diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 00000000000..1e1776fd566 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,25 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +[paths] +source = + cuda\ + cuda/ + +[run] +plugins = Cython.Coverage +core = ctrace +branch = False +relative_files = True +# Omits specific definition files that causes plugin errors +omit = + */windll.pxd + */_lib/windll.pxd + */_lib/utils.pxd + +[report] +show_missing = true +precision = 2 + +[html] +show_contexts = True diff --git a/.git_archival.txt b/.git_archival.txt new file mode 100644 index 00000000000..b651b9d07dc --- /dev/null +++ b/.git_archival.txt @@ -0,0 +1,3 @@ +node: $Format:%H$ +node-date: $Format:%cI$ +ref-names: $Format:%D$ diff --git a/.gitattributes b/.gitattributes index 8c8fc427488..1e84d118156 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1,16 @@ -cuda/_version.py export-subst +* text eol=lf +*.cmd text eol=crlf + +# Keep the vendored DLPack header byte-for-byte, but still show text diffs. +cuda_core/cuda/core/_include/dlpack.h -text !eol diff +# git should not convert line endings in PNG files +*.png binary +*.svg binary +# SCM syntax highlighting & preventing 3-way merges +pixi.lock merge=binary linguist-language=YAML linguist-generated=true + +# "export-subst" specifies that this file will get filled in with the current +# commit and tag information when running `git archive`. This allows +# `setuptools-scm` to correctly determine the version when building from a git +# archive. See #1609. +.git_archival.txt export-subst diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 00000000000..1e0b4d2c203 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,115 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +name: Bug Report +description: Create a report to help us improve +title: '[BUG]: ' +labels: ['bug'] +body: + - type: checkboxes + id: check-duplicates + attributes: + label: Is this a duplicate? + description: Check for duplicate issues. + options: + - label: I confirmed there appear to be no [duplicate issues](https://github.com/NVIDIA/cuda-python/issues) for this bug and that I agree to the [Code of Conduct](CODE_OF_CONDUCT.md) + required: true + + - type: dropdown + id: bug-type + attributes: + label: Type of Bug + description: What kind of bug are you running into? + multiple: false + options: + - Silent Failure + - Runtime Error + - Compile-time Error + - Performance + - Something else + validations: + required: true + + - type: dropdown + id: component + attributes: + label: Component + description: Which cuda-python component does this apply to? + multiple: false + options: + - cuda.pathfinder + - cuda.bindings + - cuda.core + - General cuda-python + - Infrastructure + - Not sure + validations: + required: true + + - type: textarea + id: description + attributes: + label: Describe the bug + description: A clear and concise description of what problem you are running into. + placeholder: "Attempting to compile a program via `cuda.core.Program.compile` throws a `ValueError`." + validations: + required: true + + - type: textarea + id: reproduction + attributes: + label: How to Reproduce + description: Steps used to reproduce the bug. + placeholder: | + 0. Construct a `cuda.core.Program` instance + 1. Call the `.compile(...)` method of the instance + 2. The call throws a `ValueError` with the following: + ``` + ValueError: Unsupported target_type="..." (supported_target_types=('ptx', 'cubin', 'ltoir')) + ``` + validations: + required: true + + - type: textarea + id: expected-behavior + attributes: + label: Expected behavior + description: A clear and concise description of what you expected to happen. + placeholder: "Using `cuda.core.Program.compile(...)` should run successfully and not throw a `ValueError`" + validations: + required: true + + - type: markdown + attributes: + value: '# System information' + + - type: input + id: operating-system + attributes: + label: Operating System + description: + If applicable, the OS version where this bug occurs. + placeholder: Ubuntu Linux 20.04 + validations: + required: false + + - type: textarea + id: nvidia-smi-output + attributes: + label: nvidia-smi output + description: If applicable, the output from running the `nvidia-smi` command. + placeholder: | + +-----------------------------------------------------------------------------+ + | NVIDIA-SMI 495.29.05 Driver Version: 495.29.05 CUDA Version: 11.5 | + |-------------------------------+----------------------+----------------------+ + | GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | + | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | + | | | MIG M. | + |===============================+======================+======================| + | 0 NVIDIA GeForce ... Off | 00000000:41:00.0 On | N/A | + | 0% 25C P8 8W / 320W | 491MiB / 10015MiB | 0% Default | + | | | N/A | + +-------------------------------+----------------------+----------------------+ + validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 00000000000..eb8c93b95da --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,9 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +blank_issues_enabled: true +contact_links: + - name: Questions + url: https://github.com/NVIDIA/cuda-python/discussions + about: Check out our Discussions page to ask and answer questions. diff --git a/.github/ISSUE_TEMPLATE/doc_request.yml b/.github/ISSUE_TEMPLATE/doc_request.yml new file mode 100644 index 00000000000..7804a6c85a5 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/doc_request.yml @@ -0,0 +1,43 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +name: Documentation Request +description: Suggest an idea to improve cuda-python +title: '[DOC]: ' +labels: ['doc'] + +body: + - type: checkboxes + id: check-duplicates + attributes: + label: Is this a duplicate? + description: Check for duplicate issues. + options: + - label: I confirmed there appear to be no [duplicate issues](https://github.com/NVIDIA/cuda-python/issues) for this bug and that I agree to the [Code of Conduct](CODE_OF_CONDUCT.md) + required: true + + - type: dropdown + id: new_or_correction + attributes: + label: Is this for new documentation, or an update to existing docs? + options: + - New + - Update + validations: + required: true + + - type: textarea + id: problem + attributes: + label: Describe the incorrect/future/missing documentation + placeholder: "Example: A code snippet mentions function foo(args) but I cannot find any documentation on it." + validations: + required: true + + - type: textarea + id: search_locs + attributes: + label: If this is a correction, please provide a link to the incorrect documentation. If this is a new documentation request, please link to where you have looked. + placeholder: | + https://nvidia.github.io/cuda-python/latest/ diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 00000000000..6d1504c4c4f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,71 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +name: Feature Request +description: Suggest an idea to improve cuda-python +title: '[FEA]: ' +labels: ['feature request'] +body: + - type: checkboxes + id: check-duplicates + attributes: + label: Is this a duplicate? + description: Check for duplicate issues. + options: + - label: I confirmed there appear to be no [duplicate issues](https://github.com/NVIDIA/cuda-python/issues) for this request and that I agree to the [Code of Conduct](CODE_OF_CONDUCT.md) + + - type: dropdown + id: area + attributes: + label: Area + description: What area does this request apply to? + multiple: false + options: + - cuda.pathfinder + - cuda.bindings + - cuda.core + - General cuda-python + - Infrastructure + - Not sure + validations: + required: true + + - type: textarea + id: description + attributes: + label: Is your feature request related to a problem? Please describe. + description: A clear and concise description of what the problem is, e.g., "I would like to be able to..." + placeholder: I would like to be able to use the equivalent of `cuda.core.Program.compile(...)` to compile my code to PTX. + validations: + required: true + + - type: textarea + id: proposed-solution + attributes: + label: Describe the solution you'd like + description: A clear and concise description of what you want to happen. + placeholder: | + Support a `ptx` target_type in the `cuda.core.Program.compile(...)` function. + validations: + required: true + + - type: textarea + id: alternatives + attributes: + label: Describe alternatives you've considered + description: + If applicable, please add a clear and concise description of any alternative solutions or features you've + considered. + placeholder: The alternatives to using `cuda.core.Program.compile(...)` are unappealing. They usually involve using lower level bindings to something like nvRTC or invoking the nvcc executable. + validations: + required: false + + - type: textarea + id: additional-context + attributes: + label: Additional context + description: Add any other context about the request here. + placeholder: This would be helpful to have a more productive development cycle in working at the intersection of CUDA and Python for my project. + validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/release_checklist.yml b/.github/ISSUE_TEMPLATE/release_checklist.yml new file mode 100644 index 00000000000..f7307fbe92a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/release_checklist.yml @@ -0,0 +1,33 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +name: Release Checklist +description: Public checklist for release managers making a subpackage release +labels: ["P0"] + +body: + - type: markdown + attributes: + value: | + This checklist is for cuda-core releases as well as cuda-bindings patches. Please go through this checklist and ensure all tasks are completed. See [RELEASE-core.md](../RELEASE-core.md) for detailed guidance on each step (cuda.core). + + - type: checkboxes + id: subpackage-tasks + attributes: + label: Tasks for cuda-core and cuda-bindings patch release + options: + - label: File an internal nvbug to communicate test plan & release schedule with QA + - label: Ensure all pending PRs are reviewed, tested, and merged + - label: Check (or update if needed) the dependency requirements + - label: "Finalize the doc update, including release notes (\"Note: Touching docstrings/type annotations in code is OK during code freeze, apply your best judgement!\")" + - label: Update the docs for the new version + - label: Create a public release tag + - label: Wait for the tag-triggered CI run to complete, and use that run ID for release workflows + - label: If any code change happens, rebuild the wheels from the new tag + - label: Upload wheels to PyPI + - label: Update the conda recipe & release conda packages + - label: Post-release QA + - label: Finalize the announcement update + - label: Send out the announcement internally + - label: Send out the announcement externally (GitHub Release -> Announcement) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000000..aa51259a90b --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,13 @@ +## Description + + +closes + + + + + +## Checklist + +- [ ] New or existing tests cover these changes. +- [ ] The documentation is up to date with these changes. diff --git a/.github/RELEASE-core.md b/.github/RELEASE-core.md new file mode 100644 index 00000000000..01e182c76ef --- /dev/null +++ b/.github/RELEASE-core.md @@ -0,0 +1,266 @@ + + + +# cuda.core Release Process + +This document covers the `cuda.core` release process. For other packages: +`cuda-bindings` and `cuda-python` involve a private repository and are not +documented here; `cuda-pathfinder` is largely automated by the +[release-cuda-pathfinder.yml](workflows/release-cuda-pathfinder.yml) +workflow. + +Each section below provides detailed guidance for a step in the +[Release Checklist](ISSUE_TEMPLATE/release_checklist.yml). To start a +release, create a new issue from that template and work through it item by +item, referring back here as needed. + +--- + +## File an internal nvbug + +Create an nvbug to request that SWQA begin post-release validation. Issues +identified by that process are typically addressed in a patch release. To find +the template, search for a previous release's nvbug (e.g. by title "Release of +cuda.core") and create a new bug from the same template. + +Example: + +> **Title:** Release of cuda.core v0.6.0 +> +> **Description:** +> +> Requesting SWQA validation for the cuda.core v0.6.0 release. Please test +> the following SW combinations on all listed platforms and report any +> issues found. +> +> **SW Combinations** +> - cuda.core 0.6.0 / cuda.bindings 12.9 / CTK 12.9 / CUDA 12.9 driver +> - cuda.core 0.6.0 / cuda.bindings 13.0 / CTK 13.0 / CUDA 13.0 driver +> - cuda.core 0.6.0 / cuda.bindings 13.1 / CTK 13.1 / CUDA 13.1 driver +> +> **Platforms** +> - Linux x86-64 +> - Linux arm64 +> - Windows x86-64 (TCC and WDDM) +> - WSL +> +> **Test Plan** +> +> Functional tests as described in the cuda.core test plan. +> +> **Release Milestones** +> - Pre-release QA (this request) +> - GitHub release tag and posting +> - PyPI wheel upload +> - Post-release validation + +Update the version, SW combinations (check with the release owner), and +platforms as appropriate for each release. + +--- + +## Check (or update if needed) the dependency requirements + +Review `cuda_core/pyproject.toml` and verify that all dependency +requirements are current. + +--- + +## Finalize the doc update, including release notes + +Review every PR included in the release. For each one, check whether new +functions, classes, or features were added and whether they have complete +docstrings. Add or edit docstrings as needed — touching docstrings and +type annotations in code is OK during code freeze. + +Write the release notes in `cuda_core/docs/source/release/`. Look at +historical release notes for guidance on format and structure. Balance all +entries for length, specificity, tone, and consistency. Highlight a few +notable items in the highlights section, keeping their full entries in the +appropriate sections below. + +--- + +## Update the docs for the new version + +Add the new version to +`cuda_core/docs/nv-versions.json`. This file drives the version +switcher on the documentation site. Add an entry for the new version +after `"latest"`, following the existing pattern. The docs themselves are +built and deployed automatically by the release workflow. + +--- + +## Create a public release tag + +**Warning:** Pushing a tag is a potentially irrevocable action. Be absolutely +certain the tag points to the correct commit before pushing. + +Tags should be GPG-signed. The tag name format is `cuda-core-v` +(e.g. `cuda-core-v0.6.0`). The tag must point to a commit on `main`. + +```bash +git checkout main +git pull origin main +git tag -s cuda-core-v0.6.0 -m "cuda-core v0.6.0" +git push origin cuda-core-v0.6.0 +``` + +--- + +## Wait for the tag-triggered CI run to complete + +Pushing the tag triggers a CI run automatically. Monitor it in the +**Actions** tab on GitHub. + +- **All CI tests should succeed.** If any fail, investigate and rerun as + needed. +- Note the **run ID** of the successful tag-triggered run. The release + workflow can auto-detect it from the tag, but you can also provide it + explicitly. + +--- + +## Upload wheels to PyPI + +This is a single `CI: Release` workflow run with two sequential stages: +publish to TestPyPI, then publish the same wheel set to PyPI. + +1. Go to **Actions > CI: Release** and run the workflow with: + - **Component**: `cuda-core` + - **The release git tag**: `cuda-core-v0.6.0` + + The workflow automatically looks up the successful tag-triggered CI run + for the selected release tag. + +2. Wait for the workflow to complete. It will: + - publish the selected wheels to TestPyPI + - publish the same wheel set to PyPI + +3. After completion, verify the final PyPI upload: + +```bash +pip install cuda-core==0.6.0 +``` + +--- + +## Update the conda recipe & release conda packages + +The conda-forge feedstock builds from the GitHub Release source archive +(not from PyPI). There are three approaches to updating the feedstock, +from least effort to most control. + +### Approach A: Wait for the bot + +The `regro-cf-autotick-bot` periodically scans for new releases and opens +a PR automatically. If nothing has changed in the build requirements, the +bot's PR may be sufficient — review it and ask a feedstock maintainer +to merge. However, the bot only +updates the version and sha256. If build dependencies, import paths, or +other recipe fields have changed, the bot's PR will be incomplete and CI +will fail. + +### Approach B: Request a bot update + +If the bot hasn't opened a PR, you can request one explicitly. Go to the +feedstock's Issues tab and create a new "Bot commands" issue: + +- **Title**: `@conda-forge-admin, please update version` +- **Body**: (leave empty) + +This triggers the bot to create a version-bump PR. As with approach A, +review the PR and push additional fixes if needed. + +### Approach C: Manual PR + +For full control — or when the bot's PR needs extensive fixes — open a +PR manually from a fork. + +**Fork and clone** (one-time setup): + +```bash +gh repo fork conda-forge/cuda-core-feedstock --clone +cd cuda-core-feedstock +``` + +**Create a branch and edit `recipe/meta.yaml`:** + +```bash +git checkout -b update-v0.6.0 origin/main +``` + +Update the following fields: + +1. **`version`**: Set to the new version (e.g. `0.6.0`). +2. **`number`** (build number): Reset to `0` for a new version. +3. **`sha256`**: The SHA-256 of the source archive from the GitHub + Release. Download it and compute the hash: + + ```bash + curl -sL https://github.com/NVIDIA/cuda-python/releases/download/cuda-core-v0.6.0/cuda-python-cuda-core-v0.6.0.tar.gz \ + | sha256sum + ``` + +4. **Host dependencies**: Ensure all build-time dependencies are listed. + For example, v0.6.0 added a Cython C++ dependency on `nvrtc.h`, + requiring `cuda-nvrtc-dev` in both `host` requirements and + `ignore_run_exports_from`. + +5. **Test commands and descriptions**: Update any import paths or + descriptions that changed (e.g. `cuda.core.experimental` -> + `cuda.core`). + +**Open a PR:** + +```bash +git add recipe/meta.yaml +git commit -m "Update cuda-core to 0.6.0" +git push update-v0.6.0 + +gh pr create \ + --repo conda-forge/cuda-core-feedstock \ + --head :update-v0.6.0 \ + --title "Update cuda-core to 0.6.0" \ + --body "Update cuda-core to version 0.6.0." +``` + +### Notes + +The feedstock CI (Azure Pipelines) triggers automatically on the PR. +Monitor it for build failures — common issues include missing build-time +header dependencies. Feedstock maintainers (listed in +`recipe/meta.yaml` under `extra.recipe-maintainers`) can merge the PR. + +--- + +## Post-release QA + +*TBD* + +--- + +## Finalize the announcement update + +The release workflow creates a draft GitHub Release. To publish it: + +1. Go to the repository on GitHub, click **Tags**, then switch to the + **Releases** tab. +2. Find the draft release for the new tag and click **Edit**. +3. Copy the body from a previous release as a starting point. It + typically links to the release notes in the documentation (e.g. + `https://nvidia.github.io/cuda-python/cuda-core/latest/release/0.6.0-notes.html`). +4. Update the link and any version references, then click + **Publish release**. + +--- + +## Send out the announcement internally + +The release owner will prepare and send the announcement. + +--- + +## Send out the announcement externally (GitHub Release -> Announcement) + +*TBD* diff --git a/.github/actionlint.yaml b/.github/actionlint.yaml new file mode 100644 index 00000000000..db23ece3410 --- /dev/null +++ b/.github/actionlint.yaml @@ -0,0 +1,10 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +# Self-hosted runner labels used in CI workflows. +# Without this config, actionlint rejects non-GitHub-hosted labels. +self-hosted-runner: + labels: + - linux-amd64-cpu8 + - linux-amd64-gpu-l4-latest-1 diff --git a/.github/actions/doc_preview/action.yml b/.github/actions/doc_preview/action.yml new file mode 100644 index 00000000000..0c60b899fbf --- /dev/null +++ b/.github/actions/doc_preview/action.yml @@ -0,0 +1,71 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +name: Docs in PRs +description: Preview or clean up docs built from PRs + +# A re-implementation based on the logic of https://github.com/rossjrw/pr-preview-action/blob/41a957c44a456a34718e9bcf825363194db5e6d5/README.md, due to limitations illustrated in NVIDIA/cuda-python#380. + +inputs: + source-folder: + required: true + description: "Source code directory" + pr-number: + required: true + description: "Pull request number" + +runs: + using: composite + steps: + # The steps below are executed only when testing in a PR. + # Note: the PR previews will be removed once merged to main or release/* (see below) + - name: Deploy doc preview + if: ${{ github.ref_name != 'main' && !startsWith(github.ref_name, 'release/') }} + uses: JamesIves/github-pages-deploy-action@d92aa235d04922e8f08b40ce78cc5442fcfbfa2f # v4.8.0 + with: + git-config-name: cuda-python-bot + git-config-email: cuda-python-bot@users.noreply.github.com + folder: ${{ inputs.source-folder }} + target-folder: docs/pr-preview/pr-${{ inputs.pr-number }}/ + commit-message: "Deploy doc preview for PR ${{ inputs.pr-number }} (${{ github.sha }})" + + - name: Leave a comment after deployment + if: ${{ github.ref_name != 'main' && !startsWith(github.ref_name, 'release/') }} + uses: marocchino/sticky-pull-request-comment@d4d6b0936434b21bc8345ad45a440c5f7d2c40ff # v3.0.3 + with: + header: pr-preview + number: ${{ inputs.pr-number }} + skip_unchanged: true + message: | + Doc Preview CI + :---: + |

:rocket: View preview at
https://nvidia.github.io/cuda-python/pr-preview/pr-${{ inputs.pr-number }}/
+ |
https://nvidia.github.io/cuda-python/pr-preview/pr-${{ inputs.pr-number }}/cuda-core/
+ |
https://nvidia.github.io/cuda-python/pr-preview/pr-${{ inputs.pr-number }}/cuda-bindings/
+ |
https://nvidia.github.io/cuda-python/pr-preview/pr-${{ inputs.pr-number }}/cuda-pathfinder/

+ |

Preview will be ready when the GitHub Pages deployment is complete.

+ + # The steps below are executed only when building on main or release/*. + - name: Remove doc preview + if: ${{ github.ref_name == 'main' || startsWith(github.ref_name, 'release/') }} + uses: JamesIves/github-pages-deploy-action@d92aa235d04922e8f08b40ce78cc5442fcfbfa2f # v4.8.0 + with: + git-config-name: cuda-python-bot + git-config-email: cuda-python-bot@users.noreply.github.com + folder: ${{ inputs.source-folder }} + target-folder: docs/pr-preview/pr-${{ inputs.pr-number }}/ + commit-message: "Clean up doc preview for PR ${{ inputs.pr-number }} (${{ github.sha }})" + + - name: Leave a comment after removal + if: ${{ github.ref_name == 'main' || startsWith(github.ref_name, 'release/') }} + uses: marocchino/sticky-pull-request-comment@d4d6b0936434b21bc8345ad45a440c5f7d2c40ff # v3.0.3 + with: + header: pr-preview + number: ${{ inputs.pr-number }} + hide_and_recreate: true + hide_classify: "OUTDATED" + message: | + Doc Preview CI + :---: + Preview removed because the pull request was closed or merged. diff --git a/.github/actions/fetch_ctk/action.yml b/.github/actions/fetch_ctk/action.yml new file mode 100644 index 00000000000..b4a49789779 --- /dev/null +++ b/.github/actions/fetch_ctk/action.yml @@ -0,0 +1,180 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +name: Fetch mini CTK + +description: Fetch (or create) a mini CUDA Toolkit from cache + +inputs: + host-platform: + required: true + cuda-version: + required: true + cuda-components: + description: "A list of the CTK components to install as a comma-separated list. e.g. 'cuda_nvcc,cuda_nvrtc,cuda_cudart'" + required: false + default: "cuda_nvcc,cuda_cudart,cuda_crt,libnvvm,cuda_nvrtc,cuda_profiler_api,cuda_cccl,cuda_cupti,libnvjitlink,libcufile,libnvfatbin,libcudla" + cuda-path: + description: "where the CTK components will be installed to, relative to $PWD" + required: false + default: "./cuda_toolkit" + +runs: + using: composite + steps: + - name: Set up CTK cache variable + shell: bash --noprofile --norc -xeuo pipefail {0} + run: | + # Pre-process the component list to ensure hash uniqueness + # Use the runtime workspace mount so this also works inside container jobs. + CTK_REDIST_TOOL="${GITHUB_WORKSPACE}/ci/tools/fetch_ctk_redistrib.py" + CTK_CACHE_COMPONENTS=${{ inputs.cuda-components }} + CTK_JSON_URL="https://developer.download.nvidia.com/compute/cuda/redist/redistrib_${{ inputs.cuda-version }}.json" + CTK_CACHE_COMPONENTS="$(python "$CTK_REDIST_TOOL" filter-components \ + --host-platform "${{ inputs.host-platform }}" \ + --cuda-version "${{ inputs.cuda-version }}" \ + --components "$CTK_CACHE_COMPONENTS" \ + --metadata-url "$CTK_JSON_URL")" + + HASH=$(echo -n "${CTK_CACHE_COMPONENTS}" | sha256sum | awk '{print $1}') + echo "CTK_CACHE_KEY=mini-ctk-${{ inputs.cuda-version }}-${{ inputs.host-platform }}-$HASH" >> $GITHUB_ENV + echo "CTK_CACHE_FILENAME=mini-ctk-${{ inputs.cuda-version }}-${{ inputs.host-platform }}-$HASH.tar.gz" >> $GITHUB_ENV + echo "CTK_CACHE_COMPONENTS=${CTK_CACHE_COMPONENTS}" >> $GITHUB_ENV + + - name: Install dependencies + uses: ./.github/actions/install_unix_deps + continue-on-error: false + with: + dependencies: "zstd curl xz-utils" + dependent_exes: "zstd curl xz" + + - name: Download CTK cache + id: ctk-get-cache + uses: actions/cache/restore@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 + continue-on-error: true + with: + key: ${{ env.CTK_CACHE_KEY }} + path: ./${{ env.CTK_CACHE_FILENAME }} + fail-on-cache-miss: false + + - name: Get CUDA components + if: ${{ steps.ctk-get-cache.outputs.cache-hit != 'true' }} + shell: bash --noprofile --norc -xeuo pipefail {0} + run: | + # Everything under this folder is packed and stored in the GitHub Cache space, + # and unpacked after retrieving from the cache. + CACHE_TMP_DIR="./cache_tmp_dir" + rm -rf $CACHE_TMP_DIR + mkdir $CACHE_TMP_DIR + + # The binary archives (redist) are guaranteed to be updated as part of the release posting. + # Use the runtime workspace mount so this also works inside container jobs. + CTK_REDIST_TOOL="${GITHUB_WORKSPACE}/ci/tools/fetch_ctk_redistrib.py" + CTK_BASE_URL="https://developer.download.nvidia.com/compute/cuda/redist/" + CTK_JSON_URL="$CTK_BASE_URL/redistrib_${{ inputs.cuda-version }}.json" + CTK_JSON_FILE="$CACHE_TMP_DIR/redistrib.json" + curl -LSs "$CTK_JSON_URL" -o "$CTK_JSON_FILE" + if [[ "${{ inputs.host-platform }}" == linux* ]]; then + function extract() { + tar -xvf $1 -C $CACHE_TMP_DIR --strip-components=1 + } + elif [[ "${{ inputs.host-platform }}" == "win-64" ]]; then + function extract() { + _TEMP_DIR_=$(mktemp -d) + unzip $1 -d $_TEMP_DIR_ + cp -r $_TEMP_DIR_/*/* $CACHE_TMP_DIR + rm -rf $_TEMP_DIR_ + # see commit NVIDIA/cuda-python@69410f1d9228e775845ef6c8b4a9c7f37ffc68a5 + chmod 644 $CACHE_TMP_DIR/LICENSE + } + fi + function populate_cuda_path() { + # take the component name as a argument + function download() { + curl -LSs $1 -o $2 + } + CTK_COMPONENT=$1 + CTK_COMPONENT_REL_PATH="$(python "$CTK_REDIST_TOOL" component-relative-path \ + --host-platform "${{ inputs.host-platform }}" \ + --component "$CTK_COMPONENT" \ + --metadata-path "$CTK_JSON_FILE")" + CTK_COMPONENT_URL="${CTK_BASE_URL}/${CTK_COMPONENT_REL_PATH}" + CTK_COMPONENT_COMPONENT_FILENAME="$(basename $CTK_COMPONENT_REL_PATH)" + download $CTK_COMPONENT_URL $CTK_COMPONENT_COMPONENT_FILENAME + extract $CTK_COMPONENT_COMPONENT_FILENAME + rm $CTK_COMPONENT_COMPONENT_FILENAME + } + + # Get headers and shared libraries in place + for item in $(echo $CTK_CACHE_COMPONENTS | tr ',' ' '); do + populate_cuda_path "$item" + done + # TODO: check Windows + if [[ "${{ inputs.host-platform }}" == linux* && -d "${CACHE_TMP_DIR}/lib" ]]; then + mv $CACHE_TMP_DIR/lib $CACHE_TMP_DIR/lib64 + fi + ls -l $CACHE_TMP_DIR + + # Prepare the cache + # Note: try to escape | and > ... + tar -czvf ${CTK_CACHE_FILENAME} ${CACHE_TMP_DIR} + + # "Move" files from temp dir to CUDA_PATH + CUDA_PATH="./cuda_toolkit" + mkdir -p $CUDA_PATH + # Unfortunately we cannot use "rsync -av $CACHE_TMP_DIR/ $CUDA_PATH" because + # not all runners have rsync pre-installed (or even installable, such as + # Git Bash). We do it in the dumb way. + cp -r $CACHE_TMP_DIR/* $CUDA_PATH + rm -rf $CACHE_TMP_DIR + ls -l $CUDA_PATH + + - name: Upload CTK cache + if: ${{ !cancelled() && + steps.ctk-get-cache.outputs.cache-hit != 'true' }} + uses: actions/cache/save@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 + with: + key: ${{ env.CTK_CACHE_KEY }} + path: ./${{ env.CTK_CACHE_FILENAME }} + + - name: Restore CTK cache + if: ${{ steps.ctk-get-cache.outputs.cache-hit == 'true' }} + shell: bash --noprofile --norc -xeuo pipefail {0} + run: | + ls -l + CACHE_TMP_DIR="./cache_tmp_dir" + CUDA_PATH="./cuda_toolkit" + mkdir -p $CUDA_PATH + tar -xzvf $CTK_CACHE_FILENAME + # Can't use rsync here, see above + cp -r $CACHE_TMP_DIR/* $CUDA_PATH + rm -rf $CACHE_TMP_DIR $CTK_CACHE_FILENAME + ls -l $CUDA_PATH + if [ ! -d "$CUDA_PATH/include" ]; then + exit 1 + fi + + - name: Move CTK to the specified location + if: ${{ inputs.cuda-path != './cuda_toolkit' }} + shell: bash --noprofile --norc -xeuo pipefail {0} + run: | + mv ./cuda_toolkit ${{ inputs.cuda-path }} + + - name: Set output environment variables + shell: bash --noprofile --norc -xeuo pipefail {0} + run: | + # mimics actual CTK installation + if [[ "${{ inputs.host-platform }}" == linux* ]]; then + CUDA_PATH=$(realpath "${{ inputs.cuda-path }}") + echo "${CUDA_PATH}/bin" >> $GITHUB_PATH + echo "LD_LIBRARY_PATH=${CUDA_PATH}/lib64:${LD_LIBRARY_PATH:-}" >> $GITHUB_ENV + elif [[ "${{ inputs.host-platform }}" == win* ]]; then + function normpath() { + echo "$(echo $(cygpath -w $1) | sed 's/\\/\\\\/g')" + } + CUDA_PATH=$(normpath $(realpath "${{ inputs.cuda-path }}")) + echo "$(normpath ${CUDA_PATH}/bin)" >> $GITHUB_PATH + fi + echo "CUDA_PATH=${CUDA_PATH}" >> $GITHUB_ENV + echo "CUDA_HOME=${CUDA_PATH}" >> $GITHUB_ENV diff --git a/.github/actions/get_pr_number/action.yml b/.github/actions/get_pr_number/action.yml new file mode 100644 index 00000000000..1641f806849 --- /dev/null +++ b/.github/actions/get_pr_number/action.yml @@ -0,0 +1,58 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +name: Get the PR number + +description: Get the PR number without relying on the pull_request* event triggers. + +runs: + using: composite + steps: + - name: Get PR info (non-main, non-release branch) + if: ${{ github.ref_name != 'main' && !startsWith(github.ref_name, 'release/') }} + uses: nv-gha-runners/get-pr-info@main + id: get-pr-info + + - name: Extract PR number (non-main, non-release branch) + if: ${{ github.ref_name != 'main' && !startsWith(github.ref_name, 'release/') }} + shell: bash --noprofile --norc -xeuo pipefail {0} + run: | + trap 'echo "Error at line $LINENO"; exit 1' ERR + PR_NUMBER="${{ fromJSON(steps.get-pr-info.outputs.pr-info).number }}" + if [[ -z "$PR_NUMBER" ]]; then + echo "Cannot extract PR number for ref: ${{ github.ref_name }}" + exit 1 + fi + echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV + echo "BUILD_PREVIEW=1" >> $GITHUB_ENV + + - name: Get PR data (main or release/* branch) + if: ${{ github.ref_name == 'main' || startsWith(github.ref_name, 'release/') }} + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 + id: get-pr-data + with: + script: | + const prs = await github.rest.repos.listPullRequestsAssociatedWithCommit({ + commit_sha: context.sha, + owner: context.repo.owner, + repo: context.repo.repo, + }); + if (!prs.data.length) { + core.setFailed("No PR associated with this commit on 'main' or 'release/*'."); + } else { + return prs.data[0]; + } + + - name: Extract PR number (main or release/* branch) + if: ${{ github.ref_name == 'main' || startsWith(github.ref_name, 'release/') }} + shell: bash --noprofile --norc -xeuo pipefail {0} + run: | + trap 'echo "Error at line $LINENO"; exit 1' ERR + PR_NUMBER="${{ fromJSON(steps.get-pr-data.outputs.result).number }}" + if [[ -z "$PR_NUMBER" ]]; then + echo "No associated PR found for the commit in 'main' or 'release/*'." + exit 1 + fi + echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV + echo "BUILD_LATEST=1" >> $GITHUB_ENV diff --git a/.github/actions/install_unix_deps/action.yml b/.github/actions/install_unix_deps/action.yml new file mode 100644 index 00000000000..b0a1831abf2 --- /dev/null +++ b/.github/actions/install_unix_deps/action.yml @@ -0,0 +1,47 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +name: Install dependencies on Ubuntu + +description: Install needed dependencies, regardless if using GitHub- or self- hosted runners, container, sudo or not. + +inputs: + dependencies: + required: true + dependent_exes: + required: true + +runs: + using: composite + steps: + - name: Install dependencies + shell: bash --noprofile --norc -xeuo pipefail {0} + run: | + dependencies=(${{ inputs.dependencies }}) + dependent_exes=(${{ inputs.dependent_exes }}) + + not_found=0 + for dep in ${dependent_exes[@]}; do + if ! (command -v $dep 2>&1 >/dev/null); then + not_found=1 + break + fi + done + if [[ $not_found == 0 ]]; then + echo "All dependencies are found. Do nothing." + exit 0 + fi + if ! (command -v sudo 2>&1 >/dev/null); then + if [[ $EUID == 0 ]]; then + alias SUDO="" + else + echo "The following oprations require root access." + exit 1 + fi + else + alias SUDO="sudo" + fi + shopt -s expand_aliases + SUDO apt update + SUDO apt install -y ${dependencies[@]} diff --git a/.github/actions/sccache-summary/action.yml b/.github/actions/sccache-summary/action.yml new file mode 100644 index 00000000000..28734116f62 --- /dev/null +++ b/.github/actions/sccache-summary/action.yml @@ -0,0 +1,80 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +name: sccache summary +description: Parse sccache stats JSON and write a summary table to GITHUB_STEP_SUMMARY + +# Inspired by NVIDIA/cccl's prepare-execution-summary.py (PR #3621). + +inputs: + json-file: + description: "Path to the sccache stats JSON file (from sccache --show-stats --stats-format=json)" + required: true + label: + description: "Label for the stats row (e.g. cuda.bindings, cuda.core)" + required: false + default: "sccache" + build-step: + description: "Name of the cibuildwheel build step (for deep-link in summary)" + required: false + default: "" + +runs: + using: composite + steps: + - name: Report sccache stats + shell: bash --noprofile --norc -euo pipefail {0} + env: + SCCACHE_JSON: ${{ inputs.json-file }} + SCCACHE_LABEL: ${{ inputs.label }} + SCCACHE_BUILD_STEP: ${{ inputs.build-step }} + run: | + if [ ! -f "$SCCACHE_JSON" ]; then + echo "::warning::sccache stats file not found: $SCCACHE_JSON" + exit 0 + fi + + python3 - <<'PYEOF' + import json, os, urllib.parse + + json_file = os.environ["SCCACHE_JSON"] + label = os.environ["SCCACHE_LABEL"] + build_step = os.environ.get("SCCACHE_BUILD_STEP", "") + + with open(json_file) as f: + stats = json.load(f)["stats"] + + # compile_requests only counts top-level nvcc invocations, but each + # invocation spawns sub-tool compilations (cudafe++, cicc, ptxas) that + # sccache tracks under separate language keys. Count all of them so + # the reported rate matches sccache's own "Cache hits rate". + counted_languages = {"C/C++", "CUDA", "CUDA (Device code)", "PTX", "CUBIN"} + hits = sum( + v for k, v in stats.get("cache_hits", {}).get("counts", {}).items() + if k in counted_languages + ) + misses = sum( + v for k, v in stats.get("cache_misses", {}).get("counts", {}).items() + if k in counted_languages + ) + total = hits + misses + pct = int(100 * hits / total) if total > 0 else 0 + + # Build a deep-link to the cibuildwheel step if step name is provided. + # GHA step summary links use the format: #step:N:L but we can't know the + # step number here. Instead, link to the job page with a search hint. + link_note = "" + if build_step: + link_note = f"\n\n_Full stats in the **{build_step}** step log._\n" + + summary_file = os.environ.get("GITHUB_STEP_SUMMARY", "") + if summary_file: + with open(summary_file, "a") as sf: + sf.write(f"### 📊 {label} — sccache stats\n") + sf.write("| Hit Rate | Hits | Misses | Requests |\n") + sf.write("|----------|------|--------|----------|\n") + sf.write(f"| {pct}% | {hits} | {misses} | {total} |{link_note}\n") + + print(f"{label}: {pct}% hit rate ({hits}/{total})") + PYEOF diff --git a/.github/copy-pr-bot.yaml b/.github/copy-pr-bot.yaml new file mode 100644 index 00000000000..e2fc4a5f4a2 --- /dev/null +++ b/.github/copy-pr-bot.yaml @@ -0,0 +1,10 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +# Configuration file for `copy-pr-bot` GitHub App +# https://docs.gha-runners.nvidia.com/apps/copy-pr-bot/ + +enabled: true +# auto-sync ready PRs so CI starts immediately; keep draft PRs manual +auto_sync_draft: false +auto_sync_ready: true diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000000..8c8e4274c41 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,40 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +version: 2 +updates: + # GitHub Actions updates targeting the default branch (main) + - package-ecosystem: github-actions + directory: / + schedule: + interval: "monthly" + time: "09:00" + timezone: "America/Los_Angeles" + + # Keep churn down: only one open PR from this ecosystem at a time + open-pull-requests-limit: 1 + + groups: + actions-monthly: + applies-to: version-updates + patterns: ["*"] + update-types: ["major", "minor", "patch"] + + # GitHub Actions updates targeting the 12.9.x branch + - package-ecosystem: github-actions + directory: / + target-branch: "12.9.x" # keep in sync with backport_branch in ci/versions.yml + schedule: + interval: "monthly" + time: "09:00" + timezone: "America/Los_Angeles" + + # Keep churn down: only one open PR from this ecosystem at a time + open-pull-requests-limit: 1 + + groups: + actions-monthly: + applies-to: version-updates + patterns: ["*"] + update-types: ["major", "minor", "patch"] diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 00000000000..62b46533816 --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,24 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +# Configuration for https://github.com/actions/labeler +# Auto-applies labels based on which files a PR changes. + +cuda.bindings: + - changed-files: + - any-glob-to-any-file: 'cuda_bindings/**' + +cuda.core: + - changed-files: + - any-glob-to-any-file: 'cuda_core/**' + +cuda.pathfinder: + - changed-files: + - any-glob-to-any-file: 'cuda_pathfinder/**' + +CI/CD: + - changed-files: + - any-glob-to-any-file: + - '.github/**' + - 'ci/**' diff --git a/.github/workflows/backport.yml b/.github/workflows/backport.yml new file mode 100644 index 00000000000..a3573bc14d4 --- /dev/null +++ b/.github/workflows/backport.yml @@ -0,0 +1,76 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +name: "CI: Backport the merged PR" + +on: + pull_request_target: + types: [closed, labeled] + branches: + - main + workflow_dispatch: + inputs: + backport-branch: + description: "Branch to backport commits onto" + required: false + type: string + pull-request: + description: "PR to backport" + required: true + type: number + + +permissions: + contents: write # so it can comment + pull-requests: write # so it can create pull requests + +jobs: + backport-from-pr: + name: Backport directly from a pull request + if: ${{ github.repository_owner == 'nvidia' && + github.event.pull_request.merged == true && + contains( github.event.pull_request.labels.*.name, 'to-be-backported') + }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + + - name: Load branch name + id: get-branch + run: | + OLD_BRANCH=$(yq '.backport_branch' ci/versions.yml) + echo "OLD_BRANCH=${OLD_BRANCH}" >> $GITHUB_ENV + + - name: Create backport pull requests + uses: korthout/backport-action@66065406958f46e82238fd59546f5a99e69e22aa # v4.5.2 + with: + copy_assignees: true + copy_labels_pattern: true + copy_requested_reviewers: true + target_branches: ${{ env.OLD_BRANCH }} + backport-to-branch: + name: Backport a specific PR against a specific branch + if: github.repository_owner == 'nvidia' && github.event_name == 'workflow_dispatch' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + + - name: Load branch from environment name + if: inputs.backport-branch == null + run: | + BACKPORT_BRANCH=$(yq '.backport_branch' ci/versions.yml) + echo "BACKPORT_BRANCH=${BRANCH}" >> $GITHUB_ENV + + - name: Load branch name from input + if: inputs.backport-branch != null + run: echo "BACKPORT_BRANCH=${{ inputs.backport-branch }}" >> $GITHUB_ENV + + - name: Create backport pull requests + uses: korthout/backport-action@66065406958f46e82238fd59546f5a99e69e22aa # v4.5.2 + with: + copy_assignees: true + copy_labels_pattern: true + copy_requested_reviewers: true + target_branches: ${{ env.BACKPORT_BRANCH }} + source_pr_number: ${{ inputs.pull-request }} diff --git a/.github/workflows/bandit.yml b/.github/workflows/bandit.yml new file mode 100644 index 00000000000..bd09d8e66ce --- /dev/null +++ b/.github/workflows/bandit.yml @@ -0,0 +1,50 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +name: "Static Analysis: Bandit Scan" + +on: + push: + branches: + - "pull-request/[0-9]+" + - "ctk-next" + - "main" +concurrency: + group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} + cancel-in-progress: true + +jobs: + analyze: + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + steps: + - name: Checkout + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + + - name: Install uv + uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 + with: + enable-cache: false + + - name: Get ignore codes + id: ignore-codes + # This are computed so that we can run only the `S` (bandit) + # checks. Passing --select to ruff overrides any config files + # (ruff.toml, pyproject.toml, etc), so to avoid having keep everything + # in sync we grab them from the TOML programmatically + run: | + set -euxo pipefail + + echo "codes=$(uvx toml2json ./ruff.toml | jq -r '.lint.ignore | map(select(test("^S\\d+"))) | join(",")')" >> "$GITHUB_OUTPUT" + - name: Perform Bandit Analysis using Ruff + uses: astral-sh/ruff-action@0ce1b0bf8b818ef400413f810f8a11cdbda0034b # v4.0.0 + with: + args: "check --select S --ignore ${{ steps.ignore-codes.outputs.codes }} --output-format sarif --output-file results.sarif" + - name: Upload SARIF file + uses: github/codeql-action/upload-sarif@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4.36.2 + with: + sarif_file: results.sarif diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml new file mode 100644 index 00000000000..7bb70809556 --- /dev/null +++ b/.github/workflows/build-docs.yml @@ -0,0 +1,359 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +name: "CI: Build and update docs" + +on: + workflow_call: + inputs: + component: + description: "Component(s) to build docs for" + required: false + default: "all" + type: string + # below are the acceptable options: + # - cuda-core + # - cuda-bindings + # - cuda-python + # - cuda-pathfinder + # - all + git-tag: + description: "Target git tag to build docs for" + required: false + default: "" + type: string + run-id: + description: "The GHA run ID that generated validated artifacts" + required: false + default: ${{ github.run_id }} + type: string + is-release: + description: "Are we building release docs?" + required: false + default: false + type: boolean + deploy-docs: + description: "Deploy generated docs to GitHub Pages or preview branches" + required: false + default: true + type: boolean + docs-branch: + description: "Branch that receives deployed docs" + required: false + default: "gh-pages" + type: string + +jobs: + build: + name: Build docs + # The build stage could fail but we want the CI to keep moving. + if: ${{ github.repository_owner == 'nvidia' && !cancelled() }} + runs-on: ubuntu-latest + defaults: + run: + shell: bash -el {0} + steps: + - name: Checkout ${{ github.event.repository.name }} + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + with: + fetch-depth: 1 + ref: ${{ inputs.git-tag }} + + - name: Read build CTK version + run: | + if [[ -f ci/versions.yml ]]; then + BUILD_CTK_VER=$(yq '.cuda.build.version' ci/versions.yml) + elif [[ -f ci/versions.json ]]; then + BUILD_CTK_VER=$(jq -r '.cuda.build.version' ci/versions.json) + else + echo "error: cannot find ci/versions.yml or ci/versions.json" >&2 + exit 1 + fi + if [[ ! "${BUILD_CTK_VER}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo "error: derived CTK build version ${BUILD_CTK_VER} does not match MAJOR.MINOR.MICRO" >&2 + exit 1 + fi + echo "BUILD_CTK_VER=${BUILD_CTK_VER}" >> "$GITHUB_ENV" + + # TODO: This workflow runs on GH-hosted runner and cannot use the proxy cache + + - name: Set up miniforge + uses: conda-incubator/setup-miniconda@8ee1f361103df19b6f8c8655fd3967a8ecb162d5 # v4.0.1 + with: + activate-environment: cuda-python-docs + environment-file: ./cuda_python/docs/environment-docs.yml + miniforge-version: latest + conda-remove-defaults: "true" + python-version: 3.12 + + - name: Check conda env + run: | + conda info + conda list + conda config --show-sources + conda config --show + + # WAR: Building the doc currently requires CTK installed (NVIDIA/cuda-python#326,327) + - name: Set up mini CTK + uses: ./.github/actions/fetch_ctk + with: + host-platform: linux-64 + cuda-version: ${{ env.BUILD_CTK_VER }} + + - name: Set environment variables + run: | + PYTHON_VERSION_FORMATTED="312" # see above + REPO_DIR=$(pwd) + + if [[ ${{ inputs.is-release }} == "true" ]]; then + FILE_HASH="*" + DOCS_GITHUB_REF="${{ inputs.git-tag }}" + if [[ -z "${DOCS_GITHUB_REF}" ]]; then + DOCS_GITHUB_REF="${GITHUB_REF_NAME}" + fi + else + FILE_HASH="${{ github.sha }}" + DOCS_GITHUB_REF="${{ github.sha }}" + fi + + # make outputs from the previous job as env vars + CUDA_CORE_ARTIFACT_BASENAME="cuda-core-python${PYTHON_VERSION_FORMATTED}-linux-64" + echo "CUDA_PYTHON_DOCS_GITHUB_REF=${DOCS_GITHUB_REF}" >> $GITHUB_ENV + echo "CUDA_CORE_ARTIFACT_BASENAME=${CUDA_CORE_ARTIFACT_BASENAME}" >> $GITHUB_ENV + echo "CUDA_CORE_ARTIFACT_NAME=${CUDA_CORE_ARTIFACT_BASENAME}-${FILE_HASH}" >> $GITHUB_ENV + echo "CUDA_CORE_ARTIFACTS_DIR=$(realpath "$REPO_DIR/cuda_core/dist")" >> $GITHUB_ENV + CUDA_BINDINGS_ARTIFACT_BASENAME="cuda-bindings-python${PYTHON_VERSION_FORMATTED}-cuda${BUILD_CTK_VER}-linux-64" + echo "CUDA_BINDINGS_ARTIFACT_BASENAME=${CUDA_BINDINGS_ARTIFACT_BASENAME}" >> $GITHUB_ENV + echo "CUDA_BINDINGS_ARTIFACT_NAME=${CUDA_BINDINGS_ARTIFACT_BASENAME}-${FILE_HASH}" >> $GITHUB_ENV + echo "CUDA_BINDINGS_ARTIFACTS_DIR=$(realpath "$REPO_DIR/cuda_bindings/dist")" >> $GITHUB_ENV + + - name: Download cuda-python build artifacts + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: cuda-python-wheel + path: . + run-id: ${{ inputs.run-id }} + github-token: ${{ github.token }} + + - name: Display structure of downloaded cuda-python artifacts + run: | + pwd + ls -lahR . + + - name: Download cuda-pathfinder build artifacts + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: cuda-pathfinder-wheel + path: ./cuda_pathfinder + run-id: ${{ inputs.run-id }} + github-token: ${{ github.token }} + + - name: Display structure of downloaded cuda-pathfinder artifacts + run: | + pwd + ls -lahR cuda_pathfinder + + - name: Download cuda.bindings build artifacts + if: ${{ !inputs.is-release }} + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: ${{ env.CUDA_BINDINGS_ARTIFACT_NAME }} + path: ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }} + + - name: Download cuda.bindings build artifacts + if: ${{ inputs.is-release }} + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + pattern: ${{ env.CUDA_BINDINGS_ARTIFACT_NAME }} + merge-multiple: true + path: ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }} + run-id: ${{ inputs.run-id }} + github-token: ${{ github.token }} + + - name: Display structure of downloaded cuda.bindings artifacts + run: | + pwd + ls -lahR $CUDA_BINDINGS_ARTIFACTS_DIR + + - name: Download cuda.core build artifacts + if: ${{ !inputs.is-release }} + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: ${{ env.CUDA_CORE_ARTIFACT_NAME }} + path: ${{ env.CUDA_CORE_ARTIFACTS_DIR }} + + - name: Download cuda.core build artifacts + if: ${{ inputs.is-release }} + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + pattern: ${{ env.CUDA_CORE_ARTIFACT_NAME }} + merge-multiple: true + path: ${{ env.CUDA_CORE_ARTIFACTS_DIR }} + run-id: ${{ inputs.run-id }} + github-token: ${{ github.token }} + + - name: Display structure of downloaded cuda.core build artifacts + run: | + pwd + ls -lahR $CUDA_CORE_ARTIFACTS_DIR + + - name: Install all packages + run: | + pushd cuda_pathfinder + pip install *.whl + popd + + pushd "${CUDA_BINDINGS_ARTIFACTS_DIR}" + pip install *.whl + popd + + pushd "${CUDA_CORE_ARTIFACTS_DIR}" + pip install *.whl + popd + + # Subpackages are already installed from CI artifacts above. + # --no-deps avoids re-resolving cuda-core from PyPI during tag releases. + pip install --no-deps cuda_python*.whl + + # This step sets the PR_NUMBER/BUILD_LATEST/BUILD_PREVIEW env vars. + - name: Get PR number + if: ${{ !inputs.is-release }} + uses: ./.github/actions/get_pr_number + + - name: Set up artifact directories + run: | + mkdir -p artifacts/docs + # create an empty folder for removal use + mkdir -p artifacts/empty_docs + + - name: Build all docs + if: ${{ inputs.component == 'all' }} + run: | + pushd cuda_python/docs/ + if [[ "${{ inputs.is-release }}" == "false" ]]; then + ./build_all_docs.sh latest-only + else + ./build_all_docs.sh + # At release time, we don't want to update the latest docs + rm -rf build/html/latest + fi + ls -l build + popd + mv cuda_python/docs/build/html/* artifacts/docs/ + + - name: Build component docs + if: ${{ inputs.component != 'all' }} + run: | + COMPONENT=$(echo "${{ inputs.component }}" | tr '-' '_') + pushd ${COMPONENT}/docs/ + if [[ "${{ inputs.is-release }}" == "false" ]]; then + ./build_docs.sh latest-only + else + ./build_docs.sh + # At release time, we don't want to update the latest docs + rm -rf build/html/latest + fi + ls -l build + popd + if [[ "${{ inputs.component }}" != "cuda-python" ]]; then + TARGET="${{ inputs.component }}" + mkdir -p artifacts/docs/${TARGET} + else + TARGET="" + fi + mv ${COMPONENT}/docs/build/html/* artifacts/docs/${TARGET} + + - name: Write rendered docs file list + if: ${{ !inputs.is-release && github.ref_name != 'main' && !startsWith(github.ref_name, 'release/') }} + run: | + find "${GITHUB_WORKSPACE}/artifacts/docs" -type f -name '*.html' ! -path '*/_static/*' \ + | LC_ALL=C sort > lychee-rendered-html-files.txt + if [[ ! -s lychee-rendered-html-files.txt ]]; then + echo "error: no rendered HTML pages found for lychee" >&2 + exit 1 + fi + wc -l lychee-rendered-html-files.txt + + - name: Restore lychee cache + if: ${{ !inputs.is-release && github.ref_name != 'main' && !startsWith(github.ref_name, 'release/') }} + id: restore-lychee-cache + uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 + with: + path: .lycheecache + key: docs-rendered-lychee-${{ env.PR_NUMBER }}-${{ github.sha }} + restore-keys: | + docs-rendered-lychee-${{ env.PR_NUMBER }}- + + - name: Check rendered docs links + if: ${{ !inputs.is-release && github.ref_name != 'main' && !startsWith(github.ref_name, 'release/') }} + uses: lycheeverse/lychee-action@6da1d14f3a43098a294b7696d93d938aa8d20fc0 # unreleased: supports v0.24.x archive layout + with: + # PR-preview canonical URLs are checked by the preview deployment workflow. + # The cuda-bindings #id links are docutils "problematic" anchors from generated API docs. + # TODO: Remove this exclusion after cybind stops emitting those problematic anchors. + # Preferred Networks rejects hosted-runner GETs, but the URL is browser reachable. + args: >- + --files-from ${{ github.workspace }}/lychee-rendered-html-files.txt + --include-fragments=full + --cache + --max-cache-age 1d + --max-concurrency 16 + --host-concurrency 2 + --host-request-interval 250ms + --max-retries 3 + --retry-wait-time 5 + --timeout 30 + --no-progress + --exclude '^https://nvidia\.github\.io/cuda-python/pr-preview/pr-[0-9]+/' + --exclude '^file://.*/cuda-bindings/latest/module/(driver|runtime)\.html#id[0-9]+$' + --exclude '^https://www\.preferred\.jp/en/?$' + fail: true + failIfEmpty: true + format: markdown + jobSummary: false + lycheeVersion: v0.24.2 + output: lychee-rendered-html.md + token: ${{ github.token }} + + - name: Save lychee cache + if: ${{ always() && !inputs.is-release && github.ref_name != 'main' && !startsWith(github.ref_name, 'release/') && steps.restore-lychee-cache.outputs.cache-hit != 'true' && steps.restore-lychee-cache.outputs.cache-primary-key != '' }} + uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 + with: + path: .lycheecache + key: ${{ steps.restore-lychee-cache.outputs.cache-primary-key }} + + - name: Upload docs GitHub Pages artifact + if: ${{ inputs.deploy-docs }} + uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0 + with: + path: artifacts/ + retention-days: 3 + + - name: Upload dry-run docs artifact + if: ${{ !inputs.deploy-docs || (inputs.is-release && inputs.docs-branch != 'gh-pages') }} + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: release-docs-dry-run-${{ inputs.component }}-${{ inputs.git-tag }} + path: artifacts/docs/ + retention-days: 3 + + - name: Deploy or clean up doc preview + if: ${{ inputs.deploy-docs && !inputs.is-release }} + uses: ./.github/actions/doc_preview + with: + source-folder: ${{ (github.ref_name != 'main' && 'artifacts/docs') || + 'artifacts/empty_docs' }} + pr-number: ${{ env.PR_NUMBER }} + + - name: Deploy doc update + if: ${{ inputs.deploy-docs && (github.ref_name == 'main' || inputs.is-release) }} + uses: JamesIves/github-pages-deploy-action@d92aa235d04922e8f08b40ce78cc5442fcfbfa2f # v4.8.0 + with: + git-config-name: cuda-python-bot + git-config-email: cuda-python-bot@users.noreply.github.com + branch: ${{ inputs.docs-branch }} + folder: artifacts/docs/ + target-folder: docs/ + commit-message: "Deploy ${{ (inputs.is-release && 'release') || 'latest' }} docs: ${{ env.CUDA_PYTHON_DOCS_GITHUB_REF }}" + clean: false diff --git a/.github/workflows/build-wheel.yml b/.github/workflows/build-wheel.yml new file mode 100644 index 00000000000..4dac9c8eca9 --- /dev/null +++ b/.github/workflows/build-wheel.yml @@ -0,0 +1,598 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +on: + workflow_call: + inputs: + host-platform: + required: true + type: string + cuda-version: + required: true + type: string + prev-cuda-version: + required: true + type: string + +defaults: + run: + shell: bash --noprofile --norc -xeuo pipefail {0} + +permissions: + contents: read # This is required for actions/checkout + +jobs: + build: + strategy: + fail-fast: false + matrix: + python-version: + - "3.10" + - "3.11" + - "3.12" + - "3.13" + - "3.14" + - "3.14t" + - "3.15" + - "3.15t" + name: py${{ matrix.python-version }} + runs-on: ${{ (inputs.host-platform == 'linux-64' && 'linux-amd64-cpu8') || + (inputs.host-platform == 'linux-aarch64' && 'linux-arm64-cpu8') || + (inputs.host-platform == 'win-64' && 'windows-2022') }} + steps: + - name: Checkout ${{ github.event.repository.name }} + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + with: + # Treeless clone: setuptools-scm needs the commit graph (`git describe`) + # but not historical blobs. + fetch-depth: 0 + filter: blob:none + + - name: Install latest rapidsai/sccache + if: ${{ startsWith(inputs.host-platform, 'linux') }} + run: | + curl -fsSL "https://github.com/rapidsai/sccache/releases/latest/download/sccache-$(uname -m)-unknown-linux-musl.tar.gz" \ + | sudo tar -C /usr/local/bin -xvzf - --wildcards --strip-components=1 -x '*/sccache' + echo "SCCACHE_PATH=/usr/local/bin/sccache" >> "$GITHUB_ENV" + + # xref: https://github.com/orgs/community/discussions/42856#discussioncomment-7678867 + - name: Adding addtional GHA cache-related env vars + uses: actions/github-script@v9 + with: + script: | + core.exportVariable('ACTIONS_CACHE_SERVICE_V2', 'on'); + core.exportVariable('ACTIONS_CACHE_URL', process.env['ACTIONS_CACHE_URL'] || ''); + core.exportVariable('ACTIONS_RESULTS_URL', process.env['ACTIONS_RESULTS_URL'] || ''); + core.exportVariable('ACTIONS_RUNTIME_URL', process.env['ACTIONS_RUNTIME_URL'] || ''); + core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env['ACTIONS_RUNTIME_TOKEN'] || ''); + + - name: Setup proxy cache + uses: nv-gha-runners/setup-proxy-cache@main + continue-on-error: true + # Skip cache on GitHub-hosted Windows runners. + if: ${{ inputs.host-platform != 'win-64' }} + with: + enable-apt: true + + - name: Set up Python + id: setup-python1 + uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0 + with: + # WAR: setup-python is not relocatable, and cibuildwheel hard-wires to 3.12... + # see https://github.com/actions/setup-python/issues/871 + python-version: "3.12" + + - name: Set up MSVC + if: ${{ startsWith(inputs.host-platform, 'win') }} + uses: step-security/msvc-dev-cmd@22c98154b708dbd743e6f27a933cf6ceba3305c4 # v1.13.1 + + - name: Set up yq + # GitHub made an unprofessional decision to not provide it in their Windows VMs, + # see https://github.com/actions/runner-images/issues/7443. + if: ${{ startsWith(inputs.host-platform, 'win') }} + env: + YQ_VERSION: v4.52.5 + YQ_SHA256: 47594981f3848a4b4447494adeca9555f908f7cf0a89c4da3fd0243a4631da1c + YQ_DIR: yq + shell: pwsh -command ". '{0}'" + run: | + $yqUrl = "https://github.com/mikefarah/yq/releases/download/${env:YQ_VERSION}/yq_windows_amd64.exe" + mkdir -Force -ErrorAction SilentlyContinue "${env:YQ_DIR}" | Out-Null + Invoke-WebRequest -UseBasicParsing -OutFile "${env:YQ_DIR}/yq.exe" -Uri "$yqUrl" + $hash = (Get-FileHash -Algorithm SHA256 "${env:YQ_DIR}/yq.exe").Hash.ToLower() + if ($hash -ne $env:YQ_SHA256) { + Write-Error "SHA256 mismatch for yq: expected $env:YQ_SHA256, got $hash" + exit 1 + } + ls -l $env:YQ_DIR + echo "$((Get-Location).Path)\\$env:YQ_DIR" >> $env:GITHUB_PATH + $env:Path += ";$((Get-Location).Path)\\$env:YQ_DIR" + yq --version + + - name: Set environment variables + env: + CUDA_VER: ${{ inputs.cuda-version }} + HOST_PLATFORM: ${{ inputs.host-platform }} + PY_VER: ${{ matrix.python-version }} + SHA: ${{ github.sha }} + run: ./ci/tools/env-vars build + + - name: Dump environment + run: | + env + + - name: Install twine + run: | + pip install twine + + # To keep the build workflow simple, all matrix jobs will build a wheel for later use within this workflow. + - name: Build and check cuda.pathfinder wheel + run: | + pushd cuda_pathfinder + pip wheel -v --no-deps . + popd + + - name: List the cuda.pathfinder artifacts directory + run: | + if [[ "${{ inputs.host-platform }}" == win* ]]; then + export CHOWN=chown + else + export CHOWN="sudo chown" + fi + $CHOWN -R $(whoami) cuda_pathfinder/*.whl + ls -lahR cuda_pathfinder + + # We only need/want a single pure python wheel, pick linux-64 index 0. + # This is what we will use for testing & releasing. + - name: Check cuda.pathfinder wheel + if: ${{ strategy.job-index == 0 && inputs.host-platform == 'linux-64' }} + run: | + twine check --strict cuda_pathfinder/*.whl + + - name: Upload cuda.pathfinder build artifacts + if: ${{ strategy.job-index == 0 && inputs.host-platform == 'linux-64' }} + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: cuda-pathfinder-wheel + path: cuda_pathfinder/*.whl + if-no-files-found: error + + - name: Set up mini CTK + uses: ./.github/actions/fetch_ctk + continue-on-error: false + with: + host-platform: ${{ inputs.host-platform }} + cuda-version: ${{ inputs.cuda-version }} + + - name: Build cuda.bindings wheel + uses: pypa/cibuildwheel@294735312765b09d24a2fbec22660ce817587d55 # v4.1.0 + with: + package-dir: ./cuda_bindings/ + output-dir: ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }} + env: + CIBW_BUILD: ${{ env.CIBW_BUILD }} + # TODO: remove cpython-prerelease once 3.15 is officially supported + # Allow CPython pre-release builds (currently 3.15 / 3.15t). This is a + # no-op for stable Python versions because CIBW_BUILD still filters + # the target version. + CIBW_ENABLE: cpython-prerelease + # CIBW mounts the host filesystem under /host + CIBW_ENVIRONMENT_LINUX: > + CUDA_PATH=/host/${{ env.CUDA_PATH }} + CUDA_PYTHON_PARALLEL_LEVEL=${{ env.CUDA_PYTHON_PARALLEL_LEVEL }} + CC="/host/${{ env.SCCACHE_PATH }} cc" + CXX="/host/${{ env.SCCACHE_PATH }} c++" + SCCACHE_GHA_ENABLED=true + ACTIONS_RUNTIME_TOKEN=${{ env.ACTIONS_RUNTIME_TOKEN }} + ACTIONS_RUNTIME_URL=${{ env.ACTIONS_RUNTIME_URL }} + ACTIONS_RESULTS_URL=${{ env.ACTIONS_RESULTS_URL }} + ACTIONS_CACHE_URL=${{ env.ACTIONS_CACHE_URL }} + ACTIONS_CACHE_SERVICE_V2=${{ env.ACTIONS_CACHE_SERVICE_V2 }} + SCCACHE_DIR=/host/${{ env.SCCACHE_DIR }} + SCCACHE_CACHE_SIZE=${{ env.SCCACHE_CACHE_SIZE }} + CIBW_ENVIRONMENT_WINDOWS: > + CUDA_PATH="$(cygpath -w ${{ env.CUDA_PATH }})" + CUDA_PYTHON_PARALLEL_LEVEL=${{ env.CUDA_PYTHON_PARALLEL_LEVEL }} + # check cache stats before leaving cibuildwheel + CIBW_BEFORE_TEST_LINUX: > + "/host/${{ env.SCCACHE_PATH }}" --show-adv-stats && + "/host/${{ env.SCCACHE_PATH }}" --show-stats --stats-format=json > /host/${{ github.workspace }}/sccache_bindings.json + # force the test stage to be run (so that before-test is not skipped) + # TODO: we might want to think twice on adding this, it does a lot of + # things before reaching this command. + CIBW_TEST_COMMAND: > + echo "ok!" + + - name: Report sccache stats (cuda.bindings) + if: ${{ inputs.host-platform != 'win-64' }} + uses: ./.github/actions/sccache-summary + with: + json-file: sccache_bindings.json + label: "cuda.bindings" + build-step: "Build cuda.bindings wheel" + + - name: List the cuda.bindings artifacts directory + run: | + if [[ "${{ inputs.host-platform }}" == win* ]]; then + export CHOWN=chown + else + export CHOWN="sudo chown" + fi + $CHOWN -R $(whoami) ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }} + ls -lahR ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }} + + - name: Check cuda.bindings wheel + run: | + twine check --strict ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}/*.whl + + - name: Upload cuda.bindings build artifacts + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: ${{ env.CUDA_BINDINGS_ARTIFACT_NAME }} + path: ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}/*.whl + if-no-files-found: error + + - name: Build cuda.core wheel + uses: pypa/cibuildwheel@294735312765b09d24a2fbec22660ce817587d55 # v4.1.0 + with: + package-dir: ./cuda_core/ + output-dir: ${{ env.CUDA_CORE_ARTIFACTS_DIR }} + env: + CIBW_BUILD: ${{ env.CIBW_BUILD }} + # TODO: remove cpython-prerelease once 3.15 is officially supported + # Allow CPython pre-release builds (currently 3.15 / 3.15t). This is a + # no-op for stable Python versions because CIBW_BUILD still filters + # the target version. + CIBW_ENABLE: cpython-prerelease + # CIBW mounts the host filesystem under /host + CIBW_ENVIRONMENT_LINUX: > + CUDA_PATH=/host/${{ env.CUDA_PATH }} + CUDA_PYTHON_PARALLEL_LEVEL=${{ env.CUDA_PYTHON_PARALLEL_LEVEL }} + CUDA_CORE_BUILD_MAJOR=${{ env.BUILD_CUDA_MAJOR }} + PIP_FIND_LINKS=/host/${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }} + CC="/host/${{ env.SCCACHE_PATH }} cc" + CXX="/host/${{ env.SCCACHE_PATH }} c++" + SCCACHE_GHA_ENABLED=true + ACTIONS_RUNTIME_TOKEN=${{ env.ACTIONS_RUNTIME_TOKEN }} + ACTIONS_RUNTIME_URL=${{ env.ACTIONS_RUNTIME_URL }} + ACTIONS_RESULTS_URL=${{ env.ACTIONS_RESULTS_URL }} + ACTIONS_CACHE_URL=${{ env.ACTIONS_CACHE_URL }} + ACTIONS_CACHE_SERVICE_V2=${{ env.ACTIONS_CACHE_SERVICE_V2 }} + SCCACHE_DIR=/host/${{ env.SCCACHE_DIR }} + SCCACHE_CACHE_SIZE=${{ env.SCCACHE_CACHE_SIZE }} + CIBW_ENVIRONMENT_WINDOWS: > + CUDA_PATH="$(cygpath -w ${{ env.CUDA_PATH }})" + CUDA_PYTHON_PARALLEL_LEVEL=${{ env.CUDA_PYTHON_PARALLEL_LEVEL }} + CUDA_CORE_BUILD_MAJOR=${{ env.BUILD_CUDA_MAJOR }} + PIP_FIND_LINKS="$(cygpath -w ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }})" + # check cache stats before leaving cibuildwheel + CIBW_BEFORE_TEST_LINUX: > + "/host${{ env.SCCACHE_PATH }}" --show-adv-stats && + "/host${{ env.SCCACHE_PATH }}" --show-stats --stats-format=json > /host/${{ github.workspace }}/sccache_core.json + # force the test stage to be run (so that before-test is not skipped) + # TODO: we might want to think twice on adding this, it does a lot of + # things before reaching this command. + CIBW_TEST_COMMAND: > + echo "ok!" + + - name: Report sccache stats (cuda.core) + if: ${{ inputs.host-platform != 'win-64' }} + uses: ./.github/actions/sccache-summary + with: + json-file: sccache_core.json + label: "cuda.core" + build-step: "Build cuda.core wheel" + + - name: List the cuda.core artifacts directory and rename + run: | + if [[ "${{ inputs.host-platform }}" == win* ]]; then + export CHOWN=chown + else + export CHOWN="sudo chown" + fi + $CHOWN -R $(whoami) ${{ env.CUDA_CORE_ARTIFACTS_DIR }} + + # Rename wheel to include CUDA version suffix + mkdir -p "${{ env.CUDA_CORE_ARTIFACTS_DIR }}/cu${BUILD_CUDA_MAJOR}" + for wheel in ${{ env.CUDA_CORE_ARTIFACTS_DIR }}/*.whl; do + if [[ -f "${wheel}" ]]; then + base_name=$(basename "${wheel}" .whl) + new_name="${base_name}.cu${BUILD_CUDA_MAJOR}.whl" + mv "${wheel}" "${{ env.CUDA_CORE_ARTIFACTS_DIR }}/cu${BUILD_CUDA_MAJOR}/${new_name}" + echo "Renamed wheel to: ${new_name}" + fi + done + + ls -lahR ${{ env.CUDA_CORE_ARTIFACTS_DIR }} + + # We only need/want a single pure python wheel, pick linux-64 index 0. + - name: Build and check cuda-python wheel + if: ${{ strategy.job-index == 0 && inputs.host-platform == 'linux-64' }} + run: | + pushd cuda_python + pip wheel -v --no-deps . + twine check --strict *.whl + popd + + - name: List the cuda-python artifacts directory + if: ${{ strategy.job-index == 0 && inputs.host-platform == 'linux-64' }} + run: | + if [[ "${{ inputs.host-platform }}" == win* ]]; then + export CHOWN=chown + else + export CHOWN="sudo chown" + fi + $CHOWN -R $(whoami) cuda_python/*.whl + ls -lahR cuda_python + + - name: Upload cuda-python build artifacts + if: ${{ strategy.job-index == 0 && inputs.host-platform == 'linux-64' }} + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: cuda-python-wheel + path: cuda_python/*.whl + if-no-files-found: error + + - name: Set up Python + id: setup-python2 + uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0 + with: + python-version: ${{ matrix.python-version }} + # TODO: remove allow-prereleases once 3.15 is officially supported + allow-prereleases: ${{ startsWith(matrix.python-version, '3.15') }} + + - name: verify free-threaded build + if: endsWith(matrix.python-version, 't') + run: python -c 'import sys; assert not sys._is_gil_enabled()' + + - name: Set up Python include paths + run: | + if [[ "${{ inputs.host-platform }}" == linux* ]]; then + echo "CPLUS_INCLUDE_PATH=${Python3_ROOT_DIR}/include/python${{ matrix.python-version }}" >> $GITHUB_ENV + elif [[ "${{ inputs.host-platform }}" == win* ]]; then + echo "CL=/I\"${Python3_ROOT_DIR}\include\python${{ matrix.python-version }}\"" >> $GITHUB_ENV + fi + # For caching + echo "PY_EXT_SUFFIX=$(python -c "import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX'))")" >> $GITHUB_ENV + + - name: Install cuda.pathfinder (required for next step) + run: | + pip install cuda_pathfinder/*.whl + + - name: Hide GNU link.exe so Meson finds MSVC link.exe + if: ${{ startsWith(inputs.host-platform, 'win') }} + run: | + if [ -f "/c/Program Files/Git/usr/bin/link.exe" ]; then + mv "/c/Program Files/Git/usr/bin/link.exe" "/c/Program Files/Git/usr/bin/link.exe.bak" + fi + + # TODO: remove the numpy pre-build steps once 3.15 is officially supported + # (numpy will publish pre-built 3.15 wheels at that point) + - name: Download and patch numpy sdist (pre-release Python) + if: ${{ startsWith(matrix.python-version, '3.15') }} + run: | + pip download --no-binary numpy --no-deps "numpy>=1.21.1" -d numpy-sdist/ + cd numpy-sdist && tar xf numpy-*.tar.gz && rm numpy-*.tar.gz + # WAR: numpy 2.4.x ships [tool.cibuildwheel] config that is + # incompatible with cibuildwheel v4.0 (cpython-freethreading enable + # group, OpenBLAS before-build scripts, etc.). Strip the cibuildwheel + # sections but preserve [tool.meson-python] (vendored meson path). + python -c " + import glob + for f in glob.glob('numpy-*/pyproject.toml'): + lines, skip = open(f).readlines(), False + out = [] + for line in lines: + hdr = line.strip() + if hdr.startswith('[tool.cibuildwheel') or hdr.startswith('[[tool.cibuildwheel'): + skip = True + continue + if skip and hdr.startswith('[') and 'cibuildwheel' not in hdr: + skip = False + if not skip: + out.append(line) + open(f, 'w').writelines(out) + " + echo "NUMPY_SRC_DIR=$(pwd)/$(ls -d numpy-*/)" >> $GITHUB_ENV + + - name: Build numpy wheel (pre-release Python) + if: ${{ startsWith(matrix.python-version, '3.15') }} + uses: pypa/cibuildwheel@294735312765b09d24a2fbec22660ce817587d55 # v4.1.0 + env: + CIBW_BUILD: ${{ env.CIBW_BUILD }} + CIBW_SKIP: "*-musllinux* *-win32" + CIBW_ARCHS_LINUX: "native" + CIBW_BUILD_VERBOSITY: 1 + CIBW_CONFIG_SETTINGS: "setup-args=-Dallow-noblas=true" + CIBW_CONFIG_SETTINGS_WINDOWS: "setup-args=--vsenv setup-args=-Dallow-noblas=true" + CIBW_BEFORE_BUILD_WINDOWS: "pip install delvewheel" + CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "delvewheel repair -w {dest_dir} {wheel}" + CIBW_ENABLE: "cpython-prerelease" + with: + package-dir: ${{ env.NUMPY_SRC_DIR }} + output-dir: numpy-wheel/ + + - name: Upload numpy wheel + if: ${{ startsWith(matrix.python-version, '3.15') }} + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: numpy-python${{ env.PYTHON_VERSION_FORMATTED }}-${{ inputs.host-platform }} + path: numpy-wheel/*.whl + if-no-files-found: error + + - name: Install numpy wheel + if: ${{ startsWith(matrix.python-version, '3.15') }} + run: pip install numpy-wheel/*.whl + + - name: Build cuda.bindings Cython tests + run: | + pip install ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}/*.whl --group ./cuda_bindings/pyproject.toml:test + pushd ${{ env.CUDA_BINDINGS_CYTHON_TESTS_DIR }} + bash build_tests.sh + popd + + - name: Upload cuda.bindings Cython tests + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: ${{ env.CUDA_BINDINGS_ARTIFACT_NAME }}-tests + path: ${{ env.CUDA_BINDINGS_CYTHON_TESTS_DIR }}/test_*${{ env.PY_EXT_SUFFIX }} + if-no-files-found: error + + - name: Build cuda.core Cython tests + run: | + pip install ${{ env.CUDA_CORE_ARTIFACTS_DIR }}/"cu${BUILD_CUDA_MAJOR}"/*.whl --group ./cuda_core/pyproject.toml:test + pushd ${{ env.CUDA_CORE_CYTHON_TESTS_DIR }} + bash build_tests.sh + popd + + - name: Upload cuda.core Cython tests + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: ${{ env.CUDA_CORE_ARTIFACT_NAME }}-tests + path: ${{ env.CUDA_CORE_CYTHON_TESTS_DIR }}/test_*${{ env.PY_EXT_SUFFIX }} + if-no-files-found: error + + # Note: This overwrites CUDA_PATH etc + - name: Set up mini CTK + uses: ./.github/actions/fetch_ctk + continue-on-error: false + with: + host-platform: ${{ inputs.host-platform }} + cuda-version: ${{ inputs.prev-cuda-version }} + cuda-path: "./cuda_toolkit_prev" + + - name: Build cuda.core test binaries + run: | + nvcc --version + python "${{ env.CUDA_CORE_TEST_BINARIES_DIR }}/build_test_binaries.py" + + - name: Upload cuda.core test binaries + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: ${{ env.CUDA_CORE_ARTIFACT_NAME }}-test-binaries + path: | + ${{ env.CUDA_CORE_TEST_BINARIES_DIR }}/*.o + ${{ env.CUDA_CORE_TEST_BINARIES_DIR }}/*.a + ${{ env.CUDA_CORE_TEST_BINARIES_DIR }}/*.lib + if-no-files-found: error + + - name: Download cuda.bindings build artifacts from the prior branch + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + if ! (command -v gh 2>&1 >/dev/null); then + # See https://github.com/cli/cli/blob/trunk/docs/install_linux.md#debian-ubuntu-linux-raspberry-pi-os-apt. + # gh is needed for artifact fetching. + mkdir -p -m 755 /etc/apt/keyrings \ + && out=$(mktemp) && wget -nv -O$out https://cli.github.com/packages/githubcli-archive-keyring.gpg \ + && cat $out | tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \ + && chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \ + && echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null \ + && apt update \ + && apt install gh -y + fi + + OLD_BRANCH=$(yq '.backport_branch' ci/versions.yml) + OLD_BASENAME="cuda-bindings-python${PYTHON_VERSION_FORMATTED}-cuda*-${{ inputs.host-platform }}*" + LATEST_PRIOR_RUN_ID=$(./ci/tools/lookup-run-id --branch "${OLD_BRANCH}" NVIDIA/cuda-python "CI") + + gh run download $LATEST_PRIOR_RUN_ID -p ${OLD_BASENAME} -R NVIDIA/cuda-python + rm -rf ${OLD_BASENAME}-tests # exclude cython test artifacts + ls -al $OLD_BASENAME + mkdir -p "${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}" + mv $OLD_BASENAME/*.whl "${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}" + rmdir $OLD_BASENAME + + - name: Build cuda.core wheel + uses: pypa/cibuildwheel@294735312765b09d24a2fbec22660ce817587d55 # v4.1.0 + with: + package-dir: ./cuda_core/ + output-dir: ${{ env.CUDA_CORE_ARTIFACTS_DIR }} + env: + CIBW_BUILD: ${{ env.CIBW_BUILD }} + # TODO: remove cpython-prerelease once 3.15 is officially supported + # Allow CPython pre-release builds (currently 3.15 / 3.15t). This is a + # no-op for stable Python versions because CIBW_BUILD still filters + # the target version. + CIBW_ENABLE: cpython-prerelease + # CIBW mounts the host filesystem under /host + CIBW_ENVIRONMENT_LINUX: > + CUDA_PATH=/host/${{ env.CUDA_PATH }} + CUDA_PYTHON_PARALLEL_LEVEL=${{ env.CUDA_PYTHON_PARALLEL_LEVEL }} + CUDA_CORE_BUILD_MAJOR=${{ env.BUILD_PREV_CUDA_MAJOR }} + PIP_FIND_LINKS=/host/${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }} + CC="/host/${{ env.SCCACHE_PATH }} cc" + CXX="/host/${{ env.SCCACHE_PATH }} c++" + SCCACHE_GHA_ENABLED=true + ACTIONS_RUNTIME_TOKEN=${{ env.ACTIONS_RUNTIME_TOKEN }} + ACTIONS_RUNTIME_URL=${{ env.ACTIONS_RUNTIME_URL }} + ACTIONS_RESULTS_URL=${{ env.ACTIONS_RESULTS_URL }} + ACTIONS_CACHE_URL=${{ env.ACTIONS_CACHE_URL }} + ACTIONS_CACHE_SERVICE_V2=${{ env.ACTIONS_CACHE_SERVICE_V2 }} + SCCACHE_DIR=/host/${{ env.SCCACHE_DIR }} + SCCACHE_CACHE_SIZE=${{ env.SCCACHE_CACHE_SIZE }} + CIBW_ENVIRONMENT_WINDOWS: > + CUDA_PATH="$(cygpath -w ${{ env.CUDA_PATH }})" + CUDA_PYTHON_PARALLEL_LEVEL=${{ env.CUDA_PYTHON_PARALLEL_LEVEL }} + CUDA_CORE_BUILD_MAJOR=${{ env.BUILD_PREV_CUDA_MAJOR }} + PIP_FIND_LINKS="$(cygpath -w ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }})" + # check cache stats before leaving cibuildwheel + CIBW_BEFORE_TEST_LINUX: > + "/host${{ env.SCCACHE_PATH }}" --show-adv-stats && + "/host${{ env.SCCACHE_PATH }}" --show-stats --stats-format=json > /host/${{ github.workspace }}/sccache_core_prev.json + # force the test stage to be run (so that before-test is not skipped) + # TODO: we might want to think twice on adding this, it does a lot of + # things before reaching this command. + CIBW_TEST_COMMAND: > + echo "ok!" + + - name: Report sccache stats (cuda.core prev) + if: ${{ inputs.host-platform != 'win-64' }} + uses: ./.github/actions/sccache-summary + with: + json-file: sccache_core_prev.json + label: "cuda.core (prev CTK)" + build-step: "Build cuda.core wheel" + + - name: List the cuda.core artifacts directory and rename + run: | + if [[ "${{ inputs.host-platform }}" == win* ]]; then + export CHOWN=chown + else + export CHOWN="sudo chown" + fi + $CHOWN -R $(whoami) ${{ env.CUDA_CORE_ARTIFACTS_DIR }} + ls -lahR ${{ env.CUDA_CORE_ARTIFACTS_DIR }} + + # Rename wheel to include CUDA version suffix + mkdir -p "${{ env.CUDA_CORE_ARTIFACTS_DIR }}/cu${BUILD_PREV_CUDA_MAJOR}" + for wheel in ${{ env.CUDA_CORE_ARTIFACTS_DIR }}/*.whl; do + if [[ -f "${wheel}" ]]; then + base_name=$(basename "${wheel}" .whl) + new_name="${base_name}.cu${BUILD_PREV_CUDA_MAJOR}.whl" + mv "${wheel}" "${{ env.CUDA_CORE_ARTIFACTS_DIR }}/cu${BUILD_PREV_CUDA_MAJOR}/${new_name}" + echo "Renamed wheel to: ${new_name}" + fi + done + + ls -lahR ${{ env.CUDA_CORE_ARTIFACTS_DIR }} + + - name: Merge cuda.core wheels + run: | + pip install wheel + python ci/tools/merge_cuda_core_wheels.py \ + "${{ env.CUDA_CORE_ARTIFACTS_DIR }}"/cu"${BUILD_CUDA_MAJOR}"/cuda_core*.whl \ + "${{ env.CUDA_CORE_ARTIFACTS_DIR }}"/cu"${BUILD_PREV_CUDA_MAJOR}"/cuda_core*.whl \ + --output-dir "${{ env.CUDA_CORE_ARTIFACTS_DIR }}" + + - name: Check cuda.core wheel + run: | + twine check --strict ${{ env.CUDA_CORE_ARTIFACTS_DIR }}/*.whl + + - name: Upload cuda.core build artifacts + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: ${{ env.CUDA_CORE_ARTIFACT_NAME }} + path: ${{ env.CUDA_CORE_ARTIFACTS_DIR }}/*.whl + if-no-files-found: error diff --git a/.github/workflows/ci-nightly.yml b/.github/workflows/ci-nightly.yml new file mode 100644 index 00000000000..0188ebf2524 --- /dev/null +++ b/.github/workflows/ci-nightly.yml @@ -0,0 +1,365 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +# Nightly CI pipeline that tests optional dependencies (PyTorch, numba-cuda) +# against the latest cuda-python wheels built on main, runs the standard +# test suite on runners reserved for nightly-only use (e.g. arm64 l4×2), and +# exercises release-time CI helper scripts so they do not silently rot between releases. +# +# This workflow does NOT build wheels — it downloads them from the latest +# successful CI run on main and runs integration/standard tests. + +name: "CI: Nightly optional-deps" + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} + cancel-in-progress: true + +on: + schedule: + # 2:17 AM UTC daily, after the midnight main CI build finishes. + # Avoid minute 0 because GitHub documents high scheduled-workflow load + # at the start of every hour, where queued jobs may be delayed or dropped. + - cron: "17 2 * * *" + workflow_dispatch: + inputs: + run-id: + description: > + Override the CI run ID to download artifacts from. + Leave empty to auto-detect the latest successful main run. + type: string + default: '' + +jobs: + test-ci-tools-for-release: + name: "Nightly: CI tools for release" + if: ${{ github.repository_owner == 'nvidia' }} + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + with: + fetch-depth: 1 + + - name: Run CI tools unit tests + run: | + python -m pip install pytest + # Standalone CI tool tests; skip repo-root conftest.py (imports cuda.pathfinder). + python -m pytest -v --noconftest ci/tools/tests + + find-wheels: + runs-on: ubuntu-latest + outputs: + RUN_ID: ${{ steps.find.outputs.run_id }} + HEAD_SHA: ${{ steps.find.outputs.head_sha }} + CUDA_BUILD_VER: ${{ steps.find.outputs.cuda_build_ver }} + steps: + - name: Checkout repository + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + with: + fetch-depth: 1 + + - name: Find latest successful CI run on main + id: find + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + if [[ -n "${{ inputs.run-id }}" ]]; then + RUN_ID="${{ inputs.run-id }}" + HEAD_SHA=$(gh run view "$RUN_ID" \ + -R "${{ github.repository }}" \ + --json headSha | jq -r '.headSha') + else + # lookup-run-id --branch --head-sha prints two lines: run_id then head_sha + OUTPUT=$(./ci/tools/lookup-run-id --branch main --head-sha "${{ github.repository }}" "CI") + RUN_ID=$(echo "$OUTPUT" | sed -n '1p') + HEAD_SHA=$(echo "$OUTPUT" | sed -n '2p') + fi + + if [[ -z "$HEAD_SHA" || "$HEAD_SHA" == "null" ]]; then + echo "::error::Could not resolve head SHA for CI run $RUN_ID" + exit 1 + fi + + CUDA_BUILD_VER=$(gh api \ + "repos/${{ github.repository }}/contents/ci/versions.yml?ref=$HEAD_SHA" \ + --jq '.content' \ + | base64 -d \ + | yq '.cuda.build.version') + + if [[ -z "$CUDA_BUILD_VER" || "$CUDA_BUILD_VER" == "null" ]]; then + echo "::error::Could not resolve CUDA build version from $HEAD_SHA" + exit 1 + fi + + echo "run_id=$RUN_ID" >> $GITHUB_OUTPUT + echo "head_sha=$HEAD_SHA" >> $GITHUB_OUTPUT + echo "cuda_build_ver=$CUDA_BUILD_VER" >> $GITHUB_OUTPUT + + # ── PyTorch interop tests ── + + test-pytorch-linux: + name: "Nightly PyTorch (linux-64)" + if: ${{ github.repository_owner == 'nvidia' }} + needs: find-wheels + permissions: + contents: read + actions: read + secrets: inherit + uses: ./.github/workflows/test-wheel-linux.yml + with: + build-type: nightly + host-platform: linux-64 + build-ctk-ver: ${{ needs.find-wheels.outputs.CUDA_BUILD_VER }} + run-id: ${{ needs.find-wheels.outputs.RUN_ID }} + sha: ${{ needs.find-wheels.outputs.HEAD_SHA }} + test-mode: nightly-pytorch + matrix_filter: 'map(select(.ENV.MODE == "nightly-pytorch"))' + + test-pytorch-linux-aarch64: + name: "Nightly PyTorch (linux-aarch64)" + if: ${{ github.repository_owner == 'nvidia' }} + needs: find-wheels + permissions: + contents: read + actions: read + secrets: inherit + uses: ./.github/workflows/test-wheel-linux.yml + with: + build-type: nightly + host-platform: linux-aarch64 + build-ctk-ver: ${{ needs.find-wheels.outputs.CUDA_BUILD_VER }} + run-id: ${{ needs.find-wheels.outputs.RUN_ID }} + sha: ${{ needs.find-wheels.outputs.HEAD_SHA }} + test-mode: nightly-pytorch + matrix_filter: 'map(select(.ENV.MODE == "nightly-pytorch"))' + + test-pytorch-windows: + name: "Nightly PyTorch (win-64)" + if: ${{ github.repository_owner == 'nvidia' }} + needs: find-wheels + permissions: + contents: read + actions: read + secrets: inherit + uses: ./.github/workflows/test-wheel-windows.yml + with: + build-type: nightly + host-platform: win-64 + build-ctk-ver: ${{ needs.find-wheels.outputs.CUDA_BUILD_VER }} + run-id: ${{ needs.find-wheels.outputs.RUN_ID }} + sha: ${{ needs.find-wheels.outputs.HEAD_SHA }} + test-mode: nightly-pytorch + matrix_filter: 'map(select(.ENV.MODE == "nightly-pytorch"))' + + # ── numba-cuda tests ── + + test-numba-cuda-linux-64: + name: "Nightly numba-cuda (linux-64)" + if: ${{ github.repository_owner == 'nvidia' }} + needs: find-wheels + permissions: + contents: read + actions: read + secrets: inherit + uses: ./.github/workflows/test-wheel-linux.yml + with: + build-type: nightly + host-platform: linux-64 + build-ctk-ver: ${{ needs.find-wheels.outputs.CUDA_BUILD_VER }} + run-id: ${{ needs.find-wheels.outputs.RUN_ID }} + sha: ${{ needs.find-wheels.outputs.HEAD_SHA }} + test-mode: nightly-numba-cuda + matrix_filter: 'map(select(.ENV.MODE == "nightly-numba-cuda"))' + + test-numba-cuda-linux-aarch64: + name: "Nightly numba-cuda (linux-aarch64)" + if: ${{ github.repository_owner == 'nvidia' }} + needs: find-wheels + permissions: + contents: read + actions: read + secrets: inherit + uses: ./.github/workflows/test-wheel-linux.yml + with: + build-type: nightly + host-platform: linux-aarch64 + build-ctk-ver: ${{ needs.find-wheels.outputs.CUDA_BUILD_VER }} + run-id: ${{ needs.find-wheels.outputs.RUN_ID }} + sha: ${{ needs.find-wheels.outputs.HEAD_SHA }} + test-mode: nightly-numba-cuda + matrix_filter: 'map(select(.ENV.MODE == "nightly-numba-cuda"))' + + test-numba-cuda-windows: + name: "Nightly numba-cuda (win-64)" + if: ${{ github.repository_owner == 'nvidia' }} + needs: find-wheels + permissions: + contents: read + actions: read + secrets: inherit + uses: ./.github/workflows/test-wheel-windows.yml + with: + build-type: nightly + host-platform: win-64 + build-ctk-ver: ${{ needs.find-wheels.outputs.CUDA_BUILD_VER }} + run-id: ${{ needs.find-wheels.outputs.RUN_ID }} + sha: ${{ needs.find-wheels.outputs.HEAD_SHA }} + test-mode: nightly-numba-cuda + matrix_filter: 'map(select(.ENV.MODE == "nightly-numba-cuda"))' + + # ── numba-cuda-mlir tests ── + + test-numba-cuda-mlir-linux-64: + name: "Nightly numba-cuda-mlir (linux-64)" + if: ${{ github.repository_owner == 'nvidia' }} + needs: find-wheels + permissions: + contents: read + actions: read + secrets: inherit + uses: ./.github/workflows/test-wheel-linux.yml + with: + build-type: nightly + host-platform: linux-64 + build-ctk-ver: ${{ needs.find-wheels.outputs.CUDA_BUILD_VER }} + run-id: ${{ needs.find-wheels.outputs.RUN_ID }} + sha: ${{ needs.find-wheels.outputs.HEAD_SHA }} + test-mode: nightly-numba-cuda-mlir + matrix_filter: 'map(select(.ENV.MODE == "nightly-numba-cuda-mlir"))' + + test-numba-cuda-mlir-windows: + name: "Nightly numba-cuda-mlir (win-64)" + if: ${{ github.repository_owner == 'nvidia' }} + needs: find-wheels + permissions: + contents: read + actions: read + secrets: inherit + uses: ./.github/workflows/test-wheel-windows.yml + with: + build-type: nightly + host-platform: win-64 + build-ctk-ver: ${{ needs.find-wheels.outputs.CUDA_BUILD_VER }} + run-id: ${{ needs.find-wheels.outputs.RUN_ID }} + sha: ${{ needs.find-wheels.outputs.HEAD_SHA }} + test-mode: nightly-numba-cuda-mlir + matrix_filter: 'map(select(.ENV.MODE == "nightly-numba-cuda-mlir"))' + + # ── Released cuda-core against main pathfinder/bindings ── + + test-cuda-core-linux-64: + name: "Nightly cuda-core (linux-64)" + if: ${{ github.repository_owner == 'nvidia' }} + needs: find-wheels + permissions: + contents: read + actions: read + secrets: inherit + uses: ./.github/workflows/test-wheel-linux.yml + with: + build-type: nightly + host-platform: linux-64 + build-ctk-ver: ${{ needs.find-wheels.outputs.CUDA_BUILD_VER }} + run-id: ${{ needs.find-wheels.outputs.RUN_ID }} + sha: ${{ needs.find-wheels.outputs.HEAD_SHA }} + test-mode: nightly-cuda-core + matrix_filter: 'map(select(.ENV.MODE == "nightly-cuda-core"))' + + test-cuda-core-windows: + name: "Nightly cuda-core (win-64)" + if: ${{ github.repository_owner == 'nvidia' }} + needs: find-wheels + permissions: + contents: read + actions: read + secrets: inherit + uses: ./.github/workflows/test-wheel-windows.yml + with: + build-type: nightly + host-platform: win-64 + build-ctk-ver: ${{ needs.find-wheels.outputs.CUDA_BUILD_VER }} + run-id: ${{ needs.find-wheels.outputs.RUN_ID }} + sha: ${{ needs.find-wheels.outputs.HEAD_SHA }} + test-mode: nightly-cuda-core + matrix_filter: 'map(select(.ENV.MODE == "nightly-cuda-core"))' + + # ── Standard tests on nightly-only runners ── + + test-standard-linux-aarch64: + name: "Nightly standard (linux-aarch64)" + if: ${{ github.repository_owner == 'nvidia' }} + needs: find-wheels + permissions: + contents: read + actions: read + secrets: inherit + uses: ./.github/workflows/test-wheel-linux.yml + with: + build-type: nightly + host-platform: linux-aarch64 + build-ctk-ver: ${{ needs.find-wheels.outputs.CUDA_BUILD_VER }} + run-id: ${{ needs.find-wheels.outputs.RUN_ID }} + sha: ${{ needs.find-wheels.outputs.HEAD_SHA }} + test-mode: standard + matrix_filter: 'map(select(.ENV.MODE == "nightly-standard"))' + + # ── Status check ── + + checks: + name: Nightly check status + if: always() + runs-on: ubuntu-latest + needs: + - test-ci-tools-for-release + - find-wheels + - test-pytorch-linux + - test-pytorch-linux-aarch64 + - test-pytorch-windows + - test-numba-cuda-linux-64 + - test-numba-cuda-linux-aarch64 + - test-numba-cuda-windows + - test-numba-cuda-mlir-linux-64 + - test-numba-cuda-mlir-windows + - test-cuda-core-linux-64 + - test-cuda-core-windows + - test-standard-linux-aarch64 + steps: + - name: Exit + run: | + # If any dependency was cancelled or failed, that's a failure. + # + # See ci.yml for the full rationale on why we must use always() + # and explicitly check each result rather than relying on the + # default behaviour. + if ${{ needs.test-ci-tools-for-release.result == 'cancelled' || + needs.test-ci-tools-for-release.result == 'failure' || + needs.find-wheels.result != 'success' }}; then + exit 1 + fi + if ${{ needs.test-pytorch-linux.result == 'cancelled' || + needs.test-pytorch-linux.result == 'failure' || + needs.test-pytorch-linux-aarch64.result == 'cancelled' || + needs.test-pytorch-linux-aarch64.result == 'failure' || + needs.test-pytorch-windows.result == 'cancelled' || + needs.test-pytorch-windows.result == 'failure' || + needs.test-numba-cuda-linux-64.result == 'cancelled' || + needs.test-numba-cuda-linux-64.result == 'failure' || + needs.test-numba-cuda-linux-aarch64.result == 'cancelled' || + needs.test-numba-cuda-linux-aarch64.result == 'failure' || + needs.test-numba-cuda-windows.result == 'cancelled' || + needs.test-numba-cuda-windows.result == 'failure' || + needs.test-numba-cuda-mlir-linux-64.result == 'cancelled' || + needs.test-numba-cuda-mlir-linux-64.result == 'failure' || + needs.test-numba-cuda-mlir-windows.result == 'cancelled' || + needs.test-numba-cuda-mlir-windows.result == 'failure' || + needs.test-cuda-core-linux-64.result == 'cancelled' || + needs.test-cuda-core-linux-64.result == 'failure' || + needs.test-cuda-core-windows.result == 'cancelled' || + needs.test-cuda-core-windows.result == 'failure' || + needs.test-standard-linux-aarch64.result == 'cancelled' || + needs.test-standard-linux-aarch64.result == 'failure' }}; then + exit 1 + fi + exit 0 diff --git a/.github/workflows/ci-pixi-source-test.yml b/.github/workflows/ci-pixi-source-test.yml new file mode 100644 index 00000000000..563b69d0e23 --- /dev/null +++ b/.github/workflows/ci-pixi-source-test.yml @@ -0,0 +1,149 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +# Validates the `pixi run test` developer workflow (source build + Cython +# codegen + test suite via the pixi-managed environment). +# +# WHY THIS EXISTS: the main CI (ci.yml / test-wheel-*.yml) tests prebuilt +# *wheels*; it never exercises the pixi *source build*. That path rots silently +# whenever the CUDA pin, generated bindings, conda-forge packages, or the +# cython-test build mechanics drift (see #2182, #2183). This workflow is the +# only thing that runs the pixi source build end to end. +# +# Two tiers, to spend GPU minutes deliberately (GPUs are scarce): +# - build-smoke (PRs): CPU-only. Source-builds bindings + core, imports them, +# builds the cython test extensions and checks placement. Catches the +# compile / ABI / .so-placement regressions WITHOUT a GPU. +# - full-test (nightly + manual): GPU runner, full `pixi run test`. + +name: "CI: pixi run test (source build)" + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} + cancel-in-progress: true + +on: + schedule: + # 2:37 AM UTC daily — offset from ci-nightly.yml (2:17) to avoid contending + # for the same scheduled-workflow window. + - cron: "37 2 * * *" + pull_request: + # Only the files that can break the source-build path (see #2182/#2183). + paths: + - "**/pixi.toml" + - "**/pixi.lock" + - "cuda_bindings/build_hooks.py" + - "cuda_core/build_hooks.py" + - "cuda_bindings/cuda/bindings/**" # generated bindings sources + - "cuda_bindings/tests/cython/**" + - "cuda_core/tests/cython/**" + - "ci/versions.yml" + - ".github/workflows/ci-pixi-source-test.yml" + workflow_dispatch: + inputs: + cuda-env: + description: "pixi environment to test (cu13 or cu12)." + type: string + default: "cu13" + +defaults: + run: + shell: bash --noprofile --norc -xeuo pipefail {0} + +env: + PIXI_VERSION: "v0.66.0" # keep in sync with the version developers run locally + +jobs: + # ── PR guard: CPU-only build + import + placement smoke ── + build-smoke: + name: "build smoke (cu13, linux-64, CPU)" + if: ${{ github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }} + runs-on: ubuntu-latest + timeout-minutes: 45 + steps: + - name: Checkout ${{ github.event.repository.name }} + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + with: + # Full history + tags so setuptools-scm derives the real (13.x) + # package version; a shallow checkout yields 0.1.dev1, which trips + # cuda.core's "cuda.bindings 12.x or 13.x must be installed" guard. + fetch-depth: 0 + + - name: Setup pixi + # Pinned to a commit SHA; install logic lives in the action and is + # auditable/pinned (vs. a curl|bash of an unverified installer). + uses: prefix-dev/setup-pixi@5185adfbffb4bd703da3010310260805d89ebb11 # v0.9.6 + with: + pixi-version: ${{ env.PIXI_VERSION }} + run-install: false + + - name: Source-build + import + cython-placement smoke + env: + CUDA_ENV: ${{ inputs.cuda-env || 'cu13' }} + run: | + # pathfinder: pure-Python, no GPU. + pixi run -e "${CUDA_ENV}" test-pathfinder + + # bindings + core: force the source build (catches nvrtc/driver + # compile errors like #2182) and import them (catches ABI mismatches). + pixi run --manifest-path cuda_bindings -e "${CUDA_ENV}" \ + python -c "import cuda.bindings.driver, cuda.bindings.nvrtc, cuda.bindings.runtime; print('bindings import OK')" + pixi run --manifest-path cuda_core -e "${CUDA_ENV}" \ + python -c "import cuda.core; print('core import OK')" + + # cython test extensions: build them and confirm each .so landed next + # to its .pyx in tests/cython (catches the placement regression #2180). + pixi run --manifest-path cuda_bindings -e "${CUDA_ENV}" build-cython-tests + pixi run --manifest-path cuda_core -e "${CUDA_ENV}" build-cython-tests + for d in cuda_bindings/tests/cython cuda_core/tests/cython; do + if ! compgen -G "${d}/*.cpython-*.so" > /dev/null; then + echo "::error::no compiled cython test .so in ${d} (placement regression)" + exit 1 + fi + done + echo "cython test extensions placed correctly" + + # ── Nightly: full `pixi run test` on a GPU runner ── + full-test: + name: "pixi run test (${{ inputs.cuda-env || 'cu13' }}, linux-64, GPU)" + if: ${{ (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && github.repository_owner == 'nvidia' }} + runs-on: "linux-amd64-gpu-l4-latest-1" # same label scheme as test-wheel-linux.yml + timeout-minutes: 90 + container: + options: -u root --security-opt seccomp=unconfined --shm-size 16g + image: ubuntu:24.04 + steps: + - name: Ensure GPU is working + run: nvidia-smi + + - name: Install system packages + run: | + apt-get update + # ca-certificates + git for checkout; libgl1/libegl1 for pyglet + # (pulled in by the test env). pixi itself is installed by setup-pixi. + apt-get install -y --no-install-recommends \ + ca-certificates git libgl1 libegl1 + + - name: Checkout ${{ github.event.repository.name }} + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + with: + # Full history + tags so setuptools-scm derives the real (13.x) + # package version; a shallow checkout yields 0.1.dev1, which trips + # cuda.core's "cuda.bindings 12.x or 13.x must be installed" guard. + fetch-depth: 0 + + - name: Setup proxy cache + uses: nv-gha-runners/setup-proxy-cache@main + continue-on-error: true + + - name: Setup pixi + # Pinned to a commit SHA; install logic lives in the action and is + # auditable/pinned (vs. a curl|bash of an unverified installer). + uses: prefix-dev/setup-pixi@5185adfbffb4bd703da3010310260805d89ebb11 # v0.9.6 + with: + pixi-version: ${{ env.PIXI_VERSION }} + run-install: false + + - name: pixi run test + run: pixi run -e "${{ inputs.cuda-env || 'cu13' }}" test diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000000..fe43b52d01a --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,473 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +# Note: This name is referred to in the test job, so make sure any changes are sync'd up! +# Further this is referencing a run in the backport branch to fetch old bindings. +name: "CI" + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} + cancel-in-progress: true + +on: + push: + branches: + - "pull-request/[0-9]+" + - "main" + tags: + # Build release artifacts from tag refs so setuptools-scm resolves exact + # release versions instead of .dev+local variants. + - "v*" + - "cuda-core-v*" + - "cuda-pathfinder-v*" + schedule: + # every 24 hours at midnight UTC + - cron: "0 0 * * *" + workflow_dispatch: {} + +jobs: + ci-vars: + runs-on: ubuntu-latest + outputs: + CUDA_BUILD_VER: ${{ steps.get-vars.outputs.cuda_build_ver }} + CUDA_PREV_BUILD_VER: ${{ steps.get-vars.outputs.cuda_prev_build_ver }} + steps: + - name: Checkout repository + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + with: + fetch-depth: 1 + - name: Get CUDA build versions + id: get-vars + run: | + cuda_build_ver=$(yq '.cuda.build.version' ci/versions.yml) + echo "cuda_build_ver=$cuda_build_ver" >> $GITHUB_OUTPUT + + cuda_prev_build_ver=$(yq '.cuda.prev_build.version' ci/versions.yml) + echo "cuda_prev_build_ver=$cuda_prev_build_ver" >> $GITHUB_OUTPUT + + should-skip: + runs-on: ubuntu-latest + outputs: + skip: ${{ steps.get-should-skip.outputs.skip }} + doc-only: ${{ steps.get-should-skip.outputs.doc_only }} + steps: + - name: Checkout repository + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + - name: Compute whether to skip builds and tests + id: get-should-skip + env: + GH_TOKEN: ${{ github.token }} + run: | + set -euxo pipefail + if ${{ startsWith(github.ref_name, 'pull-request/') }}; then + pr_number="$(grep -Po '(\d+)$' <<< '${{ github.ref_name }}')" + pr_title="$(gh pr view "${pr_number}" --json title --jq '.title')" + skip="$(echo "${pr_title}" | grep -q '\[no-ci\]' && echo true || echo false)" + doc_only="$(echo "${pr_title}" | grep -q '\[doc-only\]' && echo true || echo false)" + else + skip=false + doc_only=false + fi + echo "skip=${skip}" >> "$GITHUB_OUTPUT" + echo "doc_only=${doc_only}" >> "$GITHUB_OUTPUT" + + # Detect which top-level modules were touched by the PR so downstream build + # and test jobs can avoid rebuilding/retesting modules unaffected by the + # change. See issue #299. + # + # Dependency graph (verified in pyproject.toml files): + # cuda_pathfinder -> (no internal deps) + # cuda_bindings -> cuda_pathfinder + # cuda_core -> cuda_pathfinder, cuda_bindings + # cuda_python -> cuda_bindings (meta package) + # + # A change to cuda_pathfinder (or shared infra) forces a rebuild of every + # downstream module. A change to cuda_bindings forces rebuild of cuda_core. + # A change to cuda_core alone skips rebuilding/retesting cuda_bindings. + # On push to main, tag refs, schedule, or workflow_dispatch events we + # unconditionally run everything because there is no meaningful "changed + # paths" baseline for those events. + detect-changes: + runs-on: ubuntu-latest + outputs: + bindings: ${{ steps.compose.outputs.bindings }} + core: ${{ steps.compose.outputs.core }} + pathfinder: ${{ steps.compose.outputs.pathfinder }} + python_meta: ${{ steps.compose.outputs.python_meta }} + test_helpers: ${{ steps.compose.outputs.test_helpers }} + shared: ${{ steps.compose.outputs.shared }} + build_bindings: ${{ steps.compose.outputs.build_bindings }} + build_core: ${{ steps.compose.outputs.build_core }} + build_pathfinder: ${{ steps.compose.outputs.build_pathfinder }} + test_bindings: ${{ steps.compose.outputs.test_bindings }} + test_core: ${{ steps.compose.outputs.test_core }} + test_pathfinder: ${{ steps.compose.outputs.test_pathfinder }} + steps: + - name: Checkout repository + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + with: + # Treeless clone: commit graph is needed for `git merge-base` and + # `git diff --name-only` below, but historical blobs aren't. + fetch-depth: 0 + filter: blob:none + + # copy-pr-bot pushes every PR (whether it targets main or a backport + # branch such as 12.9.x) to pull-request/, so the base branch + # cannot be inferred from github.ref_name. Look it up via the + # upstream PR metadata so the diff below is rooted at the right place. + - name: Resolve PR base branch + id: pr-info + if: ${{ startsWith(github.ref_name, 'pull-request/') }} + uses: nv-gha-runners/get-pr-info@main + + - name: Detect changed paths + id: filter + if: ${{ startsWith(github.ref_name, 'pull-request/') }} + env: + # GitHub Actions evaluates step-level `env:` expressions eagerly — + # the step's `if:` gate does NOT short-circuit them. On non-PR + # events (push/tag/schedule), `pr-info` is skipped and its outputs + # are empty strings, so `fromJSON('')` would raise a template error + # and fail the step despite `if:` being false. Guard the + # `fromJSON` call with a short-circuit so the expression resolves + # to an empty string on non-PR events; the step is still gated + # off by `if:`, so `BASE_REF` is never consumed there. + BASE_REF: ${{ steps.pr-info.outputs.pr-info && fromJSON(steps.pr-info.outputs.pr-info).base.ref || '' }} + run: | + # Diff against the merge base with the PR's actual target branch. + # Uses merge-base so diverged branches only show files changed on + # the PR side, not upstream commits. + if [[ -z "${BASE_REF}" ]]; then + echo "Could not resolve PR base branch from get-pr-info output" >&2 + exit 1 + fi + base=$(git merge-base HEAD "origin/${BASE_REF}") + changed=$(git diff --name-only "$base"...HEAD) + + has_match() { + grep -qE "$1" <<< "$changed" && echo true || echo false + } + + { + echo "bindings=$(has_match '^cuda_bindings/')" + echo "core=$(has_match '^cuda_core/')" + echo "pathfinder=$(has_match '^cuda_pathfinder/')" + echo "python_meta=$(has_match '^cuda_python/')" + echo "test_helpers=$(has_match '^cuda_python_test_helpers/')" + echo "shared=$(has_match '^(\.github/|ci/|scripts/|toolshed/|conftest\.py$|pyproject\.toml$|pixi\.(toml|lock)$|pytest\.ini$|ruff\.toml$)')" + } >> "$GITHUB_OUTPUT" + + - name: Compose gating outputs + id: compose + env: + IS_PR: ${{ startsWith(github.ref_name, 'pull-request/') }} + BINDINGS: ${{ steps.filter.outputs.bindings || 'false' }} + CORE: ${{ steps.filter.outputs.core || 'false' }} + PATHFINDER: ${{ steps.filter.outputs.pathfinder || 'false' }} + PYTHON_META: ${{ steps.filter.outputs.python_meta || 'false' }} + TEST_HELPERS: ${{ steps.filter.outputs.test_helpers || 'false' }} + SHARED: ${{ steps.filter.outputs.shared || 'false' }} + run: | + set -euxo pipefail + # Non-PR events (push to main, tag push, schedule, workflow_dispatch) + # always exercise the full pipeline because there is no baseline for + # a meaningful diff. + if [[ "${IS_PR}" != "true" ]]; then + bindings=true + core=true + pathfinder=true + python_meta=true + test_helpers=true + shared=true + else + bindings="${BINDINGS}" + core="${CORE}" + pathfinder="${PATHFINDER}" + python_meta="${PYTHON_META}" + test_helpers="${TEST_HELPERS}" + shared="${SHARED}" + fi + + or_flag() { + for v in "$@"; do + if [[ "${v}" == "true" ]]; then + echo "true" + return + fi + done + echo "false" + } + + # Build gating: pathfinder change forces rebuild of bindings and + # core; bindings change forces rebuild of core. shared changes force + # a full rebuild. + build_pathfinder="$(or_flag "${shared}" "${pathfinder}")" + build_bindings="$(or_flag "${shared}" "${pathfinder}" "${bindings}")" + build_core="$(or_flag "${shared}" "${pathfinder}" "${bindings}" "${core}")" + + # Test gating: tests for a module must run whenever that module, any + # of its runtime dependencies, the shared test helper package, or + # shared infra changes. pathfinder tests are cheap and always run. + test_pathfinder=true + test_bindings="$(or_flag "${shared}" "${pathfinder}" "${bindings}" "${test_helpers}")" + test_core="$(or_flag "${shared}" "${pathfinder}" "${bindings}" "${core}" "${test_helpers}")" + + { + echo "bindings=${bindings}" + echo "core=${core}" + echo "pathfinder=${pathfinder}" + echo "python_meta=${python_meta}" + echo "test_helpers=${test_helpers}" + echo "shared=${shared}" + echo "build_bindings=${build_bindings}" + echo "build_core=${build_core}" + echo "build_pathfinder=${build_pathfinder}" + echo "test_bindings=${test_bindings}" + echo "test_core=${test_core}" + echo "test_pathfinder=${test_pathfinder}" + } >> "$GITHUB_OUTPUT" + + # NOTE: Build jobs are intentionally split by platform rather than using a single + # matrix. This allows each test job to depend only on its corresponding build, + # so faster platforms can proceed through build & test without waiting for slower + # ones. Keep these job definitions textually identical except for: + # - host-platform value + # - if: condition (build-linux-64 omits doc-only check since it's needed for docs) + build-linux-64: + needs: + - ci-vars + - should-skip + strategy: + fail-fast: false + matrix: + host-platform: + - linux-64 + name: Build ${{ matrix.host-platform }}, CUDA ${{ needs.ci-vars.outputs.CUDA_BUILD_VER }} + if: ${{ github.repository_owner == 'nvidia' && !fromJSON(needs.should-skip.outputs.skip) }} + secrets: inherit + uses: ./.github/workflows/build-wheel.yml + with: + host-platform: ${{ matrix.host-platform }} + cuda-version: ${{ needs.ci-vars.outputs.CUDA_BUILD_VER }} + prev-cuda-version: ${{ needs.ci-vars.outputs.CUDA_PREV_BUILD_VER }} + + # See build-linux-64 for why build jobs are split by platform. + build-linux-aarch64: + needs: + - ci-vars + - should-skip + strategy: + fail-fast: false + matrix: + host-platform: + - linux-aarch64 + name: Build ${{ matrix.host-platform }}, CUDA ${{ needs.ci-vars.outputs.CUDA_BUILD_VER }} + if: ${{ github.repository_owner == 'nvidia' && !fromJSON(needs.should-skip.outputs.skip) && !fromJSON(needs.should-skip.outputs.doc-only) }} + secrets: inherit + uses: ./.github/workflows/build-wheel.yml + with: + host-platform: ${{ matrix.host-platform }} + cuda-version: ${{ needs.ci-vars.outputs.CUDA_BUILD_VER }} + prev-cuda-version: ${{ needs.ci-vars.outputs.CUDA_PREV_BUILD_VER }} + + # See build-linux-64 for why build jobs are split by platform. + build-windows: + needs: + - ci-vars + - should-skip + strategy: + fail-fast: false + matrix: + host-platform: + - win-64 + name: Build ${{ matrix.host-platform }}, CUDA ${{ needs.ci-vars.outputs.CUDA_BUILD_VER }} + if: ${{ github.repository_owner == 'nvidia' && !fromJSON(needs.should-skip.outputs.skip) && !fromJSON(needs.should-skip.outputs.doc-only) }} + secrets: inherit + uses: ./.github/workflows/build-wheel.yml + with: + host-platform: ${{ matrix.host-platform }} + cuda-version: ${{ needs.ci-vars.outputs.CUDA_BUILD_VER }} + prev-cuda-version: ${{ needs.ci-vars.outputs.CUDA_PREV_BUILD_VER }} + + # NOTE: test-sdist jobs are split by platform (mirroring build-* and test-wheel-*) + # so platform-specific sources (e.g. cuda_bindings/*_windows.pyx selected by + # build_hooks.py) are exercised on their target OS. Keep these job definitions + # textually identical except for: + # - host-platform value + # - uses: (test-sdist-linux.yml vs test-sdist-windows.yml) + test-sdist-linux: + needs: + - ci-vars + - should-skip + name: Test sdist linux-64 + if: ${{ github.repository_owner == 'nvidia' && !fromJSON(needs.should-skip.outputs.skip) && !fromJSON(needs.should-skip.outputs.doc-only) }} + secrets: inherit + uses: ./.github/workflows/test-sdist-linux.yml + with: + host-platform: linux-64 + cuda-version: ${{ needs.ci-vars.outputs.CUDA_BUILD_VER }} + + # See test-sdist-linux for why sdist test jobs are split by platform. + test-sdist-windows: + needs: + - ci-vars + - should-skip + name: Test sdist win-64 + if: ${{ github.repository_owner == 'nvidia' && !fromJSON(needs.should-skip.outputs.skip) && !fromJSON(needs.should-skip.outputs.doc-only) }} + secrets: inherit + uses: ./.github/workflows/test-sdist-windows.yml + with: + host-platform: win-64 + cuda-version: ${{ needs.ci-vars.outputs.CUDA_BUILD_VER }} + + # NOTE: Test jobs are split by platform for the same reason as build jobs (see + # build-linux-64). Keep these job definitions textually identical except for: + # - host-platform value + # - build job under needs: + # - uses: (test-wheel-linux.yml vs test-wheel-windows.yml) + test-linux-64: + strategy: + fail-fast: false + matrix: + host-platform: + - linux-64 + name: Test ${{ matrix.host-platform }} + if: ${{ github.repository_owner == 'nvidia' && !fromJSON(needs.should-skip.outputs.doc-only) }} + permissions: + contents: read # This is required for actions/checkout + needs: + - ci-vars + - should-skip + - detect-changes + - build-linux-64 + secrets: inherit + uses: ./.github/workflows/test-wheel-linux.yml + with: + build-type: pull-request + host-platform: ${{ matrix.host-platform }} + build-ctk-ver: ${{ needs.ci-vars.outputs.CUDA_BUILD_VER }} + nruns: ${{ (github.event_name == 'schedule' && 5) || 1}} + skip-bindings-test: ${{ !fromJSON(needs.detect-changes.outputs.test_bindings) }} + + # See test-linux-64 for why test jobs are split by platform. + test-linux-aarch64: + strategy: + fail-fast: false + matrix: + host-platform: + - linux-aarch64 + name: Test ${{ matrix.host-platform }} + if: ${{ github.repository_owner == 'nvidia' && !fromJSON(needs.should-skip.outputs.doc-only) }} + permissions: + contents: read # This is required for actions/checkout + needs: + - ci-vars + - should-skip + - detect-changes + - build-linux-aarch64 + secrets: inherit + uses: ./.github/workflows/test-wheel-linux.yml + with: + build-type: pull-request + host-platform: ${{ matrix.host-platform }} + build-ctk-ver: ${{ needs.ci-vars.outputs.CUDA_BUILD_VER }} + nruns: ${{ (github.event_name == 'schedule' && 5) || 1}} + skip-bindings-test: ${{ !fromJSON(needs.detect-changes.outputs.test_bindings) }} + + # See test-linux-64 for why test jobs are split by platform. + test-windows: + strategy: + fail-fast: false + matrix: + host-platform: + - win-64 + name: Test ${{ matrix.host-platform }} + if: ${{ github.repository_owner == 'nvidia' && !fromJSON(needs.should-skip.outputs.doc-only) }} + permissions: + contents: read # This is required for actions/checkout + needs: + - ci-vars + - should-skip + - detect-changes + - build-windows + secrets: inherit + uses: ./.github/workflows/test-wheel-windows.yml + with: + build-type: pull-request + host-platform: ${{ matrix.host-platform }} + build-ctk-ver: ${{ needs.ci-vars.outputs.CUDA_BUILD_VER }} + nruns: ${{ (github.event_name == 'schedule' && 5) || 1}} + skip-bindings-test: ${{ !fromJSON(needs.detect-changes.outputs.test_bindings) }} + + doc: + name: Docs + if: ${{ github.repository_owner == 'nvidia' }} + # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages + permissions: + id-token: write + contents: write + pull-requests: write + needs: + - ci-vars + - build-linux-64 + secrets: inherit + uses: ./.github/workflows/build-docs.yml + with: + is-release: ${{ github.ref_type == 'tag' }} + + checks: + name: Check job status + if: always() + runs-on: ubuntu-latest + needs: + - should-skip + - detect-changes + - test-sdist-linux + - test-sdist-windows + - test-linux-64 + - test-linux-aarch64 + - test-windows + - doc + steps: + - name: Exit + run: | + # GitHub treats `result == 'skipped'` as success for required + # status checks (see CCCL gate comment + cccl#605). The previous + # `cancelled || failure` predicate let upstream build failures + # propagate as `skipped` on downstream test jobs and silently + # pass this aggregator. Adopt CCCL's `check_result` pattern: + # require an explicit `expected` status per dependency, where + # anything else (including `skipped` from a failed upstream) + # fails the gate. `if: always()` on the job still ensures this + # step runs even when needs are skipped. + if [[ "${{ needs.should-skip.outputs.skip }}" == "true" ]]; then + echo "[no-ci] - skipping aggregator checks" + exit 0 + fi + + doc_only="${{ needs.should-skip.outputs.doc-only }}" + status="success" + check_result() { + name=$1; expected=$2; result=$3 + echo "Checking $name: result='$result' (expected '$expected')" + if [[ "$result" != "$expected" ]]; then + echo "::error::$name did not match expected result" + status="failed" + fi + } + + # always expected to succeed (even in [doc-only] mode) + check_result "should-skip" "success" "${{ needs.should-skip.result }}" + check_result "detect-changes" "success" "${{ needs.detect-changes.result }}" + check_result "doc" "success" "${{ needs.doc.result }}" + + # [doc-only] flips these from 'success' to 'skipped' + if [[ "$doc_only" == "true" ]]; then expected="skipped"; else expected="success"; fi + check_result "test-sdist-linux" "$expected" "${{ needs.test-sdist-linux.result }}" + check_result "test-sdist-windows" "$expected" "${{ needs.test-sdist-windows.result }}" + check_result "test-linux-64" "$expected" "${{ needs.test-linux-64.result }}" + check_result "test-linux-aarch64" "$expected" "${{ needs.test-linux-aarch64.result }}" + check_result "test-windows" "$expected" "${{ needs.test-windows.result }}" + + [[ "$status" == "success" ]] diff --git a/.github/workflows/cleanup-pr-previews.yml b/.github/workflows/cleanup-pr-previews.yml new file mode 100644 index 00000000000..de9e348f430 --- /dev/null +++ b/.github/workflows/cleanup-pr-previews.yml @@ -0,0 +1,68 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +name: "Cleanup: PR Preview Documentation" + +on: + schedule: + # Run every night at 11pm EST (4am UTC during EST, 3am UTC during EDT) + # Using 4am UTC to be safe during EST (Nov-Mar) + - cron: '0 4 * * *' + workflow_dispatch: + inputs: + dry-run: + description: 'Run in dry-run mode (preview only, no changes)' + required: false + default: false + type: boolean + +permissions: + contents: write # Required to push changes to gh-pages branch + +jobs: + cleanup: + name: Clean up stale PR preview folders + runs-on: ubuntu-latest + # Only run for NVIDIA org to prevent forks from running this + if: github.repository_owner == 'NVIDIA' + steps: + - name: Checkout repository + uses: actions/checkout@v7.0.0 + with: + # Treeless clone: `git worktree add gh-pages` needs the commit graph, + # but historical blobs aren't required. + fetch-depth: 0 + filter: blob:none + + - name: Configure git identity + run: | + git config --global user.name "cuda-python-bot" + git config --global user.email "cuda-python-bot@users.noreply.github.com" + + - name: Run PR preview cleanup script + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + # Determine if we should run in dry-run mode + if [[ "${{ inputs.dry-run }}" == "true" ]]; then + echo "Running in dry-run mode (preview only)" + ./ci/cleanup-pr-previews --dry-run + else + echo "Running cleanup with push to gh-pages" + ./ci/cleanup-pr-previews --push + fi + + - name: Summary + if: always() + run: | + echo "### PR Preview Cleanup Summary" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + if [[ "${{ inputs.dry-run }}" == "true" ]]; then + echo "✅ Dry-run completed successfully" >> $GITHUB_STEP_SUMMARY + echo "No changes were made to the gh-pages branch" >> $GITHUB_STEP_SUMMARY + else + echo "✅ Cleanup completed and changes pushed to gh-pages" >> $GITHUB_STEP_SUMMARY + fi + echo "" >> $GITHUB_STEP_SUMMARY + echo "Workflow run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" >> $GITHUB_STEP_SUMMARY diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 00000000000..87bcd8e58d5 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,46 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +name: "Static Analysis: CodeQL Scan" + +on: + push: + branches: + - "pull-request/[0-9]+" + - "ctk-next" + - "main" +concurrency: + group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} + cancel-in-progress: true + +jobs: + analyze: + name: Analyze (${{ matrix.language }}) + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + include: + - language: python + build-mode: none + steps: + - name: Checkout repository + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + + - name: Initialize CodeQL + uses: github/codeql-action/init@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4.36.2 + with: + languages: ${{ matrix.language }} + build-mode: ${{ matrix.build-mode }} + queries: security-extended + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4.36.2 + with: + category: "/language:${{matrix.language}}" diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 00000000000..f1b8eb9f3a2 --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,501 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +name: "CI: Coverage" + +on: + schedule: + - cron: '0 0 * * *' # This runs the workflow every day at 12:00 AM UTC + workflow_dispatch: {} + +env: + PY_VER: "3.14" + LOCAL_CTK: "1" + GPU: "a100" + DRIVER: "latest" + +jobs: + coverage-vars: + runs-on: ubuntu-latest + outputs: + CUDA_VER: ${{ steps.get-vars.outputs.cuda_ver }} + steps: + - name: Checkout ${{ github.event.repository.name }} + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + - name: Get CUDA version + id: get-vars + run: | + cuda_ver=$(yq '.cuda.build.version' ci/versions.yml) + echo "cuda_ver=$cuda_ver" >> $GITHUB_OUTPUT + + coverage-linux: + name: Coverage (Linux) + needs: [coverage-vars] + runs-on: "linux-amd64-gpu-a100-latest-1" + permissions: + id-token: write + contents: write + defaults: + run: + shell: bash --noprofile --norc -xeuo pipefail {0} + env: + HOST_PLATFORM: "linux-64" + ARCH: "x86_64" + CUDA_VER: ${{ needs.coverage-vars.outputs.CUDA_VER }} + # Our self-hosted runners require a container + # TODO: use a different (nvidia?) container + container: + options: -u root --security-opt seccomp=unconfined --shm-size 16g + image: ubuntu:24.04 + env: + NVIDIA_VISIBLE_DEVICES: ${{ env.NVIDIA_VISIBLE_DEVICES }} + PIP_CACHE_DIR: "/tmp/pip-cache" + steps: + - name: Ensure GPU is working + run: nvidia-smi + + # We have to install git before checking out the repo (so that we can + # deploy the docs at the end). This means we can't use install_unix_deps + # action so install the git package. + - name: Install git + run: | + apt-get update + apt-get install -y git + + - name: Checkout ${{ github.event.repository.name }} + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + with: + # Treeless clone: setuptools-scm needs the commit graph (`git describe`) + # but not historical blobs. + fetch-depth: 0 + filter: blob:none + + - name: Fix workspace ownership + run: | + chown -R $(id -u):$(id -g) "$GITHUB_WORKSPACE" + + - name: Install dependencies + uses: ./.github/actions/install_unix_deps + continue-on-error: false + with: + dependencies: "tree rsync libsqlite3-0 g++ jq wget libgl1 libegl1" + dependent_exes: "tree rsync libsqlite3-0 g++ jq wget libgl1 libegl1" + + - name: Setup proxy cache + uses: nv-gha-runners/setup-proxy-cache@main + continue-on-error: true + + - name: Set environment variables + env: + BUILD_CUDA_VER: ${{ env.CUDA_VER }} + CUDA_VER: ${{ env.CUDA_VER }} + HOST_PLATFORM: ${{ env.HOST_PLATFORM }} + LOCAL_CTK: ${{ env.LOCAL_CTK }} + PY_VER: ${{ env.PY_VER }} + SHA: ${{ github.sha }} + run: | + ./ci/tools/env-vars test + echo "CUDA_PYTHON_COVERAGE=1" >> $GITHUB_ENV + + - name: Set up Python + uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0 + with: + python-version: ${{ env.PY_VER }} + env: + # we use self-hosted runners on which setup-python behaves weirdly... + AGENT_TOOLSDIRECTORY: "/opt/hostedtoolcache" + + - name: Set up mini CTK + if: ${{ env.LOCAL_CTK == '1' }} + uses: ./.github/actions/fetch_ctk + continue-on-error: false + with: + host-platform: ${{ env.HOST_PLATFORM }} + cuda-version: ${{ env.CUDA_VER }} + + - name: Create venv + run: | + python -m venv .venv + + - name: Build cuda-pathfinder + run: | + cd cuda_pathfinder + ../.venv/bin/pip install -v . --group test + + - name: Build cuda-bindings + run: | + cd cuda_bindings + ../.venv/bin/pip install -v . --group test + + - name: Build cuda-core + run: | + cd cuda_core + ../.venv/bin/pip install -v . --group test + + - name: Install coverage tools + run: | + .venv/bin/pip install coverage pytest-cov Cython + + - name: Set cuda package install root + run: | + echo "INSTALL_ROOT=$(.venv/bin/python -c 'import cuda; import os; print(os.path.dirname(cuda.__path__[0]))')" >> $GITHUB_ENV + echo "REPO_ROOT=$(pwd)" >> $GITHUB_ENV + + - name: Run cuda.pathfinder tests + continue-on-error: true + run: | + cd $INSTALL_ROOT + $REPO_ROOT/.venv/bin/pytest -v --cov=./cuda --cov-append --cov-context=test --cov-config=$REPO_ROOT/.coveragerc $REPO_ROOT/cuda_pathfinder/tests + + - name: Run cuda.bindings tests + continue-on-error: true + run: | + cd $INSTALL_ROOT + $REPO_ROOT/.venv/bin/pytest -v --cov=./cuda --cov-append --cov-context=test --cov-config=$REPO_ROOT/.coveragerc $REPO_ROOT/cuda_bindings/tests + + - name: Run cuda.core tests + continue-on-error: true + run: | + cd $INSTALL_ROOT + $REPO_ROOT/.venv/bin/pytest -v --cov=./cuda --cov-append --cov-context=test --cov-config=$REPO_ROOT/.coveragerc $REPO_ROOT/cuda_core/tests + + - name: Copy Linux coverage file to workspace + run: | + cp $INSTALL_ROOT/.coverage $REPO_ROOT/.coverage.linux + echo "Copied .coverage.linux to $REPO_ROOT" + ls -lh $REPO_ROOT/.coverage.linux + + - name: Upload Linux coverage data + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: coverage-data-linux + path: .coverage.linux + retention-days: 7 + include-hidden-files: true + if-no-files-found: error + + - name: Upload cuda source code for coverage mapping + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: cuda-source-linux + path: ${{ env.INSTALL_ROOT }}/cuda/ + retention-days: 7 + if-no-files-found: error + + # Build Windows wheels on GitHub-hosted runner (has VS, no GPU) + build-wheel-windows: + name: Build Wheels (Windows) + needs: [coverage-vars] + runs-on: windows-2022 + permissions: + contents: read + defaults: + run: + shell: bash --noprofile --norc -xeuo pipefail {0} + env: + HOST_PLATFORM: "win-64" + CUDA_PYTHON_COVERAGE: "1" + CUDA_VER: ${{ needs.coverage-vars.outputs.CUDA_VER }} + steps: + - name: Checkout ${{ github.event.repository.name }} + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + with: + # Treeless clone: setuptools-scm needs the commit graph (`git describe`) + # but not historical blobs. + fetch-depth: 0 + filter: blob:none + + - name: Set up Python + uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0 + with: + python-version: ${{ env.PY_VER }} + + - name: Set up MSVC + uses: step-security/msvc-dev-cmd@22c98154b708dbd743e6f27a933cf6ceba3305c4 # v1.13.1 + + - name: Set up mini CTK + uses: ./.github/actions/fetch_ctk + continue-on-error: false + with: + host-platform: win-64 + cuda-version: ${{ env.CUDA_VER }} + + - name: Create venv + run: | + python -m venv .venv + + - name: Build and install cuda.pathfinder + run: | + .venv/Scripts/pip install wheel setuptools Cython + .venv/Scripts/pip wheel -v --no-deps ./cuda_pathfinder -w ./wheels/ + + - name: Build cuda.bindings wheel + run: | + cd cuda_bindings + ../.venv/Scripts/pip wheel -v --no-deps . -w ../wheels/ + + - name: Build cuda.core wheel + run: | + export PIP_FIND_LINKS="$(pwd)/wheels" + export PIP_PRE=1 + cd cuda_core + ../.venv/Scripts/pip wheel -v --no-deps . -w ../wheels/ + + - name: List wheel artifacts + run: | + echo "=== Windows wheel artifacts ===" + ls -lahR ./wheels/ + + - name: Upload Windows wheel artifacts + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: coverage-windows-wheels + path: ./wheels/*.whl + retention-days: 1 + if-no-files-found: error + + # Run coverage tests on self-hosted GPU runner (no VS needed, installs pre-built wheels) + coverage-windows: + name: Coverage (Windows) + needs: [coverage-vars, build-wheel-windows] + runs-on: "windows-amd64-gpu-a100-latest-1" + permissions: + id-token: write + contents: write + env: + HOST_PLATFORM: "win-64" + ARCH: "amd64" + CUDA_PYTHON_COVERAGE: "1" + CUDA_VER: ${{ needs.coverage-vars.outputs.CUDA_VER }} + defaults: + run: + shell: bash --noprofile --norc -xeuo pipefail {0} + steps: + - name: Checkout ${{ github.event.repository.name }} + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + with: + fetch-depth: 1 + + - name: Setup proxy cache + uses: nv-gha-runners/setup-proxy-cache@main + continue-on-error: true + + # DRIVER above is 'latest' so install_gpu_driver.ps1 is intentionally + # skipped (it errors on latest/earliest); configure_driver_mode.ps1 + # still runs to put the pre-installed driver into TCC mode. + - name: Configure driver mode + shell: powershell + env: + DRIVER_MODE: "TCC" + run: | + ci/tools/configure_driver_mode.ps1 + + - name: Ensure GPU is working + run: | + nvidia-smi + + - name: Set up Python + uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0 + with: + python-version: ${{ env.PY_VER }} + + - name: Set up mini CTK + uses: ./.github/actions/fetch_ctk + continue-on-error: false + with: + host-platform: win-64 + cuda-version: ${{ env.CUDA_VER }} + + - name: Download Windows wheel artifacts + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: coverage-windows-wheels + path: ./wheels/ + + - name: List downloaded wheel artifacts + run: | + echo "=== Downloaded wheel artifacts ===" + ls -lahR ./wheels/ + + - name: Create venv + run: | + python -m venv .venv + + - name: Install wheels from build job + run: | + .venv/Scripts/pip install ./wheels/cuda_pathfinder*.whl + echo "Installed cuda.pathfinder" + + .venv/Scripts/pip install ./wheels/cuda_bindings*.whl + echo "Installed cuda.bindings" + + .venv/Scripts/pip install ./wheels/cuda_core*.whl + echo "Installed cuda.core" + + - name: Install test dependencies and coverage tools + run: | + .venv/Scripts/pip install -v ./cuda_python_test_helpers + .venv/Scripts/pip install coverage pytest-cov Cython + .venv/Scripts/pip install --group ./cuda_pathfinder/pyproject.toml:test + .venv/Scripts/pip install --group ./cuda_bindings/pyproject.toml:test + .venv/Scripts/pip install --group ./cuda_core/pyproject.toml:test + + - name: Get install root + id: install-root + run: | + INSTALL_ROOT=$(.venv/Scripts/python -c 'import cuda; import os; print(os.path.dirname(cuda.__path__[0]))') + echo "INSTALL_ROOT=$INSTALL_ROOT" >> $GITHUB_OUTPUT + echo "Install root: $INSTALL_ROOT" + + - name: Run cuda.pathfinder tests + continue-on-error: true + run: | + cd "${{ steps.install-root.outputs.INSTALL_ROOT }}" + "$GITHUB_WORKSPACE/.venv/Scripts/pytest" -v --cov=./cuda --cov-append --cov-context=test --cov-config="$GITHUB_WORKSPACE/.coveragerc" "$GITHUB_WORKSPACE/cuda_pathfinder/tests" + + # Cython linetrace under coverage on Windows needs more stack than the + # default 1 MB thread size. The helper runs pytest on an 8 MB thread. + - name: Run cuda.bindings tests (with 8MB stack) + continue-on-error: true + run: | + "$GITHUB_WORKSPACE/.venv/Scripts/python" "$GITHUB_WORKSPACE/ci/tools/run_pytest_with_stack.py" \ + --cwd "${{ steps.install-root.outputs.INSTALL_ROOT }}" \ + -v --cov=./cuda --cov-append --cov-context=test \ + --cov-config="$GITHUB_WORKSPACE/.coveragerc" \ + "$GITHUB_WORKSPACE/cuda_bindings/tests" + + - name: Run cuda.core tests (with 8MB stack) + continue-on-error: true + run: | + "$GITHUB_WORKSPACE/.venv/Scripts/python" "$GITHUB_WORKSPACE/ci/tools/run_pytest_with_stack.py" \ + --cwd "${{ steps.install-root.outputs.INSTALL_ROOT }}" \ + -v --cov=./cuda --cov-append --cov-context=test \ + --cov-config="$GITHUB_WORKSPACE/.coveragerc" \ + "$GITHUB_WORKSPACE/cuda_core/tests" + + - name: Copy Windows coverage file to workspace + run: | + cp "${{ steps.install-root.outputs.INSTALL_ROOT }}/.coverage" "$GITHUB_WORKSPACE/.coverage.windows" + echo "Copied .coverage.windows to $GITHUB_WORKSPACE" + ls -lh "$GITHUB_WORKSPACE/.coverage.windows" + + - name: Upload Windows coverage data + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: coverage-data-windows + path: .coverage.windows + retention-days: 7 + include-hidden-files: true + if-no-files-found: error + + combine-and-deploy: + name: Combine Coverage and Deploy + needs: [coverage-linux, coverage-windows] + runs-on: ubuntu-latest + if: always() + permissions: + id-token: write + contents: write + steps: + - name: Checkout ${{ github.event.repository.name }} + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + + - name: Set up Python + uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0 + with: + python-version: ${{ env.PY_VER }} + + - name: Install coverage + run: | + # .coveragerc enables Cython.Coverage plugin; ensure it's available here too. + pip install coverage[toml] Cython + + - name: Download Linux coverage data + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: coverage-data-linux + path: ./ + + - name: Download cuda source code + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: cuda-source-linux + path: ./cuda/ + + - name: Download Windows coverage data + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: coverage-data-windows + path: ./ + + - name: Combine coverage data + run: | + echo "=== Working directory ===" + pwd + echo "" + echo "=== All files in root ===" + ls -la + echo "" + + # Verify both Linux and Windows coverage files exist + echo "=== Checking coverage files ===" + + if [ ! -f ".coverage.linux" ]; then + echo "[ERROR] .coverage.linux not found!" + exit 1 + fi + echo "[OK] Found .coverage.linux" + + if [ ! -f ".coverage.windows" ]; then + echo "[ERROR] .coverage.windows not found!" + exit 1 + fi + echo "[OK] Found .coverage.windows" + + echo "=== Available coverage files ===" + ls -lh .coverage.* + + echo "=== Cuda source structure ===" + find ./cuda -type d || { + echo "[ERROR] No cuda source directory!" + exit 1 + } + + # Combine all .coverage.* files + echo "" + echo "=== Combining coverage data ===" + coverage combine --rcfile=./.coveragerc --keep .coverage.* + + # Generate reports + echo "" + echo "=== Generating HTML, XML, and text reports ===" + coverage html --rcfile=./.coveragerc + coverage xml --rcfile=./.coveragerc -o coverage.xml + coverage report --rcfile=./.coveragerc + + # Prepare for upload + mkdir -p ./docs/coverage + mv htmlcov/* ./docs/coverage/ + mv coverage.xml ./docs/coverage/ + + echo "" + echo "[SUCCESS] Coverage reports generated successfully" + + - name: Archive combined coverage results + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: coverage-combined + path: docs/coverage/ + retention-days: 7 + include-hidden-files: true + + - name: Deploy to gh-pages + uses: JamesIves/github-pages-deploy-action@d92aa235d04922e8f08b40ce78cc5442fcfbfa2f # v4.8.0 + with: + git-config-name: cuda-python-bot + git-config-email: cuda-python-bot@users.noreply.github.com + folder: docs/ + target-folder: docs/ + commit-message: "Deploy combined coverage (Linux + Windows): ${{ github.sha }}" + clean: false diff --git a/.github/workflows/pr-auto-label.yml b/.github/workflows/pr-auto-label.yml new file mode 100644 index 00000000000..dfd77156a26 --- /dev/null +++ b/.github/workflows/pr-auto-label.yml @@ -0,0 +1,23 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +name: "CI: Auto-label PRs by path" + +on: + pull_request_target: + types: + - opened + - synchronize + +jobs: + auto-label: + name: Auto-label by changed paths + if: github.repository_owner == 'NVIDIA' + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write + steps: + - name: Apply labels + uses: actions/labeler@e52e4fb63ed5cd0e07abaad9826b2a893ccb921f # main (include actions/labeler#917) diff --git a/.github/workflows/pr-metadata-check.yml b/.github/workflows/pr-metadata-check.yml new file mode 100644 index 00000000000..6f60ec45bf4 --- /dev/null +++ b/.github/workflows/pr-metadata-check.yml @@ -0,0 +1,135 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +name: "CI: Enforce assignee/label/milestone on PRs" + +on: + pull_request_target: + types: + - opened + - edited + - synchronize + - assigned + - unassigned + - labeled + - unlabeled + - reopened + - ready_for_review + +jobs: + check-metadata: + name: PR has assignee, labels, and milestone + if: github.repository_owner == 'NVIDIA' + runs-on: ubuntu-latest + steps: + - name: Check for assignee, labels, and milestone + env: + PR_URL: ${{ github.event.pull_request.html_url }} + PR_NUMBER: ${{ github.event.pull_request.number }} + GH_REPO: ${{ github.repository }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + IS_BOT: ${{ github.actor == 'dependabot[bot]' || github.actor == 'pre-commit-ci[bot]' || github.actor == 'copy-pr-bot[bot]' }} + IS_DRAFT: ${{ github.event.pull_request.draft }} + run: | + if [ "$IS_BOT" = "true" ] || [ "$IS_DRAFT" = "true" ]; then + echo "Skipping check for bot or draft PR." + exit 0 + fi + + # Fetch live PR data to avoid stale event payload (race condition + # when labels/milestone are added shortly after PR creation). + PR_JSON=$(gh pr view "${PR_NUMBER}" --repo "${GH_REPO}" \ + --json assignees,labels,milestone \ + --jq '{assignees: .assignees, labels: .labels, milestone: (.milestone.title // empty)}') + ASSIGNEES=$(echo "$PR_JSON" | jq '.assignees') + LABELS=$(echo "$PR_JSON" | jq '.labels') + MILESTONE=$(echo "$PR_JSON" | jq -r '.milestone') + + ERRORS="" + + ASSIGNEE_COUNT=$(echo "$ASSIGNEES" | jq 'length') + if [ "$ASSIGNEE_COUNT" -eq 0 ]; then + ERRORS="${ERRORS}- **Missing assignee**: assign at least one person to this PR.\n" + fi + + # Module labels identify which package the PR touches. + # Cross-cutting labels exempt PRs from needing a module label. + # Read label names line-by-line (jq outputs one per line) so + # multi-word GitHub labels are not split by shell word-splitting. + MODULE_LABELS="cuda.bindings cuda.core cuda.pathfinder" + MODULE_EXEMPT_LABELS="CI/CD" + HAS_MODULE=false + while IFS= read -r label; do + [ -n "$label" ] || continue + for mod in $MODULE_LABELS $MODULE_EXEMPT_LABELS; do + if [ "$label" = "$mod" ]; then + HAS_MODULE=true + break 2 + fi + done + done < <(echo "$LABELS" | jq -r '.[].name') + + if [ "$HAS_MODULE" = "false" ]; then + ERRORS="${ERRORS}- **Missing module label**: add at least one of: \`cuda.bindings\`, \`cuda.core\`, \`cuda.pathfinder\` (or a cross-cutting label such as \`CI/CD\`).\n" + fi + + # Type labels categorize the kind of change. + TYPE_LABELS="bug enhancement feature documentation test example CI/CD packaging dependencies performance experiment RFC support P0 P1 P2" + HAS_TYPE=false + while IFS= read -r label; do + [ -n "$label" ] || continue + for typ in $TYPE_LABELS; do + if [ "$label" = "$typ" ]; then + HAS_TYPE=true + break 2 + fi + done + done < <(echo "$LABELS" | jq -r '.[].name') + + if [ "$HAS_TYPE" = "false" ]; then + ERRORS="${ERRORS}- **Missing type label**: add at least one of: \`bug\`, \`enhancement\`, \`feature\`, \`documentation\`, \`test\`, \`example\`, \`CI/CD\`, \`packaging\`, \`dependencies\`, \`performance\`, \`experiment\`, \`RFC\`, \`support\`, \`P0\`, \`P1\`, \`P2\`.\n" + fi + + if [ -z "$MILESTONE" ]; then + ERRORS="${ERRORS}- **Missing milestone**: assign a milestone to this PR.\n" + fi + + # Block PRs with labels that indicate they are not ready to merge. + # Match blocked label names exactly (case-insensitively); emit the + # original spelling from the payload so error text matches GitHub. + BLOCKED_LABELS=$(jq -r ' + (["blocked", "do not merge"]) as $blocking + | .[] + | .name as $n + | if ($blocking | index($n | ascii_downcase)) != null + then $n + else empty + end + ' <<<"$LABELS") + while IFS= read -r label; do + [ -n "$label" ] || continue + ERRORS="${ERRORS}- **Blocked label detected**: label \`$label\` prevents merging. Remove it when the PR is ready.\n" + done <<<"$BLOCKED_LABELS" + + if [ -n "$ERRORS" ]; then + echo "::error::This PR is missing required metadata. See the job summary for details." + { + echo "## PR Metadata Check Failed" + echo "" + printf '%b' "$ERRORS" + echo "" + echo "Please update the PR at: $PR_URL" + } >> "$GITHUB_STEP_SUMMARY" + exit 1 + fi + + ASSIGNEE_LIST=$(echo "$ASSIGNEES" | jq -r '.[].login' | paste -sd ', ' -) + LABEL_LIST=$(echo "$LABELS" | jq -r '.[].name' | paste -sd ', ' -) + { + echo "## PR Metadata Check Passed" + echo "" + echo "- **Assignees**: $ASSIGNEE_LIST" + echo "- **Labels**: $LABEL_LIST" + echo "- **Milestone**: $MILESTONE" + } >> "$GITHUB_STEP_SUMMARY" diff --git a/.github/workflows/release-cuda-pathfinder.yml b/.github/workflows/release-cuda-pathfinder.yml new file mode 100644 index 00000000000..f3d1952e9ec --- /dev/null +++ b/.github/workflows/release-cuda-pathfinder.yml @@ -0,0 +1,386 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +# One-click release workflow for cuda-pathfinder. +# +# Provide a release tag. The workflow finds +# the CI run, creates a draft GitHub release with the standard +# body, builds versioned docs, uploads source archive + wheels to the +# release, publishes to TestPyPI, verifies the install, publishes to PyPI, +# verifies again, and finally marks the release as published. + +name: "Release: cuda-pathfinder" + +on: + workflow_dispatch: + inputs: + tag: + description: "Release tag to publish (e.g. cuda-pathfinder-v1.3.5)" + required: true + type: string + +concurrency: + group: release-cuda-pathfinder + cancel-in-progress: false + +defaults: + run: + shell: bash --noprofile --norc -xeuo pipefail {0} + +jobs: + # -------------------------------------------------------------------------- + # Collect release metadata, find the CI run, create a draft release. + # -------------------------------------------------------------------------- + prepare: + runs-on: ubuntu-latest + permissions: + contents: write + outputs: + tag: ${{ steps.vars.outputs.tag }} + version: ${{ steps.vars.outputs.version }} + run-id: ${{ steps.detect-run.outputs.run-id }} + steps: + - name: Verify running on default branch + run: | + if [[ "${{ github.ref_name }}" != "${{ github.event.repository.default_branch }}" ]]; then + echo "::error::This workflow must be triggered from the default branch (${{ github.event.repository.default_branch }}). Got: ${{ github.ref_name }} (select the correct branch in the 'Use workflow from' dropdown)." + exit 1 + fi + + - name: Set release variables + id: vars + env: + TAG_INPUT: ${{ inputs.tag }} + run: | + version="${TAG_INPUT#cuda-pathfinder-v}" + { + echo "tag=${TAG_INPUT}" + echo "version=${version}" + } >> "$GITHUB_OUTPUT" + + - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + with: + # lookup-run-id resolves the git tag to a SHA; we need tags but not history. + fetch-depth: 1 + fetch-tags: true + # Resolve only the exact tag ref; checkout fails if the tag does not exist. + ref: refs/tags/${{ steps.vars.outputs.tag }} + + - name: Check release notes exist + env: + VERSION: ${{ steps.vars.outputs.version }} + run: | + notes="cuda_pathfinder/docs/source/release/${VERSION}-notes.rst" + if [[ ! -f "${notes}" ]]; then + echo "::error::Release notes not found: ${notes}" + echo "Create the release notes file before running this workflow." + exit 1 + fi + + - name: Detect CI run ID + id: detect-run + env: + GH_TOKEN: ${{ github.token }} + TAG: ${{ steps.vars.outputs.tag }} + run: | + run_id=$(./ci/tools/lookup-run-id "${TAG}" "${{ github.repository }}") + echo "run-id=${run_id}" >> "$GITHUB_OUTPUT" + + - name: Create draft release + env: + GH_TOKEN: ${{ github.token }} + TAG: ${{ steps.vars.outputs.tag }} + VERSION: ${{ steps.vars.outputs.version }} + run: | + # If the release exists and is already published, stop early. + existing_draft=$(gh release view "${TAG}" --repo "${{ github.repository }}" --json isDraft --jq '.isDraft' 2>/dev/null || echo "missing") + if [[ "${existing_draft}" == "false" ]]; then + echo "::error::Release ${TAG} already exists and is published. Cannot re-release." + exit 1 + fi + if [[ "${existing_draft}" == "true" ]]; then + exit 0 + fi + cat > /tmp/release-body.md < "release/${archive}.tar.gz.sha256sum" + + - name: Download wheels + env: + GH_TOKEN: ${{ github.token }} + run: | + ./ci/tools/download-wheels "${RUN_ID}" "cuda-pathfinder" "${{ github.repository }}" "release/wheels" + + - name: Upload to release + env: + GH_TOKEN: ${{ github.token }} + run: | + gh release upload "${TAG}" \ + --repo "${{ github.repository }}" \ + --clobber \ + release/*.tar.gz release/*.sha256sum release/wheels/*.whl + + # -------------------------------------------------------------------------- + # Publish to TestPyPI. + # -------------------------------------------------------------------------- + publish-testpypi: + needs: [prepare, docs] + if: ${{ !cancelled() && needs.prepare.result == 'success' }} + runs-on: ubuntu-latest + environment: + name: testpypi + url: https://test.pypi.org/p/cuda-pathfinder/ + permissions: + id-token: write + env: + RUN_ID: ${{ needs.prepare.outputs.run-id }} + steps: + - name: Download wheels + env: + GH_TOKEN: ${{ github.token }} + run: | + # Intentionally inline artifact download logic here so publish jobs + # are pinned only to RUN_ID artifacts and do not depend on repo checkout. + mkdir -p dist + gh run download "${RUN_ID}" -p "cuda-pathfinder*" -R "${{ github.repository }}" + shopt -s nullglob globstar + for artifact_dir in cuda-*; do + if [[ ! -d "${artifact_dir}" ]]; then + continue + fi + if [[ "${artifact_dir}" == *-tests ]]; then + continue + fi + wheels=( "${artifact_dir}"/**/*.whl ) + if (( ${#wheels[@]} > 0 )); then + mv "${wheels[@]}" dist/ + fi + done + rm -rf cuda-* + ls -la dist + + - name: Publish to TestPyPI + uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0 + with: + repository-url: https://test.pypi.org/legacy/ + + # -------------------------------------------------------------------------- + # Verify the TestPyPI package installs and imports correctly. + # -------------------------------------------------------------------------- + verify-testpypi: + needs: [prepare, publish-testpypi] + runs-on: ubuntu-latest + env: + VERSION: ${{ needs.prepare.outputs.version }} + steps: + - name: Install from TestPyPI and verify + run: | + python3 -m venv /tmp/verify + source /tmp/verify/bin/activate + max_attempts=6 + retry_seconds=30 + for ((attempt=1; attempt<=max_attempts; attempt++)); do + if pip install \ + --index-url https://test.pypi.org/simple/ \ + --extra-index-url https://pypi.org/simple/ \ + "cuda-pathfinder==${VERSION}"; then + break + fi + if (( attempt == max_attempts )); then + echo "::error::Failed to install cuda-pathfinder==${VERSION} from TestPyPI after ${max_attempts} attempts" + exit 1 + fi + sleep "${retry_seconds}" + done + installed=$(python -c "from cuda.pathfinder import __version__; print(__version__)") + if [[ "${installed}" != "${VERSION}" ]]; then + echo "::error::Version mismatch: expected ${VERSION}, got ${installed}" + exit 1 + fi + + # -------------------------------------------------------------------------- + # Publish to PyPI. + # -------------------------------------------------------------------------- + publish-pypi: + needs: [prepare, verify-testpypi] + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/cuda-pathfinder/ + permissions: + id-token: write + env: + RUN_ID: ${{ needs.prepare.outputs.run-id }} + steps: + - name: Download wheels + env: + GH_TOKEN: ${{ github.token }} + run: | + # Intentionally inline artifact download logic here so publish jobs + # are pinned only to RUN_ID artifacts and do not depend on repo checkout. + mkdir -p dist + gh run download "${RUN_ID}" -p "cuda-pathfinder*" -R "${{ github.repository }}" + shopt -s nullglob globstar + for artifact_dir in cuda-*; do + if [[ ! -d "${artifact_dir}" ]]; then + continue + fi + if [[ "${artifact_dir}" == *-tests ]]; then + continue + fi + wheels=( "${artifact_dir}"/**/*.whl ) + if (( ${#wheels[@]} > 0 )); then + mv "${wheels[@]}" dist/ + fi + done + rm -rf cuda-* + ls -la dist + + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0 + + # -------------------------------------------------------------------------- + # Verify the PyPI package installs and imports correctly. + # -------------------------------------------------------------------------- + verify-pypi: + needs: [prepare, publish-pypi] + runs-on: ubuntu-latest + env: + VERSION: ${{ needs.prepare.outputs.version }} + steps: + - name: Install from PyPI and verify + run: | + python3 -m venv /tmp/verify + source /tmp/verify/bin/activate + max_attempts=6 + retry_seconds=30 + for ((attempt=1; attempt<=max_attempts; attempt++)); do + if pip install "cuda-pathfinder==${VERSION}"; then + break + fi + if (( attempt == max_attempts )); then + echo "::error::Failed to install cuda-pathfinder==${VERSION} from PyPI after ${max_attempts} attempts" + exit 1 + fi + sleep "${retry_seconds}" + done + installed=$(python -c "from cuda.pathfinder import __version__; print(__version__)") + if [[ "${installed}" != "${VERSION}" ]]; then + echo "::error::Version mismatch: expected ${VERSION}, got ${installed}" + exit 1 + fi + + # -------------------------------------------------------------------------- + # Verify docs and publish the release (mark non-draft). + # -------------------------------------------------------------------------- + finalize: + needs: [prepare, verify-pypi, upload-assets] + runs-on: ubuntu-latest + permissions: + contents: write + env: + TAG: ${{ needs.prepare.outputs.tag }} + VERSION: ${{ needs.prepare.outputs.version }} + steps: + - name: Verify docs URL + run: | + url="https://nvidia.github.io/cuda-python/cuda-pathfinder/${VERSION}/" + status=$(curl -sL -o /dev/null -w '%{http_code}' "${url}") + if [[ "${status}" != "200" ]]; then + echo "::warning::Docs URL returned HTTP ${status} -- docs may not be deployed yet" + fi + + - name: Verify release is still a draft + env: + GH_TOKEN: ${{ github.token }} + run: | + is_draft=$(gh release view "${TAG}" --repo "${{ github.repository }}" --json isDraft --jq '.isDraft') + if [[ "${is_draft}" != "true" ]]; then + echo "::error::Release ${TAG} is no longer a draft (was it published manually?)" + exit 1 + fi + + - name: Publish release + env: + GH_TOKEN: ${{ github.token }} + run: | + gh release edit "${TAG}" \ + --repo "${{ github.repository }}" \ + --draft=false \ + --latest=false + docs_url="https://nvidia.github.io/cuda-python/cuda-pathfinder/${VERSION}/" + echo "${docs_url}" + printf '%s\n' "${docs_url}" >> "$GITHUB_STEP_SUMMARY" diff --git a/.github/workflows/release-upload.yml b/.github/workflows/release-upload.yml new file mode 100644 index 00000000000..77681096ed9 --- /dev/null +++ b/.github/workflows/release-upload.yml @@ -0,0 +1,107 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +name: "CI: Upload git archive" + +on: + workflow_call: + inputs: + git-tag: + type: string + required: true + run-id: + description: "The GHA run ID that generated validated artifacts" + type: string + required: true + component: + description: "Component to download wheels for" + type: string + required: true + dry-run: + description: "Validate release artifacts without uploading them to the GitHub release" + type: boolean + required: false + default: false + +concurrency: + # Concurrency group that uses the workflow name and PR number if available + # or commit SHA as a fallback. If a new build is triggered under that + # concurrency group while a previous build is running it will be canceled. + # Repeated pushes to a PR will cancel all previous builds, while multiple + # merges to main will not cancel. + group: ${{ github.workflow }}-${{ github.ref_name || github.sha }} + cancel-in-progress: true + +permissions: + contents: write + +jobs: + # create source archive and upload it to the published release + # URL to the archive: https://github.com/NVIDIA//releases/download//-.tar.gz + upload: + if: ${{ !github.event.repository.fork }} + runs-on: ubuntu-latest + env: + ARCHIVE_NAME: ${{ github.event.repository.name }}-${{ inputs.git-tag }} + steps: + - name: Checkout Source + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + with: + fetch-depth: 1 + ref: ${{ inputs.git-tag }} + + - name: Create Release Directory + run: mkdir -p release + + - name: Archive Source + run: > + git archive + --format=tar.gz + --prefix="${{ env.ARCHIVE_NAME }}/" + --output="release/${{ env.ARCHIVE_NAME }}.tar.gz" + ${{ inputs.git-tag }} + + - name: Compute Checksum + run: > + sha256sum "release/${{ env.ARCHIVE_NAME }}.tar.gz" + | awk '{print $1}' + > "release/${{ env.ARCHIVE_NAME }}.tar.gz.sha256sum" + + - name: Upload Archive + if: ${{ !inputs.dry-run }} + env: + GH_TOKEN: ${{ github.token }} + run: > + gh release upload + --clobber "${{ inputs.git-tag }}" + --repo "${{ github.repository }}" + release/* + + - name: Download and Validate Wheels + env: + GH_TOKEN: ${{ github.token }} + run: | + # Use the shared script to download wheels + ./ci/tools/download-wheels "${{ inputs.run-id }}" "${{ inputs.component }}" "${{ github.repository }}" "release/wheels" + + # Validate that release wheels match the expected version from tag. + ./ci/tools/validate-release-wheels "${{ inputs.git-tag }}" "${{ inputs.component }}" "release/wheels" + + - name: Upload Wheels + if: ${{ !inputs.dry-run }} + env: + GH_TOKEN: ${{ github.token }} + run: | + if [[ -d "release/wheels" && $(ls -A release/wheels 2>/dev/null | wc -l) -gt 0 ]]; then + echo "Uploading wheels to release ${{ inputs.git-tag }}" + gh release upload --clobber "${{ inputs.git-tag }}" --repo "${{ github.repository }}" release/wheels/* + fi + + - name: Upload dry-run release artifacts + if: ${{ inputs.dry-run }} + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: release-artifacts-dry-run-${{ inputs.component }}-${{ inputs.git-tag }} + path: release/ + retention-days: 3 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000000..37322974a02 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,275 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +name: "CI: Release" + +# Manually-triggered release workflow. Creates a release draft if one doesn't exist +# for the given tag, or uses an existing draft, then publishes the selected wheels +# to TestPyPI followed by PyPI. The dry-run mode validates the release path +# without publishing to external release surfaces. +# +# Maintenance note: non-trivial changes to this workflow should be validated +# with dry-run workflow_dispatch runs before merging. Suggested focused matrix: +# - mainline: +# component=cuda-bindings +# git-tag= +# backport-git-tag=not planned +# run-id= +# dry-run-docs-branch=gh-pages-dry-run +# - backport sequence: +# 1. component=cuda-bindings +# git-tag= +# backport-git-tag= +# 2. component=cuda-python +# git-tag= +# backport-git-tag= +# run-id= +# dry-run-docs-branch=gh-pages-dry-run +# Leave run-id blank so determine-run-id is exercised. For exhaustive coverage, +# add a mainline cuda-python dry-run when changes could affect metapackage +# artifact validation, docs routing, or component-specific release behavior. + +on: + workflow_dispatch: + inputs: + component: + description: "Component to release" + required: true + type: choice + options: + - cuda-core + - cuda-bindings + - cuda-pathfinder + - cuda-python + release-action: + description: "What to run" + required: true + type: choice + options: + - dry-run + - full-release + default: dry-run + git-tag: + description: "The release git tag" + required: true + type: string + backport-git-tag: + description: "Mainline cuda-bindings/cuda-python only: planned backport tag, or 'not planned'. Leave blank for backport releases." + required: false + type: string + default: "" + run-id: + description: "The GHA run ID that generated validated artifacts (optional - auto-detects successful tag-triggered CI run for git-tag)" + required: false + type: string + default: "" + dry-run-docs-branch: + description: "Dry-run only: optional gh-pages-* branch to receive generated docs, for example gh-pages-dry-run" + required: false + type: string + default: "" + +defaults: + run: + shell: bash --noprofile --norc -xeuo pipefail {0} + +jobs: + determine-run-id: + runs-on: ubuntu-latest + outputs: + run-id: ${{ steps.lookup-run-id.outputs.run-id }} + steps: + - name: Checkout Source + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + with: + # lookup-run-id resolves the git tag to a SHA; we need tags but not history. + fetch-depth: 1 + fetch-tags: true + + - name: Determine Run ID + id: lookup-run-id + env: + GH_TOKEN: ${{ github.token }} + run: | + if [[ -n "${{ inputs.run-id }}" ]]; then + echo "Using provided run ID: ${{ inputs.run-id }}" + RUN_ID="${{ inputs.run-id }}" + else + echo "Auto-detecting successful tag-triggered run ID for tag: ${{ inputs.git-tag }}" + RUN_ID=$(./ci/tools/lookup-run-id "${{ inputs.git-tag }}" "${{ github.repository }}") + echo "Auto-detected run ID: $RUN_ID" + fi + echo "run-id=$RUN_ID" >> "$GITHUB_OUTPUT" + + check-tag: + runs-on: ubuntu-latest + steps: + - name: Checkout Source + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + with: + # Dry-run validation resolves the requested tag locally; we need tags but not history. + fetch-depth: 1 + fetch-tags: true + + - name: Check release tag and draft state + env: + GH_TOKEN: ${{ github.token }} + RELEASE_ACTION: ${{ inputs.release-action }} + RELEASE_GIT_TAG: ${{ inputs.git-tag }} + DRY_RUN_DOCS_BRANCH: ${{ inputs.dry-run-docs-branch }} + run: | + if [[ "$RELEASE_ACTION" == "full-release" && -n "$DRY_RUN_DOCS_BRANCH" ]]; then + echo "error: dry-run-docs-branch is only valid with release-action=dry-run" >&2 + exit 1 + fi + if [[ "$RELEASE_ACTION" == "dry-run" && -n "$DRY_RUN_DOCS_BRANCH" && ! "$DRY_RUN_DOCS_BRANCH" =~ ^gh-pages-[[:alnum:]._/-]+$ ]]; then + echo "error: dry-run-docs-branch must be a non-production gh-pages-* branch" >&2 + exit 1 + fi + if [[ "$RELEASE_ACTION" == "dry-run" ]]; then + git rev-parse --verify "${RELEASE_GIT_TAG}^{commit}" + echo "Dry-run selected; not checking or creating a GitHub release draft." + exit 0 + fi + + mapfile -t tags < <(gh release list -R "${{ github.repository }}" --json tagName --jq '.[] | .tagName') + mapfile -t is_draft < <(gh release list -R "${{ github.repository }}" --json isDraft --jq '.[] | .isDraft') + + found=0 + for idx in "${!tags[@]}"; do + if [[ "${tags[$idx]}" == "${{ inputs.git-tag }}" ]]; then + echo "found existing release for ${{ inputs.git-tag }}" + found=1 + if [[ "${is_draft[$idx]}" != "true" ]]; then + echo "the release note is not in draft state" + exit 1 + fi + break + fi + done + if [[ "$found" == 0 ]]; then + echo "no release found for ${{ inputs.git-tag }}, creating draft release" + gh release create "${{ inputs.git-tag }}" --draft --repo "${{ github.repository }}" --title "Release ${{ inputs.git-tag }}" --notes "Release ${{ inputs.git-tag }}" + fi + + check-release-notes: + runs-on: ubuntu-latest + steps: + - name: Checkout Source + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + + - name: Set up Python + uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0 + with: + python-version: "3.12" + + - name: Check versioned release notes exist + run: | + python ci/tools/check_release_notes.py \ + --git-tag "${{ inputs.git-tag }}" \ + --component "${{ inputs.component }}" \ + --backport-git-tag "${{ inputs.backport-git-tag }}" + + doc: + name: Build release docs + if: ${{ github.repository_owner == 'nvidia' }} + # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages + permissions: + id-token: write + contents: write + pull-requests: write + needs: + - check-tag + - check-release-notes + - determine-run-id + secrets: inherit + uses: ./.github/workflows/build-docs.yml + with: + component: ${{ inputs.component }} + git-tag: ${{ inputs.git-tag }} + run-id: ${{ needs.determine-run-id.outputs.run-id }} + is-release: true + deploy-docs: ${{ inputs.release-action == 'full-release' || inputs.dry-run-docs-branch != '' }} + docs-branch: ${{ (inputs.release-action == 'dry-run' && inputs.dry-run-docs-branch) || 'gh-pages' }} + + upload-archive: + name: Validate release artifacts + permissions: + contents: write + needs: + - check-tag + - check-release-notes + - determine-run-id + - doc + secrets: inherit + uses: ./.github/workflows/release-upload.yml + with: + git-tag: ${{ inputs.git-tag }} + run-id: ${{ needs.determine-run-id.outputs.run-id }} + component: ${{ inputs.component }} + dry-run: ${{ inputs.release-action == 'dry-run' }} + + publish-testpypi: + name: Publish wheels to TestPyPI + if: ${{ inputs.release-action == 'full-release' }} + runs-on: ubuntu-latest + needs: + - check-tag + - check-release-notes + - determine-run-id + - doc + environment: + name: testpypi + url: https://test.pypi.org/p/${{ inputs.component }}/ + permissions: + id-token: write + steps: + - name: Checkout Source + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + + - name: Download component wheels + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + ./ci/tools/download-wheels "${{ needs.determine-run-id.outputs.run-id }}" "${{ inputs.component }}" "${{ github.repository }}" "dist" + + - name: Validate wheel versions for release tag + run: | + ./ci/tools/validate-release-wheels "${{ inputs.git-tag }}" "${{ inputs.component }}" "dist" + + - name: Publish package distributions to TestPyPI + uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0 + with: + repository-url: https://test.pypi.org/legacy/ + + publish-pypi: + name: Publish wheels to PyPI + if: ${{ inputs.release-action == 'full-release' }} + runs-on: ubuntu-latest + needs: + - determine-run-id + - publish-testpypi + environment: + name: pypi + url: https://pypi.org/p/${{ inputs.component }}/ + permissions: + id-token: write + steps: + - name: Checkout Source + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + + - name: Download component wheels + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + ./ci/tools/download-wheels "${{ needs.determine-run-id.outputs.run-id }}" "${{ inputs.component }}" "${{ github.repository }}" "dist" + + - name: Validate wheel versions for release tag + run: | + ./ci/tools/validate-release-wheels "${{ inputs.git-tag }}" "${{ inputs.component }}" "dist" + + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0 + + # TODO: add another job to make the release leave the draft state? diff --git a/.github/workflows/test-sdist-linux.yml b/.github/workflows/test-sdist-linux.yml new file mode 100644 index 00000000000..9d077912f3c --- /dev/null +++ b/.github/workflows/test-sdist-linux.yml @@ -0,0 +1,110 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +on: + workflow_call: + inputs: + host-platform: + required: true + type: string + cuda-version: + required: true + type: string + +defaults: + run: + shell: bash --noprofile --norc -xeuo pipefail {0} + +permissions: + contents: read # This is required for actions/checkout + +jobs: + test-sdist: + name: Test sdist builds + timeout-minutes: 60 + runs-on: linux-amd64-cpu8 + steps: + - name: Checkout ${{ github.event.repository.name }} + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + with: + # Treeless clone: setuptools-scm (invoked via `python -m build`) needs + # the commit graph (`git describe`) but not historical blobs. + fetch-depth: 0 + filter: blob:none + + - name: Set up Python + uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0 + with: + python-version: "3.12" + + - name: Install build tools + run: pip install build + + # Pure Python packages -- no CTK needed. + - name: Build cuda.pathfinder sdist and wheel-from-sdist + run: | + python -m build --sdist cuda_pathfinder/ + pip wheel --no-deps --wheel-dir cuda_pathfinder/dist cuda_pathfinder/dist/*.tar.gz + + - name: Build cuda-python sdist and wheel-from-sdist + run: | + python -m build --sdist cuda_python/ + pip wheel --no-deps --wheel-dir cuda_python/dist cuda_python/dist/*.tar.gz + + # Cython packages need CTK + sccache. + # The env vars ACTIONS_CACHE_SERVICE_V2, ACTIONS_RESULTS_URL, and ACTIONS_RUNTIME_TOKEN + # are exposed by this action. + - name: Enable sccache + uses: mozilla-actions/sccache-action@9e7fa8a12102821edf02ca5dbea1acd0f89a2696 # 0.0.10 + with: + disable_annotations: 'true' + + # xref: https://github.com/orgs/community/discussions/42856#discussioncomment-7678867 + - name: Adding additional GHA cache-related env vars + uses: actions/github-script@v9 + with: + script: | + core.exportVariable('ACTIONS_CACHE_URL', process.env['ACTIONS_CACHE_URL']) + core.exportVariable('ACTIONS_RUNTIME_URL', process.env['ACTIONS_RUNTIME_URL']) + + - name: Setup proxy cache + uses: nv-gha-runners/setup-proxy-cache@main + continue-on-error: true + with: + enable-apt: true + + - name: Set up mini CTK + uses: ./.github/actions/fetch_ctk + continue-on-error: false + with: + host-platform: ${{ inputs.host-platform }} + cuda-version: ${{ inputs.cuda-version }} + + # cuda_bindings/setup.py parses CUDA headers at import time, so CUDA_PATH + # (set by fetch_ctk) must be available for both sdist and wheel builds. + - name: Build cuda.bindings sdist and wheel-from-sdist + run: | + export CUDA_PYTHON_PARALLEL_LEVEL=$(nproc) + export CC="sccache cc" + export CXX="sccache c++" + export PIP_FIND_LINKS="$(pwd)/cuda_pathfinder/dist" + python -m build --sdist cuda_bindings/ + pip wheel --no-deps --wheel-dir cuda_bindings/dist cuda_bindings/dist/*.tar.gz + + # cuda_core sdist delegates to setuptools (no CTK needed), but + # wheel-from-sdist needs CTK and cuda-bindings (dynamic build dep via + # get_requires_for_build_wheel in build_hooks.py). + - name: Build cuda.core sdist and wheel-from-sdist + run: | + export CUDA_PYTHON_PARALLEL_LEVEL=$(nproc) + export CUDA_CORE_BUILD_MAJOR="$(echo '${{ inputs.cuda-version }}' | cut -d. -f1)" + export CC="sccache cc" + export CXX="sccache c++" + export PIP_FIND_LINKS="$(pwd)/cuda_bindings/dist $(pwd)/cuda_pathfinder/dist" + python -m build --sdist cuda_core/ + pip wheel --no-deps --wheel-dir cuda_core/dist cuda_core/dist/*.tar.gz + + - name: Show sccache stats + if: always() + run: sccache --show-stats diff --git a/.github/workflows/test-sdist-windows.yml b/.github/workflows/test-sdist-windows.yml new file mode 100644 index 00000000000..043bacc1cad --- /dev/null +++ b/.github/workflows/test-sdist-windows.yml @@ -0,0 +1,96 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +# Windows counterpart of test-sdist-linux.yml. Exists so that platform-gated +# sources (e.g. cuda_bindings/*_windows.pyx selected by build_hooks.py) are +# exercised by the sdist completeness test. Keep the shape of this file in +# sync with test-sdist-linux.yml aside from Windows-specific setup (MSVC, +# no sccache, no proxy cache). + +on: + workflow_call: + inputs: + host-platform: + required: true + type: string + cuda-version: + required: true + type: string + +defaults: + run: + shell: bash --noprofile --norc -xeuo pipefail {0} + +permissions: + contents: read # This is required for actions/checkout + +jobs: + test-sdist: + name: Test sdist builds + timeout-minutes: 60 + runs-on: windows-2022 + steps: + - name: Checkout ${{ github.event.repository.name }} + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + with: + # Treeless clone: setuptools-scm (invoked via `python -m build`) needs + # the commit graph (`git describe`) but not historical blobs. + fetch-depth: 0 + filter: blob:none + + - name: Set up Python + uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0 + with: + python-version: "3.12" + + - name: Set up MSVC + uses: step-security/msvc-dev-cmd@22c98154b708dbd743e6f27a933cf6ceba3305c4 # v1.13.1 + + - name: Install build tools + run: pip install build + + # Pure Python packages -- no CTK needed. + - name: Build cuda.pathfinder sdist and wheel-from-sdist + run: | + python -m build --sdist cuda_pathfinder/ + pip wheel --no-deps --wheel-dir cuda_pathfinder/dist cuda_pathfinder/dist/*.tar.gz + + - name: Build cuda-python sdist and wheel-from-sdist + run: | + python -m build --sdist cuda_python/ + pip wheel --no-deps --wheel-dir cuda_python/dist cuda_python/dist/*.tar.gz + + # Cython packages need CTK. No sccache on Windows (this is a correctness + # smoke test, not a production build; see build-wheel.yml which also + # limits sccache to Linux). + - name: Set up mini CTK + uses: ./.github/actions/fetch_ctk + continue-on-error: false + with: + host-platform: ${{ inputs.host-platform }} + cuda-version: ${{ inputs.cuda-version }} + + # cuda_bindings/setup.py parses CUDA headers at import time, so CUDA_PATH + # (set by fetch_ctk) must be available for both sdist and wheel builds. + # PIP_FIND_LINKS is passed as a native Windows path via cygpath because + # pip on Windows treats space-separated entries as separators and is + # picky about mixed path styles (see build-wheel.yml for the same + # convention). + - name: Build cuda.bindings sdist and wheel-from-sdist + run: | + export CUDA_PYTHON_PARALLEL_LEVEL=$(nproc) + export PIP_FIND_LINKS="$(cygpath -w "$(pwd)/cuda_pathfinder/dist")" + python -m build --sdist cuda_bindings/ + pip wheel --no-deps --wheel-dir cuda_bindings/dist cuda_bindings/dist/*.tar.gz + + # cuda_core sdist delegates to setuptools (no CTK needed), but + # wheel-from-sdist needs CTK and cuda-bindings (dynamic build dep via + # get_requires_for_build_wheel in build_hooks.py). + - name: Build cuda.core sdist and wheel-from-sdist + run: | + export CUDA_PYTHON_PARALLEL_LEVEL=$(nproc) + export CUDA_CORE_BUILD_MAJOR="$(echo '${{ inputs.cuda-version }}' | cut -d. -f1)" + export PIP_FIND_LINKS="$(cygpath -w "$(pwd)/cuda_bindings/dist") $(cygpath -w "$(pwd)/cuda_pathfinder/dist")" + python -m build --sdist cuda_core/ + pip wheel --no-deps --wheel-dir cuda_core/dist cuda_core/dist/*.tar.gz diff --git a/.github/workflows/test-wheel-linux.yml b/.github/workflows/test-wheel-linux.yml new file mode 100644 index 00000000000..4971d56f832 --- /dev/null +++ b/.github/workflows/test-wheel-linux.yml @@ -0,0 +1,537 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +name: "CI: Test wheels" + +on: + workflow_call: + inputs: + build-type: + type: string + required: true + host-platform: + type: string + required: true + build-ctk-ver: + type: string + required: true + matrix_filter: + type: string + default: "." + nruns: + type: number + default: 1 + # When true, cuda.bindings tests (and the Cython tests that depend on + # them) are skipped even when CTK majors match. Callers set this based + # on the output of the detect-changes job in ci.yml so PRs that only + # touch unrelated modules avoid the expensive bindings test suite. + skip-bindings-test: + type: boolean + default: false + run-id: + description: > + Workflow run ID to download artifacts from. + Defaults to the current run when empty. + type: string + default: '' + test-mode: + description: > + Test mode: 'standard' (default), 'nightly-pytorch', + 'nightly-numba-cuda', 'nightly-numba-cuda-mlir', or + 'nightly-cuda-core'. + type: string + default: 'standard' + sha: + description: > + Commit SHA used to construct artifact names. + Defaults to github.sha (current run) when empty. + type: string + default: '' + +defaults: + run: + shell: bash --noprofile --norc -xeuo pipefail {0} + +jobs: + compute-matrix: + runs-on: ubuntu-latest + env: + BUILD_TYPE: ${{ inputs.build-type }} + ARCH: ${{ (inputs.host-platform == 'linux-64' && 'amd64') || + (inputs.host-platform == 'linux-aarch64' && 'arm64') }} + outputs: + MATRIX: ${{ steps.compute-matrix.outputs.MATRIX }} + OLD_BRANCH: ${{ steps.compute-matrix.outputs.OLD_BRANCH }} + steps: + - name: Checkout ${{ github.event.repository.name }} + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + + - name: Validate Test Type + run: | + if [[ "$BUILD_TYPE" != "pull-request" ]] && [[ "$BUILD_TYPE" != "nightly" ]] && [[ "$BUILD_TYPE" != "branch" ]]; then + echo "Invalid build type! Must be one of 'nightly', 'pull-request', or 'branch'." + exit 1 + fi + + - name: Compute Python Test Matrix + id: compute-matrix + run: | + # Use the nightly matrix for branch tests + MATRIX_TYPE="${BUILD_TYPE}" + if [[ "${MATRIX_TYPE}" == "branch" ]]; then + MATRIX_TYPE="nightly" + fi + + # Read base matrix from YAML file for the specific architecture + TEST_MATRIX=$(yq -o json ".linux[\"${MATRIX_TYPE}\"] | map(select(.ARCH == \"${ARCH}\"))" ci/test-matrix.yml) + + # Apply matrix filter; reject custom DRIVER + FLAVOR=wsl (the + # in-container driver swap doesn't work under WSL); add a + # RUNNER_DRIVER field that maps any custom version back to + # 'latest' (the install script swaps the driver itself, so we + # need to land on the runner that ships with the most recent + # pre-installed driver); wrap in include structure. + MATRIX=$(echo "$TEST_MATRIX" | jq -c '${{ inputs.matrix_filter }} | if any(.[]; .DRIVER != "latest" and .DRIVER != "earliest" and .FLAVOR == "wsl") then "Error: custom DRIVER is not supported with FLAVOR=wsl\n" | halt_error(1) else . end | map(. + {RUNNER_DRIVER: (if .DRIVER == "latest" or .DRIVER == "earliest" then .DRIVER else "latest" end)}) | if (. | length) > 0 then {include: .} else "Error: Empty matrix\n" | halt_error(1) end') + + echo "MATRIX=${MATRIX}" | tee --append "${GITHUB_OUTPUT}" + + # This job has yq already installed, so let's do it here + OLD_BRANCH=$(yq '.backport_branch' ci/versions.yml) + echo "OLD_BRANCH=${OLD_BRANCH}" >> "$GITHUB_OUTPUT" + + test: + name: Python ${{ matrix.PY_VER }}, CUDA ${{ matrix.CUDA_VER }} (${{ (matrix.LOCAL_CTK == '1' && 'local') || 'wheels' }}), GPU ${{ matrix.GPU }}${{ matrix.GPU_COUNT != '1' && format(' (x{0})', matrix.GPU_COUNT) || '' }}${{ matrix.FLAVOR && format(', {0}', matrix.FLAVOR) || '' }}${{ matrix.ENV.TORCH_VER && format(', {0}+{1}', matrix.ENV.TORCH_VER, matrix.ENV.TORCH_CUDA) || '' }}${{ matrix.ENV.MODE == 'nightly-numba-cuda' && ', latest' || '' }} + timeout-minutes: 60 + needs: compute-matrix + strategy: + fail-fast: false + matrix: ${{ fromJSON(needs.compute-matrix.outputs.MATRIX) }} + runs-on: "${{ matrix.FLAVOR || 'linux' }}-${{ matrix.ARCH }}-gpu-${{ matrix.GPU }}-${{ matrix.RUNNER_DRIVER }}-${{ matrix.GPU_COUNT }}" + # TODO: remove continue-on-error once 3.15 is officially supported + continue-on-error: ${{ startsWith(matrix.PY_VER, '3.15') }} + # The build stage could fail but we want the CI to keep moving. + if: ${{ github.repository_owner == 'nvidia' && !cancelled() }} + # Our self-hosted runners require a container + # TODO: use a different (nvidia?) container + container: + # Custom-DRIVER rows need --privileged --pid=host so install_gpu_driver.sh + # can nsenter to the host for the install + refresh the toolkit bind mounts + # back inside the container. Stock options for latest/earliest rows. + options: ${{ ((matrix.DRIVER == 'latest' || matrix.DRIVER == 'earliest') && '-u root --security-opt seccomp=unconfined --shm-size 16g') || '-u root --security-opt seccomp=unconfined --shm-size 16g --privileged --pid=host' }} + image: ubuntu:24.04 + env: + NVIDIA_VISIBLE_DEVICES: ${{ env.NVIDIA_VISIBLE_DEVICES }} + PIP_CACHE_DIR: "/tmp/pip-cache" + steps: + - name: Checkout ${{ github.event.repository.name }} + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + + - name: Setup proxy cache + uses: nv-gha-runners/setup-proxy-cache@main + continue-on-error: true + + - name: Install dependencies + uses: ./.github/actions/install_unix_deps + continue-on-error: false + with: + # for artifact fetching, graphics libs, g++ required for cffi in + # example; util-linux for `nsenter` (custom-DRIVER rows re-exec + # install_gpu_driver.sh onto the host through nsenter) + dependencies: "jq wget libgl1 libegl1 g++ util-linux" + dependent_exes: "jq wget" + + - name: Install GPU driver + if: ${{ matrix.DRIVER != 'latest' && matrix.DRIVER != 'earliest' }} + env: + DRIVER: ${{ matrix.DRIVER }} + GPU_TYPE: ${{ matrix.GPU }} + run: ./ci/tools/install_gpu_driver.sh + + - name: Ensure GPU is working + run: nvidia-smi + + - name: Set environment variables + env: + BUILD_CUDA_VER: ${{ inputs.build-ctk-ver }} + CUDA_VER: ${{ matrix.CUDA_VER }} + HOST_PLATFORM: ${{ inputs.host-platform }} + LOCAL_CTK: ${{ matrix.LOCAL_CTK }} + PY_VER: ${{ matrix.PY_VER }} + SHA: ${{ inputs.sha || github.sha }} + SKIP_BINDINGS_TEST_OVERRIDE: ${{ inputs.skip-bindings-test && '1' || '0' }} + run: ./ci/tools/env-vars test + + - name: Apply extra matrix environment variables + if: ${{ matrix.ENV }} + env: + MATRIX_ENV: ${{ toJSON(matrix.ENV) }} + run: echo "$MATRIX_ENV" | jq -r 'to_entries[] | "\(.key)=\(.value)"' >> "$GITHUB_ENV" + + - name: Download cuda-pathfinder build artifacts + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: cuda-pathfinder-wheel + path: ./cuda_pathfinder + run-id: ${{ inputs.run-id || github.run_id }} + github-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Download cuda-python build artifacts + if: ${{ env.BINDINGS_SOURCE == 'main' }} + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: cuda-python-wheel + path: . + run-id: ${{ inputs.run-id || github.run_id }} + github-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Download cuda.bindings build artifacts + if: ${{ env.BINDINGS_SOURCE == 'main' }} + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: ${{ env.CUDA_BINDINGS_ARTIFACT_NAME }} + path: ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }} + run-id: ${{ inputs.run-id || github.run_id }} + github-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Download cuda-python & cuda.bindings build artifacts from the prior branch + if: ${{ env.BINDINGS_SOURCE == 'backport' }} + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + # See https://github.com/cli/cli/blob/trunk/docs/install_linux.md#debian-ubuntu-linux-raspberry-pi-os-apt. + # gh is needed for artifact fetching. + mkdir -p -m 755 /etc/apt/keyrings \ + && out=$(mktemp) && wget -nv -O$out https://cli.github.com/packages/githubcli-archive-keyring.gpg \ + && cat $out | tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \ + && chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \ + && echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null \ + && apt update \ + && apt install gh -y + + OLD_BRANCH=${{ needs.compute-matrix.outputs.OLD_BRANCH }} + OLD_BASENAME="cuda-bindings-python${PYTHON_VERSION_FORMATTED}-cuda*-${{ inputs.host-platform }}*" + LATEST_PRIOR_RUN_ID=$(./ci/tools/lookup-run-id --branch "${OLD_BRANCH}" NVIDIA/cuda-python "CI") + + gh run download $LATEST_PRIOR_RUN_ID -p ${OLD_BASENAME} -R NVIDIA/cuda-python + rm -rf ${OLD_BASENAME}-tests # exclude cython test artifacts + ls -al $OLD_BASENAME + mkdir -p "${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}" + mv $OLD_BASENAME/*.whl "${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}"/ + rmdir $OLD_BASENAME + + gh run download $LATEST_PRIOR_RUN_ID -p cuda-python-wheel -R NVIDIA/cuda-python + ls -al cuda-python-wheel + mv cuda-python-wheel/*.whl . + rmdir cuda-python-wheel + + - name: Display structure of downloaded cuda-python artifacts + if: ${{ env.BINDINGS_SOURCE != 'published' }} + run: | + pwd + ls -lah cuda_python*.whl cuda_pathfinder/ + + - name: Display structure of downloaded cuda.bindings artifacts + if: ${{ env.BINDINGS_SOURCE != 'published' }} + run: | + pwd + ls -lahR $CUDA_BINDINGS_ARTIFACTS_DIR + + - name: Download cuda.bindings Cython tests + if: ${{ env.SKIP_CYTHON_TEST == '0' }} + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: ${{ env.CUDA_BINDINGS_ARTIFACT_NAME }}-tests + path: ${{ env.CUDA_BINDINGS_CYTHON_TESTS_DIR }} + run-id: ${{ inputs.run-id || github.run_id }} + github-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Display structure of downloaded cuda.bindings Cython tests + if: ${{ env.SKIP_CYTHON_TEST == '0' }} + run: | + pwd + ls -lahR $CUDA_BINDINGS_CYTHON_TESTS_DIR + + - name: Download cuda.core build artifacts + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: ${{ env.CUDA_CORE_ARTIFACT_NAME }} + path: ${{ env.CUDA_CORE_ARTIFACTS_DIR }} + run-id: ${{ inputs.run-id || github.run_id }} + github-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Display structure of downloaded cuda.core build artifacts + run: | + pwd + ls -lahR $CUDA_CORE_ARTIFACTS_DIR + + - name: Download cuda.core Cython tests + if: ${{ env.SKIP_CYTHON_TEST == '0' }} + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: ${{ env.CUDA_CORE_ARTIFACT_NAME }}-tests + path: ${{ env.CUDA_CORE_CYTHON_TESTS_DIR }} + run-id: ${{ inputs.run-id || github.run_id }} + github-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Display structure of downloaded cuda.core Cython tests + if: ${{ env.SKIP_CYTHON_TEST == '0' }} + run: | + pwd + ls -lahR $CUDA_CORE_CYTHON_TESTS_DIR + + - name: Download cuda.core test binaries + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: ${{ env.CUDA_CORE_ARTIFACT_NAME }}-test-binaries + path: ${{ env.CUDA_CORE_TEST_BINARIES_DIR }} + run-id: ${{ inputs.run-id || github.run_id }} + github-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Display structure of downloaded cuda.core test binaries + run: | + pwd + ls -lahR $CUDA_CORE_TEST_BINARIES_DIR + + - name: Set up Python ${{ matrix.PY_VER }} + uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0 + with: + python-version: ${{ matrix.PY_VER }} + # TODO: remove allow-prereleases once 3.15 is officially supported + allow-prereleases: ${{ startsWith(matrix.PY_VER, '3.15') }} + env: + # we use self-hosted runners on which setup-python behaves weirdly (Python include can't be found)... + AGENT_TOOLSDIRECTORY: "/opt/hostedtoolcache" + + - name: Set up mini CTK + if: ${{ matrix.LOCAL_CTK == '1' }} + uses: ./.github/actions/fetch_ctk + continue-on-error: false + with: + host-platform: ${{ inputs.host-platform }} + cuda-version: ${{ matrix.CUDA_VER }} + + # TODO: remove the numpy wheel steps once 3.15 is officially supported + - name: Download numpy wheel (pre-release Python) + if: ${{ startsWith(matrix.PY_VER, '3.15') }} + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: numpy-python${{ env.PYTHON_VERSION_FORMATTED }}-${{ inputs.host-platform }} + path: numpy-wheel + + - name: Install numpy wheel (pre-release Python) + if: ${{ startsWith(matrix.PY_VER, '3.15') }} + run: pip install numpy-wheel/*.whl + + - name: Set up latest cuda_sanitizer_api + if: ${{ env.SETUP_SANITIZER == '1' }} + uses: ./.github/actions/fetch_ctk + continue-on-error: false + with: + host-platform: ${{ inputs.host-platform }} + cuda-version: ${{ env.LATEST_CUDA_VERSION }} + cuda-components: "cuda_sanitizer_api" + + - name: Set up compute-sanitizer + run: setup-sanitizer + + - name: Set up test repetition on nightly runs + run: echo "PYTEST_ADDOPTS=\"--count=${{ inputs.nruns }}\"" >> "$GITHUB_ENV" + + # ── Standard test steps (skipped for nightly modes) ── + - name: Run cuda.pathfinder tests with see_what_works + if: ${{ inputs.test-mode == 'standard' }} + env: + CUDA_PATHFINDER_TEST_LOAD_NVIDIA_DYNAMIC_LIB_STRICTNESS: see_what_works + CUDA_PATHFINDER_TEST_FIND_NVIDIA_HEADERS_STRICTNESS: see_what_works + CUDA_PATHFINDER_TEST_FIND_NVIDIA_BITCODE_LIB_STRICTNESS: see_what_works + run: run-tests pathfinder + + - name: Run cuda.bindings tests + if: ${{ inputs.test-mode == 'standard' && env.SKIP_CUDA_BINDINGS_TEST == '0' }} + env: + CUDA_VER: ${{ matrix.CUDA_VER }} + LOCAL_CTK: ${{ matrix.LOCAL_CTK }} + # #2299: BAR-size query returns CUDA_ERROR_NOT_SUPPORTED on G+H; + # skip the test on gh200 runners until upstream cufile guards it. + PYTEST_ADDOPTS: ${{ matrix.GPU == 'gh200' && '--deselect tests/test_cufile.py::test_get_bar_size_in_kb' || '' }} + run: run-tests bindings + + - name: Run cuda.bindings benchmarks (smoke test) + if: ${{ inputs.test-mode == 'standard' && env.SKIP_CUDA_BINDINGS_TEST == '0' }} + run: | + pip install pyperf + pushd benchmarks/cuda_bindings + python run_pyperf.py --debug-single-value + popd + + - name: Run cuda.core tests + if: ${{ inputs.test-mode == 'standard' }} + env: + CUDA_VER: ${{ matrix.CUDA_VER }} + LOCAL_CTK: ${{ matrix.LOCAL_CTK }} + run: run-tests core + + - name: Ensure cuda-python installable + if: ${{ inputs.test-mode == 'standard' && env.BINDINGS_SOURCE == 'main' }} + run: | + # Subpackages are already installed from CI artifacts; --no-deps keeps + # tag-release cuda-core wheels from being replaced by PyPI pins. + if [[ "${{ matrix.LOCAL_CTK }}" == 1 ]]; then + pip install --only-binary=:all: --no-deps cuda_python*.whl + else + pip install --only-binary=:all: --no-deps $(ls cuda_python*.whl)[all] + fi + + - name: Install cuda.pathfinder extra wheels for testing + if: ${{ inputs.test-mode == 'standard' }} + run: | + set -euo pipefail + pushd cuda_pathfinder + pip install --only-binary=:all: -v ./*.whl --group "test-cu${TEST_CUDA_MAJOR}" + pip list + popd + + - name: Run cuda.pathfinder tests with all_must_work + if: ${{ inputs.test-mode == 'standard' }} + env: + CUDA_PATHFINDER_TEST_LOAD_NVIDIA_DYNAMIC_LIB_STRICTNESS: all_must_work + CUDA_PATHFINDER_TEST_FIND_NVIDIA_HEADERS_STRICTNESS: all_must_work + CUDA_PATHFINDER_TEST_FIND_NVIDIA_BITCODE_LIB_STRICTNESS: all_must_work + run: run-tests pathfinder + + # ── Nightly: install wheels + optional dep together ── + - name: Install cuda-python wheels + PyTorch + if: ${{ inputs.test-mode == 'nightly-pytorch' }} + env: + CUDA_VER: ${{ matrix.CUDA_VER }} + LOCAL_CTK: ${{ matrix.LOCAL_CTK }} + run: run-tests nightly-pytorch + + - name: Install cuda-python wheels + numba-cuda + if: ${{ inputs.test-mode == 'nightly-numba-cuda' }} + env: + CUDA_VER: ${{ matrix.CUDA_VER }} + LOCAL_CTK: ${{ matrix.LOCAL_CTK }} + run: run-tests nightly-numba-cuda + + - name: Install cuda-python wheels + numba-cuda-mlir + if: ${{ inputs.test-mode == 'nightly-numba-cuda-mlir' }} + env: + CUDA_VER: ${{ matrix.CUDA_VER }} + LOCAL_CTK: ${{ matrix.LOCAL_CTK }} + run: run-tests nightly-numba-cuda-mlir + + - name: Install main pathfinder/bindings + released cuda-core + if: ${{ inputs.test-mode == 'nightly-cuda-core' }} + env: + CUDA_VER: ${{ matrix.CUDA_VER }} + LOCAL_CTK: ${{ matrix.LOCAL_CTK }} + run: run-tests nightly-cuda-core + + # ── Nightly: run tests ── + - name: Run PyTorch interop tests + if: ${{ inputs.test-mode == 'nightly-pytorch' }} + run: | + pushd cuda_core + pytest -rxXs -v --durations=0 tests/test_utils.py tests/example_tests/ + popd + + - name: Run numba-cuda tests + if: ${{ inputs.test-mode == 'nightly-numba-cuda' }} + run: python -m numba.runtests numba.cuda.tests + + - name: Checkout numba-cuda-mlir tests at matching tag + if: ${{ inputs.test-mode == 'nightly-numba-cuda-mlir' && env.NUMBA_CUDA_MLIR_VER != '' }} + uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + with: + repository: NVIDIA/numba-cuda-mlir + ref: v${{ env.NUMBA_CUDA_MLIR_VER }} + path: numba-cuda-mlir-released + + - name: Run numba-cuda-mlir tests + if: ${{ inputs.test-mode == 'nightly-numba-cuda-mlir' && env.NUMBA_CUDA_MLIR_VER != '' }} + run: | + pushd numba-cuda-mlir-released + # Install this tag's test deps (pytest + plugins + ml-dtypes + ...). + pip install --upgrade "pip>=25.1" + pip install --group test + # Skip tests/benchmarks/ and tests/doc_examples/ — they import the + # numba package at collection time, which cuSIMT intentionally does + # not depend on. See NVIDIA/numba-cuda-mlir#136. + # + # Version-gated deselects: when a newer numba-cuda-mlir release + # ships with the referenced fix, the guard evaluates false and the + # tests get run automatically. If they still fail on the newer + # version we hear about it loudly (rather than silently masking). + DESELECTS=() + if python -c "from packaging.version import Version; import sys; sys.exit(0 if Version('${NUMBA_CUDA_MLIR_VER}') <= Version('0.4.1') else 1)"; then + # NVIDIA/numba-cuda-mlir#135: serial-pytest contamination of + # numba_cuda_mlir.cuda.cudadrv from an xfailed test in + # test_nrt_comprehensive.py contaminates any later test that + # touches cuda.cudadrv.driver. Upstream CI hides it via + # `-n auto --dist loadscope`. Which specific tests fail depends + # on collection order (we saw different subsets on linux-64 vs + # win-64 across runs), so we deselect the union of all tests + # #135 lists as vulnerable + test_fortran_contiguous (observed + # to hit the same contamination in our runs). + # + # test_nvjitlink_jit_with_linkable_code_lto_dump_assembly_warn: + # subprocess-invokes `cuobjdump`, not on PATH in the base + # ubuntu:24.04 container. (Linux-only; Windows runners ship + # cuobjdump with the local CTK. No upstream fix yet — pending + # a skip-guard bug to be filed against NVIDIA/numba-cuda-mlir.) + DESELECTS+=( + --deselect 'tests/numba_cuda_tests/cudadrv/test_cuda_array_slicing.py::CudaArraySetting::test_no_sync_default_stream' + --deselect 'tests/numba_cuda_tests/cudadrv/test_cuda_array_slicing.py::CudaArraySetting::test_no_sync_supplied_stream' + --deselect 'tests/numba_cuda_tests/cudadrv/test_cuda_array_slicing.py::CudaArraySetting::test_sync' + --deselect 'tests/numba_cuda_tests/cudapy/test_cuda_array_interface.py::TestCudaArrayInterface::test_consume_no_sync' + --deselect 'tests/numba_cuda_tests/cudapy/test_cuda_array_interface.py::TestCudaArrayInterface::test_consume_sync' + --deselect 'tests/numba_cuda_tests/cudapy/test_cuda_array_interface.py::TestCudaArrayInterface::test_launch_no_sync' + --deselect 'tests/numba_cuda_tests/cudapy/test_cuda_array_interface.py::TestCudaArrayInterface::test_launch_sync' + --deselect 'tests/numba_cuda_tests/cudapy/test_cuda_array_interface.py::TestCudaArrayInterface::test_launch_sync_two_streams' + --deselect 'tests/numba_cuda_tests/cudapy/test_cuda_array_interface.py::TestCudaArrayInterface::test_fortran_contiguous' + --deselect 'tests/numba_cuda_tests/cudadrv/test_nvjitlink.py::TestLinkerDumpAssembly::test_nvjitlink_jit_with_linkable_code_lto_dump_assembly_warn' + ) + fi + pytest -rxXs -v --durations=0 \ + --ignore=tests/benchmarks \ + --ignore=tests/doc_examples \ + "${DESELECTS[@]}" \ + tests/ + popd + + - name: Checkout released cuda-core tests at matching tag + if: ${{ inputs.test-mode == 'nightly-cuda-core' && env.CUDA_CORE_RELEASED_VER != '' }} + uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + with: + ref: cuda-core-v${{ env.CUDA_CORE_RELEASED_VER }} + path: cuda-core-released + + - name: Run released cuda-core tests + if: ${{ inputs.test-mode == 'nightly-cuda-core' && env.CUDA_CORE_RELEASED_VER != '' }} + run: | + pushd cuda-core-released/cuda_core + # Install the released tag's test group so we exercise the exact deps + # that cuda-core version shipped with. + pip install --upgrade "pip>=25.1" + pip install --group "${CUDA_CORE_TEST_GROUP}" + # Cap pytest below 9.1: released cuda-core <=1.0.1 has parametrize + # patterns that pytest 9.1 rejects; the main-side fix (#2212) has + # not yet shipped in a cuda-core release. + pip install "pytest<9.1" + # Version-gated deselect: drops automatically when a newer + # cuda-core release with the wrapper-mapping update ships. + DESELECTS=() + if python -c "from packaging.version import Version; import sys; sys.exit(0 if Version('${CUDA_CORE_RELEASED_VER}') <= Version('1.0.1') else 1)"; then + # NvlinkVersion: v1.0.1's wrapper mapping predates + # NvlinkVersion.VERSION_6_0 which main cuda-bindings adds. + # Expected drift on this mode until released cuda-core catches up. + DESELECTS+=( + --deselect 'tests/test_enum_coverage.py::test_wrapper_covers_all_binding_members[NvlinkVersion]' + ) + fi + pytest -rxXs -v --durations=0 --randomly-dont-reorganize \ + "${DESELECTS[@]}" \ + tests/ + popd diff --git a/.github/workflows/test-wheel-windows.yml b/.github/workflows/test-wheel-windows.yml new file mode 100644 index 00000000000..e2ff59f39e5 --- /dev/null +++ b/.github/workflows/test-wheel-windows.yml @@ -0,0 +1,504 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +name: "CI: Test wheels" + +on: + workflow_call: + inputs: + build-type: + type: string + required: true + host-platform: + type: string + required: true + build-ctk-ver: + type: string + required: true + matrix_filter: + type: string + default: "." + nruns: + type: number + default: 1 + # When true, cuda.bindings tests (and the Cython tests that depend on + # them) are skipped even when CTK majors match. Callers set this based + # on the output of the detect-changes job in ci.yml so PRs that only + # touch unrelated modules avoid the expensive bindings test suite. + skip-bindings-test: + type: boolean + default: false + run-id: + description: > + Workflow run ID to download artifacts from. + Defaults to the current run when empty. + type: string + default: '' + test-mode: + description: > + Test mode: 'standard' (default), 'nightly-pytorch', + 'nightly-numba-cuda', 'nightly-numba-cuda-mlir', or + 'nightly-cuda-core'. + type: string + default: 'standard' + sha: + description: > + Commit SHA used to construct artifact names. + Defaults to github.sha (current run) when empty. + type: string + default: '' + +jobs: + compute-matrix: + runs-on: ubuntu-latest + defaults: + run: + shell: bash --noprofile --norc -xeuo pipefail {0} + env: + BUILD_TYPE: ${{ inputs.build-type }} + ARCH: ${{ (inputs.host-platform == 'win-64' && 'amd64') }} + outputs: + MATRIX: ${{ steps.compute-matrix.outputs.MATRIX }} + steps: + - name: Checkout ${{ github.event.repository.name }} + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + + - name: Validate Test Type + run: | + if [[ "$BUILD_TYPE" != "pull-request" ]] && [[ "$BUILD_TYPE" != "nightly" ]] && [[ "$BUILD_TYPE" != "branch" ]]; then + echo "Invalid build type! Must be one of 'nightly', 'pull-request', or 'branch'." + exit 1 + fi + - name: Compute Python Test Matrix + id: compute-matrix + run: | + # Use the nightly matrix for branch tests + MATRIX_TYPE="${BUILD_TYPE}" + if [[ "${MATRIX_TYPE}" == "branch" ]]; then + MATRIX_TYPE="nightly" + fi + + # Read base matrix from YAML file for the specific architecture + TEST_MATRIX=$(yq -o json ".windows[\"${MATRIX_TYPE}\"] | map(select(.ARCH == \"${ARCH}\"))" ci/test-matrix.yml) + + # Apply matrix filter; add a RUNNER_DRIVER field that maps any + # custom DRIVER version back to 'latest' (install_gpu_driver.ps1 + # swaps the driver itself, so the runner must be the one that + # ships the most recent pre-installed driver); wrap in include. + MATRIX=$(echo "$TEST_MATRIX" | jq -c '${{ inputs.matrix_filter }} | map(. + {RUNNER_DRIVER: (if .DRIVER == "latest" or .DRIVER == "earliest" then .DRIVER else "latest" end)}) | if (. | length) > 0 then {include: .} else "Error: Empty matrix\n" | halt_error(1) end') + + echo "MATRIX=${MATRIX}" | tee --append "${GITHUB_OUTPUT}" + + test: + name: Python ${{ matrix.PY_VER }}, CUDA ${{ matrix.CUDA_VER }} (${{ (matrix.LOCAL_CTK == '1' && 'local') || 'wheels' }}), GPU ${{ matrix.GPU }}${{ matrix.GPU_COUNT != '1' && format(' (x{0})', matrix.GPU_COUNT) || '' }} (${{ matrix.DRIVER_MODE }})${{ matrix.ENV.TORCH_VER && format(', {0}+{1}', matrix.ENV.TORCH_VER, matrix.ENV.TORCH_CUDA) || '' }}${{ matrix.ENV.MODE == 'nightly-numba-cuda' && ', latest' || '' }} + timeout-minutes: 60 + # The build stage could fail but we want the CI to keep moving. + needs: compute-matrix + strategy: + fail-fast: false + matrix: ${{ fromJSON(needs.compute-matrix.outputs.MATRIX) }} + if: ${{ github.repository_owner == 'nvidia' && !cancelled() }} + # TODO: remove continue-on-error once 3.15 is officially supported + continue-on-error: ${{ startsWith(matrix.PY_VER, '3.15') }} + runs-on: "windows-${{ matrix.ARCH }}-gpu-${{ matrix.GPU }}-${{ matrix.RUNNER_DRIVER }}-${{ matrix.GPU_COUNT }}" + steps: + - name: Checkout ${{ github.event.repository.name }} + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + + - name: Setup proxy cache + uses: nv-gha-runners/setup-proxy-cache@main + continue-on-error: true + with: + enable-apt: true + + - name: Install GPU driver + if: ${{ matrix.DRIVER != 'latest' && matrix.DRIVER != 'earliest' }} + env: + DRIVER: ${{ matrix.DRIVER }} + GPU_TYPE: ${{ matrix.GPU }} + run: | + ci/tools/install_gpu_driver.ps1 + + - name: Configure driver mode + env: + DRIVER_MODE: ${{ matrix.DRIVER_MODE }} + run: | + ci/tools/configure_driver_mode.ps1 + + - name: Ensure GPU is working + run: | + nvidia-smi + + $mode_output = nvidia-smi | Select-String -Pattern "${{ matrix.DRIVER_MODE }}" + Write-Output "Driver mode check: $mode_output" + if ("$mode_output" -eq "") { + Write-Error "Switching to driver mode ${{ matrix.DRIVER_MODE }} failed!" + exit 1 + } + Write-Output "Driver mode verified: ${{ matrix.DRIVER_MODE }}" + + - name: Set environment variables + env: + BUILD_CUDA_VER: ${{ inputs.build-ctk-ver }} + CUDA_VER: ${{ matrix.CUDA_VER }} + HOST_PLATFORM: ${{ inputs.host-platform }} + LOCAL_CTK: ${{ matrix.LOCAL_CTK }} + PY_VER: ${{ matrix.PY_VER }} + SHA: ${{ inputs.sha || github.sha }} + SKIP_BINDINGS_TEST_OVERRIDE: ${{ inputs.skip-bindings-test && '1' || '0' }} + shell: bash --noprofile --norc -xeuo pipefail {0} + run: ./ci/tools/env-vars test + + - name: Apply extra matrix environment variables + if: ${{ matrix.ENV }} + env: + MATRIX_ENV: ${{ toJSON(matrix.ENV) }} + shell: bash --noprofile --norc -xeuo pipefail {0} + run: echo "$MATRIX_ENV" | jq -r 'to_entries[] | "\(.key)=\(.value)"' >> "$GITHUB_ENV" + + - name: Download cuda-pathfinder build artifacts + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: cuda-pathfinder-wheel + path: ./cuda_pathfinder + run-id: ${{ inputs.run-id || github.run_id }} + github-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Download cuda-python build artifacts + if: ${{ env.BINDINGS_SOURCE == 'main' }} + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: cuda-python-wheel + path: . + run-id: ${{ inputs.run-id || github.run_id }} + github-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Download cuda.bindings build artifacts + if: ${{ env.BINDINGS_SOURCE == 'main' }} + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: ${{ env.CUDA_BINDINGS_ARTIFACT_NAME }} + path: ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }} + run-id: ${{ inputs.run-id || github.run_id }} + github-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Download cuda-python & cuda.bindings build artifacts from the prior branch + if: ${{ env.BINDINGS_SOURCE == 'backport' }} + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + shell: bash --noprofile --norc -xeuo pipefail {0} + run: | + OLD_BRANCH=$(yq '.backport_branch' ci/versions.yml) + OLD_BASENAME="cuda-bindings-python${PYTHON_VERSION_FORMATTED}-cuda*-${{ inputs.host-platform }}*" + LATEST_PRIOR_RUN_ID=$(./ci/tools/lookup-run-id --branch "${OLD_BRANCH}" NVIDIA/cuda-python "CI") + + gh run download $LATEST_PRIOR_RUN_ID -p ${OLD_BASENAME} -R NVIDIA/cuda-python + rm -rf ${OLD_BASENAME}-tests # exclude cython test artifacts + ls -al $OLD_BASENAME + mkdir -p "${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}" + mv $OLD_BASENAME/*.whl "${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}"/ + rmdir $OLD_BASENAME + + gh run download $LATEST_PRIOR_RUN_ID -p cuda-python-wheel -R NVIDIA/cuda-python + ls -al cuda-python-wheel + mv cuda-python-wheel/*.whl . + rmdir cuda-python-wheel + + - name: Display structure of downloaded cuda-python artifacts + if: ${{ env.BINDINGS_SOURCE != 'published' }} + run: | + Get-Location + Get-ChildItem cuda_python*.whl | Select-Object Mode, LastWriteTime, Length, FullName + + - name: Display structure of downloaded cuda.bindings artifacts + if: ${{ env.BINDINGS_SOURCE != 'published' }} + run: | + Get-Location + Get-ChildItem -Recurse -Force $env:CUDA_BINDINGS_ARTIFACTS_DIR | Select-Object Mode, LastWriteTime, Length, FullName + + - name: Download cuda.bindings Cython tests + if: ${{ env.SKIP_CYTHON_TEST == '0' }} + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: ${{ env.CUDA_BINDINGS_ARTIFACT_NAME }}-tests + path: ${{ env.CUDA_BINDINGS_CYTHON_TESTS_DIR }} + run-id: ${{ inputs.run-id || github.run_id }} + github-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Display structure of downloaded cuda.bindings Cython tests + if: ${{ env.SKIP_CYTHON_TEST == '0' }} + run: | + Get-Location + Get-ChildItem -Recurse -Force $env:CUDA_BINDINGS_CYTHON_TESTS_DIR | Select-Object Mode, LastWriteTime, Length, FullName + + - name: Download cuda.core build artifacts + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: ${{ env.CUDA_CORE_ARTIFACT_NAME }} + path: ${{ env.CUDA_CORE_ARTIFACTS_DIR }} + run-id: ${{ inputs.run-id || github.run_id }} + github-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Display structure of downloaded cuda.core build artifacts + run: | + Get-Location + Get-ChildItem -Recurse -Force $env:CUDA_CORE_ARTIFACTS_DIR | Select-Object Mode, LastWriteTime, Length, FullName + + - name: Download cuda.core Cython tests + if: ${{ env.SKIP_CYTHON_TEST == '0' }} + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: ${{ env.CUDA_CORE_ARTIFACT_NAME }}-tests + path: ${{ env.CUDA_CORE_CYTHON_TESTS_DIR }} + run-id: ${{ inputs.run-id || github.run_id }} + github-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Display structure of downloaded cuda.core Cython tests + if: ${{ env.SKIP_CYTHON_TEST == '0' }} + run: | + Get-Location + Get-ChildItem -Recurse -Force $env:CUDA_CORE_CYTHON_TESTS_DIR | Select-Object Mode, LastWriteTime, Length, FullName + + - name: Download cuda.core test binaries + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: ${{ env.CUDA_CORE_ARTIFACT_NAME }}-test-binaries + path: ${{ env.CUDA_CORE_TEST_BINARIES_DIR }} + run-id: ${{ inputs.run-id || github.run_id }} + github-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Display structure of downloaded cuda.core test binaries + run: | + Get-Location + Get-ChildItem -Recurse -Force $env:CUDA_CORE_TEST_BINARIES_DIR | Select-Object Mode, LastWriteTime, Length, FullName + + - name: Set up Python ${{ matrix.PY_VER }} + uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0 + with: + python-version: ${{ matrix.PY_VER }} + + - name: Verify LongPathsEnabled + run: | + $val = (Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem' -Name 'LongPathsEnabled').LongPathsEnabled + echo "LongPathsEnabled = $val" + if ($val -ne 1) { + echo "::error::LongPathsEnabled is not set to 1 (see issue #1820)" + exit 1 + } + + - name: Set up mini CTK + if: ${{ matrix.LOCAL_CTK == '1' }} + uses: ./.github/actions/fetch_ctk + continue-on-error: false + with: + host-platform: ${{ inputs.host-platform }} + cuda-version: ${{ matrix.CUDA_VER }} + + # TODO: remove the numpy wheel steps once 3.15 is officially supported + - name: Download numpy wheel (pre-release Python) + if: ${{ startsWith(matrix.PY_VER, '3.15') }} + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: numpy-python${{ env.PYTHON_VERSION_FORMATTED }}-${{ inputs.host-platform }} + path: numpy-wheel + + - name: Install numpy wheel (pre-release Python) + if: ${{ startsWith(matrix.PY_VER, '3.15') }} + shell: bash --noprofile --norc -xeuo pipefail {0} + run: pip install numpy-wheel/*.whl + + - name: Set up test repetition on nightly runs + shell: bash --noprofile --norc -xeuo pipefail {0} + run: echo "PYTEST_ADDOPTS=\"--count=${{ inputs.nruns }}\"" >> "$GITHUB_ENV" + + # ── Standard test steps (skipped for nightly modes) ── + - name: Run cuda.pathfinder tests with see_what_works + if: ${{ inputs.test-mode == 'standard' }} + env: + CUDA_PATHFINDER_TEST_LOAD_NVIDIA_DYNAMIC_LIB_STRICTNESS: see_what_works + CUDA_PATHFINDER_TEST_FIND_NVIDIA_HEADERS_STRICTNESS: see_what_works + CUDA_PATHFINDER_TEST_FIND_NVIDIA_BITCODE_LIB_STRICTNESS: see_what_works + shell: bash --noprofile --norc -xeuo pipefail {0} + run: run-tests pathfinder + + - name: Run cuda.bindings tests + if: ${{ inputs.test-mode == 'standard' && env.SKIP_CUDA_BINDINGS_TEST == '0' }} + env: + CUDA_VER: ${{ matrix.CUDA_VER }} + LOCAL_CTK: ${{ matrix.LOCAL_CTK }} + shell: bash --noprofile --norc -xeuo pipefail {0} + run: run-tests bindings + + - name: Run cuda.core tests + if: ${{ inputs.test-mode == 'standard' }} + env: + CUDA_VER: ${{ matrix.CUDA_VER }} + LOCAL_CTK: ${{ matrix.LOCAL_CTK }} + shell: bash --noprofile --norc -xeuo pipefail {0} + run: run-tests core + + - name: Ensure cuda-python installable + if: ${{ inputs.test-mode == 'standard' && env.BINDINGS_SOURCE == 'main' }} + run: | + # Subpackages are already installed from CI artifacts; --no-deps keeps + # tag-release cuda-core wheels from being replaced by PyPI pins. + if ('${{ matrix.LOCAL_CTK }}' -eq '1') { + pip install --only-binary=:all: --no-deps (Get-ChildItem -Filter cuda_python*.whl).FullName + } else { + pip install --only-binary=:all: --no-deps "$((Get-ChildItem -Filter cuda_python*.whl).FullName)[all]" + } + + - name: Install cuda.pathfinder extra wheels for testing + if: ${{ inputs.test-mode == 'standard' }} + shell: bash --noprofile --norc -xeuo pipefail {0} + run: | + pushd cuda_pathfinder + pip install --only-binary=:all: -v ./*.whl --group "test-cu${TEST_CUDA_MAJOR}" + pip list + popd + + - name: Run cuda.pathfinder tests with all_must_work + if: ${{ inputs.test-mode == 'standard' }} + env: + CUDA_PATHFINDER_TEST_LOAD_NVIDIA_DYNAMIC_LIB_STRICTNESS: all_must_work + CUDA_PATHFINDER_TEST_FIND_NVIDIA_HEADERS_STRICTNESS: all_must_work + CUDA_PATHFINDER_TEST_FIND_NVIDIA_BITCODE_LIB_STRICTNESS: all_must_work + shell: bash --noprofile --norc -xeuo pipefail {0} + run: run-tests pathfinder + + # ── Nightly: install wheels + optional dep together ── + - name: Install Visual C++ Redistributable (required by PyTorch on Windows) + if: ${{ inputs.test-mode == 'nightly-pytorch' }} + run: | + Invoke-WebRequest -Uri "https://aka.ms/vs/17/release/vc_redist.x64.exe" -OutFile "vc_redist.x64.exe" + Start-Process -FilePath ".\vc_redist.x64.exe" -ArgumentList "/install", "/quiet", "/norestart" -Wait + Remove-Item "vc_redist.x64.exe" + + - name: Install cuda-python wheels + PyTorch + if: ${{ inputs.test-mode == 'nightly-pytorch' }} + env: + CUDA_VER: ${{ matrix.CUDA_VER }} + LOCAL_CTK: ${{ matrix.LOCAL_CTK }} + shell: bash --noprofile --norc -xeuo pipefail {0} + run: run-tests nightly-pytorch + + - name: Install cuda-python wheels + numba-cuda + if: ${{ inputs.test-mode == 'nightly-numba-cuda' }} + env: + CUDA_VER: ${{ matrix.CUDA_VER }} + LOCAL_CTK: ${{ matrix.LOCAL_CTK }} + shell: bash --noprofile --norc -xeuo pipefail {0} + run: run-tests nightly-numba-cuda + + - name: Install cuda-python wheels + numba-cuda-mlir + if: ${{ inputs.test-mode == 'nightly-numba-cuda-mlir' }} + env: + CUDA_VER: ${{ matrix.CUDA_VER }} + LOCAL_CTK: ${{ matrix.LOCAL_CTK }} + shell: bash --noprofile --norc -xeuo pipefail {0} + run: run-tests nightly-numba-cuda-mlir + + - name: Install main pathfinder/bindings + released cuda-core + if: ${{ inputs.test-mode == 'nightly-cuda-core' }} + env: + CUDA_VER: ${{ matrix.CUDA_VER }} + LOCAL_CTK: ${{ matrix.LOCAL_CTK }} + shell: bash --noprofile --norc -xeuo pipefail {0} + run: run-tests nightly-cuda-core + + # ── Nightly: run tests ── + - name: Run PyTorch interop tests + if: ${{ inputs.test-mode == 'nightly-pytorch' }} + shell: bash --noprofile --norc -xeuo pipefail {0} + run: | + pushd cuda_core + pytest -rxXs -v --durations=0 tests/test_utils.py tests/example_tests/ + popd + + - name: Run numba-cuda tests + if: ${{ inputs.test-mode == 'nightly-numba-cuda' }} + shell: bash --noprofile --norc -xeuo pipefail {0} + run: python -m numba.runtests numba.cuda.tests + + - name: Checkout numba-cuda-mlir tests at matching tag + if: ${{ inputs.test-mode == 'nightly-numba-cuda-mlir' && env.NUMBA_CUDA_MLIR_VER != '' }} + uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + with: + repository: NVIDIA/numba-cuda-mlir + ref: v${{ env.NUMBA_CUDA_MLIR_VER }} + path: numba-cuda-mlir-released + + - name: Run numba-cuda-mlir tests + if: ${{ inputs.test-mode == 'nightly-numba-cuda-mlir' && env.NUMBA_CUDA_MLIR_VER != '' }} + shell: bash --noprofile --norc -xeuo pipefail {0} + run: | + pushd numba-cuda-mlir-released + pip install --upgrade "pip>=25.1" + pip install --group test + # Version-gated deselects — dropped automatically when newer + # cuSIMT release ships. See linux step for full rationale. + # NVIDIA/numba-cuda-mlir#135 poisons a subset of tests that + # varies across runs based on collection order, so we deselect + # the full union rather than trying to enumerate what happened + # to fail on the most recent nightly. + DESELECTS=() + if python -c "from packaging.version import Version; import sys; sys.exit(0 if Version('${NUMBA_CUDA_MLIR_VER}') <= Version('0.4.1') else 1)"; then + DESELECTS+=( + --deselect 'tests/numba_cuda_tests/cudadrv/test_cuda_array_slicing.py::CudaArraySetting::test_no_sync_default_stream' + --deselect 'tests/numba_cuda_tests/cudadrv/test_cuda_array_slicing.py::CudaArraySetting::test_no_sync_supplied_stream' + --deselect 'tests/numba_cuda_tests/cudadrv/test_cuda_array_slicing.py::CudaArraySetting::test_sync' + --deselect 'tests/numba_cuda_tests/cudapy/test_cuda_array_interface.py::TestCudaArrayInterface::test_consume_no_sync' + --deselect 'tests/numba_cuda_tests/cudapy/test_cuda_array_interface.py::TestCudaArrayInterface::test_consume_sync' + --deselect 'tests/numba_cuda_tests/cudapy/test_cuda_array_interface.py::TestCudaArrayInterface::test_launch_no_sync' + --deselect 'tests/numba_cuda_tests/cudapy/test_cuda_array_interface.py::TestCudaArrayInterface::test_launch_sync' + --deselect 'tests/numba_cuda_tests/cudapy/test_cuda_array_interface.py::TestCudaArrayInterface::test_launch_sync_two_streams' + --deselect 'tests/numba_cuda_tests/cudapy/test_cuda_array_interface.py::TestCudaArrayInterface::test_fortran_contiguous' + ) + fi + pytest -rxXs -v --durations=0 \ + --ignore=tests/benchmarks \ + --ignore=tests/doc_examples \ + "${DESELECTS[@]}" \ + tests/ + popd + + - name: Checkout released cuda-core tests at matching tag + if: ${{ inputs.test-mode == 'nightly-cuda-core' && env.CUDA_CORE_RELEASED_VER != '' }} + uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + with: + ref: cuda-core-v${{ env.CUDA_CORE_RELEASED_VER }} + path: cuda-core-released + + - name: Run released cuda-core tests + if: ${{ inputs.test-mode == 'nightly-cuda-core' && env.CUDA_CORE_RELEASED_VER != '' }} + shell: bash --noprofile --norc -xeuo pipefail {0} + run: | + pushd cuda-core-released/cuda_core + pip install --upgrade "pip>=25.1" + pip install --group "${CUDA_CORE_TEST_GROUP}" + # Cap pytest below 9.1 — released cuda-core <=1.0.1 has parametrize + # patterns that pytest 9.1 rejects (see #2212). + pip install "pytest<9.1" + # Version-gated deselects — dropped automatically when a newer + # cuda-core release ships. See linux step for full rationale on + # NvlinkVersion. The Windows-only tests are: + # - test_rlcompleter_patch: env-dependent expectation that + # passes on Linux, fails on Windows MCDM. + # - test_non_managed_resources_report_not_managed[pinned]: same + # MCDM mempool OOM v1.0.1 already xfails in + # test_pinned_memory_resource_initialization (TODO(#9999)); + # main fixed the parametrized case via #2139 but v1.0.1 lacks + # the fix. + DESELECTS=() + if python -c "from packaging.version import Version; import sys; sys.exit(0 if Version('${CUDA_CORE_RELEASED_VER}') <= Version('1.0.1') else 1)"; then + DESELECTS+=( + --deselect 'tests/test_enum_coverage.py::test_wrapper_covers_all_binding_members[NvlinkVersion]' + --deselect 'tests/test_rlcompleter_patch.py::test_opt_out_env_var_disables_patch_even_when_interactive' + --deselect 'tests/test_memory.py::test_non_managed_resources_report_not_managed[pinned]' + ) + fi + pytest -rxXs -v --durations=0 --randomly-dont-reorganize \ + "${DESELECTS[@]}" \ + tests/ + popd diff --git a/.github/workflows/triagelabel.yml b/.github/workflows/triagelabel.yml index 75456f56ee9..300efad36a2 100644 --- a/.github/workflows/triagelabel.yml +++ b/.github/workflows/triagelabel.yml @@ -1,16 +1,25 @@ -name: Label issues +# SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +name: Add Triage Label + on: issues: types: - reopened - opened + jobs: - label_issues: + triage: runs-on: ubuntu-latest permissions: issues: write steps: - - run: gh issue edit "$NUMBER" --add-label "triage" + - name: Add or check for existing labels + # add the triage label only if no label has been added + if: ${{ github.event.issue.labels[0] == null }} + run: gh issue edit "$NUMBER" --add-label "triage" env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_REPO: ${{ github.repository }} diff --git a/.gitignore b/.gitignore index c34410505b4..6b6a7dfc0b5 100644 --- a/.gitignore +++ b/.gitignore @@ -8,35 +8,37 @@ __pycache__/ # CUDA Python specific .cache/ +.lycheecache .pytest_cache/ .benchmarks/ *.cpp -!cuda/_lib/param_packer.cpp -!cuda/_cuda/loader.cpp +!*_impl.cpp +!cuda_bindings/cuda/bindings/_lib/param_packer.cpp +!cuda_bindings/cuda/bindings/_bindings/loader.cpp +cache_driver +cache_runtime +cache_nvrtc + +# cuda.core test object fixtures built locally / downloaded as CI artifacts +cuda_core/tests/test_binaries/*.o +cuda_core/tests/test_binaries/*.a +cuda_core/tests/test_binaries/*.lib # CUDA Python specific (auto-generated) -cuda/_cuda/ccuda.pxd -cuda/_cuda/ccuda.pyx -cuda/_cuda/cnvrtc.pxd -cuda/_cuda/cnvrtc.pyx -cuda/_lib/ccudart/ccudart.pxd -cuda/_lib/ccudart/ccudart.pyx -cuda/_lib/ccudart/utils.pxd -cuda/_lib/ccudart/utils.pyx -cuda/_lib/utils.pxd -cuda/_lib/utils.pyx -cuda/ccuda.pxd -cuda/ccuda.pyx -cuda/ccudart.pxd -cuda/ccudart.pyx -cuda/cnvrtc.pxd -cuda/cnvrtc.pyx -cuda/cuda.pxd -cuda/cuda.pyx -cuda/cudart.pxd -cuda/cudart.pyx -cuda/nvrtc.pxd -cuda/nvrtc.pyx +cuda_bindings/cuda/bindings/_internal/cudla.pyx +cuda_bindings/cuda/bindings/_internal/driver.pyx +cuda_bindings/cuda/bindings/_internal/nvrtc.pyx +cuda_bindings/cuda/bindings/_internal/cufile.pyx +cuda_bindings/cuda/bindings/_internal/nvfatbin.pyx +cuda_bindings/cuda/bindings/_internal/nvjitlink.pyx +cuda_bindings/cuda/bindings/_internal/nvml.pyx +cuda_bindings/cuda/bindings/_internal/nvvm.pyx +cuda_bindings/cuda/bindings/_internal/runtime.pyx +cuda_bindings/cuda/bindings/_internal/runtime_ptds.pyx +cuda_bindings/cuda/bindings/utils/_get_handle.pyx + +# Version files from setuptools_scm +_version.py # Distribution / packaging .Python @@ -102,6 +104,8 @@ instance/ # Sphinx documentation docs_src/_build/ +*/docs/source/generated/ +*/docs/source/module/generated/ # PyBuilder .pybuilder/ @@ -168,3 +172,13 @@ dmypy.json # Cython debug symbols cython_debug/ + +# Dont ignore +!.github/actions/build/ +# pixi environments +.pixi/* +!.pixi/config.toml + +# Cursor +.cursorrules +.claude/settings.local.json diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000000..029e69da916 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,151 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +ci: + autofix_commit_msg: | + [pre-commit.ci] auto code formatting + autofix_prs: false + autoupdate_branch: '' + autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate' + autoupdate_schedule: quarterly + skip: [lychee, check-precommit-installed] + submodules: false + +# Please update the rev: SHAs below with this command: +# pre-commit autoupdate --freeze +repos: + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: c60c980e561ed3e73101667fe8365c609d19a438 # frozen: v0.15.9 + hooks: + - id: ruff-check + args: [--fix, --show-fixes] + exclude: (^cuda_bindings/cuda/bindings/_internal/_fast_enum\.py$)|(.*\.pyi$) + - id: ruff-format + exclude: .*\.pyi$ + + - repo: local + hooks: + - id: check-precommit-installed + name: Warn if the pre-commit git hook is not installed + entry: python ./toolshed/check_precommit_installed.py + language: python + always_run: true + pass_filenames: false + verbose: true + + - id: check-spdx + name: Check SPDX Headers + entry: python ./toolshed/check_spdx.py + language: python + additional_dependencies: + - https://files.pythonhosted.org/packages/cc/20/ff623b09d963f88bfde16306a54e12ee5ea43e9b597108672ff3a408aad6/pathspec-0.12.1-py3-none-any.whl + exclude: '(.*pixi\.lock)|(\.git_archival\.txt)|(.*\.patch$)|(^cuda_core/cuda/core/_vendored/)' + args: ["--fix"] + + - id: check-generated-file-seals + name: Check generated-file seals + entry: python ./toolshed/check_generated_file_seals.py + language: python + files: ^cuda_bindings/ + types: [text] + + - id: no-markdown-in-docs-source + name: Prevent markdown files in docs/source directories + entry: bash -c + args: + - 'for file in "$@"; do >&2 echo "error: markdown file "$file" found in a docs/source directory. Only reST (.rst) is allowed"; done && exit 1' + - "_" # fake script name, because bash considers $0 (the first argument) to be the script name + language: system + files: '^.*/docs/source/.*\.md$' + + - id: stubgen-pyx-cuda-core + name: Generate .pyi stubs for cuda_core + entry: stubgen-pyx cuda_core/cuda --continue-on-error --include-private + language: python + files: ^cuda_core/cuda/.*\.(pyx|pxd)$ + pass_filenames: false + additional_dependencies: + - stubgen-pyx==0.2.6 + - Cython==3.2.4 + + # Link checking for authored documentation files + - repo: https://github.com/lycheeverse/lychee + rev: 2bba271688c1abb1503097a064e6c3bc1d1b6a9b # frozen: lychee-v0.24.2 + hooks: + - id: lychee + args: + - --cache + - --max-concurrency=4 + - --max-retries=3 + - --no-progress + files: '\.(md|rst)$' + + # Standard hooks + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: "3e8a8703264a2f4a69428a0aa4dcb512790b2c8c" # frozen: v6.0.0 + hooks: + - id: check-added-large-files + exclude: cuda_bindings/cuda/bindings/nvml.pyx + - id: check-case-conflict + - id: check-docstring-first + - id: check-merge-conflict + - id: check-symlinks + - id: check-toml + - id: check-yaml + - id: debug-statements + - id: end-of-file-fixer + exclude: &gen_exclude '^(?:cuda_python/README\.md|cuda_bindings/cuda/bindings/.*\.in?|cuda_bindings/docs/source/module/.*\.rst?|.*\.pyi)$' + - id: mixed-line-ending + - id: trailing-whitespace + exclude: | + (?x)^(?: + cuda_python/README\.md| + cuda_bindings/cuda/bindings/.*\.in?| + cuda_bindings/docs/source/module/.*\.rst?| + .*\.patch$ + )$ + + # Checking for common mistakes + - repo: https://github.com/pre-commit/pygrep-hooks + rev: "3a6eb0fadf60b3cccfd80bad9dbb6fae7e47b316" # frozen: v1.10.0 + hooks: + - id: rst-backticks + - id: rst-directive-colons + - id: rst-inline-touching-normal + + - repo: https://github.com/pre-commit/mirrors-mypy + rev: 8e5c80792e2ec0c87804d8ef915bf35e2caea6da # frozen: v1.20.0 + hooks: + - id: mypy + alias: mypy-pathfinder + name: mypy-pathfinder + files: ^cuda_pathfinder/cuda/.*\.py$ # Exclude tests directory + args: [--config-file=cuda_pathfinder/pyproject.toml] + - id: mypy + alias: mypy-cuda-core + name: mypy-cuda-core + files: ^cuda_core/cuda/.*\.(py|pyi)$ + exclude: ^cuda_core/cuda/core/_vendored/ + pass_filenames: false + args: [--config-file=cuda_core/pyproject.toml, cuda_core/cuda/core] + additional_dependencies: + - numpy==2.4.2 + + - repo: https://github.com/rhysd/actionlint + rev: "914e7df21a07ef503a81201c76d2b11c789d3fca" # frozen: v1.7.12 + hooks: + - id: actionlint + args: ["-shellcheck="] + exclude: ^\.github/workflows/coverage.yml$ + + - repo: https://github.com/MarcoGorelli/cython-lint + rev: "7c6152f6c8f9087684ff2e09a9227941e233bafb" # frozen: v0.19.0 + hooks: + - id: cython-lint + args: [--no-pycodestyle] + exclude: ^cuda_bindings/ + + +default_language_version: + python: python3 diff --git a/.spdx-ignore b/.spdx-ignore new file mode 100644 index 00000000000..c0bf98105e7 --- /dev/null +++ b/.spdx-ignore @@ -0,0 +1,19 @@ +LICENSE* +*.html +*.json +*.md +*.png +.gitattributes +.gitignore +requirements*.txt +cuda_bindings/examples/* + +# Vendored +cuda_core/cuda/core/_include/dlpack.h +cuda_core/cuda/core/_include/aoti_shim.h +cuda_core/cuda/core/_include/aoti_shim.def + +# Generated by stubgen-pyx; regenerated on every commit so a header would be lost +cuda_core/cuda/**/*.pyi + +qa/ctk-next.drawio.svg diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 00000000000..e66437159b0 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,331 @@ +# cuda-python monorepo agent instructions + +This file contains repository-wide guidance. + +When a subdirectory has its own `AGENTS.md`, treat that file as the primary +guide for package-specific conventions and workflows. + +## Package map + +- `cuda_pathfinder/`: Pure-Python library discovery and loading utilities. +- `cuda_bindings/`: Low-level CUDA host API bindings (Cython-heavy). +- `cuda_core/`: High-level Pythonic CUDA APIs built on top of bindings. +- `cuda_python/`: Metapackage and docs aggregation. + +# Pull requests + +**Never push branches or commits to the upstream repo (github.com/NVIDIA/cuda-python). +Treat it as read-only.** All branch creation and pushes must go to the contributor's +personal fork. Before pushing, confirm which remote points to the contributor's +personal fork (not `upstream`) by running `git remote -v`, then push there +(`git push `). Open the PR from that fork with +`gh pr create`. Do not use `git push upstream` or any command that writes to +the `upstream` remote. + +When creating pull requests with `gh pr create`, always assign at least one +label and a milestone. CI enforces this via the `pr-metadata-check` workflow +and will block PRs that are missing labels or a milestone. Use `--label` and +`--milestone` flags, for example: + +``` +gh pr create --title "..." --body "..." --label "bug" --milestone "v1.0" +``` + +If you are unsure which label or milestone to use, check the existing labels +and milestones on the repository with `gh label list` and `gh api +repos/{owner}/{repo}/milestones --jq '.[].title'`, and pick the best match. + + +# General + +- When searching for text or files, prefer using `rg` or `rg --files` + respectively because `rg` is much faster than alternatives like `grep`. (If + the `rg` command is not found, then use alternatives.) +- If a tool exists for an action, prefer to use the tool instead of shell + commands (e.g `read_file` over `cat`). Strictly avoid raw `cmd`/terminal when + a dedicated tool exists. Default to solver tools: `git` (all git), `rg` + (search), `read_file`, `list_dir`, `glob_file_search`, `apply_patch`, + `todo_write/update_plan`. Use `cmd`/`run_terminal_cmd` only when no listed + tool can perform the action. +- If `pixi` is available for this repo, prefer `pixi run ...` or the matching + `pixi` task over invoking raw `python`, `pytest`, `pip`, or similar tools + directly so commands run in the repository-managed environment. +- When extracting or transforming JSON in shell workflows, prefer `jq` over + one-off Python parsing. For `gh` commands that return JSON, prefer the + built-in `--jq` flag instead of piping the output into `python`. +- When multiple tool calls can be parallelized (e.g., todo updates with other + actions, file searches, reading files), make these tool calls in parallel + instead of sequential. Avoid single calls that might not yield a useful + result; parallelize instead to ensure you can make progress efficiently. +- Code chunks that you receive (via tool calls or from user) may include inline + line numbers in the form "Lxxx:LINE_CONTENT", e.g. "L123:LINE_CONTENT". Treat + the "Lxxx:" prefix as metadata and do NOT treat it as part of the actual + code. +- Default expectation: deliver working code, not just a plan. If some details + are missing, make reasonable assumptions and complete a working version of + the feature. + + +# Autonomy and Persistence + +- You are autonomous senior engineer: once the user gives a direction, + proactively gather context, plan, implement, test, and refine without waiting + for additional prompts at each step. +- Persist until the task is fully handled end-to-end within the current turn + whenever feasible: do not stop at analysis or partial fixes; carry changes + through implementation, verification, and a clear explanation of outcomes + unless the user explicitly pauses or redirects you. +- Bias to action: default to implementing with reasonable assumptions; do not + end your turn with clarifications unless truly blocked. +- Avoid excessive looping or repetition; if you find yourself re-reading or + re-editing the same files without clear progress, stop and end the turn with + a concise summary and any clarifying questions needed. + + +# Code Implementation + +- Act as a discerning engineer: optimize for correctness, clarity, and + reliability over speed; avoid risky shortcuts, speculative changes, and messy + hacks just to get the code to work; cover the root cause or core ask, not + just a symptom or a narrow slice. +- Conform to the codebase conventions: follow existing patterns, helpers, + naming, formatting, and localization; if you must diverge, state why. +- Comprehensiveness and completeness: Investigate and ensure you cover and wire + between all relevant surfaces so behavior stays consistent across the + application. +- Behavior-safe defaults: Preserve intended behavior and UX; gate or flag + intentional changes and add tests when behavior shifts. +- Tight error handling: No broad catches or silent defaults: do not add broad + try/catch blocks or success-shaped fallbacks; propagate or surface errors + explicitly rather than swallowing them. + - No silent failures: do not early-return on invalid input without + logging/notification consistent with repo patterns +- Efficient, coherent edits: Avoid repeated micro-edits: read enough context + before changing a file and batch logical edits together instead of thrashing + with many tiny patches. +- Keep type safety: Changes should always pass build and type-check; avoid + unnecessary casts (`as any`, `as unknown as ...`); prefer proper types and + guards, and reuse existing helpers (e.g., normalizing identifiers) instead of + type-asserting. +- Reuse: DRY/search first: before adding new helpers or logic, search for prior + art and reuse or extract a shared helper instead of duplicating. +- Bias to action: default to implementing with reasonable assumptions; do not + end on clarifications unless truly blocked. Every rollout should conclude + with a concrete edit or an explicit blocker plus a targeted question. + +## Test authorship markers + +Use pytest markers to make the provenance of newly added unit tests explicit. +Keep this provenance system minimal: choose from only these three markers. +Place the marker immediately above each test function. A class-level marker is +acceptable only when every test method in the class has the same provenance. +Do not use module-level `pytestmark` for authorship provenance; it is too easy +to miss in large files and makes later per-test provenance changes ambiguous. + +- `@pytest.mark.agent_authored(model="")`: the test was authored by an + agent and has not yet been materially reviewed or rewritten by a human. + Agents must add this marker when generating new unit tests, for example: + + ```python + import pytest + + @pytest.mark.agent_authored(model="gpt-5.5") + def test_something(): + ... + ``` + +- `@pytest.mark.human_reviewed`: a human has materially reviewed or rewritten + an agent-authored test. Prefer replacing + `@pytest.mark.agent_authored(model="")` with this marker instead of + keeping both. +- `@pytest.mark.human_authored`: the test was authored by a human, or + rewritten enough that the authorship is primarily human. + +Use at most one authorship marker per test. Treat missing markers as legacy or +unknown provenance, not as implicit `@pytest.mark.human_authored`. Because +these are pytest markers, tests can be selected with `pytest -m`, for example +`pytest -m agent_authored`. + +When an agent notices a human adding a new test or materially modifying an +existing test, suggest adding `@pytest.mark.human_authored` or replacing +`@pytest.mark.agent_authored(model="")` with +`@pytest.mark.human_reviewed` as appropriate. + + +# Editing constraints + +- Default to ASCII when editing or creating files. Only introduce non-ASCII or + other Unicode characters when there is a clear justification and the file + already uses them. +- Add succinct code comments that explain what is going on if code is not + self-explanatory. You should not add comments like "Assigns the value to the + variable", but a brief comment might be useful ahead of a complex code block + that the user would otherwise have to spend time parsing out. Usage of these + comments should be rare. +- Try to use apply_patch for single file edits, but it is fine to explore other + options to make the edit if it does not work well. Do not use apply_patch for + changes that are auto-generated (i.e. generating package.json or running + a lint or format command like gofmt) or when scripting is more efficient + (such as search and replacing a string across a codebase). +- You may be in a dirty git worktree. + * NEVER revert existing changes you did not make unless explicitly + requested, since these changes were made by the user. + * If asked to make a commit or code edits and there are unrelated changes + to your work or changes that you didn't make in those files, don't revert + those changes. + * If the changes are in files you've touched recently, you should read + carefully and understand how you can work with the changes rather than + reverting them. + * If the changes are in unrelated files, just ignore them and don't revert + them. +- Do not amend a commit unless explicitly requested to do so. +- While you are working, you might notice unexpected changes that you didn't + make. If this happens, STOP IMMEDIATELY and ask the user how they would like + to proceed. +- **NEVER** use destructive commands like `git reset --hard` or `git checkout + --` unless specifically requested or approved by the user. + + +# Exploration and reading files + +- **Think first.** Before any tool call, decide ALL files/resources you will + need. +- **Batch everything.** If you need multiple files (even from different + places), read them together. +- **multi_tool_use.parallel** Use `multi_tool_use.parallel` to parallelize tool + calls and only this. +- **Only make sequential calls if you truly cannot know the next file without + seeing a result first.** +- **Workflow:** (a) plan all needed reads → (b) issue one parallel batch → (c) + analyze results → (d) repeat if new, unpredictable reads arise. +- Additional notes: + - Always maximize parallelism. Never read files one-by-one unless logically unavoidable. + - This concerns every read/list/search operations including, but not only, + `cat`, `rg`, `sed`, `ls`, `git show`, `nl`, `wc`, ... + - Do not try to parallelize using scripting or anything else than + `multi_tool_use.parallel`. + + +# Plan tool + +When using the planning tool: +- Skip using the planning tool for straightforward tasks (roughly the easiest + 25%). +- Do not make single-step plans. +- When you made a plan, update it after having performed one of the sub-tasks + that you shared on the plan. +- Unless asked for a plan, never end the interaction with only a plan. Plans + guide your edits; the deliverable is working code. +- Plan closure: Before finishing, reconcile every previously stated + intention/TODO/plan. Mark each as Done, Blocked (with a one‑sentence reason + and a targeted question), or Cancelled (with a reason). Do not end with + in_progress/pending items. If you created todos via a tool, update their + statuses accordingly. +- Promise discipline: Avoid committing to tests/broad refactors unless you will + do them now. Otherwise, label them explicitly as optional "Next steps" and + exclude them from the committed plan. +- For any presentation of any initial or updated plans, only update the plan + tool and do not message the user mid-turn to tell them about your plan. + + +# Special user requests + +- If the user makes a simple request (such as asking for the time) which you + can fulfill by running a terminal command (such as `date`), you should do so. +- If the user asks for a "review", default to a code review mindset: prioritise + identifying bugs, risks, behavioural regressions, and missing tests. Findings + must be the primary focus of the response - keep summaries or overviews brief + and only after enumerating the issues. Present findings first (ordered by + severity with file/line references), follow with open questions or + assumptions, and offer a change-summary only as a secondary detail. If no + findings are discovered, state that explicitly and mention any residual risks + or testing gaps. + + +# Frontend tasks + +When doing frontend design tasks, avoid collapsing into "AI slop" or safe, +average-looking layouts. Aim for interfaces that feel intentional, bold, and +a bit surprising. +- Typography: Use expressive, purposeful fonts and avoid default stacks (Inter, + Roboto, Arial, system). +- Color & Look: Choose a clear visual direction; define CSS variables; avoid + purple-on-white defaults. No purple bias or dark mode bias. +- Motion: Use a few meaningful animations (page-load, staggered reveals) + instead of generic micro-motions. +- Background: Don't rely on flat, single-color backgrounds; use gradients, + shapes, or subtle patterns to build atmosphere. +- Overall: Avoid boilerplate layouts and interchangeable UI patterns. Vary + themes, type families, and visual languages across outputs. +- Ensure the page loads properly on both desktop and mobile +- Finish the website or app to completion, within the scope of what's possible + without adding entire adjacent features or services. It should be in + a working state for a user to run and test. + +Exception: If working within an existing website or design system, preserve the +established patterns, structure, and visual language. + + +# Presenting your work and final message + +You are producing plain text that will later be styled by the CLI. Follow these +rules exactly. Formatting should make results easy to scan, but not feel +mechanical. Use judgment to decide how much structure adds value. + +- Default: be very concise; friendly coding teammate tone. +- Format: Use natural language with high-level headings. +- Ask only when needed; suggest ideas; mirror the user's style. +- For substantial work, summarize clearly; follow final‑answer formatting. +- Skip heavy formatting for simple confirmations. +- Don't dump large files you've written; reference paths only. +- No "save/copy this file" - User is on the same machine. +- Offer logical next steps (tests, commits, build) briefly; add verify steps if + you couldn't do something. +- For code changes: + * Lead with a quick explanation of the change, and then give more details on + the context covering where and why a change was made. Do not start this + explanation with "summary", just jump right in. + * If there are natural next steps the user may want to take, suggest them at + the end of your response. Do not make suggestions if there are no natural + next steps. + * When suggesting multiple options, use numeric lists for the suggestions so + the user can quickly respond with a single number. +- The user does not command execution outputs. When asked to show the output of + a command (e.g. `git show`), relay the important details in your answer or + summarize the key lines so the user understands the result. + +## Final answer structure and style guidelines + +- Plain text; CLI handles styling. Use structure only when it helps + scanability. +- Headers: optional; short Title Case (1-3 words) wrapped in **…**; no blank + line before the first bullet; add only if they truly help. +- Bullets: use - ; merge related points; keep to one line when possible; 4–6 + per list ordered by importance; keep phrasing consistent. +- Monospace: backticks for commands/paths/env vars/code ids and inline + examples; use for literal keyword bullets; never combine with double asterisk. +- Code samples or multi-line snippets should be wrapped in fenced code blocks; + include an info string as often as possible. +- Structure: group related bullets; order sections general → specific + → supporting; for subsections, start with a bolded keyword bullet, then + items; match complexity to the task. +- Tone: collaborative, concise, factual; present tense, active voice; + self‑contained; no "above/below"; parallel wording. +- Don'ts: no nested bullets/hierarchies; no ANSI codes; don't cram unrelated + keywords; keep keyword lists short—wrap/reformat if long; avoid naming + formatting styles in answers. +- Adaptation: code explanations → precise, structured with code refs; simple + tasks → lead with outcome; big changes → logical walkthrough + rationale + + next actions; casual one-offs → plain sentences, no headers/bullets. +- File References: When referencing files in your response follow the below + rules: + * Use inline code to make file paths clickable. + * Each reference should have a stand alone path. Even if it's the same file. + * Accepted: absolute, workspace‑relative, a/ or b/ diff prefixes, or bare + filename/suffix. + * Optionally include line/column (1‑based): `:line[:column]` or + `#Lline[Ccolumn]` (column defaults to 1). + * Do not use URIs like `file://`, `vscode://`, or `https://`. + * Do not provide range of lines + * Examples: `src/app.ts`, src/app.ts:42, b/server/index.js#L10, + C:\repo\project\main.rs:12:5 diff --git a/CLAUDE.md b/CLAUDE.md new file mode 120000 index 00000000000..47dc3e3d863 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1 @@ +AGENTS.md \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 44f1d02b796..012126cc842 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,11 +2,270 @@ Thank you for your interest in contributing to CUDA Python! Based on the type of contribution, it will fall into two categories: -1. You want to report a bug, feature request, or documentation issue - - File an [issue](https://github.com/NVIDIA/cuda-python/issues/new) +1. You want to report a bug, feature request, or documentation issue: + - File an [issue](https://github.com/NVIDIA/cuda-python/issues/new/choose) describing what you encountered or what you want to see changed. - The NVIDIA team will evaluate the issues and triage them, scheduling them for a release. If you believe the issue needs priority attention comment on the issue to notify the team. -2. You want to implement a feature or bug-fix - - At this time we do not accept code contributions. +2. You want to implement a feature, improvement, or bug fix: + - Before starting work on an existing issue, please comment on the issue to express your interest and wait to be assigned by a maintainer. This helps avoid redundant effort in case the issue is already being worked on by another contributor or an NVIDIA team member. + - Please refer to each component's guideline: + - [`cuda.core`](https://nvidia.github.io/cuda-python/cuda-core/latest/contribute.html) + - [`cuda.bindings`](https://nvidia.github.io/cuda-python/cuda-bindings/latest/contribute.html)[1](#footnote1) + - [`cuda.pathfinder`](https://nvidia.github.io/cuda-python/cuda-pathfinder/latest/contribute.html) + +## Table of Contents + +- [Contributing to CUDA Python](#contributing-to-cuda-python) + - [Table of Contents](#table-of-contents) + - [Type stubs for cuda.core](#type-stubs-for-cudacore) + - [Pre-commit](#pre-commit) + - [Signing Your Work](#signing-your-work) + - [Code signing](#code-signing) + - [Developer Certificate of Origin (DCO)](#developer-certificate-of-origin-dco) + - [CI infrastructure overview](#ci-infrastructure-overview) + - [CI Pipeline Flow](#ci-pipeline-flow) + - [Pipeline Execution Details](#pipeline-execution-details) + - [Branch-specific Artifact Flow](#branch-specific-artifact-flow) + - [Main Branch](#main-branch) + - [Backport Branches](#backport-branches) + - [Key Infrastructure Details](#key-infrastructure-details) + - [Code coverage](#code-coverage) + + +## Type stubs for cuda.core + +`cuda.core` is a PEP 561-compliant package: it ships a `py.typed` marker and +`.pyi` stub files alongside the Cython extensions. The stubs +are checked into the repository. + +**You do not need to run stubgen-pyx manually.** A pre-commit hook +regenerates the corresponding `.pyi` files automatically when you commit. +The results are then also tested with `mypy`. + +A few things to keep in mind: + +- **Do not edit `.pyi` files by hand.** They are regenerated from the Cython + sources on every commit that touches those sources; manual edits will be + overwritten. +- **Type annotations belong in the `.pyx`/`.pxd` source.** stubgen-pyx reads + Cython type annotations and docstrings to build the stubs, so keeping the + source well-annotated is the right way to improve stub quality. +- **To run mypy manually (outside of pre-commit)**: `python -m mypy + --config-file cuda_core/pyproject.toml + +## Pre-commit +This project uses [pre-commit.ci](https://pre-commit.ci/) with GitHub Actions. All pull requests are automatically checked for pre-commit compliance, and any pre-commit failures will block merging until resolved. + +To set yourself up for running pre-commit checks locally and to catch issues before pushing your changes, follow these steps: + +* Install pre-commit with: `pip install pre-commit` +* Run this once per checkout: `pre-commit install` +* You can manually check all files at any time by running: `pre-commit run --all-files` + +This command runs all configured hooks (such as linters and formatters) across your repository, letting you review and address issues before committing. + +Installing the hook is required, not optional. Some of the automated checks +(the SPDX header updater and the `.pyi` stub generator for `cuda_core`) only +keep the tree consistent if they run on *every* commit. Relying on manual +`pre-commit run --all-files` invocations means these checks can be skipped +between commits, leaving stale headers or out-of-date stubs in the history. +If the hook isn't installed, `pre-commit run` (and CI) will print a visible +warning reminding you to run `pre-commit install`. + + +## Signing Your Work + +Contributions to files licensed under Apache 2.0 must be certified under the +[Developer Certificate of Origin (DCO)](#developer-certificate-of-origin-dco). +Sign off every commit with the `-s` option: + +```console +git commit -s -m "Describe your change" +``` + +Git uses your configured name and email address to add a trailer like this to +the commit message: + +```text +Signed-off-by: Your Name +``` + +Use your real name and an email address associated with your contribution. The +sign-off certifies that you have the right to submit the contribution under the +DCO below. DCO sign-off is separate from the cryptographic commit signing +described in the next section; both requirements apply. + + +## Code signing + +This repository implements a security check to prevent the CI system from running untrusted code. A part of the security check consists of checking if the git commits are signed. Please ensure that your commits are signed [following GitHub’s instruction](https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification). + + +## Developer Certificate of Origin (DCO) +``` +Version 1.1 + +Copyright (C) 2004, 2006 The Linux Foundation and its contributors. + +Everyone is permitted to copy and distribute verbatim copies of this +license document, but changing it is not allowed. + + +Developer's Certificate of Origin 1.1 + +By making a contribution to this project, I certify that: + +(a) The contribution was created in whole or in part by me and I + have the right to submit it under the open source license + indicated in the file; or + +(b) The contribution is based upon previous work that, to the best + of my knowledge, is covered under an appropriate open source + license and I have the right under that license to submit that + work with modifications, whether created in whole or in part + by me, under the same open source license (unless I am + permitted to submit under a different license), as indicated + in the file; or + +(c) The contribution was provided directly to me by some other + person who certified (a), (b) or (c) and I have not modified + it. + +(d) I understand and agree that this project and the contribution + are public and that a record of the contribution (including all + personal information I submit with it, including my sign-off) is + maintained indefinitely and may be redistributed consistent with + this project or the open source license(s) involved. +``` + +## CI infrastructure overview + +The CUDA Python project uses a comprehensive CI pipeline that builds, tests, and releases multiple components across different platforms. This section provides a visual overview of our CI infrastructure to help contributors understand the build and release process. + +### CI Pipeline Flow + +![CUDA Python CI Pipeline Flow](ci/ci-pipeline.svg) + +Alternative Mermaid diagram representation: + +```mermaid +flowchart TD + %% Trigger Events + subgraph TRIGGER["🔄 TRIGGER EVENTS"] + T1["• Push to main branch"] + T2["• Pull request
• Manual workflow dispatch"] + T1 --- T2 + end + + %% Build Stage + subgraph BUILD["🔨 BUILD STAGE"] + subgraph BUILD_PLATFORMS["Parallel Platform Builds"] + B1["linux-64
(Self-hosted)"] + B2["linux-aarch64
(Self-hosted)"] + B3["win-64
(GitHub-hosted)"] + end + BUILD_DETAILS["• Python versions: 3.10, 3.11, 3.12, 3.13, 3.14
• CUDA version: 13.0.0 (build-time)
• Components: cuda-core, cuda-bindings,
cuda-pathfinder, cuda-python"] + end + + %% Artifact Storage + subgraph ARTIFACTS["📦 ARTIFACT STORAGE"] + subgraph GITHUB_ARTIFACTS["GitHub Artifacts"] + GA1["• Wheel files (.whl)
• Test artifacts
• Documentation
(30-day retention)"] + end + subgraph GITHUB_CACHE["GitHub Cache"] + GC1["• Mini CTK cache"] + end + end + + %% Test Stage + subgraph TEST["🧪 TEST STAGE"] + subgraph TEST_PLATFORMS["Parallel Platform Tests"] + TS1["linux-64
(Self-hosted)"] + TS2["linux-aarch64
(Self-hosted)"] + TS3["win-64
(GitHub-hosted)"] + end + TEST_DETAILS["• Download wheels from artifacts
• Test against multiple CUDA runtime versions
• Run Python unit tests, Cython tests, examples"] + ARTIFACT_FLOWS["Artifact Flows:
• cuda-pathfinder: main → backport
• cuda-bindings: backport → main"] + end + + %% Release Pipeline + subgraph RELEASE["🚀 RELEASE PIPELINE"] + subgraph RELEASE_STAGES["Sequential Release Steps"] + R1["Validation
• Artifact integrity
• Git tag verification"] + R2["Publishing
• PyPI/TestPyPI
• Component or all releases"] + R3["Documentation
• GitHub Pages
• Release notes"] + R1 --> R2 --> R3 + end + RELEASE_DETAILS["• Manual workflow dispatch with run ID
• Supports individual component or full releases"] + end + + %% Main Flow + TRIGGER --> BUILD + BUILD -.->|"wheel upload"| ARTIFACTS + ARTIFACTS -.-> TEST + TEST --> RELEASE + + %% Artifact Flow Arrows (Cache Reuse) + GITHUB_CACHE -.->|"mini CTK reuse"| BUILD + GITHUB_CACHE -.->|"mini CTK reuse"| TEST + + %% Artifact Flow Arrows (Wheel Fetch) + GITHUB_ARTIFACTS -.->|"wheel fetch"| TEST + GITHUB_ARTIFACTS -.->|"wheel fetch"| RELEASE + + %% Styling + classDef triggerStyle fill:#e8f4fd,stroke:#2196F3,stroke-width:2px,color:#1976D2 + classDef buildStyle fill:#f3e5f5,stroke:#9C27B0,stroke-width:2px,color:#7B1FA2 + classDef artifactStyle fill:#fff3e0,stroke:#FF9800,stroke-width:2px,color:#F57C00 + classDef testStyle fill:#e8f5e8,stroke:#4CAF50,stroke-width:2px,color:#388E3C + classDef releaseStyle fill:#ffebee,stroke:#f44336,stroke-width:2px,color:#D32F2F + + class TRIGGER,T1,T2 triggerStyle + class BUILD,BUILD_PLATFORMS,B1,B2,B3,BUILD_DETAILS buildStyle + class ARTIFACTS,GITHUB_ARTIFACTS,GITHUB_CACHE,GA1,GC1 artifactStyle + class TEST,TEST_PLATFORMS,TS1,TS2,TS3,TEST_DETAILS,ARTIFACT_FLOWS testStyle + class RELEASE,RELEASE_STAGES,R1,R2,R3,RELEASE_DETAILS releaseStyle +``` + +### Pipeline Execution Details + +**Parallel Execution**: The CI pipeline leverages parallel execution to optimize build and test times: +- **Build Stage**: Different architectures/operating systems (linux-64, linux-aarch64, win-64) are built in parallel across their respective runners +- **Test Stage**: Different architectures/operating systems/CUDA versions are tested in parallel; documentation preview is also built in parallel with testing + +### Branch-specific Artifact Flow + +#### Main Branch +- **Build** → **Test** → **Documentation** → **Potential Release** +- Artifacts stored as `{component}-python{version}-{platform}-{sha}` +- Full test coverage across all platforms and CUDA versions +- **Artifact flow out**: `cuda-pathfinder` artifacts → backport branches + +#### Backport Branches +- **Build** → **Test** → **Backport PR Creation** +- Artifacts used for validation before creating backport pull requests +- Maintains compatibility with older CUDA versions +- **Artifact flow in**: `cuda-pathfinder` artifacts ← main branch +- **Artifact flow out**: older `cuda-bindings` artifacts → main branch + +### Key Infrastructure Details + +- **Self-hosted runners**: Used for Linux builds and GPU testing (more resources, faster builds) +- **GitHub-hosted runners**: Used for Windows builds and general tasks +- **Artifact retention**: 30 days for GitHub Artifacts (wheels, docs, tests) +- **Cache retention**: GitHub Cache for build dependencies and environments +- **Security**: All commits must be signed, untrusted code blocked +- **Parallel execution**: Matrix builds across Python versions and platforms +- **Component isolation**: Each component (core, bindings, pathfinder, python) can be built/released independently + +## Code coverage + +Code coverage reports are produced nightly and posted to [GitHub Pages](https://nvidia.github.io/cuda-python/coverage). + +Known limitations: Code coverage is only run on Linux x86_64 with an a100 GPU. We plan to add more platform and GPU coverage in the future. + +--- + +1: The `cuda-python` meta package shares the same license and the contributing guidelines as those of `cuda-bindings`. diff --git a/LICENSE b/LICENSE index b7d042fcee3..d6f74778be8 100644 --- a/LICENSE +++ b/LICENSE @@ -1,48 +1,178 @@ -NVIDIA SOFTWARE LICENSE - -This license is a legal agreement between you and NVIDIA Corporation ("NVIDIA") and governs your use of the NVIDIA CUDA Python software and materials provided hereunder ("SOFTWARE"). - -This license can be accepted only by an adult of legal age of majority in the country in which the SOFTWARE is used. If you are under the legal age of majority, you must ask your parent or legal guardian to consent to this license. By taking delivery of the SOFTWARE, you affirm that you have reached the legal age of majority, you accept the terms of this license, and you take legal and financial responsibility for the actions of your permitted users. - -You agree to use the SOFTWARE only for purposes that are permitted by (a) this license, and (b) any applicable law, regulation or generally accepted practices or guidelines in the relevant jurisdictions. - -1. LICENSE. Subject to the terms of this license, NVIDIA grants you a non-exclusive limited license to: (a) install and use the SOFTWARE, and (b) distribute the SOFTWARE subject to the distribution requirements described in this license. NVIDIA reserves all rights, title and interest in and to the SOFTWARE not expressly granted to you under this license. - -2. DISTRIBUTION REQUIREMENTS. These are the distribution requirements for you to exercise the distribution grant: -a. The terms under which you distribute the SOFTWARE must be consistent with the terms of this license, including (without limitation) terms relating to the license grant and license restrictions and protection of NVIDIA's intellectual property rights. -b. You agree to notify NVIDIA in writing of any known or suspected distribution or use of the SOFTWARE not in compliance with the requirements of this license, and to enforce the terms of your agreements with respect to distributed SOFTWARE. - -3. LIMITATIONS. Your license to use the SOFTWARE is restricted as follows: -a. The SOFTWARE is licensed for you to develop applications only for use in systems with NVIDIA GPUs. -b. You may not reverse engineer, decompile or disassemble, or remove copyright or other proprietary notices from any portion of the SOFTWARE or copies of the SOFTWARE. -c. You may not modify or create derivative works of any portion of the SOFTWARE. -d. You may not bypass, disable, or circumvent any technical measure, encryption, security, digital rights management or authentication mechanism in the SOFTWARE. -e. You may not use the SOFTWARE in any manner that would cause it to become subject to an open source software license. As examples, licenses that require as a condition of use, modification, and/or distribution that the SOFTWARE be (i) disclosed or distributed in source code form; (ii) licensed for the purpose of making derivative works; or (iii) redistributable at no charge. -f. Unless you have an agreement with NVIDIA for this purpose, you may not use the SOFTWARE with any system or application where the use or failure of the system or application can reasonably be expected to threaten or result in personal injury, death, or catastrophic loss. Examples include use in avionics, navigation, military, medical, life support or other life critical applications. NVIDIA does not design, test or manufacture the SOFTWARE for these critical uses and NVIDIA shall not be liable to you or any third party, in whole or in part, for any claims or damages arising from such uses. -g. You agree to defend, indemnify and hold harmless NVIDIA and its affiliates, and their respective employees, contractors, agents, officers and directors, from and against any and all claims, damages, obligations, losses, liabilities, costs or debt, fines, restitutions and expenses (including but not limited to attorney's fees and costs incident to establishing the right of indemnification) arising out of or related to use of the SOFTWARE outside of the scope of this Agreement, or not in compliance with its terms. - -4. PRE-RELEASE. SOFTWARE versions identified as alpha, beta, preview, early access or otherwise as pre-release may not be fully functional, may contain errors or design flaws, and may have reduced or different security, privacy, availability, and reliability standards relative to commercial versions of NVIDIA software and materials. You may use a pre-release SOFTWARE version at your own risk, understanding that these versions are not intended for use in production or business-critical systems. - -5. OWNERSHIP. The SOFTWARE and the related intellectual property rights therein are and will remain the sole and exclusive property of NVIDIA or its licensors. The SOFTWARE is copyrighted and protected by the laws of the United States and other countries, and international treaty provisions. NVIDIA may make changes to the SOFTWARE, at any time without notice, but is not obligated to support or update the SOFTWARE. - -6. COMPONENTS UNDER OTHER LICENSES. The SOFTWARE may include NVIDIA or third-party components with separate legal notices or terms as may be described in proprietary notices accompanying the SOFTWARE. If and to the extent there is a conflict between the terms in this license and the license terms associated with a component, the license terms associated with the components control only to the extent necessary to resolve the conflict. - -7. FEEDBACK. You may, but don't have to, provide to NVIDIA any Feedback. "Feedback" means any suggestions, bug fixes, enhancements, modifications, feature requests or other feedback regarding the SOFTWARE. For any Feedback that you voluntarily provide, you hereby grant NVIDIA and its affiliates a perpetual, non-exclusive, worldwide, irrevocable license to use, reproduce, modify, license, sublicense (through multiple tiers of sublicensees), and distribute (through multiple tiers of distributors) the Feedback without the payment of any royalties or fees to you. NVIDIA will use Feedback at its choice. - -8. NO WARRANTIES. THE SOFTWARE IS PROVIDED "AS IS" WITHOUT ANY EXPRESS OR IMPLIED WARRANTY OF ANY KIND INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT, OR FITNESS FOR A PARTICULAR PURPOSE. NVIDIA DOES NOT WARRANT THAT THE SOFTWARE WILL MEET YOUR REQUIREMENTS OR THAT THE OPERATION THEREOF WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ALL ERRORS WILL BE CORRECTED. - -9. LIMITATIONS OF LIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY LAW, NVIDIA AND ITS AFFILIATES SHALL NOT BE LIABLE FOR ANY SPECIAL, INCIDENTAL, PUNITIVE OR CONSEQUENTIAL DAMAGES, OR ANY LOST PROFITS, PROJECT DELAYS, LOSS OF USE, LOSS OF DATA OR LOSS OF GOODWILL, OR THE COSTS OF PROCURING SUBSTITUTE PRODUCTS, ARISING OUT OF OR IN CONNECTION WITH THIS LICENSE OR THE USE OR PERFORMANCE OF THE SOFTWARE, WHETHER SUCH LIABILITY ARISES FROM ANY CLAIM BASED UPON BREACH OF CONTRACT, BREACH OF WARRANTY, TORT (INCLUDING NEGLIGENCE), PRODUCT LIABILITY OR ANY OTHER CAUSE OF ACTION OR THEORY OF LIABILITY, EVEN IF NVIDIA HAS PREVIOUSLY BEEN ADVISED OF, OR COULD REASONABLY HAVE FORESEEN, THE POSSIBILITY OF SUCH DAMAGES. IN NO EVENT WILL NVIDIA'S AND ITS AFFILIATES TOTAL CUMULATIVE LIABILITY UNDER OR ARISING OUT OF THIS LICENSE EXCEED US$10.00. THE NATURE OF THE LIABILITY OR THE NUMBER OF CLAIMS OR SUITS SHALL NOT ENLARGE OR EXTEND THIS LIMIT. - -10. TERMINATION. Your rights under this license will terminate automatically without notice from NVIDIA if you fail to comply with any term and condition of this license or if you commence or participate in any legal proceeding against NVIDIA with respect to the SOFTWARE. NVIDIA may terminate this license with advance written notice to you if NVIDIA decides to no longer provide the SOFTWARE in a country or, in NVIDIA's sole discretion, the continued use of it is no longer commercially viable. Upon any termination of this license, you agree to promptly discontinue use of the SOFTWARE and destroy all copies in your possession or control. Your prior distributions in accordance with this license are not affected by the termination of this license. All provisions of this license will survive termination, except for the license granted to you. - -11. APPLICABLE LAW. This license will be governed in all respects by the laws of the United States and of the State of Delaware as those laws are applied to contracts entered into and performed entirely within Delaware by Delaware residents, without regard to the conflicts of laws principles. The United Nations Convention on Contracts for the International Sale of Goods is specifically disclaimed. You agree to all terms of this Agreement in the English language. The state or federal courts residing in Santa Clara County, California shall have exclusive jurisdiction over any dispute or claim arising out of this license. Notwithstanding this, you agree that NVIDIA shall still be allowed to apply for injunctive remedies or an equivalent type of urgent legal relief in any jurisdiction. - -12. NO ASSIGNMENT. This license and your rights and obligations thereunder may not be assigned by you by any means or operation of law without NVIDIA's permission. Any attempted assignment not approved by NVIDIA in writing shall be void and of no effect. - -13. EXPORT. The SOFTWARE is subject to United States export laws and regulations. You agree that you will not ship, transfer or export the SOFTWARE into any country, or use the SOFTWARE in any manner, prohibited by the United States Bureau of Industry and Security or economic sanctions regulations administered by the U.S. Department of Treasury's Office of Foreign Assets Control (OFAC), or any applicable export laws, restrictions or regulations. These laws include restrictions on destinations, end users and end use. By accepting this license, you confirm that you are not a resident or citizen of any country currently embargoed by the U.S. and that you are not otherwise prohibited from receiving the SOFTWARE. - -14. GOVERNMENT USE. The SOFTWARE has been developed entirely at private expense and is "commercial items" consisting of "commercial computer software" and "commercial computer software documentation" provided with RESTRICTED RIGHTS. Use, duplication or disclosure by the U.S. Government or a U.S. Government subcontractor is subject to the restrictions in this license pursuant to DFARS 227.7202-3(a) or as set forth in subparagraphs (b)(1) and (2) of the Commercial Computer Software - Restricted Rights clause at FAR 52.227-19, as applicable. Contractor/manufacturer is NVIDIA, 2788 San Tomas Expressway, Santa Clara, CA 95051. - -15. ENTIRE AGREEMENT. This license is the final, complete and exclusive agreement between the parties relating to the subject matter of this license and supersedes all prior or contemporaneous understandings and agreements relating to this subject matter, whether oral or written. If any court of competent jurisdiction determines that any provision of this license is illegal, invalid or unenforceable, the remaining provisions will remain in full force and effect. This license may only be modified in a writing signed by an authorized representative of each party. - -(v. May 12, 2021) +Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 4e93de45004..00000000000 --- a/MANIFEST.in +++ /dev/null @@ -1 +0,0 @@ -include cuda/_version.py diff --git a/README.md b/README.md index 7a8043a074f..243669b69ee 100644 --- a/README.md +++ b/README.md @@ -1,76 +1,55 @@ -# CUDA-Python +# cuda-python -CUDA Python is a standard set of low-level interfaces, providing full coverage of and access to the CUDA host APIs from Python. Checkout the [Overview](https://nvidia.github.io/cuda-python/overview.html) for the workflow and performance results. +CUDA Python is the home for accessing NVIDIA’s CUDA platform from Python. It consists of multiple components: -## Installing +* [cuda.core](https://nvidia.github.io/cuda-python/cuda-core/latest): Pythonic access to CUDA Runtime and other core functionality +* [cuda.bindings](https://nvidia.github.io/cuda-python/cuda-bindings/latest): Low-level Python bindings to CUDA C APIs +* [cuda.pathfinder](https://nvidia.github.io/cuda-python/cuda-pathfinder/latest): Utilities for locating CUDA components installed in the user's Python environment +* [cuda.coop](https://nvidia.github.io/cccl/unstable/python/coop.html): A Python module providing CCCL's reusable block-wide and warp-wide *device* primitives for use within Numba CUDA kernels +* [cuda.compute](https://nvidia.github.io/cccl/unstable/python/compute/index.html): A Python module for easy access to CCCL's highly efficient and customizable parallel algorithms, like `sort`, `scan`, `reduce`, `transform`, etc. that are callable on the *host* +* [numba-cuda-mlir](https://nvidia.github.io/numba-cuda-mlir/): An evolution of Numba CUDA that improves upon its technical foundation and performance to provide the future of CUDA Python JIT compilation. It currently supports developing CUDA **SIMT** kernels in Python, providing Python bindings for accelerated device libraries, and serving as a compiler for user-defined functions in accelerated libraries. +* [numba.cuda](https://nvidia.github.io/numba-cuda/): A Python DSL that exposes CUDA **SIMT** programming model and compiles a restricted subset of Python code into CUDA kernels and device functions +* [cuda.tile](https://docs.nvidia.com/cuda/cutile-python/): A new Python DSL that exposes CUDA **Tile** programming model and allows users to write NumPy-like code in CUDA kernels +* [nvmath-python](https://docs.nvidia.com/cuda/nvmath-python/latest): Pythonic access to NVIDIA CPU & GPU Math Libraries, with [*host*](https://docs.nvidia.com/cuda/nvmath-python/latest/overview.html#host-apis), [*device*](https://docs.nvidia.com/cuda/nvmath-python/latest/overview.html#device-apis), and [*distributed*](https://docs.nvidia.com/cuda/nvmath-python/latest/distributed-apis/index.html) APIs. It also provides low-level Python bindings to host C APIs ([nvmath.bindings](https://docs.nvidia.com/cuda/nvmath-python/latest/bindings/index.html)). +* [nvshmem4py](https://docs.nvidia.com/nvshmem/api/api/language_bindings/python/index.html): Pythonic interface to the NVSHMEM library, enabling Python applications to leverage NVSHMEM's high-performance PGAS (Partitioned Global Address Space) programming model for GPU-accelerated computing +* [Nsight Python](https://docs.nvidia.com/nsight-python/index.html): Python kernel profiling interface that automates performance analysis across multiple kernel configurations using NVIDIA Nsight Tools +* [CUPTI Python](https://docs.nvidia.com/cupti-python/): Python APIs for creation of profiling tools that target CUDA Python applications via the CUDA Profiling Tools Interface (CUPTI) +* [Accelerated Computing Hub](https://github.com/NVIDIA/accelerated-computing-hub): Open-source learning materials related to GPU computing. You will find user guides, tutorials, and other works freely available for all learners interested in GPU computing. -CUDA Python can be installed from: +CUDA Python is currently undergoing an overhaul to improve existing and introduce new components. All of the previously available functionality from the `cuda-python` package will continue to be available, please refer to the [cuda.bindings](https://nvidia.github.io/cuda-python/cuda-bindings/latest) documentation for installation guide and further detail. -* PYPI -* Conda (nvidia channel) -* Source builds +## cuda-python as a metapackage -There're differences in each of these options that are described further in [Installation](https://nvidia.github.io/cuda-python/install.html) documentation. Each package will guarantee minor version compatibility. +`cuda-python` is being restructured to become a metapackage that contains a collection of subpackages. Each subpackage is versioned independently, allowing installation of each component as needed. -## Runtime Dependencies +### Subpackage: `cuda.core` -CUDA Python is supported on all platforms that CUDA is supported. Specific dependencies are as follows: +The `cuda.core` package offers idiomatic, Pythonic access to CUDA Runtime and other functionalities. -* Driver: Linux (450.80.02 or later) Windows (456.38 or later) -* CUDA Toolkit 12.0 to 12.5 +The goals are to -Only the NVRTC redistributable component is required from the CUDA Toolkit. [CUDA Toolkit Documentation](https://docs.nvidia.com/cuda/index.html) Installation Guides can be used for guidance. Note that the NVRTC component in the Toolkit can be obtained via PYPI, Conda or Local Installer. +1. Provide **idiomatic ("Pythonic")** access to CUDA Driver, Runtime, and JIT compiler toolchain +2. Focus on **developer productivity** by ensuring end-to-end CUDA development can be performed quickly and entirely in Python +3. **Avoid homegrown** Python abstractions for CUDA for new Python GPU libraries starting from scratch +4. **Ease** developer **burden of maintaining** and catching up with latest CUDA features +5. **Flatten the learning curve** for current and future generations of CUDA developers -### Supported Python Versions +### Subpackage: `cuda.bindings` -CUDA Python follows [NEP 29](https://numpy.org/neps/nep-0029-deprecation_policy.html) for supported Python version guarantee. +The `cuda.bindings` package is a standard set of low-level interfaces, providing full coverage of and access to the CUDA host APIs from Python. -Before dropping support, an issue will be raised to look for feedback. +The list of available interfaces is: -Source builds work for multiple Python versions, however pre-build PyPI and Conda packages are only provided for a subset: +* CUDA Driver +* CUDA Runtime +* NVRTC +* nvJitLink +* NVVM +* nvFatbin +* cuFile +* NVML -* Python 3.9 to 3.12 +## License -## Testing - -### Requirements - -Latest dependencies can be found in [requirements.txt](https://github.com/NVIDIA/cuda-python/blob/main/requirements.txt). - -### Unit-tests - -You can run the included tests with: - -``` -python -m pytest -``` - -### Benchmark - -You can run benchmark only tests with: - -``` -python -m pytest --benchmark-only -``` - -### Samples - -You can run the included tests with: - -``` -python -m pytest examples -``` - -## Examples - -CUDA Samples rewriten using CUDA Python are found in `examples`. - -Custom extra included examples: - -- `examples/extra/jit_program_test.py`: Demonstrates the use of the API to compile and - launch a kernel on the device. Includes device memory allocation / - deallocation, transfers between host and device, creation and usage of - streams, and context management. -- `examples/extra/numba_emm_plugin.py`: Implements a Numba External Memory Management - plugin, showing that this CUDA Python Driver API can coexist with other - wrappers of the driver API. +CUDA Python is licensed under the [Apache License 2.0](./LICENSE). Third-party +attributions for `cuda.core` are listed in [`cuda_core/NOTICE`](./cuda_core/NOTICE). diff --git a/SECURITY.md b/SECURITY.md new file mode 100755 index 00000000000..63ef6e4950c --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,46 @@ +# Security + +NVIDIA is dedicated to the security and trust of our software products and services, +including all source code repositories managed through our organization. + +If you need to report a security issue, please use the appropriate contact points outlined +below. **Please do not report security vulnerabilities through GitHub/GitLab.** + +## Reporting Potential Security Vulnerability in CUDA Python + +To report a potential security vulnerability in CUDA Python: + +- Web: [Security Vulnerability Submission + Form](https://www.nvidia.com/object/submit-security-vulnerability.html) +- E-Mail: + - We encourage you to use the following PGP key for secure email communication: [NVIDIA + public PGP Key for communication](https://www.nvidia.com/en-us/security/pgp-key) + - Please include the following information: + - Product/Driver name and version/branch that contains the vulnerability + - Type of vulnerability (code execution, denial of service, buffer overflow, etc.) + - Instructions to reproduce the vulnerability + - Proof-of-concept or exploit code + - Potential impact of the vulnerability, including how an attacker could exploit the + vulnerability + +While NVIDIA currently does not have a bug bounty program, we do offer acknowledgement when +an externally reported security issue is addressed under our coordinated vulnerability +disclosure policy. Please visit our [Product Security Incident Response Team +(PSIRT)](https://www.nvidia.com/en-us/security/psirt-policies/) policies page for more +information. + +## CUDA IPC and Python serialization + +`cuda.core.Buffer` objects allocated from IPC-enabled memory resources can be +pickled for transfer between same-host processes. Unpickling performs an IPC +memory import using the embedded `IPCBufferDescriptor`. Only unpickle buffers +(and call `Buffer.from_ipc_descriptor`) with descriptors from trusted peers; +malicious descriptors can trigger invalid memory operations. + +When sharing CUDA objects across processes, use `multiprocessing` with the +`spawn` start method. + +## NVIDIA Product Security + +For all security-related concerns, please visit NVIDIA's Product Security portal at +. diff --git a/benchmarks/cuda_bindings/.gitignore b/benchmarks/cuda_bindings/.gitignore new file mode 100644 index 00000000000..b795782a321 --- /dev/null +++ b/benchmarks/cuda_bindings/.gitignore @@ -0,0 +1,16 @@ +# Build artifacts +.build/ +__pycache__/ + +# Benchmark results +*.json +.benchmarks/ + +# Pixi environments +.pixi/ + +# Override root .gitignore *.cpp rule (which targets Cython-generated files) +!benchmarks/cpp/*.cpp + +results-python.json +results-cpp.json diff --git a/benchmarks/cuda_bindings/AGENTS.md b/benchmarks/cuda_bindings/AGENTS.md new file mode 100644 index 00000000000..b9096a737f8 --- /dev/null +++ b/benchmarks/cuda_bindings/AGENTS.md @@ -0,0 +1,6 @@ +# cuda.bindings benchmarks + +Read the README.md in this directory for more details about the benchmarks. + +When generating code verify that that the code is correct based on the source for cuda-bindings +that can be found in ../../cuda_bindings diff --git a/benchmarks/cuda_bindings/README.md b/benchmarks/cuda_bindings/README.md new file mode 100644 index 00000000000..33b2bf30ce1 --- /dev/null +++ b/benchmarks/cuda_bindings/README.md @@ -0,0 +1,80 @@ +# cuda.bindings benchmarks + +These benchmarks are intended to measure the latency overhead of calling CUDA +Driver APIs through cuda.bindings, relative to a similar C++ baseline. + +The goal is to benchmark how much overhead does the Python layer adds to calling +CUDA APIs and what operations are not in our target of less than 1us of overhead. + +Most Python benchmarks have a C++ counterpart that is used as a comparative +baseline. We try to make each implementation perform small operations and +nearly the same work as possible and are run under similar conditions. + +A few benchmarks (e.g. in `bench_enum.py`) are intentionally Python-only +because they measure costs with no direct C++ equivalent — such as enum +construction and member access on `cuda.bindings` enum classes. + +These are **not** throughput benchmarks to measure the overall performance +of kernels and applications. + +## Usage + +Requires pixi. + +There are a couple of environments defined based on how `cuda.bindings` is installed: + +- `wheel`: Installs from conda packages +- `source`: Installs from source + +There are a couple of tasks defined: + +- `bench`: Runs the Python benchmarks +- `bench-cpp`: Runs the C++ benchmarks + +### System tuning + +For more stable results on Linux, tune the system before running benchmarks. +See: https://pyperf.readthedocs.io/en/latest/system.html#system + +```bash +# Show current system state +pixi run -e wheel -- python -m pyperf system show + +# Apply tuning (may require root) +$(pixi run -e wheel -- which python) -m pyperf system tune +``` + +### Running benchmarks + +To run the benchmarks combine the environment and task: + +```bash +# Run the Python benchmarks in the wheel environment +pixi run -e wheel bench +pixi run -e wheel bench --min-time 0.1 + +# Run the Python benchmarks in the source environment +pixi run -e source bench + +# Run the C++ benchmarks +pixi run -e wheel bench-cpp +pixi run -e wheel bench-cpp --min-time 0.1 +``` + +Both runners automatically save results to JSON files in the benchmarks +directory: `results-python.json` and `results-cpp.json`. + +## Output JSON and analysis + +The benchmarks are run using [pyperf](https://pyperf.readthedocs.io/en/latest/). +Both Python and C++ results are saved in pyperf-compatible JSON format, +which can be analyzed with pyperf commands: + +```bash +# Show results and statistics +pixi run -e wheel -- python -m pyperf stats results-python.json +pixi run -e wheel -- python -m pyperf stats results-cpp.json + +# Compare C++ vs Python results +pixi run -e wheel -- python -m pyperf compare_to results-cpp.json results-python.json +``` diff --git a/benchmarks/cuda_bindings/benchmarks/bench_ctx_device.py b/benchmarks/cuda_bindings/benchmarks/bench_ctx_device.py new file mode 100644 index 00000000000..7f619ae4a39 --- /dev/null +++ b/benchmarks/cuda_bindings/benchmarks/bench_ctx_device.py @@ -0,0 +1,79 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +import time + +from runner.runtime import ensure_context + +from cuda.bindings import driver as cuda + +CTX = ensure_context() + +_, DEVICE = cuda.cuDeviceGet(0) +ATTRIBUTE = cuda.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR + +# Outer retain so the benchmarked retain/release pair just bumps the refcount. +_err, _PRIMARY_CTX = cuda.cuDevicePrimaryCtxRetain(DEVICE) +if _err != cuda.CUresult.CUDA_SUCCESS: + raise RuntimeError(f"cuDevicePrimaryCtxRetain failed during setup: {_err}") + + +def bench_ctx_get_current(loops: int) -> float: + _fn = cuda.cuCtxGetCurrent + + t0 = time.perf_counter() + for _ in range(loops): + _fn() + return time.perf_counter() - t0 + + +def bench_ctx_set_current(loops: int) -> float: + _fn = cuda.cuCtxSetCurrent + _ctx = CTX + + t0 = time.perf_counter() + for _ in range(loops): + _fn(_ctx) + return time.perf_counter() - t0 + + +def bench_ctx_get_device(loops: int) -> float: + _fn = cuda.cuCtxGetDevice + + t0 = time.perf_counter() + for _ in range(loops): + _fn() + return time.perf_counter() - t0 + + +def bench_device_get(loops: int) -> float: + _fn = cuda.cuDeviceGet + + t0 = time.perf_counter() + for _ in range(loops): + _fn(0) + return time.perf_counter() - t0 + + +def bench_device_get_attribute(loops: int) -> float: + _fn = cuda.cuDeviceGetAttribute + _attr = ATTRIBUTE + _dev = DEVICE + + t0 = time.perf_counter() + for _ in range(loops): + _fn(_attr, _dev) + return time.perf_counter() - t0 + + +def bench_device_primary_ctx_retain(loops: int) -> float: + _retain = cuda.cuDevicePrimaryCtxRetain + _release = cuda.cuDevicePrimaryCtxRelease + _dev = DEVICE + + t0 = time.perf_counter() + for _ in range(loops): + _retain(_dev) + _release(_dev) + return time.perf_counter() - t0 diff --git a/benchmarks/cuda_bindings/benchmarks/bench_enum.py b/benchmarks/cuda_bindings/benchmarks/bench_enum.py new file mode 100644 index 00000000000..42bfd47ed3e --- /dev/null +++ b/benchmarks/cuda_bindings/benchmarks/bench_enum.py @@ -0,0 +1,34 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +import time + +from cuda.bindings import driver as cuda + + +def bench_curesult_construction(loops: int) -> float: + _cls = cuda.CUresult + + t0 = time.perf_counter() + for _ in range(loops): + _cls(0) + return time.perf_counter() - t0 + + +def bench_curesult_member_access(loops: int) -> float: + _cls = cuda.CUresult + + t0 = time.perf_counter() + for _ in range(loops): + _cls.CUDA_SUCCESS # noqa: B018 + return time.perf_counter() - t0 + + +def bench_device_attribute_construction(loops: int) -> float: + _cls = cuda.CUdevice_attribute + + t0 = time.perf_counter() + for _ in range(loops): + _cls(1) + return time.perf_counter() - t0 diff --git a/benchmarks/cuda_bindings/benchmarks/bench_event.py b/benchmarks/cuda_bindings/benchmarks/bench_event.py new file mode 100644 index 00000000000..041adc25538 --- /dev/null +++ b/benchmarks/cuda_bindings/benchmarks/bench_event.py @@ -0,0 +1,62 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +import time + +from runner.runtime import ensure_context + +from cuda.bindings import driver as cuda + +ensure_context() + +_err, STREAM = cuda.cuStreamCreate(cuda.CUstream_flags.CU_STREAM_NON_BLOCKING.value) +_err, EVENT = cuda.cuEventCreate(cuda.CUevent_flags.CU_EVENT_DISABLE_TIMING.value) + +cuda.cuEventRecord(EVENT, STREAM) +cuda.cuStreamSynchronize(STREAM) + +EVENT_FLAGS = cuda.CUevent_flags.CU_EVENT_DISABLE_TIMING.value + + +def bench_event_create_destroy(loops: int) -> float: + _create = cuda.cuEventCreate + _destroy = cuda.cuEventDestroy + _flags = EVENT_FLAGS + + t0 = time.perf_counter() + for _ in range(loops): + _, e = _create(_flags) + _destroy(e) + return time.perf_counter() - t0 + + +def bench_event_record(loops: int) -> float: + _fn = cuda.cuEventRecord + _event = EVENT + _stream = STREAM + + t0 = time.perf_counter() + for _ in range(loops): + _fn(_event, _stream) + return time.perf_counter() - t0 + + +def bench_event_query(loops: int) -> float: + _fn = cuda.cuEventQuery + _event = EVENT + + t0 = time.perf_counter() + for _ in range(loops): + _fn(_event) + return time.perf_counter() - t0 + + +def bench_event_synchronize(loops: int) -> float: + _fn = cuda.cuEventSynchronize + _event = EVENT + + t0 = time.perf_counter() + for _ in range(loops): + _fn(_event) + return time.perf_counter() - t0 diff --git a/benchmarks/cuda_bindings/benchmarks/bench_launch.py b/benchmarks/cuda_bindings/benchmarks/bench_launch.py new file mode 100644 index 00000000000..eb3392b09d1 --- /dev/null +++ b/benchmarks/cuda_bindings/benchmarks/bench_launch.py @@ -0,0 +1,406 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +import ctypes +import time + +from runner.runtime import alloc_persistent, assert_drv, compile_and_load + +from cuda.bindings import driver as cuda + +# Compile kernels lazily so benchmark discovery does not need NVRTC. +KERNEL_SOURCE = """\ +extern "C" __global__ void empty_kernel() { return; } +extern "C" __global__ void small_kernel(float *f) { *f = 0.0f; } + +#define ITEM_PARAM(x, T) T x +#define REP1(x, T) , ITEM_PARAM(x, T) +#define REP2(x, T) REP1(x##0, T) REP1(x##1, T) +#define REP4(x, T) REP2(x##0, T) REP2(x##1, T) +#define REP8(x, T) REP4(x##0, T) REP4(x##1, T) +#define REP16(x, T) REP8(x##0, T) REP8(x##1, T) +#define REP32(x, T) REP16(x##0, T) REP16(x##1, T) +#define REP64(x, T) REP32(x##0, T) REP32(x##1, T) +#define REP128(x, T) REP64(x##0, T) REP64(x##1, T) +#define REP256(x, T) REP128(x##0, T) REP128(x##1, T) + +template +struct KernelFunctionParam { + unsigned char p[maxBytes]; +}; + +extern "C" __global__ +void small_kernel_16_args( + ITEM_PARAM(F, int*) + REP1(A, int*) + REP2(A, int*) + REP4(A, int*) + REP8(A, int*)) +{ *F = 0; } + +extern "C" __global__ +void small_kernel_256_args( + ITEM_PARAM(F, int*) + REP1(A, int*) + REP2(A, int*) + REP4(A, int*) + REP8(A, int*) + REP16(A, int*) + REP32(A, int*) + REP64(A, int*) + REP128(A, int*)) +{ *F = 0; } + +extern "C" __global__ +void small_kernel_512_args( + ITEM_PARAM(F, int*) + REP1(A, int*) + REP2(A, int*) + REP4(A, int*) + REP8(A, int*) + REP16(A, int*) + REP32(A, int*) + REP64(A, int*) + REP128(A, int*) + REP256(A, int*)) +{ *F = 0; } + +extern "C" __global__ +void small_kernel_512_bools( + ITEM_PARAM(F, bool) + REP1(A, bool) + REP2(A, bool) + REP4(A, bool) + REP8(A, bool) + REP16(A, bool) + REP32(A, bool) + REP64(A, bool) + REP128(A, bool) + REP256(A, bool)) +{ return; } + +extern "C" __global__ +void small_kernel_512_ints( + ITEM_PARAM(F, int) + REP1(A, int) + REP2(A, int) + REP4(A, int) + REP8(A, int) + REP16(A, int) + REP32(A, int) + REP64(A, int) + REP128(A, int) + REP256(A, int)) +{ return; } + +extern "C" __global__ +void small_kernel_512_doubles( + ITEM_PARAM(F, double) + REP1(A, double) + REP2(A, double) + REP4(A, double) + REP8(A, double) + REP16(A, double) + REP32(A, double) + REP64(A, double) + REP128(A, double) + REP256(A, double)) +{ return; } + +extern "C" __global__ +void small_kernel_512_chars( + ITEM_PARAM(F, char) + REP1(A, char) + REP2(A, char) + REP4(A, char) + REP8(A, char) + REP16(A, char) + REP32(A, char) + REP64(A, char) + REP128(A, char) + REP256(A, char)) +{ return; } + +extern "C" __global__ +void small_kernel_512_longlongs( + ITEM_PARAM(F, long long) + REP1(A, long long) + REP2(A, long long) + REP4(A, long long) + REP8(A, long long) + REP16(A, long long) + REP32(A, long long) + REP64(A, long long) + REP128(A, long long) + REP256(A, long long)) +{ return; } + +extern "C" __global__ +void small_kernel_2048B(KernelFunctionParam<2048> param) { + // Do not touch param to prevent compiler from copying + // the whole structure from const bank to lmem. +} +""" + +MODULE = None +EMPTY_KERNEL = None +SMALL_KERNEL = None +KERNEL_16_ARGS = None +KERNEL_256_ARGS = None +KERNEL_512_ARGS = None +KERNEL_512_BOOLS = None +KERNEL_512_INTS = None +KERNEL_512_DOUBLES = None +KERNEL_512_CHARS = None +KERNEL_512_LONGLONGS = None +KERNEL_2048B = None +STREAM = None +FLOAT_PTR = None +INT_PTRS_512 = None +_VAL_PS_16 = None +_VAL_PS_512 = None +PACKED_16 = None +PACKED_512 = None + + +class _Struct2048B(ctypes.Structure): + _fields_ = [("values", ctypes.c_uint8 * 2048)] + + +STRUCT_2048B = _Struct2048B() + + +def _ensure_launch_state() -> None: + global MODULE, EMPTY_KERNEL, SMALL_KERNEL + global KERNEL_16_ARGS, KERNEL_256_ARGS, KERNEL_512_ARGS + global KERNEL_512_BOOLS, KERNEL_512_INTS, KERNEL_512_DOUBLES + global KERNEL_512_CHARS, KERNEL_512_LONGLONGS, KERNEL_2048B + global STREAM, FLOAT_PTR, INT_PTRS_512 + global _VAL_PS_16, _VAL_PS_512, PACKED_16, PACKED_512 + + if EMPTY_KERNEL is not None: + return + + module = compile_and_load(KERNEL_SOURCE) + + def get_func(name): + err, func = cuda.cuModuleGetFunction(module, name.encode()) + assert_drv(err) + return func + + err, stream = cuda.cuStreamCreate(cuda.CUstream_flags.CU_STREAM_NON_BLOCKING.value) + assert_drv(err) + + float_ptr = alloc_persistent(ctypes.sizeof(ctypes.c_float)) + int_ptrs_512 = tuple(alloc_persistent(ctypes.sizeof(ctypes.c_int)) for _ in range(512)) + + # Pre-pack 16 args + val_ps_16 = [ctypes.c_void_p(int(ptr)) for ptr in int_ptrs_512[:16]] + packed_16 = (ctypes.c_void_p * 16)() + for i, vp in enumerate(val_ps_16): + packed_16[i] = ctypes.addressof(vp) + + # Pre-pack 512 args + val_ps_512 = [ctypes.c_void_p(int(ptr)) for ptr in int_ptrs_512] + packed_512 = (ctypes.c_void_p * 512)() + for i, vp in enumerate(val_ps_512): + packed_512[i] = ctypes.addressof(vp) + + MODULE = module + EMPTY_KERNEL = get_func("empty_kernel") + SMALL_KERNEL = get_func("small_kernel") + KERNEL_16_ARGS = get_func("small_kernel_16_args") + KERNEL_256_ARGS = get_func("small_kernel_256_args") + KERNEL_512_ARGS = get_func("small_kernel_512_args") + KERNEL_512_BOOLS = get_func("small_kernel_512_bools") + KERNEL_512_INTS = get_func("small_kernel_512_ints") + KERNEL_512_DOUBLES = get_func("small_kernel_512_doubles") + KERNEL_512_CHARS = get_func("small_kernel_512_chars") + KERNEL_512_LONGLONGS = get_func("small_kernel_512_longlongs") + KERNEL_2048B = get_func("small_kernel_2048B") + STREAM = stream + FLOAT_PTR = float_ptr + INT_PTRS_512 = int_ptrs_512 + _VAL_PS_16 = val_ps_16 + _VAL_PS_512 = val_ps_512 + PACKED_16 = packed_16 + PACKED_512 = packed_512 + + +def bench_launch_empty_kernel(loops: int) -> float: + _ensure_launch_state() + _fn = cuda.cuLaunchKernel + _kernel = EMPTY_KERNEL + _stream = STREAM + + t0 = time.perf_counter() + for _ in range(loops): + _fn(_kernel, 1, 1, 1, 1, 1, 1, 0, _stream, 0, 0) + return time.perf_counter() - t0 + + +def bench_launch_small_kernel(loops: int) -> float: + _ensure_launch_state() + _fn = cuda.cuLaunchKernel + _kernel = SMALL_KERNEL + _stream = STREAM + _args = (FLOAT_PTR,) + _arg_types = (None,) + + t0 = time.perf_counter() + for _ in range(loops): + _fn(_kernel, 1, 1, 1, 1, 1, 1, 0, _stream, (_args, _arg_types), 0) + return time.perf_counter() - t0 + + +def bench_launch_16_args(loops: int) -> float: + _ensure_launch_state() + _fn = cuda.cuLaunchKernel + _kernel = KERNEL_16_ARGS + _stream = STREAM + _args = INT_PTRS_512[:16] + _arg_types = (None,) * 16 + + t0 = time.perf_counter() + for _ in range(loops): + _fn(_kernel, 1, 1, 1, 1, 1, 1, 0, _stream, (_args, _arg_types), 0) + return time.perf_counter() - t0 + + +def bench_launch_16_args_pre_packed(loops: int) -> float: + _ensure_launch_state() + _fn = cuda.cuLaunchKernel + _kernel = KERNEL_16_ARGS + _stream = STREAM + _packed = PACKED_16 + + t0 = time.perf_counter() + for _ in range(loops): + _fn(_kernel, 1, 1, 1, 1, 1, 1, 0, _stream, _packed, 0) + return time.perf_counter() - t0 + + +def bench_launch_256_args(loops: int) -> float: + _ensure_launch_state() + _fn = cuda.cuLaunchKernel + _kernel = KERNEL_256_ARGS + _stream = STREAM + _args = INT_PTRS_512[:256] + _arg_types = (None,) * 256 + + t0 = time.perf_counter() + for _ in range(loops): + _fn(_kernel, 1, 1, 1, 1, 1, 1, 0, _stream, (_args, _arg_types), 0) + return time.perf_counter() - t0 + + +def bench_launch_512_args(loops: int) -> float: + _ensure_launch_state() + _fn = cuda.cuLaunchKernel + _kernel = KERNEL_512_ARGS + _stream = STREAM + _args = INT_PTRS_512 + _arg_types = (None,) * 512 + + t0 = time.perf_counter() + for _ in range(loops): + _fn(_kernel, 1, 1, 1, 1, 1, 1, 0, _stream, (_args, _arg_types), 0) + return time.perf_counter() - t0 + + +def bench_launch_512_args_pre_packed(loops: int) -> float: + _ensure_launch_state() + _fn = cuda.cuLaunchKernel + _kernel = KERNEL_512_ARGS + _stream = STREAM + _packed = PACKED_512 + + t0 = time.perf_counter() + for _ in range(loops): + _fn(_kernel, 1, 1, 1, 1, 1, 1, 0, _stream, _packed, 0) + return time.perf_counter() - t0 + + +def bench_launch_512_bools(loops: int) -> float: + _ensure_launch_state() + _fn = cuda.cuLaunchKernel + _kernel = KERNEL_512_BOOLS + _stream = STREAM + _args = (True,) * 512 + _arg_types = (ctypes.c_bool,) * 512 + + t0 = time.perf_counter() + for _ in range(loops): + _fn(_kernel, 1, 1, 1, 1, 1, 1, 0, _stream, (_args, _arg_types), 0) + return time.perf_counter() - t0 + + +def bench_launch_512_ints(loops: int) -> float: + _ensure_launch_state() + _fn = cuda.cuLaunchKernel + _kernel = KERNEL_512_INTS + _stream = STREAM + _args = (123,) * 512 + _arg_types = (ctypes.c_int,) * 512 + + t0 = time.perf_counter() + for _ in range(loops): + _fn(_kernel, 1, 1, 1, 1, 1, 1, 0, _stream, (_args, _arg_types), 0) + return time.perf_counter() - t0 + + +def bench_launch_512_doubles(loops: int) -> float: + _ensure_launch_state() + _fn = cuda.cuLaunchKernel + _kernel = KERNEL_512_DOUBLES + _stream = STREAM + _args = (1.2345,) * 512 + _arg_types = (ctypes.c_double,) * 512 + + t0 = time.perf_counter() + for _ in range(loops): + _fn(_kernel, 1, 1, 1, 1, 1, 1, 0, _stream, (_args, _arg_types), 0) + return time.perf_counter() - t0 + + +def bench_launch_512_bytes(loops: int) -> float: + _ensure_launch_state() + _fn = cuda.cuLaunchKernel + _kernel = KERNEL_512_CHARS + _stream = STREAM + _args = (127,) * 512 + _arg_types = (ctypes.c_byte,) * 512 + + t0 = time.perf_counter() + for _ in range(loops): + _fn(_kernel, 1, 1, 1, 1, 1, 1, 0, _stream, (_args, _arg_types), 0) + return time.perf_counter() - t0 + + +def bench_launch_512_longlongs(loops: int) -> float: + _ensure_launch_state() + _fn = cuda.cuLaunchKernel + _kernel = KERNEL_512_LONGLONGS + _stream = STREAM + _args = (9223372036854775806,) * 512 + _arg_types = (ctypes.c_longlong,) * 512 + + t0 = time.perf_counter() + for _ in range(loops): + _fn(_kernel, 1, 1, 1, 1, 1, 1, 0, _stream, (_args, _arg_types), 0) + return time.perf_counter() - t0 + + +def bench_launch_2048b(loops: int) -> float: + _ensure_launch_state() + _fn = cuda.cuLaunchKernel + _kernel = KERNEL_2048B + _stream = STREAM + _args = (STRUCT_2048B,) + _arg_types = (None,) + + t0 = time.perf_counter() + for _ in range(loops): + _fn(_kernel, 1, 1, 1, 1, 1, 1, 0, _stream, (_args, _arg_types), 0) + return time.perf_counter() - t0 diff --git a/benchmarks/cuda_bindings/benchmarks/bench_memory.py b/benchmarks/cuda_bindings/benchmarks/bench_memory.py new file mode 100644 index 00000000000..875c0604066 --- /dev/null +++ b/benchmarks/cuda_bindings/benchmarks/bench_memory.py @@ -0,0 +1,88 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +import time + +import numpy as np +from runner.runtime import alloc_persistent, ensure_context + +from cuda.bindings import driver as cuda + +ensure_context() + +# Allocation size for alloc/free benchmarks +ALLOC_SIZE = 1024 + +# Small transfer size (8 bytes) to measure call overhead, not bandwidth +COPY_SIZE = 8 + +# Pre-allocate device memory and host buffers for memcpy benchmarks +DST_DPTR = alloc_persistent(COPY_SIZE) +SRC_DPTR = alloc_persistent(COPY_SIZE) +HOST_SRC = np.zeros(COPY_SIZE, dtype=np.uint8) +HOST_DST = np.zeros(COPY_SIZE, dtype=np.uint8) + +# Stream for async operations +_err, STREAM = cuda.cuStreamCreate(cuda.CUstream_flags.CU_STREAM_NON_BLOCKING.value) + + +def bench_mem_alloc_free(loops: int) -> float: + _alloc = cuda.cuMemAlloc + _free = cuda.cuMemFree + _size = ALLOC_SIZE + + t0 = time.perf_counter() + for _ in range(loops): + _, ptr = _alloc(_size) + _free(ptr) + return time.perf_counter() - t0 + + +def bench_mem_alloc_async_free_async(loops: int) -> float: + _alloc = cuda.cuMemAllocAsync + _free = cuda.cuMemFreeAsync + _size = ALLOC_SIZE + _stream = STREAM + + t0 = time.perf_counter() + for _ in range(loops): + _, ptr = _alloc(_size, _stream) + _free(ptr, _stream) + return time.perf_counter() - t0 + + +def bench_memcpy_htod(loops: int) -> float: + _fn = cuda.cuMemcpyHtoD + _dst = DST_DPTR + _src = HOST_SRC + _size = COPY_SIZE + + t0 = time.perf_counter() + for _ in range(loops): + _fn(_dst, _src, _size) + return time.perf_counter() - t0 + + +def bench_memcpy_dtoh(loops: int) -> float: + _fn = cuda.cuMemcpyDtoH + _dst = HOST_DST + _src = SRC_DPTR + _size = COPY_SIZE + + t0 = time.perf_counter() + for _ in range(loops): + _fn(_dst, _src, _size) + return time.perf_counter() - t0 + + +def bench_memcpy_dtod(loops: int) -> float: + _fn = cuda.cuMemcpyDtoD + _dst = DST_DPTR + _src = SRC_DPTR + _size = COPY_SIZE + + t0 = time.perf_counter() + for _ in range(loops): + _fn(_dst, _src, _size) + return time.perf_counter() - t0 diff --git a/benchmarks/cuda_bindings/benchmarks/bench_module.py b/benchmarks/cuda_bindings/benchmarks/bench_module.py new file mode 100644 index 00000000000..0c2b317c3a1 --- /dev/null +++ b/benchmarks/cuda_bindings/benchmarks/bench_module.py @@ -0,0 +1,57 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +import time + +from runner.runtime import assert_drv, compile_cubin, ensure_context, register_module + +from cuda.bindings import driver as cuda + +ensure_context() + +# Compile a trivial kernel to cubin once; reuse for all benchmarks +KERNEL_SOURCE = 'extern "C" __global__ void empty_kernel() { return; }' +CUBIN = compile_cubin(KERNEL_SOURCE) + +# Load a persistent module + function for the get_function / get_attribute benchmarks +_err, MODULE = cuda.cuModuleLoadData(CUBIN) +assert_drv(_err) +register_module(MODULE) +_err, FUNCTION = cuda.cuModuleGetFunction(MODULE, b"empty_kernel") +assert_drv(_err) + +FUNC_ATTRIBUTE = cuda.CUfunction_attribute.CU_FUNC_ATTRIBUTE_MAX_THREADS_PER_BLOCK + + +def bench_module_load_unload(loops: int) -> float: + _load = cuda.cuModuleLoadData + _unload = cuda.cuModuleUnload + _cubin = CUBIN + + t0 = time.perf_counter() + for _ in range(loops): + _, m = _load(_cubin) + _unload(m) + return time.perf_counter() - t0 + + +def bench_module_get_function(loops: int) -> float: + _fn = cuda.cuModuleGetFunction + _module = MODULE + + t0 = time.perf_counter() + for _ in range(loops): + _fn(_module, b"empty_kernel") + return time.perf_counter() - t0 + + +def bench_func_get_attribute(loops: int) -> float: + _fn = cuda.cuFuncGetAttribute + _attr = FUNC_ATTRIBUTE + _func = FUNCTION + + t0 = time.perf_counter() + for _ in range(loops): + _fn(_attr, _func) + return time.perf_counter() - t0 diff --git a/benchmarks/cuda_bindings/benchmarks/bench_nvrtc.py b/benchmarks/cuda_bindings/benchmarks/bench_nvrtc.py new file mode 100644 index 00000000000..0b2598aaa4e --- /dev/null +++ b/benchmarks/cuda_bindings/benchmarks/bench_nvrtc.py @@ -0,0 +1,83 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +import time + +from runner.runtime import assert_drv, ensure_context + +from cuda.bindings import driver as cuda +from cuda.bindings import nvrtc + +ensure_context() + +KERNEL_SOURCE = b'extern "C" __global__ void empty_kernel() { return; }' +PROGRAM_NAME = b"benchmark_kernel.cu" + +# Compute the arch flag once for compile benchmarks +_err, _device = cuda.cuDeviceGet(0) +assert_drv(_err) +_err, _major = cuda.cuDeviceGetAttribute(cuda.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR, _device) +assert_drv(_err) +_err, _minor = cuda.cuDeviceGetAttribute(cuda.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR, _device) +assert_drv(_err) +ARCH_FLAG = f"--gpu-architecture=sm_{_major}{_minor}".encode() +COMPILE_OPTIONS = [b"--fmad=false", ARCH_FLAG] + +# Pre-build 100 empty headers for the headers benchmark +HEADER_NAMES = [f"header_{i}.cuh".encode() for i in range(100)] +HEADER_SOURCES = [b"// empty" for _ in range(100)] + + +def bench_nvrtc_create_program(loops: int) -> float: + _create = nvrtc.nvrtcCreateProgram + _destroy = nvrtc.nvrtcDestroyProgram + _assert = assert_drv + _src = KERNEL_SOURCE + _name = PROGRAM_NAME + + t0 = time.perf_counter() + for _ in range(loops): + err, prog = _create(_src, _name, 0, [], []) + _assert(err) + (err,) = _destroy(prog) + _assert(err) + return time.perf_counter() - t0 + + +def bench_nvrtc_create_program_100_headers(loops: int) -> float: + _create = nvrtc.nvrtcCreateProgram + _destroy = nvrtc.nvrtcDestroyProgram + _assert = assert_drv + _src = KERNEL_SOURCE + _name = PROGRAM_NAME + _headers = HEADER_SOURCES + _header_names = HEADER_NAMES + + t0 = time.perf_counter() + for _ in range(loops): + err, prog = _create(_src, _name, 100, _headers, _header_names) + _assert(err) + (err,) = _destroy(prog) + _assert(err) + return time.perf_counter() - t0 + + +def bench_nvrtc_compile_program(loops: int) -> float: + _create = nvrtc.nvrtcCreateProgram + _compile = nvrtc.nvrtcCompileProgram + _destroy = nvrtc.nvrtcDestroyProgram + _assert = assert_drv + _src = KERNEL_SOURCE + _name = PROGRAM_NAME + _options = COMPILE_OPTIONS + + t0 = time.perf_counter() + for _ in range(loops): + err, prog = _create(_src, _name, 0, [], []) + _assert(err) + (err,) = _compile(prog, 2, _options) + _assert(err) + (err,) = _destroy(prog) + _assert(err) + return time.perf_counter() - t0 diff --git a/benchmarks/cuda_bindings/benchmarks/bench_pointer_attributes.py b/benchmarks/cuda_bindings/benchmarks/bench_pointer_attributes.py new file mode 100644 index 00000000000..3cc7ad015c1 --- /dev/null +++ b/benchmarks/cuda_bindings/benchmarks/bench_pointer_attributes.py @@ -0,0 +1,45 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +import time + +from runner.runtime import alloc_persistent + +from cuda.bindings import driver as cuda + +# Allocate memory used by the tests +PTR = alloc_persistent(1 << 18) +ATTRIBUTE = cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_MEMORY_TYPE + +ATTRIBUTES = ( + cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_MEMORY_TYPE, + cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_DEVICE_POINTER, + cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_HOST_POINTER, + cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_BUFFER_ID, +) +NUM_ATTRIBUTES = len(ATTRIBUTES) + + +def bench_pointer_get_attribute(loops: int) -> float: + # Local references to avoid global lookups in the hot loop + _fn = cuda.cuPointerGetAttribute + _attr = ATTRIBUTE + _ptr = PTR + + t0 = time.perf_counter() + for _ in range(loops): + _fn(_attr, _ptr) + return time.perf_counter() - t0 + + +def bench_pointer_get_attributes(loops: int) -> float: + _fn = cuda.cuPointerGetAttributes + _num = NUM_ATTRIBUTES + _attrs = ATTRIBUTES + _ptr = PTR + + t0 = time.perf_counter() + for _ in range(loops): + _fn(_num, _attrs, _ptr) + return time.perf_counter() - t0 diff --git a/benchmarks/cuda_bindings/benchmarks/bench_stream.py b/benchmarks/cuda_bindings/benchmarks/bench_stream.py new file mode 100644 index 00000000000..3aab9288fc6 --- /dev/null +++ b/benchmarks/cuda_bindings/benchmarks/bench_stream.py @@ -0,0 +1,45 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +import time + +from runner.runtime import ensure_context + +from cuda.bindings import driver as cuda + +ensure_context() + +_err, STREAM = cuda.cuStreamCreate(cuda.CUstream_flags.CU_STREAM_NON_BLOCKING.value) + + +def bench_stream_create_destroy(loops: int) -> float: + _create = cuda.cuStreamCreate + _destroy = cuda.cuStreamDestroy + _flags = cuda.CUstream_flags.CU_STREAM_NON_BLOCKING.value + + t0 = time.perf_counter() + for _ in range(loops): + _, s = _create(_flags) + _destroy(s) + return time.perf_counter() - t0 + + +def bench_stream_query(loops: int) -> float: + _fn = cuda.cuStreamQuery + _stream = STREAM + + t0 = time.perf_counter() + for _ in range(loops): + _fn(_stream) + return time.perf_counter() - t0 + + +def bench_stream_synchronize(loops: int) -> float: + _fn = cuda.cuStreamSynchronize + _stream = STREAM + + t0 = time.perf_counter() + for _ in range(loops): + _fn(_stream) + return time.perf_counter() - t0 diff --git a/benchmarks/cuda_bindings/benchmarks/bench_tensormap.py b/benchmarks/cuda_bindings/benchmarks/bench_tensormap.py new file mode 100644 index 00000000000..e2a596820b7 --- /dev/null +++ b/benchmarks/cuda_bindings/benchmarks/bench_tensormap.py @@ -0,0 +1,203 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +import time + +from runner.runtime import alloc_persistent, ensure_context + +from cuda.bindings import driver as cuda + +ensure_context() + +PTR = alloc_persistent(1 << 20) + +cuuint32_t = cuda.cuuint32_t +cuuint64_t = cuda.cuuint64_t + +# Tiled: rank-2 float32, 128x128, 64x64 tile. +TILED_DTYPE = cuda.CUtensorMapDataType.CU_TENSOR_MAP_DATA_TYPE_FLOAT32 +TILED_RANK = 2 +TILED_GLOBAL_DIM = (cuuint64_t(128), cuuint64_t(128)) +TILED_GLOBAL_STRIDES = (cuuint64_t(128 * 4),) +TILED_BOX_DIM = (cuuint32_t(64), cuuint32_t(64)) +TILED_ELEMENT_STRIDES = (cuuint32_t(1), cuuint32_t(1)) +TILED_INTERLEAVE = cuda.CUtensorMapInterleave.CU_TENSOR_MAP_INTERLEAVE_NONE +TILED_SWIZZLE = cuda.CUtensorMapSwizzle.CU_TENSOR_MAP_SWIZZLE_NONE +TILED_L2 = cuda.CUtensorMapL2promotion.CU_TENSOR_MAP_L2_PROMOTION_NONE +TILED_OOB = cuda.CUtensorMapFloatOOBfill.CU_TENSOR_MAP_FLOAT_OOB_FILL_NONE + +# Im2col: rank-3 float16, 32x64x64. +IM2COL_DTYPE = cuda.CUtensorMapDataType.CU_TENSOR_MAP_DATA_TYPE_FLOAT16 +IM2COL_RANK = 3 +IM2COL_GLOBAL_DIM = (cuuint64_t(32), cuuint64_t(64), cuuint64_t(64)) +IM2COL_GLOBAL_STRIDES = (cuuint64_t(32 * 2), cuuint64_t(32 * 64 * 2)) +IM2COL_PIXEL_BOX_LOWER = (0,) +IM2COL_PIXEL_BOX_UPPER = (0,) +IM2COL_CHANNELS = 32 +IM2COL_PIXELS = 32 +IM2COL_ELEMENT_STRIDES = (cuuint32_t(1), cuuint32_t(1), cuuint32_t(1)) +IM2COL_INTERLEAVE = cuda.CUtensorMapInterleave.CU_TENSOR_MAP_INTERLEAVE_NONE +IM2COL_SWIZZLE = cuda.CUtensorMapSwizzle.CU_TENSOR_MAP_SWIZZLE_NONE +IM2COL_L2 = cuda.CUtensorMapL2promotion.CU_TENSOR_MAP_L2_PROMOTION_NONE +IM2COL_OOB = cuda.CUtensorMapFloatOOBfill.CU_TENSOR_MAP_FLOAT_OOB_FILL_NONE + +_SUCCESS = cuda.CUresult.CUDA_SUCCESS + +# Resolve bindings once at module load. A missing attribute (old binding that +# predates a TMA API) is the only legitimate reason for a probe to skip — +# everything else (signature mismatches, unexpected TypeError, etc.) should +# surface loudly instead of being reclassified as "unsupported". +_ENCODE_TILED = getattr(cuda, "cuTensorMapEncodeTiled", None) +_ENCODE_IM2COL = getattr(cuda, "cuTensorMapEncodeIm2col", None) +_ENCODE_IM2COL_WIDE = getattr(cuda, "cuTensorMapEncodeIm2colWide", None) +_IM2COL_WIDE_MODE_CLS = getattr(cuda, "CUtensorMapIm2ColWideMode", None) + + +def _probe_tiled() -> bool: + if _ENCODE_TILED is None: + return False + err, _ = _ENCODE_TILED( + TILED_DTYPE, + TILED_RANK, + PTR, + TILED_GLOBAL_DIM, + TILED_GLOBAL_STRIDES, + TILED_BOX_DIM, + TILED_ELEMENT_STRIDES, + TILED_INTERLEAVE, + TILED_SWIZZLE, + TILED_L2, + TILED_OOB, + ) + return err == _SUCCESS + + +def _probe_im2col() -> bool: + if _ENCODE_IM2COL is None: + return False + err, _ = _ENCODE_IM2COL( + IM2COL_DTYPE, + IM2COL_RANK, + PTR, + IM2COL_GLOBAL_DIM, + IM2COL_GLOBAL_STRIDES, + IM2COL_PIXEL_BOX_LOWER, + IM2COL_PIXEL_BOX_UPPER, + IM2COL_CHANNELS, + IM2COL_PIXELS, + IM2COL_ELEMENT_STRIDES, + IM2COL_INTERLEAVE, + IM2COL_SWIZZLE, + IM2COL_L2, + IM2COL_OOB, + ) + return err == _SUCCESS + + +def _probe_im2col_wide() -> bool: + if _ENCODE_IM2COL_WIDE is None or _IM2COL_WIDE_MODE_CLS is None: + return False + mode = _IM2COL_WIDE_MODE_CLS.CU_TENSOR_MAP_IM2COL_WIDE_MODE_W + err, _ = _ENCODE_IM2COL_WIDE( + IM2COL_DTYPE, + IM2COL_RANK, + PTR, + IM2COL_GLOBAL_DIM, + IM2COL_GLOBAL_STRIDES, + 0, + 0, + IM2COL_CHANNELS, + IM2COL_PIXELS, + IM2COL_ELEMENT_STRIDES, + IM2COL_INTERLEAVE, + mode, + cuda.CUtensorMapSwizzle.CU_TENSOR_MAP_SWIZZLE_128B, + IM2COL_L2, + IM2COL_OOB, + ) + return err == _SUCCESS + + +_TILED_OK = _probe_tiled() +_IM2COL_OK = _probe_im2col() +_IM2COL_WIDE_OK = _probe_im2col_wide() + +if _IM2COL_WIDE_OK: + _IM2COL_WIDE_MODE_W = _IM2COL_WIDE_MODE_CLS.CU_TENSOR_MAP_IM2COL_WIDE_MODE_W + _IM2COL_WIDE_SWIZZLE = cuda.CUtensorMapSwizzle.CU_TENSOR_MAP_SWIZZLE_128B + +SKIPPED_BENCHMARKS: set[str] = set() +if not _TILED_OK: + SKIPPED_BENCHMARKS.add("bench_tensor_map_encode_tiled") +if not _IM2COL_OK: + SKIPPED_BENCHMARKS.add("bench_tensor_map_encode_im2col") +if not _IM2COL_WIDE_OK: + SKIPPED_BENCHMARKS.add("bench_tensor_map_encode_im2col_wide") + + +def bench_tensor_map_encode_tiled(loops: int) -> float: + _fn = cuda.cuTensorMapEncodeTiled + _dt = TILED_DTYPE + _rank = TILED_RANK + _addr = PTR + _gdim = TILED_GLOBAL_DIM + _gstr = TILED_GLOBAL_STRIDES + _bdim = TILED_BOX_DIM + _estr = TILED_ELEMENT_STRIDES + _inter = TILED_INTERLEAVE + _swz = TILED_SWIZZLE + _l2 = TILED_L2 + _oob = TILED_OOB + + t0 = time.perf_counter() + for _ in range(loops): + _fn(_dt, _rank, _addr, _gdim, _gstr, _bdim, _estr, _inter, _swz, _l2, _oob) + return time.perf_counter() - t0 + + +def bench_tensor_map_encode_im2col(loops: int) -> float: + _fn = cuda.cuTensorMapEncodeIm2col + _dt = IM2COL_DTYPE + _rank = IM2COL_RANK + _addr = PTR + _gdim = IM2COL_GLOBAL_DIM + _gstr = IM2COL_GLOBAL_STRIDES + _lower = IM2COL_PIXEL_BOX_LOWER + _upper = IM2COL_PIXEL_BOX_UPPER + _ch = IM2COL_CHANNELS + _px = IM2COL_PIXELS + _estr = IM2COL_ELEMENT_STRIDES + _inter = IM2COL_INTERLEAVE + _swz = IM2COL_SWIZZLE + _l2 = IM2COL_L2 + _oob = IM2COL_OOB + + t0 = time.perf_counter() + for _ in range(loops): + _fn(_dt, _rank, _addr, _gdim, _gstr, _lower, _upper, _ch, _px, _estr, _inter, _swz, _l2, _oob) + return time.perf_counter() - t0 + + +def bench_tensor_map_encode_im2col_wide(loops: int) -> float: + _fn = _ENCODE_IM2COL_WIDE + _dt = IM2COL_DTYPE + _rank = IM2COL_RANK + _addr = PTR + _gdim = IM2COL_GLOBAL_DIM + _gstr = IM2COL_GLOBAL_STRIDES + _lower_w = 0 + _upper_w = 0 + _ch = IM2COL_CHANNELS + _px = IM2COL_PIXELS + _estr = IM2COL_ELEMENT_STRIDES + _inter = IM2COL_INTERLEAVE + _mode = _IM2COL_WIDE_MODE_W + _swz = _IM2COL_WIDE_SWIZZLE + _l2 = IM2COL_L2 + _oob = IM2COL_OOB + + t0 = time.perf_counter() + for _ in range(loops): + _fn(_dt, _rank, _addr, _gdim, _gstr, _lower_w, _upper_w, _ch, _px, _estr, _inter, _mode, _swz, _l2, _oob) + return time.perf_counter() - t0 diff --git a/benchmarks/cuda_bindings/benchmarks/cpp/CMakeLists.txt b/benchmarks/cuda_bindings/benchmarks/cpp/CMakeLists.txt new file mode 100644 index 00000000000..9811ec1f099 --- /dev/null +++ b/benchmarks/cuda_bindings/benchmarks/cpp/CMakeLists.txt @@ -0,0 +1,95 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.24) +project(cuda_bindings_cpp_benchmarks LANGUAGES CXX) + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + +set(CUDA_HOME_HINT "$ENV{CUDA_HOME}") +set(CONDA_PREFIX_HINT "$ENV{CONDA_PREFIX}") + +# Find cuda.h (driver API header) +find_path( + CUDA_DRIVER_INCLUDE_DIR + cuda.h + HINTS + "${CUDA_HOME_HINT}/include" + "${CONDA_PREFIX_HINT}/targets/x86_64-linux/include" + "${CONDA_PREFIX_HINT}/include" +) + +# Find libcuda (driver API library) — lives on the system, not in toolkit +find_library( + CUDA_DRIVER_LIBRARY + NAMES cuda + HINTS + "/usr/lib/x86_64-linux-gnu" + "/usr/lib64" + "${CUDA_HOME_HINT}/lib64/stubs" + "${CUDA_HOME_HINT}/lib/stubs" + "${CONDA_PREFIX_HINT}/targets/x86_64-linux/lib/stubs" + "${CONDA_PREFIX_HINT}/lib/stubs" +) + +# Find nvrtc.h and libnvrtc (for runtime compilation benchmarks) +find_path( + NVRTC_INCLUDE_DIR + nvrtc.h + HINTS + "${CUDA_HOME_HINT}/include" + "${CONDA_PREFIX_HINT}/targets/x86_64-linux/include" + "${CONDA_PREFIX_HINT}/include" +) + +find_library( + NVRTC_LIBRARY + NAMES nvrtc + HINTS + "${CUDA_HOME_HINT}/lib64" + "${CUDA_HOME_HINT}/lib" + "${CONDA_PREFIX_HINT}/targets/x86_64-linux/lib" + "${CONDA_PREFIX_HINT}/lib" +) + +if(NOT CUDA_DRIVER_INCLUDE_DIR) + message(FATAL_ERROR "Could not find cuda.h. Ensure CUDA_HOME is set or install cuda-crt-dev.") +endif() + +if(NOT CUDA_DRIVER_LIBRARY) + message(FATAL_ERROR "Could not find libcuda. Ensure the NVIDIA driver is installed.") +endif() + +# Helper: add a benchmark that only needs the driver API +function(add_driver_benchmark name) + add_executable(${name}_cpp ${name}.cpp) + target_include_directories(${name}_cpp PRIVATE "${CUDA_DRIVER_INCLUDE_DIR}") + target_link_libraries(${name}_cpp PRIVATE "${CUDA_DRIVER_LIBRARY}") +endfunction() + +# Helper: add a benchmark that needs driver API + NVRTC +function(add_nvrtc_benchmark name) + add_executable(${name}_cpp ${name}.cpp) + target_include_directories(${name}_cpp PRIVATE "${CUDA_DRIVER_INCLUDE_DIR}" "${NVRTC_INCLUDE_DIR}") + target_link_libraries(${name}_cpp PRIVATE "${CUDA_DRIVER_LIBRARY}" "${NVRTC_LIBRARY}") +endfunction() + +# Driver-only benchmarks +add_driver_benchmark(bench_pointer_attributes) +add_driver_benchmark(bench_ctx_device) +add_driver_benchmark(bench_stream) +add_driver_benchmark(bench_event) +add_driver_benchmark(bench_memory) +add_driver_benchmark(bench_tensormap) + +# NVRTC benchmarks (require nvrtc for kernel compilation) +if(NVRTC_INCLUDE_DIR AND NVRTC_LIBRARY) + add_nvrtc_benchmark(bench_launch) + add_nvrtc_benchmark(bench_module) + add_nvrtc_benchmark(bench_nvrtc) +else() + message(WARNING "NVRTC not found — skipping bench_launch, bench_module, bench_nvrtc. Install cuda-nvrtc-dev.") +endif() diff --git a/benchmarks/cuda_bindings/benchmarks/cpp/bench_ctx_device.cpp b/benchmarks/cuda_bindings/benchmarks/cpp/bench_ctx_device.cpp new file mode 100644 index 00000000000..29358867186 --- /dev/null +++ b/benchmarks/cuda_bindings/benchmarks/cpp/bench_ctx_device.cpp @@ -0,0 +1,106 @@ +// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +#include + +#include "bench_support.hpp" + +#include +#include + + +static void check_cu(CUresult status, const char* message) { + if (status != CUDA_SUCCESS) { + const char* error_name = nullptr; + cuGetErrorName(status, &error_name); + std::cerr << message << ": " << (error_name ? error_name : "unknown") << '\n'; + std::exit(1); + } +} + + +int main(int argc, char** argv) { + bench::Options options = bench::parse_args(argc, argv); + + // Setup: init CUDA and create a context + check_cu(cuInit(0), "cuInit failed"); + + CUdevice device; + check_cu(cuDeviceGet(&device, 0), "cuDeviceGet failed"); + + CUcontext ctx; + CUctxCreateParams ctxParams = {}; + check_cu(cuCtxCreate(&ctx, &ctxParams, 0, device), "cuCtxCreate failed"); + + bench::BenchmarkSuite suite(options); + + // --- ctx_get_current --- + { + CUcontext current_ctx = nullptr; + suite.run("ctx_device.ctx_get_current", [&]() { + check_cu(cuCtxGetCurrent(¤t_ctx), "cuCtxGetCurrent failed"); + }); + } + + // --- ctx_set_current --- + { + suite.run("ctx_device.ctx_set_current", [&]() { + check_cu(cuCtxSetCurrent(ctx), "cuCtxSetCurrent failed"); + }); + } + + // --- ctx_get_device --- + { + CUdevice dev; + suite.run("ctx_device.ctx_get_device", [&]() { + check_cu(cuCtxGetDevice(&dev), "cuCtxGetDevice failed"); + }); + } + + // --- device_get --- + { + CUdevice dev; + suite.run("ctx_device.device_get", [&]() { + check_cu(cuDeviceGet(&dev, 0), "cuDeviceGet failed"); + }); + } + + // --- device_get_attribute --- + { + int value = 0; + suite.run("ctx_device.device_get_attribute", [&]() { + check_cu( + cuDeviceGetAttribute(&value, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR, device), + "cuDeviceGetAttribute failed" + ); + }); + } + + // --- device_primary_ctx_retain --- + // Outer retain so the benchmarked retain/release pair just bumps the refcount. + CUcontext primary_outer = nullptr; + check_cu( + cuDevicePrimaryCtxRetain(&primary_outer, device), + "cuDevicePrimaryCtxRetain (setup) failed" + ); + { + CUcontext primary = nullptr; + suite.run("ctx_device.device_primary_ctx_retain", [&]() { + check_cu(cuDevicePrimaryCtxRetain(&primary, device), "cuDevicePrimaryCtxRetain failed"); + check_cu(cuDevicePrimaryCtxRelease(device), "cuDevicePrimaryCtxRelease failed"); + }); + } + check_cu( + cuDevicePrimaryCtxRelease(device), + "cuDevicePrimaryCtxRelease (teardown) failed" + ); + + // Cleanup + check_cu(cuCtxDestroy(ctx), "cuCtxDestroy failed"); + + // Write all results + suite.write(); + + return 0; +} diff --git a/benchmarks/cuda_bindings/benchmarks/cpp/bench_event.cpp b/benchmarks/cuda_bindings/benchmarks/cpp/bench_event.cpp new file mode 100644 index 00000000000..c24aa983199 --- /dev/null +++ b/benchmarks/cuda_bindings/benchmarks/cpp/bench_event.cpp @@ -0,0 +1,95 @@ +// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +#include + +#include "bench_support.hpp" + +#include +#include + + +static void check_cu(CUresult status, const char* message) { + if (status != CUDA_SUCCESS) { + const char* error_name = nullptr; + cuGetErrorName(status, &error_name); + std::cerr << message << ": " << (error_name ? error_name : "unknown") << '\n'; + std::exit(1); + } +} + + +int main(int argc, char** argv) { + bench::Options options = bench::parse_args(argc, argv); + + // Setup + check_cu(cuInit(0), "cuInit failed"); + + CUdevice device; + check_cu(cuDeviceGet(&device, 0), "cuDeviceGet failed"); + + CUcontext ctx; + CUctxCreateParams ctxParams = {}; + check_cu(cuCtxCreate(&ctx, &ctxParams, 0, device), "cuCtxCreate failed"); + + CUstream stream; + check_cu(cuStreamCreate(&stream, CU_STREAM_NON_BLOCKING), "cuStreamCreate failed"); + + // Persistent event for query/synchronize/record benchmarks + CUevent event; + check_cu(cuEventCreate(&event, CU_EVENT_DISABLE_TIMING), "cuEventCreate failed"); + + // Record and sync so the event starts in a completed state + check_cu(cuEventRecord(event, stream), "cuEventRecord failed"); + check_cu(cuStreamSynchronize(stream), "cuStreamSynchronize failed"); + + bench::BenchmarkSuite suite(options); + // Drain the persistent stream after calibration so event_record (which + // enqueues onto the stream) and event_synchronize start from a known state. + suite.set_post_calibrate([&]() { + check_cu(cuStreamSynchronize(stream), "post-calibrate sync failed"); + }); + + // --- event_create_destroy --- + { + CUevent e; + suite.run("event.event_create_destroy", [&]() { + check_cu(cuEventCreate(&e, CU_EVENT_DISABLE_TIMING), "cuEventCreate failed"); + check_cu(cuEventDestroy(e), "cuEventDestroy failed"); + }); + } + + // --- event_record --- + { + suite.run("event.event_record", [&]() { + check_cu(cuEventRecord(event, stream), "cuEventRecord failed"); + }); + } + + // Re-sync so event is in a known completed state after the record benchmark + check_cu(cuStreamSynchronize(stream), "cuStreamSynchronize failed"); + + { + suite.run("event.event_query", [&]() { + // Returns CUDA_SUCCESS if complete, CUDA_ERROR_NOT_READY if not + cuEventQuery(event); + }); + } + + // --- event_synchronize --- + { + suite.run("event.event_synchronize", [&]() { + check_cu(cuEventSynchronize(event), "cuEventSynchronize failed"); + }); + } + + // Cleanup + check_cu(cuEventDestroy(event), "cuEventDestroy failed"); + check_cu(cuStreamDestroy(stream), "cuStreamDestroy failed"); + check_cu(cuCtxDestroy(ctx), "cuCtxDestroy failed"); + + suite.write(); + + return 0; +} diff --git a/benchmarks/cuda_bindings/benchmarks/cpp/bench_launch.cpp b/benchmarks/cuda_bindings/benchmarks/cpp/bench_launch.cpp new file mode 100644 index 00000000000..4897859a61a --- /dev/null +++ b/benchmarks/cuda_bindings/benchmarks/cpp/bench_launch.cpp @@ -0,0 +1,341 @@ +// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +#include +#include + +#include "bench_support.hpp" + +#include +#include +#include +#include +#include +#include + + +static void check_cu(CUresult status, const char* message) { + if (status != CUDA_SUCCESS) { + const char* error_name = nullptr; + cuGetErrorName(status, &error_name); + std::cerr << message << ": " << (error_name ? error_name : "unknown") << '\n'; + std::exit(1); + } +} + +static void check_nvrtc(nvrtcResult status, const char* message) { + if (status != NVRTC_SUCCESS) { + std::cerr << message << ": " << nvrtcGetErrorString(status) << '\n'; + std::exit(1); + } +} + +static CUmodule compile_and_load(const char* source, CUdevice device) { + int major = 0, minor = 0; + check_cu(cuDeviceGetAttribute(&major, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR, device), + "cuDeviceGetAttribute failed"); + check_cu(cuDeviceGetAttribute(&minor, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR, device), + "cuDeviceGetAttribute failed"); + + nvrtcProgram prog; + check_nvrtc(nvrtcCreateProgram(&prog, source, "benchmark_kernel.cu", 0, nullptr, nullptr), + "nvrtcCreateProgram failed"); + + std::string arch = "--gpu-architecture=sm_" + std::to_string(major) + std::to_string(minor); + const char* opts[] = {"--fmad=false", arch.c_str()}; + nvrtcResult compile_result = nvrtcCompileProgram(prog, 2, opts); + + if (compile_result != NVRTC_SUCCESS) { + size_t log_size = 0; + nvrtcGetProgramLogSize(prog, &log_size); + std::vector log(log_size); + nvrtcGetProgramLog(prog, log.data()); + std::cerr << "NVRTC compile failed:\n" << log.data() << '\n'; + std::exit(1); + } + + size_t cubin_size = 0; + check_nvrtc(nvrtcGetCUBINSize(prog, &cubin_size), "nvrtcGetCUBINSize failed"); + std::vector cubin(cubin_size); + check_nvrtc(nvrtcGetCUBIN(prog, cubin.data()), "nvrtcGetCUBIN failed"); + nvrtcDestroyProgram(&prog); + + CUmodule module; + check_cu(cuModuleLoadData(&module, cubin.data()), "cuModuleLoadData failed"); + return module; +} + + +static const char* KERNEL_SOURCE = R"( +extern "C" __global__ void empty_kernel() { return; } +extern "C" __global__ void small_kernel(float *f) { *f = 0.0f; } + +#define ITEM_PARAM(x, T) T x +#define REP1(x, T) , ITEM_PARAM(x, T) +#define REP2(x, T) REP1(x##0, T) REP1(x##1, T) +#define REP4(x, T) REP2(x##0, T) REP2(x##1, T) +#define REP8(x, T) REP4(x##0, T) REP4(x##1, T) +#define REP16(x, T) REP8(x##0, T) REP8(x##1, T) +#define REP32(x, T) REP16(x##0, T) REP16(x##1, T) +#define REP64(x, T) REP32(x##0, T) REP32(x##1, T) +#define REP128(x, T) REP64(x##0, T) REP64(x##1, T) +#define REP256(x, T) REP128(x##0, T) REP128(x##1, T) + +template +struct KernelFunctionParam { + unsigned char p[maxBytes]; +}; + +extern "C" __global__ +void small_kernel_16_args( + ITEM_PARAM(F, int*) + REP1(A, int*) REP2(A, int*) REP4(A, int*) REP8(A, int*)) +{ *F = 0; } + +extern "C" __global__ +void small_kernel_256_args( + ITEM_PARAM(F, int*) + REP1(A, int*) REP2(A, int*) REP4(A, int*) REP8(A, int*) + REP16(A, int*) REP32(A, int*) REP64(A, int*) REP128(A, int*)) +{ *F = 0; } + +extern "C" __global__ +void small_kernel_512_args( + ITEM_PARAM(F, int*) + REP1(A, int*) REP2(A, int*) REP4(A, int*) REP8(A, int*) + REP16(A, int*) REP32(A, int*) REP64(A, int*) REP128(A, int*) + REP256(A, int*)) +{ *F = 0; } + +extern "C" __global__ +void small_kernel_512_bools( + ITEM_PARAM(F, bool) + REP1(A, bool) REP2(A, bool) REP4(A, bool) REP8(A, bool) + REP16(A, bool) REP32(A, bool) REP64(A, bool) REP128(A, bool) + REP256(A, bool)) +{ return; } + +extern "C" __global__ +void small_kernel_512_ints( + ITEM_PARAM(F, int) + REP1(A, int) REP2(A, int) REP4(A, int) REP8(A, int) + REP16(A, int) REP32(A, int) REP64(A, int) REP128(A, int) + REP256(A, int)) +{ return; } + +extern "C" __global__ +void small_kernel_512_doubles( + ITEM_PARAM(F, double) + REP1(A, double) REP2(A, double) REP4(A, double) REP8(A, double) + REP16(A, double) REP32(A, double) REP64(A, double) REP128(A, double) + REP256(A, double)) +{ return; } + +extern "C" __global__ +void small_kernel_512_chars( + ITEM_PARAM(F, char) + REP1(A, char) REP2(A, char) REP4(A, char) REP8(A, char) + REP16(A, char) REP32(A, char) REP64(A, char) REP128(A, char) + REP256(A, char)) +{ return; } + +extern "C" __global__ +void small_kernel_512_longlongs( + ITEM_PARAM(F, long long) + REP1(A, long long) REP2(A, long long) REP4(A, long long) REP8(A, long long) + REP16(A, long long) REP32(A, long long) REP64(A, long long) REP128(A, long long) + REP256(A, long long)) +{ return; } + +extern "C" __global__ +void small_kernel_2048B(KernelFunctionParam<2048> param) {} +)"; + + +int main(int argc, char** argv) { + bench::Options options = bench::parse_args(argc, argv); + + // Setup + check_cu(cuInit(0), "cuInit failed"); + + CUdevice device; + check_cu(cuDeviceGet(&device, 0), "cuDeviceGet failed"); + + CUcontext ctx; + CUctxCreateParams ctxParams = {}; + check_cu(cuCtxCreate(&ctx, &ctxParams, 0, device), "cuCtxCreate failed"); + + CUmodule module = compile_and_load(KERNEL_SOURCE, device); + + // Get all kernel handles + auto get_func = [&](const char* name) { + CUfunction f; + check_cu(cuModuleGetFunction(&f, module, name), "GetFunction failed"); + return f; + }; + + CUfunction empty_kernel = get_func("empty_kernel"); + CUfunction small_kernel = get_func("small_kernel"); + CUfunction kernel_16_args = get_func("small_kernel_16_args"); + CUfunction kernel_256_args = get_func("small_kernel_256_args"); + CUfunction kernel_512_args = get_func("small_kernel_512_args"); + CUfunction kernel_512_bools = get_func("small_kernel_512_bools"); + CUfunction kernel_512_ints = get_func("small_kernel_512_ints"); + CUfunction kernel_512_doubles = get_func("small_kernel_512_doubles"); + CUfunction kernel_512_chars = get_func("small_kernel_512_chars"); + CUfunction kernel_512_longlongs = get_func("small_kernel_512_longlongs"); + CUfunction kernel_2048B = get_func("small_kernel_2048B"); + + CUstream stream; + check_cu(cuStreamCreate(&stream, CU_STREAM_NON_BLOCKING), "cuStreamCreate failed"); + + // Allocate device memory + CUdeviceptr float_ptr; + check_cu(cuMemAlloc(&float_ptr, sizeof(float)), "cuMemAlloc failed"); + + CUdeviceptr int_ptrs[512]; + for (int i = 0; i < 512; ++i) { + check_cu(cuMemAlloc(&int_ptrs[i], sizeof(int)), "cuMemAlloc failed"); + } + + // Pre-pack pointer params + void* packed_16[16]; + for (int i = 0; i < 16; ++i) + packed_16[i] = &int_ptrs[i]; + + void* packed_256[256]; + for (int i = 0; i < 256; ++i) + packed_256[i] = &int_ptrs[i]; + + void* packed_512[512]; + for (int i = 0; i < 512; ++i) + packed_512[i] = &int_ptrs[i]; + + // Typed args for 512-arg benchmarks + bool bool_args[512]; + void* bool_params[512]; + for (int i = 0; i < 512; ++i) { bool_args[i] = true; bool_params[i] = &bool_args[i]; } + + int int_args[512]; + void* int_params[512]; + for (int i = 0; i < 512; ++i) { int_args[i] = 123; int_params[i] = &int_args[i]; } + + double double_args[512]; + void* double_params[512]; + for (int i = 0; i < 512; ++i) { double_args[i] = 1.2345; double_params[i] = &double_args[i]; } + + char char_args[512]; + void* char_params[512]; + for (int i = 0; i < 512; ++i) { char_args[i] = 127; char_params[i] = &char_args[i]; } + + long long ll_args[512]; + void* ll_params[512]; + for (int i = 0; i < 512; ++i) { ll_args[i] = 9223372036854775806LL; ll_params[i] = &ll_args[i]; } + + // 2048-byte struct + struct alignas(8) Struct2048B { unsigned char p[2048]; } struct_2048B = {}; + void* struct_params[] = {&struct_2048B}; + + bench::BenchmarkSuite suite(options); + // After calibration, drain the persistent stream so the first measured + // sample does not start on a backlogged stream. Calibration for enqueue- + // style ops (kernel launches) may queue many thousands of operations. + suite.set_post_calibrate([&]() { + check_cu(cuStreamSynchronize(stream), "post-calibrate sync failed"); + }); + + suite.run("launch.launch_empty_kernel", [&]() { + check_cu(cuLaunchKernel(empty_kernel, 1, 1, 1, 1, 1, 1, 0, stream, nullptr, nullptr), + "cuLaunchKernel failed"); + }); + check_cu(cuStreamSynchronize(stream), "sync"); + + { + void* params[] = {&float_ptr}; + suite.run("launch.launch_small_kernel", [&]() { + check_cu(cuLaunchKernel(small_kernel, 1, 1, 1, 1, 1, 1, 0, stream, params, nullptr), + "cuLaunchKernel failed"); + }); + } + check_cu(cuStreamSynchronize(stream), "sync"); + + suite.run("launch.launch_16_args", [&]() { + check_cu(cuLaunchKernel(kernel_16_args, 1, 1, 1, 1, 1, 1, 0, stream, packed_16, nullptr), + "cuLaunchKernel failed"); + }); + check_cu(cuStreamSynchronize(stream), "sync"); + + suite.run("launch.launch_16_args_pre_packed", [&]() { + check_cu(cuLaunchKernel(kernel_16_args, 1, 1, 1, 1, 1, 1, 0, stream, packed_16, nullptr), + "cuLaunchKernel failed"); + }); + check_cu(cuStreamSynchronize(stream), "sync"); + + suite.run("launch.launch_256_args", [&]() { + check_cu(cuLaunchKernel(kernel_256_args, 1, 1, 1, 1, 1, 1, 0, stream, packed_256, nullptr), + "cuLaunchKernel failed"); + }); + check_cu(cuStreamSynchronize(stream), "sync"); + + suite.run("launch.launch_512_args", [&]() { + check_cu(cuLaunchKernel(kernel_512_args, 1, 1, 1, 1, 1, 1, 0, stream, packed_512, nullptr), + "cuLaunchKernel failed"); + }); + check_cu(cuStreamSynchronize(stream), "sync"); + + suite.run("launch.launch_512_args_pre_packed", [&]() { + check_cu(cuLaunchKernel(kernel_512_args, 1, 1, 1, 1, 1, 1, 0, stream, packed_512, nullptr), + "cuLaunchKernel failed"); + }); + check_cu(cuStreamSynchronize(stream), "sync"); + + suite.run("launch.launch_512_bools", [&]() { + check_cu(cuLaunchKernel(kernel_512_bools, 1, 1, 1, 1, 1, 1, 0, stream, bool_params, nullptr), + "cuLaunchKernel failed"); + }); + check_cu(cuStreamSynchronize(stream), "sync"); + + suite.run("launch.launch_512_ints", [&]() { + check_cu(cuLaunchKernel(kernel_512_ints, 1, 1, 1, 1, 1, 1, 0, stream, int_params, nullptr), + "cuLaunchKernel failed"); + }); + check_cu(cuStreamSynchronize(stream), "sync"); + + suite.run("launch.launch_512_doubles", [&]() { + check_cu(cuLaunchKernel(kernel_512_doubles, 1, 1, 1, 1, 1, 1, 0, stream, double_params, nullptr), + "cuLaunchKernel failed"); + }); + check_cu(cuStreamSynchronize(stream), "sync"); + + suite.run("launch.launch_512_bytes", [&]() { + check_cu(cuLaunchKernel(kernel_512_chars, 1, 1, 1, 1, 1, 1, 0, stream, char_params, nullptr), + "cuLaunchKernel failed"); + }); + check_cu(cuStreamSynchronize(stream), "sync"); + + suite.run("launch.launch_512_longlongs", [&]() { + check_cu(cuLaunchKernel(kernel_512_longlongs, 1, 1, 1, 1, 1, 1, 0, stream, ll_params, nullptr), + "cuLaunchKernel failed"); + }); + check_cu(cuStreamSynchronize(stream), "sync"); + + suite.run("launch.launch_2048b", [&]() { + check_cu(cuLaunchKernel(kernel_2048B, 1, 1, 1, 1, 1, 1, 0, stream, struct_params, nullptr), + "cuLaunchKernel failed"); + }); + check_cu(cuStreamSynchronize(stream), "sync"); + + // Cleanup + for (int i = 0; i < 512; ++i) { + check_cu(cuMemFree(int_ptrs[i]), "cuMemFree failed"); + } + check_cu(cuMemFree(float_ptr), "cuMemFree failed"); + check_cu(cuStreamDestroy(stream), "cuStreamDestroy failed"); + check_cu(cuModuleUnload(module), "cuModuleUnload failed"); + check_cu(cuCtxDestroy(ctx), "cuCtxDestroy failed"); + + suite.write(); + + return 0; +} diff --git a/benchmarks/cuda_bindings/benchmarks/cpp/bench_memory.cpp b/benchmarks/cuda_bindings/benchmarks/cpp/bench_memory.cpp new file mode 100644 index 00000000000..803363be480 --- /dev/null +++ b/benchmarks/cuda_bindings/benchmarks/cpp/bench_memory.cpp @@ -0,0 +1,111 @@ +// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +#include + +#include "bench_support.hpp" + +#include +#include +#include +#include + + +static void check_cu(CUresult status, const char* message) { + if (status != CUDA_SUCCESS) { + const char* error_name = nullptr; + cuGetErrorName(status, &error_name); + std::cerr << message << ": " << (error_name ? error_name : "unknown") << '\n'; + std::exit(1); + } +} + + +static constexpr size_t ALLOC_SIZE = 1024; +static constexpr size_t COPY_SIZE = 8; + + +int main(int argc, char** argv) { + bench::Options options = bench::parse_args(argc, argv); + + // Setup + check_cu(cuInit(0), "cuInit failed"); + + CUdevice device; + check_cu(cuDeviceGet(&device, 0), "cuDeviceGet failed"); + + CUcontext ctx; + CUctxCreateParams ctxParams = {}; + check_cu(cuCtxCreate(&ctx, &ctxParams, 0, device), "cuCtxCreate failed"); + + CUstream stream; + check_cu(cuStreamCreate(&stream, CU_STREAM_NON_BLOCKING), "cuStreamCreate failed"); + + // Pre-allocate device memory for memcpy benchmarks + CUdeviceptr dst_dptr, src_dptr; + check_cu(cuMemAlloc(&dst_dptr, COPY_SIZE), "cuMemAlloc failed"); + check_cu(cuMemAlloc(&src_dptr, COPY_SIZE), "cuMemAlloc failed"); + + // Host buffers for memcpy + uint8_t host_src[COPY_SIZE] = {}; + uint8_t host_dst[COPY_SIZE] = {}; + + bench::BenchmarkSuite suite(options); + // Drain the persistent stream after calibration so async benchmarks + // (mem_alloc_async_free_async) don't start measurement on a backlogged stream. + suite.set_post_calibrate([&]() { + check_cu(cuStreamSynchronize(stream), "post-calibrate sync failed"); + }); + + // --- mem_alloc_free --- + { + CUdeviceptr ptr; + suite.run("memory.mem_alloc_free", [&]() { + check_cu(cuMemAlloc(&ptr, ALLOC_SIZE), "cuMemAlloc failed"); + check_cu(cuMemFree(ptr), "cuMemFree failed"); + }); + } + + // --- mem_alloc_async_free_async --- + { + CUdeviceptr ptr; + suite.run("memory.mem_alloc_async_free_async", [&]() { + check_cu(cuMemAllocAsync(&ptr, ALLOC_SIZE, stream), "cuMemAllocAsync failed"); + check_cu(cuMemFreeAsync(ptr, stream), "cuMemFreeAsync failed"); + }); + } + + check_cu(cuStreamSynchronize(stream), "cuStreamSynchronize failed"); + + // --- memcpy_htod --- + { + suite.run("memory.memcpy_htod", [&]() { + check_cu(cuMemcpyHtoD(dst_dptr, host_src, COPY_SIZE), "cuMemcpyHtoD failed"); + }); + } + + // --- memcpy_dtoh --- + { + suite.run("memory.memcpy_dtoh", [&]() { + check_cu(cuMemcpyDtoH(host_dst, src_dptr, COPY_SIZE), "cuMemcpyDtoH failed"); + }); + } + + // --- memcpy_dtod --- + { + suite.run("memory.memcpy_dtod", [&]() { + check_cu(cuMemcpyDtoD(dst_dptr, src_dptr, COPY_SIZE), "cuMemcpyDtoD failed"); + }); + } + + // Cleanup + check_cu(cuMemFree(dst_dptr), "cuMemFree failed"); + check_cu(cuMemFree(src_dptr), "cuMemFree failed"); + check_cu(cuStreamDestroy(stream), "cuStreamDestroy failed"); + check_cu(cuCtxDestroy(ctx), "cuCtxDestroy failed"); + + suite.write(); + + return 0; +} diff --git a/benchmarks/cuda_bindings/benchmarks/cpp/bench_module.cpp b/benchmarks/cuda_bindings/benchmarks/cpp/bench_module.cpp new file mode 100644 index 00000000000..802025a6506 --- /dev/null +++ b/benchmarks/cuda_bindings/benchmarks/cpp/bench_module.cpp @@ -0,0 +1,130 @@ +// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +#include +#include + +#include "bench_support.hpp" + +#include +#include +#include +#include + + +static void check_cu(CUresult status, const char* message) { + if (status != CUDA_SUCCESS) { + const char* error_name = nullptr; + cuGetErrorName(status, &error_name); + std::cerr << message << ": " << (error_name ? error_name : "unknown") << '\n'; + std::exit(1); + } +} + +static void check_nvrtc(nvrtcResult status, const char* message) { + if (status != NVRTC_SUCCESS) { + std::cerr << message << ": " << nvrtcGetErrorString(status) << '\n'; + std::exit(1); + } +} + +static std::vector compile_cubin(const char* source, CUdevice device) { + int major = 0, minor = 0; + check_cu(cuDeviceGetAttribute(&major, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR, device), + "cuDeviceGetAttribute failed"); + check_cu(cuDeviceGetAttribute(&minor, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR, device), + "cuDeviceGetAttribute failed"); + + nvrtcProgram prog; + check_nvrtc(nvrtcCreateProgram(&prog, source, "benchmark_kernel.cu", 0, nullptr, nullptr), + "nvrtcCreateProgram failed"); + + std::string arch = "--gpu-architecture=sm_" + std::to_string(major) + std::to_string(minor); + const char* opts[] = {"--fmad=false", arch.c_str()}; + nvrtcResult compile_result = nvrtcCompileProgram(prog, 2, opts); + + if (compile_result != NVRTC_SUCCESS) { + size_t log_size = 0; + nvrtcGetProgramLogSize(prog, &log_size); + std::vector log(log_size); + nvrtcGetProgramLog(prog, log.data()); + std::cerr << "NVRTC compile failed:\n" << log.data() << '\n'; + std::exit(1); + } + + size_t cubin_size = 0; + check_nvrtc(nvrtcGetCUBINSize(prog, &cubin_size), "nvrtcGetCUBINSize failed"); + std::vector cubin(cubin_size); + check_nvrtc(nvrtcGetCUBIN(prog, cubin.data()), "nvrtcGetCUBIN failed"); + nvrtcDestroyProgram(&prog); + + return cubin; +} + + +static const char* KERNEL_SOURCE = R"( +extern "C" __global__ void empty_kernel() { return; } +)"; + + +int main(int argc, char** argv) { + bench::Options options = bench::parse_args(argc, argv); + + // Setup + check_cu(cuInit(0), "cuInit failed"); + + CUdevice device; + check_cu(cuDeviceGet(&device, 0), "cuDeviceGet failed"); + + CUcontext ctx; + CUctxCreateParams ctxParams = {}; + check_cu(cuCtxCreate(&ctx, &ctxParams, 0, device), "cuCtxCreate failed"); + + std::vector cubin = compile_cubin(KERNEL_SOURCE, device); + + // Load a persistent module + function for get_function / get_attribute benchmarks + CUmodule persistent_module; + check_cu(cuModuleLoadData(&persistent_module, cubin.data()), "cuModuleLoadData failed"); + + CUfunction function; + check_cu(cuModuleGetFunction(&function, persistent_module, "empty_kernel"), + "cuModuleGetFunction failed"); + + bench::BenchmarkSuite suite(options); + + // --- module_load_unload --- + { + CUmodule m; + suite.run("module.module_load_unload", [&]() { + check_cu(cuModuleLoadData(&m, cubin.data()), "cuModuleLoadData failed"); + check_cu(cuModuleUnload(m), "cuModuleUnload failed"); + }); + } + + // --- module_get_function --- + { + CUfunction f; + suite.run("module.module_get_function", [&]() { + check_cu(cuModuleGetFunction(&f, persistent_module, "empty_kernel"), + "cuModuleGetFunction failed"); + }); + } + + // --- func_get_attribute --- + { + int value = 0; + suite.run("module.func_get_attribute", [&]() { + check_cu(cuFuncGetAttribute(&value, CU_FUNC_ATTRIBUTE_MAX_THREADS_PER_BLOCK, function), + "cuFuncGetAttribute failed"); + }); + } + + // Cleanup + check_cu(cuModuleUnload(persistent_module), "cuModuleUnload failed"); + check_cu(cuCtxDestroy(ctx), "cuCtxDestroy failed"); + + suite.write(); + + return 0; +} diff --git a/benchmarks/cuda_bindings/benchmarks/cpp/bench_nvrtc.cpp b/benchmarks/cuda_bindings/benchmarks/cpp/bench_nvrtc.cpp new file mode 100644 index 00000000000..842b7353cf4 --- /dev/null +++ b/benchmarks/cuda_bindings/benchmarks/cpp/bench_nvrtc.cpp @@ -0,0 +1,115 @@ +// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +#include +#include + +#include "bench_support.hpp" + +#include +#include +#include +#include + + +static void check_cu(CUresult status, const char* message) { + if (status != CUDA_SUCCESS) { + const char* error_name = nullptr; + cuGetErrorName(status, &error_name); + std::cerr << message << ": " << (error_name ? error_name : "unknown") << '\n'; + std::exit(1); + } +} + +static void check_nvrtc(nvrtcResult status, const char* message) { + if (status != NVRTC_SUCCESS) { + std::cerr << message << ": " << nvrtcGetErrorString(status) << '\n'; + std::exit(1); + } +} + + +static const char* KERNEL_SOURCE = R"(extern "C" __global__ void empty_kernel() { return; })"; +static const char* PROGRAM_NAME = "benchmark_kernel.cu"; + +static constexpr int NUM_HEADERS = 100; + + +int main(int argc, char** argv) { + bench::Options options = bench::parse_args(argc, argv); + + // Setup: need CUDA init to query compute capability for compile options + check_cu(cuInit(0), "cuInit failed"); + + CUdevice device; + check_cu(cuDeviceGet(&device, 0), "cuDeviceGet failed"); + + int major = 0, minor = 0; + check_cu(cuDeviceGetAttribute(&major, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR, device), + "cuDeviceGetAttribute failed"); + check_cu(cuDeviceGetAttribute(&minor, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR, device), + "cuDeviceGetAttribute failed"); + + std::string arch = "--gpu-architecture=sm_" + std::to_string(major) + std::to_string(minor); + const char* compile_opts[] = {"--fmad=false", arch.c_str()}; + + // Pre-build 100 empty headers + std::vector header_name_strs(NUM_HEADERS); + std::vector header_names(NUM_HEADERS); + std::vector header_sources(NUM_HEADERS); + static const char* empty_header = "// empty"; + for (int i = 0; i < NUM_HEADERS; ++i) { + header_name_strs[i] = "header_" + std::to_string(i) + ".cuh"; + header_names[i] = header_name_strs[i].c_str(); + header_sources[i] = empty_header; + } + + bench::BenchmarkSuite suite(options); + + // --- nvrtc_create_program (no headers) --- + { + nvrtcProgram prog; + suite.run("nvrtc.nvrtc_create_program", [&]() { + check_nvrtc( + nvrtcCreateProgram(&prog, KERNEL_SOURCE, PROGRAM_NAME, 0, nullptr, nullptr), + "nvrtcCreateProgram failed" + ); + check_nvrtc(nvrtcDestroyProgram(&prog), "nvrtcDestroyProgram failed"); + }); + } + + // --- nvrtc_create_program_100_headers --- + { + nvrtcProgram prog; + suite.run("nvrtc.nvrtc_create_program_100_headers", [&]() { + check_nvrtc( + nvrtcCreateProgram(&prog, KERNEL_SOURCE, PROGRAM_NAME, + NUM_HEADERS, header_sources.data(), header_names.data()), + "nvrtcCreateProgram failed" + ); + check_nvrtc(nvrtcDestroyProgram(&prog), "nvrtcDestroyProgram failed"); + }); + } + + // --- nvrtc_compile_program --- + { + nvrtcProgram prog; + std::uint64_t compile_loops = std::min(options.loops, static_cast(10)); + suite.run("nvrtc.nvrtc_compile_program", compile_loops, [&]() { + check_nvrtc( + nvrtcCreateProgram(&prog, KERNEL_SOURCE, PROGRAM_NAME, 0, nullptr, nullptr), + "nvrtcCreateProgram failed" + ); + check_nvrtc( + nvrtcCompileProgram(prog, 2, compile_opts), + "nvrtcCompileProgram failed" + ); + check_nvrtc(nvrtcDestroyProgram(&prog), "nvrtcDestroyProgram failed"); + }); + } + + suite.write(); + + return 0; +} diff --git a/benchmarks/cuda_bindings/benchmarks/cpp/bench_pointer_attributes.cpp b/benchmarks/cuda_bindings/benchmarks/cpp/bench_pointer_attributes.cpp new file mode 100644 index 00000000000..6c6f42a58e1 --- /dev/null +++ b/benchmarks/cuda_bindings/benchmarks/cpp/bench_pointer_attributes.cpp @@ -0,0 +1,82 @@ +// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +#include + +#include "bench_support.hpp" + +#include +#include + + +static void check_cu(CUresult status, const char* message) { + if (status != CUDA_SUCCESS) { + const char* error_name = nullptr; + cuGetErrorName(status, &error_name); + std::cerr << message << ": " << (error_name ? error_name : "unknown") << '\n'; + std::exit(1); + } +} + + +int main(int argc, char** argv) { + bench::Options options = bench::parse_args(argc, argv); + + // Setup: init CUDA, allocate memory + check_cu(cuInit(0), "cuInit failed"); + + CUdevice device; + check_cu(cuDeviceGet(&device, 0), "cuDeviceGet failed"); + + CUcontext ctx; + CUctxCreateParams ctxParams = {}; + check_cu(cuCtxCreate(&ctx, &ctxParams, 0, device), "cuCtxCreate failed"); + + CUdeviceptr ptr; + check_cu(cuMemAlloc(&ptr, 1 << 18), "cuMemAlloc failed"); + + bench::BenchmarkSuite suite(options); + + // --- pointer_get_attribute --- + { + unsigned int memory_type = 0; + suite.run("pointer_attributes.pointer_get_attribute", [&]() { + check_cu( + cuPointerGetAttribute(&memory_type, CU_POINTER_ATTRIBUTE_MEMORY_TYPE, ptr), + "cuPointerGetAttribute failed" + ); + }); + } + + // --- pointer_get_attributes --- + { + unsigned int memory_type = 0; + CUdeviceptr dev_ptr_out = 0; + void* host_ptr_out = nullptr; + unsigned long long buffer_id = 0; + + CUpointer_attribute attrs[4] = { + CU_POINTER_ATTRIBUTE_MEMORY_TYPE, + CU_POINTER_ATTRIBUTE_DEVICE_POINTER, + CU_POINTER_ATTRIBUTE_HOST_POINTER, + CU_POINTER_ATTRIBUTE_BUFFER_ID, + }; + void* data[4] = {&memory_type, &dev_ptr_out, &host_ptr_out, &buffer_id}; + + suite.run("pointer_attributes.pointer_get_attributes", [&]() { + check_cu( + cuPointerGetAttributes(4, attrs, data, ptr), + "cuPointerGetAttributes failed" + ); + }); + } + + // Cleanup + check_cu(cuMemFree(ptr), "cuMemFree failed"); + check_cu(cuCtxDestroy(ctx), "cuCtxDestroy failed"); + + suite.write(); + + return 0; +} diff --git a/benchmarks/cuda_bindings/benchmarks/cpp/bench_stream.cpp b/benchmarks/cuda_bindings/benchmarks/cpp/bench_stream.cpp new file mode 100644 index 00000000000..95ad0790f9f --- /dev/null +++ b/benchmarks/cuda_bindings/benchmarks/cpp/bench_stream.cpp @@ -0,0 +1,80 @@ +// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +#include + +#include "bench_support.hpp" + +#include +#include + + +static void check_cu(CUresult status, const char* message) { + if (status != CUDA_SUCCESS) { + const char* error_name = nullptr; + cuGetErrorName(status, &error_name); + std::cerr << message << ": " << (error_name ? error_name : "unknown") << '\n'; + std::exit(1); + } +} + + +int main(int argc, char** argv) { + bench::Options options = bench::parse_args(argc, argv); + + // Setup + check_cu(cuInit(0), "cuInit failed"); + + CUdevice device; + check_cu(cuDeviceGet(&device, 0), "cuDeviceGet failed"); + + CUcontext ctx; + CUctxCreateParams ctxParams = {}; + check_cu(cuCtxCreate(&ctx, &ctxParams, 0, device), "cuCtxCreate failed"); + + // Persistent stream for query/synchronize benchmarks + CUstream stream; + check_cu(cuStreamCreate(&stream, CU_STREAM_NON_BLOCKING), "cuStreamCreate failed"); + + bench::BenchmarkSuite suite(options); + // Drain the persistent stream after calibration for completeness. + // stream_create_destroy uses a local stream, but stream_query/synchronize + // observe the persistent one. + suite.set_post_calibrate([&]() { + check_cu(cuStreamSynchronize(stream), "post-calibrate sync failed"); + }); + + // --- stream_create_destroy --- + { + CUstream s; + suite.run("stream.stream_create_destroy", [&]() { + check_cu(cuStreamCreate(&s, CU_STREAM_NON_BLOCKING), "cuStreamCreate failed"); + check_cu(cuStreamDestroy(s), "cuStreamDestroy failed"); + }); + } + + // --- stream_query --- + { + suite.run("stream.stream_query", [&]() { + // cuStreamQuery returns CUDA_SUCCESS if stream is idle, + // CUDA_ERROR_NOT_READY if busy — both are valid here. + cuStreamQuery(stream); + }); + } + + // --- stream_synchronize --- + { + suite.run("stream.stream_synchronize", [&]() { + check_cu(cuStreamSynchronize(stream), "cuStreamSynchronize failed"); + }); + } + + // Cleanup + check_cu(cuStreamDestroy(stream), "cuStreamDestroy failed"); + check_cu(cuCtxDestroy(ctx), "cuCtxDestroy failed"); + + suite.write(); + + return 0; +} diff --git a/benchmarks/cuda_bindings/benchmarks/cpp/bench_support.hpp b/benchmarks/cuda_bindings/benchmarks/cpp/bench_support.hpp new file mode 100644 index 00000000000..1207ee7c4dc --- /dev/null +++ b/benchmarks/cuda_bindings/benchmarks/cpp/bench_support.hpp @@ -0,0 +1,483 @@ +// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace bench { + +struct Options { + std::uint64_t loops = 1000; + std::uint64_t warmups = 5; + std::uint64_t values = 20; + std::uint64_t runs = 20; + double min_time_sec = 0.0; + // Safety cap for the calibration doubling loop. Set high enough that even + // sub-nanosecond ops can reach typical --min-time targets (e.g. 100ms). + // A warning is printed if calibration hits this cap before reaching min-time. + std::uint64_t max_loops = 100000000; + std::uint64_t calibrate_rounds = 3; + std::string output_path; + std::string benchmark_name; +}; + +// A single run result: warmup values and timed values (seconds per loop) +struct RunResult { + std::string date; + double duration_sec; + std::vector warmup_values; // seconds per loop + std::vector values; // seconds per loop +}; + +inline Options parse_args(int argc, char** argv) { + Options options; + for (int i = 1; i < argc; ++i) { + const std::string arg(argv[i]); + if (arg == "--loops" && i + 1 < argc) { + options.loops = std::strtoull(argv[++i], nullptr, 10); + continue; + } + if (arg == "--warmups" && i + 1 < argc) { + options.warmups = std::strtoull(argv[++i], nullptr, 10); + continue; + } + if (arg == "--min-time" && i + 1 < argc) { + options.min_time_sec = std::strtod(argv[++i], nullptr); + continue; + } + if (arg == "--max-loops" && i + 1 < argc) { + options.max_loops = std::strtoull(argv[++i], nullptr, 10); + continue; + } + if (arg == "--calibrate-rounds" && i + 1 < argc) { + options.calibrate_rounds = std::strtoull(argv[++i], nullptr, 10); + continue; + } + if (arg == "--values" && i + 1 < argc) { + options.values = std::strtoull(argv[++i], nullptr, 10); + continue; + } + if (arg == "--runs" && i + 1 < argc) { + options.runs = std::strtoull(argv[++i], nullptr, 10); + continue; + } + if ((arg == "-o" || arg == "--output") && i + 1 < argc) { + options.output_path = argv[++i]; + continue; + } + if (arg == "--name" && i + 1 < argc) { + options.benchmark_name = argv[++i]; + continue; + } + if (arg == "--help" || arg == "-h") { + std::cout << "Usage: benchmark [options]\n" + << " --loops N Loop iterations per value (default: 1000)\n" + << " --warmups N Warmup values per run (default: 5)\n" + << " --values N Timed values per run (default: 20)\n" + << " --runs N Number of runs (default: 20)\n" + << " --min-time S Calibrate loops to reach S seconds per value\n" + << " --max-loops N Safety cap for calibration loop count (default: 100000000)\n" + << " --calibrate-rounds N Calibration passes (default: 3)\n" + << " -o, --output F Write pyperf-compatible JSON to file\n" + << " --name S Benchmark name (overrides default)\n"; + std::exit(0); + } + + std::cerr << "Unknown argument: " << arg << '\n'; + std::exit(2); + } + return options; +} + +inline std::string iso_now() { + const auto now = std::chrono::system_clock::now(); + const std::time_t t = std::chrono::system_clock::to_time_t(now); + std::tm tm{}; +#ifdef _WIN32 + gmtime_s(&tm, &t); +#else + gmtime_r(&t, &tm); +#endif + char buf[64]; + std::strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", &tm); + return std::string(buf); +} + +// Calibrate loop count to hit a minimum wall time per value. +// Returns the chosen loop count. If `capped_out` is non-null, it is set to +// true when calibration reached `max_loops` before hitting `min_time_sec` +// (meaning --min-time was NOT actually satisfied by the calibration). +template +std::uint64_t calibrate_loops( + const Options& options, + Fn&& fn, + const std::function& post_calibrate = {}, + bool* capped_out = nullptr, + double* last_elapsed_out = nullptr +) { + if (options.min_time_sec <= 0.0) { + if (capped_out) *capped_out = false; + if (last_elapsed_out) *last_elapsed_out = 0.0; + return options.loops; + } + + // Allow callers (e.g. the explicit-loop overload) to request a minimum + // starting loop count via options.loops. + const std::uint64_t start_loops = std::max(1, options.loops); + const std::uint64_t max_loops = std::max(start_loops, options.max_loops); + const std::uint64_t rounds = std::max(1, options.calibrate_rounds); + + // Track the round that produced the best (largest) loop count so the + // returned loop count, capped flag, and last-elapsed time all describe + // the same round. + std::uint64_t best_loops = 0; + bool best_capped = false; + double best_elapsed = 0.0; + + for (std::uint64_t round = 0; round < rounds; ++round) { + std::uint64_t loops = start_loops; + bool round_capped = false; + double elapsed = 0.0; + + while (true) { + const auto t0 = std::chrono::steady_clock::now(); + for (std::uint64_t i = 0; i < loops; ++i) { + fn(); + } + const auto t1 = std::chrono::steady_clock::now(); + elapsed = std::chrono::duration(t1 - t0).count(); + + // Drain any state left behind by this probe (e.g. queued async + // work on a persistent stream) before the next probe, the next + // round, or the first measured warmup/value runs. + if (post_calibrate) { + post_calibrate(); + } + if (elapsed >= options.min_time_sec) { + break; + } + if (loops >= max_loops) { + round_capped = true; + break; + } + if (loops > max_loops / 2) { + loops = max_loops; + } else { + loops *= 2; + } + } + + if (loops >= best_loops) { + best_loops = loops; + best_capped = round_capped; + best_elapsed = elapsed; + } + } + + if (capped_out) *capped_out = best_capped; + if (last_elapsed_out) *last_elapsed_out = best_elapsed; + return best_loops; +} + +// Run a benchmark function. The function signature is: void fn() — one call = one operation. +// The harness calls fn() in a tight loop `loops` times per value. +template +std::vector run_benchmark(const Options& options, Fn&& fn) { + std::vector results; + results.reserve(options.runs); + + for (std::uint64_t r = 0; r < options.runs; ++r) { + RunResult run; + run.date = iso_now(); + const auto run_start = std::chrono::steady_clock::now(); + + // Warmups + for (std::uint64_t w = 0; w < options.warmups; ++w) { + const auto t0 = std::chrono::steady_clock::now(); + for (std::uint64_t i = 0; i < options.loops; ++i) { + fn(); + } + const auto t1 = std::chrono::steady_clock::now(); + const double elapsed = std::chrono::duration(t1 - t0).count(); + run.warmup_values.push_back(elapsed / static_cast(options.loops)); + } + + // Timed values + for (std::uint64_t v = 0; v < options.values; ++v) { + const auto t0 = std::chrono::steady_clock::now(); + for (std::uint64_t i = 0; i < options.loops; ++i) { + fn(); + } + const auto t1 = std::chrono::steady_clock::now(); + const double elapsed = std::chrono::duration(t1 - t0).count(); + run.values.push_back(elapsed / static_cast(options.loops)); + } + + const auto run_end = std::chrono::steady_clock::now(); + run.duration_sec = std::chrono::duration(run_end - run_start).count(); + results.push_back(std::move(run)); + } + + return results; +} + +inline void print_summary(const std::string& name, const std::vector& results) { + // Collect all timed values + std::vector all_values; + for (const auto& run : results) { + for (double v : run.values) { + all_values.push_back(v); + } + } + if (all_values.empty()) + return; + + double sum = 0; + for (double v : all_values) + sum += v; + + double mean = sum / static_cast(all_values.size()); + + double sq_sum = 0; + for (double v : all_values) { + double diff = v - mean; + sq_sum += diff * diff; + } + double stdev = std::sqrt(sq_sum / static_cast(all_values.size())); + + std::cout << name << ": Mean +- std dev: " + << std::fixed << std::setprecision(0) + << (mean * 1e9) << " ns +- " + << (stdev * 1e9) << " ns\n"; +} + +// Escape a JSON string (minimal — no control chars expected) +inline std::string json_str(const std::string& s) { + return "\"" + s + "\""; +} + +inline void write_pyperf_json( + const std::string& output_path, + const std::string& name, + std::uint64_t loops, + const std::vector& results +) { + std::ofstream out(output_path); + if (!out) { + std::cerr << "Failed to open output file: " << output_path << '\n'; + std::exit(3); + } + + out << std::setprecision(17); + + out << "{\"version\": \"1.0\", "; + out << "\"metadata\": {"; + out << "\"name\": " << json_str(name) << ", "; + out << "\"loops\": " << loops << ", "; + out << "\"unit\": \"second\""; + out << "}, "; + + out << "\"benchmarks\": [{\"runs\": ["; + + for (std::size_t r = 0; r < results.size(); ++r) { + const auto& run = results[r]; + if (r > 0) out << ", "; + + out << "{\"metadata\": {"; + out << "\"date\": " << json_str(run.date) << ", "; + out << "\"duration\": " << run.duration_sec; + out << "}, "; + + // Warmups: array of [loops, value] pairs + out << "\"warmups\": ["; + for (std::size_t w = 0; w < run.warmup_values.size(); ++w) { + if (w > 0) out << ", "; + out << "[" << loops << ", " << run.warmup_values[w] << "]"; + } + out << "], "; + + // Values + out << "\"values\": ["; + for (std::size_t v = 0; v < run.values.size(); ++v) { + if (v > 0) out << ", "; + out << run.values[v]; + } + out << "]}"; + } + + out << "]}]}\n"; +} + +// A collected benchmark entry: name, loops, and run results +struct BenchmarkEntry { + std::string name; + std::uint64_t loops; + std::vector results; +}; + +// Collect multiple benchmarks from a single binary and write them all +// to one pyperf-compatible JSON file. +class BenchmarkSuite { +public: + explicit BenchmarkSuite(Options options) : options_(std::move(options)) {} + + // Post-calibration hook. If set, invoked between calibration probes so + // async benchmarks can drain state left behind by each probe before the + // next one runs. The final probe leaves the benchmark in a drained state + // before the first measured warmup/value. Can be overridden per-call via + // the `post_calibrate` parameter on `run()`. + void set_post_calibrate(std::function hook) { + post_calibrate_ = std::move(hook); + } + + // Run a benchmark and record it. The name is used as the benchmark ID. + // If --min-time is set, loop count is auto-calibrated. `post_calibrate`, + // if provided, runs between calibration probes to reset async state. + template + void run( + const std::string& name, + Fn&& fn, + std::function post_calibrate = {} + ) { + std::uint64_t loops = options_.loops; + Options custom = options_; + if (options_.min_time_sec > 0.0) { + loops = calibrate_and_warn(name, options_, fn, select_post_calibrate(post_calibrate)); + custom.loops = loops; + } + auto results = run_benchmark(custom, std::forward(fn)); + print_summary(name, results); + entries_.push_back({name, loops, std::move(results)}); + } + + // Run a benchmark with a custom loop count (used as a floor for fast ops + // or a fixed count for slow ops like compilation). When --min-time is set, + // calibration still runs but starts from `loops_override` as the minimum. + template + void run( + const std::string& name, + std::uint64_t loops_override, + Fn&& fn, + std::function post_calibrate = {} + ) { + std::uint64_t loops = loops_override; + Options custom = options_; + custom.loops = loops_override; + if (options_.min_time_sec > 0.0) { + Options calib_opts = options_; + calib_opts.loops = loops_override; // floor + loops = calibrate_and_warn(name, calib_opts, fn, select_post_calibrate(post_calibrate)); + custom.loops = loops; + } + auto results = run_benchmark(custom, std::forward(fn)); + print_summary(name, results); + entries_.push_back({name, loops, std::move(results)}); + } + + // Write all collected benchmarks to the output file (if -o was given). + void write() const { + if (options_.output_path.empty() || entries_.empty()) + return; + write_multi_pyperf_json(options_.output_path, entries_); + } + +private: + Options options_; + std::vector entries_; + std::function post_calibrate_; + + std::function select_post_calibrate(const std::function& per_call) const { + if (per_call) { + return per_call; + } + return post_calibrate_; + } + + template + std::uint64_t calibrate_and_warn( + const std::string& name, + const Options& calib_opts, + Fn&& fn, + const std::function& post_calibrate + ) const { + bool capped = false; + double last_elapsed = 0.0; + std::uint64_t loops = calibrate_loops( + calib_opts, std::forward(fn), post_calibrate, &capped, &last_elapsed + ); + if (capped) { + std::cerr << "WARNING: " << name + << ": calibration hit --max-loops (" << calib_opts.max_loops + << ") before reaching --min-time (" << calib_opts.min_time_sec + << "s). Last sample: " << last_elapsed + << "s. Raise --max-loops to satisfy --min-time for this benchmark.\n"; + } + return loops; + } + + static void write_multi_pyperf_json( + const std::string& output_path, + const std::vector& entries + ) { + std::ofstream out(output_path); + if (!out) { + std::cerr << "Failed to open output file: " << output_path << '\n'; + std::exit(3); + } + + out << std::setprecision(17); + out << "{\"version\": \"1.0\", \"benchmarks\": ["; + + for (std::size_t e = 0; e < entries.size(); ++e) { + const auto& entry = entries[e]; + if (e > 0) out << ", "; + + out << "{\"metadata\": {"; + out << "\"name\": " << json_str(entry.name) << ", "; + out << "\"loops\": " << entry.loops << ", "; + out << "\"unit\": \"second\""; + out << "}, \"runs\": ["; + + for (std::size_t r = 0; r < entry.results.size(); ++r) { + const auto& run = entry.results[r]; + if (r > 0) out << ", "; + + out << "{\"metadata\": {"; + out << "\"date\": " << json_str(run.date) << ", "; + out << "\"duration\": " << run.duration_sec; + out << "}, "; + + out << "\"warmups\": ["; + for (std::size_t w = 0; w < run.warmup_values.size(); ++w) { + if (w > 0) out << ", "; + out << "[" << entry.loops << ", " << run.warmup_values[w] << "]"; + } + out << "], "; + + out << "\"values\": ["; + for (std::size_t v = 0; v < run.values.size(); ++v) { + if (v > 0) out << ", "; + out << run.values[v]; + } + out << "]}"; + } + out << "]}"; + } + out << "]}\n"; + } +}; + +} // namespace bench diff --git a/benchmarks/cuda_bindings/benchmarks/cpp/bench_tensormap.cpp b/benchmarks/cuda_bindings/benchmarks/cpp/bench_tensormap.cpp new file mode 100644 index 00000000000..d2ea5d6b20c --- /dev/null +++ b/benchmarks/cuda_bindings/benchmarks/cpp/bench_tensormap.cpp @@ -0,0 +1,218 @@ +// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +#include + +#include "bench_support.hpp" + +#include +#include + + +static void check_cu(CUresult status, const char* message) { + if (status != CUDA_SUCCESS) { + const char* error_name = nullptr; + cuGetErrorName(status, &error_name); + std::cerr << message << ": " << (error_name ? error_name : "unknown") << '\n'; + std::exit(1); + } +} + + +int main(int argc, char** argv) { + bench::Options options = bench::parse_args(argc, argv); + + // Setup: init CUDA, allocate device memory + check_cu(cuInit(0), "cuInit failed"); + + CUdevice device; + check_cu(cuDeviceGet(&device, 0), "cuDeviceGet failed"); + + CUcontext ctx; + CUctxCreateParams ctxParams = {}; + check_cu(cuCtxCreate(&ctx, &ctxParams, 0, device), "cuCtxCreate failed"); + + CUdeviceptr ptr; + check_cu(cuMemAlloc(&ptr, 1 << 20), "cuMemAlloc failed"); + + // CUtensorMap must be 64-byte aligned. + alignas(64) CUtensorMap tensor_map{}; + + bench::BenchmarkSuite suite(options); + + // --- tensor_map_encode_tiled --- + { + const cuuint64_t global_dim[2] = {128ull, 128ull}; + const cuuint64_t global_strides[1] = {128ull * 4ull}; + const cuuint32_t box_dim[2] = {64u, 64u}; + const cuuint32_t element_strides[2] = {1u, 1u}; + + CUresult probe = cuTensorMapEncodeTiled( + &tensor_map, + CU_TENSOR_MAP_DATA_TYPE_FLOAT32, + 2u, + reinterpret_cast(ptr), + global_dim, + global_strides, + box_dim, + element_strides, + CU_TENSOR_MAP_INTERLEAVE_NONE, + CU_TENSOR_MAP_SWIZZLE_NONE, + CU_TENSOR_MAP_L2_PROMOTION_NONE, + CU_TENSOR_MAP_FLOAT_OOB_FILL_NONE + ); + if (probe == CUDA_SUCCESS) { + suite.run("tensormap.tensor_map_encode_tiled", [&]() { + check_cu( + cuTensorMapEncodeTiled( + &tensor_map, + CU_TENSOR_MAP_DATA_TYPE_FLOAT32, + 2u, + reinterpret_cast(ptr), + global_dim, + global_strides, + box_dim, + element_strides, + CU_TENSOR_MAP_INTERLEAVE_NONE, + CU_TENSOR_MAP_SWIZZLE_NONE, + CU_TENSOR_MAP_L2_PROMOTION_NONE, + CU_TENSOR_MAP_FLOAT_OOB_FILL_NONE + ), + "cuTensorMapEncodeTiled failed" + ); + }); + } else { + const char* err_name = nullptr; + cuGetErrorName(probe, &err_name); + std::cerr << "Skipping tensormap.tensor_map_encode_tiled: " + << (err_name ? err_name : "unknown") << '\n'; + } + } + + // --- tensor_map_encode_im2col --- + { + const cuuint64_t global_dim[3] = {32ull, 64ull, 64ull}; + const cuuint64_t global_strides[2] = {32ull * 2ull, 32ull * 64ull * 2ull}; + const int pixel_box_lower[1] = {0}; + const int pixel_box_upper[1] = {0}; + const cuuint32_t element_strides[3] = {1u, 1u, 1u}; + + CUresult probe = cuTensorMapEncodeIm2col( + &tensor_map, + CU_TENSOR_MAP_DATA_TYPE_FLOAT16, + 3u, + reinterpret_cast(ptr), + global_dim, + global_strides, + pixel_box_lower, + pixel_box_upper, + 32u, + 32u, + element_strides, + CU_TENSOR_MAP_INTERLEAVE_NONE, + CU_TENSOR_MAP_SWIZZLE_NONE, + CU_TENSOR_MAP_L2_PROMOTION_NONE, + CU_TENSOR_MAP_FLOAT_OOB_FILL_NONE + ); + if (probe == CUDA_SUCCESS) { + suite.run("tensormap.tensor_map_encode_im2col", [&]() { + check_cu( + cuTensorMapEncodeIm2col( + &tensor_map, + CU_TENSOR_MAP_DATA_TYPE_FLOAT16, + 3u, + reinterpret_cast(ptr), + global_dim, + global_strides, + pixel_box_lower, + pixel_box_upper, + 32u, + 32u, + element_strides, + CU_TENSOR_MAP_INTERLEAVE_NONE, + CU_TENSOR_MAP_SWIZZLE_NONE, + CU_TENSOR_MAP_L2_PROMOTION_NONE, + CU_TENSOR_MAP_FLOAT_OOB_FILL_NONE + ), + "cuTensorMapEncodeIm2col failed" + ); + }); + } else { + const char* err_name = nullptr; + cuGetErrorName(probe, &err_name); + std::cerr << "Skipping tensormap.tensor_map_encode_im2col: " + << (err_name ? err_name : "unknown") << '\n'; + } + } + +#if defined(CUDA_VERSION) && CUDA_VERSION >= 12080 + // --- tensor_map_encode_im2col_wide --- + { + const cuuint64_t global_dim[3] = {32ull, 64ull, 64ull}; + const cuuint64_t global_strides[2] = {32ull * 2ull, 32ull * 64ull * 2ull}; + const cuuint32_t element_strides[3] = {1u, 1u, 1u}; + + CUresult probe = cuTensorMapEncodeIm2colWide( + &tensor_map, + CU_TENSOR_MAP_DATA_TYPE_FLOAT16, + 3u, + reinterpret_cast(ptr), + global_dim, + global_strides, + 0, + 0, + 32u, + 32u, + element_strides, + CU_TENSOR_MAP_INTERLEAVE_NONE, + CU_TENSOR_MAP_IM2COL_WIDE_MODE_W, + CU_TENSOR_MAP_SWIZZLE_128B, + CU_TENSOR_MAP_L2_PROMOTION_NONE, + CU_TENSOR_MAP_FLOAT_OOB_FILL_NONE + ); + + if (probe == CUDA_SUCCESS) { + suite.run("tensormap.tensor_map_encode_im2col_wide", [&]() { + check_cu( + cuTensorMapEncodeIm2colWide( + &tensor_map, + CU_TENSOR_MAP_DATA_TYPE_FLOAT16, + 3u, + reinterpret_cast(ptr), + global_dim, + global_strides, + 0, + 0, + 32u, + 32u, + element_strides, + CU_TENSOR_MAP_INTERLEAVE_NONE, + CU_TENSOR_MAP_IM2COL_WIDE_MODE_W, + CU_TENSOR_MAP_SWIZZLE_128B, + CU_TENSOR_MAP_L2_PROMOTION_NONE, + CU_TENSOR_MAP_FLOAT_OOB_FILL_NONE + ), + "cuTensorMapEncodeIm2colWide failed" + ); + }); + } else { + const char* err_name = nullptr; + cuGetErrorName(probe, &err_name); + std::cerr << "Skipping tensormap.tensor_map_encode_im2col_wide: " + << (err_name ? err_name : "unknown") << '\n'; + } + } +#else + std::cerr << "Skipping tensormap.tensor_map_encode_im2col_wide: " + "built against CUDA_VERSION < 12080.\n"; +#endif + + // Cleanup + check_cu(cuMemFree(ptr), "cuMemFree failed"); + check_cu(cuCtxDestroy(ctx), "cuCtxDestroy failed"); + + suite.write(); + + return 0; +} diff --git a/benchmarks/cuda_bindings/compare.py b/benchmarks/cuda_bindings/compare.py new file mode 100644 index 00000000000..ca1b398ceb2 --- /dev/null +++ b/benchmarks/cuda_bindings/compare.py @@ -0,0 +1,163 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +"""Compare Python and C++ benchmark results in a summary table.""" + +import argparse +import json +import statistics +import sys +from pathlib import Path + +PROJECT_ROOT = Path(__file__).resolve().parent +DEFAULT_PYTHON = PROJECT_ROOT / "results-python.json" +DEFAULT_CPP = PROJECT_ROOT / "results-cpp.json" + + +def load_benchmarks(path: Path) -> dict[str, list[float]]: + """Load a pyperf JSON file and return {name: [values]}.""" + with open(path) as f: + data = json.load(f) + + results: dict[str, list[float]] = {} + for bench in data.get("benchmarks", []): + name = bench.get("metadata", {}).get("name", "") + if not name: + # Try to find name in run metadata + for run in bench.get("runs", []): + name = run.get("metadata", {}).get("name", "") + if name: + break + values: list[float] = [] + for run in bench.get("runs", []): + values.extend(run.get("values", [])) + if name and values: + results[name] = values + return results + + +def stats(values: list[float]) -> tuple[float, float, float, int]: + mean = statistics.mean(values) + stdev = statistics.pstdev(values) if len(values) > 1 else 0.0 + rsd = (stdev / mean) if mean else 0.0 + return mean, stdev, rsd, len(values) + + +def fmt_rsd(rsd: float | None) -> str: + if rsd is None: + return "-" + return f"{rsd * 100:.1f}%" + + +def fmt_ns(seconds: float) -> str: + """Format a duration in nanoseconds with a thousands separator. + + Using a single unit across the whole table makes side-by-side comparison + easier, even when some entries get into the multi-microsecond range. + """ + return f"{seconds * 1e9:,.0f}" + + +def fmt_overhead_ns(py_mean: float, cpp_mean: float) -> str: + return f"{(py_mean - cpp_mean) * 1e9:+,.0f}" + + +def fmt_overhead_pct(py_mean: float, cpp_mean: float) -> str: + if cpp_mean <= 0.0: + return "-" + pct = (py_mean - cpp_mean) / cpp_mean * 100 + return f"{pct:+,.0f}%" + + +def main() -> None: + parser = argparse.ArgumentParser(description="Compare Python vs C++ benchmark results") + parser.add_argument( + "--python", + type=Path, + default=DEFAULT_PYTHON, + help=f"Python results JSON (default: {DEFAULT_PYTHON.name})", + ) + parser.add_argument( + "--cpp", + type=Path, + default=DEFAULT_CPP, + help=f"C++ results JSON (default: {DEFAULT_CPP.name})", + ) + args = parser.parse_args() + + if not args.python.exists(): + print(f"Python results not found: {args.python}", file=sys.stderr) + print("Run: pixi run -e wheel bench", file=sys.stderr) + sys.exit(1) + + py_benchmarks = load_benchmarks(args.python) + cpp_benchmarks = load_benchmarks(args.cpp) if args.cpp.exists() else {} + + if not py_benchmarks: + print("No benchmarks found in Python results.", file=sys.stderr) + sys.exit(1) + + # Column widths + all_names = sorted(set(py_benchmarks) | set(cpp_benchmarks)) + name_width = max(len(n) for n in all_names) + name_width = max(name_width, len("Benchmark")) + + # Right-aligned numeric columns. Widths chosen so header text fits and + # multi-microsecond ns values with thousands separators still align. + cpp_w = 12 + py_w = 12 + rsd_w = 8 + oh_ns_w = 12 + oh_pct_w = 10 + + # Header + if cpp_benchmarks: + header = ( + f"{'Benchmark':<{name_width}} " + f"{'C++ (ns)':>{cpp_w}} {'C++ RSD':>{rsd_w}} " + f"{'Python (ns)':>{py_w}} {'Py RSD':>{rsd_w}} " + f"{'Overhead ns':>{oh_ns_w}} {'Overhead %':>{oh_pct_w}}" + ) + else: + header = f"{'Benchmark':<{name_width}} {'Python (ns)':>{py_w}} {'Py RSD':>{rsd_w}}" + + sep = "-" * len(header) + print(sep) + print(header) + print(sep) + + for name in all_names: + py_vals = py_benchmarks.get(name) + cpp_vals = cpp_benchmarks.get(name) + + py_stats = stats(py_vals) if py_vals else None + cpp_stats = stats(cpp_vals) if cpp_vals else None + + py_str = fmt_ns(py_stats[0]) if py_stats else "-" + cpp_str = fmt_ns(cpp_stats[0]) if cpp_stats else "-" + py_rsd = fmt_rsd(py_stats[2]) if py_stats else "-" + cpp_rsd = fmt_rsd(cpp_stats[2]) if cpp_stats else "-" + + if py_stats and cpp_stats: + overhead_ns_str = fmt_overhead_ns(py_stats[0], cpp_stats[0]) + overhead_pct_str = fmt_overhead_pct(py_stats[0], cpp_stats[0]) + else: + overhead_ns_str = "-" + overhead_pct_str = "-" + + if cpp_benchmarks: + print( + f"{name:<{name_width}} " + f"{cpp_str:>{cpp_w}} {cpp_rsd:>{rsd_w}} " + f"{py_str:>{py_w}} {py_rsd:>{rsd_w}} " + f"{overhead_ns_str:>{oh_ns_w}} {overhead_pct_str:>{oh_pct_w}}" + ) + else: + print(f"{name:<{name_width}} {py_str:>{py_w}} {py_rsd:>{rsd_w}}") + + print(sep) + + +if __name__ == "__main__": + main() diff --git a/benchmarks/cuda_bindings/pixi.lock b/benchmarks/cuda_bindings/pixi.lock new file mode 100644 index 00000000000..8f754621bd2 --- /dev/null +++ b/benchmarks/cuda_bindings/pixi.lock @@ -0,0 +1,1767 @@ +version: 6 +environments: + default: + channels: + - url: https://conda.anaconda.org/conda-forge/ + options: + channel-priority: disabled + pypi-prerelease-mode: if-necessary-or-explicit + packages: {} + source: + channels: + - url: https://conda.anaconda.org/conda-forge/ + options: + channel-priority: disabled + pypi-prerelease-mode: if-necessary-or-explicit + packages: + linux-64: + - conda: https://conda.anaconda.org/conda-forge/linux-64/_openmp_mutex-4.5-20_gnu.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/attr-2.5.2-h39aace5_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/binutils-2.45.1-default_h4852527_101.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/binutils_impl_linux-64-2.45.1-default_hfdba357_101.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/binutils_linux-64-2.45.1-default_h4852527_101.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/bzip2-1.0.8-hda65f42_9.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/c-ares-1.34.6-hb03c661_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/c-compiler-1.11.0-h4d9bdce_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/ca-certificates-2026.2.25-hbd8a1cb_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cffi-2.0.0-py314h4a8dc5f_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cfgv-3.5.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cmake-4.2.3-hc85cc9f_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/colorama-0.4.6-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/conda-gcc-specs-14.3.0-he8ccf15_18.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cccl_linux-64-13.2.27-ha770c72_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-crt-dev_linux-64-13.2.51-ha770c72_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-cudart-13.2.51-hecca717_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-cudart-dev-13.2.51-hecca717_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart-dev_linux-64-13.2.51-h376f20c_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-cudart-static-13.2.51-hecca717_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart-static_linux-64-13.2.51-h376f20c_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart_linux-64-13.2.51-h376f20c_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-driver-dev_linux-64-13.2.51-h376f20c_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-nvrtc-13.2.78-hecca717_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-nvrtc-dev-13.2.78-hecca717_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-nvvm-13.2.51-h69a702a_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-nvvm-dev_linux-64-13.2.51-ha770c72_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-nvvm-impl-13.2.51-h4bc722e_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-nvvm-tools-13.2.51-h4bc722e_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-version-13.2-he2cc418_3.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cxx-compiler-1.11.0-hfcd1e18_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/distlib-0.4.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/exceptiongroup-1.3.1-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/filelock-3.25.2-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/gcc-14.3.0-h0dff253_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/gcc_impl_linux-64-14.3.0-hbdf3cc3_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/gcc_linux-64-14.3.0-h298d278_21.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/gxx-14.3.0-h76987e4_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/gxx_impl_linux-64-14.3.0-h2185e75_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/gxx_linux-64-14.3.0-he467f4b_21.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/icu-78.2-h33c6efd_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/identify-2.6.17-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/importlib-metadata-8.7.0-pyhe01879c_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/iniconfig-2.3.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/kernel-headers_linux-64-4.18.0-he073ed8_9.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/keyutils-1.6.3-hb9d3cd8_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/krb5-1.22.2-ha1258a1_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/ld_impl_linux-64-2.45.1-default_hbd61a6d_101.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libblas-3.11.0-5_h4a7cf45_openblas.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libcap-2.77-h3ff7636_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libcblas-3.11.0-5_h0358290_openblas.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libcufile-1.17.1.22-h85c024f_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libcurl-8.18.0-hcf29cc6_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libedit-3.1.20250104-pl5321h7949ede_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libev-4.33-hd590300_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libexpat-2.7.4-hecca717_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libffi-3.5.2-h3435931_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libgcc-15.2.0-he0feb66_18.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/libgcc-devel_linux-64-14.3.0-hf649bbc_118.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libgcc-ng-15.2.0-h69a702a_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libgfortran-15.2.0-h69a702a_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libgfortran5-15.2.0-h68bc16d_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libgomp-15.2.0-he0feb66_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/liblapack-3.11.0-5_h47877c9_openblas.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/liblzma-5.8.2-hb03c661_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libmpdec-4.0.0-hb03c661_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libnghttp2-1.67.0-had1ee68_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libnl-3.11.0-hb9d3cd8_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libnvfatbin-13.2.51-hecca717_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libnvjitlink-13.2.51-hecca717_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libopenblas-0.3.30-pthreads_h94d23a6_4.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libsanitizer-14.3.0-h8f1669f_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libsqlite-3.51.2-hf4e2dac_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libssh2-1.11.1-hcf80075_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libstdcxx-15.2.0-h934c35e_18.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/libstdcxx-devel_linux-64-14.3.0-h9f08a49_118.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libsystemd0-257.10-hd0affe5_4.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libudev1-257.10-hd0affe5_4.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libuuid-2.41.3-h5347b49_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libuv-1.51.0-hb03c661_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libzlib-1.3.1-hb9d3cd8_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/ncurses-6.5-h2d0b736_3.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/ninja-1.13.2-h171cf75_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/nodeenv-1.10.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/numpy-2.4.2-py314h2b28147_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/openssl-3.6.1-h35e630c_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/packaging-26.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/platformdirs-4.9.4-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pluggy-1.6.0-pyhf9edf01_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pre-commit-4.5.1-pyha770c72_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/py-cpuinfo-9.0.0-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pycparser-2.22-pyh29332c3_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pygments-2.19.2-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/pyperf-2.9.0-py314hdafbbf9_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pytest-9.0.2-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pytest-benchmark-5.2.3-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/python-3.14.3-h32b2ec7_101_cp314.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/python-discovery-1.1.3-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/python_abi-3.14-8_cp314.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/pyyaml-6.0.3-py314h67df5f8_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/rdma-core-61.0-h192683f_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/readline-8.3-h853b02a_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/rhash-1.4.6-hb9d3cd8_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/setuptools-82.0.1-pyh332efcf_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/six-1.17.0-pyhe01879c_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/sysroot_linux-64-2.28-h4ee821c_9.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/tk-8.6.13-noxft_h366c992_103.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/tomli-2.4.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/typing_extensions-4.15.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/tzdata-2025c-hc9c84f9_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/ukkonen-1.1.0-py314h9891dd4_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/virtualenv-21.2.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/yaml-0.2.5-h280c20c_3.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/zipp-3.23.0-pyhcf101f3_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/zstd-1.5.7-hb78ec9c_6.conda + - conda: ../../cuda_bindings + - conda: ../../cuda_pathfinder + wheel: + channels: + - url: https://conda.anaconda.org/conda-forge/ + options: + channel-priority: disabled + pypi-prerelease-mode: if-necessary-or-explicit + packages: + linux-64: + - conda: https://conda.anaconda.org/conda-forge/linux-64/_openmp_mutex-4.5-20_gnu.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/attr-2.5.2-h39aace5_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/binutils-2.45.1-default_h4852527_101.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/binutils_impl_linux-64-2.45.1-default_hfdba357_101.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/binutils_linux-64-2.45.1-default_h4852527_101.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/bzip2-1.0.8-hda65f42_9.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/c-ares-1.34.6-hb03c661_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/c-compiler-1.11.0-h4d9bdce_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/ca-certificates-2026.2.25-hbd8a1cb_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cffi-2.0.0-py314h4a8dc5f_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cfgv-3.5.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cmake-4.2.3-hc85cc9f_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/colorama-0.4.6-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/conda-gcc-specs-14.3.0-he8ccf15_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-bindings-13.1.0-py314ha160325_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cccl_linux-64-13.1.115-ha770c72_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-crt-dev_linux-64-13.1.115-ha770c72_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-cudart-13.1.80-hecca717_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-cudart-dev-13.1.80-hecca717_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart-dev_linux-64-13.1.80-h376f20c_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-cudart-static-13.1.80-hecca717_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart-static_linux-64-13.1.80-h376f20c_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart_linux-64-13.1.80-h376f20c_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-driver-dev_linux-64-13.1.80-h376f20c_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-nvrtc-13.1.115-hecca717_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-nvrtc-dev-13.1.115-hecca717_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-nvvm-impl-13.1.115-h4bc722e_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-pathfinder-1.4.0-pyhc364b38_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-version-13.1-h2ff5cdb_3.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cxx-compiler-1.11.0-hfcd1e18_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/distlib-0.4.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/exceptiongroup-1.3.1-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/filelock-3.25.2-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/gcc-14.3.0-h0dff253_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/gcc_impl_linux-64-14.3.0-hbdf3cc3_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/gcc_linux-64-14.3.0-h298d278_21.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/gxx-14.3.0-h76987e4_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/gxx_impl_linux-64-14.3.0-h2185e75_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/gxx_linux-64-14.3.0-he467f4b_21.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/icu-78.2-h33c6efd_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/identify-2.6.17-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/importlib-metadata-8.7.0-pyhe01879c_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/iniconfig-2.3.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/kernel-headers_linux-64-4.18.0-he073ed8_9.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/keyutils-1.6.3-hb9d3cd8_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/krb5-1.22.2-ha1258a1_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/ld_impl_linux-64-2.45.1-default_hbd61a6d_101.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libblas-3.11.0-5_h4a7cf45_openblas.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libcap-2.77-h3ff7636_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libcblas-3.11.0-5_h0358290_openblas.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libcufile-1.16.1.26-hd07211c_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libcurl-8.18.0-hcf29cc6_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libedit-3.1.20250104-pl5321h7949ede_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libev-4.33-hd590300_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libexpat-2.7.4-hecca717_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libffi-3.5.2-h3435931_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libgcc-15.2.0-he0feb66_18.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/libgcc-devel_linux-64-14.3.0-hf649bbc_118.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libgcc-ng-15.2.0-h69a702a_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libgfortran-15.2.0-h69a702a_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libgfortran5-15.2.0-h68bc16d_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libgomp-15.2.0-he0feb66_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/liblapack-3.11.0-5_h47877c9_openblas.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/liblzma-5.8.2-hb03c661_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libmpdec-4.0.0-hb03c661_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libnghttp2-1.67.0-had1ee68_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libnl-3.11.0-hb9d3cd8_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libnvjitlink-13.1.115-hecca717_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libopenblas-0.3.30-pthreads_h94d23a6_4.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libsanitizer-14.3.0-h8f1669f_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libsqlite-3.51.2-hf4e2dac_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libssh2-1.11.1-hcf80075_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libstdcxx-15.2.0-h934c35e_18.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/libstdcxx-devel_linux-64-14.3.0-h9f08a49_118.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libsystemd0-257.10-hd0affe5_4.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libudev1-257.10-hd0affe5_4.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libuuid-2.41.3-h5347b49_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libuv-1.51.0-hb03c661_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libzlib-1.3.1-hb9d3cd8_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/ncurses-6.5-h2d0b736_3.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/ninja-1.13.2-h171cf75_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/nodeenv-1.10.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/numpy-2.4.2-py314h2b28147_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/openssl-3.6.1-h35e630c_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/packaging-26.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/platformdirs-4.9.4-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pluggy-1.6.0-pyhf9edf01_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pre-commit-4.5.1-pyha770c72_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/py-cpuinfo-9.0.0-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pycparser-2.22-pyh29332c3_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pygments-2.19.2-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/pyperf-2.9.0-py314hdafbbf9_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pytest-9.0.2-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pytest-benchmark-5.2.3-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/python-3.14.3-h32b2ec7_101_cp314.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/python-discovery-1.1.3-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/python_abi-3.14-8_cp314.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/pyyaml-6.0.3-py314h67df5f8_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/rdma-core-61.0-h192683f_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/readline-8.3-h853b02a_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/rhash-1.4.6-hb9d3cd8_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/setuptools-82.0.1-pyh332efcf_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/six-1.17.0-pyhe01879c_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/sysroot_linux-64-2.28-h4ee821c_9.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/tk-8.6.13-noxft_h366c992_103.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/tomli-2.4.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/typing_extensions-4.15.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/tzdata-2025c-hc9c84f9_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/ukkonen-1.1.0-py314h9891dd4_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/virtualenv-21.2.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/yaml-0.2.5-h280c20c_3.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/zipp-3.23.0-pyhcf101f3_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/zstd-1.5.7-hb78ec9c_6.conda +packages: +- conda: https://conda.anaconda.org/conda-forge/linux-64/_openmp_mutex-4.5-20_gnu.conda + build_number: 20 + sha256: 1dd3fffd892081df9726d7eb7e0dea6198962ba775bd88842135a4ddb4deb3c9 + md5: a9f577daf3de00bca7c3c76c0ecbd1de + depends: + - __glibc >=2.17,<3.0.a0 + - libgomp >=7.5.0 + constrains: + - openmp_impl <0.0a0 + license: BSD-3-Clause + license_family: BSD + size: 28948 + timestamp: 1770939786096 +- conda: https://conda.anaconda.org/conda-forge/linux-64/attr-2.5.2-h39aace5_0.conda + sha256: a9c114cbfeda42a226e2db1809a538929d2f118ef855372293bd188f71711c48 + md5: 791365c5f65975051e4e017b5da3abf5 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=13 + license: GPL-2.0-or-later + license_family: GPL + size: 68072 + timestamp: 1756738968573 +- conda: https://conda.anaconda.org/conda-forge/linux-64/binutils-2.45.1-default_h4852527_101.conda + sha256: 2851d34944b056d028543f0440fb631aeeff204151ea09589d8d9c13882395de + md5: 9902aeb08445c03fb31e01beeb173988 + depends: + - binutils_impl_linux-64 >=2.45.1,<2.45.2.0a0 + license: GPL-3.0-only + license_family: GPL + size: 35128 + timestamp: 1770267175160 +- conda: https://conda.anaconda.org/conda-forge/linux-64/binutils_impl_linux-64-2.45.1-default_hfdba357_101.conda + sha256: 74341b26a2b9475dc14ba3cf12432fcd10a23af285101883e720216d81d44676 + md5: 83aa53cb3f5fc849851a84d777a60551 + depends: + - ld_impl_linux-64 2.45.1 default_hbd61a6d_101 + - sysroot_linux-64 + - zstd >=1.5.7,<1.6.0a0 + license: GPL-3.0-only + license_family: GPL + size: 3744895 + timestamp: 1770267152681 +- conda: https://conda.anaconda.org/conda-forge/linux-64/binutils_linux-64-2.45.1-default_h4852527_101.conda + sha256: 4826f97d33cbe54459970a1e84500dbe0cccf8326aaf370e707372ae20ec5a47 + md5: dec96579f9a7035a59492bf6ee613b53 + depends: + - binutils_impl_linux-64 2.45.1 default_hfdba357_101 + license: GPL-3.0-only + license_family: GPL + size: 36060 + timestamp: 1770267177798 +- conda: https://conda.anaconda.org/conda-forge/linux-64/bzip2-1.0.8-hda65f42_9.conda + sha256: 0b75d45f0bba3e95dc693336fa51f40ea28c980131fec438afb7ce6118ed05f6 + md5: d2ffd7602c02f2b316fd921d39876885 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + license: bzip2-1.0.6 + license_family: BSD + size: 260182 + timestamp: 1771350215188 +- conda: https://conda.anaconda.org/conda-forge/linux-64/c-ares-1.34.6-hb03c661_0.conda + sha256: cc9accf72fa028d31c2a038460787751127317dcfa991f8d1f1babf216bb454e + md5: 920bb03579f15389b9e512095ad995b7 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + license: MIT + license_family: MIT + size: 207882 + timestamp: 1765214722852 +- conda: https://conda.anaconda.org/conda-forge/linux-64/c-compiler-1.11.0-h4d9bdce_0.conda + sha256: 8e7a40f16400d7839c82581410aa05c1f8324a693c9d50079f8c50dc9fb241f0 + md5: abd85120de1187b0d1ec305c2173c71b + depends: + - binutils + - gcc + - gcc_linux-64 14.* + license: BSD-3-Clause + license_family: BSD + size: 6693 + timestamp: 1753098721814 +- conda: https://conda.anaconda.org/conda-forge/noarch/ca-certificates-2026.2.25-hbd8a1cb_0.conda + sha256: 67cc7101b36421c5913a1687ef1b99f85b5d6868da3abbf6ec1a4181e79782fc + md5: 4492fd26db29495f0ba23f146cd5638d + depends: + - __unix + license: ISC + size: 147413 + timestamp: 1772006283803 +- conda: https://conda.anaconda.org/conda-forge/linux-64/cffi-2.0.0-py314h4a8dc5f_1.conda + sha256: c6339858a0aaf5d939e00d345c98b99e4558f285942b27232ac098ad17ac7f8e + md5: cf45f4278afd6f4e6d03eda0f435d527 + depends: + - __glibc >=2.17,<3.0.a0 + - libffi >=3.5.2,<3.6.0a0 + - libgcc >=14 + - pycparser + - python >=3.14,<3.15.0a0 + - python_abi 3.14.* *_cp314 + license: MIT + license_family: MIT + size: 300271 + timestamp: 1761203085220 +- conda: https://conda.anaconda.org/conda-forge/noarch/cfgv-3.5.0-pyhd8ed1ab_0.conda + sha256: aa589352e61bb221351a79e5946d56916e3c595783994884accdb3b97fe9d449 + md5: 381bd45fb7aa032691f3063aff47e3a1 + depends: + - python >=3.10 + license: MIT + license_family: MIT + size: 13589 + timestamp: 1763607964133 +- conda: https://conda.anaconda.org/conda-forge/linux-64/cmake-4.2.3-hc85cc9f_1.conda + sha256: 5ece78754577b8d9030ec1f09ce1cd481125f27d8d6fcdcfe2c1017661830c61 + md5: 51d37989c1758b5edfe98518088bf700 + depends: + - __glibc >=2.17,<3.0.a0 + - bzip2 >=1.0.8,<2.0a0 + - libcurl >=8.18.0,<9.0a0 + - libexpat >=2.7.4,<3.0a0 + - libgcc >=14 + - liblzma >=5.8.2,<6.0a0 + - libstdcxx >=14 + - libuv >=1.51.0,<2.0a0 + - libzlib >=1.3.1,<2.0a0 + - ncurses >=6.5,<7.0a0 + - rhash >=1.4.6,<2.0a0 + - zstd >=1.5.7,<1.6.0a0 + license: BSD-3-Clause + license_family: BSD + size: 22330508 + timestamp: 1771383666798 +- conda: https://conda.anaconda.org/conda-forge/noarch/colorama-0.4.6-pyhd8ed1ab_1.conda + sha256: ab29d57dc70786c1269633ba3dff20288b81664d3ff8d21af995742e2bb03287 + md5: 962b9857ee8e7018c22f2776ffa0b2d7 + depends: + - python >=3.9 + license: BSD-3-Clause + license_family: BSD + size: 27011 + timestamp: 1733218222191 +- conda: https://conda.anaconda.org/conda-forge/linux-64/conda-gcc-specs-14.3.0-he8ccf15_18.conda + sha256: b90ec0e6a9eb22f7240b3584fe785457cff961fec68d40e6aece5d596f9bbd9a + md5: 0e3e144115c43c9150d18fa20db5f31c + depends: + - gcc_impl_linux-64 >=14.3.0,<14.3.1.0a0 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 31705 + timestamp: 1771378159534 +- conda: ../../cuda_bindings + name: cuda-bindings + version: 13.2.0 + build: hb0f4dca_0 + subdir: linux-64 + variants: + target_platform: linux-64 + depends: + - python + - cuda-version + - cuda-pathfinder + - libnvjitlink + - cuda-nvrtc + - cuda-nvrtc >=13.2.78,<14.0a0 + - cuda-nvvm + - libnvfatbin + - libcufile + - libcufile >=1.17.1.22,<2.0a0 + - libgcc >=15 + - libgcc >=15 + - libstdcxx >=15 + - python_abi 3.14.* *_cp314 + license: Apache-2.0 + sources: + cuda-pathfinder: + path: ../cuda_pathfinder +- conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-bindings-13.1.0-py314ha160325_1.conda + sha256: aecfbbc9a687e5daba66b896613a00c617e3eadc21a31b19e53e8e642e83d7a7 + md5: 3bd3abdf71e1b8c53310195677bf00be + depends: + - __glibc >=2.17,<3.0.a0 + - cuda-nvrtc >=13,<14.0a0 + - cuda-nvvm-impl >=13,<14.0a0 + - cuda-pathfinder >=1.1.0,<2 + - cuda-version >=13,<14.0a0 + - libcufile >=1,<2.0a0 + - libgcc >=14 + - libnvjitlink >=13.0,<14.0a0 + - libstdcxx >=14 + - numpy + - python >=3.14,<3.15.0a0 + - python_abi 3.14.* *_cp314 + constrains: + - cuda-python >=13.1.0,<13.2.0a0 + - cuda-cudart >=13,<14.0a0 + license: LicenseRef-NVIDIA-SOFTWARE-LICENSE + size: 7267159 + timestamp: 1764919647948 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cccl_linux-64-13.1.115-ha770c72_0.conda + sha256: 0715f15da71587238600f0584bc8d243d8fde602c3d8856f421b58dff3fb9422 + md5: a179486129ff28d053bb16fdb533568e + depends: + - cuda-version >=13.1,<13.2.0a0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 1277295 + timestamp: 1768272295906 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cccl_linux-64-13.2.27-ha770c72_0.conda + sha256: e539baa32e3be63f89bd11d421911363faac322903caf58a15a46ba68ae29867 + md5: 4910b7b709f1168baffc2a742b39a222 + depends: + - cuda-version >=13.2,<13.3.0a0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 1415308 + timestamp: 1773098874302 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-crt-dev_linux-64-13.1.115-ha770c72_0.conda + sha256: 82ae1f3e492146722e258e237daa537f4d4df8157b2dfa49a0869eb41a11d284 + md5: 3723bca2a84e6cc0f0a98427b71bec73 + depends: + - cuda-version >=13.1,<13.2.0a0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 96480 + timestamp: 1768280269206 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-crt-dev_linux-64-13.2.51-ha770c72_0.conda + sha256: dd9a74a40b196b1ea150b17ca8fb539dd8f75edd349af354a7bae6dbb43e43b4 + md5: 6f4a609f3d142d4b22728823955249e9 + depends: + - cuda-version >=13.2,<13.3.0a0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 97122 + timestamp: 1773115163637 +- conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-cudart-13.1.80-hecca717_0.conda + sha256: 00acb7564e7c7dd60be431bd2a1a937856e38a86535d72281461cd193500a0a4 + md5: 2e2b71c8d67f6ceb1d3820aa438f3580 + depends: + - __glibc >=2.17,<3.0.a0 + - cuda-cudart_linux-64 13.1.80 h376f20c_0 + - cuda-version >=13.1,<13.2.0a0 + - libgcc >=14 + - libstdcxx >=14 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 24159 + timestamp: 1764883525821 +- conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-cudart-13.2.51-hecca717_0.conda + sha256: 9cc44fd4914738a32cf5c801925a08c61ce45b5534833cf1df1621236a9a321d + md5: 29f5b46965bd82b0e9cc27a96d13f2bd + depends: + - __glibc >=2.17,<3.0.a0 + - cuda-cudart_linux-64 13.2.51 h376f20c_0 + - cuda-version >=13.2,<13.3.0a0 + - libgcc >=14 + - libstdcxx >=14 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 24534 + timestamp: 1773104357094 +- conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-cudart-dev-13.1.80-hecca717_0.conda + sha256: 12aa5dcf82cdf863be18a48a9ad4d271aa864ef985752bc9707371b84085f0c8 + md5: e3cbe24bf8ae135e9f82450be520e886 + depends: + - __glibc >=2.17,<3.0.a0 + - cuda-cudart 13.1.80 hecca717_0 + - cuda-cudart-dev_linux-64 13.1.80 h376f20c_0 + - cuda-cudart-static 13.1.80 hecca717_0 + - cuda-version >=13.1,<13.2.0a0 + - libgcc >=14 + - libstdcxx >=14 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 24597 + timestamp: 1764883573873 +- conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-cudart-dev-13.2.51-hecca717_0.conda + sha256: f6d81c961b6212389c07ffc9dc1268966db63aa351d46875effee40447eb9dd8 + md5: 9b35a56418b6cbbde5ea5f7d84c26317 + depends: + - __glibc >=2.17,<3.0.a0 + - cuda-cudart 13.2.51 hecca717_0 + - cuda-cudart-dev_linux-64 13.2.51 h376f20c_0 + - cuda-cudart-static 13.2.51 hecca717_0 + - cuda-version >=13.2,<13.3.0a0 + - libgcc >=14 + - libstdcxx >=14 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 24961 + timestamp: 1773104406956 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart-dev_linux-64-13.1.80-h376f20c_0.conda + sha256: 41a1cc86f2759ef6ae47cc68e2180baaeb4b989709931366ee0cdc90f8e10f5f + md5: a36776a49ae0e47a26e129bdc82aeb3e + depends: + - cuda-cccl_linux-64 + - cuda-cudart-static_linux-64 + - cuda-cudart_linux-64 + - cuda-version >=13.1,<13.2.0a0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 392459 + timestamp: 1764883538793 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart-dev_linux-64-13.2.51-h376f20c_0.conda + sha256: 86dd0dc301bab5263d63f13d47b02507e0cf2fd22ff9aefa37dea2dd03c6df83 + md5: 7e5cf4b991525b7b1a2cfa3f1c81462e + depends: + - cuda-cccl_linux-64 + - cuda-cudart-static_linux-64 + - cuda-cudart_linux-64 + - cuda-version >=13.2,<13.3.0a0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 399921 + timestamp: 1773104368666 +- conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-cudart-static-13.1.80-hecca717_0.conda + sha256: 7cbf145b3e59d360052556bfe9425753b119c33cbba0c1f20f0191a7330ced5c + md5: 0e5edde73725a13f7d62ddf96b7656b9 + depends: + - __glibc >=2.17,<3.0.a0 + - cuda-cudart-static_linux-64 13.1.80 h376f20c_0 + - cuda-version >=13.1,<13.2.0a0 + - libgcc >=14 + - libstdcxx >=14 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 24119 + timestamp: 1764883551735 +- conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-cudart-static-13.2.51-hecca717_0.conda + sha256: d4a316038b02161e04a864c8cd146d2ec62cbd114eb951197c6ef6042d3c46c4 + md5: daec4c4dc0355adcdf009dceb3b94259 + depends: + - __glibc >=2.17,<3.0.a0 + - cuda-cudart-static_linux-64 13.2.51 h376f20c_0 + - cuda-version >=13.2,<13.3.0a0 + - libgcc >=14 + - libstdcxx >=14 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 24494 + timestamp: 1773104383494 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart-static_linux-64-13.1.80-h376f20c_0.conda + sha256: 2252e12fa9a806f685684b6395a660d845dc95bdc95e52a6bc09dba8a9eccec3 + md5: be9f8ef5a01fca1f28c8d523f8501771 + depends: + - cuda-version >=13.1,<13.2.0a0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 1121385 + timestamp: 1764883490595 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart-static_linux-64-13.2.51-h376f20c_0.conda + sha256: e3cc51809bd8be0a96bbe01a668f08e6e611c8fba60426c4d9f10926f3159456 + md5: aa9c7d5cd427042ffbd59c9ef6014f98 + depends: + - cuda-version >=13.2,<13.3.0a0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 1103784 + timestamp: 1773104321614 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart_linux-64-13.1.80-h376f20c_0.conda + sha256: fca2951815564c36cf5a4e0f7ed0222429d206fda3d4e1aa3d52a969a293b868 + md5: 4dc4c3a1e010e06035f01d661c1b70bd + depends: + - cuda-version >=13.1,<13.2.0a0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 199654 + timestamp: 1764883502803 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart_linux-64-13.2.51-h376f20c_0.conda + sha256: e1d943a5582c8e171c9dcf2c0c72ddd5bf0a2ac9acd6ed15898d69d618cf53c6 + md5: 51a1624c7e26d8821b5d959ee7ecb517 + depends: + - cuda-version >=13.2,<13.3.0a0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 203460 + timestamp: 1773104333900 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-driver-dev_linux-64-13.1.80-h376f20c_0.conda + sha256: 83bf37d5a3b4a85853cded6a8b90db302b014845b7d9461ccdb84db8c2abfbc3 + md5: 1d7073905d0359ff234545494a933d59 + depends: + - cuda-version >=13.1,<13.2.0a0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 38992 + timestamp: 1764883514338 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-driver-dev_linux-64-13.2.51-h376f20c_0.conda + sha256: 1b372b7af937a3a2fdb1cbd5356e6b365f3495d899a413ebf98369ab0c5c0c79 + md5: 970891239574056829fc1cfc208278a7 + depends: + - cuda-version >=13.2,<13.3.0a0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 39485 + timestamp: 1773104345638 +- conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-nvrtc-13.1.115-hecca717_0.conda + sha256: 9cc4f9df70c02eea5121cdb0e865207b04cd52591f57ebcac2ba44fada10eb5b + md5: df16c9049d882cdaf4f83a5b90079589 + depends: + - __glibc >=2.17,<3.0.a0 + - cuda-version >=13.1,<13.2.0a0 + - libgcc >=14 + - libstdcxx >=14 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 35339417 + timestamp: 1768272955912 +- conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-nvrtc-13.2.78-hecca717_0.conda + sha256: 73fbc9d15c062c3ea60891e8183002f6b055fa6638402d17581677af0aaa20d8 + md5: 66623d882c42506fa3f1780b90841400 + depends: + - __glibc >=2.17,<3.0.a0 + - cuda-version >=13.2,<13.3.0a0 + - libgcc >=14 + - libstdcxx >=14 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 35670504 + timestamp: 1776109867257 +- conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-nvrtc-dev-13.1.115-hecca717_0.conda + sha256: 2c929c592ca1909e3944edec62b77403d256156a4010bfa17fb0b948d33e54d3 + md5: 1096fce4abad7dd975ce6d9953fceb6a + depends: + - __glibc >=2.17,<3.0.a0 + - cuda-nvrtc 13.1.115 hecca717_0 + - cuda-version >=13.1,<13.2.0a0 + - libgcc >=14 + - libstdcxx >=14 + constrains: + - cuda-nvrtc-static >=13.1.115 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 35845 + timestamp: 1768273073971 +- conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-nvrtc-dev-13.2.78-hecca717_0.conda + sha256: 12505f1bbc222acf2a63da5c84e4176d2f9c18b458e2bde28939fdf326b6d292 + md5: cc313f0ea18ebc6e713a8980611431f5 + depends: + - __glibc >=2.17,<3.0.a0 + - cuda-nvrtc 13.2.78 hecca717_0 + - cuda-version >=13.2,<13.3.0a0 + - libgcc >=14 + - libstdcxx >=14 + constrains: + - cuda-nvrtc-static >=13.2.78 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 36312 + timestamp: 1776109983818 +- conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-nvvm-13.2.51-h69a702a_0.conda + sha256: d0111ba8fa12b96d38989d2016ecec0c11410c0e566d839ed54f3925591efb0b + md5: 03cd3639b8e13623c7b91b1cb0136402 + depends: + - cuda-nvvm-dev_linux-64 13.2.51.* + - cuda-nvvm-impl 13.2.51.* + - cuda-nvvm-tools 13.2.51.* + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 25494 + timestamp: 1773157399568 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-nvvm-dev_linux-64-13.2.51-ha770c72_0.conda + sha256: f00fce92bf7f1da314654f7693f571a014aaa2ba1fae3762634f3e5be254da83 + md5: 57724ac113f7435762d0c39e1b1ad341 + depends: + - cuda-version >=13.2,<13.3.0a0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 28399 + timestamp: 1773115185916 +- conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-nvvm-impl-13.1.115-h4bc722e_0.conda + sha256: 12d84615684f1279799c023ce4ccc7c34f151bec2a90e0c8d04798a8c8af437c + md5: bf76661bc0de83a60537c4913f339fb3 + depends: + - __glibc >=2.17,<3.0.a0 + - cuda-version >=13.1,<13.2.0a0 + - libgcc >=12 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 21873791 + timestamp: 1768280315627 +- conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-nvvm-impl-13.2.51-h4bc722e_0.conda + sha256: bea7cbd2ff0f8bf07e0b90d522b4834533b4024237322c09f1b3875970c4abc9 + md5: 3c3872ff2bd6cc6368dcd4b35bb995f2 + depends: + - __glibc >=2.17,<3.0.a0 + - cuda-version >=13.2,<13.3.0a0 + - libgcc >=12 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 22202489 + timestamp: 1773115209641 +- conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-nvvm-tools-13.2.51-h4bc722e_0.conda + sha256: da5fd2dc57df2047215ff76f295685b1e1e586a46c2e46214120458cee18ee80 + md5: 2df6cd3b3d6d1365a2979285703056f9 + depends: + - __glibc >=2.17,<3.0.a0 + - cuda-version >=13.2,<13.3.0a0 + - libgcc >=12 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 25988523 + timestamp: 1773115248060 +- conda: ../../cuda_pathfinder + name: cuda-pathfinder + version: 1.3.4a0 + build: pyh4616a5c_0 + subdir: noarch + variants: + target_platform: noarch + depends: + - python >=3.10 + - python * + license: Apache-2.0 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-pathfinder-1.4.0-pyhc364b38_0.conda + sha256: edf16fdfbcce5bbb445118fd8d070dda8afe36b4b437a94f472fde153bc38151 + md5: 2d13e524da66b60e6e7d5c6585729ea8 + depends: + - python >=3.10 + - cuda-version >=12.0,<14 + - python + license: Apache-2.0 + license_family: APACHE + size: 39327 + timestamp: 1772059437166 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-version-13.1-h2ff5cdb_3.conda + sha256: 176ac20fdb95611af8fb2bf0d3d16fee998019b1d0f12fc9ddd5fa0df4553992 + md5: d85448460c25ee43ff2f8346bb9ad52b + constrains: + - cudatoolkit 13.1|13.1.* + - __cuda >=13 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 21511 + timestamp: 1757017115788 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-version-13.2-he2cc418_3.conda + sha256: 64aebe8ccb3a2c3ff446d3c0c0e88ef4fdb069a5732c03539bf3a37243c4c679 + md5: 45676e3dd76b30ec613f1f822d450eff + constrains: + - __cuda >=13 + - cudatoolkit 13.2|13.2.* + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 21908 + timestamp: 1773093709154 +- conda: https://conda.anaconda.org/conda-forge/linux-64/cxx-compiler-1.11.0-hfcd1e18_0.conda + sha256: 3fcc97ae3e89c150401a50a4de58794ffc67b1ed0e1851468fcc376980201e25 + md5: 5da8c935dca9186673987f79cef0b2a5 + depends: + - c-compiler 1.11.0 h4d9bdce_0 + - gxx + - gxx_linux-64 14.* + license: BSD-3-Clause + license_family: BSD + size: 6635 + timestamp: 1753098722177 +- conda: https://conda.anaconda.org/conda-forge/noarch/distlib-0.4.0-pyhd8ed1ab_0.conda + sha256: 6d977f0b2fc24fee21a9554389ab83070db341af6d6f09285360b2e09ef8b26e + md5: 003b8ba0a94e2f1e117d0bd46aebc901 + depends: + - python >=3.9 + license: Apache-2.0 + license_family: APACHE + size: 275642 + timestamp: 1752823081585 +- conda: https://conda.anaconda.org/conda-forge/noarch/exceptiongroup-1.3.1-pyhd8ed1ab_0.conda + sha256: ee6cf346d017d954255bbcbdb424cddea4d14e4ed7e9813e429db1d795d01144 + md5: 8e662bd460bda79b1ea39194e3c4c9ab + depends: + - python >=3.10 + - typing_extensions >=4.6.0 + license: MIT and PSF-2.0 + size: 21333 + timestamp: 1763918099466 +- conda: https://conda.anaconda.org/conda-forge/noarch/filelock-3.25.2-pyhd8ed1ab_0.conda + sha256: dddea9ec53d5e179de82c24569d41198f98db93314f0adae6b15195085d5567f + md5: f58064cec97b12a7136ebb8a6f8a129b + depends: + - python >=3.10 + license: Unlicense + size: 25845 + timestamp: 1773314012590 +- conda: https://conda.anaconda.org/conda-forge/linux-64/gcc-14.3.0-h0dff253_18.conda + sha256: 9b34b57b06b485e33a40d430f71ac88c8f381673592507cf7161c50ff0832772 + md5: 52d6457abc42e320787ada5f9033fa99 + depends: + - conda-gcc-specs + - gcc_impl_linux-64 14.3.0 hbdf3cc3_18 + license: BSD-3-Clause + license_family: BSD + size: 29506 + timestamp: 1771378321585 +- conda: https://conda.anaconda.org/conda-forge/linux-64/gcc_impl_linux-64-14.3.0-hbdf3cc3_18.conda + sha256: 3b31a273b806c6851e16e9cf63ef87cae28d19be0df148433f3948e7da795592 + md5: 30bb690150536f622873758b0e8d6712 + depends: + - binutils_impl_linux-64 >=2.45 + - libgcc >=14.3.0 + - libgcc-devel_linux-64 14.3.0 hf649bbc_118 + - libgomp >=14.3.0 + - libsanitizer 14.3.0 h8f1669f_18 + - libstdcxx >=14.3.0 + - libstdcxx-devel_linux-64 14.3.0 h9f08a49_118 + - sysroot_linux-64 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 76302378 + timestamp: 1771378056505 +- conda: https://conda.anaconda.org/conda-forge/linux-64/gcc_linux-64-14.3.0-h298d278_21.conda + sha256: 27ad0cd10dccffca74e20fb38c9f8643ff8fce56eee260bf89fa257d5ab0c90a + md5: 1403ed5fe091bd7442e4e8a229d14030 + depends: + - gcc_impl_linux-64 14.3.0.* + - binutils_linux-64 + - sysroot_linux-64 + license: BSD-3-Clause + license_family: BSD + size: 28946 + timestamp: 1770908213807 +- conda: https://conda.anaconda.org/conda-forge/linux-64/gxx-14.3.0-h76987e4_18.conda + sha256: 1b490c9be9669f9c559db7b2a1f7d8b973c58ca0c6f21a5d2ba3f0ab2da63362 + md5: 19189121d644d4ef75fed05383bc75f5 + depends: + - gcc 14.3.0 h0dff253_18 + - gxx_impl_linux-64 14.3.0 h2185e75_18 + license: BSD-3-Clause + license_family: BSD + size: 28883 + timestamp: 1771378355605 +- conda: https://conda.anaconda.org/conda-forge/linux-64/gxx_impl_linux-64-14.3.0-h2185e75_18.conda + sha256: 38ffca57cc9c264d461ac2ce9464a9d605e0f606d92d831de9075cb0d95fc68a + md5: 6514b3a10e84b6a849e1b15d3753eb22 + depends: + - gcc_impl_linux-64 14.3.0 hbdf3cc3_18 + - libstdcxx-devel_linux-64 14.3.0 h9f08a49_118 + - sysroot_linux-64 + - tzdata + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 14566100 + timestamp: 1771378271421 +- conda: https://conda.anaconda.org/conda-forge/linux-64/gxx_linux-64-14.3.0-he467f4b_21.conda + sha256: 1e07c197e0779fa9105e59cd55a835ded96bfde59eb169439736a89b27b48e5d + md5: 7b51f4ff82eeb1f386bfee20a7bed3ed + depends: + - gxx_impl_linux-64 14.3.0.* + - gcc_linux-64 ==14.3.0 h298d278_21 + - binutils_linux-64 + - sysroot_linux-64 + license: BSD-3-Clause + license_family: BSD + size: 27503 + timestamp: 1770908213813 +- conda: https://conda.anaconda.org/conda-forge/linux-64/icu-78.2-h33c6efd_0.conda + sha256: 142a722072fa96cf16ff98eaaf641f54ab84744af81754c292cb81e0881c0329 + md5: 186a18e3ba246eccfc7cff00cd19a870 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libstdcxx >=14 + license: MIT + license_family: MIT + size: 12728445 + timestamp: 1767969922681 +- conda: https://conda.anaconda.org/conda-forge/noarch/identify-2.6.17-pyhd8ed1ab_0.conda + sha256: 7cd5eccdb171a0adbf83a1ad8fc4e17822f4fc3f5518da9040de64e88bc07343 + md5: 5b7ae2ec4e0750e094f804a6cf1b2a37 + depends: + - python >=3.10 + - ukkonen + license: MIT + license_family: MIT + size: 79520 + timestamp: 1772402363021 +- conda: https://conda.anaconda.org/conda-forge/noarch/importlib-metadata-8.7.0-pyhe01879c_1.conda + sha256: c18ab120a0613ada4391b15981d86ff777b5690ca461ea7e9e49531e8f374745 + md5: 63ccfdc3a3ce25b027b8767eb722fca8 + depends: + - python >=3.9 + - zipp >=3.20 + - python + license: Apache-2.0 + license_family: APACHE + size: 34641 + timestamp: 1747934053147 +- conda: https://conda.anaconda.org/conda-forge/noarch/iniconfig-2.3.0-pyhd8ed1ab_0.conda + sha256: e1a9e3b1c8fe62dc3932a616c284b5d8cbe3124bbfbedcf4ce5c828cb166ee19 + md5: 9614359868482abba1bd15ce465e3c42 + depends: + - python >=3.10 + license: MIT + license_family: MIT + size: 13387 + timestamp: 1760831448842 +- conda: https://conda.anaconda.org/conda-forge/noarch/kernel-headers_linux-64-4.18.0-he073ed8_9.conda + sha256: 41557eeadf641de6aeae49486cef30d02a6912d8da98585d687894afd65b356a + md5: 86d9cba083cd041bfbf242a01a7a1999 + constrains: + - sysroot_linux-64 ==2.28 + license: LGPL-2.0-or-later AND LGPL-2.0-or-later WITH exceptions AND GPL-2.0-or-later + license_family: GPL + size: 1278712 + timestamp: 1765578681495 +- conda: https://conda.anaconda.org/conda-forge/linux-64/keyutils-1.6.3-hb9d3cd8_0.conda + sha256: 0960d06048a7185d3542d850986d807c6e37ca2e644342dd0c72feefcf26c2a4 + md5: b38117a3c920364aff79f870c984b4a3 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=13 + license: LGPL-2.1-or-later + size: 134088 + timestamp: 1754905959823 +- conda: https://conda.anaconda.org/conda-forge/linux-64/krb5-1.22.2-ha1258a1_0.conda + sha256: 3e307628ca3527448dd1cb14ad7bb9d04d1d28c7d4c5f97ba196ae984571dd25 + md5: fb53fb07ce46a575c5d004bbc96032c2 + depends: + - __glibc >=2.17,<3.0.a0 + - keyutils >=1.6.3,<2.0a0 + - libedit >=3.1.20250104,<3.2.0a0 + - libedit >=3.1.20250104,<4.0a0 + - libgcc >=14 + - libstdcxx >=14 + - openssl >=3.5.5,<4.0a0 + license: MIT + license_family: MIT + size: 1386730 + timestamp: 1769769569681 +- conda: https://conda.anaconda.org/conda-forge/linux-64/ld_impl_linux-64-2.45.1-default_hbd61a6d_101.conda + sha256: 565941ac1f8b0d2f2e8f02827cbca648f4d18cd461afc31f15604cd291b5c5f3 + md5: 12bd9a3f089ee6c9266a37dab82afabd + depends: + - __glibc >=2.17,<3.0.a0 + - zstd >=1.5.7,<1.6.0a0 + constrains: + - binutils_impl_linux-64 2.45.1 + license: GPL-3.0-only + license_family: GPL + size: 725507 + timestamp: 1770267139900 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libblas-3.11.0-5_h4a7cf45_openblas.conda + build_number: 5 + sha256: 18c72545080b86739352482ba14ba2c4815e19e26a7417ca21a95b76ec8da24c + md5: c160954f7418d7b6e87eaf05a8913fa9 + depends: + - libopenblas >=0.3.30,<0.3.31.0a0 + - libopenblas >=0.3.30,<1.0a0 + constrains: + - mkl <2026 + - liblapack 3.11.0 5*_openblas + - libcblas 3.11.0 5*_openblas + - blas 2.305 openblas + - liblapacke 3.11.0 5*_openblas + license: BSD-3-Clause + license_family: BSD + size: 18213 + timestamp: 1765818813880 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libcap-2.77-h3ff7636_0.conda + sha256: 9517cce5193144af0fcbf19b7bd67db0a329c2cc2618f28ffecaa921a1cbe9d3 + md5: 09c264d40c67b82b49a3f3b89037bd2e + depends: + - __glibc >=2.17,<3.0.a0 + - attr >=2.5.2,<2.6.0a0 + - libgcc >=14 + license: BSD-3-Clause + license_family: BSD + size: 121429 + timestamp: 1762349484074 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libcblas-3.11.0-5_h0358290_openblas.conda + build_number: 5 + sha256: 0cbdcc67901e02dc17f1d19e1f9170610bd828100dc207de4d5b6b8ad1ae7ad8 + md5: 6636a2b6f1a87572df2970d3ebc87cc0 + depends: + - libblas 3.11.0 5_h4a7cf45_openblas + constrains: + - liblapacke 3.11.0 5*_openblas + - blas 2.305 openblas + - liblapack 3.11.0 5*_openblas + license: BSD-3-Clause + license_family: BSD + size: 18194 + timestamp: 1765818837135 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libcufile-1.16.1.26-hd07211c_0.conda + sha256: 8c44b5bf947afad827df0df49fe7483cf1b2916694081b2db4fecdfd6a2bacd1 + md5: 48418c48dac04671fa46cb446122b8a5 + depends: + - __glibc >=2.28,<3.0.a0 + - cuda-version >=13.1,<13.2.0a0 + - libgcc >=14 + - libstdcxx >=14 + - rdma-core >=60.0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 990938 + timestamp: 1768273732081 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libcufile-1.17.1.22-h85c024f_0.conda + sha256: a24ad0ca488aa3e237049cd5b5c6d7fe3d2d4330682ed329203064e332ea1d74 + md5: 056a67706108efd1f9c24682ba8d3685 + depends: + - __glibc >=2.28,<3.0.a0 + - cuda-version >=13.2,<13.3.0a0 + - libgcc >=14 + - libstdcxx >=14 + - rdma-core >=61.0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 1082447 + timestamp: 1776110053053 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libcurl-8.18.0-hcf29cc6_1.conda + sha256: c84e8dccb65ad5149c0121e4b54bdc47fa39303fd5f4979b8c44bb51b39a369b + md5: 1707cdd636af2ff697b53186572c9f77 + depends: + - __glibc >=2.17,<3.0.a0 + - krb5 >=1.22.2,<1.23.0a0 + - libgcc >=14 + - libnghttp2 >=1.67.0,<2.0a0 + - libssh2 >=1.11.1,<2.0a0 + - libzlib >=1.3.1,<2.0a0 + - openssl >=3.5.5,<4.0a0 + - zstd >=1.5.7,<1.6.0a0 + license: curl + license_family: MIT + size: 463621 + timestamp: 1770892808818 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libedit-3.1.20250104-pl5321h7949ede_0.conda + sha256: d789471216e7aba3c184cd054ed61ce3f6dac6f87a50ec69291b9297f8c18724 + md5: c277e0a4d549b03ac1e9d6cbbe3d017b + depends: + - ncurses + - __glibc >=2.17,<3.0.a0 + - libgcc >=13 + - ncurses >=6.5,<7.0a0 + license: BSD-2-Clause + license_family: BSD + size: 134676 + timestamp: 1738479519902 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libev-4.33-hd590300_2.conda + sha256: 1cd6048169fa0395af74ed5d8f1716e22c19a81a8a36f934c110ca3ad4dd27b4 + md5: 172bf1cd1ff8629f2b1179945ed45055 + depends: + - libgcc-ng >=12 + license: BSD-2-Clause + license_family: BSD + size: 112766 + timestamp: 1702146165126 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libexpat-2.7.4-hecca717_0.conda + sha256: d78f1d3bea8c031d2f032b760f36676d87929b18146351c4464c66b0869df3f5 + md5: e7f7ce06ec24cfcfb9e36d28cf82ba57 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + constrains: + - expat 2.7.4.* + license: MIT + license_family: MIT + size: 76798 + timestamp: 1771259418166 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libffi-3.5.2-h3435931_0.conda + sha256: 31f19b6a88ce40ebc0d5a992c131f57d919f73c0b92cd1617a5bec83f6e961e6 + md5: a360c33a5abe61c07959e449fa1453eb + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + license: MIT + license_family: MIT + size: 58592 + timestamp: 1769456073053 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libgcc-15.2.0-he0feb66_18.conda + sha256: faf7d2017b4d718951e3a59d081eb09759152f93038479b768e3d612688f83f5 + md5: 0aa00f03f9e39fb9876085dee11a85d4 + depends: + - __glibc >=2.17,<3.0.a0 + - _openmp_mutex >=4.5 + constrains: + - libgcc-ng ==15.2.0=*_18 + - libgomp 15.2.0 he0feb66_18 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 1041788 + timestamp: 1771378212382 +- conda: https://conda.anaconda.org/conda-forge/noarch/libgcc-devel_linux-64-14.3.0-hf649bbc_118.conda + sha256: 1abc6a81ee66e8ac9ac09a26e2d6ad7bba23f0a0cc3a6118654f036f9c0e1854 + md5: 06901733131833f5edd68cf3d9679798 + depends: + - __unix + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 3084533 + timestamp: 1771377786730 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libgcc-ng-15.2.0-h69a702a_18.conda + sha256: e318a711400f536c81123e753d4c797a821021fb38970cebfb3f454126016893 + md5: d5e96b1ed75ca01906b3d2469b4ce493 + depends: + - libgcc 15.2.0 he0feb66_18 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 27526 + timestamp: 1771378224552 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libgfortran-15.2.0-h69a702a_18.conda + sha256: d2c9fad338fd85e4487424865da8e74006ab2e2475bd788f624d7a39b2a72aee + md5: 9063115da5bc35fdc3e1002e69b9ef6e + depends: + - libgfortran5 15.2.0 h68bc16d_18 + constrains: + - libgfortran-ng ==15.2.0=*_18 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 27523 + timestamp: 1771378269450 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libgfortran5-15.2.0-h68bc16d_18.conda + sha256: 539b57cf50ec85509a94ba9949b7e30717839e4d694bc94f30d41c9d34de2d12 + md5: 646855f357199a12f02a87382d429b75 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=15.2.0 + constrains: + - libgfortran 15.2.0 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 2482475 + timestamp: 1771378241063 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libgomp-15.2.0-he0feb66_18.conda + sha256: 21337ab58e5e0649d869ab168d4e609b033509de22521de1bfed0c031bfc5110 + md5: 239c5e9546c38a1e884d69effcf4c882 + depends: + - __glibc >=2.17,<3.0.a0 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 603262 + timestamp: 1771378117851 +- conda: https://conda.anaconda.org/conda-forge/linux-64/liblapack-3.11.0-5_h47877c9_openblas.conda + build_number: 5 + sha256: c723b6599fcd4c6c75dee728359ef418307280fa3e2ee376e14e85e5bbdda053 + md5: b38076eb5c8e40d0106beda6f95d7609 + depends: + - libblas 3.11.0 5_h4a7cf45_openblas + constrains: + - blas 2.305 openblas + - liblapacke 3.11.0 5*_openblas + - libcblas 3.11.0 5*_openblas + license: BSD-3-Clause + license_family: BSD + size: 18200 + timestamp: 1765818857876 +- conda: https://conda.anaconda.org/conda-forge/linux-64/liblzma-5.8.2-hb03c661_0.conda + sha256: 755c55ebab181d678c12e49cced893598f2bab22d582fbbf4d8b83c18be207eb + md5: c7c83eecbb72d88b940c249af56c8b17 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + constrains: + - xz 5.8.2.* + license: 0BSD + size: 113207 + timestamp: 1768752626120 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libmpdec-4.0.0-hb03c661_1.conda + sha256: fe171ed5cf5959993d43ff72de7596e8ac2853e9021dec0344e583734f1e0843 + md5: 2c21e66f50753a083cbe6b80f38268fa + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + license: BSD-2-Clause + license_family: BSD + size: 92400 + timestamp: 1769482286018 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libnghttp2-1.67.0-had1ee68_0.conda + sha256: a4a7dab8db4dc81c736e9a9b42bdfd97b087816e029e221380511960ac46c690 + md5: b499ce4b026493a13774bcf0f4c33849 + depends: + - __glibc >=2.17,<3.0.a0 + - c-ares >=1.34.5,<2.0a0 + - libev >=4.33,<4.34.0a0 + - libev >=4.33,<5.0a0 + - libgcc >=14 + - libstdcxx >=14 + - libzlib >=1.3.1,<2.0a0 + - openssl >=3.5.2,<4.0a0 + license: MIT + license_family: MIT + size: 666600 + timestamp: 1756834976695 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libnl-3.11.0-hb9d3cd8_0.conda + sha256: ba7c5d294e3d80f08ac5a39564217702d1a752e352e486210faff794ac5001b4 + md5: db63358239cbe1ff86242406d440e44a + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=13 + license: LGPL-2.1-or-later + license_family: LGPL + size: 741323 + timestamp: 1731846827427 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libnvfatbin-13.2.51-hecca717_0.conda + sha256: 66b7bbe40d259e4927b9c264569afd49d0e31a3813c585beea63f3415577f1b3 + md5: 7e6534bce7252c84efdedae1fae2148e + depends: + - __glibc >=2.17,<3.0.a0 + - cuda-version >=13.2,<13.3.0a0 + - libgcc >=14 + - libstdcxx >=14 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 471076 + timestamp: 1773100181931 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libnvjitlink-13.1.115-hecca717_1.conda + sha256: 6b5300bf9952da4bfdbfb45c13b042d786a0daffb1bd2fa45ea9ad971703fe96 + md5: 851acc1af02d31c732b931b9ffddc2d9 + depends: + - __glibc >=2.17,<3.0.a0 + - cuda-version >=13,<13.2.0a0 + - libgcc >=14 + - libstdcxx >=14 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 31328660 + timestamp: 1771443943495 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libnvjitlink-13.2.51-hecca717_0.conda + sha256: 2ca45a2c9e6cc307cea3c8a1bf27bceb745fa5e1150d7b768b63a781eeaee7a2 + md5: 20a82402e6851e5d4e0b13ee1083d370 + depends: + - __glibc >=2.17,<3.0.a0 + - cuda-version >=13,<13.3.0a0 + - libgcc >=14 + - libstdcxx >=14 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 31691081 + timestamp: 1773100788615 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libopenblas-0.3.30-pthreads_h94d23a6_4.conda + sha256: 199d79c237afb0d4780ccd2fbf829cea80743df60df4705202558675e07dd2c5 + md5: be43915efc66345cccb3c310b6ed0374 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libgfortran + - libgfortran5 >=14.3.0 + constrains: + - openblas >=0.3.30,<0.3.31.0a0 + license: BSD-3-Clause + license_family: BSD + size: 5927939 + timestamp: 1763114673331 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libsanitizer-14.3.0-h8f1669f_18.conda + sha256: e03ed186eefb46d7800224ad34bad1268c9d19ecb8f621380a50601c6221a4a7 + md5: ad3a0e2dc4cce549b2860e2ef0e6d75b + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14.3.0 + - libstdcxx >=14.3.0 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 7949259 + timestamp: 1771377982207 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libsqlite-3.51.2-hf4e2dac_0.conda + sha256: 04596fcee262a870e4b7c9807224680ff48d4d0cc0dac076a602503d3dc6d217 + md5: da5be73701eecd0e8454423fd6ffcf30 + depends: + - __glibc >=2.17,<3.0.a0 + - icu >=78.2,<79.0a0 + - libgcc >=14 + - libzlib >=1.3.1,<2.0a0 + license: blessing + size: 942808 + timestamp: 1768147973361 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libssh2-1.11.1-hcf80075_0.conda + sha256: fa39bfd69228a13e553bd24601332b7cfeb30ca11a3ca50bb028108fe90a7661 + md5: eecce068c7e4eddeb169591baac20ac4 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=13 + - libzlib >=1.3.1,<2.0a0 + - openssl >=3.5.0,<4.0a0 + license: BSD-3-Clause + license_family: BSD + size: 304790 + timestamp: 1745608545575 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libstdcxx-15.2.0-h934c35e_18.conda + sha256: 78668020064fdaa27e9ab65cd2997e2c837b564ab26ce3bf0e58a2ce1a525c6e + md5: 1b08cd684f34175e4514474793d44bcb + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc 15.2.0 he0feb66_18 + constrains: + - libstdcxx-ng ==15.2.0=*_18 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 5852330 + timestamp: 1771378262446 +- conda: https://conda.anaconda.org/conda-forge/noarch/libstdcxx-devel_linux-64-14.3.0-h9f08a49_118.conda + sha256: b1c3824769b92a1486bf3e2cc5f13304d83ae613ea061b7bc47bb6080d6dfdba + md5: 865a399bce236119301ebd1532fced8d + depends: + - __unix + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 20171098 + timestamp: 1771377827750 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libsystemd0-257.10-hd0affe5_4.conda + sha256: f0356bb344a684e7616fc84675cfca6401140320594e8686be30e8ac7547aed2 + md5: 1d4c18d75c51ed9d00092a891a547a7d + depends: + - __glibc >=2.17,<3.0.a0 + - libcap >=2.77,<2.78.0a0 + - libgcc >=14 + license: LGPL-2.1-or-later + size: 491953 + timestamp: 1770738638119 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libudev1-257.10-hd0affe5_4.conda + sha256: ed4d2c01fbeb1330f112f7e399408634db277d3dfb2dec1d0395f56feaa24351 + md5: 6c74fba677b61a0842cbf0f63eee683b + depends: + - __glibc >=2.17,<3.0.a0 + - libcap >=2.77,<2.78.0a0 + - libgcc >=14 + license: LGPL-2.1-or-later + size: 144654 + timestamp: 1770738650966 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libuuid-2.41.3-h5347b49_0.conda + sha256: 1a7539cfa7df00714e8943e18de0b06cceef6778e420a5ee3a2a145773758aee + md5: db409b7c1720428638e7c0d509d3e1b5 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + license: BSD-3-Clause + license_family: BSD + size: 40311 + timestamp: 1766271528534 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libuv-1.51.0-hb03c661_1.conda + sha256: c180f4124a889ac343fc59d15558e93667d894a966ec6fdb61da1604481be26b + md5: 0f03292cc56bf91a077a134ea8747118 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + license: MIT + license_family: MIT + size: 895108 + timestamp: 1753948278280 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libzlib-1.3.1-hb9d3cd8_2.conda + sha256: d4bfe88d7cb447768e31650f06257995601f89076080e76df55e3112d4e47dc4 + md5: edb0dca6bc32e4f4789199455a1dbeb8 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=13 + constrains: + - zlib 1.3.1 *_2 + license: Zlib + license_family: Other + size: 60963 + timestamp: 1727963148474 +- conda: https://conda.anaconda.org/conda-forge/linux-64/ncurses-6.5-h2d0b736_3.conda + sha256: 3fde293232fa3fca98635e1167de6b7c7fda83caf24b9d6c91ec9eefb4f4d586 + md5: 47e340acb35de30501a76c7c799c41d7 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=13 + license: X11 AND BSD-3-Clause + size: 891641 + timestamp: 1738195959188 +- conda: https://conda.anaconda.org/conda-forge/linux-64/ninja-1.13.2-h171cf75_0.conda + sha256: 6f7d59dbec0a7b00bf5d103a4306e8886678b796ff2151b62452d4582b2a53fb + md5: b518e9e92493721281a60fa975bddc65 + depends: + - libstdcxx >=14 + - libgcc >=14 + - __glibc >=2.17,<3.0.a0 + license: Apache-2.0 + license_family: APACHE + size: 186323 + timestamp: 1763688260928 +- conda: https://conda.anaconda.org/conda-forge/noarch/nodeenv-1.10.0-pyhd8ed1ab_0.conda + sha256: 4fa40e3e13fc6ea0a93f67dfc76c96190afd7ea4ffc1bac2612d954b42cdc3ee + md5: eb52d14a901e23c39e9e7b4a1a5c015f + depends: + - python >=3.10 + - setuptools + license: BSD-3-Clause + license_family: BSD + size: 40866 + timestamp: 1766261270149 +- conda: https://conda.anaconda.org/conda-forge/linux-64/numpy-2.4.2-py314h2b28147_1.conda + sha256: 1d8377c8001c15ed12c2713b723213474b435706ab9d34ede69795d64af9e94d + md5: 4ea6b620fdf24a1a0bc4f1c7134dfafb + depends: + - python + - libstdcxx >=14 + - libgcc >=14 + - __glibc >=2.17,<3.0.a0 + - libcblas >=3.9.0,<4.0a0 + - python_abi 3.14.* *_cp314 + - libblas >=3.9.0,<4.0a0 + - liblapack >=3.9.0,<4.0a0 + constrains: + - numpy-base <0a0 + license: BSD-3-Clause + license_family: BSD + size: 8926994 + timestamp: 1770098474394 +- conda: https://conda.anaconda.org/conda-forge/linux-64/openssl-3.6.1-h35e630c_1.conda + sha256: 44c877f8af015332a5d12f5ff0fb20ca32f896526a7d0cdb30c769df1144fb5c + md5: f61eb8cd60ff9057122a3d338b99c00f + depends: + - __glibc >=2.17,<3.0.a0 + - ca-certificates + - libgcc >=14 + license: Apache-2.0 + license_family: Apache + size: 3164551 + timestamp: 1769555830639 +- conda: https://conda.anaconda.org/conda-forge/noarch/packaging-26.0-pyhcf101f3_0.conda + sha256: c1fc0f953048f743385d31c468b4a678b3ad20caffdeaa94bed85ba63049fd58 + md5: b76541e68fea4d511b1ac46a28dcd2c6 + depends: + - python >=3.8 + - python + license: Apache-2.0 + license_family: APACHE + size: 72010 + timestamp: 1769093650580 +- conda: https://conda.anaconda.org/conda-forge/noarch/platformdirs-4.9.4-pyhcf101f3_0.conda + sha256: 0289f0a38337ee201d984f8f31f11f6ef076cfbbfd0ab9181d12d9d1d099bf46 + md5: 82c1787f2a65c0155ef9652466ee98d6 + depends: + - python >=3.10 + - python + license: MIT + license_family: MIT + size: 25646 + timestamp: 1773199142345 +- conda: https://conda.anaconda.org/conda-forge/noarch/pluggy-1.6.0-pyhf9edf01_1.conda + sha256: e14aafa63efa0528ca99ba568eaf506eb55a0371d12e6250aaaa61718d2eb62e + md5: d7585b6550ad04c8c5e21097ada2888e + depends: + - python >=3.9 + - python + license: MIT + license_family: MIT + size: 25877 + timestamp: 1764896838868 +- conda: https://conda.anaconda.org/conda-forge/noarch/pre-commit-4.5.1-pyha770c72_0.conda + sha256: 5b81b7516d4baf43d0c185896b245fa7384b25dc5615e7baa504b7fa4e07b706 + md5: 7f3ac694319c7eaf81a0325d6405e974 + depends: + - cfgv >=2.0.0 + - identify >=1.0.0 + - nodeenv >=0.11.1 + - python >=3.10 + - pyyaml >=5.1 + - virtualenv >=20.10.0 + license: MIT + license_family: MIT + size: 200827 + timestamp: 1765937577534 +- conda: https://conda.anaconda.org/conda-forge/noarch/py-cpuinfo-9.0.0-pyhd8ed1ab_1.conda + sha256: 6d8f03c13d085a569fde931892cded813474acbef2e03381a1a87f420c7da035 + md5: 46830ee16925d5ed250850503b5dc3a8 + depends: + - python >=3.9 + license: MIT + license_family: MIT + size: 25766 + timestamp: 1733236452235 +- conda: https://conda.anaconda.org/conda-forge/noarch/pycparser-2.22-pyh29332c3_1.conda + sha256: 79db7928d13fab2d892592223d7570f5061c192f27b9febd1a418427b719acc6 + md5: 12c566707c80111f9799308d9e265aef + depends: + - python >=3.9 + - python + license: BSD-3-Clause + license_family: BSD + size: 110100 + timestamp: 1733195786147 +- conda: https://conda.anaconda.org/conda-forge/noarch/pygments-2.19.2-pyhd8ed1ab_0.conda + sha256: 5577623b9f6685ece2697c6eb7511b4c9ac5fb607c9babc2646c811b428fd46a + md5: 6b6ece66ebcae2d5f326c77ef2c5a066 + depends: + - python >=3.9 + license: BSD-2-Clause + license_family: BSD + size: 889287 + timestamp: 1750615908735 +- conda: https://conda.anaconda.org/conda-forge/linux-64/pyperf-2.9.0-py314hdafbbf9_0.conda + sha256: 438c41b42530874928733299ca815f5994f36996c86024f3f37ca220ed910a07 + md5: ed166875b3876d5d7e6e39d2e8d1c6e3 + depends: + - python >=3.14,<3.15.0a0 + - python_abi 3.14.* *_cp314 + - six + license: MIT + license_family: MIT + size: 273897 + timestamp: 1765980972868 +- conda: https://conda.anaconda.org/conda-forge/noarch/pytest-9.0.2-pyhcf101f3_0.conda + sha256: 9e749fb465a8bedf0184d8b8996992a38de351f7c64e967031944978de03a520 + md5: 2b694bad8a50dc2f712f5368de866480 + depends: + - pygments >=2.7.2 + - python >=3.10 + - iniconfig >=1.0.1 + - packaging >=22 + - pluggy >=1.5,<2 + - tomli >=1 + - colorama >=0.4 + - exceptiongroup >=1 + - python + constrains: + - pytest-faulthandler >=2 + license: MIT + license_family: MIT + size: 299581 + timestamp: 1765062031645 +- conda: https://conda.anaconda.org/conda-forge/noarch/pytest-benchmark-5.2.3-pyhd8ed1ab_0.conda + sha256: 2f2229415a6e5387c1faaedf442ea8c07471cb2bf5ad1007b9cfb83ea85ca29a + md5: 0e7294ed4af8b833fcd2c101d647c3da + depends: + - py-cpuinfo + - pytest >=8.1 + - python >=3.10 + license: BSD-2-Clause + license_family: BSD + size: 43976 + timestamp: 1762716480208 +- conda: https://conda.anaconda.org/conda-forge/linux-64/python-3.14.3-h32b2ec7_101_cp314.conda + build_number: 101 + sha256: cb0628c5f1732f889f53a877484da98f5a0e0f47326622671396fb4f2b0cd6bd + md5: c014ad06e60441661737121d3eae8a60 + depends: + - __glibc >=2.17,<3.0.a0 + - bzip2 >=1.0.8,<2.0a0 + - ld_impl_linux-64 >=2.36.1 + - libexpat >=2.7.3,<3.0a0 + - libffi >=3.5.2,<3.6.0a0 + - libgcc >=14 + - liblzma >=5.8.2,<6.0a0 + - libmpdec >=4.0.0,<5.0a0 + - libsqlite >=3.51.2,<4.0a0 + - libuuid >=2.41.3,<3.0a0 + - libzlib >=1.3.1,<2.0a0 + - ncurses >=6.5,<7.0a0 + - openssl >=3.5.5,<4.0a0 + - python_abi 3.14.* *_cp314 + - readline >=8.3,<9.0a0 + - tk >=8.6.13,<8.7.0a0 + - tzdata + - zstd >=1.5.7,<1.6.0a0 + license: Python-2.0 + size: 36702440 + timestamp: 1770675584356 + python_site_packages_path: lib/python3.14/site-packages +- conda: https://conda.anaconda.org/conda-forge/noarch/python-discovery-1.1.3-pyhcf101f3_0.conda + sha256: 36429765f626c345710fbae14aeeda676c1745427667eb480bb855b7089affba + md5: 69fc0a99fc21b26b81026c72e00f83df + depends: + - python >=3.10 + - filelock >=3.15.4 + - platformdirs <5,>=4.3.6 + - python + license: MIT + license_family: MIT + size: 33996 + timestamp: 1773161039118 +- conda: https://conda.anaconda.org/conda-forge/noarch/python_abi-3.14-8_cp314.conda + build_number: 8 + sha256: ad6d2e9ac39751cc0529dd1566a26751a0bf2542adb0c232533d32e176e21db5 + md5: 0539938c55b6b1a59b560e843ad864a4 + constrains: + - python 3.14.* *_cp314 + license: BSD-3-Clause + license_family: BSD + size: 6989 + timestamp: 1752805904792 +- conda: https://conda.anaconda.org/conda-forge/linux-64/pyyaml-6.0.3-py314h67df5f8_1.conda + sha256: b318fb070c7a1f89980ef124b80a0b5ccf3928143708a85e0053cde0169c699d + md5: 2035f68f96be30dc60a5dfd7452c7941 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - python >=3.14,<3.15.0a0 + - python_abi 3.14.* *_cp314 + - yaml >=0.2.5,<0.3.0a0 + license: MIT + license_family: MIT + size: 202391 + timestamp: 1770223462836 +- conda: https://conda.anaconda.org/conda-forge/linux-64/rdma-core-61.0-h192683f_0.conda + sha256: 8e0b7962cf8bec9a016cd91a6c6dc1f9ebc8e7e316b1d572f7b9047d0de54717 + md5: d487d93d170e332ab39803e05912a762 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libnl >=3.11.0,<4.0a0 + - libstdcxx >=14 + - libsystemd0 >=257.10 + - libudev1 >=257.10 + license: Linux-OpenIB + license_family: BSD + size: 1268666 + timestamp: 1769154883613 +- conda: https://conda.anaconda.org/conda-forge/linux-64/readline-8.3-h853b02a_0.conda + sha256: 12ffde5a6f958e285aa22c191ca01bbd3d6e710aa852e00618fa6ddc59149002 + md5: d7d95fc8287ea7bf33e0e7116d2b95ec + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - ncurses >=6.5,<7.0a0 + license: GPL-3.0-only + license_family: GPL + size: 345073 + timestamp: 1765813471974 +- conda: https://conda.anaconda.org/conda-forge/linux-64/rhash-1.4.6-hb9d3cd8_1.conda + sha256: d5c73079c1dd2c2a313c3bfd81c73dbd066b7eb08d213778c8bff520091ae894 + md5: c1c9b02933fdb2cfb791d936c20e887e + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=13 + license: MIT + license_family: MIT + size: 193775 + timestamp: 1748644872902 +- conda: https://conda.anaconda.org/conda-forge/noarch/setuptools-82.0.1-pyh332efcf_0.conda + sha256: 82088a6e4daa33329a30bc26dc19a98c7c1d3f05c0f73ce9845d4eab4924e9e1 + md5: 8e194e7b992f99a5015edbd4ebd38efd + depends: + - python >=3.10 + license: MIT + license_family: MIT + size: 639697 + timestamp: 1773074868565 +- conda: https://conda.anaconda.org/conda-forge/noarch/six-1.17.0-pyhe01879c_1.conda + sha256: 458227f759d5e3fcec5d9b7acce54e10c9e1f4f4b7ec978f3bfd54ce4ee9853d + md5: 3339e3b65d58accf4ca4fb8748ab16b3 + depends: + - python >=3.9 + - python + license: MIT + license_family: MIT + size: 18455 + timestamp: 1753199211006 +- conda: https://conda.anaconda.org/conda-forge/noarch/sysroot_linux-64-2.28-h4ee821c_9.conda + sha256: c47299fe37aebb0fcf674b3be588e67e4afb86225be4b0d452c7eb75c086b851 + md5: 13dc3adbc692664cd3beabd216434749 + depends: + - __glibc >=2.28 + - kernel-headers_linux-64 4.18.0 he073ed8_9 + - tzdata + license: LGPL-2.0-or-later AND LGPL-2.0-or-later WITH exceptions AND GPL-2.0-or-later + license_family: GPL + size: 24008591 + timestamp: 1765578833462 +- conda: https://conda.anaconda.org/conda-forge/linux-64/tk-8.6.13-noxft_h366c992_103.conda + sha256: cafeec44494f842ffeca27e9c8b0c27ed714f93ac77ddadc6aaf726b5554ebac + md5: cffd3bdd58090148f4cfcd831f4b26ab + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libzlib >=1.3.1,<2.0a0 + constrains: + - xorg-libx11 >=1.8.12,<2.0a0 + license: TCL + license_family: BSD + size: 3301196 + timestamp: 1769460227866 +- conda: https://conda.anaconda.org/conda-forge/noarch/tomli-2.4.0-pyhcf101f3_0.conda + sha256: 62940c563de45790ba0f076b9f2085a842a65662268b02dd136a8e9b1eaf47a8 + md5: 72e780e9aa2d0a3295f59b1874e3768b + depends: + - python >=3.10 + - python + license: MIT + license_family: MIT + size: 21453 + timestamp: 1768146676791 +- conda: https://conda.anaconda.org/conda-forge/noarch/typing_extensions-4.15.0-pyhcf101f3_0.conda + sha256: 032271135bca55aeb156cee361c81350c6f3fb203f57d024d7e5a1fc9ef18731 + md5: 0caa1af407ecff61170c9437a808404d + depends: + - python >=3.10 + - python + license: PSF-2.0 + license_family: PSF + size: 51692 + timestamp: 1756220668932 +- conda: https://conda.anaconda.org/conda-forge/noarch/tzdata-2025c-hc9c84f9_1.conda + sha256: 1d30098909076af33a35017eed6f2953af1c769e273a0626a04722ac4acaba3c + md5: ad659d0a2b3e47e38d829aa8cad2d610 + license: LicenseRef-Public-Domain + size: 119135 + timestamp: 1767016325805 +- conda: https://conda.anaconda.org/conda-forge/linux-64/ukkonen-1.1.0-py314h9891dd4_0.conda + sha256: c84034056dc938c853e4f61e72e5bd37e2ec91927a661fb9762f678cbea52d43 + md5: 5d3c008e54c7f49592fca9c32896a76f + depends: + - __glibc >=2.17,<3.0.a0 + - cffi + - libgcc >=14 + - libstdcxx >=14 + - python >=3.14,<3.15.0a0 + - python_abi 3.14.* *_cp314 + license: MIT + license_family: MIT + size: 15004 + timestamp: 1769438727085 +- conda: https://conda.anaconda.org/conda-forge/noarch/virtualenv-21.2.0-pyhcf101f3_0.conda + sha256: b83246d145ba0e6814d2ed0b616293e56924e6c7d6649101f5a4f97f9e757ed1 + md5: 704c22301912f7e37d0a92b2e7d5942d + depends: + - python >=3.10 + - distlib >=0.3.7,<1 + - filelock <4,>=3.24.2 + - importlib-metadata >=6.6 + - platformdirs >=3.9.1,<5 + - python-discovery >=1 + - typing_extensions >=4.13.2 + - python + license: MIT + license_family: MIT + size: 4647775 + timestamp: 1773133660203 +- conda: https://conda.anaconda.org/conda-forge/linux-64/yaml-0.2.5-h280c20c_3.conda + sha256: 6d9ea2f731e284e9316d95fa61869fe7bbba33df7929f82693c121022810f4ad + md5: a77f85f77be52ff59391544bfe73390a + depends: + - libgcc >=14 + - __glibc >=2.17,<3.0.a0 + license: MIT + license_family: MIT + size: 85189 + timestamp: 1753484064210 +- conda: https://conda.anaconda.org/conda-forge/noarch/zipp-3.23.0-pyhcf101f3_1.conda + sha256: b4533f7d9efc976511a73ef7d4a2473406d7f4c750884be8e8620b0ce70f4dae + md5: 30cd29cb87d819caead4d55184c1d115 + depends: + - python >=3.10 + - python + license: MIT + license_family: MIT + size: 24194 + timestamp: 1764460141901 +- conda: https://conda.anaconda.org/conda-forge/linux-64/zstd-1.5.7-hb78ec9c_6.conda + sha256: 68f0206ca6e98fea941e5717cec780ed2873ffabc0e1ed34428c061e2c6268c7 + md5: 4a13eeac0b5c8e5b8ab496e6c4ddd829 + depends: + - __glibc >=2.17,<3.0.a0 + - libzlib >=1.3.1,<2.0a0 + license: BSD-3-Clause + license_family: BSD + size: 601375 + timestamp: 1764777111296 diff --git a/benchmarks/cuda_bindings/pixi.toml b/benchmarks/cuda_bindings/pixi.toml new file mode 100644 index 00000000000..92b7b2e336f --- /dev/null +++ b/benchmarks/cuda_bindings/pixi.toml @@ -0,0 +1,83 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +[workspace] +channels = ["conda-forge"] +platforms = ["linux-64"] +preview = ["pixi-build"] +channel-priority = "disabled" + +[feature.cu13.system-requirements] +cuda = "13" + +[feature.cu13-pinned.dependencies] +cuda-version = "13.1.*" + +[feature.cu13-source.dependencies] +cuda-version = "13.*" + +[feature.bench.dependencies] +python = "3.14.*" +pyperf = "*" +pytest = "*" +pytest-benchmark = "*" +numpy = "*" + +[feature.cpp-bench.dependencies] +cmake = "*" +ninja = "*" +cxx-compiler = "*" +cuda-cudart-dev = "*" +cuda-nvrtc-dev = "*" + +[feature.cpp-bench.target.linux-64.dependencies] +cuda-crt-dev_linux-64 = "*" +cuda-driver-dev_linux-64 = "*" + +[feature.cpp-bench.target.linux-64.activation.env] +CUDA_HOME = "$CONDA_PREFIX/targets/x86_64-linux" + +[feature.dev.dependencies] +pre-commit = "*" + +[feature.bindings-wheel.dependencies] +cuda-bindings = "==13.1.0" + +[feature.bindings-source.dependencies] +cuda-bindings = { path = "../../cuda_bindings" } + +[environments] +wheel = { features = ["cu13", "cu13-pinned", "bench", "cpp-bench", "dev", "bindings-wheel"] } +source = { features = ["cu13", "cu13-source", "bench", "cpp-bench", "dev", "bindings-source"] } + +[target.linux.tasks.bench] +cmd = ["python", "$PIXI_PROJECT_ROOT/run_pyperf.py"] + +[target.linux.tasks.bench-smoke-test] +cmd = ["python", "$PIXI_PROJECT_ROOT/run_pyperf.py", "--debug-single-value"] + +[target.linux.tasks.bench-cpp-configure] +cmd = [ + "cmake", + "-S", + "$PIXI_PROJECT_ROOT/benchmarks/cpp", + "-B", + "$PIXI_PROJECT_ROOT/.build/cpp", + "-G", + "Ninja", +] + +[target.linux.tasks.bench-cpp-build] +cmd = ["cmake", "--build", "$PIXI_PROJECT_ROOT/.build/cpp"] +depends-on = [{ task = "bench-cpp-configure" }] + +[target.linux.tasks.bench-cpp] +cmd = ["python", "$PIXI_PROJECT_ROOT/run_cpp.py"] +depends-on = [{ task = "bench-cpp-build" }] + +[target.linux.tasks.bench-compare] +cmd = ["python", "$PIXI_PROJECT_ROOT/compare.py"] + +[target.linux.tasks.lint] +cmd = ["pre-commit", "run", "--all-files"] diff --git a/benchmarks/cuda_bindings/run_cpp.py b/benchmarks/cuda_bindings/run_cpp.py new file mode 100644 index 00000000000..96e50cb890f --- /dev/null +++ b/benchmarks/cuda_bindings/run_cpp.py @@ -0,0 +1,8 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from runner.cpp import main + +if __name__ == "__main__": + main() diff --git a/benchmarks/cuda_bindings/run_pyperf.py b/benchmarks/cuda_bindings/run_pyperf.py new file mode 100644 index 00000000000..f45af8c69a3 --- /dev/null +++ b/benchmarks/cuda_bindings/run_pyperf.py @@ -0,0 +1,8 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from runner.main import main + +if __name__ == "__main__": + main() diff --git a/benchmarks/cuda_bindings/runner/__init__.py b/benchmarks/cuda_bindings/runner/__init__.py new file mode 100644 index 00000000000..27422b3cb7e --- /dev/null +++ b/benchmarks/cuda_bindings/runner/__init__.py @@ -0,0 +1,3 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 diff --git a/benchmarks/cuda_bindings/runner/cpp.py b/benchmarks/cuda_bindings/runner/cpp.py new file mode 100644 index 00000000000..f752d677100 --- /dev/null +++ b/benchmarks/cuda_bindings/runner/cpp.py @@ -0,0 +1,189 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +import argparse +import json +import subprocess +import sys +import tempfile +from pathlib import Path + +PROJECT_ROOT = Path(__file__).resolve().parent.parent +BUILD_DIR = PROJECT_ROOT / ".build" / "cpp" +DEFAULT_OUTPUT = PROJECT_ROOT / "results-cpp.json" + +BINARY_PREFIX = "bench_" +BINARY_SUFFIX = "_cpp" + + +def discover_binaries() -> dict[str, Path]: + """Discover C++ benchmark binaries in the build directory""" + if not BUILD_DIR.is_dir(): + return {} + + registry: dict[str, Path] = {} + for path in sorted(BUILD_DIR.iterdir()): + if not path.is_file() or not path.name.startswith(BINARY_PREFIX): + continue + if not path.name.endswith(BINARY_SUFFIX): + continue + name = path.name.removeprefix(BINARY_PREFIX).removesuffix(BINARY_SUFFIX) + registry[name] = path + return registry + + +def strip_output_args(argv: list[str]) -> list[str]: + cleaned: list[str] = [] + skip_next = False + for arg in argv: + if skip_next: + skip_next = False + continue + if arg in ("-o", "--output"): + skip_next = True + continue + if arg.startswith(("-o=", "--output=")): + continue + cleaned.append(arg) + return cleaned + + +def merge_pyperf_json(individual_files: list[Path], output_path: Path) -> int: + """Merge individual pyperf JSON files into a single BenchmarkSuite file. + + Each C++ binary produces a file with structure: + {"version": "1.0", "metadata": {...}, "benchmarks": [{...}]} + + We merge them by collecting all benchmark entries into one file. + """ + all_benchmarks = [] + + for path in individual_files: + with open(path) as f: + data = json.load(f) + + file_metadata = data.get("metadata", {}) + bench_name = file_metadata.get("name", "") + loops = file_metadata.get("loops") + unit = file_metadata.get("unit", "second") + + for bench in data.get("benchmarks", []): + for run in bench.get("runs", []): + run_meta = run.setdefault("metadata", {}) + if bench_name: + run_meta.setdefault("name", bench_name) + if loops is not None: + run_meta.setdefault("loops", loops) + run_meta.setdefault("unit", unit) + + all_benchmarks.append(bench) + + merged = { + "version": "1.0", + "benchmarks": all_benchmarks, + } + + with open(output_path, "w") as f: + json.dump(merged, f) + + return len(all_benchmarks) + + +def parse_args(argv: list[str]) -> tuple[argparse.Namespace, list[str]]: + parser = argparse.ArgumentParser( + description="Run C++ CUDA benchmarks", + add_help=False, + ) + parser.add_argument( + "--benchmark", + action="append", + default=[], + help="Benchmark name to run (e.g. 'ctx_device'). Repeat for multiple. Defaults to all.", + ) + parser.add_argument( + "--list", + action="store_true", + help="Print discovered benchmark names and exit.", + ) + parser.add_argument( + "-o", + "--output", + type=Path, + default=DEFAULT_OUTPUT, + help=f"JSON output file path (default: {DEFAULT_OUTPUT.name})", + ) + parsed, remaining = parser.parse_known_args(argv) + return parsed, remaining + + +def main() -> None: + parsed, remaining_argv = parse_args(sys.argv[1:]) + + registry = discover_binaries() + if not registry: + print( + f"No C++ benchmark binaries found in {BUILD_DIR}.\nRun 'pixi run bench-cpp-build' first.", + file=sys.stderr, + ) + sys.exit(1) + + if parsed.list: + for name in sorted(registry): + print(name) + return + + if parsed.benchmark: + missing = sorted(set(parsed.benchmark) - set(registry)) + if missing: + known = ", ".join(sorted(registry)) + unknown = ", ".join(missing) + print( + f"Unknown benchmark(s): {unknown}. Known benchmarks: {known}", + file=sys.stderr, + ) + sys.exit(1) + names = parsed.benchmark + else: + names = sorted(registry) + + # Strip any --output args to avoid conflicts with our output handling + passthrough_argv = strip_output_args(remaining_argv) + + output_path = parsed.output.resolve() + failed = False + individual_files: list[Path] = [] + + with tempfile.TemporaryDirectory(prefix="cuda_bench_cpp_") as tmpdir: + tmpdir_path = Path(tmpdir) + + for name in names: + binary = registry[name] + tmp_json = tmpdir_path / f"{name}.json" + cmd = [str(binary), "-o", str(tmp_json), *passthrough_argv] + result = subprocess.run(cmd, check=False) # noqa: S603 + if result.returncode != 0: + print(f"FAILED: {name} (exit code {result.returncode})", file=sys.stderr) + failed = True + elif tmp_json.exists(): + individual_files.append(tmp_json) + + if individual_files: + count = merge_pyperf_json(individual_files, output_path) + print(f"\nResults saved to {output_path} ({count} benchmark(s))") + + if not individual_files and not failed: + print( + "No C++ benchmark results were produced. The selected benchmark " + "binaries may have skipped every benchmark on this driver/device. " + "Existing output file (if any) was left untouched.", + file=sys.stderr, + ) + sys.exit(1) + + if failed: + sys.exit(1) + + +if __name__ == "__main__": + main() diff --git a/benchmarks/cuda_bindings/runner/main.py b/benchmarks/cuda_bindings/runner/main.py new file mode 100644 index 00000000000..9c984c340d6 --- /dev/null +++ b/benchmarks/cuda_bindings/runner/main.py @@ -0,0 +1,317 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +import argparse +import ast +import importlib.util +import os +import sys +from collections.abc import Callable +from pathlib import Path +from types import ModuleType + +import pyperf + +PROJECT_ROOT = Path(__file__).resolve().parent.parent +BENCH_DIR = PROJECT_ROOT / "benchmarks" +DEFAULT_OUTPUT = PROJECT_ROOT / "results-python.json" +DEFAULT_MODULE_NAME_PREFIX = "cuda_bindings_bench" +# Env var used to propagate the --benchmark filter from the parent to pyperf +# worker subprocesses. pyperf reconstructs worker argv from scratch and drops +# custom flags like --benchmark, so without this the worker would register the +# full bench list and pyperf would run the wrong bench by task index. +DEFAULT_BENCH_FILTER_ENV_VAR = "CUDA_BINDINGS_BENCH_FILTER" + +BASE_PYPERF_INHERITED_ENV_VARS = ( + "CUDA_HOME", + "CUDA_PATH", + "CUDA_VISIBLE_DEVICES", + "LD_LIBRARY_PATH", + "NVIDIA_VISIBLE_DEVICES", +) +_MODULE_CACHE: dict[Path, ModuleType] = {} + + +def load_module(module_path: Path, module_name_prefix: str = DEFAULT_MODULE_NAME_PREFIX) -> ModuleType: + module_path = module_path.resolve() + cached_module = _MODULE_CACHE.get(module_path) + if cached_module is not None: + return cached_module + + module_name = f"{module_name_prefix}_{module_path.stem}" + spec = importlib.util.spec_from_file_location(module_name, module_path) + if spec is None or spec.loader is None: + raise RuntimeError(f"Failed to load benchmark module: {module_path}") + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + _MODULE_CACHE[module_path] = module + return module + + +def benchmark_id(module_name: str, function_name: str) -> str: + module_suffix = module_name.removeprefix("bench_") + suffix = function_name.removeprefix("bench_") + return f"{module_suffix}.{suffix}" + + +def _discover_module_functions(module_path: Path) -> list[str]: + tree = ast.parse(module_path.read_text(encoding="utf-8"), filename=str(module_path)) + return [ + node.name + for node in tree.body + if isinstance(node, ast.FunctionDef | ast.AsyncFunctionDef) and node.name.startswith("bench_") + ] + + +def _lazy_benchmark( + module_path: Path, + function_name: str, + module_name_prefix: str = DEFAULT_MODULE_NAME_PREFIX, +) -> Callable[[int], float]: + loaded_function: Callable[[int], float] | None = None + + def run(loops: int) -> float: + nonlocal loaded_function + if loaded_function is None: + module = load_module(module_path, module_name_prefix=module_name_prefix) + loaded_function = getattr(module, function_name) + return loaded_function(loops) + + run.__name__ = function_name + # Expose the binding source so the runner can introspect skip lists before + # handing the benchmark to pyperf. Accessing these attributes does not + # trigger module import — discovery stays lazy. + run._bench_module_path = module_path # type: ignore[attr-defined] + run._bench_function_name = function_name # type: ignore[attr-defined] + return run + + +def _collect_skipped_benchmarks( + bench_ids: list[str], + registry: dict[str, Callable[[int], float]], + module_name_prefix: str = DEFAULT_MODULE_NAME_PREFIX, +) -> set[str]: + """Return bench IDs that the owning module has marked as unsupported. + + Benchmark modules may declare a module-level + ``SKIPPED_BENCHMARKS: set[str]`` containing the names of ``bench_*`` + functions whose underlying API is unavailable on the current driver or + device (e.g. TMA encoders on pre-Hopper GPUs). Loading the module runs + its import-time probe, so this call is the same cost as the first + real invocation would have been. + """ + skipped: set[str] = set() + loaded_modules: dict[Path, ModuleType] = {} + for bench_id in bench_ids: + fn = registry[bench_id] + module_path = getattr(fn, "_bench_module_path", None) + function_name = getattr(fn, "_bench_function_name", None) + if module_path is None or function_name is None: + continue + module = loaded_modules.get(module_path) + if module is None: + module = load_module(module_path, module_name_prefix=module_name_prefix) + loaded_modules[module_path] = module + module_skip = getattr(module, "SKIPPED_BENCHMARKS", None) + if module_skip and function_name in module_skip: + skipped.add(bench_id) + return skipped + + +def discover_benchmarks( + bench_dir: Path | None = None, + module_name_prefix: str = DEFAULT_MODULE_NAME_PREFIX, +) -> dict[str, Callable[[int], float]]: + """Discover bench_ functions. + + Each bench_ function must have the signature: bench_*(loops: int) -> float + where it calls the operation `loops` times and returns the total elapsed + time in seconds (using time.perf_counter). + """ + # Resolve the default inside the call so tests (and embedders) can + # monkeypatch ``BENCH_DIR`` at the module level — Python binds default + # args at def-time, so a literal default would ignore later patches. + if bench_dir is None: + bench_dir = BENCH_DIR + registry: dict[str, Callable[[int], float]] = {} + for module_path in sorted(bench_dir.glob("bench_*.py")): + module_name = module_path.stem + for function_name in _discover_module_functions(module_path): + bench_id = benchmark_id(module_name, function_name) + if bench_id in registry: + raise ValueError(f"Duplicate benchmark ID discovered: {bench_id}") + registry[bench_id] = _lazy_benchmark(module_path, function_name, module_name_prefix=module_name_prefix) + return registry + + +def strip_pyperf_output_args(argv: list[str]) -> list[str]: + cleaned: list[str] = [] + skip_next = False + for arg in argv: + if skip_next: + skip_next = False + continue + if arg in ("-o", "--output", "--append"): + skip_next = True + continue + if arg.startswith(("-o=", "--output=", "--append=")): + continue + cleaned.append(arg) + return cleaned + + +def _split_env_vars(arg_value: str) -> list[str]: + return [env_var for env_var in arg_value.split(",") if env_var] + + +def ensure_pyperf_worker_env( + argv: list[str], + extra_env_vars: tuple[str, ...] = (DEFAULT_BENCH_FILTER_ENV_VAR,), +) -> list[str]: + if "--copy-env" in argv: + return list(argv) + + inherited_env: list[str] = [] + cleaned: list[str] = [] + skip_next = False + for arg in argv: + if skip_next: + inherited_env.extend(_split_env_vars(arg)) + skip_next = False + continue + if arg == "--inherit-environ": + skip_next = True + continue + if arg.startswith("--inherit-environ="): + inherited_env.extend(_split_env_vars(arg.partition("=")[2])) + continue + cleaned.append(arg) + + if skip_next: + raise ValueError("Missing value for --inherit-environ") + + for env_var in (*BASE_PYPERF_INHERITED_ENV_VARS, *extra_env_vars): + if env_var in os.environ: + inherited_env.append(env_var) + + deduped_env: list[str] = [] + for env_var in inherited_env: + if env_var not in deduped_env: + deduped_env.append(env_var) + + if deduped_env: + cleaned.extend(["--inherit-environ", ",".join(deduped_env)]) + + return cleaned + + +def parse_args(argv: list[str], default_output: Path = DEFAULT_OUTPUT) -> tuple[argparse.Namespace, list[str]]: + parser = argparse.ArgumentParser(add_help=False) + parser.add_argument( + "--benchmark", + action="append", + default=[], + help="Benchmark ID to run. Repeat to run multiple IDs. Defaults to all.", + ) + parser.add_argument( + "--list", + action="store_true", + help="Print discovered benchmark IDs and exit.", + ) + parser.add_argument( + "-o", + "--output", + type=Path, + default=default_output, + help=f"JSON output file path (default: {default_output.name})", + ) + parsed, remaining = parser.parse_known_args(argv) + return parsed, remaining + + +def main( + *, + bench_dir: Path = BENCH_DIR, + default_output: Path = DEFAULT_OUTPUT, + module_name_prefix: str = DEFAULT_MODULE_NAME_PREFIX, + bench_filter_env_var: str = DEFAULT_BENCH_FILTER_ENV_VAR, +) -> None: + parsed, remaining_argv = parse_args(sys.argv[1:], default_output=default_output) + + registry = discover_benchmarks(bench_dir=bench_dir, module_name_prefix=module_name_prefix) + if not registry: + raise RuntimeError(f"No benchmark functions found in {bench_dir}") + + if parsed.list: + for bench_id in sorted(registry): + print(bench_id) + return + + # The --benchmark filter must be the same in the parent and in any pyperf + # worker subprocess, otherwise pyperf's task-index bookkeeping points at + # the wrong bench. pyperf drops unknown CLI flags when spawning workers, + # so fall back to an env var carrying the filter. + requested = list(parsed.benchmark) + env_filter = os.environ.get(bench_filter_env_var, "") + if not requested and env_filter: + requested = [bid for bid in env_filter.split(",") if bid] + + if requested: + missing = sorted(set(requested) - set(registry)) + if missing: + known = ", ".join(sorted(registry)) + unknown = ", ".join(missing) + raise ValueError(f"Unknown benchmark(s): {unknown}. Known benchmarks: {known}") + benchmark_ids = requested + # Propagate to any pyperf worker we're about to spawn. + os.environ[bench_filter_env_var] = ",".join(benchmark_ids) + else: + benchmark_ids = sorted(registry) + + # Strip any --output args to avoid conflicts with our output handling. + output_path = parsed.output.resolve() + remaining_argv = strip_pyperf_output_args(remaining_argv) + remaining_argv = ensure_pyperf_worker_env(remaining_argv, extra_env_vars=(bench_filter_env_var,)) + is_worker = "--worker" in remaining_argv + + # Drop benchmarks that the owning module has marked as unavailable on + # this driver/device. Without this step a single unsupported bench + # (e.g. TMA on a pre-Hopper GPU) would abort the whole pyperf run, + # since pyperf treats a raised exception as a fatal worker failure. + skipped = _collect_skipped_benchmarks(benchmark_ids, registry, module_name_prefix=module_name_prefix) + if skipped and not is_worker: + for bench_id in sorted(skipped): + print(f"Skipping {bench_id}: unsupported on this driver/device", file=sys.stderr) + benchmark_ids = [bench_id for bench_id in benchmark_ids if bench_id not in skipped] + + # If every selected benchmark was skipped, fail loudly instead of silently + # printing "Results saved" with no output. Leave any existing output file + # untouched so a prior successful run is not destroyed. + if not benchmark_ids: + if not is_worker: + print( + "No benchmarks to run: every selected benchmark is unsupported " + "on this driver/device. Existing output file (if any) was left " + "untouched.", + file=sys.stderr, + ) + sys.exit(1) + + # Delete the file so this run starts fresh. Only destructive once we know + # at least one benchmark will actually run. + if not is_worker: + output_path.unlink(missing_ok=True) + + sys.argv = [sys.argv[0], "--append", str(output_path), *remaining_argv] + + runner = pyperf.Runner() + for bench_id in benchmark_ids: + runner.bench_time_func(bench_id, registry[bench_id]) + + if not is_worker: + print(f"\nResults saved to {output_path}") + + +if __name__ == "__main__": + main() diff --git a/benchmarks/cuda_bindings/runner/runtime.py b/benchmarks/cuda_bindings/runner/runtime.py new file mode 100644 index 00000000000..153d92f259d --- /dev/null +++ b/benchmarks/cuda_bindings/runner/runtime.py @@ -0,0 +1,117 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +import atexit + +from cuda.bindings import driver as cuda +from cuda.bindings import nvrtc + +_ctx = None +_device = None +_persistent_ptrs: list[int] = [] +_modules: list = [] + + +def assert_drv(err) -> None: + if err != cuda.CUresult.CUDA_SUCCESS: + raise RuntimeError(f"Cuda Error: {err}") + + +def ensure_context() -> int: + global _ctx, _device + if _ctx is not None: + return _ctx + + (err,) = cuda.cuInit(0) + assert_drv(err) + + err, device = cuda.cuDeviceGet(0) + assert_drv(err) + _device = device + + err, ctx = cuda.cuCtxCreate(None, 0, device) + assert_drv(err) + _ctx = ctx + return ctx + + +def alloc_persistent(size: int) -> int: + ensure_context() + err, ptr = cuda.cuMemAlloc(size) + assert_drv(err) + _persistent_ptrs.append(ptr) + return ptr + + +def register_module(module) -> int: + _modules.append(module) + return module + + +def compile_cubin(kernel_source: str) -> bytes: + """Compile CUDA C source with NVRTC and return the raw cubin bytes.""" + ensure_context() + + err, major = cuda.cuDeviceGetAttribute( + cuda.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR, _device + ) + assert_drv(err) + err, minor = cuda.cuDeviceGetAttribute( + cuda.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR, _device + ) + assert_drv(err) + + err, prog = nvrtc.nvrtcCreateProgram(kernel_source.encode(), b"benchmark_kernel.cu", 0, [], []) + assert_drv(err) + + arch_flag = f"--gpu-architecture=sm_{major}{minor}".encode() + (err,) = nvrtc.nvrtcCompileProgram(prog, 2, [b"--fmad=false", arch_flag]) + + # check for compile errors + err_log, log_size = nvrtc.nvrtcGetProgramLogSize(prog) + assert_drv(err_log) + log = b" " * log_size + (err_log,) = nvrtc.nvrtcGetProgramLog(prog, log) + assert_drv(err_log) + assert_drv(err) + + err, cubin_size = nvrtc.nvrtcGetCUBINSize(prog) + assert_drv(err) + cubin = b" " * cubin_size + (err,) = nvrtc.nvrtcGetCUBIN(prog, cubin) + assert_drv(err) + (err,) = nvrtc.nvrtcDestroyProgram(prog) + assert_drv(err) + + return cubin + + +def compile_and_load(kernel_source: str) -> int: + """Compile CUDA C source and return the CUmodule handle.""" + cubin = compile_cubin(kernel_source) + err, module = cuda.cuModuleLoadData(cubin) + assert_drv(err) + return register_module(module) + + +def cleanup() -> None: + global _ctx + for ptr in reversed(_persistent_ptrs): + (err,) = cuda.cuMemFree(ptr) + assert_drv(err) + _persistent_ptrs.clear() + + for module in reversed(_modules): + (err,) = cuda.cuModuleUnload(module) + assert_drv(err) + _modules.clear() + + if _ctx is None: + return + (err,) = cuda.cuCtxDestroy(_ctx) + assert_drv(err) + _ctx = None + + +atexit.register(cleanup) diff --git a/benchmarks/cuda_bindings/tests/test_runner.py b/benchmarks/cuda_bindings/tests/test_runner.py new file mode 100644 index 00000000000..56d88444c9e --- /dev/null +++ b/benchmarks/cuda_bindings/tests/test_runner.py @@ -0,0 +1,166 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +from __future__ import annotations + +import importlib.util +import itertools +import sys +import types +from pathlib import Path + +REPO_ROOT = Path(__file__).resolve().parents[3] +RUNNER_MAIN_PATH = REPO_ROOT / "benchmarks/cuda_bindings/runner/main.py" +BENCH_LAUNCH_PATH = REPO_ROOT / "benchmarks/cuda_bindings/benchmarks/bench_launch.py" + + +def load_module_from_path(module_name: str, module_path: Path): + spec = importlib.util.spec_from_file_location(module_name, module_path) + if spec is None or spec.loader is None: + raise RuntimeError(f"Failed to load test module: {module_path}") + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + return module + + +def load_runner_main(monkeypatch): + pyperf_module = types.ModuleType("pyperf") + + class FakeRunner: + def bench_time_func(self, *_args, **_kwargs) -> None: + raise AssertionError("FakeRunner should not be used in these tests") + + pyperf_module.Runner = FakeRunner + monkeypatch.setitem(sys.modules, "pyperf", pyperf_module) + return load_module_from_path("test_cuda_bindings_bench_runner_main", RUNNER_MAIN_PATH) + + +def load_bench_launch(monkeypatch, calls: list[tuple]): + pointer_values = itertools.count(1000) + + runtime_module = types.ModuleType("runner.runtime") + + def alloc_persistent(size: int) -> int: + calls.append(("alloc_persistent", size)) + return next(pointer_values) + + def assert_drv(err) -> None: + calls.append(("assert_drv", err)) + assert err == 0 + + def compile_and_load(source: str) -> str: + calls.append(("compile_and_load", source)) + return "module" + + runtime_module.alloc_persistent = alloc_persistent + runtime_module.assert_drv = assert_drv + runtime_module.compile_and_load = compile_and_load + + runner_module = types.ModuleType("runner") + runner_module.runtime = runtime_module + + driver_module = types.ModuleType("cuda.bindings.driver") + + class FakeCUresult: + CUDA_SUCCESS = 0 + + class FakeCUstreamFlags: + CU_STREAM_NON_BLOCKING = types.SimpleNamespace(value=1) + + def cuModuleGetFunction(module, name): + calls.append(("cuModuleGetFunction", module, name)) + return 0, name + + def cuStreamCreate(flags): + calls.append(("cuStreamCreate", flags)) + return 0, "stream" + + def cuLaunchKernel(*args): + calls.append(("cuLaunchKernel", args)) + return 0 + + driver_module.CUresult = FakeCUresult + driver_module.CUstream_flags = FakeCUstreamFlags + driver_module.cuModuleGetFunction = cuModuleGetFunction + driver_module.cuStreamCreate = cuStreamCreate + driver_module.cuLaunchKernel = cuLaunchKernel + + cuda_module = types.ModuleType("cuda") + bindings_module = types.ModuleType("cuda.bindings") + bindings_module.driver = driver_module + cuda_module.bindings = bindings_module + + monkeypatch.setitem(sys.modules, "runner", runner_module) + monkeypatch.setitem(sys.modules, "runner.runtime", runtime_module) + monkeypatch.setitem(sys.modules, "cuda", cuda_module) + monkeypatch.setitem(sys.modules, "cuda.bindings", bindings_module) + monkeypatch.setitem(sys.modules, "cuda.bindings.driver", driver_module) + + return load_module_from_path("test_cuda_bindings_bench_launch", BENCH_LAUNCH_PATH) + + +def test_discover_benchmarks_is_lazy(monkeypatch, tmp_path): + runner_main = load_runner_main(monkeypatch) + + marker_path = tmp_path / "imported.txt" + bench_path = tmp_path / "bench_lazy.py" + bench_path.write_text( + "\n".join( + ( + "from pathlib import Path", + f"Path({str(marker_path)!r}).write_text('imported')", + "", + "def helper() -> float:", + " return 0.0", + "", + "def bench_visible(loops: int) -> float:", + " return loops + 0.5", + "", + ) + ), + encoding="utf-8", + ) + + monkeypatch.setattr(runner_main, "BENCH_DIR", tmp_path) + runner_main._MODULE_CACHE.clear() + + registry = runner_main.discover_benchmarks() + + assert sorted(registry) == ["lazy.visible"] + assert not marker_path.exists() + assert registry["lazy.visible"](3) == 3.5 + assert marker_path.read_text(encoding="utf-8") == "imported" + + +def test_ensure_pyperf_worker_env_preserves_existing_args(monkeypatch): + runner_main = load_runner_main(monkeypatch) + + for env_var in runner_main.BASE_PYPERF_INHERITED_ENV_VARS: + monkeypatch.delenv(env_var, raising=False) + monkeypatch.setenv("CUDA_PATH", "/opt/cuda") + monkeypatch.setenv("LD_LIBRARY_PATH", "/opt/cuda/lib64") + + argv = runner_main.ensure_pyperf_worker_env(["--fast", "--inherit-environ=FOO,BAR"]) + + assert argv == ["--fast", "--inherit-environ", "FOO,BAR,CUDA_PATH,LD_LIBRARY_PATH"] + + +def test_bench_launch_initializes_on_first_use(monkeypatch): + calls: list[tuple] = [] + bench_launch = load_bench_launch(monkeypatch, calls) + + assert calls == [] + + bench_launch.bench_launch_empty_kernel(1) + compile_calls = [call for call in calls if call[0] == "compile_and_load"] + launch_calls = [call for call in calls if call[0] == "cuLaunchKernel"] + + assert len(compile_calls) == 1 + assert len(launch_calls) == 1 + + bench_launch.bench_launch_16_args_pre_packed(1) + compile_calls = [call for call in calls if call[0] == "compile_and_load"] + launch_calls = [call for call in calls if call[0] == "cuLaunchKernel"] + + assert len(compile_calls) == 1 + assert len(launch_calls) == 2 diff --git a/benchmarks/cuda_core/.gitignore b/benchmarks/cuda_core/.gitignore new file mode 100644 index 00000000000..b795782a321 --- /dev/null +++ b/benchmarks/cuda_core/.gitignore @@ -0,0 +1,16 @@ +# Build artifacts +.build/ +__pycache__/ + +# Benchmark results +*.json +.benchmarks/ + +# Pixi environments +.pixi/ + +# Override root .gitignore *.cpp rule (which targets Cython-generated files) +!benchmarks/cpp/*.cpp + +results-python.json +results-cpp.json diff --git a/benchmarks/cuda_core/AGENTS.md b/benchmarks/cuda_core/AGENTS.md new file mode 100644 index 00000000000..d2a3a3357cd --- /dev/null +++ b/benchmarks/cuda_core/AGENTS.md @@ -0,0 +1,11 @@ +# cuda.core benchmarks + +Read the README.md in this directory for more details about the benchmarks. + +When generating code verify that that the code is correct based on the source for cuda-core +that can be found in ../../cuda_core. + +This suite shares the pyperf runner with `../cuda_bindings/` via a sys.path +insert in `run_pyperf.py`. The per-suite setup (`runtime.py`, the `benchmarks/` +module files) lives here. Benchmark IDs are kept identical to the cuda.bindings +suite so `compare.py` can diff them directly. diff --git a/benchmarks/cuda_core/README.md b/benchmarks/cuda_core/README.md new file mode 100644 index 00000000000..de124f7ff73 --- /dev/null +++ b/benchmarks/cuda_core/README.md @@ -0,0 +1,73 @@ +# cuda.core benchmarks + +These benchmarks measure the latency overhead of the `cuda.core` public API +on top of `cuda.bindings`. Every benchmark ID here has a 1:1 counterpart in +`../cuda_bindings/benchmarks/` so a `compare.py` run produces a side-by-side +"bindings vs core" overhead table for every operation. + +This suite is **not** a throughput benchmark and does not test kernel +performance — it measures Python-side call overhead only. No C++ baseline +is built or run for `cuda.core`: the comparative baseline is the +`cuda.bindings` Python results file at +`../cuda_bindings/results-python.json`. + +The pyperf runner (`runner/main.py`) is shared with the cuda.bindings +suite via a `sys.path` insert in `run_pyperf.py`; only the per-suite +`runtime.py` and `benchmarks/*.py` live here. + +## Usage + +Requires pixi. + +Environments: + +- `wheel`: Installs released `cuda-core` from conda-forge. +- `source`: Installs `cuda-core` and `cuda-bindings` from the in-tree + sources, so local changes are exercised. + +Tasks: + +- `bench`: Runs the full suite. +- `bench-smoke-test`: Runs each bench with `--debug-single-value` for + a quick smoke check (not meaningful for timing). +- `bench-compare`: Prints a side-by-side table against + `../cuda_bindings/results-python.json`. + +### System tuning + +For more stable results on Linux, tune the system before running. +See: https://pyperf.readthedocs.io/en/latest/system.html#system + +```bash +pixi run -e wheel -- python -m pyperf system show +$(pixi run -e wheel -- which python) -m pyperf system tune +``` + +### Running benchmarks + +```bash +# Wheel env +pixi run -e wheel bench +pixi run -e wheel bench --min-time 0.1 + +# Source env (picks up local cuda.core / cuda.bindings changes) +pixi run -e source bench + +# Side-by-side comparison vs cuda.bindings +pixi run -e wheel bench-compare +``` + +Results are saved to `results-python.json` in this directory. Compare +against the cuda.bindings baseline by running that suite's `bench` task +first so `../cuda_bindings/results-python.json` exists. + +## Output JSON and analysis + +The suite uses [pyperf](https://pyperf.readthedocs.io/en/latest/). The +output JSON is pyperf-compatible: + +```bash +pixi run -e wheel -- python -m pyperf stats results-python.json +pixi run -e wheel -- python -m pyperf compare_to \ + ../cuda_bindings/results-python.json results-python.json +``` diff --git a/benchmarks/cuda_core/benchmarks/bench_ctx_device.py b/benchmarks/cuda_core/benchmarks/bench_ctx_device.py new file mode 100644 index 00000000000..ce646ee1f14 --- /dev/null +++ b/benchmarks/cuda_core/benchmarks/bench_ctx_device.py @@ -0,0 +1,54 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +import time + +from runtime import ensure_device + +from cuda.core import Device + +DEV = ensure_device() + + +def bench_ctx_get_current(loops: int) -> float: + # Device() with no args returns the TLS-cached "current" device. + _fn = Device + + t0 = time.perf_counter() + for _ in range(loops): + _fn() + return time.perf_counter() - t0 + + +def bench_ctx_set_current(loops: int) -> float: + _fn = DEV.set_current + + t0 = time.perf_counter() + for _ in range(loops): + _fn() + return time.perf_counter() - t0 + + +def bench_device_get(loops: int) -> float: + # Device(id) hits the same TLS cache after the first construction. + _fn = Device + + t0 = time.perf_counter() + for _ in range(loops): + _fn(0) + return time.perf_counter() - t0 + + +def bench_device_get_attribute(loops: int) -> float: + # Matches the cuda.bindings bench's CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR + # call. cuda.core caches this attribute in DeviceProperties, so every + # iteration past the first is a dict lookup rather than a driver call + # — the bench therefore measures the user-visible cost of the public + # API, which is legitimately faster than cuda.bindings here. + _props = DEV.properties + + t0 = time.perf_counter() + for _ in range(loops): + _props.compute_capability_major # noqa: B018 + return time.perf_counter() - t0 diff --git a/benchmarks/cuda_core/benchmarks/bench_event.py b/benchmarks/cuda_core/benchmarks/bench_event.py new file mode 100644 index 00000000000..883c470be1f --- /dev/null +++ b/benchmarks/cuda_core/benchmarks/bench_event.py @@ -0,0 +1,53 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +import time + +from runtime import ensure_device + +DEV = ensure_device() +STREAM = DEV.create_stream() + +# Pre-recorded event, completed, reused for record/query/sync benches. +EVENT = STREAM.record() +STREAM.sync() + + +def bench_event_create_destroy(loops: int) -> float: + _create = DEV.create_event + + t0 = time.perf_counter() + for _ in range(loops): + e = _create() + e.close() + return time.perf_counter() - t0 + + +def bench_event_record(loops: int) -> float: + # Reuse EVENT so we measure cuEventRecord, not event allocation. + _record = STREAM.record + _event = EVENT + + t0 = time.perf_counter() + for _ in range(loops): + _record(_event) + return time.perf_counter() - t0 + + +def bench_event_query(loops: int) -> float: + _event = EVENT + + t0 = time.perf_counter() + for _ in range(loops): + _event.is_done # noqa: B018 + return time.perf_counter() - t0 + + +def bench_event_synchronize(loops: int) -> float: + _fn = EVENT.sync + + t0 = time.perf_counter() + for _ in range(loops): + _fn() + return time.perf_counter() - t0 diff --git a/benchmarks/cuda_core/benchmarks/bench_launch.py b/benchmarks/cuda_core/benchmarks/bench_launch.py new file mode 100644 index 00000000000..c08f866c63c --- /dev/null +++ b/benchmarks/cuda_core/benchmarks/bench_launch.py @@ -0,0 +1,187 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +import time + +from runtime import compile_module, ensure_device + +from cuda.core import LaunchConfig, launch + +# Same source as the cuda.bindings launch bench, minus the variants we +# don't need here. Pointer args are passed as Python ints (via int(handle)) +# or Buffer instances; cuda.core's ParamHolder treats both as intptr_t. +KERNEL_SOURCE = """\ +extern "C" __global__ void empty_kernel() { return; } +extern "C" __global__ void small_kernel(float *f) { *f = 0.0f; } + +#define ITEM_PARAM(x, T) T x +#define REP1(x, T) , ITEM_PARAM(x, T) +#define REP2(x, T) REP1(x##0, T) REP1(x##1, T) +#define REP4(x, T) REP2(x##0, T) REP2(x##1, T) +#define REP8(x, T) REP4(x##0, T) REP4(x##1, T) +#define REP16(x, T) REP8(x##0, T) REP8(x##1, T) +#define REP32(x, T) REP16(x##0, T) REP16(x##1, T) +#define REP64(x, T) REP32(x##0, T) REP32(x##1, T) +#define REP128(x, T) REP64(x##0, T) REP64(x##1, T) +#define REP256(x, T) REP128(x##0, T) REP128(x##1, T) + +extern "C" __global__ +void small_kernel_16_args( + ITEM_PARAM(F, int*) + REP1(A, int*) + REP2(A, int*) + REP4(A, int*) + REP8(A, int*)) +{ *F = 0; } + +extern "C" __global__ +void small_kernel_256_args( + ITEM_PARAM(F, int*) + REP1(A, int*) + REP2(A, int*) + REP4(A, int*) + REP8(A, int*) + REP16(A, int*) + REP32(A, int*) + REP64(A, int*) + REP128(A, int*)) +{ *F = 0; } + +extern "C" __global__ +void small_kernel_512_args( + ITEM_PARAM(F, int*) + REP1(A, int*) + REP2(A, int*) + REP4(A, int*) + REP8(A, int*) + REP16(A, int*) + REP32(A, int*) + REP64(A, int*) + REP128(A, int*) + REP256(A, int*)) +{ *F = 0; } +""" + +KERNEL_NAMES = ( + "empty_kernel", + "small_kernel", + "small_kernel_16_args", + "small_kernel_256_args", + "small_kernel_512_args", +) + +DEV = ensure_device() +STREAM = DEV.create_stream() +CONFIG = LaunchConfig(grid=1, block=1) + +MODULE = None +EMPTY_KERNEL = None +SMALL_KERNEL = None +KERNEL_16_ARGS = None +KERNEL_256_ARGS = None +KERNEL_512_ARGS = None +FLOAT_BUF = None +INT_BUFS_512: tuple = () +INT_PTRS_512: tuple = () + + +def _ensure_launch_state() -> None: + global MODULE, EMPTY_KERNEL, SMALL_KERNEL + global KERNEL_16_ARGS, KERNEL_256_ARGS, KERNEL_512_ARGS + global FLOAT_BUF, INT_BUFS_512, INT_PTRS_512 + + if EMPTY_KERNEL is not None: + return + + module = compile_module(KERNEL_SOURCE, KERNEL_NAMES) + + # Pre-allocate buffers for the kernel args. Allocate on STREAM so the + # pool-async allocs are stream-ordered with the launches we will issue + # on the same stream below — matches the cuda.bindings bench, which + # uses synchronous cuMemAlloc and therefore has the pointers ready + # before the first timed launch. Use ints (raw pointer addresses) in + # the launch hot path so ParamHolder skips the Buffer type check and + # goes through its int fast-path. + float_buf = DEV.allocate(4, STREAM) + int_bufs_512 = tuple(DEV.allocate(4, STREAM) for _ in range(512)) + int_ptrs_512 = tuple(int(b.handle) for b in int_bufs_512) + + MODULE = module + EMPTY_KERNEL = module.get_kernel("empty_kernel") + SMALL_KERNEL = module.get_kernel("small_kernel") + KERNEL_16_ARGS = module.get_kernel("small_kernel_16_args") + KERNEL_256_ARGS = module.get_kernel("small_kernel_256_args") + KERNEL_512_ARGS = module.get_kernel("small_kernel_512_args") + FLOAT_BUF = float_buf + INT_BUFS_512 = int_bufs_512 + INT_PTRS_512 = int_ptrs_512 + + +def bench_launch_empty_kernel(loops: int) -> float: + _ensure_launch_state() + _launch = launch + _kernel = EMPTY_KERNEL + _stream = STREAM + _config = CONFIG + + t0 = time.perf_counter() + for _ in range(loops): + _launch(_stream, _config, _kernel) + return time.perf_counter() - t0 + + +def bench_launch_small_kernel(loops: int) -> float: + _ensure_launch_state() + _launch = launch + _kernel = SMALL_KERNEL + _stream = STREAM + _config = CONFIG + _ptr = int(FLOAT_BUF.handle) + + t0 = time.perf_counter() + for _ in range(loops): + _launch(_stream, _config, _kernel, _ptr) + return time.perf_counter() - t0 + + +def bench_launch_16_args(loops: int) -> float: + _ensure_launch_state() + _launch = launch + _kernel = KERNEL_16_ARGS + _stream = STREAM + _config = CONFIG + _args = INT_PTRS_512[:16] + + t0 = time.perf_counter() + for _ in range(loops): + _launch(_stream, _config, _kernel, *_args) + return time.perf_counter() - t0 + + +def bench_launch_256_args(loops: int) -> float: + _ensure_launch_state() + _launch = launch + _kernel = KERNEL_256_ARGS + _stream = STREAM + _config = CONFIG + _args = INT_PTRS_512[:256] + + t0 = time.perf_counter() + for _ in range(loops): + _launch(_stream, _config, _kernel, *_args) + return time.perf_counter() - t0 + + +def bench_launch_512_args(loops: int) -> float: + _ensure_launch_state() + _launch = launch + _kernel = KERNEL_512_ARGS + _stream = STREAM + _config = CONFIG + _args = INT_PTRS_512 + + t0 = time.perf_counter() + for _ in range(loops): + _launch(_stream, _config, _kernel, *_args) + return time.perf_counter() - t0 diff --git a/benchmarks/cuda_core/benchmarks/bench_memory.py b/benchmarks/cuda_core/benchmarks/bench_memory.py new file mode 100644 index 00000000000..445f85e5121 --- /dev/null +++ b/benchmarks/cuda_core/benchmarks/bench_memory.py @@ -0,0 +1,37 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +import time + +from runtime import ensure_device + +DEV = ensure_device() +STREAM = DEV.create_stream() + +# Small allocation size: we measure call overhead, not the allocator. +ALLOC_SIZE = 1024 + + +def bench_mem_alloc_free(loops: int) -> float: + # No-stream variant: dev.allocate() uses the default stream internally. + _alloc = DEV.allocate + _size = ALLOC_SIZE + + t0 = time.perf_counter() + for _ in range(loops): + buf = _alloc(_size) + buf.close() + return time.perf_counter() - t0 + + +def bench_mem_alloc_async_free_async(loops: int) -> float: + _alloc = DEV.allocate + _size = ALLOC_SIZE + _stream = STREAM + + t0 = time.perf_counter() + for _ in range(loops): + buf = _alloc(_size, _stream) + buf.close(_stream) + return time.perf_counter() - t0 diff --git a/benchmarks/cuda_core/benchmarks/bench_stream.py b/benchmarks/cuda_core/benchmarks/bench_stream.py new file mode 100644 index 00000000000..f1501c6f658 --- /dev/null +++ b/benchmarks/cuda_core/benchmarks/bench_stream.py @@ -0,0 +1,29 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +import time + +from runtime import ensure_device + +DEV = ensure_device() +STREAM = DEV.create_stream() + + +def bench_stream_create_destroy(loops: int) -> float: + _create = DEV.create_stream + + t0 = time.perf_counter() + for _ in range(loops): + s = _create() + s.close() + return time.perf_counter() - t0 + + +def bench_stream_synchronize(loops: int) -> float: + _fn = STREAM.sync + + t0 = time.perf_counter() + for _ in range(loops): + _fn() + return time.perf_counter() - t0 diff --git a/benchmarks/cuda_core/compare.py b/benchmarks/cuda_core/compare.py new file mode 100644 index 00000000000..20fa1c5f2aa --- /dev/null +++ b/benchmarks/cuda_core/compare.py @@ -0,0 +1,214 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +"""Compare cuda.core and cuda.bindings benchmark results side by side. + +Benchmark IDs are kept intentionally identical across the two suites +(e.g. ``stream.stream_create_destroy``) so a result present in both +files can be diffed directly. IDs that exist in only one suite are +rendered with ``-`` in the missing column. +""" + +import argparse +import json +import statistics +import sys +from pathlib import Path + +HERE = Path(__file__).resolve().parent +DEFAULT_CORE = HERE / "results-python.json" +DEFAULT_BINDINGS = HERE.parent / "cuda_bindings" / "results-python.json" + +# Benchmark IDs where the cuda.core path invokes a different driver +# symbol, makes an additional driver call, or hits a cuda.core-side cache +# compared to the cuda.bindings bench — i.e. the "Delta" column is NOT +# pure Python wrapper overhead on top of the same driver call. +# Unstarred rows compare like-for-like driver calls. Per-row rationale +# is inlined below as a comment next to each ID. +DIFFERENT_CODEPATH_BENCHMARKS: frozenset[str] = frozenset( + { + # cuCtxGetDevice (core) vs cuCtxGetCurrent (bindings). + "ctx_device.ctx_get_current", + # TLS list lookup (core) vs cuDeviceGet (bindings). + "ctx_device.device_get", + # DeviceProperties dict cache hit (core) vs cuDeviceGetAttribute + # (bindings) on every iteration. + "ctx_device.device_get_attribute", + # cuStreamCreateWithPriority + cuCtxGetStreamPriorityRange (core) + # vs cuStreamCreate (bindings). + "stream.stream_create_destroy", + # cuMemAllocFromPoolAsync on default stream (core) vs synchronous + # cuMemAlloc (bindings). + "memory.mem_alloc_free", + # cuMemAllocFromPoolAsync with explicit pool handle (core) vs + # cuMemAllocAsync with implicit default pool (bindings). + "memory.mem_alloc_async_free_async", + # cuLaunchKernelEx + per-call ParamHolder (core) vs cuLaunchKernel + # with pre-built arg tuple (bindings). + "launch.launch_empty_kernel", + "launch.launch_small_kernel", + "launch.launch_16_args", + "launch.launch_256_args", + "launch.launch_512_args", + } +) +DIFFERENT_CODEPATH_MARKER = "*" + + +def load_benchmarks(path: Path) -> dict[str, list[float]]: + """Load a pyperf JSON file and return {name: [values]}.""" + with open(path) as f: + data = json.load(f) + + results: dict[str, list[float]] = {} + for bench in data.get("benchmarks", []): + name = bench.get("metadata", {}).get("name", "") + if not name: + for run in bench.get("runs", []): + name = run.get("metadata", {}).get("name", "") + if name: + break + values: list[float] = [] + for run in bench.get("runs", []): + values.extend(run.get("values", [])) + if name and values: + results[name] = values + return results + + +def stats(values: list[float]) -> tuple[float, float, float, int]: + mean = statistics.mean(values) + stdev = statistics.pstdev(values) if len(values) > 1 else 0.0 + rsd = (stdev / mean) if mean else 0.0 + return mean, stdev, rsd, len(values) + + +def fmt_rsd(rsd: float | None) -> str: + if rsd is None: + return "-" + return f"{rsd * 100:.1f}%" + + +def fmt_ns(seconds: float) -> str: + return f"{seconds * 1e9:,.0f}" + + +def fmt_delta_ns(core_mean: float, bindings_mean: float) -> str: + return f"{(core_mean - bindings_mean) * 1e9:+,.0f}" + + +def fmt_delta_pct(core_mean: float, bindings_mean: float) -> str: + if bindings_mean <= 0.0: + return "-" + pct = (core_mean - bindings_mean) / bindings_mean * 100 + return f"{pct:+,.0f}%" + + +def main() -> None: + parser = argparse.ArgumentParser(description="Compare cuda.core vs cuda.bindings benchmark results") + parser.add_argument( + "--core", + type=Path, + default=DEFAULT_CORE, + help=f"cuda.core results JSON (default: {DEFAULT_CORE.name})", + ) + parser.add_argument( + "--bindings", + type=Path, + default=DEFAULT_BINDINGS, + help=f"cuda.bindings results JSON (default: {DEFAULT_BINDINGS})", + ) + args = parser.parse_args() + + if not args.core.exists(): + print(f"cuda.core results not found: {args.core}", file=sys.stderr) + print("Run: pixi run -e source bench", file=sys.stderr) + sys.exit(1) + + core_benchmarks = load_benchmarks(args.core) + bindings_benchmarks = load_benchmarks(args.bindings) if args.bindings.exists() else {} + + if not core_benchmarks: + print("No benchmarks found in cuda.core results.", file=sys.stderr) + sys.exit(1) + + all_names = sorted(set(core_benchmarks) | set(bindings_benchmarks)) + + # Reserve a trailing column of space for the "different codepath" marker + # so it does not collide visually with the benchmark ID. + display_names = { + name: f"{name} {DIFFERENT_CODEPATH_MARKER}" if name in DIFFERENT_CODEPATH_BENCHMARKS else name + for name in all_names + } + name_width = max(len(display_names[n]) for n in all_names) + name_width = max(name_width, len("Benchmark")) + + bind_w = 14 + core_w = 14 + rsd_w = 8 + delta_ns_w = 12 + delta_pct_w = 10 + + if bindings_benchmarks: + header = ( + f"{'Benchmark':<{name_width}} " + f"{'bindings (ns)':>{bind_w}} {'RSD':>{rsd_w}} " + f"{'core (ns)':>{core_w}} {'RSD':>{rsd_w}} " + f"{'Delta ns':>{delta_ns_w}} {'Delta %':>{delta_pct_w}}" + ) + else: + header = f"{'Benchmark':<{name_width}} {'core (ns)':>{core_w}} {'RSD':>{rsd_w}}" + + sep = "-" * len(header) + + if bindings_benchmarks: + # Keep legend lines shorter than the table so they don't overflow. + print("Delta = core mean - bindings mean (positive = cuda.core slower).") + print(f"{DIFFERENT_CODEPATH_MARKER} marks benchmarks where the cuda.core path invokes a different driver") + print(" symbol, makes an additional driver call, or hits a cuda.core-side cache") + print(" — so Delta is not pure Python wrapper overhead on top of the same driver") + print(" call. Unstarred rows compare like-for-like driver calls; their Delta is") + print(" wrapper overhead.") + print() + + print(sep) + print(header) + print(sep) + + for name in all_names: + core_vals = core_benchmarks.get(name) + bind_vals = bindings_benchmarks.get(name) + + core_stats = stats(core_vals) if core_vals else None + bind_stats = stats(bind_vals) if bind_vals else None + + core_str = fmt_ns(core_stats[0]) if core_stats else "-" + bind_str = fmt_ns(bind_stats[0]) if bind_stats else "-" + core_rsd = fmt_rsd(core_stats[2]) if core_stats else "-" + bind_rsd = fmt_rsd(bind_stats[2]) if bind_stats else "-" + + if core_stats and bind_stats: + delta_ns_str = fmt_delta_ns(core_stats[0], bind_stats[0]) + delta_pct_str = fmt_delta_pct(core_stats[0], bind_stats[0]) + else: + delta_ns_str = "-" + delta_pct_str = "-" + + display_name = display_names[name] + + if bindings_benchmarks: + print( + f"{display_name:<{name_width}} " + f"{bind_str:>{bind_w}} {bind_rsd:>{rsd_w}} " + f"{core_str:>{core_w}} {core_rsd:>{rsd_w}} " + f"{delta_ns_str:>{delta_ns_w}} {delta_pct_str:>{delta_pct_w}}" + ) + else: + print(f"{display_name:<{name_width}} {core_str:>{core_w}} {core_rsd:>{rsd_w}}") + + print(sep) + + +if __name__ == "__main__": + main() diff --git a/benchmarks/cuda_core/pixi.lock b/benchmarks/cuda_core/pixi.lock new file mode 100644 index 00000000000..e5eca8b36ee --- /dev/null +++ b/benchmarks/cuda_core/pixi.lock @@ -0,0 +1,972 @@ +version: 6 +environments: + default: + channels: + - url: https://conda.anaconda.org/conda-forge/ + options: + channel-priority: disabled + pypi-prerelease-mode: if-necessary-or-explicit + packages: {} + source: + channels: + - url: https://conda.anaconda.org/conda-forge/ + options: + channel-priority: disabled + pypi-prerelease-mode: if-necessary-or-explicit + packages: + linux-64: + - conda: https://conda.anaconda.org/conda-forge/linux-64/_openmp_mutex-4.5-20_gnu.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/bzip2-1.0.8-hda65f42_9.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/ca-certificates-2026.4.22-hbd8a1cb_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cffi-2.0.0-py314h4a8dc5f_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cfgv-3.5.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-bindings-13.2.0-py314ha0b5721_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-cudart-13.2.75-hecca717_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart_linux-64-13.2.75-h376f20c_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-nvrtc-13.2.78-hecca717_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-nvvm-impl-13.2.78-h4bc722e_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-pathfinder-1.5.4-pyhc364b38_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-version-13.2-he2cc418_3.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/distlib-0.4.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/filelock-3.29.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/icu-78.3-h33c6efd_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/identify-2.6.19-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/importlib-metadata-8.8.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/ld_impl_linux-64-2.45.1-default_hbd61a6d_102.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libblas-3.11.0-6_h4a7cf45_openblas.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libcap-2.77-hd0affe5_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libcblas-3.11.0-6_h0358290_openblas.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libcufile-1.17.1.22-h85c024f_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libexpat-2.7.5-hecca717_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libffi-3.5.2-h3435931_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libgcc-15.2.0-he0feb66_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libgfortran-15.2.0-h69a702a_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libgfortran5-15.2.0-h68bc16d_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libgomp-15.2.0-he0feb66_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/liblapack-3.11.0-6_h47877c9_openblas.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/liblzma-5.8.3-hb03c661_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libmpdec-4.0.0-hb03c661_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libnl-3.11.0-hb9d3cd8_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libnvjitlink-13.2.78-hecca717_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libopenblas-0.3.32-pthreads_h94d23a6_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libsqlite-3.53.0-hf4e2dac_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libstdcxx-15.2.0-h934c35e_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libsystemd0-257.13-hd0affe5_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libudev1-257.13-hd0affe5_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libuuid-2.42-h5347b49_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libzlib-1.3.2-h25fd6f3_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/ncurses-6.6-hdb14827_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/nodeenv-1.10.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/numpy-2.4.3-py314h2b28147_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/openssl-3.6.2-h35e630c_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/platformdirs-4.9.6-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pre-commit-4.6.0-pyha770c72_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pycparser-2.22-pyh29332c3_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/pyperf-2.9.0-py314hdafbbf9_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/python-3.14.4-habeac84_100_cp314.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/python-discovery-1.2.2-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/python_abi-3.14-8_cp314.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/pyyaml-6.0.3-py314h67df5f8_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/rdma-core-61.0-h192683f_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/readline-8.3-h853b02a_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/setuptools-82.0.1-pyh332efcf_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/six-1.17.0-pyhe01879c_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/tk-8.6.13-noxft_h366c992_103.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/typing_extensions-4.15.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/tzdata-2025c-hc9c84f9_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/ukkonen-1.1.0-py314h9891dd4_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/virtualenv-21.3.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/yaml-0.2.5-h280c20c_3.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/zipp-3.23.1-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/zstd-1.5.7-hb78ec9c_6.conda + - conda: ../../cuda_core + wheel: + channels: + - url: https://conda.anaconda.org/conda-forge/ + options: + channel-priority: disabled + pypi-prerelease-mode: if-necessary-or-explicit + packages: + linux-64: + - conda: https://conda.anaconda.org/conda-forge/linux-64/_openmp_mutex-4.5-20_gnu.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/bzip2-1.0.8-hda65f42_9.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/ca-certificates-2026.4.22-hbd8a1cb_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cffi-2.0.0-py314h4a8dc5f_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cfgv-3.5.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-bindings-13.2.0-py314ha0b5721_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-core-0.7.0-cuda13_py314h025f531_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-nvrtc-13.1.115-hecca717_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-nvvm-impl-13.1.115-h4bc722e_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-pathfinder-1.5.4-pyhc364b38_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-version-13.1-h2ff5cdb_3.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/distlib-0.4.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/filelock-3.29.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/icu-78.3-h33c6efd_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/identify-2.6.19-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/importlib-metadata-8.8.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/ld_impl_linux-64-2.45.1-default_hbd61a6d_102.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libblas-3.11.0-6_h4a7cf45_openblas.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libcap-2.77-hd0affe5_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libcblas-3.11.0-6_h0358290_openblas.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libcufile-1.16.1.26-hd07211c_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libexpat-2.7.5-hecca717_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libffi-3.5.2-h3435931_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libgcc-15.2.0-he0feb66_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libgfortran-15.2.0-h69a702a_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libgfortran5-15.2.0-h68bc16d_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libgomp-15.2.0-he0feb66_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/liblapack-3.11.0-6_h47877c9_openblas.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/liblzma-5.8.3-hb03c661_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libmpdec-4.0.0-hb03c661_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libnl-3.11.0-hb9d3cd8_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libnvjitlink-13.2.78-hecca717_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libopenblas-0.3.32-pthreads_h94d23a6_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libsqlite-3.53.0-hf4e2dac_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libstdcxx-15.2.0-h934c35e_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libsystemd0-257.13-hd0affe5_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libudev1-257.13-hd0affe5_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libuuid-2.42-h5347b49_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libzlib-1.3.2-h25fd6f3_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/ncurses-6.6-hdb14827_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/nodeenv-1.10.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/numpy-2.4.3-py314h2b28147_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/openssl-3.6.2-h35e630c_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/platformdirs-4.9.6-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pre-commit-4.6.0-pyha770c72_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pycparser-2.22-pyh29332c3_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/pyperf-2.9.0-py314hdafbbf9_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/python-3.14.4-habeac84_100_cp314.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/python-discovery-1.2.2-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/python_abi-3.14-8_cp314.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/pyyaml-6.0.3-py314h67df5f8_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/rdma-core-61.0-h192683f_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/readline-8.3-h853b02a_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/setuptools-82.0.1-pyh332efcf_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/six-1.17.0-pyhe01879c_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/tk-8.6.13-noxft_h366c992_103.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/typing_extensions-4.15.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/tzdata-2025c-hc9c84f9_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/ukkonen-1.1.0-py314h9891dd4_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/virtualenv-21.3.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/yaml-0.2.5-h280c20c_3.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/zipp-3.23.1-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/zstd-1.5.7-hb78ec9c_6.conda +packages: +- conda: https://conda.anaconda.org/conda-forge/linux-64/_openmp_mutex-4.5-20_gnu.conda + build_number: 20 + sha256: 1dd3fffd892081df9726d7eb7e0dea6198962ba775bd88842135a4ddb4deb3c9 + md5: a9f577daf3de00bca7c3c76c0ecbd1de + depends: + - __glibc >=2.17,<3.0.a0 + - libgomp >=7.5.0 + constrains: + - openmp_impl <0.0a0 + license: BSD-3-Clause + license_family: BSD + size: 28948 + timestamp: 1770939786096 +- conda: https://conda.anaconda.org/conda-forge/linux-64/bzip2-1.0.8-hda65f42_9.conda + sha256: 0b75d45f0bba3e95dc693336fa51f40ea28c980131fec438afb7ce6118ed05f6 + md5: d2ffd7602c02f2b316fd921d39876885 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + license: bzip2-1.0.6 + license_family: BSD + size: 260182 + timestamp: 1771350215188 +- conda: https://conda.anaconda.org/conda-forge/noarch/ca-certificates-2026.4.22-hbd8a1cb_0.conda + sha256: c9dbcc8039a52023660d6d1bbf87594a93dd69c6ac5a2a44323af2c92976728d + md5: e18ad67cf881dcadee8b8d9e2f8e5f73 + depends: + - __unix + license: ISC + size: 131039 + timestamp: 1776865545798 +- conda: https://conda.anaconda.org/conda-forge/linux-64/cffi-2.0.0-py314h4a8dc5f_1.conda + sha256: c6339858a0aaf5d939e00d345c98b99e4558f285942b27232ac098ad17ac7f8e + md5: cf45f4278afd6f4e6d03eda0f435d527 + depends: + - __glibc >=2.17,<3.0.a0 + - libffi >=3.5.2,<3.6.0a0 + - libgcc >=14 + - pycparser + - python >=3.14,<3.15.0a0 + - python_abi 3.14.* *_cp314 + license: MIT + license_family: MIT + size: 300271 + timestamp: 1761203085220 +- conda: https://conda.anaconda.org/conda-forge/noarch/cfgv-3.5.0-pyhd8ed1ab_0.conda + sha256: aa589352e61bb221351a79e5946d56916e3c595783994884accdb3b97fe9d449 + md5: 381bd45fb7aa032691f3063aff47e3a1 + depends: + - python >=3.10 + license: MIT + license_family: MIT + size: 13589 + timestamp: 1763607964133 +- conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-bindings-13.2.0-py314ha0b5721_0.conda + sha256: f77e397cbf7b173dae7470aca3052184779431b7a7bcce3ecc56c2822c83cdb4 + md5: 29baeabdf5e58a696a68625b7bd8d9f8 + depends: + - __glibc >=2.17,<3.0.a0 + - cuda-nvrtc >=13,<14.0a0 + - cuda-nvvm-impl >=13,<14.0a0 + - cuda-pathfinder >=1.1.0,<2 + - cuda-version >=13,<14.0a0 + - libcufile >=1,<2.0a0 + - libgcc >=14 + - libnvjitlink >=13.0,<14.0a0 + - libstdcxx >=14 + - python >=3.14,<3.15.0a0 + - python_abi 3.14.* *_cp314 + constrains: + - cuda-cudart >=13,<14.0a0 + - cuda-python >=13.2.0,<13.3.0a0 + license: LicenseRef-NVIDIA-SOFTWARE-LICENSE + size: 4281852 + timestamp: 1773284503198 +- conda: ../../cuda_core + name: cuda-core + version: 0.7.0 + build: hb0f4dca_0 + subdir: linux-64 + variants: + target_platform: linux-64 + depends: + - python + - cuda-version + - numpy + - cuda-bindings + - cuda-pathfinder + - libgcc >=15 + - libgcc >=15 + - libstdcxx >=15 + - python_abi 3.14.* *_cp314 + - cuda-nvrtc >=13.2.78,<14.0a0 + - cuda-cudart >=13.2.75,<14.0a0 + license: Apache-2.0 +- conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-core-0.7.0-cuda13_py314h025f531_0.conda + sha256: 25841761aa7cfb2a9295afbefea5ab96ac15f07aa56fc35acb36d254c92e6747 + md5: 60c216b8b88821564e7f2409d6437bb5 + depends: + - __glibc >=2.17,<3.0.a0 + - cuda-bindings >=13,<14.0a0 + - cuda-pathfinder >=1.4.2,<2 + - cuda-version >=13,<14.0a0 + - libgcc >=14 + - libstdcxx >=14 + - numpy + - python >=3.14,<3.15.0a0 + - python_abi 3.14.* *_cp314 + license: Apache-2.0 + license_family: APACHE + size: 1541620 + timestamp: 1775673907706 +- conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-cudart-13.2.75-hecca717_0.conda + sha256: 633bc9ba458a12a20a42776bf3fa25cecfddc65a22e4ed207fe09b9adcd9de58 + md5: 9b7dcd83f8a965efcf7377dc54203619 + depends: + - __glibc >=2.17,<3.0.a0 + - cuda-cudart_linux-64 13.2.75 h376f20c_0 + - cuda-version >=13.2,<13.3.0a0 + - libgcc >=14 + - libstdcxx >=14 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 24542 + timestamp: 1776110472025 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart_linux-64-13.2.75-h376f20c_0.conda + sha256: cd03c67b2005e2e74ff278f6f8b17ca7d6f18cf43fb00775833669508d301a83 + md5: ff98f2b9b87eb8b3a4b36745d3d5b93e + depends: + - cuda-version >=13.2,<13.3.0a0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 203339 + timestamp: 1776110448238 +- conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-nvrtc-13.1.115-hecca717_0.conda + sha256: 9cc4f9df70c02eea5121cdb0e865207b04cd52591f57ebcac2ba44fada10eb5b + md5: df16c9049d882cdaf4f83a5b90079589 + depends: + - __glibc >=2.17,<3.0.a0 + - cuda-version >=13.1,<13.2.0a0 + - libgcc >=14 + - libstdcxx >=14 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 35339417 + timestamp: 1768272955912 +- conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-nvrtc-13.2.78-hecca717_0.conda + sha256: 73fbc9d15c062c3ea60891e8183002f6b055fa6638402d17581677af0aaa20d8 + md5: 66623d882c42506fa3f1780b90841400 + depends: + - __glibc >=2.17,<3.0.a0 + - cuda-version >=13.2,<13.3.0a0 + - libgcc >=14 + - libstdcxx >=14 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 35670504 + timestamp: 1776109867257 +- conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-nvvm-impl-13.1.115-h4bc722e_0.conda + sha256: 12d84615684f1279799c023ce4ccc7c34f151bec2a90e0c8d04798a8c8af437c + md5: bf76661bc0de83a60537c4913f339fb3 + depends: + - __glibc >=2.17,<3.0.a0 + - cuda-version >=13.1,<13.2.0a0 + - libgcc >=12 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 21873791 + timestamp: 1768280315627 +- conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-nvvm-impl-13.2.78-h4bc722e_0.conda + sha256: 944d132f61f240131abff67646da4040ae585a1f43c6b38fabebb6cc075a7c16 + md5: 5e1021b4c73e795deabbf35ed1317dcb + depends: + - __glibc >=2.17,<3.0.a0 + - cuda-version >=13.2,<13.3.0a0 + - libgcc >=12 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 22205958 + timestamp: 1776121258973 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-pathfinder-1.5.4-pyhc364b38_0.conda + sha256: 662046880e1dd8f62cd2ad8ac9618ace683cb7a3f3af93c52e425a772c9b4f00 + md5: 42d4610b52102122741f9bf68f2866ed + depends: + - python >=3.10 + - cuda-version >=12.0,<14 + - python + license: Apache-2.0 + license_family: APACHE + size: 45892 + timestamp: 1777330272729 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-version-13.1-h2ff5cdb_3.conda + sha256: 176ac20fdb95611af8fb2bf0d3d16fee998019b1d0f12fc9ddd5fa0df4553992 + md5: d85448460c25ee43ff2f8346bb9ad52b + constrains: + - cudatoolkit 13.1|13.1.* + - __cuda >=13 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 21511 + timestamp: 1757017115788 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-version-13.2-he2cc418_3.conda + sha256: 64aebe8ccb3a2c3ff446d3c0c0e88ef4fdb069a5732c03539bf3a37243c4c679 + md5: 45676e3dd76b30ec613f1f822d450eff + constrains: + - __cuda >=13 + - cudatoolkit 13.2|13.2.* + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 21908 + timestamp: 1773093709154 +- conda: https://conda.anaconda.org/conda-forge/noarch/distlib-0.4.0-pyhd8ed1ab_0.conda + sha256: 6d977f0b2fc24fee21a9554389ab83070db341af6d6f09285360b2e09ef8b26e + md5: 003b8ba0a94e2f1e117d0bd46aebc901 + depends: + - python >=3.9 + license: Apache-2.0 + license_family: APACHE + size: 275642 + timestamp: 1752823081585 +- conda: https://conda.anaconda.org/conda-forge/noarch/filelock-3.29.0-pyhd8ed1ab_0.conda + sha256: 6b471a18372bbd52bdf32fc965f71de3bc1b5219418b8e6b3875a67a7b08c483 + md5: 8fa8358d022a3a9bd101384a808044c6 + depends: + - python >=3.10 + license: Unlicense + size: 34211 + timestamp: 1776621506566 +- conda: https://conda.anaconda.org/conda-forge/linux-64/icu-78.3-h33c6efd_0.conda + sha256: fbf86c4a59c2ed05bbffb2ba25c7ed94f6185ec30ecb691615d42342baa1a16a + md5: c80d8a3b84358cb967fa81e7075fbc8a + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libstdcxx >=14 + license: MIT + license_family: MIT + size: 12723451 + timestamp: 1773822285671 +- conda: https://conda.anaconda.org/conda-forge/noarch/identify-2.6.19-pyhd8ed1ab_0.conda + sha256: 381cedccf0866babfc135d65ee40b778bd20e927d2a5ec810f750c5860a7c5b8 + md5: 84a3233b709a289a4ddd7a2fd27dd988 + depends: + - python >=3.10 + - ukkonen + license: MIT + license_family: MIT + size: 79757 + timestamp: 1776455344188 +- conda: https://conda.anaconda.org/conda-forge/noarch/importlib-metadata-8.8.0-pyhcf101f3_0.conda + sha256: 82ab2a0d91ca1e7e63ab6a4939356667ef683905dea631bc2121aa534d347b16 + md5: 080594bf4493e6bae2607e65390c520a + depends: + - python >=3.10 + - zipp >=3.20 + - python + license: Apache-2.0 + license_family: APACHE + size: 34387 + timestamp: 1773931568510 +- conda: https://conda.anaconda.org/conda-forge/linux-64/ld_impl_linux-64-2.45.1-default_hbd61a6d_102.conda + sha256: 3d584956604909ff5df353767f3a2a2f60e07d070b328d109f30ac40cd62df6c + md5: 18335a698559cdbcd86150a48bf54ba6 + depends: + - __glibc >=2.17,<3.0.a0 + - zstd >=1.5.7,<1.6.0a0 + constrains: + - binutils_impl_linux-64 2.45.1 + license: GPL-3.0-only + license_family: GPL + size: 728002 + timestamp: 1774197446916 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libblas-3.11.0-6_h4a7cf45_openblas.conda + build_number: 6 + sha256: 7bfe936dbb5db04820cf300a9cc1f5ee8d5302fc896c2d66e30f1ee2f20fbfd6 + md5: 6d6d225559bfa6e2f3c90ee9c03d4e2e + depends: + - libopenblas >=0.3.32,<0.3.33.0a0 + - libopenblas >=0.3.32,<1.0a0 + constrains: + - blas 2.306 openblas + - liblapack 3.11.0 6*_openblas + - liblapacke 3.11.0 6*_openblas + - libcblas 3.11.0 6*_openblas + - mkl <2026 + license: BSD-3-Clause + license_family: BSD + size: 18621 + timestamp: 1774503034895 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libcap-2.77-hd0affe5_1.conda + sha256: 37c41b1024d0c75da76822e3c079aabaf121618a32fe05e53a897b35a88008fc + md5: 499cd8e2d4358986dbe3b30e8fe1bf6a + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + license: BSD-3-Clause + license_family: BSD + size: 124432 + timestamp: 1774333989027 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libcblas-3.11.0-6_h0358290_openblas.conda + build_number: 6 + sha256: 57edafa7796f6fa3ebbd5367692dd4c7f552be42109c2dd1a7c89b55089bf374 + md5: 36ae340a916635b97ac8a0655ace2a35 + depends: + - libblas 3.11.0 6_h4a7cf45_openblas + constrains: + - blas 2.306 openblas + - liblapack 3.11.0 6*_openblas + - liblapacke 3.11.0 6*_openblas + license: BSD-3-Clause + license_family: BSD + size: 18622 + timestamp: 1774503050205 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libcufile-1.16.1.26-hd07211c_0.conda + sha256: 8c44b5bf947afad827df0df49fe7483cf1b2916694081b2db4fecdfd6a2bacd1 + md5: 48418c48dac04671fa46cb446122b8a5 + depends: + - __glibc >=2.28,<3.0.a0 + - cuda-version >=13.1,<13.2.0a0 + - libgcc >=14 + - libstdcxx >=14 + - rdma-core >=60.0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 990938 + timestamp: 1768273732081 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libcufile-1.17.1.22-h85c024f_0.conda + sha256: a24ad0ca488aa3e237049cd5b5c6d7fe3d2d4330682ed329203064e332ea1d74 + md5: 056a67706108efd1f9c24682ba8d3685 + depends: + - __glibc >=2.28,<3.0.a0 + - cuda-version >=13.2,<13.3.0a0 + - libgcc >=14 + - libstdcxx >=14 + - rdma-core >=61.0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 1082447 + timestamp: 1776110053053 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libexpat-2.7.5-hecca717_0.conda + sha256: e8c2b57f6aacabdf2f1b0924bd4831ce5071ba080baa4a9e8c0d720588b6794c + md5: 49f570f3bc4c874a06ea69b7225753af + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + constrains: + - expat 2.7.5.* + license: MIT + license_family: MIT + size: 76624 + timestamp: 1774719175983 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libffi-3.5.2-h3435931_0.conda + sha256: 31f19b6a88ce40ebc0d5a992c131f57d919f73c0b92cd1617a5bec83f6e961e6 + md5: a360c33a5abe61c07959e449fa1453eb + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + license: MIT + license_family: MIT + size: 58592 + timestamp: 1769456073053 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libgcc-15.2.0-he0feb66_18.conda + sha256: faf7d2017b4d718951e3a59d081eb09759152f93038479b768e3d612688f83f5 + md5: 0aa00f03f9e39fb9876085dee11a85d4 + depends: + - __glibc >=2.17,<3.0.a0 + - _openmp_mutex >=4.5 + constrains: + - libgcc-ng ==15.2.0=*_18 + - libgomp 15.2.0 he0feb66_18 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 1041788 + timestamp: 1771378212382 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libgfortran-15.2.0-h69a702a_18.conda + sha256: d2c9fad338fd85e4487424865da8e74006ab2e2475bd788f624d7a39b2a72aee + md5: 9063115da5bc35fdc3e1002e69b9ef6e + depends: + - libgfortran5 15.2.0 h68bc16d_18 + constrains: + - libgfortran-ng ==15.2.0=*_18 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 27523 + timestamp: 1771378269450 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libgfortran5-15.2.0-h68bc16d_18.conda + sha256: 539b57cf50ec85509a94ba9949b7e30717839e4d694bc94f30d41c9d34de2d12 + md5: 646855f357199a12f02a87382d429b75 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=15.2.0 + constrains: + - libgfortran 15.2.0 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 2482475 + timestamp: 1771378241063 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libgomp-15.2.0-he0feb66_18.conda + sha256: 21337ab58e5e0649d869ab168d4e609b033509de22521de1bfed0c031bfc5110 + md5: 239c5e9546c38a1e884d69effcf4c882 + depends: + - __glibc >=2.17,<3.0.a0 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 603262 + timestamp: 1771378117851 +- conda: https://conda.anaconda.org/conda-forge/linux-64/liblapack-3.11.0-6_h47877c9_openblas.conda + build_number: 6 + sha256: 371f517eb7010b21c6cc882c7606daccebb943307cb9a3bf2c70456a5c024f7d + md5: 881d801569b201c2e753f03c84b85e15 + depends: + - libblas 3.11.0 6_h4a7cf45_openblas + constrains: + - blas 2.306 openblas + - liblapacke 3.11.0 6*_openblas + - libcblas 3.11.0 6*_openblas + license: BSD-3-Clause + license_family: BSD + size: 18624 + timestamp: 1774503065378 +- conda: https://conda.anaconda.org/conda-forge/linux-64/liblzma-5.8.3-hb03c661_0.conda + sha256: ec30e52a3c1bf7d0425380a189d209a52baa03f22fb66dd3eb587acaa765bd6d + md5: b88d90cad08e6bc8ad540cb310a761fb + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + constrains: + - xz 5.8.3.* + license: 0BSD + size: 113478 + timestamp: 1775825492909 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libmpdec-4.0.0-hb03c661_1.conda + sha256: fe171ed5cf5959993d43ff72de7596e8ac2853e9021dec0344e583734f1e0843 + md5: 2c21e66f50753a083cbe6b80f38268fa + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + license: BSD-2-Clause + license_family: BSD + size: 92400 + timestamp: 1769482286018 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libnl-3.11.0-hb9d3cd8_0.conda + sha256: ba7c5d294e3d80f08ac5a39564217702d1a752e352e486210faff794ac5001b4 + md5: db63358239cbe1ff86242406d440e44a + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=13 + license: LGPL-2.1-or-later + license_family: LGPL + size: 741323 + timestamp: 1731846827427 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libnvjitlink-13.2.78-hecca717_0.conda + sha256: 2ece599a2a1090eb70916061ab8b49670ee9b143e1f3b41efa0e32e0336a9465 + md5: 641ddee63cb39856291275114ce15d13 + depends: + - __glibc >=2.17,<3.0.a0 + - cuda-version >=13,<13.3.0a0 + - libgcc >=14 + - libstdcxx >=14 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 31659345 + timestamp: 1776110062236 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libopenblas-0.3.32-pthreads_h94d23a6_0.conda + sha256: 6dc30b28f32737a1c52dada10c8f3a41bc9e021854215efca04a7f00487d09d9 + md5: 89d61bc91d3f39fda0ca10fcd3c68594 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libgfortran + - libgfortran5 >=14.3.0 + constrains: + - openblas >=0.3.32,<0.3.33.0a0 + license: BSD-3-Clause + license_family: BSD + size: 5928890 + timestamp: 1774471724897 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libsqlite-3.53.0-hf4e2dac_0.conda + sha256: ec37c79f737933bbac965f5dc0f08ef2790247129a84bb3114fad4900adce401 + md5: 810d83373448da85c3f673fbcb7ad3a3 + depends: + - __glibc >=2.17,<3.0.a0 + - icu >=78.3,<79.0a0 + - libgcc >=14 + - libzlib >=1.3.2,<2.0a0 + license: blessing + size: 958864 + timestamp: 1775753750179 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libstdcxx-15.2.0-h934c35e_18.conda + sha256: 78668020064fdaa27e9ab65cd2997e2c837b564ab26ce3bf0e58a2ce1a525c6e + md5: 1b08cd684f34175e4514474793d44bcb + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc 15.2.0 he0feb66_18 + constrains: + - libstdcxx-ng ==15.2.0=*_18 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 5852330 + timestamp: 1771378262446 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libsystemd0-257.13-hd0affe5_0.conda + sha256: c5008b602cb5c819f7b52d418b3ed17e1818cbbf6705b189e7ab36bb70cce3d8 + md5: 8ee3cb7f64be0e8c4787f3a4dbe024e6 + depends: + - __glibc >=2.17,<3.0.a0 + - libcap >=2.77,<2.78.0a0 + - libgcc >=14 + license: LGPL-2.1-or-later + size: 492799 + timestamp: 1773797095649 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libudev1-257.13-hd0affe5_0.conda + sha256: 1a1e367c04d66030aa93b4d33905f7f6fbb59cfc292e816fe3e9c1e8b3f4d1e2 + md5: 2c2270f93d6f9073cbf72d821dfc7d72 + depends: + - __glibc >=2.17,<3.0.a0 + - libcap >=2.77,<2.78.0a0 + - libgcc >=14 + license: LGPL-2.1-or-later + size: 145087 + timestamp: 1773797108513 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libuuid-2.42-h5347b49_0.conda + sha256: bc1b08c92626c91500fd9f26f2c797f3eb153b627d53e9c13cd167f1e12b2829 + md5: 38ffe67b78c9d4de527be8315e5ada2c + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + license: BSD-3-Clause + license_family: BSD + size: 40297 + timestamp: 1775052476770 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libzlib-1.3.2-h25fd6f3_2.conda + sha256: 55044c403570f0dc26e6364de4dc5368e5f3fc7ff103e867c487e2b5ab2bcda9 + md5: d87ff7921124eccd67248aa483c23fec + depends: + - __glibc >=2.17,<3.0.a0 + constrains: + - zlib 1.3.2 *_2 + license: Zlib + license_family: Other + size: 63629 + timestamp: 1774072609062 +- conda: https://conda.anaconda.org/conda-forge/linux-64/ncurses-6.6-hdb14827_0.conda + sha256: fc89f74bbe362fb29fa3c037697a89bec140b346a2469a90f7936d1d7ea4d8a3 + md5: fc21868a1a5aacc937e7a18747acb8a5 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + license: X11 AND BSD-3-Clause + size: 918956 + timestamp: 1777422145199 +- conda: https://conda.anaconda.org/conda-forge/noarch/nodeenv-1.10.0-pyhd8ed1ab_0.conda + sha256: 4fa40e3e13fc6ea0a93f67dfc76c96190afd7ea4ffc1bac2612d954b42cdc3ee + md5: eb52d14a901e23c39e9e7b4a1a5c015f + depends: + - python >=3.10 + - setuptools + license: BSD-3-Clause + license_family: BSD + size: 40866 + timestamp: 1766261270149 +- conda: https://conda.anaconda.org/conda-forge/linux-64/numpy-2.4.3-py314h2b28147_0.conda + sha256: f2ba8cb0d86a6461a6bcf0d315c80c7076083f72c6733c9290086640723f79ec + md5: 36f5b7eb328bdc204954a2225cf908e2 + depends: + - python + - libstdcxx >=14 + - libgcc >=14 + - __glibc >=2.17,<3.0.a0 + - python_abi 3.14.* *_cp314 + - libcblas >=3.9.0,<4.0a0 + - liblapack >=3.9.0,<4.0a0 + - libblas >=3.9.0,<4.0a0 + constrains: + - numpy-base <0a0 + license: BSD-3-Clause + license_family: BSD + size: 8927860 + timestamp: 1773839233468 +- conda: https://conda.anaconda.org/conda-forge/linux-64/openssl-3.6.2-h35e630c_0.conda + sha256: c0ef482280e38c71a08ad6d71448194b719630345b0c9c60744a2010e8a8e0cb + md5: da1b85b6a87e141f5140bb9924cecab0 + depends: + - __glibc >=2.17,<3.0.a0 + - ca-certificates + - libgcc >=14 + license: Apache-2.0 + license_family: Apache + size: 3167099 + timestamp: 1775587756857 +- conda: https://conda.anaconda.org/conda-forge/noarch/platformdirs-4.9.6-pyhcf101f3_0.conda + sha256: 8f29915c172f1f7f4f7c9391cd5dac3ebf5d13745c8b7c8006032615246345a5 + md5: 89c0b6d1793601a2a3a3f7d2d3d8b937 + depends: + - python >=3.10 + - python + license: MIT + license_family: MIT + size: 25862 + timestamp: 1775741140609 +- conda: https://conda.anaconda.org/conda-forge/noarch/pre-commit-4.6.0-pyha770c72_0.conda + sha256: 716960bf0a9eb334458a26b3bdcb17b8d0786062138a4f48c7f335c8418c5d0b + md5: 7859736b4f8ebe6c8481bf48d91c9a1e + depends: + - cfgv >=2.0.0 + - identify >=1.0.0 + - nodeenv >=0.11.1 + - python >=3.10 + - pyyaml >=5.1 + - virtualenv >=20.10.0 + license: MIT + license_family: MIT + size: 201606 + timestamp: 1776858157327 +- conda: https://conda.anaconda.org/conda-forge/noarch/pycparser-2.22-pyh29332c3_1.conda + sha256: 79db7928d13fab2d892592223d7570f5061c192f27b9febd1a418427b719acc6 + md5: 12c566707c80111f9799308d9e265aef + depends: + - python >=3.9 + - python + license: BSD-3-Clause + license_family: BSD + size: 110100 + timestamp: 1733195786147 +- conda: https://conda.anaconda.org/conda-forge/linux-64/pyperf-2.9.0-py314hdafbbf9_0.conda + sha256: 438c41b42530874928733299ca815f5994f36996c86024f3f37ca220ed910a07 + md5: ed166875b3876d5d7e6e39d2e8d1c6e3 + depends: + - python >=3.14,<3.15.0a0 + - python_abi 3.14.* *_cp314 + - six + license: MIT + license_family: MIT + size: 273897 + timestamp: 1765980972868 +- conda: https://conda.anaconda.org/conda-forge/linux-64/python-3.14.4-habeac84_100_cp314.conda + build_number: 100 + sha256: dec247c5badc811baa34d6085df9d0465535883cf745e22e8d79092ad54a3a7b + md5: a443f87920815d41bfe611296e507995 + depends: + - __glibc >=2.17,<3.0.a0 + - bzip2 >=1.0.8,<2.0a0 + - ld_impl_linux-64 >=2.36.1 + - libexpat >=2.7.5,<3.0a0 + - libffi >=3.5.2,<3.6.0a0 + - libgcc >=14 + - liblzma >=5.8.2,<6.0a0 + - libmpdec >=4.0.0,<5.0a0 + - libsqlite >=3.52.0,<4.0a0 + - libuuid >=2.42,<3.0a0 + - libzlib >=1.3.2,<2.0a0 + - ncurses >=6.5,<7.0a0 + - openssl >=3.5.6,<4.0a0 + - python_abi 3.14.* *_cp314 + - readline >=8.3,<9.0a0 + - tk >=8.6.13,<8.7.0a0 + - tzdata + - zstd >=1.5.7,<1.6.0a0 + license: Python-2.0 + size: 36705460 + timestamp: 1775614357822 + python_site_packages_path: lib/python3.14/site-packages +- conda: https://conda.anaconda.org/conda-forge/noarch/python-discovery-1.2.2-pyhcf101f3_0.conda + sha256: 498ad019d75ba31c7891dc6d9efc8a7ed48cd5d5973f3a9377eb1b174577d3db + md5: feb2e11368da12d6ce473b6573efab41 + depends: + - python >=3.10 + - filelock >=3.15.4 + - platformdirs <5,>=4.3.6 + - python + license: MIT + license_family: MIT + size: 34341 + timestamp: 1775586706825 +- conda: https://conda.anaconda.org/conda-forge/noarch/python_abi-3.14-8_cp314.conda + build_number: 8 + sha256: ad6d2e9ac39751cc0529dd1566a26751a0bf2542adb0c232533d32e176e21db5 + md5: 0539938c55b6b1a59b560e843ad864a4 + constrains: + - python 3.14.* *_cp314 + license: BSD-3-Clause + license_family: BSD + size: 6989 + timestamp: 1752805904792 +- conda: https://conda.anaconda.org/conda-forge/linux-64/pyyaml-6.0.3-py314h67df5f8_1.conda + sha256: b318fb070c7a1f89980ef124b80a0b5ccf3928143708a85e0053cde0169c699d + md5: 2035f68f96be30dc60a5dfd7452c7941 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - python >=3.14,<3.15.0a0 + - python_abi 3.14.* *_cp314 + - yaml >=0.2.5,<0.3.0a0 + license: MIT + license_family: MIT + size: 202391 + timestamp: 1770223462836 +- conda: https://conda.anaconda.org/conda-forge/linux-64/rdma-core-61.0-h192683f_0.conda + sha256: 8e0b7962cf8bec9a016cd91a6c6dc1f9ebc8e7e316b1d572f7b9047d0de54717 + md5: d487d93d170e332ab39803e05912a762 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libnl >=3.11.0,<4.0a0 + - libstdcxx >=14 + - libsystemd0 >=257.10 + - libudev1 >=257.10 + license: Linux-OpenIB + license_family: BSD + size: 1268666 + timestamp: 1769154883613 +- conda: https://conda.anaconda.org/conda-forge/linux-64/readline-8.3-h853b02a_0.conda + sha256: 12ffde5a6f958e285aa22c191ca01bbd3d6e710aa852e00618fa6ddc59149002 + md5: d7d95fc8287ea7bf33e0e7116d2b95ec + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - ncurses >=6.5,<7.0a0 + license: GPL-3.0-only + license_family: GPL + size: 345073 + timestamp: 1765813471974 +- conda: https://conda.anaconda.org/conda-forge/noarch/setuptools-82.0.1-pyh332efcf_0.conda + sha256: 82088a6e4daa33329a30bc26dc19a98c7c1d3f05c0f73ce9845d4eab4924e9e1 + md5: 8e194e7b992f99a5015edbd4ebd38efd + depends: + - python >=3.10 + license: MIT + license_family: MIT + size: 639697 + timestamp: 1773074868565 +- conda: https://conda.anaconda.org/conda-forge/noarch/six-1.17.0-pyhe01879c_1.conda + sha256: 458227f759d5e3fcec5d9b7acce54e10c9e1f4f4b7ec978f3bfd54ce4ee9853d + md5: 3339e3b65d58accf4ca4fb8748ab16b3 + depends: + - python >=3.9 + - python + license: MIT + license_family: MIT + size: 18455 + timestamp: 1753199211006 +- conda: https://conda.anaconda.org/conda-forge/linux-64/tk-8.6.13-noxft_h366c992_103.conda + sha256: cafeec44494f842ffeca27e9c8b0c27ed714f93ac77ddadc6aaf726b5554ebac + md5: cffd3bdd58090148f4cfcd831f4b26ab + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libzlib >=1.3.1,<2.0a0 + constrains: + - xorg-libx11 >=1.8.12,<2.0a0 + license: TCL + license_family: BSD + size: 3301196 + timestamp: 1769460227866 +- conda: https://conda.anaconda.org/conda-forge/noarch/typing_extensions-4.15.0-pyhcf101f3_0.conda + sha256: 032271135bca55aeb156cee361c81350c6f3fb203f57d024d7e5a1fc9ef18731 + md5: 0caa1af407ecff61170c9437a808404d + depends: + - python >=3.10 + - python + license: PSF-2.0 + license_family: PSF + size: 51692 + timestamp: 1756220668932 +- conda: https://conda.anaconda.org/conda-forge/noarch/tzdata-2025c-hc9c84f9_1.conda + sha256: 1d30098909076af33a35017eed6f2953af1c769e273a0626a04722ac4acaba3c + md5: ad659d0a2b3e47e38d829aa8cad2d610 + license: LicenseRef-Public-Domain + size: 119135 + timestamp: 1767016325805 +- conda: https://conda.anaconda.org/conda-forge/linux-64/ukkonen-1.1.0-py314h9891dd4_0.conda + sha256: c84034056dc938c853e4f61e72e5bd37e2ec91927a661fb9762f678cbea52d43 + md5: 5d3c008e54c7f49592fca9c32896a76f + depends: + - __glibc >=2.17,<3.0.a0 + - cffi + - libgcc >=14 + - libstdcxx >=14 + - python >=3.14,<3.15.0a0 + - python_abi 3.14.* *_cp314 + license: MIT + license_family: MIT + size: 15004 + timestamp: 1769438727085 +- conda: https://conda.anaconda.org/conda-forge/noarch/virtualenv-21.3.0-pyhcf101f3_0.conda + sha256: defaf2bc2a3cf6f1455149531e8be4d03e18eb1d022ffe4f4d964d49bbf0fe34 + md5: da6e70a64226740cef159121dbe40b95 + depends: + - python >=3.10 + - distlib >=0.3.7,<1 + - filelock <4,>=3.24.2 + - importlib-metadata >=6.6 + - platformdirs >=3.9.1,<5 + - python-discovery >=1 + - typing_extensions >=4.13.2 + - python + license: MIT + license_family: MIT + size: 5161814 + timestamp: 1777321763628 +- conda: https://conda.anaconda.org/conda-forge/linux-64/yaml-0.2.5-h280c20c_3.conda + sha256: 6d9ea2f731e284e9316d95fa61869fe7bbba33df7929f82693c121022810f4ad + md5: a77f85f77be52ff59391544bfe73390a + depends: + - libgcc >=14 + - __glibc >=2.17,<3.0.a0 + license: MIT + license_family: MIT + size: 85189 + timestamp: 1753484064210 +- conda: https://conda.anaconda.org/conda-forge/noarch/zipp-3.23.1-pyhcf101f3_0.conda + sha256: 523616c0530d305d2216c2b4a8dfd3872628b60083255b89c5e0d8c42e738cca + md5: e1c36c6121a7c9c76f2f148f1e83b983 + depends: + - python >=3.10 + - python + license: MIT + license_family: MIT + size: 24461 + timestamp: 1776131454755 +- conda: https://conda.anaconda.org/conda-forge/linux-64/zstd-1.5.7-hb78ec9c_6.conda + sha256: 68f0206ca6e98fea941e5717cec780ed2873ffabc0e1ed34428c061e2c6268c7 + md5: 4a13eeac0b5c8e5b8ab496e6c4ddd829 + depends: + - __glibc >=2.17,<3.0.a0 + - libzlib >=1.3.1,<2.0a0 + license: BSD-3-Clause + license_family: BSD + size: 601375 + timestamp: 1764777111296 diff --git a/benchmarks/cuda_core/pixi.toml b/benchmarks/cuda_core/pixi.toml new file mode 100644 index 00000000000..419dfd91b92 --- /dev/null +++ b/benchmarks/cuda_core/pixi.toml @@ -0,0 +1,52 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +[workspace] +channels = ["conda-forge"] +platforms = ["linux-64"] +preview = ["pixi-build"] +channel-priority = "disabled" + +[feature.cu13.system-requirements] +cuda = "13" + +[feature.cu13-pinned.dependencies] +cuda-version = "13.1.*" + +[feature.cu13-source.dependencies] +cuda-version = "13.*" + +[feature.bench.dependencies] +python = "3.14.*" +pyperf = "*" +numpy = "*" + +[feature.dev.dependencies] +pre-commit = "*" + +# Wheel environment: released cuda-core from conda-forge. +[feature.core-wheel.dependencies] +cuda-core = "==0.7.0" + +# Source environment: build cuda-core + cuda-bindings from the in-tree +# sources so local changes are exercised. Mirrors cuda_core/pixi.toml. +[feature.core-source.dependencies] +cuda-core = { path = "../../cuda_core" } +cuda-bindings = { path = "../../cuda_bindings" } + +[environments] +wheel = { features = ["cu13", "cu13-pinned", "bench", "dev", "core-wheel"] } +source = { features = ["cu13", "cu13-source", "bench", "dev", "core-source"] } + +[target.linux.tasks.bench] +cmd = ["python", "$PIXI_PROJECT_ROOT/run_pyperf.py"] + +[target.linux.tasks.bench-smoke-test] +cmd = ["python", "$PIXI_PROJECT_ROOT/run_pyperf.py", "--debug-single-value"] + +[target.linux.tasks.bench-compare] +cmd = ["python", "$PIXI_PROJECT_ROOT/compare.py"] + +[target.linux.tasks.lint] +cmd = ["pre-commit", "run", "--all-files"] diff --git a/benchmarks/cuda_core/run_pyperf.py b/benchmarks/cuda_core/run_pyperf.py new file mode 100644 index 00000000000..1f0c4b130b1 --- /dev/null +++ b/benchmarks/cuda_core/run_pyperf.py @@ -0,0 +1,32 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +"""Entry point for the cuda.core latency benchmark suite. + +The pyperf runner lives in the cuda_bindings suite. Reuse it by putting +that directory on sys.path, then call main() with this suite's paths. +pyperf workers re-execute this script, so the sys.path tweak is done +before the worker can import anything. +""" + +import sys +from pathlib import Path + +HERE = Path(__file__).resolve().parent +CUDA_BINDINGS_SUITE = HERE.parent / "cuda_bindings" + +# Share the runner with cuda_bindings; keep cuda_core's own modules +# (benchmarks/, runtime.py) resolvable via the script's own directory. +if str(CUDA_BINDINGS_SUITE) not in sys.path: + sys.path.append(str(CUDA_BINDINGS_SUITE)) + +from runner.main import main + +if __name__ == "__main__": + main( + bench_dir=HERE / "benchmarks", + default_output=HERE / "results-python.json", + module_name_prefix="cuda_core_bench", + bench_filter_env_var="CUDA_CORE_BENCH_FILTER", + ) diff --git a/benchmarks/cuda_core/runtime.py b/benchmarks/cuda_core/runtime.py new file mode 100644 index 00000000000..d2942f40240 --- /dev/null +++ b/benchmarks/cuda_core/runtime.py @@ -0,0 +1,53 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +"""Shared cuda.core setup for the latency benchmarks. + +Holds the one Device/stream/ObjectCode instance that every bench module +reuses. No state is shared with the cuda_bindings suite — each suite +runs standalone in its own process. +""" + +import atexit + +from cuda.core import Device, Program, ProgramOptions + +_device: Device | None = None +_modules: list = [] + + +def ensure_device() -> Device: + """Return the primary Device, initializing it on first call.""" + global _device + if _device is not None: + return _device + dev = Device() + dev.set_current() + _device = dev + return dev + + +def register_module(module) -> object: + """Keep a reference to an ObjectCode so its kernels stay alive.""" + _modules.append(module) + return module + + +def compile_module(kernel_source: str, name_expressions: tuple[str, ...]) -> object: + """Compile a CUDA C++ source with NVRTC via cuda.core.Program. + + name_expressions must list every __global__ function the caller + intends to fetch via ObjectCode.get_kernel(). + """ + dev = ensure_device() + options = ProgramOptions(arch=f"sm_{dev.arch}", fma=False) + prog = Program(kernel_source, code_type="c++", options=options) + return register_module(prog.compile("cubin", name_expressions=name_expressions)) + + +def cleanup() -> None: + _modules.clear() + + +atexit.register(cleanup) diff --git a/ci/.ci-pipeline-regen.md b/ci/.ci-pipeline-regen.md new file mode 100644 index 00000000000..7ddf9b970d5 --- /dev/null +++ b/ci/.ci-pipeline-regen.md @@ -0,0 +1,106 @@ +# CUDA Python CI Pipeline SVG Regeneration Instructions + +This file contains the prompt and requirements for regenerating `ci-pipeline.svg` with the same styling and content. + +## Styling Requirements + +- Hand-drawn Excalidraw-style design with rough, sketchy borders +- Comic Sans MS font family for all text +- Imperfect lines and curves that mimic hand-drawn aesthetics +- Canvas size: 900x800 pixels +- Color scheme: + - Trigger Events: #e8f4fd background, #2196F3 border, #1976D2 text + - Build Stage: #f3e5f5 background, #9C27B0 border, #7B1FA2 text + - Artifact Storage: #fff3e0 background, #FF9800 border, #F57C00 text + - Test Stage: #e8f5e8 background, #4CAF50 border, #388E3C text + - Release Pipeline: #ffebee background, #f44336 border, #D32F2F text + +## Content Structure + +1. **Title**: "CUDA Python CI Pipeline Flow" + +2. **Trigger Events** (top blue box): + - Push to main branch + - Pull request + - Manual workflow dispatch + +3. **Build Stage** (purple box): + - Three platform boxes: linux-64 (Self-hosted), linux-aarch64 (Self-hosted), win-64 (GitHub-hosted) + - Details: Python versions 3.9-3.13, CUDA 13.0.0 (build-time) + - Components: cuda-core, cuda-bindings, cuda-pathfinder, cuda-python + +4. **Artifact Storage** (orange box): + - GitHub Artifacts box: Wheel files (.whl), Test artifacts, Documentation (30-day retention) + - GitHub Cache box: Mini CTK cache + +5. **Test Stage** (green box): + - Three platform boxes: linux-64 (Self-hosted), linux-aarch64 (Self-hosted), win-64 (GitHub-hosted) + - Details: Download wheels from artifacts, Test against multiple CUDA runtime versions, Run Python unit tests, Cython tests, examples + - Artifact Flows (in red text): + • cuda-pathfinder: main → backport + • cuda-bindings: backport → main + +6. **Release Pipeline** (red box): + - Three sequential boxes: Validation → Publishing → Documentation + - Validation: Artifact integrity, Git tag verification + - Publishing: PyPI/TestPyPI, Component or all releases + - Documentation: GitHub Pages, Release notes + - Details: Manual workflow dispatch with run ID, Supports individual component or full releases + +## Arrow Requirements + +- Main flow arrows: Trigger → Build → Artifact → Test → Release +- Additional artifact flow arrows (dashed, orange #FF9800): + - From GitHub Cache (mini CTK) back to Build Stage with "mini CTK reuse" label + - From GitHub Artifacts (wheels) to Release Pipeline with "wheel fetch" label + - **NEW**: From GitHub Cache (mini CTK) to Test Stage with "mini CTK reuse" label + - **NEW**: From GitHub Artifacts (wheels) to Test Stage with "wheel fetch" label +- Arrow marker definition with hand-drawn style (orange arrow heads, not black) +- Use stroke-dasharray="5,3" for artifact flow arrows + +## Critical Arrow Positioning Requirements (UPDATED) + +**IMPORTANT**: Arrows must NOT overlap with stage boxes. Ensure proper clearance: + +1. **Mini CTK reuse arrow** (GitHub Cache → Build Stage): + - Arrow endpoint Y coordinate must be BELOW the Build Stage box edge (y=292) + - Use y=295 or greater for the endpoint to ensure no overlap + - Position "mini CTK reuse" text to the RIGHT of the arrow (not left) for less visual clutter + - Text color should be orange (#FF9800) to match arrow + +2. **Wheel fetch arrow** (GitHub Artifacts → Release Pipeline): + - Arrow endpoint Y coordinate must be ABOVE the Release Pipeline box edge (y=652) + - Use y=645 or smaller for the endpoint to provide proper margin + - Position "wheel fetch" text between Test Stage and Release Pipeline boxes + - Text should be to the LEFT of the arrow for better spacing + +## Font Size Requirements (UPDATED) + +- ALL text labels must use consistent 12pt font size for readability +- No 9pt text - this is too small and hard to read +- Title: 16pt, Stage headers: 14pt, All other text: 12pt + +## Key Features + +- All boxes use rough, hand-drawn paths (not perfect rectangles) +- Text should be properly sized and positioned within boxes +- Platform boxes within each stage should be clearly separated +- Maintain consistent spacing and alignment +- Orange arrow heads must match the orange arrow color + +## Text Positioning + +- Use text-anchor="middle" for centered headers +- Use text-anchor="start" for left-aligned bullet points +- Ensure all text fits within their enclosing boxes +- Use transforms for angled text labels on artifact flow arrows +- Artifact flow arrow text positioning is critical - follow positioning requirements above + +## Recent Manual Adjustments Applied + +- Fixed arrow endpoint positioning to prevent overlap with stage boxes +- Moved mini CTK reuse arrow endpoint from y=285 to y=295 +- Moved wheel fetch arrow endpoint from y=650 to y=645 +- Repositioned text labels for better visual separation +- Standardized all text to 12pt font size for consistency +- Changed arrow heads from black to orange to match arrow color diff --git a/ci/ci-pipeline.svg b/ci/ci-pipeline.svg new file mode 100644 index 00000000000..eeff4c69fd1 --- /dev/null +++ b/ci/ci-pipeline.svg @@ -0,0 +1,172 @@ + + + + + + + + + + + + + + + + + + CUDA Python CI Pipeline Flow + + + + TRIGGER EVENTS + • Push to main branch + • Pull request + • Manual workflow dispatch + + + + + + BUILD STAGE + + + + linux-64 + Self-hosted + + + linux-aarch64 + Self-hosted + + + win-64 + GitHub-hosted + + + • Python versions: 3.9, 3.10, 3.11, 3.12, 3.13 + • CUDA version: 13.0.0 (build-time) + • Components: cuda-core, cuda-bindings, + cuda-pathfinder, cuda-python + + + + wheel upload + + + + ARTIFACT STORAGE + + + + GitHub Artifacts + • Wheel files (.whl) + • Test artifacts + • Documentation + (30-day retention) + + + GitHub Cache + • Mini CTK cache + + + + + + + + mini CTK reuse + + + + wheel fetch + + + + + mini CTK reuse + + + + wheel fetch + + + + TEST STAGE + + + + linux-64 + Self-hosted + + + linux-aarch64 + Self-hosted + + + win-64 + GitHub-hosted + + + • Download wheels from artifacts + • Test against multiple CUDA runtime versions + • Run Python unit tests, Cython tests, examples + Artifact Flows: + • cuda-pathfinder: main → backport + • cuda-bindings: backport → main + + + + + + + RELEASE PIPELINE + + + + Validation + • Artifact integrity + • Git tag verification + + + + + + Publishing + • PyPI/TestPyPI + • Component or all releases + + + + + + Documentation + • GitHub Pages + • Release notes + + + • Manual workflow dispatch with run ID + • Supports individual component or full releases + diff --git a/ci/cleanup-pr-previews b/ci/cleanup-pr-previews new file mode 100755 index 00000000000..17fd89ab6c0 --- /dev/null +++ b/ci/cleanup-pr-previews @@ -0,0 +1,283 @@ +#!/usr/bin/env bash + +# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +# A utility script to clean up PR preview documentation folders for closed/merged PRs. +# This script checks all pr-XXXXX folders in the gh-pages branch docs/pr-preview/ directory, +# verifies if the corresponding PR XXXXX is still open, and removes preview folders +# for PRs that have been closed or merged. + +set -euo pipefail + +# Colors for output +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +NC='\033[0m' # No Color + +# Usage information +usage() { + cat << EOF +PR Preview Cleanup Script - Clean up stale PR preview documentation folders + +This script fetches all pr-XXXXX folders from docs/pr-preview/ in the gh-pages branch, +checks PR status via GitHub API, and removes folders for closed/merged/deleted PRs. + +USAGE: $0 [OPTIONS] + +OPTIONS: + -n, --dry-run Preview what would be deleted without actually deleting + --push Commit and push changes to gh-pages (default: false, requires manual push) + -h, --help Show this help message + +EXAMPLES: + $0 -n # Preview what would be cleaned up (RECOMMENDED FIRST) + $0 # Clean up folders locally (no push) + $0 --push # Clean up folders and push to gh-pages branch + $0 --dry-run --push # Invalid combination (dry-run takes precedence) + +REQUIREMENTS: + - GH_TOKEN environment variable must be set with appropriate permissions + - 'gh' (GitHub CLI) must be installed and authenticated + - 'jq' must be installed for JSON parsing + +SAFETY: +Always run with --dry-run first to verify expected behavior before actual cleanup. +The script will show a summary of what would be removed. Use --push to automatically +commit and push changes, otherwise manual git operations are required. + +This script is specifically designed for the NVIDIA/cuda-python repository structure. +EOF + exit 1 +} + +# Configuration - hardcoded for this specific repository +REPOSITORY="NVIDIA/cuda-python" +DRY_RUN="false" +PUSH_CHANGES="false" + +# Parse command line arguments +while [[ $# -gt 0 ]]; do + case $1 in + -n|--dry-run) + DRY_RUN="true" + shift + ;; + --push) + PUSH_CHANGES="true" + shift + ;; + -h|--help) + usage + ;; + *) + echo -e "${RED}[ERROR]${NC} Unknown option: $1" >&2 + echo "Use --help for usage information" >&2 + exit 1 + ;; + esac +done + +# Validate required tools and environment +echo -e "${YELLOW}[INFO]${NC} Checking prerequisites..." + +if [[ -z "${GH_TOKEN:-}" ]]; then + echo -e "${RED}[ERROR]${NC} GH_TOKEN environment variable is required" >&2 + exit 1 +fi + +if ! command -v jq >/dev/null 2>&1; then + echo -e "${RED}[ERROR]${NC} jq is required but not installed" >&2 + exit 1 +fi + +if ! command -v gh >/dev/null 2>&1; then + echo -e "${RED}[ERROR]${NC} GitHub CLI (gh) is required but not installed" >&2 + exit 1 +fi + +echo -e "${GREEN}[INFO]${NC} All prerequisites satisfied" + +# Fetch PR preview folders from gh-pages branch +echo -e "${YELLOW}[INFO]${NC} Fetching PR preview folders from gh-pages branch..." + +# Get the list of pr-XXXXX folders from gh-pages branch +PR_FOLDERS=$(gh api repos/"${REPOSITORY}"/contents/docs/pr-preview?ref=gh-pages \ + --header "Accept: application/vnd.github+json" \ + --jq '.[] | select(.type == "dir" and (.name | test("^pr-[0-9]+$"))) | .name' \ + 2>/dev/null || true) + +if [[ -z "$PR_FOLDERS" ]]; then + echo -e "${YELLOW}[INFO]${NC} No PR preview folders found in gh-pages branch" + exit 0 +fi + +echo -e "${GREEN}[INFO]${NC} Found $(echo "$PR_FOLDERS" | wc -l) PR preview folders" + +# Check each PR folder +FOLDERS_TO_REMOVE=() +TOTAL_FOLDERS=0 +OPEN_PRS=0 + +while IFS= read -r folder; do + if [[ -z "$folder" ]]; then + continue + fi + + TOTAL_FOLDERS=$((TOTAL_FOLDERS + 1)) + + # Extract PR number from folder name (pr-XXXXX -> XXXXX) + PR_NUMBER="${folder#pr-}" + + echo -e "${YELLOW}[CHECK]${NC} Checking PR #${PR_NUMBER}..." + + # Check PR status using GitHub API + PR_STATUS=$(gh api repos/"${REPOSITORY}"/pulls/"${PR_NUMBER}" \ + --header "Accept: application/vnd.github+json" \ + --jq '.state' 2>/dev/null || echo "not_found") + + case "$PR_STATUS" in + "open") + echo -e "${GREEN}[KEEP]${NC} PR #${PR_NUMBER} is still open" + OPEN_PRS=$((OPEN_PRS + 1)) + ;; + "closed") + echo -e "${RED}[REMOVE]${NC} PR #${PR_NUMBER} is closed" + FOLDERS_TO_REMOVE+=("$folder") + ;; + "not_found") + echo -e "${RED}[REMOVE]${NC} PR #${PR_NUMBER} not found (may have been deleted)" + FOLDERS_TO_REMOVE+=("$folder") + ;; + *) + echo -e "${YELLOW}[UNKNOWN]${NC} PR #${PR_NUMBER} has unexpected status: ${PR_STATUS}" + ;; + esac +done <<< "$PR_FOLDERS" + +# Summary +echo "" +echo -e "${YELLOW}[SUMMARY]${NC}" +echo "Total PR preview folders: ${TOTAL_FOLDERS}" +echo "Open PRs: ${OPEN_PRS}" +echo "Folders to remove: ${#FOLDERS_TO_REMOVE[@]}" + +if [[ ${#FOLDERS_TO_REMOVE[@]} -eq 0 ]]; then + echo -e "${GREEN}[INFO]${NC} No cleanup needed - all preview folders correspond to open PRs" + exit 0 +fi + +# List folders to be removed +echo "" +echo -e "${YELLOW}[FOLDERS TO REMOVE]${NC}" +for folder in "${FOLDERS_TO_REMOVE[@]}"; do + pr_num="${folder#pr-}" + echo " - $folder (PR #${pr_num})" +done + +# Perform cleanup or show what would be done +echo "" +if [[ "$DRY_RUN" == "true" ]]; then + echo -e "${YELLOW}[DRY RUN]${NC} Would remove ${#FOLDERS_TO_REMOVE[@]} folders (run without --dry-run to actually remove)" +else + echo -e "${RED}[CLEANUP]${NC} Proceeding to remove ${#FOLDERS_TO_REMOVE[@]} folders..." + + # Create a git worktree for gh-pages branch + TEMP_DIR="./gh-pages-cleanup" + + # Safely remove any existing worktree and directory + if [[ -d "$TEMP_DIR" ]]; then + echo -e "${YELLOW}[INFO]${NC} Cleaning up existing worktree at $TEMP_DIR..." + # Try to remove existing worktree first (if it's registered) + git worktree remove "$TEMP_DIR" --force >/dev/null 2>&1 || true + # Now remove the directory + rm -rf "$TEMP_DIR" + fi + + # Cleanup function to properly remove worktree and temp directory + cleanup_worktree() { + cd - >/dev/null 2>&1 || true # Go back to original directory + # Only cleanup if changes have been pushed or if no changes were made + if [[ "${CHANGES_PUSHED:-false}" == "true" ]] || [[ "${REMOVED_COUNT:-0}" -eq 0 ]]; then + if [[ -n "$TEMP_DIR" && -d "$TEMP_DIR" ]]; then + git worktree remove "$TEMP_DIR" --force >/dev/null 2>&1 || true + fi + rm -rf "$TEMP_DIR" >/dev/null 2>&1 || true + else + echo -e "${YELLOW}[INFO]${NC} Worktree preserved at $TEMP_DIR for manual verification" >&2 + echo -e "${YELLOW}[INFO]${NC} Remove manually with: git worktree remove $TEMP_DIR && rm -rf $TEMP_DIR" >&2 + fi + } + trap cleanup_worktree EXIT + + # Ensure the local gh-pages branch is up-to-date + git fetch origin gh-pages:gh-pages + + echo -e "${YELLOW}[INFO]${NC} Creating git worktree for gh-pages branch..." + if ! git worktree add "$TEMP_DIR" gh-pages >/dev/null 2>&1; then + echo -e "${RED}[ERROR]${NC} Failed to create git worktree for gh-pages branch" >&2 + + # Check if the issue might be a leftover worktree registration + if git worktree list | grep -q "$TEMP_DIR" 2>/dev/null; then + echo -e "${YELLOW}[INFO]${NC} Found existing worktree registration, attempting to clean up..." >&2 + git worktree remove "$TEMP_DIR" --force >/dev/null 2>&1 || true + rm -rf "$TEMP_DIR" >/dev/null 2>&1 || true + + # Try again + if ! git worktree add "$TEMP_DIR" gh-pages >/dev/null 2>&1; then + echo -e "${RED}[ERROR]${NC} Still unable to create worktree after cleanup" >&2 + exit 1 + fi + else + echo "Make sure the gh-pages branch exists and is accessible" >&2 + exit 1 + fi + fi + + cd "$TEMP_DIR" + + # Remove each folder + REMOVED_COUNT=0 + for folder in "${FOLDERS_TO_REMOVE[@]}"; do + pr_num="${folder#pr-}" + folder_path="docs/pr-preview/$folder" + + if [[ -d "$folder_path" ]]; then + echo -e "${YELLOW}[REMOVE]${NC} Removing $folder_path" + rm -rf "$folder_path" + git add "$folder_path" + REMOVED_COUNT=$((REMOVED_COUNT + 1)) + else + echo -e "${YELLOW}[SKIP]${NC} Folder $folder_path not found locally" + fi + done + + if [[ $REMOVED_COUNT -gt 0 ]]; then + # Commit and push changes + commit_message="Clean up PR preview folders for ${REMOVED_COUNT} closed/merged PRs + +Removed preview folders for the following PRs: +$(printf '%s\n' "${FOLDERS_TO_REMOVE[@]}" | sed 's/^pr-/- PR #/' | head -20) +$(if [[ ${#FOLDERS_TO_REMOVE[@]} -gt 20 ]]; then echo "... and $((${#FOLDERS_TO_REMOVE[@]} - 20)) more"; fi)" + + echo -e "${YELLOW}[INFO]${NC} Committing changes..." + git commit -m "$commit_message" + + if [[ "$PUSH_CHANGES" == "true" ]]; then + echo -e "${YELLOW}[INFO]${NC} Pushing to gh-pages branch..." + git push origin gh-pages + CHANGES_PUSHED="true" + echo -e "${GREEN}[SUCCESS]${NC} Cleanup completed! Removed ${REMOVED_COUNT} PR preview folders and pushed changes" + else + CHANGES_PUSHED="false" + echo -e "${GREEN}[SUCCESS]${NC} Cleanup completed! Removed ${REMOVED_COUNT} PR preview folders" + echo -e "${YELLOW}[INFO]${NC} Changes have been committed locally but not pushed. Use 'git push origin gh-pages' to push manually." + echo -e "${YELLOW}[WARNING]${NC} Worktree will be preserved for manual verification." + fi + else + CHANGES_PUSHED="true" # No changes made, safe to cleanup + echo -e "${YELLOW}[INFO]${NC} No folders were actually removed (they may have been cleaned up already)" + fi +fi diff --git a/ci/test-matrix.yml b/ci/test-matrix.yml new file mode 100644 index 00000000000..0adb0142ae7 --- /dev/null +++ b/ci/test-matrix.yml @@ -0,0 +1,147 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 +# +# Test matrix configurations for CUDA Python CI workflows. This file consolidates +# the test matrices that were previously hardcoded in the workflow files. All GPU +# and ARCH values are hard-coded for each architecture: various GPUs for amd64, +# alternating a100/l4 for arm64. +# +# Please keep the matrices sorted in ascending order by the following: +# +# [ARCH, PY_VER, CUDA_VER, LOCAL_CTK, GPU, GPU_COUNT, DRIVER] +# +# Windows entries also include DRIVER_MODE. +# +# Notes: +# - DRIVER accepts: +# * 'latest' - use the runner's pre-installed latest driver (no install step) +# * 'earliest' - use the runner's pre-installed earliest driver (no install step) +# * a version string (e.g. '580.65.06') +# - install that version via ci/tools/install_gpu_driver.sh (Linux) +# or ci/tools/install_gpu_driver.ps1 (Windows) at the start of the +# job. The matrix row is routed to the 'latest' runner image (the +# install scripts swap the driver themselves). +# - DRIVER: 'earliest' does not work with CUDA 12.9.1 +# - DRIVER: a custom version is not supported with FLAVOR=wsl on Linux. +# - ENV: optional map of extra environment variables to inject into the test +# job. Every key/value pair is written to GITHUB_ENV after the standard +# environment-variable setup step, so the variables are visible to all +# subsequent steps (including the cuda.bindings and cuda.core test +# steps). Nightly rows also use ENV.MODE as a matrix-filter tag (see +# ci-nightly.yml). Examples: +# ENV: { CUDA_PYTHON_CUDA_PER_THREAD_DEFAULT_STREAM: '1' } +# ENV: { MODE: 'nightly-pytorch', TORCH_VER: '2.12.1', TORCH_CUDA: 'cu126' } + +linux: + pull-request: + # linux-64 + - { ARCH: 'amd64', PY_VER: '3.10', CUDA_VER: '12.9.1', LOCAL_CTK: '1', GPU: 'v100', GPU_COUNT: '1', DRIVER: 'latest' } + - { ARCH: 'amd64', PY_VER: '3.10', CUDA_VER: '13.0.2', LOCAL_CTK: '0', GPU: 'l4', GPU_COUNT: '1', DRIVER: 'latest' } + - { ARCH: 'amd64', PY_VER: '3.10', CUDA_VER: '13.3.0', LOCAL_CTK: '0', GPU: 'l4', GPU_COUNT: '1', DRIVER: 'latest' } + - { ARCH: 'amd64', PY_VER: '3.11', CUDA_VER: '12.9.1', LOCAL_CTK: '0', GPU: 'rtxpro6000', GPU_COUNT: '1', DRIVER: 'latest' } + - { ARCH: 'amd64', PY_VER: '3.11', CUDA_VER: '13.0.2', LOCAL_CTK: '1', GPU: 'l4', GPU_COUNT: '1', DRIVER: 'latest' } + - { ARCH: 'amd64', PY_VER: '3.11', CUDA_VER: '13.3.0', LOCAL_CTK: '1', GPU: 'l4', GPU_COUNT: '1', DRIVER: 'latest' } + - { ARCH: 'amd64', PY_VER: '3.12', CUDA_VER: '12.9.1', LOCAL_CTK: '1', GPU: 'l4', GPU_COUNT: '1', DRIVER: 'latest', ENV: { CUDA_PYTHON_CUDA_PER_THREAD_DEFAULT_STREAM: '1' } } + - { ARCH: 'amd64', PY_VER: '3.12', CUDA_VER: '13.0.2', LOCAL_CTK: '0', GPU: 'l4', GPU_COUNT: '1', DRIVER: 'latest' } + - { ARCH: 'amd64', PY_VER: '3.12', CUDA_VER: '13.3.0', LOCAL_CTK: '0', GPU: 'l4', GPU_COUNT: '1', DRIVER: 'latest' } + - { ARCH: 'amd64', PY_VER: '3.13', CUDA_VER: '12.9.1', LOCAL_CTK: '0', GPU: 'v100', GPU_COUNT: '1', DRIVER: 'latest' } + - { ARCH: 'amd64', PY_VER: '3.13', CUDA_VER: '13.0.2', LOCAL_CTK: '1', GPU: 'rtxpro6000', GPU_COUNT: '1', DRIVER: 'latest' } + - { ARCH: 'amd64', PY_VER: '3.13', CUDA_VER: '13.3.0', LOCAL_CTK: '1', GPU: 'rtxpro6000', GPU_COUNT: '1', DRIVER: '610.43.02' } + - { ARCH: 'amd64', PY_VER: '3.14', CUDA_VER: '12.9.1', LOCAL_CTK: '0', GPU: 't4', GPU_COUNT: '1', DRIVER: 'latest' } + - { ARCH: 'amd64', PY_VER: '3.14', CUDA_VER: '13.0.2', LOCAL_CTK: '1', GPU: 'l4', GPU_COUNT: '1', DRIVER: 'latest' } + - { ARCH: 'amd64', PY_VER: '3.14', CUDA_VER: '13.3.0', LOCAL_CTK: '1', GPU: 'l4', GPU_COUNT: '1', DRIVER: '610.43.02' } + - { ARCH: 'amd64', PY_VER: '3.14t', CUDA_VER: '12.9.1', LOCAL_CTK: '1', GPU: 't4', GPU_COUNT: '1', DRIVER: 'latest' } + - { ARCH: 'amd64', PY_VER: '3.14t', CUDA_VER: '13.0.2', LOCAL_CTK: '1', GPU: 'l4', GPU_COUNT: '1', DRIVER: 'latest' } + - { ARCH: 'amd64', PY_VER: '3.14t', CUDA_VER: '13.3.0', LOCAL_CTK: '1', GPU: 'l4', GPU_COUNT: '1', DRIVER: 'latest' } + - { ARCH: 'amd64', PY_VER: '3.15', CUDA_VER: '13.3.0', LOCAL_CTK: '0', GPU: 'l4', GPU_COUNT: '1', DRIVER: 'latest' } + - { ARCH: 'amd64', PY_VER: '3.15t', CUDA_VER: '13.3.0', LOCAL_CTK: '0', GPU: 'l4', GPU_COUNT: '1', DRIVER: 'latest' } + # linux-aarch64 + - { ARCH: 'arm64', PY_VER: '3.10', CUDA_VER: '12.9.1', LOCAL_CTK: '1', GPU: 'a100', GPU_COUNT: '1', DRIVER: 'latest' } + - { ARCH: 'arm64', PY_VER: '3.10', CUDA_VER: '13.0.2', LOCAL_CTK: '0', GPU: 'l4', GPU_COUNT: '1', DRIVER: 'latest' } + - { ARCH: 'arm64', PY_VER: '3.10', CUDA_VER: '13.3.0', LOCAL_CTK: '0', GPU: 'a100', GPU_COUNT: '1', DRIVER: 'latest' } + - { ARCH: 'arm64', PY_VER: '3.11', CUDA_VER: '12.9.1', LOCAL_CTK: '0', GPU: 'l4', GPU_COUNT: '1', DRIVER: 'latest' } + - { ARCH: 'arm64', PY_VER: '3.11', CUDA_VER: '13.0.2', LOCAL_CTK: '1', GPU: 'a100', GPU_COUNT: '1', DRIVER: 'latest' } + - { ARCH: 'arm64', PY_VER: '3.11', CUDA_VER: '13.3.0', LOCAL_CTK: '1', GPU: 'l4', GPU_COUNT: '1', DRIVER: 'latest' } + - { ARCH: 'arm64', PY_VER: '3.12', CUDA_VER: '12.9.1', LOCAL_CTK: '1', GPU: 'a100', GPU_COUNT: '1', DRIVER: 'latest' } + - { ARCH: 'arm64', PY_VER: '3.12', CUDA_VER: '13.0.2', LOCAL_CTK: '0', GPU: 'l4', GPU_COUNT: '1', DRIVER: 'latest' } + - { ARCH: 'arm64', PY_VER: '3.12', CUDA_VER: '13.3.0', LOCAL_CTK: '0', GPU: 'a100', GPU_COUNT: '1', DRIVER: 'latest' } + - { ARCH: 'arm64', PY_VER: '3.13', CUDA_VER: '12.9.1', LOCAL_CTK: '0', GPU: 'l4', GPU_COUNT: '1', DRIVER: 'latest' } + - { ARCH: 'arm64', PY_VER: '3.13', CUDA_VER: '13.0.2', LOCAL_CTK: '1', GPU: 'a100', GPU_COUNT: '1', DRIVER: 'latest' } + - { ARCH: 'arm64', PY_VER: '3.13', CUDA_VER: '13.3.0', LOCAL_CTK: '1', GPU: 'l4', GPU_COUNT: '1', DRIVER: 'latest' } + - { ARCH: 'arm64', PY_VER: '3.14', CUDA_VER: '12.9.1', LOCAL_CTK: '0', GPU: 'a100', GPU_COUNT: '1', DRIVER: 'latest' } + - { ARCH: 'arm64', PY_VER: '3.14', CUDA_VER: '13.0.2', LOCAL_CTK: '1', GPU: 'l4', GPU_COUNT: '1', DRIVER: 'latest' } + - { ARCH: 'arm64', PY_VER: '3.14', CUDA_VER: '13.3.0', LOCAL_CTK: '1', GPU: 'a100', GPU_COUNT: '1', DRIVER: 'latest' } + - { ARCH: 'arm64', PY_VER: '3.14t', CUDA_VER: '12.9.1', LOCAL_CTK: '1', GPU: 'l4', GPU_COUNT: '1', DRIVER: 'latest' } + - { ARCH: 'arm64', PY_VER: '3.14t', CUDA_VER: '13.0.2', LOCAL_CTK: '0', GPU: 'a100', GPU_COUNT: '1', DRIVER: 'latest' } + - { ARCH: 'arm64', PY_VER: '3.14t', CUDA_VER: '13.3.0', LOCAL_CTK: '1', GPU: 'l4', GPU_COUNT: '1', DRIVER: 'latest' } + # special runners + - { ARCH: 'amd64', PY_VER: '3.13', CUDA_VER: '13.0.2', LOCAL_CTK: '1', GPU: 'h100', GPU_COUNT: '1', DRIVER: 'latest' } + - { ARCH: 'amd64', PY_VER: '3.13', CUDA_VER: '13.3.0', LOCAL_CTK: '1', GPU: 'h100', GPU_COUNT: '1', DRIVER: 'latest' } + - { ARCH: 'amd64', PY_VER: '3.14', CUDA_VER: '13.3.0', LOCAL_CTK: '1', GPU: 't4', GPU_COUNT: '2', DRIVER: 'latest' } + - { ARCH: 'amd64', PY_VER: '3.14t', CUDA_VER: '13.3.0', LOCAL_CTK: '1', GPU: 'h100', GPU_COUNT: '2', DRIVER: 'latest' } + - { ARCH: 'amd64', PY_VER: '3.11', CUDA_VER: '12.9.1', LOCAL_CTK: '0', GPU: 't4', GPU_COUNT: '1', DRIVER: 'latest', FLAVOR: 'wsl' } + - { ARCH: 'amd64', PY_VER: '3.12', CUDA_VER: '13.3.0', LOCAL_CTK: '0', GPU: 'rtx4090', GPU_COUNT: '1', DRIVER: 'latest', FLAVOR: 'wsl' } + nightly: + # nightly-pytorch + - { ARCH: 'amd64', PY_VER: '3.12', CUDA_VER: '12.6.3', LOCAL_CTK: '0', GPU: 'l4', GPU_COUNT: '1', DRIVER: 'latest', ENV: { MODE: 'nightly-pytorch', TORCH_VER: '2.12.1', TORCH_CUDA: 'cu126' } } + - { ARCH: 'amd64', PY_VER: '3.12', CUDA_VER: '13.0.2', LOCAL_CTK: '0', GPU: 'l4', GPU_COUNT: '1', DRIVER: 'latest', ENV: { MODE: 'nightly-pytorch', TORCH_VER: '2.12.1', TORCH_CUDA: 'cu130' } } + - { ARCH: 'amd64', PY_VER: '3.12', CUDA_VER: '12.6.3', LOCAL_CTK: '0', GPU: 'l4', GPU_COUNT: '1', DRIVER: 'latest', ENV: { MODE: 'nightly-pytorch', TORCH_VER: '2.9.1', TORCH_CUDA: 'cu126' } } + - { ARCH: 'amd64', PY_VER: '3.12', CUDA_VER: '13.0.2', LOCAL_CTK: '0', GPU: 'l4', GPU_COUNT: '1', DRIVER: 'latest', ENV: { MODE: 'nightly-pytorch', TORCH_VER: '2.9.1', TORCH_CUDA: 'cu130' } } + - { ARCH: 'arm64', PY_VER: '3.12', CUDA_VER: '12.6.3', LOCAL_CTK: '0', GPU: 'l4', GPU_COUNT: '1', DRIVER: 'latest', ENV: { MODE: 'nightly-pytorch', TORCH_VER: '2.12.1', TORCH_CUDA: 'cu126' } } + - { ARCH: 'arm64', PY_VER: '3.12', CUDA_VER: '13.0.2', LOCAL_CTK: '0', GPU: 'l4', GPU_COUNT: '1', DRIVER: 'latest', ENV: { MODE: 'nightly-pytorch', TORCH_VER: '2.12.1', TORCH_CUDA: 'cu130' } } + - { ARCH: 'arm64', PY_VER: '3.12', CUDA_VER: '12.6.3', LOCAL_CTK: '0', GPU: 'l4', GPU_COUNT: '1', DRIVER: 'latest', ENV: { MODE: 'nightly-pytorch', TORCH_VER: '2.9.1', TORCH_CUDA: 'cu126' } } + - { ARCH: 'arm64', PY_VER: '3.12', CUDA_VER: '13.0.2', LOCAL_CTK: '0', GPU: 'l4', GPU_COUNT: '1', DRIVER: 'latest', ENV: { MODE: 'nightly-pytorch', TORCH_VER: '2.9.1', TORCH_CUDA: 'cu130' } } + # nightly-numba-cuda + - { ARCH: 'amd64', PY_VER: '3.12', CUDA_VER: '12.9.1', LOCAL_CTK: '0', GPU: 'l4', GPU_COUNT: '1', DRIVER: 'latest', ENV: { MODE: 'nightly-numba-cuda' } } + - { ARCH: 'amd64', PY_VER: '3.12', CUDA_VER: '13.3.0', LOCAL_CTK: '0', GPU: 'l4', GPU_COUNT: '1', DRIVER: '580.65.06', ENV: { MODE: 'nightly-numba-cuda' } } + - { ARCH: 'arm64', PY_VER: '3.12', CUDA_VER: '12.9.1', LOCAL_CTK: '0', GPU: 'l4', GPU_COUNT: '1', DRIVER: 'latest', ENV: { MODE: 'nightly-numba-cuda' } } + - { ARCH: 'arm64', PY_VER: '3.12', CUDA_VER: '13.3.0', LOCAL_CTK: '0', GPU: 'l4', GPU_COUNT: '1', DRIVER: 'latest', ENV: { MODE: 'nightly-numba-cuda' } } + # nightly-numba-cuda-mlir (MLIR backend, linux-64 only) + - { ARCH: 'amd64', PY_VER: '3.12', CUDA_VER: '12.9.1', LOCAL_CTK: '0', GPU: 'rtxpro6000', GPU_COUNT: '1', DRIVER: 'latest', ENV: { MODE: 'nightly-numba-cuda-mlir' } } + - { ARCH: 'amd64', PY_VER: '3.12', CUDA_VER: '13.3.0', LOCAL_CTK: '0', GPU: 'rtxpro6000', GPU_COUNT: '1', DRIVER: 'latest', ENV: { MODE: 'nightly-numba-cuda-mlir' } } + # nightly-cuda-core (released cuda-core from PyPI against main pathfinder/bindings) + - { ARCH: 'amd64', PY_VER: '3.12', CUDA_VER: '13.3.0', LOCAL_CTK: '0', GPU: 'a100', GPU_COUNT: '1', DRIVER: 'latest', ENV: { MODE: 'nightly-cuda-core' } } + # nightly-standard (arm64 nightly-only runners — per runner team request) + - { ARCH: 'arm64', PY_VER: '3.13', CUDA_VER: '13.3.0', LOCAL_CTK: '1', GPU: 'gh200', GPU_COUNT: '1', DRIVER: 'latest', ENV: { MODE: 'nightly-standard' } } + - { ARCH: 'arm64', PY_VER: '3.14', CUDA_VER: '13.3.0', LOCAL_CTK: '1', GPU: 'gb300', GPU_COUNT: '1', DRIVER: 'latest', ENV: { MODE: 'nightly-standard' } } + - { ARCH: 'arm64', PY_VER: '3.14', CUDA_VER: '13.3.0', LOCAL_CTK: '1', GPU: 'l4', GPU_COUNT: '2', DRIVER: 'latest', ENV: { MODE: 'nightly-standard' } } + - { ARCH: 'arm64', PY_VER: '3.14t', CUDA_VER: '13.3.0', LOCAL_CTK: '1', GPU: 'l4', GPU_COUNT: '2', DRIVER: 'latest', ENV: { MODE: 'nightly-standard' } } + +windows: + pull-request: + # win-64 + - { ARCH: 'amd64', PY_VER: '3.10', CUDA_VER: '12.9.1', LOCAL_CTK: '0', GPU: 'rtx2080', GPU_COUNT: '1', DRIVER: 'latest', DRIVER_MODE: 'WDDM' } + - { ARCH: 'amd64', PY_VER: '3.10', CUDA_VER: '13.0.2', LOCAL_CTK: '1', GPU: 'rtxpro6000', GPU_COUNT: '1', DRIVER: 'latest', DRIVER_MODE: 'TCC' } + - { ARCH: 'amd64', PY_VER: '3.10', CUDA_VER: '13.3.0', LOCAL_CTK: '1', GPU: 'rtxpro6000', GPU_COUNT: '1', DRIVER: 'latest', DRIVER_MODE: 'TCC' } + - { ARCH: 'amd64', PY_VER: '3.11', CUDA_VER: '12.9.1', LOCAL_CTK: '1', GPU: 'v100', GPU_COUNT: '1', DRIVER: 'latest', DRIVER_MODE: 'MCDM' } + - { ARCH: 'amd64', PY_VER: '3.11', CUDA_VER: '13.0.2', LOCAL_CTK: '0', GPU: 'rtx4090', GPU_COUNT: '1', DRIVER: 'latest', DRIVER_MODE: 'WDDM' } + - { ARCH: 'amd64', PY_VER: '3.11', CUDA_VER: '13.3.0', LOCAL_CTK: '0', GPU: 'rtx4090', GPU_COUNT: '1', DRIVER: 'latest', DRIVER_MODE: 'WDDM' } + - { ARCH: 'amd64', PY_VER: '3.12', CUDA_VER: '12.9.1', LOCAL_CTK: '0', GPU: 'l4', GPU_COUNT: '1', DRIVER: 'latest', DRIVER_MODE: 'MCDM' } + - { ARCH: 'amd64', PY_VER: '3.12', CUDA_VER: '13.0.2', LOCAL_CTK: '1', GPU: 'a100', GPU_COUNT: '1', DRIVER: 'latest', DRIVER_MODE: 'TCC' } + - { ARCH: 'amd64', PY_VER: '3.12', CUDA_VER: '13.3.0', LOCAL_CTK: '1', GPU: 'a100', GPU_COUNT: '1', DRIVER: 'latest', DRIVER_MODE: 'TCC' } + - { ARCH: 'amd64', PY_VER: '3.13', CUDA_VER: '12.9.1', LOCAL_CTK: '1', GPU: 'l4', GPU_COUNT: '1', DRIVER: 'latest', DRIVER_MODE: 'TCC' } + - { ARCH: 'amd64', PY_VER: '3.13', CUDA_VER: '13.0.2', LOCAL_CTK: '0', GPU: 'rtxpro6000', GPU_COUNT: '1', DRIVER: 'latest', DRIVER_MODE: 'MCDM' } + - { ARCH: 'amd64', PY_VER: '3.13', CUDA_VER: '13.3.0', LOCAL_CTK: '0', GPU: 'rtxpro6000', GPU_COUNT: '1', DRIVER: 'latest', DRIVER_MODE: 'MCDM', ENV: { CUDA_PYTHON_CUDA_PER_THREAD_DEFAULT_STREAM: '1' } } + - { ARCH: 'amd64', PY_VER: '3.14', CUDA_VER: '12.9.1', LOCAL_CTK: '0', GPU: 'v100', GPU_COUNT: '1', DRIVER: 'latest', DRIVER_MODE: 'TCC' } + - { ARCH: 'amd64', PY_VER: '3.14', CUDA_VER: '13.0.2', LOCAL_CTK: '1', GPU: 'l4', GPU_COUNT: '1', DRIVER: 'latest', DRIVER_MODE: 'MCDM' } + - { ARCH: 'amd64', PY_VER: '3.14', CUDA_VER: '13.3.0', LOCAL_CTK: '1', GPU: 'l4', GPU_COUNT: '1', DRIVER: 'latest', DRIVER_MODE: 'MCDM' } + - { ARCH: 'amd64', PY_VER: '3.14t', CUDA_VER: '12.9.1', LOCAL_CTK: '1', GPU: 'l4', GPU_COUNT: '1', DRIVER: 'latest', DRIVER_MODE: 'TCC' } + - { ARCH: 'amd64', PY_VER: '3.14t', CUDA_VER: '13.0.2', LOCAL_CTK: '0', GPU: 'a100', GPU_COUNT: '1', DRIVER: 'latest', DRIVER_MODE: 'MCDM' } + - { ARCH: 'amd64', PY_VER: '3.14t', CUDA_VER: '13.3.0', LOCAL_CTK: '0', GPU: 'a100', GPU_COUNT: '1', DRIVER: 'latest', DRIVER_MODE: 'MCDM' } + # special runners + - { ARCH: 'amd64', PY_VER: '3.14', CUDA_VER: '13.3.0', LOCAL_CTK: '1', GPU: 't4', GPU_COUNT: '2', DRIVER: 'latest', DRIVER_MODE: 'TCC' } + - { ARCH: 'amd64', PY_VER: '3.14', CUDA_VER: '13.3.0', LOCAL_CTK: '0', GPU: 'h100', GPU_COUNT: '2', DRIVER: 'latest', DRIVER_MODE: 'MCDM' } + nightly: + # nightly-pytorch + - { ARCH: 'amd64', PY_VER: '3.12', CUDA_VER: '12.6.3', LOCAL_CTK: '0', GPU: 'l4', GPU_COUNT: '1', DRIVER: 'latest', DRIVER_MODE: 'TCC', ENV: { MODE: 'nightly-pytorch', TORCH_VER: '2.12.1', TORCH_CUDA: 'cu126' } } + - { ARCH: 'amd64', PY_VER: '3.12', CUDA_VER: '13.0.2', LOCAL_CTK: '0', GPU: 'l4', GPU_COUNT: '1', DRIVER: 'latest', DRIVER_MODE: 'TCC', ENV: { MODE: 'nightly-pytorch', TORCH_VER: '2.12.1', TORCH_CUDA: 'cu130' } } + - { ARCH: 'amd64', PY_VER: '3.12', CUDA_VER: '12.6.3', LOCAL_CTK: '0', GPU: 'l4', GPU_COUNT: '1', DRIVER: 'latest', DRIVER_MODE: 'TCC', ENV: { MODE: 'nightly-pytorch', TORCH_VER: '2.9.1', TORCH_CUDA: 'cu126' } } + - { ARCH: 'amd64', PY_VER: '3.12', CUDA_VER: '13.0.2', LOCAL_CTK: '0', GPU: 'l4', GPU_COUNT: '1', DRIVER: 'latest', DRIVER_MODE: 'TCC', ENV: { MODE: 'nightly-pytorch', TORCH_VER: '2.9.1', TORCH_CUDA: 'cu130' } } + # nightly-numba-cuda + - { ARCH: 'amd64', PY_VER: '3.12', CUDA_VER: '12.9.1', LOCAL_CTK: '0', GPU: 'l4', GPU_COUNT: '1', DRIVER: 'latest', DRIVER_MODE: 'TCC', ENV: { MODE: 'nightly-numba-cuda' } } + - { ARCH: 'amd64', PY_VER: '3.12', CUDA_VER: '13.3.0', LOCAL_CTK: '0', GPU: 'l4', GPU_COUNT: '1', DRIVER: '596.36', DRIVER_MODE: 'TCC', ENV: { MODE: 'nightly-numba-cuda' } } + # nightly-numba-cuda-mlir (MLIR backend, win-64) + - { ARCH: 'amd64', PY_VER: '3.12', CUDA_VER: '12.9.1', LOCAL_CTK: '0', GPU: 'rtxpro6000', GPU_COUNT: '1', DRIVER: 'latest', DRIVER_MODE: 'MCDM', ENV: { MODE: 'nightly-numba-cuda-mlir' } } + - { ARCH: 'amd64', PY_VER: '3.12', CUDA_VER: '13.3.0', LOCAL_CTK: '0', GPU: 'rtxpro6000', GPU_COUNT: '1', DRIVER: 'latest', DRIVER_MODE: 'MCDM', ENV: { MODE: 'nightly-numba-cuda-mlir' } } + # nightly-cuda-core (released cuda-core from PyPI against main pathfinder/bindings) + - { ARCH: 'amd64', PY_VER: '3.14', CUDA_VER: '13.3.0', LOCAL_CTK: '0', GPU: 'a100', GPU_COUNT: '1', DRIVER: 'latest', DRIVER_MODE: 'MCDM', ENV: { MODE: 'nightly-cuda-core' } } diff --git a/ci/tools/check_release_notes.py b/ci/tools/check_release_notes.py new file mode 100644 index 00000000000..75d2c9871f0 --- /dev/null +++ b/ci/tools/check_release_notes.py @@ -0,0 +1,256 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +"""Check that versioned release-notes files exist before releasing. + +Usage: + python check_release_notes.py --git-tag --component + +Exit codes: + 0 — release notes present and non-empty (or .post version, skipped) + 1 — release notes missing or empty + 2 — invalid arguments (including unparsable tag, or component/tag-prefix mismatch) +""" + +from __future__ import annotations + +import argparse +import os +import re +import sys + +COMPONENT_TO_PACKAGE: dict[str, str] = { + "cuda-core": "cuda_core", + "cuda-bindings": "cuda_bindings", + "cuda-pathfinder": "cuda_pathfinder", + "cuda-python": "cuda_python", +} + +# Version characters are restricted to digit-prefixed word chars and dots, so +# malformed inputs like "v../evil" or "v1/2/3" cannot flow into the notes path. +_VERSION_PATTERN = r"\d[\w.]*" + +# Each component has exactly one valid tag-prefix form. cuda-bindings and +# cuda-python share the bare "v" namespace (setuptools-scm lookup). +COMPONENT_TO_TAG_RE: dict[str, re.Pattern[str]] = { + "cuda-bindings": re.compile(rf"^v(?P{_VERSION_PATTERN})$"), + "cuda-python": re.compile(rf"^v(?P{_VERSION_PATTERN})$"), + "cuda-core": re.compile(rf"^cuda-core-v(?P{_VERSION_PATTERN})$"), + "cuda-pathfinder": re.compile(rf"^cuda-pathfinder-v(?P{_VERSION_PATTERN})$"), +} + +BACKPORT_PLANNING_COMPONENTS = frozenset({"cuda-bindings", "cuda-python"}) +BACKPORT_NOT_PLANNED = "not planned" +BACKPORT_BRANCH_RE = re.compile(r"""^backport_branch:\s*["']?(?P[^"'\s#]+)""") +BACKPORT_BRANCH_NAME_RE = re.compile(r"^\d+\.\d+\.x$") + + +def parse_version_from_tag(git_tag: str, component: str) -> str | None: + """Extract the version string from a tag, given the target component. + + Returns None if the tag does not match the component's expected prefix + or contains characters outside the allowed version set. + """ + pattern = COMPONENT_TO_TAG_RE.get(component) + if pattern is None: + return None + m = pattern.match(git_tag) + return m.group("version") if m else None + + +def is_post_release(version: str) -> bool: + return ".post" in version + + +def load_backport_branch(repo_root: str = ".") -> str | None: + path = os.path.join(repo_root, "ci", "versions.yml") + try: + with open(path, encoding="utf-8") as f: + for line in f: + m = BACKPORT_BRANCH_RE.match(line.strip()) + if m: + return m.group("branch") + except FileNotFoundError: + pass + github_ref_name = os.environ.get("GITHUB_REF_NAME", "") + if BACKPORT_BRANCH_NAME_RE.match(github_ref_name): + return github_ref_name + return None + + +def is_backport_version(version: str, backport_branch: str) -> bool: + if backport_branch.endswith(".x"): + return version.startswith(backport_branch[:-1]) + return version == backport_branch + + +def notes_path(package: str, version: str) -> str: + return os.path.join(package, "docs", "source", "release", f"{version}-notes.rst") + + +def check_release_notes(git_tag: str, component: str, repo_root: str = ".") -> list[tuple[str, str]]: + """Return a list of (path, reason) for missing or empty release notes. + + Returns an empty list when notes are present and non-empty, or when the + tag is a .post release (no new notes required). + """ + if component not in COMPONENT_TO_PACKAGE: + return [("", f"unknown component '{component}'")] + + version = parse_version_from_tag(git_tag, component) + if version is None: + return [("", f"cannot parse version from tag '{git_tag}' for component '{component}'")] + + if is_post_release(version): + return [] + + path = notes_path(COMPONENT_TO_PACKAGE[component], version) + full = os.path.join(repo_root, path) + if not os.path.isfile(full): + return [(path, "missing")] + if os.path.getsize(full) == 0: + return [(path, "empty")] + return [] + + +def write_step_summary(message: str) -> None: + summary_path = os.environ.get("GITHUB_STEP_SUMMARY") + if not summary_path: + return + with open(summary_path, "a", encoding="utf-8") as f: + f.write(message) + if not message.endswith("\n"): + f.write("\n") + + +def warn_missing_backport_notes(git_tag: str, component: str, problems: list[tuple[str, str]]) -> None: + print(f"WARNING: missing or empty release notes for backport tag {git_tag}:") + summary_lines = [ + "## Release Notes Reminder", + "", + f"Backport release `{git_tag}` for `{component}` is allowed to continue,", + "but the following release-note files are missing or empty in the workflow source:", + "", + ] + for path, reason in problems: + print(f"::warning file={path}::Release notes for backport tag {git_tag} are {reason}.") + print(f" - {path} ({reason})") + summary_lines.append(f"- `{path}` ({reason})") + summary_lines.extend(["", "Please add the backport release notes on `main` if they are not already present."]) + write_step_summary("\n".join(summary_lines)) + + +def validate_backport_decision( + *, + git_tag: str, + component: str, + version: str, + backport_git_tag: str, + backport_branch: str | None, + repo_root: str, +) -> tuple[int | None, list[tuple[str, str]]]: + if component not in BACKPORT_PLANNING_COMPONENTS or is_post_release(version): + return None, [] + + if backport_branch is None: + print("ERROR: cannot determine backport branch from ci/versions.yml or GITHUB_REF_NAME.", file=sys.stderr) + return 2, [] + + if is_backport_version(version, backport_branch): + problems = check_release_notes(git_tag, component, repo_root) + if problems: + warn_missing_backport_notes(git_tag, component, problems) + else: + print(f"Release notes present for backport tag {git_tag}, component {component}.") + return 0, [] + + decision = backport_git_tag.strip() + if not decision: + return ( + 1, + [ + ( + "", + f"required for {component} mainline releases; use a backport tag or '{BACKPORT_NOT_PLANNED}'", + ) + ], + ) + + if decision == BACKPORT_NOT_PLANNED: + print(f"Backport release not planned for {git_tag}, skipping backport release-notes check.") + return None, [] + + backport_version = parse_version_from_tag(decision, component) + if backport_version is None: + print( + f"ERROR: backport tag {decision!r} does not match the expected format for component {component!r}.", + file=sys.stderr, + ) + return 2, [] + + if not is_backport_version(backport_version, backport_branch): + print( + f"ERROR: backport tag {decision!r} does not match configured backport branch {backport_branch!r}.", + file=sys.stderr, + ) + return 2, [] + + problems = check_release_notes(decision, component, repo_root) + if problems: + return 1, problems + return None, [] + + +def main(argv: list[str] | None = None) -> int: + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--git-tag", required=True) + parser.add_argument("--component", required=True, choices=list(COMPONENT_TO_PACKAGE)) + parser.add_argument("--repo-root", default=".") + parser.add_argument("--backport-git-tag", default="") + parser.add_argument("--backport-branch", default="") + args = parser.parse_args(argv) + + version = parse_version_from_tag(args.git_tag, args.component) + if version is None: + print( + f"ERROR: tag {args.git_tag!r} does not match the expected format for component {args.component!r}.", + file=sys.stderr, + ) + return 2 + + if is_post_release(version): + print(f"Post-release tag ({args.git_tag}), skipping release-notes check.") + return 0 + + backport_branch = args.backport_branch or load_backport_branch(args.repo_root) + rc, problems = validate_backport_decision( + git_tag=args.git_tag, + component=args.component, + version=version, + backport_git_tag=args.backport_git_tag, + backport_branch=backport_branch, + repo_root=args.repo_root, + ) + if rc is not None: + if problems: + print(f"ERROR: release notes policy failed for tag {args.git_tag}:", file=sys.stderr) + for path, reason in problems: + print(f" - {path} ({reason})", file=sys.stderr) + return rc + + if not problems: + problems = check_release_notes(args.git_tag, args.component, args.repo_root) + + if not problems: + print(f"Release notes present for tag {args.git_tag}, component {args.component}.") + return 0 + + print(f"ERROR: missing or empty release notes for tag {args.git_tag}:", file=sys.stderr) + for path, reason in problems: + print(f" - {path} ({reason})", file=sys.stderr) + print("Add versioned release notes before releasing.", file=sys.stderr) + return 1 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/ci/tools/configure_driver_mode.ps1 b/ci/tools/configure_driver_mode.ps1 new file mode 100644 index 00000000000..b055ca39102 --- /dev/null +++ b/ci/tools/configure_driver_mode.ps1 @@ -0,0 +1,62 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +# configure_driver_mode.ps1 -- set the NVIDIA driver mode on a Windows CI +# runner and cycle the display devices so the new mode takes effect +# without rebooting. Always runs (whether or not install_gpu_driver.ps1 +# just ran). When install_gpu_driver.ps1 has run, this single device +# cycle also activates the freshly-installed driver. +# +# Inputs (env): +# DRIVER_MODE One of WDDM, TCC, MCDM. + +function Set-DriverMode { + + # Map matrix DRIVER_MODE to nvidia-smi -fdm code. + # This assumes we have the prior knowledge on which GPU can use which mode. + $driver_mode = $env:DRIVER_MODE + if ($driver_mode -eq "WDDM") { + Write-Output "Setting driver mode to WDDM..." + nvidia-smi -fdm 0 + } elseif ($driver_mode -eq "TCC") { + Write-Output "Setting driver mode to TCC..." + nvidia-smi -fdm 1 + } elseif ($driver_mode -eq "MCDM") { + Write-Output "Setting driver mode to MCDM..." + nvidia-smi -fdm 2 + } else { + Write-Output "Unknown driver mode: $driver_mode" + exit 1 + } + + # Only restart NVIDIA display adapters, not other display devices (e.g. QEMU VGA). + $nvidia_devices = @(Get-PnpDevice -Class Display -FriendlyName "NVIDIA*") + $gpu_count = $nvidia_devices.Count + foreach ($device in $nvidia_devices) { + Write-Output "Restarting device: $($device.FriendlyName) ($($device.InstanceId))" + pnputil /disable-device "$($device.InstanceId)" + pnputil /enable-device "$($device.InstanceId)" + } + + # Initial settle after the device cycle. + Start-Sleep -Seconds 5 + + # Poll nvidia-smi for N consecutive successes (N == cycled GPUs) + # so a mid-init "ok" flap doesn't fool the loop; bail after ~60s. + Write-Output "Waiting for nvidia-smi/NVML to come back up after device cycle..." + $deadline = (Get-Date).AddSeconds(60) + $consecutive_ok = 0 + do { + Start-Sleep -Seconds 3 + & nvidia-smi.exe 2>&1 | Out-Null + if ($LASTEXITCODE -eq 0) { $consecutive_ok++ } else { $consecutive_ok = 0 } + } while ($consecutive_ok -lt $gpu_count -and (Get-Date) -lt $deadline) + if ($consecutive_ok -lt $gpu_count) { + Write-Error "nvidia-smi did not return cleanly $gpu_count times in a row within 60s of the device cycle" + exit 1 + } +} + +# Run the functions +Set-DriverMode diff --git a/ci/tools/download-wheels b/ci/tools/download-wheels new file mode 100755 index 00000000000..20f31fb73d5 --- /dev/null +++ b/ci/tools/download-wheels @@ -0,0 +1,82 @@ +#!/usr/bin/env bash + +# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +# A utility script to download component wheels from GitHub Actions artifacts. +# This script reuses the same logic that was in release.yml to maintain consistency. + +set -euo pipefail + +# Check required arguments +if [[ $# -lt 3 ]]; then + echo "Usage: $0 [output-dir]" >&2 + echo " run-id: The GitHub Actions run ID containing the artifacts" >&2 + echo " component: The component name pattern to download (e.g., cuda-core, cuda-bindings)" >&2 + echo " repository: The GitHub repository (e.g., NVIDIA/cuda-python)" >&2 + echo " output-dir: Optional output directory (default: ./dist)" >&2 + exit 1 +fi + +RUN_ID="$1" +COMPONENT="$2" +REPOSITORY="$3" +OUTPUT_DIR="${4:-./dist}" + +# Ensure we have a GitHub token +if [[ -z "${GH_TOKEN:-}" ]]; then + echo "Error: GH_TOKEN environment variable is required" + exit 1 +fi + +echo "Downloading wheels for component: $COMPONENT from run: $RUN_ID" + +# Download component wheels using the same logic as release.yml +if [[ "$COMPONENT" == "all" ]]; then + # Download all component patterns + gh run download "$RUN_ID" -p "cuda-*" -R "$REPOSITORY" +else + gh run download "$RUN_ID" -p "${COMPONENT}*" -R "$REPOSITORY" +fi + +# Create output directory +mkdir -p "$OUTPUT_DIR" + +# Process downloaded artifacts +for p in cuda-* +do + if [[ ! -d "$p" ]]; then + continue + fi + + # exclude cython test artifacts + if [[ "${p}" == *-tests ]]; then + echo "Skipping test artifact: $p" + continue + fi + + # TODO: remove the Python 3.15 exclusion once 3.15 is officially supported + # exclude pre-release Python (3.15) wheels from releasing + if [[ "${p}" == *python315* ]]; then + echo "Skipping pre-release Python artifact: $p" + continue + fi + + # If we're not downloading "all", only process matching component + if [[ "$COMPONENT" != "all" && "$p" != ${COMPONENT}* ]]; then + continue + fi + + echo "Processing artifact: $p" + # Move wheel files to output directory + if [[ -d "$p" ]]; then + find "$p" -name "*.whl" -exec mv {} "$OUTPUT_DIR/" \; + fi +done + +# Clean up artifact directories +rm -rf cuda-* + +echo "Downloaded wheels to: $OUTPUT_DIR" +ls -la "$OUTPUT_DIR" diff --git a/ci/tools/env-vars b/ci/tools/env-vars new file mode 100755 index 00000000000..8ffbfa13472 --- /dev/null +++ b/ci/tools/env-vars @@ -0,0 +1,114 @@ +#!/usr/bin/env bash + +# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +# A utility script to set up the GitHub environment variables for the CI. + +set -euo pipefail + +# Check if the script was called with exactly 1 argument +if [[ ${#} -ne 1 ]]; then + echo "Error: This script requires exactly 1 argument (the build mode). You provided ${#}" + echo "Usage: ${0} build_mode[build or test]" + exit 1 +fi + +PYTHON_VERSION_FORMATTED=$(echo "${PY_VER}" | tr -d '.') + +if [[ "${HOST_PLATFORM}" == linux* ]]; then + REPO_DIR=$(pwd) + TOOLS_PATH="${REPO_DIR}/ci/tools" +elif [[ "${HOST_PLATFORM}" == win* ]]; then + PWD=$(pwd) + REPO_DIR=$(cygpath -w ${PWD}) + TOOLS_PATH=$(cygpath -w ${PWD}/ci/tools) +fi + +echo "${TOOLS_PATH}" >> $GITHUB_PATH +echo "CUDA_PYTHON_PARALLEL_LEVEL=$(nproc)" >> $GITHUB_ENV +CUDA_CORE_ARTIFACT_BASENAME="cuda-core-python${PYTHON_VERSION_FORMATTED}-${HOST_PLATFORM}" +{ + echo "CUDA_CORE_ARTIFACT_BASENAME=${CUDA_CORE_ARTIFACT_BASENAME}" + echo "CUDA_CORE_ARTIFACT_NAME=${CUDA_CORE_ARTIFACT_BASENAME}-${SHA}" + echo "CUDA_CORE_ARTIFACTS_DIR=$(realpath "${REPO_DIR}/cuda_core/dist")" + echo "CUDA_CORE_CYTHON_TESTS_DIR=$(realpath "${REPO_DIR}/cuda_core/tests/cython")" + echo "CUDA_CORE_TEST_BINARIES_DIR=$(realpath "${REPO_DIR}/cuda_core/tests/test_binaries")" + echo "PYTHON_VERSION_FORMATTED=${PYTHON_VERSION_FORMATTED}" +} >> $GITHUB_ENV + +if [[ "${1}" == "build" ]]; then + # platform is handled by the default value of platform (`auto`) in cibuildwheel + # here we only need to specify the python version we want + echo "CIBW_BUILD=cp${PYTHON_VERSION_FORMATTED}-*" >> $GITHUB_ENV + BUILD_CUDA_MAJOR="$(cut -d '.' -f 1 <<< ${CUDA_VER})" + echo "BUILD_CUDA_MAJOR=${BUILD_CUDA_MAJOR}" >> $GITHUB_ENV + echo "BUILD_PREV_CUDA_MAJOR=$((${BUILD_CUDA_MAJOR} - 1))" >> $GITHUB_ENV + CUDA_BINDINGS_ARTIFACT_BASENAME="cuda-bindings-python${PYTHON_VERSION_FORMATTED}-cuda${CUDA_VER}-${HOST_PLATFORM}" + # Enforce an explicit cache dir so that we can reuse this path later + echo "SCCACHE_DIR=${HOME}/.cache/sccache" >> $GITHUB_ENV + echo "SCCACHE_CACHE_SIZE=1G" >> $GITHUB_ENV +elif [[ "${1}" == "test" ]]; then + BUILD_CUDA_MAJOR="$(cut -d '.' -f 1 <<< ${BUILD_CUDA_VER})" + TEST_CUDA_MAJOR="$(cut -d '.' -f 1 <<< ${CUDA_VER})" + CUDA_BINDINGS_ARTIFACT_BASENAME="cuda-bindings-python${PYTHON_VERSION_FORMATTED}-cuda${BUILD_CUDA_VER}-${HOST_PLATFORM}" + + # BINDINGS_SOURCE controls which cuda-bindings to install at test time: + # main — use the just-built bindings wheel from this CI run + # backport — fetch bindings from the prior (N-1) branch + # published — install from PyPI (cuda-bindings==${TEST_CUDA_MAJOR}.${TEST_CUDA_MINOR}.*) + # + # SKIP_CUDA_BINDINGS_TEST / SKIP_CYTHON_TEST control which *tests* to run + # (they do NOT affect installation — that's BINDINGS_SOURCE's job). + + BUILD_CUDA_MINOR="$(cut -d '.' -f 2 <<< ${BUILD_CUDA_VER})" + TEST_CUDA_MINOR="$(cut -d '.' -f 2 <<< ${CUDA_VER})" + + if [[ ${BUILD_CUDA_MAJOR} != ${TEST_CUDA_MAJOR} ]]; then + # Major mismatch (e.g. build=13.x, test=12.x): use the backport branch. + BINDINGS_SOURCE=backport + SKIP_CUDA_BINDINGS_TEST=1 + SKIP_CYTHON_TEST=1 + elif [[ ${BUILD_CUDA_MINOR} != ${TEST_CUDA_MINOR} ]]; then + # Same major, minor mismatch (e.g. build=13.2, test=13.0): use published + # bindings from PyPI to test the real-world backward-compat scenario. + BINDINGS_SOURCE=published + SKIP_CUDA_BINDINGS_TEST=1 + SKIP_CYTHON_TEST=1 + else + # Exact match: use the just-built bindings wheel. + BINDINGS_SOURCE=main + if [[ "${SKIP_BINDINGS_TEST_OVERRIDE:-0}" == "1" ]]; then + SKIP_CUDA_BINDINGS_TEST=1 + else + SKIP_CUDA_BINDINGS_TEST=0 + fi + SKIP_CYTHON_TEST=0 + fi + # We don't test compute-sanitizer on CTK<12 because backporting fixes is too much effort + # We only test compute-sanitizer on python 3.12 arbitrarily; we don't need to use sanitizer on the entire matrix + # Only local ctk installs have compute-sanitizer; there is no wheel for it + if [[ "${PY_VER}" == "3.12" && "${CUDA_VER}" != "11.8.0" && "${LOCAL_CTK}" == 1 && "${HOST_PLATFORM}" == linux* ]]; then + echo "LATEST_CUDA_VERSION=$(bash ci/tools/guess_latest.sh $TEST_CUDA_MAJOR)" >> $GITHUB_ENV + SETUP_SANITIZER=1 + else + SETUP_SANITIZER=0 + echo "SANITIZER_CMD=" >> $GITHUB_ENV + fi + { + echo "SETUP_SANITIZER=${SETUP_SANITIZER}" + echo "BINDINGS_SOURCE=${BINDINGS_SOURCE}" + echo "SKIP_CUDA_BINDINGS_TEST=${SKIP_CUDA_BINDINGS_TEST}" + echo "SKIP_CYTHON_TEST=${SKIP_CYTHON_TEST}" + echo "TEST_CUDA_MAJOR=${TEST_CUDA_MAJOR}" + echo "TEST_CUDA_MINOR=${TEST_CUDA_MINOR}" + } >> $GITHUB_ENV +fi + +{ + echo "CUDA_BINDINGS_ARTIFACT_BASENAME=${CUDA_BINDINGS_ARTIFACT_BASENAME}" + echo "CUDA_BINDINGS_ARTIFACT_NAME=${CUDA_BINDINGS_ARTIFACT_BASENAME}-${SHA}" + echo "CUDA_BINDINGS_ARTIFACTS_DIR=$(realpath "${REPO_DIR}/cuda_bindings/dist")" + echo "CUDA_BINDINGS_CYTHON_TESTS_DIR=$(realpath "${REPO_DIR}/cuda_bindings/tests/cython")" +} >> $GITHUB_ENV diff --git a/ci/tools/fetch_ctk_redistrib.py b/ci/tools/fetch_ctk_redistrib.py new file mode 100644 index 00000000000..5007765516e --- /dev/null +++ b/ci/tools/fetch_ctk_redistrib.py @@ -0,0 +1,186 @@ +#!/usr/bin/env python3 +# +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +"""Resolve mini-CTK components from NVIDIA redistrib metadata.""" + +from __future__ import annotations + +import argparse +import json +import sys +import urllib.error +import urllib.parse +import urllib.request +from pathlib import Path +from typing import Any + +HOST_PLATFORM_TO_SUBDIR: dict[str, str] = { + "linux-64": "linux-x86_64", + "linux-aarch64": "linux-sbsa", + "win-64": "windows-x86_64", +} + +# CTK 13.3.0 renamed the redistrib key from cuda_cccl to cccl. +COMPONENT_ALIASES: dict[str, tuple[str, ...]] = { + "cuda_cccl": ("cccl",), +} + + +def host_platform_to_subdir(host_platform: str) -> str: + try: + return HOST_PLATFORM_TO_SUBDIR[host_platform] + except KeyError as exc: + raise ValueError(f"unsupported host-platform: {host_platform!r}") from exc + + +def split_components(components: str) -> list[str]: + return [component for component in components.split(",") if component] + + +def filter_static_components(components: list[str], host_platform: str, cuda_version: str) -> list[str]: + try: + cuda_major = int(cuda_version.split(".", 1)[0]) + except ValueError as exc: + raise ValueError(f"invalid cuda-version: {cuda_version!r}") from exc + + filtered = [] + for component in components: + if component == "libnvjitlink" and cuda_major < 12: + continue + if component in {"cuda_crt", "libnvvm"} and cuda_major < 13: + continue + if component == "libcufile" and host_platform.startswith("win-"): + continue + filtered.append(component) + return filtered + + +def validate_metadata_url(metadata_url: str) -> str: + parsed = urllib.parse.urlsplit(metadata_url) + if parsed.scheme != "https" or not parsed.netloc: + raise ValueError(f"metadata URL must be an https URL: {metadata_url!r}") + return metadata_url + + +def load_metadata(*, metadata_path: str | None, metadata_url: str | None) -> dict[str, Any]: + if (metadata_path is None) == (metadata_url is None): + raise ValueError("exactly one of --metadata-path or --metadata-url is required") + + if metadata_path is not None: + return json.loads(Path(metadata_path).read_text(encoding="utf-8")) + + assert metadata_url is not None + metadata_url = validate_metadata_url(metadata_url) + with urllib.request.urlopen(metadata_url) as response: # noqa: S310 - scheme is restricted to https above + return json.load(response) + + +def resolve_component_name(metadata: dict[str, Any], component: str) -> str: + if component in metadata: + return component + + for alias in COMPONENT_ALIASES.get(component, ()): + if alias in metadata: + return alias + + return component + + +def filter_components( + metadata: dict[str, Any], + *, + host_platform: str, + cuda_version: str, + components: str, +) -> tuple[list[str], list[str]]: + ctk_subdir = host_platform_to_subdir(host_platform) + filtered = [] + skipped = [] + for component in filter_static_components(split_components(components), host_platform, cuda_version): + resolved_component = resolve_component_name(metadata, component) + if ctk_subdir in metadata.get(resolved_component, {}): + filtered.append(resolved_component) + else: + skipped.append(component) + return filtered, skipped + + +def get_component_relative_path(metadata: dict[str, Any], *, host_platform: str, component: str) -> str: + ctk_subdir = host_platform_to_subdir(host_platform) + component = resolve_component_name(metadata, component) + component_info = metadata.get(component) + if component_info is None: + raise KeyError(f"unknown CTK component {component!r}") + + subdir_info = component_info.get(ctk_subdir) + if subdir_info is None: + raise KeyError(f"CTK component {component!r} is not available for redistrib subdir {ctk_subdir!r}") + + relative_path = subdir_info.get("relative_path") + if relative_path is None: + raise KeyError(f"CTK component {component!r} for redistrib subdir {ctk_subdir!r} is missing 'relative_path'") + return relative_path + + +def parse_args(argv: list[str] | None = None) -> argparse.Namespace: + parser = argparse.ArgumentParser(description=__doc__) + subparsers = parser.add_subparsers(dest="command", required=True) + + filter_parser = subparsers.add_parser("filter-components") + filter_parser.add_argument("--host-platform", required=True) + filter_parser.add_argument("--cuda-version", required=True) + filter_parser.add_argument("--components", required=True) + filter_parser.add_argument("--metadata-path") + filter_parser.add_argument("--metadata-url") + + relpath_parser = subparsers.add_parser("component-relative-path") + relpath_parser.add_argument("--host-platform", required=True) + relpath_parser.add_argument("--component", required=True) + relpath_parser.add_argument("--metadata-path") + relpath_parser.add_argument("--metadata-url") + + return parser.parse_args(argv) + + +def main(argv: list[str] | None = None) -> int: + args = parse_args(argv) + + try: + metadata = load_metadata(metadata_path=args.metadata_path, metadata_url=args.metadata_url) + + if args.command == "filter-components": + filtered, skipped = filter_components( + metadata, + host_platform=args.host_platform, + cuda_version=args.cuda_version, + components=args.components, + ) + for component in skipped: + print( + f"Skipping unsupported CTK component {component!r} for host-platform {args.host_platform!r}", + file=sys.stderr, + ) + print(",".join(filtered)) + return 0 + + if args.command == "component-relative-path": + print( + get_component_relative_path( + metadata, + host_platform=args.host_platform, + component=args.component, + ) + ) + return 0 + + raise AssertionError(f"unexpected command: {args.command!r}") + except (ValueError, KeyError, OSError, urllib.error.URLError, json.JSONDecodeError) as exc: + print(f"ERROR: {exc}", file=sys.stderr) + return 1 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/ci/tools/guess_latest.sh b/ci/tools/guess_latest.sh new file mode 100644 index 00000000000..8a0a13034ca --- /dev/null +++ b/ci/tools/guess_latest.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +# URL to search +URL="https://developer.download.nvidia.com/compute/cuda/redist/" + +# Ensure exactly one argument is provided +if [ "$#" -ne 1 ]; then + echo "Usage: $0 " + exit 1 +fi + +# Accept major version as the first argument +MAJOR_VERSION="$1" + +# Fetch the directory listing and extract the latest version number +get_latest_version() { + # Get the HTML content of the page + local html_content=$(wget -q -O - "$URL") + + # Extract links matching the pattern redistrib_?.?.?.json + local files=$(echo "$html_content" | grep -oP "redistrib_${MAJOR_VERSION}\.[0-9]+\.[0-9]+\.json" | cut -d'"' -f2) + + # If files were found, extract the version numbers and find the latest + if [ -n "$files" ]; then + # Extract just the version numbers using regex + local versions=$(echo "$files" | grep -oP "redistrib_\K${MAJOR_VERSION}\.[0-9]+\.[0-9]+(?=\.json)") + + # Sort the versions and get the latest + local latest_version=$(echo "$versions" | sort -V | tail -n 1) + echo "$latest_version" + else + echo "No files matching the pattern were found." + return 1 + fi +} + +# Call the function and store the result +latest_version=$(get_latest_version) +echo $latest_version diff --git a/ci/tools/install_gpu_driver.ps1 b/ci/tools/install_gpu_driver.ps1 new file mode 100644 index 00000000000..e61c6bbdbb1 --- /dev/null +++ b/ci/tools/install_gpu_driver.ps1 @@ -0,0 +1,78 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +# install_gpu_driver.ps1 -- install a specific NVIDIA driver version on a +# Windows CI runner. Driver-mode selection and the post-install device +# power-cycle are the responsibility of configure_driver_mode.ps1, which +# the workflow runs immediately after this script (or by itself when +# DRIVER is 'latest'/'earliest' and the runner already brings up the +# right driver). +# +# Inputs (env): +# DRIVER Driver version, e.g. "610.47". Must NOT be 'latest' or +# 'earliest' -- those are runner-pre-installed and the +# workflow is expected to skip this script for them. +# GPU_TYPE Lower-case GPU label from the matrix (e.g. "l4", "rtx4090"). +# Selects the data-center vs desktop installer variant. + +# Install the driver +function Install-Driver { + + # Driver version is plumbed from the matrix via the DRIVER env var. + $version = $env:DRIVER + if (-not $version -or $version -eq 'latest' -or $version -eq 'earliest') { + Write-Error "DRIVER env var must be a specific version string (e.g. '610.47'); got '$version'." + exit 1 + } + + # Get GPU type from environment variable + $gpu_type = $env:GPU_TYPE + + $data_center_gpus = @('a100', 'h100', 'l4', 't4', 'v100', 'rtxa6000', 'rtx6000ada') + $desktop_gpus = @('rtx2080', 'rtx4090', 'rtxpro6000') + + if ($data_center_gpus -contains $gpu_type) { + Write-Output "Data center GPU detected: $gpu_type" + $filename="$version-data-center-tesla-desktop-winserver-2022-2025-dch-international.exe" + $server_path="tesla/$version" + } elseif ($desktop_gpus -contains $gpu_type) { + Write-Output "Desktop GPU detected: $gpu_type" + $filename="$version-desktop-win10-win11-64bit-international-dch-whql.exe" + $server_path="Windows/$version" + } else { + Write-Output "Unknown GPU type: $gpu_type" + exit 1 + } + + $url="https://us.download.nvidia.com/$server_path/$filename" + $filepath="C:\NVIDIA-Driver\$filename" + + Write-Output "Installing NVIDIA driver version $version for GPU type $gpu_type" + Write-Output "Download URL: $url" + + # Silent install arguments + $install_args = '/s /noeula /noreboot'; + + # Create the folder for the driver download + if (!(Test-Path -Path 'C:\NVIDIA-Driver')) { + New-Item -Path 'C:\' -Name 'NVIDIA-Driver' -ItemType 'directory' | Out-Null + } + + # Download the file to a specified directory + # Disabling progress bar due to https://github.com/GoogleCloudPlatform/compute-gpu-installation/issues/29 + $ProgressPreference_tmp = $ProgressPreference + $ProgressPreference = 'SilentlyContinue' + Write-Output 'Downloading the driver installer...' + Invoke-WebRequest $url -OutFile $filepath + $ProgressPreference = $ProgressPreference_tmp + Write-Output 'Download complete!' + + # Install the file with the specified path from earlier + Write-Output 'Running the driver installer...' + Start-Process -FilePath $filepath -ArgumentList $install_args -Wait + Write-Output 'Install complete; driver mode + device cycle handled by configure_driver_mode.ps1.' +} + +# Run the functions +Install-Driver diff --git a/ci/tools/install_gpu_driver.sh b/ci/tools/install_gpu_driver.sh new file mode 100755 index 00000000000..777edd63519 --- /dev/null +++ b/ci/tools/install_gpu_driver.sh @@ -0,0 +1,220 @@ +#!/bin/bash +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +# install_gpu_driver.sh -- install a specific NVIDIA driver version on a +# Linux CI runner. Adapted from nv-gha-runners/vm-images PR #256 +# (`nvgha-driver` CLI), trimmed and parameterised for cuda-python's CI. +# +# !!! ALPHA !!! +# Performs live modifications to the host driver stack (kernel module +# reload, package replacement, and -- inside containers -- toolkit +# bind-mount refresh) and may cause issues. +# +# Inputs (env): +# DRIVER Driver version, e.g. "580.65.06". Must NOT be 'latest' or +# 'earliest' -- those are runner-pre-installed and the +# workflow is expected to skip this script for them. +# GPU_TYPE Lower-case GPU label from the matrix (e.g. "v100", "l4", +# "h100"). Used only to pick the kernel module flavor +# (Volta needs the proprietary/legacy module; everything +# newer can use the open module). +# +# Arch is detected from `uname -m`. +# +# When the script runs inside a container (the cuda-python Linux jobs do) +# it re-execs itself on the host via `nsenter`. The job must declare +# `options: --privileged --pid=host` (the workflow only does this for +# matrix rows with a custom DRIVER). After the host-side install, the +# container's bind-mounted nvidia libs/binaries are refreshed in-place so +# the new driver is visible without restarting the container. +set -euo pipefail + +: "${DRIVER:?DRIVER env var is required (e.g. 580.65.06)}" +: "${GPU_TYPE:?GPU_TYPE env var is required (e.g. l4)}" + +case "$DRIVER" in + latest|earliest) + echo "::error::install_gpu_driver.sh must not be invoked with DRIVER=$DRIVER (runner-pre-installed)" >&2 + exit 1 + ;; +esac + +VERSION="$DRIVER" + +# Volta (V100) requires the legacy/proprietary kernel module; all newer +# GPUs in this matrix support the open module. Extend this if/when older +# GPUs return to the matrix. +case "$GPU_TYPE" in + v100) KMT=proprietary ;; + *) KMT=open ;; +esac + +case "$(uname -m)" in + x86_64) + ARCH_DIR=Linux-x86_64 + ARCH_SUFFIX=x86_64 + ;; + aarch64) + ARCH_DIR=Linux-aarch64 + ARCH_SUFFIX=aarch64 + ;; + *) + echo "::error::unsupported arch: $(uname -m)" >&2 + exit 1 + ;; +esac + +URL="https://us.download.nvidia.com/XFree86/${ARCH_DIR}/${VERSION}/NVIDIA-Linux-${ARCH_SUFFIX}-${VERSION}.run" + +# Re-elevate to root if needed (sudo is preinstalled on the runner image). +if [ "$(id -u)" != 0 ]; then + exec sudo -E DRIVER="$DRIVER" GPU_TYPE="$GPU_TYPE" "$0" "$@" +fi + +echo "install_gpu_driver.sh is ALPHA -- it performs live modifications to the host driver stack and may cause issues" >&2 +echo "DRIVER=${VERSION} GPU_TYPE=${GPU_TYPE} KMT=${KMT} ARCH=${ARCH_SUFFIX}" >&2 +echo "URL=${URL}" >&2 + +# Toolkit packages we keep across the purge: dockerd's --runtime=nvidia +# resolves nvidia-container-runtime through these, and removing them +# breaks `docker exec` against any container started with that runtime. +KEEP_RE='^(nvidia-container-toolkit(-base)?|libnvidia-container1|libnvidia-container-tools)$' + +in_container() { + [ -f /.dockerenv ] || grep -qE '/(docker|kubepods|containerd)' /proc/1/cgroup 2>/dev/null +} + +host_install() { + apt-get -y install build-essential dkms "linux-headers-$(uname -r)" psmisc kmod + + systemctl stop nvidia-persistenced dcgm-exporter || true + # if-test instead of `fuser ... || true` so a kill failure surfaces + # (fuser exits 1 when nothing holds the device, which is the happy path). + if fuser /dev/nvidia* >/dev/null 2>&1; then + fuser -kv /dev/nvidia* + fi + sleep 1 + for m in nvidia_uvm nvidia_drm nvidia_modeset nvidia; do + rmmod "$m" 2>/dev/null || true + done + + # Purge existing nvidia/libnvidia packages, except the toolkit pieces + # captured by KEEP_RE. Tolerate apt failures: postrm scripts can trip + # and the .run installer is about to replace everything anyway. + dpkg-query -W -f='${Package}\n' 'nvidia-*' 'libnvidia-*' 2>/dev/null \ + | awk -v re="$KEEP_RE" '$0 !~ re' \ + | xargs -r apt-get -y remove --purge || true + + local d + d=$(mktemp -d) + ( cd "$d" \ + && wget -q -O installer.run "$URL" \ + && sh installer.run --silent --dkms --no-questions \ + --accept-license --ui=none --no-cc-version-check --kernel-module-type="$KMT" ) + modprobe nvidia nvidia_uvm nvidia_modeset + + # Bring nvidia-persistenced back up. NVML state-changing calls from + # inside the test container (e.g. nvmlDeviceSetPersistenceMode, which + # cuda.core's test_persistence_mode_enabled exercises) talk to the + # daemon via /run/nvidia-persistenced/socket; without a live daemon + # they return NVML_ERROR_UNKNOWN. + # + # systemctl can't start the unit (the `--silent --no-questions` .run + # installer drops /usr/bin/nvidia-persistenced but no usable systemd + # unit), so exec the binary directly -- it self-daemonizes. + # + # `--user root` because the default `nvidia-persistenced` user was + # deleted along with `nvidia-compute-utils-*` in the purge above; + # without this flag the daemon's post-fork setuid() fails silently + # and the process exits. + # + # nv-gha-runners/vm-images' `nvgha-driver` has the same latent gap; + # its CUDA-runtime validation workload never issues an NVML SET + # write so it hasn't surfaced there. + /usr/bin/nvidia-persistenced --verbose --user root || true +} + +# Replace the toolkit's bind-mounted nvidia libs/binaries inside this +# container with copies from the host's new install. `cp` (not +# `mount --bind`) because procfs-routed binds drop the exec bit. +refresh_container_libs() { + # Walk /proc/self/mountinfo and match the toolkit-injected nvidia + # binds via mount point (field 5) so deleted source paths -- which + # the kernel suffixes field 4 with " (deleted)" once the host unlinks + # the old lib -- don't break discovery. Filters skip what we can't or + # shouldn't refresh: + # $3 ~ /^0:/ tmpfs/proc/sysfs (e.g. the toolkit hook tmpfs) + # $5 must be under /usr/(bin|lib) binaries + libs only -- explicitly + # NOT /run/nvidia-persistenced/socket + # (cp'ing the daemon's IPC socket unlinks + # the container's view and turns later + # NVML state-changing calls into + # NVML_ERROR_UNKNOWN); NOT /dev/nvidia* + # (character devices); NOT /proc/driver/nvidia + # (procfs); NOT /tmp/nvidia-mps (runtime). + # $5 ~ /\.json$/ vulkan/glvnd config remaps (not version-bound) + # $5 ~ /\/(firmware|xorg)\// firmware loads host-side; xorg unused in CUDA containers + local mounts + mounts=$(awk ' + $3 !~ /^0:/ && + $5 ~ /^\/usr\/(bin|lib)/ && + $5 !~ /\.json$/ && + $5 !~ /\/(firmware|xorg)\// && + $5 ~ /(nvidia|libcuda)/ { print $5 } + ' /proc/self/mountinfo | sort -u) + + for tgt in $mounts; do + local src="/proc/1/root$tgt" + if [ ! -e "$src" ]; then + # Driver swap rewrites the version suffix (libfoo.so.595.71.05 -> + # libfoo.so.580.65.06); strip it and find the new file. + local base + base=$(basename "$tgt") + base="${base%.so.*}.so" + src=$(find "/proc/1/root$(dirname "$tgt")" -maxdepth 1 -name "${base}.*" 2>/dev/null \ + | sort -V | tail -n1) + [ -n "$src" ] || { echo "skip $tgt: no host source" >&2; continue; } + fi + umount "$tgt" 2>/dev/null || true + # --preserve=mode keeps the SUID bit so the refresh doesn't silently + # de-privilege binaries like nvidia-modprobe that ship 4755 (the + # runner-team's nvgha-driver uses plain `cp` and has the same gap). + cp -f --preserve=mode --remove-destination "$src" "$tgt" \ + || echo "WARN: refresh failed for $tgt (src=$src)" >&2 + done + ldconfig +} + +if [ -z "${_NVDRV_NSENTERED:-}" ] && in_container; then + # Re-exec on the host. The runner-team's `nvgha-driver` script lives at a + # host-side absolute path so `"$0"` survives the mount-namespace flip; + # ours lives in the GH workspace mount (container-only), so we pipe the + # script body in via stdin instead -- the `< "$0"` fd is opened before + # nsenter and stays valid across the namespace switch. Env vars (DRIVER, + # GPU_TYPE, _NVDRV_NSENTERED) are inherited by the host-side bash. + _NVDRV_NSENTERED=1 nsenter -t 1 -m -p -n -i -u -- bash -s < "$0" \ + || { echo "::error::container needs 'options: --privileged --pid=host'" >&2; exit 1; } + refresh_container_libs + + # Re-bind /run/nvidia-persistenced from the host. The container's + # original bind mount was pinned to the host's at-container-start + # inode; the daemon stop+restart cycle recreates the dir under a + # fresh inode, stranding the bind mount on the deleted one (socket + # shows up with link count 0 inside the container, NVML SET calls + # return NVML_ERROR_UNKNOWN). Re-bind from /proc/1/root so the + # container picks up the live host dir. Needs CAP_SYS_ADMIN, which + # the workflow grants via --privileged --pid=host on custom-DRIVER + # rows. + if [ -d /proc/1/root/run/nvidia-persistenced ]; then + umount /run/nvidia-persistenced 2>/dev/null || true + mkdir -p /run/nvidia-persistenced + mount --bind /proc/1/root/run/nvidia-persistenced /run/nvidia-persistenced + fi +else + host_install +fi + +nvidia-smi >/dev/null +grep -qF "$VERSION" /proc/driver/nvidia/version diff --git a/ci/tools/lookup-run-id b/ci/tools/lookup-run-id new file mode 100755 index 00000000000..bd8ba413974 --- /dev/null +++ b/ci/tools/lookup-run-id @@ -0,0 +1,177 @@ +#!/usr/bin/env bash + +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +# A utility script to find a GitHub Actions workflow run ID. +# +# Two modes: +# --tag Find the successful CI run triggered by a tag push. +# --branch Find the latest successful CI run on a branch. +# +# Outputs the run ID on stdout. All diagnostic messages go to stderr. +# When --head-sha is passed, a second line with the run's head SHA is printed. + +set -euo pipefail + +usage() { + cat >&2 < [workflow-name] + $0 --branch [workflow-name] + +Options: + --tag Find run by git tag (requires local git repo with the tag) + --branch Find latest successful run on the given branch + --head-sha Also print the run's head commit SHA (second line) + +Examples: + $0 --tag v13.0.1 NVIDIA/cuda-python + $0 --branch main NVIDIA/cuda-python + $0 --branch main --head-sha NVIDIA/cuda-python "CI" +EOF + exit 1 +} + +# ── Parse arguments ── +MODE="" +REF="" +HEAD_SHA_FLAG=0 + +while [[ $# -gt 0 ]]; do + case "${1}" in + --tag) + [[ -n "${MODE}" && "${MODE}" != "tag" ]] && { echo "Error: --tag and --branch are mutually exclusive" >&2; exit 1; } + MODE="tag"; REF="${2}"; shift 2 ;; + --branch) + [[ -n "${MODE}" && "${MODE}" != "branch" ]] && { echo "Error: --tag and --branch are mutually exclusive" >&2; exit 1; } + MODE="branch"; REF="${2}"; shift 2 ;; + --head-sha) + HEAD_SHA_FLAG=1; shift ;; + -h|--help) + usage ;; + *) + break ;; + esac +done + +if [[ -z "${MODE}" ]]; then + # Legacy positional interface: [workflow-name] + # Kept for backward compatibility with release.yml. + if [[ $# -lt 2 ]]; then usage; fi + MODE="tag" + REF="${1}"; shift +fi + +REPOSITORY="${1:-}"; shift || true +WORKFLOW_NAME="${1:-CI}" + +if [[ -z "${REPOSITORY}" ]]; then usage; fi + +# ── Prerequisite checks ── +if [[ -z "${GH_TOKEN:-}" ]]; then + echo "Error: GH_TOKEN environment variable is required" >&2 + exit 1 +fi + +for cmd in jq gh; do + if ! command -v "${cmd}" >/dev/null 2>&1; then + echo "Error: ${cmd} is required but not installed" >&2 + exit 1 + fi +done + +# ── Mode: branch ── +if [[ "${MODE}" == "branch" ]]; then + echo "Looking up latest successful '${WORKFLOW_NAME}' run on branch: ${REF}" >&2 + + RUN_ID=$(gh run list \ + -b "${REF}" \ + -L 1 \ + -w "${WORKFLOW_NAME}" \ + -s success \ + -R "${REPOSITORY}" \ + --json databaseId \ + | jq -r '.[0].databaseId // empty') + + if [[ -z "${RUN_ID}" ]]; then + echo "Error: No successful '${WORKFLOW_NAME}' run found on branch '${REF}'" >&2 + exit 1 + fi + + echo "Found run ID: ${RUN_ID}" >&2 + echo "${RUN_ID}" + + if [[ "${HEAD_SHA_FLAG}" == 1 ]]; then + HEAD_SHA=$(gh run view "${RUN_ID}" \ + -R "${REPOSITORY}" \ + --json headSha \ + | jq -r '.headSha') + echo "Head SHA: ${HEAD_SHA}" >&2 + echo "${HEAD_SHA}" + fi + exit 0 +fi + +# ── Mode: tag ── +echo "Looking up run ID for tag: ${REF} in repository: ${REPOSITORY}" >&2 + +if ! COMMIT_SHA=$(git rev-parse "${REF}^{commit}"); then + echo "Error: Could not resolve git tag '${REF}' to a commit SHA" >&2 + echo "Make sure the tag exists and you have fetched it" >&2 + exit 1 +fi + +echo "Resolved tag '${REF}' to commit: ${COMMIT_SHA}" >&2 +echo "Searching for '${WORKFLOW_NAME}' workflow runs for commit: ${COMMIT_SHA} (tag: ${REF})" >&2 + +RUN_DATA=$(gh run list \ + --repo "${REPOSITORY}" \ + --commit "${COMMIT_SHA}" \ + --workflow "${WORKFLOW_NAME}" \ + --status completed \ + --json databaseId,workflowName,status,conclusion,headSha,headBranch,event,createdAt,url \ + --limit 50) + +if [[ -z "${RUN_DATA}" || "${RUN_DATA}" == "[]" ]]; then + echo "Error: No completed '${WORKFLOW_NAME}' workflow runs found for commit ${COMMIT_SHA}" >&2 + echo "Available workflow runs for this commit:" >&2 + gh run list --repo "${REPOSITORY}" --commit "${COMMIT_SHA}" --limit 10 || true + exit 1 +fi + +RUN_ID=$(echo "${RUN_DATA}" | jq -r --arg tag "${REF}" ' + map(select(.conclusion == "success" and .event == "push" and .headBranch == $tag)) + | sort_by(.createdAt) + | reverse + | .[0].databaseId // empty +') + +if [[ -z "${RUN_ID}" ]]; then + echo "Error: No successful '${WORKFLOW_NAME}' workflow runs found for tag '${REF}'." >&2 + echo "This release workflow now requires artifacts from a tag-triggered CI run." >&2 + echo "If you just pushed the tag, wait for CI on that tag to finish and retry." >&2 + echo "" >&2 + echo "Completed runs for commit ${COMMIT_SHA}:" >&2 + echo "${RUN_DATA}" | jq -r '.[] | "\(.databaseId): event=\(.event // "null"), headBranch=\(.headBranch // "null"), conclusion=\(.conclusion // "null"), status=\(.status // "null"), createdAt=\(.createdAt // "null")"' >&2 + exit 1 +fi + +echo "Found workflow run ID: ${RUN_ID} for tag '${REF}'" >&2 + +echo "Verifying artifacts exist for run ${RUN_ID}..." >&2 +ARTIFACT_LIST=$(gh run view "${RUN_ID}" --repo "${REPOSITORY}" --json url || echo "") + +if [[ -z "${ARTIFACT_LIST}" ]]; then + echo "Warning: Could not verify artifacts for workflow run ${RUN_ID}" >&2 +fi + +echo "${RUN_ID}" + +if [[ "${HEAD_SHA_FLAG}" == 1 ]]; then + HEAD_SHA=$(echo "${RUN_DATA}" | jq -r --arg id "${RUN_ID}" ' + map(select(.databaseId == ($id | tonumber))) | .[0].headSha // empty') + echo "Head SHA: ${HEAD_SHA}" >&2 + echo "${HEAD_SHA}" +fi diff --git a/ci/tools/merge_cuda_core_wheels.py b/ci/tools/merge_cuda_core_wheels.py new file mode 100644 index 00000000000..c66a1bfa2a8 --- /dev/null +++ b/ci/tools/merge_cuda_core_wheels.py @@ -0,0 +1,253 @@ +#!/usr/bin/env python3 + +# SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +""" +Script to merge CUDA-specific wheels into a single multi-CUDA wheel. + +This script takes wheels built for different CUDA versions (cu12, cu13) and merges them +into a single wheel that supports both CUDA versions. + +In particular, each wheel contains a CUDA-specific build of the `cuda.core` library +and the associated bindings. This script merges these directories into a single wheel +that supports both CUDA versions, i.e., containing both `cuda/core/cu12` +and `cuda/core/cu13`. At runtime, the code in `cuda/core/__init__.py` +is used to import the appropriate CUDA-specific bindings. + +This script is based on the one in NVIDIA/CCCL. +""" + +import argparse +import os +import shutil +import subprocess +import sys +import tempfile +import zipfile +from pathlib import Path +from typing import List + + +def run_command(cmd: List[str], cwd: Path | None = None, env: dict = os.environ) -> subprocess.CompletedProcess: + """Run a command with error handling.""" + print(f"Running: {' '.join(cmd)}") + if cwd: + print(f" Working directory: {cwd}") + + result = subprocess.run(cmd, cwd=cwd, env=env, capture_output=True, text=True) # noqa: S603 + + if result.returncode != 0: + print(f"Command failed with return code {result.returncode}") + print("STDOUT:", result.stdout) + print("STDERR:", result.stderr) + result.check_returncode() + + return result + + +def print_wheel_directory_structure(wheel_path: Path, filter_prefix: str = "cuda/core/", label: str | None = None): + """Print the directory structure of a wheel file, similar to unzip -l output. + + Args: + wheel_path: Path to the wheel file to inspect + filter_prefix: Only show files matching this prefix (default: "cuda/core/") + label: Optional label to print before the structure (e.g., "Input wheel 1: name.whl") + """ + if label: + print(f"\n--- {label} ---", file=sys.stderr) + try: + with zipfile.ZipFile(wheel_path, "r") as zf: + print(f"{'Length':>10} {'Date':>12} {'Time':>8} Name", file=sys.stderr) + print("-" * 80, file=sys.stderr) + total_size = 0 + file_count = 0 + for name in sorted(zf.namelist()): + if filter_prefix in name: + info = zf.getinfo(name) + total_size += info.file_size + file_count += 1 + date_time = info.date_time + date_str = f"{date_time[0]:04d}-{date_time[1]:02d}-{date_time[2]:02d}" + time_str = f"{date_time[3]:02d}:{date_time[4]:02d}:{date_time[5]:02d}" + print(f"{info.file_size:10d} {date_str} {time_str} {name}", file=sys.stderr) + print("-" * 80, file=sys.stderr) + print(f"{total_size:10d} {file_count} files", file=sys.stderr) + except Exception as e: + print(f"Warning: Could not list wheel contents: {e}", file=sys.stderr) + + +def merge_wheels(wheels: List[Path], output_dir: Path, show_wheel_contents: bool = True) -> Path: + """Merge multiple wheels into a single wheel with version-specific binaries.""" + print("\n=== Merging wheels ===", file=sys.stderr) + print(f"Input wheels: {[w.name for w in wheels]}", file=sys.stderr) + + if len(wheels) == 1: + raise RuntimeError("only one wheel is provided, nothing to merge") + + # Extract all wheels to temporary directories + with tempfile.TemporaryDirectory() as temp_dir: + temp_path = Path(temp_dir) + extracted_wheels = [] + + for i, wheel in enumerate(wheels): + print(f"Extracting wheel {i + 1}/{len(wheels)}: {wheel.name}", file=sys.stderr) + # Extract wheel - wheel unpack creates the directory itself + run_command( + [ + sys.executable, + "-m", + "wheel", + "unpack", + str(wheel), + "--dest", + str(temp_path), + ] + ) + + # Find the extracted directory (wheel unpack creates a subdirectory) + extract_dir = None + for item in temp_path.iterdir(): + if item.is_dir() and item.name.startswith("cuda_core"): + extract_dir = item + break + + if not extract_dir: + raise RuntimeError(f"Could not find extracted wheel directory for {wheel.name}") + + # Rename to our expected name + expected_name = temp_path / f"wheel_{i}" + extract_dir.rename(expected_name) + extract_dir = expected_name + + extracted_wheels.append(extract_dir) + + if show_wheel_contents: + print("\n=== Input wheel directory structures ===", file=sys.stderr) + for i, wheel in enumerate(wheels): + print_wheel_directory_structure(wheel, label=f"Input wheel {i + 1}: {wheel.name}") + + # Use the first wheel as the base and merge binaries from others + base_wheel = extracted_wheels[0] + + # Copy version-specific directories from each wheel into versioned subdirectories + base_dir = Path("cuda") / "core" + + for i, wheel_dir in enumerate(extracted_wheels): + cuda_version = wheels[i].name.split(".cu")[1].split(".")[0] + versioned_dir = base_wheel / base_dir / f"cu{cuda_version}" + + # Copy entire directory tree from source wheel to versioned directory + print(f" Copying {wheel_dir / base_dir} to {versioned_dir}", file=sys.stderr) + shutil.copytree(wheel_dir / base_dir, versioned_dir, dirs_exist_ok=True) + + # Overwrite the __init__.py in versioned dirs to be empty + os.truncate(versioned_dir / "__init__.py", 0) + + print("\n=== Removing files from cuda/core/ directory ===", file=sys.stderr) + items_to_keep = ( + "__init__.py", + "_version.py", + "_include", + "_cpp", # Headers for Cython development + "cu12", + "cu13", + ) + # _resource_handles is shared (not CUDA-version-specific) and must stay + # at top level. It's imported early in __init__.py before versioned code. + items_to_keep_prefix = ("_resource_handles",) + all_items = os.scandir(base_wheel / base_dir) + removed_count = 0 + for f in all_items: + f_abspath = f.path + if f.name in items_to_keep: + continue + if any(f.name.startswith(prefix) for prefix in items_to_keep_prefix): + continue + if f.is_dir(): + print(f" Removing directory: {f.name}", file=sys.stderr) + shutil.rmtree(f_abspath) + else: + print(f" Removing file: {f.name}", file=sys.stderr) + os.remove(f_abspath) + removed_count += 1 + print(f"Removed {removed_count} items from cuda/core/ directory", file=sys.stderr) + + # Repack the merged wheel + output_dir.mkdir(parents=True, exist_ok=True) + + # Create a clean wheel name without CUDA version suffixes + base_wheel_name = wheels[0].with_suffix(".whl").name + + print(f"Repacking merged wheel as: {base_wheel_name}", file=sys.stderr) + run_command( + [ + sys.executable, + "-m", + "wheel", + "pack", + str(base_wheel), + "--dest-dir", + str(output_dir), + ] + ) + + # Find the output wheel + output_wheels = list(output_dir.glob("*.whl")) + if not output_wheels: + raise RuntimeError("Failed to create merged wheel") + + merged_wheel = output_wheels[0] + print(f"Successfully merged wheel: {merged_wheel}", file=sys.stderr) + + if show_wheel_contents: + print("\n=== Output wheel directory structure ===", file=sys.stderr) + print_wheel_directory_structure(merged_wheel) + + return merged_wheel + + +def main(): + """Main merge script.""" + parser = argparse.ArgumentParser(description="Merge CUDA-specific wheels into a single multi-CUDA wheel") + parser.add_argument("wheels", nargs="+", help="Paths to the CUDA-specific wheels to merge") + parser.add_argument("--output-dir", "-o", default="dist", help="Output directory for merged wheel") + + args = parser.parse_args() + + print("cuda.core Wheel Merger", file=sys.stderr) + print("======================", file=sys.stderr) + + # Convert wheel paths to Path objects and validate + wheels = [] + for wheel_path in args.wheels: + wheel = Path(wheel_path) + if not wheel.exists(): + print(f"Error: Wheel not found: {wheel}", file=sys.stderr) + sys.exit(1) + if not wheel.name.endswith(".whl"): + print(f"Error: Not a wheel file: {wheel}", file=sys.stderr) + sys.exit(1) + wheels.append(wheel) + + if not wheels: + print("Error: No wheels provided", file=sys.stderr) + sys.exit(1) + + output_dir = Path(args.output_dir) + + # Check that we have wheel tool available + try: + import wheel + except ImportError: + print("Error: wheel package not available. Install with: pip install wheel", file=sys.stderr) + sys.exit(1) + + # Merge the wheels + merged_wheel = merge_wheels(wheels, output_dir) + print(f"\nMerge complete! Output: {merged_wheel}") + + +if __name__ == "__main__": + main() diff --git a/ci/tools/run-tests b/ci/tools/run-tests new file mode 100755 index 00000000000..c093ed9e4d2 --- /dev/null +++ b/ci/tools/run-tests @@ -0,0 +1,194 @@ +#!/usr/bin/env bash + +# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +# A utility script to install the correct packages and run the tests. + +set -euo pipefail + +# Check if the script was called with exactly 1 argument +if [[ ${#} -ne 1 ]]; then + echo "Error: This script requires exactly 1 argument. You provided ${#}" + exit 1 +fi +if [[ "${1}" != "bindings" && "${1}" != "core" && "${1}" != "pathfinder" && "${1}" != nightly-* ]]; then + echo "Error: Invalid test module '${1}'. Must be 'bindings', 'core', 'pathfinder', or 'nightly-*'" + exit 1 +fi + +test_module=${1} + +# For standard modes, install pathfinder up front (it is a direct dependency +# of bindings, and a transitive dependency of core). Nightly modes install +# all wheels together in a single pip call further below. +if [[ "${test_module}" != nightly-* ]]; then + pushd ./cuda_pathfinder + echo "Installing pathfinder wheel" + pip install ./*.whl --group test + popd +fi + +if [[ "${test_module}" == "pathfinder" ]]; then + pushd ./cuda_pathfinder + echo "Running pathfinder tests with " \ + "LD:${CUDA_PATHFINDER_TEST_LOAD_NVIDIA_DYNAMIC_LIB_STRICTNESS} " \ + "FH:${CUDA_PATHFINDER_TEST_FIND_NVIDIA_HEADERS_STRICTNESS} " \ + "BC:${CUDA_PATHFINDER_TEST_FIND_NVIDIA_BITCODE_LIB_STRICTNESS}" + pytest -ra -s -v --durations=0 tests/ |& tee /tmp/pathfinder_test_log.txt + # Report the number of "INFO test_" lines (including zero) + # to support quick validations based on GHA log archives. + line_count=$(awk '/^INFO test_/ {count++} END {print count+0}' /tmp/pathfinder_test_log.txt) + echo "Number of \"INFO test_\" lines: $line_count" + popd +elif [[ "${test_module}" == "bindings" ]]; then + echo "Installing bindings wheel" + pushd ./cuda_bindings + if [[ "${LOCAL_CTK}" == 1 ]]; then + pip install "${CUDA_BINDINGS_ARTIFACTS_DIR}"/*.whl --group test + else + pip install $(ls "${CUDA_BINDINGS_ARTIFACTS_DIR}"/*.whl)[all] --group test + fi + echo "Running bindings tests" + ${SANITIZER_CMD} pytest -rxXs -v --durations=0 --randomly-dont-reorganize tests/ + if [[ "${SKIP_CYTHON_TEST}" == 0 ]]; then + ${SANITIZER_CMD} pytest -rxXs -v --durations=0 --randomly-dont-reorganize tests/cython + fi + popd +elif [[ "${test_module}" == "core" || "${test_module}" == nightly-* ]]; then + # Shared setup for core and nightly modes. + TEST_CUDA_MAJOR="$(cut -d '.' -f 1 <<< ${CUDA_VER})" + TEST_CUDA_MAJOR_MINOR="$(cut -d '.' -f 1-2 <<< "${CUDA_VER}")" + + FREE_THREADING="" + if python -c 'import sys; assert not sys._is_gil_enabled()' 2> /dev/null; then + FREE_THREADING+="-ft" + fi + + # Resolve bindings based on BINDINGS_SOURCE (set by env-vars): + # main/backport → local wheel from artifacts dir + # published → install from PyPI by version + BINDINGS_ARGS=() + if [[ "${BINDINGS_SOURCE}" == "published" ]]; then + BINDINGS_ARGS+=("cuda-bindings==${TEST_CUDA_MAJOR}.${TEST_CUDA_MINOR}.*") + else + BINDINGS_ARGS=("${CUDA_BINDINGS_ARTIFACTS_DIR}"/*.whl) + if [[ "${LOCAL_CTK}" != 1 ]]; then + BINDINGS_ARGS=("${BINDINGS_ARGS[0]}[all]") + fi + fi + + # Resolve core wheel, adding the published cuda.bindings extra + # when this job is resolving against wheel-installed CTK packages. + CORE_WHL=("${CUDA_CORE_ARTIFACTS_DIR}"/*.whl) + if [[ "${LOCAL_CTK}" != 1 ]]; then + CORE_WHL=("${CORE_WHL[0]}[cu${TEST_CUDA_MAJOR}]") + fi + + if [[ "${test_module}" == nightly-* ]]; then + # Resolve pathfinder wheel to absolute path before pushd. + # CUDA_BINDINGS_ARTIFACTS_DIR and CUDA_CORE_ARTIFACTS_DIR are already + # absolute (set via realpath in env-vars). + PATHFINDER_WHL=($(realpath ./cuda_pathfinder/*.whl)) + fi + + if [[ "${test_module}" == "core" ]]; then + # pushd so --group reads test dependency groups from cuda_core/pyproject.toml. + pushd ./cuda_core + echo "Installing bindings (source: ${BINDINGS_SOURCE})" + pip install "${BINDINGS_ARGS[@]}" + echo "Installing core wheel" + # Constrain cuda-toolkit to the requested CTK version to avoid + # pip pulling in a newer nvidia-cuda-runtime that conflicts with it. + pip install "${CORE_WHL[@]}" --group "test-cu${TEST_CUDA_MAJOR}${FREE_THREADING}" "cuda-toolkit==${TEST_CUDA_MAJOR_MINOR}.*" + echo "Installed packages before core tests:" + pip list + echo "Running core tests" + ${SANITIZER_CMD} pytest -rxXs -v --durations=0 --randomly-dont-reorganize tests/ + # Currently our CI always installs the latest bindings (from either major version). + # This is not compatible with the test requirements. + if [[ "${SKIP_CYTHON_TEST}" == 0 ]]; then + ${SANITIZER_CMD} pytest -rxXs -v --durations=0 --randomly-dont-reorganize tests/cython + fi + popd + elif [[ "${test_module}" == "nightly-cuda-core" ]]; then + # Test the *released* cuda-core (from PyPI) against *main*-built pathfinder + # and cuda-bindings. The workflow follows up with an actions/checkout of the + # matching cuda-core-v tag so the released version's own test suite + # (which is not shipped in the wheel) can be exercised. + echo "Installing pathfinder + bindings from main + released cuda-core from PyPI" + pip install "${PATHFINDER_WHL[@]}" "${BINDINGS_ARGS[@]}" "cuda-core[cu${TEST_CUDA_MAJOR}]" + + released_ver=$(pip show cuda-core | awk '/^Version:/{print $2}') + if [[ -n "${GITHUB_ENV:-}" ]]; then + echo "CUDA_CORE_RELEASED_VER=${released_ver}" >> "${GITHUB_ENV}" + echo "CUDA_CORE_TEST_GROUP=test-cu${TEST_CUDA_MAJOR}${FREE_THREADING}" >> "${GITHUB_ENV}" + fi + echo "Installed packages before released cuda-core tests:" + pip list + else + # Nightly optional-dependency testing: nightly-pytorch, nightly-numba-cuda, + # nightly-numba-cuda-mlir. Install ALL cuda-python wheels (pathfinder + + # bindings + core) and the optional dep in a single pip call so pip resolves + # version constraints in one shot. + pushd ./cuda_core + PIP_ARGS=( + "${PATHFINDER_WHL[@]}" + "${BINDINGS_ARGS[@]}" + "${CORE_WHL[@]}" + --group "test-cu${TEST_CUDA_MAJOR}${FREE_THREADING}" + ) + + if [[ "${test_module}" == "nightly-pytorch" ]]; then + # TORCH_VER and TORCH_CUDA must be set by the caller. + # Use cuda-toolkit[cudart] only — torch brings its own nvcc/nvrtc/etc. + # This avoids version conflicts between our nvidia-* pins and torch's. + echo "Installing pathfinder + bindings + core + test deps + PyTorch ${TORCH_VER} (${TORCH_CUDA})" + PIP_ARGS+=("cuda-toolkit[cudart]==${TEST_CUDA_MAJOR_MINOR}.*") + if [[ "${TORCH_VER}" == "latest" ]]; then + PIP_ARGS+=(torch) + else + PIP_ARGS+=("torch==${TORCH_VER}") + fi + PIP_ARGS+=(--extra-index-url "https://download.pytorch.org/whl/${TORCH_CUDA}") + elif [[ "${test_module}" == "nightly-numba-cuda" ]]; then + echo "Installing pathfinder + bindings + core + test deps + numba-cuda" + # numba-cuda's test-cuXX group deps (can't use --group for a wheel install): + PIP_ARGS+=( + "cuda-toolkit[curand,cublas]==${TEST_CUDA_MAJOR_MINOR}.*" + "numba-cuda[cu${TEST_CUDA_MAJOR}]" + "cupy-cuda${TEST_CUDA_MAJOR}x" + psutil cffi pytest-xdist pytest-benchmark filecheck ml_dtypes statistics + ) + elif [[ "${test_module}" == "nightly-numba-cuda-mlir" ]]; then + echo "Installing pathfinder + bindings + core + numba-cuda-mlir + cupy" + # numpy<2.5: numba-cuda-mlir 0.4.0 registers np.row_stack, which was + # removed in NumPy 2.5. See NVIDIA/numba-cuda-mlir#154. + # curand/cublas + cupy: some numba-cuda-mlir tests (e.g. + # test_fortran_contiguous) call cp.random, which dlopens libcurand at + # runtime. Mirror the numba-cuda branch, which installs the same libs. + PIP_ARGS+=( + "numba-cuda-mlir[cu${TEST_CUDA_MAJOR}]" + "numpy<2.5" + "cuda-toolkit[curand,cublas]==${TEST_CUDA_MAJOR_MINOR}.*" + "cupy-cuda${TEST_CUDA_MAJOR}x" + ) + fi + + pip install "${PIP_ARGS[@]}" + echo "Nightly install complete — installed packages:" + pip list + popd + + if [[ "${test_module}" == "nightly-numba-cuda-mlir" ]]; then + # Expose the installed numba-cuda-mlir version so the workflow can + # actions/checkout the matching v tag from NVIDIA/numba-cuda-mlir + # (the wheel does not ship test_*.py files). + installed_ver=$(pip show numba-cuda-mlir | awk '/^Version:/{print $2}') + if [[ -n "${GITHUB_ENV:-}" ]]; then + echo "NUMBA_CUDA_MLIR_VER=${installed_ver}" >> "${GITHUB_ENV}" + fi + fi + fi +fi diff --git a/ci/tools/run_pytest_with_stack.py b/ci/tools/run_pytest_with_stack.py new file mode 100644 index 00000000000..e1e1f782ba1 --- /dev/null +++ b/ci/tools/run_pytest_with_stack.py @@ -0,0 +1,54 @@ +#!/usr/bin/env python3 + +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +"""Run pytest on a thread with a larger stack size. + +Cython linetrace instrumentation under coverage on Windows can exceed the +default 1 MB thread stack. This helper spawns a single worker thread with +a configurable stack (default 8 MB) so the rest of the CI workflow stays +readable. + +Usage: + python run_pytest_with_stack.py [--stack-mb N] [--cwd DIR] [pytest args ...] +""" + +import argparse +import concurrent.futures +import os +import sys +import threading + +import pytest + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument( + "--stack-mb", + type=int, + default=8, + help="Thread stack size in megabytes (default: 8)", + ) + parser.add_argument( + "--cwd", + default=None, + help="Working directory for the test run", + ) + args, pytest_args = parser.parse_known_args() + + if args.cwd: + os.chdir(args.cwd) + + threading.stack_size(args.stack_mb * 1024 * 1024) + + with concurrent.futures.ThreadPoolExecutor(max_workers=1) as pool: + code = pool.submit(pytest.main, pytest_args).result() + + sys.exit(code) + + +if __name__ == "__main__": + main() diff --git a/ci/tools/setup-sanitizer b/ci/tools/setup-sanitizer new file mode 100755 index 00000000000..cce78cedfa9 --- /dev/null +++ b/ci/tools/setup-sanitizer @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +# A utility script to set up the GitHub environment variables for the CI. + +set -euo pipefail + +# Setup comppute sanitizer if requested. +if [[ "${SETUP_SANITIZER}" == 1 ]]; then + COMPUTE_SANITIZER="${CUDA_HOME}/bin/compute-sanitizer" + COMPUTE_SANITIZER_VERSION=$(${COMPUTE_SANITIZER} --version | grep -Eo "[0-9]{4}\.[0-9]\.[0-9]" | sed -e 's/\.//g') + # --target-processes=application-only: attach the sanitizer to the parent + # pytest process only. Spawned multiprocessing.Process children run without + # the sanitizer. This aims to mitigate a class of CI hangs where child + # processes take an extreme amount of time to spawn (>30 seconds). Test bugs + # triggered by that specific condition are typically uncovered only in CI, + # where they become emergencies and are difficult to debug. The parent + # process is still fully sanitized, which is where most of the interesting + # host-side IPC plumbing runs anyway. + SANITIZER_CMD="${COMPUTE_SANITIZER} --target-processes=application-only --launch-timeout=0 --tool=memcheck --error-exitcode=1 --report-api-errors=no" + if [[ "$COMPUTE_SANITIZER_VERSION" -ge 202111 ]]; then + SANITIZER_CMD="${SANITIZER_CMD} --padding=32" + fi +else + SANITIZER_CMD="" +fi +echo "SANITIZER_CMD=${SANITIZER_CMD}" >> $GITHUB_ENV diff --git a/ci/tools/tests/test_check_release_notes.py b/ci/tools/tests/test_check_release_notes.py new file mode 100644 index 00000000000..4f65404eed5 --- /dev/null +++ b/ci/tools/tests/test_check_release_notes.py @@ -0,0 +1,333 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +from __future__ import annotations + +import os +import sys + +sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..")) +from check_release_notes import ( + check_release_notes, + is_post_release, + load_backport_branch, + main, + parse_version_from_tag, +) + + +class TestParseVersionFromTag: + def test_plain_tag_bindings(self): + assert parse_version_from_tag("v13.1.0", "cuda-bindings") == "13.1.0" + + def test_plain_tag_python(self): + assert parse_version_from_tag("v13.1.0", "cuda-python") == "13.1.0" + + def test_component_prefix_core(self): + assert parse_version_from_tag("cuda-core-v0.7.0", "cuda-core") == "0.7.0" + + def test_component_prefix_pathfinder(self): + assert parse_version_from_tag("cuda-pathfinder-v1.5.2", "cuda-pathfinder") == "1.5.2" + + def test_post_release(self): + assert parse_version_from_tag("v12.6.2.post1", "cuda-bindings") == "12.6.2.post1" + + def test_invalid_tag(self): + assert parse_version_from_tag("not-a-tag", "cuda-core") is None + + def test_no_v_prefix(self): + assert parse_version_from_tag("13.1.0", "cuda-bindings") is None + + def test_component_prefix_mismatch(self): + # cuda-core-v* must not be accepted for component=cuda-pathfinder + assert parse_version_from_tag("cuda-core-v0.7.0", "cuda-pathfinder") is None + + def test_bare_v_rejected_for_core(self): + # bare v* belongs to cuda-bindings/cuda-python, not cuda-core + assert parse_version_from_tag("v0.7.0", "cuda-core") is None + + def test_unknown_component(self): + assert parse_version_from_tag("v13.1.0", "bogus") is None + + def test_path_traversal_rejected(self): + assert parse_version_from_tag("v1.0.0/../evil", "cuda-bindings") is None + + def test_path_separator_rejected(self): + assert parse_version_from_tag("v1/2/3", "cuda-bindings") is None + + def test_leading_dot_rejected(self): + assert parse_version_from_tag("v.1.0", "cuda-bindings") is None + + def test_whitespace_rejected(self): + assert parse_version_from_tag("v1.0.0 ", "cuda-bindings") is None + + def test_trailing_suffix_rejected(self): + # \w permits alphanumerics + underscore only; hyphens and shell meta-chars are out + assert parse_version_from_tag("v1.0.0-extra", "cuda-bindings") is None + + +class TestIsPostRelease: + def test_normal(self): + assert not is_post_release("13.1.0") + + def test_post(self): + assert is_post_release("12.6.2.post1") + + def test_post_no_number(self): + assert is_post_release("1.0.0.post") + + +class TestCheckReleaseNotes: + def _make_notes(self, tmp_path, pkg, version, content="Release notes."): + d = tmp_path / pkg / "docs" / "source" / "release" + d.mkdir(parents=True, exist_ok=True) + f = d / f"{version}-notes.rst" + f.write_text(content) + return f + + def test_present_and_nonempty(self, tmp_path): + self._make_notes(tmp_path, "cuda_core", "0.7.0") + problems = check_release_notes("cuda-core-v0.7.0", "cuda-core", str(tmp_path)) + assert problems == [] + + def test_missing(self, tmp_path): + problems = check_release_notes("cuda-core-v0.7.0", "cuda-core", str(tmp_path)) + assert len(problems) == 1 + assert problems[0][1] == "missing" + + def test_empty(self, tmp_path): + self._make_notes(tmp_path, "cuda_core", "0.7.0", content="") + problems = check_release_notes("cuda-core-v0.7.0", "cuda-core", str(tmp_path)) + assert len(problems) == 1 + assert problems[0][1] == "empty" + + def test_post_release_skipped(self, tmp_path): + problems = check_release_notes("v12.6.2.post1", "cuda-bindings", str(tmp_path)) + assert problems == [] + + def test_invalid_tag(self, tmp_path): + problems = check_release_notes("not-a-tag", "cuda-core", str(tmp_path)) + assert len(problems) == 1 + assert "cannot parse" in problems[0][1] + + def test_component_prefix_mismatch(self, tmp_path): + # Pass a cuda-core tag with component=cuda-pathfinder; must be rejected. + problems = check_release_notes("cuda-core-v0.7.0", "cuda-pathfinder", str(tmp_path)) + assert len(problems) == 1 + assert "cannot parse" in problems[0][1] + + def test_unknown_component(self, tmp_path): + problems = check_release_notes("v13.1.0", "bogus", str(tmp_path)) + assert len(problems) == 1 + assert "unknown component" in problems[0][1] + + def test_plain_v_tag(self, tmp_path): + self._make_notes(tmp_path, "cuda_python", "13.1.0") + problems = check_release_notes("v13.1.0", "cuda-python", str(tmp_path)) + assert problems == [] + + +class TestLoadBackportBranch: + def test_from_versions_yml(self, tmp_path): + d = tmp_path / "ci" + d.mkdir(parents=True) + (d / "versions.yml").write_text('backport_branch: "12.9.x"\n') + + assert load_backport_branch(str(tmp_path)) == "12.9.x" + + def test_from_github_ref_name_for_legacy_backport_branch(self, tmp_path, monkeypatch): + monkeypatch.setenv("GITHUB_REF_NAME", "12.9.x") + + assert load_backport_branch(str(tmp_path)) == "12.9.x" + + def test_ignores_non_backport_github_ref_name(self, tmp_path, monkeypatch): + monkeypatch.setenv("GITHUB_REF_NAME", "main") + + assert load_backport_branch(str(tmp_path)) is None + + +class TestMain: + def _make_notes(self, tmp_path, pkg, version, content="Release notes."): + d = tmp_path / pkg / "docs" / "source" / "release" + d.mkdir(parents=True, exist_ok=True) + (d / f"{version}-notes.rst").write_text(content) + + def test_success(self, tmp_path): + d = tmp_path / "cuda_core" / "docs" / "source" / "release" + d.mkdir(parents=True) + (d / "0.7.0-notes.rst").write_text("Notes here.") + rc = main(["--git-tag", "cuda-core-v0.7.0", "--component", "cuda-core", "--repo-root", str(tmp_path)]) + assert rc == 0 + + def test_failure(self, tmp_path): + rc = main(["--git-tag", "cuda-core-v0.7.0", "--component", "cuda-core", "--repo-root", str(tmp_path)]) + assert rc == 1 + + def test_post_skip(self, tmp_path): + rc = main(["--git-tag", "v12.6.2.post1", "--component", "cuda-bindings", "--repo-root", str(tmp_path)]) + assert rc == 0 + + def test_unparsable_tag_returns_2(self, tmp_path): + rc = main(["--git-tag", "not-a-tag", "--component", "cuda-core", "--repo-root", str(tmp_path)]) + assert rc == 2 + + def test_path_traversal_returns_2(self, tmp_path): + rc = main(["--git-tag", "v1.0.0/../evil", "--component", "cuda-bindings", "--repo-root", str(tmp_path)]) + assert rc == 2 + + def test_component_prefix_mismatch_returns_2(self, tmp_path): + rc = main( + [ + "--git-tag", + "cuda-core-v0.7.0", + "--component", + "cuda-pathfinder", + "--repo-root", + str(tmp_path), + ] + ) + assert rc == 2 + + def test_mainline_bindings_requires_backport_decision(self, tmp_path, capsys): + rc = main( + [ + "--git-tag", + "v13.3.0", + "--component", + "cuda-bindings", + "--repo-root", + str(tmp_path), + "--backport-branch", + "12.9.x", + ] + ) + + captured = capsys.readouterr() + assert rc == 1 + assert "" in captured.err + + def test_mainline_bindings_accepts_not_planned(self, tmp_path): + self._make_notes(tmp_path, "cuda_bindings", "13.3.0") + + rc = main( + [ + "--git-tag", + "v13.3.0", + "--component", + "cuda-bindings", + "--repo-root", + str(tmp_path), + "--backport-branch", + "12.9.x", + "--backport-git-tag", + "not planned", + ] + ) + + assert rc == 0 + + def test_mainline_bindings_checks_planned_backport_notes(self, tmp_path, capsys): + self._make_notes(tmp_path, "cuda_bindings", "13.3.0") + + rc = main( + [ + "--git-tag", + "v13.3.0", + "--component", + "cuda-bindings", + "--repo-root", + str(tmp_path), + "--backport-branch", + "12.9.x", + "--backport-git-tag", + "v12.9.7", + ] + ) + + captured = capsys.readouterr() + assert rc == 1 + assert "12.9.7-notes.rst" in captured.err + + def test_mainline_bindings_accepts_planned_backport_notes(self, tmp_path): + self._make_notes(tmp_path, "cuda_bindings", "13.3.0") + self._make_notes(tmp_path, "cuda_bindings", "12.9.7") + + rc = main( + [ + "--git-tag", + "v13.3.0", + "--component", + "cuda-bindings", + "--repo-root", + str(tmp_path), + "--backport-branch", + "12.9.x", + "--backport-git-tag", + "v12.9.7", + ] + ) + + assert rc == 0 + + def test_mainline_cuda_python_accepts_planned_backport_notes(self, tmp_path): + self._make_notes(tmp_path, "cuda_python", "13.3.0") + self._make_notes(tmp_path, "cuda_python", "12.9.7") + + rc = main( + [ + "--git-tag", + "v13.3.0", + "--component", + "cuda-python", + "--repo-root", + str(tmp_path), + "--backport-branch", + "12.9.x", + "--backport-git-tag", + "v12.9.7", + ] + ) + + assert rc == 0 + + def test_backport_bindings_missing_notes_warns_without_failing(self, tmp_path, monkeypatch, capsys): + summary_path = tmp_path / "summary.md" + monkeypatch.setenv("GITHUB_STEP_SUMMARY", str(summary_path)) + + rc = main( + [ + "--git-tag", + "v12.9.7", + "--component", + "cuda-bindings", + "--repo-root", + str(tmp_path), + "--backport-branch", + "12.9.x", + ] + ) + + captured = capsys.readouterr() + assert rc == 0 + assert "::warning file=cuda_bindings/docs/source/release/12.9.7-notes.rst::" in captured.out + assert "12.9.7-notes.rst" in summary_path.read_text() + + def test_mainline_bindings_rejects_non_backport_tag(self, tmp_path): + self._make_notes(tmp_path, "cuda_bindings", "13.3.0") + + rc = main( + [ + "--git-tag", + "v13.3.0", + "--component", + "cuda-bindings", + "--repo-root", + str(tmp_path), + "--backport-branch", + "12.9.x", + "--backport-git-tag", + "v13.2.0", + ] + ) + + assert rc == 2 diff --git a/ci/tools/validate-release-wheels b/ci/tools/validate-release-wheels new file mode 100755 index 00000000000..52d24df4731 --- /dev/null +++ b/ci/tools/validate-release-wheels @@ -0,0 +1,138 @@ +#!/usr/bin/env python3 + +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +"""Validate downloaded release wheels against the requested release tag.""" + +from __future__ import annotations + +import argparse +import sys +from collections import defaultdict +from pathlib import Path + +from check_release_notes import parse_version_from_tag + +COMPONENT_TO_DISTRIBUTIONS: dict[str, set[str]] = { + "cuda-core": {"cuda_core"}, + "cuda-bindings": {"cuda_bindings"}, + "cuda-pathfinder": {"cuda_pathfinder"}, + "cuda-python": {"cuda_python"}, + "all": {"cuda_core", "cuda_bindings", "cuda_pathfinder", "cuda_python"}, +} + +COMPONENT_TO_TAG_COMPONENTS: dict[str, tuple[str, ...]] = { + "cuda-core": ("cuda-core",), + "cuda-bindings": ("cuda-bindings",), + "cuda-pathfinder": ("cuda-pathfinder",), + "cuda-python": ("cuda-python",), + "all": ("cuda-core", "cuda-bindings", "cuda-pathfinder", "cuda-python"), +} + + +def parse_args() -> argparse.Namespace: + parser = argparse.ArgumentParser( + description=( + "Validate that wheel versions match the release tag. " + "This rejects dev/local wheel versions for release uploads." + ) + ) + parser.add_argument("git_tag", help="Release git tag (for example: v13.0.0)") + parser.add_argument("component", choices=sorted(COMPONENT_TO_DISTRIBUTIONS.keys())) + parser.add_argument("wheel_dir", help="Directory containing wheel files") + return parser.parse_args() + + +def version_from_tag(tag: str, component: str) -> str: + versions = { + version + for tag_component in COMPONENT_TO_TAG_COMPONENTS[component] + if (version := parse_version_from_tag(tag, tag_component)) is not None + } + if len(versions) == 1: + return versions.pop() + raise ValueError( + "Unsupported git tag format " + f"{tag!r} for component {component!r}; expected vX.Y.Z[.postN], " + "cuda-core-vX.Y.Z[.postN], or cuda-pathfinder-vX.Y.Z[.postN]." + ) + + +def parse_wheel_dist_and_version(path: Path) -> tuple[str, str]: + # Wheel name format starts with: {distribution}-{version}-... + parts = path.stem.split("-") + if len(parts) < 5: + raise ValueError(f"Invalid wheel filename format: {path.name}") + return parts[0], parts[1] + + +def main() -> int: + args = parse_args() + try: + expected_version = version_from_tag(args.git_tag, args.component) + except ValueError as exc: + print(f"Error: {exc}", file=sys.stderr) + return 1 + + expected_distributions = COMPONENT_TO_DISTRIBUTIONS[args.component] + wheel_dir = Path(args.wheel_dir) + + wheels = sorted(wheel_dir.glob("*.whl")) + if not wheels: + print(f"Error: No wheel files found in {wheel_dir}", file=sys.stderr) + return 1 + + seen_versions: dict[str, set[str]] = defaultdict(set) + errors: list[str] = [] + + for wheel in wheels: + try: + distribution, version = parse_wheel_dist_and_version(wheel) + except ValueError as exc: + errors.append(str(exc)) + continue + + if distribution not in expected_distributions: + continue + + seen_versions[distribution].add(version) + + if ".dev" in version or "+" in version: + errors.append( + f"{wheel.name}: wheel version {version!r} contains dev/local markers " + "(.dev or +), which is not allowed for release uploads." + ) + + if version != expected_version: + errors.append( + f"{wheel.name}: wheel version {version!r} does not match expected " + f"release version {expected_version!r} from git tag {args.git_tag!r}." + ) + + missing_distributions = sorted(expected_distributions - set(seen_versions)) + if missing_distributions: + errors.append("Missing expected component wheels in download set: " + ", ".join(missing_distributions)) + + for distribution, versions in sorted(seen_versions.items()): + if len(versions) > 1: + errors.append( + f"Expected one release version for {distribution}, found multiple: " + ", ".join(sorted(versions)) + ) + + if errors: + print("Wheel validation failed:", file=sys.stderr) + for error in errors: + print(f" - {error}", file=sys.stderr) + return 1 + + print( + "Validated release wheels for component " + f"{args.component} at version {expected_version} from tag {args.git_tag}." + ) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/ci/versions.yml b/ci/versions.yml new file mode 100644 index 00000000000..0f0ab251e50 --- /dev/null +++ b/ci/versions.yml @@ -0,0 +1,10 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +backport_branch: "12.9.x" # keep in sync with target-branch in .github/dependabot.yml + +cuda: + build: + version: "13.3.0" + prev_build: + version: "12.9.1" diff --git a/conftest.py b/conftest.py new file mode 100644 index 00000000000..7a0c59065d5 --- /dev/null +++ b/conftest.py @@ -0,0 +1,58 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + + +import os + +import pytest + +from cuda.pathfinder import get_cuda_path_or_home + + +# Please keep in sync with the copy in cuda_core/tests/conftest.py. +def _cuda_headers_available() -> bool: + """Return True if CUDA headers are available, False if no CUDA path is set. + + Raises AssertionError if a CUDA path is set but has no include/ subdirectory. + """ + cuda_path = get_cuda_path_or_home() + if cuda_path is None: + return False + assert os.path.isdir(os.path.join(cuda_path, "include")), ( + f"CUDA path {cuda_path} does not contain an 'include' subdirectory" + ) + return True + + +def pytest_collection_modifyitems(config, items): # noqa: ARG001 + have_headers = _cuda_headers_available() + for item in items: + nodeid = item.nodeid.replace("\\", "/") + + # Package markers by path + if nodeid.startswith("cuda_pathfinder/tests/") or "/cuda_pathfinder/tests/" in nodeid: + item.add_marker(pytest.mark.pathfinder) + if nodeid.startswith("cuda_bindings/tests/") or "/cuda_bindings/tests/" in nodeid: + item.add_marker(pytest.mark.bindings) + if nodeid.startswith("cuda_core/tests/") or "/cuda_core/tests/" in nodeid: + item.add_marker(pytest.mark.core) + + # Smoke tests + if nodeid.startswith("tests/integration/") or "/tests/integration/" in nodeid: + item.add_marker(pytest.mark.smoke) + + # Cython tests (any tests/cython subtree) + if ( + "/tests/cython/" in nodeid + or nodeid.endswith("/tests/cython") + or ("/cython/" in nodeid and "/tests/" in nodeid) + ): + item.add_marker(pytest.mark.cython) + + # Gate core cython tests on CUDA_PATH + if "core" in item.keywords and not have_headers: + item.add_marker( + pytest.mark.skip( + reason="Environment variable CUDA_PATH or CUDA_HOME is not set: skipping core cython tests" + ) + ) diff --git a/context7.json b/context7.json new file mode 100644 index 00000000000..d87afcd31e6 --- /dev/null +++ b/context7.json @@ -0,0 +1,4 @@ +{ + "url": "https://context7.com/nvidia/cuda-python", + "public_key": "pk_gupaHhsdvsuT1j3BZpb7i" +} diff --git a/cuda/__init__.py b/cuda/__init__.py deleted file mode 100644 index ecd3379a870..00000000000 --- a/cuda/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ - -from . import _version -__version__ = _version.get_versions()['version'] diff --git a/cuda/_cuda/ccuda.pyx.in b/cuda/_cuda/ccuda.pyx.in deleted file mode 100644 index 64a296f1dd2..00000000000 --- a/cuda/_cuda/ccuda.pyx.in +++ /dev/null @@ -1,14081 +0,0 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. -# -# Please refer to the NVIDIA end user license agreement (EULA) associated -# with this source code for terms and conditions that govern your use of -# this software. Any use, reproduction, disclosure, or distribution of -# this software and related documentation outside the terms of the EULA -# is strictly prohibited. -{{if 'Windows' == platform.system()}} -import win32api -import struct -from pywintypes import error -{{else}} -cimport cuda._lib.dlfcn as dlfcn -{{endif}} -import os -import sys -cimport cuda._cuda.loader as loader -cdef bint __cuPythonInit = False -{{if 'cuGetErrorString' in found_functions}}cdef void *__cuGetErrorString = NULL{{endif}} -{{if 'cuGetErrorName' in found_functions}}cdef void *__cuGetErrorName = NULL{{endif}} -{{if 'cuInit' in found_functions}}cdef void *__cuInit = NULL{{endif}} -{{if 'cuDriverGetVersion' in found_functions}}cdef void *__cuDriverGetVersion = NULL{{endif}} -{{if 'cuDeviceGet' in found_functions}}cdef void *__cuDeviceGet = NULL{{endif}} -{{if 'cuDeviceGetCount' in found_functions}}cdef void *__cuDeviceGetCount = NULL{{endif}} -{{if 'cuDeviceGetName' in found_functions}}cdef void *__cuDeviceGetName = NULL{{endif}} -{{if 'cuDeviceGetUuid' in found_functions}}cdef void *__cuDeviceGetUuid = NULL{{endif}} -{{if 'cuDeviceGetUuid_v2' in found_functions}}cdef void *__cuDeviceGetUuid_v2 = NULL{{endif}} -{{if 'cuDeviceGetLuid' in found_functions}}cdef void *__cuDeviceGetLuid = NULL{{endif}} -{{if 'cuDeviceTotalMem_v2' in found_functions}}cdef void *__cuDeviceTotalMem_v2 = NULL{{endif}} -{{if 'cuDeviceGetTexture1DLinearMaxWidth' in found_functions}}cdef void *__cuDeviceGetTexture1DLinearMaxWidth = NULL{{endif}} -{{if 'cuDeviceGetAttribute' in found_functions}}cdef void *__cuDeviceGetAttribute = NULL{{endif}} -{{if 'cuDeviceGetNvSciSyncAttributes' in found_functions}}cdef void *__cuDeviceGetNvSciSyncAttributes = NULL{{endif}} -{{if 'cuDeviceSetMemPool' in found_functions}}cdef void *__cuDeviceSetMemPool = NULL{{endif}} -{{if 'cuDeviceGetMemPool' in found_functions}}cdef void *__cuDeviceGetMemPool = NULL{{endif}} -{{if 'cuDeviceGetDefaultMemPool' in found_functions}}cdef void *__cuDeviceGetDefaultMemPool = NULL{{endif}} -{{if 'cuDeviceGetExecAffinitySupport' in found_functions}}cdef void *__cuDeviceGetExecAffinitySupport = NULL{{endif}} -{{if 'cuFlushGPUDirectRDMAWrites' in found_functions}}cdef void *__cuFlushGPUDirectRDMAWrites = NULL{{endif}} -{{if 'cuDeviceGetProperties' in found_functions}}cdef void *__cuDeviceGetProperties = NULL{{endif}} -{{if 'cuDeviceComputeCapability' in found_functions}}cdef void *__cuDeviceComputeCapability = NULL{{endif}} -{{if 'cuDevicePrimaryCtxRetain' in found_functions}}cdef void *__cuDevicePrimaryCtxRetain = NULL{{endif}} -{{if 'cuDevicePrimaryCtxRelease_v2' in found_functions}}cdef void *__cuDevicePrimaryCtxRelease_v2 = NULL{{endif}} -{{if 'cuDevicePrimaryCtxSetFlags_v2' in found_functions}}cdef void *__cuDevicePrimaryCtxSetFlags_v2 = NULL{{endif}} -{{if 'cuDevicePrimaryCtxGetState' in found_functions}}cdef void *__cuDevicePrimaryCtxGetState = NULL{{endif}} -{{if 'cuDevicePrimaryCtxReset_v2' in found_functions}}cdef void *__cuDevicePrimaryCtxReset_v2 = NULL{{endif}} -{{if 'cuCtxCreate_v2' in found_functions}}cdef void *__cuCtxCreate_v2 = NULL{{endif}} -{{if 'cuCtxCreate_v3' in found_functions}}cdef void *__cuCtxCreate_v3 = NULL{{endif}} -{{if 'cuCtxCreate_v4' in found_functions}}cdef void *__cuCtxCreate_v4 = NULL{{endif}} -{{if 'cuCtxDestroy_v2' in found_functions}}cdef void *__cuCtxDestroy_v2 = NULL{{endif}} -{{if 'cuCtxPushCurrent_v2' in found_functions}}cdef void *__cuCtxPushCurrent_v2 = NULL{{endif}} -{{if 'cuCtxPopCurrent_v2' in found_functions}}cdef void *__cuCtxPopCurrent_v2 = NULL{{endif}} -{{if 'cuCtxSetCurrent' in found_functions}}cdef void *__cuCtxSetCurrent = NULL{{endif}} -{{if 'cuCtxGetCurrent' in found_functions}}cdef void *__cuCtxGetCurrent = NULL{{endif}} -{{if 'cuCtxGetDevice' in found_functions}}cdef void *__cuCtxGetDevice = NULL{{endif}} -{{if 'cuCtxGetFlags' in found_functions}}cdef void *__cuCtxGetFlags = NULL{{endif}} -{{if 'cuCtxSetFlags' in found_functions}}cdef void *__cuCtxSetFlags = NULL{{endif}} -{{if 'cuCtxGetId' in found_functions}}cdef void *__cuCtxGetId = NULL{{endif}} -{{if 'cuCtxSynchronize' in found_functions}}cdef void *__cuCtxSynchronize = NULL{{endif}} -{{if 'cuCtxSetLimit' in found_functions}}cdef void *__cuCtxSetLimit = NULL{{endif}} -{{if 'cuCtxGetLimit' in found_functions}}cdef void *__cuCtxGetLimit = NULL{{endif}} -{{if 'cuCtxGetCacheConfig' in found_functions}}cdef void *__cuCtxGetCacheConfig = NULL{{endif}} -{{if 'cuCtxSetCacheConfig' in found_functions}}cdef void *__cuCtxSetCacheConfig = NULL{{endif}} -{{if 'cuCtxGetApiVersion' in found_functions}}cdef void *__cuCtxGetApiVersion = NULL{{endif}} -{{if 'cuCtxGetStreamPriorityRange' in found_functions}}cdef void *__cuCtxGetStreamPriorityRange = NULL{{endif}} -{{if 'cuCtxResetPersistingL2Cache' in found_functions}}cdef void *__cuCtxResetPersistingL2Cache = NULL{{endif}} -{{if 'cuCtxGetExecAffinity' in found_functions}}cdef void *__cuCtxGetExecAffinity = NULL{{endif}} -{{if 'cuCtxRecordEvent' in found_functions}}cdef void *__cuCtxRecordEvent = NULL{{endif}} -{{if 'cuCtxWaitEvent' in found_functions}}cdef void *__cuCtxWaitEvent = NULL{{endif}} -{{if 'cuCtxAttach' in found_functions}}cdef void *__cuCtxAttach = NULL{{endif}} -{{if 'cuCtxDetach' in found_functions}}cdef void *__cuCtxDetach = NULL{{endif}} -{{if 'cuCtxGetSharedMemConfig' in found_functions}}cdef void *__cuCtxGetSharedMemConfig = NULL{{endif}} -{{if 'cuCtxSetSharedMemConfig' in found_functions}}cdef void *__cuCtxSetSharedMemConfig = NULL{{endif}} -{{if 'cuModuleLoad' in found_functions}}cdef void *__cuModuleLoad = NULL{{endif}} -{{if 'cuModuleLoadData' in found_functions}}cdef void *__cuModuleLoadData = NULL{{endif}} -{{if 'cuModuleLoadDataEx' in found_functions}}cdef void *__cuModuleLoadDataEx = NULL{{endif}} -{{if 'cuModuleLoadFatBinary' in found_functions}}cdef void *__cuModuleLoadFatBinary = NULL{{endif}} -{{if 'cuModuleUnload' in found_functions}}cdef void *__cuModuleUnload = NULL{{endif}} -{{if 'cuModuleGetLoadingMode' in found_functions}}cdef void *__cuModuleGetLoadingMode = NULL{{endif}} -{{if 'cuModuleGetFunction' in found_functions}}cdef void *__cuModuleGetFunction = NULL{{endif}} -{{if 'cuModuleGetFunctionCount' in found_functions}}cdef void *__cuModuleGetFunctionCount = NULL{{endif}} -{{if 'cuModuleEnumerateFunctions' in found_functions}}cdef void *__cuModuleEnumerateFunctions = NULL{{endif}} -{{if 'cuModuleGetGlobal_v2' in found_functions}}cdef void *__cuModuleGetGlobal_v2 = NULL{{endif}} -{{if 'cuLinkCreate_v2' in found_functions}}cdef void *__cuLinkCreate_v2 = NULL{{endif}} -{{if 'cuLinkAddData_v2' in found_functions}}cdef void *__cuLinkAddData_v2 = NULL{{endif}} -{{if 'cuLinkAddFile_v2' in found_functions}}cdef void *__cuLinkAddFile_v2 = NULL{{endif}} -{{if 'cuLinkComplete' in found_functions}}cdef void *__cuLinkComplete = NULL{{endif}} -{{if 'cuLinkDestroy' in found_functions}}cdef void *__cuLinkDestroy = NULL{{endif}} -{{if 'cuModuleGetTexRef' in found_functions}}cdef void *__cuModuleGetTexRef = NULL{{endif}} -{{if 'cuModuleGetSurfRef' in found_functions}}cdef void *__cuModuleGetSurfRef = NULL{{endif}} -{{if 'cuLibraryLoadData' in found_functions}}cdef void *__cuLibraryLoadData = NULL{{endif}} -{{if 'cuLibraryLoadFromFile' in found_functions}}cdef void *__cuLibraryLoadFromFile = NULL{{endif}} -{{if 'cuLibraryUnload' in found_functions}}cdef void *__cuLibraryUnload = NULL{{endif}} -{{if 'cuLibraryGetKernel' in found_functions}}cdef void *__cuLibraryGetKernel = NULL{{endif}} -{{if 'cuLibraryGetKernelCount' in found_functions}}cdef void *__cuLibraryGetKernelCount = NULL{{endif}} -{{if 'cuLibraryEnumerateKernels' in found_functions}}cdef void *__cuLibraryEnumerateKernels = NULL{{endif}} -{{if 'cuLibraryGetModule' in found_functions}}cdef void *__cuLibraryGetModule = NULL{{endif}} -{{if 'cuKernelGetFunction' in found_functions}}cdef void *__cuKernelGetFunction = NULL{{endif}} -{{if 'cuKernelGetLibrary' in found_functions}}cdef void *__cuKernelGetLibrary = NULL{{endif}} -{{if 'cuLibraryGetGlobal' in found_functions}}cdef void *__cuLibraryGetGlobal = NULL{{endif}} -{{if 'cuLibraryGetManaged' in found_functions}}cdef void *__cuLibraryGetManaged = NULL{{endif}} -{{if 'cuLibraryGetUnifiedFunction' in found_functions}}cdef void *__cuLibraryGetUnifiedFunction = NULL{{endif}} -{{if 'cuKernelGetAttribute' in found_functions}}cdef void *__cuKernelGetAttribute = NULL{{endif}} -{{if 'cuKernelSetAttribute' in found_functions}}cdef void *__cuKernelSetAttribute = NULL{{endif}} -{{if 'cuKernelSetCacheConfig' in found_functions}}cdef void *__cuKernelSetCacheConfig = NULL{{endif}} -{{if 'cuKernelGetName' in found_functions}}cdef void *__cuKernelGetName = NULL{{endif}} -{{if 'cuKernelGetParamInfo' in found_functions}}cdef void *__cuKernelGetParamInfo = NULL{{endif}} -{{if 'cuMemGetInfo_v2' in found_functions}}cdef void *__cuMemGetInfo_v2 = NULL{{endif}} -{{if 'cuMemAlloc_v2' in found_functions}}cdef void *__cuMemAlloc_v2 = NULL{{endif}} -{{if 'cuMemAllocPitch_v2' in found_functions}}cdef void *__cuMemAllocPitch_v2 = NULL{{endif}} -{{if 'cuMemFree_v2' in found_functions}}cdef void *__cuMemFree_v2 = NULL{{endif}} -{{if 'cuMemGetAddressRange_v2' in found_functions}}cdef void *__cuMemGetAddressRange_v2 = NULL{{endif}} -{{if 'cuMemAllocHost_v2' in found_functions}}cdef void *__cuMemAllocHost_v2 = NULL{{endif}} -{{if 'cuMemFreeHost' in found_functions}}cdef void *__cuMemFreeHost = NULL{{endif}} -{{if 'cuMemHostAlloc' in found_functions}}cdef void *__cuMemHostAlloc = NULL{{endif}} -{{if 'cuMemHostGetDevicePointer_v2' in found_functions}}cdef void *__cuMemHostGetDevicePointer_v2 = NULL{{endif}} -{{if 'cuMemHostGetFlags' in found_functions}}cdef void *__cuMemHostGetFlags = NULL{{endif}} -{{if 'cuMemAllocManaged' in found_functions}}cdef void *__cuMemAllocManaged = NULL{{endif}} -{{if 'cuDeviceRegisterAsyncNotification' in found_functions}}cdef void *__cuDeviceRegisterAsyncNotification = NULL{{endif}} -{{if 'cuDeviceUnregisterAsyncNotification' in found_functions}}cdef void *__cuDeviceUnregisterAsyncNotification = NULL{{endif}} -{{if 'cuDeviceGetByPCIBusId' in found_functions}}cdef void *__cuDeviceGetByPCIBusId = NULL{{endif}} -{{if 'cuDeviceGetPCIBusId' in found_functions}}cdef void *__cuDeviceGetPCIBusId = NULL{{endif}} -{{if 'cuIpcGetEventHandle' in found_functions}}cdef void *__cuIpcGetEventHandle = NULL{{endif}} -{{if 'cuIpcOpenEventHandle' in found_functions}}cdef void *__cuIpcOpenEventHandle = NULL{{endif}} -{{if 'cuIpcGetMemHandle' in found_functions}}cdef void *__cuIpcGetMemHandle = NULL{{endif}} -{{if 'cuIpcOpenMemHandle_v2' in found_functions}}cdef void *__cuIpcOpenMemHandle_v2 = NULL{{endif}} -{{if 'cuIpcCloseMemHandle' in found_functions}}cdef void *__cuIpcCloseMemHandle = NULL{{endif}} -{{if 'cuMemHostRegister_v2' in found_functions}}cdef void *__cuMemHostRegister_v2 = NULL{{endif}} -{{if 'cuMemHostUnregister' in found_functions}}cdef void *__cuMemHostUnregister = NULL{{endif}} -{{if 'cuMemcpy' in found_functions}}cdef void *__cuMemcpy = NULL{{endif}} -{{if 'cuMemcpyPeer' in found_functions}}cdef void *__cuMemcpyPeer = NULL{{endif}} -{{if 'cuMemcpyHtoD_v2' in found_functions}}cdef void *__cuMemcpyHtoD_v2 = NULL{{endif}} -{{if 'cuMemcpyDtoH_v2' in found_functions}}cdef void *__cuMemcpyDtoH_v2 = NULL{{endif}} -{{if 'cuMemcpyDtoD_v2' in found_functions}}cdef void *__cuMemcpyDtoD_v2 = NULL{{endif}} -{{if 'cuMemcpyDtoA_v2' in found_functions}}cdef void *__cuMemcpyDtoA_v2 = NULL{{endif}} -{{if 'cuMemcpyAtoD_v2' in found_functions}}cdef void *__cuMemcpyAtoD_v2 = NULL{{endif}} -{{if 'cuMemcpyHtoA_v2' in found_functions}}cdef void *__cuMemcpyHtoA_v2 = NULL{{endif}} -{{if 'cuMemcpyAtoH_v2' in found_functions}}cdef void *__cuMemcpyAtoH_v2 = NULL{{endif}} -{{if 'cuMemcpyAtoA_v2' in found_functions}}cdef void *__cuMemcpyAtoA_v2 = NULL{{endif}} -{{if 'cuMemcpy2D_v2' in found_functions}}cdef void *__cuMemcpy2D_v2 = NULL{{endif}} -{{if 'cuMemcpy2DUnaligned_v2' in found_functions}}cdef void *__cuMemcpy2DUnaligned_v2 = NULL{{endif}} -{{if 'cuMemcpy3D_v2' in found_functions}}cdef void *__cuMemcpy3D_v2 = NULL{{endif}} -{{if 'cuMemcpy3DPeer' in found_functions}}cdef void *__cuMemcpy3DPeer = NULL{{endif}} -{{if 'cuMemcpyAsync' in found_functions}}cdef void *__cuMemcpyAsync = NULL{{endif}} -{{if 'cuMemcpyPeerAsync' in found_functions}}cdef void *__cuMemcpyPeerAsync = NULL{{endif}} -{{if 'cuMemcpyHtoDAsync_v2' in found_functions}}cdef void *__cuMemcpyHtoDAsync_v2 = NULL{{endif}} -{{if 'cuMemcpyDtoHAsync_v2' in found_functions}}cdef void *__cuMemcpyDtoHAsync_v2 = NULL{{endif}} -{{if 'cuMemcpyDtoDAsync_v2' in found_functions}}cdef void *__cuMemcpyDtoDAsync_v2 = NULL{{endif}} -{{if 'cuMemcpyHtoAAsync_v2' in found_functions}}cdef void *__cuMemcpyHtoAAsync_v2 = NULL{{endif}} -{{if 'cuMemcpyAtoHAsync_v2' in found_functions}}cdef void *__cuMemcpyAtoHAsync_v2 = NULL{{endif}} -{{if 'cuMemcpy2DAsync_v2' in found_functions}}cdef void *__cuMemcpy2DAsync_v2 = NULL{{endif}} -{{if 'cuMemcpy3DAsync_v2' in found_functions}}cdef void *__cuMemcpy3DAsync_v2 = NULL{{endif}} -{{if 'cuMemcpy3DPeerAsync' in found_functions}}cdef void *__cuMemcpy3DPeerAsync = NULL{{endif}} -{{if 'cuMemsetD8_v2' in found_functions}}cdef void *__cuMemsetD8_v2 = NULL{{endif}} -{{if 'cuMemsetD16_v2' in found_functions}}cdef void *__cuMemsetD16_v2 = NULL{{endif}} -{{if 'cuMemsetD32_v2' in found_functions}}cdef void *__cuMemsetD32_v2 = NULL{{endif}} -{{if 'cuMemsetD2D8_v2' in found_functions}}cdef void *__cuMemsetD2D8_v2 = NULL{{endif}} -{{if 'cuMemsetD2D16_v2' in found_functions}}cdef void *__cuMemsetD2D16_v2 = NULL{{endif}} -{{if 'cuMemsetD2D32_v2' in found_functions}}cdef void *__cuMemsetD2D32_v2 = NULL{{endif}} -{{if 'cuMemsetD8Async' in found_functions}}cdef void *__cuMemsetD8Async = NULL{{endif}} -{{if 'cuMemsetD16Async' in found_functions}}cdef void *__cuMemsetD16Async = NULL{{endif}} -{{if 'cuMemsetD32Async' in found_functions}}cdef void *__cuMemsetD32Async = NULL{{endif}} -{{if 'cuMemsetD2D8Async' in found_functions}}cdef void *__cuMemsetD2D8Async = NULL{{endif}} -{{if 'cuMemsetD2D16Async' in found_functions}}cdef void *__cuMemsetD2D16Async = NULL{{endif}} -{{if 'cuMemsetD2D32Async' in found_functions}}cdef void *__cuMemsetD2D32Async = NULL{{endif}} -{{if 'cuArrayCreate_v2' in found_functions}}cdef void *__cuArrayCreate_v2 = NULL{{endif}} -{{if 'cuArrayGetDescriptor_v2' in found_functions}}cdef void *__cuArrayGetDescriptor_v2 = NULL{{endif}} -{{if 'cuArrayGetSparseProperties' in found_functions}}cdef void *__cuArrayGetSparseProperties = NULL{{endif}} -{{if 'cuMipmappedArrayGetSparseProperties' in found_functions}}cdef void *__cuMipmappedArrayGetSparseProperties = NULL{{endif}} -{{if 'cuArrayGetMemoryRequirements' in found_functions}}cdef void *__cuArrayGetMemoryRequirements = NULL{{endif}} -{{if 'cuMipmappedArrayGetMemoryRequirements' in found_functions}}cdef void *__cuMipmappedArrayGetMemoryRequirements = NULL{{endif}} -{{if 'cuArrayGetPlane' in found_functions}}cdef void *__cuArrayGetPlane = NULL{{endif}} -{{if 'cuArrayDestroy' in found_functions}}cdef void *__cuArrayDestroy = NULL{{endif}} -{{if 'cuArray3DCreate_v2' in found_functions}}cdef void *__cuArray3DCreate_v2 = NULL{{endif}} -{{if 'cuArray3DGetDescriptor_v2' in found_functions}}cdef void *__cuArray3DGetDescriptor_v2 = NULL{{endif}} -{{if 'cuMipmappedArrayCreate' in found_functions}}cdef void *__cuMipmappedArrayCreate = NULL{{endif}} -{{if 'cuMipmappedArrayGetLevel' in found_functions}}cdef void *__cuMipmappedArrayGetLevel = NULL{{endif}} -{{if 'cuMipmappedArrayDestroy' in found_functions}}cdef void *__cuMipmappedArrayDestroy = NULL{{endif}} -{{if 'cuMemGetHandleForAddressRange' in found_functions}}cdef void *__cuMemGetHandleForAddressRange = NULL{{endif}} -{{if 'cuMemAddressReserve' in found_functions}}cdef void *__cuMemAddressReserve = NULL{{endif}} -{{if 'cuMemAddressFree' in found_functions}}cdef void *__cuMemAddressFree = NULL{{endif}} -{{if 'cuMemCreate' in found_functions}}cdef void *__cuMemCreate = NULL{{endif}} -{{if 'cuMemRelease' in found_functions}}cdef void *__cuMemRelease = NULL{{endif}} -{{if 'cuMemMap' in found_functions}}cdef void *__cuMemMap = NULL{{endif}} -{{if 'cuMemMapArrayAsync' in found_functions}}cdef void *__cuMemMapArrayAsync = NULL{{endif}} -{{if 'cuMemUnmap' in found_functions}}cdef void *__cuMemUnmap = NULL{{endif}} -{{if 'cuMemSetAccess' in found_functions}}cdef void *__cuMemSetAccess = NULL{{endif}} -{{if 'cuMemGetAccess' in found_functions}}cdef void *__cuMemGetAccess = NULL{{endif}} -{{if 'cuMemExportToShareableHandle' in found_functions}}cdef void *__cuMemExportToShareableHandle = NULL{{endif}} -{{if 'cuMemImportFromShareableHandle' in found_functions}}cdef void *__cuMemImportFromShareableHandle = NULL{{endif}} -{{if 'cuMemGetAllocationGranularity' in found_functions}}cdef void *__cuMemGetAllocationGranularity = NULL{{endif}} -{{if 'cuMemGetAllocationPropertiesFromHandle' in found_functions}}cdef void *__cuMemGetAllocationPropertiesFromHandle = NULL{{endif}} -{{if 'cuMemRetainAllocationHandle' in found_functions}}cdef void *__cuMemRetainAllocationHandle = NULL{{endif}} -{{if 'cuMemFreeAsync' in found_functions}}cdef void *__cuMemFreeAsync = NULL{{endif}} -{{if 'cuMemAllocAsync' in found_functions}}cdef void *__cuMemAllocAsync = NULL{{endif}} -{{if 'cuMemPoolTrimTo' in found_functions}}cdef void *__cuMemPoolTrimTo = NULL{{endif}} -{{if 'cuMemPoolSetAttribute' in found_functions}}cdef void *__cuMemPoolSetAttribute = NULL{{endif}} -{{if 'cuMemPoolGetAttribute' in found_functions}}cdef void *__cuMemPoolGetAttribute = NULL{{endif}} -{{if 'cuMemPoolSetAccess' in found_functions}}cdef void *__cuMemPoolSetAccess = NULL{{endif}} -{{if 'cuMemPoolGetAccess' in found_functions}}cdef void *__cuMemPoolGetAccess = NULL{{endif}} -{{if 'cuMemPoolCreate' in found_functions}}cdef void *__cuMemPoolCreate = NULL{{endif}} -{{if 'cuMemPoolDestroy' in found_functions}}cdef void *__cuMemPoolDestroy = NULL{{endif}} -{{if 'cuMemAllocFromPoolAsync' in found_functions}}cdef void *__cuMemAllocFromPoolAsync = NULL{{endif}} -{{if 'cuMemPoolExportToShareableHandle' in found_functions}}cdef void *__cuMemPoolExportToShareableHandle = NULL{{endif}} -{{if 'cuMemPoolImportFromShareableHandle' in found_functions}}cdef void *__cuMemPoolImportFromShareableHandle = NULL{{endif}} -{{if 'cuMemPoolExportPointer' in found_functions}}cdef void *__cuMemPoolExportPointer = NULL{{endif}} -{{if 'cuMemPoolImportPointer' in found_functions}}cdef void *__cuMemPoolImportPointer = NULL{{endif}} -{{if 'cuMulticastCreate' in found_functions}}cdef void *__cuMulticastCreate = NULL{{endif}} -{{if 'cuMulticastAddDevice' in found_functions}}cdef void *__cuMulticastAddDevice = NULL{{endif}} -{{if 'cuMulticastBindMem' in found_functions}}cdef void *__cuMulticastBindMem = NULL{{endif}} -{{if 'cuMulticastBindAddr' in found_functions}}cdef void *__cuMulticastBindAddr = NULL{{endif}} -{{if 'cuMulticastUnbind' in found_functions}}cdef void *__cuMulticastUnbind = NULL{{endif}} -{{if 'cuMulticastGetGranularity' in found_functions}}cdef void *__cuMulticastGetGranularity = NULL{{endif}} -{{if 'cuPointerGetAttribute' in found_functions}}cdef void *__cuPointerGetAttribute = NULL{{endif}} -{{if 'cuMemPrefetchAsync' in found_functions}}cdef void *__cuMemPrefetchAsync = NULL{{endif}} -{{if 'cuMemPrefetchAsync_v2' in found_functions}}cdef void *__cuMemPrefetchAsync_v2 = NULL{{endif}} -{{if 'cuMemAdvise' in found_functions}}cdef void *__cuMemAdvise = NULL{{endif}} -{{if 'cuMemAdvise_v2' in found_functions}}cdef void *__cuMemAdvise_v2 = NULL{{endif}} -{{if 'cuMemRangeGetAttribute' in found_functions}}cdef void *__cuMemRangeGetAttribute = NULL{{endif}} -{{if 'cuMemRangeGetAttributes' in found_functions}}cdef void *__cuMemRangeGetAttributes = NULL{{endif}} -{{if 'cuPointerSetAttribute' in found_functions}}cdef void *__cuPointerSetAttribute = NULL{{endif}} -{{if 'cuPointerGetAttributes' in found_functions}}cdef void *__cuPointerGetAttributes = NULL{{endif}} -{{if 'cuStreamCreate' in found_functions}}cdef void *__cuStreamCreate = NULL{{endif}} -{{if 'cuStreamCreateWithPriority' in found_functions}}cdef void *__cuStreamCreateWithPriority = NULL{{endif}} -{{if 'cuStreamGetPriority' in found_functions}}cdef void *__cuStreamGetPriority = NULL{{endif}} -{{if 'cuStreamGetFlags' in found_functions}}cdef void *__cuStreamGetFlags = NULL{{endif}} -{{if 'cuStreamGetId' in found_functions}}cdef void *__cuStreamGetId = NULL{{endif}} -{{if 'cuStreamGetCtx' in found_functions}}cdef void *__cuStreamGetCtx = NULL{{endif}} -{{if 'cuStreamGetCtx_v2' in found_functions}}cdef void *__cuStreamGetCtx_v2 = NULL{{endif}} -{{if 'cuStreamWaitEvent' in found_functions}}cdef void *__cuStreamWaitEvent = NULL{{endif}} -{{if 'cuStreamAddCallback' in found_functions}}cdef void *__cuStreamAddCallback = NULL{{endif}} -{{if 'cuStreamBeginCapture_v2' in found_functions}}cdef void *__cuStreamBeginCapture_v2 = NULL{{endif}} -{{if 'cuStreamBeginCaptureToGraph' in found_functions}}cdef void *__cuStreamBeginCaptureToGraph = NULL{{endif}} -{{if 'cuThreadExchangeStreamCaptureMode' in found_functions}}cdef void *__cuThreadExchangeStreamCaptureMode = NULL{{endif}} -{{if 'cuStreamEndCapture' in found_functions}}cdef void *__cuStreamEndCapture = NULL{{endif}} -{{if 'cuStreamIsCapturing' in found_functions}}cdef void *__cuStreamIsCapturing = NULL{{endif}} -{{if 'cuStreamGetCaptureInfo_v2' in found_functions}}cdef void *__cuStreamGetCaptureInfo_v2 = NULL{{endif}} -{{if 'cuStreamGetCaptureInfo_v3' in found_functions}}cdef void *__cuStreamGetCaptureInfo_v3 = NULL{{endif}} -{{if 'cuStreamUpdateCaptureDependencies' in found_functions}}cdef void *__cuStreamUpdateCaptureDependencies = NULL{{endif}} -{{if 'cuStreamUpdateCaptureDependencies_v2' in found_functions}}cdef void *__cuStreamUpdateCaptureDependencies_v2 = NULL{{endif}} -{{if 'cuStreamAttachMemAsync' in found_functions}}cdef void *__cuStreamAttachMemAsync = NULL{{endif}} -{{if 'cuStreamQuery' in found_functions}}cdef void *__cuStreamQuery = NULL{{endif}} -{{if 'cuStreamSynchronize' in found_functions}}cdef void *__cuStreamSynchronize = NULL{{endif}} -{{if 'cuStreamDestroy_v2' in found_functions}}cdef void *__cuStreamDestroy_v2 = NULL{{endif}} -{{if 'cuStreamCopyAttributes' in found_functions}}cdef void *__cuStreamCopyAttributes = NULL{{endif}} -{{if 'cuStreamGetAttribute' in found_functions}}cdef void *__cuStreamGetAttribute = NULL{{endif}} -{{if 'cuStreamSetAttribute' in found_functions}}cdef void *__cuStreamSetAttribute = NULL{{endif}} -{{if 'cuEventCreate' in found_functions}}cdef void *__cuEventCreate = NULL{{endif}} -{{if 'cuEventRecord' in found_functions}}cdef void *__cuEventRecord = NULL{{endif}} -{{if 'cuEventRecordWithFlags' in found_functions}}cdef void *__cuEventRecordWithFlags = NULL{{endif}} -{{if 'cuEventQuery' in found_functions}}cdef void *__cuEventQuery = NULL{{endif}} -{{if 'cuEventSynchronize' in found_functions}}cdef void *__cuEventSynchronize = NULL{{endif}} -{{if 'cuEventDestroy_v2' in found_functions}}cdef void *__cuEventDestroy_v2 = NULL{{endif}} -{{if 'cuEventElapsedTime' in found_functions}}cdef void *__cuEventElapsedTime = NULL{{endif}} -{{if 'cuImportExternalMemory' in found_functions}}cdef void *__cuImportExternalMemory = NULL{{endif}} -{{if 'cuExternalMemoryGetMappedBuffer' in found_functions}}cdef void *__cuExternalMemoryGetMappedBuffer = NULL{{endif}} -{{if 'cuExternalMemoryGetMappedMipmappedArray' in found_functions}}cdef void *__cuExternalMemoryGetMappedMipmappedArray = NULL{{endif}} -{{if 'cuDestroyExternalMemory' in found_functions}}cdef void *__cuDestroyExternalMemory = NULL{{endif}} -{{if 'cuImportExternalSemaphore' in found_functions}}cdef void *__cuImportExternalSemaphore = NULL{{endif}} -{{if 'cuSignalExternalSemaphoresAsync' in found_functions}}cdef void *__cuSignalExternalSemaphoresAsync = NULL{{endif}} -{{if 'cuWaitExternalSemaphoresAsync' in found_functions}}cdef void *__cuWaitExternalSemaphoresAsync = NULL{{endif}} -{{if 'cuDestroyExternalSemaphore' in found_functions}}cdef void *__cuDestroyExternalSemaphore = NULL{{endif}} -{{if 'cuStreamWaitValue32_v2' in found_functions}}cdef void *__cuStreamWaitValue32_v2 = NULL{{endif}} -{{if 'cuStreamWaitValue64_v2' in found_functions}}cdef void *__cuStreamWaitValue64_v2 = NULL{{endif}} -{{if 'cuStreamWriteValue32_v2' in found_functions}}cdef void *__cuStreamWriteValue32_v2 = NULL{{endif}} -{{if 'cuStreamWriteValue64_v2' in found_functions}}cdef void *__cuStreamWriteValue64_v2 = NULL{{endif}} -{{if 'cuStreamBatchMemOp_v2' in found_functions}}cdef void *__cuStreamBatchMemOp_v2 = NULL{{endif}} -{{if 'cuFuncGetAttribute' in found_functions}}cdef void *__cuFuncGetAttribute = NULL{{endif}} -{{if 'cuFuncSetAttribute' in found_functions}}cdef void *__cuFuncSetAttribute = NULL{{endif}} -{{if 'cuFuncSetCacheConfig' in found_functions}}cdef void *__cuFuncSetCacheConfig = NULL{{endif}} -{{if 'cuFuncGetModule' in found_functions}}cdef void *__cuFuncGetModule = NULL{{endif}} -{{if 'cuFuncGetName' in found_functions}}cdef void *__cuFuncGetName = NULL{{endif}} -{{if 'cuFuncGetParamInfo' in found_functions}}cdef void *__cuFuncGetParamInfo = NULL{{endif}} -{{if 'cuFuncIsLoaded' in found_functions}}cdef void *__cuFuncIsLoaded = NULL{{endif}} -{{if 'cuFuncLoad' in found_functions}}cdef void *__cuFuncLoad = NULL{{endif}} -{{if 'cuLaunchKernel' in found_functions}}cdef void *__cuLaunchKernel = NULL{{endif}} -{{if 'cuLaunchKernelEx' in found_functions}}cdef void *__cuLaunchKernelEx = NULL{{endif}} -{{if 'cuLaunchCooperativeKernel' in found_functions}}cdef void *__cuLaunchCooperativeKernel = NULL{{endif}} -{{if 'cuLaunchCooperativeKernelMultiDevice' in found_functions}}cdef void *__cuLaunchCooperativeKernelMultiDevice = NULL{{endif}} -{{if 'cuLaunchHostFunc' in found_functions}}cdef void *__cuLaunchHostFunc = NULL{{endif}} -{{if 'cuFuncSetBlockShape' in found_functions}}cdef void *__cuFuncSetBlockShape = NULL{{endif}} -{{if 'cuFuncSetSharedSize' in found_functions}}cdef void *__cuFuncSetSharedSize = NULL{{endif}} -{{if 'cuParamSetSize' in found_functions}}cdef void *__cuParamSetSize = NULL{{endif}} -{{if 'cuParamSeti' in found_functions}}cdef void *__cuParamSeti = NULL{{endif}} -{{if 'cuParamSetf' in found_functions}}cdef void *__cuParamSetf = NULL{{endif}} -{{if 'cuParamSetv' in found_functions}}cdef void *__cuParamSetv = NULL{{endif}} -{{if 'cuLaunch' in found_functions}}cdef void *__cuLaunch = NULL{{endif}} -{{if 'cuLaunchGrid' in found_functions}}cdef void *__cuLaunchGrid = NULL{{endif}} -{{if 'cuLaunchGridAsync' in found_functions}}cdef void *__cuLaunchGridAsync = NULL{{endif}} -{{if 'cuParamSetTexRef' in found_functions}}cdef void *__cuParamSetTexRef = NULL{{endif}} -{{if 'cuFuncSetSharedMemConfig' in found_functions}}cdef void *__cuFuncSetSharedMemConfig = NULL{{endif}} -{{if 'cuGraphCreate' in found_functions}}cdef void *__cuGraphCreate = NULL{{endif}} -{{if 'cuGraphAddKernelNode_v2' in found_functions}}cdef void *__cuGraphAddKernelNode_v2 = NULL{{endif}} -{{if 'cuGraphKernelNodeGetParams_v2' in found_functions}}cdef void *__cuGraphKernelNodeGetParams_v2 = NULL{{endif}} -{{if 'cuGraphKernelNodeSetParams_v2' in found_functions}}cdef void *__cuGraphKernelNodeSetParams_v2 = NULL{{endif}} -{{if 'cuGraphAddMemcpyNode' in found_functions}}cdef void *__cuGraphAddMemcpyNode = NULL{{endif}} -{{if 'cuGraphMemcpyNodeGetParams' in found_functions}}cdef void *__cuGraphMemcpyNodeGetParams = NULL{{endif}} -{{if 'cuGraphMemcpyNodeSetParams' in found_functions}}cdef void *__cuGraphMemcpyNodeSetParams = NULL{{endif}} -{{if 'cuGraphAddMemsetNode' in found_functions}}cdef void *__cuGraphAddMemsetNode = NULL{{endif}} -{{if 'cuGraphMemsetNodeGetParams' in found_functions}}cdef void *__cuGraphMemsetNodeGetParams = NULL{{endif}} -{{if 'cuGraphMemsetNodeSetParams' in found_functions}}cdef void *__cuGraphMemsetNodeSetParams = NULL{{endif}} -{{if 'cuGraphAddHostNode' in found_functions}}cdef void *__cuGraphAddHostNode = NULL{{endif}} -{{if 'cuGraphHostNodeGetParams' in found_functions}}cdef void *__cuGraphHostNodeGetParams = NULL{{endif}} -{{if 'cuGraphHostNodeSetParams' in found_functions}}cdef void *__cuGraphHostNodeSetParams = NULL{{endif}} -{{if 'cuGraphAddChildGraphNode' in found_functions}}cdef void *__cuGraphAddChildGraphNode = NULL{{endif}} -{{if 'cuGraphChildGraphNodeGetGraph' in found_functions}}cdef void *__cuGraphChildGraphNodeGetGraph = NULL{{endif}} -{{if 'cuGraphAddEmptyNode' in found_functions}}cdef void *__cuGraphAddEmptyNode = NULL{{endif}} -{{if 'cuGraphAddEventRecordNode' in found_functions}}cdef void *__cuGraphAddEventRecordNode = NULL{{endif}} -{{if 'cuGraphEventRecordNodeGetEvent' in found_functions}}cdef void *__cuGraphEventRecordNodeGetEvent = NULL{{endif}} -{{if 'cuGraphEventRecordNodeSetEvent' in found_functions}}cdef void *__cuGraphEventRecordNodeSetEvent = NULL{{endif}} -{{if 'cuGraphAddEventWaitNode' in found_functions}}cdef void *__cuGraphAddEventWaitNode = NULL{{endif}} -{{if 'cuGraphEventWaitNodeGetEvent' in found_functions}}cdef void *__cuGraphEventWaitNodeGetEvent = NULL{{endif}} -{{if 'cuGraphEventWaitNodeSetEvent' in found_functions}}cdef void *__cuGraphEventWaitNodeSetEvent = NULL{{endif}} -{{if 'cuGraphAddExternalSemaphoresSignalNode' in found_functions}}cdef void *__cuGraphAddExternalSemaphoresSignalNode = NULL{{endif}} -{{if 'cuGraphExternalSemaphoresSignalNodeGetParams' in found_functions}}cdef void *__cuGraphExternalSemaphoresSignalNodeGetParams = NULL{{endif}} -{{if 'cuGraphExternalSemaphoresSignalNodeSetParams' in found_functions}}cdef void *__cuGraphExternalSemaphoresSignalNodeSetParams = NULL{{endif}} -{{if 'cuGraphAddExternalSemaphoresWaitNode' in found_functions}}cdef void *__cuGraphAddExternalSemaphoresWaitNode = NULL{{endif}} -{{if 'cuGraphExternalSemaphoresWaitNodeGetParams' in found_functions}}cdef void *__cuGraphExternalSemaphoresWaitNodeGetParams = NULL{{endif}} -{{if 'cuGraphExternalSemaphoresWaitNodeSetParams' in found_functions}}cdef void *__cuGraphExternalSemaphoresWaitNodeSetParams = NULL{{endif}} -{{if 'cuGraphAddBatchMemOpNode' in found_functions}}cdef void *__cuGraphAddBatchMemOpNode = NULL{{endif}} -{{if 'cuGraphBatchMemOpNodeGetParams' in found_functions}}cdef void *__cuGraphBatchMemOpNodeGetParams = NULL{{endif}} -{{if 'cuGraphBatchMemOpNodeSetParams' in found_functions}}cdef void *__cuGraphBatchMemOpNodeSetParams = NULL{{endif}} -{{if 'cuGraphExecBatchMemOpNodeSetParams' in found_functions}}cdef void *__cuGraphExecBatchMemOpNodeSetParams = NULL{{endif}} -{{if 'cuGraphAddMemAllocNode' in found_functions}}cdef void *__cuGraphAddMemAllocNode = NULL{{endif}} -{{if 'cuGraphMemAllocNodeGetParams' in found_functions}}cdef void *__cuGraphMemAllocNodeGetParams = NULL{{endif}} -{{if 'cuGraphAddMemFreeNode' in found_functions}}cdef void *__cuGraphAddMemFreeNode = NULL{{endif}} -{{if 'cuGraphMemFreeNodeGetParams' in found_functions}}cdef void *__cuGraphMemFreeNodeGetParams = NULL{{endif}} -{{if 'cuDeviceGraphMemTrim' in found_functions}}cdef void *__cuDeviceGraphMemTrim = NULL{{endif}} -{{if 'cuDeviceGetGraphMemAttribute' in found_functions}}cdef void *__cuDeviceGetGraphMemAttribute = NULL{{endif}} -{{if 'cuDeviceSetGraphMemAttribute' in found_functions}}cdef void *__cuDeviceSetGraphMemAttribute = NULL{{endif}} -{{if 'cuGraphClone' in found_functions}}cdef void *__cuGraphClone = NULL{{endif}} -{{if 'cuGraphNodeFindInClone' in found_functions}}cdef void *__cuGraphNodeFindInClone = NULL{{endif}} -{{if 'cuGraphNodeGetType' in found_functions}}cdef void *__cuGraphNodeGetType = NULL{{endif}} -{{if 'cuGraphGetNodes' in found_functions}}cdef void *__cuGraphGetNodes = NULL{{endif}} -{{if 'cuGraphGetRootNodes' in found_functions}}cdef void *__cuGraphGetRootNodes = NULL{{endif}} -{{if 'cuGraphGetEdges' in found_functions}}cdef void *__cuGraphGetEdges = NULL{{endif}} -{{if 'cuGraphGetEdges_v2' in found_functions}}cdef void *__cuGraphGetEdges_v2 = NULL{{endif}} -{{if 'cuGraphNodeGetDependencies' in found_functions}}cdef void *__cuGraphNodeGetDependencies = NULL{{endif}} -{{if 'cuGraphNodeGetDependencies_v2' in found_functions}}cdef void *__cuGraphNodeGetDependencies_v2 = NULL{{endif}} -{{if 'cuGraphNodeGetDependentNodes' in found_functions}}cdef void *__cuGraphNodeGetDependentNodes = NULL{{endif}} -{{if 'cuGraphNodeGetDependentNodes_v2' in found_functions}}cdef void *__cuGraphNodeGetDependentNodes_v2 = NULL{{endif}} -{{if 'cuGraphAddDependencies' in found_functions}}cdef void *__cuGraphAddDependencies = NULL{{endif}} -{{if 'cuGraphAddDependencies_v2' in found_functions}}cdef void *__cuGraphAddDependencies_v2 = NULL{{endif}} -{{if 'cuGraphRemoveDependencies' in found_functions}}cdef void *__cuGraphRemoveDependencies = NULL{{endif}} -{{if 'cuGraphRemoveDependencies_v2' in found_functions}}cdef void *__cuGraphRemoveDependencies_v2 = NULL{{endif}} -{{if 'cuGraphDestroyNode' in found_functions}}cdef void *__cuGraphDestroyNode = NULL{{endif}} -{{if 'cuGraphInstantiateWithFlags' in found_functions}}cdef void *__cuGraphInstantiateWithFlags = NULL{{endif}} -{{if 'cuGraphInstantiateWithParams' in found_functions}}cdef void *__cuGraphInstantiateWithParams = NULL{{endif}} -{{if 'cuGraphExecGetFlags' in found_functions}}cdef void *__cuGraphExecGetFlags = NULL{{endif}} -{{if 'cuGraphExecKernelNodeSetParams_v2' in found_functions}}cdef void *__cuGraphExecKernelNodeSetParams_v2 = NULL{{endif}} -{{if 'cuGraphExecMemcpyNodeSetParams' in found_functions}}cdef void *__cuGraphExecMemcpyNodeSetParams = NULL{{endif}} -{{if 'cuGraphExecMemsetNodeSetParams' in found_functions}}cdef void *__cuGraphExecMemsetNodeSetParams = NULL{{endif}} -{{if 'cuGraphExecHostNodeSetParams' in found_functions}}cdef void *__cuGraphExecHostNodeSetParams = NULL{{endif}} -{{if 'cuGraphExecChildGraphNodeSetParams' in found_functions}}cdef void *__cuGraphExecChildGraphNodeSetParams = NULL{{endif}} -{{if 'cuGraphExecEventRecordNodeSetEvent' in found_functions}}cdef void *__cuGraphExecEventRecordNodeSetEvent = NULL{{endif}} -{{if 'cuGraphExecEventWaitNodeSetEvent' in found_functions}}cdef void *__cuGraphExecEventWaitNodeSetEvent = NULL{{endif}} -{{if 'cuGraphExecExternalSemaphoresSignalNodeSetParams' in found_functions}}cdef void *__cuGraphExecExternalSemaphoresSignalNodeSetParams = NULL{{endif}} -{{if 'cuGraphExecExternalSemaphoresWaitNodeSetParams' in found_functions}}cdef void *__cuGraphExecExternalSemaphoresWaitNodeSetParams = NULL{{endif}} -{{if 'cuGraphNodeSetEnabled' in found_functions}}cdef void *__cuGraphNodeSetEnabled = NULL{{endif}} -{{if 'cuGraphNodeGetEnabled' in found_functions}}cdef void *__cuGraphNodeGetEnabled = NULL{{endif}} -{{if 'cuGraphUpload' in found_functions}}cdef void *__cuGraphUpload = NULL{{endif}} -{{if 'cuGraphLaunch' in found_functions}}cdef void *__cuGraphLaunch = NULL{{endif}} -{{if 'cuGraphExecDestroy' in found_functions}}cdef void *__cuGraphExecDestroy = NULL{{endif}} -{{if 'cuGraphDestroy' in found_functions}}cdef void *__cuGraphDestroy = NULL{{endif}} -{{if 'cuGraphExecUpdate_v2' in found_functions}}cdef void *__cuGraphExecUpdate_v2 = NULL{{endif}} -{{if 'cuGraphKernelNodeCopyAttributes' in found_functions}}cdef void *__cuGraphKernelNodeCopyAttributes = NULL{{endif}} -{{if 'cuGraphKernelNodeGetAttribute' in found_functions}}cdef void *__cuGraphKernelNodeGetAttribute = NULL{{endif}} -{{if 'cuGraphKernelNodeSetAttribute' in found_functions}}cdef void *__cuGraphKernelNodeSetAttribute = NULL{{endif}} -{{if 'cuGraphDebugDotPrint' in found_functions}}cdef void *__cuGraphDebugDotPrint = NULL{{endif}} -{{if 'cuUserObjectCreate' in found_functions}}cdef void *__cuUserObjectCreate = NULL{{endif}} -{{if 'cuUserObjectRetain' in found_functions}}cdef void *__cuUserObjectRetain = NULL{{endif}} -{{if 'cuUserObjectRelease' in found_functions}}cdef void *__cuUserObjectRelease = NULL{{endif}} -{{if 'cuGraphRetainUserObject' in found_functions}}cdef void *__cuGraphRetainUserObject = NULL{{endif}} -{{if 'cuGraphReleaseUserObject' in found_functions}}cdef void *__cuGraphReleaseUserObject = NULL{{endif}} -{{if 'cuGraphAddNode' in found_functions}}cdef void *__cuGraphAddNode = NULL{{endif}} -{{if 'cuGraphAddNode_v2' in found_functions}}cdef void *__cuGraphAddNode_v2 = NULL{{endif}} -{{if 'cuGraphNodeSetParams' in found_functions}}cdef void *__cuGraphNodeSetParams = NULL{{endif}} -{{if 'cuGraphExecNodeSetParams' in found_functions}}cdef void *__cuGraphExecNodeSetParams = NULL{{endif}} -{{if 'cuGraphConditionalHandleCreate' in found_functions}}cdef void *__cuGraphConditionalHandleCreate = NULL{{endif}} -{{if 'cuOccupancyMaxActiveBlocksPerMultiprocessor' in found_functions}}cdef void *__cuOccupancyMaxActiveBlocksPerMultiprocessor = NULL{{endif}} -{{if 'cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags' in found_functions}}cdef void *__cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags = NULL{{endif}} -{{if 'cuOccupancyMaxPotentialBlockSize' in found_functions}}cdef void *__cuOccupancyMaxPotentialBlockSize = NULL{{endif}} -{{if 'cuOccupancyMaxPotentialBlockSizeWithFlags' in found_functions}}cdef void *__cuOccupancyMaxPotentialBlockSizeWithFlags = NULL{{endif}} -{{if 'cuOccupancyAvailableDynamicSMemPerBlock' in found_functions}}cdef void *__cuOccupancyAvailableDynamicSMemPerBlock = NULL{{endif}} -{{if 'cuOccupancyMaxPotentialClusterSize' in found_functions}}cdef void *__cuOccupancyMaxPotentialClusterSize = NULL{{endif}} -{{if 'cuOccupancyMaxActiveClusters' in found_functions}}cdef void *__cuOccupancyMaxActiveClusters = NULL{{endif}} -{{if 'cuTexRefSetArray' in found_functions}}cdef void *__cuTexRefSetArray = NULL{{endif}} -{{if 'cuTexRefSetMipmappedArray' in found_functions}}cdef void *__cuTexRefSetMipmappedArray = NULL{{endif}} -{{if 'cuTexRefSetAddress_v2' in found_functions}}cdef void *__cuTexRefSetAddress_v2 = NULL{{endif}} -{{if 'cuTexRefSetAddress2D_v3' in found_functions}}cdef void *__cuTexRefSetAddress2D_v3 = NULL{{endif}} -{{if 'cuTexRefSetFormat' in found_functions}}cdef void *__cuTexRefSetFormat = NULL{{endif}} -{{if 'cuTexRefSetAddressMode' in found_functions}}cdef void *__cuTexRefSetAddressMode = NULL{{endif}} -{{if 'cuTexRefSetFilterMode' in found_functions}}cdef void *__cuTexRefSetFilterMode = NULL{{endif}} -{{if 'cuTexRefSetMipmapFilterMode' in found_functions}}cdef void *__cuTexRefSetMipmapFilterMode = NULL{{endif}} -{{if 'cuTexRefSetMipmapLevelBias' in found_functions}}cdef void *__cuTexRefSetMipmapLevelBias = NULL{{endif}} -{{if 'cuTexRefSetMipmapLevelClamp' in found_functions}}cdef void *__cuTexRefSetMipmapLevelClamp = NULL{{endif}} -{{if 'cuTexRefSetMaxAnisotropy' in found_functions}}cdef void *__cuTexRefSetMaxAnisotropy = NULL{{endif}} -{{if 'cuTexRefSetBorderColor' in found_functions}}cdef void *__cuTexRefSetBorderColor = NULL{{endif}} -{{if 'cuTexRefSetFlags' in found_functions}}cdef void *__cuTexRefSetFlags = NULL{{endif}} -{{if 'cuTexRefGetAddress_v2' in found_functions}}cdef void *__cuTexRefGetAddress_v2 = NULL{{endif}} -{{if 'cuTexRefGetArray' in found_functions}}cdef void *__cuTexRefGetArray = NULL{{endif}} -{{if 'cuTexRefGetMipmappedArray' in found_functions}}cdef void *__cuTexRefGetMipmappedArray = NULL{{endif}} -{{if 'cuTexRefGetAddressMode' in found_functions}}cdef void *__cuTexRefGetAddressMode = NULL{{endif}} -{{if 'cuTexRefGetFilterMode' in found_functions}}cdef void *__cuTexRefGetFilterMode = NULL{{endif}} -{{if 'cuTexRefGetFormat' in found_functions}}cdef void *__cuTexRefGetFormat = NULL{{endif}} -{{if 'cuTexRefGetMipmapFilterMode' in found_functions}}cdef void *__cuTexRefGetMipmapFilterMode = NULL{{endif}} -{{if 'cuTexRefGetMipmapLevelBias' in found_functions}}cdef void *__cuTexRefGetMipmapLevelBias = NULL{{endif}} -{{if 'cuTexRefGetMipmapLevelClamp' in found_functions}}cdef void *__cuTexRefGetMipmapLevelClamp = NULL{{endif}} -{{if 'cuTexRefGetMaxAnisotropy' in found_functions}}cdef void *__cuTexRefGetMaxAnisotropy = NULL{{endif}} -{{if 'cuTexRefGetBorderColor' in found_functions}}cdef void *__cuTexRefGetBorderColor = NULL{{endif}} -{{if 'cuTexRefGetFlags' in found_functions}}cdef void *__cuTexRefGetFlags = NULL{{endif}} -{{if 'cuTexRefCreate' in found_functions}}cdef void *__cuTexRefCreate = NULL{{endif}} -{{if 'cuTexRefDestroy' in found_functions}}cdef void *__cuTexRefDestroy = NULL{{endif}} -{{if 'cuSurfRefSetArray' in found_functions}}cdef void *__cuSurfRefSetArray = NULL{{endif}} -{{if 'cuSurfRefGetArray' in found_functions}}cdef void *__cuSurfRefGetArray = NULL{{endif}} -{{if 'cuTexObjectCreate' in found_functions}}cdef void *__cuTexObjectCreate = NULL{{endif}} -{{if 'cuTexObjectDestroy' in found_functions}}cdef void *__cuTexObjectDestroy = NULL{{endif}} -{{if 'cuTexObjectGetResourceDesc' in found_functions}}cdef void *__cuTexObjectGetResourceDesc = NULL{{endif}} -{{if 'cuTexObjectGetTextureDesc' in found_functions}}cdef void *__cuTexObjectGetTextureDesc = NULL{{endif}} -{{if 'cuTexObjectGetResourceViewDesc' in found_functions}}cdef void *__cuTexObjectGetResourceViewDesc = NULL{{endif}} -{{if 'cuSurfObjectCreate' in found_functions}}cdef void *__cuSurfObjectCreate = NULL{{endif}} -{{if 'cuSurfObjectDestroy' in found_functions}}cdef void *__cuSurfObjectDestroy = NULL{{endif}} -{{if 'cuSurfObjectGetResourceDesc' in found_functions}}cdef void *__cuSurfObjectGetResourceDesc = NULL{{endif}} -{{if 'cuTensorMapEncodeTiled' in found_functions}}cdef void *__cuTensorMapEncodeTiled = NULL{{endif}} -{{if 'cuTensorMapEncodeIm2col' in found_functions}}cdef void *__cuTensorMapEncodeIm2col = NULL{{endif}} -{{if 'cuTensorMapReplaceAddress' in found_functions}}cdef void *__cuTensorMapReplaceAddress = NULL{{endif}} -{{if 'cuDeviceCanAccessPeer' in found_functions}}cdef void *__cuDeviceCanAccessPeer = NULL{{endif}} -{{if 'cuCtxEnablePeerAccess' in found_functions}}cdef void *__cuCtxEnablePeerAccess = NULL{{endif}} -{{if 'cuCtxDisablePeerAccess' in found_functions}}cdef void *__cuCtxDisablePeerAccess = NULL{{endif}} -{{if 'cuDeviceGetP2PAttribute' in found_functions}}cdef void *__cuDeviceGetP2PAttribute = NULL{{endif}} -{{if 'cuGraphicsUnregisterResource' in found_functions}}cdef void *__cuGraphicsUnregisterResource = NULL{{endif}} -{{if 'cuGraphicsSubResourceGetMappedArray' in found_functions}}cdef void *__cuGraphicsSubResourceGetMappedArray = NULL{{endif}} -{{if 'cuGraphicsResourceGetMappedMipmappedArray' in found_functions}}cdef void *__cuGraphicsResourceGetMappedMipmappedArray = NULL{{endif}} -{{if 'cuGraphicsResourceGetMappedPointer_v2' in found_functions}}cdef void *__cuGraphicsResourceGetMappedPointer_v2 = NULL{{endif}} -{{if 'cuGraphicsResourceSetMapFlags_v2' in found_functions}}cdef void *__cuGraphicsResourceSetMapFlags_v2 = NULL{{endif}} -{{if 'cuGraphicsMapResources' in found_functions}}cdef void *__cuGraphicsMapResources = NULL{{endif}} -{{if 'cuGraphicsUnmapResources' in found_functions}}cdef void *__cuGraphicsUnmapResources = NULL{{endif}} -{{if 'cuGetProcAddress_v2' in found_functions}}cdef void *__cuGetProcAddress_v2 = NULL{{endif}} -{{if 'cuCoredumpGetAttribute' in found_functions}}cdef void *__cuCoredumpGetAttribute = NULL{{endif}} -{{if 'cuCoredumpGetAttributeGlobal' in found_functions}}cdef void *__cuCoredumpGetAttributeGlobal = NULL{{endif}} -{{if 'cuCoredumpSetAttribute' in found_functions}}cdef void *__cuCoredumpSetAttribute = NULL{{endif}} -{{if 'cuCoredumpSetAttributeGlobal' in found_functions}}cdef void *__cuCoredumpSetAttributeGlobal = NULL{{endif}} -{{if 'cuGetExportTable' in found_functions}}cdef void *__cuGetExportTable = NULL{{endif}} -{{if 'cuGreenCtxCreate' in found_functions}}cdef void *__cuGreenCtxCreate = NULL{{endif}} -{{if 'cuGreenCtxDestroy' in found_functions}}cdef void *__cuGreenCtxDestroy = NULL{{endif}} -{{if 'cuCtxFromGreenCtx' in found_functions}}cdef void *__cuCtxFromGreenCtx = NULL{{endif}} -{{if 'cuDeviceGetDevResource' in found_functions}}cdef void *__cuDeviceGetDevResource = NULL{{endif}} -{{if 'cuCtxGetDevResource' in found_functions}}cdef void *__cuCtxGetDevResource = NULL{{endif}} -{{if 'cuGreenCtxGetDevResource' in found_functions}}cdef void *__cuGreenCtxGetDevResource = NULL{{endif}} -{{if 'cuDevSmResourceSplitByCount' in found_functions}}cdef void *__cuDevSmResourceSplitByCount = NULL{{endif}} -{{if 'cuDevResourceGenerateDesc' in found_functions}}cdef void *__cuDevResourceGenerateDesc = NULL{{endif}} -{{if 'cuGreenCtxRecordEvent' in found_functions}}cdef void *__cuGreenCtxRecordEvent = NULL{{endif}} -{{if 'cuGreenCtxWaitEvent' in found_functions}}cdef void *__cuGreenCtxWaitEvent = NULL{{endif}} -{{if 'cuStreamGetGreenCtx' in found_functions}}cdef void *__cuStreamGetGreenCtx = NULL{{endif}} -{{if 'cuGreenCtxStreamCreate' in found_functions}}cdef void *__cuGreenCtxStreamCreate = NULL{{endif}} -{{if 'cuProfilerStart' in found_functions}}cdef void *__cuProfilerStart = NULL{{endif}} -{{if 'cuProfilerStop' in found_functions}}cdef void *__cuProfilerStop = NULL{{endif}} -{{if True}}cdef void *__cuGraphicsEGLRegisterImage = NULL{{endif}} -{{if True}}cdef void *__cuEGLStreamConsumerConnect = NULL{{endif}} -{{if True}}cdef void *__cuEGLStreamConsumerConnectWithFlags = NULL{{endif}} -{{if True}}cdef void *__cuEGLStreamConsumerDisconnect = NULL{{endif}} -{{if True}}cdef void *__cuEGLStreamConsumerAcquireFrame = NULL{{endif}} -{{if True}}cdef void *__cuEGLStreamConsumerReleaseFrame = NULL{{endif}} -{{if True}}cdef void *__cuEGLStreamProducerConnect = NULL{{endif}} -{{if True}}cdef void *__cuEGLStreamProducerDisconnect = NULL{{endif}} -{{if True}}cdef void *__cuEGLStreamProducerPresentFrame = NULL{{endif}} -{{if True}}cdef void *__cuEGLStreamProducerReturnFrame = NULL{{endif}} -{{if True}}cdef void *__cuGraphicsResourceGetMappedEglFrame = NULL{{endif}} -{{if True}}cdef void *__cuEventCreateFromEGLSync = NULL{{endif}} -{{if True}}cdef void *__cuGraphicsGLRegisterBuffer = NULL{{endif}} -{{if True}}cdef void *__cuGraphicsGLRegisterImage = NULL{{endif}} -{{if True}}cdef void *__cuGLGetDevices_v2 = NULL{{endif}} -{{if True}}cdef void *__cuVDPAUGetDevice = NULL{{endif}} -{{if True}}cdef void *__cuVDPAUCtxCreate_v2 = NULL{{endif}} -{{if True}}cdef void *__cuGraphicsVDPAURegisterVideoSurface = NULL{{endif}} -{{if True}}cdef void *__cuGraphicsVDPAURegisterOutputSurface = NULL{{endif}} - -cdef int cuPythonInit() except -1 nogil: - global __cuPythonInit - cdef bint usePTDS - if __cuPythonInit: - return 0 - __cuPythonInit = True - with gil: - usePTDS = os.getenv('CUDA_PYTHON_CUDA_PER_THREAD_DEFAULT_STREAM', default=0) - - # Load library - cdef char libPath[260] - libPath[0] = 0 - with gil: - status = loader.getCUDALibraryPath(libPath, sys.maxsize > 2**32) - if status == 0 and len(libPath) != 0: - path = libPath.decode('utf-8') - else: - {{if 'Windows' == platform.system()}} - path = 'nvcuda.dll' - {{else}} - path = 'libcuda.so.1' - {{endif}} - - {{if 'Windows' == platform.system()}} - LOAD_LIBRARY_SEARCH_SYSTEM32 = 0x00000800 - try: - handle = win32api.LoadLibraryEx(path, 0, LOAD_LIBRARY_SEARCH_SYSTEM32) - except error as e: - raise RuntimeError('Failed to LoadLibraryEx ' + path) - {{else}} - handle = dlfcn.dlopen(bytes(path, encoding='utf-8'), dlfcn.RTLD_NOW) - if (handle == NULL): - raise RuntimeError('Failed to dlopen ' + path) - {{endif}} - - # Get latest __cuGetProcAddress_v2 - {{if 'Windows' == platform.system()}} - with gil: - try: - global __cuGetProcAddress_v2 - __cuGetProcAddress_v2 = win32api.GetProcAddress(handle, 'cuGetProcAddress_v2') - except: - pass - {{else}} - global __cuGetProcAddress_v2 - __cuGetProcAddress_v2 = dlfcn.dlsym(handle, 'cuGetProcAddress_v2') - {{endif}} - - # Load using cuGetProcAddress if available - if __cuGetProcAddress_v2 != NULL: - if usePTDS: - # Get all PTDS version of functions - pass - {{if 'cuMemcpy' in found_functions}} - global __cuMemcpy - cuGetProcAddress('cuMemcpy', &__cuMemcpy, 7000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuMemcpyPeer' in found_functions}} - global __cuMemcpyPeer - cuGetProcAddress('cuMemcpyPeer', &__cuMemcpyPeer, 7000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuMemcpyHtoD_v2' in found_functions}} - global __cuMemcpyHtoD_v2 - cuGetProcAddress('cuMemcpyHtoD', &__cuMemcpyHtoD_v2, 7000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuMemcpyDtoH_v2' in found_functions}} - global __cuMemcpyDtoH_v2 - cuGetProcAddress('cuMemcpyDtoH', &__cuMemcpyDtoH_v2, 7000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuMemcpyDtoD_v2' in found_functions}} - global __cuMemcpyDtoD_v2 - cuGetProcAddress('cuMemcpyDtoD', &__cuMemcpyDtoD_v2, 7000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuMemcpyDtoA_v2' in found_functions}} - global __cuMemcpyDtoA_v2 - cuGetProcAddress('cuMemcpyDtoA', &__cuMemcpyDtoA_v2, 7000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuMemcpyAtoD_v2' in found_functions}} - global __cuMemcpyAtoD_v2 - cuGetProcAddress('cuMemcpyAtoD', &__cuMemcpyAtoD_v2, 7000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuMemcpyHtoA_v2' in found_functions}} - global __cuMemcpyHtoA_v2 - cuGetProcAddress('cuMemcpyHtoA', &__cuMemcpyHtoA_v2, 7000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuMemcpyAtoH_v2' in found_functions}} - global __cuMemcpyAtoH_v2 - cuGetProcAddress('cuMemcpyAtoH', &__cuMemcpyAtoH_v2, 7000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuMemcpyAtoA_v2' in found_functions}} - global __cuMemcpyAtoA_v2 - cuGetProcAddress('cuMemcpyAtoA', &__cuMemcpyAtoA_v2, 7000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuMemcpy2D_v2' in found_functions}} - global __cuMemcpy2D_v2 - cuGetProcAddress('cuMemcpy2D', &__cuMemcpy2D_v2, 7000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuMemcpy2DUnaligned_v2' in found_functions}} - global __cuMemcpy2DUnaligned_v2 - cuGetProcAddress('cuMemcpy2DUnaligned', &__cuMemcpy2DUnaligned_v2, 7000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuMemcpy3D_v2' in found_functions}} - global __cuMemcpy3D_v2 - cuGetProcAddress('cuMemcpy3D', &__cuMemcpy3D_v2, 7000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuMemcpy3DPeer' in found_functions}} - global __cuMemcpy3DPeer - cuGetProcAddress('cuMemcpy3DPeer', &__cuMemcpy3DPeer, 7000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuMemcpyAsync' in found_functions}} - global __cuMemcpyAsync - cuGetProcAddress('cuMemcpyAsync', &__cuMemcpyAsync, 7000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuMemcpyPeerAsync' in found_functions}} - global __cuMemcpyPeerAsync - cuGetProcAddress('cuMemcpyPeerAsync', &__cuMemcpyPeerAsync, 7000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuMemcpyHtoDAsync_v2' in found_functions}} - global __cuMemcpyHtoDAsync_v2 - cuGetProcAddress('cuMemcpyHtoDAsync', &__cuMemcpyHtoDAsync_v2, 7000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuMemcpyDtoHAsync_v2' in found_functions}} - global __cuMemcpyDtoHAsync_v2 - cuGetProcAddress('cuMemcpyDtoHAsync', &__cuMemcpyDtoHAsync_v2, 7000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuMemcpyDtoDAsync_v2' in found_functions}} - global __cuMemcpyDtoDAsync_v2 - cuGetProcAddress('cuMemcpyDtoDAsync', &__cuMemcpyDtoDAsync_v2, 7000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuMemcpyHtoAAsync_v2' in found_functions}} - global __cuMemcpyHtoAAsync_v2 - cuGetProcAddress('cuMemcpyHtoAAsync', &__cuMemcpyHtoAAsync_v2, 7000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuMemcpyAtoHAsync_v2' in found_functions}} - global __cuMemcpyAtoHAsync_v2 - cuGetProcAddress('cuMemcpyAtoHAsync', &__cuMemcpyAtoHAsync_v2, 7000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuMemcpy2DAsync_v2' in found_functions}} - global __cuMemcpy2DAsync_v2 - cuGetProcAddress('cuMemcpy2DAsync', &__cuMemcpy2DAsync_v2, 7000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuMemcpy3DAsync_v2' in found_functions}} - global __cuMemcpy3DAsync_v2 - cuGetProcAddress('cuMemcpy3DAsync', &__cuMemcpy3DAsync_v2, 7000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuMemcpy3DPeerAsync' in found_functions}} - global __cuMemcpy3DPeerAsync - cuGetProcAddress('cuMemcpy3DPeerAsync', &__cuMemcpy3DPeerAsync, 7000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuMemsetD8_v2' in found_functions}} - global __cuMemsetD8_v2 - cuGetProcAddress('cuMemsetD8', &__cuMemsetD8_v2, 7000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuMemsetD16_v2' in found_functions}} - global __cuMemsetD16_v2 - cuGetProcAddress('cuMemsetD16', &__cuMemsetD16_v2, 7000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuMemsetD32_v2' in found_functions}} - global __cuMemsetD32_v2 - cuGetProcAddress('cuMemsetD32', &__cuMemsetD32_v2, 7000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuMemsetD2D8_v2' in found_functions}} - global __cuMemsetD2D8_v2 - cuGetProcAddress('cuMemsetD2D8', &__cuMemsetD2D8_v2, 7000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuMemsetD2D16_v2' in found_functions}} - global __cuMemsetD2D16_v2 - cuGetProcAddress('cuMemsetD2D16', &__cuMemsetD2D16_v2, 7000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuMemsetD2D32_v2' in found_functions}} - global __cuMemsetD2D32_v2 - cuGetProcAddress('cuMemsetD2D32', &__cuMemsetD2D32_v2, 7000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuMemsetD8Async' in found_functions}} - global __cuMemsetD8Async - cuGetProcAddress('cuMemsetD8Async', &__cuMemsetD8Async, 7000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuMemsetD16Async' in found_functions}} - global __cuMemsetD16Async - cuGetProcAddress('cuMemsetD16Async', &__cuMemsetD16Async, 7000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuMemsetD32Async' in found_functions}} - global __cuMemsetD32Async - cuGetProcAddress('cuMemsetD32Async', &__cuMemsetD32Async, 7000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuMemsetD2D8Async' in found_functions}} - global __cuMemsetD2D8Async - cuGetProcAddress('cuMemsetD2D8Async', &__cuMemsetD2D8Async, 7000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuMemsetD2D16Async' in found_functions}} - global __cuMemsetD2D16Async - cuGetProcAddress('cuMemsetD2D16Async', &__cuMemsetD2D16Async, 7000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuMemsetD2D32Async' in found_functions}} - global __cuMemsetD2D32Async - cuGetProcAddress('cuMemsetD2D32Async', &__cuMemsetD2D32Async, 7000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuMemMapArrayAsync' in found_functions}} - global __cuMemMapArrayAsync - cuGetProcAddress('cuMemMapArrayAsync', &__cuMemMapArrayAsync, 11010, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuMemFreeAsync' in found_functions}} - global __cuMemFreeAsync - cuGetProcAddress('cuMemFreeAsync', &__cuMemFreeAsync, 11020, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuMemAllocAsync' in found_functions}} - global __cuMemAllocAsync - cuGetProcAddress('cuMemAllocAsync', &__cuMemAllocAsync, 11020, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuMemAllocFromPoolAsync' in found_functions}} - global __cuMemAllocFromPoolAsync - cuGetProcAddress('cuMemAllocFromPoolAsync', &__cuMemAllocFromPoolAsync, 11020, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuMemPrefetchAsync' in found_functions}} - global __cuMemPrefetchAsync - cuGetProcAddress('cuMemPrefetchAsync', &__cuMemPrefetchAsync, 8000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuMemPrefetchAsync_v2' in found_functions}} - global __cuMemPrefetchAsync_v2 - cuGetProcAddress('cuMemPrefetchAsync', &__cuMemPrefetchAsync_v2, 12020, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuStreamGetPriority' in found_functions}} - global __cuStreamGetPriority - cuGetProcAddress('cuStreamGetPriority', &__cuStreamGetPriority, 7000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuStreamGetFlags' in found_functions}} - global __cuStreamGetFlags - cuGetProcAddress('cuStreamGetFlags', &__cuStreamGetFlags, 7000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuStreamGetId' in found_functions}} - global __cuStreamGetId - cuGetProcAddress('cuStreamGetId', &__cuStreamGetId, 12000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuStreamGetCtx' in found_functions}} - global __cuStreamGetCtx - cuGetProcAddress('cuStreamGetCtx', &__cuStreamGetCtx, 9020, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuStreamGetCtx_v2' in found_functions}} - global __cuStreamGetCtx_v2 - cuGetProcAddress('cuStreamGetCtx', &__cuStreamGetCtx_v2, 12050, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuStreamWaitEvent' in found_functions}} - global __cuStreamWaitEvent - cuGetProcAddress('cuStreamWaitEvent', &__cuStreamWaitEvent, 7000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuStreamAddCallback' in found_functions}} - global __cuStreamAddCallback - cuGetProcAddress('cuStreamAddCallback', &__cuStreamAddCallback, 7000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuStreamBeginCapture_v2' in found_functions}} - global __cuStreamBeginCapture_v2 - cuGetProcAddress('cuStreamBeginCapture', &__cuStreamBeginCapture_v2, 10010, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuStreamBeginCaptureToGraph' in found_functions}} - global __cuStreamBeginCaptureToGraph - cuGetProcAddress('cuStreamBeginCaptureToGraph', &__cuStreamBeginCaptureToGraph, 12030, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuStreamEndCapture' in found_functions}} - global __cuStreamEndCapture - cuGetProcAddress('cuStreamEndCapture', &__cuStreamEndCapture, 10000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuStreamIsCapturing' in found_functions}} - global __cuStreamIsCapturing - cuGetProcAddress('cuStreamIsCapturing', &__cuStreamIsCapturing, 10000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuStreamGetCaptureInfo_v2' in found_functions}} - global __cuStreamGetCaptureInfo_v2 - cuGetProcAddress('cuStreamGetCaptureInfo', &__cuStreamGetCaptureInfo_v2, 11030, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuStreamGetCaptureInfo_v3' in found_functions}} - global __cuStreamGetCaptureInfo_v3 - cuGetProcAddress('cuStreamGetCaptureInfo', &__cuStreamGetCaptureInfo_v3, 12030, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuStreamUpdateCaptureDependencies' in found_functions}} - global __cuStreamUpdateCaptureDependencies - cuGetProcAddress('cuStreamUpdateCaptureDependencies', &__cuStreamUpdateCaptureDependencies, 11030, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuStreamUpdateCaptureDependencies_v2' in found_functions}} - global __cuStreamUpdateCaptureDependencies_v2 - cuGetProcAddress('cuStreamUpdateCaptureDependencies', &__cuStreamUpdateCaptureDependencies_v2, 12030, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuStreamAttachMemAsync' in found_functions}} - global __cuStreamAttachMemAsync - cuGetProcAddress('cuStreamAttachMemAsync', &__cuStreamAttachMemAsync, 7000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuStreamQuery' in found_functions}} - global __cuStreamQuery - cuGetProcAddress('cuStreamQuery', &__cuStreamQuery, 7000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuStreamSynchronize' in found_functions}} - global __cuStreamSynchronize - cuGetProcAddress('cuStreamSynchronize', &__cuStreamSynchronize, 7000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuStreamCopyAttributes' in found_functions}} - global __cuStreamCopyAttributes - cuGetProcAddress('cuStreamCopyAttributes', &__cuStreamCopyAttributes, 11000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuStreamGetAttribute' in found_functions}} - global __cuStreamGetAttribute - cuGetProcAddress('cuStreamGetAttribute', &__cuStreamGetAttribute, 11000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuStreamSetAttribute' in found_functions}} - global __cuStreamSetAttribute - cuGetProcAddress('cuStreamSetAttribute', &__cuStreamSetAttribute, 11000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuEventRecord' in found_functions}} - global __cuEventRecord - cuGetProcAddress('cuEventRecord', &__cuEventRecord, 7000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuEventRecordWithFlags' in found_functions}} - global __cuEventRecordWithFlags - cuGetProcAddress('cuEventRecordWithFlags', &__cuEventRecordWithFlags, 11010, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuSignalExternalSemaphoresAsync' in found_functions}} - global __cuSignalExternalSemaphoresAsync - cuGetProcAddress('cuSignalExternalSemaphoresAsync', &__cuSignalExternalSemaphoresAsync, 10000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuWaitExternalSemaphoresAsync' in found_functions}} - global __cuWaitExternalSemaphoresAsync - cuGetProcAddress('cuWaitExternalSemaphoresAsync', &__cuWaitExternalSemaphoresAsync, 10000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuStreamWaitValue32_v2' in found_functions}} - global __cuStreamWaitValue32_v2 - cuGetProcAddress('cuStreamWaitValue32', &__cuStreamWaitValue32_v2, 11070, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuStreamWaitValue64_v2' in found_functions}} - global __cuStreamWaitValue64_v2 - cuGetProcAddress('cuStreamWaitValue64', &__cuStreamWaitValue64_v2, 11070, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuStreamWriteValue32_v2' in found_functions}} - global __cuStreamWriteValue32_v2 - cuGetProcAddress('cuStreamWriteValue32', &__cuStreamWriteValue32_v2, 11070, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuStreamWriteValue64_v2' in found_functions}} - global __cuStreamWriteValue64_v2 - cuGetProcAddress('cuStreamWriteValue64', &__cuStreamWriteValue64_v2, 11070, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuStreamBatchMemOp_v2' in found_functions}} - global __cuStreamBatchMemOp_v2 - cuGetProcAddress('cuStreamBatchMemOp', &__cuStreamBatchMemOp_v2, 11070, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuLaunchKernel' in found_functions}} - global __cuLaunchKernel - cuGetProcAddress('cuLaunchKernel', &__cuLaunchKernel, 7000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuLaunchKernelEx' in found_functions}} - global __cuLaunchKernelEx - cuGetProcAddress('cuLaunchKernelEx', &__cuLaunchKernelEx, 11060, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuLaunchCooperativeKernel' in found_functions}} - global __cuLaunchCooperativeKernel - cuGetProcAddress('cuLaunchCooperativeKernel', &__cuLaunchCooperativeKernel, 9000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuLaunchHostFunc' in found_functions}} - global __cuLaunchHostFunc - cuGetProcAddress('cuLaunchHostFunc', &__cuLaunchHostFunc, 10000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuGraphInstantiateWithParams' in found_functions}} - global __cuGraphInstantiateWithParams - cuGetProcAddress('cuGraphInstantiateWithParams', &__cuGraphInstantiateWithParams, 12000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuGraphUpload' in found_functions}} - global __cuGraphUpload - cuGetProcAddress('cuGraphUpload', &__cuGraphUpload, 11010, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuGraphLaunch' in found_functions}} - global __cuGraphLaunch - cuGetProcAddress('cuGraphLaunch', &__cuGraphLaunch, 10000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuGraphicsMapResources' in found_functions}} - global __cuGraphicsMapResources - cuGetProcAddress('cuGraphicsMapResources', &__cuGraphicsMapResources, 7000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - {{if 'cuGraphicsUnmapResources' in found_functions}} - global __cuGraphicsUnmapResources - cuGetProcAddress('cuGraphicsUnmapResources', &__cuGraphicsUnmapResources, 7000, CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, NULL) - {{endif}} - else: - # Else get the regular version - pass - {{if 'cuMemcpy' in found_functions}} - global __cuMemcpy - cuGetProcAddress('cuMemcpy', &__cuMemcpy, 4000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemcpyPeer' in found_functions}} - global __cuMemcpyPeer - cuGetProcAddress('cuMemcpyPeer', &__cuMemcpyPeer, 4000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemcpyHtoD_v2' in found_functions}} - global __cuMemcpyHtoD_v2 - cuGetProcAddress('cuMemcpyHtoD', &__cuMemcpyHtoD_v2, 3020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemcpyDtoH_v2' in found_functions}} - global __cuMemcpyDtoH_v2 - cuGetProcAddress('cuMemcpyDtoH', &__cuMemcpyDtoH_v2, 3020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemcpyDtoD_v2' in found_functions}} - global __cuMemcpyDtoD_v2 - cuGetProcAddress('cuMemcpyDtoD', &__cuMemcpyDtoD_v2, 3020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemcpyDtoA_v2' in found_functions}} - global __cuMemcpyDtoA_v2 - cuGetProcAddress('cuMemcpyDtoA', &__cuMemcpyDtoA_v2, 3020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemcpyAtoD_v2' in found_functions}} - global __cuMemcpyAtoD_v2 - cuGetProcAddress('cuMemcpyAtoD', &__cuMemcpyAtoD_v2, 3020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemcpyHtoA_v2' in found_functions}} - global __cuMemcpyHtoA_v2 - cuGetProcAddress('cuMemcpyHtoA', &__cuMemcpyHtoA_v2, 3020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemcpyAtoH_v2' in found_functions}} - global __cuMemcpyAtoH_v2 - cuGetProcAddress('cuMemcpyAtoH', &__cuMemcpyAtoH_v2, 3020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemcpyAtoA_v2' in found_functions}} - global __cuMemcpyAtoA_v2 - cuGetProcAddress('cuMemcpyAtoA', &__cuMemcpyAtoA_v2, 3020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemcpy2D_v2' in found_functions}} - global __cuMemcpy2D_v2 - cuGetProcAddress('cuMemcpy2D', &__cuMemcpy2D_v2, 3020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemcpy2DUnaligned_v2' in found_functions}} - global __cuMemcpy2DUnaligned_v2 - cuGetProcAddress('cuMemcpy2DUnaligned', &__cuMemcpy2DUnaligned_v2, 3020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemcpy3D_v2' in found_functions}} - global __cuMemcpy3D_v2 - cuGetProcAddress('cuMemcpy3D', &__cuMemcpy3D_v2, 3020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemcpy3DPeer' in found_functions}} - global __cuMemcpy3DPeer - cuGetProcAddress('cuMemcpy3DPeer', &__cuMemcpy3DPeer, 4000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemcpyAsync' in found_functions}} - global __cuMemcpyAsync - cuGetProcAddress('cuMemcpyAsync', &__cuMemcpyAsync, 4000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemcpyPeerAsync' in found_functions}} - global __cuMemcpyPeerAsync - cuGetProcAddress('cuMemcpyPeerAsync', &__cuMemcpyPeerAsync, 4000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemcpyHtoDAsync_v2' in found_functions}} - global __cuMemcpyHtoDAsync_v2 - cuGetProcAddress('cuMemcpyHtoDAsync', &__cuMemcpyHtoDAsync_v2, 3020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemcpyDtoHAsync_v2' in found_functions}} - global __cuMemcpyDtoHAsync_v2 - cuGetProcAddress('cuMemcpyDtoHAsync', &__cuMemcpyDtoHAsync_v2, 3020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemcpyDtoDAsync_v2' in found_functions}} - global __cuMemcpyDtoDAsync_v2 - cuGetProcAddress('cuMemcpyDtoDAsync', &__cuMemcpyDtoDAsync_v2, 3020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemcpyHtoAAsync_v2' in found_functions}} - global __cuMemcpyHtoAAsync_v2 - cuGetProcAddress('cuMemcpyHtoAAsync', &__cuMemcpyHtoAAsync_v2, 3020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemcpyAtoHAsync_v2' in found_functions}} - global __cuMemcpyAtoHAsync_v2 - cuGetProcAddress('cuMemcpyAtoHAsync', &__cuMemcpyAtoHAsync_v2, 3020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemcpy2DAsync_v2' in found_functions}} - global __cuMemcpy2DAsync_v2 - cuGetProcAddress('cuMemcpy2DAsync', &__cuMemcpy2DAsync_v2, 3020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemcpy3DAsync_v2' in found_functions}} - global __cuMemcpy3DAsync_v2 - cuGetProcAddress('cuMemcpy3DAsync', &__cuMemcpy3DAsync_v2, 3020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemcpy3DPeerAsync' in found_functions}} - global __cuMemcpy3DPeerAsync - cuGetProcAddress('cuMemcpy3DPeerAsync', &__cuMemcpy3DPeerAsync, 4000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemsetD8_v2' in found_functions}} - global __cuMemsetD8_v2 - cuGetProcAddress('cuMemsetD8', &__cuMemsetD8_v2, 3020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemsetD16_v2' in found_functions}} - global __cuMemsetD16_v2 - cuGetProcAddress('cuMemsetD16', &__cuMemsetD16_v2, 3020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemsetD32_v2' in found_functions}} - global __cuMemsetD32_v2 - cuGetProcAddress('cuMemsetD32', &__cuMemsetD32_v2, 3020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemsetD2D8_v2' in found_functions}} - global __cuMemsetD2D8_v2 - cuGetProcAddress('cuMemsetD2D8', &__cuMemsetD2D8_v2, 3020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemsetD2D16_v2' in found_functions}} - global __cuMemsetD2D16_v2 - cuGetProcAddress('cuMemsetD2D16', &__cuMemsetD2D16_v2, 3020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemsetD2D32_v2' in found_functions}} - global __cuMemsetD2D32_v2 - cuGetProcAddress('cuMemsetD2D32', &__cuMemsetD2D32_v2, 3020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemsetD8Async' in found_functions}} - global __cuMemsetD8Async - cuGetProcAddress('cuMemsetD8Async', &__cuMemsetD8Async, 3020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemsetD16Async' in found_functions}} - global __cuMemsetD16Async - cuGetProcAddress('cuMemsetD16Async', &__cuMemsetD16Async, 3020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemsetD32Async' in found_functions}} - global __cuMemsetD32Async - cuGetProcAddress('cuMemsetD32Async', &__cuMemsetD32Async, 3020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemsetD2D8Async' in found_functions}} - global __cuMemsetD2D8Async - cuGetProcAddress('cuMemsetD2D8Async', &__cuMemsetD2D8Async, 3020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemsetD2D16Async' in found_functions}} - global __cuMemsetD2D16Async - cuGetProcAddress('cuMemsetD2D16Async', &__cuMemsetD2D16Async, 3020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemsetD2D32Async' in found_functions}} - global __cuMemsetD2D32Async - cuGetProcAddress('cuMemsetD2D32Async', &__cuMemsetD2D32Async, 3020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemMapArrayAsync' in found_functions}} - global __cuMemMapArrayAsync - cuGetProcAddress('cuMemMapArrayAsync', &__cuMemMapArrayAsync, 11010, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemFreeAsync' in found_functions}} - global __cuMemFreeAsync - cuGetProcAddress('cuMemFreeAsync', &__cuMemFreeAsync, 11020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemAllocAsync' in found_functions}} - global __cuMemAllocAsync - cuGetProcAddress('cuMemAllocAsync', &__cuMemAllocAsync, 11020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemAllocFromPoolAsync' in found_functions}} - global __cuMemAllocFromPoolAsync - cuGetProcAddress('cuMemAllocFromPoolAsync', &__cuMemAllocFromPoolAsync, 11020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemPrefetchAsync' in found_functions}} - global __cuMemPrefetchAsync - cuGetProcAddress('cuMemPrefetchAsync', &__cuMemPrefetchAsync, 8000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemPrefetchAsync_v2' in found_functions}} - global __cuMemPrefetchAsync_v2 - cuGetProcAddress('cuMemPrefetchAsync', &__cuMemPrefetchAsync_v2, 12020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuStreamGetPriority' in found_functions}} - global __cuStreamGetPriority - cuGetProcAddress('cuStreamGetPriority', &__cuStreamGetPriority, 5050, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuStreamGetFlags' in found_functions}} - global __cuStreamGetFlags - cuGetProcAddress('cuStreamGetFlags', &__cuStreamGetFlags, 5050, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuStreamGetId' in found_functions}} - global __cuStreamGetId - cuGetProcAddress('cuStreamGetId', &__cuStreamGetId, 12000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuStreamGetCtx' in found_functions}} - global __cuStreamGetCtx - cuGetProcAddress('cuStreamGetCtx', &__cuStreamGetCtx, 9020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuStreamGetCtx_v2' in found_functions}} - global __cuStreamGetCtx_v2 - cuGetProcAddress('cuStreamGetCtx', &__cuStreamGetCtx_v2, 12050, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuStreamWaitEvent' in found_functions}} - global __cuStreamWaitEvent - cuGetProcAddress('cuStreamWaitEvent', &__cuStreamWaitEvent, 3020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuStreamAddCallback' in found_functions}} - global __cuStreamAddCallback - cuGetProcAddress('cuStreamAddCallback', &__cuStreamAddCallback, 5000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuStreamBeginCapture_v2' in found_functions}} - global __cuStreamBeginCapture_v2 - cuGetProcAddress('cuStreamBeginCapture', &__cuStreamBeginCapture_v2, 10010, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuStreamBeginCaptureToGraph' in found_functions}} - global __cuStreamBeginCaptureToGraph - cuGetProcAddress('cuStreamBeginCaptureToGraph', &__cuStreamBeginCaptureToGraph, 12030, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuStreamEndCapture' in found_functions}} - global __cuStreamEndCapture - cuGetProcAddress('cuStreamEndCapture', &__cuStreamEndCapture, 10000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuStreamIsCapturing' in found_functions}} - global __cuStreamIsCapturing - cuGetProcAddress('cuStreamIsCapturing', &__cuStreamIsCapturing, 10000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuStreamGetCaptureInfo_v2' in found_functions}} - global __cuStreamGetCaptureInfo_v2 - cuGetProcAddress('cuStreamGetCaptureInfo', &__cuStreamGetCaptureInfo_v2, 11030, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuStreamGetCaptureInfo_v3' in found_functions}} - global __cuStreamGetCaptureInfo_v3 - cuGetProcAddress('cuStreamGetCaptureInfo', &__cuStreamGetCaptureInfo_v3, 12030, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuStreamUpdateCaptureDependencies' in found_functions}} - global __cuStreamUpdateCaptureDependencies - cuGetProcAddress('cuStreamUpdateCaptureDependencies', &__cuStreamUpdateCaptureDependencies, 11030, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuStreamUpdateCaptureDependencies_v2' in found_functions}} - global __cuStreamUpdateCaptureDependencies_v2 - cuGetProcAddress('cuStreamUpdateCaptureDependencies', &__cuStreamUpdateCaptureDependencies_v2, 12030, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuStreamAttachMemAsync' in found_functions}} - global __cuStreamAttachMemAsync - cuGetProcAddress('cuStreamAttachMemAsync', &__cuStreamAttachMemAsync, 6000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuStreamQuery' in found_functions}} - global __cuStreamQuery - cuGetProcAddress('cuStreamQuery', &__cuStreamQuery, 2000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuStreamSynchronize' in found_functions}} - global __cuStreamSynchronize - cuGetProcAddress('cuStreamSynchronize', &__cuStreamSynchronize, 2000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuStreamCopyAttributes' in found_functions}} - global __cuStreamCopyAttributes - cuGetProcAddress('cuStreamCopyAttributes', &__cuStreamCopyAttributes, 11000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuStreamGetAttribute' in found_functions}} - global __cuStreamGetAttribute - cuGetProcAddress('cuStreamGetAttribute', &__cuStreamGetAttribute, 11000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuStreamSetAttribute' in found_functions}} - global __cuStreamSetAttribute - cuGetProcAddress('cuStreamSetAttribute', &__cuStreamSetAttribute, 11000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuEventRecord' in found_functions}} - global __cuEventRecord - cuGetProcAddress('cuEventRecord', &__cuEventRecord, 2000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuEventRecordWithFlags' in found_functions}} - global __cuEventRecordWithFlags - cuGetProcAddress('cuEventRecordWithFlags', &__cuEventRecordWithFlags, 11010, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuSignalExternalSemaphoresAsync' in found_functions}} - global __cuSignalExternalSemaphoresAsync - cuGetProcAddress('cuSignalExternalSemaphoresAsync', &__cuSignalExternalSemaphoresAsync, 10000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuWaitExternalSemaphoresAsync' in found_functions}} - global __cuWaitExternalSemaphoresAsync - cuGetProcAddress('cuWaitExternalSemaphoresAsync', &__cuWaitExternalSemaphoresAsync, 10000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuStreamWaitValue32_v2' in found_functions}} - global __cuStreamWaitValue32_v2 - cuGetProcAddress('cuStreamWaitValue32', &__cuStreamWaitValue32_v2, 11070, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuStreamWaitValue64_v2' in found_functions}} - global __cuStreamWaitValue64_v2 - cuGetProcAddress('cuStreamWaitValue64', &__cuStreamWaitValue64_v2, 11070, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuStreamWriteValue32_v2' in found_functions}} - global __cuStreamWriteValue32_v2 - cuGetProcAddress('cuStreamWriteValue32', &__cuStreamWriteValue32_v2, 11070, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuStreamWriteValue64_v2' in found_functions}} - global __cuStreamWriteValue64_v2 - cuGetProcAddress('cuStreamWriteValue64', &__cuStreamWriteValue64_v2, 11070, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuStreamBatchMemOp_v2' in found_functions}} - global __cuStreamBatchMemOp_v2 - cuGetProcAddress('cuStreamBatchMemOp', &__cuStreamBatchMemOp_v2, 11070, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuLaunchKernel' in found_functions}} - global __cuLaunchKernel - cuGetProcAddress('cuLaunchKernel', &__cuLaunchKernel, 4000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuLaunchKernelEx' in found_functions}} - global __cuLaunchKernelEx - cuGetProcAddress('cuLaunchKernelEx', &__cuLaunchKernelEx, 11060, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuLaunchCooperativeKernel' in found_functions}} - global __cuLaunchCooperativeKernel - cuGetProcAddress('cuLaunchCooperativeKernel', &__cuLaunchCooperativeKernel, 9000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuLaunchHostFunc' in found_functions}} - global __cuLaunchHostFunc - cuGetProcAddress('cuLaunchHostFunc', &__cuLaunchHostFunc, 10000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphInstantiateWithParams' in found_functions}} - global __cuGraphInstantiateWithParams - cuGetProcAddress('cuGraphInstantiateWithParams', &__cuGraphInstantiateWithParams, 12000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphUpload' in found_functions}} - global __cuGraphUpload - cuGetProcAddress('cuGraphUpload', &__cuGraphUpload, 11010, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphLaunch' in found_functions}} - global __cuGraphLaunch - cuGetProcAddress('cuGraphLaunch', &__cuGraphLaunch, 10000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphicsMapResources' in found_functions}} - global __cuGraphicsMapResources - cuGetProcAddress('cuGraphicsMapResources', &__cuGraphicsMapResources, 3000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphicsUnmapResources' in found_functions}} - global __cuGraphicsUnmapResources - cuGetProcAddress('cuGraphicsUnmapResources', &__cuGraphicsUnmapResources, 3000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - # Get remaining functions - {{if 'cuGetErrorString' in found_functions}} - global __cuGetErrorString - cuGetProcAddress('cuGetErrorString', &__cuGetErrorString, 6000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGetErrorName' in found_functions}} - global __cuGetErrorName - cuGetProcAddress('cuGetErrorName', &__cuGetErrorName, 6000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuInit' in found_functions}} - global __cuInit - cuGetProcAddress('cuInit', &__cuInit, 2000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuDriverGetVersion' in found_functions}} - global __cuDriverGetVersion - cuGetProcAddress('cuDriverGetVersion', &__cuDriverGetVersion, 2020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuDeviceGet' in found_functions}} - global __cuDeviceGet - cuGetProcAddress('cuDeviceGet', &__cuDeviceGet, 2000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuDeviceGetCount' in found_functions}} - global __cuDeviceGetCount - cuGetProcAddress('cuDeviceGetCount', &__cuDeviceGetCount, 2000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuDeviceGetName' in found_functions}} - global __cuDeviceGetName - cuGetProcAddress('cuDeviceGetName', &__cuDeviceGetName, 2000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuDeviceGetUuid' in found_functions}} - global __cuDeviceGetUuid - cuGetProcAddress('cuDeviceGetUuid', &__cuDeviceGetUuid, 9020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuDeviceGetUuid_v2' in found_functions}} - global __cuDeviceGetUuid_v2 - cuGetProcAddress('cuDeviceGetUuid', &__cuDeviceGetUuid_v2, 11040, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuDeviceGetLuid' in found_functions}} - global __cuDeviceGetLuid - cuGetProcAddress('cuDeviceGetLuid', &__cuDeviceGetLuid, 10000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuDeviceTotalMem_v2' in found_functions}} - global __cuDeviceTotalMem_v2 - cuGetProcAddress('cuDeviceTotalMem', &__cuDeviceTotalMem_v2, 3020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuDeviceGetTexture1DLinearMaxWidth' in found_functions}} - global __cuDeviceGetTexture1DLinearMaxWidth - cuGetProcAddress('cuDeviceGetTexture1DLinearMaxWidth', &__cuDeviceGetTexture1DLinearMaxWidth, 11010, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuDeviceGetAttribute' in found_functions}} - global __cuDeviceGetAttribute - cuGetProcAddress('cuDeviceGetAttribute', &__cuDeviceGetAttribute, 2000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuDeviceGetNvSciSyncAttributes' in found_functions}} - global __cuDeviceGetNvSciSyncAttributes - cuGetProcAddress('cuDeviceGetNvSciSyncAttributes', &__cuDeviceGetNvSciSyncAttributes, 10020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuDeviceSetMemPool' in found_functions}} - global __cuDeviceSetMemPool - cuGetProcAddress('cuDeviceSetMemPool', &__cuDeviceSetMemPool, 11020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuDeviceGetMemPool' in found_functions}} - global __cuDeviceGetMemPool - cuGetProcAddress('cuDeviceGetMemPool', &__cuDeviceGetMemPool, 11020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuDeviceGetDefaultMemPool' in found_functions}} - global __cuDeviceGetDefaultMemPool - cuGetProcAddress('cuDeviceGetDefaultMemPool', &__cuDeviceGetDefaultMemPool, 11020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuDeviceGetExecAffinitySupport' in found_functions}} - global __cuDeviceGetExecAffinitySupport - cuGetProcAddress('cuDeviceGetExecAffinitySupport', &__cuDeviceGetExecAffinitySupport, 11040, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuFlushGPUDirectRDMAWrites' in found_functions}} - global __cuFlushGPUDirectRDMAWrites - cuGetProcAddress('cuFlushGPUDirectRDMAWrites', &__cuFlushGPUDirectRDMAWrites, 11030, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuDeviceGetProperties' in found_functions}} - global __cuDeviceGetProperties - cuGetProcAddress('cuDeviceGetProperties', &__cuDeviceGetProperties, 2000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuDeviceComputeCapability' in found_functions}} - global __cuDeviceComputeCapability - cuGetProcAddress('cuDeviceComputeCapability', &__cuDeviceComputeCapability, 2000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuDevicePrimaryCtxRetain' in found_functions}} - global __cuDevicePrimaryCtxRetain - cuGetProcAddress('cuDevicePrimaryCtxRetain', &__cuDevicePrimaryCtxRetain, 7000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuDevicePrimaryCtxRelease_v2' in found_functions}} - global __cuDevicePrimaryCtxRelease_v2 - cuGetProcAddress('cuDevicePrimaryCtxRelease', &__cuDevicePrimaryCtxRelease_v2, 11000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuDevicePrimaryCtxSetFlags_v2' in found_functions}} - global __cuDevicePrimaryCtxSetFlags_v2 - cuGetProcAddress('cuDevicePrimaryCtxSetFlags', &__cuDevicePrimaryCtxSetFlags_v2, 11000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuDevicePrimaryCtxGetState' in found_functions}} - global __cuDevicePrimaryCtxGetState - cuGetProcAddress('cuDevicePrimaryCtxGetState', &__cuDevicePrimaryCtxGetState, 7000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuDevicePrimaryCtxReset_v2' in found_functions}} - global __cuDevicePrimaryCtxReset_v2 - cuGetProcAddress('cuDevicePrimaryCtxReset', &__cuDevicePrimaryCtxReset_v2, 11000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuCtxCreate_v2' in found_functions}} - global __cuCtxCreate_v2 - cuGetProcAddress('cuCtxCreate', &__cuCtxCreate_v2, 3020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuCtxCreate_v3' in found_functions}} - global __cuCtxCreate_v3 - cuGetProcAddress('cuCtxCreate', &__cuCtxCreate_v3, 11040, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuCtxCreate_v4' in found_functions}} - global __cuCtxCreate_v4 - cuGetProcAddress('cuCtxCreate', &__cuCtxCreate_v4, 12050, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuCtxDestroy_v2' in found_functions}} - global __cuCtxDestroy_v2 - cuGetProcAddress('cuCtxDestroy', &__cuCtxDestroy_v2, 4000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuCtxPushCurrent_v2' in found_functions}} - global __cuCtxPushCurrent_v2 - cuGetProcAddress('cuCtxPushCurrent', &__cuCtxPushCurrent_v2, 4000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuCtxPopCurrent_v2' in found_functions}} - global __cuCtxPopCurrent_v2 - cuGetProcAddress('cuCtxPopCurrent', &__cuCtxPopCurrent_v2, 4000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuCtxSetCurrent' in found_functions}} - global __cuCtxSetCurrent - cuGetProcAddress('cuCtxSetCurrent', &__cuCtxSetCurrent, 4000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuCtxGetCurrent' in found_functions}} - global __cuCtxGetCurrent - cuGetProcAddress('cuCtxGetCurrent', &__cuCtxGetCurrent, 4000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuCtxGetDevice' in found_functions}} - global __cuCtxGetDevice - cuGetProcAddress('cuCtxGetDevice', &__cuCtxGetDevice, 2000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuCtxGetFlags' in found_functions}} - global __cuCtxGetFlags - cuGetProcAddress('cuCtxGetFlags', &__cuCtxGetFlags, 7000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuCtxSetFlags' in found_functions}} - global __cuCtxSetFlags - cuGetProcAddress('cuCtxSetFlags', &__cuCtxSetFlags, 12010, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuCtxGetId' in found_functions}} - global __cuCtxGetId - cuGetProcAddress('cuCtxGetId', &__cuCtxGetId, 12000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuCtxSynchronize' in found_functions}} - global __cuCtxSynchronize - cuGetProcAddress('cuCtxSynchronize', &__cuCtxSynchronize, 2000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuCtxSetLimit' in found_functions}} - global __cuCtxSetLimit - cuGetProcAddress('cuCtxSetLimit', &__cuCtxSetLimit, 3010, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuCtxGetLimit' in found_functions}} - global __cuCtxGetLimit - cuGetProcAddress('cuCtxGetLimit', &__cuCtxGetLimit, 3010, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuCtxGetCacheConfig' in found_functions}} - global __cuCtxGetCacheConfig - cuGetProcAddress('cuCtxGetCacheConfig', &__cuCtxGetCacheConfig, 3020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuCtxSetCacheConfig' in found_functions}} - global __cuCtxSetCacheConfig - cuGetProcAddress('cuCtxSetCacheConfig', &__cuCtxSetCacheConfig, 3020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuCtxGetApiVersion' in found_functions}} - global __cuCtxGetApiVersion - cuGetProcAddress('cuCtxGetApiVersion', &__cuCtxGetApiVersion, 3020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuCtxGetStreamPriorityRange' in found_functions}} - global __cuCtxGetStreamPriorityRange - cuGetProcAddress('cuCtxGetStreamPriorityRange', &__cuCtxGetStreamPriorityRange, 5050, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuCtxResetPersistingL2Cache' in found_functions}} - global __cuCtxResetPersistingL2Cache - cuGetProcAddress('cuCtxResetPersistingL2Cache', &__cuCtxResetPersistingL2Cache, 11000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuCtxGetExecAffinity' in found_functions}} - global __cuCtxGetExecAffinity - cuGetProcAddress('cuCtxGetExecAffinity', &__cuCtxGetExecAffinity, 11040, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuCtxRecordEvent' in found_functions}} - global __cuCtxRecordEvent - cuGetProcAddress('cuCtxRecordEvent', &__cuCtxRecordEvent, 12050, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuCtxWaitEvent' in found_functions}} - global __cuCtxWaitEvent - cuGetProcAddress('cuCtxWaitEvent', &__cuCtxWaitEvent, 12050, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuCtxAttach' in found_functions}} - global __cuCtxAttach - cuGetProcAddress('cuCtxAttach', &__cuCtxAttach, 2000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuCtxDetach' in found_functions}} - global __cuCtxDetach - cuGetProcAddress('cuCtxDetach', &__cuCtxDetach, 2000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuCtxGetSharedMemConfig' in found_functions}} - global __cuCtxGetSharedMemConfig - cuGetProcAddress('cuCtxGetSharedMemConfig', &__cuCtxGetSharedMemConfig, 4020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuCtxSetSharedMemConfig' in found_functions}} - global __cuCtxSetSharedMemConfig - cuGetProcAddress('cuCtxSetSharedMemConfig', &__cuCtxSetSharedMemConfig, 4020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuModuleLoad' in found_functions}} - global __cuModuleLoad - cuGetProcAddress('cuModuleLoad', &__cuModuleLoad, 2000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuModuleLoadData' in found_functions}} - global __cuModuleLoadData - cuGetProcAddress('cuModuleLoadData', &__cuModuleLoadData, 2000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuModuleLoadDataEx' in found_functions}} - global __cuModuleLoadDataEx - cuGetProcAddress('cuModuleLoadDataEx', &__cuModuleLoadDataEx, 2010, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuModuleLoadFatBinary' in found_functions}} - global __cuModuleLoadFatBinary - cuGetProcAddress('cuModuleLoadFatBinary', &__cuModuleLoadFatBinary, 2000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuModuleUnload' in found_functions}} - global __cuModuleUnload - cuGetProcAddress('cuModuleUnload', &__cuModuleUnload, 2000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuModuleGetLoadingMode' in found_functions}} - global __cuModuleGetLoadingMode - cuGetProcAddress('cuModuleGetLoadingMode', &__cuModuleGetLoadingMode, 11070, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuModuleGetFunction' in found_functions}} - global __cuModuleGetFunction - cuGetProcAddress('cuModuleGetFunction', &__cuModuleGetFunction, 2000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuModuleGetFunctionCount' in found_functions}} - global __cuModuleGetFunctionCount - cuGetProcAddress('cuModuleGetFunctionCount', &__cuModuleGetFunctionCount, 12040, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuModuleEnumerateFunctions' in found_functions}} - global __cuModuleEnumerateFunctions - cuGetProcAddress('cuModuleEnumerateFunctions', &__cuModuleEnumerateFunctions, 12040, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuModuleGetGlobal_v2' in found_functions}} - global __cuModuleGetGlobal_v2 - cuGetProcAddress('cuModuleGetGlobal', &__cuModuleGetGlobal_v2, 3020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuLinkCreate_v2' in found_functions}} - global __cuLinkCreate_v2 - cuGetProcAddress('cuLinkCreate', &__cuLinkCreate_v2, 6050, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuLinkAddData_v2' in found_functions}} - global __cuLinkAddData_v2 - cuGetProcAddress('cuLinkAddData', &__cuLinkAddData_v2, 6050, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuLinkAddFile_v2' in found_functions}} - global __cuLinkAddFile_v2 - cuGetProcAddress('cuLinkAddFile', &__cuLinkAddFile_v2, 6050, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuLinkComplete' in found_functions}} - global __cuLinkComplete - cuGetProcAddress('cuLinkComplete', &__cuLinkComplete, 5050, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuLinkDestroy' in found_functions}} - global __cuLinkDestroy - cuGetProcAddress('cuLinkDestroy', &__cuLinkDestroy, 5050, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuModuleGetTexRef' in found_functions}} - global __cuModuleGetTexRef - cuGetProcAddress('cuModuleGetTexRef', &__cuModuleGetTexRef, 2000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuModuleGetSurfRef' in found_functions}} - global __cuModuleGetSurfRef - cuGetProcAddress('cuModuleGetSurfRef', &__cuModuleGetSurfRef, 3000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuLibraryLoadData' in found_functions}} - global __cuLibraryLoadData - cuGetProcAddress('cuLibraryLoadData', &__cuLibraryLoadData, 12000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuLibraryLoadFromFile' in found_functions}} - global __cuLibraryLoadFromFile - cuGetProcAddress('cuLibraryLoadFromFile', &__cuLibraryLoadFromFile, 12000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuLibraryUnload' in found_functions}} - global __cuLibraryUnload - cuGetProcAddress('cuLibraryUnload', &__cuLibraryUnload, 12000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuLibraryGetKernel' in found_functions}} - global __cuLibraryGetKernel - cuGetProcAddress('cuLibraryGetKernel', &__cuLibraryGetKernel, 12000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuLibraryGetKernelCount' in found_functions}} - global __cuLibraryGetKernelCount - cuGetProcAddress('cuLibraryGetKernelCount', &__cuLibraryGetKernelCount, 12040, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuLibraryEnumerateKernels' in found_functions}} - global __cuLibraryEnumerateKernels - cuGetProcAddress('cuLibraryEnumerateKernels', &__cuLibraryEnumerateKernels, 12040, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuLibraryGetModule' in found_functions}} - global __cuLibraryGetModule - cuGetProcAddress('cuLibraryGetModule', &__cuLibraryGetModule, 12000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuKernelGetFunction' in found_functions}} - global __cuKernelGetFunction - cuGetProcAddress('cuKernelGetFunction', &__cuKernelGetFunction, 12000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuKernelGetLibrary' in found_functions}} - global __cuKernelGetLibrary - cuGetProcAddress('cuKernelGetLibrary', &__cuKernelGetLibrary, 12050, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuLibraryGetGlobal' in found_functions}} - global __cuLibraryGetGlobal - cuGetProcAddress('cuLibraryGetGlobal', &__cuLibraryGetGlobal, 12000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuLibraryGetManaged' in found_functions}} - global __cuLibraryGetManaged - cuGetProcAddress('cuLibraryGetManaged', &__cuLibraryGetManaged, 12000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuLibraryGetUnifiedFunction' in found_functions}} - global __cuLibraryGetUnifiedFunction - cuGetProcAddress('cuLibraryGetUnifiedFunction', &__cuLibraryGetUnifiedFunction, 12000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuKernelGetAttribute' in found_functions}} - global __cuKernelGetAttribute - cuGetProcAddress('cuKernelGetAttribute', &__cuKernelGetAttribute, 12000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuKernelSetAttribute' in found_functions}} - global __cuKernelSetAttribute - cuGetProcAddress('cuKernelSetAttribute', &__cuKernelSetAttribute, 12000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuKernelSetCacheConfig' in found_functions}} - global __cuKernelSetCacheConfig - cuGetProcAddress('cuKernelSetCacheConfig', &__cuKernelSetCacheConfig, 12000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuKernelGetName' in found_functions}} - global __cuKernelGetName - cuGetProcAddress('cuKernelGetName', &__cuKernelGetName, 12030, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuKernelGetParamInfo' in found_functions}} - global __cuKernelGetParamInfo - cuGetProcAddress('cuKernelGetParamInfo', &__cuKernelGetParamInfo, 12040, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemGetInfo_v2' in found_functions}} - global __cuMemGetInfo_v2 - cuGetProcAddress('cuMemGetInfo', &__cuMemGetInfo_v2, 3020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemAlloc_v2' in found_functions}} - global __cuMemAlloc_v2 - cuGetProcAddress('cuMemAlloc', &__cuMemAlloc_v2, 3020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemAllocPitch_v2' in found_functions}} - global __cuMemAllocPitch_v2 - cuGetProcAddress('cuMemAllocPitch', &__cuMemAllocPitch_v2, 3020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemFree_v2' in found_functions}} - global __cuMemFree_v2 - cuGetProcAddress('cuMemFree', &__cuMemFree_v2, 3020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemGetAddressRange_v2' in found_functions}} - global __cuMemGetAddressRange_v2 - cuGetProcAddress('cuMemGetAddressRange', &__cuMemGetAddressRange_v2, 3020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemAllocHost_v2' in found_functions}} - global __cuMemAllocHost_v2 - cuGetProcAddress('cuMemAllocHost', &__cuMemAllocHost_v2, 3020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemFreeHost' in found_functions}} - global __cuMemFreeHost - cuGetProcAddress('cuMemFreeHost', &__cuMemFreeHost, 2000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemHostAlloc' in found_functions}} - global __cuMemHostAlloc - cuGetProcAddress('cuMemHostAlloc', &__cuMemHostAlloc, 2020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemHostGetDevicePointer_v2' in found_functions}} - global __cuMemHostGetDevicePointer_v2 - cuGetProcAddress('cuMemHostGetDevicePointer', &__cuMemHostGetDevicePointer_v2, 3020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemHostGetFlags' in found_functions}} - global __cuMemHostGetFlags - cuGetProcAddress('cuMemHostGetFlags', &__cuMemHostGetFlags, 2030, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemAllocManaged' in found_functions}} - global __cuMemAllocManaged - cuGetProcAddress('cuMemAllocManaged', &__cuMemAllocManaged, 6000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuDeviceRegisterAsyncNotification' in found_functions}} - global __cuDeviceRegisterAsyncNotification - cuGetProcAddress('cuDeviceRegisterAsyncNotification', &__cuDeviceRegisterAsyncNotification, 12040, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuDeviceUnregisterAsyncNotification' in found_functions}} - global __cuDeviceUnregisterAsyncNotification - cuGetProcAddress('cuDeviceUnregisterAsyncNotification', &__cuDeviceUnregisterAsyncNotification, 12040, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuDeviceGetByPCIBusId' in found_functions}} - global __cuDeviceGetByPCIBusId - cuGetProcAddress('cuDeviceGetByPCIBusId', &__cuDeviceGetByPCIBusId, 4010, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuDeviceGetPCIBusId' in found_functions}} - global __cuDeviceGetPCIBusId - cuGetProcAddress('cuDeviceGetPCIBusId', &__cuDeviceGetPCIBusId, 4010, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuIpcGetEventHandle' in found_functions}} - global __cuIpcGetEventHandle - cuGetProcAddress('cuIpcGetEventHandle', &__cuIpcGetEventHandle, 4010, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuIpcOpenEventHandle' in found_functions}} - global __cuIpcOpenEventHandle - cuGetProcAddress('cuIpcOpenEventHandle', &__cuIpcOpenEventHandle, 4010, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuIpcGetMemHandle' in found_functions}} - global __cuIpcGetMemHandle - cuGetProcAddress('cuIpcGetMemHandle', &__cuIpcGetMemHandle, 4010, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuIpcOpenMemHandle_v2' in found_functions}} - global __cuIpcOpenMemHandle_v2 - cuGetProcAddress('cuIpcOpenMemHandle', &__cuIpcOpenMemHandle_v2, 11000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuIpcCloseMemHandle' in found_functions}} - global __cuIpcCloseMemHandle - cuGetProcAddress('cuIpcCloseMemHandle', &__cuIpcCloseMemHandle, 4010, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemHostRegister_v2' in found_functions}} - global __cuMemHostRegister_v2 - cuGetProcAddress('cuMemHostRegister', &__cuMemHostRegister_v2, 6050, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemHostUnregister' in found_functions}} - global __cuMemHostUnregister - cuGetProcAddress('cuMemHostUnregister', &__cuMemHostUnregister, 4000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuArrayCreate_v2' in found_functions}} - global __cuArrayCreate_v2 - cuGetProcAddress('cuArrayCreate', &__cuArrayCreate_v2, 3020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuArrayGetDescriptor_v2' in found_functions}} - global __cuArrayGetDescriptor_v2 - cuGetProcAddress('cuArrayGetDescriptor', &__cuArrayGetDescriptor_v2, 3020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuArrayGetSparseProperties' in found_functions}} - global __cuArrayGetSparseProperties - cuGetProcAddress('cuArrayGetSparseProperties', &__cuArrayGetSparseProperties, 11010, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMipmappedArrayGetSparseProperties' in found_functions}} - global __cuMipmappedArrayGetSparseProperties - cuGetProcAddress('cuMipmappedArrayGetSparseProperties', &__cuMipmappedArrayGetSparseProperties, 11010, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuArrayGetMemoryRequirements' in found_functions}} - global __cuArrayGetMemoryRequirements - cuGetProcAddress('cuArrayGetMemoryRequirements', &__cuArrayGetMemoryRequirements, 11060, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMipmappedArrayGetMemoryRequirements' in found_functions}} - global __cuMipmappedArrayGetMemoryRequirements - cuGetProcAddress('cuMipmappedArrayGetMemoryRequirements', &__cuMipmappedArrayGetMemoryRequirements, 11060, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuArrayGetPlane' in found_functions}} - global __cuArrayGetPlane - cuGetProcAddress('cuArrayGetPlane', &__cuArrayGetPlane, 11020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuArrayDestroy' in found_functions}} - global __cuArrayDestroy - cuGetProcAddress('cuArrayDestroy', &__cuArrayDestroy, 2000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuArray3DCreate_v2' in found_functions}} - global __cuArray3DCreate_v2 - cuGetProcAddress('cuArray3DCreate', &__cuArray3DCreate_v2, 3020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuArray3DGetDescriptor_v2' in found_functions}} - global __cuArray3DGetDescriptor_v2 - cuGetProcAddress('cuArray3DGetDescriptor', &__cuArray3DGetDescriptor_v2, 3020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMipmappedArrayCreate' in found_functions}} - global __cuMipmappedArrayCreate - cuGetProcAddress('cuMipmappedArrayCreate', &__cuMipmappedArrayCreate, 5000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMipmappedArrayGetLevel' in found_functions}} - global __cuMipmappedArrayGetLevel - cuGetProcAddress('cuMipmappedArrayGetLevel', &__cuMipmappedArrayGetLevel, 5000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMipmappedArrayDestroy' in found_functions}} - global __cuMipmappedArrayDestroy - cuGetProcAddress('cuMipmappedArrayDestroy', &__cuMipmappedArrayDestroy, 5000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemGetHandleForAddressRange' in found_functions}} - global __cuMemGetHandleForAddressRange - cuGetProcAddress('cuMemGetHandleForAddressRange', &__cuMemGetHandleForAddressRange, 11070, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemAddressReserve' in found_functions}} - global __cuMemAddressReserve - cuGetProcAddress('cuMemAddressReserve', &__cuMemAddressReserve, 10020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemAddressFree' in found_functions}} - global __cuMemAddressFree - cuGetProcAddress('cuMemAddressFree', &__cuMemAddressFree, 10020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemCreate' in found_functions}} - global __cuMemCreate - cuGetProcAddress('cuMemCreate', &__cuMemCreate, 10020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemRelease' in found_functions}} - global __cuMemRelease - cuGetProcAddress('cuMemRelease', &__cuMemRelease, 10020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemMap' in found_functions}} - global __cuMemMap - cuGetProcAddress('cuMemMap', &__cuMemMap, 10020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemUnmap' in found_functions}} - global __cuMemUnmap - cuGetProcAddress('cuMemUnmap', &__cuMemUnmap, 10020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemSetAccess' in found_functions}} - global __cuMemSetAccess - cuGetProcAddress('cuMemSetAccess', &__cuMemSetAccess, 10020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemGetAccess' in found_functions}} - global __cuMemGetAccess - cuGetProcAddress('cuMemGetAccess', &__cuMemGetAccess, 10020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemExportToShareableHandle' in found_functions}} - global __cuMemExportToShareableHandle - cuGetProcAddress('cuMemExportToShareableHandle', &__cuMemExportToShareableHandle, 10020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemImportFromShareableHandle' in found_functions}} - global __cuMemImportFromShareableHandle - cuGetProcAddress('cuMemImportFromShareableHandle', &__cuMemImportFromShareableHandle, 10020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemGetAllocationGranularity' in found_functions}} - global __cuMemGetAllocationGranularity - cuGetProcAddress('cuMemGetAllocationGranularity', &__cuMemGetAllocationGranularity, 10020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemGetAllocationPropertiesFromHandle' in found_functions}} - global __cuMemGetAllocationPropertiesFromHandle - cuGetProcAddress('cuMemGetAllocationPropertiesFromHandle', &__cuMemGetAllocationPropertiesFromHandle, 10020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemRetainAllocationHandle' in found_functions}} - global __cuMemRetainAllocationHandle - cuGetProcAddress('cuMemRetainAllocationHandle', &__cuMemRetainAllocationHandle, 11000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemPoolTrimTo' in found_functions}} - global __cuMemPoolTrimTo - cuGetProcAddress('cuMemPoolTrimTo', &__cuMemPoolTrimTo, 11020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemPoolSetAttribute' in found_functions}} - global __cuMemPoolSetAttribute - cuGetProcAddress('cuMemPoolSetAttribute', &__cuMemPoolSetAttribute, 11020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemPoolGetAttribute' in found_functions}} - global __cuMemPoolGetAttribute - cuGetProcAddress('cuMemPoolGetAttribute', &__cuMemPoolGetAttribute, 11020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemPoolSetAccess' in found_functions}} - global __cuMemPoolSetAccess - cuGetProcAddress('cuMemPoolSetAccess', &__cuMemPoolSetAccess, 11020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemPoolGetAccess' in found_functions}} - global __cuMemPoolGetAccess - cuGetProcAddress('cuMemPoolGetAccess', &__cuMemPoolGetAccess, 11020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemPoolCreate' in found_functions}} - global __cuMemPoolCreate - cuGetProcAddress('cuMemPoolCreate', &__cuMemPoolCreate, 11020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemPoolDestroy' in found_functions}} - global __cuMemPoolDestroy - cuGetProcAddress('cuMemPoolDestroy', &__cuMemPoolDestroy, 11020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemPoolExportToShareableHandle' in found_functions}} - global __cuMemPoolExportToShareableHandle - cuGetProcAddress('cuMemPoolExportToShareableHandle', &__cuMemPoolExportToShareableHandle, 11020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemPoolImportFromShareableHandle' in found_functions}} - global __cuMemPoolImportFromShareableHandle - cuGetProcAddress('cuMemPoolImportFromShareableHandle', &__cuMemPoolImportFromShareableHandle, 11020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemPoolExportPointer' in found_functions}} - global __cuMemPoolExportPointer - cuGetProcAddress('cuMemPoolExportPointer', &__cuMemPoolExportPointer, 11020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemPoolImportPointer' in found_functions}} - global __cuMemPoolImportPointer - cuGetProcAddress('cuMemPoolImportPointer', &__cuMemPoolImportPointer, 11020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMulticastCreate' in found_functions}} - global __cuMulticastCreate - cuGetProcAddress('cuMulticastCreate', &__cuMulticastCreate, 12010, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMulticastAddDevice' in found_functions}} - global __cuMulticastAddDevice - cuGetProcAddress('cuMulticastAddDevice', &__cuMulticastAddDevice, 12010, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMulticastBindMem' in found_functions}} - global __cuMulticastBindMem - cuGetProcAddress('cuMulticastBindMem', &__cuMulticastBindMem, 12010, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMulticastBindAddr' in found_functions}} - global __cuMulticastBindAddr - cuGetProcAddress('cuMulticastBindAddr', &__cuMulticastBindAddr, 12010, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMulticastUnbind' in found_functions}} - global __cuMulticastUnbind - cuGetProcAddress('cuMulticastUnbind', &__cuMulticastUnbind, 12010, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMulticastGetGranularity' in found_functions}} - global __cuMulticastGetGranularity - cuGetProcAddress('cuMulticastGetGranularity', &__cuMulticastGetGranularity, 12010, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuPointerGetAttribute' in found_functions}} - global __cuPointerGetAttribute - cuGetProcAddress('cuPointerGetAttribute', &__cuPointerGetAttribute, 4000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemAdvise' in found_functions}} - global __cuMemAdvise - cuGetProcAddress('cuMemAdvise', &__cuMemAdvise, 8000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemAdvise_v2' in found_functions}} - global __cuMemAdvise_v2 - cuGetProcAddress('cuMemAdvise', &__cuMemAdvise_v2, 12020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemRangeGetAttribute' in found_functions}} - global __cuMemRangeGetAttribute - cuGetProcAddress('cuMemRangeGetAttribute', &__cuMemRangeGetAttribute, 8000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuMemRangeGetAttributes' in found_functions}} - global __cuMemRangeGetAttributes - cuGetProcAddress('cuMemRangeGetAttributes', &__cuMemRangeGetAttributes, 8000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuPointerSetAttribute' in found_functions}} - global __cuPointerSetAttribute - cuGetProcAddress('cuPointerSetAttribute', &__cuPointerSetAttribute, 6000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuPointerGetAttributes' in found_functions}} - global __cuPointerGetAttributes - cuGetProcAddress('cuPointerGetAttributes', &__cuPointerGetAttributes, 7000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuStreamCreate' in found_functions}} - global __cuStreamCreate - cuGetProcAddress('cuStreamCreate', &__cuStreamCreate, 2000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuStreamCreateWithPriority' in found_functions}} - global __cuStreamCreateWithPriority - cuGetProcAddress('cuStreamCreateWithPriority', &__cuStreamCreateWithPriority, 5050, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuThreadExchangeStreamCaptureMode' in found_functions}} - global __cuThreadExchangeStreamCaptureMode - cuGetProcAddress('cuThreadExchangeStreamCaptureMode', &__cuThreadExchangeStreamCaptureMode, 10010, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuStreamDestroy_v2' in found_functions}} - global __cuStreamDestroy_v2 - cuGetProcAddress('cuStreamDestroy', &__cuStreamDestroy_v2, 4000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuEventCreate' in found_functions}} - global __cuEventCreate - cuGetProcAddress('cuEventCreate', &__cuEventCreate, 2000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuEventQuery' in found_functions}} - global __cuEventQuery - cuGetProcAddress('cuEventQuery', &__cuEventQuery, 2000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuEventSynchronize' in found_functions}} - global __cuEventSynchronize - cuGetProcAddress('cuEventSynchronize', &__cuEventSynchronize, 2000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuEventDestroy_v2' in found_functions}} - global __cuEventDestroy_v2 - cuGetProcAddress('cuEventDestroy', &__cuEventDestroy_v2, 4000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuEventElapsedTime' in found_functions}} - global __cuEventElapsedTime - cuGetProcAddress('cuEventElapsedTime', &__cuEventElapsedTime, 2000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuImportExternalMemory' in found_functions}} - global __cuImportExternalMemory - cuGetProcAddress('cuImportExternalMemory', &__cuImportExternalMemory, 10000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuExternalMemoryGetMappedBuffer' in found_functions}} - global __cuExternalMemoryGetMappedBuffer - cuGetProcAddress('cuExternalMemoryGetMappedBuffer', &__cuExternalMemoryGetMappedBuffer, 10000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuExternalMemoryGetMappedMipmappedArray' in found_functions}} - global __cuExternalMemoryGetMappedMipmappedArray - cuGetProcAddress('cuExternalMemoryGetMappedMipmappedArray', &__cuExternalMemoryGetMappedMipmappedArray, 10000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuDestroyExternalMemory' in found_functions}} - global __cuDestroyExternalMemory - cuGetProcAddress('cuDestroyExternalMemory', &__cuDestroyExternalMemory, 10000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuImportExternalSemaphore' in found_functions}} - global __cuImportExternalSemaphore - cuGetProcAddress('cuImportExternalSemaphore', &__cuImportExternalSemaphore, 10000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuDestroyExternalSemaphore' in found_functions}} - global __cuDestroyExternalSemaphore - cuGetProcAddress('cuDestroyExternalSemaphore', &__cuDestroyExternalSemaphore, 10000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuFuncGetAttribute' in found_functions}} - global __cuFuncGetAttribute - cuGetProcAddress('cuFuncGetAttribute', &__cuFuncGetAttribute, 2020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuFuncSetAttribute' in found_functions}} - global __cuFuncSetAttribute - cuGetProcAddress('cuFuncSetAttribute', &__cuFuncSetAttribute, 9000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuFuncSetCacheConfig' in found_functions}} - global __cuFuncSetCacheConfig - cuGetProcAddress('cuFuncSetCacheConfig', &__cuFuncSetCacheConfig, 3000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuFuncGetModule' in found_functions}} - global __cuFuncGetModule - cuGetProcAddress('cuFuncGetModule', &__cuFuncGetModule, 11000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuFuncGetName' in found_functions}} - global __cuFuncGetName - cuGetProcAddress('cuFuncGetName', &__cuFuncGetName, 12030, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuFuncGetParamInfo' in found_functions}} - global __cuFuncGetParamInfo - cuGetProcAddress('cuFuncGetParamInfo', &__cuFuncGetParamInfo, 12040, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuFuncIsLoaded' in found_functions}} - global __cuFuncIsLoaded - cuGetProcAddress('cuFuncIsLoaded', &__cuFuncIsLoaded, 12040, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuFuncLoad' in found_functions}} - global __cuFuncLoad - cuGetProcAddress('cuFuncLoad', &__cuFuncLoad, 12040, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuLaunchCooperativeKernelMultiDevice' in found_functions}} - global __cuLaunchCooperativeKernelMultiDevice - cuGetProcAddress('cuLaunchCooperativeKernelMultiDevice', &__cuLaunchCooperativeKernelMultiDevice, 9000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuFuncSetBlockShape' in found_functions}} - global __cuFuncSetBlockShape - cuGetProcAddress('cuFuncSetBlockShape', &__cuFuncSetBlockShape, 2000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuFuncSetSharedSize' in found_functions}} - global __cuFuncSetSharedSize - cuGetProcAddress('cuFuncSetSharedSize', &__cuFuncSetSharedSize, 2000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuParamSetSize' in found_functions}} - global __cuParamSetSize - cuGetProcAddress('cuParamSetSize', &__cuParamSetSize, 2000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuParamSeti' in found_functions}} - global __cuParamSeti - cuGetProcAddress('cuParamSeti', &__cuParamSeti, 2000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuParamSetf' in found_functions}} - global __cuParamSetf - cuGetProcAddress('cuParamSetf', &__cuParamSetf, 2000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuParamSetv' in found_functions}} - global __cuParamSetv - cuGetProcAddress('cuParamSetv', &__cuParamSetv, 2000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuLaunch' in found_functions}} - global __cuLaunch - cuGetProcAddress('cuLaunch', &__cuLaunch, 2000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuLaunchGrid' in found_functions}} - global __cuLaunchGrid - cuGetProcAddress('cuLaunchGrid', &__cuLaunchGrid, 2000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuLaunchGridAsync' in found_functions}} - global __cuLaunchGridAsync - cuGetProcAddress('cuLaunchGridAsync', &__cuLaunchGridAsync, 2000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuParamSetTexRef' in found_functions}} - global __cuParamSetTexRef - cuGetProcAddress('cuParamSetTexRef', &__cuParamSetTexRef, 2000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuFuncSetSharedMemConfig' in found_functions}} - global __cuFuncSetSharedMemConfig - cuGetProcAddress('cuFuncSetSharedMemConfig', &__cuFuncSetSharedMemConfig, 4020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphCreate' in found_functions}} - global __cuGraphCreate - cuGetProcAddress('cuGraphCreate', &__cuGraphCreate, 10000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphAddKernelNode_v2' in found_functions}} - global __cuGraphAddKernelNode_v2 - cuGetProcAddress('cuGraphAddKernelNode', &__cuGraphAddKernelNode_v2, 12000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphKernelNodeGetParams_v2' in found_functions}} - global __cuGraphKernelNodeGetParams_v2 - cuGetProcAddress('cuGraphKernelNodeGetParams', &__cuGraphKernelNodeGetParams_v2, 12000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphKernelNodeSetParams_v2' in found_functions}} - global __cuGraphKernelNodeSetParams_v2 - cuGetProcAddress('cuGraphKernelNodeSetParams', &__cuGraphKernelNodeSetParams_v2, 12000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphAddMemcpyNode' in found_functions}} - global __cuGraphAddMemcpyNode - cuGetProcAddress('cuGraphAddMemcpyNode', &__cuGraphAddMemcpyNode, 10000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphMemcpyNodeGetParams' in found_functions}} - global __cuGraphMemcpyNodeGetParams - cuGetProcAddress('cuGraphMemcpyNodeGetParams', &__cuGraphMemcpyNodeGetParams, 10000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphMemcpyNodeSetParams' in found_functions}} - global __cuGraphMemcpyNodeSetParams - cuGetProcAddress('cuGraphMemcpyNodeSetParams', &__cuGraphMemcpyNodeSetParams, 10000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphAddMemsetNode' in found_functions}} - global __cuGraphAddMemsetNode - cuGetProcAddress('cuGraphAddMemsetNode', &__cuGraphAddMemsetNode, 10000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphMemsetNodeGetParams' in found_functions}} - global __cuGraphMemsetNodeGetParams - cuGetProcAddress('cuGraphMemsetNodeGetParams', &__cuGraphMemsetNodeGetParams, 10000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphMemsetNodeSetParams' in found_functions}} - global __cuGraphMemsetNodeSetParams - cuGetProcAddress('cuGraphMemsetNodeSetParams', &__cuGraphMemsetNodeSetParams, 10000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphAddHostNode' in found_functions}} - global __cuGraphAddHostNode - cuGetProcAddress('cuGraphAddHostNode', &__cuGraphAddHostNode, 10000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphHostNodeGetParams' in found_functions}} - global __cuGraphHostNodeGetParams - cuGetProcAddress('cuGraphHostNodeGetParams', &__cuGraphHostNodeGetParams, 10000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphHostNodeSetParams' in found_functions}} - global __cuGraphHostNodeSetParams - cuGetProcAddress('cuGraphHostNodeSetParams', &__cuGraphHostNodeSetParams, 10000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphAddChildGraphNode' in found_functions}} - global __cuGraphAddChildGraphNode - cuGetProcAddress('cuGraphAddChildGraphNode', &__cuGraphAddChildGraphNode, 10000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphChildGraphNodeGetGraph' in found_functions}} - global __cuGraphChildGraphNodeGetGraph - cuGetProcAddress('cuGraphChildGraphNodeGetGraph', &__cuGraphChildGraphNodeGetGraph, 10000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphAddEmptyNode' in found_functions}} - global __cuGraphAddEmptyNode - cuGetProcAddress('cuGraphAddEmptyNode', &__cuGraphAddEmptyNode, 10000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphAddEventRecordNode' in found_functions}} - global __cuGraphAddEventRecordNode - cuGetProcAddress('cuGraphAddEventRecordNode', &__cuGraphAddEventRecordNode, 11010, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphEventRecordNodeGetEvent' in found_functions}} - global __cuGraphEventRecordNodeGetEvent - cuGetProcAddress('cuGraphEventRecordNodeGetEvent', &__cuGraphEventRecordNodeGetEvent, 11010, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphEventRecordNodeSetEvent' in found_functions}} - global __cuGraphEventRecordNodeSetEvent - cuGetProcAddress('cuGraphEventRecordNodeSetEvent', &__cuGraphEventRecordNodeSetEvent, 11010, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphAddEventWaitNode' in found_functions}} - global __cuGraphAddEventWaitNode - cuGetProcAddress('cuGraphAddEventWaitNode', &__cuGraphAddEventWaitNode, 11010, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphEventWaitNodeGetEvent' in found_functions}} - global __cuGraphEventWaitNodeGetEvent - cuGetProcAddress('cuGraphEventWaitNodeGetEvent', &__cuGraphEventWaitNodeGetEvent, 11010, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphEventWaitNodeSetEvent' in found_functions}} - global __cuGraphEventWaitNodeSetEvent - cuGetProcAddress('cuGraphEventWaitNodeSetEvent', &__cuGraphEventWaitNodeSetEvent, 11010, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphAddExternalSemaphoresSignalNode' in found_functions}} - global __cuGraphAddExternalSemaphoresSignalNode - cuGetProcAddress('cuGraphAddExternalSemaphoresSignalNode', &__cuGraphAddExternalSemaphoresSignalNode, 11020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphExternalSemaphoresSignalNodeGetParams' in found_functions}} - global __cuGraphExternalSemaphoresSignalNodeGetParams - cuGetProcAddress('cuGraphExternalSemaphoresSignalNodeGetParams', &__cuGraphExternalSemaphoresSignalNodeGetParams, 11020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphExternalSemaphoresSignalNodeSetParams' in found_functions}} - global __cuGraphExternalSemaphoresSignalNodeSetParams - cuGetProcAddress('cuGraphExternalSemaphoresSignalNodeSetParams', &__cuGraphExternalSemaphoresSignalNodeSetParams, 11020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphAddExternalSemaphoresWaitNode' in found_functions}} - global __cuGraphAddExternalSemaphoresWaitNode - cuGetProcAddress('cuGraphAddExternalSemaphoresWaitNode', &__cuGraphAddExternalSemaphoresWaitNode, 11020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphExternalSemaphoresWaitNodeGetParams' in found_functions}} - global __cuGraphExternalSemaphoresWaitNodeGetParams - cuGetProcAddress('cuGraphExternalSemaphoresWaitNodeGetParams', &__cuGraphExternalSemaphoresWaitNodeGetParams, 11020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphExternalSemaphoresWaitNodeSetParams' in found_functions}} - global __cuGraphExternalSemaphoresWaitNodeSetParams - cuGetProcAddress('cuGraphExternalSemaphoresWaitNodeSetParams', &__cuGraphExternalSemaphoresWaitNodeSetParams, 11020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphAddBatchMemOpNode' in found_functions}} - global __cuGraphAddBatchMemOpNode - cuGetProcAddress('cuGraphAddBatchMemOpNode', &__cuGraphAddBatchMemOpNode, 11070, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphBatchMemOpNodeGetParams' in found_functions}} - global __cuGraphBatchMemOpNodeGetParams - cuGetProcAddress('cuGraphBatchMemOpNodeGetParams', &__cuGraphBatchMemOpNodeGetParams, 11070, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphBatchMemOpNodeSetParams' in found_functions}} - global __cuGraphBatchMemOpNodeSetParams - cuGetProcAddress('cuGraphBatchMemOpNodeSetParams', &__cuGraphBatchMemOpNodeSetParams, 11070, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphExecBatchMemOpNodeSetParams' in found_functions}} - global __cuGraphExecBatchMemOpNodeSetParams - cuGetProcAddress('cuGraphExecBatchMemOpNodeSetParams', &__cuGraphExecBatchMemOpNodeSetParams, 11070, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphAddMemAllocNode' in found_functions}} - global __cuGraphAddMemAllocNode - cuGetProcAddress('cuGraphAddMemAllocNode', &__cuGraphAddMemAllocNode, 11040, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphMemAllocNodeGetParams' in found_functions}} - global __cuGraphMemAllocNodeGetParams - cuGetProcAddress('cuGraphMemAllocNodeGetParams', &__cuGraphMemAllocNodeGetParams, 11040, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphAddMemFreeNode' in found_functions}} - global __cuGraphAddMemFreeNode - cuGetProcAddress('cuGraphAddMemFreeNode', &__cuGraphAddMemFreeNode, 11040, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphMemFreeNodeGetParams' in found_functions}} - global __cuGraphMemFreeNodeGetParams - cuGetProcAddress('cuGraphMemFreeNodeGetParams', &__cuGraphMemFreeNodeGetParams, 11040, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuDeviceGraphMemTrim' in found_functions}} - global __cuDeviceGraphMemTrim - cuGetProcAddress('cuDeviceGraphMemTrim', &__cuDeviceGraphMemTrim, 11040, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuDeviceGetGraphMemAttribute' in found_functions}} - global __cuDeviceGetGraphMemAttribute - cuGetProcAddress('cuDeviceGetGraphMemAttribute', &__cuDeviceGetGraphMemAttribute, 11040, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuDeviceSetGraphMemAttribute' in found_functions}} - global __cuDeviceSetGraphMemAttribute - cuGetProcAddress('cuDeviceSetGraphMemAttribute', &__cuDeviceSetGraphMemAttribute, 11040, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphClone' in found_functions}} - global __cuGraphClone - cuGetProcAddress('cuGraphClone', &__cuGraphClone, 10000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphNodeFindInClone' in found_functions}} - global __cuGraphNodeFindInClone - cuGetProcAddress('cuGraphNodeFindInClone', &__cuGraphNodeFindInClone, 10000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphNodeGetType' in found_functions}} - global __cuGraphNodeGetType - cuGetProcAddress('cuGraphNodeGetType', &__cuGraphNodeGetType, 10000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphGetNodes' in found_functions}} - global __cuGraphGetNodes - cuGetProcAddress('cuGraphGetNodes', &__cuGraphGetNodes, 10000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphGetRootNodes' in found_functions}} - global __cuGraphGetRootNodes - cuGetProcAddress('cuGraphGetRootNodes', &__cuGraphGetRootNodes, 10000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphGetEdges' in found_functions}} - global __cuGraphGetEdges - cuGetProcAddress('cuGraphGetEdges', &__cuGraphGetEdges, 10000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphGetEdges_v2' in found_functions}} - global __cuGraphGetEdges_v2 - cuGetProcAddress('cuGraphGetEdges', &__cuGraphGetEdges_v2, 12030, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphNodeGetDependencies' in found_functions}} - global __cuGraphNodeGetDependencies - cuGetProcAddress('cuGraphNodeGetDependencies', &__cuGraphNodeGetDependencies, 10000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphNodeGetDependencies_v2' in found_functions}} - global __cuGraphNodeGetDependencies_v2 - cuGetProcAddress('cuGraphNodeGetDependencies', &__cuGraphNodeGetDependencies_v2, 12030, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphNodeGetDependentNodes' in found_functions}} - global __cuGraphNodeGetDependentNodes - cuGetProcAddress('cuGraphNodeGetDependentNodes', &__cuGraphNodeGetDependentNodes, 10000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphNodeGetDependentNodes_v2' in found_functions}} - global __cuGraphNodeGetDependentNodes_v2 - cuGetProcAddress('cuGraphNodeGetDependentNodes', &__cuGraphNodeGetDependentNodes_v2, 12030, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphAddDependencies' in found_functions}} - global __cuGraphAddDependencies - cuGetProcAddress('cuGraphAddDependencies', &__cuGraphAddDependencies, 10000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphAddDependencies_v2' in found_functions}} - global __cuGraphAddDependencies_v2 - cuGetProcAddress('cuGraphAddDependencies', &__cuGraphAddDependencies_v2, 12030, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphRemoveDependencies' in found_functions}} - global __cuGraphRemoveDependencies - cuGetProcAddress('cuGraphRemoveDependencies', &__cuGraphRemoveDependencies, 10000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphRemoveDependencies_v2' in found_functions}} - global __cuGraphRemoveDependencies_v2 - cuGetProcAddress('cuGraphRemoveDependencies', &__cuGraphRemoveDependencies_v2, 12030, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphDestroyNode' in found_functions}} - global __cuGraphDestroyNode - cuGetProcAddress('cuGraphDestroyNode', &__cuGraphDestroyNode, 10000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphInstantiateWithFlags' in found_functions}} - global __cuGraphInstantiateWithFlags - cuGetProcAddress('cuGraphInstantiateWithFlags', &__cuGraphInstantiateWithFlags, 11040, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphExecGetFlags' in found_functions}} - global __cuGraphExecGetFlags - cuGetProcAddress('cuGraphExecGetFlags', &__cuGraphExecGetFlags, 12000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphExecKernelNodeSetParams_v2' in found_functions}} - global __cuGraphExecKernelNodeSetParams_v2 - cuGetProcAddress('cuGraphExecKernelNodeSetParams', &__cuGraphExecKernelNodeSetParams_v2, 12000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphExecMemcpyNodeSetParams' in found_functions}} - global __cuGraphExecMemcpyNodeSetParams - cuGetProcAddress('cuGraphExecMemcpyNodeSetParams', &__cuGraphExecMemcpyNodeSetParams, 10020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphExecMemsetNodeSetParams' in found_functions}} - global __cuGraphExecMemsetNodeSetParams - cuGetProcAddress('cuGraphExecMemsetNodeSetParams', &__cuGraphExecMemsetNodeSetParams, 10020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphExecHostNodeSetParams' in found_functions}} - global __cuGraphExecHostNodeSetParams - cuGetProcAddress('cuGraphExecHostNodeSetParams', &__cuGraphExecHostNodeSetParams, 10020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphExecChildGraphNodeSetParams' in found_functions}} - global __cuGraphExecChildGraphNodeSetParams - cuGetProcAddress('cuGraphExecChildGraphNodeSetParams', &__cuGraphExecChildGraphNodeSetParams, 11010, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphExecEventRecordNodeSetEvent' in found_functions}} - global __cuGraphExecEventRecordNodeSetEvent - cuGetProcAddress('cuGraphExecEventRecordNodeSetEvent', &__cuGraphExecEventRecordNodeSetEvent, 11010, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphExecEventWaitNodeSetEvent' in found_functions}} - global __cuGraphExecEventWaitNodeSetEvent - cuGetProcAddress('cuGraphExecEventWaitNodeSetEvent', &__cuGraphExecEventWaitNodeSetEvent, 11010, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphExecExternalSemaphoresSignalNodeSetParams' in found_functions}} - global __cuGraphExecExternalSemaphoresSignalNodeSetParams - cuGetProcAddress('cuGraphExecExternalSemaphoresSignalNodeSetParams', &__cuGraphExecExternalSemaphoresSignalNodeSetParams, 11020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphExecExternalSemaphoresWaitNodeSetParams' in found_functions}} - global __cuGraphExecExternalSemaphoresWaitNodeSetParams - cuGetProcAddress('cuGraphExecExternalSemaphoresWaitNodeSetParams', &__cuGraphExecExternalSemaphoresWaitNodeSetParams, 11020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphNodeSetEnabled' in found_functions}} - global __cuGraphNodeSetEnabled - cuGetProcAddress('cuGraphNodeSetEnabled', &__cuGraphNodeSetEnabled, 11060, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphNodeGetEnabled' in found_functions}} - global __cuGraphNodeGetEnabled - cuGetProcAddress('cuGraphNodeGetEnabled', &__cuGraphNodeGetEnabled, 11060, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphExecDestroy' in found_functions}} - global __cuGraphExecDestroy - cuGetProcAddress('cuGraphExecDestroy', &__cuGraphExecDestroy, 10000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphDestroy' in found_functions}} - global __cuGraphDestroy - cuGetProcAddress('cuGraphDestroy', &__cuGraphDestroy, 10000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphExecUpdate_v2' in found_functions}} - global __cuGraphExecUpdate_v2 - cuGetProcAddress('cuGraphExecUpdate', &__cuGraphExecUpdate_v2, 12000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphKernelNodeCopyAttributes' in found_functions}} - global __cuGraphKernelNodeCopyAttributes - cuGetProcAddress('cuGraphKernelNodeCopyAttributes', &__cuGraphKernelNodeCopyAttributes, 11000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphKernelNodeGetAttribute' in found_functions}} - global __cuGraphKernelNodeGetAttribute - cuGetProcAddress('cuGraphKernelNodeGetAttribute', &__cuGraphKernelNodeGetAttribute, 11000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphKernelNodeSetAttribute' in found_functions}} - global __cuGraphKernelNodeSetAttribute - cuGetProcAddress('cuGraphKernelNodeSetAttribute', &__cuGraphKernelNodeSetAttribute, 11000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphDebugDotPrint' in found_functions}} - global __cuGraphDebugDotPrint - cuGetProcAddress('cuGraphDebugDotPrint', &__cuGraphDebugDotPrint, 11030, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuUserObjectCreate' in found_functions}} - global __cuUserObjectCreate - cuGetProcAddress('cuUserObjectCreate', &__cuUserObjectCreate, 11030, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuUserObjectRetain' in found_functions}} - global __cuUserObjectRetain - cuGetProcAddress('cuUserObjectRetain', &__cuUserObjectRetain, 11030, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuUserObjectRelease' in found_functions}} - global __cuUserObjectRelease - cuGetProcAddress('cuUserObjectRelease', &__cuUserObjectRelease, 11030, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphRetainUserObject' in found_functions}} - global __cuGraphRetainUserObject - cuGetProcAddress('cuGraphRetainUserObject', &__cuGraphRetainUserObject, 11030, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphReleaseUserObject' in found_functions}} - global __cuGraphReleaseUserObject - cuGetProcAddress('cuGraphReleaseUserObject', &__cuGraphReleaseUserObject, 11030, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphAddNode' in found_functions}} - global __cuGraphAddNode - cuGetProcAddress('cuGraphAddNode', &__cuGraphAddNode, 12020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphAddNode_v2' in found_functions}} - global __cuGraphAddNode_v2 - cuGetProcAddress('cuGraphAddNode', &__cuGraphAddNode_v2, 12030, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphNodeSetParams' in found_functions}} - global __cuGraphNodeSetParams - cuGetProcAddress('cuGraphNodeSetParams', &__cuGraphNodeSetParams, 12020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphExecNodeSetParams' in found_functions}} - global __cuGraphExecNodeSetParams - cuGetProcAddress('cuGraphExecNodeSetParams', &__cuGraphExecNodeSetParams, 12020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphConditionalHandleCreate' in found_functions}} - global __cuGraphConditionalHandleCreate - cuGetProcAddress('cuGraphConditionalHandleCreate', &__cuGraphConditionalHandleCreate, 12030, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuOccupancyMaxActiveBlocksPerMultiprocessor' in found_functions}} - global __cuOccupancyMaxActiveBlocksPerMultiprocessor - cuGetProcAddress('cuOccupancyMaxActiveBlocksPerMultiprocessor', &__cuOccupancyMaxActiveBlocksPerMultiprocessor, 6050, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags' in found_functions}} - global __cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags - cuGetProcAddress('cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags', &__cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags, 7000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuOccupancyMaxPotentialBlockSize' in found_functions}} - global __cuOccupancyMaxPotentialBlockSize - cuGetProcAddress('cuOccupancyMaxPotentialBlockSize', &__cuOccupancyMaxPotentialBlockSize, 6050, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuOccupancyMaxPotentialBlockSizeWithFlags' in found_functions}} - global __cuOccupancyMaxPotentialBlockSizeWithFlags - cuGetProcAddress('cuOccupancyMaxPotentialBlockSizeWithFlags', &__cuOccupancyMaxPotentialBlockSizeWithFlags, 7000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuOccupancyAvailableDynamicSMemPerBlock' in found_functions}} - global __cuOccupancyAvailableDynamicSMemPerBlock - cuGetProcAddress('cuOccupancyAvailableDynamicSMemPerBlock', &__cuOccupancyAvailableDynamicSMemPerBlock, 10020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuOccupancyMaxPotentialClusterSize' in found_functions}} - global __cuOccupancyMaxPotentialClusterSize - cuGetProcAddress('cuOccupancyMaxPotentialClusterSize', &__cuOccupancyMaxPotentialClusterSize, 11070, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuOccupancyMaxActiveClusters' in found_functions}} - global __cuOccupancyMaxActiveClusters - cuGetProcAddress('cuOccupancyMaxActiveClusters', &__cuOccupancyMaxActiveClusters, 11070, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuTexRefSetArray' in found_functions}} - global __cuTexRefSetArray - cuGetProcAddress('cuTexRefSetArray', &__cuTexRefSetArray, 2000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuTexRefSetMipmappedArray' in found_functions}} - global __cuTexRefSetMipmappedArray - cuGetProcAddress('cuTexRefSetMipmappedArray', &__cuTexRefSetMipmappedArray, 5000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuTexRefSetAddress_v2' in found_functions}} - global __cuTexRefSetAddress_v2 - cuGetProcAddress('cuTexRefSetAddress', &__cuTexRefSetAddress_v2, 3020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuTexRefSetAddress2D_v3' in found_functions}} - global __cuTexRefSetAddress2D_v3 - cuGetProcAddress('cuTexRefSetAddress2D', &__cuTexRefSetAddress2D_v3, 4010, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuTexRefSetFormat' in found_functions}} - global __cuTexRefSetFormat - cuGetProcAddress('cuTexRefSetFormat', &__cuTexRefSetFormat, 2000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuTexRefSetAddressMode' in found_functions}} - global __cuTexRefSetAddressMode - cuGetProcAddress('cuTexRefSetAddressMode', &__cuTexRefSetAddressMode, 2000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuTexRefSetFilterMode' in found_functions}} - global __cuTexRefSetFilterMode - cuGetProcAddress('cuTexRefSetFilterMode', &__cuTexRefSetFilterMode, 2000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuTexRefSetMipmapFilterMode' in found_functions}} - global __cuTexRefSetMipmapFilterMode - cuGetProcAddress('cuTexRefSetMipmapFilterMode', &__cuTexRefSetMipmapFilterMode, 5000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuTexRefSetMipmapLevelBias' in found_functions}} - global __cuTexRefSetMipmapLevelBias - cuGetProcAddress('cuTexRefSetMipmapLevelBias', &__cuTexRefSetMipmapLevelBias, 5000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuTexRefSetMipmapLevelClamp' in found_functions}} - global __cuTexRefSetMipmapLevelClamp - cuGetProcAddress('cuTexRefSetMipmapLevelClamp', &__cuTexRefSetMipmapLevelClamp, 5000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuTexRefSetMaxAnisotropy' in found_functions}} - global __cuTexRefSetMaxAnisotropy - cuGetProcAddress('cuTexRefSetMaxAnisotropy', &__cuTexRefSetMaxAnisotropy, 5000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuTexRefSetBorderColor' in found_functions}} - global __cuTexRefSetBorderColor - cuGetProcAddress('cuTexRefSetBorderColor', &__cuTexRefSetBorderColor, 8000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuTexRefSetFlags' in found_functions}} - global __cuTexRefSetFlags - cuGetProcAddress('cuTexRefSetFlags', &__cuTexRefSetFlags, 2000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuTexRefGetAddress_v2' in found_functions}} - global __cuTexRefGetAddress_v2 - cuGetProcAddress('cuTexRefGetAddress', &__cuTexRefGetAddress_v2, 3020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuTexRefGetArray' in found_functions}} - global __cuTexRefGetArray - cuGetProcAddress('cuTexRefGetArray', &__cuTexRefGetArray, 2000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuTexRefGetMipmappedArray' in found_functions}} - global __cuTexRefGetMipmappedArray - cuGetProcAddress('cuTexRefGetMipmappedArray', &__cuTexRefGetMipmappedArray, 5000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuTexRefGetAddressMode' in found_functions}} - global __cuTexRefGetAddressMode - cuGetProcAddress('cuTexRefGetAddressMode', &__cuTexRefGetAddressMode, 2000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuTexRefGetFilterMode' in found_functions}} - global __cuTexRefGetFilterMode - cuGetProcAddress('cuTexRefGetFilterMode', &__cuTexRefGetFilterMode, 2000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuTexRefGetFormat' in found_functions}} - global __cuTexRefGetFormat - cuGetProcAddress('cuTexRefGetFormat', &__cuTexRefGetFormat, 2000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuTexRefGetMipmapFilterMode' in found_functions}} - global __cuTexRefGetMipmapFilterMode - cuGetProcAddress('cuTexRefGetMipmapFilterMode', &__cuTexRefGetMipmapFilterMode, 5000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuTexRefGetMipmapLevelBias' in found_functions}} - global __cuTexRefGetMipmapLevelBias - cuGetProcAddress('cuTexRefGetMipmapLevelBias', &__cuTexRefGetMipmapLevelBias, 5000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuTexRefGetMipmapLevelClamp' in found_functions}} - global __cuTexRefGetMipmapLevelClamp - cuGetProcAddress('cuTexRefGetMipmapLevelClamp', &__cuTexRefGetMipmapLevelClamp, 5000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuTexRefGetMaxAnisotropy' in found_functions}} - global __cuTexRefGetMaxAnisotropy - cuGetProcAddress('cuTexRefGetMaxAnisotropy', &__cuTexRefGetMaxAnisotropy, 5000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuTexRefGetBorderColor' in found_functions}} - global __cuTexRefGetBorderColor - cuGetProcAddress('cuTexRefGetBorderColor', &__cuTexRefGetBorderColor, 8000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuTexRefGetFlags' in found_functions}} - global __cuTexRefGetFlags - cuGetProcAddress('cuTexRefGetFlags', &__cuTexRefGetFlags, 2000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuTexRefCreate' in found_functions}} - global __cuTexRefCreate - cuGetProcAddress('cuTexRefCreate', &__cuTexRefCreate, 2000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuTexRefDestroy' in found_functions}} - global __cuTexRefDestroy - cuGetProcAddress('cuTexRefDestroy', &__cuTexRefDestroy, 2000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuSurfRefSetArray' in found_functions}} - global __cuSurfRefSetArray - cuGetProcAddress('cuSurfRefSetArray', &__cuSurfRefSetArray, 3000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuSurfRefGetArray' in found_functions}} - global __cuSurfRefGetArray - cuGetProcAddress('cuSurfRefGetArray', &__cuSurfRefGetArray, 3000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuTexObjectCreate' in found_functions}} - global __cuTexObjectCreate - cuGetProcAddress('cuTexObjectCreate', &__cuTexObjectCreate, 5000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuTexObjectDestroy' in found_functions}} - global __cuTexObjectDestroy - cuGetProcAddress('cuTexObjectDestroy', &__cuTexObjectDestroy, 5000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuTexObjectGetResourceDesc' in found_functions}} - global __cuTexObjectGetResourceDesc - cuGetProcAddress('cuTexObjectGetResourceDesc', &__cuTexObjectGetResourceDesc, 5000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuTexObjectGetTextureDesc' in found_functions}} - global __cuTexObjectGetTextureDesc - cuGetProcAddress('cuTexObjectGetTextureDesc', &__cuTexObjectGetTextureDesc, 5000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuTexObjectGetResourceViewDesc' in found_functions}} - global __cuTexObjectGetResourceViewDesc - cuGetProcAddress('cuTexObjectGetResourceViewDesc', &__cuTexObjectGetResourceViewDesc, 5000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuSurfObjectCreate' in found_functions}} - global __cuSurfObjectCreate - cuGetProcAddress('cuSurfObjectCreate', &__cuSurfObjectCreate, 5000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuSurfObjectDestroy' in found_functions}} - global __cuSurfObjectDestroy - cuGetProcAddress('cuSurfObjectDestroy', &__cuSurfObjectDestroy, 5000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuSurfObjectGetResourceDesc' in found_functions}} - global __cuSurfObjectGetResourceDesc - cuGetProcAddress('cuSurfObjectGetResourceDesc', &__cuSurfObjectGetResourceDesc, 5000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuTensorMapEncodeTiled' in found_functions}} - global __cuTensorMapEncodeTiled - cuGetProcAddress('cuTensorMapEncodeTiled', &__cuTensorMapEncodeTiled, 12000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuTensorMapEncodeIm2col' in found_functions}} - global __cuTensorMapEncodeIm2col - cuGetProcAddress('cuTensorMapEncodeIm2col', &__cuTensorMapEncodeIm2col, 12000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuTensorMapReplaceAddress' in found_functions}} - global __cuTensorMapReplaceAddress - cuGetProcAddress('cuTensorMapReplaceAddress', &__cuTensorMapReplaceAddress, 12000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuDeviceCanAccessPeer' in found_functions}} - global __cuDeviceCanAccessPeer - cuGetProcAddress('cuDeviceCanAccessPeer', &__cuDeviceCanAccessPeer, 4000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuCtxEnablePeerAccess' in found_functions}} - global __cuCtxEnablePeerAccess - cuGetProcAddress('cuCtxEnablePeerAccess', &__cuCtxEnablePeerAccess, 4000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuCtxDisablePeerAccess' in found_functions}} - global __cuCtxDisablePeerAccess - cuGetProcAddress('cuCtxDisablePeerAccess', &__cuCtxDisablePeerAccess, 4000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuDeviceGetP2PAttribute' in found_functions}} - global __cuDeviceGetP2PAttribute - cuGetProcAddress('cuDeviceGetP2PAttribute', &__cuDeviceGetP2PAttribute, 8000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphicsUnregisterResource' in found_functions}} - global __cuGraphicsUnregisterResource - cuGetProcAddress('cuGraphicsUnregisterResource', &__cuGraphicsUnregisterResource, 3000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphicsSubResourceGetMappedArray' in found_functions}} - global __cuGraphicsSubResourceGetMappedArray - cuGetProcAddress('cuGraphicsSubResourceGetMappedArray', &__cuGraphicsSubResourceGetMappedArray, 3000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphicsResourceGetMappedMipmappedArray' in found_functions}} - global __cuGraphicsResourceGetMappedMipmappedArray - cuGetProcAddress('cuGraphicsResourceGetMappedMipmappedArray', &__cuGraphicsResourceGetMappedMipmappedArray, 5000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphicsResourceGetMappedPointer_v2' in found_functions}} - global __cuGraphicsResourceGetMappedPointer_v2 - cuGetProcAddress('cuGraphicsResourceGetMappedPointer', &__cuGraphicsResourceGetMappedPointer_v2, 3020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGraphicsResourceSetMapFlags_v2' in found_functions}} - global __cuGraphicsResourceSetMapFlags_v2 - cuGetProcAddress('cuGraphicsResourceSetMapFlags', &__cuGraphicsResourceSetMapFlags_v2, 6050, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGetProcAddress_v2' in found_functions}} - global __cuGetProcAddress_v2 - cuGetProcAddress('cuGetProcAddress', &__cuGetProcAddress_v2, 12000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuCoredumpGetAttribute' in found_functions}} - global __cuCoredumpGetAttribute - cuGetProcAddress('cuCoredumpGetAttribute', &__cuCoredumpGetAttribute, 12010, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuCoredumpGetAttributeGlobal' in found_functions}} - global __cuCoredumpGetAttributeGlobal - cuGetProcAddress('cuCoredumpGetAttributeGlobal', &__cuCoredumpGetAttributeGlobal, 12010, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuCoredumpSetAttribute' in found_functions}} - global __cuCoredumpSetAttribute - cuGetProcAddress('cuCoredumpSetAttribute', &__cuCoredumpSetAttribute, 12010, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuCoredumpSetAttributeGlobal' in found_functions}} - global __cuCoredumpSetAttributeGlobal - cuGetProcAddress('cuCoredumpSetAttributeGlobal', &__cuCoredumpSetAttributeGlobal, 12010, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGetExportTable' in found_functions}} - global __cuGetExportTable - cuGetProcAddress('cuGetExportTable', &__cuGetExportTable, 3000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGreenCtxCreate' in found_functions}} - global __cuGreenCtxCreate - cuGetProcAddress('cuGreenCtxCreate', &__cuGreenCtxCreate, 12040, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGreenCtxDestroy' in found_functions}} - global __cuGreenCtxDestroy - cuGetProcAddress('cuGreenCtxDestroy', &__cuGreenCtxDestroy, 12040, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuCtxFromGreenCtx' in found_functions}} - global __cuCtxFromGreenCtx - cuGetProcAddress('cuCtxFromGreenCtx', &__cuCtxFromGreenCtx, 12040, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuDeviceGetDevResource' in found_functions}} - global __cuDeviceGetDevResource - cuGetProcAddress('cuDeviceGetDevResource', &__cuDeviceGetDevResource, 12040, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuCtxGetDevResource' in found_functions}} - global __cuCtxGetDevResource - cuGetProcAddress('cuCtxGetDevResource', &__cuCtxGetDevResource, 12040, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGreenCtxGetDevResource' in found_functions}} - global __cuGreenCtxGetDevResource - cuGetProcAddress('cuGreenCtxGetDevResource', &__cuGreenCtxGetDevResource, 12040, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuDevSmResourceSplitByCount' in found_functions}} - global __cuDevSmResourceSplitByCount - cuGetProcAddress('cuDevSmResourceSplitByCount', &__cuDevSmResourceSplitByCount, 12040, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuDevResourceGenerateDesc' in found_functions}} - global __cuDevResourceGenerateDesc - cuGetProcAddress('cuDevResourceGenerateDesc', &__cuDevResourceGenerateDesc, 12040, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGreenCtxRecordEvent' in found_functions}} - global __cuGreenCtxRecordEvent - cuGetProcAddress('cuGreenCtxRecordEvent', &__cuGreenCtxRecordEvent, 12040, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGreenCtxWaitEvent' in found_functions}} - global __cuGreenCtxWaitEvent - cuGetProcAddress('cuGreenCtxWaitEvent', &__cuGreenCtxWaitEvent, 12040, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuStreamGetGreenCtx' in found_functions}} - global __cuStreamGetGreenCtx - cuGetProcAddress('cuStreamGetGreenCtx', &__cuStreamGetGreenCtx, 12040, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuGreenCtxStreamCreate' in found_functions}} - global __cuGreenCtxStreamCreate - cuGetProcAddress('cuGreenCtxStreamCreate', &__cuGreenCtxStreamCreate, 12050, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuProfilerStart' in found_functions}} - global __cuProfilerStart - cuGetProcAddress('cuProfilerStart', &__cuProfilerStart, 4000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if 'cuProfilerStop' in found_functions}} - global __cuProfilerStop - cuGetProcAddress('cuProfilerStop', &__cuProfilerStop, 4000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if True}} - global __cuGraphicsEGLRegisterImage - cuGetProcAddress('cuGraphicsEGLRegisterImage', &__cuGraphicsEGLRegisterImage, 7000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if True}} - global __cuEGLStreamConsumerConnect - cuGetProcAddress('cuEGLStreamConsumerConnect', &__cuEGLStreamConsumerConnect, 7000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if True}} - global __cuEGLStreamConsumerConnectWithFlags - cuGetProcAddress('cuEGLStreamConsumerConnectWithFlags', &__cuEGLStreamConsumerConnectWithFlags, 8000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if True}} - global __cuEGLStreamConsumerDisconnect - cuGetProcAddress('cuEGLStreamConsumerDisconnect', &__cuEGLStreamConsumerDisconnect, 7000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if True}} - global __cuEGLStreamConsumerAcquireFrame - cuGetProcAddress('cuEGLStreamConsumerAcquireFrame', &__cuEGLStreamConsumerAcquireFrame, 7000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if True}} - global __cuEGLStreamConsumerReleaseFrame - cuGetProcAddress('cuEGLStreamConsumerReleaseFrame', &__cuEGLStreamConsumerReleaseFrame, 7000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if True}} - global __cuEGLStreamProducerConnect - cuGetProcAddress('cuEGLStreamProducerConnect', &__cuEGLStreamProducerConnect, 7000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if True}} - global __cuEGLStreamProducerDisconnect - cuGetProcAddress('cuEGLStreamProducerDisconnect', &__cuEGLStreamProducerDisconnect, 7000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if True}} - global __cuEGLStreamProducerPresentFrame - cuGetProcAddress('cuEGLStreamProducerPresentFrame', &__cuEGLStreamProducerPresentFrame, 7000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if True}} - global __cuEGLStreamProducerReturnFrame - cuGetProcAddress('cuEGLStreamProducerReturnFrame', &__cuEGLStreamProducerReturnFrame, 7000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if True}} - global __cuGraphicsResourceGetMappedEglFrame - cuGetProcAddress('cuGraphicsResourceGetMappedEglFrame', &__cuGraphicsResourceGetMappedEglFrame, 7000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if True}} - global __cuEventCreateFromEGLSync - cuGetProcAddress('cuEventCreateFromEGLSync', &__cuEventCreateFromEGLSync, 9000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if True}} - global __cuGraphicsGLRegisterBuffer - cuGetProcAddress('cuGraphicsGLRegisterBuffer', &__cuGraphicsGLRegisterBuffer, 3000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if True}} - global __cuGraphicsGLRegisterImage - cuGetProcAddress('cuGraphicsGLRegisterImage', &__cuGraphicsGLRegisterImage, 3000, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if True}} - global __cuGLGetDevices_v2 - cuGetProcAddress('cuGLGetDevices', &__cuGLGetDevices_v2, 6050, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if True}} - global __cuVDPAUGetDevice - cuGetProcAddress('cuVDPAUGetDevice', &__cuVDPAUGetDevice, 3010, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if True}} - global __cuVDPAUCtxCreate_v2 - cuGetProcAddress('cuVDPAUCtxCreate', &__cuVDPAUCtxCreate_v2, 3020, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if True}} - global __cuGraphicsVDPAURegisterVideoSurface - cuGetProcAddress('cuGraphicsVDPAURegisterVideoSurface', &__cuGraphicsVDPAURegisterVideoSurface, 3010, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - {{if True}} - global __cuGraphicsVDPAURegisterOutputSurface - cuGetProcAddress('cuGraphicsVDPAURegisterOutputSurface', &__cuGraphicsVDPAURegisterOutputSurface, 3010, CU_GET_PROC_ADDRESS_DEFAULT, NULL) - {{endif}} - return 0 - - {{if 'Windows' == platform.system()}} - # Load using win32GetAddr - with gil: - if usePTDS: - # Get all PTDS version of functions - pass - {{if 'cuMemcpy' in found_functions}} - try: - global __cuMemcpy - __cuMemcpy = win32api.GetProcAddress(handle, 'cuMemcpy_ptds') - except: - pass - {{endif}} - {{if 'cuMemcpyPeer' in found_functions}} - try: - global __cuMemcpyPeer - __cuMemcpyPeer = win32api.GetProcAddress(handle, 'cuMemcpyPeer_ptds') - except: - pass - {{endif}} - {{if 'cuMemcpyHtoD_v2' in found_functions}} - try: - global __cuMemcpyHtoD_v2 - __cuMemcpyHtoD_v2 = win32api.GetProcAddress(handle, 'cuMemcpyHtoD_v2_ptds') - except: - pass - {{endif}} - {{if 'cuMemcpyDtoH_v2' in found_functions}} - try: - global __cuMemcpyDtoH_v2 - __cuMemcpyDtoH_v2 = win32api.GetProcAddress(handle, 'cuMemcpyDtoH_v2_ptds') - except: - pass - {{endif}} - {{if 'cuMemcpyDtoD_v2' in found_functions}} - try: - global __cuMemcpyDtoD_v2 - __cuMemcpyDtoD_v2 = win32api.GetProcAddress(handle, 'cuMemcpyDtoD_v2_ptds') - except: - pass - {{endif}} - {{if 'cuMemcpyDtoA_v2' in found_functions}} - try: - global __cuMemcpyDtoA_v2 - __cuMemcpyDtoA_v2 = win32api.GetProcAddress(handle, 'cuMemcpyDtoA_v2_ptds') - except: - pass - {{endif}} - {{if 'cuMemcpyAtoD_v2' in found_functions}} - try: - global __cuMemcpyAtoD_v2 - __cuMemcpyAtoD_v2 = win32api.GetProcAddress(handle, 'cuMemcpyAtoD_v2_ptds') - except: - pass - {{endif}} - {{if 'cuMemcpyHtoA_v2' in found_functions}} - try: - global __cuMemcpyHtoA_v2 - __cuMemcpyHtoA_v2 = win32api.GetProcAddress(handle, 'cuMemcpyHtoA_v2_ptds') - except: - pass - {{endif}} - {{if 'cuMemcpyAtoH_v2' in found_functions}} - try: - global __cuMemcpyAtoH_v2 - __cuMemcpyAtoH_v2 = win32api.GetProcAddress(handle, 'cuMemcpyAtoH_v2_ptds') - except: - pass - {{endif}} - {{if 'cuMemcpyAtoA_v2' in found_functions}} - try: - global __cuMemcpyAtoA_v2 - __cuMemcpyAtoA_v2 = win32api.GetProcAddress(handle, 'cuMemcpyAtoA_v2_ptds') - except: - pass - {{endif}} - {{if 'cuMemcpy2D_v2' in found_functions}} - try: - global __cuMemcpy2D_v2 - __cuMemcpy2D_v2 = win32api.GetProcAddress(handle, 'cuMemcpy2D_v2_ptds') - except: - pass - {{endif}} - {{if 'cuMemcpy2DUnaligned_v2' in found_functions}} - try: - global __cuMemcpy2DUnaligned_v2 - __cuMemcpy2DUnaligned_v2 = win32api.GetProcAddress(handle, 'cuMemcpy2DUnaligned_v2_ptds') - except: - pass - {{endif}} - {{if 'cuMemcpy3D_v2' in found_functions}} - try: - global __cuMemcpy3D_v2 - __cuMemcpy3D_v2 = win32api.GetProcAddress(handle, 'cuMemcpy3D_v2_ptds') - except: - pass - {{endif}} - {{if 'cuMemcpy3DPeer' in found_functions}} - try: - global __cuMemcpy3DPeer - __cuMemcpy3DPeer = win32api.GetProcAddress(handle, 'cuMemcpy3DPeer_ptds') - except: - pass - {{endif}} - {{if 'cuMemcpyAsync' in found_functions}} - try: - global __cuMemcpyAsync - __cuMemcpyAsync = win32api.GetProcAddress(handle, 'cuMemcpyAsync_ptsz') - except: - pass - {{endif}} - {{if 'cuMemcpyPeerAsync' in found_functions}} - try: - global __cuMemcpyPeerAsync - __cuMemcpyPeerAsync = win32api.GetProcAddress(handle, 'cuMemcpyPeerAsync_ptsz') - except: - pass - {{endif}} - {{if 'cuMemcpyHtoDAsync_v2' in found_functions}} - try: - global __cuMemcpyHtoDAsync_v2 - __cuMemcpyHtoDAsync_v2 = win32api.GetProcAddress(handle, 'cuMemcpyHtoDAsync_v2_ptsz') - except: - pass - {{endif}} - {{if 'cuMemcpyDtoHAsync_v2' in found_functions}} - try: - global __cuMemcpyDtoHAsync_v2 - __cuMemcpyDtoHAsync_v2 = win32api.GetProcAddress(handle, 'cuMemcpyDtoHAsync_v2_ptsz') - except: - pass - {{endif}} - {{if 'cuMemcpyDtoDAsync_v2' in found_functions}} - try: - global __cuMemcpyDtoDAsync_v2 - __cuMemcpyDtoDAsync_v2 = win32api.GetProcAddress(handle, 'cuMemcpyDtoDAsync_v2_ptsz') - except: - pass - {{endif}} - {{if 'cuMemcpyHtoAAsync_v2' in found_functions}} - try: - global __cuMemcpyHtoAAsync_v2 - __cuMemcpyHtoAAsync_v2 = win32api.GetProcAddress(handle, 'cuMemcpyHtoAAsync_v2_ptsz') - except: - pass - {{endif}} - {{if 'cuMemcpyAtoHAsync_v2' in found_functions}} - try: - global __cuMemcpyAtoHAsync_v2 - __cuMemcpyAtoHAsync_v2 = win32api.GetProcAddress(handle, 'cuMemcpyAtoHAsync_v2_ptsz') - except: - pass - {{endif}} - {{if 'cuMemcpy2DAsync_v2' in found_functions}} - try: - global __cuMemcpy2DAsync_v2 - __cuMemcpy2DAsync_v2 = win32api.GetProcAddress(handle, 'cuMemcpy2DAsync_v2_ptsz') - except: - pass - {{endif}} - {{if 'cuMemcpy3DAsync_v2' in found_functions}} - try: - global __cuMemcpy3DAsync_v2 - __cuMemcpy3DAsync_v2 = win32api.GetProcAddress(handle, 'cuMemcpy3DAsync_v2_ptsz') - except: - pass - {{endif}} - {{if 'cuMemcpy3DPeerAsync' in found_functions}} - try: - global __cuMemcpy3DPeerAsync - __cuMemcpy3DPeerAsync = win32api.GetProcAddress(handle, 'cuMemcpy3DPeerAsync_ptsz') - except: - pass - {{endif}} - {{if 'cuMemsetD8_v2' in found_functions}} - try: - global __cuMemsetD8_v2 - __cuMemsetD8_v2 = win32api.GetProcAddress(handle, 'cuMemsetD8_v2_ptds') - except: - pass - {{endif}} - {{if 'cuMemsetD16_v2' in found_functions}} - try: - global __cuMemsetD16_v2 - __cuMemsetD16_v2 = win32api.GetProcAddress(handle, 'cuMemsetD16_v2_ptds') - except: - pass - {{endif}} - {{if 'cuMemsetD32_v2' in found_functions}} - try: - global __cuMemsetD32_v2 - __cuMemsetD32_v2 = win32api.GetProcAddress(handle, 'cuMemsetD32_v2_ptds') - except: - pass - {{endif}} - {{if 'cuMemsetD2D8_v2' in found_functions}} - try: - global __cuMemsetD2D8_v2 - __cuMemsetD2D8_v2 = win32api.GetProcAddress(handle, 'cuMemsetD2D8_v2_ptds') - except: - pass - {{endif}} - {{if 'cuMemsetD2D16_v2' in found_functions}} - try: - global __cuMemsetD2D16_v2 - __cuMemsetD2D16_v2 = win32api.GetProcAddress(handle, 'cuMemsetD2D16_v2_ptds') - except: - pass - {{endif}} - {{if 'cuMemsetD2D32_v2' in found_functions}} - try: - global __cuMemsetD2D32_v2 - __cuMemsetD2D32_v2 = win32api.GetProcAddress(handle, 'cuMemsetD2D32_v2_ptds') - except: - pass - {{endif}} - {{if 'cuMemsetD8Async' in found_functions}} - try: - global __cuMemsetD8Async - __cuMemsetD8Async = win32api.GetProcAddress(handle, 'cuMemsetD8Async_ptsz') - except: - pass - {{endif}} - {{if 'cuMemsetD16Async' in found_functions}} - try: - global __cuMemsetD16Async - __cuMemsetD16Async = win32api.GetProcAddress(handle, 'cuMemsetD16Async_ptsz') - except: - pass - {{endif}} - {{if 'cuMemsetD32Async' in found_functions}} - try: - global __cuMemsetD32Async - __cuMemsetD32Async = win32api.GetProcAddress(handle, 'cuMemsetD32Async_ptsz') - except: - pass - {{endif}} - {{if 'cuMemsetD2D8Async' in found_functions}} - try: - global __cuMemsetD2D8Async - __cuMemsetD2D8Async = win32api.GetProcAddress(handle, 'cuMemsetD2D8Async_ptsz') - except: - pass - {{endif}} - {{if 'cuMemsetD2D16Async' in found_functions}} - try: - global __cuMemsetD2D16Async - __cuMemsetD2D16Async = win32api.GetProcAddress(handle, 'cuMemsetD2D16Async_ptsz') - except: - pass - {{endif}} - {{if 'cuMemsetD2D32Async' in found_functions}} - try: - global __cuMemsetD2D32Async - __cuMemsetD2D32Async = win32api.GetProcAddress(handle, 'cuMemsetD2D32Async_ptsz') - except: - pass - {{endif}} - {{if 'cuMemMapArrayAsync' in found_functions}} - try: - global __cuMemMapArrayAsync - __cuMemMapArrayAsync = win32api.GetProcAddress(handle, 'cuMemMapArrayAsync_ptsz') - except: - pass - {{endif}} - {{if 'cuMemFreeAsync' in found_functions}} - try: - global __cuMemFreeAsync - __cuMemFreeAsync = win32api.GetProcAddress(handle, 'cuMemFreeAsync_ptsz') - except: - pass - {{endif}} - {{if 'cuMemAllocAsync' in found_functions}} - try: - global __cuMemAllocAsync - __cuMemAllocAsync = win32api.GetProcAddress(handle, 'cuMemAllocAsync_ptsz') - except: - pass - {{endif}} - {{if 'cuMemAllocFromPoolAsync' in found_functions}} - try: - global __cuMemAllocFromPoolAsync - __cuMemAllocFromPoolAsync = win32api.GetProcAddress(handle, 'cuMemAllocFromPoolAsync_ptsz') - except: - pass - {{endif}} - {{if 'cuMemPrefetchAsync' in found_functions}} - try: - global __cuMemPrefetchAsync - __cuMemPrefetchAsync = win32api.GetProcAddress(handle, 'cuMemPrefetchAsync_ptsz') - except: - pass - {{endif}} - {{if 'cuMemPrefetchAsync_v2' in found_functions}} - try: - global __cuMemPrefetchAsync_v2 - __cuMemPrefetchAsync_v2 = win32api.GetProcAddress(handle, 'cuMemPrefetchAsync_v2_ptsz') - except: - pass - {{endif}} - {{if 'cuStreamGetPriority' in found_functions}} - try: - global __cuStreamGetPriority - __cuStreamGetPriority = win32api.GetProcAddress(handle, 'cuStreamGetPriority_ptsz') - except: - pass - {{endif}} - {{if 'cuStreamGetFlags' in found_functions}} - try: - global __cuStreamGetFlags - __cuStreamGetFlags = win32api.GetProcAddress(handle, 'cuStreamGetFlags_ptsz') - except: - pass - {{endif}} - {{if 'cuStreamGetId' in found_functions}} - try: - global __cuStreamGetId - __cuStreamGetId = win32api.GetProcAddress(handle, 'cuStreamGetId_ptsz') - except: - pass - {{endif}} - {{if 'cuStreamGetCtx' in found_functions}} - try: - global __cuStreamGetCtx - __cuStreamGetCtx = win32api.GetProcAddress(handle, 'cuStreamGetCtx_ptsz') - except: - pass - {{endif}} - {{if 'cuStreamGetCtx_v2' in found_functions}} - try: - global __cuStreamGetCtx_v2 - __cuStreamGetCtx_v2 = win32api.GetProcAddress(handle, 'cuStreamGetCtx_v2_ptsz') - except: - pass - {{endif}} - {{if 'cuStreamWaitEvent' in found_functions}} - try: - global __cuStreamWaitEvent - __cuStreamWaitEvent = win32api.GetProcAddress(handle, 'cuStreamWaitEvent_ptsz') - except: - pass - {{endif}} - {{if 'cuStreamAddCallback' in found_functions}} - try: - global __cuStreamAddCallback - __cuStreamAddCallback = win32api.GetProcAddress(handle, 'cuStreamAddCallback_ptsz') - except: - pass - {{endif}} - {{if 'cuStreamBeginCapture_v2' in found_functions}} - try: - global __cuStreamBeginCapture_v2 - __cuStreamBeginCapture_v2 = win32api.GetProcAddress(handle, 'cuStreamBeginCapture_v2_ptsz') - except: - pass - {{endif}} - {{if 'cuStreamBeginCaptureToGraph' in found_functions}} - try: - global __cuStreamBeginCaptureToGraph - __cuStreamBeginCaptureToGraph = win32api.GetProcAddress(handle, 'cuStreamBeginCaptureToGraph_ptsz') - except: - pass - {{endif}} - {{if 'cuStreamEndCapture' in found_functions}} - try: - global __cuStreamEndCapture - __cuStreamEndCapture = win32api.GetProcAddress(handle, 'cuStreamEndCapture_ptsz') - except: - pass - {{endif}} - {{if 'cuStreamIsCapturing' in found_functions}} - try: - global __cuStreamIsCapturing - __cuStreamIsCapturing = win32api.GetProcAddress(handle, 'cuStreamIsCapturing_ptsz') - except: - pass - {{endif}} - {{if 'cuStreamGetCaptureInfo_v2' in found_functions}} - try: - global __cuStreamGetCaptureInfo_v2 - __cuStreamGetCaptureInfo_v2 = win32api.GetProcAddress(handle, 'cuStreamGetCaptureInfo_v2_ptsz') - except: - pass - {{endif}} - {{if 'cuStreamGetCaptureInfo_v3' in found_functions}} - try: - global __cuStreamGetCaptureInfo_v3 - __cuStreamGetCaptureInfo_v3 = win32api.GetProcAddress(handle, 'cuStreamGetCaptureInfo_v3_ptsz') - except: - pass - {{endif}} - {{if 'cuStreamUpdateCaptureDependencies' in found_functions}} - try: - global __cuStreamUpdateCaptureDependencies - __cuStreamUpdateCaptureDependencies = win32api.GetProcAddress(handle, 'cuStreamUpdateCaptureDependencies_ptsz') - except: - pass - {{endif}} - {{if 'cuStreamUpdateCaptureDependencies_v2' in found_functions}} - try: - global __cuStreamUpdateCaptureDependencies_v2 - __cuStreamUpdateCaptureDependencies_v2 = win32api.GetProcAddress(handle, 'cuStreamUpdateCaptureDependencies_v2_ptsz') - except: - pass - {{endif}} - {{if 'cuStreamAttachMemAsync' in found_functions}} - try: - global __cuStreamAttachMemAsync - __cuStreamAttachMemAsync = win32api.GetProcAddress(handle, 'cuStreamAttachMemAsync_ptsz') - except: - pass - {{endif}} - {{if 'cuStreamQuery' in found_functions}} - try: - global __cuStreamQuery - __cuStreamQuery = win32api.GetProcAddress(handle, 'cuStreamQuery_ptsz') - except: - pass - {{endif}} - {{if 'cuStreamSynchronize' in found_functions}} - try: - global __cuStreamSynchronize - __cuStreamSynchronize = win32api.GetProcAddress(handle, 'cuStreamSynchronize_ptsz') - except: - pass - {{endif}} - {{if 'cuStreamCopyAttributes' in found_functions}} - try: - global __cuStreamCopyAttributes - __cuStreamCopyAttributes = win32api.GetProcAddress(handle, 'cuStreamCopyAttributes_ptsz') - except: - pass - {{endif}} - {{if 'cuStreamGetAttribute' in found_functions}} - try: - global __cuStreamGetAttribute - __cuStreamGetAttribute = win32api.GetProcAddress(handle, 'cuStreamGetAttribute_ptsz') - except: - pass - {{endif}} - {{if 'cuStreamSetAttribute' in found_functions}} - try: - global __cuStreamSetAttribute - __cuStreamSetAttribute = win32api.GetProcAddress(handle, 'cuStreamSetAttribute_ptsz') - except: - pass - {{endif}} - {{if 'cuEventRecord' in found_functions}} - try: - global __cuEventRecord - __cuEventRecord = win32api.GetProcAddress(handle, 'cuEventRecord_ptsz') - except: - pass - {{endif}} - {{if 'cuEventRecordWithFlags' in found_functions}} - try: - global __cuEventRecordWithFlags - __cuEventRecordWithFlags = win32api.GetProcAddress(handle, 'cuEventRecordWithFlags_ptsz') - except: - pass - {{endif}} - {{if 'cuSignalExternalSemaphoresAsync' in found_functions}} - try: - global __cuSignalExternalSemaphoresAsync - __cuSignalExternalSemaphoresAsync = win32api.GetProcAddress(handle, 'cuSignalExternalSemaphoresAsync_ptsz') - except: - pass - {{endif}} - {{if 'cuWaitExternalSemaphoresAsync' in found_functions}} - try: - global __cuWaitExternalSemaphoresAsync - __cuWaitExternalSemaphoresAsync = win32api.GetProcAddress(handle, 'cuWaitExternalSemaphoresAsync_ptsz') - except: - pass - {{endif}} - {{if 'cuStreamWaitValue32_v2' in found_functions}} - try: - global __cuStreamWaitValue32_v2 - __cuStreamWaitValue32_v2 = win32api.GetProcAddress(handle, 'cuStreamWaitValue32_v2_ptsz') - except: - pass - {{endif}} - {{if 'cuStreamWaitValue64_v2' in found_functions}} - try: - global __cuStreamWaitValue64_v2 - __cuStreamWaitValue64_v2 = win32api.GetProcAddress(handle, 'cuStreamWaitValue64_v2_ptsz') - except: - pass - {{endif}} - {{if 'cuStreamWriteValue32_v2' in found_functions}} - try: - global __cuStreamWriteValue32_v2 - __cuStreamWriteValue32_v2 = win32api.GetProcAddress(handle, 'cuStreamWriteValue32_v2_ptsz') - except: - pass - {{endif}} - {{if 'cuStreamWriteValue64_v2' in found_functions}} - try: - global __cuStreamWriteValue64_v2 - __cuStreamWriteValue64_v2 = win32api.GetProcAddress(handle, 'cuStreamWriteValue64_v2_ptsz') - except: - pass - {{endif}} - {{if 'cuStreamBatchMemOp_v2' in found_functions}} - try: - global __cuStreamBatchMemOp_v2 - __cuStreamBatchMemOp_v2 = win32api.GetProcAddress(handle, 'cuStreamBatchMemOp_v2_ptsz') - except: - pass - {{endif}} - {{if 'cuLaunchKernel' in found_functions}} - try: - global __cuLaunchKernel - __cuLaunchKernel = win32api.GetProcAddress(handle, 'cuLaunchKernel_ptsz') - except: - pass - {{endif}} - {{if 'cuLaunchKernelEx' in found_functions}} - try: - global __cuLaunchKernelEx - __cuLaunchKernelEx = win32api.GetProcAddress(handle, 'cuLaunchKernelEx_ptsz') - except: - pass - {{endif}} - {{if 'cuLaunchCooperativeKernel' in found_functions}} - try: - global __cuLaunchCooperativeKernel - __cuLaunchCooperativeKernel = win32api.GetProcAddress(handle, 'cuLaunchCooperativeKernel_ptsz') - except: - pass - {{endif}} - {{if 'cuLaunchHostFunc' in found_functions}} - try: - global __cuLaunchHostFunc - __cuLaunchHostFunc = win32api.GetProcAddress(handle, 'cuLaunchHostFunc_ptsz') - except: - pass - {{endif}} - {{if 'cuGraphInstantiateWithParams' in found_functions}} - try: - global __cuGraphInstantiateWithParams - __cuGraphInstantiateWithParams = win32api.GetProcAddress(handle, 'cuGraphInstantiateWithParams_ptsz') - except: - pass - {{endif}} - {{if 'cuGraphUpload' in found_functions}} - try: - global __cuGraphUpload - __cuGraphUpload = win32api.GetProcAddress(handle, 'cuGraphUpload_ptsz') - except: - pass - {{endif}} - {{if 'cuGraphLaunch' in found_functions}} - try: - global __cuGraphLaunch - __cuGraphLaunch = win32api.GetProcAddress(handle, 'cuGraphLaunch_ptsz') - except: - pass - {{endif}} - {{if 'cuGraphicsMapResources' in found_functions}} - try: - global __cuGraphicsMapResources - __cuGraphicsMapResources = win32api.GetProcAddress(handle, 'cuGraphicsMapResources_ptsz') - except: - pass - {{endif}} - {{if 'cuGraphicsUnmapResources' in found_functions}} - try: - global __cuGraphicsUnmapResources - __cuGraphicsUnmapResources = win32api.GetProcAddress(handle, 'cuGraphicsUnmapResources_ptsz') - except: - pass - {{endif}} - else: - # Else get the regular version - pass - {{if 'cuMemcpy' in found_functions}} - try: - global __cuMemcpy - __cuMemcpy = win32api.GetProcAddress(handle, 'cuMemcpy') - except: - pass - {{endif}} - {{if 'cuMemcpyPeer' in found_functions}} - try: - global __cuMemcpyPeer - __cuMemcpyPeer = win32api.GetProcAddress(handle, 'cuMemcpyPeer') - except: - pass - {{endif}} - {{if 'cuMemcpyHtoD_v2' in found_functions}} - try: - global __cuMemcpyHtoD_v2 - __cuMemcpyHtoD_v2 = win32api.GetProcAddress(handle, 'cuMemcpyHtoD_v2') - except: - pass - {{endif}} - {{if 'cuMemcpyDtoH_v2' in found_functions}} - try: - global __cuMemcpyDtoH_v2 - __cuMemcpyDtoH_v2 = win32api.GetProcAddress(handle, 'cuMemcpyDtoH_v2') - except: - pass - {{endif}} - {{if 'cuMemcpyDtoD_v2' in found_functions}} - try: - global __cuMemcpyDtoD_v2 - __cuMemcpyDtoD_v2 = win32api.GetProcAddress(handle, 'cuMemcpyDtoD_v2') - except: - pass - {{endif}} - {{if 'cuMemcpyDtoA_v2' in found_functions}} - try: - global __cuMemcpyDtoA_v2 - __cuMemcpyDtoA_v2 = win32api.GetProcAddress(handle, 'cuMemcpyDtoA_v2') - except: - pass - {{endif}} - {{if 'cuMemcpyAtoD_v2' in found_functions}} - try: - global __cuMemcpyAtoD_v2 - __cuMemcpyAtoD_v2 = win32api.GetProcAddress(handle, 'cuMemcpyAtoD_v2') - except: - pass - {{endif}} - {{if 'cuMemcpyHtoA_v2' in found_functions}} - try: - global __cuMemcpyHtoA_v2 - __cuMemcpyHtoA_v2 = win32api.GetProcAddress(handle, 'cuMemcpyHtoA_v2') - except: - pass - {{endif}} - {{if 'cuMemcpyAtoH_v2' in found_functions}} - try: - global __cuMemcpyAtoH_v2 - __cuMemcpyAtoH_v2 = win32api.GetProcAddress(handle, 'cuMemcpyAtoH_v2') - except: - pass - {{endif}} - {{if 'cuMemcpyAtoA_v2' in found_functions}} - try: - global __cuMemcpyAtoA_v2 - __cuMemcpyAtoA_v2 = win32api.GetProcAddress(handle, 'cuMemcpyAtoA_v2') - except: - pass - {{endif}} - {{if 'cuMemcpy2D_v2' in found_functions}} - try: - global __cuMemcpy2D_v2 - __cuMemcpy2D_v2 = win32api.GetProcAddress(handle, 'cuMemcpy2D_v2') - except: - pass - {{endif}} - {{if 'cuMemcpy2DUnaligned_v2' in found_functions}} - try: - global __cuMemcpy2DUnaligned_v2 - __cuMemcpy2DUnaligned_v2 = win32api.GetProcAddress(handle, 'cuMemcpy2DUnaligned_v2') - except: - pass - {{endif}} - {{if 'cuMemcpy3D_v2' in found_functions}} - try: - global __cuMemcpy3D_v2 - __cuMemcpy3D_v2 = win32api.GetProcAddress(handle, 'cuMemcpy3D_v2') - except: - pass - {{endif}} - {{if 'cuMemcpy3DPeer' in found_functions}} - try: - global __cuMemcpy3DPeer - __cuMemcpy3DPeer = win32api.GetProcAddress(handle, 'cuMemcpy3DPeer') - except: - pass - {{endif}} - {{if 'cuMemcpyAsync' in found_functions}} - try: - global __cuMemcpyAsync - __cuMemcpyAsync = win32api.GetProcAddress(handle, 'cuMemcpyAsync') - except: - pass - {{endif}} - {{if 'cuMemcpyPeerAsync' in found_functions}} - try: - global __cuMemcpyPeerAsync - __cuMemcpyPeerAsync = win32api.GetProcAddress(handle, 'cuMemcpyPeerAsync') - except: - pass - {{endif}} - {{if 'cuMemcpyHtoDAsync_v2' in found_functions}} - try: - global __cuMemcpyHtoDAsync_v2 - __cuMemcpyHtoDAsync_v2 = win32api.GetProcAddress(handle, 'cuMemcpyHtoDAsync_v2') - except: - pass - {{endif}} - {{if 'cuMemcpyDtoHAsync_v2' in found_functions}} - try: - global __cuMemcpyDtoHAsync_v2 - __cuMemcpyDtoHAsync_v2 = win32api.GetProcAddress(handle, 'cuMemcpyDtoHAsync_v2') - except: - pass - {{endif}} - {{if 'cuMemcpyDtoDAsync_v2' in found_functions}} - try: - global __cuMemcpyDtoDAsync_v2 - __cuMemcpyDtoDAsync_v2 = win32api.GetProcAddress(handle, 'cuMemcpyDtoDAsync_v2') - except: - pass - {{endif}} - {{if 'cuMemcpyHtoAAsync_v2' in found_functions}} - try: - global __cuMemcpyHtoAAsync_v2 - __cuMemcpyHtoAAsync_v2 = win32api.GetProcAddress(handle, 'cuMemcpyHtoAAsync_v2') - except: - pass - {{endif}} - {{if 'cuMemcpyAtoHAsync_v2' in found_functions}} - try: - global __cuMemcpyAtoHAsync_v2 - __cuMemcpyAtoHAsync_v2 = win32api.GetProcAddress(handle, 'cuMemcpyAtoHAsync_v2') - except: - pass - {{endif}} - {{if 'cuMemcpy2DAsync_v2' in found_functions}} - try: - global __cuMemcpy2DAsync_v2 - __cuMemcpy2DAsync_v2 = win32api.GetProcAddress(handle, 'cuMemcpy2DAsync_v2') - except: - pass - {{endif}} - {{if 'cuMemcpy3DAsync_v2' in found_functions}} - try: - global __cuMemcpy3DAsync_v2 - __cuMemcpy3DAsync_v2 = win32api.GetProcAddress(handle, 'cuMemcpy3DAsync_v2') - except: - pass - {{endif}} - {{if 'cuMemcpy3DPeerAsync' in found_functions}} - try: - global __cuMemcpy3DPeerAsync - __cuMemcpy3DPeerAsync = win32api.GetProcAddress(handle, 'cuMemcpy3DPeerAsync') - except: - pass - {{endif}} - {{if 'cuMemsetD8_v2' in found_functions}} - try: - global __cuMemsetD8_v2 - __cuMemsetD8_v2 = win32api.GetProcAddress(handle, 'cuMemsetD8_v2') - except: - pass - {{endif}} - {{if 'cuMemsetD16_v2' in found_functions}} - try: - global __cuMemsetD16_v2 - __cuMemsetD16_v2 = win32api.GetProcAddress(handle, 'cuMemsetD16_v2') - except: - pass - {{endif}} - {{if 'cuMemsetD32_v2' in found_functions}} - try: - global __cuMemsetD32_v2 - __cuMemsetD32_v2 = win32api.GetProcAddress(handle, 'cuMemsetD32_v2') - except: - pass - {{endif}} - {{if 'cuMemsetD2D8_v2' in found_functions}} - try: - global __cuMemsetD2D8_v2 - __cuMemsetD2D8_v2 = win32api.GetProcAddress(handle, 'cuMemsetD2D8_v2') - except: - pass - {{endif}} - {{if 'cuMemsetD2D16_v2' in found_functions}} - try: - global __cuMemsetD2D16_v2 - __cuMemsetD2D16_v2 = win32api.GetProcAddress(handle, 'cuMemsetD2D16_v2') - except: - pass - {{endif}} - {{if 'cuMemsetD2D32_v2' in found_functions}} - try: - global __cuMemsetD2D32_v2 - __cuMemsetD2D32_v2 = win32api.GetProcAddress(handle, 'cuMemsetD2D32_v2') - except: - pass - {{endif}} - {{if 'cuMemsetD8Async' in found_functions}} - try: - global __cuMemsetD8Async - __cuMemsetD8Async = win32api.GetProcAddress(handle, 'cuMemsetD8Async') - except: - pass - {{endif}} - {{if 'cuMemsetD16Async' in found_functions}} - try: - global __cuMemsetD16Async - __cuMemsetD16Async = win32api.GetProcAddress(handle, 'cuMemsetD16Async') - except: - pass - {{endif}} - {{if 'cuMemsetD32Async' in found_functions}} - try: - global __cuMemsetD32Async - __cuMemsetD32Async = win32api.GetProcAddress(handle, 'cuMemsetD32Async') - except: - pass - {{endif}} - {{if 'cuMemsetD2D8Async' in found_functions}} - try: - global __cuMemsetD2D8Async - __cuMemsetD2D8Async = win32api.GetProcAddress(handle, 'cuMemsetD2D8Async') - except: - pass - {{endif}} - {{if 'cuMemsetD2D16Async' in found_functions}} - try: - global __cuMemsetD2D16Async - __cuMemsetD2D16Async = win32api.GetProcAddress(handle, 'cuMemsetD2D16Async') - except: - pass - {{endif}} - {{if 'cuMemsetD2D32Async' in found_functions}} - try: - global __cuMemsetD2D32Async - __cuMemsetD2D32Async = win32api.GetProcAddress(handle, 'cuMemsetD2D32Async') - except: - pass - {{endif}} - {{if 'cuMemMapArrayAsync' in found_functions}} - try: - global __cuMemMapArrayAsync - __cuMemMapArrayAsync = win32api.GetProcAddress(handle, 'cuMemMapArrayAsync') - except: - pass - {{endif}} - {{if 'cuMemFreeAsync' in found_functions}} - try: - global __cuMemFreeAsync - __cuMemFreeAsync = win32api.GetProcAddress(handle, 'cuMemFreeAsync') - except: - pass - {{endif}} - {{if 'cuMemAllocAsync' in found_functions}} - try: - global __cuMemAllocAsync - __cuMemAllocAsync = win32api.GetProcAddress(handle, 'cuMemAllocAsync') - except: - pass - {{endif}} - {{if 'cuMemAllocFromPoolAsync' in found_functions}} - try: - global __cuMemAllocFromPoolAsync - __cuMemAllocFromPoolAsync = win32api.GetProcAddress(handle, 'cuMemAllocFromPoolAsync') - except: - pass - {{endif}} - {{if 'cuMemPrefetchAsync' in found_functions}} - try: - global __cuMemPrefetchAsync - __cuMemPrefetchAsync = win32api.GetProcAddress(handle, 'cuMemPrefetchAsync') - except: - pass - {{endif}} - {{if 'cuMemPrefetchAsync_v2' in found_functions}} - try: - global __cuMemPrefetchAsync_v2 - __cuMemPrefetchAsync_v2 = win32api.GetProcAddress(handle, 'cuMemPrefetchAsync_v2') - except: - pass - {{endif}} - {{if 'cuStreamGetPriority' in found_functions}} - try: - global __cuStreamGetPriority - __cuStreamGetPriority = win32api.GetProcAddress(handle, 'cuStreamGetPriority') - except: - pass - {{endif}} - {{if 'cuStreamGetFlags' in found_functions}} - try: - global __cuStreamGetFlags - __cuStreamGetFlags = win32api.GetProcAddress(handle, 'cuStreamGetFlags') - except: - pass - {{endif}} - {{if 'cuStreamGetId' in found_functions}} - try: - global __cuStreamGetId - __cuStreamGetId = win32api.GetProcAddress(handle, 'cuStreamGetId') - except: - pass - {{endif}} - {{if 'cuStreamGetCtx' in found_functions}} - try: - global __cuStreamGetCtx - __cuStreamGetCtx = win32api.GetProcAddress(handle, 'cuStreamGetCtx') - except: - pass - {{endif}} - {{if 'cuStreamGetCtx_v2' in found_functions}} - try: - global __cuStreamGetCtx_v2 - __cuStreamGetCtx_v2 = win32api.GetProcAddress(handle, 'cuStreamGetCtx_v2') - except: - pass - {{endif}} - {{if 'cuStreamWaitEvent' in found_functions}} - try: - global __cuStreamWaitEvent - __cuStreamWaitEvent = win32api.GetProcAddress(handle, 'cuStreamWaitEvent') - except: - pass - {{endif}} - {{if 'cuStreamAddCallback' in found_functions}} - try: - global __cuStreamAddCallback - __cuStreamAddCallback = win32api.GetProcAddress(handle, 'cuStreamAddCallback') - except: - pass - {{endif}} - {{if 'cuStreamBeginCapture_v2' in found_functions}} - try: - global __cuStreamBeginCapture_v2 - __cuStreamBeginCapture_v2 = win32api.GetProcAddress(handle, 'cuStreamBeginCapture_v2') - except: - pass - {{endif}} - {{if 'cuStreamBeginCaptureToGraph' in found_functions}} - try: - global __cuStreamBeginCaptureToGraph - __cuStreamBeginCaptureToGraph = win32api.GetProcAddress(handle, 'cuStreamBeginCaptureToGraph') - except: - pass - {{endif}} - {{if 'cuStreamEndCapture' in found_functions}} - try: - global __cuStreamEndCapture - __cuStreamEndCapture = win32api.GetProcAddress(handle, 'cuStreamEndCapture') - except: - pass - {{endif}} - {{if 'cuStreamIsCapturing' in found_functions}} - try: - global __cuStreamIsCapturing - __cuStreamIsCapturing = win32api.GetProcAddress(handle, 'cuStreamIsCapturing') - except: - pass - {{endif}} - {{if 'cuStreamGetCaptureInfo_v2' in found_functions}} - try: - global __cuStreamGetCaptureInfo_v2 - __cuStreamGetCaptureInfo_v2 = win32api.GetProcAddress(handle, 'cuStreamGetCaptureInfo_v2') - except: - pass - {{endif}} - {{if 'cuStreamGetCaptureInfo_v3' in found_functions}} - try: - global __cuStreamGetCaptureInfo_v3 - __cuStreamGetCaptureInfo_v3 = win32api.GetProcAddress(handle, 'cuStreamGetCaptureInfo_v3') - except: - pass - {{endif}} - {{if 'cuStreamUpdateCaptureDependencies' in found_functions}} - try: - global __cuStreamUpdateCaptureDependencies - __cuStreamUpdateCaptureDependencies = win32api.GetProcAddress(handle, 'cuStreamUpdateCaptureDependencies') - except: - pass - {{endif}} - {{if 'cuStreamUpdateCaptureDependencies_v2' in found_functions}} - try: - global __cuStreamUpdateCaptureDependencies_v2 - __cuStreamUpdateCaptureDependencies_v2 = win32api.GetProcAddress(handle, 'cuStreamUpdateCaptureDependencies_v2') - except: - pass - {{endif}} - {{if 'cuStreamAttachMemAsync' in found_functions}} - try: - global __cuStreamAttachMemAsync - __cuStreamAttachMemAsync = win32api.GetProcAddress(handle, 'cuStreamAttachMemAsync') - except: - pass - {{endif}} - {{if 'cuStreamQuery' in found_functions}} - try: - global __cuStreamQuery - __cuStreamQuery = win32api.GetProcAddress(handle, 'cuStreamQuery') - except: - pass - {{endif}} - {{if 'cuStreamSynchronize' in found_functions}} - try: - global __cuStreamSynchronize - __cuStreamSynchronize = win32api.GetProcAddress(handle, 'cuStreamSynchronize') - except: - pass - {{endif}} - {{if 'cuStreamCopyAttributes' in found_functions}} - try: - global __cuStreamCopyAttributes - __cuStreamCopyAttributes = win32api.GetProcAddress(handle, 'cuStreamCopyAttributes') - except: - pass - {{endif}} - {{if 'cuStreamGetAttribute' in found_functions}} - try: - global __cuStreamGetAttribute - __cuStreamGetAttribute = win32api.GetProcAddress(handle, 'cuStreamGetAttribute') - except: - pass - {{endif}} - {{if 'cuStreamSetAttribute' in found_functions}} - try: - global __cuStreamSetAttribute - __cuStreamSetAttribute = win32api.GetProcAddress(handle, 'cuStreamSetAttribute') - except: - pass - {{endif}} - {{if 'cuEventRecord' in found_functions}} - try: - global __cuEventRecord - __cuEventRecord = win32api.GetProcAddress(handle, 'cuEventRecord') - except: - pass - {{endif}} - {{if 'cuEventRecordWithFlags' in found_functions}} - try: - global __cuEventRecordWithFlags - __cuEventRecordWithFlags = win32api.GetProcAddress(handle, 'cuEventRecordWithFlags') - except: - pass - {{endif}} - {{if 'cuSignalExternalSemaphoresAsync' in found_functions}} - try: - global __cuSignalExternalSemaphoresAsync - __cuSignalExternalSemaphoresAsync = win32api.GetProcAddress(handle, 'cuSignalExternalSemaphoresAsync') - except: - pass - {{endif}} - {{if 'cuWaitExternalSemaphoresAsync' in found_functions}} - try: - global __cuWaitExternalSemaphoresAsync - __cuWaitExternalSemaphoresAsync = win32api.GetProcAddress(handle, 'cuWaitExternalSemaphoresAsync') - except: - pass - {{endif}} - {{if 'cuStreamWaitValue32_v2' in found_functions}} - try: - global __cuStreamWaitValue32_v2 - __cuStreamWaitValue32_v2 = win32api.GetProcAddress(handle, 'cuStreamWaitValue32_v2') - except: - pass - {{endif}} - {{if 'cuStreamWaitValue64_v2' in found_functions}} - try: - global __cuStreamWaitValue64_v2 - __cuStreamWaitValue64_v2 = win32api.GetProcAddress(handle, 'cuStreamWaitValue64_v2') - except: - pass - {{endif}} - {{if 'cuStreamWriteValue32_v2' in found_functions}} - try: - global __cuStreamWriteValue32_v2 - __cuStreamWriteValue32_v2 = win32api.GetProcAddress(handle, 'cuStreamWriteValue32_v2') - except: - pass - {{endif}} - {{if 'cuStreamWriteValue64_v2' in found_functions}} - try: - global __cuStreamWriteValue64_v2 - __cuStreamWriteValue64_v2 = win32api.GetProcAddress(handle, 'cuStreamWriteValue64_v2') - except: - pass - {{endif}} - {{if 'cuStreamBatchMemOp_v2' in found_functions}} - try: - global __cuStreamBatchMemOp_v2 - __cuStreamBatchMemOp_v2 = win32api.GetProcAddress(handle, 'cuStreamBatchMemOp_v2') - except: - pass - {{endif}} - {{if 'cuLaunchKernel' in found_functions}} - try: - global __cuLaunchKernel - __cuLaunchKernel = win32api.GetProcAddress(handle, 'cuLaunchKernel') - except: - pass - {{endif}} - {{if 'cuLaunchKernelEx' in found_functions}} - try: - global __cuLaunchKernelEx - __cuLaunchKernelEx = win32api.GetProcAddress(handle, 'cuLaunchKernelEx') - except: - pass - {{endif}} - {{if 'cuLaunchCooperativeKernel' in found_functions}} - try: - global __cuLaunchCooperativeKernel - __cuLaunchCooperativeKernel = win32api.GetProcAddress(handle, 'cuLaunchCooperativeKernel') - except: - pass - {{endif}} - {{if 'cuLaunchHostFunc' in found_functions}} - try: - global __cuLaunchHostFunc - __cuLaunchHostFunc = win32api.GetProcAddress(handle, 'cuLaunchHostFunc') - except: - pass - {{endif}} - {{if 'cuGraphInstantiateWithParams' in found_functions}} - try: - global __cuGraphInstantiateWithParams - __cuGraphInstantiateWithParams = win32api.GetProcAddress(handle, 'cuGraphInstantiateWithParams') - except: - pass - {{endif}} - {{if 'cuGraphUpload' in found_functions}} - try: - global __cuGraphUpload - __cuGraphUpload = win32api.GetProcAddress(handle, 'cuGraphUpload') - except: - pass - {{endif}} - {{if 'cuGraphLaunch' in found_functions}} - try: - global __cuGraphLaunch - __cuGraphLaunch = win32api.GetProcAddress(handle, 'cuGraphLaunch') - except: - pass - {{endif}} - {{if 'cuGraphicsMapResources' in found_functions}} - try: - global __cuGraphicsMapResources - __cuGraphicsMapResources = win32api.GetProcAddress(handle, 'cuGraphicsMapResources') - except: - pass - {{endif}} - {{if 'cuGraphicsUnmapResources' in found_functions}} - try: - global __cuGraphicsUnmapResources - __cuGraphicsUnmapResources = win32api.GetProcAddress(handle, 'cuGraphicsUnmapResources') - except: - pass - {{endif}} - # Get remaining functions - {{if 'cuGetErrorString' in found_functions}} - try: - global __cuGetErrorString - __cuGetErrorString = win32api.GetProcAddress(handle, 'cuGetErrorString') - except: - pass - {{endif}} - {{if 'cuGetErrorName' in found_functions}} - try: - global __cuGetErrorName - __cuGetErrorName = win32api.GetProcAddress(handle, 'cuGetErrorName') - except: - pass - {{endif}} - {{if 'cuInit' in found_functions}} - try: - global __cuInit - __cuInit = win32api.GetProcAddress(handle, 'cuInit') - except: - pass - {{endif}} - {{if 'cuDriverGetVersion' in found_functions}} - try: - global __cuDriverGetVersion - __cuDriverGetVersion = win32api.GetProcAddress(handle, 'cuDriverGetVersion') - except: - pass - {{endif}} - {{if 'cuDeviceGet' in found_functions}} - try: - global __cuDeviceGet - __cuDeviceGet = win32api.GetProcAddress(handle, 'cuDeviceGet') - except: - pass - {{endif}} - {{if 'cuDeviceGetCount' in found_functions}} - try: - global __cuDeviceGetCount - __cuDeviceGetCount = win32api.GetProcAddress(handle, 'cuDeviceGetCount') - except: - pass - {{endif}} - {{if 'cuDeviceGetName' in found_functions}} - try: - global __cuDeviceGetName - __cuDeviceGetName = win32api.GetProcAddress(handle, 'cuDeviceGetName') - except: - pass - {{endif}} - {{if 'cuDeviceGetUuid' in found_functions}} - try: - global __cuDeviceGetUuid - __cuDeviceGetUuid = win32api.GetProcAddress(handle, 'cuDeviceGetUuid') - except: - pass - {{endif}} - {{if 'cuDeviceGetUuid_v2' in found_functions}} - try: - global __cuDeviceGetUuid_v2 - __cuDeviceGetUuid_v2 = win32api.GetProcAddress(handle, 'cuDeviceGetUuid_v2') - except: - pass - {{endif}} - {{if 'cuDeviceGetLuid' in found_functions}} - try: - global __cuDeviceGetLuid - __cuDeviceGetLuid = win32api.GetProcAddress(handle, 'cuDeviceGetLuid') - except: - pass - {{endif}} - {{if 'cuDeviceTotalMem_v2' in found_functions}} - try: - global __cuDeviceTotalMem_v2 - __cuDeviceTotalMem_v2 = win32api.GetProcAddress(handle, 'cuDeviceTotalMem_v2') - except: - pass - {{endif}} - {{if 'cuDeviceGetTexture1DLinearMaxWidth' in found_functions}} - try: - global __cuDeviceGetTexture1DLinearMaxWidth - __cuDeviceGetTexture1DLinearMaxWidth = win32api.GetProcAddress(handle, 'cuDeviceGetTexture1DLinearMaxWidth') - except: - pass - {{endif}} - {{if 'cuDeviceGetAttribute' in found_functions}} - try: - global __cuDeviceGetAttribute - __cuDeviceGetAttribute = win32api.GetProcAddress(handle, 'cuDeviceGetAttribute') - except: - pass - {{endif}} - {{if 'cuDeviceGetNvSciSyncAttributes' in found_functions}} - try: - global __cuDeviceGetNvSciSyncAttributes - __cuDeviceGetNvSciSyncAttributes = win32api.GetProcAddress(handle, 'cuDeviceGetNvSciSyncAttributes') - except: - pass - {{endif}} - {{if 'cuDeviceSetMemPool' in found_functions}} - try: - global __cuDeviceSetMemPool - __cuDeviceSetMemPool = win32api.GetProcAddress(handle, 'cuDeviceSetMemPool') - except: - pass - {{endif}} - {{if 'cuDeviceGetMemPool' in found_functions}} - try: - global __cuDeviceGetMemPool - __cuDeviceGetMemPool = win32api.GetProcAddress(handle, 'cuDeviceGetMemPool') - except: - pass - {{endif}} - {{if 'cuDeviceGetDefaultMemPool' in found_functions}} - try: - global __cuDeviceGetDefaultMemPool - __cuDeviceGetDefaultMemPool = win32api.GetProcAddress(handle, 'cuDeviceGetDefaultMemPool') - except: - pass - {{endif}} - {{if 'cuDeviceGetExecAffinitySupport' in found_functions}} - try: - global __cuDeviceGetExecAffinitySupport - __cuDeviceGetExecAffinitySupport = win32api.GetProcAddress(handle, 'cuDeviceGetExecAffinitySupport') - except: - pass - {{endif}} - {{if 'cuFlushGPUDirectRDMAWrites' in found_functions}} - try: - global __cuFlushGPUDirectRDMAWrites - __cuFlushGPUDirectRDMAWrites = win32api.GetProcAddress(handle, 'cuFlushGPUDirectRDMAWrites') - except: - pass - {{endif}} - {{if 'cuDeviceGetProperties' in found_functions}} - try: - global __cuDeviceGetProperties - __cuDeviceGetProperties = win32api.GetProcAddress(handle, 'cuDeviceGetProperties') - except: - pass - {{endif}} - {{if 'cuDeviceComputeCapability' in found_functions}} - try: - global __cuDeviceComputeCapability - __cuDeviceComputeCapability = win32api.GetProcAddress(handle, 'cuDeviceComputeCapability') - except: - pass - {{endif}} - {{if 'cuDevicePrimaryCtxRetain' in found_functions}} - try: - global __cuDevicePrimaryCtxRetain - __cuDevicePrimaryCtxRetain = win32api.GetProcAddress(handle, 'cuDevicePrimaryCtxRetain') - except: - pass - {{endif}} - {{if 'cuDevicePrimaryCtxRelease_v2' in found_functions}} - try: - global __cuDevicePrimaryCtxRelease_v2 - __cuDevicePrimaryCtxRelease_v2 = win32api.GetProcAddress(handle, 'cuDevicePrimaryCtxRelease_v2') - except: - pass - {{endif}} - {{if 'cuDevicePrimaryCtxSetFlags_v2' in found_functions}} - try: - global __cuDevicePrimaryCtxSetFlags_v2 - __cuDevicePrimaryCtxSetFlags_v2 = win32api.GetProcAddress(handle, 'cuDevicePrimaryCtxSetFlags_v2') - except: - pass - {{endif}} - {{if 'cuDevicePrimaryCtxGetState' in found_functions}} - try: - global __cuDevicePrimaryCtxGetState - __cuDevicePrimaryCtxGetState = win32api.GetProcAddress(handle, 'cuDevicePrimaryCtxGetState') - except: - pass - {{endif}} - {{if 'cuDevicePrimaryCtxReset_v2' in found_functions}} - try: - global __cuDevicePrimaryCtxReset_v2 - __cuDevicePrimaryCtxReset_v2 = win32api.GetProcAddress(handle, 'cuDevicePrimaryCtxReset_v2') - except: - pass - {{endif}} - {{if 'cuCtxCreate_v2' in found_functions}} - try: - global __cuCtxCreate_v2 - __cuCtxCreate_v2 = win32api.GetProcAddress(handle, 'cuCtxCreate_v2') - except: - pass - {{endif}} - {{if 'cuCtxCreate_v3' in found_functions}} - try: - global __cuCtxCreate_v3 - __cuCtxCreate_v3 = win32api.GetProcAddress(handle, 'cuCtxCreate_v3') - except: - pass - {{endif}} - {{if 'cuCtxCreate_v4' in found_functions}} - try: - global __cuCtxCreate_v4 - __cuCtxCreate_v4 = win32api.GetProcAddress(handle, 'cuCtxCreate_v4') - except: - pass - {{endif}} - {{if 'cuCtxDestroy_v2' in found_functions}} - try: - global __cuCtxDestroy_v2 - __cuCtxDestroy_v2 = win32api.GetProcAddress(handle, 'cuCtxDestroy_v2') - except: - pass - {{endif}} - {{if 'cuCtxPushCurrent_v2' in found_functions}} - try: - global __cuCtxPushCurrent_v2 - __cuCtxPushCurrent_v2 = win32api.GetProcAddress(handle, 'cuCtxPushCurrent_v2') - except: - pass - {{endif}} - {{if 'cuCtxPopCurrent_v2' in found_functions}} - try: - global __cuCtxPopCurrent_v2 - __cuCtxPopCurrent_v2 = win32api.GetProcAddress(handle, 'cuCtxPopCurrent_v2') - except: - pass - {{endif}} - {{if 'cuCtxSetCurrent' in found_functions}} - try: - global __cuCtxSetCurrent - __cuCtxSetCurrent = win32api.GetProcAddress(handle, 'cuCtxSetCurrent') - except: - pass - {{endif}} - {{if 'cuCtxGetCurrent' in found_functions}} - try: - global __cuCtxGetCurrent - __cuCtxGetCurrent = win32api.GetProcAddress(handle, 'cuCtxGetCurrent') - except: - pass - {{endif}} - {{if 'cuCtxGetDevice' in found_functions}} - try: - global __cuCtxGetDevice - __cuCtxGetDevice = win32api.GetProcAddress(handle, 'cuCtxGetDevice') - except: - pass - {{endif}} - {{if 'cuCtxGetFlags' in found_functions}} - try: - global __cuCtxGetFlags - __cuCtxGetFlags = win32api.GetProcAddress(handle, 'cuCtxGetFlags') - except: - pass - {{endif}} - {{if 'cuCtxSetFlags' in found_functions}} - try: - global __cuCtxSetFlags - __cuCtxSetFlags = win32api.GetProcAddress(handle, 'cuCtxSetFlags') - except: - pass - {{endif}} - {{if 'cuCtxGetId' in found_functions}} - try: - global __cuCtxGetId - __cuCtxGetId = win32api.GetProcAddress(handle, 'cuCtxGetId') - except: - pass - {{endif}} - {{if 'cuCtxSynchronize' in found_functions}} - try: - global __cuCtxSynchronize - __cuCtxSynchronize = win32api.GetProcAddress(handle, 'cuCtxSynchronize') - except: - pass - {{endif}} - {{if 'cuCtxSetLimit' in found_functions}} - try: - global __cuCtxSetLimit - __cuCtxSetLimit = win32api.GetProcAddress(handle, 'cuCtxSetLimit') - except: - pass - {{endif}} - {{if 'cuCtxGetLimit' in found_functions}} - try: - global __cuCtxGetLimit - __cuCtxGetLimit = win32api.GetProcAddress(handle, 'cuCtxGetLimit') - except: - pass - {{endif}} - {{if 'cuCtxGetCacheConfig' in found_functions}} - try: - global __cuCtxGetCacheConfig - __cuCtxGetCacheConfig = win32api.GetProcAddress(handle, 'cuCtxGetCacheConfig') - except: - pass - {{endif}} - {{if 'cuCtxSetCacheConfig' in found_functions}} - try: - global __cuCtxSetCacheConfig - __cuCtxSetCacheConfig = win32api.GetProcAddress(handle, 'cuCtxSetCacheConfig') - except: - pass - {{endif}} - {{if 'cuCtxGetApiVersion' in found_functions}} - try: - global __cuCtxGetApiVersion - __cuCtxGetApiVersion = win32api.GetProcAddress(handle, 'cuCtxGetApiVersion') - except: - pass - {{endif}} - {{if 'cuCtxGetStreamPriorityRange' in found_functions}} - try: - global __cuCtxGetStreamPriorityRange - __cuCtxGetStreamPriorityRange = win32api.GetProcAddress(handle, 'cuCtxGetStreamPriorityRange') - except: - pass - {{endif}} - {{if 'cuCtxResetPersistingL2Cache' in found_functions}} - try: - global __cuCtxResetPersistingL2Cache - __cuCtxResetPersistingL2Cache = win32api.GetProcAddress(handle, 'cuCtxResetPersistingL2Cache') - except: - pass - {{endif}} - {{if 'cuCtxGetExecAffinity' in found_functions}} - try: - global __cuCtxGetExecAffinity - __cuCtxGetExecAffinity = win32api.GetProcAddress(handle, 'cuCtxGetExecAffinity') - except: - pass - {{endif}} - {{if 'cuCtxRecordEvent' in found_functions}} - try: - global __cuCtxRecordEvent - __cuCtxRecordEvent = win32api.GetProcAddress(handle, 'cuCtxRecordEvent') - except: - pass - {{endif}} - {{if 'cuCtxWaitEvent' in found_functions}} - try: - global __cuCtxWaitEvent - __cuCtxWaitEvent = win32api.GetProcAddress(handle, 'cuCtxWaitEvent') - except: - pass - {{endif}} - {{if 'cuCtxAttach' in found_functions}} - try: - global __cuCtxAttach - __cuCtxAttach = win32api.GetProcAddress(handle, 'cuCtxAttach') - except: - pass - {{endif}} - {{if 'cuCtxDetach' in found_functions}} - try: - global __cuCtxDetach - __cuCtxDetach = win32api.GetProcAddress(handle, 'cuCtxDetach') - except: - pass - {{endif}} - {{if 'cuCtxGetSharedMemConfig' in found_functions}} - try: - global __cuCtxGetSharedMemConfig - __cuCtxGetSharedMemConfig = win32api.GetProcAddress(handle, 'cuCtxGetSharedMemConfig') - except: - pass - {{endif}} - {{if 'cuCtxSetSharedMemConfig' in found_functions}} - try: - global __cuCtxSetSharedMemConfig - __cuCtxSetSharedMemConfig = win32api.GetProcAddress(handle, 'cuCtxSetSharedMemConfig') - except: - pass - {{endif}} - {{if 'cuModuleLoad' in found_functions}} - try: - global __cuModuleLoad - __cuModuleLoad = win32api.GetProcAddress(handle, 'cuModuleLoad') - except: - pass - {{endif}} - {{if 'cuModuleLoadData' in found_functions}} - try: - global __cuModuleLoadData - __cuModuleLoadData = win32api.GetProcAddress(handle, 'cuModuleLoadData') - except: - pass - {{endif}} - {{if 'cuModuleLoadDataEx' in found_functions}} - try: - global __cuModuleLoadDataEx - __cuModuleLoadDataEx = win32api.GetProcAddress(handle, 'cuModuleLoadDataEx') - except: - pass - {{endif}} - {{if 'cuModuleLoadFatBinary' in found_functions}} - try: - global __cuModuleLoadFatBinary - __cuModuleLoadFatBinary = win32api.GetProcAddress(handle, 'cuModuleLoadFatBinary') - except: - pass - {{endif}} - {{if 'cuModuleUnload' in found_functions}} - try: - global __cuModuleUnload - __cuModuleUnload = win32api.GetProcAddress(handle, 'cuModuleUnload') - except: - pass - {{endif}} - {{if 'cuModuleGetLoadingMode' in found_functions}} - try: - global __cuModuleGetLoadingMode - __cuModuleGetLoadingMode = win32api.GetProcAddress(handle, 'cuModuleGetLoadingMode') - except: - pass - {{endif}} - {{if 'cuModuleGetFunction' in found_functions}} - try: - global __cuModuleGetFunction - __cuModuleGetFunction = win32api.GetProcAddress(handle, 'cuModuleGetFunction') - except: - pass - {{endif}} - {{if 'cuModuleGetFunctionCount' in found_functions}} - try: - global __cuModuleGetFunctionCount - __cuModuleGetFunctionCount = win32api.GetProcAddress(handle, 'cuModuleGetFunctionCount') - except: - pass - {{endif}} - {{if 'cuModuleEnumerateFunctions' in found_functions}} - try: - global __cuModuleEnumerateFunctions - __cuModuleEnumerateFunctions = win32api.GetProcAddress(handle, 'cuModuleEnumerateFunctions') - except: - pass - {{endif}} - {{if 'cuModuleGetGlobal_v2' in found_functions}} - try: - global __cuModuleGetGlobal_v2 - __cuModuleGetGlobal_v2 = win32api.GetProcAddress(handle, 'cuModuleGetGlobal_v2') - except: - pass - {{endif}} - {{if 'cuLinkCreate_v2' in found_functions}} - try: - global __cuLinkCreate_v2 - __cuLinkCreate_v2 = win32api.GetProcAddress(handle, 'cuLinkCreate_v2') - except: - pass - {{endif}} - {{if 'cuLinkAddData_v2' in found_functions}} - try: - global __cuLinkAddData_v2 - __cuLinkAddData_v2 = win32api.GetProcAddress(handle, 'cuLinkAddData_v2') - except: - pass - {{endif}} - {{if 'cuLinkAddFile_v2' in found_functions}} - try: - global __cuLinkAddFile_v2 - __cuLinkAddFile_v2 = win32api.GetProcAddress(handle, 'cuLinkAddFile_v2') - except: - pass - {{endif}} - {{if 'cuLinkComplete' in found_functions}} - try: - global __cuLinkComplete - __cuLinkComplete = win32api.GetProcAddress(handle, 'cuLinkComplete') - except: - pass - {{endif}} - {{if 'cuLinkDestroy' in found_functions}} - try: - global __cuLinkDestroy - __cuLinkDestroy = win32api.GetProcAddress(handle, 'cuLinkDestroy') - except: - pass - {{endif}} - {{if 'cuModuleGetTexRef' in found_functions}} - try: - global __cuModuleGetTexRef - __cuModuleGetTexRef = win32api.GetProcAddress(handle, 'cuModuleGetTexRef') - except: - pass - {{endif}} - {{if 'cuModuleGetSurfRef' in found_functions}} - try: - global __cuModuleGetSurfRef - __cuModuleGetSurfRef = win32api.GetProcAddress(handle, 'cuModuleGetSurfRef') - except: - pass - {{endif}} - {{if 'cuLibraryLoadData' in found_functions}} - try: - global __cuLibraryLoadData - __cuLibraryLoadData = win32api.GetProcAddress(handle, 'cuLibraryLoadData') - except: - pass - {{endif}} - {{if 'cuLibraryLoadFromFile' in found_functions}} - try: - global __cuLibraryLoadFromFile - __cuLibraryLoadFromFile = win32api.GetProcAddress(handle, 'cuLibraryLoadFromFile') - except: - pass - {{endif}} - {{if 'cuLibraryUnload' in found_functions}} - try: - global __cuLibraryUnload - __cuLibraryUnload = win32api.GetProcAddress(handle, 'cuLibraryUnload') - except: - pass - {{endif}} - {{if 'cuLibraryGetKernel' in found_functions}} - try: - global __cuLibraryGetKernel - __cuLibraryGetKernel = win32api.GetProcAddress(handle, 'cuLibraryGetKernel') - except: - pass - {{endif}} - {{if 'cuLibraryGetKernelCount' in found_functions}} - try: - global __cuLibraryGetKernelCount - __cuLibraryGetKernelCount = win32api.GetProcAddress(handle, 'cuLibraryGetKernelCount') - except: - pass - {{endif}} - {{if 'cuLibraryEnumerateKernels' in found_functions}} - try: - global __cuLibraryEnumerateKernels - __cuLibraryEnumerateKernels = win32api.GetProcAddress(handle, 'cuLibraryEnumerateKernels') - except: - pass - {{endif}} - {{if 'cuLibraryGetModule' in found_functions}} - try: - global __cuLibraryGetModule - __cuLibraryGetModule = win32api.GetProcAddress(handle, 'cuLibraryGetModule') - except: - pass - {{endif}} - {{if 'cuKernelGetFunction' in found_functions}} - try: - global __cuKernelGetFunction - __cuKernelGetFunction = win32api.GetProcAddress(handle, 'cuKernelGetFunction') - except: - pass - {{endif}} - {{if 'cuKernelGetLibrary' in found_functions}} - try: - global __cuKernelGetLibrary - __cuKernelGetLibrary = win32api.GetProcAddress(handle, 'cuKernelGetLibrary') - except: - pass - {{endif}} - {{if 'cuLibraryGetGlobal' in found_functions}} - try: - global __cuLibraryGetGlobal - __cuLibraryGetGlobal = win32api.GetProcAddress(handle, 'cuLibraryGetGlobal') - except: - pass - {{endif}} - {{if 'cuLibraryGetManaged' in found_functions}} - try: - global __cuLibraryGetManaged - __cuLibraryGetManaged = win32api.GetProcAddress(handle, 'cuLibraryGetManaged') - except: - pass - {{endif}} - {{if 'cuLibraryGetUnifiedFunction' in found_functions}} - try: - global __cuLibraryGetUnifiedFunction - __cuLibraryGetUnifiedFunction = win32api.GetProcAddress(handle, 'cuLibraryGetUnifiedFunction') - except: - pass - {{endif}} - {{if 'cuKernelGetAttribute' in found_functions}} - try: - global __cuKernelGetAttribute - __cuKernelGetAttribute = win32api.GetProcAddress(handle, 'cuKernelGetAttribute') - except: - pass - {{endif}} - {{if 'cuKernelSetAttribute' in found_functions}} - try: - global __cuKernelSetAttribute - __cuKernelSetAttribute = win32api.GetProcAddress(handle, 'cuKernelSetAttribute') - except: - pass - {{endif}} - {{if 'cuKernelSetCacheConfig' in found_functions}} - try: - global __cuKernelSetCacheConfig - __cuKernelSetCacheConfig = win32api.GetProcAddress(handle, 'cuKernelSetCacheConfig') - except: - pass - {{endif}} - {{if 'cuKernelGetName' in found_functions}} - try: - global __cuKernelGetName - __cuKernelGetName = win32api.GetProcAddress(handle, 'cuKernelGetName') - except: - pass - {{endif}} - {{if 'cuKernelGetParamInfo' in found_functions}} - try: - global __cuKernelGetParamInfo - __cuKernelGetParamInfo = win32api.GetProcAddress(handle, 'cuKernelGetParamInfo') - except: - pass - {{endif}} - {{if 'cuMemGetInfo_v2' in found_functions}} - try: - global __cuMemGetInfo_v2 - __cuMemGetInfo_v2 = win32api.GetProcAddress(handle, 'cuMemGetInfo_v2') - except: - pass - {{endif}} - {{if 'cuMemAlloc_v2' in found_functions}} - try: - global __cuMemAlloc_v2 - __cuMemAlloc_v2 = win32api.GetProcAddress(handle, 'cuMemAlloc_v2') - except: - pass - {{endif}} - {{if 'cuMemAllocPitch_v2' in found_functions}} - try: - global __cuMemAllocPitch_v2 - __cuMemAllocPitch_v2 = win32api.GetProcAddress(handle, 'cuMemAllocPitch_v2') - except: - pass - {{endif}} - {{if 'cuMemFree_v2' in found_functions}} - try: - global __cuMemFree_v2 - __cuMemFree_v2 = win32api.GetProcAddress(handle, 'cuMemFree_v2') - except: - pass - {{endif}} - {{if 'cuMemGetAddressRange_v2' in found_functions}} - try: - global __cuMemGetAddressRange_v2 - __cuMemGetAddressRange_v2 = win32api.GetProcAddress(handle, 'cuMemGetAddressRange_v2') - except: - pass - {{endif}} - {{if 'cuMemAllocHost_v2' in found_functions}} - try: - global __cuMemAllocHost_v2 - __cuMemAllocHost_v2 = win32api.GetProcAddress(handle, 'cuMemAllocHost_v2') - except: - pass - {{endif}} - {{if 'cuMemFreeHost' in found_functions}} - try: - global __cuMemFreeHost - __cuMemFreeHost = win32api.GetProcAddress(handle, 'cuMemFreeHost') - except: - pass - {{endif}} - {{if 'cuMemHostAlloc' in found_functions}} - try: - global __cuMemHostAlloc - __cuMemHostAlloc = win32api.GetProcAddress(handle, 'cuMemHostAlloc') - except: - pass - {{endif}} - {{if 'cuMemHostGetDevicePointer_v2' in found_functions}} - try: - global __cuMemHostGetDevicePointer_v2 - __cuMemHostGetDevicePointer_v2 = win32api.GetProcAddress(handle, 'cuMemHostGetDevicePointer_v2') - except: - pass - {{endif}} - {{if 'cuMemHostGetFlags' in found_functions}} - try: - global __cuMemHostGetFlags - __cuMemHostGetFlags = win32api.GetProcAddress(handle, 'cuMemHostGetFlags') - except: - pass - {{endif}} - {{if 'cuMemAllocManaged' in found_functions}} - try: - global __cuMemAllocManaged - __cuMemAllocManaged = win32api.GetProcAddress(handle, 'cuMemAllocManaged') - except: - pass - {{endif}} - {{if 'cuDeviceRegisterAsyncNotification' in found_functions}} - try: - global __cuDeviceRegisterAsyncNotification - __cuDeviceRegisterAsyncNotification = win32api.GetProcAddress(handle, 'cuDeviceRegisterAsyncNotification') - except: - pass - {{endif}} - {{if 'cuDeviceUnregisterAsyncNotification' in found_functions}} - try: - global __cuDeviceUnregisterAsyncNotification - __cuDeviceUnregisterAsyncNotification = win32api.GetProcAddress(handle, 'cuDeviceUnregisterAsyncNotification') - except: - pass - {{endif}} - {{if 'cuDeviceGetByPCIBusId' in found_functions}} - try: - global __cuDeviceGetByPCIBusId - __cuDeviceGetByPCIBusId = win32api.GetProcAddress(handle, 'cuDeviceGetByPCIBusId') - except: - pass - {{endif}} - {{if 'cuDeviceGetPCIBusId' in found_functions}} - try: - global __cuDeviceGetPCIBusId - __cuDeviceGetPCIBusId = win32api.GetProcAddress(handle, 'cuDeviceGetPCIBusId') - except: - pass - {{endif}} - {{if 'cuIpcGetEventHandle' in found_functions}} - try: - global __cuIpcGetEventHandle - __cuIpcGetEventHandle = win32api.GetProcAddress(handle, 'cuIpcGetEventHandle') - except: - pass - {{endif}} - {{if 'cuIpcOpenEventHandle' in found_functions}} - try: - global __cuIpcOpenEventHandle - __cuIpcOpenEventHandle = win32api.GetProcAddress(handle, 'cuIpcOpenEventHandle') - except: - pass - {{endif}} - {{if 'cuIpcGetMemHandle' in found_functions}} - try: - global __cuIpcGetMemHandle - __cuIpcGetMemHandle = win32api.GetProcAddress(handle, 'cuIpcGetMemHandle') - except: - pass - {{endif}} - {{if 'cuIpcOpenMemHandle_v2' in found_functions}} - try: - global __cuIpcOpenMemHandle_v2 - __cuIpcOpenMemHandle_v2 = win32api.GetProcAddress(handle, 'cuIpcOpenMemHandle_v2') - except: - pass - {{endif}} - {{if 'cuIpcCloseMemHandle' in found_functions}} - try: - global __cuIpcCloseMemHandle - __cuIpcCloseMemHandle = win32api.GetProcAddress(handle, 'cuIpcCloseMemHandle') - except: - pass - {{endif}} - {{if 'cuMemHostRegister_v2' in found_functions}} - try: - global __cuMemHostRegister_v2 - __cuMemHostRegister_v2 = win32api.GetProcAddress(handle, 'cuMemHostRegister_v2') - except: - pass - {{endif}} - {{if 'cuMemHostUnregister' in found_functions}} - try: - global __cuMemHostUnregister - __cuMemHostUnregister = win32api.GetProcAddress(handle, 'cuMemHostUnregister') - except: - pass - {{endif}} - {{if 'cuArrayCreate_v2' in found_functions}} - try: - global __cuArrayCreate_v2 - __cuArrayCreate_v2 = win32api.GetProcAddress(handle, 'cuArrayCreate_v2') - except: - pass - {{endif}} - {{if 'cuArrayGetDescriptor_v2' in found_functions}} - try: - global __cuArrayGetDescriptor_v2 - __cuArrayGetDescriptor_v2 = win32api.GetProcAddress(handle, 'cuArrayGetDescriptor_v2') - except: - pass - {{endif}} - {{if 'cuArrayGetSparseProperties' in found_functions}} - try: - global __cuArrayGetSparseProperties - __cuArrayGetSparseProperties = win32api.GetProcAddress(handle, 'cuArrayGetSparseProperties') - except: - pass - {{endif}} - {{if 'cuMipmappedArrayGetSparseProperties' in found_functions}} - try: - global __cuMipmappedArrayGetSparseProperties - __cuMipmappedArrayGetSparseProperties = win32api.GetProcAddress(handle, 'cuMipmappedArrayGetSparseProperties') - except: - pass - {{endif}} - {{if 'cuArrayGetMemoryRequirements' in found_functions}} - try: - global __cuArrayGetMemoryRequirements - __cuArrayGetMemoryRequirements = win32api.GetProcAddress(handle, 'cuArrayGetMemoryRequirements') - except: - pass - {{endif}} - {{if 'cuMipmappedArrayGetMemoryRequirements' in found_functions}} - try: - global __cuMipmappedArrayGetMemoryRequirements - __cuMipmappedArrayGetMemoryRequirements = win32api.GetProcAddress(handle, 'cuMipmappedArrayGetMemoryRequirements') - except: - pass - {{endif}} - {{if 'cuArrayGetPlane' in found_functions}} - try: - global __cuArrayGetPlane - __cuArrayGetPlane = win32api.GetProcAddress(handle, 'cuArrayGetPlane') - except: - pass - {{endif}} - {{if 'cuArrayDestroy' in found_functions}} - try: - global __cuArrayDestroy - __cuArrayDestroy = win32api.GetProcAddress(handle, 'cuArrayDestroy') - except: - pass - {{endif}} - {{if 'cuArray3DCreate_v2' in found_functions}} - try: - global __cuArray3DCreate_v2 - __cuArray3DCreate_v2 = win32api.GetProcAddress(handle, 'cuArray3DCreate_v2') - except: - pass - {{endif}} - {{if 'cuArray3DGetDescriptor_v2' in found_functions}} - try: - global __cuArray3DGetDescriptor_v2 - __cuArray3DGetDescriptor_v2 = win32api.GetProcAddress(handle, 'cuArray3DGetDescriptor_v2') - except: - pass - {{endif}} - {{if 'cuMipmappedArrayCreate' in found_functions}} - try: - global __cuMipmappedArrayCreate - __cuMipmappedArrayCreate = win32api.GetProcAddress(handle, 'cuMipmappedArrayCreate') - except: - pass - {{endif}} - {{if 'cuMipmappedArrayGetLevel' in found_functions}} - try: - global __cuMipmappedArrayGetLevel - __cuMipmappedArrayGetLevel = win32api.GetProcAddress(handle, 'cuMipmappedArrayGetLevel') - except: - pass - {{endif}} - {{if 'cuMipmappedArrayDestroy' in found_functions}} - try: - global __cuMipmappedArrayDestroy - __cuMipmappedArrayDestroy = win32api.GetProcAddress(handle, 'cuMipmappedArrayDestroy') - except: - pass - {{endif}} - {{if 'cuMemGetHandleForAddressRange' in found_functions}} - try: - global __cuMemGetHandleForAddressRange - __cuMemGetHandleForAddressRange = win32api.GetProcAddress(handle, 'cuMemGetHandleForAddressRange') - except: - pass - {{endif}} - {{if 'cuMemAddressReserve' in found_functions}} - try: - global __cuMemAddressReserve - __cuMemAddressReserve = win32api.GetProcAddress(handle, 'cuMemAddressReserve') - except: - pass - {{endif}} - {{if 'cuMemAddressFree' in found_functions}} - try: - global __cuMemAddressFree - __cuMemAddressFree = win32api.GetProcAddress(handle, 'cuMemAddressFree') - except: - pass - {{endif}} - {{if 'cuMemCreate' in found_functions}} - try: - global __cuMemCreate - __cuMemCreate = win32api.GetProcAddress(handle, 'cuMemCreate') - except: - pass - {{endif}} - {{if 'cuMemRelease' in found_functions}} - try: - global __cuMemRelease - __cuMemRelease = win32api.GetProcAddress(handle, 'cuMemRelease') - except: - pass - {{endif}} - {{if 'cuMemMap' in found_functions}} - try: - global __cuMemMap - __cuMemMap = win32api.GetProcAddress(handle, 'cuMemMap') - except: - pass - {{endif}} - {{if 'cuMemUnmap' in found_functions}} - try: - global __cuMemUnmap - __cuMemUnmap = win32api.GetProcAddress(handle, 'cuMemUnmap') - except: - pass - {{endif}} - {{if 'cuMemSetAccess' in found_functions}} - try: - global __cuMemSetAccess - __cuMemSetAccess = win32api.GetProcAddress(handle, 'cuMemSetAccess') - except: - pass - {{endif}} - {{if 'cuMemGetAccess' in found_functions}} - try: - global __cuMemGetAccess - __cuMemGetAccess = win32api.GetProcAddress(handle, 'cuMemGetAccess') - except: - pass - {{endif}} - {{if 'cuMemExportToShareableHandle' in found_functions}} - try: - global __cuMemExportToShareableHandle - __cuMemExportToShareableHandle = win32api.GetProcAddress(handle, 'cuMemExportToShareableHandle') - except: - pass - {{endif}} - {{if 'cuMemImportFromShareableHandle' in found_functions}} - try: - global __cuMemImportFromShareableHandle - __cuMemImportFromShareableHandle = win32api.GetProcAddress(handle, 'cuMemImportFromShareableHandle') - except: - pass - {{endif}} - {{if 'cuMemGetAllocationGranularity' in found_functions}} - try: - global __cuMemGetAllocationGranularity - __cuMemGetAllocationGranularity = win32api.GetProcAddress(handle, 'cuMemGetAllocationGranularity') - except: - pass - {{endif}} - {{if 'cuMemGetAllocationPropertiesFromHandle' in found_functions}} - try: - global __cuMemGetAllocationPropertiesFromHandle - __cuMemGetAllocationPropertiesFromHandle = win32api.GetProcAddress(handle, 'cuMemGetAllocationPropertiesFromHandle') - except: - pass - {{endif}} - {{if 'cuMemRetainAllocationHandle' in found_functions}} - try: - global __cuMemRetainAllocationHandle - __cuMemRetainAllocationHandle = win32api.GetProcAddress(handle, 'cuMemRetainAllocationHandle') - except: - pass - {{endif}} - {{if 'cuMemPoolTrimTo' in found_functions}} - try: - global __cuMemPoolTrimTo - __cuMemPoolTrimTo = win32api.GetProcAddress(handle, 'cuMemPoolTrimTo') - except: - pass - {{endif}} - {{if 'cuMemPoolSetAttribute' in found_functions}} - try: - global __cuMemPoolSetAttribute - __cuMemPoolSetAttribute = win32api.GetProcAddress(handle, 'cuMemPoolSetAttribute') - except: - pass - {{endif}} - {{if 'cuMemPoolGetAttribute' in found_functions}} - try: - global __cuMemPoolGetAttribute - __cuMemPoolGetAttribute = win32api.GetProcAddress(handle, 'cuMemPoolGetAttribute') - except: - pass - {{endif}} - {{if 'cuMemPoolSetAccess' in found_functions}} - try: - global __cuMemPoolSetAccess - __cuMemPoolSetAccess = win32api.GetProcAddress(handle, 'cuMemPoolSetAccess') - except: - pass - {{endif}} - {{if 'cuMemPoolGetAccess' in found_functions}} - try: - global __cuMemPoolGetAccess - __cuMemPoolGetAccess = win32api.GetProcAddress(handle, 'cuMemPoolGetAccess') - except: - pass - {{endif}} - {{if 'cuMemPoolCreate' in found_functions}} - try: - global __cuMemPoolCreate - __cuMemPoolCreate = win32api.GetProcAddress(handle, 'cuMemPoolCreate') - except: - pass - {{endif}} - {{if 'cuMemPoolDestroy' in found_functions}} - try: - global __cuMemPoolDestroy - __cuMemPoolDestroy = win32api.GetProcAddress(handle, 'cuMemPoolDestroy') - except: - pass - {{endif}} - {{if 'cuMemPoolExportToShareableHandle' in found_functions}} - try: - global __cuMemPoolExportToShareableHandle - __cuMemPoolExportToShareableHandle = win32api.GetProcAddress(handle, 'cuMemPoolExportToShareableHandle') - except: - pass - {{endif}} - {{if 'cuMemPoolImportFromShareableHandle' in found_functions}} - try: - global __cuMemPoolImportFromShareableHandle - __cuMemPoolImportFromShareableHandle = win32api.GetProcAddress(handle, 'cuMemPoolImportFromShareableHandle') - except: - pass - {{endif}} - {{if 'cuMemPoolExportPointer' in found_functions}} - try: - global __cuMemPoolExportPointer - __cuMemPoolExportPointer = win32api.GetProcAddress(handle, 'cuMemPoolExportPointer') - except: - pass - {{endif}} - {{if 'cuMemPoolImportPointer' in found_functions}} - try: - global __cuMemPoolImportPointer - __cuMemPoolImportPointer = win32api.GetProcAddress(handle, 'cuMemPoolImportPointer') - except: - pass - {{endif}} - {{if 'cuMulticastCreate' in found_functions}} - try: - global __cuMulticastCreate - __cuMulticastCreate = win32api.GetProcAddress(handle, 'cuMulticastCreate') - except: - pass - {{endif}} - {{if 'cuMulticastAddDevice' in found_functions}} - try: - global __cuMulticastAddDevice - __cuMulticastAddDevice = win32api.GetProcAddress(handle, 'cuMulticastAddDevice') - except: - pass - {{endif}} - {{if 'cuMulticastBindMem' in found_functions}} - try: - global __cuMulticastBindMem - __cuMulticastBindMem = win32api.GetProcAddress(handle, 'cuMulticastBindMem') - except: - pass - {{endif}} - {{if 'cuMulticastBindAddr' in found_functions}} - try: - global __cuMulticastBindAddr - __cuMulticastBindAddr = win32api.GetProcAddress(handle, 'cuMulticastBindAddr') - except: - pass - {{endif}} - {{if 'cuMulticastUnbind' in found_functions}} - try: - global __cuMulticastUnbind - __cuMulticastUnbind = win32api.GetProcAddress(handle, 'cuMulticastUnbind') - except: - pass - {{endif}} - {{if 'cuMulticastGetGranularity' in found_functions}} - try: - global __cuMulticastGetGranularity - __cuMulticastGetGranularity = win32api.GetProcAddress(handle, 'cuMulticastGetGranularity') - except: - pass - {{endif}} - {{if 'cuPointerGetAttribute' in found_functions}} - try: - global __cuPointerGetAttribute - __cuPointerGetAttribute = win32api.GetProcAddress(handle, 'cuPointerGetAttribute') - except: - pass - {{endif}} - {{if 'cuMemAdvise' in found_functions}} - try: - global __cuMemAdvise - __cuMemAdvise = win32api.GetProcAddress(handle, 'cuMemAdvise') - except: - pass - {{endif}} - {{if 'cuMemAdvise_v2' in found_functions}} - try: - global __cuMemAdvise_v2 - __cuMemAdvise_v2 = win32api.GetProcAddress(handle, 'cuMemAdvise_v2') - except: - pass - {{endif}} - {{if 'cuMemRangeGetAttribute' in found_functions}} - try: - global __cuMemRangeGetAttribute - __cuMemRangeGetAttribute = win32api.GetProcAddress(handle, 'cuMemRangeGetAttribute') - except: - pass - {{endif}} - {{if 'cuMemRangeGetAttributes' in found_functions}} - try: - global __cuMemRangeGetAttributes - __cuMemRangeGetAttributes = win32api.GetProcAddress(handle, 'cuMemRangeGetAttributes') - except: - pass - {{endif}} - {{if 'cuPointerSetAttribute' in found_functions}} - try: - global __cuPointerSetAttribute - __cuPointerSetAttribute = win32api.GetProcAddress(handle, 'cuPointerSetAttribute') - except: - pass - {{endif}} - {{if 'cuPointerGetAttributes' in found_functions}} - try: - global __cuPointerGetAttributes - __cuPointerGetAttributes = win32api.GetProcAddress(handle, 'cuPointerGetAttributes') - except: - pass - {{endif}} - {{if 'cuStreamCreate' in found_functions}} - try: - global __cuStreamCreate - __cuStreamCreate = win32api.GetProcAddress(handle, 'cuStreamCreate') - except: - pass - {{endif}} - {{if 'cuStreamCreateWithPriority' in found_functions}} - try: - global __cuStreamCreateWithPriority - __cuStreamCreateWithPriority = win32api.GetProcAddress(handle, 'cuStreamCreateWithPriority') - except: - pass - {{endif}} - {{if 'cuThreadExchangeStreamCaptureMode' in found_functions}} - try: - global __cuThreadExchangeStreamCaptureMode - __cuThreadExchangeStreamCaptureMode = win32api.GetProcAddress(handle, 'cuThreadExchangeStreamCaptureMode') - except: - pass - {{endif}} - {{if 'cuStreamDestroy_v2' in found_functions}} - try: - global __cuStreamDestroy_v2 - __cuStreamDestroy_v2 = win32api.GetProcAddress(handle, 'cuStreamDestroy_v2') - except: - pass - {{endif}} - {{if 'cuEventCreate' in found_functions}} - try: - global __cuEventCreate - __cuEventCreate = win32api.GetProcAddress(handle, 'cuEventCreate') - except: - pass - {{endif}} - {{if 'cuEventQuery' in found_functions}} - try: - global __cuEventQuery - __cuEventQuery = win32api.GetProcAddress(handle, 'cuEventQuery') - except: - pass - {{endif}} - {{if 'cuEventSynchronize' in found_functions}} - try: - global __cuEventSynchronize - __cuEventSynchronize = win32api.GetProcAddress(handle, 'cuEventSynchronize') - except: - pass - {{endif}} - {{if 'cuEventDestroy_v2' in found_functions}} - try: - global __cuEventDestroy_v2 - __cuEventDestroy_v2 = win32api.GetProcAddress(handle, 'cuEventDestroy_v2') - except: - pass - {{endif}} - {{if 'cuEventElapsedTime' in found_functions}} - try: - global __cuEventElapsedTime - __cuEventElapsedTime = win32api.GetProcAddress(handle, 'cuEventElapsedTime') - except: - pass - {{endif}} - {{if 'cuImportExternalMemory' in found_functions}} - try: - global __cuImportExternalMemory - __cuImportExternalMemory = win32api.GetProcAddress(handle, 'cuImportExternalMemory') - except: - pass - {{endif}} - {{if 'cuExternalMemoryGetMappedBuffer' in found_functions}} - try: - global __cuExternalMemoryGetMappedBuffer - __cuExternalMemoryGetMappedBuffer = win32api.GetProcAddress(handle, 'cuExternalMemoryGetMappedBuffer') - except: - pass - {{endif}} - {{if 'cuExternalMemoryGetMappedMipmappedArray' in found_functions}} - try: - global __cuExternalMemoryGetMappedMipmappedArray - __cuExternalMemoryGetMappedMipmappedArray = win32api.GetProcAddress(handle, 'cuExternalMemoryGetMappedMipmappedArray') - except: - pass - {{endif}} - {{if 'cuDestroyExternalMemory' in found_functions}} - try: - global __cuDestroyExternalMemory - __cuDestroyExternalMemory = win32api.GetProcAddress(handle, 'cuDestroyExternalMemory') - except: - pass - {{endif}} - {{if 'cuImportExternalSemaphore' in found_functions}} - try: - global __cuImportExternalSemaphore - __cuImportExternalSemaphore = win32api.GetProcAddress(handle, 'cuImportExternalSemaphore') - except: - pass - {{endif}} - {{if 'cuDestroyExternalSemaphore' in found_functions}} - try: - global __cuDestroyExternalSemaphore - __cuDestroyExternalSemaphore = win32api.GetProcAddress(handle, 'cuDestroyExternalSemaphore') - except: - pass - {{endif}} - {{if 'cuFuncGetAttribute' in found_functions}} - try: - global __cuFuncGetAttribute - __cuFuncGetAttribute = win32api.GetProcAddress(handle, 'cuFuncGetAttribute') - except: - pass - {{endif}} - {{if 'cuFuncSetAttribute' in found_functions}} - try: - global __cuFuncSetAttribute - __cuFuncSetAttribute = win32api.GetProcAddress(handle, 'cuFuncSetAttribute') - except: - pass - {{endif}} - {{if 'cuFuncSetCacheConfig' in found_functions}} - try: - global __cuFuncSetCacheConfig - __cuFuncSetCacheConfig = win32api.GetProcAddress(handle, 'cuFuncSetCacheConfig') - except: - pass - {{endif}} - {{if 'cuFuncGetModule' in found_functions}} - try: - global __cuFuncGetModule - __cuFuncGetModule = win32api.GetProcAddress(handle, 'cuFuncGetModule') - except: - pass - {{endif}} - {{if 'cuFuncGetName' in found_functions}} - try: - global __cuFuncGetName - __cuFuncGetName = win32api.GetProcAddress(handle, 'cuFuncGetName') - except: - pass - {{endif}} - {{if 'cuFuncGetParamInfo' in found_functions}} - try: - global __cuFuncGetParamInfo - __cuFuncGetParamInfo = win32api.GetProcAddress(handle, 'cuFuncGetParamInfo') - except: - pass - {{endif}} - {{if 'cuFuncIsLoaded' in found_functions}} - try: - global __cuFuncIsLoaded - __cuFuncIsLoaded = win32api.GetProcAddress(handle, 'cuFuncIsLoaded') - except: - pass - {{endif}} - {{if 'cuFuncLoad' in found_functions}} - try: - global __cuFuncLoad - __cuFuncLoad = win32api.GetProcAddress(handle, 'cuFuncLoad') - except: - pass - {{endif}} - {{if 'cuLaunchCooperativeKernelMultiDevice' in found_functions}} - try: - global __cuLaunchCooperativeKernelMultiDevice - __cuLaunchCooperativeKernelMultiDevice = win32api.GetProcAddress(handle, 'cuLaunchCooperativeKernelMultiDevice') - except: - pass - {{endif}} - {{if 'cuFuncSetBlockShape' in found_functions}} - try: - global __cuFuncSetBlockShape - __cuFuncSetBlockShape = win32api.GetProcAddress(handle, 'cuFuncSetBlockShape') - except: - pass - {{endif}} - {{if 'cuFuncSetSharedSize' in found_functions}} - try: - global __cuFuncSetSharedSize - __cuFuncSetSharedSize = win32api.GetProcAddress(handle, 'cuFuncSetSharedSize') - except: - pass - {{endif}} - {{if 'cuParamSetSize' in found_functions}} - try: - global __cuParamSetSize - __cuParamSetSize = win32api.GetProcAddress(handle, 'cuParamSetSize') - except: - pass - {{endif}} - {{if 'cuParamSeti' in found_functions}} - try: - global __cuParamSeti - __cuParamSeti = win32api.GetProcAddress(handle, 'cuParamSeti') - except: - pass - {{endif}} - {{if 'cuParamSetf' in found_functions}} - try: - global __cuParamSetf - __cuParamSetf = win32api.GetProcAddress(handle, 'cuParamSetf') - except: - pass - {{endif}} - {{if 'cuParamSetv' in found_functions}} - try: - global __cuParamSetv - __cuParamSetv = win32api.GetProcAddress(handle, 'cuParamSetv') - except: - pass - {{endif}} - {{if 'cuLaunch' in found_functions}} - try: - global __cuLaunch - __cuLaunch = win32api.GetProcAddress(handle, 'cuLaunch') - except: - pass - {{endif}} - {{if 'cuLaunchGrid' in found_functions}} - try: - global __cuLaunchGrid - __cuLaunchGrid = win32api.GetProcAddress(handle, 'cuLaunchGrid') - except: - pass - {{endif}} - {{if 'cuLaunchGridAsync' in found_functions}} - try: - global __cuLaunchGridAsync - __cuLaunchGridAsync = win32api.GetProcAddress(handle, 'cuLaunchGridAsync') - except: - pass - {{endif}} - {{if 'cuParamSetTexRef' in found_functions}} - try: - global __cuParamSetTexRef - __cuParamSetTexRef = win32api.GetProcAddress(handle, 'cuParamSetTexRef') - except: - pass - {{endif}} - {{if 'cuFuncSetSharedMemConfig' in found_functions}} - try: - global __cuFuncSetSharedMemConfig - __cuFuncSetSharedMemConfig = win32api.GetProcAddress(handle, 'cuFuncSetSharedMemConfig') - except: - pass - {{endif}} - {{if 'cuGraphCreate' in found_functions}} - try: - global __cuGraphCreate - __cuGraphCreate = win32api.GetProcAddress(handle, 'cuGraphCreate') - except: - pass - {{endif}} - {{if 'cuGraphAddKernelNode_v2' in found_functions}} - try: - global __cuGraphAddKernelNode_v2 - __cuGraphAddKernelNode_v2 = win32api.GetProcAddress(handle, 'cuGraphAddKernelNode_v2') - except: - pass - {{endif}} - {{if 'cuGraphKernelNodeGetParams_v2' in found_functions}} - try: - global __cuGraphKernelNodeGetParams_v2 - __cuGraphKernelNodeGetParams_v2 = win32api.GetProcAddress(handle, 'cuGraphKernelNodeGetParams_v2') - except: - pass - {{endif}} - {{if 'cuGraphKernelNodeSetParams_v2' in found_functions}} - try: - global __cuGraphKernelNodeSetParams_v2 - __cuGraphKernelNodeSetParams_v2 = win32api.GetProcAddress(handle, 'cuGraphKernelNodeSetParams_v2') - except: - pass - {{endif}} - {{if 'cuGraphAddMemcpyNode' in found_functions}} - try: - global __cuGraphAddMemcpyNode - __cuGraphAddMemcpyNode = win32api.GetProcAddress(handle, 'cuGraphAddMemcpyNode') - except: - pass - {{endif}} - {{if 'cuGraphMemcpyNodeGetParams' in found_functions}} - try: - global __cuGraphMemcpyNodeGetParams - __cuGraphMemcpyNodeGetParams = win32api.GetProcAddress(handle, 'cuGraphMemcpyNodeGetParams') - except: - pass - {{endif}} - {{if 'cuGraphMemcpyNodeSetParams' in found_functions}} - try: - global __cuGraphMemcpyNodeSetParams - __cuGraphMemcpyNodeSetParams = win32api.GetProcAddress(handle, 'cuGraphMemcpyNodeSetParams') - except: - pass - {{endif}} - {{if 'cuGraphAddMemsetNode' in found_functions}} - try: - global __cuGraphAddMemsetNode - __cuGraphAddMemsetNode = win32api.GetProcAddress(handle, 'cuGraphAddMemsetNode') - except: - pass - {{endif}} - {{if 'cuGraphMemsetNodeGetParams' in found_functions}} - try: - global __cuGraphMemsetNodeGetParams - __cuGraphMemsetNodeGetParams = win32api.GetProcAddress(handle, 'cuGraphMemsetNodeGetParams') - except: - pass - {{endif}} - {{if 'cuGraphMemsetNodeSetParams' in found_functions}} - try: - global __cuGraphMemsetNodeSetParams - __cuGraphMemsetNodeSetParams = win32api.GetProcAddress(handle, 'cuGraphMemsetNodeSetParams') - except: - pass - {{endif}} - {{if 'cuGraphAddHostNode' in found_functions}} - try: - global __cuGraphAddHostNode - __cuGraphAddHostNode = win32api.GetProcAddress(handle, 'cuGraphAddHostNode') - except: - pass - {{endif}} - {{if 'cuGraphHostNodeGetParams' in found_functions}} - try: - global __cuGraphHostNodeGetParams - __cuGraphHostNodeGetParams = win32api.GetProcAddress(handle, 'cuGraphHostNodeGetParams') - except: - pass - {{endif}} - {{if 'cuGraphHostNodeSetParams' in found_functions}} - try: - global __cuGraphHostNodeSetParams - __cuGraphHostNodeSetParams = win32api.GetProcAddress(handle, 'cuGraphHostNodeSetParams') - except: - pass - {{endif}} - {{if 'cuGraphAddChildGraphNode' in found_functions}} - try: - global __cuGraphAddChildGraphNode - __cuGraphAddChildGraphNode = win32api.GetProcAddress(handle, 'cuGraphAddChildGraphNode') - except: - pass - {{endif}} - {{if 'cuGraphChildGraphNodeGetGraph' in found_functions}} - try: - global __cuGraphChildGraphNodeGetGraph - __cuGraphChildGraphNodeGetGraph = win32api.GetProcAddress(handle, 'cuGraphChildGraphNodeGetGraph') - except: - pass - {{endif}} - {{if 'cuGraphAddEmptyNode' in found_functions}} - try: - global __cuGraphAddEmptyNode - __cuGraphAddEmptyNode = win32api.GetProcAddress(handle, 'cuGraphAddEmptyNode') - except: - pass - {{endif}} - {{if 'cuGraphAddEventRecordNode' in found_functions}} - try: - global __cuGraphAddEventRecordNode - __cuGraphAddEventRecordNode = win32api.GetProcAddress(handle, 'cuGraphAddEventRecordNode') - except: - pass - {{endif}} - {{if 'cuGraphEventRecordNodeGetEvent' in found_functions}} - try: - global __cuGraphEventRecordNodeGetEvent - __cuGraphEventRecordNodeGetEvent = win32api.GetProcAddress(handle, 'cuGraphEventRecordNodeGetEvent') - except: - pass - {{endif}} - {{if 'cuGraphEventRecordNodeSetEvent' in found_functions}} - try: - global __cuGraphEventRecordNodeSetEvent - __cuGraphEventRecordNodeSetEvent = win32api.GetProcAddress(handle, 'cuGraphEventRecordNodeSetEvent') - except: - pass - {{endif}} - {{if 'cuGraphAddEventWaitNode' in found_functions}} - try: - global __cuGraphAddEventWaitNode - __cuGraphAddEventWaitNode = win32api.GetProcAddress(handle, 'cuGraphAddEventWaitNode') - except: - pass - {{endif}} - {{if 'cuGraphEventWaitNodeGetEvent' in found_functions}} - try: - global __cuGraphEventWaitNodeGetEvent - __cuGraphEventWaitNodeGetEvent = win32api.GetProcAddress(handle, 'cuGraphEventWaitNodeGetEvent') - except: - pass - {{endif}} - {{if 'cuGraphEventWaitNodeSetEvent' in found_functions}} - try: - global __cuGraphEventWaitNodeSetEvent - __cuGraphEventWaitNodeSetEvent = win32api.GetProcAddress(handle, 'cuGraphEventWaitNodeSetEvent') - except: - pass - {{endif}} - {{if 'cuGraphAddExternalSemaphoresSignalNode' in found_functions}} - try: - global __cuGraphAddExternalSemaphoresSignalNode - __cuGraphAddExternalSemaphoresSignalNode = win32api.GetProcAddress(handle, 'cuGraphAddExternalSemaphoresSignalNode') - except: - pass - {{endif}} - {{if 'cuGraphExternalSemaphoresSignalNodeGetParams' in found_functions}} - try: - global __cuGraphExternalSemaphoresSignalNodeGetParams - __cuGraphExternalSemaphoresSignalNodeGetParams = win32api.GetProcAddress(handle, 'cuGraphExternalSemaphoresSignalNodeGetParams') - except: - pass - {{endif}} - {{if 'cuGraphExternalSemaphoresSignalNodeSetParams' in found_functions}} - try: - global __cuGraphExternalSemaphoresSignalNodeSetParams - __cuGraphExternalSemaphoresSignalNodeSetParams = win32api.GetProcAddress(handle, 'cuGraphExternalSemaphoresSignalNodeSetParams') - except: - pass - {{endif}} - {{if 'cuGraphAddExternalSemaphoresWaitNode' in found_functions}} - try: - global __cuGraphAddExternalSemaphoresWaitNode - __cuGraphAddExternalSemaphoresWaitNode = win32api.GetProcAddress(handle, 'cuGraphAddExternalSemaphoresWaitNode') - except: - pass - {{endif}} - {{if 'cuGraphExternalSemaphoresWaitNodeGetParams' in found_functions}} - try: - global __cuGraphExternalSemaphoresWaitNodeGetParams - __cuGraphExternalSemaphoresWaitNodeGetParams = win32api.GetProcAddress(handle, 'cuGraphExternalSemaphoresWaitNodeGetParams') - except: - pass - {{endif}} - {{if 'cuGraphExternalSemaphoresWaitNodeSetParams' in found_functions}} - try: - global __cuGraphExternalSemaphoresWaitNodeSetParams - __cuGraphExternalSemaphoresWaitNodeSetParams = win32api.GetProcAddress(handle, 'cuGraphExternalSemaphoresWaitNodeSetParams') - except: - pass - {{endif}} - {{if 'cuGraphAddBatchMemOpNode' in found_functions}} - try: - global __cuGraphAddBatchMemOpNode - __cuGraphAddBatchMemOpNode = win32api.GetProcAddress(handle, 'cuGraphAddBatchMemOpNode') - except: - pass - {{endif}} - {{if 'cuGraphBatchMemOpNodeGetParams' in found_functions}} - try: - global __cuGraphBatchMemOpNodeGetParams - __cuGraphBatchMemOpNodeGetParams = win32api.GetProcAddress(handle, 'cuGraphBatchMemOpNodeGetParams') - except: - pass - {{endif}} - {{if 'cuGraphBatchMemOpNodeSetParams' in found_functions}} - try: - global __cuGraphBatchMemOpNodeSetParams - __cuGraphBatchMemOpNodeSetParams = win32api.GetProcAddress(handle, 'cuGraphBatchMemOpNodeSetParams') - except: - pass - {{endif}} - {{if 'cuGraphExecBatchMemOpNodeSetParams' in found_functions}} - try: - global __cuGraphExecBatchMemOpNodeSetParams - __cuGraphExecBatchMemOpNodeSetParams = win32api.GetProcAddress(handle, 'cuGraphExecBatchMemOpNodeSetParams') - except: - pass - {{endif}} - {{if 'cuGraphAddMemAllocNode' in found_functions}} - try: - global __cuGraphAddMemAllocNode - __cuGraphAddMemAllocNode = win32api.GetProcAddress(handle, 'cuGraphAddMemAllocNode') - except: - pass - {{endif}} - {{if 'cuGraphMemAllocNodeGetParams' in found_functions}} - try: - global __cuGraphMemAllocNodeGetParams - __cuGraphMemAllocNodeGetParams = win32api.GetProcAddress(handle, 'cuGraphMemAllocNodeGetParams') - except: - pass - {{endif}} - {{if 'cuGraphAddMemFreeNode' in found_functions}} - try: - global __cuGraphAddMemFreeNode - __cuGraphAddMemFreeNode = win32api.GetProcAddress(handle, 'cuGraphAddMemFreeNode') - except: - pass - {{endif}} - {{if 'cuGraphMemFreeNodeGetParams' in found_functions}} - try: - global __cuGraphMemFreeNodeGetParams - __cuGraphMemFreeNodeGetParams = win32api.GetProcAddress(handle, 'cuGraphMemFreeNodeGetParams') - except: - pass - {{endif}} - {{if 'cuDeviceGraphMemTrim' in found_functions}} - try: - global __cuDeviceGraphMemTrim - __cuDeviceGraphMemTrim = win32api.GetProcAddress(handle, 'cuDeviceGraphMemTrim') - except: - pass - {{endif}} - {{if 'cuDeviceGetGraphMemAttribute' in found_functions}} - try: - global __cuDeviceGetGraphMemAttribute - __cuDeviceGetGraphMemAttribute = win32api.GetProcAddress(handle, 'cuDeviceGetGraphMemAttribute') - except: - pass - {{endif}} - {{if 'cuDeviceSetGraphMemAttribute' in found_functions}} - try: - global __cuDeviceSetGraphMemAttribute - __cuDeviceSetGraphMemAttribute = win32api.GetProcAddress(handle, 'cuDeviceSetGraphMemAttribute') - except: - pass - {{endif}} - {{if 'cuGraphClone' in found_functions}} - try: - global __cuGraphClone - __cuGraphClone = win32api.GetProcAddress(handle, 'cuGraphClone') - except: - pass - {{endif}} - {{if 'cuGraphNodeFindInClone' in found_functions}} - try: - global __cuGraphNodeFindInClone - __cuGraphNodeFindInClone = win32api.GetProcAddress(handle, 'cuGraphNodeFindInClone') - except: - pass - {{endif}} - {{if 'cuGraphNodeGetType' in found_functions}} - try: - global __cuGraphNodeGetType - __cuGraphNodeGetType = win32api.GetProcAddress(handle, 'cuGraphNodeGetType') - except: - pass - {{endif}} - {{if 'cuGraphGetNodes' in found_functions}} - try: - global __cuGraphGetNodes - __cuGraphGetNodes = win32api.GetProcAddress(handle, 'cuGraphGetNodes') - except: - pass - {{endif}} - {{if 'cuGraphGetRootNodes' in found_functions}} - try: - global __cuGraphGetRootNodes - __cuGraphGetRootNodes = win32api.GetProcAddress(handle, 'cuGraphGetRootNodes') - except: - pass - {{endif}} - {{if 'cuGraphGetEdges' in found_functions}} - try: - global __cuGraphGetEdges - __cuGraphGetEdges = win32api.GetProcAddress(handle, 'cuGraphGetEdges') - except: - pass - {{endif}} - {{if 'cuGraphGetEdges_v2' in found_functions}} - try: - global __cuGraphGetEdges_v2 - __cuGraphGetEdges_v2 = win32api.GetProcAddress(handle, 'cuGraphGetEdges_v2') - except: - pass - {{endif}} - {{if 'cuGraphNodeGetDependencies' in found_functions}} - try: - global __cuGraphNodeGetDependencies - __cuGraphNodeGetDependencies = win32api.GetProcAddress(handle, 'cuGraphNodeGetDependencies') - except: - pass - {{endif}} - {{if 'cuGraphNodeGetDependencies_v2' in found_functions}} - try: - global __cuGraphNodeGetDependencies_v2 - __cuGraphNodeGetDependencies_v2 = win32api.GetProcAddress(handle, 'cuGraphNodeGetDependencies_v2') - except: - pass - {{endif}} - {{if 'cuGraphNodeGetDependentNodes' in found_functions}} - try: - global __cuGraphNodeGetDependentNodes - __cuGraphNodeGetDependentNodes = win32api.GetProcAddress(handle, 'cuGraphNodeGetDependentNodes') - except: - pass - {{endif}} - {{if 'cuGraphNodeGetDependentNodes_v2' in found_functions}} - try: - global __cuGraphNodeGetDependentNodes_v2 - __cuGraphNodeGetDependentNodes_v2 = win32api.GetProcAddress(handle, 'cuGraphNodeGetDependentNodes_v2') - except: - pass - {{endif}} - {{if 'cuGraphAddDependencies' in found_functions}} - try: - global __cuGraphAddDependencies - __cuGraphAddDependencies = win32api.GetProcAddress(handle, 'cuGraphAddDependencies') - except: - pass - {{endif}} - {{if 'cuGraphAddDependencies_v2' in found_functions}} - try: - global __cuGraphAddDependencies_v2 - __cuGraphAddDependencies_v2 = win32api.GetProcAddress(handle, 'cuGraphAddDependencies_v2') - except: - pass - {{endif}} - {{if 'cuGraphRemoveDependencies' in found_functions}} - try: - global __cuGraphRemoveDependencies - __cuGraphRemoveDependencies = win32api.GetProcAddress(handle, 'cuGraphRemoveDependencies') - except: - pass - {{endif}} - {{if 'cuGraphRemoveDependencies_v2' in found_functions}} - try: - global __cuGraphRemoveDependencies_v2 - __cuGraphRemoveDependencies_v2 = win32api.GetProcAddress(handle, 'cuGraphRemoveDependencies_v2') - except: - pass - {{endif}} - {{if 'cuGraphDestroyNode' in found_functions}} - try: - global __cuGraphDestroyNode - __cuGraphDestroyNode = win32api.GetProcAddress(handle, 'cuGraphDestroyNode') - except: - pass - {{endif}} - {{if 'cuGraphInstantiateWithFlags' in found_functions}} - try: - global __cuGraphInstantiateWithFlags - __cuGraphInstantiateWithFlags = win32api.GetProcAddress(handle, 'cuGraphInstantiateWithFlags') - except: - pass - {{endif}} - {{if 'cuGraphExecGetFlags' in found_functions}} - try: - global __cuGraphExecGetFlags - __cuGraphExecGetFlags = win32api.GetProcAddress(handle, 'cuGraphExecGetFlags') - except: - pass - {{endif}} - {{if 'cuGraphExecKernelNodeSetParams_v2' in found_functions}} - try: - global __cuGraphExecKernelNodeSetParams_v2 - __cuGraphExecKernelNodeSetParams_v2 = win32api.GetProcAddress(handle, 'cuGraphExecKernelNodeSetParams_v2') - except: - pass - {{endif}} - {{if 'cuGraphExecMemcpyNodeSetParams' in found_functions}} - try: - global __cuGraphExecMemcpyNodeSetParams - __cuGraphExecMemcpyNodeSetParams = win32api.GetProcAddress(handle, 'cuGraphExecMemcpyNodeSetParams') - except: - pass - {{endif}} - {{if 'cuGraphExecMemsetNodeSetParams' in found_functions}} - try: - global __cuGraphExecMemsetNodeSetParams - __cuGraphExecMemsetNodeSetParams = win32api.GetProcAddress(handle, 'cuGraphExecMemsetNodeSetParams') - except: - pass - {{endif}} - {{if 'cuGraphExecHostNodeSetParams' in found_functions}} - try: - global __cuGraphExecHostNodeSetParams - __cuGraphExecHostNodeSetParams = win32api.GetProcAddress(handle, 'cuGraphExecHostNodeSetParams') - except: - pass - {{endif}} - {{if 'cuGraphExecChildGraphNodeSetParams' in found_functions}} - try: - global __cuGraphExecChildGraphNodeSetParams - __cuGraphExecChildGraphNodeSetParams = win32api.GetProcAddress(handle, 'cuGraphExecChildGraphNodeSetParams') - except: - pass - {{endif}} - {{if 'cuGraphExecEventRecordNodeSetEvent' in found_functions}} - try: - global __cuGraphExecEventRecordNodeSetEvent - __cuGraphExecEventRecordNodeSetEvent = win32api.GetProcAddress(handle, 'cuGraphExecEventRecordNodeSetEvent') - except: - pass - {{endif}} - {{if 'cuGraphExecEventWaitNodeSetEvent' in found_functions}} - try: - global __cuGraphExecEventWaitNodeSetEvent - __cuGraphExecEventWaitNodeSetEvent = win32api.GetProcAddress(handle, 'cuGraphExecEventWaitNodeSetEvent') - except: - pass - {{endif}} - {{if 'cuGraphExecExternalSemaphoresSignalNodeSetParams' in found_functions}} - try: - global __cuGraphExecExternalSemaphoresSignalNodeSetParams - __cuGraphExecExternalSemaphoresSignalNodeSetParams = win32api.GetProcAddress(handle, 'cuGraphExecExternalSemaphoresSignalNodeSetParams') - except: - pass - {{endif}} - {{if 'cuGraphExecExternalSemaphoresWaitNodeSetParams' in found_functions}} - try: - global __cuGraphExecExternalSemaphoresWaitNodeSetParams - __cuGraphExecExternalSemaphoresWaitNodeSetParams = win32api.GetProcAddress(handle, 'cuGraphExecExternalSemaphoresWaitNodeSetParams') - except: - pass - {{endif}} - {{if 'cuGraphNodeSetEnabled' in found_functions}} - try: - global __cuGraphNodeSetEnabled - __cuGraphNodeSetEnabled = win32api.GetProcAddress(handle, 'cuGraphNodeSetEnabled') - except: - pass - {{endif}} - {{if 'cuGraphNodeGetEnabled' in found_functions}} - try: - global __cuGraphNodeGetEnabled - __cuGraphNodeGetEnabled = win32api.GetProcAddress(handle, 'cuGraphNodeGetEnabled') - except: - pass - {{endif}} - {{if 'cuGraphExecDestroy' in found_functions}} - try: - global __cuGraphExecDestroy - __cuGraphExecDestroy = win32api.GetProcAddress(handle, 'cuGraphExecDestroy') - except: - pass - {{endif}} - {{if 'cuGraphDestroy' in found_functions}} - try: - global __cuGraphDestroy - __cuGraphDestroy = win32api.GetProcAddress(handle, 'cuGraphDestroy') - except: - pass - {{endif}} - {{if 'cuGraphExecUpdate_v2' in found_functions}} - try: - global __cuGraphExecUpdate_v2 - __cuGraphExecUpdate_v2 = win32api.GetProcAddress(handle, 'cuGraphExecUpdate_v2') - except: - pass - {{endif}} - {{if 'cuGraphKernelNodeCopyAttributes' in found_functions}} - try: - global __cuGraphKernelNodeCopyAttributes - __cuGraphKernelNodeCopyAttributes = win32api.GetProcAddress(handle, 'cuGraphKernelNodeCopyAttributes') - except: - pass - {{endif}} - {{if 'cuGraphKernelNodeGetAttribute' in found_functions}} - try: - global __cuGraphKernelNodeGetAttribute - __cuGraphKernelNodeGetAttribute = win32api.GetProcAddress(handle, 'cuGraphKernelNodeGetAttribute') - except: - pass - {{endif}} - {{if 'cuGraphKernelNodeSetAttribute' in found_functions}} - try: - global __cuGraphKernelNodeSetAttribute - __cuGraphKernelNodeSetAttribute = win32api.GetProcAddress(handle, 'cuGraphKernelNodeSetAttribute') - except: - pass - {{endif}} - {{if 'cuGraphDebugDotPrint' in found_functions}} - try: - global __cuGraphDebugDotPrint - __cuGraphDebugDotPrint = win32api.GetProcAddress(handle, 'cuGraphDebugDotPrint') - except: - pass - {{endif}} - {{if 'cuUserObjectCreate' in found_functions}} - try: - global __cuUserObjectCreate - __cuUserObjectCreate = win32api.GetProcAddress(handle, 'cuUserObjectCreate') - except: - pass - {{endif}} - {{if 'cuUserObjectRetain' in found_functions}} - try: - global __cuUserObjectRetain - __cuUserObjectRetain = win32api.GetProcAddress(handle, 'cuUserObjectRetain') - except: - pass - {{endif}} - {{if 'cuUserObjectRelease' in found_functions}} - try: - global __cuUserObjectRelease - __cuUserObjectRelease = win32api.GetProcAddress(handle, 'cuUserObjectRelease') - except: - pass - {{endif}} - {{if 'cuGraphRetainUserObject' in found_functions}} - try: - global __cuGraphRetainUserObject - __cuGraphRetainUserObject = win32api.GetProcAddress(handle, 'cuGraphRetainUserObject') - except: - pass - {{endif}} - {{if 'cuGraphReleaseUserObject' in found_functions}} - try: - global __cuGraphReleaseUserObject - __cuGraphReleaseUserObject = win32api.GetProcAddress(handle, 'cuGraphReleaseUserObject') - except: - pass - {{endif}} - {{if 'cuGraphAddNode' in found_functions}} - try: - global __cuGraphAddNode - __cuGraphAddNode = win32api.GetProcAddress(handle, 'cuGraphAddNode') - except: - pass - {{endif}} - {{if 'cuGraphAddNode_v2' in found_functions}} - try: - global __cuGraphAddNode_v2 - __cuGraphAddNode_v2 = win32api.GetProcAddress(handle, 'cuGraphAddNode_v2') - except: - pass - {{endif}} - {{if 'cuGraphNodeSetParams' in found_functions}} - try: - global __cuGraphNodeSetParams - __cuGraphNodeSetParams = win32api.GetProcAddress(handle, 'cuGraphNodeSetParams') - except: - pass - {{endif}} - {{if 'cuGraphExecNodeSetParams' in found_functions}} - try: - global __cuGraphExecNodeSetParams - __cuGraphExecNodeSetParams = win32api.GetProcAddress(handle, 'cuGraphExecNodeSetParams') - except: - pass - {{endif}} - {{if 'cuGraphConditionalHandleCreate' in found_functions}} - try: - global __cuGraphConditionalHandleCreate - __cuGraphConditionalHandleCreate = win32api.GetProcAddress(handle, 'cuGraphConditionalHandleCreate') - except: - pass - {{endif}} - {{if 'cuOccupancyMaxActiveBlocksPerMultiprocessor' in found_functions}} - try: - global __cuOccupancyMaxActiveBlocksPerMultiprocessor - __cuOccupancyMaxActiveBlocksPerMultiprocessor = win32api.GetProcAddress(handle, 'cuOccupancyMaxActiveBlocksPerMultiprocessor') - except: - pass - {{endif}} - {{if 'cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags' in found_functions}} - try: - global __cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags - __cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags = win32api.GetProcAddress(handle, 'cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags') - except: - pass - {{endif}} - {{if 'cuOccupancyMaxPotentialBlockSize' in found_functions}} - try: - global __cuOccupancyMaxPotentialBlockSize - __cuOccupancyMaxPotentialBlockSize = win32api.GetProcAddress(handle, 'cuOccupancyMaxPotentialBlockSize') - except: - pass - {{endif}} - {{if 'cuOccupancyMaxPotentialBlockSizeWithFlags' in found_functions}} - try: - global __cuOccupancyMaxPotentialBlockSizeWithFlags - __cuOccupancyMaxPotentialBlockSizeWithFlags = win32api.GetProcAddress(handle, 'cuOccupancyMaxPotentialBlockSizeWithFlags') - except: - pass - {{endif}} - {{if 'cuOccupancyAvailableDynamicSMemPerBlock' in found_functions}} - try: - global __cuOccupancyAvailableDynamicSMemPerBlock - __cuOccupancyAvailableDynamicSMemPerBlock = win32api.GetProcAddress(handle, 'cuOccupancyAvailableDynamicSMemPerBlock') - except: - pass - {{endif}} - {{if 'cuOccupancyMaxPotentialClusterSize' in found_functions}} - try: - global __cuOccupancyMaxPotentialClusterSize - __cuOccupancyMaxPotentialClusterSize = win32api.GetProcAddress(handle, 'cuOccupancyMaxPotentialClusterSize') - except: - pass - {{endif}} - {{if 'cuOccupancyMaxActiveClusters' in found_functions}} - try: - global __cuOccupancyMaxActiveClusters - __cuOccupancyMaxActiveClusters = win32api.GetProcAddress(handle, 'cuOccupancyMaxActiveClusters') - except: - pass - {{endif}} - {{if 'cuTexRefSetArray' in found_functions}} - try: - global __cuTexRefSetArray - __cuTexRefSetArray = win32api.GetProcAddress(handle, 'cuTexRefSetArray') - except: - pass - {{endif}} - {{if 'cuTexRefSetMipmappedArray' in found_functions}} - try: - global __cuTexRefSetMipmappedArray - __cuTexRefSetMipmappedArray = win32api.GetProcAddress(handle, 'cuTexRefSetMipmappedArray') - except: - pass - {{endif}} - {{if 'cuTexRefSetAddress_v2' in found_functions}} - try: - global __cuTexRefSetAddress_v2 - __cuTexRefSetAddress_v2 = win32api.GetProcAddress(handle, 'cuTexRefSetAddress_v2') - except: - pass - {{endif}} - {{if 'cuTexRefSetAddress2D_v3' in found_functions}} - try: - global __cuTexRefSetAddress2D_v3 - __cuTexRefSetAddress2D_v3 = win32api.GetProcAddress(handle, 'cuTexRefSetAddress2D_v3') - except: - pass - {{endif}} - {{if 'cuTexRefSetFormat' in found_functions}} - try: - global __cuTexRefSetFormat - __cuTexRefSetFormat = win32api.GetProcAddress(handle, 'cuTexRefSetFormat') - except: - pass - {{endif}} - {{if 'cuTexRefSetAddressMode' in found_functions}} - try: - global __cuTexRefSetAddressMode - __cuTexRefSetAddressMode = win32api.GetProcAddress(handle, 'cuTexRefSetAddressMode') - except: - pass - {{endif}} - {{if 'cuTexRefSetFilterMode' in found_functions}} - try: - global __cuTexRefSetFilterMode - __cuTexRefSetFilterMode = win32api.GetProcAddress(handle, 'cuTexRefSetFilterMode') - except: - pass - {{endif}} - {{if 'cuTexRefSetMipmapFilterMode' in found_functions}} - try: - global __cuTexRefSetMipmapFilterMode - __cuTexRefSetMipmapFilterMode = win32api.GetProcAddress(handle, 'cuTexRefSetMipmapFilterMode') - except: - pass - {{endif}} - {{if 'cuTexRefSetMipmapLevelBias' in found_functions}} - try: - global __cuTexRefSetMipmapLevelBias - __cuTexRefSetMipmapLevelBias = win32api.GetProcAddress(handle, 'cuTexRefSetMipmapLevelBias') - except: - pass - {{endif}} - {{if 'cuTexRefSetMipmapLevelClamp' in found_functions}} - try: - global __cuTexRefSetMipmapLevelClamp - __cuTexRefSetMipmapLevelClamp = win32api.GetProcAddress(handle, 'cuTexRefSetMipmapLevelClamp') - except: - pass - {{endif}} - {{if 'cuTexRefSetMaxAnisotropy' in found_functions}} - try: - global __cuTexRefSetMaxAnisotropy - __cuTexRefSetMaxAnisotropy = win32api.GetProcAddress(handle, 'cuTexRefSetMaxAnisotropy') - except: - pass - {{endif}} - {{if 'cuTexRefSetBorderColor' in found_functions}} - try: - global __cuTexRefSetBorderColor - __cuTexRefSetBorderColor = win32api.GetProcAddress(handle, 'cuTexRefSetBorderColor') - except: - pass - {{endif}} - {{if 'cuTexRefSetFlags' in found_functions}} - try: - global __cuTexRefSetFlags - __cuTexRefSetFlags = win32api.GetProcAddress(handle, 'cuTexRefSetFlags') - except: - pass - {{endif}} - {{if 'cuTexRefGetAddress_v2' in found_functions}} - try: - global __cuTexRefGetAddress_v2 - __cuTexRefGetAddress_v2 = win32api.GetProcAddress(handle, 'cuTexRefGetAddress_v2') - except: - pass - {{endif}} - {{if 'cuTexRefGetArray' in found_functions}} - try: - global __cuTexRefGetArray - __cuTexRefGetArray = win32api.GetProcAddress(handle, 'cuTexRefGetArray') - except: - pass - {{endif}} - {{if 'cuTexRefGetMipmappedArray' in found_functions}} - try: - global __cuTexRefGetMipmappedArray - __cuTexRefGetMipmappedArray = win32api.GetProcAddress(handle, 'cuTexRefGetMipmappedArray') - except: - pass - {{endif}} - {{if 'cuTexRefGetAddressMode' in found_functions}} - try: - global __cuTexRefGetAddressMode - __cuTexRefGetAddressMode = win32api.GetProcAddress(handle, 'cuTexRefGetAddressMode') - except: - pass - {{endif}} - {{if 'cuTexRefGetFilterMode' in found_functions}} - try: - global __cuTexRefGetFilterMode - __cuTexRefGetFilterMode = win32api.GetProcAddress(handle, 'cuTexRefGetFilterMode') - except: - pass - {{endif}} - {{if 'cuTexRefGetFormat' in found_functions}} - try: - global __cuTexRefGetFormat - __cuTexRefGetFormat = win32api.GetProcAddress(handle, 'cuTexRefGetFormat') - except: - pass - {{endif}} - {{if 'cuTexRefGetMipmapFilterMode' in found_functions}} - try: - global __cuTexRefGetMipmapFilterMode - __cuTexRefGetMipmapFilterMode = win32api.GetProcAddress(handle, 'cuTexRefGetMipmapFilterMode') - except: - pass - {{endif}} - {{if 'cuTexRefGetMipmapLevelBias' in found_functions}} - try: - global __cuTexRefGetMipmapLevelBias - __cuTexRefGetMipmapLevelBias = win32api.GetProcAddress(handle, 'cuTexRefGetMipmapLevelBias') - except: - pass - {{endif}} - {{if 'cuTexRefGetMipmapLevelClamp' in found_functions}} - try: - global __cuTexRefGetMipmapLevelClamp - __cuTexRefGetMipmapLevelClamp = win32api.GetProcAddress(handle, 'cuTexRefGetMipmapLevelClamp') - except: - pass - {{endif}} - {{if 'cuTexRefGetMaxAnisotropy' in found_functions}} - try: - global __cuTexRefGetMaxAnisotropy - __cuTexRefGetMaxAnisotropy = win32api.GetProcAddress(handle, 'cuTexRefGetMaxAnisotropy') - except: - pass - {{endif}} - {{if 'cuTexRefGetBorderColor' in found_functions}} - try: - global __cuTexRefGetBorderColor - __cuTexRefGetBorderColor = win32api.GetProcAddress(handle, 'cuTexRefGetBorderColor') - except: - pass - {{endif}} - {{if 'cuTexRefGetFlags' in found_functions}} - try: - global __cuTexRefGetFlags - __cuTexRefGetFlags = win32api.GetProcAddress(handle, 'cuTexRefGetFlags') - except: - pass - {{endif}} - {{if 'cuTexRefCreate' in found_functions}} - try: - global __cuTexRefCreate - __cuTexRefCreate = win32api.GetProcAddress(handle, 'cuTexRefCreate') - except: - pass - {{endif}} - {{if 'cuTexRefDestroy' in found_functions}} - try: - global __cuTexRefDestroy - __cuTexRefDestroy = win32api.GetProcAddress(handle, 'cuTexRefDestroy') - except: - pass - {{endif}} - {{if 'cuSurfRefSetArray' in found_functions}} - try: - global __cuSurfRefSetArray - __cuSurfRefSetArray = win32api.GetProcAddress(handle, 'cuSurfRefSetArray') - except: - pass - {{endif}} - {{if 'cuSurfRefGetArray' in found_functions}} - try: - global __cuSurfRefGetArray - __cuSurfRefGetArray = win32api.GetProcAddress(handle, 'cuSurfRefGetArray') - except: - pass - {{endif}} - {{if 'cuTexObjectCreate' in found_functions}} - try: - global __cuTexObjectCreate - __cuTexObjectCreate = win32api.GetProcAddress(handle, 'cuTexObjectCreate') - except: - pass - {{endif}} - {{if 'cuTexObjectDestroy' in found_functions}} - try: - global __cuTexObjectDestroy - __cuTexObjectDestroy = win32api.GetProcAddress(handle, 'cuTexObjectDestroy') - except: - pass - {{endif}} - {{if 'cuTexObjectGetResourceDesc' in found_functions}} - try: - global __cuTexObjectGetResourceDesc - __cuTexObjectGetResourceDesc = win32api.GetProcAddress(handle, 'cuTexObjectGetResourceDesc') - except: - pass - {{endif}} - {{if 'cuTexObjectGetTextureDesc' in found_functions}} - try: - global __cuTexObjectGetTextureDesc - __cuTexObjectGetTextureDesc = win32api.GetProcAddress(handle, 'cuTexObjectGetTextureDesc') - except: - pass - {{endif}} - {{if 'cuTexObjectGetResourceViewDesc' in found_functions}} - try: - global __cuTexObjectGetResourceViewDesc - __cuTexObjectGetResourceViewDesc = win32api.GetProcAddress(handle, 'cuTexObjectGetResourceViewDesc') - except: - pass - {{endif}} - {{if 'cuSurfObjectCreate' in found_functions}} - try: - global __cuSurfObjectCreate - __cuSurfObjectCreate = win32api.GetProcAddress(handle, 'cuSurfObjectCreate') - except: - pass - {{endif}} - {{if 'cuSurfObjectDestroy' in found_functions}} - try: - global __cuSurfObjectDestroy - __cuSurfObjectDestroy = win32api.GetProcAddress(handle, 'cuSurfObjectDestroy') - except: - pass - {{endif}} - {{if 'cuSurfObjectGetResourceDesc' in found_functions}} - try: - global __cuSurfObjectGetResourceDesc - __cuSurfObjectGetResourceDesc = win32api.GetProcAddress(handle, 'cuSurfObjectGetResourceDesc') - except: - pass - {{endif}} - {{if 'cuTensorMapEncodeTiled' in found_functions}} - try: - global __cuTensorMapEncodeTiled - __cuTensorMapEncodeTiled = win32api.GetProcAddress(handle, 'cuTensorMapEncodeTiled') - except: - pass - {{endif}} - {{if 'cuTensorMapEncodeIm2col' in found_functions}} - try: - global __cuTensorMapEncodeIm2col - __cuTensorMapEncodeIm2col = win32api.GetProcAddress(handle, 'cuTensorMapEncodeIm2col') - except: - pass - {{endif}} - {{if 'cuTensorMapReplaceAddress' in found_functions}} - try: - global __cuTensorMapReplaceAddress - __cuTensorMapReplaceAddress = win32api.GetProcAddress(handle, 'cuTensorMapReplaceAddress') - except: - pass - {{endif}} - {{if 'cuDeviceCanAccessPeer' in found_functions}} - try: - global __cuDeviceCanAccessPeer - __cuDeviceCanAccessPeer = win32api.GetProcAddress(handle, 'cuDeviceCanAccessPeer') - except: - pass - {{endif}} - {{if 'cuCtxEnablePeerAccess' in found_functions}} - try: - global __cuCtxEnablePeerAccess - __cuCtxEnablePeerAccess = win32api.GetProcAddress(handle, 'cuCtxEnablePeerAccess') - except: - pass - {{endif}} - {{if 'cuCtxDisablePeerAccess' in found_functions}} - try: - global __cuCtxDisablePeerAccess - __cuCtxDisablePeerAccess = win32api.GetProcAddress(handle, 'cuCtxDisablePeerAccess') - except: - pass - {{endif}} - {{if 'cuDeviceGetP2PAttribute' in found_functions}} - try: - global __cuDeviceGetP2PAttribute - __cuDeviceGetP2PAttribute = win32api.GetProcAddress(handle, 'cuDeviceGetP2PAttribute') - except: - pass - {{endif}} - {{if 'cuGraphicsUnregisterResource' in found_functions}} - try: - global __cuGraphicsUnregisterResource - __cuGraphicsUnregisterResource = win32api.GetProcAddress(handle, 'cuGraphicsUnregisterResource') - except: - pass - {{endif}} - {{if 'cuGraphicsSubResourceGetMappedArray' in found_functions}} - try: - global __cuGraphicsSubResourceGetMappedArray - __cuGraphicsSubResourceGetMappedArray = win32api.GetProcAddress(handle, 'cuGraphicsSubResourceGetMappedArray') - except: - pass - {{endif}} - {{if 'cuGraphicsResourceGetMappedMipmappedArray' in found_functions}} - try: - global __cuGraphicsResourceGetMappedMipmappedArray - __cuGraphicsResourceGetMappedMipmappedArray = win32api.GetProcAddress(handle, 'cuGraphicsResourceGetMappedMipmappedArray') - except: - pass - {{endif}} - {{if 'cuGraphicsResourceGetMappedPointer_v2' in found_functions}} - try: - global __cuGraphicsResourceGetMappedPointer_v2 - __cuGraphicsResourceGetMappedPointer_v2 = win32api.GetProcAddress(handle, 'cuGraphicsResourceGetMappedPointer_v2') - except: - pass - {{endif}} - {{if 'cuGraphicsResourceSetMapFlags_v2' in found_functions}} - try: - global __cuGraphicsResourceSetMapFlags_v2 - __cuGraphicsResourceSetMapFlags_v2 = win32api.GetProcAddress(handle, 'cuGraphicsResourceSetMapFlags_v2') - except: - pass - {{endif}} - {{if 'cuGetProcAddress_v2' in found_functions}} - try: - global __cuGetProcAddress_v2 - __cuGetProcAddress_v2 = win32api.GetProcAddress(handle, 'cuGetProcAddress_v2') - except: - pass - {{endif}} - {{if 'cuCoredumpGetAttribute' in found_functions}} - try: - global __cuCoredumpGetAttribute - __cuCoredumpGetAttribute = win32api.GetProcAddress(handle, 'cuCoredumpGetAttribute') - except: - pass - {{endif}} - {{if 'cuCoredumpGetAttributeGlobal' in found_functions}} - try: - global __cuCoredumpGetAttributeGlobal - __cuCoredumpGetAttributeGlobal = win32api.GetProcAddress(handle, 'cuCoredumpGetAttributeGlobal') - except: - pass - {{endif}} - {{if 'cuCoredumpSetAttribute' in found_functions}} - try: - global __cuCoredumpSetAttribute - __cuCoredumpSetAttribute = win32api.GetProcAddress(handle, 'cuCoredumpSetAttribute') - except: - pass - {{endif}} - {{if 'cuCoredumpSetAttributeGlobal' in found_functions}} - try: - global __cuCoredumpSetAttributeGlobal - __cuCoredumpSetAttributeGlobal = win32api.GetProcAddress(handle, 'cuCoredumpSetAttributeGlobal') - except: - pass - {{endif}} - {{if 'cuGetExportTable' in found_functions}} - try: - global __cuGetExportTable - __cuGetExportTable = win32api.GetProcAddress(handle, 'cuGetExportTable') - except: - pass - {{endif}} - {{if 'cuGreenCtxCreate' in found_functions}} - try: - global __cuGreenCtxCreate - __cuGreenCtxCreate = win32api.GetProcAddress(handle, 'cuGreenCtxCreate') - except: - pass - {{endif}} - {{if 'cuGreenCtxDestroy' in found_functions}} - try: - global __cuGreenCtxDestroy - __cuGreenCtxDestroy = win32api.GetProcAddress(handle, 'cuGreenCtxDestroy') - except: - pass - {{endif}} - {{if 'cuCtxFromGreenCtx' in found_functions}} - try: - global __cuCtxFromGreenCtx - __cuCtxFromGreenCtx = win32api.GetProcAddress(handle, 'cuCtxFromGreenCtx') - except: - pass - {{endif}} - {{if 'cuDeviceGetDevResource' in found_functions}} - try: - global __cuDeviceGetDevResource - __cuDeviceGetDevResource = win32api.GetProcAddress(handle, 'cuDeviceGetDevResource') - except: - pass - {{endif}} - {{if 'cuCtxGetDevResource' in found_functions}} - try: - global __cuCtxGetDevResource - __cuCtxGetDevResource = win32api.GetProcAddress(handle, 'cuCtxGetDevResource') - except: - pass - {{endif}} - {{if 'cuGreenCtxGetDevResource' in found_functions}} - try: - global __cuGreenCtxGetDevResource - __cuGreenCtxGetDevResource = win32api.GetProcAddress(handle, 'cuGreenCtxGetDevResource') - except: - pass - {{endif}} - {{if 'cuDevSmResourceSplitByCount' in found_functions}} - try: - global __cuDevSmResourceSplitByCount - __cuDevSmResourceSplitByCount = win32api.GetProcAddress(handle, 'cuDevSmResourceSplitByCount') - except: - pass - {{endif}} - {{if 'cuDevResourceGenerateDesc' in found_functions}} - try: - global __cuDevResourceGenerateDesc - __cuDevResourceGenerateDesc = win32api.GetProcAddress(handle, 'cuDevResourceGenerateDesc') - except: - pass - {{endif}} - {{if 'cuGreenCtxRecordEvent' in found_functions}} - try: - global __cuGreenCtxRecordEvent - __cuGreenCtxRecordEvent = win32api.GetProcAddress(handle, 'cuGreenCtxRecordEvent') - except: - pass - {{endif}} - {{if 'cuGreenCtxWaitEvent' in found_functions}} - try: - global __cuGreenCtxWaitEvent - __cuGreenCtxWaitEvent = win32api.GetProcAddress(handle, 'cuGreenCtxWaitEvent') - except: - pass - {{endif}} - {{if 'cuStreamGetGreenCtx' in found_functions}} - try: - global __cuStreamGetGreenCtx - __cuStreamGetGreenCtx = win32api.GetProcAddress(handle, 'cuStreamGetGreenCtx') - except: - pass - {{endif}} - {{if 'cuGreenCtxStreamCreate' in found_functions}} - try: - global __cuGreenCtxStreamCreate - __cuGreenCtxStreamCreate = win32api.GetProcAddress(handle, 'cuGreenCtxStreamCreate') - except: - pass - {{endif}} - {{if 'cuProfilerStart' in found_functions}} - try: - global __cuProfilerStart - __cuProfilerStart = win32api.GetProcAddress(handle, 'cuProfilerStart') - except: - pass - {{endif}} - {{if 'cuProfilerStop' in found_functions}} - try: - global __cuProfilerStop - __cuProfilerStop = win32api.GetProcAddress(handle, 'cuProfilerStop') - except: - pass - {{endif}} - {{if True}} - try: - global __cuGraphicsEGLRegisterImage - __cuGraphicsEGLRegisterImage = win32api.GetProcAddress(handle, 'cuGraphicsEGLRegisterImage') - except: - pass - {{endif}} - {{if True}} - try: - global __cuEGLStreamConsumerConnect - __cuEGLStreamConsumerConnect = win32api.GetProcAddress(handle, 'cuEGLStreamConsumerConnect') - except: - pass - {{endif}} - {{if True}} - try: - global __cuEGLStreamConsumerConnectWithFlags - __cuEGLStreamConsumerConnectWithFlags = win32api.GetProcAddress(handle, 'cuEGLStreamConsumerConnectWithFlags') - except: - pass - {{endif}} - {{if True}} - try: - global __cuEGLStreamConsumerDisconnect - __cuEGLStreamConsumerDisconnect = win32api.GetProcAddress(handle, 'cuEGLStreamConsumerDisconnect') - except: - pass - {{endif}} - {{if True}} - try: - global __cuEGLStreamConsumerAcquireFrame - __cuEGLStreamConsumerAcquireFrame = win32api.GetProcAddress(handle, 'cuEGLStreamConsumerAcquireFrame') - except: - pass - {{endif}} - {{if True}} - try: - global __cuEGLStreamConsumerReleaseFrame - __cuEGLStreamConsumerReleaseFrame = win32api.GetProcAddress(handle, 'cuEGLStreamConsumerReleaseFrame') - except: - pass - {{endif}} - {{if True}} - try: - global __cuEGLStreamProducerConnect - __cuEGLStreamProducerConnect = win32api.GetProcAddress(handle, 'cuEGLStreamProducerConnect') - except: - pass - {{endif}} - {{if True}} - try: - global __cuEGLStreamProducerDisconnect - __cuEGLStreamProducerDisconnect = win32api.GetProcAddress(handle, 'cuEGLStreamProducerDisconnect') - except: - pass - {{endif}} - {{if True}} - try: - global __cuEGLStreamProducerPresentFrame - __cuEGLStreamProducerPresentFrame = win32api.GetProcAddress(handle, 'cuEGLStreamProducerPresentFrame') - except: - pass - {{endif}} - {{if True}} - try: - global __cuEGLStreamProducerReturnFrame - __cuEGLStreamProducerReturnFrame = win32api.GetProcAddress(handle, 'cuEGLStreamProducerReturnFrame') - except: - pass - {{endif}} - {{if True}} - try: - global __cuGraphicsResourceGetMappedEglFrame - __cuGraphicsResourceGetMappedEglFrame = win32api.GetProcAddress(handle, 'cuGraphicsResourceGetMappedEglFrame') - except: - pass - {{endif}} - {{if True}} - try: - global __cuEventCreateFromEGLSync - __cuEventCreateFromEGLSync = win32api.GetProcAddress(handle, 'cuEventCreateFromEGLSync') - except: - pass - {{endif}} - {{if True}} - try: - global __cuGraphicsGLRegisterBuffer - __cuGraphicsGLRegisterBuffer = win32api.GetProcAddress(handle, 'cuGraphicsGLRegisterBuffer') - except: - pass - {{endif}} - {{if True}} - try: - global __cuGraphicsGLRegisterImage - __cuGraphicsGLRegisterImage = win32api.GetProcAddress(handle, 'cuGraphicsGLRegisterImage') - except: - pass - {{endif}} - {{if True}} - try: - global __cuGLGetDevices_v2 - __cuGLGetDevices_v2 = win32api.GetProcAddress(handle, 'cuGLGetDevices_v2') - except: - pass - {{endif}} - {{if True}} - try: - global __cuVDPAUGetDevice - __cuVDPAUGetDevice = win32api.GetProcAddress(handle, 'cuVDPAUGetDevice') - except: - pass - {{endif}} - {{if True}} - try: - global __cuVDPAUCtxCreate_v2 - __cuVDPAUCtxCreate_v2 = win32api.GetProcAddress(handle, 'cuVDPAUCtxCreate_v2') - except: - pass - {{endif}} - {{if True}} - try: - global __cuGraphicsVDPAURegisterVideoSurface - __cuGraphicsVDPAURegisterVideoSurface = win32api.GetProcAddress(handle, 'cuGraphicsVDPAURegisterVideoSurface') - except: - pass - {{endif}} - {{if True}} - try: - global __cuGraphicsVDPAURegisterOutputSurface - __cuGraphicsVDPAURegisterOutputSurface = win32api.GetProcAddress(handle, 'cuGraphicsVDPAURegisterOutputSurface') - except: - pass - {{endif}} - {{else}} - # Load using dlsym - if usePTDS: - # Get all PTDS version of functions - pass - {{if 'cuMemcpy' in found_functions}} - global __cuMemcpy - __cuMemcpy = dlfcn.dlsym(handle, 'cuMemcpy_ptds') - {{endif}} - {{if 'cuMemcpyPeer' in found_functions}} - global __cuMemcpyPeer - __cuMemcpyPeer = dlfcn.dlsym(handle, 'cuMemcpyPeer_ptds') - {{endif}} - {{if 'cuMemcpyHtoD_v2' in found_functions}} - global __cuMemcpyHtoD_v2 - __cuMemcpyHtoD_v2 = dlfcn.dlsym(handle, 'cuMemcpyHtoD_v2_ptds') - {{endif}} - {{if 'cuMemcpyDtoH_v2' in found_functions}} - global __cuMemcpyDtoH_v2 - __cuMemcpyDtoH_v2 = dlfcn.dlsym(handle, 'cuMemcpyDtoH_v2_ptds') - {{endif}} - {{if 'cuMemcpyDtoD_v2' in found_functions}} - global __cuMemcpyDtoD_v2 - __cuMemcpyDtoD_v2 = dlfcn.dlsym(handle, 'cuMemcpyDtoD_v2_ptds') - {{endif}} - {{if 'cuMemcpyDtoA_v2' in found_functions}} - global __cuMemcpyDtoA_v2 - __cuMemcpyDtoA_v2 = dlfcn.dlsym(handle, 'cuMemcpyDtoA_v2_ptds') - {{endif}} - {{if 'cuMemcpyAtoD_v2' in found_functions}} - global __cuMemcpyAtoD_v2 - __cuMemcpyAtoD_v2 = dlfcn.dlsym(handle, 'cuMemcpyAtoD_v2_ptds') - {{endif}} - {{if 'cuMemcpyHtoA_v2' in found_functions}} - global __cuMemcpyHtoA_v2 - __cuMemcpyHtoA_v2 = dlfcn.dlsym(handle, 'cuMemcpyHtoA_v2_ptds') - {{endif}} - {{if 'cuMemcpyAtoH_v2' in found_functions}} - global __cuMemcpyAtoH_v2 - __cuMemcpyAtoH_v2 = dlfcn.dlsym(handle, 'cuMemcpyAtoH_v2_ptds') - {{endif}} - {{if 'cuMemcpyAtoA_v2' in found_functions}} - global __cuMemcpyAtoA_v2 - __cuMemcpyAtoA_v2 = dlfcn.dlsym(handle, 'cuMemcpyAtoA_v2_ptds') - {{endif}} - {{if 'cuMemcpy2D_v2' in found_functions}} - global __cuMemcpy2D_v2 - __cuMemcpy2D_v2 = dlfcn.dlsym(handle, 'cuMemcpy2D_v2_ptds') - {{endif}} - {{if 'cuMemcpy2DUnaligned_v2' in found_functions}} - global __cuMemcpy2DUnaligned_v2 - __cuMemcpy2DUnaligned_v2 = dlfcn.dlsym(handle, 'cuMemcpy2DUnaligned_v2_ptds') - {{endif}} - {{if 'cuMemcpy3D_v2' in found_functions}} - global __cuMemcpy3D_v2 - __cuMemcpy3D_v2 = dlfcn.dlsym(handle, 'cuMemcpy3D_v2_ptds') - {{endif}} - {{if 'cuMemcpy3DPeer' in found_functions}} - global __cuMemcpy3DPeer - __cuMemcpy3DPeer = dlfcn.dlsym(handle, 'cuMemcpy3DPeer_ptds') - {{endif}} - {{if 'cuMemcpyAsync' in found_functions}} - global __cuMemcpyAsync - __cuMemcpyAsync = dlfcn.dlsym(handle, 'cuMemcpyAsync_ptsz') - {{endif}} - {{if 'cuMemcpyPeerAsync' in found_functions}} - global __cuMemcpyPeerAsync - __cuMemcpyPeerAsync = dlfcn.dlsym(handle, 'cuMemcpyPeerAsync_ptsz') - {{endif}} - {{if 'cuMemcpyHtoDAsync_v2' in found_functions}} - global __cuMemcpyHtoDAsync_v2 - __cuMemcpyHtoDAsync_v2 = dlfcn.dlsym(handle, 'cuMemcpyHtoDAsync_v2_ptsz') - {{endif}} - {{if 'cuMemcpyDtoHAsync_v2' in found_functions}} - global __cuMemcpyDtoHAsync_v2 - __cuMemcpyDtoHAsync_v2 = dlfcn.dlsym(handle, 'cuMemcpyDtoHAsync_v2_ptsz') - {{endif}} - {{if 'cuMemcpyDtoDAsync_v2' in found_functions}} - global __cuMemcpyDtoDAsync_v2 - __cuMemcpyDtoDAsync_v2 = dlfcn.dlsym(handle, 'cuMemcpyDtoDAsync_v2_ptsz') - {{endif}} - {{if 'cuMemcpyHtoAAsync_v2' in found_functions}} - global __cuMemcpyHtoAAsync_v2 - __cuMemcpyHtoAAsync_v2 = dlfcn.dlsym(handle, 'cuMemcpyHtoAAsync_v2_ptsz') - {{endif}} - {{if 'cuMemcpyAtoHAsync_v2' in found_functions}} - global __cuMemcpyAtoHAsync_v2 - __cuMemcpyAtoHAsync_v2 = dlfcn.dlsym(handle, 'cuMemcpyAtoHAsync_v2_ptsz') - {{endif}} - {{if 'cuMemcpy2DAsync_v2' in found_functions}} - global __cuMemcpy2DAsync_v2 - __cuMemcpy2DAsync_v2 = dlfcn.dlsym(handle, 'cuMemcpy2DAsync_v2_ptsz') - {{endif}} - {{if 'cuMemcpy3DAsync_v2' in found_functions}} - global __cuMemcpy3DAsync_v2 - __cuMemcpy3DAsync_v2 = dlfcn.dlsym(handle, 'cuMemcpy3DAsync_v2_ptsz') - {{endif}} - {{if 'cuMemcpy3DPeerAsync' in found_functions}} - global __cuMemcpy3DPeerAsync - __cuMemcpy3DPeerAsync = dlfcn.dlsym(handle, 'cuMemcpy3DPeerAsync_ptsz') - {{endif}} - {{if 'cuMemsetD8_v2' in found_functions}} - global __cuMemsetD8_v2 - __cuMemsetD8_v2 = dlfcn.dlsym(handle, 'cuMemsetD8_v2_ptds') - {{endif}} - {{if 'cuMemsetD16_v2' in found_functions}} - global __cuMemsetD16_v2 - __cuMemsetD16_v2 = dlfcn.dlsym(handle, 'cuMemsetD16_v2_ptds') - {{endif}} - {{if 'cuMemsetD32_v2' in found_functions}} - global __cuMemsetD32_v2 - __cuMemsetD32_v2 = dlfcn.dlsym(handle, 'cuMemsetD32_v2_ptds') - {{endif}} - {{if 'cuMemsetD2D8_v2' in found_functions}} - global __cuMemsetD2D8_v2 - __cuMemsetD2D8_v2 = dlfcn.dlsym(handle, 'cuMemsetD2D8_v2_ptds') - {{endif}} - {{if 'cuMemsetD2D16_v2' in found_functions}} - global __cuMemsetD2D16_v2 - __cuMemsetD2D16_v2 = dlfcn.dlsym(handle, 'cuMemsetD2D16_v2_ptds') - {{endif}} - {{if 'cuMemsetD2D32_v2' in found_functions}} - global __cuMemsetD2D32_v2 - __cuMemsetD2D32_v2 = dlfcn.dlsym(handle, 'cuMemsetD2D32_v2_ptds') - {{endif}} - {{if 'cuMemsetD8Async' in found_functions}} - global __cuMemsetD8Async - __cuMemsetD8Async = dlfcn.dlsym(handle, 'cuMemsetD8Async_ptsz') - {{endif}} - {{if 'cuMemsetD16Async' in found_functions}} - global __cuMemsetD16Async - __cuMemsetD16Async = dlfcn.dlsym(handle, 'cuMemsetD16Async_ptsz') - {{endif}} - {{if 'cuMemsetD32Async' in found_functions}} - global __cuMemsetD32Async - __cuMemsetD32Async = dlfcn.dlsym(handle, 'cuMemsetD32Async_ptsz') - {{endif}} - {{if 'cuMemsetD2D8Async' in found_functions}} - global __cuMemsetD2D8Async - __cuMemsetD2D8Async = dlfcn.dlsym(handle, 'cuMemsetD2D8Async_ptsz') - {{endif}} - {{if 'cuMemsetD2D16Async' in found_functions}} - global __cuMemsetD2D16Async - __cuMemsetD2D16Async = dlfcn.dlsym(handle, 'cuMemsetD2D16Async_ptsz') - {{endif}} - {{if 'cuMemsetD2D32Async' in found_functions}} - global __cuMemsetD2D32Async - __cuMemsetD2D32Async = dlfcn.dlsym(handle, 'cuMemsetD2D32Async_ptsz') - {{endif}} - {{if 'cuMemMapArrayAsync' in found_functions}} - global __cuMemMapArrayAsync - __cuMemMapArrayAsync = dlfcn.dlsym(handle, 'cuMemMapArrayAsync_ptsz') - {{endif}} - {{if 'cuMemFreeAsync' in found_functions}} - global __cuMemFreeAsync - __cuMemFreeAsync = dlfcn.dlsym(handle, 'cuMemFreeAsync_ptsz') - {{endif}} - {{if 'cuMemAllocAsync' in found_functions}} - global __cuMemAllocAsync - __cuMemAllocAsync = dlfcn.dlsym(handle, 'cuMemAllocAsync_ptsz') - {{endif}} - {{if 'cuMemAllocFromPoolAsync' in found_functions}} - global __cuMemAllocFromPoolAsync - __cuMemAllocFromPoolAsync = dlfcn.dlsym(handle, 'cuMemAllocFromPoolAsync_ptsz') - {{endif}} - {{if 'cuMemPrefetchAsync' in found_functions}} - global __cuMemPrefetchAsync - __cuMemPrefetchAsync = dlfcn.dlsym(handle, 'cuMemPrefetchAsync_ptsz') - {{endif}} - {{if 'cuMemPrefetchAsync_v2' in found_functions}} - global __cuMemPrefetchAsync_v2 - __cuMemPrefetchAsync_v2 = dlfcn.dlsym(handle, 'cuMemPrefetchAsync_v2_ptsz') - {{endif}} - {{if 'cuStreamGetPriority' in found_functions}} - global __cuStreamGetPriority - __cuStreamGetPriority = dlfcn.dlsym(handle, 'cuStreamGetPriority_ptsz') - {{endif}} - {{if 'cuStreamGetFlags' in found_functions}} - global __cuStreamGetFlags - __cuStreamGetFlags = dlfcn.dlsym(handle, 'cuStreamGetFlags_ptsz') - {{endif}} - {{if 'cuStreamGetId' in found_functions}} - global __cuStreamGetId - __cuStreamGetId = dlfcn.dlsym(handle, 'cuStreamGetId_ptsz') - {{endif}} - {{if 'cuStreamGetCtx' in found_functions}} - global __cuStreamGetCtx - __cuStreamGetCtx = dlfcn.dlsym(handle, 'cuStreamGetCtx_ptsz') - {{endif}} - {{if 'cuStreamGetCtx_v2' in found_functions}} - global __cuStreamGetCtx_v2 - __cuStreamGetCtx_v2 = dlfcn.dlsym(handle, 'cuStreamGetCtx_v2_ptsz') - {{endif}} - {{if 'cuStreamWaitEvent' in found_functions}} - global __cuStreamWaitEvent - __cuStreamWaitEvent = dlfcn.dlsym(handle, 'cuStreamWaitEvent_ptsz') - {{endif}} - {{if 'cuStreamAddCallback' in found_functions}} - global __cuStreamAddCallback - __cuStreamAddCallback = dlfcn.dlsym(handle, 'cuStreamAddCallback_ptsz') - {{endif}} - {{if 'cuStreamBeginCapture_v2' in found_functions}} - global __cuStreamBeginCapture_v2 - __cuStreamBeginCapture_v2 = dlfcn.dlsym(handle, 'cuStreamBeginCapture_v2_ptsz') - {{endif}} - {{if 'cuStreamBeginCaptureToGraph' in found_functions}} - global __cuStreamBeginCaptureToGraph - __cuStreamBeginCaptureToGraph = dlfcn.dlsym(handle, 'cuStreamBeginCaptureToGraph_ptsz') - {{endif}} - {{if 'cuStreamEndCapture' in found_functions}} - global __cuStreamEndCapture - __cuStreamEndCapture = dlfcn.dlsym(handle, 'cuStreamEndCapture_ptsz') - {{endif}} - {{if 'cuStreamIsCapturing' in found_functions}} - global __cuStreamIsCapturing - __cuStreamIsCapturing = dlfcn.dlsym(handle, 'cuStreamIsCapturing_ptsz') - {{endif}} - {{if 'cuStreamGetCaptureInfo_v2' in found_functions}} - global __cuStreamGetCaptureInfo_v2 - __cuStreamGetCaptureInfo_v2 = dlfcn.dlsym(handle, 'cuStreamGetCaptureInfo_v2_ptsz') - {{endif}} - {{if 'cuStreamGetCaptureInfo_v3' in found_functions}} - global __cuStreamGetCaptureInfo_v3 - __cuStreamGetCaptureInfo_v3 = dlfcn.dlsym(handle, 'cuStreamGetCaptureInfo_v3_ptsz') - {{endif}} - {{if 'cuStreamUpdateCaptureDependencies' in found_functions}} - global __cuStreamUpdateCaptureDependencies - __cuStreamUpdateCaptureDependencies = dlfcn.dlsym(handle, 'cuStreamUpdateCaptureDependencies_ptsz') - {{endif}} - {{if 'cuStreamUpdateCaptureDependencies_v2' in found_functions}} - global __cuStreamUpdateCaptureDependencies_v2 - __cuStreamUpdateCaptureDependencies_v2 = dlfcn.dlsym(handle, 'cuStreamUpdateCaptureDependencies_v2_ptsz') - {{endif}} - {{if 'cuStreamAttachMemAsync' in found_functions}} - global __cuStreamAttachMemAsync - __cuStreamAttachMemAsync = dlfcn.dlsym(handle, 'cuStreamAttachMemAsync_ptsz') - {{endif}} - {{if 'cuStreamQuery' in found_functions}} - global __cuStreamQuery - __cuStreamQuery = dlfcn.dlsym(handle, 'cuStreamQuery_ptsz') - {{endif}} - {{if 'cuStreamSynchronize' in found_functions}} - global __cuStreamSynchronize - __cuStreamSynchronize = dlfcn.dlsym(handle, 'cuStreamSynchronize_ptsz') - {{endif}} - {{if 'cuStreamCopyAttributes' in found_functions}} - global __cuStreamCopyAttributes - __cuStreamCopyAttributes = dlfcn.dlsym(handle, 'cuStreamCopyAttributes_ptsz') - {{endif}} - {{if 'cuStreamGetAttribute' in found_functions}} - global __cuStreamGetAttribute - __cuStreamGetAttribute = dlfcn.dlsym(handle, 'cuStreamGetAttribute_ptsz') - {{endif}} - {{if 'cuStreamSetAttribute' in found_functions}} - global __cuStreamSetAttribute - __cuStreamSetAttribute = dlfcn.dlsym(handle, 'cuStreamSetAttribute_ptsz') - {{endif}} - {{if 'cuEventRecord' in found_functions}} - global __cuEventRecord - __cuEventRecord = dlfcn.dlsym(handle, 'cuEventRecord_ptsz') - {{endif}} - {{if 'cuEventRecordWithFlags' in found_functions}} - global __cuEventRecordWithFlags - __cuEventRecordWithFlags = dlfcn.dlsym(handle, 'cuEventRecordWithFlags_ptsz') - {{endif}} - {{if 'cuSignalExternalSemaphoresAsync' in found_functions}} - global __cuSignalExternalSemaphoresAsync - __cuSignalExternalSemaphoresAsync = dlfcn.dlsym(handle, 'cuSignalExternalSemaphoresAsync_ptsz') - {{endif}} - {{if 'cuWaitExternalSemaphoresAsync' in found_functions}} - global __cuWaitExternalSemaphoresAsync - __cuWaitExternalSemaphoresAsync = dlfcn.dlsym(handle, 'cuWaitExternalSemaphoresAsync_ptsz') - {{endif}} - {{if 'cuStreamWaitValue32_v2' in found_functions}} - global __cuStreamWaitValue32_v2 - __cuStreamWaitValue32_v2 = dlfcn.dlsym(handle, 'cuStreamWaitValue32_v2_ptsz') - {{endif}} - {{if 'cuStreamWaitValue64_v2' in found_functions}} - global __cuStreamWaitValue64_v2 - __cuStreamWaitValue64_v2 = dlfcn.dlsym(handle, 'cuStreamWaitValue64_v2_ptsz') - {{endif}} - {{if 'cuStreamWriteValue32_v2' in found_functions}} - global __cuStreamWriteValue32_v2 - __cuStreamWriteValue32_v2 = dlfcn.dlsym(handle, 'cuStreamWriteValue32_v2_ptsz') - {{endif}} - {{if 'cuStreamWriteValue64_v2' in found_functions}} - global __cuStreamWriteValue64_v2 - __cuStreamWriteValue64_v2 = dlfcn.dlsym(handle, 'cuStreamWriteValue64_v2_ptsz') - {{endif}} - {{if 'cuStreamBatchMemOp_v2' in found_functions}} - global __cuStreamBatchMemOp_v2 - __cuStreamBatchMemOp_v2 = dlfcn.dlsym(handle, 'cuStreamBatchMemOp_v2_ptsz') - {{endif}} - {{if 'cuLaunchKernel' in found_functions}} - global __cuLaunchKernel - __cuLaunchKernel = dlfcn.dlsym(handle, 'cuLaunchKernel_ptsz') - {{endif}} - {{if 'cuLaunchKernelEx' in found_functions}} - global __cuLaunchKernelEx - __cuLaunchKernelEx = dlfcn.dlsym(handle, 'cuLaunchKernelEx_ptsz') - {{endif}} - {{if 'cuLaunchCooperativeKernel' in found_functions}} - global __cuLaunchCooperativeKernel - __cuLaunchCooperativeKernel = dlfcn.dlsym(handle, 'cuLaunchCooperativeKernel_ptsz') - {{endif}} - {{if 'cuLaunchHostFunc' in found_functions}} - global __cuLaunchHostFunc - __cuLaunchHostFunc = dlfcn.dlsym(handle, 'cuLaunchHostFunc_ptsz') - {{endif}} - {{if 'cuGraphInstantiateWithParams' in found_functions}} - global __cuGraphInstantiateWithParams - __cuGraphInstantiateWithParams = dlfcn.dlsym(handle, 'cuGraphInstantiateWithParams_ptsz') - {{endif}} - {{if 'cuGraphUpload' in found_functions}} - global __cuGraphUpload - __cuGraphUpload = dlfcn.dlsym(handle, 'cuGraphUpload_ptsz') - {{endif}} - {{if 'cuGraphLaunch' in found_functions}} - global __cuGraphLaunch - __cuGraphLaunch = dlfcn.dlsym(handle, 'cuGraphLaunch_ptsz') - {{endif}} - {{if 'cuGraphicsMapResources' in found_functions}} - global __cuGraphicsMapResources - __cuGraphicsMapResources = dlfcn.dlsym(handle, 'cuGraphicsMapResources_ptsz') - {{endif}} - {{if 'cuGraphicsUnmapResources' in found_functions}} - global __cuGraphicsUnmapResources - __cuGraphicsUnmapResources = dlfcn.dlsym(handle, 'cuGraphicsUnmapResources_ptsz') - {{endif}} - else: - # Else get the regular version - pass - {{if 'cuMemcpy' in found_functions}} - global __cuMemcpy - __cuMemcpy = dlfcn.dlsym(handle, 'cuMemcpy') - {{endif}} - {{if 'cuMemcpyPeer' in found_functions}} - global __cuMemcpyPeer - __cuMemcpyPeer = dlfcn.dlsym(handle, 'cuMemcpyPeer') - {{endif}} - {{if 'cuMemcpyHtoD_v2' in found_functions}} - global __cuMemcpyHtoD_v2 - __cuMemcpyHtoD_v2 = dlfcn.dlsym(handle, 'cuMemcpyHtoD_v2') - {{endif}} - {{if 'cuMemcpyDtoH_v2' in found_functions}} - global __cuMemcpyDtoH_v2 - __cuMemcpyDtoH_v2 = dlfcn.dlsym(handle, 'cuMemcpyDtoH_v2') - {{endif}} - {{if 'cuMemcpyDtoD_v2' in found_functions}} - global __cuMemcpyDtoD_v2 - __cuMemcpyDtoD_v2 = dlfcn.dlsym(handle, 'cuMemcpyDtoD_v2') - {{endif}} - {{if 'cuMemcpyDtoA_v2' in found_functions}} - global __cuMemcpyDtoA_v2 - __cuMemcpyDtoA_v2 = dlfcn.dlsym(handle, 'cuMemcpyDtoA_v2') - {{endif}} - {{if 'cuMemcpyAtoD_v2' in found_functions}} - global __cuMemcpyAtoD_v2 - __cuMemcpyAtoD_v2 = dlfcn.dlsym(handle, 'cuMemcpyAtoD_v2') - {{endif}} - {{if 'cuMemcpyHtoA_v2' in found_functions}} - global __cuMemcpyHtoA_v2 - __cuMemcpyHtoA_v2 = dlfcn.dlsym(handle, 'cuMemcpyHtoA_v2') - {{endif}} - {{if 'cuMemcpyAtoH_v2' in found_functions}} - global __cuMemcpyAtoH_v2 - __cuMemcpyAtoH_v2 = dlfcn.dlsym(handle, 'cuMemcpyAtoH_v2') - {{endif}} - {{if 'cuMemcpyAtoA_v2' in found_functions}} - global __cuMemcpyAtoA_v2 - __cuMemcpyAtoA_v2 = dlfcn.dlsym(handle, 'cuMemcpyAtoA_v2') - {{endif}} - {{if 'cuMemcpy2D_v2' in found_functions}} - global __cuMemcpy2D_v2 - __cuMemcpy2D_v2 = dlfcn.dlsym(handle, 'cuMemcpy2D_v2') - {{endif}} - {{if 'cuMemcpy2DUnaligned_v2' in found_functions}} - global __cuMemcpy2DUnaligned_v2 - __cuMemcpy2DUnaligned_v2 = dlfcn.dlsym(handle, 'cuMemcpy2DUnaligned_v2') - {{endif}} - {{if 'cuMemcpy3D_v2' in found_functions}} - global __cuMemcpy3D_v2 - __cuMemcpy3D_v2 = dlfcn.dlsym(handle, 'cuMemcpy3D_v2') - {{endif}} - {{if 'cuMemcpy3DPeer' in found_functions}} - global __cuMemcpy3DPeer - __cuMemcpy3DPeer = dlfcn.dlsym(handle, 'cuMemcpy3DPeer') - {{endif}} - {{if 'cuMemcpyAsync' in found_functions}} - global __cuMemcpyAsync - __cuMemcpyAsync = dlfcn.dlsym(handle, 'cuMemcpyAsync') - {{endif}} - {{if 'cuMemcpyPeerAsync' in found_functions}} - global __cuMemcpyPeerAsync - __cuMemcpyPeerAsync = dlfcn.dlsym(handle, 'cuMemcpyPeerAsync') - {{endif}} - {{if 'cuMemcpyHtoDAsync_v2' in found_functions}} - global __cuMemcpyHtoDAsync_v2 - __cuMemcpyHtoDAsync_v2 = dlfcn.dlsym(handle, 'cuMemcpyHtoDAsync_v2') - {{endif}} - {{if 'cuMemcpyDtoHAsync_v2' in found_functions}} - global __cuMemcpyDtoHAsync_v2 - __cuMemcpyDtoHAsync_v2 = dlfcn.dlsym(handle, 'cuMemcpyDtoHAsync_v2') - {{endif}} - {{if 'cuMemcpyDtoDAsync_v2' in found_functions}} - global __cuMemcpyDtoDAsync_v2 - __cuMemcpyDtoDAsync_v2 = dlfcn.dlsym(handle, 'cuMemcpyDtoDAsync_v2') - {{endif}} - {{if 'cuMemcpyHtoAAsync_v2' in found_functions}} - global __cuMemcpyHtoAAsync_v2 - __cuMemcpyHtoAAsync_v2 = dlfcn.dlsym(handle, 'cuMemcpyHtoAAsync_v2') - {{endif}} - {{if 'cuMemcpyAtoHAsync_v2' in found_functions}} - global __cuMemcpyAtoHAsync_v2 - __cuMemcpyAtoHAsync_v2 = dlfcn.dlsym(handle, 'cuMemcpyAtoHAsync_v2') - {{endif}} - {{if 'cuMemcpy2DAsync_v2' in found_functions}} - global __cuMemcpy2DAsync_v2 - __cuMemcpy2DAsync_v2 = dlfcn.dlsym(handle, 'cuMemcpy2DAsync_v2') - {{endif}} - {{if 'cuMemcpy3DAsync_v2' in found_functions}} - global __cuMemcpy3DAsync_v2 - __cuMemcpy3DAsync_v2 = dlfcn.dlsym(handle, 'cuMemcpy3DAsync_v2') - {{endif}} - {{if 'cuMemcpy3DPeerAsync' in found_functions}} - global __cuMemcpy3DPeerAsync - __cuMemcpy3DPeerAsync = dlfcn.dlsym(handle, 'cuMemcpy3DPeerAsync') - {{endif}} - {{if 'cuMemsetD8_v2' in found_functions}} - global __cuMemsetD8_v2 - __cuMemsetD8_v2 = dlfcn.dlsym(handle, 'cuMemsetD8_v2') - {{endif}} - {{if 'cuMemsetD16_v2' in found_functions}} - global __cuMemsetD16_v2 - __cuMemsetD16_v2 = dlfcn.dlsym(handle, 'cuMemsetD16_v2') - {{endif}} - {{if 'cuMemsetD32_v2' in found_functions}} - global __cuMemsetD32_v2 - __cuMemsetD32_v2 = dlfcn.dlsym(handle, 'cuMemsetD32_v2') - {{endif}} - {{if 'cuMemsetD2D8_v2' in found_functions}} - global __cuMemsetD2D8_v2 - __cuMemsetD2D8_v2 = dlfcn.dlsym(handle, 'cuMemsetD2D8_v2') - {{endif}} - {{if 'cuMemsetD2D16_v2' in found_functions}} - global __cuMemsetD2D16_v2 - __cuMemsetD2D16_v2 = dlfcn.dlsym(handle, 'cuMemsetD2D16_v2') - {{endif}} - {{if 'cuMemsetD2D32_v2' in found_functions}} - global __cuMemsetD2D32_v2 - __cuMemsetD2D32_v2 = dlfcn.dlsym(handle, 'cuMemsetD2D32_v2') - {{endif}} - {{if 'cuMemsetD8Async' in found_functions}} - global __cuMemsetD8Async - __cuMemsetD8Async = dlfcn.dlsym(handle, 'cuMemsetD8Async') - {{endif}} - {{if 'cuMemsetD16Async' in found_functions}} - global __cuMemsetD16Async - __cuMemsetD16Async = dlfcn.dlsym(handle, 'cuMemsetD16Async') - {{endif}} - {{if 'cuMemsetD32Async' in found_functions}} - global __cuMemsetD32Async - __cuMemsetD32Async = dlfcn.dlsym(handle, 'cuMemsetD32Async') - {{endif}} - {{if 'cuMemsetD2D8Async' in found_functions}} - global __cuMemsetD2D8Async - __cuMemsetD2D8Async = dlfcn.dlsym(handle, 'cuMemsetD2D8Async') - {{endif}} - {{if 'cuMemsetD2D16Async' in found_functions}} - global __cuMemsetD2D16Async - __cuMemsetD2D16Async = dlfcn.dlsym(handle, 'cuMemsetD2D16Async') - {{endif}} - {{if 'cuMemsetD2D32Async' in found_functions}} - global __cuMemsetD2D32Async - __cuMemsetD2D32Async = dlfcn.dlsym(handle, 'cuMemsetD2D32Async') - {{endif}} - {{if 'cuMemMapArrayAsync' in found_functions}} - global __cuMemMapArrayAsync - __cuMemMapArrayAsync = dlfcn.dlsym(handle, 'cuMemMapArrayAsync') - {{endif}} - {{if 'cuMemFreeAsync' in found_functions}} - global __cuMemFreeAsync - __cuMemFreeAsync = dlfcn.dlsym(handle, 'cuMemFreeAsync') - {{endif}} - {{if 'cuMemAllocAsync' in found_functions}} - global __cuMemAllocAsync - __cuMemAllocAsync = dlfcn.dlsym(handle, 'cuMemAllocAsync') - {{endif}} - {{if 'cuMemAllocFromPoolAsync' in found_functions}} - global __cuMemAllocFromPoolAsync - __cuMemAllocFromPoolAsync = dlfcn.dlsym(handle, 'cuMemAllocFromPoolAsync') - {{endif}} - {{if 'cuMemPrefetchAsync' in found_functions}} - global __cuMemPrefetchAsync - __cuMemPrefetchAsync = dlfcn.dlsym(handle, 'cuMemPrefetchAsync') - {{endif}} - {{if 'cuMemPrefetchAsync_v2' in found_functions}} - global __cuMemPrefetchAsync_v2 - __cuMemPrefetchAsync_v2 = dlfcn.dlsym(handle, 'cuMemPrefetchAsync_v2') - {{endif}} - {{if 'cuStreamGetPriority' in found_functions}} - global __cuStreamGetPriority - __cuStreamGetPriority = dlfcn.dlsym(handle, 'cuStreamGetPriority') - {{endif}} - {{if 'cuStreamGetFlags' in found_functions}} - global __cuStreamGetFlags - __cuStreamGetFlags = dlfcn.dlsym(handle, 'cuStreamGetFlags') - {{endif}} - {{if 'cuStreamGetId' in found_functions}} - global __cuStreamGetId - __cuStreamGetId = dlfcn.dlsym(handle, 'cuStreamGetId') - {{endif}} - {{if 'cuStreamGetCtx' in found_functions}} - global __cuStreamGetCtx - __cuStreamGetCtx = dlfcn.dlsym(handle, 'cuStreamGetCtx') - {{endif}} - {{if 'cuStreamGetCtx_v2' in found_functions}} - global __cuStreamGetCtx_v2 - __cuStreamGetCtx_v2 = dlfcn.dlsym(handle, 'cuStreamGetCtx_v2') - {{endif}} - {{if 'cuStreamWaitEvent' in found_functions}} - global __cuStreamWaitEvent - __cuStreamWaitEvent = dlfcn.dlsym(handle, 'cuStreamWaitEvent') - {{endif}} - {{if 'cuStreamAddCallback' in found_functions}} - global __cuStreamAddCallback - __cuStreamAddCallback = dlfcn.dlsym(handle, 'cuStreamAddCallback') - {{endif}} - {{if 'cuStreamBeginCapture_v2' in found_functions}} - global __cuStreamBeginCapture_v2 - __cuStreamBeginCapture_v2 = dlfcn.dlsym(handle, 'cuStreamBeginCapture_v2') - {{endif}} - {{if 'cuStreamBeginCaptureToGraph' in found_functions}} - global __cuStreamBeginCaptureToGraph - __cuStreamBeginCaptureToGraph = dlfcn.dlsym(handle, 'cuStreamBeginCaptureToGraph') - {{endif}} - {{if 'cuStreamEndCapture' in found_functions}} - global __cuStreamEndCapture - __cuStreamEndCapture = dlfcn.dlsym(handle, 'cuStreamEndCapture') - {{endif}} - {{if 'cuStreamIsCapturing' in found_functions}} - global __cuStreamIsCapturing - __cuStreamIsCapturing = dlfcn.dlsym(handle, 'cuStreamIsCapturing') - {{endif}} - {{if 'cuStreamGetCaptureInfo_v2' in found_functions}} - global __cuStreamGetCaptureInfo_v2 - __cuStreamGetCaptureInfo_v2 = dlfcn.dlsym(handle, 'cuStreamGetCaptureInfo_v2') - {{endif}} - {{if 'cuStreamGetCaptureInfo_v3' in found_functions}} - global __cuStreamGetCaptureInfo_v3 - __cuStreamGetCaptureInfo_v3 = dlfcn.dlsym(handle, 'cuStreamGetCaptureInfo_v3') - {{endif}} - {{if 'cuStreamUpdateCaptureDependencies' in found_functions}} - global __cuStreamUpdateCaptureDependencies - __cuStreamUpdateCaptureDependencies = dlfcn.dlsym(handle, 'cuStreamUpdateCaptureDependencies') - {{endif}} - {{if 'cuStreamUpdateCaptureDependencies_v2' in found_functions}} - global __cuStreamUpdateCaptureDependencies_v2 - __cuStreamUpdateCaptureDependencies_v2 = dlfcn.dlsym(handle, 'cuStreamUpdateCaptureDependencies_v2') - {{endif}} - {{if 'cuStreamAttachMemAsync' in found_functions}} - global __cuStreamAttachMemAsync - __cuStreamAttachMemAsync = dlfcn.dlsym(handle, 'cuStreamAttachMemAsync') - {{endif}} - {{if 'cuStreamQuery' in found_functions}} - global __cuStreamQuery - __cuStreamQuery = dlfcn.dlsym(handle, 'cuStreamQuery') - {{endif}} - {{if 'cuStreamSynchronize' in found_functions}} - global __cuStreamSynchronize - __cuStreamSynchronize = dlfcn.dlsym(handle, 'cuStreamSynchronize') - {{endif}} - {{if 'cuStreamCopyAttributes' in found_functions}} - global __cuStreamCopyAttributes - __cuStreamCopyAttributes = dlfcn.dlsym(handle, 'cuStreamCopyAttributes') - {{endif}} - {{if 'cuStreamGetAttribute' in found_functions}} - global __cuStreamGetAttribute - __cuStreamGetAttribute = dlfcn.dlsym(handle, 'cuStreamGetAttribute') - {{endif}} - {{if 'cuStreamSetAttribute' in found_functions}} - global __cuStreamSetAttribute - __cuStreamSetAttribute = dlfcn.dlsym(handle, 'cuStreamSetAttribute') - {{endif}} - {{if 'cuEventRecord' in found_functions}} - global __cuEventRecord - __cuEventRecord = dlfcn.dlsym(handle, 'cuEventRecord') - {{endif}} - {{if 'cuEventRecordWithFlags' in found_functions}} - global __cuEventRecordWithFlags - __cuEventRecordWithFlags = dlfcn.dlsym(handle, 'cuEventRecordWithFlags') - {{endif}} - {{if 'cuSignalExternalSemaphoresAsync' in found_functions}} - global __cuSignalExternalSemaphoresAsync - __cuSignalExternalSemaphoresAsync = dlfcn.dlsym(handle, 'cuSignalExternalSemaphoresAsync') - {{endif}} - {{if 'cuWaitExternalSemaphoresAsync' in found_functions}} - global __cuWaitExternalSemaphoresAsync - __cuWaitExternalSemaphoresAsync = dlfcn.dlsym(handle, 'cuWaitExternalSemaphoresAsync') - {{endif}} - {{if 'cuStreamWaitValue32_v2' in found_functions}} - global __cuStreamWaitValue32_v2 - __cuStreamWaitValue32_v2 = dlfcn.dlsym(handle, 'cuStreamWaitValue32_v2') - {{endif}} - {{if 'cuStreamWaitValue64_v2' in found_functions}} - global __cuStreamWaitValue64_v2 - __cuStreamWaitValue64_v2 = dlfcn.dlsym(handle, 'cuStreamWaitValue64_v2') - {{endif}} - {{if 'cuStreamWriteValue32_v2' in found_functions}} - global __cuStreamWriteValue32_v2 - __cuStreamWriteValue32_v2 = dlfcn.dlsym(handle, 'cuStreamWriteValue32_v2') - {{endif}} - {{if 'cuStreamWriteValue64_v2' in found_functions}} - global __cuStreamWriteValue64_v2 - __cuStreamWriteValue64_v2 = dlfcn.dlsym(handle, 'cuStreamWriteValue64_v2') - {{endif}} - {{if 'cuStreamBatchMemOp_v2' in found_functions}} - global __cuStreamBatchMemOp_v2 - __cuStreamBatchMemOp_v2 = dlfcn.dlsym(handle, 'cuStreamBatchMemOp_v2') - {{endif}} - {{if 'cuLaunchKernel' in found_functions}} - global __cuLaunchKernel - __cuLaunchKernel = dlfcn.dlsym(handle, 'cuLaunchKernel') - {{endif}} - {{if 'cuLaunchKernelEx' in found_functions}} - global __cuLaunchKernelEx - __cuLaunchKernelEx = dlfcn.dlsym(handle, 'cuLaunchKernelEx') - {{endif}} - {{if 'cuLaunchCooperativeKernel' in found_functions}} - global __cuLaunchCooperativeKernel - __cuLaunchCooperativeKernel = dlfcn.dlsym(handle, 'cuLaunchCooperativeKernel') - {{endif}} - {{if 'cuLaunchHostFunc' in found_functions}} - global __cuLaunchHostFunc - __cuLaunchHostFunc = dlfcn.dlsym(handle, 'cuLaunchHostFunc') - {{endif}} - {{if 'cuGraphInstantiateWithParams' in found_functions}} - global __cuGraphInstantiateWithParams - __cuGraphInstantiateWithParams = dlfcn.dlsym(handle, 'cuGraphInstantiateWithParams') - {{endif}} - {{if 'cuGraphUpload' in found_functions}} - global __cuGraphUpload - __cuGraphUpload = dlfcn.dlsym(handle, 'cuGraphUpload') - {{endif}} - {{if 'cuGraphLaunch' in found_functions}} - global __cuGraphLaunch - __cuGraphLaunch = dlfcn.dlsym(handle, 'cuGraphLaunch') - {{endif}} - {{if 'cuGraphicsMapResources' in found_functions}} - global __cuGraphicsMapResources - __cuGraphicsMapResources = dlfcn.dlsym(handle, 'cuGraphicsMapResources') - {{endif}} - {{if 'cuGraphicsUnmapResources' in found_functions}} - global __cuGraphicsUnmapResources - __cuGraphicsUnmapResources = dlfcn.dlsym(handle, 'cuGraphicsUnmapResources') - {{endif}} - # Get remaining functions - {{if 'cuGetErrorString' in found_functions}} - global __cuGetErrorString - __cuGetErrorString = dlfcn.dlsym(handle, 'cuGetErrorString') - {{endif}} - {{if 'cuGetErrorName' in found_functions}} - global __cuGetErrorName - __cuGetErrorName = dlfcn.dlsym(handle, 'cuGetErrorName') - {{endif}} - {{if 'cuInit' in found_functions}} - global __cuInit - __cuInit = dlfcn.dlsym(handle, 'cuInit') - {{endif}} - {{if 'cuDriverGetVersion' in found_functions}} - global __cuDriverGetVersion - __cuDriverGetVersion = dlfcn.dlsym(handle, 'cuDriverGetVersion') - {{endif}} - {{if 'cuDeviceGet' in found_functions}} - global __cuDeviceGet - __cuDeviceGet = dlfcn.dlsym(handle, 'cuDeviceGet') - {{endif}} - {{if 'cuDeviceGetCount' in found_functions}} - global __cuDeviceGetCount - __cuDeviceGetCount = dlfcn.dlsym(handle, 'cuDeviceGetCount') - {{endif}} - {{if 'cuDeviceGetName' in found_functions}} - global __cuDeviceGetName - __cuDeviceGetName = dlfcn.dlsym(handle, 'cuDeviceGetName') - {{endif}} - {{if 'cuDeviceGetUuid' in found_functions}} - global __cuDeviceGetUuid - __cuDeviceGetUuid = dlfcn.dlsym(handle, 'cuDeviceGetUuid') - {{endif}} - {{if 'cuDeviceGetUuid_v2' in found_functions}} - global __cuDeviceGetUuid_v2 - __cuDeviceGetUuid_v2 = dlfcn.dlsym(handle, 'cuDeviceGetUuid_v2') - {{endif}} - {{if 'cuDeviceGetLuid' in found_functions}} - global __cuDeviceGetLuid - __cuDeviceGetLuid = dlfcn.dlsym(handle, 'cuDeviceGetLuid') - {{endif}} - {{if 'cuDeviceTotalMem_v2' in found_functions}} - global __cuDeviceTotalMem_v2 - __cuDeviceTotalMem_v2 = dlfcn.dlsym(handle, 'cuDeviceTotalMem_v2') - {{endif}} - {{if 'cuDeviceGetTexture1DLinearMaxWidth' in found_functions}} - global __cuDeviceGetTexture1DLinearMaxWidth - __cuDeviceGetTexture1DLinearMaxWidth = dlfcn.dlsym(handle, 'cuDeviceGetTexture1DLinearMaxWidth') - {{endif}} - {{if 'cuDeviceGetAttribute' in found_functions}} - global __cuDeviceGetAttribute - __cuDeviceGetAttribute = dlfcn.dlsym(handle, 'cuDeviceGetAttribute') - {{endif}} - {{if 'cuDeviceGetNvSciSyncAttributes' in found_functions}} - global __cuDeviceGetNvSciSyncAttributes - __cuDeviceGetNvSciSyncAttributes = dlfcn.dlsym(handle, 'cuDeviceGetNvSciSyncAttributes') - {{endif}} - {{if 'cuDeviceSetMemPool' in found_functions}} - global __cuDeviceSetMemPool - __cuDeviceSetMemPool = dlfcn.dlsym(handle, 'cuDeviceSetMemPool') - {{endif}} - {{if 'cuDeviceGetMemPool' in found_functions}} - global __cuDeviceGetMemPool - __cuDeviceGetMemPool = dlfcn.dlsym(handle, 'cuDeviceGetMemPool') - {{endif}} - {{if 'cuDeviceGetDefaultMemPool' in found_functions}} - global __cuDeviceGetDefaultMemPool - __cuDeviceGetDefaultMemPool = dlfcn.dlsym(handle, 'cuDeviceGetDefaultMemPool') - {{endif}} - {{if 'cuDeviceGetExecAffinitySupport' in found_functions}} - global __cuDeviceGetExecAffinitySupport - __cuDeviceGetExecAffinitySupport = dlfcn.dlsym(handle, 'cuDeviceGetExecAffinitySupport') - {{endif}} - {{if 'cuFlushGPUDirectRDMAWrites' in found_functions}} - global __cuFlushGPUDirectRDMAWrites - __cuFlushGPUDirectRDMAWrites = dlfcn.dlsym(handle, 'cuFlushGPUDirectRDMAWrites') - {{endif}} - {{if 'cuDeviceGetProperties' in found_functions}} - global __cuDeviceGetProperties - __cuDeviceGetProperties = dlfcn.dlsym(handle, 'cuDeviceGetProperties') - {{endif}} - {{if 'cuDeviceComputeCapability' in found_functions}} - global __cuDeviceComputeCapability - __cuDeviceComputeCapability = dlfcn.dlsym(handle, 'cuDeviceComputeCapability') - {{endif}} - {{if 'cuDevicePrimaryCtxRetain' in found_functions}} - global __cuDevicePrimaryCtxRetain - __cuDevicePrimaryCtxRetain = dlfcn.dlsym(handle, 'cuDevicePrimaryCtxRetain') - {{endif}} - {{if 'cuDevicePrimaryCtxRelease_v2' in found_functions}} - global __cuDevicePrimaryCtxRelease_v2 - __cuDevicePrimaryCtxRelease_v2 = dlfcn.dlsym(handle, 'cuDevicePrimaryCtxRelease_v2') - {{endif}} - {{if 'cuDevicePrimaryCtxSetFlags_v2' in found_functions}} - global __cuDevicePrimaryCtxSetFlags_v2 - __cuDevicePrimaryCtxSetFlags_v2 = dlfcn.dlsym(handle, 'cuDevicePrimaryCtxSetFlags_v2') - {{endif}} - {{if 'cuDevicePrimaryCtxGetState' in found_functions}} - global __cuDevicePrimaryCtxGetState - __cuDevicePrimaryCtxGetState = dlfcn.dlsym(handle, 'cuDevicePrimaryCtxGetState') - {{endif}} - {{if 'cuDevicePrimaryCtxReset_v2' in found_functions}} - global __cuDevicePrimaryCtxReset_v2 - __cuDevicePrimaryCtxReset_v2 = dlfcn.dlsym(handle, 'cuDevicePrimaryCtxReset_v2') - {{endif}} - {{if 'cuCtxCreate_v2' in found_functions}} - global __cuCtxCreate_v2 - __cuCtxCreate_v2 = dlfcn.dlsym(handle, 'cuCtxCreate_v2') - {{endif}} - {{if 'cuCtxCreate_v3' in found_functions}} - global __cuCtxCreate_v3 - __cuCtxCreate_v3 = dlfcn.dlsym(handle, 'cuCtxCreate_v3') - {{endif}} - {{if 'cuCtxCreate_v4' in found_functions}} - global __cuCtxCreate_v4 - __cuCtxCreate_v4 = dlfcn.dlsym(handle, 'cuCtxCreate_v4') - {{endif}} - {{if 'cuCtxDestroy_v2' in found_functions}} - global __cuCtxDestroy_v2 - __cuCtxDestroy_v2 = dlfcn.dlsym(handle, 'cuCtxDestroy_v2') - {{endif}} - {{if 'cuCtxPushCurrent_v2' in found_functions}} - global __cuCtxPushCurrent_v2 - __cuCtxPushCurrent_v2 = dlfcn.dlsym(handle, 'cuCtxPushCurrent_v2') - {{endif}} - {{if 'cuCtxPopCurrent_v2' in found_functions}} - global __cuCtxPopCurrent_v2 - __cuCtxPopCurrent_v2 = dlfcn.dlsym(handle, 'cuCtxPopCurrent_v2') - {{endif}} - {{if 'cuCtxSetCurrent' in found_functions}} - global __cuCtxSetCurrent - __cuCtxSetCurrent = dlfcn.dlsym(handle, 'cuCtxSetCurrent') - {{endif}} - {{if 'cuCtxGetCurrent' in found_functions}} - global __cuCtxGetCurrent - __cuCtxGetCurrent = dlfcn.dlsym(handle, 'cuCtxGetCurrent') - {{endif}} - {{if 'cuCtxGetDevice' in found_functions}} - global __cuCtxGetDevice - __cuCtxGetDevice = dlfcn.dlsym(handle, 'cuCtxGetDevice') - {{endif}} - {{if 'cuCtxGetFlags' in found_functions}} - global __cuCtxGetFlags - __cuCtxGetFlags = dlfcn.dlsym(handle, 'cuCtxGetFlags') - {{endif}} - {{if 'cuCtxSetFlags' in found_functions}} - global __cuCtxSetFlags - __cuCtxSetFlags = dlfcn.dlsym(handle, 'cuCtxSetFlags') - {{endif}} - {{if 'cuCtxGetId' in found_functions}} - global __cuCtxGetId - __cuCtxGetId = dlfcn.dlsym(handle, 'cuCtxGetId') - {{endif}} - {{if 'cuCtxSynchronize' in found_functions}} - global __cuCtxSynchronize - __cuCtxSynchronize = dlfcn.dlsym(handle, 'cuCtxSynchronize') - {{endif}} - {{if 'cuCtxSetLimit' in found_functions}} - global __cuCtxSetLimit - __cuCtxSetLimit = dlfcn.dlsym(handle, 'cuCtxSetLimit') - {{endif}} - {{if 'cuCtxGetLimit' in found_functions}} - global __cuCtxGetLimit - __cuCtxGetLimit = dlfcn.dlsym(handle, 'cuCtxGetLimit') - {{endif}} - {{if 'cuCtxGetCacheConfig' in found_functions}} - global __cuCtxGetCacheConfig - __cuCtxGetCacheConfig = dlfcn.dlsym(handle, 'cuCtxGetCacheConfig') - {{endif}} - {{if 'cuCtxSetCacheConfig' in found_functions}} - global __cuCtxSetCacheConfig - __cuCtxSetCacheConfig = dlfcn.dlsym(handle, 'cuCtxSetCacheConfig') - {{endif}} - {{if 'cuCtxGetApiVersion' in found_functions}} - global __cuCtxGetApiVersion - __cuCtxGetApiVersion = dlfcn.dlsym(handle, 'cuCtxGetApiVersion') - {{endif}} - {{if 'cuCtxGetStreamPriorityRange' in found_functions}} - global __cuCtxGetStreamPriorityRange - __cuCtxGetStreamPriorityRange = dlfcn.dlsym(handle, 'cuCtxGetStreamPriorityRange') - {{endif}} - {{if 'cuCtxResetPersistingL2Cache' in found_functions}} - global __cuCtxResetPersistingL2Cache - __cuCtxResetPersistingL2Cache = dlfcn.dlsym(handle, 'cuCtxResetPersistingL2Cache') - {{endif}} - {{if 'cuCtxGetExecAffinity' in found_functions}} - global __cuCtxGetExecAffinity - __cuCtxGetExecAffinity = dlfcn.dlsym(handle, 'cuCtxGetExecAffinity') - {{endif}} - {{if 'cuCtxRecordEvent' in found_functions}} - global __cuCtxRecordEvent - __cuCtxRecordEvent = dlfcn.dlsym(handle, 'cuCtxRecordEvent') - {{endif}} - {{if 'cuCtxWaitEvent' in found_functions}} - global __cuCtxWaitEvent - __cuCtxWaitEvent = dlfcn.dlsym(handle, 'cuCtxWaitEvent') - {{endif}} - {{if 'cuCtxAttach' in found_functions}} - global __cuCtxAttach - __cuCtxAttach = dlfcn.dlsym(handle, 'cuCtxAttach') - {{endif}} - {{if 'cuCtxDetach' in found_functions}} - global __cuCtxDetach - __cuCtxDetach = dlfcn.dlsym(handle, 'cuCtxDetach') - {{endif}} - {{if 'cuCtxGetSharedMemConfig' in found_functions}} - global __cuCtxGetSharedMemConfig - __cuCtxGetSharedMemConfig = dlfcn.dlsym(handle, 'cuCtxGetSharedMemConfig') - {{endif}} - {{if 'cuCtxSetSharedMemConfig' in found_functions}} - global __cuCtxSetSharedMemConfig - __cuCtxSetSharedMemConfig = dlfcn.dlsym(handle, 'cuCtxSetSharedMemConfig') - {{endif}} - {{if 'cuModuleLoad' in found_functions}} - global __cuModuleLoad - __cuModuleLoad = dlfcn.dlsym(handle, 'cuModuleLoad') - {{endif}} - {{if 'cuModuleLoadData' in found_functions}} - global __cuModuleLoadData - __cuModuleLoadData = dlfcn.dlsym(handle, 'cuModuleLoadData') - {{endif}} - {{if 'cuModuleLoadDataEx' in found_functions}} - global __cuModuleLoadDataEx - __cuModuleLoadDataEx = dlfcn.dlsym(handle, 'cuModuleLoadDataEx') - {{endif}} - {{if 'cuModuleLoadFatBinary' in found_functions}} - global __cuModuleLoadFatBinary - __cuModuleLoadFatBinary = dlfcn.dlsym(handle, 'cuModuleLoadFatBinary') - {{endif}} - {{if 'cuModuleUnload' in found_functions}} - global __cuModuleUnload - __cuModuleUnload = dlfcn.dlsym(handle, 'cuModuleUnload') - {{endif}} - {{if 'cuModuleGetLoadingMode' in found_functions}} - global __cuModuleGetLoadingMode - __cuModuleGetLoadingMode = dlfcn.dlsym(handle, 'cuModuleGetLoadingMode') - {{endif}} - {{if 'cuModuleGetFunction' in found_functions}} - global __cuModuleGetFunction - __cuModuleGetFunction = dlfcn.dlsym(handle, 'cuModuleGetFunction') - {{endif}} - {{if 'cuModuleGetFunctionCount' in found_functions}} - global __cuModuleGetFunctionCount - __cuModuleGetFunctionCount = dlfcn.dlsym(handle, 'cuModuleGetFunctionCount') - {{endif}} - {{if 'cuModuleEnumerateFunctions' in found_functions}} - global __cuModuleEnumerateFunctions - __cuModuleEnumerateFunctions = dlfcn.dlsym(handle, 'cuModuleEnumerateFunctions') - {{endif}} - {{if 'cuModuleGetGlobal_v2' in found_functions}} - global __cuModuleGetGlobal_v2 - __cuModuleGetGlobal_v2 = dlfcn.dlsym(handle, 'cuModuleGetGlobal_v2') - {{endif}} - {{if 'cuLinkCreate_v2' in found_functions}} - global __cuLinkCreate_v2 - __cuLinkCreate_v2 = dlfcn.dlsym(handle, 'cuLinkCreate_v2') - {{endif}} - {{if 'cuLinkAddData_v2' in found_functions}} - global __cuLinkAddData_v2 - __cuLinkAddData_v2 = dlfcn.dlsym(handle, 'cuLinkAddData_v2') - {{endif}} - {{if 'cuLinkAddFile_v2' in found_functions}} - global __cuLinkAddFile_v2 - __cuLinkAddFile_v2 = dlfcn.dlsym(handle, 'cuLinkAddFile_v2') - {{endif}} - {{if 'cuLinkComplete' in found_functions}} - global __cuLinkComplete - __cuLinkComplete = dlfcn.dlsym(handle, 'cuLinkComplete') - {{endif}} - {{if 'cuLinkDestroy' in found_functions}} - global __cuLinkDestroy - __cuLinkDestroy = dlfcn.dlsym(handle, 'cuLinkDestroy') - {{endif}} - {{if 'cuModuleGetTexRef' in found_functions}} - global __cuModuleGetTexRef - __cuModuleGetTexRef = dlfcn.dlsym(handle, 'cuModuleGetTexRef') - {{endif}} - {{if 'cuModuleGetSurfRef' in found_functions}} - global __cuModuleGetSurfRef - __cuModuleGetSurfRef = dlfcn.dlsym(handle, 'cuModuleGetSurfRef') - {{endif}} - {{if 'cuLibraryLoadData' in found_functions}} - global __cuLibraryLoadData - __cuLibraryLoadData = dlfcn.dlsym(handle, 'cuLibraryLoadData') - {{endif}} - {{if 'cuLibraryLoadFromFile' in found_functions}} - global __cuLibraryLoadFromFile - __cuLibraryLoadFromFile = dlfcn.dlsym(handle, 'cuLibraryLoadFromFile') - {{endif}} - {{if 'cuLibraryUnload' in found_functions}} - global __cuLibraryUnload - __cuLibraryUnload = dlfcn.dlsym(handle, 'cuLibraryUnload') - {{endif}} - {{if 'cuLibraryGetKernel' in found_functions}} - global __cuLibraryGetKernel - __cuLibraryGetKernel = dlfcn.dlsym(handle, 'cuLibraryGetKernel') - {{endif}} - {{if 'cuLibraryGetKernelCount' in found_functions}} - global __cuLibraryGetKernelCount - __cuLibraryGetKernelCount = dlfcn.dlsym(handle, 'cuLibraryGetKernelCount') - {{endif}} - {{if 'cuLibraryEnumerateKernels' in found_functions}} - global __cuLibraryEnumerateKernels - __cuLibraryEnumerateKernels = dlfcn.dlsym(handle, 'cuLibraryEnumerateKernels') - {{endif}} - {{if 'cuLibraryGetModule' in found_functions}} - global __cuLibraryGetModule - __cuLibraryGetModule = dlfcn.dlsym(handle, 'cuLibraryGetModule') - {{endif}} - {{if 'cuKernelGetFunction' in found_functions}} - global __cuKernelGetFunction - __cuKernelGetFunction = dlfcn.dlsym(handle, 'cuKernelGetFunction') - {{endif}} - {{if 'cuKernelGetLibrary' in found_functions}} - global __cuKernelGetLibrary - __cuKernelGetLibrary = dlfcn.dlsym(handle, 'cuKernelGetLibrary') - {{endif}} - {{if 'cuLibraryGetGlobal' in found_functions}} - global __cuLibraryGetGlobal - __cuLibraryGetGlobal = dlfcn.dlsym(handle, 'cuLibraryGetGlobal') - {{endif}} - {{if 'cuLibraryGetManaged' in found_functions}} - global __cuLibraryGetManaged - __cuLibraryGetManaged = dlfcn.dlsym(handle, 'cuLibraryGetManaged') - {{endif}} - {{if 'cuLibraryGetUnifiedFunction' in found_functions}} - global __cuLibraryGetUnifiedFunction - __cuLibraryGetUnifiedFunction = dlfcn.dlsym(handle, 'cuLibraryGetUnifiedFunction') - {{endif}} - {{if 'cuKernelGetAttribute' in found_functions}} - global __cuKernelGetAttribute - __cuKernelGetAttribute = dlfcn.dlsym(handle, 'cuKernelGetAttribute') - {{endif}} - {{if 'cuKernelSetAttribute' in found_functions}} - global __cuKernelSetAttribute - __cuKernelSetAttribute = dlfcn.dlsym(handle, 'cuKernelSetAttribute') - {{endif}} - {{if 'cuKernelSetCacheConfig' in found_functions}} - global __cuKernelSetCacheConfig - __cuKernelSetCacheConfig = dlfcn.dlsym(handle, 'cuKernelSetCacheConfig') - {{endif}} - {{if 'cuKernelGetName' in found_functions}} - global __cuKernelGetName - __cuKernelGetName = dlfcn.dlsym(handle, 'cuKernelGetName') - {{endif}} - {{if 'cuKernelGetParamInfo' in found_functions}} - global __cuKernelGetParamInfo - __cuKernelGetParamInfo = dlfcn.dlsym(handle, 'cuKernelGetParamInfo') - {{endif}} - {{if 'cuMemGetInfo_v2' in found_functions}} - global __cuMemGetInfo_v2 - __cuMemGetInfo_v2 = dlfcn.dlsym(handle, 'cuMemGetInfo_v2') - {{endif}} - {{if 'cuMemAlloc_v2' in found_functions}} - global __cuMemAlloc_v2 - __cuMemAlloc_v2 = dlfcn.dlsym(handle, 'cuMemAlloc_v2') - {{endif}} - {{if 'cuMemAllocPitch_v2' in found_functions}} - global __cuMemAllocPitch_v2 - __cuMemAllocPitch_v2 = dlfcn.dlsym(handle, 'cuMemAllocPitch_v2') - {{endif}} - {{if 'cuMemFree_v2' in found_functions}} - global __cuMemFree_v2 - __cuMemFree_v2 = dlfcn.dlsym(handle, 'cuMemFree_v2') - {{endif}} - {{if 'cuMemGetAddressRange_v2' in found_functions}} - global __cuMemGetAddressRange_v2 - __cuMemGetAddressRange_v2 = dlfcn.dlsym(handle, 'cuMemGetAddressRange_v2') - {{endif}} - {{if 'cuMemAllocHost_v2' in found_functions}} - global __cuMemAllocHost_v2 - __cuMemAllocHost_v2 = dlfcn.dlsym(handle, 'cuMemAllocHost_v2') - {{endif}} - {{if 'cuMemFreeHost' in found_functions}} - global __cuMemFreeHost - __cuMemFreeHost = dlfcn.dlsym(handle, 'cuMemFreeHost') - {{endif}} - {{if 'cuMemHostAlloc' in found_functions}} - global __cuMemHostAlloc - __cuMemHostAlloc = dlfcn.dlsym(handle, 'cuMemHostAlloc') - {{endif}} - {{if 'cuMemHostGetDevicePointer_v2' in found_functions}} - global __cuMemHostGetDevicePointer_v2 - __cuMemHostGetDevicePointer_v2 = dlfcn.dlsym(handle, 'cuMemHostGetDevicePointer_v2') - {{endif}} - {{if 'cuMemHostGetFlags' in found_functions}} - global __cuMemHostGetFlags - __cuMemHostGetFlags = dlfcn.dlsym(handle, 'cuMemHostGetFlags') - {{endif}} - {{if 'cuMemAllocManaged' in found_functions}} - global __cuMemAllocManaged - __cuMemAllocManaged = dlfcn.dlsym(handle, 'cuMemAllocManaged') - {{endif}} - {{if 'cuDeviceRegisterAsyncNotification' in found_functions}} - global __cuDeviceRegisterAsyncNotification - __cuDeviceRegisterAsyncNotification = dlfcn.dlsym(handle, 'cuDeviceRegisterAsyncNotification') - {{endif}} - {{if 'cuDeviceUnregisterAsyncNotification' in found_functions}} - global __cuDeviceUnregisterAsyncNotification - __cuDeviceUnregisterAsyncNotification = dlfcn.dlsym(handle, 'cuDeviceUnregisterAsyncNotification') - {{endif}} - {{if 'cuDeviceGetByPCIBusId' in found_functions}} - global __cuDeviceGetByPCIBusId - __cuDeviceGetByPCIBusId = dlfcn.dlsym(handle, 'cuDeviceGetByPCIBusId') - {{endif}} - {{if 'cuDeviceGetPCIBusId' in found_functions}} - global __cuDeviceGetPCIBusId - __cuDeviceGetPCIBusId = dlfcn.dlsym(handle, 'cuDeviceGetPCIBusId') - {{endif}} - {{if 'cuIpcGetEventHandle' in found_functions}} - global __cuIpcGetEventHandle - __cuIpcGetEventHandle = dlfcn.dlsym(handle, 'cuIpcGetEventHandle') - {{endif}} - {{if 'cuIpcOpenEventHandle' in found_functions}} - global __cuIpcOpenEventHandle - __cuIpcOpenEventHandle = dlfcn.dlsym(handle, 'cuIpcOpenEventHandle') - {{endif}} - {{if 'cuIpcGetMemHandle' in found_functions}} - global __cuIpcGetMemHandle - __cuIpcGetMemHandle = dlfcn.dlsym(handle, 'cuIpcGetMemHandle') - {{endif}} - {{if 'cuIpcOpenMemHandle_v2' in found_functions}} - global __cuIpcOpenMemHandle_v2 - __cuIpcOpenMemHandle_v2 = dlfcn.dlsym(handle, 'cuIpcOpenMemHandle_v2') - {{endif}} - {{if 'cuIpcCloseMemHandle' in found_functions}} - global __cuIpcCloseMemHandle - __cuIpcCloseMemHandle = dlfcn.dlsym(handle, 'cuIpcCloseMemHandle') - {{endif}} - {{if 'cuMemHostRegister_v2' in found_functions}} - global __cuMemHostRegister_v2 - __cuMemHostRegister_v2 = dlfcn.dlsym(handle, 'cuMemHostRegister_v2') - {{endif}} - {{if 'cuMemHostUnregister' in found_functions}} - global __cuMemHostUnregister - __cuMemHostUnregister = dlfcn.dlsym(handle, 'cuMemHostUnregister') - {{endif}} - {{if 'cuArrayCreate_v2' in found_functions}} - global __cuArrayCreate_v2 - __cuArrayCreate_v2 = dlfcn.dlsym(handle, 'cuArrayCreate_v2') - {{endif}} - {{if 'cuArrayGetDescriptor_v2' in found_functions}} - global __cuArrayGetDescriptor_v2 - __cuArrayGetDescriptor_v2 = dlfcn.dlsym(handle, 'cuArrayGetDescriptor_v2') - {{endif}} - {{if 'cuArrayGetSparseProperties' in found_functions}} - global __cuArrayGetSparseProperties - __cuArrayGetSparseProperties = dlfcn.dlsym(handle, 'cuArrayGetSparseProperties') - {{endif}} - {{if 'cuMipmappedArrayGetSparseProperties' in found_functions}} - global __cuMipmappedArrayGetSparseProperties - __cuMipmappedArrayGetSparseProperties = dlfcn.dlsym(handle, 'cuMipmappedArrayGetSparseProperties') - {{endif}} - {{if 'cuArrayGetMemoryRequirements' in found_functions}} - global __cuArrayGetMemoryRequirements - __cuArrayGetMemoryRequirements = dlfcn.dlsym(handle, 'cuArrayGetMemoryRequirements') - {{endif}} - {{if 'cuMipmappedArrayGetMemoryRequirements' in found_functions}} - global __cuMipmappedArrayGetMemoryRequirements - __cuMipmappedArrayGetMemoryRequirements = dlfcn.dlsym(handle, 'cuMipmappedArrayGetMemoryRequirements') - {{endif}} - {{if 'cuArrayGetPlane' in found_functions}} - global __cuArrayGetPlane - __cuArrayGetPlane = dlfcn.dlsym(handle, 'cuArrayGetPlane') - {{endif}} - {{if 'cuArrayDestroy' in found_functions}} - global __cuArrayDestroy - __cuArrayDestroy = dlfcn.dlsym(handle, 'cuArrayDestroy') - {{endif}} - {{if 'cuArray3DCreate_v2' in found_functions}} - global __cuArray3DCreate_v2 - __cuArray3DCreate_v2 = dlfcn.dlsym(handle, 'cuArray3DCreate_v2') - {{endif}} - {{if 'cuArray3DGetDescriptor_v2' in found_functions}} - global __cuArray3DGetDescriptor_v2 - __cuArray3DGetDescriptor_v2 = dlfcn.dlsym(handle, 'cuArray3DGetDescriptor_v2') - {{endif}} - {{if 'cuMipmappedArrayCreate' in found_functions}} - global __cuMipmappedArrayCreate - __cuMipmappedArrayCreate = dlfcn.dlsym(handle, 'cuMipmappedArrayCreate') - {{endif}} - {{if 'cuMipmappedArrayGetLevel' in found_functions}} - global __cuMipmappedArrayGetLevel - __cuMipmappedArrayGetLevel = dlfcn.dlsym(handle, 'cuMipmappedArrayGetLevel') - {{endif}} - {{if 'cuMipmappedArrayDestroy' in found_functions}} - global __cuMipmappedArrayDestroy - __cuMipmappedArrayDestroy = dlfcn.dlsym(handle, 'cuMipmappedArrayDestroy') - {{endif}} - {{if 'cuMemGetHandleForAddressRange' in found_functions}} - global __cuMemGetHandleForAddressRange - __cuMemGetHandleForAddressRange = dlfcn.dlsym(handle, 'cuMemGetHandleForAddressRange') - {{endif}} - {{if 'cuMemAddressReserve' in found_functions}} - global __cuMemAddressReserve - __cuMemAddressReserve = dlfcn.dlsym(handle, 'cuMemAddressReserve') - {{endif}} - {{if 'cuMemAddressFree' in found_functions}} - global __cuMemAddressFree - __cuMemAddressFree = dlfcn.dlsym(handle, 'cuMemAddressFree') - {{endif}} - {{if 'cuMemCreate' in found_functions}} - global __cuMemCreate - __cuMemCreate = dlfcn.dlsym(handle, 'cuMemCreate') - {{endif}} - {{if 'cuMemRelease' in found_functions}} - global __cuMemRelease - __cuMemRelease = dlfcn.dlsym(handle, 'cuMemRelease') - {{endif}} - {{if 'cuMemMap' in found_functions}} - global __cuMemMap - __cuMemMap = dlfcn.dlsym(handle, 'cuMemMap') - {{endif}} - {{if 'cuMemUnmap' in found_functions}} - global __cuMemUnmap - __cuMemUnmap = dlfcn.dlsym(handle, 'cuMemUnmap') - {{endif}} - {{if 'cuMemSetAccess' in found_functions}} - global __cuMemSetAccess - __cuMemSetAccess = dlfcn.dlsym(handle, 'cuMemSetAccess') - {{endif}} - {{if 'cuMemGetAccess' in found_functions}} - global __cuMemGetAccess - __cuMemGetAccess = dlfcn.dlsym(handle, 'cuMemGetAccess') - {{endif}} - {{if 'cuMemExportToShareableHandle' in found_functions}} - global __cuMemExportToShareableHandle - __cuMemExportToShareableHandle = dlfcn.dlsym(handle, 'cuMemExportToShareableHandle') - {{endif}} - {{if 'cuMemImportFromShareableHandle' in found_functions}} - global __cuMemImportFromShareableHandle - __cuMemImportFromShareableHandle = dlfcn.dlsym(handle, 'cuMemImportFromShareableHandle') - {{endif}} - {{if 'cuMemGetAllocationGranularity' in found_functions}} - global __cuMemGetAllocationGranularity - __cuMemGetAllocationGranularity = dlfcn.dlsym(handle, 'cuMemGetAllocationGranularity') - {{endif}} - {{if 'cuMemGetAllocationPropertiesFromHandle' in found_functions}} - global __cuMemGetAllocationPropertiesFromHandle - __cuMemGetAllocationPropertiesFromHandle = dlfcn.dlsym(handle, 'cuMemGetAllocationPropertiesFromHandle') - {{endif}} - {{if 'cuMemRetainAllocationHandle' in found_functions}} - global __cuMemRetainAllocationHandle - __cuMemRetainAllocationHandle = dlfcn.dlsym(handle, 'cuMemRetainAllocationHandle') - {{endif}} - {{if 'cuMemPoolTrimTo' in found_functions}} - global __cuMemPoolTrimTo - __cuMemPoolTrimTo = dlfcn.dlsym(handle, 'cuMemPoolTrimTo') - {{endif}} - {{if 'cuMemPoolSetAttribute' in found_functions}} - global __cuMemPoolSetAttribute - __cuMemPoolSetAttribute = dlfcn.dlsym(handle, 'cuMemPoolSetAttribute') - {{endif}} - {{if 'cuMemPoolGetAttribute' in found_functions}} - global __cuMemPoolGetAttribute - __cuMemPoolGetAttribute = dlfcn.dlsym(handle, 'cuMemPoolGetAttribute') - {{endif}} - {{if 'cuMemPoolSetAccess' in found_functions}} - global __cuMemPoolSetAccess - __cuMemPoolSetAccess = dlfcn.dlsym(handle, 'cuMemPoolSetAccess') - {{endif}} - {{if 'cuMemPoolGetAccess' in found_functions}} - global __cuMemPoolGetAccess - __cuMemPoolGetAccess = dlfcn.dlsym(handle, 'cuMemPoolGetAccess') - {{endif}} - {{if 'cuMemPoolCreate' in found_functions}} - global __cuMemPoolCreate - __cuMemPoolCreate = dlfcn.dlsym(handle, 'cuMemPoolCreate') - {{endif}} - {{if 'cuMemPoolDestroy' in found_functions}} - global __cuMemPoolDestroy - __cuMemPoolDestroy = dlfcn.dlsym(handle, 'cuMemPoolDestroy') - {{endif}} - {{if 'cuMemPoolExportToShareableHandle' in found_functions}} - global __cuMemPoolExportToShareableHandle - __cuMemPoolExportToShareableHandle = dlfcn.dlsym(handle, 'cuMemPoolExportToShareableHandle') - {{endif}} - {{if 'cuMemPoolImportFromShareableHandle' in found_functions}} - global __cuMemPoolImportFromShareableHandle - __cuMemPoolImportFromShareableHandle = dlfcn.dlsym(handle, 'cuMemPoolImportFromShareableHandle') - {{endif}} - {{if 'cuMemPoolExportPointer' in found_functions}} - global __cuMemPoolExportPointer - __cuMemPoolExportPointer = dlfcn.dlsym(handle, 'cuMemPoolExportPointer') - {{endif}} - {{if 'cuMemPoolImportPointer' in found_functions}} - global __cuMemPoolImportPointer - __cuMemPoolImportPointer = dlfcn.dlsym(handle, 'cuMemPoolImportPointer') - {{endif}} - {{if 'cuMulticastCreate' in found_functions}} - global __cuMulticastCreate - __cuMulticastCreate = dlfcn.dlsym(handle, 'cuMulticastCreate') - {{endif}} - {{if 'cuMulticastAddDevice' in found_functions}} - global __cuMulticastAddDevice - __cuMulticastAddDevice = dlfcn.dlsym(handle, 'cuMulticastAddDevice') - {{endif}} - {{if 'cuMulticastBindMem' in found_functions}} - global __cuMulticastBindMem - __cuMulticastBindMem = dlfcn.dlsym(handle, 'cuMulticastBindMem') - {{endif}} - {{if 'cuMulticastBindAddr' in found_functions}} - global __cuMulticastBindAddr - __cuMulticastBindAddr = dlfcn.dlsym(handle, 'cuMulticastBindAddr') - {{endif}} - {{if 'cuMulticastUnbind' in found_functions}} - global __cuMulticastUnbind - __cuMulticastUnbind = dlfcn.dlsym(handle, 'cuMulticastUnbind') - {{endif}} - {{if 'cuMulticastGetGranularity' in found_functions}} - global __cuMulticastGetGranularity - __cuMulticastGetGranularity = dlfcn.dlsym(handle, 'cuMulticastGetGranularity') - {{endif}} - {{if 'cuPointerGetAttribute' in found_functions}} - global __cuPointerGetAttribute - __cuPointerGetAttribute = dlfcn.dlsym(handle, 'cuPointerGetAttribute') - {{endif}} - {{if 'cuMemAdvise' in found_functions}} - global __cuMemAdvise - __cuMemAdvise = dlfcn.dlsym(handle, 'cuMemAdvise') - {{endif}} - {{if 'cuMemAdvise_v2' in found_functions}} - global __cuMemAdvise_v2 - __cuMemAdvise_v2 = dlfcn.dlsym(handle, 'cuMemAdvise_v2') - {{endif}} - {{if 'cuMemRangeGetAttribute' in found_functions}} - global __cuMemRangeGetAttribute - __cuMemRangeGetAttribute = dlfcn.dlsym(handle, 'cuMemRangeGetAttribute') - {{endif}} - {{if 'cuMemRangeGetAttributes' in found_functions}} - global __cuMemRangeGetAttributes - __cuMemRangeGetAttributes = dlfcn.dlsym(handle, 'cuMemRangeGetAttributes') - {{endif}} - {{if 'cuPointerSetAttribute' in found_functions}} - global __cuPointerSetAttribute - __cuPointerSetAttribute = dlfcn.dlsym(handle, 'cuPointerSetAttribute') - {{endif}} - {{if 'cuPointerGetAttributes' in found_functions}} - global __cuPointerGetAttributes - __cuPointerGetAttributes = dlfcn.dlsym(handle, 'cuPointerGetAttributes') - {{endif}} - {{if 'cuStreamCreate' in found_functions}} - global __cuStreamCreate - __cuStreamCreate = dlfcn.dlsym(handle, 'cuStreamCreate') - {{endif}} - {{if 'cuStreamCreateWithPriority' in found_functions}} - global __cuStreamCreateWithPriority - __cuStreamCreateWithPriority = dlfcn.dlsym(handle, 'cuStreamCreateWithPriority') - {{endif}} - {{if 'cuThreadExchangeStreamCaptureMode' in found_functions}} - global __cuThreadExchangeStreamCaptureMode - __cuThreadExchangeStreamCaptureMode = dlfcn.dlsym(handle, 'cuThreadExchangeStreamCaptureMode') - {{endif}} - {{if 'cuStreamDestroy_v2' in found_functions}} - global __cuStreamDestroy_v2 - __cuStreamDestroy_v2 = dlfcn.dlsym(handle, 'cuStreamDestroy_v2') - {{endif}} - {{if 'cuEventCreate' in found_functions}} - global __cuEventCreate - __cuEventCreate = dlfcn.dlsym(handle, 'cuEventCreate') - {{endif}} - {{if 'cuEventQuery' in found_functions}} - global __cuEventQuery - __cuEventQuery = dlfcn.dlsym(handle, 'cuEventQuery') - {{endif}} - {{if 'cuEventSynchronize' in found_functions}} - global __cuEventSynchronize - __cuEventSynchronize = dlfcn.dlsym(handle, 'cuEventSynchronize') - {{endif}} - {{if 'cuEventDestroy_v2' in found_functions}} - global __cuEventDestroy_v2 - __cuEventDestroy_v2 = dlfcn.dlsym(handle, 'cuEventDestroy_v2') - {{endif}} - {{if 'cuEventElapsedTime' in found_functions}} - global __cuEventElapsedTime - __cuEventElapsedTime = dlfcn.dlsym(handle, 'cuEventElapsedTime') - {{endif}} - {{if 'cuImportExternalMemory' in found_functions}} - global __cuImportExternalMemory - __cuImportExternalMemory = dlfcn.dlsym(handle, 'cuImportExternalMemory') - {{endif}} - {{if 'cuExternalMemoryGetMappedBuffer' in found_functions}} - global __cuExternalMemoryGetMappedBuffer - __cuExternalMemoryGetMappedBuffer = dlfcn.dlsym(handle, 'cuExternalMemoryGetMappedBuffer') - {{endif}} - {{if 'cuExternalMemoryGetMappedMipmappedArray' in found_functions}} - global __cuExternalMemoryGetMappedMipmappedArray - __cuExternalMemoryGetMappedMipmappedArray = dlfcn.dlsym(handle, 'cuExternalMemoryGetMappedMipmappedArray') - {{endif}} - {{if 'cuDestroyExternalMemory' in found_functions}} - global __cuDestroyExternalMemory - __cuDestroyExternalMemory = dlfcn.dlsym(handle, 'cuDestroyExternalMemory') - {{endif}} - {{if 'cuImportExternalSemaphore' in found_functions}} - global __cuImportExternalSemaphore - __cuImportExternalSemaphore = dlfcn.dlsym(handle, 'cuImportExternalSemaphore') - {{endif}} - {{if 'cuDestroyExternalSemaphore' in found_functions}} - global __cuDestroyExternalSemaphore - __cuDestroyExternalSemaphore = dlfcn.dlsym(handle, 'cuDestroyExternalSemaphore') - {{endif}} - {{if 'cuFuncGetAttribute' in found_functions}} - global __cuFuncGetAttribute - __cuFuncGetAttribute = dlfcn.dlsym(handle, 'cuFuncGetAttribute') - {{endif}} - {{if 'cuFuncSetAttribute' in found_functions}} - global __cuFuncSetAttribute - __cuFuncSetAttribute = dlfcn.dlsym(handle, 'cuFuncSetAttribute') - {{endif}} - {{if 'cuFuncSetCacheConfig' in found_functions}} - global __cuFuncSetCacheConfig - __cuFuncSetCacheConfig = dlfcn.dlsym(handle, 'cuFuncSetCacheConfig') - {{endif}} - {{if 'cuFuncGetModule' in found_functions}} - global __cuFuncGetModule - __cuFuncGetModule = dlfcn.dlsym(handle, 'cuFuncGetModule') - {{endif}} - {{if 'cuFuncGetName' in found_functions}} - global __cuFuncGetName - __cuFuncGetName = dlfcn.dlsym(handle, 'cuFuncGetName') - {{endif}} - {{if 'cuFuncGetParamInfo' in found_functions}} - global __cuFuncGetParamInfo - __cuFuncGetParamInfo = dlfcn.dlsym(handle, 'cuFuncGetParamInfo') - {{endif}} - {{if 'cuFuncIsLoaded' in found_functions}} - global __cuFuncIsLoaded - __cuFuncIsLoaded = dlfcn.dlsym(handle, 'cuFuncIsLoaded') - {{endif}} - {{if 'cuFuncLoad' in found_functions}} - global __cuFuncLoad - __cuFuncLoad = dlfcn.dlsym(handle, 'cuFuncLoad') - {{endif}} - {{if 'cuLaunchCooperativeKernelMultiDevice' in found_functions}} - global __cuLaunchCooperativeKernelMultiDevice - __cuLaunchCooperativeKernelMultiDevice = dlfcn.dlsym(handle, 'cuLaunchCooperativeKernelMultiDevice') - {{endif}} - {{if 'cuFuncSetBlockShape' in found_functions}} - global __cuFuncSetBlockShape - __cuFuncSetBlockShape = dlfcn.dlsym(handle, 'cuFuncSetBlockShape') - {{endif}} - {{if 'cuFuncSetSharedSize' in found_functions}} - global __cuFuncSetSharedSize - __cuFuncSetSharedSize = dlfcn.dlsym(handle, 'cuFuncSetSharedSize') - {{endif}} - {{if 'cuParamSetSize' in found_functions}} - global __cuParamSetSize - __cuParamSetSize = dlfcn.dlsym(handle, 'cuParamSetSize') - {{endif}} - {{if 'cuParamSeti' in found_functions}} - global __cuParamSeti - __cuParamSeti = dlfcn.dlsym(handle, 'cuParamSeti') - {{endif}} - {{if 'cuParamSetf' in found_functions}} - global __cuParamSetf - __cuParamSetf = dlfcn.dlsym(handle, 'cuParamSetf') - {{endif}} - {{if 'cuParamSetv' in found_functions}} - global __cuParamSetv - __cuParamSetv = dlfcn.dlsym(handle, 'cuParamSetv') - {{endif}} - {{if 'cuLaunch' in found_functions}} - global __cuLaunch - __cuLaunch = dlfcn.dlsym(handle, 'cuLaunch') - {{endif}} - {{if 'cuLaunchGrid' in found_functions}} - global __cuLaunchGrid - __cuLaunchGrid = dlfcn.dlsym(handle, 'cuLaunchGrid') - {{endif}} - {{if 'cuLaunchGridAsync' in found_functions}} - global __cuLaunchGridAsync - __cuLaunchGridAsync = dlfcn.dlsym(handle, 'cuLaunchGridAsync') - {{endif}} - {{if 'cuParamSetTexRef' in found_functions}} - global __cuParamSetTexRef - __cuParamSetTexRef = dlfcn.dlsym(handle, 'cuParamSetTexRef') - {{endif}} - {{if 'cuFuncSetSharedMemConfig' in found_functions}} - global __cuFuncSetSharedMemConfig - __cuFuncSetSharedMemConfig = dlfcn.dlsym(handle, 'cuFuncSetSharedMemConfig') - {{endif}} - {{if 'cuGraphCreate' in found_functions}} - global __cuGraphCreate - __cuGraphCreate = dlfcn.dlsym(handle, 'cuGraphCreate') - {{endif}} - {{if 'cuGraphAddKernelNode_v2' in found_functions}} - global __cuGraphAddKernelNode_v2 - __cuGraphAddKernelNode_v2 = dlfcn.dlsym(handle, 'cuGraphAddKernelNode_v2') - {{endif}} - {{if 'cuGraphKernelNodeGetParams_v2' in found_functions}} - global __cuGraphKernelNodeGetParams_v2 - __cuGraphKernelNodeGetParams_v2 = dlfcn.dlsym(handle, 'cuGraphKernelNodeGetParams_v2') - {{endif}} - {{if 'cuGraphKernelNodeSetParams_v2' in found_functions}} - global __cuGraphKernelNodeSetParams_v2 - __cuGraphKernelNodeSetParams_v2 = dlfcn.dlsym(handle, 'cuGraphKernelNodeSetParams_v2') - {{endif}} - {{if 'cuGraphAddMemcpyNode' in found_functions}} - global __cuGraphAddMemcpyNode - __cuGraphAddMemcpyNode = dlfcn.dlsym(handle, 'cuGraphAddMemcpyNode') - {{endif}} - {{if 'cuGraphMemcpyNodeGetParams' in found_functions}} - global __cuGraphMemcpyNodeGetParams - __cuGraphMemcpyNodeGetParams = dlfcn.dlsym(handle, 'cuGraphMemcpyNodeGetParams') - {{endif}} - {{if 'cuGraphMemcpyNodeSetParams' in found_functions}} - global __cuGraphMemcpyNodeSetParams - __cuGraphMemcpyNodeSetParams = dlfcn.dlsym(handle, 'cuGraphMemcpyNodeSetParams') - {{endif}} - {{if 'cuGraphAddMemsetNode' in found_functions}} - global __cuGraphAddMemsetNode - __cuGraphAddMemsetNode = dlfcn.dlsym(handle, 'cuGraphAddMemsetNode') - {{endif}} - {{if 'cuGraphMemsetNodeGetParams' in found_functions}} - global __cuGraphMemsetNodeGetParams - __cuGraphMemsetNodeGetParams = dlfcn.dlsym(handle, 'cuGraphMemsetNodeGetParams') - {{endif}} - {{if 'cuGraphMemsetNodeSetParams' in found_functions}} - global __cuGraphMemsetNodeSetParams - __cuGraphMemsetNodeSetParams = dlfcn.dlsym(handle, 'cuGraphMemsetNodeSetParams') - {{endif}} - {{if 'cuGraphAddHostNode' in found_functions}} - global __cuGraphAddHostNode - __cuGraphAddHostNode = dlfcn.dlsym(handle, 'cuGraphAddHostNode') - {{endif}} - {{if 'cuGraphHostNodeGetParams' in found_functions}} - global __cuGraphHostNodeGetParams - __cuGraphHostNodeGetParams = dlfcn.dlsym(handle, 'cuGraphHostNodeGetParams') - {{endif}} - {{if 'cuGraphHostNodeSetParams' in found_functions}} - global __cuGraphHostNodeSetParams - __cuGraphHostNodeSetParams = dlfcn.dlsym(handle, 'cuGraphHostNodeSetParams') - {{endif}} - {{if 'cuGraphAddChildGraphNode' in found_functions}} - global __cuGraphAddChildGraphNode - __cuGraphAddChildGraphNode = dlfcn.dlsym(handle, 'cuGraphAddChildGraphNode') - {{endif}} - {{if 'cuGraphChildGraphNodeGetGraph' in found_functions}} - global __cuGraphChildGraphNodeGetGraph - __cuGraphChildGraphNodeGetGraph = dlfcn.dlsym(handle, 'cuGraphChildGraphNodeGetGraph') - {{endif}} - {{if 'cuGraphAddEmptyNode' in found_functions}} - global __cuGraphAddEmptyNode - __cuGraphAddEmptyNode = dlfcn.dlsym(handle, 'cuGraphAddEmptyNode') - {{endif}} - {{if 'cuGraphAddEventRecordNode' in found_functions}} - global __cuGraphAddEventRecordNode - __cuGraphAddEventRecordNode = dlfcn.dlsym(handle, 'cuGraphAddEventRecordNode') - {{endif}} - {{if 'cuGraphEventRecordNodeGetEvent' in found_functions}} - global __cuGraphEventRecordNodeGetEvent - __cuGraphEventRecordNodeGetEvent = dlfcn.dlsym(handle, 'cuGraphEventRecordNodeGetEvent') - {{endif}} - {{if 'cuGraphEventRecordNodeSetEvent' in found_functions}} - global __cuGraphEventRecordNodeSetEvent - __cuGraphEventRecordNodeSetEvent = dlfcn.dlsym(handle, 'cuGraphEventRecordNodeSetEvent') - {{endif}} - {{if 'cuGraphAddEventWaitNode' in found_functions}} - global __cuGraphAddEventWaitNode - __cuGraphAddEventWaitNode = dlfcn.dlsym(handle, 'cuGraphAddEventWaitNode') - {{endif}} - {{if 'cuGraphEventWaitNodeGetEvent' in found_functions}} - global __cuGraphEventWaitNodeGetEvent - __cuGraphEventWaitNodeGetEvent = dlfcn.dlsym(handle, 'cuGraphEventWaitNodeGetEvent') - {{endif}} - {{if 'cuGraphEventWaitNodeSetEvent' in found_functions}} - global __cuGraphEventWaitNodeSetEvent - __cuGraphEventWaitNodeSetEvent = dlfcn.dlsym(handle, 'cuGraphEventWaitNodeSetEvent') - {{endif}} - {{if 'cuGraphAddExternalSemaphoresSignalNode' in found_functions}} - global __cuGraphAddExternalSemaphoresSignalNode - __cuGraphAddExternalSemaphoresSignalNode = dlfcn.dlsym(handle, 'cuGraphAddExternalSemaphoresSignalNode') - {{endif}} - {{if 'cuGraphExternalSemaphoresSignalNodeGetParams' in found_functions}} - global __cuGraphExternalSemaphoresSignalNodeGetParams - __cuGraphExternalSemaphoresSignalNodeGetParams = dlfcn.dlsym(handle, 'cuGraphExternalSemaphoresSignalNodeGetParams') - {{endif}} - {{if 'cuGraphExternalSemaphoresSignalNodeSetParams' in found_functions}} - global __cuGraphExternalSemaphoresSignalNodeSetParams - __cuGraphExternalSemaphoresSignalNodeSetParams = dlfcn.dlsym(handle, 'cuGraphExternalSemaphoresSignalNodeSetParams') - {{endif}} - {{if 'cuGraphAddExternalSemaphoresWaitNode' in found_functions}} - global __cuGraphAddExternalSemaphoresWaitNode - __cuGraphAddExternalSemaphoresWaitNode = dlfcn.dlsym(handle, 'cuGraphAddExternalSemaphoresWaitNode') - {{endif}} - {{if 'cuGraphExternalSemaphoresWaitNodeGetParams' in found_functions}} - global __cuGraphExternalSemaphoresWaitNodeGetParams - __cuGraphExternalSemaphoresWaitNodeGetParams = dlfcn.dlsym(handle, 'cuGraphExternalSemaphoresWaitNodeGetParams') - {{endif}} - {{if 'cuGraphExternalSemaphoresWaitNodeSetParams' in found_functions}} - global __cuGraphExternalSemaphoresWaitNodeSetParams - __cuGraphExternalSemaphoresWaitNodeSetParams = dlfcn.dlsym(handle, 'cuGraphExternalSemaphoresWaitNodeSetParams') - {{endif}} - {{if 'cuGraphAddBatchMemOpNode' in found_functions}} - global __cuGraphAddBatchMemOpNode - __cuGraphAddBatchMemOpNode = dlfcn.dlsym(handle, 'cuGraphAddBatchMemOpNode') - {{endif}} - {{if 'cuGraphBatchMemOpNodeGetParams' in found_functions}} - global __cuGraphBatchMemOpNodeGetParams - __cuGraphBatchMemOpNodeGetParams = dlfcn.dlsym(handle, 'cuGraphBatchMemOpNodeGetParams') - {{endif}} - {{if 'cuGraphBatchMemOpNodeSetParams' in found_functions}} - global __cuGraphBatchMemOpNodeSetParams - __cuGraphBatchMemOpNodeSetParams = dlfcn.dlsym(handle, 'cuGraphBatchMemOpNodeSetParams') - {{endif}} - {{if 'cuGraphExecBatchMemOpNodeSetParams' in found_functions}} - global __cuGraphExecBatchMemOpNodeSetParams - __cuGraphExecBatchMemOpNodeSetParams = dlfcn.dlsym(handle, 'cuGraphExecBatchMemOpNodeSetParams') - {{endif}} - {{if 'cuGraphAddMemAllocNode' in found_functions}} - global __cuGraphAddMemAllocNode - __cuGraphAddMemAllocNode = dlfcn.dlsym(handle, 'cuGraphAddMemAllocNode') - {{endif}} - {{if 'cuGraphMemAllocNodeGetParams' in found_functions}} - global __cuGraphMemAllocNodeGetParams - __cuGraphMemAllocNodeGetParams = dlfcn.dlsym(handle, 'cuGraphMemAllocNodeGetParams') - {{endif}} - {{if 'cuGraphAddMemFreeNode' in found_functions}} - global __cuGraphAddMemFreeNode - __cuGraphAddMemFreeNode = dlfcn.dlsym(handle, 'cuGraphAddMemFreeNode') - {{endif}} - {{if 'cuGraphMemFreeNodeGetParams' in found_functions}} - global __cuGraphMemFreeNodeGetParams - __cuGraphMemFreeNodeGetParams = dlfcn.dlsym(handle, 'cuGraphMemFreeNodeGetParams') - {{endif}} - {{if 'cuDeviceGraphMemTrim' in found_functions}} - global __cuDeviceGraphMemTrim - __cuDeviceGraphMemTrim = dlfcn.dlsym(handle, 'cuDeviceGraphMemTrim') - {{endif}} - {{if 'cuDeviceGetGraphMemAttribute' in found_functions}} - global __cuDeviceGetGraphMemAttribute - __cuDeviceGetGraphMemAttribute = dlfcn.dlsym(handle, 'cuDeviceGetGraphMemAttribute') - {{endif}} - {{if 'cuDeviceSetGraphMemAttribute' in found_functions}} - global __cuDeviceSetGraphMemAttribute - __cuDeviceSetGraphMemAttribute = dlfcn.dlsym(handle, 'cuDeviceSetGraphMemAttribute') - {{endif}} - {{if 'cuGraphClone' in found_functions}} - global __cuGraphClone - __cuGraphClone = dlfcn.dlsym(handle, 'cuGraphClone') - {{endif}} - {{if 'cuGraphNodeFindInClone' in found_functions}} - global __cuGraphNodeFindInClone - __cuGraphNodeFindInClone = dlfcn.dlsym(handle, 'cuGraphNodeFindInClone') - {{endif}} - {{if 'cuGraphNodeGetType' in found_functions}} - global __cuGraphNodeGetType - __cuGraphNodeGetType = dlfcn.dlsym(handle, 'cuGraphNodeGetType') - {{endif}} - {{if 'cuGraphGetNodes' in found_functions}} - global __cuGraphGetNodes - __cuGraphGetNodes = dlfcn.dlsym(handle, 'cuGraphGetNodes') - {{endif}} - {{if 'cuGraphGetRootNodes' in found_functions}} - global __cuGraphGetRootNodes - __cuGraphGetRootNodes = dlfcn.dlsym(handle, 'cuGraphGetRootNodes') - {{endif}} - {{if 'cuGraphGetEdges' in found_functions}} - global __cuGraphGetEdges - __cuGraphGetEdges = dlfcn.dlsym(handle, 'cuGraphGetEdges') - {{endif}} - {{if 'cuGraphGetEdges_v2' in found_functions}} - global __cuGraphGetEdges_v2 - __cuGraphGetEdges_v2 = dlfcn.dlsym(handle, 'cuGraphGetEdges_v2') - {{endif}} - {{if 'cuGraphNodeGetDependencies' in found_functions}} - global __cuGraphNodeGetDependencies - __cuGraphNodeGetDependencies = dlfcn.dlsym(handle, 'cuGraphNodeGetDependencies') - {{endif}} - {{if 'cuGraphNodeGetDependencies_v2' in found_functions}} - global __cuGraphNodeGetDependencies_v2 - __cuGraphNodeGetDependencies_v2 = dlfcn.dlsym(handle, 'cuGraphNodeGetDependencies_v2') - {{endif}} - {{if 'cuGraphNodeGetDependentNodes' in found_functions}} - global __cuGraphNodeGetDependentNodes - __cuGraphNodeGetDependentNodes = dlfcn.dlsym(handle, 'cuGraphNodeGetDependentNodes') - {{endif}} - {{if 'cuGraphNodeGetDependentNodes_v2' in found_functions}} - global __cuGraphNodeGetDependentNodes_v2 - __cuGraphNodeGetDependentNodes_v2 = dlfcn.dlsym(handle, 'cuGraphNodeGetDependentNodes_v2') - {{endif}} - {{if 'cuGraphAddDependencies' in found_functions}} - global __cuGraphAddDependencies - __cuGraphAddDependencies = dlfcn.dlsym(handle, 'cuGraphAddDependencies') - {{endif}} - {{if 'cuGraphAddDependencies_v2' in found_functions}} - global __cuGraphAddDependencies_v2 - __cuGraphAddDependencies_v2 = dlfcn.dlsym(handle, 'cuGraphAddDependencies_v2') - {{endif}} - {{if 'cuGraphRemoveDependencies' in found_functions}} - global __cuGraphRemoveDependencies - __cuGraphRemoveDependencies = dlfcn.dlsym(handle, 'cuGraphRemoveDependencies') - {{endif}} - {{if 'cuGraphRemoveDependencies_v2' in found_functions}} - global __cuGraphRemoveDependencies_v2 - __cuGraphRemoveDependencies_v2 = dlfcn.dlsym(handle, 'cuGraphRemoveDependencies_v2') - {{endif}} - {{if 'cuGraphDestroyNode' in found_functions}} - global __cuGraphDestroyNode - __cuGraphDestroyNode = dlfcn.dlsym(handle, 'cuGraphDestroyNode') - {{endif}} - {{if 'cuGraphInstantiateWithFlags' in found_functions}} - global __cuGraphInstantiateWithFlags - __cuGraphInstantiateWithFlags = dlfcn.dlsym(handle, 'cuGraphInstantiateWithFlags') - {{endif}} - {{if 'cuGraphExecGetFlags' in found_functions}} - global __cuGraphExecGetFlags - __cuGraphExecGetFlags = dlfcn.dlsym(handle, 'cuGraphExecGetFlags') - {{endif}} - {{if 'cuGraphExecKernelNodeSetParams_v2' in found_functions}} - global __cuGraphExecKernelNodeSetParams_v2 - __cuGraphExecKernelNodeSetParams_v2 = dlfcn.dlsym(handle, 'cuGraphExecKernelNodeSetParams_v2') - {{endif}} - {{if 'cuGraphExecMemcpyNodeSetParams' in found_functions}} - global __cuGraphExecMemcpyNodeSetParams - __cuGraphExecMemcpyNodeSetParams = dlfcn.dlsym(handle, 'cuGraphExecMemcpyNodeSetParams') - {{endif}} - {{if 'cuGraphExecMemsetNodeSetParams' in found_functions}} - global __cuGraphExecMemsetNodeSetParams - __cuGraphExecMemsetNodeSetParams = dlfcn.dlsym(handle, 'cuGraphExecMemsetNodeSetParams') - {{endif}} - {{if 'cuGraphExecHostNodeSetParams' in found_functions}} - global __cuGraphExecHostNodeSetParams - __cuGraphExecHostNodeSetParams = dlfcn.dlsym(handle, 'cuGraphExecHostNodeSetParams') - {{endif}} - {{if 'cuGraphExecChildGraphNodeSetParams' in found_functions}} - global __cuGraphExecChildGraphNodeSetParams - __cuGraphExecChildGraphNodeSetParams = dlfcn.dlsym(handle, 'cuGraphExecChildGraphNodeSetParams') - {{endif}} - {{if 'cuGraphExecEventRecordNodeSetEvent' in found_functions}} - global __cuGraphExecEventRecordNodeSetEvent - __cuGraphExecEventRecordNodeSetEvent = dlfcn.dlsym(handle, 'cuGraphExecEventRecordNodeSetEvent') - {{endif}} - {{if 'cuGraphExecEventWaitNodeSetEvent' in found_functions}} - global __cuGraphExecEventWaitNodeSetEvent - __cuGraphExecEventWaitNodeSetEvent = dlfcn.dlsym(handle, 'cuGraphExecEventWaitNodeSetEvent') - {{endif}} - {{if 'cuGraphExecExternalSemaphoresSignalNodeSetParams' in found_functions}} - global __cuGraphExecExternalSemaphoresSignalNodeSetParams - __cuGraphExecExternalSemaphoresSignalNodeSetParams = dlfcn.dlsym(handle, 'cuGraphExecExternalSemaphoresSignalNodeSetParams') - {{endif}} - {{if 'cuGraphExecExternalSemaphoresWaitNodeSetParams' in found_functions}} - global __cuGraphExecExternalSemaphoresWaitNodeSetParams - __cuGraphExecExternalSemaphoresWaitNodeSetParams = dlfcn.dlsym(handle, 'cuGraphExecExternalSemaphoresWaitNodeSetParams') - {{endif}} - {{if 'cuGraphNodeSetEnabled' in found_functions}} - global __cuGraphNodeSetEnabled - __cuGraphNodeSetEnabled = dlfcn.dlsym(handle, 'cuGraphNodeSetEnabled') - {{endif}} - {{if 'cuGraphNodeGetEnabled' in found_functions}} - global __cuGraphNodeGetEnabled - __cuGraphNodeGetEnabled = dlfcn.dlsym(handle, 'cuGraphNodeGetEnabled') - {{endif}} - {{if 'cuGraphExecDestroy' in found_functions}} - global __cuGraphExecDestroy - __cuGraphExecDestroy = dlfcn.dlsym(handle, 'cuGraphExecDestroy') - {{endif}} - {{if 'cuGraphDestroy' in found_functions}} - global __cuGraphDestroy - __cuGraphDestroy = dlfcn.dlsym(handle, 'cuGraphDestroy') - {{endif}} - {{if 'cuGraphExecUpdate_v2' in found_functions}} - global __cuGraphExecUpdate_v2 - __cuGraphExecUpdate_v2 = dlfcn.dlsym(handle, 'cuGraphExecUpdate_v2') - {{endif}} - {{if 'cuGraphKernelNodeCopyAttributes' in found_functions}} - global __cuGraphKernelNodeCopyAttributes - __cuGraphKernelNodeCopyAttributes = dlfcn.dlsym(handle, 'cuGraphKernelNodeCopyAttributes') - {{endif}} - {{if 'cuGraphKernelNodeGetAttribute' in found_functions}} - global __cuGraphKernelNodeGetAttribute - __cuGraphKernelNodeGetAttribute = dlfcn.dlsym(handle, 'cuGraphKernelNodeGetAttribute') - {{endif}} - {{if 'cuGraphKernelNodeSetAttribute' in found_functions}} - global __cuGraphKernelNodeSetAttribute - __cuGraphKernelNodeSetAttribute = dlfcn.dlsym(handle, 'cuGraphKernelNodeSetAttribute') - {{endif}} - {{if 'cuGraphDebugDotPrint' in found_functions}} - global __cuGraphDebugDotPrint - __cuGraphDebugDotPrint = dlfcn.dlsym(handle, 'cuGraphDebugDotPrint') - {{endif}} - {{if 'cuUserObjectCreate' in found_functions}} - global __cuUserObjectCreate - __cuUserObjectCreate = dlfcn.dlsym(handle, 'cuUserObjectCreate') - {{endif}} - {{if 'cuUserObjectRetain' in found_functions}} - global __cuUserObjectRetain - __cuUserObjectRetain = dlfcn.dlsym(handle, 'cuUserObjectRetain') - {{endif}} - {{if 'cuUserObjectRelease' in found_functions}} - global __cuUserObjectRelease - __cuUserObjectRelease = dlfcn.dlsym(handle, 'cuUserObjectRelease') - {{endif}} - {{if 'cuGraphRetainUserObject' in found_functions}} - global __cuGraphRetainUserObject - __cuGraphRetainUserObject = dlfcn.dlsym(handle, 'cuGraphRetainUserObject') - {{endif}} - {{if 'cuGraphReleaseUserObject' in found_functions}} - global __cuGraphReleaseUserObject - __cuGraphReleaseUserObject = dlfcn.dlsym(handle, 'cuGraphReleaseUserObject') - {{endif}} - {{if 'cuGraphAddNode' in found_functions}} - global __cuGraphAddNode - __cuGraphAddNode = dlfcn.dlsym(handle, 'cuGraphAddNode') - {{endif}} - {{if 'cuGraphAddNode_v2' in found_functions}} - global __cuGraphAddNode_v2 - __cuGraphAddNode_v2 = dlfcn.dlsym(handle, 'cuGraphAddNode_v2') - {{endif}} - {{if 'cuGraphNodeSetParams' in found_functions}} - global __cuGraphNodeSetParams - __cuGraphNodeSetParams = dlfcn.dlsym(handle, 'cuGraphNodeSetParams') - {{endif}} - {{if 'cuGraphExecNodeSetParams' in found_functions}} - global __cuGraphExecNodeSetParams - __cuGraphExecNodeSetParams = dlfcn.dlsym(handle, 'cuGraphExecNodeSetParams') - {{endif}} - {{if 'cuGraphConditionalHandleCreate' in found_functions}} - global __cuGraphConditionalHandleCreate - __cuGraphConditionalHandleCreate = dlfcn.dlsym(handle, 'cuGraphConditionalHandleCreate') - {{endif}} - {{if 'cuOccupancyMaxActiveBlocksPerMultiprocessor' in found_functions}} - global __cuOccupancyMaxActiveBlocksPerMultiprocessor - __cuOccupancyMaxActiveBlocksPerMultiprocessor = dlfcn.dlsym(handle, 'cuOccupancyMaxActiveBlocksPerMultiprocessor') - {{endif}} - {{if 'cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags' in found_functions}} - global __cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags - __cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags = dlfcn.dlsym(handle, 'cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags') - {{endif}} - {{if 'cuOccupancyMaxPotentialBlockSize' in found_functions}} - global __cuOccupancyMaxPotentialBlockSize - __cuOccupancyMaxPotentialBlockSize = dlfcn.dlsym(handle, 'cuOccupancyMaxPotentialBlockSize') - {{endif}} - {{if 'cuOccupancyMaxPotentialBlockSizeWithFlags' in found_functions}} - global __cuOccupancyMaxPotentialBlockSizeWithFlags - __cuOccupancyMaxPotentialBlockSizeWithFlags = dlfcn.dlsym(handle, 'cuOccupancyMaxPotentialBlockSizeWithFlags') - {{endif}} - {{if 'cuOccupancyAvailableDynamicSMemPerBlock' in found_functions}} - global __cuOccupancyAvailableDynamicSMemPerBlock - __cuOccupancyAvailableDynamicSMemPerBlock = dlfcn.dlsym(handle, 'cuOccupancyAvailableDynamicSMemPerBlock') - {{endif}} - {{if 'cuOccupancyMaxPotentialClusterSize' in found_functions}} - global __cuOccupancyMaxPotentialClusterSize - __cuOccupancyMaxPotentialClusterSize = dlfcn.dlsym(handle, 'cuOccupancyMaxPotentialClusterSize') - {{endif}} - {{if 'cuOccupancyMaxActiveClusters' in found_functions}} - global __cuOccupancyMaxActiveClusters - __cuOccupancyMaxActiveClusters = dlfcn.dlsym(handle, 'cuOccupancyMaxActiveClusters') - {{endif}} - {{if 'cuTexRefSetArray' in found_functions}} - global __cuTexRefSetArray - __cuTexRefSetArray = dlfcn.dlsym(handle, 'cuTexRefSetArray') - {{endif}} - {{if 'cuTexRefSetMipmappedArray' in found_functions}} - global __cuTexRefSetMipmappedArray - __cuTexRefSetMipmappedArray = dlfcn.dlsym(handle, 'cuTexRefSetMipmappedArray') - {{endif}} - {{if 'cuTexRefSetAddress_v2' in found_functions}} - global __cuTexRefSetAddress_v2 - __cuTexRefSetAddress_v2 = dlfcn.dlsym(handle, 'cuTexRefSetAddress_v2') - {{endif}} - {{if 'cuTexRefSetAddress2D_v3' in found_functions}} - global __cuTexRefSetAddress2D_v3 - __cuTexRefSetAddress2D_v3 = dlfcn.dlsym(handle, 'cuTexRefSetAddress2D_v3') - {{endif}} - {{if 'cuTexRefSetFormat' in found_functions}} - global __cuTexRefSetFormat - __cuTexRefSetFormat = dlfcn.dlsym(handle, 'cuTexRefSetFormat') - {{endif}} - {{if 'cuTexRefSetAddressMode' in found_functions}} - global __cuTexRefSetAddressMode - __cuTexRefSetAddressMode = dlfcn.dlsym(handle, 'cuTexRefSetAddressMode') - {{endif}} - {{if 'cuTexRefSetFilterMode' in found_functions}} - global __cuTexRefSetFilterMode - __cuTexRefSetFilterMode = dlfcn.dlsym(handle, 'cuTexRefSetFilterMode') - {{endif}} - {{if 'cuTexRefSetMipmapFilterMode' in found_functions}} - global __cuTexRefSetMipmapFilterMode - __cuTexRefSetMipmapFilterMode = dlfcn.dlsym(handle, 'cuTexRefSetMipmapFilterMode') - {{endif}} - {{if 'cuTexRefSetMipmapLevelBias' in found_functions}} - global __cuTexRefSetMipmapLevelBias - __cuTexRefSetMipmapLevelBias = dlfcn.dlsym(handle, 'cuTexRefSetMipmapLevelBias') - {{endif}} - {{if 'cuTexRefSetMipmapLevelClamp' in found_functions}} - global __cuTexRefSetMipmapLevelClamp - __cuTexRefSetMipmapLevelClamp = dlfcn.dlsym(handle, 'cuTexRefSetMipmapLevelClamp') - {{endif}} - {{if 'cuTexRefSetMaxAnisotropy' in found_functions}} - global __cuTexRefSetMaxAnisotropy - __cuTexRefSetMaxAnisotropy = dlfcn.dlsym(handle, 'cuTexRefSetMaxAnisotropy') - {{endif}} - {{if 'cuTexRefSetBorderColor' in found_functions}} - global __cuTexRefSetBorderColor - __cuTexRefSetBorderColor = dlfcn.dlsym(handle, 'cuTexRefSetBorderColor') - {{endif}} - {{if 'cuTexRefSetFlags' in found_functions}} - global __cuTexRefSetFlags - __cuTexRefSetFlags = dlfcn.dlsym(handle, 'cuTexRefSetFlags') - {{endif}} - {{if 'cuTexRefGetAddress_v2' in found_functions}} - global __cuTexRefGetAddress_v2 - __cuTexRefGetAddress_v2 = dlfcn.dlsym(handle, 'cuTexRefGetAddress_v2') - {{endif}} - {{if 'cuTexRefGetArray' in found_functions}} - global __cuTexRefGetArray - __cuTexRefGetArray = dlfcn.dlsym(handle, 'cuTexRefGetArray') - {{endif}} - {{if 'cuTexRefGetMipmappedArray' in found_functions}} - global __cuTexRefGetMipmappedArray - __cuTexRefGetMipmappedArray = dlfcn.dlsym(handle, 'cuTexRefGetMipmappedArray') - {{endif}} - {{if 'cuTexRefGetAddressMode' in found_functions}} - global __cuTexRefGetAddressMode - __cuTexRefGetAddressMode = dlfcn.dlsym(handle, 'cuTexRefGetAddressMode') - {{endif}} - {{if 'cuTexRefGetFilterMode' in found_functions}} - global __cuTexRefGetFilterMode - __cuTexRefGetFilterMode = dlfcn.dlsym(handle, 'cuTexRefGetFilterMode') - {{endif}} - {{if 'cuTexRefGetFormat' in found_functions}} - global __cuTexRefGetFormat - __cuTexRefGetFormat = dlfcn.dlsym(handle, 'cuTexRefGetFormat') - {{endif}} - {{if 'cuTexRefGetMipmapFilterMode' in found_functions}} - global __cuTexRefGetMipmapFilterMode - __cuTexRefGetMipmapFilterMode = dlfcn.dlsym(handle, 'cuTexRefGetMipmapFilterMode') - {{endif}} - {{if 'cuTexRefGetMipmapLevelBias' in found_functions}} - global __cuTexRefGetMipmapLevelBias - __cuTexRefGetMipmapLevelBias = dlfcn.dlsym(handle, 'cuTexRefGetMipmapLevelBias') - {{endif}} - {{if 'cuTexRefGetMipmapLevelClamp' in found_functions}} - global __cuTexRefGetMipmapLevelClamp - __cuTexRefGetMipmapLevelClamp = dlfcn.dlsym(handle, 'cuTexRefGetMipmapLevelClamp') - {{endif}} - {{if 'cuTexRefGetMaxAnisotropy' in found_functions}} - global __cuTexRefGetMaxAnisotropy - __cuTexRefGetMaxAnisotropy = dlfcn.dlsym(handle, 'cuTexRefGetMaxAnisotropy') - {{endif}} - {{if 'cuTexRefGetBorderColor' in found_functions}} - global __cuTexRefGetBorderColor - __cuTexRefGetBorderColor = dlfcn.dlsym(handle, 'cuTexRefGetBorderColor') - {{endif}} - {{if 'cuTexRefGetFlags' in found_functions}} - global __cuTexRefGetFlags - __cuTexRefGetFlags = dlfcn.dlsym(handle, 'cuTexRefGetFlags') - {{endif}} - {{if 'cuTexRefCreate' in found_functions}} - global __cuTexRefCreate - __cuTexRefCreate = dlfcn.dlsym(handle, 'cuTexRefCreate') - {{endif}} - {{if 'cuTexRefDestroy' in found_functions}} - global __cuTexRefDestroy - __cuTexRefDestroy = dlfcn.dlsym(handle, 'cuTexRefDestroy') - {{endif}} - {{if 'cuSurfRefSetArray' in found_functions}} - global __cuSurfRefSetArray - __cuSurfRefSetArray = dlfcn.dlsym(handle, 'cuSurfRefSetArray') - {{endif}} - {{if 'cuSurfRefGetArray' in found_functions}} - global __cuSurfRefGetArray - __cuSurfRefGetArray = dlfcn.dlsym(handle, 'cuSurfRefGetArray') - {{endif}} - {{if 'cuTexObjectCreate' in found_functions}} - global __cuTexObjectCreate - __cuTexObjectCreate = dlfcn.dlsym(handle, 'cuTexObjectCreate') - {{endif}} - {{if 'cuTexObjectDestroy' in found_functions}} - global __cuTexObjectDestroy - __cuTexObjectDestroy = dlfcn.dlsym(handle, 'cuTexObjectDestroy') - {{endif}} - {{if 'cuTexObjectGetResourceDesc' in found_functions}} - global __cuTexObjectGetResourceDesc - __cuTexObjectGetResourceDesc = dlfcn.dlsym(handle, 'cuTexObjectGetResourceDesc') - {{endif}} - {{if 'cuTexObjectGetTextureDesc' in found_functions}} - global __cuTexObjectGetTextureDesc - __cuTexObjectGetTextureDesc = dlfcn.dlsym(handle, 'cuTexObjectGetTextureDesc') - {{endif}} - {{if 'cuTexObjectGetResourceViewDesc' in found_functions}} - global __cuTexObjectGetResourceViewDesc - __cuTexObjectGetResourceViewDesc = dlfcn.dlsym(handle, 'cuTexObjectGetResourceViewDesc') - {{endif}} - {{if 'cuSurfObjectCreate' in found_functions}} - global __cuSurfObjectCreate - __cuSurfObjectCreate = dlfcn.dlsym(handle, 'cuSurfObjectCreate') - {{endif}} - {{if 'cuSurfObjectDestroy' in found_functions}} - global __cuSurfObjectDestroy - __cuSurfObjectDestroy = dlfcn.dlsym(handle, 'cuSurfObjectDestroy') - {{endif}} - {{if 'cuSurfObjectGetResourceDesc' in found_functions}} - global __cuSurfObjectGetResourceDesc - __cuSurfObjectGetResourceDesc = dlfcn.dlsym(handle, 'cuSurfObjectGetResourceDesc') - {{endif}} - {{if 'cuTensorMapEncodeTiled' in found_functions}} - global __cuTensorMapEncodeTiled - __cuTensorMapEncodeTiled = dlfcn.dlsym(handle, 'cuTensorMapEncodeTiled') - {{endif}} - {{if 'cuTensorMapEncodeIm2col' in found_functions}} - global __cuTensorMapEncodeIm2col - __cuTensorMapEncodeIm2col = dlfcn.dlsym(handle, 'cuTensorMapEncodeIm2col') - {{endif}} - {{if 'cuTensorMapReplaceAddress' in found_functions}} - global __cuTensorMapReplaceAddress - __cuTensorMapReplaceAddress = dlfcn.dlsym(handle, 'cuTensorMapReplaceAddress') - {{endif}} - {{if 'cuDeviceCanAccessPeer' in found_functions}} - global __cuDeviceCanAccessPeer - __cuDeviceCanAccessPeer = dlfcn.dlsym(handle, 'cuDeviceCanAccessPeer') - {{endif}} - {{if 'cuCtxEnablePeerAccess' in found_functions}} - global __cuCtxEnablePeerAccess - __cuCtxEnablePeerAccess = dlfcn.dlsym(handle, 'cuCtxEnablePeerAccess') - {{endif}} - {{if 'cuCtxDisablePeerAccess' in found_functions}} - global __cuCtxDisablePeerAccess - __cuCtxDisablePeerAccess = dlfcn.dlsym(handle, 'cuCtxDisablePeerAccess') - {{endif}} - {{if 'cuDeviceGetP2PAttribute' in found_functions}} - global __cuDeviceGetP2PAttribute - __cuDeviceGetP2PAttribute = dlfcn.dlsym(handle, 'cuDeviceGetP2PAttribute') - {{endif}} - {{if 'cuGraphicsUnregisterResource' in found_functions}} - global __cuGraphicsUnregisterResource - __cuGraphicsUnregisterResource = dlfcn.dlsym(handle, 'cuGraphicsUnregisterResource') - {{endif}} - {{if 'cuGraphicsSubResourceGetMappedArray' in found_functions}} - global __cuGraphicsSubResourceGetMappedArray - __cuGraphicsSubResourceGetMappedArray = dlfcn.dlsym(handle, 'cuGraphicsSubResourceGetMappedArray') - {{endif}} - {{if 'cuGraphicsResourceGetMappedMipmappedArray' in found_functions}} - global __cuGraphicsResourceGetMappedMipmappedArray - __cuGraphicsResourceGetMappedMipmappedArray = dlfcn.dlsym(handle, 'cuGraphicsResourceGetMappedMipmappedArray') - {{endif}} - {{if 'cuGraphicsResourceGetMappedPointer_v2' in found_functions}} - global __cuGraphicsResourceGetMappedPointer_v2 - __cuGraphicsResourceGetMappedPointer_v2 = dlfcn.dlsym(handle, 'cuGraphicsResourceGetMappedPointer_v2') - {{endif}} - {{if 'cuGraphicsResourceSetMapFlags_v2' in found_functions}} - global __cuGraphicsResourceSetMapFlags_v2 - __cuGraphicsResourceSetMapFlags_v2 = dlfcn.dlsym(handle, 'cuGraphicsResourceSetMapFlags_v2') - {{endif}} - {{if 'cuGetProcAddress_v2' in found_functions}} - global __cuGetProcAddress_v2 - __cuGetProcAddress_v2 = dlfcn.dlsym(handle, 'cuGetProcAddress_v2') - {{endif}} - {{if 'cuCoredumpGetAttribute' in found_functions}} - global __cuCoredumpGetAttribute - __cuCoredumpGetAttribute = dlfcn.dlsym(handle, 'cuCoredumpGetAttribute') - {{endif}} - {{if 'cuCoredumpGetAttributeGlobal' in found_functions}} - global __cuCoredumpGetAttributeGlobal - __cuCoredumpGetAttributeGlobal = dlfcn.dlsym(handle, 'cuCoredumpGetAttributeGlobal') - {{endif}} - {{if 'cuCoredumpSetAttribute' in found_functions}} - global __cuCoredumpSetAttribute - __cuCoredumpSetAttribute = dlfcn.dlsym(handle, 'cuCoredumpSetAttribute') - {{endif}} - {{if 'cuCoredumpSetAttributeGlobal' in found_functions}} - global __cuCoredumpSetAttributeGlobal - __cuCoredumpSetAttributeGlobal = dlfcn.dlsym(handle, 'cuCoredumpSetAttributeGlobal') - {{endif}} - {{if 'cuGetExportTable' in found_functions}} - global __cuGetExportTable - __cuGetExportTable = dlfcn.dlsym(handle, 'cuGetExportTable') - {{endif}} - {{if 'cuGreenCtxCreate' in found_functions}} - global __cuGreenCtxCreate - __cuGreenCtxCreate = dlfcn.dlsym(handle, 'cuGreenCtxCreate') - {{endif}} - {{if 'cuGreenCtxDestroy' in found_functions}} - global __cuGreenCtxDestroy - __cuGreenCtxDestroy = dlfcn.dlsym(handle, 'cuGreenCtxDestroy') - {{endif}} - {{if 'cuCtxFromGreenCtx' in found_functions}} - global __cuCtxFromGreenCtx - __cuCtxFromGreenCtx = dlfcn.dlsym(handle, 'cuCtxFromGreenCtx') - {{endif}} - {{if 'cuDeviceGetDevResource' in found_functions}} - global __cuDeviceGetDevResource - __cuDeviceGetDevResource = dlfcn.dlsym(handle, 'cuDeviceGetDevResource') - {{endif}} - {{if 'cuCtxGetDevResource' in found_functions}} - global __cuCtxGetDevResource - __cuCtxGetDevResource = dlfcn.dlsym(handle, 'cuCtxGetDevResource') - {{endif}} - {{if 'cuGreenCtxGetDevResource' in found_functions}} - global __cuGreenCtxGetDevResource - __cuGreenCtxGetDevResource = dlfcn.dlsym(handle, 'cuGreenCtxGetDevResource') - {{endif}} - {{if 'cuDevSmResourceSplitByCount' in found_functions}} - global __cuDevSmResourceSplitByCount - __cuDevSmResourceSplitByCount = dlfcn.dlsym(handle, 'cuDevSmResourceSplitByCount') - {{endif}} - {{if 'cuDevResourceGenerateDesc' in found_functions}} - global __cuDevResourceGenerateDesc - __cuDevResourceGenerateDesc = dlfcn.dlsym(handle, 'cuDevResourceGenerateDesc') - {{endif}} - {{if 'cuGreenCtxRecordEvent' in found_functions}} - global __cuGreenCtxRecordEvent - __cuGreenCtxRecordEvent = dlfcn.dlsym(handle, 'cuGreenCtxRecordEvent') - {{endif}} - {{if 'cuGreenCtxWaitEvent' in found_functions}} - global __cuGreenCtxWaitEvent - __cuGreenCtxWaitEvent = dlfcn.dlsym(handle, 'cuGreenCtxWaitEvent') - {{endif}} - {{if 'cuStreamGetGreenCtx' in found_functions}} - global __cuStreamGetGreenCtx - __cuStreamGetGreenCtx = dlfcn.dlsym(handle, 'cuStreamGetGreenCtx') - {{endif}} - {{if 'cuGreenCtxStreamCreate' in found_functions}} - global __cuGreenCtxStreamCreate - __cuGreenCtxStreamCreate = dlfcn.dlsym(handle, 'cuGreenCtxStreamCreate') - {{endif}} - {{if 'cuProfilerStart' in found_functions}} - global __cuProfilerStart - __cuProfilerStart = dlfcn.dlsym(handle, 'cuProfilerStart') - {{endif}} - {{if 'cuProfilerStop' in found_functions}} - global __cuProfilerStop - __cuProfilerStop = dlfcn.dlsym(handle, 'cuProfilerStop') - {{endif}} - {{if True}} - global __cuGraphicsEGLRegisterImage - __cuGraphicsEGLRegisterImage = dlfcn.dlsym(handle, 'cuGraphicsEGLRegisterImage') - {{endif}} - {{if True}} - global __cuEGLStreamConsumerConnect - __cuEGLStreamConsumerConnect = dlfcn.dlsym(handle, 'cuEGLStreamConsumerConnect') - {{endif}} - {{if True}} - global __cuEGLStreamConsumerConnectWithFlags - __cuEGLStreamConsumerConnectWithFlags = dlfcn.dlsym(handle, 'cuEGLStreamConsumerConnectWithFlags') - {{endif}} - {{if True}} - global __cuEGLStreamConsumerDisconnect - __cuEGLStreamConsumerDisconnect = dlfcn.dlsym(handle, 'cuEGLStreamConsumerDisconnect') - {{endif}} - {{if True}} - global __cuEGLStreamConsumerAcquireFrame - __cuEGLStreamConsumerAcquireFrame = dlfcn.dlsym(handle, 'cuEGLStreamConsumerAcquireFrame') - {{endif}} - {{if True}} - global __cuEGLStreamConsumerReleaseFrame - __cuEGLStreamConsumerReleaseFrame = dlfcn.dlsym(handle, 'cuEGLStreamConsumerReleaseFrame') - {{endif}} - {{if True}} - global __cuEGLStreamProducerConnect - __cuEGLStreamProducerConnect = dlfcn.dlsym(handle, 'cuEGLStreamProducerConnect') - {{endif}} - {{if True}} - global __cuEGLStreamProducerDisconnect - __cuEGLStreamProducerDisconnect = dlfcn.dlsym(handle, 'cuEGLStreamProducerDisconnect') - {{endif}} - {{if True}} - global __cuEGLStreamProducerPresentFrame - __cuEGLStreamProducerPresentFrame = dlfcn.dlsym(handle, 'cuEGLStreamProducerPresentFrame') - {{endif}} - {{if True}} - global __cuEGLStreamProducerReturnFrame - __cuEGLStreamProducerReturnFrame = dlfcn.dlsym(handle, 'cuEGLStreamProducerReturnFrame') - {{endif}} - {{if True}} - global __cuGraphicsResourceGetMappedEglFrame - __cuGraphicsResourceGetMappedEglFrame = dlfcn.dlsym(handle, 'cuGraphicsResourceGetMappedEglFrame') - {{endif}} - {{if True}} - global __cuEventCreateFromEGLSync - __cuEventCreateFromEGLSync = dlfcn.dlsym(handle, 'cuEventCreateFromEGLSync') - {{endif}} - {{if True}} - global __cuGraphicsGLRegisterBuffer - __cuGraphicsGLRegisterBuffer = dlfcn.dlsym(handle, 'cuGraphicsGLRegisterBuffer') - {{endif}} - {{if True}} - global __cuGraphicsGLRegisterImage - __cuGraphicsGLRegisterImage = dlfcn.dlsym(handle, 'cuGraphicsGLRegisterImage') - {{endif}} - {{if True}} - global __cuGLGetDevices_v2 - __cuGLGetDevices_v2 = dlfcn.dlsym(handle, 'cuGLGetDevices_v2') - {{endif}} - {{if True}} - global __cuVDPAUGetDevice - __cuVDPAUGetDevice = dlfcn.dlsym(handle, 'cuVDPAUGetDevice') - {{endif}} - {{if True}} - global __cuVDPAUCtxCreate_v2 - __cuVDPAUCtxCreate_v2 = dlfcn.dlsym(handle, 'cuVDPAUCtxCreate_v2') - {{endif}} - {{if True}} - global __cuGraphicsVDPAURegisterVideoSurface - __cuGraphicsVDPAURegisterVideoSurface = dlfcn.dlsym(handle, 'cuGraphicsVDPAURegisterVideoSurface') - {{endif}} - {{if True}} - global __cuGraphicsVDPAURegisterOutputSurface - __cuGraphicsVDPAURegisterOutputSurface = dlfcn.dlsym(handle, 'cuGraphicsVDPAURegisterOutputSurface') - {{endif}} - {{endif}} - -{{if 'cuGetErrorString' in found_functions}} - -cdef CUresult _cuGetErrorString(CUresult error, const char** pStr) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGetErrorString - cuPythonInit() - if __cuGetErrorString == NULL: - with gil: - raise RuntimeError('Function "cuGetErrorString" not found') - err = ( __cuGetErrorString)(error, pStr) - return err -{{endif}} - -{{if 'cuGetErrorName' in found_functions}} - -cdef CUresult _cuGetErrorName(CUresult error, const char** pStr) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGetErrorName - cuPythonInit() - if __cuGetErrorName == NULL: - with gil: - raise RuntimeError('Function "cuGetErrorName" not found') - err = ( __cuGetErrorName)(error, pStr) - return err -{{endif}} - -{{if 'cuInit' in found_functions}} - -cdef CUresult _cuInit(unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuInit - cuPythonInit() - if __cuInit == NULL: - with gil: - raise RuntimeError('Function "cuInit" not found') - err = ( __cuInit)(Flags) - return err -{{endif}} - -{{if 'cuDriverGetVersion' in found_functions}} - -cdef CUresult _cuDriverGetVersion(int* driverVersion) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuDriverGetVersion - cuPythonInit() - if __cuDriverGetVersion == NULL: - with gil: - raise RuntimeError('Function "cuDriverGetVersion" not found') - err = ( __cuDriverGetVersion)(driverVersion) - return err -{{endif}} - -{{if 'cuDeviceGet' in found_functions}} - -cdef CUresult _cuDeviceGet(CUdevice* device, int ordinal) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuDeviceGet - cuPythonInit() - if __cuDeviceGet == NULL: - with gil: - raise RuntimeError('Function "cuDeviceGet" not found') - err = ( __cuDeviceGet)(device, ordinal) - return err -{{endif}} - -{{if 'cuDeviceGetCount' in found_functions}} - -cdef CUresult _cuDeviceGetCount(int* count) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuDeviceGetCount - cuPythonInit() - if __cuDeviceGetCount == NULL: - with gil: - raise RuntimeError('Function "cuDeviceGetCount" not found') - err = ( __cuDeviceGetCount)(count) - return err -{{endif}} - -{{if 'cuDeviceGetName' in found_functions}} - -cdef CUresult _cuDeviceGetName(char* name, int length, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuDeviceGetName - cuPythonInit() - if __cuDeviceGetName == NULL: - with gil: - raise RuntimeError('Function "cuDeviceGetName" not found') - err = ( __cuDeviceGetName)(name, length, dev) - return err -{{endif}} - -{{if 'cuDeviceGetUuid' in found_functions}} - -cdef CUresult _cuDeviceGetUuid(CUuuid* uuid, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuDeviceGetUuid - cuPythonInit() - if __cuDeviceGetUuid == NULL: - with gil: - raise RuntimeError('Function "cuDeviceGetUuid" not found') - err = ( __cuDeviceGetUuid)(uuid, dev) - return err -{{endif}} - -{{if 'cuDeviceGetUuid_v2' in found_functions}} - -cdef CUresult _cuDeviceGetUuid_v2(CUuuid* uuid, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuDeviceGetUuid_v2 - cuPythonInit() - if __cuDeviceGetUuid_v2 == NULL: - with gil: - raise RuntimeError('Function "cuDeviceGetUuid_v2" not found') - err = ( __cuDeviceGetUuid_v2)(uuid, dev) - return err -{{endif}} - -{{if 'cuDeviceGetLuid' in found_functions}} - -cdef CUresult _cuDeviceGetLuid(char* luid, unsigned int* deviceNodeMask, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuDeviceGetLuid - cuPythonInit() - if __cuDeviceGetLuid == NULL: - with gil: - raise RuntimeError('Function "cuDeviceGetLuid" not found') - err = ( __cuDeviceGetLuid)(luid, deviceNodeMask, dev) - return err -{{endif}} - -{{if 'cuDeviceTotalMem_v2' in found_functions}} - -cdef CUresult _cuDeviceTotalMem_v2(size_t* numbytes, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuDeviceTotalMem_v2 - cuPythonInit() - if __cuDeviceTotalMem_v2 == NULL: - with gil: - raise RuntimeError('Function "cuDeviceTotalMem_v2" not found') - err = ( __cuDeviceTotalMem_v2)(numbytes, dev) - return err -{{endif}} - -{{if 'cuDeviceGetTexture1DLinearMaxWidth' in found_functions}} - -cdef CUresult _cuDeviceGetTexture1DLinearMaxWidth(size_t* maxWidthInElements, CUarray_format pformat, unsigned numChannels, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuDeviceGetTexture1DLinearMaxWidth - cuPythonInit() - if __cuDeviceGetTexture1DLinearMaxWidth == NULL: - with gil: - raise RuntimeError('Function "cuDeviceGetTexture1DLinearMaxWidth" not found') - err = ( __cuDeviceGetTexture1DLinearMaxWidth)(maxWidthInElements, pformat, numChannels, dev) - return err -{{endif}} - -{{if 'cuDeviceGetAttribute' in found_functions}} - -cdef CUresult _cuDeviceGetAttribute(int* pi, CUdevice_attribute attrib, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuDeviceGetAttribute - cuPythonInit() - if __cuDeviceGetAttribute == NULL: - with gil: - raise RuntimeError('Function "cuDeviceGetAttribute" not found') - err = ( __cuDeviceGetAttribute)(pi, attrib, dev) - return err -{{endif}} - -{{if 'cuDeviceGetNvSciSyncAttributes' in found_functions}} - -cdef CUresult _cuDeviceGetNvSciSyncAttributes(void* nvSciSyncAttrList, CUdevice dev, int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuDeviceGetNvSciSyncAttributes - cuPythonInit() - if __cuDeviceGetNvSciSyncAttributes == NULL: - with gil: - raise RuntimeError('Function "cuDeviceGetNvSciSyncAttributes" not found') - err = ( __cuDeviceGetNvSciSyncAttributes)(nvSciSyncAttrList, dev, flags) - return err -{{endif}} - -{{if 'cuDeviceSetMemPool' in found_functions}} - -cdef CUresult _cuDeviceSetMemPool(CUdevice dev, CUmemoryPool pool) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuDeviceSetMemPool - cuPythonInit() - if __cuDeviceSetMemPool == NULL: - with gil: - raise RuntimeError('Function "cuDeviceSetMemPool" not found') - err = ( __cuDeviceSetMemPool)(dev, pool) - return err -{{endif}} - -{{if 'cuDeviceGetMemPool' in found_functions}} - -cdef CUresult _cuDeviceGetMemPool(CUmemoryPool* pool, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuDeviceGetMemPool - cuPythonInit() - if __cuDeviceGetMemPool == NULL: - with gil: - raise RuntimeError('Function "cuDeviceGetMemPool" not found') - err = ( __cuDeviceGetMemPool)(pool, dev) - return err -{{endif}} - -{{if 'cuDeviceGetDefaultMemPool' in found_functions}} - -cdef CUresult _cuDeviceGetDefaultMemPool(CUmemoryPool* pool_out, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuDeviceGetDefaultMemPool - cuPythonInit() - if __cuDeviceGetDefaultMemPool == NULL: - with gil: - raise RuntimeError('Function "cuDeviceGetDefaultMemPool" not found') - err = ( __cuDeviceGetDefaultMemPool)(pool_out, dev) - return err -{{endif}} - -{{if 'cuDeviceGetExecAffinitySupport' in found_functions}} - -cdef CUresult _cuDeviceGetExecAffinitySupport(int* pi, CUexecAffinityType typename, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuDeviceGetExecAffinitySupport - cuPythonInit() - if __cuDeviceGetExecAffinitySupport == NULL: - with gil: - raise RuntimeError('Function "cuDeviceGetExecAffinitySupport" not found') - err = ( __cuDeviceGetExecAffinitySupport)(pi, typename, dev) - return err -{{endif}} - -{{if 'cuFlushGPUDirectRDMAWrites' in found_functions}} - -cdef CUresult _cuFlushGPUDirectRDMAWrites(CUflushGPUDirectRDMAWritesTarget target, CUflushGPUDirectRDMAWritesScope scope) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuFlushGPUDirectRDMAWrites - cuPythonInit() - if __cuFlushGPUDirectRDMAWrites == NULL: - with gil: - raise RuntimeError('Function "cuFlushGPUDirectRDMAWrites" not found') - err = ( __cuFlushGPUDirectRDMAWrites)(target, scope) - return err -{{endif}} - -{{if 'cuDeviceGetProperties' in found_functions}} - -cdef CUresult _cuDeviceGetProperties(CUdevprop* prop, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuDeviceGetProperties - cuPythonInit() - if __cuDeviceGetProperties == NULL: - with gil: - raise RuntimeError('Function "cuDeviceGetProperties" not found') - err = ( __cuDeviceGetProperties)(prop, dev) - return err -{{endif}} - -{{if 'cuDeviceComputeCapability' in found_functions}} - -cdef CUresult _cuDeviceComputeCapability(int* major, int* minor, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuDeviceComputeCapability - cuPythonInit() - if __cuDeviceComputeCapability == NULL: - with gil: - raise RuntimeError('Function "cuDeviceComputeCapability" not found') - err = ( __cuDeviceComputeCapability)(major, minor, dev) - return err -{{endif}} - -{{if 'cuDevicePrimaryCtxRetain' in found_functions}} - -cdef CUresult _cuDevicePrimaryCtxRetain(CUcontext* pctx, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuDevicePrimaryCtxRetain - cuPythonInit() - if __cuDevicePrimaryCtxRetain == NULL: - with gil: - raise RuntimeError('Function "cuDevicePrimaryCtxRetain" not found') - err = ( __cuDevicePrimaryCtxRetain)(pctx, dev) - return err -{{endif}} - -{{if 'cuDevicePrimaryCtxRelease_v2' in found_functions}} - -cdef CUresult _cuDevicePrimaryCtxRelease_v2(CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuDevicePrimaryCtxRelease_v2 - cuPythonInit() - if __cuDevicePrimaryCtxRelease_v2 == NULL: - with gil: - raise RuntimeError('Function "cuDevicePrimaryCtxRelease_v2" not found') - err = ( __cuDevicePrimaryCtxRelease_v2)(dev) - return err -{{endif}} - -{{if 'cuDevicePrimaryCtxSetFlags_v2' in found_functions}} - -cdef CUresult _cuDevicePrimaryCtxSetFlags_v2(CUdevice dev, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuDevicePrimaryCtxSetFlags_v2 - cuPythonInit() - if __cuDevicePrimaryCtxSetFlags_v2 == NULL: - with gil: - raise RuntimeError('Function "cuDevicePrimaryCtxSetFlags_v2" not found') - err = ( __cuDevicePrimaryCtxSetFlags_v2)(dev, flags) - return err -{{endif}} - -{{if 'cuDevicePrimaryCtxGetState' in found_functions}} - -cdef CUresult _cuDevicePrimaryCtxGetState(CUdevice dev, unsigned int* flags, int* active) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuDevicePrimaryCtxGetState - cuPythonInit() - if __cuDevicePrimaryCtxGetState == NULL: - with gil: - raise RuntimeError('Function "cuDevicePrimaryCtxGetState" not found') - err = ( __cuDevicePrimaryCtxGetState)(dev, flags, active) - return err -{{endif}} - -{{if 'cuDevicePrimaryCtxReset_v2' in found_functions}} - -cdef CUresult _cuDevicePrimaryCtxReset_v2(CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuDevicePrimaryCtxReset_v2 - cuPythonInit() - if __cuDevicePrimaryCtxReset_v2 == NULL: - with gil: - raise RuntimeError('Function "cuDevicePrimaryCtxReset_v2" not found') - err = ( __cuDevicePrimaryCtxReset_v2)(dev) - return err -{{endif}} - -{{if 'cuCtxCreate_v2' in found_functions}} - -cdef CUresult _cuCtxCreate_v2(CUcontext* pctx, unsigned int flags, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuCtxCreate_v2 - cuPythonInit() - if __cuCtxCreate_v2 == NULL: - with gil: - raise RuntimeError('Function "cuCtxCreate_v2" not found') - err = ( __cuCtxCreate_v2)(pctx, flags, dev) - return err -{{endif}} - -{{if 'cuCtxCreate_v3' in found_functions}} - -cdef CUresult _cuCtxCreate_v3(CUcontext* pctx, CUexecAffinityParam* paramsArray, int numParams, unsigned int flags, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuCtxCreate_v3 - cuPythonInit() - if __cuCtxCreate_v3 == NULL: - with gil: - raise RuntimeError('Function "cuCtxCreate_v3" not found') - err = ( __cuCtxCreate_v3)(pctx, paramsArray, numParams, flags, dev) - return err -{{endif}} - -{{if 'cuCtxCreate_v4' in found_functions}} - -cdef CUresult _cuCtxCreate_v4(CUcontext* pctx, CUctxCreateParams* ctxCreateParams, unsigned int flags, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuCtxCreate_v4 - cuPythonInit() - if __cuCtxCreate_v4 == NULL: - with gil: - raise RuntimeError('Function "cuCtxCreate_v4" not found') - err = ( __cuCtxCreate_v4)(pctx, ctxCreateParams, flags, dev) - return err -{{endif}} - -{{if 'cuCtxDestroy_v2' in found_functions}} - -cdef CUresult _cuCtxDestroy_v2(CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuCtxDestroy_v2 - cuPythonInit() - if __cuCtxDestroy_v2 == NULL: - with gil: - raise RuntimeError('Function "cuCtxDestroy_v2" not found') - err = ( __cuCtxDestroy_v2)(ctx) - return err -{{endif}} - -{{if 'cuCtxPushCurrent_v2' in found_functions}} - -cdef CUresult _cuCtxPushCurrent_v2(CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuCtxPushCurrent_v2 - cuPythonInit() - if __cuCtxPushCurrent_v2 == NULL: - with gil: - raise RuntimeError('Function "cuCtxPushCurrent_v2" not found') - err = ( __cuCtxPushCurrent_v2)(ctx) - return err -{{endif}} - -{{if 'cuCtxPopCurrent_v2' in found_functions}} - -cdef CUresult _cuCtxPopCurrent_v2(CUcontext* pctx) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuCtxPopCurrent_v2 - cuPythonInit() - if __cuCtxPopCurrent_v2 == NULL: - with gil: - raise RuntimeError('Function "cuCtxPopCurrent_v2" not found') - err = ( __cuCtxPopCurrent_v2)(pctx) - return err -{{endif}} - -{{if 'cuCtxSetCurrent' in found_functions}} - -cdef CUresult _cuCtxSetCurrent(CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuCtxSetCurrent - cuPythonInit() - if __cuCtxSetCurrent == NULL: - with gil: - raise RuntimeError('Function "cuCtxSetCurrent" not found') - err = ( __cuCtxSetCurrent)(ctx) - return err -{{endif}} - -{{if 'cuCtxGetCurrent' in found_functions}} - -cdef CUresult _cuCtxGetCurrent(CUcontext* pctx) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuCtxGetCurrent - cuPythonInit() - if __cuCtxGetCurrent == NULL: - with gil: - raise RuntimeError('Function "cuCtxGetCurrent" not found') - err = ( __cuCtxGetCurrent)(pctx) - return err -{{endif}} - -{{if 'cuCtxGetDevice' in found_functions}} - -cdef CUresult _cuCtxGetDevice(CUdevice* device) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuCtxGetDevice - cuPythonInit() - if __cuCtxGetDevice == NULL: - with gil: - raise RuntimeError('Function "cuCtxGetDevice" not found') - err = ( __cuCtxGetDevice)(device) - return err -{{endif}} - -{{if 'cuCtxGetFlags' in found_functions}} - -cdef CUresult _cuCtxGetFlags(unsigned int* flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuCtxGetFlags - cuPythonInit() - if __cuCtxGetFlags == NULL: - with gil: - raise RuntimeError('Function "cuCtxGetFlags" not found') - err = ( __cuCtxGetFlags)(flags) - return err -{{endif}} - -{{if 'cuCtxSetFlags' in found_functions}} - -cdef CUresult _cuCtxSetFlags(unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuCtxSetFlags - cuPythonInit() - if __cuCtxSetFlags == NULL: - with gil: - raise RuntimeError('Function "cuCtxSetFlags" not found') - err = ( __cuCtxSetFlags)(flags) - return err -{{endif}} - -{{if 'cuCtxGetId' in found_functions}} - -cdef CUresult _cuCtxGetId(CUcontext ctx, unsigned long long* ctxId) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuCtxGetId - cuPythonInit() - if __cuCtxGetId == NULL: - with gil: - raise RuntimeError('Function "cuCtxGetId" not found') - err = ( __cuCtxGetId)(ctx, ctxId) - return err -{{endif}} - -{{if 'cuCtxSynchronize' in found_functions}} - -cdef CUresult _cuCtxSynchronize() except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuCtxSynchronize - cuPythonInit() - if __cuCtxSynchronize == NULL: - with gil: - raise RuntimeError('Function "cuCtxSynchronize" not found') - err = ( __cuCtxSynchronize)() - return err -{{endif}} - -{{if 'cuCtxSetLimit' in found_functions}} - -cdef CUresult _cuCtxSetLimit(CUlimit limit, size_t value) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuCtxSetLimit - cuPythonInit() - if __cuCtxSetLimit == NULL: - with gil: - raise RuntimeError('Function "cuCtxSetLimit" not found') - err = ( __cuCtxSetLimit)(limit, value) - return err -{{endif}} - -{{if 'cuCtxGetLimit' in found_functions}} - -cdef CUresult _cuCtxGetLimit(size_t* pvalue, CUlimit limit) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuCtxGetLimit - cuPythonInit() - if __cuCtxGetLimit == NULL: - with gil: - raise RuntimeError('Function "cuCtxGetLimit" not found') - err = ( __cuCtxGetLimit)(pvalue, limit) - return err -{{endif}} - -{{if 'cuCtxGetCacheConfig' in found_functions}} - -cdef CUresult _cuCtxGetCacheConfig(CUfunc_cache* pconfig) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuCtxGetCacheConfig - cuPythonInit() - if __cuCtxGetCacheConfig == NULL: - with gil: - raise RuntimeError('Function "cuCtxGetCacheConfig" not found') - err = ( __cuCtxGetCacheConfig)(pconfig) - return err -{{endif}} - -{{if 'cuCtxSetCacheConfig' in found_functions}} - -cdef CUresult _cuCtxSetCacheConfig(CUfunc_cache config) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuCtxSetCacheConfig - cuPythonInit() - if __cuCtxSetCacheConfig == NULL: - with gil: - raise RuntimeError('Function "cuCtxSetCacheConfig" not found') - err = ( __cuCtxSetCacheConfig)(config) - return err -{{endif}} - -{{if 'cuCtxGetApiVersion' in found_functions}} - -cdef CUresult _cuCtxGetApiVersion(CUcontext ctx, unsigned int* version) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuCtxGetApiVersion - cuPythonInit() - if __cuCtxGetApiVersion == NULL: - with gil: - raise RuntimeError('Function "cuCtxGetApiVersion" not found') - err = ( __cuCtxGetApiVersion)(ctx, version) - return err -{{endif}} - -{{if 'cuCtxGetStreamPriorityRange' in found_functions}} - -cdef CUresult _cuCtxGetStreamPriorityRange(int* leastPriority, int* greatestPriority) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuCtxGetStreamPriorityRange - cuPythonInit() - if __cuCtxGetStreamPriorityRange == NULL: - with gil: - raise RuntimeError('Function "cuCtxGetStreamPriorityRange" not found') - err = ( __cuCtxGetStreamPriorityRange)(leastPriority, greatestPriority) - return err -{{endif}} - -{{if 'cuCtxResetPersistingL2Cache' in found_functions}} - -cdef CUresult _cuCtxResetPersistingL2Cache() except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuCtxResetPersistingL2Cache - cuPythonInit() - if __cuCtxResetPersistingL2Cache == NULL: - with gil: - raise RuntimeError('Function "cuCtxResetPersistingL2Cache" not found') - err = ( __cuCtxResetPersistingL2Cache)() - return err -{{endif}} - -{{if 'cuCtxGetExecAffinity' in found_functions}} - -cdef CUresult _cuCtxGetExecAffinity(CUexecAffinityParam* pExecAffinity, CUexecAffinityType typename) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuCtxGetExecAffinity - cuPythonInit() - if __cuCtxGetExecAffinity == NULL: - with gil: - raise RuntimeError('Function "cuCtxGetExecAffinity" not found') - err = ( __cuCtxGetExecAffinity)(pExecAffinity, typename) - return err -{{endif}} - -{{if 'cuCtxRecordEvent' in found_functions}} - -cdef CUresult _cuCtxRecordEvent(CUcontext hCtx, CUevent hEvent) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuCtxRecordEvent - cuPythonInit() - if __cuCtxRecordEvent == NULL: - with gil: - raise RuntimeError('Function "cuCtxRecordEvent" not found') - err = ( __cuCtxRecordEvent)(hCtx, hEvent) - return err -{{endif}} - -{{if 'cuCtxWaitEvent' in found_functions}} - -cdef CUresult _cuCtxWaitEvent(CUcontext hCtx, CUevent hEvent) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuCtxWaitEvent - cuPythonInit() - if __cuCtxWaitEvent == NULL: - with gil: - raise RuntimeError('Function "cuCtxWaitEvent" not found') - err = ( __cuCtxWaitEvent)(hCtx, hEvent) - return err -{{endif}} - -{{if 'cuCtxAttach' in found_functions}} - -cdef CUresult _cuCtxAttach(CUcontext* pctx, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuCtxAttach - cuPythonInit() - if __cuCtxAttach == NULL: - with gil: - raise RuntimeError('Function "cuCtxAttach" not found') - err = ( __cuCtxAttach)(pctx, flags) - return err -{{endif}} - -{{if 'cuCtxDetach' in found_functions}} - -cdef CUresult _cuCtxDetach(CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuCtxDetach - cuPythonInit() - if __cuCtxDetach == NULL: - with gil: - raise RuntimeError('Function "cuCtxDetach" not found') - err = ( __cuCtxDetach)(ctx) - return err -{{endif}} - -{{if 'cuCtxGetSharedMemConfig' in found_functions}} - -cdef CUresult _cuCtxGetSharedMemConfig(CUsharedconfig* pConfig) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuCtxGetSharedMemConfig - cuPythonInit() - if __cuCtxGetSharedMemConfig == NULL: - with gil: - raise RuntimeError('Function "cuCtxGetSharedMemConfig" not found') - err = ( __cuCtxGetSharedMemConfig)(pConfig) - return err -{{endif}} - -{{if 'cuCtxSetSharedMemConfig' in found_functions}} - -cdef CUresult _cuCtxSetSharedMemConfig(CUsharedconfig config) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuCtxSetSharedMemConfig - cuPythonInit() - if __cuCtxSetSharedMemConfig == NULL: - with gil: - raise RuntimeError('Function "cuCtxSetSharedMemConfig" not found') - err = ( __cuCtxSetSharedMemConfig)(config) - return err -{{endif}} - -{{if 'cuModuleLoad' in found_functions}} - -cdef CUresult _cuModuleLoad(CUmodule* module, const char* fname) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuModuleLoad - cuPythonInit() - if __cuModuleLoad == NULL: - with gil: - raise RuntimeError('Function "cuModuleLoad" not found') - err = ( __cuModuleLoad)(module, fname) - return err -{{endif}} - -{{if 'cuModuleLoadData' in found_functions}} - -cdef CUresult _cuModuleLoadData(CUmodule* module, const void* image) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuModuleLoadData - cuPythonInit() - if __cuModuleLoadData == NULL: - with gil: - raise RuntimeError('Function "cuModuleLoadData" not found') - err = ( __cuModuleLoadData)(module, image) - return err -{{endif}} - -{{if 'cuModuleLoadDataEx' in found_functions}} - -cdef CUresult _cuModuleLoadDataEx(CUmodule* module, const void* image, unsigned int numOptions, CUjit_option* options, void** optionValues) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuModuleLoadDataEx - cuPythonInit() - if __cuModuleLoadDataEx == NULL: - with gil: - raise RuntimeError('Function "cuModuleLoadDataEx" not found') - err = ( __cuModuleLoadDataEx)(module, image, numOptions, options, optionValues) - return err -{{endif}} - -{{if 'cuModuleLoadFatBinary' in found_functions}} - -cdef CUresult _cuModuleLoadFatBinary(CUmodule* module, const void* fatCubin) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuModuleLoadFatBinary - cuPythonInit() - if __cuModuleLoadFatBinary == NULL: - with gil: - raise RuntimeError('Function "cuModuleLoadFatBinary" not found') - err = ( __cuModuleLoadFatBinary)(module, fatCubin) - return err -{{endif}} - -{{if 'cuModuleUnload' in found_functions}} - -cdef CUresult _cuModuleUnload(CUmodule hmod) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuModuleUnload - cuPythonInit() - if __cuModuleUnload == NULL: - with gil: - raise RuntimeError('Function "cuModuleUnload" not found') - err = ( __cuModuleUnload)(hmod) - return err -{{endif}} - -{{if 'cuModuleGetLoadingMode' in found_functions}} - -cdef CUresult _cuModuleGetLoadingMode(CUmoduleLoadingMode* mode) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuModuleGetLoadingMode - cuPythonInit() - if __cuModuleGetLoadingMode == NULL: - with gil: - raise RuntimeError('Function "cuModuleGetLoadingMode" not found') - err = ( __cuModuleGetLoadingMode)(mode) - return err -{{endif}} - -{{if 'cuModuleGetFunction' in found_functions}} - -cdef CUresult _cuModuleGetFunction(CUfunction* hfunc, CUmodule hmod, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuModuleGetFunction - cuPythonInit() - if __cuModuleGetFunction == NULL: - with gil: - raise RuntimeError('Function "cuModuleGetFunction" not found') - err = ( __cuModuleGetFunction)(hfunc, hmod, name) - return err -{{endif}} - -{{if 'cuModuleGetFunctionCount' in found_functions}} - -cdef CUresult _cuModuleGetFunctionCount(unsigned int* count, CUmodule mod) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuModuleGetFunctionCount - cuPythonInit() - if __cuModuleGetFunctionCount == NULL: - with gil: - raise RuntimeError('Function "cuModuleGetFunctionCount" not found') - err = ( __cuModuleGetFunctionCount)(count, mod) - return err -{{endif}} - -{{if 'cuModuleEnumerateFunctions' in found_functions}} - -cdef CUresult _cuModuleEnumerateFunctions(CUfunction* functions, unsigned int numFunctions, CUmodule mod) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuModuleEnumerateFunctions - cuPythonInit() - if __cuModuleEnumerateFunctions == NULL: - with gil: - raise RuntimeError('Function "cuModuleEnumerateFunctions" not found') - err = ( __cuModuleEnumerateFunctions)(functions, numFunctions, mod) - return err -{{endif}} - -{{if 'cuModuleGetGlobal_v2' in found_functions}} - -cdef CUresult _cuModuleGetGlobal_v2(CUdeviceptr* dptr, size_t* numbytes, CUmodule hmod, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuModuleGetGlobal_v2 - cuPythonInit() - if __cuModuleGetGlobal_v2 == NULL: - with gil: - raise RuntimeError('Function "cuModuleGetGlobal_v2" not found') - err = ( __cuModuleGetGlobal_v2)(dptr, numbytes, hmod, name) - return err -{{endif}} - -{{if 'cuLinkCreate_v2' in found_functions}} - -cdef CUresult _cuLinkCreate_v2(unsigned int numOptions, CUjit_option* options, void** optionValues, CUlinkState* stateOut) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuLinkCreate_v2 - cuPythonInit() - if __cuLinkCreate_v2 == NULL: - with gil: - raise RuntimeError('Function "cuLinkCreate_v2" not found') - err = ( __cuLinkCreate_v2)(numOptions, options, optionValues, stateOut) - return err -{{endif}} - -{{if 'cuLinkAddData_v2' in found_functions}} - -cdef CUresult _cuLinkAddData_v2(CUlinkState state, CUjitInputType typename, void* data, size_t size, const char* name, unsigned int numOptions, CUjit_option* options, void** optionValues) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuLinkAddData_v2 - cuPythonInit() - if __cuLinkAddData_v2 == NULL: - with gil: - raise RuntimeError('Function "cuLinkAddData_v2" not found') - err = ( __cuLinkAddData_v2)(state, typename, data, size, name, numOptions, options, optionValues) - return err -{{endif}} - -{{if 'cuLinkAddFile_v2' in found_functions}} - -cdef CUresult _cuLinkAddFile_v2(CUlinkState state, CUjitInputType typename, const char* path, unsigned int numOptions, CUjit_option* options, void** optionValues) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuLinkAddFile_v2 - cuPythonInit() - if __cuLinkAddFile_v2 == NULL: - with gil: - raise RuntimeError('Function "cuLinkAddFile_v2" not found') - err = ( __cuLinkAddFile_v2)(state, typename, path, numOptions, options, optionValues) - return err -{{endif}} - -{{if 'cuLinkComplete' in found_functions}} - -cdef CUresult _cuLinkComplete(CUlinkState state, void** cubinOut, size_t* sizeOut) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuLinkComplete - cuPythonInit() - if __cuLinkComplete == NULL: - with gil: - raise RuntimeError('Function "cuLinkComplete" not found') - err = ( __cuLinkComplete)(state, cubinOut, sizeOut) - return err -{{endif}} - -{{if 'cuLinkDestroy' in found_functions}} - -cdef CUresult _cuLinkDestroy(CUlinkState state) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuLinkDestroy - cuPythonInit() - if __cuLinkDestroy == NULL: - with gil: - raise RuntimeError('Function "cuLinkDestroy" not found') - err = ( __cuLinkDestroy)(state) - return err -{{endif}} - -{{if 'cuModuleGetTexRef' in found_functions}} - -cdef CUresult _cuModuleGetTexRef(CUtexref* pTexRef, CUmodule hmod, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuModuleGetTexRef - cuPythonInit() - if __cuModuleGetTexRef == NULL: - with gil: - raise RuntimeError('Function "cuModuleGetTexRef" not found') - err = ( __cuModuleGetTexRef)(pTexRef, hmod, name) - return err -{{endif}} - -{{if 'cuModuleGetSurfRef' in found_functions}} - -cdef CUresult _cuModuleGetSurfRef(CUsurfref* pSurfRef, CUmodule hmod, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuModuleGetSurfRef - cuPythonInit() - if __cuModuleGetSurfRef == NULL: - with gil: - raise RuntimeError('Function "cuModuleGetSurfRef" not found') - err = ( __cuModuleGetSurfRef)(pSurfRef, hmod, name) - return err -{{endif}} - -{{if 'cuLibraryLoadData' in found_functions}} - -cdef CUresult _cuLibraryLoadData(CUlibrary* library, const void* code, CUjit_option* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, CUlibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuLibraryLoadData - cuPythonInit() - if __cuLibraryLoadData == NULL: - with gil: - raise RuntimeError('Function "cuLibraryLoadData" not found') - err = ( __cuLibraryLoadData)(library, code, jitOptions, jitOptionsValues, numJitOptions, libraryOptions, libraryOptionValues, numLibraryOptions) - return err -{{endif}} - -{{if 'cuLibraryLoadFromFile' in found_functions}} - -cdef CUresult _cuLibraryLoadFromFile(CUlibrary* library, const char* fileName, CUjit_option* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, CUlibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuLibraryLoadFromFile - cuPythonInit() - if __cuLibraryLoadFromFile == NULL: - with gil: - raise RuntimeError('Function "cuLibraryLoadFromFile" not found') - err = ( __cuLibraryLoadFromFile)(library, fileName, jitOptions, jitOptionsValues, numJitOptions, libraryOptions, libraryOptionValues, numLibraryOptions) - return err -{{endif}} - -{{if 'cuLibraryUnload' in found_functions}} - -cdef CUresult _cuLibraryUnload(CUlibrary library) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuLibraryUnload - cuPythonInit() - if __cuLibraryUnload == NULL: - with gil: - raise RuntimeError('Function "cuLibraryUnload" not found') - err = ( __cuLibraryUnload)(library) - return err -{{endif}} - -{{if 'cuLibraryGetKernel' in found_functions}} - -cdef CUresult _cuLibraryGetKernel(CUkernel* pKernel, CUlibrary library, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuLibraryGetKernel - cuPythonInit() - if __cuLibraryGetKernel == NULL: - with gil: - raise RuntimeError('Function "cuLibraryGetKernel" not found') - err = ( __cuLibraryGetKernel)(pKernel, library, name) - return err -{{endif}} - -{{if 'cuLibraryGetKernelCount' in found_functions}} - -cdef CUresult _cuLibraryGetKernelCount(unsigned int* count, CUlibrary lib) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuLibraryGetKernelCount - cuPythonInit() - if __cuLibraryGetKernelCount == NULL: - with gil: - raise RuntimeError('Function "cuLibraryGetKernelCount" not found') - err = ( __cuLibraryGetKernelCount)(count, lib) - return err -{{endif}} - -{{if 'cuLibraryEnumerateKernels' in found_functions}} - -cdef CUresult _cuLibraryEnumerateKernels(CUkernel* kernels, unsigned int numKernels, CUlibrary lib) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuLibraryEnumerateKernels - cuPythonInit() - if __cuLibraryEnumerateKernels == NULL: - with gil: - raise RuntimeError('Function "cuLibraryEnumerateKernels" not found') - err = ( __cuLibraryEnumerateKernels)(kernels, numKernels, lib) - return err -{{endif}} - -{{if 'cuLibraryGetModule' in found_functions}} - -cdef CUresult _cuLibraryGetModule(CUmodule* pMod, CUlibrary library) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuLibraryGetModule - cuPythonInit() - if __cuLibraryGetModule == NULL: - with gil: - raise RuntimeError('Function "cuLibraryGetModule" not found') - err = ( __cuLibraryGetModule)(pMod, library) - return err -{{endif}} - -{{if 'cuKernelGetFunction' in found_functions}} - -cdef CUresult _cuKernelGetFunction(CUfunction* pFunc, CUkernel kernel) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuKernelGetFunction - cuPythonInit() - if __cuKernelGetFunction == NULL: - with gil: - raise RuntimeError('Function "cuKernelGetFunction" not found') - err = ( __cuKernelGetFunction)(pFunc, kernel) - return err -{{endif}} - -{{if 'cuKernelGetLibrary' in found_functions}} - -cdef CUresult _cuKernelGetLibrary(CUlibrary* pLib, CUkernel kernel) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuKernelGetLibrary - cuPythonInit() - if __cuKernelGetLibrary == NULL: - with gil: - raise RuntimeError('Function "cuKernelGetLibrary" not found') - err = ( __cuKernelGetLibrary)(pLib, kernel) - return err -{{endif}} - -{{if 'cuLibraryGetGlobal' in found_functions}} - -cdef CUresult _cuLibraryGetGlobal(CUdeviceptr* dptr, size_t* numbytes, CUlibrary library, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuLibraryGetGlobal - cuPythonInit() - if __cuLibraryGetGlobal == NULL: - with gil: - raise RuntimeError('Function "cuLibraryGetGlobal" not found') - err = ( __cuLibraryGetGlobal)(dptr, numbytes, library, name) - return err -{{endif}} - -{{if 'cuLibraryGetManaged' in found_functions}} - -cdef CUresult _cuLibraryGetManaged(CUdeviceptr* dptr, size_t* numbytes, CUlibrary library, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuLibraryGetManaged - cuPythonInit() - if __cuLibraryGetManaged == NULL: - with gil: - raise RuntimeError('Function "cuLibraryGetManaged" not found') - err = ( __cuLibraryGetManaged)(dptr, numbytes, library, name) - return err -{{endif}} - -{{if 'cuLibraryGetUnifiedFunction' in found_functions}} - -cdef CUresult _cuLibraryGetUnifiedFunction(void** fptr, CUlibrary library, const char* symbol) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuLibraryGetUnifiedFunction - cuPythonInit() - if __cuLibraryGetUnifiedFunction == NULL: - with gil: - raise RuntimeError('Function "cuLibraryGetUnifiedFunction" not found') - err = ( __cuLibraryGetUnifiedFunction)(fptr, library, symbol) - return err -{{endif}} - -{{if 'cuKernelGetAttribute' in found_functions}} - -cdef CUresult _cuKernelGetAttribute(int* pi, CUfunction_attribute attrib, CUkernel kernel, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuKernelGetAttribute - cuPythonInit() - if __cuKernelGetAttribute == NULL: - with gil: - raise RuntimeError('Function "cuKernelGetAttribute" not found') - err = ( __cuKernelGetAttribute)(pi, attrib, kernel, dev) - return err -{{endif}} - -{{if 'cuKernelSetAttribute' in found_functions}} - -cdef CUresult _cuKernelSetAttribute(CUfunction_attribute attrib, int val, CUkernel kernel, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuKernelSetAttribute - cuPythonInit() - if __cuKernelSetAttribute == NULL: - with gil: - raise RuntimeError('Function "cuKernelSetAttribute" not found') - err = ( __cuKernelSetAttribute)(attrib, val, kernel, dev) - return err -{{endif}} - -{{if 'cuKernelSetCacheConfig' in found_functions}} - -cdef CUresult _cuKernelSetCacheConfig(CUkernel kernel, CUfunc_cache config, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuKernelSetCacheConfig - cuPythonInit() - if __cuKernelSetCacheConfig == NULL: - with gil: - raise RuntimeError('Function "cuKernelSetCacheConfig" not found') - err = ( __cuKernelSetCacheConfig)(kernel, config, dev) - return err -{{endif}} - -{{if 'cuKernelGetName' in found_functions}} - -cdef CUresult _cuKernelGetName(const char** name, CUkernel hfunc) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuKernelGetName - cuPythonInit() - if __cuKernelGetName == NULL: - with gil: - raise RuntimeError('Function "cuKernelGetName" not found') - err = ( __cuKernelGetName)(name, hfunc) - return err -{{endif}} - -{{if 'cuKernelGetParamInfo' in found_functions}} - -cdef CUresult _cuKernelGetParamInfo(CUkernel kernel, size_t paramIndex, size_t* paramOffset, size_t* paramSize) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuKernelGetParamInfo - cuPythonInit() - if __cuKernelGetParamInfo == NULL: - with gil: - raise RuntimeError('Function "cuKernelGetParamInfo" not found') - err = ( __cuKernelGetParamInfo)(kernel, paramIndex, paramOffset, paramSize) - return err -{{endif}} - -{{if 'cuMemGetInfo_v2' in found_functions}} - -cdef CUresult _cuMemGetInfo_v2(size_t* free, size_t* total) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemGetInfo_v2 - cuPythonInit() - if __cuMemGetInfo_v2 == NULL: - with gil: - raise RuntimeError('Function "cuMemGetInfo_v2" not found') - err = ( __cuMemGetInfo_v2)(free, total) - return err -{{endif}} - -{{if 'cuMemAlloc_v2' in found_functions}} - -cdef CUresult _cuMemAlloc_v2(CUdeviceptr* dptr, size_t bytesize) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemAlloc_v2 - cuPythonInit() - if __cuMemAlloc_v2 == NULL: - with gil: - raise RuntimeError('Function "cuMemAlloc_v2" not found') - err = ( __cuMemAlloc_v2)(dptr, bytesize) - return err -{{endif}} - -{{if 'cuMemAllocPitch_v2' in found_functions}} - -cdef CUresult _cuMemAllocPitch_v2(CUdeviceptr* dptr, size_t* pPitch, size_t WidthInBytes, size_t Height, unsigned int ElementSizeBytes) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemAllocPitch_v2 - cuPythonInit() - if __cuMemAllocPitch_v2 == NULL: - with gil: - raise RuntimeError('Function "cuMemAllocPitch_v2" not found') - err = ( __cuMemAllocPitch_v2)(dptr, pPitch, WidthInBytes, Height, ElementSizeBytes) - return err -{{endif}} - -{{if 'cuMemFree_v2' in found_functions}} - -cdef CUresult _cuMemFree_v2(CUdeviceptr dptr) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemFree_v2 - cuPythonInit() - if __cuMemFree_v2 == NULL: - with gil: - raise RuntimeError('Function "cuMemFree_v2" not found') - err = ( __cuMemFree_v2)(dptr) - return err -{{endif}} - -{{if 'cuMemGetAddressRange_v2' in found_functions}} - -cdef CUresult _cuMemGetAddressRange_v2(CUdeviceptr* pbase, size_t* psize, CUdeviceptr dptr) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemGetAddressRange_v2 - cuPythonInit() - if __cuMemGetAddressRange_v2 == NULL: - with gil: - raise RuntimeError('Function "cuMemGetAddressRange_v2" not found') - err = ( __cuMemGetAddressRange_v2)(pbase, psize, dptr) - return err -{{endif}} - -{{if 'cuMemAllocHost_v2' in found_functions}} - -cdef CUresult _cuMemAllocHost_v2(void** pp, size_t bytesize) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemAllocHost_v2 - cuPythonInit() - if __cuMemAllocHost_v2 == NULL: - with gil: - raise RuntimeError('Function "cuMemAllocHost_v2" not found') - err = ( __cuMemAllocHost_v2)(pp, bytesize) - return err -{{endif}} - -{{if 'cuMemFreeHost' in found_functions}} - -cdef CUresult _cuMemFreeHost(void* p) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemFreeHost - cuPythonInit() - if __cuMemFreeHost == NULL: - with gil: - raise RuntimeError('Function "cuMemFreeHost" not found') - err = ( __cuMemFreeHost)(p) - return err -{{endif}} - -{{if 'cuMemHostAlloc' in found_functions}} - -cdef CUresult _cuMemHostAlloc(void** pp, size_t bytesize, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemHostAlloc - cuPythonInit() - if __cuMemHostAlloc == NULL: - with gil: - raise RuntimeError('Function "cuMemHostAlloc" not found') - err = ( __cuMemHostAlloc)(pp, bytesize, Flags) - return err -{{endif}} - -{{if 'cuMemHostGetDevicePointer_v2' in found_functions}} - -cdef CUresult _cuMemHostGetDevicePointer_v2(CUdeviceptr* pdptr, void* p, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemHostGetDevicePointer_v2 - cuPythonInit() - if __cuMemHostGetDevicePointer_v2 == NULL: - with gil: - raise RuntimeError('Function "cuMemHostGetDevicePointer_v2" not found') - err = ( __cuMemHostGetDevicePointer_v2)(pdptr, p, Flags) - return err -{{endif}} - -{{if 'cuMemHostGetFlags' in found_functions}} - -cdef CUresult _cuMemHostGetFlags(unsigned int* pFlags, void* p) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemHostGetFlags - cuPythonInit() - if __cuMemHostGetFlags == NULL: - with gil: - raise RuntimeError('Function "cuMemHostGetFlags" not found') - err = ( __cuMemHostGetFlags)(pFlags, p) - return err -{{endif}} - -{{if 'cuMemAllocManaged' in found_functions}} - -cdef CUresult _cuMemAllocManaged(CUdeviceptr* dptr, size_t bytesize, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemAllocManaged - cuPythonInit() - if __cuMemAllocManaged == NULL: - with gil: - raise RuntimeError('Function "cuMemAllocManaged" not found') - err = ( __cuMemAllocManaged)(dptr, bytesize, flags) - return err -{{endif}} - -{{if 'cuDeviceRegisterAsyncNotification' in found_functions}} - -cdef CUresult _cuDeviceRegisterAsyncNotification(CUdevice device, CUasyncCallback callbackFunc, void* userData, CUasyncCallbackHandle* callback) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuDeviceRegisterAsyncNotification - cuPythonInit() - if __cuDeviceRegisterAsyncNotification == NULL: - with gil: - raise RuntimeError('Function "cuDeviceRegisterAsyncNotification" not found') - err = ( __cuDeviceRegisterAsyncNotification)(device, callbackFunc, userData, callback) - return err -{{endif}} - -{{if 'cuDeviceUnregisterAsyncNotification' in found_functions}} - -cdef CUresult _cuDeviceUnregisterAsyncNotification(CUdevice device, CUasyncCallbackHandle callback) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuDeviceUnregisterAsyncNotification - cuPythonInit() - if __cuDeviceUnregisterAsyncNotification == NULL: - with gil: - raise RuntimeError('Function "cuDeviceUnregisterAsyncNotification" not found') - err = ( __cuDeviceUnregisterAsyncNotification)(device, callback) - return err -{{endif}} - -{{if 'cuDeviceGetByPCIBusId' in found_functions}} - -cdef CUresult _cuDeviceGetByPCIBusId(CUdevice* dev, const char* pciBusId) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuDeviceGetByPCIBusId - cuPythonInit() - if __cuDeviceGetByPCIBusId == NULL: - with gil: - raise RuntimeError('Function "cuDeviceGetByPCIBusId" not found') - err = ( __cuDeviceGetByPCIBusId)(dev, pciBusId) - return err -{{endif}} - -{{if 'cuDeviceGetPCIBusId' in found_functions}} - -cdef CUresult _cuDeviceGetPCIBusId(char* pciBusId, int length, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuDeviceGetPCIBusId - cuPythonInit() - if __cuDeviceGetPCIBusId == NULL: - with gil: - raise RuntimeError('Function "cuDeviceGetPCIBusId" not found') - err = ( __cuDeviceGetPCIBusId)(pciBusId, length, dev) - return err -{{endif}} - -{{if 'cuIpcGetEventHandle' in found_functions}} - -cdef CUresult _cuIpcGetEventHandle(CUipcEventHandle* pHandle, CUevent event) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuIpcGetEventHandle - cuPythonInit() - if __cuIpcGetEventHandle == NULL: - with gil: - raise RuntimeError('Function "cuIpcGetEventHandle" not found') - err = ( __cuIpcGetEventHandle)(pHandle, event) - return err -{{endif}} - -{{if 'cuIpcOpenEventHandle' in found_functions}} - -cdef CUresult _cuIpcOpenEventHandle(CUevent* phEvent, CUipcEventHandle handle) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuIpcOpenEventHandle - cuPythonInit() - if __cuIpcOpenEventHandle == NULL: - with gil: - raise RuntimeError('Function "cuIpcOpenEventHandle" not found') - err = ( __cuIpcOpenEventHandle)(phEvent, handle) - return err -{{endif}} - -{{if 'cuIpcGetMemHandle' in found_functions}} - -cdef CUresult _cuIpcGetMemHandle(CUipcMemHandle* pHandle, CUdeviceptr dptr) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuIpcGetMemHandle - cuPythonInit() - if __cuIpcGetMemHandle == NULL: - with gil: - raise RuntimeError('Function "cuIpcGetMemHandle" not found') - err = ( __cuIpcGetMemHandle)(pHandle, dptr) - return err -{{endif}} - -{{if 'cuIpcOpenMemHandle_v2' in found_functions}} - -cdef CUresult _cuIpcOpenMemHandle_v2(CUdeviceptr* pdptr, CUipcMemHandle handle, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuIpcOpenMemHandle_v2 - cuPythonInit() - if __cuIpcOpenMemHandle_v2 == NULL: - with gil: - raise RuntimeError('Function "cuIpcOpenMemHandle_v2" not found') - err = ( __cuIpcOpenMemHandle_v2)(pdptr, handle, Flags) - return err -{{endif}} - -{{if 'cuIpcCloseMemHandle' in found_functions}} - -cdef CUresult _cuIpcCloseMemHandle(CUdeviceptr dptr) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuIpcCloseMemHandle - cuPythonInit() - if __cuIpcCloseMemHandle == NULL: - with gil: - raise RuntimeError('Function "cuIpcCloseMemHandle" not found') - err = ( __cuIpcCloseMemHandle)(dptr) - return err -{{endif}} - -{{if 'cuMemHostRegister_v2' in found_functions}} - -cdef CUresult _cuMemHostRegister_v2(void* p, size_t bytesize, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemHostRegister_v2 - cuPythonInit() - if __cuMemHostRegister_v2 == NULL: - with gil: - raise RuntimeError('Function "cuMemHostRegister_v2" not found') - err = ( __cuMemHostRegister_v2)(p, bytesize, Flags) - return err -{{endif}} - -{{if 'cuMemHostUnregister' in found_functions}} - -cdef CUresult _cuMemHostUnregister(void* p) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemHostUnregister - cuPythonInit() - if __cuMemHostUnregister == NULL: - with gil: - raise RuntimeError('Function "cuMemHostUnregister" not found') - err = ( __cuMemHostUnregister)(p) - return err -{{endif}} - -{{if 'cuMemcpy' in found_functions}} - -cdef CUresult _cuMemcpy(CUdeviceptr dst, CUdeviceptr src, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemcpy - cuPythonInit() - if __cuMemcpy == NULL: - with gil: - raise RuntimeError('Function "cuMemcpy" not found') - err = ( __cuMemcpy)(dst, src, ByteCount) - return err -{{endif}} - -{{if 'cuMemcpyPeer' in found_functions}} - -cdef CUresult _cuMemcpyPeer(CUdeviceptr dstDevice, CUcontext dstContext, CUdeviceptr srcDevice, CUcontext srcContext, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemcpyPeer - cuPythonInit() - if __cuMemcpyPeer == NULL: - with gil: - raise RuntimeError('Function "cuMemcpyPeer" not found') - err = ( __cuMemcpyPeer)(dstDevice, dstContext, srcDevice, srcContext, ByteCount) - return err -{{endif}} - -{{if 'cuMemcpyHtoD_v2' in found_functions}} - -cdef CUresult _cuMemcpyHtoD_v2(CUdeviceptr dstDevice, const void* srcHost, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemcpyHtoD_v2 - cuPythonInit() - if __cuMemcpyHtoD_v2 == NULL: - with gil: - raise RuntimeError('Function "cuMemcpyHtoD_v2" not found') - err = ( __cuMemcpyHtoD_v2)(dstDevice, srcHost, ByteCount) - return err -{{endif}} - -{{if 'cuMemcpyDtoH_v2' in found_functions}} - -cdef CUresult _cuMemcpyDtoH_v2(void* dstHost, CUdeviceptr srcDevice, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemcpyDtoH_v2 - cuPythonInit() - if __cuMemcpyDtoH_v2 == NULL: - with gil: - raise RuntimeError('Function "cuMemcpyDtoH_v2" not found') - err = ( __cuMemcpyDtoH_v2)(dstHost, srcDevice, ByteCount) - return err -{{endif}} - -{{if 'cuMemcpyDtoD_v2' in found_functions}} - -cdef CUresult _cuMemcpyDtoD_v2(CUdeviceptr dstDevice, CUdeviceptr srcDevice, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemcpyDtoD_v2 - cuPythonInit() - if __cuMemcpyDtoD_v2 == NULL: - with gil: - raise RuntimeError('Function "cuMemcpyDtoD_v2" not found') - err = ( __cuMemcpyDtoD_v2)(dstDevice, srcDevice, ByteCount) - return err -{{endif}} - -{{if 'cuMemcpyDtoA_v2' in found_functions}} - -cdef CUresult _cuMemcpyDtoA_v2(CUarray dstArray, size_t dstOffset, CUdeviceptr srcDevice, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemcpyDtoA_v2 - cuPythonInit() - if __cuMemcpyDtoA_v2 == NULL: - with gil: - raise RuntimeError('Function "cuMemcpyDtoA_v2" not found') - err = ( __cuMemcpyDtoA_v2)(dstArray, dstOffset, srcDevice, ByteCount) - return err -{{endif}} - -{{if 'cuMemcpyAtoD_v2' in found_functions}} - -cdef CUresult _cuMemcpyAtoD_v2(CUdeviceptr dstDevice, CUarray srcArray, size_t srcOffset, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemcpyAtoD_v2 - cuPythonInit() - if __cuMemcpyAtoD_v2 == NULL: - with gil: - raise RuntimeError('Function "cuMemcpyAtoD_v2" not found') - err = ( __cuMemcpyAtoD_v2)(dstDevice, srcArray, srcOffset, ByteCount) - return err -{{endif}} - -{{if 'cuMemcpyHtoA_v2' in found_functions}} - -cdef CUresult _cuMemcpyHtoA_v2(CUarray dstArray, size_t dstOffset, const void* srcHost, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemcpyHtoA_v2 - cuPythonInit() - if __cuMemcpyHtoA_v2 == NULL: - with gil: - raise RuntimeError('Function "cuMemcpyHtoA_v2" not found') - err = ( __cuMemcpyHtoA_v2)(dstArray, dstOffset, srcHost, ByteCount) - return err -{{endif}} - -{{if 'cuMemcpyAtoH_v2' in found_functions}} - -cdef CUresult _cuMemcpyAtoH_v2(void* dstHost, CUarray srcArray, size_t srcOffset, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemcpyAtoH_v2 - cuPythonInit() - if __cuMemcpyAtoH_v2 == NULL: - with gil: - raise RuntimeError('Function "cuMemcpyAtoH_v2" not found') - err = ( __cuMemcpyAtoH_v2)(dstHost, srcArray, srcOffset, ByteCount) - return err -{{endif}} - -{{if 'cuMemcpyAtoA_v2' in found_functions}} - -cdef CUresult _cuMemcpyAtoA_v2(CUarray dstArray, size_t dstOffset, CUarray srcArray, size_t srcOffset, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemcpyAtoA_v2 - cuPythonInit() - if __cuMemcpyAtoA_v2 == NULL: - with gil: - raise RuntimeError('Function "cuMemcpyAtoA_v2" not found') - err = ( __cuMemcpyAtoA_v2)(dstArray, dstOffset, srcArray, srcOffset, ByteCount) - return err -{{endif}} - -{{if 'cuMemcpy2D_v2' in found_functions}} - -cdef CUresult _cuMemcpy2D_v2(const CUDA_MEMCPY2D* pCopy) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemcpy2D_v2 - cuPythonInit() - if __cuMemcpy2D_v2 == NULL: - with gil: - raise RuntimeError('Function "cuMemcpy2D_v2" not found') - err = ( __cuMemcpy2D_v2)(pCopy) - return err -{{endif}} - -{{if 'cuMemcpy2DUnaligned_v2' in found_functions}} - -cdef CUresult _cuMemcpy2DUnaligned_v2(const CUDA_MEMCPY2D* pCopy) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemcpy2DUnaligned_v2 - cuPythonInit() - if __cuMemcpy2DUnaligned_v2 == NULL: - with gil: - raise RuntimeError('Function "cuMemcpy2DUnaligned_v2" not found') - err = ( __cuMemcpy2DUnaligned_v2)(pCopy) - return err -{{endif}} - -{{if 'cuMemcpy3D_v2' in found_functions}} - -cdef CUresult _cuMemcpy3D_v2(const CUDA_MEMCPY3D* pCopy) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemcpy3D_v2 - cuPythonInit() - if __cuMemcpy3D_v2 == NULL: - with gil: - raise RuntimeError('Function "cuMemcpy3D_v2" not found') - err = ( __cuMemcpy3D_v2)(pCopy) - return err -{{endif}} - -{{if 'cuMemcpy3DPeer' in found_functions}} - -cdef CUresult _cuMemcpy3DPeer(const CUDA_MEMCPY3D_PEER* pCopy) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemcpy3DPeer - cuPythonInit() - if __cuMemcpy3DPeer == NULL: - with gil: - raise RuntimeError('Function "cuMemcpy3DPeer" not found') - err = ( __cuMemcpy3DPeer)(pCopy) - return err -{{endif}} - -{{if 'cuMemcpyAsync' in found_functions}} - -cdef CUresult _cuMemcpyAsync(CUdeviceptr dst, CUdeviceptr src, size_t ByteCount, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemcpyAsync - cuPythonInit() - if __cuMemcpyAsync == NULL: - with gil: - raise RuntimeError('Function "cuMemcpyAsync" not found') - err = ( __cuMemcpyAsync)(dst, src, ByteCount, hStream) - return err -{{endif}} - -{{if 'cuMemcpyPeerAsync' in found_functions}} - -cdef CUresult _cuMemcpyPeerAsync(CUdeviceptr dstDevice, CUcontext dstContext, CUdeviceptr srcDevice, CUcontext srcContext, size_t ByteCount, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemcpyPeerAsync - cuPythonInit() - if __cuMemcpyPeerAsync == NULL: - with gil: - raise RuntimeError('Function "cuMemcpyPeerAsync" not found') - err = ( __cuMemcpyPeerAsync)(dstDevice, dstContext, srcDevice, srcContext, ByteCount, hStream) - return err -{{endif}} - -{{if 'cuMemcpyHtoDAsync_v2' in found_functions}} - -cdef CUresult _cuMemcpyHtoDAsync_v2(CUdeviceptr dstDevice, const void* srcHost, size_t ByteCount, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemcpyHtoDAsync_v2 - cuPythonInit() - if __cuMemcpyHtoDAsync_v2 == NULL: - with gil: - raise RuntimeError('Function "cuMemcpyHtoDAsync_v2" not found') - err = ( __cuMemcpyHtoDAsync_v2)(dstDevice, srcHost, ByteCount, hStream) - return err -{{endif}} - -{{if 'cuMemcpyDtoHAsync_v2' in found_functions}} - -cdef CUresult _cuMemcpyDtoHAsync_v2(void* dstHost, CUdeviceptr srcDevice, size_t ByteCount, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemcpyDtoHAsync_v2 - cuPythonInit() - if __cuMemcpyDtoHAsync_v2 == NULL: - with gil: - raise RuntimeError('Function "cuMemcpyDtoHAsync_v2" not found') - err = ( __cuMemcpyDtoHAsync_v2)(dstHost, srcDevice, ByteCount, hStream) - return err -{{endif}} - -{{if 'cuMemcpyDtoDAsync_v2' in found_functions}} - -cdef CUresult _cuMemcpyDtoDAsync_v2(CUdeviceptr dstDevice, CUdeviceptr srcDevice, size_t ByteCount, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemcpyDtoDAsync_v2 - cuPythonInit() - if __cuMemcpyDtoDAsync_v2 == NULL: - with gil: - raise RuntimeError('Function "cuMemcpyDtoDAsync_v2" not found') - err = ( __cuMemcpyDtoDAsync_v2)(dstDevice, srcDevice, ByteCount, hStream) - return err -{{endif}} - -{{if 'cuMemcpyHtoAAsync_v2' in found_functions}} - -cdef CUresult _cuMemcpyHtoAAsync_v2(CUarray dstArray, size_t dstOffset, const void* srcHost, size_t ByteCount, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemcpyHtoAAsync_v2 - cuPythonInit() - if __cuMemcpyHtoAAsync_v2 == NULL: - with gil: - raise RuntimeError('Function "cuMemcpyHtoAAsync_v2" not found') - err = ( __cuMemcpyHtoAAsync_v2)(dstArray, dstOffset, srcHost, ByteCount, hStream) - return err -{{endif}} - -{{if 'cuMemcpyAtoHAsync_v2' in found_functions}} - -cdef CUresult _cuMemcpyAtoHAsync_v2(void* dstHost, CUarray srcArray, size_t srcOffset, size_t ByteCount, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemcpyAtoHAsync_v2 - cuPythonInit() - if __cuMemcpyAtoHAsync_v2 == NULL: - with gil: - raise RuntimeError('Function "cuMemcpyAtoHAsync_v2" not found') - err = ( __cuMemcpyAtoHAsync_v2)(dstHost, srcArray, srcOffset, ByteCount, hStream) - return err -{{endif}} - -{{if 'cuMemcpy2DAsync_v2' in found_functions}} - -cdef CUresult _cuMemcpy2DAsync_v2(const CUDA_MEMCPY2D* pCopy, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemcpy2DAsync_v2 - cuPythonInit() - if __cuMemcpy2DAsync_v2 == NULL: - with gil: - raise RuntimeError('Function "cuMemcpy2DAsync_v2" not found') - err = ( __cuMemcpy2DAsync_v2)(pCopy, hStream) - return err -{{endif}} - -{{if 'cuMemcpy3DAsync_v2' in found_functions}} - -cdef CUresult _cuMemcpy3DAsync_v2(const CUDA_MEMCPY3D* pCopy, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemcpy3DAsync_v2 - cuPythonInit() - if __cuMemcpy3DAsync_v2 == NULL: - with gil: - raise RuntimeError('Function "cuMemcpy3DAsync_v2" not found') - err = ( __cuMemcpy3DAsync_v2)(pCopy, hStream) - return err -{{endif}} - -{{if 'cuMemcpy3DPeerAsync' in found_functions}} - -cdef CUresult _cuMemcpy3DPeerAsync(const CUDA_MEMCPY3D_PEER* pCopy, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemcpy3DPeerAsync - cuPythonInit() - if __cuMemcpy3DPeerAsync == NULL: - with gil: - raise RuntimeError('Function "cuMemcpy3DPeerAsync" not found') - err = ( __cuMemcpy3DPeerAsync)(pCopy, hStream) - return err -{{endif}} - -{{if 'cuMemsetD8_v2' in found_functions}} - -cdef CUresult _cuMemsetD8_v2(CUdeviceptr dstDevice, unsigned char uc, size_t N) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemsetD8_v2 - cuPythonInit() - if __cuMemsetD8_v2 == NULL: - with gil: - raise RuntimeError('Function "cuMemsetD8_v2" not found') - err = ( __cuMemsetD8_v2)(dstDevice, uc, N) - return err -{{endif}} - -{{if 'cuMemsetD16_v2' in found_functions}} - -cdef CUresult _cuMemsetD16_v2(CUdeviceptr dstDevice, unsigned short us, size_t N) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemsetD16_v2 - cuPythonInit() - if __cuMemsetD16_v2 == NULL: - with gil: - raise RuntimeError('Function "cuMemsetD16_v2" not found') - err = ( __cuMemsetD16_v2)(dstDevice, us, N) - return err -{{endif}} - -{{if 'cuMemsetD32_v2' in found_functions}} - -cdef CUresult _cuMemsetD32_v2(CUdeviceptr dstDevice, unsigned int ui, size_t N) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemsetD32_v2 - cuPythonInit() - if __cuMemsetD32_v2 == NULL: - with gil: - raise RuntimeError('Function "cuMemsetD32_v2" not found') - err = ( __cuMemsetD32_v2)(dstDevice, ui, N) - return err -{{endif}} - -{{if 'cuMemsetD2D8_v2' in found_functions}} - -cdef CUresult _cuMemsetD2D8_v2(CUdeviceptr dstDevice, size_t dstPitch, unsigned char uc, size_t Width, size_t Height) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemsetD2D8_v2 - cuPythonInit() - if __cuMemsetD2D8_v2 == NULL: - with gil: - raise RuntimeError('Function "cuMemsetD2D8_v2" not found') - err = ( __cuMemsetD2D8_v2)(dstDevice, dstPitch, uc, Width, Height) - return err -{{endif}} - -{{if 'cuMemsetD2D16_v2' in found_functions}} - -cdef CUresult _cuMemsetD2D16_v2(CUdeviceptr dstDevice, size_t dstPitch, unsigned short us, size_t Width, size_t Height) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemsetD2D16_v2 - cuPythonInit() - if __cuMemsetD2D16_v2 == NULL: - with gil: - raise RuntimeError('Function "cuMemsetD2D16_v2" not found') - err = ( __cuMemsetD2D16_v2)(dstDevice, dstPitch, us, Width, Height) - return err -{{endif}} - -{{if 'cuMemsetD2D32_v2' in found_functions}} - -cdef CUresult _cuMemsetD2D32_v2(CUdeviceptr dstDevice, size_t dstPitch, unsigned int ui, size_t Width, size_t Height) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemsetD2D32_v2 - cuPythonInit() - if __cuMemsetD2D32_v2 == NULL: - with gil: - raise RuntimeError('Function "cuMemsetD2D32_v2" not found') - err = ( __cuMemsetD2D32_v2)(dstDevice, dstPitch, ui, Width, Height) - return err -{{endif}} - -{{if 'cuMemsetD8Async' in found_functions}} - -cdef CUresult _cuMemsetD8Async(CUdeviceptr dstDevice, unsigned char uc, size_t N, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemsetD8Async - cuPythonInit() - if __cuMemsetD8Async == NULL: - with gil: - raise RuntimeError('Function "cuMemsetD8Async" not found') - err = ( __cuMemsetD8Async)(dstDevice, uc, N, hStream) - return err -{{endif}} - -{{if 'cuMemsetD16Async' in found_functions}} - -cdef CUresult _cuMemsetD16Async(CUdeviceptr dstDevice, unsigned short us, size_t N, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemsetD16Async - cuPythonInit() - if __cuMemsetD16Async == NULL: - with gil: - raise RuntimeError('Function "cuMemsetD16Async" not found') - err = ( __cuMemsetD16Async)(dstDevice, us, N, hStream) - return err -{{endif}} - -{{if 'cuMemsetD32Async' in found_functions}} - -cdef CUresult _cuMemsetD32Async(CUdeviceptr dstDevice, unsigned int ui, size_t N, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemsetD32Async - cuPythonInit() - if __cuMemsetD32Async == NULL: - with gil: - raise RuntimeError('Function "cuMemsetD32Async" not found') - err = ( __cuMemsetD32Async)(dstDevice, ui, N, hStream) - return err -{{endif}} - -{{if 'cuMemsetD2D8Async' in found_functions}} - -cdef CUresult _cuMemsetD2D8Async(CUdeviceptr dstDevice, size_t dstPitch, unsigned char uc, size_t Width, size_t Height, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemsetD2D8Async - cuPythonInit() - if __cuMemsetD2D8Async == NULL: - with gil: - raise RuntimeError('Function "cuMemsetD2D8Async" not found') - err = ( __cuMemsetD2D8Async)(dstDevice, dstPitch, uc, Width, Height, hStream) - return err -{{endif}} - -{{if 'cuMemsetD2D16Async' in found_functions}} - -cdef CUresult _cuMemsetD2D16Async(CUdeviceptr dstDevice, size_t dstPitch, unsigned short us, size_t Width, size_t Height, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemsetD2D16Async - cuPythonInit() - if __cuMemsetD2D16Async == NULL: - with gil: - raise RuntimeError('Function "cuMemsetD2D16Async" not found') - err = ( __cuMemsetD2D16Async)(dstDevice, dstPitch, us, Width, Height, hStream) - return err -{{endif}} - -{{if 'cuMemsetD2D32Async' in found_functions}} - -cdef CUresult _cuMemsetD2D32Async(CUdeviceptr dstDevice, size_t dstPitch, unsigned int ui, size_t Width, size_t Height, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemsetD2D32Async - cuPythonInit() - if __cuMemsetD2D32Async == NULL: - with gil: - raise RuntimeError('Function "cuMemsetD2D32Async" not found') - err = ( __cuMemsetD2D32Async)(dstDevice, dstPitch, ui, Width, Height, hStream) - return err -{{endif}} - -{{if 'cuArrayCreate_v2' in found_functions}} - -cdef CUresult _cuArrayCreate_v2(CUarray* pHandle, const CUDA_ARRAY_DESCRIPTOR* pAllocateArray) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuArrayCreate_v2 - cuPythonInit() - if __cuArrayCreate_v2 == NULL: - with gil: - raise RuntimeError('Function "cuArrayCreate_v2" not found') - err = ( __cuArrayCreate_v2)(pHandle, pAllocateArray) - return err -{{endif}} - -{{if 'cuArrayGetDescriptor_v2' in found_functions}} - -cdef CUresult _cuArrayGetDescriptor_v2(CUDA_ARRAY_DESCRIPTOR* pArrayDescriptor, CUarray hArray) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuArrayGetDescriptor_v2 - cuPythonInit() - if __cuArrayGetDescriptor_v2 == NULL: - with gil: - raise RuntimeError('Function "cuArrayGetDescriptor_v2" not found') - err = ( __cuArrayGetDescriptor_v2)(pArrayDescriptor, hArray) - return err -{{endif}} - -{{if 'cuArrayGetSparseProperties' in found_functions}} - -cdef CUresult _cuArrayGetSparseProperties(CUDA_ARRAY_SPARSE_PROPERTIES* sparseProperties, CUarray array) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuArrayGetSparseProperties - cuPythonInit() - if __cuArrayGetSparseProperties == NULL: - with gil: - raise RuntimeError('Function "cuArrayGetSparseProperties" not found') - err = ( __cuArrayGetSparseProperties)(sparseProperties, array) - return err -{{endif}} - -{{if 'cuMipmappedArrayGetSparseProperties' in found_functions}} - -cdef CUresult _cuMipmappedArrayGetSparseProperties(CUDA_ARRAY_SPARSE_PROPERTIES* sparseProperties, CUmipmappedArray mipmap) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMipmappedArrayGetSparseProperties - cuPythonInit() - if __cuMipmappedArrayGetSparseProperties == NULL: - with gil: - raise RuntimeError('Function "cuMipmappedArrayGetSparseProperties" not found') - err = ( __cuMipmappedArrayGetSparseProperties)(sparseProperties, mipmap) - return err -{{endif}} - -{{if 'cuArrayGetMemoryRequirements' in found_functions}} - -cdef CUresult _cuArrayGetMemoryRequirements(CUDA_ARRAY_MEMORY_REQUIREMENTS* memoryRequirements, CUarray array, CUdevice device) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuArrayGetMemoryRequirements - cuPythonInit() - if __cuArrayGetMemoryRequirements == NULL: - with gil: - raise RuntimeError('Function "cuArrayGetMemoryRequirements" not found') - err = ( __cuArrayGetMemoryRequirements)(memoryRequirements, array, device) - return err -{{endif}} - -{{if 'cuMipmappedArrayGetMemoryRequirements' in found_functions}} - -cdef CUresult _cuMipmappedArrayGetMemoryRequirements(CUDA_ARRAY_MEMORY_REQUIREMENTS* memoryRequirements, CUmipmappedArray mipmap, CUdevice device) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMipmappedArrayGetMemoryRequirements - cuPythonInit() - if __cuMipmappedArrayGetMemoryRequirements == NULL: - with gil: - raise RuntimeError('Function "cuMipmappedArrayGetMemoryRequirements" not found') - err = ( __cuMipmappedArrayGetMemoryRequirements)(memoryRequirements, mipmap, device) - return err -{{endif}} - -{{if 'cuArrayGetPlane' in found_functions}} - -cdef CUresult _cuArrayGetPlane(CUarray* pPlaneArray, CUarray hArray, unsigned int planeIdx) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuArrayGetPlane - cuPythonInit() - if __cuArrayGetPlane == NULL: - with gil: - raise RuntimeError('Function "cuArrayGetPlane" not found') - err = ( __cuArrayGetPlane)(pPlaneArray, hArray, planeIdx) - return err -{{endif}} - -{{if 'cuArrayDestroy' in found_functions}} - -cdef CUresult _cuArrayDestroy(CUarray hArray) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuArrayDestroy - cuPythonInit() - if __cuArrayDestroy == NULL: - with gil: - raise RuntimeError('Function "cuArrayDestroy" not found') - err = ( __cuArrayDestroy)(hArray) - return err -{{endif}} - -{{if 'cuArray3DCreate_v2' in found_functions}} - -cdef CUresult _cuArray3DCreate_v2(CUarray* pHandle, const CUDA_ARRAY3D_DESCRIPTOR* pAllocateArray) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuArray3DCreate_v2 - cuPythonInit() - if __cuArray3DCreate_v2 == NULL: - with gil: - raise RuntimeError('Function "cuArray3DCreate_v2" not found') - err = ( __cuArray3DCreate_v2)(pHandle, pAllocateArray) - return err -{{endif}} - -{{if 'cuArray3DGetDescriptor_v2' in found_functions}} - -cdef CUresult _cuArray3DGetDescriptor_v2(CUDA_ARRAY3D_DESCRIPTOR* pArrayDescriptor, CUarray hArray) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuArray3DGetDescriptor_v2 - cuPythonInit() - if __cuArray3DGetDescriptor_v2 == NULL: - with gil: - raise RuntimeError('Function "cuArray3DGetDescriptor_v2" not found') - err = ( __cuArray3DGetDescriptor_v2)(pArrayDescriptor, hArray) - return err -{{endif}} - -{{if 'cuMipmappedArrayCreate' in found_functions}} - -cdef CUresult _cuMipmappedArrayCreate(CUmipmappedArray* pHandle, const CUDA_ARRAY3D_DESCRIPTOR* pMipmappedArrayDesc, unsigned int numMipmapLevels) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMipmappedArrayCreate - cuPythonInit() - if __cuMipmappedArrayCreate == NULL: - with gil: - raise RuntimeError('Function "cuMipmappedArrayCreate" not found') - err = ( __cuMipmappedArrayCreate)(pHandle, pMipmappedArrayDesc, numMipmapLevels) - return err -{{endif}} - -{{if 'cuMipmappedArrayGetLevel' in found_functions}} - -cdef CUresult _cuMipmappedArrayGetLevel(CUarray* pLevelArray, CUmipmappedArray hMipmappedArray, unsigned int level) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMipmappedArrayGetLevel - cuPythonInit() - if __cuMipmappedArrayGetLevel == NULL: - with gil: - raise RuntimeError('Function "cuMipmappedArrayGetLevel" not found') - err = ( __cuMipmappedArrayGetLevel)(pLevelArray, hMipmappedArray, level) - return err -{{endif}} - -{{if 'cuMipmappedArrayDestroy' in found_functions}} - -cdef CUresult _cuMipmappedArrayDestroy(CUmipmappedArray hMipmappedArray) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMipmappedArrayDestroy - cuPythonInit() - if __cuMipmappedArrayDestroy == NULL: - with gil: - raise RuntimeError('Function "cuMipmappedArrayDestroy" not found') - err = ( __cuMipmappedArrayDestroy)(hMipmappedArray) - return err -{{endif}} - -{{if 'cuMemGetHandleForAddressRange' in found_functions}} - -cdef CUresult _cuMemGetHandleForAddressRange(void* handle, CUdeviceptr dptr, size_t size, CUmemRangeHandleType handleType, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemGetHandleForAddressRange - cuPythonInit() - if __cuMemGetHandleForAddressRange == NULL: - with gil: - raise RuntimeError('Function "cuMemGetHandleForAddressRange" not found') - err = ( __cuMemGetHandleForAddressRange)(handle, dptr, size, handleType, flags) - return err -{{endif}} - -{{if 'cuMemAddressReserve' in found_functions}} - -cdef CUresult _cuMemAddressReserve(CUdeviceptr* ptr, size_t size, size_t alignment, CUdeviceptr addr, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemAddressReserve - cuPythonInit() - if __cuMemAddressReserve == NULL: - with gil: - raise RuntimeError('Function "cuMemAddressReserve" not found') - err = ( __cuMemAddressReserve)(ptr, size, alignment, addr, flags) - return err -{{endif}} - -{{if 'cuMemAddressFree' in found_functions}} - -cdef CUresult _cuMemAddressFree(CUdeviceptr ptr, size_t size) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemAddressFree - cuPythonInit() - if __cuMemAddressFree == NULL: - with gil: - raise RuntimeError('Function "cuMemAddressFree" not found') - err = ( __cuMemAddressFree)(ptr, size) - return err -{{endif}} - -{{if 'cuMemCreate' in found_functions}} - -cdef CUresult _cuMemCreate(CUmemGenericAllocationHandle* handle, size_t size, const CUmemAllocationProp* prop, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemCreate - cuPythonInit() - if __cuMemCreate == NULL: - with gil: - raise RuntimeError('Function "cuMemCreate" not found') - err = ( __cuMemCreate)(handle, size, prop, flags) - return err -{{endif}} - -{{if 'cuMemRelease' in found_functions}} - -cdef CUresult _cuMemRelease(CUmemGenericAllocationHandle handle) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemRelease - cuPythonInit() - if __cuMemRelease == NULL: - with gil: - raise RuntimeError('Function "cuMemRelease" not found') - err = ( __cuMemRelease)(handle) - return err -{{endif}} - -{{if 'cuMemMap' in found_functions}} - -cdef CUresult _cuMemMap(CUdeviceptr ptr, size_t size, size_t offset, CUmemGenericAllocationHandle handle, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemMap - cuPythonInit() - if __cuMemMap == NULL: - with gil: - raise RuntimeError('Function "cuMemMap" not found') - err = ( __cuMemMap)(ptr, size, offset, handle, flags) - return err -{{endif}} - -{{if 'cuMemMapArrayAsync' in found_functions}} - -cdef CUresult _cuMemMapArrayAsync(CUarrayMapInfo* mapInfoList, unsigned int count, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemMapArrayAsync - cuPythonInit() - if __cuMemMapArrayAsync == NULL: - with gil: - raise RuntimeError('Function "cuMemMapArrayAsync" not found') - err = ( __cuMemMapArrayAsync)(mapInfoList, count, hStream) - return err -{{endif}} - -{{if 'cuMemUnmap' in found_functions}} - -cdef CUresult _cuMemUnmap(CUdeviceptr ptr, size_t size) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemUnmap - cuPythonInit() - if __cuMemUnmap == NULL: - with gil: - raise RuntimeError('Function "cuMemUnmap" not found') - err = ( __cuMemUnmap)(ptr, size) - return err -{{endif}} - -{{if 'cuMemSetAccess' in found_functions}} - -cdef CUresult _cuMemSetAccess(CUdeviceptr ptr, size_t size, const CUmemAccessDesc* desc, size_t count) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemSetAccess - cuPythonInit() - if __cuMemSetAccess == NULL: - with gil: - raise RuntimeError('Function "cuMemSetAccess" not found') - err = ( __cuMemSetAccess)(ptr, size, desc, count) - return err -{{endif}} - -{{if 'cuMemGetAccess' in found_functions}} - -cdef CUresult _cuMemGetAccess(unsigned long long* flags, const CUmemLocation* location, CUdeviceptr ptr) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemGetAccess - cuPythonInit() - if __cuMemGetAccess == NULL: - with gil: - raise RuntimeError('Function "cuMemGetAccess" not found') - err = ( __cuMemGetAccess)(flags, location, ptr) - return err -{{endif}} - -{{if 'cuMemExportToShareableHandle' in found_functions}} - -cdef CUresult _cuMemExportToShareableHandle(void* shareableHandle, CUmemGenericAllocationHandle handle, CUmemAllocationHandleType handleType, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemExportToShareableHandle - cuPythonInit() - if __cuMemExportToShareableHandle == NULL: - with gil: - raise RuntimeError('Function "cuMemExportToShareableHandle" not found') - err = ( __cuMemExportToShareableHandle)(shareableHandle, handle, handleType, flags) - return err -{{endif}} - -{{if 'cuMemImportFromShareableHandle' in found_functions}} - -cdef CUresult _cuMemImportFromShareableHandle(CUmemGenericAllocationHandle* handle, void* osHandle, CUmemAllocationHandleType shHandleType) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemImportFromShareableHandle - cuPythonInit() - if __cuMemImportFromShareableHandle == NULL: - with gil: - raise RuntimeError('Function "cuMemImportFromShareableHandle" not found') - err = ( __cuMemImportFromShareableHandle)(handle, osHandle, shHandleType) - return err -{{endif}} - -{{if 'cuMemGetAllocationGranularity' in found_functions}} - -cdef CUresult _cuMemGetAllocationGranularity(size_t* granularity, const CUmemAllocationProp* prop, CUmemAllocationGranularity_flags option) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemGetAllocationGranularity - cuPythonInit() - if __cuMemGetAllocationGranularity == NULL: - with gil: - raise RuntimeError('Function "cuMemGetAllocationGranularity" not found') - err = ( __cuMemGetAllocationGranularity)(granularity, prop, option) - return err -{{endif}} - -{{if 'cuMemGetAllocationPropertiesFromHandle' in found_functions}} - -cdef CUresult _cuMemGetAllocationPropertiesFromHandle(CUmemAllocationProp* prop, CUmemGenericAllocationHandle handle) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemGetAllocationPropertiesFromHandle - cuPythonInit() - if __cuMemGetAllocationPropertiesFromHandle == NULL: - with gil: - raise RuntimeError('Function "cuMemGetAllocationPropertiesFromHandle" not found') - err = ( __cuMemGetAllocationPropertiesFromHandle)(prop, handle) - return err -{{endif}} - -{{if 'cuMemRetainAllocationHandle' in found_functions}} - -cdef CUresult _cuMemRetainAllocationHandle(CUmemGenericAllocationHandle* handle, void* addr) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemRetainAllocationHandle - cuPythonInit() - if __cuMemRetainAllocationHandle == NULL: - with gil: - raise RuntimeError('Function "cuMemRetainAllocationHandle" not found') - err = ( __cuMemRetainAllocationHandle)(handle, addr) - return err -{{endif}} - -{{if 'cuMemFreeAsync' in found_functions}} - -cdef CUresult _cuMemFreeAsync(CUdeviceptr dptr, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemFreeAsync - cuPythonInit() - if __cuMemFreeAsync == NULL: - with gil: - raise RuntimeError('Function "cuMemFreeAsync" not found') - err = ( __cuMemFreeAsync)(dptr, hStream) - return err -{{endif}} - -{{if 'cuMemAllocAsync' in found_functions}} - -cdef CUresult _cuMemAllocAsync(CUdeviceptr* dptr, size_t bytesize, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemAllocAsync - cuPythonInit() - if __cuMemAllocAsync == NULL: - with gil: - raise RuntimeError('Function "cuMemAllocAsync" not found') - err = ( __cuMemAllocAsync)(dptr, bytesize, hStream) - return err -{{endif}} - -{{if 'cuMemPoolTrimTo' in found_functions}} - -cdef CUresult _cuMemPoolTrimTo(CUmemoryPool pool, size_t minBytesToKeep) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemPoolTrimTo - cuPythonInit() - if __cuMemPoolTrimTo == NULL: - with gil: - raise RuntimeError('Function "cuMemPoolTrimTo" not found') - err = ( __cuMemPoolTrimTo)(pool, minBytesToKeep) - return err -{{endif}} - -{{if 'cuMemPoolSetAttribute' in found_functions}} - -cdef CUresult _cuMemPoolSetAttribute(CUmemoryPool pool, CUmemPool_attribute attr, void* value) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemPoolSetAttribute - cuPythonInit() - if __cuMemPoolSetAttribute == NULL: - with gil: - raise RuntimeError('Function "cuMemPoolSetAttribute" not found') - err = ( __cuMemPoolSetAttribute)(pool, attr, value) - return err -{{endif}} - -{{if 'cuMemPoolGetAttribute' in found_functions}} - -cdef CUresult _cuMemPoolGetAttribute(CUmemoryPool pool, CUmemPool_attribute attr, void* value) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemPoolGetAttribute - cuPythonInit() - if __cuMemPoolGetAttribute == NULL: - with gil: - raise RuntimeError('Function "cuMemPoolGetAttribute" not found') - err = ( __cuMemPoolGetAttribute)(pool, attr, value) - return err -{{endif}} - -{{if 'cuMemPoolSetAccess' in found_functions}} - -cdef CUresult _cuMemPoolSetAccess(CUmemoryPool pool, const CUmemAccessDesc* map, size_t count) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemPoolSetAccess - cuPythonInit() - if __cuMemPoolSetAccess == NULL: - with gil: - raise RuntimeError('Function "cuMemPoolSetAccess" not found') - err = ( __cuMemPoolSetAccess)(pool, map, count) - return err -{{endif}} - -{{if 'cuMemPoolGetAccess' in found_functions}} - -cdef CUresult _cuMemPoolGetAccess(CUmemAccess_flags* flags, CUmemoryPool memPool, CUmemLocation* location) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemPoolGetAccess - cuPythonInit() - if __cuMemPoolGetAccess == NULL: - with gil: - raise RuntimeError('Function "cuMemPoolGetAccess" not found') - err = ( __cuMemPoolGetAccess)(flags, memPool, location) - return err -{{endif}} - -{{if 'cuMemPoolCreate' in found_functions}} - -cdef CUresult _cuMemPoolCreate(CUmemoryPool* pool, const CUmemPoolProps* poolProps) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemPoolCreate - cuPythonInit() - if __cuMemPoolCreate == NULL: - with gil: - raise RuntimeError('Function "cuMemPoolCreate" not found') - err = ( __cuMemPoolCreate)(pool, poolProps) - return err -{{endif}} - -{{if 'cuMemPoolDestroy' in found_functions}} - -cdef CUresult _cuMemPoolDestroy(CUmemoryPool pool) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemPoolDestroy - cuPythonInit() - if __cuMemPoolDestroy == NULL: - with gil: - raise RuntimeError('Function "cuMemPoolDestroy" not found') - err = ( __cuMemPoolDestroy)(pool) - return err -{{endif}} - -{{if 'cuMemAllocFromPoolAsync' in found_functions}} - -cdef CUresult _cuMemAllocFromPoolAsync(CUdeviceptr* dptr, size_t bytesize, CUmemoryPool pool, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemAllocFromPoolAsync - cuPythonInit() - if __cuMemAllocFromPoolAsync == NULL: - with gil: - raise RuntimeError('Function "cuMemAllocFromPoolAsync" not found') - err = ( __cuMemAllocFromPoolAsync)(dptr, bytesize, pool, hStream) - return err -{{endif}} - -{{if 'cuMemPoolExportToShareableHandle' in found_functions}} - -cdef CUresult _cuMemPoolExportToShareableHandle(void* handle_out, CUmemoryPool pool, CUmemAllocationHandleType handleType, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemPoolExportToShareableHandle - cuPythonInit() - if __cuMemPoolExportToShareableHandle == NULL: - with gil: - raise RuntimeError('Function "cuMemPoolExportToShareableHandle" not found') - err = ( __cuMemPoolExportToShareableHandle)(handle_out, pool, handleType, flags) - return err -{{endif}} - -{{if 'cuMemPoolImportFromShareableHandle' in found_functions}} - -cdef CUresult _cuMemPoolImportFromShareableHandle(CUmemoryPool* pool_out, void* handle, CUmemAllocationHandleType handleType, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemPoolImportFromShareableHandle - cuPythonInit() - if __cuMemPoolImportFromShareableHandle == NULL: - with gil: - raise RuntimeError('Function "cuMemPoolImportFromShareableHandle" not found') - err = ( __cuMemPoolImportFromShareableHandle)(pool_out, handle, handleType, flags) - return err -{{endif}} - -{{if 'cuMemPoolExportPointer' in found_functions}} - -cdef CUresult _cuMemPoolExportPointer(CUmemPoolPtrExportData* shareData_out, CUdeviceptr ptr) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemPoolExportPointer - cuPythonInit() - if __cuMemPoolExportPointer == NULL: - with gil: - raise RuntimeError('Function "cuMemPoolExportPointer" not found') - err = ( __cuMemPoolExportPointer)(shareData_out, ptr) - return err -{{endif}} - -{{if 'cuMemPoolImportPointer' in found_functions}} - -cdef CUresult _cuMemPoolImportPointer(CUdeviceptr* ptr_out, CUmemoryPool pool, CUmemPoolPtrExportData* shareData) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemPoolImportPointer - cuPythonInit() - if __cuMemPoolImportPointer == NULL: - with gil: - raise RuntimeError('Function "cuMemPoolImportPointer" not found') - err = ( __cuMemPoolImportPointer)(ptr_out, pool, shareData) - return err -{{endif}} - -{{if 'cuMulticastCreate' in found_functions}} - -cdef CUresult _cuMulticastCreate(CUmemGenericAllocationHandle* mcHandle, const CUmulticastObjectProp* prop) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMulticastCreate - cuPythonInit() - if __cuMulticastCreate == NULL: - with gil: - raise RuntimeError('Function "cuMulticastCreate" not found') - err = ( __cuMulticastCreate)(mcHandle, prop) - return err -{{endif}} - -{{if 'cuMulticastAddDevice' in found_functions}} - -cdef CUresult _cuMulticastAddDevice(CUmemGenericAllocationHandle mcHandle, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMulticastAddDevice - cuPythonInit() - if __cuMulticastAddDevice == NULL: - with gil: - raise RuntimeError('Function "cuMulticastAddDevice" not found') - err = ( __cuMulticastAddDevice)(mcHandle, dev) - return err -{{endif}} - -{{if 'cuMulticastBindMem' in found_functions}} - -cdef CUresult _cuMulticastBindMem(CUmemGenericAllocationHandle mcHandle, size_t mcOffset, CUmemGenericAllocationHandle memHandle, size_t memOffset, size_t size, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMulticastBindMem - cuPythonInit() - if __cuMulticastBindMem == NULL: - with gil: - raise RuntimeError('Function "cuMulticastBindMem" not found') - err = ( __cuMulticastBindMem)(mcHandle, mcOffset, memHandle, memOffset, size, flags) - return err -{{endif}} - -{{if 'cuMulticastBindAddr' in found_functions}} - -cdef CUresult _cuMulticastBindAddr(CUmemGenericAllocationHandle mcHandle, size_t mcOffset, CUdeviceptr memptr, size_t size, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMulticastBindAddr - cuPythonInit() - if __cuMulticastBindAddr == NULL: - with gil: - raise RuntimeError('Function "cuMulticastBindAddr" not found') - err = ( __cuMulticastBindAddr)(mcHandle, mcOffset, memptr, size, flags) - return err -{{endif}} - -{{if 'cuMulticastUnbind' in found_functions}} - -cdef CUresult _cuMulticastUnbind(CUmemGenericAllocationHandle mcHandle, CUdevice dev, size_t mcOffset, size_t size) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMulticastUnbind - cuPythonInit() - if __cuMulticastUnbind == NULL: - with gil: - raise RuntimeError('Function "cuMulticastUnbind" not found') - err = ( __cuMulticastUnbind)(mcHandle, dev, mcOffset, size) - return err -{{endif}} - -{{if 'cuMulticastGetGranularity' in found_functions}} - -cdef CUresult _cuMulticastGetGranularity(size_t* granularity, const CUmulticastObjectProp* prop, CUmulticastGranularity_flags option) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMulticastGetGranularity - cuPythonInit() - if __cuMulticastGetGranularity == NULL: - with gil: - raise RuntimeError('Function "cuMulticastGetGranularity" not found') - err = ( __cuMulticastGetGranularity)(granularity, prop, option) - return err -{{endif}} - -{{if 'cuPointerGetAttribute' in found_functions}} - -cdef CUresult _cuPointerGetAttribute(void* data, CUpointer_attribute attribute, CUdeviceptr ptr) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuPointerGetAttribute - cuPythonInit() - if __cuPointerGetAttribute == NULL: - with gil: - raise RuntimeError('Function "cuPointerGetAttribute" not found') - err = ( __cuPointerGetAttribute)(data, attribute, ptr) - return err -{{endif}} - -{{if 'cuMemPrefetchAsync' in found_functions}} - -cdef CUresult _cuMemPrefetchAsync(CUdeviceptr devPtr, size_t count, CUdevice dstDevice, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemPrefetchAsync - cuPythonInit() - if __cuMemPrefetchAsync == NULL: - with gil: - raise RuntimeError('Function "cuMemPrefetchAsync" not found') - err = ( __cuMemPrefetchAsync)(devPtr, count, dstDevice, hStream) - return err -{{endif}} - -{{if 'cuMemPrefetchAsync_v2' in found_functions}} - -cdef CUresult _cuMemPrefetchAsync_v2(CUdeviceptr devPtr, size_t count, CUmemLocation location, unsigned int flags, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemPrefetchAsync_v2 - cuPythonInit() - if __cuMemPrefetchAsync_v2 == NULL: - with gil: - raise RuntimeError('Function "cuMemPrefetchAsync_v2" not found') - err = ( __cuMemPrefetchAsync_v2)(devPtr, count, location, flags, hStream) - return err -{{endif}} - -{{if 'cuMemAdvise' in found_functions}} - -cdef CUresult _cuMemAdvise(CUdeviceptr devPtr, size_t count, CUmem_advise advice, CUdevice device) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemAdvise - cuPythonInit() - if __cuMemAdvise == NULL: - with gil: - raise RuntimeError('Function "cuMemAdvise" not found') - err = ( __cuMemAdvise)(devPtr, count, advice, device) - return err -{{endif}} - -{{if 'cuMemAdvise_v2' in found_functions}} - -cdef CUresult _cuMemAdvise_v2(CUdeviceptr devPtr, size_t count, CUmem_advise advice, CUmemLocation location) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemAdvise_v2 - cuPythonInit() - if __cuMemAdvise_v2 == NULL: - with gil: - raise RuntimeError('Function "cuMemAdvise_v2" not found') - err = ( __cuMemAdvise_v2)(devPtr, count, advice, location) - return err -{{endif}} - -{{if 'cuMemRangeGetAttribute' in found_functions}} - -cdef CUresult _cuMemRangeGetAttribute(void* data, size_t dataSize, CUmem_range_attribute attribute, CUdeviceptr devPtr, size_t count) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemRangeGetAttribute - cuPythonInit() - if __cuMemRangeGetAttribute == NULL: - with gil: - raise RuntimeError('Function "cuMemRangeGetAttribute" not found') - err = ( __cuMemRangeGetAttribute)(data, dataSize, attribute, devPtr, count) - return err -{{endif}} - -{{if 'cuMemRangeGetAttributes' in found_functions}} - -cdef CUresult _cuMemRangeGetAttributes(void** data, size_t* dataSizes, CUmem_range_attribute* attributes, size_t numAttributes, CUdeviceptr devPtr, size_t count) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuMemRangeGetAttributes - cuPythonInit() - if __cuMemRangeGetAttributes == NULL: - with gil: - raise RuntimeError('Function "cuMemRangeGetAttributes" not found') - err = ( __cuMemRangeGetAttributes)(data, dataSizes, attributes, numAttributes, devPtr, count) - return err -{{endif}} - -{{if 'cuPointerSetAttribute' in found_functions}} - -cdef CUresult _cuPointerSetAttribute(const void* value, CUpointer_attribute attribute, CUdeviceptr ptr) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuPointerSetAttribute - cuPythonInit() - if __cuPointerSetAttribute == NULL: - with gil: - raise RuntimeError('Function "cuPointerSetAttribute" not found') - err = ( __cuPointerSetAttribute)(value, attribute, ptr) - return err -{{endif}} - -{{if 'cuPointerGetAttributes' in found_functions}} - -cdef CUresult _cuPointerGetAttributes(unsigned int numAttributes, CUpointer_attribute* attributes, void** data, CUdeviceptr ptr) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuPointerGetAttributes - cuPythonInit() - if __cuPointerGetAttributes == NULL: - with gil: - raise RuntimeError('Function "cuPointerGetAttributes" not found') - err = ( __cuPointerGetAttributes)(numAttributes, attributes, data, ptr) - return err -{{endif}} - -{{if 'cuStreamCreate' in found_functions}} - -cdef CUresult _cuStreamCreate(CUstream* phStream, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuStreamCreate - cuPythonInit() - if __cuStreamCreate == NULL: - with gil: - raise RuntimeError('Function "cuStreamCreate" not found') - err = ( __cuStreamCreate)(phStream, Flags) - return err -{{endif}} - -{{if 'cuStreamCreateWithPriority' in found_functions}} - -cdef CUresult _cuStreamCreateWithPriority(CUstream* phStream, unsigned int flags, int priority) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuStreamCreateWithPriority - cuPythonInit() - if __cuStreamCreateWithPriority == NULL: - with gil: - raise RuntimeError('Function "cuStreamCreateWithPriority" not found') - err = ( __cuStreamCreateWithPriority)(phStream, flags, priority) - return err -{{endif}} - -{{if 'cuStreamGetPriority' in found_functions}} - -cdef CUresult _cuStreamGetPriority(CUstream hStream, int* priority) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuStreamGetPriority - cuPythonInit() - if __cuStreamGetPriority == NULL: - with gil: - raise RuntimeError('Function "cuStreamGetPriority" not found') - err = ( __cuStreamGetPriority)(hStream, priority) - return err -{{endif}} - -{{if 'cuStreamGetFlags' in found_functions}} - -cdef CUresult _cuStreamGetFlags(CUstream hStream, unsigned int* flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuStreamGetFlags - cuPythonInit() - if __cuStreamGetFlags == NULL: - with gil: - raise RuntimeError('Function "cuStreamGetFlags" not found') - err = ( __cuStreamGetFlags)(hStream, flags) - return err -{{endif}} - -{{if 'cuStreamGetId' in found_functions}} - -cdef CUresult _cuStreamGetId(CUstream hStream, unsigned long long* streamId) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuStreamGetId - cuPythonInit() - if __cuStreamGetId == NULL: - with gil: - raise RuntimeError('Function "cuStreamGetId" not found') - err = ( __cuStreamGetId)(hStream, streamId) - return err -{{endif}} - -{{if 'cuStreamGetCtx' in found_functions}} - -cdef CUresult _cuStreamGetCtx(CUstream hStream, CUcontext* pctx) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuStreamGetCtx - cuPythonInit() - if __cuStreamGetCtx == NULL: - with gil: - raise RuntimeError('Function "cuStreamGetCtx" not found') - err = ( __cuStreamGetCtx)(hStream, pctx) - return err -{{endif}} - -{{if 'cuStreamGetCtx_v2' in found_functions}} - -cdef CUresult _cuStreamGetCtx_v2(CUstream hStream, CUcontext* pCtx, CUgreenCtx* pGreenCtx) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuStreamGetCtx_v2 - cuPythonInit() - if __cuStreamGetCtx_v2 == NULL: - with gil: - raise RuntimeError('Function "cuStreamGetCtx_v2" not found') - err = ( __cuStreamGetCtx_v2)(hStream, pCtx, pGreenCtx) - return err -{{endif}} - -{{if 'cuStreamWaitEvent' in found_functions}} - -cdef CUresult _cuStreamWaitEvent(CUstream hStream, CUevent hEvent, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuStreamWaitEvent - cuPythonInit() - if __cuStreamWaitEvent == NULL: - with gil: - raise RuntimeError('Function "cuStreamWaitEvent" not found') - err = ( __cuStreamWaitEvent)(hStream, hEvent, Flags) - return err -{{endif}} - -{{if 'cuStreamAddCallback' in found_functions}} - -cdef CUresult _cuStreamAddCallback(CUstream hStream, CUstreamCallback callback, void* userData, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuStreamAddCallback - cuPythonInit() - if __cuStreamAddCallback == NULL: - with gil: - raise RuntimeError('Function "cuStreamAddCallback" not found') - err = ( __cuStreamAddCallback)(hStream, callback, userData, flags) - return err -{{endif}} - -{{if 'cuStreamBeginCapture_v2' in found_functions}} - -cdef CUresult _cuStreamBeginCapture_v2(CUstream hStream, CUstreamCaptureMode mode) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuStreamBeginCapture_v2 - cuPythonInit() - if __cuStreamBeginCapture_v2 == NULL: - with gil: - raise RuntimeError('Function "cuStreamBeginCapture_v2" not found') - err = ( __cuStreamBeginCapture_v2)(hStream, mode) - return err -{{endif}} - -{{if 'cuStreamBeginCaptureToGraph' in found_functions}} - -cdef CUresult _cuStreamBeginCaptureToGraph(CUstream hStream, CUgraph hGraph, const CUgraphNode* dependencies, const CUgraphEdgeData* dependencyData, size_t numDependencies, CUstreamCaptureMode mode) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuStreamBeginCaptureToGraph - cuPythonInit() - if __cuStreamBeginCaptureToGraph == NULL: - with gil: - raise RuntimeError('Function "cuStreamBeginCaptureToGraph" not found') - err = ( __cuStreamBeginCaptureToGraph)(hStream, hGraph, dependencies, dependencyData, numDependencies, mode) - return err -{{endif}} - -{{if 'cuThreadExchangeStreamCaptureMode' in found_functions}} - -cdef CUresult _cuThreadExchangeStreamCaptureMode(CUstreamCaptureMode* mode) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuThreadExchangeStreamCaptureMode - cuPythonInit() - if __cuThreadExchangeStreamCaptureMode == NULL: - with gil: - raise RuntimeError('Function "cuThreadExchangeStreamCaptureMode" not found') - err = ( __cuThreadExchangeStreamCaptureMode)(mode) - return err -{{endif}} - -{{if 'cuStreamEndCapture' in found_functions}} - -cdef CUresult _cuStreamEndCapture(CUstream hStream, CUgraph* phGraph) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuStreamEndCapture - cuPythonInit() - if __cuStreamEndCapture == NULL: - with gil: - raise RuntimeError('Function "cuStreamEndCapture" not found') - err = ( __cuStreamEndCapture)(hStream, phGraph) - return err -{{endif}} - -{{if 'cuStreamIsCapturing' in found_functions}} - -cdef CUresult _cuStreamIsCapturing(CUstream hStream, CUstreamCaptureStatus* captureStatus) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuStreamIsCapturing - cuPythonInit() - if __cuStreamIsCapturing == NULL: - with gil: - raise RuntimeError('Function "cuStreamIsCapturing" not found') - err = ( __cuStreamIsCapturing)(hStream, captureStatus) - return err -{{endif}} - -{{if 'cuStreamGetCaptureInfo_v2' in found_functions}} - -cdef CUresult _cuStreamGetCaptureInfo_v2(CUstream hStream, CUstreamCaptureStatus* captureStatus_out, cuuint64_t* id_out, CUgraph* graph_out, const CUgraphNode** dependencies_out, size_t* numDependencies_out) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuStreamGetCaptureInfo_v2 - cuPythonInit() - if __cuStreamGetCaptureInfo_v2 == NULL: - with gil: - raise RuntimeError('Function "cuStreamGetCaptureInfo_v2" not found') - err = ( __cuStreamGetCaptureInfo_v2)(hStream, captureStatus_out, id_out, graph_out, dependencies_out, numDependencies_out) - return err -{{endif}} - -{{if 'cuStreamGetCaptureInfo_v3' in found_functions}} - -cdef CUresult _cuStreamGetCaptureInfo_v3(CUstream hStream, CUstreamCaptureStatus* captureStatus_out, cuuint64_t* id_out, CUgraph* graph_out, const CUgraphNode** dependencies_out, const CUgraphEdgeData** edgeData_out, size_t* numDependencies_out) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuStreamGetCaptureInfo_v3 - cuPythonInit() - if __cuStreamGetCaptureInfo_v3 == NULL: - with gil: - raise RuntimeError('Function "cuStreamGetCaptureInfo_v3" not found') - err = ( __cuStreamGetCaptureInfo_v3)(hStream, captureStatus_out, id_out, graph_out, dependencies_out, edgeData_out, numDependencies_out) - return err -{{endif}} - -{{if 'cuStreamUpdateCaptureDependencies' in found_functions}} - -cdef CUresult _cuStreamUpdateCaptureDependencies(CUstream hStream, CUgraphNode* dependencies, size_t numDependencies, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuStreamUpdateCaptureDependencies - cuPythonInit() - if __cuStreamUpdateCaptureDependencies == NULL: - with gil: - raise RuntimeError('Function "cuStreamUpdateCaptureDependencies" not found') - err = ( __cuStreamUpdateCaptureDependencies)(hStream, dependencies, numDependencies, flags) - return err -{{endif}} - -{{if 'cuStreamUpdateCaptureDependencies_v2' in found_functions}} - -cdef CUresult _cuStreamUpdateCaptureDependencies_v2(CUstream hStream, CUgraphNode* dependencies, const CUgraphEdgeData* dependencyData, size_t numDependencies, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuStreamUpdateCaptureDependencies_v2 - cuPythonInit() - if __cuStreamUpdateCaptureDependencies_v2 == NULL: - with gil: - raise RuntimeError('Function "cuStreamUpdateCaptureDependencies_v2" not found') - err = ( __cuStreamUpdateCaptureDependencies_v2)(hStream, dependencies, dependencyData, numDependencies, flags) - return err -{{endif}} - -{{if 'cuStreamAttachMemAsync' in found_functions}} - -cdef CUresult _cuStreamAttachMemAsync(CUstream hStream, CUdeviceptr dptr, size_t length, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuStreamAttachMemAsync - cuPythonInit() - if __cuStreamAttachMemAsync == NULL: - with gil: - raise RuntimeError('Function "cuStreamAttachMemAsync" not found') - err = ( __cuStreamAttachMemAsync)(hStream, dptr, length, flags) - return err -{{endif}} - -{{if 'cuStreamQuery' in found_functions}} - -cdef CUresult _cuStreamQuery(CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuStreamQuery - cuPythonInit() - if __cuStreamQuery == NULL: - with gil: - raise RuntimeError('Function "cuStreamQuery" not found') - err = ( __cuStreamQuery)(hStream) - return err -{{endif}} - -{{if 'cuStreamSynchronize' in found_functions}} - -cdef CUresult _cuStreamSynchronize(CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuStreamSynchronize - cuPythonInit() - if __cuStreamSynchronize == NULL: - with gil: - raise RuntimeError('Function "cuStreamSynchronize" not found') - err = ( __cuStreamSynchronize)(hStream) - return err -{{endif}} - -{{if 'cuStreamDestroy_v2' in found_functions}} - -cdef CUresult _cuStreamDestroy_v2(CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuStreamDestroy_v2 - cuPythonInit() - if __cuStreamDestroy_v2 == NULL: - with gil: - raise RuntimeError('Function "cuStreamDestroy_v2" not found') - err = ( __cuStreamDestroy_v2)(hStream) - return err -{{endif}} - -{{if 'cuStreamCopyAttributes' in found_functions}} - -cdef CUresult _cuStreamCopyAttributes(CUstream dst, CUstream src) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuStreamCopyAttributes - cuPythonInit() - if __cuStreamCopyAttributes == NULL: - with gil: - raise RuntimeError('Function "cuStreamCopyAttributes" not found') - err = ( __cuStreamCopyAttributes)(dst, src) - return err -{{endif}} - -{{if 'cuStreamGetAttribute' in found_functions}} - -cdef CUresult _cuStreamGetAttribute(CUstream hStream, CUstreamAttrID attr, CUstreamAttrValue* value_out) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuStreamGetAttribute - cuPythonInit() - if __cuStreamGetAttribute == NULL: - with gil: - raise RuntimeError('Function "cuStreamGetAttribute" not found') - err = ( __cuStreamGetAttribute)(hStream, attr, value_out) - return err -{{endif}} - -{{if 'cuStreamSetAttribute' in found_functions}} - -cdef CUresult _cuStreamSetAttribute(CUstream hStream, CUstreamAttrID attr, const CUstreamAttrValue* value) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuStreamSetAttribute - cuPythonInit() - if __cuStreamSetAttribute == NULL: - with gil: - raise RuntimeError('Function "cuStreamSetAttribute" not found') - err = ( __cuStreamSetAttribute)(hStream, attr, value) - return err -{{endif}} - -{{if 'cuEventCreate' in found_functions}} - -cdef CUresult _cuEventCreate(CUevent* phEvent, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuEventCreate - cuPythonInit() - if __cuEventCreate == NULL: - with gil: - raise RuntimeError('Function "cuEventCreate" not found') - err = ( __cuEventCreate)(phEvent, Flags) - return err -{{endif}} - -{{if 'cuEventRecord' in found_functions}} - -cdef CUresult _cuEventRecord(CUevent hEvent, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuEventRecord - cuPythonInit() - if __cuEventRecord == NULL: - with gil: - raise RuntimeError('Function "cuEventRecord" not found') - err = ( __cuEventRecord)(hEvent, hStream) - return err -{{endif}} - -{{if 'cuEventRecordWithFlags' in found_functions}} - -cdef CUresult _cuEventRecordWithFlags(CUevent hEvent, CUstream hStream, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuEventRecordWithFlags - cuPythonInit() - if __cuEventRecordWithFlags == NULL: - with gil: - raise RuntimeError('Function "cuEventRecordWithFlags" not found') - err = ( __cuEventRecordWithFlags)(hEvent, hStream, flags) - return err -{{endif}} - -{{if 'cuEventQuery' in found_functions}} - -cdef CUresult _cuEventQuery(CUevent hEvent) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuEventQuery - cuPythonInit() - if __cuEventQuery == NULL: - with gil: - raise RuntimeError('Function "cuEventQuery" not found') - err = ( __cuEventQuery)(hEvent) - return err -{{endif}} - -{{if 'cuEventSynchronize' in found_functions}} - -cdef CUresult _cuEventSynchronize(CUevent hEvent) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuEventSynchronize - cuPythonInit() - if __cuEventSynchronize == NULL: - with gil: - raise RuntimeError('Function "cuEventSynchronize" not found') - err = ( __cuEventSynchronize)(hEvent) - return err -{{endif}} - -{{if 'cuEventDestroy_v2' in found_functions}} - -cdef CUresult _cuEventDestroy_v2(CUevent hEvent) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuEventDestroy_v2 - cuPythonInit() - if __cuEventDestroy_v2 == NULL: - with gil: - raise RuntimeError('Function "cuEventDestroy_v2" not found') - err = ( __cuEventDestroy_v2)(hEvent) - return err -{{endif}} - -{{if 'cuEventElapsedTime' in found_functions}} - -cdef CUresult _cuEventElapsedTime(float* pMilliseconds, CUevent hStart, CUevent hEnd) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuEventElapsedTime - cuPythonInit() - if __cuEventElapsedTime == NULL: - with gil: - raise RuntimeError('Function "cuEventElapsedTime" not found') - err = ( __cuEventElapsedTime)(pMilliseconds, hStart, hEnd) - return err -{{endif}} - -{{if 'cuImportExternalMemory' in found_functions}} - -cdef CUresult _cuImportExternalMemory(CUexternalMemory* extMem_out, const CUDA_EXTERNAL_MEMORY_HANDLE_DESC* memHandleDesc) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuImportExternalMemory - cuPythonInit() - if __cuImportExternalMemory == NULL: - with gil: - raise RuntimeError('Function "cuImportExternalMemory" not found') - err = ( __cuImportExternalMemory)(extMem_out, memHandleDesc) - return err -{{endif}} - -{{if 'cuExternalMemoryGetMappedBuffer' in found_functions}} - -cdef CUresult _cuExternalMemoryGetMappedBuffer(CUdeviceptr* devPtr, CUexternalMemory extMem, const CUDA_EXTERNAL_MEMORY_BUFFER_DESC* bufferDesc) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuExternalMemoryGetMappedBuffer - cuPythonInit() - if __cuExternalMemoryGetMappedBuffer == NULL: - with gil: - raise RuntimeError('Function "cuExternalMemoryGetMappedBuffer" not found') - err = ( __cuExternalMemoryGetMappedBuffer)(devPtr, extMem, bufferDesc) - return err -{{endif}} - -{{if 'cuExternalMemoryGetMappedMipmappedArray' in found_functions}} - -cdef CUresult _cuExternalMemoryGetMappedMipmappedArray(CUmipmappedArray* mipmap, CUexternalMemory extMem, const CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC* mipmapDesc) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuExternalMemoryGetMappedMipmappedArray - cuPythonInit() - if __cuExternalMemoryGetMappedMipmappedArray == NULL: - with gil: - raise RuntimeError('Function "cuExternalMemoryGetMappedMipmappedArray" not found') - err = ( __cuExternalMemoryGetMappedMipmappedArray)(mipmap, extMem, mipmapDesc) - return err -{{endif}} - -{{if 'cuDestroyExternalMemory' in found_functions}} - -cdef CUresult _cuDestroyExternalMemory(CUexternalMemory extMem) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuDestroyExternalMemory - cuPythonInit() - if __cuDestroyExternalMemory == NULL: - with gil: - raise RuntimeError('Function "cuDestroyExternalMemory" not found') - err = ( __cuDestroyExternalMemory)(extMem) - return err -{{endif}} - -{{if 'cuImportExternalSemaphore' in found_functions}} - -cdef CUresult _cuImportExternalSemaphore(CUexternalSemaphore* extSem_out, const CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC* semHandleDesc) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuImportExternalSemaphore - cuPythonInit() - if __cuImportExternalSemaphore == NULL: - with gil: - raise RuntimeError('Function "cuImportExternalSemaphore" not found') - err = ( __cuImportExternalSemaphore)(extSem_out, semHandleDesc) - return err -{{endif}} - -{{if 'cuSignalExternalSemaphoresAsync' in found_functions}} - -cdef CUresult _cuSignalExternalSemaphoresAsync(const CUexternalSemaphore* extSemArray, const CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS* paramsArray, unsigned int numExtSems, CUstream stream) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuSignalExternalSemaphoresAsync - cuPythonInit() - if __cuSignalExternalSemaphoresAsync == NULL: - with gil: - raise RuntimeError('Function "cuSignalExternalSemaphoresAsync" not found') - err = ( __cuSignalExternalSemaphoresAsync)(extSemArray, paramsArray, numExtSems, stream) - return err -{{endif}} - -{{if 'cuWaitExternalSemaphoresAsync' in found_functions}} - -cdef CUresult _cuWaitExternalSemaphoresAsync(const CUexternalSemaphore* extSemArray, const CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS* paramsArray, unsigned int numExtSems, CUstream stream) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuWaitExternalSemaphoresAsync - cuPythonInit() - if __cuWaitExternalSemaphoresAsync == NULL: - with gil: - raise RuntimeError('Function "cuWaitExternalSemaphoresAsync" not found') - err = ( __cuWaitExternalSemaphoresAsync)(extSemArray, paramsArray, numExtSems, stream) - return err -{{endif}} - -{{if 'cuDestroyExternalSemaphore' in found_functions}} - -cdef CUresult _cuDestroyExternalSemaphore(CUexternalSemaphore extSem) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuDestroyExternalSemaphore - cuPythonInit() - if __cuDestroyExternalSemaphore == NULL: - with gil: - raise RuntimeError('Function "cuDestroyExternalSemaphore" not found') - err = ( __cuDestroyExternalSemaphore)(extSem) - return err -{{endif}} - -{{if 'cuStreamWaitValue32_v2' in found_functions}} - -cdef CUresult _cuStreamWaitValue32_v2(CUstream stream, CUdeviceptr addr, cuuint32_t value, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuStreamWaitValue32_v2 - cuPythonInit() - if __cuStreamWaitValue32_v2 == NULL: - with gil: - raise RuntimeError('Function "cuStreamWaitValue32_v2" not found') - err = ( __cuStreamWaitValue32_v2)(stream, addr, value, flags) - return err -{{endif}} - -{{if 'cuStreamWaitValue64_v2' in found_functions}} - -cdef CUresult _cuStreamWaitValue64_v2(CUstream stream, CUdeviceptr addr, cuuint64_t value, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuStreamWaitValue64_v2 - cuPythonInit() - if __cuStreamWaitValue64_v2 == NULL: - with gil: - raise RuntimeError('Function "cuStreamWaitValue64_v2" not found') - err = ( __cuStreamWaitValue64_v2)(stream, addr, value, flags) - return err -{{endif}} - -{{if 'cuStreamWriteValue32_v2' in found_functions}} - -cdef CUresult _cuStreamWriteValue32_v2(CUstream stream, CUdeviceptr addr, cuuint32_t value, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuStreamWriteValue32_v2 - cuPythonInit() - if __cuStreamWriteValue32_v2 == NULL: - with gil: - raise RuntimeError('Function "cuStreamWriteValue32_v2" not found') - err = ( __cuStreamWriteValue32_v2)(stream, addr, value, flags) - return err -{{endif}} - -{{if 'cuStreamWriteValue64_v2' in found_functions}} - -cdef CUresult _cuStreamWriteValue64_v2(CUstream stream, CUdeviceptr addr, cuuint64_t value, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuStreamWriteValue64_v2 - cuPythonInit() - if __cuStreamWriteValue64_v2 == NULL: - with gil: - raise RuntimeError('Function "cuStreamWriteValue64_v2" not found') - err = ( __cuStreamWriteValue64_v2)(stream, addr, value, flags) - return err -{{endif}} - -{{if 'cuStreamBatchMemOp_v2' in found_functions}} - -cdef CUresult _cuStreamBatchMemOp_v2(CUstream stream, unsigned int count, CUstreamBatchMemOpParams* paramArray, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuStreamBatchMemOp_v2 - cuPythonInit() - if __cuStreamBatchMemOp_v2 == NULL: - with gil: - raise RuntimeError('Function "cuStreamBatchMemOp_v2" not found') - err = ( __cuStreamBatchMemOp_v2)(stream, count, paramArray, flags) - return err -{{endif}} - -{{if 'cuFuncGetAttribute' in found_functions}} - -cdef CUresult _cuFuncGetAttribute(int* pi, CUfunction_attribute attrib, CUfunction hfunc) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuFuncGetAttribute - cuPythonInit() - if __cuFuncGetAttribute == NULL: - with gil: - raise RuntimeError('Function "cuFuncGetAttribute" not found') - err = ( __cuFuncGetAttribute)(pi, attrib, hfunc) - return err -{{endif}} - -{{if 'cuFuncSetAttribute' in found_functions}} - -cdef CUresult _cuFuncSetAttribute(CUfunction hfunc, CUfunction_attribute attrib, int value) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuFuncSetAttribute - cuPythonInit() - if __cuFuncSetAttribute == NULL: - with gil: - raise RuntimeError('Function "cuFuncSetAttribute" not found') - err = ( __cuFuncSetAttribute)(hfunc, attrib, value) - return err -{{endif}} - -{{if 'cuFuncSetCacheConfig' in found_functions}} - -cdef CUresult _cuFuncSetCacheConfig(CUfunction hfunc, CUfunc_cache config) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuFuncSetCacheConfig - cuPythonInit() - if __cuFuncSetCacheConfig == NULL: - with gil: - raise RuntimeError('Function "cuFuncSetCacheConfig" not found') - err = ( __cuFuncSetCacheConfig)(hfunc, config) - return err -{{endif}} - -{{if 'cuFuncGetModule' in found_functions}} - -cdef CUresult _cuFuncGetModule(CUmodule* hmod, CUfunction hfunc) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuFuncGetModule - cuPythonInit() - if __cuFuncGetModule == NULL: - with gil: - raise RuntimeError('Function "cuFuncGetModule" not found') - err = ( __cuFuncGetModule)(hmod, hfunc) - return err -{{endif}} - -{{if 'cuFuncGetName' in found_functions}} - -cdef CUresult _cuFuncGetName(const char** name, CUfunction hfunc) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuFuncGetName - cuPythonInit() - if __cuFuncGetName == NULL: - with gil: - raise RuntimeError('Function "cuFuncGetName" not found') - err = ( __cuFuncGetName)(name, hfunc) - return err -{{endif}} - -{{if 'cuFuncGetParamInfo' in found_functions}} - -cdef CUresult _cuFuncGetParamInfo(CUfunction func, size_t paramIndex, size_t* paramOffset, size_t* paramSize) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuFuncGetParamInfo - cuPythonInit() - if __cuFuncGetParamInfo == NULL: - with gil: - raise RuntimeError('Function "cuFuncGetParamInfo" not found') - err = ( __cuFuncGetParamInfo)(func, paramIndex, paramOffset, paramSize) - return err -{{endif}} - -{{if 'cuFuncIsLoaded' in found_functions}} - -cdef CUresult _cuFuncIsLoaded(CUfunctionLoadingState* state, CUfunction function) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuFuncIsLoaded - cuPythonInit() - if __cuFuncIsLoaded == NULL: - with gil: - raise RuntimeError('Function "cuFuncIsLoaded" not found') - err = ( __cuFuncIsLoaded)(state, function) - return err -{{endif}} - -{{if 'cuFuncLoad' in found_functions}} - -cdef CUresult _cuFuncLoad(CUfunction function) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuFuncLoad - cuPythonInit() - if __cuFuncLoad == NULL: - with gil: - raise RuntimeError('Function "cuFuncLoad" not found') - err = ( __cuFuncLoad)(function) - return err -{{endif}} - -{{if 'cuLaunchKernel' in found_functions}} - -cdef CUresult _cuLaunchKernel(CUfunction f, unsigned int gridDimX, unsigned int gridDimY, unsigned int gridDimZ, unsigned int blockDimX, unsigned int blockDimY, unsigned int blockDimZ, unsigned int sharedMemBytes, CUstream hStream, void** kernelParams, void** extra) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuLaunchKernel - cuPythonInit() - if __cuLaunchKernel == NULL: - with gil: - raise RuntimeError('Function "cuLaunchKernel" not found') - err = ( __cuLaunchKernel)(f, gridDimX, gridDimY, gridDimZ, blockDimX, blockDimY, blockDimZ, sharedMemBytes, hStream, kernelParams, extra) - return err -{{endif}} - -{{if 'cuLaunchKernelEx' in found_functions}} - -cdef CUresult _cuLaunchKernelEx(const CUlaunchConfig* config, CUfunction f, void** kernelParams, void** extra) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuLaunchKernelEx - cuPythonInit() - if __cuLaunchKernelEx == NULL: - with gil: - raise RuntimeError('Function "cuLaunchKernelEx" not found') - err = ( __cuLaunchKernelEx)(config, f, kernelParams, extra) - return err -{{endif}} - -{{if 'cuLaunchCooperativeKernel' in found_functions}} - -cdef CUresult _cuLaunchCooperativeKernel(CUfunction f, unsigned int gridDimX, unsigned int gridDimY, unsigned int gridDimZ, unsigned int blockDimX, unsigned int blockDimY, unsigned int blockDimZ, unsigned int sharedMemBytes, CUstream hStream, void** kernelParams) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuLaunchCooperativeKernel - cuPythonInit() - if __cuLaunchCooperativeKernel == NULL: - with gil: - raise RuntimeError('Function "cuLaunchCooperativeKernel" not found') - err = ( __cuLaunchCooperativeKernel)(f, gridDimX, gridDimY, gridDimZ, blockDimX, blockDimY, blockDimZ, sharedMemBytes, hStream, kernelParams) - return err -{{endif}} - -{{if 'cuLaunchCooperativeKernelMultiDevice' in found_functions}} - -cdef CUresult _cuLaunchCooperativeKernelMultiDevice(CUDA_LAUNCH_PARAMS* launchParamsList, unsigned int numDevices, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuLaunchCooperativeKernelMultiDevice - cuPythonInit() - if __cuLaunchCooperativeKernelMultiDevice == NULL: - with gil: - raise RuntimeError('Function "cuLaunchCooperativeKernelMultiDevice" not found') - err = ( __cuLaunchCooperativeKernelMultiDevice)(launchParamsList, numDevices, flags) - return err -{{endif}} - -{{if 'cuLaunchHostFunc' in found_functions}} - -cdef CUresult _cuLaunchHostFunc(CUstream hStream, CUhostFn fn, void* userData) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuLaunchHostFunc - cuPythonInit() - if __cuLaunchHostFunc == NULL: - with gil: - raise RuntimeError('Function "cuLaunchHostFunc" not found') - err = ( __cuLaunchHostFunc)(hStream, fn, userData) - return err -{{endif}} - -{{if 'cuFuncSetBlockShape' in found_functions}} - -cdef CUresult _cuFuncSetBlockShape(CUfunction hfunc, int x, int y, int z) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuFuncSetBlockShape - cuPythonInit() - if __cuFuncSetBlockShape == NULL: - with gil: - raise RuntimeError('Function "cuFuncSetBlockShape" not found') - err = ( __cuFuncSetBlockShape)(hfunc, x, y, z) - return err -{{endif}} - -{{if 'cuFuncSetSharedSize' in found_functions}} - -cdef CUresult _cuFuncSetSharedSize(CUfunction hfunc, unsigned int numbytes) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuFuncSetSharedSize - cuPythonInit() - if __cuFuncSetSharedSize == NULL: - with gil: - raise RuntimeError('Function "cuFuncSetSharedSize" not found') - err = ( __cuFuncSetSharedSize)(hfunc, numbytes) - return err -{{endif}} - -{{if 'cuParamSetSize' in found_functions}} - -cdef CUresult _cuParamSetSize(CUfunction hfunc, unsigned int numbytes) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuParamSetSize - cuPythonInit() - if __cuParamSetSize == NULL: - with gil: - raise RuntimeError('Function "cuParamSetSize" not found') - err = ( __cuParamSetSize)(hfunc, numbytes) - return err -{{endif}} - -{{if 'cuParamSeti' in found_functions}} - -cdef CUresult _cuParamSeti(CUfunction hfunc, int offset, unsigned int value) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuParamSeti - cuPythonInit() - if __cuParamSeti == NULL: - with gil: - raise RuntimeError('Function "cuParamSeti" not found') - err = ( __cuParamSeti)(hfunc, offset, value) - return err -{{endif}} - -{{if 'cuParamSetf' in found_functions}} - -cdef CUresult _cuParamSetf(CUfunction hfunc, int offset, float value) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuParamSetf - cuPythonInit() - if __cuParamSetf == NULL: - with gil: - raise RuntimeError('Function "cuParamSetf" not found') - err = ( __cuParamSetf)(hfunc, offset, value) - return err -{{endif}} - -{{if 'cuParamSetv' in found_functions}} - -cdef CUresult _cuParamSetv(CUfunction hfunc, int offset, void* ptr, unsigned int numbytes) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuParamSetv - cuPythonInit() - if __cuParamSetv == NULL: - with gil: - raise RuntimeError('Function "cuParamSetv" not found') - err = ( __cuParamSetv)(hfunc, offset, ptr, numbytes) - return err -{{endif}} - -{{if 'cuLaunch' in found_functions}} - -cdef CUresult _cuLaunch(CUfunction f) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuLaunch - cuPythonInit() - if __cuLaunch == NULL: - with gil: - raise RuntimeError('Function "cuLaunch" not found') - err = ( __cuLaunch)(f) - return err -{{endif}} - -{{if 'cuLaunchGrid' in found_functions}} - -cdef CUresult _cuLaunchGrid(CUfunction f, int grid_width, int grid_height) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuLaunchGrid - cuPythonInit() - if __cuLaunchGrid == NULL: - with gil: - raise RuntimeError('Function "cuLaunchGrid" not found') - err = ( __cuLaunchGrid)(f, grid_width, grid_height) - return err -{{endif}} - -{{if 'cuLaunchGridAsync' in found_functions}} - -cdef CUresult _cuLaunchGridAsync(CUfunction f, int grid_width, int grid_height, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuLaunchGridAsync - cuPythonInit() - if __cuLaunchGridAsync == NULL: - with gil: - raise RuntimeError('Function "cuLaunchGridAsync" not found') - err = ( __cuLaunchGridAsync)(f, grid_width, grid_height, hStream) - return err -{{endif}} - -{{if 'cuParamSetTexRef' in found_functions}} - -cdef CUresult _cuParamSetTexRef(CUfunction hfunc, int texunit, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuParamSetTexRef - cuPythonInit() - if __cuParamSetTexRef == NULL: - with gil: - raise RuntimeError('Function "cuParamSetTexRef" not found') - err = ( __cuParamSetTexRef)(hfunc, texunit, hTexRef) - return err -{{endif}} - -{{if 'cuFuncSetSharedMemConfig' in found_functions}} - -cdef CUresult _cuFuncSetSharedMemConfig(CUfunction hfunc, CUsharedconfig config) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuFuncSetSharedMemConfig - cuPythonInit() - if __cuFuncSetSharedMemConfig == NULL: - with gil: - raise RuntimeError('Function "cuFuncSetSharedMemConfig" not found') - err = ( __cuFuncSetSharedMemConfig)(hfunc, config) - return err -{{endif}} - -{{if 'cuGraphCreate' in found_functions}} - -cdef CUresult _cuGraphCreate(CUgraph* phGraph, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphCreate - cuPythonInit() - if __cuGraphCreate == NULL: - with gil: - raise RuntimeError('Function "cuGraphCreate" not found') - err = ( __cuGraphCreate)(phGraph, flags) - return err -{{endif}} - -{{if 'cuGraphAddKernelNode_v2' in found_functions}} - -cdef CUresult _cuGraphAddKernelNode_v2(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, const CUDA_KERNEL_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphAddKernelNode_v2 - cuPythonInit() - if __cuGraphAddKernelNode_v2 == NULL: - with gil: - raise RuntimeError('Function "cuGraphAddKernelNode_v2" not found') - err = ( __cuGraphAddKernelNode_v2)(phGraphNode, hGraph, dependencies, numDependencies, nodeParams) - return err -{{endif}} - -{{if 'cuGraphKernelNodeGetParams_v2' in found_functions}} - -cdef CUresult _cuGraphKernelNodeGetParams_v2(CUgraphNode hNode, CUDA_KERNEL_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphKernelNodeGetParams_v2 - cuPythonInit() - if __cuGraphKernelNodeGetParams_v2 == NULL: - with gil: - raise RuntimeError('Function "cuGraphKernelNodeGetParams_v2" not found') - err = ( __cuGraphKernelNodeGetParams_v2)(hNode, nodeParams) - return err -{{endif}} - -{{if 'cuGraphKernelNodeSetParams_v2' in found_functions}} - -cdef CUresult _cuGraphKernelNodeSetParams_v2(CUgraphNode hNode, const CUDA_KERNEL_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphKernelNodeSetParams_v2 - cuPythonInit() - if __cuGraphKernelNodeSetParams_v2 == NULL: - with gil: - raise RuntimeError('Function "cuGraphKernelNodeSetParams_v2" not found') - err = ( __cuGraphKernelNodeSetParams_v2)(hNode, nodeParams) - return err -{{endif}} - -{{if 'cuGraphAddMemcpyNode' in found_functions}} - -cdef CUresult _cuGraphAddMemcpyNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, const CUDA_MEMCPY3D* copyParams, CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphAddMemcpyNode - cuPythonInit() - if __cuGraphAddMemcpyNode == NULL: - with gil: - raise RuntimeError('Function "cuGraphAddMemcpyNode" not found') - err = ( __cuGraphAddMemcpyNode)(phGraphNode, hGraph, dependencies, numDependencies, copyParams, ctx) - return err -{{endif}} - -{{if 'cuGraphMemcpyNodeGetParams' in found_functions}} - -cdef CUresult _cuGraphMemcpyNodeGetParams(CUgraphNode hNode, CUDA_MEMCPY3D* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphMemcpyNodeGetParams - cuPythonInit() - if __cuGraphMemcpyNodeGetParams == NULL: - with gil: - raise RuntimeError('Function "cuGraphMemcpyNodeGetParams" not found') - err = ( __cuGraphMemcpyNodeGetParams)(hNode, nodeParams) - return err -{{endif}} - -{{if 'cuGraphMemcpyNodeSetParams' in found_functions}} - -cdef CUresult _cuGraphMemcpyNodeSetParams(CUgraphNode hNode, const CUDA_MEMCPY3D* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphMemcpyNodeSetParams - cuPythonInit() - if __cuGraphMemcpyNodeSetParams == NULL: - with gil: - raise RuntimeError('Function "cuGraphMemcpyNodeSetParams" not found') - err = ( __cuGraphMemcpyNodeSetParams)(hNode, nodeParams) - return err -{{endif}} - -{{if 'cuGraphAddMemsetNode' in found_functions}} - -cdef CUresult _cuGraphAddMemsetNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, const CUDA_MEMSET_NODE_PARAMS* memsetParams, CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphAddMemsetNode - cuPythonInit() - if __cuGraphAddMemsetNode == NULL: - with gil: - raise RuntimeError('Function "cuGraphAddMemsetNode" not found') - err = ( __cuGraphAddMemsetNode)(phGraphNode, hGraph, dependencies, numDependencies, memsetParams, ctx) - return err -{{endif}} - -{{if 'cuGraphMemsetNodeGetParams' in found_functions}} - -cdef CUresult _cuGraphMemsetNodeGetParams(CUgraphNode hNode, CUDA_MEMSET_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphMemsetNodeGetParams - cuPythonInit() - if __cuGraphMemsetNodeGetParams == NULL: - with gil: - raise RuntimeError('Function "cuGraphMemsetNodeGetParams" not found') - err = ( __cuGraphMemsetNodeGetParams)(hNode, nodeParams) - return err -{{endif}} - -{{if 'cuGraphMemsetNodeSetParams' in found_functions}} - -cdef CUresult _cuGraphMemsetNodeSetParams(CUgraphNode hNode, const CUDA_MEMSET_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphMemsetNodeSetParams - cuPythonInit() - if __cuGraphMemsetNodeSetParams == NULL: - with gil: - raise RuntimeError('Function "cuGraphMemsetNodeSetParams" not found') - err = ( __cuGraphMemsetNodeSetParams)(hNode, nodeParams) - return err -{{endif}} - -{{if 'cuGraphAddHostNode' in found_functions}} - -cdef CUresult _cuGraphAddHostNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, const CUDA_HOST_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphAddHostNode - cuPythonInit() - if __cuGraphAddHostNode == NULL: - with gil: - raise RuntimeError('Function "cuGraphAddHostNode" not found') - err = ( __cuGraphAddHostNode)(phGraphNode, hGraph, dependencies, numDependencies, nodeParams) - return err -{{endif}} - -{{if 'cuGraphHostNodeGetParams' in found_functions}} - -cdef CUresult _cuGraphHostNodeGetParams(CUgraphNode hNode, CUDA_HOST_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphHostNodeGetParams - cuPythonInit() - if __cuGraphHostNodeGetParams == NULL: - with gil: - raise RuntimeError('Function "cuGraphHostNodeGetParams" not found') - err = ( __cuGraphHostNodeGetParams)(hNode, nodeParams) - return err -{{endif}} - -{{if 'cuGraphHostNodeSetParams' in found_functions}} - -cdef CUresult _cuGraphHostNodeSetParams(CUgraphNode hNode, const CUDA_HOST_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphHostNodeSetParams - cuPythonInit() - if __cuGraphHostNodeSetParams == NULL: - with gil: - raise RuntimeError('Function "cuGraphHostNodeSetParams" not found') - err = ( __cuGraphHostNodeSetParams)(hNode, nodeParams) - return err -{{endif}} - -{{if 'cuGraphAddChildGraphNode' in found_functions}} - -cdef CUresult _cuGraphAddChildGraphNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, CUgraph childGraph) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphAddChildGraphNode - cuPythonInit() - if __cuGraphAddChildGraphNode == NULL: - with gil: - raise RuntimeError('Function "cuGraphAddChildGraphNode" not found') - err = ( __cuGraphAddChildGraphNode)(phGraphNode, hGraph, dependencies, numDependencies, childGraph) - return err -{{endif}} - -{{if 'cuGraphChildGraphNodeGetGraph' in found_functions}} - -cdef CUresult _cuGraphChildGraphNodeGetGraph(CUgraphNode hNode, CUgraph* phGraph) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphChildGraphNodeGetGraph - cuPythonInit() - if __cuGraphChildGraphNodeGetGraph == NULL: - with gil: - raise RuntimeError('Function "cuGraphChildGraphNodeGetGraph" not found') - err = ( __cuGraphChildGraphNodeGetGraph)(hNode, phGraph) - return err -{{endif}} - -{{if 'cuGraphAddEmptyNode' in found_functions}} - -cdef CUresult _cuGraphAddEmptyNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphAddEmptyNode - cuPythonInit() - if __cuGraphAddEmptyNode == NULL: - with gil: - raise RuntimeError('Function "cuGraphAddEmptyNode" not found') - err = ( __cuGraphAddEmptyNode)(phGraphNode, hGraph, dependencies, numDependencies) - return err -{{endif}} - -{{if 'cuGraphAddEventRecordNode' in found_functions}} - -cdef CUresult _cuGraphAddEventRecordNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, CUevent event) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphAddEventRecordNode - cuPythonInit() - if __cuGraphAddEventRecordNode == NULL: - with gil: - raise RuntimeError('Function "cuGraphAddEventRecordNode" not found') - err = ( __cuGraphAddEventRecordNode)(phGraphNode, hGraph, dependencies, numDependencies, event) - return err -{{endif}} - -{{if 'cuGraphEventRecordNodeGetEvent' in found_functions}} - -cdef CUresult _cuGraphEventRecordNodeGetEvent(CUgraphNode hNode, CUevent* event_out) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphEventRecordNodeGetEvent - cuPythonInit() - if __cuGraphEventRecordNodeGetEvent == NULL: - with gil: - raise RuntimeError('Function "cuGraphEventRecordNodeGetEvent" not found') - err = ( __cuGraphEventRecordNodeGetEvent)(hNode, event_out) - return err -{{endif}} - -{{if 'cuGraphEventRecordNodeSetEvent' in found_functions}} - -cdef CUresult _cuGraphEventRecordNodeSetEvent(CUgraphNode hNode, CUevent event) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphEventRecordNodeSetEvent - cuPythonInit() - if __cuGraphEventRecordNodeSetEvent == NULL: - with gil: - raise RuntimeError('Function "cuGraphEventRecordNodeSetEvent" not found') - err = ( __cuGraphEventRecordNodeSetEvent)(hNode, event) - return err -{{endif}} - -{{if 'cuGraphAddEventWaitNode' in found_functions}} - -cdef CUresult _cuGraphAddEventWaitNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, CUevent event) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphAddEventWaitNode - cuPythonInit() - if __cuGraphAddEventWaitNode == NULL: - with gil: - raise RuntimeError('Function "cuGraphAddEventWaitNode" not found') - err = ( __cuGraphAddEventWaitNode)(phGraphNode, hGraph, dependencies, numDependencies, event) - return err -{{endif}} - -{{if 'cuGraphEventWaitNodeGetEvent' in found_functions}} - -cdef CUresult _cuGraphEventWaitNodeGetEvent(CUgraphNode hNode, CUevent* event_out) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphEventWaitNodeGetEvent - cuPythonInit() - if __cuGraphEventWaitNodeGetEvent == NULL: - with gil: - raise RuntimeError('Function "cuGraphEventWaitNodeGetEvent" not found') - err = ( __cuGraphEventWaitNodeGetEvent)(hNode, event_out) - return err -{{endif}} - -{{if 'cuGraphEventWaitNodeSetEvent' in found_functions}} - -cdef CUresult _cuGraphEventWaitNodeSetEvent(CUgraphNode hNode, CUevent event) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphEventWaitNodeSetEvent - cuPythonInit() - if __cuGraphEventWaitNodeSetEvent == NULL: - with gil: - raise RuntimeError('Function "cuGraphEventWaitNodeSetEvent" not found') - err = ( __cuGraphEventWaitNodeSetEvent)(hNode, event) - return err -{{endif}} - -{{if 'cuGraphAddExternalSemaphoresSignalNode' in found_functions}} - -cdef CUresult _cuGraphAddExternalSemaphoresSignalNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, const CUDA_EXT_SEM_SIGNAL_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphAddExternalSemaphoresSignalNode - cuPythonInit() - if __cuGraphAddExternalSemaphoresSignalNode == NULL: - with gil: - raise RuntimeError('Function "cuGraphAddExternalSemaphoresSignalNode" not found') - err = ( __cuGraphAddExternalSemaphoresSignalNode)(phGraphNode, hGraph, dependencies, numDependencies, nodeParams) - return err -{{endif}} - -{{if 'cuGraphExternalSemaphoresSignalNodeGetParams' in found_functions}} - -cdef CUresult _cuGraphExternalSemaphoresSignalNodeGetParams(CUgraphNode hNode, CUDA_EXT_SEM_SIGNAL_NODE_PARAMS* params_out) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphExternalSemaphoresSignalNodeGetParams - cuPythonInit() - if __cuGraphExternalSemaphoresSignalNodeGetParams == NULL: - with gil: - raise RuntimeError('Function "cuGraphExternalSemaphoresSignalNodeGetParams" not found') - err = ( __cuGraphExternalSemaphoresSignalNodeGetParams)(hNode, params_out) - return err -{{endif}} - -{{if 'cuGraphExternalSemaphoresSignalNodeSetParams' in found_functions}} - -cdef CUresult _cuGraphExternalSemaphoresSignalNodeSetParams(CUgraphNode hNode, const CUDA_EXT_SEM_SIGNAL_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphExternalSemaphoresSignalNodeSetParams - cuPythonInit() - if __cuGraphExternalSemaphoresSignalNodeSetParams == NULL: - with gil: - raise RuntimeError('Function "cuGraphExternalSemaphoresSignalNodeSetParams" not found') - err = ( __cuGraphExternalSemaphoresSignalNodeSetParams)(hNode, nodeParams) - return err -{{endif}} - -{{if 'cuGraphAddExternalSemaphoresWaitNode' in found_functions}} - -cdef CUresult _cuGraphAddExternalSemaphoresWaitNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, const CUDA_EXT_SEM_WAIT_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphAddExternalSemaphoresWaitNode - cuPythonInit() - if __cuGraphAddExternalSemaphoresWaitNode == NULL: - with gil: - raise RuntimeError('Function "cuGraphAddExternalSemaphoresWaitNode" not found') - err = ( __cuGraphAddExternalSemaphoresWaitNode)(phGraphNode, hGraph, dependencies, numDependencies, nodeParams) - return err -{{endif}} - -{{if 'cuGraphExternalSemaphoresWaitNodeGetParams' in found_functions}} - -cdef CUresult _cuGraphExternalSemaphoresWaitNodeGetParams(CUgraphNode hNode, CUDA_EXT_SEM_WAIT_NODE_PARAMS* params_out) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphExternalSemaphoresWaitNodeGetParams - cuPythonInit() - if __cuGraphExternalSemaphoresWaitNodeGetParams == NULL: - with gil: - raise RuntimeError('Function "cuGraphExternalSemaphoresWaitNodeGetParams" not found') - err = ( __cuGraphExternalSemaphoresWaitNodeGetParams)(hNode, params_out) - return err -{{endif}} - -{{if 'cuGraphExternalSemaphoresWaitNodeSetParams' in found_functions}} - -cdef CUresult _cuGraphExternalSemaphoresWaitNodeSetParams(CUgraphNode hNode, const CUDA_EXT_SEM_WAIT_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphExternalSemaphoresWaitNodeSetParams - cuPythonInit() - if __cuGraphExternalSemaphoresWaitNodeSetParams == NULL: - with gil: - raise RuntimeError('Function "cuGraphExternalSemaphoresWaitNodeSetParams" not found') - err = ( __cuGraphExternalSemaphoresWaitNodeSetParams)(hNode, nodeParams) - return err -{{endif}} - -{{if 'cuGraphAddBatchMemOpNode' in found_functions}} - -cdef CUresult _cuGraphAddBatchMemOpNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, const CUDA_BATCH_MEM_OP_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphAddBatchMemOpNode - cuPythonInit() - if __cuGraphAddBatchMemOpNode == NULL: - with gil: - raise RuntimeError('Function "cuGraphAddBatchMemOpNode" not found') - err = ( __cuGraphAddBatchMemOpNode)(phGraphNode, hGraph, dependencies, numDependencies, nodeParams) - return err -{{endif}} - -{{if 'cuGraphBatchMemOpNodeGetParams' in found_functions}} - -cdef CUresult _cuGraphBatchMemOpNodeGetParams(CUgraphNode hNode, CUDA_BATCH_MEM_OP_NODE_PARAMS* nodeParams_out) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphBatchMemOpNodeGetParams - cuPythonInit() - if __cuGraphBatchMemOpNodeGetParams == NULL: - with gil: - raise RuntimeError('Function "cuGraphBatchMemOpNodeGetParams" not found') - err = ( __cuGraphBatchMemOpNodeGetParams)(hNode, nodeParams_out) - return err -{{endif}} - -{{if 'cuGraphBatchMemOpNodeSetParams' in found_functions}} - -cdef CUresult _cuGraphBatchMemOpNodeSetParams(CUgraphNode hNode, const CUDA_BATCH_MEM_OP_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphBatchMemOpNodeSetParams - cuPythonInit() - if __cuGraphBatchMemOpNodeSetParams == NULL: - with gil: - raise RuntimeError('Function "cuGraphBatchMemOpNodeSetParams" not found') - err = ( __cuGraphBatchMemOpNodeSetParams)(hNode, nodeParams) - return err -{{endif}} - -{{if 'cuGraphExecBatchMemOpNodeSetParams' in found_functions}} - -cdef CUresult _cuGraphExecBatchMemOpNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_BATCH_MEM_OP_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphExecBatchMemOpNodeSetParams - cuPythonInit() - if __cuGraphExecBatchMemOpNodeSetParams == NULL: - with gil: - raise RuntimeError('Function "cuGraphExecBatchMemOpNodeSetParams" not found') - err = ( __cuGraphExecBatchMemOpNodeSetParams)(hGraphExec, hNode, nodeParams) - return err -{{endif}} - -{{if 'cuGraphAddMemAllocNode' in found_functions}} - -cdef CUresult _cuGraphAddMemAllocNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, CUDA_MEM_ALLOC_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphAddMemAllocNode - cuPythonInit() - if __cuGraphAddMemAllocNode == NULL: - with gil: - raise RuntimeError('Function "cuGraphAddMemAllocNode" not found') - err = ( __cuGraphAddMemAllocNode)(phGraphNode, hGraph, dependencies, numDependencies, nodeParams) - return err -{{endif}} - -{{if 'cuGraphMemAllocNodeGetParams' in found_functions}} - -cdef CUresult _cuGraphMemAllocNodeGetParams(CUgraphNode hNode, CUDA_MEM_ALLOC_NODE_PARAMS* params_out) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphMemAllocNodeGetParams - cuPythonInit() - if __cuGraphMemAllocNodeGetParams == NULL: - with gil: - raise RuntimeError('Function "cuGraphMemAllocNodeGetParams" not found') - err = ( __cuGraphMemAllocNodeGetParams)(hNode, params_out) - return err -{{endif}} - -{{if 'cuGraphAddMemFreeNode' in found_functions}} - -cdef CUresult _cuGraphAddMemFreeNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, CUdeviceptr dptr) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphAddMemFreeNode - cuPythonInit() - if __cuGraphAddMemFreeNode == NULL: - with gil: - raise RuntimeError('Function "cuGraphAddMemFreeNode" not found') - err = ( __cuGraphAddMemFreeNode)(phGraphNode, hGraph, dependencies, numDependencies, dptr) - return err -{{endif}} - -{{if 'cuGraphMemFreeNodeGetParams' in found_functions}} - -cdef CUresult _cuGraphMemFreeNodeGetParams(CUgraphNode hNode, CUdeviceptr* dptr_out) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphMemFreeNodeGetParams - cuPythonInit() - if __cuGraphMemFreeNodeGetParams == NULL: - with gil: - raise RuntimeError('Function "cuGraphMemFreeNodeGetParams" not found') - err = ( __cuGraphMemFreeNodeGetParams)(hNode, dptr_out) - return err -{{endif}} - -{{if 'cuDeviceGraphMemTrim' in found_functions}} - -cdef CUresult _cuDeviceGraphMemTrim(CUdevice device) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuDeviceGraphMemTrim - cuPythonInit() - if __cuDeviceGraphMemTrim == NULL: - with gil: - raise RuntimeError('Function "cuDeviceGraphMemTrim" not found') - err = ( __cuDeviceGraphMemTrim)(device) - return err -{{endif}} - -{{if 'cuDeviceGetGraphMemAttribute' in found_functions}} - -cdef CUresult _cuDeviceGetGraphMemAttribute(CUdevice device, CUgraphMem_attribute attr, void* value) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuDeviceGetGraphMemAttribute - cuPythonInit() - if __cuDeviceGetGraphMemAttribute == NULL: - with gil: - raise RuntimeError('Function "cuDeviceGetGraphMemAttribute" not found') - err = ( __cuDeviceGetGraphMemAttribute)(device, attr, value) - return err -{{endif}} - -{{if 'cuDeviceSetGraphMemAttribute' in found_functions}} - -cdef CUresult _cuDeviceSetGraphMemAttribute(CUdevice device, CUgraphMem_attribute attr, void* value) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuDeviceSetGraphMemAttribute - cuPythonInit() - if __cuDeviceSetGraphMemAttribute == NULL: - with gil: - raise RuntimeError('Function "cuDeviceSetGraphMemAttribute" not found') - err = ( __cuDeviceSetGraphMemAttribute)(device, attr, value) - return err -{{endif}} - -{{if 'cuGraphClone' in found_functions}} - -cdef CUresult _cuGraphClone(CUgraph* phGraphClone, CUgraph originalGraph) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphClone - cuPythonInit() - if __cuGraphClone == NULL: - with gil: - raise RuntimeError('Function "cuGraphClone" not found') - err = ( __cuGraphClone)(phGraphClone, originalGraph) - return err -{{endif}} - -{{if 'cuGraphNodeFindInClone' in found_functions}} - -cdef CUresult _cuGraphNodeFindInClone(CUgraphNode* phNode, CUgraphNode hOriginalNode, CUgraph hClonedGraph) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphNodeFindInClone - cuPythonInit() - if __cuGraphNodeFindInClone == NULL: - with gil: - raise RuntimeError('Function "cuGraphNodeFindInClone" not found') - err = ( __cuGraphNodeFindInClone)(phNode, hOriginalNode, hClonedGraph) - return err -{{endif}} - -{{if 'cuGraphNodeGetType' in found_functions}} - -cdef CUresult _cuGraphNodeGetType(CUgraphNode hNode, CUgraphNodeType* typename) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphNodeGetType - cuPythonInit() - if __cuGraphNodeGetType == NULL: - with gil: - raise RuntimeError('Function "cuGraphNodeGetType" not found') - err = ( __cuGraphNodeGetType)(hNode, typename) - return err -{{endif}} - -{{if 'cuGraphGetNodes' in found_functions}} - -cdef CUresult _cuGraphGetNodes(CUgraph hGraph, CUgraphNode* nodes, size_t* numNodes) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphGetNodes - cuPythonInit() - if __cuGraphGetNodes == NULL: - with gil: - raise RuntimeError('Function "cuGraphGetNodes" not found') - err = ( __cuGraphGetNodes)(hGraph, nodes, numNodes) - return err -{{endif}} - -{{if 'cuGraphGetRootNodes' in found_functions}} - -cdef CUresult _cuGraphGetRootNodes(CUgraph hGraph, CUgraphNode* rootNodes, size_t* numRootNodes) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphGetRootNodes - cuPythonInit() - if __cuGraphGetRootNodes == NULL: - with gil: - raise RuntimeError('Function "cuGraphGetRootNodes" not found') - err = ( __cuGraphGetRootNodes)(hGraph, rootNodes, numRootNodes) - return err -{{endif}} - -{{if 'cuGraphGetEdges' in found_functions}} - -cdef CUresult _cuGraphGetEdges(CUgraph hGraph, CUgraphNode* from_, CUgraphNode* to, size_t* numEdges) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphGetEdges - cuPythonInit() - if __cuGraphGetEdges == NULL: - with gil: - raise RuntimeError('Function "cuGraphGetEdges" not found') - err = ( __cuGraphGetEdges)(hGraph, from_, to, numEdges) - return err -{{endif}} - -{{if 'cuGraphGetEdges_v2' in found_functions}} - -cdef CUresult _cuGraphGetEdges_v2(CUgraph hGraph, CUgraphNode* from_, CUgraphNode* to, CUgraphEdgeData* edgeData, size_t* numEdges) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphGetEdges_v2 - cuPythonInit() - if __cuGraphGetEdges_v2 == NULL: - with gil: - raise RuntimeError('Function "cuGraphGetEdges_v2" not found') - err = ( __cuGraphGetEdges_v2)(hGraph, from_, to, edgeData, numEdges) - return err -{{endif}} - -{{if 'cuGraphNodeGetDependencies' in found_functions}} - -cdef CUresult _cuGraphNodeGetDependencies(CUgraphNode hNode, CUgraphNode* dependencies, size_t* numDependencies) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphNodeGetDependencies - cuPythonInit() - if __cuGraphNodeGetDependencies == NULL: - with gil: - raise RuntimeError('Function "cuGraphNodeGetDependencies" not found') - err = ( __cuGraphNodeGetDependencies)(hNode, dependencies, numDependencies) - return err -{{endif}} - -{{if 'cuGraphNodeGetDependencies_v2' in found_functions}} - -cdef CUresult _cuGraphNodeGetDependencies_v2(CUgraphNode hNode, CUgraphNode* dependencies, CUgraphEdgeData* edgeData, size_t* numDependencies) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphNodeGetDependencies_v2 - cuPythonInit() - if __cuGraphNodeGetDependencies_v2 == NULL: - with gil: - raise RuntimeError('Function "cuGraphNodeGetDependencies_v2" not found') - err = ( __cuGraphNodeGetDependencies_v2)(hNode, dependencies, edgeData, numDependencies) - return err -{{endif}} - -{{if 'cuGraphNodeGetDependentNodes' in found_functions}} - -cdef CUresult _cuGraphNodeGetDependentNodes(CUgraphNode hNode, CUgraphNode* dependentNodes, size_t* numDependentNodes) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphNodeGetDependentNodes - cuPythonInit() - if __cuGraphNodeGetDependentNodes == NULL: - with gil: - raise RuntimeError('Function "cuGraphNodeGetDependentNodes" not found') - err = ( __cuGraphNodeGetDependentNodes)(hNode, dependentNodes, numDependentNodes) - return err -{{endif}} - -{{if 'cuGraphNodeGetDependentNodes_v2' in found_functions}} - -cdef CUresult _cuGraphNodeGetDependentNodes_v2(CUgraphNode hNode, CUgraphNode* dependentNodes, CUgraphEdgeData* edgeData, size_t* numDependentNodes) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphNodeGetDependentNodes_v2 - cuPythonInit() - if __cuGraphNodeGetDependentNodes_v2 == NULL: - with gil: - raise RuntimeError('Function "cuGraphNodeGetDependentNodes_v2" not found') - err = ( __cuGraphNodeGetDependentNodes_v2)(hNode, dependentNodes, edgeData, numDependentNodes) - return err -{{endif}} - -{{if 'cuGraphAddDependencies' in found_functions}} - -cdef CUresult _cuGraphAddDependencies(CUgraph hGraph, const CUgraphNode* from_, const CUgraphNode* to, size_t numDependencies) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphAddDependencies - cuPythonInit() - if __cuGraphAddDependencies == NULL: - with gil: - raise RuntimeError('Function "cuGraphAddDependencies" not found') - err = ( __cuGraphAddDependencies)(hGraph, from_, to, numDependencies) - return err -{{endif}} - -{{if 'cuGraphAddDependencies_v2' in found_functions}} - -cdef CUresult _cuGraphAddDependencies_v2(CUgraph hGraph, const CUgraphNode* from_, const CUgraphNode* to, const CUgraphEdgeData* edgeData, size_t numDependencies) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphAddDependencies_v2 - cuPythonInit() - if __cuGraphAddDependencies_v2 == NULL: - with gil: - raise RuntimeError('Function "cuGraphAddDependencies_v2" not found') - err = ( __cuGraphAddDependencies_v2)(hGraph, from_, to, edgeData, numDependencies) - return err -{{endif}} - -{{if 'cuGraphRemoveDependencies' in found_functions}} - -cdef CUresult _cuGraphRemoveDependencies(CUgraph hGraph, const CUgraphNode* from_, const CUgraphNode* to, size_t numDependencies) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphRemoveDependencies - cuPythonInit() - if __cuGraphRemoveDependencies == NULL: - with gil: - raise RuntimeError('Function "cuGraphRemoveDependencies" not found') - err = ( __cuGraphRemoveDependencies)(hGraph, from_, to, numDependencies) - return err -{{endif}} - -{{if 'cuGraphRemoveDependencies_v2' in found_functions}} - -cdef CUresult _cuGraphRemoveDependencies_v2(CUgraph hGraph, const CUgraphNode* from_, const CUgraphNode* to, const CUgraphEdgeData* edgeData, size_t numDependencies) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphRemoveDependencies_v2 - cuPythonInit() - if __cuGraphRemoveDependencies_v2 == NULL: - with gil: - raise RuntimeError('Function "cuGraphRemoveDependencies_v2" not found') - err = ( __cuGraphRemoveDependencies_v2)(hGraph, from_, to, edgeData, numDependencies) - return err -{{endif}} - -{{if 'cuGraphDestroyNode' in found_functions}} - -cdef CUresult _cuGraphDestroyNode(CUgraphNode hNode) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphDestroyNode - cuPythonInit() - if __cuGraphDestroyNode == NULL: - with gil: - raise RuntimeError('Function "cuGraphDestroyNode" not found') - err = ( __cuGraphDestroyNode)(hNode) - return err -{{endif}} - -{{if 'cuGraphInstantiateWithFlags' in found_functions}} - -cdef CUresult _cuGraphInstantiateWithFlags(CUgraphExec* phGraphExec, CUgraph hGraph, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphInstantiateWithFlags - cuPythonInit() - if __cuGraphInstantiateWithFlags == NULL: - with gil: - raise RuntimeError('Function "cuGraphInstantiateWithFlags" not found') - err = ( __cuGraphInstantiateWithFlags)(phGraphExec, hGraph, flags) - return err -{{endif}} - -{{if 'cuGraphInstantiateWithParams' in found_functions}} - -cdef CUresult _cuGraphInstantiateWithParams(CUgraphExec* phGraphExec, CUgraph hGraph, CUDA_GRAPH_INSTANTIATE_PARAMS* instantiateParams) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphInstantiateWithParams - cuPythonInit() - if __cuGraphInstantiateWithParams == NULL: - with gil: - raise RuntimeError('Function "cuGraphInstantiateWithParams" not found') - err = ( __cuGraphInstantiateWithParams)(phGraphExec, hGraph, instantiateParams) - return err -{{endif}} - -{{if 'cuGraphExecGetFlags' in found_functions}} - -cdef CUresult _cuGraphExecGetFlags(CUgraphExec hGraphExec, cuuint64_t* flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphExecGetFlags - cuPythonInit() - if __cuGraphExecGetFlags == NULL: - with gil: - raise RuntimeError('Function "cuGraphExecGetFlags" not found') - err = ( __cuGraphExecGetFlags)(hGraphExec, flags) - return err -{{endif}} - -{{if 'cuGraphExecKernelNodeSetParams_v2' in found_functions}} - -cdef CUresult _cuGraphExecKernelNodeSetParams_v2(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_KERNEL_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphExecKernelNodeSetParams_v2 - cuPythonInit() - if __cuGraphExecKernelNodeSetParams_v2 == NULL: - with gil: - raise RuntimeError('Function "cuGraphExecKernelNodeSetParams_v2" not found') - err = ( __cuGraphExecKernelNodeSetParams_v2)(hGraphExec, hNode, nodeParams) - return err -{{endif}} - -{{if 'cuGraphExecMemcpyNodeSetParams' in found_functions}} - -cdef CUresult _cuGraphExecMemcpyNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_MEMCPY3D* copyParams, CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphExecMemcpyNodeSetParams - cuPythonInit() - if __cuGraphExecMemcpyNodeSetParams == NULL: - with gil: - raise RuntimeError('Function "cuGraphExecMemcpyNodeSetParams" not found') - err = ( __cuGraphExecMemcpyNodeSetParams)(hGraphExec, hNode, copyParams, ctx) - return err -{{endif}} - -{{if 'cuGraphExecMemsetNodeSetParams' in found_functions}} - -cdef CUresult _cuGraphExecMemsetNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_MEMSET_NODE_PARAMS* memsetParams, CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphExecMemsetNodeSetParams - cuPythonInit() - if __cuGraphExecMemsetNodeSetParams == NULL: - with gil: - raise RuntimeError('Function "cuGraphExecMemsetNodeSetParams" not found') - err = ( __cuGraphExecMemsetNodeSetParams)(hGraphExec, hNode, memsetParams, ctx) - return err -{{endif}} - -{{if 'cuGraphExecHostNodeSetParams' in found_functions}} - -cdef CUresult _cuGraphExecHostNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_HOST_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphExecHostNodeSetParams - cuPythonInit() - if __cuGraphExecHostNodeSetParams == NULL: - with gil: - raise RuntimeError('Function "cuGraphExecHostNodeSetParams" not found') - err = ( __cuGraphExecHostNodeSetParams)(hGraphExec, hNode, nodeParams) - return err -{{endif}} - -{{if 'cuGraphExecChildGraphNodeSetParams' in found_functions}} - -cdef CUresult _cuGraphExecChildGraphNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, CUgraph childGraph) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphExecChildGraphNodeSetParams - cuPythonInit() - if __cuGraphExecChildGraphNodeSetParams == NULL: - with gil: - raise RuntimeError('Function "cuGraphExecChildGraphNodeSetParams" not found') - err = ( __cuGraphExecChildGraphNodeSetParams)(hGraphExec, hNode, childGraph) - return err -{{endif}} - -{{if 'cuGraphExecEventRecordNodeSetEvent' in found_functions}} - -cdef CUresult _cuGraphExecEventRecordNodeSetEvent(CUgraphExec hGraphExec, CUgraphNode hNode, CUevent event) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphExecEventRecordNodeSetEvent - cuPythonInit() - if __cuGraphExecEventRecordNodeSetEvent == NULL: - with gil: - raise RuntimeError('Function "cuGraphExecEventRecordNodeSetEvent" not found') - err = ( __cuGraphExecEventRecordNodeSetEvent)(hGraphExec, hNode, event) - return err -{{endif}} - -{{if 'cuGraphExecEventWaitNodeSetEvent' in found_functions}} - -cdef CUresult _cuGraphExecEventWaitNodeSetEvent(CUgraphExec hGraphExec, CUgraphNode hNode, CUevent event) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphExecEventWaitNodeSetEvent - cuPythonInit() - if __cuGraphExecEventWaitNodeSetEvent == NULL: - with gil: - raise RuntimeError('Function "cuGraphExecEventWaitNodeSetEvent" not found') - err = ( __cuGraphExecEventWaitNodeSetEvent)(hGraphExec, hNode, event) - return err -{{endif}} - -{{if 'cuGraphExecExternalSemaphoresSignalNodeSetParams' in found_functions}} - -cdef CUresult _cuGraphExecExternalSemaphoresSignalNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_EXT_SEM_SIGNAL_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphExecExternalSemaphoresSignalNodeSetParams - cuPythonInit() - if __cuGraphExecExternalSemaphoresSignalNodeSetParams == NULL: - with gil: - raise RuntimeError('Function "cuGraphExecExternalSemaphoresSignalNodeSetParams" not found') - err = ( __cuGraphExecExternalSemaphoresSignalNodeSetParams)(hGraphExec, hNode, nodeParams) - return err -{{endif}} - -{{if 'cuGraphExecExternalSemaphoresWaitNodeSetParams' in found_functions}} - -cdef CUresult _cuGraphExecExternalSemaphoresWaitNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_EXT_SEM_WAIT_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphExecExternalSemaphoresWaitNodeSetParams - cuPythonInit() - if __cuGraphExecExternalSemaphoresWaitNodeSetParams == NULL: - with gil: - raise RuntimeError('Function "cuGraphExecExternalSemaphoresWaitNodeSetParams" not found') - err = ( __cuGraphExecExternalSemaphoresWaitNodeSetParams)(hGraphExec, hNode, nodeParams) - return err -{{endif}} - -{{if 'cuGraphNodeSetEnabled' in found_functions}} - -cdef CUresult _cuGraphNodeSetEnabled(CUgraphExec hGraphExec, CUgraphNode hNode, unsigned int isEnabled) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphNodeSetEnabled - cuPythonInit() - if __cuGraphNodeSetEnabled == NULL: - with gil: - raise RuntimeError('Function "cuGraphNodeSetEnabled" not found') - err = ( __cuGraphNodeSetEnabled)(hGraphExec, hNode, isEnabled) - return err -{{endif}} - -{{if 'cuGraphNodeGetEnabled' in found_functions}} - -cdef CUresult _cuGraphNodeGetEnabled(CUgraphExec hGraphExec, CUgraphNode hNode, unsigned int* isEnabled) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphNodeGetEnabled - cuPythonInit() - if __cuGraphNodeGetEnabled == NULL: - with gil: - raise RuntimeError('Function "cuGraphNodeGetEnabled" not found') - err = ( __cuGraphNodeGetEnabled)(hGraphExec, hNode, isEnabled) - return err -{{endif}} - -{{if 'cuGraphUpload' in found_functions}} - -cdef CUresult _cuGraphUpload(CUgraphExec hGraphExec, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphUpload - cuPythonInit() - if __cuGraphUpload == NULL: - with gil: - raise RuntimeError('Function "cuGraphUpload" not found') - err = ( __cuGraphUpload)(hGraphExec, hStream) - return err -{{endif}} - -{{if 'cuGraphLaunch' in found_functions}} - -cdef CUresult _cuGraphLaunch(CUgraphExec hGraphExec, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphLaunch - cuPythonInit() - if __cuGraphLaunch == NULL: - with gil: - raise RuntimeError('Function "cuGraphLaunch" not found') - err = ( __cuGraphLaunch)(hGraphExec, hStream) - return err -{{endif}} - -{{if 'cuGraphExecDestroy' in found_functions}} - -cdef CUresult _cuGraphExecDestroy(CUgraphExec hGraphExec) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphExecDestroy - cuPythonInit() - if __cuGraphExecDestroy == NULL: - with gil: - raise RuntimeError('Function "cuGraphExecDestroy" not found') - err = ( __cuGraphExecDestroy)(hGraphExec) - return err -{{endif}} - -{{if 'cuGraphDestroy' in found_functions}} - -cdef CUresult _cuGraphDestroy(CUgraph hGraph) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphDestroy - cuPythonInit() - if __cuGraphDestroy == NULL: - with gil: - raise RuntimeError('Function "cuGraphDestroy" not found') - err = ( __cuGraphDestroy)(hGraph) - return err -{{endif}} - -{{if 'cuGraphExecUpdate_v2' in found_functions}} - -cdef CUresult _cuGraphExecUpdate_v2(CUgraphExec hGraphExec, CUgraph hGraph, CUgraphExecUpdateResultInfo* resultInfo) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphExecUpdate_v2 - cuPythonInit() - if __cuGraphExecUpdate_v2 == NULL: - with gil: - raise RuntimeError('Function "cuGraphExecUpdate_v2" not found') - err = ( __cuGraphExecUpdate_v2)(hGraphExec, hGraph, resultInfo) - return err -{{endif}} - -{{if 'cuGraphKernelNodeCopyAttributes' in found_functions}} - -cdef CUresult _cuGraphKernelNodeCopyAttributes(CUgraphNode dst, CUgraphNode src) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphKernelNodeCopyAttributes - cuPythonInit() - if __cuGraphKernelNodeCopyAttributes == NULL: - with gil: - raise RuntimeError('Function "cuGraphKernelNodeCopyAttributes" not found') - err = ( __cuGraphKernelNodeCopyAttributes)(dst, src) - return err -{{endif}} - -{{if 'cuGraphKernelNodeGetAttribute' in found_functions}} - -cdef CUresult _cuGraphKernelNodeGetAttribute(CUgraphNode hNode, CUkernelNodeAttrID attr, CUkernelNodeAttrValue* value_out) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphKernelNodeGetAttribute - cuPythonInit() - if __cuGraphKernelNodeGetAttribute == NULL: - with gil: - raise RuntimeError('Function "cuGraphKernelNodeGetAttribute" not found') - err = ( __cuGraphKernelNodeGetAttribute)(hNode, attr, value_out) - return err -{{endif}} - -{{if 'cuGraphKernelNodeSetAttribute' in found_functions}} - -cdef CUresult _cuGraphKernelNodeSetAttribute(CUgraphNode hNode, CUkernelNodeAttrID attr, const CUkernelNodeAttrValue* value) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphKernelNodeSetAttribute - cuPythonInit() - if __cuGraphKernelNodeSetAttribute == NULL: - with gil: - raise RuntimeError('Function "cuGraphKernelNodeSetAttribute" not found') - err = ( __cuGraphKernelNodeSetAttribute)(hNode, attr, value) - return err -{{endif}} - -{{if 'cuGraphDebugDotPrint' in found_functions}} - -cdef CUresult _cuGraphDebugDotPrint(CUgraph hGraph, const char* path, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphDebugDotPrint - cuPythonInit() - if __cuGraphDebugDotPrint == NULL: - with gil: - raise RuntimeError('Function "cuGraphDebugDotPrint" not found') - err = ( __cuGraphDebugDotPrint)(hGraph, path, flags) - return err -{{endif}} - -{{if 'cuUserObjectCreate' in found_functions}} - -cdef CUresult _cuUserObjectCreate(CUuserObject* object_out, void* ptr, CUhostFn destroy, unsigned int initialRefcount, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuUserObjectCreate - cuPythonInit() - if __cuUserObjectCreate == NULL: - with gil: - raise RuntimeError('Function "cuUserObjectCreate" not found') - err = ( __cuUserObjectCreate)(object_out, ptr, destroy, initialRefcount, flags) - return err -{{endif}} - -{{if 'cuUserObjectRetain' in found_functions}} - -cdef CUresult _cuUserObjectRetain(CUuserObject object, unsigned int count) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuUserObjectRetain - cuPythonInit() - if __cuUserObjectRetain == NULL: - with gil: - raise RuntimeError('Function "cuUserObjectRetain" not found') - err = ( __cuUserObjectRetain)(object, count) - return err -{{endif}} - -{{if 'cuUserObjectRelease' in found_functions}} - -cdef CUresult _cuUserObjectRelease(CUuserObject object, unsigned int count) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuUserObjectRelease - cuPythonInit() - if __cuUserObjectRelease == NULL: - with gil: - raise RuntimeError('Function "cuUserObjectRelease" not found') - err = ( __cuUserObjectRelease)(object, count) - return err -{{endif}} - -{{if 'cuGraphRetainUserObject' in found_functions}} - -cdef CUresult _cuGraphRetainUserObject(CUgraph graph, CUuserObject object, unsigned int count, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphRetainUserObject - cuPythonInit() - if __cuGraphRetainUserObject == NULL: - with gil: - raise RuntimeError('Function "cuGraphRetainUserObject" not found') - err = ( __cuGraphRetainUserObject)(graph, object, count, flags) - return err -{{endif}} - -{{if 'cuGraphReleaseUserObject' in found_functions}} - -cdef CUresult _cuGraphReleaseUserObject(CUgraph graph, CUuserObject object, unsigned int count) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphReleaseUserObject - cuPythonInit() - if __cuGraphReleaseUserObject == NULL: - with gil: - raise RuntimeError('Function "cuGraphReleaseUserObject" not found') - err = ( __cuGraphReleaseUserObject)(graph, object, count) - return err -{{endif}} - -{{if 'cuGraphAddNode' in found_functions}} - -cdef CUresult _cuGraphAddNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, CUgraphNodeParams* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphAddNode - cuPythonInit() - if __cuGraphAddNode == NULL: - with gil: - raise RuntimeError('Function "cuGraphAddNode" not found') - err = ( __cuGraphAddNode)(phGraphNode, hGraph, dependencies, numDependencies, nodeParams) - return err -{{endif}} - -{{if 'cuGraphAddNode_v2' in found_functions}} - -cdef CUresult _cuGraphAddNode_v2(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, const CUgraphEdgeData* dependencyData, size_t numDependencies, CUgraphNodeParams* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphAddNode_v2 - cuPythonInit() - if __cuGraphAddNode_v2 == NULL: - with gil: - raise RuntimeError('Function "cuGraphAddNode_v2" not found') - err = ( __cuGraphAddNode_v2)(phGraphNode, hGraph, dependencies, dependencyData, numDependencies, nodeParams) - return err -{{endif}} - -{{if 'cuGraphNodeSetParams' in found_functions}} - -cdef CUresult _cuGraphNodeSetParams(CUgraphNode hNode, CUgraphNodeParams* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphNodeSetParams - cuPythonInit() - if __cuGraphNodeSetParams == NULL: - with gil: - raise RuntimeError('Function "cuGraphNodeSetParams" not found') - err = ( __cuGraphNodeSetParams)(hNode, nodeParams) - return err -{{endif}} - -{{if 'cuGraphExecNodeSetParams' in found_functions}} - -cdef CUresult _cuGraphExecNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, CUgraphNodeParams* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphExecNodeSetParams - cuPythonInit() - if __cuGraphExecNodeSetParams == NULL: - with gil: - raise RuntimeError('Function "cuGraphExecNodeSetParams" not found') - err = ( __cuGraphExecNodeSetParams)(hGraphExec, hNode, nodeParams) - return err -{{endif}} - -{{if 'cuGraphConditionalHandleCreate' in found_functions}} - -cdef CUresult _cuGraphConditionalHandleCreate(CUgraphConditionalHandle* pHandle_out, CUgraph hGraph, CUcontext ctx, unsigned int defaultLaunchValue, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphConditionalHandleCreate - cuPythonInit() - if __cuGraphConditionalHandleCreate == NULL: - with gil: - raise RuntimeError('Function "cuGraphConditionalHandleCreate" not found') - err = ( __cuGraphConditionalHandleCreate)(pHandle_out, hGraph, ctx, defaultLaunchValue, flags) - return err -{{endif}} - -{{if 'cuOccupancyMaxActiveBlocksPerMultiprocessor' in found_functions}} - -cdef CUresult _cuOccupancyMaxActiveBlocksPerMultiprocessor(int* numBlocks, CUfunction func, int blockSize, size_t dynamicSMemSize) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuOccupancyMaxActiveBlocksPerMultiprocessor - cuPythonInit() - if __cuOccupancyMaxActiveBlocksPerMultiprocessor == NULL: - with gil: - raise RuntimeError('Function "cuOccupancyMaxActiveBlocksPerMultiprocessor" not found') - err = ( __cuOccupancyMaxActiveBlocksPerMultiprocessor)(numBlocks, func, blockSize, dynamicSMemSize) - return err -{{endif}} - -{{if 'cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags' in found_functions}} - -cdef CUresult _cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(int* numBlocks, CUfunction func, int blockSize, size_t dynamicSMemSize, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags - cuPythonInit() - if __cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags == NULL: - with gil: - raise RuntimeError('Function "cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags" not found') - err = ( __cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags)(numBlocks, func, blockSize, dynamicSMemSize, flags) - return err -{{endif}} - -{{if 'cuOccupancyMaxPotentialBlockSize' in found_functions}} - -cdef CUresult _cuOccupancyMaxPotentialBlockSize(int* minGridSize, int* blockSize, CUfunction func, CUoccupancyB2DSize blockSizeToDynamicSMemSize, size_t dynamicSMemSize, int blockSizeLimit) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuOccupancyMaxPotentialBlockSize - cuPythonInit() - if __cuOccupancyMaxPotentialBlockSize == NULL: - with gil: - raise RuntimeError('Function "cuOccupancyMaxPotentialBlockSize" not found') - err = ( __cuOccupancyMaxPotentialBlockSize)(minGridSize, blockSize, func, blockSizeToDynamicSMemSize, dynamicSMemSize, blockSizeLimit) - return err -{{endif}} - -{{if 'cuOccupancyMaxPotentialBlockSizeWithFlags' in found_functions}} - -cdef CUresult _cuOccupancyMaxPotentialBlockSizeWithFlags(int* minGridSize, int* blockSize, CUfunction func, CUoccupancyB2DSize blockSizeToDynamicSMemSize, size_t dynamicSMemSize, int blockSizeLimit, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuOccupancyMaxPotentialBlockSizeWithFlags - cuPythonInit() - if __cuOccupancyMaxPotentialBlockSizeWithFlags == NULL: - with gil: - raise RuntimeError('Function "cuOccupancyMaxPotentialBlockSizeWithFlags" not found') - err = ( __cuOccupancyMaxPotentialBlockSizeWithFlags)(minGridSize, blockSize, func, blockSizeToDynamicSMemSize, dynamicSMemSize, blockSizeLimit, flags) - return err -{{endif}} - -{{if 'cuOccupancyAvailableDynamicSMemPerBlock' in found_functions}} - -cdef CUresult _cuOccupancyAvailableDynamicSMemPerBlock(size_t* dynamicSmemSize, CUfunction func, int numBlocks, int blockSize) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuOccupancyAvailableDynamicSMemPerBlock - cuPythonInit() - if __cuOccupancyAvailableDynamicSMemPerBlock == NULL: - with gil: - raise RuntimeError('Function "cuOccupancyAvailableDynamicSMemPerBlock" not found') - err = ( __cuOccupancyAvailableDynamicSMemPerBlock)(dynamicSmemSize, func, numBlocks, blockSize) - return err -{{endif}} - -{{if 'cuOccupancyMaxPotentialClusterSize' in found_functions}} - -cdef CUresult _cuOccupancyMaxPotentialClusterSize(int* clusterSize, CUfunction func, const CUlaunchConfig* config) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuOccupancyMaxPotentialClusterSize - cuPythonInit() - if __cuOccupancyMaxPotentialClusterSize == NULL: - with gil: - raise RuntimeError('Function "cuOccupancyMaxPotentialClusterSize" not found') - err = ( __cuOccupancyMaxPotentialClusterSize)(clusterSize, func, config) - return err -{{endif}} - -{{if 'cuOccupancyMaxActiveClusters' in found_functions}} - -cdef CUresult _cuOccupancyMaxActiveClusters(int* numClusters, CUfunction func, const CUlaunchConfig* config) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuOccupancyMaxActiveClusters - cuPythonInit() - if __cuOccupancyMaxActiveClusters == NULL: - with gil: - raise RuntimeError('Function "cuOccupancyMaxActiveClusters" not found') - err = ( __cuOccupancyMaxActiveClusters)(numClusters, func, config) - return err -{{endif}} - -{{if 'cuTexRefSetArray' in found_functions}} - -cdef CUresult _cuTexRefSetArray(CUtexref hTexRef, CUarray hArray, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuTexRefSetArray - cuPythonInit() - if __cuTexRefSetArray == NULL: - with gil: - raise RuntimeError('Function "cuTexRefSetArray" not found') - err = ( __cuTexRefSetArray)(hTexRef, hArray, Flags) - return err -{{endif}} - -{{if 'cuTexRefSetMipmappedArray' in found_functions}} - -cdef CUresult _cuTexRefSetMipmappedArray(CUtexref hTexRef, CUmipmappedArray hMipmappedArray, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuTexRefSetMipmappedArray - cuPythonInit() - if __cuTexRefSetMipmappedArray == NULL: - with gil: - raise RuntimeError('Function "cuTexRefSetMipmappedArray" not found') - err = ( __cuTexRefSetMipmappedArray)(hTexRef, hMipmappedArray, Flags) - return err -{{endif}} - -{{if 'cuTexRefSetAddress_v2' in found_functions}} - -cdef CUresult _cuTexRefSetAddress_v2(size_t* ByteOffset, CUtexref hTexRef, CUdeviceptr dptr, size_t numbytes) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuTexRefSetAddress_v2 - cuPythonInit() - if __cuTexRefSetAddress_v2 == NULL: - with gil: - raise RuntimeError('Function "cuTexRefSetAddress_v2" not found') - err = ( __cuTexRefSetAddress_v2)(ByteOffset, hTexRef, dptr, numbytes) - return err -{{endif}} - -{{if 'cuTexRefSetAddress2D_v3' in found_functions}} - -cdef CUresult _cuTexRefSetAddress2D_v3(CUtexref hTexRef, const CUDA_ARRAY_DESCRIPTOR* desc, CUdeviceptr dptr, size_t Pitch) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuTexRefSetAddress2D_v3 - cuPythonInit() - if __cuTexRefSetAddress2D_v3 == NULL: - with gil: - raise RuntimeError('Function "cuTexRefSetAddress2D_v3" not found') - err = ( __cuTexRefSetAddress2D_v3)(hTexRef, desc, dptr, Pitch) - return err -{{endif}} - -{{if 'cuTexRefSetFormat' in found_functions}} - -cdef CUresult _cuTexRefSetFormat(CUtexref hTexRef, CUarray_format fmt, int NumPackedComponents) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuTexRefSetFormat - cuPythonInit() - if __cuTexRefSetFormat == NULL: - with gil: - raise RuntimeError('Function "cuTexRefSetFormat" not found') - err = ( __cuTexRefSetFormat)(hTexRef, fmt, NumPackedComponents) - return err -{{endif}} - -{{if 'cuTexRefSetAddressMode' in found_functions}} - -cdef CUresult _cuTexRefSetAddressMode(CUtexref hTexRef, int dim, CUaddress_mode am) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuTexRefSetAddressMode - cuPythonInit() - if __cuTexRefSetAddressMode == NULL: - with gil: - raise RuntimeError('Function "cuTexRefSetAddressMode" not found') - err = ( __cuTexRefSetAddressMode)(hTexRef, dim, am) - return err -{{endif}} - -{{if 'cuTexRefSetFilterMode' in found_functions}} - -cdef CUresult _cuTexRefSetFilterMode(CUtexref hTexRef, CUfilter_mode fm) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuTexRefSetFilterMode - cuPythonInit() - if __cuTexRefSetFilterMode == NULL: - with gil: - raise RuntimeError('Function "cuTexRefSetFilterMode" not found') - err = ( __cuTexRefSetFilterMode)(hTexRef, fm) - return err -{{endif}} - -{{if 'cuTexRefSetMipmapFilterMode' in found_functions}} - -cdef CUresult _cuTexRefSetMipmapFilterMode(CUtexref hTexRef, CUfilter_mode fm) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuTexRefSetMipmapFilterMode - cuPythonInit() - if __cuTexRefSetMipmapFilterMode == NULL: - with gil: - raise RuntimeError('Function "cuTexRefSetMipmapFilterMode" not found') - err = ( __cuTexRefSetMipmapFilterMode)(hTexRef, fm) - return err -{{endif}} - -{{if 'cuTexRefSetMipmapLevelBias' in found_functions}} - -cdef CUresult _cuTexRefSetMipmapLevelBias(CUtexref hTexRef, float bias) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuTexRefSetMipmapLevelBias - cuPythonInit() - if __cuTexRefSetMipmapLevelBias == NULL: - with gil: - raise RuntimeError('Function "cuTexRefSetMipmapLevelBias" not found') - err = ( __cuTexRefSetMipmapLevelBias)(hTexRef, bias) - return err -{{endif}} - -{{if 'cuTexRefSetMipmapLevelClamp' in found_functions}} - -cdef CUresult _cuTexRefSetMipmapLevelClamp(CUtexref hTexRef, float minMipmapLevelClamp, float maxMipmapLevelClamp) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuTexRefSetMipmapLevelClamp - cuPythonInit() - if __cuTexRefSetMipmapLevelClamp == NULL: - with gil: - raise RuntimeError('Function "cuTexRefSetMipmapLevelClamp" not found') - err = ( __cuTexRefSetMipmapLevelClamp)(hTexRef, minMipmapLevelClamp, maxMipmapLevelClamp) - return err -{{endif}} - -{{if 'cuTexRefSetMaxAnisotropy' in found_functions}} - -cdef CUresult _cuTexRefSetMaxAnisotropy(CUtexref hTexRef, unsigned int maxAniso) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuTexRefSetMaxAnisotropy - cuPythonInit() - if __cuTexRefSetMaxAnisotropy == NULL: - with gil: - raise RuntimeError('Function "cuTexRefSetMaxAnisotropy" not found') - err = ( __cuTexRefSetMaxAnisotropy)(hTexRef, maxAniso) - return err -{{endif}} - -{{if 'cuTexRefSetBorderColor' in found_functions}} - -cdef CUresult _cuTexRefSetBorderColor(CUtexref hTexRef, float* pBorderColor) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuTexRefSetBorderColor - cuPythonInit() - if __cuTexRefSetBorderColor == NULL: - with gil: - raise RuntimeError('Function "cuTexRefSetBorderColor" not found') - err = ( __cuTexRefSetBorderColor)(hTexRef, pBorderColor) - return err -{{endif}} - -{{if 'cuTexRefSetFlags' in found_functions}} - -cdef CUresult _cuTexRefSetFlags(CUtexref hTexRef, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuTexRefSetFlags - cuPythonInit() - if __cuTexRefSetFlags == NULL: - with gil: - raise RuntimeError('Function "cuTexRefSetFlags" not found') - err = ( __cuTexRefSetFlags)(hTexRef, Flags) - return err -{{endif}} - -{{if 'cuTexRefGetAddress_v2' in found_functions}} - -cdef CUresult _cuTexRefGetAddress_v2(CUdeviceptr* pdptr, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuTexRefGetAddress_v2 - cuPythonInit() - if __cuTexRefGetAddress_v2 == NULL: - with gil: - raise RuntimeError('Function "cuTexRefGetAddress_v2" not found') - err = ( __cuTexRefGetAddress_v2)(pdptr, hTexRef) - return err -{{endif}} - -{{if 'cuTexRefGetArray' in found_functions}} - -cdef CUresult _cuTexRefGetArray(CUarray* phArray, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuTexRefGetArray - cuPythonInit() - if __cuTexRefGetArray == NULL: - with gil: - raise RuntimeError('Function "cuTexRefGetArray" not found') - err = ( __cuTexRefGetArray)(phArray, hTexRef) - return err -{{endif}} - -{{if 'cuTexRefGetMipmappedArray' in found_functions}} - -cdef CUresult _cuTexRefGetMipmappedArray(CUmipmappedArray* phMipmappedArray, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuTexRefGetMipmappedArray - cuPythonInit() - if __cuTexRefGetMipmappedArray == NULL: - with gil: - raise RuntimeError('Function "cuTexRefGetMipmappedArray" not found') - err = ( __cuTexRefGetMipmappedArray)(phMipmappedArray, hTexRef) - return err -{{endif}} - -{{if 'cuTexRefGetAddressMode' in found_functions}} - -cdef CUresult _cuTexRefGetAddressMode(CUaddress_mode* pam, CUtexref hTexRef, int dim) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuTexRefGetAddressMode - cuPythonInit() - if __cuTexRefGetAddressMode == NULL: - with gil: - raise RuntimeError('Function "cuTexRefGetAddressMode" not found') - err = ( __cuTexRefGetAddressMode)(pam, hTexRef, dim) - return err -{{endif}} - -{{if 'cuTexRefGetFilterMode' in found_functions}} - -cdef CUresult _cuTexRefGetFilterMode(CUfilter_mode* pfm, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuTexRefGetFilterMode - cuPythonInit() - if __cuTexRefGetFilterMode == NULL: - with gil: - raise RuntimeError('Function "cuTexRefGetFilterMode" not found') - err = ( __cuTexRefGetFilterMode)(pfm, hTexRef) - return err -{{endif}} - -{{if 'cuTexRefGetFormat' in found_functions}} - -cdef CUresult _cuTexRefGetFormat(CUarray_format* pFormat, int* pNumChannels, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuTexRefGetFormat - cuPythonInit() - if __cuTexRefGetFormat == NULL: - with gil: - raise RuntimeError('Function "cuTexRefGetFormat" not found') - err = ( __cuTexRefGetFormat)(pFormat, pNumChannels, hTexRef) - return err -{{endif}} - -{{if 'cuTexRefGetMipmapFilterMode' in found_functions}} - -cdef CUresult _cuTexRefGetMipmapFilterMode(CUfilter_mode* pfm, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuTexRefGetMipmapFilterMode - cuPythonInit() - if __cuTexRefGetMipmapFilterMode == NULL: - with gil: - raise RuntimeError('Function "cuTexRefGetMipmapFilterMode" not found') - err = ( __cuTexRefGetMipmapFilterMode)(pfm, hTexRef) - return err -{{endif}} - -{{if 'cuTexRefGetMipmapLevelBias' in found_functions}} - -cdef CUresult _cuTexRefGetMipmapLevelBias(float* pbias, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuTexRefGetMipmapLevelBias - cuPythonInit() - if __cuTexRefGetMipmapLevelBias == NULL: - with gil: - raise RuntimeError('Function "cuTexRefGetMipmapLevelBias" not found') - err = ( __cuTexRefGetMipmapLevelBias)(pbias, hTexRef) - return err -{{endif}} - -{{if 'cuTexRefGetMipmapLevelClamp' in found_functions}} - -cdef CUresult _cuTexRefGetMipmapLevelClamp(float* pminMipmapLevelClamp, float* pmaxMipmapLevelClamp, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuTexRefGetMipmapLevelClamp - cuPythonInit() - if __cuTexRefGetMipmapLevelClamp == NULL: - with gil: - raise RuntimeError('Function "cuTexRefGetMipmapLevelClamp" not found') - err = ( __cuTexRefGetMipmapLevelClamp)(pminMipmapLevelClamp, pmaxMipmapLevelClamp, hTexRef) - return err -{{endif}} - -{{if 'cuTexRefGetMaxAnisotropy' in found_functions}} - -cdef CUresult _cuTexRefGetMaxAnisotropy(int* pmaxAniso, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuTexRefGetMaxAnisotropy - cuPythonInit() - if __cuTexRefGetMaxAnisotropy == NULL: - with gil: - raise RuntimeError('Function "cuTexRefGetMaxAnisotropy" not found') - err = ( __cuTexRefGetMaxAnisotropy)(pmaxAniso, hTexRef) - return err -{{endif}} - -{{if 'cuTexRefGetBorderColor' in found_functions}} - -cdef CUresult _cuTexRefGetBorderColor(float* pBorderColor, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuTexRefGetBorderColor - cuPythonInit() - if __cuTexRefGetBorderColor == NULL: - with gil: - raise RuntimeError('Function "cuTexRefGetBorderColor" not found') - err = ( __cuTexRefGetBorderColor)(pBorderColor, hTexRef) - return err -{{endif}} - -{{if 'cuTexRefGetFlags' in found_functions}} - -cdef CUresult _cuTexRefGetFlags(unsigned int* pFlags, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuTexRefGetFlags - cuPythonInit() - if __cuTexRefGetFlags == NULL: - with gil: - raise RuntimeError('Function "cuTexRefGetFlags" not found') - err = ( __cuTexRefGetFlags)(pFlags, hTexRef) - return err -{{endif}} - -{{if 'cuTexRefCreate' in found_functions}} - -cdef CUresult _cuTexRefCreate(CUtexref* pTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuTexRefCreate - cuPythonInit() - if __cuTexRefCreate == NULL: - with gil: - raise RuntimeError('Function "cuTexRefCreate" not found') - err = ( __cuTexRefCreate)(pTexRef) - return err -{{endif}} - -{{if 'cuTexRefDestroy' in found_functions}} - -cdef CUresult _cuTexRefDestroy(CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuTexRefDestroy - cuPythonInit() - if __cuTexRefDestroy == NULL: - with gil: - raise RuntimeError('Function "cuTexRefDestroy" not found') - err = ( __cuTexRefDestroy)(hTexRef) - return err -{{endif}} - -{{if 'cuSurfRefSetArray' in found_functions}} - -cdef CUresult _cuSurfRefSetArray(CUsurfref hSurfRef, CUarray hArray, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuSurfRefSetArray - cuPythonInit() - if __cuSurfRefSetArray == NULL: - with gil: - raise RuntimeError('Function "cuSurfRefSetArray" not found') - err = ( __cuSurfRefSetArray)(hSurfRef, hArray, Flags) - return err -{{endif}} - -{{if 'cuSurfRefGetArray' in found_functions}} - -cdef CUresult _cuSurfRefGetArray(CUarray* phArray, CUsurfref hSurfRef) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuSurfRefGetArray - cuPythonInit() - if __cuSurfRefGetArray == NULL: - with gil: - raise RuntimeError('Function "cuSurfRefGetArray" not found') - err = ( __cuSurfRefGetArray)(phArray, hSurfRef) - return err -{{endif}} - -{{if 'cuTexObjectCreate' in found_functions}} - -cdef CUresult _cuTexObjectCreate(CUtexObject* pTexObject, const CUDA_RESOURCE_DESC* pResDesc, const CUDA_TEXTURE_DESC* pTexDesc, const CUDA_RESOURCE_VIEW_DESC* pResViewDesc) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuTexObjectCreate - cuPythonInit() - if __cuTexObjectCreate == NULL: - with gil: - raise RuntimeError('Function "cuTexObjectCreate" not found') - err = ( __cuTexObjectCreate)(pTexObject, pResDesc, pTexDesc, pResViewDesc) - return err -{{endif}} - -{{if 'cuTexObjectDestroy' in found_functions}} - -cdef CUresult _cuTexObjectDestroy(CUtexObject texObject) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuTexObjectDestroy - cuPythonInit() - if __cuTexObjectDestroy == NULL: - with gil: - raise RuntimeError('Function "cuTexObjectDestroy" not found') - err = ( __cuTexObjectDestroy)(texObject) - return err -{{endif}} - -{{if 'cuTexObjectGetResourceDesc' in found_functions}} - -cdef CUresult _cuTexObjectGetResourceDesc(CUDA_RESOURCE_DESC* pResDesc, CUtexObject texObject) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuTexObjectGetResourceDesc - cuPythonInit() - if __cuTexObjectGetResourceDesc == NULL: - with gil: - raise RuntimeError('Function "cuTexObjectGetResourceDesc" not found') - err = ( __cuTexObjectGetResourceDesc)(pResDesc, texObject) - return err -{{endif}} - -{{if 'cuTexObjectGetTextureDesc' in found_functions}} - -cdef CUresult _cuTexObjectGetTextureDesc(CUDA_TEXTURE_DESC* pTexDesc, CUtexObject texObject) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuTexObjectGetTextureDesc - cuPythonInit() - if __cuTexObjectGetTextureDesc == NULL: - with gil: - raise RuntimeError('Function "cuTexObjectGetTextureDesc" not found') - err = ( __cuTexObjectGetTextureDesc)(pTexDesc, texObject) - return err -{{endif}} - -{{if 'cuTexObjectGetResourceViewDesc' in found_functions}} - -cdef CUresult _cuTexObjectGetResourceViewDesc(CUDA_RESOURCE_VIEW_DESC* pResViewDesc, CUtexObject texObject) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuTexObjectGetResourceViewDesc - cuPythonInit() - if __cuTexObjectGetResourceViewDesc == NULL: - with gil: - raise RuntimeError('Function "cuTexObjectGetResourceViewDesc" not found') - err = ( __cuTexObjectGetResourceViewDesc)(pResViewDesc, texObject) - return err -{{endif}} - -{{if 'cuSurfObjectCreate' in found_functions}} - -cdef CUresult _cuSurfObjectCreate(CUsurfObject* pSurfObject, const CUDA_RESOURCE_DESC* pResDesc) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuSurfObjectCreate - cuPythonInit() - if __cuSurfObjectCreate == NULL: - with gil: - raise RuntimeError('Function "cuSurfObjectCreate" not found') - err = ( __cuSurfObjectCreate)(pSurfObject, pResDesc) - return err -{{endif}} - -{{if 'cuSurfObjectDestroy' in found_functions}} - -cdef CUresult _cuSurfObjectDestroy(CUsurfObject surfObject) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuSurfObjectDestroy - cuPythonInit() - if __cuSurfObjectDestroy == NULL: - with gil: - raise RuntimeError('Function "cuSurfObjectDestroy" not found') - err = ( __cuSurfObjectDestroy)(surfObject) - return err -{{endif}} - -{{if 'cuSurfObjectGetResourceDesc' in found_functions}} - -cdef CUresult _cuSurfObjectGetResourceDesc(CUDA_RESOURCE_DESC* pResDesc, CUsurfObject surfObject) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuSurfObjectGetResourceDesc - cuPythonInit() - if __cuSurfObjectGetResourceDesc == NULL: - with gil: - raise RuntimeError('Function "cuSurfObjectGetResourceDesc" not found') - err = ( __cuSurfObjectGetResourceDesc)(pResDesc, surfObject) - return err -{{endif}} - -{{if 'cuTensorMapEncodeTiled' in found_functions}} - -cdef CUresult _cuTensorMapEncodeTiled(CUtensorMap* tensorMap, CUtensorMapDataType tensorDataType, cuuint32_t tensorRank, void* globalAddress, const cuuint64_t* globalDim, const cuuint64_t* globalStrides, const cuuint32_t* boxDim, const cuuint32_t* elementStrides, CUtensorMapInterleave interleave, CUtensorMapSwizzle swizzle, CUtensorMapL2promotion l2Promotion, CUtensorMapFloatOOBfill oobFill) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuTensorMapEncodeTiled - cuPythonInit() - if __cuTensorMapEncodeTiled == NULL: - with gil: - raise RuntimeError('Function "cuTensorMapEncodeTiled" not found') - err = ( __cuTensorMapEncodeTiled)(tensorMap, tensorDataType, tensorRank, globalAddress, globalDim, globalStrides, boxDim, elementStrides, interleave, swizzle, l2Promotion, oobFill) - return err -{{endif}} - -{{if 'cuTensorMapEncodeIm2col' in found_functions}} - -cdef CUresult _cuTensorMapEncodeIm2col(CUtensorMap* tensorMap, CUtensorMapDataType tensorDataType, cuuint32_t tensorRank, void* globalAddress, const cuuint64_t* globalDim, const cuuint64_t* globalStrides, const int* pixelBoxLowerCorner, const int* pixelBoxUpperCorner, cuuint32_t channelsPerPixel, cuuint32_t pixelsPerColumn, const cuuint32_t* elementStrides, CUtensorMapInterleave interleave, CUtensorMapSwizzle swizzle, CUtensorMapL2promotion l2Promotion, CUtensorMapFloatOOBfill oobFill) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuTensorMapEncodeIm2col - cuPythonInit() - if __cuTensorMapEncodeIm2col == NULL: - with gil: - raise RuntimeError('Function "cuTensorMapEncodeIm2col" not found') - err = ( __cuTensorMapEncodeIm2col)(tensorMap, tensorDataType, tensorRank, globalAddress, globalDim, globalStrides, pixelBoxLowerCorner, pixelBoxUpperCorner, channelsPerPixel, pixelsPerColumn, elementStrides, interleave, swizzle, l2Promotion, oobFill) - return err -{{endif}} - -{{if 'cuTensorMapReplaceAddress' in found_functions}} - -cdef CUresult _cuTensorMapReplaceAddress(CUtensorMap* tensorMap, void* globalAddress) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuTensorMapReplaceAddress - cuPythonInit() - if __cuTensorMapReplaceAddress == NULL: - with gil: - raise RuntimeError('Function "cuTensorMapReplaceAddress" not found') - err = ( __cuTensorMapReplaceAddress)(tensorMap, globalAddress) - return err -{{endif}} - -{{if 'cuDeviceCanAccessPeer' in found_functions}} - -cdef CUresult _cuDeviceCanAccessPeer(int* canAccessPeer, CUdevice dev, CUdevice peerDev) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuDeviceCanAccessPeer - cuPythonInit() - if __cuDeviceCanAccessPeer == NULL: - with gil: - raise RuntimeError('Function "cuDeviceCanAccessPeer" not found') - err = ( __cuDeviceCanAccessPeer)(canAccessPeer, dev, peerDev) - return err -{{endif}} - -{{if 'cuCtxEnablePeerAccess' in found_functions}} - -cdef CUresult _cuCtxEnablePeerAccess(CUcontext peerContext, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuCtxEnablePeerAccess - cuPythonInit() - if __cuCtxEnablePeerAccess == NULL: - with gil: - raise RuntimeError('Function "cuCtxEnablePeerAccess" not found') - err = ( __cuCtxEnablePeerAccess)(peerContext, Flags) - return err -{{endif}} - -{{if 'cuCtxDisablePeerAccess' in found_functions}} - -cdef CUresult _cuCtxDisablePeerAccess(CUcontext peerContext) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuCtxDisablePeerAccess - cuPythonInit() - if __cuCtxDisablePeerAccess == NULL: - with gil: - raise RuntimeError('Function "cuCtxDisablePeerAccess" not found') - err = ( __cuCtxDisablePeerAccess)(peerContext) - return err -{{endif}} - -{{if 'cuDeviceGetP2PAttribute' in found_functions}} - -cdef CUresult _cuDeviceGetP2PAttribute(int* value, CUdevice_P2PAttribute attrib, CUdevice srcDevice, CUdevice dstDevice) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuDeviceGetP2PAttribute - cuPythonInit() - if __cuDeviceGetP2PAttribute == NULL: - with gil: - raise RuntimeError('Function "cuDeviceGetP2PAttribute" not found') - err = ( __cuDeviceGetP2PAttribute)(value, attrib, srcDevice, dstDevice) - return err -{{endif}} - -{{if 'cuGraphicsUnregisterResource' in found_functions}} - -cdef CUresult _cuGraphicsUnregisterResource(CUgraphicsResource resource) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphicsUnregisterResource - cuPythonInit() - if __cuGraphicsUnregisterResource == NULL: - with gil: - raise RuntimeError('Function "cuGraphicsUnregisterResource" not found') - err = ( __cuGraphicsUnregisterResource)(resource) - return err -{{endif}} - -{{if 'cuGraphicsSubResourceGetMappedArray' in found_functions}} - -cdef CUresult _cuGraphicsSubResourceGetMappedArray(CUarray* pArray, CUgraphicsResource resource, unsigned int arrayIndex, unsigned int mipLevel) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphicsSubResourceGetMappedArray - cuPythonInit() - if __cuGraphicsSubResourceGetMappedArray == NULL: - with gil: - raise RuntimeError('Function "cuGraphicsSubResourceGetMappedArray" not found') - err = ( __cuGraphicsSubResourceGetMappedArray)(pArray, resource, arrayIndex, mipLevel) - return err -{{endif}} - -{{if 'cuGraphicsResourceGetMappedMipmappedArray' in found_functions}} - -cdef CUresult _cuGraphicsResourceGetMappedMipmappedArray(CUmipmappedArray* pMipmappedArray, CUgraphicsResource resource) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphicsResourceGetMappedMipmappedArray - cuPythonInit() - if __cuGraphicsResourceGetMappedMipmappedArray == NULL: - with gil: - raise RuntimeError('Function "cuGraphicsResourceGetMappedMipmappedArray" not found') - err = ( __cuGraphicsResourceGetMappedMipmappedArray)(pMipmappedArray, resource) - return err -{{endif}} - -{{if 'cuGraphicsResourceGetMappedPointer_v2' in found_functions}} - -cdef CUresult _cuGraphicsResourceGetMappedPointer_v2(CUdeviceptr* pDevPtr, size_t* pSize, CUgraphicsResource resource) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphicsResourceGetMappedPointer_v2 - cuPythonInit() - if __cuGraphicsResourceGetMappedPointer_v2 == NULL: - with gil: - raise RuntimeError('Function "cuGraphicsResourceGetMappedPointer_v2" not found') - err = ( __cuGraphicsResourceGetMappedPointer_v2)(pDevPtr, pSize, resource) - return err -{{endif}} - -{{if 'cuGraphicsResourceSetMapFlags_v2' in found_functions}} - -cdef CUresult _cuGraphicsResourceSetMapFlags_v2(CUgraphicsResource resource, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphicsResourceSetMapFlags_v2 - cuPythonInit() - if __cuGraphicsResourceSetMapFlags_v2 == NULL: - with gil: - raise RuntimeError('Function "cuGraphicsResourceSetMapFlags_v2" not found') - err = ( __cuGraphicsResourceSetMapFlags_v2)(resource, flags) - return err -{{endif}} - -{{if 'cuGraphicsMapResources' in found_functions}} - -cdef CUresult _cuGraphicsMapResources(unsigned int count, CUgraphicsResource* resources, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphicsMapResources - cuPythonInit() - if __cuGraphicsMapResources == NULL: - with gil: - raise RuntimeError('Function "cuGraphicsMapResources" not found') - err = ( __cuGraphicsMapResources)(count, resources, hStream) - return err -{{endif}} - -{{if 'cuGraphicsUnmapResources' in found_functions}} - -cdef CUresult _cuGraphicsUnmapResources(unsigned int count, CUgraphicsResource* resources, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphicsUnmapResources - cuPythonInit() - if __cuGraphicsUnmapResources == NULL: - with gil: - raise RuntimeError('Function "cuGraphicsUnmapResources" not found') - err = ( __cuGraphicsUnmapResources)(count, resources, hStream) - return err -{{endif}} - -{{if 'cuGetProcAddress_v2' in found_functions}} - -cdef CUresult _cuGetProcAddress_v2(const char* symbol, void** pfn, int cudaVersion, cuuint64_t flags, CUdriverProcAddressQueryResult* symbolStatus) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGetProcAddress_v2 - cuPythonInit() - if __cuGetProcAddress_v2 == NULL: - with gil: - raise RuntimeError('Function "cuGetProcAddress_v2" not found') - err = ( __cuGetProcAddress_v2)(symbol, pfn, cudaVersion, flags, symbolStatus) - return err -{{endif}} - -{{if 'cuCoredumpGetAttribute' in found_functions}} - -cdef CUresult _cuCoredumpGetAttribute(CUcoredumpSettings attrib, void* value, size_t* size) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuCoredumpGetAttribute - cuPythonInit() - if __cuCoredumpGetAttribute == NULL: - with gil: - raise RuntimeError('Function "cuCoredumpGetAttribute" not found') - err = ( __cuCoredumpGetAttribute)(attrib, value, size) - return err -{{endif}} - -{{if 'cuCoredumpGetAttributeGlobal' in found_functions}} - -cdef CUresult _cuCoredumpGetAttributeGlobal(CUcoredumpSettings attrib, void* value, size_t* size) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuCoredumpGetAttributeGlobal - cuPythonInit() - if __cuCoredumpGetAttributeGlobal == NULL: - with gil: - raise RuntimeError('Function "cuCoredumpGetAttributeGlobal" not found') - err = ( __cuCoredumpGetAttributeGlobal)(attrib, value, size) - return err -{{endif}} - -{{if 'cuCoredumpSetAttribute' in found_functions}} - -cdef CUresult _cuCoredumpSetAttribute(CUcoredumpSettings attrib, void* value, size_t* size) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuCoredumpSetAttribute - cuPythonInit() - if __cuCoredumpSetAttribute == NULL: - with gil: - raise RuntimeError('Function "cuCoredumpSetAttribute" not found') - err = ( __cuCoredumpSetAttribute)(attrib, value, size) - return err -{{endif}} - -{{if 'cuCoredumpSetAttributeGlobal' in found_functions}} - -cdef CUresult _cuCoredumpSetAttributeGlobal(CUcoredumpSettings attrib, void* value, size_t* size) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuCoredumpSetAttributeGlobal - cuPythonInit() - if __cuCoredumpSetAttributeGlobal == NULL: - with gil: - raise RuntimeError('Function "cuCoredumpSetAttributeGlobal" not found') - err = ( __cuCoredumpSetAttributeGlobal)(attrib, value, size) - return err -{{endif}} - -{{if 'cuGetExportTable' in found_functions}} - -cdef CUresult _cuGetExportTable(const void** ppExportTable, const CUuuid* pExportTableId) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGetExportTable - cuPythonInit() - if __cuGetExportTable == NULL: - with gil: - raise RuntimeError('Function "cuGetExportTable" not found') - err = ( __cuGetExportTable)(ppExportTable, pExportTableId) - return err -{{endif}} - -{{if 'cuGreenCtxCreate' in found_functions}} - -cdef CUresult _cuGreenCtxCreate(CUgreenCtx* phCtx, CUdevResourceDesc desc, CUdevice dev, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGreenCtxCreate - cuPythonInit() - if __cuGreenCtxCreate == NULL: - with gil: - raise RuntimeError('Function "cuGreenCtxCreate" not found') - err = ( __cuGreenCtxCreate)(phCtx, desc, dev, flags) - return err -{{endif}} - -{{if 'cuGreenCtxDestroy' in found_functions}} - -cdef CUresult _cuGreenCtxDestroy(CUgreenCtx hCtx) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGreenCtxDestroy - cuPythonInit() - if __cuGreenCtxDestroy == NULL: - with gil: - raise RuntimeError('Function "cuGreenCtxDestroy" not found') - err = ( __cuGreenCtxDestroy)(hCtx) - return err -{{endif}} - -{{if 'cuCtxFromGreenCtx' in found_functions}} - -cdef CUresult _cuCtxFromGreenCtx(CUcontext* pContext, CUgreenCtx hCtx) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuCtxFromGreenCtx - cuPythonInit() - if __cuCtxFromGreenCtx == NULL: - with gil: - raise RuntimeError('Function "cuCtxFromGreenCtx" not found') - err = ( __cuCtxFromGreenCtx)(pContext, hCtx) - return err -{{endif}} - -{{if 'cuDeviceGetDevResource' in found_functions}} - -cdef CUresult _cuDeviceGetDevResource(CUdevice device, CUdevResource* resource, CUdevResourceType typename) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuDeviceGetDevResource - cuPythonInit() - if __cuDeviceGetDevResource == NULL: - with gil: - raise RuntimeError('Function "cuDeviceGetDevResource" not found') - err = ( __cuDeviceGetDevResource)(device, resource, typename) - return err -{{endif}} - -{{if 'cuCtxGetDevResource' in found_functions}} - -cdef CUresult _cuCtxGetDevResource(CUcontext hCtx, CUdevResource* resource, CUdevResourceType typename) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuCtxGetDevResource - cuPythonInit() - if __cuCtxGetDevResource == NULL: - with gil: - raise RuntimeError('Function "cuCtxGetDevResource" not found') - err = ( __cuCtxGetDevResource)(hCtx, resource, typename) - return err -{{endif}} - -{{if 'cuGreenCtxGetDevResource' in found_functions}} - -cdef CUresult _cuGreenCtxGetDevResource(CUgreenCtx hCtx, CUdevResource* resource, CUdevResourceType typename) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGreenCtxGetDevResource - cuPythonInit() - if __cuGreenCtxGetDevResource == NULL: - with gil: - raise RuntimeError('Function "cuGreenCtxGetDevResource" not found') - err = ( __cuGreenCtxGetDevResource)(hCtx, resource, typename) - return err -{{endif}} - -{{if 'cuDevSmResourceSplitByCount' in found_functions}} - -cdef CUresult _cuDevSmResourceSplitByCount(CUdevResource* result, unsigned int* nbGroups, const CUdevResource* input, CUdevResource* remaining, unsigned int useFlags, unsigned int minCount) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuDevSmResourceSplitByCount - cuPythonInit() - if __cuDevSmResourceSplitByCount == NULL: - with gil: - raise RuntimeError('Function "cuDevSmResourceSplitByCount" not found') - err = ( __cuDevSmResourceSplitByCount)(result, nbGroups, input, remaining, useFlags, minCount) - return err -{{endif}} - -{{if 'cuDevResourceGenerateDesc' in found_functions}} - -cdef CUresult _cuDevResourceGenerateDesc(CUdevResourceDesc* phDesc, CUdevResource* resources, unsigned int nbResources) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuDevResourceGenerateDesc - cuPythonInit() - if __cuDevResourceGenerateDesc == NULL: - with gil: - raise RuntimeError('Function "cuDevResourceGenerateDesc" not found') - err = ( __cuDevResourceGenerateDesc)(phDesc, resources, nbResources) - return err -{{endif}} - -{{if 'cuGreenCtxRecordEvent' in found_functions}} - -cdef CUresult _cuGreenCtxRecordEvent(CUgreenCtx hCtx, CUevent hEvent) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGreenCtxRecordEvent - cuPythonInit() - if __cuGreenCtxRecordEvent == NULL: - with gil: - raise RuntimeError('Function "cuGreenCtxRecordEvent" not found') - err = ( __cuGreenCtxRecordEvent)(hCtx, hEvent) - return err -{{endif}} - -{{if 'cuGreenCtxWaitEvent' in found_functions}} - -cdef CUresult _cuGreenCtxWaitEvent(CUgreenCtx hCtx, CUevent hEvent) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGreenCtxWaitEvent - cuPythonInit() - if __cuGreenCtxWaitEvent == NULL: - with gil: - raise RuntimeError('Function "cuGreenCtxWaitEvent" not found') - err = ( __cuGreenCtxWaitEvent)(hCtx, hEvent) - return err -{{endif}} - -{{if 'cuStreamGetGreenCtx' in found_functions}} - -cdef CUresult _cuStreamGetGreenCtx(CUstream hStream, CUgreenCtx* phCtx) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuStreamGetGreenCtx - cuPythonInit() - if __cuStreamGetGreenCtx == NULL: - with gil: - raise RuntimeError('Function "cuStreamGetGreenCtx" not found') - err = ( __cuStreamGetGreenCtx)(hStream, phCtx) - return err -{{endif}} - -{{if 'cuGreenCtxStreamCreate' in found_functions}} - -cdef CUresult _cuGreenCtxStreamCreate(CUstream* phStream, CUgreenCtx greenCtx, unsigned int flags, int priority) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGreenCtxStreamCreate - cuPythonInit() - if __cuGreenCtxStreamCreate == NULL: - with gil: - raise RuntimeError('Function "cuGreenCtxStreamCreate" not found') - err = ( __cuGreenCtxStreamCreate)(phStream, greenCtx, flags, priority) - return err -{{endif}} - -{{if 'cuProfilerStart' in found_functions}} - -cdef CUresult _cuProfilerStart() except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuProfilerStart - cuPythonInit() - if __cuProfilerStart == NULL: - with gil: - raise RuntimeError('Function "cuProfilerStart" not found') - err = ( __cuProfilerStart)() - return err -{{endif}} - -{{if 'cuProfilerStop' in found_functions}} - -cdef CUresult _cuProfilerStop() except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuProfilerStop - cuPythonInit() - if __cuProfilerStop == NULL: - with gil: - raise RuntimeError('Function "cuProfilerStop" not found') - err = ( __cuProfilerStop)() - return err -{{endif}} - -{{if True}} - -cdef CUresult _cuGraphicsEGLRegisterImage(CUgraphicsResource* pCudaResource, EGLImageKHR image, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphicsEGLRegisterImage - cuPythonInit() - if __cuGraphicsEGLRegisterImage == NULL: - with gil: - raise RuntimeError('Function "cuGraphicsEGLRegisterImage" not found') - err = ( __cuGraphicsEGLRegisterImage)(pCudaResource, image, flags) - return err -{{endif}} - -{{if True}} - -cdef CUresult _cuEGLStreamConsumerConnect(CUeglStreamConnection* conn, EGLStreamKHR stream) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuEGLStreamConsumerConnect - cuPythonInit() - if __cuEGLStreamConsumerConnect == NULL: - with gil: - raise RuntimeError('Function "cuEGLStreamConsumerConnect" not found') - err = ( __cuEGLStreamConsumerConnect)(conn, stream) - return err -{{endif}} - -{{if True}} - -cdef CUresult _cuEGLStreamConsumerConnectWithFlags(CUeglStreamConnection* conn, EGLStreamKHR stream, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuEGLStreamConsumerConnectWithFlags - cuPythonInit() - if __cuEGLStreamConsumerConnectWithFlags == NULL: - with gil: - raise RuntimeError('Function "cuEGLStreamConsumerConnectWithFlags" not found') - err = ( __cuEGLStreamConsumerConnectWithFlags)(conn, stream, flags) - return err -{{endif}} - -{{if True}} - -cdef CUresult _cuEGLStreamConsumerDisconnect(CUeglStreamConnection* conn) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuEGLStreamConsumerDisconnect - cuPythonInit() - if __cuEGLStreamConsumerDisconnect == NULL: - with gil: - raise RuntimeError('Function "cuEGLStreamConsumerDisconnect" not found') - err = ( __cuEGLStreamConsumerDisconnect)(conn) - return err -{{endif}} - -{{if True}} - -cdef CUresult _cuEGLStreamConsumerAcquireFrame(CUeglStreamConnection* conn, CUgraphicsResource* pCudaResource, CUstream* pStream, unsigned int timeout) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuEGLStreamConsumerAcquireFrame - cuPythonInit() - if __cuEGLStreamConsumerAcquireFrame == NULL: - with gil: - raise RuntimeError('Function "cuEGLStreamConsumerAcquireFrame" not found') - err = ( __cuEGLStreamConsumerAcquireFrame)(conn, pCudaResource, pStream, timeout) - return err -{{endif}} - -{{if True}} - -cdef CUresult _cuEGLStreamConsumerReleaseFrame(CUeglStreamConnection* conn, CUgraphicsResource pCudaResource, CUstream* pStream) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuEGLStreamConsumerReleaseFrame - cuPythonInit() - if __cuEGLStreamConsumerReleaseFrame == NULL: - with gil: - raise RuntimeError('Function "cuEGLStreamConsumerReleaseFrame" not found') - err = ( __cuEGLStreamConsumerReleaseFrame)(conn, pCudaResource, pStream) - return err -{{endif}} - -{{if True}} - -cdef CUresult _cuEGLStreamProducerConnect(CUeglStreamConnection* conn, EGLStreamKHR stream, EGLint width, EGLint height) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuEGLStreamProducerConnect - cuPythonInit() - if __cuEGLStreamProducerConnect == NULL: - with gil: - raise RuntimeError('Function "cuEGLStreamProducerConnect" not found') - err = ( __cuEGLStreamProducerConnect)(conn, stream, width, height) - return err -{{endif}} - -{{if True}} - -cdef CUresult _cuEGLStreamProducerDisconnect(CUeglStreamConnection* conn) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuEGLStreamProducerDisconnect - cuPythonInit() - if __cuEGLStreamProducerDisconnect == NULL: - with gil: - raise RuntimeError('Function "cuEGLStreamProducerDisconnect" not found') - err = ( __cuEGLStreamProducerDisconnect)(conn) - return err -{{endif}} - -{{if True}} - -cdef CUresult _cuEGLStreamProducerPresentFrame(CUeglStreamConnection* conn, CUeglFrame eglframe, CUstream* pStream) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuEGLStreamProducerPresentFrame - cuPythonInit() - if __cuEGLStreamProducerPresentFrame == NULL: - with gil: - raise RuntimeError('Function "cuEGLStreamProducerPresentFrame" not found') - err = ( __cuEGLStreamProducerPresentFrame)(conn, eglframe, pStream) - return err -{{endif}} - -{{if True}} - -cdef CUresult _cuEGLStreamProducerReturnFrame(CUeglStreamConnection* conn, CUeglFrame* eglframe, CUstream* pStream) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuEGLStreamProducerReturnFrame - cuPythonInit() - if __cuEGLStreamProducerReturnFrame == NULL: - with gil: - raise RuntimeError('Function "cuEGLStreamProducerReturnFrame" not found') - err = ( __cuEGLStreamProducerReturnFrame)(conn, eglframe, pStream) - return err -{{endif}} - -{{if True}} - -cdef CUresult _cuGraphicsResourceGetMappedEglFrame(CUeglFrame* eglFrame, CUgraphicsResource resource, unsigned int index, unsigned int mipLevel) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphicsResourceGetMappedEglFrame - cuPythonInit() - if __cuGraphicsResourceGetMappedEglFrame == NULL: - with gil: - raise RuntimeError('Function "cuGraphicsResourceGetMappedEglFrame" not found') - err = ( __cuGraphicsResourceGetMappedEglFrame)(eglFrame, resource, index, mipLevel) - return err -{{endif}} - -{{if True}} - -cdef CUresult _cuEventCreateFromEGLSync(CUevent* phEvent, EGLSyncKHR eglSync, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuEventCreateFromEGLSync - cuPythonInit() - if __cuEventCreateFromEGLSync == NULL: - with gil: - raise RuntimeError('Function "cuEventCreateFromEGLSync" not found') - err = ( __cuEventCreateFromEGLSync)(phEvent, eglSync, flags) - return err -{{endif}} - -{{if True}} - -cdef CUresult _cuGraphicsGLRegisterBuffer(CUgraphicsResource* pCudaResource, GLuint buffer, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphicsGLRegisterBuffer - cuPythonInit() - if __cuGraphicsGLRegisterBuffer == NULL: - with gil: - raise RuntimeError('Function "cuGraphicsGLRegisterBuffer" not found') - err = ( __cuGraphicsGLRegisterBuffer)(pCudaResource, buffer, Flags) - return err -{{endif}} - -{{if True}} - -cdef CUresult _cuGraphicsGLRegisterImage(CUgraphicsResource* pCudaResource, GLuint image, GLenum target, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphicsGLRegisterImage - cuPythonInit() - if __cuGraphicsGLRegisterImage == NULL: - with gil: - raise RuntimeError('Function "cuGraphicsGLRegisterImage" not found') - err = ( __cuGraphicsGLRegisterImage)(pCudaResource, image, target, Flags) - return err -{{endif}} - -{{if True}} - -cdef CUresult _cuGLGetDevices_v2(unsigned int* pCudaDeviceCount, CUdevice* pCudaDevices, unsigned int cudaDeviceCount, CUGLDeviceList deviceList) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGLGetDevices_v2 - cuPythonInit() - if __cuGLGetDevices_v2 == NULL: - with gil: - raise RuntimeError('Function "cuGLGetDevices_v2" not found') - err = ( __cuGLGetDevices_v2)(pCudaDeviceCount, pCudaDevices, cudaDeviceCount, deviceList) - return err -{{endif}} - -{{if True}} - -cdef CUresult _cuVDPAUGetDevice(CUdevice* pDevice, VdpDevice vdpDevice, VdpGetProcAddress* vdpGetProcAddress) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuVDPAUGetDevice - cuPythonInit() - if __cuVDPAUGetDevice == NULL: - with gil: - raise RuntimeError('Function "cuVDPAUGetDevice" not found') - err = ( __cuVDPAUGetDevice)(pDevice, vdpDevice, vdpGetProcAddress) - return err -{{endif}} - -{{if True}} - -cdef CUresult _cuVDPAUCtxCreate_v2(CUcontext* pCtx, unsigned int flags, CUdevice device, VdpDevice vdpDevice, VdpGetProcAddress* vdpGetProcAddress) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuVDPAUCtxCreate_v2 - cuPythonInit() - if __cuVDPAUCtxCreate_v2 == NULL: - with gil: - raise RuntimeError('Function "cuVDPAUCtxCreate_v2" not found') - err = ( __cuVDPAUCtxCreate_v2)(pCtx, flags, device, vdpDevice, vdpGetProcAddress) - return err -{{endif}} - -{{if True}} - -cdef CUresult _cuGraphicsVDPAURegisterVideoSurface(CUgraphicsResource* pCudaResource, VdpVideoSurface vdpSurface, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphicsVDPAURegisterVideoSurface - cuPythonInit() - if __cuGraphicsVDPAURegisterVideoSurface == NULL: - with gil: - raise RuntimeError('Function "cuGraphicsVDPAURegisterVideoSurface" not found') - err = ( __cuGraphicsVDPAURegisterVideoSurface)(pCudaResource, vdpSurface, flags) - return err -{{endif}} - -{{if True}} - -cdef CUresult _cuGraphicsVDPAURegisterOutputSurface(CUgraphicsResource* pCudaResource, VdpOutputSurface vdpSurface, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - global __cuGraphicsVDPAURegisterOutputSurface - cuPythonInit() - if __cuGraphicsVDPAURegisterOutputSurface == NULL: - with gil: - raise RuntimeError('Function "cuGraphicsVDPAURegisterOutputSurface" not found') - err = ( __cuGraphicsVDPAURegisterOutputSurface)(pCudaResource, vdpSurface, flags) - return err -{{endif}} diff --git a/cuda/_cuda/cnvrtc.pyx.in b/cuda/_cuda/cnvrtc.pyx.in deleted file mode 100644 index c6da941717b..00000000000 --- a/cuda/_cuda/cnvrtc.pyx.in +++ /dev/null @@ -1,552 +0,0 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. -# -# Please refer to the NVIDIA end user license agreement (EULA) associated -# with this source code for terms and conditions that govern your use of -# this software. Any use, reproduction, disclosure, or distribution of -# this software and related documentation outside the terms of the EULA -# is strictly prohibited. -{{if 'Windows' == platform.system()}} -import win32api -import struct -from pywintypes import error -{{else}} -cimport cuda._lib.dlfcn as dlfcn -{{endif}} - -cdef bint __cuPythonInit = False -{{if 'nvrtcGetErrorString' in found_functions}}cdef void *__nvrtcGetErrorString = NULL{{endif}} -{{if 'nvrtcVersion' in found_functions}}cdef void *__nvrtcVersion = NULL{{endif}} -{{if 'nvrtcGetNumSupportedArchs' in found_functions}}cdef void *__nvrtcGetNumSupportedArchs = NULL{{endif}} -{{if 'nvrtcGetSupportedArchs' in found_functions}}cdef void *__nvrtcGetSupportedArchs = NULL{{endif}} -{{if 'nvrtcCreateProgram' in found_functions}}cdef void *__nvrtcCreateProgram = NULL{{endif}} -{{if 'nvrtcDestroyProgram' in found_functions}}cdef void *__nvrtcDestroyProgram = NULL{{endif}} -{{if 'nvrtcCompileProgram' in found_functions}}cdef void *__nvrtcCompileProgram = NULL{{endif}} -{{if 'nvrtcGetPTXSize' in found_functions}}cdef void *__nvrtcGetPTXSize = NULL{{endif}} -{{if 'nvrtcGetPTX' in found_functions}}cdef void *__nvrtcGetPTX = NULL{{endif}} -{{if 'nvrtcGetCUBINSize' in found_functions}}cdef void *__nvrtcGetCUBINSize = NULL{{endif}} -{{if 'nvrtcGetCUBIN' in found_functions}}cdef void *__nvrtcGetCUBIN = NULL{{endif}} -{{if 'nvrtcGetNVVMSize' in found_functions}}cdef void *__nvrtcGetNVVMSize = NULL{{endif}} -{{if 'nvrtcGetNVVM' in found_functions}}cdef void *__nvrtcGetNVVM = NULL{{endif}} -{{if 'nvrtcGetLTOIRSize' in found_functions}}cdef void *__nvrtcGetLTOIRSize = NULL{{endif}} -{{if 'nvrtcGetLTOIR' in found_functions}}cdef void *__nvrtcGetLTOIR = NULL{{endif}} -{{if 'nvrtcGetOptiXIRSize' in found_functions}}cdef void *__nvrtcGetOptiXIRSize = NULL{{endif}} -{{if 'nvrtcGetOptiXIR' in found_functions}}cdef void *__nvrtcGetOptiXIR = NULL{{endif}} -{{if 'nvrtcGetProgramLogSize' in found_functions}}cdef void *__nvrtcGetProgramLogSize = NULL{{endif}} -{{if 'nvrtcGetProgramLog' in found_functions}}cdef void *__nvrtcGetProgramLog = NULL{{endif}} -{{if 'nvrtcAddNameExpression' in found_functions}}cdef void *__nvrtcAddNameExpression = NULL{{endif}} -{{if 'nvrtcGetLoweredName' in found_functions}}cdef void *__nvrtcGetLoweredName = NULL{{endif}} - -cdef int cuPythonInit() except -1 nogil: - global __cuPythonInit - if __cuPythonInit: - return 0 - __cuPythonInit = True - - # Load library - {{if 'Windows' == platform.system()}} - LOAD_LIBRARY_SAFE_CURRENT_DIRS = 0x00002000 - with gil: - try: - handle = win32api.LoadLibraryEx("nvrtc64_120_0.dll", 0, LOAD_LIBRARY_SAFE_CURRENT_DIRS) - except: - raise RuntimeError('Failed to LoadLibraryEx nvrtc64_120_0.dll') - {{else}} - handle = NULL - if handle == NULL: - handle = dlfcn.dlopen('libnvrtc.so.12', dlfcn.RTLD_NOW) - if handle == NULL: - with gil: - raise RuntimeError('Failed to dlopen libnvrtc.so.12') - {{endif}} - - - # Load function - {{if 'Windows' == platform.system()}} - with gil: - {{if 'nvrtcGetErrorString' in found_functions}} - try: - global __nvrtcGetErrorString - __nvrtcGetErrorString = win32api.GetProcAddress(handle, 'nvrtcGetErrorString') - except: - pass - {{endif}} - {{if 'nvrtcVersion' in found_functions}} - try: - global __nvrtcVersion - __nvrtcVersion = win32api.GetProcAddress(handle, 'nvrtcVersion') - except: - pass - {{endif}} - {{if 'nvrtcGetNumSupportedArchs' in found_functions}} - try: - global __nvrtcGetNumSupportedArchs - __nvrtcGetNumSupportedArchs = win32api.GetProcAddress(handle, 'nvrtcGetNumSupportedArchs') - except: - pass - {{endif}} - {{if 'nvrtcGetSupportedArchs' in found_functions}} - try: - global __nvrtcGetSupportedArchs - __nvrtcGetSupportedArchs = win32api.GetProcAddress(handle, 'nvrtcGetSupportedArchs') - except: - pass - {{endif}} - {{if 'nvrtcCreateProgram' in found_functions}} - try: - global __nvrtcCreateProgram - __nvrtcCreateProgram = win32api.GetProcAddress(handle, 'nvrtcCreateProgram') - except: - pass - {{endif}} - {{if 'nvrtcDestroyProgram' in found_functions}} - try: - global __nvrtcDestroyProgram - __nvrtcDestroyProgram = win32api.GetProcAddress(handle, 'nvrtcDestroyProgram') - except: - pass - {{endif}} - {{if 'nvrtcCompileProgram' in found_functions}} - try: - global __nvrtcCompileProgram - __nvrtcCompileProgram = win32api.GetProcAddress(handle, 'nvrtcCompileProgram') - except: - pass - {{endif}} - {{if 'nvrtcGetPTXSize' in found_functions}} - try: - global __nvrtcGetPTXSize - __nvrtcGetPTXSize = win32api.GetProcAddress(handle, 'nvrtcGetPTXSize') - except: - pass - {{endif}} - {{if 'nvrtcGetPTX' in found_functions}} - try: - global __nvrtcGetPTX - __nvrtcGetPTX = win32api.GetProcAddress(handle, 'nvrtcGetPTX') - except: - pass - {{endif}} - {{if 'nvrtcGetCUBINSize' in found_functions}} - try: - global __nvrtcGetCUBINSize - __nvrtcGetCUBINSize = win32api.GetProcAddress(handle, 'nvrtcGetCUBINSize') - except: - pass - {{endif}} - {{if 'nvrtcGetCUBIN' in found_functions}} - try: - global __nvrtcGetCUBIN - __nvrtcGetCUBIN = win32api.GetProcAddress(handle, 'nvrtcGetCUBIN') - except: - pass - {{endif}} - {{if 'nvrtcGetNVVMSize' in found_functions}} - try: - global __nvrtcGetNVVMSize - __nvrtcGetNVVMSize = win32api.GetProcAddress(handle, 'nvrtcGetNVVMSize') - except: - pass - {{endif}} - {{if 'nvrtcGetNVVM' in found_functions}} - try: - global __nvrtcGetNVVM - __nvrtcGetNVVM = win32api.GetProcAddress(handle, 'nvrtcGetNVVM') - except: - pass - {{endif}} - {{if 'nvrtcGetLTOIRSize' in found_functions}} - try: - global __nvrtcGetLTOIRSize - __nvrtcGetLTOIRSize = win32api.GetProcAddress(handle, 'nvrtcGetLTOIRSize') - except: - pass - {{endif}} - {{if 'nvrtcGetLTOIR' in found_functions}} - try: - global __nvrtcGetLTOIR - __nvrtcGetLTOIR = win32api.GetProcAddress(handle, 'nvrtcGetLTOIR') - except: - pass - {{endif}} - {{if 'nvrtcGetOptiXIRSize' in found_functions}} - try: - global __nvrtcGetOptiXIRSize - __nvrtcGetOptiXIRSize = win32api.GetProcAddress(handle, 'nvrtcGetOptiXIRSize') - except: - pass - {{endif}} - {{if 'nvrtcGetOptiXIR' in found_functions}} - try: - global __nvrtcGetOptiXIR - __nvrtcGetOptiXIR = win32api.GetProcAddress(handle, 'nvrtcGetOptiXIR') - except: - pass - {{endif}} - {{if 'nvrtcGetProgramLogSize' in found_functions}} - try: - global __nvrtcGetProgramLogSize - __nvrtcGetProgramLogSize = win32api.GetProcAddress(handle, 'nvrtcGetProgramLogSize') - except: - pass - {{endif}} - {{if 'nvrtcGetProgramLog' in found_functions}} - try: - global __nvrtcGetProgramLog - __nvrtcGetProgramLog = win32api.GetProcAddress(handle, 'nvrtcGetProgramLog') - except: - pass - {{endif}} - {{if 'nvrtcAddNameExpression' in found_functions}} - try: - global __nvrtcAddNameExpression - __nvrtcAddNameExpression = win32api.GetProcAddress(handle, 'nvrtcAddNameExpression') - except: - pass - {{endif}} - {{if 'nvrtcGetLoweredName' in found_functions}} - try: - global __nvrtcGetLoweredName - __nvrtcGetLoweredName = win32api.GetProcAddress(handle, 'nvrtcGetLoweredName') - except: - pass - {{endif}} - - {{else}} - {{if 'nvrtcGetErrorString' in found_functions}} - global __nvrtcGetErrorString - __nvrtcGetErrorString = dlfcn.dlsym(handle, 'nvrtcGetErrorString') - {{endif}} - {{if 'nvrtcVersion' in found_functions}} - global __nvrtcVersion - __nvrtcVersion = dlfcn.dlsym(handle, 'nvrtcVersion') - {{endif}} - {{if 'nvrtcGetNumSupportedArchs' in found_functions}} - global __nvrtcGetNumSupportedArchs - __nvrtcGetNumSupportedArchs = dlfcn.dlsym(handle, 'nvrtcGetNumSupportedArchs') - {{endif}} - {{if 'nvrtcGetSupportedArchs' in found_functions}} - global __nvrtcGetSupportedArchs - __nvrtcGetSupportedArchs = dlfcn.dlsym(handle, 'nvrtcGetSupportedArchs') - {{endif}} - {{if 'nvrtcCreateProgram' in found_functions}} - global __nvrtcCreateProgram - __nvrtcCreateProgram = dlfcn.dlsym(handle, 'nvrtcCreateProgram') - {{endif}} - {{if 'nvrtcDestroyProgram' in found_functions}} - global __nvrtcDestroyProgram - __nvrtcDestroyProgram = dlfcn.dlsym(handle, 'nvrtcDestroyProgram') - {{endif}} - {{if 'nvrtcCompileProgram' in found_functions}} - global __nvrtcCompileProgram - __nvrtcCompileProgram = dlfcn.dlsym(handle, 'nvrtcCompileProgram') - {{endif}} - {{if 'nvrtcGetPTXSize' in found_functions}} - global __nvrtcGetPTXSize - __nvrtcGetPTXSize = dlfcn.dlsym(handle, 'nvrtcGetPTXSize') - {{endif}} - {{if 'nvrtcGetPTX' in found_functions}} - global __nvrtcGetPTX - __nvrtcGetPTX = dlfcn.dlsym(handle, 'nvrtcGetPTX') - {{endif}} - {{if 'nvrtcGetCUBINSize' in found_functions}} - global __nvrtcGetCUBINSize - __nvrtcGetCUBINSize = dlfcn.dlsym(handle, 'nvrtcGetCUBINSize') - {{endif}} - {{if 'nvrtcGetCUBIN' in found_functions}} - global __nvrtcGetCUBIN - __nvrtcGetCUBIN = dlfcn.dlsym(handle, 'nvrtcGetCUBIN') - {{endif}} - {{if 'nvrtcGetNVVMSize' in found_functions}} - global __nvrtcGetNVVMSize - __nvrtcGetNVVMSize = dlfcn.dlsym(handle, 'nvrtcGetNVVMSize') - {{endif}} - {{if 'nvrtcGetNVVM' in found_functions}} - global __nvrtcGetNVVM - __nvrtcGetNVVM = dlfcn.dlsym(handle, 'nvrtcGetNVVM') - {{endif}} - {{if 'nvrtcGetLTOIRSize' in found_functions}} - global __nvrtcGetLTOIRSize - __nvrtcGetLTOIRSize = dlfcn.dlsym(handle, 'nvrtcGetLTOIRSize') - {{endif}} - {{if 'nvrtcGetLTOIR' in found_functions}} - global __nvrtcGetLTOIR - __nvrtcGetLTOIR = dlfcn.dlsym(handle, 'nvrtcGetLTOIR') - {{endif}} - {{if 'nvrtcGetOptiXIRSize' in found_functions}} - global __nvrtcGetOptiXIRSize - __nvrtcGetOptiXIRSize = dlfcn.dlsym(handle, 'nvrtcGetOptiXIRSize') - {{endif}} - {{if 'nvrtcGetOptiXIR' in found_functions}} - global __nvrtcGetOptiXIR - __nvrtcGetOptiXIR = dlfcn.dlsym(handle, 'nvrtcGetOptiXIR') - {{endif}} - {{if 'nvrtcGetProgramLogSize' in found_functions}} - global __nvrtcGetProgramLogSize - __nvrtcGetProgramLogSize = dlfcn.dlsym(handle, 'nvrtcGetProgramLogSize') - {{endif}} - {{if 'nvrtcGetProgramLog' in found_functions}} - global __nvrtcGetProgramLog - __nvrtcGetProgramLog = dlfcn.dlsym(handle, 'nvrtcGetProgramLog') - {{endif}} - {{if 'nvrtcAddNameExpression' in found_functions}} - global __nvrtcAddNameExpression - __nvrtcAddNameExpression = dlfcn.dlsym(handle, 'nvrtcAddNameExpression') - {{endif}} - {{if 'nvrtcGetLoweredName' in found_functions}} - global __nvrtcGetLoweredName - __nvrtcGetLoweredName = dlfcn.dlsym(handle, 'nvrtcGetLoweredName') - {{endif}} - - {{endif}} - -{{if 'nvrtcGetErrorString' in found_functions}} - -cdef const char* _nvrtcGetErrorString(nvrtcResult result) except ?NULL nogil: - global __nvrtcGetErrorString - cuPythonInit() - if __nvrtcGetErrorString == NULL: - with gil: - raise RuntimeError('Function "nvrtcGetErrorString" not found') - err = ( __nvrtcGetErrorString)(result) - return err -{{endif}} - -{{if 'nvrtcVersion' in found_functions}} - -cdef nvrtcResult _nvrtcVersion(int* major, int* minor) except ?NVRTC_ERROR_INVALID_INPUT nogil: - global __nvrtcVersion - cuPythonInit() - if __nvrtcVersion == NULL: - with gil: - raise RuntimeError('Function "nvrtcVersion" not found') - err = ( __nvrtcVersion)(major, minor) - return err -{{endif}} - -{{if 'nvrtcGetNumSupportedArchs' in found_functions}} - -cdef nvrtcResult _nvrtcGetNumSupportedArchs(int* numArchs) except ?NVRTC_ERROR_INVALID_INPUT nogil: - global __nvrtcGetNumSupportedArchs - cuPythonInit() - if __nvrtcGetNumSupportedArchs == NULL: - with gil: - raise RuntimeError('Function "nvrtcGetNumSupportedArchs" not found') - err = ( __nvrtcGetNumSupportedArchs)(numArchs) - return err -{{endif}} - -{{if 'nvrtcGetSupportedArchs' in found_functions}} - -cdef nvrtcResult _nvrtcGetSupportedArchs(int* supportedArchs) except ?NVRTC_ERROR_INVALID_INPUT nogil: - global __nvrtcGetSupportedArchs - cuPythonInit() - if __nvrtcGetSupportedArchs == NULL: - with gil: - raise RuntimeError('Function "nvrtcGetSupportedArchs" not found') - err = ( __nvrtcGetSupportedArchs)(supportedArchs) - return err -{{endif}} - -{{if 'nvrtcCreateProgram' in found_functions}} - -cdef nvrtcResult _nvrtcCreateProgram(nvrtcProgram* prog, const char* src, const char* name, int numHeaders, const char** headers, const char** includeNames) except ?NVRTC_ERROR_INVALID_INPUT nogil: - global __nvrtcCreateProgram - cuPythonInit() - if __nvrtcCreateProgram == NULL: - with gil: - raise RuntimeError('Function "nvrtcCreateProgram" not found') - err = ( __nvrtcCreateProgram)(prog, src, name, numHeaders, headers, includeNames) - return err -{{endif}} - -{{if 'nvrtcDestroyProgram' in found_functions}} - -cdef nvrtcResult _nvrtcDestroyProgram(nvrtcProgram* prog) except ?NVRTC_ERROR_INVALID_INPUT nogil: - global __nvrtcDestroyProgram - cuPythonInit() - if __nvrtcDestroyProgram == NULL: - with gil: - raise RuntimeError('Function "nvrtcDestroyProgram" not found') - err = ( __nvrtcDestroyProgram)(prog) - return err -{{endif}} - -{{if 'nvrtcCompileProgram' in found_functions}} - -cdef nvrtcResult _nvrtcCompileProgram(nvrtcProgram prog, int numOptions, const char** options) except ?NVRTC_ERROR_INVALID_INPUT nogil: - global __nvrtcCompileProgram - cuPythonInit() - if __nvrtcCompileProgram == NULL: - with gil: - raise RuntimeError('Function "nvrtcCompileProgram" not found') - err = ( __nvrtcCompileProgram)(prog, numOptions, options) - return err -{{endif}} - -{{if 'nvrtcGetPTXSize' in found_functions}} - -cdef nvrtcResult _nvrtcGetPTXSize(nvrtcProgram prog, size_t* ptxSizeRet) except ?NVRTC_ERROR_INVALID_INPUT nogil: - global __nvrtcGetPTXSize - cuPythonInit() - if __nvrtcGetPTXSize == NULL: - with gil: - raise RuntimeError('Function "nvrtcGetPTXSize" not found') - err = ( __nvrtcGetPTXSize)(prog, ptxSizeRet) - return err -{{endif}} - -{{if 'nvrtcGetPTX' in found_functions}} - -cdef nvrtcResult _nvrtcGetPTX(nvrtcProgram prog, char* ptx) except ?NVRTC_ERROR_INVALID_INPUT nogil: - global __nvrtcGetPTX - cuPythonInit() - if __nvrtcGetPTX == NULL: - with gil: - raise RuntimeError('Function "nvrtcGetPTX" not found') - err = ( __nvrtcGetPTX)(prog, ptx) - return err -{{endif}} - -{{if 'nvrtcGetCUBINSize' in found_functions}} - -cdef nvrtcResult _nvrtcGetCUBINSize(nvrtcProgram prog, size_t* cubinSizeRet) except ?NVRTC_ERROR_INVALID_INPUT nogil: - global __nvrtcGetCUBINSize - cuPythonInit() - if __nvrtcGetCUBINSize == NULL: - with gil: - raise RuntimeError('Function "nvrtcGetCUBINSize" not found') - err = ( __nvrtcGetCUBINSize)(prog, cubinSizeRet) - return err -{{endif}} - -{{if 'nvrtcGetCUBIN' in found_functions}} - -cdef nvrtcResult _nvrtcGetCUBIN(nvrtcProgram prog, char* cubin) except ?NVRTC_ERROR_INVALID_INPUT nogil: - global __nvrtcGetCUBIN - cuPythonInit() - if __nvrtcGetCUBIN == NULL: - with gil: - raise RuntimeError('Function "nvrtcGetCUBIN" not found') - err = ( __nvrtcGetCUBIN)(prog, cubin) - return err -{{endif}} - -{{if 'nvrtcGetNVVMSize' in found_functions}} - -cdef nvrtcResult _nvrtcGetNVVMSize(nvrtcProgram prog, size_t* nvvmSizeRet) except ?NVRTC_ERROR_INVALID_INPUT nogil: - global __nvrtcGetNVVMSize - cuPythonInit() - if __nvrtcGetNVVMSize == NULL: - with gil: - raise RuntimeError('Function "nvrtcGetNVVMSize" not found') - err = ( __nvrtcGetNVVMSize)(prog, nvvmSizeRet) - return err -{{endif}} - -{{if 'nvrtcGetNVVM' in found_functions}} - -cdef nvrtcResult _nvrtcGetNVVM(nvrtcProgram prog, char* nvvm) except ?NVRTC_ERROR_INVALID_INPUT nogil: - global __nvrtcGetNVVM - cuPythonInit() - if __nvrtcGetNVVM == NULL: - with gil: - raise RuntimeError('Function "nvrtcGetNVVM" not found') - err = ( __nvrtcGetNVVM)(prog, nvvm) - return err -{{endif}} - -{{if 'nvrtcGetLTOIRSize' in found_functions}} - -cdef nvrtcResult _nvrtcGetLTOIRSize(nvrtcProgram prog, size_t* LTOIRSizeRet) except ?NVRTC_ERROR_INVALID_INPUT nogil: - global __nvrtcGetLTOIRSize - cuPythonInit() - if __nvrtcGetLTOIRSize == NULL: - with gil: - raise RuntimeError('Function "nvrtcGetLTOIRSize" not found') - err = ( __nvrtcGetLTOIRSize)(prog, LTOIRSizeRet) - return err -{{endif}} - -{{if 'nvrtcGetLTOIR' in found_functions}} - -cdef nvrtcResult _nvrtcGetLTOIR(nvrtcProgram prog, char* LTOIR) except ?NVRTC_ERROR_INVALID_INPUT nogil: - global __nvrtcGetLTOIR - cuPythonInit() - if __nvrtcGetLTOIR == NULL: - with gil: - raise RuntimeError('Function "nvrtcGetLTOIR" not found') - err = ( __nvrtcGetLTOIR)(prog, LTOIR) - return err -{{endif}} - -{{if 'nvrtcGetOptiXIRSize' in found_functions}} - -cdef nvrtcResult _nvrtcGetOptiXIRSize(nvrtcProgram prog, size_t* optixirSizeRet) except ?NVRTC_ERROR_INVALID_INPUT nogil: - global __nvrtcGetOptiXIRSize - cuPythonInit() - if __nvrtcGetOptiXIRSize == NULL: - with gil: - raise RuntimeError('Function "nvrtcGetOptiXIRSize" not found') - err = ( __nvrtcGetOptiXIRSize)(prog, optixirSizeRet) - return err -{{endif}} - -{{if 'nvrtcGetOptiXIR' in found_functions}} - -cdef nvrtcResult _nvrtcGetOptiXIR(nvrtcProgram prog, char* optixir) except ?NVRTC_ERROR_INVALID_INPUT nogil: - global __nvrtcGetOptiXIR - cuPythonInit() - if __nvrtcGetOptiXIR == NULL: - with gil: - raise RuntimeError('Function "nvrtcGetOptiXIR" not found') - err = ( __nvrtcGetOptiXIR)(prog, optixir) - return err -{{endif}} - -{{if 'nvrtcGetProgramLogSize' in found_functions}} - -cdef nvrtcResult _nvrtcGetProgramLogSize(nvrtcProgram prog, size_t* logSizeRet) except ?NVRTC_ERROR_INVALID_INPUT nogil: - global __nvrtcGetProgramLogSize - cuPythonInit() - if __nvrtcGetProgramLogSize == NULL: - with gil: - raise RuntimeError('Function "nvrtcGetProgramLogSize" not found') - err = ( __nvrtcGetProgramLogSize)(prog, logSizeRet) - return err -{{endif}} - -{{if 'nvrtcGetProgramLog' in found_functions}} - -cdef nvrtcResult _nvrtcGetProgramLog(nvrtcProgram prog, char* log) except ?NVRTC_ERROR_INVALID_INPUT nogil: - global __nvrtcGetProgramLog - cuPythonInit() - if __nvrtcGetProgramLog == NULL: - with gil: - raise RuntimeError('Function "nvrtcGetProgramLog" not found') - err = ( __nvrtcGetProgramLog)(prog, log) - return err -{{endif}} - -{{if 'nvrtcAddNameExpression' in found_functions}} - -cdef nvrtcResult _nvrtcAddNameExpression(nvrtcProgram prog, const char* name_expression) except ?NVRTC_ERROR_INVALID_INPUT nogil: - global __nvrtcAddNameExpression - cuPythonInit() - if __nvrtcAddNameExpression == NULL: - with gil: - raise RuntimeError('Function "nvrtcAddNameExpression" not found') - err = ( __nvrtcAddNameExpression)(prog, name_expression) - return err -{{endif}} - -{{if 'nvrtcGetLoweredName' in found_functions}} - -cdef nvrtcResult _nvrtcGetLoweredName(nvrtcProgram prog, const char* name_expression, const char** lowered_name) except ?NVRTC_ERROR_INVALID_INPUT nogil: - global __nvrtcGetLoweredName - cuPythonInit() - if __nvrtcGetLoweredName == NULL: - with gil: - raise RuntimeError('Function "nvrtcGetLoweredName" not found') - err = ( __nvrtcGetLoweredName)(prog, name_expression, lowered_name) - return err -{{endif}} diff --git a/cuda/_cuda/loader.cpp b/cuda/_cuda/loader.cpp deleted file mode 100644 index b2477fef3af..00000000000 --- a/cuda/_cuda/loader.cpp +++ /dev/null @@ -1,354 +0,0 @@ -// Copyright 2021-2024 NVIDIA Corporation. All rights reserved. -// -// Please refer to the NVIDIA end user license agreement (EULA) associated -// with this source code for terms and conditions that govern your use of -// this software. Any use, reproduction, disclosure, or distribution of -// this software and related documentation outside the terms of the EULA -// is strictly prohibited. -#include -#include -#include -#include "loader.h" - -#define DXCORE_MAX_PATH 260 - -#if defined(_WIN32) -#include "windows.h" -#define _getAddr GetProcAddress -#define _Handle HMODULE -static const size_t sysrootName64_length = (sizeof("System32") - 1); -static const char* sysrootName64 = "System32"; -static const size_t libcudaName64_length = (sizeof("\\nvcuda64.dll") - 1); -static const char* libcudaName64 = "\\nvcuda64.dll"; -static const size_t sysrootNameX86_length = (sizeof("SysWOW64") - 1); -static const char* sysrootNameX86 = "SysWOW64"; -static const size_t libcudaNameX86_length = (sizeof("\\nvcuda32.dll") - 1); -static const char* libcudaNameX86 = "\\nvcuda32.dll"; -static size_t sysrootName_length = NULL; -static const char* sysrootName = NULL; - -#else -#include -#include -#define _getAddr dlsym -#define _Handle void* -static const size_t libcudaNameLinux_length = (sizeof("/libcuda.so.1.1") - 1); -static const char* libcudaNameLinux = "/libcuda.so.1.1"; -#endif -static size_t libcudaName_length = 0; -static const char* libcudaName = NULL; - -struct dxcore_enumAdapters2; -struct dxcore_queryAdapterInfo; - -typedef int (*pfnDxcoreEnumAdapters2)(const dxcore_enumAdapters2 *pParams); -typedef int (*pfnDxcoreQueryAdapterInfo)(const dxcore_queryAdapterInfo *pParams); - -struct dxcore_lib { - _Handle hDxcoreLib; - pfnDxcoreEnumAdapters2 pDxcoreEnumAdapters2; - pfnDxcoreQueryAdapterInfo pDxcoreQueryAdapterInfo; -}; - -struct dxcore_luid -{ - unsigned int lowPart; - int highPart; -}; - -struct dxcore_adapterInfo -{ - unsigned int hAdapter; - struct dxcore_luid AdapterLuid; - unsigned int NumOfSources; - unsigned int bPresentMoveRegionsPreferred; -}; - -struct dxcore_enumAdapters2 -{ - unsigned int NumAdapters; - struct dxcore_adapterInfo *pAdapters; -}; - -enum dxcore_kmtqueryAdapterInfoType -{ - DXCORE_QUERYDRIVERVERSION = 13, - DXCORE_QUERYREGISTRY = 48, -}; - -enum dxcore_queryregistry_type { - DXCORE_QUERYREGISTRY_DRIVERSTOREPATH = 2, -}; - -enum dxcore_queryregistry_status { - DXCORE_QUERYREGISTRY_STATUS_SUCCESS = 0, - DXCORE_QUERYREGISTRY_STATUS_BUFFER_OVERFLOW = 1, - DXCORE_QUERYREGISTRY_STATUS_FAIL = 2, -}; - -struct dxcore_queryregistry_info { - enum dxcore_queryregistry_type QueryType; - unsigned int QueryFlags; - wchar_t ValueName[DXCORE_MAX_PATH]; - unsigned int ValueType; - unsigned int PhysicalAdapterIndex; - unsigned int OutputValueSize; - enum dxcore_queryregistry_status Status; - union { - unsigned long long OutputQword; - wchar_t Output; - }; -}; - -struct dxcore_queryAdapterInfo -{ - unsigned int hAdapter; - enum dxcore_kmtqueryAdapterInfoType Type; - void *pPrivateDriverData; - unsigned int PrivateDriverDataSize; -}; - -static int dxcore_query_adapter_info_helper(struct dxcore_lib* pLib, - unsigned int hAdapter, - enum dxcore_kmtqueryAdapterInfoType type, - void* pPrivateDriverDate, - unsigned int privateDriverDataSize) -{ - struct dxcore_queryAdapterInfo queryAdapterInfo = {}; - - queryAdapterInfo.hAdapter = hAdapter; - queryAdapterInfo.Type = type; - queryAdapterInfo.pPrivateDriverData = pPrivateDriverDate; - queryAdapterInfo.PrivateDriverDataSize = privateDriverDataSize; - - return pLib->pDxcoreQueryAdapterInfo(&queryAdapterInfo); -} - -static int dxcore_query_adapter_wddm_version(struct dxcore_lib* pLib, unsigned int hAdapter, unsigned int* version) -{ - return dxcore_query_adapter_info_helper(pLib, - hAdapter, - DXCORE_QUERYDRIVERVERSION, - (void*)version, - (unsigned int)sizeof(*version)); -} - -static int dxcore_query_adapter_driverstore_path(struct dxcore_lib* pLib, unsigned int hAdapter, char** ppDriverStorePath) -{ - struct dxcore_queryregistry_info params = {}; - struct dxcore_queryregistry_info* pValue = NULL; - wchar_t* pOutput; - size_t outputSizeInBytes; - size_t outputSize; - - // 1. Fetch output size - params.QueryType = DXCORE_QUERYREGISTRY_DRIVERSTOREPATH; - - if (dxcore_query_adapter_info_helper(pLib, - hAdapter, - DXCORE_QUERYREGISTRY, - (void*)¶ms, - (unsigned int)sizeof(struct dxcore_queryregistry_info))) - { - return (-1); - } - - if (params.OutputValueSize > DXCORE_MAX_PATH * sizeof(wchar_t)) { - return (-1); - } - - outputSizeInBytes = (size_t)params.OutputValueSize; - outputSize = outputSizeInBytes / sizeof(wchar_t); - - // 2. Retrieve output - pValue = (struct dxcore_queryregistry_info*)calloc(sizeof(struct dxcore_queryregistry_info) + outputSizeInBytes + sizeof(wchar_t), 1); - if (!pValue) { - return (-1); - } - - pValue->QueryType = DXCORE_QUERYREGISTRY_DRIVERSTOREPATH; - pValue->OutputValueSize = (unsigned int)outputSizeInBytes; - - if (dxcore_query_adapter_info_helper(pLib, - hAdapter, - DXCORE_QUERYREGISTRY, - (void*)pValue, - (unsigned int)(sizeof(struct dxcore_queryregistry_info) + outputSizeInBytes))) - { - free(pValue); - return (-1); - } - pOutput = (wchar_t*)(&pValue->Output); - - // Make sure no matter what happened the wchar_t string is null terminated - pOutput[outputSize] = L'\0'; - - // Convert the output into a regular c string - *ppDriverStorePath = (char*)calloc(outputSize + 1, sizeof(char)); - if (!*ppDriverStorePath) { - free(pValue); - return (-1); - } - wcstombs(*ppDriverStorePath, pOutput, outputSize); - - free(pValue); - - return 0; -} - -static char* replaceSystemPath(char* path) -{ - char *replacedPath = (char*)calloc(DXCORE_MAX_PATH + 1, sizeof(char)); - -#if defined(_WIN32) - wchar_t *systemPath = (wchar_t*)calloc(DXCORE_MAX_PATH + 1, sizeof(wchar_t)); - // Get system root path - if (GetSystemDirectoryW(systemPath, DXCORE_MAX_PATH) == 0) { - free(replacedPath); - free(systemPath); - return NULL; - } - wcstombs(replacedPath, systemPath, DXCORE_MAX_PATH); - free(systemPath); - - // Replace the /SystemRoot/ part of the registry-obtained path with - // the actual system root path from above - char* sysrootPath = strstr(path, sysrootName); - strncat(replacedPath, sysrootPath + sysrootName_length, DXCORE_MAX_PATH - strlen(replacedPath)); -#else - strncat(replacedPath, path, DXCORE_MAX_PATH); -#endif - - // Append nvcuda dll - if (libcudaName_length < DXCORE_MAX_PATH - strlen(replacedPath)) { - strncat(replacedPath, libcudaName, libcudaName_length); - } - else { - strncat(replacedPath, libcudaName, DXCORE_MAX_PATH - strlen(replacedPath)); - } - - return replacedPath; -} - -static int dxcore_check_adapter(struct dxcore_lib *pLib, char *libPath, struct dxcore_adapterInfo *pAdapterInfo) -{ - unsigned int wddmVersion = 0; - char* driverStorePath = NULL; - - if (dxcore_query_adapter_wddm_version(pLib, pAdapterInfo->hAdapter, &wddmVersion)) { - return 1; - } - - if (wddmVersion < 2500) { - return 1; - } - - if (dxcore_query_adapter_driverstore_path(pLib, pAdapterInfo->hAdapter, &driverStorePath)) { - return 1; - } - - // Replace with valid path - char* replacedPath = replaceSystemPath(driverStorePath); - if (!replacedPath) { - free(driverStorePath); - free(replacedPath); - return 1; - } - - // Does file exist? -#if defined(_WIN32) - if (GetFileAttributes(replacedPath) == INVALID_FILE_ATTRIBUTES) { - free(driverStorePath); - free(replacedPath); - return 1; - } -#else - if (access(replacedPath, F_OK) < 0) { - free(driverStorePath); - free(replacedPath); - return 1; - } -#endif - - memcpy(libPath, replacedPath, DXCORE_MAX_PATH); - free(driverStorePath); - free(replacedPath); - - return 0; -} - -static int dxcore_enum_adapters(struct dxcore_lib *pLib, char *libPath) -{ - struct dxcore_enumAdapters2 params = {0}; - unsigned int adapterIndex = 0; - - if (pLib->pDxcoreEnumAdapters2(¶ms)) { - return 1; - } - params.pAdapters = (dxcore_adapterInfo*)calloc(params.NumAdapters, sizeof(struct dxcore_adapterInfo)); - if (pLib->pDxcoreEnumAdapters2(¶ms)) { - free(params.pAdapters); - return 1; - } - - for (adapterIndex = 0; adapterIndex < params.NumAdapters; adapterIndex++) { - if (!dxcore_check_adapter(pLib, libPath, ¶ms.pAdapters[adapterIndex])) { - free(params.pAdapters); - return 0; - } - } - - free(params.pAdapters); - return 1; -} - -int getCUDALibraryPath(char *libPath, bool isBit64) -{ - struct dxcore_lib lib = {0}; - - if (!libPath) { - return 1; - } - - // Configure paths based on app's bit configuration -#if defined(_WIN32) - if (isBit64) { - sysrootName_length = sysrootName64_length; - sysrootName = sysrootName64; - libcudaName_length = libcudaName64_length; - libcudaName = libcudaName64; - } - else { - sysrootName_length = sysrootNameX86_length; - sysrootName = sysrootNameX86; - libcudaName_length = libcudaNameX86_length; - libcudaName = libcudaNameX86; - } -#else - libcudaName_length = libcudaNameLinux_length; - libcudaName = libcudaNameLinux; -#endif - -#if defined(_WIN32) - lib.hDxcoreLib = LoadLibraryExW(L"gdi32.dll", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32); -#else - lib.hDxcoreLib = dlopen("libdxcore.so", RTLD_LAZY); -#endif - if (!lib.hDxcoreLib) { - return 1; - } - - lib.pDxcoreEnumAdapters2 = (pfnDxcoreEnumAdapters2)_getAddr(lib.hDxcoreLib, "D3DKMTEnumAdapters2"); - if (!lib.pDxcoreEnumAdapters2) { - return 1; - } - lib.pDxcoreQueryAdapterInfo = (pfnDxcoreQueryAdapterInfo)_getAddr(lib.hDxcoreLib, "D3DKMTQueryAdapterInfo"); - if (!lib.pDxcoreQueryAdapterInfo) { - return 1; - } - - if (dxcore_enum_adapters(&lib, libPath)) { - return 1; - } - return 0; -} diff --git a/cuda/_cuda/loader.h b/cuda/_cuda/loader.h deleted file mode 100644 index 2963d9e0db2..00000000000 --- a/cuda/_cuda/loader.h +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright 2021-2024 NVIDIA Corporation. All rights reserved. -// -// Please refer to the NVIDIA end user license agreement (EULA) associated -// with this source code for terms and conditions that govern your use of -// this software. Any use, reproduction, disclosure, or distribution of -// this software and related documentation outside the terms of the EULA -// is strictly prohibited. -int getCUDALibraryPath(char *libPath, bool isBit64); diff --git a/cuda/_cuda/loader.pxd b/cuda/_cuda/loader.pxd deleted file mode 100644 index 17151580963..00000000000 --- a/cuda/_cuda/loader.pxd +++ /dev/null @@ -1,10 +0,0 @@ - -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. -# -# Please refer to the NVIDIA end user license agreement (EULA) associated -# with this source code for terms and conditions that govern your use of -# this software. Any use, reproduction, disclosure, or distribution of -# this software and related documentation outside the terms of the EULA -# is strictly prohibited. -cdef extern from "loader.h": - int getCUDALibraryPath(char *libPath, bint isBit64) diff --git a/cuda/_lib/ccudart/ccudart.pxd.in b/cuda/_lib/ccudart/ccudart.pxd.in deleted file mode 100644 index 072fa91a41c..00000000000 --- a/cuda/_lib/ccudart/ccudart.pxd.in +++ /dev/null @@ -1,311 +0,0 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. -# -# Please refer to the NVIDIA end user license agreement (EULA) associated -# with this source code for terms and conditions that govern your use of -# this software. Any use, reproduction, disclosure, or distribution of -# this software and related documentation outside the terms of the EULA -# is strictly prohibited. -cimport cuda.ccuda as ccuda -from cuda.ccudart cimport * -from libc.stdlib cimport malloc, free, calloc -from libc.string cimport memset, memcpy, strncmp -from libcpp cimport bool - -{{if 'cudaMemcpy' in found_functions}}cdef cudaError_t _cudaMemcpy(void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaStreamCreate' in found_functions}}cdef cudaError_t _cudaStreamCreate(cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaEventCreate' in found_functions}}cdef cudaError_t _cudaEventCreate(cudaEvent_t* event) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaEventQuery' in found_functions}}cdef cudaError_t _cudaEventQuery(cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaCreateChannelDesc' in found_functions}}cdef cudaChannelFormatDesc _cudaCreateChannelDesc(int x, int y, int z, int w, cudaChannelFormatKind f) noexcept nogil{{endif}} -{{if 'cudaDriverGetVersion' in found_functions}}cdef cudaError_t _cudaDriverGetVersion(int* driverVersion) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaRuntimeGetVersion' in found_functions}}cdef cudaError_t _cudaRuntimeGetVersion(int* runtimeVersion) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDeviceGetTexture1DLinearMaxWidth' in found_functions}}cdef cudaError_t _cudaDeviceGetTexture1DLinearMaxWidth(size_t* maxWidthInElements, const cudaChannelFormatDesc* fmtDesc, int device) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMallocHost' in found_functions}}cdef cudaError_t _cudaMallocHost(void** ptr, size_t size) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMallocPitch' in found_functions}}cdef cudaError_t _cudaMallocPitch(void** devPtr, size_t* pitch, size_t width, size_t height) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMallocMipmappedArray' in found_functions}}cdef cudaError_t _cudaMallocMipmappedArray(cudaMipmappedArray_t* mipmappedArray, const cudaChannelFormatDesc* desc, cudaExtent extent, unsigned int numLevels, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemcpy2D' in found_functions}}cdef cudaError_t _cudaMemcpy2D(void* dst, size_t dpitch, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemcpy2DAsync' in found_functions}}cdef cudaError_t _cudaMemcpy2DAsync(void* dst, size_t dpitch, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemcpyAsync' in found_functions}}cdef cudaError_t _cudaMemcpyAsync(void* dst, const void* src, size_t count, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphAddMemcpyNode' in found_functions}}cdef cudaError_t _cudaGraphAddMemcpyNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaMemcpy3DParms* pCopyParams) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphAddMemcpyNode1D' in found_functions}}cdef cudaError_t _cudaGraphAddMemcpyNode1D(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphMemcpyNodeSetParams1D' in found_functions}}cdef cudaError_t _cudaGraphMemcpyNodeSetParams1D(cudaGraphNode_t node, void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphExecMemcpyNodeSetParams' in found_functions}}cdef cudaError_t _cudaGraphExecMemcpyNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaMemcpy3DParms* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphExecMemcpyNodeSetParams1D' in found_functions}}cdef cudaError_t _cudaGraphExecMemcpyNodeSetParams1D(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGetDriverEntryPoint' in found_functions}}cdef cudaError_t _cudaGetDriverEntryPoint(const char* symbol, void** funcPtr, unsigned long long flags, cudaDriverEntryPointQueryResult* driverStatus) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphAddMemsetNode' in found_functions}}cdef cudaError_t _cudaGraphAddMemsetNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaMemsetParams* pMemsetParams) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphExecMemsetNodeSetParams' in found_functions}}cdef cudaError_t _cudaGraphExecMemsetNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaMemsetParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphMemcpyNodeSetParams' in found_functions}}cdef cudaError_t _cudaGraphMemcpyNodeSetParams(cudaGraphNode_t node, const cudaMemcpy3DParms* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphMemcpyNodeGetParams' in found_functions}}cdef cudaError_t _cudaGraphMemcpyNodeGetParams(cudaGraphNode_t node, cudaMemcpy3DParms* p) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaFuncGetAttributes' in found_functions}}cdef cudaError_t _cudaFuncGetAttributes(cudaFuncAttributes* attr, const void* func) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMallocArray' in found_functions}}cdef cudaError_t _cudaMallocArray(cudaArray_t* arrayPtr, const cudaChannelFormatDesc* desc, size_t width, size_t height, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMalloc3D' in found_functions}}cdef cudaError_t _cudaMalloc3D(cudaPitchedPtr* pitchedDevPtr, cudaExtent extent) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMalloc3DArray' in found_functions}}cdef cudaError_t _cudaMalloc3DArray(cudaArray_t* arrayPtr, const cudaChannelFormatDesc* desc, cudaExtent extent, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGetErrorString' in found_functions}}cdef const char* _cudaGetErrorString(cudaError_t error) except ?NULL nogil{{endif}} -{{if 'cudaStreamAddCallback' in found_functions}}cdef cudaError_t _cudaStreamAddCallback(cudaStream_t stream, cudaStreamCallback_t callback, void* userData, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaStreamGetCaptureInfo_v2' in found_functions}}cdef cudaError_t _cudaStreamGetCaptureInfo_v2(cudaStream_t stream, cudaStreamCaptureStatus* captureStatus_out, unsigned long long* id_out, cudaGraph_t* graph_out, const cudaGraphNode_t** dependencies_out, size_t* numDependencies_out) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaImportExternalSemaphore' in found_functions}}cdef cudaError_t _cudaImportExternalSemaphore(cudaExternalSemaphore_t* extSem_out, const cudaExternalSemaphoreHandleDesc* semHandleDesc) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaSignalExternalSemaphoresAsync_v2' in found_functions}}cdef cudaError_t _cudaSignalExternalSemaphoresAsync_v2(const cudaExternalSemaphore_t* extSemArray, const cudaExternalSemaphoreSignalParams* paramsArray, unsigned int numExtSems, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaWaitExternalSemaphoresAsync_v2' in found_functions}}cdef cudaError_t _cudaWaitExternalSemaphoresAsync_v2(const cudaExternalSemaphore_t* extSemArray, const cudaExternalSemaphoreWaitParams* paramsArray, unsigned int numExtSems, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaArrayGetInfo' in found_functions}}cdef cudaError_t _cudaArrayGetInfo(cudaChannelFormatDesc* desc, cudaExtent* extent, unsigned int* flags, cudaArray_t array) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemcpy2DToArray' in found_functions}}cdef cudaError_t _cudaMemcpy2DToArray(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemcpy2DFromArray' in found_functions}}cdef cudaError_t _cudaMemcpy2DFromArray(void* dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemcpy2DArrayToArray' in found_functions}}cdef cudaError_t _cudaMemcpy2DArrayToArray(cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemcpy2DToArrayAsync' in found_functions}}cdef cudaError_t _cudaMemcpy2DToArrayAsync(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemcpy2DFromArrayAsync' in found_functions}}cdef cudaError_t _cudaMemcpy2DFromArrayAsync(void* dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemset3D' in found_functions}}cdef cudaError_t _cudaMemset3D(cudaPitchedPtr pitchedDevPtr, int value, cudaExtent extent) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemset3DAsync' in found_functions}}cdef cudaError_t _cudaMemset3DAsync(cudaPitchedPtr pitchedDevPtr, int value, cudaExtent extent, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemcpyToArray' in found_functions}}cdef cudaError_t _cudaMemcpyToArray(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemcpyFromArray' in found_functions}}cdef cudaError_t _cudaMemcpyFromArray(void* dst, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemcpyToArrayAsync' in found_functions}}cdef cudaError_t _cudaMemcpyToArrayAsync(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t count, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemcpyFromArrayAsync' in found_functions}}cdef cudaError_t _cudaMemcpyFromArrayAsync(void* dst, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaPointerGetAttributes' in found_functions}}cdef cudaError_t _cudaPointerGetAttributes(cudaPointerAttributes* attributes, const void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGetDeviceFlags' in found_functions}}cdef cudaError_t _cudaGetDeviceFlags(unsigned int* flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemcpy3D' in found_functions}}cdef cudaError_t _cudaMemcpy3D(const cudaMemcpy3DParms* p) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemcpy3DAsync' in found_functions}}cdef cudaError_t _cudaMemcpy3DAsync(const cudaMemcpy3DParms* p, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemPoolSetAccess' in found_functions}}cdef cudaError_t _cudaMemPoolSetAccess(cudaMemPool_t memPool, const cudaMemAccessDesc* descList, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDeviceReset' in found_functions}}cdef cudaError_t _cudaDeviceReset() except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGetLastError' in found_functions}}cdef cudaError_t _cudaGetLastError() except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaPeekAtLastError' in found_functions}}cdef cudaError_t _cudaPeekAtLastError() except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGetDevice' in found_functions}}cdef cudaError_t _cudaGetDevice(int* device) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaSetDevice' in found_functions}}cdef cudaError_t _cudaSetDevice(int device) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGetDeviceProperties_v2' in found_functions}}cdef cudaError_t _cudaGetDeviceProperties_v2(cudaDeviceProp* prop, int device) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaChooseDevice' in found_functions}}cdef cudaError_t _cudaChooseDevice(int* device, const cudaDeviceProp* prop) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemcpyArrayToArray' in found_functions}}cdef cudaError_t _cudaMemcpyArrayToArray(cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGetChannelDesc' in found_functions}}cdef cudaError_t _cudaGetChannelDesc(cudaChannelFormatDesc* desc, cudaArray_const_t array) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaCreateTextureObject' in found_functions}}cdef cudaError_t _cudaCreateTextureObject(cudaTextureObject_t* pTexObject, const cudaResourceDesc* pResDesc, const cudaTextureDesc* pTexDesc, const cudaResourceViewDesc* pResViewDesc) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGetTextureObjectTextureDesc' in found_functions}}cdef cudaError_t _cudaGetTextureObjectTextureDesc(cudaTextureDesc* pTexDesc, cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGetTextureObjectResourceViewDesc' in found_functions}}cdef cudaError_t _cudaGetTextureObjectResourceViewDesc(cudaResourceViewDesc* pResViewDesc, cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGetExportTable' in found_functions}}cdef cudaError_t _cudaGetExportTable(const void** ppExportTable, const cudaUUID_t* pExportTableId) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemcpy3DPeer' in found_functions}}cdef cudaError_t _cudaMemcpy3DPeer(const cudaMemcpy3DPeerParms* p) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemcpy3DPeerAsync' in found_functions}}cdef cudaError_t _cudaMemcpy3DPeerAsync(const cudaMemcpy3DPeerParms* p, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'make_cudaPitchedPtr' in found_functions}}cdef cudaPitchedPtr _make_cudaPitchedPtr(void* d, size_t p, size_t xsz, size_t ysz) noexcept nogil{{endif}} -{{if 'make_cudaPos' in found_functions}}cdef cudaPos _make_cudaPos(size_t x, size_t y, size_t z) noexcept nogil{{endif}} -{{if 'make_cudaExtent' in found_functions}}cdef cudaExtent _make_cudaExtent(size_t w, size_t h, size_t d) noexcept nogil{{endif}} -{{if 'cudaSetDeviceFlags' in found_functions}}cdef cudaError_t _cudaSetDeviceFlags(unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphAddMemAllocNode' in found_functions}}cdef cudaError_t _cudaGraphAddMemAllocNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaMemAllocNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphMemAllocNodeGetParams' in found_functions}}cdef cudaError_t _cudaGraphMemAllocNodeGetParams(cudaGraphNode_t node, cudaMemAllocNodeParams* params_out) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphMemFreeNodeGetParams' in found_functions}}cdef cudaError_t _cudaGraphMemFreeNodeGetParams(cudaGraphNode_t node, void* dptr_out) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemAdvise' in found_functions}}cdef cudaError_t _cudaMemAdvise(const void* devPtr, size_t count, cudaMemoryAdvise advice, int device) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemRangeGetAttribute' in found_functions}}cdef cudaError_t _cudaMemRangeGetAttribute(void* data, size_t dataSize, cudaMemRangeAttribute attribute, const void* devPtr, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemRangeGetAttributes' in found_functions}}cdef cudaError_t _cudaMemRangeGetAttributes(void** data, size_t* dataSizes, cudaMemRangeAttribute* attributes, size_t numAttributes, const void* devPtr, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGetDeviceCount' in found_functions}}cdef cudaError_t _cudaGetDeviceCount(int* count) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDeviceGetAttribute' in found_functions}}cdef cudaError_t _cudaDeviceGetAttribute(int* value, cudaDeviceAttr attr, int device) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDeviceSetSharedMemConfig' in found_functions}}cdef cudaError_t _cudaDeviceSetSharedMemConfig(cudaSharedMemConfig config) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDeviceGetByPCIBusId' in found_functions}}cdef cudaError_t _cudaDeviceGetByPCIBusId(int* device, const char* pciBusId) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDeviceGetPCIBusId' in found_functions}}cdef cudaError_t _cudaDeviceGetPCIBusId(char* pciBusId, int length, int device) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDeviceGetP2PAttribute' in found_functions}}cdef cudaError_t _cudaDeviceGetP2PAttribute(int* value, cudaDeviceP2PAttr attr, int srcDevice, int dstDevice) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaArrayGetSparseProperties' in found_functions}}cdef cudaError_t _cudaArrayGetSparseProperties(cudaArraySparseProperties* sparseProperties, cudaArray_t array) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMipmappedArrayGetSparseProperties' in found_functions}}cdef cudaError_t _cudaMipmappedArrayGetSparseProperties(cudaArraySparseProperties* sparseProperties, cudaMipmappedArray_t mipmap) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDeviceCanAccessPeer' in found_functions}}cdef cudaError_t _cudaDeviceCanAccessPeer(int* canAccessPeer, int device, int peerDevice) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemcpyPeer' in found_functions}}cdef cudaError_t _cudaMemcpyPeer(void* dst, int dstDevice, const void* src, int srcDevice, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemcpyPeerAsync' in found_functions}}cdef cudaError_t _cudaMemcpyPeerAsync(void* dst, int dstDevice, const void* src, int srcDevice, size_t count, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDeviceEnablePeerAccess' in found_functions}}cdef cudaError_t _cudaDeviceEnablePeerAccess(int peerDevice, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDeviceDisablePeerAccess' in found_functions}}cdef cudaError_t _cudaDeviceDisablePeerAccess(int peerDevice) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaExternalMemoryGetMappedMipmappedArray' in found_functions}}cdef cudaError_t _cudaExternalMemoryGetMappedMipmappedArray(cudaMipmappedArray_t* mipmap, cudaExternalMemory_t extMem, const cudaExternalMemoryMipmappedArrayDesc* mipmapDesc) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGetSurfaceObjectResourceDesc' in found_functions}}cdef cudaError_t _cudaGetSurfaceObjectResourceDesc(cudaResourceDesc* pResDesc, cudaSurfaceObject_t surfObject) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphKernelNodeGetParams' in found_functions}}cdef cudaError_t _cudaGraphKernelNodeGetParams(cudaGraphNode_t node, cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaExternalMemoryGetMappedBuffer' in found_functions}}cdef cudaError_t _cudaExternalMemoryGetMappedBuffer(void** devPtr, cudaExternalMemory_t extMem, const cudaExternalMemoryBufferDesc* bufferDesc) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaImportExternalMemory' in found_functions}}cdef cudaError_t _cudaImportExternalMemory(cudaExternalMemory_t* extMem_out, const cudaExternalMemoryHandleDesc* memHandleDesc) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaCreateSurfaceObject' in found_functions}}cdef cudaError_t _cudaCreateSurfaceObject(cudaSurfaceObject_t* pSurfObject, const cudaResourceDesc* pResDesc) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGetTextureObjectResourceDesc' in found_functions}}cdef cudaError_t _cudaGetTextureObjectResourceDesc(cudaResourceDesc* pResDesc, cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphicsEGLRegisterImage' in found_functions}}cdef cudaError_t _cudaGraphicsEGLRegisterImage(cudaGraphicsResource_t* pCudaResource, EGLImageKHR image, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaEGLStreamProducerPresentFrame' in found_functions}}cdef cudaError_t _cudaEGLStreamProducerPresentFrame(cudaEglStreamConnection* conn, cudaEglFrame eglframe, cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaEGLStreamProducerReturnFrame' in found_functions}}cdef cudaError_t _cudaEGLStreamProducerReturnFrame(cudaEglStreamConnection* conn, cudaEglFrame* eglframe, cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphicsResourceGetMappedEglFrame' in found_functions}}cdef cudaError_t _cudaGraphicsResourceGetMappedEglFrame(cudaEglFrame* eglFrame, cudaGraphicsResource_t resource, unsigned int index, unsigned int mipLevel) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if True}}cdef cudaError_t _cudaVDPAUSetVDPAUDevice(int device, VdpDevice vdpDevice, VdpGetProcAddress* vdpGetProcAddress) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaArrayGetMemoryRequirements' in found_functions}}cdef cudaError_t _cudaArrayGetMemoryRequirements(cudaArrayMemoryRequirements* memoryRequirements, cudaArray_t array, int device) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMipmappedArrayGetMemoryRequirements' in found_functions}}cdef cudaError_t _cudaMipmappedArrayGetMemoryRequirements(cudaArrayMemoryRequirements* memoryRequirements, cudaMipmappedArray_t mipmap, int device) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaStreamGetAttribute' in found_functions}}cdef cudaError_t _cudaStreamGetAttribute(cudaStream_t hStream, cudaStreamAttrID attr, cudaStreamAttrValue* value_out) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaStreamSetAttribute' in found_functions}}cdef cudaError_t _cudaStreamSetAttribute(cudaStream_t hStream, cudaStreamAttrID attr, const cudaStreamAttrValue* value) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphKernelNodeGetAttribute' in found_functions}}cdef cudaError_t _cudaGraphKernelNodeGetAttribute(cudaGraphNode_t hNode, cudaKernelNodeAttrID attr, cudaKernelNodeAttrValue* value_out) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphKernelNodeSetAttribute' in found_functions}}cdef cudaError_t _cudaGraphKernelNodeSetAttribute(cudaGraphNode_t hNode, cudaKernelNodeAttrID attr, const cudaKernelNodeAttrValue* value) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if True}}cdef cudaError_t _cudaVDPAUGetDevice(int* device, VdpDevice vdpDevice, VdpGetProcAddress* vdpGetProcAddress) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if True}}cdef cudaError_t _cudaGraphicsVDPAURegisterVideoSurface(cudaGraphicsResource** resource, VdpVideoSurface vdpSurface, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if True}}cdef cudaError_t _cudaGraphicsVDPAURegisterOutputSurface(cudaGraphicsResource** resource, VdpOutputSurface vdpSurface, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if True}}cdef cudaError_t _cudaGLGetDevices(unsigned int* pCudaDeviceCount, int* pCudaDevices, unsigned int cudaDeviceCount, cudaGLDeviceList deviceList) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if True}}cdef cudaError_t _cudaGraphicsGLRegisterImage(cudaGraphicsResource** resource, GLuint image, GLenum target, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if True}}cdef cudaError_t _cudaGraphicsGLRegisterBuffer(cudaGraphicsResource** resource, GLuint buffer, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDeviceSynchronize' in found_functions}}cdef cudaError_t _cudaDeviceSynchronize() except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDeviceSetLimit' in found_functions}}cdef cudaError_t _cudaDeviceSetLimit(cudaLimit limit, size_t value) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDeviceGetLimit' in found_functions}}cdef cudaError_t _cudaDeviceGetLimit(size_t* pValue, cudaLimit limit) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDeviceGetCacheConfig' in found_functions}}cdef cudaError_t _cudaDeviceGetCacheConfig(cudaFuncCache* pCacheConfig) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDeviceGetStreamPriorityRange' in found_functions}}cdef cudaError_t _cudaDeviceGetStreamPriorityRange(int* leastPriority, int* greatestPriority) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDeviceSetCacheConfig' in found_functions}}cdef cudaError_t _cudaDeviceSetCacheConfig(cudaFuncCache cacheConfig) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDeviceGetSharedMemConfig' in found_functions}}cdef cudaError_t _cudaDeviceGetSharedMemConfig(cudaSharedMemConfig* pConfig) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaIpcGetEventHandle' in found_functions}}cdef cudaError_t _cudaIpcGetEventHandle(cudaIpcEventHandle_t* handle, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaIpcOpenEventHandle' in found_functions}}cdef cudaError_t _cudaIpcOpenEventHandle(cudaEvent_t* event, cudaIpcEventHandle_t handle) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaIpcGetMemHandle' in found_functions}}cdef cudaError_t _cudaIpcGetMemHandle(cudaIpcMemHandle_t* handle, void* devPtr) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaIpcOpenMemHandle' in found_functions}}cdef cudaError_t _cudaIpcOpenMemHandle(void** devPtr, cudaIpcMemHandle_t handle, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaIpcCloseMemHandle' in found_functions}}cdef cudaError_t _cudaIpcCloseMemHandle(void* devPtr) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDeviceFlushGPUDirectRDMAWrites' in found_functions}}cdef cudaError_t _cudaDeviceFlushGPUDirectRDMAWrites(cudaFlushGPUDirectRDMAWritesTarget target, cudaFlushGPUDirectRDMAWritesScope scope) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDeviceGetDefaultMemPool' in found_functions}}cdef cudaError_t _cudaDeviceGetDefaultMemPool(cudaMemPool_t* memPool, int device) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDeviceSetMemPool' in found_functions}}cdef cudaError_t _cudaDeviceSetMemPool(int device, cudaMemPool_t memPool) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDeviceGetMemPool' in found_functions}}cdef cudaError_t _cudaDeviceGetMemPool(cudaMemPool_t* memPool, int device) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDeviceGetNvSciSyncAttributes' in found_functions}}cdef cudaError_t _cudaDeviceGetNvSciSyncAttributes(void* nvSciSyncAttrList, int device, int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaStreamCreateWithFlags' in found_functions}}cdef cudaError_t _cudaStreamCreateWithFlags(cudaStream_t* pStream, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaStreamCreateWithPriority' in found_functions}}cdef cudaError_t _cudaStreamCreateWithPriority(cudaStream_t* pStream, unsigned int flags, int priority) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaStreamGetPriority' in found_functions}}cdef cudaError_t _cudaStreamGetPriority(cudaStream_t hStream, int* priority) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaStreamGetFlags' in found_functions}}cdef cudaError_t _cudaStreamGetFlags(cudaStream_t hStream, unsigned int* flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaCtxResetPersistingL2Cache' in found_functions}}cdef cudaError_t _cudaCtxResetPersistingL2Cache() except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaStreamCopyAttributes' in found_functions}}cdef cudaError_t _cudaStreamCopyAttributes(cudaStream_t dst, cudaStream_t src) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaStreamDestroy' in found_functions}}cdef cudaError_t _cudaStreamDestroy(cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaStreamWaitEvent' in found_functions}}cdef cudaError_t _cudaStreamWaitEvent(cudaStream_t stream, cudaEvent_t event, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaStreamSynchronize' in found_functions}}cdef cudaError_t _cudaStreamSynchronize(cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaStreamQuery' in found_functions}}cdef cudaError_t _cudaStreamQuery(cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaStreamAttachMemAsync' in found_functions}}cdef cudaError_t _cudaStreamAttachMemAsync(cudaStream_t stream, void* devPtr, size_t length, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaStreamBeginCapture' in found_functions}}cdef cudaError_t _cudaStreamBeginCapture(cudaStream_t stream, cudaStreamCaptureMode mode) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaStreamBeginCaptureToGraph' in found_functions}}cdef cudaError_t _cudaStreamBeginCaptureToGraph(cudaStream_t stream, cudaGraph_t graph, const cudaGraphNode_t* dependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, cudaStreamCaptureMode mode) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaThreadExchangeStreamCaptureMode' in found_functions}}cdef cudaError_t _cudaThreadExchangeStreamCaptureMode(cudaStreamCaptureMode* mode) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaStreamEndCapture' in found_functions}}cdef cudaError_t _cudaStreamEndCapture(cudaStream_t stream, cudaGraph_t* pGraph) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaStreamIsCapturing' in found_functions}}cdef cudaError_t _cudaStreamIsCapturing(cudaStream_t stream, cudaStreamCaptureStatus* pCaptureStatus) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaStreamUpdateCaptureDependencies' in found_functions}}cdef cudaError_t _cudaStreamUpdateCaptureDependencies(cudaStream_t stream, cudaGraphNode_t* dependencies, size_t numDependencies, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaEventCreateWithFlags' in found_functions}}cdef cudaError_t _cudaEventCreateWithFlags(cudaEvent_t* event, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaEventRecord' in found_functions}}cdef cudaError_t _cudaEventRecord(cudaEvent_t event, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaEventRecordWithFlags' in found_functions}}cdef cudaError_t _cudaEventRecordWithFlags(cudaEvent_t event, cudaStream_t stream, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaEventSynchronize' in found_functions}}cdef cudaError_t _cudaEventSynchronize(cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaEventDestroy' in found_functions}}cdef cudaError_t _cudaEventDestroy(cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaEventElapsedTime' in found_functions}}cdef cudaError_t _cudaEventElapsedTime(float* ms, cudaEvent_t start, cudaEvent_t end) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDestroyExternalMemory' in found_functions}}cdef cudaError_t _cudaDestroyExternalMemory(cudaExternalMemory_t extMem) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDestroyExternalSemaphore' in found_functions}}cdef cudaError_t _cudaDestroyExternalSemaphore(cudaExternalSemaphore_t extSem) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaFuncSetCacheConfig' in found_functions}}cdef cudaError_t _cudaFuncSetCacheConfig(const void* func, cudaFuncCache cacheConfig) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaFuncSetSharedMemConfig' in found_functions}}cdef cudaError_t _cudaFuncSetSharedMemConfig(const void* func, cudaSharedMemConfig config) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaFuncSetAttribute' in found_functions}}cdef cudaError_t _cudaFuncSetAttribute(const void* func, cudaFuncAttribute attr, int value) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaLaunchHostFunc' in found_functions}}cdef cudaError_t _cudaLaunchHostFunc(cudaStream_t stream, cudaHostFn_t fn, void* userData) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaOccupancyMaxActiveBlocksPerMultiprocessor' in found_functions}}cdef cudaError_t _cudaOccupancyMaxActiveBlocksPerMultiprocessor(int* numBlocks, const void* func, int blockSize, size_t dynamicSMemSize) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaOccupancyAvailableDynamicSMemPerBlock' in found_functions}}cdef cudaError_t _cudaOccupancyAvailableDynamicSMemPerBlock(size_t* dynamicSmemSize, const void* func, int numBlocks, int blockSize) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags' in found_functions}}cdef cudaError_t _cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(int* numBlocks, const void* func, int blockSize, size_t dynamicSMemSize, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMallocManaged' in found_functions}}cdef cudaError_t _cudaMallocManaged(void** devPtr, size_t size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMalloc' in found_functions}}cdef cudaError_t _cudaMalloc(void** devPtr, size_t size) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaFree' in found_functions}}cdef cudaError_t _cudaFree(void* devPtr) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaFreeHost' in found_functions}}cdef cudaError_t _cudaFreeHost(void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaFreeArray' in found_functions}}cdef cudaError_t _cudaFreeArray(cudaArray_t array) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaFreeMipmappedArray' in found_functions}}cdef cudaError_t _cudaFreeMipmappedArray(cudaMipmappedArray_t mipmappedArray) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaHostAlloc' in found_functions}}cdef cudaError_t _cudaHostAlloc(void** pHost, size_t size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaHostRegister' in found_functions}}cdef cudaError_t _cudaHostRegister(void* ptr, size_t size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaHostUnregister' in found_functions}}cdef cudaError_t _cudaHostUnregister(void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaHostGetDevicePointer' in found_functions}}cdef cudaError_t _cudaHostGetDevicePointer(void** pDevice, void* pHost, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaHostGetFlags' in found_functions}}cdef cudaError_t _cudaHostGetFlags(unsigned int* pFlags, void* pHost) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGetMipmappedArrayLevel' in found_functions}}cdef cudaError_t _cudaGetMipmappedArrayLevel(cudaArray_t* levelArray, cudaMipmappedArray_const_t mipmappedArray, unsigned int level) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemGetInfo' in found_functions}}cdef cudaError_t _cudaMemGetInfo(size_t* free, size_t* total) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaArrayGetPlane' in found_functions}}cdef cudaError_t _cudaArrayGetPlane(cudaArray_t* pPlaneArray, cudaArray_t hArray, unsigned int planeIdx) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemset' in found_functions}}cdef cudaError_t _cudaMemset(void* devPtr, int value, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemset2D' in found_functions}}cdef cudaError_t _cudaMemset2D(void* devPtr, size_t pitch, int value, size_t width, size_t height) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemsetAsync' in found_functions}}cdef cudaError_t _cudaMemsetAsync(void* devPtr, int value, size_t count, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemset2DAsync' in found_functions}}cdef cudaError_t _cudaMemset2DAsync(void* devPtr, size_t pitch, int value, size_t width, size_t height, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemPrefetchAsync' in found_functions}}cdef cudaError_t _cudaMemPrefetchAsync(const void* devPtr, size_t count, int dstDevice, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMallocAsync' in found_functions}}cdef cudaError_t _cudaMallocAsync(void** devPtr, size_t size, cudaStream_t hStream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaFreeAsync' in found_functions}}cdef cudaError_t _cudaFreeAsync(void* devPtr, cudaStream_t hStream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemPoolTrimTo' in found_functions}}cdef cudaError_t _cudaMemPoolTrimTo(cudaMemPool_t memPool, size_t minBytesToKeep) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemPoolSetAttribute' in found_functions}}cdef cudaError_t _cudaMemPoolSetAttribute(cudaMemPool_t memPool, cudaMemPoolAttr attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemPoolGetAttribute' in found_functions}}cdef cudaError_t _cudaMemPoolGetAttribute(cudaMemPool_t memPool, cudaMemPoolAttr attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemPoolGetAccess' in found_functions}}cdef cudaError_t _cudaMemPoolGetAccess(cudaMemAccessFlags* flags, cudaMemPool_t memPool, cudaMemLocation* location) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemPoolCreate' in found_functions}}cdef cudaError_t _cudaMemPoolCreate(cudaMemPool_t* memPool, const cudaMemPoolProps* poolProps) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemPoolDestroy' in found_functions}}cdef cudaError_t _cudaMemPoolDestroy(cudaMemPool_t memPool) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMallocFromPoolAsync' in found_functions}}cdef cudaError_t _cudaMallocFromPoolAsync(void** ptr, size_t size, cudaMemPool_t memPool, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemPoolExportToShareableHandle' in found_functions}}cdef cudaError_t _cudaMemPoolExportToShareableHandle(void* shareableHandle, cudaMemPool_t memPool, cudaMemAllocationHandleType handleType, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemPoolImportFromShareableHandle' in found_functions}}cdef cudaError_t _cudaMemPoolImportFromShareableHandle(cudaMemPool_t* memPool, void* shareableHandle, cudaMemAllocationHandleType handleType, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemPoolExportPointer' in found_functions}}cdef cudaError_t _cudaMemPoolExportPointer(cudaMemPoolPtrExportData* exportData, void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemPoolImportPointer' in found_functions}}cdef cudaError_t _cudaMemPoolImportPointer(void** ptr, cudaMemPool_t memPool, cudaMemPoolPtrExportData* exportData) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphicsUnregisterResource' in found_functions}}cdef cudaError_t _cudaGraphicsUnregisterResource(cudaGraphicsResource_t resource) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphicsResourceSetMapFlags' in found_functions}}cdef cudaError_t _cudaGraphicsResourceSetMapFlags(cudaGraphicsResource_t resource, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphicsMapResources' in found_functions}}cdef cudaError_t _cudaGraphicsMapResources(int count, cudaGraphicsResource_t* resources, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphicsUnmapResources' in found_functions}}cdef cudaError_t _cudaGraphicsUnmapResources(int count, cudaGraphicsResource_t* resources, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphicsResourceGetMappedPointer' in found_functions}}cdef cudaError_t _cudaGraphicsResourceGetMappedPointer(void** devPtr, size_t* size, cudaGraphicsResource_t resource) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphicsSubResourceGetMappedArray' in found_functions}}cdef cudaError_t _cudaGraphicsSubResourceGetMappedArray(cudaArray_t* array, cudaGraphicsResource_t resource, unsigned int arrayIndex, unsigned int mipLevel) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphicsResourceGetMappedMipmappedArray' in found_functions}}cdef cudaError_t _cudaGraphicsResourceGetMappedMipmappedArray(cudaMipmappedArray_t* mipmappedArray, cudaGraphicsResource_t resource) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDestroyTextureObject' in found_functions}}cdef cudaError_t _cudaDestroyTextureObject(cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDestroySurfaceObject' in found_functions}}cdef cudaError_t _cudaDestroySurfaceObject(cudaSurfaceObject_t surfObject) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphCreate' in found_functions}}cdef cudaError_t _cudaGraphCreate(cudaGraph_t* pGraph, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphAddKernelNode' in found_functions}}cdef cudaError_t _cudaGraphAddKernelNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphKernelNodeSetParams' in found_functions}}cdef cudaError_t _cudaGraphKernelNodeSetParams(cudaGraphNode_t node, const cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphKernelNodeCopyAttributes' in found_functions}}cdef cudaError_t _cudaGraphKernelNodeCopyAttributes(cudaGraphNode_t hSrc, cudaGraphNode_t hDst) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphMemsetNodeGetParams' in found_functions}}cdef cudaError_t _cudaGraphMemsetNodeGetParams(cudaGraphNode_t node, cudaMemsetParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphMemsetNodeSetParams' in found_functions}}cdef cudaError_t _cudaGraphMemsetNodeSetParams(cudaGraphNode_t node, const cudaMemsetParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphAddHostNode' in found_functions}}cdef cudaError_t _cudaGraphAddHostNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphHostNodeGetParams' in found_functions}}cdef cudaError_t _cudaGraphHostNodeGetParams(cudaGraphNode_t node, cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphHostNodeSetParams' in found_functions}}cdef cudaError_t _cudaGraphHostNodeSetParams(cudaGraphNode_t node, const cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphAddChildGraphNode' in found_functions}}cdef cudaError_t _cudaGraphAddChildGraphNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaGraph_t childGraph) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphChildGraphNodeGetGraph' in found_functions}}cdef cudaError_t _cudaGraphChildGraphNodeGetGraph(cudaGraphNode_t node, cudaGraph_t* pGraph) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphAddEmptyNode' in found_functions}}cdef cudaError_t _cudaGraphAddEmptyNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphAddEventRecordNode' in found_functions}}cdef cudaError_t _cudaGraphAddEventRecordNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphEventRecordNodeGetEvent' in found_functions}}cdef cudaError_t _cudaGraphEventRecordNodeGetEvent(cudaGraphNode_t node, cudaEvent_t* event_out) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphEventRecordNodeSetEvent' in found_functions}}cdef cudaError_t _cudaGraphEventRecordNodeSetEvent(cudaGraphNode_t node, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphAddEventWaitNode' in found_functions}}cdef cudaError_t _cudaGraphAddEventWaitNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphEventWaitNodeGetEvent' in found_functions}}cdef cudaError_t _cudaGraphEventWaitNodeGetEvent(cudaGraphNode_t node, cudaEvent_t* event_out) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphEventWaitNodeSetEvent' in found_functions}}cdef cudaError_t _cudaGraphEventWaitNodeSetEvent(cudaGraphNode_t node, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphAddExternalSemaphoresSignalNode' in found_functions}}cdef cudaError_t _cudaGraphAddExternalSemaphoresSignalNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphExternalSemaphoresSignalNodeGetParams' in found_functions}}cdef cudaError_t _cudaGraphExternalSemaphoresSignalNodeGetParams(cudaGraphNode_t hNode, cudaExternalSemaphoreSignalNodeParams* params_out) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphExternalSemaphoresSignalNodeSetParams' in found_functions}}cdef cudaError_t _cudaGraphExternalSemaphoresSignalNodeSetParams(cudaGraphNode_t hNode, const cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphAddExternalSemaphoresWaitNode' in found_functions}}cdef cudaError_t _cudaGraphAddExternalSemaphoresWaitNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphExternalSemaphoresWaitNodeGetParams' in found_functions}}cdef cudaError_t _cudaGraphExternalSemaphoresWaitNodeGetParams(cudaGraphNode_t hNode, cudaExternalSemaphoreWaitNodeParams* params_out) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphExternalSemaphoresWaitNodeSetParams' in found_functions}}cdef cudaError_t _cudaGraphExternalSemaphoresWaitNodeSetParams(cudaGraphNode_t hNode, const cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphAddMemFreeNode' in found_functions}}cdef cudaError_t _cudaGraphAddMemFreeNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, void* dptr) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDeviceGraphMemTrim' in found_functions}}cdef cudaError_t _cudaDeviceGraphMemTrim(int device) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDeviceGetGraphMemAttribute' in found_functions}}cdef cudaError_t _cudaDeviceGetGraphMemAttribute(int device, cudaGraphMemAttributeType attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDeviceSetGraphMemAttribute' in found_functions}}cdef cudaError_t _cudaDeviceSetGraphMemAttribute(int device, cudaGraphMemAttributeType attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphClone' in found_functions}}cdef cudaError_t _cudaGraphClone(cudaGraph_t* pGraphClone, cudaGraph_t originalGraph) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphNodeFindInClone' in found_functions}}cdef cudaError_t _cudaGraphNodeFindInClone(cudaGraphNode_t* pNode, cudaGraphNode_t originalNode, cudaGraph_t clonedGraph) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphNodeGetType' in found_functions}}cdef cudaError_t _cudaGraphNodeGetType(cudaGraphNode_t node, cudaGraphNodeType* pType) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphGetNodes' in found_functions}}cdef cudaError_t _cudaGraphGetNodes(cudaGraph_t graph, cudaGraphNode_t* nodes, size_t* numNodes) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphGetRootNodes' in found_functions}}cdef cudaError_t _cudaGraphGetRootNodes(cudaGraph_t graph, cudaGraphNode_t* pRootNodes, size_t* pNumRootNodes) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphGetEdges' in found_functions}}cdef cudaError_t _cudaGraphGetEdges(cudaGraph_t graph, cudaGraphNode_t* from_, cudaGraphNode_t* to, size_t* numEdges) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphNodeGetDependencies' in found_functions}}cdef cudaError_t _cudaGraphNodeGetDependencies(cudaGraphNode_t node, cudaGraphNode_t* pDependencies, size_t* pNumDependencies) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphNodeGetDependentNodes' in found_functions}}cdef cudaError_t _cudaGraphNodeGetDependentNodes(cudaGraphNode_t node, cudaGraphNode_t* pDependentNodes, size_t* pNumDependentNodes) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphAddDependencies' in found_functions}}cdef cudaError_t _cudaGraphAddDependencies(cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphRemoveDependencies' in found_functions}}cdef cudaError_t _cudaGraphRemoveDependencies(cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphDestroyNode' in found_functions}}cdef cudaError_t _cudaGraphDestroyNode(cudaGraphNode_t node) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphInstantiate' in found_functions}}cdef cudaError_t _cudaGraphInstantiate(cudaGraphExec_t* pGraphExec, cudaGraph_t graph, unsigned long long flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphInstantiateWithFlags' in found_functions}}cdef cudaError_t _cudaGraphInstantiateWithFlags(cudaGraphExec_t* pGraphExec, cudaGraph_t graph, unsigned long long flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphExecKernelNodeSetParams' in found_functions}}cdef cudaError_t _cudaGraphExecKernelNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphExecHostNodeSetParams' in found_functions}}cdef cudaError_t _cudaGraphExecHostNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphExecChildGraphNodeSetParams' in found_functions}}cdef cudaError_t _cudaGraphExecChildGraphNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, cudaGraph_t childGraph) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphExecEventRecordNodeSetEvent' in found_functions}}cdef cudaError_t _cudaGraphExecEventRecordNodeSetEvent(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphExecEventWaitNodeSetEvent' in found_functions}}cdef cudaError_t _cudaGraphExecEventWaitNodeSetEvent(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphExecExternalSemaphoresSignalNodeSetParams' in found_functions}}cdef cudaError_t _cudaGraphExecExternalSemaphoresSignalNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, const cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphExecExternalSemaphoresWaitNodeSetParams' in found_functions}}cdef cudaError_t _cudaGraphExecExternalSemaphoresWaitNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, const cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphNodeSetEnabled' in found_functions}}cdef cudaError_t _cudaGraphNodeSetEnabled(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, unsigned int isEnabled) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphNodeGetEnabled' in found_functions}}cdef cudaError_t _cudaGraphNodeGetEnabled(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, unsigned int* isEnabled) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphExecUpdate' in found_functions}}cdef cudaError_t _cudaGraphExecUpdate(cudaGraphExec_t hGraphExec, cudaGraph_t hGraph, cudaGraphExecUpdateResultInfo* resultInfo) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphUpload' in found_functions}}cdef cudaError_t _cudaGraphUpload(cudaGraphExec_t graphExec, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphLaunch' in found_functions}}cdef cudaError_t _cudaGraphLaunch(cudaGraphExec_t graphExec, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphExecDestroy' in found_functions}}cdef cudaError_t _cudaGraphExecDestroy(cudaGraphExec_t graphExec) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphDestroy' in found_functions}}cdef cudaError_t _cudaGraphDestroy(cudaGraph_t graph) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphDebugDotPrint' in found_functions}}cdef cudaError_t _cudaGraphDebugDotPrint(cudaGraph_t graph, const char* path, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaUserObjectCreate' in found_functions}}cdef cudaError_t _cudaUserObjectCreate(cudaUserObject_t* object_out, void* ptr, cudaHostFn_t destroy, unsigned int initialRefcount, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaUserObjectRetain' in found_functions}}cdef cudaError_t _cudaUserObjectRetain(cudaUserObject_t object, unsigned int count) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaUserObjectRelease' in found_functions}}cdef cudaError_t _cudaUserObjectRelease(cudaUserObject_t object, unsigned int count) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphRetainUserObject' in found_functions}}cdef cudaError_t _cudaGraphRetainUserObject(cudaGraph_t graph, cudaUserObject_t object, unsigned int count, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphReleaseUserObject' in found_functions}}cdef cudaError_t _cudaGraphReleaseUserObject(cudaGraph_t graph, cudaUserObject_t object, unsigned int count) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if True}}cdef cudaError_t _cudaProfilerStart() except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if True}}cdef cudaError_t _cudaProfilerStop() except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if True}}cdef cudaError_t _cudaGraphicsEGLRegisterImage(cudaGraphicsResource_t* pCudaResource, EGLImageKHR image, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if True}}cdef cudaError_t _cudaEGLStreamConsumerConnect(cudaEglStreamConnection* conn, EGLStreamKHR eglStream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if True}}cdef cudaError_t _cudaEGLStreamConsumerConnectWithFlags(cudaEglStreamConnection* conn, EGLStreamKHR eglStream, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if True}}cdef cudaError_t _cudaEGLStreamConsumerDisconnect(cudaEglStreamConnection* conn) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if True}}cdef cudaError_t _cudaEGLStreamConsumerAcquireFrame(cudaEglStreamConnection* conn, cudaGraphicsResource_t* pCudaResource, cudaStream_t* pStream, unsigned int timeout) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if True}}cdef cudaError_t _cudaEGLStreamConsumerReleaseFrame(cudaEglStreamConnection* conn, cudaGraphicsResource_t pCudaResource, cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if True}}cdef cudaError_t _cudaEGLStreamProducerConnect(cudaEglStreamConnection* conn, EGLStreamKHR eglStream, EGLint width, EGLint height) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if True}}cdef cudaError_t _cudaEGLStreamProducerDisconnect(cudaEglStreamConnection* conn) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if True}}cdef cudaError_t _cudaEventCreateFromEGLSync(cudaEvent_t* phEvent, EGLSyncKHR eglSync, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaInitDevice' in found_functions}}cdef cudaError_t _cudaInitDevice(int device, unsigned int deviceFlags, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaStreamGetId' in found_functions}}cdef cudaError_t _cudaStreamGetId(cudaStream_t hStream, unsigned long long* streamId) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphInstantiateWithParams' in found_functions}}cdef cudaError_t _cudaGraphInstantiateWithParams(cudaGraphExec_t* pGraphExec, cudaGraph_t graph, cudaGraphInstantiateParams* instantiateParams) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphExecGetFlags' in found_functions}}cdef cudaError_t _cudaGraphExecGetFlags(cudaGraphExec_t graphExec, unsigned long long* flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGetKernel' in found_functions}}cdef cudaError_t _cudaGetKernel(cudaKernel_t* kernelPtr, const void* entryFuncAddr) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphAddNode' in found_functions}}cdef cudaError_t _cudaGraphAddNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphNodeSetParams' in found_functions}}cdef cudaError_t _cudaGraphNodeSetParams(cudaGraphNode_t node, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphExecNodeSetParams' in found_functions}}cdef cudaError_t _cudaGraphExecNodeSetParams(cudaGraphExec_t graphExec, cudaGraphNode_t node, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemPrefetchAsync_v2' in found_functions}}cdef cudaError_t _cudaMemPrefetchAsync_v2(const void* devPtr, size_t count, cudaMemLocation location, unsigned int flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemAdvise_v2' in found_functions}}cdef cudaError_t _cudaMemAdvise_v2(const void* devPtr, size_t count, cudaMemoryAdvise advice, cudaMemLocation location) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphConditionalHandleCreate' in found_functions}}cdef cudaError_t _cudaGraphConditionalHandleCreate(cudaGraphConditionalHandle* pHandle_out, cudaGraph_t graph, unsigned int defaultLaunchValue, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaStreamGetCaptureInfo_v3' in found_functions}}cdef cudaError_t _cudaStreamGetCaptureInfo_v3(cudaStream_t stream, cudaStreamCaptureStatus* captureStatus_out, unsigned long long* id_out, cudaGraph_t* graph_out, const cudaGraphNode_t** dependencies_out, const cudaGraphEdgeData** edgeData_out, size_t* numDependencies_out) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaStreamUpdateCaptureDependencies_v2' in found_functions}}cdef cudaError_t _cudaStreamUpdateCaptureDependencies_v2(cudaStream_t stream, cudaGraphNode_t* dependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphGetEdges_v2' in found_functions}}cdef cudaError_t _cudaGraphGetEdges_v2(cudaGraph_t graph, cudaGraphNode_t* from_, cudaGraphNode_t* to, cudaGraphEdgeData* edgeData, size_t* numEdges) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphNodeGetDependencies_v2' in found_functions}}cdef cudaError_t _cudaGraphNodeGetDependencies_v2(cudaGraphNode_t node, cudaGraphNode_t* pDependencies, cudaGraphEdgeData* edgeData, size_t* pNumDependencies) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphNodeGetDependentNodes_v2' in found_functions}}cdef cudaError_t _cudaGraphNodeGetDependentNodes_v2(cudaGraphNode_t node, cudaGraphNode_t* pDependentNodes, cudaGraphEdgeData* edgeData, size_t* pNumDependentNodes) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphAddDependencies_v2' in found_functions}}cdef cudaError_t _cudaGraphAddDependencies_v2(cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, const cudaGraphEdgeData* edgeData, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphRemoveDependencies_v2' in found_functions}}cdef cudaError_t _cudaGraphRemoveDependencies_v2(cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, const cudaGraphEdgeData* edgeData, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphAddNode_v2' in found_functions}}cdef cudaError_t _cudaGraphAddNode_v2(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if True}}cdef cudaError_t _getLocalRuntimeVersion(int* runtimeVersion) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDeviceRegisterAsyncNotification' in found_functions}}cdef cudaError_t _cudaDeviceRegisterAsyncNotification(int device, cudaAsyncCallback callbackFunc, void* userData, cudaAsyncCallbackHandle_t* callback) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDeviceUnregisterAsyncNotification' in found_functions}}cdef cudaError_t _cudaDeviceUnregisterAsyncNotification(int device, cudaAsyncCallbackHandle_t callback) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGetDriverEntryPointByVersion' in found_functions}}cdef cudaError_t _cudaGetDriverEntryPointByVersion(const char* symbol, void** funcPtr, unsigned int cudaVersion, unsigned long long flags, cudaDriverEntryPointQueryResult* driverStatus) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} diff --git a/cuda/_lib/ccudart/ccudart.pyx.in b/cuda/_lib/ccudart/ccudart.pyx.in deleted file mode 100644 index 25cb36f2008..00000000000 --- a/cuda/_lib/ccudart/ccudart.pyx.in +++ /dev/null @@ -1,4930 +0,0 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. -# -# Please refer to the NVIDIA end user license agreement (EULA) associated -# with this source code for terms and conditions that govern your use of -# this software. Any use, reproduction, disclosure, or distribution of -# this software and related documentation outside the terms of the EULA -# is strictly prohibited. -from cuda.ccudart cimport * -from cuda._lib.ccudart.utils cimport * -from libc.stdlib cimport malloc, free, calloc -from libc.string cimport memset, memcpy, strncmp -from libcpp cimport bool -cimport cuda._cuda.ccuda as ccuda - -cdef cudaPythonGlobal m_global = globalGetInstance() - -{{if 'cudaMemcpy' in found_functions}} - -cdef cudaError_t _cudaMemcpy(void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = memcpyDispatch(dst, src, count, kind) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaStreamCreate' in found_functions}} - -cdef cudaError_t _cudaStreamCreate(cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuStreamCreate(pStream, 0) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaEventCreate' in found_functions}} - -cdef cudaError_t _cudaEventCreate(cudaEvent_t* event) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuEventCreate(event, ccuda.CUevent_flags_enum.CU_EVENT_DEFAULT) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaEventQuery' in found_functions}} - -cdef cudaError_t _cudaEventQuery(cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = ccuda._cuEventQuery(event) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaCreateChannelDesc' in found_functions}} - -cdef cudaChannelFormatDesc _cudaCreateChannelDesc(int x, int y, int z, int w, cudaChannelFormatKind f) noexcept nogil: - cdef cudaChannelFormatDesc desc - desc.x = x - desc.y = y - desc.z = z - desc.w = w - desc.f = f - return desc - - -{{endif}} -{{if 'cudaDriverGetVersion' in found_functions}} - -cdef cudaError_t _cudaDriverGetVersion(int* driverVersion) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = ccuda._cuDriverGetVersion(driverVersion) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaRuntimeGetVersion' in found_functions}} - -cdef cudaError_t _cudaRuntimeGetVersion(int* runtimeVersion) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - runtimeVersion[0] = m_global._CUDART_VERSION - return cudaSuccess - - -{{endif}} -{{if 'cudaDeviceGetTexture1DLinearMaxWidth' in found_functions}} - -cdef cudaError_t _cudaDeviceGetTexture1DLinearMaxWidth(size_t* maxWidthInElements, const cudaChannelFormatDesc* fmtDesc, int device) except ?cudaErrorCallRequiresNewerDriver nogil: - if fmtDesc == NULL: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - - cdef cudaError_t err = cudaSuccess - cdef ccuda.CUarray_format fmt - cdef int numChannels = 0 - - err = m_global.lazyInitDriver() - if err != cudaSuccess: - return err - err = getDescInfo(fmtDesc, &numChannels, &fmt) - if err == cudaSuccess: - _setLastError(err) - return err - err = ccuda._cuDeviceGetTexture1DLinearMaxWidth(maxWidthInElements, fmt, numChannels, device) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaMallocHost' in found_functions}} - -cdef cudaError_t _cudaMallocHost(void** ptr, size_t size) except ?cudaErrorCallRequiresNewerDriver nogil: - if ptr == NULL: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = mallocHost(size, ptr, 0) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaMallocPitch' in found_functions}} - -cdef cudaError_t _cudaMallocPitch(void** devPtr, size_t* pitch, size_t width, size_t height) except ?cudaErrorCallRequiresNewerDriver nogil: - if devPtr == NULL or pitch == NULL: - return cudaErrorInvalidValue - - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = mallocPitch(width, height, 1, devPtr, pitch) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaMallocMipmappedArray' in found_functions}} - -cdef cudaError_t _cudaMallocMipmappedArray(cudaMipmappedArray_t* mipmappedArray, const cudaChannelFormatDesc* desc, cudaExtent extent, unsigned int numLevels, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - if mipmappedArray == NULL or desc == NULL: - return cudaErrorInvalidValue - - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = mallocMipmappedArray(mipmappedArray, desc, extent.depth, extent.height, extent.width, numLevels, flags) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaMemcpy2D' in found_functions}} - -cdef cudaError_t _cudaMemcpy2D(void* dst, size_t dpitch, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = memcpy2DPtr(dst, dpitch, src, spitch, width, height, kind, NULL, False) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaMemcpy2DAsync' in found_functions}} - -cdef cudaError_t _cudaMemcpy2DAsync(void* dst, size_t dpitch, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = memcpy2DPtr(dst, dpitch, src, spitch, width, height, kind, stream, True) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaMemcpyAsync' in found_functions}} - -cdef cudaError_t _cudaMemcpyAsync(void* dst, const void* src, size_t count, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = memcpyAsyncDispatch(dst, src, count, kind, stream) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaGraphAddMemcpyNode' in found_functions}} - -cdef cudaError_t _cudaGraphAddMemcpyNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaMemcpy3DParms* pCopyParams) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef ccuda.CUcontext context - cdef ccuda.CUDA_MEMCPY3D_v2 driverNodeParams - cdef cudaError_t err = cudaSuccess - - if pCopyParams == NULL: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - - err = ccuda._cuCtxGetCurrent(&context) - if err != cudaSuccess: - _setLastError(err) - return err - - err = toDriverMemCopy3DParams(pCopyParams, &driverNodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - - err = ccuda._cuGraphAddMemcpyNode(pGraphNode, graph, pDependencies, numDependencies, &driverNodeParams, context) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaGraphAddMemcpyNode1D' in found_functions}} - -cdef cudaError_t _cudaGraphAddMemcpyNode1D(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef ccuda.CUcontext context - cdef ccuda.CUDA_MEMCPY3D_v2 driverNodeParams - cdef cudaMemcpy3DParms copyParams - cdef cudaError_t err = cudaSuccess - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - - err = ccuda._cuCtxGetCurrent(&context) - if err != cudaSuccess: - _setLastError(err) - return err - - copy1DConvertTo3DParams(dst, src, count, kind, ©Params) - - err = toDriverMemCopy3DParams(©Params, &driverNodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - - err = ccuda._cuGraphAddMemcpyNode(pGraphNode, graph, pDependencies, numDependencies, &driverNodeParams, context) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaGraphMemcpyNodeSetParams1D' in found_functions}} - -cdef cudaError_t _cudaGraphMemcpyNodeSetParams1D(cudaGraphNode_t node, void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef ccuda.CUDA_MEMCPY3D_v2 driverNodeParams - cdef cudaMemcpy3DParms copyParams - cdef cudaError_t err = cudaSuccess - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - copy1DConvertTo3DParams(dst, src, count, kind, ©Params) - - err = toDriverMemCopy3DParams(©Params, &driverNodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - - err = ccuda._cuGraphMemcpyNodeSetParams(node, &driverNodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaGraphExecMemcpyNodeSetParams' in found_functions}} - -cdef cudaError_t _cudaGraphExecMemcpyNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaMemcpy3DParms* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef ccuda.CUcontext context - cdef ccuda.CUDA_MEMCPY3D_v2 driverNodeParams - cdef cudaError_t err = cudaSuccess - - if pNodeParams == NULL: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - - err = ccuda._cuCtxGetCurrent(&context) - if err != cudaSuccess: - _setLastError(err) - return err - - err = toDriverMemCopy3DParams(pNodeParams, &driverNodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - - err = ccuda._cuGraphExecMemcpyNodeSetParams(hGraphExec, node, &driverNodeParams, context) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaGraphExecMemcpyNodeSetParams1D' in found_functions}} - -cdef cudaError_t _cudaGraphExecMemcpyNodeSetParams1D(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef ccuda.CUcontext context - cdef ccuda.CUDA_MEMCPY3D_v2 driverNodeParams - cdef cudaMemcpy3DParms copyParams - cdef cudaError_t err = cudaSuccess - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - - err = ccuda._cuCtxGetCurrent(&context) - if err != cudaSuccess: - _setLastError(err) - return err - - copy1DConvertTo3DParams(dst, src, count, kind, ©Params) - - err = toDriverMemCopy3DParams(©Params, &driverNodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - - err = ccuda._cuGraphExecMemcpyNodeSetParams(hGraphExec, node, &driverNodeParams, context) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaGetDriverEntryPoint' in found_functions}} - -cdef cudaError_t _cudaGetDriverEntryPoint(const char* symbol, void** funcPtr, unsigned long long flags, cudaDriverEntryPointQueryResult* driverStatus) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = ccuda._cuGetProcAddress_v2(symbol, funcPtr, m_global._CUDART_VERSION, flags, driverStatus) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaGraphAddMemsetNode' in found_functions}} - -cdef cudaError_t _cudaGraphAddMemsetNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaMemsetParams* pMemsetParams) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef ccuda.CUcontext context - cdef ccuda.CUDA_MEMSET_NODE_PARAMS driverParams - cdef cudaError_t err = cudaSuccess - - if pMemsetParams == NULL: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - - err = ccuda._cuCtxGetCurrent(&context) - if err != cudaSuccess: - _setLastError(err) - return err - - toDriverMemsetNodeParams(pMemsetParams, &driverParams) - - err = ccuda._cuGraphAddMemsetNode(pGraphNode, graph, pDependencies, numDependencies, &driverParams, context) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaGraphExecMemsetNodeSetParams' in found_functions}} - -cdef cudaError_t _cudaGraphExecMemsetNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaMemsetParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef ccuda.CUcontext context - cdef ccuda.CUDA_MEMSET_NODE_PARAMS driverParams - cdef cudaError_t err = cudaSuccess - - if pNodeParams == NULL: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - - err = ccuda._cuCtxGetCurrent(&context) - if err != cudaSuccess: - _setLastError(err) - return err - - toDriverMemsetNodeParams(pNodeParams, &driverParams) - - err = ccuda._cuGraphExecMemsetNodeSetParams(hGraphExec, node, &driverParams, context) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaGraphMemcpyNodeSetParams' in found_functions}} - -cdef cudaError_t _cudaGraphMemcpyNodeSetParams(cudaGraphNode_t node, const cudaMemcpy3DParms* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef ccuda.CUDA_MEMCPY3D_v2 driverNodeParams - cdef cudaError_t err = cudaSuccess - - if pNodeParams == NULL: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = toDriverMemCopy3DParams(pNodeParams, &driverNodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - err = ccuda._cuGraphMemcpyNodeSetParams(node, &driverNodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaGraphMemcpyNodeGetParams' in found_functions}} - -cdef cudaError_t _cudaGraphMemcpyNodeGetParams(cudaGraphNode_t node, cudaMemcpy3DParms* p) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef ccuda.CUDA_MEMCPY3D_v2 driverNodeParams - - if p == NULL: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphMemcpyNodeGetParams(node, &driverNodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - err = toCudartMemCopy3DParams(&driverNodeParams, p) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaFuncGetAttributes' in found_functions}} - -cdef cudaError_t _cudaFuncGetAttributes(cudaFuncAttributes* attr, const void* func) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - if NULL == attr: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - cdef int bytes = 0 - memset(attr, 0, sizeof(cudaFuncAttributes)) - err = ccuda._cuFuncGetAttribute(&attr[0].maxThreadsPerBlock, ccuda.CUfunction_attribute_enum.CU_FUNC_ATTRIBUTE_MAX_THREADS_PER_BLOCK, func) - if err != cudaSuccess: - _setLastError(err) - return err - err = ccuda._cuFuncGetAttribute(&attr[0].numRegs, ccuda.CUfunction_attribute_enum.CU_FUNC_ATTRIBUTE_NUM_REGS, func) - if err != cudaSuccess: - _setLastError(err) - return err - err = ccuda._cuFuncGetAttribute(&attr[0].ptxVersion, ccuda.CUfunction_attribute_enum.CU_FUNC_ATTRIBUTE_PTX_VERSION, func) - if err != cudaSuccess: - _setLastError(err) - return err - err = ccuda._cuFuncGetAttribute(&attr[0].binaryVersion, ccuda.CUfunction_attribute_enum.CU_FUNC_ATTRIBUTE_BINARY_VERSION, func) - if err != cudaSuccess: - _setLastError(err) - return err - err = ccuda._cuFuncGetAttribute(&bytes, ccuda.CUfunction_attribute_enum.CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES, func) - if err != cudaSuccess: - _setLastError(err) - return err - attr[0].sharedSizeBytes = bytes - err = ccuda._cuFuncGetAttribute(&bytes, ccuda.CUfunction_attribute_enum.CU_FUNC_ATTRIBUTE_CONST_SIZE_BYTES, func) - if err != cudaSuccess: - _setLastError(err) - return err - attr[0].constSizeBytes = bytes - err = ccuda._cuFuncGetAttribute(&bytes, ccuda.CUfunction_attribute_enum.CU_FUNC_ATTRIBUTE_LOCAL_SIZE_BYTES, func) - if err != cudaSuccess: - _setLastError(err) - return err - attr[0].localSizeBytes = bytes - err = ccuda._cuFuncGetAttribute(&attr[0].cacheModeCA, ccuda.CUfunction_attribute_enum.CU_FUNC_ATTRIBUTE_CACHE_MODE_CA, func) - if err != cudaSuccess: - _setLastError(err) - return err - err = ccuda._cuFuncGetAttribute(&bytes, ccuda.CUfunction_attribute_enum.CU_FUNC_ATTRIBUTE_MAX_DYNAMIC_SHARED_SIZE_BYTES, func) - if err != cudaSuccess: - _setLastError(err) - return err - err = ccuda._cuFuncGetAttribute(&attr[0].preferredShmemCarveout, ccuda.CUfunction_attribute_enum.CU_FUNC_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT, func) - if err != cudaSuccess: - _setLastError(err) - return err - attr[0].maxDynamicSharedSizeBytes = bytes - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaMallocArray' in found_functions}} - -cdef cudaError_t _cudaMallocArray(cudaArray_t* arrayPtr, const cudaChannelFormatDesc* desc, size_t width, size_t height, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - if arrayPtr == NULL or desc == NULL: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = mallocArray(arrayPtr, desc, 0, height, width, 0, flags) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaMalloc3D' in found_functions}} - -cdef cudaError_t _cudaMalloc3D(cudaPitchedPtr* pitchedDevPtr, cudaExtent extent) except ?cudaErrorCallRequiresNewerDriver nogil: - if pitchedDevPtr == NULL: - return cudaErrorInvalidValue - - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = mallocPitch(extent.width, extent.height, extent.depth, &pitchedDevPtr[0].ptr, &pitchedDevPtr[0].pitch) - if err != cudaSuccess: - _setLastError(err) - return err - pitchedDevPtr[0].xsize = extent.width - pitchedDevPtr[0].ysize = extent.height - return err - - -{{endif}} -{{if 'cudaMalloc3DArray' in found_functions}} - -cdef cudaError_t _cudaMalloc3DArray(cudaArray_t* arrayPtr, const cudaChannelFormatDesc* desc, cudaExtent extent, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - if arrayPtr == NULL or desc == NULL: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = mallocArray(arrayPtr, desc, extent.depth, extent.height, extent.width, 0, flags) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaGetErrorString' in found_functions}} - -cdef const char* _cudaGetErrorString(cudaError_t error) except ?NULL nogil: - cdef const char* pStr = NULL - cdef cudaError_t err = cudaSuccess - - err = ccuda._cuGetErrorString(error, &pStr) - if err != cudaSuccess: - _setLastError(err) - if err == cudaErrorInvalidValue: - pStr = "unrecognized error code" - return pStr - - -{{endif}} -{{if 'cudaStreamAddCallback' in found_functions}} - -cdef cudaError_t _cudaStreamAddCallback(cudaStream_t stream, cudaStreamCallback_t callback, void* userData, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = streamAddCallbackCommon(stream, callback, userData, flags) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaStreamGetCaptureInfo_v2' in found_functions}} - -cdef cudaError_t _cudaStreamGetCaptureInfo_v2(cudaStream_t stream, cudaStreamCaptureStatus* captureStatus_out, unsigned long long* id_out, cudaGraph_t* graph_out, const cudaGraphNode_t** dependencies_out, size_t* numDependencies_out) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = streamGetCaptureInfoCommon(stream, captureStatus_out, id_out, graph_out, dependencies_out, numDependencies_out) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaImportExternalSemaphore' in found_functions}} - -cdef cudaError_t _cudaImportExternalSemaphore(cudaExternalSemaphore_t* extSem_out, const cudaExternalSemaphoreHandleDesc* semHandleDesc) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - cdef ccuda.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC driverSemHandleDesc - - if semHandleDesc == NULL: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - - memset(&driverSemHandleDesc, 0, sizeof(driverSemHandleDesc)) - - if semHandleDesc.type == cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeOpaqueFd: - driverSemHandleDesc.type = ccuda.CUexternalSemaphoreHandleType_enum.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD - driverSemHandleDesc.handle.fd = semHandleDesc.handle.fd - elif semHandleDesc.type == cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeOpaqueWin32: - driverSemHandleDesc.type = ccuda.CUexternalSemaphoreHandleType_enum.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32 - driverSemHandleDesc.handle.win32.handle = semHandleDesc.handle.win32.handle - driverSemHandleDesc.handle.win32.name = semHandleDesc.handle.win32.name - elif semHandleDesc.type == cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeOpaqueWin32Kmt: - driverSemHandleDesc.type = ccuda.CUexternalSemaphoreHandleType_enum.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT - driverSemHandleDesc.handle.win32.handle = semHandleDesc.handle.win32.handle - driverSemHandleDesc.handle.win32.name = semHandleDesc.handle.win32.name - elif semHandleDesc.type == cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeD3D12Fence: - driverSemHandleDesc.type = ccuda.CUexternalSemaphoreHandleType_enum.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE - driverSemHandleDesc.handle.win32.handle = semHandleDesc.handle.win32.handle - driverSemHandleDesc.handle.win32.name = semHandleDesc.handle.win32.name - elif semHandleDesc.type == cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeD3D11Fence: - driverSemHandleDesc.type = ccuda.CUexternalSemaphoreHandleType_enum.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_FENCE - driverSemHandleDesc.handle.win32.handle = semHandleDesc.handle.win32.handle - driverSemHandleDesc.handle.win32.name = semHandleDesc.handle.win32.name - elif semHandleDesc.type == cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeNvSciSync: - driverSemHandleDesc.type = ccuda.CUexternalSemaphoreHandleType_enum.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC - driverSemHandleDesc.handle.nvSciSyncObj = semHandleDesc.handle.nvSciSyncObj - elif semHandleDesc.type == cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeKeyedMutex: - driverSemHandleDesc.type = ccuda.CUexternalSemaphoreHandleType_enum.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX - driverSemHandleDesc.handle.win32.handle = semHandleDesc.handle.win32.handle - driverSemHandleDesc.handle.win32.name = semHandleDesc.handle.win32.name - elif semHandleDesc.type == cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeKeyedMutexKmt: - driverSemHandleDesc.type = ccuda.CUexternalSemaphoreHandleType_enum.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX_KMT - driverSemHandleDesc.handle.win32.handle = semHandleDesc.handle.win32.handle - driverSemHandleDesc.handle.win32.name = semHandleDesc.handle.win32.name - elif semHandleDesc.type == cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeTimelineSemaphoreFd: - driverSemHandleDesc.type = ccuda.CUexternalSemaphoreHandleType_enum.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_FD - driverSemHandleDesc.handle.fd = semHandleDesc.handle.fd - elif semHandleDesc.type == cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeTimelineSemaphoreWin32: - driverSemHandleDesc.type = ccuda.CUexternalSemaphoreHandleType_enum.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_WIN32 - driverSemHandleDesc.handle.win32.handle = semHandleDesc.handle.win32.handle - driverSemHandleDesc.handle.win32.name = semHandleDesc.handle.win32.name - driverSemHandleDesc.flags = semHandleDesc.flags - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuImportExternalSemaphore(extSem_out, &driverSemHandleDesc) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaSignalExternalSemaphoresAsync_v2' in found_functions}} - -cdef cudaError_t _cudaSignalExternalSemaphoresAsync_v2(const cudaExternalSemaphore_t* extSemArray, const cudaExternalSemaphoreSignalParams* paramsArray, unsigned int numExtSems, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuSignalExternalSemaphoresAsync(extSemArray, paramsArray, numExtSems, stream) - if err != cudaSuccess: - _setLastError(err) - return err - return cudaSuccess - - -{{endif}} -{{if 'cudaWaitExternalSemaphoresAsync_v2' in found_functions}} - -cdef cudaError_t _cudaWaitExternalSemaphoresAsync_v2(const cudaExternalSemaphore_t* extSemArray, const cudaExternalSemaphoreWaitParams* paramsArray, unsigned int numExtSems, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuWaitExternalSemaphoresAsync(extSemArray, paramsArray, numExtSems, stream) - if err != cudaSuccess: - _setLastError(err) - return err - return cudaSuccess - - -{{endif}} -{{if 'cudaArrayGetInfo' in found_functions}} - -cdef cudaError_t _cudaArrayGetInfo(cudaChannelFormatDesc* desc, cudaExtent* extent, unsigned int* flags, cudaArray_t array) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - cdef ccuda.CUDA_ARRAY3D_DESCRIPTOR_v2 driverDesc - cdef size_t width = 0 - cdef size_t height = 0 - cdef size_t depth = 0 - - # Zero out parameters in case cuArray3DGetDescriptor fails - if flags: - flags[0] = 0 - - if desc: - memset(desc, 0, sizeof(desc[0])) - - - if extent: - memset(extent, 0, sizeof(extent[0])) - - err = ccuda._cuArray3DGetDescriptor_v2(&driverDesc, array) - if err != cudaSuccess: - _setLastError(err) - return err - - # Flags are copied directly from the driver API - if flags: - flags[0] = driverDesc.Flags - - # Convert from driver API types to runtime API types. extent.Depth = 0 - # indicates a 2D array. - if desc: - width = 0 - height = 0 - depth = 0 - - err = getChannelFormatDescFromDriverDesc(desc, &depth, &height, &width, &driverDesc) - if err != cudaSuccess: - _setLastError(err) - return err - - if extent: - extent.width = driverDesc.Width - extent.height = driverDesc.Height - extent.depth = driverDesc.Depth - - return cudaSuccess - - -{{endif}} -{{if 'cudaMemcpy2DToArray' in found_functions}} - -cdef cudaError_t _cudaMemcpy2DToArray(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = memcpy2DToArray(dst, hOffset, wOffset, src, spitch, width, height, kind, NULL, False) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaMemcpy2DFromArray' in found_functions}} - -cdef cudaError_t _cudaMemcpy2DFromArray(void* dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = memcpy2DFromArray(dst, dpitch, src, hOffset, wOffset, width, height, kind, NULL, False) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaMemcpy2DArrayToArray' in found_functions}} - -cdef cudaError_t _cudaMemcpy2DArrayToArray(cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = memcpy2DArrayToArray(dst, hOffsetDst, wOffsetDst, src, hOffsetSrc, wOffsetSrc, width, height, kind) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaMemcpy2DToArrayAsync' in found_functions}} - -cdef cudaError_t _cudaMemcpy2DToArrayAsync(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = memcpy2DToArray(dst, hOffset, wOffset, src, spitch, width, height, kind, stream, True) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaMemcpy2DFromArrayAsync' in found_functions}} - -cdef cudaError_t _cudaMemcpy2DFromArrayAsync(void* dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = memcpy2DFromArray(dst, dpitch, src, hOffset, wOffset, width, height, kind, stream, True) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaMemset3D' in found_functions}} - -cdef cudaError_t _cudaMemset3D(cudaPitchedPtr pitchedDevPtr, int value, cudaExtent extent) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = memset3DPtr(pitchedDevPtr, value, extent, NULL, False) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaMemset3DAsync' in found_functions}} - -cdef cudaError_t _cudaMemset3DAsync(cudaPitchedPtr pitchedDevPtr, int value, cudaExtent extent, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = memset3DPtr(pitchedDevPtr, value, extent, stream, True) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaMemcpyToArray' in found_functions}} - -cdef cudaError_t _cudaMemcpyToArray(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = memcpyToArray(dst, hOffset, wOffset, src, count, kind, NULL, False) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaMemcpyFromArray' in found_functions}} - -cdef cudaError_t _cudaMemcpyFromArray(void* dst, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = memcpyFromArray(dst, src, hOffset, wOffset, count, kind, NULL, 0) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaMemcpyToArrayAsync' in found_functions}} - -cdef cudaError_t _cudaMemcpyToArrayAsync(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t count, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = memcpyToArray(dst, hOffset, wOffset, src, count, kind, stream, True) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaMemcpyFromArrayAsync' in found_functions}} - -cdef cudaError_t _cudaMemcpyFromArrayAsync(void* dst, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = memcpyFromArray(dst, src, hOffset, wOffset, count, kind, stream, True) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaPointerGetAttributes' in found_functions}} - -cdef cudaError_t _cudaPointerGetAttributes(cudaPointerAttributes* attributes, const void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - cdef cudaPointerAttributes attrib - cdef ccuda.CUcontext driverContext = NULL - cdef ccuda.CUmemorytype driverMemoryType - cdef int isManaged = 0 - cdef ccuda.CUpointer_attribute[6] query - query[0] = ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_CONTEXT - query[1] = ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_MEMORY_TYPE - query[2] = ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_DEVICE_POINTER - query[3] = ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_HOST_POINTER - query[4] = ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_IS_MANAGED - query[5] = ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_DEVICE_ORDINAL - - memset(&attrib, 0, sizeof(attrib)) - memset(&driverMemoryType, 0, sizeof(driverMemoryType)) - - cdef void** data = [ - &driverContext, - &driverMemoryType, - &attrib.devicePointer, - &attrib.hostPointer, - &isManaged, - &attrib.device - ] - - if attributes == NULL: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - - # Get all the attributes we need - err = ccuda._cuPointerGetAttributes((sizeof(query)/sizeof(query[0])), query, data, ptr) - if err != cudaSuccess: - if attributes != NULL: - memset(attributes, 0, sizeof(attributes[0])) - attributes[0].device = -1 - _setLastError(err) - return err - - if driverMemoryType == ccuda.CUmemorytype_enum.CU_MEMORYTYPE_HOST: - if isManaged: - attrib.type = cudaMemoryTypeManaged - else: - attrib.type = cudaMemoryTypeHost - elif driverMemoryType == ccuda.CUmemorytype_enum.CU_MEMORYTYPE_DEVICE: - if isManaged: - attrib.type = cudaMemoryTypeManaged - else: - attrib.type = cudaMemoryTypeDevice - else: - if driverMemoryType == 0: - attrib.type = cudaMemoryTypeUnregistered - else: - if attributes != NULL: - memset(attributes, 0, sizeof(attributes[0])) - attributes[0].device = -1 - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - - # copy to user structure - attributes[0] = attrib - - return cudaSuccess - - -{{endif}} -{{if 'cudaGetDeviceFlags' in found_functions}} - -cdef cudaError_t _cudaGetDeviceFlags(unsigned int* flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitDriver() - if err != cudaSuccess: - return err - - if flags == NULL: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - - cdef ccuda.CUcontext driverContext - err = ccuda._cuCtxGetCurrent(&driverContext) - if err != cudaSuccess: - _setLastError(err) - return err - - # Get the flags from the current context - if driverContext != NULL: - err = ccuda._cuCtxGetFlags(flags) - if err != cudaSuccess: - _setLastError(err) - return err - - # Assume first valid device and get its implicit flags - cdef cudaPythonDevice* device - cdef unsigned int pcFlags - cdef int pcActive - device = m_global.getDevice(0) - err = ccuda._cuDevicePrimaryCtxGetState(device[0].driverDevice, &pcFlags, &pcActive) - if err != cudaSuccess: - _setLastError(err) - return err - flags[0] = pcFlags | cudaDeviceMapHost - return cudaSuccess - - -{{endif}} -{{if 'cudaMemcpy3D' in found_functions}} - -cdef cudaError_t _cudaMemcpy3D(const cudaMemcpy3DParms* p) except ?cudaErrorCallRequiresNewerDriver nogil: - if p == NULL: - return cudaErrorInvalidValue - - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = memcpy3D(p, False, 0, 0, NULL, False) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaMemcpy3DAsync' in found_functions}} - -cdef cudaError_t _cudaMemcpy3DAsync(const cudaMemcpy3DParms* p, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - if p == NULL: - return cudaErrorInvalidValue - - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = memcpy3D(p, False, 0, 0, stream, True) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaMemPoolSetAccess' in found_functions}} - -cdef cudaError_t _cudaMemPoolSetAccess(cudaMemPool_t memPool, const cudaMemAccessDesc* descList, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitDriver() - if err != cudaSuccess: - return err - cdef size_t MAX_DEVICES = 32 - cdef ccuda.CUmemAccessDesc localList[32] - cdef ccuda.CUmemAccessDesc *cuDescList - cdef size_t i = 0 - - if (count > MAX_DEVICES): - cuDescList = calloc(sizeof(ccuda.CUmemAccessDesc), count) - else: - cuDescList = localList - - if cuDescList == NULL: - _setLastError(cudaErrorMemoryAllocation) - return cudaErrorMemoryAllocation - - while i < count: - cuDescList[i].location.type = descList[i].location.type - cuDescList[i].location.id = descList[i].location.id - cuDescList[i].flags = descList[i].flags - i += 1 - - err = ccuda._cuMemPoolSetAccess(memPool, cuDescList, count) - if err != cudaSuccess: - _setLastError(err) - return err - - if count > MAX_DEVICES: - free(cuDescList) - - return cudaSuccess - - -{{endif}} -{{if 'cudaDeviceReset' in found_functions}} - -cdef cudaError_t _cudaDeviceReset() except ?cudaErrorCallRequiresNewerDriver nogil: - cdef int deviceOrdinal = 0 - cdef cudaError_t err = cudaSuccess - if not m_global._lazyInitDriver: - return cudaSuccess - - cdef ccuda.CUcontext context - err = ccuda._cuCtxGetCurrent(&context) - if err != cudaSuccess: - _setLastError(err) - return err - - cdef cudaPythonDevice* device - device = m_global.getDeviceFromPrimaryCtx(context) - if device != NULL: - err = resetPrimaryContext(device) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaGetLastError' in found_functions}} - -cdef cudaError_t _cudaGetLastError() except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t last_err = m_global._lastError - m_global._lastError = cudaSuccess - return last_err - - -{{endif}} -{{if 'cudaPeekAtLastError' in found_functions}} - -cdef cudaError_t _cudaPeekAtLastError() except ?cudaErrorCallRequiresNewerDriver nogil: - return m_global._lastError - - -{{endif}} -{{if 'cudaGetDevice' in found_functions}} - -cdef cudaError_t _cudaGetDevice(int* deviceOrdinal) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - cdef ccuda.CUdevice driverDevice = 0 - - err = m_global.lazyInitDriver() - if err != cudaSuccess: - return err - - cdef cudaPythonDevice *cudaDevice - err = ccuda._cuCtxGetDevice(&driverDevice) - if err == cudaSuccess: - cudaDevice = m_global.getDeviceFromDriver(driverDevice) - deviceOrdinal[0] = cudaDevice[0].deviceOrdinal - elif err == cudaErrorDeviceUninitialized: - # Like C Runtime, default to first device and let context creation happen in another call - # By default, device 0 would initialized - deviceOrdinal[0] = 0 - err = cudaSuccess - return err - - -{{endif}} -{{if 'cudaSetDevice' in found_functions}} - -cdef cudaError_t _cudaSetDevice(int deviceOrdinal) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - cdef cudaPythonDevice *device - - err = m_global.lazyInitDriver() - if err != cudaSuccess: - return err - - device = m_global.getDevice(deviceOrdinal) - if device == NULL: - _setLastError(err) - return cudaErrorInvalidDevice - - if device.primaryContext == NULL: - initPrimaryContext(device) - - err = ccuda._cuCtxSetCurrent(device.primaryContext) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaGetDeviceProperties_v2' in found_functions}} - -cdef cudaError_t _cudaGetDeviceProperties_v2(cudaDeviceProp* prop, int deviceOrdinal) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitDriver() - if err != cudaSuccess: - return err - - device = m_global.getDevice(deviceOrdinal) - if device == NULL: - _setLastError(err) - return cudaErrorInvalidDevice - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.kernelExecTimeoutEnabled), ccuda.CU_DEVICE_ATTRIBUTE_KERNEL_EXEC_TIMEOUT, device[0].driverDevice) - if err != cudaSuccess: - _setLastError(err) - return err - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.computeMode), ccuda.CU_DEVICE_ATTRIBUTE_COMPUTE_MODE, device[0].driverDevice) - if err != cudaSuccess: - _setLastError(err) - return err - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.clockRate), ccuda.CU_DEVICE_ATTRIBUTE_CLOCK_RATE, device[0].driverDevice) - if err != cudaSuccess: - _setLastError(err) - return err - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.memoryClockRate), ccuda.CU_DEVICE_ATTRIBUTE_MEMORY_CLOCK_RATE, device[0].driverDevice) - if err != cudaSuccess: - _setLastError(err) - return err - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.singleToDoublePrecisionPerfRatio), ccuda.CU_DEVICE_ATTRIBUTE_SINGLE_TO_DOUBLE_PRECISION_PERF_RATIO, device[0].driverDevice) - if err != cudaSuccess: - _setLastError(err) - return err - - prop[0] = device[0].deviceProperties - - return cudaSuccess - - -{{endif}} -{{if 'cudaChooseDevice' in found_functions}} - -cdef cudaError_t _cudaChooseDevice(int* device, const cudaDeviceProp* prop) except ?cudaErrorCallRequiresNewerDriver nogil: - if device == NULL or prop == NULL: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitDriver() - if err != cudaSuccess: - return err - cdef int best = -1 - cdef int maxrank = -1 - cdef int rank = 0 - cdef char* dontCare_name = [b'\0'] - cdef int dontCare_major = -1 - cdef int dontCare_minor = -1 - cdef size_t dontCare_totalGlobalMem = 0 - cdef int deviceOrdinal = 0 - cdef cudaDeviceProp *devProp - - for deviceOrdinal in range(m_global._numDevices): - devProp = &m_global._deviceList[deviceOrdinal].deviceProperties - rank = 0 - if (strncmp(prop[0].name, dontCare_name, sizeof(prop[0].name)) != 0): - rank += strncmp(prop[0].name, devProp[0].name, sizeof(prop[0].name)) == 0 - if (prop[0].major != dontCare_major): - rank += prop[0].major <= devProp[0].major - if (prop[0].major == devProp[0].major and prop[0].minor != dontCare_minor): - rank += prop[0].minor <= devProp[0].minor - if (prop[0].totalGlobalMem != dontCare_totalGlobalMem): - rank += prop[0].totalGlobalMem <= devProp[0].totalGlobalMem - if (rank > maxrank): - maxrank = rank - best = deviceOrdinal - - device[0] = best - return cudaSuccess - - -{{endif}} -{{if 'cudaMemcpyArrayToArray' in found_functions}} - -cdef cudaError_t _cudaMemcpyArrayToArray(cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = memcpyArrayToArray(dst, hOffsetDst, wOffsetDst, src, hOffsetSrc, wOffsetSrc, count, kind) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaGetChannelDesc' in found_functions}} - -cdef cudaError_t _cudaGetChannelDesc(cudaChannelFormatDesc* desc, cudaArray_const_t array) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - - if desc == NULL: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = getChannelDesc(array, desc) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaCreateTextureObject' in found_functions}} - -cdef cudaError_t _cudaCreateTextureObject(cudaTextureObject_t* pTexObject, const cudaResourceDesc* pResDesc, const cudaTextureDesc* pTexDesc, const cudaResourceViewDesc* pResViewDesc) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - - if pResDesc == NULL or pTexDesc == NULL: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - - cdef ccuda.CUDA_RESOURCE_DESC rd - cdef ccuda.CUDA_TEXTURE_DESC td - cdef ccuda.CUDA_RESOURCE_VIEW_DESC rvd - cdef cudaTextureDesc texDesc - memcpy(&texDesc, pTexDesc, sizeof(cudaTextureDesc)) - texDesc.seamlessCubemap = 0 - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - if pResViewDesc: - err = getDriverResDescFromResDesc(&rd, pResDesc, &td, &texDesc, &rvd, pResViewDesc) - else: - err = getDriverResDescFromResDesc(&rd, pResDesc, &td, &texDesc, NULL, pResViewDesc) - if err != cudaSuccess: - _setLastError(err) - return err - if pResViewDesc: - err = ccuda._cuTexObjectCreate(pTexObject, &rd, &td, &rvd) - else: - err = ccuda._cuTexObjectCreate(pTexObject, &rd, &td, NULL) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGetTextureObjectTextureDesc' in found_functions}} - -cdef cudaError_t _cudaGetTextureObjectTextureDesc(cudaTextureDesc* pTexDesc, cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - - cdef cudaResourceDesc resDesc - cdef ccuda.CUDA_RESOURCE_DESC rd - cdef ccuda.CUDA_TEXTURE_DESC td - cdef cudaTextureDesc texDesc - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuTexObjectGetResourceDesc(&rd, texObject) - if err != cudaSuccess: - _setLastError(err) - return err - err = ccuda._cuTexObjectGetTextureDesc(&td, texObject) - if err != cudaSuccess: - _setLastError(err) - return err - err = getResDescFromDriverResDesc(&resDesc, &rd, &texDesc, &td, NULL, NULL) - if err != cudaSuccess: - _setLastError(err) - return err - memcpy(pTexDesc, &texDesc, sizeof(cudaTextureDesc)) - - return cudaSuccess - -{{endif}} -{{if 'cudaGetTextureObjectResourceViewDesc' in found_functions}} - -cdef cudaError_t _cudaGetTextureObjectResourceViewDesc(cudaResourceViewDesc* pResViewDesc, cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - cdef cudaResourceDesc resDesc - cdef ccuda.CUDA_RESOURCE_DESC rd - cdef ccuda.CUDA_RESOURCE_VIEW_DESC rvd - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda.cuTexObjectGetResourceDesc(&rd, texObject) - if err != cudaSuccess: - _setLastError(err) - return err - err = ccuda.cuTexObjectGetResourceViewDesc(&rvd, texObject) - if err != cudaSuccess: - _setLastError(err) - return err - err = getResDescFromDriverResDesc(&resDesc, &rd, NULL, NULL, pResViewDesc, &rvd) - if err != cudaSuccess: - _setLastError(err) - return err - - return cudaSuccess - - -{{endif}} -{{if 'cudaGetExportTable' in found_functions}} - -cdef cudaError_t _cudaGetExportTable(const void** ppExportTable, const cudaUUID_t* pExportTableId) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - - err = m_global.lazyInitDriver() - if err != cudaSuccess: - return err - err = ccuda._cuGetExportTable(ppExportTable, pExportTableId) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaMemcpy3DPeer' in found_functions}} - -cdef cudaError_t _cudaMemcpy3DPeer(const cudaMemcpy3DPeerParms* p) except ?cudaErrorCallRequiresNewerDriver nogil: - if p == NULL: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - - cdef cudaError_t err = cudaSuccess - cdef cudaMemcpy3DParms cp - memset(&cp, 0, sizeof(cp)) - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - cp.srcArray = p[0].srcArray - cp.srcPos = p[0].srcPos - cp.srcPtr = p[0].srcPtr - cp.dstArray = p[0].dstArray - cp.dstPos = p[0].dstPos - cp.dstPtr = p[0].dstPtr - cp.extent = p[0].extent - cp.kind = cudaMemcpyKind.cudaMemcpyDeviceToDevice - - err = memcpy3D(&cp, True, p[0].srcDevice, p[0].dstDevice, NULL, False) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaMemcpy3DPeerAsync' in found_functions}} - -cdef cudaError_t _cudaMemcpy3DPeerAsync(const cudaMemcpy3DPeerParms* p, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - if p == NULL: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - - cdef cudaError_t err = cudaSuccess - cdef cudaMemcpy3DParms cp - memset(&cp, 0, sizeof(cp)) - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - cp.srcArray = p[0].srcArray - cp.srcPos = p[0].srcPos - cp.srcPtr = p[0].srcPtr - cp.dstArray = p[0].dstArray - cp.dstPos = p[0].dstPos - cp.dstPtr = p[0].dstPtr - cp.extent = p[0].extent - cp.kind = cudaMemcpyKind.cudaMemcpyDeviceToDevice - - err = memcpy3D(&cp, True, p[0].srcDevice, p[0].dstDevice, stream, True) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'make_cudaPitchedPtr' in found_functions}} - -cdef cudaPitchedPtr _make_cudaPitchedPtr(void* d, size_t p, size_t xsz, size_t ysz) noexcept nogil: - cdef cudaPitchedPtr s - s.ptr = d - s.pitch = p - s.xsize = xsz - s.ysize = ysz - return s - - -{{endif}} -{{if 'make_cudaPos' in found_functions}} - -cdef cudaPos _make_cudaPos(size_t x, size_t y, size_t z) noexcept nogil: - cdef cudaPos p - p.x = x - p.y = y - p.z = z - return p - - -{{endif}} -{{if 'make_cudaExtent' in found_functions}} - -cdef cudaExtent _make_cudaExtent(size_t w, size_t h, size_t d) noexcept nogil: - cdef cudaExtent e - e.width = w - e.height = h - e.depth = d - return e - - -{{endif}} -{{if 'cudaSetDeviceFlags' in found_functions}} - -cdef cudaError_t _cudaSetDeviceFlags(unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - flags &= ~cudaDeviceMapHost - if flags & ~cudaDeviceMask: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - cdef unsigned int scheduleFlags = flags & cudaDeviceScheduleMask - if scheduleFlags and (scheduleFlags != cudaDeviceScheduleSpin and - scheduleFlags != cudaDeviceScheduleYield and - scheduleFlags != cudaDeviceScheduleBlockingSync): - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - - cdef ccuda.CUcontext context - err = ccuda._cuCtxGetCurrent(&context) - if err != cudaSuccess: - _setLastError(err) - return err - - cdef cudaPythonDevice* device - device = m_global.getDeviceFromPrimaryCtx(context) - if device == NULL: - # We don't know if context provided is primary or not - # cudaSetDevice may need to be called before retrying call - return cudaErrorIncompatibleDriverContext - - err = ccuda._cuDevicePrimaryCtxSetFlags_v2(device[0].driverDevice, flags) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaGraphAddMemAllocNode' in found_functions}} - -cdef cudaError_t _cudaGraphAddMemAllocNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaMemAllocNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - if nodeParams == NULL: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphAddMemAllocNode(pGraphNode, graph, pDependencies, numDependencies, nodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaGraphMemAllocNodeGetParams' in found_functions}} - -cdef cudaError_t _cudaGraphMemAllocNodeGetParams(cudaGraphNode_t node, cudaMemAllocNodeParams* params_out) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - if params_out == NULL: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphMemAllocNodeGetParams(node, params_out) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaGraphMemFreeNodeGetParams' in found_functions}} - -cdef cudaError_t _cudaGraphMemFreeNodeGetParams(cudaGraphNode_t node, void* dptr_out) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - if dptr_out == NULL: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphMemFreeNodeGetParams(node, dptr_out) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaMemAdvise' in found_functions}} - -cdef cudaError_t _cudaMemAdvise(const void* devPtr, size_t count, cudaMemoryAdvise advice, int device) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuMemAdvise(devPtr, count, advice, device) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaMemAdvise_v2' in found_functions}} - -cdef cudaError_t _cudaMemAdvise_v2(const void* devPtr, size_t count, cudaMemoryAdvise advice, cudaMemLocation location) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - cdef ccuda.CUmemLocation _driver_location - _driver_location.type = location.type - _driver_location.id = location.id - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuMemAdvise_v2(devPtr, count, advice, _driver_location) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaMemRangeGetAttribute' in found_functions}} - -cdef cudaError_t _cudaMemRangeGetAttribute(void* data, size_t dataSize, cudaMemRangeAttribute attribute, const void* devPtr, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = ccuda._cuMemRangeGetAttribute(data, dataSize, attribute, devPtr, count) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaMemRangeGetAttributes' in found_functions}} - -cdef cudaError_t _cudaMemRangeGetAttributes(void** data, size_t* dataSizes, cudaMemRangeAttribute* attributes, size_t numAttributes, const void* devPtr, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = ccuda._cuMemRangeGetAttributes(data, dataSizes, attributes, numAttributes, devPtr, count) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaGetDeviceCount' in found_functions}} - -cdef cudaError_t _cudaGetDeviceCount(int* count) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitDriver() - if err != cudaSuccess: - return err - count[0] = m_global._numDevices - return cudaSuccess - - -{{endif}} -{{if 'cudaDeviceGetAttribute' in found_functions}} - -cdef cudaError_t _cudaDeviceGetAttribute(int* value, cudaDeviceAttr attr, int device) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = ccuda._cuDeviceGetAttribute(value, attr, device) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaDeviceSetSharedMemConfig' in found_functions}} - -cdef cudaError_t _cudaDeviceSetSharedMemConfig(cudaSharedMemConfig config) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuCtxSetSharedMemConfig(config) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaDeviceGetByPCIBusId' in found_functions}} - -cdef cudaError_t _cudaDeviceGetByPCIBusId(int* device, const char* pciBusId) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = ccuda._cuDeviceGetByPCIBusId(device, pciBusId) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaDeviceGetPCIBusId' in found_functions}} - -cdef cudaError_t _cudaDeviceGetPCIBusId(char* pciBusId, int length, int device) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = ccuda._cuDeviceGetPCIBusId(pciBusId, length, device) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaDeviceGetP2PAttribute' in found_functions}} - -cdef cudaError_t _cudaDeviceGetP2PAttribute(int* value, cudaDeviceP2PAttr attr, int srcDevice, int dstDevice) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = ccuda._cuDeviceGetP2PAttribute(value, attr, srcDevice, dstDevice) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaArrayGetSparseProperties' in found_functions}} - -cdef cudaError_t _cudaArrayGetSparseProperties(cudaArraySparseProperties* sparseProperties, cudaArray_t array) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - cdef ccuda.CUDA_ARRAY_SPARSE_PROPERTIES _driver_sparseProperties - if not sparseProperties: - _setLastError(cudaErrorInvalidValue) - return cudaError.cudaErrorInvalidValue - memset(sparseProperties, 0, sizeof(cudaArraySparseProperties)) - - err = ccuda._cuArrayGetSparseProperties(&_driver_sparseProperties, array) - if err == cudaSuccess: - sparseProperties[0].miptailFirstLevel = _driver_sparseProperties.miptailFirstLevel - sparseProperties[0].miptailSize = _driver_sparseProperties.miptailSize - sparseProperties[0].flags = _driver_sparseProperties.flags - sparseProperties[0].tileExtent.width = _driver_sparseProperties.tileExtent.width - sparseProperties[0].tileExtent.height = _driver_sparseProperties.tileExtent.height - sparseProperties[0].tileExtent.depth = _driver_sparseProperties.tileExtent.depth - - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaMipmappedArrayGetSparseProperties' in found_functions}} - -cdef cudaError_t _cudaMipmappedArrayGetSparseProperties(cudaArraySparseProperties* sparseProperties, cudaMipmappedArray_t mipmap) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - cdef ccuda.CUDA_ARRAY_SPARSE_PROPERTIES _driver_sparseProperties - if not sparseProperties: - _setLastError(cudaErrorInvalidValue) - return cudaError.cudaErrorInvalidValue - memset(sparseProperties, 0, sizeof(cudaArraySparseProperties)) - - err = ccuda._cuMipmappedArrayGetSparseProperties(&_driver_sparseProperties, mipmap) - if err == cudaSuccess: - sparseProperties[0].miptailFirstLevel = _driver_sparseProperties.miptailFirstLevel - sparseProperties[0].miptailSize = _driver_sparseProperties.miptailSize - sparseProperties[0].flags = _driver_sparseProperties.flags - sparseProperties[0].tileExtent.width = _driver_sparseProperties.tileExtent.width - sparseProperties[0].tileExtent.height = _driver_sparseProperties.tileExtent.height - sparseProperties[0].tileExtent.depth = _driver_sparseProperties.tileExtent.depth - - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaDeviceCanAccessPeer' in found_functions}} - -cdef cudaError_t _cudaDeviceCanAccessPeer(int* canAccessPeer, int device, int peerDevice) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitDriver() - if err != cudaSuccess: - return err - cdef cudaPythonDevice *driverDevice - cdef cudaPythonDevice *driverPeerDevice - driverDevice = m_global.getDevice(device) - driverPeerDevice = m_global.getDevice(peerDevice) - if driverDevice == NULL or driverPeerDevice == NULL: - return cudaErrorInvalidDevice - - err = ccuda._cuDeviceCanAccessPeer(canAccessPeer, driverDevice.driverDevice, driverPeerDevice.driverDevice) - if err != cudaSuccess: - _setLastError(err) - return err - if device == peerDevice: - canAccessPeer[0] = 0 - return err - - -{{endif}} -{{if 'cudaMemcpyPeer' in found_functions}} - -cdef cudaError_t _cudaMemcpyPeer(void* dst, int dstDevice, const void* src, int srcDevice, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - cdef cudaPythonDevice *device - cdef cudaPythonDevice *peerDevice - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - if count > 0: - peerDevice = m_global.getDevice(dstDevice) - device = m_global.getDevice(srcDevice) - if device == NULL or peerDevice == NULL: - _setLastError(err) - return cudaErrorInvalidDevice - err = initPrimaryContext(peerDevice) - if err != cudaSuccess: - _setLastError(err) - return err - err = initPrimaryContext(device) - if err != cudaSuccess: - _setLastError(err) - return err - err = ccuda._cuMemcpyPeer(dst, peerDevice[0].primaryContext, src, device[0].primaryContext, count) - if err != cudaSuccess: - _setLastError(err) - return err - return err - - -{{endif}} -{{if 'cudaMemcpyPeerAsync' in found_functions}} - -cdef cudaError_t _cudaMemcpyPeerAsync(void* dst, int dstDevice, const void* src, int srcDevice, size_t count, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - cdef cudaPythonDevice *device - cdef cudaPythonDevice *peerDevice - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - if count > 0: - peerDevice = m_global.getDevice(dstDevice) - device = m_global.getDevice(srcDevice) - if device == NULL or peerDevice == NULL: - _setLastError(err) - return cudaErrorInvalidDevice - err = initPrimaryContext(peerDevice) - if err != cudaSuccess: - _setLastError(err) - return err - err = initPrimaryContext(device) - if err != cudaSuccess: - _setLastError(err) - return err - err = ccuda._cuMemcpyPeerAsync(dst, peerDevice[0].primaryContext, src, device[0].primaryContext, count, stream) - if err != cudaSuccess: - _setLastError(err) - return err - return err - - -{{endif}} -{{if 'cudaDeviceEnablePeerAccess' in found_functions}} - -cdef cudaError_t _cudaDeviceEnablePeerAccess(int peerDevice, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - cdef ccuda.CUcontext context - cdef cudaPythonDevice *dev - err = m_global.lazyInitContextState() - if err != cudaSuccess: - _setLastError(err) - return err - err = ccuda._cuCtxGetCurrent(&context) - if err != cudaSuccess: - _setLastError(err) - return err - dev = m_global.getDeviceFromPrimaryCtx(context) - if dev == NULL: - # We don't know if context provided is primary or not - # cudaSetDevice may need to be called before retrying call - _setLastError(cudaErrorIncompatibleDriverContext) - return cudaErrorIncompatibleDriverContext - dev = m_global.getDevice(peerDevice) - if dev == NULL: - return cudaErrorInvalidDevice - err = initPrimaryContext(dev) - if err != cudaSuccess: - _setLastError(err) - return err - err = ccuda._cuCtxEnablePeerAccess(dev.primaryContext, flags) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaDeviceDisablePeerAccess' in found_functions}} - -cdef cudaError_t _cudaDeviceDisablePeerAccess(int peerDevice) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - cdef ccuda.CUcontext context - cdef cudaPythonDevice *dev - err = m_global.lazyInitContextState() - if err != cudaSuccess: - _setLastError(err) - return err - err = ccuda._cuCtxGetCurrent(&context) - if err != cudaSuccess: - _setLastError(err) - return err - dev = m_global.getDeviceFromPrimaryCtx(context) - if dev == NULL: - # We don't know if context provided is primary or not - # cudaSetDevice may need to be called before retrying call - _setLastError(cudaErrorIncompatibleDriverContext) - return cudaErrorIncompatibleDriverContext - dev = m_global.getDevice(peerDevice) - if dev == NULL: - return cudaErrorInvalidDevice - err = initPrimaryContext(dev) - if err != cudaSuccess: - _setLastError(err) - return err - err = ccuda._cuCtxDisablePeerAccess(dev.primaryContext) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaExternalMemoryGetMappedMipmappedArray' in found_functions}} - -cdef cudaError_t _cudaExternalMemoryGetMappedMipmappedArray(cudaMipmappedArray_t* mipmap, cudaExternalMemory_t extMem, const cudaExternalMemoryMipmappedArrayDesc* mipmapDesc) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - cdef ccuda.CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC _driver_mipmapDesc - memset(&_driver_mipmapDesc, 0, sizeof(_driver_mipmapDesc)) - _driver_mipmapDesc.offset = mipmapDesc[0].offset - _driver_mipmapDesc.arrayDesc.Width = mipmapDesc[0].extent.width - _driver_mipmapDesc.arrayDesc.Height = mipmapDesc[0].extent.height - _driver_mipmapDesc.arrayDesc.Depth = mipmapDesc[0].extent.depth - err_rt = getDescInfo(&mipmapDesc[0].formatDesc, &_driver_mipmapDesc.arrayDesc.NumChannels, &_driver_mipmapDesc.arrayDesc.Format) - if err_rt != cudaError.cudaSuccess: - _setLastError(err_rt) - return err_rt - _driver_mipmapDesc.arrayDesc.Flags = mipmapDesc[0].flags - _driver_mipmapDesc.numLevels = mipmapDesc[0].numLevels - - if err != cudaSuccess: - return err - err = ccuda._cuExternalMemoryGetMappedMipmappedArray(mipmap, extMem, &_driver_mipmapDesc) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGetSurfaceObjectResourceDesc' in found_functions}} - -cdef cudaError_t _cudaGetSurfaceObjectResourceDesc(cudaResourceDesc* pResDesc, cudaSurfaceObject_t surfObject) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - cdef ccuda.CUDA_RESOURCE_DESC _driver_pResDesc - - if err != cudaSuccess: - return err - err = ccuda._cuSurfObjectGetResourceDesc(&_driver_pResDesc, surfObject) - memset(pResDesc, 0, sizeof(cudaResourceDesc)) - if _driver_pResDesc.resType == ccuda.CU_RESOURCE_TYPE_ARRAY: - pResDesc[0].resType = cudaResourceType.cudaResourceTypeArray - pResDesc[0].res.array.array = _driver_pResDesc.res.array.hArray - elif _driver_pResDesc.resType == ccuda.CU_RESOURCE_TYPE_MIPMAPPED_ARRAY: - pResDesc[0].resType = cudaResourceType.cudaResourceTypeMipmappedArray - pResDesc[0].res.mipmap.mipmap = _driver_pResDesc.res.mipmap.hMipmappedArray - elif _driver_pResDesc.resType == ccuda.CU_RESOURCE_TYPE_LINEAR: - pResDesc[0].resType = cudaResourceType.cudaResourceTypeLinear - pResDesc[0].res.linear.devPtr = _driver_pResDesc.res.linear.devPtr - pResDesc[0].res.linear.sizeInBytes = _driver_pResDesc.res.linear.sizeInBytes - elif _driver_pResDesc.resType == ccuda.CU_RESOURCE_TYPE_PITCH2D: - pResDesc[0].resType = cudaResourceType.cudaResourceTypePitch2D - pResDesc[0].res.pitch2D.devPtr = _driver_pResDesc.res.pitch2D.devPtr - pResDesc[0].res.pitch2D.pitchInBytes = _driver_pResDesc.res.pitch2D.pitchInBytes - pResDesc[0].res.pitch2D.width = _driver_pResDesc.res.pitch2D.width - pResDesc[0].res.pitch2D.height = _driver_pResDesc.res.pitch2D.height - if _driver_pResDesc.resType == ccuda.CU_RESOURCE_TYPE_LINEAR or _driver_pResDesc.resType == ccuda.CU_RESOURCE_TYPE_PITCH2D: - channel_size = 0 - if _driver_pResDesc.res.linear.format == ccuda.CU_AD_FORMAT_UNSIGNED_INT8: - pResDesc[0].res.linear.desc.f = cudaChannelFormatKind.cudaChannelFormatKindUnsigned - channel_size = 8 - elif _driver_pResDesc.res.linear.format == ccuda.CU_AD_FORMAT_UNSIGNED_INT16: - pResDesc[0].res.linear.desc.f = cudaChannelFormatKind.cudaChannelFormatKindUnsigned - channel_size = 16 - elif _driver_pResDesc.res.linear.format == ccuda.CU_AD_FORMAT_UNSIGNED_INT32: - pResDesc[0].res.linear.desc.f = cudaChannelFormatKind.cudaChannelFormatKindUnsigned - channel_size = 32 - elif _driver_pResDesc.res.linear.format == ccuda.CU_AD_FORMAT_SIGNED_INT8: - pResDesc[0].res.linear.desc.f = cudaChannelFormatKind.cudaChannelFormatKindSigned - channel_size = 8 - elif _driver_pResDesc.res.linear.format == ccuda.CU_AD_FORMAT_SIGNED_INT16: - pResDesc[0].res.linear.desc.f = cudaChannelFormatKind.cudaChannelFormatKindSigned - channel_size = 16 - elif _driver_pResDesc.res.linear.format == ccuda.CU_AD_FORMAT_SIGNED_INT32: - pResDesc[0].res.linear.desc.f = cudaChannelFormatKind.cudaChannelFormatKindSigned - channel_size = 32 - elif _driver_pResDesc.res.linear.format == ccuda.CU_AD_FORMAT_HALF: - pResDesc[0].res.linear.desc.f = cudaChannelFormatKind.cudaChannelFormatKindFloat - channel_size = 16 - elif _driver_pResDesc.res.linear.format == ccuda.CU_AD_FORMAT_FLOAT: - pResDesc[0].res.linear.desc.f = cudaChannelFormatKind.cudaChannelFormatKindFloat - channel_size = 32 - elif _driver_pResDesc.res.linear.format == ccuda.CU_AD_FORMAT_NV12: - pResDesc[0].res.linear.desc.f = cudaChannelFormatKind.cudaChannelFormatKindNV12 - channel_size = 8 - else: - _setLastError(cudaErrorInvalidChannelDescriptor) - return cudaError.cudaErrorInvalidChannelDescriptor - pResDesc[0].res.linear.desc.x = 0 - pResDesc[0].res.linear.desc.y = 0 - pResDesc[0].res.linear.desc.z = 0 - pResDesc[0].res.linear.desc.w = 0 - if _driver_pResDesc.res.linear.numChannels >= 4: - pResDesc[0].res.linear.desc.w = channel_size - if _driver_pResDesc.res.linear.numChannels >= 3: - pResDesc[0].res.linear.desc.z = channel_size - if _driver_pResDesc.res.linear.numChannels >= 2: - pResDesc[0].res.linear.desc.y = channel_size - if _driver_pResDesc.res.linear.numChannels >= 1: - pResDesc[0].res.linear.desc.x = channel_size - if _driver_pResDesc.res.linear.numChannels < 1 or _driver_pResDesc.res.linear.numChannels >= 5: - _setLastError(cudaErrorInvalidChannelDescriptor) - return cudaError.cudaErrorInvalidChannelDescriptor - - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphKernelNodeGetParams' in found_functions}} - -cdef cudaError_t _cudaGraphKernelNodeGetParams(cudaGraphNode_t node, cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - cdef ccuda.CUDA_KERNEL_NODE_PARAMS driverNodeParams - - if err != cudaSuccess: - return err - err = ccuda._cuGraphKernelNodeGetParams_v2(node, &driverNodeParams) - pNodeParams[0].func = driverNodeParams.func - pNodeParams[0].gridDim.x = driverNodeParams.gridDimX - pNodeParams[0].gridDim.y = driverNodeParams.gridDimY - pNodeParams[0].gridDim.z = driverNodeParams.gridDimZ - pNodeParams[0].blockDim.x = driverNodeParams.blockDimX - pNodeParams[0].blockDim.y = driverNodeParams.blockDimY - pNodeParams[0].blockDim.z = driverNodeParams.blockDimZ - pNodeParams[0].sharedMemBytes = driverNodeParams.sharedMemBytes - pNodeParams[0].kernelParams = driverNodeParams.kernelParams - pNodeParams[0].extra = driverNodeParams.extra - - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaExternalMemoryGetMappedBuffer' in found_functions}} - -cdef cudaError_t _cudaExternalMemoryGetMappedBuffer(void** devPtr, cudaExternalMemory_t extMem, const cudaExternalMemoryBufferDesc* bufferDesc) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - cdef ccuda.CUDA_EXTERNAL_MEMORY_BUFFER_DESC _driver_bufferDesc - memset(&_driver_bufferDesc, 0, sizeof(_driver_bufferDesc)) - _driver_bufferDesc.offset = bufferDesc[0].offset - _driver_bufferDesc.size = bufferDesc[0].size - _driver_bufferDesc.flags = bufferDesc[0].flags - - if err != cudaSuccess: - return err - err = ccuda._cuExternalMemoryGetMappedBuffer(devPtr, extMem, &_driver_bufferDesc) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaImportExternalMemory' in found_functions}} - -cdef cudaError_t _cudaImportExternalMemory(cudaExternalMemory_t* extMem_out, const cudaExternalMemoryHandleDesc* memHandleDesc) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - cdef ccuda.CUDA_EXTERNAL_MEMORY_HANDLE_DESC _driver_memHandleDesc - memset(&_driver_memHandleDesc, 0, sizeof(_driver_memHandleDesc)) - - if memHandleDesc[0].type == cudaExternalMemoryHandleType.cudaExternalMemoryHandleTypeOpaqueFd: - _driver_memHandleDesc.type = ccuda.CUexternalMemoryHandleType_enum.CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD - _driver_memHandleDesc.handle.fd = memHandleDesc[0].handle.fd - elif memHandleDesc[0].type == cudaExternalMemoryHandleType.cudaExternalMemoryHandleTypeOpaqueWin32: - _driver_memHandleDesc.type = ccuda.CUexternalMemoryHandleType_enum.CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32 - _driver_memHandleDesc.handle.win32.handle = memHandleDesc[0].handle.win32.handle - _driver_memHandleDesc.handle.win32.name = memHandleDesc[0].handle.win32.name - elif memHandleDesc[0].type == cudaExternalMemoryHandleType.cudaExternalMemoryHandleTypeOpaqueWin32Kmt: - _driver_memHandleDesc.type = ccuda.CUexternalMemoryHandleType_enum.CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT - _driver_memHandleDesc.handle.win32.handle = memHandleDesc[0].handle.win32.handle - _driver_memHandleDesc.handle.win32.name = memHandleDesc[0].handle.win32.name - elif memHandleDesc[0].type == cudaExternalMemoryHandleType.cudaExternalMemoryHandleTypeD3D12Heap: - _driver_memHandleDesc.type = ccuda.CUexternalMemoryHandleType_enum.CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP - _driver_memHandleDesc.handle.win32.handle = memHandleDesc[0].handle.win32.handle - _driver_memHandleDesc.handle.win32.name = memHandleDesc[0].handle.win32.name - elif memHandleDesc[0].type == cudaExternalMemoryHandleType.cudaExternalMemoryHandleTypeD3D12Resource: - _driver_memHandleDesc.type = ccuda.CUexternalMemoryHandleType_enum.CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE - _driver_memHandleDesc.handle.win32.handle = memHandleDesc[0].handle.win32.handle - _driver_memHandleDesc.handle.win32.name = memHandleDesc[0].handle.win32.name - elif memHandleDesc[0].type == cudaExternalMemoryHandleType.cudaExternalMemoryHandleTypeD3D11Resource: - _driver_memHandleDesc.type = ccuda.CUexternalMemoryHandleType_enum.CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE - _driver_memHandleDesc.handle.win32.handle = memHandleDesc[0].handle.win32.handle - _driver_memHandleDesc.handle.win32.name = memHandleDesc[0].handle.win32.name - elif memHandleDesc[0].type == cudaExternalMemoryHandleType.cudaExternalMemoryHandleTypeD3D11ResourceKmt: - _driver_memHandleDesc.type = ccuda.CUexternalMemoryHandleType_enum.CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE_KMT - _driver_memHandleDesc.handle.win32.handle = memHandleDesc[0].handle.win32.handle - _driver_memHandleDesc.handle.win32.name = memHandleDesc[0].handle.win32.name - elif memHandleDesc[0].type == cudaExternalMemoryHandleType.cudaExternalMemoryHandleTypeNvSciBuf: - _driver_memHandleDesc.type = ccuda.CUexternalMemoryHandleType_enum.CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF - _driver_memHandleDesc.handle.nvSciBufObject = memHandleDesc[0].handle.nvSciBufObject - _driver_memHandleDesc.size = memHandleDesc[0].size - _driver_memHandleDesc.flags = memHandleDesc[0].flags - - if err != cudaSuccess: - return err - err = ccuda._cuImportExternalMemory(extMem_out, &_driver_memHandleDesc) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaCreateSurfaceObject' in found_functions}} - -cdef cudaError_t _cudaCreateSurfaceObject(cudaSurfaceObject_t* pSurfObject, const cudaResourceDesc* pResDesc) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - cdef ccuda.CUDA_RESOURCE_DESC _driver_pResDesc - memset(&_driver_pResDesc, 0, sizeof(_driver_pResDesc)) - err = toDriverCudaResourceDesc(&_driver_pResDesc, pResDesc) - if err != cudaSuccess: - _setLastError(err) - return err - - err = ccuda._cuSurfObjectCreate(pSurfObject, &_driver_pResDesc) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGetTextureObjectResourceDesc' in found_functions}} - -cdef cudaError_t _cudaGetTextureObjectResourceDesc(cudaResourceDesc* pResDesc, cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - cdef ccuda.CUDA_RESOURCE_DESC _driver_pResDesc - memset(&_driver_pResDesc, 0, sizeof(_driver_pResDesc)) - err = toDriverCudaResourceDesc(&_driver_pResDesc, pResDesc) - if err != cudaSuccess: - _setLastError(err) - return err - - err = ccuda._cuTexObjectGetResourceDesc(&_driver_pResDesc, texObject) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} - -cdef cudaError_t _cudaEGLStreamProducerPresentFrame(cudaEglStreamConnection* conn, cudaEglFrame eglframe, cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - cdef ccuda.CUeglFrame cueglFrame - err = getDriverEglFrame(&cueglFrame, eglframe) - if err != cudaSuccess: - _setLastError(err) - return err - err = ccuda._cuEGLStreamProducerPresentFrame(conn, cueglFrame, pStream) - if err != cudaSuccess: - _setLastError(err) - return err - -cdef cudaError_t _cudaEGLStreamProducerReturnFrame(cudaEglStreamConnection* conn, cudaEglFrame* eglframe, cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - if eglframe == NULL: - err = cudaErrorInvalidResourceHandle - _setLastError(err) - return err - cdef ccuda.CUeglFrame cueglFrame - err = ccuda._cuEGLStreamProducerReturnFrame(conn, &cueglFrame, pStream) - if err != cudaSuccess: - _setLastError(err) - return err - err = getRuntimeEglFrame(eglframe, cueglFrame) - if err != cudaSuccess: - _setLastError(err) - return err - return err - -cdef cudaError_t _cudaGraphicsResourceGetMappedEglFrame(cudaEglFrame* eglFrame, cudaGraphicsResource_t resource, unsigned int index, unsigned int mipLevel) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - cdef ccuda.CUeglFrame cueglFrame - memset(&cueglFrame, 0, sizeof(cueglFrame)) - err = ccuda._cuGraphicsResourceGetMappedEglFrame(&cueglFrame, resource, index, mipLevel) - if err != cudaSuccess: - _setLastError(err) - return err - err = getRuntimeEglFrame(eglFrame, cueglFrame) - if err != cudaSuccess: - _setLastError(err) - return err - return err - -cdef cudaError_t _cudaVDPAUSetVDPAUDevice(int device, VdpDevice vdpDevice, VdpGetProcAddress* vdpGetProcAddress) except ?cudaErrorCallRequiresNewerDriver nogil: - return cudaErrorNotSupported - -{{if 'cudaArrayGetMemoryRequirements' in found_functions}} - -cdef cudaError_t _cudaArrayGetMemoryRequirements(cudaArrayMemoryRequirements* memoryRequirements, cudaArray_t array, int device) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - cdef ccuda.CUDA_ARRAY_MEMORY_REQUIREMENTS driverMemoryRequirements - if memoryRequirements == NULL: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - - memset(memoryRequirements, 0, sizeof(memoryRequirements[0])) - err = ccuda._cuArrayGetMemoryRequirements(&driverMemoryRequirements, array, device) - if err != cudaSuccess: - _setLastError(err) - return err - - memoryRequirements[0].size = driverMemoryRequirements.size - memoryRequirements[0].alignment = driverMemoryRequirements.alignment - return cudaSuccess - -{{endif}} -{{if 'cudaMipmappedArrayGetMemoryRequirements' in found_functions}} - -cdef cudaError_t _cudaMipmappedArrayGetMemoryRequirements(cudaArrayMemoryRequirements* memoryRequirements, cudaMipmappedArray_t mipmap, int device) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - cdef ccuda.CUDA_ARRAY_MEMORY_REQUIREMENTS driverMemoryRequirements - if memoryRequirements == NULL: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - - memset(memoryRequirements, 0, sizeof(memoryRequirements[0])) - err = ccuda._cuMipmappedArrayGetMemoryRequirements(&driverMemoryRequirements, mipmap, device) - if err != cudaSuccess: - _setLastError(err) - return err - - memoryRequirements[0].size = driverMemoryRequirements.size - memoryRequirements[0].alignment = driverMemoryRequirements.alignment - return cudaSuccess - -{{endif}} -{{if 'cudaStreamGetAttribute' in found_functions}} - -cdef cudaError_t _cudaStreamGetAttribute(cudaStream_t hStream, cudaStreamAttrID attr, cudaStreamAttrValue* value_out) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuStreamGetAttribute(hStream, attr, value_out) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaStreamSetAttribute' in found_functions}} - -cdef cudaError_t _cudaStreamSetAttribute(cudaStream_t hStream, cudaStreamAttrID attr, const cudaStreamAttrValue* value) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuStreamSetAttribute(hStream, attr, value) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphKernelNodeGetAttribute' in found_functions}} - -cdef cudaError_t _cudaGraphKernelNodeGetAttribute(cudaGraphNode_t hNode, cudaKernelNodeAttrID attr, cudaKernelNodeAttrValue* value_out) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphKernelNodeGetAttribute(hNode, attr, value_out) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphKernelNodeSetAttribute' in found_functions}} - -cdef cudaError_t _cudaGraphKernelNodeSetAttribute(cudaGraphNode_t hNode, cudaKernelNodeAttrID attr, const cudaKernelNodeAttrValue* value) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphKernelNodeSetAttribute(hNode, attr, value) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if True}} - -cdef cudaError_t _cudaVDPAUGetDevice(int* device, VdpDevice vdpDevice, VdpGetProcAddress* vdpGetProcAddress) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuVDPAUGetDevice(device, vdpDevice, vdpGetProcAddress) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if True}} - -cdef cudaError_t _cudaGraphicsVDPAURegisterVideoSurface(cudaGraphicsResource** resource, VdpVideoSurface vdpSurface, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphicsVDPAURegisterVideoSurface(resource, vdpSurface, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if True}} - -cdef cudaError_t _cudaGraphicsVDPAURegisterOutputSurface(cudaGraphicsResource** resource, VdpOutputSurface vdpSurface, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphicsVDPAURegisterOutputSurface(resource, vdpSurface, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if True}} - -cdef cudaError_t _cudaGLGetDevices(unsigned int* pCudaDeviceCount, int* pCudaDevices, unsigned int cudaDeviceCount, cudaGLDeviceList deviceList) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGLGetDevices_v2(pCudaDeviceCount, pCudaDevices, cudaDeviceCount, deviceList) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if True}} - -cdef cudaError_t _cudaGraphicsGLRegisterImage(cudaGraphicsResource** resource, GLuint image, GLenum target, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphicsGLRegisterImage(resource, image, target, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if True}} - -cdef cudaError_t _cudaGraphicsGLRegisterBuffer(cudaGraphicsResource** resource, GLuint buffer, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphicsGLRegisterBuffer(resource, buffer, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaDeviceSynchronize' in found_functions}} - -cdef cudaError_t _cudaDeviceSynchronize() except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuCtxSynchronize() - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaDeviceSetLimit' in found_functions}} - -cdef cudaError_t _cudaDeviceSetLimit(cudaLimit limit, size_t value) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuCtxSetLimit(limit, value) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaDeviceGetLimit' in found_functions}} - -cdef cudaError_t _cudaDeviceGetLimit(size_t* pValue, cudaLimit limit) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuCtxGetLimit(pValue, limit) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaDeviceGetCacheConfig' in found_functions}} - -cdef cudaError_t _cudaDeviceGetCacheConfig(cudaFuncCache* pCacheConfig) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuCtxGetCacheConfig(pCacheConfig) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaDeviceGetStreamPriorityRange' in found_functions}} - -cdef cudaError_t _cudaDeviceGetStreamPriorityRange(int* leastPriority, int* greatestPriority) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuCtxGetStreamPriorityRange(leastPriority, greatestPriority) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaDeviceSetCacheConfig' in found_functions}} - -cdef cudaError_t _cudaDeviceSetCacheConfig(cudaFuncCache cacheConfig) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuCtxSetCacheConfig(cacheConfig) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaDeviceGetSharedMemConfig' in found_functions}} - -cdef cudaError_t _cudaDeviceGetSharedMemConfig(cudaSharedMemConfig* pConfig) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuCtxGetSharedMemConfig(pConfig) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaIpcGetEventHandle' in found_functions}} - -cdef cudaError_t _cudaIpcGetEventHandle(cudaIpcEventHandle_t* handle, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuIpcGetEventHandle(handle, event) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaIpcOpenEventHandle' in found_functions}} - -cdef cudaError_t _cudaIpcOpenEventHandle(cudaEvent_t* event, cudaIpcEventHandle_t handle) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - cdef ccuda.CUipcEventHandle _driver_handle - memcpy(&_driver_handle, &handle, sizeof(_driver_handle)) - if err != cudaSuccess: - return err - err = ccuda._cuIpcOpenEventHandle(event, _driver_handle) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaIpcGetMemHandle' in found_functions}} - -cdef cudaError_t _cudaIpcGetMemHandle(cudaIpcMemHandle_t* handle, void* devPtr) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuIpcGetMemHandle(handle, devPtr) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaIpcOpenMemHandle' in found_functions}} - -cdef cudaError_t _cudaIpcOpenMemHandle(void** devPtr, cudaIpcMemHandle_t handle, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - cdef ccuda.CUipcMemHandle _driver_handle - memcpy(&_driver_handle, &handle, sizeof(_driver_handle)) - if err != cudaSuccess: - return err - err = ccuda._cuIpcOpenMemHandle_v2(devPtr, _driver_handle, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaIpcCloseMemHandle' in found_functions}} - -cdef cudaError_t _cudaIpcCloseMemHandle(void* devPtr) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuIpcCloseMemHandle(devPtr) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaDeviceFlushGPUDirectRDMAWrites' in found_functions}} - -cdef cudaError_t _cudaDeviceFlushGPUDirectRDMAWrites(cudaFlushGPUDirectRDMAWritesTarget target, cudaFlushGPUDirectRDMAWritesScope scope) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuFlushGPUDirectRDMAWrites(target, scope) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaDeviceGetDefaultMemPool' in found_functions}} - -cdef cudaError_t _cudaDeviceGetDefaultMemPool(cudaMemPool_t* memPool, int device) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuDeviceGetDefaultMemPool(memPool, device) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaDeviceSetMemPool' in found_functions}} - -cdef cudaError_t _cudaDeviceSetMemPool(int device, cudaMemPool_t memPool) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuDeviceSetMemPool(device, memPool) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaDeviceGetMemPool' in found_functions}} - -cdef cudaError_t _cudaDeviceGetMemPool(cudaMemPool_t* memPool, int device) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuDeviceGetMemPool(memPool, device) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaDeviceGetNvSciSyncAttributes' in found_functions}} - -cdef cudaError_t _cudaDeviceGetNvSciSyncAttributes(void* nvSciSyncAttrList, int device, int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuDeviceGetNvSciSyncAttributes(nvSciSyncAttrList, device, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaStreamCreateWithFlags' in found_functions}} - -cdef cudaError_t _cudaStreamCreateWithFlags(cudaStream_t* pStream, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuStreamCreate(pStream, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaStreamCreateWithPriority' in found_functions}} - -cdef cudaError_t _cudaStreamCreateWithPriority(cudaStream_t* pStream, unsigned int flags, int priority) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuStreamCreateWithPriority(pStream, flags, priority) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaStreamGetPriority' in found_functions}} - -cdef cudaError_t _cudaStreamGetPriority(cudaStream_t hStream, int* priority) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuStreamGetPriority(hStream, priority) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaStreamGetFlags' in found_functions}} - -cdef cudaError_t _cudaStreamGetFlags(cudaStream_t hStream, unsigned int* flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuStreamGetFlags(hStream, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaCtxResetPersistingL2Cache' in found_functions}} - -cdef cudaError_t _cudaCtxResetPersistingL2Cache() except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuCtxResetPersistingL2Cache() - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaStreamCopyAttributes' in found_functions}} - -cdef cudaError_t _cudaStreamCopyAttributes(cudaStream_t dst, cudaStream_t src) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuStreamCopyAttributes(dst, src) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaStreamDestroy' in found_functions}} - -cdef cudaError_t _cudaStreamDestroy(cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuStreamDestroy_v2(stream) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaStreamWaitEvent' in found_functions}} - -cdef cudaError_t _cudaStreamWaitEvent(cudaStream_t stream, cudaEvent_t event, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuStreamWaitEvent(stream, event, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaStreamSynchronize' in found_functions}} - -cdef cudaError_t _cudaStreamSynchronize(cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuStreamSynchronize(stream) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaStreamQuery' in found_functions}} - -cdef cudaError_t _cudaStreamQuery(cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuStreamQuery(stream) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaStreamAttachMemAsync' in found_functions}} - -cdef cudaError_t _cudaStreamAttachMemAsync(cudaStream_t stream, void* devPtr, size_t length, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuStreamAttachMemAsync(stream, devPtr, length, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaStreamBeginCapture' in found_functions}} - -cdef cudaError_t _cudaStreamBeginCapture(cudaStream_t stream, cudaStreamCaptureMode mode) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuStreamBeginCapture_v2(stream, mode) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaStreamBeginCaptureToGraph' in found_functions}} - -cdef cudaError_t _cudaStreamBeginCaptureToGraph(cudaStream_t stream, cudaGraph_t graph, const cudaGraphNode_t* dependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, cudaStreamCaptureMode mode) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuStreamBeginCaptureToGraph(stream, graph, dependencies, dependencyData, numDependencies, mode) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaThreadExchangeStreamCaptureMode' in found_functions}} - -cdef cudaError_t _cudaThreadExchangeStreamCaptureMode(cudaStreamCaptureMode* mode) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuThreadExchangeStreamCaptureMode(mode) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaStreamEndCapture' in found_functions}} - -cdef cudaError_t _cudaStreamEndCapture(cudaStream_t stream, cudaGraph_t* pGraph) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuStreamEndCapture(stream, pGraph) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaStreamIsCapturing' in found_functions}} - -cdef cudaError_t _cudaStreamIsCapturing(cudaStream_t stream, cudaStreamCaptureStatus* pCaptureStatus) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuStreamIsCapturing(stream, pCaptureStatus) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaStreamUpdateCaptureDependencies' in found_functions}} - -cdef cudaError_t _cudaStreamUpdateCaptureDependencies(cudaStream_t stream, cudaGraphNode_t* dependencies, size_t numDependencies, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuStreamUpdateCaptureDependencies(stream, dependencies, numDependencies, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaEventCreateWithFlags' in found_functions}} - -cdef cudaError_t _cudaEventCreateWithFlags(cudaEvent_t* event, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuEventCreate(event, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaEventRecord' in found_functions}} - -cdef cudaError_t _cudaEventRecord(cudaEvent_t event, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuEventRecord(event, stream) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaEventRecordWithFlags' in found_functions}} - -cdef cudaError_t _cudaEventRecordWithFlags(cudaEvent_t event, cudaStream_t stream, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuEventRecordWithFlags(event, stream, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaEventSynchronize' in found_functions}} - -cdef cudaError_t _cudaEventSynchronize(cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuEventSynchronize(event) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaEventDestroy' in found_functions}} - -cdef cudaError_t _cudaEventDestroy(cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuEventDestroy_v2(event) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaEventElapsedTime' in found_functions}} - -cdef cudaError_t _cudaEventElapsedTime(float* ms, cudaEvent_t start, cudaEvent_t end) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuEventElapsedTime(ms, start, end) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaDestroyExternalMemory' in found_functions}} - -cdef cudaError_t _cudaDestroyExternalMemory(cudaExternalMemory_t extMem) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuDestroyExternalMemory(extMem) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaDestroyExternalSemaphore' in found_functions}} - -cdef cudaError_t _cudaDestroyExternalSemaphore(cudaExternalSemaphore_t extSem) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuDestroyExternalSemaphore(extSem) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaFuncSetCacheConfig' in found_functions}} - -cdef cudaError_t _cudaFuncSetCacheConfig(const void* func, cudaFuncCache cacheConfig) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuFuncSetCacheConfig(func, cacheConfig) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaFuncSetSharedMemConfig' in found_functions}} - -cdef cudaError_t _cudaFuncSetSharedMemConfig(const void* func, cudaSharedMemConfig config) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuFuncSetSharedMemConfig(func, config) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaFuncSetAttribute' in found_functions}} - -cdef cudaError_t _cudaFuncSetAttribute(const void* func, cudaFuncAttribute attr, int value) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuFuncSetAttribute(func, attr, value) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaLaunchHostFunc' in found_functions}} - -cdef cudaError_t _cudaLaunchHostFunc(cudaStream_t stream, cudaHostFn_t fn, void* userData) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = streamAddHostCallbackCommon(stream, fn, userData) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaOccupancyMaxActiveBlocksPerMultiprocessor' in found_functions}} - -cdef cudaError_t _cudaOccupancyMaxActiveBlocksPerMultiprocessor(int* numBlocks, const void* func, int blockSize, size_t dynamicSMemSize) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuOccupancyMaxActiveBlocksPerMultiprocessor(numBlocks, func, blockSize, dynamicSMemSize) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaOccupancyAvailableDynamicSMemPerBlock' in found_functions}} - -cdef cudaError_t _cudaOccupancyAvailableDynamicSMemPerBlock(size_t* dynamicSmemSize, const void* func, int numBlocks, int blockSize) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuOccupancyAvailableDynamicSMemPerBlock(dynamicSmemSize, func, numBlocks, blockSize) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags' in found_functions}} - -cdef cudaError_t _cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(int* numBlocks, const void* func, int blockSize, size_t dynamicSMemSize, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(numBlocks, func, blockSize, dynamicSMemSize, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaMallocManaged' in found_functions}} - -cdef cudaError_t _cudaMallocManaged(void** devPtr, size_t size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuMemAllocManaged(devPtr, size, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaMalloc' in found_functions}} - -cdef cudaError_t _cudaMalloc(void** devPtr, size_t size) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuMemAlloc_v2(devPtr, size) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaFree' in found_functions}} - -cdef cudaError_t _cudaFree(void* devPtr) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuMemFree_v2(devPtr) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaFreeHost' in found_functions}} - -cdef cudaError_t _cudaFreeHost(void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuMemFreeHost(ptr) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaFreeArray' in found_functions}} - -cdef cudaError_t _cudaFreeArray(cudaArray_t array) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuArrayDestroy(array) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaFreeMipmappedArray' in found_functions}} - -cdef cudaError_t _cudaFreeMipmappedArray(cudaMipmappedArray_t mipmappedArray) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuMipmappedArrayDestroy(mipmappedArray) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaHostAlloc' in found_functions}} - -cdef cudaError_t _cudaHostAlloc(void** pHost, size_t size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuMemHostAlloc(pHost, size, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaHostRegister' in found_functions}} - -cdef cudaError_t _cudaHostRegister(void* ptr, size_t size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuMemHostRegister_v2(ptr, size, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaHostUnregister' in found_functions}} - -cdef cudaError_t _cudaHostUnregister(void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuMemHostUnregister(ptr) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaHostGetDevicePointer' in found_functions}} - -cdef cudaError_t _cudaHostGetDevicePointer(void** pDevice, void* pHost, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuMemHostGetDevicePointer_v2(pDevice, pHost, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaHostGetFlags' in found_functions}} - -cdef cudaError_t _cudaHostGetFlags(unsigned int* pFlags, void* pHost) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuMemHostGetFlags(pFlags, pHost) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGetMipmappedArrayLevel' in found_functions}} - -cdef cudaError_t _cudaGetMipmappedArrayLevel(cudaArray_t* levelArray, cudaMipmappedArray_const_t mipmappedArray, unsigned int level) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuMipmappedArrayGetLevel(levelArray, mipmappedArray, level) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaMemGetInfo' in found_functions}} - -cdef cudaError_t _cudaMemGetInfo(size_t* free, size_t* total) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuMemGetInfo_v2(free, total) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaArrayGetPlane' in found_functions}} - -cdef cudaError_t _cudaArrayGetPlane(cudaArray_t* pPlaneArray, cudaArray_t hArray, unsigned int planeIdx) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuArrayGetPlane(pPlaneArray, hArray, planeIdx) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaMemset' in found_functions}} - -cdef cudaError_t _cudaMemset(void* devPtr, int value, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuMemsetD8_v2(devPtr, value, count) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaMemset2D' in found_functions}} - -cdef cudaError_t _cudaMemset2D(void* devPtr, size_t pitch, int value, size_t width, size_t height) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuMemsetD2D8_v2(devPtr, pitch, value, width, height) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaMemsetAsync' in found_functions}} - -cdef cudaError_t _cudaMemsetAsync(void* devPtr, int value, size_t count, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuMemsetD8Async(devPtr, value, count, stream) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaMemset2DAsync' in found_functions}} - -cdef cudaError_t _cudaMemset2DAsync(void* devPtr, size_t pitch, int value, size_t width, size_t height, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuMemsetD2D8Async(devPtr, pitch, value, width, height, stream) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaMemPrefetchAsync' in found_functions}} - -cdef cudaError_t _cudaMemPrefetchAsync(const void* devPtr, size_t count, int dstDevice, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuMemPrefetchAsync(devPtr, count, dstDevice, stream) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaMemPrefetchAsync_v2' in found_functions}} - -cdef cudaError_t _cudaMemPrefetchAsync_v2(const void* devPtr, size_t count, cudaMemLocation location, unsigned int flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - cdef ccuda.CUmemLocation _driver_location - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - _driver_location.type = location.type - _driver_location.id = location.id - err = ccuda._cuMemPrefetchAsync_v2(devPtr, count, _driver_location, flags, stream) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaMallocAsync' in found_functions}} - -cdef cudaError_t _cudaMallocAsync(void** devPtr, size_t size, cudaStream_t hStream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuMemAllocAsync(devPtr, size, hStream) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaFreeAsync' in found_functions}} - -cdef cudaError_t _cudaFreeAsync(void* devPtr, cudaStream_t hStream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuMemFreeAsync(devPtr, hStream) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaMemPoolTrimTo' in found_functions}} - -cdef cudaError_t _cudaMemPoolTrimTo(cudaMemPool_t memPool, size_t minBytesToKeep) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuMemPoolTrimTo(memPool, minBytesToKeep) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaMemPoolSetAttribute' in found_functions}} - -cdef cudaError_t _cudaMemPoolSetAttribute(cudaMemPool_t memPool, cudaMemPoolAttr attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuMemPoolSetAttribute(memPool, attr, value) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaMemPoolGetAttribute' in found_functions}} - -cdef cudaError_t _cudaMemPoolGetAttribute(cudaMemPool_t memPool, cudaMemPoolAttr attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuMemPoolGetAttribute(memPool, attr, value) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaMemPoolGetAccess' in found_functions}} - -cdef cudaError_t _cudaMemPoolGetAccess(cudaMemAccessFlags* flags, cudaMemPool_t memPool, cudaMemLocation* location) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuMemPoolGetAccess(flags, memPool, location) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaMemPoolCreate' in found_functions}} - -cdef cudaError_t _cudaMemPoolCreate(cudaMemPool_t* memPool, const cudaMemPoolProps* poolProps) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuMemPoolCreate(memPool, poolProps) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaMemPoolDestroy' in found_functions}} - -cdef cudaError_t _cudaMemPoolDestroy(cudaMemPool_t memPool) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuMemPoolDestroy(memPool) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaMallocFromPoolAsync' in found_functions}} - -cdef cudaError_t _cudaMallocFromPoolAsync(void** ptr, size_t size, cudaMemPool_t memPool, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuMemAllocFromPoolAsync(ptr, size, memPool, stream) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaMemPoolExportToShareableHandle' in found_functions}} - -cdef cudaError_t _cudaMemPoolExportToShareableHandle(void* shareableHandle, cudaMemPool_t memPool, cudaMemAllocationHandleType handleType, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuMemPoolExportToShareableHandle(shareableHandle, memPool, handleType, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaMemPoolImportFromShareableHandle' in found_functions}} - -cdef cudaError_t _cudaMemPoolImportFromShareableHandle(cudaMemPool_t* memPool, void* shareableHandle, cudaMemAllocationHandleType handleType, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuMemPoolImportFromShareableHandle(memPool, shareableHandle, handleType, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaMemPoolExportPointer' in found_functions}} - -cdef cudaError_t _cudaMemPoolExportPointer(cudaMemPoolPtrExportData* exportData, void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuMemPoolExportPointer(exportData, ptr) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaMemPoolImportPointer' in found_functions}} - -cdef cudaError_t _cudaMemPoolImportPointer(void** ptr, cudaMemPool_t memPool, cudaMemPoolPtrExportData* exportData) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuMemPoolImportPointer(ptr, memPool, exportData) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphicsUnregisterResource' in found_functions}} - -cdef cudaError_t _cudaGraphicsUnregisterResource(cudaGraphicsResource_t resource) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphicsUnregisterResource(resource) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphicsResourceSetMapFlags' in found_functions}} - -cdef cudaError_t _cudaGraphicsResourceSetMapFlags(cudaGraphicsResource_t resource, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphicsResourceSetMapFlags_v2(resource, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphicsMapResources' in found_functions}} - -cdef cudaError_t _cudaGraphicsMapResources(int count, cudaGraphicsResource_t* resources, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphicsMapResources(count, resources, stream) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphicsUnmapResources' in found_functions}} - -cdef cudaError_t _cudaGraphicsUnmapResources(int count, cudaGraphicsResource_t* resources, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphicsUnmapResources(count, resources, stream) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphicsResourceGetMappedPointer' in found_functions}} - -cdef cudaError_t _cudaGraphicsResourceGetMappedPointer(void** devPtr, size_t* size, cudaGraphicsResource_t resource) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphicsResourceGetMappedPointer_v2(devPtr, size, resource) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphicsSubResourceGetMappedArray' in found_functions}} - -cdef cudaError_t _cudaGraphicsSubResourceGetMappedArray(cudaArray_t* array, cudaGraphicsResource_t resource, unsigned int arrayIndex, unsigned int mipLevel) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphicsSubResourceGetMappedArray(array, resource, arrayIndex, mipLevel) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphicsResourceGetMappedMipmappedArray' in found_functions}} - -cdef cudaError_t _cudaGraphicsResourceGetMappedMipmappedArray(cudaMipmappedArray_t* mipmappedArray, cudaGraphicsResource_t resource) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphicsResourceGetMappedMipmappedArray(mipmappedArray, resource) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaDestroyTextureObject' in found_functions}} - -cdef cudaError_t _cudaDestroyTextureObject(cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuTexObjectDestroy(texObject) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaDestroySurfaceObject' in found_functions}} - -cdef cudaError_t _cudaDestroySurfaceObject(cudaSurfaceObject_t surfObject) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuSurfObjectDestroy(surfObject) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphCreate' in found_functions}} - -cdef cudaError_t _cudaGraphCreate(cudaGraph_t* pGraph, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphCreate(pGraph, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphAddKernelNode' in found_functions}} - -cdef cudaError_t _cudaGraphAddKernelNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - cdef ccuda.CUDA_KERNEL_NODE_PARAMS driverNodeParams - err = toDriverKernelNodeParams(pNodeParams, &driverNodeParams) - if err != cudaSuccess: - return err - err = ccuda._cuGraphAddKernelNode_v2(pGraphNode, graph, pDependencies, numDependencies, &driverNodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphKernelNodeSetParams' in found_functions}} - -cdef cudaError_t _cudaGraphKernelNodeSetParams(cudaGraphNode_t node, const cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - cdef ccuda.CUDA_KERNEL_NODE_PARAMS driverNodeParams - err = toDriverKernelNodeParams(pNodeParams, &driverNodeParams) - if err != cudaSuccess: - return err - err = ccuda._cuGraphKernelNodeSetParams_v2(node, &driverNodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphKernelNodeCopyAttributes' in found_functions}} - -cdef cudaError_t _cudaGraphKernelNodeCopyAttributes(cudaGraphNode_t hSrc, cudaGraphNode_t hDst) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphKernelNodeCopyAttributes(hSrc, hDst) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphMemsetNodeGetParams' in found_functions}} - -cdef cudaError_t _cudaGraphMemsetNodeGetParams(cudaGraphNode_t node, cudaMemsetParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphMemsetNodeGetParams(node, pNodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphMemsetNodeSetParams' in found_functions}} - -cdef cudaError_t _cudaGraphMemsetNodeSetParams(cudaGraphNode_t node, const cudaMemsetParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphMemsetNodeSetParams(node, pNodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphAddHostNode' in found_functions}} - -cdef cudaError_t _cudaGraphAddHostNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - cdef ccuda.CUDA_HOST_NODE_PARAMS driverNodeParams - toDriverHostNodeParams(pNodeParams, &driverNodeParams) - err = ccuda._cuGraphAddHostNode(pGraphNode, graph, pDependencies, numDependencies, &driverNodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphHostNodeGetParams' in found_functions}} - -cdef cudaError_t _cudaGraphHostNodeGetParams(cudaGraphNode_t node, cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphHostNodeGetParams(node, pNodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphHostNodeSetParams' in found_functions}} - -cdef cudaError_t _cudaGraphHostNodeSetParams(cudaGraphNode_t node, const cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - cdef ccuda.CUDA_HOST_NODE_PARAMS driverNodeParams - toDriverHostNodeParams(pNodeParams, &driverNodeParams) - err = ccuda._cuGraphHostNodeSetParams(node, &driverNodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphAddChildGraphNode' in found_functions}} - -cdef cudaError_t _cudaGraphAddChildGraphNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaGraph_t childGraph) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphAddChildGraphNode(pGraphNode, graph, pDependencies, numDependencies, childGraph) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphChildGraphNodeGetGraph' in found_functions}} - -cdef cudaError_t _cudaGraphChildGraphNodeGetGraph(cudaGraphNode_t node, cudaGraph_t* pGraph) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphChildGraphNodeGetGraph(node, pGraph) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphAddEmptyNode' in found_functions}} - -cdef cudaError_t _cudaGraphAddEmptyNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphAddEmptyNode(pGraphNode, graph, pDependencies, numDependencies) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphAddEventRecordNode' in found_functions}} - -cdef cudaError_t _cudaGraphAddEventRecordNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphAddEventRecordNode(pGraphNode, graph, pDependencies, numDependencies, event) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphEventRecordNodeGetEvent' in found_functions}} - -cdef cudaError_t _cudaGraphEventRecordNodeGetEvent(cudaGraphNode_t node, cudaEvent_t* event_out) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphEventRecordNodeGetEvent(node, event_out) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphEventRecordNodeSetEvent' in found_functions}} - -cdef cudaError_t _cudaGraphEventRecordNodeSetEvent(cudaGraphNode_t node, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphEventRecordNodeSetEvent(node, event) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphAddEventWaitNode' in found_functions}} - -cdef cudaError_t _cudaGraphAddEventWaitNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphAddEventWaitNode(pGraphNode, graph, pDependencies, numDependencies, event) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphEventWaitNodeGetEvent' in found_functions}} - -cdef cudaError_t _cudaGraphEventWaitNodeGetEvent(cudaGraphNode_t node, cudaEvent_t* event_out) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphEventWaitNodeGetEvent(node, event_out) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphEventWaitNodeSetEvent' in found_functions}} - -cdef cudaError_t _cudaGraphEventWaitNodeSetEvent(cudaGraphNode_t node, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphEventWaitNodeSetEvent(node, event) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphAddExternalSemaphoresSignalNode' in found_functions}} - -cdef cudaError_t _cudaGraphAddExternalSemaphoresSignalNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphAddExternalSemaphoresSignalNode(pGraphNode, graph, pDependencies, numDependencies, nodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphExternalSemaphoresSignalNodeGetParams' in found_functions}} - -cdef cudaError_t _cudaGraphExternalSemaphoresSignalNodeGetParams(cudaGraphNode_t hNode, cudaExternalSemaphoreSignalNodeParams* params_out) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphExternalSemaphoresSignalNodeGetParams(hNode, params_out) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphExternalSemaphoresSignalNodeSetParams' in found_functions}} - -cdef cudaError_t _cudaGraphExternalSemaphoresSignalNodeSetParams(cudaGraphNode_t hNode, const cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphExternalSemaphoresSignalNodeSetParams(hNode, nodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphAddExternalSemaphoresWaitNode' in found_functions}} - -cdef cudaError_t _cudaGraphAddExternalSemaphoresWaitNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphAddExternalSemaphoresWaitNode(pGraphNode, graph, pDependencies, numDependencies, nodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphExternalSemaphoresWaitNodeGetParams' in found_functions}} - -cdef cudaError_t _cudaGraphExternalSemaphoresWaitNodeGetParams(cudaGraphNode_t hNode, cudaExternalSemaphoreWaitNodeParams* params_out) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphExternalSemaphoresWaitNodeGetParams(hNode, params_out) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphExternalSemaphoresWaitNodeSetParams' in found_functions}} - -cdef cudaError_t _cudaGraphExternalSemaphoresWaitNodeSetParams(cudaGraphNode_t hNode, const cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphExternalSemaphoresWaitNodeSetParams(hNode, nodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphAddMemFreeNode' in found_functions}} - -cdef cudaError_t _cudaGraphAddMemFreeNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, void* dptr) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphAddMemFreeNode(pGraphNode, graph, pDependencies, numDependencies, dptr) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaDeviceGraphMemTrim' in found_functions}} - -cdef cudaError_t _cudaDeviceGraphMemTrim(int device) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuDeviceGraphMemTrim(device) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaDeviceGetGraphMemAttribute' in found_functions}} - -cdef cudaError_t _cudaDeviceGetGraphMemAttribute(int device, cudaGraphMemAttributeType attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuDeviceGetGraphMemAttribute(device, attr, value) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaDeviceSetGraphMemAttribute' in found_functions}} - -cdef cudaError_t _cudaDeviceSetGraphMemAttribute(int device, cudaGraphMemAttributeType attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuDeviceSetGraphMemAttribute(device, attr, value) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphClone' in found_functions}} - -cdef cudaError_t _cudaGraphClone(cudaGraph_t* pGraphClone, cudaGraph_t originalGraph) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphClone(pGraphClone, originalGraph) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphNodeFindInClone' in found_functions}} - -cdef cudaError_t _cudaGraphNodeFindInClone(cudaGraphNode_t* pNode, cudaGraphNode_t originalNode, cudaGraph_t clonedGraph) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphNodeFindInClone(pNode, originalNode, clonedGraph) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphNodeGetType' in found_functions}} - -cdef cudaError_t _cudaGraphNodeGetType(cudaGraphNode_t node, cudaGraphNodeType* pType) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphNodeGetType(node, pType) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphGetNodes' in found_functions}} - -cdef cudaError_t _cudaGraphGetNodes(cudaGraph_t graph, cudaGraphNode_t* nodes, size_t* numNodes) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphGetNodes(graph, nodes, numNodes) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphGetRootNodes' in found_functions}} - -cdef cudaError_t _cudaGraphGetRootNodes(cudaGraph_t graph, cudaGraphNode_t* pRootNodes, size_t* pNumRootNodes) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphGetRootNodes(graph, pRootNodes, pNumRootNodes) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphGetEdges' in found_functions}} - -cdef cudaError_t _cudaGraphGetEdges(cudaGraph_t graph, cudaGraphNode_t* from_, cudaGraphNode_t* to, size_t* numEdges) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphGetEdges(graph, from_, to, numEdges) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphNodeGetDependencies' in found_functions}} - -cdef cudaError_t _cudaGraphNodeGetDependencies(cudaGraphNode_t node, cudaGraphNode_t* pDependencies, size_t* pNumDependencies) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphNodeGetDependencies(node, pDependencies, pNumDependencies) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphNodeGetDependentNodes' in found_functions}} - -cdef cudaError_t _cudaGraphNodeGetDependentNodes(cudaGraphNode_t node, cudaGraphNode_t* pDependentNodes, size_t* pNumDependentNodes) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphNodeGetDependentNodes(node, pDependentNodes, pNumDependentNodes) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphAddDependencies' in found_functions}} - -cdef cudaError_t _cudaGraphAddDependencies(cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphAddDependencies(graph, from_, to, numDependencies) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphRemoveDependencies' in found_functions}} - -cdef cudaError_t _cudaGraphRemoveDependencies(cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphRemoveDependencies(graph, from_, to, numDependencies) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphDestroyNode' in found_functions}} - -cdef cudaError_t _cudaGraphDestroyNode(cudaGraphNode_t node) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphDestroyNode(node) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphInstantiate' in found_functions}} - -cdef cudaError_t _cudaGraphInstantiate(cudaGraphExec_t* pGraphExec, cudaGraph_t graph, unsigned long long flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphInstantiateWithFlags(pGraphExec, graph, flags) - -{{endif}} -{{if 'cudaGraphInstantiateWithFlags' in found_functions}} - -cdef cudaError_t _cudaGraphInstantiateWithFlags(cudaGraphExec_t* pGraphExec, cudaGraph_t graph, unsigned long long flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphInstantiateWithFlags(pGraphExec, graph, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphExecKernelNodeSetParams' in found_functions}} - -cdef cudaError_t _cudaGraphExecKernelNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - cdef ccuda.CUDA_KERNEL_NODE_PARAMS driverNodeParams - err = toDriverKernelNodeParams(pNodeParams, &driverNodeParams) - if err != cudaSuccess: - return err - err = ccuda._cuGraphExecKernelNodeSetParams_v2(hGraphExec, node, &driverNodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphExecHostNodeSetParams' in found_functions}} - -cdef cudaError_t _cudaGraphExecHostNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - cdef ccuda.CUDA_HOST_NODE_PARAMS driverNodeParams - toDriverHostNodeParams(pNodeParams, &driverNodeParams) - err = ccuda._cuGraphExecHostNodeSetParams(hGraphExec, node, &driverNodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphExecChildGraphNodeSetParams' in found_functions}} - -cdef cudaError_t _cudaGraphExecChildGraphNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, cudaGraph_t childGraph) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphExecChildGraphNodeSetParams(hGraphExec, node, childGraph) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphExecEventRecordNodeSetEvent' in found_functions}} - -cdef cudaError_t _cudaGraphExecEventRecordNodeSetEvent(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphExecEventRecordNodeSetEvent(hGraphExec, hNode, event) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphExecEventWaitNodeSetEvent' in found_functions}} - -cdef cudaError_t _cudaGraphExecEventWaitNodeSetEvent(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphExecEventWaitNodeSetEvent(hGraphExec, hNode, event) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphExecExternalSemaphoresSignalNodeSetParams' in found_functions}} - -cdef cudaError_t _cudaGraphExecExternalSemaphoresSignalNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, const cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphExecExternalSemaphoresSignalNodeSetParams(hGraphExec, hNode, nodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphExecExternalSemaphoresWaitNodeSetParams' in found_functions}} - -cdef cudaError_t _cudaGraphExecExternalSemaphoresWaitNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, const cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphExecExternalSemaphoresWaitNodeSetParams(hGraphExec, hNode, nodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphNodeSetEnabled' in found_functions}} - -cdef cudaError_t _cudaGraphNodeSetEnabled(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, unsigned int isEnabled) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphNodeSetEnabled(hGraphExec, hNode, isEnabled) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphNodeGetEnabled' in found_functions}} - -cdef cudaError_t _cudaGraphNodeGetEnabled(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, unsigned int* isEnabled) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphNodeGetEnabled(hGraphExec, hNode, isEnabled) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphExecUpdate' in found_functions}} - -cdef cudaError_t _cudaGraphExecUpdate(cudaGraphExec_t hGraphExec, cudaGraph_t hGraph, cudaGraphExecUpdateResultInfo* resultInfo) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphExecUpdate_v2(hGraphExec, hGraph, resultInfo) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphUpload' in found_functions}} - -cdef cudaError_t _cudaGraphUpload(cudaGraphExec_t graphExec, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphUpload(graphExec, stream) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphLaunch' in found_functions}} - -cdef cudaError_t _cudaGraphLaunch(cudaGraphExec_t graphExec, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphLaunch(graphExec, stream) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphExecDestroy' in found_functions}} - -cdef cudaError_t _cudaGraphExecDestroy(cudaGraphExec_t graphExec) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphExecDestroy(graphExec) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphDestroy' in found_functions}} - -cdef cudaError_t _cudaGraphDestroy(cudaGraph_t graph) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphDestroy(graph) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphDebugDotPrint' in found_functions}} - -cdef cudaError_t _cudaGraphDebugDotPrint(cudaGraph_t graph, const char* path, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphDebugDotPrint(graph, path, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaUserObjectCreate' in found_functions}} - -cdef cudaError_t _cudaUserObjectCreate(cudaUserObject_t* object_out, void* ptr, cudaHostFn_t destroy, unsigned int initialRefcount, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuUserObjectCreate(object_out, ptr, destroy, initialRefcount, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaUserObjectRetain' in found_functions}} - -cdef cudaError_t _cudaUserObjectRetain(cudaUserObject_t object, unsigned int count) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuUserObjectRetain(object, count) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaUserObjectRelease' in found_functions}} - -cdef cudaError_t _cudaUserObjectRelease(cudaUserObject_t object, unsigned int count) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuUserObjectRelease(object, count) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphRetainUserObject' in found_functions}} - -cdef cudaError_t _cudaGraphRetainUserObject(cudaGraph_t graph, cudaUserObject_t object, unsigned int count, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphRetainUserObject(graph, object, count, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphReleaseUserObject' in found_functions}} - -cdef cudaError_t _cudaGraphReleaseUserObject(cudaGraph_t graph, cudaUserObject_t object, unsigned int count) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphReleaseUserObject(graph, object, count) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if True}} - -cdef cudaError_t _cudaProfilerStart() except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuProfilerStart() - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if True}} - -cdef cudaError_t _cudaProfilerStop() except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuProfilerStop() - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if True}} - -cdef cudaError_t _cudaGraphicsEGLRegisterImage(cudaGraphicsResource_t* pCudaResource, EGLImageKHR image, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphicsEGLRegisterImage(pCudaResource, image, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if True}} - -cdef cudaError_t _cudaEGLStreamConsumerConnect(cudaEglStreamConnection* conn, EGLStreamKHR eglStream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuEGLStreamConsumerConnect(conn, eglStream) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if True}} - -cdef cudaError_t _cudaEGLStreamConsumerConnectWithFlags(cudaEglStreamConnection* conn, EGLStreamKHR eglStream, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuEGLStreamConsumerConnectWithFlags(conn, eglStream, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if True}} - -cdef cudaError_t _cudaEGLStreamConsumerDisconnect(cudaEglStreamConnection* conn) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuEGLStreamConsumerDisconnect(conn) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if True}} - -cdef cudaError_t _cudaEGLStreamConsumerAcquireFrame(cudaEglStreamConnection* conn, cudaGraphicsResource_t* pCudaResource, cudaStream_t* pStream, unsigned int timeout) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuEGLStreamConsumerAcquireFrame(conn, pCudaResource, pStream, timeout) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if True}} - -cdef cudaError_t _cudaEGLStreamConsumerReleaseFrame(cudaEglStreamConnection* conn, cudaGraphicsResource_t pCudaResource, cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuEGLStreamConsumerReleaseFrame(conn, pCudaResource, pStream) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if True}} - -cdef cudaError_t _cudaEGLStreamProducerConnect(cudaEglStreamConnection* conn, EGLStreamKHR eglStream, EGLint width, EGLint height) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuEGLStreamProducerConnect(conn, eglStream, width, height) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if True}} - -cdef cudaError_t _cudaEGLStreamProducerDisconnect(cudaEglStreamConnection* conn) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuEGLStreamProducerDisconnect(conn) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if True}} - -cdef cudaError_t _cudaEventCreateFromEGLSync(cudaEvent_t* phEvent, EGLSyncKHR eglSync, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuEventCreateFromEGLSync(phEvent, eglSync, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaInitDevice' in found_functions}} - -cdef cudaError_t _cudaInitDevice(int deviceOrdinal, unsigned int deviceFlags, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - cdef cudaPythonDevice *device - cdef unsigned int scheduleFlags - - err = m_global.lazyInitDriver() - if err != cudaSuccess: - return err - - device = m_global.getDevice(deviceOrdinal) - if device == NULL: - _setLastError(cudaErrorInvalidDevice) - return cudaErrorInvalidDevice - - if device.primaryContext == NULL: - initPrimaryContext(device) - - if flags & cudaInitDeviceFlagsAreValid: - scheduleFlags = deviceFlags & cudaDeviceScheduleMask - deviceFlags &= ~cudaDeviceMapHost - if deviceFlags & ~cudaDeviceMask: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - if scheduleFlags: - if scheduleFlags != cudaDeviceScheduleSpin and scheduleFlags != cudaDeviceScheduleYield and scheduleFlags != cudaDeviceScheduleBlockingSync: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - - err = ccuda._cuDevicePrimaryCtxSetFlags_v2(device[0].driverDevice, deviceFlags) - if err != cudaSuccess: - _setLastError(err) - return err - return cudaSuccess - -{{endif}} -{{if 'cudaStreamGetId' in found_functions}} - -cdef cudaError_t _cudaStreamGetId(cudaStream_t hStream, unsigned long long* streamId) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuStreamGetId(hStream, streamId) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphInstantiateWithParams' in found_functions}} - -cdef cudaError_t _cudaGraphInstantiateWithParams(cudaGraphExec_t* pGraphExec, cudaGraph_t graph, cudaGraphInstantiateParams* instantiateParams) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphInstantiateWithParams(pGraphExec, graph, instantiateParams) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphExecGetFlags' in found_functions}} - -cdef cudaError_t _cudaGraphExecGetFlags(cudaGraphExec_t graphExec, unsigned long long* flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphExecGetFlags(graphExec, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGetKernel' in found_functions}} - -cdef cudaError_t _cudaGetKernel(cudaKernel_t* kernelPtr, const void* entryFuncAddr) except ?cudaErrorCallRequiresNewerDriver nogil: - if kernelPtr == NULL: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - if entryFuncAddr == NULL: - _setLastError(cudaErrorInvalidDeviceFunction) - return cudaErrorInvalidDeviceFunction - - kernelPtr[0] = entryFuncAddr; - return cudaSuccess - -{{endif}} -{{if 'cudaGraphAddNode' in found_functions}} - -cdef cudaError_t _cudaGraphAddNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - if nodeParams == NULL: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - _setLastError(err) - return err - cdef ccuda.CUgraphNodeParams driverNodeParams - err = toDriverGraphNodeParams(nodeParams, &driverNodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - err = ccuda._cuGraphAddNode(pGraphNode, graph, pDependencies, numDependencies, &driverNodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - toCudartGraphNodeOutParams(&driverNodeParams, nodeParams) - return cudaSuccess - -{{endif}} -{{if 'cudaGraphNodeSetParams' in found_functions}} - -cdef cudaError_t _cudaGraphNodeSetParams(cudaGraphNode_t node, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - if nodeParams == NULL: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - _setLastError(err) - return err - cdef ccuda.CUgraphNodeParams driverNodeParams - err = toDriverGraphNodeParams(nodeParams, &driverNodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - err = ccuda._cuGraphNodeSetParams(node, &driverNodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - toCudartGraphNodeOutParams(&driverNodeParams, nodeParams); - return cudaSuccess - -{{endif}} -{{if 'cudaGraphExecNodeSetParams' in found_functions}} - -cdef cudaError_t _cudaGraphExecNodeSetParams(cudaGraphExec_t graphExec, cudaGraphNode_t node, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - if nodeParams == NULL: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - _setLastError(err) - return err - cdef ccuda.CUgraphNodeParams driverNodeParams - err = toDriverGraphNodeParams(nodeParams, &driverNodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - err = ccuda._cuGraphExecNodeSetParams(graphExec, node, &driverNodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - toCudartGraphNodeOutParams(&driverNodeParams, nodeParams); - return cudaSuccess - -{{endif}} -{{if 'cudaGraphConditionalHandleCreate' in found_functions}} - -cdef cudaError_t _cudaGraphConditionalHandleCreate(cudaGraphConditionalHandle* pHandle_out, cudaGraph_t graph, unsigned int defaultLaunchValue, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - cdef ccuda.CUcontext context - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuCtxGetCurrent(&context) - if err != cudaSuccess: - _setLastError(err) - return err - err = ccuda._cuGraphConditionalHandleCreate(pHandle_out, graph, context, defaultLaunchValue, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaStreamGetCaptureInfo_v3' in found_functions}} - -cdef cudaError_t _cudaStreamGetCaptureInfo_v3(cudaStream_t stream, cudaStreamCaptureStatus* captureStatus_out, unsigned long long* id_out, cudaGraph_t* graph_out, const cudaGraphNode_t** dependencies_out, const cudaGraphEdgeData** edgeData_out, size_t* numDependencies_out) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = streamGetCaptureInfoCommon_v3(stream, captureStatus_out, id_out, graph_out, dependencies_out, edgeData_out, numDependencies_out) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaStreamUpdateCaptureDependencies_v2' in found_functions}} - -cdef cudaError_t _cudaStreamUpdateCaptureDependencies_v2(cudaStream_t stream, cudaGraphNode_t* dependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuStreamUpdateCaptureDependencies_v2(stream, dependencies, dependencyData, numDependencies, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphGetEdges_v2' in found_functions}} - -cdef cudaError_t _cudaGraphGetEdges_v2(cudaGraph_t graph, cudaGraphNode_t* from_, cudaGraphNode_t* to, cudaGraphEdgeData* edgeData, size_t* numEdges) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphGetEdges_v2(graph, from_, to, edgeData, numEdges) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphNodeGetDependencies_v2' in found_functions}} - -cdef cudaError_t _cudaGraphNodeGetDependencies_v2(cudaGraphNode_t node, cudaGraphNode_t* pDependencies, cudaGraphEdgeData* edgeData, size_t* pNumDependencies) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphNodeGetDependencies_v2(node, pDependencies, edgeData, pNumDependencies) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphNodeGetDependentNodes_v2' in found_functions}} - -cdef cudaError_t _cudaGraphNodeGetDependentNodes_v2(cudaGraphNode_t node, cudaGraphNode_t* pDependentNodes, cudaGraphEdgeData* edgeData, size_t* pNumDependentNodes) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphNodeGetDependentNodes_v2(node, pDependentNodes, edgeData, pNumDependentNodes) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphAddDependencies_v2' in found_functions}} - -cdef cudaError_t _cudaGraphAddDependencies_v2(cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, const cudaGraphEdgeData* edgeData, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphAddDependencies_v2(graph, from_, to, edgeData, numDependencies) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphRemoveDependencies_v2' in found_functions}} - -cdef cudaError_t _cudaGraphRemoveDependencies_v2(cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, const cudaGraphEdgeData* edgeData, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = ccuda._cuGraphRemoveDependencies_v2(graph, from_, to, edgeData, numDependencies) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphAddNode_v2' in found_functions}} - -cdef cudaError_t _cudaGraphAddNode_v2(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - if nodeParams == NULL: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - _setLastError(err) - return err - cdef ccuda.CUgraphNodeParams driverNodeParams - err = toDriverGraphNodeParams(nodeParams, &driverNodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - err = ccuda._cuGraphAddNode_v2(pGraphNode, graph, pDependencies, dependencyData, numDependencies, &driverNodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - toCudartGraphNodeOutParams(&driverNodeParams, nodeParams) - return cudaSuccess - -{{endif}} -{{if True}} - -{{if 'Windows' != platform.system()}} -cimport cuda._lib.dlfcn as dlfcn -{{endif}} - -cdef cudaError_t _getLocalRuntimeVersion(int* runtimeVersion) except ?cudaErrorCallRequiresNewerDriver nogil: - {{if 'Windows' == platform.system()}} - with gil: - raise NotImplementedError('"getLocalRuntimeVersion" is unsupported on Windows') - {{else}} - # Load - handle = dlfcn.dlopen('libcudart.so.12', dlfcn.RTLD_NOW) - if handle == NULL: - with gil: - raise RuntimeError(f'Failed to dlopen libcudart.so.12') - - __cudaRuntimeGetVersion = dlfcn.dlsym(handle, 'cudaRuntimeGetVersion') - - if __cudaRuntimeGetVersion == NULL: - with gil: - raise RuntimeError(f'Function "cudaRuntimeGetVersion" not found in libcudart.so.12') - - # Call - cdef cudaError_t err = cudaSuccess - err = ( __cudaRuntimeGetVersion)(runtimeVersion) - - # Unload - dlfcn.dlclose(handle) - - # Return - return err - {{endif}} -{{endif}} -{{if 'cudaDeviceRegisterAsyncNotification' in found_functions}} - -cdef cudaError_t _cudaDeviceRegisterAsyncNotification(int device, cudaAsyncCallback callbackFunc, void* userData, cudaAsyncCallbackHandle_t* callback) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = DeviceRegisterAsyncNotificationCommon(device, callbackFunc, userData, callback) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaDeviceUnregisterAsyncNotification' in found_functions}} - -cdef cudaError_t _cudaDeviceUnregisterAsyncNotification(int device, cudaAsyncCallbackHandle_t callback) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = DeviceUnregisterAsyncNotificationCommon(device, callback) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGetDriverEntryPointByVersion' in found_functions}} - -cdef cudaError_t _cudaGetDriverEntryPointByVersion(const char* symbol, void** funcPtr, unsigned int cudaVersion, unsigned long long flags, cudaDriverEntryPointQueryResult* driverStatus) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = ccuda._cuGetProcAddress_v2(symbol, funcPtr, cudaVersion, flags, driverStatus) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} diff --git a/cuda/_lib/ccudart/utils.pxd.in b/cuda/_lib/ccudart/utils.pxd.in deleted file mode 100644 index 7bc552bb3bb..00000000000 --- a/cuda/_lib/ccudart/utils.pxd.in +++ /dev/null @@ -1,121 +0,0 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. -# -# Please refer to the NVIDIA end user license agreement (EULA) associated -# with this source code for terms and conditions that govern your use of -# this software. Any use, reproduction, disclosure, or distribution of -# this software and related documentation outside the terms of the EULA -# is strictly prohibited. -from cuda.ccudart cimport * -from libc.stdlib cimport malloc, free, calloc -from libc.string cimport memset, memcpy, strncmp -from libcpp cimport bool -from libcpp.map cimport map -cimport cuda._cuda.ccuda as ccuda - -ctypedef struct cudaAsyncCallbackData_st: - cudaAsyncCallback callback - void *userData - -ctypedef cudaAsyncCallbackData_st cudaAsyncCallbackData - -cdef struct cudaPythonDevice: - ccuda.CUdevice driverDevice - ccuda.CUcontext primaryContext - bool primaryContextRetained - int deviceOrdinal - cudaDeviceProp deviceProperties - -cdef class cudaPythonGlobal: - cdef bint _lazyInitDriver - cdef int _numDevices - cdef cudaPythonDevice* _deviceList - cdef cudaError_t _lastError - cdef int _CUDART_VERSION - cdef map[cudaAsyncCallbackHandle_t, cudaAsyncCallbackData*] _asyncCallbackDataMap - - cdef cudaError_t lazyInitDriver(self) except ?cudaErrorCallRequiresNewerDriver nogil - cdef cudaError_t lazyInitContextState(self) except ?cudaErrorCallRequiresNewerDriver nogil - cdef cudaPythonDevice* getDevice(self, int deviceOrdinal) noexcept nogil - cdef cudaPythonDevice* getDeviceFromDriver(self, ccuda.CUdevice driverDevice) noexcept nogil - cdef cudaPythonDevice* getDeviceFromPrimaryCtx(self, ccuda.CUcontext context) noexcept nogil - -cdef cudaError_t initPrimaryContext(cudaPythonDevice *device) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t resetPrimaryContext(cudaPythonDevice* device) except ?cudaErrorCallRequiresNewerDriver nogil - -cdef cudaPythonGlobal globalGetInstance() -cdef cudaError_t _setLastError(cudaError_t err) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t getDescInfo(const cudaChannelFormatDesc* d, int *numberOfChannels, ccuda.CUarray_format *format) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t streamAddCallbackCommon(cudaStream_t stream, cudaStreamCallback_t callback, void *userData, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t streamAddHostCallbackCommon(cudaStream_t stream, cudaHostFn_t callback, void *userData) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t streamGetCaptureInfoCommon(cudaStream_t stream, cudaStreamCaptureStatus* captureStatus_out, unsigned long long *id_out, cudaGraph_t *graph_out, const cudaGraphNode_t **dependencies_out, size_t *numDependencies_out) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t streamGetCaptureInfoCommon_v3(cudaStream_t stream, cudaStreamCaptureStatus* captureStatus_out, unsigned long long *id_out, cudaGraph_t *graph_out, const cudaGraphNode_t **dependencies_out, const cudaGraphEdgeData** edgeData_out, size_t *numDependencies_out) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t getChannelFormatDescFromDriverDesc(cudaChannelFormatDesc* pRuntimeDesc, size_t* pDepth, size_t* pHeight, size_t* pWidth, const ccuda.CUDA_ARRAY3D_DESCRIPTOR_v2* pDriverDesc) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t copyFromHost2D(cudaArray_const_t thisArray, size_t hOffset, size_t wOffset, const char *src, size_t spitch, size_t width, size_t height, ccuda.CUstream stream, bool async) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t copyFromDevice2D(ccuda.CUmemorytype type, cudaArray_const_t thisArray, size_t hOffset, size_t wOffset, const char *src, size_t srcOffset, - size_t spitch, size_t width, size_t height, ccuda.CUstream stream, bool async) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t copyToHost2D(cudaArray_const_t thisArray, size_t hOffset, size_t wOffset, char *dst, size_t dpitch, size_t width, - size_t height, ccuda.CUstream stream, bool async) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t copyToDevice2D(ccuda.CUmemorytype type, cudaArray_const_t thisArray, size_t hOffset, size_t wOffset, const char *dst, size_t dstOffset, size_t dpitch, - size_t width, size_t height, ccuda.CUstream stream, bool async) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t copyToArray2D(cudaArray_const_t thisArray, size_t hOffsetSrc, size_t wOffsetSrc, cudaArray_t dst, - size_t hOffsetDst, size_t wOffsetDst, size_t width, size_t height) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t getChannelDesc(cudaArray_const_t thisArray, cudaChannelFormatDesc *outDesc) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t getDriverResDescFromResDesc(ccuda.CUDA_RESOURCE_DESC *rdDst, const cudaResourceDesc *rdSrc, - ccuda.CUDA_TEXTURE_DESC *tdDst, const cudaTextureDesc *tdSrc, - ccuda.CUDA_RESOURCE_VIEW_DESC *rvdDst, const cudaResourceViewDesc *rvdSrc) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t getResDescFromDriverResDesc(cudaResourceDesc *rdDst, const ccuda.CUDA_RESOURCE_DESC *rdSrc, - cudaTextureDesc *tdDst, const ccuda.CUDA_TEXTURE_DESC *tdSrc, - cudaResourceViewDesc *rvdDst, const ccuda.CUDA_RESOURCE_VIEW_DESC *rvdSrc) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t memsetPtr(char *mem, int c, size_t count, cudaStream_t sid, bool async) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t memset2DPtr(char *mem, size_t pitch, int c, size_t width, size_t height, cudaStream_t sid, bool async) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t copyFromHost(cudaArray_const_t thisArray, size_t hOffset, size_t wOffset, const char *src, size_t count, - ccuda.CUstream stream, bool async) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t copyFromDevice(ccuda.CUmemorytype type, cudaArray_const_t thisArray, size_t hOffset, size_t wOffset, - const char *src, size_t srcOffset, size_t count, ccuda.CUstream stream, bool async) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t copyToHost(cudaArray_const_t thisArray, size_t hOffset, size_t wOffset, char *dst, size_t count, ccuda.CUstream stream, bool async) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t copyToDevice(ccuda.CUmemorytype type, cudaArray_const_t thisArray, size_t hOffset, size_t wOffset, - const char *dst, size_t dstOffset, size_t count, ccuda.CUstream stream, bool async) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t copy1DConvertTo3DParams(void* dst, const void* src, size_t count, cudaMemcpyKind kind, cudaMemcpy3DParms *p) except ?cudaErrorCallRequiresNewerDriver nogil -cdef void toDriverMemsetNodeParams(const cudaMemsetParams *pRuntimeParams, ccuda.CUDA_MEMSET_NODE_PARAMS *pDriverParams) noexcept nogil -cdef cudaError_t toDriverMemCopy3DParams(const cudaMemcpy3DParms *p, ccuda.CUDA_MEMCPY3D *cd) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t mallocArray(cudaArray_t *arrayPtr, const cudaChannelFormatDesc *desc, size_t depth, size_t height, - size_t width, int corr2D, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t memcpy2DToArray(cudaArray_t dst, size_t hOffset, size_t wOffset, const char *src, - size_t spitch, size_t width, size_t height, cudaMemcpyKind kind, - cudaStream_t sid, bool async) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t memcpyDispatch(void *dst, const void *src, size_t size, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t mallocHost(size_t size, void **mem, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t mallocPitch(size_t width, size_t height, size_t depth, void **mem, size_t *pitch) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t mallocMipmappedArray(cudaMipmappedArray_t *mipmappedArrayPtr, const cudaChannelFormatDesc *desc, - size_t depth, size_t height, size_t width, unsigned int numLevels, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t memcpy2DPtr(char *dst, size_t dpitch, const char *src, size_t spitch, size_t width, - size_t height, cudaMemcpyKind kind, - cudaStream_t sid, bool async) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t memcpy3D(const cudaMemcpy3DParms *p, bool peer, int srcDevice, int dstDevice, cudaStream_t sid, bool async) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t memcpyAsyncDispatch(void *dst, const void *src, size_t size, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t toCudartMemCopy3DParams(const ccuda.CUDA_MEMCPY3D_v2 *cd, cudaMemcpy3DParms *p) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t memcpy2DFromArray(char *dst, size_t dpitch, cudaArray_const_t src, size_t hOffset, - size_t wOffset, size_t width, size_t height, cudaMemcpyKind kind, - cudaStream_t sid, bool async) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t memcpy2DArrayToArray(cudaArray_t dst, size_t hOffsetDst, size_t wOffsetDst, - cudaArray_const_t src, size_t hOffsetSrc, size_t wOffsetSrc, - size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t memset3DPtr(cudaPitchedPtr p, int val, cudaExtent e, cudaStream_t sid, bool async) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t memcpyToArray(cudaArray_t dst, size_t hOffset, size_t wOffset, const char *src, - size_t count, cudaMemcpyKind kind, - cudaStream_t sid, bool async) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t memcpyFromArray(char *dst, cudaArray_const_t src, size_t hOffset, size_t wOffset, - size_t count, cudaMemcpyKind kind, - cudaStream_t sid, bool async) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t memcpyArrayToArray(cudaArray_t dst, size_t hOffsetDst, size_t wOffsetDst, - cudaArray_const_t src, size_t hOffsetSrc, size_t wOffsetSrc, - size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t toDriverCudaResourceDesc(ccuda.CUDA_RESOURCE_DESC *_driver_pResDesc, const cudaResourceDesc *pResDesc) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t getDriverEglFrame(ccuda.CUeglFrame *cuEglFrame, cudaEglFrame eglFrame) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t getRuntimeEglFrame(cudaEglFrame *eglFrame, ccuda.CUeglFrame cueglFrame) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t toDriverGraphNodeParams(const cudaGraphNodeParams *rtParams, ccuda.CUgraphNodeParams *driverParams) except ?cudaErrorCallRequiresNewerDriver nogil -cdef void toCudartGraphNodeOutParams(const ccuda.CUgraphNodeParams *driverParams, cudaGraphNodeParams *rtParams) noexcept nogil -cdef cudaError_t toDriverKernelNodeParams(const cudaKernelNodeParams *nodeParams, ccuda.CUDA_KERNEL_NODE_PARAMS *driverNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil -cdef void toDriverHostNodeParams(const cudaHostNodeParams *pRuntimeNodeParams, ccuda.CUDA_HOST_NODE_PARAMS *pDriverNodeParams) noexcept nogil -cdef cudaError_t DeviceRegisterAsyncNotificationCommon(int device, cudaAsyncCallback callbackFunc, void* userData, cudaAsyncCallbackHandle_t* callback) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t DeviceUnregisterAsyncNotificationCommon(int device, cudaAsyncCallbackHandle_t callback) except ?cudaErrorCallRequiresNewerDriver nogil diff --git a/cuda/_lib/ccudart/utils.pyx.in b/cuda/_lib/ccudart/utils.pyx.in deleted file mode 100644 index 35ddf5a0dfd..00000000000 --- a/cuda/_lib/ccudart/utils.pyx.in +++ /dev/null @@ -1,3503 +0,0 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. -# -# Please refer to the NVIDIA end user license agreement (EULA) associated -# with this source code for terms and conditions that govern your use of -# this software. Any use, reproduction, disclosure, or distribution of -# this software and related documentation outside the terms of the EULA -# is strictly prohibited. -import cython -from cuda.ccudart cimport * -from libc.stdlib cimport malloc, free, calloc -from libc.string cimport memset, memcpy, strncmp, memcmp -from libcpp cimport bool -cimport cuda._cuda.ccuda as ccuda - -cdef struct cudaArrayLocalState: - ccuda.CUarray array - cudaChannelFormatDesc desc - size_t depth - size_t height - size_t width - size_t elementSize - size_t widthInBytes - -ctypedef struct cudaStreamCallbackData_st: - cudaStreamCallback_t callback - void *userData - -ctypedef cudaStreamCallbackData_st cudaStreamCallbackData - -ctypedef struct cudaStreamHostCallbackData_st: - cudaHostFn_t callback - void *userData - -ctypedef cudaStreamHostCallbackData_st cudaStreamHostCallbackData - -cdef class cudaPythonGlobal: - def __cinit__(self): - self._lazyInitDriver = False - self._numDevices = 0 - self._deviceList = NULL - self._CUDART_VERSION = CUDART_VERSION - - def __dealloc__(self): - if self._deviceList is not NULL: - free(self._deviceList) - for item in self._asyncCallbackDataMap: - free(item.second) - self._asyncCallbackDataMap.clear() - - cdef cudaError_t lazyInitDriver(self) except ?cudaErrorCallRequiresNewerDriver nogil: - if self._lazyInitDriver: - return cudaSuccess - - cdef cudaError_t err = cudaSuccess - err = ccuda._cuInit(0) - if err != cudaSuccess: - return err - err = ccuda._cuDeviceGetCount(&self._numDevices) - if err != cudaSuccess: - return err - - self._deviceList = calloc(self._numDevices, sizeof(cudaPythonDevice)) - if self._deviceList == NULL: - return cudaErrorMemoryAllocation - - for deviceOrdinal in range(self._numDevices): - err = initDevice(&self._deviceList[deviceOrdinal], deviceOrdinal) - if err != cudaSuccess: - free(self._deviceList) - return err - - self._lazyInitDriver = True - - cdef cudaError_t lazyInitContextState(self) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - cdef ccuda.CUcontext driverContext - cdef cudaPythonDevice *device - - err = self.lazyInitDriver() - if err != cudaSuccess: - return err - - err = ccuda._cuCtxGetCurrent(&driverContext) - if err != cudaSuccess: - return err - device = self.getDeviceFromPrimaryCtx(driverContext) - - # 1. Context + device - if driverContext != NULL and device != NULL: - err = initPrimaryContext(device) - if err != cudaSuccess: - return err - - # 2. Context + no device - cdef unsigned int version - if driverContext != NULL: - # If the context exists, but is non-primary, make sure it can be used with the CUDA 3.2 API, - # then return immediately - err = ccuda._cuCtxGetApiVersion(driverContext, &version) - if err == cudaErrorContextIsDestroyed: - return cudaErrorIncompatibleDriverContext - elif err != cudaSuccess: - return err - elif version < 3020: - return cudaErrorIncompatibleDriverContext - return cudaSuccess - - # 3. No context + device - # (impossible) - - # 4. No context + no device - # Default to first device - device = self.getDevice(0) - err = initPrimaryContext(device) - if err != cudaSuccess: - return err - err = ccuda._cuCtxSetCurrent(device.primaryContext) - return err - - cdef cudaPythonDevice* getDevice(self, int deviceOrdinal) noexcept nogil: - if deviceOrdinal < 0 or deviceOrdinal >= m_global._numDevices: - return NULL - return &self._deviceList[deviceOrdinal] - - cdef cudaPythonDevice* getDeviceFromDriver(self, ccuda.CUdevice driverDevice) noexcept nogil: - for i in range(self._numDevices): - if self._deviceList[i].driverDevice == driverDevice: - return &self._deviceList[i] - return NULL - - cdef cudaPythonDevice* getDeviceFromPrimaryCtx(self, ccuda.CUcontext context) noexcept nogil: - if context == NULL: - return NULL - for i in range(self._numDevices): - if self._deviceList[i].primaryContext == context: - return &self._deviceList[i] - return NULL - -cdef cudaPythonGlobal m_global = cudaPythonGlobal() - - -cdef cudaError_t initDevice(cudaPythonDevice *device, int deviceOrdinal) except ?cudaErrorCallRequiresNewerDriver nogil: - # ccuda.CUcontext primaryContext - device[0].primaryContext = NULL - # bool primaryContextRetained - device[0].primaryContextRetained = False - # int deviceOrdinal - device[0].deviceOrdinal = deviceOrdinal - - # ccuda.CUdevice driverDevice - err = ccuda._cuDeviceGet(&device[0].driverDevice, deviceOrdinal) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - # cudaDeviceProp deviceProperties - err = ccuda._cuDeviceGetName(device[0].deviceProperties.name, sizeof(device[0].deviceProperties.name), deviceOrdinal) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceTotalMem_v2(&(device[0].deviceProperties.totalGlobalMem), deviceOrdinal) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceTotalMem_v2(&(device[0].deviceProperties.totalGlobalMem), deviceOrdinal) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.major), ccuda.CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.minor), ccuda.CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.deviceOverlap), ccuda.CU_DEVICE_ATTRIBUTE_GPU_OVERLAP, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.asyncEngineCount), ccuda.CU_DEVICE_ATTRIBUTE_ASYNC_ENGINE_COUNT, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.multiProcessorCount), ccuda.CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.kernelExecTimeoutEnabled), ccuda.CU_DEVICE_ATTRIBUTE_KERNEL_EXEC_TIMEOUT, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.integrated), ccuda.CU_DEVICE_ATTRIBUTE_INTEGRATED, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.canMapHostMemory), ccuda.CU_DEVICE_ATTRIBUTE_CAN_MAP_HOST_MEMORY, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.maxTexture1D), ccuda.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_WIDTH, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.maxTexture1DMipmap), ccuda.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_MIPMAPPED_WIDTH, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.maxTexture1DLinear), ccuda.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LINEAR_WIDTH, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.maxTexture2D[0]), ccuda.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_WIDTH, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.maxTexture2D[1]), ccuda.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_HEIGHT, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.maxTexture2DMipmap[0]), ccuda.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_MIPMAPPED_WIDTH, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.maxTexture2DMipmap[1]), ccuda.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_MIPMAPPED_HEIGHT, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.maxTexture2DLinear[0]), ccuda.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_WIDTH, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.maxTexture2DLinear[1]), ccuda.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_HEIGHT, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.maxTexture2DLinear[2]), ccuda.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_PITCH, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.maxTexture2DGather[0]), ccuda.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_GATHER_WIDTH, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.maxTexture2DGather[1]), ccuda.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_GATHER_HEIGHT, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.maxTexture3D[0]), ccuda.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_WIDTH, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.maxTexture3D[1]), ccuda.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_HEIGHT, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.maxTexture3D[2]), ccuda.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_DEPTH, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.maxTexture3DAlt[0]), ccuda.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_WIDTH_ALTERNATE, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.maxTexture3DAlt[1]), ccuda.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_HEIGHT_ALTERNATE, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.maxTexture3DAlt[2]), ccuda.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_DEPTH_ALTERNATE, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.maxTextureCubemap), ccuda.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_WIDTH, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.maxTexture1DLayered[0]), ccuda.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LAYERED_WIDTH, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.maxTexture1DLayered[1]), ccuda.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LAYERED_LAYERS, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.maxTexture2DLayered[0]), ccuda.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_WIDTH, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.maxTexture2DLayered[1]), ccuda.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_HEIGHT, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.maxTexture2DLayered[2]), ccuda.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_LAYERS, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.maxTextureCubemapLayered[0]), ccuda.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_LAYERED_WIDTH, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.maxTextureCubemapLayered[1]), ccuda.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_LAYERED_LAYERS, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.maxSurface1D), ccuda.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_WIDTH, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.maxSurface2D[0]), ccuda.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_WIDTH, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.maxSurface2D[1]), ccuda.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_HEIGHT, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.maxSurface3D[0]), ccuda.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_WIDTH, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.maxSurface3D[1]), ccuda.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_HEIGHT, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.maxSurface3D[2]), ccuda.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_DEPTH, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.maxSurface1DLayered[0]), ccuda.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_LAYERED_WIDTH, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.maxSurface1DLayered[1]), ccuda.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_LAYERED_LAYERS, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.maxSurface2DLayered[0]), ccuda.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_WIDTH, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.maxSurface2DLayered[1]), ccuda.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_HEIGHT, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.maxSurface2DLayered[2]), ccuda.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_LAYERS, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.maxSurfaceCubemap), ccuda.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_WIDTH, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.maxSurfaceCubemapLayered[0]), ccuda.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_LAYERED_WIDTH, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.maxSurfaceCubemapLayered[1]), ccuda.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_LAYERED_LAYERS, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.concurrentKernels), ccuda.CU_DEVICE_ATTRIBUTE_CONCURRENT_KERNELS, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.ECCEnabled), ccuda.CU_DEVICE_ATTRIBUTE_ECC_ENABLED, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.pciBusID), ccuda.CU_DEVICE_ATTRIBUTE_PCI_BUS_ID, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.pciDeviceID), ccuda.CU_DEVICE_ATTRIBUTE_PCI_DEVICE_ID, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.pciDomainID), ccuda.CU_DEVICE_ATTRIBUTE_PCI_DOMAIN_ID, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.tccDriver), ccuda.CU_DEVICE_ATTRIBUTE_TCC_DRIVER, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.unifiedAddressing), ccuda.CU_DEVICE_ATTRIBUTE_UNIFIED_ADDRESSING, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.memoryClockRate), ccuda.CU_DEVICE_ATTRIBUTE_MEMORY_CLOCK_RATE, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.memoryBusWidth), ccuda.CU_DEVICE_ATTRIBUTE_GLOBAL_MEMORY_BUS_WIDTH, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.l2CacheSize), ccuda.CU_DEVICE_ATTRIBUTE_L2_CACHE_SIZE, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.persistingL2CacheMaxSize), ccuda.CU_DEVICE_ATTRIBUTE_MAX_PERSISTING_L2_CACHE_SIZE, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.maxThreadsPerMultiProcessor), ccuda.CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_MULTIPROCESSOR, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - cdef int surfaceAlignment - err = ccuda._cuDeviceGetAttribute(&(surfaceAlignment), ccuda.CU_DEVICE_ATTRIBUTE_SURFACE_ALIGNMENT, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - device[0].deviceProperties.surfaceAlignment = surfaceAlignment - - cdef int texturePitchAlignment - err = ccuda._cuDeviceGetAttribute(&texturePitchAlignment, ccuda.CU_DEVICE_ATTRIBUTE_TEXTURE_PITCH_ALIGNMENT, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - device[0].deviceProperties.texturePitchAlignment = texturePitchAlignment - - cdef int sharedMemPerBlock - err = ccuda._cuDeviceGetAttribute(&sharedMemPerBlock, ccuda.CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - device[0].deviceProperties.sharedMemPerBlock = sharedMemPerBlock - - cdef int sharedMemPerBlockOptin - err = ccuda._cuDeviceGetAttribute(&sharedMemPerBlockOptin, ccuda.CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK_OPTIN, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - device[0].deviceProperties.sharedMemPerBlockOptin = sharedMemPerBlockOptin - - cdef int sharedMemPerMultiprocessor - err = ccuda._cuDeviceGetAttribute(&sharedMemPerMultiprocessor, ccuda.CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_MULTIPROCESSOR, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - device[0].deviceProperties.sharedMemPerMultiprocessor = sharedMemPerMultiprocessor - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.regsPerBlock), ccuda.CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_BLOCK, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.regsPerMultiprocessor), ccuda.CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_MULTIPROCESSOR, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.warpSize), ccuda.CU_DEVICE_ATTRIBUTE_WARP_SIZE, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - cdef int memPitch - err = ccuda._cuDeviceGetAttribute(&memPitch, ccuda.CU_DEVICE_ATTRIBUTE_MAX_PITCH, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - device[0].deviceProperties.memPitch = memPitch - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.maxThreadsPerBlock), ccuda.CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_BLOCK, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.maxThreadsDim[0]), ccuda.CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_X, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.maxThreadsDim[1]), ccuda.CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Y, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.maxThreadsDim[2]), ccuda.CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Z, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.maxGridSize[0]), ccuda.CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_X, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.maxGridSize[1]), ccuda.CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Y, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.maxGridSize[2]), ccuda.CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Z, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - cdef int totalConstMem - err = ccuda._cuDeviceGetAttribute(&totalConstMem, ccuda.CU_DEVICE_ATTRIBUTE_TOTAL_CONSTANT_MEMORY, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - device[0].deviceProperties.totalConstMem = totalConstMem - - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.clockRate), ccuda.CU_DEVICE_ATTRIBUTE_CLOCK_RATE, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - cdef int textureAlignment - err = ccuda._cuDeviceGetAttribute(&textureAlignment, ccuda.CU_DEVICE_ATTRIBUTE_TEXTURE_ALIGNMENT, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - device[0].deviceProperties.textureAlignment = textureAlignment - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.streamPrioritiesSupported), ccuda.CU_DEVICE_ATTRIBUTE_STREAM_PRIORITIES_SUPPORTED, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.globalL1CacheSupported), ccuda.CU_DEVICE_ATTRIBUTE_GLOBAL_L1_CACHE_SUPPORTED, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.localL1CacheSupported), ccuda.CU_DEVICE_ATTRIBUTE_LOCAL_L1_CACHE_SUPPORTED, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.managedMemory), ccuda.CU_DEVICE_ATTRIBUTE_MANAGED_MEMORY, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.isMultiGpuBoard), ccuda.CU_DEVICE_ATTRIBUTE_MULTI_GPU_BOARD, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.multiGpuBoardGroupID), ccuda.CU_DEVICE_ATTRIBUTE_MULTI_GPU_BOARD_GROUP_ID, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.hostNativeAtomicSupported), ccuda.CU_DEVICE_ATTRIBUTE_HOST_NATIVE_ATOMIC_SUPPORTED, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.singleToDoublePrecisionPerfRatio), ccuda.CU_DEVICE_ATTRIBUTE_SINGLE_TO_DOUBLE_PRECISION_PERF_RATIO, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.pageableMemoryAccess), ccuda.CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.concurrentManagedAccess), ccuda.CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.computePreemptionSupported), ccuda.CU_DEVICE_ATTRIBUTE_COMPUTE_PREEMPTION_SUPPORTED, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.canUseHostPointerForRegisteredMem), ccuda.CU_DEVICE_ATTRIBUTE_CAN_USE_HOST_POINTER_FOR_REGISTERED_MEM, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.cooperativeLaunch), ccuda.CU_DEVICE_ATTRIBUTE_COOPERATIVE_LAUNCH, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.cooperativeMultiDeviceLaunch), ccuda.CU_DEVICE_ATTRIBUTE_COOPERATIVE_MULTI_DEVICE_LAUNCH, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.pageableMemoryAccessUsesHostPageTables), ccuda.CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS_USES_HOST_PAGE_TABLES, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.directManagedMemAccessFromHost), ccuda.CU_DEVICE_ATTRIBUTE_DIRECT_MANAGED_MEM_ACCESS_FROM_HOST, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = ccuda._cuDeviceGetUuid((&(device[0].deviceProperties.uuid)), deviceOrdinal) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.maxBlocksPerMultiProcessor), ccuda.CU_DEVICE_ATTRIBUTE_MAX_BLOCKS_PER_MULTIPROCESSOR, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - err = ccuda._cuDeviceGetAttribute(&(device[0].deviceProperties.accessPolicyMaxWindowSize), ccuda.CU_DEVICE_ATTRIBUTE_MAX_ACCESS_POLICY_WINDOW_SIZE, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - cdef int reservedSharedMemPerBlock - err = ccuda._cuDeviceGetAttribute(&reservedSharedMemPerBlock, ccuda.CU_DEVICE_ATTRIBUTE_RESERVED_SHARED_MEMORY_PER_BLOCK, (deviceOrdinal)) - if err != ccuda.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - device[0].deviceProperties.reservedSharedMemPerBlock = reservedSharedMemPerBlock - - return cudaSuccess - - -cdef cudaError_t initPrimaryContext(cudaPythonDevice *device) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - - # If we have context retained we need to check if it is not reset - cdef unsigned int version - if device[0].primaryContextRetained: - err = ccuda._cuCtxGetApiVersion(device[0].primaryContext, &version) - if err == cudaErrorDeviceUninitialized: - err = ccuda.cuDevicePrimaryCtxRelease(device[0].driverDevice) - if err != cudaSuccess: - return err - device[0].primaryContextRetained = False - elif err != cudaSuccess: - return err - - # If we don't or it is invalid we need to recreate it - if not device[0].primaryContextRetained: - err = ccuda._cuDevicePrimaryCtxRetain(&device[0].primaryContext, device[0].driverDevice) - if err != cudaSuccess: - return err - device[0].primaryContextRetained = True - return err - -cdef cudaError_t resetPrimaryContext(cudaPythonDevice* device) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - cdef unsigned int version - - err = ccuda._cuCtxGetApiVersion(device[0].primaryContext, &version) - if err == cudaSuccess: - if not device[0].primaryContextRetained: - err = ccuda._cuDevicePrimaryCtxRetain(&device[0].primaryContext, device[0].driverDevice) - if err != cudaSuccess: - return err - device[0].primaryContextRetained = True - ccuda._cuDevicePrimaryCtxReset_v2(device[0].driverDevice) - return cudaSuccess - elif err == cudaErrorDeviceUninitialized: - return cudaSuccess - else: - return err - - -cdef cudaPythonGlobal globalGetInstance(): - return m_global - - -cdef cudaError_t _setLastError(cudaError_t err) except ?cudaErrorCallRequiresNewerDriver nogil: - if err != cudaSuccess: - m_global._lastError = err - - -cdef int case_desc(const cudaChannelFormatDesc* d, int x, int y, int z, int w, int f) except ?cudaErrorCallRequiresNewerDriver nogil: - return d[0].x == x and d[0].y == y and d[0].z == z and d[0].w == w and d[0].f == f - - -cdef cudaError_t getDescInfo(const cudaChannelFormatDesc* d, int *numberOfChannels, ccuda.CUarray_format *format) except ?cudaErrorCallRequiresNewerDriver nogil: - # Check validity - if d[0].f in (cudaChannelFormatKind.cudaChannelFormatKindSigned, - cudaChannelFormatKind.cudaChannelFormatKindUnsigned): - if (d[0].x != 8) and (d[0].x != 16) and (d[0].x != 32): - return cudaErrorInvalidChannelDescriptor - elif d[0].f in (cudaChannelFormatKind.cudaChannelFormatKindFloat,): - if (d[0].x != 16) and (d[0].x != 32): - return cudaErrorInvalidChannelDescriptor - elif d[0].f in (cudaChannelFormatKind.cudaChannelFormatKindNV12,): - if (d[0].x != 8) or (d[0].y != 8) or (d[0].z != 8) or (d[0].w != 0): - return cudaErrorInvalidChannelDescriptor - elif d[0].f in (cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized8X1, - cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized8X2, - cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized8X4, - cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized8X1, - cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized8X2, - cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized8X4,): - if (d[0].x != 8): - return cudaErrorInvalidChannelDescriptor - elif d[0].f in (cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized16X1, - cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized16X2, - cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized16X4, - cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized16X1, - cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized16X2, - cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized16X4,): - if (d[0].x != 16): - return cudaErrorInvalidChannelDescriptor - elif d[0].f in (cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed1, - cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed1SRGB, - cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed2, - cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed2SRGB, - cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed3, - cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed3SRGB, - cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed4, - cudaChannelFormatKind.cudaChannelFormatKindSignedBlockCompressed4, - cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed5, - cudaChannelFormatKind.cudaChannelFormatKindSignedBlockCompressed5, - cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed7, - cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed7SRGB,): - if (d[0].x != 8): - return cudaErrorInvalidChannelDescriptor - elif d[0].f in (cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed6H, - cudaChannelFormatKind.cudaChannelFormatKindSignedBlockCompressed6H,): - if (d[0].x != 16) or (d[0].y != 16) or (d[0].z != 16) or (d[0].w != 0): - return cudaErrorInvalidChannelDescriptor - else: - return cudaErrorInvalidChannelDescriptor - - # If Y is non-zero, it must match X - # If Z is non-zero, it must match Y - # If W is non-zero, it must match Z - if (((d[0].y != 0) and (d[0].y != d[0].x)) or - ((d[0].z != 0) and (d[0].z != d[0].y)) or - ((d[0].w != 0) and (d[0].w != d[0].z))): - return cudaErrorInvalidChannelDescriptor - if case_desc(d, 8, 0, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindSigned): - numberOfChannels[0] = 1 - format[0] = ccuda.CUarray_format_enum.CU_AD_FORMAT_SIGNED_INT8 - elif case_desc(d, 8, 8, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindSigned): - numberOfChannels[0] = 2 - format[0] = ccuda.CUarray_format_enum.CU_AD_FORMAT_SIGNED_INT8 - elif case_desc(d, 8, 8, 8, 0, cudaChannelFormatKind.cudaChannelFormatKindSigned): - numberOfChannels[0] = 3 - format[0] = ccuda.CUarray_format_enum.CU_AD_FORMAT_SIGNED_INT8 - elif case_desc(d, 8, 8, 8, 8, cudaChannelFormatKind.cudaChannelFormatKindSigned): - numberOfChannels[0] = 4 - format[0] = ccuda.CUarray_format_enum.CU_AD_FORMAT_SIGNED_INT8 - elif case_desc(d, 8, 0, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindUnsigned): - numberOfChannels[0] = 1 - format[0] = ccuda.CUarray_format_enum.CU_AD_FORMAT_UNSIGNED_INT8 - elif case_desc(d, 8, 8, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindUnsigned): - numberOfChannels[0] = 2 - format[0] = ccuda.CUarray_format_enum.CU_AD_FORMAT_UNSIGNED_INT8 - elif case_desc(d, 8, 8, 8, 0, cudaChannelFormatKind.cudaChannelFormatKindUnsigned): - numberOfChannels[0] = 3 - format[0] = ccuda.CUarray_format_enum.CU_AD_FORMAT_UNSIGNED_INT8 - elif case_desc(d, 8, 8, 8, 8, cudaChannelFormatKind.cudaChannelFormatKindUnsigned): - numberOfChannels[0] = 4 - format[0] = ccuda.CUarray_format_enum.CU_AD_FORMAT_UNSIGNED_INT8 - elif case_desc(d, 16, 0, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindSigned): - numberOfChannels[0] = 1 - format[0] = ccuda.CUarray_format_enum.CU_AD_FORMAT_SIGNED_INT16 - elif case_desc(d, 16, 16, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindSigned): - numberOfChannels[0] = 2 - format[0] = ccuda.CUarray_format_enum.CU_AD_FORMAT_SIGNED_INT16 - elif case_desc(d, 16, 16, 16, 0, cudaChannelFormatKind.cudaChannelFormatKindSigned): - numberOfChannels[0] = 3 - format[0] = ccuda.CUarray_format_enum.CU_AD_FORMAT_SIGNED_INT16 - elif case_desc(d, 16, 16, 16, 16, cudaChannelFormatKind.cudaChannelFormatKindSigned): - numberOfChannels[0] = 4 - format[0] = ccuda.CUarray_format_enum.CU_AD_FORMAT_SIGNED_INT16 - elif case_desc(d, 16, 0, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindUnsigned): - numberOfChannels[0] = 1 - format[0] = ccuda.CUarray_format_enum.CU_AD_FORMAT_UNSIGNED_INT16 - elif case_desc(d, 16, 16, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindUnsigned): - numberOfChannels[0] = 2 - format[0] = ccuda.CUarray_format_enum.CU_AD_FORMAT_UNSIGNED_INT16 - elif case_desc(d, 16, 16, 16, 0, cudaChannelFormatKind.cudaChannelFormatKindUnsigned): - numberOfChannels[0] = 3 - format[0] = ccuda.CUarray_format_enum.CU_AD_FORMAT_UNSIGNED_INT16 - elif case_desc(d, 16, 16, 16, 16, cudaChannelFormatKind.cudaChannelFormatKindUnsigned): - numberOfChannels[0] = 4 - format[0] = ccuda.CUarray_format_enum.CU_AD_FORMAT_UNSIGNED_INT16 - elif case_desc(d, 32, 0, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindSigned): - numberOfChannels[0] = 1 - format[0] = ccuda.CUarray_format_enum.CU_AD_FORMAT_SIGNED_INT32 - elif case_desc(d, 32, 32, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindSigned): - numberOfChannels[0] = 2 - format[0] = ccuda.CUarray_format_enum.CU_AD_FORMAT_SIGNED_INT32 - elif case_desc(d, 32, 32, 32, 0, cudaChannelFormatKind.cudaChannelFormatKindSigned): - numberOfChannels[0] = 3 - format[0] = ccuda.CUarray_format_enum.CU_AD_FORMAT_SIGNED_INT32 - elif case_desc(d, 32, 32, 32, 32, cudaChannelFormatKind.cudaChannelFormatKindSigned): - numberOfChannels[0] = 4 - format[0] = ccuda.CUarray_format_enum.CU_AD_FORMAT_SIGNED_INT32 - elif case_desc(d, 32, 0, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindUnsigned): - numberOfChannels[0] = 1 - format[0] = ccuda.CUarray_format_enum.CU_AD_FORMAT_UNSIGNED_INT32 - elif case_desc(d, 32, 32, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindUnsigned): - numberOfChannels[0] = 2 - format[0] = ccuda.CUarray_format_enum.CU_AD_FORMAT_UNSIGNED_INT32 - elif case_desc(d, 32, 32, 32, 0, cudaChannelFormatKind.cudaChannelFormatKindUnsigned): - numberOfChannels[0] = 3 - format[0] = ccuda.CUarray_format_enum.CU_AD_FORMAT_UNSIGNED_INT32 - elif case_desc(d, 32, 32, 32, 32, cudaChannelFormatKind.cudaChannelFormatKindUnsigned): - numberOfChannels[0] = 4 - format[0] = ccuda.CUarray_format_enum.CU_AD_FORMAT_UNSIGNED_INT32 - elif case_desc(d, 16, 0, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindFloat): - numberOfChannels[0] = 1 - format[0] = ccuda.CUarray_format_enum.CU_AD_FORMAT_HALF - elif case_desc(d, 16, 16, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindFloat): - numberOfChannels[0] = 2 - format[0] = ccuda.CUarray_format_enum.CU_AD_FORMAT_HALF - elif case_desc(d, 16, 16, 16, 0, cudaChannelFormatKind.cudaChannelFormatKindFloat): - numberOfChannels[0] = 3 - format[0] = ccuda.CUarray_format_enum.CU_AD_FORMAT_HALF - elif case_desc(d, 16, 16, 16, 16, cudaChannelFormatKind.cudaChannelFormatKindFloat): - numberOfChannels[0] = 4 - format[0] = ccuda.CUarray_format_enum.CU_AD_FORMAT_HALF - elif case_desc(d, 32, 0, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindFloat): - numberOfChannels[0] = 1 - format[0] = ccuda.CUarray_format_enum.CU_AD_FORMAT_FLOAT - elif case_desc(d, 32, 32, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindFloat): - numberOfChannels[0] = 2 - format[0] = ccuda.CUarray_format_enum.CU_AD_FORMAT_FLOAT - elif case_desc(d, 32, 32, 32, 0, cudaChannelFormatKind.cudaChannelFormatKindFloat): - numberOfChannels[0] = 3 - format[0] = ccuda.CUarray_format_enum.CU_AD_FORMAT_FLOAT - elif case_desc(d, 32, 32, 32, 32, cudaChannelFormatKind.cudaChannelFormatKindFloat): - numberOfChannels[0] = 4 - format[0] = ccuda.CUarray_format_enum.CU_AD_FORMAT_FLOAT - elif case_desc(d, 8, 8, 8, 0, cudaChannelFormatKind.cudaChannelFormatKindNV12): - numberOfChannels[0] = 3 - format[0] = ccuda.CUarray_format_enum.CU_AD_FORMAT_NV12 - elif case_desc(d, 8, 8, 8, 8, cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed1): - numberOfChannels[0] = 4 - format[0] = ccuda.CUarray_format_enum.CU_AD_FORMAT_BC1_UNORM - elif case_desc(d, 8, 8, 8, 8, cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed1SRGB): - numberOfChannels[0] = 4 - format[0] = ccuda.CUarray_format_enum.CU_AD_FORMAT_BC1_UNORM_SRGB - elif case_desc(d, 8, 8, 8, 8, cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed2): - numberOfChannels[0] = 4 - format[0] = ccuda.CUarray_format_enum.CU_AD_FORMAT_BC2_UNORM - elif case_desc(d, 8, 8, 8, 8, cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed2SRGB): - numberOfChannels[0] = 4 - format[0] = ccuda.CUarray_format_enum.CU_AD_FORMAT_BC2_UNORM_SRGB - elif case_desc(d, 8, 8, 8, 8, cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed3): - numberOfChannels[0] = 4 - format[0] = ccuda.CUarray_format_enum.CU_AD_FORMAT_BC3_UNORM - elif case_desc(d, 8, 8, 8, 8, cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed3SRGB): - numberOfChannels[0] = 4 - format[0] = ccuda.CUarray_format_enum.CU_AD_FORMAT_BC3_UNORM_SRGB - elif case_desc(d, 8, 0, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed4): - numberOfChannels[0] = 1 - format[0] = ccuda.CUarray_format_enum.CU_AD_FORMAT_BC4_UNORM - elif case_desc(d, 8, 0, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindSignedBlockCompressed4): - numberOfChannels[0] = 1 - format[0] = ccuda.CUarray_format_enum.CU_AD_FORMAT_BC4_SNORM - elif case_desc(d, 8, 8, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed5): - numberOfChannels[0] = 2 - format[0] = ccuda.CUarray_format_enum.CU_AD_FORMAT_BC5_UNORM - elif case_desc(d, 8, 8, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindSignedBlockCompressed5): - numberOfChannels[0] = 2 - format[0] = ccuda.CUarray_format_enum.CU_AD_FORMAT_BC5_SNORM - elif case_desc(d, 16, 16, 16, 0, cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed6H): - numberOfChannels[0] = 3 - format[0] = ccuda.CUarray_format_enum.CU_AD_FORMAT_BC6H_UF16 - elif case_desc(d, 16, 16, 16, 0, cudaChannelFormatKind.cudaChannelFormatKindSignedBlockCompressed6H): - numberOfChannels[0] = 3 - format[0] = ccuda.CUarray_format_enum.CU_AD_FORMAT_BC6H_SF16 - elif case_desc(d, 8, 8, 8, 8, cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed7): - numberOfChannels[0] = 4 - format[0] = ccuda.CUarray_format_enum.CU_AD_FORMAT_BC7_UNORM - elif case_desc(d, 8, 8, 8, 8, cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed7SRGB): - numberOfChannels[0] = 4 - format[0] = ccuda.CUarray_format_enum.CU_AD_FORMAT_BC7_UNORM_SRGB - else: - return cudaErrorInvalidChannelDescriptor - - if d[0].f in (cudaChannelFormatKind.cudaChannelFormatKindNV12, - cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed6H, - cudaChannelFormatKind.cudaChannelFormatKindSignedBlockCompressed6H,): - if numberOfChannels[0] != 3: - return cudaErrorInvalidChannelDescriptor - else: - if (numberOfChannels[0] != 1) and (numberOfChannels[0] != 2) and (numberOfChannels[0] != 4): - return cudaErrorInvalidChannelDescriptor - return cudaSuccess - - -@cython.show_performance_hints(False) -cdef void cudaStreamRtCallbackWrapper(ccuda.CUstream stream, ccuda.CUresult status, void *data) nogil: - cdef cudaStreamCallbackData *cbData = data - cdef cudaError_t err = status - with gil: - cbData.callback(stream, err, cbData.userData) - free(cbData) - - -cdef cudaError_t streamAddCallbackCommon( - cudaStream_t stream, - cudaStreamCallback_t callback, - void *userData, - unsigned int flags -) except ?cudaErrorCallRequiresNewerDriver nogil: - if callback == NULL: - return cudaErrorInvalidValue - - cdef cudaStreamCallbackData *cbData = NULL - cdef cudaError_t err = cudaSuccess - cbData = malloc(sizeof(cbData[0])) - - if cbData == NULL: - return cudaErrorMemoryAllocation - - cbData.callback = callback - cbData.userData = userData - err = ccuda._cuStreamAddCallback(stream, cudaStreamRtCallbackWrapper, cbData, flags) - if err != cudaSuccess: - free(cbData) - return err - - -@cython.show_performance_hints(False) -cdef void cudaStreamRtHostCallbackWrapper(void *data) nogil: - cdef cudaStreamHostCallbackData *cbData = data - with gil: - cbData.callback(cbData.userData) - free(cbData) - - -cdef cudaError_t streamAddHostCallbackCommon( - cudaStream_t stream, - cudaHostFn_t callback, - void *userData -) except ?cudaErrorCallRequiresNewerDriver nogil: - if callback == NULL: - return cudaErrorInvalidValue - - cdef cudaStreamHostCallbackData *cbData = NULL - cdef cudaError_t err = cudaSuccess - cbData = malloc(sizeof(cbData[0])) - - if cbData == NULL: - return cudaErrorMemoryAllocation - - cbData.callback = callback - cbData.userData = userData - err = ccuda._cuLaunchHostFunc(stream, cudaStreamRtHostCallbackWrapper, cbData) - if err != cudaSuccess: - free(cbData) - return err - - -cdef cudaError_t toRuntimeStreamCaptureStatus(ccuda.CUstreamCaptureStatus driverCaptureStatus, cudaStreamCaptureStatus *runtimeStatus) except ?cudaErrorCallRequiresNewerDriver nogil: - if driverCaptureStatus == ccuda.CUstreamCaptureStatus_enum.CU_STREAM_CAPTURE_STATUS_NONE: - runtimeStatus[0] = cudaStreamCaptureStatus.cudaStreamCaptureStatusNone - elif driverCaptureStatus == ccuda.CUstreamCaptureStatus_enum.CU_STREAM_CAPTURE_STATUS_ACTIVE: - runtimeStatus[0] = cudaStreamCaptureStatus.cudaStreamCaptureStatusActive - elif driverCaptureStatus == ccuda.CUstreamCaptureStatus_enum.CU_STREAM_CAPTURE_STATUS_INVALIDATED: - runtimeStatus[0] = cudaStreamCaptureStatus.cudaStreamCaptureStatusInvalidated - else: - return cudaErrorUnknown - return cudaSuccess - - -cdef cudaError_t streamGetCaptureInfoCommon( - cudaStream_t stream, - cudaStreamCaptureStatus* captureStatus_out, - unsigned long long *id_out, - cudaGraph_t *graph_out, - const cudaGraphNode_t **dependencies_out, - size_t *numDependencies_out) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - - if captureStatus_out == NULL: - return cudaErrorInvalidValue - - cdef ccuda.CUstreamCaptureStatus driverCaptureStatus - - err = ccuda._cuStreamGetCaptureInfo_v2(stream, &driverCaptureStatus, id_out, - graph_out, dependencies_out, numDependencies_out) - if err != cudaSuccess: - return err - - return toRuntimeStreamCaptureStatus(driverCaptureStatus, captureStatus_out) - - -cdef cudaError_t streamGetCaptureInfoCommon_v3( - cudaStream_t stream, - cudaStreamCaptureStatus* captureStatus_out, - unsigned long long *id_out, - cudaGraph_t *graph_out, - const cudaGraphNode_t **dependencies_out, - const cudaGraphEdgeData** edgeData_out, - size_t *numDependencies_out) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - - if captureStatus_out == NULL: - return cudaErrorInvalidValue - - cdef ccuda.CUstreamCaptureStatus driverCaptureStatus - - err = ccuda._cuStreamGetCaptureInfo_v3(stream, &driverCaptureStatus, id_out, - graph_out, dependencies_out, edgeData_out, numDependencies_out) - if err != cudaSuccess: - return err - - return toRuntimeStreamCaptureStatus(driverCaptureStatus, captureStatus_out) - - -cdef ccuda.CUDA_MEMCPY3D_v2 memCopy3DInit(ccuda.CUmemorytype_enum dstType, ccuda.CUmemorytype_enum srcType) noexcept nogil: - cdef ccuda.CUDA_MEMCPY3D_v2 cp - memset(&cp, 0, sizeof(cp)) - cp.dstMemoryType = dstType - cp.srcMemoryType = srcType - cp.WidthInBytes = 0 - cp.Height = 1 - cp.Depth = 1 - return cp - - -cdef ccuda.CUDA_MEMCPY2D_v2 memCopy2DInit(ccuda.CUmemorytype_enum dstType, ccuda.CUmemorytype_enum srcType) noexcept nogil: - cdef ccuda.CUDA_MEMCPY2D_v2 cp - memset(&cp, 0, sizeof(cp)) - cp.dstMemoryType = dstType - cp.srcMemoryType = srcType - cp.WidthInBytes = 0 - cp.Height = 1 - return cp - - -cdef cudaError_t bytesPerElement(size_t *bytes, int numberOfChannels, ccuda.CUarray_format format) except ?cudaErrorCallRequiresNewerDriver nogil: - if format in (ccuda.CU_AD_FORMAT_FLOAT, - ccuda.CU_AD_FORMAT_UNSIGNED_INT32, - ccuda.CU_AD_FORMAT_SIGNED_INT32): - bytes[0] = numberOfChannels * 4 - return cudaSuccess - elif format in (ccuda.CU_AD_FORMAT_HALF, - ccuda.CU_AD_FORMAT_SIGNED_INT16, - ccuda.CU_AD_FORMAT_UNSIGNED_INT16): - bytes[0] = numberOfChannels * 2 - return cudaSuccess - elif format in (ccuda.CU_AD_FORMAT_SIGNED_INT8, - ccuda.CU_AD_FORMAT_UNSIGNED_INT8, - ccuda.CU_AD_FORMAT_NV12): - bytes[0] = numberOfChannels - return cudaSuccess - elif format in (ccuda.CU_AD_FORMAT_SNORM_INT8X1, - ccuda.CU_AD_FORMAT_UNORM_INT8X1): - bytes[0] = 1 - return cudaSuccess - elif format in (ccuda.CU_AD_FORMAT_SNORM_INT8X2, - ccuda.CU_AD_FORMAT_UNORM_INT8X2, - ccuda.CU_AD_FORMAT_SNORM_INT16X1, - ccuda.CU_AD_FORMAT_UNORM_INT16X1): - bytes[0] = 2 - return cudaSuccess - elif format in (ccuda.CU_AD_FORMAT_SNORM_INT8X4, - ccuda.CU_AD_FORMAT_UNORM_INT8X4, - ccuda.CU_AD_FORMAT_SNORM_INT16X2, - ccuda.CU_AD_FORMAT_UNORM_INT16X2): - bytes[0] = 4 - return cudaSuccess - elif format in (ccuda.CU_AD_FORMAT_SNORM_INT16X4, - ccuda.CU_AD_FORMAT_UNORM_INT16X4): - bytes[0] = 8 - return cudaSuccess - elif format in (ccuda.CU_AD_FORMAT_BC2_UNORM, - ccuda.CU_AD_FORMAT_BC2_UNORM_SRGB, - ccuda.CU_AD_FORMAT_BC3_UNORM, - ccuda.CU_AD_FORMAT_BC3_UNORM_SRGB, - ccuda.CU_AD_FORMAT_BC5_UNORM, - ccuda.CU_AD_FORMAT_BC5_SNORM, - ccuda.CU_AD_FORMAT_BC6H_UF16, - ccuda.CU_AD_FORMAT_BC6H_SF16, - ccuda.CU_AD_FORMAT_BC7_UNORM, - ccuda.CU_AD_FORMAT_BC7_UNORM_SRGB): - bytes[0] = 16 - return cudaSuccess - return cudaErrorInvalidChannelDescriptor - - -cdef cudaError_t getChannelFormatDescFromDriverDesc( - cudaChannelFormatDesc* pRuntimeDesc, size_t* pDepth, size_t* pHeight, size_t* pWidth, - const ccuda.CUDA_ARRAY3D_DESCRIPTOR_v2* pDriverDesc) except ?cudaErrorCallRequiresNewerDriver nogil: - - cdef int channel_size = 0 - if pDriverDesc[0].Format == ccuda.CU_AD_FORMAT_UNSIGNED_INT8: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsigned - channel_size = 8 - elif pDriverDesc[0].Format == ccuda.CU_AD_FORMAT_UNSIGNED_INT16: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsigned - channel_size = 16 - elif pDriverDesc[0].Format == ccuda.CU_AD_FORMAT_UNSIGNED_INT32: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsigned - channel_size = 32 - elif pDriverDesc[0].Format == ccuda.CU_AD_FORMAT_SIGNED_INT8: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSigned - channel_size = 8 - elif pDriverDesc[0].Format == ccuda.CU_AD_FORMAT_SIGNED_INT16: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSigned - channel_size = 16 - elif pDriverDesc[0].Format == ccuda.CU_AD_FORMAT_SIGNED_INT32: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSigned - channel_size = 32 - elif pDriverDesc[0].Format == ccuda.CU_AD_FORMAT_HALF: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindFloat - channel_size = 16 - elif pDriverDesc[0].Format == ccuda.CU_AD_FORMAT_FLOAT: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindFloat - channel_size = 32 - elif pDriverDesc[0].Format == ccuda.CU_AD_FORMAT_NV12: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindNV12 - channel_size = 8 - elif pDriverDesc[0].Format == ccuda.CU_AD_FORMAT_UNORM_INT8X1: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized8X1 - channel_size = 8 - elif pDriverDesc[0].Format == ccuda.CU_AD_FORMAT_UNORM_INT8X2: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized8X2 - channel_size = 8 - elif pDriverDesc[0].Format == ccuda.CU_AD_FORMAT_UNORM_INT8X4: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized8X4 - channel_size = 8 - elif pDriverDesc[0].Format == ccuda.CU_AD_FORMAT_SNORM_INT8X1: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized8X1 - channel_size = 8 - elif pDriverDesc[0].Format == ccuda.CU_AD_FORMAT_SNORM_INT8X2: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized8X2 - channel_size = 8 - elif pDriverDesc[0].Format == ccuda.CU_AD_FORMAT_SNORM_INT8X4: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized8X4 - channel_size = 8 - elif pDriverDesc[0].Format == ccuda.CU_AD_FORMAT_UNORM_INT16X1: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized16X1 - channel_size = 16 - elif pDriverDesc[0].Format == ccuda.CU_AD_FORMAT_UNORM_INT16X2: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized16X2 - channel_size = 16 - elif pDriverDesc[0].Format == ccuda.CU_AD_FORMAT_UNORM_INT16X4: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized16X4 - channel_size = 16 - elif pDriverDesc[0].Format == ccuda.CU_AD_FORMAT_SNORM_INT16X1: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized16X1 - channel_size = 16 - elif pDriverDesc[0].Format == ccuda.CU_AD_FORMAT_SNORM_INT16X2: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized16X2 - channel_size = 16 - elif pDriverDesc[0].Format == ccuda.CU_AD_FORMAT_SNORM_INT16X4: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized16X4 - channel_size = 16 - elif pDriverDesc[0].Format == ccuda.CU_AD_FORMAT_BC1_UNORM: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed1 - channel_size = 8 - elif pDriverDesc[0].Format == ccuda.CU_AD_FORMAT_BC1_UNORM_SRGB: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed1SRGB - channel_size = 8 - elif pDriverDesc[0].Format == ccuda.CU_AD_FORMAT_BC2_UNORM: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed2 - channel_size = 8 - elif pDriverDesc[0].Format == ccuda.CU_AD_FORMAT_BC2_UNORM_SRGB: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed2SRGB - channel_size = 8 - elif pDriverDesc[0].Format == ccuda.CU_AD_FORMAT_BC3_UNORM: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed3 - channel_size = 8 - elif pDriverDesc[0].Format == ccuda.CU_AD_FORMAT_BC3_UNORM_SRGB: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed3SRGB - channel_size = 8 - elif pDriverDesc[0].Format == ccuda.CU_AD_FORMAT_BC4_UNORM: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed4 - channel_size = 8 - elif pDriverDesc[0].Format == ccuda.CU_AD_FORMAT_BC4_SNORM: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSignedBlockCompressed4 - channel_size = 8 - elif pDriverDesc[0].Format == ccuda.CU_AD_FORMAT_BC5_UNORM: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed5 - channel_size = 8 - elif pDriverDesc[0].Format == ccuda.CU_AD_FORMAT_BC5_SNORM: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSignedBlockCompressed5 - channel_size = 8 - elif pDriverDesc[0].Format == ccuda.CU_AD_FORMAT_BC6H_UF16: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed6H - channel_size = 16 - elif pDriverDesc[0].Format == ccuda.CU_AD_FORMAT_BC6H_SF16: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSignedBlockCompressed6H - channel_size = 16 - elif pDriverDesc[0].Format == ccuda.CU_AD_FORMAT_BC7_UNORM: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed7 - channel_size = 8 - elif pDriverDesc[0].Format == ccuda.CU_AD_FORMAT_BC7_UNORM_SRGB: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed7SRGB - channel_size = 8 - else: - return cudaErrorInvalidChannelDescriptor - - # populate bits per channel - pRuntimeDesc[0].x = 0 - pRuntimeDesc[0].y = 0 - pRuntimeDesc[0].z = 0 - pRuntimeDesc[0].w = 0 - - if pDriverDesc[0].NumChannels >= 4: - pRuntimeDesc[0].w = channel_size - if pDriverDesc[0].NumChannels >= 3: - pRuntimeDesc[0].z = channel_size - if pDriverDesc[0].NumChannels >= 2: - pRuntimeDesc[0].y = channel_size - if pDriverDesc[0].NumChannels >= 1: - pRuntimeDesc[0].x = channel_size - - if pDriverDesc[0].NumChannels not in (4, 3, 2, 1): - return cudaErrorInvalidChannelDescriptor - - # populate dimensions - if pDepth != NULL: - pDepth[0] = pDriverDesc[0].Depth - if pHeight != NULL: - pHeight[0] = pDriverDesc[0].Height - if pWidth != NULL: - pWidth[0] = pDriverDesc[0].Width - return cudaSuccess - - -cdef cudaError_t getArrayBlockExtent(cudaExtent *blockExtent, ccuda.CUarray_format format) except ?cudaErrorCallRequiresNewerDriver nogil: - if format in (ccuda.CU_AD_FORMAT_FLOAT, - ccuda.CU_AD_FORMAT_UNSIGNED_INT32, - ccuda.CU_AD_FORMAT_SIGNED_INT32, - ccuda.CU_AD_FORMAT_HALF, - ccuda.CU_AD_FORMAT_SIGNED_INT16, - ccuda.CU_AD_FORMAT_UNSIGNED_INT16, - ccuda.CU_AD_FORMAT_SIGNED_INT8, - ccuda.CU_AD_FORMAT_UNSIGNED_INT8, - ccuda.CU_AD_FORMAT_NV12, - ccuda.CU_AD_FORMAT_SNORM_INT8X1, - ccuda.CU_AD_FORMAT_UNORM_INT8X1, - ccuda.CU_AD_FORMAT_SNORM_INT8X2, - ccuda.CU_AD_FORMAT_UNORM_INT8X2, - ccuda.CU_AD_FORMAT_SNORM_INT16X1, - ccuda.CU_AD_FORMAT_UNORM_INT16X1, - ccuda.CU_AD_FORMAT_SNORM_INT8X4, - ccuda.CU_AD_FORMAT_UNORM_INT8X4, - ccuda.CU_AD_FORMAT_SNORM_INT16X2, - ccuda.CU_AD_FORMAT_UNORM_INT16X2, - ccuda.CU_AD_FORMAT_SNORM_INT16X4, - ccuda.CU_AD_FORMAT_UNORM_INT16X4): - blockExtent[0].width = 1 - blockExtent[0].height = 1 - blockExtent[0].depth = 1 - elif format in (ccuda.CU_AD_FORMAT_BC1_UNORM, - ccuda.CU_AD_FORMAT_BC1_UNORM_SRGB, - ccuda.CU_AD_FORMAT_BC4_UNORM, - ccuda.CU_AD_FORMAT_BC4_SNORM, - ccuda.CU_AD_FORMAT_BC2_UNORM, - ccuda.CU_AD_FORMAT_BC2_UNORM_SRGB, - ccuda.CU_AD_FORMAT_BC3_UNORM, - ccuda.CU_AD_FORMAT_BC3_UNORM_SRGB, - ccuda.CU_AD_FORMAT_BC5_UNORM, - ccuda.CU_AD_FORMAT_BC5_SNORM, - ccuda.CU_AD_FORMAT_BC6H_UF16, - ccuda.CU_AD_FORMAT_BC6H_SF16, - ccuda.CU_AD_FORMAT_BC7_UNORM, - ccuda.CU_AD_FORMAT_BC7_UNORM_SRGB): - blockExtent[0].width = 4 - blockExtent[0].height = 4 - blockExtent[0].depth = 1 - else: - return cudaErrorInvalidChannelDescriptor - return cudaSuccess - - -cdef cudaError_t getLocalState(cudaArrayLocalState *state, cudaArray_const_t thisArray) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaArrayLocalState arrayState - memset(&arrayState, 0, sizeof(arrayState)) - arrayState.array = thisArray - - cdef cudaExtent compBlockExtent - compBlockExtent.width = 1 - compBlockExtent.height = 1 - compBlockExtent.depth = 1 - cdef ccuda.CUDA_ARRAY3D_DESCRIPTOR_v2 driverDesc - memset(&driverDesc, 0, sizeof(driverDesc)) - err = ccuda._cuArray3DGetDescriptor_v2(&driverDesc, arrayState.array) - if err != cudaSuccess: - return err - err = getChannelFormatDescFromDriverDesc(&arrayState.desc, &arrayState.depth, &arrayState.height, &arrayState.width, &driverDesc) - if err != cudaSuccess: - return err - err = bytesPerElement(&arrayState.elementSize, driverDesc.NumChannels, driverDesc.Format) - if err != cudaSuccess: - return err - err = getArrayBlockExtent(&compBlockExtent, driverDesc.Format) - if err != cudaSuccess: - return err - arrayState.widthInBytes = ((arrayState.width + compBlockExtent.width - 1) / compBlockExtent.width) * arrayState.elementSize - - state[0] = arrayState - return cudaSuccess - - -cdef cudaError_t copyFromHost2D(cudaArray_const_t thisArray, size_t hOffset, size_t wOffset, const char *src, size_t spitch, size_t width, size_t height, ccuda.CUstream stream, bool async) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - cdef cudaArrayLocalState arrayState - memset(&arrayState, 0, sizeof(arrayState)) - err = getLocalState(&arrayState, thisArray) - if err != cudaSuccess: - return err - cdef ccuda.CUDA_MEMCPY3D_v2 cp = memCopy3DInit(ccuda.CUmemorytype_enum.CU_MEMORYTYPE_ARRAY, ccuda.CUmemorytype_enum.CU_MEMORYTYPE_HOST) - - cp.dstArray = arrayState.array - cp.dstXInBytes = wOffset - cp.dstY = hOffset - - cp.srcHost = src - cp.srcPitch = spitch - cp.srcXInBytes = 0 - cp.srcY = 0 - - cp.Height = height - cp.WidthInBytes = width - - err = driverMemcpy3D(&cp, stream, async) - return err - - -cdef cudaError_t copyFromDevice2D(ccuda.CUmemorytype type, cudaArray_const_t thisArray, size_t hOffset, size_t wOffset, const char *src, size_t srcOffset, - size_t spitch, size_t width, size_t height, ccuda.CUstream stream, bool async) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - cdef cudaArrayLocalState arrayState - memset(&arrayState, 0, sizeof(arrayState)) - err = getLocalState(&arrayState, thisArray) - if err != cudaSuccess: - return err - cdef ccuda.CUDA_MEMCPY3D_v2 cp = memCopy3DInit(ccuda.CUmemorytype_enum.CU_MEMORYTYPE_ARRAY, type) - - cp.dstArray = arrayState.array - cp.dstXInBytes = wOffset - cp.dstY = hOffset - - cp.srcDevice = src - cp.srcPitch = spitch - cp.srcXInBytes = srcOffset % spitch - cp.srcY = (srcOffset / spitch) - - cp.Height = height - cp.WidthInBytes = width - - err = driverMemcpy3D(&cp, stream, async) - if err != cudaSuccess: - return err - - return cudaSuccess - - -cdef cudaError_t copyToHost2D(cudaArray_const_t thisArray, size_t hOffset, size_t wOffset, char *dst, size_t dpitch, size_t width, - size_t height, ccuda.CUstream stream, bool async) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaArrayLocalState arrayState - cdef cudaError_t err = cudaSuccess - memset(&arrayState, 0, sizeof(arrayState)) - err = getLocalState(&arrayState, thisArray) - if err != cudaSuccess: - return err - cdef ccuda.CUDA_MEMCPY3D_v2 cp = memCopy3DInit(ccuda.CUmemorytype_enum.CU_MEMORYTYPE_HOST, ccuda.CUmemorytype_enum.CU_MEMORYTYPE_ARRAY) - - cp.dstHost = dst - cp.dstPitch = dpitch - cp.dstXInBytes = 0 - cp.dstY = 0 - - cp.srcArray = arrayState.array - cp.srcXInBytes = wOffset - cp.srcY = hOffset - - cp.Height = height - cp.WidthInBytes = width - - err = driverMemcpy3D(&cp, stream, async) - if err != cudaSuccess: - return err - - return cudaSuccess - - -cdef cudaError_t copyToDevice2D(ccuda.CUmemorytype type, cudaArray_const_t thisArray, size_t hOffset, size_t wOffset, const char *dst, size_t dstOffset, size_t dpitch, - size_t width, size_t height, ccuda.CUstream stream, bool async) except ?cudaErrorCallRequiresNewerDriver nogil: - - cdef cudaArrayLocalState arrayState - cdef cudaError_t err = cudaSuccess - memset(&arrayState, 0, sizeof(arrayState)) - err = getLocalState(&arrayState, thisArray) - if err != cudaSuccess: - return err - cdef ccuda.CUDA_MEMCPY3D_v2 cp = memCopy3DInit(type, ccuda.CUmemorytype_enum.CU_MEMORYTYPE_ARRAY) - - cp.dstDevice = dst - cp.dstPitch = dpitch - cp.dstXInBytes = dstOffset % dpitch - cp.dstY = (dstOffset / dpitch) - - cp.srcArray = arrayState.array - cp.srcXInBytes = wOffset - cp.srcY = hOffset - - cp.Height = height - cp.WidthInBytes = width - - err = driverMemcpy3D(&cp, stream, async) - if err != cudaSuccess: - return err - - return cudaSuccess - - -cdef cudaError_t copyToArray2D(cudaArray_const_t thisArray, size_t hOffsetSrc, size_t wOffsetSrc, cudaArray_t dst, - size_t hOffsetDst, size_t wOffsetDst, size_t width, size_t height) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaArrayLocalState arrayState - cdef cudaError_t err = cudaSuccess - memset(&arrayState, 0, sizeof(arrayState)) - err = getLocalState(&arrayState, thisArray) - if err != cudaSuccess: - return err - cdef ccuda.CUDA_MEMCPY3D_v2 cp = memCopy3DInit(ccuda.CUmemorytype_enum.CU_MEMORYTYPE_ARRAY, ccuda.CUmemorytype_enum.CU_MEMORYTYPE_ARRAY) - - cp.dstArray = dst - cp.dstXInBytes = wOffsetDst - cp.dstY = hOffsetDst - - cp.srcArray = arrayState.array - cp.srcXInBytes = wOffsetSrc - cp.srcY = hOffsetSrc - - cp.Height = height - cp.WidthInBytes = width - - err = driverMemcpy3D(&cp, NULL, False) - if err != cudaSuccess: - return err - - return cudaSuccess - - -cdef cudaError_t copyToArray(cudaArray_const_t thisArray, size_t hOffsetSrc, size_t wOffsetSrc, cudaArray_t dst, size_t hOffsetDst, - size_t wOffsetDst, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef void *tmp - cdef cudaError_t err = cudaSuccess - err = cudaMalloc(&tmp, count) - if err != cudaSuccess: - return err - - err = cudaMemcpyFromArray(tmp, thisArray, wOffsetSrc, hOffsetSrc, count, cudaMemcpyDeviceToDevice) - if err != cudaSuccess: - return err - err = cudaMemcpyToArray(dst, wOffsetDst, hOffsetDst, tmp, count, cudaMemcpyDeviceToDevice) - if err != cudaSuccess: - return err - err = cudaFree(tmp) - if err != cudaSuccess: - return err - return cudaSuccess - - -cdef cudaError_t memcpyArrayToArray(cudaArray_t dst, size_t hOffsetDst, size_t wOffsetDst, - cudaArray_const_t src, size_t hOffsetSrc, size_t wOffsetSrc, - size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: - if count == 0: - return cudaSuccess - if kind != cudaMemcpyDeviceToDevice and kind != cudaMemcpyDefault: - return cudaErrorInvalidMemcpyDirection - return copyToArray(src, hOffsetSrc, wOffsetSrc, dst, hOffsetDst, wOffsetDst, count) - - -cdef cudaError_t getChannelDesc(cudaArray_const_t thisArray, cudaChannelFormatDesc *outDesc) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaArrayLocalState arrayState - cdef cudaError_t err = cudaSuccess - memset(&arrayState, 0, sizeof(arrayState)) - err = getLocalState(&arrayState, thisArray) - if err != cudaSuccess: - return err - outDesc[0] = arrayState.desc - return cudaSuccess - - -cdef cudaError_t getFormat(cudaArray_const_t thisArray, int &numberOfChannels, ccuda.CUarray_format *format) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaArrayLocalState arrayState - cdef cudaError_t err = cudaSuccess - memset(&arrayState, 0, sizeof(arrayState)) - err = getLocalState(&arrayState, thisArray) - if err != cudaSuccess: - return err - return getDescInfo(&arrayState.desc, &numberOfChannels, format) - - -cdef cudaError_t getDriverResDescFromResDesc(ccuda.CUDA_RESOURCE_DESC *rdDst, const cudaResourceDesc *rdSrc, - ccuda.CUDA_TEXTURE_DESC *tdDst, const cudaTextureDesc *tdSrc, - ccuda.CUDA_RESOURCE_VIEW_DESC *rvdDst, const cudaResourceViewDesc *rvdSrc) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef int i = 0 - cdef int numChannels = 0 - cdef ccuda.CUarray_format format - cdef ccuda.CUarray hArray = NULL - cdef cudaError_t err = cudaSuccess - i = 0 - - memset(rdDst, 0, sizeof(rdDst[0])) - - if rdSrc[0].resType == cudaResourceType.cudaResourceTypeArray: - rdDst[0].resType = ccuda.CUresourcetype_enum.CU_RESOURCE_TYPE_ARRAY - rdDst[0].res.array.hArray = rdSrc[0].res.array.array - err = getFormat(rdSrc[0].res.array.array, numChannels, &format) - if err != cudaSuccess: - return err - elif rdSrc[0].resType == cudaResourceType.cudaResourceTypeMipmappedArray: - rdDst[0].resType = ccuda.CUresourcetype_enum.CU_RESOURCE_TYPE_MIPMAPPED_ARRAY - rdDst[0].res.mipmap.hMipmappedArray = rdSrc[0].res.mipmap.mipmap - err = ccuda._cuMipmappedArrayGetLevel(&hArray, rdDst[0].res.mipmap.hMipmappedArray, 0) - if err != cudaSuccess: - return err - err = getFormat(hArray, numChannels, &format) - if err != cudaSuccess: - return err - elif rdSrc[0].resType == cudaResourceType.cudaResourceTypeLinear: - rdDst[0].resType = ccuda.CUresourcetype_enum.CU_RESOURCE_TYPE_LINEAR - rdDst[0].res.linear.devPtr = rdSrc[0].res.linear.devPtr - rdDst[0].res.linear.sizeInBytes = rdSrc[0].res.linear.sizeInBytes - err = getDescInfo(&rdSrc[0].res.linear.desc, &numChannels, &format) - if err != cudaSuccess: - return err - rdDst[0].res.linear.format = format - rdDst[0].res.linear.numChannels = numChannels - elif rdSrc[0].resType == cudaResourceType.cudaResourceTypePitch2D: - rdDst[0].resType = ccuda.CUresourcetype_enum.CU_RESOURCE_TYPE_PITCH2D - rdDst[0].res.pitch2D.devPtr = rdSrc[0].res.pitch2D.devPtr - rdDst[0].res.pitch2D.pitchInBytes = rdSrc[0].res.pitch2D.pitchInBytes - rdDst[0].res.pitch2D.width = rdSrc[0].res.pitch2D.width - rdDst[0].res.pitch2D.height = rdSrc[0].res.pitch2D.height - err = getDescInfo(&rdSrc[0].res.linear.desc, &numChannels, &format) - if err != cudaSuccess: - return err - rdDst[0].res.pitch2D.format = format - rdDst[0].res.pitch2D.numChannels = numChannels - else: - return cudaErrorInvalidValue - - - rdDst[0].flags = 0 - - if tdDst and tdSrc: - memset(tdDst, 0, sizeof(tdDst[0])) - - while (i < 3): - tdDst[0].addressMode[i] = tdSrc[0].addressMode[i] - i += 1 - - tdDst[0].filterMode = tdSrc[0].filterMode - tdDst[0].mipmapFilterMode = tdSrc[0].mipmapFilterMode - tdDst[0].mipmapLevelBias = tdSrc[0].mipmapLevelBias - tdDst[0].minMipmapLevelClamp = tdSrc[0].minMipmapLevelClamp - tdDst[0].maxMipmapLevelClamp = tdSrc[0].maxMipmapLevelClamp - tdDst[0].maxAnisotropy = tdSrc[0].maxAnisotropy - i = 0 - while (i < 4): - tdDst[0].borderColor[i] = tdSrc[0].borderColor[i] - i += 1 - - if tdSrc[0].sRGB: - tdDst[0].flags |= ccuda.CU_TRSF_SRGB - else: - tdDst[0].flags |= 0 - - if tdSrc[0].normalizedCoords: - tdDst[0].flags |= ccuda.CU_TRSF_NORMALIZED_COORDINATES - else: - tdDst[0].flags |= 0 - - if tdSrc[0].disableTrilinearOptimization: - tdDst[0].flags |= ccuda.CU_TRSF_DISABLE_TRILINEAR_OPTIMIZATION - else: - tdDst[0].flags |= 0 - - if tdSrc[0].seamlessCubemap: - tdDst[0].flags |= ccuda.CU_TRSF_SEAMLESS_CUBEMAP - else: - tdDst[0].flags |= 0 - - if format in (ccuda.CU_AD_FORMAT_SNORM_INT8X1, - ccuda.CU_AD_FORMAT_SNORM_INT8X2, - ccuda.CU_AD_FORMAT_SNORM_INT8X4, - ccuda.CU_AD_FORMAT_UNORM_INT8X1, - ccuda.CU_AD_FORMAT_UNORM_INT8X2, - ccuda.CU_AD_FORMAT_UNORM_INT8X4, - ccuda.CU_AD_FORMAT_SNORM_INT16X1, - ccuda.CU_AD_FORMAT_SNORM_INT16X2, - ccuda.CU_AD_FORMAT_SNORM_INT16X4, - ccuda.CU_AD_FORMAT_UNORM_INT16X1, - ccuda.CU_AD_FORMAT_UNORM_INT16X2, - ccuda.CU_AD_FORMAT_UNORM_INT16X4, - ccuda.CU_AD_FORMAT_BC1_UNORM, - ccuda.CU_AD_FORMAT_BC1_UNORM_SRGB, - ccuda.CU_AD_FORMAT_BC2_UNORM, - ccuda.CU_AD_FORMAT_BC2_UNORM_SRGB, - ccuda.CU_AD_FORMAT_BC3_UNORM, - ccuda.CU_AD_FORMAT_BC3_UNORM_SRGB, - ccuda.CU_AD_FORMAT_BC4_UNORM, - ccuda.CU_AD_FORMAT_BC4_SNORM, - ccuda.CU_AD_FORMAT_BC5_UNORM, - ccuda.CU_AD_FORMAT_BC5_SNORM, - ccuda.CU_AD_FORMAT_BC7_UNORM, - ccuda.CU_AD_FORMAT_BC7_UNORM_SRGB): - if tdSrc[0].readMode != cudaTextureReadMode.cudaReadModeNormalizedFloat: - return cudaErrorInvalidNormSetting - elif format in (ccuda.CU_AD_FORMAT_SIGNED_INT8, - ccuda.CU_AD_FORMAT_SIGNED_INT16, - ccuda.CU_AD_FORMAT_UNSIGNED_INT8, - ccuda.CU_AD_FORMAT_UNSIGNED_INT16): - if tdSrc[0].readMode == cudaReadModeElementType: - if tdSrc[0].filterMode == cudaTextureFilterMode.cudaFilterModeLinear: - return cudaErrorInvalidFilterSetting - tdDst[0].flags |= ccuda.CU_TRSF_READ_AS_INTEGER - elif format == ccuda.CU_AD_FORMAT_NV12: - return cudaErrorInvalidValue - elif format == ccuda.CU_AD_FORMAT_SIGNED_INT32 or format == ccuda.CU_AD_FORMAT_UNSIGNED_INT32: - if tdSrc[0].filterMode == cudaTextureFilterMode.cudaFilterModeLinear: - return cudaErrorInvalidFilterSetting - if tdSrc[0].readMode == cudaTextureReadMode.cudaReadModeNormalizedFloat: - return cudaErrorInvalidNormSetting - else: - if tdSrc[0].readMode == cudaTextureReadMode.cudaReadModeNormalizedFloat: - return cudaErrorInvalidNormSetting - - if rvdDst and rvdSrc: - memset(rvdDst, 0, sizeof(rvdDst[0])) - - rvdDst[0].format = rvdSrc[0].format - rvdDst[0].width = rvdSrc[0].width - rvdDst[0].height = rvdSrc[0].height - rvdDst[0].depth = rvdSrc[0].depth - rvdDst[0].firstMipmapLevel = rvdSrc[0].firstMipmapLevel - rvdDst[0].lastMipmapLevel = rvdSrc[0].lastMipmapLevel - rvdDst[0].firstLayer = rvdSrc[0].firstLayer - rvdDst[0].lastLayer = rvdSrc[0].lastLayer - - return cudaSuccess - - -cdef cudaError_t getResDescFromDriverResDesc(cudaResourceDesc *rdDst, const ccuda.CUDA_RESOURCE_DESC *rdSrc, - cudaTextureDesc *tdDst, const ccuda.CUDA_TEXTURE_DESC *tdSrc, - cudaResourceViewDesc *rvdDst, const ccuda.CUDA_RESOURCE_VIEW_DESC *rvdSrc) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef int i = 0 - cdef int numChannels = 0 - cdef ccuda.CUDA_ARRAY3D_DESCRIPTOR_v2 ad - cdef ccuda.CUarray hArray - - memset(rdDst, 0, sizeof(rdDst[0])) - memset(&ad, 0, sizeof(ad)) - memset(&hArray, 0, sizeof(hArray)) - - if rdSrc[0].resType == ccuda.CUresourcetype_enum.CU_RESOURCE_TYPE_ARRAY: - rdDst[0].resType = cudaResourceType.cudaResourceTypeArray - rdDst[0].res.array.array = rdSrc[0].res.array.hArray - err = getFormat(rdDst[0].res.array.array, numChannels, &ad.Format) - if err != cudaSuccess: - return err - elif rdSrc[0].resType == ccuda.CUresourcetype_enum.CU_RESOURCE_TYPE_MIPMAPPED_ARRAY: - rdDst[0].resType = cudaResourceType.cudaResourceTypeMipmappedArray - rdDst[0].res.mipmap.mipmap = rdSrc[0].res.mipmap.hMipmappedArray - err = ccuda._cuMipmappedArrayGetLevel(&hArray, rdSrc[0].res.mipmap.hMipmappedArray, 0) - if err != cudaSuccess: - return err - err = getFormat(hArray, numChannels, &ad.Format) - if err != cudaSuccess: - return err - elif rdSrc[0].resType == ccuda.CUresourcetype_enum.CU_RESOURCE_TYPE_LINEAR: - rdDst[0].resType = cudaResourceType.cudaResourceTypeLinear - rdDst[0].res.linear.devPtr = rdSrc[0].res.linear.devPtr - rdDst[0].res.linear.sizeInBytes = rdSrc[0].res.linear.sizeInBytes - ad.Format = rdSrc[0].res.linear.format - ad.NumChannels = rdSrc[0].res.linear.numChannels - err = getChannelFormatDescFromDriverDesc(&rdDst[0].res.linear.desc, - NULL, NULL, NULL, - &ad) - if err != cudaSuccess: - return err - elif rdSrc[0].resType == ccuda.CUresourcetype_enum.CU_RESOURCE_TYPE_PITCH2D: - rdDst[0].resType = cudaResourceType.cudaResourceTypePitch2D - rdDst[0].res.pitch2D.devPtr = rdSrc[0].res.pitch2D.devPtr - rdDst[0].res.pitch2D.pitchInBytes = rdSrc[0].res.pitch2D.pitchInBytes - rdDst[0].res.pitch2D.width = rdSrc[0].res.pitch2D.width - rdDst[0].res.pitch2D.height = rdSrc[0].res.pitch2D.height - ad.Format = rdSrc[0].res.linear.format - ad.NumChannels = rdSrc[0].res.linear.numChannels - err = getChannelFormatDescFromDriverDesc(&rdDst[0].res.linear.desc, - NULL, NULL, NULL, - &ad) - if err != cudaSuccess: - return err - else: - return cudaErrorInvalidValue - - if tdDst and tdSrc: - memset(tdDst, 0, sizeof(tdDst[0])) - i = 0 - while i < 3: - tdDst[0].addressMode[i] = tdSrc[0].addressMode[i] - i += 1 - - tdDst[0].filterMode = tdSrc[0].filterMode - tdDst[0].mipmapFilterMode = tdSrc[0].mipmapFilterMode - tdDst[0].mipmapLevelBias = tdSrc[0].mipmapLevelBias - tdDst[0].minMipmapLevelClamp = tdSrc[0].minMipmapLevelClamp - tdDst[0].maxMipmapLevelClamp = tdSrc[0].maxMipmapLevelClamp - tdDst[0].maxAnisotropy = tdSrc[0].maxAnisotropy - i = 0 - while i < 4: - tdDst[0].borderColor[i] = tdSrc[0].borderColor[i] - i += 1 - - if tdSrc[0].flags & ccuda.CU_TRSF_SRGB: - tdDst[0].sRGB = 1 - else: - tdDst[0].sRGB = 0 - - if tdSrc[0].flags & ccuda.CU_TRSF_NORMALIZED_COORDINATES: - tdDst[0].normalizedCoords = 1 - else: - tdDst[0].normalizedCoords = 0 - - if tdSrc[0].flags & ccuda.CU_TRSF_DISABLE_TRILINEAR_OPTIMIZATION: - tdDst[0].disableTrilinearOptimization = 1 - else: - tdDst[0].disableTrilinearOptimization = 0 - - if tdSrc[0].flags & ccuda.CU_TRSF_SEAMLESS_CUBEMAP: - tdDst[0].seamlessCubemap |= 1 - else: - tdDst[0].seamlessCubemap |= 0 - - if ad.Format in (ccuda.CU_AD_FORMAT_SNORM_INT8X1, - ccuda.CU_AD_FORMAT_SNORM_INT8X2, - ccuda.CU_AD_FORMAT_SNORM_INT8X4, - ccuda.CU_AD_FORMAT_UNORM_INT8X1, - ccuda.CU_AD_FORMAT_UNORM_INT8X2, - ccuda.CU_AD_FORMAT_UNORM_INT8X4, - ccuda.CU_AD_FORMAT_SNORM_INT16X1, - ccuda.CU_AD_FORMAT_SNORM_INT16X2, - ccuda.CU_AD_FORMAT_SNORM_INT16X4, - ccuda.CU_AD_FORMAT_UNORM_INT16X1, - ccuda.CU_AD_FORMAT_UNORM_INT16X2, - ccuda.CU_AD_FORMAT_UNORM_INT16X4, - ccuda.CU_AD_FORMAT_BC1_UNORM, - ccuda.CU_AD_FORMAT_BC1_UNORM_SRGB, - ccuda.CU_AD_FORMAT_BC2_UNORM, - ccuda.CU_AD_FORMAT_BC2_UNORM_SRGB, - ccuda.CU_AD_FORMAT_BC3_UNORM, - ccuda.CU_AD_FORMAT_BC3_UNORM_SRGB, - ccuda.CU_AD_FORMAT_BC4_UNORM, - ccuda.CU_AD_FORMAT_BC4_SNORM, - ccuda.CU_AD_FORMAT_BC5_UNORM, - ccuda.CU_AD_FORMAT_BC5_SNORM, - ccuda.CU_AD_FORMAT_BC7_UNORM, - ccuda.CU_AD_FORMAT_BC7_UNORM_SRGB): - tdDst[0].readMode = cudaTextureReadMode.cudaReadModeNormalizedFloat - elif ad.Format in (ccuda.CU_AD_FORMAT_SIGNED_INT8, - ccuda.CU_AD_FORMAT_SIGNED_INT16, - ccuda.CU_AD_FORMAT_UNSIGNED_INT8, - ccuda.CU_AD_FORMAT_UNSIGNED_INT16): - with gil: - if (tdSrc[0].flags & ccuda.CU_TRSF_READ_AS_INTEGER): - tdDst[0].readMode = cudaTextureReadMode.cudaReadModeElementType - else: - tdDst[0].readMode = cudaTextureReadMode.cudaReadModeNormalizedFloat - else: - tdDst[0].readMode = cudaTextureReadMode.cudaReadModeElementType - - if rvdDst and rvdSrc: - memset(rvdDst, 0, sizeof(rvdDst[0])) - - rvdDst[0].format = rvdSrc[0].format - rvdDst[0].width = rvdSrc[0].width - rvdDst[0].height = rvdSrc[0].height - rvdDst[0].depth = rvdSrc[0].depth - rvdDst[0].firstMipmapLevel = rvdSrc[0].firstMipmapLevel - rvdDst[0].lastMipmapLevel = rvdSrc[0].lastMipmapLevel - rvdDst[0].firstLayer = rvdSrc[0].firstLayer - rvdDst[0].lastLayer = rvdSrc[0].lastLayer - - return cudaSuccess - - -cdef cudaError_t memsetPtr(char *mem, int c, size_t count, cudaStream_t sid, bool async) except ?cudaErrorCallRequiresNewerDriver nogil: - if count == 0: - return cudaSuccess - - if not async: - return ccuda._cuMemsetD8_v2(mem, c, count) - else: - return ccuda._cuMemsetD8Async(mem, c, count, sid) - - -cdef cudaError_t memset2DPtr(char *mem, size_t pitch, int c, size_t width, size_t height, cudaStream_t sid, bool async) except ?cudaErrorCallRequiresNewerDriver nogil: - if width == 0 or height == 0: - return cudaSuccess - - if not async: - return ccuda._cuMemsetD2D8_v2(mem, pitch, c, width, height) - else: - return ccuda._cuMemsetD2D8Async(mem, pitch, c, width, height, sid) - - -cdef cudaError_t copyFromHost(cudaArray_const_t thisArray, size_t hOffset, size_t wOffset, const char *src, size_t count, ccuda.CUstream stream, bool async) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaArrayLocalState arrayState - cdef cudaError_t err = cudaSuccess - memset(&arrayState, 0, sizeof(arrayState)) - err = getLocalState(&arrayState, thisArray) - if err != cudaSuccess: - return err - cdef size_t copied = 0 - cdef ccuda.CUDA_MEMCPY3D_v2 cp = memCopy3DInit(ccuda.CUmemorytype_enum.CU_MEMORYTYPE_ARRAY, ccuda.CUmemorytype_enum.CU_MEMORYTYPE_HOST) - - if (wOffset > 0) and (count >= arrayState.widthInBytes - wOffset): - cp.dstArray = arrayState.array - cp.dstXInBytes = wOffset - cp.dstY = hOffset - - cp.srcHost = src - cp.srcPitch = arrayState.widthInBytes - cp.srcXInBytes = 0 - cp.srcY = 0 - - cp.Height = 1 - cp.WidthInBytes = arrayState.widthInBytes - wOffset - - copied += cp.Height * cp.WidthInBytes - hOffset += cp.Height - wOffset = 0 - - err = driverMemcpy3D(&cp, stream, async) - if err != cudaSuccess: - return err - - if (count - copied >= arrayState.widthInBytes): - cp.dstArray = arrayState.array - cp.dstXInBytes = wOffset - cp.dstY = hOffset - - cp.srcHost = src + copied - cp.srcPitch = arrayState.widthInBytes - cp.srcXInBytes = 0 - cp.srcY = 0 - - cp.Height = ((count - copied) / arrayState.widthInBytes) - cp.WidthInBytes = arrayState.widthInBytes - - copied += cp.Height * cp.WidthInBytes - hOffset += cp.Height - wOffset = 0 - - err = driverMemcpy3D(&cp, stream, async) - if err != cudaSuccess: - return err - - if (count - copied > 0): - cp.dstArray = arrayState.array - cp.dstXInBytes = wOffset - cp.dstY = hOffset - - cp.srcHost = src + copied - cp.srcPitch = arrayState.widthInBytes - cp.srcXInBytes = 0 - cp.srcY = 0 - - cp.Height = 1 - cp.WidthInBytes = count - copied - - err = driverMemcpy3D(&cp, stream, async) - if err != cudaSuccess: - return err - - return cudaSuccess - - -cdef cudaError_t copyFromDevice(ccuda.CUmemorytype type, cudaArray_const_t thisArray, size_t hOffset, size_t wOffset, const char *src, size_t srcOffset, size_t count, ccuda.CUstream stream, bool async) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaArrayLocalState arrayState - cdef cudaError_t err = cudaSuccess - memset(&arrayState, 0, sizeof(arrayState)) - err = getLocalState(&arrayState, thisArray) - if err != cudaSuccess: - return err - cdef size_t copied = 0 - cdef ccuda.CUDA_MEMCPY3D_v2 cp = memCopy3DInit(ccuda.CUmemorytype_enum.CU_MEMORYTYPE_ARRAY, type) - - if (wOffset > 0) and (count >= arrayState.widthInBytes - wOffset): - cp.dstArray = arrayState.array - cp.dstXInBytes = wOffset - cp.dstY = hOffset - - cp.srcDevice = src - cp.srcPitch = arrayState.widthInBytes - cp.srcXInBytes = srcOffset - cp.srcY = 0 - - cp.Height = 1 - cp.WidthInBytes = arrayState.widthInBytes - wOffset - - copied += cp.Height * cp.WidthInBytes - hOffset += cp.Height - wOffset = 0 - - err = driverMemcpy3D(&cp, stream, async) - if err != cudaSuccess: - return err - - if (count - copied >= arrayState.widthInBytes): - cp.dstArray = arrayState.array - cp.dstXInBytes = wOffset - cp.dstY = hOffset - - cp.srcDevice = (src + copied) - cp.srcPitch = arrayState.widthInBytes - cp.srcXInBytes = srcOffset - cp.srcY = 0 - - cp.Height = ((count - copied) / arrayState.widthInBytes) - cp.WidthInBytes = arrayState.widthInBytes - - copied += cp.Height * cp.WidthInBytes - hOffset += cp.Height - wOffset = 0 - - - err = driverMemcpy3D(&cp, stream, async) - if err != cudaSuccess: - return err - - if (count - copied > 0): - cp.dstArray = arrayState.array - cp.dstXInBytes = wOffset - cp.dstY = hOffset - - cp.srcDevice = (src + copied) - cp.srcPitch = arrayState.widthInBytes - cp.srcXInBytes = srcOffset - cp.srcY = 0 - - cp.Height = 1 - cp.WidthInBytes = count - copied - - err = driverMemcpy3D(&cp, stream, async) - if err != cudaSuccess: - return err - - return cudaSuccess - - -cdef cudaError_t copyToHost(cudaArray_const_t thisArray, size_t hOffset, size_t wOffset, char *dst, size_t count, ccuda.CUstream stream, bool async) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaArrayLocalState arrayState - cdef cudaError_t err = cudaSuccess - memset(&arrayState, 0, sizeof(arrayState)) - err = getLocalState(&arrayState, thisArray) - if err != cudaSuccess: - return err - cdef size_t copied = 0 - cdef ccuda.CUDA_MEMCPY3D_v2 cp = memCopy3DInit(ccuda.CUmemorytype_enum.CU_MEMORYTYPE_HOST, ccuda.CUmemorytype_enum.CU_MEMORYTYPE_ARRAY) - - if (wOffset > 0) and (count >= arrayState.widthInBytes - wOffset): - cp.dstHost = dst - cp.dstPitch = arrayState.widthInBytes - cp.dstXInBytes = 0 - cp.dstY = 0 - - cp.srcArray = arrayState.array - cp.srcXInBytes = wOffset - cp.srcY = hOffset - - cp.Height = 1 - cp.WidthInBytes = arrayState.widthInBytes - wOffset - - copied += cp.Height * cp.WidthInBytes - hOffset += cp.Height - wOffset = 0 - - err = driverMemcpy3D(&cp, stream, async) - if err != cudaSuccess: - return err - - if (count - copied >= arrayState.widthInBytes): - cp.dstHost = dst + copied - cp.dstPitch = arrayState.widthInBytes - cp.dstXInBytes = 0 - cp.dstY = 0 - - cp.srcArray = arrayState.array - cp.srcXInBytes = wOffset - cp.srcY = hOffset - - cp.Height = ((count - copied) / arrayState.widthInBytes) - cp.WidthInBytes = arrayState.widthInBytes - - copied += cp.Height * cp.WidthInBytes - hOffset += cp.Height - wOffset = 0 - - err = driverMemcpy3D(&cp, stream, async) - if err != cudaSuccess: - return err - - if (count - copied > 0): - cp.dstHost = dst + copied - cp.dstPitch = arrayState.widthInBytes - cp.dstXInBytes = 0 - cp.dstY = 0 - - cp.srcArray = arrayState.array - cp.srcXInBytes = wOffset - cp.srcY = hOffset - - cp.Height = 1 - cp.WidthInBytes = count - copied - - err = driverMemcpy3D(&cp, stream, async) - if err != cudaSuccess: - return err - - return cudaSuccess - - -cdef cudaError_t driverMemcpy3DPeer(ccuda.CUDA_MEMCPY3D_PEER *cp, ccuda.CUstream stream, bool async) except ?cudaErrorCallRequiresNewerDriver nogil: - if async: - return ccuda._cuMemcpy3DPeerAsync(cp, stream) - else: - return ccuda._cuMemcpy3DPeer(cp) - - -cdef cudaError_t driverMemcpy3D(ccuda.CUDA_MEMCPY3D_v2 *cp, ccuda.CUstream stream, bool async) except ?cudaErrorCallRequiresNewerDriver nogil: - if async: - return ccuda._cuMemcpy3DAsync_v2(cp, stream) - else: - return ccuda._cuMemcpy3D_v2(cp) - - -cdef cudaError_t memcpy3D(const cudaMemcpy3DParms *p, bool peer, int srcDevice, int dstDevice, cudaStream_t sid, bool async) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef ccuda.CUDA_MEMCPY3D_v2 cd - cdef ccuda.CUDA_MEMCPY3D_PEER cdPeer - cdef cudaPythonDevice *srcDev - cdef cudaPythonDevice *dstDev - - memset(&cdPeer, 0, sizeof(cdPeer)) - - cdef cudaError_t err = toDriverMemCopy3DParams(p, &cd) - if err != cudaSuccess: - return err - - # Execute the copy - if peer: - srcDev = m_global.getDevice(srcDevice) - dstDev = m_global.getDevice(dstDevice) - if srcDev == NULL or dstDev == NULL: - return cudaErrorInvalidDevice - cdPeer.srcXInBytes = cd.srcXInBytes - cdPeer.srcY = cd.srcY - cdPeer.srcZ = cd.srcZ - cdPeer.srcLOD = cd.srcLOD - cdPeer.srcMemoryType = cd.srcMemoryType - cdPeer.srcHost = cd.srcHost - cdPeer.srcDevice = cd.srcDevice - cdPeer.srcArray = cd.srcArray - cdPeer.srcContext = srcDev.primaryContext - cdPeer.srcPitch = cd.srcPitch - cdPeer.srcHeight = cd.srcHeight - cdPeer.dstXInBytes = cd.dstXInBytes - cdPeer.dstY = cd.dstY - cdPeer.dstZ = cd.dstZ - cdPeer.dstLOD = cd.dstLOD - cdPeer.dstMemoryType = cd.dstMemoryType - cdPeer.dstHost = cd.dstHost - cdPeer.dstDevice = cd.dstDevice - cdPeer.dstArray = cd.dstArray - cdPeer.dstContext = dstDev.primaryContext - cdPeer.dstPitch = cd.dstPitch - cdPeer.dstHeight = cd.dstHeight - cdPeer.WidthInBytes = cd.WidthInBytes - cdPeer.Height = cd.Height - cdPeer.Depth = cd.Depth - err = driverMemcpy3DPeer(&cdPeer, sid, async) - else: - err = driverMemcpy3D(&cd, sid, async) - return err - - -cdef cudaError_t copyToDevice(ccuda.CUmemorytype type, cudaArray_const_t thisArray, size_t hOffset, size_t wOffset, const char *dst, size_t dstOffset, size_t count, ccuda.CUstream stream, bool async) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaArrayLocalState arrayState - cdef cudaError_t err = cudaSuccess - memset(&arrayState, 0, sizeof(arrayState)) - err = getLocalState(&arrayState, thisArray) - if err != cudaSuccess: - return err - cdef size_t copied = 0 - cdef ccuda.CUDA_MEMCPY3D_v2 cp = memCopy3DInit(type, ccuda.CUmemorytype_enum.CU_MEMORYTYPE_ARRAY) - - if (wOffset > 0) and (count >= arrayState.widthInBytes - wOffset): - cp.dstDevice = dst - cp.dstPitch = arrayState.widthInBytes - cp.dstXInBytes = dstOffset - cp.dstY = 0 - - cp.srcArray = arrayState.array - cp.srcXInBytes = wOffset - cp.srcY = hOffset - - cp.Height = 1 - cp.WidthInBytes = arrayState.widthInBytes - wOffset - - copied += cp.Height * cp.WidthInBytes - hOffset += cp.Height - wOffset = 0 - - err = driverMemcpy3D(&cp, stream, async) - if err != cudaSuccess: - return err - - if (count - copied >= arrayState.widthInBytes): - cp.dstDevice = (dst + copied) - cp.dstPitch = arrayState.widthInBytes - cp.dstXInBytes = dstOffset - cp.dstY = 0 - - cp.srcArray = arrayState.array - cp.srcXInBytes = wOffset - cp.srcY = hOffset - - cp.Height = ((count - copied) / arrayState.widthInBytes) - cp.WidthInBytes = arrayState.widthInBytes - - copied += cp.Height * cp.WidthInBytes - hOffset += cp.Height - wOffset = 0 - - err = driverMemcpy3D(&cp, stream, async) - if err != cudaSuccess: - return err - - if (count - copied > 0): - cp.dstDevice = (dst + copied) - cp.dstPitch = arrayState.widthInBytes - cp.dstXInBytes = dstOffset - cp.dstY = 0 - - cp.srcArray = arrayState.array - cp.srcXInBytes = wOffset - cp.srcY = hOffset - - cp.Height = 1 - cp.WidthInBytes = count - copied - - err = driverMemcpy3D(&cp, stream, async) - if err != cudaSuccess: - return err - - return cudaSuccess - - -cdef cudaError_t copy1DConvertTo3DParams(void* dst, const void* src, size_t count, cudaMemcpyKind kind, cudaMemcpy3DParms *p) except ?cudaErrorCallRequiresNewerDriver nogil: - memset(p, 0, sizeof(cudaMemcpy3DParms)) - p[0].extent.width = count - p[0].extent.height = 1 - p[0].extent.depth = 1 - p[0].dstPtr.ptr = dst - p[0].srcPtr.ptr = src - p[0].kind = kind - - -cdef void toDriverMemsetNodeParams(const cudaMemsetParams *pRuntimeParams, ccuda.CUDA_MEMSET_NODE_PARAMS *pDriverParams) noexcept nogil: - pDriverParams[0].dst = pRuntimeParams[0].dst - pDriverParams[0].pitch = pRuntimeParams[0].pitch - pDriverParams[0].value = pRuntimeParams[0].value - pDriverParams[0].elementSize = pRuntimeParams[0].elementSize - pDriverParams[0].width = pRuntimeParams[0].width - pDriverParams[0].height = pRuntimeParams[0].height - - -cdef cudaError_t getElementSize(size_t *elementSize, cudaArray_t array) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef ccuda.CUDA_ARRAY3D_DESCRIPTOR driverDesc - cdef cudaError_t err = cudaSuccess - err = ccuda._cuArray3DGetDescriptor_v2(&driverDesc, array) - if err != cudaSuccess: - return err - if (driverDesc.Format == ccuda.CU_AD_FORMAT_FLOAT or - driverDesc.Format == ccuda.CU_AD_FORMAT_UNSIGNED_INT32 or - driverDesc.Format == ccuda.CU_AD_FORMAT_SIGNED_INT32): - elementSize[0] = driverDesc.NumChannels * 4 - return cudaSuccess - elif (driverDesc.Format == ccuda.CU_AD_FORMAT_HALF or - driverDesc.Format == ccuda.CU_AD_FORMAT_SIGNED_INT16 or - driverDesc.Format == ccuda.CU_AD_FORMAT_UNSIGNED_INT16): - elementSize[0] = driverDesc.NumChannels * 2 - return cudaSuccess - elif (driverDesc.Format == ccuda.CU_AD_FORMAT_SIGNED_INT8 or - driverDesc.Format == ccuda.CU_AD_FORMAT_UNSIGNED_INT8 or - driverDesc.Format == ccuda.CU_AD_FORMAT_NV12): - elementSize[0] = driverDesc.NumChannels - return cudaSuccess - return cudaErrorInvalidChannelDescriptor - - -cdef cudaError_t toDriverMemCopy3DParams(const cudaMemcpy3DParms *p, ccuda.CUDA_MEMCPY3D *cd) except ?cudaErrorCallRequiresNewerDriver nogil: - memset(cd, 0, sizeof(ccuda.CUDA_MEMCPY3D)) - cd[0].dstMemoryType = ccuda.CUmemorytype_enum.CU_MEMORYTYPE_DEVICE - cd[0].srcMemoryType = ccuda.CUmemorytype_enum.CU_MEMORYTYPE_DEVICE - cd[0].WidthInBytes = 0 - cd[0].Height = 1 - cd[0].Depth = 1 - cdef size_t srcElementSize = 0 - cdef size_t dstElementSize = 0 - cdef cudaError_t err = cudaSuccess - - cdef cudaExtent srcBlockExtent - cdef cudaExtent dstBlockExtent - cdef cudaExtent copyBlockExtent - cdef ccuda.CUarray_format srcFmt - cdef ccuda.CUarray_format dstFmt - cdef int numChannels = 0 - srcBlockExtent.width = srcBlockExtent.height = srcBlockExtent.depth = 1 - dstBlockExtent.width = dstBlockExtent.height = dstBlockExtent.depth = 1 - copyBlockExtent.width = copyBlockExtent.height = copyBlockExtent.depth = 1 - - if p[0].extent.width == 0 or p[0].extent.height == 0 or p[0].extent.depth == 0: - return cudaSuccess - - if p[0].kind == cudaMemcpyHostToHost: - cd[0].srcMemoryType = ccuda.CUmemorytype_enum.CU_MEMORYTYPE_HOST - cd[0].dstMemoryType = ccuda.CUmemorytype_enum.CU_MEMORYTYPE_HOST - elif p[0].kind == cudaMemcpyHostToDevice: - cd[0].srcMemoryType = ccuda.CUmemorytype_enum.CU_MEMORYTYPE_HOST - cd[0].dstMemoryType = ccuda.CUmemorytype_enum.CU_MEMORYTYPE_DEVICE - elif p[0].kind == cudaMemcpyDeviceToHost: - cd[0].srcMemoryType = ccuda.CUmemorytype_enum.CU_MEMORYTYPE_DEVICE - cd[0].dstMemoryType = ccuda.CUmemorytype_enum.CU_MEMORYTYPE_HOST - elif p[0].kind == cudaMemcpyDeviceToDevice: - cd[0].srcMemoryType = ccuda.CUmemorytype_enum.CU_MEMORYTYPE_DEVICE - cd[0].dstMemoryType = ccuda.CUmemorytype_enum.CU_MEMORYTYPE_DEVICE - elif p[0].kind == cudaMemcpyDefault: - cd[0].srcMemoryType = ccuda.CUmemorytype_enum.CU_MEMORYTYPE_UNIFIED - cd[0].dstMemoryType = ccuda.CUmemorytype_enum.CU_MEMORYTYPE_UNIFIED - else: - return cudaErrorInvalidMemcpyDirection - - if p[0].srcArray: - err = getFormat(p[0].srcArray, numChannels, &srcFmt) - if err != cudaSuccess: - return err - err = getArrayBlockExtent(&srcBlockExtent, srcFmt) - if err != cudaSuccess: - return err - copyBlockExtent = srcBlockExtent - if p[0].dstArray: - err = getFormat(p[0].dstArray, numChannels, &dstFmt) - if err != cudaSuccess: - return err - err = getArrayBlockExtent(&dstBlockExtent, dstFmt) - if err != cudaSuccess: - return err - if not p[0].srcArray: - copyBlockExtent = dstBlockExtent - - if p[0].srcArray: - if NULL != p[0].srcPtr.ptr or ccuda.CUmemorytype_enum.CU_MEMORYTYPE_HOST == cd[0].srcMemoryType: - return cudaErrorInvalidValue - cd[0].srcMemoryType = ccuda.CUmemorytype_enum.CU_MEMORYTYPE_ARRAY - cd[0].srcArray = p[0].srcArray - err = getElementSize(&srcElementSize, p[0].srcArray) - if err != cudaSuccess: - return err - else: - if NULL == p[0].srcPtr.ptr: - return cudaErrorInvalidValue - if (p[0].extent.height > 1 or p[0].extent.depth > 1) and (p[0].extent.width > p[0].srcPtr.pitch): - return cudaErrorInvalidPitchValue - if p[0].extent.depth > 1: - adjustedSrcHeight = p[0].srcPtr.ysize * copyBlockExtent.height - if p[0].extent.height > adjustedSrcHeight: - return cudaErrorInvalidPitchValue - - if ccuda.CUmemorytype_enum.CU_MEMORYTYPE_HOST == cd[0].srcMemoryType: - cd[0].srcHost = p[0].srcPtr.ptr - else: - cd[0].srcDevice = (p[0].srcPtr.ptr) - cd[0].srcPitch = p[0].srcPtr.pitch - cd[0].srcHeight = p[0].srcPtr.ysize - - if p[0].dstArray: - if NULL != p[0].dstPtr.ptr: - return cudaErrorInvalidValue - cd[0].dstMemoryType = ccuda.CUmemorytype_enum.CU_MEMORYTYPE_ARRAY - cd[0].dstArray = p[0].dstArray - err = getElementSize(&dstElementSize, p[0].dstArray) - if err != cudaSuccess: - return err - else: - if NULL == p[0].dstPtr.ptr: - return cudaErrorInvalidValue - if (p[0].extent.height > 1 or p[0].extent.depth > 1) and (p[0].extent.width > p[0].dstPtr.pitch): - return cudaErrorInvalidPitchValue - if p[0].extent.depth > 1: - adjustedDstHeight = p[0].dstPtr.ysize * copyBlockExtent.height - if p[0].extent.height > adjustedDstHeight: - return cudaErrorInvalidPitchValue - - if ccuda.CUmemorytype_enum.CU_MEMORYTYPE_HOST == cd[0].dstMemoryType: - cd[0].dstHost = p[0].dstPtr.ptr - else: - cd[0].dstDevice = (p[0].dstPtr.ptr) - cd[0].dstPitch = p[0].dstPtr.pitch - cd[0].dstHeight = p[0].dstPtr.ysize - - if srcElementSize and dstElementSize and srcElementSize != dstElementSize: - return cudaErrorInvalidValue - - cdef size_t elementSize = sizeof(char) - if srcElementSize: - elementSize = srcElementSize - if dstElementSize: - elementSize = dstElementSize - srcElementSize = elementSize - dstElementSize = elementSize - - # Determine the extent of the transfer - cd[0].WidthInBytes = ((p[0].extent.width + copyBlockExtent.width - 1) / copyBlockExtent.width) * elementSize - cd[0].Height = ((p[0].extent.height + copyBlockExtent.height - 1) / copyBlockExtent.height) - cd[0].Depth = p[0].extent.depth - - # Populate bloated src copy origin - cd[0].srcXInBytes = (p[0].srcPos.x / srcBlockExtent.width) * elementSize - cd[0].srcY = (p[0].srcPos.y / srcBlockExtent.height) - cd[0].srcZ = p[0].srcPos.z - - # Populate bloated dst copy origin - cd[0].dstXInBytes = (p[0].dstPos.x / dstBlockExtent.width) * elementSize - cd[0].dstY = (p[0].dstPos.y / dstBlockExtent.height) - cd[0].dstZ = p[0].dstPos.z - - return cudaSuccess - - -cdef cudaError_t mallocArray(cudaArray_t *arrayPtr, const cudaChannelFormatDesc *desc, - size_t depth, size_t height, size_t width, int corr2D, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - if arrayPtr == NULL: - return cudaErrorInvalidValue - - cdef ccuda.CUarray array = NULL - cdef ccuda.CUDA_ARRAY3D_DESCRIPTOR_v2 ad - cdef cudaError_t err = cudaSuccess - arrayPtr[0] = NULL - if (((width == 0)) or - ((height == 0) and (depth != 0) and not (flags & cudaArrayLayered)) or - ((flags & cudaArrayLayered) and (depth == 0)) or - ((flags & cudaArrayCubemap) and not (flags & cudaArrayLayered) and ((width != height) or (depth != 6))) or - ((flags & cudaArrayLayered) and (flags & cudaArrayCubemap) and ((width != height) or (depth % 6 != 0)))): - return cudaErrorInvalidValue - else: - memset(&ad, 0, sizeof(ad)) - err = getDescInfo(desc, &ad.NumChannels, &ad.Format) - if err != cudaSuccess: - return err - ad.Height = height - ad.Width = width - ad.Depth = (depth - corr2D) - ad.Flags = flags - err = ccuda._cuArray3DCreate_v2(&array, &ad) - if err != cudaSuccess: - return err - - arrayPtr[0] = array - return cudaSuccess - - -cdef cudaError_t memcpy2DToArray(cudaArray_t dst, size_t hOffset, size_t wOffset, const char *src, - size_t spitch, size_t width, size_t height, cudaMemcpyKind kind, - cudaStream_t sid, bool async) except ?cudaErrorCallRequiresNewerDriver nogil: - if width == 0 or height == 0: - return cudaSuccess - if height > 1 and width > spitch: - return cudaErrorInvalidPitchValue - - cdef cudaError_t err = cudaSuccess - if kind == cudaMemcpyKind.cudaMemcpyHostToDevice: - err = copyFromHost2D(dst, hOffset, wOffset, src, spitch, width, height, sid, async) - elif kind == cudaMemcpyKind.cudaMemcpyDeviceToDevice: - err = copyFromDevice2D(ccuda.CUmemorytype_enum.CU_MEMORYTYPE_DEVICE, dst, hOffset, wOffset, src, 0, spitch, width, height, sid, async) - elif kind == cudaMemcpyKind.cudaMemcpyDefault: - err = copyFromDevice2D(ccuda.CUmemorytype_enum.CU_MEMORYTYPE_UNIFIED, dst, hOffset, wOffset, src, 0, spitch, width, height, sid, async) - else: - return cudaErrorInvalidMemcpyDirection - return err - - -cdef cudaError_t memcpy2DPtr(char *dst, size_t dpitch, const char *src, size_t spitch, size_t width, - size_t height, cudaMemcpyKind kind, - cudaStream_t sid, bool async) except ?cudaErrorCallRequiresNewerDriver nogil: - if width == 0 or height == 0: - return cudaSuccess - if height > 1 and width > dpitch: - return cudaErrorInvalidPitchValue - if height > 1 and width > spitch: - return cudaErrorInvalidPitchValue - - cdef cudaError_t err = cudaSuccess - cdef ccuda.CUDA_MEMCPY2D_v2 cp - memset(&cp, 0, sizeof(cp)) - - if kind == cudaMemcpyKind.cudaMemcpyHostToHost: - cp = memCopy2DInit(ccuda.CUmemorytype_enum.CU_MEMORYTYPE_HOST, ccuda.CUmemorytype_enum.CU_MEMORYTYPE_HOST) - cp.dstHost = dst - cp.srcHost = src - elif kind == cudaMemcpyKind.cudaMemcpyDeviceToHost: - cp = memCopy2DInit(ccuda.CUmemorytype_enum.CU_MEMORYTYPE_HOST, ccuda.CUmemorytype_enum.CU_MEMORYTYPE_DEVICE) - cp.dstHost = dst - cp.srcDevice = src - elif kind == cudaMemcpyKind.cudaMemcpyHostToDevice: - cp = memCopy2DInit(ccuda.CUmemorytype_enum.CU_MEMORYTYPE_DEVICE, ccuda.CUmemorytype_enum.CU_MEMORYTYPE_HOST) - cp.dstDevice = dst - cp.srcHost = src - elif kind == cudaMemcpyKind.cudaMemcpyDeviceToDevice: - cp = memCopy2DInit(ccuda.CUmemorytype_enum.CU_MEMORYTYPE_DEVICE, ccuda.CUmemorytype_enum.CU_MEMORYTYPE_DEVICE) - cp.dstDevice = dst - cp.srcDevice = src - elif kind == cudaMemcpyKind.cudaMemcpyDefault: - cp = memCopy2DInit(ccuda.CUmemorytype_enum.CU_MEMORYTYPE_UNIFIED, ccuda.CUmemorytype_enum.CU_MEMORYTYPE_UNIFIED) - cp.dstDevice = dst - cp.srcDevice = src - else: - err = cudaErrorInvalidMemcpyDirection - - if err != cudaSuccess: - return err - - cp.dstPitch = dpitch - cp.srcPitch = spitch - cp.WidthInBytes = width - cp.Height = height - - if async: - err = ccuda._cuMemcpy2DAsync_v2(&cp, sid) - else: - err = ccuda._cuMemcpy2DUnaligned_v2(&cp) - return err - - -cdef cudaError_t memcpyDispatch(void *dst, const void *src, size_t size, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: - if size == 0: - return cudaSuccess - - cdef cudaError_t err = cudaSuccess - if kind == cudaMemcpyKind.cudaMemcpyHostToHost: - return memcpy2DPtr(dst, size, src, size, size, 1, kind, NULL, 0) - elif kind == cudaMemcpyKind.cudaMemcpyDeviceToHost: - err = ccuda._cuMemcpyDtoH_v2(dst, src, size) - elif kind == cudaMemcpyKind.cudaMemcpyHostToDevice: - err = ccuda._cuMemcpyHtoD_v2(dst, src, size) - elif kind == cudaMemcpyKind.cudaMemcpyDeviceToDevice: - err = ccuda._cuMemcpyDtoD_v2(dst, src, size) - elif kind == cudaMemcpyKind.cudaMemcpyDefault: - err = ccuda._cuMemcpy(dst, src, size) - else: - return cudaErrorInvalidMemcpyDirection - - -cdef cudaError_t mallocHost(size_t size, void **mem, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - if size == 0: - if mem == NULL: - return cudaErrorInvalidValue - mem[0] = NULL - return cudaSuccess - else: - return ccuda._cuMemHostAlloc(mem, size, flags) - - -cdef cudaError_t mallocPitch(size_t width, size_t height, size_t depth, void **mem, size_t *pitch) except ?cudaErrorCallRequiresNewerDriver nogil: - height *= depth - - if width == 0 or height == 0: - if mem == NULL or pitch == NULL: - return cudaErrorInvalidValue - mem[0] = NULL - pitch[0] = 0 - else: - return ccuda._cuMemAllocPitch_v2(mem, pitch, width, height, 4) - return cudaSuccess - - -cdef cudaError_t mallocMipmappedArray(cudaMipmappedArray_t *mipmappedArray, const cudaChannelFormatDesc *desc, - size_t depth, size_t height, size_t width, unsigned int numLevels, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - if mipmappedArray == NULL: - return cudaErrorInvalidValue - - cdef ccuda.CUmipmappedArray mipmap = NULL - cdef ccuda.CUDA_ARRAY3D_DESCRIPTOR_v2 ad - memset(&ad, 0, sizeof(ad)) - - mipmappedArray[0] = NULL - if (((width == 0)) or - ((height == 0) and (depth != 0) and not (flags & cudaArrayLayered)) or - ((flags & cudaArrayLayered) and (depth == 0)) or - ((flags & cudaArrayCubemap) and not (flags & cudaArrayLayered) and ((width != height) or (depth != 6))) or - ((flags & cudaArrayLayered) and (flags & cudaArrayCubemap) and ((width != height) or (depth % 6 != 0)))): - return cudaErrorInvalidValue - else: - err = getDescInfo(desc, &ad.NumChannels, &ad.Format) - if err != cudaSuccess: - return err - ad.Height = height - ad.Width = width - ad.Depth = depth - ad.Flags = flags - err = ccuda._cuMipmappedArrayCreate(&mipmap, &ad, numLevels) - if err != cudaSuccess: - return err - mipmappedArray[0] = mipmap - return cudaSuccess - - -cdef cudaError_t memcpyAsyncDispatch(void *dst, const void *src, size_t size, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - if size == 0: - return cudaSuccess - elif kind == cudaMemcpyKind.cudaMemcpyHostToHost: - return memcpy2DPtr(dst, size, src, size, size, 1, kind, stream, True) - elif kind == cudaMemcpyKind.cudaMemcpyDeviceToHost: - return ccuda._cuMemcpyDtoHAsync_v2(dst, src, size, stream) - elif kind == cudaMemcpyKind.cudaMemcpyHostToDevice: - returnccuda._cuMemcpyHtoDAsync_v2(dst, src, size, stream) - elif kind == cudaMemcpyKind.cudaMemcpyDeviceToDevice: - returnccuda._cuMemcpyDtoDAsync_v2(dst, src, size, stream) - elif kind == cudaMemcpyKind.cudaMemcpyDefault: - returnccuda._cuMemcpyAsync(dst, src, size, stream) - return cudaErrorInvalidMemcpyDirection - - -cdef cudaError_t toCudartMemCopy3DParams(const ccuda.CUDA_MEMCPY3D_v2 *cd, cudaMemcpy3DParms *p) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaExtent srcBlockExtent - cdef cudaExtent dstBlockExtent - cdef cudaExtent copyBlockExtent - cdef ccuda.CUarray_format srcFmt - cdef ccuda.CUarray_format dstFmt - cdef int numChannels = 0 - srcBlockExtent.width = srcBlockExtent.height = srcBlockExtent.depth = 1 - dstBlockExtent.width = dstBlockExtent.height = dstBlockExtent.depth = 1 - copyBlockExtent.width = copyBlockExtent.height = copyBlockExtent.depth = 1 - - memset(p, 0, sizeof(cudaMemcpy3DParms)) - p[0].srcPtr.xsize = 0 - p[0].dstPtr.xsize = 0 - - if (cd[0].srcMemoryType == ccuda.CUmemorytype_enum.CU_MEMORYTYPE_HOST and cd[0].dstMemoryType == ccuda.CUmemorytype_enum.CU_MEMORYTYPE_HOST): - p[0].kind = cudaMemcpyHostToHost - - p[0].srcPtr.ptr = cd[0].srcHost - p[0].srcPtr.pitch = cd[0].srcPitch - p[0].srcPtr.ysize = cd[0].srcHeight - - p[0].dstPtr.ptr = cd[0].dstHost - p[0].dstPtr.pitch = cd[0].dstPitch - p[0].dstPtr.ysize = cd[0].dstHeight - elif (cd[0].srcMemoryType == ccuda.CUmemorytype_enum.CU_MEMORYTYPE_HOST - and (cd[0].dstMemoryType == ccuda.CUmemorytype_enum.CU_MEMORYTYPE_DEVICE - or cd[0].dstMemoryType == ccuda.CUmemorytype_enum.CU_MEMORYTYPE_ARRAY)): - p[0].kind = cudaMemcpyHostToDevice - - p[0].srcPtr.ptr = cd[0].srcHost - p[0].srcPtr.pitch = cd[0].srcPitch - p[0].srcPtr.ysize = cd[0].srcHeight - - if (cd[0].dstMemoryType == ccuda.CUmemorytype_enum.CU_MEMORYTYPE_ARRAY): - p[0].dstArray = cd[0].dstArray - else: - p[0].dstPtr.ptr = cd[0].dstDevice - p[0].dstPtr.pitch = cd[0].dstPitch - p[0].dstPtr.ysize = cd[0].dstHeight - elif ((cd[0].srcMemoryType == ccuda.CUmemorytype_enum.CU_MEMORYTYPE_DEVICE or cd[0].srcMemoryType == ccuda.CUmemorytype_enum.CU_MEMORYTYPE_ARRAY) - and cd[0].dstMemoryType == ccuda.CUmemorytype_enum.CU_MEMORYTYPE_HOST): - p[0].kind = cudaMemcpyDeviceToHost - - if (cd[0].srcMemoryType == ccuda.CUmemorytype_enum.CU_MEMORYTYPE_ARRAY): - p[0].srcArray = cd[0].srcArray - else: - p[0].srcPtr.ptr = cd[0].srcDevice - p[0].srcPtr.pitch = cd[0].srcPitch - p[0].srcPtr.ysize = cd[0].srcHeight - - p[0].dstPtr.ptr = cd[0].dstHost - p[0].dstPtr.pitch = cd[0].dstPitch - p[0].dstPtr.ysize = cd[0].dstHeight - elif ((cd[0].srcMemoryType == ccuda.CUmemorytype_enum.CU_MEMORYTYPE_DEVICE or cd[0].srcMemoryType == ccuda.CUmemorytype_enum.CU_MEMORYTYPE_ARRAY) - and (cd[0].dstMemoryType == ccuda.CUmemorytype_enum.CU_MEMORYTYPE_DEVICE or cd[0].dstMemoryType == ccuda.CUmemorytype_enum.CU_MEMORYTYPE_ARRAY)): - p[0].kind = cudaMemcpyDeviceToDevice - - if (cd[0].srcMemoryType == ccuda.CUmemorytype_enum.CU_MEMORYTYPE_ARRAY): - p[0].srcArray = cd[0].srcArray - else: - p[0].srcPtr.ptr = cd[0].srcDevice - p[0].srcPtr.pitch = cd[0].srcPitch - p[0].srcPtr.ysize = cd[0].srcHeight - - if (cd[0].dstMemoryType == ccuda.CUmemorytype_enum.CU_MEMORYTYPE_ARRAY): - p[0].dstArray = cd[0].dstArray - else: - p[0].dstPtr.ptr = cd[0].dstDevice - p[0].dstPtr.pitch = cd[0].dstPitch - p[0].dstPtr.ysize = cd[0].dstHeight - elif (cd[0].srcMemoryType == ccuda.CUmemorytype_enum.CU_MEMORYTYPE_UNIFIED and cd[0].dstMemoryType == ccuda.CUmemorytype_enum.CU_MEMORYTYPE_UNIFIED): - p[0].kind = cudaMemcpyDefault - - p[0].srcPtr.ptr = cd[0].srcDevice - p[0].srcPtr.pitch = cd[0].srcPitch - p[0].srcPtr.ysize = cd[0].srcHeight - - p[0].dstPtr.ptr = cd[0].dstDevice - p[0].dstPtr.pitch = cd[0].dstPitch - p[0].dstPtr.ysize = cd[0].dstHeight - elif (cd[0].srcMemoryType == ccuda.CUmemorytype_enum.CU_MEMORYTYPE_UNIFIED and cd[0].dstMemoryType == ccuda.CUmemorytype_enum.CU_MEMORYTYPE_ARRAY): - p[0].kind = cudaMemcpyDefault - - p[0].srcPtr.ptr = cd[0].srcDevice - p[0].srcPtr.pitch = cd[0].srcPitch - p[0].srcPtr.ysize = cd[0].srcHeight - - p[0].dstArray = cd[0].dstArray - elif (cd[0].srcMemoryType == ccuda.CUmemorytype_enum.CU_MEMORYTYPE_ARRAY and cd[0].dstMemoryType == ccuda.CUmemorytype_enum.CU_MEMORYTYPE_UNIFIED): - p[0].kind = cudaMemcpyDefault - - p[0].srcArray = cd[0].srcArray - - p[0].dstPtr.ptr = cd[0].dstDevice - p[0].dstPtr.pitch = cd[0].dstPitch - p[0].dstPtr.ysize = cd[0].dstHeight - else: - return cudaErrorUnknown - - cdef size_t srcElementSize = 0 - cdef size_t dstElementSize = 0 - cdef cudaError_t err = cudaSuccess - - if (cd[0].srcMemoryType == ccuda.CUmemorytype_enum.CU_MEMORYTYPE_ARRAY): - err = getFormat(cd[0].srcArray, numChannels, &srcFmt) - if err != cudaSuccess: - return err - err = getArrayBlockExtent(&srcBlockExtent, srcFmt) - if err != cudaSuccess: - return err - err = getElementSize(&srcElementSize, cd[0].srcArray) - if err != cudaSuccess: - return err - copyBlockExtent = srcBlockExtent - - if (cd[0].dstMemoryType == ccuda.CUmemorytype_enum.CU_MEMORYTYPE_ARRAY): - err = getFormat(cd[0].dstArray, numChannels, &dstFmt) - if err != cudaSuccess: - return err - err = getArrayBlockExtent(&dstBlockExtent, dstFmt) - if err != cudaSuccess: - return err - err = getElementSize(&dstElementSize, cd[0].dstArray) - if err != cudaSuccess: - return err - if cd[0].srcMemoryType != ccuda.CUmemorytype_enum.CU_MEMORYTYPE_ARRAY: - copyBlockExtent = dstBlockExtent - - if (srcElementSize and dstElementSize and srcElementSize != dstElementSize): - return cudaErrorInvalidValue - - cdef size_t elementSize = sizeof(char) - if (srcElementSize): - elementSize = srcElementSize - if (dstElementSize): - elementSize = dstElementSize - srcElementSize = elementSize - dstElementSize = elementSize - - p[0].extent.width = (cd[0].WidthInBytes / elementSize) * copyBlockExtent.width - p[0].extent.height = cd[0].Height * copyBlockExtent.height - p[0].extent.depth = cd[0].Depth - - p[0].srcPos.x = (cd[0].srcXInBytes / elementSize) * srcBlockExtent.width - p[0].srcPos.y = cd[0].srcY * srcBlockExtent.height - p[0].srcPos.z = cd[0].srcZ - - p[0].dstPos.x = (cd[0].dstXInBytes / elementSize) * dstBlockExtent.width - p[0].dstPos.y = cd[0].dstY * dstBlockExtent.height - p[0].dstPos.z = cd[0].dstZ - return cudaSuccess - - -cdef cudaError_t memcpy2DFromArray(char *dst, size_t dpitch, cudaArray_const_t src, size_t hOffset, - size_t wOffset, size_t width, size_t height, cudaMemcpyKind kind, - cudaStream_t sid, bool async) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - if width == 0 or height == 0: - return cudaSuccess - if height > 1 and width > dpitch: - return cudaErrorInvalidPitchValue - - if kind == cudaMemcpyKind.cudaMemcpyDeviceToHost: - err = copyToHost2D(src, hOffset, wOffset, dst, dpitch, width, height, sid, async) - elif kind == cudaMemcpyKind.cudaMemcpyDeviceToDevice: - err = copyToDevice2D(ccuda.CUmemorytype_enum.CU_MEMORYTYPE_DEVICE, src, hOffset, wOffset, dst, 0, dpitch, width, height, sid, async) - elif kind == cudaMemcpyKind.cudaMemcpyDefault: - err = copyToDevice2D(ccuda.CUmemorytype_enum.CU_MEMORYTYPE_UNIFIED, src, hOffset, wOffset, dst, 0, dpitch, width, height, sid, async) - else: - return cudaErrorInvalidMemcpyDirection - return err - - -cdef cudaError_t memcpy2DArrayToArray(cudaArray_t dst, size_t hOffsetDst, size_t wOffsetDst, - cudaArray_const_t src, size_t hOffsetSrc, size_t wOffsetSrc, - size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: - if width == 0 or height == 0: - return cudaSuccess - if kind != cudaMemcpyKind.cudaMemcpyDeviceToDevice and kind != cudaMemcpyKind.cudaMemcpyDefault: - return cudaErrorInvalidMemcpyDirection - return copyToArray2D(src, hOffsetSrc, wOffsetSrc, dst, hOffsetDst, wOffsetDst, width, height) - - -cdef cudaError_t memset3DPtr(cudaPitchedPtr p, int val, cudaExtent e, cudaStream_t sid, bool async) except ?cudaErrorCallRequiresNewerDriver nogil: - if e.width == 0 or e.height == 0 or e.depth == 0: - return cudaSuccess - - if (e.height > 1 or e.depth > 1) and e.width > p.pitch: - return cudaErrorInvalidValue - - if e.depth > 0 and e.height > p.ysize: - return cudaErrorInvalidValue - - cdef char *ptr = p.ptr - cdef size_t d - cdef cudaError_t err = cudaSuccess - - if e.width >= p.xsize and e.height == p.ysize and e.width == p.pitch: - return memsetPtr(ptr, val, e.width * e.height * e.depth, sid, async) - elif e.height == p.ysize: - return memset2DPtr(ptr, p.pitch, val, e.width, e.height * e.depth, sid, async) - else: - d = 0 - while (d != e.depth): - err = memset2DPtr(ptr, p.pitch, val, e.width, e.height, sid, async) - if err != cudaSuccess: - return err - ptr += p.pitch * p.ysize - d += 1 - return cudaSuccess - - -cdef cudaError_t memcpyToArray(cudaArray_t dst, size_t hOffset, size_t wOffset, const char *src, - size_t count, cudaMemcpyKind kind, - cudaStream_t sid, bool async) except ?cudaErrorCallRequiresNewerDriver nogil: - if count == 0: - return cudaSuccess - - if kind == cudaMemcpyKind.cudaMemcpyHostToDevice: - return copyFromHost(dst, hOffset, wOffset, src, count, sid, async) - elif kind == cudaMemcpyKind.cudaMemcpyDeviceToDevice: - return copyFromDevice(ccuda.CUmemorytype_enum.CU_MEMORYTYPE_DEVICE, dst, hOffset, wOffset, src, 0, count, sid, async) - elif kind == cudaMemcpyKind.cudaMemcpyDefault: - return copyFromDevice(ccuda.CUmemorytype_enum.CU_MEMORYTYPE_UNIFIED, dst, hOffset, wOffset, src, 0, count, sid, async) - elif kind == cudaMemcpyKind.cudaMemcpyHostToHost or kind == cudaMemcpyKind.cudaMemcpyDeviceToHost: - return cudaErrorInvalidMemcpyDirection - return cudaSuccess - - -cdef cudaError_t memcpyFromArray(char *dst, cudaArray_const_t src, size_t hOffset, size_t wOffset, - size_t count, cudaMemcpyKind kind, - cudaStream_t sid, bool async) except ?cudaErrorCallRequiresNewerDriver nogil: - if count == 0: - return cudaSuccess - - if kind == cudaMemcpyKind.cudaMemcpyDeviceToHost: - return copyToHost(src, hOffset, wOffset, dst, count, sid, async) - elif kind == cudaMemcpyKind.cudaMemcpyDeviceToDevice: - return copyToDevice(ccuda.CUmemorytype_enum.CU_MEMORYTYPE_DEVICE, src, hOffset, wOffset, dst, 0, count, sid, async) - elif kind == cudaMemcpyKind.cudaMemcpyDefault: - return copyToDevice(ccuda.CUmemorytype_enum.CU_MEMORYTYPE_UNIFIED, src, hOffset, wOffset, dst, 0, count, sid, async) - elif kind == cudaMemcpyKind.cudaMemcpyHostToDevice or kind == cudaMemcpyKind.cudaMemcpyHostToHost: - return cudaErrorInvalidMemcpyDirection - return cudaSuccess - - -cdef cudaError_t toDriverCudaResourceDesc(ccuda.CUDA_RESOURCE_DESC *_driver_pResDesc, const cudaResourceDesc *pResDesc) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - cdef int numChannels - cdef ccuda.CUarray_format format - - if pResDesc[0].resType == cudaResourceType.cudaResourceTypeArray: - _driver_pResDesc[0].resType = ccuda.CUresourcetype_enum.CU_RESOURCE_TYPE_ARRAY - _driver_pResDesc[0].res.array.hArray = pResDesc[0].res.array.array - elif pResDesc[0].resType == cudaResourceType.cudaResourceTypeMipmappedArray: - _driver_pResDesc[0].resType = ccuda.CUresourcetype_enum.CU_RESOURCE_TYPE_MIPMAPPED_ARRAY - _driver_pResDesc[0].res.mipmap.hMipmappedArray = pResDesc[0].res.mipmap.mipmap - elif pResDesc[0].resType == cudaResourceType.cudaResourceTypeLinear: - _driver_pResDesc[0].resType = ccuda.CUresourcetype_enum.CU_RESOURCE_TYPE_LINEAR - _driver_pResDesc[0].res.linear.devPtr = pResDesc[0].res.linear.devPtr - _driver_pResDesc[0].res.linear.sizeInBytes = pResDesc[0].res.linear.sizeInBytes - err = getDescInfo(&pResDesc[0].res.linear.desc, &numChannels, &format) - if err != cudaSuccess: - _setLastError(err) - return err - _driver_pResDesc[0].res.linear.format = format - _driver_pResDesc[0].res.linear.numChannels = numChannels - elif pResDesc[0].resType == cudaResourceType.cudaResourceTypePitch2D: - _driver_pResDesc[0].resType = ccuda.CUresourcetype_enum.CU_RESOURCE_TYPE_PITCH2D - _driver_pResDesc[0].res.pitch2D.devPtr = pResDesc[0].res.pitch2D.devPtr - _driver_pResDesc[0].res.pitch2D.pitchInBytes = pResDesc[0].res.pitch2D.pitchInBytes - _driver_pResDesc[0].res.pitch2D.width = pResDesc[0].res.pitch2D.width - _driver_pResDesc[0].res.pitch2D.height = pResDesc[0].res.pitch2D.height - err = getDescInfo(&pResDesc[0].res.linear.desc, &numChannels, &format) - if err != cudaSuccess: - _setLastError(err) - return err - _driver_pResDesc[0].res.pitch2D.format = format - _driver_pResDesc[0].res.pitch2D.numChannels = numChannels - else: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - _driver_pResDesc[0].flags = 0 - - return err - - -cdef cudaError_t getDriverEglFrame(ccuda.CUeglFrame *cuEglFrame, cudaEglFrame eglFrame) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - cdef unsigned int i = 0 - - err = getDescInfo(&eglFrame.planeDesc[0].channelDesc, &cuEglFrame[0].numChannels, &cuEglFrame[0].cuFormat) - if err != cudaSuccess: - return err - for i in range(eglFrame.planeCount): - if eglFrame.frameType == cudaEglFrameTypeArray: - cuEglFrame[0].frame.pArray[i] = eglFrame.frame.pArray[i] - else: - cuEglFrame[0].frame.pPitch[i] = eglFrame.frame.pPitch[i].ptr - cuEglFrame[0].width = eglFrame.planeDesc[0].width - cuEglFrame[0].height = eglFrame.planeDesc[0].height - cuEglFrame[0].depth = eglFrame.planeDesc[0].depth - cuEglFrame[0].pitch = eglFrame.planeDesc[0].pitch - cuEglFrame[0].planeCount = eglFrame.planeCount - if eglFrame.eglColorFormat == cudaEglColorFormatYUV420Planar: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_PLANAR - elif eglFrame.eglColorFormat == cudaEglColorFormatYUV420SemiPlanar: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR - elif eglFrame.eglColorFormat == cudaEglColorFormatYUV422Planar: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV422_PLANAR - elif eglFrame.eglColorFormat == cudaEglColorFormatYUV422SemiPlanar: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV422_SEMIPLANAR - elif eglFrame.eglColorFormat == cudaEglColorFormatYUV444Planar: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV444_PLANAR - elif eglFrame.eglColorFormat == cudaEglColorFormatYUV444SemiPlanar: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV444_SEMIPLANAR - elif eglFrame.eglColorFormat == cudaEglColorFormatYUYV422: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUYV_422 - elif eglFrame.eglColorFormat == cudaEglColorFormatUYVY422: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_UYVY_422 - elif eglFrame.eglColorFormat == cudaEglColorFormatARGB: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_ARGB - elif eglFrame.eglColorFormat == cudaEglColorFormatRGBA: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_RGBA - elif eglFrame.eglColorFormat == cudaEglColorFormatABGR: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_ABGR - elif eglFrame.eglColorFormat == cudaEglColorFormatBGRA: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BGRA - elif eglFrame.eglColorFormat == cudaEglColorFormatL: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_L - elif eglFrame.eglColorFormat == cudaEglColorFormatR: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_R - elif eglFrame.eglColorFormat == cudaEglColorFormatA: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_A - elif eglFrame.eglColorFormat == cudaEglColorFormatRG: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_RG - elif eglFrame.eglColorFormat == cudaEglColorFormatAYUV: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_AYUV - elif eglFrame.eglColorFormat == cudaEglColorFormatYVU444SemiPlanar: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU444_SEMIPLANAR - elif eglFrame.eglColorFormat == cudaEglColorFormatYVU422SemiPlanar: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU422_SEMIPLANAR - elif eglFrame.eglColorFormat == cudaEglColorFormatYVU420SemiPlanar: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR - elif eglFrame.eglColorFormat == cudaEglColorFormatY10V10U10_444SemiPlanar: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR - elif eglFrame.eglColorFormat == cudaEglColorFormatY10V10U10_420SemiPlanar: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR - elif eglFrame.eglColorFormat == cudaEglColorFormatY12V12U12_444SemiPlanar: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR - elif eglFrame.eglColorFormat == cudaEglColorFormatY12V12U12_420SemiPlanar: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR - elif eglFrame.eglColorFormat == cudaEglColorFormatVYUY_ER: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_VYUY_ER - elif eglFrame.eglColorFormat == cudaEglColorFormatUYVY_ER: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_UYVY_ER - elif eglFrame.eglColorFormat == cudaEglColorFormatYUYV_ER: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUYV_ER - elif eglFrame.eglColorFormat == cudaEglColorFormatYVYU_ER: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVYU_ER - elif eglFrame.eglColorFormat == cudaEglColorFormatYUVA_ER: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUVA_ER - elif eglFrame.eglColorFormat == cudaEglColorFormatAYUV_ER: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_AYUV_ER - elif eglFrame.eglColorFormat == cudaEglColorFormatYUV444Planar_ER: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV444_PLANAR_ER - elif eglFrame.eglColorFormat == cudaEglColorFormatYUV422Planar_ER: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV422_PLANAR_ER - elif eglFrame.eglColorFormat == cudaEglColorFormatYUV420Planar_ER: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_PLANAR_ER - elif eglFrame.eglColorFormat == cudaEglColorFormatYUV444SemiPlanar_ER: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV444_SEMIPLANAR_ER - elif eglFrame.eglColorFormat == cudaEglColorFormatYUV422SemiPlanar_ER: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV422_SEMIPLANAR_ER - elif eglFrame.eglColorFormat == cudaEglColorFormatYUV420SemiPlanar_ER: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR_ER - elif eglFrame.eglColorFormat == cudaEglColorFormatYVU444Planar_ER: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU444_PLANAR_ER - elif eglFrame.eglColorFormat == cudaEglColorFormatYVU422Planar_ER: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU422_PLANAR_ER - elif eglFrame.eglColorFormat == cudaEglColorFormatYVU420Planar_ER: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_PLANAR_ER - elif eglFrame.eglColorFormat == cudaEglColorFormatYVU444SemiPlanar_ER: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU444_SEMIPLANAR_ER - elif eglFrame.eglColorFormat == cudaEglColorFormatYVU422SemiPlanar_ER: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU422_SEMIPLANAR_ER - elif eglFrame.eglColorFormat == cudaEglColorFormatYVU420SemiPlanar_ER: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR_ER - elif eglFrame.eglColorFormat == cudaEglColorFormatBayerRGGB: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_RGGB - elif eglFrame.eglColorFormat == cudaEglColorFormatBayerBGGR: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_BGGR - elif eglFrame.eglColorFormat == cudaEglColorFormatBayerGRBG: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_GRBG - elif eglFrame.eglColorFormat == cudaEglColorFormatBayerGBRG: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_GBRG - elif eglFrame.eglColorFormat == cudaEglColorFormatBayer10RGGB: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER10_RGGB - elif eglFrame.eglColorFormat == cudaEglColorFormatBayer10BGGR: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER10_BGGR - elif eglFrame.eglColorFormat == cudaEglColorFormatBayer10GRBG: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER10_GRBG - elif eglFrame.eglColorFormat == cudaEglColorFormatBayer10GBRG: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER10_GBRG - elif eglFrame.eglColorFormat == cudaEglColorFormatBayer12RGGB: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_RGGB - elif eglFrame.eglColorFormat == cudaEglColorFormatBayer12BGGR: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_BGGR - elif eglFrame.eglColorFormat == cudaEglColorFormatBayer12GRBG: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_GRBG - elif eglFrame.eglColorFormat == cudaEglColorFormatBayer12GBRG: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_GBRG - elif eglFrame.eglColorFormat == cudaEglColorFormatBayer14RGGB: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER14_RGGB - elif eglFrame.eglColorFormat == cudaEglColorFormatBayer14BGGR: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER14_BGGR - elif eglFrame.eglColorFormat == cudaEglColorFormatBayer14GRBG: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER14_GRBG - elif eglFrame.eglColorFormat == cudaEglColorFormatBayer14GBRG: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER14_GBRG - elif eglFrame.eglColorFormat == cudaEglColorFormatBayer20RGGB: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER20_RGGB - elif eglFrame.eglColorFormat == cudaEglColorFormatBayer20BGGR: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER20_BGGR - elif eglFrame.eglColorFormat == cudaEglColorFormatBayer20GRBG: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER20_GRBG - elif eglFrame.eglColorFormat == cudaEglColorFormatBayer20GBRG: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER20_GBRG - elif eglFrame.eglColorFormat == cudaEglColorFormatBayerIspRGGB: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_ISP_RGGB - elif eglFrame.eglColorFormat == cudaEglColorFormatBayerIspBGGR: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_ISP_BGGR - elif eglFrame.eglColorFormat == cudaEglColorFormatBayerIspGRBG: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_ISP_GRBG - elif eglFrame.eglColorFormat == cudaEglColorFormatBayerIspGBRG: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_ISP_GBRG - elif eglFrame.eglColorFormat == cudaEglColorFormatYVU444Planar: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU444_PLANAR - elif eglFrame.eglColorFormat == cudaEglColorFormatYVU422Planar: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU422_PLANAR - elif eglFrame.eglColorFormat == cudaEglColorFormatYVU420Planar: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_PLANAR - elif eglFrame.eglColorFormat == cudaEglColorFormatBayerBCCR: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_BCCR - elif eglFrame.eglColorFormat == cudaEglColorFormatBayerRCCB: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_RCCB - elif eglFrame.eglColorFormat == cudaEglColorFormatBayerCRBC: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_CRBC - elif eglFrame.eglColorFormat == cudaEglColorFormatBayerCBRC: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_CBRC - elif eglFrame.eglColorFormat == cudaEglColorFormatBayer10CCCC: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER10_CCCC - elif eglFrame.eglColorFormat == cudaEglColorFormatBayer12BCCR: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_BCCR - elif eglFrame.eglColorFormat == cudaEglColorFormatBayer12RCCB: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_RCCB - elif eglFrame.eglColorFormat == cudaEglColorFormatBayer12CRBC: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_CRBC - elif eglFrame.eglColorFormat == cudaEglColorFormatBayer12CBRC: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_CBRC - elif eglFrame.eglColorFormat == cudaEglColorFormatBayer12CCCC: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_CCCC - elif eglFrame.eglColorFormat == cudaEglColorFormatY: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y - elif eglFrame.eglColorFormat == cudaEglColorFormatYUV420SemiPlanar_2020: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR_2020 - elif eglFrame.eglColorFormat == cudaEglColorFormatYVU420SemiPlanar_2020: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR_2020 - elif eglFrame.eglColorFormat == cudaEglColorFormatYUV420Planar_2020: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_PLANAR_2020 - elif eglFrame.eglColorFormat == cudaEglColorFormatYVU420Planar_2020: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_PLANAR_2020 - elif eglFrame.eglColorFormat == cudaEglColorFormatYUV420SemiPlanar_709: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR_709 - elif eglFrame.eglColorFormat == cudaEglColorFormatYVU420SemiPlanar_709: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR_709 - elif eglFrame.eglColorFormat == cudaEglColorFormatYUV420Planar_709: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_PLANAR_709 - elif eglFrame.eglColorFormat == cudaEglColorFormatYVU420Planar_709: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_PLANAR_709 - elif eglFrame.eglColorFormat == cudaEglColorFormatY10V10U10_420SemiPlanar_709: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_709 - elif eglFrame.eglColorFormat == cudaEglColorFormatY10V10U10_420SemiPlanar_2020: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_2020 - elif eglFrame.eglColorFormat == cudaEglColorFormatY10V10U10_422SemiPlanar_2020: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR_2020 - elif eglFrame.eglColorFormat == cudaEglColorFormatY10V10U10_422SemiPlanar: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR - elif eglFrame.eglColorFormat == cudaEglColorFormatY10V10U10_422SemiPlanar_709: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR_709 - elif eglFrame.eglColorFormat == cudaEglColorFormatY_ER: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y_ER - elif eglFrame.eglColorFormat == cudaEglColorFormatY_709_ER: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y_709_ER - elif eglFrame.eglColorFormat == cudaEglColorFormatY10_ER: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10_ER - elif eglFrame.eglColorFormat == cudaEglColorFormatY10_709_ER: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10_709_ER - elif eglFrame.eglColorFormat == cudaEglColorFormatY12_ER: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12_ER - elif eglFrame.eglColorFormat == cudaEglColorFormatY12_709_ER: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12_709_ER - elif eglFrame.eglColorFormat == cudaEglColorFormatYUVA: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUVA - elif eglFrame.eglColorFormat == cudaEglColorFormatYVYU: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVYU - elif eglFrame.eglColorFormat == cudaEglColorFormatVYUY: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_VYUY - elif eglFrame.eglColorFormat == cudaEglColorFormatY10V10U10_420SemiPlanar_ER: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_ER - elif eglFrame.eglColorFormat == cudaEglColorFormatY10V10U10_420SemiPlanar_709_ER: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_709_ER - elif eglFrame.eglColorFormat == cudaEglColorFormatY10V10U10_444SemiPlanar_ER: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR_ER - elif eglFrame.eglColorFormat == cudaEglColorFormatY10V10U10_444SemiPlanar_709_ER: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR_709_ER - elif eglFrame.eglColorFormat == cudaEglColorFormatY12V12U12_420SemiPlanar_ER: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR_ER - elif eglFrame.eglColorFormat == cudaEglColorFormatY12V12U12_420SemiPlanar_709_ER: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR_709_ER - elif eglFrame.eglColorFormat == cudaEglColorFormatY12V12U12_444SemiPlanar_ER: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR_ER - elif eglFrame.eglColorFormat == cudaEglColorFormatY12V12U12_444SemiPlanar_709_ER: - cuEglFrame[0].eglColorFormat = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR_709_ER - else: - return cudaErrorInvalidValue - if eglFrame.frameType == cudaEglFrameTypeArray: - cuEglFrame[0].frameType = ccuda.CUeglFrameType_enum.CU_EGL_FRAME_TYPE_ARRAY - elif eglFrame.frameType == cudaEglFrameTypePitch: - cuEglFrame[0].frameType = ccuda.CUeglFrameType_enum.CU_EGL_FRAME_TYPE_PITCH - else: - return cudaErrorInvalidValue - - -@cython.show_performance_hints(False) -cdef cudaError_t getRuntimeEglFrame(cudaEglFrame *eglFrame, ccuda.CUeglFrame cueglFrame) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - cdef unsigned int i - cdef ccuda.CUDA_ARRAY3D_DESCRIPTOR_v2 ad - cdef cudaPitchedPtr pPtr - memset(eglFrame, 0, sizeof(eglFrame[0])) - memset(&ad, 0, sizeof(ad)) - for i in range(cueglFrame.planeCount): - ad.Depth = cueglFrame.depth - ad.Flags = 0 - ad.Format = cueglFrame.cuFormat - ad.Height = cueglFrame.height - ad.NumChannels = cueglFrame.numChannels - ad.Width = cueglFrame.width - - err = getChannelFormatDescFromDriverDesc(&eglFrame[0].planeDesc[i].channelDesc, NULL, NULL, NULL, &ad) - if err != cudaSuccess: - return err - - eglFrame[0].planeDesc[i].depth = cueglFrame.depth - eglFrame[0].planeDesc[i].numChannels = cueglFrame.numChannels - if i == 0: - eglFrame[0].planeDesc[i].width = cueglFrame.width - eglFrame[0].planeDesc[i].height = cueglFrame.height - eglFrame[0].planeDesc[i].pitch = cueglFrame.pitch - elif (cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_PLANAR or - cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_PLANAR_ER or - cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_PLANAR or - cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_PLANAR_ER or - cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_PLANAR_2020 or - cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_PLANAR_2020 or - cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_PLANAR_709 or - cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_PLANAR_709): - eglFrame[0].planeDesc[i].width = (cueglFrame.width / 2) - eglFrame[0].planeDesc[i].height = (cueglFrame.height / 2) - eglFrame[0].planeDesc[i].pitch = (cueglFrame.pitch / 2) - elif (cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR or - cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR_ER or - cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR or - cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR_ER or - cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR or - cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR or - cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR_2020 or - cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR_2020 or - cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR_709 or - cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR_709 or - cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_709 or - cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_2020 or - cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_ER or - cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_709_ER or - cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR_ER or - cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR_709_ER): - eglFrame[0].planeDesc[i].width = (cueglFrame.width / 2) - eglFrame[0].planeDesc[i].height = (cueglFrame.height / 2) - eglFrame[0].planeDesc[i].pitch = (cueglFrame.pitch / 2) - eglFrame[0].planeDesc[1].channelDesc.y = 8 - if (cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR or - cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR or - cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_709 or - cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_2020 or - cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_ER or - cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_709_ER or - cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR_ER or - cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR_709_ER): - eglFrame[0].planeDesc[1].channelDesc.y = 16 - elif (cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV422_PLANAR or - cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV422_PLANAR_ER or - cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU422_PLANAR or - cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU422_PLANAR_ER): - eglFrame[0].planeDesc[i].height = cueglFrame.height - eglFrame[0].planeDesc[i].width = (cueglFrame.width / 2) - eglFrame[0].planeDesc[i].pitch = (cueglFrame.pitch / 2) - elif (cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV422_SEMIPLANAR or - cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV422_SEMIPLANAR_ER or - cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU422_SEMIPLANAR or - cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU422_SEMIPLANAR_ER or - cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR_2020 or - cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR or - cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR_709): - eglFrame[0].planeDesc[i].width = (cueglFrame.width / 2) - eglFrame[0].planeDesc[i].height = cueglFrame.height - eglFrame[0].planeDesc[i].pitch = (cueglFrame.pitch / 2) - eglFrame[0].planeDesc[1].channelDesc.y = 8 - if (cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR_2020 or - cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR or - cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR_709): - eglFrame[0].planeDesc[1].channelDesc.y = 16 - elif (cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV444_PLANAR or - cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV444_PLANAR_ER or - cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU444_PLANAR or - cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU444_PLANAR_ER): - eglFrame[0].planeDesc[i].height = cueglFrame.height - eglFrame[0].planeDesc[i].width = cueglFrame.width - eglFrame[0].planeDesc[i].pitch = cueglFrame.pitch - elif (cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV444_SEMIPLANAR or - cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV444_SEMIPLANAR_ER or - cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU444_SEMIPLANAR or - cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU444_SEMIPLANAR_ER or - cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR or - cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR or - cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR_ER or - cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR_709_ER or - cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR_ER or - cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR_709_ER): - eglFrame[0].planeDesc[i].height = cueglFrame.height - eglFrame[0].planeDesc[i].width = cueglFrame.width - eglFrame[0].planeDesc[i].pitch = cueglFrame.pitch - eglFrame[0].planeDesc[1].channelDesc.y = 8 - if (cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR or - cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR or - cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR_ER or - cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR_709_ER or - cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR_ER or - cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR_709_ER): - eglFrame[0].planeDesc[1].channelDesc.y = 16 - if cueglFrame.frameType == ccuda.CUeglFrameType_enum.CU_EGL_FRAME_TYPE_ARRAY: - eglFrame[0].frame.pArray[i] = cueglFrame.frame.pArray[i] - else: - pPtr = make_cudaPitchedPtr(cueglFrame.frame.pPitch[i], eglFrame[0].planeDesc[i].pitch, - eglFrame[0].planeDesc[i].width, eglFrame[0].planeDesc[i].height) - eglFrame[0].frame.pPitch[i] = pPtr - - eglFrame[0].planeCount = cueglFrame.planeCount - if cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_PLANAR: - eglFrame[0].eglColorFormat = cudaEglColorFormatYUV420Planar - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR: - eglFrame[0].eglColorFormat = cudaEglColorFormatYUV420SemiPlanar - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV422_PLANAR: - eglFrame[0].eglColorFormat = cudaEglColorFormatYUV422Planar - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV422_SEMIPLANAR: - eglFrame[0].eglColorFormat = cudaEglColorFormatYUV422SemiPlanar - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV444_PLANAR: - eglFrame[0].eglColorFormat = cudaEglColorFormatYUV444Planar - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV444_SEMIPLANAR: - eglFrame[0].eglColorFormat = cudaEglColorFormatYUV444SemiPlanar - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUYV_422: - eglFrame[0].eglColorFormat = cudaEglColorFormatYUYV422 - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_UYVY_422: - eglFrame[0].eglColorFormat = cudaEglColorFormatUYVY422 - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_ARGB: - eglFrame[0].eglColorFormat = cudaEglColorFormatARGB - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_RGBA: - eglFrame[0].eglColorFormat = cudaEglColorFormatRGBA - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_ABGR: - eglFrame[0].eglColorFormat = cudaEglColorFormatABGR - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BGRA: - eglFrame[0].eglColorFormat = cudaEglColorFormatBGRA - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_L: - eglFrame[0].eglColorFormat = cudaEglColorFormatL - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_R: - eglFrame[0].eglColorFormat = cudaEglColorFormatR - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_A: - eglFrame[0].eglColorFormat = cudaEglColorFormatA - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_RG: - eglFrame[0].eglColorFormat = cudaEglColorFormatRG - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_AYUV: - eglFrame[0].eglColorFormat = cudaEglColorFormatAYUV - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU444_SEMIPLANAR: - eglFrame[0].eglColorFormat = cudaEglColorFormatYVU444SemiPlanar - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU422_SEMIPLANAR: - eglFrame[0].eglColorFormat = cudaEglColorFormatYVU422SemiPlanar - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR: - eglFrame[0].eglColorFormat = cudaEglColorFormatYVU420SemiPlanar - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR: - eglFrame[0].eglColorFormat = cudaEglColorFormatY10V10U10_444SemiPlanar - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR: - eglFrame[0].eglColorFormat = cudaEglColorFormatY10V10U10_420SemiPlanar - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR: - eglFrame[0].eglColorFormat = cudaEglColorFormatY12V12U12_444SemiPlanar - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR: - eglFrame[0].eglColorFormat = cudaEglColorFormatY12V12U12_420SemiPlanar - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_VYUY_ER: - eglFrame[0].eglColorFormat = cudaEglColorFormatVYUY_ER - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_UYVY_ER: - eglFrame[0].eglColorFormat = cudaEglColorFormatUYVY_ER - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUYV_ER: - eglFrame[0].eglColorFormat = cudaEglColorFormatYUYV_ER - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVYU_ER: - eglFrame[0].eglColorFormat = cudaEglColorFormatYVYU_ER - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUVA_ER: - eglFrame[0].eglColorFormat = cudaEglColorFormatYUVA_ER - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_AYUV_ER: - eglFrame[0].eglColorFormat = cudaEglColorFormatAYUV_ER - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV444_PLANAR_ER: - eglFrame[0].eglColorFormat = cudaEglColorFormatYUV444Planar_ER - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV422_PLANAR_ER: - eglFrame[0].eglColorFormat = cudaEglColorFormatYUV422Planar_ER - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_PLANAR_ER: - eglFrame[0].eglColorFormat = cudaEglColorFormatYUV420Planar_ER - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV444_SEMIPLANAR_ER: - eglFrame[0].eglColorFormat = cudaEglColorFormatYUV444SemiPlanar_ER - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV422_SEMIPLANAR_ER: - eglFrame[0].eglColorFormat = cudaEglColorFormatYUV422SemiPlanar_ER - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR_ER: - eglFrame[0].eglColorFormat = cudaEglColorFormatYUV420SemiPlanar_ER - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU444_PLANAR_ER: - eglFrame[0].eglColorFormat = cudaEglColorFormatYVU444Planar_ER - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU422_PLANAR_ER: - eglFrame[0].eglColorFormat = cudaEglColorFormatYVU422Planar_ER - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_PLANAR_ER: - eglFrame[0].eglColorFormat = cudaEglColorFormatYVU420Planar_ER - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU444_SEMIPLANAR_ER: - eglFrame[0].eglColorFormat = cudaEglColorFormatYVU444SemiPlanar_ER - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU422_SEMIPLANAR_ER: - eglFrame[0].eglColorFormat = cudaEglColorFormatYVU422SemiPlanar_ER - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR_ER: - eglFrame[0].eglColorFormat = cudaEglColorFormatYVU420SemiPlanar_ER - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_RGGB: - eglFrame[0].eglColorFormat = cudaEglColorFormatBayerRGGB - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_BGGR: - eglFrame[0].eglColorFormat = cudaEglColorFormatBayerBGGR - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_GRBG: - eglFrame[0].eglColorFormat = cudaEglColorFormatBayerGRBG - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_GBRG: - eglFrame[0].eglColorFormat = cudaEglColorFormatBayerGBRG - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER10_RGGB: - eglFrame[0].eglColorFormat = cudaEglColorFormatBayer10RGGB - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER10_BGGR: - eglFrame[0].eglColorFormat = cudaEglColorFormatBayer10BGGR - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER10_GRBG: - eglFrame[0].eglColorFormat = cudaEglColorFormatBayer10GRBG - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER10_GBRG: - eglFrame[0].eglColorFormat = cudaEglColorFormatBayer10GBRG - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_RGGB: - eglFrame[0].eglColorFormat = cudaEglColorFormatBayer12RGGB - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_BGGR: - eglFrame[0].eglColorFormat = cudaEglColorFormatBayer12BGGR - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_GRBG: - eglFrame[0].eglColorFormat = cudaEglColorFormatBayer12GRBG - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_GBRG: - eglFrame[0].eglColorFormat = cudaEglColorFormatBayer12GBRG - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER14_RGGB: - eglFrame[0].eglColorFormat = cudaEglColorFormatBayer14RGGB - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER14_BGGR: - eglFrame[0].eglColorFormat = cudaEglColorFormatBayer14BGGR - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER14_GRBG: - eglFrame[0].eglColorFormat = cudaEglColorFormatBayer14GRBG - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER14_GBRG: - eglFrame[0].eglColorFormat = cudaEglColorFormatBayer14GBRG - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER20_RGGB: - eglFrame[0].eglColorFormat = cudaEglColorFormatBayer20RGGB - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER20_BGGR: - eglFrame[0].eglColorFormat = cudaEglColorFormatBayer20BGGR - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER20_GRBG: - eglFrame[0].eglColorFormat = cudaEglColorFormatBayer20GRBG - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER20_GBRG: - eglFrame[0].eglColorFormat = cudaEglColorFormatBayer20GBRG - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_ISP_RGGB: - eglFrame[0].eglColorFormat = cudaEglColorFormatBayerIspRGGB - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_ISP_BGGR: - eglFrame[0].eglColorFormat = cudaEglColorFormatBayerIspBGGR - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_ISP_GRBG: - eglFrame[0].eglColorFormat = cudaEglColorFormatBayerIspGRBG - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_ISP_GBRG: - eglFrame[0].eglColorFormat = cudaEglColorFormatBayerIspGBRG - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU444_PLANAR: - eglFrame[0].eglColorFormat = cudaEglColorFormatYVU444Planar - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU422_PLANAR: - eglFrame[0].eglColorFormat = cudaEglColorFormatYVU422Planar - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_PLANAR: - eglFrame[0].eglColorFormat = cudaEglColorFormatYVU420Planar - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_BCCR: - eglFrame[0].eglColorFormat = cudaEglColorFormatBayerBCCR - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_RCCB: - eglFrame[0].eglColorFormat = cudaEglColorFormatBayerRCCB - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_CRBC: - eglFrame[0].eglColorFormat = cudaEglColorFormatBayerCRBC - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_CBRC: - eglFrame[0].eglColorFormat = cudaEglColorFormatBayerCBRC - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER10_CCCC: - eglFrame[0].eglColorFormat = cudaEglColorFormatBayer10CCCC - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_BCCR: - eglFrame[0].eglColorFormat = cudaEglColorFormatBayer12BCCR - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_RCCB: - eglFrame[0].eglColorFormat = cudaEglColorFormatBayer12RCCB - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_CRBC: - eglFrame[0].eglColorFormat = cudaEglColorFormatBayer12CRBC - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_CBRC: - eglFrame[0].eglColorFormat = cudaEglColorFormatBayer12CBRC - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_CCCC: - eglFrame[0].eglColorFormat = cudaEglColorFormatBayer12CCCC - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y: - eglFrame[0].eglColorFormat = cudaEglColorFormatY - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR_2020: - eglFrame[0].eglColorFormat = cudaEglColorFormatYUV420SemiPlanar_2020 - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR_2020: - eglFrame[0].eglColorFormat = cudaEglColorFormatYVU420SemiPlanar_2020 - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_PLANAR_2020: - eglFrame[0].eglColorFormat = cudaEglColorFormatYUV420Planar_2020 - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_PLANAR_2020: - eglFrame[0].eglColorFormat = cudaEglColorFormatYVU420Planar_2020 - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR_709: - eglFrame[0].eglColorFormat = cudaEglColorFormatYUV420SemiPlanar_709 - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR_709: - eglFrame[0].eglColorFormat = cudaEglColorFormatYVU420SemiPlanar_709 - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_PLANAR_709: - eglFrame[0].eglColorFormat = cudaEglColorFormatYUV420Planar_709 - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_PLANAR_709: - eglFrame[0].eglColorFormat = cudaEglColorFormatYVU420Planar_709 - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_709: - eglFrame[0].eglColorFormat = cudaEglColorFormatY10V10U10_420SemiPlanar_709 - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_2020: - eglFrame[0].eglColorFormat = cudaEglColorFormatY10V10U10_420SemiPlanar_2020 - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR_2020: - eglFrame[0].eglColorFormat = cudaEglColorFormatY10V10U10_422SemiPlanar_2020 - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR: - eglFrame[0].eglColorFormat = cudaEglColorFormatY10V10U10_422SemiPlanar - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR_709: - eglFrame[0].eglColorFormat = cudaEglColorFormatY10V10U10_422SemiPlanar_709 - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y_ER: - eglFrame[0].eglColorFormat = cudaEglColorFormatY_ER - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y_709_ER: - eglFrame[0].eglColorFormat = cudaEglColorFormatY_709_ER - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10_ER: - eglFrame[0].eglColorFormat = cudaEglColorFormatY10_ER - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10_709_ER: - eglFrame[0].eglColorFormat = cudaEglColorFormatY10_709_ER - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12_ER: - eglFrame[0].eglColorFormat = cudaEglColorFormatY12_ER - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12_709_ER: - eglFrame[0].eglColorFormat = cudaEglColorFormatY12_709_ER - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUVA: - eglFrame[0].eglColorFormat = cudaEglColorFormatYUVA - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVYU: - eglFrame[0].eglColorFormat = cudaEglColorFormatYVYU - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_VYUY: - eglFrame[0].eglColorFormat = cudaEglColorFormatVYUY - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_ER: - eglFrame[0].eglColorFormat = cudaEglColorFormatY10V10U10_420SemiPlanar_ER - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_709_ER: - eglFrame[0].eglColorFormat = cudaEglColorFormatY10V10U10_420SemiPlanar_709_ER - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR_ER: - eglFrame[0].eglColorFormat = cudaEglColorFormatY10V10U10_444SemiPlanar_ER - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR_709_ER: - eglFrame[0].eglColorFormat = cudaEglColorFormatY10V10U10_444SemiPlanar_709_ER - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR_ER: - eglFrame[0].eglColorFormat = cudaEglColorFormatY12V12U12_420SemiPlanar_ER - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR_709_ER: - eglFrame[0].eglColorFormat = cudaEglColorFormatY12V12U12_420SemiPlanar_709_ER - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR_ER: - eglFrame[0].eglColorFormat = cudaEglColorFormatY12V12U12_444SemiPlanar_ER - elif cueglFrame.eglColorFormat == ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR_709_ER: - eglFrame[0].eglColorFormat = cudaEglColorFormatY12V12U12_444SemiPlanar_709_ER - else: - return cudaErrorInvalidValue - if cueglFrame.frameType == ccuda.CUeglFrameType_enum.CU_EGL_FRAME_TYPE_ARRAY: - eglFrame[0].frameType = cudaEglFrameTypeArray - elif cueglFrame.frameType == ccuda.CUeglFrameType_enum.CU_EGL_FRAME_TYPE_PITCH: - eglFrame[0].frameType = cudaEglFrameTypePitch - else: - return cudaErrorInvalidValue - - -cdef cudaError_t toDriverGraphNodeParams(const cudaGraphNodeParams *rtParams, ccuda.CUgraphNodeParams *driverParams) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err - cdef ccuda.CUcontext context - memset(driverParams, 0, sizeof(driverParams[0])) - - if rtParams[0].type == cudaGraphNodeType.cudaGraphNodeTypeKernel: - driverParams[0].type = ccuda.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_KERNEL - err = toDriverKernelNodeParams(&rtParams[0].kernel, &driverParams[0].kernel) - if err != cudaSuccess: - return err - elif rtParams[0].type == cudaGraphNodeType.cudaGraphNodeTypeMemcpy: - driverParams[0].type = ccuda.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_MEMCPY - err = ccuda._cuCtxGetCurrent(&context) - if err != cudaSuccess: - _setLastError(err) - return err - err = toDriverMemCopy3DParams(&rtParams[0].memcpy.copyParams, &driverParams[0].memcpy.copyParams) - if err != cudaSuccess: - return err - driverParams[0].memcpy.copyCtx = context - elif rtParams[0].type == cudaGraphNodeType.cudaGraphNodeTypeMemset: - driverParams[0].type = ccuda.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_MEMSET - err = ccuda._cuCtxGetCurrent(&context) - if err != cudaSuccess: - _setLastError(err) - return err - toDriverMemsetNodeParams(&rtParams[0].memset, &driverParams[0].memset) - driverParams[0].memset.ctx = context - elif rtParams[0].type == cudaGraphNodeType.cudaGraphNodeTypeHost: - driverParams[0].type = ccuda.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_HOST - toDriverHostNodeParams(&rtParams[0].host, &driverParams[0].host) - elif rtParams[0].type == cudaGraphNodeType.cudaGraphNodeTypeGraph: - driverParams[0].type = ccuda.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_GRAPH - driverParams[0].graph.graph = rtParams[0].graph.graph - elif rtParams[0].type == cudaGraphNodeType.cudaGraphNodeTypeEmpty: - driverParams[0].type = ccuda.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_EMPTY - elif rtParams[0].type == cudaGraphNodeType.cudaGraphNodeTypeWaitEvent: - driverParams[0].type = ccuda.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_WAIT_EVENT - driverParams[0].eventWait.event = rtParams[0].eventWait.event - elif rtParams[0].type == cudaGraphNodeType.cudaGraphNodeTypeEventRecord: - driverParams[0].type = ccuda.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_EVENT_RECORD - driverParams[0].eventRecord.event = rtParams[0].eventRecord.event - elif rtParams[0].type == cudaGraphNodeType.cudaGraphNodeTypeExtSemaphoreSignal: - driverParams[0].type = ccuda.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_EXT_SEMAS_SIGNAL - driverParams[0].extSemSignal = ((&rtParams[0].extSemSignal))[0] - elif rtParams[0].type == cudaGraphNodeType.cudaGraphNodeTypeExtSemaphoreWait: - driverParams[0].type = ccuda.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_EXT_SEMAS_WAIT - driverParams[0].extSemWait = (&rtParams[0].extSemWait)[0] - elif rtParams[0].type == cudaGraphNodeType.cudaGraphNodeTypeMemAlloc: - driverParams[0].type = ccuda.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_MEM_ALLOC - driverParams[0].alloc = (&rtParams[0].alloc)[0] - elif rtParams[0].type == cudaGraphNodeType.cudaGraphNodeTypeMemFree: - driverParams[0].type = ccuda.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_MEM_FREE - driverParams[0].free.dptr = rtParams[0].free.dptr - elif rtParams[0].type == cudaGraphNodeType.cudaGraphNodeTypeConditional: - driverParams[0].type = ccuda.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_CONDITIONAL - # RT params mirror the driver params except the RT struct lacks the ctx at the end. - memcpy(&driverParams[0].conditional, &rtParams[0].conditional, sizeof(rtParams[0].conditional)) - err = ccuda._cuCtxGetCurrent(&context) - if err != cudaSuccess: - _setLastError(err) - return err - driverParams[0].conditional.ctx = context - else: - return cudaErrorInvalidValue - return cudaSuccess - - -cdef void toCudartGraphNodeOutParams(const ccuda.CUgraphNodeParams *driverParams, cudaGraphNodeParams *rtParams) noexcept nogil: - if driverParams[0].type == ccuda.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_MEM_ALLOC: - rtParams[0].alloc.dptr = driverParams[0].alloc.dptr - elif driverParams[0].type == ccuda.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_CONDITIONAL: - rtParams[0].conditional.phGraph_out = driverParams[0].conditional.phGraph_out - - -cdef cudaError_t toDriverKernelNodeParams(const cudaKernelNodeParams nodeParams[0], ccuda.CUDA_KERNEL_NODE_PARAMS *driverNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - cdef ccuda.CUcontext context - err = ccuda._cuCtxGetCurrent(&context) - if err != cudaSuccess: - _setLastError(err) - return err - driverNodeParams[0].func = nodeParams[0].func - driverNodeParams[0].kern = NULL - driverNodeParams[0].ctx = context - driverNodeParams[0].gridDimX = nodeParams[0].gridDim.x - driverNodeParams[0].gridDimY = nodeParams[0].gridDim.y - driverNodeParams[0].gridDimZ = nodeParams[0].gridDim.z - driverNodeParams[0].blockDimX = nodeParams[0].blockDim.x - driverNodeParams[0].blockDimY = nodeParams[0].blockDim.y - driverNodeParams[0].blockDimZ = nodeParams[0].blockDim.z - driverNodeParams[0].sharedMemBytes = nodeParams[0].sharedMemBytes - driverNodeParams[0].kernelParams = nodeParams[0].kernelParams - driverNodeParams[0].extra = nodeParams[0].extra - return err - - -cdef void toDriverHostNodeParams(const cudaHostNodeParams *pRuntimeNodeParams, ccuda.CUDA_HOST_NODE_PARAMS *pDriverNodeParams) noexcept nogil: - pDriverNodeParams[0].fn = pRuntimeNodeParams[0].fn - pDriverNodeParams[0].userData = pRuntimeNodeParams[0].userData - - -@cython.show_performance_hints(False) -cdef void cudaAsyncNotificationCallbackWrapper(cudaAsyncNotificationInfo_t *info, void *data, cudaAsyncCallbackHandle_t handle) nogil: - cdef cudaAsyncCallbackData *cbData = data - with gil: - cbData.callback(info, cbData.userData, handle) - - -cdef cudaError_t DeviceRegisterAsyncNotificationCommon(int device, cudaAsyncCallback callbackFunc, void* userData, cudaAsyncCallbackHandle_t* callback) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaAsyncCallbackData *cbData = NULL - cdef cudaError_t err = cudaSuccess - cbData = malloc(sizeof(cbData[0])) - - if cbData == NULL: - return cudaErrorMemoryAllocation - - cbData.callback = callbackFunc - cbData.userData = userData - err = ccuda._cuDeviceRegisterAsyncNotification(device, cudaAsyncNotificationCallbackWrapper, cbData, callback) - if err != cudaSuccess: - free(cbData) - - m_global._asyncCallbackDataMap[callback[0]] = cbData - - return err - -cdef cudaError_t DeviceUnregisterAsyncNotificationCommon(int device, cudaAsyncCallbackHandle_t callback) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = ccuda._cuDeviceUnregisterAsyncNotification(device, callback) - if err != cudaSuccess: - _setLastError(err) - return err - - free(m_global._asyncCallbackDataMap[callback]) - m_global._asyncCallbackDataMap.erase(callback) - - return err diff --git a/cuda/_lib/dlfcn.pxd b/cuda/_lib/dlfcn.pxd deleted file mode 100644 index 808c7186cf0..00000000000 --- a/cuda/_lib/dlfcn.pxd +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. -# -# Please refer to the NVIDIA end user license agreement (EULA) associated -# with this source code for terms and conditions that govern your use of -# this software. Any use, reproduction, disclosure, or distribution of -# this software and related documentation outside the terms of the EULA -# is strictly prohibited. -cdef extern from "" nogil: - void *dlopen(const char *, int) - char *dlerror() - void *dlsym(void *, const char *) - int dlclose(void *) - - enum: - RTLD_LAZY - RTLD_NOW - RTLD_GLOBAL - RTLD_LOCAL \ No newline at end of file diff --git a/cuda/_lib/param_packer.h b/cuda/_lib/param_packer.h deleted file mode 100644 index 2dfa4deb6e6..00000000000 --- a/cuda/_lib/param_packer.h +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2021-2024 NVIDIA Corporation. All rights reserved. -// -// Please refer to the NVIDIA end user license agreement (EULA) associated -// with this source code for terms and conditions that govern your use of -// this software. Any use, reproduction, disclosure, or distribution of -// this software and related documentation outside the terms of the EULA -// is strictly prohibited. -#pragma once -#include - -int feed(void* ptr, PyObject* value, PyObject* type); diff --git a/cuda/_lib/param_packer.pxd b/cuda/_lib/param_packer.pxd deleted file mode 100644 index 440006f57a3..00000000000 --- a/cuda/_lib/param_packer.pxd +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. -# -# Please refer to the NVIDIA end user license agreement (EULA) associated -# with this source code for terms and conditions that govern your use of -# this software. Any use, reproduction, disclosure, or distribution of -# this software and related documentation outside the terms of the EULA -# is strictly prohibited. -cdef extern from "param_packer.h": - int feed(void* ptr, object o, object ct) diff --git a/cuda/_lib/utils.pxd.in b/cuda/_lib/utils.pxd.in deleted file mode 100644 index 229f6be9610..00000000000 --- a/cuda/_lib/utils.pxd.in +++ /dev/null @@ -1,127 +0,0 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. -# -# Please refer to the NVIDIA end user license agreement (EULA) associated -# with this source code for terms and conditions that govern your use of -# this software. Any use, reproduction, disclosure, or distribution of -# this software and related documentation outside the terms of the EULA -# is strictly prohibited. -cimport cuda.cuda as cuda -cimport cuda.ccuda as ccuda -from libcpp.vector cimport vector - -cdef class HelperKernelParams: - cdef Py_buffer _pybuffer - cdef bint _pyobj_acquired - cdef void** _ckernelParams - cdef char* _ckernelParamsData - cdef int _length - cdef bint _malloc_list_created - -cdef class HelperInputVoidPtr: - cdef Py_buffer _pybuffer - cdef void* _cptr - cdef bint _pyobj_acquired -{{if 'CUmemPool_attribute_enum' in found_types}} - -cdef class HelperCUmemPool_attribute: - cdef void* _cptr - cdef ccuda.CUmemPool_attribute_enum _attr - cdef bint _is_getter - - # Return values - cdef int _int_val - cdef cuda.cuuint64_t _cuuint64_t_val -{{endif}} -{{if 'CUmem_range_attribute_enum' in found_types}} - -cdef class HelperCUmem_range_attribute: - cdef void* _cptr - cdef ccuda.CUmem_range_attribute_enum _attr - cdef size_t _data_size - - # Return values - cdef int _int_val # 32 bit integer - cdef int* _int_val_list # 32 bit integer array -{{endif}} -{{if 'CUpointer_attribute_enum' in found_types}} - -cdef class HelperCUpointer_attribute: - cdef void* _cptr - cdef ccuda.CUpointer_attribute_enum _attr - cdef bint _is_getter - - # Return values - cdef cuda.CUcontext _ctx - cdef unsigned int _uint - cdef cuda.CUdeviceptr _devptr - cdef void** _void - cdef cuda.CUDA_POINTER_ATTRIBUTE_P2P_TOKENS _token - cdef bint _bool - cdef unsigned long long _ull - cdef size_t _size - cdef cuda.CUmemoryPool _mempool -{{endif}} -{{if 'CUgraphMem_attribute_enum' in found_types}} - -cdef class HelperCUgraphMem_attribute: - cdef void* _cptr - cdef ccuda.CUgraphMem_attribute_enum _attr - cdef bint _is_getter - - # Return values - cdef cuda.cuuint64_t _cuuint64_t_val -{{endif}} -{{if 'CUjit_option_enum' in found_types}} - -cdef class HelperCUjit_option: - cdef void* _cptr - cdef ccuda.CUjit_option_enum _attr - - # Return values - cdef unsigned int _uint - cdef float _float - cdef char* _charstar - cdef ccuda.CUjit_target_enum _target - cdef ccuda.CUjit_fallback_enum _fallback - cdef int _int - cdef ccuda.CUjit_cacheMode_enum _cacheMode - cdef vector[char*] _charstarstar # list of names - cdef InputVoidPtrPtrHelper _voidstarstar # list of addresses -{{endif}} -{{if 'CUlibraryOption_enum' in found_types}} - -cdef class HelperCUlibraryOption: - cdef void* _cptr - cdef ccuda.CUlibraryOption_enum _attr - - # Return values - cdef unsigned int _uint -{{endif}} -{{if 'CUmemAllocationHandleType_enum' in found_types}} - -cdef class HelperCUmemAllocationHandleType: - cdef void* _cptr - cdef ccuda.CUmemAllocationHandleType_enum _type - - # Return values - cdef int _int - cdef void* _handle - cdef unsigned int _d3dkmt_handle - cdef cuda.CUmemFabricHandle _mem_fabric_handle -{{endif}} - -cdef class InputVoidPtrPtrHelper: - cdef void** _cptr - -{{if 'CUcoredumpSettings_enum' in found_types}} - -cdef class HelperCUcoredumpSettings: - cdef void* _cptr - cdef ccuda.CUcoredumpSettings_enum _attrib - cdef bint _is_getter - cdef size_t _size - - # Return values - cdef bint _bool - cdef char* _charstar -{{endif}} diff --git a/cuda/_lib/utils.pyx.in b/cuda/_lib/utils.pyx.in deleted file mode 100644 index 6f61f90b8db..00000000000 --- a/cuda/_lib/utils.pyx.in +++ /dev/null @@ -1,593 +0,0 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. -# -# Please refer to the NVIDIA end user license agreement (EULA) associated -# with this source code for terms and conditions that govern your use of -# this software. Any use, reproduction, disclosure, or distribution of -# this software and related documentation outside the terms of the EULA -# is strictly prohibited. -from cpython.buffer cimport PyObject_CheckBuffer, PyObject_GetBuffer, PyBuffer_Release, PyBUF_SIMPLE, PyBUF_ANY_CONTIGUOUS -from libc.stdlib cimport calloc, free -from libc.stdint cimport int32_t, uint32_t, int64_t, uint64_t -from libc.stddef cimport wchar_t -from libc.string cimport memcpy -from enum import Enum -from typing import List, Tuple -import ctypes -cimport cuda.ccuda as ccuda -import cuda.cuda as cuda -cimport cuda._lib.param_packer as param_packer - -ctypedef unsigned long long void_ptr - -cdef void* callocWrapper(length, size): - cdef void* out = calloc(length, size) - if out is NULL: - raise MemoryError('Failed to allocated length x size memory: {}x{}'.format(length, size)) - return out - -cdef class HelperKernelParams: - supported_types = { # excluding void_p and None, which are handled specially - ctypes.c_bool, - ctypes.c_char, - ctypes.c_wchar, - ctypes.c_byte, - ctypes.c_ubyte, - ctypes.c_short, - ctypes.c_ushort, - ctypes.c_int, - ctypes.c_uint, - ctypes.c_long, - ctypes.c_ulong, - ctypes.c_longlong, - ctypes.c_ulonglong, - ctypes.c_size_t, - ctypes.c_float, - ctypes.c_double - } - - max_param_size = max(ctypes.sizeof(max(HelperKernelParams.supported_types, key=lambda t:ctypes.sizeof(t))), sizeof(void_ptr)) - - def __cinit__(self, kernelParams): - self._pyobj_acquired = False - self._malloc_list_created = False - if kernelParams is None: - self._ckernelParams = NULL - elif isinstance(kernelParams, (int)): - # Easy run, user gave us an already configured void** address - self._ckernelParams = kernelParams - elif PyObject_CheckBuffer(kernelParams): - # Easy run, get address from Python Buffer Protocol - err_buffer = PyObject_GetBuffer(kernelParams, &self._pybuffer, PyBUF_SIMPLE | PyBUF_ANY_CONTIGUOUS) - if err_buffer == -1: - raise RuntimeError("Argument 'kernelParams' failed to retrieve buffer through Buffer Protocol") - self._pyobj_acquired = True - self._ckernelParams = self._pybuffer.buf - elif isinstance(kernelParams, (Tuple)) and len(kernelParams) == 2 and isinstance(kernelParams[0], (Tuple)) and isinstance(kernelParams[1], (Tuple)): - # Hard run, construct and fill out contigues memory using provided kernel values and types based - if len(kernelParams[0]) != len(kernelParams[1]): - raise TypeError("Argument 'kernelParams' has tuples with different length") - if len(kernelParams[0]) != 0: - self._length = len(kernelParams[0]) - self._ckernelParams = callocWrapper(len(kernelParams[0]), sizeof(void*)) - self._ckernelParamsData = callocWrapper(len(kernelParams[0]), HelperKernelParams.max_param_size) - self._malloc_list_created = True - - idx = 0 - data_idx = 0 - for value, ctype in zip(kernelParams[0], kernelParams[1]): - if ctype is None: - # special cases for None - if callable(getattr(value, 'getPtr', None)): - self._ckernelParams[idx] = value.getPtr() - elif isinstance(value, (ctypes.Structure)): - self._ckernelParams[idx] = ctypes.addressof(value) - elif isinstance(value, (Enum)): - self._ckernelParams[idx] = &(self._ckernelParamsData[data_idx]) - (self._ckernelParams[idx])[0] = value.value - data_idx += sizeof(int) - else: - raise TypeError("Provided argument is of type {} but expected Type {}, {} or CUDA Binding structure with getPtr() attribute".format(type(value), type(ctypes.Structure), type(ctypes.c_void_p))) - elif ctype in HelperKernelParams.supported_types: - self._ckernelParams[idx] = &(self._ckernelParamsData[data_idx]) - - # handle case where a float is passed as a double - if ctype == ctypes.c_double and isinstance(value, ctypes.c_float): - value = ctype(value.value) - if not isinstance(value, ctype): # make it a ctype - size = param_packer.feed(self._ckernelParams[idx], value, ctype) - if size == 0: # feed failed - value = ctype(value) - size = ctypes.sizeof(ctype) - addr = (ctypes.addressof(value)) - memcpy(self._ckernelParams[idx], addr, size) - else: - size = ctypes.sizeof(ctype) - addr = (ctypes.addressof(value)) - memcpy(self._ckernelParams[idx], addr, size) - data_idx += size - elif ctype == ctypes.c_void_p: - # special cases for void_p - if isinstance(value, (int, ctypes.c_void_p)): - self._ckernelParams[idx] = &(self._ckernelParamsData[data_idx]) - (self._ckernelParams[idx])[0] = value.value if isinstance(value, (ctypes.c_void_p)) else value - data_idx += sizeof(void_ptr) - elif callable(getattr(value, 'getPtr', None)): - self._ckernelParams[idx] = &(self._ckernelParamsData[data_idx]) - (self._ckernelParams[idx])[0] = value.getPtr() - data_idx += sizeof(void_ptr) - else: - raise TypeError("Provided argument is of type {} but expected Type {}, {} or CUDA Binding structure with getPtr() attribute".format(type(value), type(int), type(ctypes.c_void_p))) - else: - raise TypeError("Unsupported type: " + str(type(ctype))) - idx += 1 - else: - raise TypeError("Argument 'kernelParams' is not a valid type: Tuple[Tuple[Any, ...], Tuple[Any, ...]] or PyObject implimenting Buffer Protocol or Int") - - def __dealloc__(self): - if self._pyobj_acquired is True: - PyBuffer_Release(&self._pybuffer) - if self._malloc_list_created is True: - free(self._ckernelParams) - free(self._ckernelParamsData) - - @property - def ckernelParams(self): - return self._ckernelParams - -cdef class HelperInputVoidPtr: - def __cinit__(self, ptr): - self._pyobj_acquired = False - if ptr is None: - self._cptr = NULL - elif isinstance(ptr, (int)): - # Easy run, user gave us an already configured void** address - self._cptr = ptr - elif isinstance(ptr, (cuda.CUdeviceptr)): - self._cptr = int(ptr) - elif PyObject_CheckBuffer(ptr): - # Easy run, get address from Python Buffer Protocol - err_buffer = PyObject_GetBuffer(ptr, &self._pybuffer, PyBUF_SIMPLE | PyBUF_ANY_CONTIGUOUS) - if err_buffer == -1: - raise RuntimeError("Failed to retrieve buffer through Buffer Protocol") - self._pyobj_acquired = True - self._cptr = self._pybuffer.buf - else: - raise TypeError("Provided argument is of type {} but expected Type {}, {} or object with Buffer Protocol".format(type(ptr), type(None), type(int))) - - def __dealloc__(self): - if self._pyobj_acquired is True: - PyBuffer_Release(&self._pybuffer) - - @property - def cptr(self): - return self._cptr - -{{if 'CUmemPool_attribute_enum' in found_types}} - -cdef class HelperCUmemPool_attribute: - def __cinit__(self, attr, init_value, is_getter=False): - self._is_getter = is_getter - self._attr = attr.value - if self._attr in ({{if 'CU_MEMPOOL_ATTR_REUSE_FOLLOW_EVENT_DEPENDENCIES'}}ccuda.CUmemPool_attribute_enum.CU_MEMPOOL_ATTR_REUSE_FOLLOW_EVENT_DEPENDENCIES,{{endif}} - {{if 'CU_MEMPOOL_ATTR_REUSE_ALLOW_OPPORTUNISTIC'}}ccuda.CUmemPool_attribute_enum.CU_MEMPOOL_ATTR_REUSE_ALLOW_OPPORTUNISTIC,{{endif}} - {{if 'CU_MEMPOOL_ATTR_REUSE_ALLOW_INTERNAL_DEPENDENCIES'}}ccuda.CUmemPool_attribute_enum.CU_MEMPOOL_ATTR_REUSE_ALLOW_INTERNAL_DEPENDENCIES,{{endif}}): - self._int_val = init_value - self._cptr = &self._int_val - elif self._attr in ({{if 'CU_MEMPOOL_ATTR_RELEASE_THRESHOLD'}}ccuda.CUmemPool_attribute_enum.CU_MEMPOOL_ATTR_RELEASE_THRESHOLD,{{endif}} - {{if 'CU_MEMPOOL_ATTR_RESERVED_MEM_CURRENT'}}ccuda.CUmemPool_attribute_enum.CU_MEMPOOL_ATTR_RESERVED_MEM_CURRENT,{{endif}} - {{if 'CU_MEMPOOL_ATTR_RESERVED_MEM_HIGH'}}ccuda.CUmemPool_attribute_enum.CU_MEMPOOL_ATTR_RESERVED_MEM_HIGH,{{endif}} - {{if 'CU_MEMPOOL_ATTR_USED_MEM_CURRENT'}}ccuda.CUmemPool_attribute_enum.CU_MEMPOOL_ATTR_USED_MEM_CURRENT,{{endif}} - {{if 'CU_MEMPOOL_ATTR_USED_MEM_HIGH'}}ccuda.CUmemPool_attribute_enum.CU_MEMPOOL_ATTR_USED_MEM_HIGH,{{endif}}): - if self._is_getter: - self._cuuint64_t_val = cuda.cuuint64_t() - self._cptr = self._cuuint64_t_val.getPtr() - else: - self._cptr = init_value.getPtr() - else: - raise TypeError('Unsupported attribute: {}'.format(attr.name)) - - def __dealloc__(self): - pass - - @property - def cptr(self): - return self._cptr - - def pyObj(self): - assert(self._is_getter == True) - if self._attr in ({{if 'CU_MEMPOOL_ATTR_REUSE_FOLLOW_EVENT_DEPENDENCIES'}}ccuda.CUmemPool_attribute_enum.CU_MEMPOOL_ATTR_REUSE_FOLLOW_EVENT_DEPENDENCIES,{{endif}} - {{if 'CU_MEMPOOL_ATTR_REUSE_ALLOW_OPPORTUNISTIC'}}ccuda.CUmemPool_attribute_enum.CU_MEMPOOL_ATTR_REUSE_ALLOW_OPPORTUNISTIC,{{endif}} - {{if 'CU_MEMPOOL_ATTR_REUSE_ALLOW_INTERNAL_DEPENDENCIES'}}ccuda.CUmemPool_attribute_enum.CU_MEMPOOL_ATTR_REUSE_ALLOW_INTERNAL_DEPENDENCIES,{{endif}}): - return self._int_val - elif self._attr in ({{if 'CU_MEMPOOL_ATTR_RELEASE_THRESHOLD'}}ccuda.CUmemPool_attribute_enum.CU_MEMPOOL_ATTR_RELEASE_THRESHOLD,{{endif}} - {{if 'CU_MEMPOOL_ATTR_RESERVED_MEM_CURRENT'}}ccuda.CUmemPool_attribute_enum.CU_MEMPOOL_ATTR_RESERVED_MEM_CURRENT,{{endif}} - {{if 'CU_MEMPOOL_ATTR_RESERVED_MEM_HIGH'}}ccuda.CUmemPool_attribute_enum.CU_MEMPOOL_ATTR_RESERVED_MEM_HIGH,{{endif}} - {{if 'CU_MEMPOOL_ATTR_USED_MEM_CURRENT'}}ccuda.CUmemPool_attribute_enum.CU_MEMPOOL_ATTR_USED_MEM_CURRENT,{{endif}} - {{if 'CU_MEMPOOL_ATTR_USED_MEM_HIGH'}}ccuda.CUmemPool_attribute_enum.CU_MEMPOOL_ATTR_USED_MEM_HIGH,{{endif}}): - return self._cuuint64_t_val - else: - raise TypeError('Unsupported attribute value: {}'.format(self._attr)) -{{endif}} -{{if 'CUmem_range_attribute_enum' in found_types}} - -cdef class HelperCUmem_range_attribute: - def __cinit__(self, attr, data_size): - self._data_size = data_size - self._attr = attr.value - if self._attr in ({{if 'CU_MEM_RANGE_ATTRIBUTE_READ_MOSTLY'}}ccuda.CUmem_range_attribute_enum.CU_MEM_RANGE_ATTRIBUTE_READ_MOSTLY,{{endif}} - {{if 'CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION'}}ccuda.CUmem_range_attribute_enum.CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION,{{endif}} - {{if 'CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION'}}ccuda.CUmem_range_attribute_enum.CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION,{{endif}}): - self._cptr = &self._int_val - elif self._attr in ({{if 'CU_MEM_RANGE_ATTRIBUTE_ACCESSED_BY'}}ccuda.CUmem_range_attribute_enum.CU_MEM_RANGE_ATTRIBUTE_ACCESSED_BY,{{endif}}): - self._cptr = callocWrapper(1, self._data_size) - self._int_val_list = self._cptr - else: - raise TypeError('Unsupported attribute: {}'.format(attr.name)) - - def __dealloc__(self): - if self._attr in ({{if 'CU_MEM_RANGE_ATTRIBUTE_ACCESSED_BY'}}ccuda.CUmem_range_attribute_enum.CU_MEM_RANGE_ATTRIBUTE_ACCESSED_BY,{{endif}}): - free(self._cptr) - - @property - def cptr(self): - return self._cptr - - def pyObj(self): - if self._attr in ({{if 'CU_MEM_RANGE_ATTRIBUTE_READ_MOSTLY'}}ccuda.CUmem_range_attribute_enum.CU_MEM_RANGE_ATTRIBUTE_READ_MOSTLY,{{endif}} - {{if 'CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION'}}ccuda.CUmem_range_attribute_enum.CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION,{{endif}} - {{if 'CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION'}}ccuda.CUmem_range_attribute_enum.CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION,{{endif}}): - return self._int_val - elif self._attr in ({{if 'CU_MEM_RANGE_ATTRIBUTE_ACCESSED_BY'}}ccuda.CUmem_range_attribute_enum.CU_MEM_RANGE_ATTRIBUTE_ACCESSED_BY,{{endif}}): - return [self._int_val_list[idx] for idx in range(int(self._data_size/4))] - else: - raise TypeError('Unsupported attribute value: {}'.format(self._attr)) -{{endif}} -{{if 'CUpointer_attribute_enum' in found_types}} - -cdef class HelperCUpointer_attribute: - def __cinit__(self, attr, init_value, is_getter=False): - self._is_getter = is_getter - self._attr = attr.value - if self._attr in ({{if 'CU_POINTER_ATTRIBUTE_CONTEXT'}}ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_CONTEXT,{{endif}}): - if self._is_getter: - self._ctx = cuda.CUcontext() - self._cptr = self._ctx.getPtr() - else: - self._cptr = init_value.getPtr() - elif self._attr in ({{if 'CU_POINTER_ATTRIBUTE_MEMORY_TYPE'}}ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_MEMORY_TYPE,{{endif}} - {{if 'CU_POINTER_ATTRIBUTE_DEVICE_ORDINAL'}}ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_DEVICE_ORDINAL,{{endif}} - {{if 'CU_POINTER_ATTRIBUTE_ALLOWED_HANDLE_TYPES'}}ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_ALLOWED_HANDLE_TYPES,{{endif}} - {{if 'CU_POINTER_ATTRIBUTE_IS_GPU_DIRECT_RDMA_CAPABLE'}}ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_IS_GPU_DIRECT_RDMA_CAPABLE,{{endif}} - {{if 'CU_POINTER_ATTRIBUTE_ACCESS_FLAGS'}}ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_ACCESS_FLAGS,{{endif}}): - self._uint = init_value - self._cptr = &self._uint - elif self._attr in ({{if 'CU_POINTER_ATTRIBUTE_DEVICE_POINTER'}}ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_DEVICE_POINTER,{{endif}} - {{if 'CU_POINTER_ATTRIBUTE_RANGE_START_ADDR'}}ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_RANGE_START_ADDR,{{endif}}): - if self._is_getter: - self._devptr = cuda.CUdeviceptr() - self._cptr = self._devptr.getPtr() - else: - self._cptr = init_value.getPtr() - elif self._attr in ({{if 'CU_POINTER_ATTRIBUTE_HOST_POINTER'}}ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_HOST_POINTER,{{endif}}): - self._void = init_value - self._cptr = &self._void - elif self._attr in ({{if 'CU_POINTER_ATTRIBUTE_P2P_TOKENS'}}ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_P2P_TOKENS,{{endif}}): - if self._is_getter: - self._token = cuda.CUDA_POINTER_ATTRIBUTE_P2P_TOKENS() - self._cptr = self._token.getPtr() - else: - self._cptr = init_value.getPtr() - elif self._attr in ({{if 'CU_POINTER_ATTRIBUTE_SYNC_MEMOPS'}}ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_SYNC_MEMOPS,{{endif}} - {{if 'CU_POINTER_ATTRIBUTE_IS_MANAGED'}}ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_IS_MANAGED,{{endif}} - {{if 'CU_POINTER_ATTRIBUTE_IS_LEGACY_CUDA_IPC_CAPABLE'}}ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_IS_LEGACY_CUDA_IPC_CAPABLE,{{endif}} - {{if 'CU_POINTER_ATTRIBUTE_MAPPED'}}ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_MAPPED,{{endif}}): - self._bool = init_value - self._cptr = &self._bool - elif self._attr in ({{if 'CU_POINTER_ATTRIBUTE_BUFFER_ID'}}ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_BUFFER_ID,{{endif}}): - self._ull = init_value - self._cptr = &self._ull - elif self._attr in ({{if 'CU_POINTER_ATTRIBUTE_RANGE_SIZE'}}ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_RANGE_SIZE,{{endif}}): - self._size = init_value - self._cptr = &self._size - elif self._attr in ({{if 'CU_POINTER_ATTRIBUTE_MEMPOOL_HANDLE'}}ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_MEMPOOL_HANDLE,{{endif}}): - if self._is_getter: - self._mempool = cuda.CUmemoryPool() - self._cptr = self._mempool.getPtr() - else: - self._cptr = init_value.getPtr() - else: - raise TypeError('Unsupported attribute: {}'.format(attr.name)) - - def __dealloc__(self): - pass - - @property - def cptr(self): - return self._cptr - - def pyObj(self): - assert(self._is_getter == True) - if self._attr in ({{if 'CU_POINTER_ATTRIBUTE_CONTEXT'}}ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_CONTEXT,{{endif}}): - return self._ctx - elif self._attr in ({{if 'CU_POINTER_ATTRIBUTE_MEMORY_TYPE'}}ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_MEMORY_TYPE,{{endif}} - {{if 'CU_POINTER_ATTRIBUTE_DEVICE_ORDINAL'}}ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_DEVICE_ORDINAL,{{endif}} - {{if 'CU_POINTER_ATTRIBUTE_ALLOWED_HANDLE_TYPES'}}ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_ALLOWED_HANDLE_TYPES,{{endif}} - {{if 'CU_POINTER_ATTRIBUTE_IS_GPU_DIRECT_RDMA_CAPABLE'}}ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_IS_GPU_DIRECT_RDMA_CAPABLE,{{endif}} - {{if 'CU_POINTER_ATTRIBUTE_ACCESS_FLAGS'}}ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_ACCESS_FLAGS,{{endif}}): - return self._uint - elif self._attr in ({{if 'CU_POINTER_ATTRIBUTE_DEVICE_POINTER'}}ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_DEVICE_POINTER,{{endif}} - {{if 'CU_POINTER_ATTRIBUTE_RANGE_START_ADDR'}}ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_RANGE_START_ADDR,{{endif}}): - return self._devptr - elif self._attr in ({{if 'CU_POINTER_ATTRIBUTE_HOST_POINTER'}}ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_HOST_POINTER,{{endif}}): - return self._void - elif self._attr in ({{if 'CU_POINTER_ATTRIBUTE_P2P_TOKENS'}}ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_P2P_TOKENS,{{endif}}): - return self._token - elif self._attr in ({{if 'CU_POINTER_ATTRIBUTE_SYNC_MEMOPS'}}ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_SYNC_MEMOPS,{{endif}} - {{if 'CU_POINTER_ATTRIBUTE_IS_MANAGED'}}ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_IS_MANAGED,{{endif}} - {{if 'CU_POINTER_ATTRIBUTE_IS_LEGACY_CUDA_IPC_CAPABLE'}}ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_IS_LEGACY_CUDA_IPC_CAPABLE,{{endif}} - {{if 'CU_POINTER_ATTRIBUTE_MAPPED'}}ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_MAPPED,{{endif}}): - return self._bool - elif self._attr in ({{if 'CU_POINTER_ATTRIBUTE_BUFFER_ID'}}ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_BUFFER_ID,{{endif}}): - return self._ull - elif self._attr in ({{if 'CU_POINTER_ATTRIBUTE_RANGE_SIZE'}}ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_RANGE_SIZE,{{endif}}): - return self._size - elif self._attr in ({{if 'CU_POINTER_ATTRIBUTE_MEMPOOL_HANDLE'}}ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_MEMPOOL_HANDLE,{{endif}}): - return self._mempool - else: - raise TypeError('Unsupported attribute value: {}'.format(self._attr)) -{{endif}} -{{if 'CUgraphMem_attribute_enum' in found_types}} - -cdef class HelperCUgraphMem_attribute: - def __cinit__(self, attr, init_value, is_getter=False): - self._is_getter = is_getter - self._attr = attr.value - if self._attr in ({{if 'CU_GRAPH_MEM_ATTR_USED_MEM_CURRENT' in found_values}}ccuda.CUgraphMem_attribute_enum.CU_GRAPH_MEM_ATTR_USED_MEM_CURRENT,{{endif}} - {{if 'CU_GRAPH_MEM_ATTR_USED_MEM_HIGH' in found_values}}ccuda.CUgraphMem_attribute_enum.CU_GRAPH_MEM_ATTR_USED_MEM_HIGH,{{endif}} - {{if 'CU_GRAPH_MEM_ATTR_RESERVED_MEM_CURRENT' in found_values}}ccuda.CUgraphMem_attribute_enum.CU_GRAPH_MEM_ATTR_RESERVED_MEM_CURRENT,{{endif}} - {{if 'CU_GRAPH_MEM_ATTR_RESERVED_MEM_HIGH' in found_values}}ccuda.CUgraphMem_attribute_enum.CU_GRAPH_MEM_ATTR_RESERVED_MEM_HIGH,{{endif}}): - if self._is_getter: - self._cuuint64_t_val = cuda.cuuint64_t() - self._cptr = self._cuuint64_t_val.getPtr() - else: - self._cptr = init_value.getPtr() - else: - raise TypeError('Unsupported attribute: {}'.format(attr.name)) - - def __dealloc__(self): - pass - - @property - def cptr(self): - return self._cptr - - def pyObj(self): - assert(self._is_getter == True) - if self._attr in ({{if 'CU_GRAPH_MEM_ATTR_USED_MEM_CURRENT' in found_values}}ccuda.CUgraphMem_attribute_enum.CU_GRAPH_MEM_ATTR_USED_MEM_CURRENT,{{endif}} - {{if 'CU_GRAPH_MEM_ATTR_USED_MEM_HIGH' in found_values}}ccuda.CUgraphMem_attribute_enum.CU_GRAPH_MEM_ATTR_USED_MEM_HIGH,{{endif}} - {{if 'CU_GRAPH_MEM_ATTR_RESERVED_MEM_CURRENT' in found_values}}ccuda.CUgraphMem_attribute_enum.CU_GRAPH_MEM_ATTR_RESERVED_MEM_CURRENT,{{endif}} - {{if 'CU_GRAPH_MEM_ATTR_RESERVED_MEM_HIGH' in found_values}}ccuda.CUgraphMem_attribute_enum.CU_GRAPH_MEM_ATTR_RESERVED_MEM_HIGH,{{endif}}): - return self._cuuint64_t_val - else: - raise TypeError('Unsupported attribute value: {}'.format(self._attr)) -{{endif}} -{{if 'CUjit_option_enum' in found_types}} - -cdef class HelperCUjit_option: - def __cinit__(self, attr, init_value): - self._attr = attr.value - if self._attr in ({{if 'CU_JIT_MAX_REGISTERS' in found_values}}ccuda.CUjit_option_enum.CU_JIT_MAX_REGISTERS,{{endif}} - {{if 'CU_JIT_THREADS_PER_BLOCK' in found_values}}ccuda.CUjit_option_enum.CU_JIT_THREADS_PER_BLOCK,{{endif}} - {{if 'CU_JIT_INFO_LOG_BUFFER_SIZE_BYTES' in found_values}}ccuda.CUjit_option_enum.CU_JIT_INFO_LOG_BUFFER_SIZE_BYTES,{{endif}} - {{if 'CU_JIT_ERROR_LOG_BUFFER_SIZE_BYTES' in found_values}}ccuda.CUjit_option_enum.CU_JIT_ERROR_LOG_BUFFER_SIZE_BYTES,{{endif}} - {{if 'CU_JIT_OPTIMIZATION_LEVEL' in found_values}}ccuda.CUjit_option_enum.CU_JIT_OPTIMIZATION_LEVEL,{{endif}} - {{if 'CU_JIT_GLOBAL_SYMBOL_COUNT' in found_values}}ccuda.CUjit_option_enum.CU_JIT_GLOBAL_SYMBOL_COUNT,{{endif}} - {{if 'CU_JIT_TARGET_FROM_CUCONTEXT' in found_values}}ccuda.CUjit_option_enum.CU_JIT_TARGET_FROM_CUCONTEXT,{{endif}} - {{if 'CU_JIT_REFERENCED_KERNEL_COUNT' in found_values}}ccuda.CUjit_option_enum.CU_JIT_REFERENCED_KERNEL_COUNT,{{endif}} - {{if 'CU_JIT_REFERENCED_VARIABLE_COUNT' in found_values}}ccuda.CUjit_option_enum.CU_JIT_REFERENCED_VARIABLE_COUNT,{{endif}} - {{if 'CU_JIT_MIN_CTA_PER_SM' in found_values}}ccuda.CUjit_option_enum.CU_JIT_MIN_CTA_PER_SM,{{endif}}): - self._uint = init_value - self._cptr = self._uint - elif self._attr in ({{if 'CU_JIT_WALL_TIME' in found_values}}ccuda.CUjit_option_enum.CU_JIT_WALL_TIME,{{endif}}): - self._float = init_value - self._cptr = self._float - elif self._attr in ({{if 'CU_JIT_INFO_LOG_BUFFER' in found_values}}ccuda.CUjit_option_enum.CU_JIT_INFO_LOG_BUFFER,{{endif}} - {{if 'CU_JIT_ERROR_LOG_BUFFER' in found_values}}ccuda.CUjit_option_enum.CU_JIT_ERROR_LOG_BUFFER{{endif}}): - self._charstar = init_value - self._cptr = self._charstar - elif self._attr in ({{if 'CU_JIT_TARGET' in found_values}}ccuda.CUjit_option_enum.CU_JIT_TARGET,{{endif}}): - self._target = init_value.value - self._cptr = self._target - elif self._attr in ({{if 'CU_JIT_FALLBACK_STRATEGY' in found_values}}ccuda.CUjit_option_enum.CU_JIT_FALLBACK_STRATEGY,{{endif}}): - self._fallback = init_value.value - self._cptr = self._fallback - elif self._attr in ({{if 'CU_JIT_GENERATE_DEBUG_INFO' in found_values}}ccuda.CUjit_option_enum.CU_JIT_GENERATE_DEBUG_INFO,{{endif}} - {{if 'CU_JIT_LOG_VERBOSE' in found_values}}ccuda.CUjit_option_enum.CU_JIT_LOG_VERBOSE,{{endif}} - {{if 'CU_JIT_GENERATE_LINE_INFO' in found_values}}ccuda.CUjit_option_enum.CU_JIT_GENERATE_LINE_INFO,{{endif}} - {{if 'CU_JIT_LTO' in found_values}}ccuda.CUjit_option_enum.CU_JIT_LTO,{{endif}} - {{if 'CU_JIT_FTZ' in found_values}}ccuda.CUjit_option_enum.CU_JIT_FTZ,{{endif}} - {{if 'CU_JIT_PREC_DIV' in found_values}}ccuda.CUjit_option_enum.CU_JIT_PREC_DIV,{{endif}} - {{if 'CU_JIT_PREC_SQRT' in found_values}}ccuda.CUjit_option_enum.CU_JIT_PREC_SQRT,{{endif}} - {{if 'CU_JIT_FMA' in found_values}}ccuda.CUjit_option_enum.CU_JIT_FMA,{{endif}} - {{if 'CU_JIT_OPTIMIZE_UNUSED_DEVICE_VARIABLES' in found_values}}ccuda.CUjit_option_enum.CU_JIT_OPTIMIZE_UNUSED_DEVICE_VARIABLES,{{endif}}): - self._int = init_value - self._cptr = self._int - elif self._attr in ({{if 'CU_JIT_CACHE_MODE' in found_values}}ccuda.CUjit_option_enum.CU_JIT_CACHE_MODE,{{endif}}): - self._cacheMode = init_value.value - self._cptr = self._cacheMode - elif self._attr in ({{if 'CU_JIT_GLOBAL_SYMBOL_NAMES' in found_values}}ccuda.CUjit_option_enum.CU_JIT_GLOBAL_SYMBOL_NAMES,{{endif}} - {{if 'CU_JIT_REFERENCED_KERNEL_NAMES' in found_values}}ccuda.CUjit_option_enum.CU_JIT_REFERENCED_KERNEL_NAMES,{{endif}} - {{if 'CU_JIT_REFERENCED_VARIABLE_NAMES' in found_values}}ccuda.CUjit_option_enum.CU_JIT_REFERENCED_VARIABLE_NAMES,{{endif}}): - self._charstarstar = init_value - self._cptr = &self._charstarstar[0] - elif self._attr in ({{if 'CU_JIT_GLOBAL_SYMBOL_ADDRESSES' in found_values}}ccuda.CUjit_option_enum.CU_JIT_GLOBAL_SYMBOL_ADDRESSES,{{endif}}): - pylist = [HelperInputVoidPtr(val) for val in init_value] - self._voidstarstar = InputVoidPtrPtrHelper(pylist) - self._cptr = self._voidstarstar.cptr - else: - raise TypeError('Unsupported attribute: {}'.format(attr.name)) - - def __dealloc__(self): - pass - - @property - def cptr(self): - return self._cptr -{{endif}} - -{{if 'CUlibraryOption_enum' in found_types}} - -cdef class HelperCUlibraryOption: - def __cinit__(self, attr, init_value): - self._attr = attr.value - if False: - pass - {{if 'CU_LIBRARY_HOST_UNIVERSAL_FUNCTION_AND_DATA_TABLE' in found_values}} - elif self._attr in (ccuda.CUlibraryOption_enum.CU_LIBRARY_HOST_UNIVERSAL_FUNCTION_AND_DATA_TABLE,): - self._cptr = init_value.getPtr() - {{endif}} - {{if 'CU_LIBRARY_BINARY_IS_PRESERVED' in found_values}} - elif self._attr in (ccuda.CUlibraryOption_enum.CU_LIBRARY_BINARY_IS_PRESERVED,): - self._uint = init_value - self._cptr = self._uint - {{endif}} - else: - raise TypeError('Unsupported attribute: {}'.format(attr.name)) - - def __dealloc__(self): - pass - - @property - def cptr(self): - return self._cptr -{{endif}} - -{{if 'CUmemAllocationHandleType_enum' in found_types}} - -cdef class HelperCUmemAllocationHandleType: - def __cinit__(self, attr): - self._type = attr.value - if False: - pass - {{if 'CU_MEM_HANDLE_TYPE_NONE' in found_values}} - elif self._type in (ccuda.CUmemAllocationHandleType_enum.CU_MEM_HANDLE_TYPE_NONE,): - self._cptr = &self._int - {{endif}} - {{if 'CU_MEM_HANDLE_TYPE_POSIX_FILE_DESCRIPTOR' in found_values}} - elif self._type in (ccuda.CUmemAllocationHandleType_enum.CU_MEM_HANDLE_TYPE_POSIX_FILE_DESCRIPTOR,): - self._cptr = &self._int - {{endif}} - {{if 'CU_MEM_HANDLE_TYPE_WIN32' in found_values}} - elif self._type in (ccuda.CUmemAllocationHandleType_enum.CU_MEM_HANDLE_TYPE_WIN32,): - self._cptr = &self._handle - {{endif}} - {{if 'CU_MEM_HANDLE_TYPE_WIN32_KMT' in found_values}} - elif self._type in (ccuda.CUmemAllocationHandleType_enum.CU_MEM_HANDLE_TYPE_WIN32_KMT,): - self._cptr = &self._d3dkmt_handle - {{endif}} - {{if 'CU_MEM_HANDLE_TYPE_FABRIC' in found_values}} - elif self._type in (ccuda.CUmemAllocationHandleType_enum.CU_MEM_HANDLE_TYPE_FABRIC,): - self._mem_fabric_handle = cuda.CUmemFabricHandle() - self._cptr = self._mem_fabric_handle.getPtr() - {{endif}} - else: - raise TypeError('Unsupported attribute: {}'.format(attr.name)) - - def __dealloc__(self): - pass - - @property - def cptr(self): - return self._cptr - - def pyObj(self): - if False: - pass - {{if 'CU_MEM_HANDLE_TYPE_NONE' in found_values}} - elif self._type in (ccuda.CUmemAllocationHandleType_enum.CU_MEM_HANDLE_TYPE_NONE,): - return self._int - {{endif}} - {{if 'CU_MEM_HANDLE_TYPE_POSIX_FILE_DESCRIPTOR' in found_values}} - elif self._type in (ccuda.CUmemAllocationHandleType_enum.CU_MEM_HANDLE_TYPE_POSIX_FILE_DESCRIPTOR,): - return self._int - {{endif}} - {{if 'CU_MEM_HANDLE_TYPE_WIN32' in found_values}} - elif self._type in (ccuda.CUmemAllocationHandleType_enum.CU_MEM_HANDLE_TYPE_WIN32,): - return self._handle - {{endif}} - {{if 'CU_MEM_HANDLE_TYPE_WIN32_KMT' in found_values}} - elif self._type in (ccuda.CUmemAllocationHandleType_enum.CU_MEM_HANDLE_TYPE_WIN32_KMT,): - return self._d3dkmt_handle - {{endif}} - {{if 'CU_MEM_HANDLE_TYPE_FABRIC' in found_values}} - elif self._type in (ccuda.CUmemAllocationHandleType_enum.CU_MEM_HANDLE_TYPE_FABRIC,): - return self._mem_fabric_handle - {{endif}} - else: - raise TypeError('Unsupported attribute: {}'.format(self._type)) -{{endif}} - -cdef class InputVoidPtrPtrHelper: - def __cinit__(self, lst): - self._cptr = callocWrapper(len(lst), sizeof(void*)) - for idx in range(len(lst)): - self._cptr[idx] = lst[idx].cptr - - def __dealloc__(self): - free(self._cptr) - - @property - def cptr(self): - return self._cptr - -{{if 'CUcoredumpSettings_enum' in found_types}} - -cdef class HelperCUcoredumpSettings: - def __cinit__(self, attr, init_value, is_getter=False): - self._is_getter = is_getter - self._attrib = attr.value - if self._attrib in ({{if 'CU_COREDUMP_FILE' in found_values}}ccuda.CUcoredumpSettings_enum.CU_COREDUMP_FILE,{{endif}} - {{if 'CU_COREDUMP_PIPE' in found_values}}ccuda.CUcoredumpSettings_enum.CU_COREDUMP_PIPE,{{endif}}): - if self._is_getter: - self._charstar = callocWrapper(1024, 1) - self._cptr = self._charstar - self._size = 1024 - else: - self._charstar = init_value - self._cptr = self._charstar - self._size = len(init_value) - elif self._attrib in ({{if 'CU_COREDUMP_ENABLE_ON_EXCEPTION' in found_values}}ccuda.CUcoredumpSettings_enum.CU_COREDUMP_ENABLE_ON_EXCEPTION,{{endif}} - {{if 'CU_COREDUMP_TRIGGER_HOST' in found_values}}ccuda.CUcoredumpSettings_enum.CU_COREDUMP_TRIGGER_HOST,{{endif}} - {{if 'CU_COREDUMP_LIGHTWEIGHT' in found_values}}ccuda.CUcoredumpSettings_enum.CU_COREDUMP_LIGHTWEIGHT,{{endif}} - {{if 'CU_COREDUMP_ENABLE_USER_TRIGGER' in found_values}}ccuda.CUcoredumpSettings_enum.CU_COREDUMP_ENABLE_USER_TRIGGER,{{endif}}): - if self._is_getter == False: - self._bool = init_value - - self._cptr = &self._bool - self._size = 1 - else: - raise TypeError('Unsupported attribute: {}'.format(attr.name)) - - def __dealloc__(self): - pass - - @property - def cptr(self): - return self._cptr - - def size(self): - return self._size - - def pyObj(self): - assert(self._is_getter == True) - if self._attrib in ({{if 'CU_COREDUMP_FILE' in found_values}}ccuda.CUcoredumpSettings_enum.CU_COREDUMP_FILE,{{endif}} - {{if 'CU_COREDUMP_PIPE' in found_values}}ccuda.CUcoredumpSettings_enum.CU_COREDUMP_PIPE,{{endif}}): - return self._charstar - elif self._attrib in ({{if 'CU_COREDUMP_ENABLE_ON_EXCEPTION' in found_values}}ccuda.CUcoredumpSettings_enum.CU_COREDUMP_ENABLE_ON_EXCEPTION,{{endif}} - {{if 'CU_COREDUMP_TRIGGER_HOST' in found_values}}ccuda.CUcoredumpSettings_enum.CU_COREDUMP_TRIGGER_HOST,{{endif}} - {{if 'CU_COREDUMP_LIGHTWEIGHT' in found_values}}ccuda.CUcoredumpSettings_enum.CU_COREDUMP_LIGHTWEIGHT,{{endif}} - {{if 'CU_COREDUMP_ENABLE_USER_TRIGGER' in found_values}}ccuda.CUcoredumpSettings_enum.CU_COREDUMP_ENABLE_USER_TRIGGER,{{endif}}): - return self._bool - else: - raise TypeError('Unsupported attribute value: {}'.format(self._attrib)) -{{endif}} diff --git a/cuda/_version.py b/cuda/_version.py deleted file mode 100644 index 03e1a0b1771..00000000000 --- a/cuda/_version.py +++ /dev/null @@ -1,683 +0,0 @@ - -# This file helps to compute a version number in source trees obtained from -# git-archive tarball (such as those provided by githubs download-from-tag -# feature). Distribution tarballs (built by setup.py sdist) and build -# directories (produced by setup.py build) will contain a much shorter file -# that just contains the computed version number. - -# This file is released into the public domain. -# Generated by versioneer-0.29 -# https://github.com/python-versioneer/python-versioneer - -"""Git implementation of _version.py.""" - -import errno -import os -import re -import subprocess -import sys -from typing import Any, Callable, Dict, List, Optional, Tuple -import functools - - -def get_keywords() -> Dict[str, str]: - """Get the keywords needed to look up the version information.""" - # these strings will be replaced by git during git-archive. - # setup.py/versioneer.py will grep for the variable names, so they must - # each be defined on a line of their own. _version.py will just call - # get_keywords(). - git_refnames = "$Format:%d$" - git_full = "$Format:%H$" - git_date = "$Format:%ci$" - keywords = {"refnames": git_refnames, "full": git_full, "date": git_date} - return keywords - - -class VersioneerConfig: - """Container for Versioneer configuration parameters.""" - - VCS: str - style: str - tag_prefix: str - parentdir_prefix: str - versionfile_source: str - verbose: bool - - -def get_config() -> VersioneerConfig: - """Create, populate and return the VersioneerConfig() object.""" - # these strings are filled in when 'setup.py versioneer' creates - # _version.py - cfg = VersioneerConfig() - cfg.VCS = "git" - cfg.style = "pep440" - cfg.tag_prefix = "v" - cfg.parentdir_prefix = "cuda-python-" - cfg.versionfile_source = "cuda/_version.py" - cfg.verbose = False - return cfg - - -class NotThisMethod(Exception): - """Exception raised if a method is not valid for the current scenario.""" - - -LONG_VERSION_PY: Dict[str, str] = {} -HANDLERS: Dict[str, Dict[str, Callable]] = {} - - -def register_vcs_handler(vcs: str, method: str) -> Callable: # decorator - """Create decorator to mark a method as the handler of a VCS.""" - def decorate(f: Callable) -> Callable: - """Store f in HANDLERS[vcs][method].""" - if vcs not in HANDLERS: - HANDLERS[vcs] = {} - HANDLERS[vcs][method] = f - return f - return decorate - - -def run_command( - commands: List[str], - args: List[str], - cwd: Optional[str] = None, - verbose: bool = False, - hide_stderr: bool = False, - env: Optional[Dict[str, str]] = None, -) -> Tuple[Optional[str], Optional[int]]: - """Call the given command(s).""" - assert isinstance(commands, list) - process = None - - popen_kwargs: Dict[str, Any] = {} - if sys.platform == "win32": - # This hides the console window if pythonw.exe is used - startupinfo = subprocess.STARTUPINFO() - startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW - popen_kwargs["startupinfo"] = startupinfo - - for command in commands: - try: - dispcmd = str([command] + args) - # remember shell=False, so use git.cmd on windows, not just git - process = subprocess.Popen([command] + args, cwd=cwd, env=env, - stdout=subprocess.PIPE, - stderr=(subprocess.PIPE if hide_stderr - else None), **popen_kwargs) - break - except OSError as e: - if e.errno == errno.ENOENT: - continue - if verbose: - print("unable to run %s" % dispcmd) - print(e) - return None, None - else: - if verbose: - print("unable to find command, tried %s" % (commands,)) - return None, None - stdout = process.communicate()[0].strip().decode() - if process.returncode != 0: - if verbose: - print("unable to run %s (error)" % dispcmd) - print("stdout was %s" % stdout) - return None, process.returncode - return stdout, process.returncode - - -def versions_from_parentdir( - parentdir_prefix: str, - root: str, - verbose: bool, -) -> Dict[str, Any]: - """Try to determine the version from the parent directory name. - - Source tarballs conventionally unpack into a directory that includes both - the project name and a version string. We will also support searching up - two directory levels for an appropriately named parent directory - """ - rootdirs = [] - - for _ in range(3): - dirname = os.path.basename(root) - if dirname.startswith(parentdir_prefix): - return {"version": dirname[len(parentdir_prefix):], - "full-revisionid": None, - "dirty": False, "error": None, "date": None} - rootdirs.append(root) - root = os.path.dirname(root) # up a level - - if verbose: - print("Tried directories %s but none started with prefix %s" % - (str(rootdirs), parentdir_prefix)) - raise NotThisMethod("rootdir doesn't start with parentdir_prefix") - - -@register_vcs_handler("git", "get_keywords") -def git_get_keywords(versionfile_abs: str) -> Dict[str, str]: - """Extract version information from the given file.""" - # the code embedded in _version.py can just fetch the value of these - # keywords. When used from setup.py, we don't want to import _version.py, - # so we do it with a regexp instead. This function is not used from - # _version.py. - keywords: Dict[str, str] = {} - try: - with open(versionfile_abs, "r") as fobj: - for line in fobj: - if line.strip().startswith("git_refnames ="): - mo = re.search(r'=\s*"(.*)"', line) - if mo: - keywords["refnames"] = mo.group(1) - if line.strip().startswith("git_full ="): - mo = re.search(r'=\s*"(.*)"', line) - if mo: - keywords["full"] = mo.group(1) - if line.strip().startswith("git_date ="): - mo = re.search(r'=\s*"(.*)"', line) - if mo: - keywords["date"] = mo.group(1) - except OSError: - pass - return keywords - - -@register_vcs_handler("git", "keywords") -def git_versions_from_keywords( - keywords: Dict[str, str], - tag_prefix: str, - verbose: bool, -) -> Dict[str, Any]: - """Get version information from git keywords.""" - if "refnames" not in keywords: - raise NotThisMethod("Short version file found") - date = keywords.get("date") - if date is not None: - # Use only the last line. Previous lines may contain GPG signature - # information. - date = date.splitlines()[-1] - - # git-2.2.0 added "%cI", which expands to an ISO-8601 -compliant - # datestamp. However we prefer "%ci" (which expands to an "ISO-8601 - # -like" string, which we must then edit to make compliant), because - # it's been around since git-1.5.3, and it's too difficult to - # discover which version we're using, or to work around using an - # older one. - date = date.strip().replace(" ", "T", 1).replace(" ", "", 1) - refnames = keywords["refnames"].strip() - if refnames.startswith("$Format"): - if verbose: - print("keywords are unexpanded, not using") - raise NotThisMethod("unexpanded keywords, not a git-archive tarball") - refs = {r.strip() for r in refnames.strip("()").split(",")} - # starting in git-1.8.3, tags are listed as "tag: foo-1.0" instead of - # just "foo-1.0". If we see a "tag: " prefix, prefer those. - TAG = "tag: " - tags = {r[len(TAG):] for r in refs if r.startswith(TAG)} - if not tags: - # Either we're using git < 1.8.3, or there really are no tags. We use - # a heuristic: assume all version tags have a digit. The old git %d - # expansion behaves like git log --decorate=short and strips out the - # refs/heads/ and refs/tags/ prefixes that would let us distinguish - # between branches and tags. By ignoring refnames without digits, we - # filter out many common branch names like "release" and - # "stabilization", as well as "HEAD" and "master". - tags = {r for r in refs if re.search(r'\d', r)} - if verbose: - print("discarding '%s', no digits" % ",".join(refs - tags)) - if verbose: - print("likely tags: %s" % ",".join(sorted(tags))) - for ref in sorted(tags): - # sorting will prefer e.g. "2.0" over "2.0rc1" - if ref.startswith(tag_prefix): - r = ref[len(tag_prefix):] - # Filter out refs that exactly match prefix or that don't start - # with a number once the prefix is stripped (mostly a concern - # when prefix is '') - if not re.match(r'\d', r): - continue - if verbose: - print("picking %s" % r) - return {"version": r, - "full-revisionid": keywords["full"].strip(), - "dirty": False, "error": None, - "date": date} - # no suitable tags, so version is "0+unknown", but full hex is still there - if verbose: - print("no suitable tags, using unknown + full revision id") - return {"version": "0+unknown", - "full-revisionid": keywords["full"].strip(), - "dirty": False, "error": "no suitable tags", "date": None} - - -@register_vcs_handler("git", "pieces_from_vcs") -def git_pieces_from_vcs( - tag_prefix: str, - root: str, - verbose: bool, - runner: Callable = run_command -) -> Dict[str, Any]: - """Get version from 'git describe' in the root of the source tree. - - This only gets called if the git-archive 'subst' keywords were *not* - expanded, and _version.py hasn't already been rewritten with a short - version string, meaning we're inside a checked out source tree. - """ - GITS = ["git"] - if sys.platform == "win32": - GITS = ["git.cmd", "git.exe"] - - # GIT_DIR can interfere with correct operation of Versioneer. - # It may be intended to be passed to the Versioneer-versioned project, - # but that should not change where we get our version from. - env = os.environ.copy() - env.pop("GIT_DIR", None) - runner = functools.partial(runner, env=env) - - _, rc = runner(GITS, ["rev-parse", "--git-dir"], cwd=root, - hide_stderr=not verbose) - if rc != 0: - if verbose: - print("Directory %s not under git control" % root) - raise NotThisMethod("'git rev-parse --git-dir' returned error") - - # if there is a tag matching tag_prefix, this yields TAG-NUM-gHEX[-dirty] - # if there isn't one, this yields HEX[-dirty] (no NUM) - describe_out, rc = runner(GITS, [ - "describe", "--tags", "--dirty", "--always", "--long", - "--match", f"{tag_prefix}[[:digit:]]*" - ], cwd=root) - # --long was added in git-1.5.5 - if describe_out is None: - raise NotThisMethod("'git describe' failed") - describe_out = describe_out.strip() - full_out, rc = runner(GITS, ["rev-parse", "HEAD"], cwd=root) - if full_out is None: - raise NotThisMethod("'git rev-parse' failed") - full_out = full_out.strip() - - pieces: Dict[str, Any] = {} - pieces["long"] = full_out - pieces["short"] = full_out[:7] # maybe improved later - pieces["error"] = None - - branch_name, rc = runner(GITS, ["rev-parse", "--abbrev-ref", "HEAD"], - cwd=root) - # --abbrev-ref was added in git-1.6.3 - if rc != 0 or branch_name is None: - raise NotThisMethod("'git rev-parse --abbrev-ref' returned error") - branch_name = branch_name.strip() - - if branch_name == "HEAD": - # If we aren't exactly on a branch, pick a branch which represents - # the current commit. If all else fails, we are on a branchless - # commit. - branches, rc = runner(GITS, ["branch", "--contains"], cwd=root) - # --contains was added in git-1.5.4 - if rc != 0 or branches is None: - raise NotThisMethod("'git branch --contains' returned error") - branches = branches.split("\n") - - # Remove the first line if we're running detached - if "(" in branches[0]: - branches.pop(0) - - # Strip off the leading "* " from the list of branches. - branches = [branch[2:] for branch in branches] - if "master" in branches: - branch_name = "master" - elif not branches: - branch_name = None - else: - # Pick the first branch that is returned. Good or bad. - branch_name = branches[0] - - pieces["branch"] = branch_name - - # parse describe_out. It will be like TAG-NUM-gHEX[-dirty] or HEX[-dirty] - # TAG might have hyphens. - git_describe = describe_out - - # look for -dirty suffix - dirty = git_describe.endswith("-dirty") - pieces["dirty"] = dirty - if dirty: - git_describe = git_describe[:git_describe.rindex("-dirty")] - - # now we have TAG-NUM-gHEX or HEX - - if "-" in git_describe: - # TAG-NUM-gHEX - mo = re.search(r'^(.+)-(\d+)-g([0-9a-f]+)$', git_describe) - if not mo: - # unparsable. Maybe git-describe is misbehaving? - pieces["error"] = ("unable to parse git-describe output: '%s'" - % describe_out) - return pieces - - # tag - full_tag = mo.group(1) - if not full_tag.startswith(tag_prefix): - if verbose: - fmt = "tag '%s' doesn't start with prefix '%s'" - print(fmt % (full_tag, tag_prefix)) - pieces["error"] = ("tag '%s' doesn't start with prefix '%s'" - % (full_tag, tag_prefix)) - return pieces - pieces["closest-tag"] = full_tag[len(tag_prefix):] - - # distance: number of commits since tag - pieces["distance"] = int(mo.group(2)) - - # commit: short hex revision ID - pieces["short"] = mo.group(3) - - else: - # HEX: no tags - pieces["closest-tag"] = None - out, rc = runner(GITS, ["rev-list", "HEAD", "--left-right"], cwd=root) - pieces["distance"] = len(out.split()) # total number of commits - - # commit date: see ISO-8601 comment in git_versions_from_keywords() - date = runner(GITS, ["show", "-s", "--format=%ci", "HEAD"], cwd=root)[0].strip() - # Use only the last line. Previous lines may contain GPG signature - # information. - date = date.splitlines()[-1] - pieces["date"] = date.strip().replace(" ", "T", 1).replace(" ", "", 1) - - return pieces - - -def plus_or_dot(pieces: Dict[str, Any]) -> str: - """Return a + if we don't already have one, else return a .""" - if "+" in pieces.get("closest-tag", ""): - return "." - return "+" - - -def render_pep440(pieces: Dict[str, Any]) -> str: - """Build up version string, with post-release "local version identifier". - - Our goal: TAG[+DISTANCE.gHEX[.dirty]] . Note that if you - get a tagged build and then dirty it, you'll get TAG+0.gHEX.dirty - - Exceptions: - 1: no tags. git_describe was just HEX. 0+untagged.DISTANCE.gHEX[.dirty] - """ - if pieces["closest-tag"]: - rendered = pieces["closest-tag"] - if pieces["distance"] or pieces["dirty"]: - rendered += plus_or_dot(pieces) - rendered += "%d.g%s" % (pieces["distance"], pieces["short"]) - if pieces["dirty"]: - rendered += ".dirty" - else: - # exception #1 - rendered = "0+untagged.%d.g%s" % (pieces["distance"], - pieces["short"]) - if pieces["dirty"]: - rendered += ".dirty" - return rendered - - -def render_pep440_branch(pieces: Dict[str, Any]) -> str: - """TAG[[.dev0]+DISTANCE.gHEX[.dirty]] . - - The ".dev0" means not master branch. Note that .dev0 sorts backwards - (a feature branch will appear "older" than the master branch). - - Exceptions: - 1: no tags. 0[.dev0]+untagged.DISTANCE.gHEX[.dirty] - """ - if pieces["closest-tag"]: - rendered = pieces["closest-tag"] - if pieces["distance"] or pieces["dirty"]: - if pieces["branch"] != "master": - rendered += ".dev0" - rendered += plus_or_dot(pieces) - rendered += "%d.g%s" % (pieces["distance"], pieces["short"]) - if pieces["dirty"]: - rendered += ".dirty" - else: - # exception #1 - rendered = "0" - if pieces["branch"] != "master": - rendered += ".dev0" - rendered += "+untagged.%d.g%s" % (pieces["distance"], - pieces["short"]) - if pieces["dirty"]: - rendered += ".dirty" - return rendered - - -def pep440_split_post(ver: str) -> Tuple[str, Optional[int]]: - """Split pep440 version string at the post-release segment. - - Returns the release segments before the post-release and the - post-release version number (or -1 if no post-release segment is present). - """ - vc = str.split(ver, ".post") - return vc[0], int(vc[1] or 0) if len(vc) == 2 else None - - -def render_pep440_pre(pieces: Dict[str, Any]) -> str: - """TAG[.postN.devDISTANCE] -- No -dirty. - - Exceptions: - 1: no tags. 0.post0.devDISTANCE - """ - if pieces["closest-tag"]: - if pieces["distance"]: - # update the post release segment - tag_version, post_version = pep440_split_post(pieces["closest-tag"]) - rendered = tag_version - if post_version is not None: - rendered += ".post%d.dev%d" % (post_version + 1, pieces["distance"]) - else: - rendered += ".post0.dev%d" % (pieces["distance"]) - else: - # no commits, use the tag as the version - rendered = pieces["closest-tag"] - else: - # exception #1 - rendered = "0.post0.dev%d" % pieces["distance"] - return rendered - - -def render_pep440_post(pieces: Dict[str, Any]) -> str: - """TAG[.postDISTANCE[.dev0]+gHEX] . - - The ".dev0" means dirty. Note that .dev0 sorts backwards - (a dirty tree will appear "older" than the corresponding clean one), - but you shouldn't be releasing software with -dirty anyways. - - Exceptions: - 1: no tags. 0.postDISTANCE[.dev0] - """ - if pieces["closest-tag"]: - rendered = pieces["closest-tag"] - if pieces["distance"] or pieces["dirty"]: - rendered += ".post%d" % pieces["distance"] - if pieces["dirty"]: - rendered += ".dev0" - rendered += plus_or_dot(pieces) - rendered += "g%s" % pieces["short"] - else: - # exception #1 - rendered = "0.post%d" % pieces["distance"] - if pieces["dirty"]: - rendered += ".dev0" - rendered += "+g%s" % pieces["short"] - return rendered - - -def render_pep440_post_branch(pieces: Dict[str, Any]) -> str: - """TAG[.postDISTANCE[.dev0]+gHEX[.dirty]] . - - The ".dev0" means not master branch. - - Exceptions: - 1: no tags. 0.postDISTANCE[.dev0]+gHEX[.dirty] - """ - if pieces["closest-tag"]: - rendered = pieces["closest-tag"] - if pieces["distance"] or pieces["dirty"]: - rendered += ".post%d" % pieces["distance"] - if pieces["branch"] != "master": - rendered += ".dev0" - rendered += plus_or_dot(pieces) - rendered += "g%s" % pieces["short"] - if pieces["dirty"]: - rendered += ".dirty" - else: - # exception #1 - rendered = "0.post%d" % pieces["distance"] - if pieces["branch"] != "master": - rendered += ".dev0" - rendered += "+g%s" % pieces["short"] - if pieces["dirty"]: - rendered += ".dirty" - return rendered - - -def render_pep440_old(pieces: Dict[str, Any]) -> str: - """TAG[.postDISTANCE[.dev0]] . - - The ".dev0" means dirty. - - Exceptions: - 1: no tags. 0.postDISTANCE[.dev0] - """ - if pieces["closest-tag"]: - rendered = pieces["closest-tag"] - if pieces["distance"] or pieces["dirty"]: - rendered += ".post%d" % pieces["distance"] - if pieces["dirty"]: - rendered += ".dev0" - else: - # exception #1 - rendered = "0.post%d" % pieces["distance"] - if pieces["dirty"]: - rendered += ".dev0" - return rendered - - -def render_git_describe(pieces: Dict[str, Any]) -> str: - """TAG[-DISTANCE-gHEX][-dirty]. - - Like 'git describe --tags --dirty --always'. - - Exceptions: - 1: no tags. HEX[-dirty] (note: no 'g' prefix) - """ - if pieces["closest-tag"]: - rendered = pieces["closest-tag"] - if pieces["distance"]: - rendered += "-%d-g%s" % (pieces["distance"], pieces["short"]) - else: - # exception #1 - rendered = pieces["short"] - if pieces["dirty"]: - rendered += "-dirty" - return rendered - - -def render_git_describe_long(pieces: Dict[str, Any]) -> str: - """TAG-DISTANCE-gHEX[-dirty]. - - Like 'git describe --tags --dirty --always -long'. - The distance/hash is unconditional. - - Exceptions: - 1: no tags. HEX[-dirty] (note: no 'g' prefix) - """ - if pieces["closest-tag"]: - rendered = pieces["closest-tag"] - rendered += "-%d-g%s" % (pieces["distance"], pieces["short"]) - else: - # exception #1 - rendered = pieces["short"] - if pieces["dirty"]: - rendered += "-dirty" - return rendered - - -def render(pieces: Dict[str, Any], style: str) -> Dict[str, Any]: - """Render the given version pieces into the requested style.""" - if pieces["error"]: - return {"version": "unknown", - "full-revisionid": pieces.get("long"), - "dirty": None, - "error": pieces["error"], - "date": None} - - if not style or style == "default": - style = "pep440" # the default - - if style == "pep440": - rendered = render_pep440(pieces) - elif style == "pep440-branch": - rendered = render_pep440_branch(pieces) - elif style == "pep440-pre": - rendered = render_pep440_pre(pieces) - elif style == "pep440-post": - rendered = render_pep440_post(pieces) - elif style == "pep440-post-branch": - rendered = render_pep440_post_branch(pieces) - elif style == "pep440-old": - rendered = render_pep440_old(pieces) - elif style == "git-describe": - rendered = render_git_describe(pieces) - elif style == "git-describe-long": - rendered = render_git_describe_long(pieces) - else: - raise ValueError("unknown style '%s'" % style) - - return {"version": rendered, "full-revisionid": pieces["long"], - "dirty": pieces["dirty"], "error": None, - "date": pieces.get("date")} - - -def get_versions() -> Dict[str, Any]: - """Get version information or return default if unable to do so.""" - # I am in _version.py, which lives at ROOT/VERSIONFILE_SOURCE. If we have - # __file__, we can work backwards from there to the root. Some - # py2exe/bbfreeze/non-CPython implementations don't do __file__, in which - # case we can only use expanded keywords. - - cfg = get_config() - verbose = cfg.verbose - - try: - return git_versions_from_keywords(get_keywords(), cfg.tag_prefix, - verbose) - except NotThisMethod: - pass - - try: - root = os.path.realpath(__file__) - # versionfile_source is the relative path from the top of the source - # tree (where the .git directory might live) to this file. Invert - # this to find the root from __file__. - for _ in cfg.versionfile_source.split('/'): - root = os.path.dirname(root) - except NameError: - return {"version": "0+unknown", "full-revisionid": None, - "dirty": None, - "error": "unable to find root of source tree", - "date": None} - - try: - pieces = git_pieces_from_vcs(cfg.tag_prefix, root, verbose) - return render(pieces, cfg.style) - except NotThisMethod: - pass - - try: - if cfg.parentdir_prefix: - return versions_from_parentdir(cfg.parentdir_prefix, root, verbose) - except NotThisMethod: - pass - - return {"version": "0+unknown", "full-revisionid": None, - "dirty": None, - "error": "unable to compute version", "date": None} diff --git a/cuda/benchmarks/kernels.py b/cuda/benchmarks/kernels.py deleted file mode 100644 index d31cc58a356..00000000000 --- a/cuda/benchmarks/kernels.py +++ /dev/null @@ -1,163 +0,0 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. -# -# Please refer to the NVIDIA end user license agreement (EULA) associated -# with this source code for terms and conditions that govern your use of -# this software. Any use, reproduction, disclosure, or distribution of -# this software and related documentation outside the terms of the EULA -# is strictly prohibited. -kernel_string = '''\ -#define ITEM_PARAM(x, T) T x -#define REP1(x, T) , ITEM_PARAM(x, T) -#define REP2(x, T) REP1(x##0, T) REP1(x##1, T) -#define REP4(x, T) REP2(x##0, T) REP2(x##1, T) -#define REP8(x, T) REP4(x##0, T) REP4(x##1, T) -#define REP16(x, T) REP8(x##0, T) REP8(x##1, T) -#define REP32(x, T) REP16(x##0, T) REP16(x##1, T) -#define REP64(x, T) REP32(x##0, T) REP32(x##1, T) -#define REP128(x, T) REP64(x##0, T) REP64(x##1, T) -#define REP256(x, T) REP128(x##0, T) REP128(x##1, T) - -template -struct KernelFunctionParam -{ - unsigned char p[maxBytes]; -}; - -extern "C" __global__ void small_kernel(float *f) -{ - *f = 0.0f; -} - -extern "C" __global__ void empty_kernel() -{ - return; -} - -extern "C" __global__ -void small_kernel_512_args( - ITEM_PARAM(F, int*) - REP1(A, int*) - REP2(A, int*) - REP4(A, int*) - REP8(A, int*) - REP16(A, int*) - REP32(A, int*) - REP64(A, int*) - REP128(A, int*) - REP256(A, int*)) -{ - *F = 0; -} - -extern "C" __global__ -void small_kernel_512_bools( - ITEM_PARAM(F, bool) - REP1(A, bool) - REP2(A, bool) - REP4(A, bool) - REP8(A, bool) - REP16(A, bool) - REP32(A, bool) - REP64(A, bool) - REP128(A, bool) - REP256(A, bool)) -{ - return; -} - -extern "C" __global__ -void small_kernel_512_ints( - ITEM_PARAM(F, int) - REP1(A, int) - REP2(A, int) - REP4(A, int) - REP8(A, int) - REP16(A, int) - REP32(A, int) - REP64(A, int) - REP128(A, int) - REP256(A, int)) -{ - return; -} - -extern "C" __global__ -void small_kernel_512_doubles( - ITEM_PARAM(F, double) - REP1(A, double) - REP2(A, double) - REP4(A, double) - REP8(A, double) - REP16(A, double) - REP32(A, double) - REP64(A, double) - REP128(A, double) - REP256(A, double)) -{ - return; -} - -extern "C" __global__ -void small_kernel_512_chars( - ITEM_PARAM(F, char) - REP1(A, char) - REP2(A, char) - REP4(A, char) - REP8(A, char) - REP16(A, char) - REP32(A, char) - REP64(A, char) - REP128(A, char) - REP256(A, char)) -{ - return; -} - -extern "C" __global__ -void small_kernel_512_longlongs( - ITEM_PARAM(F, long long) - REP1(A, long long) - REP2(A, long long) - REP4(A, long long) - REP8(A, long long) - REP16(A, long long) - REP32(A, long long) - REP64(A, long long) - REP128(A, long long) - REP256(A, long long)) -{ - return; -} - -extern "C" __global__ -void small_kernel_256_args( - ITEM_PARAM(F, int*) - REP1(A, int*) - REP2(A, int*) - REP4(A, int*) - REP8(A, int*) - REP16(A, int*) - REP32(A, int*) - REP64(A, int*) - REP128(A, int*)) -{ - *F = 0; -} - -extern "C" __global__ -void small_kernel_16_args( - ITEM_PARAM(F, int*) - REP1(A, int*) - REP2(A, int*) - REP4(A, int*) - REP8(A, int*)) -{ - *F = 0; -} - -extern "C" __global__ void small_kernel_2048B(KernelFunctionParam<2048> param) -{ - // Do not touch param to prevent compiler from copying - // the whole structure from const bank to lmem. -} -''' diff --git a/cuda/benchmarks/perf_test_utils.py b/cuda/benchmarks/perf_test_utils.py deleted file mode 100644 index 11f5cc30bf6..00000000000 --- a/cuda/benchmarks/perf_test_utils.py +++ /dev/null @@ -1,86 +0,0 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. -# -# Please refer to the NVIDIA end user license agreement (EULA) associated -# with this source code for terms and conditions that govern your use of -# this software. Any use, reproduction, disclosure, or distribution of -# this software and related documentation outside the terms of the EULA -# is strictly prohibited. -import pytest -from cuda import cuda, cudart, nvrtc -import numpy as np - -def ASSERT_DRV(err): - if isinstance(err, cuda.CUresult): - if err != cuda.CUresult.CUDA_SUCCESS: - raise RuntimeError('Cuda Error: {}'.format(err)) - elif isinstance(err, cudart.cudaError_t): - if err != cudart.cudaError_t.cudaSuccess: - raise RuntimeError('Cudart Error: {}'.format(err)) - elif isinstance(err, nvrtc.nvrtcResult): - if err != nvrtc.nvrtcResult.NVRTC_SUCCESS: - raise RuntimeError('Nvrtc Error: {}'.format(err)) - else: - raise RuntimeError('Unknown error type: {}'.format(err)) - -@pytest.fixture -def init_cuda(): - # Initialize - err, = cuda.cuInit(0) - ASSERT_DRV(err) - err, device = cuda.cuDeviceGet(0) - ASSERT_DRV(err) - err, ctx = cuda.cuCtxCreate(0, device) - ASSERT_DRV(err) - - # create stream - err, stream = cuda.cuStreamCreate(cuda.CUstream_flags.CU_STREAM_NON_BLOCKING.value) - ASSERT_DRV(err) - - yield device, ctx, stream - - err, = cuda.cuStreamDestroy(stream) - ASSERT_DRV(err) - err, = cuda.cuCtxDestroy(ctx) - ASSERT_DRV(err) - -@pytest.fixture -def load_module(): - module = None - def _load_module(kernel_string, device): - nonlocal module - # Get module - err, major = cuda.cuDeviceGetAttribute(cuda.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR, device) - ASSERT_DRV(err) - err, minor = cuda.cuDeviceGetAttribute(cuda.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR, device) - ASSERT_DRV(err) - - err, prog = nvrtc.nvrtcCreateProgram(str.encode(kernel_string), b'kernelString.cu', 0, [], []) - ASSERT_DRV(err) - opts = [b'--fmad=false', bytes('--gpu-architecture=sm_' + str(major) + str(minor), 'ascii')] - err, = nvrtc.nvrtcCompileProgram(prog, 2, opts) - - err_log, logSize = nvrtc.nvrtcGetProgramLogSize(prog) - ASSERT_DRV(err_log) - log = b' ' * logSize - err_log, = nvrtc.nvrtcGetProgramLog(prog, log) - ASSERT_DRV(err_log) - result = log.decode() - if len(result) > 1: - print(result) - - ASSERT_DRV(err) - err, cubinSize = nvrtc.nvrtcGetCUBINSize(prog) - ASSERT_DRV(err) - cubin = b' ' * cubinSize - err, = nvrtc.nvrtcGetCUBIN(prog, cubin) - ASSERT_DRV(err) - cubin = np.char.array(cubin) - err, module = cuda.cuModuleLoadData(cubin) - ASSERT_DRV(err) - - return module - - yield _load_module - - err, = cuda.cuModuleUnload(module) - ASSERT_DRV(err) diff --git a/cuda/benchmarks/test_cupy.py b/cuda/benchmarks/test_cupy.py deleted file mode 100644 index 43aaa5b1263..00000000000 --- a/cuda/benchmarks/test_cupy.py +++ /dev/null @@ -1,193 +0,0 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. -# -# Please refer to the NVIDIA end user license agreement (EULA) associated -# with this source code for terms and conditions that govern your use of -# this software. Any use, reproduction, disclosure, or distribution of -# this software and related documentation outside the terms of the EULA -# is strictly prohibited. -import pytest -import ctypes - -# Always skip since cupy is not CTK 12.x yet -skip_tests = True -if not skip_tests: - try: - import cupy - skip_tests = False - except ImportError: - skip_tests = True - -from .kernels import kernel_string - -def launch(kernel, args=()): - kernel((1,), (1,), args) - -# Measure launch latency with no parmaeters -@pytest.mark.skipif(skip_tests, reason="cupy is not installed") -@pytest.mark.benchmark(group="cupy") -def test_launch_latency_empty_kernel(benchmark): - module = cupy.RawModule(code=kernel_string) - kernel = module.get_function('empty_kernel') - - stream = cupy.cuda.stream.Stream(non_blocking=True) - - with stream: - benchmark(launch, kernel) - stream.synchronize() - -# Measure launch latency with a single parameter -@pytest.mark.skipif(skip_tests, reason="cupy is not installed") -@pytest.mark.benchmark(group="cupy") -def test_launch_latency_small_kernel(benchmark): - module = cupy.RawModule(code=kernel_string) - kernel = module.get_function('small_kernel') - cupy.cuda.set_allocator() - arg = cupy.cuda.alloc(ctypes.sizeof(ctypes.c_float)) - - stream = cupy.cuda.stream.Stream(non_blocking=True) - - with stream: - benchmark(launch, kernel, (arg,)) - stream.synchronize() - -# Measure launch latency with many parameters using builtin parameter packing -@pytest.mark.skipif(skip_tests, reason="cupy is not installed") -@pytest.mark.benchmark(group="cupy") -def test_launch_latency_small_kernel_512_args(benchmark): - module = cupy.RawModule(code=kernel_string) - kernel = module.get_function('small_kernel_512_args') - cupy.cuda.set_allocator() - - args = [] - for _ in range(512): - args.append(cupy.cuda.alloc(ctypes.sizeof(ctypes.c_int))) - args = tuple(args) - - stream = cupy.cuda.stream.Stream(non_blocking=True) - - with stream: - benchmark(launch, kernel, args) - stream.synchronize() - -# Measure launch latency with many parameters using builtin parameter packing -@pytest.mark.skipif(skip_tests, reason="cupy is not installed") -@pytest.mark.benchmark(group="cupy") -def test_launch_latency_small_kernel_512_bools(benchmark): - module = cupy.RawModule(code=kernel_string) - kernel = module.get_function('small_kernel_512_bools') - cupy.cuda.set_allocator() - - args = [True] * 512 - args = tuple(args) - - stream = cupy.cuda.stream.Stream(non_blocking=True) - - with stream: - benchmark(launch, kernel, args) - stream.synchronize() - -# Measure launch latency with many parameters using builtin parameter packing -@pytest.mark.skipif(skip_tests, reason="cupy is not installed") -@pytest.mark.benchmark(group="cupy") -def test_launch_latency_small_kernel_512_doubles(benchmark): - module = cupy.RawModule(code=kernel_string) - kernel = module.get_function('small_kernel_512_doubles') - cupy.cuda.set_allocator() - - args = [1.2345] * 512 - args = tuple(args) - - stream = cupy.cuda.stream.Stream(non_blocking=True) - - with stream: - benchmark(launch, kernel, args) - stream.synchronize() - -# Measure launch latency with many parameters using builtin parameter packing -@pytest.mark.skipif(skip_tests, reason="cupy is not installed") -@pytest.mark.benchmark(group="cupy") -def test_launch_latency_small_kernel_512_ints(benchmark): - module = cupy.RawModule(code=kernel_string) - kernel = module.get_function('small_kernel_512_ints') - cupy.cuda.set_allocator() - - args = [123] * 512 - args = tuple(args) - - stream = cupy.cuda.stream.Stream(non_blocking=True) - - with stream: - benchmark(launch, kernel, args) - stream.synchronize() - -# Measure launch latency with many parameters using builtin parameter packing -@pytest.mark.skipif(skip_tests, reason="cupy is not installed") -@pytest.mark.benchmark(group="cupy") -def test_launch_latency_small_kernel_512_bytes(benchmark): - module = cupy.RawModule(code=kernel_string) - kernel = module.get_function('small_kernel_512_chars') - cupy.cuda.set_allocator() - - args = [127] * 512 - args = tuple(args) - - stream = cupy.cuda.stream.Stream(non_blocking=True) - - with stream: - benchmark(launch, kernel, args) - stream.synchronize() - -# Measure launch latency with many parameters using builtin parameter packing -@pytest.mark.skipif(skip_tests, reason="cupy is not installed") -@pytest.mark.benchmark(group="cupy") -def test_launch_latency_small_kernel_512_longlongs(benchmark): - module = cupy.RawModule(code=kernel_string) - kernel = module.get_function('small_kernel_512_longlongs') - cupy.cuda.set_allocator() - - args = [9223372036854775806] * 512 - args = tuple(args) - - stream = cupy.cuda.stream.Stream(non_blocking=True) - - with stream: - benchmark(launch, kernel, args) - stream.synchronize() - -# Measure launch latency with many parameters using builtin parameter packing -@pytest.mark.skipif(skip_tests, reason="cupy is not installed") -@pytest.mark.benchmark(group="cupy") -def test_launch_latency_small_kernel_256_args(benchmark): - module = cupy.RawModule(code=kernel_string) - kernel = module.get_function('small_kernel_256_args') - cupy.cuda.set_allocator() - - args = [] - for _ in range(256): - args.append(cupy.cuda.alloc(ctypes.sizeof(ctypes.c_int))) - args = tuple(args) - - stream = cupy.cuda.stream.Stream(non_blocking=True) - - with stream: - benchmark(launch, kernel, args) - stream.synchronize() - -# Measure launch latency with many parameters using builtin parameter packing -@pytest.mark.skipif(skip_tests, reason="cupy is not installed") -@pytest.mark.benchmark(group="cupy") -def test_launch_latency_small_kernel_16_args(benchmark): - module = cupy.RawModule(code=kernel_string) - kernel = module.get_function('small_kernel_16_args') - cupy.cuda.set_allocator() - - args = [] - for _ in range(16): - args.append(cupy.cuda.alloc(ctypes.sizeof(ctypes.c_int))) - args = tuple(args) - - stream = cupy.cuda.stream.Stream(non_blocking=True) - - with stream: - benchmark(launch, kernel, args) - stream.synchronize() diff --git a/cuda/benchmarks/test_launch_latency.py b/cuda/benchmarks/test_launch_latency.py deleted file mode 100755 index 79668a637a4..00000000000 --- a/cuda/benchmarks/test_launch_latency.py +++ /dev/null @@ -1,311 +0,0 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. -# -# Please refer to the NVIDIA end user license agreement (EULA) associated -# with this source code for terms and conditions that govern your use of -# this software. Any use, reproduction, disclosure, or distribution of -# this software and related documentation outside the terms of the EULA -# is strictly prohibited. -import pytest -from cuda import cuda -import ctypes - -from .perf_test_utils import ASSERT_DRV, init_cuda, load_module -from .kernels import kernel_string - -def launch(kernel, stream, args=(), arg_types=()): - cuda.cuLaunchKernel(kernel, - 1, 1, 1, # grid dim - 1, 1, 1, # block dim - 0, stream, # shared mem and stream - (args, arg_types), 0) # arguments - -def launch_packed(kernel, stream, params): - cuda.cuLaunchKernel(kernel, - 1, 1, 1, # grid dim - 1, 1, 1, # block dim - 0, stream, # shared mem and stream - params, 0) # arguments - -# Measure launch latency with no parmaeters -@pytest.mark.benchmark(group="launch-latency") -def test_launch_latency_empty_kernel(benchmark, init_cuda, load_module): - device, ctx, stream = init_cuda - module = load_module(kernel_string, device) - - err, func = cuda.cuModuleGetFunction(module, b'empty_kernel') - ASSERT_DRV(err) - - benchmark(launch, func, stream) - - cuda.cuCtxSynchronize() - -# Measure launch latency with a single parameter -@pytest.mark.benchmark(group="launch-latency") -def test_launch_latency_small_kernel(benchmark, init_cuda, load_module): - device, ctx, stream = init_cuda - module = load_module(kernel_string, device) - - err, func = cuda.cuModuleGetFunction(module, b'small_kernel') - ASSERT_DRV(err) - - err, f = cuda.cuMemAlloc(ctypes.sizeof(ctypes.c_float)) - ASSERT_DRV(err) - - benchmark(launch, func, stream, args=(f,), arg_types=(None,)) - - cuda.cuCtxSynchronize() - - err, = cuda.cuMemFree(f) - ASSERT_DRV(err) - -# Measure launch latency with many parameters using builtin parameter packing -@pytest.mark.benchmark(group="launch-latency") -def test_launch_latency_small_kernel_512_args(benchmark, init_cuda, load_module): - device, ctx, stream = init_cuda - module = load_module(kernel_string, device) - - err, func = cuda.cuModuleGetFunction(module, b'small_kernel_512_args') - ASSERT_DRV(err) - - args = [] - arg_types = [None] * 512 - for _ in arg_types: - err, p = cuda.cuMemAlloc(ctypes.sizeof(ctypes.c_int)) - ASSERT_DRV(err) - args.append(p) - - args = tuple(args) - arg_types = tuple(arg_types) - - benchmark(launch, func, stream, args=args, arg_types=arg_types) - - cuda.cuCtxSynchronize() - - for p in args: - err, = cuda.cuMemFree(p) - ASSERT_DRV(err) - -@pytest.mark.benchmark(group="launch-latency") -def test_launch_latency_small_kernel_512_bools(benchmark, init_cuda, load_module): - device, ctx, stream = init_cuda - module = load_module(kernel_string, device) - - err, func = cuda.cuModuleGetFunction(module, b'small_kernel_512_bools') - ASSERT_DRV(err) - - args = [True] * 512 - arg_types = [ctypes.c_bool] * 512 - - args = tuple(args) - arg_types = tuple(arg_types) - - benchmark(launch, func, stream, args=args, arg_types=arg_types) - - cuda.cuCtxSynchronize() - -@pytest.mark.benchmark(group="launch-latency") -def test_launch_latency_small_kernel_512_doubles(benchmark, init_cuda, load_module): - device, ctx, stream = init_cuda - module = load_module(kernel_string, device) - - err, func = cuda.cuModuleGetFunction(module, b'small_kernel_512_doubles') - ASSERT_DRV(err) - - args = [1.2345] * 512 - arg_types = [ctypes.c_double] * 512 - - args = tuple(args) - arg_types = tuple(arg_types) - - benchmark(launch, func, stream, args=args, arg_types=arg_types) - - cuda.cuCtxSynchronize() - -@pytest.mark.benchmark(group="launch-latency") -def test_launch_latency_small_kernel_512_ints(benchmark, init_cuda, load_module): - device, ctx, stream = init_cuda - module = load_module(kernel_string, device) - - err, func = cuda.cuModuleGetFunction(module, b'small_kernel_512_ints') - ASSERT_DRV(err) - - args = [123] * 512 - arg_types = [ctypes.c_int] * 512 - - args = tuple(args) - arg_types = tuple(arg_types) - - benchmark(launch, func, stream, args=args, arg_types=arg_types) - - cuda.cuCtxSynchronize() - -@pytest.mark.benchmark(group="launch-latency") -def test_launch_latency_small_kernel_512_bytes(benchmark, init_cuda, load_module): - device, ctx, stream = init_cuda - module = load_module(kernel_string, device) - - err, func = cuda.cuModuleGetFunction(module, b'small_kernel_512_chars') - ASSERT_DRV(err) - - args = [127] * 512 - arg_types = [ctypes.c_byte] * 512 - - args = tuple(args) - arg_types = tuple(arg_types) - - benchmark(launch, func, stream, args=args, arg_types=arg_types) - - cuda.cuCtxSynchronize() - -@pytest.mark.benchmark(group="launch-latency") -def test_launch_latency_small_kernel_512_longlongs(benchmark, init_cuda, load_module): - device, ctx, stream = init_cuda - module = load_module(kernel_string, device) - - err, func = cuda.cuModuleGetFunction(module, b'small_kernel_512_longlongs') - ASSERT_DRV(err) - - args = [9223372036854775806] * 512 - arg_types = [ctypes.c_longlong] * 512 - - args = tuple(args) - arg_types = tuple(arg_types) - - benchmark(launch, func, stream, args=args, arg_types=arg_types) - - cuda.cuCtxSynchronize() - -# Measure launch latency with many parameters using builtin parameter packing -@pytest.mark.benchmark(group="launch-latency") -def test_launch_latency_small_kernel_256_args(benchmark, init_cuda, load_module): - device, ctx, stream = init_cuda - module = load_module(kernel_string, device) - - err, func = cuda.cuModuleGetFunction(module, b'small_kernel_256_args') - ASSERT_DRV(err) - - args = [] - arg_types = [None] * 256 - for _ in arg_types: - err, p = cuda.cuMemAlloc(ctypes.sizeof(ctypes.c_int)) - ASSERT_DRV(err) - args.append(p) - - args = tuple(args) - arg_types = tuple(arg_types) - - benchmark(launch, func, stream, args=args, arg_types=arg_types) - - cuda.cuCtxSynchronize() - - for p in args: - err, = cuda.cuMemFree(p) - ASSERT_DRV(err) - -# Measure launch latency with many parameters using builtin parameter packing -@pytest.mark.benchmark(group="launch-latency") -def test_launch_latency_small_kernel_16_args(benchmark, init_cuda, load_module): - device, ctx, stream = init_cuda - module = load_module(kernel_string, device) - - err, func = cuda.cuModuleGetFunction(module, b'small_kernel_16_args') - ASSERT_DRV(err) - - args = [] - arg_types = [None] * 16 - for _ in arg_types: - err, p = cuda.cuMemAlloc(ctypes.sizeof(ctypes.c_int)) - ASSERT_DRV(err) - args.append(p) - - args = tuple(args) - arg_types = tuple(arg_types) - - benchmark(launch, func, stream, args=args, arg_types=arg_types) - - cuda.cuCtxSynchronize() - - for p in args: - err, = cuda.cuMemFree(p) - ASSERT_DRV(err) - -# Measure launch latency with many parameters, excluding parameter packing -@pytest.mark.benchmark(group="launch-latency") -def test_launch_latency_small_kernel_512_args_ctypes(benchmark, init_cuda, load_module): - device, ctx, stream = init_cuda - module = load_module(kernel_string, device) - - err, func = cuda.cuModuleGetFunction(module, b'small_kernel_512_args') - ASSERT_DRV(err) - - vals = [] - val_ps = [] - for i in range(512): - err, p = cuda.cuMemAlloc(ctypes.sizeof(ctypes.c_int)) - ASSERT_DRV(err) - vals.append(p) - val_ps.append(ctypes.c_void_p(int(vals[i]))) - - packagedParams = (ctypes.c_void_p * 512)() - for i in range(512): - packagedParams[i] = ctypes.addressof(val_ps[i]) - - benchmark(launch_packed, func, stream, packagedParams) - - cuda.cuCtxSynchronize() - - for p in vals: - err, = cuda.cuMemFree(p) - ASSERT_DRV(err) - -def pack_and_launch(kernel, stream, params): - packed_params = (ctypes.c_void_p * len(params))() - ptrs = [0] * len(params) - for i in range(len(params)): - ptrs[i] = ctypes.c_void_p(int(params[i])) - packed_params[i] = ctypes.addressof(ptrs[i]) - - cuda.cuLaunchKernel(kernel, - 1, 1, 1, - 1, 1, 1, - 0, stream, - packed_params, 0) - -# Measure launch latency plus parameter packing using ctypes -@pytest.mark.benchmark(group="launch-latency") -def test_launch_latency_small_kernel_512_args_ctypes_with_packing(benchmark, init_cuda, load_module): - device, ctx, stream = init_cuda - module = load_module(kernel_string, device) - - err, func = cuda.cuModuleGetFunction(module, b'small_kernel_512_args') - ASSERT_DRV(err) - - vals = [] - for i in range(512): - err, p = cuda.cuMemAlloc(ctypes.sizeof(ctypes.c_int)) - ASSERT_DRV(err) - vals.append(p) - - benchmark(pack_and_launch, func, stream, vals) - - cuda.cuCtxSynchronize() - - for p in vals: - err, = cuda.cuMemFree(p) - ASSERT_DRV(err) - -# Measure launch latency with a single large struct parameter -@pytest.mark.benchmark(group="launch-latency") -def test_launch_latency_small_kernel_2048B(benchmark, init_cuda, load_module): - device, ctx, stream = init_cuda - module = load_module(kernel_string, device) - - err, func = cuda.cuModuleGetFunction(module, b'small_kernel_2048B') - ASSERT_DRV(err) - - class struct_2048B(ctypes.Structure): - _fields_ = [('values',ctypes.c_uint8 * 2048)] - - benchmark(launch, func, stream, args=(struct_2048B(),), arg_types=(None,)) - - cuda.cuCtxSynchronize() diff --git a/cuda/benchmarks/test_numba.py b/cuda/benchmarks/test_numba.py deleted file mode 100644 index f0dd12316e1..00000000000 --- a/cuda/benchmarks/test_numba.py +++ /dev/null @@ -1,50 +0,0 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. -# -# Please refer to the NVIDIA end user license agreement (EULA) associated -# with this source code for terms and conditions that govern your use of -# this software. Any use, reproduction, disclosure, or distribution of -# this software and related documentation outside the terms of the EULA -# is strictly prohibited. -import pytest -import numpy as np -try: - from numba import cuda - skip_tests = False -except ImportError: - skip_tests = True - -def launch_empty(kernel, stream): - kernel[1,1, stream]() - -def launch(kernel, stream, arg): - kernel[1,1, stream](arg) - -# Measure launch latency with no parmaeters -@pytest.mark.skipif(skip_tests, reason="Numba is not installed") -@pytest.mark.benchmark(group="numba", min_rounds=1000) -def test_launch_latency_empty_kernel(benchmark): - stream = cuda.stream() - - @cuda.jit - def empty_kernel(): - return - - benchmark(launch_empty, empty_kernel, stream) - - cuda.synchronize() - -# Measure launch latency with a single parameter -@pytest.mark.skipif(skip_tests, reason="Numba is not installed") -@pytest.mark.benchmark(group="numba", min_rounds=1000) -def test_launch_latency_small_kernel(benchmark): - stream = cuda.stream() - - arg = cuda.device_array(1, dtype=np.float32, stream=stream) - - @cuda.jit - def small_kernel(array): - array[0] = 0.0 - - benchmark(launch, small_kernel, stream, arg) - - cuda.synchronize() diff --git a/cuda/benchmarks/test_pointer_attributes.py b/cuda/benchmarks/test_pointer_attributes.py deleted file mode 100644 index 72de39641dc..00000000000 --- a/cuda/benchmarks/test_pointer_attributes.py +++ /dev/null @@ -1,106 +0,0 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. -# -# Please refer to the NVIDIA end user license agreement (EULA) associated -# with this source code for terms and conditions that govern your use of -# this software. Any use, reproduction, disclosure, or distribution of -# this software and related documentation outside the terms of the EULA -# is strictly prohibited. -import pytest -from cuda import cuda -import ctypes -import random - -from .perf_test_utils import ASSERT_DRV, init_cuda - -random.seed(0) - -idx = 0 -def query_attribute(attribute, ptrs): - global idx - ptr = ptrs[idx] - idx = (idx + 1 ) % len(ptrs) - - cuda.cuPointerGetAttribute(attribute, ptr) - -def query_attributes(attributes, ptrs): - global idx - ptr = ptrs[idx] - idx = (idx + 1 ) % len(ptrs) - - cuda.cuPointerGetAttributes(len(attributes), attributes, ptr) - -@pytest.mark.benchmark(group="pointer-attributes") -# Measure cuPointerGetAttribute in the same way as C benchmarks -def test_pointer_get_attribute(benchmark, init_cuda): - _ = init_cuda - - ptrs = [] - for _ in range(500): - err, ptr = cuda.cuMemAlloc(1 << 18) - ASSERT_DRV(err) - ptrs.append(ptr) - - random.shuffle(ptrs) - - benchmark(query_attribute, cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_MEMORY_TYPE, ptrs) - - for p in ptrs: - err, = cuda.cuMemFree(p) - ASSERT_DRV(err) - -@pytest.mark.benchmark(group="pointer-attributes") -# Measure cuPointerGetAttributes with all attributes -def test_pointer_get_attributes_all(benchmark, init_cuda): - _ = init_cuda - - ptrs = [] - for _ in range(500): - err, ptr = cuda.cuMemAlloc(1 << 18) - ASSERT_DRV(err) - ptrs.append(ptr) - - random.shuffle(ptrs) - - attributes = [cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_CONTEXT, - cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_MEMORY_TYPE, - cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_HOST_POINTER, - cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_P2P_TOKENS, - cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_SYNC_MEMOPS, - cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_BUFFER_ID, - cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_IS_MANAGED, - cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_DEVICE_ORDINAL, - cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_IS_LEGACY_CUDA_IPC_CAPABLE, - cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_RANGE_START_ADDR, - cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_RANGE_SIZE, - cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_MAPPED, - cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_ALLOWED_HANDLE_TYPES, - cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_IS_GPU_DIRECT_RDMA_CAPABLE, - cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_ACCESS_FLAGS, - cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_MEMPOOL_HANDLE] - - benchmark(query_attributes, attributes, ptrs) - - for p in ptrs: - err, = cuda.cuMemFree(p) - ASSERT_DRV(err) - -@pytest.mark.benchmark(group="pointer-attributes") -# Measure cuPointerGetAttributes with a single attribute -def test_pointer_get_attributes_single(benchmark, init_cuda): - _ = init_cuda - - ptrs = [] - for _ in range(500): - err, ptr = cuda.cuMemAlloc(1 << 18) - ASSERT_DRV(err) - ptrs.append(ptr) - - random.shuffle(ptrs) - - attributes = [cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_MEMORY_TYPE,] - - benchmark(query_attributes, attributes, ptrs) - - for p in ptrs: - err, = cuda.cuMemFree(p) - ASSERT_DRV(err) diff --git a/cuda/ccuda.pxd.in b/cuda/ccuda.pxd.in deleted file mode 100644 index 91e051d4c4d..00000000000 --- a/cuda/ccuda.pxd.in +++ /dev/null @@ -1,4835 +0,0 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. -# -# Please refer to the NVIDIA end user license agreement (EULA) associated -# with this source code for terms and conditions that govern your use of -# this software. Any use, reproduction, disclosure, or distribution of -# this software and related documentation outside the terms of the EULA -# is strictly prohibited. - -from libc.stdint cimport uint32_t, uint64_t - -cdef extern from "cuda.h": - - ctypedef uint32_t cuuint32_t - - ctypedef uint64_t cuuint64_t - - ctypedef unsigned long long CUdeviceptr_v2 - - ctypedef CUdeviceptr_v2 CUdeviceptr - - ctypedef int CUdevice_v1 - - ctypedef CUdevice_v1 CUdevice - - cdef struct CUctx_st: - pass - ctypedef CUctx_st* CUcontext - - cdef struct CUmod_st: - pass - ctypedef CUmod_st* CUmodule - - cdef struct CUfunc_st: - pass - ctypedef CUfunc_st* CUfunction - - cdef struct CUlib_st: - pass - ctypedef CUlib_st* CUlibrary - - cdef struct CUkern_st: - pass - ctypedef CUkern_st* CUkernel - - cdef struct CUarray_st: - pass - ctypedef CUarray_st* CUarray - - cdef struct CUmipmappedArray_st: - pass - ctypedef CUmipmappedArray_st* CUmipmappedArray - - cdef struct CUtexref_st: - pass - ctypedef CUtexref_st* CUtexref - - cdef struct CUsurfref_st: - pass - ctypedef CUsurfref_st* CUsurfref - - cdef struct CUevent_st: - pass - ctypedef CUevent_st* CUevent - - cdef struct CUstream_st: - pass - ctypedef CUstream_st* CUstream - - cdef struct CUgraphicsResource_st: - pass - ctypedef CUgraphicsResource_st* CUgraphicsResource - - ctypedef unsigned long long CUtexObject_v1 - - ctypedef CUtexObject_v1 CUtexObject - - ctypedef unsigned long long CUsurfObject_v1 - - ctypedef CUsurfObject_v1 CUsurfObject - - cdef struct CUextMemory_st: - pass - ctypedef CUextMemory_st* CUexternalMemory - - cdef struct CUextSemaphore_st: - pass - ctypedef CUextSemaphore_st* CUexternalSemaphore - - cdef struct CUgraph_st: - pass - ctypedef CUgraph_st* CUgraph - - cdef struct CUgraphNode_st: - pass - ctypedef CUgraphNode_st* CUgraphNode - - cdef struct CUgraphExec_st: - pass - ctypedef CUgraphExec_st* CUgraphExec - - cdef struct CUmemPoolHandle_st: - pass - ctypedef CUmemPoolHandle_st* CUmemoryPool - - cdef struct CUuserObject_st: - pass - ctypedef CUuserObject_st* CUuserObject - - ctypedef cuuint64_t CUgraphConditionalHandle - - cdef struct CUgraphDeviceUpdatableNode_st: - pass - ctypedef CUgraphDeviceUpdatableNode_st* CUgraphDeviceNode - - cdef struct CUasyncCallbackEntry_st: - pass - ctypedef CUasyncCallbackEntry_st* CUasyncCallbackHandle - - cdef struct CUgreenCtx_st: - pass - ctypedef CUgreenCtx_st* CUgreenCtx - - cdef struct CUuuid_st: - char bytes[16] - - ctypedef CUuuid_st CUuuid - - cdef struct CUmemFabricHandle_st: - unsigned char data[64] - - ctypedef CUmemFabricHandle_st CUmemFabricHandle_v1 - - ctypedef CUmemFabricHandle_v1 CUmemFabricHandle - - cdef struct CUipcEventHandle_st: - char reserved[64] - - ctypedef CUipcEventHandle_st CUipcEventHandle_v1 - - ctypedef CUipcEventHandle_v1 CUipcEventHandle - - cdef struct CUipcMemHandle_st: - char reserved[64] - - ctypedef CUipcMemHandle_st CUipcMemHandle_v1 - - ctypedef CUipcMemHandle_v1 CUipcMemHandle - - cdef enum CUipcMem_flags_enum: - CU_IPC_MEM_LAZY_ENABLE_PEER_ACCESS = 1 - - ctypedef CUipcMem_flags_enum CUipcMem_flags - - cdef enum CUmemAttach_flags_enum: - CU_MEM_ATTACH_GLOBAL = 1 - CU_MEM_ATTACH_HOST = 2 - CU_MEM_ATTACH_SINGLE = 4 - - ctypedef CUmemAttach_flags_enum CUmemAttach_flags - - cdef enum CUctx_flags_enum: - CU_CTX_SCHED_AUTO = 0 - CU_CTX_SCHED_SPIN = 1 - CU_CTX_SCHED_YIELD = 2 - CU_CTX_SCHED_BLOCKING_SYNC = 4 - CU_CTX_BLOCKING_SYNC = 4 - CU_CTX_SCHED_MASK = 7 - CU_CTX_MAP_HOST = 8 - CU_CTX_LMEM_RESIZE_TO_MAX = 16 - CU_CTX_COREDUMP_ENABLE = 32 - CU_CTX_USER_COREDUMP_ENABLE = 64 - CU_CTX_SYNC_MEMOPS = 128 - CU_CTX_FLAGS_MASK = 255 - - ctypedef CUctx_flags_enum CUctx_flags - - cdef enum CUevent_sched_flags_enum: - CU_EVENT_SCHED_AUTO = 0 - CU_EVENT_SCHED_SPIN = 1 - CU_EVENT_SCHED_YIELD = 2 - CU_EVENT_SCHED_BLOCKING_SYNC = 4 - - ctypedef CUevent_sched_flags_enum CUevent_sched_flags - - cdef enum cl_event_flags_enum: - NVCL_EVENT_SCHED_AUTO = 0 - NVCL_EVENT_SCHED_SPIN = 1 - NVCL_EVENT_SCHED_YIELD = 2 - NVCL_EVENT_SCHED_BLOCKING_SYNC = 4 - - ctypedef cl_event_flags_enum cl_event_flags - - cdef enum cl_context_flags_enum: - NVCL_CTX_SCHED_AUTO = 0 - NVCL_CTX_SCHED_SPIN = 1 - NVCL_CTX_SCHED_YIELD = 2 - NVCL_CTX_SCHED_BLOCKING_SYNC = 4 - - ctypedef cl_context_flags_enum cl_context_flags - - cdef enum CUstream_flags_enum: - CU_STREAM_DEFAULT = 0 - CU_STREAM_NON_BLOCKING = 1 - - ctypedef CUstream_flags_enum CUstream_flags - - cdef enum CUevent_flags_enum: - CU_EVENT_DEFAULT = 0 - CU_EVENT_BLOCKING_SYNC = 1 - CU_EVENT_DISABLE_TIMING = 2 - CU_EVENT_INTERPROCESS = 4 - - ctypedef CUevent_flags_enum CUevent_flags - - cdef enum CUevent_record_flags_enum: - CU_EVENT_RECORD_DEFAULT = 0 - CU_EVENT_RECORD_EXTERNAL = 1 - - ctypedef CUevent_record_flags_enum CUevent_record_flags - - cdef enum CUevent_wait_flags_enum: - CU_EVENT_WAIT_DEFAULT = 0 - CU_EVENT_WAIT_EXTERNAL = 1 - - ctypedef CUevent_wait_flags_enum CUevent_wait_flags - - cdef enum CUstreamWaitValue_flags_enum: - CU_STREAM_WAIT_VALUE_GEQ = 0 - CU_STREAM_WAIT_VALUE_EQ = 1 - CU_STREAM_WAIT_VALUE_AND = 2 - CU_STREAM_WAIT_VALUE_NOR = 3 - CU_STREAM_WAIT_VALUE_FLUSH = 1073741824 - - ctypedef CUstreamWaitValue_flags_enum CUstreamWaitValue_flags - - cdef enum CUstreamWriteValue_flags_enum: - CU_STREAM_WRITE_VALUE_DEFAULT = 0 - CU_STREAM_WRITE_VALUE_NO_MEMORY_BARRIER = 1 - - ctypedef CUstreamWriteValue_flags_enum CUstreamWriteValue_flags - - cdef enum CUstreamBatchMemOpType_enum: - CU_STREAM_MEM_OP_WAIT_VALUE_32 = 1 - CU_STREAM_MEM_OP_WRITE_VALUE_32 = 2 - CU_STREAM_MEM_OP_FLUSH_REMOTE_WRITES = 3 - CU_STREAM_MEM_OP_WAIT_VALUE_64 = 4 - CU_STREAM_MEM_OP_WRITE_VALUE_64 = 5 - CU_STREAM_MEM_OP_BARRIER = 6 - - ctypedef CUstreamBatchMemOpType_enum CUstreamBatchMemOpType - - cdef enum CUstreamMemoryBarrier_flags_enum: - CU_STREAM_MEMORY_BARRIER_TYPE_SYS = 0 - CU_STREAM_MEMORY_BARRIER_TYPE_GPU = 1 - - ctypedef CUstreamMemoryBarrier_flags_enum CUstreamMemoryBarrier_flags - - cdef struct CUstreamMemOpWaitValueParams_st: - CUstreamBatchMemOpType operation - CUdeviceptr address - cuuint32_t value - cuuint64_t value64 - unsigned int flags - CUdeviceptr alias - - cdef struct CUstreamMemOpWriteValueParams_st: - CUstreamBatchMemOpType operation - CUdeviceptr address - cuuint32_t value - cuuint64_t value64 - unsigned int flags - CUdeviceptr alias - - cdef struct CUstreamMemOpFlushRemoteWritesParams_st: - CUstreamBatchMemOpType operation - unsigned int flags - - cdef struct CUstreamMemOpMemoryBarrierParams_st: - CUstreamBatchMemOpType operation - unsigned int flags - - cdef union CUstreamBatchMemOpParams_union: - CUstreamBatchMemOpType operation - CUstreamMemOpWaitValueParams_st waitValue - CUstreamMemOpWriteValueParams_st writeValue - CUstreamMemOpFlushRemoteWritesParams_st flushRemoteWrites - CUstreamMemOpMemoryBarrierParams_st memoryBarrier - cuuint64_t pad[6] - - ctypedef CUstreamBatchMemOpParams_union CUstreamBatchMemOpParams_v1 - - ctypedef CUstreamBatchMemOpParams_v1 CUstreamBatchMemOpParams - - cdef struct CUDA_BATCH_MEM_OP_NODE_PARAMS_v1_st: - CUcontext ctx - unsigned int count - CUstreamBatchMemOpParams* paramArray - unsigned int flags - - ctypedef CUDA_BATCH_MEM_OP_NODE_PARAMS_v1_st CUDA_BATCH_MEM_OP_NODE_PARAMS_v1 - - ctypedef CUDA_BATCH_MEM_OP_NODE_PARAMS_v1 CUDA_BATCH_MEM_OP_NODE_PARAMS - - cdef struct CUDA_BATCH_MEM_OP_NODE_PARAMS_v2_st: - CUcontext ctx - unsigned int count - CUstreamBatchMemOpParams* paramArray - unsigned int flags - - ctypedef CUDA_BATCH_MEM_OP_NODE_PARAMS_v2_st CUDA_BATCH_MEM_OP_NODE_PARAMS_v2 - - cdef enum CUoccupancy_flags_enum: - CU_OCCUPANCY_DEFAULT = 0 - CU_OCCUPANCY_DISABLE_CACHING_OVERRIDE = 1 - - ctypedef CUoccupancy_flags_enum CUoccupancy_flags - - cdef enum CUstreamUpdateCaptureDependencies_flags_enum: - CU_STREAM_ADD_CAPTURE_DEPENDENCIES = 0 - CU_STREAM_SET_CAPTURE_DEPENDENCIES = 1 - - ctypedef CUstreamUpdateCaptureDependencies_flags_enum CUstreamUpdateCaptureDependencies_flags - - cdef enum CUasyncNotificationType_enum: - CU_ASYNC_NOTIFICATION_TYPE_OVER_BUDGET = 1 - - ctypedef CUasyncNotificationType_enum CUasyncNotificationType - - cdef struct anon_struct0: - unsigned long long bytesOverBudget - - cdef union anon_union2: - anon_struct0 overBudget - - cdef struct CUasyncNotificationInfo_st: - CUasyncNotificationType type - anon_union2 info - - ctypedef CUasyncNotificationInfo_st CUasyncNotificationInfo - - ctypedef void (*CUasyncCallback)(CUasyncNotificationInfo* info, void* userData, CUasyncCallbackHandle callback) - - cdef enum CUarray_format_enum: - CU_AD_FORMAT_UNSIGNED_INT8 = 1 - CU_AD_FORMAT_UNSIGNED_INT16 = 2 - CU_AD_FORMAT_UNSIGNED_INT32 = 3 - CU_AD_FORMAT_SIGNED_INT8 = 8 - CU_AD_FORMAT_SIGNED_INT16 = 9 - CU_AD_FORMAT_SIGNED_INT32 = 10 - CU_AD_FORMAT_HALF = 16 - CU_AD_FORMAT_FLOAT = 32 - CU_AD_FORMAT_BC1_UNORM = 145 - CU_AD_FORMAT_BC1_UNORM_SRGB = 146 - CU_AD_FORMAT_BC2_UNORM = 147 - CU_AD_FORMAT_BC2_UNORM_SRGB = 148 - CU_AD_FORMAT_BC3_UNORM = 149 - CU_AD_FORMAT_BC3_UNORM_SRGB = 150 - CU_AD_FORMAT_BC4_UNORM = 151 - CU_AD_FORMAT_BC4_SNORM = 152 - CU_AD_FORMAT_BC5_UNORM = 153 - CU_AD_FORMAT_BC5_SNORM = 154 - CU_AD_FORMAT_BC6H_UF16 = 155 - CU_AD_FORMAT_BC6H_SF16 = 156 - CU_AD_FORMAT_BC7_UNORM = 157 - CU_AD_FORMAT_BC7_UNORM_SRGB = 158 - CU_AD_FORMAT_P010 = 159 - CU_AD_FORMAT_P016 = 161 - CU_AD_FORMAT_NV16 = 162 - CU_AD_FORMAT_P210 = 163 - CU_AD_FORMAT_P216 = 164 - CU_AD_FORMAT_YUY2 = 165 - CU_AD_FORMAT_Y210 = 166 - CU_AD_FORMAT_Y216 = 167 - CU_AD_FORMAT_AYUV = 168 - CU_AD_FORMAT_Y410 = 169 - CU_AD_FORMAT_NV12 = 176 - CU_AD_FORMAT_Y416 = 177 - CU_AD_FORMAT_Y444_PLANAR8 = 178 - CU_AD_FORMAT_Y444_PLANAR10 = 179 - CU_AD_FORMAT_UNORM_INT8X1 = 192 - CU_AD_FORMAT_UNORM_INT8X2 = 193 - CU_AD_FORMAT_UNORM_INT8X4 = 194 - CU_AD_FORMAT_UNORM_INT16X1 = 195 - CU_AD_FORMAT_UNORM_INT16X2 = 196 - CU_AD_FORMAT_UNORM_INT16X4 = 197 - CU_AD_FORMAT_SNORM_INT8X1 = 198 - CU_AD_FORMAT_SNORM_INT8X2 = 199 - CU_AD_FORMAT_SNORM_INT8X4 = 200 - CU_AD_FORMAT_SNORM_INT16X1 = 201 - CU_AD_FORMAT_SNORM_INT16X2 = 202 - CU_AD_FORMAT_SNORM_INT16X4 = 203 - CU_AD_FORMAT_MAX = 2147483647 - - ctypedef CUarray_format_enum CUarray_format - - cdef enum CUaddress_mode_enum: - CU_TR_ADDRESS_MODE_WRAP = 0 - CU_TR_ADDRESS_MODE_CLAMP = 1 - CU_TR_ADDRESS_MODE_MIRROR = 2 - CU_TR_ADDRESS_MODE_BORDER = 3 - - ctypedef CUaddress_mode_enum CUaddress_mode - - cdef enum CUfilter_mode_enum: - CU_TR_FILTER_MODE_POINT = 0 - CU_TR_FILTER_MODE_LINEAR = 1 - - ctypedef CUfilter_mode_enum CUfilter_mode - - cdef enum CUdevice_attribute_enum: - CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_BLOCK = 1 - CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_X = 2 - CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Y = 3 - CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Z = 4 - CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_X = 5 - CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Y = 6 - CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Z = 7 - CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK = 8 - CU_DEVICE_ATTRIBUTE_SHARED_MEMORY_PER_BLOCK = 8 - CU_DEVICE_ATTRIBUTE_TOTAL_CONSTANT_MEMORY = 9 - CU_DEVICE_ATTRIBUTE_WARP_SIZE = 10 - CU_DEVICE_ATTRIBUTE_MAX_PITCH = 11 - CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_BLOCK = 12 - CU_DEVICE_ATTRIBUTE_REGISTERS_PER_BLOCK = 12 - CU_DEVICE_ATTRIBUTE_CLOCK_RATE = 13 - CU_DEVICE_ATTRIBUTE_TEXTURE_ALIGNMENT = 14 - CU_DEVICE_ATTRIBUTE_GPU_OVERLAP = 15 - CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT = 16 - CU_DEVICE_ATTRIBUTE_KERNEL_EXEC_TIMEOUT = 17 - CU_DEVICE_ATTRIBUTE_INTEGRATED = 18 - CU_DEVICE_ATTRIBUTE_CAN_MAP_HOST_MEMORY = 19 - CU_DEVICE_ATTRIBUTE_COMPUTE_MODE = 20 - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_WIDTH = 21 - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_WIDTH = 22 - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_HEIGHT = 23 - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_WIDTH = 24 - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_HEIGHT = 25 - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_DEPTH = 26 - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_WIDTH = 27 - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_WIDTH = 27 - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_HEIGHT = 28 - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_HEIGHT = 28 - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_LAYERS = 29 - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_NUMSLICES = 29 - CU_DEVICE_ATTRIBUTE_SURFACE_ALIGNMENT = 30 - CU_DEVICE_ATTRIBUTE_CONCURRENT_KERNELS = 31 - CU_DEVICE_ATTRIBUTE_ECC_ENABLED = 32 - CU_DEVICE_ATTRIBUTE_PCI_BUS_ID = 33 - CU_DEVICE_ATTRIBUTE_PCI_DEVICE_ID = 34 - CU_DEVICE_ATTRIBUTE_TCC_DRIVER = 35 - CU_DEVICE_ATTRIBUTE_MEMORY_CLOCK_RATE = 36 - CU_DEVICE_ATTRIBUTE_GLOBAL_MEMORY_BUS_WIDTH = 37 - CU_DEVICE_ATTRIBUTE_L2_CACHE_SIZE = 38 - CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_MULTIPROCESSOR = 39 - CU_DEVICE_ATTRIBUTE_ASYNC_ENGINE_COUNT = 40 - CU_DEVICE_ATTRIBUTE_UNIFIED_ADDRESSING = 41 - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LAYERED_WIDTH = 42 - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LAYERED_LAYERS = 43 - CU_DEVICE_ATTRIBUTE_CAN_TEX2D_GATHER = 44 - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_GATHER_WIDTH = 45 - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_GATHER_HEIGHT = 46 - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_WIDTH_ALTERNATE = 47 - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_HEIGHT_ALTERNATE = 48 - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_DEPTH_ALTERNATE = 49 - CU_DEVICE_ATTRIBUTE_PCI_DOMAIN_ID = 50 - CU_DEVICE_ATTRIBUTE_TEXTURE_PITCH_ALIGNMENT = 51 - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_WIDTH = 52 - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_LAYERED_WIDTH = 53 - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_LAYERED_LAYERS = 54 - CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_WIDTH = 55 - CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_WIDTH = 56 - CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_HEIGHT = 57 - CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_WIDTH = 58 - CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_HEIGHT = 59 - CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_DEPTH = 60 - CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_LAYERED_WIDTH = 61 - CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_LAYERED_LAYERS = 62 - CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_WIDTH = 63 - CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_HEIGHT = 64 - CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_LAYERS = 65 - CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_WIDTH = 66 - CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_LAYERED_WIDTH = 67 - CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_LAYERED_LAYERS = 68 - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LINEAR_WIDTH = 69 - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_WIDTH = 70 - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_HEIGHT = 71 - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_PITCH = 72 - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_MIPMAPPED_WIDTH = 73 - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_MIPMAPPED_HEIGHT = 74 - CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR = 75 - CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR = 76 - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_MIPMAPPED_WIDTH = 77 - CU_DEVICE_ATTRIBUTE_STREAM_PRIORITIES_SUPPORTED = 78 - CU_DEVICE_ATTRIBUTE_GLOBAL_L1_CACHE_SUPPORTED = 79 - CU_DEVICE_ATTRIBUTE_LOCAL_L1_CACHE_SUPPORTED = 80 - CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_MULTIPROCESSOR = 81 - CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_MULTIPROCESSOR = 82 - CU_DEVICE_ATTRIBUTE_MANAGED_MEMORY = 83 - CU_DEVICE_ATTRIBUTE_MULTI_GPU_BOARD = 84 - CU_DEVICE_ATTRIBUTE_MULTI_GPU_BOARD_GROUP_ID = 85 - CU_DEVICE_ATTRIBUTE_HOST_NATIVE_ATOMIC_SUPPORTED = 86 - CU_DEVICE_ATTRIBUTE_SINGLE_TO_DOUBLE_PRECISION_PERF_RATIO = 87 - CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS = 88 - CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS = 89 - CU_DEVICE_ATTRIBUTE_COMPUTE_PREEMPTION_SUPPORTED = 90 - CU_DEVICE_ATTRIBUTE_CAN_USE_HOST_POINTER_FOR_REGISTERED_MEM = 91 - CU_DEVICE_ATTRIBUTE_CAN_USE_STREAM_MEM_OPS_V1 = 92 - CU_DEVICE_ATTRIBUTE_CAN_USE_64_BIT_STREAM_MEM_OPS_V1 = 93 - CU_DEVICE_ATTRIBUTE_CAN_USE_STREAM_WAIT_VALUE_NOR_V1 = 94 - CU_DEVICE_ATTRIBUTE_COOPERATIVE_LAUNCH = 95 - CU_DEVICE_ATTRIBUTE_COOPERATIVE_MULTI_DEVICE_LAUNCH = 96 - CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK_OPTIN = 97 - CU_DEVICE_ATTRIBUTE_CAN_FLUSH_REMOTE_WRITES = 98 - CU_DEVICE_ATTRIBUTE_HOST_REGISTER_SUPPORTED = 99 - CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS_USES_HOST_PAGE_TABLES = 100 - CU_DEVICE_ATTRIBUTE_DIRECT_MANAGED_MEM_ACCESS_FROM_HOST = 101 - CU_DEVICE_ATTRIBUTE_VIRTUAL_ADDRESS_MANAGEMENT_SUPPORTED = 102 - CU_DEVICE_ATTRIBUTE_VIRTUAL_MEMORY_MANAGEMENT_SUPPORTED = 102 - CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_POSIX_FILE_DESCRIPTOR_SUPPORTED = 103 - CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_WIN32_HANDLE_SUPPORTED = 104 - CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_WIN32_KMT_HANDLE_SUPPORTED = 105 - CU_DEVICE_ATTRIBUTE_MAX_BLOCKS_PER_MULTIPROCESSOR = 106 - CU_DEVICE_ATTRIBUTE_GENERIC_COMPRESSION_SUPPORTED = 107 - CU_DEVICE_ATTRIBUTE_MAX_PERSISTING_L2_CACHE_SIZE = 108 - CU_DEVICE_ATTRIBUTE_MAX_ACCESS_POLICY_WINDOW_SIZE = 109 - CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_WITH_CUDA_VMM_SUPPORTED = 110 - CU_DEVICE_ATTRIBUTE_RESERVED_SHARED_MEMORY_PER_BLOCK = 111 - CU_DEVICE_ATTRIBUTE_SPARSE_CUDA_ARRAY_SUPPORTED = 112 - CU_DEVICE_ATTRIBUTE_READ_ONLY_HOST_REGISTER_SUPPORTED = 113 - CU_DEVICE_ATTRIBUTE_TIMELINE_SEMAPHORE_INTEROP_SUPPORTED = 114 - CU_DEVICE_ATTRIBUTE_MEMORY_POOLS_SUPPORTED = 115 - CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_SUPPORTED = 116 - CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_FLUSH_WRITES_OPTIONS = 117 - CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_WRITES_ORDERING = 118 - CU_DEVICE_ATTRIBUTE_MEMPOOL_SUPPORTED_HANDLE_TYPES = 119 - CU_DEVICE_ATTRIBUTE_CLUSTER_LAUNCH = 120 - CU_DEVICE_ATTRIBUTE_DEFERRED_MAPPING_CUDA_ARRAY_SUPPORTED = 121 - CU_DEVICE_ATTRIBUTE_CAN_USE_64_BIT_STREAM_MEM_OPS = 122 - CU_DEVICE_ATTRIBUTE_CAN_USE_STREAM_WAIT_VALUE_NOR = 123 - CU_DEVICE_ATTRIBUTE_DMA_BUF_SUPPORTED = 124 - CU_DEVICE_ATTRIBUTE_IPC_EVENT_SUPPORTED = 125 - CU_DEVICE_ATTRIBUTE_MEM_SYNC_DOMAIN_COUNT = 126 - CU_DEVICE_ATTRIBUTE_TENSOR_MAP_ACCESS_SUPPORTED = 127 - CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_FABRIC_SUPPORTED = 128 - CU_DEVICE_ATTRIBUTE_UNIFIED_FUNCTION_POINTERS = 129 - CU_DEVICE_ATTRIBUTE_NUMA_CONFIG = 130 - CU_DEVICE_ATTRIBUTE_NUMA_ID = 131 - CU_DEVICE_ATTRIBUTE_MULTICAST_SUPPORTED = 132 - CU_DEVICE_ATTRIBUTE_MPS_ENABLED = 133 - CU_DEVICE_ATTRIBUTE_HOST_NUMA_ID = 134 - CU_DEVICE_ATTRIBUTE_D3D12_CIG_SUPPORTED = 135 - CU_DEVICE_ATTRIBUTE_MAX = 136 - - ctypedef CUdevice_attribute_enum CUdevice_attribute - - cdef struct CUdevprop_st: - int maxThreadsPerBlock - int maxThreadsDim[3] - int maxGridSize[3] - int sharedMemPerBlock - int totalConstantMemory - int SIMDWidth - int memPitch - int regsPerBlock - int clockRate - int textureAlign - - ctypedef CUdevprop_st CUdevprop_v1 - - ctypedef CUdevprop_v1 CUdevprop - - cdef enum CUpointer_attribute_enum: - CU_POINTER_ATTRIBUTE_CONTEXT = 1 - CU_POINTER_ATTRIBUTE_MEMORY_TYPE = 2 - CU_POINTER_ATTRIBUTE_DEVICE_POINTER = 3 - CU_POINTER_ATTRIBUTE_HOST_POINTER = 4 - CU_POINTER_ATTRIBUTE_P2P_TOKENS = 5 - CU_POINTER_ATTRIBUTE_SYNC_MEMOPS = 6 - CU_POINTER_ATTRIBUTE_BUFFER_ID = 7 - CU_POINTER_ATTRIBUTE_IS_MANAGED = 8 - CU_POINTER_ATTRIBUTE_DEVICE_ORDINAL = 9 - CU_POINTER_ATTRIBUTE_IS_LEGACY_CUDA_IPC_CAPABLE = 10 - CU_POINTER_ATTRIBUTE_RANGE_START_ADDR = 11 - CU_POINTER_ATTRIBUTE_RANGE_SIZE = 12 - CU_POINTER_ATTRIBUTE_MAPPED = 13 - CU_POINTER_ATTRIBUTE_ALLOWED_HANDLE_TYPES = 14 - CU_POINTER_ATTRIBUTE_IS_GPU_DIRECT_RDMA_CAPABLE = 15 - CU_POINTER_ATTRIBUTE_ACCESS_FLAGS = 16 - CU_POINTER_ATTRIBUTE_MEMPOOL_HANDLE = 17 - CU_POINTER_ATTRIBUTE_MAPPING_SIZE = 18 - CU_POINTER_ATTRIBUTE_MAPPING_BASE_ADDR = 19 - CU_POINTER_ATTRIBUTE_MEMORY_BLOCK_ID = 20 - - ctypedef CUpointer_attribute_enum CUpointer_attribute - - cdef enum CUfunction_attribute_enum: - CU_FUNC_ATTRIBUTE_MAX_THREADS_PER_BLOCK = 0 - CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES = 1 - CU_FUNC_ATTRIBUTE_CONST_SIZE_BYTES = 2 - CU_FUNC_ATTRIBUTE_LOCAL_SIZE_BYTES = 3 - CU_FUNC_ATTRIBUTE_NUM_REGS = 4 - CU_FUNC_ATTRIBUTE_PTX_VERSION = 5 - CU_FUNC_ATTRIBUTE_BINARY_VERSION = 6 - CU_FUNC_ATTRIBUTE_CACHE_MODE_CA = 7 - CU_FUNC_ATTRIBUTE_MAX_DYNAMIC_SHARED_SIZE_BYTES = 8 - CU_FUNC_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT = 9 - CU_FUNC_ATTRIBUTE_CLUSTER_SIZE_MUST_BE_SET = 10 - CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_WIDTH = 11 - CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_HEIGHT = 12 - CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_DEPTH = 13 - CU_FUNC_ATTRIBUTE_NON_PORTABLE_CLUSTER_SIZE_ALLOWED = 14 - CU_FUNC_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE = 15 - CU_FUNC_ATTRIBUTE_MAX = 16 - - ctypedef CUfunction_attribute_enum CUfunction_attribute - - cdef enum CUfunc_cache_enum: - CU_FUNC_CACHE_PREFER_NONE = 0 - CU_FUNC_CACHE_PREFER_SHARED = 1 - CU_FUNC_CACHE_PREFER_L1 = 2 - CU_FUNC_CACHE_PREFER_EQUAL = 3 - - ctypedef CUfunc_cache_enum CUfunc_cache - - cdef enum CUsharedconfig_enum: - CU_SHARED_MEM_CONFIG_DEFAULT_BANK_SIZE = 0 - CU_SHARED_MEM_CONFIG_FOUR_BYTE_BANK_SIZE = 1 - CU_SHARED_MEM_CONFIG_EIGHT_BYTE_BANK_SIZE = 2 - - ctypedef CUsharedconfig_enum CUsharedconfig - - cdef enum CUshared_carveout_enum: - CU_SHAREDMEM_CARVEOUT_DEFAULT = -1 - CU_SHAREDMEM_CARVEOUT_MAX_L1 = 0 - CU_SHAREDMEM_CARVEOUT_MAX_SHARED = 100 - - ctypedef CUshared_carveout_enum CUshared_carveout - - cdef enum CUmemorytype_enum: - CU_MEMORYTYPE_HOST = 1 - CU_MEMORYTYPE_DEVICE = 2 - CU_MEMORYTYPE_ARRAY = 3 - CU_MEMORYTYPE_UNIFIED = 4 - - ctypedef CUmemorytype_enum CUmemorytype - - cdef enum CUcomputemode_enum: - CU_COMPUTEMODE_DEFAULT = 0 - CU_COMPUTEMODE_PROHIBITED = 2 - CU_COMPUTEMODE_EXCLUSIVE_PROCESS = 3 - - ctypedef CUcomputemode_enum CUcomputemode - - cdef enum CUmem_advise_enum: - CU_MEM_ADVISE_SET_READ_MOSTLY = 1 - CU_MEM_ADVISE_UNSET_READ_MOSTLY = 2 - CU_MEM_ADVISE_SET_PREFERRED_LOCATION = 3 - CU_MEM_ADVISE_UNSET_PREFERRED_LOCATION = 4 - CU_MEM_ADVISE_SET_ACCESSED_BY = 5 - CU_MEM_ADVISE_UNSET_ACCESSED_BY = 6 - - ctypedef CUmem_advise_enum CUmem_advise - - cdef enum CUmem_range_attribute_enum: - CU_MEM_RANGE_ATTRIBUTE_READ_MOSTLY = 1 - CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION = 2 - CU_MEM_RANGE_ATTRIBUTE_ACCESSED_BY = 3 - CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION = 4 - CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION_TYPE = 5 - CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION_ID = 6 - CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION_TYPE = 7 - CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION_ID = 8 - - ctypedef CUmem_range_attribute_enum CUmem_range_attribute - - cdef enum CUjit_option_enum: - CU_JIT_MAX_REGISTERS = 0 - CU_JIT_THREADS_PER_BLOCK = 1 - CU_JIT_WALL_TIME = 2 - CU_JIT_INFO_LOG_BUFFER = 3 - CU_JIT_INFO_LOG_BUFFER_SIZE_BYTES = 4 - CU_JIT_ERROR_LOG_BUFFER = 5 - CU_JIT_ERROR_LOG_BUFFER_SIZE_BYTES = 6 - CU_JIT_OPTIMIZATION_LEVEL = 7 - CU_JIT_TARGET_FROM_CUCONTEXT = 8 - CU_JIT_TARGET = 9 - CU_JIT_FALLBACK_STRATEGY = 10 - CU_JIT_GENERATE_DEBUG_INFO = 11 - CU_JIT_LOG_VERBOSE = 12 - CU_JIT_GENERATE_LINE_INFO = 13 - CU_JIT_CACHE_MODE = 14 - CU_JIT_NEW_SM3X_OPT = 15 - CU_JIT_FAST_COMPILE = 16 - CU_JIT_GLOBAL_SYMBOL_NAMES = 17 - CU_JIT_GLOBAL_SYMBOL_ADDRESSES = 18 - CU_JIT_GLOBAL_SYMBOL_COUNT = 19 - CU_JIT_LTO = 20 - CU_JIT_FTZ = 21 - CU_JIT_PREC_DIV = 22 - CU_JIT_PREC_SQRT = 23 - CU_JIT_FMA = 24 - CU_JIT_REFERENCED_KERNEL_NAMES = 25 - CU_JIT_REFERENCED_KERNEL_COUNT = 26 - CU_JIT_REFERENCED_VARIABLE_NAMES = 27 - CU_JIT_REFERENCED_VARIABLE_COUNT = 28 - CU_JIT_OPTIMIZE_UNUSED_DEVICE_VARIABLES = 29 - CU_JIT_POSITION_INDEPENDENT_CODE = 30 - CU_JIT_MIN_CTA_PER_SM = 31 - CU_JIT_MAX_THREADS_PER_BLOCK = 32 - CU_JIT_OVERRIDE_DIRECTIVE_VALUES = 33 - CU_JIT_NUM_OPTIONS = 34 - - ctypedef CUjit_option_enum CUjit_option - - cdef enum CUjit_target_enum: - CU_TARGET_COMPUTE_30 = 30 - CU_TARGET_COMPUTE_32 = 32 - CU_TARGET_COMPUTE_35 = 35 - CU_TARGET_COMPUTE_37 = 37 - CU_TARGET_COMPUTE_50 = 50 - CU_TARGET_COMPUTE_52 = 52 - CU_TARGET_COMPUTE_53 = 53 - CU_TARGET_COMPUTE_60 = 60 - CU_TARGET_COMPUTE_61 = 61 - CU_TARGET_COMPUTE_62 = 62 - CU_TARGET_COMPUTE_70 = 70 - CU_TARGET_COMPUTE_72 = 72 - CU_TARGET_COMPUTE_75 = 75 - CU_TARGET_COMPUTE_80 = 80 - CU_TARGET_COMPUTE_86 = 86 - CU_TARGET_COMPUTE_87 = 87 - CU_TARGET_COMPUTE_89 = 89 - CU_TARGET_COMPUTE_90 = 90 - CU_TARGET_COMPUTE_90A = 65626 - - ctypedef CUjit_target_enum CUjit_target - - cdef enum CUjit_fallback_enum: - CU_PREFER_PTX = 0 - CU_PREFER_BINARY = 1 - - ctypedef CUjit_fallback_enum CUjit_fallback - - cdef enum CUjit_cacheMode_enum: - CU_JIT_CACHE_OPTION_NONE = 0 - CU_JIT_CACHE_OPTION_CG = 1 - CU_JIT_CACHE_OPTION_CA = 2 - - ctypedef CUjit_cacheMode_enum CUjit_cacheMode - - cdef enum CUjitInputType_enum: - CU_JIT_INPUT_CUBIN = 0 - CU_JIT_INPUT_PTX = 1 - CU_JIT_INPUT_FATBINARY = 2 - CU_JIT_INPUT_OBJECT = 3 - CU_JIT_INPUT_LIBRARY = 4 - CU_JIT_INPUT_NVVM = 5 - CU_JIT_NUM_INPUT_TYPES = 6 - - ctypedef CUjitInputType_enum CUjitInputType - - cdef struct CUlinkState_st: - pass - ctypedef CUlinkState_st* CUlinkState - - cdef enum CUgraphicsRegisterFlags_enum: - CU_GRAPHICS_REGISTER_FLAGS_NONE = 0 - CU_GRAPHICS_REGISTER_FLAGS_READ_ONLY = 1 - CU_GRAPHICS_REGISTER_FLAGS_WRITE_DISCARD = 2 - CU_GRAPHICS_REGISTER_FLAGS_SURFACE_LDST = 4 - CU_GRAPHICS_REGISTER_FLAGS_TEXTURE_GATHER = 8 - - ctypedef CUgraphicsRegisterFlags_enum CUgraphicsRegisterFlags - - cdef enum CUgraphicsMapResourceFlags_enum: - CU_GRAPHICS_MAP_RESOURCE_FLAGS_NONE = 0 - CU_GRAPHICS_MAP_RESOURCE_FLAGS_READ_ONLY = 1 - CU_GRAPHICS_MAP_RESOURCE_FLAGS_WRITE_DISCARD = 2 - - ctypedef CUgraphicsMapResourceFlags_enum CUgraphicsMapResourceFlags - - cdef enum CUarray_cubemap_face_enum: - CU_CUBEMAP_FACE_POSITIVE_X = 0 - CU_CUBEMAP_FACE_NEGATIVE_X = 1 - CU_CUBEMAP_FACE_POSITIVE_Y = 2 - CU_CUBEMAP_FACE_NEGATIVE_Y = 3 - CU_CUBEMAP_FACE_POSITIVE_Z = 4 - CU_CUBEMAP_FACE_NEGATIVE_Z = 5 - - ctypedef CUarray_cubemap_face_enum CUarray_cubemap_face - - cdef enum CUlimit_enum: - CU_LIMIT_STACK_SIZE = 0 - CU_LIMIT_PRINTF_FIFO_SIZE = 1 - CU_LIMIT_MALLOC_HEAP_SIZE = 2 - CU_LIMIT_DEV_RUNTIME_SYNC_DEPTH = 3 - CU_LIMIT_DEV_RUNTIME_PENDING_LAUNCH_COUNT = 4 - CU_LIMIT_MAX_L2_FETCH_GRANULARITY = 5 - CU_LIMIT_PERSISTING_L2_CACHE_SIZE = 6 - CU_LIMIT_SHMEM_SIZE = 7 - CU_LIMIT_CIG_ENABLED = 8 - CU_LIMIT_CIG_SHMEM_FALLBACK_ENABLED = 9 - CU_LIMIT_MAX = 10 - - ctypedef CUlimit_enum CUlimit - - cdef enum CUresourcetype_enum: - CU_RESOURCE_TYPE_ARRAY = 0 - CU_RESOURCE_TYPE_MIPMAPPED_ARRAY = 1 - CU_RESOURCE_TYPE_LINEAR = 2 - CU_RESOURCE_TYPE_PITCH2D = 3 - - ctypedef CUresourcetype_enum CUresourcetype - - ctypedef void (*CUhostFn)(void* userData) - - cdef enum CUaccessProperty_enum: - CU_ACCESS_PROPERTY_NORMAL = 0 - CU_ACCESS_PROPERTY_STREAMING = 1 - CU_ACCESS_PROPERTY_PERSISTING = 2 - - ctypedef CUaccessProperty_enum CUaccessProperty - - cdef struct CUaccessPolicyWindow_st: - void* base_ptr - size_t num_bytes - float hitRatio - CUaccessProperty hitProp - CUaccessProperty missProp - - ctypedef CUaccessPolicyWindow_st CUaccessPolicyWindow_v1 - - ctypedef CUaccessPolicyWindow_v1 CUaccessPolicyWindow - - cdef struct CUDA_KERNEL_NODE_PARAMS_st: - CUfunction func - unsigned int gridDimX - unsigned int gridDimY - unsigned int gridDimZ - unsigned int blockDimX - unsigned int blockDimY - unsigned int blockDimZ - unsigned int sharedMemBytes - void** kernelParams - void** extra - - ctypedef CUDA_KERNEL_NODE_PARAMS_st CUDA_KERNEL_NODE_PARAMS_v1 - - cdef struct CUDA_KERNEL_NODE_PARAMS_v2_st: - CUfunction func - unsigned int gridDimX - unsigned int gridDimY - unsigned int gridDimZ - unsigned int blockDimX - unsigned int blockDimY - unsigned int blockDimZ - unsigned int sharedMemBytes - void** kernelParams - void** extra - CUkernel kern - CUcontext ctx - - ctypedef CUDA_KERNEL_NODE_PARAMS_v2_st CUDA_KERNEL_NODE_PARAMS_v2 - - ctypedef CUDA_KERNEL_NODE_PARAMS_v2 CUDA_KERNEL_NODE_PARAMS - - cdef struct CUDA_KERNEL_NODE_PARAMS_v3_st: - CUfunction func - unsigned int gridDimX - unsigned int gridDimY - unsigned int gridDimZ - unsigned int blockDimX - unsigned int blockDimY - unsigned int blockDimZ - unsigned int sharedMemBytes - void** kernelParams - void** extra - CUkernel kern - CUcontext ctx - - ctypedef CUDA_KERNEL_NODE_PARAMS_v3_st CUDA_KERNEL_NODE_PARAMS_v3 - - cdef struct CUDA_MEMSET_NODE_PARAMS_st: - CUdeviceptr dst - size_t pitch - unsigned int value - unsigned int elementSize - size_t width - size_t height - - ctypedef CUDA_MEMSET_NODE_PARAMS_st CUDA_MEMSET_NODE_PARAMS_v1 - - ctypedef CUDA_MEMSET_NODE_PARAMS_v1 CUDA_MEMSET_NODE_PARAMS - - cdef struct CUDA_MEMSET_NODE_PARAMS_v2_st: - CUdeviceptr dst - size_t pitch - unsigned int value - unsigned int elementSize - size_t width - size_t height - CUcontext ctx - - ctypedef CUDA_MEMSET_NODE_PARAMS_v2_st CUDA_MEMSET_NODE_PARAMS_v2 - - cdef struct CUDA_HOST_NODE_PARAMS_st: - CUhostFn fn - void* userData - - ctypedef CUDA_HOST_NODE_PARAMS_st CUDA_HOST_NODE_PARAMS_v1 - - ctypedef CUDA_HOST_NODE_PARAMS_v1 CUDA_HOST_NODE_PARAMS - - cdef struct CUDA_HOST_NODE_PARAMS_v2_st: - CUhostFn fn - void* userData - - ctypedef CUDA_HOST_NODE_PARAMS_v2_st CUDA_HOST_NODE_PARAMS_v2 - - cdef enum CUgraphConditionalNodeType_enum: - CU_GRAPH_COND_TYPE_IF = 0 - CU_GRAPH_COND_TYPE_WHILE = 1 - - ctypedef CUgraphConditionalNodeType_enum CUgraphConditionalNodeType - - cdef struct CUDA_CONDITIONAL_NODE_PARAMS: - CUgraphConditionalHandle handle - CUgraphConditionalNodeType type - unsigned int size - CUgraph* phGraph_out - CUcontext ctx - - cdef enum CUgraphNodeType_enum: - CU_GRAPH_NODE_TYPE_KERNEL = 0 - CU_GRAPH_NODE_TYPE_MEMCPY = 1 - CU_GRAPH_NODE_TYPE_MEMSET = 2 - CU_GRAPH_NODE_TYPE_HOST = 3 - CU_GRAPH_NODE_TYPE_GRAPH = 4 - CU_GRAPH_NODE_TYPE_EMPTY = 5 - CU_GRAPH_NODE_TYPE_WAIT_EVENT = 6 - CU_GRAPH_NODE_TYPE_EVENT_RECORD = 7 - CU_GRAPH_NODE_TYPE_EXT_SEMAS_SIGNAL = 8 - CU_GRAPH_NODE_TYPE_EXT_SEMAS_WAIT = 9 - CU_GRAPH_NODE_TYPE_MEM_ALLOC = 10 - CU_GRAPH_NODE_TYPE_MEM_FREE = 11 - CU_GRAPH_NODE_TYPE_BATCH_MEM_OP = 12 - CU_GRAPH_NODE_TYPE_CONDITIONAL = 13 - - ctypedef CUgraphNodeType_enum CUgraphNodeType - - cdef enum CUgraphDependencyType_enum: - CU_GRAPH_DEPENDENCY_TYPE_DEFAULT = 0 - CU_GRAPH_DEPENDENCY_TYPE_PROGRAMMATIC = 1 - - ctypedef CUgraphDependencyType_enum CUgraphDependencyType - - cdef struct CUgraphEdgeData_st: - unsigned char from_port - unsigned char to_port - unsigned char type - unsigned char reserved[5] - - ctypedef CUgraphEdgeData_st CUgraphEdgeData - - cdef enum CUgraphInstantiateResult_enum: - CUDA_GRAPH_INSTANTIATE_SUCCESS = 0 - CUDA_GRAPH_INSTANTIATE_ERROR = 1 - CUDA_GRAPH_INSTANTIATE_INVALID_STRUCTURE = 2 - CUDA_GRAPH_INSTANTIATE_NODE_OPERATION_NOT_SUPPORTED = 3 - CUDA_GRAPH_INSTANTIATE_MULTIPLE_CTXS_NOT_SUPPORTED = 4 - - ctypedef CUgraphInstantiateResult_enum CUgraphInstantiateResult - - cdef struct CUDA_GRAPH_INSTANTIATE_PARAMS_st: - cuuint64_t flags - CUstream hUploadStream - CUgraphNode hErrNode_out - CUgraphInstantiateResult result_out - - ctypedef CUDA_GRAPH_INSTANTIATE_PARAMS_st CUDA_GRAPH_INSTANTIATE_PARAMS - - cdef enum CUsynchronizationPolicy_enum: - CU_SYNC_POLICY_AUTO = 1 - CU_SYNC_POLICY_SPIN = 2 - CU_SYNC_POLICY_YIELD = 3 - CU_SYNC_POLICY_BLOCKING_SYNC = 4 - - ctypedef CUsynchronizationPolicy_enum CUsynchronizationPolicy - - cdef enum CUclusterSchedulingPolicy_enum: - CU_CLUSTER_SCHEDULING_POLICY_DEFAULT = 0 - CU_CLUSTER_SCHEDULING_POLICY_SPREAD = 1 - CU_CLUSTER_SCHEDULING_POLICY_LOAD_BALANCING = 2 - - ctypedef CUclusterSchedulingPolicy_enum CUclusterSchedulingPolicy - - cdef enum CUlaunchMemSyncDomain_enum: - CU_LAUNCH_MEM_SYNC_DOMAIN_DEFAULT = 0 - CU_LAUNCH_MEM_SYNC_DOMAIN_REMOTE = 1 - - ctypedef CUlaunchMemSyncDomain_enum CUlaunchMemSyncDomain - - cdef struct CUlaunchMemSyncDomainMap_st: - unsigned char default_ - unsigned char remote - - ctypedef CUlaunchMemSyncDomainMap_st CUlaunchMemSyncDomainMap - - cdef enum CUlaunchAttributeID_enum: - CU_LAUNCH_ATTRIBUTE_IGNORE = 0 - CU_LAUNCH_ATTRIBUTE_ACCESS_POLICY_WINDOW = 1 - CU_LAUNCH_ATTRIBUTE_COOPERATIVE = 2 - CU_LAUNCH_ATTRIBUTE_SYNCHRONIZATION_POLICY = 3 - CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION = 4 - CU_LAUNCH_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE = 5 - CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_STREAM_SERIALIZATION = 6 - CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_EVENT = 7 - CU_LAUNCH_ATTRIBUTE_PRIORITY = 8 - CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP = 9 - CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN = 10 - CU_LAUNCH_ATTRIBUTE_LAUNCH_COMPLETION_EVENT = 12 - CU_LAUNCH_ATTRIBUTE_DEVICE_UPDATABLE_KERNEL_NODE = 13 - CU_LAUNCH_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT = 14 - - ctypedef CUlaunchAttributeID_enum CUlaunchAttributeID - - cdef struct anon_struct1: - unsigned int x - unsigned int y - unsigned int z - - cdef struct anon_struct2: - CUevent event - int flags - int triggerAtBlockStart - - cdef struct anon_struct3: - CUevent event - int flags - - cdef struct anon_struct4: - int deviceUpdatable - CUgraphDeviceNode devNode - - cdef union CUlaunchAttributeValue_union: - char pad[64] - CUaccessPolicyWindow accessPolicyWindow - int cooperative - CUsynchronizationPolicy syncPolicy - anon_struct1 clusterDim - CUclusterSchedulingPolicy clusterSchedulingPolicyPreference - int programmaticStreamSerializationAllowed - anon_struct2 programmaticEvent - anon_struct3 launchCompletionEvent - int priority - CUlaunchMemSyncDomainMap memSyncDomainMap - CUlaunchMemSyncDomain memSyncDomain - anon_struct4 deviceUpdatableKernelNode - unsigned int sharedMemCarveout - - ctypedef CUlaunchAttributeValue_union CUlaunchAttributeValue - - cdef struct CUlaunchAttribute_st: - CUlaunchAttributeID id - CUlaunchAttributeValue value - - ctypedef CUlaunchAttribute_st CUlaunchAttribute - - cdef struct CUlaunchConfig_st: - unsigned int gridDimX - unsigned int gridDimY - unsigned int gridDimZ - unsigned int blockDimX - unsigned int blockDimY - unsigned int blockDimZ - unsigned int sharedMemBytes - CUstream hStream - CUlaunchAttribute* attrs - unsigned int numAttrs - - ctypedef CUlaunchConfig_st CUlaunchConfig - - ctypedef CUlaunchAttributeID CUkernelNodeAttrID - - ctypedef CUlaunchAttributeValue CUkernelNodeAttrValue_v1 - - ctypedef CUkernelNodeAttrValue_v1 CUkernelNodeAttrValue - - cdef enum CUstreamCaptureStatus_enum: - CU_STREAM_CAPTURE_STATUS_NONE = 0 - CU_STREAM_CAPTURE_STATUS_ACTIVE = 1 - CU_STREAM_CAPTURE_STATUS_INVALIDATED = 2 - - ctypedef CUstreamCaptureStatus_enum CUstreamCaptureStatus - - cdef enum CUstreamCaptureMode_enum: - CU_STREAM_CAPTURE_MODE_GLOBAL = 0 - CU_STREAM_CAPTURE_MODE_THREAD_LOCAL = 1 - CU_STREAM_CAPTURE_MODE_RELAXED = 2 - - ctypedef CUstreamCaptureMode_enum CUstreamCaptureMode - - ctypedef CUlaunchAttributeID CUstreamAttrID - - ctypedef CUlaunchAttributeValue CUstreamAttrValue_v1 - - ctypedef CUstreamAttrValue_v1 CUstreamAttrValue - - cdef enum CUdriverProcAddress_flags_enum: - CU_GET_PROC_ADDRESS_DEFAULT = 0 - CU_GET_PROC_ADDRESS_LEGACY_STREAM = 1 - CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM = 2 - - ctypedef CUdriverProcAddress_flags_enum CUdriverProcAddress_flags - - cdef enum CUdriverProcAddressQueryResult_enum: - CU_GET_PROC_ADDRESS_SUCCESS = 0 - CU_GET_PROC_ADDRESS_SYMBOL_NOT_FOUND = 1 - CU_GET_PROC_ADDRESS_VERSION_NOT_SUFFICIENT = 2 - - ctypedef CUdriverProcAddressQueryResult_enum CUdriverProcAddressQueryResult - - cdef enum CUexecAffinityType_enum: - CU_EXEC_AFFINITY_TYPE_SM_COUNT = 0 - CU_EXEC_AFFINITY_TYPE_MAX = 1 - - ctypedef CUexecAffinityType_enum CUexecAffinityType - - cdef struct CUexecAffinitySmCount_st: - unsigned int val - - ctypedef CUexecAffinitySmCount_st CUexecAffinitySmCount_v1 - - ctypedef CUexecAffinitySmCount_v1 CUexecAffinitySmCount - - cdef union anon_union3: - CUexecAffinitySmCount smCount - - cdef struct CUexecAffinityParam_st: - CUexecAffinityType type - anon_union3 param - - ctypedef CUexecAffinityParam_st CUexecAffinityParam_v1 - - ctypedef CUexecAffinityParam_v1 CUexecAffinityParam - - cdef enum CUcigDataType_enum: - CIG_DATA_TYPE_D3D12_COMMAND_QUEUE = 1 - - ctypedef CUcigDataType_enum CUcigDataType - - cdef struct CUctxCigParam_st: - CUcigDataType sharedDataType - void* sharedData - - ctypedef CUctxCigParam_st CUctxCigParam - - cdef struct CUctxCreateParams_st: - CUexecAffinityParam* execAffinityParams - int numExecAffinityParams - CUctxCigParam* cigParams - - ctypedef CUctxCreateParams_st CUctxCreateParams - - cdef enum CUlibraryOption_enum: - CU_LIBRARY_HOST_UNIVERSAL_FUNCTION_AND_DATA_TABLE = 0 - CU_LIBRARY_BINARY_IS_PRESERVED = 1 - CU_LIBRARY_NUM_OPTIONS = 2 - - ctypedef CUlibraryOption_enum CUlibraryOption - - cdef struct CUlibraryHostUniversalFunctionAndDataTable_st: - void* functionTable - size_t functionWindowSize - void* dataTable - size_t dataWindowSize - - ctypedef CUlibraryHostUniversalFunctionAndDataTable_st CUlibraryHostUniversalFunctionAndDataTable - - cdef enum cudaError_enum: - CUDA_SUCCESS = 0 - CUDA_ERROR_INVALID_VALUE = 1 - CUDA_ERROR_OUT_OF_MEMORY = 2 - CUDA_ERROR_NOT_INITIALIZED = 3 - CUDA_ERROR_DEINITIALIZED = 4 - CUDA_ERROR_PROFILER_DISABLED = 5 - CUDA_ERROR_PROFILER_NOT_INITIALIZED = 6 - CUDA_ERROR_PROFILER_ALREADY_STARTED = 7 - CUDA_ERROR_PROFILER_ALREADY_STOPPED = 8 - CUDA_ERROR_STUB_LIBRARY = 34 - CUDA_ERROR_DEVICE_UNAVAILABLE = 46 - CUDA_ERROR_NO_DEVICE = 100 - CUDA_ERROR_INVALID_DEVICE = 101 - CUDA_ERROR_DEVICE_NOT_LICENSED = 102 - CUDA_ERROR_INVALID_IMAGE = 200 - CUDA_ERROR_INVALID_CONTEXT = 201 - CUDA_ERROR_CONTEXT_ALREADY_CURRENT = 202 - CUDA_ERROR_MAP_FAILED = 205 - CUDA_ERROR_UNMAP_FAILED = 206 - CUDA_ERROR_ARRAY_IS_MAPPED = 207 - CUDA_ERROR_ALREADY_MAPPED = 208 - CUDA_ERROR_NO_BINARY_FOR_GPU = 209 - CUDA_ERROR_ALREADY_ACQUIRED = 210 - CUDA_ERROR_NOT_MAPPED = 211 - CUDA_ERROR_NOT_MAPPED_AS_ARRAY = 212 - CUDA_ERROR_NOT_MAPPED_AS_POINTER = 213 - CUDA_ERROR_ECC_UNCORRECTABLE = 214 - CUDA_ERROR_UNSUPPORTED_LIMIT = 215 - CUDA_ERROR_CONTEXT_ALREADY_IN_USE = 216 - CUDA_ERROR_PEER_ACCESS_UNSUPPORTED = 217 - CUDA_ERROR_INVALID_PTX = 218 - CUDA_ERROR_INVALID_GRAPHICS_CONTEXT = 219 - CUDA_ERROR_NVLINK_UNCORRECTABLE = 220 - CUDA_ERROR_JIT_COMPILER_NOT_FOUND = 221 - CUDA_ERROR_UNSUPPORTED_PTX_VERSION = 222 - CUDA_ERROR_JIT_COMPILATION_DISABLED = 223 - CUDA_ERROR_UNSUPPORTED_EXEC_AFFINITY = 224 - CUDA_ERROR_UNSUPPORTED_DEVSIDE_SYNC = 225 - CUDA_ERROR_INVALID_SOURCE = 300 - CUDA_ERROR_FILE_NOT_FOUND = 301 - CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND = 302 - CUDA_ERROR_SHARED_OBJECT_INIT_FAILED = 303 - CUDA_ERROR_OPERATING_SYSTEM = 304 - CUDA_ERROR_INVALID_HANDLE = 400 - CUDA_ERROR_ILLEGAL_STATE = 401 - CUDA_ERROR_LOSSY_QUERY = 402 - CUDA_ERROR_NOT_FOUND = 500 - CUDA_ERROR_NOT_READY = 600 - CUDA_ERROR_ILLEGAL_ADDRESS = 700 - CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES = 701 - CUDA_ERROR_LAUNCH_TIMEOUT = 702 - CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING = 703 - CUDA_ERROR_PEER_ACCESS_ALREADY_ENABLED = 704 - CUDA_ERROR_PEER_ACCESS_NOT_ENABLED = 705 - CUDA_ERROR_PRIMARY_CONTEXT_ACTIVE = 708 - CUDA_ERROR_CONTEXT_IS_DESTROYED = 709 - CUDA_ERROR_ASSERT = 710 - CUDA_ERROR_TOO_MANY_PEERS = 711 - CUDA_ERROR_HOST_MEMORY_ALREADY_REGISTERED = 712 - CUDA_ERROR_HOST_MEMORY_NOT_REGISTERED = 713 - CUDA_ERROR_HARDWARE_STACK_ERROR = 714 - CUDA_ERROR_ILLEGAL_INSTRUCTION = 715 - CUDA_ERROR_MISALIGNED_ADDRESS = 716 - CUDA_ERROR_INVALID_ADDRESS_SPACE = 717 - CUDA_ERROR_INVALID_PC = 718 - CUDA_ERROR_LAUNCH_FAILED = 719 - CUDA_ERROR_COOPERATIVE_LAUNCH_TOO_LARGE = 720 - CUDA_ERROR_NOT_PERMITTED = 800 - CUDA_ERROR_NOT_SUPPORTED = 801 - CUDA_ERROR_SYSTEM_NOT_READY = 802 - CUDA_ERROR_SYSTEM_DRIVER_MISMATCH = 803 - CUDA_ERROR_COMPAT_NOT_SUPPORTED_ON_DEVICE = 804 - CUDA_ERROR_MPS_CONNECTION_FAILED = 805 - CUDA_ERROR_MPS_RPC_FAILURE = 806 - CUDA_ERROR_MPS_SERVER_NOT_READY = 807 - CUDA_ERROR_MPS_MAX_CLIENTS_REACHED = 808 - CUDA_ERROR_MPS_MAX_CONNECTIONS_REACHED = 809 - CUDA_ERROR_MPS_CLIENT_TERMINATED = 810 - CUDA_ERROR_CDP_NOT_SUPPORTED = 811 - CUDA_ERROR_CDP_VERSION_MISMATCH = 812 - CUDA_ERROR_STREAM_CAPTURE_UNSUPPORTED = 900 - CUDA_ERROR_STREAM_CAPTURE_INVALIDATED = 901 - CUDA_ERROR_STREAM_CAPTURE_MERGE = 902 - CUDA_ERROR_STREAM_CAPTURE_UNMATCHED = 903 - CUDA_ERROR_STREAM_CAPTURE_UNJOINED = 904 - CUDA_ERROR_STREAM_CAPTURE_ISOLATION = 905 - CUDA_ERROR_STREAM_CAPTURE_IMPLICIT = 906 - CUDA_ERROR_CAPTURED_EVENT = 907 - CUDA_ERROR_STREAM_CAPTURE_WRONG_THREAD = 908 - CUDA_ERROR_TIMEOUT = 909 - CUDA_ERROR_GRAPH_EXEC_UPDATE_FAILURE = 910 - CUDA_ERROR_EXTERNAL_DEVICE = 911 - CUDA_ERROR_INVALID_CLUSTER_SIZE = 912 - CUDA_ERROR_FUNCTION_NOT_LOADED = 913 - CUDA_ERROR_INVALID_RESOURCE_TYPE = 914 - CUDA_ERROR_INVALID_RESOURCE_CONFIGURATION = 915 - CUDA_ERROR_UNKNOWN = 999 - - ctypedef cudaError_enum CUresult - - cdef enum CUdevice_P2PAttribute_enum: - CU_DEVICE_P2P_ATTRIBUTE_PERFORMANCE_RANK = 1 - CU_DEVICE_P2P_ATTRIBUTE_ACCESS_SUPPORTED = 2 - CU_DEVICE_P2P_ATTRIBUTE_NATIVE_ATOMIC_SUPPORTED = 3 - CU_DEVICE_P2P_ATTRIBUTE_ACCESS_ACCESS_SUPPORTED = 4 - CU_DEVICE_P2P_ATTRIBUTE_CUDA_ARRAY_ACCESS_SUPPORTED = 4 - - ctypedef CUdevice_P2PAttribute_enum CUdevice_P2PAttribute - - ctypedef void (*CUstreamCallback)(CUstream hStream, CUresult status, void* userData) - - ctypedef size_t (*CUoccupancyB2DSize)(int blockSize) - - cdef struct CUDA_MEMCPY2D_st: - size_t srcXInBytes - size_t srcY - CUmemorytype srcMemoryType - const void* srcHost - CUdeviceptr srcDevice - CUarray srcArray - size_t srcPitch - size_t dstXInBytes - size_t dstY - CUmemorytype dstMemoryType - void* dstHost - CUdeviceptr dstDevice - CUarray dstArray - size_t dstPitch - size_t WidthInBytes - size_t Height - - ctypedef CUDA_MEMCPY2D_st CUDA_MEMCPY2D_v2 - - ctypedef CUDA_MEMCPY2D_v2 CUDA_MEMCPY2D - - cdef struct CUDA_MEMCPY3D_st: - size_t srcXInBytes - size_t srcY - size_t srcZ - size_t srcLOD - CUmemorytype srcMemoryType - const void* srcHost - CUdeviceptr srcDevice - CUarray srcArray - void* reserved0 - size_t srcPitch - size_t srcHeight - size_t dstXInBytes - size_t dstY - size_t dstZ - size_t dstLOD - CUmemorytype dstMemoryType - void* dstHost - CUdeviceptr dstDevice - CUarray dstArray - void* reserved1 - size_t dstPitch - size_t dstHeight - size_t WidthInBytes - size_t Height - size_t Depth - - ctypedef CUDA_MEMCPY3D_st CUDA_MEMCPY3D_v2 - - ctypedef CUDA_MEMCPY3D_v2 CUDA_MEMCPY3D - - cdef struct CUDA_MEMCPY3D_PEER_st: - size_t srcXInBytes - size_t srcY - size_t srcZ - size_t srcLOD - CUmemorytype srcMemoryType - const void* srcHost - CUdeviceptr srcDevice - CUarray srcArray - CUcontext srcContext - size_t srcPitch - size_t srcHeight - size_t dstXInBytes - size_t dstY - size_t dstZ - size_t dstLOD - CUmemorytype dstMemoryType - void* dstHost - CUdeviceptr dstDevice - CUarray dstArray - CUcontext dstContext - size_t dstPitch - size_t dstHeight - size_t WidthInBytes - size_t Height - size_t Depth - - ctypedef CUDA_MEMCPY3D_PEER_st CUDA_MEMCPY3D_PEER_v1 - - ctypedef CUDA_MEMCPY3D_PEER_v1 CUDA_MEMCPY3D_PEER - - cdef struct CUDA_MEMCPY_NODE_PARAMS_st: - int flags - int reserved - CUcontext copyCtx - CUDA_MEMCPY3D copyParams - - ctypedef CUDA_MEMCPY_NODE_PARAMS_st CUDA_MEMCPY_NODE_PARAMS - - cdef struct CUDA_ARRAY_DESCRIPTOR_st: - size_t Width - size_t Height - CUarray_format Format - unsigned int NumChannels - - ctypedef CUDA_ARRAY_DESCRIPTOR_st CUDA_ARRAY_DESCRIPTOR_v2 - - ctypedef CUDA_ARRAY_DESCRIPTOR_v2 CUDA_ARRAY_DESCRIPTOR - - cdef struct CUDA_ARRAY3D_DESCRIPTOR_st: - size_t Width - size_t Height - size_t Depth - CUarray_format Format - unsigned int NumChannels - unsigned int Flags - - ctypedef CUDA_ARRAY3D_DESCRIPTOR_st CUDA_ARRAY3D_DESCRIPTOR_v2 - - ctypedef CUDA_ARRAY3D_DESCRIPTOR_v2 CUDA_ARRAY3D_DESCRIPTOR - - cdef struct anon_struct5: - unsigned int width - unsigned int height - unsigned int depth - - cdef struct CUDA_ARRAY_SPARSE_PROPERTIES_st: - anon_struct5 tileExtent - unsigned int miptailFirstLevel - unsigned long long miptailSize - unsigned int flags - unsigned int reserved[4] - - ctypedef CUDA_ARRAY_SPARSE_PROPERTIES_st CUDA_ARRAY_SPARSE_PROPERTIES_v1 - - ctypedef CUDA_ARRAY_SPARSE_PROPERTIES_v1 CUDA_ARRAY_SPARSE_PROPERTIES - - cdef struct CUDA_ARRAY_MEMORY_REQUIREMENTS_st: - size_t size - size_t alignment - unsigned int reserved[4] - - ctypedef CUDA_ARRAY_MEMORY_REQUIREMENTS_st CUDA_ARRAY_MEMORY_REQUIREMENTS_v1 - - ctypedef CUDA_ARRAY_MEMORY_REQUIREMENTS_v1 CUDA_ARRAY_MEMORY_REQUIREMENTS - - cdef struct anon_struct6: - CUarray hArray - - cdef struct anon_struct7: - CUmipmappedArray hMipmappedArray - - cdef struct anon_struct8: - CUdeviceptr devPtr - CUarray_format format - unsigned int numChannels - size_t sizeInBytes - - cdef struct anon_struct9: - CUdeviceptr devPtr - CUarray_format format - unsigned int numChannels - size_t width - size_t height - size_t pitchInBytes - - cdef struct anon_struct10: - int reserved[32] - - cdef union anon_union4: - anon_struct6 array - anon_struct7 mipmap - anon_struct8 linear - anon_struct9 pitch2D - anon_struct10 reserved - - cdef struct CUDA_RESOURCE_DESC_st: - CUresourcetype resType - anon_union4 res - unsigned int flags - - ctypedef CUDA_RESOURCE_DESC_st CUDA_RESOURCE_DESC_v1 - - ctypedef CUDA_RESOURCE_DESC_v1 CUDA_RESOURCE_DESC - - cdef struct CUDA_TEXTURE_DESC_st: - CUaddress_mode addressMode[3] - CUfilter_mode filterMode - unsigned int flags - unsigned int maxAnisotropy - CUfilter_mode mipmapFilterMode - float mipmapLevelBias - float minMipmapLevelClamp - float maxMipmapLevelClamp - float borderColor[4] - int reserved[12] - - ctypedef CUDA_TEXTURE_DESC_st CUDA_TEXTURE_DESC_v1 - - ctypedef CUDA_TEXTURE_DESC_v1 CUDA_TEXTURE_DESC - - cdef enum CUresourceViewFormat_enum: - CU_RES_VIEW_FORMAT_NONE = 0 - CU_RES_VIEW_FORMAT_UINT_1X8 = 1 - CU_RES_VIEW_FORMAT_UINT_2X8 = 2 - CU_RES_VIEW_FORMAT_UINT_4X8 = 3 - CU_RES_VIEW_FORMAT_SINT_1X8 = 4 - CU_RES_VIEW_FORMAT_SINT_2X8 = 5 - CU_RES_VIEW_FORMAT_SINT_4X8 = 6 - CU_RES_VIEW_FORMAT_UINT_1X16 = 7 - CU_RES_VIEW_FORMAT_UINT_2X16 = 8 - CU_RES_VIEW_FORMAT_UINT_4X16 = 9 - CU_RES_VIEW_FORMAT_SINT_1X16 = 10 - CU_RES_VIEW_FORMAT_SINT_2X16 = 11 - CU_RES_VIEW_FORMAT_SINT_4X16 = 12 - CU_RES_VIEW_FORMAT_UINT_1X32 = 13 - CU_RES_VIEW_FORMAT_UINT_2X32 = 14 - CU_RES_VIEW_FORMAT_UINT_4X32 = 15 - CU_RES_VIEW_FORMAT_SINT_1X32 = 16 - CU_RES_VIEW_FORMAT_SINT_2X32 = 17 - CU_RES_VIEW_FORMAT_SINT_4X32 = 18 - CU_RES_VIEW_FORMAT_FLOAT_1X16 = 19 - CU_RES_VIEW_FORMAT_FLOAT_2X16 = 20 - CU_RES_VIEW_FORMAT_FLOAT_4X16 = 21 - CU_RES_VIEW_FORMAT_FLOAT_1X32 = 22 - CU_RES_VIEW_FORMAT_FLOAT_2X32 = 23 - CU_RES_VIEW_FORMAT_FLOAT_4X32 = 24 - CU_RES_VIEW_FORMAT_UNSIGNED_BC1 = 25 - CU_RES_VIEW_FORMAT_UNSIGNED_BC2 = 26 - CU_RES_VIEW_FORMAT_UNSIGNED_BC3 = 27 - CU_RES_VIEW_FORMAT_UNSIGNED_BC4 = 28 - CU_RES_VIEW_FORMAT_SIGNED_BC4 = 29 - CU_RES_VIEW_FORMAT_UNSIGNED_BC5 = 30 - CU_RES_VIEW_FORMAT_SIGNED_BC5 = 31 - CU_RES_VIEW_FORMAT_UNSIGNED_BC6H = 32 - CU_RES_VIEW_FORMAT_SIGNED_BC6H = 33 - CU_RES_VIEW_FORMAT_UNSIGNED_BC7 = 34 - - ctypedef CUresourceViewFormat_enum CUresourceViewFormat - - cdef struct CUDA_RESOURCE_VIEW_DESC_st: - CUresourceViewFormat format - size_t width - size_t height - size_t depth - unsigned int firstMipmapLevel - unsigned int lastMipmapLevel - unsigned int firstLayer - unsigned int lastLayer - unsigned int reserved[16] - - ctypedef CUDA_RESOURCE_VIEW_DESC_st CUDA_RESOURCE_VIEW_DESC_v1 - - ctypedef CUDA_RESOURCE_VIEW_DESC_v1 CUDA_RESOURCE_VIEW_DESC - - cdef struct CUtensorMap_st: - cuuint64_t opaque[16] - - ctypedef CUtensorMap_st CUtensorMap - - cdef enum CUtensorMapDataType_enum: - CU_TENSOR_MAP_DATA_TYPE_UINT8 = 0 - CU_TENSOR_MAP_DATA_TYPE_UINT16 = 1 - CU_TENSOR_MAP_DATA_TYPE_UINT32 = 2 - CU_TENSOR_MAP_DATA_TYPE_INT32 = 3 - CU_TENSOR_MAP_DATA_TYPE_UINT64 = 4 - CU_TENSOR_MAP_DATA_TYPE_INT64 = 5 - CU_TENSOR_MAP_DATA_TYPE_FLOAT16 = 6 - CU_TENSOR_MAP_DATA_TYPE_FLOAT32 = 7 - CU_TENSOR_MAP_DATA_TYPE_FLOAT64 = 8 - CU_TENSOR_MAP_DATA_TYPE_BFLOAT16 = 9 - CU_TENSOR_MAP_DATA_TYPE_FLOAT32_FTZ = 10 - CU_TENSOR_MAP_DATA_TYPE_TFLOAT32 = 11 - CU_TENSOR_MAP_DATA_TYPE_TFLOAT32_FTZ = 12 - - ctypedef CUtensorMapDataType_enum CUtensorMapDataType - - cdef enum CUtensorMapInterleave_enum: - CU_TENSOR_MAP_INTERLEAVE_NONE = 0 - CU_TENSOR_MAP_INTERLEAVE_16B = 1 - CU_TENSOR_MAP_INTERLEAVE_32B = 2 - - ctypedef CUtensorMapInterleave_enum CUtensorMapInterleave - - cdef enum CUtensorMapSwizzle_enum: - CU_TENSOR_MAP_SWIZZLE_NONE = 0 - CU_TENSOR_MAP_SWIZZLE_32B = 1 - CU_TENSOR_MAP_SWIZZLE_64B = 2 - CU_TENSOR_MAP_SWIZZLE_128B = 3 - - ctypedef CUtensorMapSwizzle_enum CUtensorMapSwizzle - - cdef enum CUtensorMapL2promotion_enum: - CU_TENSOR_MAP_L2_PROMOTION_NONE = 0 - CU_TENSOR_MAP_L2_PROMOTION_L2_64B = 1 - CU_TENSOR_MAP_L2_PROMOTION_L2_128B = 2 - CU_TENSOR_MAP_L2_PROMOTION_L2_256B = 3 - - ctypedef CUtensorMapL2promotion_enum CUtensorMapL2promotion - - cdef enum CUtensorMapFloatOOBfill_enum: - CU_TENSOR_MAP_FLOAT_OOB_FILL_NONE = 0 - CU_TENSOR_MAP_FLOAT_OOB_FILL_NAN_REQUEST_ZERO_FMA = 1 - - ctypedef CUtensorMapFloatOOBfill_enum CUtensorMapFloatOOBfill - - cdef struct CUDA_POINTER_ATTRIBUTE_P2P_TOKENS_st: - unsigned long long p2pToken - unsigned int vaSpaceToken - - ctypedef CUDA_POINTER_ATTRIBUTE_P2P_TOKENS_st CUDA_POINTER_ATTRIBUTE_P2P_TOKENS_v1 - - ctypedef CUDA_POINTER_ATTRIBUTE_P2P_TOKENS_v1 CUDA_POINTER_ATTRIBUTE_P2P_TOKENS - - cdef enum CUDA_POINTER_ATTRIBUTE_ACCESS_FLAGS_enum: - CU_POINTER_ATTRIBUTE_ACCESS_FLAG_NONE = 0 - CU_POINTER_ATTRIBUTE_ACCESS_FLAG_READ = 1 - CU_POINTER_ATTRIBUTE_ACCESS_FLAG_READWRITE = 3 - - ctypedef CUDA_POINTER_ATTRIBUTE_ACCESS_FLAGS_enum CUDA_POINTER_ATTRIBUTE_ACCESS_FLAGS - - cdef struct CUDA_LAUNCH_PARAMS_st: - CUfunction function - unsigned int gridDimX - unsigned int gridDimY - unsigned int gridDimZ - unsigned int blockDimX - unsigned int blockDimY - unsigned int blockDimZ - unsigned int sharedMemBytes - CUstream hStream - void** kernelParams - - ctypedef CUDA_LAUNCH_PARAMS_st CUDA_LAUNCH_PARAMS_v1 - - ctypedef CUDA_LAUNCH_PARAMS_v1 CUDA_LAUNCH_PARAMS - - cdef enum CUexternalMemoryHandleType_enum: - CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD = 1 - CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32 = 2 - CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT = 3 - CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP = 4 - CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE = 5 - CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE = 6 - CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE_KMT = 7 - CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF = 8 - - ctypedef CUexternalMemoryHandleType_enum CUexternalMemoryHandleType - - cdef struct anon_struct11: - void* handle - const void* name - - cdef union anon_union5: - int fd - anon_struct11 win32 - const void* nvSciBufObject - - cdef struct CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st: - CUexternalMemoryHandleType type - anon_union5 handle - unsigned long long size - unsigned int flags - unsigned int reserved[16] - - ctypedef CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st CUDA_EXTERNAL_MEMORY_HANDLE_DESC_v1 - - ctypedef CUDA_EXTERNAL_MEMORY_HANDLE_DESC_v1 CUDA_EXTERNAL_MEMORY_HANDLE_DESC - - cdef struct CUDA_EXTERNAL_MEMORY_BUFFER_DESC_st: - unsigned long long offset - unsigned long long size - unsigned int flags - unsigned int reserved[16] - - ctypedef CUDA_EXTERNAL_MEMORY_BUFFER_DESC_st CUDA_EXTERNAL_MEMORY_BUFFER_DESC_v1 - - ctypedef CUDA_EXTERNAL_MEMORY_BUFFER_DESC_v1 CUDA_EXTERNAL_MEMORY_BUFFER_DESC - - cdef struct CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_st: - unsigned long long offset - CUDA_ARRAY3D_DESCRIPTOR arrayDesc - unsigned int numLevels - unsigned int reserved[16] - - ctypedef CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_st CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_v1 - - ctypedef CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_v1 CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC - - cdef enum CUexternalSemaphoreHandleType_enum: - CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD = 1 - CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32 = 2 - CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT = 3 - CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE = 4 - CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_FENCE = 5 - CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC = 6 - CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX = 7 - CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX_KMT = 8 - CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_FD = 9 - CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_WIN32 = 10 - - ctypedef CUexternalSemaphoreHandleType_enum CUexternalSemaphoreHandleType - - cdef struct anon_struct12: - void* handle - const void* name - - cdef union anon_union6: - int fd - anon_struct12 win32 - const void* nvSciSyncObj - - cdef struct CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st: - CUexternalSemaphoreHandleType type - anon_union6 handle - unsigned int flags - unsigned int reserved[16] - - ctypedef CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_v1 - - ctypedef CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_v1 CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC - - cdef struct anon_struct13: - unsigned long long value - - cdef union anon_union7: - void* fence - unsigned long long reserved - - cdef struct anon_struct14: - unsigned long long key - - cdef struct anon_struct15: - anon_struct13 fence - anon_union7 nvSciSync - anon_struct14 keyedMutex - unsigned int reserved[12] - - cdef struct CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st: - anon_struct15 params - unsigned int flags - unsigned int reserved[16] - - ctypedef CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_v1 - - ctypedef CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_v1 CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS - - cdef struct anon_struct16: - unsigned long long value - - cdef union anon_union8: - void* fence - unsigned long long reserved - - cdef struct anon_struct17: - unsigned long long key - unsigned int timeoutMs - - cdef struct anon_struct18: - anon_struct16 fence - anon_union8 nvSciSync - anon_struct17 keyedMutex - unsigned int reserved[10] - - cdef struct CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st: - anon_struct18 params - unsigned int flags - unsigned int reserved[16] - - ctypedef CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_v1 - - ctypedef CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_v1 CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS - - cdef struct CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_st: - CUexternalSemaphore* extSemArray - const CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS* paramsArray - unsigned int numExtSems - - ctypedef CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_st CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v1 - - ctypedef CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v1 CUDA_EXT_SEM_SIGNAL_NODE_PARAMS - - cdef struct CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2_st: - CUexternalSemaphore* extSemArray - const CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS* paramsArray - unsigned int numExtSems - - ctypedef CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2_st CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2 - - cdef struct CUDA_EXT_SEM_WAIT_NODE_PARAMS_st: - CUexternalSemaphore* extSemArray - const CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS* paramsArray - unsigned int numExtSems - - ctypedef CUDA_EXT_SEM_WAIT_NODE_PARAMS_st CUDA_EXT_SEM_WAIT_NODE_PARAMS_v1 - - ctypedef CUDA_EXT_SEM_WAIT_NODE_PARAMS_v1 CUDA_EXT_SEM_WAIT_NODE_PARAMS - - cdef struct CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2_st: - CUexternalSemaphore* extSemArray - const CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS* paramsArray - unsigned int numExtSems - - ctypedef CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2_st CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2 - - ctypedef unsigned long long CUmemGenericAllocationHandle_v1 - - ctypedef CUmemGenericAllocationHandle_v1 CUmemGenericAllocationHandle - - cdef enum CUmemAllocationHandleType_enum: - CU_MEM_HANDLE_TYPE_NONE = 0 - CU_MEM_HANDLE_TYPE_POSIX_FILE_DESCRIPTOR = 1 - CU_MEM_HANDLE_TYPE_WIN32 = 2 - CU_MEM_HANDLE_TYPE_WIN32_KMT = 4 - CU_MEM_HANDLE_TYPE_FABRIC = 8 - CU_MEM_HANDLE_TYPE_MAX = 2147483647 - - ctypedef CUmemAllocationHandleType_enum CUmemAllocationHandleType - - cdef enum CUmemAccess_flags_enum: - CU_MEM_ACCESS_FLAGS_PROT_NONE = 0 - CU_MEM_ACCESS_FLAGS_PROT_READ = 1 - CU_MEM_ACCESS_FLAGS_PROT_READWRITE = 3 - CU_MEM_ACCESS_FLAGS_PROT_MAX = 2147483647 - - ctypedef CUmemAccess_flags_enum CUmemAccess_flags - - cdef enum CUmemLocationType_enum: - CU_MEM_LOCATION_TYPE_INVALID = 0 - CU_MEM_LOCATION_TYPE_DEVICE = 1 - CU_MEM_LOCATION_TYPE_HOST = 2 - CU_MEM_LOCATION_TYPE_HOST_NUMA = 3 - CU_MEM_LOCATION_TYPE_HOST_NUMA_CURRENT = 4 - CU_MEM_LOCATION_TYPE_MAX = 2147483647 - - ctypedef CUmemLocationType_enum CUmemLocationType - - cdef enum CUmemAllocationType_enum: - CU_MEM_ALLOCATION_TYPE_INVALID = 0 - CU_MEM_ALLOCATION_TYPE_PINNED = 1 - CU_MEM_ALLOCATION_TYPE_MAX = 2147483647 - - ctypedef CUmemAllocationType_enum CUmemAllocationType - - cdef enum CUmemAllocationGranularity_flags_enum: - CU_MEM_ALLOC_GRANULARITY_MINIMUM = 0 - CU_MEM_ALLOC_GRANULARITY_RECOMMENDED = 1 - - ctypedef CUmemAllocationGranularity_flags_enum CUmemAllocationGranularity_flags - - cdef enum CUmemRangeHandleType_enum: - CU_MEM_RANGE_HANDLE_TYPE_DMA_BUF_FD = 1 - CU_MEM_RANGE_HANDLE_TYPE_MAX = 2147483647 - - ctypedef CUmemRangeHandleType_enum CUmemRangeHandleType - - cdef enum CUarraySparseSubresourceType_enum: - CU_ARRAY_SPARSE_SUBRESOURCE_TYPE_SPARSE_LEVEL = 0 - CU_ARRAY_SPARSE_SUBRESOURCE_TYPE_MIPTAIL = 1 - - ctypedef CUarraySparseSubresourceType_enum CUarraySparseSubresourceType - - cdef enum CUmemOperationType_enum: - CU_MEM_OPERATION_TYPE_MAP = 1 - CU_MEM_OPERATION_TYPE_UNMAP = 2 - - ctypedef CUmemOperationType_enum CUmemOperationType - - cdef enum CUmemHandleType_enum: - CU_MEM_HANDLE_TYPE_GENERIC = 0 - - ctypedef CUmemHandleType_enum CUmemHandleType - - cdef union anon_union9: - CUmipmappedArray mipmap - CUarray array - - cdef struct anon_struct19: - unsigned int level - unsigned int layer - unsigned int offsetX - unsigned int offsetY - unsigned int offsetZ - unsigned int extentWidth - unsigned int extentHeight - unsigned int extentDepth - - cdef struct anon_struct20: - unsigned int layer - unsigned long long offset - unsigned long long size - - cdef union anon_union10: - anon_struct19 sparseLevel - anon_struct20 miptail - - cdef union anon_union11: - CUmemGenericAllocationHandle memHandle - - cdef struct CUarrayMapInfo_st: - CUresourcetype resourceType - anon_union9 resource - CUarraySparseSubresourceType subresourceType - anon_union10 subresource - CUmemOperationType memOperationType - CUmemHandleType memHandleType - anon_union11 memHandle - unsigned long long offset - unsigned int deviceBitMask - unsigned int flags - unsigned int reserved[2] - - ctypedef CUarrayMapInfo_st CUarrayMapInfo_v1 - - ctypedef CUarrayMapInfo_v1 CUarrayMapInfo - - cdef struct CUmemLocation_st: - CUmemLocationType type - int id - - ctypedef CUmemLocation_st CUmemLocation_v1 - - ctypedef CUmemLocation_v1 CUmemLocation - - cdef enum CUmemAllocationCompType_enum: - CU_MEM_ALLOCATION_COMP_NONE = 0 - CU_MEM_ALLOCATION_COMP_GENERIC = 1 - - ctypedef CUmemAllocationCompType_enum CUmemAllocationCompType - - cdef struct anon_struct21: - unsigned char compressionType - unsigned char gpuDirectRDMACapable - unsigned short usage - unsigned char reserved[4] - - cdef struct CUmemAllocationProp_st: - CUmemAllocationType type - CUmemAllocationHandleType requestedHandleTypes - CUmemLocation location - void* win32HandleMetaData - anon_struct21 allocFlags - - ctypedef CUmemAllocationProp_st CUmemAllocationProp_v1 - - ctypedef CUmemAllocationProp_v1 CUmemAllocationProp - - cdef enum CUmulticastGranularity_flags_enum: - CU_MULTICAST_GRANULARITY_MINIMUM = 0 - CU_MULTICAST_GRANULARITY_RECOMMENDED = 1 - - ctypedef CUmulticastGranularity_flags_enum CUmulticastGranularity_flags - - cdef struct CUmulticastObjectProp_st: - unsigned int numDevices - size_t size - unsigned long long handleTypes - unsigned long long flags - - ctypedef CUmulticastObjectProp_st CUmulticastObjectProp_v1 - - ctypedef CUmulticastObjectProp_v1 CUmulticastObjectProp - - cdef struct CUmemAccessDesc_st: - CUmemLocation location - CUmemAccess_flags flags - - ctypedef CUmemAccessDesc_st CUmemAccessDesc_v1 - - ctypedef CUmemAccessDesc_v1 CUmemAccessDesc - - cdef enum CUgraphExecUpdateResult_enum: - CU_GRAPH_EXEC_UPDATE_SUCCESS = 0 - CU_GRAPH_EXEC_UPDATE_ERROR = 1 - CU_GRAPH_EXEC_UPDATE_ERROR_TOPOLOGY_CHANGED = 2 - CU_GRAPH_EXEC_UPDATE_ERROR_NODE_TYPE_CHANGED = 3 - CU_GRAPH_EXEC_UPDATE_ERROR_FUNCTION_CHANGED = 4 - CU_GRAPH_EXEC_UPDATE_ERROR_PARAMETERS_CHANGED = 5 - CU_GRAPH_EXEC_UPDATE_ERROR_NOT_SUPPORTED = 6 - CU_GRAPH_EXEC_UPDATE_ERROR_UNSUPPORTED_FUNCTION_CHANGE = 7 - CU_GRAPH_EXEC_UPDATE_ERROR_ATTRIBUTES_CHANGED = 8 - - ctypedef CUgraphExecUpdateResult_enum CUgraphExecUpdateResult - - cdef struct CUgraphExecUpdateResultInfo_st: - CUgraphExecUpdateResult result - CUgraphNode errorNode - CUgraphNode errorFromNode - - ctypedef CUgraphExecUpdateResultInfo_st CUgraphExecUpdateResultInfo_v1 - - ctypedef CUgraphExecUpdateResultInfo_v1 CUgraphExecUpdateResultInfo - - cdef enum CUmemPool_attribute_enum: - CU_MEMPOOL_ATTR_REUSE_FOLLOW_EVENT_DEPENDENCIES = 1 - CU_MEMPOOL_ATTR_REUSE_ALLOW_OPPORTUNISTIC = 2 - CU_MEMPOOL_ATTR_REUSE_ALLOW_INTERNAL_DEPENDENCIES = 3 - CU_MEMPOOL_ATTR_RELEASE_THRESHOLD = 4 - CU_MEMPOOL_ATTR_RESERVED_MEM_CURRENT = 5 - CU_MEMPOOL_ATTR_RESERVED_MEM_HIGH = 6 - CU_MEMPOOL_ATTR_USED_MEM_CURRENT = 7 - CU_MEMPOOL_ATTR_USED_MEM_HIGH = 8 - - ctypedef CUmemPool_attribute_enum CUmemPool_attribute - - cdef struct CUmemPoolProps_st: - CUmemAllocationType allocType - CUmemAllocationHandleType handleTypes - CUmemLocation location - void* win32SecurityAttributes - size_t maxSize - unsigned char reserved[56] - - ctypedef CUmemPoolProps_st CUmemPoolProps_v1 - - ctypedef CUmemPoolProps_v1 CUmemPoolProps - - cdef struct CUmemPoolPtrExportData_st: - unsigned char reserved[64] - - ctypedef CUmemPoolPtrExportData_st CUmemPoolPtrExportData_v1 - - ctypedef CUmemPoolPtrExportData_v1 CUmemPoolPtrExportData - - cdef struct CUDA_MEM_ALLOC_NODE_PARAMS_v1_st: - CUmemPoolProps poolProps - const CUmemAccessDesc* accessDescs - size_t accessDescCount - size_t bytesize - CUdeviceptr dptr - - ctypedef CUDA_MEM_ALLOC_NODE_PARAMS_v1_st CUDA_MEM_ALLOC_NODE_PARAMS_v1 - - ctypedef CUDA_MEM_ALLOC_NODE_PARAMS_v1 CUDA_MEM_ALLOC_NODE_PARAMS - - cdef struct CUDA_MEM_ALLOC_NODE_PARAMS_v2_st: - CUmemPoolProps poolProps - const CUmemAccessDesc* accessDescs - size_t accessDescCount - size_t bytesize - CUdeviceptr dptr - - ctypedef CUDA_MEM_ALLOC_NODE_PARAMS_v2_st CUDA_MEM_ALLOC_NODE_PARAMS_v2 - - cdef struct CUDA_MEM_FREE_NODE_PARAMS_st: - CUdeviceptr dptr - - ctypedef CUDA_MEM_FREE_NODE_PARAMS_st CUDA_MEM_FREE_NODE_PARAMS - - cdef enum CUgraphMem_attribute_enum: - CU_GRAPH_MEM_ATTR_USED_MEM_CURRENT = 0 - CU_GRAPH_MEM_ATTR_USED_MEM_HIGH = 1 - CU_GRAPH_MEM_ATTR_RESERVED_MEM_CURRENT = 2 - CU_GRAPH_MEM_ATTR_RESERVED_MEM_HIGH = 3 - - ctypedef CUgraphMem_attribute_enum CUgraphMem_attribute - - cdef struct CUDA_CHILD_GRAPH_NODE_PARAMS_st: - CUgraph graph - - ctypedef CUDA_CHILD_GRAPH_NODE_PARAMS_st CUDA_CHILD_GRAPH_NODE_PARAMS - - cdef struct CUDA_EVENT_RECORD_NODE_PARAMS_st: - CUevent event - - ctypedef CUDA_EVENT_RECORD_NODE_PARAMS_st CUDA_EVENT_RECORD_NODE_PARAMS - - cdef struct CUDA_EVENT_WAIT_NODE_PARAMS_st: - CUevent event - - ctypedef CUDA_EVENT_WAIT_NODE_PARAMS_st CUDA_EVENT_WAIT_NODE_PARAMS - - cdef struct CUgraphNodeParams_st: - CUgraphNodeType type - int reserved0[3] - long long reserved1[29] - CUDA_KERNEL_NODE_PARAMS_v3 kernel - CUDA_MEMCPY_NODE_PARAMS memcpy - CUDA_MEMSET_NODE_PARAMS_v2 memset - CUDA_HOST_NODE_PARAMS_v2 host - CUDA_CHILD_GRAPH_NODE_PARAMS graph - CUDA_EVENT_WAIT_NODE_PARAMS eventWait - CUDA_EVENT_RECORD_NODE_PARAMS eventRecord - CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2 extSemSignal - CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2 extSemWait - CUDA_MEM_ALLOC_NODE_PARAMS_v2 alloc - CUDA_MEM_FREE_NODE_PARAMS free - CUDA_BATCH_MEM_OP_NODE_PARAMS_v2 memOp - CUDA_CONDITIONAL_NODE_PARAMS conditional - long long reserved2 - - ctypedef CUgraphNodeParams_st CUgraphNodeParams - - cdef enum CUflushGPUDirectRDMAWritesOptions_enum: - CU_FLUSH_GPU_DIRECT_RDMA_WRITES_OPTION_HOST = 1 - CU_FLUSH_GPU_DIRECT_RDMA_WRITES_OPTION_MEMOPS = 2 - - ctypedef CUflushGPUDirectRDMAWritesOptions_enum CUflushGPUDirectRDMAWritesOptions - - cdef enum CUGPUDirectRDMAWritesOrdering_enum: - CU_GPU_DIRECT_RDMA_WRITES_ORDERING_NONE = 0 - CU_GPU_DIRECT_RDMA_WRITES_ORDERING_OWNER = 100 - CU_GPU_DIRECT_RDMA_WRITES_ORDERING_ALL_DEVICES = 200 - - ctypedef CUGPUDirectRDMAWritesOrdering_enum CUGPUDirectRDMAWritesOrdering - - cdef enum CUflushGPUDirectRDMAWritesScope_enum: - CU_FLUSH_GPU_DIRECT_RDMA_WRITES_TO_OWNER = 100 - CU_FLUSH_GPU_DIRECT_RDMA_WRITES_TO_ALL_DEVICES = 200 - - ctypedef CUflushGPUDirectRDMAWritesScope_enum CUflushGPUDirectRDMAWritesScope - - cdef enum CUflushGPUDirectRDMAWritesTarget_enum: - CU_FLUSH_GPU_DIRECT_RDMA_WRITES_TARGET_CURRENT_CTX = 0 - - ctypedef CUflushGPUDirectRDMAWritesTarget_enum CUflushGPUDirectRDMAWritesTarget - - cdef enum CUgraphDebugDot_flags_enum: - CU_GRAPH_DEBUG_DOT_FLAGS_VERBOSE = 1 - CU_GRAPH_DEBUG_DOT_FLAGS_RUNTIME_TYPES = 2 - CU_GRAPH_DEBUG_DOT_FLAGS_KERNEL_NODE_PARAMS = 4 - CU_GRAPH_DEBUG_DOT_FLAGS_MEMCPY_NODE_PARAMS = 8 - CU_GRAPH_DEBUG_DOT_FLAGS_MEMSET_NODE_PARAMS = 16 - CU_GRAPH_DEBUG_DOT_FLAGS_HOST_NODE_PARAMS = 32 - CU_GRAPH_DEBUG_DOT_FLAGS_EVENT_NODE_PARAMS = 64 - CU_GRAPH_DEBUG_DOT_FLAGS_EXT_SEMAS_SIGNAL_NODE_PARAMS = 128 - CU_GRAPH_DEBUG_DOT_FLAGS_EXT_SEMAS_WAIT_NODE_PARAMS = 256 - CU_GRAPH_DEBUG_DOT_FLAGS_KERNEL_NODE_ATTRIBUTES = 512 - CU_GRAPH_DEBUG_DOT_FLAGS_HANDLES = 1024 - CU_GRAPH_DEBUG_DOT_FLAGS_MEM_ALLOC_NODE_PARAMS = 2048 - CU_GRAPH_DEBUG_DOT_FLAGS_MEM_FREE_NODE_PARAMS = 4096 - CU_GRAPH_DEBUG_DOT_FLAGS_BATCH_MEM_OP_NODE_PARAMS = 8192 - CU_GRAPH_DEBUG_DOT_FLAGS_EXTRA_TOPO_INFO = 16384 - CU_GRAPH_DEBUG_DOT_FLAGS_CONDITIONAL_NODE_PARAMS = 32768 - - ctypedef CUgraphDebugDot_flags_enum CUgraphDebugDot_flags - - cdef enum CUuserObject_flags_enum: - CU_USER_OBJECT_NO_DESTRUCTOR_SYNC = 1 - - ctypedef CUuserObject_flags_enum CUuserObject_flags - - cdef enum CUuserObjectRetain_flags_enum: - CU_GRAPH_USER_OBJECT_MOVE = 1 - - ctypedef CUuserObjectRetain_flags_enum CUuserObjectRetain_flags - - cdef enum CUgraphInstantiate_flags_enum: - CUDA_GRAPH_INSTANTIATE_FLAG_AUTO_FREE_ON_LAUNCH = 1 - CUDA_GRAPH_INSTANTIATE_FLAG_UPLOAD = 2 - CUDA_GRAPH_INSTANTIATE_FLAG_DEVICE_LAUNCH = 4 - CUDA_GRAPH_INSTANTIATE_FLAG_USE_NODE_PRIORITY = 8 - - ctypedef CUgraphInstantiate_flags_enum CUgraphInstantiate_flags - - cdef enum CUdeviceNumaConfig_enum: - CU_DEVICE_NUMA_CONFIG_NONE = 0 - CU_DEVICE_NUMA_CONFIG_NUMA_NODE = 1 - - ctypedef CUdeviceNumaConfig_enum CUdeviceNumaConfig - - cdef enum CUmoduleLoadingMode_enum: - CU_MODULE_EAGER_LOADING = 1 - CU_MODULE_LAZY_LOADING = 2 - - ctypedef CUmoduleLoadingMode_enum CUmoduleLoadingMode - - cdef enum CUfunctionLoadingState_enum: - CU_FUNCTION_LOADING_STATE_UNLOADED = 0 - CU_FUNCTION_LOADING_STATE_LOADED = 1 - CU_FUNCTION_LOADING_STATE_MAX = 2 - - ctypedef CUfunctionLoadingState_enum CUfunctionLoadingState - - cdef enum CUcoredumpSettings_enum: - CU_COREDUMP_ENABLE_ON_EXCEPTION = 1 - CU_COREDUMP_TRIGGER_HOST = 2 - CU_COREDUMP_LIGHTWEIGHT = 3 - CU_COREDUMP_ENABLE_USER_TRIGGER = 4 - CU_COREDUMP_FILE = 5 - CU_COREDUMP_PIPE = 6 - CU_COREDUMP_GENERATION_FLAGS = 7 - CU_COREDUMP_MAX = 8 - - ctypedef CUcoredumpSettings_enum CUcoredumpSettings - - cdef enum CUCoredumpGenerationFlags: - CU_COREDUMP_DEFAULT_FLAGS = 0 - CU_COREDUMP_SKIP_NONRELOCATED_ELF_IMAGES = 1 - CU_COREDUMP_SKIP_GLOBAL_MEMORY = 2 - CU_COREDUMP_SKIP_SHARED_MEMORY = 4 - CU_COREDUMP_SKIP_LOCAL_MEMORY = 8 - CU_COREDUMP_LIGHTWEIGHT_FLAGS = 15 - CU_COREDUMP_SKIP_ABORT = 16 - - cdef struct CUdevResourceDesc_st: - pass - ctypedef CUdevResourceDesc_st* CUdevResourceDesc - - ctypedef enum CUgreenCtxCreate_flags: - CU_GREEN_CTX_DEFAULT_STREAM = 1 - - ctypedef enum CUdevSmResourceSplit_flags: - CU_DEV_SM_RESOURCE_SPLIT_IGNORE_SM_COSCHEDULING = 1 - CU_DEV_SM_RESOURCE_SPLIT_MAX_POTENTIAL_CLUSTER_SIZE = 2 - - ctypedef enum CUdevResourceType: - CU_DEV_RESOURCE_TYPE_INVALID = 0 - CU_DEV_RESOURCE_TYPE_SM = 1 - - cdef struct CUdevSmResource_st: - unsigned int smCount - - ctypedef CUdevSmResource_st CUdevSmResource - - cdef struct CUdevResource_st: - CUdevResourceType type - unsigned char _internal_padding[92] - CUdevSmResource sm - unsigned char _oversize[48] - - ctypedef CUdevResource_st CUdevResource_v1 - - ctypedef CUdevResource_v1 CUdevResource - -cdef extern from "cudaProfiler.h": - - cdef enum CUoutput_mode_enum: - CU_OUT_KEY_VALUE_PAIR = 0 - CU_OUT_CSV = 1 - - ctypedef CUoutput_mode_enum CUoutput_mode - -cdef enum CUeglFrameType_enum: - CU_EGL_FRAME_TYPE_ARRAY = 0 - CU_EGL_FRAME_TYPE_PITCH = 1 - -ctypedef CUeglFrameType_enum CUeglFrameType - -cdef enum CUeglResourceLocationFlags_enum: - CU_EGL_RESOURCE_LOCATION_SYSMEM = 0 - CU_EGL_RESOURCE_LOCATION_VIDMEM = 1 - -ctypedef CUeglResourceLocationFlags_enum CUeglResourceLocationFlags - -cdef enum CUeglColorFormat_enum: - CU_EGL_COLOR_FORMAT_YUV420_PLANAR = 0 - CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR = 1 - CU_EGL_COLOR_FORMAT_YUV422_PLANAR = 2 - CU_EGL_COLOR_FORMAT_YUV422_SEMIPLANAR = 3 - CU_EGL_COLOR_FORMAT_RGB = 4 - CU_EGL_COLOR_FORMAT_BGR = 5 - CU_EGL_COLOR_FORMAT_ARGB = 6 - CU_EGL_COLOR_FORMAT_RGBA = 7 - CU_EGL_COLOR_FORMAT_L = 8 - CU_EGL_COLOR_FORMAT_R = 9 - CU_EGL_COLOR_FORMAT_YUV444_PLANAR = 10 - CU_EGL_COLOR_FORMAT_YUV444_SEMIPLANAR = 11 - CU_EGL_COLOR_FORMAT_YUYV_422 = 12 - CU_EGL_COLOR_FORMAT_UYVY_422 = 13 - CU_EGL_COLOR_FORMAT_ABGR = 14 - CU_EGL_COLOR_FORMAT_BGRA = 15 - CU_EGL_COLOR_FORMAT_A = 16 - CU_EGL_COLOR_FORMAT_RG = 17 - CU_EGL_COLOR_FORMAT_AYUV = 18 - CU_EGL_COLOR_FORMAT_YVU444_SEMIPLANAR = 19 - CU_EGL_COLOR_FORMAT_YVU422_SEMIPLANAR = 20 - CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR = 21 - CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR = 22 - CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR = 23 - CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR = 24 - CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR = 25 - CU_EGL_COLOR_FORMAT_VYUY_ER = 26 - CU_EGL_COLOR_FORMAT_UYVY_ER = 27 - CU_EGL_COLOR_FORMAT_YUYV_ER = 28 - CU_EGL_COLOR_FORMAT_YVYU_ER = 29 - CU_EGL_COLOR_FORMAT_YUV_ER = 30 - CU_EGL_COLOR_FORMAT_YUVA_ER = 31 - CU_EGL_COLOR_FORMAT_AYUV_ER = 32 - CU_EGL_COLOR_FORMAT_YUV444_PLANAR_ER = 33 - CU_EGL_COLOR_FORMAT_YUV422_PLANAR_ER = 34 - CU_EGL_COLOR_FORMAT_YUV420_PLANAR_ER = 35 - CU_EGL_COLOR_FORMAT_YUV444_SEMIPLANAR_ER = 36 - CU_EGL_COLOR_FORMAT_YUV422_SEMIPLANAR_ER = 37 - CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR_ER = 38 - CU_EGL_COLOR_FORMAT_YVU444_PLANAR_ER = 39 - CU_EGL_COLOR_FORMAT_YVU422_PLANAR_ER = 40 - CU_EGL_COLOR_FORMAT_YVU420_PLANAR_ER = 41 - CU_EGL_COLOR_FORMAT_YVU444_SEMIPLANAR_ER = 42 - CU_EGL_COLOR_FORMAT_YVU422_SEMIPLANAR_ER = 43 - CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR_ER = 44 - CU_EGL_COLOR_FORMAT_BAYER_RGGB = 45 - CU_EGL_COLOR_FORMAT_BAYER_BGGR = 46 - CU_EGL_COLOR_FORMAT_BAYER_GRBG = 47 - CU_EGL_COLOR_FORMAT_BAYER_GBRG = 48 - CU_EGL_COLOR_FORMAT_BAYER10_RGGB = 49 - CU_EGL_COLOR_FORMAT_BAYER10_BGGR = 50 - CU_EGL_COLOR_FORMAT_BAYER10_GRBG = 51 - CU_EGL_COLOR_FORMAT_BAYER10_GBRG = 52 - CU_EGL_COLOR_FORMAT_BAYER12_RGGB = 53 - CU_EGL_COLOR_FORMAT_BAYER12_BGGR = 54 - CU_EGL_COLOR_FORMAT_BAYER12_GRBG = 55 - CU_EGL_COLOR_FORMAT_BAYER12_GBRG = 56 - CU_EGL_COLOR_FORMAT_BAYER14_RGGB = 57 - CU_EGL_COLOR_FORMAT_BAYER14_BGGR = 58 - CU_EGL_COLOR_FORMAT_BAYER14_GRBG = 59 - CU_EGL_COLOR_FORMAT_BAYER14_GBRG = 60 - CU_EGL_COLOR_FORMAT_BAYER20_RGGB = 61 - CU_EGL_COLOR_FORMAT_BAYER20_BGGR = 62 - CU_EGL_COLOR_FORMAT_BAYER20_GRBG = 63 - CU_EGL_COLOR_FORMAT_BAYER20_GBRG = 64 - CU_EGL_COLOR_FORMAT_YVU444_PLANAR = 65 - CU_EGL_COLOR_FORMAT_YVU422_PLANAR = 66 - CU_EGL_COLOR_FORMAT_YVU420_PLANAR = 67 - CU_EGL_COLOR_FORMAT_BAYER_ISP_RGGB = 68 - CU_EGL_COLOR_FORMAT_BAYER_ISP_BGGR = 69 - CU_EGL_COLOR_FORMAT_BAYER_ISP_GRBG = 70 - CU_EGL_COLOR_FORMAT_BAYER_ISP_GBRG = 71 - CU_EGL_COLOR_FORMAT_BAYER_BCCR = 72 - CU_EGL_COLOR_FORMAT_BAYER_RCCB = 73 - CU_EGL_COLOR_FORMAT_BAYER_CRBC = 74 - CU_EGL_COLOR_FORMAT_BAYER_CBRC = 75 - CU_EGL_COLOR_FORMAT_BAYER10_CCCC = 76 - CU_EGL_COLOR_FORMAT_BAYER12_BCCR = 77 - CU_EGL_COLOR_FORMAT_BAYER12_RCCB = 78 - CU_EGL_COLOR_FORMAT_BAYER12_CRBC = 79 - CU_EGL_COLOR_FORMAT_BAYER12_CBRC = 80 - CU_EGL_COLOR_FORMAT_BAYER12_CCCC = 81 - CU_EGL_COLOR_FORMAT_Y = 82 - CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR_2020 = 83 - CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR_2020 = 84 - CU_EGL_COLOR_FORMAT_YUV420_PLANAR_2020 = 85 - CU_EGL_COLOR_FORMAT_YVU420_PLANAR_2020 = 86 - CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR_709 = 87 - CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR_709 = 88 - CU_EGL_COLOR_FORMAT_YUV420_PLANAR_709 = 89 - CU_EGL_COLOR_FORMAT_YVU420_PLANAR_709 = 90 - CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_709 = 91 - CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_2020 = 92 - CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR_2020 = 93 - CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR = 94 - CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR_709 = 95 - CU_EGL_COLOR_FORMAT_Y_ER = 96 - CU_EGL_COLOR_FORMAT_Y_709_ER = 97 - CU_EGL_COLOR_FORMAT_Y10_ER = 98 - CU_EGL_COLOR_FORMAT_Y10_709_ER = 99 - CU_EGL_COLOR_FORMAT_Y12_ER = 100 - CU_EGL_COLOR_FORMAT_Y12_709_ER = 101 - CU_EGL_COLOR_FORMAT_YUVA = 102 - CU_EGL_COLOR_FORMAT_YUV = 103 - CU_EGL_COLOR_FORMAT_YVYU = 104 - CU_EGL_COLOR_FORMAT_VYUY = 105 - CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_ER = 106 - CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_709_ER = 107 - CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR_ER = 108 - CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR_709_ER = 109 - CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR_ER = 110 - CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR_709_ER = 111 - CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR_ER = 112 - CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR_709_ER = 113 - CU_EGL_COLOR_FORMAT_MAX = 114 - -ctypedef CUeglColorFormat_enum CUeglColorFormat - -cdef union anon_union14: - CUarray pArray[3] - void* pPitch[3] - -cdef struct CUeglFrame_st: - anon_union14 frame - unsigned int width - unsigned int height - unsigned int depth - unsigned int pitch - unsigned int planeCount - unsigned int numChannels - CUeglFrameType frameType - CUeglColorFormat eglColorFormat - CUarray_format cuFormat - -ctypedef CUeglFrame_st CUeglFrame_v1 - -ctypedef CUeglFrame_v1 CUeglFrame - -cdef extern from "": - cdef struct CUeglStreamConnection_st: - pass -ctypedef CUeglStreamConnection_st* CUeglStreamConnection - -cdef enum CUGLDeviceList_enum: - CU_GL_DEVICE_LIST_ALL = 1 - CU_GL_DEVICE_LIST_CURRENT_FRAME = 2 - CU_GL_DEVICE_LIST_NEXT_FRAME = 3 - -ctypedef CUGLDeviceList_enum CUGLDeviceList - -cdef enum CUGLmap_flags_enum: - CU_GL_MAP_RESOURCE_FLAGS_NONE = 0 - CU_GL_MAP_RESOURCE_FLAGS_READ_ONLY = 1 - CU_GL_MAP_RESOURCE_FLAGS_WRITE_DISCARD = 2 - -ctypedef CUGLmap_flags_enum CUGLmap_flags - -ctypedef unsigned int GLenum - -ctypedef unsigned int GLuint - -cdef extern from "": - cdef struct void: - pass -ctypedef void* EGLImageKHR - -cdef extern from "": - cdef struct void: - pass -ctypedef void* EGLStreamKHR - -ctypedef unsigned int EGLint - -cdef extern from "": - cdef struct void: - pass -ctypedef void* EGLSyncKHR - -ctypedef uint32_t VdpDevice - -ctypedef unsigned long long VdpGetProcAddress - -ctypedef uint32_t VdpVideoSurface - -ctypedef uint32_t VdpOutputSurface - -{{if 'cuGetErrorString' in found_functions}} - -cdef CUresult cuGetErrorString(CUresult error, const char** pStr) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGetErrorName' in found_functions}} - -cdef CUresult cuGetErrorName(CUresult error, const char** pStr) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuInit' in found_functions}} - -cdef CUresult cuInit(unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDriverGetVersion' in found_functions}} - -cdef CUresult cuDriverGetVersion(int* driverVersion) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDeviceGet' in found_functions}} - -cdef CUresult cuDeviceGet(CUdevice* device, int ordinal) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDeviceGetCount' in found_functions}} - -cdef CUresult cuDeviceGetCount(int* count) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDeviceGetName' in found_functions}} - -cdef CUresult cuDeviceGetName(char* name, int length, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDeviceGetUuid' in found_functions}} - -cdef CUresult cuDeviceGetUuid(CUuuid* uuid, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDeviceGetUuid_v2' in found_functions}} - -cdef CUresult cuDeviceGetUuid_v2(CUuuid* uuid, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDeviceGetLuid' in found_functions}} - -cdef CUresult cuDeviceGetLuid(char* luid, unsigned int* deviceNodeMask, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDeviceTotalMem_v2' in found_functions}} - -cdef CUresult cuDeviceTotalMem(size_t* numbytes, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDeviceGetTexture1DLinearMaxWidth' in found_functions}} - -cdef CUresult cuDeviceGetTexture1DLinearMaxWidth(size_t* maxWidthInElements, CUarray_format pformat, unsigned numChannels, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDeviceGetAttribute' in found_functions}} - -cdef CUresult cuDeviceGetAttribute(int* pi, CUdevice_attribute attrib, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDeviceGetNvSciSyncAttributes' in found_functions}} - -cdef CUresult cuDeviceGetNvSciSyncAttributes(void* nvSciSyncAttrList, CUdevice dev, int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDeviceSetMemPool' in found_functions}} - -cdef CUresult cuDeviceSetMemPool(CUdevice dev, CUmemoryPool pool) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDeviceGetMemPool' in found_functions}} - -cdef CUresult cuDeviceGetMemPool(CUmemoryPool* pool, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDeviceGetDefaultMemPool' in found_functions}} - -cdef CUresult cuDeviceGetDefaultMemPool(CUmemoryPool* pool_out, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDeviceGetExecAffinitySupport' in found_functions}} - -cdef CUresult cuDeviceGetExecAffinitySupport(int* pi, CUexecAffinityType typename, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuFlushGPUDirectRDMAWrites' in found_functions}} - -cdef CUresult cuFlushGPUDirectRDMAWrites(CUflushGPUDirectRDMAWritesTarget target, CUflushGPUDirectRDMAWritesScope scope) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDeviceGetProperties' in found_functions}} - -cdef CUresult cuDeviceGetProperties(CUdevprop* prop, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDeviceComputeCapability' in found_functions}} - -cdef CUresult cuDeviceComputeCapability(int* major, int* minor, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDevicePrimaryCtxRetain' in found_functions}} - -cdef CUresult cuDevicePrimaryCtxRetain(CUcontext* pctx, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDevicePrimaryCtxRelease_v2' in found_functions}} - -cdef CUresult cuDevicePrimaryCtxRelease(CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDevicePrimaryCtxSetFlags_v2' in found_functions}} - -cdef CUresult cuDevicePrimaryCtxSetFlags(CUdevice dev, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDevicePrimaryCtxGetState' in found_functions}} - -cdef CUresult cuDevicePrimaryCtxGetState(CUdevice dev, unsigned int* flags, int* active) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDevicePrimaryCtxReset_v2' in found_functions}} - -cdef CUresult cuDevicePrimaryCtxReset(CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxCreate_v2' in found_functions}} - -cdef CUresult cuCtxCreate(CUcontext* pctx, unsigned int flags, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxCreate_v3' in found_functions}} - -cdef CUresult cuCtxCreate_v3(CUcontext* pctx, CUexecAffinityParam* paramsArray, int numParams, unsigned int flags, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxCreate_v4' in found_functions}} - -cdef CUresult cuCtxCreate_v4(CUcontext* pctx, CUctxCreateParams* ctxCreateParams, unsigned int flags, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxDestroy_v2' in found_functions}} - -cdef CUresult cuCtxDestroy(CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxPushCurrent_v2' in found_functions}} - -cdef CUresult cuCtxPushCurrent(CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxPopCurrent_v2' in found_functions}} - -cdef CUresult cuCtxPopCurrent(CUcontext* pctx) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxSetCurrent' in found_functions}} - -cdef CUresult cuCtxSetCurrent(CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxGetCurrent' in found_functions}} - -cdef CUresult cuCtxGetCurrent(CUcontext* pctx) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxGetDevice' in found_functions}} - -cdef CUresult cuCtxGetDevice(CUdevice* device) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxGetFlags' in found_functions}} - -cdef CUresult cuCtxGetFlags(unsigned int* flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxSetFlags' in found_functions}} - -cdef CUresult cuCtxSetFlags(unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxGetId' in found_functions}} - -cdef CUresult cuCtxGetId(CUcontext ctx, unsigned long long* ctxId) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxSynchronize' in found_functions}} - -cdef CUresult cuCtxSynchronize() except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxSetLimit' in found_functions}} - -cdef CUresult cuCtxSetLimit(CUlimit limit, size_t value) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxGetLimit' in found_functions}} - -cdef CUresult cuCtxGetLimit(size_t* pvalue, CUlimit limit) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxGetCacheConfig' in found_functions}} - -cdef CUresult cuCtxGetCacheConfig(CUfunc_cache* pconfig) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxSetCacheConfig' in found_functions}} - -cdef CUresult cuCtxSetCacheConfig(CUfunc_cache config) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxGetApiVersion' in found_functions}} - -cdef CUresult cuCtxGetApiVersion(CUcontext ctx, unsigned int* version) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxGetStreamPriorityRange' in found_functions}} - -cdef CUresult cuCtxGetStreamPriorityRange(int* leastPriority, int* greatestPriority) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxResetPersistingL2Cache' in found_functions}} - -cdef CUresult cuCtxResetPersistingL2Cache() except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxGetExecAffinity' in found_functions}} - -cdef CUresult cuCtxGetExecAffinity(CUexecAffinityParam* pExecAffinity, CUexecAffinityType typename) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxRecordEvent' in found_functions}} - -cdef CUresult cuCtxRecordEvent(CUcontext hCtx, CUevent hEvent) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxWaitEvent' in found_functions}} - -cdef CUresult cuCtxWaitEvent(CUcontext hCtx, CUevent hEvent) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxAttach' in found_functions}} - -cdef CUresult cuCtxAttach(CUcontext* pctx, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxDetach' in found_functions}} - -cdef CUresult cuCtxDetach(CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxGetSharedMemConfig' in found_functions}} - -cdef CUresult cuCtxGetSharedMemConfig(CUsharedconfig* pConfig) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxSetSharedMemConfig' in found_functions}} - -cdef CUresult cuCtxSetSharedMemConfig(CUsharedconfig config) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuModuleLoad' in found_functions}} - -cdef CUresult cuModuleLoad(CUmodule* module, const char* fname) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuModuleLoadData' in found_functions}} - -cdef CUresult cuModuleLoadData(CUmodule* module, const void* image) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuModuleLoadDataEx' in found_functions}} - -cdef CUresult cuModuleLoadDataEx(CUmodule* module, const void* image, unsigned int numOptions, CUjit_option* options, void** optionValues) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuModuleLoadFatBinary' in found_functions}} - -cdef CUresult cuModuleLoadFatBinary(CUmodule* module, const void* fatCubin) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuModuleUnload' in found_functions}} - -cdef CUresult cuModuleUnload(CUmodule hmod) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuModuleGetLoadingMode' in found_functions}} - -cdef CUresult cuModuleGetLoadingMode(CUmoduleLoadingMode* mode) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuModuleGetFunction' in found_functions}} - -cdef CUresult cuModuleGetFunction(CUfunction* hfunc, CUmodule hmod, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuModuleGetFunctionCount' in found_functions}} - -cdef CUresult cuModuleGetFunctionCount(unsigned int* count, CUmodule mod) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuModuleEnumerateFunctions' in found_functions}} - -cdef CUresult cuModuleEnumerateFunctions(CUfunction* functions, unsigned int numFunctions, CUmodule mod) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuModuleGetGlobal_v2' in found_functions}} - -cdef CUresult cuModuleGetGlobal(CUdeviceptr* dptr, size_t* numbytes, CUmodule hmod, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuLinkCreate_v2' in found_functions}} - -cdef CUresult cuLinkCreate(unsigned int numOptions, CUjit_option* options, void** optionValues, CUlinkState* stateOut) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuLinkAddData_v2' in found_functions}} - -cdef CUresult cuLinkAddData(CUlinkState state, CUjitInputType typename, void* data, size_t size, const char* name, unsigned int numOptions, CUjit_option* options, void** optionValues) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuLinkAddFile_v2' in found_functions}} - -cdef CUresult cuLinkAddFile(CUlinkState state, CUjitInputType typename, const char* path, unsigned int numOptions, CUjit_option* options, void** optionValues) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuLinkComplete' in found_functions}} - -cdef CUresult cuLinkComplete(CUlinkState state, void** cubinOut, size_t* sizeOut) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuLinkDestroy' in found_functions}} - -cdef CUresult cuLinkDestroy(CUlinkState state) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuModuleGetTexRef' in found_functions}} - -cdef CUresult cuModuleGetTexRef(CUtexref* pTexRef, CUmodule hmod, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuModuleGetSurfRef' in found_functions}} - -cdef CUresult cuModuleGetSurfRef(CUsurfref* pSurfRef, CUmodule hmod, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuLibraryLoadData' in found_functions}} - -cdef CUresult cuLibraryLoadData(CUlibrary* library, const void* code, CUjit_option* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, CUlibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuLibraryLoadFromFile' in found_functions}} - -cdef CUresult cuLibraryLoadFromFile(CUlibrary* library, const char* fileName, CUjit_option* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, CUlibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuLibraryUnload' in found_functions}} - -cdef CUresult cuLibraryUnload(CUlibrary library) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuLibraryGetKernel' in found_functions}} - -cdef CUresult cuLibraryGetKernel(CUkernel* pKernel, CUlibrary library, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuLibraryGetKernelCount' in found_functions}} - -cdef CUresult cuLibraryGetKernelCount(unsigned int* count, CUlibrary lib) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuLibraryEnumerateKernels' in found_functions}} - -cdef CUresult cuLibraryEnumerateKernels(CUkernel* kernels, unsigned int numKernels, CUlibrary lib) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuLibraryGetModule' in found_functions}} - -cdef CUresult cuLibraryGetModule(CUmodule* pMod, CUlibrary library) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuKernelGetFunction' in found_functions}} - -cdef CUresult cuKernelGetFunction(CUfunction* pFunc, CUkernel kernel) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuKernelGetLibrary' in found_functions}} - -cdef CUresult cuKernelGetLibrary(CUlibrary* pLib, CUkernel kernel) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuLibraryGetGlobal' in found_functions}} - -cdef CUresult cuLibraryGetGlobal(CUdeviceptr* dptr, size_t* numbytes, CUlibrary library, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuLibraryGetManaged' in found_functions}} - -cdef CUresult cuLibraryGetManaged(CUdeviceptr* dptr, size_t* numbytes, CUlibrary library, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuLibraryGetUnifiedFunction' in found_functions}} - -cdef CUresult cuLibraryGetUnifiedFunction(void** fptr, CUlibrary library, const char* symbol) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuKernelGetAttribute' in found_functions}} - -cdef CUresult cuKernelGetAttribute(int* pi, CUfunction_attribute attrib, CUkernel kernel, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuKernelSetAttribute' in found_functions}} - -cdef CUresult cuKernelSetAttribute(CUfunction_attribute attrib, int val, CUkernel kernel, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuKernelSetCacheConfig' in found_functions}} - -cdef CUresult cuKernelSetCacheConfig(CUkernel kernel, CUfunc_cache config, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuKernelGetName' in found_functions}} - -cdef CUresult cuKernelGetName(const char** name, CUkernel hfunc) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuKernelGetParamInfo' in found_functions}} - -cdef CUresult cuKernelGetParamInfo(CUkernel kernel, size_t paramIndex, size_t* paramOffset, size_t* paramSize) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemGetInfo_v2' in found_functions}} - -cdef CUresult cuMemGetInfo(size_t* free, size_t* total) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemAlloc_v2' in found_functions}} - -cdef CUresult cuMemAlloc(CUdeviceptr* dptr, size_t bytesize) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemAllocPitch_v2' in found_functions}} - -cdef CUresult cuMemAllocPitch(CUdeviceptr* dptr, size_t* pPitch, size_t WidthInBytes, size_t Height, unsigned int ElementSizeBytes) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemFree_v2' in found_functions}} - -cdef CUresult cuMemFree(CUdeviceptr dptr) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemGetAddressRange_v2' in found_functions}} - -cdef CUresult cuMemGetAddressRange(CUdeviceptr* pbase, size_t* psize, CUdeviceptr dptr) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemAllocHost_v2' in found_functions}} - -cdef CUresult cuMemAllocHost(void** pp, size_t bytesize) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemFreeHost' in found_functions}} - -cdef CUresult cuMemFreeHost(void* p) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemHostAlloc' in found_functions}} - -cdef CUresult cuMemHostAlloc(void** pp, size_t bytesize, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemHostGetDevicePointer_v2' in found_functions}} - -cdef CUresult cuMemHostGetDevicePointer(CUdeviceptr* pdptr, void* p, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemHostGetFlags' in found_functions}} - -cdef CUresult cuMemHostGetFlags(unsigned int* pFlags, void* p) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemAllocManaged' in found_functions}} - -cdef CUresult cuMemAllocManaged(CUdeviceptr* dptr, size_t bytesize, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDeviceRegisterAsyncNotification' in found_functions}} - -cdef CUresult cuDeviceRegisterAsyncNotification(CUdevice device, CUasyncCallback callbackFunc, void* userData, CUasyncCallbackHandle* callback) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDeviceUnregisterAsyncNotification' in found_functions}} - -cdef CUresult cuDeviceUnregisterAsyncNotification(CUdevice device, CUasyncCallbackHandle callback) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDeviceGetByPCIBusId' in found_functions}} - -cdef CUresult cuDeviceGetByPCIBusId(CUdevice* dev, const char* pciBusId) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDeviceGetPCIBusId' in found_functions}} - -cdef CUresult cuDeviceGetPCIBusId(char* pciBusId, int length, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuIpcGetEventHandle' in found_functions}} - -cdef CUresult cuIpcGetEventHandle(CUipcEventHandle* pHandle, CUevent event) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuIpcOpenEventHandle' in found_functions}} - -cdef CUresult cuIpcOpenEventHandle(CUevent* phEvent, CUipcEventHandle handle) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuIpcGetMemHandle' in found_functions}} - -cdef CUresult cuIpcGetMemHandle(CUipcMemHandle* pHandle, CUdeviceptr dptr) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuIpcOpenMemHandle_v2' in found_functions}} - -cdef CUresult cuIpcOpenMemHandle(CUdeviceptr* pdptr, CUipcMemHandle handle, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuIpcCloseMemHandle' in found_functions}} - -cdef CUresult cuIpcCloseMemHandle(CUdeviceptr dptr) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemHostRegister_v2' in found_functions}} - -cdef CUresult cuMemHostRegister(void* p, size_t bytesize, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemHostUnregister' in found_functions}} - -cdef CUresult cuMemHostUnregister(void* p) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemcpy' in found_functions}} - -cdef CUresult cuMemcpy(CUdeviceptr dst, CUdeviceptr src, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemcpyPeer' in found_functions}} - -cdef CUresult cuMemcpyPeer(CUdeviceptr dstDevice, CUcontext dstContext, CUdeviceptr srcDevice, CUcontext srcContext, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemcpyHtoD_v2' in found_functions}} - -cdef CUresult cuMemcpyHtoD(CUdeviceptr dstDevice, const void* srcHost, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemcpyDtoH_v2' in found_functions}} - -cdef CUresult cuMemcpyDtoH(void* dstHost, CUdeviceptr srcDevice, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemcpyDtoD_v2' in found_functions}} - -cdef CUresult cuMemcpyDtoD(CUdeviceptr dstDevice, CUdeviceptr srcDevice, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemcpyDtoA_v2' in found_functions}} - -cdef CUresult cuMemcpyDtoA(CUarray dstArray, size_t dstOffset, CUdeviceptr srcDevice, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemcpyAtoD_v2' in found_functions}} - -cdef CUresult cuMemcpyAtoD(CUdeviceptr dstDevice, CUarray srcArray, size_t srcOffset, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemcpyHtoA_v2' in found_functions}} - -cdef CUresult cuMemcpyHtoA(CUarray dstArray, size_t dstOffset, const void* srcHost, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemcpyAtoH_v2' in found_functions}} - -cdef CUresult cuMemcpyAtoH(void* dstHost, CUarray srcArray, size_t srcOffset, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemcpyAtoA_v2' in found_functions}} - -cdef CUresult cuMemcpyAtoA(CUarray dstArray, size_t dstOffset, CUarray srcArray, size_t srcOffset, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemcpy2D_v2' in found_functions}} - -cdef CUresult cuMemcpy2D(const CUDA_MEMCPY2D* pCopy) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemcpy2DUnaligned_v2' in found_functions}} - -cdef CUresult cuMemcpy2DUnaligned(const CUDA_MEMCPY2D* pCopy) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemcpy3D_v2' in found_functions}} - -cdef CUresult cuMemcpy3D(const CUDA_MEMCPY3D* pCopy) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemcpy3DPeer' in found_functions}} - -cdef CUresult cuMemcpy3DPeer(const CUDA_MEMCPY3D_PEER* pCopy) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemcpyAsync' in found_functions}} - -cdef CUresult cuMemcpyAsync(CUdeviceptr dst, CUdeviceptr src, size_t ByteCount, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemcpyPeerAsync' in found_functions}} - -cdef CUresult cuMemcpyPeerAsync(CUdeviceptr dstDevice, CUcontext dstContext, CUdeviceptr srcDevice, CUcontext srcContext, size_t ByteCount, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemcpyHtoDAsync_v2' in found_functions}} - -cdef CUresult cuMemcpyHtoDAsync(CUdeviceptr dstDevice, const void* srcHost, size_t ByteCount, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemcpyDtoHAsync_v2' in found_functions}} - -cdef CUresult cuMemcpyDtoHAsync(void* dstHost, CUdeviceptr srcDevice, size_t ByteCount, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemcpyDtoDAsync_v2' in found_functions}} - -cdef CUresult cuMemcpyDtoDAsync(CUdeviceptr dstDevice, CUdeviceptr srcDevice, size_t ByteCount, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemcpyHtoAAsync_v2' in found_functions}} - -cdef CUresult cuMemcpyHtoAAsync(CUarray dstArray, size_t dstOffset, const void* srcHost, size_t ByteCount, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemcpyAtoHAsync_v2' in found_functions}} - -cdef CUresult cuMemcpyAtoHAsync(void* dstHost, CUarray srcArray, size_t srcOffset, size_t ByteCount, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemcpy2DAsync_v2' in found_functions}} - -cdef CUresult cuMemcpy2DAsync(const CUDA_MEMCPY2D* pCopy, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemcpy3DAsync_v2' in found_functions}} - -cdef CUresult cuMemcpy3DAsync(const CUDA_MEMCPY3D* pCopy, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemcpy3DPeerAsync' in found_functions}} - -cdef CUresult cuMemcpy3DPeerAsync(const CUDA_MEMCPY3D_PEER* pCopy, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemsetD8_v2' in found_functions}} - -cdef CUresult cuMemsetD8(CUdeviceptr dstDevice, unsigned char uc, size_t N) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemsetD16_v2' in found_functions}} - -cdef CUresult cuMemsetD16(CUdeviceptr dstDevice, unsigned short us, size_t N) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemsetD32_v2' in found_functions}} - -cdef CUresult cuMemsetD32(CUdeviceptr dstDevice, unsigned int ui, size_t N) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemsetD2D8_v2' in found_functions}} - -cdef CUresult cuMemsetD2D8(CUdeviceptr dstDevice, size_t dstPitch, unsigned char uc, size_t Width, size_t Height) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemsetD2D16_v2' in found_functions}} - -cdef CUresult cuMemsetD2D16(CUdeviceptr dstDevice, size_t dstPitch, unsigned short us, size_t Width, size_t Height) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemsetD2D32_v2' in found_functions}} - -cdef CUresult cuMemsetD2D32(CUdeviceptr dstDevice, size_t dstPitch, unsigned int ui, size_t Width, size_t Height) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemsetD8Async' in found_functions}} - -cdef CUresult cuMemsetD8Async(CUdeviceptr dstDevice, unsigned char uc, size_t N, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemsetD16Async' in found_functions}} - -cdef CUresult cuMemsetD16Async(CUdeviceptr dstDevice, unsigned short us, size_t N, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemsetD32Async' in found_functions}} - -cdef CUresult cuMemsetD32Async(CUdeviceptr dstDevice, unsigned int ui, size_t N, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemsetD2D8Async' in found_functions}} - -cdef CUresult cuMemsetD2D8Async(CUdeviceptr dstDevice, size_t dstPitch, unsigned char uc, size_t Width, size_t Height, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemsetD2D16Async' in found_functions}} - -cdef CUresult cuMemsetD2D16Async(CUdeviceptr dstDevice, size_t dstPitch, unsigned short us, size_t Width, size_t Height, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemsetD2D32Async' in found_functions}} - -cdef CUresult cuMemsetD2D32Async(CUdeviceptr dstDevice, size_t dstPitch, unsigned int ui, size_t Width, size_t Height, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuArrayCreate_v2' in found_functions}} - -cdef CUresult cuArrayCreate(CUarray* pHandle, const CUDA_ARRAY_DESCRIPTOR* pAllocateArray) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuArrayGetDescriptor_v2' in found_functions}} - -cdef CUresult cuArrayGetDescriptor(CUDA_ARRAY_DESCRIPTOR* pArrayDescriptor, CUarray hArray) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuArrayGetSparseProperties' in found_functions}} - -cdef CUresult cuArrayGetSparseProperties(CUDA_ARRAY_SPARSE_PROPERTIES* sparseProperties, CUarray array) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMipmappedArrayGetSparseProperties' in found_functions}} - -cdef CUresult cuMipmappedArrayGetSparseProperties(CUDA_ARRAY_SPARSE_PROPERTIES* sparseProperties, CUmipmappedArray mipmap) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuArrayGetMemoryRequirements' in found_functions}} - -cdef CUresult cuArrayGetMemoryRequirements(CUDA_ARRAY_MEMORY_REQUIREMENTS* memoryRequirements, CUarray array, CUdevice device) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMipmappedArrayGetMemoryRequirements' in found_functions}} - -cdef CUresult cuMipmappedArrayGetMemoryRequirements(CUDA_ARRAY_MEMORY_REQUIREMENTS* memoryRequirements, CUmipmappedArray mipmap, CUdevice device) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuArrayGetPlane' in found_functions}} - -cdef CUresult cuArrayGetPlane(CUarray* pPlaneArray, CUarray hArray, unsigned int planeIdx) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuArrayDestroy' in found_functions}} - -cdef CUresult cuArrayDestroy(CUarray hArray) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuArray3DCreate_v2' in found_functions}} - -cdef CUresult cuArray3DCreate(CUarray* pHandle, const CUDA_ARRAY3D_DESCRIPTOR* pAllocateArray) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuArray3DGetDescriptor_v2' in found_functions}} - -cdef CUresult cuArray3DGetDescriptor(CUDA_ARRAY3D_DESCRIPTOR* pArrayDescriptor, CUarray hArray) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMipmappedArrayCreate' in found_functions}} - -cdef CUresult cuMipmappedArrayCreate(CUmipmappedArray* pHandle, const CUDA_ARRAY3D_DESCRIPTOR* pMipmappedArrayDesc, unsigned int numMipmapLevels) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMipmappedArrayGetLevel' in found_functions}} - -cdef CUresult cuMipmappedArrayGetLevel(CUarray* pLevelArray, CUmipmappedArray hMipmappedArray, unsigned int level) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMipmappedArrayDestroy' in found_functions}} - -cdef CUresult cuMipmappedArrayDestroy(CUmipmappedArray hMipmappedArray) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemGetHandleForAddressRange' in found_functions}} - -cdef CUresult cuMemGetHandleForAddressRange(void* handle, CUdeviceptr dptr, size_t size, CUmemRangeHandleType handleType, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemAddressReserve' in found_functions}} - -cdef CUresult cuMemAddressReserve(CUdeviceptr* ptr, size_t size, size_t alignment, CUdeviceptr addr, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemAddressFree' in found_functions}} - -cdef CUresult cuMemAddressFree(CUdeviceptr ptr, size_t size) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemCreate' in found_functions}} - -cdef CUresult cuMemCreate(CUmemGenericAllocationHandle* handle, size_t size, const CUmemAllocationProp* prop, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemRelease' in found_functions}} - -cdef CUresult cuMemRelease(CUmemGenericAllocationHandle handle) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemMap' in found_functions}} - -cdef CUresult cuMemMap(CUdeviceptr ptr, size_t size, size_t offset, CUmemGenericAllocationHandle handle, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemMapArrayAsync' in found_functions}} - -cdef CUresult cuMemMapArrayAsync(CUarrayMapInfo* mapInfoList, unsigned int count, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemUnmap' in found_functions}} - -cdef CUresult cuMemUnmap(CUdeviceptr ptr, size_t size) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemSetAccess' in found_functions}} - -cdef CUresult cuMemSetAccess(CUdeviceptr ptr, size_t size, const CUmemAccessDesc* desc, size_t count) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemGetAccess' in found_functions}} - -cdef CUresult cuMemGetAccess(unsigned long long* flags, const CUmemLocation* location, CUdeviceptr ptr) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemExportToShareableHandle' in found_functions}} - -cdef CUresult cuMemExportToShareableHandle(void* shareableHandle, CUmemGenericAllocationHandle handle, CUmemAllocationHandleType handleType, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemImportFromShareableHandle' in found_functions}} - -cdef CUresult cuMemImportFromShareableHandle(CUmemGenericAllocationHandle* handle, void* osHandle, CUmemAllocationHandleType shHandleType) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemGetAllocationGranularity' in found_functions}} - -cdef CUresult cuMemGetAllocationGranularity(size_t* granularity, const CUmemAllocationProp* prop, CUmemAllocationGranularity_flags option) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemGetAllocationPropertiesFromHandle' in found_functions}} - -cdef CUresult cuMemGetAllocationPropertiesFromHandle(CUmemAllocationProp* prop, CUmemGenericAllocationHandle handle) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemRetainAllocationHandle' in found_functions}} - -cdef CUresult cuMemRetainAllocationHandle(CUmemGenericAllocationHandle* handle, void* addr) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemFreeAsync' in found_functions}} - -cdef CUresult cuMemFreeAsync(CUdeviceptr dptr, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemAllocAsync' in found_functions}} - -cdef CUresult cuMemAllocAsync(CUdeviceptr* dptr, size_t bytesize, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemPoolTrimTo' in found_functions}} - -cdef CUresult cuMemPoolTrimTo(CUmemoryPool pool, size_t minBytesToKeep) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemPoolSetAttribute' in found_functions}} - -cdef CUresult cuMemPoolSetAttribute(CUmemoryPool pool, CUmemPool_attribute attr, void* value) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemPoolGetAttribute' in found_functions}} - -cdef CUresult cuMemPoolGetAttribute(CUmemoryPool pool, CUmemPool_attribute attr, void* value) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemPoolSetAccess' in found_functions}} - -cdef CUresult cuMemPoolSetAccess(CUmemoryPool pool, const CUmemAccessDesc* map, size_t count) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemPoolGetAccess' in found_functions}} - -cdef CUresult cuMemPoolGetAccess(CUmemAccess_flags* flags, CUmemoryPool memPool, CUmemLocation* location) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemPoolCreate' in found_functions}} - -cdef CUresult cuMemPoolCreate(CUmemoryPool* pool, const CUmemPoolProps* poolProps) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemPoolDestroy' in found_functions}} - -cdef CUresult cuMemPoolDestroy(CUmemoryPool pool) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemAllocFromPoolAsync' in found_functions}} - -cdef CUresult cuMemAllocFromPoolAsync(CUdeviceptr* dptr, size_t bytesize, CUmemoryPool pool, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemPoolExportToShareableHandle' in found_functions}} - -cdef CUresult cuMemPoolExportToShareableHandle(void* handle_out, CUmemoryPool pool, CUmemAllocationHandleType handleType, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemPoolImportFromShareableHandle' in found_functions}} - -cdef CUresult cuMemPoolImportFromShareableHandle(CUmemoryPool* pool_out, void* handle, CUmemAllocationHandleType handleType, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemPoolExportPointer' in found_functions}} - -cdef CUresult cuMemPoolExportPointer(CUmemPoolPtrExportData* shareData_out, CUdeviceptr ptr) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemPoolImportPointer' in found_functions}} - -cdef CUresult cuMemPoolImportPointer(CUdeviceptr* ptr_out, CUmemoryPool pool, CUmemPoolPtrExportData* shareData) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMulticastCreate' in found_functions}} - -cdef CUresult cuMulticastCreate(CUmemGenericAllocationHandle* mcHandle, const CUmulticastObjectProp* prop) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMulticastAddDevice' in found_functions}} - -cdef CUresult cuMulticastAddDevice(CUmemGenericAllocationHandle mcHandle, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMulticastBindMem' in found_functions}} - -cdef CUresult cuMulticastBindMem(CUmemGenericAllocationHandle mcHandle, size_t mcOffset, CUmemGenericAllocationHandle memHandle, size_t memOffset, size_t size, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMulticastBindAddr' in found_functions}} - -cdef CUresult cuMulticastBindAddr(CUmemGenericAllocationHandle mcHandle, size_t mcOffset, CUdeviceptr memptr, size_t size, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMulticastUnbind' in found_functions}} - -cdef CUresult cuMulticastUnbind(CUmemGenericAllocationHandle mcHandle, CUdevice dev, size_t mcOffset, size_t size) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMulticastGetGranularity' in found_functions}} - -cdef CUresult cuMulticastGetGranularity(size_t* granularity, const CUmulticastObjectProp* prop, CUmulticastGranularity_flags option) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuPointerGetAttribute' in found_functions}} - -cdef CUresult cuPointerGetAttribute(void* data, CUpointer_attribute attribute, CUdeviceptr ptr) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemPrefetchAsync' in found_functions}} - -cdef CUresult cuMemPrefetchAsync(CUdeviceptr devPtr, size_t count, CUdevice dstDevice, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemPrefetchAsync_v2' in found_functions}} - -cdef CUresult cuMemPrefetchAsync_v2(CUdeviceptr devPtr, size_t count, CUmemLocation location, unsigned int flags, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemAdvise' in found_functions}} - -cdef CUresult cuMemAdvise(CUdeviceptr devPtr, size_t count, CUmem_advise advice, CUdevice device) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemAdvise_v2' in found_functions}} - -cdef CUresult cuMemAdvise_v2(CUdeviceptr devPtr, size_t count, CUmem_advise advice, CUmemLocation location) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemRangeGetAttribute' in found_functions}} - -cdef CUresult cuMemRangeGetAttribute(void* data, size_t dataSize, CUmem_range_attribute attribute, CUdeviceptr devPtr, size_t count) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemRangeGetAttributes' in found_functions}} - -cdef CUresult cuMemRangeGetAttributes(void** data, size_t* dataSizes, CUmem_range_attribute* attributes, size_t numAttributes, CUdeviceptr devPtr, size_t count) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuPointerSetAttribute' in found_functions}} - -cdef CUresult cuPointerSetAttribute(const void* value, CUpointer_attribute attribute, CUdeviceptr ptr) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuPointerGetAttributes' in found_functions}} - -cdef CUresult cuPointerGetAttributes(unsigned int numAttributes, CUpointer_attribute* attributes, void** data, CUdeviceptr ptr) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamCreate' in found_functions}} - -cdef CUresult cuStreamCreate(CUstream* phStream, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamCreateWithPriority' in found_functions}} - -cdef CUresult cuStreamCreateWithPriority(CUstream* phStream, unsigned int flags, int priority) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamGetPriority' in found_functions}} - -cdef CUresult cuStreamGetPriority(CUstream hStream, int* priority) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamGetFlags' in found_functions}} - -cdef CUresult cuStreamGetFlags(CUstream hStream, unsigned int* flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamGetId' in found_functions}} - -cdef CUresult cuStreamGetId(CUstream hStream, unsigned long long* streamId) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamGetCtx' in found_functions}} - -cdef CUresult cuStreamGetCtx(CUstream hStream, CUcontext* pctx) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamGetCtx_v2' in found_functions}} - -cdef CUresult cuStreamGetCtx_v2(CUstream hStream, CUcontext* pCtx, CUgreenCtx* pGreenCtx) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamWaitEvent' in found_functions}} - -cdef CUresult cuStreamWaitEvent(CUstream hStream, CUevent hEvent, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamAddCallback' in found_functions}} - -cdef CUresult cuStreamAddCallback(CUstream hStream, CUstreamCallback callback, void* userData, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamBeginCapture_v2' in found_functions}} - -cdef CUresult cuStreamBeginCapture(CUstream hStream, CUstreamCaptureMode mode) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamBeginCaptureToGraph' in found_functions}} - -cdef CUresult cuStreamBeginCaptureToGraph(CUstream hStream, CUgraph hGraph, const CUgraphNode* dependencies, const CUgraphEdgeData* dependencyData, size_t numDependencies, CUstreamCaptureMode mode) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuThreadExchangeStreamCaptureMode' in found_functions}} - -cdef CUresult cuThreadExchangeStreamCaptureMode(CUstreamCaptureMode* mode) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamEndCapture' in found_functions}} - -cdef CUresult cuStreamEndCapture(CUstream hStream, CUgraph* phGraph) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamIsCapturing' in found_functions}} - -cdef CUresult cuStreamIsCapturing(CUstream hStream, CUstreamCaptureStatus* captureStatus) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamGetCaptureInfo_v2' in found_functions}} - -cdef CUresult cuStreamGetCaptureInfo(CUstream hStream, CUstreamCaptureStatus* captureStatus_out, cuuint64_t* id_out, CUgraph* graph_out, const CUgraphNode** dependencies_out, size_t* numDependencies_out) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamGetCaptureInfo_v3' in found_functions}} - -cdef CUresult cuStreamGetCaptureInfo_v3(CUstream hStream, CUstreamCaptureStatus* captureStatus_out, cuuint64_t* id_out, CUgraph* graph_out, const CUgraphNode** dependencies_out, const CUgraphEdgeData** edgeData_out, size_t* numDependencies_out) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamUpdateCaptureDependencies' in found_functions}} - -cdef CUresult cuStreamUpdateCaptureDependencies(CUstream hStream, CUgraphNode* dependencies, size_t numDependencies, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamUpdateCaptureDependencies_v2' in found_functions}} - -cdef CUresult cuStreamUpdateCaptureDependencies_v2(CUstream hStream, CUgraphNode* dependencies, const CUgraphEdgeData* dependencyData, size_t numDependencies, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamAttachMemAsync' in found_functions}} - -cdef CUresult cuStreamAttachMemAsync(CUstream hStream, CUdeviceptr dptr, size_t length, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamQuery' in found_functions}} - -cdef CUresult cuStreamQuery(CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamSynchronize' in found_functions}} - -cdef CUresult cuStreamSynchronize(CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamDestroy_v2' in found_functions}} - -cdef CUresult cuStreamDestroy(CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamCopyAttributes' in found_functions}} - -cdef CUresult cuStreamCopyAttributes(CUstream dst, CUstream src) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamGetAttribute' in found_functions}} - -cdef CUresult cuStreamGetAttribute(CUstream hStream, CUstreamAttrID attr, CUstreamAttrValue* value_out) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamSetAttribute' in found_functions}} - -cdef CUresult cuStreamSetAttribute(CUstream hStream, CUstreamAttrID attr, const CUstreamAttrValue* value) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuEventCreate' in found_functions}} - -cdef CUresult cuEventCreate(CUevent* phEvent, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuEventRecord' in found_functions}} - -cdef CUresult cuEventRecord(CUevent hEvent, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuEventRecordWithFlags' in found_functions}} - -cdef CUresult cuEventRecordWithFlags(CUevent hEvent, CUstream hStream, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuEventQuery' in found_functions}} - -cdef CUresult cuEventQuery(CUevent hEvent) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuEventSynchronize' in found_functions}} - -cdef CUresult cuEventSynchronize(CUevent hEvent) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuEventDestroy_v2' in found_functions}} - -cdef CUresult cuEventDestroy(CUevent hEvent) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuEventElapsedTime' in found_functions}} - -cdef CUresult cuEventElapsedTime(float* pMilliseconds, CUevent hStart, CUevent hEnd) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuImportExternalMemory' in found_functions}} - -cdef CUresult cuImportExternalMemory(CUexternalMemory* extMem_out, const CUDA_EXTERNAL_MEMORY_HANDLE_DESC* memHandleDesc) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuExternalMemoryGetMappedBuffer' in found_functions}} - -cdef CUresult cuExternalMemoryGetMappedBuffer(CUdeviceptr* devPtr, CUexternalMemory extMem, const CUDA_EXTERNAL_MEMORY_BUFFER_DESC* bufferDesc) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuExternalMemoryGetMappedMipmappedArray' in found_functions}} - -cdef CUresult cuExternalMemoryGetMappedMipmappedArray(CUmipmappedArray* mipmap, CUexternalMemory extMem, const CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC* mipmapDesc) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDestroyExternalMemory' in found_functions}} - -cdef CUresult cuDestroyExternalMemory(CUexternalMemory extMem) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuImportExternalSemaphore' in found_functions}} - -cdef CUresult cuImportExternalSemaphore(CUexternalSemaphore* extSem_out, const CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC* semHandleDesc) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuSignalExternalSemaphoresAsync' in found_functions}} - -cdef CUresult cuSignalExternalSemaphoresAsync(const CUexternalSemaphore* extSemArray, const CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS* paramsArray, unsigned int numExtSems, CUstream stream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuWaitExternalSemaphoresAsync' in found_functions}} - -cdef CUresult cuWaitExternalSemaphoresAsync(const CUexternalSemaphore* extSemArray, const CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS* paramsArray, unsigned int numExtSems, CUstream stream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDestroyExternalSemaphore' in found_functions}} - -cdef CUresult cuDestroyExternalSemaphore(CUexternalSemaphore extSem) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamWaitValue32_v2' in found_functions}} - -cdef CUresult cuStreamWaitValue32(CUstream stream, CUdeviceptr addr, cuuint32_t value, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamWaitValue64_v2' in found_functions}} - -cdef CUresult cuStreamWaitValue64(CUstream stream, CUdeviceptr addr, cuuint64_t value, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamWriteValue32_v2' in found_functions}} - -cdef CUresult cuStreamWriteValue32(CUstream stream, CUdeviceptr addr, cuuint32_t value, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamWriteValue64_v2' in found_functions}} - -cdef CUresult cuStreamWriteValue64(CUstream stream, CUdeviceptr addr, cuuint64_t value, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamBatchMemOp_v2' in found_functions}} - -cdef CUresult cuStreamBatchMemOp(CUstream stream, unsigned int count, CUstreamBatchMemOpParams* paramArray, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuFuncGetAttribute' in found_functions}} - -cdef CUresult cuFuncGetAttribute(int* pi, CUfunction_attribute attrib, CUfunction hfunc) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuFuncSetAttribute' in found_functions}} - -cdef CUresult cuFuncSetAttribute(CUfunction hfunc, CUfunction_attribute attrib, int value) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuFuncSetCacheConfig' in found_functions}} - -cdef CUresult cuFuncSetCacheConfig(CUfunction hfunc, CUfunc_cache config) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuFuncGetModule' in found_functions}} - -cdef CUresult cuFuncGetModule(CUmodule* hmod, CUfunction hfunc) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuFuncGetName' in found_functions}} - -cdef CUresult cuFuncGetName(const char** name, CUfunction hfunc) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuFuncGetParamInfo' in found_functions}} - -cdef CUresult cuFuncGetParamInfo(CUfunction func, size_t paramIndex, size_t* paramOffset, size_t* paramSize) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuFuncIsLoaded' in found_functions}} - -cdef CUresult cuFuncIsLoaded(CUfunctionLoadingState* state, CUfunction function) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuFuncLoad' in found_functions}} - -cdef CUresult cuFuncLoad(CUfunction function) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuLaunchKernel' in found_functions}} - -cdef CUresult cuLaunchKernel(CUfunction f, unsigned int gridDimX, unsigned int gridDimY, unsigned int gridDimZ, unsigned int blockDimX, unsigned int blockDimY, unsigned int blockDimZ, unsigned int sharedMemBytes, CUstream hStream, void** kernelParams, void** extra) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuLaunchKernelEx' in found_functions}} - -cdef CUresult cuLaunchKernelEx(const CUlaunchConfig* config, CUfunction f, void** kernelParams, void** extra) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuLaunchCooperativeKernel' in found_functions}} - -cdef CUresult cuLaunchCooperativeKernel(CUfunction f, unsigned int gridDimX, unsigned int gridDimY, unsigned int gridDimZ, unsigned int blockDimX, unsigned int blockDimY, unsigned int blockDimZ, unsigned int sharedMemBytes, CUstream hStream, void** kernelParams) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuLaunchCooperativeKernelMultiDevice' in found_functions}} - -cdef CUresult cuLaunchCooperativeKernelMultiDevice(CUDA_LAUNCH_PARAMS* launchParamsList, unsigned int numDevices, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuLaunchHostFunc' in found_functions}} - -cdef CUresult cuLaunchHostFunc(CUstream hStream, CUhostFn fn, void* userData) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuFuncSetBlockShape' in found_functions}} - -cdef CUresult cuFuncSetBlockShape(CUfunction hfunc, int x, int y, int z) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuFuncSetSharedSize' in found_functions}} - -cdef CUresult cuFuncSetSharedSize(CUfunction hfunc, unsigned int numbytes) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuParamSetSize' in found_functions}} - -cdef CUresult cuParamSetSize(CUfunction hfunc, unsigned int numbytes) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuParamSeti' in found_functions}} - -cdef CUresult cuParamSeti(CUfunction hfunc, int offset, unsigned int value) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuParamSetf' in found_functions}} - -cdef CUresult cuParamSetf(CUfunction hfunc, int offset, float value) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuParamSetv' in found_functions}} - -cdef CUresult cuParamSetv(CUfunction hfunc, int offset, void* ptr, unsigned int numbytes) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuLaunch' in found_functions}} - -cdef CUresult cuLaunch(CUfunction f) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuLaunchGrid' in found_functions}} - -cdef CUresult cuLaunchGrid(CUfunction f, int grid_width, int grid_height) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuLaunchGridAsync' in found_functions}} - -cdef CUresult cuLaunchGridAsync(CUfunction f, int grid_width, int grid_height, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuParamSetTexRef' in found_functions}} - -cdef CUresult cuParamSetTexRef(CUfunction hfunc, int texunit, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuFuncSetSharedMemConfig' in found_functions}} - -cdef CUresult cuFuncSetSharedMemConfig(CUfunction hfunc, CUsharedconfig config) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphCreate' in found_functions}} - -cdef CUresult cuGraphCreate(CUgraph* phGraph, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphAddKernelNode_v2' in found_functions}} - -cdef CUresult cuGraphAddKernelNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, const CUDA_KERNEL_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphKernelNodeGetParams_v2' in found_functions}} - -cdef CUresult cuGraphKernelNodeGetParams(CUgraphNode hNode, CUDA_KERNEL_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphKernelNodeSetParams_v2' in found_functions}} - -cdef CUresult cuGraphKernelNodeSetParams(CUgraphNode hNode, const CUDA_KERNEL_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphAddMemcpyNode' in found_functions}} - -cdef CUresult cuGraphAddMemcpyNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, const CUDA_MEMCPY3D* copyParams, CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphMemcpyNodeGetParams' in found_functions}} - -cdef CUresult cuGraphMemcpyNodeGetParams(CUgraphNode hNode, CUDA_MEMCPY3D* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphMemcpyNodeSetParams' in found_functions}} - -cdef CUresult cuGraphMemcpyNodeSetParams(CUgraphNode hNode, const CUDA_MEMCPY3D* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphAddMemsetNode' in found_functions}} - -cdef CUresult cuGraphAddMemsetNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, const CUDA_MEMSET_NODE_PARAMS* memsetParams, CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphMemsetNodeGetParams' in found_functions}} - -cdef CUresult cuGraphMemsetNodeGetParams(CUgraphNode hNode, CUDA_MEMSET_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphMemsetNodeSetParams' in found_functions}} - -cdef CUresult cuGraphMemsetNodeSetParams(CUgraphNode hNode, const CUDA_MEMSET_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphAddHostNode' in found_functions}} - -cdef CUresult cuGraphAddHostNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, const CUDA_HOST_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphHostNodeGetParams' in found_functions}} - -cdef CUresult cuGraphHostNodeGetParams(CUgraphNode hNode, CUDA_HOST_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphHostNodeSetParams' in found_functions}} - -cdef CUresult cuGraphHostNodeSetParams(CUgraphNode hNode, const CUDA_HOST_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphAddChildGraphNode' in found_functions}} - -cdef CUresult cuGraphAddChildGraphNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, CUgraph childGraph) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphChildGraphNodeGetGraph' in found_functions}} - -cdef CUresult cuGraphChildGraphNodeGetGraph(CUgraphNode hNode, CUgraph* phGraph) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphAddEmptyNode' in found_functions}} - -cdef CUresult cuGraphAddEmptyNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphAddEventRecordNode' in found_functions}} - -cdef CUresult cuGraphAddEventRecordNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, CUevent event) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphEventRecordNodeGetEvent' in found_functions}} - -cdef CUresult cuGraphEventRecordNodeGetEvent(CUgraphNode hNode, CUevent* event_out) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphEventRecordNodeSetEvent' in found_functions}} - -cdef CUresult cuGraphEventRecordNodeSetEvent(CUgraphNode hNode, CUevent event) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphAddEventWaitNode' in found_functions}} - -cdef CUresult cuGraphAddEventWaitNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, CUevent event) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphEventWaitNodeGetEvent' in found_functions}} - -cdef CUresult cuGraphEventWaitNodeGetEvent(CUgraphNode hNode, CUevent* event_out) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphEventWaitNodeSetEvent' in found_functions}} - -cdef CUresult cuGraphEventWaitNodeSetEvent(CUgraphNode hNode, CUevent event) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphAddExternalSemaphoresSignalNode' in found_functions}} - -cdef CUresult cuGraphAddExternalSemaphoresSignalNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, const CUDA_EXT_SEM_SIGNAL_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphExternalSemaphoresSignalNodeGetParams' in found_functions}} - -cdef CUresult cuGraphExternalSemaphoresSignalNodeGetParams(CUgraphNode hNode, CUDA_EXT_SEM_SIGNAL_NODE_PARAMS* params_out) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphExternalSemaphoresSignalNodeSetParams' in found_functions}} - -cdef CUresult cuGraphExternalSemaphoresSignalNodeSetParams(CUgraphNode hNode, const CUDA_EXT_SEM_SIGNAL_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphAddExternalSemaphoresWaitNode' in found_functions}} - -cdef CUresult cuGraphAddExternalSemaphoresWaitNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, const CUDA_EXT_SEM_WAIT_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphExternalSemaphoresWaitNodeGetParams' in found_functions}} - -cdef CUresult cuGraphExternalSemaphoresWaitNodeGetParams(CUgraphNode hNode, CUDA_EXT_SEM_WAIT_NODE_PARAMS* params_out) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphExternalSemaphoresWaitNodeSetParams' in found_functions}} - -cdef CUresult cuGraphExternalSemaphoresWaitNodeSetParams(CUgraphNode hNode, const CUDA_EXT_SEM_WAIT_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphAddBatchMemOpNode' in found_functions}} - -cdef CUresult cuGraphAddBatchMemOpNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, const CUDA_BATCH_MEM_OP_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphBatchMemOpNodeGetParams' in found_functions}} - -cdef CUresult cuGraphBatchMemOpNodeGetParams(CUgraphNode hNode, CUDA_BATCH_MEM_OP_NODE_PARAMS* nodeParams_out) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphBatchMemOpNodeSetParams' in found_functions}} - -cdef CUresult cuGraphBatchMemOpNodeSetParams(CUgraphNode hNode, const CUDA_BATCH_MEM_OP_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphExecBatchMemOpNodeSetParams' in found_functions}} - -cdef CUresult cuGraphExecBatchMemOpNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_BATCH_MEM_OP_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphAddMemAllocNode' in found_functions}} - -cdef CUresult cuGraphAddMemAllocNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, CUDA_MEM_ALLOC_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphMemAllocNodeGetParams' in found_functions}} - -cdef CUresult cuGraphMemAllocNodeGetParams(CUgraphNode hNode, CUDA_MEM_ALLOC_NODE_PARAMS* params_out) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphAddMemFreeNode' in found_functions}} - -cdef CUresult cuGraphAddMemFreeNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, CUdeviceptr dptr) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphMemFreeNodeGetParams' in found_functions}} - -cdef CUresult cuGraphMemFreeNodeGetParams(CUgraphNode hNode, CUdeviceptr* dptr_out) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDeviceGraphMemTrim' in found_functions}} - -cdef CUresult cuDeviceGraphMemTrim(CUdevice device) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDeviceGetGraphMemAttribute' in found_functions}} - -cdef CUresult cuDeviceGetGraphMemAttribute(CUdevice device, CUgraphMem_attribute attr, void* value) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDeviceSetGraphMemAttribute' in found_functions}} - -cdef CUresult cuDeviceSetGraphMemAttribute(CUdevice device, CUgraphMem_attribute attr, void* value) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphClone' in found_functions}} - -cdef CUresult cuGraphClone(CUgraph* phGraphClone, CUgraph originalGraph) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphNodeFindInClone' in found_functions}} - -cdef CUresult cuGraphNodeFindInClone(CUgraphNode* phNode, CUgraphNode hOriginalNode, CUgraph hClonedGraph) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphNodeGetType' in found_functions}} - -cdef CUresult cuGraphNodeGetType(CUgraphNode hNode, CUgraphNodeType* typename) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphGetNodes' in found_functions}} - -cdef CUresult cuGraphGetNodes(CUgraph hGraph, CUgraphNode* nodes, size_t* numNodes) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphGetRootNodes' in found_functions}} - -cdef CUresult cuGraphGetRootNodes(CUgraph hGraph, CUgraphNode* rootNodes, size_t* numRootNodes) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphGetEdges' in found_functions}} - -cdef CUresult cuGraphGetEdges(CUgraph hGraph, CUgraphNode* from_, CUgraphNode* to, size_t* numEdges) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphGetEdges_v2' in found_functions}} - -cdef CUresult cuGraphGetEdges_v2(CUgraph hGraph, CUgraphNode* from_, CUgraphNode* to, CUgraphEdgeData* edgeData, size_t* numEdges) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphNodeGetDependencies' in found_functions}} - -cdef CUresult cuGraphNodeGetDependencies(CUgraphNode hNode, CUgraphNode* dependencies, size_t* numDependencies) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphNodeGetDependencies_v2' in found_functions}} - -cdef CUresult cuGraphNodeGetDependencies_v2(CUgraphNode hNode, CUgraphNode* dependencies, CUgraphEdgeData* edgeData, size_t* numDependencies) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphNodeGetDependentNodes' in found_functions}} - -cdef CUresult cuGraphNodeGetDependentNodes(CUgraphNode hNode, CUgraphNode* dependentNodes, size_t* numDependentNodes) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphNodeGetDependentNodes_v2' in found_functions}} - -cdef CUresult cuGraphNodeGetDependentNodes_v2(CUgraphNode hNode, CUgraphNode* dependentNodes, CUgraphEdgeData* edgeData, size_t* numDependentNodes) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphAddDependencies' in found_functions}} - -cdef CUresult cuGraphAddDependencies(CUgraph hGraph, const CUgraphNode* from_, const CUgraphNode* to, size_t numDependencies) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphAddDependencies_v2' in found_functions}} - -cdef CUresult cuGraphAddDependencies_v2(CUgraph hGraph, const CUgraphNode* from_, const CUgraphNode* to, const CUgraphEdgeData* edgeData, size_t numDependencies) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphRemoveDependencies' in found_functions}} - -cdef CUresult cuGraphRemoveDependencies(CUgraph hGraph, const CUgraphNode* from_, const CUgraphNode* to, size_t numDependencies) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphRemoveDependencies_v2' in found_functions}} - -cdef CUresult cuGraphRemoveDependencies_v2(CUgraph hGraph, const CUgraphNode* from_, const CUgraphNode* to, const CUgraphEdgeData* edgeData, size_t numDependencies) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphDestroyNode' in found_functions}} - -cdef CUresult cuGraphDestroyNode(CUgraphNode hNode) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphInstantiateWithFlags' in found_functions}} - -cdef CUresult cuGraphInstantiate(CUgraphExec* phGraphExec, CUgraph hGraph, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphInstantiateWithParams' in found_functions}} - -cdef CUresult cuGraphInstantiateWithParams(CUgraphExec* phGraphExec, CUgraph hGraph, CUDA_GRAPH_INSTANTIATE_PARAMS* instantiateParams) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphExecGetFlags' in found_functions}} - -cdef CUresult cuGraphExecGetFlags(CUgraphExec hGraphExec, cuuint64_t* flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphExecKernelNodeSetParams_v2' in found_functions}} - -cdef CUresult cuGraphExecKernelNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_KERNEL_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphExecMemcpyNodeSetParams' in found_functions}} - -cdef CUresult cuGraphExecMemcpyNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_MEMCPY3D* copyParams, CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphExecMemsetNodeSetParams' in found_functions}} - -cdef CUresult cuGraphExecMemsetNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_MEMSET_NODE_PARAMS* memsetParams, CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphExecHostNodeSetParams' in found_functions}} - -cdef CUresult cuGraphExecHostNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_HOST_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphExecChildGraphNodeSetParams' in found_functions}} - -cdef CUresult cuGraphExecChildGraphNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, CUgraph childGraph) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphExecEventRecordNodeSetEvent' in found_functions}} - -cdef CUresult cuGraphExecEventRecordNodeSetEvent(CUgraphExec hGraphExec, CUgraphNode hNode, CUevent event) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphExecEventWaitNodeSetEvent' in found_functions}} - -cdef CUresult cuGraphExecEventWaitNodeSetEvent(CUgraphExec hGraphExec, CUgraphNode hNode, CUevent event) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphExecExternalSemaphoresSignalNodeSetParams' in found_functions}} - -cdef CUresult cuGraphExecExternalSemaphoresSignalNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_EXT_SEM_SIGNAL_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphExecExternalSemaphoresWaitNodeSetParams' in found_functions}} - -cdef CUresult cuGraphExecExternalSemaphoresWaitNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_EXT_SEM_WAIT_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphNodeSetEnabled' in found_functions}} - -cdef CUresult cuGraphNodeSetEnabled(CUgraphExec hGraphExec, CUgraphNode hNode, unsigned int isEnabled) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphNodeGetEnabled' in found_functions}} - -cdef CUresult cuGraphNodeGetEnabled(CUgraphExec hGraphExec, CUgraphNode hNode, unsigned int* isEnabled) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphUpload' in found_functions}} - -cdef CUresult cuGraphUpload(CUgraphExec hGraphExec, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphLaunch' in found_functions}} - -cdef CUresult cuGraphLaunch(CUgraphExec hGraphExec, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphExecDestroy' in found_functions}} - -cdef CUresult cuGraphExecDestroy(CUgraphExec hGraphExec) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphDestroy' in found_functions}} - -cdef CUresult cuGraphDestroy(CUgraph hGraph) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphExecUpdate_v2' in found_functions}} - -cdef CUresult cuGraphExecUpdate(CUgraphExec hGraphExec, CUgraph hGraph, CUgraphExecUpdateResultInfo* resultInfo) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphKernelNodeCopyAttributes' in found_functions}} - -cdef CUresult cuGraphKernelNodeCopyAttributes(CUgraphNode dst, CUgraphNode src) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphKernelNodeGetAttribute' in found_functions}} - -cdef CUresult cuGraphKernelNodeGetAttribute(CUgraphNode hNode, CUkernelNodeAttrID attr, CUkernelNodeAttrValue* value_out) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphKernelNodeSetAttribute' in found_functions}} - -cdef CUresult cuGraphKernelNodeSetAttribute(CUgraphNode hNode, CUkernelNodeAttrID attr, const CUkernelNodeAttrValue* value) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphDebugDotPrint' in found_functions}} - -cdef CUresult cuGraphDebugDotPrint(CUgraph hGraph, const char* path, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuUserObjectCreate' in found_functions}} - -cdef CUresult cuUserObjectCreate(CUuserObject* object_out, void* ptr, CUhostFn destroy, unsigned int initialRefcount, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuUserObjectRetain' in found_functions}} - -cdef CUresult cuUserObjectRetain(CUuserObject object, unsigned int count) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuUserObjectRelease' in found_functions}} - -cdef CUresult cuUserObjectRelease(CUuserObject object, unsigned int count) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphRetainUserObject' in found_functions}} - -cdef CUresult cuGraphRetainUserObject(CUgraph graph, CUuserObject object, unsigned int count, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphReleaseUserObject' in found_functions}} - -cdef CUresult cuGraphReleaseUserObject(CUgraph graph, CUuserObject object, unsigned int count) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphAddNode' in found_functions}} - -cdef CUresult cuGraphAddNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, CUgraphNodeParams* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphAddNode_v2' in found_functions}} - -cdef CUresult cuGraphAddNode_v2(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, const CUgraphEdgeData* dependencyData, size_t numDependencies, CUgraphNodeParams* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphNodeSetParams' in found_functions}} - -cdef CUresult cuGraphNodeSetParams(CUgraphNode hNode, CUgraphNodeParams* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphExecNodeSetParams' in found_functions}} - -cdef CUresult cuGraphExecNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, CUgraphNodeParams* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphConditionalHandleCreate' in found_functions}} - -cdef CUresult cuGraphConditionalHandleCreate(CUgraphConditionalHandle* pHandle_out, CUgraph hGraph, CUcontext ctx, unsigned int defaultLaunchValue, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuOccupancyMaxActiveBlocksPerMultiprocessor' in found_functions}} - -cdef CUresult cuOccupancyMaxActiveBlocksPerMultiprocessor(int* numBlocks, CUfunction func, int blockSize, size_t dynamicSMemSize) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags' in found_functions}} - -cdef CUresult cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(int* numBlocks, CUfunction func, int blockSize, size_t dynamicSMemSize, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuOccupancyMaxPotentialBlockSize' in found_functions}} - -cdef CUresult cuOccupancyMaxPotentialBlockSize(int* minGridSize, int* blockSize, CUfunction func, CUoccupancyB2DSize blockSizeToDynamicSMemSize, size_t dynamicSMemSize, int blockSizeLimit) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuOccupancyMaxPotentialBlockSizeWithFlags' in found_functions}} - -cdef CUresult cuOccupancyMaxPotentialBlockSizeWithFlags(int* minGridSize, int* blockSize, CUfunction func, CUoccupancyB2DSize blockSizeToDynamicSMemSize, size_t dynamicSMemSize, int blockSizeLimit, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuOccupancyAvailableDynamicSMemPerBlock' in found_functions}} - -cdef CUresult cuOccupancyAvailableDynamicSMemPerBlock(size_t* dynamicSmemSize, CUfunction func, int numBlocks, int blockSize) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuOccupancyMaxPotentialClusterSize' in found_functions}} - -cdef CUresult cuOccupancyMaxPotentialClusterSize(int* clusterSize, CUfunction func, const CUlaunchConfig* config) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuOccupancyMaxActiveClusters' in found_functions}} - -cdef CUresult cuOccupancyMaxActiveClusters(int* numClusters, CUfunction func, const CUlaunchConfig* config) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexRefSetArray' in found_functions}} - -cdef CUresult cuTexRefSetArray(CUtexref hTexRef, CUarray hArray, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexRefSetMipmappedArray' in found_functions}} - -cdef CUresult cuTexRefSetMipmappedArray(CUtexref hTexRef, CUmipmappedArray hMipmappedArray, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexRefSetAddress_v2' in found_functions}} - -cdef CUresult cuTexRefSetAddress(size_t* ByteOffset, CUtexref hTexRef, CUdeviceptr dptr, size_t numbytes) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexRefSetAddress2D_v3' in found_functions}} - -cdef CUresult cuTexRefSetAddress2D(CUtexref hTexRef, const CUDA_ARRAY_DESCRIPTOR* desc, CUdeviceptr dptr, size_t Pitch) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexRefSetFormat' in found_functions}} - -cdef CUresult cuTexRefSetFormat(CUtexref hTexRef, CUarray_format fmt, int NumPackedComponents) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexRefSetAddressMode' in found_functions}} - -cdef CUresult cuTexRefSetAddressMode(CUtexref hTexRef, int dim, CUaddress_mode am) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexRefSetFilterMode' in found_functions}} - -cdef CUresult cuTexRefSetFilterMode(CUtexref hTexRef, CUfilter_mode fm) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexRefSetMipmapFilterMode' in found_functions}} - -cdef CUresult cuTexRefSetMipmapFilterMode(CUtexref hTexRef, CUfilter_mode fm) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexRefSetMipmapLevelBias' in found_functions}} - -cdef CUresult cuTexRefSetMipmapLevelBias(CUtexref hTexRef, float bias) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexRefSetMipmapLevelClamp' in found_functions}} - -cdef CUresult cuTexRefSetMipmapLevelClamp(CUtexref hTexRef, float minMipmapLevelClamp, float maxMipmapLevelClamp) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexRefSetMaxAnisotropy' in found_functions}} - -cdef CUresult cuTexRefSetMaxAnisotropy(CUtexref hTexRef, unsigned int maxAniso) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexRefSetBorderColor' in found_functions}} - -cdef CUresult cuTexRefSetBorderColor(CUtexref hTexRef, float* pBorderColor) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexRefSetFlags' in found_functions}} - -cdef CUresult cuTexRefSetFlags(CUtexref hTexRef, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexRefGetAddress_v2' in found_functions}} - -cdef CUresult cuTexRefGetAddress(CUdeviceptr* pdptr, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexRefGetArray' in found_functions}} - -cdef CUresult cuTexRefGetArray(CUarray* phArray, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexRefGetMipmappedArray' in found_functions}} - -cdef CUresult cuTexRefGetMipmappedArray(CUmipmappedArray* phMipmappedArray, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexRefGetAddressMode' in found_functions}} - -cdef CUresult cuTexRefGetAddressMode(CUaddress_mode* pam, CUtexref hTexRef, int dim) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexRefGetFilterMode' in found_functions}} - -cdef CUresult cuTexRefGetFilterMode(CUfilter_mode* pfm, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexRefGetFormat' in found_functions}} - -cdef CUresult cuTexRefGetFormat(CUarray_format* pFormat, int* pNumChannels, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexRefGetMipmapFilterMode' in found_functions}} - -cdef CUresult cuTexRefGetMipmapFilterMode(CUfilter_mode* pfm, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexRefGetMipmapLevelBias' in found_functions}} - -cdef CUresult cuTexRefGetMipmapLevelBias(float* pbias, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexRefGetMipmapLevelClamp' in found_functions}} - -cdef CUresult cuTexRefGetMipmapLevelClamp(float* pminMipmapLevelClamp, float* pmaxMipmapLevelClamp, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexRefGetMaxAnisotropy' in found_functions}} - -cdef CUresult cuTexRefGetMaxAnisotropy(int* pmaxAniso, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexRefGetBorderColor' in found_functions}} - -cdef CUresult cuTexRefGetBorderColor(float* pBorderColor, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexRefGetFlags' in found_functions}} - -cdef CUresult cuTexRefGetFlags(unsigned int* pFlags, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexRefCreate' in found_functions}} - -cdef CUresult cuTexRefCreate(CUtexref* pTexRef) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexRefDestroy' in found_functions}} - -cdef CUresult cuTexRefDestroy(CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuSurfRefSetArray' in found_functions}} - -cdef CUresult cuSurfRefSetArray(CUsurfref hSurfRef, CUarray hArray, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuSurfRefGetArray' in found_functions}} - -cdef CUresult cuSurfRefGetArray(CUarray* phArray, CUsurfref hSurfRef) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexObjectCreate' in found_functions}} - -cdef CUresult cuTexObjectCreate(CUtexObject* pTexObject, const CUDA_RESOURCE_DESC* pResDesc, const CUDA_TEXTURE_DESC* pTexDesc, const CUDA_RESOURCE_VIEW_DESC* pResViewDesc) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexObjectDestroy' in found_functions}} - -cdef CUresult cuTexObjectDestroy(CUtexObject texObject) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexObjectGetResourceDesc' in found_functions}} - -cdef CUresult cuTexObjectGetResourceDesc(CUDA_RESOURCE_DESC* pResDesc, CUtexObject texObject) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexObjectGetTextureDesc' in found_functions}} - -cdef CUresult cuTexObjectGetTextureDesc(CUDA_TEXTURE_DESC* pTexDesc, CUtexObject texObject) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexObjectGetResourceViewDesc' in found_functions}} - -cdef CUresult cuTexObjectGetResourceViewDesc(CUDA_RESOURCE_VIEW_DESC* pResViewDesc, CUtexObject texObject) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuSurfObjectCreate' in found_functions}} - -cdef CUresult cuSurfObjectCreate(CUsurfObject* pSurfObject, const CUDA_RESOURCE_DESC* pResDesc) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuSurfObjectDestroy' in found_functions}} - -cdef CUresult cuSurfObjectDestroy(CUsurfObject surfObject) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuSurfObjectGetResourceDesc' in found_functions}} - -cdef CUresult cuSurfObjectGetResourceDesc(CUDA_RESOURCE_DESC* pResDesc, CUsurfObject surfObject) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTensorMapEncodeTiled' in found_functions}} - -cdef CUresult cuTensorMapEncodeTiled(CUtensorMap* tensorMap, CUtensorMapDataType tensorDataType, cuuint32_t tensorRank, void* globalAddress, const cuuint64_t* globalDim, const cuuint64_t* globalStrides, const cuuint32_t* boxDim, const cuuint32_t* elementStrides, CUtensorMapInterleave interleave, CUtensorMapSwizzle swizzle, CUtensorMapL2promotion l2Promotion, CUtensorMapFloatOOBfill oobFill) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTensorMapEncodeIm2col' in found_functions}} - -cdef CUresult cuTensorMapEncodeIm2col(CUtensorMap* tensorMap, CUtensorMapDataType tensorDataType, cuuint32_t tensorRank, void* globalAddress, const cuuint64_t* globalDim, const cuuint64_t* globalStrides, const int* pixelBoxLowerCorner, const int* pixelBoxUpperCorner, cuuint32_t channelsPerPixel, cuuint32_t pixelsPerColumn, const cuuint32_t* elementStrides, CUtensorMapInterleave interleave, CUtensorMapSwizzle swizzle, CUtensorMapL2promotion l2Promotion, CUtensorMapFloatOOBfill oobFill) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTensorMapReplaceAddress' in found_functions}} - -cdef CUresult cuTensorMapReplaceAddress(CUtensorMap* tensorMap, void* globalAddress) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDeviceCanAccessPeer' in found_functions}} - -cdef CUresult cuDeviceCanAccessPeer(int* canAccessPeer, CUdevice dev, CUdevice peerDev) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxEnablePeerAccess' in found_functions}} - -cdef CUresult cuCtxEnablePeerAccess(CUcontext peerContext, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxDisablePeerAccess' in found_functions}} - -cdef CUresult cuCtxDisablePeerAccess(CUcontext peerContext) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDeviceGetP2PAttribute' in found_functions}} - -cdef CUresult cuDeviceGetP2PAttribute(int* value, CUdevice_P2PAttribute attrib, CUdevice srcDevice, CUdevice dstDevice) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphicsUnregisterResource' in found_functions}} - -cdef CUresult cuGraphicsUnregisterResource(CUgraphicsResource resource) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphicsSubResourceGetMappedArray' in found_functions}} - -cdef CUresult cuGraphicsSubResourceGetMappedArray(CUarray* pArray, CUgraphicsResource resource, unsigned int arrayIndex, unsigned int mipLevel) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphicsResourceGetMappedMipmappedArray' in found_functions}} - -cdef CUresult cuGraphicsResourceGetMappedMipmappedArray(CUmipmappedArray* pMipmappedArray, CUgraphicsResource resource) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphicsResourceGetMappedPointer_v2' in found_functions}} - -cdef CUresult cuGraphicsResourceGetMappedPointer(CUdeviceptr* pDevPtr, size_t* pSize, CUgraphicsResource resource) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphicsResourceSetMapFlags_v2' in found_functions}} - -cdef CUresult cuGraphicsResourceSetMapFlags(CUgraphicsResource resource, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphicsMapResources' in found_functions}} - -cdef CUresult cuGraphicsMapResources(unsigned int count, CUgraphicsResource* resources, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphicsUnmapResources' in found_functions}} - -cdef CUresult cuGraphicsUnmapResources(unsigned int count, CUgraphicsResource* resources, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGetProcAddress_v2' in found_functions}} - -cdef CUresult cuGetProcAddress(const char* symbol, void** pfn, int cudaVersion, cuuint64_t flags, CUdriverProcAddressQueryResult* symbolStatus) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCoredumpGetAttribute' in found_functions}} - -cdef CUresult cuCoredumpGetAttribute(CUcoredumpSettings attrib, void* value, size_t* size) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCoredumpGetAttributeGlobal' in found_functions}} - -cdef CUresult cuCoredumpGetAttributeGlobal(CUcoredumpSettings attrib, void* value, size_t* size) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCoredumpSetAttribute' in found_functions}} - -cdef CUresult cuCoredumpSetAttribute(CUcoredumpSettings attrib, void* value, size_t* size) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCoredumpSetAttributeGlobal' in found_functions}} - -cdef CUresult cuCoredumpSetAttributeGlobal(CUcoredumpSettings attrib, void* value, size_t* size) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGetExportTable' in found_functions}} - -cdef CUresult cuGetExportTable(const void** ppExportTable, const CUuuid* pExportTableId) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGreenCtxCreate' in found_functions}} - -cdef CUresult cuGreenCtxCreate(CUgreenCtx* phCtx, CUdevResourceDesc desc, CUdevice dev, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGreenCtxDestroy' in found_functions}} - -cdef CUresult cuGreenCtxDestroy(CUgreenCtx hCtx) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxFromGreenCtx' in found_functions}} - -cdef CUresult cuCtxFromGreenCtx(CUcontext* pContext, CUgreenCtx hCtx) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDeviceGetDevResource' in found_functions}} - -cdef CUresult cuDeviceGetDevResource(CUdevice device, CUdevResource* resource, CUdevResourceType typename) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxGetDevResource' in found_functions}} - -cdef CUresult cuCtxGetDevResource(CUcontext hCtx, CUdevResource* resource, CUdevResourceType typename) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGreenCtxGetDevResource' in found_functions}} - -cdef CUresult cuGreenCtxGetDevResource(CUgreenCtx hCtx, CUdevResource* resource, CUdevResourceType typename) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDevSmResourceSplitByCount' in found_functions}} - -cdef CUresult cuDevSmResourceSplitByCount(CUdevResource* result, unsigned int* nbGroups, const CUdevResource* input, CUdevResource* remaining, unsigned int useFlags, unsigned int minCount) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDevResourceGenerateDesc' in found_functions}} - -cdef CUresult cuDevResourceGenerateDesc(CUdevResourceDesc* phDesc, CUdevResource* resources, unsigned int nbResources) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGreenCtxRecordEvent' in found_functions}} - -cdef CUresult cuGreenCtxRecordEvent(CUgreenCtx hCtx, CUevent hEvent) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGreenCtxWaitEvent' in found_functions}} - -cdef CUresult cuGreenCtxWaitEvent(CUgreenCtx hCtx, CUevent hEvent) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamGetGreenCtx' in found_functions}} - -cdef CUresult cuStreamGetGreenCtx(CUstream hStream, CUgreenCtx* phCtx) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGreenCtxStreamCreate' in found_functions}} - -cdef CUresult cuGreenCtxStreamCreate(CUstream* phStream, CUgreenCtx greenCtx, unsigned int flags, int priority) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuProfilerStart' in found_functions}} - -cdef CUresult cuProfilerStart() except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuProfilerStop' in found_functions}} - -cdef CUresult cuProfilerStop() except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if True}} - -cdef CUresult cuGraphicsEGLRegisterImage(CUgraphicsResource* pCudaResource, EGLImageKHR image, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if True}} - -cdef CUresult cuEGLStreamConsumerConnect(CUeglStreamConnection* conn, EGLStreamKHR stream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if True}} - -cdef CUresult cuEGLStreamConsumerConnectWithFlags(CUeglStreamConnection* conn, EGLStreamKHR stream, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if True}} - -cdef CUresult cuEGLStreamConsumerDisconnect(CUeglStreamConnection* conn) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if True}} - -cdef CUresult cuEGLStreamConsumerAcquireFrame(CUeglStreamConnection* conn, CUgraphicsResource* pCudaResource, CUstream* pStream, unsigned int timeout) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if True}} - -cdef CUresult cuEGLStreamConsumerReleaseFrame(CUeglStreamConnection* conn, CUgraphicsResource pCudaResource, CUstream* pStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if True}} - -cdef CUresult cuEGLStreamProducerConnect(CUeglStreamConnection* conn, EGLStreamKHR stream, EGLint width, EGLint height) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if True}} - -cdef CUresult cuEGLStreamProducerDisconnect(CUeglStreamConnection* conn) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if True}} - -cdef CUresult cuEGLStreamProducerPresentFrame(CUeglStreamConnection* conn, CUeglFrame eglframe, CUstream* pStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if True}} - -cdef CUresult cuEGLStreamProducerReturnFrame(CUeglStreamConnection* conn, CUeglFrame* eglframe, CUstream* pStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if True}} - -cdef CUresult cuGraphicsResourceGetMappedEglFrame(CUeglFrame* eglFrame, CUgraphicsResource resource, unsigned int index, unsigned int mipLevel) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if True}} - -cdef CUresult cuEventCreateFromEGLSync(CUevent* phEvent, EGLSyncKHR eglSync, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if True}} - -cdef CUresult cuGraphicsGLRegisterBuffer(CUgraphicsResource* pCudaResource, GLuint buffer, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if True}} - -cdef CUresult cuGraphicsGLRegisterImage(CUgraphicsResource* pCudaResource, GLuint image, GLenum target, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if True}} - -cdef CUresult cuGLGetDevices(unsigned int* pCudaDeviceCount, CUdevice* pCudaDevices, unsigned int cudaDeviceCount, CUGLDeviceList deviceList) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if True}} - -cdef CUresult cuVDPAUGetDevice(CUdevice* pDevice, VdpDevice vdpDevice, VdpGetProcAddress* vdpGetProcAddress) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if True}} - -cdef CUresult cuVDPAUCtxCreate(CUcontext* pCtx, unsigned int flags, CUdevice device, VdpDevice vdpDevice, VdpGetProcAddress* vdpGetProcAddress) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if True}} - -cdef CUresult cuGraphicsVDPAURegisterVideoSurface(CUgraphicsResource* pCudaResource, VdpVideoSurface vdpSurface, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if True}} - -cdef CUresult cuGraphicsVDPAURegisterOutputSurface(CUgraphicsResource* pCudaResource, VdpOutputSurface vdpSurface, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -cdef enum: CUDA_VERSION = 12050 - -cdef enum: CU_IPC_HANDLE_SIZE = 64 - -cdef enum: CU_STREAM_LEGACY = 1 - -cdef enum: CU_STREAM_PER_THREAD = 2 - -cdef enum: CU_COMPUTE_ACCELERATED_TARGET_BASE = 65536 - -cdef enum: CU_GRAPH_COND_ASSIGN_DEFAULT = 1 - -cdef enum: CU_GRAPH_KERNEL_NODE_PORT_DEFAULT = 0 - -cdef enum: CU_GRAPH_KERNEL_NODE_PORT_PROGRAMMATIC = 1 - -cdef enum: CU_GRAPH_KERNEL_NODE_PORT_LAUNCH_ORDER = 2 - -cdef enum: CU_KERNEL_NODE_ATTRIBUTE_ACCESS_POLICY_WINDOW = 1 - -cdef enum: CU_KERNEL_NODE_ATTRIBUTE_COOPERATIVE = 2 - -cdef enum: CU_KERNEL_NODE_ATTRIBUTE_CLUSTER_DIMENSION = 4 - -cdef enum: CU_KERNEL_NODE_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE = 5 - -cdef enum: CU_KERNEL_NODE_ATTRIBUTE_PRIORITY = 8 - -cdef enum: CU_KERNEL_NODE_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP = 9 - -cdef enum: CU_KERNEL_NODE_ATTRIBUTE_MEM_SYNC_DOMAIN = 10 - -cdef enum: CU_KERNEL_NODE_ATTRIBUTE_DEVICE_UPDATABLE_KERNEL_NODE = 13 - -cdef enum: CU_KERNEL_NODE_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT = 14 - -cdef enum: CU_STREAM_ATTRIBUTE_ACCESS_POLICY_WINDOW = 1 - -cdef enum: CU_STREAM_ATTRIBUTE_SYNCHRONIZATION_POLICY = 3 - -cdef enum: CU_STREAM_ATTRIBUTE_PRIORITY = 8 - -cdef enum: CU_STREAM_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP = 9 - -cdef enum: CU_STREAM_ATTRIBUTE_MEM_SYNC_DOMAIN = 10 - -cdef enum: CU_MEMHOSTALLOC_PORTABLE = 1 - -cdef enum: CU_MEMHOSTALLOC_DEVICEMAP = 2 - -cdef enum: CU_MEMHOSTALLOC_WRITECOMBINED = 4 - -cdef enum: CU_MEMHOSTREGISTER_PORTABLE = 1 - -cdef enum: CU_MEMHOSTREGISTER_DEVICEMAP = 2 - -cdef enum: CU_MEMHOSTREGISTER_IOMEMORY = 4 - -cdef enum: CU_MEMHOSTREGISTER_READ_ONLY = 8 - -cdef enum: CU_ARRAY_SPARSE_PROPERTIES_SINGLE_MIPTAIL = 1 - -cdef enum: CU_TENSOR_MAP_NUM_QWORDS = 16 - -cdef enum: CUDA_EXTERNAL_MEMORY_DEDICATED = 1 - -cdef enum: CUDA_EXTERNAL_SEMAPHORE_SIGNAL_SKIP_NVSCIBUF_MEMSYNC = 1 - -cdef enum: CUDA_EXTERNAL_SEMAPHORE_WAIT_SKIP_NVSCIBUF_MEMSYNC = 2 - -cdef enum: CUDA_NVSCISYNC_ATTR_SIGNAL = 1 - -cdef enum: CUDA_NVSCISYNC_ATTR_WAIT = 2 - -cdef enum: CU_MEM_CREATE_USAGE_TILE_POOL = 1 - -cdef enum: CUDA_COOPERATIVE_LAUNCH_MULTI_DEVICE_NO_PRE_LAUNCH_SYNC = 1 - -cdef enum: CUDA_COOPERATIVE_LAUNCH_MULTI_DEVICE_NO_POST_LAUNCH_SYNC = 2 - -cdef enum: CUDA_ARRAY3D_LAYERED = 1 - -cdef enum: CUDA_ARRAY3D_2DARRAY = 1 - -cdef enum: CUDA_ARRAY3D_SURFACE_LDST = 2 - -cdef enum: CUDA_ARRAY3D_CUBEMAP = 4 - -cdef enum: CUDA_ARRAY3D_TEXTURE_GATHER = 8 - -cdef enum: CUDA_ARRAY3D_DEPTH_TEXTURE = 16 - -cdef enum: CUDA_ARRAY3D_COLOR_ATTACHMENT = 32 - -cdef enum: CUDA_ARRAY3D_SPARSE = 64 - -cdef enum: CUDA_ARRAY3D_DEFERRED_MAPPING = 128 - -cdef enum: CUDA_ARRAY3D_VIDEO_ENCODE_DECODE = 256 - -cdef enum: CU_TRSA_OVERRIDE_FORMAT = 1 - -cdef enum: CU_TRSF_READ_AS_INTEGER = 1 - -cdef enum: CU_TRSF_NORMALIZED_COORDINATES = 2 - -cdef enum: CU_TRSF_SRGB = 16 - -cdef enum: CU_TRSF_DISABLE_TRILINEAR_OPTIMIZATION = 32 - -cdef enum: CU_TRSF_SEAMLESS_CUBEMAP = 64 - -cdef enum: CU_LAUNCH_PARAM_END_AS_INT = 0 - -cdef enum: CU_LAUNCH_PARAM_END = 0 - -cdef enum: CU_LAUNCH_PARAM_BUFFER_POINTER_AS_INT = 1 - -cdef enum: CU_LAUNCH_PARAM_BUFFER_POINTER = 1 - -cdef enum: CU_LAUNCH_PARAM_BUFFER_SIZE_AS_INT = 2 - -cdef enum: CU_LAUNCH_PARAM_BUFFER_SIZE = 2 - -cdef enum: CU_PARAM_TR_DEFAULT = -1 - -cdef enum: CU_DEVICE_CPU = -1 - -cdef enum: CU_DEVICE_INVALID = -2 - -cdef enum: RESOURCE_ABI_VERSION = 1 - -cdef enum: RESOURCE_ABI_EXTERNAL_BYTES = 48 - -cdef enum: MAX_PLANES = 3 - -cdef enum: CUDA_EGL_INFINITE_TIMEOUT = 4294967295 \ No newline at end of file diff --git a/cuda/ccuda.pyx.in b/cuda/ccuda.pyx.in deleted file mode 100644 index 48c06b5b279..00000000000 --- a/cuda/ccuda.pyx.in +++ /dev/null @@ -1,2744 +0,0 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. -# -# Please refer to the NVIDIA end user license agreement (EULA) associated -# with this source code for terms and conditions that govern your use of -# this software. Any use, reproduction, disclosure, or distribution of -# this software and related documentation outside the terms of the EULA -# is strictly prohibited. -cimport cuda._cuda.ccuda as ccuda - -{{if 'cuGetErrorString' in found_functions}} - -cdef CUresult cuGetErrorString(CUresult error, const char** pStr) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGetErrorString(error, pStr) -{{endif}} - -{{if 'cuGetErrorName' in found_functions}} - -cdef CUresult cuGetErrorName(CUresult error, const char** pStr) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGetErrorName(error, pStr) -{{endif}} - -{{if 'cuInit' in found_functions}} - -cdef CUresult cuInit(unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuInit(Flags) -{{endif}} - -{{if 'cuDriverGetVersion' in found_functions}} - -cdef CUresult cuDriverGetVersion(int* driverVersion) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuDriverGetVersion(driverVersion) -{{endif}} - -{{if 'cuDeviceGet' in found_functions}} - -cdef CUresult cuDeviceGet(CUdevice* device, int ordinal) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuDeviceGet(device, ordinal) -{{endif}} - -{{if 'cuDeviceGetCount' in found_functions}} - -cdef CUresult cuDeviceGetCount(int* count) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuDeviceGetCount(count) -{{endif}} - -{{if 'cuDeviceGetName' in found_functions}} - -cdef CUresult cuDeviceGetName(char* name, int length, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuDeviceGetName(name, length, dev) -{{endif}} - -{{if 'cuDeviceGetUuid' in found_functions}} - -cdef CUresult cuDeviceGetUuid(CUuuid* uuid, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuDeviceGetUuid(uuid, dev) -{{endif}} - -{{if 'cuDeviceGetUuid_v2' in found_functions}} - -cdef CUresult cuDeviceGetUuid_v2(CUuuid* uuid, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuDeviceGetUuid_v2(uuid, dev) -{{endif}} - -{{if 'cuDeviceGetLuid' in found_functions}} - -cdef CUresult cuDeviceGetLuid(char* luid, unsigned int* deviceNodeMask, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuDeviceGetLuid(luid, deviceNodeMask, dev) -{{endif}} - -{{if 'cuDeviceTotalMem_v2' in found_functions}} - -cdef CUresult cuDeviceTotalMem(size_t* numbytes, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuDeviceTotalMem_v2(numbytes, dev) -{{endif}} - -{{if 'cuDeviceGetTexture1DLinearMaxWidth' in found_functions}} - -cdef CUresult cuDeviceGetTexture1DLinearMaxWidth(size_t* maxWidthInElements, CUarray_format pformat, unsigned numChannels, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuDeviceGetTexture1DLinearMaxWidth(maxWidthInElements, pformat, numChannels, dev) -{{endif}} - -{{if 'cuDeviceGetAttribute' in found_functions}} - -cdef CUresult cuDeviceGetAttribute(int* pi, CUdevice_attribute attrib, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuDeviceGetAttribute(pi, attrib, dev) -{{endif}} - -{{if 'cuDeviceGetNvSciSyncAttributes' in found_functions}} - -cdef CUresult cuDeviceGetNvSciSyncAttributes(void* nvSciSyncAttrList, CUdevice dev, int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuDeviceGetNvSciSyncAttributes(nvSciSyncAttrList, dev, flags) -{{endif}} - -{{if 'cuDeviceSetMemPool' in found_functions}} - -cdef CUresult cuDeviceSetMemPool(CUdevice dev, CUmemoryPool pool) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuDeviceSetMemPool(dev, pool) -{{endif}} - -{{if 'cuDeviceGetMemPool' in found_functions}} - -cdef CUresult cuDeviceGetMemPool(CUmemoryPool* pool, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuDeviceGetMemPool(pool, dev) -{{endif}} - -{{if 'cuDeviceGetDefaultMemPool' in found_functions}} - -cdef CUresult cuDeviceGetDefaultMemPool(CUmemoryPool* pool_out, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuDeviceGetDefaultMemPool(pool_out, dev) -{{endif}} - -{{if 'cuDeviceGetExecAffinitySupport' in found_functions}} - -cdef CUresult cuDeviceGetExecAffinitySupport(int* pi, CUexecAffinityType typename, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuDeviceGetExecAffinitySupport(pi, typename, dev) -{{endif}} - -{{if 'cuFlushGPUDirectRDMAWrites' in found_functions}} - -cdef CUresult cuFlushGPUDirectRDMAWrites(CUflushGPUDirectRDMAWritesTarget target, CUflushGPUDirectRDMAWritesScope scope) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuFlushGPUDirectRDMAWrites(target, scope) -{{endif}} - -{{if 'cuDeviceGetProperties' in found_functions}} - -cdef CUresult cuDeviceGetProperties(CUdevprop* prop, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuDeviceGetProperties(prop, dev) -{{endif}} - -{{if 'cuDeviceComputeCapability' in found_functions}} - -cdef CUresult cuDeviceComputeCapability(int* major, int* minor, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuDeviceComputeCapability(major, minor, dev) -{{endif}} - -{{if 'cuDevicePrimaryCtxRetain' in found_functions}} - -cdef CUresult cuDevicePrimaryCtxRetain(CUcontext* pctx, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuDevicePrimaryCtxRetain(pctx, dev) -{{endif}} - -{{if 'cuDevicePrimaryCtxRelease_v2' in found_functions}} - -cdef CUresult cuDevicePrimaryCtxRelease(CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuDevicePrimaryCtxRelease_v2(dev) -{{endif}} - -{{if 'cuDevicePrimaryCtxSetFlags_v2' in found_functions}} - -cdef CUresult cuDevicePrimaryCtxSetFlags(CUdevice dev, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuDevicePrimaryCtxSetFlags_v2(dev, flags) -{{endif}} - -{{if 'cuDevicePrimaryCtxGetState' in found_functions}} - -cdef CUresult cuDevicePrimaryCtxGetState(CUdevice dev, unsigned int* flags, int* active) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuDevicePrimaryCtxGetState(dev, flags, active) -{{endif}} - -{{if 'cuDevicePrimaryCtxReset_v2' in found_functions}} - -cdef CUresult cuDevicePrimaryCtxReset(CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuDevicePrimaryCtxReset_v2(dev) -{{endif}} - -{{if 'cuCtxCreate_v2' in found_functions}} - -cdef CUresult cuCtxCreate(CUcontext* pctx, unsigned int flags, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuCtxCreate_v2(pctx, flags, dev) -{{endif}} - -{{if 'cuCtxCreate_v3' in found_functions}} - -cdef CUresult cuCtxCreate_v3(CUcontext* pctx, CUexecAffinityParam* paramsArray, int numParams, unsigned int flags, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuCtxCreate_v3(pctx, paramsArray, numParams, flags, dev) -{{endif}} - -{{if 'cuCtxCreate_v4' in found_functions}} - -cdef CUresult cuCtxCreate_v4(CUcontext* pctx, CUctxCreateParams* ctxCreateParams, unsigned int flags, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuCtxCreate_v4(pctx, ctxCreateParams, flags, dev) -{{endif}} - -{{if 'cuCtxDestroy_v2' in found_functions}} - -cdef CUresult cuCtxDestroy(CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuCtxDestroy_v2(ctx) -{{endif}} - -{{if 'cuCtxPushCurrent_v2' in found_functions}} - -cdef CUresult cuCtxPushCurrent(CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuCtxPushCurrent_v2(ctx) -{{endif}} - -{{if 'cuCtxPopCurrent_v2' in found_functions}} - -cdef CUresult cuCtxPopCurrent(CUcontext* pctx) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuCtxPopCurrent_v2(pctx) -{{endif}} - -{{if 'cuCtxSetCurrent' in found_functions}} - -cdef CUresult cuCtxSetCurrent(CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuCtxSetCurrent(ctx) -{{endif}} - -{{if 'cuCtxGetCurrent' in found_functions}} - -cdef CUresult cuCtxGetCurrent(CUcontext* pctx) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuCtxGetCurrent(pctx) -{{endif}} - -{{if 'cuCtxGetDevice' in found_functions}} - -cdef CUresult cuCtxGetDevice(CUdevice* device) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuCtxGetDevice(device) -{{endif}} - -{{if 'cuCtxGetFlags' in found_functions}} - -cdef CUresult cuCtxGetFlags(unsigned int* flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuCtxGetFlags(flags) -{{endif}} - -{{if 'cuCtxSetFlags' in found_functions}} - -cdef CUresult cuCtxSetFlags(unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuCtxSetFlags(flags) -{{endif}} - -{{if 'cuCtxGetId' in found_functions}} - -cdef CUresult cuCtxGetId(CUcontext ctx, unsigned long long* ctxId) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuCtxGetId(ctx, ctxId) -{{endif}} - -{{if 'cuCtxSynchronize' in found_functions}} - -cdef CUresult cuCtxSynchronize() except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuCtxSynchronize() -{{endif}} - -{{if 'cuCtxSetLimit' in found_functions}} - -cdef CUresult cuCtxSetLimit(CUlimit limit, size_t value) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuCtxSetLimit(limit, value) -{{endif}} - -{{if 'cuCtxGetLimit' in found_functions}} - -cdef CUresult cuCtxGetLimit(size_t* pvalue, CUlimit limit) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuCtxGetLimit(pvalue, limit) -{{endif}} - -{{if 'cuCtxGetCacheConfig' in found_functions}} - -cdef CUresult cuCtxGetCacheConfig(CUfunc_cache* pconfig) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuCtxGetCacheConfig(pconfig) -{{endif}} - -{{if 'cuCtxSetCacheConfig' in found_functions}} - -cdef CUresult cuCtxSetCacheConfig(CUfunc_cache config) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuCtxSetCacheConfig(config) -{{endif}} - -{{if 'cuCtxGetApiVersion' in found_functions}} - -cdef CUresult cuCtxGetApiVersion(CUcontext ctx, unsigned int* version) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuCtxGetApiVersion(ctx, version) -{{endif}} - -{{if 'cuCtxGetStreamPriorityRange' in found_functions}} - -cdef CUresult cuCtxGetStreamPriorityRange(int* leastPriority, int* greatestPriority) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuCtxGetStreamPriorityRange(leastPriority, greatestPriority) -{{endif}} - -{{if 'cuCtxResetPersistingL2Cache' in found_functions}} - -cdef CUresult cuCtxResetPersistingL2Cache() except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuCtxResetPersistingL2Cache() -{{endif}} - -{{if 'cuCtxGetExecAffinity' in found_functions}} - -cdef CUresult cuCtxGetExecAffinity(CUexecAffinityParam* pExecAffinity, CUexecAffinityType typename) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuCtxGetExecAffinity(pExecAffinity, typename) -{{endif}} - -{{if 'cuCtxRecordEvent' in found_functions}} - -cdef CUresult cuCtxRecordEvent(CUcontext hCtx, CUevent hEvent) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuCtxRecordEvent(hCtx, hEvent) -{{endif}} - -{{if 'cuCtxWaitEvent' in found_functions}} - -cdef CUresult cuCtxWaitEvent(CUcontext hCtx, CUevent hEvent) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuCtxWaitEvent(hCtx, hEvent) -{{endif}} - -{{if 'cuCtxAttach' in found_functions}} - -cdef CUresult cuCtxAttach(CUcontext* pctx, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuCtxAttach(pctx, flags) -{{endif}} - -{{if 'cuCtxDetach' in found_functions}} - -cdef CUresult cuCtxDetach(CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuCtxDetach(ctx) -{{endif}} - -{{if 'cuCtxGetSharedMemConfig' in found_functions}} - -cdef CUresult cuCtxGetSharedMemConfig(CUsharedconfig* pConfig) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuCtxGetSharedMemConfig(pConfig) -{{endif}} - -{{if 'cuCtxSetSharedMemConfig' in found_functions}} - -cdef CUresult cuCtxSetSharedMemConfig(CUsharedconfig config) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuCtxSetSharedMemConfig(config) -{{endif}} - -{{if 'cuModuleLoad' in found_functions}} - -cdef CUresult cuModuleLoad(CUmodule* module, const char* fname) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuModuleLoad(module, fname) -{{endif}} - -{{if 'cuModuleLoadData' in found_functions}} - -cdef CUresult cuModuleLoadData(CUmodule* module, const void* image) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuModuleLoadData(module, image) -{{endif}} - -{{if 'cuModuleLoadDataEx' in found_functions}} - -cdef CUresult cuModuleLoadDataEx(CUmodule* module, const void* image, unsigned int numOptions, CUjit_option* options, void** optionValues) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuModuleLoadDataEx(module, image, numOptions, options, optionValues) -{{endif}} - -{{if 'cuModuleLoadFatBinary' in found_functions}} - -cdef CUresult cuModuleLoadFatBinary(CUmodule* module, const void* fatCubin) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuModuleLoadFatBinary(module, fatCubin) -{{endif}} - -{{if 'cuModuleUnload' in found_functions}} - -cdef CUresult cuModuleUnload(CUmodule hmod) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuModuleUnload(hmod) -{{endif}} - -{{if 'cuModuleGetLoadingMode' in found_functions}} - -cdef CUresult cuModuleGetLoadingMode(CUmoduleLoadingMode* mode) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuModuleGetLoadingMode(mode) -{{endif}} - -{{if 'cuModuleGetFunction' in found_functions}} - -cdef CUresult cuModuleGetFunction(CUfunction* hfunc, CUmodule hmod, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuModuleGetFunction(hfunc, hmod, name) -{{endif}} - -{{if 'cuModuleGetFunctionCount' in found_functions}} - -cdef CUresult cuModuleGetFunctionCount(unsigned int* count, CUmodule mod) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuModuleGetFunctionCount(count, mod) -{{endif}} - -{{if 'cuModuleEnumerateFunctions' in found_functions}} - -cdef CUresult cuModuleEnumerateFunctions(CUfunction* functions, unsigned int numFunctions, CUmodule mod) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuModuleEnumerateFunctions(functions, numFunctions, mod) -{{endif}} - -{{if 'cuModuleGetGlobal_v2' in found_functions}} - -cdef CUresult cuModuleGetGlobal(CUdeviceptr* dptr, size_t* numbytes, CUmodule hmod, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuModuleGetGlobal_v2(dptr, numbytes, hmod, name) -{{endif}} - -{{if 'cuLinkCreate_v2' in found_functions}} - -cdef CUresult cuLinkCreate(unsigned int numOptions, CUjit_option* options, void** optionValues, CUlinkState* stateOut) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuLinkCreate_v2(numOptions, options, optionValues, stateOut) -{{endif}} - -{{if 'cuLinkAddData_v2' in found_functions}} - -cdef CUresult cuLinkAddData(CUlinkState state, CUjitInputType typename, void* data, size_t size, const char* name, unsigned int numOptions, CUjit_option* options, void** optionValues) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuLinkAddData_v2(state, typename, data, size, name, numOptions, options, optionValues) -{{endif}} - -{{if 'cuLinkAddFile_v2' in found_functions}} - -cdef CUresult cuLinkAddFile(CUlinkState state, CUjitInputType typename, const char* path, unsigned int numOptions, CUjit_option* options, void** optionValues) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuLinkAddFile_v2(state, typename, path, numOptions, options, optionValues) -{{endif}} - -{{if 'cuLinkComplete' in found_functions}} - -cdef CUresult cuLinkComplete(CUlinkState state, void** cubinOut, size_t* sizeOut) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuLinkComplete(state, cubinOut, sizeOut) -{{endif}} - -{{if 'cuLinkDestroy' in found_functions}} - -cdef CUresult cuLinkDestroy(CUlinkState state) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuLinkDestroy(state) -{{endif}} - -{{if 'cuModuleGetTexRef' in found_functions}} - -cdef CUresult cuModuleGetTexRef(CUtexref* pTexRef, CUmodule hmod, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuModuleGetTexRef(pTexRef, hmod, name) -{{endif}} - -{{if 'cuModuleGetSurfRef' in found_functions}} - -cdef CUresult cuModuleGetSurfRef(CUsurfref* pSurfRef, CUmodule hmod, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuModuleGetSurfRef(pSurfRef, hmod, name) -{{endif}} - -{{if 'cuLibraryLoadData' in found_functions}} - -cdef CUresult cuLibraryLoadData(CUlibrary* library, const void* code, CUjit_option* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, CUlibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuLibraryLoadData(library, code, jitOptions, jitOptionsValues, numJitOptions, libraryOptions, libraryOptionValues, numLibraryOptions) -{{endif}} - -{{if 'cuLibraryLoadFromFile' in found_functions}} - -cdef CUresult cuLibraryLoadFromFile(CUlibrary* library, const char* fileName, CUjit_option* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, CUlibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuLibraryLoadFromFile(library, fileName, jitOptions, jitOptionsValues, numJitOptions, libraryOptions, libraryOptionValues, numLibraryOptions) -{{endif}} - -{{if 'cuLibraryUnload' in found_functions}} - -cdef CUresult cuLibraryUnload(CUlibrary library) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuLibraryUnload(library) -{{endif}} - -{{if 'cuLibraryGetKernel' in found_functions}} - -cdef CUresult cuLibraryGetKernel(CUkernel* pKernel, CUlibrary library, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuLibraryGetKernel(pKernel, library, name) -{{endif}} - -{{if 'cuLibraryGetKernelCount' in found_functions}} - -cdef CUresult cuLibraryGetKernelCount(unsigned int* count, CUlibrary lib) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuLibraryGetKernelCount(count, lib) -{{endif}} - -{{if 'cuLibraryEnumerateKernels' in found_functions}} - -cdef CUresult cuLibraryEnumerateKernels(CUkernel* kernels, unsigned int numKernels, CUlibrary lib) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuLibraryEnumerateKernels(kernels, numKernels, lib) -{{endif}} - -{{if 'cuLibraryGetModule' in found_functions}} - -cdef CUresult cuLibraryGetModule(CUmodule* pMod, CUlibrary library) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuLibraryGetModule(pMod, library) -{{endif}} - -{{if 'cuKernelGetFunction' in found_functions}} - -cdef CUresult cuKernelGetFunction(CUfunction* pFunc, CUkernel kernel) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuKernelGetFunction(pFunc, kernel) -{{endif}} - -{{if 'cuKernelGetLibrary' in found_functions}} - -cdef CUresult cuKernelGetLibrary(CUlibrary* pLib, CUkernel kernel) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuKernelGetLibrary(pLib, kernel) -{{endif}} - -{{if 'cuLibraryGetGlobal' in found_functions}} - -cdef CUresult cuLibraryGetGlobal(CUdeviceptr* dptr, size_t* numbytes, CUlibrary library, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuLibraryGetGlobal(dptr, numbytes, library, name) -{{endif}} - -{{if 'cuLibraryGetManaged' in found_functions}} - -cdef CUresult cuLibraryGetManaged(CUdeviceptr* dptr, size_t* numbytes, CUlibrary library, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuLibraryGetManaged(dptr, numbytes, library, name) -{{endif}} - -{{if 'cuLibraryGetUnifiedFunction' in found_functions}} - -cdef CUresult cuLibraryGetUnifiedFunction(void** fptr, CUlibrary library, const char* symbol) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuLibraryGetUnifiedFunction(fptr, library, symbol) -{{endif}} - -{{if 'cuKernelGetAttribute' in found_functions}} - -cdef CUresult cuKernelGetAttribute(int* pi, CUfunction_attribute attrib, CUkernel kernel, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuKernelGetAttribute(pi, attrib, kernel, dev) -{{endif}} - -{{if 'cuKernelSetAttribute' in found_functions}} - -cdef CUresult cuKernelSetAttribute(CUfunction_attribute attrib, int val, CUkernel kernel, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuKernelSetAttribute(attrib, val, kernel, dev) -{{endif}} - -{{if 'cuKernelSetCacheConfig' in found_functions}} - -cdef CUresult cuKernelSetCacheConfig(CUkernel kernel, CUfunc_cache config, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuKernelSetCacheConfig(kernel, config, dev) -{{endif}} - -{{if 'cuKernelGetName' in found_functions}} - -cdef CUresult cuKernelGetName(const char** name, CUkernel hfunc) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuKernelGetName(name, hfunc) -{{endif}} - -{{if 'cuKernelGetParamInfo' in found_functions}} - -cdef CUresult cuKernelGetParamInfo(CUkernel kernel, size_t paramIndex, size_t* paramOffset, size_t* paramSize) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuKernelGetParamInfo(kernel, paramIndex, paramOffset, paramSize) -{{endif}} - -{{if 'cuMemGetInfo_v2' in found_functions}} - -cdef CUresult cuMemGetInfo(size_t* free, size_t* total) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemGetInfo_v2(free, total) -{{endif}} - -{{if 'cuMemAlloc_v2' in found_functions}} - -cdef CUresult cuMemAlloc(CUdeviceptr* dptr, size_t bytesize) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemAlloc_v2(dptr, bytesize) -{{endif}} - -{{if 'cuMemAllocPitch_v2' in found_functions}} - -cdef CUresult cuMemAllocPitch(CUdeviceptr* dptr, size_t* pPitch, size_t WidthInBytes, size_t Height, unsigned int ElementSizeBytes) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemAllocPitch_v2(dptr, pPitch, WidthInBytes, Height, ElementSizeBytes) -{{endif}} - -{{if 'cuMemFree_v2' in found_functions}} - -cdef CUresult cuMemFree(CUdeviceptr dptr) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemFree_v2(dptr) -{{endif}} - -{{if 'cuMemGetAddressRange_v2' in found_functions}} - -cdef CUresult cuMemGetAddressRange(CUdeviceptr* pbase, size_t* psize, CUdeviceptr dptr) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemGetAddressRange_v2(pbase, psize, dptr) -{{endif}} - -{{if 'cuMemAllocHost_v2' in found_functions}} - -cdef CUresult cuMemAllocHost(void** pp, size_t bytesize) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemAllocHost_v2(pp, bytesize) -{{endif}} - -{{if 'cuMemFreeHost' in found_functions}} - -cdef CUresult cuMemFreeHost(void* p) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemFreeHost(p) -{{endif}} - -{{if 'cuMemHostAlloc' in found_functions}} - -cdef CUresult cuMemHostAlloc(void** pp, size_t bytesize, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemHostAlloc(pp, bytesize, Flags) -{{endif}} - -{{if 'cuMemHostGetDevicePointer_v2' in found_functions}} - -cdef CUresult cuMemHostGetDevicePointer(CUdeviceptr* pdptr, void* p, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemHostGetDevicePointer_v2(pdptr, p, Flags) -{{endif}} - -{{if 'cuMemHostGetFlags' in found_functions}} - -cdef CUresult cuMemHostGetFlags(unsigned int* pFlags, void* p) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemHostGetFlags(pFlags, p) -{{endif}} - -{{if 'cuMemAllocManaged' in found_functions}} - -cdef CUresult cuMemAllocManaged(CUdeviceptr* dptr, size_t bytesize, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemAllocManaged(dptr, bytesize, flags) -{{endif}} - -{{if 'cuDeviceRegisterAsyncNotification' in found_functions}} - -cdef CUresult cuDeviceRegisterAsyncNotification(CUdevice device, CUasyncCallback callbackFunc, void* userData, CUasyncCallbackHandle* callback) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuDeviceRegisterAsyncNotification(device, callbackFunc, userData, callback) -{{endif}} - -{{if 'cuDeviceUnregisterAsyncNotification' in found_functions}} - -cdef CUresult cuDeviceUnregisterAsyncNotification(CUdevice device, CUasyncCallbackHandle callback) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuDeviceUnregisterAsyncNotification(device, callback) -{{endif}} - -{{if 'cuDeviceGetByPCIBusId' in found_functions}} - -cdef CUresult cuDeviceGetByPCIBusId(CUdevice* dev, const char* pciBusId) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuDeviceGetByPCIBusId(dev, pciBusId) -{{endif}} - -{{if 'cuDeviceGetPCIBusId' in found_functions}} - -cdef CUresult cuDeviceGetPCIBusId(char* pciBusId, int length, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuDeviceGetPCIBusId(pciBusId, length, dev) -{{endif}} - -{{if 'cuIpcGetEventHandle' in found_functions}} - -cdef CUresult cuIpcGetEventHandle(CUipcEventHandle* pHandle, CUevent event) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuIpcGetEventHandle(pHandle, event) -{{endif}} - -{{if 'cuIpcOpenEventHandle' in found_functions}} - -cdef CUresult cuIpcOpenEventHandle(CUevent* phEvent, CUipcEventHandle handle) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuIpcOpenEventHandle(phEvent, handle) -{{endif}} - -{{if 'cuIpcGetMemHandle' in found_functions}} - -cdef CUresult cuIpcGetMemHandle(CUipcMemHandle* pHandle, CUdeviceptr dptr) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuIpcGetMemHandle(pHandle, dptr) -{{endif}} - -{{if 'cuIpcOpenMemHandle_v2' in found_functions}} - -cdef CUresult cuIpcOpenMemHandle(CUdeviceptr* pdptr, CUipcMemHandle handle, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuIpcOpenMemHandle_v2(pdptr, handle, Flags) -{{endif}} - -{{if 'cuIpcCloseMemHandle' in found_functions}} - -cdef CUresult cuIpcCloseMemHandle(CUdeviceptr dptr) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuIpcCloseMemHandle(dptr) -{{endif}} - -{{if 'cuMemHostRegister_v2' in found_functions}} - -cdef CUresult cuMemHostRegister(void* p, size_t bytesize, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemHostRegister_v2(p, bytesize, Flags) -{{endif}} - -{{if 'cuMemHostUnregister' in found_functions}} - -cdef CUresult cuMemHostUnregister(void* p) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemHostUnregister(p) -{{endif}} - -{{if 'cuMemcpy' in found_functions}} - -cdef CUresult cuMemcpy(CUdeviceptr dst, CUdeviceptr src, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemcpy(dst, src, ByteCount) -{{endif}} - -{{if 'cuMemcpyPeer' in found_functions}} - -cdef CUresult cuMemcpyPeer(CUdeviceptr dstDevice, CUcontext dstContext, CUdeviceptr srcDevice, CUcontext srcContext, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemcpyPeer(dstDevice, dstContext, srcDevice, srcContext, ByteCount) -{{endif}} - -{{if 'cuMemcpyHtoD_v2' in found_functions}} - -cdef CUresult cuMemcpyHtoD(CUdeviceptr dstDevice, const void* srcHost, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemcpyHtoD_v2(dstDevice, srcHost, ByteCount) -{{endif}} - -{{if 'cuMemcpyDtoH_v2' in found_functions}} - -cdef CUresult cuMemcpyDtoH(void* dstHost, CUdeviceptr srcDevice, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemcpyDtoH_v2(dstHost, srcDevice, ByteCount) -{{endif}} - -{{if 'cuMemcpyDtoD_v2' in found_functions}} - -cdef CUresult cuMemcpyDtoD(CUdeviceptr dstDevice, CUdeviceptr srcDevice, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemcpyDtoD_v2(dstDevice, srcDevice, ByteCount) -{{endif}} - -{{if 'cuMemcpyDtoA_v2' in found_functions}} - -cdef CUresult cuMemcpyDtoA(CUarray dstArray, size_t dstOffset, CUdeviceptr srcDevice, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemcpyDtoA_v2(dstArray, dstOffset, srcDevice, ByteCount) -{{endif}} - -{{if 'cuMemcpyAtoD_v2' in found_functions}} - -cdef CUresult cuMemcpyAtoD(CUdeviceptr dstDevice, CUarray srcArray, size_t srcOffset, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemcpyAtoD_v2(dstDevice, srcArray, srcOffset, ByteCount) -{{endif}} - -{{if 'cuMemcpyHtoA_v2' in found_functions}} - -cdef CUresult cuMemcpyHtoA(CUarray dstArray, size_t dstOffset, const void* srcHost, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemcpyHtoA_v2(dstArray, dstOffset, srcHost, ByteCount) -{{endif}} - -{{if 'cuMemcpyAtoH_v2' in found_functions}} - -cdef CUresult cuMemcpyAtoH(void* dstHost, CUarray srcArray, size_t srcOffset, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemcpyAtoH_v2(dstHost, srcArray, srcOffset, ByteCount) -{{endif}} - -{{if 'cuMemcpyAtoA_v2' in found_functions}} - -cdef CUresult cuMemcpyAtoA(CUarray dstArray, size_t dstOffset, CUarray srcArray, size_t srcOffset, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemcpyAtoA_v2(dstArray, dstOffset, srcArray, srcOffset, ByteCount) -{{endif}} - -{{if 'cuMemcpy2D_v2' in found_functions}} - -cdef CUresult cuMemcpy2D(const CUDA_MEMCPY2D* pCopy) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemcpy2D_v2(pCopy) -{{endif}} - -{{if 'cuMemcpy2DUnaligned_v2' in found_functions}} - -cdef CUresult cuMemcpy2DUnaligned(const CUDA_MEMCPY2D* pCopy) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemcpy2DUnaligned_v2(pCopy) -{{endif}} - -{{if 'cuMemcpy3D_v2' in found_functions}} - -cdef CUresult cuMemcpy3D(const CUDA_MEMCPY3D* pCopy) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemcpy3D_v2(pCopy) -{{endif}} - -{{if 'cuMemcpy3DPeer' in found_functions}} - -cdef CUresult cuMemcpy3DPeer(const CUDA_MEMCPY3D_PEER* pCopy) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemcpy3DPeer(pCopy) -{{endif}} - -{{if 'cuMemcpyAsync' in found_functions}} - -cdef CUresult cuMemcpyAsync(CUdeviceptr dst, CUdeviceptr src, size_t ByteCount, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemcpyAsync(dst, src, ByteCount, hStream) -{{endif}} - -{{if 'cuMemcpyPeerAsync' in found_functions}} - -cdef CUresult cuMemcpyPeerAsync(CUdeviceptr dstDevice, CUcontext dstContext, CUdeviceptr srcDevice, CUcontext srcContext, size_t ByteCount, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemcpyPeerAsync(dstDevice, dstContext, srcDevice, srcContext, ByteCount, hStream) -{{endif}} - -{{if 'cuMemcpyHtoDAsync_v2' in found_functions}} - -cdef CUresult cuMemcpyHtoDAsync(CUdeviceptr dstDevice, const void* srcHost, size_t ByteCount, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemcpyHtoDAsync_v2(dstDevice, srcHost, ByteCount, hStream) -{{endif}} - -{{if 'cuMemcpyDtoHAsync_v2' in found_functions}} - -cdef CUresult cuMemcpyDtoHAsync(void* dstHost, CUdeviceptr srcDevice, size_t ByteCount, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemcpyDtoHAsync_v2(dstHost, srcDevice, ByteCount, hStream) -{{endif}} - -{{if 'cuMemcpyDtoDAsync_v2' in found_functions}} - -cdef CUresult cuMemcpyDtoDAsync(CUdeviceptr dstDevice, CUdeviceptr srcDevice, size_t ByteCount, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemcpyDtoDAsync_v2(dstDevice, srcDevice, ByteCount, hStream) -{{endif}} - -{{if 'cuMemcpyHtoAAsync_v2' in found_functions}} - -cdef CUresult cuMemcpyHtoAAsync(CUarray dstArray, size_t dstOffset, const void* srcHost, size_t ByteCount, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemcpyHtoAAsync_v2(dstArray, dstOffset, srcHost, ByteCount, hStream) -{{endif}} - -{{if 'cuMemcpyAtoHAsync_v2' in found_functions}} - -cdef CUresult cuMemcpyAtoHAsync(void* dstHost, CUarray srcArray, size_t srcOffset, size_t ByteCount, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemcpyAtoHAsync_v2(dstHost, srcArray, srcOffset, ByteCount, hStream) -{{endif}} - -{{if 'cuMemcpy2DAsync_v2' in found_functions}} - -cdef CUresult cuMemcpy2DAsync(const CUDA_MEMCPY2D* pCopy, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemcpy2DAsync_v2(pCopy, hStream) -{{endif}} - -{{if 'cuMemcpy3DAsync_v2' in found_functions}} - -cdef CUresult cuMemcpy3DAsync(const CUDA_MEMCPY3D* pCopy, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemcpy3DAsync_v2(pCopy, hStream) -{{endif}} - -{{if 'cuMemcpy3DPeerAsync' in found_functions}} - -cdef CUresult cuMemcpy3DPeerAsync(const CUDA_MEMCPY3D_PEER* pCopy, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemcpy3DPeerAsync(pCopy, hStream) -{{endif}} - -{{if 'cuMemsetD8_v2' in found_functions}} - -cdef CUresult cuMemsetD8(CUdeviceptr dstDevice, unsigned char uc, size_t N) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemsetD8_v2(dstDevice, uc, N) -{{endif}} - -{{if 'cuMemsetD16_v2' in found_functions}} - -cdef CUresult cuMemsetD16(CUdeviceptr dstDevice, unsigned short us, size_t N) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemsetD16_v2(dstDevice, us, N) -{{endif}} - -{{if 'cuMemsetD32_v2' in found_functions}} - -cdef CUresult cuMemsetD32(CUdeviceptr dstDevice, unsigned int ui, size_t N) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemsetD32_v2(dstDevice, ui, N) -{{endif}} - -{{if 'cuMemsetD2D8_v2' in found_functions}} - -cdef CUresult cuMemsetD2D8(CUdeviceptr dstDevice, size_t dstPitch, unsigned char uc, size_t Width, size_t Height) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemsetD2D8_v2(dstDevice, dstPitch, uc, Width, Height) -{{endif}} - -{{if 'cuMemsetD2D16_v2' in found_functions}} - -cdef CUresult cuMemsetD2D16(CUdeviceptr dstDevice, size_t dstPitch, unsigned short us, size_t Width, size_t Height) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemsetD2D16_v2(dstDevice, dstPitch, us, Width, Height) -{{endif}} - -{{if 'cuMemsetD2D32_v2' in found_functions}} - -cdef CUresult cuMemsetD2D32(CUdeviceptr dstDevice, size_t dstPitch, unsigned int ui, size_t Width, size_t Height) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemsetD2D32_v2(dstDevice, dstPitch, ui, Width, Height) -{{endif}} - -{{if 'cuMemsetD8Async' in found_functions}} - -cdef CUresult cuMemsetD8Async(CUdeviceptr dstDevice, unsigned char uc, size_t N, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemsetD8Async(dstDevice, uc, N, hStream) -{{endif}} - -{{if 'cuMemsetD16Async' in found_functions}} - -cdef CUresult cuMemsetD16Async(CUdeviceptr dstDevice, unsigned short us, size_t N, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemsetD16Async(dstDevice, us, N, hStream) -{{endif}} - -{{if 'cuMemsetD32Async' in found_functions}} - -cdef CUresult cuMemsetD32Async(CUdeviceptr dstDevice, unsigned int ui, size_t N, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemsetD32Async(dstDevice, ui, N, hStream) -{{endif}} - -{{if 'cuMemsetD2D8Async' in found_functions}} - -cdef CUresult cuMemsetD2D8Async(CUdeviceptr dstDevice, size_t dstPitch, unsigned char uc, size_t Width, size_t Height, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemsetD2D8Async(dstDevice, dstPitch, uc, Width, Height, hStream) -{{endif}} - -{{if 'cuMemsetD2D16Async' in found_functions}} - -cdef CUresult cuMemsetD2D16Async(CUdeviceptr dstDevice, size_t dstPitch, unsigned short us, size_t Width, size_t Height, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemsetD2D16Async(dstDevice, dstPitch, us, Width, Height, hStream) -{{endif}} - -{{if 'cuMemsetD2D32Async' in found_functions}} - -cdef CUresult cuMemsetD2D32Async(CUdeviceptr dstDevice, size_t dstPitch, unsigned int ui, size_t Width, size_t Height, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemsetD2D32Async(dstDevice, dstPitch, ui, Width, Height, hStream) -{{endif}} - -{{if 'cuArrayCreate_v2' in found_functions}} - -cdef CUresult cuArrayCreate(CUarray* pHandle, const CUDA_ARRAY_DESCRIPTOR* pAllocateArray) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuArrayCreate_v2(pHandle, pAllocateArray) -{{endif}} - -{{if 'cuArrayGetDescriptor_v2' in found_functions}} - -cdef CUresult cuArrayGetDescriptor(CUDA_ARRAY_DESCRIPTOR* pArrayDescriptor, CUarray hArray) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuArrayGetDescriptor_v2(pArrayDescriptor, hArray) -{{endif}} - -{{if 'cuArrayGetSparseProperties' in found_functions}} - -cdef CUresult cuArrayGetSparseProperties(CUDA_ARRAY_SPARSE_PROPERTIES* sparseProperties, CUarray array) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuArrayGetSparseProperties(sparseProperties, array) -{{endif}} - -{{if 'cuMipmappedArrayGetSparseProperties' in found_functions}} - -cdef CUresult cuMipmappedArrayGetSparseProperties(CUDA_ARRAY_SPARSE_PROPERTIES* sparseProperties, CUmipmappedArray mipmap) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMipmappedArrayGetSparseProperties(sparseProperties, mipmap) -{{endif}} - -{{if 'cuArrayGetMemoryRequirements' in found_functions}} - -cdef CUresult cuArrayGetMemoryRequirements(CUDA_ARRAY_MEMORY_REQUIREMENTS* memoryRequirements, CUarray array, CUdevice device) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuArrayGetMemoryRequirements(memoryRequirements, array, device) -{{endif}} - -{{if 'cuMipmappedArrayGetMemoryRequirements' in found_functions}} - -cdef CUresult cuMipmappedArrayGetMemoryRequirements(CUDA_ARRAY_MEMORY_REQUIREMENTS* memoryRequirements, CUmipmappedArray mipmap, CUdevice device) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMipmappedArrayGetMemoryRequirements(memoryRequirements, mipmap, device) -{{endif}} - -{{if 'cuArrayGetPlane' in found_functions}} - -cdef CUresult cuArrayGetPlane(CUarray* pPlaneArray, CUarray hArray, unsigned int planeIdx) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuArrayGetPlane(pPlaneArray, hArray, planeIdx) -{{endif}} - -{{if 'cuArrayDestroy' in found_functions}} - -cdef CUresult cuArrayDestroy(CUarray hArray) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuArrayDestroy(hArray) -{{endif}} - -{{if 'cuArray3DCreate_v2' in found_functions}} - -cdef CUresult cuArray3DCreate(CUarray* pHandle, const CUDA_ARRAY3D_DESCRIPTOR* pAllocateArray) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuArray3DCreate_v2(pHandle, pAllocateArray) -{{endif}} - -{{if 'cuArray3DGetDescriptor_v2' in found_functions}} - -cdef CUresult cuArray3DGetDescriptor(CUDA_ARRAY3D_DESCRIPTOR* pArrayDescriptor, CUarray hArray) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuArray3DGetDescriptor_v2(pArrayDescriptor, hArray) -{{endif}} - -{{if 'cuMipmappedArrayCreate' in found_functions}} - -cdef CUresult cuMipmappedArrayCreate(CUmipmappedArray* pHandle, const CUDA_ARRAY3D_DESCRIPTOR* pMipmappedArrayDesc, unsigned int numMipmapLevels) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMipmappedArrayCreate(pHandle, pMipmappedArrayDesc, numMipmapLevels) -{{endif}} - -{{if 'cuMipmappedArrayGetLevel' in found_functions}} - -cdef CUresult cuMipmappedArrayGetLevel(CUarray* pLevelArray, CUmipmappedArray hMipmappedArray, unsigned int level) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMipmappedArrayGetLevel(pLevelArray, hMipmappedArray, level) -{{endif}} - -{{if 'cuMipmappedArrayDestroy' in found_functions}} - -cdef CUresult cuMipmappedArrayDestroy(CUmipmappedArray hMipmappedArray) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMipmappedArrayDestroy(hMipmappedArray) -{{endif}} - -{{if 'cuMemGetHandleForAddressRange' in found_functions}} - -cdef CUresult cuMemGetHandleForAddressRange(void* handle, CUdeviceptr dptr, size_t size, CUmemRangeHandleType handleType, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemGetHandleForAddressRange(handle, dptr, size, handleType, flags) -{{endif}} - -{{if 'cuMemAddressReserve' in found_functions}} - -cdef CUresult cuMemAddressReserve(CUdeviceptr* ptr, size_t size, size_t alignment, CUdeviceptr addr, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemAddressReserve(ptr, size, alignment, addr, flags) -{{endif}} - -{{if 'cuMemAddressFree' in found_functions}} - -cdef CUresult cuMemAddressFree(CUdeviceptr ptr, size_t size) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemAddressFree(ptr, size) -{{endif}} - -{{if 'cuMemCreate' in found_functions}} - -cdef CUresult cuMemCreate(CUmemGenericAllocationHandle* handle, size_t size, const CUmemAllocationProp* prop, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemCreate(handle, size, prop, flags) -{{endif}} - -{{if 'cuMemRelease' in found_functions}} - -cdef CUresult cuMemRelease(CUmemGenericAllocationHandle handle) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemRelease(handle) -{{endif}} - -{{if 'cuMemMap' in found_functions}} - -cdef CUresult cuMemMap(CUdeviceptr ptr, size_t size, size_t offset, CUmemGenericAllocationHandle handle, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemMap(ptr, size, offset, handle, flags) -{{endif}} - -{{if 'cuMemMapArrayAsync' in found_functions}} - -cdef CUresult cuMemMapArrayAsync(CUarrayMapInfo* mapInfoList, unsigned int count, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemMapArrayAsync(mapInfoList, count, hStream) -{{endif}} - -{{if 'cuMemUnmap' in found_functions}} - -cdef CUresult cuMemUnmap(CUdeviceptr ptr, size_t size) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemUnmap(ptr, size) -{{endif}} - -{{if 'cuMemSetAccess' in found_functions}} - -cdef CUresult cuMemSetAccess(CUdeviceptr ptr, size_t size, const CUmemAccessDesc* desc, size_t count) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemSetAccess(ptr, size, desc, count) -{{endif}} - -{{if 'cuMemGetAccess' in found_functions}} - -cdef CUresult cuMemGetAccess(unsigned long long* flags, const CUmemLocation* location, CUdeviceptr ptr) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemGetAccess(flags, location, ptr) -{{endif}} - -{{if 'cuMemExportToShareableHandle' in found_functions}} - -cdef CUresult cuMemExportToShareableHandle(void* shareableHandle, CUmemGenericAllocationHandle handle, CUmemAllocationHandleType handleType, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemExportToShareableHandle(shareableHandle, handle, handleType, flags) -{{endif}} - -{{if 'cuMemImportFromShareableHandle' in found_functions}} - -cdef CUresult cuMemImportFromShareableHandle(CUmemGenericAllocationHandle* handle, void* osHandle, CUmemAllocationHandleType shHandleType) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemImportFromShareableHandle(handle, osHandle, shHandleType) -{{endif}} - -{{if 'cuMemGetAllocationGranularity' in found_functions}} - -cdef CUresult cuMemGetAllocationGranularity(size_t* granularity, const CUmemAllocationProp* prop, CUmemAllocationGranularity_flags option) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemGetAllocationGranularity(granularity, prop, option) -{{endif}} - -{{if 'cuMemGetAllocationPropertiesFromHandle' in found_functions}} - -cdef CUresult cuMemGetAllocationPropertiesFromHandle(CUmemAllocationProp* prop, CUmemGenericAllocationHandle handle) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemGetAllocationPropertiesFromHandle(prop, handle) -{{endif}} - -{{if 'cuMemRetainAllocationHandle' in found_functions}} - -cdef CUresult cuMemRetainAllocationHandle(CUmemGenericAllocationHandle* handle, void* addr) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemRetainAllocationHandle(handle, addr) -{{endif}} - -{{if 'cuMemFreeAsync' in found_functions}} - -cdef CUresult cuMemFreeAsync(CUdeviceptr dptr, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemFreeAsync(dptr, hStream) -{{endif}} - -{{if 'cuMemAllocAsync' in found_functions}} - -cdef CUresult cuMemAllocAsync(CUdeviceptr* dptr, size_t bytesize, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemAllocAsync(dptr, bytesize, hStream) -{{endif}} - -{{if 'cuMemPoolTrimTo' in found_functions}} - -cdef CUresult cuMemPoolTrimTo(CUmemoryPool pool, size_t minBytesToKeep) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemPoolTrimTo(pool, minBytesToKeep) -{{endif}} - -{{if 'cuMemPoolSetAttribute' in found_functions}} - -cdef CUresult cuMemPoolSetAttribute(CUmemoryPool pool, CUmemPool_attribute attr, void* value) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemPoolSetAttribute(pool, attr, value) -{{endif}} - -{{if 'cuMemPoolGetAttribute' in found_functions}} - -cdef CUresult cuMemPoolGetAttribute(CUmemoryPool pool, CUmemPool_attribute attr, void* value) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemPoolGetAttribute(pool, attr, value) -{{endif}} - -{{if 'cuMemPoolSetAccess' in found_functions}} - -cdef CUresult cuMemPoolSetAccess(CUmemoryPool pool, const CUmemAccessDesc* map, size_t count) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemPoolSetAccess(pool, map, count) -{{endif}} - -{{if 'cuMemPoolGetAccess' in found_functions}} - -cdef CUresult cuMemPoolGetAccess(CUmemAccess_flags* flags, CUmemoryPool memPool, CUmemLocation* location) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemPoolGetAccess(flags, memPool, location) -{{endif}} - -{{if 'cuMemPoolCreate' in found_functions}} - -cdef CUresult cuMemPoolCreate(CUmemoryPool* pool, const CUmemPoolProps* poolProps) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemPoolCreate(pool, poolProps) -{{endif}} - -{{if 'cuMemPoolDestroy' in found_functions}} - -cdef CUresult cuMemPoolDestroy(CUmemoryPool pool) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemPoolDestroy(pool) -{{endif}} - -{{if 'cuMemAllocFromPoolAsync' in found_functions}} - -cdef CUresult cuMemAllocFromPoolAsync(CUdeviceptr* dptr, size_t bytesize, CUmemoryPool pool, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemAllocFromPoolAsync(dptr, bytesize, pool, hStream) -{{endif}} - -{{if 'cuMemPoolExportToShareableHandle' in found_functions}} - -cdef CUresult cuMemPoolExportToShareableHandle(void* handle_out, CUmemoryPool pool, CUmemAllocationHandleType handleType, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemPoolExportToShareableHandle(handle_out, pool, handleType, flags) -{{endif}} - -{{if 'cuMemPoolImportFromShareableHandle' in found_functions}} - -cdef CUresult cuMemPoolImportFromShareableHandle(CUmemoryPool* pool_out, void* handle, CUmemAllocationHandleType handleType, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemPoolImportFromShareableHandle(pool_out, handle, handleType, flags) -{{endif}} - -{{if 'cuMemPoolExportPointer' in found_functions}} - -cdef CUresult cuMemPoolExportPointer(CUmemPoolPtrExportData* shareData_out, CUdeviceptr ptr) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemPoolExportPointer(shareData_out, ptr) -{{endif}} - -{{if 'cuMemPoolImportPointer' in found_functions}} - -cdef CUresult cuMemPoolImportPointer(CUdeviceptr* ptr_out, CUmemoryPool pool, CUmemPoolPtrExportData* shareData) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemPoolImportPointer(ptr_out, pool, shareData) -{{endif}} - -{{if 'cuMulticastCreate' in found_functions}} - -cdef CUresult cuMulticastCreate(CUmemGenericAllocationHandle* mcHandle, const CUmulticastObjectProp* prop) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMulticastCreate(mcHandle, prop) -{{endif}} - -{{if 'cuMulticastAddDevice' in found_functions}} - -cdef CUresult cuMulticastAddDevice(CUmemGenericAllocationHandle mcHandle, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMulticastAddDevice(mcHandle, dev) -{{endif}} - -{{if 'cuMulticastBindMem' in found_functions}} - -cdef CUresult cuMulticastBindMem(CUmemGenericAllocationHandle mcHandle, size_t mcOffset, CUmemGenericAllocationHandle memHandle, size_t memOffset, size_t size, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMulticastBindMem(mcHandle, mcOffset, memHandle, memOffset, size, flags) -{{endif}} - -{{if 'cuMulticastBindAddr' in found_functions}} - -cdef CUresult cuMulticastBindAddr(CUmemGenericAllocationHandle mcHandle, size_t mcOffset, CUdeviceptr memptr, size_t size, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMulticastBindAddr(mcHandle, mcOffset, memptr, size, flags) -{{endif}} - -{{if 'cuMulticastUnbind' in found_functions}} - -cdef CUresult cuMulticastUnbind(CUmemGenericAllocationHandle mcHandle, CUdevice dev, size_t mcOffset, size_t size) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMulticastUnbind(mcHandle, dev, mcOffset, size) -{{endif}} - -{{if 'cuMulticastGetGranularity' in found_functions}} - -cdef CUresult cuMulticastGetGranularity(size_t* granularity, const CUmulticastObjectProp* prop, CUmulticastGranularity_flags option) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMulticastGetGranularity(granularity, prop, option) -{{endif}} - -{{if 'cuPointerGetAttribute' in found_functions}} - -cdef CUresult cuPointerGetAttribute(void* data, CUpointer_attribute attribute, CUdeviceptr ptr) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuPointerGetAttribute(data, attribute, ptr) -{{endif}} - -{{if 'cuMemPrefetchAsync' in found_functions}} - -cdef CUresult cuMemPrefetchAsync(CUdeviceptr devPtr, size_t count, CUdevice dstDevice, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemPrefetchAsync(devPtr, count, dstDevice, hStream) -{{endif}} - -{{if 'cuMemPrefetchAsync_v2' in found_functions}} - -cdef CUresult cuMemPrefetchAsync_v2(CUdeviceptr devPtr, size_t count, CUmemLocation location, unsigned int flags, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemPrefetchAsync_v2(devPtr, count, location, flags, hStream) -{{endif}} - -{{if 'cuMemAdvise' in found_functions}} - -cdef CUresult cuMemAdvise(CUdeviceptr devPtr, size_t count, CUmem_advise advice, CUdevice device) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemAdvise(devPtr, count, advice, device) -{{endif}} - -{{if 'cuMemAdvise_v2' in found_functions}} - -cdef CUresult cuMemAdvise_v2(CUdeviceptr devPtr, size_t count, CUmem_advise advice, CUmemLocation location) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemAdvise_v2(devPtr, count, advice, location) -{{endif}} - -{{if 'cuMemRangeGetAttribute' in found_functions}} - -cdef CUresult cuMemRangeGetAttribute(void* data, size_t dataSize, CUmem_range_attribute attribute, CUdeviceptr devPtr, size_t count) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemRangeGetAttribute(data, dataSize, attribute, devPtr, count) -{{endif}} - -{{if 'cuMemRangeGetAttributes' in found_functions}} - -cdef CUresult cuMemRangeGetAttributes(void** data, size_t* dataSizes, CUmem_range_attribute* attributes, size_t numAttributes, CUdeviceptr devPtr, size_t count) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuMemRangeGetAttributes(data, dataSizes, attributes, numAttributes, devPtr, count) -{{endif}} - -{{if 'cuPointerSetAttribute' in found_functions}} - -cdef CUresult cuPointerSetAttribute(const void* value, CUpointer_attribute attribute, CUdeviceptr ptr) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuPointerSetAttribute(value, attribute, ptr) -{{endif}} - -{{if 'cuPointerGetAttributes' in found_functions}} - -cdef CUresult cuPointerGetAttributes(unsigned int numAttributes, CUpointer_attribute* attributes, void** data, CUdeviceptr ptr) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuPointerGetAttributes(numAttributes, attributes, data, ptr) -{{endif}} - -{{if 'cuStreamCreate' in found_functions}} - -cdef CUresult cuStreamCreate(CUstream* phStream, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuStreamCreate(phStream, Flags) -{{endif}} - -{{if 'cuStreamCreateWithPriority' in found_functions}} - -cdef CUresult cuStreamCreateWithPriority(CUstream* phStream, unsigned int flags, int priority) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuStreamCreateWithPriority(phStream, flags, priority) -{{endif}} - -{{if 'cuStreamGetPriority' in found_functions}} - -cdef CUresult cuStreamGetPriority(CUstream hStream, int* priority) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuStreamGetPriority(hStream, priority) -{{endif}} - -{{if 'cuStreamGetFlags' in found_functions}} - -cdef CUresult cuStreamGetFlags(CUstream hStream, unsigned int* flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuStreamGetFlags(hStream, flags) -{{endif}} - -{{if 'cuStreamGetId' in found_functions}} - -cdef CUresult cuStreamGetId(CUstream hStream, unsigned long long* streamId) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuStreamGetId(hStream, streamId) -{{endif}} - -{{if 'cuStreamGetCtx' in found_functions}} - -cdef CUresult cuStreamGetCtx(CUstream hStream, CUcontext* pctx) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuStreamGetCtx(hStream, pctx) -{{endif}} - -{{if 'cuStreamGetCtx_v2' in found_functions}} - -cdef CUresult cuStreamGetCtx_v2(CUstream hStream, CUcontext* pCtx, CUgreenCtx* pGreenCtx) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuStreamGetCtx_v2(hStream, pCtx, pGreenCtx) -{{endif}} - -{{if 'cuStreamWaitEvent' in found_functions}} - -cdef CUresult cuStreamWaitEvent(CUstream hStream, CUevent hEvent, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuStreamWaitEvent(hStream, hEvent, Flags) -{{endif}} - -{{if 'cuStreamAddCallback' in found_functions}} - -cdef CUresult cuStreamAddCallback(CUstream hStream, CUstreamCallback callback, void* userData, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuStreamAddCallback(hStream, callback, userData, flags) -{{endif}} - -{{if 'cuStreamBeginCapture_v2' in found_functions}} - -cdef CUresult cuStreamBeginCapture(CUstream hStream, CUstreamCaptureMode mode) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuStreamBeginCapture_v2(hStream, mode) -{{endif}} - -{{if 'cuStreamBeginCaptureToGraph' in found_functions}} - -cdef CUresult cuStreamBeginCaptureToGraph(CUstream hStream, CUgraph hGraph, const CUgraphNode* dependencies, const CUgraphEdgeData* dependencyData, size_t numDependencies, CUstreamCaptureMode mode) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuStreamBeginCaptureToGraph(hStream, hGraph, dependencies, dependencyData, numDependencies, mode) -{{endif}} - -{{if 'cuThreadExchangeStreamCaptureMode' in found_functions}} - -cdef CUresult cuThreadExchangeStreamCaptureMode(CUstreamCaptureMode* mode) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuThreadExchangeStreamCaptureMode(mode) -{{endif}} - -{{if 'cuStreamEndCapture' in found_functions}} - -cdef CUresult cuStreamEndCapture(CUstream hStream, CUgraph* phGraph) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuStreamEndCapture(hStream, phGraph) -{{endif}} - -{{if 'cuStreamIsCapturing' in found_functions}} - -cdef CUresult cuStreamIsCapturing(CUstream hStream, CUstreamCaptureStatus* captureStatus) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuStreamIsCapturing(hStream, captureStatus) -{{endif}} - -{{if 'cuStreamGetCaptureInfo_v2' in found_functions}} - -cdef CUresult cuStreamGetCaptureInfo(CUstream hStream, CUstreamCaptureStatus* captureStatus_out, cuuint64_t* id_out, CUgraph* graph_out, const CUgraphNode** dependencies_out, size_t* numDependencies_out) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuStreamGetCaptureInfo_v2(hStream, captureStatus_out, id_out, graph_out, dependencies_out, numDependencies_out) -{{endif}} - -{{if 'cuStreamGetCaptureInfo_v3' in found_functions}} - -cdef CUresult cuStreamGetCaptureInfo_v3(CUstream hStream, CUstreamCaptureStatus* captureStatus_out, cuuint64_t* id_out, CUgraph* graph_out, const CUgraphNode** dependencies_out, const CUgraphEdgeData** edgeData_out, size_t* numDependencies_out) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuStreamGetCaptureInfo_v3(hStream, captureStatus_out, id_out, graph_out, dependencies_out, edgeData_out, numDependencies_out) -{{endif}} - -{{if 'cuStreamUpdateCaptureDependencies' in found_functions}} - -cdef CUresult cuStreamUpdateCaptureDependencies(CUstream hStream, CUgraphNode* dependencies, size_t numDependencies, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuStreamUpdateCaptureDependencies(hStream, dependencies, numDependencies, flags) -{{endif}} - -{{if 'cuStreamUpdateCaptureDependencies_v2' in found_functions}} - -cdef CUresult cuStreamUpdateCaptureDependencies_v2(CUstream hStream, CUgraphNode* dependencies, const CUgraphEdgeData* dependencyData, size_t numDependencies, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuStreamUpdateCaptureDependencies_v2(hStream, dependencies, dependencyData, numDependencies, flags) -{{endif}} - -{{if 'cuStreamAttachMemAsync' in found_functions}} - -cdef CUresult cuStreamAttachMemAsync(CUstream hStream, CUdeviceptr dptr, size_t length, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuStreamAttachMemAsync(hStream, dptr, length, flags) -{{endif}} - -{{if 'cuStreamQuery' in found_functions}} - -cdef CUresult cuStreamQuery(CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuStreamQuery(hStream) -{{endif}} - -{{if 'cuStreamSynchronize' in found_functions}} - -cdef CUresult cuStreamSynchronize(CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuStreamSynchronize(hStream) -{{endif}} - -{{if 'cuStreamDestroy_v2' in found_functions}} - -cdef CUresult cuStreamDestroy(CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuStreamDestroy_v2(hStream) -{{endif}} - -{{if 'cuStreamCopyAttributes' in found_functions}} - -cdef CUresult cuStreamCopyAttributes(CUstream dst, CUstream src) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuStreamCopyAttributes(dst, src) -{{endif}} - -{{if 'cuStreamGetAttribute' in found_functions}} - -cdef CUresult cuStreamGetAttribute(CUstream hStream, CUstreamAttrID attr, CUstreamAttrValue* value_out) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuStreamGetAttribute(hStream, attr, value_out) -{{endif}} - -{{if 'cuStreamSetAttribute' in found_functions}} - -cdef CUresult cuStreamSetAttribute(CUstream hStream, CUstreamAttrID attr, const CUstreamAttrValue* value) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuStreamSetAttribute(hStream, attr, value) -{{endif}} - -{{if 'cuEventCreate' in found_functions}} - -cdef CUresult cuEventCreate(CUevent* phEvent, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuEventCreate(phEvent, Flags) -{{endif}} - -{{if 'cuEventRecord' in found_functions}} - -cdef CUresult cuEventRecord(CUevent hEvent, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuEventRecord(hEvent, hStream) -{{endif}} - -{{if 'cuEventRecordWithFlags' in found_functions}} - -cdef CUresult cuEventRecordWithFlags(CUevent hEvent, CUstream hStream, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuEventRecordWithFlags(hEvent, hStream, flags) -{{endif}} - -{{if 'cuEventQuery' in found_functions}} - -cdef CUresult cuEventQuery(CUevent hEvent) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuEventQuery(hEvent) -{{endif}} - -{{if 'cuEventSynchronize' in found_functions}} - -cdef CUresult cuEventSynchronize(CUevent hEvent) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuEventSynchronize(hEvent) -{{endif}} - -{{if 'cuEventDestroy_v2' in found_functions}} - -cdef CUresult cuEventDestroy(CUevent hEvent) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuEventDestroy_v2(hEvent) -{{endif}} - -{{if 'cuEventElapsedTime' in found_functions}} - -cdef CUresult cuEventElapsedTime(float* pMilliseconds, CUevent hStart, CUevent hEnd) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuEventElapsedTime(pMilliseconds, hStart, hEnd) -{{endif}} - -{{if 'cuImportExternalMemory' in found_functions}} - -cdef CUresult cuImportExternalMemory(CUexternalMemory* extMem_out, const CUDA_EXTERNAL_MEMORY_HANDLE_DESC* memHandleDesc) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuImportExternalMemory(extMem_out, memHandleDesc) -{{endif}} - -{{if 'cuExternalMemoryGetMappedBuffer' in found_functions}} - -cdef CUresult cuExternalMemoryGetMappedBuffer(CUdeviceptr* devPtr, CUexternalMemory extMem, const CUDA_EXTERNAL_MEMORY_BUFFER_DESC* bufferDesc) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuExternalMemoryGetMappedBuffer(devPtr, extMem, bufferDesc) -{{endif}} - -{{if 'cuExternalMemoryGetMappedMipmappedArray' in found_functions}} - -cdef CUresult cuExternalMemoryGetMappedMipmappedArray(CUmipmappedArray* mipmap, CUexternalMemory extMem, const CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC* mipmapDesc) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuExternalMemoryGetMappedMipmappedArray(mipmap, extMem, mipmapDesc) -{{endif}} - -{{if 'cuDestroyExternalMemory' in found_functions}} - -cdef CUresult cuDestroyExternalMemory(CUexternalMemory extMem) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuDestroyExternalMemory(extMem) -{{endif}} - -{{if 'cuImportExternalSemaphore' in found_functions}} - -cdef CUresult cuImportExternalSemaphore(CUexternalSemaphore* extSem_out, const CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC* semHandleDesc) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuImportExternalSemaphore(extSem_out, semHandleDesc) -{{endif}} - -{{if 'cuSignalExternalSemaphoresAsync' in found_functions}} - -cdef CUresult cuSignalExternalSemaphoresAsync(const CUexternalSemaphore* extSemArray, const CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS* paramsArray, unsigned int numExtSems, CUstream stream) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuSignalExternalSemaphoresAsync(extSemArray, paramsArray, numExtSems, stream) -{{endif}} - -{{if 'cuWaitExternalSemaphoresAsync' in found_functions}} - -cdef CUresult cuWaitExternalSemaphoresAsync(const CUexternalSemaphore* extSemArray, const CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS* paramsArray, unsigned int numExtSems, CUstream stream) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuWaitExternalSemaphoresAsync(extSemArray, paramsArray, numExtSems, stream) -{{endif}} - -{{if 'cuDestroyExternalSemaphore' in found_functions}} - -cdef CUresult cuDestroyExternalSemaphore(CUexternalSemaphore extSem) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuDestroyExternalSemaphore(extSem) -{{endif}} - -{{if 'cuStreamWaitValue32_v2' in found_functions}} - -cdef CUresult cuStreamWaitValue32(CUstream stream, CUdeviceptr addr, cuuint32_t value, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuStreamWaitValue32_v2(stream, addr, value, flags) -{{endif}} - -{{if 'cuStreamWaitValue64_v2' in found_functions}} - -cdef CUresult cuStreamWaitValue64(CUstream stream, CUdeviceptr addr, cuuint64_t value, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuStreamWaitValue64_v2(stream, addr, value, flags) -{{endif}} - -{{if 'cuStreamWriteValue32_v2' in found_functions}} - -cdef CUresult cuStreamWriteValue32(CUstream stream, CUdeviceptr addr, cuuint32_t value, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuStreamWriteValue32_v2(stream, addr, value, flags) -{{endif}} - -{{if 'cuStreamWriteValue64_v2' in found_functions}} - -cdef CUresult cuStreamWriteValue64(CUstream stream, CUdeviceptr addr, cuuint64_t value, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuStreamWriteValue64_v2(stream, addr, value, flags) -{{endif}} - -{{if 'cuStreamBatchMemOp_v2' in found_functions}} - -cdef CUresult cuStreamBatchMemOp(CUstream stream, unsigned int count, CUstreamBatchMemOpParams* paramArray, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuStreamBatchMemOp_v2(stream, count, paramArray, flags) -{{endif}} - -{{if 'cuFuncGetAttribute' in found_functions}} - -cdef CUresult cuFuncGetAttribute(int* pi, CUfunction_attribute attrib, CUfunction hfunc) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuFuncGetAttribute(pi, attrib, hfunc) -{{endif}} - -{{if 'cuFuncSetAttribute' in found_functions}} - -cdef CUresult cuFuncSetAttribute(CUfunction hfunc, CUfunction_attribute attrib, int value) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuFuncSetAttribute(hfunc, attrib, value) -{{endif}} - -{{if 'cuFuncSetCacheConfig' in found_functions}} - -cdef CUresult cuFuncSetCacheConfig(CUfunction hfunc, CUfunc_cache config) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuFuncSetCacheConfig(hfunc, config) -{{endif}} - -{{if 'cuFuncGetModule' in found_functions}} - -cdef CUresult cuFuncGetModule(CUmodule* hmod, CUfunction hfunc) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuFuncGetModule(hmod, hfunc) -{{endif}} - -{{if 'cuFuncGetName' in found_functions}} - -cdef CUresult cuFuncGetName(const char** name, CUfunction hfunc) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuFuncGetName(name, hfunc) -{{endif}} - -{{if 'cuFuncGetParamInfo' in found_functions}} - -cdef CUresult cuFuncGetParamInfo(CUfunction func, size_t paramIndex, size_t* paramOffset, size_t* paramSize) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuFuncGetParamInfo(func, paramIndex, paramOffset, paramSize) -{{endif}} - -{{if 'cuFuncIsLoaded' in found_functions}} - -cdef CUresult cuFuncIsLoaded(CUfunctionLoadingState* state, CUfunction function) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuFuncIsLoaded(state, function) -{{endif}} - -{{if 'cuFuncLoad' in found_functions}} - -cdef CUresult cuFuncLoad(CUfunction function) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuFuncLoad(function) -{{endif}} - -{{if 'cuLaunchKernel' in found_functions}} - -cdef CUresult cuLaunchKernel(CUfunction f, unsigned int gridDimX, unsigned int gridDimY, unsigned int gridDimZ, unsigned int blockDimX, unsigned int blockDimY, unsigned int blockDimZ, unsigned int sharedMemBytes, CUstream hStream, void** kernelParams, void** extra) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuLaunchKernel(f, gridDimX, gridDimY, gridDimZ, blockDimX, blockDimY, blockDimZ, sharedMemBytes, hStream, kernelParams, extra) -{{endif}} - -{{if 'cuLaunchKernelEx' in found_functions}} - -cdef CUresult cuLaunchKernelEx(const CUlaunchConfig* config, CUfunction f, void** kernelParams, void** extra) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuLaunchKernelEx(config, f, kernelParams, extra) -{{endif}} - -{{if 'cuLaunchCooperativeKernel' in found_functions}} - -cdef CUresult cuLaunchCooperativeKernel(CUfunction f, unsigned int gridDimX, unsigned int gridDimY, unsigned int gridDimZ, unsigned int blockDimX, unsigned int blockDimY, unsigned int blockDimZ, unsigned int sharedMemBytes, CUstream hStream, void** kernelParams) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuLaunchCooperativeKernel(f, gridDimX, gridDimY, gridDimZ, blockDimX, blockDimY, blockDimZ, sharedMemBytes, hStream, kernelParams) -{{endif}} - -{{if 'cuLaunchCooperativeKernelMultiDevice' in found_functions}} - -cdef CUresult cuLaunchCooperativeKernelMultiDevice(CUDA_LAUNCH_PARAMS* launchParamsList, unsigned int numDevices, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuLaunchCooperativeKernelMultiDevice(launchParamsList, numDevices, flags) -{{endif}} - -{{if 'cuLaunchHostFunc' in found_functions}} - -cdef CUresult cuLaunchHostFunc(CUstream hStream, CUhostFn fn, void* userData) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuLaunchHostFunc(hStream, fn, userData) -{{endif}} - -{{if 'cuFuncSetBlockShape' in found_functions}} - -cdef CUresult cuFuncSetBlockShape(CUfunction hfunc, int x, int y, int z) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuFuncSetBlockShape(hfunc, x, y, z) -{{endif}} - -{{if 'cuFuncSetSharedSize' in found_functions}} - -cdef CUresult cuFuncSetSharedSize(CUfunction hfunc, unsigned int numbytes) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuFuncSetSharedSize(hfunc, numbytes) -{{endif}} - -{{if 'cuParamSetSize' in found_functions}} - -cdef CUresult cuParamSetSize(CUfunction hfunc, unsigned int numbytes) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuParamSetSize(hfunc, numbytes) -{{endif}} - -{{if 'cuParamSeti' in found_functions}} - -cdef CUresult cuParamSeti(CUfunction hfunc, int offset, unsigned int value) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuParamSeti(hfunc, offset, value) -{{endif}} - -{{if 'cuParamSetf' in found_functions}} - -cdef CUresult cuParamSetf(CUfunction hfunc, int offset, float value) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuParamSetf(hfunc, offset, value) -{{endif}} - -{{if 'cuParamSetv' in found_functions}} - -cdef CUresult cuParamSetv(CUfunction hfunc, int offset, void* ptr, unsigned int numbytes) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuParamSetv(hfunc, offset, ptr, numbytes) -{{endif}} - -{{if 'cuLaunch' in found_functions}} - -cdef CUresult cuLaunch(CUfunction f) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuLaunch(f) -{{endif}} - -{{if 'cuLaunchGrid' in found_functions}} - -cdef CUresult cuLaunchGrid(CUfunction f, int grid_width, int grid_height) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuLaunchGrid(f, grid_width, grid_height) -{{endif}} - -{{if 'cuLaunchGridAsync' in found_functions}} - -cdef CUresult cuLaunchGridAsync(CUfunction f, int grid_width, int grid_height, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuLaunchGridAsync(f, grid_width, grid_height, hStream) -{{endif}} - -{{if 'cuParamSetTexRef' in found_functions}} - -cdef CUresult cuParamSetTexRef(CUfunction hfunc, int texunit, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuParamSetTexRef(hfunc, texunit, hTexRef) -{{endif}} - -{{if 'cuFuncSetSharedMemConfig' in found_functions}} - -cdef CUresult cuFuncSetSharedMemConfig(CUfunction hfunc, CUsharedconfig config) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuFuncSetSharedMemConfig(hfunc, config) -{{endif}} - -{{if 'cuGraphCreate' in found_functions}} - -cdef CUresult cuGraphCreate(CUgraph* phGraph, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphCreate(phGraph, flags) -{{endif}} - -{{if 'cuGraphAddKernelNode_v2' in found_functions}} - -cdef CUresult cuGraphAddKernelNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, const CUDA_KERNEL_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphAddKernelNode_v2(phGraphNode, hGraph, dependencies, numDependencies, nodeParams) -{{endif}} - -{{if 'cuGraphKernelNodeGetParams_v2' in found_functions}} - -cdef CUresult cuGraphKernelNodeGetParams(CUgraphNode hNode, CUDA_KERNEL_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphKernelNodeGetParams_v2(hNode, nodeParams) -{{endif}} - -{{if 'cuGraphKernelNodeSetParams_v2' in found_functions}} - -cdef CUresult cuGraphKernelNodeSetParams(CUgraphNode hNode, const CUDA_KERNEL_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphKernelNodeSetParams_v2(hNode, nodeParams) -{{endif}} - -{{if 'cuGraphAddMemcpyNode' in found_functions}} - -cdef CUresult cuGraphAddMemcpyNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, const CUDA_MEMCPY3D* copyParams, CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphAddMemcpyNode(phGraphNode, hGraph, dependencies, numDependencies, copyParams, ctx) -{{endif}} - -{{if 'cuGraphMemcpyNodeGetParams' in found_functions}} - -cdef CUresult cuGraphMemcpyNodeGetParams(CUgraphNode hNode, CUDA_MEMCPY3D* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphMemcpyNodeGetParams(hNode, nodeParams) -{{endif}} - -{{if 'cuGraphMemcpyNodeSetParams' in found_functions}} - -cdef CUresult cuGraphMemcpyNodeSetParams(CUgraphNode hNode, const CUDA_MEMCPY3D* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphMemcpyNodeSetParams(hNode, nodeParams) -{{endif}} - -{{if 'cuGraphAddMemsetNode' in found_functions}} - -cdef CUresult cuGraphAddMemsetNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, const CUDA_MEMSET_NODE_PARAMS* memsetParams, CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphAddMemsetNode(phGraphNode, hGraph, dependencies, numDependencies, memsetParams, ctx) -{{endif}} - -{{if 'cuGraphMemsetNodeGetParams' in found_functions}} - -cdef CUresult cuGraphMemsetNodeGetParams(CUgraphNode hNode, CUDA_MEMSET_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphMemsetNodeGetParams(hNode, nodeParams) -{{endif}} - -{{if 'cuGraphMemsetNodeSetParams' in found_functions}} - -cdef CUresult cuGraphMemsetNodeSetParams(CUgraphNode hNode, const CUDA_MEMSET_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphMemsetNodeSetParams(hNode, nodeParams) -{{endif}} - -{{if 'cuGraphAddHostNode' in found_functions}} - -cdef CUresult cuGraphAddHostNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, const CUDA_HOST_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphAddHostNode(phGraphNode, hGraph, dependencies, numDependencies, nodeParams) -{{endif}} - -{{if 'cuGraphHostNodeGetParams' in found_functions}} - -cdef CUresult cuGraphHostNodeGetParams(CUgraphNode hNode, CUDA_HOST_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphHostNodeGetParams(hNode, nodeParams) -{{endif}} - -{{if 'cuGraphHostNodeSetParams' in found_functions}} - -cdef CUresult cuGraphHostNodeSetParams(CUgraphNode hNode, const CUDA_HOST_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphHostNodeSetParams(hNode, nodeParams) -{{endif}} - -{{if 'cuGraphAddChildGraphNode' in found_functions}} - -cdef CUresult cuGraphAddChildGraphNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, CUgraph childGraph) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphAddChildGraphNode(phGraphNode, hGraph, dependencies, numDependencies, childGraph) -{{endif}} - -{{if 'cuGraphChildGraphNodeGetGraph' in found_functions}} - -cdef CUresult cuGraphChildGraphNodeGetGraph(CUgraphNode hNode, CUgraph* phGraph) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphChildGraphNodeGetGraph(hNode, phGraph) -{{endif}} - -{{if 'cuGraphAddEmptyNode' in found_functions}} - -cdef CUresult cuGraphAddEmptyNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphAddEmptyNode(phGraphNode, hGraph, dependencies, numDependencies) -{{endif}} - -{{if 'cuGraphAddEventRecordNode' in found_functions}} - -cdef CUresult cuGraphAddEventRecordNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, CUevent event) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphAddEventRecordNode(phGraphNode, hGraph, dependencies, numDependencies, event) -{{endif}} - -{{if 'cuGraphEventRecordNodeGetEvent' in found_functions}} - -cdef CUresult cuGraphEventRecordNodeGetEvent(CUgraphNode hNode, CUevent* event_out) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphEventRecordNodeGetEvent(hNode, event_out) -{{endif}} - -{{if 'cuGraphEventRecordNodeSetEvent' in found_functions}} - -cdef CUresult cuGraphEventRecordNodeSetEvent(CUgraphNode hNode, CUevent event) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphEventRecordNodeSetEvent(hNode, event) -{{endif}} - -{{if 'cuGraphAddEventWaitNode' in found_functions}} - -cdef CUresult cuGraphAddEventWaitNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, CUevent event) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphAddEventWaitNode(phGraphNode, hGraph, dependencies, numDependencies, event) -{{endif}} - -{{if 'cuGraphEventWaitNodeGetEvent' in found_functions}} - -cdef CUresult cuGraphEventWaitNodeGetEvent(CUgraphNode hNode, CUevent* event_out) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphEventWaitNodeGetEvent(hNode, event_out) -{{endif}} - -{{if 'cuGraphEventWaitNodeSetEvent' in found_functions}} - -cdef CUresult cuGraphEventWaitNodeSetEvent(CUgraphNode hNode, CUevent event) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphEventWaitNodeSetEvent(hNode, event) -{{endif}} - -{{if 'cuGraphAddExternalSemaphoresSignalNode' in found_functions}} - -cdef CUresult cuGraphAddExternalSemaphoresSignalNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, const CUDA_EXT_SEM_SIGNAL_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphAddExternalSemaphoresSignalNode(phGraphNode, hGraph, dependencies, numDependencies, nodeParams) -{{endif}} - -{{if 'cuGraphExternalSemaphoresSignalNodeGetParams' in found_functions}} - -cdef CUresult cuGraphExternalSemaphoresSignalNodeGetParams(CUgraphNode hNode, CUDA_EXT_SEM_SIGNAL_NODE_PARAMS* params_out) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphExternalSemaphoresSignalNodeGetParams(hNode, params_out) -{{endif}} - -{{if 'cuGraphExternalSemaphoresSignalNodeSetParams' in found_functions}} - -cdef CUresult cuGraphExternalSemaphoresSignalNodeSetParams(CUgraphNode hNode, const CUDA_EXT_SEM_SIGNAL_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphExternalSemaphoresSignalNodeSetParams(hNode, nodeParams) -{{endif}} - -{{if 'cuGraphAddExternalSemaphoresWaitNode' in found_functions}} - -cdef CUresult cuGraphAddExternalSemaphoresWaitNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, const CUDA_EXT_SEM_WAIT_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphAddExternalSemaphoresWaitNode(phGraphNode, hGraph, dependencies, numDependencies, nodeParams) -{{endif}} - -{{if 'cuGraphExternalSemaphoresWaitNodeGetParams' in found_functions}} - -cdef CUresult cuGraphExternalSemaphoresWaitNodeGetParams(CUgraphNode hNode, CUDA_EXT_SEM_WAIT_NODE_PARAMS* params_out) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphExternalSemaphoresWaitNodeGetParams(hNode, params_out) -{{endif}} - -{{if 'cuGraphExternalSemaphoresWaitNodeSetParams' in found_functions}} - -cdef CUresult cuGraphExternalSemaphoresWaitNodeSetParams(CUgraphNode hNode, const CUDA_EXT_SEM_WAIT_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphExternalSemaphoresWaitNodeSetParams(hNode, nodeParams) -{{endif}} - -{{if 'cuGraphAddBatchMemOpNode' in found_functions}} - -cdef CUresult cuGraphAddBatchMemOpNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, const CUDA_BATCH_MEM_OP_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphAddBatchMemOpNode(phGraphNode, hGraph, dependencies, numDependencies, nodeParams) -{{endif}} - -{{if 'cuGraphBatchMemOpNodeGetParams' in found_functions}} - -cdef CUresult cuGraphBatchMemOpNodeGetParams(CUgraphNode hNode, CUDA_BATCH_MEM_OP_NODE_PARAMS* nodeParams_out) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphBatchMemOpNodeGetParams(hNode, nodeParams_out) -{{endif}} - -{{if 'cuGraphBatchMemOpNodeSetParams' in found_functions}} - -cdef CUresult cuGraphBatchMemOpNodeSetParams(CUgraphNode hNode, const CUDA_BATCH_MEM_OP_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphBatchMemOpNodeSetParams(hNode, nodeParams) -{{endif}} - -{{if 'cuGraphExecBatchMemOpNodeSetParams' in found_functions}} - -cdef CUresult cuGraphExecBatchMemOpNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_BATCH_MEM_OP_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphExecBatchMemOpNodeSetParams(hGraphExec, hNode, nodeParams) -{{endif}} - -{{if 'cuGraphAddMemAllocNode' in found_functions}} - -cdef CUresult cuGraphAddMemAllocNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, CUDA_MEM_ALLOC_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphAddMemAllocNode(phGraphNode, hGraph, dependencies, numDependencies, nodeParams) -{{endif}} - -{{if 'cuGraphMemAllocNodeGetParams' in found_functions}} - -cdef CUresult cuGraphMemAllocNodeGetParams(CUgraphNode hNode, CUDA_MEM_ALLOC_NODE_PARAMS* params_out) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphMemAllocNodeGetParams(hNode, params_out) -{{endif}} - -{{if 'cuGraphAddMemFreeNode' in found_functions}} - -cdef CUresult cuGraphAddMemFreeNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, CUdeviceptr dptr) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphAddMemFreeNode(phGraphNode, hGraph, dependencies, numDependencies, dptr) -{{endif}} - -{{if 'cuGraphMemFreeNodeGetParams' in found_functions}} - -cdef CUresult cuGraphMemFreeNodeGetParams(CUgraphNode hNode, CUdeviceptr* dptr_out) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphMemFreeNodeGetParams(hNode, dptr_out) -{{endif}} - -{{if 'cuDeviceGraphMemTrim' in found_functions}} - -cdef CUresult cuDeviceGraphMemTrim(CUdevice device) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuDeviceGraphMemTrim(device) -{{endif}} - -{{if 'cuDeviceGetGraphMemAttribute' in found_functions}} - -cdef CUresult cuDeviceGetGraphMemAttribute(CUdevice device, CUgraphMem_attribute attr, void* value) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuDeviceGetGraphMemAttribute(device, attr, value) -{{endif}} - -{{if 'cuDeviceSetGraphMemAttribute' in found_functions}} - -cdef CUresult cuDeviceSetGraphMemAttribute(CUdevice device, CUgraphMem_attribute attr, void* value) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuDeviceSetGraphMemAttribute(device, attr, value) -{{endif}} - -{{if 'cuGraphClone' in found_functions}} - -cdef CUresult cuGraphClone(CUgraph* phGraphClone, CUgraph originalGraph) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphClone(phGraphClone, originalGraph) -{{endif}} - -{{if 'cuGraphNodeFindInClone' in found_functions}} - -cdef CUresult cuGraphNodeFindInClone(CUgraphNode* phNode, CUgraphNode hOriginalNode, CUgraph hClonedGraph) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphNodeFindInClone(phNode, hOriginalNode, hClonedGraph) -{{endif}} - -{{if 'cuGraphNodeGetType' in found_functions}} - -cdef CUresult cuGraphNodeGetType(CUgraphNode hNode, CUgraphNodeType* typename) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphNodeGetType(hNode, typename) -{{endif}} - -{{if 'cuGraphGetNodes' in found_functions}} - -cdef CUresult cuGraphGetNodes(CUgraph hGraph, CUgraphNode* nodes, size_t* numNodes) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphGetNodes(hGraph, nodes, numNodes) -{{endif}} - -{{if 'cuGraphGetRootNodes' in found_functions}} - -cdef CUresult cuGraphGetRootNodes(CUgraph hGraph, CUgraphNode* rootNodes, size_t* numRootNodes) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphGetRootNodes(hGraph, rootNodes, numRootNodes) -{{endif}} - -{{if 'cuGraphGetEdges' in found_functions}} - -cdef CUresult cuGraphGetEdges(CUgraph hGraph, CUgraphNode* from_, CUgraphNode* to, size_t* numEdges) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphGetEdges(hGraph, from_, to, numEdges) -{{endif}} - -{{if 'cuGraphGetEdges_v2' in found_functions}} - -cdef CUresult cuGraphGetEdges_v2(CUgraph hGraph, CUgraphNode* from_, CUgraphNode* to, CUgraphEdgeData* edgeData, size_t* numEdges) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphGetEdges_v2(hGraph, from_, to, edgeData, numEdges) -{{endif}} - -{{if 'cuGraphNodeGetDependencies' in found_functions}} - -cdef CUresult cuGraphNodeGetDependencies(CUgraphNode hNode, CUgraphNode* dependencies, size_t* numDependencies) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphNodeGetDependencies(hNode, dependencies, numDependencies) -{{endif}} - -{{if 'cuGraphNodeGetDependencies_v2' in found_functions}} - -cdef CUresult cuGraphNodeGetDependencies_v2(CUgraphNode hNode, CUgraphNode* dependencies, CUgraphEdgeData* edgeData, size_t* numDependencies) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphNodeGetDependencies_v2(hNode, dependencies, edgeData, numDependencies) -{{endif}} - -{{if 'cuGraphNodeGetDependentNodes' in found_functions}} - -cdef CUresult cuGraphNodeGetDependentNodes(CUgraphNode hNode, CUgraphNode* dependentNodes, size_t* numDependentNodes) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphNodeGetDependentNodes(hNode, dependentNodes, numDependentNodes) -{{endif}} - -{{if 'cuGraphNodeGetDependentNodes_v2' in found_functions}} - -cdef CUresult cuGraphNodeGetDependentNodes_v2(CUgraphNode hNode, CUgraphNode* dependentNodes, CUgraphEdgeData* edgeData, size_t* numDependentNodes) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphNodeGetDependentNodes_v2(hNode, dependentNodes, edgeData, numDependentNodes) -{{endif}} - -{{if 'cuGraphAddDependencies' in found_functions}} - -cdef CUresult cuGraphAddDependencies(CUgraph hGraph, const CUgraphNode* from_, const CUgraphNode* to, size_t numDependencies) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphAddDependencies(hGraph, from_, to, numDependencies) -{{endif}} - -{{if 'cuGraphAddDependencies_v2' in found_functions}} - -cdef CUresult cuGraphAddDependencies_v2(CUgraph hGraph, const CUgraphNode* from_, const CUgraphNode* to, const CUgraphEdgeData* edgeData, size_t numDependencies) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphAddDependencies_v2(hGraph, from_, to, edgeData, numDependencies) -{{endif}} - -{{if 'cuGraphRemoveDependencies' in found_functions}} - -cdef CUresult cuGraphRemoveDependencies(CUgraph hGraph, const CUgraphNode* from_, const CUgraphNode* to, size_t numDependencies) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphRemoveDependencies(hGraph, from_, to, numDependencies) -{{endif}} - -{{if 'cuGraphRemoveDependencies_v2' in found_functions}} - -cdef CUresult cuGraphRemoveDependencies_v2(CUgraph hGraph, const CUgraphNode* from_, const CUgraphNode* to, const CUgraphEdgeData* edgeData, size_t numDependencies) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphRemoveDependencies_v2(hGraph, from_, to, edgeData, numDependencies) -{{endif}} - -{{if 'cuGraphDestroyNode' in found_functions}} - -cdef CUresult cuGraphDestroyNode(CUgraphNode hNode) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphDestroyNode(hNode) -{{endif}} - -{{if 'cuGraphInstantiateWithFlags' in found_functions}} - -cdef CUresult cuGraphInstantiate(CUgraphExec* phGraphExec, CUgraph hGraph, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphInstantiateWithFlags(phGraphExec, hGraph, flags) -{{endif}} - -{{if 'cuGraphInstantiateWithParams' in found_functions}} - -cdef CUresult cuGraphInstantiateWithParams(CUgraphExec* phGraphExec, CUgraph hGraph, CUDA_GRAPH_INSTANTIATE_PARAMS* instantiateParams) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphInstantiateWithParams(phGraphExec, hGraph, instantiateParams) -{{endif}} - -{{if 'cuGraphExecGetFlags' in found_functions}} - -cdef CUresult cuGraphExecGetFlags(CUgraphExec hGraphExec, cuuint64_t* flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphExecGetFlags(hGraphExec, flags) -{{endif}} - -{{if 'cuGraphExecKernelNodeSetParams_v2' in found_functions}} - -cdef CUresult cuGraphExecKernelNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_KERNEL_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphExecKernelNodeSetParams_v2(hGraphExec, hNode, nodeParams) -{{endif}} - -{{if 'cuGraphExecMemcpyNodeSetParams' in found_functions}} - -cdef CUresult cuGraphExecMemcpyNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_MEMCPY3D* copyParams, CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphExecMemcpyNodeSetParams(hGraphExec, hNode, copyParams, ctx) -{{endif}} - -{{if 'cuGraphExecMemsetNodeSetParams' in found_functions}} - -cdef CUresult cuGraphExecMemsetNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_MEMSET_NODE_PARAMS* memsetParams, CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphExecMemsetNodeSetParams(hGraphExec, hNode, memsetParams, ctx) -{{endif}} - -{{if 'cuGraphExecHostNodeSetParams' in found_functions}} - -cdef CUresult cuGraphExecHostNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_HOST_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphExecHostNodeSetParams(hGraphExec, hNode, nodeParams) -{{endif}} - -{{if 'cuGraphExecChildGraphNodeSetParams' in found_functions}} - -cdef CUresult cuGraphExecChildGraphNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, CUgraph childGraph) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphExecChildGraphNodeSetParams(hGraphExec, hNode, childGraph) -{{endif}} - -{{if 'cuGraphExecEventRecordNodeSetEvent' in found_functions}} - -cdef CUresult cuGraphExecEventRecordNodeSetEvent(CUgraphExec hGraphExec, CUgraphNode hNode, CUevent event) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphExecEventRecordNodeSetEvent(hGraphExec, hNode, event) -{{endif}} - -{{if 'cuGraphExecEventWaitNodeSetEvent' in found_functions}} - -cdef CUresult cuGraphExecEventWaitNodeSetEvent(CUgraphExec hGraphExec, CUgraphNode hNode, CUevent event) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphExecEventWaitNodeSetEvent(hGraphExec, hNode, event) -{{endif}} - -{{if 'cuGraphExecExternalSemaphoresSignalNodeSetParams' in found_functions}} - -cdef CUresult cuGraphExecExternalSemaphoresSignalNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_EXT_SEM_SIGNAL_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphExecExternalSemaphoresSignalNodeSetParams(hGraphExec, hNode, nodeParams) -{{endif}} - -{{if 'cuGraphExecExternalSemaphoresWaitNodeSetParams' in found_functions}} - -cdef CUresult cuGraphExecExternalSemaphoresWaitNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_EXT_SEM_WAIT_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphExecExternalSemaphoresWaitNodeSetParams(hGraphExec, hNode, nodeParams) -{{endif}} - -{{if 'cuGraphNodeSetEnabled' in found_functions}} - -cdef CUresult cuGraphNodeSetEnabled(CUgraphExec hGraphExec, CUgraphNode hNode, unsigned int isEnabled) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphNodeSetEnabled(hGraphExec, hNode, isEnabled) -{{endif}} - -{{if 'cuGraphNodeGetEnabled' in found_functions}} - -cdef CUresult cuGraphNodeGetEnabled(CUgraphExec hGraphExec, CUgraphNode hNode, unsigned int* isEnabled) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphNodeGetEnabled(hGraphExec, hNode, isEnabled) -{{endif}} - -{{if 'cuGraphUpload' in found_functions}} - -cdef CUresult cuGraphUpload(CUgraphExec hGraphExec, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphUpload(hGraphExec, hStream) -{{endif}} - -{{if 'cuGraphLaunch' in found_functions}} - -cdef CUresult cuGraphLaunch(CUgraphExec hGraphExec, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphLaunch(hGraphExec, hStream) -{{endif}} - -{{if 'cuGraphExecDestroy' in found_functions}} - -cdef CUresult cuGraphExecDestroy(CUgraphExec hGraphExec) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphExecDestroy(hGraphExec) -{{endif}} - -{{if 'cuGraphDestroy' in found_functions}} - -cdef CUresult cuGraphDestroy(CUgraph hGraph) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphDestroy(hGraph) -{{endif}} - -{{if 'cuGraphExecUpdate_v2' in found_functions}} - -cdef CUresult cuGraphExecUpdate(CUgraphExec hGraphExec, CUgraph hGraph, CUgraphExecUpdateResultInfo* resultInfo) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphExecUpdate_v2(hGraphExec, hGraph, resultInfo) -{{endif}} - -{{if 'cuGraphKernelNodeCopyAttributes' in found_functions}} - -cdef CUresult cuGraphKernelNodeCopyAttributes(CUgraphNode dst, CUgraphNode src) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphKernelNodeCopyAttributes(dst, src) -{{endif}} - -{{if 'cuGraphKernelNodeGetAttribute' in found_functions}} - -cdef CUresult cuGraphKernelNodeGetAttribute(CUgraphNode hNode, CUkernelNodeAttrID attr, CUkernelNodeAttrValue* value_out) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphKernelNodeGetAttribute(hNode, attr, value_out) -{{endif}} - -{{if 'cuGraphKernelNodeSetAttribute' in found_functions}} - -cdef CUresult cuGraphKernelNodeSetAttribute(CUgraphNode hNode, CUkernelNodeAttrID attr, const CUkernelNodeAttrValue* value) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphKernelNodeSetAttribute(hNode, attr, value) -{{endif}} - -{{if 'cuGraphDebugDotPrint' in found_functions}} - -cdef CUresult cuGraphDebugDotPrint(CUgraph hGraph, const char* path, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphDebugDotPrint(hGraph, path, flags) -{{endif}} - -{{if 'cuUserObjectCreate' in found_functions}} - -cdef CUresult cuUserObjectCreate(CUuserObject* object_out, void* ptr, CUhostFn destroy, unsigned int initialRefcount, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuUserObjectCreate(object_out, ptr, destroy, initialRefcount, flags) -{{endif}} - -{{if 'cuUserObjectRetain' in found_functions}} - -cdef CUresult cuUserObjectRetain(CUuserObject object, unsigned int count) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuUserObjectRetain(object, count) -{{endif}} - -{{if 'cuUserObjectRelease' in found_functions}} - -cdef CUresult cuUserObjectRelease(CUuserObject object, unsigned int count) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuUserObjectRelease(object, count) -{{endif}} - -{{if 'cuGraphRetainUserObject' in found_functions}} - -cdef CUresult cuGraphRetainUserObject(CUgraph graph, CUuserObject object, unsigned int count, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphRetainUserObject(graph, object, count, flags) -{{endif}} - -{{if 'cuGraphReleaseUserObject' in found_functions}} - -cdef CUresult cuGraphReleaseUserObject(CUgraph graph, CUuserObject object, unsigned int count) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphReleaseUserObject(graph, object, count) -{{endif}} - -{{if 'cuGraphAddNode' in found_functions}} - -cdef CUresult cuGraphAddNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, CUgraphNodeParams* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphAddNode(phGraphNode, hGraph, dependencies, numDependencies, nodeParams) -{{endif}} - -{{if 'cuGraphAddNode_v2' in found_functions}} - -cdef CUresult cuGraphAddNode_v2(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, const CUgraphEdgeData* dependencyData, size_t numDependencies, CUgraphNodeParams* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphAddNode_v2(phGraphNode, hGraph, dependencies, dependencyData, numDependencies, nodeParams) -{{endif}} - -{{if 'cuGraphNodeSetParams' in found_functions}} - -cdef CUresult cuGraphNodeSetParams(CUgraphNode hNode, CUgraphNodeParams* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphNodeSetParams(hNode, nodeParams) -{{endif}} - -{{if 'cuGraphExecNodeSetParams' in found_functions}} - -cdef CUresult cuGraphExecNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, CUgraphNodeParams* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphExecNodeSetParams(hGraphExec, hNode, nodeParams) -{{endif}} - -{{if 'cuGraphConditionalHandleCreate' in found_functions}} - -cdef CUresult cuGraphConditionalHandleCreate(CUgraphConditionalHandle* pHandle_out, CUgraph hGraph, CUcontext ctx, unsigned int defaultLaunchValue, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphConditionalHandleCreate(pHandle_out, hGraph, ctx, defaultLaunchValue, flags) -{{endif}} - -{{if 'cuOccupancyMaxActiveBlocksPerMultiprocessor' in found_functions}} - -cdef CUresult cuOccupancyMaxActiveBlocksPerMultiprocessor(int* numBlocks, CUfunction func, int blockSize, size_t dynamicSMemSize) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuOccupancyMaxActiveBlocksPerMultiprocessor(numBlocks, func, blockSize, dynamicSMemSize) -{{endif}} - -{{if 'cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags' in found_functions}} - -cdef CUresult cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(int* numBlocks, CUfunction func, int blockSize, size_t dynamicSMemSize, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(numBlocks, func, blockSize, dynamicSMemSize, flags) -{{endif}} - -{{if 'cuOccupancyMaxPotentialBlockSize' in found_functions}} - -cdef CUresult cuOccupancyMaxPotentialBlockSize(int* minGridSize, int* blockSize, CUfunction func, CUoccupancyB2DSize blockSizeToDynamicSMemSize, size_t dynamicSMemSize, int blockSizeLimit) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuOccupancyMaxPotentialBlockSize(minGridSize, blockSize, func, blockSizeToDynamicSMemSize, dynamicSMemSize, blockSizeLimit) -{{endif}} - -{{if 'cuOccupancyMaxPotentialBlockSizeWithFlags' in found_functions}} - -cdef CUresult cuOccupancyMaxPotentialBlockSizeWithFlags(int* minGridSize, int* blockSize, CUfunction func, CUoccupancyB2DSize blockSizeToDynamicSMemSize, size_t dynamicSMemSize, int blockSizeLimit, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuOccupancyMaxPotentialBlockSizeWithFlags(minGridSize, blockSize, func, blockSizeToDynamicSMemSize, dynamicSMemSize, blockSizeLimit, flags) -{{endif}} - -{{if 'cuOccupancyAvailableDynamicSMemPerBlock' in found_functions}} - -cdef CUresult cuOccupancyAvailableDynamicSMemPerBlock(size_t* dynamicSmemSize, CUfunction func, int numBlocks, int blockSize) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuOccupancyAvailableDynamicSMemPerBlock(dynamicSmemSize, func, numBlocks, blockSize) -{{endif}} - -{{if 'cuOccupancyMaxPotentialClusterSize' in found_functions}} - -cdef CUresult cuOccupancyMaxPotentialClusterSize(int* clusterSize, CUfunction func, const CUlaunchConfig* config) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuOccupancyMaxPotentialClusterSize(clusterSize, func, config) -{{endif}} - -{{if 'cuOccupancyMaxActiveClusters' in found_functions}} - -cdef CUresult cuOccupancyMaxActiveClusters(int* numClusters, CUfunction func, const CUlaunchConfig* config) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuOccupancyMaxActiveClusters(numClusters, func, config) -{{endif}} - -{{if 'cuTexRefSetArray' in found_functions}} - -cdef CUresult cuTexRefSetArray(CUtexref hTexRef, CUarray hArray, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuTexRefSetArray(hTexRef, hArray, Flags) -{{endif}} - -{{if 'cuTexRefSetMipmappedArray' in found_functions}} - -cdef CUresult cuTexRefSetMipmappedArray(CUtexref hTexRef, CUmipmappedArray hMipmappedArray, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuTexRefSetMipmappedArray(hTexRef, hMipmappedArray, Flags) -{{endif}} - -{{if 'cuTexRefSetAddress_v2' in found_functions}} - -cdef CUresult cuTexRefSetAddress(size_t* ByteOffset, CUtexref hTexRef, CUdeviceptr dptr, size_t numbytes) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuTexRefSetAddress_v2(ByteOffset, hTexRef, dptr, numbytes) -{{endif}} - -{{if 'cuTexRefSetAddress2D_v3' in found_functions}} - -cdef CUresult cuTexRefSetAddress2D(CUtexref hTexRef, const CUDA_ARRAY_DESCRIPTOR* desc, CUdeviceptr dptr, size_t Pitch) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuTexRefSetAddress2D_v3(hTexRef, desc, dptr, Pitch) -{{endif}} - -{{if 'cuTexRefSetFormat' in found_functions}} - -cdef CUresult cuTexRefSetFormat(CUtexref hTexRef, CUarray_format fmt, int NumPackedComponents) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuTexRefSetFormat(hTexRef, fmt, NumPackedComponents) -{{endif}} - -{{if 'cuTexRefSetAddressMode' in found_functions}} - -cdef CUresult cuTexRefSetAddressMode(CUtexref hTexRef, int dim, CUaddress_mode am) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuTexRefSetAddressMode(hTexRef, dim, am) -{{endif}} - -{{if 'cuTexRefSetFilterMode' in found_functions}} - -cdef CUresult cuTexRefSetFilterMode(CUtexref hTexRef, CUfilter_mode fm) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuTexRefSetFilterMode(hTexRef, fm) -{{endif}} - -{{if 'cuTexRefSetMipmapFilterMode' in found_functions}} - -cdef CUresult cuTexRefSetMipmapFilterMode(CUtexref hTexRef, CUfilter_mode fm) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuTexRefSetMipmapFilterMode(hTexRef, fm) -{{endif}} - -{{if 'cuTexRefSetMipmapLevelBias' in found_functions}} - -cdef CUresult cuTexRefSetMipmapLevelBias(CUtexref hTexRef, float bias) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuTexRefSetMipmapLevelBias(hTexRef, bias) -{{endif}} - -{{if 'cuTexRefSetMipmapLevelClamp' in found_functions}} - -cdef CUresult cuTexRefSetMipmapLevelClamp(CUtexref hTexRef, float minMipmapLevelClamp, float maxMipmapLevelClamp) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuTexRefSetMipmapLevelClamp(hTexRef, minMipmapLevelClamp, maxMipmapLevelClamp) -{{endif}} - -{{if 'cuTexRefSetMaxAnisotropy' in found_functions}} - -cdef CUresult cuTexRefSetMaxAnisotropy(CUtexref hTexRef, unsigned int maxAniso) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuTexRefSetMaxAnisotropy(hTexRef, maxAniso) -{{endif}} - -{{if 'cuTexRefSetBorderColor' in found_functions}} - -cdef CUresult cuTexRefSetBorderColor(CUtexref hTexRef, float* pBorderColor) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuTexRefSetBorderColor(hTexRef, pBorderColor) -{{endif}} - -{{if 'cuTexRefSetFlags' in found_functions}} - -cdef CUresult cuTexRefSetFlags(CUtexref hTexRef, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuTexRefSetFlags(hTexRef, Flags) -{{endif}} - -{{if 'cuTexRefGetAddress_v2' in found_functions}} - -cdef CUresult cuTexRefGetAddress(CUdeviceptr* pdptr, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuTexRefGetAddress_v2(pdptr, hTexRef) -{{endif}} - -{{if 'cuTexRefGetArray' in found_functions}} - -cdef CUresult cuTexRefGetArray(CUarray* phArray, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuTexRefGetArray(phArray, hTexRef) -{{endif}} - -{{if 'cuTexRefGetMipmappedArray' in found_functions}} - -cdef CUresult cuTexRefGetMipmappedArray(CUmipmappedArray* phMipmappedArray, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuTexRefGetMipmappedArray(phMipmappedArray, hTexRef) -{{endif}} - -{{if 'cuTexRefGetAddressMode' in found_functions}} - -cdef CUresult cuTexRefGetAddressMode(CUaddress_mode* pam, CUtexref hTexRef, int dim) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuTexRefGetAddressMode(pam, hTexRef, dim) -{{endif}} - -{{if 'cuTexRefGetFilterMode' in found_functions}} - -cdef CUresult cuTexRefGetFilterMode(CUfilter_mode* pfm, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuTexRefGetFilterMode(pfm, hTexRef) -{{endif}} - -{{if 'cuTexRefGetFormat' in found_functions}} - -cdef CUresult cuTexRefGetFormat(CUarray_format* pFormat, int* pNumChannels, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuTexRefGetFormat(pFormat, pNumChannels, hTexRef) -{{endif}} - -{{if 'cuTexRefGetMipmapFilterMode' in found_functions}} - -cdef CUresult cuTexRefGetMipmapFilterMode(CUfilter_mode* pfm, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuTexRefGetMipmapFilterMode(pfm, hTexRef) -{{endif}} - -{{if 'cuTexRefGetMipmapLevelBias' in found_functions}} - -cdef CUresult cuTexRefGetMipmapLevelBias(float* pbias, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuTexRefGetMipmapLevelBias(pbias, hTexRef) -{{endif}} - -{{if 'cuTexRefGetMipmapLevelClamp' in found_functions}} - -cdef CUresult cuTexRefGetMipmapLevelClamp(float* pminMipmapLevelClamp, float* pmaxMipmapLevelClamp, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuTexRefGetMipmapLevelClamp(pminMipmapLevelClamp, pmaxMipmapLevelClamp, hTexRef) -{{endif}} - -{{if 'cuTexRefGetMaxAnisotropy' in found_functions}} - -cdef CUresult cuTexRefGetMaxAnisotropy(int* pmaxAniso, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuTexRefGetMaxAnisotropy(pmaxAniso, hTexRef) -{{endif}} - -{{if 'cuTexRefGetBorderColor' in found_functions}} - -cdef CUresult cuTexRefGetBorderColor(float* pBorderColor, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuTexRefGetBorderColor(pBorderColor, hTexRef) -{{endif}} - -{{if 'cuTexRefGetFlags' in found_functions}} - -cdef CUresult cuTexRefGetFlags(unsigned int* pFlags, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuTexRefGetFlags(pFlags, hTexRef) -{{endif}} - -{{if 'cuTexRefCreate' in found_functions}} - -cdef CUresult cuTexRefCreate(CUtexref* pTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuTexRefCreate(pTexRef) -{{endif}} - -{{if 'cuTexRefDestroy' in found_functions}} - -cdef CUresult cuTexRefDestroy(CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuTexRefDestroy(hTexRef) -{{endif}} - -{{if 'cuSurfRefSetArray' in found_functions}} - -cdef CUresult cuSurfRefSetArray(CUsurfref hSurfRef, CUarray hArray, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuSurfRefSetArray(hSurfRef, hArray, Flags) -{{endif}} - -{{if 'cuSurfRefGetArray' in found_functions}} - -cdef CUresult cuSurfRefGetArray(CUarray* phArray, CUsurfref hSurfRef) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuSurfRefGetArray(phArray, hSurfRef) -{{endif}} - -{{if 'cuTexObjectCreate' in found_functions}} - -cdef CUresult cuTexObjectCreate(CUtexObject* pTexObject, const CUDA_RESOURCE_DESC* pResDesc, const CUDA_TEXTURE_DESC* pTexDesc, const CUDA_RESOURCE_VIEW_DESC* pResViewDesc) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuTexObjectCreate(pTexObject, pResDesc, pTexDesc, pResViewDesc) -{{endif}} - -{{if 'cuTexObjectDestroy' in found_functions}} - -cdef CUresult cuTexObjectDestroy(CUtexObject texObject) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuTexObjectDestroy(texObject) -{{endif}} - -{{if 'cuTexObjectGetResourceDesc' in found_functions}} - -cdef CUresult cuTexObjectGetResourceDesc(CUDA_RESOURCE_DESC* pResDesc, CUtexObject texObject) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuTexObjectGetResourceDesc(pResDesc, texObject) -{{endif}} - -{{if 'cuTexObjectGetTextureDesc' in found_functions}} - -cdef CUresult cuTexObjectGetTextureDesc(CUDA_TEXTURE_DESC* pTexDesc, CUtexObject texObject) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuTexObjectGetTextureDesc(pTexDesc, texObject) -{{endif}} - -{{if 'cuTexObjectGetResourceViewDesc' in found_functions}} - -cdef CUresult cuTexObjectGetResourceViewDesc(CUDA_RESOURCE_VIEW_DESC* pResViewDesc, CUtexObject texObject) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuTexObjectGetResourceViewDesc(pResViewDesc, texObject) -{{endif}} - -{{if 'cuSurfObjectCreate' in found_functions}} - -cdef CUresult cuSurfObjectCreate(CUsurfObject* pSurfObject, const CUDA_RESOURCE_DESC* pResDesc) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuSurfObjectCreate(pSurfObject, pResDesc) -{{endif}} - -{{if 'cuSurfObjectDestroy' in found_functions}} - -cdef CUresult cuSurfObjectDestroy(CUsurfObject surfObject) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuSurfObjectDestroy(surfObject) -{{endif}} - -{{if 'cuSurfObjectGetResourceDesc' in found_functions}} - -cdef CUresult cuSurfObjectGetResourceDesc(CUDA_RESOURCE_DESC* pResDesc, CUsurfObject surfObject) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuSurfObjectGetResourceDesc(pResDesc, surfObject) -{{endif}} - -{{if 'cuTensorMapEncodeTiled' in found_functions}} - -cdef CUresult cuTensorMapEncodeTiled(CUtensorMap* tensorMap, CUtensorMapDataType tensorDataType, cuuint32_t tensorRank, void* globalAddress, const cuuint64_t* globalDim, const cuuint64_t* globalStrides, const cuuint32_t* boxDim, const cuuint32_t* elementStrides, CUtensorMapInterleave interleave, CUtensorMapSwizzle swizzle, CUtensorMapL2promotion l2Promotion, CUtensorMapFloatOOBfill oobFill) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuTensorMapEncodeTiled(tensorMap, tensorDataType, tensorRank, globalAddress, globalDim, globalStrides, boxDim, elementStrides, interleave, swizzle, l2Promotion, oobFill) -{{endif}} - -{{if 'cuTensorMapEncodeIm2col' in found_functions}} - -cdef CUresult cuTensorMapEncodeIm2col(CUtensorMap* tensorMap, CUtensorMapDataType tensorDataType, cuuint32_t tensorRank, void* globalAddress, const cuuint64_t* globalDim, const cuuint64_t* globalStrides, const int* pixelBoxLowerCorner, const int* pixelBoxUpperCorner, cuuint32_t channelsPerPixel, cuuint32_t pixelsPerColumn, const cuuint32_t* elementStrides, CUtensorMapInterleave interleave, CUtensorMapSwizzle swizzle, CUtensorMapL2promotion l2Promotion, CUtensorMapFloatOOBfill oobFill) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuTensorMapEncodeIm2col(tensorMap, tensorDataType, tensorRank, globalAddress, globalDim, globalStrides, pixelBoxLowerCorner, pixelBoxUpperCorner, channelsPerPixel, pixelsPerColumn, elementStrides, interleave, swizzle, l2Promotion, oobFill) -{{endif}} - -{{if 'cuTensorMapReplaceAddress' in found_functions}} - -cdef CUresult cuTensorMapReplaceAddress(CUtensorMap* tensorMap, void* globalAddress) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuTensorMapReplaceAddress(tensorMap, globalAddress) -{{endif}} - -{{if 'cuDeviceCanAccessPeer' in found_functions}} - -cdef CUresult cuDeviceCanAccessPeer(int* canAccessPeer, CUdevice dev, CUdevice peerDev) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuDeviceCanAccessPeer(canAccessPeer, dev, peerDev) -{{endif}} - -{{if 'cuCtxEnablePeerAccess' in found_functions}} - -cdef CUresult cuCtxEnablePeerAccess(CUcontext peerContext, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuCtxEnablePeerAccess(peerContext, Flags) -{{endif}} - -{{if 'cuCtxDisablePeerAccess' in found_functions}} - -cdef CUresult cuCtxDisablePeerAccess(CUcontext peerContext) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuCtxDisablePeerAccess(peerContext) -{{endif}} - -{{if 'cuDeviceGetP2PAttribute' in found_functions}} - -cdef CUresult cuDeviceGetP2PAttribute(int* value, CUdevice_P2PAttribute attrib, CUdevice srcDevice, CUdevice dstDevice) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuDeviceGetP2PAttribute(value, attrib, srcDevice, dstDevice) -{{endif}} - -{{if 'cuGraphicsUnregisterResource' in found_functions}} - -cdef CUresult cuGraphicsUnregisterResource(CUgraphicsResource resource) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphicsUnregisterResource(resource) -{{endif}} - -{{if 'cuGraphicsSubResourceGetMappedArray' in found_functions}} - -cdef CUresult cuGraphicsSubResourceGetMappedArray(CUarray* pArray, CUgraphicsResource resource, unsigned int arrayIndex, unsigned int mipLevel) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphicsSubResourceGetMappedArray(pArray, resource, arrayIndex, mipLevel) -{{endif}} - -{{if 'cuGraphicsResourceGetMappedMipmappedArray' in found_functions}} - -cdef CUresult cuGraphicsResourceGetMappedMipmappedArray(CUmipmappedArray* pMipmappedArray, CUgraphicsResource resource) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphicsResourceGetMappedMipmappedArray(pMipmappedArray, resource) -{{endif}} - -{{if 'cuGraphicsResourceGetMappedPointer_v2' in found_functions}} - -cdef CUresult cuGraphicsResourceGetMappedPointer(CUdeviceptr* pDevPtr, size_t* pSize, CUgraphicsResource resource) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphicsResourceGetMappedPointer_v2(pDevPtr, pSize, resource) -{{endif}} - -{{if 'cuGraphicsResourceSetMapFlags_v2' in found_functions}} - -cdef CUresult cuGraphicsResourceSetMapFlags(CUgraphicsResource resource, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphicsResourceSetMapFlags_v2(resource, flags) -{{endif}} - -{{if 'cuGraphicsMapResources' in found_functions}} - -cdef CUresult cuGraphicsMapResources(unsigned int count, CUgraphicsResource* resources, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphicsMapResources(count, resources, hStream) -{{endif}} - -{{if 'cuGraphicsUnmapResources' in found_functions}} - -cdef CUresult cuGraphicsUnmapResources(unsigned int count, CUgraphicsResource* resources, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphicsUnmapResources(count, resources, hStream) -{{endif}} - -{{if 'cuGetProcAddress_v2' in found_functions}} - -cdef CUresult cuGetProcAddress(const char* symbol, void** pfn, int cudaVersion, cuuint64_t flags, CUdriverProcAddressQueryResult* symbolStatus) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGetProcAddress_v2(symbol, pfn, cudaVersion, flags, symbolStatus) -{{endif}} - -{{if 'cuCoredumpGetAttribute' in found_functions}} - -cdef CUresult cuCoredumpGetAttribute(CUcoredumpSettings attrib, void* value, size_t* size) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuCoredumpGetAttribute(attrib, value, size) -{{endif}} - -{{if 'cuCoredumpGetAttributeGlobal' in found_functions}} - -cdef CUresult cuCoredumpGetAttributeGlobal(CUcoredumpSettings attrib, void* value, size_t* size) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuCoredumpGetAttributeGlobal(attrib, value, size) -{{endif}} - -{{if 'cuCoredumpSetAttribute' in found_functions}} - -cdef CUresult cuCoredumpSetAttribute(CUcoredumpSettings attrib, void* value, size_t* size) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuCoredumpSetAttribute(attrib, value, size) -{{endif}} - -{{if 'cuCoredumpSetAttributeGlobal' in found_functions}} - -cdef CUresult cuCoredumpSetAttributeGlobal(CUcoredumpSettings attrib, void* value, size_t* size) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuCoredumpSetAttributeGlobal(attrib, value, size) -{{endif}} - -{{if 'cuGetExportTable' in found_functions}} - -cdef CUresult cuGetExportTable(const void** ppExportTable, const CUuuid* pExportTableId) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGetExportTable(ppExportTable, pExportTableId) -{{endif}} - -{{if 'cuGreenCtxCreate' in found_functions}} - -cdef CUresult cuGreenCtxCreate(CUgreenCtx* phCtx, CUdevResourceDesc desc, CUdevice dev, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGreenCtxCreate(phCtx, desc, dev, flags) -{{endif}} - -{{if 'cuGreenCtxDestroy' in found_functions}} - -cdef CUresult cuGreenCtxDestroy(CUgreenCtx hCtx) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGreenCtxDestroy(hCtx) -{{endif}} - -{{if 'cuCtxFromGreenCtx' in found_functions}} - -cdef CUresult cuCtxFromGreenCtx(CUcontext* pContext, CUgreenCtx hCtx) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuCtxFromGreenCtx(pContext, hCtx) -{{endif}} - -{{if 'cuDeviceGetDevResource' in found_functions}} - -cdef CUresult cuDeviceGetDevResource(CUdevice device, CUdevResource* resource, CUdevResourceType typename) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuDeviceGetDevResource(device, resource, typename) -{{endif}} - -{{if 'cuCtxGetDevResource' in found_functions}} - -cdef CUresult cuCtxGetDevResource(CUcontext hCtx, CUdevResource* resource, CUdevResourceType typename) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuCtxGetDevResource(hCtx, resource, typename) -{{endif}} - -{{if 'cuGreenCtxGetDevResource' in found_functions}} - -cdef CUresult cuGreenCtxGetDevResource(CUgreenCtx hCtx, CUdevResource* resource, CUdevResourceType typename) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGreenCtxGetDevResource(hCtx, resource, typename) -{{endif}} - -{{if 'cuDevSmResourceSplitByCount' in found_functions}} - -cdef CUresult cuDevSmResourceSplitByCount(CUdevResource* result, unsigned int* nbGroups, const CUdevResource* input, CUdevResource* remaining, unsigned int useFlags, unsigned int minCount) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuDevSmResourceSplitByCount(result, nbGroups, input, remaining, useFlags, minCount) -{{endif}} - -{{if 'cuDevResourceGenerateDesc' in found_functions}} - -cdef CUresult cuDevResourceGenerateDesc(CUdevResourceDesc* phDesc, CUdevResource* resources, unsigned int nbResources) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuDevResourceGenerateDesc(phDesc, resources, nbResources) -{{endif}} - -{{if 'cuGreenCtxRecordEvent' in found_functions}} - -cdef CUresult cuGreenCtxRecordEvent(CUgreenCtx hCtx, CUevent hEvent) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGreenCtxRecordEvent(hCtx, hEvent) -{{endif}} - -{{if 'cuGreenCtxWaitEvent' in found_functions}} - -cdef CUresult cuGreenCtxWaitEvent(CUgreenCtx hCtx, CUevent hEvent) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGreenCtxWaitEvent(hCtx, hEvent) -{{endif}} - -{{if 'cuStreamGetGreenCtx' in found_functions}} - -cdef CUresult cuStreamGetGreenCtx(CUstream hStream, CUgreenCtx* phCtx) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuStreamGetGreenCtx(hStream, phCtx) -{{endif}} - -{{if 'cuGreenCtxStreamCreate' in found_functions}} - -cdef CUresult cuGreenCtxStreamCreate(CUstream* phStream, CUgreenCtx greenCtx, unsigned int flags, int priority) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGreenCtxStreamCreate(phStream, greenCtx, flags, priority) -{{endif}} - -{{if 'cuProfilerStart' in found_functions}} - -cdef CUresult cuProfilerStart() except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuProfilerStart() -{{endif}} - -{{if 'cuProfilerStop' in found_functions}} - -cdef CUresult cuProfilerStop() except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuProfilerStop() -{{endif}} - -{{if True}} - -cdef CUresult cuGraphicsEGLRegisterImage(CUgraphicsResource* pCudaResource, EGLImageKHR image, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphicsEGLRegisterImage(pCudaResource, image, flags) -{{endif}} - -{{if True}} - -cdef CUresult cuEGLStreamConsumerConnect(CUeglStreamConnection* conn, EGLStreamKHR stream) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuEGLStreamConsumerConnect(conn, stream) -{{endif}} - -{{if True}} - -cdef CUresult cuEGLStreamConsumerConnectWithFlags(CUeglStreamConnection* conn, EGLStreamKHR stream, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuEGLStreamConsumerConnectWithFlags(conn, stream, flags) -{{endif}} - -{{if True}} - -cdef CUresult cuEGLStreamConsumerDisconnect(CUeglStreamConnection* conn) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuEGLStreamConsumerDisconnect(conn) -{{endif}} - -{{if True}} - -cdef CUresult cuEGLStreamConsumerAcquireFrame(CUeglStreamConnection* conn, CUgraphicsResource* pCudaResource, CUstream* pStream, unsigned int timeout) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuEGLStreamConsumerAcquireFrame(conn, pCudaResource, pStream, timeout) -{{endif}} - -{{if True}} - -cdef CUresult cuEGLStreamConsumerReleaseFrame(CUeglStreamConnection* conn, CUgraphicsResource pCudaResource, CUstream* pStream) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuEGLStreamConsumerReleaseFrame(conn, pCudaResource, pStream) -{{endif}} - -{{if True}} - -cdef CUresult cuEGLStreamProducerConnect(CUeglStreamConnection* conn, EGLStreamKHR stream, EGLint width, EGLint height) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuEGLStreamProducerConnect(conn, stream, width, height) -{{endif}} - -{{if True}} - -cdef CUresult cuEGLStreamProducerDisconnect(CUeglStreamConnection* conn) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuEGLStreamProducerDisconnect(conn) -{{endif}} - -{{if True}} - -cdef CUresult cuEGLStreamProducerPresentFrame(CUeglStreamConnection* conn, CUeglFrame eglframe, CUstream* pStream) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuEGLStreamProducerPresentFrame(conn, eglframe, pStream) -{{endif}} - -{{if True}} - -cdef CUresult cuEGLStreamProducerReturnFrame(CUeglStreamConnection* conn, CUeglFrame* eglframe, CUstream* pStream) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuEGLStreamProducerReturnFrame(conn, eglframe, pStream) -{{endif}} - -{{if True}} - -cdef CUresult cuGraphicsResourceGetMappedEglFrame(CUeglFrame* eglFrame, CUgraphicsResource resource, unsigned int index, unsigned int mipLevel) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphicsResourceGetMappedEglFrame(eglFrame, resource, index, mipLevel) -{{endif}} - -{{if True}} - -cdef CUresult cuEventCreateFromEGLSync(CUevent* phEvent, EGLSyncKHR eglSync, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuEventCreateFromEGLSync(phEvent, eglSync, flags) -{{endif}} - -{{if True}} - -cdef CUresult cuGraphicsGLRegisterBuffer(CUgraphicsResource* pCudaResource, GLuint buffer, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphicsGLRegisterBuffer(pCudaResource, buffer, Flags) -{{endif}} - -{{if True}} - -cdef CUresult cuGraphicsGLRegisterImage(CUgraphicsResource* pCudaResource, GLuint image, GLenum target, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphicsGLRegisterImage(pCudaResource, image, target, Flags) -{{endif}} - -{{if True}} - -cdef CUresult cuGLGetDevices(unsigned int* pCudaDeviceCount, CUdevice* pCudaDevices, unsigned int cudaDeviceCount, CUGLDeviceList deviceList) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGLGetDevices_v2(pCudaDeviceCount, pCudaDevices, cudaDeviceCount, deviceList) -{{endif}} - -{{if True}} - -cdef CUresult cuVDPAUGetDevice(CUdevice* pDevice, VdpDevice vdpDevice, VdpGetProcAddress* vdpGetProcAddress) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuVDPAUGetDevice(pDevice, vdpDevice, vdpGetProcAddress) -{{endif}} - -{{if True}} - -cdef CUresult cuVDPAUCtxCreate(CUcontext* pCtx, unsigned int flags, CUdevice device, VdpDevice vdpDevice, VdpGetProcAddress* vdpGetProcAddress) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuVDPAUCtxCreate_v2(pCtx, flags, device, vdpDevice, vdpGetProcAddress) -{{endif}} - -{{if True}} - -cdef CUresult cuGraphicsVDPAURegisterVideoSurface(CUgraphicsResource* pCudaResource, VdpVideoSurface vdpSurface, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphicsVDPAURegisterVideoSurface(pCudaResource, vdpSurface, flags) -{{endif}} - -{{if True}} - -cdef CUresult cuGraphicsVDPAURegisterOutputSurface(CUgraphicsResource* pCudaResource, VdpOutputSurface vdpSurface, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return ccuda._cuGraphicsVDPAURegisterOutputSurface(pCudaResource, vdpSurface, flags) -{{endif}} diff --git a/cuda/ccudart.pxd.in b/cuda/ccudart.pxd.in deleted file mode 100644 index 86e37220b2e..00000000000 --- a/cuda/ccudart.pxd.in +++ /dev/null @@ -1,3308 +0,0 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. -# -# Please refer to the NVIDIA end user license agreement (EULA) associated -# with this source code for terms and conditions that govern your use of -# this software. Any use, reproduction, disclosure, or distribution of -# this software and related documentation outside the terms of the EULA -# is strictly prohibited. - -from libc.stdint cimport uint32_t, uint64_t - -cdef extern from "vector_types.h": - - cdef struct dim3: - unsigned int x - unsigned int y - unsigned int z - -cdef extern from "driver_types.h": - - cdef enum cudaError: - cudaSuccess = 0 - cudaErrorInvalidValue = 1 - cudaErrorMemoryAllocation = 2 - cudaErrorInitializationError = 3 - cudaErrorCudartUnloading = 4 - cudaErrorProfilerDisabled = 5 - cudaErrorProfilerNotInitialized = 6 - cudaErrorProfilerAlreadyStarted = 7 - cudaErrorProfilerAlreadyStopped = 8 - cudaErrorInvalidConfiguration = 9 - cudaErrorInvalidPitchValue = 12 - cudaErrorInvalidSymbol = 13 - cudaErrorInvalidHostPointer = 16 - cudaErrorInvalidDevicePointer = 17 - cudaErrorInvalidTexture = 18 - cudaErrorInvalidTextureBinding = 19 - cudaErrorInvalidChannelDescriptor = 20 - cudaErrorInvalidMemcpyDirection = 21 - cudaErrorAddressOfConstant = 22 - cudaErrorTextureFetchFailed = 23 - cudaErrorTextureNotBound = 24 - cudaErrorSynchronizationError = 25 - cudaErrorInvalidFilterSetting = 26 - cudaErrorInvalidNormSetting = 27 - cudaErrorMixedDeviceExecution = 28 - cudaErrorNotYetImplemented = 31 - cudaErrorMemoryValueTooLarge = 32 - cudaErrorStubLibrary = 34 - cudaErrorInsufficientDriver = 35 - cudaErrorCallRequiresNewerDriver = 36 - cudaErrorInvalidSurface = 37 - cudaErrorDuplicateVariableName = 43 - cudaErrorDuplicateTextureName = 44 - cudaErrorDuplicateSurfaceName = 45 - cudaErrorDevicesUnavailable = 46 - cudaErrorIncompatibleDriverContext = 49 - cudaErrorMissingConfiguration = 52 - cudaErrorPriorLaunchFailure = 53 - cudaErrorLaunchMaxDepthExceeded = 65 - cudaErrorLaunchFileScopedTex = 66 - cudaErrorLaunchFileScopedSurf = 67 - cudaErrorSyncDepthExceeded = 68 - cudaErrorLaunchPendingCountExceeded = 69 - cudaErrorInvalidDeviceFunction = 98 - cudaErrorNoDevice = 100 - cudaErrorInvalidDevice = 101 - cudaErrorDeviceNotLicensed = 102 - cudaErrorSoftwareValidityNotEstablished = 103 - cudaErrorStartupFailure = 127 - cudaErrorInvalidKernelImage = 200 - cudaErrorDeviceUninitialized = 201 - cudaErrorMapBufferObjectFailed = 205 - cudaErrorUnmapBufferObjectFailed = 206 - cudaErrorArrayIsMapped = 207 - cudaErrorAlreadyMapped = 208 - cudaErrorNoKernelImageForDevice = 209 - cudaErrorAlreadyAcquired = 210 - cudaErrorNotMapped = 211 - cudaErrorNotMappedAsArray = 212 - cudaErrorNotMappedAsPointer = 213 - cudaErrorECCUncorrectable = 214 - cudaErrorUnsupportedLimit = 215 - cudaErrorDeviceAlreadyInUse = 216 - cudaErrorPeerAccessUnsupported = 217 - cudaErrorInvalidPtx = 218 - cudaErrorInvalidGraphicsContext = 219 - cudaErrorNvlinkUncorrectable = 220 - cudaErrorJitCompilerNotFound = 221 - cudaErrorUnsupportedPtxVersion = 222 - cudaErrorJitCompilationDisabled = 223 - cudaErrorUnsupportedExecAffinity = 224 - cudaErrorUnsupportedDevSideSync = 225 - cudaErrorInvalidSource = 300 - cudaErrorFileNotFound = 301 - cudaErrorSharedObjectSymbolNotFound = 302 - cudaErrorSharedObjectInitFailed = 303 - cudaErrorOperatingSystem = 304 - cudaErrorInvalidResourceHandle = 400 - cudaErrorIllegalState = 401 - cudaErrorLossyQuery = 402 - cudaErrorSymbolNotFound = 500 - cudaErrorNotReady = 600 - cudaErrorIllegalAddress = 700 - cudaErrorLaunchOutOfResources = 701 - cudaErrorLaunchTimeout = 702 - cudaErrorLaunchIncompatibleTexturing = 703 - cudaErrorPeerAccessAlreadyEnabled = 704 - cudaErrorPeerAccessNotEnabled = 705 - cudaErrorSetOnActiveProcess = 708 - cudaErrorContextIsDestroyed = 709 - cudaErrorAssert = 710 - cudaErrorTooManyPeers = 711 - cudaErrorHostMemoryAlreadyRegistered = 712 - cudaErrorHostMemoryNotRegistered = 713 - cudaErrorHardwareStackError = 714 - cudaErrorIllegalInstruction = 715 - cudaErrorMisalignedAddress = 716 - cudaErrorInvalidAddressSpace = 717 - cudaErrorInvalidPc = 718 - cudaErrorLaunchFailure = 719 - cudaErrorCooperativeLaunchTooLarge = 720 - cudaErrorNotPermitted = 800 - cudaErrorNotSupported = 801 - cudaErrorSystemNotReady = 802 - cudaErrorSystemDriverMismatch = 803 - cudaErrorCompatNotSupportedOnDevice = 804 - cudaErrorMpsConnectionFailed = 805 - cudaErrorMpsRpcFailure = 806 - cudaErrorMpsServerNotReady = 807 - cudaErrorMpsMaxClientsReached = 808 - cudaErrorMpsMaxConnectionsReached = 809 - cudaErrorMpsClientTerminated = 810 - cudaErrorCdpNotSupported = 811 - cudaErrorCdpVersionMismatch = 812 - cudaErrorStreamCaptureUnsupported = 900 - cudaErrorStreamCaptureInvalidated = 901 - cudaErrorStreamCaptureMerge = 902 - cudaErrorStreamCaptureUnmatched = 903 - cudaErrorStreamCaptureUnjoined = 904 - cudaErrorStreamCaptureIsolation = 905 - cudaErrorStreamCaptureImplicit = 906 - cudaErrorCapturedEvent = 907 - cudaErrorStreamCaptureWrongThread = 908 - cudaErrorTimeout = 909 - cudaErrorGraphExecUpdateFailure = 910 - cudaErrorExternalDevice = 911 - cudaErrorInvalidClusterSize = 912 - cudaErrorUnknown = 999 - cudaErrorApiFailureBase = 10000 - - ctypedef cudaError cudaError_t - - cdef struct cudaChannelFormatDesc: - int x - int y - int z - int w - cudaChannelFormatKind f - - cdef struct cudaArray: - pass - ctypedef cudaArray* cudaArray_t - - cdef struct cudaArray: - pass - ctypedef cudaArray* cudaArray_const_t - - cdef struct cudaMipmappedArray: - pass - ctypedef cudaMipmappedArray* cudaMipmappedArray_t - - cdef struct cudaMipmappedArray: - pass - ctypedef cudaMipmappedArray* cudaMipmappedArray_const_t - - cdef struct anon_struct0: - unsigned int width - unsigned int height - unsigned int depth - - cdef struct cudaArraySparseProperties: - anon_struct0 tileExtent - unsigned int miptailFirstLevel - unsigned long long miptailSize - unsigned int flags - unsigned int reserved[4] - - cdef struct cudaArrayMemoryRequirements: - size_t size - size_t alignment - unsigned int reserved[4] - - cdef struct cudaPitchedPtr: - void* ptr - size_t pitch - size_t xsize - size_t ysize - - cdef struct cudaExtent: - size_t width - size_t height - size_t depth - - cdef struct cudaPos: - size_t x - size_t y - size_t z - - cdef struct cudaMemcpy3DParms: - cudaArray_t srcArray - cudaPos srcPos - cudaPitchedPtr srcPtr - cudaArray_t dstArray - cudaPos dstPos - cudaPitchedPtr dstPtr - cudaExtent extent - cudaMemcpyKind kind - - cdef struct cudaMemcpyNodeParams: - int flags - int reserved[3] - cudaMemcpy3DParms copyParams - - cdef struct cudaMemcpy3DPeerParms: - cudaArray_t srcArray - cudaPos srcPos - cudaPitchedPtr srcPtr - int srcDevice - cudaArray_t dstArray - cudaPos dstPos - cudaPitchedPtr dstPtr - int dstDevice - cudaExtent extent - - cdef struct cudaMemsetParams: - void* dst - size_t pitch - unsigned int value - unsigned int elementSize - size_t width - size_t height - - cdef struct cudaMemsetParamsV2: - void* dst - size_t pitch - unsigned int value - unsigned int elementSize - size_t width - size_t height - - cdef struct cudaAccessPolicyWindow: - void* base_ptr - size_t num_bytes - float hitRatio - cudaAccessProperty hitProp - cudaAccessProperty missProp - - ctypedef void (*cudaHostFn_t)(void* userData) - - cdef struct cudaHostNodeParams: - cudaHostFn_t fn - void* userData - - cdef struct cudaHostNodeParamsV2: - cudaHostFn_t fn - void* userData - - cdef struct anon_struct1: - cudaArray_t array - - cdef struct anon_struct2: - cudaMipmappedArray_t mipmap - - cdef struct anon_struct3: - void* devPtr - cudaChannelFormatDesc desc - size_t sizeInBytes - - cdef struct anon_struct4: - void* devPtr - cudaChannelFormatDesc desc - size_t width - size_t height - size_t pitchInBytes - - cdef union anon_union0: - anon_struct1 array - anon_struct2 mipmap - anon_struct3 linear - anon_struct4 pitch2D - - cdef struct cudaResourceDesc: - cudaResourceType resType - anon_union0 res - - cdef struct cudaResourceViewDesc: - cudaResourceViewFormat format - size_t width - size_t height - size_t depth - unsigned int firstMipmapLevel - unsigned int lastMipmapLevel - unsigned int firstLayer - unsigned int lastLayer - - cdef struct cudaPointerAttributes: - cudaMemoryType type - int device - void* devicePointer - void* hostPointer - - cdef struct cudaFuncAttributes: - size_t sharedSizeBytes - size_t constSizeBytes - size_t localSizeBytes - int maxThreadsPerBlock - int numRegs - int ptxVersion - int binaryVersion - int cacheModeCA - int maxDynamicSharedSizeBytes - int preferredShmemCarveout - int clusterDimMustBeSet - int requiredClusterWidth - int requiredClusterHeight - int requiredClusterDepth - int clusterSchedulingPolicyPreference - int nonPortableClusterSizeAllowed - int reserved[16] - - cdef struct cudaMemLocation: - cudaMemLocationType type - int id - - cdef struct cudaMemAccessDesc: - cudaMemLocation location - cudaMemAccessFlags flags - - cdef struct cudaMemPoolProps: - cudaMemAllocationType allocType - cudaMemAllocationHandleType handleTypes - cudaMemLocation location - void* win32SecurityAttributes - size_t maxSize - unsigned char reserved[56] - - cdef struct cudaMemPoolPtrExportData: - unsigned char reserved[64] - - cdef struct cudaMemAllocNodeParams: - cudaMemPoolProps poolProps - const cudaMemAccessDesc* accessDescs - size_t accessDescCount - size_t bytesize - void* dptr - - cdef struct cudaMemAllocNodeParamsV2: - cudaMemPoolProps poolProps - const cudaMemAccessDesc* accessDescs - size_t accessDescCount - size_t bytesize - void* dptr - - cdef struct cudaMemFreeNodeParams: - void* dptr - - cdef struct CUuuid_st: - char bytes[16] - - ctypedef CUuuid_st CUuuid - - ctypedef CUuuid_st cudaUUID_t - - cdef struct cudaDeviceProp: - char name[256] - cudaUUID_t uuid - char luid[8] - unsigned int luidDeviceNodeMask - size_t totalGlobalMem - size_t sharedMemPerBlock - int regsPerBlock - int warpSize - size_t memPitch - int maxThreadsPerBlock - int maxThreadsDim[3] - int maxGridSize[3] - int clockRate - size_t totalConstMem - int major - int minor - size_t textureAlignment - size_t texturePitchAlignment - int deviceOverlap - int multiProcessorCount - int kernelExecTimeoutEnabled - int integrated - int canMapHostMemory - int computeMode - int maxTexture1D - int maxTexture1DMipmap - int maxTexture1DLinear - int maxTexture2D[2] - int maxTexture2DMipmap[2] - int maxTexture2DLinear[3] - int maxTexture2DGather[2] - int maxTexture3D[3] - int maxTexture3DAlt[3] - int maxTextureCubemap - int maxTexture1DLayered[2] - int maxTexture2DLayered[3] - int maxTextureCubemapLayered[2] - int maxSurface1D - int maxSurface2D[2] - int maxSurface3D[3] - int maxSurface1DLayered[2] - int maxSurface2DLayered[3] - int maxSurfaceCubemap - int maxSurfaceCubemapLayered[2] - size_t surfaceAlignment - int concurrentKernels - int ECCEnabled - int pciBusID - int pciDeviceID - int pciDomainID - int tccDriver - int asyncEngineCount - int unifiedAddressing - int memoryClockRate - int memoryBusWidth - int l2CacheSize - int persistingL2CacheMaxSize - int maxThreadsPerMultiProcessor - int streamPrioritiesSupported - int globalL1CacheSupported - int localL1CacheSupported - size_t sharedMemPerMultiprocessor - int regsPerMultiprocessor - int managedMemory - int isMultiGpuBoard - int multiGpuBoardGroupID - int hostNativeAtomicSupported - int singleToDoublePrecisionPerfRatio - int pageableMemoryAccess - int concurrentManagedAccess - int computePreemptionSupported - int canUseHostPointerForRegisteredMem - int cooperativeLaunch - int cooperativeMultiDeviceLaunch - size_t sharedMemPerBlockOptin - int pageableMemoryAccessUsesHostPageTables - int directManagedMemAccessFromHost - int maxBlocksPerMultiProcessor - int accessPolicyMaxWindowSize - size_t reservedSharedMemPerBlock - int hostRegisterSupported - int sparseCudaArraySupported - int hostRegisterReadOnlySupported - int timelineSemaphoreInteropSupported - int memoryPoolsSupported - int gpuDirectRDMASupported - unsigned int gpuDirectRDMAFlushWritesOptions - int gpuDirectRDMAWritesOrdering - unsigned int memoryPoolSupportedHandleTypes - int deferredMappingCudaArraySupported - int ipcEventSupported - int clusterLaunch - int unifiedFunctionPointers - int reserved2[2] - int reserved1[1] - int reserved[60] - - cdef struct cudaIpcEventHandle_st: - char reserved[64] - - ctypedef cudaIpcEventHandle_st cudaIpcEventHandle_t - - cdef struct cudaIpcMemHandle_st: - char reserved[64] - - ctypedef cudaIpcMemHandle_st cudaIpcMemHandle_t - - cdef struct cudaMemFabricHandle_st: - char reserved[64] - - ctypedef cudaMemFabricHandle_st cudaMemFabricHandle_t - - cdef struct anon_struct5: - void* handle - const void* name - - cdef union anon_union1: - int fd - anon_struct5 win32 - const void* nvSciBufObject - - cdef struct cudaExternalMemoryHandleDesc: - cudaExternalMemoryHandleType type - anon_union1 handle - unsigned long long size - unsigned int flags - - cdef struct cudaExternalMemoryBufferDesc: - unsigned long long offset - unsigned long long size - unsigned int flags - - cdef struct cudaExternalMemoryMipmappedArrayDesc: - unsigned long long offset - cudaChannelFormatDesc formatDesc - cudaExtent extent - unsigned int flags - unsigned int numLevels - - cdef struct anon_struct6: - void* handle - const void* name - - cdef union anon_union2: - int fd - anon_struct6 win32 - const void* nvSciSyncObj - - cdef struct cudaExternalSemaphoreHandleDesc: - cudaExternalSemaphoreHandleType type - anon_union2 handle - unsigned int flags - - cdef struct anon_struct13: - unsigned long long value - - cdef union anon_union5: - void* fence - unsigned long long reserved - - cdef struct anon_struct14: - unsigned long long key - - cdef struct anon_struct15: - anon_struct13 fence - anon_union5 nvSciSync - anon_struct14 keyedMutex - unsigned int reserved[12] - - cdef struct cudaExternalSemaphoreSignalParams: - anon_struct15 params - unsigned int flags - unsigned int reserved[16] - - cdef struct anon_struct16: - unsigned long long value - - cdef union anon_union6: - void* fence - unsigned long long reserved - - cdef struct anon_struct17: - unsigned long long key - unsigned int timeoutMs - - cdef struct anon_struct18: - anon_struct16 fence - anon_union6 nvSciSync - anon_struct17 keyedMutex - unsigned int reserved[10] - - cdef struct cudaExternalSemaphoreWaitParams: - anon_struct18 params - unsigned int flags - unsigned int reserved[16] - - cdef struct CUstream_st: - pass - ctypedef CUstream_st* cudaStream_t - - cdef struct CUevent_st: - pass - ctypedef CUevent_st* cudaEvent_t - - cdef struct cudaGraphicsResource: - pass - ctypedef cudaGraphicsResource* cudaGraphicsResource_t - - cdef struct CUexternalMemory_st: - pass - ctypedef CUexternalMemory_st* cudaExternalMemory_t - - cdef struct CUexternalSemaphore_st: - pass - ctypedef CUexternalSemaphore_st* cudaExternalSemaphore_t - - cdef struct CUgraph_st: - pass - ctypedef CUgraph_st* cudaGraph_t - - cdef struct CUgraphNode_st: - pass - ctypedef CUgraphNode_st* cudaGraphNode_t - - cdef struct CUuserObject_st: - pass - ctypedef CUuserObject_st* cudaUserObject_t - - ctypedef unsigned long long cudaGraphConditionalHandle - - cdef struct CUfunc_st: - pass - ctypedef CUfunc_st* cudaFunction_t - - cdef struct CUkern_st: - pass - ctypedef CUkern_st* cudaKernel_t - - cdef struct CUmemPoolHandle_st: - pass - ctypedef CUmemPoolHandle_st* cudaMemPool_t - - cdef struct cudaKernelNodeParams: - void* func - dim3 gridDim - dim3 blockDim - unsigned int sharedMemBytes - void** kernelParams - void** extra - - cdef struct cudaKernelNodeParamsV2: - void* func - dim3 gridDim - dim3 blockDim - unsigned int sharedMemBytes - void** kernelParams - void** extra - - cdef struct cudaExternalSemaphoreSignalNodeParams: - cudaExternalSemaphore_t* extSemArray - const cudaExternalSemaphoreSignalParams* paramsArray - unsigned int numExtSems - - cdef struct cudaExternalSemaphoreSignalNodeParamsV2: - cudaExternalSemaphore_t* extSemArray - const cudaExternalSemaphoreSignalParams* paramsArray - unsigned int numExtSems - - cdef struct cudaExternalSemaphoreWaitNodeParams: - cudaExternalSemaphore_t* extSemArray - const cudaExternalSemaphoreWaitParams* paramsArray - unsigned int numExtSems - - cdef struct cudaExternalSemaphoreWaitNodeParamsV2: - cudaExternalSemaphore_t* extSemArray - const cudaExternalSemaphoreWaitParams* paramsArray - unsigned int numExtSems - - cdef struct cudaConditionalNodeParams: - cudaGraphConditionalHandle handle - cudaGraphConditionalNodeType type - unsigned int size - cudaGraph_t* phGraph_out - - cdef struct cudaChildGraphNodeParams: - cudaGraph_t graph - - cdef struct cudaEventRecordNodeParams: - cudaEvent_t event - - cdef struct cudaEventWaitNodeParams: - cudaEvent_t event - - cdef struct cudaGraphNodeParams: - cudaGraphNodeType type - int reserved0[3] - long long reserved1[29] - cudaKernelNodeParamsV2 kernel - cudaMemcpyNodeParams memcpy - cudaMemsetParamsV2 memset - cudaHostNodeParamsV2 host - cudaChildGraphNodeParams graph - cudaEventWaitNodeParams eventWait - cudaEventRecordNodeParams eventRecord - cudaExternalSemaphoreSignalNodeParamsV2 extSemSignal - cudaExternalSemaphoreWaitNodeParamsV2 extSemWait - cudaMemAllocNodeParamsV2 alloc - cudaMemFreeNodeParams free - cudaConditionalNodeParams conditional - long long reserved2 - - cdef enum cudaGraphDependencyType_enum: - cudaGraphDependencyTypeDefault = 0 - cudaGraphDependencyTypeProgrammatic = 1 - - ctypedef cudaGraphDependencyType_enum cudaGraphDependencyType - - cdef struct cudaGraphEdgeData_st: - unsigned char from_port - unsigned char to_port - unsigned char type - unsigned char reserved[5] - - ctypedef cudaGraphEdgeData_st cudaGraphEdgeData - - cdef struct CUgraphExec_st: - pass - ctypedef CUgraphExec_st* cudaGraphExec_t - - cdef enum cudaGraphInstantiateResult: - cudaGraphInstantiateSuccess = 0 - cudaGraphInstantiateError = 1 - cudaGraphInstantiateInvalidStructure = 2 - cudaGraphInstantiateNodeOperationNotSupported = 3 - cudaGraphInstantiateMultipleDevicesNotSupported = 4 - - cdef struct cudaGraphInstantiateParams_st: - unsigned long long flags - cudaStream_t uploadStream - cudaGraphNode_t errNode_out - cudaGraphInstantiateResult result_out - - ctypedef cudaGraphInstantiateParams_st cudaGraphInstantiateParams - - cdef struct cudaGraphExecUpdateResultInfo_st: - cudaGraphExecUpdateResult result - cudaGraphNode_t errorNode - cudaGraphNode_t errorFromNode - - ctypedef cudaGraphExecUpdateResultInfo_st cudaGraphExecUpdateResultInfo - - cdef struct CUgraphDeviceUpdatableNode_st: - pass - ctypedef CUgraphDeviceUpdatableNode_st* cudaGraphDeviceNode_t - - cdef struct anon_struct19: - const void* pValue - size_t offset - size_t size - - cdef union anon_union8: - dim3 gridDim - anon_struct19 param - unsigned int isEnabled - - cdef struct cudaGraphKernelNodeUpdate: - cudaGraphDeviceNode_t node - cudaGraphKernelNodeField field - anon_union8 updateData - - cdef enum cudaLaunchMemSyncDomain: - cudaLaunchMemSyncDomainDefault = 0 - cudaLaunchMemSyncDomainRemote = 1 - - cdef struct cudaLaunchMemSyncDomainMap_st: - unsigned char default_ - unsigned char remote - - ctypedef cudaLaunchMemSyncDomainMap_st cudaLaunchMemSyncDomainMap - - cdef enum cudaLaunchAttributeID: - cudaLaunchAttributeIgnore = 0 - cudaLaunchAttributeAccessPolicyWindow = 1 - cudaLaunchAttributeCooperative = 2 - cudaLaunchAttributeSynchronizationPolicy = 3 - cudaLaunchAttributeClusterDimension = 4 - cudaLaunchAttributeClusterSchedulingPolicyPreference = 5 - cudaLaunchAttributeProgrammaticStreamSerialization = 6 - cudaLaunchAttributeProgrammaticEvent = 7 - cudaLaunchAttributePriority = 8 - cudaLaunchAttributeMemSyncDomainMap = 9 - cudaLaunchAttributeMemSyncDomain = 10 - cudaLaunchAttributeLaunchCompletionEvent = 12 - cudaLaunchAttributeDeviceUpdatableKernelNode = 13 - cudaLaunchAttributePreferredSharedMemoryCarveout = 14 - - cdef struct anon_struct20: - unsigned int x - unsigned int y - unsigned int z - - cdef struct anon_struct21: - cudaEvent_t event - int flags - int triggerAtBlockStart - - cdef struct anon_struct22: - cudaEvent_t event - int flags - - cdef struct anon_struct23: - int deviceUpdatable - cudaGraphDeviceNode_t devNode - - cdef union cudaLaunchAttributeValue: - char pad[64] - cudaAccessPolicyWindow accessPolicyWindow - int cooperative - cudaSynchronizationPolicy syncPolicy - anon_struct20 clusterDim - cudaClusterSchedulingPolicy clusterSchedulingPolicyPreference - int programmaticStreamSerializationAllowed - anon_struct21 programmaticEvent - int priority - cudaLaunchMemSyncDomainMap memSyncDomainMap - cudaLaunchMemSyncDomain memSyncDomain - anon_struct22 launchCompletionEvent - anon_struct23 deviceUpdatableKernelNode - unsigned int sharedMemCarveout - - cdef struct cudaLaunchAttribute_st: - cudaLaunchAttributeID id - cudaLaunchAttributeValue val - - ctypedef cudaLaunchAttribute_st cudaLaunchAttribute - - cdef struct cudaAsyncCallbackEntry: - pass - ctypedef cudaAsyncCallbackEntry* cudaAsyncCallbackHandle_t - - cdef enum cudaAsyncNotificationType_enum: - cudaAsyncNotificationTypeOverBudget = 1 - - ctypedef cudaAsyncNotificationType_enum cudaAsyncNotificationType - - cdef struct anon_struct24: - unsigned long long bytesOverBudget - - cdef union anon_union9: - anon_struct24 overBudget - - cdef struct cudaAsyncNotificationInfo: - cudaAsyncNotificationType type - anon_union9 info - - ctypedef cudaAsyncNotificationInfo cudaAsyncNotificationInfo_t - - ctypedef void (*cudaAsyncCallback)(cudaAsyncNotificationInfo_t* , void* , cudaAsyncCallbackHandle_t ) - - cdef enum cudaChannelFormatKind: - cudaChannelFormatKindSigned = 0 - cudaChannelFormatKindUnsigned = 1 - cudaChannelFormatKindFloat = 2 - cudaChannelFormatKindNone = 3 - cudaChannelFormatKindNV12 = 4 - cudaChannelFormatKindUnsignedNormalized8X1 = 5 - cudaChannelFormatKindUnsignedNormalized8X2 = 6 - cudaChannelFormatKindUnsignedNormalized8X4 = 7 - cudaChannelFormatKindUnsignedNormalized16X1 = 8 - cudaChannelFormatKindUnsignedNormalized16X2 = 9 - cudaChannelFormatKindUnsignedNormalized16X4 = 10 - cudaChannelFormatKindSignedNormalized8X1 = 11 - cudaChannelFormatKindSignedNormalized8X2 = 12 - cudaChannelFormatKindSignedNormalized8X4 = 13 - cudaChannelFormatKindSignedNormalized16X1 = 14 - cudaChannelFormatKindSignedNormalized16X2 = 15 - cudaChannelFormatKindSignedNormalized16X4 = 16 - cudaChannelFormatKindUnsignedBlockCompressed1 = 17 - cudaChannelFormatKindUnsignedBlockCompressed1SRGB = 18 - cudaChannelFormatKindUnsignedBlockCompressed2 = 19 - cudaChannelFormatKindUnsignedBlockCompressed2SRGB = 20 - cudaChannelFormatKindUnsignedBlockCompressed3 = 21 - cudaChannelFormatKindUnsignedBlockCompressed3SRGB = 22 - cudaChannelFormatKindUnsignedBlockCompressed4 = 23 - cudaChannelFormatKindSignedBlockCompressed4 = 24 - cudaChannelFormatKindUnsignedBlockCompressed5 = 25 - cudaChannelFormatKindSignedBlockCompressed5 = 26 - cudaChannelFormatKindUnsignedBlockCompressed6H = 27 - cudaChannelFormatKindSignedBlockCompressed6H = 28 - cudaChannelFormatKindUnsignedBlockCompressed7 = 29 - cudaChannelFormatKindUnsignedBlockCompressed7SRGB = 30 - - cdef enum cudaMemoryType: - cudaMemoryTypeUnregistered = 0 - cudaMemoryTypeHost = 1 - cudaMemoryTypeDevice = 2 - cudaMemoryTypeManaged = 3 - - cdef enum cudaMemcpyKind: - cudaMemcpyHostToHost = 0 - cudaMemcpyHostToDevice = 1 - cudaMemcpyDeviceToHost = 2 - cudaMemcpyDeviceToDevice = 3 - cudaMemcpyDefault = 4 - - cdef enum cudaAccessProperty: - cudaAccessPropertyNormal = 0 - cudaAccessPropertyStreaming = 1 - cudaAccessPropertyPersisting = 2 - - cdef enum cudaStreamCaptureStatus: - cudaStreamCaptureStatusNone = 0 - cudaStreamCaptureStatusActive = 1 - cudaStreamCaptureStatusInvalidated = 2 - - cdef enum cudaStreamCaptureMode: - cudaStreamCaptureModeGlobal = 0 - cudaStreamCaptureModeThreadLocal = 1 - cudaStreamCaptureModeRelaxed = 2 - - cdef enum cudaSynchronizationPolicy: - cudaSyncPolicyAuto = 1 - cudaSyncPolicySpin = 2 - cudaSyncPolicyYield = 3 - cudaSyncPolicyBlockingSync = 4 - - cdef enum cudaClusterSchedulingPolicy: - cudaClusterSchedulingPolicyDefault = 0 - cudaClusterSchedulingPolicySpread = 1 - cudaClusterSchedulingPolicyLoadBalancing = 2 - - cdef enum cudaStreamUpdateCaptureDependenciesFlags: - cudaStreamAddCaptureDependencies = 0 - cudaStreamSetCaptureDependencies = 1 - - cdef enum cudaUserObjectFlags: - cudaUserObjectNoDestructorSync = 1 - - cdef enum cudaUserObjectRetainFlags: - cudaGraphUserObjectMove = 1 - - cdef enum cudaGraphicsRegisterFlags: - cudaGraphicsRegisterFlagsNone = 0 - cudaGraphicsRegisterFlagsReadOnly = 1 - cudaGraphicsRegisterFlagsWriteDiscard = 2 - cudaGraphicsRegisterFlagsSurfaceLoadStore = 4 - cudaGraphicsRegisterFlagsTextureGather = 8 - - cdef enum cudaGraphicsMapFlags: - cudaGraphicsMapFlagsNone = 0 - cudaGraphicsMapFlagsReadOnly = 1 - cudaGraphicsMapFlagsWriteDiscard = 2 - - cdef enum cudaGraphicsCubeFace: - cudaGraphicsCubeFacePositiveX = 0 - cudaGraphicsCubeFaceNegativeX = 1 - cudaGraphicsCubeFacePositiveY = 2 - cudaGraphicsCubeFaceNegativeY = 3 - cudaGraphicsCubeFacePositiveZ = 4 - cudaGraphicsCubeFaceNegativeZ = 5 - - cdef enum cudaResourceType: - cudaResourceTypeArray = 0 - cudaResourceTypeMipmappedArray = 1 - cudaResourceTypeLinear = 2 - cudaResourceTypePitch2D = 3 - - cdef enum cudaResourceViewFormat: - cudaResViewFormatNone = 0 - cudaResViewFormatUnsignedChar1 = 1 - cudaResViewFormatUnsignedChar2 = 2 - cudaResViewFormatUnsignedChar4 = 3 - cudaResViewFormatSignedChar1 = 4 - cudaResViewFormatSignedChar2 = 5 - cudaResViewFormatSignedChar4 = 6 - cudaResViewFormatUnsignedShort1 = 7 - cudaResViewFormatUnsignedShort2 = 8 - cudaResViewFormatUnsignedShort4 = 9 - cudaResViewFormatSignedShort1 = 10 - cudaResViewFormatSignedShort2 = 11 - cudaResViewFormatSignedShort4 = 12 - cudaResViewFormatUnsignedInt1 = 13 - cudaResViewFormatUnsignedInt2 = 14 - cudaResViewFormatUnsignedInt4 = 15 - cudaResViewFormatSignedInt1 = 16 - cudaResViewFormatSignedInt2 = 17 - cudaResViewFormatSignedInt4 = 18 - cudaResViewFormatHalf1 = 19 - cudaResViewFormatHalf2 = 20 - cudaResViewFormatHalf4 = 21 - cudaResViewFormatFloat1 = 22 - cudaResViewFormatFloat2 = 23 - cudaResViewFormatFloat4 = 24 - cudaResViewFormatUnsignedBlockCompressed1 = 25 - cudaResViewFormatUnsignedBlockCompressed2 = 26 - cudaResViewFormatUnsignedBlockCompressed3 = 27 - cudaResViewFormatUnsignedBlockCompressed4 = 28 - cudaResViewFormatSignedBlockCompressed4 = 29 - cudaResViewFormatUnsignedBlockCompressed5 = 30 - cudaResViewFormatSignedBlockCompressed5 = 31 - cudaResViewFormatUnsignedBlockCompressed6H = 32 - cudaResViewFormatSignedBlockCompressed6H = 33 - cudaResViewFormatUnsignedBlockCompressed7 = 34 - - cdef enum cudaFuncAttribute: - cudaFuncAttributeMaxDynamicSharedMemorySize = 8 - cudaFuncAttributePreferredSharedMemoryCarveout = 9 - cudaFuncAttributeClusterDimMustBeSet = 10 - cudaFuncAttributeRequiredClusterWidth = 11 - cudaFuncAttributeRequiredClusterHeight = 12 - cudaFuncAttributeRequiredClusterDepth = 13 - cudaFuncAttributeNonPortableClusterSizeAllowed = 14 - cudaFuncAttributeClusterSchedulingPolicyPreference = 15 - cudaFuncAttributeMax = 16 - - cdef enum cudaFuncCache: - cudaFuncCachePreferNone = 0 - cudaFuncCachePreferShared = 1 - cudaFuncCachePreferL1 = 2 - cudaFuncCachePreferEqual = 3 - - cdef enum cudaSharedMemConfig: - cudaSharedMemBankSizeDefault = 0 - cudaSharedMemBankSizeFourByte = 1 - cudaSharedMemBankSizeEightByte = 2 - - cdef enum cudaSharedCarveout: - cudaSharedmemCarveoutDefault = -1 - cudaSharedmemCarveoutMaxL1 = 0 - cudaSharedmemCarveoutMaxShared = 100 - - cdef enum cudaComputeMode: - cudaComputeModeDefault = 0 - cudaComputeModeExclusive = 1 - cudaComputeModeProhibited = 2 - cudaComputeModeExclusiveProcess = 3 - - cdef enum cudaLimit: - cudaLimitStackSize = 0 - cudaLimitPrintfFifoSize = 1 - cudaLimitMallocHeapSize = 2 - cudaLimitDevRuntimeSyncDepth = 3 - cudaLimitDevRuntimePendingLaunchCount = 4 - cudaLimitMaxL2FetchGranularity = 5 - cudaLimitPersistingL2CacheSize = 6 - - cdef enum cudaMemoryAdvise: - cudaMemAdviseSetReadMostly = 1 - cudaMemAdviseUnsetReadMostly = 2 - cudaMemAdviseSetPreferredLocation = 3 - cudaMemAdviseUnsetPreferredLocation = 4 - cudaMemAdviseSetAccessedBy = 5 - cudaMemAdviseUnsetAccessedBy = 6 - - cdef enum cudaMemRangeAttribute: - cudaMemRangeAttributeReadMostly = 1 - cudaMemRangeAttributePreferredLocation = 2 - cudaMemRangeAttributeAccessedBy = 3 - cudaMemRangeAttributeLastPrefetchLocation = 4 - cudaMemRangeAttributePreferredLocationType = 5 - cudaMemRangeAttributePreferredLocationId = 6 - cudaMemRangeAttributeLastPrefetchLocationType = 7 - cudaMemRangeAttributeLastPrefetchLocationId = 8 - - cdef enum cudaFlushGPUDirectRDMAWritesOptions: - cudaFlushGPUDirectRDMAWritesOptionHost = 1 - cudaFlushGPUDirectRDMAWritesOptionMemOps = 2 - - cdef enum cudaGPUDirectRDMAWritesOrdering: - cudaGPUDirectRDMAWritesOrderingNone = 0 - cudaGPUDirectRDMAWritesOrderingOwner = 100 - cudaGPUDirectRDMAWritesOrderingAllDevices = 200 - - cdef enum cudaFlushGPUDirectRDMAWritesScope: - cudaFlushGPUDirectRDMAWritesToOwner = 100 - cudaFlushGPUDirectRDMAWritesToAllDevices = 200 - - cdef enum cudaFlushGPUDirectRDMAWritesTarget: - cudaFlushGPUDirectRDMAWritesTargetCurrentDevice = 0 - - cdef enum cudaDeviceAttr: - cudaDevAttrMaxThreadsPerBlock = 1 - cudaDevAttrMaxBlockDimX = 2 - cudaDevAttrMaxBlockDimY = 3 - cudaDevAttrMaxBlockDimZ = 4 - cudaDevAttrMaxGridDimX = 5 - cudaDevAttrMaxGridDimY = 6 - cudaDevAttrMaxGridDimZ = 7 - cudaDevAttrMaxSharedMemoryPerBlock = 8 - cudaDevAttrTotalConstantMemory = 9 - cudaDevAttrWarpSize = 10 - cudaDevAttrMaxPitch = 11 - cudaDevAttrMaxRegistersPerBlock = 12 - cudaDevAttrClockRate = 13 - cudaDevAttrTextureAlignment = 14 - cudaDevAttrGpuOverlap = 15 - cudaDevAttrMultiProcessorCount = 16 - cudaDevAttrKernelExecTimeout = 17 - cudaDevAttrIntegrated = 18 - cudaDevAttrCanMapHostMemory = 19 - cudaDevAttrComputeMode = 20 - cudaDevAttrMaxTexture1DWidth = 21 - cudaDevAttrMaxTexture2DWidth = 22 - cudaDevAttrMaxTexture2DHeight = 23 - cudaDevAttrMaxTexture3DWidth = 24 - cudaDevAttrMaxTexture3DHeight = 25 - cudaDevAttrMaxTexture3DDepth = 26 - cudaDevAttrMaxTexture2DLayeredWidth = 27 - cudaDevAttrMaxTexture2DLayeredHeight = 28 - cudaDevAttrMaxTexture2DLayeredLayers = 29 - cudaDevAttrSurfaceAlignment = 30 - cudaDevAttrConcurrentKernels = 31 - cudaDevAttrEccEnabled = 32 - cudaDevAttrPciBusId = 33 - cudaDevAttrPciDeviceId = 34 - cudaDevAttrTccDriver = 35 - cudaDevAttrMemoryClockRate = 36 - cudaDevAttrGlobalMemoryBusWidth = 37 - cudaDevAttrL2CacheSize = 38 - cudaDevAttrMaxThreadsPerMultiProcessor = 39 - cudaDevAttrAsyncEngineCount = 40 - cudaDevAttrUnifiedAddressing = 41 - cudaDevAttrMaxTexture1DLayeredWidth = 42 - cudaDevAttrMaxTexture1DLayeredLayers = 43 - cudaDevAttrMaxTexture2DGatherWidth = 45 - cudaDevAttrMaxTexture2DGatherHeight = 46 - cudaDevAttrMaxTexture3DWidthAlt = 47 - cudaDevAttrMaxTexture3DHeightAlt = 48 - cudaDevAttrMaxTexture3DDepthAlt = 49 - cudaDevAttrPciDomainId = 50 - cudaDevAttrTexturePitchAlignment = 51 - cudaDevAttrMaxTextureCubemapWidth = 52 - cudaDevAttrMaxTextureCubemapLayeredWidth = 53 - cudaDevAttrMaxTextureCubemapLayeredLayers = 54 - cudaDevAttrMaxSurface1DWidth = 55 - cudaDevAttrMaxSurface2DWidth = 56 - cudaDevAttrMaxSurface2DHeight = 57 - cudaDevAttrMaxSurface3DWidth = 58 - cudaDevAttrMaxSurface3DHeight = 59 - cudaDevAttrMaxSurface3DDepth = 60 - cudaDevAttrMaxSurface1DLayeredWidth = 61 - cudaDevAttrMaxSurface1DLayeredLayers = 62 - cudaDevAttrMaxSurface2DLayeredWidth = 63 - cudaDevAttrMaxSurface2DLayeredHeight = 64 - cudaDevAttrMaxSurface2DLayeredLayers = 65 - cudaDevAttrMaxSurfaceCubemapWidth = 66 - cudaDevAttrMaxSurfaceCubemapLayeredWidth = 67 - cudaDevAttrMaxSurfaceCubemapLayeredLayers = 68 - cudaDevAttrMaxTexture1DLinearWidth = 69 - cudaDevAttrMaxTexture2DLinearWidth = 70 - cudaDevAttrMaxTexture2DLinearHeight = 71 - cudaDevAttrMaxTexture2DLinearPitch = 72 - cudaDevAttrMaxTexture2DMipmappedWidth = 73 - cudaDevAttrMaxTexture2DMipmappedHeight = 74 - cudaDevAttrComputeCapabilityMajor = 75 - cudaDevAttrComputeCapabilityMinor = 76 - cudaDevAttrMaxTexture1DMipmappedWidth = 77 - cudaDevAttrStreamPrioritiesSupported = 78 - cudaDevAttrGlobalL1CacheSupported = 79 - cudaDevAttrLocalL1CacheSupported = 80 - cudaDevAttrMaxSharedMemoryPerMultiprocessor = 81 - cudaDevAttrMaxRegistersPerMultiprocessor = 82 - cudaDevAttrManagedMemory = 83 - cudaDevAttrIsMultiGpuBoard = 84 - cudaDevAttrMultiGpuBoardGroupID = 85 - cudaDevAttrHostNativeAtomicSupported = 86 - cudaDevAttrSingleToDoublePrecisionPerfRatio = 87 - cudaDevAttrPageableMemoryAccess = 88 - cudaDevAttrConcurrentManagedAccess = 89 - cudaDevAttrComputePreemptionSupported = 90 - cudaDevAttrCanUseHostPointerForRegisteredMem = 91 - cudaDevAttrReserved92 = 92 - cudaDevAttrReserved93 = 93 - cudaDevAttrReserved94 = 94 - cudaDevAttrCooperativeLaunch = 95 - cudaDevAttrCooperativeMultiDeviceLaunch = 96 - cudaDevAttrMaxSharedMemoryPerBlockOptin = 97 - cudaDevAttrCanFlushRemoteWrites = 98 - cudaDevAttrHostRegisterSupported = 99 - cudaDevAttrPageableMemoryAccessUsesHostPageTables = 100 - cudaDevAttrDirectManagedMemAccessFromHost = 101 - cudaDevAttrMaxBlocksPerMultiprocessor = 106 - cudaDevAttrMaxPersistingL2CacheSize = 108 - cudaDevAttrMaxAccessPolicyWindowSize = 109 - cudaDevAttrReservedSharedMemoryPerBlock = 111 - cudaDevAttrSparseCudaArraySupported = 112 - cudaDevAttrHostRegisterReadOnlySupported = 113 - cudaDevAttrTimelineSemaphoreInteropSupported = 114 - cudaDevAttrMaxTimelineSemaphoreInteropSupported = 114 - cudaDevAttrMemoryPoolsSupported = 115 - cudaDevAttrGPUDirectRDMASupported = 116 - cudaDevAttrGPUDirectRDMAFlushWritesOptions = 117 - cudaDevAttrGPUDirectRDMAWritesOrdering = 118 - cudaDevAttrMemoryPoolSupportedHandleTypes = 119 - cudaDevAttrClusterLaunch = 120 - cudaDevAttrDeferredMappingCudaArraySupported = 121 - cudaDevAttrReserved122 = 122 - cudaDevAttrReserved123 = 123 - cudaDevAttrReserved124 = 124 - cudaDevAttrIpcEventSupport = 125 - cudaDevAttrMemSyncDomainCount = 126 - cudaDevAttrReserved127 = 127 - cudaDevAttrReserved128 = 128 - cudaDevAttrReserved129 = 129 - cudaDevAttrNumaConfig = 130 - cudaDevAttrNumaId = 131 - cudaDevAttrReserved132 = 132 - cudaDevAttrMpsEnabled = 133 - cudaDevAttrHostNumaId = 134 - cudaDevAttrD3D12CigSupported = 135 - cudaDevAttrMax = 136 - - cdef enum cudaMemPoolAttr: - cudaMemPoolReuseFollowEventDependencies = 1 - cudaMemPoolReuseAllowOpportunistic = 2 - cudaMemPoolReuseAllowInternalDependencies = 3 - cudaMemPoolAttrReleaseThreshold = 4 - cudaMemPoolAttrReservedMemCurrent = 5 - cudaMemPoolAttrReservedMemHigh = 6 - cudaMemPoolAttrUsedMemCurrent = 7 - cudaMemPoolAttrUsedMemHigh = 8 - - cdef enum cudaMemLocationType: - cudaMemLocationTypeInvalid = 0 - cudaMemLocationTypeDevice = 1 - cudaMemLocationTypeHost = 2 - cudaMemLocationTypeHostNuma = 3 - cudaMemLocationTypeHostNumaCurrent = 4 - - cdef enum cudaMemAccessFlags: - cudaMemAccessFlagsProtNone = 0 - cudaMemAccessFlagsProtRead = 1 - cudaMemAccessFlagsProtReadWrite = 3 - - cdef enum cudaMemAllocationType: - cudaMemAllocationTypeInvalid = 0 - cudaMemAllocationTypePinned = 1 - cudaMemAllocationTypeMax = 2147483647 - - cdef enum cudaMemAllocationHandleType: - cudaMemHandleTypeNone = 0 - cudaMemHandleTypePosixFileDescriptor = 1 - cudaMemHandleTypeWin32 = 2 - cudaMemHandleTypeWin32Kmt = 4 - cudaMemHandleTypeFabric = 8 - - cdef enum cudaGraphMemAttributeType: - cudaGraphMemAttrUsedMemCurrent = 0 - cudaGraphMemAttrUsedMemHigh = 1 - cudaGraphMemAttrReservedMemCurrent = 2 - cudaGraphMemAttrReservedMemHigh = 3 - - cdef enum cudaDeviceP2PAttr: - cudaDevP2PAttrPerformanceRank = 1 - cudaDevP2PAttrAccessSupported = 2 - cudaDevP2PAttrNativeAtomicSupported = 3 - cudaDevP2PAttrCudaArrayAccessSupported = 4 - - cdef enum cudaExternalMemoryHandleType: - cudaExternalMemoryHandleTypeOpaqueFd = 1 - cudaExternalMemoryHandleTypeOpaqueWin32 = 2 - cudaExternalMemoryHandleTypeOpaqueWin32Kmt = 3 - cudaExternalMemoryHandleTypeD3D12Heap = 4 - cudaExternalMemoryHandleTypeD3D12Resource = 5 - cudaExternalMemoryHandleTypeD3D11Resource = 6 - cudaExternalMemoryHandleTypeD3D11ResourceKmt = 7 - cudaExternalMemoryHandleTypeNvSciBuf = 8 - - cdef enum cudaExternalSemaphoreHandleType: - cudaExternalSemaphoreHandleTypeOpaqueFd = 1 - cudaExternalSemaphoreHandleTypeOpaqueWin32 = 2 - cudaExternalSemaphoreHandleTypeOpaqueWin32Kmt = 3 - cudaExternalSemaphoreHandleTypeD3D12Fence = 4 - cudaExternalSemaphoreHandleTypeD3D11Fence = 5 - cudaExternalSemaphoreHandleTypeNvSciSync = 6 - cudaExternalSemaphoreHandleTypeKeyedMutex = 7 - cudaExternalSemaphoreHandleTypeKeyedMutexKmt = 8 - cudaExternalSemaphoreHandleTypeTimelineSemaphoreFd = 9 - cudaExternalSemaphoreHandleTypeTimelineSemaphoreWin32 = 10 - - cdef enum cudaCGScope: - cudaCGScopeInvalid = 0 - cudaCGScopeGrid = 1 - cudaCGScopeMultiGrid = 2 - - cdef enum cudaGraphConditionalHandleFlags: - cudaGraphCondAssignDefault = 1 - - cdef enum cudaGraphConditionalNodeType: - cudaGraphCondTypeIf = 0 - cudaGraphCondTypeWhile = 1 - - cdef enum cudaGraphNodeType: - cudaGraphNodeTypeKernel = 0 - cudaGraphNodeTypeMemcpy = 1 - cudaGraphNodeTypeMemset = 2 - cudaGraphNodeTypeHost = 3 - cudaGraphNodeTypeGraph = 4 - cudaGraphNodeTypeEmpty = 5 - cudaGraphNodeTypeWaitEvent = 6 - cudaGraphNodeTypeEventRecord = 7 - cudaGraphNodeTypeExtSemaphoreSignal = 8 - cudaGraphNodeTypeExtSemaphoreWait = 9 - cudaGraphNodeTypeMemAlloc = 10 - cudaGraphNodeTypeMemFree = 11 - cudaGraphNodeTypeConditional = 13 - cudaGraphNodeTypeCount = 14 - - cdef enum cudaGraphExecUpdateResult: - cudaGraphExecUpdateSuccess = 0 - cudaGraphExecUpdateError = 1 - cudaGraphExecUpdateErrorTopologyChanged = 2 - cudaGraphExecUpdateErrorNodeTypeChanged = 3 - cudaGraphExecUpdateErrorFunctionChanged = 4 - cudaGraphExecUpdateErrorParametersChanged = 5 - cudaGraphExecUpdateErrorNotSupported = 6 - cudaGraphExecUpdateErrorUnsupportedFunctionChange = 7 - cudaGraphExecUpdateErrorAttributesChanged = 8 - - cdef enum cudaGraphKernelNodeField: - cudaGraphKernelNodeFieldInvalid = 0 - cudaGraphKernelNodeFieldGridDim = 1 - cudaGraphKernelNodeFieldParam = 2 - cudaGraphKernelNodeFieldEnabled = 3 - - cdef enum cudaGetDriverEntryPointFlags: - cudaEnableDefault = 0 - cudaEnableLegacyStream = 1 - cudaEnablePerThreadDefaultStream = 2 - - cdef enum cudaDriverEntryPointQueryResult: - cudaDriverEntryPointSuccess = 0 - cudaDriverEntryPointSymbolNotFound = 1 - cudaDriverEntryPointVersionNotSufficent = 2 - - cdef enum cudaGraphDebugDotFlags: - cudaGraphDebugDotFlagsVerbose = 1 - cudaGraphDebugDotFlagsKernelNodeParams = 4 - cudaGraphDebugDotFlagsMemcpyNodeParams = 8 - cudaGraphDebugDotFlagsMemsetNodeParams = 16 - cudaGraphDebugDotFlagsHostNodeParams = 32 - cudaGraphDebugDotFlagsEventNodeParams = 64 - cudaGraphDebugDotFlagsExtSemasSignalNodeParams = 128 - cudaGraphDebugDotFlagsExtSemasWaitNodeParams = 256 - cudaGraphDebugDotFlagsKernelNodeAttributes = 512 - cudaGraphDebugDotFlagsHandles = 1024 - cudaGraphDebugDotFlagsConditionalNodeParams = 32768 - - cdef enum cudaGraphInstantiateFlags: - cudaGraphInstantiateFlagAutoFreeOnLaunch = 1 - cudaGraphInstantiateFlagUpload = 2 - cudaGraphInstantiateFlagDeviceLaunch = 4 - cudaGraphInstantiateFlagUseNodePriority = 8 - - cdef enum cudaDeviceNumaConfig: - cudaDeviceNumaConfigNone = 0 - cudaDeviceNumaConfigNumaNode = 1 - -cdef extern from "surface_types.h": - - ctypedef unsigned long long cudaSurfaceObject_t - - cdef enum cudaSurfaceBoundaryMode: - cudaBoundaryModeZero = 0 - cudaBoundaryModeClamp = 1 - cudaBoundaryModeTrap = 2 - - cdef enum cudaSurfaceFormatMode: - cudaFormatModeForced = 0 - cudaFormatModeAuto = 1 - -cdef extern from "texture_types.h": - - cdef struct cudaTextureDesc: - cudaTextureAddressMode addressMode[3] - cudaTextureFilterMode filterMode - cudaTextureReadMode readMode - int sRGB - float borderColor[4] - int normalizedCoords - unsigned int maxAnisotropy - cudaTextureFilterMode mipmapFilterMode - float mipmapLevelBias - float minMipmapLevelClamp - float maxMipmapLevelClamp - int disableTrilinearOptimization - int seamlessCubemap - - ctypedef unsigned long long cudaTextureObject_t - - cdef enum cudaTextureAddressMode: - cudaAddressModeWrap = 0 - cudaAddressModeClamp = 1 - cudaAddressModeMirror = 2 - cudaAddressModeBorder = 3 - - cdef enum cudaTextureFilterMode: - cudaFilterModePoint = 0 - cudaFilterModeLinear = 1 - - cdef enum cudaTextureReadMode: - cudaReadModeElementType = 0 - cudaReadModeNormalizedFloat = 1 - -cdef extern from "library_types.h": - - cdef enum cudaDataType_t: - CUDA_R_32F = 0 - CUDA_R_64F = 1 - CUDA_R_16F = 2 - CUDA_R_8I = 3 - CUDA_C_32F = 4 - CUDA_C_64F = 5 - CUDA_C_16F = 6 - CUDA_C_8I = 7 - CUDA_R_8U = 8 - CUDA_C_8U = 9 - CUDA_R_32I = 10 - CUDA_C_32I = 11 - CUDA_R_32U = 12 - CUDA_C_32U = 13 - CUDA_R_16BF = 14 - CUDA_C_16BF = 15 - CUDA_R_4I = 16 - CUDA_C_4I = 17 - CUDA_R_4U = 18 - CUDA_C_4U = 19 - CUDA_R_16I = 20 - CUDA_C_16I = 21 - CUDA_R_16U = 22 - CUDA_C_16U = 23 - CUDA_R_64I = 24 - CUDA_C_64I = 25 - CUDA_R_64U = 26 - CUDA_C_64U = 27 - CUDA_R_8F_E4M3 = 28 - CUDA_R_8F_E5M2 = 29 - - ctypedef cudaDataType_t cudaDataType - - cdef enum libraryPropertyType_t: - MAJOR_VERSION = 0 - MINOR_VERSION = 1 - PATCH_LEVEL = 2 - - ctypedef libraryPropertyType_t libraryPropertyType - -cdef extern from "cuda_runtime_api.h": - - ctypedef void (*cudaStreamCallback_t)(cudaStream_t stream, cudaError_t status, void* userData) - -cdef extern from "device_types.h": - - cdef enum cudaRoundMode: - cudaRoundNearest = 0 - cudaRoundZero = 1 - cudaRoundPosInf = 2 - cudaRoundMinInf = 3 - -ctypedef unsigned int GLenum - -ctypedef unsigned int GLuint - -cdef extern from "": - cdef struct void: - pass -ctypedef void* EGLImageKHR - -cdef extern from "": - cdef struct void: - pass -ctypedef void* EGLStreamKHR - -ctypedef unsigned int EGLint - -cdef extern from "": - cdef struct void: - pass -ctypedef void* EGLSyncKHR - -ctypedef uint32_t VdpDevice - -ctypedef unsigned long long VdpGetProcAddress - -ctypedef uint32_t VdpVideoSurface - -ctypedef uint32_t VdpOutputSurface - -ctypedef cudaLaunchAttributeID cudaStreamAttrID - -ctypedef cudaLaunchAttributeID cudaKernelNodeAttrID - -ctypedef cudaLaunchAttributeValue cudaStreamAttrValue - -ctypedef cudaLaunchAttributeValue cudaKernelNodeAttrValue - -cdef enum cudaEglFrameType_enum: - cudaEglFrameTypeArray = 0 - cudaEglFrameTypePitch = 1 - -ctypedef cudaEglFrameType_enum cudaEglFrameType - -cdef enum cudaEglResourceLocationFlags_enum: - cudaEglResourceLocationSysmem = 0 - cudaEglResourceLocationVidmem = 1 - -ctypedef cudaEglResourceLocationFlags_enum cudaEglResourceLocationFlags - -cdef enum cudaEglColorFormat_enum: - cudaEglColorFormatYUV420Planar = 0 - cudaEglColorFormatYUV420SemiPlanar = 1 - cudaEglColorFormatYUV422Planar = 2 - cudaEglColorFormatYUV422SemiPlanar = 3 - cudaEglColorFormatARGB = 6 - cudaEglColorFormatRGBA = 7 - cudaEglColorFormatL = 8 - cudaEglColorFormatR = 9 - cudaEglColorFormatYUV444Planar = 10 - cudaEglColorFormatYUV444SemiPlanar = 11 - cudaEglColorFormatYUYV422 = 12 - cudaEglColorFormatUYVY422 = 13 - cudaEglColorFormatABGR = 14 - cudaEglColorFormatBGRA = 15 - cudaEglColorFormatA = 16 - cudaEglColorFormatRG = 17 - cudaEglColorFormatAYUV = 18 - cudaEglColorFormatYVU444SemiPlanar = 19 - cudaEglColorFormatYVU422SemiPlanar = 20 - cudaEglColorFormatYVU420SemiPlanar = 21 - cudaEglColorFormatY10V10U10_444SemiPlanar = 22 - cudaEglColorFormatY10V10U10_420SemiPlanar = 23 - cudaEglColorFormatY12V12U12_444SemiPlanar = 24 - cudaEglColorFormatY12V12U12_420SemiPlanar = 25 - cudaEglColorFormatVYUY_ER = 26 - cudaEglColorFormatUYVY_ER = 27 - cudaEglColorFormatYUYV_ER = 28 - cudaEglColorFormatYVYU_ER = 29 - cudaEglColorFormatYUVA_ER = 31 - cudaEglColorFormatAYUV_ER = 32 - cudaEglColorFormatYUV444Planar_ER = 33 - cudaEglColorFormatYUV422Planar_ER = 34 - cudaEglColorFormatYUV420Planar_ER = 35 - cudaEglColorFormatYUV444SemiPlanar_ER = 36 - cudaEglColorFormatYUV422SemiPlanar_ER = 37 - cudaEglColorFormatYUV420SemiPlanar_ER = 38 - cudaEglColorFormatYVU444Planar_ER = 39 - cudaEglColorFormatYVU422Planar_ER = 40 - cudaEglColorFormatYVU420Planar_ER = 41 - cudaEglColorFormatYVU444SemiPlanar_ER = 42 - cudaEglColorFormatYVU422SemiPlanar_ER = 43 - cudaEglColorFormatYVU420SemiPlanar_ER = 44 - cudaEglColorFormatBayerRGGB = 45 - cudaEglColorFormatBayerBGGR = 46 - cudaEglColorFormatBayerGRBG = 47 - cudaEglColorFormatBayerGBRG = 48 - cudaEglColorFormatBayer10RGGB = 49 - cudaEglColorFormatBayer10BGGR = 50 - cudaEglColorFormatBayer10GRBG = 51 - cudaEglColorFormatBayer10GBRG = 52 - cudaEglColorFormatBayer12RGGB = 53 - cudaEglColorFormatBayer12BGGR = 54 - cudaEglColorFormatBayer12GRBG = 55 - cudaEglColorFormatBayer12GBRG = 56 - cudaEglColorFormatBayer14RGGB = 57 - cudaEglColorFormatBayer14BGGR = 58 - cudaEglColorFormatBayer14GRBG = 59 - cudaEglColorFormatBayer14GBRG = 60 - cudaEglColorFormatBayer20RGGB = 61 - cudaEglColorFormatBayer20BGGR = 62 - cudaEglColorFormatBayer20GRBG = 63 - cudaEglColorFormatBayer20GBRG = 64 - cudaEglColorFormatYVU444Planar = 65 - cudaEglColorFormatYVU422Planar = 66 - cudaEglColorFormatYVU420Planar = 67 - cudaEglColorFormatBayerIspRGGB = 68 - cudaEglColorFormatBayerIspBGGR = 69 - cudaEglColorFormatBayerIspGRBG = 70 - cudaEglColorFormatBayerIspGBRG = 71 - cudaEglColorFormatBayerBCCR = 72 - cudaEglColorFormatBayerRCCB = 73 - cudaEglColorFormatBayerCRBC = 74 - cudaEglColorFormatBayerCBRC = 75 - cudaEglColorFormatBayer10CCCC = 76 - cudaEglColorFormatBayer12BCCR = 77 - cudaEglColorFormatBayer12RCCB = 78 - cudaEglColorFormatBayer12CRBC = 79 - cudaEglColorFormatBayer12CBRC = 80 - cudaEglColorFormatBayer12CCCC = 81 - cudaEglColorFormatY = 82 - cudaEglColorFormatYUV420SemiPlanar_2020 = 83 - cudaEglColorFormatYVU420SemiPlanar_2020 = 84 - cudaEglColorFormatYUV420Planar_2020 = 85 - cudaEglColorFormatYVU420Planar_2020 = 86 - cudaEglColorFormatYUV420SemiPlanar_709 = 87 - cudaEglColorFormatYVU420SemiPlanar_709 = 88 - cudaEglColorFormatYUV420Planar_709 = 89 - cudaEglColorFormatYVU420Planar_709 = 90 - cudaEglColorFormatY10V10U10_420SemiPlanar_709 = 91 - cudaEglColorFormatY10V10U10_420SemiPlanar_2020 = 92 - cudaEglColorFormatY10V10U10_422SemiPlanar_2020 = 93 - cudaEglColorFormatY10V10U10_422SemiPlanar = 94 - cudaEglColorFormatY10V10U10_422SemiPlanar_709 = 95 - cudaEglColorFormatY_ER = 96 - cudaEglColorFormatY_709_ER = 97 - cudaEglColorFormatY10_ER = 98 - cudaEglColorFormatY10_709_ER = 99 - cudaEglColorFormatY12_ER = 100 - cudaEglColorFormatY12_709_ER = 101 - cudaEglColorFormatYUVA = 102 - cudaEglColorFormatYVYU = 104 - cudaEglColorFormatVYUY = 105 - cudaEglColorFormatY10V10U10_420SemiPlanar_ER = 106 - cudaEglColorFormatY10V10U10_420SemiPlanar_709_ER = 107 - cudaEglColorFormatY10V10U10_444SemiPlanar_ER = 108 - cudaEglColorFormatY10V10U10_444SemiPlanar_709_ER = 109 - cudaEglColorFormatY12V12U12_420SemiPlanar_ER = 110 - cudaEglColorFormatY12V12U12_420SemiPlanar_709_ER = 111 - cudaEglColorFormatY12V12U12_444SemiPlanar_ER = 112 - cudaEglColorFormatY12V12U12_444SemiPlanar_709_ER = 113 - -ctypedef cudaEglColorFormat_enum cudaEglColorFormat - -cdef struct cudaEglPlaneDesc_st: - unsigned int width - unsigned int height - unsigned int depth - unsigned int pitch - unsigned int numChannels - cudaChannelFormatDesc channelDesc - unsigned int reserved[4] - -ctypedef cudaEglPlaneDesc_st cudaEglPlaneDesc - -cdef union anon_union10: - cudaArray_t pArray[3] - cudaPitchedPtr pPitch[3] - -cdef struct cudaEglFrame_st: - anon_union10 frame - cudaEglPlaneDesc planeDesc[3] - unsigned int planeCount - cudaEglFrameType frameType - cudaEglColorFormat eglColorFormat - -ctypedef cudaEglFrame_st cudaEglFrame - -cdef extern from "": - cdef struct CUeglStreamConnection_st: - pass -ctypedef CUeglStreamConnection_st* cudaEglStreamConnection - -cdef enum cudaGLDeviceList: - cudaGLDeviceListAll = 1 - cudaGLDeviceListCurrentFrame = 2 - cudaGLDeviceListNextFrame = 3 - -cdef enum cudaGLMapFlags: - cudaGLMapFlagsNone = 0 - cudaGLMapFlagsReadOnly = 1 - cudaGLMapFlagsWriteDiscard = 2 - -{{if 'cudaDeviceReset' in found_functions}} - -cdef cudaError_t cudaDeviceReset() except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaDeviceSynchronize' in found_functions}} - -cdef cudaError_t cudaDeviceSynchronize() except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaDeviceSetLimit' in found_functions}} - -cdef cudaError_t cudaDeviceSetLimit(cudaLimit limit, size_t value) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaDeviceGetLimit' in found_functions}} - -cdef cudaError_t cudaDeviceGetLimit(size_t* pValue, cudaLimit limit) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaDeviceGetTexture1DLinearMaxWidth' in found_functions}} - -cdef cudaError_t cudaDeviceGetTexture1DLinearMaxWidth(size_t* maxWidthInElements, const cudaChannelFormatDesc* fmtDesc, int device) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaDeviceGetCacheConfig' in found_functions}} - -cdef cudaError_t cudaDeviceGetCacheConfig(cudaFuncCache* pCacheConfig) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaDeviceGetStreamPriorityRange' in found_functions}} - -cdef cudaError_t cudaDeviceGetStreamPriorityRange(int* leastPriority, int* greatestPriority) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaDeviceSetCacheConfig' in found_functions}} - -cdef cudaError_t cudaDeviceSetCacheConfig(cudaFuncCache cacheConfig) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaDeviceGetByPCIBusId' in found_functions}} - -cdef cudaError_t cudaDeviceGetByPCIBusId(int* device, const char* pciBusId) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaDeviceGetPCIBusId' in found_functions}} - -cdef cudaError_t cudaDeviceGetPCIBusId(char* pciBusId, int length, int device) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaIpcGetEventHandle' in found_functions}} - -cdef cudaError_t cudaIpcGetEventHandle(cudaIpcEventHandle_t* handle, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaIpcOpenEventHandle' in found_functions}} - -cdef cudaError_t cudaIpcOpenEventHandle(cudaEvent_t* event, cudaIpcEventHandle_t handle) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaIpcGetMemHandle' in found_functions}} - -cdef cudaError_t cudaIpcGetMemHandle(cudaIpcMemHandle_t* handle, void* devPtr) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaIpcOpenMemHandle' in found_functions}} - -cdef cudaError_t cudaIpcOpenMemHandle(void** devPtr, cudaIpcMemHandle_t handle, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaIpcCloseMemHandle' in found_functions}} - -cdef cudaError_t cudaIpcCloseMemHandle(void* devPtr) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaDeviceFlushGPUDirectRDMAWrites' in found_functions}} - -cdef cudaError_t cudaDeviceFlushGPUDirectRDMAWrites(cudaFlushGPUDirectRDMAWritesTarget target, cudaFlushGPUDirectRDMAWritesScope scope) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaDeviceRegisterAsyncNotification' in found_functions}} - -cdef cudaError_t cudaDeviceRegisterAsyncNotification(int device, cudaAsyncCallback callbackFunc, void* userData, cudaAsyncCallbackHandle_t* callback) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaDeviceUnregisterAsyncNotification' in found_functions}} - -cdef cudaError_t cudaDeviceUnregisterAsyncNotification(int device, cudaAsyncCallbackHandle_t callback) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaDeviceGetSharedMemConfig' in found_functions}} - -cdef cudaError_t cudaDeviceGetSharedMemConfig(cudaSharedMemConfig* pConfig) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaDeviceSetSharedMemConfig' in found_functions}} - -cdef cudaError_t cudaDeviceSetSharedMemConfig(cudaSharedMemConfig config) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGetLastError' in found_functions}} - -cdef cudaError_t cudaGetLastError() except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaPeekAtLastError' in found_functions}} - -cdef cudaError_t cudaPeekAtLastError() except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGetErrorName' in found_functions}} - -cdef const char* cudaGetErrorName(cudaError_t error) except ?NULL nogil -{{endif}} - -{{if 'cudaGetErrorString' in found_functions}} - -cdef const char* cudaGetErrorString(cudaError_t error) except ?NULL nogil -{{endif}} - -{{if 'cudaGetDeviceCount' in found_functions}} - -cdef cudaError_t cudaGetDeviceCount(int* count) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGetDeviceProperties_v2' in found_functions}} - -cdef cudaError_t cudaGetDeviceProperties(cudaDeviceProp* prop, int device) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaDeviceGetAttribute' in found_functions}} - -cdef cudaError_t cudaDeviceGetAttribute(int* value, cudaDeviceAttr attr, int device) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaDeviceGetDefaultMemPool' in found_functions}} - -cdef cudaError_t cudaDeviceGetDefaultMemPool(cudaMemPool_t* memPool, int device) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaDeviceSetMemPool' in found_functions}} - -cdef cudaError_t cudaDeviceSetMemPool(int device, cudaMemPool_t memPool) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaDeviceGetMemPool' in found_functions}} - -cdef cudaError_t cudaDeviceGetMemPool(cudaMemPool_t* memPool, int device) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaDeviceGetNvSciSyncAttributes' in found_functions}} - -cdef cudaError_t cudaDeviceGetNvSciSyncAttributes(void* nvSciSyncAttrList, int device, int flags) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaDeviceGetP2PAttribute' in found_functions}} - -cdef cudaError_t cudaDeviceGetP2PAttribute(int* value, cudaDeviceP2PAttr attr, int srcDevice, int dstDevice) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaChooseDevice' in found_functions}} - -cdef cudaError_t cudaChooseDevice(int* device, const cudaDeviceProp* prop) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaInitDevice' in found_functions}} - -cdef cudaError_t cudaInitDevice(int device, unsigned int deviceFlags, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaSetDevice' in found_functions}} - -cdef cudaError_t cudaSetDevice(int device) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGetDevice' in found_functions}} - -cdef cudaError_t cudaGetDevice(int* device) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaSetDeviceFlags' in found_functions}} - -cdef cudaError_t cudaSetDeviceFlags(unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGetDeviceFlags' in found_functions}} - -cdef cudaError_t cudaGetDeviceFlags(unsigned int* flags) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaStreamCreate' in found_functions}} - -cdef cudaError_t cudaStreamCreate(cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaStreamCreateWithFlags' in found_functions}} - -cdef cudaError_t cudaStreamCreateWithFlags(cudaStream_t* pStream, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaStreamCreateWithPriority' in found_functions}} - -cdef cudaError_t cudaStreamCreateWithPriority(cudaStream_t* pStream, unsigned int flags, int priority) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaStreamGetPriority' in found_functions}} - -cdef cudaError_t cudaStreamGetPriority(cudaStream_t hStream, int* priority) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaStreamGetFlags' in found_functions}} - -cdef cudaError_t cudaStreamGetFlags(cudaStream_t hStream, unsigned int* flags) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaStreamGetId' in found_functions}} - -cdef cudaError_t cudaStreamGetId(cudaStream_t hStream, unsigned long long* streamId) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaCtxResetPersistingL2Cache' in found_functions}} - -cdef cudaError_t cudaCtxResetPersistingL2Cache() except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaStreamCopyAttributes' in found_functions}} - -cdef cudaError_t cudaStreamCopyAttributes(cudaStream_t dst, cudaStream_t src) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaStreamGetAttribute' in found_functions}} - -cdef cudaError_t cudaStreamGetAttribute(cudaStream_t hStream, cudaStreamAttrID attr, cudaStreamAttrValue* value_out) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaStreamSetAttribute' in found_functions}} - -cdef cudaError_t cudaStreamSetAttribute(cudaStream_t hStream, cudaStreamAttrID attr, const cudaStreamAttrValue* value) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaStreamDestroy' in found_functions}} - -cdef cudaError_t cudaStreamDestroy(cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaStreamWaitEvent' in found_functions}} - -cdef cudaError_t cudaStreamWaitEvent(cudaStream_t stream, cudaEvent_t event, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaStreamAddCallback' in found_functions}} - -cdef cudaError_t cudaStreamAddCallback(cudaStream_t stream, cudaStreamCallback_t callback, void* userData, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaStreamSynchronize' in found_functions}} - -cdef cudaError_t cudaStreamSynchronize(cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaStreamQuery' in found_functions}} - -cdef cudaError_t cudaStreamQuery(cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaStreamAttachMemAsync' in found_functions}} - -cdef cudaError_t cudaStreamAttachMemAsync(cudaStream_t stream, void* devPtr, size_t length, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaStreamBeginCapture' in found_functions}} - -cdef cudaError_t cudaStreamBeginCapture(cudaStream_t stream, cudaStreamCaptureMode mode) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaStreamBeginCaptureToGraph' in found_functions}} - -cdef cudaError_t cudaStreamBeginCaptureToGraph(cudaStream_t stream, cudaGraph_t graph, const cudaGraphNode_t* dependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, cudaStreamCaptureMode mode) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaThreadExchangeStreamCaptureMode' in found_functions}} - -cdef cudaError_t cudaThreadExchangeStreamCaptureMode(cudaStreamCaptureMode* mode) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaStreamEndCapture' in found_functions}} - -cdef cudaError_t cudaStreamEndCapture(cudaStream_t stream, cudaGraph_t* pGraph) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaStreamIsCapturing' in found_functions}} - -cdef cudaError_t cudaStreamIsCapturing(cudaStream_t stream, cudaStreamCaptureStatus* pCaptureStatus) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaStreamGetCaptureInfo_v2' in found_functions}} - -cdef cudaError_t cudaStreamGetCaptureInfo(cudaStream_t stream, cudaStreamCaptureStatus* captureStatus_out, unsigned long long* id_out, cudaGraph_t* graph_out, const cudaGraphNode_t** dependencies_out, size_t* numDependencies_out) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaStreamGetCaptureInfo_v3' in found_functions}} - -cdef cudaError_t cudaStreamGetCaptureInfo_v3(cudaStream_t stream, cudaStreamCaptureStatus* captureStatus_out, unsigned long long* id_out, cudaGraph_t* graph_out, const cudaGraphNode_t** dependencies_out, const cudaGraphEdgeData** edgeData_out, size_t* numDependencies_out) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaStreamUpdateCaptureDependencies' in found_functions}} - -cdef cudaError_t cudaStreamUpdateCaptureDependencies(cudaStream_t stream, cudaGraphNode_t* dependencies, size_t numDependencies, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaStreamUpdateCaptureDependencies_v2' in found_functions}} - -cdef cudaError_t cudaStreamUpdateCaptureDependencies_v2(cudaStream_t stream, cudaGraphNode_t* dependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaEventCreate' in found_functions}} - -cdef cudaError_t cudaEventCreate(cudaEvent_t* event) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaEventCreateWithFlags' in found_functions}} - -cdef cudaError_t cudaEventCreateWithFlags(cudaEvent_t* event, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaEventRecord' in found_functions}} - -cdef cudaError_t cudaEventRecord(cudaEvent_t event, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaEventRecordWithFlags' in found_functions}} - -cdef cudaError_t cudaEventRecordWithFlags(cudaEvent_t event, cudaStream_t stream, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaEventQuery' in found_functions}} - -cdef cudaError_t cudaEventQuery(cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaEventSynchronize' in found_functions}} - -cdef cudaError_t cudaEventSynchronize(cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaEventDestroy' in found_functions}} - -cdef cudaError_t cudaEventDestroy(cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaEventElapsedTime' in found_functions}} - -cdef cudaError_t cudaEventElapsedTime(float* ms, cudaEvent_t start, cudaEvent_t end) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaImportExternalMemory' in found_functions}} - -cdef cudaError_t cudaImportExternalMemory(cudaExternalMemory_t* extMem_out, const cudaExternalMemoryHandleDesc* memHandleDesc) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaExternalMemoryGetMappedBuffer' in found_functions}} - -cdef cudaError_t cudaExternalMemoryGetMappedBuffer(void** devPtr, cudaExternalMemory_t extMem, const cudaExternalMemoryBufferDesc* bufferDesc) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaExternalMemoryGetMappedMipmappedArray' in found_functions}} - -cdef cudaError_t cudaExternalMemoryGetMappedMipmappedArray(cudaMipmappedArray_t* mipmap, cudaExternalMemory_t extMem, const cudaExternalMemoryMipmappedArrayDesc* mipmapDesc) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaDestroyExternalMemory' in found_functions}} - -cdef cudaError_t cudaDestroyExternalMemory(cudaExternalMemory_t extMem) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaImportExternalSemaphore' in found_functions}} - -cdef cudaError_t cudaImportExternalSemaphore(cudaExternalSemaphore_t* extSem_out, const cudaExternalSemaphoreHandleDesc* semHandleDesc) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaSignalExternalSemaphoresAsync_v2' in found_functions}} - -cdef cudaError_t cudaSignalExternalSemaphoresAsync(const cudaExternalSemaphore_t* extSemArray, const cudaExternalSemaphoreSignalParams* paramsArray, unsigned int numExtSems, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaWaitExternalSemaphoresAsync_v2' in found_functions}} - -cdef cudaError_t cudaWaitExternalSemaphoresAsync(const cudaExternalSemaphore_t* extSemArray, const cudaExternalSemaphoreWaitParams* paramsArray, unsigned int numExtSems, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaDestroyExternalSemaphore' in found_functions}} - -cdef cudaError_t cudaDestroyExternalSemaphore(cudaExternalSemaphore_t extSem) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaFuncSetCacheConfig' in found_functions}} - -cdef cudaError_t cudaFuncSetCacheConfig(const void* func, cudaFuncCache cacheConfig) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaFuncGetAttributes' in found_functions}} - -cdef cudaError_t cudaFuncGetAttributes(cudaFuncAttributes* attr, const void* func) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaFuncSetAttribute' in found_functions}} - -cdef cudaError_t cudaFuncSetAttribute(const void* func, cudaFuncAttribute attr, int value) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaLaunchHostFunc' in found_functions}} - -cdef cudaError_t cudaLaunchHostFunc(cudaStream_t stream, cudaHostFn_t fn, void* userData) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaFuncSetSharedMemConfig' in found_functions}} - -cdef cudaError_t cudaFuncSetSharedMemConfig(const void* func, cudaSharedMemConfig config) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaOccupancyMaxActiveBlocksPerMultiprocessor' in found_functions}} - -cdef cudaError_t cudaOccupancyMaxActiveBlocksPerMultiprocessor(int* numBlocks, const void* func, int blockSize, size_t dynamicSMemSize) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaOccupancyAvailableDynamicSMemPerBlock' in found_functions}} - -cdef cudaError_t cudaOccupancyAvailableDynamicSMemPerBlock(size_t* dynamicSmemSize, const void* func, int numBlocks, int blockSize) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags' in found_functions}} - -cdef cudaError_t cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(int* numBlocks, const void* func, int blockSize, size_t dynamicSMemSize, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaMallocManaged' in found_functions}} - -cdef cudaError_t cudaMallocManaged(void** devPtr, size_t size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaMalloc' in found_functions}} - -cdef cudaError_t cudaMalloc(void** devPtr, size_t size) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaMallocHost' in found_functions}} - -cdef cudaError_t cudaMallocHost(void** ptr, size_t size) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaMallocPitch' in found_functions}} - -cdef cudaError_t cudaMallocPitch(void** devPtr, size_t* pitch, size_t width, size_t height) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaMallocArray' in found_functions}} - -cdef cudaError_t cudaMallocArray(cudaArray_t* array, const cudaChannelFormatDesc* desc, size_t width, size_t height, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaFree' in found_functions}} - -cdef cudaError_t cudaFree(void* devPtr) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaFreeHost' in found_functions}} - -cdef cudaError_t cudaFreeHost(void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaFreeArray' in found_functions}} - -cdef cudaError_t cudaFreeArray(cudaArray_t array) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaFreeMipmappedArray' in found_functions}} - -cdef cudaError_t cudaFreeMipmappedArray(cudaMipmappedArray_t mipmappedArray) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaHostAlloc' in found_functions}} - -cdef cudaError_t cudaHostAlloc(void** pHost, size_t size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaHostRegister' in found_functions}} - -cdef cudaError_t cudaHostRegister(void* ptr, size_t size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaHostUnregister' in found_functions}} - -cdef cudaError_t cudaHostUnregister(void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaHostGetDevicePointer' in found_functions}} - -cdef cudaError_t cudaHostGetDevicePointer(void** pDevice, void* pHost, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaHostGetFlags' in found_functions}} - -cdef cudaError_t cudaHostGetFlags(unsigned int* pFlags, void* pHost) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaMalloc3D' in found_functions}} - -cdef cudaError_t cudaMalloc3D(cudaPitchedPtr* pitchedDevPtr, cudaExtent extent) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaMalloc3DArray' in found_functions}} - -cdef cudaError_t cudaMalloc3DArray(cudaArray_t* array, const cudaChannelFormatDesc* desc, cudaExtent extent, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaMallocMipmappedArray' in found_functions}} - -cdef cudaError_t cudaMallocMipmappedArray(cudaMipmappedArray_t* mipmappedArray, const cudaChannelFormatDesc* desc, cudaExtent extent, unsigned int numLevels, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGetMipmappedArrayLevel' in found_functions}} - -cdef cudaError_t cudaGetMipmappedArrayLevel(cudaArray_t* levelArray, cudaMipmappedArray_const_t mipmappedArray, unsigned int level) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaMemcpy3D' in found_functions}} - -cdef cudaError_t cudaMemcpy3D(const cudaMemcpy3DParms* p) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaMemcpy3DPeer' in found_functions}} - -cdef cudaError_t cudaMemcpy3DPeer(const cudaMemcpy3DPeerParms* p) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaMemcpy3DAsync' in found_functions}} - -cdef cudaError_t cudaMemcpy3DAsync(const cudaMemcpy3DParms* p, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaMemcpy3DPeerAsync' in found_functions}} - -cdef cudaError_t cudaMemcpy3DPeerAsync(const cudaMemcpy3DPeerParms* p, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaMemGetInfo' in found_functions}} - -cdef cudaError_t cudaMemGetInfo(size_t* free, size_t* total) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaArrayGetInfo' in found_functions}} - -cdef cudaError_t cudaArrayGetInfo(cudaChannelFormatDesc* desc, cudaExtent* extent, unsigned int* flags, cudaArray_t array) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaArrayGetPlane' in found_functions}} - -cdef cudaError_t cudaArrayGetPlane(cudaArray_t* pPlaneArray, cudaArray_t hArray, unsigned int planeIdx) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaArrayGetMemoryRequirements' in found_functions}} - -cdef cudaError_t cudaArrayGetMemoryRequirements(cudaArrayMemoryRequirements* memoryRequirements, cudaArray_t array, int device) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaMipmappedArrayGetMemoryRequirements' in found_functions}} - -cdef cudaError_t cudaMipmappedArrayGetMemoryRequirements(cudaArrayMemoryRequirements* memoryRequirements, cudaMipmappedArray_t mipmap, int device) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaArrayGetSparseProperties' in found_functions}} - -cdef cudaError_t cudaArrayGetSparseProperties(cudaArraySparseProperties* sparseProperties, cudaArray_t array) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaMipmappedArrayGetSparseProperties' in found_functions}} - -cdef cudaError_t cudaMipmappedArrayGetSparseProperties(cudaArraySparseProperties* sparseProperties, cudaMipmappedArray_t mipmap) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaMemcpy' in found_functions}} - -cdef cudaError_t cudaMemcpy(void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaMemcpyPeer' in found_functions}} - -cdef cudaError_t cudaMemcpyPeer(void* dst, int dstDevice, const void* src, int srcDevice, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaMemcpy2D' in found_functions}} - -cdef cudaError_t cudaMemcpy2D(void* dst, size_t dpitch, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaMemcpy2DToArray' in found_functions}} - -cdef cudaError_t cudaMemcpy2DToArray(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaMemcpy2DFromArray' in found_functions}} - -cdef cudaError_t cudaMemcpy2DFromArray(void* dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaMemcpy2DArrayToArray' in found_functions}} - -cdef cudaError_t cudaMemcpy2DArrayToArray(cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaMemcpyAsync' in found_functions}} - -cdef cudaError_t cudaMemcpyAsync(void* dst, const void* src, size_t count, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaMemcpyPeerAsync' in found_functions}} - -cdef cudaError_t cudaMemcpyPeerAsync(void* dst, int dstDevice, const void* src, int srcDevice, size_t count, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaMemcpy2DAsync' in found_functions}} - -cdef cudaError_t cudaMemcpy2DAsync(void* dst, size_t dpitch, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaMemcpy2DToArrayAsync' in found_functions}} - -cdef cudaError_t cudaMemcpy2DToArrayAsync(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaMemcpy2DFromArrayAsync' in found_functions}} - -cdef cudaError_t cudaMemcpy2DFromArrayAsync(void* dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaMemset' in found_functions}} - -cdef cudaError_t cudaMemset(void* devPtr, int value, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaMemset2D' in found_functions}} - -cdef cudaError_t cudaMemset2D(void* devPtr, size_t pitch, int value, size_t width, size_t height) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaMemset3D' in found_functions}} - -cdef cudaError_t cudaMemset3D(cudaPitchedPtr pitchedDevPtr, int value, cudaExtent extent) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaMemsetAsync' in found_functions}} - -cdef cudaError_t cudaMemsetAsync(void* devPtr, int value, size_t count, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaMemset2DAsync' in found_functions}} - -cdef cudaError_t cudaMemset2DAsync(void* devPtr, size_t pitch, int value, size_t width, size_t height, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaMemset3DAsync' in found_functions}} - -cdef cudaError_t cudaMemset3DAsync(cudaPitchedPtr pitchedDevPtr, int value, cudaExtent extent, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaMemPrefetchAsync' in found_functions}} - -cdef cudaError_t cudaMemPrefetchAsync(const void* devPtr, size_t count, int dstDevice, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaMemPrefetchAsync_v2' in found_functions}} - -cdef cudaError_t cudaMemPrefetchAsync_v2(const void* devPtr, size_t count, cudaMemLocation location, unsigned int flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaMemAdvise' in found_functions}} - -cdef cudaError_t cudaMemAdvise(const void* devPtr, size_t count, cudaMemoryAdvise advice, int device) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaMemAdvise_v2' in found_functions}} - -cdef cudaError_t cudaMemAdvise_v2(const void* devPtr, size_t count, cudaMemoryAdvise advice, cudaMemLocation location) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaMemRangeGetAttribute' in found_functions}} - -cdef cudaError_t cudaMemRangeGetAttribute(void* data, size_t dataSize, cudaMemRangeAttribute attribute, const void* devPtr, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaMemRangeGetAttributes' in found_functions}} - -cdef cudaError_t cudaMemRangeGetAttributes(void** data, size_t* dataSizes, cudaMemRangeAttribute* attributes, size_t numAttributes, const void* devPtr, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaMemcpyToArray' in found_functions}} - -cdef cudaError_t cudaMemcpyToArray(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaMemcpyFromArray' in found_functions}} - -cdef cudaError_t cudaMemcpyFromArray(void* dst, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaMemcpyArrayToArray' in found_functions}} - -cdef cudaError_t cudaMemcpyArrayToArray(cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaMemcpyToArrayAsync' in found_functions}} - -cdef cudaError_t cudaMemcpyToArrayAsync(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t count, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaMemcpyFromArrayAsync' in found_functions}} - -cdef cudaError_t cudaMemcpyFromArrayAsync(void* dst, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaMallocAsync' in found_functions}} - -cdef cudaError_t cudaMallocAsync(void** devPtr, size_t size, cudaStream_t hStream) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaFreeAsync' in found_functions}} - -cdef cudaError_t cudaFreeAsync(void* devPtr, cudaStream_t hStream) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaMemPoolTrimTo' in found_functions}} - -cdef cudaError_t cudaMemPoolTrimTo(cudaMemPool_t memPool, size_t minBytesToKeep) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaMemPoolSetAttribute' in found_functions}} - -cdef cudaError_t cudaMemPoolSetAttribute(cudaMemPool_t memPool, cudaMemPoolAttr attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaMemPoolGetAttribute' in found_functions}} - -cdef cudaError_t cudaMemPoolGetAttribute(cudaMemPool_t memPool, cudaMemPoolAttr attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaMemPoolSetAccess' in found_functions}} - -cdef cudaError_t cudaMemPoolSetAccess(cudaMemPool_t memPool, const cudaMemAccessDesc* descList, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaMemPoolGetAccess' in found_functions}} - -cdef cudaError_t cudaMemPoolGetAccess(cudaMemAccessFlags* flags, cudaMemPool_t memPool, cudaMemLocation* location) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaMemPoolCreate' in found_functions}} - -cdef cudaError_t cudaMemPoolCreate(cudaMemPool_t* memPool, const cudaMemPoolProps* poolProps) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaMemPoolDestroy' in found_functions}} - -cdef cudaError_t cudaMemPoolDestroy(cudaMemPool_t memPool) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaMallocFromPoolAsync' in found_functions}} - -cdef cudaError_t cudaMallocFromPoolAsync(void** ptr, size_t size, cudaMemPool_t memPool, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaMemPoolExportToShareableHandle' in found_functions}} - -cdef cudaError_t cudaMemPoolExportToShareableHandle(void* shareableHandle, cudaMemPool_t memPool, cudaMemAllocationHandleType handleType, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaMemPoolImportFromShareableHandle' in found_functions}} - -cdef cudaError_t cudaMemPoolImportFromShareableHandle(cudaMemPool_t* memPool, void* shareableHandle, cudaMemAllocationHandleType handleType, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaMemPoolExportPointer' in found_functions}} - -cdef cudaError_t cudaMemPoolExportPointer(cudaMemPoolPtrExportData* exportData, void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaMemPoolImportPointer' in found_functions}} - -cdef cudaError_t cudaMemPoolImportPointer(void** ptr, cudaMemPool_t memPool, cudaMemPoolPtrExportData* exportData) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaPointerGetAttributes' in found_functions}} - -cdef cudaError_t cudaPointerGetAttributes(cudaPointerAttributes* attributes, const void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaDeviceCanAccessPeer' in found_functions}} - -cdef cudaError_t cudaDeviceCanAccessPeer(int* canAccessPeer, int device, int peerDevice) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaDeviceEnablePeerAccess' in found_functions}} - -cdef cudaError_t cudaDeviceEnablePeerAccess(int peerDevice, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaDeviceDisablePeerAccess' in found_functions}} - -cdef cudaError_t cudaDeviceDisablePeerAccess(int peerDevice) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphicsUnregisterResource' in found_functions}} - -cdef cudaError_t cudaGraphicsUnregisterResource(cudaGraphicsResource_t resource) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphicsResourceSetMapFlags' in found_functions}} - -cdef cudaError_t cudaGraphicsResourceSetMapFlags(cudaGraphicsResource_t resource, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphicsMapResources' in found_functions}} - -cdef cudaError_t cudaGraphicsMapResources(int count, cudaGraphicsResource_t* resources, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphicsUnmapResources' in found_functions}} - -cdef cudaError_t cudaGraphicsUnmapResources(int count, cudaGraphicsResource_t* resources, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphicsResourceGetMappedPointer' in found_functions}} - -cdef cudaError_t cudaGraphicsResourceGetMappedPointer(void** devPtr, size_t* size, cudaGraphicsResource_t resource) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphicsSubResourceGetMappedArray' in found_functions}} - -cdef cudaError_t cudaGraphicsSubResourceGetMappedArray(cudaArray_t* array, cudaGraphicsResource_t resource, unsigned int arrayIndex, unsigned int mipLevel) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphicsResourceGetMappedMipmappedArray' in found_functions}} - -cdef cudaError_t cudaGraphicsResourceGetMappedMipmappedArray(cudaMipmappedArray_t* mipmappedArray, cudaGraphicsResource_t resource) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGetChannelDesc' in found_functions}} - -cdef cudaError_t cudaGetChannelDesc(cudaChannelFormatDesc* desc, cudaArray_const_t array) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaCreateChannelDesc' in found_functions}} - -cdef cudaChannelFormatDesc cudaCreateChannelDesc(int x, int y, int z, int w, cudaChannelFormatKind f) nogil -{{endif}} - -{{if 'cudaCreateTextureObject' in found_functions}} - -cdef cudaError_t cudaCreateTextureObject(cudaTextureObject_t* pTexObject, const cudaResourceDesc* pResDesc, const cudaTextureDesc* pTexDesc, const cudaResourceViewDesc* pResViewDesc) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaDestroyTextureObject' in found_functions}} - -cdef cudaError_t cudaDestroyTextureObject(cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGetTextureObjectResourceDesc' in found_functions}} - -cdef cudaError_t cudaGetTextureObjectResourceDesc(cudaResourceDesc* pResDesc, cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGetTextureObjectTextureDesc' in found_functions}} - -cdef cudaError_t cudaGetTextureObjectTextureDesc(cudaTextureDesc* pTexDesc, cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGetTextureObjectResourceViewDesc' in found_functions}} - -cdef cudaError_t cudaGetTextureObjectResourceViewDesc(cudaResourceViewDesc* pResViewDesc, cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaCreateSurfaceObject' in found_functions}} - -cdef cudaError_t cudaCreateSurfaceObject(cudaSurfaceObject_t* pSurfObject, const cudaResourceDesc* pResDesc) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaDestroySurfaceObject' in found_functions}} - -cdef cudaError_t cudaDestroySurfaceObject(cudaSurfaceObject_t surfObject) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGetSurfaceObjectResourceDesc' in found_functions}} - -cdef cudaError_t cudaGetSurfaceObjectResourceDesc(cudaResourceDesc* pResDesc, cudaSurfaceObject_t surfObject) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaDriverGetVersion' in found_functions}} - -cdef cudaError_t cudaDriverGetVersion(int* driverVersion) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaRuntimeGetVersion' in found_functions}} - -cdef cudaError_t cudaRuntimeGetVersion(int* runtimeVersion) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphCreate' in found_functions}} - -cdef cudaError_t cudaGraphCreate(cudaGraph_t* pGraph, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphAddKernelNode' in found_functions}} - -cdef cudaError_t cudaGraphAddKernelNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphKernelNodeGetParams' in found_functions}} - -cdef cudaError_t cudaGraphKernelNodeGetParams(cudaGraphNode_t node, cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphKernelNodeSetParams' in found_functions}} - -cdef cudaError_t cudaGraphKernelNodeSetParams(cudaGraphNode_t node, const cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphKernelNodeCopyAttributes' in found_functions}} - -cdef cudaError_t cudaGraphKernelNodeCopyAttributes(cudaGraphNode_t hSrc, cudaGraphNode_t hDst) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphKernelNodeGetAttribute' in found_functions}} - -cdef cudaError_t cudaGraphKernelNodeGetAttribute(cudaGraphNode_t hNode, cudaKernelNodeAttrID attr, cudaKernelNodeAttrValue* value_out) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphKernelNodeSetAttribute' in found_functions}} - -cdef cudaError_t cudaGraphKernelNodeSetAttribute(cudaGraphNode_t hNode, cudaKernelNodeAttrID attr, const cudaKernelNodeAttrValue* value) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphAddMemcpyNode' in found_functions}} - -cdef cudaError_t cudaGraphAddMemcpyNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaMemcpy3DParms* pCopyParams) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphAddMemcpyNode1D' in found_functions}} - -cdef cudaError_t cudaGraphAddMemcpyNode1D(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphMemcpyNodeGetParams' in found_functions}} - -cdef cudaError_t cudaGraphMemcpyNodeGetParams(cudaGraphNode_t node, cudaMemcpy3DParms* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphMemcpyNodeSetParams' in found_functions}} - -cdef cudaError_t cudaGraphMemcpyNodeSetParams(cudaGraphNode_t node, const cudaMemcpy3DParms* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphMemcpyNodeSetParams1D' in found_functions}} - -cdef cudaError_t cudaGraphMemcpyNodeSetParams1D(cudaGraphNode_t node, void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphAddMemsetNode' in found_functions}} - -cdef cudaError_t cudaGraphAddMemsetNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaMemsetParams* pMemsetParams) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphMemsetNodeGetParams' in found_functions}} - -cdef cudaError_t cudaGraphMemsetNodeGetParams(cudaGraphNode_t node, cudaMemsetParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphMemsetNodeSetParams' in found_functions}} - -cdef cudaError_t cudaGraphMemsetNodeSetParams(cudaGraphNode_t node, const cudaMemsetParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphAddHostNode' in found_functions}} - -cdef cudaError_t cudaGraphAddHostNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphHostNodeGetParams' in found_functions}} - -cdef cudaError_t cudaGraphHostNodeGetParams(cudaGraphNode_t node, cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphHostNodeSetParams' in found_functions}} - -cdef cudaError_t cudaGraphHostNodeSetParams(cudaGraphNode_t node, const cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphAddChildGraphNode' in found_functions}} - -cdef cudaError_t cudaGraphAddChildGraphNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaGraph_t childGraph) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphChildGraphNodeGetGraph' in found_functions}} - -cdef cudaError_t cudaGraphChildGraphNodeGetGraph(cudaGraphNode_t node, cudaGraph_t* pGraph) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphAddEmptyNode' in found_functions}} - -cdef cudaError_t cudaGraphAddEmptyNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphAddEventRecordNode' in found_functions}} - -cdef cudaError_t cudaGraphAddEventRecordNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphEventRecordNodeGetEvent' in found_functions}} - -cdef cudaError_t cudaGraphEventRecordNodeGetEvent(cudaGraphNode_t node, cudaEvent_t* event_out) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphEventRecordNodeSetEvent' in found_functions}} - -cdef cudaError_t cudaGraphEventRecordNodeSetEvent(cudaGraphNode_t node, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphAddEventWaitNode' in found_functions}} - -cdef cudaError_t cudaGraphAddEventWaitNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphEventWaitNodeGetEvent' in found_functions}} - -cdef cudaError_t cudaGraphEventWaitNodeGetEvent(cudaGraphNode_t node, cudaEvent_t* event_out) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphEventWaitNodeSetEvent' in found_functions}} - -cdef cudaError_t cudaGraphEventWaitNodeSetEvent(cudaGraphNode_t node, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphAddExternalSemaphoresSignalNode' in found_functions}} - -cdef cudaError_t cudaGraphAddExternalSemaphoresSignalNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphExternalSemaphoresSignalNodeGetParams' in found_functions}} - -cdef cudaError_t cudaGraphExternalSemaphoresSignalNodeGetParams(cudaGraphNode_t hNode, cudaExternalSemaphoreSignalNodeParams* params_out) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphExternalSemaphoresSignalNodeSetParams' in found_functions}} - -cdef cudaError_t cudaGraphExternalSemaphoresSignalNodeSetParams(cudaGraphNode_t hNode, const cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphAddExternalSemaphoresWaitNode' in found_functions}} - -cdef cudaError_t cudaGraphAddExternalSemaphoresWaitNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphExternalSemaphoresWaitNodeGetParams' in found_functions}} - -cdef cudaError_t cudaGraphExternalSemaphoresWaitNodeGetParams(cudaGraphNode_t hNode, cudaExternalSemaphoreWaitNodeParams* params_out) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphExternalSemaphoresWaitNodeSetParams' in found_functions}} - -cdef cudaError_t cudaGraphExternalSemaphoresWaitNodeSetParams(cudaGraphNode_t hNode, const cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphAddMemAllocNode' in found_functions}} - -cdef cudaError_t cudaGraphAddMemAllocNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaMemAllocNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphMemAllocNodeGetParams' in found_functions}} - -cdef cudaError_t cudaGraphMemAllocNodeGetParams(cudaGraphNode_t node, cudaMemAllocNodeParams* params_out) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphAddMemFreeNode' in found_functions}} - -cdef cudaError_t cudaGraphAddMemFreeNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, void* dptr) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphMemFreeNodeGetParams' in found_functions}} - -cdef cudaError_t cudaGraphMemFreeNodeGetParams(cudaGraphNode_t node, void* dptr_out) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaDeviceGraphMemTrim' in found_functions}} - -cdef cudaError_t cudaDeviceGraphMemTrim(int device) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaDeviceGetGraphMemAttribute' in found_functions}} - -cdef cudaError_t cudaDeviceGetGraphMemAttribute(int device, cudaGraphMemAttributeType attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaDeviceSetGraphMemAttribute' in found_functions}} - -cdef cudaError_t cudaDeviceSetGraphMemAttribute(int device, cudaGraphMemAttributeType attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphClone' in found_functions}} - -cdef cudaError_t cudaGraphClone(cudaGraph_t* pGraphClone, cudaGraph_t originalGraph) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphNodeFindInClone' in found_functions}} - -cdef cudaError_t cudaGraphNodeFindInClone(cudaGraphNode_t* pNode, cudaGraphNode_t originalNode, cudaGraph_t clonedGraph) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphNodeGetType' in found_functions}} - -cdef cudaError_t cudaGraphNodeGetType(cudaGraphNode_t node, cudaGraphNodeType* pType) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphGetNodes' in found_functions}} - -cdef cudaError_t cudaGraphGetNodes(cudaGraph_t graph, cudaGraphNode_t* nodes, size_t* numNodes) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphGetRootNodes' in found_functions}} - -cdef cudaError_t cudaGraphGetRootNodes(cudaGraph_t graph, cudaGraphNode_t* pRootNodes, size_t* pNumRootNodes) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphGetEdges' in found_functions}} - -cdef cudaError_t cudaGraphGetEdges(cudaGraph_t graph, cudaGraphNode_t* from_, cudaGraphNode_t* to, size_t* numEdges) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphGetEdges_v2' in found_functions}} - -cdef cudaError_t cudaGraphGetEdges_v2(cudaGraph_t graph, cudaGraphNode_t* from_, cudaGraphNode_t* to, cudaGraphEdgeData* edgeData, size_t* numEdges) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphNodeGetDependencies' in found_functions}} - -cdef cudaError_t cudaGraphNodeGetDependencies(cudaGraphNode_t node, cudaGraphNode_t* pDependencies, size_t* pNumDependencies) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphNodeGetDependencies_v2' in found_functions}} - -cdef cudaError_t cudaGraphNodeGetDependencies_v2(cudaGraphNode_t node, cudaGraphNode_t* pDependencies, cudaGraphEdgeData* edgeData, size_t* pNumDependencies) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphNodeGetDependentNodes' in found_functions}} - -cdef cudaError_t cudaGraphNodeGetDependentNodes(cudaGraphNode_t node, cudaGraphNode_t* pDependentNodes, size_t* pNumDependentNodes) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphNodeGetDependentNodes_v2' in found_functions}} - -cdef cudaError_t cudaGraphNodeGetDependentNodes_v2(cudaGraphNode_t node, cudaGraphNode_t* pDependentNodes, cudaGraphEdgeData* edgeData, size_t* pNumDependentNodes) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphAddDependencies' in found_functions}} - -cdef cudaError_t cudaGraphAddDependencies(cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphAddDependencies_v2' in found_functions}} - -cdef cudaError_t cudaGraphAddDependencies_v2(cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, const cudaGraphEdgeData* edgeData, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphRemoveDependencies' in found_functions}} - -cdef cudaError_t cudaGraphRemoveDependencies(cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphRemoveDependencies_v2' in found_functions}} - -cdef cudaError_t cudaGraphRemoveDependencies_v2(cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, const cudaGraphEdgeData* edgeData, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphDestroyNode' in found_functions}} - -cdef cudaError_t cudaGraphDestroyNode(cudaGraphNode_t node) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphInstantiate' in found_functions}} - -cdef cudaError_t cudaGraphInstantiate(cudaGraphExec_t* pGraphExec, cudaGraph_t graph, unsigned long long flags) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphInstantiateWithFlags' in found_functions}} - -cdef cudaError_t cudaGraphInstantiateWithFlags(cudaGraphExec_t* pGraphExec, cudaGraph_t graph, unsigned long long flags) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphInstantiateWithParams' in found_functions}} - -cdef cudaError_t cudaGraphInstantiateWithParams(cudaGraphExec_t* pGraphExec, cudaGraph_t graph, cudaGraphInstantiateParams* instantiateParams) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphExecGetFlags' in found_functions}} - -cdef cudaError_t cudaGraphExecGetFlags(cudaGraphExec_t graphExec, unsigned long long* flags) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphExecKernelNodeSetParams' in found_functions}} - -cdef cudaError_t cudaGraphExecKernelNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphExecMemcpyNodeSetParams' in found_functions}} - -cdef cudaError_t cudaGraphExecMemcpyNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaMemcpy3DParms* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphExecMemcpyNodeSetParams1D' in found_functions}} - -cdef cudaError_t cudaGraphExecMemcpyNodeSetParams1D(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphExecMemsetNodeSetParams' in found_functions}} - -cdef cudaError_t cudaGraphExecMemsetNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaMemsetParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphExecHostNodeSetParams' in found_functions}} - -cdef cudaError_t cudaGraphExecHostNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphExecChildGraphNodeSetParams' in found_functions}} - -cdef cudaError_t cudaGraphExecChildGraphNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, cudaGraph_t childGraph) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphExecEventRecordNodeSetEvent' in found_functions}} - -cdef cudaError_t cudaGraphExecEventRecordNodeSetEvent(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphExecEventWaitNodeSetEvent' in found_functions}} - -cdef cudaError_t cudaGraphExecEventWaitNodeSetEvent(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphExecExternalSemaphoresSignalNodeSetParams' in found_functions}} - -cdef cudaError_t cudaGraphExecExternalSemaphoresSignalNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, const cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphExecExternalSemaphoresWaitNodeSetParams' in found_functions}} - -cdef cudaError_t cudaGraphExecExternalSemaphoresWaitNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, const cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphNodeSetEnabled' in found_functions}} - -cdef cudaError_t cudaGraphNodeSetEnabled(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, unsigned int isEnabled) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphNodeGetEnabled' in found_functions}} - -cdef cudaError_t cudaGraphNodeGetEnabled(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, unsigned int* isEnabled) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphExecUpdate' in found_functions}} - -cdef cudaError_t cudaGraphExecUpdate(cudaGraphExec_t hGraphExec, cudaGraph_t hGraph, cudaGraphExecUpdateResultInfo* resultInfo) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphUpload' in found_functions}} - -cdef cudaError_t cudaGraphUpload(cudaGraphExec_t graphExec, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphLaunch' in found_functions}} - -cdef cudaError_t cudaGraphLaunch(cudaGraphExec_t graphExec, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphExecDestroy' in found_functions}} - -cdef cudaError_t cudaGraphExecDestroy(cudaGraphExec_t graphExec) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphDestroy' in found_functions}} - -cdef cudaError_t cudaGraphDestroy(cudaGraph_t graph) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphDebugDotPrint' in found_functions}} - -cdef cudaError_t cudaGraphDebugDotPrint(cudaGraph_t graph, const char* path, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaUserObjectCreate' in found_functions}} - -cdef cudaError_t cudaUserObjectCreate(cudaUserObject_t* object_out, void* ptr, cudaHostFn_t destroy, unsigned int initialRefcount, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaUserObjectRetain' in found_functions}} - -cdef cudaError_t cudaUserObjectRetain(cudaUserObject_t object, unsigned int count) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaUserObjectRelease' in found_functions}} - -cdef cudaError_t cudaUserObjectRelease(cudaUserObject_t object, unsigned int count) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphRetainUserObject' in found_functions}} - -cdef cudaError_t cudaGraphRetainUserObject(cudaGraph_t graph, cudaUserObject_t object, unsigned int count, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphReleaseUserObject' in found_functions}} - -cdef cudaError_t cudaGraphReleaseUserObject(cudaGraph_t graph, cudaUserObject_t object, unsigned int count) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphAddNode' in found_functions}} - -cdef cudaError_t cudaGraphAddNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphAddNode_v2' in found_functions}} - -cdef cudaError_t cudaGraphAddNode_v2(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphNodeSetParams' in found_functions}} - -cdef cudaError_t cudaGraphNodeSetParams(cudaGraphNode_t node, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphExecNodeSetParams' in found_functions}} - -cdef cudaError_t cudaGraphExecNodeSetParams(cudaGraphExec_t graphExec, cudaGraphNode_t node, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGraphConditionalHandleCreate' in found_functions}} - -cdef cudaError_t cudaGraphConditionalHandleCreate(cudaGraphConditionalHandle* pHandle_out, cudaGraph_t graph, unsigned int defaultLaunchValue, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGetDriverEntryPoint' in found_functions}} - -cdef cudaError_t cudaGetDriverEntryPoint(const char* symbol, void** funcPtr, unsigned long long flags, cudaDriverEntryPointQueryResult* driverStatus) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGetDriverEntryPointByVersion' in found_functions}} - -cdef cudaError_t cudaGetDriverEntryPointByVersion(const char* symbol, void** funcPtr, unsigned int cudaVersion, unsigned long long flags, cudaDriverEntryPointQueryResult* driverStatus) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGetExportTable' in found_functions}} - -cdef cudaError_t cudaGetExportTable(const void** ppExportTable, const cudaUUID_t* pExportTableId) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'cudaGetKernel' in found_functions}} - -cdef cudaError_t cudaGetKernel(cudaKernel_t* kernelPtr, const void* entryFuncAddr) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if 'make_cudaPitchedPtr' in found_functions}} - -cdef cudaPitchedPtr make_cudaPitchedPtr(void* d, size_t p, size_t xsz, size_t ysz) nogil -{{endif}} - -{{if 'make_cudaPos' in found_functions}} - -cdef cudaPos make_cudaPos(size_t x, size_t y, size_t z) nogil -{{endif}} - -{{if 'make_cudaExtent' in found_functions}} - -cdef cudaExtent make_cudaExtent(size_t w, size_t h, size_t d) nogil -{{endif}} - -{{if True}} - -cdef cudaError_t cudaGraphicsEGLRegisterImage(cudaGraphicsResource** pCudaResource, EGLImageKHR image, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if True}} - -cdef cudaError_t cudaEGLStreamConsumerConnect(cudaEglStreamConnection* conn, EGLStreamKHR eglStream) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if True}} - -cdef cudaError_t cudaEGLStreamConsumerConnectWithFlags(cudaEglStreamConnection* conn, EGLStreamKHR eglStream, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if True}} - -cdef cudaError_t cudaEGLStreamConsumerDisconnect(cudaEglStreamConnection* conn) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if True}} - -cdef cudaError_t cudaEGLStreamConsumerAcquireFrame(cudaEglStreamConnection* conn, cudaGraphicsResource_t* pCudaResource, cudaStream_t* pStream, unsigned int timeout) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if True}} - -cdef cudaError_t cudaEGLStreamConsumerReleaseFrame(cudaEglStreamConnection* conn, cudaGraphicsResource_t pCudaResource, cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if True}} - -cdef cudaError_t cudaEGLStreamProducerConnect(cudaEglStreamConnection* conn, EGLStreamKHR eglStream, EGLint width, EGLint height) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if True}} - -cdef cudaError_t cudaEGLStreamProducerDisconnect(cudaEglStreamConnection* conn) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if True}} - -cdef cudaError_t cudaEGLStreamProducerPresentFrame(cudaEglStreamConnection* conn, cudaEglFrame eglframe, cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if True}} - -cdef cudaError_t cudaEGLStreamProducerReturnFrame(cudaEglStreamConnection* conn, cudaEglFrame* eglframe, cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if True}} - -cdef cudaError_t cudaGraphicsResourceGetMappedEglFrame(cudaEglFrame* eglFrame, cudaGraphicsResource_t resource, unsigned int index, unsigned int mipLevel) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if True}} - -cdef cudaError_t cudaEventCreateFromEGLSync(cudaEvent_t* phEvent, EGLSyncKHR eglSync, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if True}} - -cdef cudaError_t cudaProfilerStart() except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if True}} - -cdef cudaError_t cudaProfilerStop() except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if True}} - -cdef cudaError_t cudaGLGetDevices(unsigned int* pCudaDeviceCount, int* pCudaDevices, unsigned int cudaDeviceCount, cudaGLDeviceList deviceList) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if True}} - -cdef cudaError_t cudaGraphicsGLRegisterImage(cudaGraphicsResource** resource, GLuint image, GLenum target, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if True}} - -cdef cudaError_t cudaGraphicsGLRegisterBuffer(cudaGraphicsResource** resource, GLuint buffer, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if True}} - -cdef cudaError_t cudaVDPAUGetDevice(int* device, VdpDevice vdpDevice, VdpGetProcAddress* vdpGetProcAddress) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if True}} - -cdef cudaError_t cudaVDPAUSetVDPAUDevice(int device, VdpDevice vdpDevice, VdpGetProcAddress* vdpGetProcAddress) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if True}} - -cdef cudaError_t cudaGraphicsVDPAURegisterVideoSurface(cudaGraphicsResource** resource, VdpVideoSurface vdpSurface, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if True}} - -cdef cudaError_t cudaGraphicsVDPAURegisterOutputSurface(cudaGraphicsResource** resource, VdpOutputSurface vdpSurface, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -{{if True}} - -cdef cudaError_t getLocalRuntimeVersion(int* runtimeVersion) except ?cudaErrorCallRequiresNewerDriver nogil -{{endif}} - -cdef enum: cudaHostAllocDefault = 0 - -cdef enum: cudaHostAllocPortable = 1 - -cdef enum: cudaHostAllocMapped = 2 - -cdef enum: cudaHostAllocWriteCombined = 4 - -cdef enum: cudaHostRegisterDefault = 0 - -cdef enum: cudaHostRegisterPortable = 1 - -cdef enum: cudaHostRegisterMapped = 2 - -cdef enum: cudaHostRegisterIoMemory = 4 - -cdef enum: cudaHostRegisterReadOnly = 8 - -cdef enum: cudaPeerAccessDefault = 0 - -cdef enum: cudaStreamDefault = 0 - -cdef enum: cudaStreamNonBlocking = 1 - -cdef enum: cudaStreamLegacy = 1 - -cdef enum: cudaStreamPerThread = 2 - -cdef enum: cudaEventDefault = 0 - -cdef enum: cudaEventBlockingSync = 1 - -cdef enum: cudaEventDisableTiming = 2 - -cdef enum: cudaEventInterprocess = 4 - -cdef enum: cudaEventRecordDefault = 0 - -cdef enum: cudaEventRecordExternal = 1 - -cdef enum: cudaEventWaitDefault = 0 - -cdef enum: cudaEventWaitExternal = 1 - -cdef enum: cudaDeviceScheduleAuto = 0 - -cdef enum: cudaDeviceScheduleSpin = 1 - -cdef enum: cudaDeviceScheduleYield = 2 - -cdef enum: cudaDeviceScheduleBlockingSync = 4 - -cdef enum: cudaDeviceBlockingSync = 4 - -cdef enum: cudaDeviceScheduleMask = 7 - -cdef enum: cudaDeviceMapHost = 8 - -cdef enum: cudaDeviceLmemResizeToMax = 16 - -cdef enum: cudaDeviceSyncMemops = 128 - -cdef enum: cudaDeviceMask = 255 - -cdef enum: cudaArrayDefault = 0 - -cdef enum: cudaArrayLayered = 1 - -cdef enum: cudaArraySurfaceLoadStore = 2 - -cdef enum: cudaArrayCubemap = 4 - -cdef enum: cudaArrayTextureGather = 8 - -cdef enum: cudaArrayColorAttachment = 32 - -cdef enum: cudaArraySparse = 64 - -cdef enum: cudaArrayDeferredMapping = 128 - -cdef enum: cudaIpcMemLazyEnablePeerAccess = 1 - -cdef enum: cudaMemAttachGlobal = 1 - -cdef enum: cudaMemAttachHost = 2 - -cdef enum: cudaMemAttachSingle = 4 - -cdef enum: cudaOccupancyDefault = 0 - -cdef enum: cudaOccupancyDisableCachingOverride = 1 - -cdef enum: cudaCpuDeviceId = -1 - -cdef enum: cudaInvalidDeviceId = -2 - -cdef enum: cudaInitDeviceFlagsAreValid = 1 - -cdef enum: cudaCooperativeLaunchMultiDeviceNoPreSync = 1 - -cdef enum: cudaCooperativeLaunchMultiDeviceNoPostSync = 2 - -cdef enum: cudaArraySparsePropertiesSingleMipTail = 1 - -cdef enum: CUDA_IPC_HANDLE_SIZE = 64 - -cdef enum: cudaExternalMemoryDedicated = 1 - -cdef enum: cudaExternalSemaphoreSignalSkipNvSciBufMemSync = 1 - -cdef enum: cudaExternalSemaphoreWaitSkipNvSciBufMemSync = 2 - -cdef enum: cudaNvSciSyncAttrSignal = 1 - -cdef enum: cudaNvSciSyncAttrWait = 2 - -cdef enum: cudaGraphKernelNodePortDefault = 0 - -cdef enum: cudaGraphKernelNodePortProgrammatic = 1 - -cdef enum: cudaGraphKernelNodePortLaunchCompletion = 2 - -cdef enum: cudaStreamAttributeAccessPolicyWindow = 1 - -cdef enum: cudaStreamAttributeSynchronizationPolicy = 3 - -cdef enum: cudaStreamAttributeMemSyncDomainMap = 9 - -cdef enum: cudaStreamAttributeMemSyncDomain = 10 - -cdef enum: cudaStreamAttributePriority = 8 - -cdef enum: cudaKernelNodeAttributeAccessPolicyWindow = 1 - -cdef enum: cudaKernelNodeAttributeCooperative = 2 - -cdef enum: cudaKernelNodeAttributePriority = 8 - -cdef enum: cudaKernelNodeAttributeClusterDimension = 4 - -cdef enum: cudaKernelNodeAttributeClusterSchedulingPolicyPreference = 5 - -cdef enum: cudaKernelNodeAttributeMemSyncDomainMap = 9 - -cdef enum: cudaKernelNodeAttributeMemSyncDomain = 10 - -cdef enum: cudaKernelNodeAttributePreferredSharedMemoryCarveout = 14 - -cdef enum: cudaKernelNodeAttributeDeviceUpdatableKernelNode = 13 - -cdef enum: cudaSurfaceType1D = 1 - -cdef enum: cudaSurfaceType2D = 2 - -cdef enum: cudaSurfaceType3D = 3 - -cdef enum: cudaSurfaceTypeCubemap = 12 - -cdef enum: cudaSurfaceType1DLayered = 241 - -cdef enum: cudaSurfaceType2DLayered = 242 - -cdef enum: cudaSurfaceTypeCubemapLayered = 252 - -cdef enum: cudaTextureType1D = 1 - -cdef enum: cudaTextureType2D = 2 - -cdef enum: cudaTextureType3D = 3 - -cdef enum: cudaTextureTypeCubemap = 12 - -cdef enum: cudaTextureType1DLayered = 241 - -cdef enum: cudaTextureType2DLayered = 242 - -cdef enum: cudaTextureTypeCubemapLayered = 252 - -cdef enum: CUDART_VERSION = 12050 - -cdef enum: __CUDART_API_VERSION = 12050 - -cdef enum: CUDA_EGL_MAX_PLANES = 3 \ No newline at end of file diff --git a/cuda/ccudart.pyx.in b/cuda/ccudart.pyx.in deleted file mode 100644 index 0ffe3b7e7ed..00000000000 --- a/cuda/ccudart.pyx.in +++ /dev/null @@ -1,2492 +0,0 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. -# -# Please refer to the NVIDIA end user license agreement (EULA) associated -# with this source code for terms and conditions that govern your use of -# this software. Any use, reproduction, disclosure, or distribution of -# this software and related documentation outside the terms of the EULA -# is strictly prohibited. - -# cython: show_performance_hints=False - -cimport cuda._cuda.ccuda as ccuda -from cuda._lib.ccudart.ccudart cimport * -from cuda._lib.ccudart.utils cimport * -from libc.stdlib cimport malloc, free, calloc -from libc cimport string -from libcpp cimport bool - -cdef cudaPythonGlobal m_global = globalGetInstance() - -{{if 'cudaDeviceReset' in found_functions}} - -cdef cudaError_t cudaDeviceReset() except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDeviceReset() - -{{endif}} - -{{if 'cudaDeviceSynchronize' in found_functions}} - -cdef cudaError_t cudaDeviceSynchronize() except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDeviceSynchronize() - -{{endif}} - -{{if 'cudaDeviceSetLimit' in found_functions}} - -cdef cudaError_t cudaDeviceSetLimit(cudaLimit limit, size_t value) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDeviceSetLimit(limit, value) - -{{endif}} - -{{if 'cudaDeviceGetLimit' in found_functions}} - -cdef cudaError_t cudaDeviceGetLimit(size_t* pValue, cudaLimit limit) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDeviceGetLimit(pValue, limit) - -{{endif}} - -{{if 'cudaDeviceGetTexture1DLinearMaxWidth' in found_functions}} - -cdef cudaError_t cudaDeviceGetTexture1DLinearMaxWidth(size_t* maxWidthInElements, const cudaChannelFormatDesc* fmtDesc, int device) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDeviceGetTexture1DLinearMaxWidth(maxWidthInElements, fmtDesc, device) - -{{endif}} - -{{if 'cudaDeviceGetCacheConfig' in found_functions}} - -cdef cudaError_t cudaDeviceGetCacheConfig(cudaFuncCache* pCacheConfig) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDeviceGetCacheConfig(pCacheConfig) - -{{endif}} - -{{if 'cudaDeviceGetStreamPriorityRange' in found_functions}} - -cdef cudaError_t cudaDeviceGetStreamPriorityRange(int* leastPriority, int* greatestPriority) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDeviceGetStreamPriorityRange(leastPriority, greatestPriority) - -{{endif}} - -{{if 'cudaDeviceSetCacheConfig' in found_functions}} - -cdef cudaError_t cudaDeviceSetCacheConfig(cudaFuncCache cacheConfig) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDeviceSetCacheConfig(cacheConfig) - -{{endif}} - -{{if 'cudaDeviceGetByPCIBusId' in found_functions}} - -cdef cudaError_t cudaDeviceGetByPCIBusId(int* device, const char* pciBusId) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDeviceGetByPCIBusId(device, pciBusId) - -{{endif}} - -{{if 'cudaDeviceGetPCIBusId' in found_functions}} - -cdef cudaError_t cudaDeviceGetPCIBusId(char* pciBusId, int length, int device) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDeviceGetPCIBusId(pciBusId, length, device) - -{{endif}} - -{{if 'cudaIpcGetEventHandle' in found_functions}} - -cdef cudaError_t cudaIpcGetEventHandle(cudaIpcEventHandle_t* handle, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaIpcGetEventHandle(handle, event) - -{{endif}} - -{{if 'cudaIpcOpenEventHandle' in found_functions}} - -cdef cudaError_t cudaIpcOpenEventHandle(cudaEvent_t* event, cudaIpcEventHandle_t handle) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaIpcOpenEventHandle(event, handle) - -{{endif}} - -{{if 'cudaIpcGetMemHandle' in found_functions}} - -cdef cudaError_t cudaIpcGetMemHandle(cudaIpcMemHandle_t* handle, void* devPtr) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaIpcGetMemHandle(handle, devPtr) - -{{endif}} - -{{if 'cudaIpcOpenMemHandle' in found_functions}} - -cdef cudaError_t cudaIpcOpenMemHandle(void** devPtr, cudaIpcMemHandle_t handle, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaIpcOpenMemHandle(devPtr, handle, flags) - -{{endif}} - -{{if 'cudaIpcCloseMemHandle' in found_functions}} - -cdef cudaError_t cudaIpcCloseMemHandle(void* devPtr) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaIpcCloseMemHandle(devPtr) - -{{endif}} - -{{if 'cudaDeviceFlushGPUDirectRDMAWrites' in found_functions}} - -cdef cudaError_t cudaDeviceFlushGPUDirectRDMAWrites(cudaFlushGPUDirectRDMAWritesTarget target, cudaFlushGPUDirectRDMAWritesScope scope) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDeviceFlushGPUDirectRDMAWrites(target, scope) - -{{endif}} - -{{if 'cudaDeviceRegisterAsyncNotification' in found_functions}} - -cdef cudaError_t cudaDeviceRegisterAsyncNotification(int device, cudaAsyncCallback callbackFunc, void* userData, cudaAsyncCallbackHandle_t* callback) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDeviceRegisterAsyncNotification(device, callbackFunc, userData, callback) - -{{endif}} - -{{if 'cudaDeviceUnregisterAsyncNotification' in found_functions}} - -cdef cudaError_t cudaDeviceUnregisterAsyncNotification(int device, cudaAsyncCallbackHandle_t callback) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDeviceUnregisterAsyncNotification(device, callback) - -{{endif}} - -{{if 'cudaDeviceGetSharedMemConfig' in found_functions}} - -cdef cudaError_t cudaDeviceGetSharedMemConfig(cudaSharedMemConfig* pConfig) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDeviceGetSharedMemConfig(pConfig) - -{{endif}} - -{{if 'cudaDeviceSetSharedMemConfig' in found_functions}} - -cdef cudaError_t cudaDeviceSetSharedMemConfig(cudaSharedMemConfig config) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDeviceSetSharedMemConfig(config) - -{{endif}} - -{{if 'cudaGetLastError' in found_functions}} - -cdef cudaError_t cudaGetLastError() except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGetLastError() - -{{endif}} - -{{if 'cudaPeekAtLastError' in found_functions}} - -cdef cudaError_t cudaPeekAtLastError() except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaPeekAtLastError() - -{{endif}} - -{{if 'cudaGetErrorName' in found_functions}} - -cdef const char* cudaGetErrorName(cudaError_t error) except ?NULL nogil: - cdef const char* pStr = "unrecognized error code" - {{if 'cudaSuccess' in found_values}} - if error == cudaSuccess: - return "cudaSuccess"{{endif}} - {{if 'cudaErrorInvalidValue' in found_values}} - if error == cudaErrorInvalidValue: - return "cudaErrorInvalidValue"{{endif}} - {{if 'cudaErrorMemoryAllocation' in found_values}} - if error == cudaErrorMemoryAllocation: - return "cudaErrorMemoryAllocation"{{endif}} - {{if 'cudaErrorInitializationError' in found_values}} - if error == cudaErrorInitializationError: - return "cudaErrorInitializationError"{{endif}} - {{if 'cudaErrorCudartUnloading' in found_values}} - if error == cudaErrorCudartUnloading: - return "cudaErrorCudartUnloading"{{endif}} - {{if 'cudaErrorProfilerDisabled' in found_values}} - if error == cudaErrorProfilerDisabled: - return "cudaErrorProfilerDisabled"{{endif}} - {{if 'cudaErrorProfilerNotInitialized' in found_values}} - if error == cudaErrorProfilerNotInitialized: - return "cudaErrorProfilerNotInitialized"{{endif}} - {{if 'cudaErrorProfilerAlreadyStarted' in found_values}} - if error == cudaErrorProfilerAlreadyStarted: - return "cudaErrorProfilerAlreadyStarted"{{endif}} - {{if 'cudaErrorProfilerAlreadyStopped' in found_values}} - if error == cudaErrorProfilerAlreadyStopped: - return "cudaErrorProfilerAlreadyStopped"{{endif}} - {{if 'cudaErrorInvalidConfiguration' in found_values}} - if error == cudaErrorInvalidConfiguration: - return "cudaErrorInvalidConfiguration"{{endif}} - {{if 'cudaErrorInvalidPitchValue' in found_values}} - if error == cudaErrorInvalidPitchValue: - return "cudaErrorInvalidPitchValue"{{endif}} - {{if 'cudaErrorInvalidSymbol' in found_values}} - if error == cudaErrorInvalidSymbol: - return "cudaErrorInvalidSymbol"{{endif}} - {{if 'cudaErrorInvalidHostPointer' in found_values}} - if error == cudaErrorInvalidHostPointer: - return "cudaErrorInvalidHostPointer"{{endif}} - {{if 'cudaErrorInvalidDevicePointer' in found_values}} - if error == cudaErrorInvalidDevicePointer: - return "cudaErrorInvalidDevicePointer"{{endif}} - {{if 'cudaErrorInvalidTexture' in found_values}} - if error == cudaErrorInvalidTexture: - return "cudaErrorInvalidTexture"{{endif}} - {{if 'cudaErrorInvalidTextureBinding' in found_values}} - if error == cudaErrorInvalidTextureBinding: - return "cudaErrorInvalidTextureBinding"{{endif}} - {{if 'cudaErrorInvalidChannelDescriptor' in found_values}} - if error == cudaErrorInvalidChannelDescriptor: - return "cudaErrorInvalidChannelDescriptor"{{endif}} - {{if 'cudaErrorInvalidMemcpyDirection' in found_values}} - if error == cudaErrorInvalidMemcpyDirection: - return "cudaErrorInvalidMemcpyDirection"{{endif}} - {{if 'cudaErrorAddressOfConstant' in found_values}} - if error == cudaErrorAddressOfConstant: - return "cudaErrorAddressOfConstant"{{endif}} - {{if 'cudaErrorTextureFetchFailed' in found_values}} - if error == cudaErrorTextureFetchFailed: - return "cudaErrorTextureFetchFailed"{{endif}} - {{if 'cudaErrorTextureNotBound' in found_values}} - if error == cudaErrorTextureNotBound: - return "cudaErrorTextureNotBound"{{endif}} - {{if 'cudaErrorSynchronizationError' in found_values}} - if error == cudaErrorSynchronizationError: - return "cudaErrorSynchronizationError"{{endif}} - {{if 'cudaErrorInvalidFilterSetting' in found_values}} - if error == cudaErrorInvalidFilterSetting: - return "cudaErrorInvalidFilterSetting"{{endif}} - {{if 'cudaErrorInvalidNormSetting' in found_values}} - if error == cudaErrorInvalidNormSetting: - return "cudaErrorInvalidNormSetting"{{endif}} - {{if 'cudaErrorMixedDeviceExecution' in found_values}} - if error == cudaErrorMixedDeviceExecution: - return "cudaErrorMixedDeviceExecution"{{endif}} - {{if 'cudaErrorNotYetImplemented' in found_values}} - if error == cudaErrorNotYetImplemented: - return "cudaErrorNotYetImplemented"{{endif}} - {{if 'cudaErrorMemoryValueTooLarge' in found_values}} - if error == cudaErrorMemoryValueTooLarge: - return "cudaErrorMemoryValueTooLarge"{{endif}} - {{if 'cudaErrorStubLibrary' in found_values}} - if error == cudaErrorStubLibrary: - return "cudaErrorStubLibrary"{{endif}} - {{if 'cudaErrorInsufficientDriver' in found_values}} - if error == cudaErrorInsufficientDriver: - return "cudaErrorInsufficientDriver"{{endif}} - {{if 'cudaErrorCallRequiresNewerDriver' in found_values}} - if error == cudaErrorCallRequiresNewerDriver: - return "cudaErrorCallRequiresNewerDriver"{{endif}} - {{if 'cudaErrorInvalidSurface' in found_values}} - if error == cudaErrorInvalidSurface: - return "cudaErrorInvalidSurface"{{endif}} - {{if 'cudaErrorDuplicateVariableName' in found_values}} - if error == cudaErrorDuplicateVariableName: - return "cudaErrorDuplicateVariableName"{{endif}} - {{if 'cudaErrorDuplicateTextureName' in found_values}} - if error == cudaErrorDuplicateTextureName: - return "cudaErrorDuplicateTextureName"{{endif}} - {{if 'cudaErrorDuplicateSurfaceName' in found_values}} - if error == cudaErrorDuplicateSurfaceName: - return "cudaErrorDuplicateSurfaceName"{{endif}} - {{if 'cudaErrorDevicesUnavailable' in found_values}} - if error == cudaErrorDevicesUnavailable: - return "cudaErrorDevicesUnavailable"{{endif}} - {{if 'cudaErrorIncompatibleDriverContext' in found_values}} - if error == cudaErrorIncompatibleDriverContext: - return "cudaErrorIncompatibleDriverContext"{{endif}} - {{if 'cudaErrorMissingConfiguration' in found_values}} - if error == cudaErrorMissingConfiguration: - return "cudaErrorMissingConfiguration"{{endif}} - {{if 'cudaErrorPriorLaunchFailure' in found_values}} - if error == cudaErrorPriorLaunchFailure: - return "cudaErrorPriorLaunchFailure"{{endif}} - {{if 'cudaErrorLaunchMaxDepthExceeded' in found_values}} - if error == cudaErrorLaunchMaxDepthExceeded: - return "cudaErrorLaunchMaxDepthExceeded"{{endif}} - {{if 'cudaErrorLaunchFileScopedTex' in found_values}} - if error == cudaErrorLaunchFileScopedTex: - return "cudaErrorLaunchFileScopedTex"{{endif}} - {{if 'cudaErrorLaunchFileScopedSurf' in found_values}} - if error == cudaErrorLaunchFileScopedSurf: - return "cudaErrorLaunchFileScopedSurf"{{endif}} - {{if 'cudaErrorSyncDepthExceeded' in found_values}} - if error == cudaErrorSyncDepthExceeded: - return "cudaErrorSyncDepthExceeded"{{endif}} - {{if 'cudaErrorLaunchPendingCountExceeded' in found_values}} - if error == cudaErrorLaunchPendingCountExceeded: - return "cudaErrorLaunchPendingCountExceeded"{{endif}} - {{if 'cudaErrorInvalidDeviceFunction' in found_values}} - if error == cudaErrorInvalidDeviceFunction: - return "cudaErrorInvalidDeviceFunction"{{endif}} - {{if 'cudaErrorNoDevice' in found_values}} - if error == cudaErrorNoDevice: - return "cudaErrorNoDevice"{{endif}} - {{if 'cudaErrorInvalidDevice' in found_values}} - if error == cudaErrorInvalidDevice: - return "cudaErrorInvalidDevice"{{endif}} - {{if 'cudaErrorDeviceNotLicensed' in found_values}} - if error == cudaErrorDeviceNotLicensed: - return "cudaErrorDeviceNotLicensed"{{endif}} - {{if 'cudaErrorSoftwareValidityNotEstablished' in found_values}} - if error == cudaErrorSoftwareValidityNotEstablished: - return "cudaErrorSoftwareValidityNotEstablished"{{endif}} - {{if 'cudaErrorStartupFailure' in found_values}} - if error == cudaErrorStartupFailure: - return "cudaErrorStartupFailure"{{endif}} - {{if 'cudaErrorInvalidKernelImage' in found_values}} - if error == cudaErrorInvalidKernelImage: - return "cudaErrorInvalidKernelImage"{{endif}} - {{if 'cudaErrorDeviceUninitialized' in found_values}} - if error == cudaErrorDeviceUninitialized: - return "cudaErrorDeviceUninitialized"{{endif}} - {{if 'cudaErrorMapBufferObjectFailed' in found_values}} - if error == cudaErrorMapBufferObjectFailed: - return "cudaErrorMapBufferObjectFailed"{{endif}} - {{if 'cudaErrorUnmapBufferObjectFailed' in found_values}} - if error == cudaErrorUnmapBufferObjectFailed: - return "cudaErrorUnmapBufferObjectFailed"{{endif}} - {{if 'cudaErrorArrayIsMapped' in found_values}} - if error == cudaErrorArrayIsMapped: - return "cudaErrorArrayIsMapped"{{endif}} - {{if 'cudaErrorAlreadyMapped' in found_values}} - if error == cudaErrorAlreadyMapped: - return "cudaErrorAlreadyMapped"{{endif}} - {{if 'cudaErrorNoKernelImageForDevice' in found_values}} - if error == cudaErrorNoKernelImageForDevice: - return "cudaErrorNoKernelImageForDevice"{{endif}} - {{if 'cudaErrorAlreadyAcquired' in found_values}} - if error == cudaErrorAlreadyAcquired: - return "cudaErrorAlreadyAcquired"{{endif}} - {{if 'cudaErrorNotMapped' in found_values}} - if error == cudaErrorNotMapped: - return "cudaErrorNotMapped"{{endif}} - {{if 'cudaErrorNotMappedAsArray' in found_values}} - if error == cudaErrorNotMappedAsArray: - return "cudaErrorNotMappedAsArray"{{endif}} - {{if 'cudaErrorNotMappedAsPointer' in found_values}} - if error == cudaErrorNotMappedAsPointer: - return "cudaErrorNotMappedAsPointer"{{endif}} - {{if 'cudaErrorECCUncorrectable' in found_values}} - if error == cudaErrorECCUncorrectable: - return "cudaErrorECCUncorrectable"{{endif}} - {{if 'cudaErrorUnsupportedLimit' in found_values}} - if error == cudaErrorUnsupportedLimit: - return "cudaErrorUnsupportedLimit"{{endif}} - {{if 'cudaErrorDeviceAlreadyInUse' in found_values}} - if error == cudaErrorDeviceAlreadyInUse: - return "cudaErrorDeviceAlreadyInUse"{{endif}} - {{if 'cudaErrorPeerAccessUnsupported' in found_values}} - if error == cudaErrorPeerAccessUnsupported: - return "cudaErrorPeerAccessUnsupported"{{endif}} - {{if 'cudaErrorInvalidPtx' in found_values}} - if error == cudaErrorInvalidPtx: - return "cudaErrorInvalidPtx"{{endif}} - {{if 'cudaErrorInvalidGraphicsContext' in found_values}} - if error == cudaErrorInvalidGraphicsContext: - return "cudaErrorInvalidGraphicsContext"{{endif}} - {{if 'cudaErrorNvlinkUncorrectable' in found_values}} - if error == cudaErrorNvlinkUncorrectable: - return "cudaErrorNvlinkUncorrectable"{{endif}} - {{if 'cudaErrorJitCompilerNotFound' in found_values}} - if error == cudaErrorJitCompilerNotFound: - return "cudaErrorJitCompilerNotFound"{{endif}} - {{if 'cudaErrorUnsupportedPtxVersion' in found_values}} - if error == cudaErrorUnsupportedPtxVersion: - return "cudaErrorUnsupportedPtxVersion"{{endif}} - {{if 'cudaErrorJitCompilationDisabled' in found_values}} - if error == cudaErrorJitCompilationDisabled: - return "cudaErrorJitCompilationDisabled"{{endif}} - {{if 'cudaErrorUnsupportedExecAffinity' in found_values}} - if error == cudaErrorUnsupportedExecAffinity: - return "cudaErrorUnsupportedExecAffinity"{{endif}} - {{if 'cudaErrorUnsupportedDevSideSync' in found_values}} - if error == cudaErrorUnsupportedDevSideSync: - return "cudaErrorUnsupportedDevSideSync"{{endif}} - {{if 'cudaErrorInvalidSource' in found_values}} - if error == cudaErrorInvalidSource: - return "cudaErrorInvalidSource"{{endif}} - {{if 'cudaErrorFileNotFound' in found_values}} - if error == cudaErrorFileNotFound: - return "cudaErrorFileNotFound"{{endif}} - {{if 'cudaErrorSharedObjectSymbolNotFound' in found_values}} - if error == cudaErrorSharedObjectSymbolNotFound: - return "cudaErrorSharedObjectSymbolNotFound"{{endif}} - {{if 'cudaErrorSharedObjectInitFailed' in found_values}} - if error == cudaErrorSharedObjectInitFailed: - return "cudaErrorSharedObjectInitFailed"{{endif}} - {{if 'cudaErrorOperatingSystem' in found_values}} - if error == cudaErrorOperatingSystem: - return "cudaErrorOperatingSystem"{{endif}} - {{if 'cudaErrorInvalidResourceHandle' in found_values}} - if error == cudaErrorInvalidResourceHandle: - return "cudaErrorInvalidResourceHandle"{{endif}} - {{if 'cudaErrorIllegalState' in found_values}} - if error == cudaErrorIllegalState: - return "cudaErrorIllegalState"{{endif}} - {{if 'cudaErrorLossyQuery' in found_values}} - if error == cudaErrorLossyQuery: - return "cudaErrorLossyQuery"{{endif}} - {{if 'cudaErrorSymbolNotFound' in found_values}} - if error == cudaErrorSymbolNotFound: - return "cudaErrorSymbolNotFound"{{endif}} - {{if 'cudaErrorNotReady' in found_values}} - if error == cudaErrorNotReady: - return "cudaErrorNotReady"{{endif}} - {{if 'cudaErrorIllegalAddress' in found_values}} - if error == cudaErrorIllegalAddress: - return "cudaErrorIllegalAddress"{{endif}} - {{if 'cudaErrorLaunchOutOfResources' in found_values}} - if error == cudaErrorLaunchOutOfResources: - return "cudaErrorLaunchOutOfResources"{{endif}} - {{if 'cudaErrorLaunchTimeout' in found_values}} - if error == cudaErrorLaunchTimeout: - return "cudaErrorLaunchTimeout"{{endif}} - {{if 'cudaErrorLaunchIncompatibleTexturing' in found_values}} - if error == cudaErrorLaunchIncompatibleTexturing: - return "cudaErrorLaunchIncompatibleTexturing"{{endif}} - {{if 'cudaErrorPeerAccessAlreadyEnabled' in found_values}} - if error == cudaErrorPeerAccessAlreadyEnabled: - return "cudaErrorPeerAccessAlreadyEnabled"{{endif}} - {{if 'cudaErrorPeerAccessNotEnabled' in found_values}} - if error == cudaErrorPeerAccessNotEnabled: - return "cudaErrorPeerAccessNotEnabled"{{endif}} - {{if 'cudaErrorSetOnActiveProcess' in found_values}} - if error == cudaErrorSetOnActiveProcess: - return "cudaErrorSetOnActiveProcess"{{endif}} - {{if 'cudaErrorContextIsDestroyed' in found_values}} - if error == cudaErrorContextIsDestroyed: - return "cudaErrorContextIsDestroyed"{{endif}} - {{if 'cudaErrorAssert' in found_values}} - if error == cudaErrorAssert: - return "cudaErrorAssert"{{endif}} - {{if 'cudaErrorTooManyPeers' in found_values}} - if error == cudaErrorTooManyPeers: - return "cudaErrorTooManyPeers"{{endif}} - {{if 'cudaErrorHostMemoryAlreadyRegistered' in found_values}} - if error == cudaErrorHostMemoryAlreadyRegistered: - return "cudaErrorHostMemoryAlreadyRegistered"{{endif}} - {{if 'cudaErrorHostMemoryNotRegistered' in found_values}} - if error == cudaErrorHostMemoryNotRegistered: - return "cudaErrorHostMemoryNotRegistered"{{endif}} - {{if 'cudaErrorHardwareStackError' in found_values}} - if error == cudaErrorHardwareStackError: - return "cudaErrorHardwareStackError"{{endif}} - {{if 'cudaErrorIllegalInstruction' in found_values}} - if error == cudaErrorIllegalInstruction: - return "cudaErrorIllegalInstruction"{{endif}} - {{if 'cudaErrorMisalignedAddress' in found_values}} - if error == cudaErrorMisalignedAddress: - return "cudaErrorMisalignedAddress"{{endif}} - {{if 'cudaErrorInvalidAddressSpace' in found_values}} - if error == cudaErrorInvalidAddressSpace: - return "cudaErrorInvalidAddressSpace"{{endif}} - {{if 'cudaErrorInvalidPc' in found_values}} - if error == cudaErrorInvalidPc: - return "cudaErrorInvalidPc"{{endif}} - {{if 'cudaErrorLaunchFailure' in found_values}} - if error == cudaErrorLaunchFailure: - return "cudaErrorLaunchFailure"{{endif}} - {{if 'cudaErrorCooperativeLaunchTooLarge' in found_values}} - if error == cudaErrorCooperativeLaunchTooLarge: - return "cudaErrorCooperativeLaunchTooLarge"{{endif}} - {{if 'cudaErrorNotPermitted' in found_values}} - if error == cudaErrorNotPermitted: - return "cudaErrorNotPermitted"{{endif}} - {{if 'cudaErrorNotSupported' in found_values}} - if error == cudaErrorNotSupported: - return "cudaErrorNotSupported"{{endif}} - {{if 'cudaErrorSystemNotReady' in found_values}} - if error == cudaErrorSystemNotReady: - return "cudaErrorSystemNotReady"{{endif}} - {{if 'cudaErrorSystemDriverMismatch' in found_values}} - if error == cudaErrorSystemDriverMismatch: - return "cudaErrorSystemDriverMismatch"{{endif}} - {{if 'cudaErrorCompatNotSupportedOnDevice' in found_values}} - if error == cudaErrorCompatNotSupportedOnDevice: - return "cudaErrorCompatNotSupportedOnDevice"{{endif}} - {{if 'cudaErrorMpsConnectionFailed' in found_values}} - if error == cudaErrorMpsConnectionFailed: - return "cudaErrorMpsConnectionFailed"{{endif}} - {{if 'cudaErrorMpsRpcFailure' in found_values}} - if error == cudaErrorMpsRpcFailure: - return "cudaErrorMpsRpcFailure"{{endif}} - {{if 'cudaErrorMpsServerNotReady' in found_values}} - if error == cudaErrorMpsServerNotReady: - return "cudaErrorMpsServerNotReady"{{endif}} - {{if 'cudaErrorMpsMaxClientsReached' in found_values}} - if error == cudaErrorMpsMaxClientsReached: - return "cudaErrorMpsMaxClientsReached"{{endif}} - {{if 'cudaErrorMpsMaxConnectionsReached' in found_values}} - if error == cudaErrorMpsMaxConnectionsReached: - return "cudaErrorMpsMaxConnectionsReached"{{endif}} - {{if 'cudaErrorMpsClientTerminated' in found_values}} - if error == cudaErrorMpsClientTerminated: - return "cudaErrorMpsClientTerminated"{{endif}} - {{if 'cudaErrorCdpNotSupported' in found_values}} - if error == cudaErrorCdpNotSupported: - return "cudaErrorCdpNotSupported"{{endif}} - {{if 'cudaErrorCdpVersionMismatch' in found_values}} - if error == cudaErrorCdpVersionMismatch: - return "cudaErrorCdpVersionMismatch"{{endif}} - {{if 'cudaErrorStreamCaptureUnsupported' in found_values}} - if error == cudaErrorStreamCaptureUnsupported: - return "cudaErrorStreamCaptureUnsupported"{{endif}} - {{if 'cudaErrorStreamCaptureInvalidated' in found_values}} - if error == cudaErrorStreamCaptureInvalidated: - return "cudaErrorStreamCaptureInvalidated"{{endif}} - {{if 'cudaErrorStreamCaptureMerge' in found_values}} - if error == cudaErrorStreamCaptureMerge: - return "cudaErrorStreamCaptureMerge"{{endif}} - {{if 'cudaErrorStreamCaptureUnmatched' in found_values}} - if error == cudaErrorStreamCaptureUnmatched: - return "cudaErrorStreamCaptureUnmatched"{{endif}} - {{if 'cudaErrorStreamCaptureUnjoined' in found_values}} - if error == cudaErrorStreamCaptureUnjoined: - return "cudaErrorStreamCaptureUnjoined"{{endif}} - {{if 'cudaErrorStreamCaptureIsolation' in found_values}} - if error == cudaErrorStreamCaptureIsolation: - return "cudaErrorStreamCaptureIsolation"{{endif}} - {{if 'cudaErrorStreamCaptureImplicit' in found_values}} - if error == cudaErrorStreamCaptureImplicit: - return "cudaErrorStreamCaptureImplicit"{{endif}} - {{if 'cudaErrorCapturedEvent' in found_values}} - if error == cudaErrorCapturedEvent: - return "cudaErrorCapturedEvent"{{endif}} - {{if 'cudaErrorStreamCaptureWrongThread' in found_values}} - if error == cudaErrorStreamCaptureWrongThread: - return "cudaErrorStreamCaptureWrongThread"{{endif}} - {{if 'cudaErrorTimeout' in found_values}} - if error == cudaErrorTimeout: - return "cudaErrorTimeout"{{endif}} - {{if 'cudaErrorGraphExecUpdateFailure' in found_values}} - if error == cudaErrorGraphExecUpdateFailure: - return "cudaErrorGraphExecUpdateFailure"{{endif}} - {{if 'cudaErrorExternalDevice' in found_values}} - if error == cudaErrorExternalDevice: - return "cudaErrorExternalDevice"{{endif}} - {{if 'cudaErrorInvalidClusterSize' in found_values}} - if error == cudaErrorInvalidClusterSize: - return "cudaErrorInvalidClusterSize"{{endif}} - {{if 'cudaErrorUnknown' in found_values}} - if error == cudaErrorUnknown: - return "cudaErrorUnknown"{{endif}} - {{if 'cudaErrorApiFailureBase' in found_values}} - if error == cudaErrorApiFailureBase: - return "cudaErrorApiFailureBase"{{endif}} - return pStr - -{{endif}} - -{{if 'cudaGetErrorString' in found_functions}} - -cdef const char* cudaGetErrorString(cudaError_t error) except ?NULL nogil: - return _cudaGetErrorString(error) - -{{endif}} - -{{if 'cudaGetDeviceCount' in found_functions}} - -cdef cudaError_t cudaGetDeviceCount(int* count) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGetDeviceCount(count) - -{{endif}} - -{{if 'cudaGetDeviceProperties_v2' in found_functions}} - -cdef cudaError_t cudaGetDeviceProperties(cudaDeviceProp* prop, int device) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGetDeviceProperties_v2(prop, device) - -{{endif}} - -{{if 'cudaDeviceGetAttribute' in found_functions}} - -cdef cudaError_t cudaDeviceGetAttribute(int* value, cudaDeviceAttr attr, int device) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDeviceGetAttribute(value, attr, device) - -{{endif}} - -{{if 'cudaDeviceGetDefaultMemPool' in found_functions}} - -cdef cudaError_t cudaDeviceGetDefaultMemPool(cudaMemPool_t* memPool, int device) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDeviceGetDefaultMemPool(memPool, device) - -{{endif}} - -{{if 'cudaDeviceSetMemPool' in found_functions}} - -cdef cudaError_t cudaDeviceSetMemPool(int device, cudaMemPool_t memPool) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDeviceSetMemPool(device, memPool) - -{{endif}} - -{{if 'cudaDeviceGetMemPool' in found_functions}} - -cdef cudaError_t cudaDeviceGetMemPool(cudaMemPool_t* memPool, int device) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDeviceGetMemPool(memPool, device) - -{{endif}} - -{{if 'cudaDeviceGetNvSciSyncAttributes' in found_functions}} - -cdef cudaError_t cudaDeviceGetNvSciSyncAttributes(void* nvSciSyncAttrList, int device, int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDeviceGetNvSciSyncAttributes(nvSciSyncAttrList, device, flags) - -{{endif}} - -{{if 'cudaDeviceGetP2PAttribute' in found_functions}} - -cdef cudaError_t cudaDeviceGetP2PAttribute(int* value, cudaDeviceP2PAttr attr, int srcDevice, int dstDevice) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDeviceGetP2PAttribute(value, attr, srcDevice, dstDevice) - -{{endif}} - -{{if 'cudaChooseDevice' in found_functions}} - -cdef cudaError_t cudaChooseDevice(int* device, const cudaDeviceProp* prop) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaChooseDevice(device, prop) - -{{endif}} - -{{if 'cudaInitDevice' in found_functions}} - -cdef cudaError_t cudaInitDevice(int device, unsigned int deviceFlags, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaInitDevice(device, deviceFlags, flags) - -{{endif}} - -{{if 'cudaSetDevice' in found_functions}} - -cdef cudaError_t cudaSetDevice(int device) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaSetDevice(device) - -{{endif}} - -{{if 'cudaGetDevice' in found_functions}} - -cdef cudaError_t cudaGetDevice(int* device) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGetDevice(device) - -{{endif}} - -{{if 'cudaSetDeviceFlags' in found_functions}} - -cdef cudaError_t cudaSetDeviceFlags(unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaSetDeviceFlags(flags) - -{{endif}} - -{{if 'cudaGetDeviceFlags' in found_functions}} - -cdef cudaError_t cudaGetDeviceFlags(unsigned int* flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGetDeviceFlags(flags) - -{{endif}} - -{{if 'cudaStreamCreate' in found_functions}} - -cdef cudaError_t cudaStreamCreate(cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaStreamCreate(pStream) - -{{endif}} - -{{if 'cudaStreamCreateWithFlags' in found_functions}} - -cdef cudaError_t cudaStreamCreateWithFlags(cudaStream_t* pStream, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaStreamCreateWithFlags(pStream, flags) - -{{endif}} - -{{if 'cudaStreamCreateWithPriority' in found_functions}} - -cdef cudaError_t cudaStreamCreateWithPriority(cudaStream_t* pStream, unsigned int flags, int priority) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaStreamCreateWithPriority(pStream, flags, priority) - -{{endif}} - -{{if 'cudaStreamGetPriority' in found_functions}} - -cdef cudaError_t cudaStreamGetPriority(cudaStream_t hStream, int* priority) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaStreamGetPriority(hStream, priority) - -{{endif}} - -{{if 'cudaStreamGetFlags' in found_functions}} - -cdef cudaError_t cudaStreamGetFlags(cudaStream_t hStream, unsigned int* flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaStreamGetFlags(hStream, flags) - -{{endif}} - -{{if 'cudaStreamGetId' in found_functions}} - -cdef cudaError_t cudaStreamGetId(cudaStream_t hStream, unsigned long long* streamId) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaStreamGetId(hStream, streamId) - -{{endif}} - -{{if 'cudaCtxResetPersistingL2Cache' in found_functions}} - -cdef cudaError_t cudaCtxResetPersistingL2Cache() except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaCtxResetPersistingL2Cache() - -{{endif}} - -{{if 'cudaStreamCopyAttributes' in found_functions}} - -cdef cudaError_t cudaStreamCopyAttributes(cudaStream_t dst, cudaStream_t src) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaStreamCopyAttributes(dst, src) - -{{endif}} - -{{if 'cudaStreamGetAttribute' in found_functions}} - -cdef cudaError_t cudaStreamGetAttribute(cudaStream_t hStream, cudaStreamAttrID attr, cudaStreamAttrValue* value_out) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaStreamGetAttribute(hStream, attr, value_out) - -{{endif}} - -{{if 'cudaStreamSetAttribute' in found_functions}} - -cdef cudaError_t cudaStreamSetAttribute(cudaStream_t hStream, cudaStreamAttrID attr, const cudaStreamAttrValue* value) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaStreamSetAttribute(hStream, attr, value) - -{{endif}} - -{{if 'cudaStreamDestroy' in found_functions}} - -cdef cudaError_t cudaStreamDestroy(cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaStreamDestroy(stream) - -{{endif}} - -{{if 'cudaStreamWaitEvent' in found_functions}} - -cdef cudaError_t cudaStreamWaitEvent(cudaStream_t stream, cudaEvent_t event, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaStreamWaitEvent(stream, event, flags) - -{{endif}} - -{{if 'cudaStreamAddCallback' in found_functions}} - -cdef cudaError_t cudaStreamAddCallback(cudaStream_t stream, cudaStreamCallback_t callback, void* userData, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaStreamAddCallback(stream, callback, userData, flags) - -{{endif}} - -{{if 'cudaStreamSynchronize' in found_functions}} - -cdef cudaError_t cudaStreamSynchronize(cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaStreamSynchronize(stream) - -{{endif}} - -{{if 'cudaStreamQuery' in found_functions}} - -cdef cudaError_t cudaStreamQuery(cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaStreamQuery(stream) - -{{endif}} - -{{if 'cudaStreamAttachMemAsync' in found_functions}} - -cdef cudaError_t cudaStreamAttachMemAsync(cudaStream_t stream, void* devPtr, size_t length, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaStreamAttachMemAsync(stream, devPtr, length, flags) - -{{endif}} - -{{if 'cudaStreamBeginCapture' in found_functions}} - -cdef cudaError_t cudaStreamBeginCapture(cudaStream_t stream, cudaStreamCaptureMode mode) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaStreamBeginCapture(stream, mode) - -{{endif}} - -{{if 'cudaStreamBeginCaptureToGraph' in found_functions}} - -cdef cudaError_t cudaStreamBeginCaptureToGraph(cudaStream_t stream, cudaGraph_t graph, const cudaGraphNode_t* dependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, cudaStreamCaptureMode mode) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaStreamBeginCaptureToGraph(stream, graph, dependencies, dependencyData, numDependencies, mode) - -{{endif}} - -{{if 'cudaThreadExchangeStreamCaptureMode' in found_functions}} - -cdef cudaError_t cudaThreadExchangeStreamCaptureMode(cudaStreamCaptureMode* mode) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaThreadExchangeStreamCaptureMode(mode) - -{{endif}} - -{{if 'cudaStreamEndCapture' in found_functions}} - -cdef cudaError_t cudaStreamEndCapture(cudaStream_t stream, cudaGraph_t* pGraph) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaStreamEndCapture(stream, pGraph) - -{{endif}} - -{{if 'cudaStreamIsCapturing' in found_functions}} - -cdef cudaError_t cudaStreamIsCapturing(cudaStream_t stream, cudaStreamCaptureStatus* pCaptureStatus) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaStreamIsCapturing(stream, pCaptureStatus) - -{{endif}} - -{{if 'cudaStreamGetCaptureInfo_v2' in found_functions}} - -cdef cudaError_t cudaStreamGetCaptureInfo(cudaStream_t stream, cudaStreamCaptureStatus* captureStatus_out, unsigned long long* id_out, cudaGraph_t* graph_out, const cudaGraphNode_t** dependencies_out, size_t* numDependencies_out) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaStreamGetCaptureInfo_v2(stream, captureStatus_out, id_out, graph_out, dependencies_out, numDependencies_out) - -{{endif}} - -{{if 'cudaStreamGetCaptureInfo_v3' in found_functions}} - -cdef cudaError_t cudaStreamGetCaptureInfo_v3(cudaStream_t stream, cudaStreamCaptureStatus* captureStatus_out, unsigned long long* id_out, cudaGraph_t* graph_out, const cudaGraphNode_t** dependencies_out, const cudaGraphEdgeData** edgeData_out, size_t* numDependencies_out) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaStreamGetCaptureInfo_v3(stream, captureStatus_out, id_out, graph_out, dependencies_out, edgeData_out, numDependencies_out) - -{{endif}} - -{{if 'cudaStreamUpdateCaptureDependencies' in found_functions}} - -cdef cudaError_t cudaStreamUpdateCaptureDependencies(cudaStream_t stream, cudaGraphNode_t* dependencies, size_t numDependencies, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaStreamUpdateCaptureDependencies(stream, dependencies, numDependencies, flags) - -{{endif}} - -{{if 'cudaStreamUpdateCaptureDependencies_v2' in found_functions}} - -cdef cudaError_t cudaStreamUpdateCaptureDependencies_v2(cudaStream_t stream, cudaGraphNode_t* dependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaStreamUpdateCaptureDependencies_v2(stream, dependencies, dependencyData, numDependencies, flags) - -{{endif}} - -{{if 'cudaEventCreate' in found_functions}} - -cdef cudaError_t cudaEventCreate(cudaEvent_t* event) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaEventCreate(event) - -{{endif}} - -{{if 'cudaEventCreateWithFlags' in found_functions}} - -cdef cudaError_t cudaEventCreateWithFlags(cudaEvent_t* event, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaEventCreateWithFlags(event, flags) - -{{endif}} - -{{if 'cudaEventRecord' in found_functions}} - -cdef cudaError_t cudaEventRecord(cudaEvent_t event, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaEventRecord(event, stream) - -{{endif}} - -{{if 'cudaEventRecordWithFlags' in found_functions}} - -cdef cudaError_t cudaEventRecordWithFlags(cudaEvent_t event, cudaStream_t stream, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaEventRecordWithFlags(event, stream, flags) - -{{endif}} - -{{if 'cudaEventQuery' in found_functions}} - -cdef cudaError_t cudaEventQuery(cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaEventQuery(event) - -{{endif}} - -{{if 'cudaEventSynchronize' in found_functions}} - -cdef cudaError_t cudaEventSynchronize(cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaEventSynchronize(event) - -{{endif}} - -{{if 'cudaEventDestroy' in found_functions}} - -cdef cudaError_t cudaEventDestroy(cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaEventDestroy(event) - -{{endif}} - -{{if 'cudaEventElapsedTime' in found_functions}} - -cdef cudaError_t cudaEventElapsedTime(float* ms, cudaEvent_t start, cudaEvent_t end) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaEventElapsedTime(ms, start, end) - -{{endif}} - -{{if 'cudaImportExternalMemory' in found_functions}} - -cdef cudaError_t cudaImportExternalMemory(cudaExternalMemory_t* extMem_out, const cudaExternalMemoryHandleDesc* memHandleDesc) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaImportExternalMemory(extMem_out, memHandleDesc) - -{{endif}} - -{{if 'cudaExternalMemoryGetMappedBuffer' in found_functions}} - -cdef cudaError_t cudaExternalMemoryGetMappedBuffer(void** devPtr, cudaExternalMemory_t extMem, const cudaExternalMemoryBufferDesc* bufferDesc) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaExternalMemoryGetMappedBuffer(devPtr, extMem, bufferDesc) - -{{endif}} - -{{if 'cudaExternalMemoryGetMappedMipmappedArray' in found_functions}} - -cdef cudaError_t cudaExternalMemoryGetMappedMipmappedArray(cudaMipmappedArray_t* mipmap, cudaExternalMemory_t extMem, const cudaExternalMemoryMipmappedArrayDesc* mipmapDesc) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaExternalMemoryGetMappedMipmappedArray(mipmap, extMem, mipmapDesc) - -{{endif}} - -{{if 'cudaDestroyExternalMemory' in found_functions}} - -cdef cudaError_t cudaDestroyExternalMemory(cudaExternalMemory_t extMem) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDestroyExternalMemory(extMem) - -{{endif}} - -{{if 'cudaImportExternalSemaphore' in found_functions}} - -cdef cudaError_t cudaImportExternalSemaphore(cudaExternalSemaphore_t* extSem_out, const cudaExternalSemaphoreHandleDesc* semHandleDesc) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaImportExternalSemaphore(extSem_out, semHandleDesc) - -{{endif}} - -{{if 'cudaSignalExternalSemaphoresAsync_v2' in found_functions}} - -cdef cudaError_t cudaSignalExternalSemaphoresAsync(const cudaExternalSemaphore_t* extSemArray, const cudaExternalSemaphoreSignalParams* paramsArray, unsigned int numExtSems, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaSignalExternalSemaphoresAsync_v2(extSemArray, paramsArray, numExtSems, stream) - -{{endif}} - -{{if 'cudaWaitExternalSemaphoresAsync_v2' in found_functions}} - -cdef cudaError_t cudaWaitExternalSemaphoresAsync(const cudaExternalSemaphore_t* extSemArray, const cudaExternalSemaphoreWaitParams* paramsArray, unsigned int numExtSems, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaWaitExternalSemaphoresAsync_v2(extSemArray, paramsArray, numExtSems, stream) - -{{endif}} - -{{if 'cudaDestroyExternalSemaphore' in found_functions}} - -cdef cudaError_t cudaDestroyExternalSemaphore(cudaExternalSemaphore_t extSem) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDestroyExternalSemaphore(extSem) - -{{endif}} - -{{if 'cudaFuncSetCacheConfig' in found_functions}} - -cdef cudaError_t cudaFuncSetCacheConfig(const void* func, cudaFuncCache cacheConfig) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaFuncSetCacheConfig(func, cacheConfig) - -{{endif}} - -{{if 'cudaFuncGetAttributes' in found_functions}} - -cdef cudaError_t cudaFuncGetAttributes(cudaFuncAttributes* attr, const void* func) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaFuncGetAttributes(attr, func) - -{{endif}} - -{{if 'cudaFuncSetAttribute' in found_functions}} - -cdef cudaError_t cudaFuncSetAttribute(const void* func, cudaFuncAttribute attr, int value) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaFuncSetAttribute(func, attr, value) - -{{endif}} - -{{if 'cudaLaunchHostFunc' in found_functions}} - -cdef cudaError_t cudaLaunchHostFunc(cudaStream_t stream, cudaHostFn_t fn, void* userData) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaLaunchHostFunc(stream, fn, userData) - -{{endif}} - -{{if 'cudaFuncSetSharedMemConfig' in found_functions}} - -cdef cudaError_t cudaFuncSetSharedMemConfig(const void* func, cudaSharedMemConfig config) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaFuncSetSharedMemConfig(func, config) - -{{endif}} - -{{if 'cudaOccupancyMaxActiveBlocksPerMultiprocessor' in found_functions}} - -cdef cudaError_t cudaOccupancyMaxActiveBlocksPerMultiprocessor(int* numBlocks, const void* func, int blockSize, size_t dynamicSMemSize) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaOccupancyMaxActiveBlocksPerMultiprocessor(numBlocks, func, blockSize, dynamicSMemSize) - -{{endif}} - -{{if 'cudaOccupancyAvailableDynamicSMemPerBlock' in found_functions}} - -cdef cudaError_t cudaOccupancyAvailableDynamicSMemPerBlock(size_t* dynamicSmemSize, const void* func, int numBlocks, int blockSize) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaOccupancyAvailableDynamicSMemPerBlock(dynamicSmemSize, func, numBlocks, blockSize) - -{{endif}} - -{{if 'cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags' in found_functions}} - -cdef cudaError_t cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(int* numBlocks, const void* func, int blockSize, size_t dynamicSMemSize, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(numBlocks, func, blockSize, dynamicSMemSize, flags) - -{{endif}} - -{{if 'cudaMallocManaged' in found_functions}} - -cdef cudaError_t cudaMallocManaged(void** devPtr, size_t size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMallocManaged(devPtr, size, flags) - -{{endif}} - -{{if 'cudaMalloc' in found_functions}} - -cdef cudaError_t cudaMalloc(void** devPtr, size_t size) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMalloc(devPtr, size) - -{{endif}} - -{{if 'cudaMallocHost' in found_functions}} - -cdef cudaError_t cudaMallocHost(void** ptr, size_t size) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMallocHost(ptr, size) - -{{endif}} - -{{if 'cudaMallocPitch' in found_functions}} - -cdef cudaError_t cudaMallocPitch(void** devPtr, size_t* pitch, size_t width, size_t height) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMallocPitch(devPtr, pitch, width, height) - -{{endif}} - -{{if 'cudaMallocArray' in found_functions}} - -cdef cudaError_t cudaMallocArray(cudaArray_t* array, const cudaChannelFormatDesc* desc, size_t width, size_t height, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMallocArray(array, desc, width, height, flags) - -{{endif}} - -{{if 'cudaFree' in found_functions}} - -cdef cudaError_t cudaFree(void* devPtr) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaFree(devPtr) - -{{endif}} - -{{if 'cudaFreeHost' in found_functions}} - -cdef cudaError_t cudaFreeHost(void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaFreeHost(ptr) - -{{endif}} - -{{if 'cudaFreeArray' in found_functions}} - -cdef cudaError_t cudaFreeArray(cudaArray_t array) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaFreeArray(array) - -{{endif}} - -{{if 'cudaFreeMipmappedArray' in found_functions}} - -cdef cudaError_t cudaFreeMipmappedArray(cudaMipmappedArray_t mipmappedArray) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaFreeMipmappedArray(mipmappedArray) - -{{endif}} - -{{if 'cudaHostAlloc' in found_functions}} - -cdef cudaError_t cudaHostAlloc(void** pHost, size_t size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaHostAlloc(pHost, size, flags) - -{{endif}} - -{{if 'cudaHostRegister' in found_functions}} - -cdef cudaError_t cudaHostRegister(void* ptr, size_t size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaHostRegister(ptr, size, flags) - -{{endif}} - -{{if 'cudaHostUnregister' in found_functions}} - -cdef cudaError_t cudaHostUnregister(void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaHostUnregister(ptr) - -{{endif}} - -{{if 'cudaHostGetDevicePointer' in found_functions}} - -cdef cudaError_t cudaHostGetDevicePointer(void** pDevice, void* pHost, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaHostGetDevicePointer(pDevice, pHost, flags) - -{{endif}} - -{{if 'cudaHostGetFlags' in found_functions}} - -cdef cudaError_t cudaHostGetFlags(unsigned int* pFlags, void* pHost) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaHostGetFlags(pFlags, pHost) - -{{endif}} - -{{if 'cudaMalloc3D' in found_functions}} - -cdef cudaError_t cudaMalloc3D(cudaPitchedPtr* pitchedDevPtr, cudaExtent extent) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMalloc3D(pitchedDevPtr, extent) - -{{endif}} - -{{if 'cudaMalloc3DArray' in found_functions}} - -cdef cudaError_t cudaMalloc3DArray(cudaArray_t* array, const cudaChannelFormatDesc* desc, cudaExtent extent, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMalloc3DArray(array, desc, extent, flags) - -{{endif}} - -{{if 'cudaMallocMipmappedArray' in found_functions}} - -cdef cudaError_t cudaMallocMipmappedArray(cudaMipmappedArray_t* mipmappedArray, const cudaChannelFormatDesc* desc, cudaExtent extent, unsigned int numLevels, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMallocMipmappedArray(mipmappedArray, desc, extent, numLevels, flags) - -{{endif}} - -{{if 'cudaGetMipmappedArrayLevel' in found_functions}} - -cdef cudaError_t cudaGetMipmappedArrayLevel(cudaArray_t* levelArray, cudaMipmappedArray_const_t mipmappedArray, unsigned int level) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGetMipmappedArrayLevel(levelArray, mipmappedArray, level) - -{{endif}} - -{{if 'cudaMemcpy3D' in found_functions}} - -cdef cudaError_t cudaMemcpy3D(const cudaMemcpy3DParms* p) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemcpy3D(p) - -{{endif}} - -{{if 'cudaMemcpy3DPeer' in found_functions}} - -cdef cudaError_t cudaMemcpy3DPeer(const cudaMemcpy3DPeerParms* p) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemcpy3DPeer(p) - -{{endif}} - -{{if 'cudaMemcpy3DAsync' in found_functions}} - -cdef cudaError_t cudaMemcpy3DAsync(const cudaMemcpy3DParms* p, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemcpy3DAsync(p, stream) - -{{endif}} - -{{if 'cudaMemcpy3DPeerAsync' in found_functions}} - -cdef cudaError_t cudaMemcpy3DPeerAsync(const cudaMemcpy3DPeerParms* p, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemcpy3DPeerAsync(p, stream) - -{{endif}} - -{{if 'cudaMemGetInfo' in found_functions}} - -cdef cudaError_t cudaMemGetInfo(size_t* free, size_t* total) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemGetInfo(free, total) - -{{endif}} - -{{if 'cudaArrayGetInfo' in found_functions}} - -cdef cudaError_t cudaArrayGetInfo(cudaChannelFormatDesc* desc, cudaExtent* extent, unsigned int* flags, cudaArray_t array) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaArrayGetInfo(desc, extent, flags, array) - -{{endif}} - -{{if 'cudaArrayGetPlane' in found_functions}} - -cdef cudaError_t cudaArrayGetPlane(cudaArray_t* pPlaneArray, cudaArray_t hArray, unsigned int planeIdx) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaArrayGetPlane(pPlaneArray, hArray, planeIdx) - -{{endif}} - -{{if 'cudaArrayGetMemoryRequirements' in found_functions}} - -cdef cudaError_t cudaArrayGetMemoryRequirements(cudaArrayMemoryRequirements* memoryRequirements, cudaArray_t array, int device) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaArrayGetMemoryRequirements(memoryRequirements, array, device) - -{{endif}} - -{{if 'cudaMipmappedArrayGetMemoryRequirements' in found_functions}} - -cdef cudaError_t cudaMipmappedArrayGetMemoryRequirements(cudaArrayMemoryRequirements* memoryRequirements, cudaMipmappedArray_t mipmap, int device) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMipmappedArrayGetMemoryRequirements(memoryRequirements, mipmap, device) - -{{endif}} - -{{if 'cudaArrayGetSparseProperties' in found_functions}} - -cdef cudaError_t cudaArrayGetSparseProperties(cudaArraySparseProperties* sparseProperties, cudaArray_t array) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaArrayGetSparseProperties(sparseProperties, array) - -{{endif}} - -{{if 'cudaMipmappedArrayGetSparseProperties' in found_functions}} - -cdef cudaError_t cudaMipmappedArrayGetSparseProperties(cudaArraySparseProperties* sparseProperties, cudaMipmappedArray_t mipmap) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMipmappedArrayGetSparseProperties(sparseProperties, mipmap) - -{{endif}} - -{{if 'cudaMemcpy' in found_functions}} - -cdef cudaError_t cudaMemcpy(void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemcpy(dst, src, count, kind) - -{{endif}} - -{{if 'cudaMemcpyPeer' in found_functions}} - -cdef cudaError_t cudaMemcpyPeer(void* dst, int dstDevice, const void* src, int srcDevice, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemcpyPeer(dst, dstDevice, src, srcDevice, count) - -{{endif}} - -{{if 'cudaMemcpy2D' in found_functions}} - -cdef cudaError_t cudaMemcpy2D(void* dst, size_t dpitch, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemcpy2D(dst, dpitch, src, spitch, width, height, kind) - -{{endif}} - -{{if 'cudaMemcpy2DToArray' in found_functions}} - -cdef cudaError_t cudaMemcpy2DToArray(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemcpy2DToArray(dst, wOffset, hOffset, src, spitch, width, height, kind) - -{{endif}} - -{{if 'cudaMemcpy2DFromArray' in found_functions}} - -cdef cudaError_t cudaMemcpy2DFromArray(void* dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemcpy2DFromArray(dst, dpitch, src, wOffset, hOffset, width, height, kind) - -{{endif}} - -{{if 'cudaMemcpy2DArrayToArray' in found_functions}} - -cdef cudaError_t cudaMemcpy2DArrayToArray(cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemcpy2DArrayToArray(dst, wOffsetDst, hOffsetDst, src, wOffsetSrc, hOffsetSrc, width, height, kind) - -{{endif}} - -{{if 'cudaMemcpyAsync' in found_functions}} - -cdef cudaError_t cudaMemcpyAsync(void* dst, const void* src, size_t count, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemcpyAsync(dst, src, count, kind, stream) - -{{endif}} - -{{if 'cudaMemcpyPeerAsync' in found_functions}} - -cdef cudaError_t cudaMemcpyPeerAsync(void* dst, int dstDevice, const void* src, int srcDevice, size_t count, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemcpyPeerAsync(dst, dstDevice, src, srcDevice, count, stream) - -{{endif}} - -{{if 'cudaMemcpy2DAsync' in found_functions}} - -cdef cudaError_t cudaMemcpy2DAsync(void* dst, size_t dpitch, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemcpy2DAsync(dst, dpitch, src, spitch, width, height, kind, stream) - -{{endif}} - -{{if 'cudaMemcpy2DToArrayAsync' in found_functions}} - -cdef cudaError_t cudaMemcpy2DToArrayAsync(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemcpy2DToArrayAsync(dst, wOffset, hOffset, src, spitch, width, height, kind, stream) - -{{endif}} - -{{if 'cudaMemcpy2DFromArrayAsync' in found_functions}} - -cdef cudaError_t cudaMemcpy2DFromArrayAsync(void* dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemcpy2DFromArrayAsync(dst, dpitch, src, wOffset, hOffset, width, height, kind, stream) - -{{endif}} - -{{if 'cudaMemset' in found_functions}} - -cdef cudaError_t cudaMemset(void* devPtr, int value, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemset(devPtr, value, count) - -{{endif}} - -{{if 'cudaMemset2D' in found_functions}} - -cdef cudaError_t cudaMemset2D(void* devPtr, size_t pitch, int value, size_t width, size_t height) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemset2D(devPtr, pitch, value, width, height) - -{{endif}} - -{{if 'cudaMemset3D' in found_functions}} - -cdef cudaError_t cudaMemset3D(cudaPitchedPtr pitchedDevPtr, int value, cudaExtent extent) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemset3D(pitchedDevPtr, value, extent) - -{{endif}} - -{{if 'cudaMemsetAsync' in found_functions}} - -cdef cudaError_t cudaMemsetAsync(void* devPtr, int value, size_t count, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemsetAsync(devPtr, value, count, stream) - -{{endif}} - -{{if 'cudaMemset2DAsync' in found_functions}} - -cdef cudaError_t cudaMemset2DAsync(void* devPtr, size_t pitch, int value, size_t width, size_t height, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemset2DAsync(devPtr, pitch, value, width, height, stream) - -{{endif}} - -{{if 'cudaMemset3DAsync' in found_functions}} - -cdef cudaError_t cudaMemset3DAsync(cudaPitchedPtr pitchedDevPtr, int value, cudaExtent extent, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemset3DAsync(pitchedDevPtr, value, extent, stream) - -{{endif}} - -{{if 'cudaMemPrefetchAsync' in found_functions}} - -cdef cudaError_t cudaMemPrefetchAsync(const void* devPtr, size_t count, int dstDevice, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemPrefetchAsync(devPtr, count, dstDevice, stream) - -{{endif}} - -{{if 'cudaMemPrefetchAsync_v2' in found_functions}} - -cdef cudaError_t cudaMemPrefetchAsync_v2(const void* devPtr, size_t count, cudaMemLocation location, unsigned int flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemPrefetchAsync_v2(devPtr, count, location, flags, stream) - -{{endif}} - -{{if 'cudaMemAdvise' in found_functions}} - -cdef cudaError_t cudaMemAdvise(const void* devPtr, size_t count, cudaMemoryAdvise advice, int device) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemAdvise(devPtr, count, advice, device) - -{{endif}} - -{{if 'cudaMemAdvise_v2' in found_functions}} - -cdef cudaError_t cudaMemAdvise_v2(const void* devPtr, size_t count, cudaMemoryAdvise advice, cudaMemLocation location) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemAdvise_v2(devPtr, count, advice, location) - -{{endif}} - -{{if 'cudaMemRangeGetAttribute' in found_functions}} - -cdef cudaError_t cudaMemRangeGetAttribute(void* data, size_t dataSize, cudaMemRangeAttribute attribute, const void* devPtr, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemRangeGetAttribute(data, dataSize, attribute, devPtr, count) - -{{endif}} - -{{if 'cudaMemRangeGetAttributes' in found_functions}} - -cdef cudaError_t cudaMemRangeGetAttributes(void** data, size_t* dataSizes, cudaMemRangeAttribute* attributes, size_t numAttributes, const void* devPtr, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemRangeGetAttributes(data, dataSizes, attributes, numAttributes, devPtr, count) - -{{endif}} - -{{if 'cudaMemcpyToArray' in found_functions}} - -cdef cudaError_t cudaMemcpyToArray(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemcpyToArray(dst, wOffset, hOffset, src, count, kind) - -{{endif}} - -{{if 'cudaMemcpyFromArray' in found_functions}} - -cdef cudaError_t cudaMemcpyFromArray(void* dst, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemcpyFromArray(dst, src, wOffset, hOffset, count, kind) - -{{endif}} - -{{if 'cudaMemcpyArrayToArray' in found_functions}} - -cdef cudaError_t cudaMemcpyArrayToArray(cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemcpyArrayToArray(dst, wOffsetDst, hOffsetDst, src, wOffsetSrc, hOffsetSrc, count, kind) - -{{endif}} - -{{if 'cudaMemcpyToArrayAsync' in found_functions}} - -cdef cudaError_t cudaMemcpyToArrayAsync(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t count, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemcpyToArrayAsync(dst, wOffset, hOffset, src, count, kind, stream) - -{{endif}} - -{{if 'cudaMemcpyFromArrayAsync' in found_functions}} - -cdef cudaError_t cudaMemcpyFromArrayAsync(void* dst, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemcpyFromArrayAsync(dst, src, wOffset, hOffset, count, kind, stream) - -{{endif}} - -{{if 'cudaMallocAsync' in found_functions}} - -cdef cudaError_t cudaMallocAsync(void** devPtr, size_t size, cudaStream_t hStream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMallocAsync(devPtr, size, hStream) - -{{endif}} - -{{if 'cudaFreeAsync' in found_functions}} - -cdef cudaError_t cudaFreeAsync(void* devPtr, cudaStream_t hStream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaFreeAsync(devPtr, hStream) - -{{endif}} - -{{if 'cudaMemPoolTrimTo' in found_functions}} - -cdef cudaError_t cudaMemPoolTrimTo(cudaMemPool_t memPool, size_t minBytesToKeep) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemPoolTrimTo(memPool, minBytesToKeep) - -{{endif}} - -{{if 'cudaMemPoolSetAttribute' in found_functions}} - -cdef cudaError_t cudaMemPoolSetAttribute(cudaMemPool_t memPool, cudaMemPoolAttr attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemPoolSetAttribute(memPool, attr, value) - -{{endif}} - -{{if 'cudaMemPoolGetAttribute' in found_functions}} - -cdef cudaError_t cudaMemPoolGetAttribute(cudaMemPool_t memPool, cudaMemPoolAttr attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemPoolGetAttribute(memPool, attr, value) - -{{endif}} - -{{if 'cudaMemPoolSetAccess' in found_functions}} - -cdef cudaError_t cudaMemPoolSetAccess(cudaMemPool_t memPool, const cudaMemAccessDesc* descList, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemPoolSetAccess(memPool, descList, count) - -{{endif}} - -{{if 'cudaMemPoolGetAccess' in found_functions}} - -cdef cudaError_t cudaMemPoolGetAccess(cudaMemAccessFlags* flags, cudaMemPool_t memPool, cudaMemLocation* location) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemPoolGetAccess(flags, memPool, location) - -{{endif}} - -{{if 'cudaMemPoolCreate' in found_functions}} - -cdef cudaError_t cudaMemPoolCreate(cudaMemPool_t* memPool, const cudaMemPoolProps* poolProps) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemPoolCreate(memPool, poolProps) - -{{endif}} - -{{if 'cudaMemPoolDestroy' in found_functions}} - -cdef cudaError_t cudaMemPoolDestroy(cudaMemPool_t memPool) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemPoolDestroy(memPool) - -{{endif}} - -{{if 'cudaMallocFromPoolAsync' in found_functions}} - -cdef cudaError_t cudaMallocFromPoolAsync(void** ptr, size_t size, cudaMemPool_t memPool, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMallocFromPoolAsync(ptr, size, memPool, stream) - -{{endif}} - -{{if 'cudaMemPoolExportToShareableHandle' in found_functions}} - -cdef cudaError_t cudaMemPoolExportToShareableHandle(void* shareableHandle, cudaMemPool_t memPool, cudaMemAllocationHandleType handleType, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemPoolExportToShareableHandle(shareableHandle, memPool, handleType, flags) - -{{endif}} - -{{if 'cudaMemPoolImportFromShareableHandle' in found_functions}} - -cdef cudaError_t cudaMemPoolImportFromShareableHandle(cudaMemPool_t* memPool, void* shareableHandle, cudaMemAllocationHandleType handleType, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemPoolImportFromShareableHandle(memPool, shareableHandle, handleType, flags) - -{{endif}} - -{{if 'cudaMemPoolExportPointer' in found_functions}} - -cdef cudaError_t cudaMemPoolExportPointer(cudaMemPoolPtrExportData* exportData, void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemPoolExportPointer(exportData, ptr) - -{{endif}} - -{{if 'cudaMemPoolImportPointer' in found_functions}} - -cdef cudaError_t cudaMemPoolImportPointer(void** ptr, cudaMemPool_t memPool, cudaMemPoolPtrExportData* exportData) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemPoolImportPointer(ptr, memPool, exportData) - -{{endif}} - -{{if 'cudaPointerGetAttributes' in found_functions}} - -cdef cudaError_t cudaPointerGetAttributes(cudaPointerAttributes* attributes, const void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaPointerGetAttributes(attributes, ptr) - -{{endif}} - -{{if 'cudaDeviceCanAccessPeer' in found_functions}} - -cdef cudaError_t cudaDeviceCanAccessPeer(int* canAccessPeer, int device, int peerDevice) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDeviceCanAccessPeer(canAccessPeer, device, peerDevice) - -{{endif}} - -{{if 'cudaDeviceEnablePeerAccess' in found_functions}} - -cdef cudaError_t cudaDeviceEnablePeerAccess(int peerDevice, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDeviceEnablePeerAccess(peerDevice, flags) - -{{endif}} - -{{if 'cudaDeviceDisablePeerAccess' in found_functions}} - -cdef cudaError_t cudaDeviceDisablePeerAccess(int peerDevice) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDeviceDisablePeerAccess(peerDevice) - -{{endif}} - -{{if 'cudaGraphicsUnregisterResource' in found_functions}} - -cdef cudaError_t cudaGraphicsUnregisterResource(cudaGraphicsResource_t resource) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphicsUnregisterResource(resource) - -{{endif}} - -{{if 'cudaGraphicsResourceSetMapFlags' in found_functions}} - -cdef cudaError_t cudaGraphicsResourceSetMapFlags(cudaGraphicsResource_t resource, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphicsResourceSetMapFlags(resource, flags) - -{{endif}} - -{{if 'cudaGraphicsMapResources' in found_functions}} - -cdef cudaError_t cudaGraphicsMapResources(int count, cudaGraphicsResource_t* resources, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphicsMapResources(count, resources, stream) - -{{endif}} - -{{if 'cudaGraphicsUnmapResources' in found_functions}} - -cdef cudaError_t cudaGraphicsUnmapResources(int count, cudaGraphicsResource_t* resources, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphicsUnmapResources(count, resources, stream) - -{{endif}} - -{{if 'cudaGraphicsResourceGetMappedPointer' in found_functions}} - -cdef cudaError_t cudaGraphicsResourceGetMappedPointer(void** devPtr, size_t* size, cudaGraphicsResource_t resource) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphicsResourceGetMappedPointer(devPtr, size, resource) - -{{endif}} - -{{if 'cudaGraphicsSubResourceGetMappedArray' in found_functions}} - -cdef cudaError_t cudaGraphicsSubResourceGetMappedArray(cudaArray_t* array, cudaGraphicsResource_t resource, unsigned int arrayIndex, unsigned int mipLevel) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphicsSubResourceGetMappedArray(array, resource, arrayIndex, mipLevel) - -{{endif}} - -{{if 'cudaGraphicsResourceGetMappedMipmappedArray' in found_functions}} - -cdef cudaError_t cudaGraphicsResourceGetMappedMipmappedArray(cudaMipmappedArray_t* mipmappedArray, cudaGraphicsResource_t resource) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphicsResourceGetMappedMipmappedArray(mipmappedArray, resource) - -{{endif}} - -{{if 'cudaGetChannelDesc' in found_functions}} - -cdef cudaError_t cudaGetChannelDesc(cudaChannelFormatDesc* desc, cudaArray_const_t array) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGetChannelDesc(desc, array) - -{{endif}} - -{{if 'cudaCreateChannelDesc' in found_functions}} - -cdef cudaChannelFormatDesc cudaCreateChannelDesc(int x, int y, int z, int w, cudaChannelFormatKind f) nogil: - return _cudaCreateChannelDesc(x, y, z, w, f) - -{{endif}} - -{{if 'cudaCreateTextureObject' in found_functions}} - -cdef cudaError_t cudaCreateTextureObject(cudaTextureObject_t* pTexObject, const cudaResourceDesc* pResDesc, const cudaTextureDesc* pTexDesc, const cudaResourceViewDesc* pResViewDesc) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaCreateTextureObject(pTexObject, pResDesc, pTexDesc, pResViewDesc) - -{{endif}} - -{{if 'cudaDestroyTextureObject' in found_functions}} - -cdef cudaError_t cudaDestroyTextureObject(cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDestroyTextureObject(texObject) - -{{endif}} - -{{if 'cudaGetTextureObjectResourceDesc' in found_functions}} - -cdef cudaError_t cudaGetTextureObjectResourceDesc(cudaResourceDesc* pResDesc, cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGetTextureObjectResourceDesc(pResDesc, texObject) - -{{endif}} - -{{if 'cudaGetTextureObjectTextureDesc' in found_functions}} - -cdef cudaError_t cudaGetTextureObjectTextureDesc(cudaTextureDesc* pTexDesc, cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGetTextureObjectTextureDesc(pTexDesc, texObject) - -{{endif}} - -{{if 'cudaGetTextureObjectResourceViewDesc' in found_functions}} - -cdef cudaError_t cudaGetTextureObjectResourceViewDesc(cudaResourceViewDesc* pResViewDesc, cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGetTextureObjectResourceViewDesc(pResViewDesc, texObject) - -{{endif}} - -{{if 'cudaCreateSurfaceObject' in found_functions}} - -cdef cudaError_t cudaCreateSurfaceObject(cudaSurfaceObject_t* pSurfObject, const cudaResourceDesc* pResDesc) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaCreateSurfaceObject(pSurfObject, pResDesc) - -{{endif}} - -{{if 'cudaDestroySurfaceObject' in found_functions}} - -cdef cudaError_t cudaDestroySurfaceObject(cudaSurfaceObject_t surfObject) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDestroySurfaceObject(surfObject) - -{{endif}} - -{{if 'cudaGetSurfaceObjectResourceDesc' in found_functions}} - -cdef cudaError_t cudaGetSurfaceObjectResourceDesc(cudaResourceDesc* pResDesc, cudaSurfaceObject_t surfObject) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGetSurfaceObjectResourceDesc(pResDesc, surfObject) - -{{endif}} - -{{if 'cudaDriverGetVersion' in found_functions}} - -cdef cudaError_t cudaDriverGetVersion(int* driverVersion) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDriverGetVersion(driverVersion) - -{{endif}} - -{{if 'cudaRuntimeGetVersion' in found_functions}} - -cdef cudaError_t cudaRuntimeGetVersion(int* runtimeVersion) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaRuntimeGetVersion(runtimeVersion) - -{{endif}} - -{{if 'cudaGraphCreate' in found_functions}} - -cdef cudaError_t cudaGraphCreate(cudaGraph_t* pGraph, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphCreate(pGraph, flags) - -{{endif}} - -{{if 'cudaGraphAddKernelNode' in found_functions}} - -cdef cudaError_t cudaGraphAddKernelNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphAddKernelNode(pGraphNode, graph, pDependencies, numDependencies, pNodeParams) - -{{endif}} - -{{if 'cudaGraphKernelNodeGetParams' in found_functions}} - -cdef cudaError_t cudaGraphKernelNodeGetParams(cudaGraphNode_t node, cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphKernelNodeGetParams(node, pNodeParams) - -{{endif}} - -{{if 'cudaGraphKernelNodeSetParams' in found_functions}} - -cdef cudaError_t cudaGraphKernelNodeSetParams(cudaGraphNode_t node, const cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphKernelNodeSetParams(node, pNodeParams) - -{{endif}} - -{{if 'cudaGraphKernelNodeCopyAttributes' in found_functions}} - -cdef cudaError_t cudaGraphKernelNodeCopyAttributes(cudaGraphNode_t hSrc, cudaGraphNode_t hDst) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphKernelNodeCopyAttributes(hSrc, hDst) - -{{endif}} - -{{if 'cudaGraphKernelNodeGetAttribute' in found_functions}} - -cdef cudaError_t cudaGraphKernelNodeGetAttribute(cudaGraphNode_t hNode, cudaKernelNodeAttrID attr, cudaKernelNodeAttrValue* value_out) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphKernelNodeGetAttribute(hNode, attr, value_out) - -{{endif}} - -{{if 'cudaGraphKernelNodeSetAttribute' in found_functions}} - -cdef cudaError_t cudaGraphKernelNodeSetAttribute(cudaGraphNode_t hNode, cudaKernelNodeAttrID attr, const cudaKernelNodeAttrValue* value) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphKernelNodeSetAttribute(hNode, attr, value) - -{{endif}} - -{{if 'cudaGraphAddMemcpyNode' in found_functions}} - -cdef cudaError_t cudaGraphAddMemcpyNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaMemcpy3DParms* pCopyParams) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphAddMemcpyNode(pGraphNode, graph, pDependencies, numDependencies, pCopyParams) - -{{endif}} - -{{if 'cudaGraphAddMemcpyNode1D' in found_functions}} - -cdef cudaError_t cudaGraphAddMemcpyNode1D(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphAddMemcpyNode1D(pGraphNode, graph, pDependencies, numDependencies, dst, src, count, kind) - -{{endif}} - -{{if 'cudaGraphMemcpyNodeGetParams' in found_functions}} - -cdef cudaError_t cudaGraphMemcpyNodeGetParams(cudaGraphNode_t node, cudaMemcpy3DParms* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphMemcpyNodeGetParams(node, pNodeParams) - -{{endif}} - -{{if 'cudaGraphMemcpyNodeSetParams' in found_functions}} - -cdef cudaError_t cudaGraphMemcpyNodeSetParams(cudaGraphNode_t node, const cudaMemcpy3DParms* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphMemcpyNodeSetParams(node, pNodeParams) - -{{endif}} - -{{if 'cudaGraphMemcpyNodeSetParams1D' in found_functions}} - -cdef cudaError_t cudaGraphMemcpyNodeSetParams1D(cudaGraphNode_t node, void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphMemcpyNodeSetParams1D(node, dst, src, count, kind) - -{{endif}} - -{{if 'cudaGraphAddMemsetNode' in found_functions}} - -cdef cudaError_t cudaGraphAddMemsetNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaMemsetParams* pMemsetParams) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphAddMemsetNode(pGraphNode, graph, pDependencies, numDependencies, pMemsetParams) - -{{endif}} - -{{if 'cudaGraphMemsetNodeGetParams' in found_functions}} - -cdef cudaError_t cudaGraphMemsetNodeGetParams(cudaGraphNode_t node, cudaMemsetParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphMemsetNodeGetParams(node, pNodeParams) - -{{endif}} - -{{if 'cudaGraphMemsetNodeSetParams' in found_functions}} - -cdef cudaError_t cudaGraphMemsetNodeSetParams(cudaGraphNode_t node, const cudaMemsetParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphMemsetNodeSetParams(node, pNodeParams) - -{{endif}} - -{{if 'cudaGraphAddHostNode' in found_functions}} - -cdef cudaError_t cudaGraphAddHostNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphAddHostNode(pGraphNode, graph, pDependencies, numDependencies, pNodeParams) - -{{endif}} - -{{if 'cudaGraphHostNodeGetParams' in found_functions}} - -cdef cudaError_t cudaGraphHostNodeGetParams(cudaGraphNode_t node, cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphHostNodeGetParams(node, pNodeParams) - -{{endif}} - -{{if 'cudaGraphHostNodeSetParams' in found_functions}} - -cdef cudaError_t cudaGraphHostNodeSetParams(cudaGraphNode_t node, const cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphHostNodeSetParams(node, pNodeParams) - -{{endif}} - -{{if 'cudaGraphAddChildGraphNode' in found_functions}} - -cdef cudaError_t cudaGraphAddChildGraphNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaGraph_t childGraph) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphAddChildGraphNode(pGraphNode, graph, pDependencies, numDependencies, childGraph) - -{{endif}} - -{{if 'cudaGraphChildGraphNodeGetGraph' in found_functions}} - -cdef cudaError_t cudaGraphChildGraphNodeGetGraph(cudaGraphNode_t node, cudaGraph_t* pGraph) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphChildGraphNodeGetGraph(node, pGraph) - -{{endif}} - -{{if 'cudaGraphAddEmptyNode' in found_functions}} - -cdef cudaError_t cudaGraphAddEmptyNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphAddEmptyNode(pGraphNode, graph, pDependencies, numDependencies) - -{{endif}} - -{{if 'cudaGraphAddEventRecordNode' in found_functions}} - -cdef cudaError_t cudaGraphAddEventRecordNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphAddEventRecordNode(pGraphNode, graph, pDependencies, numDependencies, event) - -{{endif}} - -{{if 'cudaGraphEventRecordNodeGetEvent' in found_functions}} - -cdef cudaError_t cudaGraphEventRecordNodeGetEvent(cudaGraphNode_t node, cudaEvent_t* event_out) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphEventRecordNodeGetEvent(node, event_out) - -{{endif}} - -{{if 'cudaGraphEventRecordNodeSetEvent' in found_functions}} - -cdef cudaError_t cudaGraphEventRecordNodeSetEvent(cudaGraphNode_t node, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphEventRecordNodeSetEvent(node, event) - -{{endif}} - -{{if 'cudaGraphAddEventWaitNode' in found_functions}} - -cdef cudaError_t cudaGraphAddEventWaitNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphAddEventWaitNode(pGraphNode, graph, pDependencies, numDependencies, event) - -{{endif}} - -{{if 'cudaGraphEventWaitNodeGetEvent' in found_functions}} - -cdef cudaError_t cudaGraphEventWaitNodeGetEvent(cudaGraphNode_t node, cudaEvent_t* event_out) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphEventWaitNodeGetEvent(node, event_out) - -{{endif}} - -{{if 'cudaGraphEventWaitNodeSetEvent' in found_functions}} - -cdef cudaError_t cudaGraphEventWaitNodeSetEvent(cudaGraphNode_t node, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphEventWaitNodeSetEvent(node, event) - -{{endif}} - -{{if 'cudaGraphAddExternalSemaphoresSignalNode' in found_functions}} - -cdef cudaError_t cudaGraphAddExternalSemaphoresSignalNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphAddExternalSemaphoresSignalNode(pGraphNode, graph, pDependencies, numDependencies, nodeParams) - -{{endif}} - -{{if 'cudaGraphExternalSemaphoresSignalNodeGetParams' in found_functions}} - -cdef cudaError_t cudaGraphExternalSemaphoresSignalNodeGetParams(cudaGraphNode_t hNode, cudaExternalSemaphoreSignalNodeParams* params_out) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphExternalSemaphoresSignalNodeGetParams(hNode, params_out) - -{{endif}} - -{{if 'cudaGraphExternalSemaphoresSignalNodeSetParams' in found_functions}} - -cdef cudaError_t cudaGraphExternalSemaphoresSignalNodeSetParams(cudaGraphNode_t hNode, const cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphExternalSemaphoresSignalNodeSetParams(hNode, nodeParams) - -{{endif}} - -{{if 'cudaGraphAddExternalSemaphoresWaitNode' in found_functions}} - -cdef cudaError_t cudaGraphAddExternalSemaphoresWaitNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphAddExternalSemaphoresWaitNode(pGraphNode, graph, pDependencies, numDependencies, nodeParams) - -{{endif}} - -{{if 'cudaGraphExternalSemaphoresWaitNodeGetParams' in found_functions}} - -cdef cudaError_t cudaGraphExternalSemaphoresWaitNodeGetParams(cudaGraphNode_t hNode, cudaExternalSemaphoreWaitNodeParams* params_out) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphExternalSemaphoresWaitNodeGetParams(hNode, params_out) - -{{endif}} - -{{if 'cudaGraphExternalSemaphoresWaitNodeSetParams' in found_functions}} - -cdef cudaError_t cudaGraphExternalSemaphoresWaitNodeSetParams(cudaGraphNode_t hNode, const cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphExternalSemaphoresWaitNodeSetParams(hNode, nodeParams) - -{{endif}} - -{{if 'cudaGraphAddMemAllocNode' in found_functions}} - -cdef cudaError_t cudaGraphAddMemAllocNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaMemAllocNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphAddMemAllocNode(pGraphNode, graph, pDependencies, numDependencies, nodeParams) - -{{endif}} - -{{if 'cudaGraphMemAllocNodeGetParams' in found_functions}} - -cdef cudaError_t cudaGraphMemAllocNodeGetParams(cudaGraphNode_t node, cudaMemAllocNodeParams* params_out) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphMemAllocNodeGetParams(node, params_out) - -{{endif}} - -{{if 'cudaGraphAddMemFreeNode' in found_functions}} - -cdef cudaError_t cudaGraphAddMemFreeNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, void* dptr) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphAddMemFreeNode(pGraphNode, graph, pDependencies, numDependencies, dptr) - -{{endif}} - -{{if 'cudaGraphMemFreeNodeGetParams' in found_functions}} - -cdef cudaError_t cudaGraphMemFreeNodeGetParams(cudaGraphNode_t node, void* dptr_out) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphMemFreeNodeGetParams(node, dptr_out) - -{{endif}} - -{{if 'cudaDeviceGraphMemTrim' in found_functions}} - -cdef cudaError_t cudaDeviceGraphMemTrim(int device) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDeviceGraphMemTrim(device) - -{{endif}} - -{{if 'cudaDeviceGetGraphMemAttribute' in found_functions}} - -cdef cudaError_t cudaDeviceGetGraphMemAttribute(int device, cudaGraphMemAttributeType attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDeviceGetGraphMemAttribute(device, attr, value) - -{{endif}} - -{{if 'cudaDeviceSetGraphMemAttribute' in found_functions}} - -cdef cudaError_t cudaDeviceSetGraphMemAttribute(int device, cudaGraphMemAttributeType attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDeviceSetGraphMemAttribute(device, attr, value) - -{{endif}} - -{{if 'cudaGraphClone' in found_functions}} - -cdef cudaError_t cudaGraphClone(cudaGraph_t* pGraphClone, cudaGraph_t originalGraph) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphClone(pGraphClone, originalGraph) - -{{endif}} - -{{if 'cudaGraphNodeFindInClone' in found_functions}} - -cdef cudaError_t cudaGraphNodeFindInClone(cudaGraphNode_t* pNode, cudaGraphNode_t originalNode, cudaGraph_t clonedGraph) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphNodeFindInClone(pNode, originalNode, clonedGraph) - -{{endif}} - -{{if 'cudaGraphNodeGetType' in found_functions}} - -cdef cudaError_t cudaGraphNodeGetType(cudaGraphNode_t node, cudaGraphNodeType* pType) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphNodeGetType(node, pType) - -{{endif}} - -{{if 'cudaGraphGetNodes' in found_functions}} - -cdef cudaError_t cudaGraphGetNodes(cudaGraph_t graph, cudaGraphNode_t* nodes, size_t* numNodes) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphGetNodes(graph, nodes, numNodes) - -{{endif}} - -{{if 'cudaGraphGetRootNodes' in found_functions}} - -cdef cudaError_t cudaGraphGetRootNodes(cudaGraph_t graph, cudaGraphNode_t* pRootNodes, size_t* pNumRootNodes) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphGetRootNodes(graph, pRootNodes, pNumRootNodes) - -{{endif}} - -{{if 'cudaGraphGetEdges' in found_functions}} - -cdef cudaError_t cudaGraphGetEdges(cudaGraph_t graph, cudaGraphNode_t* from_, cudaGraphNode_t* to, size_t* numEdges) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphGetEdges(graph, from_, to, numEdges) - -{{endif}} - -{{if 'cudaGraphGetEdges_v2' in found_functions}} - -cdef cudaError_t cudaGraphGetEdges_v2(cudaGraph_t graph, cudaGraphNode_t* from_, cudaGraphNode_t* to, cudaGraphEdgeData* edgeData, size_t* numEdges) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphGetEdges_v2(graph, from_, to, edgeData, numEdges) - -{{endif}} - -{{if 'cudaGraphNodeGetDependencies' in found_functions}} - -cdef cudaError_t cudaGraphNodeGetDependencies(cudaGraphNode_t node, cudaGraphNode_t* pDependencies, size_t* pNumDependencies) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphNodeGetDependencies(node, pDependencies, pNumDependencies) - -{{endif}} - -{{if 'cudaGraphNodeGetDependencies_v2' in found_functions}} - -cdef cudaError_t cudaGraphNodeGetDependencies_v2(cudaGraphNode_t node, cudaGraphNode_t* pDependencies, cudaGraphEdgeData* edgeData, size_t* pNumDependencies) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphNodeGetDependencies_v2(node, pDependencies, edgeData, pNumDependencies) - -{{endif}} - -{{if 'cudaGraphNodeGetDependentNodes' in found_functions}} - -cdef cudaError_t cudaGraphNodeGetDependentNodes(cudaGraphNode_t node, cudaGraphNode_t* pDependentNodes, size_t* pNumDependentNodes) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphNodeGetDependentNodes(node, pDependentNodes, pNumDependentNodes) - -{{endif}} - -{{if 'cudaGraphNodeGetDependentNodes_v2' in found_functions}} - -cdef cudaError_t cudaGraphNodeGetDependentNodes_v2(cudaGraphNode_t node, cudaGraphNode_t* pDependentNodes, cudaGraphEdgeData* edgeData, size_t* pNumDependentNodes) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphNodeGetDependentNodes_v2(node, pDependentNodes, edgeData, pNumDependentNodes) - -{{endif}} - -{{if 'cudaGraphAddDependencies' in found_functions}} - -cdef cudaError_t cudaGraphAddDependencies(cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphAddDependencies(graph, from_, to, numDependencies) - -{{endif}} - -{{if 'cudaGraphAddDependencies_v2' in found_functions}} - -cdef cudaError_t cudaGraphAddDependencies_v2(cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, const cudaGraphEdgeData* edgeData, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphAddDependencies_v2(graph, from_, to, edgeData, numDependencies) - -{{endif}} - -{{if 'cudaGraphRemoveDependencies' in found_functions}} - -cdef cudaError_t cudaGraphRemoveDependencies(cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphRemoveDependencies(graph, from_, to, numDependencies) - -{{endif}} - -{{if 'cudaGraphRemoveDependencies_v2' in found_functions}} - -cdef cudaError_t cudaGraphRemoveDependencies_v2(cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, const cudaGraphEdgeData* edgeData, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphRemoveDependencies_v2(graph, from_, to, edgeData, numDependencies) - -{{endif}} - -{{if 'cudaGraphDestroyNode' in found_functions}} - -cdef cudaError_t cudaGraphDestroyNode(cudaGraphNode_t node) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphDestroyNode(node) - -{{endif}} - -{{if 'cudaGraphInstantiate' in found_functions}} - -cdef cudaError_t cudaGraphInstantiate(cudaGraphExec_t* pGraphExec, cudaGraph_t graph, unsigned long long flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphInstantiate(pGraphExec, graph, flags) - -{{endif}} - -{{if 'cudaGraphInstantiateWithFlags' in found_functions}} - -cdef cudaError_t cudaGraphInstantiateWithFlags(cudaGraphExec_t* pGraphExec, cudaGraph_t graph, unsigned long long flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphInstantiateWithFlags(pGraphExec, graph, flags) - -{{endif}} - -{{if 'cudaGraphInstantiateWithParams' in found_functions}} - -cdef cudaError_t cudaGraphInstantiateWithParams(cudaGraphExec_t* pGraphExec, cudaGraph_t graph, cudaGraphInstantiateParams* instantiateParams) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphInstantiateWithParams(pGraphExec, graph, instantiateParams) - -{{endif}} - -{{if 'cudaGraphExecGetFlags' in found_functions}} - -cdef cudaError_t cudaGraphExecGetFlags(cudaGraphExec_t graphExec, unsigned long long* flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphExecGetFlags(graphExec, flags) - -{{endif}} - -{{if 'cudaGraphExecKernelNodeSetParams' in found_functions}} - -cdef cudaError_t cudaGraphExecKernelNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphExecKernelNodeSetParams(hGraphExec, node, pNodeParams) - -{{endif}} - -{{if 'cudaGraphExecMemcpyNodeSetParams' in found_functions}} - -cdef cudaError_t cudaGraphExecMemcpyNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaMemcpy3DParms* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphExecMemcpyNodeSetParams(hGraphExec, node, pNodeParams) - -{{endif}} - -{{if 'cudaGraphExecMemcpyNodeSetParams1D' in found_functions}} - -cdef cudaError_t cudaGraphExecMemcpyNodeSetParams1D(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphExecMemcpyNodeSetParams1D(hGraphExec, node, dst, src, count, kind) - -{{endif}} - -{{if 'cudaGraphExecMemsetNodeSetParams' in found_functions}} - -cdef cudaError_t cudaGraphExecMemsetNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaMemsetParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphExecMemsetNodeSetParams(hGraphExec, node, pNodeParams) - -{{endif}} - -{{if 'cudaGraphExecHostNodeSetParams' in found_functions}} - -cdef cudaError_t cudaGraphExecHostNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphExecHostNodeSetParams(hGraphExec, node, pNodeParams) - -{{endif}} - -{{if 'cudaGraphExecChildGraphNodeSetParams' in found_functions}} - -cdef cudaError_t cudaGraphExecChildGraphNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, cudaGraph_t childGraph) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphExecChildGraphNodeSetParams(hGraphExec, node, childGraph) - -{{endif}} - -{{if 'cudaGraphExecEventRecordNodeSetEvent' in found_functions}} - -cdef cudaError_t cudaGraphExecEventRecordNodeSetEvent(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphExecEventRecordNodeSetEvent(hGraphExec, hNode, event) - -{{endif}} - -{{if 'cudaGraphExecEventWaitNodeSetEvent' in found_functions}} - -cdef cudaError_t cudaGraphExecEventWaitNodeSetEvent(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphExecEventWaitNodeSetEvent(hGraphExec, hNode, event) - -{{endif}} - -{{if 'cudaGraphExecExternalSemaphoresSignalNodeSetParams' in found_functions}} - -cdef cudaError_t cudaGraphExecExternalSemaphoresSignalNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, const cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphExecExternalSemaphoresSignalNodeSetParams(hGraphExec, hNode, nodeParams) - -{{endif}} - -{{if 'cudaGraphExecExternalSemaphoresWaitNodeSetParams' in found_functions}} - -cdef cudaError_t cudaGraphExecExternalSemaphoresWaitNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, const cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphExecExternalSemaphoresWaitNodeSetParams(hGraphExec, hNode, nodeParams) - -{{endif}} - -{{if 'cudaGraphNodeSetEnabled' in found_functions}} - -cdef cudaError_t cudaGraphNodeSetEnabled(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, unsigned int isEnabled) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphNodeSetEnabled(hGraphExec, hNode, isEnabled) - -{{endif}} - -{{if 'cudaGraphNodeGetEnabled' in found_functions}} - -cdef cudaError_t cudaGraphNodeGetEnabled(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, unsigned int* isEnabled) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphNodeGetEnabled(hGraphExec, hNode, isEnabled) - -{{endif}} - -{{if 'cudaGraphExecUpdate' in found_functions}} - -cdef cudaError_t cudaGraphExecUpdate(cudaGraphExec_t hGraphExec, cudaGraph_t hGraph, cudaGraphExecUpdateResultInfo* resultInfo) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphExecUpdate(hGraphExec, hGraph, resultInfo) - -{{endif}} - -{{if 'cudaGraphUpload' in found_functions}} - -cdef cudaError_t cudaGraphUpload(cudaGraphExec_t graphExec, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphUpload(graphExec, stream) - -{{endif}} - -{{if 'cudaGraphLaunch' in found_functions}} - -cdef cudaError_t cudaGraphLaunch(cudaGraphExec_t graphExec, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphLaunch(graphExec, stream) - -{{endif}} - -{{if 'cudaGraphExecDestroy' in found_functions}} - -cdef cudaError_t cudaGraphExecDestroy(cudaGraphExec_t graphExec) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphExecDestroy(graphExec) - -{{endif}} - -{{if 'cudaGraphDestroy' in found_functions}} - -cdef cudaError_t cudaGraphDestroy(cudaGraph_t graph) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphDestroy(graph) - -{{endif}} - -{{if 'cudaGraphDebugDotPrint' in found_functions}} - -cdef cudaError_t cudaGraphDebugDotPrint(cudaGraph_t graph, const char* path, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphDebugDotPrint(graph, path, flags) - -{{endif}} - -{{if 'cudaUserObjectCreate' in found_functions}} - -cdef cudaError_t cudaUserObjectCreate(cudaUserObject_t* object_out, void* ptr, cudaHostFn_t destroy, unsigned int initialRefcount, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaUserObjectCreate(object_out, ptr, destroy, initialRefcount, flags) - -{{endif}} - -{{if 'cudaUserObjectRetain' in found_functions}} - -cdef cudaError_t cudaUserObjectRetain(cudaUserObject_t object, unsigned int count) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaUserObjectRetain(object, count) - -{{endif}} - -{{if 'cudaUserObjectRelease' in found_functions}} - -cdef cudaError_t cudaUserObjectRelease(cudaUserObject_t object, unsigned int count) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaUserObjectRelease(object, count) - -{{endif}} - -{{if 'cudaGraphRetainUserObject' in found_functions}} - -cdef cudaError_t cudaGraphRetainUserObject(cudaGraph_t graph, cudaUserObject_t object, unsigned int count, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphRetainUserObject(graph, object, count, flags) - -{{endif}} - -{{if 'cudaGraphReleaseUserObject' in found_functions}} - -cdef cudaError_t cudaGraphReleaseUserObject(cudaGraph_t graph, cudaUserObject_t object, unsigned int count) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphReleaseUserObject(graph, object, count) - -{{endif}} - -{{if 'cudaGraphAddNode' in found_functions}} - -cdef cudaError_t cudaGraphAddNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphAddNode(pGraphNode, graph, pDependencies, numDependencies, nodeParams) - -{{endif}} - -{{if 'cudaGraphAddNode_v2' in found_functions}} - -cdef cudaError_t cudaGraphAddNode_v2(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphAddNode_v2(pGraphNode, graph, pDependencies, dependencyData, numDependencies, nodeParams) - -{{endif}} - -{{if 'cudaGraphNodeSetParams' in found_functions}} - -cdef cudaError_t cudaGraphNodeSetParams(cudaGraphNode_t node, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphNodeSetParams(node, nodeParams) - -{{endif}} - -{{if 'cudaGraphExecNodeSetParams' in found_functions}} - -cdef cudaError_t cudaGraphExecNodeSetParams(cudaGraphExec_t graphExec, cudaGraphNode_t node, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphExecNodeSetParams(graphExec, node, nodeParams) - -{{endif}} - -{{if 'cudaGraphConditionalHandleCreate' in found_functions}} - -cdef cudaError_t cudaGraphConditionalHandleCreate(cudaGraphConditionalHandle* pHandle_out, cudaGraph_t graph, unsigned int defaultLaunchValue, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphConditionalHandleCreate(pHandle_out, graph, defaultLaunchValue, flags) - -{{endif}} - -{{if 'cudaGetDriverEntryPoint' in found_functions}} - -cdef cudaError_t cudaGetDriverEntryPoint(const char* symbol, void** funcPtr, unsigned long long flags, cudaDriverEntryPointQueryResult* driverStatus) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGetDriverEntryPoint(symbol, funcPtr, flags, driverStatus) - -{{endif}} - -{{if 'cudaGetDriverEntryPointByVersion' in found_functions}} - -cdef cudaError_t cudaGetDriverEntryPointByVersion(const char* symbol, void** funcPtr, unsigned int cudaVersion, unsigned long long flags, cudaDriverEntryPointQueryResult* driverStatus) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGetDriverEntryPointByVersion(symbol, funcPtr, cudaVersion, flags, driverStatus) - -{{endif}} - -{{if 'cudaGetExportTable' in found_functions}} - -cdef cudaError_t cudaGetExportTable(const void** ppExportTable, const cudaUUID_t* pExportTableId) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGetExportTable(ppExportTable, pExportTableId) - -{{endif}} - -{{if 'cudaGetKernel' in found_functions}} - -cdef cudaError_t cudaGetKernel(cudaKernel_t* kernelPtr, const void* entryFuncAddr) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGetKernel(kernelPtr, entryFuncAddr) - -{{endif}} - -{{if 'make_cudaPitchedPtr' in found_functions}} - -cdef cudaPitchedPtr make_cudaPitchedPtr(void* d, size_t p, size_t xsz, size_t ysz) nogil: - return _make_cudaPitchedPtr(d, p, xsz, ysz) - -{{endif}} - -{{if 'make_cudaPos' in found_functions}} - -cdef cudaPos make_cudaPos(size_t x, size_t y, size_t z) nogil: - return _make_cudaPos(x, y, z) - -{{endif}} - -{{if 'make_cudaExtent' in found_functions}} - -cdef cudaExtent make_cudaExtent(size_t w, size_t h, size_t d) nogil: - return _make_cudaExtent(w, h, d) - -{{endif}} - -{{if True}} - -cdef cudaError_t cudaGraphicsEGLRegisterImage(cudaGraphicsResource** pCudaResource, EGLImageKHR image, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphicsEGLRegisterImage(pCudaResource, image, flags) - -{{endif}} - -{{if True}} - -cdef cudaError_t cudaEGLStreamConsumerConnect(cudaEglStreamConnection* conn, EGLStreamKHR eglStream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaEGLStreamConsumerConnect(conn, eglStream) - -{{endif}} - -{{if True}} - -cdef cudaError_t cudaEGLStreamConsumerConnectWithFlags(cudaEglStreamConnection* conn, EGLStreamKHR eglStream, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaEGLStreamConsumerConnectWithFlags(conn, eglStream, flags) - -{{endif}} - -{{if True}} - -cdef cudaError_t cudaEGLStreamConsumerDisconnect(cudaEglStreamConnection* conn) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaEGLStreamConsumerDisconnect(conn) - -{{endif}} - -{{if True}} - -cdef cudaError_t cudaEGLStreamConsumerAcquireFrame(cudaEglStreamConnection* conn, cudaGraphicsResource_t* pCudaResource, cudaStream_t* pStream, unsigned int timeout) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaEGLStreamConsumerAcquireFrame(conn, pCudaResource, pStream, timeout) - -{{endif}} - -{{if True}} - -cdef cudaError_t cudaEGLStreamConsumerReleaseFrame(cudaEglStreamConnection* conn, cudaGraphicsResource_t pCudaResource, cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaEGLStreamConsumerReleaseFrame(conn, pCudaResource, pStream) - -{{endif}} - -{{if True}} - -cdef cudaError_t cudaEGLStreamProducerConnect(cudaEglStreamConnection* conn, EGLStreamKHR eglStream, EGLint width, EGLint height) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaEGLStreamProducerConnect(conn, eglStream, width, height) - -{{endif}} - -{{if True}} - -cdef cudaError_t cudaEGLStreamProducerDisconnect(cudaEglStreamConnection* conn) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaEGLStreamProducerDisconnect(conn) - -{{endif}} - -{{if True}} - -cdef cudaError_t cudaEGLStreamProducerPresentFrame(cudaEglStreamConnection* conn, cudaEglFrame eglframe, cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaEGLStreamProducerPresentFrame(conn, eglframe, pStream) - -{{endif}} - -{{if True}} - -cdef cudaError_t cudaEGLStreamProducerReturnFrame(cudaEglStreamConnection* conn, cudaEglFrame* eglframe, cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaEGLStreamProducerReturnFrame(conn, eglframe, pStream) - -{{endif}} - -{{if True}} - -cdef cudaError_t cudaGraphicsResourceGetMappedEglFrame(cudaEglFrame* eglFrame, cudaGraphicsResource_t resource, unsigned int index, unsigned int mipLevel) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphicsResourceGetMappedEglFrame(eglFrame, resource, index, mipLevel) - -{{endif}} - -{{if True}} - -cdef cudaError_t cudaEventCreateFromEGLSync(cudaEvent_t* phEvent, EGLSyncKHR eglSync, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaEventCreateFromEGLSync(phEvent, eglSync, flags) - -{{endif}} - -{{if True}} - -cdef cudaError_t cudaProfilerStart() except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaProfilerStart() - -{{endif}} - -{{if True}} - -cdef cudaError_t cudaProfilerStop() except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaProfilerStop() - -{{endif}} - -{{if True}} - -cdef cudaError_t cudaGLGetDevices(unsigned int* pCudaDeviceCount, int* pCudaDevices, unsigned int cudaDeviceCount, cudaGLDeviceList deviceList) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGLGetDevices(pCudaDeviceCount, pCudaDevices, cudaDeviceCount, deviceList) - -{{endif}} - -{{if True}} - -cdef cudaError_t cudaGraphicsGLRegisterImage(cudaGraphicsResource** resource, GLuint image, GLenum target, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphicsGLRegisterImage(resource, image, target, flags) - -{{endif}} - -{{if True}} - -cdef cudaError_t cudaGraphicsGLRegisterBuffer(cudaGraphicsResource** resource, GLuint buffer, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphicsGLRegisterBuffer(resource, buffer, flags) - -{{endif}} - -{{if True}} - -cdef cudaError_t cudaVDPAUGetDevice(int* device, VdpDevice vdpDevice, VdpGetProcAddress* vdpGetProcAddress) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaVDPAUGetDevice(device, vdpDevice, vdpGetProcAddress) - -{{endif}} - -{{if True}} - -cdef cudaError_t cudaVDPAUSetVDPAUDevice(int device, VdpDevice vdpDevice, VdpGetProcAddress* vdpGetProcAddress) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaVDPAUSetVDPAUDevice(device, vdpDevice, vdpGetProcAddress) - -{{endif}} - -{{if True}} - -cdef cudaError_t cudaGraphicsVDPAURegisterVideoSurface(cudaGraphicsResource** resource, VdpVideoSurface vdpSurface, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphicsVDPAURegisterVideoSurface(resource, vdpSurface, flags) - -{{endif}} - -{{if True}} - -cdef cudaError_t cudaGraphicsVDPAURegisterOutputSurface(cudaGraphicsResource** resource, VdpOutputSurface vdpSurface, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphicsVDPAURegisterOutputSurface(resource, vdpSurface, flags) - -{{endif}} - -{{if True}} - -cdef cudaError_t getLocalRuntimeVersion(int* runtimeVersion) except ?cudaErrorCallRequiresNewerDriver nogil: - return _getLocalRuntimeVersion(runtimeVersion) - -{{endif}} diff --git a/cuda/cnvrtc.pxd.in b/cuda/cnvrtc.pxd.in deleted file mode 100644 index 20e3fef38f7..00000000000 --- a/cuda/cnvrtc.pxd.in +++ /dev/null @@ -1,136 +0,0 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. -# -# Please refer to the NVIDIA end user license agreement (EULA) associated -# with this source code for terms and conditions that govern your use of -# this software. Any use, reproduction, disclosure, or distribution of -# this software and related documentation outside the terms of the EULA -# is strictly prohibited. - -from libc.stdint cimport uint32_t, uint64_t - -cdef extern from "nvrtc.h": - - ctypedef enum nvrtcResult: - NVRTC_SUCCESS = 0 - NVRTC_ERROR_OUT_OF_MEMORY = 1 - NVRTC_ERROR_PROGRAM_CREATION_FAILURE = 2 - NVRTC_ERROR_INVALID_INPUT = 3 - NVRTC_ERROR_INVALID_PROGRAM = 4 - NVRTC_ERROR_INVALID_OPTION = 5 - NVRTC_ERROR_COMPILATION = 6 - NVRTC_ERROR_BUILTIN_OPERATION_FAILURE = 7 - NVRTC_ERROR_NO_NAME_EXPRESSIONS_AFTER_COMPILATION = 8 - NVRTC_ERROR_NO_LOWERED_NAMES_BEFORE_COMPILATION = 9 - NVRTC_ERROR_NAME_EXPRESSION_NOT_VALID = 10 - NVRTC_ERROR_INTERNAL_ERROR = 11 - NVRTC_ERROR_TIME_FILE_WRITE_FAILED = 12 - - cdef struct _nvrtcProgram: - pass - ctypedef _nvrtcProgram* nvrtcProgram - -{{if 'nvrtcGetErrorString' in found_functions}} - -cdef const char* nvrtcGetErrorString(nvrtcResult result) except ?NULL nogil -{{endif}} - -{{if 'nvrtcVersion' in found_functions}} - -cdef nvrtcResult nvrtcVersion(int* major, int* minor) except ?NVRTC_ERROR_INVALID_INPUT nogil -{{endif}} - -{{if 'nvrtcGetNumSupportedArchs' in found_functions}} - -cdef nvrtcResult nvrtcGetNumSupportedArchs(int* numArchs) except ?NVRTC_ERROR_INVALID_INPUT nogil -{{endif}} - -{{if 'nvrtcGetSupportedArchs' in found_functions}} - -cdef nvrtcResult nvrtcGetSupportedArchs(int* supportedArchs) except ?NVRTC_ERROR_INVALID_INPUT nogil -{{endif}} - -{{if 'nvrtcCreateProgram' in found_functions}} - -cdef nvrtcResult nvrtcCreateProgram(nvrtcProgram* prog, const char* src, const char* name, int numHeaders, const char** headers, const char** includeNames) except ?NVRTC_ERROR_INVALID_INPUT nogil -{{endif}} - -{{if 'nvrtcDestroyProgram' in found_functions}} - -cdef nvrtcResult nvrtcDestroyProgram(nvrtcProgram* prog) except ?NVRTC_ERROR_INVALID_INPUT nogil -{{endif}} - -{{if 'nvrtcCompileProgram' in found_functions}} - -cdef nvrtcResult nvrtcCompileProgram(nvrtcProgram prog, int numOptions, const char** options) except ?NVRTC_ERROR_INVALID_INPUT nogil -{{endif}} - -{{if 'nvrtcGetPTXSize' in found_functions}} - -cdef nvrtcResult nvrtcGetPTXSize(nvrtcProgram prog, size_t* ptxSizeRet) except ?NVRTC_ERROR_INVALID_INPUT nogil -{{endif}} - -{{if 'nvrtcGetPTX' in found_functions}} - -cdef nvrtcResult nvrtcGetPTX(nvrtcProgram prog, char* ptx) except ?NVRTC_ERROR_INVALID_INPUT nogil -{{endif}} - -{{if 'nvrtcGetCUBINSize' in found_functions}} - -cdef nvrtcResult nvrtcGetCUBINSize(nvrtcProgram prog, size_t* cubinSizeRet) except ?NVRTC_ERROR_INVALID_INPUT nogil -{{endif}} - -{{if 'nvrtcGetCUBIN' in found_functions}} - -cdef nvrtcResult nvrtcGetCUBIN(nvrtcProgram prog, char* cubin) except ?NVRTC_ERROR_INVALID_INPUT nogil -{{endif}} - -{{if 'nvrtcGetNVVMSize' in found_functions}} - -cdef nvrtcResult nvrtcGetNVVMSize(nvrtcProgram prog, size_t* nvvmSizeRet) except ?NVRTC_ERROR_INVALID_INPUT nogil -{{endif}} - -{{if 'nvrtcGetNVVM' in found_functions}} - -cdef nvrtcResult nvrtcGetNVVM(nvrtcProgram prog, char* nvvm) except ?NVRTC_ERROR_INVALID_INPUT nogil -{{endif}} - -{{if 'nvrtcGetLTOIRSize' in found_functions}} - -cdef nvrtcResult nvrtcGetLTOIRSize(nvrtcProgram prog, size_t* LTOIRSizeRet) except ?NVRTC_ERROR_INVALID_INPUT nogil -{{endif}} - -{{if 'nvrtcGetLTOIR' in found_functions}} - -cdef nvrtcResult nvrtcGetLTOIR(nvrtcProgram prog, char* LTOIR) except ?NVRTC_ERROR_INVALID_INPUT nogil -{{endif}} - -{{if 'nvrtcGetOptiXIRSize' in found_functions}} - -cdef nvrtcResult nvrtcGetOptiXIRSize(nvrtcProgram prog, size_t* optixirSizeRet) except ?NVRTC_ERROR_INVALID_INPUT nogil -{{endif}} - -{{if 'nvrtcGetOptiXIR' in found_functions}} - -cdef nvrtcResult nvrtcGetOptiXIR(nvrtcProgram prog, char* optixir) except ?NVRTC_ERROR_INVALID_INPUT nogil -{{endif}} - -{{if 'nvrtcGetProgramLogSize' in found_functions}} - -cdef nvrtcResult nvrtcGetProgramLogSize(nvrtcProgram prog, size_t* logSizeRet) except ?NVRTC_ERROR_INVALID_INPUT nogil -{{endif}} - -{{if 'nvrtcGetProgramLog' in found_functions}} - -cdef nvrtcResult nvrtcGetProgramLog(nvrtcProgram prog, char* log) except ?NVRTC_ERROR_INVALID_INPUT nogil -{{endif}} - -{{if 'nvrtcAddNameExpression' in found_functions}} - -cdef nvrtcResult nvrtcAddNameExpression(nvrtcProgram prog, const char* name_expression) except ?NVRTC_ERROR_INVALID_INPUT nogil -{{endif}} - -{{if 'nvrtcGetLoweredName' in found_functions}} - -cdef nvrtcResult nvrtcGetLoweredName(nvrtcProgram prog, const char* name_expression, const char** lowered_name) except ?NVRTC_ERROR_INVALID_INPUT nogil -{{endif}} - diff --git a/cuda/cnvrtc.pyx.in b/cuda/cnvrtc.pyx.in deleted file mode 100644 index 9781b65fd8f..00000000000 --- a/cuda/cnvrtc.pyx.in +++ /dev/null @@ -1,134 +0,0 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. -# -# Please refer to the NVIDIA end user license agreement (EULA) associated -# with this source code for terms and conditions that govern your use of -# this software. Any use, reproduction, disclosure, or distribution of -# this software and related documentation outside the terms of the EULA -# is strictly prohibited. -cimport cuda._cuda.cnvrtc as cnvrtc - -{{if 'nvrtcGetErrorString' in found_functions}} - -cdef const char* nvrtcGetErrorString(nvrtcResult result) except ?NULL nogil: - return cnvrtc._nvrtcGetErrorString(result) -{{endif}} - -{{if 'nvrtcVersion' in found_functions}} - -cdef nvrtcResult nvrtcVersion(int* major, int* minor) except ?NVRTC_ERROR_INVALID_INPUT nogil: - return cnvrtc._nvrtcVersion(major, minor) -{{endif}} - -{{if 'nvrtcGetNumSupportedArchs' in found_functions}} - -cdef nvrtcResult nvrtcGetNumSupportedArchs(int* numArchs) except ?NVRTC_ERROR_INVALID_INPUT nogil: - return cnvrtc._nvrtcGetNumSupportedArchs(numArchs) -{{endif}} - -{{if 'nvrtcGetSupportedArchs' in found_functions}} - -cdef nvrtcResult nvrtcGetSupportedArchs(int* supportedArchs) except ?NVRTC_ERROR_INVALID_INPUT nogil: - return cnvrtc._nvrtcGetSupportedArchs(supportedArchs) -{{endif}} - -{{if 'nvrtcCreateProgram' in found_functions}} - -cdef nvrtcResult nvrtcCreateProgram(nvrtcProgram* prog, const char* src, const char* name, int numHeaders, const char** headers, const char** includeNames) except ?NVRTC_ERROR_INVALID_INPUT nogil: - return cnvrtc._nvrtcCreateProgram(prog, src, name, numHeaders, headers, includeNames) -{{endif}} - -{{if 'nvrtcDestroyProgram' in found_functions}} - -cdef nvrtcResult nvrtcDestroyProgram(nvrtcProgram* prog) except ?NVRTC_ERROR_INVALID_INPUT nogil: - return cnvrtc._nvrtcDestroyProgram(prog) -{{endif}} - -{{if 'nvrtcCompileProgram' in found_functions}} - -cdef nvrtcResult nvrtcCompileProgram(nvrtcProgram prog, int numOptions, const char** options) except ?NVRTC_ERROR_INVALID_INPUT nogil: - return cnvrtc._nvrtcCompileProgram(prog, numOptions, options) -{{endif}} - -{{if 'nvrtcGetPTXSize' in found_functions}} - -cdef nvrtcResult nvrtcGetPTXSize(nvrtcProgram prog, size_t* ptxSizeRet) except ?NVRTC_ERROR_INVALID_INPUT nogil: - return cnvrtc._nvrtcGetPTXSize(prog, ptxSizeRet) -{{endif}} - -{{if 'nvrtcGetPTX' in found_functions}} - -cdef nvrtcResult nvrtcGetPTX(nvrtcProgram prog, char* ptx) except ?NVRTC_ERROR_INVALID_INPUT nogil: - return cnvrtc._nvrtcGetPTX(prog, ptx) -{{endif}} - -{{if 'nvrtcGetCUBINSize' in found_functions}} - -cdef nvrtcResult nvrtcGetCUBINSize(nvrtcProgram prog, size_t* cubinSizeRet) except ?NVRTC_ERROR_INVALID_INPUT nogil: - return cnvrtc._nvrtcGetCUBINSize(prog, cubinSizeRet) -{{endif}} - -{{if 'nvrtcGetCUBIN' in found_functions}} - -cdef nvrtcResult nvrtcGetCUBIN(nvrtcProgram prog, char* cubin) except ?NVRTC_ERROR_INVALID_INPUT nogil: - return cnvrtc._nvrtcGetCUBIN(prog, cubin) -{{endif}} - -{{if 'nvrtcGetNVVMSize' in found_functions}} - -cdef nvrtcResult nvrtcGetNVVMSize(nvrtcProgram prog, size_t* nvvmSizeRet) except ?NVRTC_ERROR_INVALID_INPUT nogil: - return cnvrtc._nvrtcGetNVVMSize(prog, nvvmSizeRet) -{{endif}} - -{{if 'nvrtcGetNVVM' in found_functions}} - -cdef nvrtcResult nvrtcGetNVVM(nvrtcProgram prog, char* nvvm) except ?NVRTC_ERROR_INVALID_INPUT nogil: - return cnvrtc._nvrtcGetNVVM(prog, nvvm) -{{endif}} - -{{if 'nvrtcGetLTOIRSize' in found_functions}} - -cdef nvrtcResult nvrtcGetLTOIRSize(nvrtcProgram prog, size_t* LTOIRSizeRet) except ?NVRTC_ERROR_INVALID_INPUT nogil: - return cnvrtc._nvrtcGetLTOIRSize(prog, LTOIRSizeRet) -{{endif}} - -{{if 'nvrtcGetLTOIR' in found_functions}} - -cdef nvrtcResult nvrtcGetLTOIR(nvrtcProgram prog, char* LTOIR) except ?NVRTC_ERROR_INVALID_INPUT nogil: - return cnvrtc._nvrtcGetLTOIR(prog, LTOIR) -{{endif}} - -{{if 'nvrtcGetOptiXIRSize' in found_functions}} - -cdef nvrtcResult nvrtcGetOptiXIRSize(nvrtcProgram prog, size_t* optixirSizeRet) except ?NVRTC_ERROR_INVALID_INPUT nogil: - return cnvrtc._nvrtcGetOptiXIRSize(prog, optixirSizeRet) -{{endif}} - -{{if 'nvrtcGetOptiXIR' in found_functions}} - -cdef nvrtcResult nvrtcGetOptiXIR(nvrtcProgram prog, char* optixir) except ?NVRTC_ERROR_INVALID_INPUT nogil: - return cnvrtc._nvrtcGetOptiXIR(prog, optixir) -{{endif}} - -{{if 'nvrtcGetProgramLogSize' in found_functions}} - -cdef nvrtcResult nvrtcGetProgramLogSize(nvrtcProgram prog, size_t* logSizeRet) except ?NVRTC_ERROR_INVALID_INPUT nogil: - return cnvrtc._nvrtcGetProgramLogSize(prog, logSizeRet) -{{endif}} - -{{if 'nvrtcGetProgramLog' in found_functions}} - -cdef nvrtcResult nvrtcGetProgramLog(nvrtcProgram prog, char* log) except ?NVRTC_ERROR_INVALID_INPUT nogil: - return cnvrtc._nvrtcGetProgramLog(prog, log) -{{endif}} - -{{if 'nvrtcAddNameExpression' in found_functions}} - -cdef nvrtcResult nvrtcAddNameExpression(nvrtcProgram prog, const char* name_expression) except ?NVRTC_ERROR_INVALID_INPUT nogil: - return cnvrtc._nvrtcAddNameExpression(prog, name_expression) -{{endif}} - -{{if 'nvrtcGetLoweredName' in found_functions}} - -cdef nvrtcResult nvrtcGetLoweredName(nvrtcProgram prog, const char* name_expression, const char** lowered_name) except ?NVRTC_ERROR_INVALID_INPUT nogil: - return cnvrtc._nvrtcGetLoweredName(prog, name_expression, lowered_name) -{{endif}} diff --git a/cuda/nvrtc.pxd.in b/cuda/nvrtc.pxd.in deleted file mode 100644 index 10731987b8b..00000000000 --- a/cuda/nvrtc.pxd.in +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. -# -# Please refer to the NVIDIA end user license agreement (EULA) associated -# with this source code for terms and conditions that govern your use of -# this software. Any use, reproduction, disclosure, or distribution of -# this software and related documentation outside the terms of the EULA -# is strictly prohibited. -cimport cuda.cnvrtc as cnvrtc -cimport cuda._lib.utils as utils - -{{if 'nvrtcProgram' in found_types}} - -cdef class nvrtcProgram: - """ nvrtcProgram is the unit of compilation, and an opaque handle for a program. - - To compile a CUDA program string, an instance of nvrtcProgram must be created first with nvrtcCreateProgram, then compiled with nvrtcCompileProgram. - - Methods - ------- - getPtr() - Get memory address of class instance - - """ - cdef cnvrtc.nvrtcProgram __val - cdef cnvrtc.nvrtcProgram* _ptr -{{endif}} diff --git a/cuda/nvrtc.pyx.in b/cuda/nvrtc.pyx.in deleted file mode 100644 index bf8b2ca772d..00000000000 --- a/cuda/nvrtc.pyx.in +++ /dev/null @@ -1,873 +0,0 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. -# -# Please refer to the NVIDIA end user license agreement (EULA) associated -# with this source code for terms and conditions that govern your use of -# this software. Any use, reproduction, disclosure, or distribution of -# this software and related documentation outside the terms of the EULA -# is strictly prohibited. -from typing import List, Tuple, Any, Optional -from enum import IntEnum -import cython -import ctypes -from libc.stdlib cimport calloc, free -from libc cimport string -from libc.stdint cimport int32_t, uint32_t, int64_t, uint64_t -from libc.stddef cimport wchar_t -from libc.limits cimport CHAR_MIN -from libcpp.vector cimport vector -from cpython.buffer cimport PyObject_CheckBuffer, PyObject_GetBuffer, PyBuffer_Release, PyBUF_SIMPLE, PyBUF_ANY_CONTIGUOUS -from cpython.bytes cimport PyBytes_FromStringAndSize - -ctypedef unsigned long long signed_char_ptr -ctypedef unsigned long long unsigned_char_ptr -ctypedef unsigned long long char_ptr -ctypedef unsigned long long short_ptr -ctypedef unsigned long long unsigned_short_ptr -ctypedef unsigned long long int_ptr -ctypedef unsigned long long long_int_ptr -ctypedef unsigned long long long_long_int_ptr -ctypedef unsigned long long unsigned_int_ptr -ctypedef unsigned long long unsigned_long_int_ptr -ctypedef unsigned long long unsigned_long_long_int_ptr -ctypedef unsigned long long uint32_t_ptr -ctypedef unsigned long long uint64_t_ptr -ctypedef unsigned long long int32_t_ptr -ctypedef unsigned long long int64_t_ptr -ctypedef unsigned long long unsigned_ptr -ctypedef unsigned long long unsigned_long_long_ptr -ctypedef unsigned long long long_long_ptr -ctypedef unsigned long long size_t_ptr -ctypedef unsigned long long float_ptr -ctypedef unsigned long long double_ptr -ctypedef unsigned long long void_ptr - - -{{if 'nvrtcResult' in found_types}} - -class nvrtcResult(IntEnum): - """ - The enumerated type nvrtcResult defines API call result codes. - NVRTC API functions return nvrtcResult to indicate the call result. - """ - {{if 'NVRTC_SUCCESS' in found_values}} - NVRTC_SUCCESS = cnvrtc.nvrtcResult.NVRTC_SUCCESS{{endif}} - {{if 'NVRTC_ERROR_OUT_OF_MEMORY' in found_values}} - NVRTC_ERROR_OUT_OF_MEMORY = cnvrtc.nvrtcResult.NVRTC_ERROR_OUT_OF_MEMORY{{endif}} - {{if 'NVRTC_ERROR_PROGRAM_CREATION_FAILURE' in found_values}} - NVRTC_ERROR_PROGRAM_CREATION_FAILURE = cnvrtc.nvrtcResult.NVRTC_ERROR_PROGRAM_CREATION_FAILURE{{endif}} - {{if 'NVRTC_ERROR_INVALID_INPUT' in found_values}} - NVRTC_ERROR_INVALID_INPUT = cnvrtc.nvrtcResult.NVRTC_ERROR_INVALID_INPUT{{endif}} - {{if 'NVRTC_ERROR_INVALID_PROGRAM' in found_values}} - NVRTC_ERROR_INVALID_PROGRAM = cnvrtc.nvrtcResult.NVRTC_ERROR_INVALID_PROGRAM{{endif}} - {{if 'NVRTC_ERROR_INVALID_OPTION' in found_values}} - NVRTC_ERROR_INVALID_OPTION = cnvrtc.nvrtcResult.NVRTC_ERROR_INVALID_OPTION{{endif}} - {{if 'NVRTC_ERROR_COMPILATION' in found_values}} - NVRTC_ERROR_COMPILATION = cnvrtc.nvrtcResult.NVRTC_ERROR_COMPILATION{{endif}} - {{if 'NVRTC_ERROR_BUILTIN_OPERATION_FAILURE' in found_values}} - NVRTC_ERROR_BUILTIN_OPERATION_FAILURE = cnvrtc.nvrtcResult.NVRTC_ERROR_BUILTIN_OPERATION_FAILURE{{endif}} - {{if 'NVRTC_ERROR_NO_NAME_EXPRESSIONS_AFTER_COMPILATION' in found_values}} - NVRTC_ERROR_NO_NAME_EXPRESSIONS_AFTER_COMPILATION = cnvrtc.nvrtcResult.NVRTC_ERROR_NO_NAME_EXPRESSIONS_AFTER_COMPILATION{{endif}} - {{if 'NVRTC_ERROR_NO_LOWERED_NAMES_BEFORE_COMPILATION' in found_values}} - NVRTC_ERROR_NO_LOWERED_NAMES_BEFORE_COMPILATION = cnvrtc.nvrtcResult.NVRTC_ERROR_NO_LOWERED_NAMES_BEFORE_COMPILATION{{endif}} - {{if 'NVRTC_ERROR_NAME_EXPRESSION_NOT_VALID' in found_values}} - NVRTC_ERROR_NAME_EXPRESSION_NOT_VALID = cnvrtc.nvrtcResult.NVRTC_ERROR_NAME_EXPRESSION_NOT_VALID{{endif}} - {{if 'NVRTC_ERROR_INTERNAL_ERROR' in found_values}} - NVRTC_ERROR_INTERNAL_ERROR = cnvrtc.nvrtcResult.NVRTC_ERROR_INTERNAL_ERROR{{endif}} - {{if 'NVRTC_ERROR_TIME_FILE_WRITE_FAILED' in found_values}} - NVRTC_ERROR_TIME_FILE_WRITE_FAILED = cnvrtc.nvrtcResult.NVRTC_ERROR_TIME_FILE_WRITE_FAILED{{endif}} -{{endif}} -{{if 'nvrtcProgram' in found_types}} - -cdef class nvrtcProgram: - """ nvrtcProgram is the unit of compilation, and an opaque handle for a program. - - To compile a CUDA program string, an instance of nvrtcProgram must be created first with nvrtcCreateProgram, then compiled with nvrtcCompileProgram. - - Methods - ------- - getPtr() - Get memory address of class instance - - """ - def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - self._ptr[0] = init_value - else: - self._ptr = _ptr - def __init__(self, *args, **kwargs): - pass - def __repr__(self): - return '' - def __index__(self): - return self.__int__() - def __int__(self): - return self._ptr[0] - def getPtr(self): - return self._ptr -{{endif}} - -{{if 'nvrtcGetErrorString' in found_functions}} - -@cython.embedsignature(True) -def nvrtcGetErrorString(result not None : nvrtcResult): - """ nvrtcGetErrorString is a helper function that returns a string describing the given nvrtcResult code, e.g., NVRTC_SUCCESS to `"NVRTC_SUCCESS"`. For unrecognized enumeration values, it returns `"NVRTC_ERROR unknown"`. - - Parameters - ---------- - result : :py:obj:`~.nvrtcResult` - CUDA Runtime Compilation API result code. - - Returns - ------- - nvrtcResult.NVRTC_SUCCESS - nvrtcResult.NVRTC_SUCCESS - bytes - Message string for the given :py:obj:`~.nvrtcResult` code. - """ - cdef cnvrtc.nvrtcResult cresult = result.value - err = cnvrtc.nvrtcGetErrorString(cresult) - return (nvrtcResult.NVRTC_SUCCESS, err) -{{endif}} - -{{if 'nvrtcVersion' in found_functions}} - -@cython.embedsignature(True) -def nvrtcVersion(): - """ nvrtcVersion sets the output parameters `major` and `minor` with the CUDA Runtime Compilation version number. - - Returns - ------- - nvrtcResult - - :py:obj:`~.NVRTC_SUCCESS` - - :py:obj:`~.NVRTC_ERROR_INVALID_INPUT` - major : int - CUDA Runtime Compilation major version number. - minor : int - CUDA Runtime Compilation minor version number. - """ - cdef int major = 0 - cdef int minor = 0 - err = cnvrtc.nvrtcVersion(&major, &minor) - return (nvrtcResult(err), major, minor) -{{endif}} - -{{if 'nvrtcGetNumSupportedArchs' in found_functions}} - -@cython.embedsignature(True) -def nvrtcGetNumSupportedArchs(): - """ nvrtcGetNumSupportedArchs sets the output parameter `numArchs` with the number of architectures supported by NVRTC. This can then be used to pass an array to :py:obj:`~.nvrtcGetSupportedArchs` to get the supported architectures. - - see :py:obj:`~.nvrtcGetSupportedArchs` - - Returns - ------- - nvrtcResult - - :py:obj:`~.NVRTC_SUCCESS` - - :py:obj:`~.NVRTC_ERROR_INVALID_INPUT` - numArchs : int - number of supported architectures. - """ - cdef int numArchs = 0 - err = cnvrtc.nvrtcGetNumSupportedArchs(&numArchs) - return (nvrtcResult(err), numArchs) -{{endif}} - -{{if 'nvrtcGetSupportedArchs' in found_functions}} - -@cython.embedsignature(True) -def nvrtcGetSupportedArchs(): - """ nvrtcGetSupportedArchs populates the array passed via the output parameter `supportedArchs` with the architectures supported by NVRTC. The array is sorted in the ascending order. The size of the array to be passed can be determined using :py:obj:`~.nvrtcGetNumSupportedArchs`. - - see :py:obj:`~.nvrtcGetNumSupportedArchs` - - Returns - ------- - nvrtcResult - - :py:obj:`~.NVRTC_SUCCESS` - - :py:obj:`~.NVRTC_ERROR_INVALID_INPUT` - supportedArchs : List[int] - sorted array of supported architectures. - """ - cdef vector[int] supportedArchs - _, s = nvrtcGetNumSupportedArchs() - supportedArchs.resize(s) - - err = cnvrtc.nvrtcGetSupportedArchs(supportedArchs.data()) - return (nvrtcResult(err), supportedArchs) -{{endif}} - -{{if 'nvrtcCreateProgram' in found_functions}} - -@cython.embedsignature(True) -def nvrtcCreateProgram(char* src, char* name, int numHeaders, list headers, list includeNames): - """ nvrtcCreateProgram creates an instance of nvrtcProgram with the given input parameters, and sets the output parameter `prog` with it. - - Parameters - ---------- - src : bytes - CUDA program source. - name : bytes - CUDA program name. `name` can be `NULL`; `"default_program"` is - used when `name` is `NULL` or "". - numHeaders : int - Number of headers used. `numHeaders` must be greater than or equal - to 0. - headers : List[bytes] - Sources of the headers. `headers` can be `NULL` when `numHeaders` - is 0. - includeNames : List[bytes] - Name of each header by which they can be included in the CUDA - program source. `includeNames` can be `NULL` when `numHeaders` is - 0. These headers must be included with the exact names specified - here. - - Returns - ------- - nvrtcResult - - :py:obj:`~.NVRTC_SUCCESS` - - :py:obj:`~.NVRTC_ERROR_OUT_OF_MEMORY` - - :py:obj:`~.NVRTC_ERROR_PROGRAM_CREATION_FAILURE` - - :py:obj:`~.NVRTC_ERROR_INVALID_INPUT` - - :py:obj:`~.NVRTC_ERROR_INVALID_PROGRAM` - prog : :py:obj:`~.nvrtcProgram` - CUDA Runtime Compilation program. - - See Also - -------- - :py:obj:`~.nvrtcDestroyProgram` - """ - cdef nvrtcProgram prog = nvrtcProgram() - if numHeaders > len(headers): raise RuntimeError("List is too small: " + str(len(headers)) + " < " + str(numHeaders)) - if numHeaders > len(includeNames): raise RuntimeError("List is too small: " + str(len(includeNames)) + " < " + str(numHeaders)) - cdef vector[const char*] cheaders = headers - cdef vector[const char*] cincludeNames = includeNames - err = cnvrtc.nvrtcCreateProgram(prog._ptr, src, name, numHeaders, cheaders.data(), cincludeNames.data()) - return (nvrtcResult(err), prog) -{{endif}} - -{{if 'nvrtcDestroyProgram' in found_functions}} - -@cython.embedsignature(True) -def nvrtcDestroyProgram(prog): - """ nvrtcDestroyProgram destroys the given program. - - Parameters - ---------- - prog : :py:obj:`~.nvrtcProgram` - CUDA Runtime Compilation program. - - Returns - ------- - nvrtcResult - - :py:obj:`~.NVRTC_SUCCESS` - - :py:obj:`~.NVRTC_ERROR_INVALID_PROGRAM` - - See Also - -------- - :py:obj:`~.nvrtcCreateProgram` - """ - cdef cnvrtc.nvrtcProgram *cprog - if prog is None: - cprog = NULL - elif isinstance(prog, (nvrtcProgram,)): - pprog = prog.getPtr() - cprog = pprog - elif isinstance(prog, (int)): - cprog = prog - else: - raise TypeError("Argument 'prog' is not instance of type (expected , found " + str(type(prog))) - err = cnvrtc.nvrtcDestroyProgram(cprog) - return (nvrtcResult(err),) -{{endif}} - -{{if 'nvrtcCompileProgram' in found_functions}} - -@cython.embedsignature(True) -def nvrtcCompileProgram(prog, int numOptions, list options): - """ nvrtcCompileProgram compiles the given program. - - It supports compile options listed in :py:obj:`~.Supported Compile - Options`. - - Parameters - ---------- - prog : :py:obj:`~.nvrtcProgram` - CUDA Runtime Compilation program. - numOptions : int - Number of compiler options passed. - options : List[bytes] - Compiler options in the form of C string array. `options` can be - `NULL` when `numOptions` is 0. - - Returns - ------- - nvrtcResult - - :py:obj:`~.NVRTC_SUCCESS` - - :py:obj:`~.NVRTC_ERROR_OUT_OF_MEMORY` - - :py:obj:`~.NVRTC_ERROR_INVALID_INPUT` - - :py:obj:`~.NVRTC_ERROR_INVALID_PROGRAM` - - :py:obj:`~.NVRTC_ERROR_INVALID_OPTION` - - :py:obj:`~.NVRTC_ERROR_COMPILATION` - - :py:obj:`~.NVRTC_ERROR_BUILTIN_OPERATION_FAILURE` - - :py:obj:`~.NVRTC_ERROR_TIME_FILE_WRITE_FAILED` - """ - cdef cnvrtc.nvrtcProgram cprog - if prog is None: - cprog = 0 - elif isinstance(prog, (nvrtcProgram,)): - pprog = int(prog) - cprog = pprog - else: - pprog = int(nvrtcProgram(prog)) - cprog = pprog - if numOptions > len(options): raise RuntimeError("List is too small: " + str(len(options)) + " < " + str(numOptions)) - cdef vector[const char*] coptions = options - err = cnvrtc.nvrtcCompileProgram(cprog, numOptions, coptions.data()) - return (nvrtcResult(err),) -{{endif}} - -{{if 'nvrtcGetPTXSize' in found_functions}} - -@cython.embedsignature(True) -def nvrtcGetPTXSize(prog): - """ nvrtcGetPTXSize sets the value of `ptxSizeRet` with the size of the PTX generated by the previous compilation of `prog` (including the trailing `NULL`). - - Parameters - ---------- - prog : :py:obj:`~.nvrtcProgram` - CUDA Runtime Compilation program. - - Returns - ------- - nvrtcResult - - :py:obj:`~.NVRTC_SUCCESS` - - :py:obj:`~.NVRTC_ERROR_INVALID_INPUT` - - :py:obj:`~.NVRTC_ERROR_INVALID_PROGRAM` - ptxSizeRet : int - Size of the generated PTX (including the trailing `NULL`). - - See Also - -------- - :py:obj:`~.nvrtcGetPTX` - """ - cdef cnvrtc.nvrtcProgram cprog - if prog is None: - cprog = 0 - elif isinstance(prog, (nvrtcProgram,)): - pprog = int(prog) - cprog = pprog - else: - pprog = int(nvrtcProgram(prog)) - cprog = pprog - cdef size_t ptxSizeRet = 0 - err = cnvrtc.nvrtcGetPTXSize(cprog, &ptxSizeRet) - return (nvrtcResult(err), ptxSizeRet) -{{endif}} - -{{if 'nvrtcGetPTX' in found_functions}} - -@cython.embedsignature(True) -def nvrtcGetPTX(prog, char* ptx): - """ nvrtcGetPTX stores the PTX generated by the previous compilation of `prog` in the memory pointed by `ptx`. - - Parameters - ---------- - prog : :py:obj:`~.nvrtcProgram` - CUDA Runtime Compilation program. - ptx : bytes - Compiled result. - - Returns - ------- - nvrtcResult - - :py:obj:`~.NVRTC_SUCCESS` - - :py:obj:`~.NVRTC_ERROR_INVALID_INPUT` - - :py:obj:`~.NVRTC_ERROR_INVALID_PROGRAM` - - See Also - -------- - :py:obj:`~.nvrtcGetPTXSize` - """ - cdef cnvrtc.nvrtcProgram cprog - if prog is None: - cprog = 0 - elif isinstance(prog, (nvrtcProgram,)): - pprog = int(prog) - cprog = pprog - else: - pprog = int(nvrtcProgram(prog)) - cprog = pprog - err = cnvrtc.nvrtcGetPTX(cprog, ptx) - return (nvrtcResult(err),) -{{endif}} - -{{if 'nvrtcGetCUBINSize' in found_functions}} - -@cython.embedsignature(True) -def nvrtcGetCUBINSize(prog): - """ nvrtcGetCUBINSize sets the value of `cubinSizeRet` with the size of the cubin generated by the previous compilation of `prog`. The value of cubinSizeRet is set to 0 if the value specified to `-arch` is a virtual architecture instead of an actual architecture. - - Parameters - ---------- - prog : :py:obj:`~.nvrtcProgram` - CUDA Runtime Compilation program. - - Returns - ------- - nvrtcResult - - :py:obj:`~.NVRTC_SUCCESS` - - :py:obj:`~.NVRTC_ERROR_INVALID_INPUT` - - :py:obj:`~.NVRTC_ERROR_INVALID_PROGRAM` - cubinSizeRet : int - Size of the generated cubin. - - See Also - -------- - :py:obj:`~.nvrtcGetCUBIN` - """ - cdef cnvrtc.nvrtcProgram cprog - if prog is None: - cprog = 0 - elif isinstance(prog, (nvrtcProgram,)): - pprog = int(prog) - cprog = pprog - else: - pprog = int(nvrtcProgram(prog)) - cprog = pprog - cdef size_t cubinSizeRet = 0 - err = cnvrtc.nvrtcGetCUBINSize(cprog, &cubinSizeRet) - return (nvrtcResult(err), cubinSizeRet) -{{endif}} - -{{if 'nvrtcGetCUBIN' in found_functions}} - -@cython.embedsignature(True) -def nvrtcGetCUBIN(prog, char* cubin): - """ nvrtcGetCUBIN stores the cubin generated by the previous compilation of `prog` in the memory pointed by `cubin`. No cubin is available if the value specified to `-arch` is a virtual architecture instead of an actual architecture. - - Parameters - ---------- - prog : :py:obj:`~.nvrtcProgram` - CUDA Runtime Compilation program. - cubin : bytes - Compiled and assembled result. - - Returns - ------- - nvrtcResult - - :py:obj:`~.NVRTC_SUCCESS` - - :py:obj:`~.NVRTC_ERROR_INVALID_INPUT` - - :py:obj:`~.NVRTC_ERROR_INVALID_PROGRAM` - - See Also - -------- - :py:obj:`~.nvrtcGetCUBINSize` - """ - cdef cnvrtc.nvrtcProgram cprog - if prog is None: - cprog = 0 - elif isinstance(prog, (nvrtcProgram,)): - pprog = int(prog) - cprog = pprog - else: - pprog = int(nvrtcProgram(prog)) - cprog = pprog - err = cnvrtc.nvrtcGetCUBIN(cprog, cubin) - return (nvrtcResult(err),) -{{endif}} - -{{if 'nvrtcGetNVVMSize' in found_functions}} - -@cython.embedsignature(True) -def nvrtcGetNVVMSize(prog): - """ DEPRECATION NOTICE: This function will be removed in a future release. Please use nvrtcGetLTOIRSize (and nvrtcGetLTOIR) instead. - - Parameters - ---------- - prog : :py:obj:`~.nvrtcProgram` - None - - Returns - ------- - nvrtcResult - - nvvmSizeRet : int - None - """ - cdef cnvrtc.nvrtcProgram cprog - if prog is None: - cprog = 0 - elif isinstance(prog, (nvrtcProgram,)): - pprog = int(prog) - cprog = pprog - else: - pprog = int(nvrtcProgram(prog)) - cprog = pprog - cdef size_t nvvmSizeRet = 0 - err = cnvrtc.nvrtcGetNVVMSize(cprog, &nvvmSizeRet) - return (nvrtcResult(err), nvvmSizeRet) -{{endif}} - -{{if 'nvrtcGetNVVM' in found_functions}} - -@cython.embedsignature(True) -def nvrtcGetNVVM(prog, char* nvvm): - """ DEPRECATION NOTICE: This function will be removed in a future release. Please use nvrtcGetLTOIR (and nvrtcGetLTOIRSize) instead. - - Parameters - ---------- - prog : :py:obj:`~.nvrtcProgram` - None - nvvm : bytes - None - - Returns - ------- - nvrtcResult - - """ - cdef cnvrtc.nvrtcProgram cprog - if prog is None: - cprog = 0 - elif isinstance(prog, (nvrtcProgram,)): - pprog = int(prog) - cprog = pprog - else: - pprog = int(nvrtcProgram(prog)) - cprog = pprog - err = cnvrtc.nvrtcGetNVVM(cprog, nvvm) - return (nvrtcResult(err),) -{{endif}} - -{{if 'nvrtcGetLTOIRSize' in found_functions}} - -@cython.embedsignature(True) -def nvrtcGetLTOIRSize(prog): - """ nvrtcGetLTOIRSize sets the value of `LTOIRSizeRet` with the size of the LTO IR generated by the previous compilation of `prog`. The value of LTOIRSizeRet is set to 0 if the program was not compiled with `-dlto`. - - Parameters - ---------- - prog : :py:obj:`~.nvrtcProgram` - CUDA Runtime Compilation program. - - Returns - ------- - nvrtcResult - - :py:obj:`~.NVRTC_SUCCESS` - - :py:obj:`~.NVRTC_ERROR_INVALID_INPUT` - - :py:obj:`~.NVRTC_ERROR_INVALID_PROGRAM` - LTOIRSizeRet : int - Size of the generated LTO IR. - - See Also - -------- - :py:obj:`~.nvrtcGetLTOIR` - """ - cdef cnvrtc.nvrtcProgram cprog - if prog is None: - cprog = 0 - elif isinstance(prog, (nvrtcProgram,)): - pprog = int(prog) - cprog = pprog - else: - pprog = int(nvrtcProgram(prog)) - cprog = pprog - cdef size_t LTOIRSizeRet = 0 - err = cnvrtc.nvrtcGetLTOIRSize(cprog, <OIRSizeRet) - return (nvrtcResult(err), LTOIRSizeRet) -{{endif}} - -{{if 'nvrtcGetLTOIR' in found_functions}} - -@cython.embedsignature(True) -def nvrtcGetLTOIR(prog, char* LTOIR): - """ nvrtcGetLTOIR stores the LTO IR generated by the previous compilation of `prog` in the memory pointed by `LTOIR`. No LTO IR is available if the program was compiled without `-dlto`. - - Parameters - ---------- - prog : :py:obj:`~.nvrtcProgram` - CUDA Runtime Compilation program. - LTOIR : bytes - Compiled result. - - Returns - ------- - nvrtcResult - - :py:obj:`~.NVRTC_SUCCESS` - - :py:obj:`~.NVRTC_ERROR_INVALID_INPUT` - - :py:obj:`~.NVRTC_ERROR_INVALID_PROGRAM` - - See Also - -------- - :py:obj:`~.nvrtcGetLTOIRSize` - """ - cdef cnvrtc.nvrtcProgram cprog - if prog is None: - cprog = 0 - elif isinstance(prog, (nvrtcProgram,)): - pprog = int(prog) - cprog = pprog - else: - pprog = int(nvrtcProgram(prog)) - cprog = pprog - err = cnvrtc.nvrtcGetLTOIR(cprog, LTOIR) - return (nvrtcResult(err),) -{{endif}} - -{{if 'nvrtcGetOptiXIRSize' in found_functions}} - -@cython.embedsignature(True) -def nvrtcGetOptiXIRSize(prog): - """ nvrtcGetOptiXIRSize sets the value of `optixirSizeRet` with the size of the OptiX IR generated by the previous compilation of `prog`. The value of nvrtcGetOptiXIRSize is set to 0 if the program was compiled with options incompatible with OptiX IR generation. - - Parameters - ---------- - prog : :py:obj:`~.nvrtcProgram` - CUDA Runtime Compilation program. - - Returns - ------- - nvrtcResult - - :py:obj:`~.NVRTC_SUCCESS` - - :py:obj:`~.NVRTC_ERROR_INVALID_INPUT` - - :py:obj:`~.NVRTC_ERROR_INVALID_PROGRAM` - optixirSizeRet : int - Size of the generated LTO IR. - - See Also - -------- - :py:obj:`~.nvrtcGetOptiXIR` - """ - cdef cnvrtc.nvrtcProgram cprog - if prog is None: - cprog = 0 - elif isinstance(prog, (nvrtcProgram,)): - pprog = int(prog) - cprog = pprog - else: - pprog = int(nvrtcProgram(prog)) - cprog = pprog - cdef size_t optixirSizeRet = 0 - err = cnvrtc.nvrtcGetOptiXIRSize(cprog, &optixirSizeRet) - return (nvrtcResult(err), optixirSizeRet) -{{endif}} - -{{if 'nvrtcGetOptiXIR' in found_functions}} - -@cython.embedsignature(True) -def nvrtcGetOptiXIR(prog, char* optixir): - """ nvrtcGetOptiXIR stores the OptiX IR generated by the previous compilation of `prog` in the memory pointed by `optixir`. No OptiX IR is available if the program was compiled with options incompatible with OptiX IR generation. - - Parameters - ---------- - prog : :py:obj:`~.nvrtcProgram` - CUDA Runtime Compilation program. - Optix : bytes - IR Compiled result. - - Returns - ------- - nvrtcResult - - :py:obj:`~.NVRTC_SUCCESS` - - :py:obj:`~.NVRTC_ERROR_INVALID_INPUT` - - :py:obj:`~.NVRTC_ERROR_INVALID_PROGRAM` - - See Also - -------- - :py:obj:`~.nvrtcGetOptiXIRSize` - """ - cdef cnvrtc.nvrtcProgram cprog - if prog is None: - cprog = 0 - elif isinstance(prog, (nvrtcProgram,)): - pprog = int(prog) - cprog = pprog - else: - pprog = int(nvrtcProgram(prog)) - cprog = pprog - err = cnvrtc.nvrtcGetOptiXIR(cprog, optixir) - return (nvrtcResult(err),) -{{endif}} - -{{if 'nvrtcGetProgramLogSize' in found_functions}} - -@cython.embedsignature(True) -def nvrtcGetProgramLogSize(prog): - """ nvrtcGetProgramLogSize sets `logSizeRet` with the size of the log generated by the previous compilation of `prog` (including the trailing `NULL`). - - Note that compilation log may be generated with warnings and - informative messages, even when the compilation of `prog` succeeds. - - Parameters - ---------- - prog : :py:obj:`~.nvrtcProgram` - CUDA Runtime Compilation program. - - Returns - ------- - nvrtcResult - - :py:obj:`~.NVRTC_SUCCESS` - - :py:obj:`~.NVRTC_ERROR_INVALID_INPUT` - - :py:obj:`~.NVRTC_ERROR_INVALID_PROGRAM` - logSizeRet : int - Size of the compilation log (including the trailing `NULL`). - - See Also - -------- - :py:obj:`~.nvrtcGetProgramLog` - """ - cdef cnvrtc.nvrtcProgram cprog - if prog is None: - cprog = 0 - elif isinstance(prog, (nvrtcProgram,)): - pprog = int(prog) - cprog = pprog - else: - pprog = int(nvrtcProgram(prog)) - cprog = pprog - cdef size_t logSizeRet = 0 - err = cnvrtc.nvrtcGetProgramLogSize(cprog, &logSizeRet) - return (nvrtcResult(err), logSizeRet) -{{endif}} - -{{if 'nvrtcGetProgramLog' in found_functions}} - -@cython.embedsignature(True) -def nvrtcGetProgramLog(prog, char* log): - """ nvrtcGetProgramLog stores the log generated by the previous compilation of `prog` in the memory pointed by `log`. - - Parameters - ---------- - prog : :py:obj:`~.nvrtcProgram` - CUDA Runtime Compilation program. - log : bytes - Compilation log. - - Returns - ------- - nvrtcResult - - :py:obj:`~.NVRTC_SUCCESS` - - :py:obj:`~.NVRTC_ERROR_INVALID_INPUT` - - :py:obj:`~.NVRTC_ERROR_INVALID_PROGRAM` - - See Also - -------- - :py:obj:`~.nvrtcGetProgramLogSize` - """ - cdef cnvrtc.nvrtcProgram cprog - if prog is None: - cprog = 0 - elif isinstance(prog, (nvrtcProgram,)): - pprog = int(prog) - cprog = pprog - else: - pprog = int(nvrtcProgram(prog)) - cprog = pprog - err = cnvrtc.nvrtcGetProgramLog(cprog, log) - return (nvrtcResult(err),) -{{endif}} - -{{if 'nvrtcAddNameExpression' in found_functions}} - -@cython.embedsignature(True) -def nvrtcAddNameExpression(prog, char* name_expression): - """ nvrtcAddNameExpression notes the given name expression denoting the address of a global function or device/__constant__ variable. - - The identical name expression string must be provided on a subsequent - call to nvrtcGetLoweredName to extract the lowered name. - - Parameters - ---------- - prog : :py:obj:`~.nvrtcProgram` - CUDA Runtime Compilation program. - name_expression : bytes - constant expression denoting the address of a global function or - device/__constant__ variable. - - Returns - ------- - nvrtcResult - - :py:obj:`~.NVRTC_SUCCESS` - - :py:obj:`~.NVRTC_ERROR_INVALID_PROGRAM` - - :py:obj:`~.NVRTC_ERROR_INVALID_INPUT` - - :py:obj:`~.NVRTC_ERROR_NO_NAME_EXPRESSIONS_AFTER_COMPILATION` - - See Also - -------- - :py:obj:`~.nvrtcGetLoweredName` - """ - cdef cnvrtc.nvrtcProgram cprog - if prog is None: - cprog = 0 - elif isinstance(prog, (nvrtcProgram,)): - pprog = int(prog) - cprog = pprog - else: - pprog = int(nvrtcProgram(prog)) - cprog = pprog - err = cnvrtc.nvrtcAddNameExpression(cprog, name_expression) - return (nvrtcResult(err),) -{{endif}} - -{{if 'nvrtcGetLoweredName' in found_functions}} - -@cython.embedsignature(True) -def nvrtcGetLoweredName(prog, char* name_expression): - """ nvrtcGetLoweredName extracts the lowered (mangled) name for a global function or device/__constant__ variable, and updates lowered_name to point to it. The memory containing the name is released when the NVRTC program is destroyed by nvrtcDestroyProgram. The identical name expression must have been previously provided to nvrtcAddNameExpression. - - Parameters - ---------- - prog : nvrtcProgram - CUDA Runtime Compilation program. - name_expression : bytes - constant expression denoting the address of a global function or - device/__constant__ variable. - - Returns - ------- - nvrtcResult - NVRTC_SUCCESS - NVRTC_ERROR_NO_LOWERED_NAMES_BEFORE_COMPILATION - NVRTC_ERROR_NAME_EXPRESSION_NOT_VALID - lowered_name : bytes - initialized by the function to point to a C string containing the - lowered (mangled) name corresponding to the provided name - expression. - - See Also - -------- - nvrtcAddNameExpression - """ - cdef cnvrtc.nvrtcProgram cprog - if prog is None: - cprog = 0 - elif isinstance(prog, (nvrtcProgram,)): - pprog = int(prog) - cprog = pprog - else: - pprog = int(nvrtcProgram(prog)) - cprog = pprog - cdef const char* lowered_name = NULL - err = cnvrtc.nvrtcGetLoweredName(cprog, name_expression, &lowered_name) - return (nvrtcResult(err), lowered_name) -{{endif}} - -@cython.embedsignature(True) -def sizeof(objType): - """ Returns the size of provided CUDA Python structure in bytes - - Parameters - ---------- - objType : Any - CUDA Python object - - Returns - ------- - lowered_name : int - The size of `objType` in bytes - """ - {{if 'nvrtcProgram' in found_types}} - if objType == nvrtcProgram: - return sizeof(cnvrtc.nvrtcProgram){{endif}} - raise TypeError("Unknown type: " + str(objType)) \ No newline at end of file diff --git a/cuda/tests/test_cuda.py b/cuda/tests/test_cuda.py deleted file mode 100644 index d55a4209c73..00000000000 --- a/cuda/tests/test_cuda.py +++ /dev/null @@ -1,875 +0,0 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. -# -# Please refer to the NVIDIA end user license agreement (EULA) associated -# with this source code for terms and conditions that govern your use of -# this software. Any use, reproduction, disclosure, or distribution of -# this software and related documentation outside the terms of the EULA -# is strictly prohibited. -import platform -import pytest -import cuda.cuda as cuda -import cuda.cudart as cudart -import numpy as np -import textwrap -import shutil -from sysconfig import get_paths - -def driverVersionLessThan(target): - err, = cuda.cuInit(0) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, version = cuda.cuDriverGetVersion() - assert(err == cuda.CUresult.CUDA_SUCCESS) - return version < target - -def supportsMemoryPool(): - err, isSupported = cudart.cudaDeviceGetAttribute(cudart.cudaDeviceAttr.cudaDevAttrMemoryPoolsSupported, 0) - return err == cudart.cudaError_t.cudaSuccess and isSupported - -def supportsManagedMemory(): - err, isSupported = cudart.cudaDeviceGetAttribute(cudart.cudaDeviceAttr.cudaDevAttrManagedMemory, 0) - return err == cudart.cudaError_t.cudaSuccess and isSupported - -def supportsCudaAPI(name): - return name in dir(cuda) - -def callableBinary(name): - return shutil.which(name) != None - -def test_cuda_memcpy(): - # Init CUDA - err, = cuda.cuInit(0) - assert(err == cuda.CUresult.CUDA_SUCCESS) - - # Get device - err, device = cuda.cuDeviceGet(0) - assert(err == cuda.CUresult.CUDA_SUCCESS) - - # Construct context - err, ctx = cuda.cuCtxCreate(0, device) - assert(err == cuda.CUresult.CUDA_SUCCESS) - - # Allocate dev memory - size = int(1024 * np.uint8().itemsize) - err, dptr = cuda.cuMemAlloc(size) - assert(err == cuda.CUresult.CUDA_SUCCESS) - - # Set h1 and h2 memory to be different - h1 = np.full(size, 1).astype(np.uint8) - h2 = np.full(size, 2).astype(np.uint8) - assert(np.array_equal(h1, h2) is False) - - # h1 to D - err, = cuda.cuMemcpyHtoD(dptr, h1, size) - assert(err == cuda.CUresult.CUDA_SUCCESS) - - # D to h2 - err, = cuda.cuMemcpyDtoH(h2, dptr, size) - assert(err == cuda.CUresult.CUDA_SUCCESS) - - # Validate h1 == h2 - assert(np.array_equal(h1, h2)) - - # Cleanup - err, = cuda.cuMemFree(dptr) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, = cuda.cuCtxDestroy(ctx) - assert(err == cuda.CUresult.CUDA_SUCCESS) - -def test_cuda_array(): - err, = cuda.cuInit(0) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, device = cuda.cuDeviceGet(0) - assert(err == cuda.CUresult.CUDA_SUCCESS) - - # No context created - desc = cuda.CUDA_ARRAY_DESCRIPTOR() - err, arr = cuda.cuArrayCreate(desc) - assert(err == cuda.CUresult.CUDA_ERROR_INVALID_CONTEXT or err == cuda.CUresult.CUDA_ERROR_INVALID_VALUE) - - err, ctx = cuda.cuCtxCreate(0, device) - assert(err == cuda.CUresult.CUDA_SUCCESS) - - # Desciption not filled - err, arr = cuda.cuArrayCreate(desc) - assert(err == cuda.CUresult.CUDA_ERROR_INVALID_VALUE) - - # Pass - desc.Format = cuda.CUarray_format.CU_AD_FORMAT_SIGNED_INT8 - desc.NumChannels = 1 - desc.Width = 1 - err, arr = cuda.cuArrayCreate(desc) - assert(err == cuda.CUresult.CUDA_SUCCESS) - - err, = cuda.cuArrayDestroy(arr) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, = cuda.cuCtxDestroy(ctx) - assert(err == cuda.CUresult.CUDA_SUCCESS) - -def test_cuda_repr_primitive(): - err, = cuda.cuInit(0) - assert(err == cuda.CUresult.CUDA_SUCCESS) - - err, device = cuda.cuDeviceGet(0) - assert(err == cuda.CUresult.CUDA_SUCCESS) - assert(str(device) == '') - assert(int(device) == 0) - - err, ctx = cuda.cuCtxCreate(0, device) - assert(err == cuda.CUresult.CUDA_SUCCESS) - assert(str(ctx).startswith(' 0) - assert(hex(ctx) == hex(int(ctx))) - - # CUdeviceptr - err, dptr = cuda.cuMemAlloc(1024 * np.uint8().itemsize) - assert(err == cuda.CUresult.CUDA_SUCCESS) - assert(str(dptr).startswith(' 0) - err, = cuda.cuMemFree(dptr) - size = 7 - dptr = cuda.CUdeviceptr(size) - assert(str(dptr) == ''.format(size)) - assert(int(dptr) == size) - size = 4294967295 - dptr = cuda.CUdeviceptr(size) - assert(str(dptr) == ''.format(size)) - assert(int(dptr) == size) - size = 18446744073709551615 - dptr = cuda.CUdeviceptr(size) - assert(str(dptr) == ''.format(size)) - assert(int(dptr) == size) - - # cuuint32_t - size = 7 - int32 = cuda.cuuint32_t(size) - assert(str(int32) == ''.format(size)) - assert(int(int32) == size) - size = 4294967295 - int32 = cuda.cuuint32_t(size) - assert(str(int32) == ''.format(size)) - assert(int(int32) == size) - size = 18446744073709551615 - try: - int32 = cuda.cuuint32_t(size) - raise RuntimeError('int32 = cuda.cuuint32_t(18446744073709551615) did not fail') - except OverflowError as err: - pass - - # cuuint64_t - size = 7 - int64 = cuda.cuuint64_t(size) - assert(str(int64) == ''.format(size)) - assert(int(int64) == size) - size = 4294967295 - int64 = cuda.cuuint64_t(size) - assert(str(int64) == ''.format(size)) - assert(int(int64) == size) - size = 18446744073709551615 - int64 = cuda.cuuint64_t(size) - assert(str(int64) == ''.format(size)) - assert(int(int64) == size) - - err, = cuda.cuCtxDestroy(ctx) - assert(err == cuda.CUresult.CUDA_SUCCESS) - -def test_cuda_repr_pointer(): - err, = cuda.cuInit(0) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, device = cuda.cuDeviceGet(0) - assert(err == cuda.CUresult.CUDA_SUCCESS) - - # Test 1: Classes representing pointers - err, ctx = cuda.cuCtxCreate(0, device) - assert(err == cuda.CUresult.CUDA_SUCCESS) - assert(str(ctx).startswith(' 0) - assert(hex(ctx) == hex(int(ctx))) - randomCtxPointer = 12345 - randomCtx = cuda.CUcontext(randomCtxPointer) - assert(str(randomCtx) == ''.format(hex(randomCtxPointer))) - assert(int(randomCtx) == randomCtxPointer) - assert(hex(randomCtx) == hex(randomCtxPointer)) - - # Test 2: Function pointers - func = 12345 - b2d_cb = cuda.CUoccupancyB2DSize(func) - assert(str(b2d_cb) == ''.format(hex(func))) - assert(int(b2d_cb) == func) - assert(hex(b2d_cb) == hex(func)) - - err, = cuda.cuCtxDestroy(ctx) - assert(err == cuda.CUresult.CUDA_SUCCESS) - -def test_cuda_uuid_list_access(): - err, = cuda.cuInit(0) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, device = cuda.cuDeviceGet(0) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, ctx = cuda.cuCtxCreate(0, device) - assert(err == cuda.CUresult.CUDA_SUCCESS) - - err, uuid = cuda.cuDeviceGetUuid(device) - assert(err == cuda.CUresult.CUDA_SUCCESS) - assert(len(uuid.bytes) <= 16) - - jit_option = cuda.CUjit_option - options = { - jit_option.CU_JIT_INFO_LOG_BUFFER: 1, - jit_option.CU_JIT_INFO_LOG_BUFFER_SIZE_BYTES: 2, - jit_option.CU_JIT_ERROR_LOG_BUFFER: 3, - jit_option.CU_JIT_ERROR_LOG_BUFFER_SIZE_BYTES: 4, - jit_option.CU_JIT_LOG_VERBOSE: 5, - } - - err, = cuda.cuCtxDestroy(ctx) - assert(err == cuda.CUresult.CUDA_SUCCESS) - -def test_cuda_cuModuleLoadDataEx(): - err, = cuda.cuInit(0) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, dev = cuda.cuDeviceGet(0) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, ctx = cuda.cuCtxCreate(0, dev) - assert(err == cuda.CUresult.CUDA_SUCCESS) - - - option_keys = [ - cuda.CUjit_option.CU_JIT_INFO_LOG_BUFFER, - cuda.CUjit_option.CU_JIT_INFO_LOG_BUFFER_SIZE_BYTES, - cuda.CUjit_option.CU_JIT_ERROR_LOG_BUFFER, - cuda.CUjit_option.CU_JIT_ERROR_LOG_BUFFER_SIZE_BYTES, - cuda.CUjit_option.CU_JIT_LOG_VERBOSE - ] - err, mod = cuda.cuModuleLoadDataEx(0, 0, option_keys, []) - - err, = cuda.cuCtxDestroy(ctx) - assert(err == cuda.CUresult.CUDA_SUCCESS) - - -def test_cuda_repr(): - actual = cuda.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS() - assert isinstance(actual, cuda.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS) - - actual_repr = actual.__repr__() - expected_repr = textwrap.dedent(""" - params : - fence : - value : 0 - nvSciSync : - fence : 0x0 - reserved : 0 - keyedMutex : - key : 0 - reserved : [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] -flags : 0 -reserved : [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] -""") - assert actual_repr.split() == expected_repr.split() - - actual_repr = cuda.CUDA_KERNEL_NODE_PARAMS_st().__repr__() - expected_repr = textwrap.dedent(""" - func : -gridDimX : 0 -gridDimY : 0 -gridDimZ : 0 -blockDimX : 0 -blockDimY : 0 -blockDimZ : 0 -sharedMemBytes : 0 -kernelParams : 0 -extra : 0 -""") - assert actual_repr.split() == expected_repr.split() - - -def test_cuda_struct_list_of_enums(): - desc = cuda.CUDA_TEXTURE_DESC_st() - desc.addressMode = [cuda.CUaddress_mode.CU_TR_ADDRESS_MODE_WRAP, - cuda.CUaddress_mode.CU_TR_ADDRESS_MODE_CLAMP, - cuda.CUaddress_mode.CU_TR_ADDRESS_MODE_MIRROR] - - # # Too many args - # desc.addressMode = [cuda.CUaddress_mode.CU_TR_ADDRESS_MODE_WRAP, - # cuda.CUaddress_mode.CU_TR_ADDRESS_MODE_CLAMP, - # cuda.CUaddress_mode.CU_TR_ADDRESS_MODE_MIRROR, - # cuda.CUaddress_mode.CU_TR_ADDRESS_MODE_BORDER] - - # # Too little args - # desc.addressMode = [cuda.CUaddress_mode.CU_TR_ADDRESS_MODE_WRAP, - # cuda.CUaddress_mode.CU_TR_ADDRESS_MODE_CLAMP] - -def test_cuda_CUstreamBatchMemOpParams(): - params = cuda.CUstreamBatchMemOpParams() - params.operation = cuda.CUstreamBatchMemOpType.CU_STREAM_MEM_OP_WAIT_VALUE_32 - params.waitValue.operation = cuda.CUstreamBatchMemOpType.CU_STREAM_MEM_OP_WAIT_VALUE_32 - params.writeValue.operation = cuda.CUstreamBatchMemOpType.CU_STREAM_MEM_OP_WAIT_VALUE_32 - params.flushRemoteWrites.operation = cuda.CUstreamBatchMemOpType.CU_STREAM_MEM_OP_WAIT_VALUE_32 - params.waitValue.value64 = 666 - assert(int(params.waitValue.value64) == 666) - -@pytest.mark.skipif(driverVersionLessThan(11030) or not supportsMemoryPool(), reason='When new attributes were introduced') -def test_cuda_memPool_attr(): - err, = cuda.cuInit(0) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, device = cuda.cuDeviceGet(0) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, ctx = cuda.cuCtxCreate(0, device) - assert(err == cuda.CUresult.CUDA_SUCCESS) - - poolProps = cuda.CUmemPoolProps() - poolProps.allocType = cuda.CUmemAllocationType.CU_MEM_ALLOCATION_TYPE_PINNED - poolProps.location.id = 0 - poolProps.location.type = cuda.CUmemLocationType.CU_MEM_LOCATION_TYPE_DEVICE - - attr_list = [None] * 8 - err, pool = cuda.cuMemPoolCreate(poolProps) - assert(err == cuda.CUresult.CUDA_SUCCESS) - - for idx, attr in enumerate([cuda.CUmemPool_attribute.CU_MEMPOOL_ATTR_REUSE_FOLLOW_EVENT_DEPENDENCIES, - cuda.CUmemPool_attribute.CU_MEMPOOL_ATTR_REUSE_ALLOW_OPPORTUNISTIC, - cuda.CUmemPool_attribute.CU_MEMPOOL_ATTR_REUSE_ALLOW_INTERNAL_DEPENDENCIES, - cuda.CUmemPool_attribute.CU_MEMPOOL_ATTR_RELEASE_THRESHOLD, - cuda.CUmemPool_attribute.CU_MEMPOOL_ATTR_RESERVED_MEM_CURRENT, - cuda.CUmemPool_attribute.CU_MEMPOOL_ATTR_RESERVED_MEM_HIGH, - cuda.CUmemPool_attribute.CU_MEMPOOL_ATTR_USED_MEM_CURRENT, - cuda.CUmemPool_attribute.CU_MEMPOOL_ATTR_USED_MEM_HIGH]): - err, attr_tmp = cuda.cuMemPoolGetAttribute(pool, attr) - assert(err == cuda.CUresult.CUDA_SUCCESS) - attr_list[idx] = attr_tmp - - for idxA, attr in enumerate([cuda.CUmemPool_attribute.CU_MEMPOOL_ATTR_REUSE_FOLLOW_EVENT_DEPENDENCIES, - cuda.CUmemPool_attribute.CU_MEMPOOL_ATTR_REUSE_ALLOW_OPPORTUNISTIC, - cuda.CUmemPool_attribute.CU_MEMPOOL_ATTR_REUSE_ALLOW_INTERNAL_DEPENDENCIES]): - err, = cuda.cuMemPoolSetAttribute(pool, attr, 0) - assert(err == cuda.CUresult.CUDA_SUCCESS) - for idx, attr in enumerate([cuda.CUmemPool_attribute.CU_MEMPOOL_ATTR_RELEASE_THRESHOLD]): - err, = cuda.cuMemPoolSetAttribute(pool, attr, cuda.cuuint64_t(9)) - assert(err == cuda.CUresult.CUDA_SUCCESS) - - for idx, attr in enumerate([cuda.CUmemPool_attribute.CU_MEMPOOL_ATTR_REUSE_FOLLOW_EVENT_DEPENDENCIES, - cuda.CUmemPool_attribute.CU_MEMPOOL_ATTR_REUSE_ALLOW_OPPORTUNISTIC, - cuda.CUmemPool_attribute.CU_MEMPOOL_ATTR_REUSE_ALLOW_INTERNAL_DEPENDENCIES, - cuda.CUmemPool_attribute.CU_MEMPOOL_ATTR_RELEASE_THRESHOLD]): - err, attr_tmp = cuda.cuMemPoolGetAttribute(pool, attr) - assert(err == cuda.CUresult.CUDA_SUCCESS) - attr_list[idx] = attr_tmp - assert(attr_list[0] == 0) - assert(attr_list[1] == 0) - assert(attr_list[2] == 0) - assert(int(attr_list[3]) == 9) - - err, = cuda.cuMemPoolDestroy(pool) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, = cuda.cuCtxDestroy(ctx) - assert(err == cuda.CUresult.CUDA_SUCCESS) - -@pytest.mark.skipif(driverVersionLessThan(11030) or not supportsManagedMemory(), reason='When new attributes were introduced') -def test_cuda_pointer_attr(): - err, = cuda.cuInit(0) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, device = cuda.cuDeviceGet(0) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, ctx = cuda.cuCtxCreate(0, device) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, ptr = cuda.cuMemAllocManaged(0x1000, cuda.CUmemAttach_flags.CU_MEM_ATTACH_GLOBAL.value) - assert(err == cuda.CUresult.CUDA_SUCCESS) - - # Individual version - attr_type_list = [cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_CONTEXT, - cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_MEMORY_TYPE, - cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_DEVICE_POINTER, - cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_HOST_POINTER, - # cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_P2P_TOKENS, # TODO: Can I somehow test this? - cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_SYNC_MEMOPS, - cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_BUFFER_ID, - cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_IS_MANAGED, - cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_DEVICE_ORDINAL, - cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_IS_LEGACY_CUDA_IPC_CAPABLE, - cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_RANGE_START_ADDR, - cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_RANGE_SIZE, - cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_MAPPED, - cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_ALLOWED_HANDLE_TYPES, - cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_IS_GPU_DIRECT_RDMA_CAPABLE, - cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_ACCESS_FLAGS, - cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_MEMPOOL_HANDLE] - attr_value_list = [None] * len(attr_type_list) - for idx, attr in enumerate(attr_type_list): - err, attr_tmp = cuda.cuPointerGetAttribute(attr, ptr) - assert(err == cuda.CUresult.CUDA_SUCCESS) - attr_value_list[idx] = attr_tmp - - # List version - err, attr_value_list_v2 = cuda.cuPointerGetAttributes(len(attr_type_list), attr_type_list, ptr) - assert(err == cuda.CUresult.CUDA_SUCCESS) - for attr1, attr2 in zip(attr_value_list, attr_value_list_v2): - assert(str(attr1) == str(attr2)) - - # Test setting values - for val in (True, False): - err, = cuda.cuPointerSetAttribute(val, cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_SYNC_MEMOPS, ptr) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, attr_tmp = cuda.cuPointerGetAttribute(cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_SYNC_MEMOPS, ptr) - assert(err == cuda.CUresult.CUDA_SUCCESS) - assert(attr_tmp == val) - - err, = cuda.cuMemFree(ptr) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, = cuda.cuCtxDestroy(ctx) - assert(err == cuda.CUresult.CUDA_SUCCESS) - -@pytest.mark.skipif(not supportsManagedMemory(), reason='When new attributes were introduced') -def test_cuda_mem_range_attr(): - err, = cuda.cuInit(0) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, device = cuda.cuDeviceGet(0) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, ctx = cuda.cuCtxCreate(0, device) - assert(err == cuda.CUresult.CUDA_SUCCESS) - size = int(0x1000) - err, ptr = cuda.cuMemAllocManaged(size, cuda.CUmemAttach_flags.CU_MEM_ATTACH_GLOBAL.value) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, = cuda.cuMemAdvise(ptr, size, cuda.CUmem_advise.CU_MEM_ADVISE_SET_READ_MOSTLY, device) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, = cuda.cuMemAdvise(ptr, size, cuda.CUmem_advise.CU_MEM_ADVISE_SET_PREFERRED_LOCATION, cuda.CU_DEVICE_CPU) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, = cuda.cuMemAdvise(ptr, size, cuda.CUmem_advise.CU_MEM_ADVISE_SET_ACCESSED_BY, cuda.CU_DEVICE_CPU) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, concurrentSupported = cuda.cuDeviceGetAttribute(cuda.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS, device) - assert(err == cuda.CUresult.CUDA_SUCCESS) - if concurrentSupported: - err, = cuda.cuMemAdvise(ptr, size, cuda.CUmem_advise.CU_MEM_ADVISE_SET_ACCESSED_BY, device) - assert(err == cuda.CUresult.CUDA_SUCCESS) - expected_values_list = ([1, -1, [0, -1, -2], -2],) - else: - expected_values_list = ([1, -1, [-1, -2, -2], -2], [0, -2, [-2, -2, -2], -2]) - - # Individual version - attr_type_list = [cuda.CUmem_range_attribute.CU_MEM_RANGE_ATTRIBUTE_READ_MOSTLY, - cuda.CUmem_range_attribute.CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION, - cuda.CUmem_range_attribute.CU_MEM_RANGE_ATTRIBUTE_ACCESSED_BY, - cuda.CUmem_range_attribute.CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION] - attr_type_size_list = [4, 4, 12, 4] - attr_value_list = [None] * len(attr_type_list) - for idx in range(len(attr_type_list)): - err, attr_tmp = cuda.cuMemRangeGetAttribute(attr_type_size_list[idx], attr_type_list[idx], ptr, size) - assert(err == cuda.CUresult.CUDA_SUCCESS) - attr_value_list[idx] = attr_tmp - - matched = False - for expected_values in expected_values_list: - if expected_values == attr_value_list: - matched = True - break - if not matched: - raise RuntimeError(f'attr_value_list {attr_value_list} did not match any {expected_values_list}') - - # List version - err, attr_value_list_v2 = cuda.cuMemRangeGetAttributes(attr_type_size_list, attr_type_list, len(attr_type_list), ptr, size) - assert(err == cuda.CUresult.CUDA_SUCCESS) - for attr1, attr2 in zip(attr_value_list, attr_value_list_v2): - assert(str(attr1) == str(attr2)) - - err, = cuda.cuMemFree(ptr) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, = cuda.cuCtxDestroy(ctx) - assert(err == cuda.CUresult.CUDA_SUCCESS) - -@pytest.mark.skipif(driverVersionLessThan(11040) or not supportsMemoryPool(), reason='Mempool for graphs not supported') -def test_cuda_graphMem_attr(): - err, = cuda.cuInit(0) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, device = cuda.cuDeviceGet(0) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, ctx = cuda.cuCtxCreate(0, device) - assert(err == cuda.CUresult.CUDA_SUCCESS) - - err, stream = cuda.cuStreamCreate(0) - assert(err == cuda.CUresult.CUDA_SUCCESS) - - err, graph = cuda.cuGraphCreate(0) - assert(err == cuda.CUresult.CUDA_SUCCESS) - - allocSize = 1 - - params = cuda.CUDA_MEM_ALLOC_NODE_PARAMS() - params.poolProps.location.type = cuda.CUmemLocationType.CU_MEM_LOCATION_TYPE_DEVICE - params.poolProps.location.id = device - params.poolProps.allocType = cuda.CUmemAllocationType.CU_MEM_ALLOCATION_TYPE_PINNED - params.bytesize = allocSize - - err, allocNode = cuda.cuGraphAddMemAllocNode(graph, None, 0, params) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, freeNode = cuda.cuGraphAddMemFreeNode(graph, [allocNode], 1, params.dptr) - assert(err == cuda.CUresult.CUDA_SUCCESS) - - err, graphExec = cuda.cuGraphInstantiate(graph, 0) - assert(err == cuda.CUresult.CUDA_SUCCESS) - - err, = cuda.cuGraphLaunch(graphExec, stream) - assert(err == cuda.CUresult.CUDA_SUCCESS) - - err, used = cuda.cuDeviceGetGraphMemAttribute(device, cuda.CUgraphMem_attribute.CU_GRAPH_MEM_ATTR_USED_MEM_CURRENT) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, usedHigh = cuda.cuDeviceGetGraphMemAttribute(device, cuda.CUgraphMem_attribute.CU_GRAPH_MEM_ATTR_USED_MEM_HIGH) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, reserved = cuda.cuDeviceGetGraphMemAttribute(device, cuda.CUgraphMem_attribute.CU_GRAPH_MEM_ATTR_RESERVED_MEM_CURRENT) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, reservedHigh = cuda.cuDeviceGetGraphMemAttribute(device, cuda.CUgraphMem_attribute.CU_GRAPH_MEM_ATTR_RESERVED_MEM_HIGH) - assert(err == cuda.CUresult.CUDA_SUCCESS) - - assert int(used) >= allocSize - assert int(usedHigh) == int(used) - assert int(reserved) == int(usedHigh) - assert int(reservedHigh) == int(reserved) - - err, = cuda.cuGraphDestroy(graph) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, = cuda.cuStreamDestroy(stream) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, = cuda.cuCtxDestroy(ctx) - assert(err == cuda.CUresult.CUDA_SUCCESS) - -@pytest.mark.skipif(driverVersionLessThan(12010) - or not supportsCudaAPI('cuCoredumpSetAttributeGlobal') - or not supportsCudaAPI('cuCoredumpGetAttributeGlobal'), reason='Coredump API not present') -def test_cuda_coredump_attr(): - err, = cuda.cuInit(0) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, device = cuda.cuDeviceGet(0) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, ctx = cuda.cuCtxCreate(0, device) - assert(err == cuda.CUresult.CUDA_SUCCESS) - - attr_list = [None] * 6 - - err, = cuda.cuCoredumpSetAttributeGlobal(cuda.CUcoredumpSettings.CU_COREDUMP_TRIGGER_HOST, False) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, = cuda.cuCoredumpSetAttributeGlobal(cuda.CUcoredumpSettings.CU_COREDUMP_FILE, b'corefile') - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, = cuda.cuCoredumpSetAttributeGlobal(cuda.CUcoredumpSettings.CU_COREDUMP_PIPE, b'corepipe') - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, = cuda.cuCoredumpSetAttributeGlobal(cuda.CUcoredumpSettings.CU_COREDUMP_LIGHTWEIGHT, True) - assert(err == cuda.CUresult.CUDA_SUCCESS) - - for idx, attr in enumerate([cuda.CUcoredumpSettings.CU_COREDUMP_TRIGGER_HOST, - cuda.CUcoredumpSettings.CU_COREDUMP_FILE, - cuda.CUcoredumpSettings.CU_COREDUMP_PIPE, - cuda.CUcoredumpSettings.CU_COREDUMP_LIGHTWEIGHT, - ]): - err, attr_tmp = cuda.cuCoredumpGetAttributeGlobal(attr) - assert(err == cuda.CUresult.CUDA_SUCCESS) - attr_list[idx] = attr_tmp - - assert(attr_list[0] == False) - assert(attr_list[1] == b'corefile') - assert(attr_list[2] == b'corepipe') - assert(attr_list[3] == True) - - err, = cuda.cuCtxDestroy(ctx) - assert(err == cuda.CUresult.CUDA_SUCCESS) - -def test_get_error_name_and_string(): - err, = cuda.cuInit(0) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, device = cuda.cuDeviceGet(0) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, ctx = cuda.cuCtxCreate(0, device) - assert(err == cuda.CUresult.CUDA_SUCCESS) - - err, device = cuda.cuDeviceGet(0) - _, s = cuda.cuGetErrorString(err) - assert s == b"no error" - _, s = cuda.cuGetErrorName(err) - assert s == b"CUDA_SUCCESS" - - err, device = cuda.cuDeviceGet(-1) - _, s = cuda.cuGetErrorString(err) - assert s == b"invalid device ordinal" - _, s = cuda.cuGetErrorName(err) - assert s == b"CUDA_ERROR_INVALID_DEVICE" - err, = cuda.cuCtxDestroy(ctx) - assert(err == cuda.CUresult.CUDA_SUCCESS) - -@pytest.mark.skipif(not callableBinary('nvidia-smi'), reason='Binary existance needed') -def test_device_get_name(): - import subprocess - - err, = cuda.cuInit(0) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, device = cuda.cuDeviceGet(0) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, ctx = cuda.cuCtxCreate(0, device) - assert(err == cuda.CUresult.CUDA_SUCCESS) - - p = subprocess.run( - ["nvidia-smi", "--query-gpu=name", "--format=csv,noheader"], - stdout=subprocess.PIPE, stderr=subprocess.PIPE - ) - - delimiter = b'\r\n' if platform.system() == "Windows" else b'\n' - expect = p.stdout.split(delimiter) - size = 64 - _, got = cuda.cuDeviceGetName(size, device) - got = got.split(b'\x00')[0] - if any(b'Unable to determine the device handle for' in result for result in expect): - # Undeterministic devices get waived - pass - else: - assert any(got in result for result in expect) - - - err, = cuda.cuCtxDestroy(ctx) - assert(err == cuda.CUresult.CUDA_SUCCESS) - -# TODO: cuStreamGetCaptureInfo_v2 -@pytest.mark.skipif(driverVersionLessThan(11030), reason='Driver too old for cuStreamGetCaptureInfo_v2') -def test_stream_capture(): - pass - -def test_profiler(): - err, = cuda.cuInit(0) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, device = cuda.cuDeviceGet(0) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, ctx = cuda.cuCtxCreate(0, device) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, = cuda.cuProfilerStart() - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, = cuda.cuProfilerStop() - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, = cuda.cuCtxDestroy(ctx) - assert(err == cuda.CUresult.CUDA_SUCCESS) - -def test_eglFrame(): - val = cuda.CUeglFrame() - # [, , ] - assert(int(val.frame.pArray[0]) == 0) - assert(int(val.frame.pArray[1]) == 0) - assert(int(val.frame.pArray[2]) == 0) - val.frame.pArray = [1,2,3] - # [, , ] - assert(int(val.frame.pArray[0]) == 1) - assert(int(val.frame.pArray[1]) == 2) - assert(int(val.frame.pArray[2]) == 3) - val.frame.pArray = [cuda.CUarray(4),2,3] - # [, , ] - assert(int(val.frame.pArray[0]) == 4) - assert(int(val.frame.pArray[1]) == 2) - assert(int(val.frame.pArray[2]) == 3) - val.frame.pPitch = [4, 2, 3] - # [4, 2, 3] - assert(int(val.frame.pPitch[0]) == 4) - assert(int(val.frame.pPitch[1]) == 2) - assert(int(val.frame.pPitch[2]) == 3) - val.frame.pPitch = [1,2,3] - assert(int(val.frame.pPitch[0]) == 1) - assert(int(val.frame.pPitch[1]) == 2) - assert(int(val.frame.pPitch[2]) == 3) - -def test_char_range(): - val = cuda.CUipcMemHandle_st() - for x in range(-128, 0): - val.reserved = [x] * 64 - assert(val.reserved[0] == 256 + x) - for x in range(0, 256): - val.reserved = [x] * 64 - assert(val.reserved[0] == x) - -def test_anon_assign(): - val1 = cuda.CUexecAffinityParam_st() - val2 = cuda.CUexecAffinityParam_st() - - assert(val1.param.smCount.val == 0) - val1.param.smCount.val = 5 - assert(val1.param.smCount.val == 5) - val2.param.smCount.val = 11 - assert(val2.param.smCount.val == 11) - - val1.param = val2.param - assert(val1.param.smCount.val == 11) - -def test_union_assign(): - val = cuda.CUlaunchAttributeValue() - val.clusterDim.x, val.clusterDim.y, val.clusterDim.z = 9,9,9 - attr = cuda.CUlaunchAttribute() - attr.value = val - - assert(val.clusterDim.x == 9) - assert(val.clusterDim.y == 9) - assert(val.clusterDim.z == 9) - -def test_invalid_repr_attribute(): - val = cuda.CUlaunchAttributeValue() - string = str(val) - -@pytest.mark.skipif(driverVersionLessThan(12020) - or not supportsCudaAPI('cuGraphAddNode') - or not supportsCudaAPI('cuGraphNodeSetParams') - or not supportsCudaAPI('cuGraphExecNodeSetParams'), reason='Polymorphic graph APIs required') -def test_graph_poly(): - err, = cuda.cuInit(0) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, device = cuda.cuDeviceGet(0) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, ctx = cuda.cuCtxCreate(0, device) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, stream = cuda.cuStreamCreate(0) - assert(err == cuda.CUresult.CUDA_SUCCESS) - - # cuGraphAddNode - - # Create 2 buffers - size = int(1024 * np.uint8().itemsize) - buffers = [] - for _ in range(2): - err, dptr = cuda.cuMemAlloc(size) - assert(err == cuda.CUresult.CUDA_SUCCESS) - buffers += [(np.full(size, 2).astype(np.uint8), dptr)] - - # Update dev buffers - for host, device in buffers: - err, = cuda.cuMemcpyHtoD(device, host, size) - assert(err == cuda.CUresult.CUDA_SUCCESS) - - # Create graph - nodes = [] - err, graph = cuda.cuGraphCreate(0) - assert(err == cuda.CUresult.CUDA_SUCCESS) - - # Memset - host, device = buffers[0] - memsetParams = cuda.CUgraphNodeParams() - memsetParams.type = cuda.CUgraphNodeType.CU_GRAPH_NODE_TYPE_MEMSET - memsetParams.memset.elementSize = np.uint8().itemsize - memsetParams.memset.width = size - memsetParams.memset.height = 1 - memsetParams.memset.dst = device - memsetParams.memset.value = 1 - err, node = cuda.cuGraphAddNode(graph, None, 0, memsetParams) - assert(err == cuda.CUresult.CUDA_SUCCESS) - nodes += [node] - - # Memcpy - host, device = buffers[1] - memcpyParams = cuda.CUgraphNodeParams() - memcpyParams.type = cuda.CUgraphNodeType.CU_GRAPH_NODE_TYPE_MEMCPY - memcpyParams.memcpy.copyParams.srcMemoryType = cuda.CUmemorytype.CU_MEMORYTYPE_DEVICE - memcpyParams.memcpy.copyParams.srcDevice = device - memcpyParams.memcpy.copyParams.dstMemoryType = cuda.CUmemorytype.CU_MEMORYTYPE_HOST - memcpyParams.memcpy.copyParams.dstHost = host - memcpyParams.memcpy.copyParams.WidthInBytes = size - memcpyParams.memcpy.copyParams.Height = 1 - memcpyParams.memcpy.copyParams.Depth = 1 - err, node = cuda.cuGraphAddNode(graph, None, 0, memcpyParams) - assert(err == cuda.CUresult.CUDA_SUCCESS) - nodes += [node] - - # Instantiate, execute, validate - err, graphExec = cuda.cuGraphInstantiate(graph, 0) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, = cuda.cuGraphLaunch(graphExec, stream) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, = cuda.cuStreamSynchronize(stream) - assert(err == cuda.CUresult.CUDA_SUCCESS) - - # Validate - for host, device in buffers: - err, = cuda.cuMemcpyDtoH(host, device, size) - assert(err == cuda.CUresult.CUDA_SUCCESS) - assert(np.array_equal(buffers[0][0], np.full(size, 1).astype(np.uint8))) - assert(np.array_equal(buffers[1][0], np.full(size, 2).astype(np.uint8))) - - # cuGraphNodeSetParams - host, device = buffers[1] - err, memcpyParamsCopy = cuda.cuGraphMemcpyNodeGetParams(nodes[1]) - assert(err == cuda.CUresult.CUDA_SUCCESS) - assert(int(memcpyParamsCopy.srcDevice) == int(device)) - host, device = buffers[0] - memcpyParams.memcpy.copyParams.srcDevice = device - err, = cuda.cuGraphNodeSetParams(nodes[1], memcpyParams) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, memcpyParamsCopy = cuda.cuGraphMemcpyNodeGetParams(nodes[1]) - assert(err == cuda.CUresult.CUDA_SUCCESS) - assert(int(memcpyParamsCopy.srcDevice) == int(device)) - - # cuGraphExecNodeSetParams - memsetParams.memset.value = 11 - err, = cuda.cuGraphExecNodeSetParams(graphExec, nodes[0], memsetParams) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, = cuda.cuGraphLaunch(graphExec, stream) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, = cuda.cuStreamSynchronize(stream) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, = cuda.cuMemcpyDtoH(buffers[0][0], buffers[0][1], size) - assert(err == cuda.CUresult.CUDA_SUCCESS) - assert(np.array_equal(buffers[0][0], np.full(size, 11).astype(np.uint8))) - - # Cleanup - err, = cuda.cuMemFree(buffers[0][1]) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, = cuda.cuMemFree(buffers[1][1]) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, = cuda.cuGraphExecDestroy(graphExec) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, = cuda.cuGraphDestroy(graph) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, = cuda.cuStreamDestroy(stream) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, = cuda.cuCtxDestroy(ctx) - assert(err == cuda.CUresult.CUDA_SUCCESS) - -@pytest.mark.skipif(driverVersionLessThan(12040) - or not supportsCudaAPI('cuDeviceGetDevResource'), reason='Polymorphic graph APIs required') -def test_cuDeviceGetDevResource(): - err, = cuda.cuInit(0) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, device = cuda.cuDeviceGet(0) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, resource_in = cuda.cuDeviceGetDevResource(device, cuda.CUdevResourceType.CU_DEV_RESOURCE_TYPE_SM) - err, ctx = cuda.cuCtxCreate(0, device) - assert(err == cuda.CUresult.CUDA_SUCCESS) - - err, res, count, rem = cuda.cuDevSmResourceSplitByCount(0, resource_in, 0, 2) - assert(err == cuda.CUresult.CUDA_SUCCESS) - assert(count != 0) - assert(len(res) == 0) - err, res, count_same, rem = cuda.cuDevSmResourceSplitByCount(count, resource_in, 0, 2) - assert(err == cuda.CUresult.CUDA_SUCCESS) - assert(count == count_same) - assert(len(res) == count) - err, res, count, rem = cuda.cuDevSmResourceSplitByCount(3, resource_in, 0, 2) - assert(err == cuda.CUresult.CUDA_SUCCESS) - assert(len(res) == 3) - - err, = cuda.cuCtxDestroy(ctx) - assert(err == cuda.CUresult.CUDA_SUCCESS) - -@pytest.mark.skipif(driverVersionLessThan(12030) - or not supportsCudaAPI('cuGraphConditionalHandleCreate'), reason='Conditional graph APIs required') -def test_conditional(): - err, = cuda.cuInit(0) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, device = cuda.cuDeviceGet(0) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, ctx = cuda.cuCtxCreate(0, device) - assert(err == cuda.CUresult.CUDA_SUCCESS) - - err, graph = cuda.cuGraphCreate(0) - assert(err == cuda.CUresult.CUDA_SUCCESS) - err, handle = cuda.cuGraphConditionalHandleCreate(graph, ctx, 0, 0) - assert(err == cuda.CUresult.CUDA_SUCCESS) - - params = cuda.CUgraphNodeParams() - params.type = cuda.CUgraphNodeType.CU_GRAPH_NODE_TYPE_CONDITIONAL - params.conditional.handle = handle - params.conditional.type = cuda.CUgraphConditionalNodeType.CU_GRAPH_COND_TYPE_IF - params.conditional.size = 1 - params.conditional.ctx = ctx - - assert(len(params.conditional.phGraph_out) == 1) - assert(int(params.conditional.phGraph_out[0]) == 0) - err, node = cuda.cuGraphAddNode(graph, None, 0, params) - assert(err == cuda.CUresult.CUDA_SUCCESS) - - assert(len(params.conditional.phGraph_out) == 1) - assert(int(params.conditional.phGraph_out[0]) != 0) diff --git a/cuda/tests/test_cudart.py b/cuda/tests/test_cudart.py deleted file mode 100644 index 0e2c0af0934..00000000000 --- a/cuda/tests/test_cudart.py +++ /dev/null @@ -1,1302 +0,0 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. -# -# Please refer to the NVIDIA end user license agreement (EULA) associated -# with this source code for terms and conditions that govern your use of -# this software. Any use, reproduction, disclosure, or distribution of -# this software and related documentation outside the terms of the EULA -# is strictly prohibited. -from _pytest.mark.structures import store_mark -import ctypes -import cuda.cuda as cuda -import cuda.cudart as cudart -import math -import numpy as np -import pytest - -def isSuccess(err): - return err == cudart.cudaError_t.cudaSuccess - -def assertSuccess(err): - assert(isSuccess(err)) - -def driverVersionLessThan(target): - err, version = cudart.cudaDriverGetVersion() - assertSuccess(err) - return version < target - -def supportsMemoryPool(): - err, isSupported = cudart.cudaDeviceGetAttribute(cudart.cudaDeviceAttr.cudaDevAttrMemoryPoolsSupported, 0) - return isSuccess(err) and isSupported - -def supportsSparseTexturesDeviceFilter(): - err, isSupported = cudart.cudaDeviceGetAttribute(cudart.cudaDeviceAttr.cudaDevAttrSparseCudaArraySupported, 0) - return isSuccess(err) and isSupported - -def supportsCudaAPI(name): - return name in dir(cuda) or dir(cudart) - -def test_cudart_memcpy(): - # Allocate dev memory - size = 1024 * np.uint8().itemsize - err, dptr = cudart.cudaMalloc(size) - assertSuccess(err) - - # Set h1 and h2 memory to be different - h1 = np.full(size, 1).astype(np.uint8) - h2 = np.full(size, 2).astype(np.uint8) - assert(np.array_equal(h1, h2) is False) - - # h1 to D - err, = cudart.cudaMemcpy(dptr, h1, size, cudart.cudaMemcpyKind.cudaMemcpyHostToDevice) - assertSuccess(err) - - # D to h2 - err, = cudart.cudaMemcpy(h2, dptr, size, cudart.cudaMemcpyKind.cudaMemcpyDeviceToHost) - assertSuccess(err) - - # Validate h1 == h2 - assert(np.array_equal(h1, h2)) - - # Cleanup - err, = cudart.cudaFree(dptr) - assertSuccess(err) - -def test_cudart_hostRegister(): - # Use hostRegister API to check for correct enum return values - page_size = 80 - addr_host = np.full(page_size * 3, 1).astype(np.uint8) - addr = addr_host.ctypes.data - - size_0 = ((16 * page_size) / 8) - addr_0 = addr + int(((0 * page_size) / 8)) - size_1 = ((16 * page_size) / 8) - addr_1 = addr + int(((8 * page_size) / 8)) - - err, = cudart.cudaHostRegister(addr_0, size_0, 3) - assertSuccess(err) - err, = cudart.cudaHostRegister(addr_1, size_1, 3) - assert(err == cudart.cudaError_t.cudaErrorHostMemoryAlreadyRegistered) - - err, = cudart.cudaHostUnregister(addr_1) - assert(err == cudart.cudaError_t.cudaErrorInvalidValue) - err, = cudart.cudaHostUnregister(addr_0) - assertSuccess(err) - -def test_cudart_class_reference(): - offset = 1 - width = 4 - height = 5 - depth = 6 - flags = 0 - numMipLevels = 1 - - extent = cudart.cudaExtent() - formatDesc = cudart.cudaChannelFormatDesc() - externalMemoryMipmappedArrayDesc = cudart.cudaExternalMemoryMipmappedArrayDesc() - - # Get/set class attributes - extent.width = width - extent.height = height - extent.depth = depth - - formatDesc.x = 8 - formatDesc.y = 0 - formatDesc.z = 0 - formatDesc.w = 0 - formatDesc.f = cudart.cudaChannelFormatKind.cudaChannelFormatKindSigned - - externalMemoryMipmappedArrayDesc.offset = offset - externalMemoryMipmappedArrayDesc.formatDesc = formatDesc - externalMemoryMipmappedArrayDesc.extent = extent - externalMemoryMipmappedArrayDesc.flags = flags - externalMemoryMipmappedArrayDesc.numLevels = numMipLevels - - # Can manipulate child structure values directly - externalMemoryMipmappedArrayDesc.extent.width = width+1 - externalMemoryMipmappedArrayDesc.extent.height = height+1 - externalMemoryMipmappedArrayDesc.extent.depth = depth+1 - assert(externalMemoryMipmappedArrayDesc.extent.width == width+1) - assert(externalMemoryMipmappedArrayDesc.extent.height == height+1) - assert(externalMemoryMipmappedArrayDesc.extent.depth == depth+1) - - externalMemoryMipmappedArrayDesc.formatDesc.x = 20 - externalMemoryMipmappedArrayDesc.formatDesc.y = 21 - externalMemoryMipmappedArrayDesc.formatDesc.z = 22 - externalMemoryMipmappedArrayDesc.formatDesc.w = 23 - externalMemoryMipmappedArrayDesc.formatDesc.f = cudart.cudaChannelFormatKind.cudaChannelFormatKindFloat - assert(externalMemoryMipmappedArrayDesc.formatDesc.x == 20) - assert(externalMemoryMipmappedArrayDesc.formatDesc.y == 21) - assert(externalMemoryMipmappedArrayDesc.formatDesc.z == 22) - assert(externalMemoryMipmappedArrayDesc.formatDesc.w == 23) - assert(externalMemoryMipmappedArrayDesc.formatDesc.f == cudart.cudaChannelFormatKind.cudaChannelFormatKindFloat) - - # Can copy classes over - externalMemoryMipmappedArrayDesc.extent = extent - assert(externalMemoryMipmappedArrayDesc.extent.width == width) - assert(externalMemoryMipmappedArrayDesc.extent.height == height) - assert(externalMemoryMipmappedArrayDesc.extent.depth == depth) - - externalMemoryMipmappedArrayDesc.formatDesc = formatDesc - assert(externalMemoryMipmappedArrayDesc.formatDesc.x == 8) - assert(externalMemoryMipmappedArrayDesc.formatDesc.y == 0) - assert(externalMemoryMipmappedArrayDesc.formatDesc.z == 0) - assert(externalMemoryMipmappedArrayDesc.formatDesc.w == 0) - assert(externalMemoryMipmappedArrayDesc.formatDesc.f == cudart.cudaChannelFormatKind.cudaChannelFormatKindSigned) - -@pytest.mark.skipif(not supportsSparseTexturesDeviceFilter(), reason='Sparse Texture Device Filter') -def test_cudart_class_inline(): - extent = cudart.cudaExtent() - extent.width = 1000 - extent.height = 500 - extent.depth = 0 - - desc = cudart.cudaChannelFormatDesc() - desc.x = 32 - desc.y = 32 - desc.z = 32 - desc.w = 32 - desc.f = cudart.cudaChannelFormatKind.cudaChannelFormatKindFloat - - numChannels = 4 - numBytesPerChannel = desc.x/8 - numBytesPerTexel = numChannels * numBytesPerChannel - - flags = cudart.cudaArraySparse - maxDim = max(extent.width, extent.height) - numLevels = int(float(1.0) + math.log(maxDim, 2)) - - err, mipmap = cudart.cudaMallocMipmappedArray(desc, extent, numLevels, flags) - assertSuccess(err) - - err, sparseProp = cudart.cudaMipmappedArrayGetSparseProperties(mipmap) - assertSuccess(err) - - # tileExtent - # TODO: Will these values always be this same? Maybe need a more stable test? - # TODO: Are these values even correct? Need to research the function some more.. Maybe need an easier API test - assert(sparseProp.tileExtent.width == 64) - assert(sparseProp.tileExtent.height == 64) - assert(sparseProp.tileExtent.depth == 1) - - sparsePropNew = cudart.cudaArraySparseProperties() - sparsePropNew.tileExtent.width = 15 - sparsePropNew.tileExtent.height = 16 - sparsePropNew.tileExtent.depth = 17 - - # Check that we can copy inner structs - sparseProp.tileExtent = sparsePropNew.tileExtent - assert(sparseProp.tileExtent.width == 15) - assert(sparseProp.tileExtent.height == 16) - assert(sparseProp.tileExtent.depth == 17) - - assert(sparseProp.miptailFirstLevel == 3) - assert(sparseProp.miptailSize == 196608) - assert(sparseProp.flags == 0) - - err, = cudart.cudaFreeMipmappedArray(mipmap) - assertSuccess(err) - - # TODO - example = cudart.cudaExternalSemaphoreSignalNodeParams() - example.extSemArray = [cudart.cudaExternalSemaphore_t(0), cudart.cudaExternalSemaphore_t(123), cudart.cudaExternalSemaphore_t(999)] - a1 = cudart.cudaExternalSemaphoreSignalParams() - a1.params.fence.value = 7 - a1.params.nvSciSync.fence = 999 - a1.params.keyedMutex.key = 9 - a1.flags = 1 - a2 = cudart.cudaExternalSemaphoreSignalParams() - a2.params.fence.value = 7 - a2.params.nvSciSync.fence = 999 - a2.params.keyedMutex.key = 9 - a2.flags = 2 - a3 = cudart.cudaExternalSemaphoreSignalParams() - a3.params.fence.value = 7 - a3.params.nvSciSync.fence = 999 - a3.params.keyedMutex.key = 9 - a3.flags = 3 - example.paramsArray = [a1] - # Note: Setting is a pass by value. Changing the object does not reflect internal value - a3.params.fence.value = 4 - a3.params.nvSciSync.fence = 4 - a3.params.keyedMutex.key = 4 - a3.flags = 4 - example.numExtSems = 3 - -def test_cudart_graphs(): - err, graph = cudart.cudaGraphCreate(0) - assertSuccess(err) - - err, pGraphNode0 = cudart.cudaGraphAddEmptyNode(graph, None, 0) - assertSuccess(err) - err, pGraphNode1 = cudart.cudaGraphAddEmptyNode(graph, [pGraphNode0], 1) - assertSuccess(err) - err, pGraphNode2 = cudart.cudaGraphAddEmptyNode(graph, [pGraphNode0, pGraphNode1], 2) - assertSuccess(err) - - err, nodes, numNodes = cudart.cudaGraphGetNodes(graph) - err, nodes, numNodes = cudart.cudaGraphGetNodes(graph, numNodes) - - stream_legacy = cudart.cudaStream_t(cudart.cudaStreamLegacy) - stream_per_thread = cudart.cudaStream_t(cudart.cudaStreamPerThread) - err, stream_with_flags = cudart.cudaStreamCreateWithFlags(cudart.cudaStreamNonBlocking) - assertSuccess(err) - -def test_cudart_list_access(): - err, prop = cudart.cudaGetDeviceProperties(0) - prop.name = prop.name + b' '*(256-len(prop.name)) - -def test_cudart_class_setters(): - dim = cudart.dim3() - - dim.x = 1 - dim.y = 2 - dim.z = 3 - - assert dim.x == 1 - assert dim.y == 2 - assert dim.z == 3 - -def test_cudart_both_type(): - err, mode = cudart.cudaThreadExchangeStreamCaptureMode(cudart.cudaStreamCaptureMode.cudaStreamCaptureModeGlobal) - assertSuccess(err) - err, mode = cudart.cudaThreadExchangeStreamCaptureMode(cudart.cudaStreamCaptureMode.cudaStreamCaptureModeRelaxed) - assertSuccess(err) - assert(mode == cudart.cudaStreamCaptureMode.cudaStreamCaptureModeGlobal) - err, mode = cudart.cudaThreadExchangeStreamCaptureMode(cudart.cudaStreamCaptureMode.cudaStreamCaptureModeThreadLocal) - assertSuccess(err) - assert(mode == cudart.cudaStreamCaptureMode.cudaStreamCaptureModeRelaxed) - err, mode = cudart.cudaThreadExchangeStreamCaptureMode(cudart.cudaStreamCaptureMode.cudaStreamCaptureModeGlobal) - assertSuccess(err) - assert(mode == cudart.cudaStreamCaptureMode.cudaStreamCaptureModeThreadLocal) - -def test_cudart_cudaGetDeviceProperties(): - err, prop = cudart.cudaGetDeviceProperties(0) - assertSuccess(err) - attrs = ['accessPolicyMaxWindowSize', 'asyncEngineCount', 'canMapHostMemory', 'canUseHostPointerForRegisteredMem', 'clockRate', 'computeMode', 'computePreemptionSupported', 'concurrentKernels', 'concurrentManagedAccess', 'cooperativeLaunch', 'cooperativeMultiDeviceLaunch', 'deviceOverlap', 'directManagedMemAccessFromHost', 'getPtr', 'globalL1CacheSupported', 'hostNativeAtomicSupported', 'integrated', 'isMultiGpuBoard', 'kernelExecTimeoutEnabled', 'l2CacheSize', 'localL1CacheSupported', 'luid', 'luidDeviceNodeMask', 'major', 'managedMemory', 'maxBlocksPerMultiProcessor', 'maxGridSize', 'maxSurface1D', 'maxSurface1DLayered', 'maxSurface2D', 'maxSurface2DLayered', 'maxSurface3D', 'maxSurfaceCubemap', 'maxSurfaceCubemapLayered', 'maxTexture1D', 'maxTexture1DLayered', 'maxTexture1DLinear', 'maxTexture1DMipmap', 'maxTexture2D', 'maxTexture2DGather', 'maxTexture2DLayered', 'maxTexture2DLinear', 'maxTexture2DMipmap', 'maxTexture3D', 'maxTexture3DAlt', 'maxTextureCubemap', 'maxTextureCubemapLayered', 'maxThreadsDim', 'maxThreadsPerBlock', 'maxThreadsPerMultiProcessor', 'memPitch', 'memoryBusWidth', 'memoryClockRate', 'minor', 'multiGpuBoardGroupID', 'multiProcessorCount', 'name', 'pageableMemoryAccess', 'pageableMemoryAccessUsesHostPageTables', 'pciBusID', 'pciDeviceID', 'pciDomainID', 'persistingL2CacheMaxSize', 'regsPerBlock', 'regsPerMultiprocessor', 'reservedSharedMemPerBlock', 'sharedMemPerBlock', 'sharedMemPerBlockOptin', 'sharedMemPerMultiprocessor', 'singleToDoublePrecisionPerfRatio', 'streamPrioritiesSupported', 'surfaceAlignment', 'tccDriver', 'textureAlignment', 'texturePitchAlignment', 'totalConstMem', 'totalGlobalMem', 'unifiedAddressing', 'uuid', 'warpSize'] - for attr in attrs: - assert hasattr(prop, attr) - assert len(prop.name.decode("utf-8")) != 0 - assert len(prop.uuid.bytes.hex()) != 0 - - example = cudart.cudaExternalSemaphoreSignalNodeParams() - example.extSemArray = [cudart.cudaExternalSemaphore_t(0), cudart.cudaExternalSemaphore_t(123), cudart.cudaExternalSemaphore_t(999)] - a1 = cudart.cudaExternalSemaphoreSignalParams() - a1.params.fence.value = 7 - a1.params.nvSciSync.fence = 999 - a1.params.keyedMutex.key = 9 - a1.flags = 1 - a2 = cudart.cudaExternalSemaphoreSignalParams() - a2.params.fence.value = 7 - a2.params.nvSciSync.fence = 999 - a2.params.keyedMutex.key = 9 - a2.flags = 2 - a3 = cudart.cudaExternalSemaphoreSignalParams() - a3.params.fence.value = 7 - a3.params.nvSciSync.fence = 999 - a3.params.keyedMutex.key = 9 - a3.flags = 3 - example.paramsArray = [a1] - # Note: Setting is a pass by value. Changing the object does not reflect internal value - a3.params.fence.value = 4 - a3.params.nvSciSync.fence = 4 - a3.params.keyedMutex.key = 4 - a3.flags = 4 - example.numExtSems = 3 - -@pytest.mark.skipif(driverVersionLessThan(11030) or not supportsMemoryPool(), reason='When new attributes were introduced') -def test_cudart_MemPool_attr(): - poolProps = cudart.cudaMemPoolProps() - poolProps.allocType = cudart.cudaMemAllocationType.cudaMemAllocationTypePinned - poolProps.location.id = 0 - poolProps.location.type = cudart.cudaMemLocationType.cudaMemLocationTypeDevice - - attr_list = [None] * 8 - err, pool = cudart.cudaMemPoolCreate(poolProps) - assertSuccess(err) - - for idx, attr in enumerate([cudart.cudaMemPoolAttr.cudaMemPoolReuseFollowEventDependencies, - cudart.cudaMemPoolAttr.cudaMemPoolReuseAllowOpportunistic, - cudart.cudaMemPoolAttr.cudaMemPoolReuseAllowInternalDependencies, - cudart.cudaMemPoolAttr.cudaMemPoolAttrReleaseThreshold, - cudart.cudaMemPoolAttr.cudaMemPoolAttrReservedMemCurrent, - cudart.cudaMemPoolAttr.cudaMemPoolAttrReservedMemHigh, - cudart.cudaMemPoolAttr.cudaMemPoolAttrUsedMemCurrent, - cudart.cudaMemPoolAttr.cudaMemPoolAttrUsedMemHigh]): - err, attr_tmp = cudart.cudaMemPoolGetAttribute(pool, attr) - assertSuccess(err) - attr_list[idx] = attr_tmp - - for idxA, attr in enumerate([cudart.cudaMemPoolAttr.cudaMemPoolReuseFollowEventDependencies, - cudart.cudaMemPoolAttr.cudaMemPoolReuseAllowOpportunistic, - cudart.cudaMemPoolAttr.cudaMemPoolReuseAllowInternalDependencies]): - err, = cudart.cudaMemPoolSetAttribute(pool, attr, 0) - assertSuccess(err) - for idx, attr in enumerate([cudart.cudaMemPoolAttr.cudaMemPoolAttrReleaseThreshold]): - err, = cudart.cudaMemPoolSetAttribute(pool, attr, cuda.cuuint64_t(9)) - assertSuccess(err) - - for idx, attr in enumerate([cudart.cudaMemPoolAttr.cudaMemPoolReuseFollowEventDependencies, - cudart.cudaMemPoolAttr.cudaMemPoolReuseAllowOpportunistic, - cudart.cudaMemPoolAttr.cudaMemPoolReuseAllowInternalDependencies, - cudart.cudaMemPoolAttr.cudaMemPoolAttrReleaseThreshold]): - err, attr_tmp = cudart.cudaMemPoolGetAttribute(pool, attr) - assertSuccess(err) - attr_list[idx] = attr_tmp - assert(attr_list[0] == 0) - assert(attr_list[1] == 0) - assert(attr_list[2] == 0) - assert(int(attr_list[3]) == 9) - - err, = cudart.cudaMemPoolDestroy(pool) - assertSuccess(err) - -def test_cudart_make_api(): - err, channelDesc = cudart.cudaCreateChannelDesc(32,0,0,0,cudart.cudaChannelFormatKind.cudaChannelFormatKindFloat) - assertSuccess(err) - assert(channelDesc.x == 32) - assert(channelDesc.y == 0) - assert(channelDesc.z == 0) - assert(channelDesc.w == 0) - assert(channelDesc.f == cudart.cudaChannelFormatKind.cudaChannelFormatKindFloat) - - # make_cudaPitchedPtr - cudaPitchedPtr = cudart.make_cudaPitchedPtr(1,2,3,4) - assert(cudaPitchedPtr.ptr == 1) - assert(cudaPitchedPtr.pitch == 2) - assert(cudaPitchedPtr.xsize == 3) - assert(cudaPitchedPtr.ysize == 4) - - # make_cudaPos - cudaPos = cudart.make_cudaPos(1,2,3) - assert(cudaPos.x == 1) - assert(cudaPos.y == 2) - assert(cudaPos.z == 3) - - # make_cudaExtent - cudaExtent = cudart.make_cudaExtent(1,2,3) - assert(cudaExtent.width == 1) - assert(cudaExtent.height == 2) - assert(cudaExtent.depth == 3) - -def test_cudart_cudaStreamGetCaptureInfo(): - # create stream - err, stream = cudart.cudaStreamCreate() - assertSuccess(err) - - # validate that stream is not capturing - err, status, *info = cudart.cudaStreamGetCaptureInfo(stream) - assertSuccess(err) - assert(status == cudart.cudaStreamCaptureStatus.cudaStreamCaptureStatusNone) - - # start capture - err, = cudart.cudaStreamBeginCapture( - stream, cudart.cudaStreamCaptureMode.cudaStreamCaptureModeGlobal - ) - assertSuccess(err) - - # validate that stream is capturing now - err, status, *info = cudart.cudaStreamGetCaptureInfo(stream) - assertSuccess(err) - assert(status == cudart.cudaStreamCaptureStatus.cudaStreamCaptureStatusActive) - - # clean up - err, pgraph = cudart.cudaStreamEndCapture(stream) - assertSuccess(err) - -def test_cudart_cudaArrayGetInfo(): - # create channel descriptor - x, y, z, w = 8, 0, 0, 0 - f = cudart.cudaChannelFormatKind.cudaChannelFormatKindUnsigned - err, desc = cudart.cudaCreateChannelDesc( - x, y, z, w, f - ) - assertSuccess(err) - - # allocate device array - width = 10 - height = 0 - inFlags = 0 - err, arr = cudart.cudaMallocArray(desc, width, height, inFlags) - assertSuccess(err) - - # get device array info - err, desc, extent, outFlags = cudart.cudaArrayGetInfo(arr) - assertSuccess(err) - - # validate descriptor, extent, flags - assert(desc.x == x) - assert(desc.y == y) - assert(desc.z == z) - assert(desc.w == w) - assert(desc.f == f) - assert(extent.width == width) - assert(extent.height == height) - assert(inFlags == outFlags) - - # clean up - err, = cudart.cudaFreeArray(arr) - assertSuccess(err) - -def test_cudart_cudaMemcpy2DToArray(): - # create host arrays - size = int(1024 * np.uint8().itemsize) - h1 = np.full(size, 1).astype(np.uint8) - h2 = np.full(size, 2).astype(np.uint8) - assert(np.array_equal(h1, h2) is False) - - # create channel descriptor - err, desc = cudart.cudaCreateChannelDesc( - 8, 0, 0, 0, cudart.cudaChannelFormatKind.cudaChannelFormatKindUnsigned - ) - assertSuccess(err) - - # allocate device array - err, arr = cudart.cudaMallocArray(desc, size, 0, 0) - assertSuccess(err) - - # h1 to arr - err, = cudart.cudaMemcpy2DToArray( - arr, 0, 0, h1, size, size, 1, - cudart.cudaMemcpyKind.cudaMemcpyHostToDevice - ) - assertSuccess(err) - - # arr to h2 - err, = cudart.cudaMemcpy2DFromArray( - h2, size, arr, 0, 0, size, 1, - cudart.cudaMemcpyKind.cudaMemcpyDeviceToHost - ) - assertSuccess(err) - - # validate h1 == h2 - assert(np.array_equal(h1, h2)) - - # clean up - err, = cudart.cudaFreeArray(arr) - assertSuccess(err) - -def test_cudart_cudaMemcpy2DToArray_DtoD(): - # allocate device memory - size = 1024 * np.uint8().itemsize - err, d1 = cudart.cudaMalloc(size) - assertSuccess(err) - err, d2 = cudart.cudaMalloc(size) - assertSuccess(err) - - # create host arrays - h1 = np.full(size, 1).astype(np.uint8) - h2 = np.full(size, 2).astype(np.uint8) - assert(np.array_equal(h1, h2) is False) - - # create channel descriptor - err, desc = cudart.cudaCreateChannelDesc( - 8, 0, 0, 0, cudart.cudaChannelFormatKind.cudaChannelFormatKindUnsigned - ) - assertSuccess(err) - - # allocate device array - err, arr = cudart.cudaMallocArray(desc, size, 0, 0) - assertSuccess(err) - - # h1 to d1 - err, = cudart.cudaMemcpy(d1, h1, size, cudart.cudaMemcpyKind.cudaMemcpyHostToDevice) - assertSuccess(err) - - # d1 to arr - err, = cudart.cudaMemcpy2DToArray( - arr, 0, 0, d1, size, size, 1, - cudart.cudaMemcpyKind.cudaMemcpyDeviceToDevice - ) - assertSuccess(err) - - # arr to d2 - err, = cudart.cudaMemcpy2DFromArray( - d2, size, arr, 0, 0, size, 1, - cudart.cudaMemcpyKind.cudaMemcpyDeviceToDevice - ) - assertSuccess(err) - - # d2 to h2 - err, = cudart.cudaMemcpy(h2, d2, size, cudart.cudaMemcpyKind.cudaMemcpyDeviceToHost) - assertSuccess(err) - - # validate h1 == h2 - assert(np.array_equal(h1, h2)) - - # clean up - err, = cudart.cudaFreeArray(arr) - assertSuccess(err) - err, = cudart.cudaFree(d2) - assertSuccess(err) - err, = cudart.cudaFree(d1) - assertSuccess(err) - -def test_cudart_cudaMemcpy2DArrayToArray(): - # create host arrays - size = 1024 * np.uint8().itemsize - h1 = np.full(size, 1).astype(np.uint8) - h2 = np.full(size, 2).astype(np.uint8) - assert(np.array_equal(h1, h2) is False) - - # create channel descriptor - err, desc = cudart.cudaCreateChannelDesc( - 8, 0, 0, 0, cudart.cudaChannelFormatKind.cudaChannelFormatKindUnsigned - ) - assertSuccess(err) - - # allocate device arrays - err, a1 = cudart.cudaMallocArray(desc, size, 0, 0) - assertSuccess(err) - err, a2 = cudart.cudaMallocArray(desc, size, 0, 0) - assertSuccess(err) - - # h1 to a1 - err, = cudart.cudaMemcpy2DToArray( - a1, 0, 0, h1, size, size, 1, - cudart.cudaMemcpyKind.cudaMemcpyHostToDevice - ) - assertSuccess(err) - - # a1 to a2 - err, = cudart.cudaMemcpy2DArrayToArray( - a2, 0, 0, a1, 0, 0, size, 1, - cudart.cudaMemcpyKind.cudaMemcpyDeviceToDevice - ) - assertSuccess(err) - - # a2 to h2 - err, = cudart.cudaMemcpy2DFromArray( - h2, size, a2, 0, 0, size, 1, - cudart.cudaMemcpyKind.cudaMemcpyDeviceToHost - ) - assertSuccess(err) - - # validate h1 == h2 - assert(np.array_equal(h1, h2)) - - # clean up - err, = cudart.cudaFreeArray(a2) - assertSuccess(err) - err, = cudart.cudaFreeArray(a1) - assertSuccess(err) - -def test_cudart_cudaMemcpyArrayToArray(): - # create host arrays - size = 1024 * np.uint8().itemsize - h1 = np.full(size, 1).astype(np.uint8) - h2 = np.full(size, 2).astype(np.uint8) - assert(np.array_equal(h1, h2) is False) - - # create channel descriptor - err, desc = cudart.cudaCreateChannelDesc( - 8, 0, 0, 0, cudart.cudaChannelFormatKind.cudaChannelFormatKindUnsigned - ) - assertSuccess(err) - - # allocate device arrays - err, a1 = cudart.cudaMallocArray(desc, size, 0, 0) - assertSuccess(err) - err, a2 = cudart.cudaMallocArray(desc, size, 0, 0) - assertSuccess(err) - - # h1 to a1 - err, = cudart.cudaMemcpy2DToArray( - a1, 0, 0, h1, size, size, 1, - cudart.cudaMemcpyKind.cudaMemcpyHostToDevice - ) - assertSuccess(err) - - # a1 to a2 - err, = cudart.cudaMemcpyArrayToArray( - a2, 0, 0, a1, 0, 0, size, - cudart.cudaMemcpyKind.cudaMemcpyDeviceToDevice - ) - assertSuccess(err) - - # a2 to h2 - err, = cudart.cudaMemcpy2DFromArray( - h2, size, a2, 0, 0, size, 1, - cudart.cudaMemcpyKind.cudaMemcpyDeviceToHost - ) - assertSuccess(err) - - # validate h1 == h2 - assert(np.array_equal(h1, h2)) - - # clean up - err, = cudart.cudaFreeArray(a2) - assertSuccess(err) - err, = cudart.cudaFreeArray(a1) - assertSuccess(err) - -def test_cudart_cudaGetChannelDesc(): - # create channel descriptor - x, y, z, w = 8, 0, 0, 0 - f = cudart.cudaChannelFormatKind.cudaChannelFormatKindUnsigned - err, desc = cudart.cudaCreateChannelDesc( - x, y, z, w, f - ) - assertSuccess(err) - - # allocate device array - width = 10 - height = 0 - flags = 0 - err, arr = cudart.cudaMallocArray(desc, width, height, flags) - assertSuccess(err) - - # get channel descriptor from array - err, desc = cudart.cudaGetChannelDesc(arr) - assertSuccess(err) - - # validate array channel descriptor - assert(desc.x == x) - assert(desc.y == y) - assert(desc.z == z) - assert(desc.w == w) - assert(desc.f == f) - - # clean up - err, = cudart.cudaFreeArray(arr) - assertSuccess(err) - -def test_cudart_cudaGetTextureObjectTextureDesc(): - # create channel descriptor - err, channelDesc = cudart.cudaCreateChannelDesc( - 8, 0, 0, 0, cudart.cudaChannelFormatKind.cudaChannelFormatKindUnsigned - ) - assertSuccess(err) - - # allocate device arrays - err, arr = cudart.cudaMallocArray(channelDesc, 1024, 0, 0) - assertSuccess(err) - - # create descriptors for texture object - resDesc = cudart.cudaResourceDesc() - resDesc.res.array.array = arr - inTexDesc = cudart.cudaTextureDesc() - - # create texture object - err, texObject = cudart.cudaCreateTextureObject(resDesc, inTexDesc, None) - assertSuccess(err) - - # get texture descriptor - err, outTexDesc = cudart.cudaGetTextureObjectTextureDesc(texObject) - assertSuccess(err) - - # validate texture descriptor - for attr in dir(outTexDesc): - if attr in ["borderColor", "getPtr"]: - continue - if not attr.startswith("_"): - assert(getattr(outTexDesc, attr) == getattr(inTexDesc, attr)) - - # clean up - err, = cudart.cudaDestroyTextureObject(texObject) - assertSuccess(err) - -def test_cudart_cudaMemset3D(): - # create host arrays - size = 1024 * np.uint8().itemsize - h1 = np.full(size, 1).astype(np.uint8) - h2 = np.full(size, 2).astype(np.uint8) - assert(np.array_equal(h1, h2) is False) - - # allocate device memory - devExtent = cudart.make_cudaExtent(32, 32, 1) - err, devPitchedPtr = cudart.cudaMalloc3D(devExtent) - assertSuccess(err) - - # set memory - memExtent = cudart.make_cudaExtent(devPitchedPtr.pitch, devPitchedPtr.ysize, 1) - err, = cudart.cudaMemset3D(devPitchedPtr, 1, memExtent) - assertSuccess(err) - - # D to h2 - err, = cudart.cudaMemcpy( - h2, devPitchedPtr.ptr, size, cudart.cudaMemcpyKind.cudaMemcpyDeviceToHost - ) - - # validate h1 == h2 - assert(np.array_equal(h1, h2)) - - # clean up - err, = cudart.cudaFree(devPitchedPtr.ptr) - assertSuccess(err) - -def test_cudart_cudaMemset3D_2D(): - # create host arrays - size = 512 * np.uint8().itemsize - h1 = np.full(size, 1).astype(np.uint8) - h2 = np.full(size, 2).astype(np.uint8) - assert(np.array_equal(h1, h2) is False) - - # allocate device memory - devExtent = cudart.make_cudaExtent(1024, 1, 1) - err, devPitchedPtr = cudart.cudaMalloc3D(devExtent) - assertSuccess(err) - - # set memory - memExtent = cudart.make_cudaExtent(size, devPitchedPtr.ysize, 1) - err, = cudart.cudaMemset3D(devPitchedPtr, 1, memExtent) - assertSuccess(err) - - # D to h2 - err, = cudart.cudaMemcpy( - h2, devPitchedPtr.ptr, size, cudart.cudaMemcpyKind.cudaMemcpyDeviceToHost - ) - - # validate h1 == h2 - assert(np.array_equal(h1, h2)) - - # clean up - err, = cudart.cudaFree(devPitchedPtr.ptr) - assertSuccess(err) - -def test_cudart_cudaMemcpyToArray(): - # create host arrays - size = 1024 * np.uint8().itemsize - h1 = np.full(size, 1).astype(np.uint8) - h2 = np.full(size, 2).astype(np.uint8) - assert(np.array_equal(h1, h2) is False) - - # create channel descriptor - err, desc = cudart.cudaCreateChannelDesc( - 8, 0, 0, 0, cudart.cudaChannelFormatKind.cudaChannelFormatKindUnsigned - ) - assertSuccess(err) - - # allocate device array - err, arr = cudart.cudaMallocArray(desc, size, 0, 0) - assertSuccess(err) - - # h1 to arr - err, = cudart.cudaMemcpyToArray( - arr, 0, 0, h1, size, cudart.cudaMemcpyKind.cudaMemcpyHostToDevice - ) - assertSuccess(err) - - # arr to h2 - err, = cudart.cudaMemcpyFromArray( - h2, arr, 0, 0, size, - cudart.cudaMemcpyKind.cudaMemcpyDeviceToHost - ) - assertSuccess(err) - - # validate h1 == h2 - assert(np.array_equal(h1, h2)) - - # clean up - err, = cudart.cudaFreeArray(arr) - assertSuccess(err) - -def test_cudart_cudaMemcpyToArray_DtoD(): - # allocate device memory - size = int(1024 * np.uint8().itemsize) - err, d1 = cudart.cudaMalloc(size) - assertSuccess(err) - err, d2 = cudart.cudaMalloc(size) - assertSuccess(err) - - # create host arrays - h1 = np.full(size, 1).astype(np.uint8) - h2 = np.full(size, 2).astype(np.uint8) - assert(np.array_equal(h1, h2) is False) - - # create channel descriptor - err, desc = cudart.cudaCreateChannelDesc( - 8, 0, 0, 0, cudart.cudaChannelFormatKind.cudaChannelFormatKindUnsigned - ) - assertSuccess(err) - - # allocate device array - err, arr = cudart.cudaMallocArray(desc, size, 0, 0) - assertSuccess(err) - - # h1 to d1 - err, = cudart.cudaMemcpy(d1, h1, size, cudart.cudaMemcpyKind.cudaMemcpyHostToDevice) - assertSuccess(err) - - # d1 to arr - err, = cudart.cudaMemcpyToArray( - arr, 0, 0, d1, size, cudart.cudaMemcpyKind.cudaMemcpyDeviceToDevice - ) - assertSuccess(err) - - # arr to d2 - err, = cudart.cudaMemcpyFromArray( - d2, arr, 0, 0, size, - cudart.cudaMemcpyKind.cudaMemcpyDeviceToDevice - ) - assertSuccess(err) - - # d2 to h2 - err, = cudart.cudaMemcpy(h2, d2, size, cudart.cudaMemcpyKind.cudaMemcpyDeviceToHost) - assertSuccess(err) - - # validate h1 == h2 - assert(np.array_equal(h1, h2)) - - # clean up - err, = cudart.cudaFreeArray(arr) - assertSuccess(err) - err, = cudart.cudaFree(d2) - assertSuccess(err) - err, = cudart.cudaFree(d1) - assertSuccess(err) - -def test_cudart_cudaMemcpy3DAsync(): - # create host arrays - size = int(1024 * np.uint8().itemsize) - h1 = np.full(size, 1).astype(np.uint8) - h2 = np.full(size, 2).astype(np.uint8) - assert(np.array_equal(h1, h2) is False) - - # create channel descriptor - err, desc = cudart.cudaCreateChannelDesc( - 8, 0, 0, 0, cudart.cudaChannelFormatKind.cudaChannelFormatKindUnsigned - ) - assertSuccess(err) - - # allocate device array - err, arr = cudart.cudaMallocArray(desc, size, 0, 0) - assertSuccess(err) - - # create stream - err, stream = cudart.cudaStreamCreate() - assertSuccess(err) - - # create memcpy params - params = cudart.cudaMemcpy3DParms() - params.srcPtr = cudart.make_cudaPitchedPtr(h1, size, 1, 1) - params.dstArray = arr - params.extent = cudart.make_cudaExtent(size, 1, 1) - params.kind = cudart.cudaMemcpyKind.cudaMemcpyHostToDevice - - # h1 to arr - err, = cudart.cudaMemcpy3DAsync(params, stream) - assertSuccess(err) - - # await results - err, = cudart.cudaStreamSynchronize(stream) - assertSuccess(err) - - # arr to h2 - err, = cudart.cudaMemcpy2DFromArray( - h2, size, arr, 0, 0, size, 1, - cudart.cudaMemcpyKind.cudaMemcpyDeviceToHost - ) - assertSuccess(err) - - # validate h1 == h2 - assert(np.array_equal(h1, h2)) - - # clean up - err, = cudart.cudaFreeArray(arr) - assertSuccess(err) - -def test_cudart_cudaGraphAddMemcpyNode1D(): - # allocate device memory - size = 1024 * np.uint8().itemsize - err, dptr = cudart.cudaMalloc(size) - assertSuccess(err) - - # create host arrays - h1 = np.full(size, 1).astype(np.uint8) - h2 = np.full(size, 2).astype(np.uint8) - assert(np.array_equal(h1, h2) is False) - - # build graph - err, graph = cudart.cudaGraphCreate(0) - assertSuccess(err) - - # add nodes - err, hToDNode = cudart.cudaGraphAddMemcpyNode1D( - graph, [], 0, dptr, h1, size, cudart.cudaMemcpyKind.cudaMemcpyHostToDevice - ) - assertSuccess(err) - err, dToHNode = cudart.cudaGraphAddMemcpyNode1D( - graph, [hToDNode], 1, h2, dptr, size, - cudart.cudaMemcpyKind.cudaMemcpyDeviceToHost - ) - assertSuccess(err) - - # create stream - err, stream = cudart.cudaStreamCreate() - assertSuccess(err) - - # execute graph - err, execGraph = cudart.cudaGraphInstantiate(graph, 0) - assertSuccess(err) - err, = cudart.cudaGraphLaunch(execGraph, stream) - - # await results - err, = cudart.cudaStreamSynchronize(stream) - assertSuccess(err) - - # validate h1 == h2 - assert(np.array_equal(h1, h2)) - - # clean up - err, = cudart.cudaFree(dptr) - assertSuccess(err) - -def test_cudart_cudaGraphAddMemsetNode(): - # allocate device memory - size = 1024 * np.uint8().itemsize - err, dptr = cudart.cudaMalloc(size) - assertSuccess(err) - - # create host arrays - h1 = np.full(size, 1).astype(np.uint8) - h2 = np.full(size, 2).astype(np.uint8) - assert(np.array_equal(h1, h2) is False) - - # build graph - err, graph = cudart.cudaGraphCreate(0) - assertSuccess(err) - - # set memset params - params = cudart.cudaMemsetParams() - params.dst = dptr - params.pitch = size - params.value = 1 - params.elementSize = 1 - params.width = size - params.height = 1 - - # add nodes - err, setNode = cudart.cudaGraphAddMemsetNode( - graph, [], 0, params - ) - assertSuccess(err) - err, cpyNode = cudart.cudaGraphAddMemcpyNode1D( - graph, [setNode], 1, h2, dptr, size, - cudart.cudaMemcpyKind.cudaMemcpyDeviceToHost - ) - assertSuccess(err) - - - # create stream - err, stream = cudart.cudaStreamCreate() - assertSuccess(err) - - # execute graph - err, execGraph = cudart.cudaGraphInstantiate(graph, 0) - assertSuccess(err) - err, = cudart.cudaGraphLaunch(execGraph, stream) - assertSuccess(err) - - # await results - err, = cudart.cudaStreamSynchronize(stream) - assertSuccess(err) - - # validate h1 == h2 - assert(np.array_equal(h1, h2)) - - # clean up - err, = cudart.cudaFree(dptr) - assertSuccess(err) - -def test_cudart_cudaMemcpy3DPeer(): - # allocate device memory - size = int(1024 * np.uint8().itemsize) - err, dptr = cudart.cudaMalloc(size) - assertSuccess(err) - - # create host arrays - h1 = np.full(size, 1).astype(np.uint8) - h2 = np.full(size, 2).astype(np.uint8) - assert(np.array_equal(h1, h2) is False) - - # create channel descriptor - err, desc = cudart.cudaCreateChannelDesc( - 8, 0, 0, 0, cudart.cudaChannelFormatKind.cudaChannelFormatKindUnsigned - ) - assertSuccess(err) - - # allocate device array - err, arr = cudart.cudaMallocArray(desc, size, 0, 0) - assertSuccess(err) - - # create memcpy params - params = cudart.cudaMemcpy3DPeerParms() - params.srcPtr = cudart.make_cudaPitchedPtr(dptr, size, 1, 1) - params.dstArray = arr - params.extent = cudart.make_cudaExtent(size, 1, 1) - - # h1 to D - err, = cudart.cudaMemcpy(dptr, h1, size, cudart.cudaMemcpyKind.cudaMemcpyHostToDevice) - assertSuccess(err) - - # D to arr - err, = cudart.cudaMemcpy3DPeer(params) - assertSuccess(err) - - # arr to h2 - err, = cudart.cudaMemcpy2DFromArray( - h2, size, arr, 0, 0, size, 1, - cudart.cudaMemcpyKind.cudaMemcpyDeviceToHost - ) - assertSuccess(err) - - # validate h1 == h2 - assert(np.array_equal(h1, h2)) - - # clean up - err, = cudart.cudaFreeArray(arr) - assertSuccess(err) - err, = cudart.cudaFree(dptr) - assertSuccess(err) - -def test_cudart_cudaMemcpy3DPeerAsync(): - # allocate device memory - size = 1024 * np.uint8().itemsize - err, dptr = cudart.cudaMalloc(size) - assertSuccess(err) - - # create host arrays - h1 = np.full(size, 1).astype(np.uint8) - h2 = np.full(size, 2).astype(np.uint8) - assert(np.array_equal(h1, h2) is False) - - # create channel descriptor - err, desc = cudart.cudaCreateChannelDesc( - 8, 0, 0, 0, cudart.cudaChannelFormatKind.cudaChannelFormatKindUnsigned - ) - assertSuccess(err) - - # allocate device array - err, arr = cudart.cudaMallocArray(desc, size, 0, 0) - assertSuccess(err) - - # create stream - err, stream = cudart.cudaStreamCreate() - assertSuccess(err) - - # create memcpy params - params = cudart.cudaMemcpy3DPeerParms() - params.srcPtr = cudart.make_cudaPitchedPtr(dptr, size, 1, 1) - params.dstArray = arr - params.extent = cudart.make_cudaExtent(size, 1, 1) - - # h1 to D - err, = cudart.cudaMemcpy(dptr, h1, size, cudart.cudaMemcpyKind.cudaMemcpyHostToDevice) - assertSuccess(err) - - # D to arr - err, = cudart.cudaMemcpy3DPeerAsync(params, stream) - assertSuccess(err) - - # await results - err, = cudart.cudaStreamSynchronize(stream) - assertSuccess(err) - - # arr to h2 - err, = cudart.cudaMemcpy2DFromArray( - h2, size, arr, 0, 0, size, 1, - cudart.cudaMemcpyKind.cudaMemcpyDeviceToHost - ) - assertSuccess(err) - - # validate h1 == h2 - assert(np.array_equal(h1, h2)) - - # clean up - err, = cudart.cudaFreeArray(arr) - assertSuccess(err) - err, = cudart.cudaFree(dptr) - assertSuccess(err) - -def test_profiler(): - err, = cudart.cudaProfilerStart() - assertSuccess(err) - err, = cudart.cudaProfilerStop() - assertSuccess(err) - -def test_cudart_eglFrame(): - frame = cudart.cudaEglFrame() - # [, , ] - assert(int(frame.frame.pArray[0]) == 0) - assert(int(frame.frame.pArray[1]) == 0) - assert(int(frame.frame.pArray[2]) == 0) - frame.frame.pArray = [1,2,3] - # [, , ] - assert(int(frame.frame.pArray[0]) == 1) - assert(int(frame.frame.pArray[1]) == 2) - assert(int(frame.frame.pArray[2]) == 3) - frame.frame.pArray = [1,2,cudart.cudaArray_t(4)] - # [, , ] - assert(int(frame.frame.pArray[0]) == 1) - assert(int(frame.frame.pArray[1]) == 2) - assert(int(frame.frame.pArray[2]) == 4) - # frame.frame.pPitch - # [ptr : 0x1 - # pitch : 2 - # xsize : 4 - # ysize : 0, ptr : 0x0 - # pitch : 0 - # xsize : 0 - # ysize : 0, ptr : 0x0 - # pitch : 0 - # xsize : 0 - # ysize : 0] - assert(int(frame.frame.pPitch[0].ptr) == 1) - assert(int(frame.frame.pPitch[0].pitch) == 2) - assert(int(frame.frame.pPitch[0].xsize) == 4) - assert(int(frame.frame.pPitch[0].ysize) == 0) - assert(int(frame.frame.pPitch[1].ptr) == 0) - assert(int(frame.frame.pPitch[1].pitch) == 0) - assert(int(frame.frame.pPitch[1].xsize) == 0) - assert(int(frame.frame.pPitch[1].ysize) == 0) - assert(int(frame.frame.pPitch[2].ptr) == 0) - assert(int(frame.frame.pPitch[2].pitch) == 0) - assert(int(frame.frame.pPitch[2].xsize) == 0) - assert(int(frame.frame.pPitch[2].ysize) == 0) - frame.frame.pPitch = [cudart.cudaPitchedPtr(), cudart.cudaPitchedPtr(), cudart.cudaPitchedPtr()] - # [ptr : 0x0 - # pitch : 0 - # xsize : 0 - # ysize : 0, ptr : 0x0 - # pitch : 0 - # xsize : 0 - # ysize : 0, ptr : 0x0 - # pitch : 0 - # xsize : 0 - # ysize : 0] - assert(int(frame.frame.pPitch[0].ptr) == 0) - assert(int(frame.frame.pPitch[0].pitch) == 0) - assert(int(frame.frame.pPitch[0].xsize) == 0) - assert(int(frame.frame.pPitch[0].ysize) == 0) - assert(int(frame.frame.pPitch[1].ptr) == 0) - assert(int(frame.frame.pPitch[1].pitch) == 0) - assert(int(frame.frame.pPitch[1].xsize) == 0) - assert(int(frame.frame.pPitch[1].ysize) == 0) - assert(int(frame.frame.pPitch[2].ptr) == 0) - assert(int(frame.frame.pPitch[2].pitch) == 0) - assert(int(frame.frame.pPitch[2].xsize) == 0) - assert(int(frame.frame.pPitch[2].ysize) == 0) - x = frame.frame.pPitch[0] - x.pitch = 123 - frame.frame.pPitch = [x,x,x] - # [ptr : 0x0 - # pitch : 123 - # xsize : 0 - # ysize : 0, ptr : 0x0 - # pitch : 123 - # xsize : 0 - # ysize : 0, ptr : 0x0 - # pitch : 123 - # xsize : 0 - # ysize : 0] - assert(int(frame.frame.pPitch[0].ptr) == 0) - assert(int(frame.frame.pPitch[0].pitch) == 123) - assert(int(frame.frame.pPitch[0].xsize) == 0) - assert(int(frame.frame.pPitch[0].ysize) == 0) - assert(int(frame.frame.pPitch[1].ptr) == 0) - assert(int(frame.frame.pPitch[1].pitch) == 123) - assert(int(frame.frame.pPitch[1].xsize) == 0) - assert(int(frame.frame.pPitch[1].ysize) == 0) - assert(int(frame.frame.pPitch[2].ptr) == 0) - assert(int(frame.frame.pPitch[2].pitch) == 123) - assert(int(frame.frame.pPitch[2].xsize) == 0) - assert(int(frame.frame.pPitch[2].ysize) == 0) - x.pitch = 1234 - # [ptr : 0x0 - # pitch : 123 - # xsize : 0 - # ysize : 0, ptr : 0x0 - # pitch : 123 - # xsize : 0 - # ysize : 0, ptr : 0x0 - # pitch : 123 - # xsize : 0 - # ysize : 0] - assert(int(frame.frame.pPitch[0].ptr) == 0) - assert(int(frame.frame.pPitch[0].pitch) == 123) - assert(int(frame.frame.pPitch[0].xsize) == 0) - assert(int(frame.frame.pPitch[0].ysize) == 0) - assert(int(frame.frame.pPitch[1].ptr) == 0) - assert(int(frame.frame.pPitch[1].pitch) == 123) - assert(int(frame.frame.pPitch[1].xsize) == 0) - assert(int(frame.frame.pPitch[1].ysize) == 0) - assert(int(frame.frame.pPitch[2].ptr) == 0) - assert(int(frame.frame.pPitch[2].pitch) == 123) - assert(int(frame.frame.pPitch[2].xsize) == 0) - assert(int(frame.frame.pPitch[2].ysize) == 0) - -def cudart_func_stream_callback(use_host_api): - class testStruct(ctypes.Structure): - _fields_ = [('a', ctypes.c_int), - ('b', ctypes.c_int), - ('c', ctypes.c_int),] - - def task_callback_host(userData): - data = testStruct.from_address(userData) - assert(data.a == 1) - assert(data.b == 2) - assert(data.c == 3) - return 0 - - def task_callback_stream(stream, status, userData): - data = testStruct.from_address(userData) - assert(data.a == 1) - assert(data.b == 2) - assert(data.c == 3) - return 0 - - if use_host_api: - callback_type = ctypes.PYFUNCTYPE(ctypes.c_int, ctypes.c_void_p) - target_task = task_callback_host - else: - callback_type = ctypes.PYFUNCTYPE(ctypes.c_int, ctypes.c_void_p, ctypes.c_int, ctypes.c_void_p) - target_task = task_callback_stream - - # Construct ctype data - c_callback = callback_type(target_task) - c_data = testStruct(1, 2, 3) - - # ctypes is managing the pointer value for us - if use_host_api: - callback = cudart.cudaHostFn_t(_ptr=ctypes.addressof(c_callback)) - else: - callback = cudart.cudaStreamCallback_t(_ptr=ctypes.addressof(c_callback)) - - # Run - err, stream = cudart.cudaStreamCreate() - assertSuccess(err) - if use_host_api: - err, = cudart.cudaLaunchHostFunc(stream, callback, ctypes.addressof(c_data)) - assertSuccess(err) - else: - err, = cudart.cudaStreamAddCallback(stream, callback, ctypes.addressof(c_data), 0) - assertSuccess(err) - err, = cudart.cudaDeviceSynchronize() - assertSuccess(err) - - -def test_cudart_func_callback(): - cudart_func_stream_callback(use_host_api=False) - cudart_func_stream_callback(use_host_api=True) - -@pytest.mark.skipif(driverVersionLessThan(12030) - or not supportsCudaAPI('cudaGraphConditionalHandleCreate'), reason='Conditional graph APIs required') -def test_cudart_conditional(): - err, graph = cudart.cudaGraphCreate(0) - assertSuccess(err) - err, handle = cudart.cudaGraphConditionalHandleCreate(graph, 0, 0) - assertSuccess(err) - - params = cudart.cudaGraphNodeParams() - params.type = cudart.cudaGraphNodeType.cudaGraphNodeTypeConditional - params.conditional.handle = handle - params.conditional.type = cudart.cudaGraphConditionalNodeType.cudaGraphCondTypeIf - params.conditional.size = 1 - - assert(len(params.conditional.phGraph_out) == 1) - assert(int(params.conditional.phGraph_out[0]) == 0) - err, node = cudart.cudaGraphAddNode(graph, None, 0, params) - assertSuccess(err) - - assert(len(params.conditional.phGraph_out) == 1) - assert(int(params.conditional.phGraph_out[0]) != 0) diff --git a/cuda/tests/test_interoperability.py b/cuda/tests/test_interoperability.py deleted file mode 100644 index aab3b9a93ee..00000000000 --- a/cuda/tests/test_interoperability.py +++ /dev/null @@ -1,233 +0,0 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. -# -# Please refer to the NVIDIA end user license agreement (EULA) associated -# with this source code for terms and conditions that govern your use of -# this software. Any use, reproduction, disclosure, or distribution of -# this software and related documentation outside the terms of the EULA -# is strictly prohibited. -import pytest -import cuda.cuda as cuda -import cuda.cudart as cudart -import numpy as np - -def supportsMemoryPool(): - err, isSupported = cudart.cudaDeviceGetAttribute(cudart.cudaDeviceAttr.cudaDevAttrMemoryPoolsSupported, 0) - return err == cudart.cudaError_t.cudaSuccess and isSupported - -def test_interop_stream(): - err_dr, = cuda.cuInit(0) - assert(err_dr == cuda.CUresult.CUDA_SUCCESS) - err_dr, device = cuda.cuDeviceGet(0) - assert(err_dr == cuda.CUresult.CUDA_SUCCESS) - err_dr, ctx = cuda.cuCtxCreate(0, device) - assert(err_dr == cuda.CUresult.CUDA_SUCCESS) - - # DRV to RT - err_dr, stream = cuda.cuStreamCreate(0) - assert(err_dr == cuda.CUresult.CUDA_SUCCESS) - err_rt, = cudart.cudaStreamDestroy(stream) - assert(err_rt == cudart.cudaError_t.cudaSuccess) - - # RT to DRV - err_rt, stream = cudart.cudaStreamCreate() - assert(err_rt == cudart.cudaError_t.cudaSuccess) - err_dr, = cuda.cuStreamDestroy(stream) - assert(err_dr == cuda.CUresult.CUDA_SUCCESS) - - err_dr, = cuda.cuCtxDestroy(ctx) - assert(err_dr == cuda.CUresult.CUDA_SUCCESS) - -def test_interop_event(): - err_dr, = cuda.cuInit(0) - assert(err_dr == cuda.CUresult.CUDA_SUCCESS) - err_dr, device = cuda.cuDeviceGet(0) - assert(err_dr == cuda.CUresult.CUDA_SUCCESS) - err_dr, ctx = cuda.cuCtxCreate(0, device) - assert(err_dr == cuda.CUresult.CUDA_SUCCESS) - - # DRV to RT - err_dr, event = cuda.cuEventCreate(0) - assert(err_dr == cuda.CUresult.CUDA_SUCCESS) - err_rt, = cudart.cudaEventDestroy(event) - assert(err_rt == cudart.cudaError_t.cudaSuccess) - - # RT to DRV - err_rt, event = cudart.cudaEventCreate() - assert(err_rt == cudart.cudaError_t.cudaSuccess) - err_dr, = cuda.cuEventDestroy(event) - assert(err_dr == cuda.CUresult.CUDA_SUCCESS) - - err_dr, = cuda.cuCtxDestroy(ctx) - assert(err_dr == cuda.CUresult.CUDA_SUCCESS) - -def test_interop_graph(): - err_dr, = cuda.cuInit(0) - assert(err_dr == cuda.CUresult.CUDA_SUCCESS) - err_dr, device = cuda.cuDeviceGet(0) - assert(err_dr == cuda.CUresult.CUDA_SUCCESS) - err_dr, ctx = cuda.cuCtxCreate(0, device) - assert(err_dr == cuda.CUresult.CUDA_SUCCESS) - - # DRV to RT - err_dr, graph = cuda.cuGraphCreate(0) - assert(err_dr == cuda.CUresult.CUDA_SUCCESS) - err_rt, = cudart.cudaGraphDestroy(graph) - assert(err_rt == cudart.cudaError_t.cudaSuccess) - - # RT to DRV - err_rt, graph = cudart.cudaGraphCreate(0) - assert(err_rt == cudart.cudaError_t.cudaSuccess) - err_dr, = cuda.cuGraphDestroy(graph) - assert(err_dr == cuda.CUresult.CUDA_SUCCESS) - - err_dr, = cuda.cuCtxDestroy(ctx) - assert(err_dr == cuda.CUresult.CUDA_SUCCESS) - -def test_interop_graphNode(): - err_dr, = cuda.cuInit(0) - assert(err_dr == cuda.CUresult.CUDA_SUCCESS) - err_dr, device = cuda.cuDeviceGet(0) - assert(err_dr == cuda.CUresult.CUDA_SUCCESS) - err_dr, ctx = cuda.cuCtxCreate(0, device) - assert(err_dr == cuda.CUresult.CUDA_SUCCESS) - - err_dr, graph = cuda.cuGraphCreate(0) - assert(err_dr == cuda.CUresult.CUDA_SUCCESS) - - # DRV to RT - err_dr, node = cuda.cuGraphAddEmptyNode(graph, [], 0) - assert(err_dr == cuda.CUresult.CUDA_SUCCESS) - err_rt, = cudart.cudaGraphDestroyNode(node) - assert(err_rt == cudart.cudaError_t.cudaSuccess) - - # RT to DRV - err_rt, node = cudart.cudaGraphAddEmptyNode(graph, [], 0) - assert(err_rt == cudart.cudaError_t.cudaSuccess) - err_dr, = cuda.cuGraphDestroyNode(node) - assert(err_dr == cuda.CUresult.CUDA_SUCCESS) - - err_rt, = cudart.cudaGraphDestroy(graph) - assert(err_rt == cudart.cudaError_t.cudaSuccess) - err_dr, = cuda.cuCtxDestroy(ctx) - assert(err_dr == cuda.CUresult.CUDA_SUCCESS) - -def test_interop_userObject(): - err_dr, = cuda.cuInit(0) - assert(err_dr == cuda.CUresult.CUDA_SUCCESS) - err_dr, device = cuda.cuDeviceGet(0) - assert(err_dr == cuda.CUresult.CUDA_SUCCESS) - err_dr, ctx = cuda.cuCtxCreate(0, device) - assert(err_dr == cuda.CUresult.CUDA_SUCCESS) - - # cudaUserObject_t - # TODO - - err_dr, = cuda.cuCtxDestroy(ctx) - assert(err_dr == cuda.CUresult.CUDA_SUCCESS) - -def test_interop_function(): - err_dr, = cuda.cuInit(0) - assert(err_dr == cuda.CUresult.CUDA_SUCCESS) - err_dr, device = cuda.cuDeviceGet(0) - assert(err_dr == cuda.CUresult.CUDA_SUCCESS) - err_dr, ctx = cuda.cuCtxCreate(0, device) - assert(err_dr == cuda.CUresult.CUDA_SUCCESS) - - # cudaFunction_t - # TODO - - err_dr, = cuda.cuCtxDestroy(ctx) - assert(err_dr == cuda.CUresult.CUDA_SUCCESS) - -@pytest.mark.skipif(not supportsMemoryPool(), reason='Requires mempool operations') -def test_interop_memPool(): - err_dr, = cuda.cuInit(0) - assert(err_dr == cuda.CUresult.CUDA_SUCCESS) - err_dr, device = cuda.cuDeviceGet(0) - assert(err_dr == cuda.CUresult.CUDA_SUCCESS) - err_dr, ctx = cuda.cuCtxCreate(0, device) - assert(err_dr == cuda.CUresult.CUDA_SUCCESS) - - # DRV to RT - err_dr, pool = cuda.cuDeviceGetDefaultMemPool(0) - assert(err_dr == cuda.CUresult.CUDA_SUCCESS) - err_rt, = cudart.cudaDeviceSetMemPool(0, pool) - assert(err_rt == cudart.cudaError_t.cudaSuccess) - - # RT to DRV - err_rt, pool = cudart.cudaDeviceGetDefaultMemPool(0) - assert(err_rt == cudart.cudaError_t.cudaSuccess) - err_dr, = cuda.cuDeviceSetMemPool(0, pool) - assert(err_dr == cuda.CUresult.CUDA_SUCCESS) - - err_dr, = cuda.cuCtxDestroy(ctx) - assert(err_dr == cuda.CUresult.CUDA_SUCCESS) - -def test_interop_graphExec(): - err_dr, = cuda.cuInit(0) - assert(err_dr == cuda.CUresult.CUDA_SUCCESS) - err_dr, device = cuda.cuDeviceGet(0) - assert(err_dr == cuda.CUresult.CUDA_SUCCESS) - err_dr, ctx = cuda.cuCtxCreate(0, device) - assert(err_dr == cuda.CUresult.CUDA_SUCCESS) - err_dr, graph = cuda.cuGraphCreate(0) - assert(err_dr == cuda.CUresult.CUDA_SUCCESS) - err_dr, node = cuda.cuGraphAddEmptyNode(graph, [], 0) - assert(err_dr == cuda.CUresult.CUDA_SUCCESS) - - # DRV to RT - err_dr, graphExec = cuda.cuGraphInstantiate(graph, 0) - assert(err_dr == cuda.CUresult.CUDA_SUCCESS) - err_rt, = cudart.cudaGraphExecDestroy(graphExec) - assert(err_rt == cudart.cudaError_t.cudaSuccess) - - # RT to DRV - err_rt, graphExec = cudart.cudaGraphInstantiate(graph, 0) - assert(err_rt == cudart.cudaError_t.cudaSuccess) - err_dr, = cuda.cuGraphExecDestroy(graphExec) - assert(err_dr == cuda.CUresult.CUDA_SUCCESS) - - err_rt, = cudart.cudaGraphDestroy(graph) - assert(err_rt == cudart.cudaError_t.cudaSuccess) - err_dr, = cuda.cuCtxDestroy(ctx) - assert(err_dr == cuda.CUresult.CUDA_SUCCESS) - -def test_interop_deviceptr(): - # Init CUDA - err, = cuda.cuInit(0) - assert(err == cuda.CUresult.CUDA_SUCCESS) - - # Get device - err, device = cuda.cuDeviceGet(0) - assert(err == cuda.CUresult.CUDA_SUCCESS) - - # Construct context - err, ctx = cuda.cuCtxCreate(0, device) - assert(err == cuda.CUresult.CUDA_SUCCESS) - - # Allocate dev memory - size = 1024 * np.uint8().itemsize - err_dr, dptr = cuda.cuMemAlloc(size) - assert(err_dr == cuda.CUresult.CUDA_SUCCESS) - - # Allocate host memory - h1 = np.full(size, 1).astype(np.uint8) - h2 = np.full(size, 2).astype(np.uint8) - assert(np.array_equal(h1, h2) is False) - - # Initialize device memory - err_rt, = cudart.cudaMemset(dptr, 1, size) - assert(err_rt == cudart.cudaError_t.cudaSuccess) - - # D to h2 - err_rt, = cudart.cudaMemcpy(h2, dptr, size, cudart.cudaMemcpyKind.cudaMemcpyDeviceToHost) - assert(err_rt == cudart.cudaError_t.cudaSuccess) - - # Validate h1 == h2 - assert(np.array_equal(h1, h2)) - - # Cleanup - err_dr, = cuda.cuMemFree(dptr) - assert(err_dr == cuda.CUresult.CUDA_SUCCESS) - err_dr, = cuda.cuCtxDestroy(ctx) - assert(err_dr == cuda.CUresult.CUDA_SUCCESS) diff --git a/cuda/tests/test_kernelParams.py b/cuda/tests/test_kernelParams.py deleted file mode 100644 index 7731abe0a80..00000000000 --- a/cuda/tests/test_kernelParams.py +++ /dev/null @@ -1,728 +0,0 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. -# -# Please refer to the NVIDIA end user license agreement (EULA) associated -# with this source code for terms and conditions that govern your use of -# this software. Any use, reproduction, disclosure, or distribution of -# this software and related documentation outside the terms of the EULA -# is strictly prohibited. -import pytest -from cuda import cuda, cudart, nvrtc -import numpy as np -import ctypes - -def ASSERT_DRV(err): - if isinstance(err, cuda.CUresult): - if err != cuda.CUresult.CUDA_SUCCESS: - raise RuntimeError('Cuda Error: {}'.format(err)) - elif isinstance(err, cudart.cudaError_t): - if err != cudart.cudaError_t.cudaSuccess: - raise RuntimeError('Cudart Error: {}'.format(err)) - elif isinstance(err, nvrtc.nvrtcResult): - if err != nvrtc.nvrtcResult.NVRTC_SUCCESS: - raise RuntimeError('Nvrtc Error: {}'.format(err)) - else: - raise RuntimeError('Unknown error type: {}'.format(err)) - -def common_nvrtc(allKernelStrings, dev): - err, major = cuda.cuDeviceGetAttribute(cuda.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR, dev) - ASSERT_DRV(err) - err, minor = cuda.cuDeviceGetAttribute(cuda.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR, dev) - ASSERT_DRV(err) - err, _, nvrtc_minor = nvrtc.nvrtcVersion() - ASSERT_DRV(err) - use_cubin = (nvrtc_minor >= 1) - prefix = 'sm' if use_cubin else 'compute' - arch_arg = bytes(f'--gpu-architecture={prefix}_{major}{minor}', 'ascii') - - err, prog = nvrtc.nvrtcCreateProgram(str.encode(allKernelStrings), b'allKernelStrings.cu', 0, [], []) - ASSERT_DRV(err) - opts = [b'--fmad=false', arch_arg] - err, = nvrtc.nvrtcCompileProgram(prog, len(opts), opts) - - err_log, logSize = nvrtc.nvrtcGetProgramLogSize(prog) - ASSERT_DRV(err_log) - log = b' ' * logSize - err_log, = nvrtc.nvrtcGetProgramLog(prog, log) - ASSERT_DRV(err_log) - result = log.decode() - if len(result) > 1: - print(result) - ASSERT_DRV(err) - - if use_cubin: - err, dataSize = nvrtc.nvrtcGetCUBINSize(prog) - ASSERT_DRV(err) - data = b' ' * dataSize - err, = nvrtc.nvrtcGetCUBIN(prog, data) - ASSERT_DRV(err) - else: - err, dataSize = nvrtc.nvrtcGetPTXSize(prog) - ASSERT_DRV(err) - data = b' ' * dataSize - err, = nvrtc.nvrtcGetPTX(prog, data) - ASSERT_DRV(err) - - err, module = cuda.cuModuleLoadData(np.char.array(data)) - ASSERT_DRV(err) - - return module - -def test_kernelParams_empty(): - err, = cuda.cuInit(0) - ASSERT_DRV(err) - err, cuDevice = cuda.cuDeviceGet(0) - ASSERT_DRV(err) - err, context = cuda.cuCtxCreate(0, cuDevice) - ASSERT_DRV(err) - - kernelString = '''\ - static __device__ bool isDone; - extern "C" __global__ - void empty_kernel() - { - isDone = true; - if (isDone) return; - } - ''' - - module = common_nvrtc(kernelString, cuDevice) - - # cudaStructs kernel - err, kernel = cuda.cuModuleGetFunction(module, b'empty_kernel') - ASSERT_DRV(err) - - err, stream = cuda.cuStreamCreate(0) - ASSERT_DRV(err) - - err, = cuda.cuLaunchKernel(kernel, - 1, 1, 1, # grid dim - 1, 1, 1, # block dim - 0, stream, # shared mem and stream - ((), ()), 0) # arguments - ASSERT_DRV(err) - err, = cuda.cuLaunchKernel(kernel, - 1, 1, 1, # grid dim - 1, 1, 1, # block dim - 0, stream, # shared mem and stream - None, 0) # arguments - ASSERT_DRV(err) - - # Retrieve global and validate - isDone_host = ctypes.c_bool() - err, isDonePtr_device, isDonePtr_device_size = cuda.cuModuleGetGlobal(module, b'isDone') - ASSERT_DRV(err) - assert(isDonePtr_device_size == ctypes.sizeof(ctypes.c_bool)) - err, = cuda.cuMemcpyDtoHAsync(isDone_host, isDonePtr_device, ctypes.sizeof(ctypes.c_bool), stream) - ASSERT_DRV(err) - err, = cuda.cuStreamSynchronize(stream) - ASSERT_DRV(err) - assert(isDone_host.value == True) - - err, = cuda.cuStreamDestroy(stream) - ASSERT_DRV(err) - err, = cuda.cuModuleUnload(module) - ASSERT_DRV(err) - err, = cuda.cuCtxDestroy(context) - ASSERT_DRV(err) - -def kernelParams_basic(use_ctypes_as_values): - err, = cuda.cuInit(0) - ASSERT_DRV(err) - err, cuDevice = cuda.cuDeviceGet(0) - ASSERT_DRV(err) - err, context = cuda.cuCtxCreate(0, cuDevice) - ASSERT_DRV(err) - - if use_ctypes_as_values: - assertValues_host = (ctypes.c_bool(True), - ctypes.c_char(b'Z'), ctypes.c_wchar('Ā'), - ctypes.c_byte(-127), ctypes.c_ubyte(255), - ctypes.c_short(1), ctypes.c_ushort(1), - ctypes.c_int(2), ctypes.c_uint(2), - ctypes.c_long(3), ctypes.c_ulong(3), - ctypes.c_longlong(4), ctypes.c_ulonglong(4), - ctypes.c_size_t(5), - ctypes.c_float(float(123.456)), ctypes.c_float(float(123.456)), - ctypes.c_void_p(0xdeadbeef)) - else: - assertValues_host = (True, - b'Z', 'Ā', - -127, 255, - 90, 72, - 85, 82, - 66, 65, - 86, 90, - 33, - float(123.456), float(123.456), - 0xdeadbeef) - assertTypes_host = (ctypes.c_bool, - ctypes.c_char, ctypes.c_wchar, - ctypes.c_byte, ctypes.c_ubyte, - ctypes.c_short, ctypes.c_ushort, - ctypes.c_int, ctypes.c_uint, - ctypes.c_long, ctypes.c_ulong, - ctypes.c_longlong, ctypes.c_ulonglong, - ctypes.c_size_t, - ctypes.c_float, ctypes.c_double, - ctypes.c_void_p) - - basicKernelString = '''\ - extern "C" __global__ - void basic(bool b, - char c, wchar_t wc, - signed char byte, unsigned char ubyte, - short s, unsigned short us, - int i, unsigned int ui, - long l, unsigned long ul, - long long ll, unsigned long long ull, - size_t size, - float f, double d, - void *p, - bool *pb, - char *pc, wchar_t *pwc, - signed char *pbyte, unsigned char *pubyte, - short *ps, unsigned short *pus, - int *pi, unsigned int *pui, - long *pl, unsigned long *pul, - long long *pll, unsigned long long *pull, - size_t *psize, - float *pf, double *pd) - { - assert(b == {}); - assert(c == {}); - assert(wc == {}); - assert(byte == {}); - assert(ubyte == {}); - assert(s == {}); - assert(us == {}); - assert(i == {}); - assert(ui == {}); - assert(l == {}); - assert(ul == {}); - assert(ll == {}); - assert(ull == {}); - assert(size == {}); - assert(f == {}); - assert(d == {}); - assert(p == (void*){}); - *pb = b; - *pc = c; - *pwc = wc; - *pbyte = byte; - *pubyte = ubyte; - *ps = s; - *pus = us; - *pi = i; - *pui = ui; - *pl = l; - *pul = ul; - *pll = ll; - *pull = ull; - *psize = size; - *pf = f; - *pd = d; - } - ''' - idx = 0 - while '{}' in basicKernelString: - val = assertValues_host[idx].value if use_ctypes_as_values else assertValues_host[idx] - if assertTypes_host[idx] == ctypes.c_float: - basicKernelString = basicKernelString.replace('{}', str(float(val)) + 'f', 1) - elif assertTypes_host[idx] == ctypes.c_double: - basicKernelString = basicKernelString.replace('{}', str(float(val)), 1) - elif assertTypes_host[idx] == ctypes.c_char: - basicKernelString = basicKernelString.replace('{}', str(val)[1:], 1) - elif assertTypes_host[idx] == ctypes.c_wchar: - basicKernelString = basicKernelString.replace('{}', str(ord(val)), 1) - else: - basicKernelString = basicKernelString.replace('{}', str(int(val)), 1) - idx += 1 - - module = common_nvrtc(basicKernelString, cuDevice) - - err, kernel = cuda.cuModuleGetFunction(module, b'basic') - ASSERT_DRV(err) - - err, stream = cuda.cuStreamCreate(0) - ASSERT_DRV(err) - - # Prepare kernel - err, pb = cuda.cuMemAlloc(ctypes.sizeof(ctypes.c_bool)) - ASSERT_DRV(err) - err, pc = cuda.cuMemAlloc(ctypes.sizeof(ctypes.c_char)) - ASSERT_DRV(err) - err, pwc = cuda.cuMemAlloc(ctypes.sizeof(ctypes.c_wchar)) - ASSERT_DRV(err) - err, pbyte = cuda.cuMemAlloc(ctypes.sizeof(ctypes.c_byte)) - ASSERT_DRV(err) - err, pubyte = cuda.cuMemAlloc(ctypes.sizeof(ctypes.c_ubyte)) - ASSERT_DRV(err) - err, ps = cuda.cuMemAlloc(ctypes.sizeof(ctypes.c_short)) - ASSERT_DRV(err) - err, pus = cuda.cuMemAlloc(ctypes.sizeof(ctypes.c_ushort)) - ASSERT_DRV(err) - err, pi = cuda.cuMemAlloc(ctypes.sizeof(ctypes.c_int)) - ASSERT_DRV(err) - err, pui = cuda.cuMemAlloc(ctypes.sizeof(ctypes.c_uint)) - ASSERT_DRV(err) - err, pl = cuda.cuMemAlloc(ctypes.sizeof(ctypes.c_long)) - ASSERT_DRV(err) - err, pul = cuda.cuMemAlloc(ctypes.sizeof(ctypes.c_ulong)) - ASSERT_DRV(err) - err, pll = cuda.cuMemAlloc(ctypes.sizeof(ctypes.c_longlong)) - ASSERT_DRV(err) - err, pull = cuda.cuMemAlloc(ctypes.sizeof(ctypes.c_ulonglong)) - ASSERT_DRV(err) - err, psize = cuda.cuMemAlloc(ctypes.sizeof(ctypes.c_size_t)) - ASSERT_DRV(err) - err, pf = cuda.cuMemAlloc(ctypes.sizeof(ctypes.c_float)) - ASSERT_DRV(err) - err, pd = cuda.cuMemAlloc(ctypes.sizeof(ctypes.c_double)) - ASSERT_DRV(err) - - assertValues_device = (pb, - pc, pwc, - pbyte, pubyte, - ps, pus, - pi, pui, - pl, pul, - pll, pull, - psize, - pf, pd) - assertTypes_device = (None, - None, None, - None, None, - None, None, - None, None, - None, None, - None, None, - None, - None, None) - - basicKernelValues = assertValues_host + assertValues_device - basicKernelTypes = assertTypes_host + assertTypes_device - err, = cuda.cuLaunchKernel(kernel, - 1, 1, 1, # grid dim - 1, 1, 1, # block dim - 0, stream, # shared mem and stream - (basicKernelValues, basicKernelTypes), 0) # arguments - ASSERT_DRV(err) - - # Retrieve each dptr - host_params = tuple([valueType() for valueType in assertTypes_host[:-1]]) - for i in range(len(host_params)): - err, = cuda.cuMemcpyDtoHAsync(host_params[i], assertValues_device[i], ctypes.sizeof(assertTypes_host[i]), stream) - ASSERT_DRV(err) - - # Validate retrieved values - err, = cuda.cuStreamSynchronize(stream) - ASSERT_DRV(err) - for i in range(len(host_params)): - val = basicKernelValues[i].value if use_ctypes_as_values else basicKernelValues[i] - if basicKernelTypes[i] == ctypes.c_float: - if use_ctypes_as_values: - assert(val == host_params[i].value) - else: - assert(val == (int(host_params[i].value * 1000) / 1000)) - else: - assert(val == host_params[i].value) - - err, = cuda.cuMemFree(pb) - ASSERT_DRV(err) - err, = cuda.cuMemFree(pc) - ASSERT_DRV(err) - err, = cuda.cuMemFree(pwc) - ASSERT_DRV(err) - err, = cuda.cuMemFree(pbyte) - ASSERT_DRV(err) - err, = cuda.cuMemFree(pubyte) - ASSERT_DRV(err) - err, = cuda.cuMemFree(ps) - ASSERT_DRV(err) - err, = cuda.cuMemFree(pus) - ASSERT_DRV(err) - err, = cuda.cuMemFree(pi) - ASSERT_DRV(err) - err, = cuda.cuMemFree(pui) - ASSERT_DRV(err) - err, = cuda.cuMemFree(pl) - ASSERT_DRV(err) - err, = cuda.cuMemFree(pul) - ASSERT_DRV(err) - err, = cuda.cuMemFree(pll) - ASSERT_DRV(err) - err, = cuda.cuMemFree(pull) - ASSERT_DRV(err) - err, = cuda.cuMemFree(psize) - ASSERT_DRV(err) - err, = cuda.cuMemFree(pf) - ASSERT_DRV(err) - err, = cuda.cuMemFree(pd) - ASSERT_DRV(err) - err, = cuda.cuStreamDestroy(stream) - ASSERT_DRV(err) - err, = cuda.cuModuleUnload(module) - ASSERT_DRV(err) - err, = cuda.cuCtxDestroy(context) - ASSERT_DRV(err) - -def test_kernelParams_basic(): - # Kernel is given basic Python primative values as value input - kernelParams_basic(use_ctypes_as_values = False) - -def test_kernelParams_basic_ctypes(): - # Kernel is given basic c_type instances as primative value input - kernelParams_basic(use_ctypes_as_values = True) - -def test_kernelParams_types_cuda(): - err, = cuda.cuInit(0) - ASSERT_DRV(err) - err, cuDevice = cuda.cuDeviceGet(0) - ASSERT_DRV(err) - err, context = cuda.cuCtxCreate(0, cuDevice) - ASSERT_DRV(err) - err, uvaSupported = cuda.cuDeviceGetAttribute(cuda.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_UNIFIED_ADDRESSING, cuDevice) - ASSERT_DRV(err) - - err, perr = cudart.cudaMalloc(ctypes.sizeof(ctypes.c_int)) - ASSERT_DRV(err) - err, pSurface_host = cudart.cudaHostAlloc(cudart.sizeof(cudart.cudaSurfaceObject_t), cudart.cudaHostAllocMapped) - ASSERT_DRV(err) - err, pDim3_host = cudart.cudaHostAlloc(cudart.sizeof(cudart.dim3), cudart.cudaHostAllocMapped) - ASSERT_DRV(err) - - # Get device pointer if UVM is not enabled - if uvaSupported: - kernelValues = (cudart.cudaError_t.cudaErrorUnknown, perr, # enums - cudart.cudaSurfaceObject_t(248), cudart.cudaSurfaceObject_t(_ptr=pSurface_host), # typedef of primative - cudart.dim3(), cudart.dim3(_ptr=pDim3_host)) # struct - else: - err, pSurface_device = cudart.cudaHostGetDevicePointer(pSurface_host, 0) - ASSERT_DRV(err) - err, pDim3_device = cudart.cudaHostGetDevicePointer(pDim3_host, 0) - ASSERT_DRV(err) - kernelValues = (cudart.cudaError_t.cudaErrorUnknown, perr, # enums - cudart.cudaSurfaceObject_t(248), cudart.cudaSurfaceObject_t(_ptr=pSurface_device), # typedef of primative - cudart.dim3(), cudart.dim3(_ptr=pDim3_device)) # struct - kernelTypes = (None, ctypes.c_void_p, - None, ctypes.c_void_p, - None, ctypes.c_void_p) - kernelValues[4].x = 1 - kernelValues[4].y = 2 - kernelValues[4].z = 3 - - kernelString = '''\ - extern "C" __global__ - void structsCuda(cudaError_t err, cudaError_t *perr, - cudaSurfaceObject_t surface, cudaSurfaceObject_t *pSurface, - dim3 dim, dim3* pdim) - { - *perr = err; - *pSurface = surface; - pdim->x = dim.x; - pdim->y = dim.y; - pdim->z = dim.z; - } - ''' - - module = common_nvrtc(kernelString, cuDevice) - - # cudaStructs kernel - err, kernel = cuda.cuModuleGetFunction(module, b'structsCuda') - ASSERT_DRV(err) - - err, stream = cuda.cuStreamCreate(0) - ASSERT_DRV(err) - - err, = cuda.cuLaunchKernel(kernel, - 1, 1, 1, # grid dim - 1, 1, 1, # block dim - 0, stream, # shared mem and stream - (kernelValues, kernelTypes), 0) # arguments - ASSERT_DRV(err) - - # Retrieve each dptr - host_err = ctypes.c_int() - err, = cudart.cudaMemcpyAsync(ctypes.addressof(host_err), perr, ctypes.sizeof(ctypes.c_int()), cudart.cudaMemcpyKind.cudaMemcpyDeviceToHost, stream) - ASSERT_DRV(err) - - # Validate kernel values - err, = cuda.cuStreamSynchronize(stream) - ASSERT_DRV(err) - cuda_err = cudart.cudaError_t(host_err.value) - - if uvaSupported: - assert(kernelValues[0] == cuda_err) - assert(int(kernelValues[2]) == int(kernelValues[3])) - assert(kernelValues[4].x == kernelValues[5].x) - assert(kernelValues[4].y == kernelValues[5].y) - assert(kernelValues[4].z == kernelValues[5].z) - else: - surface_host = cudart.cudaSurfaceObject_t(_ptr=pSurface_host) - dim3_host = cudart.dim3(_ptr=pDim3_host) - assert(kernelValues[0] == cuda_err) - assert(int(kernelValues[2]) == int(surface_host)) - assert(kernelValues[4].x == dim3_host.x) - assert(kernelValues[4].y == dim3_host.y) - assert(kernelValues[4].z == dim3_host.z) - - err, = cudart.cudaFree(perr) - ASSERT_DRV(err) - err, = cudart.cudaFreeHost(pSurface_host) - ASSERT_DRV(err) - err, = cudart.cudaFreeHost(pDim3_host) - ASSERT_DRV(err) - err, = cuda.cuStreamDestroy(stream) - ASSERT_DRV(err) - err, = cuda.cuModuleUnload(module) - ASSERT_DRV(err) - err, = cuda.cuCtxDestroy(context) - ASSERT_DRV(err) - -def test_kernelParams_struct_custom(): - err, = cuda.cuInit(0) - ASSERT_DRV(err) - err, cuDevice = cuda.cuDeviceGet(0) - ASSERT_DRV(err) - err, context = cuda.cuCtxCreate(0, cuDevice) - ASSERT_DRV(err) - err, uvaSupported = cuda.cuDeviceGetAttribute(cuda.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_UNIFIED_ADDRESSING, cuDevice) - ASSERT_DRV(err) - - kernelString = '''\ - struct testStruct { - int value; - }; - - extern "C" __global__ - void structCustom(struct testStruct src, struct testStruct *dst) - { - dst->value = src.value; - } - ''' - - module = common_nvrtc(kernelString, cuDevice) - - err, kernel = cuda.cuModuleGetFunction(module, b'structCustom') - ASSERT_DRV(err) - - err, stream = cuda.cuStreamCreate(0) - ASSERT_DRV(err) - - # structCustom kernel - class testStruct(ctypes.Structure): - _fields_ = [('value',ctypes.c_int)] - - err, pStruct_host = cudart.cudaHostAlloc(ctypes.sizeof(testStruct), cudart.cudaHostAllocMapped) - ASSERT_DRV(err) - - # Get device pointer if UVM is not enabled - if uvaSupported: - kernelValues = (testStruct(5), pStruct_host) - else: - err, pStruct_device = cudart.cudaHostGetDevicePointer(pStruct_host, 0) - ASSERT_DRV(err) - kernelValues = (testStruct(5), pStruct_device) - kernelTypes = (None, ctypes.c_void_p) - - err, = cuda.cuLaunchKernel(kernel, - 1, 1, 1, # grid dim - 1, 1, 1, # block dim - 0, stream, # shared mem and stream - (kernelValues, kernelTypes), 0) # arguments - ASSERT_DRV(err) - - # Validate kernel values - err, = cuda.cuStreamSynchronize(stream) - ASSERT_DRV(err) - struct_shared = testStruct.from_address(pStruct_host) - assert(kernelValues[0].value == struct_shared.value) - - err, = cudart.cudaFreeHost(pStruct_host) - ASSERT_DRV(err) - err, = cuda.cuStreamDestroy(stream) - ASSERT_DRV(err) - err, = cuda.cuModuleUnload(module) - ASSERT_DRV(err) - err, = cuda.cuCtxDestroy(context) - ASSERT_DRV(err) - -def kernelParams_buffer_protocol_ctypes_common(pass_by_address): - err, = cuda.cuInit(0) - ASSERT_DRV(err) - err, cuDevice = cuda.cuDeviceGet(0) - ASSERT_DRV(err) - err, context = cuda.cuCtxCreate(0, cuDevice) - ASSERT_DRV(err) - err, uvaSupported = cuda.cuDeviceGetAttribute(cuda.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_UNIFIED_ADDRESSING, cuDevice) - ASSERT_DRV(err) - - kernelString = '''\ - struct testStruct { - int value; - }; - extern "C" __global__ - void testkernel(int i, int *pi, - float f, float *pf, - struct testStruct s, struct testStruct *ps) - { - *pi = i; - *pf = f; - ps->value = s.value; - } - ''' - - module = common_nvrtc(kernelString, cuDevice) - - err, kernel = cuda.cuModuleGetFunction(module, b'testkernel') - ASSERT_DRV(err) - - err, stream = cuda.cuStreamCreate(0) - ASSERT_DRV(err) - - # testkernel kernel - class testStruct(ctypes.Structure): - _fields_ = [('value',ctypes.c_int)] - - err, pInt_host = cudart.cudaHostAlloc(ctypes.sizeof(ctypes.c_int), cudart.cudaHostAllocMapped) - ASSERT_DRV(err) - err, pFloat_host = cudart.cudaHostAlloc(ctypes.sizeof(ctypes.c_float), cudart.cudaHostAllocMapped) - ASSERT_DRV(err) - err, pStruct_host = cudart.cudaHostAlloc(ctypes.sizeof(testStruct), cudart.cudaHostAllocMapped) - ASSERT_DRV(err) - - # Get device pointer if UVM is not enabled - if uvaSupported: - kernelValues = (ctypes.c_int(1), ctypes.c_void_p(pInt_host), - ctypes.c_float(float(123.456)), ctypes.c_void_p(pFloat_host), - testStruct(5), ctypes.c_void_p(pStruct_host)) - else: - err, pInt_device = cudart.cudaHostGetDevicePointer(pInt_host, 0) - ASSERT_DRV(err) - err, pFloat_device = cudart.cudaHostGetDevicePointer(pFloat_host, 0) - ASSERT_DRV(err) - err, pStruct_device = cudart.cudaHostGetDevicePointer(pStruct_host, 0) - ASSERT_DRV(err) - kernelValues = (ctypes.c_int(1), ctypes.c_void_p(pInt_device), - ctypes.c_float(float(123.456)), ctypes.c_void_p(pFloat_device), - testStruct(5), ctypes.c_void_p(pStruct_device)) - - packagedParams = (ctypes.c_void_p*len(kernelValues))() - for idx in range(len(packagedParams)): - packagedParams[idx] = ctypes.addressof(kernelValues[idx]) - err, = cuda.cuLaunchKernel(kernel, - 1, 1, 1, # grid dim - 1, 1, 1, # block dim - 0, stream, # shared mem and stream - ctypes.addressof(packagedParams) if pass_by_address else packagedParams, 0) # arguments - ASSERT_DRV(err) - - # Validate kernel values - err, = cuda.cuStreamSynchronize(stream) - ASSERT_DRV(err) - assert(kernelValues[0].value == ctypes.c_int.from_address(pInt_host).value) - assert(kernelValues[2].value == ctypes.c_float.from_address(pFloat_host).value) - assert(kernelValues[4].value == testStruct.from_address(pStruct_host).value) - - err, = cudart.cudaFreeHost(pStruct_host) - ASSERT_DRV(err) - err, = cuda.cuStreamDestroy(stream) - ASSERT_DRV(err) - err, = cuda.cuModuleUnload(module) - ASSERT_DRV(err) - err, = cuda.cuCtxDestroy(context) - ASSERT_DRV(err) - -def test_kernelParams_buffer_protocol_ctypes(): - kernelParams_buffer_protocol_ctypes_common(pass_by_address=True) - kernelParams_buffer_protocol_ctypes_common(pass_by_address=False) - -def test_kernelParams_buffer_protocol_numpy(): - err, = cuda.cuInit(0) - ASSERT_DRV(err) - err, cuDevice = cuda.cuDeviceGet(0) - ASSERT_DRV(err) - err, context = cuda.cuCtxCreate(0, cuDevice) - ASSERT_DRV(err) - err, uvaSupported = cuda.cuDeviceGetAttribute(cuda.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_UNIFIED_ADDRESSING, cuDevice) - ASSERT_DRV(err) - - kernelString = '''\ - struct testStruct { - int value; - }; - extern "C" __global__ - void testkernel(int i, int *pi, - float f, float *pf, - struct testStruct s, struct testStruct *ps) - { - *pi = i; - *pf = f; - ps->value = s.value; - } - ''' - - module = common_nvrtc(kernelString, cuDevice) - - err, kernel = cuda.cuModuleGetFunction(module, b'testkernel') - ASSERT_DRV(err) - - err, stream = cuda.cuStreamCreate(0) - ASSERT_DRV(err) - - # testkernel kernel - testStruct = np.dtype([('value', np.int32)]) - - err, pInt_host = cudart.cudaHostAlloc(np.dtype(np.int32).itemsize, cudart.cudaHostAllocMapped) - ASSERT_DRV(err) - err, pFloat_host = cudart.cudaHostAlloc(np.dtype(np.float32).itemsize, cudart.cudaHostAllocMapped) - ASSERT_DRV(err) - err, pStruct_host = cudart.cudaHostAlloc(testStruct.itemsize, cudart.cudaHostAllocMapped) - ASSERT_DRV(err) - - # Get device pointer if UVM is not enabled - if uvaSupported: - kernelValues = (np.array(1, dtype=np.uint32), np.array([pInt_host], dtype=np.uint64), - np.array(float(123.456), dtype=np.float32), np.array([pFloat_host], dtype=np.uint64), - np.array([5], testStruct), np.array([pStruct_host], dtype=np.uint64)) - else: - err, pInt_device = cudart.cudaHostGetDevicePointer(pInt_host, 0) - ASSERT_DRV(err) - err, pFloat_device = cudart.cudaHostGetDevicePointer(pFloat_host, 0) - ASSERT_DRV(err) - err, pStruct_device = cudart.cudaHostGetDevicePointer(pStruct_host, 0) - ASSERT_DRV(err) - kernelValues = (np.array(1, dtype=np.int32), np.array([pInt_device], dtype=np.uint64), - np.array(float(123.456), dtype=np.float32), np.array([pFloat_device], dtype=np.uint64), - np.array([5], testStruct), np.array([pStruct_device], dtype=np.uint64)) - - packagedParams = np.array([arg.ctypes.data for arg in kernelValues], dtype=np.uint64) - err, = cuda.cuLaunchKernel(kernel, - 1, 1, 1, # grid dim - 1, 1, 1, # block dim - 0, stream, # shared mem and stream - packagedParams, 0) # arguments - ASSERT_DRV(err) - - # Validate kernel values - err, = cuda.cuStreamSynchronize(stream) - ASSERT_DRV(err) - - class numpy_address_wrapper(): - def __init__(self, address, typestr): - self.__array_interface__ = {'data': (address, False), - 'typestr': typestr, - 'shape': (1,)} - - assert(kernelValues[0] == np.array(numpy_address_wrapper(pInt_host, '`_ is a standard set of low-level interfaces, providing full coverage of and 1:1 access to the CUDA host APIs from Python. Checkout the `Overview `_ for the workflow and performance results. + +* `Repository `_ +* `Documentation `_ +* `Examples `_ +* `Issue tracker `_ + +For the installation instruction, please refer to the `Installation `_ page. diff --git a/cuda_bindings/LICENSE b/cuda_bindings/LICENSE new file mode 100644 index 00000000000..d6f74778be8 --- /dev/null +++ b/cuda_bindings/LICENSE @@ -0,0 +1,178 @@ +Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS diff --git a/cuda_bindings/MANIFEST.in b/cuda_bindings/MANIFEST.in new file mode 100644 index 00000000000..4394e5d9fe3 --- /dev/null +++ b/cuda_bindings/MANIFEST.in @@ -0,0 +1,8 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +recursive-include cuda/ *.pyx *.pxd *.pxi *.pyx.in *.pxd.in *.pxi.in *.h +# at least with setuptools 75.0.0 this folder was added erroneously +# to the payload, causing file copying to the build environment failed +exclude cuda/bindings cuda?bindings +exclude cuda/bindings/_bindings cuda?bindings?_bindings diff --git a/cuda_bindings/README.md b/cuda_bindings/README.md new file mode 100644 index 00000000000..cc6a8948db3 --- /dev/null +++ b/cuda_bindings/README.md @@ -0,0 +1,72 @@ +# `cuda.bindings`: Low-level CUDA interfaces + +`cuda.bindings` is a standard set of low-level interfaces, providing full coverage of and access to the CUDA host APIs from Python. Checkout the [Overview page](https://nvidia.github.io/cuda-python/cuda-bindings/latest/overview.html) for the workflow and performance results. + +## Installing + +Please refer to the [Installation page](https://nvidia.github.io/cuda-python/cuda-bindings/latest/install.html) for instructions and required/optional dependencies. + +## Developing + +This subpackage adheres to the developing practices described in the parent metapackage [CONTRIBUTING.md](https://github.com/NVIDIA/cuda-python/blob/main/CONTRIBUTING.md). + +## Debugging + +Pass the `pip` / `uv` configuration option `-C="debug=True"` or +`--config-settings="debug=True"` to explicitly to build debuggable binaries. +Debuggable binaries are built by default for editable builds. + +Debuggable builds are not supported on Windows. + +## Testing + +Testing dependencies can be installed using the `[test]` optional dependency identifier. For example, `pip install -v -e .[test]`. + +Multiple testing options are available: + +* Python Unit Tests +* Cython Unit Tests +* Samples +* Benchmark + +### Python Unit Tests + +Responsible for validating different binding usage patterns. Unit test `test_kernelParams.py` is particularly special since it demonstrates various approaches in setting up kernel launch parameters. + +To run these tests: +* `python -m pytest tests/` against editable installations +* `pytest tests/` against installed packages + +### Cython Unit Tests + +Cython tests are located in `tests/cython` and need to be built. These builds have the same CUDA Toolkit header requirements as [Installing from Source](https://nvidia.github.io/cuda-python/cuda-bindings/latest/install.html#requirements) where the major.minor version must match `cuda.bindings`. To build them: + +1. Setup environment variable `CUDA_PATH` (or `CUDA_HOME`) with the path to the CUDA Toolkit installation. Note: If both are set, `CUDA_PATH` takes precedence. +2. Run `build_tests` script located in `test/cython` appropriate to your platform. This will both cythonize the tests and build them. + +To run these tests: +* `python -m pytest tests/cython/` against editable installations +* `pytest tests/cython/` against installed packages + +### Samples + +Various [CUDA Samples](https://github.com/NVIDIA/cuda-samples/tree/master) that were rewritten using CUDA Python are located in `examples`. + +In addition, extra examples are included: + +* `examples/extra/jit_program_test.py`: Demonstrates the use of the API to compile and + launch a kernel on the device. Includes device memory allocation / + deallocation, transfers between host and device, creation and usage of + streams, and context management. + +To run these samples: +* `python -m pytest tests/cython/` against editable installations +* `pytest tests/cython/` against installed packages + +### Benchmark + +Allows for analyzing binding performance using plugin [pytest-benchmark](https://github.com/ionelmc/pytest-benchmark). + +To run these benchmarks: +* `python -m pytest --benchmark-only benchmarks/` against editable installations +* `pytest --benchmark-only benchmarks/` against installed packages diff --git a/cuda_bindings/build_hooks.py b/cuda_bindings/build_hooks.py new file mode 100644 index 00000000000..f2a73b07218 --- /dev/null +++ b/cuda_bindings/build_hooks.py @@ -0,0 +1,254 @@ +# SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +# This module implements basic PEP 517 backend support to defer CUDA-dependent +# logic (cythonization) to build time. See: +# - https://peps.python.org/pep-0517/ +# - https://setuptools.pypa.io/en/latest/build_meta.html#dynamic-build-dependencies-and-other-build-meta-tweaks +# - https://github.com/NVIDIA/cuda-python/issues/1635 + +import atexit +import contextlib +import functools +import glob +import os +import shutil +import sys +import sysconfig +import tempfile +from warnings import warn + +from setuptools import build_meta as _build_meta +from setuptools.extension import Extension + +# Metadata hooks delegate directly to setuptools -- no CUDA needed. +prepare_metadata_for_build_editable = _build_meta.prepare_metadata_for_build_editable +prepare_metadata_for_build_wheel = _build_meta.prepare_metadata_for_build_wheel +build_sdist = _build_meta.build_sdist +get_requires_for_build_sdist = _build_meta.get_requires_for_build_sdist +get_requires_for_build_wheel = _build_meta.get_requires_for_build_wheel +get_requires_for_build_editable = _build_meta.get_requires_for_build_editable + +# Populated by _build_cuda_bindings(); consumed by setup.py. +_extensions = None + + +# Please keep in sync with the copy in cuda_core/build_hooks.py. +def _import_get_cuda_path_or_home(): + """Import get_cuda_path_or_home, working around PEP 517 namespace shadowing. + + See https://github.com/NVIDIA/cuda-python/issues/1824 for why this helper is needed. + """ + try: + import cuda.pathfinder + except ModuleNotFoundError as exc: + if exc.name not in ("cuda", "cuda.pathfinder"): + raise + try: + import cuda + except ModuleNotFoundError: + cuda = None + + for p in sys.path: + sp_cuda = os.path.join(p, "cuda") + if os.path.isdir(os.path.join(sp_cuda, "pathfinder")): + cuda.__path__ = list(cuda.__path__) + [sp_cuda] + break + else: + raise ModuleNotFoundError( + "cuda-pathfinder is not installed in the build environment. " + "Ensure 'cuda-pathfinder>=1.5' is in build-system.requires." + ) + import cuda.pathfinder + + return cuda.pathfinder.get_cuda_path_or_home + + +@functools.cache +def _get_cuda_path() -> str: + get_cuda_path_or_home = _import_get_cuda_path_or_home() + cuda_path = get_cuda_path_or_home() + if not cuda_path: + raise RuntimeError("Environment variable CUDA_PATH or CUDA_HOME is not set") + print("CUDA path:", cuda_path) + return cuda_path + + +# ----------------------------------------------------------------------- +# Extension preparation helpers + + +def _rename_architecture_specific_files(): + path = os.path.join("cuda", "bindings", "_internal") + if sys.platform == "linux": + src_files = glob.glob(os.path.join(path, "*_linux.pyx")) + elif sys.platform == "win32": + src_files = glob.glob(os.path.join(path, "*_windows.pyx")) + else: + raise RuntimeError(f"platform is unrecognized: {sys.platform}") + dst_files = [] + for src in src_files: + with tempfile.NamedTemporaryFile(delete=False, dir=".") as f: + shutil.copy2(src, f.name) + f_name = f.name + dst = src.replace("_linux", "").replace("_windows", "") + os.replace(f_name, f"./{dst}") + dst_files.append(dst) + return dst_files + + +def _prep_extensions(sources, libraries, include_dirs, library_dirs, extra_compile_args, extra_link_args): + pattern = sources[0] + files = glob.glob(pattern) + libraries = libraries if libraries else [] + exts = [] + for pyx in files: + mod_name = pyx.replace(".pyx", "").replace(os.sep, ".").replace("/", ".") + exts.append( + Extension( + mod_name, + sources=[pyx, *sources[1:]], + include_dirs=include_dirs, + library_dirs=library_dirs, + runtime_library_dirs=[], + libraries=libraries, + language="c++", + extra_compile_args=extra_compile_args, + extra_link_args=extra_link_args, + ) + ) + return exts + + +# ----------------------------------------------------------------------- +# Main build function + + +def _build_cuda_bindings(debug=False): + """Build all cuda-bindings extensions. + + All CUDA-dependent logic (cythonization) is deferred to this function so + that metadata queries do not require a CUDA toolkit installation. + """ + from Cython.Build import cythonize + + global _extensions + + cuda_path = _get_cuda_path() + + if os.environ.get("PARALLEL_LEVEL") is not None: + warn( + "Environment variable PARALLEL_LEVEL is deprecated. Use CUDA_PYTHON_PARALLEL_LEVEL instead", + DeprecationWarning, + stacklevel=2, + ) + nthreads = int(os.environ.get("PARALLEL_LEVEL", "0")) + else: + nthreads = int(os.environ.get("CUDA_PYTHON_PARALLEL_LEVEL", "0") or "0") + + compile_for_coverage = bool(int(os.environ.get("CUDA_PYTHON_COVERAGE", "0"))) + + # Prepare compile/link arguments + include_path_list = [os.path.join(cuda_path, "include")] + include_dirs = [ + os.path.dirname(sysconfig.get_path("include")), + ] + include_path_list + library_dirs = [sysconfig.get_path("platlib"), os.path.join(os.sys.prefix, "lib")] + if sys.platform == "win32": + cudalib_subdirs = [r"lib\arm64"] if sysconfig.get_platform() == "win-arm64" else [r"lib\x64"] + else: + cudalib_subdirs = ["lib64", "lib"] + library_dirs.extend(os.path.join(cuda_path, subdir) for subdir in cudalib_subdirs) + + extra_compile_args = [] + extra_link_args = [] + extra_cythonize_kwargs = {} + if sys.platform == "win32": + if debug: + raise RuntimeError("Debuggable builds are not supported on Windows.") + else: + extra_compile_args += [ + "-std=c++14", + "-fpermissive", + "-Wno-deprecated-declarations", + "-fno-var-tracking-assignments", + ] + if debug: + extra_cythonize_kwargs["gdb_debug"] = True + extra_compile_args += ["-g", "-O0"] + extra_compile_args += ["-D _GLIBCXX_ASSERTIONS"] + else: + extra_compile_args += ["-O3"] + extra_link_args += ["-Wl,--strip-all"] + if compile_for_coverage: + # CYTHON_TRACE_NOGIL indicates to trace nogil functions. It is not + # related to free-threading builds. + extra_compile_args += ["-DCYTHON_TRACE_NOGIL=1", "-DCYTHON_USE_SYS_MONITORING=0"] + + # Rename architecture-specific files + dst_files = _rename_architecture_specific_files() + + @atexit.register + def _cleanup_dst_files(): + for dst in dst_files: + with contextlib.suppress(FileNotFoundError): + os.remove(dst) + + # Build extension list + extensions = [] + cuda_bindings_files = glob.glob("cuda/bindings/*.pyx") + if sys.platform == "win32": + cuda_bindings_files = [f for f in cuda_bindings_files if "cufile" not in f] + + def get_static_libraries(f): + if os.path.basename(f) in ("runtime.pyx", "runtime_ptds.pyx"): + if sys.platform == "linux": + return ["cudart_static", "rt"] + else: + return ["cudart_static"] + return None + + sources_list = [ + # utils + (["cuda/bindings/utils/*.pyx"], None), + # public + *(([f], None) for f in cuda_bindings_files), + # internal files used by generated bindings + (["cuda/bindings/_internal/utils.pyx"], None), + *(([f], get_static_libraries(f)) for f in dst_files if f.endswith(".pyx")), + ] + + for sources, libraries in sources_list: + extensions += _prep_extensions( + sources, libraries, include_dirs, library_dirs, extra_compile_args, extra_link_args + ) + + # Cythonize + cython_directives = {"language_level": 3, "embedsignature": True, "binding": True, "freethreading_compatible": True} + if compile_for_coverage: + cython_directives["linetrace"] = True + + _extensions = cythonize( + extensions, + nthreads=nthreads, + build_dir="." if compile_for_coverage else "build/cython", + compiler_directives=cython_directives, + **extra_cythonize_kwargs, + ) + + +# ----------------------------------------------------------------------- +# PEP 517 build hooks + + +def build_wheel(wheel_directory, config_settings=None, metadata_directory=None): + debug = config_settings.get("debug", False) if config_settings else False + _build_cuda_bindings(debug=debug) + return _build_meta.build_wheel(wheel_directory, config_settings, metadata_directory) + + +def build_editable(wheel_directory, config_settings=None, metadata_directory=None): + debug_default = sys.platform != "win32" # Debug builds not supported on Windows + debug = config_settings.get("debug", debug_default) if config_settings else debug_default + _build_cuda_bindings(debug=debug) + return _build_meta.build_editable(wheel_directory, config_settings, metadata_directory) diff --git a/cuda/__init__.pxd b/cuda_bindings/cuda/bindings/__init__.pxd similarity index 100% rename from cuda/__init__.pxd rename to cuda_bindings/cuda/bindings/__init__.pxd diff --git a/cuda_bindings/cuda/bindings/__init__.py b/cuda_bindings/cuda/bindings/__init__.py new file mode 100644 index 00000000000..ea1daae3e0b --- /dev/null +++ b/cuda_bindings/cuda/bindings/__init__.py @@ -0,0 +1,5 @@ +# SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +from cuda.bindings import utils +from cuda.bindings._version import __version__ diff --git a/cuda_bindings/cuda/bindings/_example_helpers/__init__.py b/cuda_bindings/cuda/bindings/_example_helpers/__init__.py new file mode 100644 index 00000000000..119d7e97689 --- /dev/null +++ b/cuda_bindings/cuda/bindings/_example_helpers/__init__.py @@ -0,0 +1,17 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +from .common import KernelHelper, check_compute_capability_too_low, requirement_not_met +from .helper_cuda import check_cuda_errors, find_cuda_device, find_cuda_device_drv +from .helper_string import check_cmd_line_flag, get_cmd_line_argument_int + +__all__ = [ + "KernelHelper", + "check_cmd_line_flag", + "check_compute_capability_too_low", + "check_cuda_errors", + "find_cuda_device", + "find_cuda_device_drv", + "get_cmd_line_argument_int", + "requirement_not_met", +] diff --git a/cuda_bindings/cuda/bindings/_example_helpers/common.py b/cuda_bindings/cuda/bindings/_example_helpers/common.py new file mode 100644 index 00000000000..8970944a31a --- /dev/null +++ b/cuda_bindings/cuda/bindings/_example_helpers/common.py @@ -0,0 +1,96 @@ +# SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + + +import os +import sys + +import numpy as np + +from cuda import pathfinder +from cuda.bindings import driver as cuda +from cuda.bindings import nvrtc +from cuda.bindings import runtime as cudart + +from .helper_cuda import check_cuda_errors + + +def requirement_not_met(message): + print(message, file=sys.stderr) # noqa: T201 + exitcode = os.environ.get("CUDA_BINDINGS_SKIP_EXAMPLE", "1") + return sys.exit(int(exitcode)) + + +def check_compute_capability_too_low(dev_id, required_cc_major_minor): + cc_major = check_cuda_errors( + cudart.cudaDeviceGetAttribute(cudart.cudaDeviceAttr.cudaDevAttrComputeCapabilityMajor, dev_id) + ) + cc_minor = check_cuda_errors( + cudart.cudaDeviceGetAttribute(cudart.cudaDeviceAttr.cudaDevAttrComputeCapabilityMinor, dev_id) + ) + have_cc_major_minor = (cc_major, cc_minor) + if have_cc_major_minor < required_cc_major_minor: + requirement_not_met( + f"CUDA device compute capability too low: {have_cc_major_minor=!r}, {required_cc_major_minor=!r}" + ) + + +class KernelHelper: + def __init__(self, code, dev_id): + include_dirs = [] + for libname in ("cudart", "cccl"): + hdr_dir = pathfinder.find_nvidia_header_directory(libname) + if hdr_dir is None: + requirement_not_met(f'pathfinder.find_nvidia_header_directory("{libname}") returned None') + include_dirs.append(hdr_dir) + + prog = check_cuda_errors(nvrtc.nvrtcCreateProgram(str.encode(code), b"sourceCode.cu", 0, None, None)) + + # Initialize CUDA + check_cuda_errors(cudart.cudaFree(0)) + + major = check_cuda_errors( + cudart.cudaDeviceGetAttribute(cudart.cudaDeviceAttr.cudaDevAttrComputeCapabilityMajor, dev_id) + ) + minor = check_cuda_errors( + cudart.cudaDeviceGetAttribute(cudart.cudaDeviceAttr.cudaDevAttrComputeCapabilityMinor, dev_id) + ) + _, nvrtc_minor = check_cuda_errors(nvrtc.nvrtcVersion()) + use_cubin = nvrtc_minor >= 1 + prefix = "sm" if use_cubin else "compute" + arch_arg = bytes(f"--gpu-architecture={prefix}_{major}{minor}", "ascii") + + opts = [ + b"--fmad=true", + arch_arg, + b"--std=c++17", + b"-default-device", + ] + for inc_dir in include_dirs: + opts.append(f"--include-path={inc_dir}".encode()) + + try: + check_cuda_errors(nvrtc.nvrtcCompileProgram(prog, len(opts), opts)) + except RuntimeError as err: + log_size = check_cuda_errors(nvrtc.nvrtcGetProgramLogSize(prog)) + log = b" " * log_size + check_cuda_errors(nvrtc.nvrtcGetProgramLog(prog, log)) + import sys + + print(log.decode(), file=sys.stderr) # noqa: T201 + print(err, file=sys.stderr) # noqa: T201 + sys.exit(1) + + if use_cubin: + data_size = check_cuda_errors(nvrtc.nvrtcGetCUBINSize(prog)) + data = b" " * data_size + check_cuda_errors(nvrtc.nvrtcGetCUBIN(prog, data)) + else: + data_size = check_cuda_errors(nvrtc.nvrtcGetPTXSize(prog)) + data = b" " * data_size + check_cuda_errors(nvrtc.nvrtcGetPTX(prog, data)) + + self.module = check_cuda_errors(cuda.cuModuleLoadData(np.char.array(data))) + + def get_function(self, name): + return check_cuda_errors(cuda.cuModuleGetFunction(self.module, name)) diff --git a/cuda_bindings/cuda/bindings/_example_helpers/helper_cuda.py b/cuda_bindings/cuda/bindings/_example_helpers/helper_cuda.py new file mode 100644 index 00000000000..18fbecf59b9 --- /dev/null +++ b/cuda_bindings/cuda/bindings/_example_helpers/helper_cuda.py @@ -0,0 +1,48 @@ +# SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +from cuda.bindings import driver as cuda +from cuda.bindings import nvrtc +from cuda.bindings import runtime as cudart + +from .helper_string import check_cmd_line_flag, get_cmd_line_argument_int + + +def _cuda_get_error_enum(error): + if isinstance(error, cuda.CUresult): + err, name = cuda.cuGetErrorName(error) + return name if err == cuda.CUresult.CUDA_SUCCESS else "" + elif isinstance(error, cudart.cudaError_t): + return cudart.cudaGetErrorName(error)[1] + elif isinstance(error, nvrtc.nvrtcResult): + return nvrtc.nvrtcGetErrorString(error)[1] + else: + raise RuntimeError(f"Unknown error type: {error}") + + +def check_cuda_errors(result): + if result[0].value: + raise RuntimeError(f"CUDA error code={result[0].value}({_cuda_get_error_enum(result[0])})") + if len(result) == 1: + return None + elif len(result) == 2: + return result[1] + else: + return result[1:] + + +def find_cuda_device(): + dev_id = 0 + if check_cmd_line_flag("device="): + dev_id = get_cmd_line_argument_int("device=") + check_cuda_errors(cudart.cudaSetDevice(dev_id)) + return dev_id + + +def find_cuda_device_drv(): + dev_id = 0 + if check_cmd_line_flag("device="): + dev_id = get_cmd_line_argument_int("device=") + check_cuda_errors(cuda.cuInit(0)) + cu_device = check_cuda_errors(cuda.cuDeviceGet(dev_id)) + return cu_device diff --git a/cuda_bindings/cuda/bindings/_example_helpers/helper_string.py b/cuda_bindings/cuda/bindings/_example_helpers/helper_string.py new file mode 100644 index 00000000000..ad15cecc9ca --- /dev/null +++ b/cuda_bindings/cuda/bindings/_example_helpers/helper_string.py @@ -0,0 +1,15 @@ +# SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +import sys + + +def check_cmd_line_flag(string_ref): + return any(string_ref == i and k < len(sys.argv) - 1 for i, k in enumerate(sys.argv)) + + +def get_cmd_line_argument_int(string_ref): + for i, k in enumerate(sys.argv): + if string_ref == i and k < len(sys.argv) - 1: + return sys.argv[k + 1] + return 0 diff --git a/cuda/_cuda/__init__.py b/cuda_bindings/cuda/bindings/_internal/__init__.py similarity index 100% rename from cuda/_cuda/__init__.py rename to cuda_bindings/cuda/bindings/_internal/__init__.py diff --git a/cuda_bindings/cuda/bindings/_internal/_fast_enum.py b/cuda_bindings/cuda/bindings/_internal/_fast_enum.py new file mode 100644 index 00000000000..63a2336da1a --- /dev/null +++ b/cuda_bindings/cuda/bindings/_internal/_fast_enum.py @@ -0,0 +1,74 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + + +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=581469c1fadb5f72c43b478d73f2b905562136c8723a25e2f4240b5b681e2894 +""" +This is a replacement for the stdlib enum.IntEnum. + +Notably, it has much better import time performance, since it doesn't generate +and evaluate Python code at startup time. + +It supports the most important subset of the IntEnum API. See `test_enum` in +`cuda_bindings/tests/test_basics.py` for details. +""" + +from typing import Any, Iterator + + +class FastEnumMetaclass(type): + def __init__(cls, name, bases, namespace): + super().__init__(name, bases, namespace) + + cls.__singletons__ = {} + cls.__members__ = {} + for name, value in cls.__dict__.items(): + if name.startswith("__") and name.endswith("__"): + continue + + if isinstance(value, tuple): + value, doc = value + elif isinstance(value, int): + doc = None + else: + continue + + singleton = int.__new__(cls, value) + singleton.__doc__ = doc + singleton._name = name + cls.__singletons__[value] = singleton + cls.__members__[name] = singleton + + for name, member in cls.__members__.items(): + setattr(cls, name, member) + + def __repr__(cls) -> str: + return f"" + + def __len__(cls) -> int: + return len(cls.__members__) + + def __iter__(cls) -> Iterator["FastEnum"]: + return iter(cls.__members__.values()) + + def __contains__(cls, item: Any) -> bool: + return item in cls.__singletons__ + + +class FastEnum(int, metaclass=FastEnumMetaclass): + def __new__(cls, value: int) -> "FastEnum": + singleton: FastEnum = cls.__singletons__.get(value) + if singleton is None: + raise ValueError(f"{value} is not a valid {cls.__name__}") + return singleton + + def __repr__(self) -> str: + return f"<{self.__class__.__name__}.{self._name}: {int(self)}>" + + @property + def name(self) -> str: + return self._name + + @property + def value(self) -> int: + return int(self) diff --git a/cuda_bindings/cuda/bindings/_internal/cudla.pxd b/cuda_bindings/cuda/bindings/_internal/cudla.pxd new file mode 100644 index 00000000000..359cf8f486a --- /dev/null +++ b/cuda_bindings/cuda/bindings/_internal/cudla.pxd @@ -0,0 +1,26 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +# This code was automatically generated across versions from 1.5.0 to 13.3.0. Do not modify it directly. + +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=07f18bf6993a0d962a4e844aa9ea9a335534c669992d112dd12003b77015e5ba +from ..cycudla cimport * + + +############################################################################### +# Wrapper functions +############################################################################### + +cdef cudlaStatus _cudlaGetVersion(uint64_t* const version) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil +cdef cudlaStatus _cudlaDeviceGetCount(uint64_t* const pNumDevices) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil +cdef cudlaStatus _cudlaCreateDevice(const uint64_t device, cudlaDevHandle* const devHandle, const uint32_t flags) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil +cdef cudlaStatus _cudlaMemRegister(const cudlaDevHandle devHandle, const uint64_t* const ptr, const size_t size, uint64_t** const devPtr, const uint32_t flags) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil +cdef cudlaStatus _cudlaModuleLoadFromMemory(const cudlaDevHandle devHandle, const uint8_t* const pModule, const size_t moduleSize, cudlaModule* const hModule, const uint32_t flags) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil +cdef cudlaStatus _cudlaModuleGetAttributes(const cudlaModule hModule, const cudlaModuleAttributeType attrType, cudlaModuleAttribute* const attribute) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil +cdef cudlaStatus _cudlaModuleUnload(const cudlaModule hModule, const uint32_t flags) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil +cdef cudlaStatus _cudlaSubmitTask(const cudlaDevHandle devHandle, const cudlaTask* const ptrToTasks, const uint32_t numTasks, void* const stream, const uint32_t flags) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil +cdef cudlaStatus _cudlaDeviceGetAttribute(const cudlaDevHandle devHandle, const cudlaDevAttributeType attrib, cudlaDevAttribute* const pAttribute) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil +cdef cudlaStatus _cudlaMemUnregister(const cudlaDevHandle devHandle, const uint64_t* const devPtr) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil +cdef cudlaStatus _cudlaGetLastError(const cudlaDevHandle devHandle) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil +cdef cudlaStatus _cudlaDestroyDevice(const cudlaDevHandle devHandle) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil +cdef cudlaStatus _cudlaSetTaskTimeoutInMs(const cudlaDevHandle devHandle, const uint32_t timeout) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil diff --git a/cuda_bindings/cuda/bindings/_internal/cudla_linux.pyx b/cuda_bindings/cuda/bindings/_internal/cudla_linux.pyx new file mode 100644 index 00000000000..7c4c9d311e1 --- /dev/null +++ b/cuda_bindings/cuda/bindings/_internal/cudla_linux.pyx @@ -0,0 +1,349 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +# This code was automatically generated across versions from 1.5.0 to 13.3.0. Do not modify it directly. +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=a7e70bc7234821ae1f02306321604d7605aee20e0fde536def5edd52263be5de + + +# <<<< PREAMBLE CONTENT >>>> + +cdef extern from "": + void* _cyb_dlsym "dlsym"(void*, const char*) nogil + const void * _cyb_RTLD_DEFAULT "RTLD_DEFAULT" + +from libc.stdint cimport intptr_t as _cyb_intptr_t + +import threading as _cyb_threading + +cdef bint _cyb___py_cudla_init = False +cdef dict _cyb_func_ptrs = None +cdef object _cyb_symbol_lock = _cyb_threading.Lock() + +# <<<< END OF PREAMBLE CONTENT >>>> + +from libc.stdint cimport uintptr_t + +from .utils import FunctionNotFoundError, NotSupportedError +from cuda.pathfinder import load_nvidia_dynamic_lib + + +############################################################################### +# Wrapper init +############################################################################### + +cdef void* __cudlaGetVersion = NULL +cdef void* __cudlaDeviceGetCount = NULL +cdef void* __cudlaCreateDevice = NULL +cdef void* __cudlaMemRegister = NULL +cdef void* __cudlaModuleLoadFromMemory = NULL +cdef void* __cudlaModuleGetAttributes = NULL +cdef void* __cudlaModuleUnload = NULL +cdef void* __cudlaSubmitTask = NULL +cdef void* __cudlaDeviceGetAttribute = NULL +cdef void* __cudlaMemUnregister = NULL +cdef void* __cudlaGetLastError = NULL +cdef void* __cudlaDestroyDevice = NULL +cdef void* __cudlaSetTaskTimeoutInMs = NULL + +cdef int _init_cudla() except -1 nogil: + global _cyb___py_cudla_init + cdef void* handle = NULL + with gil, _cyb_symbol_lock: + if _cyb___py_cudla_init: return 0 + + global __cudlaGetVersion + __cudlaGetVersion = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'cudlaGetVersion') + if __cudlaGetVersion == NULL: + if handle == NULL: + handle = load_library() + __cudlaGetVersion = _cyb_dlsym(handle, 'cudlaGetVersion') + + global __cudlaDeviceGetCount + __cudlaDeviceGetCount = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'cudlaDeviceGetCount') + if __cudlaDeviceGetCount == NULL: + if handle == NULL: + handle = load_library() + __cudlaDeviceGetCount = _cyb_dlsym(handle, 'cudlaDeviceGetCount') + + global __cudlaCreateDevice + __cudlaCreateDevice = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'cudlaCreateDevice') + if __cudlaCreateDevice == NULL: + if handle == NULL: + handle = load_library() + __cudlaCreateDevice = _cyb_dlsym(handle, 'cudlaCreateDevice') + + global __cudlaMemRegister + __cudlaMemRegister = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'cudlaMemRegister') + if __cudlaMemRegister == NULL: + if handle == NULL: + handle = load_library() + __cudlaMemRegister = _cyb_dlsym(handle, 'cudlaMemRegister') + + global __cudlaModuleLoadFromMemory + __cudlaModuleLoadFromMemory = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'cudlaModuleLoadFromMemory') + if __cudlaModuleLoadFromMemory == NULL: + if handle == NULL: + handle = load_library() + __cudlaModuleLoadFromMemory = _cyb_dlsym(handle, 'cudlaModuleLoadFromMemory') + + global __cudlaModuleGetAttributes + __cudlaModuleGetAttributes = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'cudlaModuleGetAttributes') + if __cudlaModuleGetAttributes == NULL: + if handle == NULL: + handle = load_library() + __cudlaModuleGetAttributes = _cyb_dlsym(handle, 'cudlaModuleGetAttributes') + + global __cudlaModuleUnload + __cudlaModuleUnload = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'cudlaModuleUnload') + if __cudlaModuleUnload == NULL: + if handle == NULL: + handle = load_library() + __cudlaModuleUnload = _cyb_dlsym(handle, 'cudlaModuleUnload') + + global __cudlaSubmitTask + __cudlaSubmitTask = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'cudlaSubmitTask') + if __cudlaSubmitTask == NULL: + if handle == NULL: + handle = load_library() + __cudlaSubmitTask = _cyb_dlsym(handle, 'cudlaSubmitTask') + + global __cudlaDeviceGetAttribute + __cudlaDeviceGetAttribute = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'cudlaDeviceGetAttribute') + if __cudlaDeviceGetAttribute == NULL: + if handle == NULL: + handle = load_library() + __cudlaDeviceGetAttribute = _cyb_dlsym(handle, 'cudlaDeviceGetAttribute') + + global __cudlaMemUnregister + __cudlaMemUnregister = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'cudlaMemUnregister') + if __cudlaMemUnregister == NULL: + if handle == NULL: + handle = load_library() + __cudlaMemUnregister = _cyb_dlsym(handle, 'cudlaMemUnregister') + + global __cudlaGetLastError + __cudlaGetLastError = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'cudlaGetLastError') + if __cudlaGetLastError == NULL: + if handle == NULL: + handle = load_library() + __cudlaGetLastError = _cyb_dlsym(handle, 'cudlaGetLastError') + + global __cudlaDestroyDevice + __cudlaDestroyDevice = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'cudlaDestroyDevice') + if __cudlaDestroyDevice == NULL: + if handle == NULL: + handle = load_library() + __cudlaDestroyDevice = _cyb_dlsym(handle, 'cudlaDestroyDevice') + + global __cudlaSetTaskTimeoutInMs + __cudlaSetTaskTimeoutInMs = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'cudlaSetTaskTimeoutInMs') + if __cudlaSetTaskTimeoutInMs == NULL: + if handle == NULL: + handle = load_library() + __cudlaSetTaskTimeoutInMs = _cyb_dlsym(handle, 'cudlaSetTaskTimeoutInMs') + + _cyb___py_cudla_init = True + return 0 + +cdef inline int _check_or_init_cudla() except -1 nogil: + if _cyb___py_cudla_init: + return 0 + + return _init_cudla() + + +cpdef dict _inspect_function_pointers(): + global _cyb_func_ptrs + if _cyb_func_ptrs is not None: + return _cyb_func_ptrs + + _check_or_init_cudla() + cdef dict data = {} + global __cudlaGetVersion + data["__cudlaGetVersion"] = <_cyb_intptr_t>__cudlaGetVersion + + global __cudlaDeviceGetCount + data["__cudlaDeviceGetCount"] = <_cyb_intptr_t>__cudlaDeviceGetCount + + global __cudlaCreateDevice + data["__cudlaCreateDevice"] = <_cyb_intptr_t>__cudlaCreateDevice + + global __cudlaMemRegister + data["__cudlaMemRegister"] = <_cyb_intptr_t>__cudlaMemRegister + + global __cudlaModuleLoadFromMemory + data["__cudlaModuleLoadFromMemory"] = <_cyb_intptr_t>__cudlaModuleLoadFromMemory + + global __cudlaModuleGetAttributes + data["__cudlaModuleGetAttributes"] = <_cyb_intptr_t>__cudlaModuleGetAttributes + + global __cudlaModuleUnload + data["__cudlaModuleUnload"] = <_cyb_intptr_t>__cudlaModuleUnload + + global __cudlaSubmitTask + data["__cudlaSubmitTask"] = <_cyb_intptr_t>__cudlaSubmitTask + + global __cudlaDeviceGetAttribute + data["__cudlaDeviceGetAttribute"] = <_cyb_intptr_t>__cudlaDeviceGetAttribute + + global __cudlaMemUnregister + data["__cudlaMemUnregister"] = <_cyb_intptr_t>__cudlaMemUnregister + + global __cudlaGetLastError + data["__cudlaGetLastError"] = <_cyb_intptr_t>__cudlaGetLastError + + global __cudlaDestroyDevice + data["__cudlaDestroyDevice"] = <_cyb_intptr_t>__cudlaDestroyDevice + + global __cudlaSetTaskTimeoutInMs + data["__cudlaSetTaskTimeoutInMs"] = <_cyb_intptr_t>__cudlaSetTaskTimeoutInMs + _cyb_func_ptrs = data + return data + + +cpdef _inspect_function_pointer(str name): + global _cyb_func_ptrs + if _cyb_func_ptrs is None: + _cyb_func_ptrs = _inspect_function_pointers() + return _cyb_func_ptrs[name] + + + + +cdef void* load_library() except* with gil: + cdef uintptr_t handle = load_nvidia_dynamic_lib("cudla")._handle_uint + return handle + + +############################################################################### +# Wrapper functions +############################################################################### + +cdef cudlaStatus _cudlaGetVersion(uint64_t* const version) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil: + global __cudlaGetVersion + _check_or_init_cudla() + if __cudlaGetVersion == NULL: + with gil: + raise FunctionNotFoundError("function cudlaGetVersion is not found") + return (__cudlaGetVersion)( + version) + + +cdef cudlaStatus _cudlaDeviceGetCount(uint64_t* const pNumDevices) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil: + global __cudlaDeviceGetCount + _check_or_init_cudla() + if __cudlaDeviceGetCount == NULL: + with gil: + raise FunctionNotFoundError("function cudlaDeviceGetCount is not found") + return (__cudlaDeviceGetCount)( + pNumDevices) + + +cdef cudlaStatus _cudlaCreateDevice(const uint64_t device, cudlaDevHandle* const devHandle, const uint32_t flags) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil: + global __cudlaCreateDevice + _check_or_init_cudla() + if __cudlaCreateDevice == NULL: + with gil: + raise FunctionNotFoundError("function cudlaCreateDevice is not found") + return (__cudlaCreateDevice)( + device, devHandle, flags) + + +cdef cudlaStatus _cudlaMemRegister(const cudlaDevHandle devHandle, const uint64_t* const ptr, const size_t size, uint64_t** const devPtr, const uint32_t flags) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil: + global __cudlaMemRegister + _check_or_init_cudla() + if __cudlaMemRegister == NULL: + with gil: + raise FunctionNotFoundError("function cudlaMemRegister is not found") + return (__cudlaMemRegister)( + devHandle, ptr, size, devPtr, flags) + + +cdef cudlaStatus _cudlaModuleLoadFromMemory(const cudlaDevHandle devHandle, const uint8_t* const pModule, const size_t moduleSize, cudlaModule* const hModule, const uint32_t flags) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil: + global __cudlaModuleLoadFromMemory + _check_or_init_cudla() + if __cudlaModuleLoadFromMemory == NULL: + with gil: + raise FunctionNotFoundError("function cudlaModuleLoadFromMemory is not found") + return (__cudlaModuleLoadFromMemory)( + devHandle, pModule, moduleSize, hModule, flags) + + +cdef cudlaStatus _cudlaModuleGetAttributes(const cudlaModule hModule, const cudlaModuleAttributeType attrType, cudlaModuleAttribute* const attribute) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil: + global __cudlaModuleGetAttributes + _check_or_init_cudla() + if __cudlaModuleGetAttributes == NULL: + with gil: + raise FunctionNotFoundError("function cudlaModuleGetAttributes is not found") + return (__cudlaModuleGetAttributes)( + hModule, attrType, attribute) + + +cdef cudlaStatus _cudlaModuleUnload(const cudlaModule hModule, const uint32_t flags) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil: + global __cudlaModuleUnload + _check_or_init_cudla() + if __cudlaModuleUnload == NULL: + with gil: + raise FunctionNotFoundError("function cudlaModuleUnload is not found") + return (__cudlaModuleUnload)( + hModule, flags) + + +cdef cudlaStatus _cudlaSubmitTask(const cudlaDevHandle devHandle, const cudlaTask* const ptrToTasks, const uint32_t numTasks, void* const stream, const uint32_t flags) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil: + global __cudlaSubmitTask + _check_or_init_cudla() + if __cudlaSubmitTask == NULL: + with gil: + raise FunctionNotFoundError("function cudlaSubmitTask is not found") + return (__cudlaSubmitTask)( + devHandle, ptrToTasks, numTasks, stream, flags) + + +cdef cudlaStatus _cudlaDeviceGetAttribute(const cudlaDevHandle devHandle, const cudlaDevAttributeType attrib, cudlaDevAttribute* const pAttribute) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil: + global __cudlaDeviceGetAttribute + _check_or_init_cudla() + if __cudlaDeviceGetAttribute == NULL: + with gil: + raise FunctionNotFoundError("function cudlaDeviceGetAttribute is not found") + return (__cudlaDeviceGetAttribute)( + devHandle, attrib, pAttribute) + + +cdef cudlaStatus _cudlaMemUnregister(const cudlaDevHandle devHandle, const uint64_t* const devPtr) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil: + global __cudlaMemUnregister + _check_or_init_cudla() + if __cudlaMemUnregister == NULL: + with gil: + raise FunctionNotFoundError("function cudlaMemUnregister is not found") + return (__cudlaMemUnregister)( + devHandle, devPtr) + + +cdef cudlaStatus _cudlaGetLastError(const cudlaDevHandle devHandle) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil: + global __cudlaGetLastError + _check_or_init_cudla() + if __cudlaGetLastError == NULL: + with gil: + raise FunctionNotFoundError("function cudlaGetLastError is not found") + return (__cudlaGetLastError)( + devHandle) + + +cdef cudlaStatus _cudlaDestroyDevice(const cudlaDevHandle devHandle) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil: + global __cudlaDestroyDevice + _check_or_init_cudla() + if __cudlaDestroyDevice == NULL: + with gil: + raise FunctionNotFoundError("function cudlaDestroyDevice is not found") + return (__cudlaDestroyDevice)( + devHandle) + + +cdef cudlaStatus _cudlaSetTaskTimeoutInMs(const cudlaDevHandle devHandle, const uint32_t timeout) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil: + global __cudlaSetTaskTimeoutInMs + _check_or_init_cudla() + if __cudlaSetTaskTimeoutInMs == NULL: + with gil: + raise FunctionNotFoundError("function cudlaSetTaskTimeoutInMs is not found") + return (__cudlaSetTaskTimeoutInMs)( + devHandle, timeout) diff --git a/cuda_bindings/cuda/bindings/_internal/cudla_windows.pyx b/cuda_bindings/cuda/bindings/_internal/cudla_windows.pyx new file mode 100644 index 00000000000..333ac59e92d --- /dev/null +++ b/cuda_bindings/cuda/bindings/_internal/cudla_windows.pyx @@ -0,0 +1,301 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +# This code was automatically generated across versions from 1.5.0 to 13.3.0. Do not modify it directly. +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=2f2d196de722c29b044dff6aed4e22bd72347a0890d30c885d35780882c6800f + + +# <<<< PREAMBLE CONTENT >>>> + +cdef extern from "": + ctypedef void* HMODULE + void* _cyb_GetProcAddress "GetProcAddress"(HMODULE, const char*) nogil + +from libc.stdint cimport intptr_t as _cyb_intptr_t + +import threading as _cyb_threading + +cdef bint _cyb___py_cudla_init = False +cdef dict _cyb_func_ptrs = None +cdef object _cyb_symbol_lock = _cyb_threading.Lock() + +# <<<< END OF PREAMBLE CONTENT >>>> + +from libc.stdint cimport uintptr_t + +from .utils import FunctionNotFoundError, NotSupportedError + +from cuda.pathfinder import load_nvidia_dynamic_lib + + +############################################################################### +# Wrapper init +############################################################################### + + +cdef void* __cudlaGetVersion = NULL +cdef void* __cudlaDeviceGetCount = NULL +cdef void* __cudlaCreateDevice = NULL +cdef void* __cudlaMemRegister = NULL +cdef void* __cudlaModuleLoadFromMemory = NULL +cdef void* __cudlaModuleGetAttributes = NULL +cdef void* __cudlaModuleUnload = NULL +cdef void* __cudlaSubmitTask = NULL +cdef void* __cudlaDeviceGetAttribute = NULL +cdef void* __cudlaMemUnregister = NULL +cdef void* __cudlaGetLastError = NULL +cdef void* __cudlaDestroyDevice = NULL +cdef void* __cudlaSetTaskTimeoutInMs = NULL + +cdef int _init_cudla() except -1 nogil: + global _cyb___py_cudla_init + + cdef int err + cdef uintptr_t handle + with gil, _cyb_symbol_lock: + if _cyb___py_cudla_init: return 0 + + handle = load_library() + global __cudlaGetVersion + __cudlaGetVersion = _cyb_GetProcAddress(handle, 'cudlaGetVersion') + + global __cudlaDeviceGetCount + __cudlaDeviceGetCount = _cyb_GetProcAddress(handle, 'cudlaDeviceGetCount') + + global __cudlaCreateDevice + __cudlaCreateDevice = _cyb_GetProcAddress(handle, 'cudlaCreateDevice') + + global __cudlaMemRegister + __cudlaMemRegister = _cyb_GetProcAddress(handle, 'cudlaMemRegister') + + global __cudlaModuleLoadFromMemory + __cudlaModuleLoadFromMemory = _cyb_GetProcAddress(handle, 'cudlaModuleLoadFromMemory') + + global __cudlaModuleGetAttributes + __cudlaModuleGetAttributes = _cyb_GetProcAddress(handle, 'cudlaModuleGetAttributes') + + global __cudlaModuleUnload + __cudlaModuleUnload = _cyb_GetProcAddress(handle, 'cudlaModuleUnload') + + global __cudlaSubmitTask + __cudlaSubmitTask = _cyb_GetProcAddress(handle, 'cudlaSubmitTask') + + global __cudlaDeviceGetAttribute + __cudlaDeviceGetAttribute = _cyb_GetProcAddress(handle, 'cudlaDeviceGetAttribute') + + global __cudlaMemUnregister + __cudlaMemUnregister = _cyb_GetProcAddress(handle, 'cudlaMemUnregister') + + global __cudlaGetLastError + __cudlaGetLastError = _cyb_GetProcAddress(handle, 'cudlaGetLastError') + + global __cudlaDestroyDevice + __cudlaDestroyDevice = _cyb_GetProcAddress(handle, 'cudlaDestroyDevice') + + global __cudlaSetTaskTimeoutInMs + __cudlaSetTaskTimeoutInMs = _cyb_GetProcAddress(handle, 'cudlaSetTaskTimeoutInMs') + + _cyb___py_cudla_init = True + return 0 + +cdef inline int _check_or_init_cudla() except -1 nogil: + if _cyb___py_cudla_init: + return 0 + + return _init_cudla() + + +cpdef dict _inspect_function_pointers(): + global _cyb_func_ptrs + if _cyb_func_ptrs is not None: + return _cyb_func_ptrs + + _check_or_init_cudla() + cdef dict data = {} + global __cudlaGetVersion + data["__cudlaGetVersion"] = <_cyb_intptr_t>__cudlaGetVersion + + global __cudlaDeviceGetCount + data["__cudlaDeviceGetCount"] = <_cyb_intptr_t>__cudlaDeviceGetCount + + global __cudlaCreateDevice + data["__cudlaCreateDevice"] = <_cyb_intptr_t>__cudlaCreateDevice + + global __cudlaMemRegister + data["__cudlaMemRegister"] = <_cyb_intptr_t>__cudlaMemRegister + + global __cudlaModuleLoadFromMemory + data["__cudlaModuleLoadFromMemory"] = <_cyb_intptr_t>__cudlaModuleLoadFromMemory + + global __cudlaModuleGetAttributes + data["__cudlaModuleGetAttributes"] = <_cyb_intptr_t>__cudlaModuleGetAttributes + + global __cudlaModuleUnload + data["__cudlaModuleUnload"] = <_cyb_intptr_t>__cudlaModuleUnload + + global __cudlaSubmitTask + data["__cudlaSubmitTask"] = <_cyb_intptr_t>__cudlaSubmitTask + + global __cudlaDeviceGetAttribute + data["__cudlaDeviceGetAttribute"] = <_cyb_intptr_t>__cudlaDeviceGetAttribute + + global __cudlaMemUnregister + data["__cudlaMemUnregister"] = <_cyb_intptr_t>__cudlaMemUnregister + + global __cudlaGetLastError + data["__cudlaGetLastError"] = <_cyb_intptr_t>__cudlaGetLastError + + global __cudlaDestroyDevice + data["__cudlaDestroyDevice"] = <_cyb_intptr_t>__cudlaDestroyDevice + + global __cudlaSetTaskTimeoutInMs + data["__cudlaSetTaskTimeoutInMs"] = <_cyb_intptr_t>__cudlaSetTaskTimeoutInMs + _cyb_func_ptrs = data + return data + + +cpdef _inspect_function_pointer(str name): + global _cyb_func_ptrs + if _cyb_func_ptrs is None: + _cyb_func_ptrs = _inspect_function_pointers() + return _cyb_func_ptrs[name] + + + + +cdef uintptr_t load_library() except* with gil: + return load_nvidia_dynamic_lib("cudla")._handle_uint + + +############################################################################### +# Wrapper functions +############################################################################### + +cdef cudlaStatus _cudlaGetVersion(uint64_t* const version) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil: + global __cudlaGetVersion + _check_or_init_cudla() + if __cudlaGetVersion == NULL: + with gil: + raise FunctionNotFoundError("function cudlaGetVersion is not found") + return (__cudlaGetVersion)( + version) + + +cdef cudlaStatus _cudlaDeviceGetCount(uint64_t* const pNumDevices) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil: + global __cudlaDeviceGetCount + _check_or_init_cudla() + if __cudlaDeviceGetCount == NULL: + with gil: + raise FunctionNotFoundError("function cudlaDeviceGetCount is not found") + return (__cudlaDeviceGetCount)( + pNumDevices) + + +cdef cudlaStatus _cudlaCreateDevice(const uint64_t device, cudlaDevHandle* const devHandle, const uint32_t flags) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil: + global __cudlaCreateDevice + _check_or_init_cudla() + if __cudlaCreateDevice == NULL: + with gil: + raise FunctionNotFoundError("function cudlaCreateDevice is not found") + return (__cudlaCreateDevice)( + device, devHandle, flags) + + +cdef cudlaStatus _cudlaMemRegister(const cudlaDevHandle devHandle, const uint64_t* const ptr, const size_t size, uint64_t** const devPtr, const uint32_t flags) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil: + global __cudlaMemRegister + _check_or_init_cudla() + if __cudlaMemRegister == NULL: + with gil: + raise FunctionNotFoundError("function cudlaMemRegister is not found") + return (__cudlaMemRegister)( + devHandle, ptr, size, devPtr, flags) + + +cdef cudlaStatus _cudlaModuleLoadFromMemory(const cudlaDevHandle devHandle, const uint8_t* const pModule, const size_t moduleSize, cudlaModule* const hModule, const uint32_t flags) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil: + global __cudlaModuleLoadFromMemory + _check_or_init_cudla() + if __cudlaModuleLoadFromMemory == NULL: + with gil: + raise FunctionNotFoundError("function cudlaModuleLoadFromMemory is not found") + return (__cudlaModuleLoadFromMemory)( + devHandle, pModule, moduleSize, hModule, flags) + + +cdef cudlaStatus _cudlaModuleGetAttributes(const cudlaModule hModule, const cudlaModuleAttributeType attrType, cudlaModuleAttribute* const attribute) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil: + global __cudlaModuleGetAttributes + _check_or_init_cudla() + if __cudlaModuleGetAttributes == NULL: + with gil: + raise FunctionNotFoundError("function cudlaModuleGetAttributes is not found") + return (__cudlaModuleGetAttributes)( + hModule, attrType, attribute) + + +cdef cudlaStatus _cudlaModuleUnload(const cudlaModule hModule, const uint32_t flags) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil: + global __cudlaModuleUnload + _check_or_init_cudla() + if __cudlaModuleUnload == NULL: + with gil: + raise FunctionNotFoundError("function cudlaModuleUnload is not found") + return (__cudlaModuleUnload)( + hModule, flags) + + +cdef cudlaStatus _cudlaSubmitTask(const cudlaDevHandle devHandle, const cudlaTask* const ptrToTasks, const uint32_t numTasks, void* const stream, const uint32_t flags) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil: + global __cudlaSubmitTask + _check_or_init_cudla() + if __cudlaSubmitTask == NULL: + with gil: + raise FunctionNotFoundError("function cudlaSubmitTask is not found") + return (__cudlaSubmitTask)( + devHandle, ptrToTasks, numTasks, stream, flags) + + +cdef cudlaStatus _cudlaDeviceGetAttribute(const cudlaDevHandle devHandle, const cudlaDevAttributeType attrib, cudlaDevAttribute* const pAttribute) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil: + global __cudlaDeviceGetAttribute + _check_or_init_cudla() + if __cudlaDeviceGetAttribute == NULL: + with gil: + raise FunctionNotFoundError("function cudlaDeviceGetAttribute is not found") + return (__cudlaDeviceGetAttribute)( + devHandle, attrib, pAttribute) + + +cdef cudlaStatus _cudlaMemUnregister(const cudlaDevHandle devHandle, const uint64_t* const devPtr) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil: + global __cudlaMemUnregister + _check_or_init_cudla() + if __cudlaMemUnregister == NULL: + with gil: + raise FunctionNotFoundError("function cudlaMemUnregister is not found") + return (__cudlaMemUnregister)( + devHandle, devPtr) + + +cdef cudlaStatus _cudlaGetLastError(const cudlaDevHandle devHandle) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil: + global __cudlaGetLastError + _check_or_init_cudla() + if __cudlaGetLastError == NULL: + with gil: + raise FunctionNotFoundError("function cudlaGetLastError is not found") + return (__cudlaGetLastError)( + devHandle) + + +cdef cudlaStatus _cudlaDestroyDevice(const cudlaDevHandle devHandle) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil: + global __cudlaDestroyDevice + _check_or_init_cudla() + if __cudlaDestroyDevice == NULL: + with gil: + raise FunctionNotFoundError("function cudlaDestroyDevice is not found") + return (__cudlaDestroyDevice)( + devHandle) + + +cdef cudlaStatus _cudlaSetTaskTimeoutInMs(const cudlaDevHandle devHandle, const uint32_t timeout) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil: + global __cudlaSetTaskTimeoutInMs + _check_or_init_cudla() + if __cudlaSetTaskTimeoutInMs == NULL: + with gil: + raise FunctionNotFoundError("function cudlaSetTaskTimeoutInMs is not found") + return (__cudlaSetTaskTimeoutInMs)( + devHandle, timeout) diff --git a/cuda_bindings/cuda/bindings/_internal/cufile.pxd b/cuda_bindings/cuda/bindings/_internal/cufile.pxd new file mode 100644 index 00000000000..b8fe03b779d --- /dev/null +++ b/cuda_bindings/cuda/bindings/_internal/cufile.pxd @@ -0,0 +1,57 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +# This code was automatically generated across versions from 12.9.1 to 13.3.0. Do not modify it directly. + +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=b70fdd33eb00b70224c097fb28dd1031d82e8a2930356a4428c93e3bd1b52a86 +from ..cycufile cimport * + + +############################################################################### +# Wrapper functions +############################################################################### + +cdef CUfileError_t _cuFileHandleRegister(CUfileHandle_t* fh, CUfileDescr_t* descr) except?CUFILE_LOADING_ERROR nogil +cdef void _cuFileHandleDeregister(CUfileHandle_t fh) except* nogil +cdef CUfileError_t _cuFileBufRegister(const void* bufPtr_base, size_t length, int flags) except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t _cuFileBufDeregister(const void* bufPtr_base) except?CUFILE_LOADING_ERROR nogil +cdef ssize_t _cuFileRead(CUfileHandle_t fh, void* bufPtr_base, size_t size, off_t file_offset, off_t bufPtr_offset) except* nogil +cdef ssize_t _cuFileWrite(CUfileHandle_t fh, const void* bufPtr_base, size_t size, off_t file_offset, off_t bufPtr_offset) except* nogil +cdef CUfileError_t _cuFileDriverOpen() except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t _cuFileDriverClose() except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t _cuFileDriverClose_v2() except?CUFILE_LOADING_ERROR nogil +cdef long _cuFileUseCount() except* nogil +cdef CUfileError_t _cuFileDriverGetProperties(CUfileDrvProps_t* props) except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t _cuFileDriverSetPollMode(cpp_bool poll, size_t poll_threshold_size) except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t _cuFileDriverSetMaxDirectIOSize(size_t max_direct_io_size) except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t _cuFileDriverSetMaxCacheSize(size_t max_cache_size) except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t _cuFileDriverSetMaxPinnedMemSize(size_t max_pinned_size) except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t _cuFileBatchIOSetUp(CUfileBatchHandle_t* batch_idp, unsigned nr) except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t _cuFileBatchIOSubmit(CUfileBatchHandle_t batch_idp, unsigned nr, CUfileIOParams_t* iocbp, unsigned int flags) except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t _cuFileBatchIOGetStatus(CUfileBatchHandle_t batch_idp, unsigned min_nr, unsigned* nr, CUfileIOEvents_t* iocbp, timespec* timeout) except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t _cuFileBatchIOCancel(CUfileBatchHandle_t batch_idp) except?CUFILE_LOADING_ERROR nogil +cdef void _cuFileBatchIODestroy(CUfileBatchHandle_t batch_idp) except* nogil +cdef CUfileError_t _cuFileReadAsync(CUfileHandle_t fh, void* bufPtr_base, size_t* size_p, off_t* file_offset_p, off_t* bufPtr_offset_p, ssize_t* bytes_read_p, CUstream stream) except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t _cuFileWriteAsync(CUfileHandle_t fh, void* bufPtr_base, size_t* size_p, off_t* file_offset_p, off_t* bufPtr_offset_p, ssize_t* bytes_written_p, CUstream stream) except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t _cuFileStreamRegister(CUstream stream, unsigned flags) except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t _cuFileStreamDeregister(CUstream stream) except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t _cuFileGetVersion(int* version) except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t _cuFileGetParameterSizeT(CUFileSizeTConfigParameter_t param, size_t* value) except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t _cuFileGetParameterBool(CUFileBoolConfigParameter_t param, cpp_bool* value) except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t _cuFileGetParameterString(CUFileStringConfigParameter_t param, char* desc_str, int len) except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t _cuFileSetParameterSizeT(CUFileSizeTConfigParameter_t param, size_t value) except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t _cuFileSetParameterBool(CUFileBoolConfigParameter_t param, cpp_bool value) except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t _cuFileSetParameterString(CUFileStringConfigParameter_t param, const char* desc_str) except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t _cuFileGetParameterMinMaxValue(CUFileSizeTConfigParameter_t param, size_t* min_value, size_t* max_value) except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t _cuFileSetStatsLevel(int level) except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t _cuFileGetStatsLevel(int* level) except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t _cuFileStatsStart() except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t _cuFileStatsStop() except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t _cuFileStatsReset() except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t _cuFileGetStatsL1(CUfileStatsLevel1_t* stats) except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t _cuFileGetStatsL2(CUfileStatsLevel2_t* stats) except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t _cuFileGetStatsL3(CUfileStatsLevel3_t* stats) except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t _cuFileGetBARSizeInKB(int gpuIndex, size_t* barSize) except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t _cuFileSetParameterPosixPoolSlabArray(const size_t* size_values, const size_t* count_values, int len) except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t _cuFileGetParameterPosixPoolSlabArray(size_t* size_values, size_t* count_values, int len) except?CUFILE_LOADING_ERROR nogil diff --git a/cuda_bindings/cuda/bindings/_internal/cufile_linux.pyx b/cuda_bindings/cuda/bindings/_internal/cufile_linux.pyx new file mode 100644 index 00000000000..46c8928d0ba --- /dev/null +++ b/cuda_bindings/cuda/bindings/_internal/cufile_linux.pyx @@ -0,0 +1,983 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +# This code was automatically generated across versions from 12.9.1 to 13.3.0. Do not modify it directly. +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=ae15aefcbc4ccf2d415fb5d6436ae854690559f5561704523ba7d6f45abfc592 + + +# <<<< PREAMBLE CONTENT >>>> + +cdef extern from "": + void* _cyb_dlsym "dlsym"(void*, const char*) nogil + const void * _cyb_RTLD_DEFAULT "RTLD_DEFAULT" + +cimport cython as _cyb_cython +from libc.stdint cimport intptr_t as _cyb_intptr_t + +import threading as _cyb_threading + +cdef bint _cyb___py_cufile_init = False +cdef dict _cyb_func_ptrs = None +cdef object _cyb_symbol_lock = _cyb_threading.Lock() + +# <<<< END OF PREAMBLE CONTENT >>>> + +from libc.stdint cimport uintptr_t + +from .utils import FunctionNotFoundError, NotSupportedError +from cuda.pathfinder import load_nvidia_dynamic_lib + + +############################################################################### +# Wrapper init +############################################################################### + + +cdef void* __cuFileHandleRegister = NULL +cdef void* __cuFileHandleDeregister = NULL +cdef void* __cuFileBufRegister = NULL +cdef void* __cuFileBufDeregister = NULL +cdef void* __cuFileRead = NULL +cdef void* __cuFileWrite = NULL +cdef void* __cuFileDriverOpen = NULL +cdef void* __cuFileDriverClose = NULL +cdef void* __cuFileDriverClose_v2 = NULL +cdef void* __cuFileUseCount = NULL +cdef void* __cuFileDriverGetProperties = NULL +cdef void* __cuFileDriverSetPollMode = NULL +cdef void* __cuFileDriverSetMaxDirectIOSize = NULL +cdef void* __cuFileDriverSetMaxCacheSize = NULL +cdef void* __cuFileDriverSetMaxPinnedMemSize = NULL +cdef void* __cuFileBatchIOSetUp = NULL +cdef void* __cuFileBatchIOSubmit = NULL +cdef void* __cuFileBatchIOGetStatus = NULL +cdef void* __cuFileBatchIOCancel = NULL +cdef void* __cuFileBatchIODestroy = NULL +cdef void* __cuFileReadAsync = NULL +cdef void* __cuFileWriteAsync = NULL +cdef void* __cuFileStreamRegister = NULL +cdef void* __cuFileStreamDeregister = NULL +cdef void* __cuFileGetVersion = NULL +cdef void* __cuFileGetParameterSizeT = NULL +cdef void* __cuFileGetParameterBool = NULL +cdef void* __cuFileGetParameterString = NULL +cdef void* __cuFileSetParameterSizeT = NULL +cdef void* __cuFileSetParameterBool = NULL +cdef void* __cuFileSetParameterString = NULL +cdef void* __cuFileGetParameterMinMaxValue = NULL +cdef void* __cuFileSetStatsLevel = NULL +cdef void* __cuFileGetStatsLevel = NULL +cdef void* __cuFileStatsStart = NULL +cdef void* __cuFileStatsStop = NULL +cdef void* __cuFileStatsReset = NULL +cdef void* __cuFileGetStatsL1 = NULL +cdef void* __cuFileGetStatsL2 = NULL +cdef void* __cuFileGetStatsL3 = NULL +cdef void* __cuFileGetBARSizeInKB = NULL +cdef void* __cuFileSetParameterPosixPoolSlabArray = NULL +cdef void* __cuFileGetParameterPosixPoolSlabArray = NULL + +cdef int _init_cufile() except -1 nogil: + global _cyb___py_cufile_init + cdef void* handle = NULL + with gil, _cyb_symbol_lock: + if _cyb___py_cufile_init: return 0 + + global __cuFileHandleRegister + __cuFileHandleRegister = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'cuFileHandleRegister') + if __cuFileHandleRegister == NULL: + if handle == NULL: + handle = load_library() + __cuFileHandleRegister = _cyb_dlsym(handle, 'cuFileHandleRegister') + + global __cuFileHandleDeregister + __cuFileHandleDeregister = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'cuFileHandleDeregister') + if __cuFileHandleDeregister == NULL: + if handle == NULL: + handle = load_library() + __cuFileHandleDeregister = _cyb_dlsym(handle, 'cuFileHandleDeregister') + + global __cuFileBufRegister + __cuFileBufRegister = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'cuFileBufRegister') + if __cuFileBufRegister == NULL: + if handle == NULL: + handle = load_library() + __cuFileBufRegister = _cyb_dlsym(handle, 'cuFileBufRegister') + + global __cuFileBufDeregister + __cuFileBufDeregister = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'cuFileBufDeregister') + if __cuFileBufDeregister == NULL: + if handle == NULL: + handle = load_library() + __cuFileBufDeregister = _cyb_dlsym(handle, 'cuFileBufDeregister') + + global __cuFileRead + __cuFileRead = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'cuFileRead') + if __cuFileRead == NULL: + if handle == NULL: + handle = load_library() + __cuFileRead = _cyb_dlsym(handle, 'cuFileRead') + + global __cuFileWrite + __cuFileWrite = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'cuFileWrite') + if __cuFileWrite == NULL: + if handle == NULL: + handle = load_library() + __cuFileWrite = _cyb_dlsym(handle, 'cuFileWrite') + + global __cuFileDriverOpen + __cuFileDriverOpen = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'cuFileDriverOpen') + if __cuFileDriverOpen == NULL: + if handle == NULL: + handle = load_library() + __cuFileDriverOpen = _cyb_dlsym(handle, 'cuFileDriverOpen') + + global __cuFileDriverClose + __cuFileDriverClose = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'cuFileDriverClose') + if __cuFileDriverClose == NULL: + if handle == NULL: + handle = load_library() + __cuFileDriverClose = _cyb_dlsym(handle, 'cuFileDriverClose') + + global __cuFileDriverClose_v2 + __cuFileDriverClose_v2 = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'cuFileDriverClose_v2') + if __cuFileDriverClose_v2 == NULL: + if handle == NULL: + handle = load_library() + __cuFileDriverClose_v2 = _cyb_dlsym(handle, 'cuFileDriverClose_v2') + + global __cuFileUseCount + __cuFileUseCount = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'cuFileUseCount') + if __cuFileUseCount == NULL: + if handle == NULL: + handle = load_library() + __cuFileUseCount = _cyb_dlsym(handle, 'cuFileUseCount') + + global __cuFileDriverGetProperties + __cuFileDriverGetProperties = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'cuFileDriverGetProperties') + if __cuFileDriverGetProperties == NULL: + if handle == NULL: + handle = load_library() + __cuFileDriverGetProperties = _cyb_dlsym(handle, 'cuFileDriverGetProperties') + + global __cuFileDriverSetPollMode + __cuFileDriverSetPollMode = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'cuFileDriverSetPollMode') + if __cuFileDriverSetPollMode == NULL: + if handle == NULL: + handle = load_library() + __cuFileDriverSetPollMode = _cyb_dlsym(handle, 'cuFileDriverSetPollMode') + + global __cuFileDriverSetMaxDirectIOSize + __cuFileDriverSetMaxDirectIOSize = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'cuFileDriverSetMaxDirectIOSize') + if __cuFileDriverSetMaxDirectIOSize == NULL: + if handle == NULL: + handle = load_library() + __cuFileDriverSetMaxDirectIOSize = _cyb_dlsym(handle, 'cuFileDriverSetMaxDirectIOSize') + + global __cuFileDriverSetMaxCacheSize + __cuFileDriverSetMaxCacheSize = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'cuFileDriverSetMaxCacheSize') + if __cuFileDriverSetMaxCacheSize == NULL: + if handle == NULL: + handle = load_library() + __cuFileDriverSetMaxCacheSize = _cyb_dlsym(handle, 'cuFileDriverSetMaxCacheSize') + + global __cuFileDriverSetMaxPinnedMemSize + __cuFileDriverSetMaxPinnedMemSize = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'cuFileDriverSetMaxPinnedMemSize') + if __cuFileDriverSetMaxPinnedMemSize == NULL: + if handle == NULL: + handle = load_library() + __cuFileDriverSetMaxPinnedMemSize = _cyb_dlsym(handle, 'cuFileDriverSetMaxPinnedMemSize') + + global __cuFileBatchIOSetUp + __cuFileBatchIOSetUp = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'cuFileBatchIOSetUp') + if __cuFileBatchIOSetUp == NULL: + if handle == NULL: + handle = load_library() + __cuFileBatchIOSetUp = _cyb_dlsym(handle, 'cuFileBatchIOSetUp') + + global __cuFileBatchIOSubmit + __cuFileBatchIOSubmit = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'cuFileBatchIOSubmit') + if __cuFileBatchIOSubmit == NULL: + if handle == NULL: + handle = load_library() + __cuFileBatchIOSubmit = _cyb_dlsym(handle, 'cuFileBatchIOSubmit') + + global __cuFileBatchIOGetStatus + __cuFileBatchIOGetStatus = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'cuFileBatchIOGetStatus') + if __cuFileBatchIOGetStatus == NULL: + if handle == NULL: + handle = load_library() + __cuFileBatchIOGetStatus = _cyb_dlsym(handle, 'cuFileBatchIOGetStatus') + + global __cuFileBatchIOCancel + __cuFileBatchIOCancel = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'cuFileBatchIOCancel') + if __cuFileBatchIOCancel == NULL: + if handle == NULL: + handle = load_library() + __cuFileBatchIOCancel = _cyb_dlsym(handle, 'cuFileBatchIOCancel') + + global __cuFileBatchIODestroy + __cuFileBatchIODestroy = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'cuFileBatchIODestroy') + if __cuFileBatchIODestroy == NULL: + if handle == NULL: + handle = load_library() + __cuFileBatchIODestroy = _cyb_dlsym(handle, 'cuFileBatchIODestroy') + + global __cuFileReadAsync + __cuFileReadAsync = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'cuFileReadAsync') + if __cuFileReadAsync == NULL: + if handle == NULL: + handle = load_library() + __cuFileReadAsync = _cyb_dlsym(handle, 'cuFileReadAsync') + + global __cuFileWriteAsync + __cuFileWriteAsync = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'cuFileWriteAsync') + if __cuFileWriteAsync == NULL: + if handle == NULL: + handle = load_library() + __cuFileWriteAsync = _cyb_dlsym(handle, 'cuFileWriteAsync') + + global __cuFileStreamRegister + __cuFileStreamRegister = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'cuFileStreamRegister') + if __cuFileStreamRegister == NULL: + if handle == NULL: + handle = load_library() + __cuFileStreamRegister = _cyb_dlsym(handle, 'cuFileStreamRegister') + + global __cuFileStreamDeregister + __cuFileStreamDeregister = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'cuFileStreamDeregister') + if __cuFileStreamDeregister == NULL: + if handle == NULL: + handle = load_library() + __cuFileStreamDeregister = _cyb_dlsym(handle, 'cuFileStreamDeregister') + + global __cuFileGetVersion + __cuFileGetVersion = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'cuFileGetVersion') + if __cuFileGetVersion == NULL: + if handle == NULL: + handle = load_library() + __cuFileGetVersion = _cyb_dlsym(handle, 'cuFileGetVersion') + + global __cuFileGetParameterSizeT + __cuFileGetParameterSizeT = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'cuFileGetParameterSizeT') + if __cuFileGetParameterSizeT == NULL: + if handle == NULL: + handle = load_library() + __cuFileGetParameterSizeT = _cyb_dlsym(handle, 'cuFileGetParameterSizeT') + + global __cuFileGetParameterBool + __cuFileGetParameterBool = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'cuFileGetParameterBool') + if __cuFileGetParameterBool == NULL: + if handle == NULL: + handle = load_library() + __cuFileGetParameterBool = _cyb_dlsym(handle, 'cuFileGetParameterBool') + + global __cuFileGetParameterString + __cuFileGetParameterString = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'cuFileGetParameterString') + if __cuFileGetParameterString == NULL: + if handle == NULL: + handle = load_library() + __cuFileGetParameterString = _cyb_dlsym(handle, 'cuFileGetParameterString') + + global __cuFileSetParameterSizeT + __cuFileSetParameterSizeT = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'cuFileSetParameterSizeT') + if __cuFileSetParameterSizeT == NULL: + if handle == NULL: + handle = load_library() + __cuFileSetParameterSizeT = _cyb_dlsym(handle, 'cuFileSetParameterSizeT') + + global __cuFileSetParameterBool + __cuFileSetParameterBool = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'cuFileSetParameterBool') + if __cuFileSetParameterBool == NULL: + if handle == NULL: + handle = load_library() + __cuFileSetParameterBool = _cyb_dlsym(handle, 'cuFileSetParameterBool') + + global __cuFileSetParameterString + __cuFileSetParameterString = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'cuFileSetParameterString') + if __cuFileSetParameterString == NULL: + if handle == NULL: + handle = load_library() + __cuFileSetParameterString = _cyb_dlsym(handle, 'cuFileSetParameterString') + + global __cuFileGetParameterMinMaxValue + __cuFileGetParameterMinMaxValue = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'cuFileGetParameterMinMaxValue') + if __cuFileGetParameterMinMaxValue == NULL: + if handle == NULL: + handle = load_library() + __cuFileGetParameterMinMaxValue = _cyb_dlsym(handle, 'cuFileGetParameterMinMaxValue') + + global __cuFileSetStatsLevel + __cuFileSetStatsLevel = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'cuFileSetStatsLevel') + if __cuFileSetStatsLevel == NULL: + if handle == NULL: + handle = load_library() + __cuFileSetStatsLevel = _cyb_dlsym(handle, 'cuFileSetStatsLevel') + + global __cuFileGetStatsLevel + __cuFileGetStatsLevel = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'cuFileGetStatsLevel') + if __cuFileGetStatsLevel == NULL: + if handle == NULL: + handle = load_library() + __cuFileGetStatsLevel = _cyb_dlsym(handle, 'cuFileGetStatsLevel') + + global __cuFileStatsStart + __cuFileStatsStart = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'cuFileStatsStart') + if __cuFileStatsStart == NULL: + if handle == NULL: + handle = load_library() + __cuFileStatsStart = _cyb_dlsym(handle, 'cuFileStatsStart') + + global __cuFileStatsStop + __cuFileStatsStop = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'cuFileStatsStop') + if __cuFileStatsStop == NULL: + if handle == NULL: + handle = load_library() + __cuFileStatsStop = _cyb_dlsym(handle, 'cuFileStatsStop') + + global __cuFileStatsReset + __cuFileStatsReset = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'cuFileStatsReset') + if __cuFileStatsReset == NULL: + if handle == NULL: + handle = load_library() + __cuFileStatsReset = _cyb_dlsym(handle, 'cuFileStatsReset') + + global __cuFileGetStatsL1 + __cuFileGetStatsL1 = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'cuFileGetStatsL1') + if __cuFileGetStatsL1 == NULL: + if handle == NULL: + handle = load_library() + __cuFileGetStatsL1 = _cyb_dlsym(handle, 'cuFileGetStatsL1') + + global __cuFileGetStatsL2 + __cuFileGetStatsL2 = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'cuFileGetStatsL2') + if __cuFileGetStatsL2 == NULL: + if handle == NULL: + handle = load_library() + __cuFileGetStatsL2 = _cyb_dlsym(handle, 'cuFileGetStatsL2') + + global __cuFileGetStatsL3 + __cuFileGetStatsL3 = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'cuFileGetStatsL3') + if __cuFileGetStatsL3 == NULL: + if handle == NULL: + handle = load_library() + __cuFileGetStatsL3 = _cyb_dlsym(handle, 'cuFileGetStatsL3') + + global __cuFileGetBARSizeInKB + __cuFileGetBARSizeInKB = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'cuFileGetBARSizeInKB') + if __cuFileGetBARSizeInKB == NULL: + if handle == NULL: + handle = load_library() + __cuFileGetBARSizeInKB = _cyb_dlsym(handle, 'cuFileGetBARSizeInKB') + + global __cuFileSetParameterPosixPoolSlabArray + __cuFileSetParameterPosixPoolSlabArray = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'cuFileSetParameterPosixPoolSlabArray') + if __cuFileSetParameterPosixPoolSlabArray == NULL: + if handle == NULL: + handle = load_library() + __cuFileSetParameterPosixPoolSlabArray = _cyb_dlsym(handle, 'cuFileSetParameterPosixPoolSlabArray') + + global __cuFileGetParameterPosixPoolSlabArray + __cuFileGetParameterPosixPoolSlabArray = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'cuFileGetParameterPosixPoolSlabArray') + if __cuFileGetParameterPosixPoolSlabArray == NULL: + if handle == NULL: + handle = load_library() + __cuFileGetParameterPosixPoolSlabArray = _cyb_dlsym(handle, 'cuFileGetParameterPosixPoolSlabArray') + + _cyb___py_cufile_init = True + return 0 + +cdef inline int _check_or_init_cufile() except -1 nogil: + if _cyb___py_cufile_init: + return 0 + + return _init_cufile() + + +cpdef dict _inspect_function_pointers(): + global _cyb_func_ptrs + if _cyb_func_ptrs is not None: + return _cyb_func_ptrs + + _check_or_init_cufile() + cdef dict data = {} + global __cuFileHandleRegister + data["__cuFileHandleRegister"] = <_cyb_intptr_t>__cuFileHandleRegister + + global __cuFileHandleDeregister + data["__cuFileHandleDeregister"] = <_cyb_intptr_t>__cuFileHandleDeregister + + global __cuFileBufRegister + data["__cuFileBufRegister"] = <_cyb_intptr_t>__cuFileBufRegister + + global __cuFileBufDeregister + data["__cuFileBufDeregister"] = <_cyb_intptr_t>__cuFileBufDeregister + + global __cuFileRead + data["__cuFileRead"] = <_cyb_intptr_t>__cuFileRead + + global __cuFileWrite + data["__cuFileWrite"] = <_cyb_intptr_t>__cuFileWrite + + global __cuFileDriverOpen + data["__cuFileDriverOpen"] = <_cyb_intptr_t>__cuFileDriverOpen + + global __cuFileDriverClose + data["__cuFileDriverClose"] = <_cyb_intptr_t>__cuFileDriverClose + + global __cuFileDriverClose_v2 + data["__cuFileDriverClose_v2"] = <_cyb_intptr_t>__cuFileDriverClose_v2 + + global __cuFileUseCount + data["__cuFileUseCount"] = <_cyb_intptr_t>__cuFileUseCount + + global __cuFileDriverGetProperties + data["__cuFileDriverGetProperties"] = <_cyb_intptr_t>__cuFileDriverGetProperties + + global __cuFileDriverSetPollMode + data["__cuFileDriverSetPollMode"] = <_cyb_intptr_t>__cuFileDriverSetPollMode + + global __cuFileDriverSetMaxDirectIOSize + data["__cuFileDriverSetMaxDirectIOSize"] = <_cyb_intptr_t>__cuFileDriverSetMaxDirectIOSize + + global __cuFileDriverSetMaxCacheSize + data["__cuFileDriverSetMaxCacheSize"] = <_cyb_intptr_t>__cuFileDriverSetMaxCacheSize + + global __cuFileDriverSetMaxPinnedMemSize + data["__cuFileDriverSetMaxPinnedMemSize"] = <_cyb_intptr_t>__cuFileDriverSetMaxPinnedMemSize + + global __cuFileBatchIOSetUp + data["__cuFileBatchIOSetUp"] = <_cyb_intptr_t>__cuFileBatchIOSetUp + + global __cuFileBatchIOSubmit + data["__cuFileBatchIOSubmit"] = <_cyb_intptr_t>__cuFileBatchIOSubmit + + global __cuFileBatchIOGetStatus + data["__cuFileBatchIOGetStatus"] = <_cyb_intptr_t>__cuFileBatchIOGetStatus + + global __cuFileBatchIOCancel + data["__cuFileBatchIOCancel"] = <_cyb_intptr_t>__cuFileBatchIOCancel + + global __cuFileBatchIODestroy + data["__cuFileBatchIODestroy"] = <_cyb_intptr_t>__cuFileBatchIODestroy + + global __cuFileReadAsync + data["__cuFileReadAsync"] = <_cyb_intptr_t>__cuFileReadAsync + + global __cuFileWriteAsync + data["__cuFileWriteAsync"] = <_cyb_intptr_t>__cuFileWriteAsync + + global __cuFileStreamRegister + data["__cuFileStreamRegister"] = <_cyb_intptr_t>__cuFileStreamRegister + + global __cuFileStreamDeregister + data["__cuFileStreamDeregister"] = <_cyb_intptr_t>__cuFileStreamDeregister + + global __cuFileGetVersion + data["__cuFileGetVersion"] = <_cyb_intptr_t>__cuFileGetVersion + + global __cuFileGetParameterSizeT + data["__cuFileGetParameterSizeT"] = <_cyb_intptr_t>__cuFileGetParameterSizeT + + global __cuFileGetParameterBool + data["__cuFileGetParameterBool"] = <_cyb_intptr_t>__cuFileGetParameterBool + + global __cuFileGetParameterString + data["__cuFileGetParameterString"] = <_cyb_intptr_t>__cuFileGetParameterString + + global __cuFileSetParameterSizeT + data["__cuFileSetParameterSizeT"] = <_cyb_intptr_t>__cuFileSetParameterSizeT + + global __cuFileSetParameterBool + data["__cuFileSetParameterBool"] = <_cyb_intptr_t>__cuFileSetParameterBool + + global __cuFileSetParameterString + data["__cuFileSetParameterString"] = <_cyb_intptr_t>__cuFileSetParameterString + + global __cuFileGetParameterMinMaxValue + data["__cuFileGetParameterMinMaxValue"] = <_cyb_intptr_t>__cuFileGetParameterMinMaxValue + + global __cuFileSetStatsLevel + data["__cuFileSetStatsLevel"] = <_cyb_intptr_t>__cuFileSetStatsLevel + + global __cuFileGetStatsLevel + data["__cuFileGetStatsLevel"] = <_cyb_intptr_t>__cuFileGetStatsLevel + + global __cuFileStatsStart + data["__cuFileStatsStart"] = <_cyb_intptr_t>__cuFileStatsStart + + global __cuFileStatsStop + data["__cuFileStatsStop"] = <_cyb_intptr_t>__cuFileStatsStop + + global __cuFileStatsReset + data["__cuFileStatsReset"] = <_cyb_intptr_t>__cuFileStatsReset + + global __cuFileGetStatsL1 + data["__cuFileGetStatsL1"] = <_cyb_intptr_t>__cuFileGetStatsL1 + + global __cuFileGetStatsL2 + data["__cuFileGetStatsL2"] = <_cyb_intptr_t>__cuFileGetStatsL2 + + global __cuFileGetStatsL3 + data["__cuFileGetStatsL3"] = <_cyb_intptr_t>__cuFileGetStatsL3 + + global __cuFileGetBARSizeInKB + data["__cuFileGetBARSizeInKB"] = <_cyb_intptr_t>__cuFileGetBARSizeInKB + + global __cuFileSetParameterPosixPoolSlabArray + data["__cuFileSetParameterPosixPoolSlabArray"] = <_cyb_intptr_t>__cuFileSetParameterPosixPoolSlabArray + + global __cuFileGetParameterPosixPoolSlabArray + data["__cuFileGetParameterPosixPoolSlabArray"] = <_cyb_intptr_t>__cuFileGetParameterPosixPoolSlabArray + _cyb_func_ptrs = data + return data + + +cpdef _inspect_function_pointer(str name): + global _cyb_func_ptrs + if _cyb_func_ptrs is None: + _cyb_func_ptrs = _inspect_function_pointers() + return _cyb_func_ptrs[name] + + + + +cdef void* load_library() except* with gil: + cdef uintptr_t handle = load_nvidia_dynamic_lib("cufile")._handle_uint + return handle + + +############################################################################### +# Wrapper functions + +cdef CUfileError_t _cuFileHandleRegister(CUfileHandle_t* fh, CUfileDescr_t* descr) except?CUFILE_LOADING_ERROR nogil: + global __cuFileHandleRegister + _check_or_init_cufile() + if __cuFileHandleRegister == NULL: + with gil: + raise FunctionNotFoundError("function cuFileHandleRegister is not found") + return (__cuFileHandleRegister)( + fh, descr) + + +@_cyb_cython.show_performance_hints(False) +cdef void _cuFileHandleDeregister(CUfileHandle_t fh) except* nogil: + global __cuFileHandleDeregister + _check_or_init_cufile() + if __cuFileHandleDeregister == NULL: + with gil: + raise FunctionNotFoundError("function cuFileHandleDeregister is not found") + (__cuFileHandleDeregister)( + fh) + + +cdef CUfileError_t _cuFileBufRegister(const void* bufPtr_base, size_t length, int flags) except?CUFILE_LOADING_ERROR nogil: + global __cuFileBufRegister + _check_or_init_cufile() + if __cuFileBufRegister == NULL: + with gil: + raise FunctionNotFoundError("function cuFileBufRegister is not found") + return (__cuFileBufRegister)( + bufPtr_base, length, flags) + + +cdef CUfileError_t _cuFileBufDeregister(const void* bufPtr_base) except?CUFILE_LOADING_ERROR nogil: + global __cuFileBufDeregister + _check_or_init_cufile() + if __cuFileBufDeregister == NULL: + with gil: + raise FunctionNotFoundError("function cuFileBufDeregister is not found") + return (__cuFileBufDeregister)( + bufPtr_base) + + +cdef ssize_t _cuFileRead(CUfileHandle_t fh, void* bufPtr_base, size_t size, off_t file_offset, off_t bufPtr_offset) except* nogil: + global __cuFileRead + _check_or_init_cufile() + if __cuFileRead == NULL: + with gil: + raise FunctionNotFoundError("function cuFileRead is not found") + return (__cuFileRead)( + fh, bufPtr_base, size, file_offset, bufPtr_offset) + + +cdef ssize_t _cuFileWrite(CUfileHandle_t fh, const void* bufPtr_base, size_t size, off_t file_offset, off_t bufPtr_offset) except* nogil: + global __cuFileWrite + _check_or_init_cufile() + if __cuFileWrite == NULL: + with gil: + raise FunctionNotFoundError("function cuFileWrite is not found") + return (__cuFileWrite)( + fh, bufPtr_base, size, file_offset, bufPtr_offset) + + +cdef CUfileError_t _cuFileDriverOpen() except?CUFILE_LOADING_ERROR nogil: + global __cuFileDriverOpen + _check_or_init_cufile() + if __cuFileDriverOpen == NULL: + with gil: + raise FunctionNotFoundError("function cuFileDriverOpen is not found") + return (__cuFileDriverOpen)( + ) + + +cdef CUfileError_t _cuFileDriverClose() except?CUFILE_LOADING_ERROR nogil: + global __cuFileDriverClose + _check_or_init_cufile() + if __cuFileDriverClose == NULL: + with gil: + raise FunctionNotFoundError("function cuFileDriverClose is not found") + return (__cuFileDriverClose)( + ) + + +cdef CUfileError_t _cuFileDriverClose_v2() except?CUFILE_LOADING_ERROR nogil: + global __cuFileDriverClose_v2 + _check_or_init_cufile() + if __cuFileDriverClose_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuFileDriverClose_v2 is not found") + return (__cuFileDriverClose_v2)( + ) + + +cdef long _cuFileUseCount() except* nogil: + global __cuFileUseCount + _check_or_init_cufile() + if __cuFileUseCount == NULL: + with gil: + raise FunctionNotFoundError("function cuFileUseCount is not found") + return (__cuFileUseCount)( + ) + + +cdef CUfileError_t _cuFileDriverGetProperties(CUfileDrvProps_t* props) except?CUFILE_LOADING_ERROR nogil: + global __cuFileDriverGetProperties + _check_or_init_cufile() + if __cuFileDriverGetProperties == NULL: + with gil: + raise FunctionNotFoundError("function cuFileDriverGetProperties is not found") + return (__cuFileDriverGetProperties)( + props) + + +cdef CUfileError_t _cuFileDriverSetPollMode(cpp_bool poll, size_t poll_threshold_size) except?CUFILE_LOADING_ERROR nogil: + global __cuFileDriverSetPollMode + _check_or_init_cufile() + if __cuFileDriverSetPollMode == NULL: + with gil: + raise FunctionNotFoundError("function cuFileDriverSetPollMode is not found") + return (__cuFileDriverSetPollMode)( + poll, poll_threshold_size) + + +cdef CUfileError_t _cuFileDriverSetMaxDirectIOSize(size_t max_direct_io_size) except?CUFILE_LOADING_ERROR nogil: + global __cuFileDriverSetMaxDirectIOSize + _check_or_init_cufile() + if __cuFileDriverSetMaxDirectIOSize == NULL: + with gil: + raise FunctionNotFoundError("function cuFileDriverSetMaxDirectIOSize is not found") + return (__cuFileDriverSetMaxDirectIOSize)( + max_direct_io_size) + + +cdef CUfileError_t _cuFileDriverSetMaxCacheSize(size_t max_cache_size) except?CUFILE_LOADING_ERROR nogil: + global __cuFileDriverSetMaxCacheSize + _check_or_init_cufile() + if __cuFileDriverSetMaxCacheSize == NULL: + with gil: + raise FunctionNotFoundError("function cuFileDriverSetMaxCacheSize is not found") + return (__cuFileDriverSetMaxCacheSize)( + max_cache_size) + + +cdef CUfileError_t _cuFileDriverSetMaxPinnedMemSize(size_t max_pinned_size) except?CUFILE_LOADING_ERROR nogil: + global __cuFileDriverSetMaxPinnedMemSize + _check_or_init_cufile() + if __cuFileDriverSetMaxPinnedMemSize == NULL: + with gil: + raise FunctionNotFoundError("function cuFileDriverSetMaxPinnedMemSize is not found") + return (__cuFileDriverSetMaxPinnedMemSize)( + max_pinned_size) + + +cdef CUfileError_t _cuFileBatchIOSetUp(CUfileBatchHandle_t* batch_idp, unsigned nr) except?CUFILE_LOADING_ERROR nogil: + global __cuFileBatchIOSetUp + _check_or_init_cufile() + if __cuFileBatchIOSetUp == NULL: + with gil: + raise FunctionNotFoundError("function cuFileBatchIOSetUp is not found") + return (__cuFileBatchIOSetUp)( + batch_idp, nr) + + +cdef CUfileError_t _cuFileBatchIOSubmit(CUfileBatchHandle_t batch_idp, unsigned nr, CUfileIOParams_t* iocbp, unsigned int flags) except?CUFILE_LOADING_ERROR nogil: + global __cuFileBatchIOSubmit + _check_or_init_cufile() + if __cuFileBatchIOSubmit == NULL: + with gil: + raise FunctionNotFoundError("function cuFileBatchIOSubmit is not found") + return (__cuFileBatchIOSubmit)( + batch_idp, nr, iocbp, flags) + + +cdef CUfileError_t _cuFileBatchIOGetStatus(CUfileBatchHandle_t batch_idp, unsigned min_nr, unsigned* nr, CUfileIOEvents_t* iocbp, timespec* timeout) except?CUFILE_LOADING_ERROR nogil: + global __cuFileBatchIOGetStatus + _check_or_init_cufile() + if __cuFileBatchIOGetStatus == NULL: + with gil: + raise FunctionNotFoundError("function cuFileBatchIOGetStatus is not found") + return (__cuFileBatchIOGetStatus)( + batch_idp, min_nr, nr, iocbp, timeout) + + +cdef CUfileError_t _cuFileBatchIOCancel(CUfileBatchHandle_t batch_idp) except?CUFILE_LOADING_ERROR nogil: + global __cuFileBatchIOCancel + _check_or_init_cufile() + if __cuFileBatchIOCancel == NULL: + with gil: + raise FunctionNotFoundError("function cuFileBatchIOCancel is not found") + return (__cuFileBatchIOCancel)( + batch_idp) + + +@_cyb_cython.show_performance_hints(False) +cdef void _cuFileBatchIODestroy(CUfileBatchHandle_t batch_idp) except* nogil: + global __cuFileBatchIODestroy + _check_or_init_cufile() + if __cuFileBatchIODestroy == NULL: + with gil: + raise FunctionNotFoundError("function cuFileBatchIODestroy is not found") + (__cuFileBatchIODestroy)( + batch_idp) + + +cdef CUfileError_t _cuFileReadAsync(CUfileHandle_t fh, void* bufPtr_base, size_t* size_p, off_t* file_offset_p, off_t* bufPtr_offset_p, ssize_t* bytes_read_p, CUstream stream) except?CUFILE_LOADING_ERROR nogil: + global __cuFileReadAsync + _check_or_init_cufile() + if __cuFileReadAsync == NULL: + with gil: + raise FunctionNotFoundError("function cuFileReadAsync is not found") + return (__cuFileReadAsync)( + fh, bufPtr_base, size_p, file_offset_p, bufPtr_offset_p, bytes_read_p, stream) + + +cdef CUfileError_t _cuFileWriteAsync(CUfileHandle_t fh, void* bufPtr_base, size_t* size_p, off_t* file_offset_p, off_t* bufPtr_offset_p, ssize_t* bytes_written_p, CUstream stream) except?CUFILE_LOADING_ERROR nogil: + global __cuFileWriteAsync + _check_or_init_cufile() + if __cuFileWriteAsync == NULL: + with gil: + raise FunctionNotFoundError("function cuFileWriteAsync is not found") + return (__cuFileWriteAsync)( + fh, bufPtr_base, size_p, file_offset_p, bufPtr_offset_p, bytes_written_p, stream) + + +cdef CUfileError_t _cuFileStreamRegister(CUstream stream, unsigned flags) except?CUFILE_LOADING_ERROR nogil: + global __cuFileStreamRegister + _check_or_init_cufile() + if __cuFileStreamRegister == NULL: + with gil: + raise FunctionNotFoundError("function cuFileStreamRegister is not found") + return (__cuFileStreamRegister)( + stream, flags) + + +cdef CUfileError_t _cuFileStreamDeregister(CUstream stream) except?CUFILE_LOADING_ERROR nogil: + global __cuFileStreamDeregister + _check_or_init_cufile() + if __cuFileStreamDeregister == NULL: + with gil: + raise FunctionNotFoundError("function cuFileStreamDeregister is not found") + return (__cuFileStreamDeregister)( + stream) + + +cdef CUfileError_t _cuFileGetVersion(int* version) except?CUFILE_LOADING_ERROR nogil: + global __cuFileGetVersion + _check_or_init_cufile() + if __cuFileGetVersion == NULL: + with gil: + raise FunctionNotFoundError("function cuFileGetVersion is not found") + return (__cuFileGetVersion)( + version) + + +cdef CUfileError_t _cuFileGetParameterSizeT(CUFileSizeTConfigParameter_t param, size_t* value) except?CUFILE_LOADING_ERROR nogil: + global __cuFileGetParameterSizeT + _check_or_init_cufile() + if __cuFileGetParameterSizeT == NULL: + with gil: + raise FunctionNotFoundError("function cuFileGetParameterSizeT is not found") + return (__cuFileGetParameterSizeT)( + param, value) + + +cdef CUfileError_t _cuFileGetParameterBool(CUFileBoolConfigParameter_t param, cpp_bool* value) except?CUFILE_LOADING_ERROR nogil: + global __cuFileGetParameterBool + _check_or_init_cufile() + if __cuFileGetParameterBool == NULL: + with gil: + raise FunctionNotFoundError("function cuFileGetParameterBool is not found") + return (__cuFileGetParameterBool)( + param, value) + + +cdef CUfileError_t _cuFileGetParameterString(CUFileStringConfigParameter_t param, char* desc_str, int len) except?CUFILE_LOADING_ERROR nogil: + global __cuFileGetParameterString + _check_or_init_cufile() + if __cuFileGetParameterString == NULL: + with gil: + raise FunctionNotFoundError("function cuFileGetParameterString is not found") + return (__cuFileGetParameterString)( + param, desc_str, len) + + +cdef CUfileError_t _cuFileSetParameterSizeT(CUFileSizeTConfigParameter_t param, size_t value) except?CUFILE_LOADING_ERROR nogil: + global __cuFileSetParameterSizeT + _check_or_init_cufile() + if __cuFileSetParameterSizeT == NULL: + with gil: + raise FunctionNotFoundError("function cuFileSetParameterSizeT is not found") + return (__cuFileSetParameterSizeT)( + param, value) + + +cdef CUfileError_t _cuFileSetParameterBool(CUFileBoolConfigParameter_t param, cpp_bool value) except?CUFILE_LOADING_ERROR nogil: + global __cuFileSetParameterBool + _check_or_init_cufile() + if __cuFileSetParameterBool == NULL: + with gil: + raise FunctionNotFoundError("function cuFileSetParameterBool is not found") + return (__cuFileSetParameterBool)( + param, value) + + +cdef CUfileError_t _cuFileSetParameterString(CUFileStringConfigParameter_t param, const char* desc_str) except?CUFILE_LOADING_ERROR nogil: + global __cuFileSetParameterString + _check_or_init_cufile() + if __cuFileSetParameterString == NULL: + with gil: + raise FunctionNotFoundError("function cuFileSetParameterString is not found") + return (__cuFileSetParameterString)( + param, desc_str) + + +cdef CUfileError_t _cuFileGetParameterMinMaxValue(CUFileSizeTConfigParameter_t param, size_t* min_value, size_t* max_value) except?CUFILE_LOADING_ERROR nogil: + global __cuFileGetParameterMinMaxValue + _check_or_init_cufile() + if __cuFileGetParameterMinMaxValue == NULL: + with gil: + raise FunctionNotFoundError("function cuFileGetParameterMinMaxValue is not found") + return (__cuFileGetParameterMinMaxValue)( + param, min_value, max_value) + + +cdef CUfileError_t _cuFileSetStatsLevel(int level) except?CUFILE_LOADING_ERROR nogil: + global __cuFileSetStatsLevel + _check_or_init_cufile() + if __cuFileSetStatsLevel == NULL: + with gil: + raise FunctionNotFoundError("function cuFileSetStatsLevel is not found") + return (__cuFileSetStatsLevel)( + level) + + +cdef CUfileError_t _cuFileGetStatsLevel(int* level) except?CUFILE_LOADING_ERROR nogil: + global __cuFileGetStatsLevel + _check_or_init_cufile() + if __cuFileGetStatsLevel == NULL: + with gil: + raise FunctionNotFoundError("function cuFileGetStatsLevel is not found") + return (__cuFileGetStatsLevel)( + level) + + +cdef CUfileError_t _cuFileStatsStart() except?CUFILE_LOADING_ERROR nogil: + global __cuFileStatsStart + _check_or_init_cufile() + if __cuFileStatsStart == NULL: + with gil: + raise FunctionNotFoundError("function cuFileStatsStart is not found") + return (__cuFileStatsStart)( + ) + + +cdef CUfileError_t _cuFileStatsStop() except?CUFILE_LOADING_ERROR nogil: + global __cuFileStatsStop + _check_or_init_cufile() + if __cuFileStatsStop == NULL: + with gil: + raise FunctionNotFoundError("function cuFileStatsStop is not found") + return (__cuFileStatsStop)( + ) + + +cdef CUfileError_t _cuFileStatsReset() except?CUFILE_LOADING_ERROR nogil: + global __cuFileStatsReset + _check_or_init_cufile() + if __cuFileStatsReset == NULL: + with gil: + raise FunctionNotFoundError("function cuFileStatsReset is not found") + return (__cuFileStatsReset)( + ) + + +cdef CUfileError_t _cuFileGetStatsL1(CUfileStatsLevel1_t* stats) except?CUFILE_LOADING_ERROR nogil: + global __cuFileGetStatsL1 + _check_or_init_cufile() + if __cuFileGetStatsL1 == NULL: + with gil: + raise FunctionNotFoundError("function cuFileGetStatsL1 is not found") + return (__cuFileGetStatsL1)( + stats) + + +cdef CUfileError_t _cuFileGetStatsL2(CUfileStatsLevel2_t* stats) except?CUFILE_LOADING_ERROR nogil: + global __cuFileGetStatsL2 + _check_or_init_cufile() + if __cuFileGetStatsL2 == NULL: + with gil: + raise FunctionNotFoundError("function cuFileGetStatsL2 is not found") + return (__cuFileGetStatsL2)( + stats) + + +cdef CUfileError_t _cuFileGetStatsL3(CUfileStatsLevel3_t* stats) except?CUFILE_LOADING_ERROR nogil: + global __cuFileGetStatsL3 + _check_or_init_cufile() + if __cuFileGetStatsL3 == NULL: + with gil: + raise FunctionNotFoundError("function cuFileGetStatsL3 is not found") + return (__cuFileGetStatsL3)( + stats) + + +cdef CUfileError_t _cuFileGetBARSizeInKB(int gpuIndex, size_t* barSize) except?CUFILE_LOADING_ERROR nogil: + global __cuFileGetBARSizeInKB + _check_or_init_cufile() + if __cuFileGetBARSizeInKB == NULL: + with gil: + raise FunctionNotFoundError("function cuFileGetBARSizeInKB is not found") + return (__cuFileGetBARSizeInKB)( + gpuIndex, barSize) + + +cdef CUfileError_t _cuFileSetParameterPosixPoolSlabArray(const size_t* size_values, const size_t* count_values, int len) except?CUFILE_LOADING_ERROR nogil: + global __cuFileSetParameterPosixPoolSlabArray + _check_or_init_cufile() + if __cuFileSetParameterPosixPoolSlabArray == NULL: + with gil: + raise FunctionNotFoundError("function cuFileSetParameterPosixPoolSlabArray is not found") + return (__cuFileSetParameterPosixPoolSlabArray)( + size_values, count_values, len) + + +cdef CUfileError_t _cuFileGetParameterPosixPoolSlabArray(size_t* size_values, size_t* count_values, int len) except?CUFILE_LOADING_ERROR nogil: + global __cuFileGetParameterPosixPoolSlabArray + _check_or_init_cufile() + if __cuFileGetParameterPosixPoolSlabArray == NULL: + with gil: + raise FunctionNotFoundError("function cuFileGetParameterPosixPoolSlabArray is not found") + return (__cuFileGetParameterPosixPoolSlabArray)( + size_values, count_values, len) diff --git a/cuda/_cuda/ccuda.pxd.in b/cuda_bindings/cuda/bindings/_internal/driver.pxd similarity index 65% rename from cuda/_cuda/ccuda.pxd.in rename to cuda_bindings/cuda/bindings/_internal/driver.pxd index 82eba6e206b..d0d183d034c 100644 --- a/cuda/_cuda/ccuda.pxd.in +++ b/cuda_bindings/cuda/bindings/_internal/driver.pxd @@ -1,2289 +1,531 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. +# SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # -# Please refer to the NVIDIA end user license agreement (EULA) associated -# with this source code for terms and conditions that govern your use of -# this software. Any use, reproduction, disclosure, or distribution of -# this software and related documentation outside the terms of the EULA -# is strictly prohibited. -from cuda.ccuda cimport * +# SPDX-License-Identifier: Apache-2.0 +# +# This code was automatically generated across versions from 12.9.0 to 13.3.0. Do not modify it directly. -{{if 'cuGetErrorString' in found_functions}} +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=a82b3f5dcb30b13294f6896a4d9d9f2f8d7be6b29c8f0a0c61677b1c622d4480 +from ..cydriver cimport * -cdef CUresult _cuGetErrorString(CUresult error, const char** pStr) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} -{{if 'cuGetErrorName' in found_functions}} +############################################################################### +# Wrapper functions +############################################################################### +cdef CUresult _cuGetErrorString(CUresult error, const char** pStr) except ?CUDA_ERROR_NOT_FOUND nogil cdef CUresult _cuGetErrorName(CUresult error, const char** pStr) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuInit' in found_functions}} - cdef CUresult _cuInit(unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDriverGetVersion' in found_functions}} - cdef CUresult _cuDriverGetVersion(int* driverVersion) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDeviceGet' in found_functions}} - cdef CUresult _cuDeviceGet(CUdevice* device, int ordinal) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDeviceGetCount' in found_functions}} - cdef CUresult _cuDeviceGetCount(int* count) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDeviceGetName' in found_functions}} - -cdef CUresult _cuDeviceGetName(char* name, int length, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDeviceGetUuid' in found_functions}} - -cdef CUresult _cuDeviceGetUuid(CUuuid* uuid, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDeviceGetUuid_v2' in found_functions}} - +cdef CUresult _cuDeviceGetName(char* name, int len, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil cdef CUresult _cuDeviceGetUuid_v2(CUuuid* uuid, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDeviceGetLuid' in found_functions}} - cdef CUresult _cuDeviceGetLuid(char* luid, unsigned int* deviceNodeMask, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDeviceTotalMem_v2' in found_functions}} - -cdef CUresult _cuDeviceTotalMem_v2(size_t* numbytes, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDeviceGetTexture1DLinearMaxWidth' in found_functions}} - -cdef CUresult _cuDeviceGetTexture1DLinearMaxWidth(size_t* maxWidthInElements, CUarray_format pformat, unsigned numChannels, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDeviceGetAttribute' in found_functions}} - +cdef CUresult _cuDeviceTotalMem_v2(size_t* bytes, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuDeviceGetTexture1DLinearMaxWidth(size_t* maxWidthInElements, CUarray_format format, unsigned numChannels, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil cdef CUresult _cuDeviceGetAttribute(int* pi, CUdevice_attribute attrib, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDeviceGetNvSciSyncAttributes' in found_functions}} - cdef CUresult _cuDeviceGetNvSciSyncAttributes(void* nvSciSyncAttrList, CUdevice dev, int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDeviceSetMemPool' in found_functions}} - cdef CUresult _cuDeviceSetMemPool(CUdevice dev, CUmemoryPool pool) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDeviceGetMemPool' in found_functions}} - cdef CUresult _cuDeviceGetMemPool(CUmemoryPool* pool, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDeviceGetDefaultMemPool' in found_functions}} - cdef CUresult _cuDeviceGetDefaultMemPool(CUmemoryPool* pool_out, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDeviceGetExecAffinitySupport' in found_functions}} - -cdef CUresult _cuDeviceGetExecAffinitySupport(int* pi, CUexecAffinityType typename, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuFlushGPUDirectRDMAWrites' in found_functions}} - +cdef CUresult _cuDeviceGetExecAffinitySupport(int* pi, CUexecAffinityType type, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil cdef CUresult _cuFlushGPUDirectRDMAWrites(CUflushGPUDirectRDMAWritesTarget target, CUflushGPUDirectRDMAWritesScope scope) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDeviceGetProperties' in found_functions}} - cdef CUresult _cuDeviceGetProperties(CUdevprop* prop, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDeviceComputeCapability' in found_functions}} - cdef CUresult _cuDeviceComputeCapability(int* major, int* minor, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDevicePrimaryCtxRetain' in found_functions}} - cdef CUresult _cuDevicePrimaryCtxRetain(CUcontext* pctx, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDevicePrimaryCtxRelease_v2' in found_functions}} - cdef CUresult _cuDevicePrimaryCtxRelease_v2(CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDevicePrimaryCtxSetFlags_v2' in found_functions}} - cdef CUresult _cuDevicePrimaryCtxSetFlags_v2(CUdevice dev, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDevicePrimaryCtxGetState' in found_functions}} - cdef CUresult _cuDevicePrimaryCtxGetState(CUdevice dev, unsigned int* flags, int* active) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDevicePrimaryCtxReset_v2' in found_functions}} - cdef CUresult _cuDevicePrimaryCtxReset_v2(CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxCreate_v2' in found_functions}} - cdef CUresult _cuCtxCreate_v2(CUcontext* pctx, unsigned int flags, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxCreate_v3' in found_functions}} - cdef CUresult _cuCtxCreate_v3(CUcontext* pctx, CUexecAffinityParam* paramsArray, int numParams, unsigned int flags, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxCreate_v4' in found_functions}} - cdef CUresult _cuCtxCreate_v4(CUcontext* pctx, CUctxCreateParams* ctxCreateParams, unsigned int flags, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxDestroy_v2' in found_functions}} - cdef CUresult _cuCtxDestroy_v2(CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxPushCurrent_v2' in found_functions}} - cdef CUresult _cuCtxPushCurrent_v2(CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxPopCurrent_v2' in found_functions}} - cdef CUresult _cuCtxPopCurrent_v2(CUcontext* pctx) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxSetCurrent' in found_functions}} - cdef CUresult _cuCtxSetCurrent(CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxGetCurrent' in found_functions}} - cdef CUresult _cuCtxGetCurrent(CUcontext* pctx) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxGetDevice' in found_functions}} - cdef CUresult _cuCtxGetDevice(CUdevice* device) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxGetFlags' in found_functions}} - cdef CUresult _cuCtxGetFlags(unsigned int* flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxSetFlags' in found_functions}} - cdef CUresult _cuCtxSetFlags(unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxGetId' in found_functions}} - cdef CUresult _cuCtxGetId(CUcontext ctx, unsigned long long* ctxId) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxSynchronize' in found_functions}} - cdef CUresult _cuCtxSynchronize() except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxSetLimit' in found_functions}} - cdef CUresult _cuCtxSetLimit(CUlimit limit, size_t value) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxGetLimit' in found_functions}} - cdef CUresult _cuCtxGetLimit(size_t* pvalue, CUlimit limit) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxGetCacheConfig' in found_functions}} - cdef CUresult _cuCtxGetCacheConfig(CUfunc_cache* pconfig) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxSetCacheConfig' in found_functions}} - cdef CUresult _cuCtxSetCacheConfig(CUfunc_cache config) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxGetApiVersion' in found_functions}} - cdef CUresult _cuCtxGetApiVersion(CUcontext ctx, unsigned int* version) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxGetStreamPriorityRange' in found_functions}} - cdef CUresult _cuCtxGetStreamPriorityRange(int* leastPriority, int* greatestPriority) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxResetPersistingL2Cache' in found_functions}} - cdef CUresult _cuCtxResetPersistingL2Cache() except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxGetExecAffinity' in found_functions}} - -cdef CUresult _cuCtxGetExecAffinity(CUexecAffinityParam* pExecAffinity, CUexecAffinityType typename) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxRecordEvent' in found_functions}} - +cdef CUresult _cuCtxGetExecAffinity(CUexecAffinityParam* pExecAffinity, CUexecAffinityType type) except ?CUDA_ERROR_NOT_FOUND nogil cdef CUresult _cuCtxRecordEvent(CUcontext hCtx, CUevent hEvent) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxWaitEvent' in found_functions}} - cdef CUresult _cuCtxWaitEvent(CUcontext hCtx, CUevent hEvent) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxAttach' in found_functions}} - cdef CUresult _cuCtxAttach(CUcontext* pctx, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxDetach' in found_functions}} - cdef CUresult _cuCtxDetach(CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxGetSharedMemConfig' in found_functions}} - cdef CUresult _cuCtxGetSharedMemConfig(CUsharedconfig* pConfig) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxSetSharedMemConfig' in found_functions}} - cdef CUresult _cuCtxSetSharedMemConfig(CUsharedconfig config) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuModuleLoad' in found_functions}} - cdef CUresult _cuModuleLoad(CUmodule* module, const char* fname) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuModuleLoadData' in found_functions}} - cdef CUresult _cuModuleLoadData(CUmodule* module, const void* image) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuModuleLoadDataEx' in found_functions}} - cdef CUresult _cuModuleLoadDataEx(CUmodule* module, const void* image, unsigned int numOptions, CUjit_option* options, void** optionValues) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuModuleLoadFatBinary' in found_functions}} - cdef CUresult _cuModuleLoadFatBinary(CUmodule* module, const void* fatCubin) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuModuleUnload' in found_functions}} - cdef CUresult _cuModuleUnload(CUmodule hmod) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuModuleGetLoadingMode' in found_functions}} - cdef CUresult _cuModuleGetLoadingMode(CUmoduleLoadingMode* mode) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuModuleGetFunction' in found_functions}} - cdef CUresult _cuModuleGetFunction(CUfunction* hfunc, CUmodule hmod, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuModuleGetFunctionCount' in found_functions}} - cdef CUresult _cuModuleGetFunctionCount(unsigned int* count, CUmodule mod) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuModuleEnumerateFunctions' in found_functions}} - cdef CUresult _cuModuleEnumerateFunctions(CUfunction* functions, unsigned int numFunctions, CUmodule mod) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuModuleGetGlobal_v2' in found_functions}} - -cdef CUresult _cuModuleGetGlobal_v2(CUdeviceptr* dptr, size_t* numbytes, CUmodule hmod, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuLinkCreate_v2' in found_functions}} - +cdef CUresult _cuModuleGetGlobal_v2(CUdeviceptr* dptr, size_t* bytes, CUmodule hmod, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil cdef CUresult _cuLinkCreate_v2(unsigned int numOptions, CUjit_option* options, void** optionValues, CUlinkState* stateOut) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuLinkAddData_v2' in found_functions}} - -cdef CUresult _cuLinkAddData_v2(CUlinkState state, CUjitInputType typename, void* data, size_t size, const char* name, unsigned int numOptions, CUjit_option* options, void** optionValues) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuLinkAddFile_v2' in found_functions}} - -cdef CUresult _cuLinkAddFile_v2(CUlinkState state, CUjitInputType typename, const char* path, unsigned int numOptions, CUjit_option* options, void** optionValues) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuLinkComplete' in found_functions}} - +cdef CUresult _cuLinkAddData_v2(CUlinkState state, CUjitInputType type, void* data, size_t size, const char* name, unsigned int numOptions, CUjit_option* options, void** optionValues) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuLinkAddFile_v2(CUlinkState state, CUjitInputType type, const char* path, unsigned int numOptions, CUjit_option* options, void** optionValues) except ?CUDA_ERROR_NOT_FOUND nogil cdef CUresult _cuLinkComplete(CUlinkState state, void** cubinOut, size_t* sizeOut) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuLinkDestroy' in found_functions}} - cdef CUresult _cuLinkDestroy(CUlinkState state) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuModuleGetTexRef' in found_functions}} - cdef CUresult _cuModuleGetTexRef(CUtexref* pTexRef, CUmodule hmod, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuModuleGetSurfRef' in found_functions}} - cdef CUresult _cuModuleGetSurfRef(CUsurfref* pSurfRef, CUmodule hmod, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuLibraryLoadData' in found_functions}} - cdef CUresult _cuLibraryLoadData(CUlibrary* library, const void* code, CUjit_option* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, CUlibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuLibraryLoadFromFile' in found_functions}} - cdef CUresult _cuLibraryLoadFromFile(CUlibrary* library, const char* fileName, CUjit_option* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, CUlibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuLibraryUnload' in found_functions}} - cdef CUresult _cuLibraryUnload(CUlibrary library) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuLibraryGetKernel' in found_functions}} - cdef CUresult _cuLibraryGetKernel(CUkernel* pKernel, CUlibrary library, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuLibraryGetKernelCount' in found_functions}} - cdef CUresult _cuLibraryGetKernelCount(unsigned int* count, CUlibrary lib) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuLibraryEnumerateKernels' in found_functions}} - cdef CUresult _cuLibraryEnumerateKernels(CUkernel* kernels, unsigned int numKernels, CUlibrary lib) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuLibraryGetModule' in found_functions}} - cdef CUresult _cuLibraryGetModule(CUmodule* pMod, CUlibrary library) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuKernelGetFunction' in found_functions}} - cdef CUresult _cuKernelGetFunction(CUfunction* pFunc, CUkernel kernel) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuKernelGetLibrary' in found_functions}} - cdef CUresult _cuKernelGetLibrary(CUlibrary* pLib, CUkernel kernel) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuLibraryGetGlobal' in found_functions}} - -cdef CUresult _cuLibraryGetGlobal(CUdeviceptr* dptr, size_t* numbytes, CUlibrary library, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuLibraryGetManaged' in found_functions}} - -cdef CUresult _cuLibraryGetManaged(CUdeviceptr* dptr, size_t* numbytes, CUlibrary library, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuLibraryGetUnifiedFunction' in found_functions}} - +cdef CUresult _cuLibraryGetGlobal(CUdeviceptr* dptr, size_t* bytes, CUlibrary library, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuLibraryGetManaged(CUdeviceptr* dptr, size_t* bytes, CUlibrary library, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil cdef CUresult _cuLibraryGetUnifiedFunction(void** fptr, CUlibrary library, const char* symbol) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuKernelGetAttribute' in found_functions}} - cdef CUresult _cuKernelGetAttribute(int* pi, CUfunction_attribute attrib, CUkernel kernel, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuKernelSetAttribute' in found_functions}} - cdef CUresult _cuKernelSetAttribute(CUfunction_attribute attrib, int val, CUkernel kernel, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuKernelSetCacheConfig' in found_functions}} - cdef CUresult _cuKernelSetCacheConfig(CUkernel kernel, CUfunc_cache config, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuKernelGetName' in found_functions}} - cdef CUresult _cuKernelGetName(const char** name, CUkernel hfunc) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuKernelGetParamInfo' in found_functions}} - cdef CUresult _cuKernelGetParamInfo(CUkernel kernel, size_t paramIndex, size_t* paramOffset, size_t* paramSize) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemGetInfo_v2' in found_functions}} - cdef CUresult _cuMemGetInfo_v2(size_t* free, size_t* total) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemAlloc_v2' in found_functions}} - cdef CUresult _cuMemAlloc_v2(CUdeviceptr* dptr, size_t bytesize) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemAllocPitch_v2' in found_functions}} - cdef CUresult _cuMemAllocPitch_v2(CUdeviceptr* dptr, size_t* pPitch, size_t WidthInBytes, size_t Height, unsigned int ElementSizeBytes) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemFree_v2' in found_functions}} - cdef CUresult _cuMemFree_v2(CUdeviceptr dptr) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemGetAddressRange_v2' in found_functions}} - cdef CUresult _cuMemGetAddressRange_v2(CUdeviceptr* pbase, size_t* psize, CUdeviceptr dptr) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemAllocHost_v2' in found_functions}} - cdef CUresult _cuMemAllocHost_v2(void** pp, size_t bytesize) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemFreeHost' in found_functions}} - cdef CUresult _cuMemFreeHost(void* p) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemHostAlloc' in found_functions}} - cdef CUresult _cuMemHostAlloc(void** pp, size_t bytesize, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemHostGetDevicePointer_v2' in found_functions}} - cdef CUresult _cuMemHostGetDevicePointer_v2(CUdeviceptr* pdptr, void* p, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemHostGetFlags' in found_functions}} - cdef CUresult _cuMemHostGetFlags(unsigned int* pFlags, void* p) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemAllocManaged' in found_functions}} - cdef CUresult _cuMemAllocManaged(CUdeviceptr* dptr, size_t bytesize, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDeviceRegisterAsyncNotification' in found_functions}} - cdef CUresult _cuDeviceRegisterAsyncNotification(CUdevice device, CUasyncCallback callbackFunc, void* userData, CUasyncCallbackHandle* callback) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDeviceUnregisterAsyncNotification' in found_functions}} - cdef CUresult _cuDeviceUnregisterAsyncNotification(CUdevice device, CUasyncCallbackHandle callback) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDeviceGetByPCIBusId' in found_functions}} - cdef CUresult _cuDeviceGetByPCIBusId(CUdevice* dev, const char* pciBusId) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDeviceGetPCIBusId' in found_functions}} - -cdef CUresult _cuDeviceGetPCIBusId(char* pciBusId, int length, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuIpcGetEventHandle' in found_functions}} - +cdef CUresult _cuDeviceGetPCIBusId(char* pciBusId, int len, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil cdef CUresult _cuIpcGetEventHandle(CUipcEventHandle* pHandle, CUevent event) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuIpcOpenEventHandle' in found_functions}} - cdef CUresult _cuIpcOpenEventHandle(CUevent* phEvent, CUipcEventHandle handle) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuIpcGetMemHandle' in found_functions}} - cdef CUresult _cuIpcGetMemHandle(CUipcMemHandle* pHandle, CUdeviceptr dptr) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuIpcOpenMemHandle_v2' in found_functions}} - cdef CUresult _cuIpcOpenMemHandle_v2(CUdeviceptr* pdptr, CUipcMemHandle handle, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuIpcCloseMemHandle' in found_functions}} - cdef CUresult _cuIpcCloseMemHandle(CUdeviceptr dptr) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemHostRegister_v2' in found_functions}} - cdef CUresult _cuMemHostRegister_v2(void* p, size_t bytesize, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemHostUnregister' in found_functions}} - cdef CUresult _cuMemHostUnregister(void* p) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemcpy' in found_functions}} - cdef CUresult _cuMemcpy(CUdeviceptr dst, CUdeviceptr src, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemcpyPeer' in found_functions}} - cdef CUresult _cuMemcpyPeer(CUdeviceptr dstDevice, CUcontext dstContext, CUdeviceptr srcDevice, CUcontext srcContext, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemcpyHtoD_v2' in found_functions}} - cdef CUresult _cuMemcpyHtoD_v2(CUdeviceptr dstDevice, const void* srcHost, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemcpyDtoH_v2' in found_functions}} - cdef CUresult _cuMemcpyDtoH_v2(void* dstHost, CUdeviceptr srcDevice, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemcpyDtoD_v2' in found_functions}} - cdef CUresult _cuMemcpyDtoD_v2(CUdeviceptr dstDevice, CUdeviceptr srcDevice, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemcpyDtoA_v2' in found_functions}} - cdef CUresult _cuMemcpyDtoA_v2(CUarray dstArray, size_t dstOffset, CUdeviceptr srcDevice, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemcpyAtoD_v2' in found_functions}} - cdef CUresult _cuMemcpyAtoD_v2(CUdeviceptr dstDevice, CUarray srcArray, size_t srcOffset, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemcpyHtoA_v2' in found_functions}} - cdef CUresult _cuMemcpyHtoA_v2(CUarray dstArray, size_t dstOffset, const void* srcHost, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemcpyAtoH_v2' in found_functions}} - cdef CUresult _cuMemcpyAtoH_v2(void* dstHost, CUarray srcArray, size_t srcOffset, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemcpyAtoA_v2' in found_functions}} - cdef CUresult _cuMemcpyAtoA_v2(CUarray dstArray, size_t dstOffset, CUarray srcArray, size_t srcOffset, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemcpy2D_v2' in found_functions}} - cdef CUresult _cuMemcpy2D_v2(const CUDA_MEMCPY2D* pCopy) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemcpy2DUnaligned_v2' in found_functions}} - cdef CUresult _cuMemcpy2DUnaligned_v2(const CUDA_MEMCPY2D* pCopy) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemcpy3D_v2' in found_functions}} - cdef CUresult _cuMemcpy3D_v2(const CUDA_MEMCPY3D* pCopy) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemcpy3DPeer' in found_functions}} - cdef CUresult _cuMemcpy3DPeer(const CUDA_MEMCPY3D_PEER* pCopy) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemcpyAsync' in found_functions}} - cdef CUresult _cuMemcpyAsync(CUdeviceptr dst, CUdeviceptr src, size_t ByteCount, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemcpyPeerAsync' in found_functions}} - cdef CUresult _cuMemcpyPeerAsync(CUdeviceptr dstDevice, CUcontext dstContext, CUdeviceptr srcDevice, CUcontext srcContext, size_t ByteCount, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemcpyHtoDAsync_v2' in found_functions}} - cdef CUresult _cuMemcpyHtoDAsync_v2(CUdeviceptr dstDevice, const void* srcHost, size_t ByteCount, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemcpyDtoHAsync_v2' in found_functions}} - cdef CUresult _cuMemcpyDtoHAsync_v2(void* dstHost, CUdeviceptr srcDevice, size_t ByteCount, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemcpyDtoDAsync_v2' in found_functions}} - cdef CUresult _cuMemcpyDtoDAsync_v2(CUdeviceptr dstDevice, CUdeviceptr srcDevice, size_t ByteCount, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemcpyHtoAAsync_v2' in found_functions}} - cdef CUresult _cuMemcpyHtoAAsync_v2(CUarray dstArray, size_t dstOffset, const void* srcHost, size_t ByteCount, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemcpyAtoHAsync_v2' in found_functions}} - cdef CUresult _cuMemcpyAtoHAsync_v2(void* dstHost, CUarray srcArray, size_t srcOffset, size_t ByteCount, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemcpy2DAsync_v2' in found_functions}} - cdef CUresult _cuMemcpy2DAsync_v2(const CUDA_MEMCPY2D* pCopy, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemcpy3DAsync_v2' in found_functions}} - cdef CUresult _cuMemcpy3DAsync_v2(const CUDA_MEMCPY3D* pCopy, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemcpy3DPeerAsync' in found_functions}} - cdef CUresult _cuMemcpy3DPeerAsync(const CUDA_MEMCPY3D_PEER* pCopy, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemsetD8_v2' in found_functions}} - cdef CUresult _cuMemsetD8_v2(CUdeviceptr dstDevice, unsigned char uc, size_t N) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemsetD16_v2' in found_functions}} - cdef CUresult _cuMemsetD16_v2(CUdeviceptr dstDevice, unsigned short us, size_t N) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemsetD32_v2' in found_functions}} - cdef CUresult _cuMemsetD32_v2(CUdeviceptr dstDevice, unsigned int ui, size_t N) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemsetD2D8_v2' in found_functions}} - cdef CUresult _cuMemsetD2D8_v2(CUdeviceptr dstDevice, size_t dstPitch, unsigned char uc, size_t Width, size_t Height) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemsetD2D16_v2' in found_functions}} - cdef CUresult _cuMemsetD2D16_v2(CUdeviceptr dstDevice, size_t dstPitch, unsigned short us, size_t Width, size_t Height) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemsetD2D32_v2' in found_functions}} - cdef CUresult _cuMemsetD2D32_v2(CUdeviceptr dstDevice, size_t dstPitch, unsigned int ui, size_t Width, size_t Height) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemsetD8Async' in found_functions}} - cdef CUresult _cuMemsetD8Async(CUdeviceptr dstDevice, unsigned char uc, size_t N, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemsetD16Async' in found_functions}} - cdef CUresult _cuMemsetD16Async(CUdeviceptr dstDevice, unsigned short us, size_t N, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemsetD32Async' in found_functions}} - cdef CUresult _cuMemsetD32Async(CUdeviceptr dstDevice, unsigned int ui, size_t N, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemsetD2D8Async' in found_functions}} - cdef CUresult _cuMemsetD2D8Async(CUdeviceptr dstDevice, size_t dstPitch, unsigned char uc, size_t Width, size_t Height, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemsetD2D16Async' in found_functions}} - cdef CUresult _cuMemsetD2D16Async(CUdeviceptr dstDevice, size_t dstPitch, unsigned short us, size_t Width, size_t Height, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemsetD2D32Async' in found_functions}} - cdef CUresult _cuMemsetD2D32Async(CUdeviceptr dstDevice, size_t dstPitch, unsigned int ui, size_t Width, size_t Height, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuArrayCreate_v2' in found_functions}} - cdef CUresult _cuArrayCreate_v2(CUarray* pHandle, const CUDA_ARRAY_DESCRIPTOR* pAllocateArray) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuArrayGetDescriptor_v2' in found_functions}} - cdef CUresult _cuArrayGetDescriptor_v2(CUDA_ARRAY_DESCRIPTOR* pArrayDescriptor, CUarray hArray) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuArrayGetSparseProperties' in found_functions}} - cdef CUresult _cuArrayGetSparseProperties(CUDA_ARRAY_SPARSE_PROPERTIES* sparseProperties, CUarray array) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMipmappedArrayGetSparseProperties' in found_functions}} - cdef CUresult _cuMipmappedArrayGetSparseProperties(CUDA_ARRAY_SPARSE_PROPERTIES* sparseProperties, CUmipmappedArray mipmap) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuArrayGetMemoryRequirements' in found_functions}} - cdef CUresult _cuArrayGetMemoryRequirements(CUDA_ARRAY_MEMORY_REQUIREMENTS* memoryRequirements, CUarray array, CUdevice device) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMipmappedArrayGetMemoryRequirements' in found_functions}} - cdef CUresult _cuMipmappedArrayGetMemoryRequirements(CUDA_ARRAY_MEMORY_REQUIREMENTS* memoryRequirements, CUmipmappedArray mipmap, CUdevice device) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuArrayGetPlane' in found_functions}} - cdef CUresult _cuArrayGetPlane(CUarray* pPlaneArray, CUarray hArray, unsigned int planeIdx) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuArrayDestroy' in found_functions}} - cdef CUresult _cuArrayDestroy(CUarray hArray) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuArray3DCreate_v2' in found_functions}} - cdef CUresult _cuArray3DCreate_v2(CUarray* pHandle, const CUDA_ARRAY3D_DESCRIPTOR* pAllocateArray) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuArray3DGetDescriptor_v2' in found_functions}} - cdef CUresult _cuArray3DGetDescriptor_v2(CUDA_ARRAY3D_DESCRIPTOR* pArrayDescriptor, CUarray hArray) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMipmappedArrayCreate' in found_functions}} - cdef CUresult _cuMipmappedArrayCreate(CUmipmappedArray* pHandle, const CUDA_ARRAY3D_DESCRIPTOR* pMipmappedArrayDesc, unsigned int numMipmapLevels) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMipmappedArrayGetLevel' in found_functions}} - cdef CUresult _cuMipmappedArrayGetLevel(CUarray* pLevelArray, CUmipmappedArray hMipmappedArray, unsigned int level) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMipmappedArrayDestroy' in found_functions}} - cdef CUresult _cuMipmappedArrayDestroy(CUmipmappedArray hMipmappedArray) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemGetHandleForAddressRange' in found_functions}} - cdef CUresult _cuMemGetHandleForAddressRange(void* handle, CUdeviceptr dptr, size_t size, CUmemRangeHandleType handleType, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemAddressReserve' in found_functions}} - +cdef CUresult _cuMemBatchDecompressAsync(CUmemDecompressParams* paramsArray, size_t count, unsigned int flags, size_t* errorIndex, CUstream stream) except ?CUDA_ERROR_NOT_FOUND nogil cdef CUresult _cuMemAddressReserve(CUdeviceptr* ptr, size_t size, size_t alignment, CUdeviceptr addr, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemAddressFree' in found_functions}} - cdef CUresult _cuMemAddressFree(CUdeviceptr ptr, size_t size) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemCreate' in found_functions}} - cdef CUresult _cuMemCreate(CUmemGenericAllocationHandle* handle, size_t size, const CUmemAllocationProp* prop, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemRelease' in found_functions}} - cdef CUresult _cuMemRelease(CUmemGenericAllocationHandle handle) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemMap' in found_functions}} - cdef CUresult _cuMemMap(CUdeviceptr ptr, size_t size, size_t offset, CUmemGenericAllocationHandle handle, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemMapArrayAsync' in found_functions}} - cdef CUresult _cuMemMapArrayAsync(CUarrayMapInfo* mapInfoList, unsigned int count, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemUnmap' in found_functions}} - cdef CUresult _cuMemUnmap(CUdeviceptr ptr, size_t size) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemSetAccess' in found_functions}} - cdef CUresult _cuMemSetAccess(CUdeviceptr ptr, size_t size, const CUmemAccessDesc* desc, size_t count) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemGetAccess' in found_functions}} - cdef CUresult _cuMemGetAccess(unsigned long long* flags, const CUmemLocation* location, CUdeviceptr ptr) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemExportToShareableHandle' in found_functions}} - cdef CUresult _cuMemExportToShareableHandle(void* shareableHandle, CUmemGenericAllocationHandle handle, CUmemAllocationHandleType handleType, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemImportFromShareableHandle' in found_functions}} - cdef CUresult _cuMemImportFromShareableHandle(CUmemGenericAllocationHandle* handle, void* osHandle, CUmemAllocationHandleType shHandleType) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemGetAllocationGranularity' in found_functions}} - cdef CUresult _cuMemGetAllocationGranularity(size_t* granularity, const CUmemAllocationProp* prop, CUmemAllocationGranularity_flags option) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemGetAllocationPropertiesFromHandle' in found_functions}} - cdef CUresult _cuMemGetAllocationPropertiesFromHandle(CUmemAllocationProp* prop, CUmemGenericAllocationHandle handle) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemRetainAllocationHandle' in found_functions}} - cdef CUresult _cuMemRetainAllocationHandle(CUmemGenericAllocationHandle* handle, void* addr) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemFreeAsync' in found_functions}} - cdef CUresult _cuMemFreeAsync(CUdeviceptr dptr, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemAllocAsync' in found_functions}} - cdef CUresult _cuMemAllocAsync(CUdeviceptr* dptr, size_t bytesize, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemPoolTrimTo' in found_functions}} - cdef CUresult _cuMemPoolTrimTo(CUmemoryPool pool, size_t minBytesToKeep) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemPoolSetAttribute' in found_functions}} - cdef CUresult _cuMemPoolSetAttribute(CUmemoryPool pool, CUmemPool_attribute attr, void* value) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemPoolGetAttribute' in found_functions}} - cdef CUresult _cuMemPoolGetAttribute(CUmemoryPool pool, CUmemPool_attribute attr, void* value) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemPoolSetAccess' in found_functions}} - cdef CUresult _cuMemPoolSetAccess(CUmemoryPool pool, const CUmemAccessDesc* map, size_t count) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemPoolGetAccess' in found_functions}} - cdef CUresult _cuMemPoolGetAccess(CUmemAccess_flags* flags, CUmemoryPool memPool, CUmemLocation* location) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemPoolCreate' in found_functions}} - cdef CUresult _cuMemPoolCreate(CUmemoryPool* pool, const CUmemPoolProps* poolProps) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemPoolDestroy' in found_functions}} - cdef CUresult _cuMemPoolDestroy(CUmemoryPool pool) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemAllocFromPoolAsync' in found_functions}} - cdef CUresult _cuMemAllocFromPoolAsync(CUdeviceptr* dptr, size_t bytesize, CUmemoryPool pool, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemPoolExportToShareableHandle' in found_functions}} - cdef CUresult _cuMemPoolExportToShareableHandle(void* handle_out, CUmemoryPool pool, CUmemAllocationHandleType handleType, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemPoolImportFromShareableHandle' in found_functions}} - cdef CUresult _cuMemPoolImportFromShareableHandle(CUmemoryPool* pool_out, void* handle, CUmemAllocationHandleType handleType, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemPoolExportPointer' in found_functions}} - cdef CUresult _cuMemPoolExportPointer(CUmemPoolPtrExportData* shareData_out, CUdeviceptr ptr) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemPoolImportPointer' in found_functions}} - cdef CUresult _cuMemPoolImportPointer(CUdeviceptr* ptr_out, CUmemoryPool pool, CUmemPoolPtrExportData* shareData) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMulticastCreate' in found_functions}} - cdef CUresult _cuMulticastCreate(CUmemGenericAllocationHandle* mcHandle, const CUmulticastObjectProp* prop) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMulticastAddDevice' in found_functions}} - cdef CUresult _cuMulticastAddDevice(CUmemGenericAllocationHandle mcHandle, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMulticastBindMem' in found_functions}} - cdef CUresult _cuMulticastBindMem(CUmemGenericAllocationHandle mcHandle, size_t mcOffset, CUmemGenericAllocationHandle memHandle, size_t memOffset, size_t size, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMulticastBindAddr' in found_functions}} - cdef CUresult _cuMulticastBindAddr(CUmemGenericAllocationHandle mcHandle, size_t mcOffset, CUdeviceptr memptr, size_t size, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMulticastUnbind' in found_functions}} - cdef CUresult _cuMulticastUnbind(CUmemGenericAllocationHandle mcHandle, CUdevice dev, size_t mcOffset, size_t size) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMulticastGetGranularity' in found_functions}} - cdef CUresult _cuMulticastGetGranularity(size_t* granularity, const CUmulticastObjectProp* prop, CUmulticastGranularity_flags option) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuPointerGetAttribute' in found_functions}} - cdef CUresult _cuPointerGetAttribute(void* data, CUpointer_attribute attribute, CUdeviceptr ptr) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemPrefetchAsync' in found_functions}} - -cdef CUresult _cuMemPrefetchAsync(CUdeviceptr devPtr, size_t count, CUdevice dstDevice, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemPrefetchAsync_v2' in found_functions}} - cdef CUresult _cuMemPrefetchAsync_v2(CUdeviceptr devPtr, size_t count, CUmemLocation location, unsigned int flags, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemAdvise' in found_functions}} - -cdef CUresult _cuMemAdvise(CUdeviceptr devPtr, size_t count, CUmem_advise advice, CUdevice device) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemAdvise_v2' in found_functions}} - cdef CUresult _cuMemAdvise_v2(CUdeviceptr devPtr, size_t count, CUmem_advise advice, CUmemLocation location) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemRangeGetAttribute' in found_functions}} - cdef CUresult _cuMemRangeGetAttribute(void* data, size_t dataSize, CUmem_range_attribute attribute, CUdeviceptr devPtr, size_t count) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuMemRangeGetAttributes' in found_functions}} - cdef CUresult _cuMemRangeGetAttributes(void** data, size_t* dataSizes, CUmem_range_attribute* attributes, size_t numAttributes, CUdeviceptr devPtr, size_t count) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuPointerSetAttribute' in found_functions}} - cdef CUresult _cuPointerSetAttribute(const void* value, CUpointer_attribute attribute, CUdeviceptr ptr) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuPointerGetAttributes' in found_functions}} - cdef CUresult _cuPointerGetAttributes(unsigned int numAttributes, CUpointer_attribute* attributes, void** data, CUdeviceptr ptr) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamCreate' in found_functions}} - cdef CUresult _cuStreamCreate(CUstream* phStream, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamCreateWithPriority' in found_functions}} - cdef CUresult _cuStreamCreateWithPriority(CUstream* phStream, unsigned int flags, int priority) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamGetPriority' in found_functions}} - cdef CUresult _cuStreamGetPriority(CUstream hStream, int* priority) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamGetFlags' in found_functions}} - +cdef CUresult _cuStreamGetDevice(CUstream hStream, CUdevice* device) except ?CUDA_ERROR_NOT_FOUND nogil cdef CUresult _cuStreamGetFlags(CUstream hStream, unsigned int* flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamGetId' in found_functions}} - cdef CUresult _cuStreamGetId(CUstream hStream, unsigned long long* streamId) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamGetCtx' in found_functions}} - cdef CUresult _cuStreamGetCtx(CUstream hStream, CUcontext* pctx) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamGetCtx_v2' in found_functions}} - cdef CUresult _cuStreamGetCtx_v2(CUstream hStream, CUcontext* pCtx, CUgreenCtx* pGreenCtx) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamWaitEvent' in found_functions}} - cdef CUresult _cuStreamWaitEvent(CUstream hStream, CUevent hEvent, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamAddCallback' in found_functions}} - cdef CUresult _cuStreamAddCallback(CUstream hStream, CUstreamCallback callback, void* userData, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamBeginCapture_v2' in found_functions}} - cdef CUresult _cuStreamBeginCapture_v2(CUstream hStream, CUstreamCaptureMode mode) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamBeginCaptureToGraph' in found_functions}} - cdef CUresult _cuStreamBeginCaptureToGraph(CUstream hStream, CUgraph hGraph, const CUgraphNode* dependencies, const CUgraphEdgeData* dependencyData, size_t numDependencies, CUstreamCaptureMode mode) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuThreadExchangeStreamCaptureMode' in found_functions}} - cdef CUresult _cuThreadExchangeStreamCaptureMode(CUstreamCaptureMode* mode) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamEndCapture' in found_functions}} - cdef CUresult _cuStreamEndCapture(CUstream hStream, CUgraph* phGraph) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamIsCapturing' in found_functions}} - cdef CUresult _cuStreamIsCapturing(CUstream hStream, CUstreamCaptureStatus* captureStatus) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamGetCaptureInfo_v2' in found_functions}} - cdef CUresult _cuStreamGetCaptureInfo_v2(CUstream hStream, CUstreamCaptureStatus* captureStatus_out, cuuint64_t* id_out, CUgraph* graph_out, const CUgraphNode** dependencies_out, size_t* numDependencies_out) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamGetCaptureInfo_v3' in found_functions}} - cdef CUresult _cuStreamGetCaptureInfo_v3(CUstream hStream, CUstreamCaptureStatus* captureStatus_out, cuuint64_t* id_out, CUgraph* graph_out, const CUgraphNode** dependencies_out, const CUgraphEdgeData** edgeData_out, size_t* numDependencies_out) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamUpdateCaptureDependencies' in found_functions}} - -cdef CUresult _cuStreamUpdateCaptureDependencies(CUstream hStream, CUgraphNode* dependencies, size_t numDependencies, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamUpdateCaptureDependencies_v2' in found_functions}} - cdef CUresult _cuStreamUpdateCaptureDependencies_v2(CUstream hStream, CUgraphNode* dependencies, const CUgraphEdgeData* dependencyData, size_t numDependencies, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamAttachMemAsync' in found_functions}} - cdef CUresult _cuStreamAttachMemAsync(CUstream hStream, CUdeviceptr dptr, size_t length, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamQuery' in found_functions}} - cdef CUresult _cuStreamQuery(CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamSynchronize' in found_functions}} - cdef CUresult _cuStreamSynchronize(CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamDestroy_v2' in found_functions}} - cdef CUresult _cuStreamDestroy_v2(CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamCopyAttributes' in found_functions}} - cdef CUresult _cuStreamCopyAttributes(CUstream dst, CUstream src) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamGetAttribute' in found_functions}} - cdef CUresult _cuStreamGetAttribute(CUstream hStream, CUstreamAttrID attr, CUstreamAttrValue* value_out) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamSetAttribute' in found_functions}} - cdef CUresult _cuStreamSetAttribute(CUstream hStream, CUstreamAttrID attr, const CUstreamAttrValue* value) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuEventCreate' in found_functions}} - cdef CUresult _cuEventCreate(CUevent* phEvent, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuEventRecord' in found_functions}} - cdef CUresult _cuEventRecord(CUevent hEvent, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuEventRecordWithFlags' in found_functions}} - cdef CUresult _cuEventRecordWithFlags(CUevent hEvent, CUstream hStream, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuEventQuery' in found_functions}} - cdef CUresult _cuEventQuery(CUevent hEvent) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuEventSynchronize' in found_functions}} - cdef CUresult _cuEventSynchronize(CUevent hEvent) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuEventDestroy_v2' in found_functions}} - cdef CUresult _cuEventDestroy_v2(CUevent hEvent) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuEventElapsedTime' in found_functions}} - -cdef CUresult _cuEventElapsedTime(float* pMilliseconds, CUevent hStart, CUevent hEnd) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuImportExternalMemory' in found_functions}} - +cdef CUresult _cuEventElapsedTime_v2(float* pMilliseconds, CUevent hStart, CUevent hEnd) except ?CUDA_ERROR_NOT_FOUND nogil cdef CUresult _cuImportExternalMemory(CUexternalMemory* extMem_out, const CUDA_EXTERNAL_MEMORY_HANDLE_DESC* memHandleDesc) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuExternalMemoryGetMappedBuffer' in found_functions}} - cdef CUresult _cuExternalMemoryGetMappedBuffer(CUdeviceptr* devPtr, CUexternalMemory extMem, const CUDA_EXTERNAL_MEMORY_BUFFER_DESC* bufferDesc) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuExternalMemoryGetMappedMipmappedArray' in found_functions}} - cdef CUresult _cuExternalMemoryGetMappedMipmappedArray(CUmipmappedArray* mipmap, CUexternalMemory extMem, const CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC* mipmapDesc) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDestroyExternalMemory' in found_functions}} - cdef CUresult _cuDestroyExternalMemory(CUexternalMemory extMem) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuImportExternalSemaphore' in found_functions}} - cdef CUresult _cuImportExternalSemaphore(CUexternalSemaphore* extSem_out, const CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC* semHandleDesc) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuSignalExternalSemaphoresAsync' in found_functions}} - cdef CUresult _cuSignalExternalSemaphoresAsync(const CUexternalSemaphore* extSemArray, const CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS* paramsArray, unsigned int numExtSems, CUstream stream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuWaitExternalSemaphoresAsync' in found_functions}} - cdef CUresult _cuWaitExternalSemaphoresAsync(const CUexternalSemaphore* extSemArray, const CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS* paramsArray, unsigned int numExtSems, CUstream stream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDestroyExternalSemaphore' in found_functions}} - cdef CUresult _cuDestroyExternalSemaphore(CUexternalSemaphore extSem) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamWaitValue32_v2' in found_functions}} - cdef CUresult _cuStreamWaitValue32_v2(CUstream stream, CUdeviceptr addr, cuuint32_t value, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamWaitValue64_v2' in found_functions}} - cdef CUresult _cuStreamWaitValue64_v2(CUstream stream, CUdeviceptr addr, cuuint64_t value, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamWriteValue32_v2' in found_functions}} - cdef CUresult _cuStreamWriteValue32_v2(CUstream stream, CUdeviceptr addr, cuuint32_t value, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamWriteValue64_v2' in found_functions}} - cdef CUresult _cuStreamWriteValue64_v2(CUstream stream, CUdeviceptr addr, cuuint64_t value, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamBatchMemOp_v2' in found_functions}} - cdef CUresult _cuStreamBatchMemOp_v2(CUstream stream, unsigned int count, CUstreamBatchMemOpParams* paramArray, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuFuncGetAttribute' in found_functions}} - cdef CUresult _cuFuncGetAttribute(int* pi, CUfunction_attribute attrib, CUfunction hfunc) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuFuncSetAttribute' in found_functions}} - cdef CUresult _cuFuncSetAttribute(CUfunction hfunc, CUfunction_attribute attrib, int value) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuFuncSetCacheConfig' in found_functions}} - cdef CUresult _cuFuncSetCacheConfig(CUfunction hfunc, CUfunc_cache config) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuFuncGetModule' in found_functions}} - cdef CUresult _cuFuncGetModule(CUmodule* hmod, CUfunction hfunc) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuFuncGetName' in found_functions}} - cdef CUresult _cuFuncGetName(const char** name, CUfunction hfunc) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuFuncGetParamInfo' in found_functions}} - cdef CUresult _cuFuncGetParamInfo(CUfunction func, size_t paramIndex, size_t* paramOffset, size_t* paramSize) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuFuncIsLoaded' in found_functions}} - cdef CUresult _cuFuncIsLoaded(CUfunctionLoadingState* state, CUfunction function) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuFuncLoad' in found_functions}} - cdef CUresult _cuFuncLoad(CUfunction function) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuLaunchKernel' in found_functions}} - cdef CUresult _cuLaunchKernel(CUfunction f, unsigned int gridDimX, unsigned int gridDimY, unsigned int gridDimZ, unsigned int blockDimX, unsigned int blockDimY, unsigned int blockDimZ, unsigned int sharedMemBytes, CUstream hStream, void** kernelParams, void** extra) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuLaunchKernelEx' in found_functions}} - cdef CUresult _cuLaunchKernelEx(const CUlaunchConfig* config, CUfunction f, void** kernelParams, void** extra) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuLaunchCooperativeKernel' in found_functions}} - cdef CUresult _cuLaunchCooperativeKernel(CUfunction f, unsigned int gridDimX, unsigned int gridDimY, unsigned int gridDimZ, unsigned int blockDimX, unsigned int blockDimY, unsigned int blockDimZ, unsigned int sharedMemBytes, CUstream hStream, void** kernelParams) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuLaunchCooperativeKernelMultiDevice' in found_functions}} - cdef CUresult _cuLaunchCooperativeKernelMultiDevice(CUDA_LAUNCH_PARAMS* launchParamsList, unsigned int numDevices, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuLaunchHostFunc' in found_functions}} - cdef CUresult _cuLaunchHostFunc(CUstream hStream, CUhostFn fn, void* userData) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuFuncSetBlockShape' in found_functions}} - cdef CUresult _cuFuncSetBlockShape(CUfunction hfunc, int x, int y, int z) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuFuncSetSharedSize' in found_functions}} - -cdef CUresult _cuFuncSetSharedSize(CUfunction hfunc, unsigned int numbytes) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuParamSetSize' in found_functions}} - +cdef CUresult _cuFuncSetSharedSize(CUfunction hfunc, unsigned int bytes) except ?CUDA_ERROR_NOT_FOUND nogil cdef CUresult _cuParamSetSize(CUfunction hfunc, unsigned int numbytes) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuParamSeti' in found_functions}} - cdef CUresult _cuParamSeti(CUfunction hfunc, int offset, unsigned int value) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuParamSetf' in found_functions}} - cdef CUresult _cuParamSetf(CUfunction hfunc, int offset, float value) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuParamSetv' in found_functions}} - cdef CUresult _cuParamSetv(CUfunction hfunc, int offset, void* ptr, unsigned int numbytes) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuLaunch' in found_functions}} - cdef CUresult _cuLaunch(CUfunction f) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuLaunchGrid' in found_functions}} - cdef CUresult _cuLaunchGrid(CUfunction f, int grid_width, int grid_height) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuLaunchGridAsync' in found_functions}} - cdef CUresult _cuLaunchGridAsync(CUfunction f, int grid_width, int grid_height, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuParamSetTexRef' in found_functions}} - cdef CUresult _cuParamSetTexRef(CUfunction hfunc, int texunit, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuFuncSetSharedMemConfig' in found_functions}} - cdef CUresult _cuFuncSetSharedMemConfig(CUfunction hfunc, CUsharedconfig config) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphCreate' in found_functions}} - cdef CUresult _cuGraphCreate(CUgraph* phGraph, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphAddKernelNode_v2' in found_functions}} - cdef CUresult _cuGraphAddKernelNode_v2(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, const CUDA_KERNEL_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphKernelNodeGetParams_v2' in found_functions}} - cdef CUresult _cuGraphKernelNodeGetParams_v2(CUgraphNode hNode, CUDA_KERNEL_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphKernelNodeSetParams_v2' in found_functions}} - cdef CUresult _cuGraphKernelNodeSetParams_v2(CUgraphNode hNode, const CUDA_KERNEL_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphAddMemcpyNode' in found_functions}} - cdef CUresult _cuGraphAddMemcpyNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, const CUDA_MEMCPY3D* copyParams, CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphMemcpyNodeGetParams' in found_functions}} - cdef CUresult _cuGraphMemcpyNodeGetParams(CUgraphNode hNode, CUDA_MEMCPY3D* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphMemcpyNodeSetParams' in found_functions}} - cdef CUresult _cuGraphMemcpyNodeSetParams(CUgraphNode hNode, const CUDA_MEMCPY3D* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphAddMemsetNode' in found_functions}} - cdef CUresult _cuGraphAddMemsetNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, const CUDA_MEMSET_NODE_PARAMS* memsetParams, CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphMemsetNodeGetParams' in found_functions}} - cdef CUresult _cuGraphMemsetNodeGetParams(CUgraphNode hNode, CUDA_MEMSET_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphMemsetNodeSetParams' in found_functions}} - cdef CUresult _cuGraphMemsetNodeSetParams(CUgraphNode hNode, const CUDA_MEMSET_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphAddHostNode' in found_functions}} - cdef CUresult _cuGraphAddHostNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, const CUDA_HOST_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphHostNodeGetParams' in found_functions}} - cdef CUresult _cuGraphHostNodeGetParams(CUgraphNode hNode, CUDA_HOST_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphHostNodeSetParams' in found_functions}} - cdef CUresult _cuGraphHostNodeSetParams(CUgraphNode hNode, const CUDA_HOST_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphAddChildGraphNode' in found_functions}} - cdef CUresult _cuGraphAddChildGraphNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, CUgraph childGraph) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphChildGraphNodeGetGraph' in found_functions}} - cdef CUresult _cuGraphChildGraphNodeGetGraph(CUgraphNode hNode, CUgraph* phGraph) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphAddEmptyNode' in found_functions}} - cdef CUresult _cuGraphAddEmptyNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphAddEventRecordNode' in found_functions}} - cdef CUresult _cuGraphAddEventRecordNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, CUevent event) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphEventRecordNodeGetEvent' in found_functions}} - cdef CUresult _cuGraphEventRecordNodeGetEvent(CUgraphNode hNode, CUevent* event_out) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphEventRecordNodeSetEvent' in found_functions}} - cdef CUresult _cuGraphEventRecordNodeSetEvent(CUgraphNode hNode, CUevent event) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphAddEventWaitNode' in found_functions}} - cdef CUresult _cuGraphAddEventWaitNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, CUevent event) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphEventWaitNodeGetEvent' in found_functions}} - cdef CUresult _cuGraphEventWaitNodeGetEvent(CUgraphNode hNode, CUevent* event_out) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphEventWaitNodeSetEvent' in found_functions}} - cdef CUresult _cuGraphEventWaitNodeSetEvent(CUgraphNode hNode, CUevent event) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphAddExternalSemaphoresSignalNode' in found_functions}} - cdef CUresult _cuGraphAddExternalSemaphoresSignalNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, const CUDA_EXT_SEM_SIGNAL_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphExternalSemaphoresSignalNodeGetParams' in found_functions}} - cdef CUresult _cuGraphExternalSemaphoresSignalNodeGetParams(CUgraphNode hNode, CUDA_EXT_SEM_SIGNAL_NODE_PARAMS* params_out) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphExternalSemaphoresSignalNodeSetParams' in found_functions}} - cdef CUresult _cuGraphExternalSemaphoresSignalNodeSetParams(CUgraphNode hNode, const CUDA_EXT_SEM_SIGNAL_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphAddExternalSemaphoresWaitNode' in found_functions}} - cdef CUresult _cuGraphAddExternalSemaphoresWaitNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, const CUDA_EXT_SEM_WAIT_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphExternalSemaphoresWaitNodeGetParams' in found_functions}} - cdef CUresult _cuGraphExternalSemaphoresWaitNodeGetParams(CUgraphNode hNode, CUDA_EXT_SEM_WAIT_NODE_PARAMS* params_out) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphExternalSemaphoresWaitNodeSetParams' in found_functions}} - cdef CUresult _cuGraphExternalSemaphoresWaitNodeSetParams(CUgraphNode hNode, const CUDA_EXT_SEM_WAIT_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphAddBatchMemOpNode' in found_functions}} - cdef CUresult _cuGraphAddBatchMemOpNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, const CUDA_BATCH_MEM_OP_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphBatchMemOpNodeGetParams' in found_functions}} - cdef CUresult _cuGraphBatchMemOpNodeGetParams(CUgraphNode hNode, CUDA_BATCH_MEM_OP_NODE_PARAMS* nodeParams_out) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphBatchMemOpNodeSetParams' in found_functions}} - cdef CUresult _cuGraphBatchMemOpNodeSetParams(CUgraphNode hNode, const CUDA_BATCH_MEM_OP_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphExecBatchMemOpNodeSetParams' in found_functions}} - cdef CUresult _cuGraphExecBatchMemOpNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_BATCH_MEM_OP_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphAddMemAllocNode' in found_functions}} - cdef CUresult _cuGraphAddMemAllocNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, CUDA_MEM_ALLOC_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphMemAllocNodeGetParams' in found_functions}} - cdef CUresult _cuGraphMemAllocNodeGetParams(CUgraphNode hNode, CUDA_MEM_ALLOC_NODE_PARAMS* params_out) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphAddMemFreeNode' in found_functions}} - cdef CUresult _cuGraphAddMemFreeNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, CUdeviceptr dptr) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphMemFreeNodeGetParams' in found_functions}} - cdef CUresult _cuGraphMemFreeNodeGetParams(CUgraphNode hNode, CUdeviceptr* dptr_out) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDeviceGraphMemTrim' in found_functions}} - cdef CUresult _cuDeviceGraphMemTrim(CUdevice device) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDeviceGetGraphMemAttribute' in found_functions}} - cdef CUresult _cuDeviceGetGraphMemAttribute(CUdevice device, CUgraphMem_attribute attr, void* value) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDeviceSetGraphMemAttribute' in found_functions}} - cdef CUresult _cuDeviceSetGraphMemAttribute(CUdevice device, CUgraphMem_attribute attr, void* value) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphClone' in found_functions}} - cdef CUresult _cuGraphClone(CUgraph* phGraphClone, CUgraph originalGraph) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphNodeFindInClone' in found_functions}} - cdef CUresult _cuGraphNodeFindInClone(CUgraphNode* phNode, CUgraphNode hOriginalNode, CUgraph hClonedGraph) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphNodeGetType' in found_functions}} - -cdef CUresult _cuGraphNodeGetType(CUgraphNode hNode, CUgraphNodeType* typename) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphGetNodes' in found_functions}} - +cdef CUresult _cuGraphNodeGetType(CUgraphNode hNode, CUgraphNodeType* type) except ?CUDA_ERROR_NOT_FOUND nogil cdef CUresult _cuGraphGetNodes(CUgraph hGraph, CUgraphNode* nodes, size_t* numNodes) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphGetRootNodes' in found_functions}} - cdef CUresult _cuGraphGetRootNodes(CUgraph hGraph, CUgraphNode* rootNodes, size_t* numRootNodes) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphGetEdges' in found_functions}} - -cdef CUresult _cuGraphGetEdges(CUgraph hGraph, CUgraphNode* from_, CUgraphNode* to, size_t* numEdges) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphGetEdges_v2' in found_functions}} - cdef CUresult _cuGraphGetEdges_v2(CUgraph hGraph, CUgraphNode* from_, CUgraphNode* to, CUgraphEdgeData* edgeData, size_t* numEdges) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphNodeGetDependencies' in found_functions}} - -cdef CUresult _cuGraphNodeGetDependencies(CUgraphNode hNode, CUgraphNode* dependencies, size_t* numDependencies) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphNodeGetDependencies_v2' in found_functions}} - cdef CUresult _cuGraphNodeGetDependencies_v2(CUgraphNode hNode, CUgraphNode* dependencies, CUgraphEdgeData* edgeData, size_t* numDependencies) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphNodeGetDependentNodes' in found_functions}} - -cdef CUresult _cuGraphNodeGetDependentNodes(CUgraphNode hNode, CUgraphNode* dependentNodes, size_t* numDependentNodes) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphNodeGetDependentNodes_v2' in found_functions}} - cdef CUresult _cuGraphNodeGetDependentNodes_v2(CUgraphNode hNode, CUgraphNode* dependentNodes, CUgraphEdgeData* edgeData, size_t* numDependentNodes) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphAddDependencies' in found_functions}} - -cdef CUresult _cuGraphAddDependencies(CUgraph hGraph, const CUgraphNode* from_, const CUgraphNode* to, size_t numDependencies) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphAddDependencies_v2' in found_functions}} - cdef CUresult _cuGraphAddDependencies_v2(CUgraph hGraph, const CUgraphNode* from_, const CUgraphNode* to, const CUgraphEdgeData* edgeData, size_t numDependencies) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphRemoveDependencies' in found_functions}} - -cdef CUresult _cuGraphRemoveDependencies(CUgraph hGraph, const CUgraphNode* from_, const CUgraphNode* to, size_t numDependencies) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphRemoveDependencies_v2' in found_functions}} - cdef CUresult _cuGraphRemoveDependencies_v2(CUgraph hGraph, const CUgraphNode* from_, const CUgraphNode* to, const CUgraphEdgeData* edgeData, size_t numDependencies) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphDestroyNode' in found_functions}} - cdef CUresult _cuGraphDestroyNode(CUgraphNode hNode) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphInstantiateWithFlags' in found_functions}} - cdef CUresult _cuGraphInstantiateWithFlags(CUgraphExec* phGraphExec, CUgraph hGraph, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphInstantiateWithParams' in found_functions}} - cdef CUresult _cuGraphInstantiateWithParams(CUgraphExec* phGraphExec, CUgraph hGraph, CUDA_GRAPH_INSTANTIATE_PARAMS* instantiateParams) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphExecGetFlags' in found_functions}} - cdef CUresult _cuGraphExecGetFlags(CUgraphExec hGraphExec, cuuint64_t* flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphExecKernelNodeSetParams_v2' in found_functions}} - cdef CUresult _cuGraphExecKernelNodeSetParams_v2(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_KERNEL_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphExecMemcpyNodeSetParams' in found_functions}} - cdef CUresult _cuGraphExecMemcpyNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_MEMCPY3D* copyParams, CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphExecMemsetNodeSetParams' in found_functions}} - cdef CUresult _cuGraphExecMemsetNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_MEMSET_NODE_PARAMS* memsetParams, CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphExecHostNodeSetParams' in found_functions}} - cdef CUresult _cuGraphExecHostNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_HOST_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphExecChildGraphNodeSetParams' in found_functions}} - cdef CUresult _cuGraphExecChildGraphNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, CUgraph childGraph) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphExecEventRecordNodeSetEvent' in found_functions}} - cdef CUresult _cuGraphExecEventRecordNodeSetEvent(CUgraphExec hGraphExec, CUgraphNode hNode, CUevent event) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphExecEventWaitNodeSetEvent' in found_functions}} - cdef CUresult _cuGraphExecEventWaitNodeSetEvent(CUgraphExec hGraphExec, CUgraphNode hNode, CUevent event) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphExecExternalSemaphoresSignalNodeSetParams' in found_functions}} - cdef CUresult _cuGraphExecExternalSemaphoresSignalNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_EXT_SEM_SIGNAL_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphExecExternalSemaphoresWaitNodeSetParams' in found_functions}} - cdef CUresult _cuGraphExecExternalSemaphoresWaitNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_EXT_SEM_WAIT_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphNodeSetEnabled' in found_functions}} - cdef CUresult _cuGraphNodeSetEnabled(CUgraphExec hGraphExec, CUgraphNode hNode, unsigned int isEnabled) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphNodeGetEnabled' in found_functions}} - cdef CUresult _cuGraphNodeGetEnabled(CUgraphExec hGraphExec, CUgraphNode hNode, unsigned int* isEnabled) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphUpload' in found_functions}} - cdef CUresult _cuGraphUpload(CUgraphExec hGraphExec, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphLaunch' in found_functions}} - cdef CUresult _cuGraphLaunch(CUgraphExec hGraphExec, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphExecDestroy' in found_functions}} - cdef CUresult _cuGraphExecDestroy(CUgraphExec hGraphExec) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphDestroy' in found_functions}} - cdef CUresult _cuGraphDestroy(CUgraph hGraph) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphExecUpdate_v2' in found_functions}} - cdef CUresult _cuGraphExecUpdate_v2(CUgraphExec hGraphExec, CUgraph hGraph, CUgraphExecUpdateResultInfo* resultInfo) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphKernelNodeCopyAttributes' in found_functions}} - cdef CUresult _cuGraphKernelNodeCopyAttributes(CUgraphNode dst, CUgraphNode src) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphKernelNodeGetAttribute' in found_functions}} - cdef CUresult _cuGraphKernelNodeGetAttribute(CUgraphNode hNode, CUkernelNodeAttrID attr, CUkernelNodeAttrValue* value_out) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphKernelNodeSetAttribute' in found_functions}} - cdef CUresult _cuGraphKernelNodeSetAttribute(CUgraphNode hNode, CUkernelNodeAttrID attr, const CUkernelNodeAttrValue* value) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphDebugDotPrint' in found_functions}} - cdef CUresult _cuGraphDebugDotPrint(CUgraph hGraph, const char* path, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuUserObjectCreate' in found_functions}} - cdef CUresult _cuUserObjectCreate(CUuserObject* object_out, void* ptr, CUhostFn destroy, unsigned int initialRefcount, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuUserObjectRetain' in found_functions}} - cdef CUresult _cuUserObjectRetain(CUuserObject object, unsigned int count) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuUserObjectRelease' in found_functions}} - cdef CUresult _cuUserObjectRelease(CUuserObject object, unsigned int count) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphRetainUserObject' in found_functions}} - cdef CUresult _cuGraphRetainUserObject(CUgraph graph, CUuserObject object, unsigned int count, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphReleaseUserObject' in found_functions}} - cdef CUresult _cuGraphReleaseUserObject(CUgraph graph, CUuserObject object, unsigned int count) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphAddNode' in found_functions}} - -cdef CUresult _cuGraphAddNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, CUgraphNodeParams* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphAddNode_v2' in found_functions}} - cdef CUresult _cuGraphAddNode_v2(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, const CUgraphEdgeData* dependencyData, size_t numDependencies, CUgraphNodeParams* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphNodeSetParams' in found_functions}} - cdef CUresult _cuGraphNodeSetParams(CUgraphNode hNode, CUgraphNodeParams* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphExecNodeSetParams' in found_functions}} - cdef CUresult _cuGraphExecNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, CUgraphNodeParams* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphConditionalHandleCreate' in found_functions}} - cdef CUresult _cuGraphConditionalHandleCreate(CUgraphConditionalHandle* pHandle_out, CUgraph hGraph, CUcontext ctx, unsigned int defaultLaunchValue, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuOccupancyMaxActiveBlocksPerMultiprocessor' in found_functions}} - cdef CUresult _cuOccupancyMaxActiveBlocksPerMultiprocessor(int* numBlocks, CUfunction func, int blockSize, size_t dynamicSMemSize) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags' in found_functions}} - cdef CUresult _cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(int* numBlocks, CUfunction func, int blockSize, size_t dynamicSMemSize, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuOccupancyMaxPotentialBlockSize' in found_functions}} - cdef CUresult _cuOccupancyMaxPotentialBlockSize(int* minGridSize, int* blockSize, CUfunction func, CUoccupancyB2DSize blockSizeToDynamicSMemSize, size_t dynamicSMemSize, int blockSizeLimit) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuOccupancyMaxPotentialBlockSizeWithFlags' in found_functions}} - cdef CUresult _cuOccupancyMaxPotentialBlockSizeWithFlags(int* minGridSize, int* blockSize, CUfunction func, CUoccupancyB2DSize blockSizeToDynamicSMemSize, size_t dynamicSMemSize, int blockSizeLimit, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuOccupancyAvailableDynamicSMemPerBlock' in found_functions}} - cdef CUresult _cuOccupancyAvailableDynamicSMemPerBlock(size_t* dynamicSmemSize, CUfunction func, int numBlocks, int blockSize) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuOccupancyMaxPotentialClusterSize' in found_functions}} - cdef CUresult _cuOccupancyMaxPotentialClusterSize(int* clusterSize, CUfunction func, const CUlaunchConfig* config) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuOccupancyMaxActiveClusters' in found_functions}} - cdef CUresult _cuOccupancyMaxActiveClusters(int* numClusters, CUfunction func, const CUlaunchConfig* config) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexRefSetArray' in found_functions}} - cdef CUresult _cuTexRefSetArray(CUtexref hTexRef, CUarray hArray, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexRefSetMipmappedArray' in found_functions}} - cdef CUresult _cuTexRefSetMipmappedArray(CUtexref hTexRef, CUmipmappedArray hMipmappedArray, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexRefSetAddress_v2' in found_functions}} - -cdef CUresult _cuTexRefSetAddress_v2(size_t* ByteOffset, CUtexref hTexRef, CUdeviceptr dptr, size_t numbytes) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexRefSetAddress2D_v3' in found_functions}} - +cdef CUresult _cuTexRefSetAddress_v2(size_t* ByteOffset, CUtexref hTexRef, CUdeviceptr dptr, size_t bytes) except ?CUDA_ERROR_NOT_FOUND nogil cdef CUresult _cuTexRefSetAddress2D_v3(CUtexref hTexRef, const CUDA_ARRAY_DESCRIPTOR* desc, CUdeviceptr dptr, size_t Pitch) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexRefSetFormat' in found_functions}} - cdef CUresult _cuTexRefSetFormat(CUtexref hTexRef, CUarray_format fmt, int NumPackedComponents) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexRefSetAddressMode' in found_functions}} - cdef CUresult _cuTexRefSetAddressMode(CUtexref hTexRef, int dim, CUaddress_mode am) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexRefSetFilterMode' in found_functions}} - cdef CUresult _cuTexRefSetFilterMode(CUtexref hTexRef, CUfilter_mode fm) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexRefSetMipmapFilterMode' in found_functions}} - cdef CUresult _cuTexRefSetMipmapFilterMode(CUtexref hTexRef, CUfilter_mode fm) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexRefSetMipmapLevelBias' in found_functions}} - cdef CUresult _cuTexRefSetMipmapLevelBias(CUtexref hTexRef, float bias) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexRefSetMipmapLevelClamp' in found_functions}} - cdef CUresult _cuTexRefSetMipmapLevelClamp(CUtexref hTexRef, float minMipmapLevelClamp, float maxMipmapLevelClamp) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexRefSetMaxAnisotropy' in found_functions}} - cdef CUresult _cuTexRefSetMaxAnisotropy(CUtexref hTexRef, unsigned int maxAniso) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexRefSetBorderColor' in found_functions}} - cdef CUresult _cuTexRefSetBorderColor(CUtexref hTexRef, float* pBorderColor) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexRefSetFlags' in found_functions}} - cdef CUresult _cuTexRefSetFlags(CUtexref hTexRef, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexRefGetAddress_v2' in found_functions}} - cdef CUresult _cuTexRefGetAddress_v2(CUdeviceptr* pdptr, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexRefGetArray' in found_functions}} - cdef CUresult _cuTexRefGetArray(CUarray* phArray, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexRefGetMipmappedArray' in found_functions}} - cdef CUresult _cuTexRefGetMipmappedArray(CUmipmappedArray* phMipmappedArray, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexRefGetAddressMode' in found_functions}} - cdef CUresult _cuTexRefGetAddressMode(CUaddress_mode* pam, CUtexref hTexRef, int dim) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexRefGetFilterMode' in found_functions}} - cdef CUresult _cuTexRefGetFilterMode(CUfilter_mode* pfm, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexRefGetFormat' in found_functions}} - cdef CUresult _cuTexRefGetFormat(CUarray_format* pFormat, int* pNumChannels, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexRefGetMipmapFilterMode' in found_functions}} - cdef CUresult _cuTexRefGetMipmapFilterMode(CUfilter_mode* pfm, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexRefGetMipmapLevelBias' in found_functions}} - cdef CUresult _cuTexRefGetMipmapLevelBias(float* pbias, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexRefGetMipmapLevelClamp' in found_functions}} - cdef CUresult _cuTexRefGetMipmapLevelClamp(float* pminMipmapLevelClamp, float* pmaxMipmapLevelClamp, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexRefGetMaxAnisotropy' in found_functions}} - cdef CUresult _cuTexRefGetMaxAnisotropy(int* pmaxAniso, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexRefGetBorderColor' in found_functions}} - cdef CUresult _cuTexRefGetBorderColor(float* pBorderColor, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexRefGetFlags' in found_functions}} - cdef CUresult _cuTexRefGetFlags(unsigned int* pFlags, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexRefCreate' in found_functions}} - cdef CUresult _cuTexRefCreate(CUtexref* pTexRef) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexRefDestroy' in found_functions}} - cdef CUresult _cuTexRefDestroy(CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuSurfRefSetArray' in found_functions}} - cdef CUresult _cuSurfRefSetArray(CUsurfref hSurfRef, CUarray hArray, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuSurfRefGetArray' in found_functions}} - cdef CUresult _cuSurfRefGetArray(CUarray* phArray, CUsurfref hSurfRef) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexObjectCreate' in found_functions}} - cdef CUresult _cuTexObjectCreate(CUtexObject* pTexObject, const CUDA_RESOURCE_DESC* pResDesc, const CUDA_TEXTURE_DESC* pTexDesc, const CUDA_RESOURCE_VIEW_DESC* pResViewDesc) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexObjectDestroy' in found_functions}} - cdef CUresult _cuTexObjectDestroy(CUtexObject texObject) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexObjectGetResourceDesc' in found_functions}} - cdef CUresult _cuTexObjectGetResourceDesc(CUDA_RESOURCE_DESC* pResDesc, CUtexObject texObject) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexObjectGetTextureDesc' in found_functions}} - cdef CUresult _cuTexObjectGetTextureDesc(CUDA_TEXTURE_DESC* pTexDesc, CUtexObject texObject) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTexObjectGetResourceViewDesc' in found_functions}} - cdef CUresult _cuTexObjectGetResourceViewDesc(CUDA_RESOURCE_VIEW_DESC* pResViewDesc, CUtexObject texObject) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuSurfObjectCreate' in found_functions}} - cdef CUresult _cuSurfObjectCreate(CUsurfObject* pSurfObject, const CUDA_RESOURCE_DESC* pResDesc) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuSurfObjectDestroy' in found_functions}} - cdef CUresult _cuSurfObjectDestroy(CUsurfObject surfObject) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuSurfObjectGetResourceDesc' in found_functions}} - cdef CUresult _cuSurfObjectGetResourceDesc(CUDA_RESOURCE_DESC* pResDesc, CUsurfObject surfObject) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTensorMapEncodeTiled' in found_functions}} - cdef CUresult _cuTensorMapEncodeTiled(CUtensorMap* tensorMap, CUtensorMapDataType tensorDataType, cuuint32_t tensorRank, void* globalAddress, const cuuint64_t* globalDim, const cuuint64_t* globalStrides, const cuuint32_t* boxDim, const cuuint32_t* elementStrides, CUtensorMapInterleave interleave, CUtensorMapSwizzle swizzle, CUtensorMapL2promotion l2Promotion, CUtensorMapFloatOOBfill oobFill) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTensorMapEncodeIm2col' in found_functions}} - cdef CUresult _cuTensorMapEncodeIm2col(CUtensorMap* tensorMap, CUtensorMapDataType tensorDataType, cuuint32_t tensorRank, void* globalAddress, const cuuint64_t* globalDim, const cuuint64_t* globalStrides, const int* pixelBoxLowerCorner, const int* pixelBoxUpperCorner, cuuint32_t channelsPerPixel, cuuint32_t pixelsPerColumn, const cuuint32_t* elementStrides, CUtensorMapInterleave interleave, CUtensorMapSwizzle swizzle, CUtensorMapL2promotion l2Promotion, CUtensorMapFloatOOBfill oobFill) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuTensorMapReplaceAddress' in found_functions}} - +cdef CUresult _cuTensorMapEncodeIm2colWide(CUtensorMap* tensorMap, CUtensorMapDataType tensorDataType, cuuint32_t tensorRank, void* globalAddress, const cuuint64_t* globalDim, const cuuint64_t* globalStrides, int pixelBoxLowerCornerWidth, int pixelBoxUpperCornerWidth, cuuint32_t channelsPerPixel, cuuint32_t pixelsPerColumn, const cuuint32_t* elementStrides, CUtensorMapInterleave interleave, CUtensorMapIm2ColWideMode mode, CUtensorMapSwizzle swizzle, CUtensorMapL2promotion l2Promotion, CUtensorMapFloatOOBfill oobFill) except ?CUDA_ERROR_NOT_FOUND nogil cdef CUresult _cuTensorMapReplaceAddress(CUtensorMap* tensorMap, void* globalAddress) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDeviceCanAccessPeer' in found_functions}} - cdef CUresult _cuDeviceCanAccessPeer(int* canAccessPeer, CUdevice dev, CUdevice peerDev) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxEnablePeerAccess' in found_functions}} - cdef CUresult _cuCtxEnablePeerAccess(CUcontext peerContext, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxDisablePeerAccess' in found_functions}} - cdef CUresult _cuCtxDisablePeerAccess(CUcontext peerContext) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDeviceGetP2PAttribute' in found_functions}} - cdef CUresult _cuDeviceGetP2PAttribute(int* value, CUdevice_P2PAttribute attrib, CUdevice srcDevice, CUdevice dstDevice) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphicsUnregisterResource' in found_functions}} - cdef CUresult _cuGraphicsUnregisterResource(CUgraphicsResource resource) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphicsSubResourceGetMappedArray' in found_functions}} - cdef CUresult _cuGraphicsSubResourceGetMappedArray(CUarray* pArray, CUgraphicsResource resource, unsigned int arrayIndex, unsigned int mipLevel) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphicsResourceGetMappedMipmappedArray' in found_functions}} - cdef CUresult _cuGraphicsResourceGetMappedMipmappedArray(CUmipmappedArray* pMipmappedArray, CUgraphicsResource resource) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphicsResourceGetMappedPointer_v2' in found_functions}} - cdef CUresult _cuGraphicsResourceGetMappedPointer_v2(CUdeviceptr* pDevPtr, size_t* pSize, CUgraphicsResource resource) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphicsResourceSetMapFlags_v2' in found_functions}} - cdef CUresult _cuGraphicsResourceSetMapFlags_v2(CUgraphicsResource resource, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphicsMapResources' in found_functions}} - cdef CUresult _cuGraphicsMapResources(unsigned int count, CUgraphicsResource* resources, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGraphicsUnmapResources' in found_functions}} - cdef CUresult _cuGraphicsUnmapResources(unsigned int count, CUgraphicsResource* resources, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGetProcAddress_v2' in found_functions}} - cdef CUresult _cuGetProcAddress_v2(const char* symbol, void** pfn, int cudaVersion, cuuint64_t flags, CUdriverProcAddressQueryResult* symbolStatus) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCoredumpGetAttribute' in found_functions}} - cdef CUresult _cuCoredumpGetAttribute(CUcoredumpSettings attrib, void* value, size_t* size) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCoredumpGetAttributeGlobal' in found_functions}} - cdef CUresult _cuCoredumpGetAttributeGlobal(CUcoredumpSettings attrib, void* value, size_t* size) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCoredumpSetAttribute' in found_functions}} - cdef CUresult _cuCoredumpSetAttribute(CUcoredumpSettings attrib, void* value, size_t* size) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCoredumpSetAttributeGlobal' in found_functions}} - cdef CUresult _cuCoredumpSetAttributeGlobal(CUcoredumpSettings attrib, void* value, size_t* size) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGetExportTable' in found_functions}} - cdef CUresult _cuGetExportTable(const void** ppExportTable, const CUuuid* pExportTableId) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGreenCtxCreate' in found_functions}} - cdef CUresult _cuGreenCtxCreate(CUgreenCtx* phCtx, CUdevResourceDesc desc, CUdevice dev, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGreenCtxDestroy' in found_functions}} - cdef CUresult _cuGreenCtxDestroy(CUgreenCtx hCtx) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxFromGreenCtx' in found_functions}} - cdef CUresult _cuCtxFromGreenCtx(CUcontext* pContext, CUgreenCtx hCtx) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDeviceGetDevResource' in found_functions}} - -cdef CUresult _cuDeviceGetDevResource(CUdevice device, CUdevResource* resource, CUdevResourceType typename) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuCtxGetDevResource' in found_functions}} - -cdef CUresult _cuCtxGetDevResource(CUcontext hCtx, CUdevResource* resource, CUdevResourceType typename) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGreenCtxGetDevResource' in found_functions}} - -cdef CUresult _cuGreenCtxGetDevResource(CUgreenCtx hCtx, CUdevResource* resource, CUdevResourceType typename) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDevSmResourceSplitByCount' in found_functions}} - -cdef CUresult _cuDevSmResourceSplitByCount(CUdevResource* result, unsigned int* nbGroups, const CUdevResource* input, CUdevResource* remaining, unsigned int useFlags, unsigned int minCount) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuDevResourceGenerateDesc' in found_functions}} - +cdef CUresult _cuDeviceGetDevResource(CUdevice device, CUdevResource* resource, CUdevResourceType type) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuCtxGetDevResource(CUcontext hCtx, CUdevResource* resource, CUdevResourceType type) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuGreenCtxGetDevResource(CUgreenCtx hCtx, CUdevResource* resource, CUdevResourceType type) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuDevSmResourceSplitByCount(CUdevResource* result, unsigned int* nbGroups, const CUdevResource* input, CUdevResource* remainder, unsigned int flags, unsigned int minCount) except ?CUDA_ERROR_NOT_FOUND nogil cdef CUresult _cuDevResourceGenerateDesc(CUdevResourceDesc* phDesc, CUdevResource* resources, unsigned int nbResources) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGreenCtxRecordEvent' in found_functions}} - cdef CUresult _cuGreenCtxRecordEvent(CUgreenCtx hCtx, CUevent hEvent) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGreenCtxWaitEvent' in found_functions}} - cdef CUresult _cuGreenCtxWaitEvent(CUgreenCtx hCtx, CUevent hEvent) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuStreamGetGreenCtx' in found_functions}} - cdef CUresult _cuStreamGetGreenCtx(CUstream hStream, CUgreenCtx* phCtx) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuGreenCtxStreamCreate' in found_functions}} - cdef CUresult _cuGreenCtxStreamCreate(CUstream* phStream, CUgreenCtx greenCtx, unsigned int flags, int priority) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuProfilerStart' in found_functions}} - -cdef CUresult _cuProfilerStart() except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if 'cuProfilerStop' in found_functions}} - -cdef CUresult _cuProfilerStop() except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if True}} - +cdef CUresult _cuLogsRegisterCallback(CUlogsCallback callbackFunc, void* userData, CUlogsCallbackHandle* callback_out) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuLogsUnregisterCallback(CUlogsCallbackHandle callback) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuLogsCurrent(CUlogIterator* iterator_out, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuLogsDumpToFile(CUlogIterator* iterator, const char* pathToFile, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuLogsDumpToMemory(CUlogIterator* iterator, char* buffer, size_t* size, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuCheckpointProcessGetRestoreThreadId(int pid, int* tid) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuCheckpointProcessGetState(int pid, CUprocessState* state) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuCheckpointProcessLock(int pid, CUcheckpointLockArgs* args) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuCheckpointProcessCheckpoint(int pid, CUcheckpointCheckpointArgs* args) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuCheckpointProcessRestore(int pid, CUcheckpointRestoreArgs* args) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuCheckpointProcessUnlock(int pid, CUcheckpointUnlockArgs* args) except ?CUDA_ERROR_NOT_FOUND nogil cdef CUresult _cuGraphicsEGLRegisterImage(CUgraphicsResource* pCudaResource, EGLImageKHR image, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if True}} - cdef CUresult _cuEGLStreamConsumerConnect(CUeglStreamConnection* conn, EGLStreamKHR stream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if True}} - cdef CUresult _cuEGLStreamConsumerConnectWithFlags(CUeglStreamConnection* conn, EGLStreamKHR stream, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if True}} - cdef CUresult _cuEGLStreamConsumerDisconnect(CUeglStreamConnection* conn) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if True}} - cdef CUresult _cuEGLStreamConsumerAcquireFrame(CUeglStreamConnection* conn, CUgraphicsResource* pCudaResource, CUstream* pStream, unsigned int timeout) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if True}} - cdef CUresult _cuEGLStreamConsumerReleaseFrame(CUeglStreamConnection* conn, CUgraphicsResource pCudaResource, CUstream* pStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if True}} - cdef CUresult _cuEGLStreamProducerConnect(CUeglStreamConnection* conn, EGLStreamKHR stream, EGLint width, EGLint height) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if True}} - cdef CUresult _cuEGLStreamProducerDisconnect(CUeglStreamConnection* conn) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if True}} - cdef CUresult _cuEGLStreamProducerPresentFrame(CUeglStreamConnection* conn, CUeglFrame eglframe, CUstream* pStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if True}} - cdef CUresult _cuEGLStreamProducerReturnFrame(CUeglStreamConnection* conn, CUeglFrame* eglframe, CUstream* pStream) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if True}} - cdef CUresult _cuGraphicsResourceGetMappedEglFrame(CUeglFrame* eglFrame, CUgraphicsResource resource, unsigned int index, unsigned int mipLevel) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if True}} - cdef CUresult _cuEventCreateFromEGLSync(CUevent* phEvent, EGLSyncKHR eglSync, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if True}} - cdef CUresult _cuGraphicsGLRegisterBuffer(CUgraphicsResource* pCudaResource, GLuint buffer, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if True}} - cdef CUresult _cuGraphicsGLRegisterImage(CUgraphicsResource* pCudaResource, GLuint image, GLenum target, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if True}} - cdef CUresult _cuGLGetDevices_v2(unsigned int* pCudaDeviceCount, CUdevice* pCudaDevices, unsigned int cudaDeviceCount, CUGLDeviceList deviceList) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if True}} - +cdef CUresult _cuGLCtxCreate_v2(CUcontext* pCtx, unsigned int Flags, CUdevice device) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuGLInit() except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuGLRegisterBufferObject(GLuint buffer) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuGLMapBufferObject_v2(CUdeviceptr* dptr, size_t* size, GLuint buffer) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuGLUnmapBufferObject(GLuint buffer) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuGLUnregisterBufferObject(GLuint buffer) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuGLSetBufferObjectMapFlags(GLuint buffer, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuGLMapBufferObjectAsync_v2(CUdeviceptr* dptr, size_t* size, GLuint buffer, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuGLUnmapBufferObjectAsync(GLuint buffer, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuProfilerInitialize(const char* configFile, const char* outputFile, CUoutput_mode outputMode) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuProfilerStart() except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuProfilerStop() except ?CUDA_ERROR_NOT_FOUND nogil cdef CUresult _cuVDPAUGetDevice(CUdevice* pDevice, VdpDevice vdpDevice, VdpGetProcAddress* vdpGetProcAddress) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if True}} - cdef CUresult _cuVDPAUCtxCreate_v2(CUcontext* pCtx, unsigned int flags, CUdevice device, VdpDevice vdpDevice, VdpGetProcAddress* vdpGetProcAddress) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if True}} - cdef CUresult _cuGraphicsVDPAURegisterVideoSurface(CUgraphicsResource* pCudaResource, VdpVideoSurface vdpSurface, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - -{{if True}} - cdef CUresult _cuGraphicsVDPAURegisterOutputSurface(CUgraphicsResource* pCudaResource, VdpOutputSurface vdpSurface, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil -{{endif}} - +cdef CUresult _cuDeviceGetHostAtomicCapabilities(unsigned int* capabilities, const CUatomicOperation* operations, unsigned int count, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuCtxGetDevice_v2(CUdevice* device, CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuCtxSynchronize_v2(CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuMemcpyBatchAsync_v2(CUdeviceptr* dsts, CUdeviceptr* srcs, size_t* sizes, size_t count, CUmemcpyAttributes* attrs, size_t* attrsIdxs, size_t numAttrs, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuMemcpy3DBatchAsync_v2(size_t numOps, CUDA_MEMCPY3D_BATCH_OP* opList, unsigned long long flags, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuMemGetDefaultMemPool(CUmemoryPool* pool_out, CUmemLocation* location, CUmemAllocationType type) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuMemGetMemPool(CUmemoryPool* pool, CUmemLocation* location, CUmemAllocationType type) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuMemSetMemPool(CUmemLocation* location, CUmemAllocationType type, CUmemoryPool pool) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuMemPrefetchBatchAsync(CUdeviceptr* dptrs, size_t* sizes, size_t count, CUmemLocation* prefetchLocs, size_t* prefetchLocIdxs, size_t numPrefetchLocs, unsigned long long flags, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuMemDiscardBatchAsync(CUdeviceptr* dptrs, size_t* sizes, size_t count, unsigned long long flags, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuMemDiscardAndPrefetchBatchAsync(CUdeviceptr* dptrs, size_t* sizes, size_t count, CUmemLocation* prefetchLocs, size_t* prefetchLocIdxs, size_t numPrefetchLocs, unsigned long long flags, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuDeviceGetP2PAtomicCapabilities(unsigned int* capabilities, const CUatomicOperation* operations, unsigned int count, CUdevice srcDevice, CUdevice dstDevice) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuGreenCtxGetId(CUgreenCtx greenCtx, unsigned long long* greenCtxId) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuMulticastBindMem_v2(CUmemGenericAllocationHandle mcHandle, CUdevice dev, size_t mcOffset, CUmemGenericAllocationHandle memHandle, size_t memOffset, size_t size, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuMulticastBindAddr_v2(CUmemGenericAllocationHandle mcHandle, CUdevice dev, size_t mcOffset, CUdeviceptr memptr, size_t size, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuGraphNodeGetContainingGraph(CUgraphNode hNode, CUgraph* phGraph) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuGraphNodeGetLocalId(CUgraphNode hNode, unsigned int* nodeId) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuGraphNodeGetToolsId(CUgraphNode hNode, unsigned long long* toolsNodeId) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuGraphGetId(CUgraph hGraph, unsigned int* graphId) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuGraphExecGetId(CUgraphExec hGraphExec, unsigned int* graphId) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuDevSmResourceSplit(CUdevResource* result, unsigned int nbGroups, const CUdevResource* input, CUdevResource* remainder, unsigned int flags, CU_DEV_SM_RESOURCE_GROUP_PARAMS* groupParams) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuStreamGetDevResource(CUstream hStream, CUdevResource* resource, CUdevResourceType type) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuKernelGetParamCount(CUkernel kernel, size_t* paramCount) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuMemcpyWithAttributesAsync(CUdeviceptr dst, CUdeviceptr src, size_t size, CUmemcpyAttributes* attr, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuMemcpy3DWithAttributesAsync(CUDA_MEMCPY3D_BATCH_OP* op, unsigned long long flags, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuStreamBeginCaptureToCig(CUstream hStream, CUstreamCigCaptureParams* streamCigCaptureParams) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuStreamEndCaptureToCig(CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuFuncGetParamCount(CUfunction func, size_t* paramCount) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuLaunchHostFunc_v2(CUstream hStream, CUhostFn fn, void* userData, unsigned int syncMode) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuGraphNodeGetParams(CUgraphNode hNode, CUgraphNodeParams* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuCoredumpRegisterStartCallback(CUcoredumpStatusCallback callback, void* userData, CUcoredumpCallbackHandle* callbackOut) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuCoredumpRegisterCompleteCallback(CUcoredumpStatusCallback callback, void* userData, CUcoredumpCallbackHandle* callbackOut) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuCoredumpDeregisterStartCallback(CUcoredumpCallbackHandle callback) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuCoredumpDeregisterCompleteCallback(CUcoredumpCallbackHandle callback) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuLogicalEndpointIdReserve(CUlogicalEndpointId* baseLeId, cuuint32_t count) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuLogicalEndpointIdRelease(CUlogicalEndpointId baseLeId, cuuint32_t count) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuLogicalEndpointCreate(CUlogicalEndpointId leId, const CUlogicalEndpointProp* prop) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuLogicalEndpointAddDevice(CUlogicalEndpointId leId, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuLogicalEndpointDestroy(CUlogicalEndpointId leId) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuLogicalEndpointBindAddr(CUlogicalEndpointId leId, CUdevice dev, cuuint64_t offset, void* ptr, cuuint64_t size, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuLogicalEndpointBindMem(CUlogicalEndpointId leId, CUdevice dev, cuuint64_t offset, CUmemGenericAllocationHandle memHandle, cuuint64_t memOffset, cuuint64_t size, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuLogicalEndpointUnbind(CUlogicalEndpointId leId, CUdevice dev, cuuint64_t offset, cuuint64_t size) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuLogicalEndpointExport(void* handle, CUlogicalEndpointId leId, CUlogicalEndpointIpcHandleType handleType) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuLogicalEndpointImport(CUlogicalEndpointId leId, const void* handle, CUlogicalEndpointIpcHandleType handleType) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuLogicalEndpointGetLimits(cuuint64_t* bindAlignment, cuuint64_t* maxSize, const CUlogicalEndpointProp* prop) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuLogicalEndpointQuery(CUlogicalEndpointId leId, cuuint32_t count, int* queryStatus) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult _cuStreamBeginRecaptureToGraph(CUstream hStream, CUstreamCaptureMode mode, CUgraph hGraph, CUgraphRecaptureCallback callbackFunc, void* userData) except ?CUDA_ERROR_NOT_FOUND nogil diff --git a/cuda_bindings/cuda/bindings/_internal/driver_linux.pyx b/cuda_bindings/cuda/bindings/_internal/driver_linux.pyx new file mode 100644 index 00000000000..e8bef60476d --- /dev/null +++ b/cuda_bindings/cuda/bindings/_internal/driver_linux.pyx @@ -0,0 +1,8882 @@ +# SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +# This code was automatically generated across versions from 12.9.0 to 13.3.0. Do not modify it directly. +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=644e8be3cdcaddb497db76bdc5912df43457a11696b5b7f710d46cba991d0d0b + + +# <<<< PREAMBLE CONTENT >>>> + +cdef extern from "": + void* _cyb_dlsym "dlsym"(void*, const char*) nogil + +from libc.stdint cimport intptr_t as _cyb_intptr_t + +from os import getenv as _cyb_getenv +import threading as _cyb_threading + +ctypedef int (*_cyb_cuGetProcAddress_v2_T)(const char *, void **, int, cuuint64_t, CUdriverProcAddressQueryResult *)except?CUDA_ERROR_NOT_FOUND nogil + +cdef bint _cyb___py_driver_init = False +cdef dict _cyb_func_ptrs = None +cdef object _cyb_symbol_lock = _cyb_threading.Lock() + +# <<<< END OF PREAMBLE CONTENT >>>> + +from libc.stdint cimport uintptr_t + +from .utils import FunctionNotFoundError, NotSupportedError +from cuda.pathfinder import load_nvidia_dynamic_lib + + +############################################################################### +# Wrapper init +############################################################################### + + +cdef void* __cuGetErrorString = NULL +cdef void* __cuGetErrorName = NULL +cdef void* __cuInit = NULL +cdef void* __cuDriverGetVersion = NULL +cdef void* __cuDeviceGet = NULL +cdef void* __cuDeviceGetCount = NULL +cdef void* __cuDeviceGetName = NULL +cdef void* __cuDeviceGetUuid_v2 = NULL +cdef void* __cuDeviceGetLuid = NULL +cdef void* __cuDeviceTotalMem_v2 = NULL +cdef void* __cuDeviceGetTexture1DLinearMaxWidth = NULL +cdef void* __cuDeviceGetAttribute = NULL +cdef void* __cuDeviceGetNvSciSyncAttributes = NULL +cdef void* __cuDeviceSetMemPool = NULL +cdef void* __cuDeviceGetMemPool = NULL +cdef void* __cuDeviceGetDefaultMemPool = NULL +cdef void* __cuDeviceGetExecAffinitySupport = NULL +cdef void* __cuFlushGPUDirectRDMAWrites = NULL +cdef void* __cuDeviceGetProperties = NULL +cdef void* __cuDeviceComputeCapability = NULL +cdef void* __cuDevicePrimaryCtxRetain = NULL +cdef void* __cuDevicePrimaryCtxRelease_v2 = NULL +cdef void* __cuDevicePrimaryCtxSetFlags_v2 = NULL +cdef void* __cuDevicePrimaryCtxGetState = NULL +cdef void* __cuDevicePrimaryCtxReset_v2 = NULL +cdef void* __cuCtxCreate_v2 = NULL +cdef void* __cuCtxCreate_v3 = NULL +cdef void* __cuCtxCreate_v4 = NULL +cdef void* __cuCtxDestroy_v2 = NULL +cdef void* __cuCtxPushCurrent_v2 = NULL +cdef void* __cuCtxPopCurrent_v2 = NULL +cdef void* __cuCtxSetCurrent = NULL +cdef void* __cuCtxGetCurrent = NULL +cdef void* __cuCtxGetDevice = NULL +cdef void* __cuCtxGetFlags = NULL +cdef void* __cuCtxSetFlags = NULL +cdef void* __cuCtxGetId = NULL +cdef void* __cuCtxSynchronize = NULL +cdef void* __cuCtxSetLimit = NULL +cdef void* __cuCtxGetLimit = NULL +cdef void* __cuCtxGetCacheConfig = NULL +cdef void* __cuCtxSetCacheConfig = NULL +cdef void* __cuCtxGetApiVersion = NULL +cdef void* __cuCtxGetStreamPriorityRange = NULL +cdef void* __cuCtxResetPersistingL2Cache = NULL +cdef void* __cuCtxGetExecAffinity = NULL +cdef void* __cuCtxRecordEvent = NULL +cdef void* __cuCtxWaitEvent = NULL +cdef void* __cuCtxAttach = NULL +cdef void* __cuCtxDetach = NULL +cdef void* __cuCtxGetSharedMemConfig = NULL +cdef void* __cuCtxSetSharedMemConfig = NULL +cdef void* __cuModuleLoad = NULL +cdef void* __cuModuleLoadData = NULL +cdef void* __cuModuleLoadDataEx = NULL +cdef void* __cuModuleLoadFatBinary = NULL +cdef void* __cuModuleUnload = NULL +cdef void* __cuModuleGetLoadingMode = NULL +cdef void* __cuModuleGetFunction = NULL +cdef void* __cuModuleGetFunctionCount = NULL +cdef void* __cuModuleEnumerateFunctions = NULL +cdef void* __cuModuleGetGlobal_v2 = NULL +cdef void* __cuLinkCreate_v2 = NULL +cdef void* __cuLinkAddData_v2 = NULL +cdef void* __cuLinkAddFile_v2 = NULL +cdef void* __cuLinkComplete = NULL +cdef void* __cuLinkDestroy = NULL +cdef void* __cuModuleGetTexRef = NULL +cdef void* __cuModuleGetSurfRef = NULL +cdef void* __cuLibraryLoadData = NULL +cdef void* __cuLibraryLoadFromFile = NULL +cdef void* __cuLibraryUnload = NULL +cdef void* __cuLibraryGetKernel = NULL +cdef void* __cuLibraryGetKernelCount = NULL +cdef void* __cuLibraryEnumerateKernels = NULL +cdef void* __cuLibraryGetModule = NULL +cdef void* __cuKernelGetFunction = NULL +cdef void* __cuKernelGetLibrary = NULL +cdef void* __cuLibraryGetGlobal = NULL +cdef void* __cuLibraryGetManaged = NULL +cdef void* __cuLibraryGetUnifiedFunction = NULL +cdef void* __cuKernelGetAttribute = NULL +cdef void* __cuKernelSetAttribute = NULL +cdef void* __cuKernelSetCacheConfig = NULL +cdef void* __cuKernelGetName = NULL +cdef void* __cuKernelGetParamInfo = NULL +cdef void* __cuMemGetInfo_v2 = NULL +cdef void* __cuMemAlloc_v2 = NULL +cdef void* __cuMemAllocPitch_v2 = NULL +cdef void* __cuMemFree_v2 = NULL +cdef void* __cuMemGetAddressRange_v2 = NULL +cdef void* __cuMemAllocHost_v2 = NULL +cdef void* __cuMemFreeHost = NULL +cdef void* __cuMemHostAlloc = NULL +cdef void* __cuMemHostGetDevicePointer_v2 = NULL +cdef void* __cuMemHostGetFlags = NULL +cdef void* __cuMemAllocManaged = NULL +cdef void* __cuDeviceRegisterAsyncNotification = NULL +cdef void* __cuDeviceUnregisterAsyncNotification = NULL +cdef void* __cuDeviceGetByPCIBusId = NULL +cdef void* __cuDeviceGetPCIBusId = NULL +cdef void* __cuIpcGetEventHandle = NULL +cdef void* __cuIpcOpenEventHandle = NULL +cdef void* __cuIpcGetMemHandle = NULL +cdef void* __cuIpcOpenMemHandle_v2 = NULL +cdef void* __cuIpcCloseMemHandle = NULL +cdef void* __cuMemHostRegister_v2 = NULL +cdef void* __cuMemHostUnregister = NULL +cdef void* __cuMemcpy = NULL +cdef void* __cuMemcpyPeer = NULL +cdef void* __cuMemcpyHtoD_v2 = NULL +cdef void* __cuMemcpyDtoH_v2 = NULL +cdef void* __cuMemcpyDtoD_v2 = NULL +cdef void* __cuMemcpyDtoA_v2 = NULL +cdef void* __cuMemcpyAtoD_v2 = NULL +cdef void* __cuMemcpyHtoA_v2 = NULL +cdef void* __cuMemcpyAtoH_v2 = NULL +cdef void* __cuMemcpyAtoA_v2 = NULL +cdef void* __cuMemcpy2D_v2 = NULL +cdef void* __cuMemcpy2DUnaligned_v2 = NULL +cdef void* __cuMemcpy3D_v2 = NULL +cdef void* __cuMemcpy3DPeer = NULL +cdef void* __cuMemcpyAsync = NULL +cdef void* __cuMemcpyPeerAsync = NULL +cdef void* __cuMemcpyHtoDAsync_v2 = NULL +cdef void* __cuMemcpyDtoHAsync_v2 = NULL +cdef void* __cuMemcpyDtoDAsync_v2 = NULL +cdef void* __cuMemcpyHtoAAsync_v2 = NULL +cdef void* __cuMemcpyAtoHAsync_v2 = NULL +cdef void* __cuMemcpy2DAsync_v2 = NULL +cdef void* __cuMemcpy3DAsync_v2 = NULL +cdef void* __cuMemcpy3DPeerAsync = NULL +cdef void* __cuMemsetD8_v2 = NULL +cdef void* __cuMemsetD16_v2 = NULL +cdef void* __cuMemsetD32_v2 = NULL +cdef void* __cuMemsetD2D8_v2 = NULL +cdef void* __cuMemsetD2D16_v2 = NULL +cdef void* __cuMemsetD2D32_v2 = NULL +cdef void* __cuMemsetD8Async = NULL +cdef void* __cuMemsetD16Async = NULL +cdef void* __cuMemsetD32Async = NULL +cdef void* __cuMemsetD2D8Async = NULL +cdef void* __cuMemsetD2D16Async = NULL +cdef void* __cuMemsetD2D32Async = NULL +cdef void* __cuArrayCreate_v2 = NULL +cdef void* __cuArrayGetDescriptor_v2 = NULL +cdef void* __cuArrayGetSparseProperties = NULL +cdef void* __cuMipmappedArrayGetSparseProperties = NULL +cdef void* __cuArrayGetMemoryRequirements = NULL +cdef void* __cuMipmappedArrayGetMemoryRequirements = NULL +cdef void* __cuArrayGetPlane = NULL +cdef void* __cuArrayDestroy = NULL +cdef void* __cuArray3DCreate_v2 = NULL +cdef void* __cuArray3DGetDescriptor_v2 = NULL +cdef void* __cuMipmappedArrayCreate = NULL +cdef void* __cuMipmappedArrayGetLevel = NULL +cdef void* __cuMipmappedArrayDestroy = NULL +cdef void* __cuMemGetHandleForAddressRange = NULL +cdef void* __cuMemBatchDecompressAsync = NULL +cdef void* __cuMemAddressReserve = NULL +cdef void* __cuMemAddressFree = NULL +cdef void* __cuMemCreate = NULL +cdef void* __cuMemRelease = NULL +cdef void* __cuMemMap = NULL +cdef void* __cuMemMapArrayAsync = NULL +cdef void* __cuMemUnmap = NULL +cdef void* __cuMemSetAccess = NULL +cdef void* __cuMemGetAccess = NULL +cdef void* __cuMemExportToShareableHandle = NULL +cdef void* __cuMemImportFromShareableHandle = NULL +cdef void* __cuMemGetAllocationGranularity = NULL +cdef void* __cuMemGetAllocationPropertiesFromHandle = NULL +cdef void* __cuMemRetainAllocationHandle = NULL +cdef void* __cuMemFreeAsync = NULL +cdef void* __cuMemAllocAsync = NULL +cdef void* __cuMemPoolTrimTo = NULL +cdef void* __cuMemPoolSetAttribute = NULL +cdef void* __cuMemPoolGetAttribute = NULL +cdef void* __cuMemPoolSetAccess = NULL +cdef void* __cuMemPoolGetAccess = NULL +cdef void* __cuMemPoolCreate = NULL +cdef void* __cuMemPoolDestroy = NULL +cdef void* __cuMemAllocFromPoolAsync = NULL +cdef void* __cuMemPoolExportToShareableHandle = NULL +cdef void* __cuMemPoolImportFromShareableHandle = NULL +cdef void* __cuMemPoolExportPointer = NULL +cdef void* __cuMemPoolImportPointer = NULL +cdef void* __cuMulticastCreate = NULL +cdef void* __cuMulticastAddDevice = NULL +cdef void* __cuMulticastBindMem = NULL +cdef void* __cuMulticastBindAddr = NULL +cdef void* __cuMulticastUnbind = NULL +cdef void* __cuMulticastGetGranularity = NULL +cdef void* __cuPointerGetAttribute = NULL +cdef void* __cuMemPrefetchAsync_v2 = NULL +cdef void* __cuMemAdvise_v2 = NULL +cdef void* __cuMemRangeGetAttribute = NULL +cdef void* __cuMemRangeGetAttributes = NULL +cdef void* __cuPointerSetAttribute = NULL +cdef void* __cuPointerGetAttributes = NULL +cdef void* __cuStreamCreate = NULL +cdef void* __cuStreamCreateWithPriority = NULL +cdef void* __cuStreamGetPriority = NULL +cdef void* __cuStreamGetDevice = NULL +cdef void* __cuStreamGetFlags = NULL +cdef void* __cuStreamGetId = NULL +cdef void* __cuStreamGetCtx = NULL +cdef void* __cuStreamGetCtx_v2 = NULL +cdef void* __cuStreamWaitEvent = NULL +cdef void* __cuStreamAddCallback = NULL +cdef void* __cuStreamBeginCapture_v2 = NULL +cdef void* __cuStreamBeginCaptureToGraph = NULL +cdef void* __cuThreadExchangeStreamCaptureMode = NULL +cdef void* __cuStreamEndCapture = NULL +cdef void* __cuStreamIsCapturing = NULL +cdef void* __cuStreamGetCaptureInfo_v2 = NULL +cdef void* __cuStreamGetCaptureInfo_v3 = NULL +cdef void* __cuStreamUpdateCaptureDependencies_v2 = NULL +cdef void* __cuStreamAttachMemAsync = NULL +cdef void* __cuStreamQuery = NULL +cdef void* __cuStreamSynchronize = NULL +cdef void* __cuStreamDestroy_v2 = NULL +cdef void* __cuStreamCopyAttributes = NULL +cdef void* __cuStreamGetAttribute = NULL +cdef void* __cuStreamSetAttribute = NULL +cdef void* __cuEventCreate = NULL +cdef void* __cuEventRecord = NULL +cdef void* __cuEventRecordWithFlags = NULL +cdef void* __cuEventQuery = NULL +cdef void* __cuEventSynchronize = NULL +cdef void* __cuEventDestroy_v2 = NULL +cdef void* __cuEventElapsedTime_v2 = NULL +cdef void* __cuImportExternalMemory = NULL +cdef void* __cuExternalMemoryGetMappedBuffer = NULL +cdef void* __cuExternalMemoryGetMappedMipmappedArray = NULL +cdef void* __cuDestroyExternalMemory = NULL +cdef void* __cuImportExternalSemaphore = NULL +cdef void* __cuSignalExternalSemaphoresAsync = NULL +cdef void* __cuWaitExternalSemaphoresAsync = NULL +cdef void* __cuDestroyExternalSemaphore = NULL +cdef void* __cuStreamWaitValue32_v2 = NULL +cdef void* __cuStreamWaitValue64_v2 = NULL +cdef void* __cuStreamWriteValue32_v2 = NULL +cdef void* __cuStreamWriteValue64_v2 = NULL +cdef void* __cuStreamBatchMemOp_v2 = NULL +cdef void* __cuFuncGetAttribute = NULL +cdef void* __cuFuncSetAttribute = NULL +cdef void* __cuFuncSetCacheConfig = NULL +cdef void* __cuFuncGetModule = NULL +cdef void* __cuFuncGetName = NULL +cdef void* __cuFuncGetParamInfo = NULL +cdef void* __cuFuncIsLoaded = NULL +cdef void* __cuFuncLoad = NULL +cdef void* __cuLaunchKernel = NULL +cdef void* __cuLaunchKernelEx = NULL +cdef void* __cuLaunchCooperativeKernel = NULL +cdef void* __cuLaunchCooperativeKernelMultiDevice = NULL +cdef void* __cuLaunchHostFunc = NULL +cdef void* __cuFuncSetBlockShape = NULL +cdef void* __cuFuncSetSharedSize = NULL +cdef void* __cuParamSetSize = NULL +cdef void* __cuParamSeti = NULL +cdef void* __cuParamSetf = NULL +cdef void* __cuParamSetv = NULL +cdef void* __cuLaunch = NULL +cdef void* __cuLaunchGrid = NULL +cdef void* __cuLaunchGridAsync = NULL +cdef void* __cuParamSetTexRef = NULL +cdef void* __cuFuncSetSharedMemConfig = NULL +cdef void* __cuGraphCreate = NULL +cdef void* __cuGraphAddKernelNode_v2 = NULL +cdef void* __cuGraphKernelNodeGetParams_v2 = NULL +cdef void* __cuGraphKernelNodeSetParams_v2 = NULL +cdef void* __cuGraphAddMemcpyNode = NULL +cdef void* __cuGraphMemcpyNodeGetParams = NULL +cdef void* __cuGraphMemcpyNodeSetParams = NULL +cdef void* __cuGraphAddMemsetNode = NULL +cdef void* __cuGraphMemsetNodeGetParams = NULL +cdef void* __cuGraphMemsetNodeSetParams = NULL +cdef void* __cuGraphAddHostNode = NULL +cdef void* __cuGraphHostNodeGetParams = NULL +cdef void* __cuGraphHostNodeSetParams = NULL +cdef void* __cuGraphAddChildGraphNode = NULL +cdef void* __cuGraphChildGraphNodeGetGraph = NULL +cdef void* __cuGraphAddEmptyNode = NULL +cdef void* __cuGraphAddEventRecordNode = NULL +cdef void* __cuGraphEventRecordNodeGetEvent = NULL +cdef void* __cuGraphEventRecordNodeSetEvent = NULL +cdef void* __cuGraphAddEventWaitNode = NULL +cdef void* __cuGraphEventWaitNodeGetEvent = NULL +cdef void* __cuGraphEventWaitNodeSetEvent = NULL +cdef void* __cuGraphAddExternalSemaphoresSignalNode = NULL +cdef void* __cuGraphExternalSemaphoresSignalNodeGetParams = NULL +cdef void* __cuGraphExternalSemaphoresSignalNodeSetParams = NULL +cdef void* __cuGraphAddExternalSemaphoresWaitNode = NULL +cdef void* __cuGraphExternalSemaphoresWaitNodeGetParams = NULL +cdef void* __cuGraphExternalSemaphoresWaitNodeSetParams = NULL +cdef void* __cuGraphAddBatchMemOpNode = NULL +cdef void* __cuGraphBatchMemOpNodeGetParams = NULL +cdef void* __cuGraphBatchMemOpNodeSetParams = NULL +cdef void* __cuGraphExecBatchMemOpNodeSetParams = NULL +cdef void* __cuGraphAddMemAllocNode = NULL +cdef void* __cuGraphMemAllocNodeGetParams = NULL +cdef void* __cuGraphAddMemFreeNode = NULL +cdef void* __cuGraphMemFreeNodeGetParams = NULL +cdef void* __cuDeviceGraphMemTrim = NULL +cdef void* __cuDeviceGetGraphMemAttribute = NULL +cdef void* __cuDeviceSetGraphMemAttribute = NULL +cdef void* __cuGraphClone = NULL +cdef void* __cuGraphNodeFindInClone = NULL +cdef void* __cuGraphNodeGetType = NULL +cdef void* __cuGraphGetNodes = NULL +cdef void* __cuGraphGetRootNodes = NULL +cdef void* __cuGraphGetEdges_v2 = NULL +cdef void* __cuGraphNodeGetDependencies_v2 = NULL +cdef void* __cuGraphNodeGetDependentNodes_v2 = NULL +cdef void* __cuGraphAddDependencies_v2 = NULL +cdef void* __cuGraphRemoveDependencies_v2 = NULL +cdef void* __cuGraphDestroyNode = NULL +cdef void* __cuGraphInstantiateWithFlags = NULL +cdef void* __cuGraphInstantiateWithParams = NULL +cdef void* __cuGraphExecGetFlags = NULL +cdef void* __cuGraphExecKernelNodeSetParams_v2 = NULL +cdef void* __cuGraphExecMemcpyNodeSetParams = NULL +cdef void* __cuGraphExecMemsetNodeSetParams = NULL +cdef void* __cuGraphExecHostNodeSetParams = NULL +cdef void* __cuGraphExecChildGraphNodeSetParams = NULL +cdef void* __cuGraphExecEventRecordNodeSetEvent = NULL +cdef void* __cuGraphExecEventWaitNodeSetEvent = NULL +cdef void* __cuGraphExecExternalSemaphoresSignalNodeSetParams = NULL +cdef void* __cuGraphExecExternalSemaphoresWaitNodeSetParams = NULL +cdef void* __cuGraphNodeSetEnabled = NULL +cdef void* __cuGraphNodeGetEnabled = NULL +cdef void* __cuGraphUpload = NULL +cdef void* __cuGraphLaunch = NULL +cdef void* __cuGraphExecDestroy = NULL +cdef void* __cuGraphDestroy = NULL +cdef void* __cuGraphExecUpdate_v2 = NULL +cdef void* __cuGraphKernelNodeCopyAttributes = NULL +cdef void* __cuGraphKernelNodeGetAttribute = NULL +cdef void* __cuGraphKernelNodeSetAttribute = NULL +cdef void* __cuGraphDebugDotPrint = NULL +cdef void* __cuUserObjectCreate = NULL +cdef void* __cuUserObjectRetain = NULL +cdef void* __cuUserObjectRelease = NULL +cdef void* __cuGraphRetainUserObject = NULL +cdef void* __cuGraphReleaseUserObject = NULL +cdef void* __cuGraphAddNode_v2 = NULL +cdef void* __cuGraphNodeSetParams = NULL +cdef void* __cuGraphExecNodeSetParams = NULL +cdef void* __cuGraphConditionalHandleCreate = NULL +cdef void* __cuOccupancyMaxActiveBlocksPerMultiprocessor = NULL +cdef void* __cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags = NULL +cdef void* __cuOccupancyMaxPotentialBlockSize = NULL +cdef void* __cuOccupancyMaxPotentialBlockSizeWithFlags = NULL +cdef void* __cuOccupancyAvailableDynamicSMemPerBlock = NULL +cdef void* __cuOccupancyMaxPotentialClusterSize = NULL +cdef void* __cuOccupancyMaxActiveClusters = NULL +cdef void* __cuTexRefSetArray = NULL +cdef void* __cuTexRefSetMipmappedArray = NULL +cdef void* __cuTexRefSetAddress_v2 = NULL +cdef void* __cuTexRefSetAddress2D_v3 = NULL +cdef void* __cuTexRefSetFormat = NULL +cdef void* __cuTexRefSetAddressMode = NULL +cdef void* __cuTexRefSetFilterMode = NULL +cdef void* __cuTexRefSetMipmapFilterMode = NULL +cdef void* __cuTexRefSetMipmapLevelBias = NULL +cdef void* __cuTexRefSetMipmapLevelClamp = NULL +cdef void* __cuTexRefSetMaxAnisotropy = NULL +cdef void* __cuTexRefSetBorderColor = NULL +cdef void* __cuTexRefSetFlags = NULL +cdef void* __cuTexRefGetAddress_v2 = NULL +cdef void* __cuTexRefGetArray = NULL +cdef void* __cuTexRefGetMipmappedArray = NULL +cdef void* __cuTexRefGetAddressMode = NULL +cdef void* __cuTexRefGetFilterMode = NULL +cdef void* __cuTexRefGetFormat = NULL +cdef void* __cuTexRefGetMipmapFilterMode = NULL +cdef void* __cuTexRefGetMipmapLevelBias = NULL +cdef void* __cuTexRefGetMipmapLevelClamp = NULL +cdef void* __cuTexRefGetMaxAnisotropy = NULL +cdef void* __cuTexRefGetBorderColor = NULL +cdef void* __cuTexRefGetFlags = NULL +cdef void* __cuTexRefCreate = NULL +cdef void* __cuTexRefDestroy = NULL +cdef void* __cuSurfRefSetArray = NULL +cdef void* __cuSurfRefGetArray = NULL +cdef void* __cuTexObjectCreate = NULL +cdef void* __cuTexObjectDestroy = NULL +cdef void* __cuTexObjectGetResourceDesc = NULL +cdef void* __cuTexObjectGetTextureDesc = NULL +cdef void* __cuTexObjectGetResourceViewDesc = NULL +cdef void* __cuSurfObjectCreate = NULL +cdef void* __cuSurfObjectDestroy = NULL +cdef void* __cuSurfObjectGetResourceDesc = NULL +cdef void* __cuTensorMapEncodeTiled = NULL +cdef void* __cuTensorMapEncodeIm2col = NULL +cdef void* __cuTensorMapEncodeIm2colWide = NULL +cdef void* __cuTensorMapReplaceAddress = NULL +cdef void* __cuDeviceCanAccessPeer = NULL +cdef void* __cuCtxEnablePeerAccess = NULL +cdef void* __cuCtxDisablePeerAccess = NULL +cdef void* __cuDeviceGetP2PAttribute = NULL +cdef void* __cuGraphicsUnregisterResource = NULL +cdef void* __cuGraphicsSubResourceGetMappedArray = NULL +cdef void* __cuGraphicsResourceGetMappedMipmappedArray = NULL +cdef void* __cuGraphicsResourceGetMappedPointer_v2 = NULL +cdef void* __cuGraphicsResourceSetMapFlags_v2 = NULL +cdef void* __cuGraphicsMapResources = NULL +cdef void* __cuGraphicsUnmapResources = NULL +cdef void* __cuGetProcAddress_v2 = NULL +cdef void* __cuCoredumpGetAttribute = NULL +cdef void* __cuCoredumpGetAttributeGlobal = NULL +cdef void* __cuCoredumpSetAttribute = NULL +cdef void* __cuCoredumpSetAttributeGlobal = NULL +cdef void* __cuGetExportTable = NULL +cdef void* __cuGreenCtxCreate = NULL +cdef void* __cuGreenCtxDestroy = NULL +cdef void* __cuCtxFromGreenCtx = NULL +cdef void* __cuDeviceGetDevResource = NULL +cdef void* __cuCtxGetDevResource = NULL +cdef void* __cuGreenCtxGetDevResource = NULL +cdef void* __cuDevSmResourceSplitByCount = NULL +cdef void* __cuDevResourceGenerateDesc = NULL +cdef void* __cuGreenCtxRecordEvent = NULL +cdef void* __cuGreenCtxWaitEvent = NULL +cdef void* __cuStreamGetGreenCtx = NULL +cdef void* __cuGreenCtxStreamCreate = NULL +cdef void* __cuLogsRegisterCallback = NULL +cdef void* __cuLogsUnregisterCallback = NULL +cdef void* __cuLogsCurrent = NULL +cdef void* __cuLogsDumpToFile = NULL +cdef void* __cuLogsDumpToMemory = NULL +cdef void* __cuCheckpointProcessGetRestoreThreadId = NULL +cdef void* __cuCheckpointProcessGetState = NULL +cdef void* __cuCheckpointProcessLock = NULL +cdef void* __cuCheckpointProcessCheckpoint = NULL +cdef void* __cuCheckpointProcessRestore = NULL +cdef void* __cuCheckpointProcessUnlock = NULL +cdef void* __cuGraphicsEGLRegisterImage = NULL +cdef void* __cuEGLStreamConsumerConnect = NULL +cdef void* __cuEGLStreamConsumerConnectWithFlags = NULL +cdef void* __cuEGLStreamConsumerDisconnect = NULL +cdef void* __cuEGLStreamConsumerAcquireFrame = NULL +cdef void* __cuEGLStreamConsumerReleaseFrame = NULL +cdef void* __cuEGLStreamProducerConnect = NULL +cdef void* __cuEGLStreamProducerDisconnect = NULL +cdef void* __cuEGLStreamProducerPresentFrame = NULL +cdef void* __cuEGLStreamProducerReturnFrame = NULL +cdef void* __cuGraphicsResourceGetMappedEglFrame = NULL +cdef void* __cuEventCreateFromEGLSync = NULL +cdef void* __cuGraphicsGLRegisterBuffer = NULL +cdef void* __cuGraphicsGLRegisterImage = NULL +cdef void* __cuGLGetDevices_v2 = NULL +cdef void* __cuGLCtxCreate_v2 = NULL +cdef void* __cuGLInit = NULL +cdef void* __cuGLRegisterBufferObject = NULL +cdef void* __cuGLMapBufferObject_v2 = NULL +cdef void* __cuGLUnmapBufferObject = NULL +cdef void* __cuGLUnregisterBufferObject = NULL +cdef void* __cuGLSetBufferObjectMapFlags = NULL +cdef void* __cuGLMapBufferObjectAsync_v2 = NULL +cdef void* __cuGLUnmapBufferObjectAsync = NULL +cdef void* __cuProfilerInitialize = NULL +cdef void* __cuProfilerStart = NULL +cdef void* __cuProfilerStop = NULL +cdef void* __cuVDPAUGetDevice = NULL +cdef void* __cuVDPAUCtxCreate_v2 = NULL +cdef void* __cuGraphicsVDPAURegisterVideoSurface = NULL +cdef void* __cuGraphicsVDPAURegisterOutputSurface = NULL +cdef void* __cuDeviceGetHostAtomicCapabilities = NULL +cdef void* __cuCtxGetDevice_v2 = NULL +cdef void* __cuCtxSynchronize_v2 = NULL +cdef void* __cuMemcpyBatchAsync_v2 = NULL +cdef void* __cuMemcpy3DBatchAsync_v2 = NULL +cdef void* __cuMemGetDefaultMemPool = NULL +cdef void* __cuMemGetMemPool = NULL +cdef void* __cuMemSetMemPool = NULL +cdef void* __cuMemPrefetchBatchAsync = NULL +cdef void* __cuMemDiscardBatchAsync = NULL +cdef void* __cuMemDiscardAndPrefetchBatchAsync = NULL +cdef void* __cuDeviceGetP2PAtomicCapabilities = NULL +cdef void* __cuGreenCtxGetId = NULL +cdef void* __cuMulticastBindMem_v2 = NULL +cdef void* __cuMulticastBindAddr_v2 = NULL +cdef void* __cuGraphNodeGetContainingGraph = NULL +cdef void* __cuGraphNodeGetLocalId = NULL +cdef void* __cuGraphNodeGetToolsId = NULL +cdef void* __cuGraphGetId = NULL +cdef void* __cuGraphExecGetId = NULL +cdef void* __cuDevSmResourceSplit = NULL +cdef void* __cuStreamGetDevResource = NULL +cdef void* __cuKernelGetParamCount = NULL +cdef void* __cuMemcpyWithAttributesAsync = NULL +cdef void* __cuMemcpy3DWithAttributesAsync = NULL +cdef void* __cuStreamBeginCaptureToCig = NULL +cdef void* __cuStreamEndCaptureToCig = NULL +cdef void* __cuFuncGetParamCount = NULL +cdef void* __cuLaunchHostFunc_v2 = NULL +cdef void* __cuGraphNodeGetParams = NULL +cdef void* __cuCoredumpRegisterStartCallback = NULL +cdef void* __cuCoredumpRegisterCompleteCallback = NULL +cdef void* __cuCoredumpDeregisterStartCallback = NULL +cdef void* __cuCoredumpDeregisterCompleteCallback = NULL +cdef void* __cuLogicalEndpointIdReserve = NULL +cdef void* __cuLogicalEndpointIdRelease = NULL +cdef void* __cuLogicalEndpointCreate = NULL +cdef void* __cuLogicalEndpointAddDevice = NULL +cdef void* __cuLogicalEndpointDestroy = NULL +cdef void* __cuLogicalEndpointBindAddr = NULL +cdef void* __cuLogicalEndpointBindMem = NULL +cdef void* __cuLogicalEndpointUnbind = NULL +cdef void* __cuLogicalEndpointExport = NULL +cdef void* __cuLogicalEndpointImport = NULL +cdef void* __cuLogicalEndpointGetLimits = NULL +cdef void* __cuLogicalEndpointQuery = NULL +cdef void* __cuStreamBeginRecaptureToGraph = NULL + +cdef int _init_driver() except -1 nogil: + global _cyb___py_driver_init + cdef void* handle = NULL + cdef int ptds_mode + cdef _cyb_cuGetProcAddress_v2_T cuGetProcAddress_v2 + with gil, _cyb_symbol_lock: + if _cyb___py_driver_init: return 0 + + handle = load_library() + if handle == NULL: + raise RuntimeError('Failed to open cuda') + # Get latest cuGetProcAddress_v2 + cuGetProcAddress_v2 = <_cyb_cuGetProcAddress_v2_T>_cyb_dlsym(handle, 'cuGetProcAddress_v2') + if cuGetProcAddress_v2 == NULL: + raise RuntimeError("Failed to get cuGetProcAddress_v2") + if bool(int(_cyb_getenv('CUDA_PYTHON_CUDA_PER_THREAD_DEFAULT_STREAM', default=0))): + ptds_mode = CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM + else: + ptds_mode = CU_GET_PROC_ADDRESS_DEFAULT + global __cuGetErrorString + cuGetProcAddress_v2('cuGetErrorString', &__cuGetErrorString, 6000, ptds_mode, NULL) + + global __cuGetErrorName + cuGetProcAddress_v2('cuGetErrorName', &__cuGetErrorName, 6000, ptds_mode, NULL) + + global __cuInit + cuGetProcAddress_v2('cuInit', &__cuInit, 2000, ptds_mode, NULL) + + global __cuDriverGetVersion + cuGetProcAddress_v2('cuDriverGetVersion', &__cuDriverGetVersion, 2020, ptds_mode, NULL) + + global __cuDeviceGet + cuGetProcAddress_v2('cuDeviceGet', &__cuDeviceGet, 2000, ptds_mode, NULL) + + global __cuDeviceGetCount + cuGetProcAddress_v2('cuDeviceGetCount', &__cuDeviceGetCount, 2000, ptds_mode, NULL) + + global __cuDeviceGetName + cuGetProcAddress_v2('cuDeviceGetName', &__cuDeviceGetName, 2000, ptds_mode, NULL) + + global __cuDeviceGetUuid_v2 + cuGetProcAddress_v2('cuDeviceGetUuid', &__cuDeviceGetUuid_v2, 11040, ptds_mode, NULL) + + global __cuDeviceGetLuid + cuGetProcAddress_v2('cuDeviceGetLuid', &__cuDeviceGetLuid, 10000, ptds_mode, NULL) + + global __cuDeviceTotalMem_v2 + cuGetProcAddress_v2('cuDeviceTotalMem', &__cuDeviceTotalMem_v2, 3020, ptds_mode, NULL) + + global __cuDeviceGetTexture1DLinearMaxWidth + cuGetProcAddress_v2('cuDeviceGetTexture1DLinearMaxWidth', &__cuDeviceGetTexture1DLinearMaxWidth, 11010, ptds_mode, NULL) + + global __cuDeviceGetAttribute + cuGetProcAddress_v2('cuDeviceGetAttribute', &__cuDeviceGetAttribute, 2000, ptds_mode, NULL) + + global __cuDeviceGetNvSciSyncAttributes + cuGetProcAddress_v2('cuDeviceGetNvSciSyncAttributes', &__cuDeviceGetNvSciSyncAttributes, 10020, ptds_mode, NULL) + + global __cuDeviceSetMemPool + cuGetProcAddress_v2('cuDeviceSetMemPool', &__cuDeviceSetMemPool, 11020, ptds_mode, NULL) + + global __cuDeviceGetMemPool + cuGetProcAddress_v2('cuDeviceGetMemPool', &__cuDeviceGetMemPool, 11020, ptds_mode, NULL) + + global __cuDeviceGetDefaultMemPool + cuGetProcAddress_v2('cuDeviceGetDefaultMemPool', &__cuDeviceGetDefaultMemPool, 11020, ptds_mode, NULL) + + global __cuDeviceGetExecAffinitySupport + cuGetProcAddress_v2('cuDeviceGetExecAffinitySupport', &__cuDeviceGetExecAffinitySupport, 11040, ptds_mode, NULL) + + global __cuFlushGPUDirectRDMAWrites + cuGetProcAddress_v2('cuFlushGPUDirectRDMAWrites', &__cuFlushGPUDirectRDMAWrites, 11030, ptds_mode, NULL) + + global __cuDeviceGetProperties + cuGetProcAddress_v2('cuDeviceGetProperties', &__cuDeviceGetProperties, 2000, ptds_mode, NULL) + + global __cuDeviceComputeCapability + cuGetProcAddress_v2('cuDeviceComputeCapability', &__cuDeviceComputeCapability, 2000, ptds_mode, NULL) + + global __cuDevicePrimaryCtxRetain + cuGetProcAddress_v2('cuDevicePrimaryCtxRetain', &__cuDevicePrimaryCtxRetain, 7000, ptds_mode, NULL) + + global __cuDevicePrimaryCtxRelease_v2 + cuGetProcAddress_v2('cuDevicePrimaryCtxRelease', &__cuDevicePrimaryCtxRelease_v2, 11000, ptds_mode, NULL) + + global __cuDevicePrimaryCtxSetFlags_v2 + cuGetProcAddress_v2('cuDevicePrimaryCtxSetFlags', &__cuDevicePrimaryCtxSetFlags_v2, 11000, ptds_mode, NULL) + + global __cuDevicePrimaryCtxGetState + cuGetProcAddress_v2('cuDevicePrimaryCtxGetState', &__cuDevicePrimaryCtxGetState, 7000, ptds_mode, NULL) + + global __cuDevicePrimaryCtxReset_v2 + cuGetProcAddress_v2('cuDevicePrimaryCtxReset', &__cuDevicePrimaryCtxReset_v2, 11000, ptds_mode, NULL) + + global __cuCtxCreate_v2 + cuGetProcAddress_v2('cuCtxCreate', &__cuCtxCreate_v2, 3020, ptds_mode, NULL) + + global __cuCtxCreate_v3 + cuGetProcAddress_v2('cuCtxCreate', &__cuCtxCreate_v3, 11040, ptds_mode, NULL) + + global __cuCtxCreate_v4 + cuGetProcAddress_v2('cuCtxCreate', &__cuCtxCreate_v4, 12050, ptds_mode, NULL) + + global __cuCtxDestroy_v2 + cuGetProcAddress_v2('cuCtxDestroy', &__cuCtxDestroy_v2, 4000, ptds_mode, NULL) + + global __cuCtxPushCurrent_v2 + cuGetProcAddress_v2('cuCtxPushCurrent', &__cuCtxPushCurrent_v2, 4000, ptds_mode, NULL) + + global __cuCtxPopCurrent_v2 + cuGetProcAddress_v2('cuCtxPopCurrent', &__cuCtxPopCurrent_v2, 4000, ptds_mode, NULL) + + global __cuCtxSetCurrent + cuGetProcAddress_v2('cuCtxSetCurrent', &__cuCtxSetCurrent, 4000, ptds_mode, NULL) + + global __cuCtxGetCurrent + cuGetProcAddress_v2('cuCtxGetCurrent', &__cuCtxGetCurrent, 4000, ptds_mode, NULL) + + global __cuCtxGetDevice + cuGetProcAddress_v2('cuCtxGetDevice', &__cuCtxGetDevice, 2000, ptds_mode, NULL) + + global __cuCtxGetFlags + cuGetProcAddress_v2('cuCtxGetFlags', &__cuCtxGetFlags, 7000, ptds_mode, NULL) + + global __cuCtxSetFlags + cuGetProcAddress_v2('cuCtxSetFlags', &__cuCtxSetFlags, 12010, ptds_mode, NULL) + + global __cuCtxGetId + cuGetProcAddress_v2('cuCtxGetId', &__cuCtxGetId, 12000, ptds_mode, NULL) + + global __cuCtxSynchronize + cuGetProcAddress_v2('cuCtxSynchronize', &__cuCtxSynchronize, 2000, ptds_mode, NULL) + + global __cuCtxSetLimit + cuGetProcAddress_v2('cuCtxSetLimit', &__cuCtxSetLimit, 3010, ptds_mode, NULL) + + global __cuCtxGetLimit + cuGetProcAddress_v2('cuCtxGetLimit', &__cuCtxGetLimit, 3010, ptds_mode, NULL) + + global __cuCtxGetCacheConfig + cuGetProcAddress_v2('cuCtxGetCacheConfig', &__cuCtxGetCacheConfig, 3020, ptds_mode, NULL) + + global __cuCtxSetCacheConfig + cuGetProcAddress_v2('cuCtxSetCacheConfig', &__cuCtxSetCacheConfig, 3020, ptds_mode, NULL) + + global __cuCtxGetApiVersion + cuGetProcAddress_v2('cuCtxGetApiVersion', &__cuCtxGetApiVersion, 3020, ptds_mode, NULL) + + global __cuCtxGetStreamPriorityRange + cuGetProcAddress_v2('cuCtxGetStreamPriorityRange', &__cuCtxGetStreamPriorityRange, 5050, ptds_mode, NULL) + + global __cuCtxResetPersistingL2Cache + cuGetProcAddress_v2('cuCtxResetPersistingL2Cache', &__cuCtxResetPersistingL2Cache, 11000, ptds_mode, NULL) + + global __cuCtxGetExecAffinity + cuGetProcAddress_v2('cuCtxGetExecAffinity', &__cuCtxGetExecAffinity, 11040, ptds_mode, NULL) + + global __cuCtxRecordEvent + cuGetProcAddress_v2('cuCtxRecordEvent', &__cuCtxRecordEvent, 12050, ptds_mode, NULL) + + global __cuCtxWaitEvent + cuGetProcAddress_v2('cuCtxWaitEvent', &__cuCtxWaitEvent, 12050, ptds_mode, NULL) + + global __cuCtxAttach + cuGetProcAddress_v2('cuCtxAttach', &__cuCtxAttach, 2000, ptds_mode, NULL) + + global __cuCtxDetach + cuGetProcAddress_v2('cuCtxDetach', &__cuCtxDetach, 2000, ptds_mode, NULL) + + global __cuCtxGetSharedMemConfig + cuGetProcAddress_v2('cuCtxGetSharedMemConfig', &__cuCtxGetSharedMemConfig, 4020, ptds_mode, NULL) + + global __cuCtxSetSharedMemConfig + cuGetProcAddress_v2('cuCtxSetSharedMemConfig', &__cuCtxSetSharedMemConfig, 4020, ptds_mode, NULL) + + global __cuModuleLoad + cuGetProcAddress_v2('cuModuleLoad', &__cuModuleLoad, 2000, ptds_mode, NULL) + + global __cuModuleLoadData + cuGetProcAddress_v2('cuModuleLoadData', &__cuModuleLoadData, 2000, ptds_mode, NULL) + + global __cuModuleLoadDataEx + cuGetProcAddress_v2('cuModuleLoadDataEx', &__cuModuleLoadDataEx, 2010, ptds_mode, NULL) + + global __cuModuleLoadFatBinary + cuGetProcAddress_v2('cuModuleLoadFatBinary', &__cuModuleLoadFatBinary, 2000, ptds_mode, NULL) + + global __cuModuleUnload + cuGetProcAddress_v2('cuModuleUnload', &__cuModuleUnload, 2000, ptds_mode, NULL) + + global __cuModuleGetLoadingMode + cuGetProcAddress_v2('cuModuleGetLoadingMode', &__cuModuleGetLoadingMode, 11070, ptds_mode, NULL) + + global __cuModuleGetFunction + cuGetProcAddress_v2('cuModuleGetFunction', &__cuModuleGetFunction, 2000, ptds_mode, NULL) + + global __cuModuleGetFunctionCount + cuGetProcAddress_v2('cuModuleGetFunctionCount', &__cuModuleGetFunctionCount, 12040, ptds_mode, NULL) + + global __cuModuleEnumerateFunctions + cuGetProcAddress_v2('cuModuleEnumerateFunctions', &__cuModuleEnumerateFunctions, 12040, ptds_mode, NULL) + + global __cuModuleGetGlobal_v2 + cuGetProcAddress_v2('cuModuleGetGlobal', &__cuModuleGetGlobal_v2, 3020, ptds_mode, NULL) + + global __cuLinkCreate_v2 + cuGetProcAddress_v2('cuLinkCreate', &__cuLinkCreate_v2, 6050, ptds_mode, NULL) + + global __cuLinkAddData_v2 + cuGetProcAddress_v2('cuLinkAddData', &__cuLinkAddData_v2, 6050, ptds_mode, NULL) + + global __cuLinkAddFile_v2 + cuGetProcAddress_v2('cuLinkAddFile', &__cuLinkAddFile_v2, 6050, ptds_mode, NULL) + + global __cuLinkComplete + cuGetProcAddress_v2('cuLinkComplete', &__cuLinkComplete, 5050, ptds_mode, NULL) + + global __cuLinkDestroy + cuGetProcAddress_v2('cuLinkDestroy', &__cuLinkDestroy, 5050, ptds_mode, NULL) + + global __cuModuleGetTexRef + cuGetProcAddress_v2('cuModuleGetTexRef', &__cuModuleGetTexRef, 2000, ptds_mode, NULL) + + global __cuModuleGetSurfRef + cuGetProcAddress_v2('cuModuleGetSurfRef', &__cuModuleGetSurfRef, 3000, ptds_mode, NULL) + + global __cuLibraryLoadData + cuGetProcAddress_v2('cuLibraryLoadData', &__cuLibraryLoadData, 12000, ptds_mode, NULL) + + global __cuLibraryLoadFromFile + cuGetProcAddress_v2('cuLibraryLoadFromFile', &__cuLibraryLoadFromFile, 12000, ptds_mode, NULL) + + global __cuLibraryUnload + cuGetProcAddress_v2('cuLibraryUnload', &__cuLibraryUnload, 12000, ptds_mode, NULL) + + global __cuLibraryGetKernel + cuGetProcAddress_v2('cuLibraryGetKernel', &__cuLibraryGetKernel, 12000, ptds_mode, NULL) + + global __cuLibraryGetKernelCount + cuGetProcAddress_v2('cuLibraryGetKernelCount', &__cuLibraryGetKernelCount, 12040, ptds_mode, NULL) + + global __cuLibraryEnumerateKernels + cuGetProcAddress_v2('cuLibraryEnumerateKernels', &__cuLibraryEnumerateKernels, 12040, ptds_mode, NULL) + + global __cuLibraryGetModule + cuGetProcAddress_v2('cuLibraryGetModule', &__cuLibraryGetModule, 12000, ptds_mode, NULL) + + global __cuKernelGetFunction + cuGetProcAddress_v2('cuKernelGetFunction', &__cuKernelGetFunction, 12000, ptds_mode, NULL) + + global __cuKernelGetLibrary + cuGetProcAddress_v2('cuKernelGetLibrary', &__cuKernelGetLibrary, 12050, ptds_mode, NULL) + + global __cuLibraryGetGlobal + cuGetProcAddress_v2('cuLibraryGetGlobal', &__cuLibraryGetGlobal, 12000, ptds_mode, NULL) + + global __cuLibraryGetManaged + cuGetProcAddress_v2('cuLibraryGetManaged', &__cuLibraryGetManaged, 12000, ptds_mode, NULL) + + global __cuLibraryGetUnifiedFunction + cuGetProcAddress_v2('cuLibraryGetUnifiedFunction', &__cuLibraryGetUnifiedFunction, 12000, ptds_mode, NULL) + + global __cuKernelGetAttribute + cuGetProcAddress_v2('cuKernelGetAttribute', &__cuKernelGetAttribute, 12000, ptds_mode, NULL) + + global __cuKernelSetAttribute + cuGetProcAddress_v2('cuKernelSetAttribute', &__cuKernelSetAttribute, 12000, ptds_mode, NULL) + + global __cuKernelSetCacheConfig + cuGetProcAddress_v2('cuKernelSetCacheConfig', &__cuKernelSetCacheConfig, 12000, ptds_mode, NULL) + + global __cuKernelGetName + cuGetProcAddress_v2('cuKernelGetName', &__cuKernelGetName, 12030, ptds_mode, NULL) + + global __cuKernelGetParamInfo + cuGetProcAddress_v2('cuKernelGetParamInfo', &__cuKernelGetParamInfo, 12040, ptds_mode, NULL) + + global __cuMemGetInfo_v2 + cuGetProcAddress_v2('cuMemGetInfo', &__cuMemGetInfo_v2, 3020, ptds_mode, NULL) + + global __cuMemAlloc_v2 + cuGetProcAddress_v2('cuMemAlloc', &__cuMemAlloc_v2, 3020, ptds_mode, NULL) + + global __cuMemAllocPitch_v2 + cuGetProcAddress_v2('cuMemAllocPitch', &__cuMemAllocPitch_v2, 3020, ptds_mode, NULL) + + global __cuMemFree_v2 + cuGetProcAddress_v2('cuMemFree', &__cuMemFree_v2, 3020, ptds_mode, NULL) + + global __cuMemGetAddressRange_v2 + cuGetProcAddress_v2('cuMemGetAddressRange', &__cuMemGetAddressRange_v2, 3020, ptds_mode, NULL) + + global __cuMemAllocHost_v2 + cuGetProcAddress_v2('cuMemAllocHost', &__cuMemAllocHost_v2, 3020, ptds_mode, NULL) + + global __cuMemFreeHost + cuGetProcAddress_v2('cuMemFreeHost', &__cuMemFreeHost, 2000, ptds_mode, NULL) + + global __cuMemHostAlloc + cuGetProcAddress_v2('cuMemHostAlloc', &__cuMemHostAlloc, 2020, ptds_mode, NULL) + + global __cuMemHostGetDevicePointer_v2 + cuGetProcAddress_v2('cuMemHostGetDevicePointer', &__cuMemHostGetDevicePointer_v2, 3020, ptds_mode, NULL) + + global __cuMemHostGetFlags + cuGetProcAddress_v2('cuMemHostGetFlags', &__cuMemHostGetFlags, 2030, ptds_mode, NULL) + + global __cuMemAllocManaged + cuGetProcAddress_v2('cuMemAllocManaged', &__cuMemAllocManaged, 6000, ptds_mode, NULL) + + global __cuDeviceRegisterAsyncNotification + cuGetProcAddress_v2('cuDeviceRegisterAsyncNotification', &__cuDeviceRegisterAsyncNotification, 12040, ptds_mode, NULL) + + global __cuDeviceUnregisterAsyncNotification + cuGetProcAddress_v2('cuDeviceUnregisterAsyncNotification', &__cuDeviceUnregisterAsyncNotification, 12040, ptds_mode, NULL) + + global __cuDeviceGetByPCIBusId + cuGetProcAddress_v2('cuDeviceGetByPCIBusId', &__cuDeviceGetByPCIBusId, 4010, ptds_mode, NULL) + + global __cuDeviceGetPCIBusId + cuGetProcAddress_v2('cuDeviceGetPCIBusId', &__cuDeviceGetPCIBusId, 4010, ptds_mode, NULL) + + global __cuIpcGetEventHandle + cuGetProcAddress_v2('cuIpcGetEventHandle', &__cuIpcGetEventHandle, 4010, ptds_mode, NULL) + + global __cuIpcOpenEventHandle + cuGetProcAddress_v2('cuIpcOpenEventHandle', &__cuIpcOpenEventHandle, 4010, ptds_mode, NULL) + + global __cuIpcGetMemHandle + cuGetProcAddress_v2('cuIpcGetMemHandle', &__cuIpcGetMemHandle, 4010, ptds_mode, NULL) + + global __cuIpcOpenMemHandle_v2 + cuGetProcAddress_v2('cuIpcOpenMemHandle', &__cuIpcOpenMemHandle_v2, 11000, ptds_mode, NULL) + + global __cuIpcCloseMemHandle + cuGetProcAddress_v2('cuIpcCloseMemHandle', &__cuIpcCloseMemHandle, 4010, ptds_mode, NULL) + + global __cuMemHostRegister_v2 + cuGetProcAddress_v2('cuMemHostRegister', &__cuMemHostRegister_v2, 6050, ptds_mode, NULL) + + global __cuMemHostUnregister + cuGetProcAddress_v2('cuMemHostUnregister', &__cuMemHostUnregister, 4000, ptds_mode, NULL) + + global __cuMemcpy + cuGetProcAddress_v2('cuMemcpy', &__cuMemcpy, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 4000, ptds_mode, NULL) + + global __cuMemcpyPeer + cuGetProcAddress_v2('cuMemcpyPeer', &__cuMemcpyPeer, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 4000, ptds_mode, NULL) + + global __cuMemcpyHtoD_v2 + cuGetProcAddress_v2('cuMemcpyHtoD', &__cuMemcpyHtoD_v2, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemcpyDtoH_v2 + cuGetProcAddress_v2('cuMemcpyDtoH', &__cuMemcpyDtoH_v2, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemcpyDtoD_v2 + cuGetProcAddress_v2('cuMemcpyDtoD', &__cuMemcpyDtoD_v2, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemcpyDtoA_v2 + cuGetProcAddress_v2('cuMemcpyDtoA', &__cuMemcpyDtoA_v2, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemcpyAtoD_v2 + cuGetProcAddress_v2('cuMemcpyAtoD', &__cuMemcpyAtoD_v2, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemcpyHtoA_v2 + cuGetProcAddress_v2('cuMemcpyHtoA', &__cuMemcpyHtoA_v2, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemcpyAtoH_v2 + cuGetProcAddress_v2('cuMemcpyAtoH', &__cuMemcpyAtoH_v2, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemcpyAtoA_v2 + cuGetProcAddress_v2('cuMemcpyAtoA', &__cuMemcpyAtoA_v2, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemcpy2D_v2 + cuGetProcAddress_v2('cuMemcpy2D', &__cuMemcpy2D_v2, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemcpy2DUnaligned_v2 + cuGetProcAddress_v2('cuMemcpy2DUnaligned', &__cuMemcpy2DUnaligned_v2, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemcpy3D_v2 + cuGetProcAddress_v2('cuMemcpy3D', &__cuMemcpy3D_v2, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemcpy3DPeer + cuGetProcAddress_v2('cuMemcpy3DPeer', &__cuMemcpy3DPeer, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 4000, ptds_mode, NULL) + + global __cuMemcpyAsync + cuGetProcAddress_v2('cuMemcpyAsync', &__cuMemcpyAsync, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 4000, ptds_mode, NULL) + + global __cuMemcpyPeerAsync + cuGetProcAddress_v2('cuMemcpyPeerAsync', &__cuMemcpyPeerAsync, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 4000, ptds_mode, NULL) + + global __cuMemcpyHtoDAsync_v2 + cuGetProcAddress_v2('cuMemcpyHtoDAsync', &__cuMemcpyHtoDAsync_v2, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemcpyDtoHAsync_v2 + cuGetProcAddress_v2('cuMemcpyDtoHAsync', &__cuMemcpyDtoHAsync_v2, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemcpyDtoDAsync_v2 + cuGetProcAddress_v2('cuMemcpyDtoDAsync', &__cuMemcpyDtoDAsync_v2, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemcpyHtoAAsync_v2 + cuGetProcAddress_v2('cuMemcpyHtoAAsync', &__cuMemcpyHtoAAsync_v2, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemcpyAtoHAsync_v2 + cuGetProcAddress_v2('cuMemcpyAtoHAsync', &__cuMemcpyAtoHAsync_v2, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemcpy2DAsync_v2 + cuGetProcAddress_v2('cuMemcpy2DAsync', &__cuMemcpy2DAsync_v2, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemcpy3DAsync_v2 + cuGetProcAddress_v2('cuMemcpy3DAsync', &__cuMemcpy3DAsync_v2, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemcpy3DPeerAsync + cuGetProcAddress_v2('cuMemcpy3DPeerAsync', &__cuMemcpy3DPeerAsync, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 4000, ptds_mode, NULL) + + global __cuMemsetD8_v2 + cuGetProcAddress_v2('cuMemsetD8', &__cuMemsetD8_v2, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemsetD16_v2 + cuGetProcAddress_v2('cuMemsetD16', &__cuMemsetD16_v2, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemsetD32_v2 + cuGetProcAddress_v2('cuMemsetD32', &__cuMemsetD32_v2, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemsetD2D8_v2 + cuGetProcAddress_v2('cuMemsetD2D8', &__cuMemsetD2D8_v2, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemsetD2D16_v2 + cuGetProcAddress_v2('cuMemsetD2D16', &__cuMemsetD2D16_v2, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemsetD2D32_v2 + cuGetProcAddress_v2('cuMemsetD2D32', &__cuMemsetD2D32_v2, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemsetD8Async + cuGetProcAddress_v2('cuMemsetD8Async', &__cuMemsetD8Async, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemsetD16Async + cuGetProcAddress_v2('cuMemsetD16Async', &__cuMemsetD16Async, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemsetD32Async + cuGetProcAddress_v2('cuMemsetD32Async', &__cuMemsetD32Async, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemsetD2D8Async + cuGetProcAddress_v2('cuMemsetD2D8Async', &__cuMemsetD2D8Async, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemsetD2D16Async + cuGetProcAddress_v2('cuMemsetD2D16Async', &__cuMemsetD2D16Async, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemsetD2D32Async + cuGetProcAddress_v2('cuMemsetD2D32Async', &__cuMemsetD2D32Async, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuArrayCreate_v2 + cuGetProcAddress_v2('cuArrayCreate', &__cuArrayCreate_v2, 3020, ptds_mode, NULL) + + global __cuArrayGetDescriptor_v2 + cuGetProcAddress_v2('cuArrayGetDescriptor', &__cuArrayGetDescriptor_v2, 3020, ptds_mode, NULL) + + global __cuArrayGetSparseProperties + cuGetProcAddress_v2('cuArrayGetSparseProperties', &__cuArrayGetSparseProperties, 11010, ptds_mode, NULL) + + global __cuMipmappedArrayGetSparseProperties + cuGetProcAddress_v2('cuMipmappedArrayGetSparseProperties', &__cuMipmappedArrayGetSparseProperties, 11010, ptds_mode, NULL) + + global __cuArrayGetMemoryRequirements + cuGetProcAddress_v2('cuArrayGetMemoryRequirements', &__cuArrayGetMemoryRequirements, 11060, ptds_mode, NULL) + + global __cuMipmappedArrayGetMemoryRequirements + cuGetProcAddress_v2('cuMipmappedArrayGetMemoryRequirements', &__cuMipmappedArrayGetMemoryRequirements, 11060, ptds_mode, NULL) + + global __cuArrayGetPlane + cuGetProcAddress_v2('cuArrayGetPlane', &__cuArrayGetPlane, 11020, ptds_mode, NULL) + + global __cuArrayDestroy + cuGetProcAddress_v2('cuArrayDestroy', &__cuArrayDestroy, 2000, ptds_mode, NULL) + + global __cuArray3DCreate_v2 + cuGetProcAddress_v2('cuArray3DCreate', &__cuArray3DCreate_v2, 3020, ptds_mode, NULL) + + global __cuArray3DGetDescriptor_v2 + cuGetProcAddress_v2('cuArray3DGetDescriptor', &__cuArray3DGetDescriptor_v2, 3020, ptds_mode, NULL) + + global __cuMipmappedArrayCreate + cuGetProcAddress_v2('cuMipmappedArrayCreate', &__cuMipmappedArrayCreate, 5000, ptds_mode, NULL) + + global __cuMipmappedArrayGetLevel + cuGetProcAddress_v2('cuMipmappedArrayGetLevel', &__cuMipmappedArrayGetLevel, 5000, ptds_mode, NULL) + + global __cuMipmappedArrayDestroy + cuGetProcAddress_v2('cuMipmappedArrayDestroy', &__cuMipmappedArrayDestroy, 5000, ptds_mode, NULL) + + global __cuMemGetHandleForAddressRange + cuGetProcAddress_v2('cuMemGetHandleForAddressRange', &__cuMemGetHandleForAddressRange, 11070, ptds_mode, NULL) + + global __cuMemBatchDecompressAsync + cuGetProcAddress_v2('cuMemBatchDecompressAsync', &__cuMemBatchDecompressAsync, 12060, ptds_mode, NULL) + + global __cuMemAddressReserve + cuGetProcAddress_v2('cuMemAddressReserve', &__cuMemAddressReserve, 10020, ptds_mode, NULL) + + global __cuMemAddressFree + cuGetProcAddress_v2('cuMemAddressFree', &__cuMemAddressFree, 10020, ptds_mode, NULL) + + global __cuMemCreate + cuGetProcAddress_v2('cuMemCreate', &__cuMemCreate, 10020, ptds_mode, NULL) + + global __cuMemRelease + cuGetProcAddress_v2('cuMemRelease', &__cuMemRelease, 10020, ptds_mode, NULL) + + global __cuMemMap + cuGetProcAddress_v2('cuMemMap', &__cuMemMap, 10020, ptds_mode, NULL) + + global __cuMemMapArrayAsync + cuGetProcAddress_v2('cuMemMapArrayAsync', &__cuMemMapArrayAsync, 11010, ptds_mode, NULL) + + global __cuMemUnmap + cuGetProcAddress_v2('cuMemUnmap', &__cuMemUnmap, 10020, ptds_mode, NULL) + + global __cuMemSetAccess + cuGetProcAddress_v2('cuMemSetAccess', &__cuMemSetAccess, 10020, ptds_mode, NULL) + + global __cuMemGetAccess + cuGetProcAddress_v2('cuMemGetAccess', &__cuMemGetAccess, 10020, ptds_mode, NULL) + + global __cuMemExportToShareableHandle + cuGetProcAddress_v2('cuMemExportToShareableHandle', &__cuMemExportToShareableHandle, 10020, ptds_mode, NULL) + + global __cuMemImportFromShareableHandle + cuGetProcAddress_v2('cuMemImportFromShareableHandle', &__cuMemImportFromShareableHandle, 10020, ptds_mode, NULL) + + global __cuMemGetAllocationGranularity + cuGetProcAddress_v2('cuMemGetAllocationGranularity', &__cuMemGetAllocationGranularity, 10020, ptds_mode, NULL) + + global __cuMemGetAllocationPropertiesFromHandle + cuGetProcAddress_v2('cuMemGetAllocationPropertiesFromHandle', &__cuMemGetAllocationPropertiesFromHandle, 10020, ptds_mode, NULL) + + global __cuMemRetainAllocationHandle + cuGetProcAddress_v2('cuMemRetainAllocationHandle', &__cuMemRetainAllocationHandle, 11000, ptds_mode, NULL) + + global __cuMemFreeAsync + cuGetProcAddress_v2('cuMemFreeAsync', &__cuMemFreeAsync, 11020, ptds_mode, NULL) + + global __cuMemAllocAsync + cuGetProcAddress_v2('cuMemAllocAsync', &__cuMemAllocAsync, 11020, ptds_mode, NULL) + + global __cuMemPoolTrimTo + cuGetProcAddress_v2('cuMemPoolTrimTo', &__cuMemPoolTrimTo, 11020, ptds_mode, NULL) + + global __cuMemPoolSetAttribute + cuGetProcAddress_v2('cuMemPoolSetAttribute', &__cuMemPoolSetAttribute, 11020, ptds_mode, NULL) + + global __cuMemPoolGetAttribute + cuGetProcAddress_v2('cuMemPoolGetAttribute', &__cuMemPoolGetAttribute, 11020, ptds_mode, NULL) + + global __cuMemPoolSetAccess + cuGetProcAddress_v2('cuMemPoolSetAccess', &__cuMemPoolSetAccess, 11020, ptds_mode, NULL) + + global __cuMemPoolGetAccess + cuGetProcAddress_v2('cuMemPoolGetAccess', &__cuMemPoolGetAccess, 11020, ptds_mode, NULL) + + global __cuMemPoolCreate + cuGetProcAddress_v2('cuMemPoolCreate', &__cuMemPoolCreate, 11020, ptds_mode, NULL) + + global __cuMemPoolDestroy + cuGetProcAddress_v2('cuMemPoolDestroy', &__cuMemPoolDestroy, 11020, ptds_mode, NULL) + + global __cuMemAllocFromPoolAsync + cuGetProcAddress_v2('cuMemAllocFromPoolAsync', &__cuMemAllocFromPoolAsync, 11020, ptds_mode, NULL) + + global __cuMemPoolExportToShareableHandle + cuGetProcAddress_v2('cuMemPoolExportToShareableHandle', &__cuMemPoolExportToShareableHandle, 11020, ptds_mode, NULL) + + global __cuMemPoolImportFromShareableHandle + cuGetProcAddress_v2('cuMemPoolImportFromShareableHandle', &__cuMemPoolImportFromShareableHandle, 11020, ptds_mode, NULL) + + global __cuMemPoolExportPointer + cuGetProcAddress_v2('cuMemPoolExportPointer', &__cuMemPoolExportPointer, 11020, ptds_mode, NULL) + + global __cuMemPoolImportPointer + cuGetProcAddress_v2('cuMemPoolImportPointer', &__cuMemPoolImportPointer, 11020, ptds_mode, NULL) + + global __cuMulticastCreate + cuGetProcAddress_v2('cuMulticastCreate', &__cuMulticastCreate, 12010, ptds_mode, NULL) + + global __cuMulticastAddDevice + cuGetProcAddress_v2('cuMulticastAddDevice', &__cuMulticastAddDevice, 12010, ptds_mode, NULL) + + global __cuMulticastBindMem + cuGetProcAddress_v2('cuMulticastBindMem', &__cuMulticastBindMem, 12010, ptds_mode, NULL) + + global __cuMulticastBindAddr + cuGetProcAddress_v2('cuMulticastBindAddr', &__cuMulticastBindAddr, 12010, ptds_mode, NULL) + + global __cuMulticastUnbind + cuGetProcAddress_v2('cuMulticastUnbind', &__cuMulticastUnbind, 12010, ptds_mode, NULL) + + global __cuMulticastGetGranularity + cuGetProcAddress_v2('cuMulticastGetGranularity', &__cuMulticastGetGranularity, 12010, ptds_mode, NULL) + + global __cuPointerGetAttribute + cuGetProcAddress_v2('cuPointerGetAttribute', &__cuPointerGetAttribute, 4000, ptds_mode, NULL) + + global __cuMemPrefetchAsync_v2 + cuGetProcAddress_v2('cuMemPrefetchAsync', &__cuMemPrefetchAsync_v2, 12020, ptds_mode, NULL) + + global __cuMemAdvise_v2 + cuGetProcAddress_v2('cuMemAdvise', &__cuMemAdvise_v2, 12020, ptds_mode, NULL) + + global __cuMemRangeGetAttribute + cuGetProcAddress_v2('cuMemRangeGetAttribute', &__cuMemRangeGetAttribute, 8000, ptds_mode, NULL) + + global __cuMemRangeGetAttributes + cuGetProcAddress_v2('cuMemRangeGetAttributes', &__cuMemRangeGetAttributes, 8000, ptds_mode, NULL) + + global __cuPointerSetAttribute + cuGetProcAddress_v2('cuPointerSetAttribute', &__cuPointerSetAttribute, 6000, ptds_mode, NULL) + + global __cuPointerGetAttributes + cuGetProcAddress_v2('cuPointerGetAttributes', &__cuPointerGetAttributes, 7000, ptds_mode, NULL) + + global __cuStreamCreate + cuGetProcAddress_v2('cuStreamCreate', &__cuStreamCreate, 2000, ptds_mode, NULL) + + global __cuStreamCreateWithPriority + cuGetProcAddress_v2('cuStreamCreateWithPriority', &__cuStreamCreateWithPriority, 5050, ptds_mode, NULL) + + global __cuStreamGetPriority + cuGetProcAddress_v2('cuStreamGetPriority', &__cuStreamGetPriority, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 5050, ptds_mode, NULL) + + global __cuStreamGetDevice + cuGetProcAddress_v2('cuStreamGetDevice', &__cuStreamGetDevice, 12080, ptds_mode, NULL) + + global __cuStreamGetFlags + cuGetProcAddress_v2('cuStreamGetFlags', &__cuStreamGetFlags, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 5050, ptds_mode, NULL) + + global __cuStreamGetId + cuGetProcAddress_v2('cuStreamGetId', &__cuStreamGetId, 12000, ptds_mode, NULL) + + global __cuStreamGetCtx + cuGetProcAddress_v2('cuStreamGetCtx', &__cuStreamGetCtx, 9020, ptds_mode, NULL) + + global __cuStreamGetCtx_v2 + cuGetProcAddress_v2('cuStreamGetCtx', &__cuStreamGetCtx_v2, 12050, ptds_mode, NULL) + + global __cuStreamWaitEvent + cuGetProcAddress_v2('cuStreamWaitEvent', &__cuStreamWaitEvent, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuStreamAddCallback + cuGetProcAddress_v2('cuStreamAddCallback', &__cuStreamAddCallback, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 5000, ptds_mode, NULL) + + global __cuStreamBeginCapture_v2 + cuGetProcAddress_v2('cuStreamBeginCapture', &__cuStreamBeginCapture_v2, 10010, ptds_mode, NULL) + + global __cuStreamBeginCaptureToGraph + cuGetProcAddress_v2('cuStreamBeginCaptureToGraph', &__cuStreamBeginCaptureToGraph, 12030, ptds_mode, NULL) + + global __cuThreadExchangeStreamCaptureMode + cuGetProcAddress_v2('cuThreadExchangeStreamCaptureMode', &__cuThreadExchangeStreamCaptureMode, 10010, ptds_mode, NULL) + + global __cuStreamEndCapture + cuGetProcAddress_v2('cuStreamEndCapture', &__cuStreamEndCapture, 10000, ptds_mode, NULL) + + global __cuStreamIsCapturing + cuGetProcAddress_v2('cuStreamIsCapturing', &__cuStreamIsCapturing, 10000, ptds_mode, NULL) + + global __cuStreamGetCaptureInfo_v2 + cuGetProcAddress_v2('cuStreamGetCaptureInfo', &__cuStreamGetCaptureInfo_v2, 11030, ptds_mode, NULL) + + global __cuStreamGetCaptureInfo_v3 + cuGetProcAddress_v2('cuStreamGetCaptureInfo', &__cuStreamGetCaptureInfo_v3, 12030, ptds_mode, NULL) + + global __cuStreamUpdateCaptureDependencies_v2 + cuGetProcAddress_v2('cuStreamUpdateCaptureDependencies', &__cuStreamUpdateCaptureDependencies_v2, 12030, ptds_mode, NULL) + + global __cuStreamAttachMemAsync + cuGetProcAddress_v2('cuStreamAttachMemAsync', &__cuStreamAttachMemAsync, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 6000, ptds_mode, NULL) + + global __cuStreamQuery + cuGetProcAddress_v2('cuStreamQuery', &__cuStreamQuery, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 2000, ptds_mode, NULL) + + global __cuStreamSynchronize + cuGetProcAddress_v2('cuStreamSynchronize', &__cuStreamSynchronize, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 2000, ptds_mode, NULL) + + global __cuStreamDestroy_v2 + cuGetProcAddress_v2('cuStreamDestroy', &__cuStreamDestroy_v2, 4000, ptds_mode, NULL) + + global __cuStreamCopyAttributes + cuGetProcAddress_v2('cuStreamCopyAttributes', &__cuStreamCopyAttributes, 11000, ptds_mode, NULL) + + global __cuStreamGetAttribute + cuGetProcAddress_v2('cuStreamGetAttribute', &__cuStreamGetAttribute, 11000, ptds_mode, NULL) + + global __cuStreamSetAttribute + cuGetProcAddress_v2('cuStreamSetAttribute', &__cuStreamSetAttribute, 11000, ptds_mode, NULL) + + global __cuEventCreate + cuGetProcAddress_v2('cuEventCreate', &__cuEventCreate, 2000, ptds_mode, NULL) + + global __cuEventRecord + cuGetProcAddress_v2('cuEventRecord', &__cuEventRecord, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 2000, ptds_mode, NULL) + + global __cuEventRecordWithFlags + cuGetProcAddress_v2('cuEventRecordWithFlags', &__cuEventRecordWithFlags, 11010, ptds_mode, NULL) + + global __cuEventQuery + cuGetProcAddress_v2('cuEventQuery', &__cuEventQuery, 2000, ptds_mode, NULL) + + global __cuEventSynchronize + cuGetProcAddress_v2('cuEventSynchronize', &__cuEventSynchronize, 2000, ptds_mode, NULL) + + global __cuEventDestroy_v2 + cuGetProcAddress_v2('cuEventDestroy', &__cuEventDestroy_v2, 4000, ptds_mode, NULL) + + global __cuEventElapsedTime_v2 + cuGetProcAddress_v2('cuEventElapsedTime', &__cuEventElapsedTime_v2, 12080, ptds_mode, NULL) + + global __cuImportExternalMemory + cuGetProcAddress_v2('cuImportExternalMemory', &__cuImportExternalMemory, 10000, ptds_mode, NULL) + + global __cuExternalMemoryGetMappedBuffer + cuGetProcAddress_v2('cuExternalMemoryGetMappedBuffer', &__cuExternalMemoryGetMappedBuffer, 10000, ptds_mode, NULL) + + global __cuExternalMemoryGetMappedMipmappedArray + cuGetProcAddress_v2('cuExternalMemoryGetMappedMipmappedArray', &__cuExternalMemoryGetMappedMipmappedArray, 10000, ptds_mode, NULL) + + global __cuDestroyExternalMemory + cuGetProcAddress_v2('cuDestroyExternalMemory', &__cuDestroyExternalMemory, 10000, ptds_mode, NULL) + + global __cuImportExternalSemaphore + cuGetProcAddress_v2('cuImportExternalSemaphore', &__cuImportExternalSemaphore, 10000, ptds_mode, NULL) + + global __cuSignalExternalSemaphoresAsync + cuGetProcAddress_v2('cuSignalExternalSemaphoresAsync', &__cuSignalExternalSemaphoresAsync, 10000, ptds_mode, NULL) + + global __cuWaitExternalSemaphoresAsync + cuGetProcAddress_v2('cuWaitExternalSemaphoresAsync', &__cuWaitExternalSemaphoresAsync, 10000, ptds_mode, NULL) + + global __cuDestroyExternalSemaphore + cuGetProcAddress_v2('cuDestroyExternalSemaphore', &__cuDestroyExternalSemaphore, 10000, ptds_mode, NULL) + + global __cuStreamWaitValue32_v2 + cuGetProcAddress_v2('cuStreamWaitValue32', &__cuStreamWaitValue32_v2, 11070, ptds_mode, NULL) + + global __cuStreamWaitValue64_v2 + cuGetProcAddress_v2('cuStreamWaitValue64', &__cuStreamWaitValue64_v2, 11070, ptds_mode, NULL) + + global __cuStreamWriteValue32_v2 + cuGetProcAddress_v2('cuStreamWriteValue32', &__cuStreamWriteValue32_v2, 11070, ptds_mode, NULL) + + global __cuStreamWriteValue64_v2 + cuGetProcAddress_v2('cuStreamWriteValue64', &__cuStreamWriteValue64_v2, 11070, ptds_mode, NULL) + + global __cuStreamBatchMemOp_v2 + cuGetProcAddress_v2('cuStreamBatchMemOp', &__cuStreamBatchMemOp_v2, 11070, ptds_mode, NULL) + + global __cuFuncGetAttribute + cuGetProcAddress_v2('cuFuncGetAttribute', &__cuFuncGetAttribute, 2020, ptds_mode, NULL) + + global __cuFuncSetAttribute + cuGetProcAddress_v2('cuFuncSetAttribute', &__cuFuncSetAttribute, 9000, ptds_mode, NULL) + + global __cuFuncSetCacheConfig + cuGetProcAddress_v2('cuFuncSetCacheConfig', &__cuFuncSetCacheConfig, 3000, ptds_mode, NULL) + + global __cuFuncGetModule + cuGetProcAddress_v2('cuFuncGetModule', &__cuFuncGetModule, 11000, ptds_mode, NULL) + + global __cuFuncGetName + cuGetProcAddress_v2('cuFuncGetName', &__cuFuncGetName, 12030, ptds_mode, NULL) + + global __cuFuncGetParamInfo + cuGetProcAddress_v2('cuFuncGetParamInfo', &__cuFuncGetParamInfo, 12040, ptds_mode, NULL) + + global __cuFuncIsLoaded + cuGetProcAddress_v2('cuFuncIsLoaded', &__cuFuncIsLoaded, 12040, ptds_mode, NULL) + + global __cuFuncLoad + cuGetProcAddress_v2('cuFuncLoad', &__cuFuncLoad, 12040, ptds_mode, NULL) + + global __cuLaunchKernel + cuGetProcAddress_v2('cuLaunchKernel', &__cuLaunchKernel, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 4000, ptds_mode, NULL) + + global __cuLaunchKernelEx + cuGetProcAddress_v2('cuLaunchKernelEx', &__cuLaunchKernelEx, 11060, ptds_mode, NULL) + + global __cuLaunchCooperativeKernel + cuGetProcAddress_v2('cuLaunchCooperativeKernel', &__cuLaunchCooperativeKernel, 9000, ptds_mode, NULL) + + global __cuLaunchCooperativeKernelMultiDevice + cuGetProcAddress_v2('cuLaunchCooperativeKernelMultiDevice', &__cuLaunchCooperativeKernelMultiDevice, 9000, ptds_mode, NULL) + + global __cuLaunchHostFunc + cuGetProcAddress_v2('cuLaunchHostFunc', &__cuLaunchHostFunc, 10000, ptds_mode, NULL) + + global __cuFuncSetBlockShape + cuGetProcAddress_v2('cuFuncSetBlockShape', &__cuFuncSetBlockShape, 2000, ptds_mode, NULL) + + global __cuFuncSetSharedSize + cuGetProcAddress_v2('cuFuncSetSharedSize', &__cuFuncSetSharedSize, 2000, ptds_mode, NULL) + + global __cuParamSetSize + cuGetProcAddress_v2('cuParamSetSize', &__cuParamSetSize, 2000, ptds_mode, NULL) + + global __cuParamSeti + cuGetProcAddress_v2('cuParamSeti', &__cuParamSeti, 2000, ptds_mode, NULL) + + global __cuParamSetf + cuGetProcAddress_v2('cuParamSetf', &__cuParamSetf, 2000, ptds_mode, NULL) + + global __cuParamSetv + cuGetProcAddress_v2('cuParamSetv', &__cuParamSetv, 2000, ptds_mode, NULL) + + global __cuLaunch + cuGetProcAddress_v2('cuLaunch', &__cuLaunch, 2000, ptds_mode, NULL) + + global __cuLaunchGrid + cuGetProcAddress_v2('cuLaunchGrid', &__cuLaunchGrid, 2000, ptds_mode, NULL) + + global __cuLaunchGridAsync + cuGetProcAddress_v2('cuLaunchGridAsync', &__cuLaunchGridAsync, 2000, ptds_mode, NULL) + + global __cuParamSetTexRef + cuGetProcAddress_v2('cuParamSetTexRef', &__cuParamSetTexRef, 2000, ptds_mode, NULL) + + global __cuFuncSetSharedMemConfig + cuGetProcAddress_v2('cuFuncSetSharedMemConfig', &__cuFuncSetSharedMemConfig, 4020, ptds_mode, NULL) + + global __cuGraphCreate + cuGetProcAddress_v2('cuGraphCreate', &__cuGraphCreate, 10000, ptds_mode, NULL) + + global __cuGraphAddKernelNode_v2 + cuGetProcAddress_v2('cuGraphAddKernelNode', &__cuGraphAddKernelNode_v2, 12000, ptds_mode, NULL) + + global __cuGraphKernelNodeGetParams_v2 + cuGetProcAddress_v2('cuGraphKernelNodeGetParams', &__cuGraphKernelNodeGetParams_v2, 12000, ptds_mode, NULL) + + global __cuGraphKernelNodeSetParams_v2 + cuGetProcAddress_v2('cuGraphKernelNodeSetParams', &__cuGraphKernelNodeSetParams_v2, 12000, ptds_mode, NULL) + + global __cuGraphAddMemcpyNode + cuGetProcAddress_v2('cuGraphAddMemcpyNode', &__cuGraphAddMemcpyNode, 10000, ptds_mode, NULL) + + global __cuGraphMemcpyNodeGetParams + cuGetProcAddress_v2('cuGraphMemcpyNodeGetParams', &__cuGraphMemcpyNodeGetParams, 10000, ptds_mode, NULL) + + global __cuGraphMemcpyNodeSetParams + cuGetProcAddress_v2('cuGraphMemcpyNodeSetParams', &__cuGraphMemcpyNodeSetParams, 10000, ptds_mode, NULL) + + global __cuGraphAddMemsetNode + cuGetProcAddress_v2('cuGraphAddMemsetNode', &__cuGraphAddMemsetNode, 10000, ptds_mode, NULL) + + global __cuGraphMemsetNodeGetParams + cuGetProcAddress_v2('cuGraphMemsetNodeGetParams', &__cuGraphMemsetNodeGetParams, 10000, ptds_mode, NULL) + + global __cuGraphMemsetNodeSetParams + cuGetProcAddress_v2('cuGraphMemsetNodeSetParams', &__cuGraphMemsetNodeSetParams, 10000, ptds_mode, NULL) + + global __cuGraphAddHostNode + cuGetProcAddress_v2('cuGraphAddHostNode', &__cuGraphAddHostNode, 10000, ptds_mode, NULL) + + global __cuGraphHostNodeGetParams + cuGetProcAddress_v2('cuGraphHostNodeGetParams', &__cuGraphHostNodeGetParams, 10000, ptds_mode, NULL) + + global __cuGraphHostNodeSetParams + cuGetProcAddress_v2('cuGraphHostNodeSetParams', &__cuGraphHostNodeSetParams, 10000, ptds_mode, NULL) + + global __cuGraphAddChildGraphNode + cuGetProcAddress_v2('cuGraphAddChildGraphNode', &__cuGraphAddChildGraphNode, 10000, ptds_mode, NULL) + + global __cuGraphChildGraphNodeGetGraph + cuGetProcAddress_v2('cuGraphChildGraphNodeGetGraph', &__cuGraphChildGraphNodeGetGraph, 10000, ptds_mode, NULL) + + global __cuGraphAddEmptyNode + cuGetProcAddress_v2('cuGraphAddEmptyNode', &__cuGraphAddEmptyNode, 10000, ptds_mode, NULL) + + global __cuGraphAddEventRecordNode + cuGetProcAddress_v2('cuGraphAddEventRecordNode', &__cuGraphAddEventRecordNode, 11010, ptds_mode, NULL) + + global __cuGraphEventRecordNodeGetEvent + cuGetProcAddress_v2('cuGraphEventRecordNodeGetEvent', &__cuGraphEventRecordNodeGetEvent, 11010, ptds_mode, NULL) + + global __cuGraphEventRecordNodeSetEvent + cuGetProcAddress_v2('cuGraphEventRecordNodeSetEvent', &__cuGraphEventRecordNodeSetEvent, 11010, ptds_mode, NULL) + + global __cuGraphAddEventWaitNode + cuGetProcAddress_v2('cuGraphAddEventWaitNode', &__cuGraphAddEventWaitNode, 11010, ptds_mode, NULL) + + global __cuGraphEventWaitNodeGetEvent + cuGetProcAddress_v2('cuGraphEventWaitNodeGetEvent', &__cuGraphEventWaitNodeGetEvent, 11010, ptds_mode, NULL) + + global __cuGraphEventWaitNodeSetEvent + cuGetProcAddress_v2('cuGraphEventWaitNodeSetEvent', &__cuGraphEventWaitNodeSetEvent, 11010, ptds_mode, NULL) + + global __cuGraphAddExternalSemaphoresSignalNode + cuGetProcAddress_v2('cuGraphAddExternalSemaphoresSignalNode', &__cuGraphAddExternalSemaphoresSignalNode, 11020, ptds_mode, NULL) + + global __cuGraphExternalSemaphoresSignalNodeGetParams + cuGetProcAddress_v2('cuGraphExternalSemaphoresSignalNodeGetParams', &__cuGraphExternalSemaphoresSignalNodeGetParams, 11020, ptds_mode, NULL) + + global __cuGraphExternalSemaphoresSignalNodeSetParams + cuGetProcAddress_v2('cuGraphExternalSemaphoresSignalNodeSetParams', &__cuGraphExternalSemaphoresSignalNodeSetParams, 11020, ptds_mode, NULL) + + global __cuGraphAddExternalSemaphoresWaitNode + cuGetProcAddress_v2('cuGraphAddExternalSemaphoresWaitNode', &__cuGraphAddExternalSemaphoresWaitNode, 11020, ptds_mode, NULL) + + global __cuGraphExternalSemaphoresWaitNodeGetParams + cuGetProcAddress_v2('cuGraphExternalSemaphoresWaitNodeGetParams', &__cuGraphExternalSemaphoresWaitNodeGetParams, 11020, ptds_mode, NULL) + + global __cuGraphExternalSemaphoresWaitNodeSetParams + cuGetProcAddress_v2('cuGraphExternalSemaphoresWaitNodeSetParams', &__cuGraphExternalSemaphoresWaitNodeSetParams, 11020, ptds_mode, NULL) + + global __cuGraphAddBatchMemOpNode + cuGetProcAddress_v2('cuGraphAddBatchMemOpNode', &__cuGraphAddBatchMemOpNode, 11070, ptds_mode, NULL) + + global __cuGraphBatchMemOpNodeGetParams + cuGetProcAddress_v2('cuGraphBatchMemOpNodeGetParams', &__cuGraphBatchMemOpNodeGetParams, 11070, ptds_mode, NULL) + + global __cuGraphBatchMemOpNodeSetParams + cuGetProcAddress_v2('cuGraphBatchMemOpNodeSetParams', &__cuGraphBatchMemOpNodeSetParams, 11070, ptds_mode, NULL) + + global __cuGraphExecBatchMemOpNodeSetParams + cuGetProcAddress_v2('cuGraphExecBatchMemOpNodeSetParams', &__cuGraphExecBatchMemOpNodeSetParams, 11070, ptds_mode, NULL) + + global __cuGraphAddMemAllocNode + cuGetProcAddress_v2('cuGraphAddMemAllocNode', &__cuGraphAddMemAllocNode, 11040, ptds_mode, NULL) + + global __cuGraphMemAllocNodeGetParams + cuGetProcAddress_v2('cuGraphMemAllocNodeGetParams', &__cuGraphMemAllocNodeGetParams, 11040, ptds_mode, NULL) + + global __cuGraphAddMemFreeNode + cuGetProcAddress_v2('cuGraphAddMemFreeNode', &__cuGraphAddMemFreeNode, 11040, ptds_mode, NULL) + + global __cuGraphMemFreeNodeGetParams + cuGetProcAddress_v2('cuGraphMemFreeNodeGetParams', &__cuGraphMemFreeNodeGetParams, 11040, ptds_mode, NULL) + + global __cuDeviceGraphMemTrim + cuGetProcAddress_v2('cuDeviceGraphMemTrim', &__cuDeviceGraphMemTrim, 11040, ptds_mode, NULL) + + global __cuDeviceGetGraphMemAttribute + cuGetProcAddress_v2('cuDeviceGetGraphMemAttribute', &__cuDeviceGetGraphMemAttribute, 11040, ptds_mode, NULL) + + global __cuDeviceSetGraphMemAttribute + cuGetProcAddress_v2('cuDeviceSetGraphMemAttribute', &__cuDeviceSetGraphMemAttribute, 11040, ptds_mode, NULL) + + global __cuGraphClone + cuGetProcAddress_v2('cuGraphClone', &__cuGraphClone, 10000, ptds_mode, NULL) + + global __cuGraphNodeFindInClone + cuGetProcAddress_v2('cuGraphNodeFindInClone', &__cuGraphNodeFindInClone, 10000, ptds_mode, NULL) + + global __cuGraphNodeGetType + cuGetProcAddress_v2('cuGraphNodeGetType', &__cuGraphNodeGetType, 10000, ptds_mode, NULL) + + global __cuGraphGetNodes + cuGetProcAddress_v2('cuGraphGetNodes', &__cuGraphGetNodes, 10000, ptds_mode, NULL) + + global __cuGraphGetRootNodes + cuGetProcAddress_v2('cuGraphGetRootNodes', &__cuGraphGetRootNodes, 10000, ptds_mode, NULL) + + global __cuGraphGetEdges_v2 + cuGetProcAddress_v2('cuGraphGetEdges', &__cuGraphGetEdges_v2, 12030, ptds_mode, NULL) + + global __cuGraphNodeGetDependencies_v2 + cuGetProcAddress_v2('cuGraphNodeGetDependencies', &__cuGraphNodeGetDependencies_v2, 12030, ptds_mode, NULL) + + global __cuGraphNodeGetDependentNodes_v2 + cuGetProcAddress_v2('cuGraphNodeGetDependentNodes', &__cuGraphNodeGetDependentNodes_v2, 12030, ptds_mode, NULL) + + global __cuGraphAddDependencies_v2 + cuGetProcAddress_v2('cuGraphAddDependencies', &__cuGraphAddDependencies_v2, 12030, ptds_mode, NULL) + + global __cuGraphRemoveDependencies_v2 + cuGetProcAddress_v2('cuGraphRemoveDependencies', &__cuGraphRemoveDependencies_v2, 12030, ptds_mode, NULL) + + global __cuGraphDestroyNode + cuGetProcAddress_v2('cuGraphDestroyNode', &__cuGraphDestroyNode, 10000, ptds_mode, NULL) + + global __cuGraphInstantiateWithFlags + cuGetProcAddress_v2('cuGraphInstantiateWithFlags', &__cuGraphInstantiateWithFlags, 11040, ptds_mode, NULL) + + global __cuGraphInstantiateWithParams + cuGetProcAddress_v2('cuGraphInstantiateWithParams', &__cuGraphInstantiateWithParams, 12000, ptds_mode, NULL) + + global __cuGraphExecGetFlags + cuGetProcAddress_v2('cuGraphExecGetFlags', &__cuGraphExecGetFlags, 12000, ptds_mode, NULL) + + global __cuGraphExecKernelNodeSetParams_v2 + cuGetProcAddress_v2('cuGraphExecKernelNodeSetParams', &__cuGraphExecKernelNodeSetParams_v2, 12000, ptds_mode, NULL) + + global __cuGraphExecMemcpyNodeSetParams + cuGetProcAddress_v2('cuGraphExecMemcpyNodeSetParams', &__cuGraphExecMemcpyNodeSetParams, 10020, ptds_mode, NULL) + + global __cuGraphExecMemsetNodeSetParams + cuGetProcAddress_v2('cuGraphExecMemsetNodeSetParams', &__cuGraphExecMemsetNodeSetParams, 10020, ptds_mode, NULL) + + global __cuGraphExecHostNodeSetParams + cuGetProcAddress_v2('cuGraphExecHostNodeSetParams', &__cuGraphExecHostNodeSetParams, 10020, ptds_mode, NULL) + + global __cuGraphExecChildGraphNodeSetParams + cuGetProcAddress_v2('cuGraphExecChildGraphNodeSetParams', &__cuGraphExecChildGraphNodeSetParams, 11010, ptds_mode, NULL) + + global __cuGraphExecEventRecordNodeSetEvent + cuGetProcAddress_v2('cuGraphExecEventRecordNodeSetEvent', &__cuGraphExecEventRecordNodeSetEvent, 11010, ptds_mode, NULL) + + global __cuGraphExecEventWaitNodeSetEvent + cuGetProcAddress_v2('cuGraphExecEventWaitNodeSetEvent', &__cuGraphExecEventWaitNodeSetEvent, 11010, ptds_mode, NULL) + + global __cuGraphExecExternalSemaphoresSignalNodeSetParams + cuGetProcAddress_v2('cuGraphExecExternalSemaphoresSignalNodeSetParams', &__cuGraphExecExternalSemaphoresSignalNodeSetParams, 11020, ptds_mode, NULL) + + global __cuGraphExecExternalSemaphoresWaitNodeSetParams + cuGetProcAddress_v2('cuGraphExecExternalSemaphoresWaitNodeSetParams', &__cuGraphExecExternalSemaphoresWaitNodeSetParams, 11020, ptds_mode, NULL) + + global __cuGraphNodeSetEnabled + cuGetProcAddress_v2('cuGraphNodeSetEnabled', &__cuGraphNodeSetEnabled, 11060, ptds_mode, NULL) + + global __cuGraphNodeGetEnabled + cuGetProcAddress_v2('cuGraphNodeGetEnabled', &__cuGraphNodeGetEnabled, 11060, ptds_mode, NULL) + + global __cuGraphUpload + cuGetProcAddress_v2('cuGraphUpload', &__cuGraphUpload, 11010, ptds_mode, NULL) + + global __cuGraphLaunch + cuGetProcAddress_v2('cuGraphLaunch', &__cuGraphLaunch, 10000, ptds_mode, NULL) + + global __cuGraphExecDestroy + cuGetProcAddress_v2('cuGraphExecDestroy', &__cuGraphExecDestroy, 10000, ptds_mode, NULL) + + global __cuGraphDestroy + cuGetProcAddress_v2('cuGraphDestroy', &__cuGraphDestroy, 10000, ptds_mode, NULL) + + global __cuGraphExecUpdate_v2 + cuGetProcAddress_v2('cuGraphExecUpdate', &__cuGraphExecUpdate_v2, 12000, ptds_mode, NULL) + + global __cuGraphKernelNodeCopyAttributes + cuGetProcAddress_v2('cuGraphKernelNodeCopyAttributes', &__cuGraphKernelNodeCopyAttributes, 11000, ptds_mode, NULL) + + global __cuGraphKernelNodeGetAttribute + cuGetProcAddress_v2('cuGraphKernelNodeGetAttribute', &__cuGraphKernelNodeGetAttribute, 11000, ptds_mode, NULL) + + global __cuGraphKernelNodeSetAttribute + cuGetProcAddress_v2('cuGraphKernelNodeSetAttribute', &__cuGraphKernelNodeSetAttribute, 11000, ptds_mode, NULL) + + global __cuGraphDebugDotPrint + cuGetProcAddress_v2('cuGraphDebugDotPrint', &__cuGraphDebugDotPrint, 11030, ptds_mode, NULL) + + global __cuUserObjectCreate + cuGetProcAddress_v2('cuUserObjectCreate', &__cuUserObjectCreate, 11030, ptds_mode, NULL) + + global __cuUserObjectRetain + cuGetProcAddress_v2('cuUserObjectRetain', &__cuUserObjectRetain, 11030, ptds_mode, NULL) + + global __cuUserObjectRelease + cuGetProcAddress_v2('cuUserObjectRelease', &__cuUserObjectRelease, 11030, ptds_mode, NULL) + + global __cuGraphRetainUserObject + cuGetProcAddress_v2('cuGraphRetainUserObject', &__cuGraphRetainUserObject, 11030, ptds_mode, NULL) + + global __cuGraphReleaseUserObject + cuGetProcAddress_v2('cuGraphReleaseUserObject', &__cuGraphReleaseUserObject, 11030, ptds_mode, NULL) + + global __cuGraphAddNode_v2 + cuGetProcAddress_v2('cuGraphAddNode', &__cuGraphAddNode_v2, 12030, ptds_mode, NULL) + + global __cuGraphNodeSetParams + cuGetProcAddress_v2('cuGraphNodeSetParams', &__cuGraphNodeSetParams, 12020, ptds_mode, NULL) + + global __cuGraphExecNodeSetParams + cuGetProcAddress_v2('cuGraphExecNodeSetParams', &__cuGraphExecNodeSetParams, 12020, ptds_mode, NULL) + + global __cuGraphConditionalHandleCreate + cuGetProcAddress_v2('cuGraphConditionalHandleCreate', &__cuGraphConditionalHandleCreate, 12030, ptds_mode, NULL) + + global __cuOccupancyMaxActiveBlocksPerMultiprocessor + cuGetProcAddress_v2('cuOccupancyMaxActiveBlocksPerMultiprocessor', &__cuOccupancyMaxActiveBlocksPerMultiprocessor, 6050, ptds_mode, NULL) + + global __cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags + cuGetProcAddress_v2('cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags', &__cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags, 7000, ptds_mode, NULL) + + global __cuOccupancyMaxPotentialBlockSize + cuGetProcAddress_v2('cuOccupancyMaxPotentialBlockSize', &__cuOccupancyMaxPotentialBlockSize, 6050, ptds_mode, NULL) + + global __cuOccupancyMaxPotentialBlockSizeWithFlags + cuGetProcAddress_v2('cuOccupancyMaxPotentialBlockSizeWithFlags', &__cuOccupancyMaxPotentialBlockSizeWithFlags, 7000, ptds_mode, NULL) + + global __cuOccupancyAvailableDynamicSMemPerBlock + cuGetProcAddress_v2('cuOccupancyAvailableDynamicSMemPerBlock', &__cuOccupancyAvailableDynamicSMemPerBlock, 10020, ptds_mode, NULL) + + global __cuOccupancyMaxPotentialClusterSize + cuGetProcAddress_v2('cuOccupancyMaxPotentialClusterSize', &__cuOccupancyMaxPotentialClusterSize, 11070, ptds_mode, NULL) + + global __cuOccupancyMaxActiveClusters + cuGetProcAddress_v2('cuOccupancyMaxActiveClusters', &__cuOccupancyMaxActiveClusters, 11070, ptds_mode, NULL) + + global __cuTexRefSetArray + cuGetProcAddress_v2('cuTexRefSetArray', &__cuTexRefSetArray, 2000, ptds_mode, NULL) + + global __cuTexRefSetMipmappedArray + cuGetProcAddress_v2('cuTexRefSetMipmappedArray', &__cuTexRefSetMipmappedArray, 5000, ptds_mode, NULL) + + global __cuTexRefSetAddress_v2 + cuGetProcAddress_v2('cuTexRefSetAddress', &__cuTexRefSetAddress_v2, 3020, ptds_mode, NULL) + + global __cuTexRefSetAddress2D_v3 + cuGetProcAddress_v2('cuTexRefSetAddress2D', &__cuTexRefSetAddress2D_v3, 4010, ptds_mode, NULL) + + global __cuTexRefSetFormat + cuGetProcAddress_v2('cuTexRefSetFormat', &__cuTexRefSetFormat, 2000, ptds_mode, NULL) + + global __cuTexRefSetAddressMode + cuGetProcAddress_v2('cuTexRefSetAddressMode', &__cuTexRefSetAddressMode, 2000, ptds_mode, NULL) + + global __cuTexRefSetFilterMode + cuGetProcAddress_v2('cuTexRefSetFilterMode', &__cuTexRefSetFilterMode, 2000, ptds_mode, NULL) + + global __cuTexRefSetMipmapFilterMode + cuGetProcAddress_v2('cuTexRefSetMipmapFilterMode', &__cuTexRefSetMipmapFilterMode, 5000, ptds_mode, NULL) + + global __cuTexRefSetMipmapLevelBias + cuGetProcAddress_v2('cuTexRefSetMipmapLevelBias', &__cuTexRefSetMipmapLevelBias, 5000, ptds_mode, NULL) + + global __cuTexRefSetMipmapLevelClamp + cuGetProcAddress_v2('cuTexRefSetMipmapLevelClamp', &__cuTexRefSetMipmapLevelClamp, 5000, ptds_mode, NULL) + + global __cuTexRefSetMaxAnisotropy + cuGetProcAddress_v2('cuTexRefSetMaxAnisotropy', &__cuTexRefSetMaxAnisotropy, 5000, ptds_mode, NULL) + + global __cuTexRefSetBorderColor + cuGetProcAddress_v2('cuTexRefSetBorderColor', &__cuTexRefSetBorderColor, 8000, ptds_mode, NULL) + + global __cuTexRefSetFlags + cuGetProcAddress_v2('cuTexRefSetFlags', &__cuTexRefSetFlags, 2000, ptds_mode, NULL) + + global __cuTexRefGetAddress_v2 + cuGetProcAddress_v2('cuTexRefGetAddress', &__cuTexRefGetAddress_v2, 3020, ptds_mode, NULL) + + global __cuTexRefGetArray + cuGetProcAddress_v2('cuTexRefGetArray', &__cuTexRefGetArray, 2000, ptds_mode, NULL) + + global __cuTexRefGetMipmappedArray + cuGetProcAddress_v2('cuTexRefGetMipmappedArray', &__cuTexRefGetMipmappedArray, 5000, ptds_mode, NULL) + + global __cuTexRefGetAddressMode + cuGetProcAddress_v2('cuTexRefGetAddressMode', &__cuTexRefGetAddressMode, 2000, ptds_mode, NULL) + + global __cuTexRefGetFilterMode + cuGetProcAddress_v2('cuTexRefGetFilterMode', &__cuTexRefGetFilterMode, 2000, ptds_mode, NULL) + + global __cuTexRefGetFormat + cuGetProcAddress_v2('cuTexRefGetFormat', &__cuTexRefGetFormat, 2000, ptds_mode, NULL) + + global __cuTexRefGetMipmapFilterMode + cuGetProcAddress_v2('cuTexRefGetMipmapFilterMode', &__cuTexRefGetMipmapFilterMode, 5000, ptds_mode, NULL) + + global __cuTexRefGetMipmapLevelBias + cuGetProcAddress_v2('cuTexRefGetMipmapLevelBias', &__cuTexRefGetMipmapLevelBias, 5000, ptds_mode, NULL) + + global __cuTexRefGetMipmapLevelClamp + cuGetProcAddress_v2('cuTexRefGetMipmapLevelClamp', &__cuTexRefGetMipmapLevelClamp, 5000, ptds_mode, NULL) + + global __cuTexRefGetMaxAnisotropy + cuGetProcAddress_v2('cuTexRefGetMaxAnisotropy', &__cuTexRefGetMaxAnisotropy, 5000, ptds_mode, NULL) + + global __cuTexRefGetBorderColor + cuGetProcAddress_v2('cuTexRefGetBorderColor', &__cuTexRefGetBorderColor, 8000, ptds_mode, NULL) + + global __cuTexRefGetFlags + cuGetProcAddress_v2('cuTexRefGetFlags', &__cuTexRefGetFlags, 2000, ptds_mode, NULL) + + global __cuTexRefCreate + cuGetProcAddress_v2('cuTexRefCreate', &__cuTexRefCreate, 2000, ptds_mode, NULL) + + global __cuTexRefDestroy + cuGetProcAddress_v2('cuTexRefDestroy', &__cuTexRefDestroy, 2000, ptds_mode, NULL) + + global __cuSurfRefSetArray + cuGetProcAddress_v2('cuSurfRefSetArray', &__cuSurfRefSetArray, 3000, ptds_mode, NULL) + + global __cuSurfRefGetArray + cuGetProcAddress_v2('cuSurfRefGetArray', &__cuSurfRefGetArray, 3000, ptds_mode, NULL) + + global __cuTexObjectCreate + cuGetProcAddress_v2('cuTexObjectCreate', &__cuTexObjectCreate, 5000, ptds_mode, NULL) + + global __cuTexObjectDestroy + cuGetProcAddress_v2('cuTexObjectDestroy', &__cuTexObjectDestroy, 5000, ptds_mode, NULL) + + global __cuTexObjectGetResourceDesc + cuGetProcAddress_v2('cuTexObjectGetResourceDesc', &__cuTexObjectGetResourceDesc, 5000, ptds_mode, NULL) + + global __cuTexObjectGetTextureDesc + cuGetProcAddress_v2('cuTexObjectGetTextureDesc', &__cuTexObjectGetTextureDesc, 5000, ptds_mode, NULL) + + global __cuTexObjectGetResourceViewDesc + cuGetProcAddress_v2('cuTexObjectGetResourceViewDesc', &__cuTexObjectGetResourceViewDesc, 5000, ptds_mode, NULL) + + global __cuSurfObjectCreate + cuGetProcAddress_v2('cuSurfObjectCreate', &__cuSurfObjectCreate, 5000, ptds_mode, NULL) + + global __cuSurfObjectDestroy + cuGetProcAddress_v2('cuSurfObjectDestroy', &__cuSurfObjectDestroy, 5000, ptds_mode, NULL) + + global __cuSurfObjectGetResourceDesc + cuGetProcAddress_v2('cuSurfObjectGetResourceDesc', &__cuSurfObjectGetResourceDesc, 5000, ptds_mode, NULL) + + global __cuTensorMapEncodeTiled + cuGetProcAddress_v2('cuTensorMapEncodeTiled', &__cuTensorMapEncodeTiled, 12000, ptds_mode, NULL) + + global __cuTensorMapEncodeIm2col + cuGetProcAddress_v2('cuTensorMapEncodeIm2col', &__cuTensorMapEncodeIm2col, 12000, ptds_mode, NULL) + + global __cuTensorMapEncodeIm2colWide + cuGetProcAddress_v2('cuTensorMapEncodeIm2colWide', &__cuTensorMapEncodeIm2colWide, 12080, ptds_mode, NULL) + + global __cuTensorMapReplaceAddress + cuGetProcAddress_v2('cuTensorMapReplaceAddress', &__cuTensorMapReplaceAddress, 12000, ptds_mode, NULL) + + global __cuDeviceCanAccessPeer + cuGetProcAddress_v2('cuDeviceCanAccessPeer', &__cuDeviceCanAccessPeer, 4000, ptds_mode, NULL) + + global __cuCtxEnablePeerAccess + cuGetProcAddress_v2('cuCtxEnablePeerAccess', &__cuCtxEnablePeerAccess, 4000, ptds_mode, NULL) + + global __cuCtxDisablePeerAccess + cuGetProcAddress_v2('cuCtxDisablePeerAccess', &__cuCtxDisablePeerAccess, 4000, ptds_mode, NULL) + + global __cuDeviceGetP2PAttribute + cuGetProcAddress_v2('cuDeviceGetP2PAttribute', &__cuDeviceGetP2PAttribute, 8000, ptds_mode, NULL) + + global __cuGraphicsUnregisterResource + cuGetProcAddress_v2('cuGraphicsUnregisterResource', &__cuGraphicsUnregisterResource, 3000, ptds_mode, NULL) + + global __cuGraphicsSubResourceGetMappedArray + cuGetProcAddress_v2('cuGraphicsSubResourceGetMappedArray', &__cuGraphicsSubResourceGetMappedArray, 3000, ptds_mode, NULL) + + global __cuGraphicsResourceGetMappedMipmappedArray + cuGetProcAddress_v2('cuGraphicsResourceGetMappedMipmappedArray', &__cuGraphicsResourceGetMappedMipmappedArray, 5000, ptds_mode, NULL) + + global __cuGraphicsResourceGetMappedPointer_v2 + cuGetProcAddress_v2('cuGraphicsResourceGetMappedPointer', &__cuGraphicsResourceGetMappedPointer_v2, 3020, ptds_mode, NULL) + + global __cuGraphicsResourceSetMapFlags_v2 + cuGetProcAddress_v2('cuGraphicsResourceSetMapFlags', &__cuGraphicsResourceSetMapFlags_v2, 6050, ptds_mode, NULL) + + global __cuGraphicsMapResources + cuGetProcAddress_v2('cuGraphicsMapResources', &__cuGraphicsMapResources, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3000, ptds_mode, NULL) + + global __cuGraphicsUnmapResources + cuGetProcAddress_v2('cuGraphicsUnmapResources', &__cuGraphicsUnmapResources, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3000, ptds_mode, NULL) + + global __cuGetProcAddress_v2 + cuGetProcAddress_v2('cuGetProcAddress', &__cuGetProcAddress_v2, 12000, ptds_mode, NULL) + + global __cuCoredumpGetAttribute + cuGetProcAddress_v2('cuCoredumpGetAttribute', &__cuCoredumpGetAttribute, 12010, ptds_mode, NULL) + + global __cuCoredumpGetAttributeGlobal + cuGetProcAddress_v2('cuCoredumpGetAttributeGlobal', &__cuCoredumpGetAttributeGlobal, 12010, ptds_mode, NULL) + + global __cuCoredumpSetAttribute + cuGetProcAddress_v2('cuCoredumpSetAttribute', &__cuCoredumpSetAttribute, 12010, ptds_mode, NULL) + + global __cuCoredumpSetAttributeGlobal + cuGetProcAddress_v2('cuCoredumpSetAttributeGlobal', &__cuCoredumpSetAttributeGlobal, 12010, ptds_mode, NULL) + + global __cuGetExportTable + cuGetProcAddress_v2('cuGetExportTable', &__cuGetExportTable, 3000, ptds_mode, NULL) + + global __cuGreenCtxCreate + cuGetProcAddress_v2('cuGreenCtxCreate', &__cuGreenCtxCreate, 12040, ptds_mode, NULL) + + global __cuGreenCtxDestroy + cuGetProcAddress_v2('cuGreenCtxDestroy', &__cuGreenCtxDestroy, 12040, ptds_mode, NULL) + + global __cuCtxFromGreenCtx + cuGetProcAddress_v2('cuCtxFromGreenCtx', &__cuCtxFromGreenCtx, 12040, ptds_mode, NULL) + + global __cuDeviceGetDevResource + cuGetProcAddress_v2('cuDeviceGetDevResource', &__cuDeviceGetDevResource, 12040, ptds_mode, NULL) + + global __cuCtxGetDevResource + cuGetProcAddress_v2('cuCtxGetDevResource', &__cuCtxGetDevResource, 12040, ptds_mode, NULL) + + global __cuGreenCtxGetDevResource + cuGetProcAddress_v2('cuGreenCtxGetDevResource', &__cuGreenCtxGetDevResource, 12040, ptds_mode, NULL) + + global __cuDevSmResourceSplitByCount + cuGetProcAddress_v2('cuDevSmResourceSplitByCount', &__cuDevSmResourceSplitByCount, 12040, ptds_mode, NULL) + + global __cuDevResourceGenerateDesc + cuGetProcAddress_v2('cuDevResourceGenerateDesc', &__cuDevResourceGenerateDesc, 12040, ptds_mode, NULL) + + global __cuGreenCtxRecordEvent + cuGetProcAddress_v2('cuGreenCtxRecordEvent', &__cuGreenCtxRecordEvent, 12040, ptds_mode, NULL) + + global __cuGreenCtxWaitEvent + cuGetProcAddress_v2('cuGreenCtxWaitEvent', &__cuGreenCtxWaitEvent, 12040, ptds_mode, NULL) + + global __cuStreamGetGreenCtx + cuGetProcAddress_v2('cuStreamGetGreenCtx', &__cuStreamGetGreenCtx, 12040, ptds_mode, NULL) + + global __cuGreenCtxStreamCreate + cuGetProcAddress_v2('cuGreenCtxStreamCreate', &__cuGreenCtxStreamCreate, 12050, ptds_mode, NULL) + + global __cuLogsRegisterCallback + cuGetProcAddress_v2('cuLogsRegisterCallback', &__cuLogsRegisterCallback, 12080, ptds_mode, NULL) + + global __cuLogsUnregisterCallback + cuGetProcAddress_v2('cuLogsUnregisterCallback', &__cuLogsUnregisterCallback, 12080, ptds_mode, NULL) + + global __cuLogsCurrent + cuGetProcAddress_v2('cuLogsCurrent', &__cuLogsCurrent, 12080, ptds_mode, NULL) + + global __cuLogsDumpToFile + cuGetProcAddress_v2('cuLogsDumpToFile', &__cuLogsDumpToFile, 12080, ptds_mode, NULL) + + global __cuLogsDumpToMemory + cuGetProcAddress_v2('cuLogsDumpToMemory', &__cuLogsDumpToMemory, 12080, ptds_mode, NULL) + + global __cuCheckpointProcessGetRestoreThreadId + cuGetProcAddress_v2('cuCheckpointProcessGetRestoreThreadId', &__cuCheckpointProcessGetRestoreThreadId, 12080, ptds_mode, NULL) + + global __cuCheckpointProcessGetState + cuGetProcAddress_v2('cuCheckpointProcessGetState', &__cuCheckpointProcessGetState, 12080, ptds_mode, NULL) + + global __cuCheckpointProcessLock + cuGetProcAddress_v2('cuCheckpointProcessLock', &__cuCheckpointProcessLock, 12080, ptds_mode, NULL) + + global __cuCheckpointProcessCheckpoint + cuGetProcAddress_v2('cuCheckpointProcessCheckpoint', &__cuCheckpointProcessCheckpoint, 12080, ptds_mode, NULL) + + global __cuCheckpointProcessRestore + cuGetProcAddress_v2('cuCheckpointProcessRestore', &__cuCheckpointProcessRestore, 12080, ptds_mode, NULL) + + global __cuCheckpointProcessUnlock + cuGetProcAddress_v2('cuCheckpointProcessUnlock', &__cuCheckpointProcessUnlock, 12080, ptds_mode, NULL) + + global __cuGraphicsEGLRegisterImage + cuGetProcAddress_v2('cuGraphicsEGLRegisterImage', &__cuGraphicsEGLRegisterImage, 7000, ptds_mode, NULL) + + global __cuEGLStreamConsumerConnect + cuGetProcAddress_v2('cuEGLStreamConsumerConnect', &__cuEGLStreamConsumerConnect, 7000, ptds_mode, NULL) + + global __cuEGLStreamConsumerConnectWithFlags + cuGetProcAddress_v2('cuEGLStreamConsumerConnectWithFlags', &__cuEGLStreamConsumerConnectWithFlags, 8000, ptds_mode, NULL) + + global __cuEGLStreamConsumerDisconnect + cuGetProcAddress_v2('cuEGLStreamConsumerDisconnect', &__cuEGLStreamConsumerDisconnect, 7000, ptds_mode, NULL) + + global __cuEGLStreamConsumerAcquireFrame + cuGetProcAddress_v2('cuEGLStreamConsumerAcquireFrame', &__cuEGLStreamConsumerAcquireFrame, 7000, ptds_mode, NULL) + + global __cuEGLStreamConsumerReleaseFrame + cuGetProcAddress_v2('cuEGLStreamConsumerReleaseFrame', &__cuEGLStreamConsumerReleaseFrame, 7000, ptds_mode, NULL) + + global __cuEGLStreamProducerConnect + cuGetProcAddress_v2('cuEGLStreamProducerConnect', &__cuEGLStreamProducerConnect, 7000, ptds_mode, NULL) + + global __cuEGLStreamProducerDisconnect + cuGetProcAddress_v2('cuEGLStreamProducerDisconnect', &__cuEGLStreamProducerDisconnect, 7000, ptds_mode, NULL) + + global __cuEGLStreamProducerPresentFrame + cuGetProcAddress_v2('cuEGLStreamProducerPresentFrame', &__cuEGLStreamProducerPresentFrame, 7000, ptds_mode, NULL) + + global __cuEGLStreamProducerReturnFrame + cuGetProcAddress_v2('cuEGLStreamProducerReturnFrame', &__cuEGLStreamProducerReturnFrame, 7000, ptds_mode, NULL) + + global __cuGraphicsResourceGetMappedEglFrame + cuGetProcAddress_v2('cuGraphicsResourceGetMappedEglFrame', &__cuGraphicsResourceGetMappedEglFrame, 7000, ptds_mode, NULL) + + global __cuEventCreateFromEGLSync + cuGetProcAddress_v2('cuEventCreateFromEGLSync', &__cuEventCreateFromEGLSync, 9000, ptds_mode, NULL) + + global __cuGraphicsGLRegisterBuffer + cuGetProcAddress_v2('cuGraphicsGLRegisterBuffer', &__cuGraphicsGLRegisterBuffer, 3000, ptds_mode, NULL) + + global __cuGraphicsGLRegisterImage + cuGetProcAddress_v2('cuGraphicsGLRegisterImage', &__cuGraphicsGLRegisterImage, 3000, ptds_mode, NULL) + + global __cuGLGetDevices_v2 + cuGetProcAddress_v2('cuGLGetDevices', &__cuGLGetDevices_v2, 6050, ptds_mode, NULL) + + global __cuGLCtxCreate_v2 + cuGetProcAddress_v2('cuGLCtxCreate', &__cuGLCtxCreate_v2, 3020, ptds_mode, NULL) + + global __cuGLInit + cuGetProcAddress_v2('cuGLInit', &__cuGLInit, 2000, ptds_mode, NULL) + + global __cuGLRegisterBufferObject + cuGetProcAddress_v2('cuGLRegisterBufferObject', &__cuGLRegisterBufferObject, 2000, ptds_mode, NULL) + + global __cuGLMapBufferObject_v2 + cuGetProcAddress_v2('cuGLMapBufferObject', &__cuGLMapBufferObject_v2, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuGLUnmapBufferObject + cuGetProcAddress_v2('cuGLUnmapBufferObject', &__cuGLUnmapBufferObject, 2000, ptds_mode, NULL) + + global __cuGLUnregisterBufferObject + cuGetProcAddress_v2('cuGLUnregisterBufferObject', &__cuGLUnregisterBufferObject, 2000, ptds_mode, NULL) + + global __cuGLSetBufferObjectMapFlags + cuGetProcAddress_v2('cuGLSetBufferObjectMapFlags', &__cuGLSetBufferObjectMapFlags, 2030, ptds_mode, NULL) + + global __cuGLMapBufferObjectAsync_v2 + cuGetProcAddress_v2('cuGLMapBufferObjectAsync', &__cuGLMapBufferObjectAsync_v2, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuGLUnmapBufferObjectAsync + cuGetProcAddress_v2('cuGLUnmapBufferObjectAsync', &__cuGLUnmapBufferObjectAsync, 2030, ptds_mode, NULL) + + global __cuProfilerInitialize + cuGetProcAddress_v2('cuProfilerInitialize', &__cuProfilerInitialize, 4000, ptds_mode, NULL) + + global __cuProfilerStart + cuGetProcAddress_v2('cuProfilerStart', &__cuProfilerStart, 4000, ptds_mode, NULL) + + global __cuProfilerStop + cuGetProcAddress_v2('cuProfilerStop', &__cuProfilerStop, 4000, ptds_mode, NULL) + + global __cuVDPAUGetDevice + cuGetProcAddress_v2('cuVDPAUGetDevice', &__cuVDPAUGetDevice, 3010, ptds_mode, NULL) + + global __cuVDPAUCtxCreate_v2 + cuGetProcAddress_v2('cuVDPAUCtxCreate', &__cuVDPAUCtxCreate_v2, 3020, ptds_mode, NULL) + + global __cuGraphicsVDPAURegisterVideoSurface + cuGetProcAddress_v2('cuGraphicsVDPAURegisterVideoSurface', &__cuGraphicsVDPAURegisterVideoSurface, 3010, ptds_mode, NULL) + + global __cuGraphicsVDPAURegisterOutputSurface + cuGetProcAddress_v2('cuGraphicsVDPAURegisterOutputSurface', &__cuGraphicsVDPAURegisterOutputSurface, 3010, ptds_mode, NULL) + + global __cuDeviceGetHostAtomicCapabilities + cuGetProcAddress_v2('cuDeviceGetHostAtomicCapabilities', &__cuDeviceGetHostAtomicCapabilities, 13000, ptds_mode, NULL) + + global __cuCtxGetDevice_v2 + cuGetProcAddress_v2('cuCtxGetDevice', &__cuCtxGetDevice_v2, 13000, ptds_mode, NULL) + + global __cuCtxSynchronize_v2 + cuGetProcAddress_v2('cuCtxSynchronize', &__cuCtxSynchronize_v2, 13000, ptds_mode, NULL) + + global __cuMemcpyBatchAsync_v2 + cuGetProcAddress_v2('cuMemcpyBatchAsync', &__cuMemcpyBatchAsync_v2, 13000, ptds_mode, NULL) + + global __cuMemcpy3DBatchAsync_v2 + cuGetProcAddress_v2('cuMemcpy3DBatchAsync', &__cuMemcpy3DBatchAsync_v2, 13000, ptds_mode, NULL) + + global __cuMemGetDefaultMemPool + cuGetProcAddress_v2('cuMemGetDefaultMemPool', &__cuMemGetDefaultMemPool, 13000, ptds_mode, NULL) + + global __cuMemGetMemPool + cuGetProcAddress_v2('cuMemGetMemPool', &__cuMemGetMemPool, 13000, ptds_mode, NULL) + + global __cuMemSetMemPool + cuGetProcAddress_v2('cuMemSetMemPool', &__cuMemSetMemPool, 13000, ptds_mode, NULL) + + global __cuMemPrefetchBatchAsync + cuGetProcAddress_v2('cuMemPrefetchBatchAsync', &__cuMemPrefetchBatchAsync, 13000, ptds_mode, NULL) + + global __cuMemDiscardBatchAsync + cuGetProcAddress_v2('cuMemDiscardBatchAsync', &__cuMemDiscardBatchAsync, 13000, ptds_mode, NULL) + + global __cuMemDiscardAndPrefetchBatchAsync + cuGetProcAddress_v2('cuMemDiscardAndPrefetchBatchAsync', &__cuMemDiscardAndPrefetchBatchAsync, 13000, ptds_mode, NULL) + + global __cuDeviceGetP2PAtomicCapabilities + cuGetProcAddress_v2('cuDeviceGetP2PAtomicCapabilities', &__cuDeviceGetP2PAtomicCapabilities, 13000, ptds_mode, NULL) + + global __cuGreenCtxGetId + cuGetProcAddress_v2('cuGreenCtxGetId', &__cuGreenCtxGetId, 13000, ptds_mode, NULL) + + global __cuMulticastBindMem_v2 + cuGetProcAddress_v2('cuMulticastBindMem', &__cuMulticastBindMem_v2, 13010, ptds_mode, NULL) + + global __cuMulticastBindAddr_v2 + cuGetProcAddress_v2('cuMulticastBindAddr', &__cuMulticastBindAddr_v2, 13010, ptds_mode, NULL) + + global __cuGraphNodeGetContainingGraph + cuGetProcAddress_v2('cuGraphNodeGetContainingGraph', &__cuGraphNodeGetContainingGraph, 13010, ptds_mode, NULL) + + global __cuGraphNodeGetLocalId + cuGetProcAddress_v2('cuGraphNodeGetLocalId', &__cuGraphNodeGetLocalId, 13010, ptds_mode, NULL) + + global __cuGraphNodeGetToolsId + cuGetProcAddress_v2('cuGraphNodeGetToolsId', &__cuGraphNodeGetToolsId, 13010, ptds_mode, NULL) + + global __cuGraphGetId + cuGetProcAddress_v2('cuGraphGetId', &__cuGraphGetId, 13010, ptds_mode, NULL) + + global __cuGraphExecGetId + cuGetProcAddress_v2('cuGraphExecGetId', &__cuGraphExecGetId, 13010, ptds_mode, NULL) + + global __cuDevSmResourceSplit + cuGetProcAddress_v2('cuDevSmResourceSplit', &__cuDevSmResourceSplit, 13010, ptds_mode, NULL) + + global __cuStreamGetDevResource + cuGetProcAddress_v2('cuStreamGetDevResource', &__cuStreamGetDevResource, 13010, ptds_mode, NULL) + + global __cuKernelGetParamCount + cuGetProcAddress_v2('cuKernelGetParamCount', &__cuKernelGetParamCount, 13020, ptds_mode, NULL) + + global __cuMemcpyWithAttributesAsync + cuGetProcAddress_v2('cuMemcpyWithAttributesAsync', &__cuMemcpyWithAttributesAsync, 13020, ptds_mode, NULL) + + global __cuMemcpy3DWithAttributesAsync + cuGetProcAddress_v2('cuMemcpy3DWithAttributesAsync', &__cuMemcpy3DWithAttributesAsync, 13020, ptds_mode, NULL) + + global __cuStreamBeginCaptureToCig + cuGetProcAddress_v2('cuStreamBeginCaptureToCig', &__cuStreamBeginCaptureToCig, 13020, ptds_mode, NULL) + + global __cuStreamEndCaptureToCig + cuGetProcAddress_v2('cuStreamEndCaptureToCig', &__cuStreamEndCaptureToCig, 13020, ptds_mode, NULL) + + global __cuFuncGetParamCount + cuGetProcAddress_v2('cuFuncGetParamCount', &__cuFuncGetParamCount, 13020, ptds_mode, NULL) + + global __cuLaunchHostFunc_v2 + cuGetProcAddress_v2('cuLaunchHostFunc', &__cuLaunchHostFunc_v2, 13020, ptds_mode, NULL) + + global __cuGraphNodeGetParams + cuGetProcAddress_v2('cuGraphNodeGetParams', &__cuGraphNodeGetParams, 13020, ptds_mode, NULL) + + global __cuCoredumpRegisterStartCallback + cuGetProcAddress_v2('cuCoredumpRegisterStartCallback', &__cuCoredumpRegisterStartCallback, 13020, ptds_mode, NULL) + + global __cuCoredumpRegisterCompleteCallback + cuGetProcAddress_v2('cuCoredumpRegisterCompleteCallback', &__cuCoredumpRegisterCompleteCallback, 13020, ptds_mode, NULL) + + global __cuCoredumpDeregisterStartCallback + cuGetProcAddress_v2('cuCoredumpDeregisterStartCallback', &__cuCoredumpDeregisterStartCallback, 13020, ptds_mode, NULL) + + global __cuCoredumpDeregisterCompleteCallback + cuGetProcAddress_v2('cuCoredumpDeregisterCompleteCallback', &__cuCoredumpDeregisterCompleteCallback, 13020, ptds_mode, NULL) + + global __cuLogicalEndpointIdReserve + cuGetProcAddress_v2('cuLogicalEndpointIdReserve', &__cuLogicalEndpointIdReserve, 13030, ptds_mode, NULL) + + global __cuLogicalEndpointIdRelease + cuGetProcAddress_v2('cuLogicalEndpointIdRelease', &__cuLogicalEndpointIdRelease, 13030, ptds_mode, NULL) + + global __cuLogicalEndpointCreate + cuGetProcAddress_v2('cuLogicalEndpointCreate', &__cuLogicalEndpointCreate, 13030, ptds_mode, NULL) + + global __cuLogicalEndpointAddDevice + cuGetProcAddress_v2('cuLogicalEndpointAddDevice', &__cuLogicalEndpointAddDevice, 13030, ptds_mode, NULL) + + global __cuLogicalEndpointDestroy + cuGetProcAddress_v2('cuLogicalEndpointDestroy', &__cuLogicalEndpointDestroy, 13030, ptds_mode, NULL) + + global __cuLogicalEndpointBindAddr + cuGetProcAddress_v2('cuLogicalEndpointBindAddr', &__cuLogicalEndpointBindAddr, 13030, ptds_mode, NULL) + + global __cuLogicalEndpointBindMem + cuGetProcAddress_v2('cuLogicalEndpointBindMem', &__cuLogicalEndpointBindMem, 13030, ptds_mode, NULL) + + global __cuLogicalEndpointUnbind + cuGetProcAddress_v2('cuLogicalEndpointUnbind', &__cuLogicalEndpointUnbind, 13030, ptds_mode, NULL) + + global __cuLogicalEndpointExport + cuGetProcAddress_v2('cuLogicalEndpointExport', &__cuLogicalEndpointExport, 13030, ptds_mode, NULL) + + global __cuLogicalEndpointImport + cuGetProcAddress_v2('cuLogicalEndpointImport', &__cuLogicalEndpointImport, 13030, ptds_mode, NULL) + + global __cuLogicalEndpointGetLimits + cuGetProcAddress_v2('cuLogicalEndpointGetLimits', &__cuLogicalEndpointGetLimits, 13030, ptds_mode, NULL) + + global __cuLogicalEndpointQuery + cuGetProcAddress_v2('cuLogicalEndpointQuery', &__cuLogicalEndpointQuery, 13030, ptds_mode, NULL) + + global __cuStreamBeginRecaptureToGraph + cuGetProcAddress_v2('cuStreamBeginRecaptureToGraph', &__cuStreamBeginRecaptureToGraph, 13030, ptds_mode, NULL) + + _cyb___py_driver_init = True + return 0 + +cdef inline int _check_or_init_driver() except -1 nogil: + if _cyb___py_driver_init: + return 0 + + return _init_driver() + + +cpdef dict _inspect_function_pointers(): + global _cyb_func_ptrs + if _cyb_func_ptrs is not None: + return _cyb_func_ptrs + + _check_or_init_driver() + cdef dict data = {} + global __cuGetErrorString + data["__cuGetErrorString"] = <_cyb_intptr_t>__cuGetErrorString + + global __cuGetErrorName + data["__cuGetErrorName"] = <_cyb_intptr_t>__cuGetErrorName + + global __cuInit + data["__cuInit"] = <_cyb_intptr_t>__cuInit + + global __cuDriverGetVersion + data["__cuDriverGetVersion"] = <_cyb_intptr_t>__cuDriverGetVersion + + global __cuDeviceGet + data["__cuDeviceGet"] = <_cyb_intptr_t>__cuDeviceGet + + global __cuDeviceGetCount + data["__cuDeviceGetCount"] = <_cyb_intptr_t>__cuDeviceGetCount + + global __cuDeviceGetName + data["__cuDeviceGetName"] = <_cyb_intptr_t>__cuDeviceGetName + + global __cuDeviceGetUuid_v2 + data["__cuDeviceGetUuid_v2"] = <_cyb_intptr_t>__cuDeviceGetUuid_v2 + + global __cuDeviceGetLuid + data["__cuDeviceGetLuid"] = <_cyb_intptr_t>__cuDeviceGetLuid + + global __cuDeviceTotalMem_v2 + data["__cuDeviceTotalMem_v2"] = <_cyb_intptr_t>__cuDeviceTotalMem_v2 + + global __cuDeviceGetTexture1DLinearMaxWidth + data["__cuDeviceGetTexture1DLinearMaxWidth"] = <_cyb_intptr_t>__cuDeviceGetTexture1DLinearMaxWidth + + global __cuDeviceGetAttribute + data["__cuDeviceGetAttribute"] = <_cyb_intptr_t>__cuDeviceGetAttribute + + global __cuDeviceGetNvSciSyncAttributes + data["__cuDeviceGetNvSciSyncAttributes"] = <_cyb_intptr_t>__cuDeviceGetNvSciSyncAttributes + + global __cuDeviceSetMemPool + data["__cuDeviceSetMemPool"] = <_cyb_intptr_t>__cuDeviceSetMemPool + + global __cuDeviceGetMemPool + data["__cuDeviceGetMemPool"] = <_cyb_intptr_t>__cuDeviceGetMemPool + + global __cuDeviceGetDefaultMemPool + data["__cuDeviceGetDefaultMemPool"] = <_cyb_intptr_t>__cuDeviceGetDefaultMemPool + + global __cuDeviceGetExecAffinitySupport + data["__cuDeviceGetExecAffinitySupport"] = <_cyb_intptr_t>__cuDeviceGetExecAffinitySupport + + global __cuFlushGPUDirectRDMAWrites + data["__cuFlushGPUDirectRDMAWrites"] = <_cyb_intptr_t>__cuFlushGPUDirectRDMAWrites + + global __cuDeviceGetProperties + data["__cuDeviceGetProperties"] = <_cyb_intptr_t>__cuDeviceGetProperties + + global __cuDeviceComputeCapability + data["__cuDeviceComputeCapability"] = <_cyb_intptr_t>__cuDeviceComputeCapability + + global __cuDevicePrimaryCtxRetain + data["__cuDevicePrimaryCtxRetain"] = <_cyb_intptr_t>__cuDevicePrimaryCtxRetain + + global __cuDevicePrimaryCtxRelease_v2 + data["__cuDevicePrimaryCtxRelease_v2"] = <_cyb_intptr_t>__cuDevicePrimaryCtxRelease_v2 + + global __cuDevicePrimaryCtxSetFlags_v2 + data["__cuDevicePrimaryCtxSetFlags_v2"] = <_cyb_intptr_t>__cuDevicePrimaryCtxSetFlags_v2 + + global __cuDevicePrimaryCtxGetState + data["__cuDevicePrimaryCtxGetState"] = <_cyb_intptr_t>__cuDevicePrimaryCtxGetState + + global __cuDevicePrimaryCtxReset_v2 + data["__cuDevicePrimaryCtxReset_v2"] = <_cyb_intptr_t>__cuDevicePrimaryCtxReset_v2 + + global __cuCtxCreate_v2 + data["__cuCtxCreate_v2"] = <_cyb_intptr_t>__cuCtxCreate_v2 + + global __cuCtxCreate_v3 + data["__cuCtxCreate_v3"] = <_cyb_intptr_t>__cuCtxCreate_v3 + + global __cuCtxCreate_v4 + data["__cuCtxCreate_v4"] = <_cyb_intptr_t>__cuCtxCreate_v4 + + global __cuCtxDestroy_v2 + data["__cuCtxDestroy_v2"] = <_cyb_intptr_t>__cuCtxDestroy_v2 + + global __cuCtxPushCurrent_v2 + data["__cuCtxPushCurrent_v2"] = <_cyb_intptr_t>__cuCtxPushCurrent_v2 + + global __cuCtxPopCurrent_v2 + data["__cuCtxPopCurrent_v2"] = <_cyb_intptr_t>__cuCtxPopCurrent_v2 + + global __cuCtxSetCurrent + data["__cuCtxSetCurrent"] = <_cyb_intptr_t>__cuCtxSetCurrent + + global __cuCtxGetCurrent + data["__cuCtxGetCurrent"] = <_cyb_intptr_t>__cuCtxGetCurrent + + global __cuCtxGetDevice + data["__cuCtxGetDevice"] = <_cyb_intptr_t>__cuCtxGetDevice + + global __cuCtxGetFlags + data["__cuCtxGetFlags"] = <_cyb_intptr_t>__cuCtxGetFlags + + global __cuCtxSetFlags + data["__cuCtxSetFlags"] = <_cyb_intptr_t>__cuCtxSetFlags + + global __cuCtxGetId + data["__cuCtxGetId"] = <_cyb_intptr_t>__cuCtxGetId + + global __cuCtxSynchronize + data["__cuCtxSynchronize"] = <_cyb_intptr_t>__cuCtxSynchronize + + global __cuCtxSetLimit + data["__cuCtxSetLimit"] = <_cyb_intptr_t>__cuCtxSetLimit + + global __cuCtxGetLimit + data["__cuCtxGetLimit"] = <_cyb_intptr_t>__cuCtxGetLimit + + global __cuCtxGetCacheConfig + data["__cuCtxGetCacheConfig"] = <_cyb_intptr_t>__cuCtxGetCacheConfig + + global __cuCtxSetCacheConfig + data["__cuCtxSetCacheConfig"] = <_cyb_intptr_t>__cuCtxSetCacheConfig + + global __cuCtxGetApiVersion + data["__cuCtxGetApiVersion"] = <_cyb_intptr_t>__cuCtxGetApiVersion + + global __cuCtxGetStreamPriorityRange + data["__cuCtxGetStreamPriorityRange"] = <_cyb_intptr_t>__cuCtxGetStreamPriorityRange + + global __cuCtxResetPersistingL2Cache + data["__cuCtxResetPersistingL2Cache"] = <_cyb_intptr_t>__cuCtxResetPersistingL2Cache + + global __cuCtxGetExecAffinity + data["__cuCtxGetExecAffinity"] = <_cyb_intptr_t>__cuCtxGetExecAffinity + + global __cuCtxRecordEvent + data["__cuCtxRecordEvent"] = <_cyb_intptr_t>__cuCtxRecordEvent + + global __cuCtxWaitEvent + data["__cuCtxWaitEvent"] = <_cyb_intptr_t>__cuCtxWaitEvent + + global __cuCtxAttach + data["__cuCtxAttach"] = <_cyb_intptr_t>__cuCtxAttach + + global __cuCtxDetach + data["__cuCtxDetach"] = <_cyb_intptr_t>__cuCtxDetach + + global __cuCtxGetSharedMemConfig + data["__cuCtxGetSharedMemConfig"] = <_cyb_intptr_t>__cuCtxGetSharedMemConfig + + global __cuCtxSetSharedMemConfig + data["__cuCtxSetSharedMemConfig"] = <_cyb_intptr_t>__cuCtxSetSharedMemConfig + + global __cuModuleLoad + data["__cuModuleLoad"] = <_cyb_intptr_t>__cuModuleLoad + + global __cuModuleLoadData + data["__cuModuleLoadData"] = <_cyb_intptr_t>__cuModuleLoadData + + global __cuModuleLoadDataEx + data["__cuModuleLoadDataEx"] = <_cyb_intptr_t>__cuModuleLoadDataEx + + global __cuModuleLoadFatBinary + data["__cuModuleLoadFatBinary"] = <_cyb_intptr_t>__cuModuleLoadFatBinary + + global __cuModuleUnload + data["__cuModuleUnload"] = <_cyb_intptr_t>__cuModuleUnload + + global __cuModuleGetLoadingMode + data["__cuModuleGetLoadingMode"] = <_cyb_intptr_t>__cuModuleGetLoadingMode + + global __cuModuleGetFunction + data["__cuModuleGetFunction"] = <_cyb_intptr_t>__cuModuleGetFunction + + global __cuModuleGetFunctionCount + data["__cuModuleGetFunctionCount"] = <_cyb_intptr_t>__cuModuleGetFunctionCount + + global __cuModuleEnumerateFunctions + data["__cuModuleEnumerateFunctions"] = <_cyb_intptr_t>__cuModuleEnumerateFunctions + + global __cuModuleGetGlobal_v2 + data["__cuModuleGetGlobal_v2"] = <_cyb_intptr_t>__cuModuleGetGlobal_v2 + + global __cuLinkCreate_v2 + data["__cuLinkCreate_v2"] = <_cyb_intptr_t>__cuLinkCreate_v2 + + global __cuLinkAddData_v2 + data["__cuLinkAddData_v2"] = <_cyb_intptr_t>__cuLinkAddData_v2 + + global __cuLinkAddFile_v2 + data["__cuLinkAddFile_v2"] = <_cyb_intptr_t>__cuLinkAddFile_v2 + + global __cuLinkComplete + data["__cuLinkComplete"] = <_cyb_intptr_t>__cuLinkComplete + + global __cuLinkDestroy + data["__cuLinkDestroy"] = <_cyb_intptr_t>__cuLinkDestroy + + global __cuModuleGetTexRef + data["__cuModuleGetTexRef"] = <_cyb_intptr_t>__cuModuleGetTexRef + + global __cuModuleGetSurfRef + data["__cuModuleGetSurfRef"] = <_cyb_intptr_t>__cuModuleGetSurfRef + + global __cuLibraryLoadData + data["__cuLibraryLoadData"] = <_cyb_intptr_t>__cuLibraryLoadData + + global __cuLibraryLoadFromFile + data["__cuLibraryLoadFromFile"] = <_cyb_intptr_t>__cuLibraryLoadFromFile + + global __cuLibraryUnload + data["__cuLibraryUnload"] = <_cyb_intptr_t>__cuLibraryUnload + + global __cuLibraryGetKernel + data["__cuLibraryGetKernel"] = <_cyb_intptr_t>__cuLibraryGetKernel + + global __cuLibraryGetKernelCount + data["__cuLibraryGetKernelCount"] = <_cyb_intptr_t>__cuLibraryGetKernelCount + + global __cuLibraryEnumerateKernels + data["__cuLibraryEnumerateKernels"] = <_cyb_intptr_t>__cuLibraryEnumerateKernels + + global __cuLibraryGetModule + data["__cuLibraryGetModule"] = <_cyb_intptr_t>__cuLibraryGetModule + + global __cuKernelGetFunction + data["__cuKernelGetFunction"] = <_cyb_intptr_t>__cuKernelGetFunction + + global __cuKernelGetLibrary + data["__cuKernelGetLibrary"] = <_cyb_intptr_t>__cuKernelGetLibrary + + global __cuLibraryGetGlobal + data["__cuLibraryGetGlobal"] = <_cyb_intptr_t>__cuLibraryGetGlobal + + global __cuLibraryGetManaged + data["__cuLibraryGetManaged"] = <_cyb_intptr_t>__cuLibraryGetManaged + + global __cuLibraryGetUnifiedFunction + data["__cuLibraryGetUnifiedFunction"] = <_cyb_intptr_t>__cuLibraryGetUnifiedFunction + + global __cuKernelGetAttribute + data["__cuKernelGetAttribute"] = <_cyb_intptr_t>__cuKernelGetAttribute + + global __cuKernelSetAttribute + data["__cuKernelSetAttribute"] = <_cyb_intptr_t>__cuKernelSetAttribute + + global __cuKernelSetCacheConfig + data["__cuKernelSetCacheConfig"] = <_cyb_intptr_t>__cuKernelSetCacheConfig + + global __cuKernelGetName + data["__cuKernelGetName"] = <_cyb_intptr_t>__cuKernelGetName + + global __cuKernelGetParamInfo + data["__cuKernelGetParamInfo"] = <_cyb_intptr_t>__cuKernelGetParamInfo + + global __cuMemGetInfo_v2 + data["__cuMemGetInfo_v2"] = <_cyb_intptr_t>__cuMemGetInfo_v2 + + global __cuMemAlloc_v2 + data["__cuMemAlloc_v2"] = <_cyb_intptr_t>__cuMemAlloc_v2 + + global __cuMemAllocPitch_v2 + data["__cuMemAllocPitch_v2"] = <_cyb_intptr_t>__cuMemAllocPitch_v2 + + global __cuMemFree_v2 + data["__cuMemFree_v2"] = <_cyb_intptr_t>__cuMemFree_v2 + + global __cuMemGetAddressRange_v2 + data["__cuMemGetAddressRange_v2"] = <_cyb_intptr_t>__cuMemGetAddressRange_v2 + + global __cuMemAllocHost_v2 + data["__cuMemAllocHost_v2"] = <_cyb_intptr_t>__cuMemAllocHost_v2 + + global __cuMemFreeHost + data["__cuMemFreeHost"] = <_cyb_intptr_t>__cuMemFreeHost + + global __cuMemHostAlloc + data["__cuMemHostAlloc"] = <_cyb_intptr_t>__cuMemHostAlloc + + global __cuMemHostGetDevicePointer_v2 + data["__cuMemHostGetDevicePointer_v2"] = <_cyb_intptr_t>__cuMemHostGetDevicePointer_v2 + + global __cuMemHostGetFlags + data["__cuMemHostGetFlags"] = <_cyb_intptr_t>__cuMemHostGetFlags + + global __cuMemAllocManaged + data["__cuMemAllocManaged"] = <_cyb_intptr_t>__cuMemAllocManaged + + global __cuDeviceRegisterAsyncNotification + data["__cuDeviceRegisterAsyncNotification"] = <_cyb_intptr_t>__cuDeviceRegisterAsyncNotification + + global __cuDeviceUnregisterAsyncNotification + data["__cuDeviceUnregisterAsyncNotification"] = <_cyb_intptr_t>__cuDeviceUnregisterAsyncNotification + + global __cuDeviceGetByPCIBusId + data["__cuDeviceGetByPCIBusId"] = <_cyb_intptr_t>__cuDeviceGetByPCIBusId + + global __cuDeviceGetPCIBusId + data["__cuDeviceGetPCIBusId"] = <_cyb_intptr_t>__cuDeviceGetPCIBusId + + global __cuIpcGetEventHandle + data["__cuIpcGetEventHandle"] = <_cyb_intptr_t>__cuIpcGetEventHandle + + global __cuIpcOpenEventHandle + data["__cuIpcOpenEventHandle"] = <_cyb_intptr_t>__cuIpcOpenEventHandle + + global __cuIpcGetMemHandle + data["__cuIpcGetMemHandle"] = <_cyb_intptr_t>__cuIpcGetMemHandle + + global __cuIpcOpenMemHandle_v2 + data["__cuIpcOpenMemHandle_v2"] = <_cyb_intptr_t>__cuIpcOpenMemHandle_v2 + + global __cuIpcCloseMemHandle + data["__cuIpcCloseMemHandle"] = <_cyb_intptr_t>__cuIpcCloseMemHandle + + global __cuMemHostRegister_v2 + data["__cuMemHostRegister_v2"] = <_cyb_intptr_t>__cuMemHostRegister_v2 + + global __cuMemHostUnregister + data["__cuMemHostUnregister"] = <_cyb_intptr_t>__cuMemHostUnregister + + global __cuMemcpy + data["__cuMemcpy"] = <_cyb_intptr_t>__cuMemcpy + + global __cuMemcpyPeer + data["__cuMemcpyPeer"] = <_cyb_intptr_t>__cuMemcpyPeer + + global __cuMemcpyHtoD_v2 + data["__cuMemcpyHtoD_v2"] = <_cyb_intptr_t>__cuMemcpyHtoD_v2 + + global __cuMemcpyDtoH_v2 + data["__cuMemcpyDtoH_v2"] = <_cyb_intptr_t>__cuMemcpyDtoH_v2 + + global __cuMemcpyDtoD_v2 + data["__cuMemcpyDtoD_v2"] = <_cyb_intptr_t>__cuMemcpyDtoD_v2 + + global __cuMemcpyDtoA_v2 + data["__cuMemcpyDtoA_v2"] = <_cyb_intptr_t>__cuMemcpyDtoA_v2 + + global __cuMemcpyAtoD_v2 + data["__cuMemcpyAtoD_v2"] = <_cyb_intptr_t>__cuMemcpyAtoD_v2 + + global __cuMemcpyHtoA_v2 + data["__cuMemcpyHtoA_v2"] = <_cyb_intptr_t>__cuMemcpyHtoA_v2 + + global __cuMemcpyAtoH_v2 + data["__cuMemcpyAtoH_v2"] = <_cyb_intptr_t>__cuMemcpyAtoH_v2 + + global __cuMemcpyAtoA_v2 + data["__cuMemcpyAtoA_v2"] = <_cyb_intptr_t>__cuMemcpyAtoA_v2 + + global __cuMemcpy2D_v2 + data["__cuMemcpy2D_v2"] = <_cyb_intptr_t>__cuMemcpy2D_v2 + + global __cuMemcpy2DUnaligned_v2 + data["__cuMemcpy2DUnaligned_v2"] = <_cyb_intptr_t>__cuMemcpy2DUnaligned_v2 + + global __cuMemcpy3D_v2 + data["__cuMemcpy3D_v2"] = <_cyb_intptr_t>__cuMemcpy3D_v2 + + global __cuMemcpy3DPeer + data["__cuMemcpy3DPeer"] = <_cyb_intptr_t>__cuMemcpy3DPeer + + global __cuMemcpyAsync + data["__cuMemcpyAsync"] = <_cyb_intptr_t>__cuMemcpyAsync + + global __cuMemcpyPeerAsync + data["__cuMemcpyPeerAsync"] = <_cyb_intptr_t>__cuMemcpyPeerAsync + + global __cuMemcpyHtoDAsync_v2 + data["__cuMemcpyHtoDAsync_v2"] = <_cyb_intptr_t>__cuMemcpyHtoDAsync_v2 + + global __cuMemcpyDtoHAsync_v2 + data["__cuMemcpyDtoHAsync_v2"] = <_cyb_intptr_t>__cuMemcpyDtoHAsync_v2 + + global __cuMemcpyDtoDAsync_v2 + data["__cuMemcpyDtoDAsync_v2"] = <_cyb_intptr_t>__cuMemcpyDtoDAsync_v2 + + global __cuMemcpyHtoAAsync_v2 + data["__cuMemcpyHtoAAsync_v2"] = <_cyb_intptr_t>__cuMemcpyHtoAAsync_v2 + + global __cuMemcpyAtoHAsync_v2 + data["__cuMemcpyAtoHAsync_v2"] = <_cyb_intptr_t>__cuMemcpyAtoHAsync_v2 + + global __cuMemcpy2DAsync_v2 + data["__cuMemcpy2DAsync_v2"] = <_cyb_intptr_t>__cuMemcpy2DAsync_v2 + + global __cuMemcpy3DAsync_v2 + data["__cuMemcpy3DAsync_v2"] = <_cyb_intptr_t>__cuMemcpy3DAsync_v2 + + global __cuMemcpy3DPeerAsync + data["__cuMemcpy3DPeerAsync"] = <_cyb_intptr_t>__cuMemcpy3DPeerAsync + + global __cuMemsetD8_v2 + data["__cuMemsetD8_v2"] = <_cyb_intptr_t>__cuMemsetD8_v2 + + global __cuMemsetD16_v2 + data["__cuMemsetD16_v2"] = <_cyb_intptr_t>__cuMemsetD16_v2 + + global __cuMemsetD32_v2 + data["__cuMemsetD32_v2"] = <_cyb_intptr_t>__cuMemsetD32_v2 + + global __cuMemsetD2D8_v2 + data["__cuMemsetD2D8_v2"] = <_cyb_intptr_t>__cuMemsetD2D8_v2 + + global __cuMemsetD2D16_v2 + data["__cuMemsetD2D16_v2"] = <_cyb_intptr_t>__cuMemsetD2D16_v2 + + global __cuMemsetD2D32_v2 + data["__cuMemsetD2D32_v2"] = <_cyb_intptr_t>__cuMemsetD2D32_v2 + + global __cuMemsetD8Async + data["__cuMemsetD8Async"] = <_cyb_intptr_t>__cuMemsetD8Async + + global __cuMemsetD16Async + data["__cuMemsetD16Async"] = <_cyb_intptr_t>__cuMemsetD16Async + + global __cuMemsetD32Async + data["__cuMemsetD32Async"] = <_cyb_intptr_t>__cuMemsetD32Async + + global __cuMemsetD2D8Async + data["__cuMemsetD2D8Async"] = <_cyb_intptr_t>__cuMemsetD2D8Async + + global __cuMemsetD2D16Async + data["__cuMemsetD2D16Async"] = <_cyb_intptr_t>__cuMemsetD2D16Async + + global __cuMemsetD2D32Async + data["__cuMemsetD2D32Async"] = <_cyb_intptr_t>__cuMemsetD2D32Async + + global __cuArrayCreate_v2 + data["__cuArrayCreate_v2"] = <_cyb_intptr_t>__cuArrayCreate_v2 + + global __cuArrayGetDescriptor_v2 + data["__cuArrayGetDescriptor_v2"] = <_cyb_intptr_t>__cuArrayGetDescriptor_v2 + + global __cuArrayGetSparseProperties + data["__cuArrayGetSparseProperties"] = <_cyb_intptr_t>__cuArrayGetSparseProperties + + global __cuMipmappedArrayGetSparseProperties + data["__cuMipmappedArrayGetSparseProperties"] = <_cyb_intptr_t>__cuMipmappedArrayGetSparseProperties + + global __cuArrayGetMemoryRequirements + data["__cuArrayGetMemoryRequirements"] = <_cyb_intptr_t>__cuArrayGetMemoryRequirements + + global __cuMipmappedArrayGetMemoryRequirements + data["__cuMipmappedArrayGetMemoryRequirements"] = <_cyb_intptr_t>__cuMipmappedArrayGetMemoryRequirements + + global __cuArrayGetPlane + data["__cuArrayGetPlane"] = <_cyb_intptr_t>__cuArrayGetPlane + + global __cuArrayDestroy + data["__cuArrayDestroy"] = <_cyb_intptr_t>__cuArrayDestroy + + global __cuArray3DCreate_v2 + data["__cuArray3DCreate_v2"] = <_cyb_intptr_t>__cuArray3DCreate_v2 + + global __cuArray3DGetDescriptor_v2 + data["__cuArray3DGetDescriptor_v2"] = <_cyb_intptr_t>__cuArray3DGetDescriptor_v2 + + global __cuMipmappedArrayCreate + data["__cuMipmappedArrayCreate"] = <_cyb_intptr_t>__cuMipmappedArrayCreate + + global __cuMipmappedArrayGetLevel + data["__cuMipmappedArrayGetLevel"] = <_cyb_intptr_t>__cuMipmappedArrayGetLevel + + global __cuMipmappedArrayDestroy + data["__cuMipmappedArrayDestroy"] = <_cyb_intptr_t>__cuMipmappedArrayDestroy + + global __cuMemGetHandleForAddressRange + data["__cuMemGetHandleForAddressRange"] = <_cyb_intptr_t>__cuMemGetHandleForAddressRange + + global __cuMemBatchDecompressAsync + data["__cuMemBatchDecompressAsync"] = <_cyb_intptr_t>__cuMemBatchDecompressAsync + + global __cuMemAddressReserve + data["__cuMemAddressReserve"] = <_cyb_intptr_t>__cuMemAddressReserve + + global __cuMemAddressFree + data["__cuMemAddressFree"] = <_cyb_intptr_t>__cuMemAddressFree + + global __cuMemCreate + data["__cuMemCreate"] = <_cyb_intptr_t>__cuMemCreate + + global __cuMemRelease + data["__cuMemRelease"] = <_cyb_intptr_t>__cuMemRelease + + global __cuMemMap + data["__cuMemMap"] = <_cyb_intptr_t>__cuMemMap + + global __cuMemMapArrayAsync + data["__cuMemMapArrayAsync"] = <_cyb_intptr_t>__cuMemMapArrayAsync + + global __cuMemUnmap + data["__cuMemUnmap"] = <_cyb_intptr_t>__cuMemUnmap + + global __cuMemSetAccess + data["__cuMemSetAccess"] = <_cyb_intptr_t>__cuMemSetAccess + + global __cuMemGetAccess + data["__cuMemGetAccess"] = <_cyb_intptr_t>__cuMemGetAccess + + global __cuMemExportToShareableHandle + data["__cuMemExportToShareableHandle"] = <_cyb_intptr_t>__cuMemExportToShareableHandle + + global __cuMemImportFromShareableHandle + data["__cuMemImportFromShareableHandle"] = <_cyb_intptr_t>__cuMemImportFromShareableHandle + + global __cuMemGetAllocationGranularity + data["__cuMemGetAllocationGranularity"] = <_cyb_intptr_t>__cuMemGetAllocationGranularity + + global __cuMemGetAllocationPropertiesFromHandle + data["__cuMemGetAllocationPropertiesFromHandle"] = <_cyb_intptr_t>__cuMemGetAllocationPropertiesFromHandle + + global __cuMemRetainAllocationHandle + data["__cuMemRetainAllocationHandle"] = <_cyb_intptr_t>__cuMemRetainAllocationHandle + + global __cuMemFreeAsync + data["__cuMemFreeAsync"] = <_cyb_intptr_t>__cuMemFreeAsync + + global __cuMemAllocAsync + data["__cuMemAllocAsync"] = <_cyb_intptr_t>__cuMemAllocAsync + + global __cuMemPoolTrimTo + data["__cuMemPoolTrimTo"] = <_cyb_intptr_t>__cuMemPoolTrimTo + + global __cuMemPoolSetAttribute + data["__cuMemPoolSetAttribute"] = <_cyb_intptr_t>__cuMemPoolSetAttribute + + global __cuMemPoolGetAttribute + data["__cuMemPoolGetAttribute"] = <_cyb_intptr_t>__cuMemPoolGetAttribute + + global __cuMemPoolSetAccess + data["__cuMemPoolSetAccess"] = <_cyb_intptr_t>__cuMemPoolSetAccess + + global __cuMemPoolGetAccess + data["__cuMemPoolGetAccess"] = <_cyb_intptr_t>__cuMemPoolGetAccess + + global __cuMemPoolCreate + data["__cuMemPoolCreate"] = <_cyb_intptr_t>__cuMemPoolCreate + + global __cuMemPoolDestroy + data["__cuMemPoolDestroy"] = <_cyb_intptr_t>__cuMemPoolDestroy + + global __cuMemAllocFromPoolAsync + data["__cuMemAllocFromPoolAsync"] = <_cyb_intptr_t>__cuMemAllocFromPoolAsync + + global __cuMemPoolExportToShareableHandle + data["__cuMemPoolExportToShareableHandle"] = <_cyb_intptr_t>__cuMemPoolExportToShareableHandle + + global __cuMemPoolImportFromShareableHandle + data["__cuMemPoolImportFromShareableHandle"] = <_cyb_intptr_t>__cuMemPoolImportFromShareableHandle + + global __cuMemPoolExportPointer + data["__cuMemPoolExportPointer"] = <_cyb_intptr_t>__cuMemPoolExportPointer + + global __cuMemPoolImportPointer + data["__cuMemPoolImportPointer"] = <_cyb_intptr_t>__cuMemPoolImportPointer + + global __cuMulticastCreate + data["__cuMulticastCreate"] = <_cyb_intptr_t>__cuMulticastCreate + + global __cuMulticastAddDevice + data["__cuMulticastAddDevice"] = <_cyb_intptr_t>__cuMulticastAddDevice + + global __cuMulticastBindMem + data["__cuMulticastBindMem"] = <_cyb_intptr_t>__cuMulticastBindMem + + global __cuMulticastBindAddr + data["__cuMulticastBindAddr"] = <_cyb_intptr_t>__cuMulticastBindAddr + + global __cuMulticastUnbind + data["__cuMulticastUnbind"] = <_cyb_intptr_t>__cuMulticastUnbind + + global __cuMulticastGetGranularity + data["__cuMulticastGetGranularity"] = <_cyb_intptr_t>__cuMulticastGetGranularity + + global __cuPointerGetAttribute + data["__cuPointerGetAttribute"] = <_cyb_intptr_t>__cuPointerGetAttribute + + global __cuMemPrefetchAsync_v2 + data["__cuMemPrefetchAsync_v2"] = <_cyb_intptr_t>__cuMemPrefetchAsync_v2 + + global __cuMemAdvise_v2 + data["__cuMemAdvise_v2"] = <_cyb_intptr_t>__cuMemAdvise_v2 + + global __cuMemRangeGetAttribute + data["__cuMemRangeGetAttribute"] = <_cyb_intptr_t>__cuMemRangeGetAttribute + + global __cuMemRangeGetAttributes + data["__cuMemRangeGetAttributes"] = <_cyb_intptr_t>__cuMemRangeGetAttributes + + global __cuPointerSetAttribute + data["__cuPointerSetAttribute"] = <_cyb_intptr_t>__cuPointerSetAttribute + + global __cuPointerGetAttributes + data["__cuPointerGetAttributes"] = <_cyb_intptr_t>__cuPointerGetAttributes + + global __cuStreamCreate + data["__cuStreamCreate"] = <_cyb_intptr_t>__cuStreamCreate + + global __cuStreamCreateWithPriority + data["__cuStreamCreateWithPriority"] = <_cyb_intptr_t>__cuStreamCreateWithPriority + + global __cuStreamGetPriority + data["__cuStreamGetPriority"] = <_cyb_intptr_t>__cuStreamGetPriority + + global __cuStreamGetDevice + data["__cuStreamGetDevice"] = <_cyb_intptr_t>__cuStreamGetDevice + + global __cuStreamGetFlags + data["__cuStreamGetFlags"] = <_cyb_intptr_t>__cuStreamGetFlags + + global __cuStreamGetId + data["__cuStreamGetId"] = <_cyb_intptr_t>__cuStreamGetId + + global __cuStreamGetCtx + data["__cuStreamGetCtx"] = <_cyb_intptr_t>__cuStreamGetCtx + + global __cuStreamGetCtx_v2 + data["__cuStreamGetCtx_v2"] = <_cyb_intptr_t>__cuStreamGetCtx_v2 + + global __cuStreamWaitEvent + data["__cuStreamWaitEvent"] = <_cyb_intptr_t>__cuStreamWaitEvent + + global __cuStreamAddCallback + data["__cuStreamAddCallback"] = <_cyb_intptr_t>__cuStreamAddCallback + + global __cuStreamBeginCapture_v2 + data["__cuStreamBeginCapture_v2"] = <_cyb_intptr_t>__cuStreamBeginCapture_v2 + + global __cuStreamBeginCaptureToGraph + data["__cuStreamBeginCaptureToGraph"] = <_cyb_intptr_t>__cuStreamBeginCaptureToGraph + + global __cuThreadExchangeStreamCaptureMode + data["__cuThreadExchangeStreamCaptureMode"] = <_cyb_intptr_t>__cuThreadExchangeStreamCaptureMode + + global __cuStreamEndCapture + data["__cuStreamEndCapture"] = <_cyb_intptr_t>__cuStreamEndCapture + + global __cuStreamIsCapturing + data["__cuStreamIsCapturing"] = <_cyb_intptr_t>__cuStreamIsCapturing + + global __cuStreamGetCaptureInfo_v2 + data["__cuStreamGetCaptureInfo_v2"] = <_cyb_intptr_t>__cuStreamGetCaptureInfo_v2 + + global __cuStreamGetCaptureInfo_v3 + data["__cuStreamGetCaptureInfo_v3"] = <_cyb_intptr_t>__cuStreamGetCaptureInfo_v3 + + global __cuStreamUpdateCaptureDependencies_v2 + data["__cuStreamUpdateCaptureDependencies_v2"] = <_cyb_intptr_t>__cuStreamUpdateCaptureDependencies_v2 + + global __cuStreamAttachMemAsync + data["__cuStreamAttachMemAsync"] = <_cyb_intptr_t>__cuStreamAttachMemAsync + + global __cuStreamQuery + data["__cuStreamQuery"] = <_cyb_intptr_t>__cuStreamQuery + + global __cuStreamSynchronize + data["__cuStreamSynchronize"] = <_cyb_intptr_t>__cuStreamSynchronize + + global __cuStreamDestroy_v2 + data["__cuStreamDestroy_v2"] = <_cyb_intptr_t>__cuStreamDestroy_v2 + + global __cuStreamCopyAttributes + data["__cuStreamCopyAttributes"] = <_cyb_intptr_t>__cuStreamCopyAttributes + + global __cuStreamGetAttribute + data["__cuStreamGetAttribute"] = <_cyb_intptr_t>__cuStreamGetAttribute + + global __cuStreamSetAttribute + data["__cuStreamSetAttribute"] = <_cyb_intptr_t>__cuStreamSetAttribute + + global __cuEventCreate + data["__cuEventCreate"] = <_cyb_intptr_t>__cuEventCreate + + global __cuEventRecord + data["__cuEventRecord"] = <_cyb_intptr_t>__cuEventRecord + + global __cuEventRecordWithFlags + data["__cuEventRecordWithFlags"] = <_cyb_intptr_t>__cuEventRecordWithFlags + + global __cuEventQuery + data["__cuEventQuery"] = <_cyb_intptr_t>__cuEventQuery + + global __cuEventSynchronize + data["__cuEventSynchronize"] = <_cyb_intptr_t>__cuEventSynchronize + + global __cuEventDestroy_v2 + data["__cuEventDestroy_v2"] = <_cyb_intptr_t>__cuEventDestroy_v2 + + global __cuEventElapsedTime_v2 + data["__cuEventElapsedTime_v2"] = <_cyb_intptr_t>__cuEventElapsedTime_v2 + + global __cuImportExternalMemory + data["__cuImportExternalMemory"] = <_cyb_intptr_t>__cuImportExternalMemory + + global __cuExternalMemoryGetMappedBuffer + data["__cuExternalMemoryGetMappedBuffer"] = <_cyb_intptr_t>__cuExternalMemoryGetMappedBuffer + + global __cuExternalMemoryGetMappedMipmappedArray + data["__cuExternalMemoryGetMappedMipmappedArray"] = <_cyb_intptr_t>__cuExternalMemoryGetMappedMipmappedArray + + global __cuDestroyExternalMemory + data["__cuDestroyExternalMemory"] = <_cyb_intptr_t>__cuDestroyExternalMemory + + global __cuImportExternalSemaphore + data["__cuImportExternalSemaphore"] = <_cyb_intptr_t>__cuImportExternalSemaphore + + global __cuSignalExternalSemaphoresAsync + data["__cuSignalExternalSemaphoresAsync"] = <_cyb_intptr_t>__cuSignalExternalSemaphoresAsync + + global __cuWaitExternalSemaphoresAsync + data["__cuWaitExternalSemaphoresAsync"] = <_cyb_intptr_t>__cuWaitExternalSemaphoresAsync + + global __cuDestroyExternalSemaphore + data["__cuDestroyExternalSemaphore"] = <_cyb_intptr_t>__cuDestroyExternalSemaphore + + global __cuStreamWaitValue32_v2 + data["__cuStreamWaitValue32_v2"] = <_cyb_intptr_t>__cuStreamWaitValue32_v2 + + global __cuStreamWaitValue64_v2 + data["__cuStreamWaitValue64_v2"] = <_cyb_intptr_t>__cuStreamWaitValue64_v2 + + global __cuStreamWriteValue32_v2 + data["__cuStreamWriteValue32_v2"] = <_cyb_intptr_t>__cuStreamWriteValue32_v2 + + global __cuStreamWriteValue64_v2 + data["__cuStreamWriteValue64_v2"] = <_cyb_intptr_t>__cuStreamWriteValue64_v2 + + global __cuStreamBatchMemOp_v2 + data["__cuStreamBatchMemOp_v2"] = <_cyb_intptr_t>__cuStreamBatchMemOp_v2 + + global __cuFuncGetAttribute + data["__cuFuncGetAttribute"] = <_cyb_intptr_t>__cuFuncGetAttribute + + global __cuFuncSetAttribute + data["__cuFuncSetAttribute"] = <_cyb_intptr_t>__cuFuncSetAttribute + + global __cuFuncSetCacheConfig + data["__cuFuncSetCacheConfig"] = <_cyb_intptr_t>__cuFuncSetCacheConfig + + global __cuFuncGetModule + data["__cuFuncGetModule"] = <_cyb_intptr_t>__cuFuncGetModule + + global __cuFuncGetName + data["__cuFuncGetName"] = <_cyb_intptr_t>__cuFuncGetName + + global __cuFuncGetParamInfo + data["__cuFuncGetParamInfo"] = <_cyb_intptr_t>__cuFuncGetParamInfo + + global __cuFuncIsLoaded + data["__cuFuncIsLoaded"] = <_cyb_intptr_t>__cuFuncIsLoaded + + global __cuFuncLoad + data["__cuFuncLoad"] = <_cyb_intptr_t>__cuFuncLoad + + global __cuLaunchKernel + data["__cuLaunchKernel"] = <_cyb_intptr_t>__cuLaunchKernel + + global __cuLaunchKernelEx + data["__cuLaunchKernelEx"] = <_cyb_intptr_t>__cuLaunchKernelEx + + global __cuLaunchCooperativeKernel + data["__cuLaunchCooperativeKernel"] = <_cyb_intptr_t>__cuLaunchCooperativeKernel + + global __cuLaunchCooperativeKernelMultiDevice + data["__cuLaunchCooperativeKernelMultiDevice"] = <_cyb_intptr_t>__cuLaunchCooperativeKernelMultiDevice + + global __cuLaunchHostFunc + data["__cuLaunchHostFunc"] = <_cyb_intptr_t>__cuLaunchHostFunc + + global __cuFuncSetBlockShape + data["__cuFuncSetBlockShape"] = <_cyb_intptr_t>__cuFuncSetBlockShape + + global __cuFuncSetSharedSize + data["__cuFuncSetSharedSize"] = <_cyb_intptr_t>__cuFuncSetSharedSize + + global __cuParamSetSize + data["__cuParamSetSize"] = <_cyb_intptr_t>__cuParamSetSize + + global __cuParamSeti + data["__cuParamSeti"] = <_cyb_intptr_t>__cuParamSeti + + global __cuParamSetf + data["__cuParamSetf"] = <_cyb_intptr_t>__cuParamSetf + + global __cuParamSetv + data["__cuParamSetv"] = <_cyb_intptr_t>__cuParamSetv + + global __cuLaunch + data["__cuLaunch"] = <_cyb_intptr_t>__cuLaunch + + global __cuLaunchGrid + data["__cuLaunchGrid"] = <_cyb_intptr_t>__cuLaunchGrid + + global __cuLaunchGridAsync + data["__cuLaunchGridAsync"] = <_cyb_intptr_t>__cuLaunchGridAsync + + global __cuParamSetTexRef + data["__cuParamSetTexRef"] = <_cyb_intptr_t>__cuParamSetTexRef + + global __cuFuncSetSharedMemConfig + data["__cuFuncSetSharedMemConfig"] = <_cyb_intptr_t>__cuFuncSetSharedMemConfig + + global __cuGraphCreate + data["__cuGraphCreate"] = <_cyb_intptr_t>__cuGraphCreate + + global __cuGraphAddKernelNode_v2 + data["__cuGraphAddKernelNode_v2"] = <_cyb_intptr_t>__cuGraphAddKernelNode_v2 + + global __cuGraphKernelNodeGetParams_v2 + data["__cuGraphKernelNodeGetParams_v2"] = <_cyb_intptr_t>__cuGraphKernelNodeGetParams_v2 + + global __cuGraphKernelNodeSetParams_v2 + data["__cuGraphKernelNodeSetParams_v2"] = <_cyb_intptr_t>__cuGraphKernelNodeSetParams_v2 + + global __cuGraphAddMemcpyNode + data["__cuGraphAddMemcpyNode"] = <_cyb_intptr_t>__cuGraphAddMemcpyNode + + global __cuGraphMemcpyNodeGetParams + data["__cuGraphMemcpyNodeGetParams"] = <_cyb_intptr_t>__cuGraphMemcpyNodeGetParams + + global __cuGraphMemcpyNodeSetParams + data["__cuGraphMemcpyNodeSetParams"] = <_cyb_intptr_t>__cuGraphMemcpyNodeSetParams + + global __cuGraphAddMemsetNode + data["__cuGraphAddMemsetNode"] = <_cyb_intptr_t>__cuGraphAddMemsetNode + + global __cuGraphMemsetNodeGetParams + data["__cuGraphMemsetNodeGetParams"] = <_cyb_intptr_t>__cuGraphMemsetNodeGetParams + + global __cuGraphMemsetNodeSetParams + data["__cuGraphMemsetNodeSetParams"] = <_cyb_intptr_t>__cuGraphMemsetNodeSetParams + + global __cuGraphAddHostNode + data["__cuGraphAddHostNode"] = <_cyb_intptr_t>__cuGraphAddHostNode + + global __cuGraphHostNodeGetParams + data["__cuGraphHostNodeGetParams"] = <_cyb_intptr_t>__cuGraphHostNodeGetParams + + global __cuGraphHostNodeSetParams + data["__cuGraphHostNodeSetParams"] = <_cyb_intptr_t>__cuGraphHostNodeSetParams + + global __cuGraphAddChildGraphNode + data["__cuGraphAddChildGraphNode"] = <_cyb_intptr_t>__cuGraphAddChildGraphNode + + global __cuGraphChildGraphNodeGetGraph + data["__cuGraphChildGraphNodeGetGraph"] = <_cyb_intptr_t>__cuGraphChildGraphNodeGetGraph + + global __cuGraphAddEmptyNode + data["__cuGraphAddEmptyNode"] = <_cyb_intptr_t>__cuGraphAddEmptyNode + + global __cuGraphAddEventRecordNode + data["__cuGraphAddEventRecordNode"] = <_cyb_intptr_t>__cuGraphAddEventRecordNode + + global __cuGraphEventRecordNodeGetEvent + data["__cuGraphEventRecordNodeGetEvent"] = <_cyb_intptr_t>__cuGraphEventRecordNodeGetEvent + + global __cuGraphEventRecordNodeSetEvent + data["__cuGraphEventRecordNodeSetEvent"] = <_cyb_intptr_t>__cuGraphEventRecordNodeSetEvent + + global __cuGraphAddEventWaitNode + data["__cuGraphAddEventWaitNode"] = <_cyb_intptr_t>__cuGraphAddEventWaitNode + + global __cuGraphEventWaitNodeGetEvent + data["__cuGraphEventWaitNodeGetEvent"] = <_cyb_intptr_t>__cuGraphEventWaitNodeGetEvent + + global __cuGraphEventWaitNodeSetEvent + data["__cuGraphEventWaitNodeSetEvent"] = <_cyb_intptr_t>__cuGraphEventWaitNodeSetEvent + + global __cuGraphAddExternalSemaphoresSignalNode + data["__cuGraphAddExternalSemaphoresSignalNode"] = <_cyb_intptr_t>__cuGraphAddExternalSemaphoresSignalNode + + global __cuGraphExternalSemaphoresSignalNodeGetParams + data["__cuGraphExternalSemaphoresSignalNodeGetParams"] = <_cyb_intptr_t>__cuGraphExternalSemaphoresSignalNodeGetParams + + global __cuGraphExternalSemaphoresSignalNodeSetParams + data["__cuGraphExternalSemaphoresSignalNodeSetParams"] = <_cyb_intptr_t>__cuGraphExternalSemaphoresSignalNodeSetParams + + global __cuGraphAddExternalSemaphoresWaitNode + data["__cuGraphAddExternalSemaphoresWaitNode"] = <_cyb_intptr_t>__cuGraphAddExternalSemaphoresWaitNode + + global __cuGraphExternalSemaphoresWaitNodeGetParams + data["__cuGraphExternalSemaphoresWaitNodeGetParams"] = <_cyb_intptr_t>__cuGraphExternalSemaphoresWaitNodeGetParams + + global __cuGraphExternalSemaphoresWaitNodeSetParams + data["__cuGraphExternalSemaphoresWaitNodeSetParams"] = <_cyb_intptr_t>__cuGraphExternalSemaphoresWaitNodeSetParams + + global __cuGraphAddBatchMemOpNode + data["__cuGraphAddBatchMemOpNode"] = <_cyb_intptr_t>__cuGraphAddBatchMemOpNode + + global __cuGraphBatchMemOpNodeGetParams + data["__cuGraphBatchMemOpNodeGetParams"] = <_cyb_intptr_t>__cuGraphBatchMemOpNodeGetParams + + global __cuGraphBatchMemOpNodeSetParams + data["__cuGraphBatchMemOpNodeSetParams"] = <_cyb_intptr_t>__cuGraphBatchMemOpNodeSetParams + + global __cuGraphExecBatchMemOpNodeSetParams + data["__cuGraphExecBatchMemOpNodeSetParams"] = <_cyb_intptr_t>__cuGraphExecBatchMemOpNodeSetParams + + global __cuGraphAddMemAllocNode + data["__cuGraphAddMemAllocNode"] = <_cyb_intptr_t>__cuGraphAddMemAllocNode + + global __cuGraphMemAllocNodeGetParams + data["__cuGraphMemAllocNodeGetParams"] = <_cyb_intptr_t>__cuGraphMemAllocNodeGetParams + + global __cuGraphAddMemFreeNode + data["__cuGraphAddMemFreeNode"] = <_cyb_intptr_t>__cuGraphAddMemFreeNode + + global __cuGraphMemFreeNodeGetParams + data["__cuGraphMemFreeNodeGetParams"] = <_cyb_intptr_t>__cuGraphMemFreeNodeGetParams + + global __cuDeviceGraphMemTrim + data["__cuDeviceGraphMemTrim"] = <_cyb_intptr_t>__cuDeviceGraphMemTrim + + global __cuDeviceGetGraphMemAttribute + data["__cuDeviceGetGraphMemAttribute"] = <_cyb_intptr_t>__cuDeviceGetGraphMemAttribute + + global __cuDeviceSetGraphMemAttribute + data["__cuDeviceSetGraphMemAttribute"] = <_cyb_intptr_t>__cuDeviceSetGraphMemAttribute + + global __cuGraphClone + data["__cuGraphClone"] = <_cyb_intptr_t>__cuGraphClone + + global __cuGraphNodeFindInClone + data["__cuGraphNodeFindInClone"] = <_cyb_intptr_t>__cuGraphNodeFindInClone + + global __cuGraphNodeGetType + data["__cuGraphNodeGetType"] = <_cyb_intptr_t>__cuGraphNodeGetType + + global __cuGraphGetNodes + data["__cuGraphGetNodes"] = <_cyb_intptr_t>__cuGraphGetNodes + + global __cuGraphGetRootNodes + data["__cuGraphGetRootNodes"] = <_cyb_intptr_t>__cuGraphGetRootNodes + + global __cuGraphGetEdges_v2 + data["__cuGraphGetEdges_v2"] = <_cyb_intptr_t>__cuGraphGetEdges_v2 + + global __cuGraphNodeGetDependencies_v2 + data["__cuGraphNodeGetDependencies_v2"] = <_cyb_intptr_t>__cuGraphNodeGetDependencies_v2 + + global __cuGraphNodeGetDependentNodes_v2 + data["__cuGraphNodeGetDependentNodes_v2"] = <_cyb_intptr_t>__cuGraphNodeGetDependentNodes_v2 + + global __cuGraphAddDependencies_v2 + data["__cuGraphAddDependencies_v2"] = <_cyb_intptr_t>__cuGraphAddDependencies_v2 + + global __cuGraphRemoveDependencies_v2 + data["__cuGraphRemoveDependencies_v2"] = <_cyb_intptr_t>__cuGraphRemoveDependencies_v2 + + global __cuGraphDestroyNode + data["__cuGraphDestroyNode"] = <_cyb_intptr_t>__cuGraphDestroyNode + + global __cuGraphInstantiateWithFlags + data["__cuGraphInstantiateWithFlags"] = <_cyb_intptr_t>__cuGraphInstantiateWithFlags + + global __cuGraphInstantiateWithParams + data["__cuGraphInstantiateWithParams"] = <_cyb_intptr_t>__cuGraphInstantiateWithParams + + global __cuGraphExecGetFlags + data["__cuGraphExecGetFlags"] = <_cyb_intptr_t>__cuGraphExecGetFlags + + global __cuGraphExecKernelNodeSetParams_v2 + data["__cuGraphExecKernelNodeSetParams_v2"] = <_cyb_intptr_t>__cuGraphExecKernelNodeSetParams_v2 + + global __cuGraphExecMemcpyNodeSetParams + data["__cuGraphExecMemcpyNodeSetParams"] = <_cyb_intptr_t>__cuGraphExecMemcpyNodeSetParams + + global __cuGraphExecMemsetNodeSetParams + data["__cuGraphExecMemsetNodeSetParams"] = <_cyb_intptr_t>__cuGraphExecMemsetNodeSetParams + + global __cuGraphExecHostNodeSetParams + data["__cuGraphExecHostNodeSetParams"] = <_cyb_intptr_t>__cuGraphExecHostNodeSetParams + + global __cuGraphExecChildGraphNodeSetParams + data["__cuGraphExecChildGraphNodeSetParams"] = <_cyb_intptr_t>__cuGraphExecChildGraphNodeSetParams + + global __cuGraphExecEventRecordNodeSetEvent + data["__cuGraphExecEventRecordNodeSetEvent"] = <_cyb_intptr_t>__cuGraphExecEventRecordNodeSetEvent + + global __cuGraphExecEventWaitNodeSetEvent + data["__cuGraphExecEventWaitNodeSetEvent"] = <_cyb_intptr_t>__cuGraphExecEventWaitNodeSetEvent + + global __cuGraphExecExternalSemaphoresSignalNodeSetParams + data["__cuGraphExecExternalSemaphoresSignalNodeSetParams"] = <_cyb_intptr_t>__cuGraphExecExternalSemaphoresSignalNodeSetParams + + global __cuGraphExecExternalSemaphoresWaitNodeSetParams + data["__cuGraphExecExternalSemaphoresWaitNodeSetParams"] = <_cyb_intptr_t>__cuGraphExecExternalSemaphoresWaitNodeSetParams + + global __cuGraphNodeSetEnabled + data["__cuGraphNodeSetEnabled"] = <_cyb_intptr_t>__cuGraphNodeSetEnabled + + global __cuGraphNodeGetEnabled + data["__cuGraphNodeGetEnabled"] = <_cyb_intptr_t>__cuGraphNodeGetEnabled + + global __cuGraphUpload + data["__cuGraphUpload"] = <_cyb_intptr_t>__cuGraphUpload + + global __cuGraphLaunch + data["__cuGraphLaunch"] = <_cyb_intptr_t>__cuGraphLaunch + + global __cuGraphExecDestroy + data["__cuGraphExecDestroy"] = <_cyb_intptr_t>__cuGraphExecDestroy + + global __cuGraphDestroy + data["__cuGraphDestroy"] = <_cyb_intptr_t>__cuGraphDestroy + + global __cuGraphExecUpdate_v2 + data["__cuGraphExecUpdate_v2"] = <_cyb_intptr_t>__cuGraphExecUpdate_v2 + + global __cuGraphKernelNodeCopyAttributes + data["__cuGraphKernelNodeCopyAttributes"] = <_cyb_intptr_t>__cuGraphKernelNodeCopyAttributes + + global __cuGraphKernelNodeGetAttribute + data["__cuGraphKernelNodeGetAttribute"] = <_cyb_intptr_t>__cuGraphKernelNodeGetAttribute + + global __cuGraphKernelNodeSetAttribute + data["__cuGraphKernelNodeSetAttribute"] = <_cyb_intptr_t>__cuGraphKernelNodeSetAttribute + + global __cuGraphDebugDotPrint + data["__cuGraphDebugDotPrint"] = <_cyb_intptr_t>__cuGraphDebugDotPrint + + global __cuUserObjectCreate + data["__cuUserObjectCreate"] = <_cyb_intptr_t>__cuUserObjectCreate + + global __cuUserObjectRetain + data["__cuUserObjectRetain"] = <_cyb_intptr_t>__cuUserObjectRetain + + global __cuUserObjectRelease + data["__cuUserObjectRelease"] = <_cyb_intptr_t>__cuUserObjectRelease + + global __cuGraphRetainUserObject + data["__cuGraphRetainUserObject"] = <_cyb_intptr_t>__cuGraphRetainUserObject + + global __cuGraphReleaseUserObject + data["__cuGraphReleaseUserObject"] = <_cyb_intptr_t>__cuGraphReleaseUserObject + + global __cuGraphAddNode_v2 + data["__cuGraphAddNode_v2"] = <_cyb_intptr_t>__cuGraphAddNode_v2 + + global __cuGraphNodeSetParams + data["__cuGraphNodeSetParams"] = <_cyb_intptr_t>__cuGraphNodeSetParams + + global __cuGraphExecNodeSetParams + data["__cuGraphExecNodeSetParams"] = <_cyb_intptr_t>__cuGraphExecNodeSetParams + + global __cuGraphConditionalHandleCreate + data["__cuGraphConditionalHandleCreate"] = <_cyb_intptr_t>__cuGraphConditionalHandleCreate + + global __cuOccupancyMaxActiveBlocksPerMultiprocessor + data["__cuOccupancyMaxActiveBlocksPerMultiprocessor"] = <_cyb_intptr_t>__cuOccupancyMaxActiveBlocksPerMultiprocessor + + global __cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags + data["__cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags"] = <_cyb_intptr_t>__cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags + + global __cuOccupancyMaxPotentialBlockSize + data["__cuOccupancyMaxPotentialBlockSize"] = <_cyb_intptr_t>__cuOccupancyMaxPotentialBlockSize + + global __cuOccupancyMaxPotentialBlockSizeWithFlags + data["__cuOccupancyMaxPotentialBlockSizeWithFlags"] = <_cyb_intptr_t>__cuOccupancyMaxPotentialBlockSizeWithFlags + + global __cuOccupancyAvailableDynamicSMemPerBlock + data["__cuOccupancyAvailableDynamicSMemPerBlock"] = <_cyb_intptr_t>__cuOccupancyAvailableDynamicSMemPerBlock + + global __cuOccupancyMaxPotentialClusterSize + data["__cuOccupancyMaxPotentialClusterSize"] = <_cyb_intptr_t>__cuOccupancyMaxPotentialClusterSize + + global __cuOccupancyMaxActiveClusters + data["__cuOccupancyMaxActiveClusters"] = <_cyb_intptr_t>__cuOccupancyMaxActiveClusters + + global __cuTexRefSetArray + data["__cuTexRefSetArray"] = <_cyb_intptr_t>__cuTexRefSetArray + + global __cuTexRefSetMipmappedArray + data["__cuTexRefSetMipmappedArray"] = <_cyb_intptr_t>__cuTexRefSetMipmappedArray + + global __cuTexRefSetAddress_v2 + data["__cuTexRefSetAddress_v2"] = <_cyb_intptr_t>__cuTexRefSetAddress_v2 + + global __cuTexRefSetAddress2D_v3 + data["__cuTexRefSetAddress2D_v3"] = <_cyb_intptr_t>__cuTexRefSetAddress2D_v3 + + global __cuTexRefSetFormat + data["__cuTexRefSetFormat"] = <_cyb_intptr_t>__cuTexRefSetFormat + + global __cuTexRefSetAddressMode + data["__cuTexRefSetAddressMode"] = <_cyb_intptr_t>__cuTexRefSetAddressMode + + global __cuTexRefSetFilterMode + data["__cuTexRefSetFilterMode"] = <_cyb_intptr_t>__cuTexRefSetFilterMode + + global __cuTexRefSetMipmapFilterMode + data["__cuTexRefSetMipmapFilterMode"] = <_cyb_intptr_t>__cuTexRefSetMipmapFilterMode + + global __cuTexRefSetMipmapLevelBias + data["__cuTexRefSetMipmapLevelBias"] = <_cyb_intptr_t>__cuTexRefSetMipmapLevelBias + + global __cuTexRefSetMipmapLevelClamp + data["__cuTexRefSetMipmapLevelClamp"] = <_cyb_intptr_t>__cuTexRefSetMipmapLevelClamp + + global __cuTexRefSetMaxAnisotropy + data["__cuTexRefSetMaxAnisotropy"] = <_cyb_intptr_t>__cuTexRefSetMaxAnisotropy + + global __cuTexRefSetBorderColor + data["__cuTexRefSetBorderColor"] = <_cyb_intptr_t>__cuTexRefSetBorderColor + + global __cuTexRefSetFlags + data["__cuTexRefSetFlags"] = <_cyb_intptr_t>__cuTexRefSetFlags + + global __cuTexRefGetAddress_v2 + data["__cuTexRefGetAddress_v2"] = <_cyb_intptr_t>__cuTexRefGetAddress_v2 + + global __cuTexRefGetArray + data["__cuTexRefGetArray"] = <_cyb_intptr_t>__cuTexRefGetArray + + global __cuTexRefGetMipmappedArray + data["__cuTexRefGetMipmappedArray"] = <_cyb_intptr_t>__cuTexRefGetMipmappedArray + + global __cuTexRefGetAddressMode + data["__cuTexRefGetAddressMode"] = <_cyb_intptr_t>__cuTexRefGetAddressMode + + global __cuTexRefGetFilterMode + data["__cuTexRefGetFilterMode"] = <_cyb_intptr_t>__cuTexRefGetFilterMode + + global __cuTexRefGetFormat + data["__cuTexRefGetFormat"] = <_cyb_intptr_t>__cuTexRefGetFormat + + global __cuTexRefGetMipmapFilterMode + data["__cuTexRefGetMipmapFilterMode"] = <_cyb_intptr_t>__cuTexRefGetMipmapFilterMode + + global __cuTexRefGetMipmapLevelBias + data["__cuTexRefGetMipmapLevelBias"] = <_cyb_intptr_t>__cuTexRefGetMipmapLevelBias + + global __cuTexRefGetMipmapLevelClamp + data["__cuTexRefGetMipmapLevelClamp"] = <_cyb_intptr_t>__cuTexRefGetMipmapLevelClamp + + global __cuTexRefGetMaxAnisotropy + data["__cuTexRefGetMaxAnisotropy"] = <_cyb_intptr_t>__cuTexRefGetMaxAnisotropy + + global __cuTexRefGetBorderColor + data["__cuTexRefGetBorderColor"] = <_cyb_intptr_t>__cuTexRefGetBorderColor + + global __cuTexRefGetFlags + data["__cuTexRefGetFlags"] = <_cyb_intptr_t>__cuTexRefGetFlags + + global __cuTexRefCreate + data["__cuTexRefCreate"] = <_cyb_intptr_t>__cuTexRefCreate + + global __cuTexRefDestroy + data["__cuTexRefDestroy"] = <_cyb_intptr_t>__cuTexRefDestroy + + global __cuSurfRefSetArray + data["__cuSurfRefSetArray"] = <_cyb_intptr_t>__cuSurfRefSetArray + + global __cuSurfRefGetArray + data["__cuSurfRefGetArray"] = <_cyb_intptr_t>__cuSurfRefGetArray + + global __cuTexObjectCreate + data["__cuTexObjectCreate"] = <_cyb_intptr_t>__cuTexObjectCreate + + global __cuTexObjectDestroy + data["__cuTexObjectDestroy"] = <_cyb_intptr_t>__cuTexObjectDestroy + + global __cuTexObjectGetResourceDesc + data["__cuTexObjectGetResourceDesc"] = <_cyb_intptr_t>__cuTexObjectGetResourceDesc + + global __cuTexObjectGetTextureDesc + data["__cuTexObjectGetTextureDesc"] = <_cyb_intptr_t>__cuTexObjectGetTextureDesc + + global __cuTexObjectGetResourceViewDesc + data["__cuTexObjectGetResourceViewDesc"] = <_cyb_intptr_t>__cuTexObjectGetResourceViewDesc + + global __cuSurfObjectCreate + data["__cuSurfObjectCreate"] = <_cyb_intptr_t>__cuSurfObjectCreate + + global __cuSurfObjectDestroy + data["__cuSurfObjectDestroy"] = <_cyb_intptr_t>__cuSurfObjectDestroy + + global __cuSurfObjectGetResourceDesc + data["__cuSurfObjectGetResourceDesc"] = <_cyb_intptr_t>__cuSurfObjectGetResourceDesc + + global __cuTensorMapEncodeTiled + data["__cuTensorMapEncodeTiled"] = <_cyb_intptr_t>__cuTensorMapEncodeTiled + + global __cuTensorMapEncodeIm2col + data["__cuTensorMapEncodeIm2col"] = <_cyb_intptr_t>__cuTensorMapEncodeIm2col + + global __cuTensorMapEncodeIm2colWide + data["__cuTensorMapEncodeIm2colWide"] = <_cyb_intptr_t>__cuTensorMapEncodeIm2colWide + + global __cuTensorMapReplaceAddress + data["__cuTensorMapReplaceAddress"] = <_cyb_intptr_t>__cuTensorMapReplaceAddress + + global __cuDeviceCanAccessPeer + data["__cuDeviceCanAccessPeer"] = <_cyb_intptr_t>__cuDeviceCanAccessPeer + + global __cuCtxEnablePeerAccess + data["__cuCtxEnablePeerAccess"] = <_cyb_intptr_t>__cuCtxEnablePeerAccess + + global __cuCtxDisablePeerAccess + data["__cuCtxDisablePeerAccess"] = <_cyb_intptr_t>__cuCtxDisablePeerAccess + + global __cuDeviceGetP2PAttribute + data["__cuDeviceGetP2PAttribute"] = <_cyb_intptr_t>__cuDeviceGetP2PAttribute + + global __cuGraphicsUnregisterResource + data["__cuGraphicsUnregisterResource"] = <_cyb_intptr_t>__cuGraphicsUnregisterResource + + global __cuGraphicsSubResourceGetMappedArray + data["__cuGraphicsSubResourceGetMappedArray"] = <_cyb_intptr_t>__cuGraphicsSubResourceGetMappedArray + + global __cuGraphicsResourceGetMappedMipmappedArray + data["__cuGraphicsResourceGetMappedMipmappedArray"] = <_cyb_intptr_t>__cuGraphicsResourceGetMappedMipmappedArray + + global __cuGraphicsResourceGetMappedPointer_v2 + data["__cuGraphicsResourceGetMappedPointer_v2"] = <_cyb_intptr_t>__cuGraphicsResourceGetMappedPointer_v2 + + global __cuGraphicsResourceSetMapFlags_v2 + data["__cuGraphicsResourceSetMapFlags_v2"] = <_cyb_intptr_t>__cuGraphicsResourceSetMapFlags_v2 + + global __cuGraphicsMapResources + data["__cuGraphicsMapResources"] = <_cyb_intptr_t>__cuGraphicsMapResources + + global __cuGraphicsUnmapResources + data["__cuGraphicsUnmapResources"] = <_cyb_intptr_t>__cuGraphicsUnmapResources + + global __cuGetProcAddress_v2 + data["__cuGetProcAddress_v2"] = <_cyb_intptr_t>__cuGetProcAddress_v2 + + global __cuCoredumpGetAttribute + data["__cuCoredumpGetAttribute"] = <_cyb_intptr_t>__cuCoredumpGetAttribute + + global __cuCoredumpGetAttributeGlobal + data["__cuCoredumpGetAttributeGlobal"] = <_cyb_intptr_t>__cuCoredumpGetAttributeGlobal + + global __cuCoredumpSetAttribute + data["__cuCoredumpSetAttribute"] = <_cyb_intptr_t>__cuCoredumpSetAttribute + + global __cuCoredumpSetAttributeGlobal + data["__cuCoredumpSetAttributeGlobal"] = <_cyb_intptr_t>__cuCoredumpSetAttributeGlobal + + global __cuGetExportTable + data["__cuGetExportTable"] = <_cyb_intptr_t>__cuGetExportTable + + global __cuGreenCtxCreate + data["__cuGreenCtxCreate"] = <_cyb_intptr_t>__cuGreenCtxCreate + + global __cuGreenCtxDestroy + data["__cuGreenCtxDestroy"] = <_cyb_intptr_t>__cuGreenCtxDestroy + + global __cuCtxFromGreenCtx + data["__cuCtxFromGreenCtx"] = <_cyb_intptr_t>__cuCtxFromGreenCtx + + global __cuDeviceGetDevResource + data["__cuDeviceGetDevResource"] = <_cyb_intptr_t>__cuDeviceGetDevResource + + global __cuCtxGetDevResource + data["__cuCtxGetDevResource"] = <_cyb_intptr_t>__cuCtxGetDevResource + + global __cuGreenCtxGetDevResource + data["__cuGreenCtxGetDevResource"] = <_cyb_intptr_t>__cuGreenCtxGetDevResource + + global __cuDevSmResourceSplitByCount + data["__cuDevSmResourceSplitByCount"] = <_cyb_intptr_t>__cuDevSmResourceSplitByCount + + global __cuDevResourceGenerateDesc + data["__cuDevResourceGenerateDesc"] = <_cyb_intptr_t>__cuDevResourceGenerateDesc + + global __cuGreenCtxRecordEvent + data["__cuGreenCtxRecordEvent"] = <_cyb_intptr_t>__cuGreenCtxRecordEvent + + global __cuGreenCtxWaitEvent + data["__cuGreenCtxWaitEvent"] = <_cyb_intptr_t>__cuGreenCtxWaitEvent + + global __cuStreamGetGreenCtx + data["__cuStreamGetGreenCtx"] = <_cyb_intptr_t>__cuStreamGetGreenCtx + + global __cuGreenCtxStreamCreate + data["__cuGreenCtxStreamCreate"] = <_cyb_intptr_t>__cuGreenCtxStreamCreate + + global __cuLogsRegisterCallback + data["__cuLogsRegisterCallback"] = <_cyb_intptr_t>__cuLogsRegisterCallback + + global __cuLogsUnregisterCallback + data["__cuLogsUnregisterCallback"] = <_cyb_intptr_t>__cuLogsUnregisterCallback + + global __cuLogsCurrent + data["__cuLogsCurrent"] = <_cyb_intptr_t>__cuLogsCurrent + + global __cuLogsDumpToFile + data["__cuLogsDumpToFile"] = <_cyb_intptr_t>__cuLogsDumpToFile + + global __cuLogsDumpToMemory + data["__cuLogsDumpToMemory"] = <_cyb_intptr_t>__cuLogsDumpToMemory + + global __cuCheckpointProcessGetRestoreThreadId + data["__cuCheckpointProcessGetRestoreThreadId"] = <_cyb_intptr_t>__cuCheckpointProcessGetRestoreThreadId + + global __cuCheckpointProcessGetState + data["__cuCheckpointProcessGetState"] = <_cyb_intptr_t>__cuCheckpointProcessGetState + + global __cuCheckpointProcessLock + data["__cuCheckpointProcessLock"] = <_cyb_intptr_t>__cuCheckpointProcessLock + + global __cuCheckpointProcessCheckpoint + data["__cuCheckpointProcessCheckpoint"] = <_cyb_intptr_t>__cuCheckpointProcessCheckpoint + + global __cuCheckpointProcessRestore + data["__cuCheckpointProcessRestore"] = <_cyb_intptr_t>__cuCheckpointProcessRestore + + global __cuCheckpointProcessUnlock + data["__cuCheckpointProcessUnlock"] = <_cyb_intptr_t>__cuCheckpointProcessUnlock + + global __cuGraphicsEGLRegisterImage + data["__cuGraphicsEGLRegisterImage"] = <_cyb_intptr_t>__cuGraphicsEGLRegisterImage + + global __cuEGLStreamConsumerConnect + data["__cuEGLStreamConsumerConnect"] = <_cyb_intptr_t>__cuEGLStreamConsumerConnect + + global __cuEGLStreamConsumerConnectWithFlags + data["__cuEGLStreamConsumerConnectWithFlags"] = <_cyb_intptr_t>__cuEGLStreamConsumerConnectWithFlags + + global __cuEGLStreamConsumerDisconnect + data["__cuEGLStreamConsumerDisconnect"] = <_cyb_intptr_t>__cuEGLStreamConsumerDisconnect + + global __cuEGLStreamConsumerAcquireFrame + data["__cuEGLStreamConsumerAcquireFrame"] = <_cyb_intptr_t>__cuEGLStreamConsumerAcquireFrame + + global __cuEGLStreamConsumerReleaseFrame + data["__cuEGLStreamConsumerReleaseFrame"] = <_cyb_intptr_t>__cuEGLStreamConsumerReleaseFrame + + global __cuEGLStreamProducerConnect + data["__cuEGLStreamProducerConnect"] = <_cyb_intptr_t>__cuEGLStreamProducerConnect + + global __cuEGLStreamProducerDisconnect + data["__cuEGLStreamProducerDisconnect"] = <_cyb_intptr_t>__cuEGLStreamProducerDisconnect + + global __cuEGLStreamProducerPresentFrame + data["__cuEGLStreamProducerPresentFrame"] = <_cyb_intptr_t>__cuEGLStreamProducerPresentFrame + + global __cuEGLStreamProducerReturnFrame + data["__cuEGLStreamProducerReturnFrame"] = <_cyb_intptr_t>__cuEGLStreamProducerReturnFrame + + global __cuGraphicsResourceGetMappedEglFrame + data["__cuGraphicsResourceGetMappedEglFrame"] = <_cyb_intptr_t>__cuGraphicsResourceGetMappedEglFrame + + global __cuEventCreateFromEGLSync + data["__cuEventCreateFromEGLSync"] = <_cyb_intptr_t>__cuEventCreateFromEGLSync + + global __cuGraphicsGLRegisterBuffer + data["__cuGraphicsGLRegisterBuffer"] = <_cyb_intptr_t>__cuGraphicsGLRegisterBuffer + + global __cuGraphicsGLRegisterImage + data["__cuGraphicsGLRegisterImage"] = <_cyb_intptr_t>__cuGraphicsGLRegisterImage + + global __cuGLGetDevices_v2 + data["__cuGLGetDevices_v2"] = <_cyb_intptr_t>__cuGLGetDevices_v2 + + global __cuGLCtxCreate_v2 + data["__cuGLCtxCreate_v2"] = <_cyb_intptr_t>__cuGLCtxCreate_v2 + + global __cuGLInit + data["__cuGLInit"] = <_cyb_intptr_t>__cuGLInit + + global __cuGLRegisterBufferObject + data["__cuGLRegisterBufferObject"] = <_cyb_intptr_t>__cuGLRegisterBufferObject + + global __cuGLMapBufferObject_v2 + data["__cuGLMapBufferObject_v2"] = <_cyb_intptr_t>__cuGLMapBufferObject_v2 + + global __cuGLUnmapBufferObject + data["__cuGLUnmapBufferObject"] = <_cyb_intptr_t>__cuGLUnmapBufferObject + + global __cuGLUnregisterBufferObject + data["__cuGLUnregisterBufferObject"] = <_cyb_intptr_t>__cuGLUnregisterBufferObject + + global __cuGLSetBufferObjectMapFlags + data["__cuGLSetBufferObjectMapFlags"] = <_cyb_intptr_t>__cuGLSetBufferObjectMapFlags + + global __cuGLMapBufferObjectAsync_v2 + data["__cuGLMapBufferObjectAsync_v2"] = <_cyb_intptr_t>__cuGLMapBufferObjectAsync_v2 + + global __cuGLUnmapBufferObjectAsync + data["__cuGLUnmapBufferObjectAsync"] = <_cyb_intptr_t>__cuGLUnmapBufferObjectAsync + + global __cuProfilerInitialize + data["__cuProfilerInitialize"] = <_cyb_intptr_t>__cuProfilerInitialize + + global __cuProfilerStart + data["__cuProfilerStart"] = <_cyb_intptr_t>__cuProfilerStart + + global __cuProfilerStop + data["__cuProfilerStop"] = <_cyb_intptr_t>__cuProfilerStop + + global __cuVDPAUGetDevice + data["__cuVDPAUGetDevice"] = <_cyb_intptr_t>__cuVDPAUGetDevice + + global __cuVDPAUCtxCreate_v2 + data["__cuVDPAUCtxCreate_v2"] = <_cyb_intptr_t>__cuVDPAUCtxCreate_v2 + + global __cuGraphicsVDPAURegisterVideoSurface + data["__cuGraphicsVDPAURegisterVideoSurface"] = <_cyb_intptr_t>__cuGraphicsVDPAURegisterVideoSurface + + global __cuGraphicsVDPAURegisterOutputSurface + data["__cuGraphicsVDPAURegisterOutputSurface"] = <_cyb_intptr_t>__cuGraphicsVDPAURegisterOutputSurface + + global __cuDeviceGetHostAtomicCapabilities + data["__cuDeviceGetHostAtomicCapabilities"] = <_cyb_intptr_t>__cuDeviceGetHostAtomicCapabilities + + global __cuCtxGetDevice_v2 + data["__cuCtxGetDevice_v2"] = <_cyb_intptr_t>__cuCtxGetDevice_v2 + + global __cuCtxSynchronize_v2 + data["__cuCtxSynchronize_v2"] = <_cyb_intptr_t>__cuCtxSynchronize_v2 + + global __cuMemcpyBatchAsync_v2 + data["__cuMemcpyBatchAsync_v2"] = <_cyb_intptr_t>__cuMemcpyBatchAsync_v2 + + global __cuMemcpy3DBatchAsync_v2 + data["__cuMemcpy3DBatchAsync_v2"] = <_cyb_intptr_t>__cuMemcpy3DBatchAsync_v2 + + global __cuMemGetDefaultMemPool + data["__cuMemGetDefaultMemPool"] = <_cyb_intptr_t>__cuMemGetDefaultMemPool + + global __cuMemGetMemPool + data["__cuMemGetMemPool"] = <_cyb_intptr_t>__cuMemGetMemPool + + global __cuMemSetMemPool + data["__cuMemSetMemPool"] = <_cyb_intptr_t>__cuMemSetMemPool + + global __cuMemPrefetchBatchAsync + data["__cuMemPrefetchBatchAsync"] = <_cyb_intptr_t>__cuMemPrefetchBatchAsync + + global __cuMemDiscardBatchAsync + data["__cuMemDiscardBatchAsync"] = <_cyb_intptr_t>__cuMemDiscardBatchAsync + + global __cuMemDiscardAndPrefetchBatchAsync + data["__cuMemDiscardAndPrefetchBatchAsync"] = <_cyb_intptr_t>__cuMemDiscardAndPrefetchBatchAsync + + global __cuDeviceGetP2PAtomicCapabilities + data["__cuDeviceGetP2PAtomicCapabilities"] = <_cyb_intptr_t>__cuDeviceGetP2PAtomicCapabilities + + global __cuGreenCtxGetId + data["__cuGreenCtxGetId"] = <_cyb_intptr_t>__cuGreenCtxGetId + + global __cuMulticastBindMem_v2 + data["__cuMulticastBindMem_v2"] = <_cyb_intptr_t>__cuMulticastBindMem_v2 + + global __cuMulticastBindAddr_v2 + data["__cuMulticastBindAddr_v2"] = <_cyb_intptr_t>__cuMulticastBindAddr_v2 + + global __cuGraphNodeGetContainingGraph + data["__cuGraphNodeGetContainingGraph"] = <_cyb_intptr_t>__cuGraphNodeGetContainingGraph + + global __cuGraphNodeGetLocalId + data["__cuGraphNodeGetLocalId"] = <_cyb_intptr_t>__cuGraphNodeGetLocalId + + global __cuGraphNodeGetToolsId + data["__cuGraphNodeGetToolsId"] = <_cyb_intptr_t>__cuGraphNodeGetToolsId + + global __cuGraphGetId + data["__cuGraphGetId"] = <_cyb_intptr_t>__cuGraphGetId + + global __cuGraphExecGetId + data["__cuGraphExecGetId"] = <_cyb_intptr_t>__cuGraphExecGetId + + global __cuDevSmResourceSplit + data["__cuDevSmResourceSplit"] = <_cyb_intptr_t>__cuDevSmResourceSplit + + global __cuStreamGetDevResource + data["__cuStreamGetDevResource"] = <_cyb_intptr_t>__cuStreamGetDevResource + + global __cuKernelGetParamCount + data["__cuKernelGetParamCount"] = <_cyb_intptr_t>__cuKernelGetParamCount + + global __cuMemcpyWithAttributesAsync + data["__cuMemcpyWithAttributesAsync"] = <_cyb_intptr_t>__cuMemcpyWithAttributesAsync + + global __cuMemcpy3DWithAttributesAsync + data["__cuMemcpy3DWithAttributesAsync"] = <_cyb_intptr_t>__cuMemcpy3DWithAttributesAsync + + global __cuStreamBeginCaptureToCig + data["__cuStreamBeginCaptureToCig"] = <_cyb_intptr_t>__cuStreamBeginCaptureToCig + + global __cuStreamEndCaptureToCig + data["__cuStreamEndCaptureToCig"] = <_cyb_intptr_t>__cuStreamEndCaptureToCig + + global __cuFuncGetParamCount + data["__cuFuncGetParamCount"] = <_cyb_intptr_t>__cuFuncGetParamCount + + global __cuLaunchHostFunc_v2 + data["__cuLaunchHostFunc_v2"] = <_cyb_intptr_t>__cuLaunchHostFunc_v2 + + global __cuGraphNodeGetParams + data["__cuGraphNodeGetParams"] = <_cyb_intptr_t>__cuGraphNodeGetParams + + global __cuCoredumpRegisterStartCallback + data["__cuCoredumpRegisterStartCallback"] = <_cyb_intptr_t>__cuCoredumpRegisterStartCallback + + global __cuCoredumpRegisterCompleteCallback + data["__cuCoredumpRegisterCompleteCallback"] = <_cyb_intptr_t>__cuCoredumpRegisterCompleteCallback + + global __cuCoredumpDeregisterStartCallback + data["__cuCoredumpDeregisterStartCallback"] = <_cyb_intptr_t>__cuCoredumpDeregisterStartCallback + + global __cuCoredumpDeregisterCompleteCallback + data["__cuCoredumpDeregisterCompleteCallback"] = <_cyb_intptr_t>__cuCoredumpDeregisterCompleteCallback + + global __cuLogicalEndpointIdReserve + data["__cuLogicalEndpointIdReserve"] = <_cyb_intptr_t>__cuLogicalEndpointIdReserve + + global __cuLogicalEndpointIdRelease + data["__cuLogicalEndpointIdRelease"] = <_cyb_intptr_t>__cuLogicalEndpointIdRelease + + global __cuLogicalEndpointCreate + data["__cuLogicalEndpointCreate"] = <_cyb_intptr_t>__cuLogicalEndpointCreate + + global __cuLogicalEndpointAddDevice + data["__cuLogicalEndpointAddDevice"] = <_cyb_intptr_t>__cuLogicalEndpointAddDevice + + global __cuLogicalEndpointDestroy + data["__cuLogicalEndpointDestroy"] = <_cyb_intptr_t>__cuLogicalEndpointDestroy + + global __cuLogicalEndpointBindAddr + data["__cuLogicalEndpointBindAddr"] = <_cyb_intptr_t>__cuLogicalEndpointBindAddr + + global __cuLogicalEndpointBindMem + data["__cuLogicalEndpointBindMem"] = <_cyb_intptr_t>__cuLogicalEndpointBindMem + + global __cuLogicalEndpointUnbind + data["__cuLogicalEndpointUnbind"] = <_cyb_intptr_t>__cuLogicalEndpointUnbind + + global __cuLogicalEndpointExport + data["__cuLogicalEndpointExport"] = <_cyb_intptr_t>__cuLogicalEndpointExport + + global __cuLogicalEndpointImport + data["__cuLogicalEndpointImport"] = <_cyb_intptr_t>__cuLogicalEndpointImport + + global __cuLogicalEndpointGetLimits + data["__cuLogicalEndpointGetLimits"] = <_cyb_intptr_t>__cuLogicalEndpointGetLimits + + global __cuLogicalEndpointQuery + data["__cuLogicalEndpointQuery"] = <_cyb_intptr_t>__cuLogicalEndpointQuery + + global __cuStreamBeginRecaptureToGraph + data["__cuStreamBeginRecaptureToGraph"] = <_cyb_intptr_t>__cuStreamBeginRecaptureToGraph + _cyb_func_ptrs = data + return data + + +cpdef _inspect_function_pointer(str name): + global _cyb_func_ptrs + if _cyb_func_ptrs is None: + _cyb_func_ptrs = _inspect_function_pointers() + return _cyb_func_ptrs[name] + + + + +cdef void* load_library() except* with gil: + cdef uintptr_t handle = load_nvidia_dynamic_lib("cuda")._handle_uint + return handle + + +############################################################################### +# Wrapper functions +############################################################################### + +cdef CUresult _cuGetErrorString(CUresult error, const char** pStr) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGetErrorString + _check_or_init_driver() + if __cuGetErrorString == NULL: + with gil: + raise FunctionNotFoundError("function cuGetErrorString is not found") + return (__cuGetErrorString)( + error, pStr) + + +cdef CUresult _cuGetErrorName(CUresult error, const char** pStr) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGetErrorName + _check_or_init_driver() + if __cuGetErrorName == NULL: + with gil: + raise FunctionNotFoundError("function cuGetErrorName is not found") + return (__cuGetErrorName)( + error, pStr) + + +cdef CUresult _cuInit(unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuInit + _check_or_init_driver() + if __cuInit == NULL: + with gil: + raise FunctionNotFoundError("function cuInit is not found") + return (__cuInit)( + Flags) + + +cdef CUresult _cuDriverGetVersion(int* driverVersion) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDriverGetVersion + _check_or_init_driver() + if __cuDriverGetVersion == NULL: + with gil: + raise FunctionNotFoundError("function cuDriverGetVersion is not found") + return (__cuDriverGetVersion)( + driverVersion) + + +cdef CUresult _cuDeviceGet(CUdevice* device, int ordinal) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDeviceGet + _check_or_init_driver() + if __cuDeviceGet == NULL: + with gil: + raise FunctionNotFoundError("function cuDeviceGet is not found") + return (__cuDeviceGet)( + device, ordinal) + + +cdef CUresult _cuDeviceGetCount(int* count) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDeviceGetCount + _check_or_init_driver() + if __cuDeviceGetCount == NULL: + with gil: + raise FunctionNotFoundError("function cuDeviceGetCount is not found") + return (__cuDeviceGetCount)( + count) + + +cdef CUresult _cuDeviceGetName(char* name, int len, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDeviceGetName + _check_or_init_driver() + if __cuDeviceGetName == NULL: + with gil: + raise FunctionNotFoundError("function cuDeviceGetName is not found") + return (__cuDeviceGetName)( + name, len, dev) + + +cdef CUresult _cuDeviceGetUuid_v2(CUuuid* uuid, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDeviceGetUuid_v2 + _check_or_init_driver() + if __cuDeviceGetUuid_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuDeviceGetUuid_v2 is not found") + return (__cuDeviceGetUuid_v2)( + uuid, dev) + + +cdef CUresult _cuDeviceGetLuid(char* luid, unsigned int* deviceNodeMask, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDeviceGetLuid + _check_or_init_driver() + if __cuDeviceGetLuid == NULL: + with gil: + raise FunctionNotFoundError("function cuDeviceGetLuid is not found") + return (__cuDeviceGetLuid)( + luid, deviceNodeMask, dev) + + +cdef CUresult _cuDeviceTotalMem_v2(size_t* bytes, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDeviceTotalMem_v2 + _check_or_init_driver() + if __cuDeviceTotalMem_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuDeviceTotalMem_v2 is not found") + return (__cuDeviceTotalMem_v2)( + bytes, dev) + + +cdef CUresult _cuDeviceGetTexture1DLinearMaxWidth(size_t* maxWidthInElements, CUarray_format format, unsigned numChannels, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDeviceGetTexture1DLinearMaxWidth + _check_or_init_driver() + if __cuDeviceGetTexture1DLinearMaxWidth == NULL: + with gil: + raise FunctionNotFoundError("function cuDeviceGetTexture1DLinearMaxWidth is not found") + return (__cuDeviceGetTexture1DLinearMaxWidth)( + maxWidthInElements, format, numChannels, dev) + + +cdef CUresult _cuDeviceGetAttribute(int* pi, CUdevice_attribute attrib, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDeviceGetAttribute + _check_or_init_driver() + if __cuDeviceGetAttribute == NULL: + with gil: + raise FunctionNotFoundError("function cuDeviceGetAttribute is not found") + return (__cuDeviceGetAttribute)( + pi, attrib, dev) + + +cdef CUresult _cuDeviceGetNvSciSyncAttributes(void* nvSciSyncAttrList, CUdevice dev, int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDeviceGetNvSciSyncAttributes + _check_or_init_driver() + if __cuDeviceGetNvSciSyncAttributes == NULL: + with gil: + raise FunctionNotFoundError("function cuDeviceGetNvSciSyncAttributes is not found") + return (__cuDeviceGetNvSciSyncAttributes)( + nvSciSyncAttrList, dev, flags) + + +cdef CUresult _cuDeviceSetMemPool(CUdevice dev, CUmemoryPool pool) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDeviceSetMemPool + _check_or_init_driver() + if __cuDeviceSetMemPool == NULL: + with gil: + raise FunctionNotFoundError("function cuDeviceSetMemPool is not found") + return (__cuDeviceSetMemPool)( + dev, pool) + + +cdef CUresult _cuDeviceGetMemPool(CUmemoryPool* pool, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDeviceGetMemPool + _check_or_init_driver() + if __cuDeviceGetMemPool == NULL: + with gil: + raise FunctionNotFoundError("function cuDeviceGetMemPool is not found") + return (__cuDeviceGetMemPool)( + pool, dev) + + +cdef CUresult _cuDeviceGetDefaultMemPool(CUmemoryPool* pool_out, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDeviceGetDefaultMemPool + _check_or_init_driver() + if __cuDeviceGetDefaultMemPool == NULL: + with gil: + raise FunctionNotFoundError("function cuDeviceGetDefaultMemPool is not found") + return (__cuDeviceGetDefaultMemPool)( + pool_out, dev) + + +cdef CUresult _cuDeviceGetExecAffinitySupport(int* pi, CUexecAffinityType type, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDeviceGetExecAffinitySupport + _check_or_init_driver() + if __cuDeviceGetExecAffinitySupport == NULL: + with gil: + raise FunctionNotFoundError("function cuDeviceGetExecAffinitySupport is not found") + return (__cuDeviceGetExecAffinitySupport)( + pi, type, dev) + + +cdef CUresult _cuFlushGPUDirectRDMAWrites(CUflushGPUDirectRDMAWritesTarget target, CUflushGPUDirectRDMAWritesScope scope) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuFlushGPUDirectRDMAWrites + _check_or_init_driver() + if __cuFlushGPUDirectRDMAWrites == NULL: + with gil: + raise FunctionNotFoundError("function cuFlushGPUDirectRDMAWrites is not found") + return (__cuFlushGPUDirectRDMAWrites)( + target, scope) + + +cdef CUresult _cuDeviceGetProperties(CUdevprop* prop, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDeviceGetProperties + _check_or_init_driver() + if __cuDeviceGetProperties == NULL: + with gil: + raise FunctionNotFoundError("function cuDeviceGetProperties is not found") + return (__cuDeviceGetProperties)( + prop, dev) + + +cdef CUresult _cuDeviceComputeCapability(int* major, int* minor, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDeviceComputeCapability + _check_or_init_driver() + if __cuDeviceComputeCapability == NULL: + with gil: + raise FunctionNotFoundError("function cuDeviceComputeCapability is not found") + return (__cuDeviceComputeCapability)( + major, minor, dev) + + +cdef CUresult _cuDevicePrimaryCtxRetain(CUcontext* pctx, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDevicePrimaryCtxRetain + _check_or_init_driver() + if __cuDevicePrimaryCtxRetain == NULL: + with gil: + raise FunctionNotFoundError("function cuDevicePrimaryCtxRetain is not found") + return (__cuDevicePrimaryCtxRetain)( + pctx, dev) + + +cdef CUresult _cuDevicePrimaryCtxRelease_v2(CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDevicePrimaryCtxRelease_v2 + _check_or_init_driver() + if __cuDevicePrimaryCtxRelease_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuDevicePrimaryCtxRelease_v2 is not found") + return (__cuDevicePrimaryCtxRelease_v2)( + dev) + + +cdef CUresult _cuDevicePrimaryCtxSetFlags_v2(CUdevice dev, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDevicePrimaryCtxSetFlags_v2 + _check_or_init_driver() + if __cuDevicePrimaryCtxSetFlags_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuDevicePrimaryCtxSetFlags_v2 is not found") + return (__cuDevicePrimaryCtxSetFlags_v2)( + dev, flags) + + +cdef CUresult _cuDevicePrimaryCtxGetState(CUdevice dev, unsigned int* flags, int* active) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDevicePrimaryCtxGetState + _check_or_init_driver() + if __cuDevicePrimaryCtxGetState == NULL: + with gil: + raise FunctionNotFoundError("function cuDevicePrimaryCtxGetState is not found") + return (__cuDevicePrimaryCtxGetState)( + dev, flags, active) + + +cdef CUresult _cuDevicePrimaryCtxReset_v2(CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDevicePrimaryCtxReset_v2 + _check_or_init_driver() + if __cuDevicePrimaryCtxReset_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuDevicePrimaryCtxReset_v2 is not found") + return (__cuDevicePrimaryCtxReset_v2)( + dev) + + +cdef CUresult _cuCtxCreate_v2(CUcontext* pctx, unsigned int flags, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxCreate_v2 + _check_or_init_driver() + if __cuCtxCreate_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxCreate_v2 is not found") + return (__cuCtxCreate_v2)( + pctx, flags, dev) + + +cdef CUresult _cuCtxCreate_v3(CUcontext* pctx, CUexecAffinityParam* paramsArray, int numParams, unsigned int flags, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxCreate_v3 + _check_or_init_driver() + if __cuCtxCreate_v3 == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxCreate_v3 is not found") + return (__cuCtxCreate_v3)( + pctx, paramsArray, numParams, flags, dev) + + +cdef CUresult _cuCtxCreate_v4(CUcontext* pctx, CUctxCreateParams* ctxCreateParams, unsigned int flags, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxCreate_v4 + _check_or_init_driver() + if __cuCtxCreate_v4 == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxCreate_v4 is not found") + return (__cuCtxCreate_v4)( + pctx, ctxCreateParams, flags, dev) + + +cdef CUresult _cuCtxDestroy_v2(CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxDestroy_v2 + _check_or_init_driver() + if __cuCtxDestroy_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxDestroy_v2 is not found") + return (__cuCtxDestroy_v2)( + ctx) + + +cdef CUresult _cuCtxPushCurrent_v2(CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxPushCurrent_v2 + _check_or_init_driver() + if __cuCtxPushCurrent_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxPushCurrent_v2 is not found") + return (__cuCtxPushCurrent_v2)( + ctx) + + +cdef CUresult _cuCtxPopCurrent_v2(CUcontext* pctx) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxPopCurrent_v2 + _check_or_init_driver() + if __cuCtxPopCurrent_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxPopCurrent_v2 is not found") + return (__cuCtxPopCurrent_v2)( + pctx) + + +cdef CUresult _cuCtxSetCurrent(CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxSetCurrent + _check_or_init_driver() + if __cuCtxSetCurrent == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxSetCurrent is not found") + return (__cuCtxSetCurrent)( + ctx) + + +cdef CUresult _cuCtxGetCurrent(CUcontext* pctx) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxGetCurrent + _check_or_init_driver() + if __cuCtxGetCurrent == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxGetCurrent is not found") + return (__cuCtxGetCurrent)( + pctx) + + +cdef CUresult _cuCtxGetDevice(CUdevice* device) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxGetDevice + _check_or_init_driver() + if __cuCtxGetDevice == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxGetDevice is not found") + return (__cuCtxGetDevice)( + device) + + +cdef CUresult _cuCtxGetFlags(unsigned int* flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxGetFlags + _check_or_init_driver() + if __cuCtxGetFlags == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxGetFlags is not found") + return (__cuCtxGetFlags)( + flags) + + +cdef CUresult _cuCtxSetFlags(unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxSetFlags + _check_or_init_driver() + if __cuCtxSetFlags == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxSetFlags is not found") + return (__cuCtxSetFlags)( + flags) + + +cdef CUresult _cuCtxGetId(CUcontext ctx, unsigned long long* ctxId) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxGetId + _check_or_init_driver() + if __cuCtxGetId == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxGetId is not found") + return (__cuCtxGetId)( + ctx, ctxId) + + +cdef CUresult _cuCtxSynchronize() except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxSynchronize + _check_or_init_driver() + if __cuCtxSynchronize == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxSynchronize is not found") + return (__cuCtxSynchronize)( + ) + + +cdef CUresult _cuCtxSetLimit(CUlimit limit, size_t value) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxSetLimit + _check_or_init_driver() + if __cuCtxSetLimit == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxSetLimit is not found") + return (__cuCtxSetLimit)( + limit, value) + + +cdef CUresult _cuCtxGetLimit(size_t* pvalue, CUlimit limit) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxGetLimit + _check_or_init_driver() + if __cuCtxGetLimit == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxGetLimit is not found") + return (__cuCtxGetLimit)( + pvalue, limit) + + +cdef CUresult _cuCtxGetCacheConfig(CUfunc_cache* pconfig) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxGetCacheConfig + _check_or_init_driver() + if __cuCtxGetCacheConfig == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxGetCacheConfig is not found") + return (__cuCtxGetCacheConfig)( + pconfig) + + +cdef CUresult _cuCtxSetCacheConfig(CUfunc_cache config) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxSetCacheConfig + _check_or_init_driver() + if __cuCtxSetCacheConfig == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxSetCacheConfig is not found") + return (__cuCtxSetCacheConfig)( + config) + + +cdef CUresult _cuCtxGetApiVersion(CUcontext ctx, unsigned int* version) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxGetApiVersion + _check_or_init_driver() + if __cuCtxGetApiVersion == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxGetApiVersion is not found") + return (__cuCtxGetApiVersion)( + ctx, version) + + +cdef CUresult _cuCtxGetStreamPriorityRange(int* leastPriority, int* greatestPriority) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxGetStreamPriorityRange + _check_or_init_driver() + if __cuCtxGetStreamPriorityRange == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxGetStreamPriorityRange is not found") + return (__cuCtxGetStreamPriorityRange)( + leastPriority, greatestPriority) + + +cdef CUresult _cuCtxResetPersistingL2Cache() except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxResetPersistingL2Cache + _check_or_init_driver() + if __cuCtxResetPersistingL2Cache == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxResetPersistingL2Cache is not found") + return (__cuCtxResetPersistingL2Cache)( + ) + + +cdef CUresult _cuCtxGetExecAffinity(CUexecAffinityParam* pExecAffinity, CUexecAffinityType type) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxGetExecAffinity + _check_or_init_driver() + if __cuCtxGetExecAffinity == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxGetExecAffinity is not found") + return (__cuCtxGetExecAffinity)( + pExecAffinity, type) + + +cdef CUresult _cuCtxRecordEvent(CUcontext hCtx, CUevent hEvent) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxRecordEvent + _check_or_init_driver() + if __cuCtxRecordEvent == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxRecordEvent is not found") + return (__cuCtxRecordEvent)( + hCtx, hEvent) + + +cdef CUresult _cuCtxWaitEvent(CUcontext hCtx, CUevent hEvent) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxWaitEvent + _check_or_init_driver() + if __cuCtxWaitEvent == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxWaitEvent is not found") + return (__cuCtxWaitEvent)( + hCtx, hEvent) + + +cdef CUresult _cuCtxAttach(CUcontext* pctx, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxAttach + _check_or_init_driver() + if __cuCtxAttach == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxAttach is not found") + return (__cuCtxAttach)( + pctx, flags) + + +cdef CUresult _cuCtxDetach(CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxDetach + _check_or_init_driver() + if __cuCtxDetach == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxDetach is not found") + return (__cuCtxDetach)( + ctx) + + +cdef CUresult _cuCtxGetSharedMemConfig(CUsharedconfig* pConfig) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxGetSharedMemConfig + _check_or_init_driver() + if __cuCtxGetSharedMemConfig == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxGetSharedMemConfig is not found") + return (__cuCtxGetSharedMemConfig)( + pConfig) + + +cdef CUresult _cuCtxSetSharedMemConfig(CUsharedconfig config) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxSetSharedMemConfig + _check_or_init_driver() + if __cuCtxSetSharedMemConfig == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxSetSharedMemConfig is not found") + return (__cuCtxSetSharedMemConfig)( + config) + + +cdef CUresult _cuModuleLoad(CUmodule* module, const char* fname) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuModuleLoad + _check_or_init_driver() + if __cuModuleLoad == NULL: + with gil: + raise FunctionNotFoundError("function cuModuleLoad is not found") + return (__cuModuleLoad)( + module, fname) + + +cdef CUresult _cuModuleLoadData(CUmodule* module, const void* image) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuModuleLoadData + _check_or_init_driver() + if __cuModuleLoadData == NULL: + with gil: + raise FunctionNotFoundError("function cuModuleLoadData is not found") + return (__cuModuleLoadData)( + module, image) + + +cdef CUresult _cuModuleLoadDataEx(CUmodule* module, const void* image, unsigned int numOptions, CUjit_option* options, void** optionValues) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuModuleLoadDataEx + _check_or_init_driver() + if __cuModuleLoadDataEx == NULL: + with gil: + raise FunctionNotFoundError("function cuModuleLoadDataEx is not found") + return (__cuModuleLoadDataEx)( + module, image, numOptions, options, optionValues) + + +cdef CUresult _cuModuleLoadFatBinary(CUmodule* module, const void* fatCubin) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuModuleLoadFatBinary + _check_or_init_driver() + if __cuModuleLoadFatBinary == NULL: + with gil: + raise FunctionNotFoundError("function cuModuleLoadFatBinary is not found") + return (__cuModuleLoadFatBinary)( + module, fatCubin) + + +cdef CUresult _cuModuleUnload(CUmodule hmod) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuModuleUnload + _check_or_init_driver() + if __cuModuleUnload == NULL: + with gil: + raise FunctionNotFoundError("function cuModuleUnload is not found") + return (__cuModuleUnload)( + hmod) + + +cdef CUresult _cuModuleGetLoadingMode(CUmoduleLoadingMode* mode) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuModuleGetLoadingMode + _check_or_init_driver() + if __cuModuleGetLoadingMode == NULL: + with gil: + raise FunctionNotFoundError("function cuModuleGetLoadingMode is not found") + return (__cuModuleGetLoadingMode)( + mode) + + +cdef CUresult _cuModuleGetFunction(CUfunction* hfunc, CUmodule hmod, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuModuleGetFunction + _check_or_init_driver() + if __cuModuleGetFunction == NULL: + with gil: + raise FunctionNotFoundError("function cuModuleGetFunction is not found") + return (__cuModuleGetFunction)( + hfunc, hmod, name) + + +cdef CUresult _cuModuleGetFunctionCount(unsigned int* count, CUmodule mod) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuModuleGetFunctionCount + _check_or_init_driver() + if __cuModuleGetFunctionCount == NULL: + with gil: + raise FunctionNotFoundError("function cuModuleGetFunctionCount is not found") + return (__cuModuleGetFunctionCount)( + count, mod) + + +cdef CUresult _cuModuleEnumerateFunctions(CUfunction* functions, unsigned int numFunctions, CUmodule mod) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuModuleEnumerateFunctions + _check_or_init_driver() + if __cuModuleEnumerateFunctions == NULL: + with gil: + raise FunctionNotFoundError("function cuModuleEnumerateFunctions is not found") + return (__cuModuleEnumerateFunctions)( + functions, numFunctions, mod) + + +cdef CUresult _cuModuleGetGlobal_v2(CUdeviceptr* dptr, size_t* bytes, CUmodule hmod, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuModuleGetGlobal_v2 + _check_or_init_driver() + if __cuModuleGetGlobal_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuModuleGetGlobal_v2 is not found") + return (__cuModuleGetGlobal_v2)( + dptr, bytes, hmod, name) + + +cdef CUresult _cuLinkCreate_v2(unsigned int numOptions, CUjit_option* options, void** optionValues, CUlinkState* stateOut) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLinkCreate_v2 + _check_or_init_driver() + if __cuLinkCreate_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuLinkCreate_v2 is not found") + return (__cuLinkCreate_v2)( + numOptions, options, optionValues, stateOut) + + +cdef CUresult _cuLinkAddData_v2(CUlinkState state, CUjitInputType type, void* data, size_t size, const char* name, unsigned int numOptions, CUjit_option* options, void** optionValues) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLinkAddData_v2 + _check_or_init_driver() + if __cuLinkAddData_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuLinkAddData_v2 is not found") + return (__cuLinkAddData_v2)( + state, type, data, size, name, numOptions, options, optionValues) + + +cdef CUresult _cuLinkAddFile_v2(CUlinkState state, CUjitInputType type, const char* path, unsigned int numOptions, CUjit_option* options, void** optionValues) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLinkAddFile_v2 + _check_or_init_driver() + if __cuLinkAddFile_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuLinkAddFile_v2 is not found") + return (__cuLinkAddFile_v2)( + state, type, path, numOptions, options, optionValues) + + +cdef CUresult _cuLinkComplete(CUlinkState state, void** cubinOut, size_t* sizeOut) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLinkComplete + _check_or_init_driver() + if __cuLinkComplete == NULL: + with gil: + raise FunctionNotFoundError("function cuLinkComplete is not found") + return (__cuLinkComplete)( + state, cubinOut, sizeOut) + + +cdef CUresult _cuLinkDestroy(CUlinkState state) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLinkDestroy + _check_or_init_driver() + if __cuLinkDestroy == NULL: + with gil: + raise FunctionNotFoundError("function cuLinkDestroy is not found") + return (__cuLinkDestroy)( + state) + + +cdef CUresult _cuModuleGetTexRef(CUtexref* pTexRef, CUmodule hmod, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuModuleGetTexRef + _check_or_init_driver() + if __cuModuleGetTexRef == NULL: + with gil: + raise FunctionNotFoundError("function cuModuleGetTexRef is not found") + return (__cuModuleGetTexRef)( + pTexRef, hmod, name) + + +cdef CUresult _cuModuleGetSurfRef(CUsurfref* pSurfRef, CUmodule hmod, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuModuleGetSurfRef + _check_or_init_driver() + if __cuModuleGetSurfRef == NULL: + with gil: + raise FunctionNotFoundError("function cuModuleGetSurfRef is not found") + return (__cuModuleGetSurfRef)( + pSurfRef, hmod, name) + + +cdef CUresult _cuLibraryLoadData(CUlibrary* library, const void* code, CUjit_option* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, CUlibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLibraryLoadData + _check_or_init_driver() + if __cuLibraryLoadData == NULL: + with gil: + raise FunctionNotFoundError("function cuLibraryLoadData is not found") + return (__cuLibraryLoadData)( + library, code, jitOptions, jitOptionsValues, numJitOptions, libraryOptions, libraryOptionValues, numLibraryOptions) + + +cdef CUresult _cuLibraryLoadFromFile(CUlibrary* library, const char* fileName, CUjit_option* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, CUlibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLibraryLoadFromFile + _check_or_init_driver() + if __cuLibraryLoadFromFile == NULL: + with gil: + raise FunctionNotFoundError("function cuLibraryLoadFromFile is not found") + return (__cuLibraryLoadFromFile)( + library, fileName, jitOptions, jitOptionsValues, numJitOptions, libraryOptions, libraryOptionValues, numLibraryOptions) + + +cdef CUresult _cuLibraryUnload(CUlibrary library) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLibraryUnload + _check_or_init_driver() + if __cuLibraryUnload == NULL: + with gil: + raise FunctionNotFoundError("function cuLibraryUnload is not found") + return (__cuLibraryUnload)( + library) + + +cdef CUresult _cuLibraryGetKernel(CUkernel* pKernel, CUlibrary library, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLibraryGetKernel + _check_or_init_driver() + if __cuLibraryGetKernel == NULL: + with gil: + raise FunctionNotFoundError("function cuLibraryGetKernel is not found") + return (__cuLibraryGetKernel)( + pKernel, library, name) + + +cdef CUresult _cuLibraryGetKernelCount(unsigned int* count, CUlibrary lib) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLibraryGetKernelCount + _check_or_init_driver() + if __cuLibraryGetKernelCount == NULL: + with gil: + raise FunctionNotFoundError("function cuLibraryGetKernelCount is not found") + return (__cuLibraryGetKernelCount)( + count, lib) + + +cdef CUresult _cuLibraryEnumerateKernels(CUkernel* kernels, unsigned int numKernels, CUlibrary lib) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLibraryEnumerateKernels + _check_or_init_driver() + if __cuLibraryEnumerateKernels == NULL: + with gil: + raise FunctionNotFoundError("function cuLibraryEnumerateKernels is not found") + return (__cuLibraryEnumerateKernels)( + kernels, numKernels, lib) + + +cdef CUresult _cuLibraryGetModule(CUmodule* pMod, CUlibrary library) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLibraryGetModule + _check_or_init_driver() + if __cuLibraryGetModule == NULL: + with gil: + raise FunctionNotFoundError("function cuLibraryGetModule is not found") + return (__cuLibraryGetModule)( + pMod, library) + + +cdef CUresult _cuKernelGetFunction(CUfunction* pFunc, CUkernel kernel) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuKernelGetFunction + _check_or_init_driver() + if __cuKernelGetFunction == NULL: + with gil: + raise FunctionNotFoundError("function cuKernelGetFunction is not found") + return (__cuKernelGetFunction)( + pFunc, kernel) + + +cdef CUresult _cuKernelGetLibrary(CUlibrary* pLib, CUkernel kernel) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuKernelGetLibrary + _check_or_init_driver() + if __cuKernelGetLibrary == NULL: + with gil: + raise FunctionNotFoundError("function cuKernelGetLibrary is not found") + return (__cuKernelGetLibrary)( + pLib, kernel) + + +cdef CUresult _cuLibraryGetGlobal(CUdeviceptr* dptr, size_t* bytes, CUlibrary library, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLibraryGetGlobal + _check_or_init_driver() + if __cuLibraryGetGlobal == NULL: + with gil: + raise FunctionNotFoundError("function cuLibraryGetGlobal is not found") + return (__cuLibraryGetGlobal)( + dptr, bytes, library, name) + + +cdef CUresult _cuLibraryGetManaged(CUdeviceptr* dptr, size_t* bytes, CUlibrary library, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLibraryGetManaged + _check_or_init_driver() + if __cuLibraryGetManaged == NULL: + with gil: + raise FunctionNotFoundError("function cuLibraryGetManaged is not found") + return (__cuLibraryGetManaged)( + dptr, bytes, library, name) + + +cdef CUresult _cuLibraryGetUnifiedFunction(void** fptr, CUlibrary library, const char* symbol) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLibraryGetUnifiedFunction + _check_or_init_driver() + if __cuLibraryGetUnifiedFunction == NULL: + with gil: + raise FunctionNotFoundError("function cuLibraryGetUnifiedFunction is not found") + return (__cuLibraryGetUnifiedFunction)( + fptr, library, symbol) + + +cdef CUresult _cuKernelGetAttribute(int* pi, CUfunction_attribute attrib, CUkernel kernel, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuKernelGetAttribute + _check_or_init_driver() + if __cuKernelGetAttribute == NULL: + with gil: + raise FunctionNotFoundError("function cuKernelGetAttribute is not found") + return (__cuKernelGetAttribute)( + pi, attrib, kernel, dev) + + +cdef CUresult _cuKernelSetAttribute(CUfunction_attribute attrib, int val, CUkernel kernel, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuKernelSetAttribute + _check_or_init_driver() + if __cuKernelSetAttribute == NULL: + with gil: + raise FunctionNotFoundError("function cuKernelSetAttribute is not found") + return (__cuKernelSetAttribute)( + attrib, val, kernel, dev) + + +cdef CUresult _cuKernelSetCacheConfig(CUkernel kernel, CUfunc_cache config, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuKernelSetCacheConfig + _check_or_init_driver() + if __cuKernelSetCacheConfig == NULL: + with gil: + raise FunctionNotFoundError("function cuKernelSetCacheConfig is not found") + return (__cuKernelSetCacheConfig)( + kernel, config, dev) + + +cdef CUresult _cuKernelGetName(const char** name, CUkernel hfunc) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuKernelGetName + _check_or_init_driver() + if __cuKernelGetName == NULL: + with gil: + raise FunctionNotFoundError("function cuKernelGetName is not found") + return (__cuKernelGetName)( + name, hfunc) + + +cdef CUresult _cuKernelGetParamInfo(CUkernel kernel, size_t paramIndex, size_t* paramOffset, size_t* paramSize) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuKernelGetParamInfo + _check_or_init_driver() + if __cuKernelGetParamInfo == NULL: + with gil: + raise FunctionNotFoundError("function cuKernelGetParamInfo is not found") + return (__cuKernelGetParamInfo)( + kernel, paramIndex, paramOffset, paramSize) + + +cdef CUresult _cuMemGetInfo_v2(size_t* free, size_t* total) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemGetInfo_v2 + _check_or_init_driver() + if __cuMemGetInfo_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemGetInfo_v2 is not found") + return (__cuMemGetInfo_v2)( + free, total) + + +cdef CUresult _cuMemAlloc_v2(CUdeviceptr* dptr, size_t bytesize) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemAlloc_v2 + _check_or_init_driver() + if __cuMemAlloc_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemAlloc_v2 is not found") + return (__cuMemAlloc_v2)( + dptr, bytesize) + + +cdef CUresult _cuMemAllocPitch_v2(CUdeviceptr* dptr, size_t* pPitch, size_t WidthInBytes, size_t Height, unsigned int ElementSizeBytes) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemAllocPitch_v2 + _check_or_init_driver() + if __cuMemAllocPitch_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemAllocPitch_v2 is not found") + return (__cuMemAllocPitch_v2)( + dptr, pPitch, WidthInBytes, Height, ElementSizeBytes) + + +cdef CUresult _cuMemFree_v2(CUdeviceptr dptr) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemFree_v2 + _check_or_init_driver() + if __cuMemFree_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemFree_v2 is not found") + return (__cuMemFree_v2)( + dptr) + + +cdef CUresult _cuMemGetAddressRange_v2(CUdeviceptr* pbase, size_t* psize, CUdeviceptr dptr) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemGetAddressRange_v2 + _check_or_init_driver() + if __cuMemGetAddressRange_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemGetAddressRange_v2 is not found") + return (__cuMemGetAddressRange_v2)( + pbase, psize, dptr) + + +cdef CUresult _cuMemAllocHost_v2(void** pp, size_t bytesize) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemAllocHost_v2 + _check_or_init_driver() + if __cuMemAllocHost_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemAllocHost_v2 is not found") + return (__cuMemAllocHost_v2)( + pp, bytesize) + + +cdef CUresult _cuMemFreeHost(void* p) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemFreeHost + _check_or_init_driver() + if __cuMemFreeHost == NULL: + with gil: + raise FunctionNotFoundError("function cuMemFreeHost is not found") + return (__cuMemFreeHost)( + p) + + +cdef CUresult _cuMemHostAlloc(void** pp, size_t bytesize, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemHostAlloc + _check_or_init_driver() + if __cuMemHostAlloc == NULL: + with gil: + raise FunctionNotFoundError("function cuMemHostAlloc is not found") + return (__cuMemHostAlloc)( + pp, bytesize, Flags) + + +cdef CUresult _cuMemHostGetDevicePointer_v2(CUdeviceptr* pdptr, void* p, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemHostGetDevicePointer_v2 + _check_or_init_driver() + if __cuMemHostGetDevicePointer_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemHostGetDevicePointer_v2 is not found") + return (__cuMemHostGetDevicePointer_v2)( + pdptr, p, Flags) + + +cdef CUresult _cuMemHostGetFlags(unsigned int* pFlags, void* p) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemHostGetFlags + _check_or_init_driver() + if __cuMemHostGetFlags == NULL: + with gil: + raise FunctionNotFoundError("function cuMemHostGetFlags is not found") + return (__cuMemHostGetFlags)( + pFlags, p) + + +cdef CUresult _cuMemAllocManaged(CUdeviceptr* dptr, size_t bytesize, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemAllocManaged + _check_or_init_driver() + if __cuMemAllocManaged == NULL: + with gil: + raise FunctionNotFoundError("function cuMemAllocManaged is not found") + return (__cuMemAllocManaged)( + dptr, bytesize, flags) + + +cdef CUresult _cuDeviceRegisterAsyncNotification(CUdevice device, CUasyncCallback callbackFunc, void* userData, CUasyncCallbackHandle* callback) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDeviceRegisterAsyncNotification + _check_or_init_driver() + if __cuDeviceRegisterAsyncNotification == NULL: + with gil: + raise FunctionNotFoundError("function cuDeviceRegisterAsyncNotification is not found") + return (__cuDeviceRegisterAsyncNotification)( + device, callbackFunc, userData, callback) + + +cdef CUresult _cuDeviceUnregisterAsyncNotification(CUdevice device, CUasyncCallbackHandle callback) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDeviceUnregisterAsyncNotification + _check_or_init_driver() + if __cuDeviceUnregisterAsyncNotification == NULL: + with gil: + raise FunctionNotFoundError("function cuDeviceUnregisterAsyncNotification is not found") + return (__cuDeviceUnregisterAsyncNotification)( + device, callback) + + +cdef CUresult _cuDeviceGetByPCIBusId(CUdevice* dev, const char* pciBusId) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDeviceGetByPCIBusId + _check_or_init_driver() + if __cuDeviceGetByPCIBusId == NULL: + with gil: + raise FunctionNotFoundError("function cuDeviceGetByPCIBusId is not found") + return (__cuDeviceGetByPCIBusId)( + dev, pciBusId) + + +cdef CUresult _cuDeviceGetPCIBusId(char* pciBusId, int len, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDeviceGetPCIBusId + _check_or_init_driver() + if __cuDeviceGetPCIBusId == NULL: + with gil: + raise FunctionNotFoundError("function cuDeviceGetPCIBusId is not found") + return (__cuDeviceGetPCIBusId)( + pciBusId, len, dev) + + +cdef CUresult _cuIpcGetEventHandle(CUipcEventHandle* pHandle, CUevent event) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuIpcGetEventHandle + _check_or_init_driver() + if __cuIpcGetEventHandle == NULL: + with gil: + raise FunctionNotFoundError("function cuIpcGetEventHandle is not found") + return (__cuIpcGetEventHandle)( + pHandle, event) + + +cdef CUresult _cuIpcOpenEventHandle(CUevent* phEvent, CUipcEventHandle handle) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuIpcOpenEventHandle + _check_or_init_driver() + if __cuIpcOpenEventHandle == NULL: + with gil: + raise FunctionNotFoundError("function cuIpcOpenEventHandle is not found") + return (__cuIpcOpenEventHandle)( + phEvent, handle) + + +cdef CUresult _cuIpcGetMemHandle(CUipcMemHandle* pHandle, CUdeviceptr dptr) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuIpcGetMemHandle + _check_or_init_driver() + if __cuIpcGetMemHandle == NULL: + with gil: + raise FunctionNotFoundError("function cuIpcGetMemHandle is not found") + return (__cuIpcGetMemHandle)( + pHandle, dptr) + + +cdef CUresult _cuIpcOpenMemHandle_v2(CUdeviceptr* pdptr, CUipcMemHandle handle, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuIpcOpenMemHandle_v2 + _check_or_init_driver() + if __cuIpcOpenMemHandle_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuIpcOpenMemHandle_v2 is not found") + return (__cuIpcOpenMemHandle_v2)( + pdptr, handle, Flags) + + +cdef CUresult _cuIpcCloseMemHandle(CUdeviceptr dptr) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuIpcCloseMemHandle + _check_or_init_driver() + if __cuIpcCloseMemHandle == NULL: + with gil: + raise FunctionNotFoundError("function cuIpcCloseMemHandle is not found") + return (__cuIpcCloseMemHandle)( + dptr) + + +cdef CUresult _cuMemHostRegister_v2(void* p, size_t bytesize, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemHostRegister_v2 + _check_or_init_driver() + if __cuMemHostRegister_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemHostRegister_v2 is not found") + return (__cuMemHostRegister_v2)( + p, bytesize, Flags) + + +cdef CUresult _cuMemHostUnregister(void* p) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemHostUnregister + _check_or_init_driver() + if __cuMemHostUnregister == NULL: + with gil: + raise FunctionNotFoundError("function cuMemHostUnregister is not found") + return (__cuMemHostUnregister)( + p) + + +cdef CUresult _cuMemcpy(CUdeviceptr dst, CUdeviceptr src, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemcpy + _check_or_init_driver() + if __cuMemcpy == NULL: + with gil: + raise FunctionNotFoundError("function cuMemcpy is not found") + return (__cuMemcpy)( + dst, src, ByteCount) + + +cdef CUresult _cuMemcpyPeer(CUdeviceptr dstDevice, CUcontext dstContext, CUdeviceptr srcDevice, CUcontext srcContext, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemcpyPeer + _check_or_init_driver() + if __cuMemcpyPeer == NULL: + with gil: + raise FunctionNotFoundError("function cuMemcpyPeer is not found") + return (__cuMemcpyPeer)( + dstDevice, dstContext, srcDevice, srcContext, ByteCount) + + +cdef CUresult _cuMemcpyHtoD_v2(CUdeviceptr dstDevice, const void* srcHost, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemcpyHtoD_v2 + _check_or_init_driver() + if __cuMemcpyHtoD_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemcpyHtoD_v2 is not found") + return (__cuMemcpyHtoD_v2)( + dstDevice, srcHost, ByteCount) + + +cdef CUresult _cuMemcpyDtoH_v2(void* dstHost, CUdeviceptr srcDevice, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemcpyDtoH_v2 + _check_or_init_driver() + if __cuMemcpyDtoH_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemcpyDtoH_v2 is not found") + return (__cuMemcpyDtoH_v2)( + dstHost, srcDevice, ByteCount) + + +cdef CUresult _cuMemcpyDtoD_v2(CUdeviceptr dstDevice, CUdeviceptr srcDevice, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemcpyDtoD_v2 + _check_or_init_driver() + if __cuMemcpyDtoD_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemcpyDtoD_v2 is not found") + return (__cuMemcpyDtoD_v2)( + dstDevice, srcDevice, ByteCount) + + +cdef CUresult _cuMemcpyDtoA_v2(CUarray dstArray, size_t dstOffset, CUdeviceptr srcDevice, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemcpyDtoA_v2 + _check_or_init_driver() + if __cuMemcpyDtoA_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemcpyDtoA_v2 is not found") + return (__cuMemcpyDtoA_v2)( + dstArray, dstOffset, srcDevice, ByteCount) + + +cdef CUresult _cuMemcpyAtoD_v2(CUdeviceptr dstDevice, CUarray srcArray, size_t srcOffset, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemcpyAtoD_v2 + _check_or_init_driver() + if __cuMemcpyAtoD_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemcpyAtoD_v2 is not found") + return (__cuMemcpyAtoD_v2)( + dstDevice, srcArray, srcOffset, ByteCount) + + +cdef CUresult _cuMemcpyHtoA_v2(CUarray dstArray, size_t dstOffset, const void* srcHost, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemcpyHtoA_v2 + _check_or_init_driver() + if __cuMemcpyHtoA_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemcpyHtoA_v2 is not found") + return (__cuMemcpyHtoA_v2)( + dstArray, dstOffset, srcHost, ByteCount) + + +cdef CUresult _cuMemcpyAtoH_v2(void* dstHost, CUarray srcArray, size_t srcOffset, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemcpyAtoH_v2 + _check_or_init_driver() + if __cuMemcpyAtoH_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemcpyAtoH_v2 is not found") + return (__cuMemcpyAtoH_v2)( + dstHost, srcArray, srcOffset, ByteCount) + + +cdef CUresult _cuMemcpyAtoA_v2(CUarray dstArray, size_t dstOffset, CUarray srcArray, size_t srcOffset, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemcpyAtoA_v2 + _check_or_init_driver() + if __cuMemcpyAtoA_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemcpyAtoA_v2 is not found") + return (__cuMemcpyAtoA_v2)( + dstArray, dstOffset, srcArray, srcOffset, ByteCount) + + +cdef CUresult _cuMemcpy2D_v2(const CUDA_MEMCPY2D* pCopy) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemcpy2D_v2 + _check_or_init_driver() + if __cuMemcpy2D_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemcpy2D_v2 is not found") + return (__cuMemcpy2D_v2)( + pCopy) + + +cdef CUresult _cuMemcpy2DUnaligned_v2(const CUDA_MEMCPY2D* pCopy) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemcpy2DUnaligned_v2 + _check_or_init_driver() + if __cuMemcpy2DUnaligned_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemcpy2DUnaligned_v2 is not found") + return (__cuMemcpy2DUnaligned_v2)( + pCopy) + + +cdef CUresult _cuMemcpy3D_v2(const CUDA_MEMCPY3D* pCopy) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemcpy3D_v2 + _check_or_init_driver() + if __cuMemcpy3D_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemcpy3D_v2 is not found") + return (__cuMemcpy3D_v2)( + pCopy) + + +cdef CUresult _cuMemcpy3DPeer(const CUDA_MEMCPY3D_PEER* pCopy) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemcpy3DPeer + _check_or_init_driver() + if __cuMemcpy3DPeer == NULL: + with gil: + raise FunctionNotFoundError("function cuMemcpy3DPeer is not found") + return (__cuMemcpy3DPeer)( + pCopy) + + +cdef CUresult _cuMemcpyAsync(CUdeviceptr dst, CUdeviceptr src, size_t ByteCount, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemcpyAsync + _check_or_init_driver() + if __cuMemcpyAsync == NULL: + with gil: + raise FunctionNotFoundError("function cuMemcpyAsync is not found") + return (__cuMemcpyAsync)( + dst, src, ByteCount, hStream) + + +cdef CUresult _cuMemcpyPeerAsync(CUdeviceptr dstDevice, CUcontext dstContext, CUdeviceptr srcDevice, CUcontext srcContext, size_t ByteCount, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemcpyPeerAsync + _check_or_init_driver() + if __cuMemcpyPeerAsync == NULL: + with gil: + raise FunctionNotFoundError("function cuMemcpyPeerAsync is not found") + return (__cuMemcpyPeerAsync)( + dstDevice, dstContext, srcDevice, srcContext, ByteCount, hStream) + + +cdef CUresult _cuMemcpyHtoDAsync_v2(CUdeviceptr dstDevice, const void* srcHost, size_t ByteCount, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemcpyHtoDAsync_v2 + _check_or_init_driver() + if __cuMemcpyHtoDAsync_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemcpyHtoDAsync_v2 is not found") + return (__cuMemcpyHtoDAsync_v2)( + dstDevice, srcHost, ByteCount, hStream) + + +cdef CUresult _cuMemcpyDtoHAsync_v2(void* dstHost, CUdeviceptr srcDevice, size_t ByteCount, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemcpyDtoHAsync_v2 + _check_or_init_driver() + if __cuMemcpyDtoHAsync_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemcpyDtoHAsync_v2 is not found") + return (__cuMemcpyDtoHAsync_v2)( + dstHost, srcDevice, ByteCount, hStream) + + +cdef CUresult _cuMemcpyDtoDAsync_v2(CUdeviceptr dstDevice, CUdeviceptr srcDevice, size_t ByteCount, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemcpyDtoDAsync_v2 + _check_or_init_driver() + if __cuMemcpyDtoDAsync_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemcpyDtoDAsync_v2 is not found") + return (__cuMemcpyDtoDAsync_v2)( + dstDevice, srcDevice, ByteCount, hStream) + + +cdef CUresult _cuMemcpyHtoAAsync_v2(CUarray dstArray, size_t dstOffset, const void* srcHost, size_t ByteCount, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemcpyHtoAAsync_v2 + _check_or_init_driver() + if __cuMemcpyHtoAAsync_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemcpyHtoAAsync_v2 is not found") + return (__cuMemcpyHtoAAsync_v2)( + dstArray, dstOffset, srcHost, ByteCount, hStream) + + +cdef CUresult _cuMemcpyAtoHAsync_v2(void* dstHost, CUarray srcArray, size_t srcOffset, size_t ByteCount, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemcpyAtoHAsync_v2 + _check_or_init_driver() + if __cuMemcpyAtoHAsync_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemcpyAtoHAsync_v2 is not found") + return (__cuMemcpyAtoHAsync_v2)( + dstHost, srcArray, srcOffset, ByteCount, hStream) + + +cdef CUresult _cuMemcpy2DAsync_v2(const CUDA_MEMCPY2D* pCopy, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemcpy2DAsync_v2 + _check_or_init_driver() + if __cuMemcpy2DAsync_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemcpy2DAsync_v2 is not found") + return (__cuMemcpy2DAsync_v2)( + pCopy, hStream) + + +cdef CUresult _cuMemcpy3DAsync_v2(const CUDA_MEMCPY3D* pCopy, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemcpy3DAsync_v2 + _check_or_init_driver() + if __cuMemcpy3DAsync_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemcpy3DAsync_v2 is not found") + return (__cuMemcpy3DAsync_v2)( + pCopy, hStream) + + +cdef CUresult _cuMemcpy3DPeerAsync(const CUDA_MEMCPY3D_PEER* pCopy, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemcpy3DPeerAsync + _check_or_init_driver() + if __cuMemcpy3DPeerAsync == NULL: + with gil: + raise FunctionNotFoundError("function cuMemcpy3DPeerAsync is not found") + return (__cuMemcpy3DPeerAsync)( + pCopy, hStream) + + +cdef CUresult _cuMemsetD8_v2(CUdeviceptr dstDevice, unsigned char uc, size_t N) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemsetD8_v2 + _check_or_init_driver() + if __cuMemsetD8_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemsetD8_v2 is not found") + return (__cuMemsetD8_v2)( + dstDevice, uc, N) + + +cdef CUresult _cuMemsetD16_v2(CUdeviceptr dstDevice, unsigned short us, size_t N) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemsetD16_v2 + _check_or_init_driver() + if __cuMemsetD16_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemsetD16_v2 is not found") + return (__cuMemsetD16_v2)( + dstDevice, us, N) + + +cdef CUresult _cuMemsetD32_v2(CUdeviceptr dstDevice, unsigned int ui, size_t N) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemsetD32_v2 + _check_or_init_driver() + if __cuMemsetD32_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemsetD32_v2 is not found") + return (__cuMemsetD32_v2)( + dstDevice, ui, N) + + +cdef CUresult _cuMemsetD2D8_v2(CUdeviceptr dstDevice, size_t dstPitch, unsigned char uc, size_t Width, size_t Height) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemsetD2D8_v2 + _check_or_init_driver() + if __cuMemsetD2D8_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemsetD2D8_v2 is not found") + return (__cuMemsetD2D8_v2)( + dstDevice, dstPitch, uc, Width, Height) + + +cdef CUresult _cuMemsetD2D16_v2(CUdeviceptr dstDevice, size_t dstPitch, unsigned short us, size_t Width, size_t Height) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemsetD2D16_v2 + _check_or_init_driver() + if __cuMemsetD2D16_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemsetD2D16_v2 is not found") + return (__cuMemsetD2D16_v2)( + dstDevice, dstPitch, us, Width, Height) + + +cdef CUresult _cuMemsetD2D32_v2(CUdeviceptr dstDevice, size_t dstPitch, unsigned int ui, size_t Width, size_t Height) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemsetD2D32_v2 + _check_or_init_driver() + if __cuMemsetD2D32_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemsetD2D32_v2 is not found") + return (__cuMemsetD2D32_v2)( + dstDevice, dstPitch, ui, Width, Height) + + +cdef CUresult _cuMemsetD8Async(CUdeviceptr dstDevice, unsigned char uc, size_t N, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemsetD8Async + _check_or_init_driver() + if __cuMemsetD8Async == NULL: + with gil: + raise FunctionNotFoundError("function cuMemsetD8Async is not found") + return (__cuMemsetD8Async)( + dstDevice, uc, N, hStream) + + +cdef CUresult _cuMemsetD16Async(CUdeviceptr dstDevice, unsigned short us, size_t N, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemsetD16Async + _check_or_init_driver() + if __cuMemsetD16Async == NULL: + with gil: + raise FunctionNotFoundError("function cuMemsetD16Async is not found") + return (__cuMemsetD16Async)( + dstDevice, us, N, hStream) + + +cdef CUresult _cuMemsetD32Async(CUdeviceptr dstDevice, unsigned int ui, size_t N, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemsetD32Async + _check_or_init_driver() + if __cuMemsetD32Async == NULL: + with gil: + raise FunctionNotFoundError("function cuMemsetD32Async is not found") + return (__cuMemsetD32Async)( + dstDevice, ui, N, hStream) + + +cdef CUresult _cuMemsetD2D8Async(CUdeviceptr dstDevice, size_t dstPitch, unsigned char uc, size_t Width, size_t Height, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemsetD2D8Async + _check_or_init_driver() + if __cuMemsetD2D8Async == NULL: + with gil: + raise FunctionNotFoundError("function cuMemsetD2D8Async is not found") + return (__cuMemsetD2D8Async)( + dstDevice, dstPitch, uc, Width, Height, hStream) + + +cdef CUresult _cuMemsetD2D16Async(CUdeviceptr dstDevice, size_t dstPitch, unsigned short us, size_t Width, size_t Height, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemsetD2D16Async + _check_or_init_driver() + if __cuMemsetD2D16Async == NULL: + with gil: + raise FunctionNotFoundError("function cuMemsetD2D16Async is not found") + return (__cuMemsetD2D16Async)( + dstDevice, dstPitch, us, Width, Height, hStream) + + +cdef CUresult _cuMemsetD2D32Async(CUdeviceptr dstDevice, size_t dstPitch, unsigned int ui, size_t Width, size_t Height, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemsetD2D32Async + _check_or_init_driver() + if __cuMemsetD2D32Async == NULL: + with gil: + raise FunctionNotFoundError("function cuMemsetD2D32Async is not found") + return (__cuMemsetD2D32Async)( + dstDevice, dstPitch, ui, Width, Height, hStream) + + +cdef CUresult _cuArrayCreate_v2(CUarray* pHandle, const CUDA_ARRAY_DESCRIPTOR* pAllocateArray) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuArrayCreate_v2 + _check_or_init_driver() + if __cuArrayCreate_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuArrayCreate_v2 is not found") + return (__cuArrayCreate_v2)( + pHandle, pAllocateArray) + + +cdef CUresult _cuArrayGetDescriptor_v2(CUDA_ARRAY_DESCRIPTOR* pArrayDescriptor, CUarray hArray) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuArrayGetDescriptor_v2 + _check_or_init_driver() + if __cuArrayGetDescriptor_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuArrayGetDescriptor_v2 is not found") + return (__cuArrayGetDescriptor_v2)( + pArrayDescriptor, hArray) + + +cdef CUresult _cuArrayGetSparseProperties(CUDA_ARRAY_SPARSE_PROPERTIES* sparseProperties, CUarray array) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuArrayGetSparseProperties + _check_or_init_driver() + if __cuArrayGetSparseProperties == NULL: + with gil: + raise FunctionNotFoundError("function cuArrayGetSparseProperties is not found") + return (__cuArrayGetSparseProperties)( + sparseProperties, array) + + +cdef CUresult _cuMipmappedArrayGetSparseProperties(CUDA_ARRAY_SPARSE_PROPERTIES* sparseProperties, CUmipmappedArray mipmap) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMipmappedArrayGetSparseProperties + _check_or_init_driver() + if __cuMipmappedArrayGetSparseProperties == NULL: + with gil: + raise FunctionNotFoundError("function cuMipmappedArrayGetSparseProperties is not found") + return (__cuMipmappedArrayGetSparseProperties)( + sparseProperties, mipmap) + + +cdef CUresult _cuArrayGetMemoryRequirements(CUDA_ARRAY_MEMORY_REQUIREMENTS* memoryRequirements, CUarray array, CUdevice device) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuArrayGetMemoryRequirements + _check_or_init_driver() + if __cuArrayGetMemoryRequirements == NULL: + with gil: + raise FunctionNotFoundError("function cuArrayGetMemoryRequirements is not found") + return (__cuArrayGetMemoryRequirements)( + memoryRequirements, array, device) + + +cdef CUresult _cuMipmappedArrayGetMemoryRequirements(CUDA_ARRAY_MEMORY_REQUIREMENTS* memoryRequirements, CUmipmappedArray mipmap, CUdevice device) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMipmappedArrayGetMemoryRequirements + _check_or_init_driver() + if __cuMipmappedArrayGetMemoryRequirements == NULL: + with gil: + raise FunctionNotFoundError("function cuMipmappedArrayGetMemoryRequirements is not found") + return (__cuMipmappedArrayGetMemoryRequirements)( + memoryRequirements, mipmap, device) + + +cdef CUresult _cuArrayGetPlane(CUarray* pPlaneArray, CUarray hArray, unsigned int planeIdx) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuArrayGetPlane + _check_or_init_driver() + if __cuArrayGetPlane == NULL: + with gil: + raise FunctionNotFoundError("function cuArrayGetPlane is not found") + return (__cuArrayGetPlane)( + pPlaneArray, hArray, planeIdx) + + +cdef CUresult _cuArrayDestroy(CUarray hArray) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuArrayDestroy + _check_or_init_driver() + if __cuArrayDestroy == NULL: + with gil: + raise FunctionNotFoundError("function cuArrayDestroy is not found") + return (__cuArrayDestroy)( + hArray) + + +cdef CUresult _cuArray3DCreate_v2(CUarray* pHandle, const CUDA_ARRAY3D_DESCRIPTOR* pAllocateArray) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuArray3DCreate_v2 + _check_or_init_driver() + if __cuArray3DCreate_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuArray3DCreate_v2 is not found") + return (__cuArray3DCreate_v2)( + pHandle, pAllocateArray) + + +cdef CUresult _cuArray3DGetDescriptor_v2(CUDA_ARRAY3D_DESCRIPTOR* pArrayDescriptor, CUarray hArray) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuArray3DGetDescriptor_v2 + _check_or_init_driver() + if __cuArray3DGetDescriptor_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuArray3DGetDescriptor_v2 is not found") + return (__cuArray3DGetDescriptor_v2)( + pArrayDescriptor, hArray) + + +cdef CUresult _cuMipmappedArrayCreate(CUmipmappedArray* pHandle, const CUDA_ARRAY3D_DESCRIPTOR* pMipmappedArrayDesc, unsigned int numMipmapLevels) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMipmappedArrayCreate + _check_or_init_driver() + if __cuMipmappedArrayCreate == NULL: + with gil: + raise FunctionNotFoundError("function cuMipmappedArrayCreate is not found") + return (__cuMipmappedArrayCreate)( + pHandle, pMipmappedArrayDesc, numMipmapLevels) + + +cdef CUresult _cuMipmappedArrayGetLevel(CUarray* pLevelArray, CUmipmappedArray hMipmappedArray, unsigned int level) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMipmappedArrayGetLevel + _check_or_init_driver() + if __cuMipmappedArrayGetLevel == NULL: + with gil: + raise FunctionNotFoundError("function cuMipmappedArrayGetLevel is not found") + return (__cuMipmappedArrayGetLevel)( + pLevelArray, hMipmappedArray, level) + + +cdef CUresult _cuMipmappedArrayDestroy(CUmipmappedArray hMipmappedArray) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMipmappedArrayDestroy + _check_or_init_driver() + if __cuMipmappedArrayDestroy == NULL: + with gil: + raise FunctionNotFoundError("function cuMipmappedArrayDestroy is not found") + return (__cuMipmappedArrayDestroy)( + hMipmappedArray) + + +cdef CUresult _cuMemGetHandleForAddressRange(void* handle, CUdeviceptr dptr, size_t size, CUmemRangeHandleType handleType, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemGetHandleForAddressRange + _check_or_init_driver() + if __cuMemGetHandleForAddressRange == NULL: + with gil: + raise FunctionNotFoundError("function cuMemGetHandleForAddressRange is not found") + return (__cuMemGetHandleForAddressRange)( + handle, dptr, size, handleType, flags) + + +cdef CUresult _cuMemBatchDecompressAsync(CUmemDecompressParams* paramsArray, size_t count, unsigned int flags, size_t* errorIndex, CUstream stream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemBatchDecompressAsync + _check_or_init_driver() + if __cuMemBatchDecompressAsync == NULL: + with gil: + raise FunctionNotFoundError("function cuMemBatchDecompressAsync is not found") + return (__cuMemBatchDecompressAsync)( + paramsArray, count, flags, errorIndex, stream) + + +cdef CUresult _cuMemAddressReserve(CUdeviceptr* ptr, size_t size, size_t alignment, CUdeviceptr addr, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemAddressReserve + _check_or_init_driver() + if __cuMemAddressReserve == NULL: + with gil: + raise FunctionNotFoundError("function cuMemAddressReserve is not found") + return (__cuMemAddressReserve)( + ptr, size, alignment, addr, flags) + + +cdef CUresult _cuMemAddressFree(CUdeviceptr ptr, size_t size) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemAddressFree + _check_or_init_driver() + if __cuMemAddressFree == NULL: + with gil: + raise FunctionNotFoundError("function cuMemAddressFree is not found") + return (__cuMemAddressFree)( + ptr, size) + + +cdef CUresult _cuMemCreate(CUmemGenericAllocationHandle* handle, size_t size, const CUmemAllocationProp* prop, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemCreate + _check_or_init_driver() + if __cuMemCreate == NULL: + with gil: + raise FunctionNotFoundError("function cuMemCreate is not found") + return (__cuMemCreate)( + handle, size, prop, flags) + + +cdef CUresult _cuMemRelease(CUmemGenericAllocationHandle handle) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemRelease + _check_or_init_driver() + if __cuMemRelease == NULL: + with gil: + raise FunctionNotFoundError("function cuMemRelease is not found") + return (__cuMemRelease)( + handle) + + +cdef CUresult _cuMemMap(CUdeviceptr ptr, size_t size, size_t offset, CUmemGenericAllocationHandle handle, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemMap + _check_or_init_driver() + if __cuMemMap == NULL: + with gil: + raise FunctionNotFoundError("function cuMemMap is not found") + return (__cuMemMap)( + ptr, size, offset, handle, flags) + + +cdef CUresult _cuMemMapArrayAsync(CUarrayMapInfo* mapInfoList, unsigned int count, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemMapArrayAsync + _check_or_init_driver() + if __cuMemMapArrayAsync == NULL: + with gil: + raise FunctionNotFoundError("function cuMemMapArrayAsync is not found") + return (__cuMemMapArrayAsync)( + mapInfoList, count, hStream) + + +cdef CUresult _cuMemUnmap(CUdeviceptr ptr, size_t size) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemUnmap + _check_or_init_driver() + if __cuMemUnmap == NULL: + with gil: + raise FunctionNotFoundError("function cuMemUnmap is not found") + return (__cuMemUnmap)( + ptr, size) + + +cdef CUresult _cuMemSetAccess(CUdeviceptr ptr, size_t size, const CUmemAccessDesc* desc, size_t count) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemSetAccess + _check_or_init_driver() + if __cuMemSetAccess == NULL: + with gil: + raise FunctionNotFoundError("function cuMemSetAccess is not found") + return (__cuMemSetAccess)( + ptr, size, desc, count) + + +cdef CUresult _cuMemGetAccess(unsigned long long* flags, const CUmemLocation* location, CUdeviceptr ptr) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemGetAccess + _check_or_init_driver() + if __cuMemGetAccess == NULL: + with gil: + raise FunctionNotFoundError("function cuMemGetAccess is not found") + return (__cuMemGetAccess)( + flags, location, ptr) + + +cdef CUresult _cuMemExportToShareableHandle(void* shareableHandle, CUmemGenericAllocationHandle handle, CUmemAllocationHandleType handleType, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemExportToShareableHandle + _check_or_init_driver() + if __cuMemExportToShareableHandle == NULL: + with gil: + raise FunctionNotFoundError("function cuMemExportToShareableHandle is not found") + return (__cuMemExportToShareableHandle)( + shareableHandle, handle, handleType, flags) + + +cdef CUresult _cuMemImportFromShareableHandle(CUmemGenericAllocationHandle* handle, void* osHandle, CUmemAllocationHandleType shHandleType) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemImportFromShareableHandle + _check_or_init_driver() + if __cuMemImportFromShareableHandle == NULL: + with gil: + raise FunctionNotFoundError("function cuMemImportFromShareableHandle is not found") + return (__cuMemImportFromShareableHandle)( + handle, osHandle, shHandleType) + + +cdef CUresult _cuMemGetAllocationGranularity(size_t* granularity, const CUmemAllocationProp* prop, CUmemAllocationGranularity_flags option) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemGetAllocationGranularity + _check_or_init_driver() + if __cuMemGetAllocationGranularity == NULL: + with gil: + raise FunctionNotFoundError("function cuMemGetAllocationGranularity is not found") + return (__cuMemGetAllocationGranularity)( + granularity, prop, option) + + +cdef CUresult _cuMemGetAllocationPropertiesFromHandle(CUmemAllocationProp* prop, CUmemGenericAllocationHandle handle) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemGetAllocationPropertiesFromHandle + _check_or_init_driver() + if __cuMemGetAllocationPropertiesFromHandle == NULL: + with gil: + raise FunctionNotFoundError("function cuMemGetAllocationPropertiesFromHandle is not found") + return (__cuMemGetAllocationPropertiesFromHandle)( + prop, handle) + + +cdef CUresult _cuMemRetainAllocationHandle(CUmemGenericAllocationHandle* handle, void* addr) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemRetainAllocationHandle + _check_or_init_driver() + if __cuMemRetainAllocationHandle == NULL: + with gil: + raise FunctionNotFoundError("function cuMemRetainAllocationHandle is not found") + return (__cuMemRetainAllocationHandle)( + handle, addr) + + +cdef CUresult _cuMemFreeAsync(CUdeviceptr dptr, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemFreeAsync + _check_or_init_driver() + if __cuMemFreeAsync == NULL: + with gil: + raise FunctionNotFoundError("function cuMemFreeAsync is not found") + return (__cuMemFreeAsync)( + dptr, hStream) + + +cdef CUresult _cuMemAllocAsync(CUdeviceptr* dptr, size_t bytesize, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemAllocAsync + _check_or_init_driver() + if __cuMemAllocAsync == NULL: + with gil: + raise FunctionNotFoundError("function cuMemAllocAsync is not found") + return (__cuMemAllocAsync)( + dptr, bytesize, hStream) + + +cdef CUresult _cuMemPoolTrimTo(CUmemoryPool pool, size_t minBytesToKeep) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemPoolTrimTo + _check_or_init_driver() + if __cuMemPoolTrimTo == NULL: + with gil: + raise FunctionNotFoundError("function cuMemPoolTrimTo is not found") + return (__cuMemPoolTrimTo)( + pool, minBytesToKeep) + + +cdef CUresult _cuMemPoolSetAttribute(CUmemoryPool pool, CUmemPool_attribute attr, void* value) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemPoolSetAttribute + _check_or_init_driver() + if __cuMemPoolSetAttribute == NULL: + with gil: + raise FunctionNotFoundError("function cuMemPoolSetAttribute is not found") + return (__cuMemPoolSetAttribute)( + pool, attr, value) + + +cdef CUresult _cuMemPoolGetAttribute(CUmemoryPool pool, CUmemPool_attribute attr, void* value) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemPoolGetAttribute + _check_or_init_driver() + if __cuMemPoolGetAttribute == NULL: + with gil: + raise FunctionNotFoundError("function cuMemPoolGetAttribute is not found") + return (__cuMemPoolGetAttribute)( + pool, attr, value) + + +cdef CUresult _cuMemPoolSetAccess(CUmemoryPool pool, const CUmemAccessDesc* map, size_t count) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemPoolSetAccess + _check_or_init_driver() + if __cuMemPoolSetAccess == NULL: + with gil: + raise FunctionNotFoundError("function cuMemPoolSetAccess is not found") + return (__cuMemPoolSetAccess)( + pool, map, count) + + +cdef CUresult _cuMemPoolGetAccess(CUmemAccess_flags* flags, CUmemoryPool memPool, CUmemLocation* location) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemPoolGetAccess + _check_or_init_driver() + if __cuMemPoolGetAccess == NULL: + with gil: + raise FunctionNotFoundError("function cuMemPoolGetAccess is not found") + return (__cuMemPoolGetAccess)( + flags, memPool, location) + + +cdef CUresult _cuMemPoolCreate(CUmemoryPool* pool, const CUmemPoolProps* poolProps) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemPoolCreate + _check_or_init_driver() + if __cuMemPoolCreate == NULL: + with gil: + raise FunctionNotFoundError("function cuMemPoolCreate is not found") + return (__cuMemPoolCreate)( + pool, poolProps) + + +cdef CUresult _cuMemPoolDestroy(CUmemoryPool pool) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemPoolDestroy + _check_or_init_driver() + if __cuMemPoolDestroy == NULL: + with gil: + raise FunctionNotFoundError("function cuMemPoolDestroy is not found") + return (__cuMemPoolDestroy)( + pool) + + +cdef CUresult _cuMemAllocFromPoolAsync(CUdeviceptr* dptr, size_t bytesize, CUmemoryPool pool, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemAllocFromPoolAsync + _check_or_init_driver() + if __cuMemAllocFromPoolAsync == NULL: + with gil: + raise FunctionNotFoundError("function cuMemAllocFromPoolAsync is not found") + return (__cuMemAllocFromPoolAsync)( + dptr, bytesize, pool, hStream) + + +cdef CUresult _cuMemPoolExportToShareableHandle(void* handle_out, CUmemoryPool pool, CUmemAllocationHandleType handleType, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemPoolExportToShareableHandle + _check_or_init_driver() + if __cuMemPoolExportToShareableHandle == NULL: + with gil: + raise FunctionNotFoundError("function cuMemPoolExportToShareableHandle is not found") + return (__cuMemPoolExportToShareableHandle)( + handle_out, pool, handleType, flags) + + +cdef CUresult _cuMemPoolImportFromShareableHandle(CUmemoryPool* pool_out, void* handle, CUmemAllocationHandleType handleType, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemPoolImportFromShareableHandle + _check_or_init_driver() + if __cuMemPoolImportFromShareableHandle == NULL: + with gil: + raise FunctionNotFoundError("function cuMemPoolImportFromShareableHandle is not found") + return (__cuMemPoolImportFromShareableHandle)( + pool_out, handle, handleType, flags) + + +cdef CUresult _cuMemPoolExportPointer(CUmemPoolPtrExportData* shareData_out, CUdeviceptr ptr) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemPoolExportPointer + _check_or_init_driver() + if __cuMemPoolExportPointer == NULL: + with gil: + raise FunctionNotFoundError("function cuMemPoolExportPointer is not found") + return (__cuMemPoolExportPointer)( + shareData_out, ptr) + + +cdef CUresult _cuMemPoolImportPointer(CUdeviceptr* ptr_out, CUmemoryPool pool, CUmemPoolPtrExportData* shareData) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemPoolImportPointer + _check_or_init_driver() + if __cuMemPoolImportPointer == NULL: + with gil: + raise FunctionNotFoundError("function cuMemPoolImportPointer is not found") + return (__cuMemPoolImportPointer)( + ptr_out, pool, shareData) + + +cdef CUresult _cuMulticastCreate(CUmemGenericAllocationHandle* mcHandle, const CUmulticastObjectProp* prop) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMulticastCreate + _check_or_init_driver() + if __cuMulticastCreate == NULL: + with gil: + raise FunctionNotFoundError("function cuMulticastCreate is not found") + return (__cuMulticastCreate)( + mcHandle, prop) + + +cdef CUresult _cuMulticastAddDevice(CUmemGenericAllocationHandle mcHandle, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMulticastAddDevice + _check_or_init_driver() + if __cuMulticastAddDevice == NULL: + with gil: + raise FunctionNotFoundError("function cuMulticastAddDevice is not found") + return (__cuMulticastAddDevice)( + mcHandle, dev) + + +cdef CUresult _cuMulticastBindMem(CUmemGenericAllocationHandle mcHandle, size_t mcOffset, CUmemGenericAllocationHandle memHandle, size_t memOffset, size_t size, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMulticastBindMem + _check_or_init_driver() + if __cuMulticastBindMem == NULL: + with gil: + raise FunctionNotFoundError("function cuMulticastBindMem is not found") + return (__cuMulticastBindMem)( + mcHandle, mcOffset, memHandle, memOffset, size, flags) + + +cdef CUresult _cuMulticastBindAddr(CUmemGenericAllocationHandle mcHandle, size_t mcOffset, CUdeviceptr memptr, size_t size, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMulticastBindAddr + _check_or_init_driver() + if __cuMulticastBindAddr == NULL: + with gil: + raise FunctionNotFoundError("function cuMulticastBindAddr is not found") + return (__cuMulticastBindAddr)( + mcHandle, mcOffset, memptr, size, flags) + + +cdef CUresult _cuMulticastUnbind(CUmemGenericAllocationHandle mcHandle, CUdevice dev, size_t mcOffset, size_t size) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMulticastUnbind + _check_or_init_driver() + if __cuMulticastUnbind == NULL: + with gil: + raise FunctionNotFoundError("function cuMulticastUnbind is not found") + return (__cuMulticastUnbind)( + mcHandle, dev, mcOffset, size) + + +cdef CUresult _cuMulticastGetGranularity(size_t* granularity, const CUmulticastObjectProp* prop, CUmulticastGranularity_flags option) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMulticastGetGranularity + _check_or_init_driver() + if __cuMulticastGetGranularity == NULL: + with gil: + raise FunctionNotFoundError("function cuMulticastGetGranularity is not found") + return (__cuMulticastGetGranularity)( + granularity, prop, option) + + +cdef CUresult _cuPointerGetAttribute(void* data, CUpointer_attribute attribute, CUdeviceptr ptr) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuPointerGetAttribute + _check_or_init_driver() + if __cuPointerGetAttribute == NULL: + with gil: + raise FunctionNotFoundError("function cuPointerGetAttribute is not found") + return (__cuPointerGetAttribute)( + data, attribute, ptr) + + +cdef CUresult _cuMemPrefetchAsync_v2(CUdeviceptr devPtr, size_t count, CUmemLocation location, unsigned int flags, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemPrefetchAsync_v2 + _check_or_init_driver() + if __cuMemPrefetchAsync_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemPrefetchAsync_v2 is not found") + return (__cuMemPrefetchAsync_v2)( + devPtr, count, location, flags, hStream) + + +cdef CUresult _cuMemAdvise_v2(CUdeviceptr devPtr, size_t count, CUmem_advise advice, CUmemLocation location) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemAdvise_v2 + _check_or_init_driver() + if __cuMemAdvise_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemAdvise_v2 is not found") + return (__cuMemAdvise_v2)( + devPtr, count, advice, location) + + +cdef CUresult _cuMemRangeGetAttribute(void* data, size_t dataSize, CUmem_range_attribute attribute, CUdeviceptr devPtr, size_t count) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemRangeGetAttribute + _check_or_init_driver() + if __cuMemRangeGetAttribute == NULL: + with gil: + raise FunctionNotFoundError("function cuMemRangeGetAttribute is not found") + return (__cuMemRangeGetAttribute)( + data, dataSize, attribute, devPtr, count) + + +cdef CUresult _cuMemRangeGetAttributes(void** data, size_t* dataSizes, CUmem_range_attribute* attributes, size_t numAttributes, CUdeviceptr devPtr, size_t count) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemRangeGetAttributes + _check_or_init_driver() + if __cuMemRangeGetAttributes == NULL: + with gil: + raise FunctionNotFoundError("function cuMemRangeGetAttributes is not found") + return (__cuMemRangeGetAttributes)( + data, dataSizes, attributes, numAttributes, devPtr, count) + + +cdef CUresult _cuPointerSetAttribute(const void* value, CUpointer_attribute attribute, CUdeviceptr ptr) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuPointerSetAttribute + _check_or_init_driver() + if __cuPointerSetAttribute == NULL: + with gil: + raise FunctionNotFoundError("function cuPointerSetAttribute is not found") + return (__cuPointerSetAttribute)( + value, attribute, ptr) + + +cdef CUresult _cuPointerGetAttributes(unsigned int numAttributes, CUpointer_attribute* attributes, void** data, CUdeviceptr ptr) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuPointerGetAttributes + _check_or_init_driver() + if __cuPointerGetAttributes == NULL: + with gil: + raise FunctionNotFoundError("function cuPointerGetAttributes is not found") + return (__cuPointerGetAttributes)( + numAttributes, attributes, data, ptr) + + +cdef CUresult _cuStreamCreate(CUstream* phStream, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamCreate + _check_or_init_driver() + if __cuStreamCreate == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamCreate is not found") + return (__cuStreamCreate)( + phStream, Flags) + + +cdef CUresult _cuStreamCreateWithPriority(CUstream* phStream, unsigned int flags, int priority) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamCreateWithPriority + _check_or_init_driver() + if __cuStreamCreateWithPriority == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamCreateWithPriority is not found") + return (__cuStreamCreateWithPriority)( + phStream, flags, priority) + + +cdef CUresult _cuStreamGetPriority(CUstream hStream, int* priority) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamGetPriority + _check_or_init_driver() + if __cuStreamGetPriority == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamGetPriority is not found") + return (__cuStreamGetPriority)( + hStream, priority) + + +cdef CUresult _cuStreamGetDevice(CUstream hStream, CUdevice* device) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamGetDevice + _check_or_init_driver() + if __cuStreamGetDevice == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamGetDevice is not found") + return (__cuStreamGetDevice)( + hStream, device) + + +cdef CUresult _cuStreamGetFlags(CUstream hStream, unsigned int* flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamGetFlags + _check_or_init_driver() + if __cuStreamGetFlags == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamGetFlags is not found") + return (__cuStreamGetFlags)( + hStream, flags) + + +cdef CUresult _cuStreamGetId(CUstream hStream, unsigned long long* streamId) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamGetId + _check_or_init_driver() + if __cuStreamGetId == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamGetId is not found") + return (__cuStreamGetId)( + hStream, streamId) + + +cdef CUresult _cuStreamGetCtx(CUstream hStream, CUcontext* pctx) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamGetCtx + _check_or_init_driver() + if __cuStreamGetCtx == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamGetCtx is not found") + return (__cuStreamGetCtx)( + hStream, pctx) + + +cdef CUresult _cuStreamGetCtx_v2(CUstream hStream, CUcontext* pCtx, CUgreenCtx* pGreenCtx) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamGetCtx_v2 + _check_or_init_driver() + if __cuStreamGetCtx_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamGetCtx_v2 is not found") + return (__cuStreamGetCtx_v2)( + hStream, pCtx, pGreenCtx) + + +cdef CUresult _cuStreamWaitEvent(CUstream hStream, CUevent hEvent, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamWaitEvent + _check_or_init_driver() + if __cuStreamWaitEvent == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamWaitEvent is not found") + return (__cuStreamWaitEvent)( + hStream, hEvent, Flags) + + +cdef CUresult _cuStreamAddCallback(CUstream hStream, CUstreamCallback callback, void* userData, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamAddCallback + _check_or_init_driver() + if __cuStreamAddCallback == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamAddCallback is not found") + return (__cuStreamAddCallback)( + hStream, callback, userData, flags) + + +cdef CUresult _cuStreamBeginCapture_v2(CUstream hStream, CUstreamCaptureMode mode) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamBeginCapture_v2 + _check_or_init_driver() + if __cuStreamBeginCapture_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamBeginCapture_v2 is not found") + return (__cuStreamBeginCapture_v2)( + hStream, mode) + + +cdef CUresult _cuStreamBeginCaptureToGraph(CUstream hStream, CUgraph hGraph, const CUgraphNode* dependencies, const CUgraphEdgeData* dependencyData, size_t numDependencies, CUstreamCaptureMode mode) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamBeginCaptureToGraph + _check_or_init_driver() + if __cuStreamBeginCaptureToGraph == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamBeginCaptureToGraph is not found") + return (__cuStreamBeginCaptureToGraph)( + hStream, hGraph, dependencies, dependencyData, numDependencies, mode) + + +cdef CUresult _cuThreadExchangeStreamCaptureMode(CUstreamCaptureMode* mode) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuThreadExchangeStreamCaptureMode + _check_or_init_driver() + if __cuThreadExchangeStreamCaptureMode == NULL: + with gil: + raise FunctionNotFoundError("function cuThreadExchangeStreamCaptureMode is not found") + return (__cuThreadExchangeStreamCaptureMode)( + mode) + + +cdef CUresult _cuStreamEndCapture(CUstream hStream, CUgraph* phGraph) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamEndCapture + _check_or_init_driver() + if __cuStreamEndCapture == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamEndCapture is not found") + return (__cuStreamEndCapture)( + hStream, phGraph) + + +cdef CUresult _cuStreamIsCapturing(CUstream hStream, CUstreamCaptureStatus* captureStatus) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamIsCapturing + _check_or_init_driver() + if __cuStreamIsCapturing == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamIsCapturing is not found") + return (__cuStreamIsCapturing)( + hStream, captureStatus) + + +cdef CUresult _cuStreamGetCaptureInfo_v2(CUstream hStream, CUstreamCaptureStatus* captureStatus_out, cuuint64_t* id_out, CUgraph* graph_out, const CUgraphNode** dependencies_out, size_t* numDependencies_out) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamGetCaptureInfo_v2 + _check_or_init_driver() + if __cuStreamGetCaptureInfo_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamGetCaptureInfo_v2 is not found") + return (__cuStreamGetCaptureInfo_v2)( + hStream, captureStatus_out, id_out, graph_out, dependencies_out, numDependencies_out) + + +cdef CUresult _cuStreamGetCaptureInfo_v3(CUstream hStream, CUstreamCaptureStatus* captureStatus_out, cuuint64_t* id_out, CUgraph* graph_out, const CUgraphNode** dependencies_out, const CUgraphEdgeData** edgeData_out, size_t* numDependencies_out) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamGetCaptureInfo_v3 + _check_or_init_driver() + if __cuStreamGetCaptureInfo_v3 == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamGetCaptureInfo_v3 is not found") + return (__cuStreamGetCaptureInfo_v3)( + hStream, captureStatus_out, id_out, graph_out, dependencies_out, edgeData_out, numDependencies_out) + + +cdef CUresult _cuStreamUpdateCaptureDependencies_v2(CUstream hStream, CUgraphNode* dependencies, const CUgraphEdgeData* dependencyData, size_t numDependencies, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamUpdateCaptureDependencies_v2 + _check_or_init_driver() + if __cuStreamUpdateCaptureDependencies_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamUpdateCaptureDependencies_v2 is not found") + return (__cuStreamUpdateCaptureDependencies_v2)( + hStream, dependencies, dependencyData, numDependencies, flags) + + +cdef CUresult _cuStreamAttachMemAsync(CUstream hStream, CUdeviceptr dptr, size_t length, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamAttachMemAsync + _check_or_init_driver() + if __cuStreamAttachMemAsync == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamAttachMemAsync is not found") + return (__cuStreamAttachMemAsync)( + hStream, dptr, length, flags) + + +cdef CUresult _cuStreamQuery(CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamQuery + _check_or_init_driver() + if __cuStreamQuery == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamQuery is not found") + return (__cuStreamQuery)( + hStream) + + +cdef CUresult _cuStreamSynchronize(CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamSynchronize + _check_or_init_driver() + if __cuStreamSynchronize == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamSynchronize is not found") + return (__cuStreamSynchronize)( + hStream) + + +cdef CUresult _cuStreamDestroy_v2(CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamDestroy_v2 + _check_or_init_driver() + if __cuStreamDestroy_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamDestroy_v2 is not found") + return (__cuStreamDestroy_v2)( + hStream) + + +cdef CUresult _cuStreamCopyAttributes(CUstream dst, CUstream src) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamCopyAttributes + _check_or_init_driver() + if __cuStreamCopyAttributes == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamCopyAttributes is not found") + return (__cuStreamCopyAttributes)( + dst, src) + + +cdef CUresult _cuStreamGetAttribute(CUstream hStream, CUstreamAttrID attr, CUstreamAttrValue* value_out) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamGetAttribute + _check_or_init_driver() + if __cuStreamGetAttribute == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamGetAttribute is not found") + return (__cuStreamGetAttribute)( + hStream, attr, value_out) + + +cdef CUresult _cuStreamSetAttribute(CUstream hStream, CUstreamAttrID attr, const CUstreamAttrValue* value) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamSetAttribute + _check_or_init_driver() + if __cuStreamSetAttribute == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamSetAttribute is not found") + return (__cuStreamSetAttribute)( + hStream, attr, value) + + +cdef CUresult _cuEventCreate(CUevent* phEvent, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuEventCreate + _check_or_init_driver() + if __cuEventCreate == NULL: + with gil: + raise FunctionNotFoundError("function cuEventCreate is not found") + return (__cuEventCreate)( + phEvent, Flags) + + +cdef CUresult _cuEventRecord(CUevent hEvent, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuEventRecord + _check_or_init_driver() + if __cuEventRecord == NULL: + with gil: + raise FunctionNotFoundError("function cuEventRecord is not found") + return (__cuEventRecord)( + hEvent, hStream) + + +cdef CUresult _cuEventRecordWithFlags(CUevent hEvent, CUstream hStream, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuEventRecordWithFlags + _check_or_init_driver() + if __cuEventRecordWithFlags == NULL: + with gil: + raise FunctionNotFoundError("function cuEventRecordWithFlags is not found") + return (__cuEventRecordWithFlags)( + hEvent, hStream, flags) + + +cdef CUresult _cuEventQuery(CUevent hEvent) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuEventQuery + _check_or_init_driver() + if __cuEventQuery == NULL: + with gil: + raise FunctionNotFoundError("function cuEventQuery is not found") + return (__cuEventQuery)( + hEvent) + + +cdef CUresult _cuEventSynchronize(CUevent hEvent) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuEventSynchronize + _check_or_init_driver() + if __cuEventSynchronize == NULL: + with gil: + raise FunctionNotFoundError("function cuEventSynchronize is not found") + return (__cuEventSynchronize)( + hEvent) + + +cdef CUresult _cuEventDestroy_v2(CUevent hEvent) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuEventDestroy_v2 + _check_or_init_driver() + if __cuEventDestroy_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuEventDestroy_v2 is not found") + return (__cuEventDestroy_v2)( + hEvent) + + +cdef CUresult _cuEventElapsedTime_v2(float* pMilliseconds, CUevent hStart, CUevent hEnd) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuEventElapsedTime_v2 + _check_or_init_driver() + if __cuEventElapsedTime_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuEventElapsedTime_v2 is not found") + return (__cuEventElapsedTime_v2)( + pMilliseconds, hStart, hEnd) + + +cdef CUresult _cuImportExternalMemory(CUexternalMemory* extMem_out, const CUDA_EXTERNAL_MEMORY_HANDLE_DESC* memHandleDesc) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuImportExternalMemory + _check_or_init_driver() + if __cuImportExternalMemory == NULL: + with gil: + raise FunctionNotFoundError("function cuImportExternalMemory is not found") + return (__cuImportExternalMemory)( + extMem_out, memHandleDesc) + + +cdef CUresult _cuExternalMemoryGetMappedBuffer(CUdeviceptr* devPtr, CUexternalMemory extMem, const CUDA_EXTERNAL_MEMORY_BUFFER_DESC* bufferDesc) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuExternalMemoryGetMappedBuffer + _check_or_init_driver() + if __cuExternalMemoryGetMappedBuffer == NULL: + with gil: + raise FunctionNotFoundError("function cuExternalMemoryGetMappedBuffer is not found") + return (__cuExternalMemoryGetMappedBuffer)( + devPtr, extMem, bufferDesc) + + +cdef CUresult _cuExternalMemoryGetMappedMipmappedArray(CUmipmappedArray* mipmap, CUexternalMemory extMem, const CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC* mipmapDesc) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuExternalMemoryGetMappedMipmappedArray + _check_or_init_driver() + if __cuExternalMemoryGetMappedMipmappedArray == NULL: + with gil: + raise FunctionNotFoundError("function cuExternalMemoryGetMappedMipmappedArray is not found") + return (__cuExternalMemoryGetMappedMipmappedArray)( + mipmap, extMem, mipmapDesc) + + +cdef CUresult _cuDestroyExternalMemory(CUexternalMemory extMem) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDestroyExternalMemory + _check_or_init_driver() + if __cuDestroyExternalMemory == NULL: + with gil: + raise FunctionNotFoundError("function cuDestroyExternalMemory is not found") + return (__cuDestroyExternalMemory)( + extMem) + + +cdef CUresult _cuImportExternalSemaphore(CUexternalSemaphore* extSem_out, const CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC* semHandleDesc) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuImportExternalSemaphore + _check_or_init_driver() + if __cuImportExternalSemaphore == NULL: + with gil: + raise FunctionNotFoundError("function cuImportExternalSemaphore is not found") + return (__cuImportExternalSemaphore)( + extSem_out, semHandleDesc) + + +cdef CUresult _cuSignalExternalSemaphoresAsync(const CUexternalSemaphore* extSemArray, const CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS* paramsArray, unsigned int numExtSems, CUstream stream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuSignalExternalSemaphoresAsync + _check_or_init_driver() + if __cuSignalExternalSemaphoresAsync == NULL: + with gil: + raise FunctionNotFoundError("function cuSignalExternalSemaphoresAsync is not found") + return (__cuSignalExternalSemaphoresAsync)( + extSemArray, paramsArray, numExtSems, stream) + + +cdef CUresult _cuWaitExternalSemaphoresAsync(const CUexternalSemaphore* extSemArray, const CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS* paramsArray, unsigned int numExtSems, CUstream stream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuWaitExternalSemaphoresAsync + _check_or_init_driver() + if __cuWaitExternalSemaphoresAsync == NULL: + with gil: + raise FunctionNotFoundError("function cuWaitExternalSemaphoresAsync is not found") + return (__cuWaitExternalSemaphoresAsync)( + extSemArray, paramsArray, numExtSems, stream) + + +cdef CUresult _cuDestroyExternalSemaphore(CUexternalSemaphore extSem) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDestroyExternalSemaphore + _check_or_init_driver() + if __cuDestroyExternalSemaphore == NULL: + with gil: + raise FunctionNotFoundError("function cuDestroyExternalSemaphore is not found") + return (__cuDestroyExternalSemaphore)( + extSem) + + +cdef CUresult _cuStreamWaitValue32_v2(CUstream stream, CUdeviceptr addr, cuuint32_t value, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamWaitValue32_v2 + _check_or_init_driver() + if __cuStreamWaitValue32_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamWaitValue32_v2 is not found") + return (__cuStreamWaitValue32_v2)( + stream, addr, value, flags) + + +cdef CUresult _cuStreamWaitValue64_v2(CUstream stream, CUdeviceptr addr, cuuint64_t value, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamWaitValue64_v2 + _check_or_init_driver() + if __cuStreamWaitValue64_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamWaitValue64_v2 is not found") + return (__cuStreamWaitValue64_v2)( + stream, addr, value, flags) + + +cdef CUresult _cuStreamWriteValue32_v2(CUstream stream, CUdeviceptr addr, cuuint32_t value, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamWriteValue32_v2 + _check_or_init_driver() + if __cuStreamWriteValue32_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamWriteValue32_v2 is not found") + return (__cuStreamWriteValue32_v2)( + stream, addr, value, flags) + + +cdef CUresult _cuStreamWriteValue64_v2(CUstream stream, CUdeviceptr addr, cuuint64_t value, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamWriteValue64_v2 + _check_or_init_driver() + if __cuStreamWriteValue64_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamWriteValue64_v2 is not found") + return (__cuStreamWriteValue64_v2)( + stream, addr, value, flags) + + +cdef CUresult _cuStreamBatchMemOp_v2(CUstream stream, unsigned int count, CUstreamBatchMemOpParams* paramArray, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamBatchMemOp_v2 + _check_or_init_driver() + if __cuStreamBatchMemOp_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamBatchMemOp_v2 is not found") + return (__cuStreamBatchMemOp_v2)( + stream, count, paramArray, flags) + + +cdef CUresult _cuFuncGetAttribute(int* pi, CUfunction_attribute attrib, CUfunction hfunc) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuFuncGetAttribute + _check_or_init_driver() + if __cuFuncGetAttribute == NULL: + with gil: + raise FunctionNotFoundError("function cuFuncGetAttribute is not found") + return (__cuFuncGetAttribute)( + pi, attrib, hfunc) + + +cdef CUresult _cuFuncSetAttribute(CUfunction hfunc, CUfunction_attribute attrib, int value) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuFuncSetAttribute + _check_or_init_driver() + if __cuFuncSetAttribute == NULL: + with gil: + raise FunctionNotFoundError("function cuFuncSetAttribute is not found") + return (__cuFuncSetAttribute)( + hfunc, attrib, value) + + +cdef CUresult _cuFuncSetCacheConfig(CUfunction hfunc, CUfunc_cache config) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuFuncSetCacheConfig + _check_or_init_driver() + if __cuFuncSetCacheConfig == NULL: + with gil: + raise FunctionNotFoundError("function cuFuncSetCacheConfig is not found") + return (__cuFuncSetCacheConfig)( + hfunc, config) + + +cdef CUresult _cuFuncGetModule(CUmodule* hmod, CUfunction hfunc) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuFuncGetModule + _check_or_init_driver() + if __cuFuncGetModule == NULL: + with gil: + raise FunctionNotFoundError("function cuFuncGetModule is not found") + return (__cuFuncGetModule)( + hmod, hfunc) + + +cdef CUresult _cuFuncGetName(const char** name, CUfunction hfunc) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuFuncGetName + _check_or_init_driver() + if __cuFuncGetName == NULL: + with gil: + raise FunctionNotFoundError("function cuFuncGetName is not found") + return (__cuFuncGetName)( + name, hfunc) + + +cdef CUresult _cuFuncGetParamInfo(CUfunction func, size_t paramIndex, size_t* paramOffset, size_t* paramSize) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuFuncGetParamInfo + _check_or_init_driver() + if __cuFuncGetParamInfo == NULL: + with gil: + raise FunctionNotFoundError("function cuFuncGetParamInfo is not found") + return (__cuFuncGetParamInfo)( + func, paramIndex, paramOffset, paramSize) + + +cdef CUresult _cuFuncIsLoaded(CUfunctionLoadingState* state, CUfunction function) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuFuncIsLoaded + _check_or_init_driver() + if __cuFuncIsLoaded == NULL: + with gil: + raise FunctionNotFoundError("function cuFuncIsLoaded is not found") + return (__cuFuncIsLoaded)( + state, function) + + +cdef CUresult _cuFuncLoad(CUfunction function) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuFuncLoad + _check_or_init_driver() + if __cuFuncLoad == NULL: + with gil: + raise FunctionNotFoundError("function cuFuncLoad is not found") + return (__cuFuncLoad)( + function) + + +cdef CUresult _cuLaunchKernel(CUfunction f, unsigned int gridDimX, unsigned int gridDimY, unsigned int gridDimZ, unsigned int blockDimX, unsigned int blockDimY, unsigned int blockDimZ, unsigned int sharedMemBytes, CUstream hStream, void** kernelParams, void** extra) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLaunchKernel + _check_or_init_driver() + if __cuLaunchKernel == NULL: + with gil: + raise FunctionNotFoundError("function cuLaunchKernel is not found") + return (__cuLaunchKernel)( + f, gridDimX, gridDimY, gridDimZ, blockDimX, blockDimY, blockDimZ, sharedMemBytes, hStream, kernelParams, extra) + + +cdef CUresult _cuLaunchKernelEx(const CUlaunchConfig* config, CUfunction f, void** kernelParams, void** extra) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLaunchKernelEx + _check_or_init_driver() + if __cuLaunchKernelEx == NULL: + with gil: + raise FunctionNotFoundError("function cuLaunchKernelEx is not found") + return (__cuLaunchKernelEx)( + config, f, kernelParams, extra) + + +cdef CUresult _cuLaunchCooperativeKernel(CUfunction f, unsigned int gridDimX, unsigned int gridDimY, unsigned int gridDimZ, unsigned int blockDimX, unsigned int blockDimY, unsigned int blockDimZ, unsigned int sharedMemBytes, CUstream hStream, void** kernelParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLaunchCooperativeKernel + _check_or_init_driver() + if __cuLaunchCooperativeKernel == NULL: + with gil: + raise FunctionNotFoundError("function cuLaunchCooperativeKernel is not found") + return (__cuLaunchCooperativeKernel)( + f, gridDimX, gridDimY, gridDimZ, blockDimX, blockDimY, blockDimZ, sharedMemBytes, hStream, kernelParams) + + +cdef CUresult _cuLaunchCooperativeKernelMultiDevice(CUDA_LAUNCH_PARAMS* launchParamsList, unsigned int numDevices, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLaunchCooperativeKernelMultiDevice + _check_or_init_driver() + if __cuLaunchCooperativeKernelMultiDevice == NULL: + with gil: + raise FunctionNotFoundError("function cuLaunchCooperativeKernelMultiDevice is not found") + return (__cuLaunchCooperativeKernelMultiDevice)( + launchParamsList, numDevices, flags) + + +cdef CUresult _cuLaunchHostFunc(CUstream hStream, CUhostFn fn, void* userData) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLaunchHostFunc + _check_or_init_driver() + if __cuLaunchHostFunc == NULL: + with gil: + raise FunctionNotFoundError("function cuLaunchHostFunc is not found") + return (__cuLaunchHostFunc)( + hStream, fn, userData) + + +cdef CUresult _cuFuncSetBlockShape(CUfunction hfunc, int x, int y, int z) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuFuncSetBlockShape + _check_or_init_driver() + if __cuFuncSetBlockShape == NULL: + with gil: + raise FunctionNotFoundError("function cuFuncSetBlockShape is not found") + return (__cuFuncSetBlockShape)( + hfunc, x, y, z) + + +cdef CUresult _cuFuncSetSharedSize(CUfunction hfunc, unsigned int bytes) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuFuncSetSharedSize + _check_or_init_driver() + if __cuFuncSetSharedSize == NULL: + with gil: + raise FunctionNotFoundError("function cuFuncSetSharedSize is not found") + return (__cuFuncSetSharedSize)( + hfunc, bytes) + + +cdef CUresult _cuParamSetSize(CUfunction hfunc, unsigned int numbytes) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuParamSetSize + _check_or_init_driver() + if __cuParamSetSize == NULL: + with gil: + raise FunctionNotFoundError("function cuParamSetSize is not found") + return (__cuParamSetSize)( + hfunc, numbytes) + + +cdef CUresult _cuParamSeti(CUfunction hfunc, int offset, unsigned int value) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuParamSeti + _check_or_init_driver() + if __cuParamSeti == NULL: + with gil: + raise FunctionNotFoundError("function cuParamSeti is not found") + return (__cuParamSeti)( + hfunc, offset, value) + + +cdef CUresult _cuParamSetf(CUfunction hfunc, int offset, float value) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuParamSetf + _check_or_init_driver() + if __cuParamSetf == NULL: + with gil: + raise FunctionNotFoundError("function cuParamSetf is not found") + return (__cuParamSetf)( + hfunc, offset, value) + + +cdef CUresult _cuParamSetv(CUfunction hfunc, int offset, void* ptr, unsigned int numbytes) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuParamSetv + _check_or_init_driver() + if __cuParamSetv == NULL: + with gil: + raise FunctionNotFoundError("function cuParamSetv is not found") + return (__cuParamSetv)( + hfunc, offset, ptr, numbytes) + + +cdef CUresult _cuLaunch(CUfunction f) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLaunch + _check_or_init_driver() + if __cuLaunch == NULL: + with gil: + raise FunctionNotFoundError("function cuLaunch is not found") + return (__cuLaunch)( + f) + + +cdef CUresult _cuLaunchGrid(CUfunction f, int grid_width, int grid_height) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLaunchGrid + _check_or_init_driver() + if __cuLaunchGrid == NULL: + with gil: + raise FunctionNotFoundError("function cuLaunchGrid is not found") + return (__cuLaunchGrid)( + f, grid_width, grid_height) + + +cdef CUresult _cuLaunchGridAsync(CUfunction f, int grid_width, int grid_height, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLaunchGridAsync + _check_or_init_driver() + if __cuLaunchGridAsync == NULL: + with gil: + raise FunctionNotFoundError("function cuLaunchGridAsync is not found") + return (__cuLaunchGridAsync)( + f, grid_width, grid_height, hStream) + + +cdef CUresult _cuParamSetTexRef(CUfunction hfunc, int texunit, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuParamSetTexRef + _check_or_init_driver() + if __cuParamSetTexRef == NULL: + with gil: + raise FunctionNotFoundError("function cuParamSetTexRef is not found") + return (__cuParamSetTexRef)( + hfunc, texunit, hTexRef) + + +cdef CUresult _cuFuncSetSharedMemConfig(CUfunction hfunc, CUsharedconfig config) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuFuncSetSharedMemConfig + _check_or_init_driver() + if __cuFuncSetSharedMemConfig == NULL: + with gil: + raise FunctionNotFoundError("function cuFuncSetSharedMemConfig is not found") + return (__cuFuncSetSharedMemConfig)( + hfunc, config) + + +cdef CUresult _cuGraphCreate(CUgraph* phGraph, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphCreate + _check_or_init_driver() + if __cuGraphCreate == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphCreate is not found") + return (__cuGraphCreate)( + phGraph, flags) + + +cdef CUresult _cuGraphAddKernelNode_v2(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, const CUDA_KERNEL_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphAddKernelNode_v2 + _check_or_init_driver() + if __cuGraphAddKernelNode_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphAddKernelNode_v2 is not found") + return (__cuGraphAddKernelNode_v2)( + phGraphNode, hGraph, dependencies, numDependencies, nodeParams) + + +cdef CUresult _cuGraphKernelNodeGetParams_v2(CUgraphNode hNode, CUDA_KERNEL_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphKernelNodeGetParams_v2 + _check_or_init_driver() + if __cuGraphKernelNodeGetParams_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphKernelNodeGetParams_v2 is not found") + return (__cuGraphKernelNodeGetParams_v2)( + hNode, nodeParams) + + +cdef CUresult _cuGraphKernelNodeSetParams_v2(CUgraphNode hNode, const CUDA_KERNEL_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphKernelNodeSetParams_v2 + _check_or_init_driver() + if __cuGraphKernelNodeSetParams_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphKernelNodeSetParams_v2 is not found") + return (__cuGraphKernelNodeSetParams_v2)( + hNode, nodeParams) + + +cdef CUresult _cuGraphAddMemcpyNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, const CUDA_MEMCPY3D* copyParams, CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphAddMemcpyNode + _check_or_init_driver() + if __cuGraphAddMemcpyNode == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphAddMemcpyNode is not found") + return (__cuGraphAddMemcpyNode)( + phGraphNode, hGraph, dependencies, numDependencies, copyParams, ctx) + + +cdef CUresult _cuGraphMemcpyNodeGetParams(CUgraphNode hNode, CUDA_MEMCPY3D* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphMemcpyNodeGetParams + _check_or_init_driver() + if __cuGraphMemcpyNodeGetParams == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphMemcpyNodeGetParams is not found") + return (__cuGraphMemcpyNodeGetParams)( + hNode, nodeParams) + + +cdef CUresult _cuGraphMemcpyNodeSetParams(CUgraphNode hNode, const CUDA_MEMCPY3D* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphMemcpyNodeSetParams + _check_or_init_driver() + if __cuGraphMemcpyNodeSetParams == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphMemcpyNodeSetParams is not found") + return (__cuGraphMemcpyNodeSetParams)( + hNode, nodeParams) + + +cdef CUresult _cuGraphAddMemsetNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, const CUDA_MEMSET_NODE_PARAMS* memsetParams, CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphAddMemsetNode + _check_or_init_driver() + if __cuGraphAddMemsetNode == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphAddMemsetNode is not found") + return (__cuGraphAddMemsetNode)( + phGraphNode, hGraph, dependencies, numDependencies, memsetParams, ctx) + + +cdef CUresult _cuGraphMemsetNodeGetParams(CUgraphNode hNode, CUDA_MEMSET_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphMemsetNodeGetParams + _check_or_init_driver() + if __cuGraphMemsetNodeGetParams == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphMemsetNodeGetParams is not found") + return (__cuGraphMemsetNodeGetParams)( + hNode, nodeParams) + + +cdef CUresult _cuGraphMemsetNodeSetParams(CUgraphNode hNode, const CUDA_MEMSET_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphMemsetNodeSetParams + _check_or_init_driver() + if __cuGraphMemsetNodeSetParams == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphMemsetNodeSetParams is not found") + return (__cuGraphMemsetNodeSetParams)( + hNode, nodeParams) + + +cdef CUresult _cuGraphAddHostNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, const CUDA_HOST_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphAddHostNode + _check_or_init_driver() + if __cuGraphAddHostNode == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphAddHostNode is not found") + return (__cuGraphAddHostNode)( + phGraphNode, hGraph, dependencies, numDependencies, nodeParams) + + +cdef CUresult _cuGraphHostNodeGetParams(CUgraphNode hNode, CUDA_HOST_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphHostNodeGetParams + _check_or_init_driver() + if __cuGraphHostNodeGetParams == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphHostNodeGetParams is not found") + return (__cuGraphHostNodeGetParams)( + hNode, nodeParams) + + +cdef CUresult _cuGraphHostNodeSetParams(CUgraphNode hNode, const CUDA_HOST_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphHostNodeSetParams + _check_or_init_driver() + if __cuGraphHostNodeSetParams == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphHostNodeSetParams is not found") + return (__cuGraphHostNodeSetParams)( + hNode, nodeParams) + + +cdef CUresult _cuGraphAddChildGraphNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, CUgraph childGraph) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphAddChildGraphNode + _check_or_init_driver() + if __cuGraphAddChildGraphNode == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphAddChildGraphNode is not found") + return (__cuGraphAddChildGraphNode)( + phGraphNode, hGraph, dependencies, numDependencies, childGraph) + + +cdef CUresult _cuGraphChildGraphNodeGetGraph(CUgraphNode hNode, CUgraph* phGraph) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphChildGraphNodeGetGraph + _check_or_init_driver() + if __cuGraphChildGraphNodeGetGraph == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphChildGraphNodeGetGraph is not found") + return (__cuGraphChildGraphNodeGetGraph)( + hNode, phGraph) + + +cdef CUresult _cuGraphAddEmptyNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphAddEmptyNode + _check_or_init_driver() + if __cuGraphAddEmptyNode == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphAddEmptyNode is not found") + return (__cuGraphAddEmptyNode)( + phGraphNode, hGraph, dependencies, numDependencies) + + +cdef CUresult _cuGraphAddEventRecordNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, CUevent event) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphAddEventRecordNode + _check_or_init_driver() + if __cuGraphAddEventRecordNode == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphAddEventRecordNode is not found") + return (__cuGraphAddEventRecordNode)( + phGraphNode, hGraph, dependencies, numDependencies, event) + + +cdef CUresult _cuGraphEventRecordNodeGetEvent(CUgraphNode hNode, CUevent* event_out) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphEventRecordNodeGetEvent + _check_or_init_driver() + if __cuGraphEventRecordNodeGetEvent == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphEventRecordNodeGetEvent is not found") + return (__cuGraphEventRecordNodeGetEvent)( + hNode, event_out) + + +cdef CUresult _cuGraphEventRecordNodeSetEvent(CUgraphNode hNode, CUevent event) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphEventRecordNodeSetEvent + _check_or_init_driver() + if __cuGraphEventRecordNodeSetEvent == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphEventRecordNodeSetEvent is not found") + return (__cuGraphEventRecordNodeSetEvent)( + hNode, event) + + +cdef CUresult _cuGraphAddEventWaitNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, CUevent event) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphAddEventWaitNode + _check_or_init_driver() + if __cuGraphAddEventWaitNode == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphAddEventWaitNode is not found") + return (__cuGraphAddEventWaitNode)( + phGraphNode, hGraph, dependencies, numDependencies, event) + + +cdef CUresult _cuGraphEventWaitNodeGetEvent(CUgraphNode hNode, CUevent* event_out) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphEventWaitNodeGetEvent + _check_or_init_driver() + if __cuGraphEventWaitNodeGetEvent == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphEventWaitNodeGetEvent is not found") + return (__cuGraphEventWaitNodeGetEvent)( + hNode, event_out) + + +cdef CUresult _cuGraphEventWaitNodeSetEvent(CUgraphNode hNode, CUevent event) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphEventWaitNodeSetEvent + _check_or_init_driver() + if __cuGraphEventWaitNodeSetEvent == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphEventWaitNodeSetEvent is not found") + return (__cuGraphEventWaitNodeSetEvent)( + hNode, event) + + +cdef CUresult _cuGraphAddExternalSemaphoresSignalNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, const CUDA_EXT_SEM_SIGNAL_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphAddExternalSemaphoresSignalNode + _check_or_init_driver() + if __cuGraphAddExternalSemaphoresSignalNode == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphAddExternalSemaphoresSignalNode is not found") + return (__cuGraphAddExternalSemaphoresSignalNode)( + phGraphNode, hGraph, dependencies, numDependencies, nodeParams) + + +cdef CUresult _cuGraphExternalSemaphoresSignalNodeGetParams(CUgraphNode hNode, CUDA_EXT_SEM_SIGNAL_NODE_PARAMS* params_out) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphExternalSemaphoresSignalNodeGetParams + _check_or_init_driver() + if __cuGraphExternalSemaphoresSignalNodeGetParams == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphExternalSemaphoresSignalNodeGetParams is not found") + return (__cuGraphExternalSemaphoresSignalNodeGetParams)( + hNode, params_out) + + +cdef CUresult _cuGraphExternalSemaphoresSignalNodeSetParams(CUgraphNode hNode, const CUDA_EXT_SEM_SIGNAL_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphExternalSemaphoresSignalNodeSetParams + _check_or_init_driver() + if __cuGraphExternalSemaphoresSignalNodeSetParams == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphExternalSemaphoresSignalNodeSetParams is not found") + return (__cuGraphExternalSemaphoresSignalNodeSetParams)( + hNode, nodeParams) + + +cdef CUresult _cuGraphAddExternalSemaphoresWaitNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, const CUDA_EXT_SEM_WAIT_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphAddExternalSemaphoresWaitNode + _check_or_init_driver() + if __cuGraphAddExternalSemaphoresWaitNode == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphAddExternalSemaphoresWaitNode is not found") + return (__cuGraphAddExternalSemaphoresWaitNode)( + phGraphNode, hGraph, dependencies, numDependencies, nodeParams) + + +cdef CUresult _cuGraphExternalSemaphoresWaitNodeGetParams(CUgraphNode hNode, CUDA_EXT_SEM_WAIT_NODE_PARAMS* params_out) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphExternalSemaphoresWaitNodeGetParams + _check_or_init_driver() + if __cuGraphExternalSemaphoresWaitNodeGetParams == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphExternalSemaphoresWaitNodeGetParams is not found") + return (__cuGraphExternalSemaphoresWaitNodeGetParams)( + hNode, params_out) + + +cdef CUresult _cuGraphExternalSemaphoresWaitNodeSetParams(CUgraphNode hNode, const CUDA_EXT_SEM_WAIT_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphExternalSemaphoresWaitNodeSetParams + _check_or_init_driver() + if __cuGraphExternalSemaphoresWaitNodeSetParams == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphExternalSemaphoresWaitNodeSetParams is not found") + return (__cuGraphExternalSemaphoresWaitNodeSetParams)( + hNode, nodeParams) + + +cdef CUresult _cuGraphAddBatchMemOpNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, const CUDA_BATCH_MEM_OP_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphAddBatchMemOpNode + _check_or_init_driver() + if __cuGraphAddBatchMemOpNode == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphAddBatchMemOpNode is not found") + return (__cuGraphAddBatchMemOpNode)( + phGraphNode, hGraph, dependencies, numDependencies, nodeParams) + + +cdef CUresult _cuGraphBatchMemOpNodeGetParams(CUgraphNode hNode, CUDA_BATCH_MEM_OP_NODE_PARAMS* nodeParams_out) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphBatchMemOpNodeGetParams + _check_or_init_driver() + if __cuGraphBatchMemOpNodeGetParams == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphBatchMemOpNodeGetParams is not found") + return (__cuGraphBatchMemOpNodeGetParams)( + hNode, nodeParams_out) + + +cdef CUresult _cuGraphBatchMemOpNodeSetParams(CUgraphNode hNode, const CUDA_BATCH_MEM_OP_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphBatchMemOpNodeSetParams + _check_or_init_driver() + if __cuGraphBatchMemOpNodeSetParams == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphBatchMemOpNodeSetParams is not found") + return (__cuGraphBatchMemOpNodeSetParams)( + hNode, nodeParams) + + +cdef CUresult _cuGraphExecBatchMemOpNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_BATCH_MEM_OP_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphExecBatchMemOpNodeSetParams + _check_or_init_driver() + if __cuGraphExecBatchMemOpNodeSetParams == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphExecBatchMemOpNodeSetParams is not found") + return (__cuGraphExecBatchMemOpNodeSetParams)( + hGraphExec, hNode, nodeParams) + + +cdef CUresult _cuGraphAddMemAllocNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, CUDA_MEM_ALLOC_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphAddMemAllocNode + _check_or_init_driver() + if __cuGraphAddMemAllocNode == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphAddMemAllocNode is not found") + return (__cuGraphAddMemAllocNode)( + phGraphNode, hGraph, dependencies, numDependencies, nodeParams) + + +cdef CUresult _cuGraphMemAllocNodeGetParams(CUgraphNode hNode, CUDA_MEM_ALLOC_NODE_PARAMS* params_out) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphMemAllocNodeGetParams + _check_or_init_driver() + if __cuGraphMemAllocNodeGetParams == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphMemAllocNodeGetParams is not found") + return (__cuGraphMemAllocNodeGetParams)( + hNode, params_out) + + +cdef CUresult _cuGraphAddMemFreeNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, CUdeviceptr dptr) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphAddMemFreeNode + _check_or_init_driver() + if __cuGraphAddMemFreeNode == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphAddMemFreeNode is not found") + return (__cuGraphAddMemFreeNode)( + phGraphNode, hGraph, dependencies, numDependencies, dptr) + + +cdef CUresult _cuGraphMemFreeNodeGetParams(CUgraphNode hNode, CUdeviceptr* dptr_out) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphMemFreeNodeGetParams + _check_or_init_driver() + if __cuGraphMemFreeNodeGetParams == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphMemFreeNodeGetParams is not found") + return (__cuGraphMemFreeNodeGetParams)( + hNode, dptr_out) + + +cdef CUresult _cuDeviceGraphMemTrim(CUdevice device) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDeviceGraphMemTrim + _check_or_init_driver() + if __cuDeviceGraphMemTrim == NULL: + with gil: + raise FunctionNotFoundError("function cuDeviceGraphMemTrim is not found") + return (__cuDeviceGraphMemTrim)( + device) + + +cdef CUresult _cuDeviceGetGraphMemAttribute(CUdevice device, CUgraphMem_attribute attr, void* value) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDeviceGetGraphMemAttribute + _check_or_init_driver() + if __cuDeviceGetGraphMemAttribute == NULL: + with gil: + raise FunctionNotFoundError("function cuDeviceGetGraphMemAttribute is not found") + return (__cuDeviceGetGraphMemAttribute)( + device, attr, value) + + +cdef CUresult _cuDeviceSetGraphMemAttribute(CUdevice device, CUgraphMem_attribute attr, void* value) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDeviceSetGraphMemAttribute + _check_or_init_driver() + if __cuDeviceSetGraphMemAttribute == NULL: + with gil: + raise FunctionNotFoundError("function cuDeviceSetGraphMemAttribute is not found") + return (__cuDeviceSetGraphMemAttribute)( + device, attr, value) + + +cdef CUresult _cuGraphClone(CUgraph* phGraphClone, CUgraph originalGraph) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphClone + _check_or_init_driver() + if __cuGraphClone == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphClone is not found") + return (__cuGraphClone)( + phGraphClone, originalGraph) + + +cdef CUresult _cuGraphNodeFindInClone(CUgraphNode* phNode, CUgraphNode hOriginalNode, CUgraph hClonedGraph) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphNodeFindInClone + _check_or_init_driver() + if __cuGraphNodeFindInClone == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphNodeFindInClone is not found") + return (__cuGraphNodeFindInClone)( + phNode, hOriginalNode, hClonedGraph) + + +cdef CUresult _cuGraphNodeGetType(CUgraphNode hNode, CUgraphNodeType* type) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphNodeGetType + _check_or_init_driver() + if __cuGraphNodeGetType == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphNodeGetType is not found") + return (__cuGraphNodeGetType)( + hNode, type) + + +cdef CUresult _cuGraphGetNodes(CUgraph hGraph, CUgraphNode* nodes, size_t* numNodes) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphGetNodes + _check_or_init_driver() + if __cuGraphGetNodes == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphGetNodes is not found") + return (__cuGraphGetNodes)( + hGraph, nodes, numNodes) + + +cdef CUresult _cuGraphGetRootNodes(CUgraph hGraph, CUgraphNode* rootNodes, size_t* numRootNodes) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphGetRootNodes + _check_or_init_driver() + if __cuGraphGetRootNodes == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphGetRootNodes is not found") + return (__cuGraphGetRootNodes)( + hGraph, rootNodes, numRootNodes) + + +cdef CUresult _cuGraphGetEdges_v2(CUgraph hGraph, CUgraphNode* from_, CUgraphNode* to, CUgraphEdgeData* edgeData, size_t* numEdges) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphGetEdges_v2 + _check_or_init_driver() + if __cuGraphGetEdges_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphGetEdges_v2 is not found") + return (__cuGraphGetEdges_v2)( + hGraph, from_, to, edgeData, numEdges) + + +cdef CUresult _cuGraphNodeGetDependencies_v2(CUgraphNode hNode, CUgraphNode* dependencies, CUgraphEdgeData* edgeData, size_t* numDependencies) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphNodeGetDependencies_v2 + _check_or_init_driver() + if __cuGraphNodeGetDependencies_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphNodeGetDependencies_v2 is not found") + return (__cuGraphNodeGetDependencies_v2)( + hNode, dependencies, edgeData, numDependencies) + + +cdef CUresult _cuGraphNodeGetDependentNodes_v2(CUgraphNode hNode, CUgraphNode* dependentNodes, CUgraphEdgeData* edgeData, size_t* numDependentNodes) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphNodeGetDependentNodes_v2 + _check_or_init_driver() + if __cuGraphNodeGetDependentNodes_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphNodeGetDependentNodes_v2 is not found") + return (__cuGraphNodeGetDependentNodes_v2)( + hNode, dependentNodes, edgeData, numDependentNodes) + + +cdef CUresult _cuGraphAddDependencies_v2(CUgraph hGraph, const CUgraphNode* from_, const CUgraphNode* to, const CUgraphEdgeData* edgeData, size_t numDependencies) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphAddDependencies_v2 + _check_or_init_driver() + if __cuGraphAddDependencies_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphAddDependencies_v2 is not found") + return (__cuGraphAddDependencies_v2)( + hGraph, from_, to, edgeData, numDependencies) + + +cdef CUresult _cuGraphRemoveDependencies_v2(CUgraph hGraph, const CUgraphNode* from_, const CUgraphNode* to, const CUgraphEdgeData* edgeData, size_t numDependencies) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphRemoveDependencies_v2 + _check_or_init_driver() + if __cuGraphRemoveDependencies_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphRemoveDependencies_v2 is not found") + return (__cuGraphRemoveDependencies_v2)( + hGraph, from_, to, edgeData, numDependencies) + + +cdef CUresult _cuGraphDestroyNode(CUgraphNode hNode) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphDestroyNode + _check_or_init_driver() + if __cuGraphDestroyNode == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphDestroyNode is not found") + return (__cuGraphDestroyNode)( + hNode) + + +cdef CUresult _cuGraphInstantiateWithFlags(CUgraphExec* phGraphExec, CUgraph hGraph, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphInstantiateWithFlags + _check_or_init_driver() + if __cuGraphInstantiateWithFlags == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphInstantiateWithFlags is not found") + return (__cuGraphInstantiateWithFlags)( + phGraphExec, hGraph, flags) + + +cdef CUresult _cuGraphInstantiateWithParams(CUgraphExec* phGraphExec, CUgraph hGraph, CUDA_GRAPH_INSTANTIATE_PARAMS* instantiateParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphInstantiateWithParams + _check_or_init_driver() + if __cuGraphInstantiateWithParams == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphInstantiateWithParams is not found") + return (__cuGraphInstantiateWithParams)( + phGraphExec, hGraph, instantiateParams) + + +cdef CUresult _cuGraphExecGetFlags(CUgraphExec hGraphExec, cuuint64_t* flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphExecGetFlags + _check_or_init_driver() + if __cuGraphExecGetFlags == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphExecGetFlags is not found") + return (__cuGraphExecGetFlags)( + hGraphExec, flags) + + +cdef CUresult _cuGraphExecKernelNodeSetParams_v2(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_KERNEL_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphExecKernelNodeSetParams_v2 + _check_or_init_driver() + if __cuGraphExecKernelNodeSetParams_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphExecKernelNodeSetParams_v2 is not found") + return (__cuGraphExecKernelNodeSetParams_v2)( + hGraphExec, hNode, nodeParams) + + +cdef CUresult _cuGraphExecMemcpyNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_MEMCPY3D* copyParams, CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphExecMemcpyNodeSetParams + _check_or_init_driver() + if __cuGraphExecMemcpyNodeSetParams == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphExecMemcpyNodeSetParams is not found") + return (__cuGraphExecMemcpyNodeSetParams)( + hGraphExec, hNode, copyParams, ctx) + + +cdef CUresult _cuGraphExecMemsetNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_MEMSET_NODE_PARAMS* memsetParams, CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphExecMemsetNodeSetParams + _check_or_init_driver() + if __cuGraphExecMemsetNodeSetParams == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphExecMemsetNodeSetParams is not found") + return (__cuGraphExecMemsetNodeSetParams)( + hGraphExec, hNode, memsetParams, ctx) + + +cdef CUresult _cuGraphExecHostNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_HOST_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphExecHostNodeSetParams + _check_or_init_driver() + if __cuGraphExecHostNodeSetParams == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphExecHostNodeSetParams is not found") + return (__cuGraphExecHostNodeSetParams)( + hGraphExec, hNode, nodeParams) + + +cdef CUresult _cuGraphExecChildGraphNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, CUgraph childGraph) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphExecChildGraphNodeSetParams + _check_or_init_driver() + if __cuGraphExecChildGraphNodeSetParams == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphExecChildGraphNodeSetParams is not found") + return (__cuGraphExecChildGraphNodeSetParams)( + hGraphExec, hNode, childGraph) + + +cdef CUresult _cuGraphExecEventRecordNodeSetEvent(CUgraphExec hGraphExec, CUgraphNode hNode, CUevent event) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphExecEventRecordNodeSetEvent + _check_or_init_driver() + if __cuGraphExecEventRecordNodeSetEvent == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphExecEventRecordNodeSetEvent is not found") + return (__cuGraphExecEventRecordNodeSetEvent)( + hGraphExec, hNode, event) + + +cdef CUresult _cuGraphExecEventWaitNodeSetEvent(CUgraphExec hGraphExec, CUgraphNode hNode, CUevent event) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphExecEventWaitNodeSetEvent + _check_or_init_driver() + if __cuGraphExecEventWaitNodeSetEvent == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphExecEventWaitNodeSetEvent is not found") + return (__cuGraphExecEventWaitNodeSetEvent)( + hGraphExec, hNode, event) + + +cdef CUresult _cuGraphExecExternalSemaphoresSignalNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_EXT_SEM_SIGNAL_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphExecExternalSemaphoresSignalNodeSetParams + _check_or_init_driver() + if __cuGraphExecExternalSemaphoresSignalNodeSetParams == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphExecExternalSemaphoresSignalNodeSetParams is not found") + return (__cuGraphExecExternalSemaphoresSignalNodeSetParams)( + hGraphExec, hNode, nodeParams) + + +cdef CUresult _cuGraphExecExternalSemaphoresWaitNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_EXT_SEM_WAIT_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphExecExternalSemaphoresWaitNodeSetParams + _check_or_init_driver() + if __cuGraphExecExternalSemaphoresWaitNodeSetParams == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphExecExternalSemaphoresWaitNodeSetParams is not found") + return (__cuGraphExecExternalSemaphoresWaitNodeSetParams)( + hGraphExec, hNode, nodeParams) + + +cdef CUresult _cuGraphNodeSetEnabled(CUgraphExec hGraphExec, CUgraphNode hNode, unsigned int isEnabled) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphNodeSetEnabled + _check_or_init_driver() + if __cuGraphNodeSetEnabled == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphNodeSetEnabled is not found") + return (__cuGraphNodeSetEnabled)( + hGraphExec, hNode, isEnabled) + + +cdef CUresult _cuGraphNodeGetEnabled(CUgraphExec hGraphExec, CUgraphNode hNode, unsigned int* isEnabled) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphNodeGetEnabled + _check_or_init_driver() + if __cuGraphNodeGetEnabled == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphNodeGetEnabled is not found") + return (__cuGraphNodeGetEnabled)( + hGraphExec, hNode, isEnabled) + + +cdef CUresult _cuGraphUpload(CUgraphExec hGraphExec, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphUpload + _check_or_init_driver() + if __cuGraphUpload == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphUpload is not found") + return (__cuGraphUpload)( + hGraphExec, hStream) + + +cdef CUresult _cuGraphLaunch(CUgraphExec hGraphExec, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphLaunch + _check_or_init_driver() + if __cuGraphLaunch == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphLaunch is not found") + return (__cuGraphLaunch)( + hGraphExec, hStream) + + +cdef CUresult _cuGraphExecDestroy(CUgraphExec hGraphExec) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphExecDestroy + _check_or_init_driver() + if __cuGraphExecDestroy == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphExecDestroy is not found") + return (__cuGraphExecDestroy)( + hGraphExec) + + +cdef CUresult _cuGraphDestroy(CUgraph hGraph) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphDestroy + _check_or_init_driver() + if __cuGraphDestroy == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphDestroy is not found") + return (__cuGraphDestroy)( + hGraph) + + +cdef CUresult _cuGraphExecUpdate_v2(CUgraphExec hGraphExec, CUgraph hGraph, CUgraphExecUpdateResultInfo* resultInfo) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphExecUpdate_v2 + _check_or_init_driver() + if __cuGraphExecUpdate_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphExecUpdate_v2 is not found") + return (__cuGraphExecUpdate_v2)( + hGraphExec, hGraph, resultInfo) + + +cdef CUresult _cuGraphKernelNodeCopyAttributes(CUgraphNode dst, CUgraphNode src) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphKernelNodeCopyAttributes + _check_or_init_driver() + if __cuGraphKernelNodeCopyAttributes == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphKernelNodeCopyAttributes is not found") + return (__cuGraphKernelNodeCopyAttributes)( + dst, src) + + +cdef CUresult _cuGraphKernelNodeGetAttribute(CUgraphNode hNode, CUkernelNodeAttrID attr, CUkernelNodeAttrValue* value_out) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphKernelNodeGetAttribute + _check_or_init_driver() + if __cuGraphKernelNodeGetAttribute == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphKernelNodeGetAttribute is not found") + return (__cuGraphKernelNodeGetAttribute)( + hNode, attr, value_out) + + +cdef CUresult _cuGraphKernelNodeSetAttribute(CUgraphNode hNode, CUkernelNodeAttrID attr, const CUkernelNodeAttrValue* value) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphKernelNodeSetAttribute + _check_or_init_driver() + if __cuGraphKernelNodeSetAttribute == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphKernelNodeSetAttribute is not found") + return (__cuGraphKernelNodeSetAttribute)( + hNode, attr, value) + + +cdef CUresult _cuGraphDebugDotPrint(CUgraph hGraph, const char* path, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphDebugDotPrint + _check_or_init_driver() + if __cuGraphDebugDotPrint == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphDebugDotPrint is not found") + return (__cuGraphDebugDotPrint)( + hGraph, path, flags) + + +cdef CUresult _cuUserObjectCreate(CUuserObject* object_out, void* ptr, CUhostFn destroy, unsigned int initialRefcount, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuUserObjectCreate + _check_or_init_driver() + if __cuUserObjectCreate == NULL: + with gil: + raise FunctionNotFoundError("function cuUserObjectCreate is not found") + return (__cuUserObjectCreate)( + object_out, ptr, destroy, initialRefcount, flags) + + +cdef CUresult _cuUserObjectRetain(CUuserObject object, unsigned int count) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuUserObjectRetain + _check_or_init_driver() + if __cuUserObjectRetain == NULL: + with gil: + raise FunctionNotFoundError("function cuUserObjectRetain is not found") + return (__cuUserObjectRetain)( + object, count) + + +cdef CUresult _cuUserObjectRelease(CUuserObject object, unsigned int count) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuUserObjectRelease + _check_or_init_driver() + if __cuUserObjectRelease == NULL: + with gil: + raise FunctionNotFoundError("function cuUserObjectRelease is not found") + return (__cuUserObjectRelease)( + object, count) + + +cdef CUresult _cuGraphRetainUserObject(CUgraph graph, CUuserObject object, unsigned int count, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphRetainUserObject + _check_or_init_driver() + if __cuGraphRetainUserObject == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphRetainUserObject is not found") + return (__cuGraphRetainUserObject)( + graph, object, count, flags) + + +cdef CUresult _cuGraphReleaseUserObject(CUgraph graph, CUuserObject object, unsigned int count) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphReleaseUserObject + _check_or_init_driver() + if __cuGraphReleaseUserObject == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphReleaseUserObject is not found") + return (__cuGraphReleaseUserObject)( + graph, object, count) + + +cdef CUresult _cuGraphAddNode_v2(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, const CUgraphEdgeData* dependencyData, size_t numDependencies, CUgraphNodeParams* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphAddNode_v2 + _check_or_init_driver() + if __cuGraphAddNode_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphAddNode_v2 is not found") + return (__cuGraphAddNode_v2)( + phGraphNode, hGraph, dependencies, dependencyData, numDependencies, nodeParams) + + +cdef CUresult _cuGraphNodeSetParams(CUgraphNode hNode, CUgraphNodeParams* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphNodeSetParams + _check_or_init_driver() + if __cuGraphNodeSetParams == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphNodeSetParams is not found") + return (__cuGraphNodeSetParams)( + hNode, nodeParams) + + +cdef CUresult _cuGraphExecNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, CUgraphNodeParams* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphExecNodeSetParams + _check_or_init_driver() + if __cuGraphExecNodeSetParams == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphExecNodeSetParams is not found") + return (__cuGraphExecNodeSetParams)( + hGraphExec, hNode, nodeParams) + + +cdef CUresult _cuGraphConditionalHandleCreate(CUgraphConditionalHandle* pHandle_out, CUgraph hGraph, CUcontext ctx, unsigned int defaultLaunchValue, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphConditionalHandleCreate + _check_or_init_driver() + if __cuGraphConditionalHandleCreate == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphConditionalHandleCreate is not found") + return (__cuGraphConditionalHandleCreate)( + pHandle_out, hGraph, ctx, defaultLaunchValue, flags) + + +cdef CUresult _cuOccupancyMaxActiveBlocksPerMultiprocessor(int* numBlocks, CUfunction func, int blockSize, size_t dynamicSMemSize) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuOccupancyMaxActiveBlocksPerMultiprocessor + _check_or_init_driver() + if __cuOccupancyMaxActiveBlocksPerMultiprocessor == NULL: + with gil: + raise FunctionNotFoundError("function cuOccupancyMaxActiveBlocksPerMultiprocessor is not found") + return (__cuOccupancyMaxActiveBlocksPerMultiprocessor)( + numBlocks, func, blockSize, dynamicSMemSize) + + +cdef CUresult _cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(int* numBlocks, CUfunction func, int blockSize, size_t dynamicSMemSize, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags + _check_or_init_driver() + if __cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags == NULL: + with gil: + raise FunctionNotFoundError("function cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags is not found") + return (__cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags)( + numBlocks, func, blockSize, dynamicSMemSize, flags) + + +cdef CUresult _cuOccupancyMaxPotentialBlockSize(int* minGridSize, int* blockSize, CUfunction func, CUoccupancyB2DSize blockSizeToDynamicSMemSize, size_t dynamicSMemSize, int blockSizeLimit) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuOccupancyMaxPotentialBlockSize + _check_or_init_driver() + if __cuOccupancyMaxPotentialBlockSize == NULL: + with gil: + raise FunctionNotFoundError("function cuOccupancyMaxPotentialBlockSize is not found") + return (__cuOccupancyMaxPotentialBlockSize)( + minGridSize, blockSize, func, blockSizeToDynamicSMemSize, dynamicSMemSize, blockSizeLimit) + + +cdef CUresult _cuOccupancyMaxPotentialBlockSizeWithFlags(int* minGridSize, int* blockSize, CUfunction func, CUoccupancyB2DSize blockSizeToDynamicSMemSize, size_t dynamicSMemSize, int blockSizeLimit, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuOccupancyMaxPotentialBlockSizeWithFlags + _check_or_init_driver() + if __cuOccupancyMaxPotentialBlockSizeWithFlags == NULL: + with gil: + raise FunctionNotFoundError("function cuOccupancyMaxPotentialBlockSizeWithFlags is not found") + return (__cuOccupancyMaxPotentialBlockSizeWithFlags)( + minGridSize, blockSize, func, blockSizeToDynamicSMemSize, dynamicSMemSize, blockSizeLimit, flags) + + +cdef CUresult _cuOccupancyAvailableDynamicSMemPerBlock(size_t* dynamicSmemSize, CUfunction func, int numBlocks, int blockSize) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuOccupancyAvailableDynamicSMemPerBlock + _check_or_init_driver() + if __cuOccupancyAvailableDynamicSMemPerBlock == NULL: + with gil: + raise FunctionNotFoundError("function cuOccupancyAvailableDynamicSMemPerBlock is not found") + return (__cuOccupancyAvailableDynamicSMemPerBlock)( + dynamicSmemSize, func, numBlocks, blockSize) + + +cdef CUresult _cuOccupancyMaxPotentialClusterSize(int* clusterSize, CUfunction func, const CUlaunchConfig* config) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuOccupancyMaxPotentialClusterSize + _check_or_init_driver() + if __cuOccupancyMaxPotentialClusterSize == NULL: + with gil: + raise FunctionNotFoundError("function cuOccupancyMaxPotentialClusterSize is not found") + return (__cuOccupancyMaxPotentialClusterSize)( + clusterSize, func, config) + + +cdef CUresult _cuOccupancyMaxActiveClusters(int* numClusters, CUfunction func, const CUlaunchConfig* config) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuOccupancyMaxActiveClusters + _check_or_init_driver() + if __cuOccupancyMaxActiveClusters == NULL: + with gil: + raise FunctionNotFoundError("function cuOccupancyMaxActiveClusters is not found") + return (__cuOccupancyMaxActiveClusters)( + numClusters, func, config) + + +cdef CUresult _cuTexRefSetArray(CUtexref hTexRef, CUarray hArray, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexRefSetArray + _check_or_init_driver() + if __cuTexRefSetArray == NULL: + with gil: + raise FunctionNotFoundError("function cuTexRefSetArray is not found") + return (__cuTexRefSetArray)( + hTexRef, hArray, Flags) + + +cdef CUresult _cuTexRefSetMipmappedArray(CUtexref hTexRef, CUmipmappedArray hMipmappedArray, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexRefSetMipmappedArray + _check_or_init_driver() + if __cuTexRefSetMipmappedArray == NULL: + with gil: + raise FunctionNotFoundError("function cuTexRefSetMipmappedArray is not found") + return (__cuTexRefSetMipmappedArray)( + hTexRef, hMipmappedArray, Flags) + + +cdef CUresult _cuTexRefSetAddress_v2(size_t* ByteOffset, CUtexref hTexRef, CUdeviceptr dptr, size_t bytes) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexRefSetAddress_v2 + _check_or_init_driver() + if __cuTexRefSetAddress_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuTexRefSetAddress_v2 is not found") + return (__cuTexRefSetAddress_v2)( + ByteOffset, hTexRef, dptr, bytes) + + +cdef CUresult _cuTexRefSetAddress2D_v3(CUtexref hTexRef, const CUDA_ARRAY_DESCRIPTOR* desc, CUdeviceptr dptr, size_t Pitch) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexRefSetAddress2D_v3 + _check_or_init_driver() + if __cuTexRefSetAddress2D_v3 == NULL: + with gil: + raise FunctionNotFoundError("function cuTexRefSetAddress2D_v3 is not found") + return (__cuTexRefSetAddress2D_v3)( + hTexRef, desc, dptr, Pitch) + + +cdef CUresult _cuTexRefSetFormat(CUtexref hTexRef, CUarray_format fmt, int NumPackedComponents) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexRefSetFormat + _check_or_init_driver() + if __cuTexRefSetFormat == NULL: + with gil: + raise FunctionNotFoundError("function cuTexRefSetFormat is not found") + return (__cuTexRefSetFormat)( + hTexRef, fmt, NumPackedComponents) + + +cdef CUresult _cuTexRefSetAddressMode(CUtexref hTexRef, int dim, CUaddress_mode am) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexRefSetAddressMode + _check_or_init_driver() + if __cuTexRefSetAddressMode == NULL: + with gil: + raise FunctionNotFoundError("function cuTexRefSetAddressMode is not found") + return (__cuTexRefSetAddressMode)( + hTexRef, dim, am) + + +cdef CUresult _cuTexRefSetFilterMode(CUtexref hTexRef, CUfilter_mode fm) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexRefSetFilterMode + _check_or_init_driver() + if __cuTexRefSetFilterMode == NULL: + with gil: + raise FunctionNotFoundError("function cuTexRefSetFilterMode is not found") + return (__cuTexRefSetFilterMode)( + hTexRef, fm) + + +cdef CUresult _cuTexRefSetMipmapFilterMode(CUtexref hTexRef, CUfilter_mode fm) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexRefSetMipmapFilterMode + _check_or_init_driver() + if __cuTexRefSetMipmapFilterMode == NULL: + with gil: + raise FunctionNotFoundError("function cuTexRefSetMipmapFilterMode is not found") + return (__cuTexRefSetMipmapFilterMode)( + hTexRef, fm) + + +cdef CUresult _cuTexRefSetMipmapLevelBias(CUtexref hTexRef, float bias) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexRefSetMipmapLevelBias + _check_or_init_driver() + if __cuTexRefSetMipmapLevelBias == NULL: + with gil: + raise FunctionNotFoundError("function cuTexRefSetMipmapLevelBias is not found") + return (__cuTexRefSetMipmapLevelBias)( + hTexRef, bias) + + +cdef CUresult _cuTexRefSetMipmapLevelClamp(CUtexref hTexRef, float minMipmapLevelClamp, float maxMipmapLevelClamp) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexRefSetMipmapLevelClamp + _check_or_init_driver() + if __cuTexRefSetMipmapLevelClamp == NULL: + with gil: + raise FunctionNotFoundError("function cuTexRefSetMipmapLevelClamp is not found") + return (__cuTexRefSetMipmapLevelClamp)( + hTexRef, minMipmapLevelClamp, maxMipmapLevelClamp) + + +cdef CUresult _cuTexRefSetMaxAnisotropy(CUtexref hTexRef, unsigned int maxAniso) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexRefSetMaxAnisotropy + _check_or_init_driver() + if __cuTexRefSetMaxAnisotropy == NULL: + with gil: + raise FunctionNotFoundError("function cuTexRefSetMaxAnisotropy is not found") + return (__cuTexRefSetMaxAnisotropy)( + hTexRef, maxAniso) + + +cdef CUresult _cuTexRefSetBorderColor(CUtexref hTexRef, float* pBorderColor) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexRefSetBorderColor + _check_or_init_driver() + if __cuTexRefSetBorderColor == NULL: + with gil: + raise FunctionNotFoundError("function cuTexRefSetBorderColor is not found") + return (__cuTexRefSetBorderColor)( + hTexRef, pBorderColor) + + +cdef CUresult _cuTexRefSetFlags(CUtexref hTexRef, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexRefSetFlags + _check_or_init_driver() + if __cuTexRefSetFlags == NULL: + with gil: + raise FunctionNotFoundError("function cuTexRefSetFlags is not found") + return (__cuTexRefSetFlags)( + hTexRef, Flags) + + +cdef CUresult _cuTexRefGetAddress_v2(CUdeviceptr* pdptr, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexRefGetAddress_v2 + _check_or_init_driver() + if __cuTexRefGetAddress_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuTexRefGetAddress_v2 is not found") + return (__cuTexRefGetAddress_v2)( + pdptr, hTexRef) + + +cdef CUresult _cuTexRefGetArray(CUarray* phArray, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexRefGetArray + _check_or_init_driver() + if __cuTexRefGetArray == NULL: + with gil: + raise FunctionNotFoundError("function cuTexRefGetArray is not found") + return (__cuTexRefGetArray)( + phArray, hTexRef) + + +cdef CUresult _cuTexRefGetMipmappedArray(CUmipmappedArray* phMipmappedArray, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexRefGetMipmappedArray + _check_or_init_driver() + if __cuTexRefGetMipmappedArray == NULL: + with gil: + raise FunctionNotFoundError("function cuTexRefGetMipmappedArray is not found") + return (__cuTexRefGetMipmappedArray)( + phMipmappedArray, hTexRef) + + +cdef CUresult _cuTexRefGetAddressMode(CUaddress_mode* pam, CUtexref hTexRef, int dim) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexRefGetAddressMode + _check_or_init_driver() + if __cuTexRefGetAddressMode == NULL: + with gil: + raise FunctionNotFoundError("function cuTexRefGetAddressMode is not found") + return (__cuTexRefGetAddressMode)( + pam, hTexRef, dim) + + +cdef CUresult _cuTexRefGetFilterMode(CUfilter_mode* pfm, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexRefGetFilterMode + _check_or_init_driver() + if __cuTexRefGetFilterMode == NULL: + with gil: + raise FunctionNotFoundError("function cuTexRefGetFilterMode is not found") + return (__cuTexRefGetFilterMode)( + pfm, hTexRef) + + +cdef CUresult _cuTexRefGetFormat(CUarray_format* pFormat, int* pNumChannels, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexRefGetFormat + _check_or_init_driver() + if __cuTexRefGetFormat == NULL: + with gil: + raise FunctionNotFoundError("function cuTexRefGetFormat is not found") + return (__cuTexRefGetFormat)( + pFormat, pNumChannels, hTexRef) + + +cdef CUresult _cuTexRefGetMipmapFilterMode(CUfilter_mode* pfm, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexRefGetMipmapFilterMode + _check_or_init_driver() + if __cuTexRefGetMipmapFilterMode == NULL: + with gil: + raise FunctionNotFoundError("function cuTexRefGetMipmapFilterMode is not found") + return (__cuTexRefGetMipmapFilterMode)( + pfm, hTexRef) + + +cdef CUresult _cuTexRefGetMipmapLevelBias(float* pbias, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexRefGetMipmapLevelBias + _check_or_init_driver() + if __cuTexRefGetMipmapLevelBias == NULL: + with gil: + raise FunctionNotFoundError("function cuTexRefGetMipmapLevelBias is not found") + return (__cuTexRefGetMipmapLevelBias)( + pbias, hTexRef) + + +cdef CUresult _cuTexRefGetMipmapLevelClamp(float* pminMipmapLevelClamp, float* pmaxMipmapLevelClamp, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexRefGetMipmapLevelClamp + _check_or_init_driver() + if __cuTexRefGetMipmapLevelClamp == NULL: + with gil: + raise FunctionNotFoundError("function cuTexRefGetMipmapLevelClamp is not found") + return (__cuTexRefGetMipmapLevelClamp)( + pminMipmapLevelClamp, pmaxMipmapLevelClamp, hTexRef) + + +cdef CUresult _cuTexRefGetMaxAnisotropy(int* pmaxAniso, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexRefGetMaxAnisotropy + _check_or_init_driver() + if __cuTexRefGetMaxAnisotropy == NULL: + with gil: + raise FunctionNotFoundError("function cuTexRefGetMaxAnisotropy is not found") + return (__cuTexRefGetMaxAnisotropy)( + pmaxAniso, hTexRef) + + +cdef CUresult _cuTexRefGetBorderColor(float* pBorderColor, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexRefGetBorderColor + _check_or_init_driver() + if __cuTexRefGetBorderColor == NULL: + with gil: + raise FunctionNotFoundError("function cuTexRefGetBorderColor is not found") + return (__cuTexRefGetBorderColor)( + pBorderColor, hTexRef) + + +cdef CUresult _cuTexRefGetFlags(unsigned int* pFlags, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexRefGetFlags + _check_or_init_driver() + if __cuTexRefGetFlags == NULL: + with gil: + raise FunctionNotFoundError("function cuTexRefGetFlags is not found") + return (__cuTexRefGetFlags)( + pFlags, hTexRef) + + +cdef CUresult _cuTexRefCreate(CUtexref* pTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexRefCreate + _check_or_init_driver() + if __cuTexRefCreate == NULL: + with gil: + raise FunctionNotFoundError("function cuTexRefCreate is not found") + return (__cuTexRefCreate)( + pTexRef) + + +cdef CUresult _cuTexRefDestroy(CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexRefDestroy + _check_or_init_driver() + if __cuTexRefDestroy == NULL: + with gil: + raise FunctionNotFoundError("function cuTexRefDestroy is not found") + return (__cuTexRefDestroy)( + hTexRef) + + +cdef CUresult _cuSurfRefSetArray(CUsurfref hSurfRef, CUarray hArray, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuSurfRefSetArray + _check_or_init_driver() + if __cuSurfRefSetArray == NULL: + with gil: + raise FunctionNotFoundError("function cuSurfRefSetArray is not found") + return (__cuSurfRefSetArray)( + hSurfRef, hArray, Flags) + + +cdef CUresult _cuSurfRefGetArray(CUarray* phArray, CUsurfref hSurfRef) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuSurfRefGetArray + _check_or_init_driver() + if __cuSurfRefGetArray == NULL: + with gil: + raise FunctionNotFoundError("function cuSurfRefGetArray is not found") + return (__cuSurfRefGetArray)( + phArray, hSurfRef) + + +cdef CUresult _cuTexObjectCreate(CUtexObject* pTexObject, const CUDA_RESOURCE_DESC* pResDesc, const CUDA_TEXTURE_DESC* pTexDesc, const CUDA_RESOURCE_VIEW_DESC* pResViewDesc) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexObjectCreate + _check_or_init_driver() + if __cuTexObjectCreate == NULL: + with gil: + raise FunctionNotFoundError("function cuTexObjectCreate is not found") + return (__cuTexObjectCreate)( + pTexObject, pResDesc, pTexDesc, pResViewDesc) + + +cdef CUresult _cuTexObjectDestroy(CUtexObject texObject) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexObjectDestroy + _check_or_init_driver() + if __cuTexObjectDestroy == NULL: + with gil: + raise FunctionNotFoundError("function cuTexObjectDestroy is not found") + return (__cuTexObjectDestroy)( + texObject) + + +cdef CUresult _cuTexObjectGetResourceDesc(CUDA_RESOURCE_DESC* pResDesc, CUtexObject texObject) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexObjectGetResourceDesc + _check_or_init_driver() + if __cuTexObjectGetResourceDesc == NULL: + with gil: + raise FunctionNotFoundError("function cuTexObjectGetResourceDesc is not found") + return (__cuTexObjectGetResourceDesc)( + pResDesc, texObject) + + +cdef CUresult _cuTexObjectGetTextureDesc(CUDA_TEXTURE_DESC* pTexDesc, CUtexObject texObject) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexObjectGetTextureDesc + _check_or_init_driver() + if __cuTexObjectGetTextureDesc == NULL: + with gil: + raise FunctionNotFoundError("function cuTexObjectGetTextureDesc is not found") + return (__cuTexObjectGetTextureDesc)( + pTexDesc, texObject) + + +cdef CUresult _cuTexObjectGetResourceViewDesc(CUDA_RESOURCE_VIEW_DESC* pResViewDesc, CUtexObject texObject) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexObjectGetResourceViewDesc + _check_or_init_driver() + if __cuTexObjectGetResourceViewDesc == NULL: + with gil: + raise FunctionNotFoundError("function cuTexObjectGetResourceViewDesc is not found") + return (__cuTexObjectGetResourceViewDesc)( + pResViewDesc, texObject) + + +cdef CUresult _cuSurfObjectCreate(CUsurfObject* pSurfObject, const CUDA_RESOURCE_DESC* pResDesc) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuSurfObjectCreate + _check_or_init_driver() + if __cuSurfObjectCreate == NULL: + with gil: + raise FunctionNotFoundError("function cuSurfObjectCreate is not found") + return (__cuSurfObjectCreate)( + pSurfObject, pResDesc) + + +cdef CUresult _cuSurfObjectDestroy(CUsurfObject surfObject) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuSurfObjectDestroy + _check_or_init_driver() + if __cuSurfObjectDestroy == NULL: + with gil: + raise FunctionNotFoundError("function cuSurfObjectDestroy is not found") + return (__cuSurfObjectDestroy)( + surfObject) + + +cdef CUresult _cuSurfObjectGetResourceDesc(CUDA_RESOURCE_DESC* pResDesc, CUsurfObject surfObject) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuSurfObjectGetResourceDesc + _check_or_init_driver() + if __cuSurfObjectGetResourceDesc == NULL: + with gil: + raise FunctionNotFoundError("function cuSurfObjectGetResourceDesc is not found") + return (__cuSurfObjectGetResourceDesc)( + pResDesc, surfObject) + + +cdef CUresult _cuTensorMapEncodeTiled(CUtensorMap* tensorMap, CUtensorMapDataType tensorDataType, cuuint32_t tensorRank, void* globalAddress, const cuuint64_t* globalDim, const cuuint64_t* globalStrides, const cuuint32_t* boxDim, const cuuint32_t* elementStrides, CUtensorMapInterleave interleave, CUtensorMapSwizzle swizzle, CUtensorMapL2promotion l2Promotion, CUtensorMapFloatOOBfill oobFill) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTensorMapEncodeTiled + _check_or_init_driver() + if __cuTensorMapEncodeTiled == NULL: + with gil: + raise FunctionNotFoundError("function cuTensorMapEncodeTiled is not found") + return (__cuTensorMapEncodeTiled)( + tensorMap, tensorDataType, tensorRank, globalAddress, globalDim, globalStrides, boxDim, elementStrides, interleave, swizzle, l2Promotion, oobFill) + + +cdef CUresult _cuTensorMapEncodeIm2col(CUtensorMap* tensorMap, CUtensorMapDataType tensorDataType, cuuint32_t tensorRank, void* globalAddress, const cuuint64_t* globalDim, const cuuint64_t* globalStrides, const int* pixelBoxLowerCorner, const int* pixelBoxUpperCorner, cuuint32_t channelsPerPixel, cuuint32_t pixelsPerColumn, const cuuint32_t* elementStrides, CUtensorMapInterleave interleave, CUtensorMapSwizzle swizzle, CUtensorMapL2promotion l2Promotion, CUtensorMapFloatOOBfill oobFill) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTensorMapEncodeIm2col + _check_or_init_driver() + if __cuTensorMapEncodeIm2col == NULL: + with gil: + raise FunctionNotFoundError("function cuTensorMapEncodeIm2col is not found") + return (__cuTensorMapEncodeIm2col)( + tensorMap, tensorDataType, tensorRank, globalAddress, globalDim, globalStrides, pixelBoxLowerCorner, pixelBoxUpperCorner, channelsPerPixel, pixelsPerColumn, elementStrides, interleave, swizzle, l2Promotion, oobFill) + + +cdef CUresult _cuTensorMapEncodeIm2colWide(CUtensorMap* tensorMap, CUtensorMapDataType tensorDataType, cuuint32_t tensorRank, void* globalAddress, const cuuint64_t* globalDim, const cuuint64_t* globalStrides, int pixelBoxLowerCornerWidth, int pixelBoxUpperCornerWidth, cuuint32_t channelsPerPixel, cuuint32_t pixelsPerColumn, const cuuint32_t* elementStrides, CUtensorMapInterleave interleave, CUtensorMapIm2ColWideMode mode, CUtensorMapSwizzle swizzle, CUtensorMapL2promotion l2Promotion, CUtensorMapFloatOOBfill oobFill) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTensorMapEncodeIm2colWide + _check_or_init_driver() + if __cuTensorMapEncodeIm2colWide == NULL: + with gil: + raise FunctionNotFoundError("function cuTensorMapEncodeIm2colWide is not found") + return (__cuTensorMapEncodeIm2colWide)( + tensorMap, tensorDataType, tensorRank, globalAddress, globalDim, globalStrides, pixelBoxLowerCornerWidth, pixelBoxUpperCornerWidth, channelsPerPixel, pixelsPerColumn, elementStrides, interleave, mode, swizzle, l2Promotion, oobFill) + + +cdef CUresult _cuTensorMapReplaceAddress(CUtensorMap* tensorMap, void* globalAddress) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTensorMapReplaceAddress + _check_or_init_driver() + if __cuTensorMapReplaceAddress == NULL: + with gil: + raise FunctionNotFoundError("function cuTensorMapReplaceAddress is not found") + return (__cuTensorMapReplaceAddress)( + tensorMap, globalAddress) + + +cdef CUresult _cuDeviceCanAccessPeer(int* canAccessPeer, CUdevice dev, CUdevice peerDev) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDeviceCanAccessPeer + _check_or_init_driver() + if __cuDeviceCanAccessPeer == NULL: + with gil: + raise FunctionNotFoundError("function cuDeviceCanAccessPeer is not found") + return (__cuDeviceCanAccessPeer)( + canAccessPeer, dev, peerDev) + + +cdef CUresult _cuCtxEnablePeerAccess(CUcontext peerContext, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxEnablePeerAccess + _check_or_init_driver() + if __cuCtxEnablePeerAccess == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxEnablePeerAccess is not found") + return (__cuCtxEnablePeerAccess)( + peerContext, Flags) + + +cdef CUresult _cuCtxDisablePeerAccess(CUcontext peerContext) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxDisablePeerAccess + _check_or_init_driver() + if __cuCtxDisablePeerAccess == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxDisablePeerAccess is not found") + return (__cuCtxDisablePeerAccess)( + peerContext) + + +cdef CUresult _cuDeviceGetP2PAttribute(int* value, CUdevice_P2PAttribute attrib, CUdevice srcDevice, CUdevice dstDevice) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDeviceGetP2PAttribute + _check_or_init_driver() + if __cuDeviceGetP2PAttribute == NULL: + with gil: + raise FunctionNotFoundError("function cuDeviceGetP2PAttribute is not found") + return (__cuDeviceGetP2PAttribute)( + value, attrib, srcDevice, dstDevice) + + +cdef CUresult _cuGraphicsUnregisterResource(CUgraphicsResource resource) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphicsUnregisterResource + _check_or_init_driver() + if __cuGraphicsUnregisterResource == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphicsUnregisterResource is not found") + return (__cuGraphicsUnregisterResource)( + resource) + + +cdef CUresult _cuGraphicsSubResourceGetMappedArray(CUarray* pArray, CUgraphicsResource resource, unsigned int arrayIndex, unsigned int mipLevel) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphicsSubResourceGetMappedArray + _check_or_init_driver() + if __cuGraphicsSubResourceGetMappedArray == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphicsSubResourceGetMappedArray is not found") + return (__cuGraphicsSubResourceGetMappedArray)( + pArray, resource, arrayIndex, mipLevel) + + +cdef CUresult _cuGraphicsResourceGetMappedMipmappedArray(CUmipmappedArray* pMipmappedArray, CUgraphicsResource resource) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphicsResourceGetMappedMipmappedArray + _check_or_init_driver() + if __cuGraphicsResourceGetMappedMipmappedArray == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphicsResourceGetMappedMipmappedArray is not found") + return (__cuGraphicsResourceGetMappedMipmappedArray)( + pMipmappedArray, resource) + + +cdef CUresult _cuGraphicsResourceGetMappedPointer_v2(CUdeviceptr* pDevPtr, size_t* pSize, CUgraphicsResource resource) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphicsResourceGetMappedPointer_v2 + _check_or_init_driver() + if __cuGraphicsResourceGetMappedPointer_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphicsResourceGetMappedPointer_v2 is not found") + return (__cuGraphicsResourceGetMappedPointer_v2)( + pDevPtr, pSize, resource) + + +cdef CUresult _cuGraphicsResourceSetMapFlags_v2(CUgraphicsResource resource, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphicsResourceSetMapFlags_v2 + _check_or_init_driver() + if __cuGraphicsResourceSetMapFlags_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphicsResourceSetMapFlags_v2 is not found") + return (__cuGraphicsResourceSetMapFlags_v2)( + resource, flags) + + +cdef CUresult _cuGraphicsMapResources(unsigned int count, CUgraphicsResource* resources, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphicsMapResources + _check_or_init_driver() + if __cuGraphicsMapResources == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphicsMapResources is not found") + return (__cuGraphicsMapResources)( + count, resources, hStream) + + +cdef CUresult _cuGraphicsUnmapResources(unsigned int count, CUgraphicsResource* resources, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphicsUnmapResources + _check_or_init_driver() + if __cuGraphicsUnmapResources == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphicsUnmapResources is not found") + return (__cuGraphicsUnmapResources)( + count, resources, hStream) + + +cdef CUresult _cuGetProcAddress_v2(const char* symbol, void** pfn, int cudaVersion, cuuint64_t flags, CUdriverProcAddressQueryResult* symbolStatus) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGetProcAddress_v2 + _check_or_init_driver() + if __cuGetProcAddress_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuGetProcAddress_v2 is not found") + return (__cuGetProcAddress_v2)( + symbol, pfn, cudaVersion, flags, symbolStatus) + + +cdef CUresult _cuCoredumpGetAttribute(CUcoredumpSettings attrib, void* value, size_t* size) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCoredumpGetAttribute + _check_or_init_driver() + if __cuCoredumpGetAttribute == NULL: + with gil: + raise FunctionNotFoundError("function cuCoredumpGetAttribute is not found") + return (__cuCoredumpGetAttribute)( + attrib, value, size) + + +cdef CUresult _cuCoredumpGetAttributeGlobal(CUcoredumpSettings attrib, void* value, size_t* size) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCoredumpGetAttributeGlobal + _check_or_init_driver() + if __cuCoredumpGetAttributeGlobal == NULL: + with gil: + raise FunctionNotFoundError("function cuCoredumpGetAttributeGlobal is not found") + return (__cuCoredumpGetAttributeGlobal)( + attrib, value, size) + + +cdef CUresult _cuCoredumpSetAttribute(CUcoredumpSettings attrib, void* value, size_t* size) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCoredumpSetAttribute + _check_or_init_driver() + if __cuCoredumpSetAttribute == NULL: + with gil: + raise FunctionNotFoundError("function cuCoredumpSetAttribute is not found") + return (__cuCoredumpSetAttribute)( + attrib, value, size) + + +cdef CUresult _cuCoredumpSetAttributeGlobal(CUcoredumpSettings attrib, void* value, size_t* size) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCoredumpSetAttributeGlobal + _check_or_init_driver() + if __cuCoredumpSetAttributeGlobal == NULL: + with gil: + raise FunctionNotFoundError("function cuCoredumpSetAttributeGlobal is not found") + return (__cuCoredumpSetAttributeGlobal)( + attrib, value, size) + + +cdef CUresult _cuGetExportTable(const void** ppExportTable, const CUuuid* pExportTableId) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGetExportTable + _check_or_init_driver() + if __cuGetExportTable == NULL: + with gil: + raise FunctionNotFoundError("function cuGetExportTable is not found") + return (__cuGetExportTable)( + ppExportTable, pExportTableId) + + +cdef CUresult _cuGreenCtxCreate(CUgreenCtx* phCtx, CUdevResourceDesc desc, CUdevice dev, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGreenCtxCreate + _check_or_init_driver() + if __cuGreenCtxCreate == NULL: + with gil: + raise FunctionNotFoundError("function cuGreenCtxCreate is not found") + return (__cuGreenCtxCreate)( + phCtx, desc, dev, flags) + + +cdef CUresult _cuGreenCtxDestroy(CUgreenCtx hCtx) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGreenCtxDestroy + _check_or_init_driver() + if __cuGreenCtxDestroy == NULL: + with gil: + raise FunctionNotFoundError("function cuGreenCtxDestroy is not found") + return (__cuGreenCtxDestroy)( + hCtx) + + +cdef CUresult _cuCtxFromGreenCtx(CUcontext* pContext, CUgreenCtx hCtx) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxFromGreenCtx + _check_or_init_driver() + if __cuCtxFromGreenCtx == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxFromGreenCtx is not found") + return (__cuCtxFromGreenCtx)( + pContext, hCtx) + + +cdef CUresult _cuDeviceGetDevResource(CUdevice device, CUdevResource* resource, CUdevResourceType type) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDeviceGetDevResource + _check_or_init_driver() + if __cuDeviceGetDevResource == NULL: + with gil: + raise FunctionNotFoundError("function cuDeviceGetDevResource is not found") + return (__cuDeviceGetDevResource)( + device, resource, type) + + +cdef CUresult _cuCtxGetDevResource(CUcontext hCtx, CUdevResource* resource, CUdevResourceType type) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxGetDevResource + _check_or_init_driver() + if __cuCtxGetDevResource == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxGetDevResource is not found") + return (__cuCtxGetDevResource)( + hCtx, resource, type) + + +cdef CUresult _cuGreenCtxGetDevResource(CUgreenCtx hCtx, CUdevResource* resource, CUdevResourceType type) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGreenCtxGetDevResource + _check_or_init_driver() + if __cuGreenCtxGetDevResource == NULL: + with gil: + raise FunctionNotFoundError("function cuGreenCtxGetDevResource is not found") + return (__cuGreenCtxGetDevResource)( + hCtx, resource, type) + + +cdef CUresult _cuDevSmResourceSplitByCount(CUdevResource* result, unsigned int* nbGroups, const CUdevResource* input, CUdevResource* remainder, unsigned int flags, unsigned int minCount) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDevSmResourceSplitByCount + _check_or_init_driver() + if __cuDevSmResourceSplitByCount == NULL: + with gil: + raise FunctionNotFoundError("function cuDevSmResourceSplitByCount is not found") + return (__cuDevSmResourceSplitByCount)( + result, nbGroups, input, remainder, flags, minCount) + + +cdef CUresult _cuDevResourceGenerateDesc(CUdevResourceDesc* phDesc, CUdevResource* resources, unsigned int nbResources) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDevResourceGenerateDesc + _check_or_init_driver() + if __cuDevResourceGenerateDesc == NULL: + with gil: + raise FunctionNotFoundError("function cuDevResourceGenerateDesc is not found") + return (__cuDevResourceGenerateDesc)( + phDesc, resources, nbResources) + + +cdef CUresult _cuGreenCtxRecordEvent(CUgreenCtx hCtx, CUevent hEvent) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGreenCtxRecordEvent + _check_or_init_driver() + if __cuGreenCtxRecordEvent == NULL: + with gil: + raise FunctionNotFoundError("function cuGreenCtxRecordEvent is not found") + return (__cuGreenCtxRecordEvent)( + hCtx, hEvent) + + +cdef CUresult _cuGreenCtxWaitEvent(CUgreenCtx hCtx, CUevent hEvent) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGreenCtxWaitEvent + _check_or_init_driver() + if __cuGreenCtxWaitEvent == NULL: + with gil: + raise FunctionNotFoundError("function cuGreenCtxWaitEvent is not found") + return (__cuGreenCtxWaitEvent)( + hCtx, hEvent) + + +cdef CUresult _cuStreamGetGreenCtx(CUstream hStream, CUgreenCtx* phCtx) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamGetGreenCtx + _check_or_init_driver() + if __cuStreamGetGreenCtx == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamGetGreenCtx is not found") + return (__cuStreamGetGreenCtx)( + hStream, phCtx) + + +cdef CUresult _cuGreenCtxStreamCreate(CUstream* phStream, CUgreenCtx greenCtx, unsigned int flags, int priority) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGreenCtxStreamCreate + _check_or_init_driver() + if __cuGreenCtxStreamCreate == NULL: + with gil: + raise FunctionNotFoundError("function cuGreenCtxStreamCreate is not found") + return (__cuGreenCtxStreamCreate)( + phStream, greenCtx, flags, priority) + + +cdef CUresult _cuLogsRegisterCallback(CUlogsCallback callbackFunc, void* userData, CUlogsCallbackHandle* callback_out) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLogsRegisterCallback + _check_or_init_driver() + if __cuLogsRegisterCallback == NULL: + with gil: + raise FunctionNotFoundError("function cuLogsRegisterCallback is not found") + return (__cuLogsRegisterCallback)( + callbackFunc, userData, callback_out) + + +cdef CUresult _cuLogsUnregisterCallback(CUlogsCallbackHandle callback) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLogsUnregisterCallback + _check_or_init_driver() + if __cuLogsUnregisterCallback == NULL: + with gil: + raise FunctionNotFoundError("function cuLogsUnregisterCallback is not found") + return (__cuLogsUnregisterCallback)( + callback) + + +cdef CUresult _cuLogsCurrent(CUlogIterator* iterator_out, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLogsCurrent + _check_or_init_driver() + if __cuLogsCurrent == NULL: + with gil: + raise FunctionNotFoundError("function cuLogsCurrent is not found") + return (__cuLogsCurrent)( + iterator_out, flags) + + +cdef CUresult _cuLogsDumpToFile(CUlogIterator* iterator, const char* pathToFile, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLogsDumpToFile + _check_or_init_driver() + if __cuLogsDumpToFile == NULL: + with gil: + raise FunctionNotFoundError("function cuLogsDumpToFile is not found") + return (__cuLogsDumpToFile)( + iterator, pathToFile, flags) + + +cdef CUresult _cuLogsDumpToMemory(CUlogIterator* iterator, char* buffer, size_t* size, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLogsDumpToMemory + _check_or_init_driver() + if __cuLogsDumpToMemory == NULL: + with gil: + raise FunctionNotFoundError("function cuLogsDumpToMemory is not found") + return (__cuLogsDumpToMemory)( + iterator, buffer, size, flags) + + +cdef CUresult _cuCheckpointProcessGetRestoreThreadId(int pid, int* tid) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCheckpointProcessGetRestoreThreadId + _check_or_init_driver() + if __cuCheckpointProcessGetRestoreThreadId == NULL: + with gil: + raise FunctionNotFoundError("function cuCheckpointProcessGetRestoreThreadId is not found") + return (__cuCheckpointProcessGetRestoreThreadId)( + pid, tid) + + +cdef CUresult _cuCheckpointProcessGetState(int pid, CUprocessState* state) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCheckpointProcessGetState + _check_or_init_driver() + if __cuCheckpointProcessGetState == NULL: + with gil: + raise FunctionNotFoundError("function cuCheckpointProcessGetState is not found") + return (__cuCheckpointProcessGetState)( + pid, state) + + +cdef CUresult _cuCheckpointProcessLock(int pid, CUcheckpointLockArgs* args) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCheckpointProcessLock + _check_or_init_driver() + if __cuCheckpointProcessLock == NULL: + with gil: + raise FunctionNotFoundError("function cuCheckpointProcessLock is not found") + return (__cuCheckpointProcessLock)( + pid, args) + + +cdef CUresult _cuCheckpointProcessCheckpoint(int pid, CUcheckpointCheckpointArgs* args) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCheckpointProcessCheckpoint + _check_or_init_driver() + if __cuCheckpointProcessCheckpoint == NULL: + with gil: + raise FunctionNotFoundError("function cuCheckpointProcessCheckpoint is not found") + return (__cuCheckpointProcessCheckpoint)( + pid, args) + + +cdef CUresult _cuCheckpointProcessRestore(int pid, CUcheckpointRestoreArgs* args) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCheckpointProcessRestore + _check_or_init_driver() + if __cuCheckpointProcessRestore == NULL: + with gil: + raise FunctionNotFoundError("function cuCheckpointProcessRestore is not found") + return (__cuCheckpointProcessRestore)( + pid, args) + + +cdef CUresult _cuCheckpointProcessUnlock(int pid, CUcheckpointUnlockArgs* args) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCheckpointProcessUnlock + _check_or_init_driver() + if __cuCheckpointProcessUnlock == NULL: + with gil: + raise FunctionNotFoundError("function cuCheckpointProcessUnlock is not found") + return (__cuCheckpointProcessUnlock)( + pid, args) + + +cdef CUresult _cuGraphicsEGLRegisterImage(CUgraphicsResource* pCudaResource, EGLImageKHR image, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphicsEGLRegisterImage + _check_or_init_driver() + if __cuGraphicsEGLRegisterImage == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphicsEGLRegisterImage is not found") + return (__cuGraphicsEGLRegisterImage)( + pCudaResource, image, flags) + + +cdef CUresult _cuEGLStreamConsumerConnect(CUeglStreamConnection* conn, EGLStreamKHR stream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuEGLStreamConsumerConnect + _check_or_init_driver() + if __cuEGLStreamConsumerConnect == NULL: + with gil: + raise FunctionNotFoundError("function cuEGLStreamConsumerConnect is not found") + return (__cuEGLStreamConsumerConnect)( + conn, stream) + + +cdef CUresult _cuEGLStreamConsumerConnectWithFlags(CUeglStreamConnection* conn, EGLStreamKHR stream, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuEGLStreamConsumerConnectWithFlags + _check_or_init_driver() + if __cuEGLStreamConsumerConnectWithFlags == NULL: + with gil: + raise FunctionNotFoundError("function cuEGLStreamConsumerConnectWithFlags is not found") + return (__cuEGLStreamConsumerConnectWithFlags)( + conn, stream, flags) + + +cdef CUresult _cuEGLStreamConsumerDisconnect(CUeglStreamConnection* conn) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuEGLStreamConsumerDisconnect + _check_or_init_driver() + if __cuEGLStreamConsumerDisconnect == NULL: + with gil: + raise FunctionNotFoundError("function cuEGLStreamConsumerDisconnect is not found") + return (__cuEGLStreamConsumerDisconnect)( + conn) + + +cdef CUresult _cuEGLStreamConsumerAcquireFrame(CUeglStreamConnection* conn, CUgraphicsResource* pCudaResource, CUstream* pStream, unsigned int timeout) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuEGLStreamConsumerAcquireFrame + _check_or_init_driver() + if __cuEGLStreamConsumerAcquireFrame == NULL: + with gil: + raise FunctionNotFoundError("function cuEGLStreamConsumerAcquireFrame is not found") + return (__cuEGLStreamConsumerAcquireFrame)( + conn, pCudaResource, pStream, timeout) + + +cdef CUresult _cuEGLStreamConsumerReleaseFrame(CUeglStreamConnection* conn, CUgraphicsResource pCudaResource, CUstream* pStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuEGLStreamConsumerReleaseFrame + _check_or_init_driver() + if __cuEGLStreamConsumerReleaseFrame == NULL: + with gil: + raise FunctionNotFoundError("function cuEGLStreamConsumerReleaseFrame is not found") + return (__cuEGLStreamConsumerReleaseFrame)( + conn, pCudaResource, pStream) + + +cdef CUresult _cuEGLStreamProducerConnect(CUeglStreamConnection* conn, EGLStreamKHR stream, EGLint width, EGLint height) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuEGLStreamProducerConnect + _check_or_init_driver() + if __cuEGLStreamProducerConnect == NULL: + with gil: + raise FunctionNotFoundError("function cuEGLStreamProducerConnect is not found") + return (__cuEGLStreamProducerConnect)( + conn, stream, width, height) + + +cdef CUresult _cuEGLStreamProducerDisconnect(CUeglStreamConnection* conn) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuEGLStreamProducerDisconnect + _check_or_init_driver() + if __cuEGLStreamProducerDisconnect == NULL: + with gil: + raise FunctionNotFoundError("function cuEGLStreamProducerDisconnect is not found") + return (__cuEGLStreamProducerDisconnect)( + conn) + + +cdef CUresult _cuEGLStreamProducerPresentFrame(CUeglStreamConnection* conn, CUeglFrame eglframe, CUstream* pStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuEGLStreamProducerPresentFrame + _check_or_init_driver() + if __cuEGLStreamProducerPresentFrame == NULL: + with gil: + raise FunctionNotFoundError("function cuEGLStreamProducerPresentFrame is not found") + return (__cuEGLStreamProducerPresentFrame)( + conn, eglframe, pStream) + + +cdef CUresult _cuEGLStreamProducerReturnFrame(CUeglStreamConnection* conn, CUeglFrame* eglframe, CUstream* pStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuEGLStreamProducerReturnFrame + _check_or_init_driver() + if __cuEGLStreamProducerReturnFrame == NULL: + with gil: + raise FunctionNotFoundError("function cuEGLStreamProducerReturnFrame is not found") + return (__cuEGLStreamProducerReturnFrame)( + conn, eglframe, pStream) + + +cdef CUresult _cuGraphicsResourceGetMappedEglFrame(CUeglFrame* eglFrame, CUgraphicsResource resource, unsigned int index, unsigned int mipLevel) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphicsResourceGetMappedEglFrame + _check_or_init_driver() + if __cuGraphicsResourceGetMappedEglFrame == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphicsResourceGetMappedEglFrame is not found") + return (__cuGraphicsResourceGetMappedEglFrame)( + eglFrame, resource, index, mipLevel) + + +cdef CUresult _cuEventCreateFromEGLSync(CUevent* phEvent, EGLSyncKHR eglSync, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuEventCreateFromEGLSync + _check_or_init_driver() + if __cuEventCreateFromEGLSync == NULL: + with gil: + raise FunctionNotFoundError("function cuEventCreateFromEGLSync is not found") + return (__cuEventCreateFromEGLSync)( + phEvent, eglSync, flags) + + +cdef CUresult _cuGraphicsGLRegisterBuffer(CUgraphicsResource* pCudaResource, GLuint buffer, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphicsGLRegisterBuffer + _check_or_init_driver() + if __cuGraphicsGLRegisterBuffer == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphicsGLRegisterBuffer is not found") + return (__cuGraphicsGLRegisterBuffer)( + pCudaResource, buffer, Flags) + + +cdef CUresult _cuGraphicsGLRegisterImage(CUgraphicsResource* pCudaResource, GLuint image, GLenum target, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphicsGLRegisterImage + _check_or_init_driver() + if __cuGraphicsGLRegisterImage == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphicsGLRegisterImage is not found") + return (__cuGraphicsGLRegisterImage)( + pCudaResource, image, target, Flags) + + +cdef CUresult _cuGLGetDevices_v2(unsigned int* pCudaDeviceCount, CUdevice* pCudaDevices, unsigned int cudaDeviceCount, CUGLDeviceList deviceList) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGLGetDevices_v2 + _check_or_init_driver() + if __cuGLGetDevices_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuGLGetDevices_v2 is not found") + return (__cuGLGetDevices_v2)( + pCudaDeviceCount, pCudaDevices, cudaDeviceCount, deviceList) + + +cdef CUresult _cuGLCtxCreate_v2(CUcontext* pCtx, unsigned int Flags, CUdevice device) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGLCtxCreate_v2 + _check_or_init_driver() + if __cuGLCtxCreate_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuGLCtxCreate_v2 is not found") + return (__cuGLCtxCreate_v2)( + pCtx, Flags, device) + + +cdef CUresult _cuGLInit() except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGLInit + _check_or_init_driver() + if __cuGLInit == NULL: + with gil: + raise FunctionNotFoundError("function cuGLInit is not found") + return (__cuGLInit)( + ) + + +cdef CUresult _cuGLRegisterBufferObject(GLuint buffer) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGLRegisterBufferObject + _check_or_init_driver() + if __cuGLRegisterBufferObject == NULL: + with gil: + raise FunctionNotFoundError("function cuGLRegisterBufferObject is not found") + return (__cuGLRegisterBufferObject)( + buffer) + + +cdef CUresult _cuGLMapBufferObject_v2(CUdeviceptr* dptr, size_t* size, GLuint buffer) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGLMapBufferObject_v2 + _check_or_init_driver() + if __cuGLMapBufferObject_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuGLMapBufferObject_v2 is not found") + return (__cuGLMapBufferObject_v2)( + dptr, size, buffer) + + +cdef CUresult _cuGLUnmapBufferObject(GLuint buffer) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGLUnmapBufferObject + _check_or_init_driver() + if __cuGLUnmapBufferObject == NULL: + with gil: + raise FunctionNotFoundError("function cuGLUnmapBufferObject is not found") + return (__cuGLUnmapBufferObject)( + buffer) + + +cdef CUresult _cuGLUnregisterBufferObject(GLuint buffer) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGLUnregisterBufferObject + _check_or_init_driver() + if __cuGLUnregisterBufferObject == NULL: + with gil: + raise FunctionNotFoundError("function cuGLUnregisterBufferObject is not found") + return (__cuGLUnregisterBufferObject)( + buffer) + + +cdef CUresult _cuGLSetBufferObjectMapFlags(GLuint buffer, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGLSetBufferObjectMapFlags + _check_or_init_driver() + if __cuGLSetBufferObjectMapFlags == NULL: + with gil: + raise FunctionNotFoundError("function cuGLSetBufferObjectMapFlags is not found") + return (__cuGLSetBufferObjectMapFlags)( + buffer, Flags) + + +cdef CUresult _cuGLMapBufferObjectAsync_v2(CUdeviceptr* dptr, size_t* size, GLuint buffer, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGLMapBufferObjectAsync_v2 + _check_or_init_driver() + if __cuGLMapBufferObjectAsync_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuGLMapBufferObjectAsync_v2 is not found") + return (__cuGLMapBufferObjectAsync_v2)( + dptr, size, buffer, hStream) + + +cdef CUresult _cuGLUnmapBufferObjectAsync(GLuint buffer, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGLUnmapBufferObjectAsync + _check_or_init_driver() + if __cuGLUnmapBufferObjectAsync == NULL: + with gil: + raise FunctionNotFoundError("function cuGLUnmapBufferObjectAsync is not found") + return (__cuGLUnmapBufferObjectAsync)( + buffer, hStream) + + +cdef CUresult _cuProfilerInitialize(const char* configFile, const char* outputFile, CUoutput_mode outputMode) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuProfilerInitialize + _check_or_init_driver() + if __cuProfilerInitialize == NULL: + with gil: + raise FunctionNotFoundError("function cuProfilerInitialize is not found") + return (__cuProfilerInitialize)( + configFile, outputFile, outputMode) + + +cdef CUresult _cuProfilerStart() except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuProfilerStart + _check_or_init_driver() + if __cuProfilerStart == NULL: + with gil: + raise FunctionNotFoundError("function cuProfilerStart is not found") + return (__cuProfilerStart)( + ) + + +cdef CUresult _cuProfilerStop() except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuProfilerStop + _check_or_init_driver() + if __cuProfilerStop == NULL: + with gil: + raise FunctionNotFoundError("function cuProfilerStop is not found") + return (__cuProfilerStop)( + ) + + +cdef CUresult _cuVDPAUGetDevice(CUdevice* pDevice, VdpDevice vdpDevice, VdpGetProcAddress* vdpGetProcAddress) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuVDPAUGetDevice + _check_or_init_driver() + if __cuVDPAUGetDevice == NULL: + with gil: + raise FunctionNotFoundError("function cuVDPAUGetDevice is not found") + return (__cuVDPAUGetDevice)( + pDevice, vdpDevice, vdpGetProcAddress) + + +cdef CUresult _cuVDPAUCtxCreate_v2(CUcontext* pCtx, unsigned int flags, CUdevice device, VdpDevice vdpDevice, VdpGetProcAddress* vdpGetProcAddress) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuVDPAUCtxCreate_v2 + _check_or_init_driver() + if __cuVDPAUCtxCreate_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuVDPAUCtxCreate_v2 is not found") + return (__cuVDPAUCtxCreate_v2)( + pCtx, flags, device, vdpDevice, vdpGetProcAddress) + + +cdef CUresult _cuGraphicsVDPAURegisterVideoSurface(CUgraphicsResource* pCudaResource, VdpVideoSurface vdpSurface, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphicsVDPAURegisterVideoSurface + _check_or_init_driver() + if __cuGraphicsVDPAURegisterVideoSurface == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphicsVDPAURegisterVideoSurface is not found") + return (__cuGraphicsVDPAURegisterVideoSurface)( + pCudaResource, vdpSurface, flags) + + +cdef CUresult _cuGraphicsVDPAURegisterOutputSurface(CUgraphicsResource* pCudaResource, VdpOutputSurface vdpSurface, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphicsVDPAURegisterOutputSurface + _check_or_init_driver() + if __cuGraphicsVDPAURegisterOutputSurface == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphicsVDPAURegisterOutputSurface is not found") + return (__cuGraphicsVDPAURegisterOutputSurface)( + pCudaResource, vdpSurface, flags) + + +cdef CUresult _cuDeviceGetHostAtomicCapabilities(unsigned int* capabilities, const CUatomicOperation* operations, unsigned int count, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDeviceGetHostAtomicCapabilities + _check_or_init_driver() + if __cuDeviceGetHostAtomicCapabilities == NULL: + with gil: + raise FunctionNotFoundError("function cuDeviceGetHostAtomicCapabilities is not found") + return (__cuDeviceGetHostAtomicCapabilities)( + capabilities, operations, count, dev) + + +cdef CUresult _cuCtxGetDevice_v2(CUdevice* device, CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxGetDevice_v2 + _check_or_init_driver() + if __cuCtxGetDevice_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxGetDevice_v2 is not found") + return (__cuCtxGetDevice_v2)( + device, ctx) + + +cdef CUresult _cuCtxSynchronize_v2(CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxSynchronize_v2 + _check_or_init_driver() + if __cuCtxSynchronize_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxSynchronize_v2 is not found") + return (__cuCtxSynchronize_v2)( + ctx) + + +cdef CUresult _cuMemcpyBatchAsync_v2(CUdeviceptr* dsts, CUdeviceptr* srcs, size_t* sizes, size_t count, CUmemcpyAttributes* attrs, size_t* attrsIdxs, size_t numAttrs, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemcpyBatchAsync_v2 + _check_or_init_driver() + if __cuMemcpyBatchAsync_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemcpyBatchAsync_v2 is not found") + return (__cuMemcpyBatchAsync_v2)( + dsts, srcs, sizes, count, attrs, attrsIdxs, numAttrs, hStream) + + +cdef CUresult _cuMemcpy3DBatchAsync_v2(size_t numOps, CUDA_MEMCPY3D_BATCH_OP* opList, unsigned long long flags, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemcpy3DBatchAsync_v2 + _check_or_init_driver() + if __cuMemcpy3DBatchAsync_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemcpy3DBatchAsync_v2 is not found") + return (__cuMemcpy3DBatchAsync_v2)( + numOps, opList, flags, hStream) + + +cdef CUresult _cuMemGetDefaultMemPool(CUmemoryPool* pool_out, CUmemLocation* location, CUmemAllocationType type) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemGetDefaultMemPool + _check_or_init_driver() + if __cuMemGetDefaultMemPool == NULL: + with gil: + raise FunctionNotFoundError("function cuMemGetDefaultMemPool is not found") + return (__cuMemGetDefaultMemPool)( + pool_out, location, type) + + +cdef CUresult _cuMemGetMemPool(CUmemoryPool* pool, CUmemLocation* location, CUmemAllocationType type) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemGetMemPool + _check_or_init_driver() + if __cuMemGetMemPool == NULL: + with gil: + raise FunctionNotFoundError("function cuMemGetMemPool is not found") + return (__cuMemGetMemPool)( + pool, location, type) + + +cdef CUresult _cuMemSetMemPool(CUmemLocation* location, CUmemAllocationType type, CUmemoryPool pool) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemSetMemPool + _check_or_init_driver() + if __cuMemSetMemPool == NULL: + with gil: + raise FunctionNotFoundError("function cuMemSetMemPool is not found") + return (__cuMemSetMemPool)( + location, type, pool) + + +cdef CUresult _cuMemPrefetchBatchAsync(CUdeviceptr* dptrs, size_t* sizes, size_t count, CUmemLocation* prefetchLocs, size_t* prefetchLocIdxs, size_t numPrefetchLocs, unsigned long long flags, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemPrefetchBatchAsync + _check_or_init_driver() + if __cuMemPrefetchBatchAsync == NULL: + with gil: + raise FunctionNotFoundError("function cuMemPrefetchBatchAsync is not found") + return (__cuMemPrefetchBatchAsync)( + dptrs, sizes, count, prefetchLocs, prefetchLocIdxs, numPrefetchLocs, flags, hStream) + + +cdef CUresult _cuMemDiscardBatchAsync(CUdeviceptr* dptrs, size_t* sizes, size_t count, unsigned long long flags, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemDiscardBatchAsync + _check_or_init_driver() + if __cuMemDiscardBatchAsync == NULL: + with gil: + raise FunctionNotFoundError("function cuMemDiscardBatchAsync is not found") + return (__cuMemDiscardBatchAsync)( + dptrs, sizes, count, flags, hStream) + + +cdef CUresult _cuMemDiscardAndPrefetchBatchAsync(CUdeviceptr* dptrs, size_t* sizes, size_t count, CUmemLocation* prefetchLocs, size_t* prefetchLocIdxs, size_t numPrefetchLocs, unsigned long long flags, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemDiscardAndPrefetchBatchAsync + _check_or_init_driver() + if __cuMemDiscardAndPrefetchBatchAsync == NULL: + with gil: + raise FunctionNotFoundError("function cuMemDiscardAndPrefetchBatchAsync is not found") + return (__cuMemDiscardAndPrefetchBatchAsync)( + dptrs, sizes, count, prefetchLocs, prefetchLocIdxs, numPrefetchLocs, flags, hStream) + + +cdef CUresult _cuDeviceGetP2PAtomicCapabilities(unsigned int* capabilities, const CUatomicOperation* operations, unsigned int count, CUdevice srcDevice, CUdevice dstDevice) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDeviceGetP2PAtomicCapabilities + _check_or_init_driver() + if __cuDeviceGetP2PAtomicCapabilities == NULL: + with gil: + raise FunctionNotFoundError("function cuDeviceGetP2PAtomicCapabilities is not found") + return (__cuDeviceGetP2PAtomicCapabilities)( + capabilities, operations, count, srcDevice, dstDevice) + + +cdef CUresult _cuGreenCtxGetId(CUgreenCtx greenCtx, unsigned long long* greenCtxId) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGreenCtxGetId + _check_or_init_driver() + if __cuGreenCtxGetId == NULL: + with gil: + raise FunctionNotFoundError("function cuGreenCtxGetId is not found") + return (__cuGreenCtxGetId)( + greenCtx, greenCtxId) + + +cdef CUresult _cuMulticastBindMem_v2(CUmemGenericAllocationHandle mcHandle, CUdevice dev, size_t mcOffset, CUmemGenericAllocationHandle memHandle, size_t memOffset, size_t size, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMulticastBindMem_v2 + _check_or_init_driver() + if __cuMulticastBindMem_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMulticastBindMem_v2 is not found") + return (__cuMulticastBindMem_v2)( + mcHandle, dev, mcOffset, memHandle, memOffset, size, flags) + + +cdef CUresult _cuMulticastBindAddr_v2(CUmemGenericAllocationHandle mcHandle, CUdevice dev, size_t mcOffset, CUdeviceptr memptr, size_t size, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMulticastBindAddr_v2 + _check_or_init_driver() + if __cuMulticastBindAddr_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMulticastBindAddr_v2 is not found") + return (__cuMulticastBindAddr_v2)( + mcHandle, dev, mcOffset, memptr, size, flags) + + +cdef CUresult _cuGraphNodeGetContainingGraph(CUgraphNode hNode, CUgraph* phGraph) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphNodeGetContainingGraph + _check_or_init_driver() + if __cuGraphNodeGetContainingGraph == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphNodeGetContainingGraph is not found") + return (__cuGraphNodeGetContainingGraph)( + hNode, phGraph) + + +cdef CUresult _cuGraphNodeGetLocalId(CUgraphNode hNode, unsigned int* nodeId) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphNodeGetLocalId + _check_or_init_driver() + if __cuGraphNodeGetLocalId == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphNodeGetLocalId is not found") + return (__cuGraphNodeGetLocalId)( + hNode, nodeId) + + +cdef CUresult _cuGraphNodeGetToolsId(CUgraphNode hNode, unsigned long long* toolsNodeId) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphNodeGetToolsId + _check_or_init_driver() + if __cuGraphNodeGetToolsId == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphNodeGetToolsId is not found") + return (__cuGraphNodeGetToolsId)( + hNode, toolsNodeId) + + +cdef CUresult _cuGraphGetId(CUgraph hGraph, unsigned int* graphId) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphGetId + _check_or_init_driver() + if __cuGraphGetId == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphGetId is not found") + return (__cuGraphGetId)( + hGraph, graphId) + + +cdef CUresult _cuGraphExecGetId(CUgraphExec hGraphExec, unsigned int* graphId) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphExecGetId + _check_or_init_driver() + if __cuGraphExecGetId == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphExecGetId is not found") + return (__cuGraphExecGetId)( + hGraphExec, graphId) + + +cdef CUresult _cuDevSmResourceSplit(CUdevResource* result, unsigned int nbGroups, const CUdevResource* input, CUdevResource* remainder, unsigned int flags, CU_DEV_SM_RESOURCE_GROUP_PARAMS* groupParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDevSmResourceSplit + _check_or_init_driver() + if __cuDevSmResourceSplit == NULL: + with gil: + raise FunctionNotFoundError("function cuDevSmResourceSplit is not found") + return (__cuDevSmResourceSplit)( + result, nbGroups, input, remainder, flags, groupParams) + + +cdef CUresult _cuStreamGetDevResource(CUstream hStream, CUdevResource* resource, CUdevResourceType type) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamGetDevResource + _check_or_init_driver() + if __cuStreamGetDevResource == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamGetDevResource is not found") + return (__cuStreamGetDevResource)( + hStream, resource, type) + + +cdef CUresult _cuKernelGetParamCount(CUkernel kernel, size_t* paramCount) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuKernelGetParamCount + _check_or_init_driver() + if __cuKernelGetParamCount == NULL: + with gil: + raise FunctionNotFoundError("function cuKernelGetParamCount is not found") + return (__cuKernelGetParamCount)( + kernel, paramCount) + + +cdef CUresult _cuMemcpyWithAttributesAsync(CUdeviceptr dst, CUdeviceptr src, size_t size, CUmemcpyAttributes* attr, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemcpyWithAttributesAsync + _check_or_init_driver() + if __cuMemcpyWithAttributesAsync == NULL: + with gil: + raise FunctionNotFoundError("function cuMemcpyWithAttributesAsync is not found") + return (__cuMemcpyWithAttributesAsync)( + dst, src, size, attr, hStream) + + +cdef CUresult _cuMemcpy3DWithAttributesAsync(CUDA_MEMCPY3D_BATCH_OP* op, unsigned long long flags, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemcpy3DWithAttributesAsync + _check_or_init_driver() + if __cuMemcpy3DWithAttributesAsync == NULL: + with gil: + raise FunctionNotFoundError("function cuMemcpy3DWithAttributesAsync is not found") + return (__cuMemcpy3DWithAttributesAsync)( + op, flags, hStream) + + +cdef CUresult _cuStreamBeginCaptureToCig(CUstream hStream, CUstreamCigCaptureParams* streamCigCaptureParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamBeginCaptureToCig + _check_or_init_driver() + if __cuStreamBeginCaptureToCig == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamBeginCaptureToCig is not found") + return (__cuStreamBeginCaptureToCig)( + hStream, streamCigCaptureParams) + + +cdef CUresult _cuStreamEndCaptureToCig(CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamEndCaptureToCig + _check_or_init_driver() + if __cuStreamEndCaptureToCig == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamEndCaptureToCig is not found") + return (__cuStreamEndCaptureToCig)( + hStream) + + +cdef CUresult _cuFuncGetParamCount(CUfunction func, size_t* paramCount) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuFuncGetParamCount + _check_or_init_driver() + if __cuFuncGetParamCount == NULL: + with gil: + raise FunctionNotFoundError("function cuFuncGetParamCount is not found") + return (__cuFuncGetParamCount)( + func, paramCount) + + +cdef CUresult _cuLaunchHostFunc_v2(CUstream hStream, CUhostFn fn, void* userData, unsigned int syncMode) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLaunchHostFunc_v2 + _check_or_init_driver() + if __cuLaunchHostFunc_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuLaunchHostFunc_v2 is not found") + return (__cuLaunchHostFunc_v2)( + hStream, fn, userData, syncMode) + + +cdef CUresult _cuGraphNodeGetParams(CUgraphNode hNode, CUgraphNodeParams* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphNodeGetParams + _check_or_init_driver() + if __cuGraphNodeGetParams == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphNodeGetParams is not found") + return (__cuGraphNodeGetParams)( + hNode, nodeParams) + + +cdef CUresult _cuCoredumpRegisterStartCallback(CUcoredumpStatusCallback callback, void* userData, CUcoredumpCallbackHandle* callbackOut) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCoredumpRegisterStartCallback + _check_or_init_driver() + if __cuCoredumpRegisterStartCallback == NULL: + with gil: + raise FunctionNotFoundError("function cuCoredumpRegisterStartCallback is not found") + return (__cuCoredumpRegisterStartCallback)( + callback, userData, callbackOut) + + +cdef CUresult _cuCoredumpRegisterCompleteCallback(CUcoredumpStatusCallback callback, void* userData, CUcoredumpCallbackHandle* callbackOut) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCoredumpRegisterCompleteCallback + _check_or_init_driver() + if __cuCoredumpRegisterCompleteCallback == NULL: + with gil: + raise FunctionNotFoundError("function cuCoredumpRegisterCompleteCallback is not found") + return (__cuCoredumpRegisterCompleteCallback)( + callback, userData, callbackOut) + + +cdef CUresult _cuCoredumpDeregisterStartCallback(CUcoredumpCallbackHandle callback) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCoredumpDeregisterStartCallback + _check_or_init_driver() + if __cuCoredumpDeregisterStartCallback == NULL: + with gil: + raise FunctionNotFoundError("function cuCoredumpDeregisterStartCallback is not found") + return (__cuCoredumpDeregisterStartCallback)( + callback) + + +cdef CUresult _cuCoredumpDeregisterCompleteCallback(CUcoredumpCallbackHandle callback) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCoredumpDeregisterCompleteCallback + _check_or_init_driver() + if __cuCoredumpDeregisterCompleteCallback == NULL: + with gil: + raise FunctionNotFoundError("function cuCoredumpDeregisterCompleteCallback is not found") + return (__cuCoredumpDeregisterCompleteCallback)( + callback) + + +cdef CUresult _cuLogicalEndpointIdReserve(CUlogicalEndpointId* baseLeId, cuuint32_t count) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLogicalEndpointIdReserve + _check_or_init_driver() + if __cuLogicalEndpointIdReserve == NULL: + with gil: + raise FunctionNotFoundError("function cuLogicalEndpointIdReserve is not found") + return (__cuLogicalEndpointIdReserve)( + baseLeId, count) + + +cdef CUresult _cuLogicalEndpointIdRelease(CUlogicalEndpointId baseLeId, cuuint32_t count) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLogicalEndpointIdRelease + _check_or_init_driver() + if __cuLogicalEndpointIdRelease == NULL: + with gil: + raise FunctionNotFoundError("function cuLogicalEndpointIdRelease is not found") + return (__cuLogicalEndpointIdRelease)( + baseLeId, count) + + +cdef CUresult _cuLogicalEndpointCreate(CUlogicalEndpointId leId, const CUlogicalEndpointProp* prop) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLogicalEndpointCreate + _check_or_init_driver() + if __cuLogicalEndpointCreate == NULL: + with gil: + raise FunctionNotFoundError("function cuLogicalEndpointCreate is not found") + return (__cuLogicalEndpointCreate)( + leId, prop) + + +cdef CUresult _cuLogicalEndpointAddDevice(CUlogicalEndpointId leId, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLogicalEndpointAddDevice + _check_or_init_driver() + if __cuLogicalEndpointAddDevice == NULL: + with gil: + raise FunctionNotFoundError("function cuLogicalEndpointAddDevice is not found") + return (__cuLogicalEndpointAddDevice)( + leId, dev) + + +cdef CUresult _cuLogicalEndpointDestroy(CUlogicalEndpointId leId) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLogicalEndpointDestroy + _check_or_init_driver() + if __cuLogicalEndpointDestroy == NULL: + with gil: + raise FunctionNotFoundError("function cuLogicalEndpointDestroy is not found") + return (__cuLogicalEndpointDestroy)( + leId) + + +cdef CUresult _cuLogicalEndpointBindAddr(CUlogicalEndpointId leId, CUdevice dev, cuuint64_t offset, void* ptr, cuuint64_t size, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLogicalEndpointBindAddr + _check_or_init_driver() + if __cuLogicalEndpointBindAddr == NULL: + with gil: + raise FunctionNotFoundError("function cuLogicalEndpointBindAddr is not found") + return (__cuLogicalEndpointBindAddr)( + leId, dev, offset, ptr, size, flags) + + +cdef CUresult _cuLogicalEndpointBindMem(CUlogicalEndpointId leId, CUdevice dev, cuuint64_t offset, CUmemGenericAllocationHandle memHandle, cuuint64_t memOffset, cuuint64_t size, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLogicalEndpointBindMem + _check_or_init_driver() + if __cuLogicalEndpointBindMem == NULL: + with gil: + raise FunctionNotFoundError("function cuLogicalEndpointBindMem is not found") + return (__cuLogicalEndpointBindMem)( + leId, dev, offset, memHandle, memOffset, size, flags) + + +cdef CUresult _cuLogicalEndpointUnbind(CUlogicalEndpointId leId, CUdevice dev, cuuint64_t offset, cuuint64_t size) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLogicalEndpointUnbind + _check_or_init_driver() + if __cuLogicalEndpointUnbind == NULL: + with gil: + raise FunctionNotFoundError("function cuLogicalEndpointUnbind is not found") + return (__cuLogicalEndpointUnbind)( + leId, dev, offset, size) + + +cdef CUresult _cuLogicalEndpointExport(void* handle, CUlogicalEndpointId leId, CUlogicalEndpointIpcHandleType handleType) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLogicalEndpointExport + _check_or_init_driver() + if __cuLogicalEndpointExport == NULL: + with gil: + raise FunctionNotFoundError("function cuLogicalEndpointExport is not found") + return (__cuLogicalEndpointExport)( + handle, leId, handleType) + + +cdef CUresult _cuLogicalEndpointImport(CUlogicalEndpointId leId, const void* handle, CUlogicalEndpointIpcHandleType handleType) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLogicalEndpointImport + _check_or_init_driver() + if __cuLogicalEndpointImport == NULL: + with gil: + raise FunctionNotFoundError("function cuLogicalEndpointImport is not found") + return (__cuLogicalEndpointImport)( + leId, handle, handleType) + + +cdef CUresult _cuLogicalEndpointGetLimits(cuuint64_t* bindAlignment, cuuint64_t* maxSize, const CUlogicalEndpointProp* prop) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLogicalEndpointGetLimits + _check_or_init_driver() + if __cuLogicalEndpointGetLimits == NULL: + with gil: + raise FunctionNotFoundError("function cuLogicalEndpointGetLimits is not found") + return (__cuLogicalEndpointGetLimits)( + bindAlignment, maxSize, prop) + + +cdef CUresult _cuLogicalEndpointQuery(CUlogicalEndpointId leId, cuuint32_t count, int* queryStatus) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLogicalEndpointQuery + _check_or_init_driver() + if __cuLogicalEndpointQuery == NULL: + with gil: + raise FunctionNotFoundError("function cuLogicalEndpointQuery is not found") + return (__cuLogicalEndpointQuery)( + leId, count, queryStatus) + + +cdef CUresult _cuStreamBeginRecaptureToGraph(CUstream hStream, CUstreamCaptureMode mode, CUgraph hGraph, CUgraphRecaptureCallback callbackFunc, void* userData) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamBeginRecaptureToGraph + _check_or_init_driver() + if __cuStreamBeginRecaptureToGraph == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamBeginRecaptureToGraph is not found") + return (__cuStreamBeginRecaptureToGraph)( + hStream, mode, hGraph, callbackFunc, userData) diff --git a/cuda_bindings/cuda/bindings/_internal/driver_windows.pyx b/cuda_bindings/cuda/bindings/_internal/driver_windows.pyx new file mode 100644 index 00000000000..4cc1ab3e1c5 --- /dev/null +++ b/cuda_bindings/cuda/bindings/_internal/driver_windows.pyx @@ -0,0 +1,8885 @@ +# SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +# This code was automatically generated across versions from 12.9.0 to 13.3.0. Do not modify it directly. +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=501497a3d88840c62eda1dfb0b72fe7494ff20a208230b1f45ad2f0c11bf47a5 + + +# <<<< PREAMBLE CONTENT >>>> + +cdef extern from "": + ctypedef void* HMODULE + void* _cyb_GetProcAddress "GetProcAddress"(HMODULE, const char*) nogil + +from libc.stdint cimport intptr_t as _cyb_intptr_t + +from os import getenv as _cyb_getenv +import threading as _cyb_threading + +ctypedef int (*_cyb_cuGetProcAddress_v2_T)(const char *, void **, int, cuuint64_t, CUdriverProcAddressQueryResult *)except?CUDA_ERROR_NOT_FOUND nogil + +cdef bint _cyb___py_driver_init = False +cdef dict _cyb_func_ptrs = None +cdef object _cyb_symbol_lock = _cyb_threading.Lock() + +# <<<< END OF PREAMBLE CONTENT >>>> + +from libc.stdint cimport uintptr_t + +from .utils import FunctionNotFoundError, NotSupportedError +from cuda.pathfinder import load_nvidia_dynamic_lib + + +############################################################################### +# Wrapper init +############################################################################### + + +cdef void* __cuGetErrorString = NULL +cdef void* __cuGetErrorName = NULL +cdef void* __cuInit = NULL +cdef void* __cuDriverGetVersion = NULL +cdef void* __cuDeviceGet = NULL +cdef void* __cuDeviceGetCount = NULL +cdef void* __cuDeviceGetName = NULL +cdef void* __cuDeviceGetUuid_v2 = NULL +cdef void* __cuDeviceGetLuid = NULL +cdef void* __cuDeviceTotalMem_v2 = NULL +cdef void* __cuDeviceGetTexture1DLinearMaxWidth = NULL +cdef void* __cuDeviceGetAttribute = NULL +cdef void* __cuDeviceGetNvSciSyncAttributes = NULL +cdef void* __cuDeviceSetMemPool = NULL +cdef void* __cuDeviceGetMemPool = NULL +cdef void* __cuDeviceGetDefaultMemPool = NULL +cdef void* __cuDeviceGetExecAffinitySupport = NULL +cdef void* __cuFlushGPUDirectRDMAWrites = NULL +cdef void* __cuDeviceGetProperties = NULL +cdef void* __cuDeviceComputeCapability = NULL +cdef void* __cuDevicePrimaryCtxRetain = NULL +cdef void* __cuDevicePrimaryCtxRelease_v2 = NULL +cdef void* __cuDevicePrimaryCtxSetFlags_v2 = NULL +cdef void* __cuDevicePrimaryCtxGetState = NULL +cdef void* __cuDevicePrimaryCtxReset_v2 = NULL +cdef void* __cuCtxCreate_v2 = NULL +cdef void* __cuCtxCreate_v3 = NULL +cdef void* __cuCtxCreate_v4 = NULL +cdef void* __cuCtxDestroy_v2 = NULL +cdef void* __cuCtxPushCurrent_v2 = NULL +cdef void* __cuCtxPopCurrent_v2 = NULL +cdef void* __cuCtxSetCurrent = NULL +cdef void* __cuCtxGetCurrent = NULL +cdef void* __cuCtxGetDevice = NULL +cdef void* __cuCtxGetFlags = NULL +cdef void* __cuCtxSetFlags = NULL +cdef void* __cuCtxGetId = NULL +cdef void* __cuCtxSynchronize = NULL +cdef void* __cuCtxSetLimit = NULL +cdef void* __cuCtxGetLimit = NULL +cdef void* __cuCtxGetCacheConfig = NULL +cdef void* __cuCtxSetCacheConfig = NULL +cdef void* __cuCtxGetApiVersion = NULL +cdef void* __cuCtxGetStreamPriorityRange = NULL +cdef void* __cuCtxResetPersistingL2Cache = NULL +cdef void* __cuCtxGetExecAffinity = NULL +cdef void* __cuCtxRecordEvent = NULL +cdef void* __cuCtxWaitEvent = NULL +cdef void* __cuCtxAttach = NULL +cdef void* __cuCtxDetach = NULL +cdef void* __cuCtxGetSharedMemConfig = NULL +cdef void* __cuCtxSetSharedMemConfig = NULL +cdef void* __cuModuleLoad = NULL +cdef void* __cuModuleLoadData = NULL +cdef void* __cuModuleLoadDataEx = NULL +cdef void* __cuModuleLoadFatBinary = NULL +cdef void* __cuModuleUnload = NULL +cdef void* __cuModuleGetLoadingMode = NULL +cdef void* __cuModuleGetFunction = NULL +cdef void* __cuModuleGetFunctionCount = NULL +cdef void* __cuModuleEnumerateFunctions = NULL +cdef void* __cuModuleGetGlobal_v2 = NULL +cdef void* __cuLinkCreate_v2 = NULL +cdef void* __cuLinkAddData_v2 = NULL +cdef void* __cuLinkAddFile_v2 = NULL +cdef void* __cuLinkComplete = NULL +cdef void* __cuLinkDestroy = NULL +cdef void* __cuModuleGetTexRef = NULL +cdef void* __cuModuleGetSurfRef = NULL +cdef void* __cuLibraryLoadData = NULL +cdef void* __cuLibraryLoadFromFile = NULL +cdef void* __cuLibraryUnload = NULL +cdef void* __cuLibraryGetKernel = NULL +cdef void* __cuLibraryGetKernelCount = NULL +cdef void* __cuLibraryEnumerateKernels = NULL +cdef void* __cuLibraryGetModule = NULL +cdef void* __cuKernelGetFunction = NULL +cdef void* __cuKernelGetLibrary = NULL +cdef void* __cuLibraryGetGlobal = NULL +cdef void* __cuLibraryGetManaged = NULL +cdef void* __cuLibraryGetUnifiedFunction = NULL +cdef void* __cuKernelGetAttribute = NULL +cdef void* __cuKernelSetAttribute = NULL +cdef void* __cuKernelSetCacheConfig = NULL +cdef void* __cuKernelGetName = NULL +cdef void* __cuKernelGetParamInfo = NULL +cdef void* __cuMemGetInfo_v2 = NULL +cdef void* __cuMemAlloc_v2 = NULL +cdef void* __cuMemAllocPitch_v2 = NULL +cdef void* __cuMemFree_v2 = NULL +cdef void* __cuMemGetAddressRange_v2 = NULL +cdef void* __cuMemAllocHost_v2 = NULL +cdef void* __cuMemFreeHost = NULL +cdef void* __cuMemHostAlloc = NULL +cdef void* __cuMemHostGetDevicePointer_v2 = NULL +cdef void* __cuMemHostGetFlags = NULL +cdef void* __cuMemAllocManaged = NULL +cdef void* __cuDeviceRegisterAsyncNotification = NULL +cdef void* __cuDeviceUnregisterAsyncNotification = NULL +cdef void* __cuDeviceGetByPCIBusId = NULL +cdef void* __cuDeviceGetPCIBusId = NULL +cdef void* __cuIpcGetEventHandle = NULL +cdef void* __cuIpcOpenEventHandle = NULL +cdef void* __cuIpcGetMemHandle = NULL +cdef void* __cuIpcOpenMemHandle_v2 = NULL +cdef void* __cuIpcCloseMemHandle = NULL +cdef void* __cuMemHostRegister_v2 = NULL +cdef void* __cuMemHostUnregister = NULL +cdef void* __cuMemcpy = NULL +cdef void* __cuMemcpyPeer = NULL +cdef void* __cuMemcpyHtoD_v2 = NULL +cdef void* __cuMemcpyDtoH_v2 = NULL +cdef void* __cuMemcpyDtoD_v2 = NULL +cdef void* __cuMemcpyDtoA_v2 = NULL +cdef void* __cuMemcpyAtoD_v2 = NULL +cdef void* __cuMemcpyHtoA_v2 = NULL +cdef void* __cuMemcpyAtoH_v2 = NULL +cdef void* __cuMemcpyAtoA_v2 = NULL +cdef void* __cuMemcpy2D_v2 = NULL +cdef void* __cuMemcpy2DUnaligned_v2 = NULL +cdef void* __cuMemcpy3D_v2 = NULL +cdef void* __cuMemcpy3DPeer = NULL +cdef void* __cuMemcpyAsync = NULL +cdef void* __cuMemcpyPeerAsync = NULL +cdef void* __cuMemcpyHtoDAsync_v2 = NULL +cdef void* __cuMemcpyDtoHAsync_v2 = NULL +cdef void* __cuMemcpyDtoDAsync_v2 = NULL +cdef void* __cuMemcpyHtoAAsync_v2 = NULL +cdef void* __cuMemcpyAtoHAsync_v2 = NULL +cdef void* __cuMemcpy2DAsync_v2 = NULL +cdef void* __cuMemcpy3DAsync_v2 = NULL +cdef void* __cuMemcpy3DPeerAsync = NULL +cdef void* __cuMemsetD8_v2 = NULL +cdef void* __cuMemsetD16_v2 = NULL +cdef void* __cuMemsetD32_v2 = NULL +cdef void* __cuMemsetD2D8_v2 = NULL +cdef void* __cuMemsetD2D16_v2 = NULL +cdef void* __cuMemsetD2D32_v2 = NULL +cdef void* __cuMemsetD8Async = NULL +cdef void* __cuMemsetD16Async = NULL +cdef void* __cuMemsetD32Async = NULL +cdef void* __cuMemsetD2D8Async = NULL +cdef void* __cuMemsetD2D16Async = NULL +cdef void* __cuMemsetD2D32Async = NULL +cdef void* __cuArrayCreate_v2 = NULL +cdef void* __cuArrayGetDescriptor_v2 = NULL +cdef void* __cuArrayGetSparseProperties = NULL +cdef void* __cuMipmappedArrayGetSparseProperties = NULL +cdef void* __cuArrayGetMemoryRequirements = NULL +cdef void* __cuMipmappedArrayGetMemoryRequirements = NULL +cdef void* __cuArrayGetPlane = NULL +cdef void* __cuArrayDestroy = NULL +cdef void* __cuArray3DCreate_v2 = NULL +cdef void* __cuArray3DGetDescriptor_v2 = NULL +cdef void* __cuMipmappedArrayCreate = NULL +cdef void* __cuMipmappedArrayGetLevel = NULL +cdef void* __cuMipmappedArrayDestroy = NULL +cdef void* __cuMemGetHandleForAddressRange = NULL +cdef void* __cuMemBatchDecompressAsync = NULL +cdef void* __cuMemAddressReserve = NULL +cdef void* __cuMemAddressFree = NULL +cdef void* __cuMemCreate = NULL +cdef void* __cuMemRelease = NULL +cdef void* __cuMemMap = NULL +cdef void* __cuMemMapArrayAsync = NULL +cdef void* __cuMemUnmap = NULL +cdef void* __cuMemSetAccess = NULL +cdef void* __cuMemGetAccess = NULL +cdef void* __cuMemExportToShareableHandle = NULL +cdef void* __cuMemImportFromShareableHandle = NULL +cdef void* __cuMemGetAllocationGranularity = NULL +cdef void* __cuMemGetAllocationPropertiesFromHandle = NULL +cdef void* __cuMemRetainAllocationHandle = NULL +cdef void* __cuMemFreeAsync = NULL +cdef void* __cuMemAllocAsync = NULL +cdef void* __cuMemPoolTrimTo = NULL +cdef void* __cuMemPoolSetAttribute = NULL +cdef void* __cuMemPoolGetAttribute = NULL +cdef void* __cuMemPoolSetAccess = NULL +cdef void* __cuMemPoolGetAccess = NULL +cdef void* __cuMemPoolCreate = NULL +cdef void* __cuMemPoolDestroy = NULL +cdef void* __cuMemAllocFromPoolAsync = NULL +cdef void* __cuMemPoolExportToShareableHandle = NULL +cdef void* __cuMemPoolImportFromShareableHandle = NULL +cdef void* __cuMemPoolExportPointer = NULL +cdef void* __cuMemPoolImportPointer = NULL +cdef void* __cuMulticastCreate = NULL +cdef void* __cuMulticastAddDevice = NULL +cdef void* __cuMulticastBindMem = NULL +cdef void* __cuMulticastBindAddr = NULL +cdef void* __cuMulticastUnbind = NULL +cdef void* __cuMulticastGetGranularity = NULL +cdef void* __cuPointerGetAttribute = NULL +cdef void* __cuMemPrefetchAsync_v2 = NULL +cdef void* __cuMemAdvise_v2 = NULL +cdef void* __cuMemRangeGetAttribute = NULL +cdef void* __cuMemRangeGetAttributes = NULL +cdef void* __cuPointerSetAttribute = NULL +cdef void* __cuPointerGetAttributes = NULL +cdef void* __cuStreamCreate = NULL +cdef void* __cuStreamCreateWithPriority = NULL +cdef void* __cuStreamGetPriority = NULL +cdef void* __cuStreamGetDevice = NULL +cdef void* __cuStreamGetFlags = NULL +cdef void* __cuStreamGetId = NULL +cdef void* __cuStreamGetCtx = NULL +cdef void* __cuStreamGetCtx_v2 = NULL +cdef void* __cuStreamWaitEvent = NULL +cdef void* __cuStreamAddCallback = NULL +cdef void* __cuStreamBeginCapture_v2 = NULL +cdef void* __cuStreamBeginCaptureToGraph = NULL +cdef void* __cuThreadExchangeStreamCaptureMode = NULL +cdef void* __cuStreamEndCapture = NULL +cdef void* __cuStreamIsCapturing = NULL +cdef void* __cuStreamGetCaptureInfo_v2 = NULL +cdef void* __cuStreamGetCaptureInfo_v3 = NULL +cdef void* __cuStreamUpdateCaptureDependencies_v2 = NULL +cdef void* __cuStreamAttachMemAsync = NULL +cdef void* __cuStreamQuery = NULL +cdef void* __cuStreamSynchronize = NULL +cdef void* __cuStreamDestroy_v2 = NULL +cdef void* __cuStreamCopyAttributes = NULL +cdef void* __cuStreamGetAttribute = NULL +cdef void* __cuStreamSetAttribute = NULL +cdef void* __cuEventCreate = NULL +cdef void* __cuEventRecord = NULL +cdef void* __cuEventRecordWithFlags = NULL +cdef void* __cuEventQuery = NULL +cdef void* __cuEventSynchronize = NULL +cdef void* __cuEventDestroy_v2 = NULL +cdef void* __cuEventElapsedTime_v2 = NULL +cdef void* __cuImportExternalMemory = NULL +cdef void* __cuExternalMemoryGetMappedBuffer = NULL +cdef void* __cuExternalMemoryGetMappedMipmappedArray = NULL +cdef void* __cuDestroyExternalMemory = NULL +cdef void* __cuImportExternalSemaphore = NULL +cdef void* __cuSignalExternalSemaphoresAsync = NULL +cdef void* __cuWaitExternalSemaphoresAsync = NULL +cdef void* __cuDestroyExternalSemaphore = NULL +cdef void* __cuStreamWaitValue32_v2 = NULL +cdef void* __cuStreamWaitValue64_v2 = NULL +cdef void* __cuStreamWriteValue32_v2 = NULL +cdef void* __cuStreamWriteValue64_v2 = NULL +cdef void* __cuStreamBatchMemOp_v2 = NULL +cdef void* __cuFuncGetAttribute = NULL +cdef void* __cuFuncSetAttribute = NULL +cdef void* __cuFuncSetCacheConfig = NULL +cdef void* __cuFuncGetModule = NULL +cdef void* __cuFuncGetName = NULL +cdef void* __cuFuncGetParamInfo = NULL +cdef void* __cuFuncIsLoaded = NULL +cdef void* __cuFuncLoad = NULL +cdef void* __cuLaunchKernel = NULL +cdef void* __cuLaunchKernelEx = NULL +cdef void* __cuLaunchCooperativeKernel = NULL +cdef void* __cuLaunchCooperativeKernelMultiDevice = NULL +cdef void* __cuLaunchHostFunc = NULL +cdef void* __cuFuncSetBlockShape = NULL +cdef void* __cuFuncSetSharedSize = NULL +cdef void* __cuParamSetSize = NULL +cdef void* __cuParamSeti = NULL +cdef void* __cuParamSetf = NULL +cdef void* __cuParamSetv = NULL +cdef void* __cuLaunch = NULL +cdef void* __cuLaunchGrid = NULL +cdef void* __cuLaunchGridAsync = NULL +cdef void* __cuParamSetTexRef = NULL +cdef void* __cuFuncSetSharedMemConfig = NULL +cdef void* __cuGraphCreate = NULL +cdef void* __cuGraphAddKernelNode_v2 = NULL +cdef void* __cuGraphKernelNodeGetParams_v2 = NULL +cdef void* __cuGraphKernelNodeSetParams_v2 = NULL +cdef void* __cuGraphAddMemcpyNode = NULL +cdef void* __cuGraphMemcpyNodeGetParams = NULL +cdef void* __cuGraphMemcpyNodeSetParams = NULL +cdef void* __cuGraphAddMemsetNode = NULL +cdef void* __cuGraphMemsetNodeGetParams = NULL +cdef void* __cuGraphMemsetNodeSetParams = NULL +cdef void* __cuGraphAddHostNode = NULL +cdef void* __cuGraphHostNodeGetParams = NULL +cdef void* __cuGraphHostNodeSetParams = NULL +cdef void* __cuGraphAddChildGraphNode = NULL +cdef void* __cuGraphChildGraphNodeGetGraph = NULL +cdef void* __cuGraphAddEmptyNode = NULL +cdef void* __cuGraphAddEventRecordNode = NULL +cdef void* __cuGraphEventRecordNodeGetEvent = NULL +cdef void* __cuGraphEventRecordNodeSetEvent = NULL +cdef void* __cuGraphAddEventWaitNode = NULL +cdef void* __cuGraphEventWaitNodeGetEvent = NULL +cdef void* __cuGraphEventWaitNodeSetEvent = NULL +cdef void* __cuGraphAddExternalSemaphoresSignalNode = NULL +cdef void* __cuGraphExternalSemaphoresSignalNodeGetParams = NULL +cdef void* __cuGraphExternalSemaphoresSignalNodeSetParams = NULL +cdef void* __cuGraphAddExternalSemaphoresWaitNode = NULL +cdef void* __cuGraphExternalSemaphoresWaitNodeGetParams = NULL +cdef void* __cuGraphExternalSemaphoresWaitNodeSetParams = NULL +cdef void* __cuGraphAddBatchMemOpNode = NULL +cdef void* __cuGraphBatchMemOpNodeGetParams = NULL +cdef void* __cuGraphBatchMemOpNodeSetParams = NULL +cdef void* __cuGraphExecBatchMemOpNodeSetParams = NULL +cdef void* __cuGraphAddMemAllocNode = NULL +cdef void* __cuGraphMemAllocNodeGetParams = NULL +cdef void* __cuGraphAddMemFreeNode = NULL +cdef void* __cuGraphMemFreeNodeGetParams = NULL +cdef void* __cuDeviceGraphMemTrim = NULL +cdef void* __cuDeviceGetGraphMemAttribute = NULL +cdef void* __cuDeviceSetGraphMemAttribute = NULL +cdef void* __cuGraphClone = NULL +cdef void* __cuGraphNodeFindInClone = NULL +cdef void* __cuGraphNodeGetType = NULL +cdef void* __cuGraphGetNodes = NULL +cdef void* __cuGraphGetRootNodes = NULL +cdef void* __cuGraphGetEdges_v2 = NULL +cdef void* __cuGraphNodeGetDependencies_v2 = NULL +cdef void* __cuGraphNodeGetDependentNodes_v2 = NULL +cdef void* __cuGraphAddDependencies_v2 = NULL +cdef void* __cuGraphRemoveDependencies_v2 = NULL +cdef void* __cuGraphDestroyNode = NULL +cdef void* __cuGraphInstantiateWithFlags = NULL +cdef void* __cuGraphInstantiateWithParams = NULL +cdef void* __cuGraphExecGetFlags = NULL +cdef void* __cuGraphExecKernelNodeSetParams_v2 = NULL +cdef void* __cuGraphExecMemcpyNodeSetParams = NULL +cdef void* __cuGraphExecMemsetNodeSetParams = NULL +cdef void* __cuGraphExecHostNodeSetParams = NULL +cdef void* __cuGraphExecChildGraphNodeSetParams = NULL +cdef void* __cuGraphExecEventRecordNodeSetEvent = NULL +cdef void* __cuGraphExecEventWaitNodeSetEvent = NULL +cdef void* __cuGraphExecExternalSemaphoresSignalNodeSetParams = NULL +cdef void* __cuGraphExecExternalSemaphoresWaitNodeSetParams = NULL +cdef void* __cuGraphNodeSetEnabled = NULL +cdef void* __cuGraphNodeGetEnabled = NULL +cdef void* __cuGraphUpload = NULL +cdef void* __cuGraphLaunch = NULL +cdef void* __cuGraphExecDestroy = NULL +cdef void* __cuGraphDestroy = NULL +cdef void* __cuGraphExecUpdate_v2 = NULL +cdef void* __cuGraphKernelNodeCopyAttributes = NULL +cdef void* __cuGraphKernelNodeGetAttribute = NULL +cdef void* __cuGraphKernelNodeSetAttribute = NULL +cdef void* __cuGraphDebugDotPrint = NULL +cdef void* __cuUserObjectCreate = NULL +cdef void* __cuUserObjectRetain = NULL +cdef void* __cuUserObjectRelease = NULL +cdef void* __cuGraphRetainUserObject = NULL +cdef void* __cuGraphReleaseUserObject = NULL +cdef void* __cuGraphAddNode_v2 = NULL +cdef void* __cuGraphNodeSetParams = NULL +cdef void* __cuGraphExecNodeSetParams = NULL +cdef void* __cuGraphConditionalHandleCreate = NULL +cdef void* __cuOccupancyMaxActiveBlocksPerMultiprocessor = NULL +cdef void* __cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags = NULL +cdef void* __cuOccupancyMaxPotentialBlockSize = NULL +cdef void* __cuOccupancyMaxPotentialBlockSizeWithFlags = NULL +cdef void* __cuOccupancyAvailableDynamicSMemPerBlock = NULL +cdef void* __cuOccupancyMaxPotentialClusterSize = NULL +cdef void* __cuOccupancyMaxActiveClusters = NULL +cdef void* __cuTexRefSetArray = NULL +cdef void* __cuTexRefSetMipmappedArray = NULL +cdef void* __cuTexRefSetAddress_v2 = NULL +cdef void* __cuTexRefSetAddress2D_v3 = NULL +cdef void* __cuTexRefSetFormat = NULL +cdef void* __cuTexRefSetAddressMode = NULL +cdef void* __cuTexRefSetFilterMode = NULL +cdef void* __cuTexRefSetMipmapFilterMode = NULL +cdef void* __cuTexRefSetMipmapLevelBias = NULL +cdef void* __cuTexRefSetMipmapLevelClamp = NULL +cdef void* __cuTexRefSetMaxAnisotropy = NULL +cdef void* __cuTexRefSetBorderColor = NULL +cdef void* __cuTexRefSetFlags = NULL +cdef void* __cuTexRefGetAddress_v2 = NULL +cdef void* __cuTexRefGetArray = NULL +cdef void* __cuTexRefGetMipmappedArray = NULL +cdef void* __cuTexRefGetAddressMode = NULL +cdef void* __cuTexRefGetFilterMode = NULL +cdef void* __cuTexRefGetFormat = NULL +cdef void* __cuTexRefGetMipmapFilterMode = NULL +cdef void* __cuTexRefGetMipmapLevelBias = NULL +cdef void* __cuTexRefGetMipmapLevelClamp = NULL +cdef void* __cuTexRefGetMaxAnisotropy = NULL +cdef void* __cuTexRefGetBorderColor = NULL +cdef void* __cuTexRefGetFlags = NULL +cdef void* __cuTexRefCreate = NULL +cdef void* __cuTexRefDestroy = NULL +cdef void* __cuSurfRefSetArray = NULL +cdef void* __cuSurfRefGetArray = NULL +cdef void* __cuTexObjectCreate = NULL +cdef void* __cuTexObjectDestroy = NULL +cdef void* __cuTexObjectGetResourceDesc = NULL +cdef void* __cuTexObjectGetTextureDesc = NULL +cdef void* __cuTexObjectGetResourceViewDesc = NULL +cdef void* __cuSurfObjectCreate = NULL +cdef void* __cuSurfObjectDestroy = NULL +cdef void* __cuSurfObjectGetResourceDesc = NULL +cdef void* __cuTensorMapEncodeTiled = NULL +cdef void* __cuTensorMapEncodeIm2col = NULL +cdef void* __cuTensorMapEncodeIm2colWide = NULL +cdef void* __cuTensorMapReplaceAddress = NULL +cdef void* __cuDeviceCanAccessPeer = NULL +cdef void* __cuCtxEnablePeerAccess = NULL +cdef void* __cuCtxDisablePeerAccess = NULL +cdef void* __cuDeviceGetP2PAttribute = NULL +cdef void* __cuGraphicsUnregisterResource = NULL +cdef void* __cuGraphicsSubResourceGetMappedArray = NULL +cdef void* __cuGraphicsResourceGetMappedMipmappedArray = NULL +cdef void* __cuGraphicsResourceGetMappedPointer_v2 = NULL +cdef void* __cuGraphicsResourceSetMapFlags_v2 = NULL +cdef void* __cuGraphicsMapResources = NULL +cdef void* __cuGraphicsUnmapResources = NULL +cdef void* __cuGetProcAddress_v2 = NULL +cdef void* __cuCoredumpGetAttribute = NULL +cdef void* __cuCoredumpGetAttributeGlobal = NULL +cdef void* __cuCoredumpSetAttribute = NULL +cdef void* __cuCoredumpSetAttributeGlobal = NULL +cdef void* __cuGetExportTable = NULL +cdef void* __cuGreenCtxCreate = NULL +cdef void* __cuGreenCtxDestroy = NULL +cdef void* __cuCtxFromGreenCtx = NULL +cdef void* __cuDeviceGetDevResource = NULL +cdef void* __cuCtxGetDevResource = NULL +cdef void* __cuGreenCtxGetDevResource = NULL +cdef void* __cuDevSmResourceSplitByCount = NULL +cdef void* __cuDevResourceGenerateDesc = NULL +cdef void* __cuGreenCtxRecordEvent = NULL +cdef void* __cuGreenCtxWaitEvent = NULL +cdef void* __cuStreamGetGreenCtx = NULL +cdef void* __cuGreenCtxStreamCreate = NULL +cdef void* __cuLogsRegisterCallback = NULL +cdef void* __cuLogsUnregisterCallback = NULL +cdef void* __cuLogsCurrent = NULL +cdef void* __cuLogsDumpToFile = NULL +cdef void* __cuLogsDumpToMemory = NULL +cdef void* __cuCheckpointProcessGetRestoreThreadId = NULL +cdef void* __cuCheckpointProcessGetState = NULL +cdef void* __cuCheckpointProcessLock = NULL +cdef void* __cuCheckpointProcessCheckpoint = NULL +cdef void* __cuCheckpointProcessRestore = NULL +cdef void* __cuCheckpointProcessUnlock = NULL +cdef void* __cuGraphicsEGLRegisterImage = NULL +cdef void* __cuEGLStreamConsumerConnect = NULL +cdef void* __cuEGLStreamConsumerConnectWithFlags = NULL +cdef void* __cuEGLStreamConsumerDisconnect = NULL +cdef void* __cuEGLStreamConsumerAcquireFrame = NULL +cdef void* __cuEGLStreamConsumerReleaseFrame = NULL +cdef void* __cuEGLStreamProducerConnect = NULL +cdef void* __cuEGLStreamProducerDisconnect = NULL +cdef void* __cuEGLStreamProducerPresentFrame = NULL +cdef void* __cuEGLStreamProducerReturnFrame = NULL +cdef void* __cuGraphicsResourceGetMappedEglFrame = NULL +cdef void* __cuEventCreateFromEGLSync = NULL +cdef void* __cuGraphicsGLRegisterBuffer = NULL +cdef void* __cuGraphicsGLRegisterImage = NULL +cdef void* __cuGLGetDevices_v2 = NULL +cdef void* __cuGLCtxCreate_v2 = NULL +cdef void* __cuGLInit = NULL +cdef void* __cuGLRegisterBufferObject = NULL +cdef void* __cuGLMapBufferObject_v2 = NULL +cdef void* __cuGLUnmapBufferObject = NULL +cdef void* __cuGLUnregisterBufferObject = NULL +cdef void* __cuGLSetBufferObjectMapFlags = NULL +cdef void* __cuGLMapBufferObjectAsync_v2 = NULL +cdef void* __cuGLUnmapBufferObjectAsync = NULL +cdef void* __cuProfilerInitialize = NULL +cdef void* __cuProfilerStart = NULL +cdef void* __cuProfilerStop = NULL +cdef void* __cuVDPAUGetDevice = NULL +cdef void* __cuVDPAUCtxCreate_v2 = NULL +cdef void* __cuGraphicsVDPAURegisterVideoSurface = NULL +cdef void* __cuGraphicsVDPAURegisterOutputSurface = NULL +cdef void* __cuDeviceGetHostAtomicCapabilities = NULL +cdef void* __cuCtxGetDevice_v2 = NULL +cdef void* __cuCtxSynchronize_v2 = NULL +cdef void* __cuMemcpyBatchAsync_v2 = NULL +cdef void* __cuMemcpy3DBatchAsync_v2 = NULL +cdef void* __cuMemGetDefaultMemPool = NULL +cdef void* __cuMemGetMemPool = NULL +cdef void* __cuMemSetMemPool = NULL +cdef void* __cuMemPrefetchBatchAsync = NULL +cdef void* __cuMemDiscardBatchAsync = NULL +cdef void* __cuMemDiscardAndPrefetchBatchAsync = NULL +cdef void* __cuDeviceGetP2PAtomicCapabilities = NULL +cdef void* __cuGreenCtxGetId = NULL +cdef void* __cuMulticastBindMem_v2 = NULL +cdef void* __cuMulticastBindAddr_v2 = NULL +cdef void* __cuGraphNodeGetContainingGraph = NULL +cdef void* __cuGraphNodeGetLocalId = NULL +cdef void* __cuGraphNodeGetToolsId = NULL +cdef void* __cuGraphGetId = NULL +cdef void* __cuGraphExecGetId = NULL +cdef void* __cuDevSmResourceSplit = NULL +cdef void* __cuStreamGetDevResource = NULL +cdef void* __cuKernelGetParamCount = NULL +cdef void* __cuMemcpyWithAttributesAsync = NULL +cdef void* __cuMemcpy3DWithAttributesAsync = NULL +cdef void* __cuStreamBeginCaptureToCig = NULL +cdef void* __cuStreamEndCaptureToCig = NULL +cdef void* __cuFuncGetParamCount = NULL +cdef void* __cuLaunchHostFunc_v2 = NULL +cdef void* __cuGraphNodeGetParams = NULL +cdef void* __cuCoredumpRegisterStartCallback = NULL +cdef void* __cuCoredumpRegisterCompleteCallback = NULL +cdef void* __cuCoredumpDeregisterStartCallback = NULL +cdef void* __cuCoredumpDeregisterCompleteCallback = NULL +cdef void* __cuLogicalEndpointIdReserve = NULL +cdef void* __cuLogicalEndpointIdRelease = NULL +cdef void* __cuLogicalEndpointCreate = NULL +cdef void* __cuLogicalEndpointAddDevice = NULL +cdef void* __cuLogicalEndpointDestroy = NULL +cdef void* __cuLogicalEndpointBindAddr = NULL +cdef void* __cuLogicalEndpointBindMem = NULL +cdef void* __cuLogicalEndpointUnbind = NULL +cdef void* __cuLogicalEndpointExport = NULL +cdef void* __cuLogicalEndpointImport = NULL +cdef void* __cuLogicalEndpointGetLimits = NULL +cdef void* __cuLogicalEndpointQuery = NULL +cdef void* __cuStreamBeginRecaptureToGraph = NULL + +cdef int _init_driver() except -1 nogil: + global _cyb___py_driver_init + cdef uintptr_t handle = 0 + cdef int ptds_mode + cdef _cyb_cuGetProcAddress_v2_T cuGetProcAddress_v2 + with gil, _cyb_symbol_lock: + if _cyb___py_driver_init: return 0 + + handle = load_library() + if handle == 0: + raise RuntimeError('Failed to open cuda') + # Get latest __cuGetProcAddress_v2 + cuGetProcAddress_v2 = <_cyb_cuGetProcAddress_v2_T>_cyb_GetProcAddress( + handle, 'cuGetProcAddress_v2' + ) + if cuGetProcAddress_v2 == NULL: + raise RuntimeError("Failed to get cuGetProcAddress_v2") + if bool(int(_cyb_getenv('CUDA_PYTHON_CUDA_PER_THREAD_DEFAULT_STREAM', default=0))): + ptds_mode = CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM + else: + ptds_mode = CU_GET_PROC_ADDRESS_DEFAULT + global __cuGetErrorString + cuGetProcAddress_v2('cuGetErrorString', &__cuGetErrorString, 6000, ptds_mode, NULL) + + global __cuGetErrorName + cuGetProcAddress_v2('cuGetErrorName', &__cuGetErrorName, 6000, ptds_mode, NULL) + + global __cuInit + cuGetProcAddress_v2('cuInit', &__cuInit, 2000, ptds_mode, NULL) + + global __cuDriverGetVersion + cuGetProcAddress_v2('cuDriverGetVersion', &__cuDriverGetVersion, 2020, ptds_mode, NULL) + + global __cuDeviceGet + cuGetProcAddress_v2('cuDeviceGet', &__cuDeviceGet, 2000, ptds_mode, NULL) + + global __cuDeviceGetCount + cuGetProcAddress_v2('cuDeviceGetCount', &__cuDeviceGetCount, 2000, ptds_mode, NULL) + + global __cuDeviceGetName + cuGetProcAddress_v2('cuDeviceGetName', &__cuDeviceGetName, 2000, ptds_mode, NULL) + + global __cuDeviceGetUuid_v2 + cuGetProcAddress_v2('cuDeviceGetUuid', &__cuDeviceGetUuid_v2, 11040, ptds_mode, NULL) + + global __cuDeviceGetLuid + cuGetProcAddress_v2('cuDeviceGetLuid', &__cuDeviceGetLuid, 10000, ptds_mode, NULL) + + global __cuDeviceTotalMem_v2 + cuGetProcAddress_v2('cuDeviceTotalMem', &__cuDeviceTotalMem_v2, 3020, ptds_mode, NULL) + + global __cuDeviceGetTexture1DLinearMaxWidth + cuGetProcAddress_v2('cuDeviceGetTexture1DLinearMaxWidth', &__cuDeviceGetTexture1DLinearMaxWidth, 11010, ptds_mode, NULL) + + global __cuDeviceGetAttribute + cuGetProcAddress_v2('cuDeviceGetAttribute', &__cuDeviceGetAttribute, 2000, ptds_mode, NULL) + + global __cuDeviceGetNvSciSyncAttributes + cuGetProcAddress_v2('cuDeviceGetNvSciSyncAttributes', &__cuDeviceGetNvSciSyncAttributes, 10020, ptds_mode, NULL) + + global __cuDeviceSetMemPool + cuGetProcAddress_v2('cuDeviceSetMemPool', &__cuDeviceSetMemPool, 11020, ptds_mode, NULL) + + global __cuDeviceGetMemPool + cuGetProcAddress_v2('cuDeviceGetMemPool', &__cuDeviceGetMemPool, 11020, ptds_mode, NULL) + + global __cuDeviceGetDefaultMemPool + cuGetProcAddress_v2('cuDeviceGetDefaultMemPool', &__cuDeviceGetDefaultMemPool, 11020, ptds_mode, NULL) + + global __cuDeviceGetExecAffinitySupport + cuGetProcAddress_v2('cuDeviceGetExecAffinitySupport', &__cuDeviceGetExecAffinitySupport, 11040, ptds_mode, NULL) + + global __cuFlushGPUDirectRDMAWrites + cuGetProcAddress_v2('cuFlushGPUDirectRDMAWrites', &__cuFlushGPUDirectRDMAWrites, 11030, ptds_mode, NULL) + + global __cuDeviceGetProperties + cuGetProcAddress_v2('cuDeviceGetProperties', &__cuDeviceGetProperties, 2000, ptds_mode, NULL) + + global __cuDeviceComputeCapability + cuGetProcAddress_v2('cuDeviceComputeCapability', &__cuDeviceComputeCapability, 2000, ptds_mode, NULL) + + global __cuDevicePrimaryCtxRetain + cuGetProcAddress_v2('cuDevicePrimaryCtxRetain', &__cuDevicePrimaryCtxRetain, 7000, ptds_mode, NULL) + + global __cuDevicePrimaryCtxRelease_v2 + cuGetProcAddress_v2('cuDevicePrimaryCtxRelease', &__cuDevicePrimaryCtxRelease_v2, 11000, ptds_mode, NULL) + + global __cuDevicePrimaryCtxSetFlags_v2 + cuGetProcAddress_v2('cuDevicePrimaryCtxSetFlags', &__cuDevicePrimaryCtxSetFlags_v2, 11000, ptds_mode, NULL) + + global __cuDevicePrimaryCtxGetState + cuGetProcAddress_v2('cuDevicePrimaryCtxGetState', &__cuDevicePrimaryCtxGetState, 7000, ptds_mode, NULL) + + global __cuDevicePrimaryCtxReset_v2 + cuGetProcAddress_v2('cuDevicePrimaryCtxReset', &__cuDevicePrimaryCtxReset_v2, 11000, ptds_mode, NULL) + + global __cuCtxCreate_v2 + cuGetProcAddress_v2('cuCtxCreate', &__cuCtxCreate_v2, 3020, ptds_mode, NULL) + + global __cuCtxCreate_v3 + cuGetProcAddress_v2('cuCtxCreate', &__cuCtxCreate_v3, 11040, ptds_mode, NULL) + + global __cuCtxCreate_v4 + cuGetProcAddress_v2('cuCtxCreate', &__cuCtxCreate_v4, 12050, ptds_mode, NULL) + + global __cuCtxDestroy_v2 + cuGetProcAddress_v2('cuCtxDestroy', &__cuCtxDestroy_v2, 4000, ptds_mode, NULL) + + global __cuCtxPushCurrent_v2 + cuGetProcAddress_v2('cuCtxPushCurrent', &__cuCtxPushCurrent_v2, 4000, ptds_mode, NULL) + + global __cuCtxPopCurrent_v2 + cuGetProcAddress_v2('cuCtxPopCurrent', &__cuCtxPopCurrent_v2, 4000, ptds_mode, NULL) + + global __cuCtxSetCurrent + cuGetProcAddress_v2('cuCtxSetCurrent', &__cuCtxSetCurrent, 4000, ptds_mode, NULL) + + global __cuCtxGetCurrent + cuGetProcAddress_v2('cuCtxGetCurrent', &__cuCtxGetCurrent, 4000, ptds_mode, NULL) + + global __cuCtxGetDevice + cuGetProcAddress_v2('cuCtxGetDevice', &__cuCtxGetDevice, 2000, ptds_mode, NULL) + + global __cuCtxGetFlags + cuGetProcAddress_v2('cuCtxGetFlags', &__cuCtxGetFlags, 7000, ptds_mode, NULL) + + global __cuCtxSetFlags + cuGetProcAddress_v2('cuCtxSetFlags', &__cuCtxSetFlags, 12010, ptds_mode, NULL) + + global __cuCtxGetId + cuGetProcAddress_v2('cuCtxGetId', &__cuCtxGetId, 12000, ptds_mode, NULL) + + global __cuCtxSynchronize + cuGetProcAddress_v2('cuCtxSynchronize', &__cuCtxSynchronize, 2000, ptds_mode, NULL) + + global __cuCtxSetLimit + cuGetProcAddress_v2('cuCtxSetLimit', &__cuCtxSetLimit, 3010, ptds_mode, NULL) + + global __cuCtxGetLimit + cuGetProcAddress_v2('cuCtxGetLimit', &__cuCtxGetLimit, 3010, ptds_mode, NULL) + + global __cuCtxGetCacheConfig + cuGetProcAddress_v2('cuCtxGetCacheConfig', &__cuCtxGetCacheConfig, 3020, ptds_mode, NULL) + + global __cuCtxSetCacheConfig + cuGetProcAddress_v2('cuCtxSetCacheConfig', &__cuCtxSetCacheConfig, 3020, ptds_mode, NULL) + + global __cuCtxGetApiVersion + cuGetProcAddress_v2('cuCtxGetApiVersion', &__cuCtxGetApiVersion, 3020, ptds_mode, NULL) + + global __cuCtxGetStreamPriorityRange + cuGetProcAddress_v2('cuCtxGetStreamPriorityRange', &__cuCtxGetStreamPriorityRange, 5050, ptds_mode, NULL) + + global __cuCtxResetPersistingL2Cache + cuGetProcAddress_v2('cuCtxResetPersistingL2Cache', &__cuCtxResetPersistingL2Cache, 11000, ptds_mode, NULL) + + global __cuCtxGetExecAffinity + cuGetProcAddress_v2('cuCtxGetExecAffinity', &__cuCtxGetExecAffinity, 11040, ptds_mode, NULL) + + global __cuCtxRecordEvent + cuGetProcAddress_v2('cuCtxRecordEvent', &__cuCtxRecordEvent, 12050, ptds_mode, NULL) + + global __cuCtxWaitEvent + cuGetProcAddress_v2('cuCtxWaitEvent', &__cuCtxWaitEvent, 12050, ptds_mode, NULL) + + global __cuCtxAttach + cuGetProcAddress_v2('cuCtxAttach', &__cuCtxAttach, 2000, ptds_mode, NULL) + + global __cuCtxDetach + cuGetProcAddress_v2('cuCtxDetach', &__cuCtxDetach, 2000, ptds_mode, NULL) + + global __cuCtxGetSharedMemConfig + cuGetProcAddress_v2('cuCtxGetSharedMemConfig', &__cuCtxGetSharedMemConfig, 4020, ptds_mode, NULL) + + global __cuCtxSetSharedMemConfig + cuGetProcAddress_v2('cuCtxSetSharedMemConfig', &__cuCtxSetSharedMemConfig, 4020, ptds_mode, NULL) + + global __cuModuleLoad + cuGetProcAddress_v2('cuModuleLoad', &__cuModuleLoad, 2000, ptds_mode, NULL) + + global __cuModuleLoadData + cuGetProcAddress_v2('cuModuleLoadData', &__cuModuleLoadData, 2000, ptds_mode, NULL) + + global __cuModuleLoadDataEx + cuGetProcAddress_v2('cuModuleLoadDataEx', &__cuModuleLoadDataEx, 2010, ptds_mode, NULL) + + global __cuModuleLoadFatBinary + cuGetProcAddress_v2('cuModuleLoadFatBinary', &__cuModuleLoadFatBinary, 2000, ptds_mode, NULL) + + global __cuModuleUnload + cuGetProcAddress_v2('cuModuleUnload', &__cuModuleUnload, 2000, ptds_mode, NULL) + + global __cuModuleGetLoadingMode + cuGetProcAddress_v2('cuModuleGetLoadingMode', &__cuModuleGetLoadingMode, 11070, ptds_mode, NULL) + + global __cuModuleGetFunction + cuGetProcAddress_v2('cuModuleGetFunction', &__cuModuleGetFunction, 2000, ptds_mode, NULL) + + global __cuModuleGetFunctionCount + cuGetProcAddress_v2('cuModuleGetFunctionCount', &__cuModuleGetFunctionCount, 12040, ptds_mode, NULL) + + global __cuModuleEnumerateFunctions + cuGetProcAddress_v2('cuModuleEnumerateFunctions', &__cuModuleEnumerateFunctions, 12040, ptds_mode, NULL) + + global __cuModuleGetGlobal_v2 + cuGetProcAddress_v2('cuModuleGetGlobal', &__cuModuleGetGlobal_v2, 3020, ptds_mode, NULL) + + global __cuLinkCreate_v2 + cuGetProcAddress_v2('cuLinkCreate', &__cuLinkCreate_v2, 6050, ptds_mode, NULL) + + global __cuLinkAddData_v2 + cuGetProcAddress_v2('cuLinkAddData', &__cuLinkAddData_v2, 6050, ptds_mode, NULL) + + global __cuLinkAddFile_v2 + cuGetProcAddress_v2('cuLinkAddFile', &__cuLinkAddFile_v2, 6050, ptds_mode, NULL) + + global __cuLinkComplete + cuGetProcAddress_v2('cuLinkComplete', &__cuLinkComplete, 5050, ptds_mode, NULL) + + global __cuLinkDestroy + cuGetProcAddress_v2('cuLinkDestroy', &__cuLinkDestroy, 5050, ptds_mode, NULL) + + global __cuModuleGetTexRef + cuGetProcAddress_v2('cuModuleGetTexRef', &__cuModuleGetTexRef, 2000, ptds_mode, NULL) + + global __cuModuleGetSurfRef + cuGetProcAddress_v2('cuModuleGetSurfRef', &__cuModuleGetSurfRef, 3000, ptds_mode, NULL) + + global __cuLibraryLoadData + cuGetProcAddress_v2('cuLibraryLoadData', &__cuLibraryLoadData, 12000, ptds_mode, NULL) + + global __cuLibraryLoadFromFile + cuGetProcAddress_v2('cuLibraryLoadFromFile', &__cuLibraryLoadFromFile, 12000, ptds_mode, NULL) + + global __cuLibraryUnload + cuGetProcAddress_v2('cuLibraryUnload', &__cuLibraryUnload, 12000, ptds_mode, NULL) + + global __cuLibraryGetKernel + cuGetProcAddress_v2('cuLibraryGetKernel', &__cuLibraryGetKernel, 12000, ptds_mode, NULL) + + global __cuLibraryGetKernelCount + cuGetProcAddress_v2('cuLibraryGetKernelCount', &__cuLibraryGetKernelCount, 12040, ptds_mode, NULL) + + global __cuLibraryEnumerateKernels + cuGetProcAddress_v2('cuLibraryEnumerateKernels', &__cuLibraryEnumerateKernels, 12040, ptds_mode, NULL) + + global __cuLibraryGetModule + cuGetProcAddress_v2('cuLibraryGetModule', &__cuLibraryGetModule, 12000, ptds_mode, NULL) + + global __cuKernelGetFunction + cuGetProcAddress_v2('cuKernelGetFunction', &__cuKernelGetFunction, 12000, ptds_mode, NULL) + + global __cuKernelGetLibrary + cuGetProcAddress_v2('cuKernelGetLibrary', &__cuKernelGetLibrary, 12050, ptds_mode, NULL) + + global __cuLibraryGetGlobal + cuGetProcAddress_v2('cuLibraryGetGlobal', &__cuLibraryGetGlobal, 12000, ptds_mode, NULL) + + global __cuLibraryGetManaged + cuGetProcAddress_v2('cuLibraryGetManaged', &__cuLibraryGetManaged, 12000, ptds_mode, NULL) + + global __cuLibraryGetUnifiedFunction + cuGetProcAddress_v2('cuLibraryGetUnifiedFunction', &__cuLibraryGetUnifiedFunction, 12000, ptds_mode, NULL) + + global __cuKernelGetAttribute + cuGetProcAddress_v2('cuKernelGetAttribute', &__cuKernelGetAttribute, 12000, ptds_mode, NULL) + + global __cuKernelSetAttribute + cuGetProcAddress_v2('cuKernelSetAttribute', &__cuKernelSetAttribute, 12000, ptds_mode, NULL) + + global __cuKernelSetCacheConfig + cuGetProcAddress_v2('cuKernelSetCacheConfig', &__cuKernelSetCacheConfig, 12000, ptds_mode, NULL) + + global __cuKernelGetName + cuGetProcAddress_v2('cuKernelGetName', &__cuKernelGetName, 12030, ptds_mode, NULL) + + global __cuKernelGetParamInfo + cuGetProcAddress_v2('cuKernelGetParamInfo', &__cuKernelGetParamInfo, 12040, ptds_mode, NULL) + + global __cuMemGetInfo_v2 + cuGetProcAddress_v2('cuMemGetInfo', &__cuMemGetInfo_v2, 3020, ptds_mode, NULL) + + global __cuMemAlloc_v2 + cuGetProcAddress_v2('cuMemAlloc', &__cuMemAlloc_v2, 3020, ptds_mode, NULL) + + global __cuMemAllocPitch_v2 + cuGetProcAddress_v2('cuMemAllocPitch', &__cuMemAllocPitch_v2, 3020, ptds_mode, NULL) + + global __cuMemFree_v2 + cuGetProcAddress_v2('cuMemFree', &__cuMemFree_v2, 3020, ptds_mode, NULL) + + global __cuMemGetAddressRange_v2 + cuGetProcAddress_v2('cuMemGetAddressRange', &__cuMemGetAddressRange_v2, 3020, ptds_mode, NULL) + + global __cuMemAllocHost_v2 + cuGetProcAddress_v2('cuMemAllocHost', &__cuMemAllocHost_v2, 3020, ptds_mode, NULL) + + global __cuMemFreeHost + cuGetProcAddress_v2('cuMemFreeHost', &__cuMemFreeHost, 2000, ptds_mode, NULL) + + global __cuMemHostAlloc + cuGetProcAddress_v2('cuMemHostAlloc', &__cuMemHostAlloc, 2020, ptds_mode, NULL) + + global __cuMemHostGetDevicePointer_v2 + cuGetProcAddress_v2('cuMemHostGetDevicePointer', &__cuMemHostGetDevicePointer_v2, 3020, ptds_mode, NULL) + + global __cuMemHostGetFlags + cuGetProcAddress_v2('cuMemHostGetFlags', &__cuMemHostGetFlags, 2030, ptds_mode, NULL) + + global __cuMemAllocManaged + cuGetProcAddress_v2('cuMemAllocManaged', &__cuMemAllocManaged, 6000, ptds_mode, NULL) + + global __cuDeviceRegisterAsyncNotification + cuGetProcAddress_v2('cuDeviceRegisterAsyncNotification', &__cuDeviceRegisterAsyncNotification, 12040, ptds_mode, NULL) + + global __cuDeviceUnregisterAsyncNotification + cuGetProcAddress_v2('cuDeviceUnregisterAsyncNotification', &__cuDeviceUnregisterAsyncNotification, 12040, ptds_mode, NULL) + + global __cuDeviceGetByPCIBusId + cuGetProcAddress_v2('cuDeviceGetByPCIBusId', &__cuDeviceGetByPCIBusId, 4010, ptds_mode, NULL) + + global __cuDeviceGetPCIBusId + cuGetProcAddress_v2('cuDeviceGetPCIBusId', &__cuDeviceGetPCIBusId, 4010, ptds_mode, NULL) + + global __cuIpcGetEventHandle + cuGetProcAddress_v2('cuIpcGetEventHandle', &__cuIpcGetEventHandle, 4010, ptds_mode, NULL) + + global __cuIpcOpenEventHandle + cuGetProcAddress_v2('cuIpcOpenEventHandle', &__cuIpcOpenEventHandle, 4010, ptds_mode, NULL) + + global __cuIpcGetMemHandle + cuGetProcAddress_v2('cuIpcGetMemHandle', &__cuIpcGetMemHandle, 4010, ptds_mode, NULL) + + global __cuIpcOpenMemHandle_v2 + cuGetProcAddress_v2('cuIpcOpenMemHandle', &__cuIpcOpenMemHandle_v2, 11000, ptds_mode, NULL) + + global __cuIpcCloseMemHandle + cuGetProcAddress_v2('cuIpcCloseMemHandle', &__cuIpcCloseMemHandle, 4010, ptds_mode, NULL) + + global __cuMemHostRegister_v2 + cuGetProcAddress_v2('cuMemHostRegister', &__cuMemHostRegister_v2, 6050, ptds_mode, NULL) + + global __cuMemHostUnregister + cuGetProcAddress_v2('cuMemHostUnregister', &__cuMemHostUnregister, 4000, ptds_mode, NULL) + + global __cuMemcpy + cuGetProcAddress_v2('cuMemcpy', &__cuMemcpy, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 4000, ptds_mode, NULL) + + global __cuMemcpyPeer + cuGetProcAddress_v2('cuMemcpyPeer', &__cuMemcpyPeer, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 4000, ptds_mode, NULL) + + global __cuMemcpyHtoD_v2 + cuGetProcAddress_v2('cuMemcpyHtoD', &__cuMemcpyHtoD_v2, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemcpyDtoH_v2 + cuGetProcAddress_v2('cuMemcpyDtoH', &__cuMemcpyDtoH_v2, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemcpyDtoD_v2 + cuGetProcAddress_v2('cuMemcpyDtoD', &__cuMemcpyDtoD_v2, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemcpyDtoA_v2 + cuGetProcAddress_v2('cuMemcpyDtoA', &__cuMemcpyDtoA_v2, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemcpyAtoD_v2 + cuGetProcAddress_v2('cuMemcpyAtoD', &__cuMemcpyAtoD_v2, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemcpyHtoA_v2 + cuGetProcAddress_v2('cuMemcpyHtoA', &__cuMemcpyHtoA_v2, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemcpyAtoH_v2 + cuGetProcAddress_v2('cuMemcpyAtoH', &__cuMemcpyAtoH_v2, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemcpyAtoA_v2 + cuGetProcAddress_v2('cuMemcpyAtoA', &__cuMemcpyAtoA_v2, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemcpy2D_v2 + cuGetProcAddress_v2('cuMemcpy2D', &__cuMemcpy2D_v2, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemcpy2DUnaligned_v2 + cuGetProcAddress_v2('cuMemcpy2DUnaligned', &__cuMemcpy2DUnaligned_v2, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemcpy3D_v2 + cuGetProcAddress_v2('cuMemcpy3D', &__cuMemcpy3D_v2, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemcpy3DPeer + cuGetProcAddress_v2('cuMemcpy3DPeer', &__cuMemcpy3DPeer, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 4000, ptds_mode, NULL) + + global __cuMemcpyAsync + cuGetProcAddress_v2('cuMemcpyAsync', &__cuMemcpyAsync, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 4000, ptds_mode, NULL) + + global __cuMemcpyPeerAsync + cuGetProcAddress_v2('cuMemcpyPeerAsync', &__cuMemcpyPeerAsync, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 4000, ptds_mode, NULL) + + global __cuMemcpyHtoDAsync_v2 + cuGetProcAddress_v2('cuMemcpyHtoDAsync', &__cuMemcpyHtoDAsync_v2, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemcpyDtoHAsync_v2 + cuGetProcAddress_v2('cuMemcpyDtoHAsync', &__cuMemcpyDtoHAsync_v2, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemcpyDtoDAsync_v2 + cuGetProcAddress_v2('cuMemcpyDtoDAsync', &__cuMemcpyDtoDAsync_v2, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemcpyHtoAAsync_v2 + cuGetProcAddress_v2('cuMemcpyHtoAAsync', &__cuMemcpyHtoAAsync_v2, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemcpyAtoHAsync_v2 + cuGetProcAddress_v2('cuMemcpyAtoHAsync', &__cuMemcpyAtoHAsync_v2, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemcpy2DAsync_v2 + cuGetProcAddress_v2('cuMemcpy2DAsync', &__cuMemcpy2DAsync_v2, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemcpy3DAsync_v2 + cuGetProcAddress_v2('cuMemcpy3DAsync', &__cuMemcpy3DAsync_v2, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemcpy3DPeerAsync + cuGetProcAddress_v2('cuMemcpy3DPeerAsync', &__cuMemcpy3DPeerAsync, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 4000, ptds_mode, NULL) + + global __cuMemsetD8_v2 + cuGetProcAddress_v2('cuMemsetD8', &__cuMemsetD8_v2, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemsetD16_v2 + cuGetProcAddress_v2('cuMemsetD16', &__cuMemsetD16_v2, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemsetD32_v2 + cuGetProcAddress_v2('cuMemsetD32', &__cuMemsetD32_v2, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemsetD2D8_v2 + cuGetProcAddress_v2('cuMemsetD2D8', &__cuMemsetD2D8_v2, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemsetD2D16_v2 + cuGetProcAddress_v2('cuMemsetD2D16', &__cuMemsetD2D16_v2, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemsetD2D32_v2 + cuGetProcAddress_v2('cuMemsetD2D32', &__cuMemsetD2D32_v2, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemsetD8Async + cuGetProcAddress_v2('cuMemsetD8Async', &__cuMemsetD8Async, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemsetD16Async + cuGetProcAddress_v2('cuMemsetD16Async', &__cuMemsetD16Async, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemsetD32Async + cuGetProcAddress_v2('cuMemsetD32Async', &__cuMemsetD32Async, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemsetD2D8Async + cuGetProcAddress_v2('cuMemsetD2D8Async', &__cuMemsetD2D8Async, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemsetD2D16Async + cuGetProcAddress_v2('cuMemsetD2D16Async', &__cuMemsetD2D16Async, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuMemsetD2D32Async + cuGetProcAddress_v2('cuMemsetD2D32Async', &__cuMemsetD2D32Async, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuArrayCreate_v2 + cuGetProcAddress_v2('cuArrayCreate', &__cuArrayCreate_v2, 3020, ptds_mode, NULL) + + global __cuArrayGetDescriptor_v2 + cuGetProcAddress_v2('cuArrayGetDescriptor', &__cuArrayGetDescriptor_v2, 3020, ptds_mode, NULL) + + global __cuArrayGetSparseProperties + cuGetProcAddress_v2('cuArrayGetSparseProperties', &__cuArrayGetSparseProperties, 11010, ptds_mode, NULL) + + global __cuMipmappedArrayGetSparseProperties + cuGetProcAddress_v2('cuMipmappedArrayGetSparseProperties', &__cuMipmappedArrayGetSparseProperties, 11010, ptds_mode, NULL) + + global __cuArrayGetMemoryRequirements + cuGetProcAddress_v2('cuArrayGetMemoryRequirements', &__cuArrayGetMemoryRequirements, 11060, ptds_mode, NULL) + + global __cuMipmappedArrayGetMemoryRequirements + cuGetProcAddress_v2('cuMipmappedArrayGetMemoryRequirements', &__cuMipmappedArrayGetMemoryRequirements, 11060, ptds_mode, NULL) + + global __cuArrayGetPlane + cuGetProcAddress_v2('cuArrayGetPlane', &__cuArrayGetPlane, 11020, ptds_mode, NULL) + + global __cuArrayDestroy + cuGetProcAddress_v2('cuArrayDestroy', &__cuArrayDestroy, 2000, ptds_mode, NULL) + + global __cuArray3DCreate_v2 + cuGetProcAddress_v2('cuArray3DCreate', &__cuArray3DCreate_v2, 3020, ptds_mode, NULL) + + global __cuArray3DGetDescriptor_v2 + cuGetProcAddress_v2('cuArray3DGetDescriptor', &__cuArray3DGetDescriptor_v2, 3020, ptds_mode, NULL) + + global __cuMipmappedArrayCreate + cuGetProcAddress_v2('cuMipmappedArrayCreate', &__cuMipmappedArrayCreate, 5000, ptds_mode, NULL) + + global __cuMipmappedArrayGetLevel + cuGetProcAddress_v2('cuMipmappedArrayGetLevel', &__cuMipmappedArrayGetLevel, 5000, ptds_mode, NULL) + + global __cuMipmappedArrayDestroy + cuGetProcAddress_v2('cuMipmappedArrayDestroy', &__cuMipmappedArrayDestroy, 5000, ptds_mode, NULL) + + global __cuMemGetHandleForAddressRange + cuGetProcAddress_v2('cuMemGetHandleForAddressRange', &__cuMemGetHandleForAddressRange, 11070, ptds_mode, NULL) + + global __cuMemBatchDecompressAsync + cuGetProcAddress_v2('cuMemBatchDecompressAsync', &__cuMemBatchDecompressAsync, 12060, ptds_mode, NULL) + + global __cuMemAddressReserve + cuGetProcAddress_v2('cuMemAddressReserve', &__cuMemAddressReserve, 10020, ptds_mode, NULL) + + global __cuMemAddressFree + cuGetProcAddress_v2('cuMemAddressFree', &__cuMemAddressFree, 10020, ptds_mode, NULL) + + global __cuMemCreate + cuGetProcAddress_v2('cuMemCreate', &__cuMemCreate, 10020, ptds_mode, NULL) + + global __cuMemRelease + cuGetProcAddress_v2('cuMemRelease', &__cuMemRelease, 10020, ptds_mode, NULL) + + global __cuMemMap + cuGetProcAddress_v2('cuMemMap', &__cuMemMap, 10020, ptds_mode, NULL) + + global __cuMemMapArrayAsync + cuGetProcAddress_v2('cuMemMapArrayAsync', &__cuMemMapArrayAsync, 11010, ptds_mode, NULL) + + global __cuMemUnmap + cuGetProcAddress_v2('cuMemUnmap', &__cuMemUnmap, 10020, ptds_mode, NULL) + + global __cuMemSetAccess + cuGetProcAddress_v2('cuMemSetAccess', &__cuMemSetAccess, 10020, ptds_mode, NULL) + + global __cuMemGetAccess + cuGetProcAddress_v2('cuMemGetAccess', &__cuMemGetAccess, 10020, ptds_mode, NULL) + + global __cuMemExportToShareableHandle + cuGetProcAddress_v2('cuMemExportToShareableHandle', &__cuMemExportToShareableHandle, 10020, ptds_mode, NULL) + + global __cuMemImportFromShareableHandle + cuGetProcAddress_v2('cuMemImportFromShareableHandle', &__cuMemImportFromShareableHandle, 10020, ptds_mode, NULL) + + global __cuMemGetAllocationGranularity + cuGetProcAddress_v2('cuMemGetAllocationGranularity', &__cuMemGetAllocationGranularity, 10020, ptds_mode, NULL) + + global __cuMemGetAllocationPropertiesFromHandle + cuGetProcAddress_v2('cuMemGetAllocationPropertiesFromHandle', &__cuMemGetAllocationPropertiesFromHandle, 10020, ptds_mode, NULL) + + global __cuMemRetainAllocationHandle + cuGetProcAddress_v2('cuMemRetainAllocationHandle', &__cuMemRetainAllocationHandle, 11000, ptds_mode, NULL) + + global __cuMemFreeAsync + cuGetProcAddress_v2('cuMemFreeAsync', &__cuMemFreeAsync, 11020, ptds_mode, NULL) + + global __cuMemAllocAsync + cuGetProcAddress_v2('cuMemAllocAsync', &__cuMemAllocAsync, 11020, ptds_mode, NULL) + + global __cuMemPoolTrimTo + cuGetProcAddress_v2('cuMemPoolTrimTo', &__cuMemPoolTrimTo, 11020, ptds_mode, NULL) + + global __cuMemPoolSetAttribute + cuGetProcAddress_v2('cuMemPoolSetAttribute', &__cuMemPoolSetAttribute, 11020, ptds_mode, NULL) + + global __cuMemPoolGetAttribute + cuGetProcAddress_v2('cuMemPoolGetAttribute', &__cuMemPoolGetAttribute, 11020, ptds_mode, NULL) + + global __cuMemPoolSetAccess + cuGetProcAddress_v2('cuMemPoolSetAccess', &__cuMemPoolSetAccess, 11020, ptds_mode, NULL) + + global __cuMemPoolGetAccess + cuGetProcAddress_v2('cuMemPoolGetAccess', &__cuMemPoolGetAccess, 11020, ptds_mode, NULL) + + global __cuMemPoolCreate + cuGetProcAddress_v2('cuMemPoolCreate', &__cuMemPoolCreate, 11020, ptds_mode, NULL) + + global __cuMemPoolDestroy + cuGetProcAddress_v2('cuMemPoolDestroy', &__cuMemPoolDestroy, 11020, ptds_mode, NULL) + + global __cuMemAllocFromPoolAsync + cuGetProcAddress_v2('cuMemAllocFromPoolAsync', &__cuMemAllocFromPoolAsync, 11020, ptds_mode, NULL) + + global __cuMemPoolExportToShareableHandle + cuGetProcAddress_v2('cuMemPoolExportToShareableHandle', &__cuMemPoolExportToShareableHandle, 11020, ptds_mode, NULL) + + global __cuMemPoolImportFromShareableHandle + cuGetProcAddress_v2('cuMemPoolImportFromShareableHandle', &__cuMemPoolImportFromShareableHandle, 11020, ptds_mode, NULL) + + global __cuMemPoolExportPointer + cuGetProcAddress_v2('cuMemPoolExportPointer', &__cuMemPoolExportPointer, 11020, ptds_mode, NULL) + + global __cuMemPoolImportPointer + cuGetProcAddress_v2('cuMemPoolImportPointer', &__cuMemPoolImportPointer, 11020, ptds_mode, NULL) + + global __cuMulticastCreate + cuGetProcAddress_v2('cuMulticastCreate', &__cuMulticastCreate, 12010, ptds_mode, NULL) + + global __cuMulticastAddDevice + cuGetProcAddress_v2('cuMulticastAddDevice', &__cuMulticastAddDevice, 12010, ptds_mode, NULL) + + global __cuMulticastBindMem + cuGetProcAddress_v2('cuMulticastBindMem', &__cuMulticastBindMem, 12010, ptds_mode, NULL) + + global __cuMulticastBindAddr + cuGetProcAddress_v2('cuMulticastBindAddr', &__cuMulticastBindAddr, 12010, ptds_mode, NULL) + + global __cuMulticastUnbind + cuGetProcAddress_v2('cuMulticastUnbind', &__cuMulticastUnbind, 12010, ptds_mode, NULL) + + global __cuMulticastGetGranularity + cuGetProcAddress_v2('cuMulticastGetGranularity', &__cuMulticastGetGranularity, 12010, ptds_mode, NULL) + + global __cuPointerGetAttribute + cuGetProcAddress_v2('cuPointerGetAttribute', &__cuPointerGetAttribute, 4000, ptds_mode, NULL) + + global __cuMemPrefetchAsync_v2 + cuGetProcAddress_v2('cuMemPrefetchAsync', &__cuMemPrefetchAsync_v2, 12020, ptds_mode, NULL) + + global __cuMemAdvise_v2 + cuGetProcAddress_v2('cuMemAdvise', &__cuMemAdvise_v2, 12020, ptds_mode, NULL) + + global __cuMemRangeGetAttribute + cuGetProcAddress_v2('cuMemRangeGetAttribute', &__cuMemRangeGetAttribute, 8000, ptds_mode, NULL) + + global __cuMemRangeGetAttributes + cuGetProcAddress_v2('cuMemRangeGetAttributes', &__cuMemRangeGetAttributes, 8000, ptds_mode, NULL) + + global __cuPointerSetAttribute + cuGetProcAddress_v2('cuPointerSetAttribute', &__cuPointerSetAttribute, 6000, ptds_mode, NULL) + + global __cuPointerGetAttributes + cuGetProcAddress_v2('cuPointerGetAttributes', &__cuPointerGetAttributes, 7000, ptds_mode, NULL) + + global __cuStreamCreate + cuGetProcAddress_v2('cuStreamCreate', &__cuStreamCreate, 2000, ptds_mode, NULL) + + global __cuStreamCreateWithPriority + cuGetProcAddress_v2('cuStreamCreateWithPriority', &__cuStreamCreateWithPriority, 5050, ptds_mode, NULL) + + global __cuStreamGetPriority + cuGetProcAddress_v2('cuStreamGetPriority', &__cuStreamGetPriority, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 5050, ptds_mode, NULL) + + global __cuStreamGetDevice + cuGetProcAddress_v2('cuStreamGetDevice', &__cuStreamGetDevice, 12080, ptds_mode, NULL) + + global __cuStreamGetFlags + cuGetProcAddress_v2('cuStreamGetFlags', &__cuStreamGetFlags, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 5050, ptds_mode, NULL) + + global __cuStreamGetId + cuGetProcAddress_v2('cuStreamGetId', &__cuStreamGetId, 12000, ptds_mode, NULL) + + global __cuStreamGetCtx + cuGetProcAddress_v2('cuStreamGetCtx', &__cuStreamGetCtx, 9020, ptds_mode, NULL) + + global __cuStreamGetCtx_v2 + cuGetProcAddress_v2('cuStreamGetCtx', &__cuStreamGetCtx_v2, 12050, ptds_mode, NULL) + + global __cuStreamWaitEvent + cuGetProcAddress_v2('cuStreamWaitEvent', &__cuStreamWaitEvent, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuStreamAddCallback + cuGetProcAddress_v2('cuStreamAddCallback', &__cuStreamAddCallback, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 5000, ptds_mode, NULL) + + global __cuStreamBeginCapture_v2 + cuGetProcAddress_v2('cuStreamBeginCapture', &__cuStreamBeginCapture_v2, 10010, ptds_mode, NULL) + + global __cuStreamBeginCaptureToGraph + cuGetProcAddress_v2('cuStreamBeginCaptureToGraph', &__cuStreamBeginCaptureToGraph, 12030, ptds_mode, NULL) + + global __cuThreadExchangeStreamCaptureMode + cuGetProcAddress_v2('cuThreadExchangeStreamCaptureMode', &__cuThreadExchangeStreamCaptureMode, 10010, ptds_mode, NULL) + + global __cuStreamEndCapture + cuGetProcAddress_v2('cuStreamEndCapture', &__cuStreamEndCapture, 10000, ptds_mode, NULL) + + global __cuStreamIsCapturing + cuGetProcAddress_v2('cuStreamIsCapturing', &__cuStreamIsCapturing, 10000, ptds_mode, NULL) + + global __cuStreamGetCaptureInfo_v2 + cuGetProcAddress_v2('cuStreamGetCaptureInfo', &__cuStreamGetCaptureInfo_v2, 11030, ptds_mode, NULL) + + global __cuStreamGetCaptureInfo_v3 + cuGetProcAddress_v2('cuStreamGetCaptureInfo', &__cuStreamGetCaptureInfo_v3, 12030, ptds_mode, NULL) + + global __cuStreamUpdateCaptureDependencies_v2 + cuGetProcAddress_v2('cuStreamUpdateCaptureDependencies', &__cuStreamUpdateCaptureDependencies_v2, 12030, ptds_mode, NULL) + + global __cuStreamAttachMemAsync + cuGetProcAddress_v2('cuStreamAttachMemAsync', &__cuStreamAttachMemAsync, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 6000, ptds_mode, NULL) + + global __cuStreamQuery + cuGetProcAddress_v2('cuStreamQuery', &__cuStreamQuery, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 2000, ptds_mode, NULL) + + global __cuStreamSynchronize + cuGetProcAddress_v2('cuStreamSynchronize', &__cuStreamSynchronize, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 2000, ptds_mode, NULL) + + global __cuStreamDestroy_v2 + cuGetProcAddress_v2('cuStreamDestroy', &__cuStreamDestroy_v2, 4000, ptds_mode, NULL) + + global __cuStreamCopyAttributes + cuGetProcAddress_v2('cuStreamCopyAttributes', &__cuStreamCopyAttributes, 11000, ptds_mode, NULL) + + global __cuStreamGetAttribute + cuGetProcAddress_v2('cuStreamGetAttribute', &__cuStreamGetAttribute, 11000, ptds_mode, NULL) + + global __cuStreamSetAttribute + cuGetProcAddress_v2('cuStreamSetAttribute', &__cuStreamSetAttribute, 11000, ptds_mode, NULL) + + global __cuEventCreate + cuGetProcAddress_v2('cuEventCreate', &__cuEventCreate, 2000, ptds_mode, NULL) + + global __cuEventRecord + cuGetProcAddress_v2('cuEventRecord', &__cuEventRecord, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 2000, ptds_mode, NULL) + + global __cuEventRecordWithFlags + cuGetProcAddress_v2('cuEventRecordWithFlags', &__cuEventRecordWithFlags, 11010, ptds_mode, NULL) + + global __cuEventQuery + cuGetProcAddress_v2('cuEventQuery', &__cuEventQuery, 2000, ptds_mode, NULL) + + global __cuEventSynchronize + cuGetProcAddress_v2('cuEventSynchronize', &__cuEventSynchronize, 2000, ptds_mode, NULL) + + global __cuEventDestroy_v2 + cuGetProcAddress_v2('cuEventDestroy', &__cuEventDestroy_v2, 4000, ptds_mode, NULL) + + global __cuEventElapsedTime_v2 + cuGetProcAddress_v2('cuEventElapsedTime', &__cuEventElapsedTime_v2, 12080, ptds_mode, NULL) + + global __cuImportExternalMemory + cuGetProcAddress_v2('cuImportExternalMemory', &__cuImportExternalMemory, 10000, ptds_mode, NULL) + + global __cuExternalMemoryGetMappedBuffer + cuGetProcAddress_v2('cuExternalMemoryGetMappedBuffer', &__cuExternalMemoryGetMappedBuffer, 10000, ptds_mode, NULL) + + global __cuExternalMemoryGetMappedMipmappedArray + cuGetProcAddress_v2('cuExternalMemoryGetMappedMipmappedArray', &__cuExternalMemoryGetMappedMipmappedArray, 10000, ptds_mode, NULL) + + global __cuDestroyExternalMemory + cuGetProcAddress_v2('cuDestroyExternalMemory', &__cuDestroyExternalMemory, 10000, ptds_mode, NULL) + + global __cuImportExternalSemaphore + cuGetProcAddress_v2('cuImportExternalSemaphore', &__cuImportExternalSemaphore, 10000, ptds_mode, NULL) + + global __cuSignalExternalSemaphoresAsync + cuGetProcAddress_v2('cuSignalExternalSemaphoresAsync', &__cuSignalExternalSemaphoresAsync, 10000, ptds_mode, NULL) + + global __cuWaitExternalSemaphoresAsync + cuGetProcAddress_v2('cuWaitExternalSemaphoresAsync', &__cuWaitExternalSemaphoresAsync, 10000, ptds_mode, NULL) + + global __cuDestroyExternalSemaphore + cuGetProcAddress_v2('cuDestroyExternalSemaphore', &__cuDestroyExternalSemaphore, 10000, ptds_mode, NULL) + + global __cuStreamWaitValue32_v2 + cuGetProcAddress_v2('cuStreamWaitValue32', &__cuStreamWaitValue32_v2, 11070, ptds_mode, NULL) + + global __cuStreamWaitValue64_v2 + cuGetProcAddress_v2('cuStreamWaitValue64', &__cuStreamWaitValue64_v2, 11070, ptds_mode, NULL) + + global __cuStreamWriteValue32_v2 + cuGetProcAddress_v2('cuStreamWriteValue32', &__cuStreamWriteValue32_v2, 11070, ptds_mode, NULL) + + global __cuStreamWriteValue64_v2 + cuGetProcAddress_v2('cuStreamWriteValue64', &__cuStreamWriteValue64_v2, 11070, ptds_mode, NULL) + + global __cuStreamBatchMemOp_v2 + cuGetProcAddress_v2('cuStreamBatchMemOp', &__cuStreamBatchMemOp_v2, 11070, ptds_mode, NULL) + + global __cuFuncGetAttribute + cuGetProcAddress_v2('cuFuncGetAttribute', &__cuFuncGetAttribute, 2020, ptds_mode, NULL) + + global __cuFuncSetAttribute + cuGetProcAddress_v2('cuFuncSetAttribute', &__cuFuncSetAttribute, 9000, ptds_mode, NULL) + + global __cuFuncSetCacheConfig + cuGetProcAddress_v2('cuFuncSetCacheConfig', &__cuFuncSetCacheConfig, 3000, ptds_mode, NULL) + + global __cuFuncGetModule + cuGetProcAddress_v2('cuFuncGetModule', &__cuFuncGetModule, 11000, ptds_mode, NULL) + + global __cuFuncGetName + cuGetProcAddress_v2('cuFuncGetName', &__cuFuncGetName, 12030, ptds_mode, NULL) + + global __cuFuncGetParamInfo + cuGetProcAddress_v2('cuFuncGetParamInfo', &__cuFuncGetParamInfo, 12040, ptds_mode, NULL) + + global __cuFuncIsLoaded + cuGetProcAddress_v2('cuFuncIsLoaded', &__cuFuncIsLoaded, 12040, ptds_mode, NULL) + + global __cuFuncLoad + cuGetProcAddress_v2('cuFuncLoad', &__cuFuncLoad, 12040, ptds_mode, NULL) + + global __cuLaunchKernel + cuGetProcAddress_v2('cuLaunchKernel', &__cuLaunchKernel, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 4000, ptds_mode, NULL) + + global __cuLaunchKernelEx + cuGetProcAddress_v2('cuLaunchKernelEx', &__cuLaunchKernelEx, 11060, ptds_mode, NULL) + + global __cuLaunchCooperativeKernel + cuGetProcAddress_v2('cuLaunchCooperativeKernel', &__cuLaunchCooperativeKernel, 9000, ptds_mode, NULL) + + global __cuLaunchCooperativeKernelMultiDevice + cuGetProcAddress_v2('cuLaunchCooperativeKernelMultiDevice', &__cuLaunchCooperativeKernelMultiDevice, 9000, ptds_mode, NULL) + + global __cuLaunchHostFunc + cuGetProcAddress_v2('cuLaunchHostFunc', &__cuLaunchHostFunc, 10000, ptds_mode, NULL) + + global __cuFuncSetBlockShape + cuGetProcAddress_v2('cuFuncSetBlockShape', &__cuFuncSetBlockShape, 2000, ptds_mode, NULL) + + global __cuFuncSetSharedSize + cuGetProcAddress_v2('cuFuncSetSharedSize', &__cuFuncSetSharedSize, 2000, ptds_mode, NULL) + + global __cuParamSetSize + cuGetProcAddress_v2('cuParamSetSize', &__cuParamSetSize, 2000, ptds_mode, NULL) + + global __cuParamSeti + cuGetProcAddress_v2('cuParamSeti', &__cuParamSeti, 2000, ptds_mode, NULL) + + global __cuParamSetf + cuGetProcAddress_v2('cuParamSetf', &__cuParamSetf, 2000, ptds_mode, NULL) + + global __cuParamSetv + cuGetProcAddress_v2('cuParamSetv', &__cuParamSetv, 2000, ptds_mode, NULL) + + global __cuLaunch + cuGetProcAddress_v2('cuLaunch', &__cuLaunch, 2000, ptds_mode, NULL) + + global __cuLaunchGrid + cuGetProcAddress_v2('cuLaunchGrid', &__cuLaunchGrid, 2000, ptds_mode, NULL) + + global __cuLaunchGridAsync + cuGetProcAddress_v2('cuLaunchGridAsync', &__cuLaunchGridAsync, 2000, ptds_mode, NULL) + + global __cuParamSetTexRef + cuGetProcAddress_v2('cuParamSetTexRef', &__cuParamSetTexRef, 2000, ptds_mode, NULL) + + global __cuFuncSetSharedMemConfig + cuGetProcAddress_v2('cuFuncSetSharedMemConfig', &__cuFuncSetSharedMemConfig, 4020, ptds_mode, NULL) + + global __cuGraphCreate + cuGetProcAddress_v2('cuGraphCreate', &__cuGraphCreate, 10000, ptds_mode, NULL) + + global __cuGraphAddKernelNode_v2 + cuGetProcAddress_v2('cuGraphAddKernelNode', &__cuGraphAddKernelNode_v2, 12000, ptds_mode, NULL) + + global __cuGraphKernelNodeGetParams_v2 + cuGetProcAddress_v2('cuGraphKernelNodeGetParams', &__cuGraphKernelNodeGetParams_v2, 12000, ptds_mode, NULL) + + global __cuGraphKernelNodeSetParams_v2 + cuGetProcAddress_v2('cuGraphKernelNodeSetParams', &__cuGraphKernelNodeSetParams_v2, 12000, ptds_mode, NULL) + + global __cuGraphAddMemcpyNode + cuGetProcAddress_v2('cuGraphAddMemcpyNode', &__cuGraphAddMemcpyNode, 10000, ptds_mode, NULL) + + global __cuGraphMemcpyNodeGetParams + cuGetProcAddress_v2('cuGraphMemcpyNodeGetParams', &__cuGraphMemcpyNodeGetParams, 10000, ptds_mode, NULL) + + global __cuGraphMemcpyNodeSetParams + cuGetProcAddress_v2('cuGraphMemcpyNodeSetParams', &__cuGraphMemcpyNodeSetParams, 10000, ptds_mode, NULL) + + global __cuGraphAddMemsetNode + cuGetProcAddress_v2('cuGraphAddMemsetNode', &__cuGraphAddMemsetNode, 10000, ptds_mode, NULL) + + global __cuGraphMemsetNodeGetParams + cuGetProcAddress_v2('cuGraphMemsetNodeGetParams', &__cuGraphMemsetNodeGetParams, 10000, ptds_mode, NULL) + + global __cuGraphMemsetNodeSetParams + cuGetProcAddress_v2('cuGraphMemsetNodeSetParams', &__cuGraphMemsetNodeSetParams, 10000, ptds_mode, NULL) + + global __cuGraphAddHostNode + cuGetProcAddress_v2('cuGraphAddHostNode', &__cuGraphAddHostNode, 10000, ptds_mode, NULL) + + global __cuGraphHostNodeGetParams + cuGetProcAddress_v2('cuGraphHostNodeGetParams', &__cuGraphHostNodeGetParams, 10000, ptds_mode, NULL) + + global __cuGraphHostNodeSetParams + cuGetProcAddress_v2('cuGraphHostNodeSetParams', &__cuGraphHostNodeSetParams, 10000, ptds_mode, NULL) + + global __cuGraphAddChildGraphNode + cuGetProcAddress_v2('cuGraphAddChildGraphNode', &__cuGraphAddChildGraphNode, 10000, ptds_mode, NULL) + + global __cuGraphChildGraphNodeGetGraph + cuGetProcAddress_v2('cuGraphChildGraphNodeGetGraph', &__cuGraphChildGraphNodeGetGraph, 10000, ptds_mode, NULL) + + global __cuGraphAddEmptyNode + cuGetProcAddress_v2('cuGraphAddEmptyNode', &__cuGraphAddEmptyNode, 10000, ptds_mode, NULL) + + global __cuGraphAddEventRecordNode + cuGetProcAddress_v2('cuGraphAddEventRecordNode', &__cuGraphAddEventRecordNode, 11010, ptds_mode, NULL) + + global __cuGraphEventRecordNodeGetEvent + cuGetProcAddress_v2('cuGraphEventRecordNodeGetEvent', &__cuGraphEventRecordNodeGetEvent, 11010, ptds_mode, NULL) + + global __cuGraphEventRecordNodeSetEvent + cuGetProcAddress_v2('cuGraphEventRecordNodeSetEvent', &__cuGraphEventRecordNodeSetEvent, 11010, ptds_mode, NULL) + + global __cuGraphAddEventWaitNode + cuGetProcAddress_v2('cuGraphAddEventWaitNode', &__cuGraphAddEventWaitNode, 11010, ptds_mode, NULL) + + global __cuGraphEventWaitNodeGetEvent + cuGetProcAddress_v2('cuGraphEventWaitNodeGetEvent', &__cuGraphEventWaitNodeGetEvent, 11010, ptds_mode, NULL) + + global __cuGraphEventWaitNodeSetEvent + cuGetProcAddress_v2('cuGraphEventWaitNodeSetEvent', &__cuGraphEventWaitNodeSetEvent, 11010, ptds_mode, NULL) + + global __cuGraphAddExternalSemaphoresSignalNode + cuGetProcAddress_v2('cuGraphAddExternalSemaphoresSignalNode', &__cuGraphAddExternalSemaphoresSignalNode, 11020, ptds_mode, NULL) + + global __cuGraphExternalSemaphoresSignalNodeGetParams + cuGetProcAddress_v2('cuGraphExternalSemaphoresSignalNodeGetParams', &__cuGraphExternalSemaphoresSignalNodeGetParams, 11020, ptds_mode, NULL) + + global __cuGraphExternalSemaphoresSignalNodeSetParams + cuGetProcAddress_v2('cuGraphExternalSemaphoresSignalNodeSetParams', &__cuGraphExternalSemaphoresSignalNodeSetParams, 11020, ptds_mode, NULL) + + global __cuGraphAddExternalSemaphoresWaitNode + cuGetProcAddress_v2('cuGraphAddExternalSemaphoresWaitNode', &__cuGraphAddExternalSemaphoresWaitNode, 11020, ptds_mode, NULL) + + global __cuGraphExternalSemaphoresWaitNodeGetParams + cuGetProcAddress_v2('cuGraphExternalSemaphoresWaitNodeGetParams', &__cuGraphExternalSemaphoresWaitNodeGetParams, 11020, ptds_mode, NULL) + + global __cuGraphExternalSemaphoresWaitNodeSetParams + cuGetProcAddress_v2('cuGraphExternalSemaphoresWaitNodeSetParams', &__cuGraphExternalSemaphoresWaitNodeSetParams, 11020, ptds_mode, NULL) + + global __cuGraphAddBatchMemOpNode + cuGetProcAddress_v2('cuGraphAddBatchMemOpNode', &__cuGraphAddBatchMemOpNode, 11070, ptds_mode, NULL) + + global __cuGraphBatchMemOpNodeGetParams + cuGetProcAddress_v2('cuGraphBatchMemOpNodeGetParams', &__cuGraphBatchMemOpNodeGetParams, 11070, ptds_mode, NULL) + + global __cuGraphBatchMemOpNodeSetParams + cuGetProcAddress_v2('cuGraphBatchMemOpNodeSetParams', &__cuGraphBatchMemOpNodeSetParams, 11070, ptds_mode, NULL) + + global __cuGraphExecBatchMemOpNodeSetParams + cuGetProcAddress_v2('cuGraphExecBatchMemOpNodeSetParams', &__cuGraphExecBatchMemOpNodeSetParams, 11070, ptds_mode, NULL) + + global __cuGraphAddMemAllocNode + cuGetProcAddress_v2('cuGraphAddMemAllocNode', &__cuGraphAddMemAllocNode, 11040, ptds_mode, NULL) + + global __cuGraphMemAllocNodeGetParams + cuGetProcAddress_v2('cuGraphMemAllocNodeGetParams', &__cuGraphMemAllocNodeGetParams, 11040, ptds_mode, NULL) + + global __cuGraphAddMemFreeNode + cuGetProcAddress_v2('cuGraphAddMemFreeNode', &__cuGraphAddMemFreeNode, 11040, ptds_mode, NULL) + + global __cuGraphMemFreeNodeGetParams + cuGetProcAddress_v2('cuGraphMemFreeNodeGetParams', &__cuGraphMemFreeNodeGetParams, 11040, ptds_mode, NULL) + + global __cuDeviceGraphMemTrim + cuGetProcAddress_v2('cuDeviceGraphMemTrim', &__cuDeviceGraphMemTrim, 11040, ptds_mode, NULL) + + global __cuDeviceGetGraphMemAttribute + cuGetProcAddress_v2('cuDeviceGetGraphMemAttribute', &__cuDeviceGetGraphMemAttribute, 11040, ptds_mode, NULL) + + global __cuDeviceSetGraphMemAttribute + cuGetProcAddress_v2('cuDeviceSetGraphMemAttribute', &__cuDeviceSetGraphMemAttribute, 11040, ptds_mode, NULL) + + global __cuGraphClone + cuGetProcAddress_v2('cuGraphClone', &__cuGraphClone, 10000, ptds_mode, NULL) + + global __cuGraphNodeFindInClone + cuGetProcAddress_v2('cuGraphNodeFindInClone', &__cuGraphNodeFindInClone, 10000, ptds_mode, NULL) + + global __cuGraphNodeGetType + cuGetProcAddress_v2('cuGraphNodeGetType', &__cuGraphNodeGetType, 10000, ptds_mode, NULL) + + global __cuGraphGetNodes + cuGetProcAddress_v2('cuGraphGetNodes', &__cuGraphGetNodes, 10000, ptds_mode, NULL) + + global __cuGraphGetRootNodes + cuGetProcAddress_v2('cuGraphGetRootNodes', &__cuGraphGetRootNodes, 10000, ptds_mode, NULL) + + global __cuGraphGetEdges_v2 + cuGetProcAddress_v2('cuGraphGetEdges', &__cuGraphGetEdges_v2, 12030, ptds_mode, NULL) + + global __cuGraphNodeGetDependencies_v2 + cuGetProcAddress_v2('cuGraphNodeGetDependencies', &__cuGraphNodeGetDependencies_v2, 12030, ptds_mode, NULL) + + global __cuGraphNodeGetDependentNodes_v2 + cuGetProcAddress_v2('cuGraphNodeGetDependentNodes', &__cuGraphNodeGetDependentNodes_v2, 12030, ptds_mode, NULL) + + global __cuGraphAddDependencies_v2 + cuGetProcAddress_v2('cuGraphAddDependencies', &__cuGraphAddDependencies_v2, 12030, ptds_mode, NULL) + + global __cuGraphRemoveDependencies_v2 + cuGetProcAddress_v2('cuGraphRemoveDependencies', &__cuGraphRemoveDependencies_v2, 12030, ptds_mode, NULL) + + global __cuGraphDestroyNode + cuGetProcAddress_v2('cuGraphDestroyNode', &__cuGraphDestroyNode, 10000, ptds_mode, NULL) + + global __cuGraphInstantiateWithFlags + cuGetProcAddress_v2('cuGraphInstantiateWithFlags', &__cuGraphInstantiateWithFlags, 11040, ptds_mode, NULL) + + global __cuGraphInstantiateWithParams + cuGetProcAddress_v2('cuGraphInstantiateWithParams', &__cuGraphInstantiateWithParams, 12000, ptds_mode, NULL) + + global __cuGraphExecGetFlags + cuGetProcAddress_v2('cuGraphExecGetFlags', &__cuGraphExecGetFlags, 12000, ptds_mode, NULL) + + global __cuGraphExecKernelNodeSetParams_v2 + cuGetProcAddress_v2('cuGraphExecKernelNodeSetParams', &__cuGraphExecKernelNodeSetParams_v2, 12000, ptds_mode, NULL) + + global __cuGraphExecMemcpyNodeSetParams + cuGetProcAddress_v2('cuGraphExecMemcpyNodeSetParams', &__cuGraphExecMemcpyNodeSetParams, 10020, ptds_mode, NULL) + + global __cuGraphExecMemsetNodeSetParams + cuGetProcAddress_v2('cuGraphExecMemsetNodeSetParams', &__cuGraphExecMemsetNodeSetParams, 10020, ptds_mode, NULL) + + global __cuGraphExecHostNodeSetParams + cuGetProcAddress_v2('cuGraphExecHostNodeSetParams', &__cuGraphExecHostNodeSetParams, 10020, ptds_mode, NULL) + + global __cuGraphExecChildGraphNodeSetParams + cuGetProcAddress_v2('cuGraphExecChildGraphNodeSetParams', &__cuGraphExecChildGraphNodeSetParams, 11010, ptds_mode, NULL) + + global __cuGraphExecEventRecordNodeSetEvent + cuGetProcAddress_v2('cuGraphExecEventRecordNodeSetEvent', &__cuGraphExecEventRecordNodeSetEvent, 11010, ptds_mode, NULL) + + global __cuGraphExecEventWaitNodeSetEvent + cuGetProcAddress_v2('cuGraphExecEventWaitNodeSetEvent', &__cuGraphExecEventWaitNodeSetEvent, 11010, ptds_mode, NULL) + + global __cuGraphExecExternalSemaphoresSignalNodeSetParams + cuGetProcAddress_v2('cuGraphExecExternalSemaphoresSignalNodeSetParams', &__cuGraphExecExternalSemaphoresSignalNodeSetParams, 11020, ptds_mode, NULL) + + global __cuGraphExecExternalSemaphoresWaitNodeSetParams + cuGetProcAddress_v2('cuGraphExecExternalSemaphoresWaitNodeSetParams', &__cuGraphExecExternalSemaphoresWaitNodeSetParams, 11020, ptds_mode, NULL) + + global __cuGraphNodeSetEnabled + cuGetProcAddress_v2('cuGraphNodeSetEnabled', &__cuGraphNodeSetEnabled, 11060, ptds_mode, NULL) + + global __cuGraphNodeGetEnabled + cuGetProcAddress_v2('cuGraphNodeGetEnabled', &__cuGraphNodeGetEnabled, 11060, ptds_mode, NULL) + + global __cuGraphUpload + cuGetProcAddress_v2('cuGraphUpload', &__cuGraphUpload, 11010, ptds_mode, NULL) + + global __cuGraphLaunch + cuGetProcAddress_v2('cuGraphLaunch', &__cuGraphLaunch, 10000, ptds_mode, NULL) + + global __cuGraphExecDestroy + cuGetProcAddress_v2('cuGraphExecDestroy', &__cuGraphExecDestroy, 10000, ptds_mode, NULL) + + global __cuGraphDestroy + cuGetProcAddress_v2('cuGraphDestroy', &__cuGraphDestroy, 10000, ptds_mode, NULL) + + global __cuGraphExecUpdate_v2 + cuGetProcAddress_v2('cuGraphExecUpdate', &__cuGraphExecUpdate_v2, 12000, ptds_mode, NULL) + + global __cuGraphKernelNodeCopyAttributes + cuGetProcAddress_v2('cuGraphKernelNodeCopyAttributes', &__cuGraphKernelNodeCopyAttributes, 11000, ptds_mode, NULL) + + global __cuGraphKernelNodeGetAttribute + cuGetProcAddress_v2('cuGraphKernelNodeGetAttribute', &__cuGraphKernelNodeGetAttribute, 11000, ptds_mode, NULL) + + global __cuGraphKernelNodeSetAttribute + cuGetProcAddress_v2('cuGraphKernelNodeSetAttribute', &__cuGraphKernelNodeSetAttribute, 11000, ptds_mode, NULL) + + global __cuGraphDebugDotPrint + cuGetProcAddress_v2('cuGraphDebugDotPrint', &__cuGraphDebugDotPrint, 11030, ptds_mode, NULL) + + global __cuUserObjectCreate + cuGetProcAddress_v2('cuUserObjectCreate', &__cuUserObjectCreate, 11030, ptds_mode, NULL) + + global __cuUserObjectRetain + cuGetProcAddress_v2('cuUserObjectRetain', &__cuUserObjectRetain, 11030, ptds_mode, NULL) + + global __cuUserObjectRelease + cuGetProcAddress_v2('cuUserObjectRelease', &__cuUserObjectRelease, 11030, ptds_mode, NULL) + + global __cuGraphRetainUserObject + cuGetProcAddress_v2('cuGraphRetainUserObject', &__cuGraphRetainUserObject, 11030, ptds_mode, NULL) + + global __cuGraphReleaseUserObject + cuGetProcAddress_v2('cuGraphReleaseUserObject', &__cuGraphReleaseUserObject, 11030, ptds_mode, NULL) + + global __cuGraphAddNode_v2 + cuGetProcAddress_v2('cuGraphAddNode', &__cuGraphAddNode_v2, 12030, ptds_mode, NULL) + + global __cuGraphNodeSetParams + cuGetProcAddress_v2('cuGraphNodeSetParams', &__cuGraphNodeSetParams, 12020, ptds_mode, NULL) + + global __cuGraphExecNodeSetParams + cuGetProcAddress_v2('cuGraphExecNodeSetParams', &__cuGraphExecNodeSetParams, 12020, ptds_mode, NULL) + + global __cuGraphConditionalHandleCreate + cuGetProcAddress_v2('cuGraphConditionalHandleCreate', &__cuGraphConditionalHandleCreate, 12030, ptds_mode, NULL) + + global __cuOccupancyMaxActiveBlocksPerMultiprocessor + cuGetProcAddress_v2('cuOccupancyMaxActiveBlocksPerMultiprocessor', &__cuOccupancyMaxActiveBlocksPerMultiprocessor, 6050, ptds_mode, NULL) + + global __cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags + cuGetProcAddress_v2('cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags', &__cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags, 7000, ptds_mode, NULL) + + global __cuOccupancyMaxPotentialBlockSize + cuGetProcAddress_v2('cuOccupancyMaxPotentialBlockSize', &__cuOccupancyMaxPotentialBlockSize, 6050, ptds_mode, NULL) + + global __cuOccupancyMaxPotentialBlockSizeWithFlags + cuGetProcAddress_v2('cuOccupancyMaxPotentialBlockSizeWithFlags', &__cuOccupancyMaxPotentialBlockSizeWithFlags, 7000, ptds_mode, NULL) + + global __cuOccupancyAvailableDynamicSMemPerBlock + cuGetProcAddress_v2('cuOccupancyAvailableDynamicSMemPerBlock', &__cuOccupancyAvailableDynamicSMemPerBlock, 10020, ptds_mode, NULL) + + global __cuOccupancyMaxPotentialClusterSize + cuGetProcAddress_v2('cuOccupancyMaxPotentialClusterSize', &__cuOccupancyMaxPotentialClusterSize, 11070, ptds_mode, NULL) + + global __cuOccupancyMaxActiveClusters + cuGetProcAddress_v2('cuOccupancyMaxActiveClusters', &__cuOccupancyMaxActiveClusters, 11070, ptds_mode, NULL) + + global __cuTexRefSetArray + cuGetProcAddress_v2('cuTexRefSetArray', &__cuTexRefSetArray, 2000, ptds_mode, NULL) + + global __cuTexRefSetMipmappedArray + cuGetProcAddress_v2('cuTexRefSetMipmappedArray', &__cuTexRefSetMipmappedArray, 5000, ptds_mode, NULL) + + global __cuTexRefSetAddress_v2 + cuGetProcAddress_v2('cuTexRefSetAddress', &__cuTexRefSetAddress_v2, 3020, ptds_mode, NULL) + + global __cuTexRefSetAddress2D_v3 + cuGetProcAddress_v2('cuTexRefSetAddress2D', &__cuTexRefSetAddress2D_v3, 4010, ptds_mode, NULL) + + global __cuTexRefSetFormat + cuGetProcAddress_v2('cuTexRefSetFormat', &__cuTexRefSetFormat, 2000, ptds_mode, NULL) + + global __cuTexRefSetAddressMode + cuGetProcAddress_v2('cuTexRefSetAddressMode', &__cuTexRefSetAddressMode, 2000, ptds_mode, NULL) + + global __cuTexRefSetFilterMode + cuGetProcAddress_v2('cuTexRefSetFilterMode', &__cuTexRefSetFilterMode, 2000, ptds_mode, NULL) + + global __cuTexRefSetMipmapFilterMode + cuGetProcAddress_v2('cuTexRefSetMipmapFilterMode', &__cuTexRefSetMipmapFilterMode, 5000, ptds_mode, NULL) + + global __cuTexRefSetMipmapLevelBias + cuGetProcAddress_v2('cuTexRefSetMipmapLevelBias', &__cuTexRefSetMipmapLevelBias, 5000, ptds_mode, NULL) + + global __cuTexRefSetMipmapLevelClamp + cuGetProcAddress_v2('cuTexRefSetMipmapLevelClamp', &__cuTexRefSetMipmapLevelClamp, 5000, ptds_mode, NULL) + + global __cuTexRefSetMaxAnisotropy + cuGetProcAddress_v2('cuTexRefSetMaxAnisotropy', &__cuTexRefSetMaxAnisotropy, 5000, ptds_mode, NULL) + + global __cuTexRefSetBorderColor + cuGetProcAddress_v2('cuTexRefSetBorderColor', &__cuTexRefSetBorderColor, 8000, ptds_mode, NULL) + + global __cuTexRefSetFlags + cuGetProcAddress_v2('cuTexRefSetFlags', &__cuTexRefSetFlags, 2000, ptds_mode, NULL) + + global __cuTexRefGetAddress_v2 + cuGetProcAddress_v2('cuTexRefGetAddress', &__cuTexRefGetAddress_v2, 3020, ptds_mode, NULL) + + global __cuTexRefGetArray + cuGetProcAddress_v2('cuTexRefGetArray', &__cuTexRefGetArray, 2000, ptds_mode, NULL) + + global __cuTexRefGetMipmappedArray + cuGetProcAddress_v2('cuTexRefGetMipmappedArray', &__cuTexRefGetMipmappedArray, 5000, ptds_mode, NULL) + + global __cuTexRefGetAddressMode + cuGetProcAddress_v2('cuTexRefGetAddressMode', &__cuTexRefGetAddressMode, 2000, ptds_mode, NULL) + + global __cuTexRefGetFilterMode + cuGetProcAddress_v2('cuTexRefGetFilterMode', &__cuTexRefGetFilterMode, 2000, ptds_mode, NULL) + + global __cuTexRefGetFormat + cuGetProcAddress_v2('cuTexRefGetFormat', &__cuTexRefGetFormat, 2000, ptds_mode, NULL) + + global __cuTexRefGetMipmapFilterMode + cuGetProcAddress_v2('cuTexRefGetMipmapFilterMode', &__cuTexRefGetMipmapFilterMode, 5000, ptds_mode, NULL) + + global __cuTexRefGetMipmapLevelBias + cuGetProcAddress_v2('cuTexRefGetMipmapLevelBias', &__cuTexRefGetMipmapLevelBias, 5000, ptds_mode, NULL) + + global __cuTexRefGetMipmapLevelClamp + cuGetProcAddress_v2('cuTexRefGetMipmapLevelClamp', &__cuTexRefGetMipmapLevelClamp, 5000, ptds_mode, NULL) + + global __cuTexRefGetMaxAnisotropy + cuGetProcAddress_v2('cuTexRefGetMaxAnisotropy', &__cuTexRefGetMaxAnisotropy, 5000, ptds_mode, NULL) + + global __cuTexRefGetBorderColor + cuGetProcAddress_v2('cuTexRefGetBorderColor', &__cuTexRefGetBorderColor, 8000, ptds_mode, NULL) + + global __cuTexRefGetFlags + cuGetProcAddress_v2('cuTexRefGetFlags', &__cuTexRefGetFlags, 2000, ptds_mode, NULL) + + global __cuTexRefCreate + cuGetProcAddress_v2('cuTexRefCreate', &__cuTexRefCreate, 2000, ptds_mode, NULL) + + global __cuTexRefDestroy + cuGetProcAddress_v2('cuTexRefDestroy', &__cuTexRefDestroy, 2000, ptds_mode, NULL) + + global __cuSurfRefSetArray + cuGetProcAddress_v2('cuSurfRefSetArray', &__cuSurfRefSetArray, 3000, ptds_mode, NULL) + + global __cuSurfRefGetArray + cuGetProcAddress_v2('cuSurfRefGetArray', &__cuSurfRefGetArray, 3000, ptds_mode, NULL) + + global __cuTexObjectCreate + cuGetProcAddress_v2('cuTexObjectCreate', &__cuTexObjectCreate, 5000, ptds_mode, NULL) + + global __cuTexObjectDestroy + cuGetProcAddress_v2('cuTexObjectDestroy', &__cuTexObjectDestroy, 5000, ptds_mode, NULL) + + global __cuTexObjectGetResourceDesc + cuGetProcAddress_v2('cuTexObjectGetResourceDesc', &__cuTexObjectGetResourceDesc, 5000, ptds_mode, NULL) + + global __cuTexObjectGetTextureDesc + cuGetProcAddress_v2('cuTexObjectGetTextureDesc', &__cuTexObjectGetTextureDesc, 5000, ptds_mode, NULL) + + global __cuTexObjectGetResourceViewDesc + cuGetProcAddress_v2('cuTexObjectGetResourceViewDesc', &__cuTexObjectGetResourceViewDesc, 5000, ptds_mode, NULL) + + global __cuSurfObjectCreate + cuGetProcAddress_v2('cuSurfObjectCreate', &__cuSurfObjectCreate, 5000, ptds_mode, NULL) + + global __cuSurfObjectDestroy + cuGetProcAddress_v2('cuSurfObjectDestroy', &__cuSurfObjectDestroy, 5000, ptds_mode, NULL) + + global __cuSurfObjectGetResourceDesc + cuGetProcAddress_v2('cuSurfObjectGetResourceDesc', &__cuSurfObjectGetResourceDesc, 5000, ptds_mode, NULL) + + global __cuTensorMapEncodeTiled + cuGetProcAddress_v2('cuTensorMapEncodeTiled', &__cuTensorMapEncodeTiled, 12000, ptds_mode, NULL) + + global __cuTensorMapEncodeIm2col + cuGetProcAddress_v2('cuTensorMapEncodeIm2col', &__cuTensorMapEncodeIm2col, 12000, ptds_mode, NULL) + + global __cuTensorMapEncodeIm2colWide + cuGetProcAddress_v2('cuTensorMapEncodeIm2colWide', &__cuTensorMapEncodeIm2colWide, 12080, ptds_mode, NULL) + + global __cuTensorMapReplaceAddress + cuGetProcAddress_v2('cuTensorMapReplaceAddress', &__cuTensorMapReplaceAddress, 12000, ptds_mode, NULL) + + global __cuDeviceCanAccessPeer + cuGetProcAddress_v2('cuDeviceCanAccessPeer', &__cuDeviceCanAccessPeer, 4000, ptds_mode, NULL) + + global __cuCtxEnablePeerAccess + cuGetProcAddress_v2('cuCtxEnablePeerAccess', &__cuCtxEnablePeerAccess, 4000, ptds_mode, NULL) + + global __cuCtxDisablePeerAccess + cuGetProcAddress_v2('cuCtxDisablePeerAccess', &__cuCtxDisablePeerAccess, 4000, ptds_mode, NULL) + + global __cuDeviceGetP2PAttribute + cuGetProcAddress_v2('cuDeviceGetP2PAttribute', &__cuDeviceGetP2PAttribute, 8000, ptds_mode, NULL) + + global __cuGraphicsUnregisterResource + cuGetProcAddress_v2('cuGraphicsUnregisterResource', &__cuGraphicsUnregisterResource, 3000, ptds_mode, NULL) + + global __cuGraphicsSubResourceGetMappedArray + cuGetProcAddress_v2('cuGraphicsSubResourceGetMappedArray', &__cuGraphicsSubResourceGetMappedArray, 3000, ptds_mode, NULL) + + global __cuGraphicsResourceGetMappedMipmappedArray + cuGetProcAddress_v2('cuGraphicsResourceGetMappedMipmappedArray', &__cuGraphicsResourceGetMappedMipmappedArray, 5000, ptds_mode, NULL) + + global __cuGraphicsResourceGetMappedPointer_v2 + cuGetProcAddress_v2('cuGraphicsResourceGetMappedPointer', &__cuGraphicsResourceGetMappedPointer_v2, 3020, ptds_mode, NULL) + + global __cuGraphicsResourceSetMapFlags_v2 + cuGetProcAddress_v2('cuGraphicsResourceSetMapFlags', &__cuGraphicsResourceSetMapFlags_v2, 6050, ptds_mode, NULL) + + global __cuGraphicsMapResources + cuGetProcAddress_v2('cuGraphicsMapResources', &__cuGraphicsMapResources, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3000, ptds_mode, NULL) + + global __cuGraphicsUnmapResources + cuGetProcAddress_v2('cuGraphicsUnmapResources', &__cuGraphicsUnmapResources, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3000, ptds_mode, NULL) + + global __cuGetProcAddress_v2 + cuGetProcAddress_v2('cuGetProcAddress', &__cuGetProcAddress_v2, 12000, ptds_mode, NULL) + + global __cuCoredumpGetAttribute + cuGetProcAddress_v2('cuCoredumpGetAttribute', &__cuCoredumpGetAttribute, 12010, ptds_mode, NULL) + + global __cuCoredumpGetAttributeGlobal + cuGetProcAddress_v2('cuCoredumpGetAttributeGlobal', &__cuCoredumpGetAttributeGlobal, 12010, ptds_mode, NULL) + + global __cuCoredumpSetAttribute + cuGetProcAddress_v2('cuCoredumpSetAttribute', &__cuCoredumpSetAttribute, 12010, ptds_mode, NULL) + + global __cuCoredumpSetAttributeGlobal + cuGetProcAddress_v2('cuCoredumpSetAttributeGlobal', &__cuCoredumpSetAttributeGlobal, 12010, ptds_mode, NULL) + + global __cuGetExportTable + cuGetProcAddress_v2('cuGetExportTable', &__cuGetExportTable, 3000, ptds_mode, NULL) + + global __cuGreenCtxCreate + cuGetProcAddress_v2('cuGreenCtxCreate', &__cuGreenCtxCreate, 12040, ptds_mode, NULL) + + global __cuGreenCtxDestroy + cuGetProcAddress_v2('cuGreenCtxDestroy', &__cuGreenCtxDestroy, 12040, ptds_mode, NULL) + + global __cuCtxFromGreenCtx + cuGetProcAddress_v2('cuCtxFromGreenCtx', &__cuCtxFromGreenCtx, 12040, ptds_mode, NULL) + + global __cuDeviceGetDevResource + cuGetProcAddress_v2('cuDeviceGetDevResource', &__cuDeviceGetDevResource, 12040, ptds_mode, NULL) + + global __cuCtxGetDevResource + cuGetProcAddress_v2('cuCtxGetDevResource', &__cuCtxGetDevResource, 12040, ptds_mode, NULL) + + global __cuGreenCtxGetDevResource + cuGetProcAddress_v2('cuGreenCtxGetDevResource', &__cuGreenCtxGetDevResource, 12040, ptds_mode, NULL) + + global __cuDevSmResourceSplitByCount + cuGetProcAddress_v2('cuDevSmResourceSplitByCount', &__cuDevSmResourceSplitByCount, 12040, ptds_mode, NULL) + + global __cuDevResourceGenerateDesc + cuGetProcAddress_v2('cuDevResourceGenerateDesc', &__cuDevResourceGenerateDesc, 12040, ptds_mode, NULL) + + global __cuGreenCtxRecordEvent + cuGetProcAddress_v2('cuGreenCtxRecordEvent', &__cuGreenCtxRecordEvent, 12040, ptds_mode, NULL) + + global __cuGreenCtxWaitEvent + cuGetProcAddress_v2('cuGreenCtxWaitEvent', &__cuGreenCtxWaitEvent, 12040, ptds_mode, NULL) + + global __cuStreamGetGreenCtx + cuGetProcAddress_v2('cuStreamGetGreenCtx', &__cuStreamGetGreenCtx, 12040, ptds_mode, NULL) + + global __cuGreenCtxStreamCreate + cuGetProcAddress_v2('cuGreenCtxStreamCreate', &__cuGreenCtxStreamCreate, 12050, ptds_mode, NULL) + + global __cuLogsRegisterCallback + cuGetProcAddress_v2('cuLogsRegisterCallback', &__cuLogsRegisterCallback, 12080, ptds_mode, NULL) + + global __cuLogsUnregisterCallback + cuGetProcAddress_v2('cuLogsUnregisterCallback', &__cuLogsUnregisterCallback, 12080, ptds_mode, NULL) + + global __cuLogsCurrent + cuGetProcAddress_v2('cuLogsCurrent', &__cuLogsCurrent, 12080, ptds_mode, NULL) + + global __cuLogsDumpToFile + cuGetProcAddress_v2('cuLogsDumpToFile', &__cuLogsDumpToFile, 12080, ptds_mode, NULL) + + global __cuLogsDumpToMemory + cuGetProcAddress_v2('cuLogsDumpToMemory', &__cuLogsDumpToMemory, 12080, ptds_mode, NULL) + + global __cuCheckpointProcessGetRestoreThreadId + cuGetProcAddress_v2('cuCheckpointProcessGetRestoreThreadId', &__cuCheckpointProcessGetRestoreThreadId, 12080, ptds_mode, NULL) + + global __cuCheckpointProcessGetState + cuGetProcAddress_v2('cuCheckpointProcessGetState', &__cuCheckpointProcessGetState, 12080, ptds_mode, NULL) + + global __cuCheckpointProcessLock + cuGetProcAddress_v2('cuCheckpointProcessLock', &__cuCheckpointProcessLock, 12080, ptds_mode, NULL) + + global __cuCheckpointProcessCheckpoint + cuGetProcAddress_v2('cuCheckpointProcessCheckpoint', &__cuCheckpointProcessCheckpoint, 12080, ptds_mode, NULL) + + global __cuCheckpointProcessRestore + cuGetProcAddress_v2('cuCheckpointProcessRestore', &__cuCheckpointProcessRestore, 12080, ptds_mode, NULL) + + global __cuCheckpointProcessUnlock + cuGetProcAddress_v2('cuCheckpointProcessUnlock', &__cuCheckpointProcessUnlock, 12080, ptds_mode, NULL) + + global __cuGraphicsEGLRegisterImage + cuGetProcAddress_v2('cuGraphicsEGLRegisterImage', &__cuGraphicsEGLRegisterImage, 7000, ptds_mode, NULL) + + global __cuEGLStreamConsumerConnect + cuGetProcAddress_v2('cuEGLStreamConsumerConnect', &__cuEGLStreamConsumerConnect, 7000, ptds_mode, NULL) + + global __cuEGLStreamConsumerConnectWithFlags + cuGetProcAddress_v2('cuEGLStreamConsumerConnectWithFlags', &__cuEGLStreamConsumerConnectWithFlags, 8000, ptds_mode, NULL) + + global __cuEGLStreamConsumerDisconnect + cuGetProcAddress_v2('cuEGLStreamConsumerDisconnect', &__cuEGLStreamConsumerDisconnect, 7000, ptds_mode, NULL) + + global __cuEGLStreamConsumerAcquireFrame + cuGetProcAddress_v2('cuEGLStreamConsumerAcquireFrame', &__cuEGLStreamConsumerAcquireFrame, 7000, ptds_mode, NULL) + + global __cuEGLStreamConsumerReleaseFrame + cuGetProcAddress_v2('cuEGLStreamConsumerReleaseFrame', &__cuEGLStreamConsumerReleaseFrame, 7000, ptds_mode, NULL) + + global __cuEGLStreamProducerConnect + cuGetProcAddress_v2('cuEGLStreamProducerConnect', &__cuEGLStreamProducerConnect, 7000, ptds_mode, NULL) + + global __cuEGLStreamProducerDisconnect + cuGetProcAddress_v2('cuEGLStreamProducerDisconnect', &__cuEGLStreamProducerDisconnect, 7000, ptds_mode, NULL) + + global __cuEGLStreamProducerPresentFrame + cuGetProcAddress_v2('cuEGLStreamProducerPresentFrame', &__cuEGLStreamProducerPresentFrame, 7000, ptds_mode, NULL) + + global __cuEGLStreamProducerReturnFrame + cuGetProcAddress_v2('cuEGLStreamProducerReturnFrame', &__cuEGLStreamProducerReturnFrame, 7000, ptds_mode, NULL) + + global __cuGraphicsResourceGetMappedEglFrame + cuGetProcAddress_v2('cuGraphicsResourceGetMappedEglFrame', &__cuGraphicsResourceGetMappedEglFrame, 7000, ptds_mode, NULL) + + global __cuEventCreateFromEGLSync + cuGetProcAddress_v2('cuEventCreateFromEGLSync', &__cuEventCreateFromEGLSync, 9000, ptds_mode, NULL) + + global __cuGraphicsGLRegisterBuffer + cuGetProcAddress_v2('cuGraphicsGLRegisterBuffer', &__cuGraphicsGLRegisterBuffer, 3000, ptds_mode, NULL) + + global __cuGraphicsGLRegisterImage + cuGetProcAddress_v2('cuGraphicsGLRegisterImage', &__cuGraphicsGLRegisterImage, 3000, ptds_mode, NULL) + + global __cuGLGetDevices_v2 + cuGetProcAddress_v2('cuGLGetDevices', &__cuGLGetDevices_v2, 6050, ptds_mode, NULL) + + global __cuGLCtxCreate_v2 + cuGetProcAddress_v2('cuGLCtxCreate', &__cuGLCtxCreate_v2, 3020, ptds_mode, NULL) + + global __cuGLInit + cuGetProcAddress_v2('cuGLInit', &__cuGLInit, 2000, ptds_mode, NULL) + + global __cuGLRegisterBufferObject + cuGetProcAddress_v2('cuGLRegisterBufferObject', &__cuGLRegisterBufferObject, 2000, ptds_mode, NULL) + + global __cuGLMapBufferObject_v2 + cuGetProcAddress_v2('cuGLMapBufferObject', &__cuGLMapBufferObject_v2, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuGLUnmapBufferObject + cuGetProcAddress_v2('cuGLUnmapBufferObject', &__cuGLUnmapBufferObject, 2000, ptds_mode, NULL) + + global __cuGLUnregisterBufferObject + cuGetProcAddress_v2('cuGLUnregisterBufferObject', &__cuGLUnregisterBufferObject, 2000, ptds_mode, NULL) + + global __cuGLSetBufferObjectMapFlags + cuGetProcAddress_v2('cuGLSetBufferObjectMapFlags', &__cuGLSetBufferObjectMapFlags, 2030, ptds_mode, NULL) + + global __cuGLMapBufferObjectAsync_v2 + cuGetProcAddress_v2('cuGLMapBufferObjectAsync', &__cuGLMapBufferObjectAsync_v2, 7000 if ptds_mode == CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM else 3020, ptds_mode, NULL) + + global __cuGLUnmapBufferObjectAsync + cuGetProcAddress_v2('cuGLUnmapBufferObjectAsync', &__cuGLUnmapBufferObjectAsync, 2030, ptds_mode, NULL) + + global __cuProfilerInitialize + cuGetProcAddress_v2('cuProfilerInitialize', &__cuProfilerInitialize, 4000, ptds_mode, NULL) + + global __cuProfilerStart + cuGetProcAddress_v2('cuProfilerStart', &__cuProfilerStart, 4000, ptds_mode, NULL) + + global __cuProfilerStop + cuGetProcAddress_v2('cuProfilerStop', &__cuProfilerStop, 4000, ptds_mode, NULL) + + global __cuVDPAUGetDevice + cuGetProcAddress_v2('cuVDPAUGetDevice', &__cuVDPAUGetDevice, 3010, ptds_mode, NULL) + + global __cuVDPAUCtxCreate_v2 + cuGetProcAddress_v2('cuVDPAUCtxCreate', &__cuVDPAUCtxCreate_v2, 3020, ptds_mode, NULL) + + global __cuGraphicsVDPAURegisterVideoSurface + cuGetProcAddress_v2('cuGraphicsVDPAURegisterVideoSurface', &__cuGraphicsVDPAURegisterVideoSurface, 3010, ptds_mode, NULL) + + global __cuGraphicsVDPAURegisterOutputSurface + cuGetProcAddress_v2('cuGraphicsVDPAURegisterOutputSurface', &__cuGraphicsVDPAURegisterOutputSurface, 3010, ptds_mode, NULL) + + global __cuDeviceGetHostAtomicCapabilities + cuGetProcAddress_v2('cuDeviceGetHostAtomicCapabilities', &__cuDeviceGetHostAtomicCapabilities, 13000, ptds_mode, NULL) + + global __cuCtxGetDevice_v2 + cuGetProcAddress_v2('cuCtxGetDevice', &__cuCtxGetDevice_v2, 13000, ptds_mode, NULL) + + global __cuCtxSynchronize_v2 + cuGetProcAddress_v2('cuCtxSynchronize', &__cuCtxSynchronize_v2, 13000, ptds_mode, NULL) + + global __cuMemcpyBatchAsync_v2 + cuGetProcAddress_v2('cuMemcpyBatchAsync', &__cuMemcpyBatchAsync_v2, 13000, ptds_mode, NULL) + + global __cuMemcpy3DBatchAsync_v2 + cuGetProcAddress_v2('cuMemcpy3DBatchAsync', &__cuMemcpy3DBatchAsync_v2, 13000, ptds_mode, NULL) + + global __cuMemGetDefaultMemPool + cuGetProcAddress_v2('cuMemGetDefaultMemPool', &__cuMemGetDefaultMemPool, 13000, ptds_mode, NULL) + + global __cuMemGetMemPool + cuGetProcAddress_v2('cuMemGetMemPool', &__cuMemGetMemPool, 13000, ptds_mode, NULL) + + global __cuMemSetMemPool + cuGetProcAddress_v2('cuMemSetMemPool', &__cuMemSetMemPool, 13000, ptds_mode, NULL) + + global __cuMemPrefetchBatchAsync + cuGetProcAddress_v2('cuMemPrefetchBatchAsync', &__cuMemPrefetchBatchAsync, 13000, ptds_mode, NULL) + + global __cuMemDiscardBatchAsync + cuGetProcAddress_v2('cuMemDiscardBatchAsync', &__cuMemDiscardBatchAsync, 13000, ptds_mode, NULL) + + global __cuMemDiscardAndPrefetchBatchAsync + cuGetProcAddress_v2('cuMemDiscardAndPrefetchBatchAsync', &__cuMemDiscardAndPrefetchBatchAsync, 13000, ptds_mode, NULL) + + global __cuDeviceGetP2PAtomicCapabilities + cuGetProcAddress_v2('cuDeviceGetP2PAtomicCapabilities', &__cuDeviceGetP2PAtomicCapabilities, 13000, ptds_mode, NULL) + + global __cuGreenCtxGetId + cuGetProcAddress_v2('cuGreenCtxGetId', &__cuGreenCtxGetId, 13000, ptds_mode, NULL) + + global __cuMulticastBindMem_v2 + cuGetProcAddress_v2('cuMulticastBindMem', &__cuMulticastBindMem_v2, 13010, ptds_mode, NULL) + + global __cuMulticastBindAddr_v2 + cuGetProcAddress_v2('cuMulticastBindAddr', &__cuMulticastBindAddr_v2, 13010, ptds_mode, NULL) + + global __cuGraphNodeGetContainingGraph + cuGetProcAddress_v2('cuGraphNodeGetContainingGraph', &__cuGraphNodeGetContainingGraph, 13010, ptds_mode, NULL) + + global __cuGraphNodeGetLocalId + cuGetProcAddress_v2('cuGraphNodeGetLocalId', &__cuGraphNodeGetLocalId, 13010, ptds_mode, NULL) + + global __cuGraphNodeGetToolsId + cuGetProcAddress_v2('cuGraphNodeGetToolsId', &__cuGraphNodeGetToolsId, 13010, ptds_mode, NULL) + + global __cuGraphGetId + cuGetProcAddress_v2('cuGraphGetId', &__cuGraphGetId, 13010, ptds_mode, NULL) + + global __cuGraphExecGetId + cuGetProcAddress_v2('cuGraphExecGetId', &__cuGraphExecGetId, 13010, ptds_mode, NULL) + + global __cuDevSmResourceSplit + cuGetProcAddress_v2('cuDevSmResourceSplit', &__cuDevSmResourceSplit, 13010, ptds_mode, NULL) + + global __cuStreamGetDevResource + cuGetProcAddress_v2('cuStreamGetDevResource', &__cuStreamGetDevResource, 13010, ptds_mode, NULL) + + global __cuKernelGetParamCount + cuGetProcAddress_v2('cuKernelGetParamCount', &__cuKernelGetParamCount, 13020, ptds_mode, NULL) + + global __cuMemcpyWithAttributesAsync + cuGetProcAddress_v2('cuMemcpyWithAttributesAsync', &__cuMemcpyWithAttributesAsync, 13020, ptds_mode, NULL) + + global __cuMemcpy3DWithAttributesAsync + cuGetProcAddress_v2('cuMemcpy3DWithAttributesAsync', &__cuMemcpy3DWithAttributesAsync, 13020, ptds_mode, NULL) + + global __cuStreamBeginCaptureToCig + cuGetProcAddress_v2('cuStreamBeginCaptureToCig', &__cuStreamBeginCaptureToCig, 13020, ptds_mode, NULL) + + global __cuStreamEndCaptureToCig + cuGetProcAddress_v2('cuStreamEndCaptureToCig', &__cuStreamEndCaptureToCig, 13020, ptds_mode, NULL) + + global __cuFuncGetParamCount + cuGetProcAddress_v2('cuFuncGetParamCount', &__cuFuncGetParamCount, 13020, ptds_mode, NULL) + + global __cuLaunchHostFunc_v2 + cuGetProcAddress_v2('cuLaunchHostFunc', &__cuLaunchHostFunc_v2, 13020, ptds_mode, NULL) + + global __cuGraphNodeGetParams + cuGetProcAddress_v2('cuGraphNodeGetParams', &__cuGraphNodeGetParams, 13020, ptds_mode, NULL) + + global __cuCoredumpRegisterStartCallback + cuGetProcAddress_v2('cuCoredumpRegisterStartCallback', &__cuCoredumpRegisterStartCallback, 13020, ptds_mode, NULL) + + global __cuCoredumpRegisterCompleteCallback + cuGetProcAddress_v2('cuCoredumpRegisterCompleteCallback', &__cuCoredumpRegisterCompleteCallback, 13020, ptds_mode, NULL) + + global __cuCoredumpDeregisterStartCallback + cuGetProcAddress_v2('cuCoredumpDeregisterStartCallback', &__cuCoredumpDeregisterStartCallback, 13020, ptds_mode, NULL) + + global __cuCoredumpDeregisterCompleteCallback + cuGetProcAddress_v2('cuCoredumpDeregisterCompleteCallback', &__cuCoredumpDeregisterCompleteCallback, 13020, ptds_mode, NULL) + + global __cuLogicalEndpointIdReserve + cuGetProcAddress_v2('cuLogicalEndpointIdReserve', &__cuLogicalEndpointIdReserve, 13030, ptds_mode, NULL) + + global __cuLogicalEndpointIdRelease + cuGetProcAddress_v2('cuLogicalEndpointIdRelease', &__cuLogicalEndpointIdRelease, 13030, ptds_mode, NULL) + + global __cuLogicalEndpointCreate + cuGetProcAddress_v2('cuLogicalEndpointCreate', &__cuLogicalEndpointCreate, 13030, ptds_mode, NULL) + + global __cuLogicalEndpointAddDevice + cuGetProcAddress_v2('cuLogicalEndpointAddDevice', &__cuLogicalEndpointAddDevice, 13030, ptds_mode, NULL) + + global __cuLogicalEndpointDestroy + cuGetProcAddress_v2('cuLogicalEndpointDestroy', &__cuLogicalEndpointDestroy, 13030, ptds_mode, NULL) + + global __cuLogicalEndpointBindAddr + cuGetProcAddress_v2('cuLogicalEndpointBindAddr', &__cuLogicalEndpointBindAddr, 13030, ptds_mode, NULL) + + global __cuLogicalEndpointBindMem + cuGetProcAddress_v2('cuLogicalEndpointBindMem', &__cuLogicalEndpointBindMem, 13030, ptds_mode, NULL) + + global __cuLogicalEndpointUnbind + cuGetProcAddress_v2('cuLogicalEndpointUnbind', &__cuLogicalEndpointUnbind, 13030, ptds_mode, NULL) + + global __cuLogicalEndpointExport + cuGetProcAddress_v2('cuLogicalEndpointExport', &__cuLogicalEndpointExport, 13030, ptds_mode, NULL) + + global __cuLogicalEndpointImport + cuGetProcAddress_v2('cuLogicalEndpointImport', &__cuLogicalEndpointImport, 13030, ptds_mode, NULL) + + global __cuLogicalEndpointGetLimits + cuGetProcAddress_v2('cuLogicalEndpointGetLimits', &__cuLogicalEndpointGetLimits, 13030, ptds_mode, NULL) + + global __cuLogicalEndpointQuery + cuGetProcAddress_v2('cuLogicalEndpointQuery', &__cuLogicalEndpointQuery, 13030, ptds_mode, NULL) + + global __cuStreamBeginRecaptureToGraph + cuGetProcAddress_v2('cuStreamBeginRecaptureToGraph', &__cuStreamBeginRecaptureToGraph, 13030, ptds_mode, NULL) + + _cyb___py_driver_init = True + return 0 + +cdef inline int _check_or_init_driver() except -1 nogil: + if _cyb___py_driver_init: + return 0 + + return _init_driver() + + +cpdef dict _inspect_function_pointers(): + global _cyb_func_ptrs + if _cyb_func_ptrs is not None: + return _cyb_func_ptrs + + _check_or_init_driver() + cdef dict data = {} + global __cuGetErrorString + data["__cuGetErrorString"] = <_cyb_intptr_t>__cuGetErrorString + + global __cuGetErrorName + data["__cuGetErrorName"] = <_cyb_intptr_t>__cuGetErrorName + + global __cuInit + data["__cuInit"] = <_cyb_intptr_t>__cuInit + + global __cuDriverGetVersion + data["__cuDriverGetVersion"] = <_cyb_intptr_t>__cuDriverGetVersion + + global __cuDeviceGet + data["__cuDeviceGet"] = <_cyb_intptr_t>__cuDeviceGet + + global __cuDeviceGetCount + data["__cuDeviceGetCount"] = <_cyb_intptr_t>__cuDeviceGetCount + + global __cuDeviceGetName + data["__cuDeviceGetName"] = <_cyb_intptr_t>__cuDeviceGetName + + global __cuDeviceGetUuid_v2 + data["__cuDeviceGetUuid_v2"] = <_cyb_intptr_t>__cuDeviceGetUuid_v2 + + global __cuDeviceGetLuid + data["__cuDeviceGetLuid"] = <_cyb_intptr_t>__cuDeviceGetLuid + + global __cuDeviceTotalMem_v2 + data["__cuDeviceTotalMem_v2"] = <_cyb_intptr_t>__cuDeviceTotalMem_v2 + + global __cuDeviceGetTexture1DLinearMaxWidth + data["__cuDeviceGetTexture1DLinearMaxWidth"] = <_cyb_intptr_t>__cuDeviceGetTexture1DLinearMaxWidth + + global __cuDeviceGetAttribute + data["__cuDeviceGetAttribute"] = <_cyb_intptr_t>__cuDeviceGetAttribute + + global __cuDeviceGetNvSciSyncAttributes + data["__cuDeviceGetNvSciSyncAttributes"] = <_cyb_intptr_t>__cuDeviceGetNvSciSyncAttributes + + global __cuDeviceSetMemPool + data["__cuDeviceSetMemPool"] = <_cyb_intptr_t>__cuDeviceSetMemPool + + global __cuDeviceGetMemPool + data["__cuDeviceGetMemPool"] = <_cyb_intptr_t>__cuDeviceGetMemPool + + global __cuDeviceGetDefaultMemPool + data["__cuDeviceGetDefaultMemPool"] = <_cyb_intptr_t>__cuDeviceGetDefaultMemPool + + global __cuDeviceGetExecAffinitySupport + data["__cuDeviceGetExecAffinitySupport"] = <_cyb_intptr_t>__cuDeviceGetExecAffinitySupport + + global __cuFlushGPUDirectRDMAWrites + data["__cuFlushGPUDirectRDMAWrites"] = <_cyb_intptr_t>__cuFlushGPUDirectRDMAWrites + + global __cuDeviceGetProperties + data["__cuDeviceGetProperties"] = <_cyb_intptr_t>__cuDeviceGetProperties + + global __cuDeviceComputeCapability + data["__cuDeviceComputeCapability"] = <_cyb_intptr_t>__cuDeviceComputeCapability + + global __cuDevicePrimaryCtxRetain + data["__cuDevicePrimaryCtxRetain"] = <_cyb_intptr_t>__cuDevicePrimaryCtxRetain + + global __cuDevicePrimaryCtxRelease_v2 + data["__cuDevicePrimaryCtxRelease_v2"] = <_cyb_intptr_t>__cuDevicePrimaryCtxRelease_v2 + + global __cuDevicePrimaryCtxSetFlags_v2 + data["__cuDevicePrimaryCtxSetFlags_v2"] = <_cyb_intptr_t>__cuDevicePrimaryCtxSetFlags_v2 + + global __cuDevicePrimaryCtxGetState + data["__cuDevicePrimaryCtxGetState"] = <_cyb_intptr_t>__cuDevicePrimaryCtxGetState + + global __cuDevicePrimaryCtxReset_v2 + data["__cuDevicePrimaryCtxReset_v2"] = <_cyb_intptr_t>__cuDevicePrimaryCtxReset_v2 + + global __cuCtxCreate_v2 + data["__cuCtxCreate_v2"] = <_cyb_intptr_t>__cuCtxCreate_v2 + + global __cuCtxCreate_v3 + data["__cuCtxCreate_v3"] = <_cyb_intptr_t>__cuCtxCreate_v3 + + global __cuCtxCreate_v4 + data["__cuCtxCreate_v4"] = <_cyb_intptr_t>__cuCtxCreate_v4 + + global __cuCtxDestroy_v2 + data["__cuCtxDestroy_v2"] = <_cyb_intptr_t>__cuCtxDestroy_v2 + + global __cuCtxPushCurrent_v2 + data["__cuCtxPushCurrent_v2"] = <_cyb_intptr_t>__cuCtxPushCurrent_v2 + + global __cuCtxPopCurrent_v2 + data["__cuCtxPopCurrent_v2"] = <_cyb_intptr_t>__cuCtxPopCurrent_v2 + + global __cuCtxSetCurrent + data["__cuCtxSetCurrent"] = <_cyb_intptr_t>__cuCtxSetCurrent + + global __cuCtxGetCurrent + data["__cuCtxGetCurrent"] = <_cyb_intptr_t>__cuCtxGetCurrent + + global __cuCtxGetDevice + data["__cuCtxGetDevice"] = <_cyb_intptr_t>__cuCtxGetDevice + + global __cuCtxGetFlags + data["__cuCtxGetFlags"] = <_cyb_intptr_t>__cuCtxGetFlags + + global __cuCtxSetFlags + data["__cuCtxSetFlags"] = <_cyb_intptr_t>__cuCtxSetFlags + + global __cuCtxGetId + data["__cuCtxGetId"] = <_cyb_intptr_t>__cuCtxGetId + + global __cuCtxSynchronize + data["__cuCtxSynchronize"] = <_cyb_intptr_t>__cuCtxSynchronize + + global __cuCtxSetLimit + data["__cuCtxSetLimit"] = <_cyb_intptr_t>__cuCtxSetLimit + + global __cuCtxGetLimit + data["__cuCtxGetLimit"] = <_cyb_intptr_t>__cuCtxGetLimit + + global __cuCtxGetCacheConfig + data["__cuCtxGetCacheConfig"] = <_cyb_intptr_t>__cuCtxGetCacheConfig + + global __cuCtxSetCacheConfig + data["__cuCtxSetCacheConfig"] = <_cyb_intptr_t>__cuCtxSetCacheConfig + + global __cuCtxGetApiVersion + data["__cuCtxGetApiVersion"] = <_cyb_intptr_t>__cuCtxGetApiVersion + + global __cuCtxGetStreamPriorityRange + data["__cuCtxGetStreamPriorityRange"] = <_cyb_intptr_t>__cuCtxGetStreamPriorityRange + + global __cuCtxResetPersistingL2Cache + data["__cuCtxResetPersistingL2Cache"] = <_cyb_intptr_t>__cuCtxResetPersistingL2Cache + + global __cuCtxGetExecAffinity + data["__cuCtxGetExecAffinity"] = <_cyb_intptr_t>__cuCtxGetExecAffinity + + global __cuCtxRecordEvent + data["__cuCtxRecordEvent"] = <_cyb_intptr_t>__cuCtxRecordEvent + + global __cuCtxWaitEvent + data["__cuCtxWaitEvent"] = <_cyb_intptr_t>__cuCtxWaitEvent + + global __cuCtxAttach + data["__cuCtxAttach"] = <_cyb_intptr_t>__cuCtxAttach + + global __cuCtxDetach + data["__cuCtxDetach"] = <_cyb_intptr_t>__cuCtxDetach + + global __cuCtxGetSharedMemConfig + data["__cuCtxGetSharedMemConfig"] = <_cyb_intptr_t>__cuCtxGetSharedMemConfig + + global __cuCtxSetSharedMemConfig + data["__cuCtxSetSharedMemConfig"] = <_cyb_intptr_t>__cuCtxSetSharedMemConfig + + global __cuModuleLoad + data["__cuModuleLoad"] = <_cyb_intptr_t>__cuModuleLoad + + global __cuModuleLoadData + data["__cuModuleLoadData"] = <_cyb_intptr_t>__cuModuleLoadData + + global __cuModuleLoadDataEx + data["__cuModuleLoadDataEx"] = <_cyb_intptr_t>__cuModuleLoadDataEx + + global __cuModuleLoadFatBinary + data["__cuModuleLoadFatBinary"] = <_cyb_intptr_t>__cuModuleLoadFatBinary + + global __cuModuleUnload + data["__cuModuleUnload"] = <_cyb_intptr_t>__cuModuleUnload + + global __cuModuleGetLoadingMode + data["__cuModuleGetLoadingMode"] = <_cyb_intptr_t>__cuModuleGetLoadingMode + + global __cuModuleGetFunction + data["__cuModuleGetFunction"] = <_cyb_intptr_t>__cuModuleGetFunction + + global __cuModuleGetFunctionCount + data["__cuModuleGetFunctionCount"] = <_cyb_intptr_t>__cuModuleGetFunctionCount + + global __cuModuleEnumerateFunctions + data["__cuModuleEnumerateFunctions"] = <_cyb_intptr_t>__cuModuleEnumerateFunctions + + global __cuModuleGetGlobal_v2 + data["__cuModuleGetGlobal_v2"] = <_cyb_intptr_t>__cuModuleGetGlobal_v2 + + global __cuLinkCreate_v2 + data["__cuLinkCreate_v2"] = <_cyb_intptr_t>__cuLinkCreate_v2 + + global __cuLinkAddData_v2 + data["__cuLinkAddData_v2"] = <_cyb_intptr_t>__cuLinkAddData_v2 + + global __cuLinkAddFile_v2 + data["__cuLinkAddFile_v2"] = <_cyb_intptr_t>__cuLinkAddFile_v2 + + global __cuLinkComplete + data["__cuLinkComplete"] = <_cyb_intptr_t>__cuLinkComplete + + global __cuLinkDestroy + data["__cuLinkDestroy"] = <_cyb_intptr_t>__cuLinkDestroy + + global __cuModuleGetTexRef + data["__cuModuleGetTexRef"] = <_cyb_intptr_t>__cuModuleGetTexRef + + global __cuModuleGetSurfRef + data["__cuModuleGetSurfRef"] = <_cyb_intptr_t>__cuModuleGetSurfRef + + global __cuLibraryLoadData + data["__cuLibraryLoadData"] = <_cyb_intptr_t>__cuLibraryLoadData + + global __cuLibraryLoadFromFile + data["__cuLibraryLoadFromFile"] = <_cyb_intptr_t>__cuLibraryLoadFromFile + + global __cuLibraryUnload + data["__cuLibraryUnload"] = <_cyb_intptr_t>__cuLibraryUnload + + global __cuLibraryGetKernel + data["__cuLibraryGetKernel"] = <_cyb_intptr_t>__cuLibraryGetKernel + + global __cuLibraryGetKernelCount + data["__cuLibraryGetKernelCount"] = <_cyb_intptr_t>__cuLibraryGetKernelCount + + global __cuLibraryEnumerateKernels + data["__cuLibraryEnumerateKernels"] = <_cyb_intptr_t>__cuLibraryEnumerateKernels + + global __cuLibraryGetModule + data["__cuLibraryGetModule"] = <_cyb_intptr_t>__cuLibraryGetModule + + global __cuKernelGetFunction + data["__cuKernelGetFunction"] = <_cyb_intptr_t>__cuKernelGetFunction + + global __cuKernelGetLibrary + data["__cuKernelGetLibrary"] = <_cyb_intptr_t>__cuKernelGetLibrary + + global __cuLibraryGetGlobal + data["__cuLibraryGetGlobal"] = <_cyb_intptr_t>__cuLibraryGetGlobal + + global __cuLibraryGetManaged + data["__cuLibraryGetManaged"] = <_cyb_intptr_t>__cuLibraryGetManaged + + global __cuLibraryGetUnifiedFunction + data["__cuLibraryGetUnifiedFunction"] = <_cyb_intptr_t>__cuLibraryGetUnifiedFunction + + global __cuKernelGetAttribute + data["__cuKernelGetAttribute"] = <_cyb_intptr_t>__cuKernelGetAttribute + + global __cuKernelSetAttribute + data["__cuKernelSetAttribute"] = <_cyb_intptr_t>__cuKernelSetAttribute + + global __cuKernelSetCacheConfig + data["__cuKernelSetCacheConfig"] = <_cyb_intptr_t>__cuKernelSetCacheConfig + + global __cuKernelGetName + data["__cuKernelGetName"] = <_cyb_intptr_t>__cuKernelGetName + + global __cuKernelGetParamInfo + data["__cuKernelGetParamInfo"] = <_cyb_intptr_t>__cuKernelGetParamInfo + + global __cuMemGetInfo_v2 + data["__cuMemGetInfo_v2"] = <_cyb_intptr_t>__cuMemGetInfo_v2 + + global __cuMemAlloc_v2 + data["__cuMemAlloc_v2"] = <_cyb_intptr_t>__cuMemAlloc_v2 + + global __cuMemAllocPitch_v2 + data["__cuMemAllocPitch_v2"] = <_cyb_intptr_t>__cuMemAllocPitch_v2 + + global __cuMemFree_v2 + data["__cuMemFree_v2"] = <_cyb_intptr_t>__cuMemFree_v2 + + global __cuMemGetAddressRange_v2 + data["__cuMemGetAddressRange_v2"] = <_cyb_intptr_t>__cuMemGetAddressRange_v2 + + global __cuMemAllocHost_v2 + data["__cuMemAllocHost_v2"] = <_cyb_intptr_t>__cuMemAllocHost_v2 + + global __cuMemFreeHost + data["__cuMemFreeHost"] = <_cyb_intptr_t>__cuMemFreeHost + + global __cuMemHostAlloc + data["__cuMemHostAlloc"] = <_cyb_intptr_t>__cuMemHostAlloc + + global __cuMemHostGetDevicePointer_v2 + data["__cuMemHostGetDevicePointer_v2"] = <_cyb_intptr_t>__cuMemHostGetDevicePointer_v2 + + global __cuMemHostGetFlags + data["__cuMemHostGetFlags"] = <_cyb_intptr_t>__cuMemHostGetFlags + + global __cuMemAllocManaged + data["__cuMemAllocManaged"] = <_cyb_intptr_t>__cuMemAllocManaged + + global __cuDeviceRegisterAsyncNotification + data["__cuDeviceRegisterAsyncNotification"] = <_cyb_intptr_t>__cuDeviceRegisterAsyncNotification + + global __cuDeviceUnregisterAsyncNotification + data["__cuDeviceUnregisterAsyncNotification"] = <_cyb_intptr_t>__cuDeviceUnregisterAsyncNotification + + global __cuDeviceGetByPCIBusId + data["__cuDeviceGetByPCIBusId"] = <_cyb_intptr_t>__cuDeviceGetByPCIBusId + + global __cuDeviceGetPCIBusId + data["__cuDeviceGetPCIBusId"] = <_cyb_intptr_t>__cuDeviceGetPCIBusId + + global __cuIpcGetEventHandle + data["__cuIpcGetEventHandle"] = <_cyb_intptr_t>__cuIpcGetEventHandle + + global __cuIpcOpenEventHandle + data["__cuIpcOpenEventHandle"] = <_cyb_intptr_t>__cuIpcOpenEventHandle + + global __cuIpcGetMemHandle + data["__cuIpcGetMemHandle"] = <_cyb_intptr_t>__cuIpcGetMemHandle + + global __cuIpcOpenMemHandle_v2 + data["__cuIpcOpenMemHandle_v2"] = <_cyb_intptr_t>__cuIpcOpenMemHandle_v2 + + global __cuIpcCloseMemHandle + data["__cuIpcCloseMemHandle"] = <_cyb_intptr_t>__cuIpcCloseMemHandle + + global __cuMemHostRegister_v2 + data["__cuMemHostRegister_v2"] = <_cyb_intptr_t>__cuMemHostRegister_v2 + + global __cuMemHostUnregister + data["__cuMemHostUnregister"] = <_cyb_intptr_t>__cuMemHostUnregister + + global __cuMemcpy + data["__cuMemcpy"] = <_cyb_intptr_t>__cuMemcpy + + global __cuMemcpyPeer + data["__cuMemcpyPeer"] = <_cyb_intptr_t>__cuMemcpyPeer + + global __cuMemcpyHtoD_v2 + data["__cuMemcpyHtoD_v2"] = <_cyb_intptr_t>__cuMemcpyHtoD_v2 + + global __cuMemcpyDtoH_v2 + data["__cuMemcpyDtoH_v2"] = <_cyb_intptr_t>__cuMemcpyDtoH_v2 + + global __cuMemcpyDtoD_v2 + data["__cuMemcpyDtoD_v2"] = <_cyb_intptr_t>__cuMemcpyDtoD_v2 + + global __cuMemcpyDtoA_v2 + data["__cuMemcpyDtoA_v2"] = <_cyb_intptr_t>__cuMemcpyDtoA_v2 + + global __cuMemcpyAtoD_v2 + data["__cuMemcpyAtoD_v2"] = <_cyb_intptr_t>__cuMemcpyAtoD_v2 + + global __cuMemcpyHtoA_v2 + data["__cuMemcpyHtoA_v2"] = <_cyb_intptr_t>__cuMemcpyHtoA_v2 + + global __cuMemcpyAtoH_v2 + data["__cuMemcpyAtoH_v2"] = <_cyb_intptr_t>__cuMemcpyAtoH_v2 + + global __cuMemcpyAtoA_v2 + data["__cuMemcpyAtoA_v2"] = <_cyb_intptr_t>__cuMemcpyAtoA_v2 + + global __cuMemcpy2D_v2 + data["__cuMemcpy2D_v2"] = <_cyb_intptr_t>__cuMemcpy2D_v2 + + global __cuMemcpy2DUnaligned_v2 + data["__cuMemcpy2DUnaligned_v2"] = <_cyb_intptr_t>__cuMemcpy2DUnaligned_v2 + + global __cuMemcpy3D_v2 + data["__cuMemcpy3D_v2"] = <_cyb_intptr_t>__cuMemcpy3D_v2 + + global __cuMemcpy3DPeer + data["__cuMemcpy3DPeer"] = <_cyb_intptr_t>__cuMemcpy3DPeer + + global __cuMemcpyAsync + data["__cuMemcpyAsync"] = <_cyb_intptr_t>__cuMemcpyAsync + + global __cuMemcpyPeerAsync + data["__cuMemcpyPeerAsync"] = <_cyb_intptr_t>__cuMemcpyPeerAsync + + global __cuMemcpyHtoDAsync_v2 + data["__cuMemcpyHtoDAsync_v2"] = <_cyb_intptr_t>__cuMemcpyHtoDAsync_v2 + + global __cuMemcpyDtoHAsync_v2 + data["__cuMemcpyDtoHAsync_v2"] = <_cyb_intptr_t>__cuMemcpyDtoHAsync_v2 + + global __cuMemcpyDtoDAsync_v2 + data["__cuMemcpyDtoDAsync_v2"] = <_cyb_intptr_t>__cuMemcpyDtoDAsync_v2 + + global __cuMemcpyHtoAAsync_v2 + data["__cuMemcpyHtoAAsync_v2"] = <_cyb_intptr_t>__cuMemcpyHtoAAsync_v2 + + global __cuMemcpyAtoHAsync_v2 + data["__cuMemcpyAtoHAsync_v2"] = <_cyb_intptr_t>__cuMemcpyAtoHAsync_v2 + + global __cuMemcpy2DAsync_v2 + data["__cuMemcpy2DAsync_v2"] = <_cyb_intptr_t>__cuMemcpy2DAsync_v2 + + global __cuMemcpy3DAsync_v2 + data["__cuMemcpy3DAsync_v2"] = <_cyb_intptr_t>__cuMemcpy3DAsync_v2 + + global __cuMemcpy3DPeerAsync + data["__cuMemcpy3DPeerAsync"] = <_cyb_intptr_t>__cuMemcpy3DPeerAsync + + global __cuMemsetD8_v2 + data["__cuMemsetD8_v2"] = <_cyb_intptr_t>__cuMemsetD8_v2 + + global __cuMemsetD16_v2 + data["__cuMemsetD16_v2"] = <_cyb_intptr_t>__cuMemsetD16_v2 + + global __cuMemsetD32_v2 + data["__cuMemsetD32_v2"] = <_cyb_intptr_t>__cuMemsetD32_v2 + + global __cuMemsetD2D8_v2 + data["__cuMemsetD2D8_v2"] = <_cyb_intptr_t>__cuMemsetD2D8_v2 + + global __cuMemsetD2D16_v2 + data["__cuMemsetD2D16_v2"] = <_cyb_intptr_t>__cuMemsetD2D16_v2 + + global __cuMemsetD2D32_v2 + data["__cuMemsetD2D32_v2"] = <_cyb_intptr_t>__cuMemsetD2D32_v2 + + global __cuMemsetD8Async + data["__cuMemsetD8Async"] = <_cyb_intptr_t>__cuMemsetD8Async + + global __cuMemsetD16Async + data["__cuMemsetD16Async"] = <_cyb_intptr_t>__cuMemsetD16Async + + global __cuMemsetD32Async + data["__cuMemsetD32Async"] = <_cyb_intptr_t>__cuMemsetD32Async + + global __cuMemsetD2D8Async + data["__cuMemsetD2D8Async"] = <_cyb_intptr_t>__cuMemsetD2D8Async + + global __cuMemsetD2D16Async + data["__cuMemsetD2D16Async"] = <_cyb_intptr_t>__cuMemsetD2D16Async + + global __cuMemsetD2D32Async + data["__cuMemsetD2D32Async"] = <_cyb_intptr_t>__cuMemsetD2D32Async + + global __cuArrayCreate_v2 + data["__cuArrayCreate_v2"] = <_cyb_intptr_t>__cuArrayCreate_v2 + + global __cuArrayGetDescriptor_v2 + data["__cuArrayGetDescriptor_v2"] = <_cyb_intptr_t>__cuArrayGetDescriptor_v2 + + global __cuArrayGetSparseProperties + data["__cuArrayGetSparseProperties"] = <_cyb_intptr_t>__cuArrayGetSparseProperties + + global __cuMipmappedArrayGetSparseProperties + data["__cuMipmappedArrayGetSparseProperties"] = <_cyb_intptr_t>__cuMipmappedArrayGetSparseProperties + + global __cuArrayGetMemoryRequirements + data["__cuArrayGetMemoryRequirements"] = <_cyb_intptr_t>__cuArrayGetMemoryRequirements + + global __cuMipmappedArrayGetMemoryRequirements + data["__cuMipmappedArrayGetMemoryRequirements"] = <_cyb_intptr_t>__cuMipmappedArrayGetMemoryRequirements + + global __cuArrayGetPlane + data["__cuArrayGetPlane"] = <_cyb_intptr_t>__cuArrayGetPlane + + global __cuArrayDestroy + data["__cuArrayDestroy"] = <_cyb_intptr_t>__cuArrayDestroy + + global __cuArray3DCreate_v2 + data["__cuArray3DCreate_v2"] = <_cyb_intptr_t>__cuArray3DCreate_v2 + + global __cuArray3DGetDescriptor_v2 + data["__cuArray3DGetDescriptor_v2"] = <_cyb_intptr_t>__cuArray3DGetDescriptor_v2 + + global __cuMipmappedArrayCreate + data["__cuMipmappedArrayCreate"] = <_cyb_intptr_t>__cuMipmappedArrayCreate + + global __cuMipmappedArrayGetLevel + data["__cuMipmappedArrayGetLevel"] = <_cyb_intptr_t>__cuMipmappedArrayGetLevel + + global __cuMipmappedArrayDestroy + data["__cuMipmappedArrayDestroy"] = <_cyb_intptr_t>__cuMipmappedArrayDestroy + + global __cuMemGetHandleForAddressRange + data["__cuMemGetHandleForAddressRange"] = <_cyb_intptr_t>__cuMemGetHandleForAddressRange + + global __cuMemBatchDecompressAsync + data["__cuMemBatchDecompressAsync"] = <_cyb_intptr_t>__cuMemBatchDecompressAsync + + global __cuMemAddressReserve + data["__cuMemAddressReserve"] = <_cyb_intptr_t>__cuMemAddressReserve + + global __cuMemAddressFree + data["__cuMemAddressFree"] = <_cyb_intptr_t>__cuMemAddressFree + + global __cuMemCreate + data["__cuMemCreate"] = <_cyb_intptr_t>__cuMemCreate + + global __cuMemRelease + data["__cuMemRelease"] = <_cyb_intptr_t>__cuMemRelease + + global __cuMemMap + data["__cuMemMap"] = <_cyb_intptr_t>__cuMemMap + + global __cuMemMapArrayAsync + data["__cuMemMapArrayAsync"] = <_cyb_intptr_t>__cuMemMapArrayAsync + + global __cuMemUnmap + data["__cuMemUnmap"] = <_cyb_intptr_t>__cuMemUnmap + + global __cuMemSetAccess + data["__cuMemSetAccess"] = <_cyb_intptr_t>__cuMemSetAccess + + global __cuMemGetAccess + data["__cuMemGetAccess"] = <_cyb_intptr_t>__cuMemGetAccess + + global __cuMemExportToShareableHandle + data["__cuMemExportToShareableHandle"] = <_cyb_intptr_t>__cuMemExportToShareableHandle + + global __cuMemImportFromShareableHandle + data["__cuMemImportFromShareableHandle"] = <_cyb_intptr_t>__cuMemImportFromShareableHandle + + global __cuMemGetAllocationGranularity + data["__cuMemGetAllocationGranularity"] = <_cyb_intptr_t>__cuMemGetAllocationGranularity + + global __cuMemGetAllocationPropertiesFromHandle + data["__cuMemGetAllocationPropertiesFromHandle"] = <_cyb_intptr_t>__cuMemGetAllocationPropertiesFromHandle + + global __cuMemRetainAllocationHandle + data["__cuMemRetainAllocationHandle"] = <_cyb_intptr_t>__cuMemRetainAllocationHandle + + global __cuMemFreeAsync + data["__cuMemFreeAsync"] = <_cyb_intptr_t>__cuMemFreeAsync + + global __cuMemAllocAsync + data["__cuMemAllocAsync"] = <_cyb_intptr_t>__cuMemAllocAsync + + global __cuMemPoolTrimTo + data["__cuMemPoolTrimTo"] = <_cyb_intptr_t>__cuMemPoolTrimTo + + global __cuMemPoolSetAttribute + data["__cuMemPoolSetAttribute"] = <_cyb_intptr_t>__cuMemPoolSetAttribute + + global __cuMemPoolGetAttribute + data["__cuMemPoolGetAttribute"] = <_cyb_intptr_t>__cuMemPoolGetAttribute + + global __cuMemPoolSetAccess + data["__cuMemPoolSetAccess"] = <_cyb_intptr_t>__cuMemPoolSetAccess + + global __cuMemPoolGetAccess + data["__cuMemPoolGetAccess"] = <_cyb_intptr_t>__cuMemPoolGetAccess + + global __cuMemPoolCreate + data["__cuMemPoolCreate"] = <_cyb_intptr_t>__cuMemPoolCreate + + global __cuMemPoolDestroy + data["__cuMemPoolDestroy"] = <_cyb_intptr_t>__cuMemPoolDestroy + + global __cuMemAllocFromPoolAsync + data["__cuMemAllocFromPoolAsync"] = <_cyb_intptr_t>__cuMemAllocFromPoolAsync + + global __cuMemPoolExportToShareableHandle + data["__cuMemPoolExportToShareableHandle"] = <_cyb_intptr_t>__cuMemPoolExportToShareableHandle + + global __cuMemPoolImportFromShareableHandle + data["__cuMemPoolImportFromShareableHandle"] = <_cyb_intptr_t>__cuMemPoolImportFromShareableHandle + + global __cuMemPoolExportPointer + data["__cuMemPoolExportPointer"] = <_cyb_intptr_t>__cuMemPoolExportPointer + + global __cuMemPoolImportPointer + data["__cuMemPoolImportPointer"] = <_cyb_intptr_t>__cuMemPoolImportPointer + + global __cuMulticastCreate + data["__cuMulticastCreate"] = <_cyb_intptr_t>__cuMulticastCreate + + global __cuMulticastAddDevice + data["__cuMulticastAddDevice"] = <_cyb_intptr_t>__cuMulticastAddDevice + + global __cuMulticastBindMem + data["__cuMulticastBindMem"] = <_cyb_intptr_t>__cuMulticastBindMem + + global __cuMulticastBindAddr + data["__cuMulticastBindAddr"] = <_cyb_intptr_t>__cuMulticastBindAddr + + global __cuMulticastUnbind + data["__cuMulticastUnbind"] = <_cyb_intptr_t>__cuMulticastUnbind + + global __cuMulticastGetGranularity + data["__cuMulticastGetGranularity"] = <_cyb_intptr_t>__cuMulticastGetGranularity + + global __cuPointerGetAttribute + data["__cuPointerGetAttribute"] = <_cyb_intptr_t>__cuPointerGetAttribute + + global __cuMemPrefetchAsync_v2 + data["__cuMemPrefetchAsync_v2"] = <_cyb_intptr_t>__cuMemPrefetchAsync_v2 + + global __cuMemAdvise_v2 + data["__cuMemAdvise_v2"] = <_cyb_intptr_t>__cuMemAdvise_v2 + + global __cuMemRangeGetAttribute + data["__cuMemRangeGetAttribute"] = <_cyb_intptr_t>__cuMemRangeGetAttribute + + global __cuMemRangeGetAttributes + data["__cuMemRangeGetAttributes"] = <_cyb_intptr_t>__cuMemRangeGetAttributes + + global __cuPointerSetAttribute + data["__cuPointerSetAttribute"] = <_cyb_intptr_t>__cuPointerSetAttribute + + global __cuPointerGetAttributes + data["__cuPointerGetAttributes"] = <_cyb_intptr_t>__cuPointerGetAttributes + + global __cuStreamCreate + data["__cuStreamCreate"] = <_cyb_intptr_t>__cuStreamCreate + + global __cuStreamCreateWithPriority + data["__cuStreamCreateWithPriority"] = <_cyb_intptr_t>__cuStreamCreateWithPriority + + global __cuStreamGetPriority + data["__cuStreamGetPriority"] = <_cyb_intptr_t>__cuStreamGetPriority + + global __cuStreamGetDevice + data["__cuStreamGetDevice"] = <_cyb_intptr_t>__cuStreamGetDevice + + global __cuStreamGetFlags + data["__cuStreamGetFlags"] = <_cyb_intptr_t>__cuStreamGetFlags + + global __cuStreamGetId + data["__cuStreamGetId"] = <_cyb_intptr_t>__cuStreamGetId + + global __cuStreamGetCtx + data["__cuStreamGetCtx"] = <_cyb_intptr_t>__cuStreamGetCtx + + global __cuStreamGetCtx_v2 + data["__cuStreamGetCtx_v2"] = <_cyb_intptr_t>__cuStreamGetCtx_v2 + + global __cuStreamWaitEvent + data["__cuStreamWaitEvent"] = <_cyb_intptr_t>__cuStreamWaitEvent + + global __cuStreamAddCallback + data["__cuStreamAddCallback"] = <_cyb_intptr_t>__cuStreamAddCallback + + global __cuStreamBeginCapture_v2 + data["__cuStreamBeginCapture_v2"] = <_cyb_intptr_t>__cuStreamBeginCapture_v2 + + global __cuStreamBeginCaptureToGraph + data["__cuStreamBeginCaptureToGraph"] = <_cyb_intptr_t>__cuStreamBeginCaptureToGraph + + global __cuThreadExchangeStreamCaptureMode + data["__cuThreadExchangeStreamCaptureMode"] = <_cyb_intptr_t>__cuThreadExchangeStreamCaptureMode + + global __cuStreamEndCapture + data["__cuStreamEndCapture"] = <_cyb_intptr_t>__cuStreamEndCapture + + global __cuStreamIsCapturing + data["__cuStreamIsCapturing"] = <_cyb_intptr_t>__cuStreamIsCapturing + + global __cuStreamGetCaptureInfo_v2 + data["__cuStreamGetCaptureInfo_v2"] = <_cyb_intptr_t>__cuStreamGetCaptureInfo_v2 + + global __cuStreamGetCaptureInfo_v3 + data["__cuStreamGetCaptureInfo_v3"] = <_cyb_intptr_t>__cuStreamGetCaptureInfo_v3 + + global __cuStreamUpdateCaptureDependencies_v2 + data["__cuStreamUpdateCaptureDependencies_v2"] = <_cyb_intptr_t>__cuStreamUpdateCaptureDependencies_v2 + + global __cuStreamAttachMemAsync + data["__cuStreamAttachMemAsync"] = <_cyb_intptr_t>__cuStreamAttachMemAsync + + global __cuStreamQuery + data["__cuStreamQuery"] = <_cyb_intptr_t>__cuStreamQuery + + global __cuStreamSynchronize + data["__cuStreamSynchronize"] = <_cyb_intptr_t>__cuStreamSynchronize + + global __cuStreamDestroy_v2 + data["__cuStreamDestroy_v2"] = <_cyb_intptr_t>__cuStreamDestroy_v2 + + global __cuStreamCopyAttributes + data["__cuStreamCopyAttributes"] = <_cyb_intptr_t>__cuStreamCopyAttributes + + global __cuStreamGetAttribute + data["__cuStreamGetAttribute"] = <_cyb_intptr_t>__cuStreamGetAttribute + + global __cuStreamSetAttribute + data["__cuStreamSetAttribute"] = <_cyb_intptr_t>__cuStreamSetAttribute + + global __cuEventCreate + data["__cuEventCreate"] = <_cyb_intptr_t>__cuEventCreate + + global __cuEventRecord + data["__cuEventRecord"] = <_cyb_intptr_t>__cuEventRecord + + global __cuEventRecordWithFlags + data["__cuEventRecordWithFlags"] = <_cyb_intptr_t>__cuEventRecordWithFlags + + global __cuEventQuery + data["__cuEventQuery"] = <_cyb_intptr_t>__cuEventQuery + + global __cuEventSynchronize + data["__cuEventSynchronize"] = <_cyb_intptr_t>__cuEventSynchronize + + global __cuEventDestroy_v2 + data["__cuEventDestroy_v2"] = <_cyb_intptr_t>__cuEventDestroy_v2 + + global __cuEventElapsedTime_v2 + data["__cuEventElapsedTime_v2"] = <_cyb_intptr_t>__cuEventElapsedTime_v2 + + global __cuImportExternalMemory + data["__cuImportExternalMemory"] = <_cyb_intptr_t>__cuImportExternalMemory + + global __cuExternalMemoryGetMappedBuffer + data["__cuExternalMemoryGetMappedBuffer"] = <_cyb_intptr_t>__cuExternalMemoryGetMappedBuffer + + global __cuExternalMemoryGetMappedMipmappedArray + data["__cuExternalMemoryGetMappedMipmappedArray"] = <_cyb_intptr_t>__cuExternalMemoryGetMappedMipmappedArray + + global __cuDestroyExternalMemory + data["__cuDestroyExternalMemory"] = <_cyb_intptr_t>__cuDestroyExternalMemory + + global __cuImportExternalSemaphore + data["__cuImportExternalSemaphore"] = <_cyb_intptr_t>__cuImportExternalSemaphore + + global __cuSignalExternalSemaphoresAsync + data["__cuSignalExternalSemaphoresAsync"] = <_cyb_intptr_t>__cuSignalExternalSemaphoresAsync + + global __cuWaitExternalSemaphoresAsync + data["__cuWaitExternalSemaphoresAsync"] = <_cyb_intptr_t>__cuWaitExternalSemaphoresAsync + + global __cuDestroyExternalSemaphore + data["__cuDestroyExternalSemaphore"] = <_cyb_intptr_t>__cuDestroyExternalSemaphore + + global __cuStreamWaitValue32_v2 + data["__cuStreamWaitValue32_v2"] = <_cyb_intptr_t>__cuStreamWaitValue32_v2 + + global __cuStreamWaitValue64_v2 + data["__cuStreamWaitValue64_v2"] = <_cyb_intptr_t>__cuStreamWaitValue64_v2 + + global __cuStreamWriteValue32_v2 + data["__cuStreamWriteValue32_v2"] = <_cyb_intptr_t>__cuStreamWriteValue32_v2 + + global __cuStreamWriteValue64_v2 + data["__cuStreamWriteValue64_v2"] = <_cyb_intptr_t>__cuStreamWriteValue64_v2 + + global __cuStreamBatchMemOp_v2 + data["__cuStreamBatchMemOp_v2"] = <_cyb_intptr_t>__cuStreamBatchMemOp_v2 + + global __cuFuncGetAttribute + data["__cuFuncGetAttribute"] = <_cyb_intptr_t>__cuFuncGetAttribute + + global __cuFuncSetAttribute + data["__cuFuncSetAttribute"] = <_cyb_intptr_t>__cuFuncSetAttribute + + global __cuFuncSetCacheConfig + data["__cuFuncSetCacheConfig"] = <_cyb_intptr_t>__cuFuncSetCacheConfig + + global __cuFuncGetModule + data["__cuFuncGetModule"] = <_cyb_intptr_t>__cuFuncGetModule + + global __cuFuncGetName + data["__cuFuncGetName"] = <_cyb_intptr_t>__cuFuncGetName + + global __cuFuncGetParamInfo + data["__cuFuncGetParamInfo"] = <_cyb_intptr_t>__cuFuncGetParamInfo + + global __cuFuncIsLoaded + data["__cuFuncIsLoaded"] = <_cyb_intptr_t>__cuFuncIsLoaded + + global __cuFuncLoad + data["__cuFuncLoad"] = <_cyb_intptr_t>__cuFuncLoad + + global __cuLaunchKernel + data["__cuLaunchKernel"] = <_cyb_intptr_t>__cuLaunchKernel + + global __cuLaunchKernelEx + data["__cuLaunchKernelEx"] = <_cyb_intptr_t>__cuLaunchKernelEx + + global __cuLaunchCooperativeKernel + data["__cuLaunchCooperativeKernel"] = <_cyb_intptr_t>__cuLaunchCooperativeKernel + + global __cuLaunchCooperativeKernelMultiDevice + data["__cuLaunchCooperativeKernelMultiDevice"] = <_cyb_intptr_t>__cuLaunchCooperativeKernelMultiDevice + + global __cuLaunchHostFunc + data["__cuLaunchHostFunc"] = <_cyb_intptr_t>__cuLaunchHostFunc + + global __cuFuncSetBlockShape + data["__cuFuncSetBlockShape"] = <_cyb_intptr_t>__cuFuncSetBlockShape + + global __cuFuncSetSharedSize + data["__cuFuncSetSharedSize"] = <_cyb_intptr_t>__cuFuncSetSharedSize + + global __cuParamSetSize + data["__cuParamSetSize"] = <_cyb_intptr_t>__cuParamSetSize + + global __cuParamSeti + data["__cuParamSeti"] = <_cyb_intptr_t>__cuParamSeti + + global __cuParamSetf + data["__cuParamSetf"] = <_cyb_intptr_t>__cuParamSetf + + global __cuParamSetv + data["__cuParamSetv"] = <_cyb_intptr_t>__cuParamSetv + + global __cuLaunch + data["__cuLaunch"] = <_cyb_intptr_t>__cuLaunch + + global __cuLaunchGrid + data["__cuLaunchGrid"] = <_cyb_intptr_t>__cuLaunchGrid + + global __cuLaunchGridAsync + data["__cuLaunchGridAsync"] = <_cyb_intptr_t>__cuLaunchGridAsync + + global __cuParamSetTexRef + data["__cuParamSetTexRef"] = <_cyb_intptr_t>__cuParamSetTexRef + + global __cuFuncSetSharedMemConfig + data["__cuFuncSetSharedMemConfig"] = <_cyb_intptr_t>__cuFuncSetSharedMemConfig + + global __cuGraphCreate + data["__cuGraphCreate"] = <_cyb_intptr_t>__cuGraphCreate + + global __cuGraphAddKernelNode_v2 + data["__cuGraphAddKernelNode_v2"] = <_cyb_intptr_t>__cuGraphAddKernelNode_v2 + + global __cuGraphKernelNodeGetParams_v2 + data["__cuGraphKernelNodeGetParams_v2"] = <_cyb_intptr_t>__cuGraphKernelNodeGetParams_v2 + + global __cuGraphKernelNodeSetParams_v2 + data["__cuGraphKernelNodeSetParams_v2"] = <_cyb_intptr_t>__cuGraphKernelNodeSetParams_v2 + + global __cuGraphAddMemcpyNode + data["__cuGraphAddMemcpyNode"] = <_cyb_intptr_t>__cuGraphAddMemcpyNode + + global __cuGraphMemcpyNodeGetParams + data["__cuGraphMemcpyNodeGetParams"] = <_cyb_intptr_t>__cuGraphMemcpyNodeGetParams + + global __cuGraphMemcpyNodeSetParams + data["__cuGraphMemcpyNodeSetParams"] = <_cyb_intptr_t>__cuGraphMemcpyNodeSetParams + + global __cuGraphAddMemsetNode + data["__cuGraphAddMemsetNode"] = <_cyb_intptr_t>__cuGraphAddMemsetNode + + global __cuGraphMemsetNodeGetParams + data["__cuGraphMemsetNodeGetParams"] = <_cyb_intptr_t>__cuGraphMemsetNodeGetParams + + global __cuGraphMemsetNodeSetParams + data["__cuGraphMemsetNodeSetParams"] = <_cyb_intptr_t>__cuGraphMemsetNodeSetParams + + global __cuGraphAddHostNode + data["__cuGraphAddHostNode"] = <_cyb_intptr_t>__cuGraphAddHostNode + + global __cuGraphHostNodeGetParams + data["__cuGraphHostNodeGetParams"] = <_cyb_intptr_t>__cuGraphHostNodeGetParams + + global __cuGraphHostNodeSetParams + data["__cuGraphHostNodeSetParams"] = <_cyb_intptr_t>__cuGraphHostNodeSetParams + + global __cuGraphAddChildGraphNode + data["__cuGraphAddChildGraphNode"] = <_cyb_intptr_t>__cuGraphAddChildGraphNode + + global __cuGraphChildGraphNodeGetGraph + data["__cuGraphChildGraphNodeGetGraph"] = <_cyb_intptr_t>__cuGraphChildGraphNodeGetGraph + + global __cuGraphAddEmptyNode + data["__cuGraphAddEmptyNode"] = <_cyb_intptr_t>__cuGraphAddEmptyNode + + global __cuGraphAddEventRecordNode + data["__cuGraphAddEventRecordNode"] = <_cyb_intptr_t>__cuGraphAddEventRecordNode + + global __cuGraphEventRecordNodeGetEvent + data["__cuGraphEventRecordNodeGetEvent"] = <_cyb_intptr_t>__cuGraphEventRecordNodeGetEvent + + global __cuGraphEventRecordNodeSetEvent + data["__cuGraphEventRecordNodeSetEvent"] = <_cyb_intptr_t>__cuGraphEventRecordNodeSetEvent + + global __cuGraphAddEventWaitNode + data["__cuGraphAddEventWaitNode"] = <_cyb_intptr_t>__cuGraphAddEventWaitNode + + global __cuGraphEventWaitNodeGetEvent + data["__cuGraphEventWaitNodeGetEvent"] = <_cyb_intptr_t>__cuGraphEventWaitNodeGetEvent + + global __cuGraphEventWaitNodeSetEvent + data["__cuGraphEventWaitNodeSetEvent"] = <_cyb_intptr_t>__cuGraphEventWaitNodeSetEvent + + global __cuGraphAddExternalSemaphoresSignalNode + data["__cuGraphAddExternalSemaphoresSignalNode"] = <_cyb_intptr_t>__cuGraphAddExternalSemaphoresSignalNode + + global __cuGraphExternalSemaphoresSignalNodeGetParams + data["__cuGraphExternalSemaphoresSignalNodeGetParams"] = <_cyb_intptr_t>__cuGraphExternalSemaphoresSignalNodeGetParams + + global __cuGraphExternalSemaphoresSignalNodeSetParams + data["__cuGraphExternalSemaphoresSignalNodeSetParams"] = <_cyb_intptr_t>__cuGraphExternalSemaphoresSignalNodeSetParams + + global __cuGraphAddExternalSemaphoresWaitNode + data["__cuGraphAddExternalSemaphoresWaitNode"] = <_cyb_intptr_t>__cuGraphAddExternalSemaphoresWaitNode + + global __cuGraphExternalSemaphoresWaitNodeGetParams + data["__cuGraphExternalSemaphoresWaitNodeGetParams"] = <_cyb_intptr_t>__cuGraphExternalSemaphoresWaitNodeGetParams + + global __cuGraphExternalSemaphoresWaitNodeSetParams + data["__cuGraphExternalSemaphoresWaitNodeSetParams"] = <_cyb_intptr_t>__cuGraphExternalSemaphoresWaitNodeSetParams + + global __cuGraphAddBatchMemOpNode + data["__cuGraphAddBatchMemOpNode"] = <_cyb_intptr_t>__cuGraphAddBatchMemOpNode + + global __cuGraphBatchMemOpNodeGetParams + data["__cuGraphBatchMemOpNodeGetParams"] = <_cyb_intptr_t>__cuGraphBatchMemOpNodeGetParams + + global __cuGraphBatchMemOpNodeSetParams + data["__cuGraphBatchMemOpNodeSetParams"] = <_cyb_intptr_t>__cuGraphBatchMemOpNodeSetParams + + global __cuGraphExecBatchMemOpNodeSetParams + data["__cuGraphExecBatchMemOpNodeSetParams"] = <_cyb_intptr_t>__cuGraphExecBatchMemOpNodeSetParams + + global __cuGraphAddMemAllocNode + data["__cuGraphAddMemAllocNode"] = <_cyb_intptr_t>__cuGraphAddMemAllocNode + + global __cuGraphMemAllocNodeGetParams + data["__cuGraphMemAllocNodeGetParams"] = <_cyb_intptr_t>__cuGraphMemAllocNodeGetParams + + global __cuGraphAddMemFreeNode + data["__cuGraphAddMemFreeNode"] = <_cyb_intptr_t>__cuGraphAddMemFreeNode + + global __cuGraphMemFreeNodeGetParams + data["__cuGraphMemFreeNodeGetParams"] = <_cyb_intptr_t>__cuGraphMemFreeNodeGetParams + + global __cuDeviceGraphMemTrim + data["__cuDeviceGraphMemTrim"] = <_cyb_intptr_t>__cuDeviceGraphMemTrim + + global __cuDeviceGetGraphMemAttribute + data["__cuDeviceGetGraphMemAttribute"] = <_cyb_intptr_t>__cuDeviceGetGraphMemAttribute + + global __cuDeviceSetGraphMemAttribute + data["__cuDeviceSetGraphMemAttribute"] = <_cyb_intptr_t>__cuDeviceSetGraphMemAttribute + + global __cuGraphClone + data["__cuGraphClone"] = <_cyb_intptr_t>__cuGraphClone + + global __cuGraphNodeFindInClone + data["__cuGraphNodeFindInClone"] = <_cyb_intptr_t>__cuGraphNodeFindInClone + + global __cuGraphNodeGetType + data["__cuGraphNodeGetType"] = <_cyb_intptr_t>__cuGraphNodeGetType + + global __cuGraphGetNodes + data["__cuGraphGetNodes"] = <_cyb_intptr_t>__cuGraphGetNodes + + global __cuGraphGetRootNodes + data["__cuGraphGetRootNodes"] = <_cyb_intptr_t>__cuGraphGetRootNodes + + global __cuGraphGetEdges_v2 + data["__cuGraphGetEdges_v2"] = <_cyb_intptr_t>__cuGraphGetEdges_v2 + + global __cuGraphNodeGetDependencies_v2 + data["__cuGraphNodeGetDependencies_v2"] = <_cyb_intptr_t>__cuGraphNodeGetDependencies_v2 + + global __cuGraphNodeGetDependentNodes_v2 + data["__cuGraphNodeGetDependentNodes_v2"] = <_cyb_intptr_t>__cuGraphNodeGetDependentNodes_v2 + + global __cuGraphAddDependencies_v2 + data["__cuGraphAddDependencies_v2"] = <_cyb_intptr_t>__cuGraphAddDependencies_v2 + + global __cuGraphRemoveDependencies_v2 + data["__cuGraphRemoveDependencies_v2"] = <_cyb_intptr_t>__cuGraphRemoveDependencies_v2 + + global __cuGraphDestroyNode + data["__cuGraphDestroyNode"] = <_cyb_intptr_t>__cuGraphDestroyNode + + global __cuGraphInstantiateWithFlags + data["__cuGraphInstantiateWithFlags"] = <_cyb_intptr_t>__cuGraphInstantiateWithFlags + + global __cuGraphInstantiateWithParams + data["__cuGraphInstantiateWithParams"] = <_cyb_intptr_t>__cuGraphInstantiateWithParams + + global __cuGraphExecGetFlags + data["__cuGraphExecGetFlags"] = <_cyb_intptr_t>__cuGraphExecGetFlags + + global __cuGraphExecKernelNodeSetParams_v2 + data["__cuGraphExecKernelNodeSetParams_v2"] = <_cyb_intptr_t>__cuGraphExecKernelNodeSetParams_v2 + + global __cuGraphExecMemcpyNodeSetParams + data["__cuGraphExecMemcpyNodeSetParams"] = <_cyb_intptr_t>__cuGraphExecMemcpyNodeSetParams + + global __cuGraphExecMemsetNodeSetParams + data["__cuGraphExecMemsetNodeSetParams"] = <_cyb_intptr_t>__cuGraphExecMemsetNodeSetParams + + global __cuGraphExecHostNodeSetParams + data["__cuGraphExecHostNodeSetParams"] = <_cyb_intptr_t>__cuGraphExecHostNodeSetParams + + global __cuGraphExecChildGraphNodeSetParams + data["__cuGraphExecChildGraphNodeSetParams"] = <_cyb_intptr_t>__cuGraphExecChildGraphNodeSetParams + + global __cuGraphExecEventRecordNodeSetEvent + data["__cuGraphExecEventRecordNodeSetEvent"] = <_cyb_intptr_t>__cuGraphExecEventRecordNodeSetEvent + + global __cuGraphExecEventWaitNodeSetEvent + data["__cuGraphExecEventWaitNodeSetEvent"] = <_cyb_intptr_t>__cuGraphExecEventWaitNodeSetEvent + + global __cuGraphExecExternalSemaphoresSignalNodeSetParams + data["__cuGraphExecExternalSemaphoresSignalNodeSetParams"] = <_cyb_intptr_t>__cuGraphExecExternalSemaphoresSignalNodeSetParams + + global __cuGraphExecExternalSemaphoresWaitNodeSetParams + data["__cuGraphExecExternalSemaphoresWaitNodeSetParams"] = <_cyb_intptr_t>__cuGraphExecExternalSemaphoresWaitNodeSetParams + + global __cuGraphNodeSetEnabled + data["__cuGraphNodeSetEnabled"] = <_cyb_intptr_t>__cuGraphNodeSetEnabled + + global __cuGraphNodeGetEnabled + data["__cuGraphNodeGetEnabled"] = <_cyb_intptr_t>__cuGraphNodeGetEnabled + + global __cuGraphUpload + data["__cuGraphUpload"] = <_cyb_intptr_t>__cuGraphUpload + + global __cuGraphLaunch + data["__cuGraphLaunch"] = <_cyb_intptr_t>__cuGraphLaunch + + global __cuGraphExecDestroy + data["__cuGraphExecDestroy"] = <_cyb_intptr_t>__cuGraphExecDestroy + + global __cuGraphDestroy + data["__cuGraphDestroy"] = <_cyb_intptr_t>__cuGraphDestroy + + global __cuGraphExecUpdate_v2 + data["__cuGraphExecUpdate_v2"] = <_cyb_intptr_t>__cuGraphExecUpdate_v2 + + global __cuGraphKernelNodeCopyAttributes + data["__cuGraphKernelNodeCopyAttributes"] = <_cyb_intptr_t>__cuGraphKernelNodeCopyAttributes + + global __cuGraphKernelNodeGetAttribute + data["__cuGraphKernelNodeGetAttribute"] = <_cyb_intptr_t>__cuGraphKernelNodeGetAttribute + + global __cuGraphKernelNodeSetAttribute + data["__cuGraphKernelNodeSetAttribute"] = <_cyb_intptr_t>__cuGraphKernelNodeSetAttribute + + global __cuGraphDebugDotPrint + data["__cuGraphDebugDotPrint"] = <_cyb_intptr_t>__cuGraphDebugDotPrint + + global __cuUserObjectCreate + data["__cuUserObjectCreate"] = <_cyb_intptr_t>__cuUserObjectCreate + + global __cuUserObjectRetain + data["__cuUserObjectRetain"] = <_cyb_intptr_t>__cuUserObjectRetain + + global __cuUserObjectRelease + data["__cuUserObjectRelease"] = <_cyb_intptr_t>__cuUserObjectRelease + + global __cuGraphRetainUserObject + data["__cuGraphRetainUserObject"] = <_cyb_intptr_t>__cuGraphRetainUserObject + + global __cuGraphReleaseUserObject + data["__cuGraphReleaseUserObject"] = <_cyb_intptr_t>__cuGraphReleaseUserObject + + global __cuGraphAddNode_v2 + data["__cuGraphAddNode_v2"] = <_cyb_intptr_t>__cuGraphAddNode_v2 + + global __cuGraphNodeSetParams + data["__cuGraphNodeSetParams"] = <_cyb_intptr_t>__cuGraphNodeSetParams + + global __cuGraphExecNodeSetParams + data["__cuGraphExecNodeSetParams"] = <_cyb_intptr_t>__cuGraphExecNodeSetParams + + global __cuGraphConditionalHandleCreate + data["__cuGraphConditionalHandleCreate"] = <_cyb_intptr_t>__cuGraphConditionalHandleCreate + + global __cuOccupancyMaxActiveBlocksPerMultiprocessor + data["__cuOccupancyMaxActiveBlocksPerMultiprocessor"] = <_cyb_intptr_t>__cuOccupancyMaxActiveBlocksPerMultiprocessor + + global __cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags + data["__cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags"] = <_cyb_intptr_t>__cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags + + global __cuOccupancyMaxPotentialBlockSize + data["__cuOccupancyMaxPotentialBlockSize"] = <_cyb_intptr_t>__cuOccupancyMaxPotentialBlockSize + + global __cuOccupancyMaxPotentialBlockSizeWithFlags + data["__cuOccupancyMaxPotentialBlockSizeWithFlags"] = <_cyb_intptr_t>__cuOccupancyMaxPotentialBlockSizeWithFlags + + global __cuOccupancyAvailableDynamicSMemPerBlock + data["__cuOccupancyAvailableDynamicSMemPerBlock"] = <_cyb_intptr_t>__cuOccupancyAvailableDynamicSMemPerBlock + + global __cuOccupancyMaxPotentialClusterSize + data["__cuOccupancyMaxPotentialClusterSize"] = <_cyb_intptr_t>__cuOccupancyMaxPotentialClusterSize + + global __cuOccupancyMaxActiveClusters + data["__cuOccupancyMaxActiveClusters"] = <_cyb_intptr_t>__cuOccupancyMaxActiveClusters + + global __cuTexRefSetArray + data["__cuTexRefSetArray"] = <_cyb_intptr_t>__cuTexRefSetArray + + global __cuTexRefSetMipmappedArray + data["__cuTexRefSetMipmappedArray"] = <_cyb_intptr_t>__cuTexRefSetMipmappedArray + + global __cuTexRefSetAddress_v2 + data["__cuTexRefSetAddress_v2"] = <_cyb_intptr_t>__cuTexRefSetAddress_v2 + + global __cuTexRefSetAddress2D_v3 + data["__cuTexRefSetAddress2D_v3"] = <_cyb_intptr_t>__cuTexRefSetAddress2D_v3 + + global __cuTexRefSetFormat + data["__cuTexRefSetFormat"] = <_cyb_intptr_t>__cuTexRefSetFormat + + global __cuTexRefSetAddressMode + data["__cuTexRefSetAddressMode"] = <_cyb_intptr_t>__cuTexRefSetAddressMode + + global __cuTexRefSetFilterMode + data["__cuTexRefSetFilterMode"] = <_cyb_intptr_t>__cuTexRefSetFilterMode + + global __cuTexRefSetMipmapFilterMode + data["__cuTexRefSetMipmapFilterMode"] = <_cyb_intptr_t>__cuTexRefSetMipmapFilterMode + + global __cuTexRefSetMipmapLevelBias + data["__cuTexRefSetMipmapLevelBias"] = <_cyb_intptr_t>__cuTexRefSetMipmapLevelBias + + global __cuTexRefSetMipmapLevelClamp + data["__cuTexRefSetMipmapLevelClamp"] = <_cyb_intptr_t>__cuTexRefSetMipmapLevelClamp + + global __cuTexRefSetMaxAnisotropy + data["__cuTexRefSetMaxAnisotropy"] = <_cyb_intptr_t>__cuTexRefSetMaxAnisotropy + + global __cuTexRefSetBorderColor + data["__cuTexRefSetBorderColor"] = <_cyb_intptr_t>__cuTexRefSetBorderColor + + global __cuTexRefSetFlags + data["__cuTexRefSetFlags"] = <_cyb_intptr_t>__cuTexRefSetFlags + + global __cuTexRefGetAddress_v2 + data["__cuTexRefGetAddress_v2"] = <_cyb_intptr_t>__cuTexRefGetAddress_v2 + + global __cuTexRefGetArray + data["__cuTexRefGetArray"] = <_cyb_intptr_t>__cuTexRefGetArray + + global __cuTexRefGetMipmappedArray + data["__cuTexRefGetMipmappedArray"] = <_cyb_intptr_t>__cuTexRefGetMipmappedArray + + global __cuTexRefGetAddressMode + data["__cuTexRefGetAddressMode"] = <_cyb_intptr_t>__cuTexRefGetAddressMode + + global __cuTexRefGetFilterMode + data["__cuTexRefGetFilterMode"] = <_cyb_intptr_t>__cuTexRefGetFilterMode + + global __cuTexRefGetFormat + data["__cuTexRefGetFormat"] = <_cyb_intptr_t>__cuTexRefGetFormat + + global __cuTexRefGetMipmapFilterMode + data["__cuTexRefGetMipmapFilterMode"] = <_cyb_intptr_t>__cuTexRefGetMipmapFilterMode + + global __cuTexRefGetMipmapLevelBias + data["__cuTexRefGetMipmapLevelBias"] = <_cyb_intptr_t>__cuTexRefGetMipmapLevelBias + + global __cuTexRefGetMipmapLevelClamp + data["__cuTexRefGetMipmapLevelClamp"] = <_cyb_intptr_t>__cuTexRefGetMipmapLevelClamp + + global __cuTexRefGetMaxAnisotropy + data["__cuTexRefGetMaxAnisotropy"] = <_cyb_intptr_t>__cuTexRefGetMaxAnisotropy + + global __cuTexRefGetBorderColor + data["__cuTexRefGetBorderColor"] = <_cyb_intptr_t>__cuTexRefGetBorderColor + + global __cuTexRefGetFlags + data["__cuTexRefGetFlags"] = <_cyb_intptr_t>__cuTexRefGetFlags + + global __cuTexRefCreate + data["__cuTexRefCreate"] = <_cyb_intptr_t>__cuTexRefCreate + + global __cuTexRefDestroy + data["__cuTexRefDestroy"] = <_cyb_intptr_t>__cuTexRefDestroy + + global __cuSurfRefSetArray + data["__cuSurfRefSetArray"] = <_cyb_intptr_t>__cuSurfRefSetArray + + global __cuSurfRefGetArray + data["__cuSurfRefGetArray"] = <_cyb_intptr_t>__cuSurfRefGetArray + + global __cuTexObjectCreate + data["__cuTexObjectCreate"] = <_cyb_intptr_t>__cuTexObjectCreate + + global __cuTexObjectDestroy + data["__cuTexObjectDestroy"] = <_cyb_intptr_t>__cuTexObjectDestroy + + global __cuTexObjectGetResourceDesc + data["__cuTexObjectGetResourceDesc"] = <_cyb_intptr_t>__cuTexObjectGetResourceDesc + + global __cuTexObjectGetTextureDesc + data["__cuTexObjectGetTextureDesc"] = <_cyb_intptr_t>__cuTexObjectGetTextureDesc + + global __cuTexObjectGetResourceViewDesc + data["__cuTexObjectGetResourceViewDesc"] = <_cyb_intptr_t>__cuTexObjectGetResourceViewDesc + + global __cuSurfObjectCreate + data["__cuSurfObjectCreate"] = <_cyb_intptr_t>__cuSurfObjectCreate + + global __cuSurfObjectDestroy + data["__cuSurfObjectDestroy"] = <_cyb_intptr_t>__cuSurfObjectDestroy + + global __cuSurfObjectGetResourceDesc + data["__cuSurfObjectGetResourceDesc"] = <_cyb_intptr_t>__cuSurfObjectGetResourceDesc + + global __cuTensorMapEncodeTiled + data["__cuTensorMapEncodeTiled"] = <_cyb_intptr_t>__cuTensorMapEncodeTiled + + global __cuTensorMapEncodeIm2col + data["__cuTensorMapEncodeIm2col"] = <_cyb_intptr_t>__cuTensorMapEncodeIm2col + + global __cuTensorMapEncodeIm2colWide + data["__cuTensorMapEncodeIm2colWide"] = <_cyb_intptr_t>__cuTensorMapEncodeIm2colWide + + global __cuTensorMapReplaceAddress + data["__cuTensorMapReplaceAddress"] = <_cyb_intptr_t>__cuTensorMapReplaceAddress + + global __cuDeviceCanAccessPeer + data["__cuDeviceCanAccessPeer"] = <_cyb_intptr_t>__cuDeviceCanAccessPeer + + global __cuCtxEnablePeerAccess + data["__cuCtxEnablePeerAccess"] = <_cyb_intptr_t>__cuCtxEnablePeerAccess + + global __cuCtxDisablePeerAccess + data["__cuCtxDisablePeerAccess"] = <_cyb_intptr_t>__cuCtxDisablePeerAccess + + global __cuDeviceGetP2PAttribute + data["__cuDeviceGetP2PAttribute"] = <_cyb_intptr_t>__cuDeviceGetP2PAttribute + + global __cuGraphicsUnregisterResource + data["__cuGraphicsUnregisterResource"] = <_cyb_intptr_t>__cuGraphicsUnregisterResource + + global __cuGraphicsSubResourceGetMappedArray + data["__cuGraphicsSubResourceGetMappedArray"] = <_cyb_intptr_t>__cuGraphicsSubResourceGetMappedArray + + global __cuGraphicsResourceGetMappedMipmappedArray + data["__cuGraphicsResourceGetMappedMipmappedArray"] = <_cyb_intptr_t>__cuGraphicsResourceGetMappedMipmappedArray + + global __cuGraphicsResourceGetMappedPointer_v2 + data["__cuGraphicsResourceGetMappedPointer_v2"] = <_cyb_intptr_t>__cuGraphicsResourceGetMappedPointer_v2 + + global __cuGraphicsResourceSetMapFlags_v2 + data["__cuGraphicsResourceSetMapFlags_v2"] = <_cyb_intptr_t>__cuGraphicsResourceSetMapFlags_v2 + + global __cuGraphicsMapResources + data["__cuGraphicsMapResources"] = <_cyb_intptr_t>__cuGraphicsMapResources + + global __cuGraphicsUnmapResources + data["__cuGraphicsUnmapResources"] = <_cyb_intptr_t>__cuGraphicsUnmapResources + + global __cuGetProcAddress_v2 + data["__cuGetProcAddress_v2"] = <_cyb_intptr_t>__cuGetProcAddress_v2 + + global __cuCoredumpGetAttribute + data["__cuCoredumpGetAttribute"] = <_cyb_intptr_t>__cuCoredumpGetAttribute + + global __cuCoredumpGetAttributeGlobal + data["__cuCoredumpGetAttributeGlobal"] = <_cyb_intptr_t>__cuCoredumpGetAttributeGlobal + + global __cuCoredumpSetAttribute + data["__cuCoredumpSetAttribute"] = <_cyb_intptr_t>__cuCoredumpSetAttribute + + global __cuCoredumpSetAttributeGlobal + data["__cuCoredumpSetAttributeGlobal"] = <_cyb_intptr_t>__cuCoredumpSetAttributeGlobal + + global __cuGetExportTable + data["__cuGetExportTable"] = <_cyb_intptr_t>__cuGetExportTable + + global __cuGreenCtxCreate + data["__cuGreenCtxCreate"] = <_cyb_intptr_t>__cuGreenCtxCreate + + global __cuGreenCtxDestroy + data["__cuGreenCtxDestroy"] = <_cyb_intptr_t>__cuGreenCtxDestroy + + global __cuCtxFromGreenCtx + data["__cuCtxFromGreenCtx"] = <_cyb_intptr_t>__cuCtxFromGreenCtx + + global __cuDeviceGetDevResource + data["__cuDeviceGetDevResource"] = <_cyb_intptr_t>__cuDeviceGetDevResource + + global __cuCtxGetDevResource + data["__cuCtxGetDevResource"] = <_cyb_intptr_t>__cuCtxGetDevResource + + global __cuGreenCtxGetDevResource + data["__cuGreenCtxGetDevResource"] = <_cyb_intptr_t>__cuGreenCtxGetDevResource + + global __cuDevSmResourceSplitByCount + data["__cuDevSmResourceSplitByCount"] = <_cyb_intptr_t>__cuDevSmResourceSplitByCount + + global __cuDevResourceGenerateDesc + data["__cuDevResourceGenerateDesc"] = <_cyb_intptr_t>__cuDevResourceGenerateDesc + + global __cuGreenCtxRecordEvent + data["__cuGreenCtxRecordEvent"] = <_cyb_intptr_t>__cuGreenCtxRecordEvent + + global __cuGreenCtxWaitEvent + data["__cuGreenCtxWaitEvent"] = <_cyb_intptr_t>__cuGreenCtxWaitEvent + + global __cuStreamGetGreenCtx + data["__cuStreamGetGreenCtx"] = <_cyb_intptr_t>__cuStreamGetGreenCtx + + global __cuGreenCtxStreamCreate + data["__cuGreenCtxStreamCreate"] = <_cyb_intptr_t>__cuGreenCtxStreamCreate + + global __cuLogsRegisterCallback + data["__cuLogsRegisterCallback"] = <_cyb_intptr_t>__cuLogsRegisterCallback + + global __cuLogsUnregisterCallback + data["__cuLogsUnregisterCallback"] = <_cyb_intptr_t>__cuLogsUnregisterCallback + + global __cuLogsCurrent + data["__cuLogsCurrent"] = <_cyb_intptr_t>__cuLogsCurrent + + global __cuLogsDumpToFile + data["__cuLogsDumpToFile"] = <_cyb_intptr_t>__cuLogsDumpToFile + + global __cuLogsDumpToMemory + data["__cuLogsDumpToMemory"] = <_cyb_intptr_t>__cuLogsDumpToMemory + + global __cuCheckpointProcessGetRestoreThreadId + data["__cuCheckpointProcessGetRestoreThreadId"] = <_cyb_intptr_t>__cuCheckpointProcessGetRestoreThreadId + + global __cuCheckpointProcessGetState + data["__cuCheckpointProcessGetState"] = <_cyb_intptr_t>__cuCheckpointProcessGetState + + global __cuCheckpointProcessLock + data["__cuCheckpointProcessLock"] = <_cyb_intptr_t>__cuCheckpointProcessLock + + global __cuCheckpointProcessCheckpoint + data["__cuCheckpointProcessCheckpoint"] = <_cyb_intptr_t>__cuCheckpointProcessCheckpoint + + global __cuCheckpointProcessRestore + data["__cuCheckpointProcessRestore"] = <_cyb_intptr_t>__cuCheckpointProcessRestore + + global __cuCheckpointProcessUnlock + data["__cuCheckpointProcessUnlock"] = <_cyb_intptr_t>__cuCheckpointProcessUnlock + + global __cuGraphicsEGLRegisterImage + data["__cuGraphicsEGLRegisterImage"] = <_cyb_intptr_t>__cuGraphicsEGLRegisterImage + + global __cuEGLStreamConsumerConnect + data["__cuEGLStreamConsumerConnect"] = <_cyb_intptr_t>__cuEGLStreamConsumerConnect + + global __cuEGLStreamConsumerConnectWithFlags + data["__cuEGLStreamConsumerConnectWithFlags"] = <_cyb_intptr_t>__cuEGLStreamConsumerConnectWithFlags + + global __cuEGLStreamConsumerDisconnect + data["__cuEGLStreamConsumerDisconnect"] = <_cyb_intptr_t>__cuEGLStreamConsumerDisconnect + + global __cuEGLStreamConsumerAcquireFrame + data["__cuEGLStreamConsumerAcquireFrame"] = <_cyb_intptr_t>__cuEGLStreamConsumerAcquireFrame + + global __cuEGLStreamConsumerReleaseFrame + data["__cuEGLStreamConsumerReleaseFrame"] = <_cyb_intptr_t>__cuEGLStreamConsumerReleaseFrame + + global __cuEGLStreamProducerConnect + data["__cuEGLStreamProducerConnect"] = <_cyb_intptr_t>__cuEGLStreamProducerConnect + + global __cuEGLStreamProducerDisconnect + data["__cuEGLStreamProducerDisconnect"] = <_cyb_intptr_t>__cuEGLStreamProducerDisconnect + + global __cuEGLStreamProducerPresentFrame + data["__cuEGLStreamProducerPresentFrame"] = <_cyb_intptr_t>__cuEGLStreamProducerPresentFrame + + global __cuEGLStreamProducerReturnFrame + data["__cuEGLStreamProducerReturnFrame"] = <_cyb_intptr_t>__cuEGLStreamProducerReturnFrame + + global __cuGraphicsResourceGetMappedEglFrame + data["__cuGraphicsResourceGetMappedEglFrame"] = <_cyb_intptr_t>__cuGraphicsResourceGetMappedEglFrame + + global __cuEventCreateFromEGLSync + data["__cuEventCreateFromEGLSync"] = <_cyb_intptr_t>__cuEventCreateFromEGLSync + + global __cuGraphicsGLRegisterBuffer + data["__cuGraphicsGLRegisterBuffer"] = <_cyb_intptr_t>__cuGraphicsGLRegisterBuffer + + global __cuGraphicsGLRegisterImage + data["__cuGraphicsGLRegisterImage"] = <_cyb_intptr_t>__cuGraphicsGLRegisterImage + + global __cuGLGetDevices_v2 + data["__cuGLGetDevices_v2"] = <_cyb_intptr_t>__cuGLGetDevices_v2 + + global __cuGLCtxCreate_v2 + data["__cuGLCtxCreate_v2"] = <_cyb_intptr_t>__cuGLCtxCreate_v2 + + global __cuGLInit + data["__cuGLInit"] = <_cyb_intptr_t>__cuGLInit + + global __cuGLRegisterBufferObject + data["__cuGLRegisterBufferObject"] = <_cyb_intptr_t>__cuGLRegisterBufferObject + + global __cuGLMapBufferObject_v2 + data["__cuGLMapBufferObject_v2"] = <_cyb_intptr_t>__cuGLMapBufferObject_v2 + + global __cuGLUnmapBufferObject + data["__cuGLUnmapBufferObject"] = <_cyb_intptr_t>__cuGLUnmapBufferObject + + global __cuGLUnregisterBufferObject + data["__cuGLUnregisterBufferObject"] = <_cyb_intptr_t>__cuGLUnregisterBufferObject + + global __cuGLSetBufferObjectMapFlags + data["__cuGLSetBufferObjectMapFlags"] = <_cyb_intptr_t>__cuGLSetBufferObjectMapFlags + + global __cuGLMapBufferObjectAsync_v2 + data["__cuGLMapBufferObjectAsync_v2"] = <_cyb_intptr_t>__cuGLMapBufferObjectAsync_v2 + + global __cuGLUnmapBufferObjectAsync + data["__cuGLUnmapBufferObjectAsync"] = <_cyb_intptr_t>__cuGLUnmapBufferObjectAsync + + global __cuProfilerInitialize + data["__cuProfilerInitialize"] = <_cyb_intptr_t>__cuProfilerInitialize + + global __cuProfilerStart + data["__cuProfilerStart"] = <_cyb_intptr_t>__cuProfilerStart + + global __cuProfilerStop + data["__cuProfilerStop"] = <_cyb_intptr_t>__cuProfilerStop + + global __cuVDPAUGetDevice + data["__cuVDPAUGetDevice"] = <_cyb_intptr_t>__cuVDPAUGetDevice + + global __cuVDPAUCtxCreate_v2 + data["__cuVDPAUCtxCreate_v2"] = <_cyb_intptr_t>__cuVDPAUCtxCreate_v2 + + global __cuGraphicsVDPAURegisterVideoSurface + data["__cuGraphicsVDPAURegisterVideoSurface"] = <_cyb_intptr_t>__cuGraphicsVDPAURegisterVideoSurface + + global __cuGraphicsVDPAURegisterOutputSurface + data["__cuGraphicsVDPAURegisterOutputSurface"] = <_cyb_intptr_t>__cuGraphicsVDPAURegisterOutputSurface + + global __cuDeviceGetHostAtomicCapabilities + data["__cuDeviceGetHostAtomicCapabilities"] = <_cyb_intptr_t>__cuDeviceGetHostAtomicCapabilities + + global __cuCtxGetDevice_v2 + data["__cuCtxGetDevice_v2"] = <_cyb_intptr_t>__cuCtxGetDevice_v2 + + global __cuCtxSynchronize_v2 + data["__cuCtxSynchronize_v2"] = <_cyb_intptr_t>__cuCtxSynchronize_v2 + + global __cuMemcpyBatchAsync_v2 + data["__cuMemcpyBatchAsync_v2"] = <_cyb_intptr_t>__cuMemcpyBatchAsync_v2 + + global __cuMemcpy3DBatchAsync_v2 + data["__cuMemcpy3DBatchAsync_v2"] = <_cyb_intptr_t>__cuMemcpy3DBatchAsync_v2 + + global __cuMemGetDefaultMemPool + data["__cuMemGetDefaultMemPool"] = <_cyb_intptr_t>__cuMemGetDefaultMemPool + + global __cuMemGetMemPool + data["__cuMemGetMemPool"] = <_cyb_intptr_t>__cuMemGetMemPool + + global __cuMemSetMemPool + data["__cuMemSetMemPool"] = <_cyb_intptr_t>__cuMemSetMemPool + + global __cuMemPrefetchBatchAsync + data["__cuMemPrefetchBatchAsync"] = <_cyb_intptr_t>__cuMemPrefetchBatchAsync + + global __cuMemDiscardBatchAsync + data["__cuMemDiscardBatchAsync"] = <_cyb_intptr_t>__cuMemDiscardBatchAsync + + global __cuMemDiscardAndPrefetchBatchAsync + data["__cuMemDiscardAndPrefetchBatchAsync"] = <_cyb_intptr_t>__cuMemDiscardAndPrefetchBatchAsync + + global __cuDeviceGetP2PAtomicCapabilities + data["__cuDeviceGetP2PAtomicCapabilities"] = <_cyb_intptr_t>__cuDeviceGetP2PAtomicCapabilities + + global __cuGreenCtxGetId + data["__cuGreenCtxGetId"] = <_cyb_intptr_t>__cuGreenCtxGetId + + global __cuMulticastBindMem_v2 + data["__cuMulticastBindMem_v2"] = <_cyb_intptr_t>__cuMulticastBindMem_v2 + + global __cuMulticastBindAddr_v2 + data["__cuMulticastBindAddr_v2"] = <_cyb_intptr_t>__cuMulticastBindAddr_v2 + + global __cuGraphNodeGetContainingGraph + data["__cuGraphNodeGetContainingGraph"] = <_cyb_intptr_t>__cuGraphNodeGetContainingGraph + + global __cuGraphNodeGetLocalId + data["__cuGraphNodeGetLocalId"] = <_cyb_intptr_t>__cuGraphNodeGetLocalId + + global __cuGraphNodeGetToolsId + data["__cuGraphNodeGetToolsId"] = <_cyb_intptr_t>__cuGraphNodeGetToolsId + + global __cuGraphGetId + data["__cuGraphGetId"] = <_cyb_intptr_t>__cuGraphGetId + + global __cuGraphExecGetId + data["__cuGraphExecGetId"] = <_cyb_intptr_t>__cuGraphExecGetId + + global __cuDevSmResourceSplit + data["__cuDevSmResourceSplit"] = <_cyb_intptr_t>__cuDevSmResourceSplit + + global __cuStreamGetDevResource + data["__cuStreamGetDevResource"] = <_cyb_intptr_t>__cuStreamGetDevResource + + global __cuKernelGetParamCount + data["__cuKernelGetParamCount"] = <_cyb_intptr_t>__cuKernelGetParamCount + + global __cuMemcpyWithAttributesAsync + data["__cuMemcpyWithAttributesAsync"] = <_cyb_intptr_t>__cuMemcpyWithAttributesAsync + + global __cuMemcpy3DWithAttributesAsync + data["__cuMemcpy3DWithAttributesAsync"] = <_cyb_intptr_t>__cuMemcpy3DWithAttributesAsync + + global __cuStreamBeginCaptureToCig + data["__cuStreamBeginCaptureToCig"] = <_cyb_intptr_t>__cuStreamBeginCaptureToCig + + global __cuStreamEndCaptureToCig + data["__cuStreamEndCaptureToCig"] = <_cyb_intptr_t>__cuStreamEndCaptureToCig + + global __cuFuncGetParamCount + data["__cuFuncGetParamCount"] = <_cyb_intptr_t>__cuFuncGetParamCount + + global __cuLaunchHostFunc_v2 + data["__cuLaunchHostFunc_v2"] = <_cyb_intptr_t>__cuLaunchHostFunc_v2 + + global __cuGraphNodeGetParams + data["__cuGraphNodeGetParams"] = <_cyb_intptr_t>__cuGraphNodeGetParams + + global __cuCoredumpRegisterStartCallback + data["__cuCoredumpRegisterStartCallback"] = <_cyb_intptr_t>__cuCoredumpRegisterStartCallback + + global __cuCoredumpRegisterCompleteCallback + data["__cuCoredumpRegisterCompleteCallback"] = <_cyb_intptr_t>__cuCoredumpRegisterCompleteCallback + + global __cuCoredumpDeregisterStartCallback + data["__cuCoredumpDeregisterStartCallback"] = <_cyb_intptr_t>__cuCoredumpDeregisterStartCallback + + global __cuCoredumpDeregisterCompleteCallback + data["__cuCoredumpDeregisterCompleteCallback"] = <_cyb_intptr_t>__cuCoredumpDeregisterCompleteCallback + + global __cuLogicalEndpointIdReserve + data["__cuLogicalEndpointIdReserve"] = <_cyb_intptr_t>__cuLogicalEndpointIdReserve + + global __cuLogicalEndpointIdRelease + data["__cuLogicalEndpointIdRelease"] = <_cyb_intptr_t>__cuLogicalEndpointIdRelease + + global __cuLogicalEndpointCreate + data["__cuLogicalEndpointCreate"] = <_cyb_intptr_t>__cuLogicalEndpointCreate + + global __cuLogicalEndpointAddDevice + data["__cuLogicalEndpointAddDevice"] = <_cyb_intptr_t>__cuLogicalEndpointAddDevice + + global __cuLogicalEndpointDestroy + data["__cuLogicalEndpointDestroy"] = <_cyb_intptr_t>__cuLogicalEndpointDestroy + + global __cuLogicalEndpointBindAddr + data["__cuLogicalEndpointBindAddr"] = <_cyb_intptr_t>__cuLogicalEndpointBindAddr + + global __cuLogicalEndpointBindMem + data["__cuLogicalEndpointBindMem"] = <_cyb_intptr_t>__cuLogicalEndpointBindMem + + global __cuLogicalEndpointUnbind + data["__cuLogicalEndpointUnbind"] = <_cyb_intptr_t>__cuLogicalEndpointUnbind + + global __cuLogicalEndpointExport + data["__cuLogicalEndpointExport"] = <_cyb_intptr_t>__cuLogicalEndpointExport + + global __cuLogicalEndpointImport + data["__cuLogicalEndpointImport"] = <_cyb_intptr_t>__cuLogicalEndpointImport + + global __cuLogicalEndpointGetLimits + data["__cuLogicalEndpointGetLimits"] = <_cyb_intptr_t>__cuLogicalEndpointGetLimits + + global __cuLogicalEndpointQuery + data["__cuLogicalEndpointQuery"] = <_cyb_intptr_t>__cuLogicalEndpointQuery + + global __cuStreamBeginRecaptureToGraph + data["__cuStreamBeginRecaptureToGraph"] = <_cyb_intptr_t>__cuStreamBeginRecaptureToGraph + _cyb_func_ptrs = data + return data + + +cpdef _inspect_function_pointer(str name): + global _cyb_func_ptrs + if _cyb_func_ptrs is None: + _cyb_func_ptrs = _inspect_function_pointers() + return _cyb_func_ptrs[name] + + + + +cdef uintptr_t load_library() except* with gil: + cdef uintptr_t handle = load_nvidia_dynamic_lib("cuda")._handle_uint + return handle + + +############################################################################### +# Wrapper functions +############################################################################### + +cdef CUresult _cuGetErrorString(CUresult error, const char** pStr) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGetErrorString + _check_or_init_driver() + if __cuGetErrorString == NULL: + with gil: + raise FunctionNotFoundError("function cuGetErrorString is not found") + return (__cuGetErrorString)( + error, pStr) + + +cdef CUresult _cuGetErrorName(CUresult error, const char** pStr) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGetErrorName + _check_or_init_driver() + if __cuGetErrorName == NULL: + with gil: + raise FunctionNotFoundError("function cuGetErrorName is not found") + return (__cuGetErrorName)( + error, pStr) + + +cdef CUresult _cuInit(unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuInit + _check_or_init_driver() + if __cuInit == NULL: + with gil: + raise FunctionNotFoundError("function cuInit is not found") + return (__cuInit)( + Flags) + + +cdef CUresult _cuDriverGetVersion(int* driverVersion) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDriverGetVersion + _check_or_init_driver() + if __cuDriverGetVersion == NULL: + with gil: + raise FunctionNotFoundError("function cuDriverGetVersion is not found") + return (__cuDriverGetVersion)( + driverVersion) + + +cdef CUresult _cuDeviceGet(CUdevice* device, int ordinal) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDeviceGet + _check_or_init_driver() + if __cuDeviceGet == NULL: + with gil: + raise FunctionNotFoundError("function cuDeviceGet is not found") + return (__cuDeviceGet)( + device, ordinal) + + +cdef CUresult _cuDeviceGetCount(int* count) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDeviceGetCount + _check_or_init_driver() + if __cuDeviceGetCount == NULL: + with gil: + raise FunctionNotFoundError("function cuDeviceGetCount is not found") + return (__cuDeviceGetCount)( + count) + + +cdef CUresult _cuDeviceGetName(char* name, int len, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDeviceGetName + _check_or_init_driver() + if __cuDeviceGetName == NULL: + with gil: + raise FunctionNotFoundError("function cuDeviceGetName is not found") + return (__cuDeviceGetName)( + name, len, dev) + + +cdef CUresult _cuDeviceGetUuid_v2(CUuuid* uuid, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDeviceGetUuid_v2 + _check_or_init_driver() + if __cuDeviceGetUuid_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuDeviceGetUuid_v2 is not found") + return (__cuDeviceGetUuid_v2)( + uuid, dev) + + +cdef CUresult _cuDeviceGetLuid(char* luid, unsigned int* deviceNodeMask, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDeviceGetLuid + _check_or_init_driver() + if __cuDeviceGetLuid == NULL: + with gil: + raise FunctionNotFoundError("function cuDeviceGetLuid is not found") + return (__cuDeviceGetLuid)( + luid, deviceNodeMask, dev) + + +cdef CUresult _cuDeviceTotalMem_v2(size_t* bytes, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDeviceTotalMem_v2 + _check_or_init_driver() + if __cuDeviceTotalMem_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuDeviceTotalMem_v2 is not found") + return (__cuDeviceTotalMem_v2)( + bytes, dev) + + +cdef CUresult _cuDeviceGetTexture1DLinearMaxWidth(size_t* maxWidthInElements, CUarray_format format, unsigned numChannels, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDeviceGetTexture1DLinearMaxWidth + _check_or_init_driver() + if __cuDeviceGetTexture1DLinearMaxWidth == NULL: + with gil: + raise FunctionNotFoundError("function cuDeviceGetTexture1DLinearMaxWidth is not found") + return (__cuDeviceGetTexture1DLinearMaxWidth)( + maxWidthInElements, format, numChannels, dev) + + +cdef CUresult _cuDeviceGetAttribute(int* pi, CUdevice_attribute attrib, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDeviceGetAttribute + _check_or_init_driver() + if __cuDeviceGetAttribute == NULL: + with gil: + raise FunctionNotFoundError("function cuDeviceGetAttribute is not found") + return (__cuDeviceGetAttribute)( + pi, attrib, dev) + + +cdef CUresult _cuDeviceGetNvSciSyncAttributes(void* nvSciSyncAttrList, CUdevice dev, int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDeviceGetNvSciSyncAttributes + _check_or_init_driver() + if __cuDeviceGetNvSciSyncAttributes == NULL: + with gil: + raise FunctionNotFoundError("function cuDeviceGetNvSciSyncAttributes is not found") + return (__cuDeviceGetNvSciSyncAttributes)( + nvSciSyncAttrList, dev, flags) + + +cdef CUresult _cuDeviceSetMemPool(CUdevice dev, CUmemoryPool pool) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDeviceSetMemPool + _check_or_init_driver() + if __cuDeviceSetMemPool == NULL: + with gil: + raise FunctionNotFoundError("function cuDeviceSetMemPool is not found") + return (__cuDeviceSetMemPool)( + dev, pool) + + +cdef CUresult _cuDeviceGetMemPool(CUmemoryPool* pool, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDeviceGetMemPool + _check_or_init_driver() + if __cuDeviceGetMemPool == NULL: + with gil: + raise FunctionNotFoundError("function cuDeviceGetMemPool is not found") + return (__cuDeviceGetMemPool)( + pool, dev) + + +cdef CUresult _cuDeviceGetDefaultMemPool(CUmemoryPool* pool_out, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDeviceGetDefaultMemPool + _check_or_init_driver() + if __cuDeviceGetDefaultMemPool == NULL: + with gil: + raise FunctionNotFoundError("function cuDeviceGetDefaultMemPool is not found") + return (__cuDeviceGetDefaultMemPool)( + pool_out, dev) + + +cdef CUresult _cuDeviceGetExecAffinitySupport(int* pi, CUexecAffinityType type, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDeviceGetExecAffinitySupport + _check_or_init_driver() + if __cuDeviceGetExecAffinitySupport == NULL: + with gil: + raise FunctionNotFoundError("function cuDeviceGetExecAffinitySupport is not found") + return (__cuDeviceGetExecAffinitySupport)( + pi, type, dev) + + +cdef CUresult _cuFlushGPUDirectRDMAWrites(CUflushGPUDirectRDMAWritesTarget target, CUflushGPUDirectRDMAWritesScope scope) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuFlushGPUDirectRDMAWrites + _check_or_init_driver() + if __cuFlushGPUDirectRDMAWrites == NULL: + with gil: + raise FunctionNotFoundError("function cuFlushGPUDirectRDMAWrites is not found") + return (__cuFlushGPUDirectRDMAWrites)( + target, scope) + + +cdef CUresult _cuDeviceGetProperties(CUdevprop* prop, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDeviceGetProperties + _check_or_init_driver() + if __cuDeviceGetProperties == NULL: + with gil: + raise FunctionNotFoundError("function cuDeviceGetProperties is not found") + return (__cuDeviceGetProperties)( + prop, dev) + + +cdef CUresult _cuDeviceComputeCapability(int* major, int* minor, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDeviceComputeCapability + _check_or_init_driver() + if __cuDeviceComputeCapability == NULL: + with gil: + raise FunctionNotFoundError("function cuDeviceComputeCapability is not found") + return (__cuDeviceComputeCapability)( + major, minor, dev) + + +cdef CUresult _cuDevicePrimaryCtxRetain(CUcontext* pctx, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDevicePrimaryCtxRetain + _check_or_init_driver() + if __cuDevicePrimaryCtxRetain == NULL: + with gil: + raise FunctionNotFoundError("function cuDevicePrimaryCtxRetain is not found") + return (__cuDevicePrimaryCtxRetain)( + pctx, dev) + + +cdef CUresult _cuDevicePrimaryCtxRelease_v2(CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDevicePrimaryCtxRelease_v2 + _check_or_init_driver() + if __cuDevicePrimaryCtxRelease_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuDevicePrimaryCtxRelease_v2 is not found") + return (__cuDevicePrimaryCtxRelease_v2)( + dev) + + +cdef CUresult _cuDevicePrimaryCtxSetFlags_v2(CUdevice dev, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDevicePrimaryCtxSetFlags_v2 + _check_or_init_driver() + if __cuDevicePrimaryCtxSetFlags_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuDevicePrimaryCtxSetFlags_v2 is not found") + return (__cuDevicePrimaryCtxSetFlags_v2)( + dev, flags) + + +cdef CUresult _cuDevicePrimaryCtxGetState(CUdevice dev, unsigned int* flags, int* active) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDevicePrimaryCtxGetState + _check_or_init_driver() + if __cuDevicePrimaryCtxGetState == NULL: + with gil: + raise FunctionNotFoundError("function cuDevicePrimaryCtxGetState is not found") + return (__cuDevicePrimaryCtxGetState)( + dev, flags, active) + + +cdef CUresult _cuDevicePrimaryCtxReset_v2(CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDevicePrimaryCtxReset_v2 + _check_or_init_driver() + if __cuDevicePrimaryCtxReset_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuDevicePrimaryCtxReset_v2 is not found") + return (__cuDevicePrimaryCtxReset_v2)( + dev) + + +cdef CUresult _cuCtxCreate_v2(CUcontext* pctx, unsigned int flags, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxCreate_v2 + _check_or_init_driver() + if __cuCtxCreate_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxCreate_v2 is not found") + return (__cuCtxCreate_v2)( + pctx, flags, dev) + + +cdef CUresult _cuCtxCreate_v3(CUcontext* pctx, CUexecAffinityParam* paramsArray, int numParams, unsigned int flags, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxCreate_v3 + _check_or_init_driver() + if __cuCtxCreate_v3 == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxCreate_v3 is not found") + return (__cuCtxCreate_v3)( + pctx, paramsArray, numParams, flags, dev) + + +cdef CUresult _cuCtxCreate_v4(CUcontext* pctx, CUctxCreateParams* ctxCreateParams, unsigned int flags, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxCreate_v4 + _check_or_init_driver() + if __cuCtxCreate_v4 == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxCreate_v4 is not found") + return (__cuCtxCreate_v4)( + pctx, ctxCreateParams, flags, dev) + + +cdef CUresult _cuCtxDestroy_v2(CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxDestroy_v2 + _check_or_init_driver() + if __cuCtxDestroy_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxDestroy_v2 is not found") + return (__cuCtxDestroy_v2)( + ctx) + + +cdef CUresult _cuCtxPushCurrent_v2(CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxPushCurrent_v2 + _check_or_init_driver() + if __cuCtxPushCurrent_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxPushCurrent_v2 is not found") + return (__cuCtxPushCurrent_v2)( + ctx) + + +cdef CUresult _cuCtxPopCurrent_v2(CUcontext* pctx) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxPopCurrent_v2 + _check_or_init_driver() + if __cuCtxPopCurrent_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxPopCurrent_v2 is not found") + return (__cuCtxPopCurrent_v2)( + pctx) + + +cdef CUresult _cuCtxSetCurrent(CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxSetCurrent + _check_or_init_driver() + if __cuCtxSetCurrent == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxSetCurrent is not found") + return (__cuCtxSetCurrent)( + ctx) + + +cdef CUresult _cuCtxGetCurrent(CUcontext* pctx) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxGetCurrent + _check_or_init_driver() + if __cuCtxGetCurrent == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxGetCurrent is not found") + return (__cuCtxGetCurrent)( + pctx) + + +cdef CUresult _cuCtxGetDevice(CUdevice* device) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxGetDevice + _check_or_init_driver() + if __cuCtxGetDevice == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxGetDevice is not found") + return (__cuCtxGetDevice)( + device) + + +cdef CUresult _cuCtxGetFlags(unsigned int* flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxGetFlags + _check_or_init_driver() + if __cuCtxGetFlags == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxGetFlags is not found") + return (__cuCtxGetFlags)( + flags) + + +cdef CUresult _cuCtxSetFlags(unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxSetFlags + _check_or_init_driver() + if __cuCtxSetFlags == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxSetFlags is not found") + return (__cuCtxSetFlags)( + flags) + + +cdef CUresult _cuCtxGetId(CUcontext ctx, unsigned long long* ctxId) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxGetId + _check_or_init_driver() + if __cuCtxGetId == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxGetId is not found") + return (__cuCtxGetId)( + ctx, ctxId) + + +cdef CUresult _cuCtxSynchronize() except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxSynchronize + _check_or_init_driver() + if __cuCtxSynchronize == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxSynchronize is not found") + return (__cuCtxSynchronize)( + ) + + +cdef CUresult _cuCtxSetLimit(CUlimit limit, size_t value) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxSetLimit + _check_or_init_driver() + if __cuCtxSetLimit == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxSetLimit is not found") + return (__cuCtxSetLimit)( + limit, value) + + +cdef CUresult _cuCtxGetLimit(size_t* pvalue, CUlimit limit) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxGetLimit + _check_or_init_driver() + if __cuCtxGetLimit == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxGetLimit is not found") + return (__cuCtxGetLimit)( + pvalue, limit) + + +cdef CUresult _cuCtxGetCacheConfig(CUfunc_cache* pconfig) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxGetCacheConfig + _check_or_init_driver() + if __cuCtxGetCacheConfig == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxGetCacheConfig is not found") + return (__cuCtxGetCacheConfig)( + pconfig) + + +cdef CUresult _cuCtxSetCacheConfig(CUfunc_cache config) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxSetCacheConfig + _check_or_init_driver() + if __cuCtxSetCacheConfig == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxSetCacheConfig is not found") + return (__cuCtxSetCacheConfig)( + config) + + +cdef CUresult _cuCtxGetApiVersion(CUcontext ctx, unsigned int* version) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxGetApiVersion + _check_or_init_driver() + if __cuCtxGetApiVersion == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxGetApiVersion is not found") + return (__cuCtxGetApiVersion)( + ctx, version) + + +cdef CUresult _cuCtxGetStreamPriorityRange(int* leastPriority, int* greatestPriority) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxGetStreamPriorityRange + _check_or_init_driver() + if __cuCtxGetStreamPriorityRange == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxGetStreamPriorityRange is not found") + return (__cuCtxGetStreamPriorityRange)( + leastPriority, greatestPriority) + + +cdef CUresult _cuCtxResetPersistingL2Cache() except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxResetPersistingL2Cache + _check_or_init_driver() + if __cuCtxResetPersistingL2Cache == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxResetPersistingL2Cache is not found") + return (__cuCtxResetPersistingL2Cache)( + ) + + +cdef CUresult _cuCtxGetExecAffinity(CUexecAffinityParam* pExecAffinity, CUexecAffinityType type) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxGetExecAffinity + _check_or_init_driver() + if __cuCtxGetExecAffinity == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxGetExecAffinity is not found") + return (__cuCtxGetExecAffinity)( + pExecAffinity, type) + + +cdef CUresult _cuCtxRecordEvent(CUcontext hCtx, CUevent hEvent) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxRecordEvent + _check_or_init_driver() + if __cuCtxRecordEvent == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxRecordEvent is not found") + return (__cuCtxRecordEvent)( + hCtx, hEvent) + + +cdef CUresult _cuCtxWaitEvent(CUcontext hCtx, CUevent hEvent) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxWaitEvent + _check_or_init_driver() + if __cuCtxWaitEvent == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxWaitEvent is not found") + return (__cuCtxWaitEvent)( + hCtx, hEvent) + + +cdef CUresult _cuCtxAttach(CUcontext* pctx, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxAttach + _check_or_init_driver() + if __cuCtxAttach == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxAttach is not found") + return (__cuCtxAttach)( + pctx, flags) + + +cdef CUresult _cuCtxDetach(CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxDetach + _check_or_init_driver() + if __cuCtxDetach == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxDetach is not found") + return (__cuCtxDetach)( + ctx) + + +cdef CUresult _cuCtxGetSharedMemConfig(CUsharedconfig* pConfig) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxGetSharedMemConfig + _check_or_init_driver() + if __cuCtxGetSharedMemConfig == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxGetSharedMemConfig is not found") + return (__cuCtxGetSharedMemConfig)( + pConfig) + + +cdef CUresult _cuCtxSetSharedMemConfig(CUsharedconfig config) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxSetSharedMemConfig + _check_or_init_driver() + if __cuCtxSetSharedMemConfig == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxSetSharedMemConfig is not found") + return (__cuCtxSetSharedMemConfig)( + config) + + +cdef CUresult _cuModuleLoad(CUmodule* module, const char* fname) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuModuleLoad + _check_or_init_driver() + if __cuModuleLoad == NULL: + with gil: + raise FunctionNotFoundError("function cuModuleLoad is not found") + return (__cuModuleLoad)( + module, fname) + + +cdef CUresult _cuModuleLoadData(CUmodule* module, const void* image) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuModuleLoadData + _check_or_init_driver() + if __cuModuleLoadData == NULL: + with gil: + raise FunctionNotFoundError("function cuModuleLoadData is not found") + return (__cuModuleLoadData)( + module, image) + + +cdef CUresult _cuModuleLoadDataEx(CUmodule* module, const void* image, unsigned int numOptions, CUjit_option* options, void** optionValues) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuModuleLoadDataEx + _check_or_init_driver() + if __cuModuleLoadDataEx == NULL: + with gil: + raise FunctionNotFoundError("function cuModuleLoadDataEx is not found") + return (__cuModuleLoadDataEx)( + module, image, numOptions, options, optionValues) + + +cdef CUresult _cuModuleLoadFatBinary(CUmodule* module, const void* fatCubin) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuModuleLoadFatBinary + _check_or_init_driver() + if __cuModuleLoadFatBinary == NULL: + with gil: + raise FunctionNotFoundError("function cuModuleLoadFatBinary is not found") + return (__cuModuleLoadFatBinary)( + module, fatCubin) + + +cdef CUresult _cuModuleUnload(CUmodule hmod) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuModuleUnload + _check_or_init_driver() + if __cuModuleUnload == NULL: + with gil: + raise FunctionNotFoundError("function cuModuleUnload is not found") + return (__cuModuleUnload)( + hmod) + + +cdef CUresult _cuModuleGetLoadingMode(CUmoduleLoadingMode* mode) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuModuleGetLoadingMode + _check_or_init_driver() + if __cuModuleGetLoadingMode == NULL: + with gil: + raise FunctionNotFoundError("function cuModuleGetLoadingMode is not found") + return (__cuModuleGetLoadingMode)( + mode) + + +cdef CUresult _cuModuleGetFunction(CUfunction* hfunc, CUmodule hmod, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuModuleGetFunction + _check_or_init_driver() + if __cuModuleGetFunction == NULL: + with gil: + raise FunctionNotFoundError("function cuModuleGetFunction is not found") + return (__cuModuleGetFunction)( + hfunc, hmod, name) + + +cdef CUresult _cuModuleGetFunctionCount(unsigned int* count, CUmodule mod) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuModuleGetFunctionCount + _check_or_init_driver() + if __cuModuleGetFunctionCount == NULL: + with gil: + raise FunctionNotFoundError("function cuModuleGetFunctionCount is not found") + return (__cuModuleGetFunctionCount)( + count, mod) + + +cdef CUresult _cuModuleEnumerateFunctions(CUfunction* functions, unsigned int numFunctions, CUmodule mod) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuModuleEnumerateFunctions + _check_or_init_driver() + if __cuModuleEnumerateFunctions == NULL: + with gil: + raise FunctionNotFoundError("function cuModuleEnumerateFunctions is not found") + return (__cuModuleEnumerateFunctions)( + functions, numFunctions, mod) + + +cdef CUresult _cuModuleGetGlobal_v2(CUdeviceptr* dptr, size_t* bytes, CUmodule hmod, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuModuleGetGlobal_v2 + _check_or_init_driver() + if __cuModuleGetGlobal_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuModuleGetGlobal_v2 is not found") + return (__cuModuleGetGlobal_v2)( + dptr, bytes, hmod, name) + + +cdef CUresult _cuLinkCreate_v2(unsigned int numOptions, CUjit_option* options, void** optionValues, CUlinkState* stateOut) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLinkCreate_v2 + _check_or_init_driver() + if __cuLinkCreate_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuLinkCreate_v2 is not found") + return (__cuLinkCreate_v2)( + numOptions, options, optionValues, stateOut) + + +cdef CUresult _cuLinkAddData_v2(CUlinkState state, CUjitInputType type, void* data, size_t size, const char* name, unsigned int numOptions, CUjit_option* options, void** optionValues) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLinkAddData_v2 + _check_or_init_driver() + if __cuLinkAddData_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuLinkAddData_v2 is not found") + return (__cuLinkAddData_v2)( + state, type, data, size, name, numOptions, options, optionValues) + + +cdef CUresult _cuLinkAddFile_v2(CUlinkState state, CUjitInputType type, const char* path, unsigned int numOptions, CUjit_option* options, void** optionValues) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLinkAddFile_v2 + _check_or_init_driver() + if __cuLinkAddFile_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuLinkAddFile_v2 is not found") + return (__cuLinkAddFile_v2)( + state, type, path, numOptions, options, optionValues) + + +cdef CUresult _cuLinkComplete(CUlinkState state, void** cubinOut, size_t* sizeOut) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLinkComplete + _check_or_init_driver() + if __cuLinkComplete == NULL: + with gil: + raise FunctionNotFoundError("function cuLinkComplete is not found") + return (__cuLinkComplete)( + state, cubinOut, sizeOut) + + +cdef CUresult _cuLinkDestroy(CUlinkState state) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLinkDestroy + _check_or_init_driver() + if __cuLinkDestroy == NULL: + with gil: + raise FunctionNotFoundError("function cuLinkDestroy is not found") + return (__cuLinkDestroy)( + state) + + +cdef CUresult _cuModuleGetTexRef(CUtexref* pTexRef, CUmodule hmod, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuModuleGetTexRef + _check_or_init_driver() + if __cuModuleGetTexRef == NULL: + with gil: + raise FunctionNotFoundError("function cuModuleGetTexRef is not found") + return (__cuModuleGetTexRef)( + pTexRef, hmod, name) + + +cdef CUresult _cuModuleGetSurfRef(CUsurfref* pSurfRef, CUmodule hmod, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuModuleGetSurfRef + _check_or_init_driver() + if __cuModuleGetSurfRef == NULL: + with gil: + raise FunctionNotFoundError("function cuModuleGetSurfRef is not found") + return (__cuModuleGetSurfRef)( + pSurfRef, hmod, name) + + +cdef CUresult _cuLibraryLoadData(CUlibrary* library, const void* code, CUjit_option* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, CUlibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLibraryLoadData + _check_or_init_driver() + if __cuLibraryLoadData == NULL: + with gil: + raise FunctionNotFoundError("function cuLibraryLoadData is not found") + return (__cuLibraryLoadData)( + library, code, jitOptions, jitOptionsValues, numJitOptions, libraryOptions, libraryOptionValues, numLibraryOptions) + + +cdef CUresult _cuLibraryLoadFromFile(CUlibrary* library, const char* fileName, CUjit_option* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, CUlibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLibraryLoadFromFile + _check_or_init_driver() + if __cuLibraryLoadFromFile == NULL: + with gil: + raise FunctionNotFoundError("function cuLibraryLoadFromFile is not found") + return (__cuLibraryLoadFromFile)( + library, fileName, jitOptions, jitOptionsValues, numJitOptions, libraryOptions, libraryOptionValues, numLibraryOptions) + + +cdef CUresult _cuLibraryUnload(CUlibrary library) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLibraryUnload + _check_or_init_driver() + if __cuLibraryUnload == NULL: + with gil: + raise FunctionNotFoundError("function cuLibraryUnload is not found") + return (__cuLibraryUnload)( + library) + + +cdef CUresult _cuLibraryGetKernel(CUkernel* pKernel, CUlibrary library, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLibraryGetKernel + _check_or_init_driver() + if __cuLibraryGetKernel == NULL: + with gil: + raise FunctionNotFoundError("function cuLibraryGetKernel is not found") + return (__cuLibraryGetKernel)( + pKernel, library, name) + + +cdef CUresult _cuLibraryGetKernelCount(unsigned int* count, CUlibrary lib) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLibraryGetKernelCount + _check_or_init_driver() + if __cuLibraryGetKernelCount == NULL: + with gil: + raise FunctionNotFoundError("function cuLibraryGetKernelCount is not found") + return (__cuLibraryGetKernelCount)( + count, lib) + + +cdef CUresult _cuLibraryEnumerateKernels(CUkernel* kernels, unsigned int numKernels, CUlibrary lib) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLibraryEnumerateKernels + _check_or_init_driver() + if __cuLibraryEnumerateKernels == NULL: + with gil: + raise FunctionNotFoundError("function cuLibraryEnumerateKernels is not found") + return (__cuLibraryEnumerateKernels)( + kernels, numKernels, lib) + + +cdef CUresult _cuLibraryGetModule(CUmodule* pMod, CUlibrary library) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLibraryGetModule + _check_or_init_driver() + if __cuLibraryGetModule == NULL: + with gil: + raise FunctionNotFoundError("function cuLibraryGetModule is not found") + return (__cuLibraryGetModule)( + pMod, library) + + +cdef CUresult _cuKernelGetFunction(CUfunction* pFunc, CUkernel kernel) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuKernelGetFunction + _check_or_init_driver() + if __cuKernelGetFunction == NULL: + with gil: + raise FunctionNotFoundError("function cuKernelGetFunction is not found") + return (__cuKernelGetFunction)( + pFunc, kernel) + + +cdef CUresult _cuKernelGetLibrary(CUlibrary* pLib, CUkernel kernel) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuKernelGetLibrary + _check_or_init_driver() + if __cuKernelGetLibrary == NULL: + with gil: + raise FunctionNotFoundError("function cuKernelGetLibrary is not found") + return (__cuKernelGetLibrary)( + pLib, kernel) + + +cdef CUresult _cuLibraryGetGlobal(CUdeviceptr* dptr, size_t* bytes, CUlibrary library, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLibraryGetGlobal + _check_or_init_driver() + if __cuLibraryGetGlobal == NULL: + with gil: + raise FunctionNotFoundError("function cuLibraryGetGlobal is not found") + return (__cuLibraryGetGlobal)( + dptr, bytes, library, name) + + +cdef CUresult _cuLibraryGetManaged(CUdeviceptr* dptr, size_t* bytes, CUlibrary library, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLibraryGetManaged + _check_or_init_driver() + if __cuLibraryGetManaged == NULL: + with gil: + raise FunctionNotFoundError("function cuLibraryGetManaged is not found") + return (__cuLibraryGetManaged)( + dptr, bytes, library, name) + + +cdef CUresult _cuLibraryGetUnifiedFunction(void** fptr, CUlibrary library, const char* symbol) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLibraryGetUnifiedFunction + _check_or_init_driver() + if __cuLibraryGetUnifiedFunction == NULL: + with gil: + raise FunctionNotFoundError("function cuLibraryGetUnifiedFunction is not found") + return (__cuLibraryGetUnifiedFunction)( + fptr, library, symbol) + + +cdef CUresult _cuKernelGetAttribute(int* pi, CUfunction_attribute attrib, CUkernel kernel, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuKernelGetAttribute + _check_or_init_driver() + if __cuKernelGetAttribute == NULL: + with gil: + raise FunctionNotFoundError("function cuKernelGetAttribute is not found") + return (__cuKernelGetAttribute)( + pi, attrib, kernel, dev) + + +cdef CUresult _cuKernelSetAttribute(CUfunction_attribute attrib, int val, CUkernel kernel, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuKernelSetAttribute + _check_or_init_driver() + if __cuKernelSetAttribute == NULL: + with gil: + raise FunctionNotFoundError("function cuKernelSetAttribute is not found") + return (__cuKernelSetAttribute)( + attrib, val, kernel, dev) + + +cdef CUresult _cuKernelSetCacheConfig(CUkernel kernel, CUfunc_cache config, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuKernelSetCacheConfig + _check_or_init_driver() + if __cuKernelSetCacheConfig == NULL: + with gil: + raise FunctionNotFoundError("function cuKernelSetCacheConfig is not found") + return (__cuKernelSetCacheConfig)( + kernel, config, dev) + + +cdef CUresult _cuKernelGetName(const char** name, CUkernel hfunc) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuKernelGetName + _check_or_init_driver() + if __cuKernelGetName == NULL: + with gil: + raise FunctionNotFoundError("function cuKernelGetName is not found") + return (__cuKernelGetName)( + name, hfunc) + + +cdef CUresult _cuKernelGetParamInfo(CUkernel kernel, size_t paramIndex, size_t* paramOffset, size_t* paramSize) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuKernelGetParamInfo + _check_or_init_driver() + if __cuKernelGetParamInfo == NULL: + with gil: + raise FunctionNotFoundError("function cuKernelGetParamInfo is not found") + return (__cuKernelGetParamInfo)( + kernel, paramIndex, paramOffset, paramSize) + + +cdef CUresult _cuMemGetInfo_v2(size_t* free, size_t* total) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemGetInfo_v2 + _check_or_init_driver() + if __cuMemGetInfo_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemGetInfo_v2 is not found") + return (__cuMemGetInfo_v2)( + free, total) + + +cdef CUresult _cuMemAlloc_v2(CUdeviceptr* dptr, size_t bytesize) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemAlloc_v2 + _check_or_init_driver() + if __cuMemAlloc_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemAlloc_v2 is not found") + return (__cuMemAlloc_v2)( + dptr, bytesize) + + +cdef CUresult _cuMemAllocPitch_v2(CUdeviceptr* dptr, size_t* pPitch, size_t WidthInBytes, size_t Height, unsigned int ElementSizeBytes) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemAllocPitch_v2 + _check_or_init_driver() + if __cuMemAllocPitch_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemAllocPitch_v2 is not found") + return (__cuMemAllocPitch_v2)( + dptr, pPitch, WidthInBytes, Height, ElementSizeBytes) + + +cdef CUresult _cuMemFree_v2(CUdeviceptr dptr) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemFree_v2 + _check_or_init_driver() + if __cuMemFree_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemFree_v2 is not found") + return (__cuMemFree_v2)( + dptr) + + +cdef CUresult _cuMemGetAddressRange_v2(CUdeviceptr* pbase, size_t* psize, CUdeviceptr dptr) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemGetAddressRange_v2 + _check_or_init_driver() + if __cuMemGetAddressRange_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemGetAddressRange_v2 is not found") + return (__cuMemGetAddressRange_v2)( + pbase, psize, dptr) + + +cdef CUresult _cuMemAllocHost_v2(void** pp, size_t bytesize) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemAllocHost_v2 + _check_or_init_driver() + if __cuMemAllocHost_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemAllocHost_v2 is not found") + return (__cuMemAllocHost_v2)( + pp, bytesize) + + +cdef CUresult _cuMemFreeHost(void* p) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemFreeHost + _check_or_init_driver() + if __cuMemFreeHost == NULL: + with gil: + raise FunctionNotFoundError("function cuMemFreeHost is not found") + return (__cuMemFreeHost)( + p) + + +cdef CUresult _cuMemHostAlloc(void** pp, size_t bytesize, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemHostAlloc + _check_or_init_driver() + if __cuMemHostAlloc == NULL: + with gil: + raise FunctionNotFoundError("function cuMemHostAlloc is not found") + return (__cuMemHostAlloc)( + pp, bytesize, Flags) + + +cdef CUresult _cuMemHostGetDevicePointer_v2(CUdeviceptr* pdptr, void* p, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemHostGetDevicePointer_v2 + _check_or_init_driver() + if __cuMemHostGetDevicePointer_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemHostGetDevicePointer_v2 is not found") + return (__cuMemHostGetDevicePointer_v2)( + pdptr, p, Flags) + + +cdef CUresult _cuMemHostGetFlags(unsigned int* pFlags, void* p) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemHostGetFlags + _check_or_init_driver() + if __cuMemHostGetFlags == NULL: + with gil: + raise FunctionNotFoundError("function cuMemHostGetFlags is not found") + return (__cuMemHostGetFlags)( + pFlags, p) + + +cdef CUresult _cuMemAllocManaged(CUdeviceptr* dptr, size_t bytesize, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemAllocManaged + _check_or_init_driver() + if __cuMemAllocManaged == NULL: + with gil: + raise FunctionNotFoundError("function cuMemAllocManaged is not found") + return (__cuMemAllocManaged)( + dptr, bytesize, flags) + + +cdef CUresult _cuDeviceRegisterAsyncNotification(CUdevice device, CUasyncCallback callbackFunc, void* userData, CUasyncCallbackHandle* callback) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDeviceRegisterAsyncNotification + _check_or_init_driver() + if __cuDeviceRegisterAsyncNotification == NULL: + with gil: + raise FunctionNotFoundError("function cuDeviceRegisterAsyncNotification is not found") + return (__cuDeviceRegisterAsyncNotification)( + device, callbackFunc, userData, callback) + + +cdef CUresult _cuDeviceUnregisterAsyncNotification(CUdevice device, CUasyncCallbackHandle callback) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDeviceUnregisterAsyncNotification + _check_or_init_driver() + if __cuDeviceUnregisterAsyncNotification == NULL: + with gil: + raise FunctionNotFoundError("function cuDeviceUnregisterAsyncNotification is not found") + return (__cuDeviceUnregisterAsyncNotification)( + device, callback) + + +cdef CUresult _cuDeviceGetByPCIBusId(CUdevice* dev, const char* pciBusId) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDeviceGetByPCIBusId + _check_or_init_driver() + if __cuDeviceGetByPCIBusId == NULL: + with gil: + raise FunctionNotFoundError("function cuDeviceGetByPCIBusId is not found") + return (__cuDeviceGetByPCIBusId)( + dev, pciBusId) + + +cdef CUresult _cuDeviceGetPCIBusId(char* pciBusId, int len, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDeviceGetPCIBusId + _check_or_init_driver() + if __cuDeviceGetPCIBusId == NULL: + with gil: + raise FunctionNotFoundError("function cuDeviceGetPCIBusId is not found") + return (__cuDeviceGetPCIBusId)( + pciBusId, len, dev) + + +cdef CUresult _cuIpcGetEventHandle(CUipcEventHandle* pHandle, CUevent event) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuIpcGetEventHandle + _check_or_init_driver() + if __cuIpcGetEventHandle == NULL: + with gil: + raise FunctionNotFoundError("function cuIpcGetEventHandle is not found") + return (__cuIpcGetEventHandle)( + pHandle, event) + + +cdef CUresult _cuIpcOpenEventHandle(CUevent* phEvent, CUipcEventHandle handle) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuIpcOpenEventHandle + _check_or_init_driver() + if __cuIpcOpenEventHandle == NULL: + with gil: + raise FunctionNotFoundError("function cuIpcOpenEventHandle is not found") + return (__cuIpcOpenEventHandle)( + phEvent, handle) + + +cdef CUresult _cuIpcGetMemHandle(CUipcMemHandle* pHandle, CUdeviceptr dptr) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuIpcGetMemHandle + _check_or_init_driver() + if __cuIpcGetMemHandle == NULL: + with gil: + raise FunctionNotFoundError("function cuIpcGetMemHandle is not found") + return (__cuIpcGetMemHandle)( + pHandle, dptr) + + +cdef CUresult _cuIpcOpenMemHandle_v2(CUdeviceptr* pdptr, CUipcMemHandle handle, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuIpcOpenMemHandle_v2 + _check_or_init_driver() + if __cuIpcOpenMemHandle_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuIpcOpenMemHandle_v2 is not found") + return (__cuIpcOpenMemHandle_v2)( + pdptr, handle, Flags) + + +cdef CUresult _cuIpcCloseMemHandle(CUdeviceptr dptr) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuIpcCloseMemHandle + _check_or_init_driver() + if __cuIpcCloseMemHandle == NULL: + with gil: + raise FunctionNotFoundError("function cuIpcCloseMemHandle is not found") + return (__cuIpcCloseMemHandle)( + dptr) + + +cdef CUresult _cuMemHostRegister_v2(void* p, size_t bytesize, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemHostRegister_v2 + _check_or_init_driver() + if __cuMemHostRegister_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemHostRegister_v2 is not found") + return (__cuMemHostRegister_v2)( + p, bytesize, Flags) + + +cdef CUresult _cuMemHostUnregister(void* p) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemHostUnregister + _check_or_init_driver() + if __cuMemHostUnregister == NULL: + with gil: + raise FunctionNotFoundError("function cuMemHostUnregister is not found") + return (__cuMemHostUnregister)( + p) + + +cdef CUresult _cuMemcpy(CUdeviceptr dst, CUdeviceptr src, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemcpy + _check_or_init_driver() + if __cuMemcpy == NULL: + with gil: + raise FunctionNotFoundError("function cuMemcpy is not found") + return (__cuMemcpy)( + dst, src, ByteCount) + + +cdef CUresult _cuMemcpyPeer(CUdeviceptr dstDevice, CUcontext dstContext, CUdeviceptr srcDevice, CUcontext srcContext, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemcpyPeer + _check_or_init_driver() + if __cuMemcpyPeer == NULL: + with gil: + raise FunctionNotFoundError("function cuMemcpyPeer is not found") + return (__cuMemcpyPeer)( + dstDevice, dstContext, srcDevice, srcContext, ByteCount) + + +cdef CUresult _cuMemcpyHtoD_v2(CUdeviceptr dstDevice, const void* srcHost, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemcpyHtoD_v2 + _check_or_init_driver() + if __cuMemcpyHtoD_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemcpyHtoD_v2 is not found") + return (__cuMemcpyHtoD_v2)( + dstDevice, srcHost, ByteCount) + + +cdef CUresult _cuMemcpyDtoH_v2(void* dstHost, CUdeviceptr srcDevice, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemcpyDtoH_v2 + _check_or_init_driver() + if __cuMemcpyDtoH_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemcpyDtoH_v2 is not found") + return (__cuMemcpyDtoH_v2)( + dstHost, srcDevice, ByteCount) + + +cdef CUresult _cuMemcpyDtoD_v2(CUdeviceptr dstDevice, CUdeviceptr srcDevice, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemcpyDtoD_v2 + _check_or_init_driver() + if __cuMemcpyDtoD_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemcpyDtoD_v2 is not found") + return (__cuMemcpyDtoD_v2)( + dstDevice, srcDevice, ByteCount) + + +cdef CUresult _cuMemcpyDtoA_v2(CUarray dstArray, size_t dstOffset, CUdeviceptr srcDevice, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemcpyDtoA_v2 + _check_or_init_driver() + if __cuMemcpyDtoA_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemcpyDtoA_v2 is not found") + return (__cuMemcpyDtoA_v2)( + dstArray, dstOffset, srcDevice, ByteCount) + + +cdef CUresult _cuMemcpyAtoD_v2(CUdeviceptr dstDevice, CUarray srcArray, size_t srcOffset, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemcpyAtoD_v2 + _check_or_init_driver() + if __cuMemcpyAtoD_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemcpyAtoD_v2 is not found") + return (__cuMemcpyAtoD_v2)( + dstDevice, srcArray, srcOffset, ByteCount) + + +cdef CUresult _cuMemcpyHtoA_v2(CUarray dstArray, size_t dstOffset, const void* srcHost, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemcpyHtoA_v2 + _check_or_init_driver() + if __cuMemcpyHtoA_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemcpyHtoA_v2 is not found") + return (__cuMemcpyHtoA_v2)( + dstArray, dstOffset, srcHost, ByteCount) + + +cdef CUresult _cuMemcpyAtoH_v2(void* dstHost, CUarray srcArray, size_t srcOffset, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemcpyAtoH_v2 + _check_or_init_driver() + if __cuMemcpyAtoH_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemcpyAtoH_v2 is not found") + return (__cuMemcpyAtoH_v2)( + dstHost, srcArray, srcOffset, ByteCount) + + +cdef CUresult _cuMemcpyAtoA_v2(CUarray dstArray, size_t dstOffset, CUarray srcArray, size_t srcOffset, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemcpyAtoA_v2 + _check_or_init_driver() + if __cuMemcpyAtoA_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemcpyAtoA_v2 is not found") + return (__cuMemcpyAtoA_v2)( + dstArray, dstOffset, srcArray, srcOffset, ByteCount) + + +cdef CUresult _cuMemcpy2D_v2(const CUDA_MEMCPY2D* pCopy) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemcpy2D_v2 + _check_or_init_driver() + if __cuMemcpy2D_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemcpy2D_v2 is not found") + return (__cuMemcpy2D_v2)( + pCopy) + + +cdef CUresult _cuMemcpy2DUnaligned_v2(const CUDA_MEMCPY2D* pCopy) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemcpy2DUnaligned_v2 + _check_or_init_driver() + if __cuMemcpy2DUnaligned_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemcpy2DUnaligned_v2 is not found") + return (__cuMemcpy2DUnaligned_v2)( + pCopy) + + +cdef CUresult _cuMemcpy3D_v2(const CUDA_MEMCPY3D* pCopy) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemcpy3D_v2 + _check_or_init_driver() + if __cuMemcpy3D_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemcpy3D_v2 is not found") + return (__cuMemcpy3D_v2)( + pCopy) + + +cdef CUresult _cuMemcpy3DPeer(const CUDA_MEMCPY3D_PEER* pCopy) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemcpy3DPeer + _check_or_init_driver() + if __cuMemcpy3DPeer == NULL: + with gil: + raise FunctionNotFoundError("function cuMemcpy3DPeer is not found") + return (__cuMemcpy3DPeer)( + pCopy) + + +cdef CUresult _cuMemcpyAsync(CUdeviceptr dst, CUdeviceptr src, size_t ByteCount, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemcpyAsync + _check_or_init_driver() + if __cuMemcpyAsync == NULL: + with gil: + raise FunctionNotFoundError("function cuMemcpyAsync is not found") + return (__cuMemcpyAsync)( + dst, src, ByteCount, hStream) + + +cdef CUresult _cuMemcpyPeerAsync(CUdeviceptr dstDevice, CUcontext dstContext, CUdeviceptr srcDevice, CUcontext srcContext, size_t ByteCount, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemcpyPeerAsync + _check_or_init_driver() + if __cuMemcpyPeerAsync == NULL: + with gil: + raise FunctionNotFoundError("function cuMemcpyPeerAsync is not found") + return (__cuMemcpyPeerAsync)( + dstDevice, dstContext, srcDevice, srcContext, ByteCount, hStream) + + +cdef CUresult _cuMemcpyHtoDAsync_v2(CUdeviceptr dstDevice, const void* srcHost, size_t ByteCount, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemcpyHtoDAsync_v2 + _check_or_init_driver() + if __cuMemcpyHtoDAsync_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemcpyHtoDAsync_v2 is not found") + return (__cuMemcpyHtoDAsync_v2)( + dstDevice, srcHost, ByteCount, hStream) + + +cdef CUresult _cuMemcpyDtoHAsync_v2(void* dstHost, CUdeviceptr srcDevice, size_t ByteCount, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemcpyDtoHAsync_v2 + _check_or_init_driver() + if __cuMemcpyDtoHAsync_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemcpyDtoHAsync_v2 is not found") + return (__cuMemcpyDtoHAsync_v2)( + dstHost, srcDevice, ByteCount, hStream) + + +cdef CUresult _cuMemcpyDtoDAsync_v2(CUdeviceptr dstDevice, CUdeviceptr srcDevice, size_t ByteCount, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemcpyDtoDAsync_v2 + _check_or_init_driver() + if __cuMemcpyDtoDAsync_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemcpyDtoDAsync_v2 is not found") + return (__cuMemcpyDtoDAsync_v2)( + dstDevice, srcDevice, ByteCount, hStream) + + +cdef CUresult _cuMemcpyHtoAAsync_v2(CUarray dstArray, size_t dstOffset, const void* srcHost, size_t ByteCount, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemcpyHtoAAsync_v2 + _check_or_init_driver() + if __cuMemcpyHtoAAsync_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemcpyHtoAAsync_v2 is not found") + return (__cuMemcpyHtoAAsync_v2)( + dstArray, dstOffset, srcHost, ByteCount, hStream) + + +cdef CUresult _cuMemcpyAtoHAsync_v2(void* dstHost, CUarray srcArray, size_t srcOffset, size_t ByteCount, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemcpyAtoHAsync_v2 + _check_or_init_driver() + if __cuMemcpyAtoHAsync_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemcpyAtoHAsync_v2 is not found") + return (__cuMemcpyAtoHAsync_v2)( + dstHost, srcArray, srcOffset, ByteCount, hStream) + + +cdef CUresult _cuMemcpy2DAsync_v2(const CUDA_MEMCPY2D* pCopy, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemcpy2DAsync_v2 + _check_or_init_driver() + if __cuMemcpy2DAsync_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemcpy2DAsync_v2 is not found") + return (__cuMemcpy2DAsync_v2)( + pCopy, hStream) + + +cdef CUresult _cuMemcpy3DAsync_v2(const CUDA_MEMCPY3D* pCopy, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemcpy3DAsync_v2 + _check_or_init_driver() + if __cuMemcpy3DAsync_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemcpy3DAsync_v2 is not found") + return (__cuMemcpy3DAsync_v2)( + pCopy, hStream) + + +cdef CUresult _cuMemcpy3DPeerAsync(const CUDA_MEMCPY3D_PEER* pCopy, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemcpy3DPeerAsync + _check_or_init_driver() + if __cuMemcpy3DPeerAsync == NULL: + with gil: + raise FunctionNotFoundError("function cuMemcpy3DPeerAsync is not found") + return (__cuMemcpy3DPeerAsync)( + pCopy, hStream) + + +cdef CUresult _cuMemsetD8_v2(CUdeviceptr dstDevice, unsigned char uc, size_t N) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemsetD8_v2 + _check_or_init_driver() + if __cuMemsetD8_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemsetD8_v2 is not found") + return (__cuMemsetD8_v2)( + dstDevice, uc, N) + + +cdef CUresult _cuMemsetD16_v2(CUdeviceptr dstDevice, unsigned short us, size_t N) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemsetD16_v2 + _check_or_init_driver() + if __cuMemsetD16_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemsetD16_v2 is not found") + return (__cuMemsetD16_v2)( + dstDevice, us, N) + + +cdef CUresult _cuMemsetD32_v2(CUdeviceptr dstDevice, unsigned int ui, size_t N) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemsetD32_v2 + _check_or_init_driver() + if __cuMemsetD32_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemsetD32_v2 is not found") + return (__cuMemsetD32_v2)( + dstDevice, ui, N) + + +cdef CUresult _cuMemsetD2D8_v2(CUdeviceptr dstDevice, size_t dstPitch, unsigned char uc, size_t Width, size_t Height) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemsetD2D8_v2 + _check_or_init_driver() + if __cuMemsetD2D8_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemsetD2D8_v2 is not found") + return (__cuMemsetD2D8_v2)( + dstDevice, dstPitch, uc, Width, Height) + + +cdef CUresult _cuMemsetD2D16_v2(CUdeviceptr dstDevice, size_t dstPitch, unsigned short us, size_t Width, size_t Height) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemsetD2D16_v2 + _check_or_init_driver() + if __cuMemsetD2D16_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemsetD2D16_v2 is not found") + return (__cuMemsetD2D16_v2)( + dstDevice, dstPitch, us, Width, Height) + + +cdef CUresult _cuMemsetD2D32_v2(CUdeviceptr dstDevice, size_t dstPitch, unsigned int ui, size_t Width, size_t Height) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemsetD2D32_v2 + _check_or_init_driver() + if __cuMemsetD2D32_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemsetD2D32_v2 is not found") + return (__cuMemsetD2D32_v2)( + dstDevice, dstPitch, ui, Width, Height) + + +cdef CUresult _cuMemsetD8Async(CUdeviceptr dstDevice, unsigned char uc, size_t N, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemsetD8Async + _check_or_init_driver() + if __cuMemsetD8Async == NULL: + with gil: + raise FunctionNotFoundError("function cuMemsetD8Async is not found") + return (__cuMemsetD8Async)( + dstDevice, uc, N, hStream) + + +cdef CUresult _cuMemsetD16Async(CUdeviceptr dstDevice, unsigned short us, size_t N, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemsetD16Async + _check_or_init_driver() + if __cuMemsetD16Async == NULL: + with gil: + raise FunctionNotFoundError("function cuMemsetD16Async is not found") + return (__cuMemsetD16Async)( + dstDevice, us, N, hStream) + + +cdef CUresult _cuMemsetD32Async(CUdeviceptr dstDevice, unsigned int ui, size_t N, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemsetD32Async + _check_or_init_driver() + if __cuMemsetD32Async == NULL: + with gil: + raise FunctionNotFoundError("function cuMemsetD32Async is not found") + return (__cuMemsetD32Async)( + dstDevice, ui, N, hStream) + + +cdef CUresult _cuMemsetD2D8Async(CUdeviceptr dstDevice, size_t dstPitch, unsigned char uc, size_t Width, size_t Height, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemsetD2D8Async + _check_or_init_driver() + if __cuMemsetD2D8Async == NULL: + with gil: + raise FunctionNotFoundError("function cuMemsetD2D8Async is not found") + return (__cuMemsetD2D8Async)( + dstDevice, dstPitch, uc, Width, Height, hStream) + + +cdef CUresult _cuMemsetD2D16Async(CUdeviceptr dstDevice, size_t dstPitch, unsigned short us, size_t Width, size_t Height, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemsetD2D16Async + _check_or_init_driver() + if __cuMemsetD2D16Async == NULL: + with gil: + raise FunctionNotFoundError("function cuMemsetD2D16Async is not found") + return (__cuMemsetD2D16Async)( + dstDevice, dstPitch, us, Width, Height, hStream) + + +cdef CUresult _cuMemsetD2D32Async(CUdeviceptr dstDevice, size_t dstPitch, unsigned int ui, size_t Width, size_t Height, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemsetD2D32Async + _check_or_init_driver() + if __cuMemsetD2D32Async == NULL: + with gil: + raise FunctionNotFoundError("function cuMemsetD2D32Async is not found") + return (__cuMemsetD2D32Async)( + dstDevice, dstPitch, ui, Width, Height, hStream) + + +cdef CUresult _cuArrayCreate_v2(CUarray* pHandle, const CUDA_ARRAY_DESCRIPTOR* pAllocateArray) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuArrayCreate_v2 + _check_or_init_driver() + if __cuArrayCreate_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuArrayCreate_v2 is not found") + return (__cuArrayCreate_v2)( + pHandle, pAllocateArray) + + +cdef CUresult _cuArrayGetDescriptor_v2(CUDA_ARRAY_DESCRIPTOR* pArrayDescriptor, CUarray hArray) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuArrayGetDescriptor_v2 + _check_or_init_driver() + if __cuArrayGetDescriptor_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuArrayGetDescriptor_v2 is not found") + return (__cuArrayGetDescriptor_v2)( + pArrayDescriptor, hArray) + + +cdef CUresult _cuArrayGetSparseProperties(CUDA_ARRAY_SPARSE_PROPERTIES* sparseProperties, CUarray array) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuArrayGetSparseProperties + _check_or_init_driver() + if __cuArrayGetSparseProperties == NULL: + with gil: + raise FunctionNotFoundError("function cuArrayGetSparseProperties is not found") + return (__cuArrayGetSparseProperties)( + sparseProperties, array) + + +cdef CUresult _cuMipmappedArrayGetSparseProperties(CUDA_ARRAY_SPARSE_PROPERTIES* sparseProperties, CUmipmappedArray mipmap) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMipmappedArrayGetSparseProperties + _check_or_init_driver() + if __cuMipmappedArrayGetSparseProperties == NULL: + with gil: + raise FunctionNotFoundError("function cuMipmappedArrayGetSparseProperties is not found") + return (__cuMipmappedArrayGetSparseProperties)( + sparseProperties, mipmap) + + +cdef CUresult _cuArrayGetMemoryRequirements(CUDA_ARRAY_MEMORY_REQUIREMENTS* memoryRequirements, CUarray array, CUdevice device) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuArrayGetMemoryRequirements + _check_or_init_driver() + if __cuArrayGetMemoryRequirements == NULL: + with gil: + raise FunctionNotFoundError("function cuArrayGetMemoryRequirements is not found") + return (__cuArrayGetMemoryRequirements)( + memoryRequirements, array, device) + + +cdef CUresult _cuMipmappedArrayGetMemoryRequirements(CUDA_ARRAY_MEMORY_REQUIREMENTS* memoryRequirements, CUmipmappedArray mipmap, CUdevice device) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMipmappedArrayGetMemoryRequirements + _check_or_init_driver() + if __cuMipmappedArrayGetMemoryRequirements == NULL: + with gil: + raise FunctionNotFoundError("function cuMipmappedArrayGetMemoryRequirements is not found") + return (__cuMipmappedArrayGetMemoryRequirements)( + memoryRequirements, mipmap, device) + + +cdef CUresult _cuArrayGetPlane(CUarray* pPlaneArray, CUarray hArray, unsigned int planeIdx) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuArrayGetPlane + _check_or_init_driver() + if __cuArrayGetPlane == NULL: + with gil: + raise FunctionNotFoundError("function cuArrayGetPlane is not found") + return (__cuArrayGetPlane)( + pPlaneArray, hArray, planeIdx) + + +cdef CUresult _cuArrayDestroy(CUarray hArray) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuArrayDestroy + _check_or_init_driver() + if __cuArrayDestroy == NULL: + with gil: + raise FunctionNotFoundError("function cuArrayDestroy is not found") + return (__cuArrayDestroy)( + hArray) + + +cdef CUresult _cuArray3DCreate_v2(CUarray* pHandle, const CUDA_ARRAY3D_DESCRIPTOR* pAllocateArray) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuArray3DCreate_v2 + _check_or_init_driver() + if __cuArray3DCreate_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuArray3DCreate_v2 is not found") + return (__cuArray3DCreate_v2)( + pHandle, pAllocateArray) + + +cdef CUresult _cuArray3DGetDescriptor_v2(CUDA_ARRAY3D_DESCRIPTOR* pArrayDescriptor, CUarray hArray) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuArray3DGetDescriptor_v2 + _check_or_init_driver() + if __cuArray3DGetDescriptor_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuArray3DGetDescriptor_v2 is not found") + return (__cuArray3DGetDescriptor_v2)( + pArrayDescriptor, hArray) + + +cdef CUresult _cuMipmappedArrayCreate(CUmipmappedArray* pHandle, const CUDA_ARRAY3D_DESCRIPTOR* pMipmappedArrayDesc, unsigned int numMipmapLevels) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMipmappedArrayCreate + _check_or_init_driver() + if __cuMipmappedArrayCreate == NULL: + with gil: + raise FunctionNotFoundError("function cuMipmappedArrayCreate is not found") + return (__cuMipmappedArrayCreate)( + pHandle, pMipmappedArrayDesc, numMipmapLevels) + + +cdef CUresult _cuMipmappedArrayGetLevel(CUarray* pLevelArray, CUmipmappedArray hMipmappedArray, unsigned int level) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMipmappedArrayGetLevel + _check_or_init_driver() + if __cuMipmappedArrayGetLevel == NULL: + with gil: + raise FunctionNotFoundError("function cuMipmappedArrayGetLevel is not found") + return (__cuMipmappedArrayGetLevel)( + pLevelArray, hMipmappedArray, level) + + +cdef CUresult _cuMipmappedArrayDestroy(CUmipmappedArray hMipmappedArray) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMipmappedArrayDestroy + _check_or_init_driver() + if __cuMipmappedArrayDestroy == NULL: + with gil: + raise FunctionNotFoundError("function cuMipmappedArrayDestroy is not found") + return (__cuMipmappedArrayDestroy)( + hMipmappedArray) + + +cdef CUresult _cuMemGetHandleForAddressRange(void* handle, CUdeviceptr dptr, size_t size, CUmemRangeHandleType handleType, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemGetHandleForAddressRange + _check_or_init_driver() + if __cuMemGetHandleForAddressRange == NULL: + with gil: + raise FunctionNotFoundError("function cuMemGetHandleForAddressRange is not found") + return (__cuMemGetHandleForAddressRange)( + handle, dptr, size, handleType, flags) + + +cdef CUresult _cuMemBatchDecompressAsync(CUmemDecompressParams* paramsArray, size_t count, unsigned int flags, size_t* errorIndex, CUstream stream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemBatchDecompressAsync + _check_or_init_driver() + if __cuMemBatchDecompressAsync == NULL: + with gil: + raise FunctionNotFoundError("function cuMemBatchDecompressAsync is not found") + return (__cuMemBatchDecompressAsync)( + paramsArray, count, flags, errorIndex, stream) + + +cdef CUresult _cuMemAddressReserve(CUdeviceptr* ptr, size_t size, size_t alignment, CUdeviceptr addr, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemAddressReserve + _check_or_init_driver() + if __cuMemAddressReserve == NULL: + with gil: + raise FunctionNotFoundError("function cuMemAddressReserve is not found") + return (__cuMemAddressReserve)( + ptr, size, alignment, addr, flags) + + +cdef CUresult _cuMemAddressFree(CUdeviceptr ptr, size_t size) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemAddressFree + _check_or_init_driver() + if __cuMemAddressFree == NULL: + with gil: + raise FunctionNotFoundError("function cuMemAddressFree is not found") + return (__cuMemAddressFree)( + ptr, size) + + +cdef CUresult _cuMemCreate(CUmemGenericAllocationHandle* handle, size_t size, const CUmemAllocationProp* prop, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemCreate + _check_or_init_driver() + if __cuMemCreate == NULL: + with gil: + raise FunctionNotFoundError("function cuMemCreate is not found") + return (__cuMemCreate)( + handle, size, prop, flags) + + +cdef CUresult _cuMemRelease(CUmemGenericAllocationHandle handle) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemRelease + _check_or_init_driver() + if __cuMemRelease == NULL: + with gil: + raise FunctionNotFoundError("function cuMemRelease is not found") + return (__cuMemRelease)( + handle) + + +cdef CUresult _cuMemMap(CUdeviceptr ptr, size_t size, size_t offset, CUmemGenericAllocationHandle handle, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemMap + _check_or_init_driver() + if __cuMemMap == NULL: + with gil: + raise FunctionNotFoundError("function cuMemMap is not found") + return (__cuMemMap)( + ptr, size, offset, handle, flags) + + +cdef CUresult _cuMemMapArrayAsync(CUarrayMapInfo* mapInfoList, unsigned int count, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemMapArrayAsync + _check_or_init_driver() + if __cuMemMapArrayAsync == NULL: + with gil: + raise FunctionNotFoundError("function cuMemMapArrayAsync is not found") + return (__cuMemMapArrayAsync)( + mapInfoList, count, hStream) + + +cdef CUresult _cuMemUnmap(CUdeviceptr ptr, size_t size) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemUnmap + _check_or_init_driver() + if __cuMemUnmap == NULL: + with gil: + raise FunctionNotFoundError("function cuMemUnmap is not found") + return (__cuMemUnmap)( + ptr, size) + + +cdef CUresult _cuMemSetAccess(CUdeviceptr ptr, size_t size, const CUmemAccessDesc* desc, size_t count) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemSetAccess + _check_or_init_driver() + if __cuMemSetAccess == NULL: + with gil: + raise FunctionNotFoundError("function cuMemSetAccess is not found") + return (__cuMemSetAccess)( + ptr, size, desc, count) + + +cdef CUresult _cuMemGetAccess(unsigned long long* flags, const CUmemLocation* location, CUdeviceptr ptr) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemGetAccess + _check_or_init_driver() + if __cuMemGetAccess == NULL: + with gil: + raise FunctionNotFoundError("function cuMemGetAccess is not found") + return (__cuMemGetAccess)( + flags, location, ptr) + + +cdef CUresult _cuMemExportToShareableHandle(void* shareableHandle, CUmemGenericAllocationHandle handle, CUmemAllocationHandleType handleType, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemExportToShareableHandle + _check_or_init_driver() + if __cuMemExportToShareableHandle == NULL: + with gil: + raise FunctionNotFoundError("function cuMemExportToShareableHandle is not found") + return (__cuMemExportToShareableHandle)( + shareableHandle, handle, handleType, flags) + + +cdef CUresult _cuMemImportFromShareableHandle(CUmemGenericAllocationHandle* handle, void* osHandle, CUmemAllocationHandleType shHandleType) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemImportFromShareableHandle + _check_or_init_driver() + if __cuMemImportFromShareableHandle == NULL: + with gil: + raise FunctionNotFoundError("function cuMemImportFromShareableHandle is not found") + return (__cuMemImportFromShareableHandle)( + handle, osHandle, shHandleType) + + +cdef CUresult _cuMemGetAllocationGranularity(size_t* granularity, const CUmemAllocationProp* prop, CUmemAllocationGranularity_flags option) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemGetAllocationGranularity + _check_or_init_driver() + if __cuMemGetAllocationGranularity == NULL: + with gil: + raise FunctionNotFoundError("function cuMemGetAllocationGranularity is not found") + return (__cuMemGetAllocationGranularity)( + granularity, prop, option) + + +cdef CUresult _cuMemGetAllocationPropertiesFromHandle(CUmemAllocationProp* prop, CUmemGenericAllocationHandle handle) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemGetAllocationPropertiesFromHandle + _check_or_init_driver() + if __cuMemGetAllocationPropertiesFromHandle == NULL: + with gil: + raise FunctionNotFoundError("function cuMemGetAllocationPropertiesFromHandle is not found") + return (__cuMemGetAllocationPropertiesFromHandle)( + prop, handle) + + +cdef CUresult _cuMemRetainAllocationHandle(CUmemGenericAllocationHandle* handle, void* addr) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemRetainAllocationHandle + _check_or_init_driver() + if __cuMemRetainAllocationHandle == NULL: + with gil: + raise FunctionNotFoundError("function cuMemRetainAllocationHandle is not found") + return (__cuMemRetainAllocationHandle)( + handle, addr) + + +cdef CUresult _cuMemFreeAsync(CUdeviceptr dptr, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemFreeAsync + _check_or_init_driver() + if __cuMemFreeAsync == NULL: + with gil: + raise FunctionNotFoundError("function cuMemFreeAsync is not found") + return (__cuMemFreeAsync)( + dptr, hStream) + + +cdef CUresult _cuMemAllocAsync(CUdeviceptr* dptr, size_t bytesize, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemAllocAsync + _check_or_init_driver() + if __cuMemAllocAsync == NULL: + with gil: + raise FunctionNotFoundError("function cuMemAllocAsync is not found") + return (__cuMemAllocAsync)( + dptr, bytesize, hStream) + + +cdef CUresult _cuMemPoolTrimTo(CUmemoryPool pool, size_t minBytesToKeep) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemPoolTrimTo + _check_or_init_driver() + if __cuMemPoolTrimTo == NULL: + with gil: + raise FunctionNotFoundError("function cuMemPoolTrimTo is not found") + return (__cuMemPoolTrimTo)( + pool, minBytesToKeep) + + +cdef CUresult _cuMemPoolSetAttribute(CUmemoryPool pool, CUmemPool_attribute attr, void* value) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemPoolSetAttribute + _check_or_init_driver() + if __cuMemPoolSetAttribute == NULL: + with gil: + raise FunctionNotFoundError("function cuMemPoolSetAttribute is not found") + return (__cuMemPoolSetAttribute)( + pool, attr, value) + + +cdef CUresult _cuMemPoolGetAttribute(CUmemoryPool pool, CUmemPool_attribute attr, void* value) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemPoolGetAttribute + _check_or_init_driver() + if __cuMemPoolGetAttribute == NULL: + with gil: + raise FunctionNotFoundError("function cuMemPoolGetAttribute is not found") + return (__cuMemPoolGetAttribute)( + pool, attr, value) + + +cdef CUresult _cuMemPoolSetAccess(CUmemoryPool pool, const CUmemAccessDesc* map, size_t count) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemPoolSetAccess + _check_or_init_driver() + if __cuMemPoolSetAccess == NULL: + with gil: + raise FunctionNotFoundError("function cuMemPoolSetAccess is not found") + return (__cuMemPoolSetAccess)( + pool, map, count) + + +cdef CUresult _cuMemPoolGetAccess(CUmemAccess_flags* flags, CUmemoryPool memPool, CUmemLocation* location) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemPoolGetAccess + _check_or_init_driver() + if __cuMemPoolGetAccess == NULL: + with gil: + raise FunctionNotFoundError("function cuMemPoolGetAccess is not found") + return (__cuMemPoolGetAccess)( + flags, memPool, location) + + +cdef CUresult _cuMemPoolCreate(CUmemoryPool* pool, const CUmemPoolProps* poolProps) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemPoolCreate + _check_or_init_driver() + if __cuMemPoolCreate == NULL: + with gil: + raise FunctionNotFoundError("function cuMemPoolCreate is not found") + return (__cuMemPoolCreate)( + pool, poolProps) + + +cdef CUresult _cuMemPoolDestroy(CUmemoryPool pool) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemPoolDestroy + _check_or_init_driver() + if __cuMemPoolDestroy == NULL: + with gil: + raise FunctionNotFoundError("function cuMemPoolDestroy is not found") + return (__cuMemPoolDestroy)( + pool) + + +cdef CUresult _cuMemAllocFromPoolAsync(CUdeviceptr* dptr, size_t bytesize, CUmemoryPool pool, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemAllocFromPoolAsync + _check_or_init_driver() + if __cuMemAllocFromPoolAsync == NULL: + with gil: + raise FunctionNotFoundError("function cuMemAllocFromPoolAsync is not found") + return (__cuMemAllocFromPoolAsync)( + dptr, bytesize, pool, hStream) + + +cdef CUresult _cuMemPoolExportToShareableHandle(void* handle_out, CUmemoryPool pool, CUmemAllocationHandleType handleType, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemPoolExportToShareableHandle + _check_or_init_driver() + if __cuMemPoolExportToShareableHandle == NULL: + with gil: + raise FunctionNotFoundError("function cuMemPoolExportToShareableHandle is not found") + return (__cuMemPoolExportToShareableHandle)( + handle_out, pool, handleType, flags) + + +cdef CUresult _cuMemPoolImportFromShareableHandle(CUmemoryPool* pool_out, void* handle, CUmemAllocationHandleType handleType, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemPoolImportFromShareableHandle + _check_or_init_driver() + if __cuMemPoolImportFromShareableHandle == NULL: + with gil: + raise FunctionNotFoundError("function cuMemPoolImportFromShareableHandle is not found") + return (__cuMemPoolImportFromShareableHandle)( + pool_out, handle, handleType, flags) + + +cdef CUresult _cuMemPoolExportPointer(CUmemPoolPtrExportData* shareData_out, CUdeviceptr ptr) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemPoolExportPointer + _check_or_init_driver() + if __cuMemPoolExportPointer == NULL: + with gil: + raise FunctionNotFoundError("function cuMemPoolExportPointer is not found") + return (__cuMemPoolExportPointer)( + shareData_out, ptr) + + +cdef CUresult _cuMemPoolImportPointer(CUdeviceptr* ptr_out, CUmemoryPool pool, CUmemPoolPtrExportData* shareData) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemPoolImportPointer + _check_or_init_driver() + if __cuMemPoolImportPointer == NULL: + with gil: + raise FunctionNotFoundError("function cuMemPoolImportPointer is not found") + return (__cuMemPoolImportPointer)( + ptr_out, pool, shareData) + + +cdef CUresult _cuMulticastCreate(CUmemGenericAllocationHandle* mcHandle, const CUmulticastObjectProp* prop) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMulticastCreate + _check_or_init_driver() + if __cuMulticastCreate == NULL: + with gil: + raise FunctionNotFoundError("function cuMulticastCreate is not found") + return (__cuMulticastCreate)( + mcHandle, prop) + + +cdef CUresult _cuMulticastAddDevice(CUmemGenericAllocationHandle mcHandle, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMulticastAddDevice + _check_or_init_driver() + if __cuMulticastAddDevice == NULL: + with gil: + raise FunctionNotFoundError("function cuMulticastAddDevice is not found") + return (__cuMulticastAddDevice)( + mcHandle, dev) + + +cdef CUresult _cuMulticastBindMem(CUmemGenericAllocationHandle mcHandle, size_t mcOffset, CUmemGenericAllocationHandle memHandle, size_t memOffset, size_t size, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMulticastBindMem + _check_or_init_driver() + if __cuMulticastBindMem == NULL: + with gil: + raise FunctionNotFoundError("function cuMulticastBindMem is not found") + return (__cuMulticastBindMem)( + mcHandle, mcOffset, memHandle, memOffset, size, flags) + + +cdef CUresult _cuMulticastBindAddr(CUmemGenericAllocationHandle mcHandle, size_t mcOffset, CUdeviceptr memptr, size_t size, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMulticastBindAddr + _check_or_init_driver() + if __cuMulticastBindAddr == NULL: + with gil: + raise FunctionNotFoundError("function cuMulticastBindAddr is not found") + return (__cuMulticastBindAddr)( + mcHandle, mcOffset, memptr, size, flags) + + +cdef CUresult _cuMulticastUnbind(CUmemGenericAllocationHandle mcHandle, CUdevice dev, size_t mcOffset, size_t size) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMulticastUnbind + _check_or_init_driver() + if __cuMulticastUnbind == NULL: + with gil: + raise FunctionNotFoundError("function cuMulticastUnbind is not found") + return (__cuMulticastUnbind)( + mcHandle, dev, mcOffset, size) + + +cdef CUresult _cuMulticastGetGranularity(size_t* granularity, const CUmulticastObjectProp* prop, CUmulticastGranularity_flags option) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMulticastGetGranularity + _check_or_init_driver() + if __cuMulticastGetGranularity == NULL: + with gil: + raise FunctionNotFoundError("function cuMulticastGetGranularity is not found") + return (__cuMulticastGetGranularity)( + granularity, prop, option) + + +cdef CUresult _cuPointerGetAttribute(void* data, CUpointer_attribute attribute, CUdeviceptr ptr) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuPointerGetAttribute + _check_or_init_driver() + if __cuPointerGetAttribute == NULL: + with gil: + raise FunctionNotFoundError("function cuPointerGetAttribute is not found") + return (__cuPointerGetAttribute)( + data, attribute, ptr) + + +cdef CUresult _cuMemPrefetchAsync_v2(CUdeviceptr devPtr, size_t count, CUmemLocation location, unsigned int flags, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemPrefetchAsync_v2 + _check_or_init_driver() + if __cuMemPrefetchAsync_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemPrefetchAsync_v2 is not found") + return (__cuMemPrefetchAsync_v2)( + devPtr, count, location, flags, hStream) + + +cdef CUresult _cuMemAdvise_v2(CUdeviceptr devPtr, size_t count, CUmem_advise advice, CUmemLocation location) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemAdvise_v2 + _check_or_init_driver() + if __cuMemAdvise_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemAdvise_v2 is not found") + return (__cuMemAdvise_v2)( + devPtr, count, advice, location) + + +cdef CUresult _cuMemRangeGetAttribute(void* data, size_t dataSize, CUmem_range_attribute attribute, CUdeviceptr devPtr, size_t count) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemRangeGetAttribute + _check_or_init_driver() + if __cuMemRangeGetAttribute == NULL: + with gil: + raise FunctionNotFoundError("function cuMemRangeGetAttribute is not found") + return (__cuMemRangeGetAttribute)( + data, dataSize, attribute, devPtr, count) + + +cdef CUresult _cuMemRangeGetAttributes(void** data, size_t* dataSizes, CUmem_range_attribute* attributes, size_t numAttributes, CUdeviceptr devPtr, size_t count) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemRangeGetAttributes + _check_or_init_driver() + if __cuMemRangeGetAttributes == NULL: + with gil: + raise FunctionNotFoundError("function cuMemRangeGetAttributes is not found") + return (__cuMemRangeGetAttributes)( + data, dataSizes, attributes, numAttributes, devPtr, count) + + +cdef CUresult _cuPointerSetAttribute(const void* value, CUpointer_attribute attribute, CUdeviceptr ptr) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuPointerSetAttribute + _check_or_init_driver() + if __cuPointerSetAttribute == NULL: + with gil: + raise FunctionNotFoundError("function cuPointerSetAttribute is not found") + return (__cuPointerSetAttribute)( + value, attribute, ptr) + + +cdef CUresult _cuPointerGetAttributes(unsigned int numAttributes, CUpointer_attribute* attributes, void** data, CUdeviceptr ptr) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuPointerGetAttributes + _check_or_init_driver() + if __cuPointerGetAttributes == NULL: + with gil: + raise FunctionNotFoundError("function cuPointerGetAttributes is not found") + return (__cuPointerGetAttributes)( + numAttributes, attributes, data, ptr) + + +cdef CUresult _cuStreamCreate(CUstream* phStream, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamCreate + _check_or_init_driver() + if __cuStreamCreate == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamCreate is not found") + return (__cuStreamCreate)( + phStream, Flags) + + +cdef CUresult _cuStreamCreateWithPriority(CUstream* phStream, unsigned int flags, int priority) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamCreateWithPriority + _check_or_init_driver() + if __cuStreamCreateWithPriority == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamCreateWithPriority is not found") + return (__cuStreamCreateWithPriority)( + phStream, flags, priority) + + +cdef CUresult _cuStreamGetPriority(CUstream hStream, int* priority) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamGetPriority + _check_or_init_driver() + if __cuStreamGetPriority == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamGetPriority is not found") + return (__cuStreamGetPriority)( + hStream, priority) + + +cdef CUresult _cuStreamGetDevice(CUstream hStream, CUdevice* device) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamGetDevice + _check_or_init_driver() + if __cuStreamGetDevice == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamGetDevice is not found") + return (__cuStreamGetDevice)( + hStream, device) + + +cdef CUresult _cuStreamGetFlags(CUstream hStream, unsigned int* flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamGetFlags + _check_or_init_driver() + if __cuStreamGetFlags == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamGetFlags is not found") + return (__cuStreamGetFlags)( + hStream, flags) + + +cdef CUresult _cuStreamGetId(CUstream hStream, unsigned long long* streamId) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamGetId + _check_or_init_driver() + if __cuStreamGetId == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamGetId is not found") + return (__cuStreamGetId)( + hStream, streamId) + + +cdef CUresult _cuStreamGetCtx(CUstream hStream, CUcontext* pctx) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamGetCtx + _check_or_init_driver() + if __cuStreamGetCtx == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamGetCtx is not found") + return (__cuStreamGetCtx)( + hStream, pctx) + + +cdef CUresult _cuStreamGetCtx_v2(CUstream hStream, CUcontext* pCtx, CUgreenCtx* pGreenCtx) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamGetCtx_v2 + _check_or_init_driver() + if __cuStreamGetCtx_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamGetCtx_v2 is not found") + return (__cuStreamGetCtx_v2)( + hStream, pCtx, pGreenCtx) + + +cdef CUresult _cuStreamWaitEvent(CUstream hStream, CUevent hEvent, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamWaitEvent + _check_or_init_driver() + if __cuStreamWaitEvent == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamWaitEvent is not found") + return (__cuStreamWaitEvent)( + hStream, hEvent, Flags) + + +cdef CUresult _cuStreamAddCallback(CUstream hStream, CUstreamCallback callback, void* userData, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamAddCallback + _check_or_init_driver() + if __cuStreamAddCallback == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamAddCallback is not found") + return (__cuStreamAddCallback)( + hStream, callback, userData, flags) + + +cdef CUresult _cuStreamBeginCapture_v2(CUstream hStream, CUstreamCaptureMode mode) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamBeginCapture_v2 + _check_or_init_driver() + if __cuStreamBeginCapture_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamBeginCapture_v2 is not found") + return (__cuStreamBeginCapture_v2)( + hStream, mode) + + +cdef CUresult _cuStreamBeginCaptureToGraph(CUstream hStream, CUgraph hGraph, const CUgraphNode* dependencies, const CUgraphEdgeData* dependencyData, size_t numDependencies, CUstreamCaptureMode mode) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamBeginCaptureToGraph + _check_or_init_driver() + if __cuStreamBeginCaptureToGraph == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamBeginCaptureToGraph is not found") + return (__cuStreamBeginCaptureToGraph)( + hStream, hGraph, dependencies, dependencyData, numDependencies, mode) + + +cdef CUresult _cuThreadExchangeStreamCaptureMode(CUstreamCaptureMode* mode) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuThreadExchangeStreamCaptureMode + _check_or_init_driver() + if __cuThreadExchangeStreamCaptureMode == NULL: + with gil: + raise FunctionNotFoundError("function cuThreadExchangeStreamCaptureMode is not found") + return (__cuThreadExchangeStreamCaptureMode)( + mode) + + +cdef CUresult _cuStreamEndCapture(CUstream hStream, CUgraph* phGraph) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamEndCapture + _check_or_init_driver() + if __cuStreamEndCapture == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamEndCapture is not found") + return (__cuStreamEndCapture)( + hStream, phGraph) + + +cdef CUresult _cuStreamIsCapturing(CUstream hStream, CUstreamCaptureStatus* captureStatus) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamIsCapturing + _check_or_init_driver() + if __cuStreamIsCapturing == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamIsCapturing is not found") + return (__cuStreamIsCapturing)( + hStream, captureStatus) + + +cdef CUresult _cuStreamGetCaptureInfo_v2(CUstream hStream, CUstreamCaptureStatus* captureStatus_out, cuuint64_t* id_out, CUgraph* graph_out, const CUgraphNode** dependencies_out, size_t* numDependencies_out) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamGetCaptureInfo_v2 + _check_or_init_driver() + if __cuStreamGetCaptureInfo_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamGetCaptureInfo_v2 is not found") + return (__cuStreamGetCaptureInfo_v2)( + hStream, captureStatus_out, id_out, graph_out, dependencies_out, numDependencies_out) + + +cdef CUresult _cuStreamGetCaptureInfo_v3(CUstream hStream, CUstreamCaptureStatus* captureStatus_out, cuuint64_t* id_out, CUgraph* graph_out, const CUgraphNode** dependencies_out, const CUgraphEdgeData** edgeData_out, size_t* numDependencies_out) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamGetCaptureInfo_v3 + _check_or_init_driver() + if __cuStreamGetCaptureInfo_v3 == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamGetCaptureInfo_v3 is not found") + return (__cuStreamGetCaptureInfo_v3)( + hStream, captureStatus_out, id_out, graph_out, dependencies_out, edgeData_out, numDependencies_out) + + +cdef CUresult _cuStreamUpdateCaptureDependencies_v2(CUstream hStream, CUgraphNode* dependencies, const CUgraphEdgeData* dependencyData, size_t numDependencies, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamUpdateCaptureDependencies_v2 + _check_or_init_driver() + if __cuStreamUpdateCaptureDependencies_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamUpdateCaptureDependencies_v2 is not found") + return (__cuStreamUpdateCaptureDependencies_v2)( + hStream, dependencies, dependencyData, numDependencies, flags) + + +cdef CUresult _cuStreamAttachMemAsync(CUstream hStream, CUdeviceptr dptr, size_t length, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamAttachMemAsync + _check_or_init_driver() + if __cuStreamAttachMemAsync == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamAttachMemAsync is not found") + return (__cuStreamAttachMemAsync)( + hStream, dptr, length, flags) + + +cdef CUresult _cuStreamQuery(CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamQuery + _check_or_init_driver() + if __cuStreamQuery == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamQuery is not found") + return (__cuStreamQuery)( + hStream) + + +cdef CUresult _cuStreamSynchronize(CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamSynchronize + _check_or_init_driver() + if __cuStreamSynchronize == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamSynchronize is not found") + return (__cuStreamSynchronize)( + hStream) + + +cdef CUresult _cuStreamDestroy_v2(CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamDestroy_v2 + _check_or_init_driver() + if __cuStreamDestroy_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamDestroy_v2 is not found") + return (__cuStreamDestroy_v2)( + hStream) + + +cdef CUresult _cuStreamCopyAttributes(CUstream dst, CUstream src) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamCopyAttributes + _check_or_init_driver() + if __cuStreamCopyAttributes == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamCopyAttributes is not found") + return (__cuStreamCopyAttributes)( + dst, src) + + +cdef CUresult _cuStreamGetAttribute(CUstream hStream, CUstreamAttrID attr, CUstreamAttrValue* value_out) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamGetAttribute + _check_or_init_driver() + if __cuStreamGetAttribute == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamGetAttribute is not found") + return (__cuStreamGetAttribute)( + hStream, attr, value_out) + + +cdef CUresult _cuStreamSetAttribute(CUstream hStream, CUstreamAttrID attr, const CUstreamAttrValue* value) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamSetAttribute + _check_or_init_driver() + if __cuStreamSetAttribute == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamSetAttribute is not found") + return (__cuStreamSetAttribute)( + hStream, attr, value) + + +cdef CUresult _cuEventCreate(CUevent* phEvent, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuEventCreate + _check_or_init_driver() + if __cuEventCreate == NULL: + with gil: + raise FunctionNotFoundError("function cuEventCreate is not found") + return (__cuEventCreate)( + phEvent, Flags) + + +cdef CUresult _cuEventRecord(CUevent hEvent, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuEventRecord + _check_or_init_driver() + if __cuEventRecord == NULL: + with gil: + raise FunctionNotFoundError("function cuEventRecord is not found") + return (__cuEventRecord)( + hEvent, hStream) + + +cdef CUresult _cuEventRecordWithFlags(CUevent hEvent, CUstream hStream, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuEventRecordWithFlags + _check_or_init_driver() + if __cuEventRecordWithFlags == NULL: + with gil: + raise FunctionNotFoundError("function cuEventRecordWithFlags is not found") + return (__cuEventRecordWithFlags)( + hEvent, hStream, flags) + + +cdef CUresult _cuEventQuery(CUevent hEvent) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuEventQuery + _check_or_init_driver() + if __cuEventQuery == NULL: + with gil: + raise FunctionNotFoundError("function cuEventQuery is not found") + return (__cuEventQuery)( + hEvent) + + +cdef CUresult _cuEventSynchronize(CUevent hEvent) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuEventSynchronize + _check_or_init_driver() + if __cuEventSynchronize == NULL: + with gil: + raise FunctionNotFoundError("function cuEventSynchronize is not found") + return (__cuEventSynchronize)( + hEvent) + + +cdef CUresult _cuEventDestroy_v2(CUevent hEvent) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuEventDestroy_v2 + _check_or_init_driver() + if __cuEventDestroy_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuEventDestroy_v2 is not found") + return (__cuEventDestroy_v2)( + hEvent) + + +cdef CUresult _cuEventElapsedTime_v2(float* pMilliseconds, CUevent hStart, CUevent hEnd) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuEventElapsedTime_v2 + _check_or_init_driver() + if __cuEventElapsedTime_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuEventElapsedTime_v2 is not found") + return (__cuEventElapsedTime_v2)( + pMilliseconds, hStart, hEnd) + + +cdef CUresult _cuImportExternalMemory(CUexternalMemory* extMem_out, const CUDA_EXTERNAL_MEMORY_HANDLE_DESC* memHandleDesc) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuImportExternalMemory + _check_or_init_driver() + if __cuImportExternalMemory == NULL: + with gil: + raise FunctionNotFoundError("function cuImportExternalMemory is not found") + return (__cuImportExternalMemory)( + extMem_out, memHandleDesc) + + +cdef CUresult _cuExternalMemoryGetMappedBuffer(CUdeviceptr* devPtr, CUexternalMemory extMem, const CUDA_EXTERNAL_MEMORY_BUFFER_DESC* bufferDesc) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuExternalMemoryGetMappedBuffer + _check_or_init_driver() + if __cuExternalMemoryGetMappedBuffer == NULL: + with gil: + raise FunctionNotFoundError("function cuExternalMemoryGetMappedBuffer is not found") + return (__cuExternalMemoryGetMappedBuffer)( + devPtr, extMem, bufferDesc) + + +cdef CUresult _cuExternalMemoryGetMappedMipmappedArray(CUmipmappedArray* mipmap, CUexternalMemory extMem, const CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC* mipmapDesc) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuExternalMemoryGetMappedMipmappedArray + _check_or_init_driver() + if __cuExternalMemoryGetMappedMipmappedArray == NULL: + with gil: + raise FunctionNotFoundError("function cuExternalMemoryGetMappedMipmappedArray is not found") + return (__cuExternalMemoryGetMappedMipmappedArray)( + mipmap, extMem, mipmapDesc) + + +cdef CUresult _cuDestroyExternalMemory(CUexternalMemory extMem) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDestroyExternalMemory + _check_or_init_driver() + if __cuDestroyExternalMemory == NULL: + with gil: + raise FunctionNotFoundError("function cuDestroyExternalMemory is not found") + return (__cuDestroyExternalMemory)( + extMem) + + +cdef CUresult _cuImportExternalSemaphore(CUexternalSemaphore* extSem_out, const CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC* semHandleDesc) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuImportExternalSemaphore + _check_or_init_driver() + if __cuImportExternalSemaphore == NULL: + with gil: + raise FunctionNotFoundError("function cuImportExternalSemaphore is not found") + return (__cuImportExternalSemaphore)( + extSem_out, semHandleDesc) + + +cdef CUresult _cuSignalExternalSemaphoresAsync(const CUexternalSemaphore* extSemArray, const CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS* paramsArray, unsigned int numExtSems, CUstream stream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuSignalExternalSemaphoresAsync + _check_or_init_driver() + if __cuSignalExternalSemaphoresAsync == NULL: + with gil: + raise FunctionNotFoundError("function cuSignalExternalSemaphoresAsync is not found") + return (__cuSignalExternalSemaphoresAsync)( + extSemArray, paramsArray, numExtSems, stream) + + +cdef CUresult _cuWaitExternalSemaphoresAsync(const CUexternalSemaphore* extSemArray, const CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS* paramsArray, unsigned int numExtSems, CUstream stream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuWaitExternalSemaphoresAsync + _check_or_init_driver() + if __cuWaitExternalSemaphoresAsync == NULL: + with gil: + raise FunctionNotFoundError("function cuWaitExternalSemaphoresAsync is not found") + return (__cuWaitExternalSemaphoresAsync)( + extSemArray, paramsArray, numExtSems, stream) + + +cdef CUresult _cuDestroyExternalSemaphore(CUexternalSemaphore extSem) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDestroyExternalSemaphore + _check_or_init_driver() + if __cuDestroyExternalSemaphore == NULL: + with gil: + raise FunctionNotFoundError("function cuDestroyExternalSemaphore is not found") + return (__cuDestroyExternalSemaphore)( + extSem) + + +cdef CUresult _cuStreamWaitValue32_v2(CUstream stream, CUdeviceptr addr, cuuint32_t value, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamWaitValue32_v2 + _check_or_init_driver() + if __cuStreamWaitValue32_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamWaitValue32_v2 is not found") + return (__cuStreamWaitValue32_v2)( + stream, addr, value, flags) + + +cdef CUresult _cuStreamWaitValue64_v2(CUstream stream, CUdeviceptr addr, cuuint64_t value, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamWaitValue64_v2 + _check_or_init_driver() + if __cuStreamWaitValue64_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamWaitValue64_v2 is not found") + return (__cuStreamWaitValue64_v2)( + stream, addr, value, flags) + + +cdef CUresult _cuStreamWriteValue32_v2(CUstream stream, CUdeviceptr addr, cuuint32_t value, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamWriteValue32_v2 + _check_or_init_driver() + if __cuStreamWriteValue32_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamWriteValue32_v2 is not found") + return (__cuStreamWriteValue32_v2)( + stream, addr, value, flags) + + +cdef CUresult _cuStreamWriteValue64_v2(CUstream stream, CUdeviceptr addr, cuuint64_t value, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamWriteValue64_v2 + _check_or_init_driver() + if __cuStreamWriteValue64_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamWriteValue64_v2 is not found") + return (__cuStreamWriteValue64_v2)( + stream, addr, value, flags) + + +cdef CUresult _cuStreamBatchMemOp_v2(CUstream stream, unsigned int count, CUstreamBatchMemOpParams* paramArray, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamBatchMemOp_v2 + _check_or_init_driver() + if __cuStreamBatchMemOp_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamBatchMemOp_v2 is not found") + return (__cuStreamBatchMemOp_v2)( + stream, count, paramArray, flags) + + +cdef CUresult _cuFuncGetAttribute(int* pi, CUfunction_attribute attrib, CUfunction hfunc) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuFuncGetAttribute + _check_or_init_driver() + if __cuFuncGetAttribute == NULL: + with gil: + raise FunctionNotFoundError("function cuFuncGetAttribute is not found") + return (__cuFuncGetAttribute)( + pi, attrib, hfunc) + + +cdef CUresult _cuFuncSetAttribute(CUfunction hfunc, CUfunction_attribute attrib, int value) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuFuncSetAttribute + _check_or_init_driver() + if __cuFuncSetAttribute == NULL: + with gil: + raise FunctionNotFoundError("function cuFuncSetAttribute is not found") + return (__cuFuncSetAttribute)( + hfunc, attrib, value) + + +cdef CUresult _cuFuncSetCacheConfig(CUfunction hfunc, CUfunc_cache config) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuFuncSetCacheConfig + _check_or_init_driver() + if __cuFuncSetCacheConfig == NULL: + with gil: + raise FunctionNotFoundError("function cuFuncSetCacheConfig is not found") + return (__cuFuncSetCacheConfig)( + hfunc, config) + + +cdef CUresult _cuFuncGetModule(CUmodule* hmod, CUfunction hfunc) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuFuncGetModule + _check_or_init_driver() + if __cuFuncGetModule == NULL: + with gil: + raise FunctionNotFoundError("function cuFuncGetModule is not found") + return (__cuFuncGetModule)( + hmod, hfunc) + + +cdef CUresult _cuFuncGetName(const char** name, CUfunction hfunc) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuFuncGetName + _check_or_init_driver() + if __cuFuncGetName == NULL: + with gil: + raise FunctionNotFoundError("function cuFuncGetName is not found") + return (__cuFuncGetName)( + name, hfunc) + + +cdef CUresult _cuFuncGetParamInfo(CUfunction func, size_t paramIndex, size_t* paramOffset, size_t* paramSize) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuFuncGetParamInfo + _check_or_init_driver() + if __cuFuncGetParamInfo == NULL: + with gil: + raise FunctionNotFoundError("function cuFuncGetParamInfo is not found") + return (__cuFuncGetParamInfo)( + func, paramIndex, paramOffset, paramSize) + + +cdef CUresult _cuFuncIsLoaded(CUfunctionLoadingState* state, CUfunction function) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuFuncIsLoaded + _check_or_init_driver() + if __cuFuncIsLoaded == NULL: + with gil: + raise FunctionNotFoundError("function cuFuncIsLoaded is not found") + return (__cuFuncIsLoaded)( + state, function) + + +cdef CUresult _cuFuncLoad(CUfunction function) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuFuncLoad + _check_or_init_driver() + if __cuFuncLoad == NULL: + with gil: + raise FunctionNotFoundError("function cuFuncLoad is not found") + return (__cuFuncLoad)( + function) + + +cdef CUresult _cuLaunchKernel(CUfunction f, unsigned int gridDimX, unsigned int gridDimY, unsigned int gridDimZ, unsigned int blockDimX, unsigned int blockDimY, unsigned int blockDimZ, unsigned int sharedMemBytes, CUstream hStream, void** kernelParams, void** extra) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLaunchKernel + _check_or_init_driver() + if __cuLaunchKernel == NULL: + with gil: + raise FunctionNotFoundError("function cuLaunchKernel is not found") + return (__cuLaunchKernel)( + f, gridDimX, gridDimY, gridDimZ, blockDimX, blockDimY, blockDimZ, sharedMemBytes, hStream, kernelParams, extra) + + +cdef CUresult _cuLaunchKernelEx(const CUlaunchConfig* config, CUfunction f, void** kernelParams, void** extra) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLaunchKernelEx + _check_or_init_driver() + if __cuLaunchKernelEx == NULL: + with gil: + raise FunctionNotFoundError("function cuLaunchKernelEx is not found") + return (__cuLaunchKernelEx)( + config, f, kernelParams, extra) + + +cdef CUresult _cuLaunchCooperativeKernel(CUfunction f, unsigned int gridDimX, unsigned int gridDimY, unsigned int gridDimZ, unsigned int blockDimX, unsigned int blockDimY, unsigned int blockDimZ, unsigned int sharedMemBytes, CUstream hStream, void** kernelParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLaunchCooperativeKernel + _check_or_init_driver() + if __cuLaunchCooperativeKernel == NULL: + with gil: + raise FunctionNotFoundError("function cuLaunchCooperativeKernel is not found") + return (__cuLaunchCooperativeKernel)( + f, gridDimX, gridDimY, gridDimZ, blockDimX, blockDimY, blockDimZ, sharedMemBytes, hStream, kernelParams) + + +cdef CUresult _cuLaunchCooperativeKernelMultiDevice(CUDA_LAUNCH_PARAMS* launchParamsList, unsigned int numDevices, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLaunchCooperativeKernelMultiDevice + _check_or_init_driver() + if __cuLaunchCooperativeKernelMultiDevice == NULL: + with gil: + raise FunctionNotFoundError("function cuLaunchCooperativeKernelMultiDevice is not found") + return (__cuLaunchCooperativeKernelMultiDevice)( + launchParamsList, numDevices, flags) + + +cdef CUresult _cuLaunchHostFunc(CUstream hStream, CUhostFn fn, void* userData) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLaunchHostFunc + _check_or_init_driver() + if __cuLaunchHostFunc == NULL: + with gil: + raise FunctionNotFoundError("function cuLaunchHostFunc is not found") + return (__cuLaunchHostFunc)( + hStream, fn, userData) + + +cdef CUresult _cuFuncSetBlockShape(CUfunction hfunc, int x, int y, int z) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuFuncSetBlockShape + _check_or_init_driver() + if __cuFuncSetBlockShape == NULL: + with gil: + raise FunctionNotFoundError("function cuFuncSetBlockShape is not found") + return (__cuFuncSetBlockShape)( + hfunc, x, y, z) + + +cdef CUresult _cuFuncSetSharedSize(CUfunction hfunc, unsigned int bytes) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuFuncSetSharedSize + _check_or_init_driver() + if __cuFuncSetSharedSize == NULL: + with gil: + raise FunctionNotFoundError("function cuFuncSetSharedSize is not found") + return (__cuFuncSetSharedSize)( + hfunc, bytes) + + +cdef CUresult _cuParamSetSize(CUfunction hfunc, unsigned int numbytes) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuParamSetSize + _check_or_init_driver() + if __cuParamSetSize == NULL: + with gil: + raise FunctionNotFoundError("function cuParamSetSize is not found") + return (__cuParamSetSize)( + hfunc, numbytes) + + +cdef CUresult _cuParamSeti(CUfunction hfunc, int offset, unsigned int value) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuParamSeti + _check_or_init_driver() + if __cuParamSeti == NULL: + with gil: + raise FunctionNotFoundError("function cuParamSeti is not found") + return (__cuParamSeti)( + hfunc, offset, value) + + +cdef CUresult _cuParamSetf(CUfunction hfunc, int offset, float value) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuParamSetf + _check_or_init_driver() + if __cuParamSetf == NULL: + with gil: + raise FunctionNotFoundError("function cuParamSetf is not found") + return (__cuParamSetf)( + hfunc, offset, value) + + +cdef CUresult _cuParamSetv(CUfunction hfunc, int offset, void* ptr, unsigned int numbytes) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuParamSetv + _check_or_init_driver() + if __cuParamSetv == NULL: + with gil: + raise FunctionNotFoundError("function cuParamSetv is not found") + return (__cuParamSetv)( + hfunc, offset, ptr, numbytes) + + +cdef CUresult _cuLaunch(CUfunction f) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLaunch + _check_or_init_driver() + if __cuLaunch == NULL: + with gil: + raise FunctionNotFoundError("function cuLaunch is not found") + return (__cuLaunch)( + f) + + +cdef CUresult _cuLaunchGrid(CUfunction f, int grid_width, int grid_height) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLaunchGrid + _check_or_init_driver() + if __cuLaunchGrid == NULL: + with gil: + raise FunctionNotFoundError("function cuLaunchGrid is not found") + return (__cuLaunchGrid)( + f, grid_width, grid_height) + + +cdef CUresult _cuLaunchGridAsync(CUfunction f, int grid_width, int grid_height, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLaunchGridAsync + _check_or_init_driver() + if __cuLaunchGridAsync == NULL: + with gil: + raise FunctionNotFoundError("function cuLaunchGridAsync is not found") + return (__cuLaunchGridAsync)( + f, grid_width, grid_height, hStream) + + +cdef CUresult _cuParamSetTexRef(CUfunction hfunc, int texunit, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuParamSetTexRef + _check_or_init_driver() + if __cuParamSetTexRef == NULL: + with gil: + raise FunctionNotFoundError("function cuParamSetTexRef is not found") + return (__cuParamSetTexRef)( + hfunc, texunit, hTexRef) + + +cdef CUresult _cuFuncSetSharedMemConfig(CUfunction hfunc, CUsharedconfig config) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuFuncSetSharedMemConfig + _check_or_init_driver() + if __cuFuncSetSharedMemConfig == NULL: + with gil: + raise FunctionNotFoundError("function cuFuncSetSharedMemConfig is not found") + return (__cuFuncSetSharedMemConfig)( + hfunc, config) + + +cdef CUresult _cuGraphCreate(CUgraph* phGraph, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphCreate + _check_or_init_driver() + if __cuGraphCreate == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphCreate is not found") + return (__cuGraphCreate)( + phGraph, flags) + + +cdef CUresult _cuGraphAddKernelNode_v2(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, const CUDA_KERNEL_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphAddKernelNode_v2 + _check_or_init_driver() + if __cuGraphAddKernelNode_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphAddKernelNode_v2 is not found") + return (__cuGraphAddKernelNode_v2)( + phGraphNode, hGraph, dependencies, numDependencies, nodeParams) + + +cdef CUresult _cuGraphKernelNodeGetParams_v2(CUgraphNode hNode, CUDA_KERNEL_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphKernelNodeGetParams_v2 + _check_or_init_driver() + if __cuGraphKernelNodeGetParams_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphKernelNodeGetParams_v2 is not found") + return (__cuGraphKernelNodeGetParams_v2)( + hNode, nodeParams) + + +cdef CUresult _cuGraphKernelNodeSetParams_v2(CUgraphNode hNode, const CUDA_KERNEL_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphKernelNodeSetParams_v2 + _check_or_init_driver() + if __cuGraphKernelNodeSetParams_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphKernelNodeSetParams_v2 is not found") + return (__cuGraphKernelNodeSetParams_v2)( + hNode, nodeParams) + + +cdef CUresult _cuGraphAddMemcpyNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, const CUDA_MEMCPY3D* copyParams, CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphAddMemcpyNode + _check_or_init_driver() + if __cuGraphAddMemcpyNode == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphAddMemcpyNode is not found") + return (__cuGraphAddMemcpyNode)( + phGraphNode, hGraph, dependencies, numDependencies, copyParams, ctx) + + +cdef CUresult _cuGraphMemcpyNodeGetParams(CUgraphNode hNode, CUDA_MEMCPY3D* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphMemcpyNodeGetParams + _check_or_init_driver() + if __cuGraphMemcpyNodeGetParams == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphMemcpyNodeGetParams is not found") + return (__cuGraphMemcpyNodeGetParams)( + hNode, nodeParams) + + +cdef CUresult _cuGraphMemcpyNodeSetParams(CUgraphNode hNode, const CUDA_MEMCPY3D* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphMemcpyNodeSetParams + _check_or_init_driver() + if __cuGraphMemcpyNodeSetParams == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphMemcpyNodeSetParams is not found") + return (__cuGraphMemcpyNodeSetParams)( + hNode, nodeParams) + + +cdef CUresult _cuGraphAddMemsetNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, const CUDA_MEMSET_NODE_PARAMS* memsetParams, CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphAddMemsetNode + _check_or_init_driver() + if __cuGraphAddMemsetNode == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphAddMemsetNode is not found") + return (__cuGraphAddMemsetNode)( + phGraphNode, hGraph, dependencies, numDependencies, memsetParams, ctx) + + +cdef CUresult _cuGraphMemsetNodeGetParams(CUgraphNode hNode, CUDA_MEMSET_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphMemsetNodeGetParams + _check_or_init_driver() + if __cuGraphMemsetNodeGetParams == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphMemsetNodeGetParams is not found") + return (__cuGraphMemsetNodeGetParams)( + hNode, nodeParams) + + +cdef CUresult _cuGraphMemsetNodeSetParams(CUgraphNode hNode, const CUDA_MEMSET_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphMemsetNodeSetParams + _check_or_init_driver() + if __cuGraphMemsetNodeSetParams == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphMemsetNodeSetParams is not found") + return (__cuGraphMemsetNodeSetParams)( + hNode, nodeParams) + + +cdef CUresult _cuGraphAddHostNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, const CUDA_HOST_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphAddHostNode + _check_or_init_driver() + if __cuGraphAddHostNode == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphAddHostNode is not found") + return (__cuGraphAddHostNode)( + phGraphNode, hGraph, dependencies, numDependencies, nodeParams) + + +cdef CUresult _cuGraphHostNodeGetParams(CUgraphNode hNode, CUDA_HOST_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphHostNodeGetParams + _check_or_init_driver() + if __cuGraphHostNodeGetParams == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphHostNodeGetParams is not found") + return (__cuGraphHostNodeGetParams)( + hNode, nodeParams) + + +cdef CUresult _cuGraphHostNodeSetParams(CUgraphNode hNode, const CUDA_HOST_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphHostNodeSetParams + _check_or_init_driver() + if __cuGraphHostNodeSetParams == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphHostNodeSetParams is not found") + return (__cuGraphHostNodeSetParams)( + hNode, nodeParams) + + +cdef CUresult _cuGraphAddChildGraphNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, CUgraph childGraph) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphAddChildGraphNode + _check_or_init_driver() + if __cuGraphAddChildGraphNode == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphAddChildGraphNode is not found") + return (__cuGraphAddChildGraphNode)( + phGraphNode, hGraph, dependencies, numDependencies, childGraph) + + +cdef CUresult _cuGraphChildGraphNodeGetGraph(CUgraphNode hNode, CUgraph* phGraph) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphChildGraphNodeGetGraph + _check_or_init_driver() + if __cuGraphChildGraphNodeGetGraph == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphChildGraphNodeGetGraph is not found") + return (__cuGraphChildGraphNodeGetGraph)( + hNode, phGraph) + + +cdef CUresult _cuGraphAddEmptyNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphAddEmptyNode + _check_or_init_driver() + if __cuGraphAddEmptyNode == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphAddEmptyNode is not found") + return (__cuGraphAddEmptyNode)( + phGraphNode, hGraph, dependencies, numDependencies) + + +cdef CUresult _cuGraphAddEventRecordNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, CUevent event) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphAddEventRecordNode + _check_or_init_driver() + if __cuGraphAddEventRecordNode == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphAddEventRecordNode is not found") + return (__cuGraphAddEventRecordNode)( + phGraphNode, hGraph, dependencies, numDependencies, event) + + +cdef CUresult _cuGraphEventRecordNodeGetEvent(CUgraphNode hNode, CUevent* event_out) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphEventRecordNodeGetEvent + _check_or_init_driver() + if __cuGraphEventRecordNodeGetEvent == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphEventRecordNodeGetEvent is not found") + return (__cuGraphEventRecordNodeGetEvent)( + hNode, event_out) + + +cdef CUresult _cuGraphEventRecordNodeSetEvent(CUgraphNode hNode, CUevent event) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphEventRecordNodeSetEvent + _check_or_init_driver() + if __cuGraphEventRecordNodeSetEvent == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphEventRecordNodeSetEvent is not found") + return (__cuGraphEventRecordNodeSetEvent)( + hNode, event) + + +cdef CUresult _cuGraphAddEventWaitNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, CUevent event) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphAddEventWaitNode + _check_or_init_driver() + if __cuGraphAddEventWaitNode == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphAddEventWaitNode is not found") + return (__cuGraphAddEventWaitNode)( + phGraphNode, hGraph, dependencies, numDependencies, event) + + +cdef CUresult _cuGraphEventWaitNodeGetEvent(CUgraphNode hNode, CUevent* event_out) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphEventWaitNodeGetEvent + _check_or_init_driver() + if __cuGraphEventWaitNodeGetEvent == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphEventWaitNodeGetEvent is not found") + return (__cuGraphEventWaitNodeGetEvent)( + hNode, event_out) + + +cdef CUresult _cuGraphEventWaitNodeSetEvent(CUgraphNode hNode, CUevent event) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphEventWaitNodeSetEvent + _check_or_init_driver() + if __cuGraphEventWaitNodeSetEvent == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphEventWaitNodeSetEvent is not found") + return (__cuGraphEventWaitNodeSetEvent)( + hNode, event) + + +cdef CUresult _cuGraphAddExternalSemaphoresSignalNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, const CUDA_EXT_SEM_SIGNAL_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphAddExternalSemaphoresSignalNode + _check_or_init_driver() + if __cuGraphAddExternalSemaphoresSignalNode == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphAddExternalSemaphoresSignalNode is not found") + return (__cuGraphAddExternalSemaphoresSignalNode)( + phGraphNode, hGraph, dependencies, numDependencies, nodeParams) + + +cdef CUresult _cuGraphExternalSemaphoresSignalNodeGetParams(CUgraphNode hNode, CUDA_EXT_SEM_SIGNAL_NODE_PARAMS* params_out) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphExternalSemaphoresSignalNodeGetParams + _check_or_init_driver() + if __cuGraphExternalSemaphoresSignalNodeGetParams == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphExternalSemaphoresSignalNodeGetParams is not found") + return (__cuGraphExternalSemaphoresSignalNodeGetParams)( + hNode, params_out) + + +cdef CUresult _cuGraphExternalSemaphoresSignalNodeSetParams(CUgraphNode hNode, const CUDA_EXT_SEM_SIGNAL_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphExternalSemaphoresSignalNodeSetParams + _check_or_init_driver() + if __cuGraphExternalSemaphoresSignalNodeSetParams == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphExternalSemaphoresSignalNodeSetParams is not found") + return (__cuGraphExternalSemaphoresSignalNodeSetParams)( + hNode, nodeParams) + + +cdef CUresult _cuGraphAddExternalSemaphoresWaitNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, const CUDA_EXT_SEM_WAIT_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphAddExternalSemaphoresWaitNode + _check_or_init_driver() + if __cuGraphAddExternalSemaphoresWaitNode == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphAddExternalSemaphoresWaitNode is not found") + return (__cuGraphAddExternalSemaphoresWaitNode)( + phGraphNode, hGraph, dependencies, numDependencies, nodeParams) + + +cdef CUresult _cuGraphExternalSemaphoresWaitNodeGetParams(CUgraphNode hNode, CUDA_EXT_SEM_WAIT_NODE_PARAMS* params_out) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphExternalSemaphoresWaitNodeGetParams + _check_or_init_driver() + if __cuGraphExternalSemaphoresWaitNodeGetParams == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphExternalSemaphoresWaitNodeGetParams is not found") + return (__cuGraphExternalSemaphoresWaitNodeGetParams)( + hNode, params_out) + + +cdef CUresult _cuGraphExternalSemaphoresWaitNodeSetParams(CUgraphNode hNode, const CUDA_EXT_SEM_WAIT_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphExternalSemaphoresWaitNodeSetParams + _check_or_init_driver() + if __cuGraphExternalSemaphoresWaitNodeSetParams == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphExternalSemaphoresWaitNodeSetParams is not found") + return (__cuGraphExternalSemaphoresWaitNodeSetParams)( + hNode, nodeParams) + + +cdef CUresult _cuGraphAddBatchMemOpNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, const CUDA_BATCH_MEM_OP_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphAddBatchMemOpNode + _check_or_init_driver() + if __cuGraphAddBatchMemOpNode == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphAddBatchMemOpNode is not found") + return (__cuGraphAddBatchMemOpNode)( + phGraphNode, hGraph, dependencies, numDependencies, nodeParams) + + +cdef CUresult _cuGraphBatchMemOpNodeGetParams(CUgraphNode hNode, CUDA_BATCH_MEM_OP_NODE_PARAMS* nodeParams_out) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphBatchMemOpNodeGetParams + _check_or_init_driver() + if __cuGraphBatchMemOpNodeGetParams == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphBatchMemOpNodeGetParams is not found") + return (__cuGraphBatchMemOpNodeGetParams)( + hNode, nodeParams_out) + + +cdef CUresult _cuGraphBatchMemOpNodeSetParams(CUgraphNode hNode, const CUDA_BATCH_MEM_OP_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphBatchMemOpNodeSetParams + _check_or_init_driver() + if __cuGraphBatchMemOpNodeSetParams == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphBatchMemOpNodeSetParams is not found") + return (__cuGraphBatchMemOpNodeSetParams)( + hNode, nodeParams) + + +cdef CUresult _cuGraphExecBatchMemOpNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_BATCH_MEM_OP_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphExecBatchMemOpNodeSetParams + _check_or_init_driver() + if __cuGraphExecBatchMemOpNodeSetParams == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphExecBatchMemOpNodeSetParams is not found") + return (__cuGraphExecBatchMemOpNodeSetParams)( + hGraphExec, hNode, nodeParams) + + +cdef CUresult _cuGraphAddMemAllocNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, CUDA_MEM_ALLOC_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphAddMemAllocNode + _check_or_init_driver() + if __cuGraphAddMemAllocNode == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphAddMemAllocNode is not found") + return (__cuGraphAddMemAllocNode)( + phGraphNode, hGraph, dependencies, numDependencies, nodeParams) + + +cdef CUresult _cuGraphMemAllocNodeGetParams(CUgraphNode hNode, CUDA_MEM_ALLOC_NODE_PARAMS* params_out) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphMemAllocNodeGetParams + _check_or_init_driver() + if __cuGraphMemAllocNodeGetParams == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphMemAllocNodeGetParams is not found") + return (__cuGraphMemAllocNodeGetParams)( + hNode, params_out) + + +cdef CUresult _cuGraphAddMemFreeNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, CUdeviceptr dptr) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphAddMemFreeNode + _check_or_init_driver() + if __cuGraphAddMemFreeNode == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphAddMemFreeNode is not found") + return (__cuGraphAddMemFreeNode)( + phGraphNode, hGraph, dependencies, numDependencies, dptr) + + +cdef CUresult _cuGraphMemFreeNodeGetParams(CUgraphNode hNode, CUdeviceptr* dptr_out) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphMemFreeNodeGetParams + _check_or_init_driver() + if __cuGraphMemFreeNodeGetParams == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphMemFreeNodeGetParams is not found") + return (__cuGraphMemFreeNodeGetParams)( + hNode, dptr_out) + + +cdef CUresult _cuDeviceGraphMemTrim(CUdevice device) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDeviceGraphMemTrim + _check_or_init_driver() + if __cuDeviceGraphMemTrim == NULL: + with gil: + raise FunctionNotFoundError("function cuDeviceGraphMemTrim is not found") + return (__cuDeviceGraphMemTrim)( + device) + + +cdef CUresult _cuDeviceGetGraphMemAttribute(CUdevice device, CUgraphMem_attribute attr, void* value) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDeviceGetGraphMemAttribute + _check_or_init_driver() + if __cuDeviceGetGraphMemAttribute == NULL: + with gil: + raise FunctionNotFoundError("function cuDeviceGetGraphMemAttribute is not found") + return (__cuDeviceGetGraphMemAttribute)( + device, attr, value) + + +cdef CUresult _cuDeviceSetGraphMemAttribute(CUdevice device, CUgraphMem_attribute attr, void* value) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDeviceSetGraphMemAttribute + _check_or_init_driver() + if __cuDeviceSetGraphMemAttribute == NULL: + with gil: + raise FunctionNotFoundError("function cuDeviceSetGraphMemAttribute is not found") + return (__cuDeviceSetGraphMemAttribute)( + device, attr, value) + + +cdef CUresult _cuGraphClone(CUgraph* phGraphClone, CUgraph originalGraph) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphClone + _check_or_init_driver() + if __cuGraphClone == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphClone is not found") + return (__cuGraphClone)( + phGraphClone, originalGraph) + + +cdef CUresult _cuGraphNodeFindInClone(CUgraphNode* phNode, CUgraphNode hOriginalNode, CUgraph hClonedGraph) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphNodeFindInClone + _check_or_init_driver() + if __cuGraphNodeFindInClone == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphNodeFindInClone is not found") + return (__cuGraphNodeFindInClone)( + phNode, hOriginalNode, hClonedGraph) + + +cdef CUresult _cuGraphNodeGetType(CUgraphNode hNode, CUgraphNodeType* type) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphNodeGetType + _check_or_init_driver() + if __cuGraphNodeGetType == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphNodeGetType is not found") + return (__cuGraphNodeGetType)( + hNode, type) + + +cdef CUresult _cuGraphGetNodes(CUgraph hGraph, CUgraphNode* nodes, size_t* numNodes) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphGetNodes + _check_or_init_driver() + if __cuGraphGetNodes == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphGetNodes is not found") + return (__cuGraphGetNodes)( + hGraph, nodes, numNodes) + + +cdef CUresult _cuGraphGetRootNodes(CUgraph hGraph, CUgraphNode* rootNodes, size_t* numRootNodes) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphGetRootNodes + _check_or_init_driver() + if __cuGraphGetRootNodes == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphGetRootNodes is not found") + return (__cuGraphGetRootNodes)( + hGraph, rootNodes, numRootNodes) + + +cdef CUresult _cuGraphGetEdges_v2(CUgraph hGraph, CUgraphNode* from_, CUgraphNode* to, CUgraphEdgeData* edgeData, size_t* numEdges) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphGetEdges_v2 + _check_or_init_driver() + if __cuGraphGetEdges_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphGetEdges_v2 is not found") + return (__cuGraphGetEdges_v2)( + hGraph, from_, to, edgeData, numEdges) + + +cdef CUresult _cuGraphNodeGetDependencies_v2(CUgraphNode hNode, CUgraphNode* dependencies, CUgraphEdgeData* edgeData, size_t* numDependencies) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphNodeGetDependencies_v2 + _check_or_init_driver() + if __cuGraphNodeGetDependencies_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphNodeGetDependencies_v2 is not found") + return (__cuGraphNodeGetDependencies_v2)( + hNode, dependencies, edgeData, numDependencies) + + +cdef CUresult _cuGraphNodeGetDependentNodes_v2(CUgraphNode hNode, CUgraphNode* dependentNodes, CUgraphEdgeData* edgeData, size_t* numDependentNodes) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphNodeGetDependentNodes_v2 + _check_or_init_driver() + if __cuGraphNodeGetDependentNodes_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphNodeGetDependentNodes_v2 is not found") + return (__cuGraphNodeGetDependentNodes_v2)( + hNode, dependentNodes, edgeData, numDependentNodes) + + +cdef CUresult _cuGraphAddDependencies_v2(CUgraph hGraph, const CUgraphNode* from_, const CUgraphNode* to, const CUgraphEdgeData* edgeData, size_t numDependencies) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphAddDependencies_v2 + _check_or_init_driver() + if __cuGraphAddDependencies_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphAddDependencies_v2 is not found") + return (__cuGraphAddDependencies_v2)( + hGraph, from_, to, edgeData, numDependencies) + + +cdef CUresult _cuGraphRemoveDependencies_v2(CUgraph hGraph, const CUgraphNode* from_, const CUgraphNode* to, const CUgraphEdgeData* edgeData, size_t numDependencies) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphRemoveDependencies_v2 + _check_or_init_driver() + if __cuGraphRemoveDependencies_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphRemoveDependencies_v2 is not found") + return (__cuGraphRemoveDependencies_v2)( + hGraph, from_, to, edgeData, numDependencies) + + +cdef CUresult _cuGraphDestroyNode(CUgraphNode hNode) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphDestroyNode + _check_or_init_driver() + if __cuGraphDestroyNode == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphDestroyNode is not found") + return (__cuGraphDestroyNode)( + hNode) + + +cdef CUresult _cuGraphInstantiateWithFlags(CUgraphExec* phGraphExec, CUgraph hGraph, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphInstantiateWithFlags + _check_or_init_driver() + if __cuGraphInstantiateWithFlags == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphInstantiateWithFlags is not found") + return (__cuGraphInstantiateWithFlags)( + phGraphExec, hGraph, flags) + + +cdef CUresult _cuGraphInstantiateWithParams(CUgraphExec* phGraphExec, CUgraph hGraph, CUDA_GRAPH_INSTANTIATE_PARAMS* instantiateParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphInstantiateWithParams + _check_or_init_driver() + if __cuGraphInstantiateWithParams == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphInstantiateWithParams is not found") + return (__cuGraphInstantiateWithParams)( + phGraphExec, hGraph, instantiateParams) + + +cdef CUresult _cuGraphExecGetFlags(CUgraphExec hGraphExec, cuuint64_t* flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphExecGetFlags + _check_or_init_driver() + if __cuGraphExecGetFlags == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphExecGetFlags is not found") + return (__cuGraphExecGetFlags)( + hGraphExec, flags) + + +cdef CUresult _cuGraphExecKernelNodeSetParams_v2(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_KERNEL_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphExecKernelNodeSetParams_v2 + _check_or_init_driver() + if __cuGraphExecKernelNodeSetParams_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphExecKernelNodeSetParams_v2 is not found") + return (__cuGraphExecKernelNodeSetParams_v2)( + hGraphExec, hNode, nodeParams) + + +cdef CUresult _cuGraphExecMemcpyNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_MEMCPY3D* copyParams, CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphExecMemcpyNodeSetParams + _check_or_init_driver() + if __cuGraphExecMemcpyNodeSetParams == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphExecMemcpyNodeSetParams is not found") + return (__cuGraphExecMemcpyNodeSetParams)( + hGraphExec, hNode, copyParams, ctx) + + +cdef CUresult _cuGraphExecMemsetNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_MEMSET_NODE_PARAMS* memsetParams, CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphExecMemsetNodeSetParams + _check_or_init_driver() + if __cuGraphExecMemsetNodeSetParams == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphExecMemsetNodeSetParams is not found") + return (__cuGraphExecMemsetNodeSetParams)( + hGraphExec, hNode, memsetParams, ctx) + + +cdef CUresult _cuGraphExecHostNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_HOST_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphExecHostNodeSetParams + _check_or_init_driver() + if __cuGraphExecHostNodeSetParams == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphExecHostNodeSetParams is not found") + return (__cuGraphExecHostNodeSetParams)( + hGraphExec, hNode, nodeParams) + + +cdef CUresult _cuGraphExecChildGraphNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, CUgraph childGraph) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphExecChildGraphNodeSetParams + _check_or_init_driver() + if __cuGraphExecChildGraphNodeSetParams == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphExecChildGraphNodeSetParams is not found") + return (__cuGraphExecChildGraphNodeSetParams)( + hGraphExec, hNode, childGraph) + + +cdef CUresult _cuGraphExecEventRecordNodeSetEvent(CUgraphExec hGraphExec, CUgraphNode hNode, CUevent event) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphExecEventRecordNodeSetEvent + _check_or_init_driver() + if __cuGraphExecEventRecordNodeSetEvent == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphExecEventRecordNodeSetEvent is not found") + return (__cuGraphExecEventRecordNodeSetEvent)( + hGraphExec, hNode, event) + + +cdef CUresult _cuGraphExecEventWaitNodeSetEvent(CUgraphExec hGraphExec, CUgraphNode hNode, CUevent event) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphExecEventWaitNodeSetEvent + _check_or_init_driver() + if __cuGraphExecEventWaitNodeSetEvent == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphExecEventWaitNodeSetEvent is not found") + return (__cuGraphExecEventWaitNodeSetEvent)( + hGraphExec, hNode, event) + + +cdef CUresult _cuGraphExecExternalSemaphoresSignalNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_EXT_SEM_SIGNAL_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphExecExternalSemaphoresSignalNodeSetParams + _check_or_init_driver() + if __cuGraphExecExternalSemaphoresSignalNodeSetParams == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphExecExternalSemaphoresSignalNodeSetParams is not found") + return (__cuGraphExecExternalSemaphoresSignalNodeSetParams)( + hGraphExec, hNode, nodeParams) + + +cdef CUresult _cuGraphExecExternalSemaphoresWaitNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_EXT_SEM_WAIT_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphExecExternalSemaphoresWaitNodeSetParams + _check_or_init_driver() + if __cuGraphExecExternalSemaphoresWaitNodeSetParams == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphExecExternalSemaphoresWaitNodeSetParams is not found") + return (__cuGraphExecExternalSemaphoresWaitNodeSetParams)( + hGraphExec, hNode, nodeParams) + + +cdef CUresult _cuGraphNodeSetEnabled(CUgraphExec hGraphExec, CUgraphNode hNode, unsigned int isEnabled) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphNodeSetEnabled + _check_or_init_driver() + if __cuGraphNodeSetEnabled == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphNodeSetEnabled is not found") + return (__cuGraphNodeSetEnabled)( + hGraphExec, hNode, isEnabled) + + +cdef CUresult _cuGraphNodeGetEnabled(CUgraphExec hGraphExec, CUgraphNode hNode, unsigned int* isEnabled) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphNodeGetEnabled + _check_or_init_driver() + if __cuGraphNodeGetEnabled == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphNodeGetEnabled is not found") + return (__cuGraphNodeGetEnabled)( + hGraphExec, hNode, isEnabled) + + +cdef CUresult _cuGraphUpload(CUgraphExec hGraphExec, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphUpload + _check_or_init_driver() + if __cuGraphUpload == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphUpload is not found") + return (__cuGraphUpload)( + hGraphExec, hStream) + + +cdef CUresult _cuGraphLaunch(CUgraphExec hGraphExec, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphLaunch + _check_or_init_driver() + if __cuGraphLaunch == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphLaunch is not found") + return (__cuGraphLaunch)( + hGraphExec, hStream) + + +cdef CUresult _cuGraphExecDestroy(CUgraphExec hGraphExec) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphExecDestroy + _check_or_init_driver() + if __cuGraphExecDestroy == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphExecDestroy is not found") + return (__cuGraphExecDestroy)( + hGraphExec) + + +cdef CUresult _cuGraphDestroy(CUgraph hGraph) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphDestroy + _check_or_init_driver() + if __cuGraphDestroy == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphDestroy is not found") + return (__cuGraphDestroy)( + hGraph) + + +cdef CUresult _cuGraphExecUpdate_v2(CUgraphExec hGraphExec, CUgraph hGraph, CUgraphExecUpdateResultInfo* resultInfo) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphExecUpdate_v2 + _check_or_init_driver() + if __cuGraphExecUpdate_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphExecUpdate_v2 is not found") + return (__cuGraphExecUpdate_v2)( + hGraphExec, hGraph, resultInfo) + + +cdef CUresult _cuGraphKernelNodeCopyAttributes(CUgraphNode dst, CUgraphNode src) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphKernelNodeCopyAttributes + _check_or_init_driver() + if __cuGraphKernelNodeCopyAttributes == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphKernelNodeCopyAttributes is not found") + return (__cuGraphKernelNodeCopyAttributes)( + dst, src) + + +cdef CUresult _cuGraphKernelNodeGetAttribute(CUgraphNode hNode, CUkernelNodeAttrID attr, CUkernelNodeAttrValue* value_out) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphKernelNodeGetAttribute + _check_or_init_driver() + if __cuGraphKernelNodeGetAttribute == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphKernelNodeGetAttribute is not found") + return (__cuGraphKernelNodeGetAttribute)( + hNode, attr, value_out) + + +cdef CUresult _cuGraphKernelNodeSetAttribute(CUgraphNode hNode, CUkernelNodeAttrID attr, const CUkernelNodeAttrValue* value) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphKernelNodeSetAttribute + _check_or_init_driver() + if __cuGraphKernelNodeSetAttribute == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphKernelNodeSetAttribute is not found") + return (__cuGraphKernelNodeSetAttribute)( + hNode, attr, value) + + +cdef CUresult _cuGraphDebugDotPrint(CUgraph hGraph, const char* path, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphDebugDotPrint + _check_or_init_driver() + if __cuGraphDebugDotPrint == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphDebugDotPrint is not found") + return (__cuGraphDebugDotPrint)( + hGraph, path, flags) + + +cdef CUresult _cuUserObjectCreate(CUuserObject* object_out, void* ptr, CUhostFn destroy, unsigned int initialRefcount, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuUserObjectCreate + _check_or_init_driver() + if __cuUserObjectCreate == NULL: + with gil: + raise FunctionNotFoundError("function cuUserObjectCreate is not found") + return (__cuUserObjectCreate)( + object_out, ptr, destroy, initialRefcount, flags) + + +cdef CUresult _cuUserObjectRetain(CUuserObject object, unsigned int count) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuUserObjectRetain + _check_or_init_driver() + if __cuUserObjectRetain == NULL: + with gil: + raise FunctionNotFoundError("function cuUserObjectRetain is not found") + return (__cuUserObjectRetain)( + object, count) + + +cdef CUresult _cuUserObjectRelease(CUuserObject object, unsigned int count) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuUserObjectRelease + _check_or_init_driver() + if __cuUserObjectRelease == NULL: + with gil: + raise FunctionNotFoundError("function cuUserObjectRelease is not found") + return (__cuUserObjectRelease)( + object, count) + + +cdef CUresult _cuGraphRetainUserObject(CUgraph graph, CUuserObject object, unsigned int count, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphRetainUserObject + _check_or_init_driver() + if __cuGraphRetainUserObject == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphRetainUserObject is not found") + return (__cuGraphRetainUserObject)( + graph, object, count, flags) + + +cdef CUresult _cuGraphReleaseUserObject(CUgraph graph, CUuserObject object, unsigned int count) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphReleaseUserObject + _check_or_init_driver() + if __cuGraphReleaseUserObject == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphReleaseUserObject is not found") + return (__cuGraphReleaseUserObject)( + graph, object, count) + + +cdef CUresult _cuGraphAddNode_v2(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, const CUgraphEdgeData* dependencyData, size_t numDependencies, CUgraphNodeParams* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphAddNode_v2 + _check_or_init_driver() + if __cuGraphAddNode_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphAddNode_v2 is not found") + return (__cuGraphAddNode_v2)( + phGraphNode, hGraph, dependencies, dependencyData, numDependencies, nodeParams) + + +cdef CUresult _cuGraphNodeSetParams(CUgraphNode hNode, CUgraphNodeParams* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphNodeSetParams + _check_or_init_driver() + if __cuGraphNodeSetParams == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphNodeSetParams is not found") + return (__cuGraphNodeSetParams)( + hNode, nodeParams) + + +cdef CUresult _cuGraphExecNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, CUgraphNodeParams* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphExecNodeSetParams + _check_or_init_driver() + if __cuGraphExecNodeSetParams == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphExecNodeSetParams is not found") + return (__cuGraphExecNodeSetParams)( + hGraphExec, hNode, nodeParams) + + +cdef CUresult _cuGraphConditionalHandleCreate(CUgraphConditionalHandle* pHandle_out, CUgraph hGraph, CUcontext ctx, unsigned int defaultLaunchValue, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphConditionalHandleCreate + _check_or_init_driver() + if __cuGraphConditionalHandleCreate == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphConditionalHandleCreate is not found") + return (__cuGraphConditionalHandleCreate)( + pHandle_out, hGraph, ctx, defaultLaunchValue, flags) + + +cdef CUresult _cuOccupancyMaxActiveBlocksPerMultiprocessor(int* numBlocks, CUfunction func, int blockSize, size_t dynamicSMemSize) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuOccupancyMaxActiveBlocksPerMultiprocessor + _check_or_init_driver() + if __cuOccupancyMaxActiveBlocksPerMultiprocessor == NULL: + with gil: + raise FunctionNotFoundError("function cuOccupancyMaxActiveBlocksPerMultiprocessor is not found") + return (__cuOccupancyMaxActiveBlocksPerMultiprocessor)( + numBlocks, func, blockSize, dynamicSMemSize) + + +cdef CUresult _cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(int* numBlocks, CUfunction func, int blockSize, size_t dynamicSMemSize, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags + _check_or_init_driver() + if __cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags == NULL: + with gil: + raise FunctionNotFoundError("function cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags is not found") + return (__cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags)( + numBlocks, func, blockSize, dynamicSMemSize, flags) + + +cdef CUresult _cuOccupancyMaxPotentialBlockSize(int* minGridSize, int* blockSize, CUfunction func, CUoccupancyB2DSize blockSizeToDynamicSMemSize, size_t dynamicSMemSize, int blockSizeLimit) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuOccupancyMaxPotentialBlockSize + _check_or_init_driver() + if __cuOccupancyMaxPotentialBlockSize == NULL: + with gil: + raise FunctionNotFoundError("function cuOccupancyMaxPotentialBlockSize is not found") + return (__cuOccupancyMaxPotentialBlockSize)( + minGridSize, blockSize, func, blockSizeToDynamicSMemSize, dynamicSMemSize, blockSizeLimit) + + +cdef CUresult _cuOccupancyMaxPotentialBlockSizeWithFlags(int* minGridSize, int* blockSize, CUfunction func, CUoccupancyB2DSize blockSizeToDynamicSMemSize, size_t dynamicSMemSize, int blockSizeLimit, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuOccupancyMaxPotentialBlockSizeWithFlags + _check_or_init_driver() + if __cuOccupancyMaxPotentialBlockSizeWithFlags == NULL: + with gil: + raise FunctionNotFoundError("function cuOccupancyMaxPotentialBlockSizeWithFlags is not found") + return (__cuOccupancyMaxPotentialBlockSizeWithFlags)( + minGridSize, blockSize, func, blockSizeToDynamicSMemSize, dynamicSMemSize, blockSizeLimit, flags) + + +cdef CUresult _cuOccupancyAvailableDynamicSMemPerBlock(size_t* dynamicSmemSize, CUfunction func, int numBlocks, int blockSize) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuOccupancyAvailableDynamicSMemPerBlock + _check_or_init_driver() + if __cuOccupancyAvailableDynamicSMemPerBlock == NULL: + with gil: + raise FunctionNotFoundError("function cuOccupancyAvailableDynamicSMemPerBlock is not found") + return (__cuOccupancyAvailableDynamicSMemPerBlock)( + dynamicSmemSize, func, numBlocks, blockSize) + + +cdef CUresult _cuOccupancyMaxPotentialClusterSize(int* clusterSize, CUfunction func, const CUlaunchConfig* config) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuOccupancyMaxPotentialClusterSize + _check_or_init_driver() + if __cuOccupancyMaxPotentialClusterSize == NULL: + with gil: + raise FunctionNotFoundError("function cuOccupancyMaxPotentialClusterSize is not found") + return (__cuOccupancyMaxPotentialClusterSize)( + clusterSize, func, config) + + +cdef CUresult _cuOccupancyMaxActiveClusters(int* numClusters, CUfunction func, const CUlaunchConfig* config) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuOccupancyMaxActiveClusters + _check_or_init_driver() + if __cuOccupancyMaxActiveClusters == NULL: + with gil: + raise FunctionNotFoundError("function cuOccupancyMaxActiveClusters is not found") + return (__cuOccupancyMaxActiveClusters)( + numClusters, func, config) + + +cdef CUresult _cuTexRefSetArray(CUtexref hTexRef, CUarray hArray, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexRefSetArray + _check_or_init_driver() + if __cuTexRefSetArray == NULL: + with gil: + raise FunctionNotFoundError("function cuTexRefSetArray is not found") + return (__cuTexRefSetArray)( + hTexRef, hArray, Flags) + + +cdef CUresult _cuTexRefSetMipmappedArray(CUtexref hTexRef, CUmipmappedArray hMipmappedArray, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexRefSetMipmappedArray + _check_or_init_driver() + if __cuTexRefSetMipmappedArray == NULL: + with gil: + raise FunctionNotFoundError("function cuTexRefSetMipmappedArray is not found") + return (__cuTexRefSetMipmappedArray)( + hTexRef, hMipmappedArray, Flags) + + +cdef CUresult _cuTexRefSetAddress_v2(size_t* ByteOffset, CUtexref hTexRef, CUdeviceptr dptr, size_t bytes) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexRefSetAddress_v2 + _check_or_init_driver() + if __cuTexRefSetAddress_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuTexRefSetAddress_v2 is not found") + return (__cuTexRefSetAddress_v2)( + ByteOffset, hTexRef, dptr, bytes) + + +cdef CUresult _cuTexRefSetAddress2D_v3(CUtexref hTexRef, const CUDA_ARRAY_DESCRIPTOR* desc, CUdeviceptr dptr, size_t Pitch) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexRefSetAddress2D_v3 + _check_or_init_driver() + if __cuTexRefSetAddress2D_v3 == NULL: + with gil: + raise FunctionNotFoundError("function cuTexRefSetAddress2D_v3 is not found") + return (__cuTexRefSetAddress2D_v3)( + hTexRef, desc, dptr, Pitch) + + +cdef CUresult _cuTexRefSetFormat(CUtexref hTexRef, CUarray_format fmt, int NumPackedComponents) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexRefSetFormat + _check_or_init_driver() + if __cuTexRefSetFormat == NULL: + with gil: + raise FunctionNotFoundError("function cuTexRefSetFormat is not found") + return (__cuTexRefSetFormat)( + hTexRef, fmt, NumPackedComponents) + + +cdef CUresult _cuTexRefSetAddressMode(CUtexref hTexRef, int dim, CUaddress_mode am) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexRefSetAddressMode + _check_or_init_driver() + if __cuTexRefSetAddressMode == NULL: + with gil: + raise FunctionNotFoundError("function cuTexRefSetAddressMode is not found") + return (__cuTexRefSetAddressMode)( + hTexRef, dim, am) + + +cdef CUresult _cuTexRefSetFilterMode(CUtexref hTexRef, CUfilter_mode fm) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexRefSetFilterMode + _check_or_init_driver() + if __cuTexRefSetFilterMode == NULL: + with gil: + raise FunctionNotFoundError("function cuTexRefSetFilterMode is not found") + return (__cuTexRefSetFilterMode)( + hTexRef, fm) + + +cdef CUresult _cuTexRefSetMipmapFilterMode(CUtexref hTexRef, CUfilter_mode fm) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexRefSetMipmapFilterMode + _check_or_init_driver() + if __cuTexRefSetMipmapFilterMode == NULL: + with gil: + raise FunctionNotFoundError("function cuTexRefSetMipmapFilterMode is not found") + return (__cuTexRefSetMipmapFilterMode)( + hTexRef, fm) + + +cdef CUresult _cuTexRefSetMipmapLevelBias(CUtexref hTexRef, float bias) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexRefSetMipmapLevelBias + _check_or_init_driver() + if __cuTexRefSetMipmapLevelBias == NULL: + with gil: + raise FunctionNotFoundError("function cuTexRefSetMipmapLevelBias is not found") + return (__cuTexRefSetMipmapLevelBias)( + hTexRef, bias) + + +cdef CUresult _cuTexRefSetMipmapLevelClamp(CUtexref hTexRef, float minMipmapLevelClamp, float maxMipmapLevelClamp) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexRefSetMipmapLevelClamp + _check_or_init_driver() + if __cuTexRefSetMipmapLevelClamp == NULL: + with gil: + raise FunctionNotFoundError("function cuTexRefSetMipmapLevelClamp is not found") + return (__cuTexRefSetMipmapLevelClamp)( + hTexRef, minMipmapLevelClamp, maxMipmapLevelClamp) + + +cdef CUresult _cuTexRefSetMaxAnisotropy(CUtexref hTexRef, unsigned int maxAniso) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexRefSetMaxAnisotropy + _check_or_init_driver() + if __cuTexRefSetMaxAnisotropy == NULL: + with gil: + raise FunctionNotFoundError("function cuTexRefSetMaxAnisotropy is not found") + return (__cuTexRefSetMaxAnisotropy)( + hTexRef, maxAniso) + + +cdef CUresult _cuTexRefSetBorderColor(CUtexref hTexRef, float* pBorderColor) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexRefSetBorderColor + _check_or_init_driver() + if __cuTexRefSetBorderColor == NULL: + with gil: + raise FunctionNotFoundError("function cuTexRefSetBorderColor is not found") + return (__cuTexRefSetBorderColor)( + hTexRef, pBorderColor) + + +cdef CUresult _cuTexRefSetFlags(CUtexref hTexRef, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexRefSetFlags + _check_or_init_driver() + if __cuTexRefSetFlags == NULL: + with gil: + raise FunctionNotFoundError("function cuTexRefSetFlags is not found") + return (__cuTexRefSetFlags)( + hTexRef, Flags) + + +cdef CUresult _cuTexRefGetAddress_v2(CUdeviceptr* pdptr, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexRefGetAddress_v2 + _check_or_init_driver() + if __cuTexRefGetAddress_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuTexRefGetAddress_v2 is not found") + return (__cuTexRefGetAddress_v2)( + pdptr, hTexRef) + + +cdef CUresult _cuTexRefGetArray(CUarray* phArray, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexRefGetArray + _check_or_init_driver() + if __cuTexRefGetArray == NULL: + with gil: + raise FunctionNotFoundError("function cuTexRefGetArray is not found") + return (__cuTexRefGetArray)( + phArray, hTexRef) + + +cdef CUresult _cuTexRefGetMipmappedArray(CUmipmappedArray* phMipmappedArray, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexRefGetMipmappedArray + _check_or_init_driver() + if __cuTexRefGetMipmappedArray == NULL: + with gil: + raise FunctionNotFoundError("function cuTexRefGetMipmappedArray is not found") + return (__cuTexRefGetMipmappedArray)( + phMipmappedArray, hTexRef) + + +cdef CUresult _cuTexRefGetAddressMode(CUaddress_mode* pam, CUtexref hTexRef, int dim) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexRefGetAddressMode + _check_or_init_driver() + if __cuTexRefGetAddressMode == NULL: + with gil: + raise FunctionNotFoundError("function cuTexRefGetAddressMode is not found") + return (__cuTexRefGetAddressMode)( + pam, hTexRef, dim) + + +cdef CUresult _cuTexRefGetFilterMode(CUfilter_mode* pfm, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexRefGetFilterMode + _check_or_init_driver() + if __cuTexRefGetFilterMode == NULL: + with gil: + raise FunctionNotFoundError("function cuTexRefGetFilterMode is not found") + return (__cuTexRefGetFilterMode)( + pfm, hTexRef) + + +cdef CUresult _cuTexRefGetFormat(CUarray_format* pFormat, int* pNumChannels, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexRefGetFormat + _check_or_init_driver() + if __cuTexRefGetFormat == NULL: + with gil: + raise FunctionNotFoundError("function cuTexRefGetFormat is not found") + return (__cuTexRefGetFormat)( + pFormat, pNumChannels, hTexRef) + + +cdef CUresult _cuTexRefGetMipmapFilterMode(CUfilter_mode* pfm, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexRefGetMipmapFilterMode + _check_or_init_driver() + if __cuTexRefGetMipmapFilterMode == NULL: + with gil: + raise FunctionNotFoundError("function cuTexRefGetMipmapFilterMode is not found") + return (__cuTexRefGetMipmapFilterMode)( + pfm, hTexRef) + + +cdef CUresult _cuTexRefGetMipmapLevelBias(float* pbias, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexRefGetMipmapLevelBias + _check_or_init_driver() + if __cuTexRefGetMipmapLevelBias == NULL: + with gil: + raise FunctionNotFoundError("function cuTexRefGetMipmapLevelBias is not found") + return (__cuTexRefGetMipmapLevelBias)( + pbias, hTexRef) + + +cdef CUresult _cuTexRefGetMipmapLevelClamp(float* pminMipmapLevelClamp, float* pmaxMipmapLevelClamp, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexRefGetMipmapLevelClamp + _check_or_init_driver() + if __cuTexRefGetMipmapLevelClamp == NULL: + with gil: + raise FunctionNotFoundError("function cuTexRefGetMipmapLevelClamp is not found") + return (__cuTexRefGetMipmapLevelClamp)( + pminMipmapLevelClamp, pmaxMipmapLevelClamp, hTexRef) + + +cdef CUresult _cuTexRefGetMaxAnisotropy(int* pmaxAniso, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexRefGetMaxAnisotropy + _check_or_init_driver() + if __cuTexRefGetMaxAnisotropy == NULL: + with gil: + raise FunctionNotFoundError("function cuTexRefGetMaxAnisotropy is not found") + return (__cuTexRefGetMaxAnisotropy)( + pmaxAniso, hTexRef) + + +cdef CUresult _cuTexRefGetBorderColor(float* pBorderColor, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexRefGetBorderColor + _check_or_init_driver() + if __cuTexRefGetBorderColor == NULL: + with gil: + raise FunctionNotFoundError("function cuTexRefGetBorderColor is not found") + return (__cuTexRefGetBorderColor)( + pBorderColor, hTexRef) + + +cdef CUresult _cuTexRefGetFlags(unsigned int* pFlags, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexRefGetFlags + _check_or_init_driver() + if __cuTexRefGetFlags == NULL: + with gil: + raise FunctionNotFoundError("function cuTexRefGetFlags is not found") + return (__cuTexRefGetFlags)( + pFlags, hTexRef) + + +cdef CUresult _cuTexRefCreate(CUtexref* pTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexRefCreate + _check_or_init_driver() + if __cuTexRefCreate == NULL: + with gil: + raise FunctionNotFoundError("function cuTexRefCreate is not found") + return (__cuTexRefCreate)( + pTexRef) + + +cdef CUresult _cuTexRefDestroy(CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexRefDestroy + _check_or_init_driver() + if __cuTexRefDestroy == NULL: + with gil: + raise FunctionNotFoundError("function cuTexRefDestroy is not found") + return (__cuTexRefDestroy)( + hTexRef) + + +cdef CUresult _cuSurfRefSetArray(CUsurfref hSurfRef, CUarray hArray, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuSurfRefSetArray + _check_or_init_driver() + if __cuSurfRefSetArray == NULL: + with gil: + raise FunctionNotFoundError("function cuSurfRefSetArray is not found") + return (__cuSurfRefSetArray)( + hSurfRef, hArray, Flags) + + +cdef CUresult _cuSurfRefGetArray(CUarray* phArray, CUsurfref hSurfRef) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuSurfRefGetArray + _check_or_init_driver() + if __cuSurfRefGetArray == NULL: + with gil: + raise FunctionNotFoundError("function cuSurfRefGetArray is not found") + return (__cuSurfRefGetArray)( + phArray, hSurfRef) + + +cdef CUresult _cuTexObjectCreate(CUtexObject* pTexObject, const CUDA_RESOURCE_DESC* pResDesc, const CUDA_TEXTURE_DESC* pTexDesc, const CUDA_RESOURCE_VIEW_DESC* pResViewDesc) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexObjectCreate + _check_or_init_driver() + if __cuTexObjectCreate == NULL: + with gil: + raise FunctionNotFoundError("function cuTexObjectCreate is not found") + return (__cuTexObjectCreate)( + pTexObject, pResDesc, pTexDesc, pResViewDesc) + + +cdef CUresult _cuTexObjectDestroy(CUtexObject texObject) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexObjectDestroy + _check_or_init_driver() + if __cuTexObjectDestroy == NULL: + with gil: + raise FunctionNotFoundError("function cuTexObjectDestroy is not found") + return (__cuTexObjectDestroy)( + texObject) + + +cdef CUresult _cuTexObjectGetResourceDesc(CUDA_RESOURCE_DESC* pResDesc, CUtexObject texObject) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexObjectGetResourceDesc + _check_or_init_driver() + if __cuTexObjectGetResourceDesc == NULL: + with gil: + raise FunctionNotFoundError("function cuTexObjectGetResourceDesc is not found") + return (__cuTexObjectGetResourceDesc)( + pResDesc, texObject) + + +cdef CUresult _cuTexObjectGetTextureDesc(CUDA_TEXTURE_DESC* pTexDesc, CUtexObject texObject) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexObjectGetTextureDesc + _check_or_init_driver() + if __cuTexObjectGetTextureDesc == NULL: + with gil: + raise FunctionNotFoundError("function cuTexObjectGetTextureDesc is not found") + return (__cuTexObjectGetTextureDesc)( + pTexDesc, texObject) + + +cdef CUresult _cuTexObjectGetResourceViewDesc(CUDA_RESOURCE_VIEW_DESC* pResViewDesc, CUtexObject texObject) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTexObjectGetResourceViewDesc + _check_or_init_driver() + if __cuTexObjectGetResourceViewDesc == NULL: + with gil: + raise FunctionNotFoundError("function cuTexObjectGetResourceViewDesc is not found") + return (__cuTexObjectGetResourceViewDesc)( + pResViewDesc, texObject) + + +cdef CUresult _cuSurfObjectCreate(CUsurfObject* pSurfObject, const CUDA_RESOURCE_DESC* pResDesc) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuSurfObjectCreate + _check_or_init_driver() + if __cuSurfObjectCreate == NULL: + with gil: + raise FunctionNotFoundError("function cuSurfObjectCreate is not found") + return (__cuSurfObjectCreate)( + pSurfObject, pResDesc) + + +cdef CUresult _cuSurfObjectDestroy(CUsurfObject surfObject) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuSurfObjectDestroy + _check_or_init_driver() + if __cuSurfObjectDestroy == NULL: + with gil: + raise FunctionNotFoundError("function cuSurfObjectDestroy is not found") + return (__cuSurfObjectDestroy)( + surfObject) + + +cdef CUresult _cuSurfObjectGetResourceDesc(CUDA_RESOURCE_DESC* pResDesc, CUsurfObject surfObject) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuSurfObjectGetResourceDesc + _check_or_init_driver() + if __cuSurfObjectGetResourceDesc == NULL: + with gil: + raise FunctionNotFoundError("function cuSurfObjectGetResourceDesc is not found") + return (__cuSurfObjectGetResourceDesc)( + pResDesc, surfObject) + + +cdef CUresult _cuTensorMapEncodeTiled(CUtensorMap* tensorMap, CUtensorMapDataType tensorDataType, cuuint32_t tensorRank, void* globalAddress, const cuuint64_t* globalDim, const cuuint64_t* globalStrides, const cuuint32_t* boxDim, const cuuint32_t* elementStrides, CUtensorMapInterleave interleave, CUtensorMapSwizzle swizzle, CUtensorMapL2promotion l2Promotion, CUtensorMapFloatOOBfill oobFill) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTensorMapEncodeTiled + _check_or_init_driver() + if __cuTensorMapEncodeTiled == NULL: + with gil: + raise FunctionNotFoundError("function cuTensorMapEncodeTiled is not found") + return (__cuTensorMapEncodeTiled)( + tensorMap, tensorDataType, tensorRank, globalAddress, globalDim, globalStrides, boxDim, elementStrides, interleave, swizzle, l2Promotion, oobFill) + + +cdef CUresult _cuTensorMapEncodeIm2col(CUtensorMap* tensorMap, CUtensorMapDataType tensorDataType, cuuint32_t tensorRank, void* globalAddress, const cuuint64_t* globalDim, const cuuint64_t* globalStrides, const int* pixelBoxLowerCorner, const int* pixelBoxUpperCorner, cuuint32_t channelsPerPixel, cuuint32_t pixelsPerColumn, const cuuint32_t* elementStrides, CUtensorMapInterleave interleave, CUtensorMapSwizzle swizzle, CUtensorMapL2promotion l2Promotion, CUtensorMapFloatOOBfill oobFill) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTensorMapEncodeIm2col + _check_or_init_driver() + if __cuTensorMapEncodeIm2col == NULL: + with gil: + raise FunctionNotFoundError("function cuTensorMapEncodeIm2col is not found") + return (__cuTensorMapEncodeIm2col)( + tensorMap, tensorDataType, tensorRank, globalAddress, globalDim, globalStrides, pixelBoxLowerCorner, pixelBoxUpperCorner, channelsPerPixel, pixelsPerColumn, elementStrides, interleave, swizzle, l2Promotion, oobFill) + + +cdef CUresult _cuTensorMapEncodeIm2colWide(CUtensorMap* tensorMap, CUtensorMapDataType tensorDataType, cuuint32_t tensorRank, void* globalAddress, const cuuint64_t* globalDim, const cuuint64_t* globalStrides, int pixelBoxLowerCornerWidth, int pixelBoxUpperCornerWidth, cuuint32_t channelsPerPixel, cuuint32_t pixelsPerColumn, const cuuint32_t* elementStrides, CUtensorMapInterleave interleave, CUtensorMapIm2ColWideMode mode, CUtensorMapSwizzle swizzle, CUtensorMapL2promotion l2Promotion, CUtensorMapFloatOOBfill oobFill) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTensorMapEncodeIm2colWide + _check_or_init_driver() + if __cuTensorMapEncodeIm2colWide == NULL: + with gil: + raise FunctionNotFoundError("function cuTensorMapEncodeIm2colWide is not found") + return (__cuTensorMapEncodeIm2colWide)( + tensorMap, tensorDataType, tensorRank, globalAddress, globalDim, globalStrides, pixelBoxLowerCornerWidth, pixelBoxUpperCornerWidth, channelsPerPixel, pixelsPerColumn, elementStrides, interleave, mode, swizzle, l2Promotion, oobFill) + + +cdef CUresult _cuTensorMapReplaceAddress(CUtensorMap* tensorMap, void* globalAddress) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuTensorMapReplaceAddress + _check_or_init_driver() + if __cuTensorMapReplaceAddress == NULL: + with gil: + raise FunctionNotFoundError("function cuTensorMapReplaceAddress is not found") + return (__cuTensorMapReplaceAddress)( + tensorMap, globalAddress) + + +cdef CUresult _cuDeviceCanAccessPeer(int* canAccessPeer, CUdevice dev, CUdevice peerDev) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDeviceCanAccessPeer + _check_or_init_driver() + if __cuDeviceCanAccessPeer == NULL: + with gil: + raise FunctionNotFoundError("function cuDeviceCanAccessPeer is not found") + return (__cuDeviceCanAccessPeer)( + canAccessPeer, dev, peerDev) + + +cdef CUresult _cuCtxEnablePeerAccess(CUcontext peerContext, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxEnablePeerAccess + _check_or_init_driver() + if __cuCtxEnablePeerAccess == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxEnablePeerAccess is not found") + return (__cuCtxEnablePeerAccess)( + peerContext, Flags) + + +cdef CUresult _cuCtxDisablePeerAccess(CUcontext peerContext) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxDisablePeerAccess + _check_or_init_driver() + if __cuCtxDisablePeerAccess == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxDisablePeerAccess is not found") + return (__cuCtxDisablePeerAccess)( + peerContext) + + +cdef CUresult _cuDeviceGetP2PAttribute(int* value, CUdevice_P2PAttribute attrib, CUdevice srcDevice, CUdevice dstDevice) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDeviceGetP2PAttribute + _check_or_init_driver() + if __cuDeviceGetP2PAttribute == NULL: + with gil: + raise FunctionNotFoundError("function cuDeviceGetP2PAttribute is not found") + return (__cuDeviceGetP2PAttribute)( + value, attrib, srcDevice, dstDevice) + + +cdef CUresult _cuGraphicsUnregisterResource(CUgraphicsResource resource) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphicsUnregisterResource + _check_or_init_driver() + if __cuGraphicsUnregisterResource == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphicsUnregisterResource is not found") + return (__cuGraphicsUnregisterResource)( + resource) + + +cdef CUresult _cuGraphicsSubResourceGetMappedArray(CUarray* pArray, CUgraphicsResource resource, unsigned int arrayIndex, unsigned int mipLevel) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphicsSubResourceGetMappedArray + _check_or_init_driver() + if __cuGraphicsSubResourceGetMappedArray == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphicsSubResourceGetMappedArray is not found") + return (__cuGraphicsSubResourceGetMappedArray)( + pArray, resource, arrayIndex, mipLevel) + + +cdef CUresult _cuGraphicsResourceGetMappedMipmappedArray(CUmipmappedArray* pMipmappedArray, CUgraphicsResource resource) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphicsResourceGetMappedMipmappedArray + _check_or_init_driver() + if __cuGraphicsResourceGetMappedMipmappedArray == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphicsResourceGetMappedMipmappedArray is not found") + return (__cuGraphicsResourceGetMappedMipmappedArray)( + pMipmappedArray, resource) + + +cdef CUresult _cuGraphicsResourceGetMappedPointer_v2(CUdeviceptr* pDevPtr, size_t* pSize, CUgraphicsResource resource) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphicsResourceGetMappedPointer_v2 + _check_or_init_driver() + if __cuGraphicsResourceGetMappedPointer_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphicsResourceGetMappedPointer_v2 is not found") + return (__cuGraphicsResourceGetMappedPointer_v2)( + pDevPtr, pSize, resource) + + +cdef CUresult _cuGraphicsResourceSetMapFlags_v2(CUgraphicsResource resource, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphicsResourceSetMapFlags_v2 + _check_or_init_driver() + if __cuGraphicsResourceSetMapFlags_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphicsResourceSetMapFlags_v2 is not found") + return (__cuGraphicsResourceSetMapFlags_v2)( + resource, flags) + + +cdef CUresult _cuGraphicsMapResources(unsigned int count, CUgraphicsResource* resources, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphicsMapResources + _check_or_init_driver() + if __cuGraphicsMapResources == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphicsMapResources is not found") + return (__cuGraphicsMapResources)( + count, resources, hStream) + + +cdef CUresult _cuGraphicsUnmapResources(unsigned int count, CUgraphicsResource* resources, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphicsUnmapResources + _check_or_init_driver() + if __cuGraphicsUnmapResources == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphicsUnmapResources is not found") + return (__cuGraphicsUnmapResources)( + count, resources, hStream) + + +cdef CUresult _cuGetProcAddress_v2(const char* symbol, void** pfn, int cudaVersion, cuuint64_t flags, CUdriverProcAddressQueryResult* symbolStatus) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGetProcAddress_v2 + _check_or_init_driver() + if __cuGetProcAddress_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuGetProcAddress_v2 is not found") + return (__cuGetProcAddress_v2)( + symbol, pfn, cudaVersion, flags, symbolStatus) + + +cdef CUresult _cuCoredumpGetAttribute(CUcoredumpSettings attrib, void* value, size_t* size) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCoredumpGetAttribute + _check_or_init_driver() + if __cuCoredumpGetAttribute == NULL: + with gil: + raise FunctionNotFoundError("function cuCoredumpGetAttribute is not found") + return (__cuCoredumpGetAttribute)( + attrib, value, size) + + +cdef CUresult _cuCoredumpGetAttributeGlobal(CUcoredumpSettings attrib, void* value, size_t* size) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCoredumpGetAttributeGlobal + _check_or_init_driver() + if __cuCoredumpGetAttributeGlobal == NULL: + with gil: + raise FunctionNotFoundError("function cuCoredumpGetAttributeGlobal is not found") + return (__cuCoredumpGetAttributeGlobal)( + attrib, value, size) + + +cdef CUresult _cuCoredumpSetAttribute(CUcoredumpSettings attrib, void* value, size_t* size) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCoredumpSetAttribute + _check_or_init_driver() + if __cuCoredumpSetAttribute == NULL: + with gil: + raise FunctionNotFoundError("function cuCoredumpSetAttribute is not found") + return (__cuCoredumpSetAttribute)( + attrib, value, size) + + +cdef CUresult _cuCoredumpSetAttributeGlobal(CUcoredumpSettings attrib, void* value, size_t* size) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCoredumpSetAttributeGlobal + _check_or_init_driver() + if __cuCoredumpSetAttributeGlobal == NULL: + with gil: + raise FunctionNotFoundError("function cuCoredumpSetAttributeGlobal is not found") + return (__cuCoredumpSetAttributeGlobal)( + attrib, value, size) + + +cdef CUresult _cuGetExportTable(const void** ppExportTable, const CUuuid* pExportTableId) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGetExportTable + _check_or_init_driver() + if __cuGetExportTable == NULL: + with gil: + raise FunctionNotFoundError("function cuGetExportTable is not found") + return (__cuGetExportTable)( + ppExportTable, pExportTableId) + + +cdef CUresult _cuGreenCtxCreate(CUgreenCtx* phCtx, CUdevResourceDesc desc, CUdevice dev, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGreenCtxCreate + _check_or_init_driver() + if __cuGreenCtxCreate == NULL: + with gil: + raise FunctionNotFoundError("function cuGreenCtxCreate is not found") + return (__cuGreenCtxCreate)( + phCtx, desc, dev, flags) + + +cdef CUresult _cuGreenCtxDestroy(CUgreenCtx hCtx) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGreenCtxDestroy + _check_or_init_driver() + if __cuGreenCtxDestroy == NULL: + with gil: + raise FunctionNotFoundError("function cuGreenCtxDestroy is not found") + return (__cuGreenCtxDestroy)( + hCtx) + + +cdef CUresult _cuCtxFromGreenCtx(CUcontext* pContext, CUgreenCtx hCtx) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxFromGreenCtx + _check_or_init_driver() + if __cuCtxFromGreenCtx == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxFromGreenCtx is not found") + return (__cuCtxFromGreenCtx)( + pContext, hCtx) + + +cdef CUresult _cuDeviceGetDevResource(CUdevice device, CUdevResource* resource, CUdevResourceType type) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDeviceGetDevResource + _check_or_init_driver() + if __cuDeviceGetDevResource == NULL: + with gil: + raise FunctionNotFoundError("function cuDeviceGetDevResource is not found") + return (__cuDeviceGetDevResource)( + device, resource, type) + + +cdef CUresult _cuCtxGetDevResource(CUcontext hCtx, CUdevResource* resource, CUdevResourceType type) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxGetDevResource + _check_or_init_driver() + if __cuCtxGetDevResource == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxGetDevResource is not found") + return (__cuCtxGetDevResource)( + hCtx, resource, type) + + +cdef CUresult _cuGreenCtxGetDevResource(CUgreenCtx hCtx, CUdevResource* resource, CUdevResourceType type) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGreenCtxGetDevResource + _check_or_init_driver() + if __cuGreenCtxGetDevResource == NULL: + with gil: + raise FunctionNotFoundError("function cuGreenCtxGetDevResource is not found") + return (__cuGreenCtxGetDevResource)( + hCtx, resource, type) + + +cdef CUresult _cuDevSmResourceSplitByCount(CUdevResource* result, unsigned int* nbGroups, const CUdevResource* input, CUdevResource* remainder, unsigned int flags, unsigned int minCount) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDevSmResourceSplitByCount + _check_or_init_driver() + if __cuDevSmResourceSplitByCount == NULL: + with gil: + raise FunctionNotFoundError("function cuDevSmResourceSplitByCount is not found") + return (__cuDevSmResourceSplitByCount)( + result, nbGroups, input, remainder, flags, minCount) + + +cdef CUresult _cuDevResourceGenerateDesc(CUdevResourceDesc* phDesc, CUdevResource* resources, unsigned int nbResources) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDevResourceGenerateDesc + _check_or_init_driver() + if __cuDevResourceGenerateDesc == NULL: + with gil: + raise FunctionNotFoundError("function cuDevResourceGenerateDesc is not found") + return (__cuDevResourceGenerateDesc)( + phDesc, resources, nbResources) + + +cdef CUresult _cuGreenCtxRecordEvent(CUgreenCtx hCtx, CUevent hEvent) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGreenCtxRecordEvent + _check_or_init_driver() + if __cuGreenCtxRecordEvent == NULL: + with gil: + raise FunctionNotFoundError("function cuGreenCtxRecordEvent is not found") + return (__cuGreenCtxRecordEvent)( + hCtx, hEvent) + + +cdef CUresult _cuGreenCtxWaitEvent(CUgreenCtx hCtx, CUevent hEvent) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGreenCtxWaitEvent + _check_or_init_driver() + if __cuGreenCtxWaitEvent == NULL: + with gil: + raise FunctionNotFoundError("function cuGreenCtxWaitEvent is not found") + return (__cuGreenCtxWaitEvent)( + hCtx, hEvent) + + +cdef CUresult _cuStreamGetGreenCtx(CUstream hStream, CUgreenCtx* phCtx) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamGetGreenCtx + _check_or_init_driver() + if __cuStreamGetGreenCtx == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamGetGreenCtx is not found") + return (__cuStreamGetGreenCtx)( + hStream, phCtx) + + +cdef CUresult _cuGreenCtxStreamCreate(CUstream* phStream, CUgreenCtx greenCtx, unsigned int flags, int priority) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGreenCtxStreamCreate + _check_or_init_driver() + if __cuGreenCtxStreamCreate == NULL: + with gil: + raise FunctionNotFoundError("function cuGreenCtxStreamCreate is not found") + return (__cuGreenCtxStreamCreate)( + phStream, greenCtx, flags, priority) + + +cdef CUresult _cuLogsRegisterCallback(CUlogsCallback callbackFunc, void* userData, CUlogsCallbackHandle* callback_out) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLogsRegisterCallback + _check_or_init_driver() + if __cuLogsRegisterCallback == NULL: + with gil: + raise FunctionNotFoundError("function cuLogsRegisterCallback is not found") + return (__cuLogsRegisterCallback)( + callbackFunc, userData, callback_out) + + +cdef CUresult _cuLogsUnregisterCallback(CUlogsCallbackHandle callback) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLogsUnregisterCallback + _check_or_init_driver() + if __cuLogsUnregisterCallback == NULL: + with gil: + raise FunctionNotFoundError("function cuLogsUnregisterCallback is not found") + return (__cuLogsUnregisterCallback)( + callback) + + +cdef CUresult _cuLogsCurrent(CUlogIterator* iterator_out, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLogsCurrent + _check_or_init_driver() + if __cuLogsCurrent == NULL: + with gil: + raise FunctionNotFoundError("function cuLogsCurrent is not found") + return (__cuLogsCurrent)( + iterator_out, flags) + + +cdef CUresult _cuLogsDumpToFile(CUlogIterator* iterator, const char* pathToFile, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLogsDumpToFile + _check_or_init_driver() + if __cuLogsDumpToFile == NULL: + with gil: + raise FunctionNotFoundError("function cuLogsDumpToFile is not found") + return (__cuLogsDumpToFile)( + iterator, pathToFile, flags) + + +cdef CUresult _cuLogsDumpToMemory(CUlogIterator* iterator, char* buffer, size_t* size, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLogsDumpToMemory + _check_or_init_driver() + if __cuLogsDumpToMemory == NULL: + with gil: + raise FunctionNotFoundError("function cuLogsDumpToMemory is not found") + return (__cuLogsDumpToMemory)( + iterator, buffer, size, flags) + + +cdef CUresult _cuCheckpointProcessGetRestoreThreadId(int pid, int* tid) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCheckpointProcessGetRestoreThreadId + _check_or_init_driver() + if __cuCheckpointProcessGetRestoreThreadId == NULL: + with gil: + raise FunctionNotFoundError("function cuCheckpointProcessGetRestoreThreadId is not found") + return (__cuCheckpointProcessGetRestoreThreadId)( + pid, tid) + + +cdef CUresult _cuCheckpointProcessGetState(int pid, CUprocessState* state) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCheckpointProcessGetState + _check_or_init_driver() + if __cuCheckpointProcessGetState == NULL: + with gil: + raise FunctionNotFoundError("function cuCheckpointProcessGetState is not found") + return (__cuCheckpointProcessGetState)( + pid, state) + + +cdef CUresult _cuCheckpointProcessLock(int pid, CUcheckpointLockArgs* args) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCheckpointProcessLock + _check_or_init_driver() + if __cuCheckpointProcessLock == NULL: + with gil: + raise FunctionNotFoundError("function cuCheckpointProcessLock is not found") + return (__cuCheckpointProcessLock)( + pid, args) + + +cdef CUresult _cuCheckpointProcessCheckpoint(int pid, CUcheckpointCheckpointArgs* args) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCheckpointProcessCheckpoint + _check_or_init_driver() + if __cuCheckpointProcessCheckpoint == NULL: + with gil: + raise FunctionNotFoundError("function cuCheckpointProcessCheckpoint is not found") + return (__cuCheckpointProcessCheckpoint)( + pid, args) + + +cdef CUresult _cuCheckpointProcessRestore(int pid, CUcheckpointRestoreArgs* args) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCheckpointProcessRestore + _check_or_init_driver() + if __cuCheckpointProcessRestore == NULL: + with gil: + raise FunctionNotFoundError("function cuCheckpointProcessRestore is not found") + return (__cuCheckpointProcessRestore)( + pid, args) + + +cdef CUresult _cuCheckpointProcessUnlock(int pid, CUcheckpointUnlockArgs* args) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCheckpointProcessUnlock + _check_or_init_driver() + if __cuCheckpointProcessUnlock == NULL: + with gil: + raise FunctionNotFoundError("function cuCheckpointProcessUnlock is not found") + return (__cuCheckpointProcessUnlock)( + pid, args) + + +cdef CUresult _cuGraphicsEGLRegisterImage(CUgraphicsResource* pCudaResource, EGLImageKHR image, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphicsEGLRegisterImage + _check_or_init_driver() + if __cuGraphicsEGLRegisterImage == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphicsEGLRegisterImage is not found") + return (__cuGraphicsEGLRegisterImage)( + pCudaResource, image, flags) + + +cdef CUresult _cuEGLStreamConsumerConnect(CUeglStreamConnection* conn, EGLStreamKHR stream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuEGLStreamConsumerConnect + _check_or_init_driver() + if __cuEGLStreamConsumerConnect == NULL: + with gil: + raise FunctionNotFoundError("function cuEGLStreamConsumerConnect is not found") + return (__cuEGLStreamConsumerConnect)( + conn, stream) + + +cdef CUresult _cuEGLStreamConsumerConnectWithFlags(CUeglStreamConnection* conn, EGLStreamKHR stream, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuEGLStreamConsumerConnectWithFlags + _check_or_init_driver() + if __cuEGLStreamConsumerConnectWithFlags == NULL: + with gil: + raise FunctionNotFoundError("function cuEGLStreamConsumerConnectWithFlags is not found") + return (__cuEGLStreamConsumerConnectWithFlags)( + conn, stream, flags) + + +cdef CUresult _cuEGLStreamConsumerDisconnect(CUeglStreamConnection* conn) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuEGLStreamConsumerDisconnect + _check_or_init_driver() + if __cuEGLStreamConsumerDisconnect == NULL: + with gil: + raise FunctionNotFoundError("function cuEGLStreamConsumerDisconnect is not found") + return (__cuEGLStreamConsumerDisconnect)( + conn) + + +cdef CUresult _cuEGLStreamConsumerAcquireFrame(CUeglStreamConnection* conn, CUgraphicsResource* pCudaResource, CUstream* pStream, unsigned int timeout) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuEGLStreamConsumerAcquireFrame + _check_or_init_driver() + if __cuEGLStreamConsumerAcquireFrame == NULL: + with gil: + raise FunctionNotFoundError("function cuEGLStreamConsumerAcquireFrame is not found") + return (__cuEGLStreamConsumerAcquireFrame)( + conn, pCudaResource, pStream, timeout) + + +cdef CUresult _cuEGLStreamConsumerReleaseFrame(CUeglStreamConnection* conn, CUgraphicsResource pCudaResource, CUstream* pStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuEGLStreamConsumerReleaseFrame + _check_or_init_driver() + if __cuEGLStreamConsumerReleaseFrame == NULL: + with gil: + raise FunctionNotFoundError("function cuEGLStreamConsumerReleaseFrame is not found") + return (__cuEGLStreamConsumerReleaseFrame)( + conn, pCudaResource, pStream) + + +cdef CUresult _cuEGLStreamProducerConnect(CUeglStreamConnection* conn, EGLStreamKHR stream, EGLint width, EGLint height) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuEGLStreamProducerConnect + _check_or_init_driver() + if __cuEGLStreamProducerConnect == NULL: + with gil: + raise FunctionNotFoundError("function cuEGLStreamProducerConnect is not found") + return (__cuEGLStreamProducerConnect)( + conn, stream, width, height) + + +cdef CUresult _cuEGLStreamProducerDisconnect(CUeglStreamConnection* conn) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuEGLStreamProducerDisconnect + _check_or_init_driver() + if __cuEGLStreamProducerDisconnect == NULL: + with gil: + raise FunctionNotFoundError("function cuEGLStreamProducerDisconnect is not found") + return (__cuEGLStreamProducerDisconnect)( + conn) + + +cdef CUresult _cuEGLStreamProducerPresentFrame(CUeglStreamConnection* conn, CUeglFrame eglframe, CUstream* pStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuEGLStreamProducerPresentFrame + _check_or_init_driver() + if __cuEGLStreamProducerPresentFrame == NULL: + with gil: + raise FunctionNotFoundError("function cuEGLStreamProducerPresentFrame is not found") + return (__cuEGLStreamProducerPresentFrame)( + conn, eglframe, pStream) + + +cdef CUresult _cuEGLStreamProducerReturnFrame(CUeglStreamConnection* conn, CUeglFrame* eglframe, CUstream* pStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuEGLStreamProducerReturnFrame + _check_or_init_driver() + if __cuEGLStreamProducerReturnFrame == NULL: + with gil: + raise FunctionNotFoundError("function cuEGLStreamProducerReturnFrame is not found") + return (__cuEGLStreamProducerReturnFrame)( + conn, eglframe, pStream) + + +cdef CUresult _cuGraphicsResourceGetMappedEglFrame(CUeglFrame* eglFrame, CUgraphicsResource resource, unsigned int index, unsigned int mipLevel) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphicsResourceGetMappedEglFrame + _check_or_init_driver() + if __cuGraphicsResourceGetMappedEglFrame == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphicsResourceGetMappedEglFrame is not found") + return (__cuGraphicsResourceGetMappedEglFrame)( + eglFrame, resource, index, mipLevel) + + +cdef CUresult _cuEventCreateFromEGLSync(CUevent* phEvent, EGLSyncKHR eglSync, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuEventCreateFromEGLSync + _check_or_init_driver() + if __cuEventCreateFromEGLSync == NULL: + with gil: + raise FunctionNotFoundError("function cuEventCreateFromEGLSync is not found") + return (__cuEventCreateFromEGLSync)( + phEvent, eglSync, flags) + + +cdef CUresult _cuGraphicsGLRegisterBuffer(CUgraphicsResource* pCudaResource, GLuint buffer, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphicsGLRegisterBuffer + _check_or_init_driver() + if __cuGraphicsGLRegisterBuffer == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphicsGLRegisterBuffer is not found") + return (__cuGraphicsGLRegisterBuffer)( + pCudaResource, buffer, Flags) + + +cdef CUresult _cuGraphicsGLRegisterImage(CUgraphicsResource* pCudaResource, GLuint image, GLenum target, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphicsGLRegisterImage + _check_or_init_driver() + if __cuGraphicsGLRegisterImage == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphicsGLRegisterImage is not found") + return (__cuGraphicsGLRegisterImage)( + pCudaResource, image, target, Flags) + + +cdef CUresult _cuGLGetDevices_v2(unsigned int* pCudaDeviceCount, CUdevice* pCudaDevices, unsigned int cudaDeviceCount, CUGLDeviceList deviceList) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGLGetDevices_v2 + _check_or_init_driver() + if __cuGLGetDevices_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuGLGetDevices_v2 is not found") + return (__cuGLGetDevices_v2)( + pCudaDeviceCount, pCudaDevices, cudaDeviceCount, deviceList) + + +cdef CUresult _cuGLCtxCreate_v2(CUcontext* pCtx, unsigned int Flags, CUdevice device) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGLCtxCreate_v2 + _check_or_init_driver() + if __cuGLCtxCreate_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuGLCtxCreate_v2 is not found") + return (__cuGLCtxCreate_v2)( + pCtx, Flags, device) + + +cdef CUresult _cuGLInit() except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGLInit + _check_or_init_driver() + if __cuGLInit == NULL: + with gil: + raise FunctionNotFoundError("function cuGLInit is not found") + return (__cuGLInit)( + ) + + +cdef CUresult _cuGLRegisterBufferObject(GLuint buffer) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGLRegisterBufferObject + _check_or_init_driver() + if __cuGLRegisterBufferObject == NULL: + with gil: + raise FunctionNotFoundError("function cuGLRegisterBufferObject is not found") + return (__cuGLRegisterBufferObject)( + buffer) + + +cdef CUresult _cuGLMapBufferObject_v2(CUdeviceptr* dptr, size_t* size, GLuint buffer) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGLMapBufferObject_v2 + _check_or_init_driver() + if __cuGLMapBufferObject_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuGLMapBufferObject_v2 is not found") + return (__cuGLMapBufferObject_v2)( + dptr, size, buffer) + + +cdef CUresult _cuGLUnmapBufferObject(GLuint buffer) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGLUnmapBufferObject + _check_or_init_driver() + if __cuGLUnmapBufferObject == NULL: + with gil: + raise FunctionNotFoundError("function cuGLUnmapBufferObject is not found") + return (__cuGLUnmapBufferObject)( + buffer) + + +cdef CUresult _cuGLUnregisterBufferObject(GLuint buffer) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGLUnregisterBufferObject + _check_or_init_driver() + if __cuGLUnregisterBufferObject == NULL: + with gil: + raise FunctionNotFoundError("function cuGLUnregisterBufferObject is not found") + return (__cuGLUnregisterBufferObject)( + buffer) + + +cdef CUresult _cuGLSetBufferObjectMapFlags(GLuint buffer, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGLSetBufferObjectMapFlags + _check_or_init_driver() + if __cuGLSetBufferObjectMapFlags == NULL: + with gil: + raise FunctionNotFoundError("function cuGLSetBufferObjectMapFlags is not found") + return (__cuGLSetBufferObjectMapFlags)( + buffer, Flags) + + +cdef CUresult _cuGLMapBufferObjectAsync_v2(CUdeviceptr* dptr, size_t* size, GLuint buffer, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGLMapBufferObjectAsync_v2 + _check_or_init_driver() + if __cuGLMapBufferObjectAsync_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuGLMapBufferObjectAsync_v2 is not found") + return (__cuGLMapBufferObjectAsync_v2)( + dptr, size, buffer, hStream) + + +cdef CUresult _cuGLUnmapBufferObjectAsync(GLuint buffer, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGLUnmapBufferObjectAsync + _check_or_init_driver() + if __cuGLUnmapBufferObjectAsync == NULL: + with gil: + raise FunctionNotFoundError("function cuGLUnmapBufferObjectAsync is not found") + return (__cuGLUnmapBufferObjectAsync)( + buffer, hStream) + + +cdef CUresult _cuProfilerInitialize(const char* configFile, const char* outputFile, CUoutput_mode outputMode) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuProfilerInitialize + _check_or_init_driver() + if __cuProfilerInitialize == NULL: + with gil: + raise FunctionNotFoundError("function cuProfilerInitialize is not found") + return (__cuProfilerInitialize)( + configFile, outputFile, outputMode) + + +cdef CUresult _cuProfilerStart() except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuProfilerStart + _check_or_init_driver() + if __cuProfilerStart == NULL: + with gil: + raise FunctionNotFoundError("function cuProfilerStart is not found") + return (__cuProfilerStart)( + ) + + +cdef CUresult _cuProfilerStop() except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuProfilerStop + _check_or_init_driver() + if __cuProfilerStop == NULL: + with gil: + raise FunctionNotFoundError("function cuProfilerStop is not found") + return (__cuProfilerStop)( + ) + + +cdef CUresult _cuVDPAUGetDevice(CUdevice* pDevice, VdpDevice vdpDevice, VdpGetProcAddress* vdpGetProcAddress) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuVDPAUGetDevice + _check_or_init_driver() + if __cuVDPAUGetDevice == NULL: + with gil: + raise FunctionNotFoundError("function cuVDPAUGetDevice is not found") + return (__cuVDPAUGetDevice)( + pDevice, vdpDevice, vdpGetProcAddress) + + +cdef CUresult _cuVDPAUCtxCreate_v2(CUcontext* pCtx, unsigned int flags, CUdevice device, VdpDevice vdpDevice, VdpGetProcAddress* vdpGetProcAddress) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuVDPAUCtxCreate_v2 + _check_or_init_driver() + if __cuVDPAUCtxCreate_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuVDPAUCtxCreate_v2 is not found") + return (__cuVDPAUCtxCreate_v2)( + pCtx, flags, device, vdpDevice, vdpGetProcAddress) + + +cdef CUresult _cuGraphicsVDPAURegisterVideoSurface(CUgraphicsResource* pCudaResource, VdpVideoSurface vdpSurface, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphicsVDPAURegisterVideoSurface + _check_or_init_driver() + if __cuGraphicsVDPAURegisterVideoSurface == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphicsVDPAURegisterVideoSurface is not found") + return (__cuGraphicsVDPAURegisterVideoSurface)( + pCudaResource, vdpSurface, flags) + + +cdef CUresult _cuGraphicsVDPAURegisterOutputSurface(CUgraphicsResource* pCudaResource, VdpOutputSurface vdpSurface, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphicsVDPAURegisterOutputSurface + _check_or_init_driver() + if __cuGraphicsVDPAURegisterOutputSurface == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphicsVDPAURegisterOutputSurface is not found") + return (__cuGraphicsVDPAURegisterOutputSurface)( + pCudaResource, vdpSurface, flags) + + +cdef CUresult _cuDeviceGetHostAtomicCapabilities(unsigned int* capabilities, const CUatomicOperation* operations, unsigned int count, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDeviceGetHostAtomicCapabilities + _check_or_init_driver() + if __cuDeviceGetHostAtomicCapabilities == NULL: + with gil: + raise FunctionNotFoundError("function cuDeviceGetHostAtomicCapabilities is not found") + return (__cuDeviceGetHostAtomicCapabilities)( + capabilities, operations, count, dev) + + +cdef CUresult _cuCtxGetDevice_v2(CUdevice* device, CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxGetDevice_v2 + _check_or_init_driver() + if __cuCtxGetDevice_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxGetDevice_v2 is not found") + return (__cuCtxGetDevice_v2)( + device, ctx) + + +cdef CUresult _cuCtxSynchronize_v2(CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCtxSynchronize_v2 + _check_or_init_driver() + if __cuCtxSynchronize_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuCtxSynchronize_v2 is not found") + return (__cuCtxSynchronize_v2)( + ctx) + + +cdef CUresult _cuMemcpyBatchAsync_v2(CUdeviceptr* dsts, CUdeviceptr* srcs, size_t* sizes, size_t count, CUmemcpyAttributes* attrs, size_t* attrsIdxs, size_t numAttrs, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemcpyBatchAsync_v2 + _check_or_init_driver() + if __cuMemcpyBatchAsync_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemcpyBatchAsync_v2 is not found") + return (__cuMemcpyBatchAsync_v2)( + dsts, srcs, sizes, count, attrs, attrsIdxs, numAttrs, hStream) + + +cdef CUresult _cuMemcpy3DBatchAsync_v2(size_t numOps, CUDA_MEMCPY3D_BATCH_OP* opList, unsigned long long flags, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemcpy3DBatchAsync_v2 + _check_or_init_driver() + if __cuMemcpy3DBatchAsync_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMemcpy3DBatchAsync_v2 is not found") + return (__cuMemcpy3DBatchAsync_v2)( + numOps, opList, flags, hStream) + + +cdef CUresult _cuMemGetDefaultMemPool(CUmemoryPool* pool_out, CUmemLocation* location, CUmemAllocationType type) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemGetDefaultMemPool + _check_or_init_driver() + if __cuMemGetDefaultMemPool == NULL: + with gil: + raise FunctionNotFoundError("function cuMemGetDefaultMemPool is not found") + return (__cuMemGetDefaultMemPool)( + pool_out, location, type) + + +cdef CUresult _cuMemGetMemPool(CUmemoryPool* pool, CUmemLocation* location, CUmemAllocationType type) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemGetMemPool + _check_or_init_driver() + if __cuMemGetMemPool == NULL: + with gil: + raise FunctionNotFoundError("function cuMemGetMemPool is not found") + return (__cuMemGetMemPool)( + pool, location, type) + + +cdef CUresult _cuMemSetMemPool(CUmemLocation* location, CUmemAllocationType type, CUmemoryPool pool) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemSetMemPool + _check_or_init_driver() + if __cuMemSetMemPool == NULL: + with gil: + raise FunctionNotFoundError("function cuMemSetMemPool is not found") + return (__cuMemSetMemPool)( + location, type, pool) + + +cdef CUresult _cuMemPrefetchBatchAsync(CUdeviceptr* dptrs, size_t* sizes, size_t count, CUmemLocation* prefetchLocs, size_t* prefetchLocIdxs, size_t numPrefetchLocs, unsigned long long flags, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemPrefetchBatchAsync + _check_or_init_driver() + if __cuMemPrefetchBatchAsync == NULL: + with gil: + raise FunctionNotFoundError("function cuMemPrefetchBatchAsync is not found") + return (__cuMemPrefetchBatchAsync)( + dptrs, sizes, count, prefetchLocs, prefetchLocIdxs, numPrefetchLocs, flags, hStream) + + +cdef CUresult _cuMemDiscardBatchAsync(CUdeviceptr* dptrs, size_t* sizes, size_t count, unsigned long long flags, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemDiscardBatchAsync + _check_or_init_driver() + if __cuMemDiscardBatchAsync == NULL: + with gil: + raise FunctionNotFoundError("function cuMemDiscardBatchAsync is not found") + return (__cuMemDiscardBatchAsync)( + dptrs, sizes, count, flags, hStream) + + +cdef CUresult _cuMemDiscardAndPrefetchBatchAsync(CUdeviceptr* dptrs, size_t* sizes, size_t count, CUmemLocation* prefetchLocs, size_t* prefetchLocIdxs, size_t numPrefetchLocs, unsigned long long flags, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemDiscardAndPrefetchBatchAsync + _check_or_init_driver() + if __cuMemDiscardAndPrefetchBatchAsync == NULL: + with gil: + raise FunctionNotFoundError("function cuMemDiscardAndPrefetchBatchAsync is not found") + return (__cuMemDiscardAndPrefetchBatchAsync)( + dptrs, sizes, count, prefetchLocs, prefetchLocIdxs, numPrefetchLocs, flags, hStream) + + +cdef CUresult _cuDeviceGetP2PAtomicCapabilities(unsigned int* capabilities, const CUatomicOperation* operations, unsigned int count, CUdevice srcDevice, CUdevice dstDevice) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDeviceGetP2PAtomicCapabilities + _check_or_init_driver() + if __cuDeviceGetP2PAtomicCapabilities == NULL: + with gil: + raise FunctionNotFoundError("function cuDeviceGetP2PAtomicCapabilities is not found") + return (__cuDeviceGetP2PAtomicCapabilities)( + capabilities, operations, count, srcDevice, dstDevice) + + +cdef CUresult _cuGreenCtxGetId(CUgreenCtx greenCtx, unsigned long long* greenCtxId) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGreenCtxGetId + _check_or_init_driver() + if __cuGreenCtxGetId == NULL: + with gil: + raise FunctionNotFoundError("function cuGreenCtxGetId is not found") + return (__cuGreenCtxGetId)( + greenCtx, greenCtxId) + + +cdef CUresult _cuMulticastBindMem_v2(CUmemGenericAllocationHandle mcHandle, CUdevice dev, size_t mcOffset, CUmemGenericAllocationHandle memHandle, size_t memOffset, size_t size, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMulticastBindMem_v2 + _check_or_init_driver() + if __cuMulticastBindMem_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMulticastBindMem_v2 is not found") + return (__cuMulticastBindMem_v2)( + mcHandle, dev, mcOffset, memHandle, memOffset, size, flags) + + +cdef CUresult _cuMulticastBindAddr_v2(CUmemGenericAllocationHandle mcHandle, CUdevice dev, size_t mcOffset, CUdeviceptr memptr, size_t size, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMulticastBindAddr_v2 + _check_or_init_driver() + if __cuMulticastBindAddr_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuMulticastBindAddr_v2 is not found") + return (__cuMulticastBindAddr_v2)( + mcHandle, dev, mcOffset, memptr, size, flags) + + +cdef CUresult _cuGraphNodeGetContainingGraph(CUgraphNode hNode, CUgraph* phGraph) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphNodeGetContainingGraph + _check_or_init_driver() + if __cuGraphNodeGetContainingGraph == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphNodeGetContainingGraph is not found") + return (__cuGraphNodeGetContainingGraph)( + hNode, phGraph) + + +cdef CUresult _cuGraphNodeGetLocalId(CUgraphNode hNode, unsigned int* nodeId) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphNodeGetLocalId + _check_or_init_driver() + if __cuGraphNodeGetLocalId == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphNodeGetLocalId is not found") + return (__cuGraphNodeGetLocalId)( + hNode, nodeId) + + +cdef CUresult _cuGraphNodeGetToolsId(CUgraphNode hNode, unsigned long long* toolsNodeId) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphNodeGetToolsId + _check_or_init_driver() + if __cuGraphNodeGetToolsId == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphNodeGetToolsId is not found") + return (__cuGraphNodeGetToolsId)( + hNode, toolsNodeId) + + +cdef CUresult _cuGraphGetId(CUgraph hGraph, unsigned int* graphId) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphGetId + _check_or_init_driver() + if __cuGraphGetId == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphGetId is not found") + return (__cuGraphGetId)( + hGraph, graphId) + + +cdef CUresult _cuGraphExecGetId(CUgraphExec hGraphExec, unsigned int* graphId) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphExecGetId + _check_or_init_driver() + if __cuGraphExecGetId == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphExecGetId is not found") + return (__cuGraphExecGetId)( + hGraphExec, graphId) + + +cdef CUresult _cuDevSmResourceSplit(CUdevResource* result, unsigned int nbGroups, const CUdevResource* input, CUdevResource* remainder, unsigned int flags, CU_DEV_SM_RESOURCE_GROUP_PARAMS* groupParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuDevSmResourceSplit + _check_or_init_driver() + if __cuDevSmResourceSplit == NULL: + with gil: + raise FunctionNotFoundError("function cuDevSmResourceSplit is not found") + return (__cuDevSmResourceSplit)( + result, nbGroups, input, remainder, flags, groupParams) + + +cdef CUresult _cuStreamGetDevResource(CUstream hStream, CUdevResource* resource, CUdevResourceType type) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamGetDevResource + _check_or_init_driver() + if __cuStreamGetDevResource == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamGetDevResource is not found") + return (__cuStreamGetDevResource)( + hStream, resource, type) + + +cdef CUresult _cuKernelGetParamCount(CUkernel kernel, size_t* paramCount) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuKernelGetParamCount + _check_or_init_driver() + if __cuKernelGetParamCount == NULL: + with gil: + raise FunctionNotFoundError("function cuKernelGetParamCount is not found") + return (__cuKernelGetParamCount)( + kernel, paramCount) + + +cdef CUresult _cuMemcpyWithAttributesAsync(CUdeviceptr dst, CUdeviceptr src, size_t size, CUmemcpyAttributes* attr, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemcpyWithAttributesAsync + _check_or_init_driver() + if __cuMemcpyWithAttributesAsync == NULL: + with gil: + raise FunctionNotFoundError("function cuMemcpyWithAttributesAsync is not found") + return (__cuMemcpyWithAttributesAsync)( + dst, src, size, attr, hStream) + + +cdef CUresult _cuMemcpy3DWithAttributesAsync(CUDA_MEMCPY3D_BATCH_OP* op, unsigned long long flags, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuMemcpy3DWithAttributesAsync + _check_or_init_driver() + if __cuMemcpy3DWithAttributesAsync == NULL: + with gil: + raise FunctionNotFoundError("function cuMemcpy3DWithAttributesAsync is not found") + return (__cuMemcpy3DWithAttributesAsync)( + op, flags, hStream) + + +cdef CUresult _cuStreamBeginCaptureToCig(CUstream hStream, CUstreamCigCaptureParams* streamCigCaptureParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamBeginCaptureToCig + _check_or_init_driver() + if __cuStreamBeginCaptureToCig == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamBeginCaptureToCig is not found") + return (__cuStreamBeginCaptureToCig)( + hStream, streamCigCaptureParams) + + +cdef CUresult _cuStreamEndCaptureToCig(CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamEndCaptureToCig + _check_or_init_driver() + if __cuStreamEndCaptureToCig == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamEndCaptureToCig is not found") + return (__cuStreamEndCaptureToCig)( + hStream) + + +cdef CUresult _cuFuncGetParamCount(CUfunction func, size_t* paramCount) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuFuncGetParamCount + _check_or_init_driver() + if __cuFuncGetParamCount == NULL: + with gil: + raise FunctionNotFoundError("function cuFuncGetParamCount is not found") + return (__cuFuncGetParamCount)( + func, paramCount) + + +cdef CUresult _cuLaunchHostFunc_v2(CUstream hStream, CUhostFn fn, void* userData, unsigned int syncMode) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLaunchHostFunc_v2 + _check_or_init_driver() + if __cuLaunchHostFunc_v2 == NULL: + with gil: + raise FunctionNotFoundError("function cuLaunchHostFunc_v2 is not found") + return (__cuLaunchHostFunc_v2)( + hStream, fn, userData, syncMode) + + +cdef CUresult _cuGraphNodeGetParams(CUgraphNode hNode, CUgraphNodeParams* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuGraphNodeGetParams + _check_or_init_driver() + if __cuGraphNodeGetParams == NULL: + with gil: + raise FunctionNotFoundError("function cuGraphNodeGetParams is not found") + return (__cuGraphNodeGetParams)( + hNode, nodeParams) + + +cdef CUresult _cuCoredumpRegisterStartCallback(CUcoredumpStatusCallback callback, void* userData, CUcoredumpCallbackHandle* callbackOut) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCoredumpRegisterStartCallback + _check_or_init_driver() + if __cuCoredumpRegisterStartCallback == NULL: + with gil: + raise FunctionNotFoundError("function cuCoredumpRegisterStartCallback is not found") + return (__cuCoredumpRegisterStartCallback)( + callback, userData, callbackOut) + + +cdef CUresult _cuCoredumpRegisterCompleteCallback(CUcoredumpStatusCallback callback, void* userData, CUcoredumpCallbackHandle* callbackOut) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCoredumpRegisterCompleteCallback + _check_or_init_driver() + if __cuCoredumpRegisterCompleteCallback == NULL: + with gil: + raise FunctionNotFoundError("function cuCoredumpRegisterCompleteCallback is not found") + return (__cuCoredumpRegisterCompleteCallback)( + callback, userData, callbackOut) + + +cdef CUresult _cuCoredumpDeregisterStartCallback(CUcoredumpCallbackHandle callback) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCoredumpDeregisterStartCallback + _check_or_init_driver() + if __cuCoredumpDeregisterStartCallback == NULL: + with gil: + raise FunctionNotFoundError("function cuCoredumpDeregisterStartCallback is not found") + return (__cuCoredumpDeregisterStartCallback)( + callback) + + +cdef CUresult _cuCoredumpDeregisterCompleteCallback(CUcoredumpCallbackHandle callback) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuCoredumpDeregisterCompleteCallback + _check_or_init_driver() + if __cuCoredumpDeregisterCompleteCallback == NULL: + with gil: + raise FunctionNotFoundError("function cuCoredumpDeregisterCompleteCallback is not found") + return (__cuCoredumpDeregisterCompleteCallback)( + callback) + + +cdef CUresult _cuLogicalEndpointIdReserve(CUlogicalEndpointId* baseLeId, cuuint32_t count) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLogicalEndpointIdReserve + _check_or_init_driver() + if __cuLogicalEndpointIdReserve == NULL: + with gil: + raise FunctionNotFoundError("function cuLogicalEndpointIdReserve is not found") + return (__cuLogicalEndpointIdReserve)( + baseLeId, count) + + +cdef CUresult _cuLogicalEndpointIdRelease(CUlogicalEndpointId baseLeId, cuuint32_t count) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLogicalEndpointIdRelease + _check_or_init_driver() + if __cuLogicalEndpointIdRelease == NULL: + with gil: + raise FunctionNotFoundError("function cuLogicalEndpointIdRelease is not found") + return (__cuLogicalEndpointIdRelease)( + baseLeId, count) + + +cdef CUresult _cuLogicalEndpointCreate(CUlogicalEndpointId leId, const CUlogicalEndpointProp* prop) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLogicalEndpointCreate + _check_or_init_driver() + if __cuLogicalEndpointCreate == NULL: + with gil: + raise FunctionNotFoundError("function cuLogicalEndpointCreate is not found") + return (__cuLogicalEndpointCreate)( + leId, prop) + + +cdef CUresult _cuLogicalEndpointAddDevice(CUlogicalEndpointId leId, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLogicalEndpointAddDevice + _check_or_init_driver() + if __cuLogicalEndpointAddDevice == NULL: + with gil: + raise FunctionNotFoundError("function cuLogicalEndpointAddDevice is not found") + return (__cuLogicalEndpointAddDevice)( + leId, dev) + + +cdef CUresult _cuLogicalEndpointDestroy(CUlogicalEndpointId leId) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLogicalEndpointDestroy + _check_or_init_driver() + if __cuLogicalEndpointDestroy == NULL: + with gil: + raise FunctionNotFoundError("function cuLogicalEndpointDestroy is not found") + return (__cuLogicalEndpointDestroy)( + leId) + + +cdef CUresult _cuLogicalEndpointBindAddr(CUlogicalEndpointId leId, CUdevice dev, cuuint64_t offset, void* ptr, cuuint64_t size, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLogicalEndpointBindAddr + _check_or_init_driver() + if __cuLogicalEndpointBindAddr == NULL: + with gil: + raise FunctionNotFoundError("function cuLogicalEndpointBindAddr is not found") + return (__cuLogicalEndpointBindAddr)( + leId, dev, offset, ptr, size, flags) + + +cdef CUresult _cuLogicalEndpointBindMem(CUlogicalEndpointId leId, CUdevice dev, cuuint64_t offset, CUmemGenericAllocationHandle memHandle, cuuint64_t memOffset, cuuint64_t size, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLogicalEndpointBindMem + _check_or_init_driver() + if __cuLogicalEndpointBindMem == NULL: + with gil: + raise FunctionNotFoundError("function cuLogicalEndpointBindMem is not found") + return (__cuLogicalEndpointBindMem)( + leId, dev, offset, memHandle, memOffset, size, flags) + + +cdef CUresult _cuLogicalEndpointUnbind(CUlogicalEndpointId leId, CUdevice dev, cuuint64_t offset, cuuint64_t size) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLogicalEndpointUnbind + _check_or_init_driver() + if __cuLogicalEndpointUnbind == NULL: + with gil: + raise FunctionNotFoundError("function cuLogicalEndpointUnbind is not found") + return (__cuLogicalEndpointUnbind)( + leId, dev, offset, size) + + +cdef CUresult _cuLogicalEndpointExport(void* handle, CUlogicalEndpointId leId, CUlogicalEndpointIpcHandleType handleType) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLogicalEndpointExport + _check_or_init_driver() + if __cuLogicalEndpointExport == NULL: + with gil: + raise FunctionNotFoundError("function cuLogicalEndpointExport is not found") + return (__cuLogicalEndpointExport)( + handle, leId, handleType) + + +cdef CUresult _cuLogicalEndpointImport(CUlogicalEndpointId leId, const void* handle, CUlogicalEndpointIpcHandleType handleType) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLogicalEndpointImport + _check_or_init_driver() + if __cuLogicalEndpointImport == NULL: + with gil: + raise FunctionNotFoundError("function cuLogicalEndpointImport is not found") + return (__cuLogicalEndpointImport)( + leId, handle, handleType) + + +cdef CUresult _cuLogicalEndpointGetLimits(cuuint64_t* bindAlignment, cuuint64_t* maxSize, const CUlogicalEndpointProp* prop) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLogicalEndpointGetLimits + _check_or_init_driver() + if __cuLogicalEndpointGetLimits == NULL: + with gil: + raise FunctionNotFoundError("function cuLogicalEndpointGetLimits is not found") + return (__cuLogicalEndpointGetLimits)( + bindAlignment, maxSize, prop) + + +cdef CUresult _cuLogicalEndpointQuery(CUlogicalEndpointId leId, cuuint32_t count, int* queryStatus) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuLogicalEndpointQuery + _check_or_init_driver() + if __cuLogicalEndpointQuery == NULL: + with gil: + raise FunctionNotFoundError("function cuLogicalEndpointQuery is not found") + return (__cuLogicalEndpointQuery)( + leId, count, queryStatus) + + +cdef CUresult _cuStreamBeginRecaptureToGraph(CUstream hStream, CUstreamCaptureMode mode, CUgraph hGraph, CUgraphRecaptureCallback callbackFunc, void* userData) except ?CUDA_ERROR_NOT_FOUND nogil: + global __cuStreamBeginRecaptureToGraph + _check_or_init_driver() + if __cuStreamBeginRecaptureToGraph == NULL: + with gil: + raise FunctionNotFoundError("function cuStreamBeginRecaptureToGraph is not found") + return (__cuStreamBeginRecaptureToGraph)( + hStream, mode, hGraph, callbackFunc, userData) diff --git a/cuda_bindings/cuda/bindings/_internal/nvfatbin.pxd b/cuda_bindings/cuda/bindings/_internal/nvfatbin.pxd new file mode 100644 index 00000000000..b712a3087b8 --- /dev/null +++ b/cuda_bindings/cuda/bindings/_internal/nvfatbin.pxd @@ -0,0 +1,26 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +# This code was automatically generated across versions from 12.4.1 to 13.3.0. Do not modify it directly. + +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=b52d99b7f07615d6c5ecb869a5c632e6e9cb4d0cb4f6cb1e43977d29ecd9995c +from ..cynvfatbin cimport * + + +############################################################################### +# Wrapper functions +############################################################################### + +cdef const char* _nvFatbinGetErrorString(nvFatbinResult result) except?NULL nogil +cdef nvFatbinResult _nvFatbinCreate(nvFatbinHandle* handle_indirect, const char** options, size_t optionsCount) except?_NVFATBINRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvFatbinResult _nvFatbinDestroy(nvFatbinHandle* handle_indirect) except?_NVFATBINRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvFatbinResult _nvFatbinAddPTX(nvFatbinHandle handle, const char* code, size_t size, const char* arch, const char* identifier, const char* optionsCmdLine) except?_NVFATBINRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvFatbinResult _nvFatbinAddCubin(nvFatbinHandle handle, const void* code, size_t size, const char* arch, const char* identifier) except?_NVFATBINRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvFatbinResult _nvFatbinAddLTOIR(nvFatbinHandle handle, const void* code, size_t size, const char* arch, const char* identifier, const char* optionsCmdLine) except?_NVFATBINRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvFatbinResult _nvFatbinSize(nvFatbinHandle handle, size_t* size) except?_NVFATBINRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvFatbinResult _nvFatbinGet(nvFatbinHandle handle, void* buffer) except?_NVFATBINRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvFatbinResult _nvFatbinVersion(unsigned int* major, unsigned int* minor) except?_NVFATBINRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvFatbinResult _nvFatbinAddIndex(nvFatbinHandle handle, const void* code, size_t size, const char* identifier) except?_NVFATBINRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvFatbinResult _nvFatbinAddReloc(nvFatbinHandle handle, const void* code, size_t size) except?_NVFATBINRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvFatbinResult _nvFatbinAddTileIR(nvFatbinHandle handle, const void* code, size_t size, const char* identifier, const char* optionsCmdLine) except?_NVFATBINRESULT_INTERNAL_LOADING_ERROR nogil diff --git a/cuda_bindings/cuda/bindings/_internal/nvfatbin_linux.pyx b/cuda_bindings/cuda/bindings/_internal/nvfatbin_linux.pyx new file mode 100644 index 00000000000..8cdec7065b3 --- /dev/null +++ b/cuda_bindings/cuda/bindings/_internal/nvfatbin_linux.pyx @@ -0,0 +1,329 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +# This code was automatically generated across versions from 12.4.1 to 13.3.0. Do not modify it directly. +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=8a025fac12ad4fa9dc651c68c1ab7948f78cbb4b9450935db8f930c9d44988f4 + + +# <<<< PREAMBLE CONTENT >>>> + +cdef extern from "": + void* _cyb_dlsym "dlsym"(void*, const char*) nogil + const void * _cyb_RTLD_DEFAULT "RTLD_DEFAULT" + +from libc.stdint cimport intptr_t as _cyb_intptr_t + +import threading as _cyb_threading + +cdef bint _cyb___py_nvfatbin_init = False +cdef dict _cyb_func_ptrs = None +cdef object _cyb_symbol_lock = _cyb_threading.Lock() + +# <<<< END OF PREAMBLE CONTENT >>>> + +from libc.stdint cimport uintptr_t + +from .utils import FunctionNotFoundError, NotSupportedError +from cuda.pathfinder import load_nvidia_dynamic_lib + + +############################################################################### +# Wrapper init +############################################################################### + +cdef void* __nvFatbinGetErrorString = NULL +cdef void* __nvFatbinCreate = NULL +cdef void* __nvFatbinDestroy = NULL +cdef void* __nvFatbinAddPTX = NULL +cdef void* __nvFatbinAddCubin = NULL +cdef void* __nvFatbinAddLTOIR = NULL +cdef void* __nvFatbinSize = NULL +cdef void* __nvFatbinGet = NULL +cdef void* __nvFatbinVersion = NULL +cdef void* __nvFatbinAddIndex = NULL +cdef void* __nvFatbinAddReloc = NULL +cdef void* __nvFatbinAddTileIR = NULL + +cdef int _init_nvfatbin() except -1 nogil: + global _cyb___py_nvfatbin_init + cdef void* handle = NULL + with gil, _cyb_symbol_lock: + if _cyb___py_nvfatbin_init: return 0 + + global __nvFatbinGetErrorString + __nvFatbinGetErrorString = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvFatbinGetErrorString') + if __nvFatbinGetErrorString == NULL: + if handle == NULL: + handle = load_library() + __nvFatbinGetErrorString = _cyb_dlsym(handle, 'nvFatbinGetErrorString') + + global __nvFatbinCreate + __nvFatbinCreate = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvFatbinCreate') + if __nvFatbinCreate == NULL: + if handle == NULL: + handle = load_library() + __nvFatbinCreate = _cyb_dlsym(handle, 'nvFatbinCreate') + + global __nvFatbinDestroy + __nvFatbinDestroy = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvFatbinDestroy') + if __nvFatbinDestroy == NULL: + if handle == NULL: + handle = load_library() + __nvFatbinDestroy = _cyb_dlsym(handle, 'nvFatbinDestroy') + + global __nvFatbinAddPTX + __nvFatbinAddPTX = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvFatbinAddPTX') + if __nvFatbinAddPTX == NULL: + if handle == NULL: + handle = load_library() + __nvFatbinAddPTX = _cyb_dlsym(handle, 'nvFatbinAddPTX') + + global __nvFatbinAddCubin + __nvFatbinAddCubin = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvFatbinAddCubin') + if __nvFatbinAddCubin == NULL: + if handle == NULL: + handle = load_library() + __nvFatbinAddCubin = _cyb_dlsym(handle, 'nvFatbinAddCubin') + + global __nvFatbinAddLTOIR + __nvFatbinAddLTOIR = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvFatbinAddLTOIR') + if __nvFatbinAddLTOIR == NULL: + if handle == NULL: + handle = load_library() + __nvFatbinAddLTOIR = _cyb_dlsym(handle, 'nvFatbinAddLTOIR') + + global __nvFatbinSize + __nvFatbinSize = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvFatbinSize') + if __nvFatbinSize == NULL: + if handle == NULL: + handle = load_library() + __nvFatbinSize = _cyb_dlsym(handle, 'nvFatbinSize') + + global __nvFatbinGet + __nvFatbinGet = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvFatbinGet') + if __nvFatbinGet == NULL: + if handle == NULL: + handle = load_library() + __nvFatbinGet = _cyb_dlsym(handle, 'nvFatbinGet') + + global __nvFatbinVersion + __nvFatbinVersion = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvFatbinVersion') + if __nvFatbinVersion == NULL: + if handle == NULL: + handle = load_library() + __nvFatbinVersion = _cyb_dlsym(handle, 'nvFatbinVersion') + + global __nvFatbinAddIndex + __nvFatbinAddIndex = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvFatbinAddIndex') + if __nvFatbinAddIndex == NULL: + if handle == NULL: + handle = load_library() + __nvFatbinAddIndex = _cyb_dlsym(handle, 'nvFatbinAddIndex') + + global __nvFatbinAddReloc + __nvFatbinAddReloc = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvFatbinAddReloc') + if __nvFatbinAddReloc == NULL: + if handle == NULL: + handle = load_library() + __nvFatbinAddReloc = _cyb_dlsym(handle, 'nvFatbinAddReloc') + + global __nvFatbinAddTileIR + __nvFatbinAddTileIR = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvFatbinAddTileIR') + if __nvFatbinAddTileIR == NULL: + if handle == NULL: + handle = load_library() + __nvFatbinAddTileIR = _cyb_dlsym(handle, 'nvFatbinAddTileIR') + + _cyb___py_nvfatbin_init = True + return 0 + +cdef inline int _check_or_init_nvfatbin() except -1 nogil: + if _cyb___py_nvfatbin_init: + return 0 + + return _init_nvfatbin() + + +cpdef dict _inspect_function_pointers(): + global _cyb_func_ptrs + if _cyb_func_ptrs is not None: + return _cyb_func_ptrs + + _check_or_init_nvfatbin() + cdef dict data = {} + global __nvFatbinGetErrorString + data["__nvFatbinGetErrorString"] = <_cyb_intptr_t>__nvFatbinGetErrorString + + global __nvFatbinCreate + data["__nvFatbinCreate"] = <_cyb_intptr_t>__nvFatbinCreate + + global __nvFatbinDestroy + data["__nvFatbinDestroy"] = <_cyb_intptr_t>__nvFatbinDestroy + + global __nvFatbinAddPTX + data["__nvFatbinAddPTX"] = <_cyb_intptr_t>__nvFatbinAddPTX + + global __nvFatbinAddCubin + data["__nvFatbinAddCubin"] = <_cyb_intptr_t>__nvFatbinAddCubin + + global __nvFatbinAddLTOIR + data["__nvFatbinAddLTOIR"] = <_cyb_intptr_t>__nvFatbinAddLTOIR + + global __nvFatbinSize + data["__nvFatbinSize"] = <_cyb_intptr_t>__nvFatbinSize + + global __nvFatbinGet + data["__nvFatbinGet"] = <_cyb_intptr_t>__nvFatbinGet + + global __nvFatbinVersion + data["__nvFatbinVersion"] = <_cyb_intptr_t>__nvFatbinVersion + + global __nvFatbinAddIndex + data["__nvFatbinAddIndex"] = <_cyb_intptr_t>__nvFatbinAddIndex + + global __nvFatbinAddReloc + data["__nvFatbinAddReloc"] = <_cyb_intptr_t>__nvFatbinAddReloc + + global __nvFatbinAddTileIR + data["__nvFatbinAddTileIR"] = <_cyb_intptr_t>__nvFatbinAddTileIR + _cyb_func_ptrs = data + return data + + +cpdef _inspect_function_pointer(str name): + global _cyb_func_ptrs + if _cyb_func_ptrs is None: + _cyb_func_ptrs = _inspect_function_pointers() + return _cyb_func_ptrs[name] + + + + +cdef void* load_library() except* with gil: + cdef uintptr_t handle = load_nvidia_dynamic_lib("nvfatbin")._handle_uint + return handle + + +############################################################################### +# Wrapper functions +############################################################################### + +cdef const char* _nvFatbinGetErrorString(nvFatbinResult result) except?NULL nogil: + global __nvFatbinGetErrorString + _check_or_init_nvfatbin() + if __nvFatbinGetErrorString == NULL: + with gil: + raise FunctionNotFoundError("function nvFatbinGetErrorString is not found") + return (__nvFatbinGetErrorString)( + result) + + +cdef nvFatbinResult _nvFatbinCreate(nvFatbinHandle* handle_indirect, const char** options, size_t optionsCount) except?_NVFATBINRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvFatbinCreate + _check_or_init_nvfatbin() + if __nvFatbinCreate == NULL: + with gil: + raise FunctionNotFoundError("function nvFatbinCreate is not found") + return (__nvFatbinCreate)( + handle_indirect, options, optionsCount) + + +cdef nvFatbinResult _nvFatbinDestroy(nvFatbinHandle* handle_indirect) except?_NVFATBINRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvFatbinDestroy + _check_or_init_nvfatbin() + if __nvFatbinDestroy == NULL: + with gil: + raise FunctionNotFoundError("function nvFatbinDestroy is not found") + return (__nvFatbinDestroy)( + handle_indirect) + + +cdef nvFatbinResult _nvFatbinAddPTX(nvFatbinHandle handle, const char* code, size_t size, const char* arch, const char* identifier, const char* optionsCmdLine) except?_NVFATBINRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvFatbinAddPTX + _check_or_init_nvfatbin() + if __nvFatbinAddPTX == NULL: + with gil: + raise FunctionNotFoundError("function nvFatbinAddPTX is not found") + return (__nvFatbinAddPTX)( + handle, code, size, arch, identifier, optionsCmdLine) + + +cdef nvFatbinResult _nvFatbinAddCubin(nvFatbinHandle handle, const void* code, size_t size, const char* arch, const char* identifier) except?_NVFATBINRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvFatbinAddCubin + _check_or_init_nvfatbin() + if __nvFatbinAddCubin == NULL: + with gil: + raise FunctionNotFoundError("function nvFatbinAddCubin is not found") + return (__nvFatbinAddCubin)( + handle, code, size, arch, identifier) + + +cdef nvFatbinResult _nvFatbinAddLTOIR(nvFatbinHandle handle, const void* code, size_t size, const char* arch, const char* identifier, const char* optionsCmdLine) except?_NVFATBINRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvFatbinAddLTOIR + _check_or_init_nvfatbin() + if __nvFatbinAddLTOIR == NULL: + with gil: + raise FunctionNotFoundError("function nvFatbinAddLTOIR is not found") + return (__nvFatbinAddLTOIR)( + handle, code, size, arch, identifier, optionsCmdLine) + + +cdef nvFatbinResult _nvFatbinSize(nvFatbinHandle handle, size_t* size) except?_NVFATBINRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvFatbinSize + _check_or_init_nvfatbin() + if __nvFatbinSize == NULL: + with gil: + raise FunctionNotFoundError("function nvFatbinSize is not found") + return (__nvFatbinSize)( + handle, size) + + +cdef nvFatbinResult _nvFatbinGet(nvFatbinHandle handle, void* buffer) except?_NVFATBINRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvFatbinGet + _check_or_init_nvfatbin() + if __nvFatbinGet == NULL: + with gil: + raise FunctionNotFoundError("function nvFatbinGet is not found") + return (__nvFatbinGet)( + handle, buffer) + + +cdef nvFatbinResult _nvFatbinVersion(unsigned int* major, unsigned int* minor) except?_NVFATBINRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvFatbinVersion + _check_or_init_nvfatbin() + if __nvFatbinVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvFatbinVersion is not found") + return (__nvFatbinVersion)( + major, minor) + + +cdef nvFatbinResult _nvFatbinAddIndex(nvFatbinHandle handle, const void* code, size_t size, const char* identifier) except?_NVFATBINRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvFatbinAddIndex + _check_or_init_nvfatbin() + if __nvFatbinAddIndex == NULL: + with gil: + raise FunctionNotFoundError("function nvFatbinAddIndex is not found") + return (__nvFatbinAddIndex)( + handle, code, size, identifier) + + +cdef nvFatbinResult _nvFatbinAddReloc(nvFatbinHandle handle, const void* code, size_t size) except?_NVFATBINRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvFatbinAddReloc + _check_or_init_nvfatbin() + if __nvFatbinAddReloc == NULL: + with gil: + raise FunctionNotFoundError("function nvFatbinAddReloc is not found") + return (__nvFatbinAddReloc)( + handle, code, size) + + +cdef nvFatbinResult _nvFatbinAddTileIR(nvFatbinHandle handle, const void* code, size_t size, const char* identifier, const char* optionsCmdLine) except?_NVFATBINRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvFatbinAddTileIR + _check_or_init_nvfatbin() + if __nvFatbinAddTileIR == NULL: + with gil: + raise FunctionNotFoundError("function nvFatbinAddTileIR is not found") + return (__nvFatbinAddTileIR)( + handle, code, size, identifier, optionsCmdLine) diff --git a/cuda_bindings/cuda/bindings/_internal/nvfatbin_windows.pyx b/cuda_bindings/cuda/bindings/_internal/nvfatbin_windows.pyx new file mode 100644 index 00000000000..c9bb82113cb --- /dev/null +++ b/cuda_bindings/cuda/bindings/_internal/nvfatbin_windows.pyx @@ -0,0 +1,280 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +# This code was automatically generated across versions from 12.4.1 to 13.3.0. Do not modify it directly. +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=c44272bf506dcc20b5771a20fb6efc77f920c9b9bb21a89b53e3a9e7d69ce1ef + + +# <<<< PREAMBLE CONTENT >>>> + +cdef extern from "": + ctypedef void* HMODULE + void* _cyb_GetProcAddress "GetProcAddress"(HMODULE, const char*) nogil + +from libc.stdint cimport intptr_t as _cyb_intptr_t + +import threading as _cyb_threading + +cdef bint _cyb___py_nvfatbin_init = False +cdef dict _cyb_func_ptrs = None +cdef object _cyb_symbol_lock = _cyb_threading.Lock() + +# <<<< END OF PREAMBLE CONTENT >>>> + +from libc.stdint cimport uintptr_t +from cuda.pathfinder import load_nvidia_dynamic_lib +from .utils import FunctionNotFoundError, NotSupportedError +############################################################################### +# Wrapper init +############################################################################### + +cdef void* __nvFatbinGetErrorString = NULL +cdef void* __nvFatbinCreate = NULL +cdef void* __nvFatbinDestroy = NULL +cdef void* __nvFatbinAddPTX = NULL +cdef void* __nvFatbinAddCubin = NULL +cdef void* __nvFatbinAddLTOIR = NULL +cdef void* __nvFatbinSize = NULL +cdef void* __nvFatbinGet = NULL +cdef void* __nvFatbinVersion = NULL +cdef void* __nvFatbinAddIndex = NULL +cdef void* __nvFatbinAddReloc = NULL +cdef void* __nvFatbinAddTileIR = NULL + +cdef int _init_nvfatbin() except -1 nogil: + global _cyb___py_nvfatbin_init + + cdef int err + cdef uintptr_t handle + with gil, _cyb_symbol_lock: + if _cyb___py_nvfatbin_init: return 0 + + handle = load_library() + global __nvFatbinGetErrorString + __nvFatbinGetErrorString = _cyb_GetProcAddress(handle, 'nvFatbinGetErrorString') + + global __nvFatbinCreate + __nvFatbinCreate = _cyb_GetProcAddress(handle, 'nvFatbinCreate') + + global __nvFatbinDestroy + __nvFatbinDestroy = _cyb_GetProcAddress(handle, 'nvFatbinDestroy') + + global __nvFatbinAddPTX + __nvFatbinAddPTX = _cyb_GetProcAddress(handle, 'nvFatbinAddPTX') + + global __nvFatbinAddCubin + __nvFatbinAddCubin = _cyb_GetProcAddress(handle, 'nvFatbinAddCubin') + + global __nvFatbinAddLTOIR + __nvFatbinAddLTOIR = _cyb_GetProcAddress(handle, 'nvFatbinAddLTOIR') + + global __nvFatbinSize + __nvFatbinSize = _cyb_GetProcAddress(handle, 'nvFatbinSize') + + global __nvFatbinGet + __nvFatbinGet = _cyb_GetProcAddress(handle, 'nvFatbinGet') + + global __nvFatbinVersion + __nvFatbinVersion = _cyb_GetProcAddress(handle, 'nvFatbinVersion') + + global __nvFatbinAddIndex + __nvFatbinAddIndex = _cyb_GetProcAddress(handle, 'nvFatbinAddIndex') + + global __nvFatbinAddReloc + __nvFatbinAddReloc = _cyb_GetProcAddress(handle, 'nvFatbinAddReloc') + + global __nvFatbinAddTileIR + __nvFatbinAddTileIR = _cyb_GetProcAddress(handle, 'nvFatbinAddTileIR') + + _cyb___py_nvfatbin_init = True + return 0 + +cdef inline int _check_or_init_nvfatbin() except -1 nogil: + if _cyb___py_nvfatbin_init: + return 0 + + return _init_nvfatbin() + + +cpdef dict _inspect_function_pointers(): + global _cyb_func_ptrs + if _cyb_func_ptrs is not None: + return _cyb_func_ptrs + + _check_or_init_nvfatbin() + cdef dict data = {} + global __nvFatbinGetErrorString + data["__nvFatbinGetErrorString"] = <_cyb_intptr_t>__nvFatbinGetErrorString + + global __nvFatbinCreate + data["__nvFatbinCreate"] = <_cyb_intptr_t>__nvFatbinCreate + + global __nvFatbinDestroy + data["__nvFatbinDestroy"] = <_cyb_intptr_t>__nvFatbinDestroy + + global __nvFatbinAddPTX + data["__nvFatbinAddPTX"] = <_cyb_intptr_t>__nvFatbinAddPTX + + global __nvFatbinAddCubin + data["__nvFatbinAddCubin"] = <_cyb_intptr_t>__nvFatbinAddCubin + + global __nvFatbinAddLTOIR + data["__nvFatbinAddLTOIR"] = <_cyb_intptr_t>__nvFatbinAddLTOIR + + global __nvFatbinSize + data["__nvFatbinSize"] = <_cyb_intptr_t>__nvFatbinSize + + global __nvFatbinGet + data["__nvFatbinGet"] = <_cyb_intptr_t>__nvFatbinGet + + global __nvFatbinVersion + data["__nvFatbinVersion"] = <_cyb_intptr_t>__nvFatbinVersion + + global __nvFatbinAddIndex + data["__nvFatbinAddIndex"] = <_cyb_intptr_t>__nvFatbinAddIndex + + global __nvFatbinAddReloc + data["__nvFatbinAddReloc"] = <_cyb_intptr_t>__nvFatbinAddReloc + + global __nvFatbinAddTileIR + data["__nvFatbinAddTileIR"] = <_cyb_intptr_t>__nvFatbinAddTileIR + _cyb_func_ptrs = data + return data + + +cpdef _inspect_function_pointer(str name): + global _cyb_func_ptrs + if _cyb_func_ptrs is None: + _cyb_func_ptrs = _inspect_function_pointers() + return _cyb_func_ptrs[name] + + + + +cdef uintptr_t load_library() except* with gil: + return load_nvidia_dynamic_lib("nvfatbin")._handle_uint + + +############################################################################### +# Wrapper functions +############################################################################### + +cdef const char* _nvFatbinGetErrorString(nvFatbinResult result) except?NULL nogil: + global __nvFatbinGetErrorString + _check_or_init_nvfatbin() + if __nvFatbinGetErrorString == NULL: + with gil: + raise FunctionNotFoundError("function nvFatbinGetErrorString is not found") + return (__nvFatbinGetErrorString)( + result) + + +cdef nvFatbinResult _nvFatbinCreate(nvFatbinHandle* handle_indirect, const char** options, size_t optionsCount) except?_NVFATBINRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvFatbinCreate + _check_or_init_nvfatbin() + if __nvFatbinCreate == NULL: + with gil: + raise FunctionNotFoundError("function nvFatbinCreate is not found") + return (__nvFatbinCreate)( + handle_indirect, options, optionsCount) + + +cdef nvFatbinResult _nvFatbinDestroy(nvFatbinHandle* handle_indirect) except?_NVFATBINRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvFatbinDestroy + _check_or_init_nvfatbin() + if __nvFatbinDestroy == NULL: + with gil: + raise FunctionNotFoundError("function nvFatbinDestroy is not found") + return (__nvFatbinDestroy)( + handle_indirect) + + +cdef nvFatbinResult _nvFatbinAddPTX(nvFatbinHandle handle, const char* code, size_t size, const char* arch, const char* identifier, const char* optionsCmdLine) except?_NVFATBINRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvFatbinAddPTX + _check_or_init_nvfatbin() + if __nvFatbinAddPTX == NULL: + with gil: + raise FunctionNotFoundError("function nvFatbinAddPTX is not found") + return (__nvFatbinAddPTX)( + handle, code, size, arch, identifier, optionsCmdLine) + + +cdef nvFatbinResult _nvFatbinAddCubin(nvFatbinHandle handle, const void* code, size_t size, const char* arch, const char* identifier) except?_NVFATBINRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvFatbinAddCubin + _check_or_init_nvfatbin() + if __nvFatbinAddCubin == NULL: + with gil: + raise FunctionNotFoundError("function nvFatbinAddCubin is not found") + return (__nvFatbinAddCubin)( + handle, code, size, arch, identifier) + + +cdef nvFatbinResult _nvFatbinAddLTOIR(nvFatbinHandle handle, const void* code, size_t size, const char* arch, const char* identifier, const char* optionsCmdLine) except?_NVFATBINRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvFatbinAddLTOIR + _check_or_init_nvfatbin() + if __nvFatbinAddLTOIR == NULL: + with gil: + raise FunctionNotFoundError("function nvFatbinAddLTOIR is not found") + return (__nvFatbinAddLTOIR)( + handle, code, size, arch, identifier, optionsCmdLine) + + +cdef nvFatbinResult _nvFatbinSize(nvFatbinHandle handle, size_t* size) except?_NVFATBINRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvFatbinSize + _check_or_init_nvfatbin() + if __nvFatbinSize == NULL: + with gil: + raise FunctionNotFoundError("function nvFatbinSize is not found") + return (__nvFatbinSize)( + handle, size) + + +cdef nvFatbinResult _nvFatbinGet(nvFatbinHandle handle, void* buffer) except?_NVFATBINRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvFatbinGet + _check_or_init_nvfatbin() + if __nvFatbinGet == NULL: + with gil: + raise FunctionNotFoundError("function nvFatbinGet is not found") + return (__nvFatbinGet)( + handle, buffer) + + +cdef nvFatbinResult _nvFatbinVersion(unsigned int* major, unsigned int* minor) except?_NVFATBINRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvFatbinVersion + _check_or_init_nvfatbin() + if __nvFatbinVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvFatbinVersion is not found") + return (__nvFatbinVersion)( + major, minor) + + +cdef nvFatbinResult _nvFatbinAddIndex(nvFatbinHandle handle, const void* code, size_t size, const char* identifier) except?_NVFATBINRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvFatbinAddIndex + _check_or_init_nvfatbin() + if __nvFatbinAddIndex == NULL: + with gil: + raise FunctionNotFoundError("function nvFatbinAddIndex is not found") + return (__nvFatbinAddIndex)( + handle, code, size, identifier) + + +cdef nvFatbinResult _nvFatbinAddReloc(nvFatbinHandle handle, const void* code, size_t size) except?_NVFATBINRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvFatbinAddReloc + _check_or_init_nvfatbin() + if __nvFatbinAddReloc == NULL: + with gil: + raise FunctionNotFoundError("function nvFatbinAddReloc is not found") + return (__nvFatbinAddReloc)( + handle, code, size) + + +cdef nvFatbinResult _nvFatbinAddTileIR(nvFatbinHandle handle, const void* code, size_t size, const char* identifier, const char* optionsCmdLine) except?_NVFATBINRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvFatbinAddTileIR + _check_or_init_nvfatbin() + if __nvFatbinAddTileIR == NULL: + with gil: + raise FunctionNotFoundError("function nvFatbinAddTileIR is not found") + return (__nvFatbinAddTileIR)( + handle, code, size, identifier, optionsCmdLine) diff --git a/cuda_bindings/cuda/bindings/_internal/nvjitlink.pxd b/cuda_bindings/cuda/bindings/_internal/nvjitlink.pxd new file mode 100644 index 00000000000..edfe717e649 --- /dev/null +++ b/cuda_bindings/cuda/bindings/_internal/nvjitlink.pxd @@ -0,0 +1,30 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +# This code was automatically generated across versions from 12.0.1 to 13.3.0. Do not modify it directly. + +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=fd32577c0d6b922ff30c56dc4f3dcbed2251c393098c27d972ccc8688564fa50 +from ..cynvjitlink cimport * + + +############################################################################### +# Wrapper functions +############################################################################### + +cdef nvJitLinkResult _nvJitLinkCreate(nvJitLinkHandle* handle, uint32_t numOptions, const char** options) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvJitLinkResult _nvJitLinkDestroy(nvJitLinkHandle* handle) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvJitLinkResult _nvJitLinkAddData(nvJitLinkHandle handle, nvJitLinkInputType inputType, const void* data, size_t size, const char* name) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvJitLinkResult _nvJitLinkAddFile(nvJitLinkHandle handle, nvJitLinkInputType inputType, const char* fileName) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvJitLinkResult _nvJitLinkComplete(nvJitLinkHandle handle) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvJitLinkResult _nvJitLinkGetLinkedCubinSize(nvJitLinkHandle handle, size_t* size) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvJitLinkResult _nvJitLinkGetLinkedCubin(nvJitLinkHandle handle, void* cubin) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvJitLinkResult _nvJitLinkGetLinkedPtxSize(nvJitLinkHandle handle, size_t* size) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvJitLinkResult _nvJitLinkGetLinkedPtx(nvJitLinkHandle handle, char* ptx) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvJitLinkResult _nvJitLinkGetErrorLogSize(nvJitLinkHandle handle, size_t* size) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvJitLinkResult _nvJitLinkGetErrorLog(nvJitLinkHandle handle, char* log) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvJitLinkResult _nvJitLinkGetInfoLogSize(nvJitLinkHandle handle, size_t* size) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvJitLinkResult _nvJitLinkGetInfoLog(nvJitLinkHandle handle, char* log) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvJitLinkResult _nvJitLinkVersion(unsigned int* major, unsigned int* minor) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvJitLinkResult _nvJitLinkGetLinkedLTOIRSize(nvJitLinkHandle handle, size_t* size) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvJitLinkResult _nvJitLinkGetLinkedLTOIR(nvJitLinkHandle handle, void* ltoir) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil diff --git a/cuda_bindings/cuda/bindings/_internal/nvjitlink_linux.pyx b/cuda_bindings/cuda/bindings/_internal/nvjitlink_linux.pyx new file mode 100644 index 00000000000..2ff4282e6c4 --- /dev/null +++ b/cuda_bindings/cuda/bindings/_internal/nvjitlink_linux.pyx @@ -0,0 +1,413 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +# This code was automatically generated across versions from 12.0.1 to 13.3.0. Do not modify it directly. +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=2a8907b5ab8df8ecb19b6d0fd3014dea67a9e76e7a2a0ee81fdf23f449402dd6 + + +# <<<< PREAMBLE CONTENT >>>> + +cdef extern from "": + void* _cyb_dlsym "dlsym"(void*, const char*) nogil + const void * _cyb_RTLD_DEFAULT "RTLD_DEFAULT" + +from libc.stdint cimport intptr_t as _cyb_intptr_t + +import threading as _cyb_threading + +cdef bint _cyb___py_nvjitlink_init = False +cdef dict _cyb_func_ptrs = None +cdef object _cyb_symbol_lock = _cyb_threading.Lock() + +# <<<< END OF PREAMBLE CONTENT >>>> + +from libc.stdint cimport uintptr_t + +from .utils import FunctionNotFoundError, NotSupportedError +from cuda.pathfinder import load_nvidia_dynamic_lib + + +############################################################################### +# Wrapper init +############################################################################### + +cdef void* __nvJitLinkCreate = NULL +cdef void* __nvJitLinkDestroy = NULL +cdef void* __nvJitLinkAddData = NULL +cdef void* __nvJitLinkAddFile = NULL +cdef void* __nvJitLinkComplete = NULL +cdef void* __nvJitLinkGetLinkedCubinSize = NULL +cdef void* __nvJitLinkGetLinkedCubin = NULL +cdef void* __nvJitLinkGetLinkedPtxSize = NULL +cdef void* __nvJitLinkGetLinkedPtx = NULL +cdef void* __nvJitLinkGetErrorLogSize = NULL +cdef void* __nvJitLinkGetErrorLog = NULL +cdef void* __nvJitLinkGetInfoLogSize = NULL +cdef void* __nvJitLinkGetInfoLog = NULL +cdef void* __nvJitLinkVersion = NULL +cdef void* __nvJitLinkGetLinkedLTOIRSize = NULL +cdef void* __nvJitLinkGetLinkedLTOIR = NULL + +cdef int _init_nvjitlink() except -1 nogil: + global _cyb___py_nvjitlink_init + cdef void* handle = NULL + with gil, _cyb_symbol_lock: + if _cyb___py_nvjitlink_init: return 0 + + global __nvJitLinkCreate + __nvJitLinkCreate = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvJitLinkCreate') + if __nvJitLinkCreate == NULL: + if handle == NULL: + handle = load_library() + __nvJitLinkCreate = _cyb_dlsym(handle, 'nvJitLinkCreate') + + global __nvJitLinkDestroy + __nvJitLinkDestroy = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvJitLinkDestroy') + if __nvJitLinkDestroy == NULL: + if handle == NULL: + handle = load_library() + __nvJitLinkDestroy = _cyb_dlsym(handle, 'nvJitLinkDestroy') + + global __nvJitLinkAddData + __nvJitLinkAddData = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvJitLinkAddData') + if __nvJitLinkAddData == NULL: + if handle == NULL: + handle = load_library() + __nvJitLinkAddData = _cyb_dlsym(handle, 'nvJitLinkAddData') + + global __nvJitLinkAddFile + __nvJitLinkAddFile = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvJitLinkAddFile') + if __nvJitLinkAddFile == NULL: + if handle == NULL: + handle = load_library() + __nvJitLinkAddFile = _cyb_dlsym(handle, 'nvJitLinkAddFile') + + global __nvJitLinkComplete + __nvJitLinkComplete = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvJitLinkComplete') + if __nvJitLinkComplete == NULL: + if handle == NULL: + handle = load_library() + __nvJitLinkComplete = _cyb_dlsym(handle, 'nvJitLinkComplete') + + global __nvJitLinkGetLinkedCubinSize + __nvJitLinkGetLinkedCubinSize = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvJitLinkGetLinkedCubinSize') + if __nvJitLinkGetLinkedCubinSize == NULL: + if handle == NULL: + handle = load_library() + __nvJitLinkGetLinkedCubinSize = _cyb_dlsym(handle, 'nvJitLinkGetLinkedCubinSize') + + global __nvJitLinkGetLinkedCubin + __nvJitLinkGetLinkedCubin = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvJitLinkGetLinkedCubin') + if __nvJitLinkGetLinkedCubin == NULL: + if handle == NULL: + handle = load_library() + __nvJitLinkGetLinkedCubin = _cyb_dlsym(handle, 'nvJitLinkGetLinkedCubin') + + global __nvJitLinkGetLinkedPtxSize + __nvJitLinkGetLinkedPtxSize = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvJitLinkGetLinkedPtxSize') + if __nvJitLinkGetLinkedPtxSize == NULL: + if handle == NULL: + handle = load_library() + __nvJitLinkGetLinkedPtxSize = _cyb_dlsym(handle, 'nvJitLinkGetLinkedPtxSize') + + global __nvJitLinkGetLinkedPtx + __nvJitLinkGetLinkedPtx = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvJitLinkGetLinkedPtx') + if __nvJitLinkGetLinkedPtx == NULL: + if handle == NULL: + handle = load_library() + __nvJitLinkGetLinkedPtx = _cyb_dlsym(handle, 'nvJitLinkGetLinkedPtx') + + global __nvJitLinkGetErrorLogSize + __nvJitLinkGetErrorLogSize = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvJitLinkGetErrorLogSize') + if __nvJitLinkGetErrorLogSize == NULL: + if handle == NULL: + handle = load_library() + __nvJitLinkGetErrorLogSize = _cyb_dlsym(handle, 'nvJitLinkGetErrorLogSize') + + global __nvJitLinkGetErrorLog + __nvJitLinkGetErrorLog = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvJitLinkGetErrorLog') + if __nvJitLinkGetErrorLog == NULL: + if handle == NULL: + handle = load_library() + __nvJitLinkGetErrorLog = _cyb_dlsym(handle, 'nvJitLinkGetErrorLog') + + global __nvJitLinkGetInfoLogSize + __nvJitLinkGetInfoLogSize = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvJitLinkGetInfoLogSize') + if __nvJitLinkGetInfoLogSize == NULL: + if handle == NULL: + handle = load_library() + __nvJitLinkGetInfoLogSize = _cyb_dlsym(handle, 'nvJitLinkGetInfoLogSize') + + global __nvJitLinkGetInfoLog + __nvJitLinkGetInfoLog = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvJitLinkGetInfoLog') + if __nvJitLinkGetInfoLog == NULL: + if handle == NULL: + handle = load_library() + __nvJitLinkGetInfoLog = _cyb_dlsym(handle, 'nvJitLinkGetInfoLog') + + global __nvJitLinkVersion + __nvJitLinkVersion = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvJitLinkVersion') + if __nvJitLinkVersion == NULL: + if handle == NULL: + handle = load_library() + __nvJitLinkVersion = _cyb_dlsym(handle, 'nvJitLinkVersion') + + global __nvJitLinkGetLinkedLTOIRSize + __nvJitLinkGetLinkedLTOIRSize = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvJitLinkGetLinkedLTOIRSize') + if __nvJitLinkGetLinkedLTOIRSize == NULL: + if handle == NULL: + handle = load_library() + __nvJitLinkGetLinkedLTOIRSize = _cyb_dlsym(handle, 'nvJitLinkGetLinkedLTOIRSize') + + global __nvJitLinkGetLinkedLTOIR + __nvJitLinkGetLinkedLTOIR = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvJitLinkGetLinkedLTOIR') + if __nvJitLinkGetLinkedLTOIR == NULL: + if handle == NULL: + handle = load_library() + __nvJitLinkGetLinkedLTOIR = _cyb_dlsym(handle, 'nvJitLinkGetLinkedLTOIR') + + _cyb___py_nvjitlink_init = True + return 0 + +cdef inline int _check_or_init_nvjitlink() except -1 nogil: + if _cyb___py_nvjitlink_init: + return 0 + + return _init_nvjitlink() + + +cpdef dict _inspect_function_pointers(): + global _cyb_func_ptrs + if _cyb_func_ptrs is not None: + return _cyb_func_ptrs + + _check_or_init_nvjitlink() + cdef dict data = {} + global __nvJitLinkCreate + data["__nvJitLinkCreate"] = <_cyb_intptr_t>__nvJitLinkCreate + + global __nvJitLinkDestroy + data["__nvJitLinkDestroy"] = <_cyb_intptr_t>__nvJitLinkDestroy + + global __nvJitLinkAddData + data["__nvJitLinkAddData"] = <_cyb_intptr_t>__nvJitLinkAddData + + global __nvJitLinkAddFile + data["__nvJitLinkAddFile"] = <_cyb_intptr_t>__nvJitLinkAddFile + + global __nvJitLinkComplete + data["__nvJitLinkComplete"] = <_cyb_intptr_t>__nvJitLinkComplete + + global __nvJitLinkGetLinkedCubinSize + data["__nvJitLinkGetLinkedCubinSize"] = <_cyb_intptr_t>__nvJitLinkGetLinkedCubinSize + + global __nvJitLinkGetLinkedCubin + data["__nvJitLinkGetLinkedCubin"] = <_cyb_intptr_t>__nvJitLinkGetLinkedCubin + + global __nvJitLinkGetLinkedPtxSize + data["__nvJitLinkGetLinkedPtxSize"] = <_cyb_intptr_t>__nvJitLinkGetLinkedPtxSize + + global __nvJitLinkGetLinkedPtx + data["__nvJitLinkGetLinkedPtx"] = <_cyb_intptr_t>__nvJitLinkGetLinkedPtx + + global __nvJitLinkGetErrorLogSize + data["__nvJitLinkGetErrorLogSize"] = <_cyb_intptr_t>__nvJitLinkGetErrorLogSize + + global __nvJitLinkGetErrorLog + data["__nvJitLinkGetErrorLog"] = <_cyb_intptr_t>__nvJitLinkGetErrorLog + + global __nvJitLinkGetInfoLogSize + data["__nvJitLinkGetInfoLogSize"] = <_cyb_intptr_t>__nvJitLinkGetInfoLogSize + + global __nvJitLinkGetInfoLog + data["__nvJitLinkGetInfoLog"] = <_cyb_intptr_t>__nvJitLinkGetInfoLog + + global __nvJitLinkVersion + data["__nvJitLinkVersion"] = <_cyb_intptr_t>__nvJitLinkVersion + + global __nvJitLinkGetLinkedLTOIRSize + data["__nvJitLinkGetLinkedLTOIRSize"] = <_cyb_intptr_t>__nvJitLinkGetLinkedLTOIRSize + + global __nvJitLinkGetLinkedLTOIR + data["__nvJitLinkGetLinkedLTOIR"] = <_cyb_intptr_t>__nvJitLinkGetLinkedLTOIR + _cyb_func_ptrs = data + return data + + +cpdef _inspect_function_pointer(str name): + global _cyb_func_ptrs + if _cyb_func_ptrs is None: + _cyb_func_ptrs = _inspect_function_pointers() + return _cyb_func_ptrs[name] + + + + +cdef void* load_library() except* with gil: + cdef uintptr_t handle = load_nvidia_dynamic_lib("nvJitLink")._handle_uint + return handle + + +############################################################################### +# Wrapper functions +############################################################################### + +cdef nvJitLinkResult _nvJitLinkCreate(nvJitLinkHandle* handle, uint32_t numOptions, const char** options) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvJitLinkCreate + _check_or_init_nvjitlink() + if __nvJitLinkCreate == NULL: + with gil: + raise FunctionNotFoundError("function nvJitLinkCreate is not found") + return (__nvJitLinkCreate)( + handle, numOptions, options) + + +cdef nvJitLinkResult _nvJitLinkDestroy(nvJitLinkHandle* handle) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvJitLinkDestroy + _check_or_init_nvjitlink() + if __nvJitLinkDestroy == NULL: + with gil: + raise FunctionNotFoundError("function nvJitLinkDestroy is not found") + return (__nvJitLinkDestroy)( + handle) + + +cdef nvJitLinkResult _nvJitLinkAddData(nvJitLinkHandle handle, nvJitLinkInputType inputType, const void* data, size_t size, const char* name) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvJitLinkAddData + _check_or_init_nvjitlink() + if __nvJitLinkAddData == NULL: + with gil: + raise FunctionNotFoundError("function nvJitLinkAddData is not found") + return (__nvJitLinkAddData)( + handle, inputType, data, size, name) + + +cdef nvJitLinkResult _nvJitLinkAddFile(nvJitLinkHandle handle, nvJitLinkInputType inputType, const char* fileName) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvJitLinkAddFile + _check_or_init_nvjitlink() + if __nvJitLinkAddFile == NULL: + with gil: + raise FunctionNotFoundError("function nvJitLinkAddFile is not found") + return (__nvJitLinkAddFile)( + handle, inputType, fileName) + + +cdef nvJitLinkResult _nvJitLinkComplete(nvJitLinkHandle handle) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvJitLinkComplete + _check_or_init_nvjitlink() + if __nvJitLinkComplete == NULL: + with gil: + raise FunctionNotFoundError("function nvJitLinkComplete is not found") + return (__nvJitLinkComplete)( + handle) + + +cdef nvJitLinkResult _nvJitLinkGetLinkedCubinSize(nvJitLinkHandle handle, size_t* size) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvJitLinkGetLinkedCubinSize + _check_or_init_nvjitlink() + if __nvJitLinkGetLinkedCubinSize == NULL: + with gil: + raise FunctionNotFoundError("function nvJitLinkGetLinkedCubinSize is not found") + return (__nvJitLinkGetLinkedCubinSize)( + handle, size) + + +cdef nvJitLinkResult _nvJitLinkGetLinkedCubin(nvJitLinkHandle handle, void* cubin) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvJitLinkGetLinkedCubin + _check_or_init_nvjitlink() + if __nvJitLinkGetLinkedCubin == NULL: + with gil: + raise FunctionNotFoundError("function nvJitLinkGetLinkedCubin is not found") + return (__nvJitLinkGetLinkedCubin)( + handle, cubin) + + +cdef nvJitLinkResult _nvJitLinkGetLinkedPtxSize(nvJitLinkHandle handle, size_t* size) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvJitLinkGetLinkedPtxSize + _check_or_init_nvjitlink() + if __nvJitLinkGetLinkedPtxSize == NULL: + with gil: + raise FunctionNotFoundError("function nvJitLinkGetLinkedPtxSize is not found") + return (__nvJitLinkGetLinkedPtxSize)( + handle, size) + + +cdef nvJitLinkResult _nvJitLinkGetLinkedPtx(nvJitLinkHandle handle, char* ptx) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvJitLinkGetLinkedPtx + _check_or_init_nvjitlink() + if __nvJitLinkGetLinkedPtx == NULL: + with gil: + raise FunctionNotFoundError("function nvJitLinkGetLinkedPtx is not found") + return (__nvJitLinkGetLinkedPtx)( + handle, ptx) + + +cdef nvJitLinkResult _nvJitLinkGetErrorLogSize(nvJitLinkHandle handle, size_t* size) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvJitLinkGetErrorLogSize + _check_or_init_nvjitlink() + if __nvJitLinkGetErrorLogSize == NULL: + with gil: + raise FunctionNotFoundError("function nvJitLinkGetErrorLogSize is not found") + return (__nvJitLinkGetErrorLogSize)( + handle, size) + + +cdef nvJitLinkResult _nvJitLinkGetErrorLog(nvJitLinkHandle handle, char* log) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvJitLinkGetErrorLog + _check_or_init_nvjitlink() + if __nvJitLinkGetErrorLog == NULL: + with gil: + raise FunctionNotFoundError("function nvJitLinkGetErrorLog is not found") + return (__nvJitLinkGetErrorLog)( + handle, log) + + +cdef nvJitLinkResult _nvJitLinkGetInfoLogSize(nvJitLinkHandle handle, size_t* size) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvJitLinkGetInfoLogSize + _check_or_init_nvjitlink() + if __nvJitLinkGetInfoLogSize == NULL: + with gil: + raise FunctionNotFoundError("function nvJitLinkGetInfoLogSize is not found") + return (__nvJitLinkGetInfoLogSize)( + handle, size) + + +cdef nvJitLinkResult _nvJitLinkGetInfoLog(nvJitLinkHandle handle, char* log) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvJitLinkGetInfoLog + _check_or_init_nvjitlink() + if __nvJitLinkGetInfoLog == NULL: + with gil: + raise FunctionNotFoundError("function nvJitLinkGetInfoLog is not found") + return (__nvJitLinkGetInfoLog)( + handle, log) + + +cdef nvJitLinkResult _nvJitLinkVersion(unsigned int* major, unsigned int* minor) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvJitLinkVersion + _check_or_init_nvjitlink() + if __nvJitLinkVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvJitLinkVersion is not found") + return (__nvJitLinkVersion)( + major, minor) + + +cdef nvJitLinkResult _nvJitLinkGetLinkedLTOIRSize(nvJitLinkHandle handle, size_t* size) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvJitLinkGetLinkedLTOIRSize + _check_or_init_nvjitlink() + if __nvJitLinkGetLinkedLTOIRSize == NULL: + with gil: + raise FunctionNotFoundError("function nvJitLinkGetLinkedLTOIRSize is not found") + return (__nvJitLinkGetLinkedLTOIRSize)( + handle, size) + + +cdef nvJitLinkResult _nvJitLinkGetLinkedLTOIR(nvJitLinkHandle handle, void* ltoir) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvJitLinkGetLinkedLTOIR + _check_or_init_nvjitlink() + if __nvJitLinkGetLinkedLTOIR == NULL: + with gil: + raise FunctionNotFoundError("function nvJitLinkGetLinkedLTOIR is not found") + return (__nvJitLinkGetLinkedLTOIR)( + handle, ltoir) diff --git a/cuda_bindings/cuda/bindings/_internal/nvjitlink_windows.pyx b/cuda_bindings/cuda/bindings/_internal/nvjitlink_windows.pyx new file mode 100644 index 00000000000..680038584a7 --- /dev/null +++ b/cuda_bindings/cuda/bindings/_internal/nvjitlink_windows.pyx @@ -0,0 +1,348 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +# This code was automatically generated across versions from 12.0.1 to 13.3.0. Do not modify it directly. +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=8f99393554faa677ab0ab8326185997a183259db6b26b55561ed2ab6250201a6 + + +# <<<< PREAMBLE CONTENT >>>> + +cdef extern from "": + ctypedef void* HMODULE + void* _cyb_GetProcAddress "GetProcAddress"(HMODULE, const char*) nogil + +from libc.stdint cimport intptr_t as _cyb_intptr_t + +import threading as _cyb_threading + +cdef bint _cyb___py_nvjitlink_init = False +cdef dict _cyb_func_ptrs = None +cdef object _cyb_symbol_lock = _cyb_threading.Lock() + +# <<<< END OF PREAMBLE CONTENT >>>> + +from libc.stdint cimport uintptr_t +from cuda.pathfinder import load_nvidia_dynamic_lib +from .utils import FunctionNotFoundError, NotSupportedError +############################################################################### +# Wrapper init +############################################################################### + +cdef void* __nvJitLinkCreate = NULL +cdef void* __nvJitLinkDestroy = NULL +cdef void* __nvJitLinkAddData = NULL +cdef void* __nvJitLinkAddFile = NULL +cdef void* __nvJitLinkComplete = NULL +cdef void* __nvJitLinkGetLinkedCubinSize = NULL +cdef void* __nvJitLinkGetLinkedCubin = NULL +cdef void* __nvJitLinkGetLinkedPtxSize = NULL +cdef void* __nvJitLinkGetLinkedPtx = NULL +cdef void* __nvJitLinkGetErrorLogSize = NULL +cdef void* __nvJitLinkGetErrorLog = NULL +cdef void* __nvJitLinkGetInfoLogSize = NULL +cdef void* __nvJitLinkGetInfoLog = NULL +cdef void* __nvJitLinkVersion = NULL +cdef void* __nvJitLinkGetLinkedLTOIRSize = NULL +cdef void* __nvJitLinkGetLinkedLTOIR = NULL + +cdef int _init_nvjitlink() except -1 nogil: + global _cyb___py_nvjitlink_init + + cdef int err + cdef uintptr_t handle + with gil, _cyb_symbol_lock: + if _cyb___py_nvjitlink_init: return 0 + + handle = load_library() + global __nvJitLinkCreate + __nvJitLinkCreate = _cyb_GetProcAddress(handle, 'nvJitLinkCreate') + + global __nvJitLinkDestroy + __nvJitLinkDestroy = _cyb_GetProcAddress(handle, 'nvJitLinkDestroy') + + global __nvJitLinkAddData + __nvJitLinkAddData = _cyb_GetProcAddress(handle, 'nvJitLinkAddData') + + global __nvJitLinkAddFile + __nvJitLinkAddFile = _cyb_GetProcAddress(handle, 'nvJitLinkAddFile') + + global __nvJitLinkComplete + __nvJitLinkComplete = _cyb_GetProcAddress(handle, 'nvJitLinkComplete') + + global __nvJitLinkGetLinkedCubinSize + __nvJitLinkGetLinkedCubinSize = _cyb_GetProcAddress(handle, 'nvJitLinkGetLinkedCubinSize') + + global __nvJitLinkGetLinkedCubin + __nvJitLinkGetLinkedCubin = _cyb_GetProcAddress(handle, 'nvJitLinkGetLinkedCubin') + + global __nvJitLinkGetLinkedPtxSize + __nvJitLinkGetLinkedPtxSize = _cyb_GetProcAddress(handle, 'nvJitLinkGetLinkedPtxSize') + + global __nvJitLinkGetLinkedPtx + __nvJitLinkGetLinkedPtx = _cyb_GetProcAddress(handle, 'nvJitLinkGetLinkedPtx') + + global __nvJitLinkGetErrorLogSize + __nvJitLinkGetErrorLogSize = _cyb_GetProcAddress(handle, 'nvJitLinkGetErrorLogSize') + + global __nvJitLinkGetErrorLog + __nvJitLinkGetErrorLog = _cyb_GetProcAddress(handle, 'nvJitLinkGetErrorLog') + + global __nvJitLinkGetInfoLogSize + __nvJitLinkGetInfoLogSize = _cyb_GetProcAddress(handle, 'nvJitLinkGetInfoLogSize') + + global __nvJitLinkGetInfoLog + __nvJitLinkGetInfoLog = _cyb_GetProcAddress(handle, 'nvJitLinkGetInfoLog') + + global __nvJitLinkVersion + __nvJitLinkVersion = _cyb_GetProcAddress(handle, 'nvJitLinkVersion') + + global __nvJitLinkGetLinkedLTOIRSize + __nvJitLinkGetLinkedLTOIRSize = _cyb_GetProcAddress(handle, 'nvJitLinkGetLinkedLTOIRSize') + + global __nvJitLinkGetLinkedLTOIR + __nvJitLinkGetLinkedLTOIR = _cyb_GetProcAddress(handle, 'nvJitLinkGetLinkedLTOIR') + + _cyb___py_nvjitlink_init = True + return 0 + +cdef inline int _check_or_init_nvjitlink() except -1 nogil: + if _cyb___py_nvjitlink_init: + return 0 + + return _init_nvjitlink() + + +cpdef dict _inspect_function_pointers(): + global _cyb_func_ptrs + if _cyb_func_ptrs is not None: + return _cyb_func_ptrs + + _check_or_init_nvjitlink() + cdef dict data = {} + global __nvJitLinkCreate + data["__nvJitLinkCreate"] = <_cyb_intptr_t>__nvJitLinkCreate + + global __nvJitLinkDestroy + data["__nvJitLinkDestroy"] = <_cyb_intptr_t>__nvJitLinkDestroy + + global __nvJitLinkAddData + data["__nvJitLinkAddData"] = <_cyb_intptr_t>__nvJitLinkAddData + + global __nvJitLinkAddFile + data["__nvJitLinkAddFile"] = <_cyb_intptr_t>__nvJitLinkAddFile + + global __nvJitLinkComplete + data["__nvJitLinkComplete"] = <_cyb_intptr_t>__nvJitLinkComplete + + global __nvJitLinkGetLinkedCubinSize + data["__nvJitLinkGetLinkedCubinSize"] = <_cyb_intptr_t>__nvJitLinkGetLinkedCubinSize + + global __nvJitLinkGetLinkedCubin + data["__nvJitLinkGetLinkedCubin"] = <_cyb_intptr_t>__nvJitLinkGetLinkedCubin + + global __nvJitLinkGetLinkedPtxSize + data["__nvJitLinkGetLinkedPtxSize"] = <_cyb_intptr_t>__nvJitLinkGetLinkedPtxSize + + global __nvJitLinkGetLinkedPtx + data["__nvJitLinkGetLinkedPtx"] = <_cyb_intptr_t>__nvJitLinkGetLinkedPtx + + global __nvJitLinkGetErrorLogSize + data["__nvJitLinkGetErrorLogSize"] = <_cyb_intptr_t>__nvJitLinkGetErrorLogSize + + global __nvJitLinkGetErrorLog + data["__nvJitLinkGetErrorLog"] = <_cyb_intptr_t>__nvJitLinkGetErrorLog + + global __nvJitLinkGetInfoLogSize + data["__nvJitLinkGetInfoLogSize"] = <_cyb_intptr_t>__nvJitLinkGetInfoLogSize + + global __nvJitLinkGetInfoLog + data["__nvJitLinkGetInfoLog"] = <_cyb_intptr_t>__nvJitLinkGetInfoLog + + global __nvJitLinkVersion + data["__nvJitLinkVersion"] = <_cyb_intptr_t>__nvJitLinkVersion + + global __nvJitLinkGetLinkedLTOIRSize + data["__nvJitLinkGetLinkedLTOIRSize"] = <_cyb_intptr_t>__nvJitLinkGetLinkedLTOIRSize + + global __nvJitLinkGetLinkedLTOIR + data["__nvJitLinkGetLinkedLTOIR"] = <_cyb_intptr_t>__nvJitLinkGetLinkedLTOIR + _cyb_func_ptrs = data + return data + + +cpdef _inspect_function_pointer(str name): + global _cyb_func_ptrs + if _cyb_func_ptrs is None: + _cyb_func_ptrs = _inspect_function_pointers() + return _cyb_func_ptrs[name] + + + + +cdef uintptr_t load_library() except* with gil: + return load_nvidia_dynamic_lib("nvJitLink")._handle_uint + + +############################################################################### +# Wrapper functions +############################################################################### + +cdef nvJitLinkResult _nvJitLinkCreate(nvJitLinkHandle* handle, uint32_t numOptions, const char** options) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvJitLinkCreate + _check_or_init_nvjitlink() + if __nvJitLinkCreate == NULL: + with gil: + raise FunctionNotFoundError("function nvJitLinkCreate is not found") + return (__nvJitLinkCreate)( + handle, numOptions, options) + + +cdef nvJitLinkResult _nvJitLinkDestroy(nvJitLinkHandle* handle) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvJitLinkDestroy + _check_or_init_nvjitlink() + if __nvJitLinkDestroy == NULL: + with gil: + raise FunctionNotFoundError("function nvJitLinkDestroy is not found") + return (__nvJitLinkDestroy)( + handle) + + +cdef nvJitLinkResult _nvJitLinkAddData(nvJitLinkHandle handle, nvJitLinkInputType inputType, const void* data, size_t size, const char* name) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvJitLinkAddData + _check_or_init_nvjitlink() + if __nvJitLinkAddData == NULL: + with gil: + raise FunctionNotFoundError("function nvJitLinkAddData is not found") + return (__nvJitLinkAddData)( + handle, inputType, data, size, name) + + +cdef nvJitLinkResult _nvJitLinkAddFile(nvJitLinkHandle handle, nvJitLinkInputType inputType, const char* fileName) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvJitLinkAddFile + _check_or_init_nvjitlink() + if __nvJitLinkAddFile == NULL: + with gil: + raise FunctionNotFoundError("function nvJitLinkAddFile is not found") + return (__nvJitLinkAddFile)( + handle, inputType, fileName) + + +cdef nvJitLinkResult _nvJitLinkComplete(nvJitLinkHandle handle) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvJitLinkComplete + _check_or_init_nvjitlink() + if __nvJitLinkComplete == NULL: + with gil: + raise FunctionNotFoundError("function nvJitLinkComplete is not found") + return (__nvJitLinkComplete)( + handle) + + +cdef nvJitLinkResult _nvJitLinkGetLinkedCubinSize(nvJitLinkHandle handle, size_t* size) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvJitLinkGetLinkedCubinSize + _check_or_init_nvjitlink() + if __nvJitLinkGetLinkedCubinSize == NULL: + with gil: + raise FunctionNotFoundError("function nvJitLinkGetLinkedCubinSize is not found") + return (__nvJitLinkGetLinkedCubinSize)( + handle, size) + + +cdef nvJitLinkResult _nvJitLinkGetLinkedCubin(nvJitLinkHandle handle, void* cubin) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvJitLinkGetLinkedCubin + _check_or_init_nvjitlink() + if __nvJitLinkGetLinkedCubin == NULL: + with gil: + raise FunctionNotFoundError("function nvJitLinkGetLinkedCubin is not found") + return (__nvJitLinkGetLinkedCubin)( + handle, cubin) + + +cdef nvJitLinkResult _nvJitLinkGetLinkedPtxSize(nvJitLinkHandle handle, size_t* size) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvJitLinkGetLinkedPtxSize + _check_or_init_nvjitlink() + if __nvJitLinkGetLinkedPtxSize == NULL: + with gil: + raise FunctionNotFoundError("function nvJitLinkGetLinkedPtxSize is not found") + return (__nvJitLinkGetLinkedPtxSize)( + handle, size) + + +cdef nvJitLinkResult _nvJitLinkGetLinkedPtx(nvJitLinkHandle handle, char* ptx) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvJitLinkGetLinkedPtx + _check_or_init_nvjitlink() + if __nvJitLinkGetLinkedPtx == NULL: + with gil: + raise FunctionNotFoundError("function nvJitLinkGetLinkedPtx is not found") + return (__nvJitLinkGetLinkedPtx)( + handle, ptx) + + +cdef nvJitLinkResult _nvJitLinkGetErrorLogSize(nvJitLinkHandle handle, size_t* size) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvJitLinkGetErrorLogSize + _check_or_init_nvjitlink() + if __nvJitLinkGetErrorLogSize == NULL: + with gil: + raise FunctionNotFoundError("function nvJitLinkGetErrorLogSize is not found") + return (__nvJitLinkGetErrorLogSize)( + handle, size) + + +cdef nvJitLinkResult _nvJitLinkGetErrorLog(nvJitLinkHandle handle, char* log) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvJitLinkGetErrorLog + _check_or_init_nvjitlink() + if __nvJitLinkGetErrorLog == NULL: + with gil: + raise FunctionNotFoundError("function nvJitLinkGetErrorLog is not found") + return (__nvJitLinkGetErrorLog)( + handle, log) + + +cdef nvJitLinkResult _nvJitLinkGetInfoLogSize(nvJitLinkHandle handle, size_t* size) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvJitLinkGetInfoLogSize + _check_or_init_nvjitlink() + if __nvJitLinkGetInfoLogSize == NULL: + with gil: + raise FunctionNotFoundError("function nvJitLinkGetInfoLogSize is not found") + return (__nvJitLinkGetInfoLogSize)( + handle, size) + + +cdef nvJitLinkResult _nvJitLinkGetInfoLog(nvJitLinkHandle handle, char* log) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvJitLinkGetInfoLog + _check_or_init_nvjitlink() + if __nvJitLinkGetInfoLog == NULL: + with gil: + raise FunctionNotFoundError("function nvJitLinkGetInfoLog is not found") + return (__nvJitLinkGetInfoLog)( + handle, log) + + +cdef nvJitLinkResult _nvJitLinkVersion(unsigned int* major, unsigned int* minor) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvJitLinkVersion + _check_or_init_nvjitlink() + if __nvJitLinkVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvJitLinkVersion is not found") + return (__nvJitLinkVersion)( + major, minor) + + +cdef nvJitLinkResult _nvJitLinkGetLinkedLTOIRSize(nvJitLinkHandle handle, size_t* size) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvJitLinkGetLinkedLTOIRSize + _check_or_init_nvjitlink() + if __nvJitLinkGetLinkedLTOIRSize == NULL: + with gil: + raise FunctionNotFoundError("function nvJitLinkGetLinkedLTOIRSize is not found") + return (__nvJitLinkGetLinkedLTOIRSize)( + handle, size) + + +cdef nvJitLinkResult _nvJitLinkGetLinkedLTOIR(nvJitLinkHandle handle, void* ltoir) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvJitLinkGetLinkedLTOIR + _check_or_init_nvjitlink() + if __nvJitLinkGetLinkedLTOIR == NULL: + with gil: + raise FunctionNotFoundError("function nvJitLinkGetLinkedLTOIR is not found") + return (__nvJitLinkGetLinkedLTOIR)( + handle, ltoir) diff --git a/cuda_bindings/cuda/bindings/_internal/nvml.pxd b/cuda_bindings/cuda/bindings/_internal/nvml.pxd new file mode 100644 index 00000000000..eea80739f07 --- /dev/null +++ b/cuda_bindings/cuda/bindings/_internal/nvml.pxd @@ -0,0 +1,365 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +# This code was automatically generated across versions from 12.9.1 to 13.3.0. Do not modify it directly. + +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=ed4c433854399c2e4f1adc3ffcfc37901e1be29c5aa50728498c87225edf92b1 +from ..cynvml cimport * + + +############################################################################### +# Wrapper functions +############################################################################### + +cdef nvmlReturn_t _nvmlInit_v2() except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlInitWithFlags(unsigned int flags) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlShutdown() except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef const char* _nvmlErrorString(nvmlReturn_t result) except?NULL nogil +cdef nvmlReturn_t _nvmlSystemGetDriverVersion(char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlSystemGetNVMLVersion(char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlSystemGetCudaDriverVersion(int* cudaDriverVersion) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlSystemGetCudaDriverVersion_v2(int* cudaDriverVersion) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlSystemGetProcessName(unsigned int pid, char* name, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlSystemGetHicVersion(unsigned int* hwbcCount, nvmlHwbcEntry_t* hwbcEntries) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlSystemGetTopologyGpuSet(unsigned int cpuNumber, unsigned int* count, nvmlDevice_t* deviceArray) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlSystemGetDriverBranch(nvmlSystemDriverBranchInfo_t* branchInfo, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlUnitGetCount(unsigned int* unitCount) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlUnitGetHandleByIndex(unsigned int index, nvmlUnit_t* unit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlUnitGetUnitInfo(nvmlUnit_t unit, nvmlUnitInfo_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlUnitGetLedState(nvmlUnit_t unit, nvmlLedState_t* state) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlUnitGetPsuInfo(nvmlUnit_t unit, nvmlPSUInfo_t* psu) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlUnitGetTemperature(nvmlUnit_t unit, unsigned int type, unsigned int* temp) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlUnitGetFanSpeedInfo(nvmlUnit_t unit, nvmlUnitFanSpeeds_t* fanSpeeds) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlUnitGetDevices(nvmlUnit_t unit, unsigned int* deviceCount, nvmlDevice_t* devices) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetCount_v2(unsigned int* deviceCount) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetAttributes_v2(nvmlDevice_t device, nvmlDeviceAttributes_t* attributes) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetHandleByIndex_v2(unsigned int index, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetHandleBySerial(const char* serial, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetHandleByUUID(const char* uuid, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetHandleByUUIDV(const nvmlUUID_t* uuid, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetHandleByPciBusId_v2(const char* pciBusId, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetName(nvmlDevice_t device, char* name, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetBrand(nvmlDevice_t device, nvmlBrandType_t* type) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetIndex(nvmlDevice_t device, unsigned int* index) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetSerial(nvmlDevice_t device, char* serial, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetModuleId(nvmlDevice_t device, unsigned int* moduleId) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetC2cModeInfoV(nvmlDevice_t device, nvmlC2cModeInfo_v1_t* c2cModeInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetMemoryAffinity(nvmlDevice_t device, unsigned int nodeSetSize, unsigned long* nodeSet, nvmlAffinityScope_t scope) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetCpuAffinityWithinScope(nvmlDevice_t device, unsigned int cpuSetSize, unsigned long* cpuSet, nvmlAffinityScope_t scope) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetCpuAffinity(nvmlDevice_t device, unsigned int cpuSetSize, unsigned long* cpuSet) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetCpuAffinity(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceClearCpuAffinity(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetNumaNodeId(nvmlDevice_t device, unsigned int* node) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetTopologyCommonAncestor(nvmlDevice_t device1, nvmlDevice_t device2, nvmlGpuTopologyLevel_t* pathInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetTopologyNearestGpus(nvmlDevice_t device, nvmlGpuTopologyLevel_t level, unsigned int* count, nvmlDevice_t* deviceArray) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetP2PStatus(nvmlDevice_t device1, nvmlDevice_t device2, nvmlGpuP2PCapsIndex_t p2pIndex, nvmlGpuP2PStatus_t* p2pStatus) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetUUID(nvmlDevice_t device, char* uuid, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetMinorNumber(nvmlDevice_t device, unsigned int* minorNumber) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetBoardPartNumber(nvmlDevice_t device, char* partNumber, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetInforomVersion(nvmlDevice_t device, nvmlInforomObject_t object, char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetInforomImageVersion(nvmlDevice_t device, char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetInforomConfigurationChecksum(nvmlDevice_t device, unsigned int* checksum) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceValidateInforom(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetLastBBXFlushTime(nvmlDevice_t device, unsigned long long* timestamp, unsigned long* durationUs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetDisplayMode(nvmlDevice_t device, nvmlEnableState_t* display) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetDisplayActive(nvmlDevice_t device, nvmlEnableState_t* isActive) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetPersistenceMode(nvmlDevice_t device, nvmlEnableState_t* mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetPciInfoExt(nvmlDevice_t device, nvmlPciInfoExt_t* pci) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetPciInfo_v3(nvmlDevice_t device, nvmlPciInfo_t* pci) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetMaxPcieLinkGeneration(nvmlDevice_t device, unsigned int* maxLinkGen) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetGpuMaxPcieLinkGeneration(nvmlDevice_t device, unsigned int* maxLinkGenDevice) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetMaxPcieLinkWidth(nvmlDevice_t device, unsigned int* maxLinkWidth) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetCurrPcieLinkGeneration(nvmlDevice_t device, unsigned int* currLinkGen) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetCurrPcieLinkWidth(nvmlDevice_t device, unsigned int* currLinkWidth) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetPcieThroughput(nvmlDevice_t device, nvmlPcieUtilCounter_t counter, unsigned int* value) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetPcieReplayCounter(nvmlDevice_t device, unsigned int* value) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetClockInfo(nvmlDevice_t device, nvmlClockType_t type, unsigned int* clock) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetMaxClockInfo(nvmlDevice_t device, nvmlClockType_t type, unsigned int* clock) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetGpcClkVfOffset(nvmlDevice_t device, int* offset) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetClock(nvmlDevice_t device, nvmlClockType_t clockType, nvmlClockId_t clockId, unsigned int* clockMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetMaxCustomerBoostClock(nvmlDevice_t device, nvmlClockType_t clockType, unsigned int* clockMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetSupportedMemoryClocks(nvmlDevice_t device, unsigned int* count, unsigned int* clocksMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetSupportedGraphicsClocks(nvmlDevice_t device, unsigned int memoryClockMHz, unsigned int* count, unsigned int* clocksMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetAutoBoostedClocksEnabled(nvmlDevice_t device, nvmlEnableState_t* isEnabled, nvmlEnableState_t* defaultIsEnabled) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetFanSpeed(nvmlDevice_t device, unsigned int* speed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetFanSpeed_v2(nvmlDevice_t device, unsigned int fan, unsigned int* speed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetFanSpeedRPM(nvmlDevice_t device, nvmlFanSpeedInfo_t* fanSpeed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetTargetFanSpeed(nvmlDevice_t device, unsigned int fan, unsigned int* targetSpeed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetMinMaxFanSpeed(nvmlDevice_t device, unsigned int* minSpeed, unsigned int* maxSpeed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetFanControlPolicy_v2(nvmlDevice_t device, unsigned int fan, nvmlFanControlPolicy_t* policy) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetNumFans(nvmlDevice_t device, unsigned int* numFans) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetCoolerInfo(nvmlDevice_t device, nvmlCoolerInfo_t* coolerInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetTemperatureV(nvmlDevice_t device, nvmlTemperature_t* temperature) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetTemperatureThreshold(nvmlDevice_t device, nvmlTemperatureThresholds_t thresholdType, unsigned int* temp) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetMarginTemperature(nvmlDevice_t device, nvmlMarginTemperature_t* marginTempInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetThermalSettings(nvmlDevice_t device, unsigned int sensorIndex, nvmlGpuThermalSettings_t* pThermalSettings) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetPerformanceState(nvmlDevice_t device, nvmlPstates_t* pState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetCurrentClocksEventReasons(nvmlDevice_t device, unsigned long long* clocksEventReasons) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetSupportedClocksEventReasons(nvmlDevice_t device, unsigned long long* supportedClocksEventReasons) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetPowerState(nvmlDevice_t device, nvmlPstates_t* pState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetDynamicPstatesInfo(nvmlDevice_t device, nvmlGpuDynamicPstatesInfo_t* pDynamicPstatesInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetMemClkVfOffset(nvmlDevice_t device, int* offset) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetMinMaxClockOfPState(nvmlDevice_t device, nvmlClockType_t type, nvmlPstates_t pstate, unsigned int* minClockMHz, unsigned int* maxClockMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetSupportedPerformanceStates(nvmlDevice_t device, nvmlPstates_t* pstates, unsigned int size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetGpcClkMinMaxVfOffset(nvmlDevice_t device, int* minOffset, int* maxOffset) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetMemClkMinMaxVfOffset(nvmlDevice_t device, int* minOffset, int* maxOffset) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetClockOffsets(nvmlDevice_t device, nvmlClockOffset_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetClockOffsets(nvmlDevice_t device, nvmlClockOffset_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetPerformanceModes(nvmlDevice_t device, nvmlDevicePerfModes_t* perfModes) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetCurrentClockFreqs(nvmlDevice_t device, nvmlDeviceCurrentClockFreqs_t* currentClockFreqs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetPowerManagementLimit(nvmlDevice_t device, unsigned int* limit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetPowerManagementLimitConstraints(nvmlDevice_t device, unsigned int* minLimit, unsigned int* maxLimit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetPowerManagementDefaultLimit(nvmlDevice_t device, unsigned int* defaultLimit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetPowerUsage(nvmlDevice_t device, unsigned int* power) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetTotalEnergyConsumption(nvmlDevice_t device, unsigned long long* energy) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetEnforcedPowerLimit(nvmlDevice_t device, unsigned int* limit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetGpuOperationMode(nvmlDevice_t device, nvmlGpuOperationMode_t* current, nvmlGpuOperationMode_t* pending) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetMemoryInfo_v2(nvmlDevice_t device, nvmlMemory_v2_t* memory) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetComputeMode(nvmlDevice_t device, nvmlComputeMode_t* mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetCudaComputeCapability(nvmlDevice_t device, int* major, int* minor) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetDramEncryptionMode(nvmlDevice_t device, nvmlDramEncryptionInfo_t* current, nvmlDramEncryptionInfo_t* pending) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetDramEncryptionMode(nvmlDevice_t device, const nvmlDramEncryptionInfo_t* dramEncryption) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetEccMode(nvmlDevice_t device, nvmlEnableState_t* current, nvmlEnableState_t* pending) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetDefaultEccMode(nvmlDevice_t device, nvmlEnableState_t* defaultMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetBoardId(nvmlDevice_t device, unsigned int* boardId) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetMultiGpuBoard(nvmlDevice_t device, unsigned int* multiGpuBool) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetTotalEccErrors(nvmlDevice_t device, nvmlMemoryErrorType_t errorType, nvmlEccCounterType_t counterType, unsigned long long* eccCounts) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetMemoryErrorCounter(nvmlDevice_t device, nvmlMemoryErrorType_t errorType, nvmlEccCounterType_t counterType, nvmlMemoryLocation_t locationType, unsigned long long* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetUtilizationRates(nvmlDevice_t device, nvmlUtilization_t* utilization) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetEncoderUtilization(nvmlDevice_t device, unsigned int* utilization, unsigned int* samplingPeriodUs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetEncoderCapacity(nvmlDevice_t device, nvmlEncoderType_t encoderQueryType, unsigned int* encoderCapacity) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetEncoderStats(nvmlDevice_t device, unsigned int* sessionCount, unsigned int* averageFps, unsigned int* averageLatency) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetEncoderSessions(nvmlDevice_t device, unsigned int* sessionCount, nvmlEncoderSessionInfo_t* sessionInfos) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetDecoderUtilization(nvmlDevice_t device, unsigned int* utilization, unsigned int* samplingPeriodUs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetJpgUtilization(nvmlDevice_t device, unsigned int* utilization, unsigned int* samplingPeriodUs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetOfaUtilization(nvmlDevice_t device, unsigned int* utilization, unsigned int* samplingPeriodUs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetFBCStats(nvmlDevice_t device, nvmlFBCStats_t* fbcStats) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetFBCSessions(nvmlDevice_t device, unsigned int* sessionCount, nvmlFBCSessionInfo_t* sessionInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetDriverModel_v2(nvmlDevice_t device, nvmlDriverModel_t* current, nvmlDriverModel_t* pending) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetVbiosVersion(nvmlDevice_t device, char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetBridgeChipInfo(nvmlDevice_t device, nvmlBridgeChipHierarchy_t* bridgeHierarchy) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetComputeRunningProcesses_v3(nvmlDevice_t device, unsigned int* infoCount, nvmlProcessInfo_t* infos) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetGraphicsRunningProcesses_v3(nvmlDevice_t device, unsigned int* infoCount, nvmlProcessInfo_t* infos) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetMPSComputeRunningProcesses_v3(nvmlDevice_t device, unsigned int* infoCount, nvmlProcessInfo_t* infos) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetRunningProcessDetailList(nvmlDevice_t device, nvmlProcessDetailList_t* plist) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceOnSameBoard(nvmlDevice_t device1, nvmlDevice_t device2, int* onSameBoard) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetAPIRestriction(nvmlDevice_t device, nvmlRestrictedAPI_t apiType, nvmlEnableState_t* isRestricted) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetSamples(nvmlDevice_t device, nvmlSamplingType_t type, unsigned long long lastSeenTimeStamp, nvmlValueType_t* sampleValType, unsigned int* sampleCount, nvmlSample_t* samples) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetBAR1MemoryInfo(nvmlDevice_t device, nvmlBAR1Memory_t* bar1Memory) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetIrqNum(nvmlDevice_t device, unsigned int* irqNum) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetNumGpuCores(nvmlDevice_t device, unsigned int* numCores) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetPowerSource(nvmlDevice_t device, nvmlPowerSource_t* powerSource) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetMemoryBusWidth(nvmlDevice_t device, unsigned int* busWidth) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetPcieLinkMaxSpeed(nvmlDevice_t device, unsigned int* maxSpeed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetPcieSpeed(nvmlDevice_t device, unsigned int* pcieSpeed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetAdaptiveClockInfoStatus(nvmlDevice_t device, unsigned int* adaptiveClockStatus) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetBusType(nvmlDevice_t device, nvmlBusType_t* type) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetGpuFabricInfoV(nvmlDevice_t device, nvmlGpuFabricInfoV_t* gpuFabricInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlSystemGetConfComputeCapabilities(nvmlConfComputeSystemCaps_t* capabilities) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlSystemGetConfComputeState(nvmlConfComputeSystemState_t* state) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetConfComputeMemSizeInfo(nvmlDevice_t device, nvmlConfComputeMemSizeInfo_t* memInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlSystemGetConfComputeGpusReadyState(unsigned int* isAcceptingWork) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetConfComputeProtectedMemoryUsage(nvmlDevice_t device, nvmlMemory_t* memory) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetConfComputeGpuCertificate(nvmlDevice_t device, nvmlConfComputeGpuCertificate_t* gpuCert) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetConfComputeGpuAttestationReport(nvmlDevice_t device, nvmlConfComputeGpuAttestationReport_t* gpuAtstReport) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlSystemGetConfComputeKeyRotationThresholdInfo(nvmlConfComputeGetKeyRotationThresholdInfo_t* pKeyRotationThrInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetConfComputeUnprotectedMemSize(nvmlDevice_t device, unsigned long long sizeKiB) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlSystemSetConfComputeGpusReadyState(unsigned int isAcceptingWork) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlSystemSetConfComputeKeyRotationThresholdInfo(nvmlConfComputeSetKeyRotationThresholdInfo_t* pKeyRotationThrInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlSystemGetConfComputeSettings(nvmlSystemConfComputeSettings_t* settings) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetGspFirmwareVersion(nvmlDevice_t device, char* version) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetGspFirmwareMode(nvmlDevice_t device, unsigned int* isEnabled, unsigned int* defaultMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetSramEccErrorStatus(nvmlDevice_t device, nvmlEccSramErrorStatus_t* status) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetAccountingMode(nvmlDevice_t device, nvmlEnableState_t* mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetAccountingStats(nvmlDevice_t device, unsigned int pid, nvmlAccountingStats_t* stats) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetAccountingPids(nvmlDevice_t device, unsigned int* count, unsigned int* pids) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetAccountingBufferSize(nvmlDevice_t device, unsigned int* bufferSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetRetiredPages(nvmlDevice_t device, nvmlPageRetirementCause_t cause, unsigned int* pageCount, unsigned long long* addresses) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetRetiredPages_v2(nvmlDevice_t device, nvmlPageRetirementCause_t cause, unsigned int* pageCount, unsigned long long* addresses, unsigned long long* timestamps) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetRetiredPagesPendingStatus(nvmlDevice_t device, nvmlEnableState_t* isPending) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetRemappedRows(nvmlDevice_t device, unsigned int* corrRows, unsigned int* uncRows, unsigned int* isPending, unsigned int* failureOccurred) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetRowRemapperHistogram(nvmlDevice_t device, nvmlRowRemapperHistogramValues_t* values) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetArchitecture(nvmlDevice_t device, nvmlDeviceArchitecture_t* arch) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetClkMonStatus(nvmlDevice_t device, nvmlClkMonStatus_t* status) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetProcessUtilization(nvmlDevice_t device, nvmlProcessUtilizationSample_t* utilization, unsigned int* processSamplesCount, unsigned long long lastSeenTimeStamp) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetProcessesUtilizationInfo(nvmlDevice_t device, nvmlProcessesUtilizationInfo_t* procesesUtilInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetPlatformInfo(nvmlDevice_t device, nvmlPlatformInfo_t* platformInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlUnitSetLedState(nvmlUnit_t unit, nvmlLedColor_t color) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetPersistenceMode(nvmlDevice_t device, nvmlEnableState_t mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetComputeMode(nvmlDevice_t device, nvmlComputeMode_t mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetEccMode(nvmlDevice_t device, nvmlEnableState_t ecc) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceClearEccErrorCounts(nvmlDevice_t device, nvmlEccCounterType_t counterType) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetDriverModel(nvmlDevice_t device, nvmlDriverModel_t driverModel, unsigned int flags) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetGpuLockedClocks(nvmlDevice_t device, unsigned int minGpuClockMHz, unsigned int maxGpuClockMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceResetGpuLockedClocks(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetMemoryLockedClocks(nvmlDevice_t device, unsigned int minMemClockMHz, unsigned int maxMemClockMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceResetMemoryLockedClocks(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetAutoBoostedClocksEnabled(nvmlDevice_t device, nvmlEnableState_t enabled) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetDefaultAutoBoostedClocksEnabled(nvmlDevice_t device, nvmlEnableState_t enabled, unsigned int flags) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetDefaultFanSpeed_v2(nvmlDevice_t device, unsigned int fan) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetFanControlPolicy(nvmlDevice_t device, unsigned int fan, nvmlFanControlPolicy_t policy) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetTemperatureThreshold(nvmlDevice_t device, nvmlTemperatureThresholds_t thresholdType, int* temp) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetGpuOperationMode(nvmlDevice_t device, nvmlGpuOperationMode_t mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetAPIRestriction(nvmlDevice_t device, nvmlRestrictedAPI_t apiType, nvmlEnableState_t isRestricted) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetFanSpeed_v2(nvmlDevice_t device, unsigned int fan, unsigned int speed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetAccountingMode(nvmlDevice_t device, nvmlEnableState_t mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceClearAccountingPids(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetPowerManagementLimit_v2(nvmlDevice_t device, nvmlPowerValue_v2_t* powerValue) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetNvLinkState(nvmlDevice_t device, unsigned int link, nvmlEnableState_t* isActive) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetNvLinkVersion(nvmlDevice_t device, unsigned int link, unsigned int* version) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetNvLinkCapability(nvmlDevice_t device, unsigned int link, nvmlNvLinkCapability_t capability, unsigned int* capResult) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetNvLinkRemotePciInfo_v2(nvmlDevice_t device, unsigned int link, nvmlPciInfo_t* pci) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetNvLinkErrorCounter(nvmlDevice_t device, unsigned int link, nvmlNvLinkErrorCounter_t counter, unsigned long long* counterValue) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceResetNvLinkErrorCounters(nvmlDevice_t device, unsigned int link) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetNvLinkRemoteDeviceType(nvmlDevice_t device, unsigned int link, nvmlIntNvLinkDeviceType_t* pNvLinkDeviceType) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetNvLinkDeviceLowPowerThreshold(nvmlDevice_t device, nvmlNvLinkPowerThres_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlSystemSetNvlinkBwMode(unsigned int nvlinkBwMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlSystemGetNvlinkBwMode(unsigned int* nvlinkBwMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetNvlinkSupportedBwModes(nvmlDevice_t device, nvmlNvlinkSupportedBwModes_t* supportedBwMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetNvlinkBwMode(nvmlDevice_t device, nvmlNvlinkGetBwMode_t* getBwMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetNvlinkBwMode(nvmlDevice_t device, nvmlNvlinkSetBwMode_t* setBwMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlEventSetCreate(nvmlEventSet_t* set) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceRegisterEvents(nvmlDevice_t device, unsigned long long eventTypes, nvmlEventSet_t set) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetSupportedEventTypes(nvmlDevice_t device, unsigned long long* eventTypes) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlEventSetWait_v2(nvmlEventSet_t set, nvmlEventData_t* data, unsigned int timeoutms) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlEventSetFree(nvmlEventSet_t set) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlSystemEventSetCreate(nvmlSystemEventSetCreateRequest_t* request) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlSystemEventSetFree(nvmlSystemEventSetFreeRequest_t* request) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlSystemRegisterEvents(nvmlSystemRegisterEventRequest_t* request) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlSystemEventSetWait(nvmlSystemEventSetWaitRequest_t* request) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceModifyDrainState(nvmlPciInfo_t* pciInfo, nvmlEnableState_t newState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceQueryDrainState(nvmlPciInfo_t* pciInfo, nvmlEnableState_t* currentState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceRemoveGpu_v2(nvmlPciInfo_t* pciInfo, nvmlDetachGpuState_t gpuState, nvmlPcieLinkState_t linkState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceDiscoverGpus(nvmlPciInfo_t* pciInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetFieldValues(nvmlDevice_t device, int valuesCount, nvmlFieldValue_t* values) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceClearFieldValues(nvmlDevice_t device, int valuesCount, nvmlFieldValue_t* values) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetVirtualizationMode(nvmlDevice_t device, nvmlGpuVirtualizationMode_t* pVirtualMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetHostVgpuMode(nvmlDevice_t device, nvmlHostVgpuMode_t* pHostVgpuMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetVirtualizationMode(nvmlDevice_t device, nvmlGpuVirtualizationMode_t virtualMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetVgpuHeterogeneousMode(nvmlDevice_t device, nvmlVgpuHeterogeneousMode_t* pHeterogeneousMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetVgpuHeterogeneousMode(nvmlDevice_t device, const nvmlVgpuHeterogeneousMode_t* pHeterogeneousMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuInstanceGetPlacementId(nvmlVgpuInstance_t vgpuInstance, nvmlVgpuPlacementId_t* pPlacement) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetVgpuTypeSupportedPlacements(nvmlDevice_t device, nvmlVgpuTypeId_t vgpuTypeId, nvmlVgpuPlacementList_t* pPlacementList) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetVgpuTypeCreatablePlacements(nvmlDevice_t device, nvmlVgpuTypeId_t vgpuTypeId, nvmlVgpuPlacementList_t* pPlacementList) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuTypeGetGspHeapSize(nvmlVgpuTypeId_t vgpuTypeId, unsigned long long* gspHeapSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuTypeGetFbReservation(nvmlVgpuTypeId_t vgpuTypeId, unsigned long long* fbReservation) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuInstanceGetRuntimeStateSize(nvmlVgpuInstance_t vgpuInstance, nvmlVgpuRuntimeState_t* pState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetVgpuCapabilities(nvmlDevice_t device, nvmlDeviceVgpuCapability_t capability, nvmlEnableState_t state) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetGridLicensableFeatures_v4(nvmlDevice_t device, nvmlGridLicensableFeatures_t* pGridLicensableFeatures) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlGetVgpuDriverCapabilities(nvmlVgpuDriverCapability_t capability, unsigned int* capResult) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetVgpuCapabilities(nvmlDevice_t device, nvmlDeviceVgpuCapability_t capability, unsigned int* capResult) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetSupportedVgpus(nvmlDevice_t device, unsigned int* vgpuCount, nvmlVgpuTypeId_t* vgpuTypeIds) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetCreatableVgpus(nvmlDevice_t device, unsigned int* vgpuCount, nvmlVgpuTypeId_t* vgpuTypeIds) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuTypeGetClass(nvmlVgpuTypeId_t vgpuTypeId, char* vgpuTypeClass, unsigned int* size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuTypeGetName(nvmlVgpuTypeId_t vgpuTypeId, char* vgpuTypeName, unsigned int* size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuTypeGetGpuInstanceProfileId(nvmlVgpuTypeId_t vgpuTypeId, unsigned int* gpuInstanceProfileId) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuTypeGetDeviceID(nvmlVgpuTypeId_t vgpuTypeId, unsigned long long* deviceID, unsigned long long* subsystemID) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuTypeGetFramebufferSize(nvmlVgpuTypeId_t vgpuTypeId, unsigned long long* fbSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuTypeGetNumDisplayHeads(nvmlVgpuTypeId_t vgpuTypeId, unsigned int* numDisplayHeads) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuTypeGetResolution(nvmlVgpuTypeId_t vgpuTypeId, unsigned int displayIndex, unsigned int* xdim, unsigned int* ydim) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuTypeGetLicense(nvmlVgpuTypeId_t vgpuTypeId, char* vgpuTypeLicenseString, unsigned int size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuTypeGetFrameRateLimit(nvmlVgpuTypeId_t vgpuTypeId, unsigned int* frameRateLimit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuTypeGetMaxInstances(nvmlDevice_t device, nvmlVgpuTypeId_t vgpuTypeId, unsigned int* vgpuInstanceCount) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuTypeGetMaxInstancesPerVm(nvmlVgpuTypeId_t vgpuTypeId, unsigned int* vgpuInstanceCountPerVm) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuTypeGetBAR1Info(nvmlVgpuTypeId_t vgpuTypeId, nvmlVgpuTypeBar1Info_t* bar1Info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetActiveVgpus(nvmlDevice_t device, unsigned int* vgpuCount, nvmlVgpuInstance_t* vgpuInstances) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuInstanceGetVmID(nvmlVgpuInstance_t vgpuInstance, char* vmId, unsigned int size, nvmlVgpuVmIdType_t* vmIdType) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuInstanceGetUUID(nvmlVgpuInstance_t vgpuInstance, char* uuid, unsigned int size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuInstanceGetVmDriverVersion(nvmlVgpuInstance_t vgpuInstance, char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuInstanceGetFbUsage(nvmlVgpuInstance_t vgpuInstance, unsigned long long* fbUsage) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuInstanceGetLicenseStatus(nvmlVgpuInstance_t vgpuInstance, unsigned int* licensed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuInstanceGetType(nvmlVgpuInstance_t vgpuInstance, nvmlVgpuTypeId_t* vgpuTypeId) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuInstanceGetFrameRateLimit(nvmlVgpuInstance_t vgpuInstance, unsigned int* frameRateLimit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuInstanceGetEccMode(nvmlVgpuInstance_t vgpuInstance, nvmlEnableState_t* eccMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuInstanceGetEncoderCapacity(nvmlVgpuInstance_t vgpuInstance, unsigned int* encoderCapacity) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuInstanceSetEncoderCapacity(nvmlVgpuInstance_t vgpuInstance, unsigned int encoderCapacity) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuInstanceGetEncoderStats(nvmlVgpuInstance_t vgpuInstance, unsigned int* sessionCount, unsigned int* averageFps, unsigned int* averageLatency) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuInstanceGetEncoderSessions(nvmlVgpuInstance_t vgpuInstance, unsigned int* sessionCount, nvmlEncoderSessionInfo_t* sessionInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuInstanceGetFBCStats(nvmlVgpuInstance_t vgpuInstance, nvmlFBCStats_t* fbcStats) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuInstanceGetFBCSessions(nvmlVgpuInstance_t vgpuInstance, unsigned int* sessionCount, nvmlFBCSessionInfo_t* sessionInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuInstanceGetGpuInstanceId(nvmlVgpuInstance_t vgpuInstance, unsigned int* gpuInstanceId) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuInstanceGetGpuPciId(nvmlVgpuInstance_t vgpuInstance, char* vgpuPciId, unsigned int* length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuTypeGetCapabilities(nvmlVgpuTypeId_t vgpuTypeId, nvmlVgpuCapability_t capability, unsigned int* capResult) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuInstanceGetMdevUUID(nvmlVgpuInstance_t vgpuInstance, char* mdevUuid, unsigned int size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlGpuInstanceGetCreatableVgpus(nvmlGpuInstance_t gpuInstance, nvmlVgpuTypeIdInfo_t* pVgpus) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuTypeGetMaxInstancesPerGpuInstance(nvmlVgpuTypeMaxInstance_t* pMaxInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlGpuInstanceGetActiveVgpus(nvmlGpuInstance_t gpuInstance, nvmlActiveVgpuInstanceInfo_t* pVgpuInstanceInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlGpuInstanceSetVgpuSchedulerState(nvmlGpuInstance_t gpuInstance, nvmlVgpuSchedulerState_t* pScheduler) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlGpuInstanceGetVgpuSchedulerState(nvmlGpuInstance_t gpuInstance, nvmlVgpuSchedulerStateInfo_t* pSchedulerStateInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlGpuInstanceGetVgpuSchedulerLog(nvmlGpuInstance_t gpuInstance, nvmlVgpuSchedulerLogInfo_t* pSchedulerLogInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlGpuInstanceGetVgpuTypeCreatablePlacements(nvmlGpuInstance_t gpuInstance, nvmlVgpuCreatablePlacementInfo_t* pCreatablePlacementInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlGpuInstanceGetVgpuHeterogeneousMode(nvmlGpuInstance_t gpuInstance, nvmlVgpuHeterogeneousMode_t* pHeterogeneousMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlGpuInstanceSetVgpuHeterogeneousMode(nvmlGpuInstance_t gpuInstance, const nvmlVgpuHeterogeneousMode_t* pHeterogeneousMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuInstanceGetMetadata(nvmlVgpuInstance_t vgpuInstance, nvmlVgpuMetadata_t* vgpuMetadata, unsigned int* bufferSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetVgpuMetadata(nvmlDevice_t device, nvmlVgpuPgpuMetadata_t* pgpuMetadata, unsigned int* bufferSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlGetVgpuCompatibility(nvmlVgpuMetadata_t* vgpuMetadata, nvmlVgpuPgpuMetadata_t* pgpuMetadata, nvmlVgpuPgpuCompatibility_t* compatibilityInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetPgpuMetadataString(nvmlDevice_t device, char* pgpuMetadata, unsigned int* bufferSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetVgpuSchedulerLog(nvmlDevice_t device, nvmlVgpuSchedulerLog_t* pSchedulerLog) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetVgpuSchedulerState(nvmlDevice_t device, nvmlVgpuSchedulerGetState_t* pSchedulerState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetVgpuSchedulerCapabilities(nvmlDevice_t device, nvmlVgpuSchedulerCapabilities_t* pCapabilities) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetVgpuSchedulerState(nvmlDevice_t device, nvmlVgpuSchedulerSetState_t* pSchedulerState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlGetVgpuVersion(nvmlVgpuVersion_t* supported, nvmlVgpuVersion_t* current) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlSetVgpuVersion(nvmlVgpuVersion_t* vgpuVersion) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetVgpuUtilization(nvmlDevice_t device, unsigned long long lastSeenTimeStamp, nvmlValueType_t* sampleValType, unsigned int* vgpuInstanceSamplesCount, nvmlVgpuInstanceUtilizationSample_t* utilizationSamples) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetVgpuInstancesUtilizationInfo(nvmlDevice_t device, nvmlVgpuInstancesUtilizationInfo_t* vgpuUtilInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetVgpuProcessUtilization(nvmlDevice_t device, unsigned long long lastSeenTimeStamp, unsigned int* vgpuProcessSamplesCount, nvmlVgpuProcessUtilizationSample_t* utilizationSamples) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetVgpuProcessesUtilizationInfo(nvmlDevice_t device, nvmlVgpuProcessesUtilizationInfo_t* vgpuProcUtilInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuInstanceGetAccountingMode(nvmlVgpuInstance_t vgpuInstance, nvmlEnableState_t* mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuInstanceGetAccountingPids(nvmlVgpuInstance_t vgpuInstance, unsigned int* count, unsigned int* pids) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuInstanceGetAccountingStats(nvmlVgpuInstance_t vgpuInstance, unsigned int pid, nvmlAccountingStats_t* stats) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuInstanceClearAccountingPids(nvmlVgpuInstance_t vgpuInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlVgpuInstanceGetLicenseInfo_v2(nvmlVgpuInstance_t vgpuInstance, nvmlVgpuLicenseInfo_t* licenseInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlGetExcludedDeviceCount(unsigned int* deviceCount) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlGetExcludedDeviceInfoByIndex(unsigned int index, nvmlExcludedDeviceInfo_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetMigMode(nvmlDevice_t device, unsigned int mode, nvmlReturn_t* activationStatus) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetMigMode(nvmlDevice_t device, unsigned int* currentMode, unsigned int* pendingMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetGpuInstanceProfileInfoV(nvmlDevice_t device, unsigned int profile, nvmlGpuInstanceProfileInfo_v2_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetGpuInstancePossiblePlacements_v2(nvmlDevice_t device, unsigned int profileId, nvmlGpuInstancePlacement_t* placements, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetGpuInstanceRemainingCapacity(nvmlDevice_t device, unsigned int profileId, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceCreateGpuInstance(nvmlDevice_t device, unsigned int profileId, nvmlGpuInstance_t* gpuInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceCreateGpuInstanceWithPlacement(nvmlDevice_t device, unsigned int profileId, const nvmlGpuInstancePlacement_t* placement, nvmlGpuInstance_t* gpuInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlGpuInstanceDestroy(nvmlGpuInstance_t gpuInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetGpuInstances(nvmlDevice_t device, unsigned int profileId, nvmlGpuInstance_t* gpuInstances, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetGpuInstanceById(nvmlDevice_t device, unsigned int id, nvmlGpuInstance_t* gpuInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlGpuInstanceGetInfo(nvmlGpuInstance_t gpuInstance, nvmlGpuInstanceInfo_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlGpuInstanceGetComputeInstanceProfileInfoV(nvmlGpuInstance_t gpuInstance, unsigned int profile, unsigned int engProfile, nvmlComputeInstanceProfileInfo_v2_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlGpuInstanceGetComputeInstanceRemainingCapacity(nvmlGpuInstance_t gpuInstance, unsigned int profileId, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlGpuInstanceGetComputeInstancePossiblePlacements(nvmlGpuInstance_t gpuInstance, unsigned int profileId, nvmlComputeInstancePlacement_t* placements, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlGpuInstanceCreateComputeInstance(nvmlGpuInstance_t gpuInstance, unsigned int profileId, nvmlComputeInstance_t* computeInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlGpuInstanceCreateComputeInstanceWithPlacement(nvmlGpuInstance_t gpuInstance, unsigned int profileId, const nvmlComputeInstancePlacement_t* placement, nvmlComputeInstance_t* computeInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlComputeInstanceDestroy(nvmlComputeInstance_t computeInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlGpuInstanceGetComputeInstances(nvmlGpuInstance_t gpuInstance, unsigned int profileId, nvmlComputeInstance_t* computeInstances, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlGpuInstanceGetComputeInstanceById(nvmlGpuInstance_t gpuInstance, unsigned int id, nvmlComputeInstance_t* computeInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlComputeInstanceGetInfo_v2(nvmlComputeInstance_t computeInstance, nvmlComputeInstanceInfo_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceIsMigDeviceHandle(nvmlDevice_t device, unsigned int* isMigDevice) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetGpuInstanceId(nvmlDevice_t device, unsigned int* id) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetComputeInstanceId(nvmlDevice_t device, unsigned int* id) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetMaxMigDeviceCount(nvmlDevice_t device, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetMigDeviceHandleByIndex(nvmlDevice_t device, unsigned int index, nvmlDevice_t* migDevice) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetDeviceHandleFromMigDeviceHandle(nvmlDevice_t migDevice, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetCapabilities(nvmlDevice_t device, nvmlDeviceCapabilities_t* caps) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDevicePowerSmoothingActivatePresetProfile(nvmlDevice_t device, nvmlPowerSmoothingProfile_t* profile) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDevicePowerSmoothingUpdatePresetProfileParam(nvmlDevice_t device, nvmlPowerSmoothingProfile_t* profile) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDevicePowerSmoothingSetState(nvmlDevice_t device, nvmlPowerSmoothingState_t* state) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetAddressingMode(nvmlDevice_t device, nvmlDeviceAddressingMode_t* mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetRepairStatus(nvmlDevice_t device, nvmlRepairStatus_t* repairStatus) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetPowerMizerMode_v1(nvmlDevice_t device, nvmlDevicePowerMizerModes_v1_t* powerMizerMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetPowerMizerMode_v1(nvmlDevice_t device, nvmlDevicePowerMizerModes_v1_t* powerMizerMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetPdi(nvmlDevice_t device, nvmlPdi_t* pdi) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetHostname_v1(nvmlDevice_t device, nvmlHostname_v1_t* hostname) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetHostname_v1(nvmlDevice_t device, nvmlHostname_v1_t* hostname) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetNvLinkInfo(nvmlDevice_t device, nvmlNvLinkInfo_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceReadWritePRM_v1(nvmlDevice_t device, nvmlPRMTLV_v1_t* buffer) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetGpuInstanceProfileInfoByIdV(nvmlDevice_t device, unsigned int profileId, nvmlGpuInstanceProfileInfo_v2_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts(nvmlDevice_t device, nvmlEccSramUniqueUncorrectedErrorCounts_t* errorCounts) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetUnrepairableMemoryFlag_v1(nvmlDevice_t device, nvmlUnrepairableMemoryStatus_v1_t* unrepairableMemoryStatus) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceReadPRMCounters_v1(nvmlDevice_t device, nvmlPRMCounterList_v1_t* counterList) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetRusdSettings_v1(nvmlDevice_t device, nvmlRusdSettings_v1_t* settings) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceVgpuForceGspUnload(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetVgpuSchedulerState_v2(nvmlDevice_t device, nvmlVgpuSchedulerStateInfo_v2_t* pSchedulerStateInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlGpuInstanceGetVgpuSchedulerState_v2(nvmlGpuInstance_t gpuInstance, nvmlVgpuSchedulerStateInfo_v2_t* pSchedulerStateInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceGetVgpuSchedulerLog_v2(nvmlDevice_t device, nvmlVgpuSchedulerLogInfo_v2_t* pSchedulerLogInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlGpuInstanceGetVgpuSchedulerLog_v2(nvmlGpuInstance_t gpuInstance, nvmlVgpuSchedulerLogInfo_v2_t* pSchedulerLogInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlDeviceSetVgpuSchedulerState_v2(nvmlDevice_t device, nvmlVgpuSchedulerState_v2_t* pSchedulerState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t _nvmlGpuInstanceSetVgpuSchedulerState_v2(nvmlGpuInstance_t gpuInstance, nvmlVgpuSchedulerState_v2_t* pSchedulerState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil diff --git a/cuda_bindings/cuda/bindings/_internal/nvml_linux.pyx b/cuda_bindings/cuda/bindings/_internal/nvml_linux.pyx new file mode 100644 index 00000000000..2cff506e87c --- /dev/null +++ b/cuda_bindings/cuda/bindings/_internal/nvml_linux.pyx @@ -0,0 +1,7448 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +# This code was automatically generated across versions from 12.9.1 to 13.3.0. Do not modify it directly. +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=27eba7e4fbbc2bca4f40e906d63b9386cce38cbabfcc50e6a2d7ad5bc0b68e91 + + +# <<<< PREAMBLE CONTENT >>>> + +cdef extern from "": + void* _cyb_dlsym "dlsym"(void*, const char*) nogil + const void * _cyb_RTLD_DEFAULT "RTLD_DEFAULT" + +from libc.stdint cimport intptr_t as _cyb_intptr_t + +import threading as _cyb_threading + +cdef bint _cyb___py_nvml_init = False +cdef dict _cyb_func_ptrs = None +cdef object _cyb_symbol_lock = _cyb_threading.Lock() + +# <<<< END OF PREAMBLE CONTENT >>>> + +from libc.stdint cimport uintptr_t + +from .utils import FunctionNotFoundError, NotSupportedError +from cuda.pathfinder import load_nvidia_dynamic_lib + + +############################################################################### +# Wrapper init +############################################################################### + +cdef void* __nvmlInit_v2 = NULL +cdef void* __nvmlInitWithFlags = NULL +cdef void* __nvmlShutdown = NULL +cdef void* __nvmlErrorString = NULL +cdef void* __nvmlSystemGetDriverVersion = NULL +cdef void* __nvmlSystemGetNVMLVersion = NULL +cdef void* __nvmlSystemGetCudaDriverVersion = NULL +cdef void* __nvmlSystemGetCudaDriverVersion_v2 = NULL +cdef void* __nvmlSystemGetProcessName = NULL +cdef void* __nvmlSystemGetHicVersion = NULL +cdef void* __nvmlSystemGetTopologyGpuSet = NULL +cdef void* __nvmlSystemGetDriverBranch = NULL +cdef void* __nvmlUnitGetCount = NULL +cdef void* __nvmlUnitGetHandleByIndex = NULL +cdef void* __nvmlUnitGetUnitInfo = NULL +cdef void* __nvmlUnitGetLedState = NULL +cdef void* __nvmlUnitGetPsuInfo = NULL +cdef void* __nvmlUnitGetTemperature = NULL +cdef void* __nvmlUnitGetFanSpeedInfo = NULL +cdef void* __nvmlUnitGetDevices = NULL +cdef void* __nvmlDeviceGetCount_v2 = NULL +cdef void* __nvmlDeviceGetAttributes_v2 = NULL +cdef void* __nvmlDeviceGetHandleByIndex_v2 = NULL +cdef void* __nvmlDeviceGetHandleBySerial = NULL +cdef void* __nvmlDeviceGetHandleByUUID = NULL +cdef void* __nvmlDeviceGetHandleByUUIDV = NULL +cdef void* __nvmlDeviceGetHandleByPciBusId_v2 = NULL +cdef void* __nvmlDeviceGetName = NULL +cdef void* __nvmlDeviceGetBrand = NULL +cdef void* __nvmlDeviceGetIndex = NULL +cdef void* __nvmlDeviceGetSerial = NULL +cdef void* __nvmlDeviceGetModuleId = NULL +cdef void* __nvmlDeviceGetC2cModeInfoV = NULL +cdef void* __nvmlDeviceGetMemoryAffinity = NULL +cdef void* __nvmlDeviceGetCpuAffinityWithinScope = NULL +cdef void* __nvmlDeviceGetCpuAffinity = NULL +cdef void* __nvmlDeviceSetCpuAffinity = NULL +cdef void* __nvmlDeviceClearCpuAffinity = NULL +cdef void* __nvmlDeviceGetNumaNodeId = NULL +cdef void* __nvmlDeviceGetTopologyCommonAncestor = NULL +cdef void* __nvmlDeviceGetTopologyNearestGpus = NULL +cdef void* __nvmlDeviceGetP2PStatus = NULL +cdef void* __nvmlDeviceGetUUID = NULL +cdef void* __nvmlDeviceGetMinorNumber = NULL +cdef void* __nvmlDeviceGetBoardPartNumber = NULL +cdef void* __nvmlDeviceGetInforomVersion = NULL +cdef void* __nvmlDeviceGetInforomImageVersion = NULL +cdef void* __nvmlDeviceGetInforomConfigurationChecksum = NULL +cdef void* __nvmlDeviceValidateInforom = NULL +cdef void* __nvmlDeviceGetLastBBXFlushTime = NULL +cdef void* __nvmlDeviceGetDisplayMode = NULL +cdef void* __nvmlDeviceGetDisplayActive = NULL +cdef void* __nvmlDeviceGetPersistenceMode = NULL +cdef void* __nvmlDeviceGetPciInfoExt = NULL +cdef void* __nvmlDeviceGetPciInfo_v3 = NULL +cdef void* __nvmlDeviceGetMaxPcieLinkGeneration = NULL +cdef void* __nvmlDeviceGetGpuMaxPcieLinkGeneration = NULL +cdef void* __nvmlDeviceGetMaxPcieLinkWidth = NULL +cdef void* __nvmlDeviceGetCurrPcieLinkGeneration = NULL +cdef void* __nvmlDeviceGetCurrPcieLinkWidth = NULL +cdef void* __nvmlDeviceGetPcieThroughput = NULL +cdef void* __nvmlDeviceGetPcieReplayCounter = NULL +cdef void* __nvmlDeviceGetClockInfo = NULL +cdef void* __nvmlDeviceGetMaxClockInfo = NULL +cdef void* __nvmlDeviceGetGpcClkVfOffset = NULL +cdef void* __nvmlDeviceGetClock = NULL +cdef void* __nvmlDeviceGetMaxCustomerBoostClock = NULL +cdef void* __nvmlDeviceGetSupportedMemoryClocks = NULL +cdef void* __nvmlDeviceGetSupportedGraphicsClocks = NULL +cdef void* __nvmlDeviceGetAutoBoostedClocksEnabled = NULL +cdef void* __nvmlDeviceGetFanSpeed = NULL +cdef void* __nvmlDeviceGetFanSpeed_v2 = NULL +cdef void* __nvmlDeviceGetFanSpeedRPM = NULL +cdef void* __nvmlDeviceGetTargetFanSpeed = NULL +cdef void* __nvmlDeviceGetMinMaxFanSpeed = NULL +cdef void* __nvmlDeviceGetFanControlPolicy_v2 = NULL +cdef void* __nvmlDeviceGetNumFans = NULL +cdef void* __nvmlDeviceGetCoolerInfo = NULL +cdef void* __nvmlDeviceGetTemperatureV = NULL +cdef void* __nvmlDeviceGetTemperatureThreshold = NULL +cdef void* __nvmlDeviceGetMarginTemperature = NULL +cdef void* __nvmlDeviceGetThermalSettings = NULL +cdef void* __nvmlDeviceGetPerformanceState = NULL +cdef void* __nvmlDeviceGetCurrentClocksEventReasons = NULL +cdef void* __nvmlDeviceGetSupportedClocksEventReasons = NULL +cdef void* __nvmlDeviceGetPowerState = NULL +cdef void* __nvmlDeviceGetDynamicPstatesInfo = NULL +cdef void* __nvmlDeviceGetMemClkVfOffset = NULL +cdef void* __nvmlDeviceGetMinMaxClockOfPState = NULL +cdef void* __nvmlDeviceGetSupportedPerformanceStates = NULL +cdef void* __nvmlDeviceGetGpcClkMinMaxVfOffset = NULL +cdef void* __nvmlDeviceGetMemClkMinMaxVfOffset = NULL +cdef void* __nvmlDeviceGetClockOffsets = NULL +cdef void* __nvmlDeviceSetClockOffsets = NULL +cdef void* __nvmlDeviceGetPerformanceModes = NULL +cdef void* __nvmlDeviceGetCurrentClockFreqs = NULL +cdef void* __nvmlDeviceGetPowerManagementLimit = NULL +cdef void* __nvmlDeviceGetPowerManagementLimitConstraints = NULL +cdef void* __nvmlDeviceGetPowerManagementDefaultLimit = NULL +cdef void* __nvmlDeviceGetPowerUsage = NULL +cdef void* __nvmlDeviceGetTotalEnergyConsumption = NULL +cdef void* __nvmlDeviceGetEnforcedPowerLimit = NULL +cdef void* __nvmlDeviceGetGpuOperationMode = NULL +cdef void* __nvmlDeviceGetMemoryInfo_v2 = NULL +cdef void* __nvmlDeviceGetComputeMode = NULL +cdef void* __nvmlDeviceGetCudaComputeCapability = NULL +cdef void* __nvmlDeviceGetDramEncryptionMode = NULL +cdef void* __nvmlDeviceSetDramEncryptionMode = NULL +cdef void* __nvmlDeviceGetEccMode = NULL +cdef void* __nvmlDeviceGetDefaultEccMode = NULL +cdef void* __nvmlDeviceGetBoardId = NULL +cdef void* __nvmlDeviceGetMultiGpuBoard = NULL +cdef void* __nvmlDeviceGetTotalEccErrors = NULL +cdef void* __nvmlDeviceGetMemoryErrorCounter = NULL +cdef void* __nvmlDeviceGetUtilizationRates = NULL +cdef void* __nvmlDeviceGetEncoderUtilization = NULL +cdef void* __nvmlDeviceGetEncoderCapacity = NULL +cdef void* __nvmlDeviceGetEncoderStats = NULL +cdef void* __nvmlDeviceGetEncoderSessions = NULL +cdef void* __nvmlDeviceGetDecoderUtilization = NULL +cdef void* __nvmlDeviceGetJpgUtilization = NULL +cdef void* __nvmlDeviceGetOfaUtilization = NULL +cdef void* __nvmlDeviceGetFBCStats = NULL +cdef void* __nvmlDeviceGetFBCSessions = NULL +cdef void* __nvmlDeviceGetDriverModel_v2 = NULL +cdef void* __nvmlDeviceGetVbiosVersion = NULL +cdef void* __nvmlDeviceGetBridgeChipInfo = NULL +cdef void* __nvmlDeviceGetComputeRunningProcesses_v3 = NULL +cdef void* __nvmlDeviceGetGraphicsRunningProcesses_v3 = NULL +cdef void* __nvmlDeviceGetMPSComputeRunningProcesses_v3 = NULL +cdef void* __nvmlDeviceGetRunningProcessDetailList = NULL +cdef void* __nvmlDeviceOnSameBoard = NULL +cdef void* __nvmlDeviceGetAPIRestriction = NULL +cdef void* __nvmlDeviceGetSamples = NULL +cdef void* __nvmlDeviceGetBAR1MemoryInfo = NULL +cdef void* __nvmlDeviceGetIrqNum = NULL +cdef void* __nvmlDeviceGetNumGpuCores = NULL +cdef void* __nvmlDeviceGetPowerSource = NULL +cdef void* __nvmlDeviceGetMemoryBusWidth = NULL +cdef void* __nvmlDeviceGetPcieLinkMaxSpeed = NULL +cdef void* __nvmlDeviceGetPcieSpeed = NULL +cdef void* __nvmlDeviceGetAdaptiveClockInfoStatus = NULL +cdef void* __nvmlDeviceGetBusType = NULL +cdef void* __nvmlDeviceGetGpuFabricInfoV = NULL +cdef void* __nvmlSystemGetConfComputeCapabilities = NULL +cdef void* __nvmlSystemGetConfComputeState = NULL +cdef void* __nvmlDeviceGetConfComputeMemSizeInfo = NULL +cdef void* __nvmlSystemGetConfComputeGpusReadyState = NULL +cdef void* __nvmlDeviceGetConfComputeProtectedMemoryUsage = NULL +cdef void* __nvmlDeviceGetConfComputeGpuCertificate = NULL +cdef void* __nvmlDeviceGetConfComputeGpuAttestationReport = NULL +cdef void* __nvmlSystemGetConfComputeKeyRotationThresholdInfo = NULL +cdef void* __nvmlDeviceSetConfComputeUnprotectedMemSize = NULL +cdef void* __nvmlSystemSetConfComputeGpusReadyState = NULL +cdef void* __nvmlSystemSetConfComputeKeyRotationThresholdInfo = NULL +cdef void* __nvmlSystemGetConfComputeSettings = NULL +cdef void* __nvmlDeviceGetGspFirmwareVersion = NULL +cdef void* __nvmlDeviceGetGspFirmwareMode = NULL +cdef void* __nvmlDeviceGetSramEccErrorStatus = NULL +cdef void* __nvmlDeviceGetAccountingMode = NULL +cdef void* __nvmlDeviceGetAccountingStats = NULL +cdef void* __nvmlDeviceGetAccountingPids = NULL +cdef void* __nvmlDeviceGetAccountingBufferSize = NULL +cdef void* __nvmlDeviceGetRetiredPages = NULL +cdef void* __nvmlDeviceGetRetiredPages_v2 = NULL +cdef void* __nvmlDeviceGetRetiredPagesPendingStatus = NULL +cdef void* __nvmlDeviceGetRemappedRows = NULL +cdef void* __nvmlDeviceGetRowRemapperHistogram = NULL +cdef void* __nvmlDeviceGetArchitecture = NULL +cdef void* __nvmlDeviceGetClkMonStatus = NULL +cdef void* __nvmlDeviceGetProcessUtilization = NULL +cdef void* __nvmlDeviceGetProcessesUtilizationInfo = NULL +cdef void* __nvmlDeviceGetPlatformInfo = NULL +cdef void* __nvmlUnitSetLedState = NULL +cdef void* __nvmlDeviceSetPersistenceMode = NULL +cdef void* __nvmlDeviceSetComputeMode = NULL +cdef void* __nvmlDeviceSetEccMode = NULL +cdef void* __nvmlDeviceClearEccErrorCounts = NULL +cdef void* __nvmlDeviceSetDriverModel = NULL +cdef void* __nvmlDeviceSetGpuLockedClocks = NULL +cdef void* __nvmlDeviceResetGpuLockedClocks = NULL +cdef void* __nvmlDeviceSetMemoryLockedClocks = NULL +cdef void* __nvmlDeviceResetMemoryLockedClocks = NULL +cdef void* __nvmlDeviceSetAutoBoostedClocksEnabled = NULL +cdef void* __nvmlDeviceSetDefaultAutoBoostedClocksEnabled = NULL +cdef void* __nvmlDeviceSetDefaultFanSpeed_v2 = NULL +cdef void* __nvmlDeviceSetFanControlPolicy = NULL +cdef void* __nvmlDeviceSetTemperatureThreshold = NULL +cdef void* __nvmlDeviceSetGpuOperationMode = NULL +cdef void* __nvmlDeviceSetAPIRestriction = NULL +cdef void* __nvmlDeviceSetFanSpeed_v2 = NULL +cdef void* __nvmlDeviceSetAccountingMode = NULL +cdef void* __nvmlDeviceClearAccountingPids = NULL +cdef void* __nvmlDeviceSetPowerManagementLimit_v2 = NULL +cdef void* __nvmlDeviceGetNvLinkState = NULL +cdef void* __nvmlDeviceGetNvLinkVersion = NULL +cdef void* __nvmlDeviceGetNvLinkCapability = NULL +cdef void* __nvmlDeviceGetNvLinkRemotePciInfo_v2 = NULL +cdef void* __nvmlDeviceGetNvLinkErrorCounter = NULL +cdef void* __nvmlDeviceResetNvLinkErrorCounters = NULL +cdef void* __nvmlDeviceGetNvLinkRemoteDeviceType = NULL +cdef void* __nvmlDeviceSetNvLinkDeviceLowPowerThreshold = NULL +cdef void* __nvmlSystemSetNvlinkBwMode = NULL +cdef void* __nvmlSystemGetNvlinkBwMode = NULL +cdef void* __nvmlDeviceGetNvlinkSupportedBwModes = NULL +cdef void* __nvmlDeviceGetNvlinkBwMode = NULL +cdef void* __nvmlDeviceSetNvlinkBwMode = NULL +cdef void* __nvmlEventSetCreate = NULL +cdef void* __nvmlDeviceRegisterEvents = NULL +cdef void* __nvmlDeviceGetSupportedEventTypes = NULL +cdef void* __nvmlEventSetWait_v2 = NULL +cdef void* __nvmlEventSetFree = NULL +cdef void* __nvmlSystemEventSetCreate = NULL +cdef void* __nvmlSystemEventSetFree = NULL +cdef void* __nvmlSystemRegisterEvents = NULL +cdef void* __nvmlSystemEventSetWait = NULL +cdef void* __nvmlDeviceModifyDrainState = NULL +cdef void* __nvmlDeviceQueryDrainState = NULL +cdef void* __nvmlDeviceRemoveGpu_v2 = NULL +cdef void* __nvmlDeviceDiscoverGpus = NULL +cdef void* __nvmlDeviceGetFieldValues = NULL +cdef void* __nvmlDeviceClearFieldValues = NULL +cdef void* __nvmlDeviceGetVirtualizationMode = NULL +cdef void* __nvmlDeviceGetHostVgpuMode = NULL +cdef void* __nvmlDeviceSetVirtualizationMode = NULL +cdef void* __nvmlDeviceGetVgpuHeterogeneousMode = NULL +cdef void* __nvmlDeviceSetVgpuHeterogeneousMode = NULL +cdef void* __nvmlVgpuInstanceGetPlacementId = NULL +cdef void* __nvmlDeviceGetVgpuTypeSupportedPlacements = NULL +cdef void* __nvmlDeviceGetVgpuTypeCreatablePlacements = NULL +cdef void* __nvmlVgpuTypeGetGspHeapSize = NULL +cdef void* __nvmlVgpuTypeGetFbReservation = NULL +cdef void* __nvmlVgpuInstanceGetRuntimeStateSize = NULL +cdef void* __nvmlDeviceSetVgpuCapabilities = NULL +cdef void* __nvmlDeviceGetGridLicensableFeatures_v4 = NULL +cdef void* __nvmlGetVgpuDriverCapabilities = NULL +cdef void* __nvmlDeviceGetVgpuCapabilities = NULL +cdef void* __nvmlDeviceGetSupportedVgpus = NULL +cdef void* __nvmlDeviceGetCreatableVgpus = NULL +cdef void* __nvmlVgpuTypeGetClass = NULL +cdef void* __nvmlVgpuTypeGetName = NULL +cdef void* __nvmlVgpuTypeGetGpuInstanceProfileId = NULL +cdef void* __nvmlVgpuTypeGetDeviceID = NULL +cdef void* __nvmlVgpuTypeGetFramebufferSize = NULL +cdef void* __nvmlVgpuTypeGetNumDisplayHeads = NULL +cdef void* __nvmlVgpuTypeGetResolution = NULL +cdef void* __nvmlVgpuTypeGetLicense = NULL +cdef void* __nvmlVgpuTypeGetFrameRateLimit = NULL +cdef void* __nvmlVgpuTypeGetMaxInstances = NULL +cdef void* __nvmlVgpuTypeGetMaxInstancesPerVm = NULL +cdef void* __nvmlVgpuTypeGetBAR1Info = NULL +cdef void* __nvmlDeviceGetActiveVgpus = NULL +cdef void* __nvmlVgpuInstanceGetVmID = NULL +cdef void* __nvmlVgpuInstanceGetUUID = NULL +cdef void* __nvmlVgpuInstanceGetVmDriverVersion = NULL +cdef void* __nvmlVgpuInstanceGetFbUsage = NULL +cdef void* __nvmlVgpuInstanceGetLicenseStatus = NULL +cdef void* __nvmlVgpuInstanceGetType = NULL +cdef void* __nvmlVgpuInstanceGetFrameRateLimit = NULL +cdef void* __nvmlVgpuInstanceGetEccMode = NULL +cdef void* __nvmlVgpuInstanceGetEncoderCapacity = NULL +cdef void* __nvmlVgpuInstanceSetEncoderCapacity = NULL +cdef void* __nvmlVgpuInstanceGetEncoderStats = NULL +cdef void* __nvmlVgpuInstanceGetEncoderSessions = NULL +cdef void* __nvmlVgpuInstanceGetFBCStats = NULL +cdef void* __nvmlVgpuInstanceGetFBCSessions = NULL +cdef void* __nvmlVgpuInstanceGetGpuInstanceId = NULL +cdef void* __nvmlVgpuInstanceGetGpuPciId = NULL +cdef void* __nvmlVgpuTypeGetCapabilities = NULL +cdef void* __nvmlVgpuInstanceGetMdevUUID = NULL +cdef void* __nvmlGpuInstanceGetCreatableVgpus = NULL +cdef void* __nvmlVgpuTypeGetMaxInstancesPerGpuInstance = NULL +cdef void* __nvmlGpuInstanceGetActiveVgpus = NULL +cdef void* __nvmlGpuInstanceSetVgpuSchedulerState = NULL +cdef void* __nvmlGpuInstanceGetVgpuSchedulerState = NULL +cdef void* __nvmlGpuInstanceGetVgpuSchedulerLog = NULL +cdef void* __nvmlGpuInstanceGetVgpuTypeCreatablePlacements = NULL +cdef void* __nvmlGpuInstanceGetVgpuHeterogeneousMode = NULL +cdef void* __nvmlGpuInstanceSetVgpuHeterogeneousMode = NULL +cdef void* __nvmlVgpuInstanceGetMetadata = NULL +cdef void* __nvmlDeviceGetVgpuMetadata = NULL +cdef void* __nvmlGetVgpuCompatibility = NULL +cdef void* __nvmlDeviceGetPgpuMetadataString = NULL +cdef void* __nvmlDeviceGetVgpuSchedulerLog = NULL +cdef void* __nvmlDeviceGetVgpuSchedulerState = NULL +cdef void* __nvmlDeviceGetVgpuSchedulerCapabilities = NULL +cdef void* __nvmlDeviceSetVgpuSchedulerState = NULL +cdef void* __nvmlGetVgpuVersion = NULL +cdef void* __nvmlSetVgpuVersion = NULL +cdef void* __nvmlDeviceGetVgpuUtilization = NULL +cdef void* __nvmlDeviceGetVgpuInstancesUtilizationInfo = NULL +cdef void* __nvmlDeviceGetVgpuProcessUtilization = NULL +cdef void* __nvmlDeviceGetVgpuProcessesUtilizationInfo = NULL +cdef void* __nvmlVgpuInstanceGetAccountingMode = NULL +cdef void* __nvmlVgpuInstanceGetAccountingPids = NULL +cdef void* __nvmlVgpuInstanceGetAccountingStats = NULL +cdef void* __nvmlVgpuInstanceClearAccountingPids = NULL +cdef void* __nvmlVgpuInstanceGetLicenseInfo_v2 = NULL +cdef void* __nvmlGetExcludedDeviceCount = NULL +cdef void* __nvmlGetExcludedDeviceInfoByIndex = NULL +cdef void* __nvmlDeviceSetMigMode = NULL +cdef void* __nvmlDeviceGetMigMode = NULL +cdef void* __nvmlDeviceGetGpuInstanceProfileInfoV = NULL +cdef void* __nvmlDeviceGetGpuInstancePossiblePlacements_v2 = NULL +cdef void* __nvmlDeviceGetGpuInstanceRemainingCapacity = NULL +cdef void* __nvmlDeviceCreateGpuInstance = NULL +cdef void* __nvmlDeviceCreateGpuInstanceWithPlacement = NULL +cdef void* __nvmlGpuInstanceDestroy = NULL +cdef void* __nvmlDeviceGetGpuInstances = NULL +cdef void* __nvmlDeviceGetGpuInstanceById = NULL +cdef void* __nvmlGpuInstanceGetInfo = NULL +cdef void* __nvmlGpuInstanceGetComputeInstanceProfileInfoV = NULL +cdef void* __nvmlGpuInstanceGetComputeInstanceRemainingCapacity = NULL +cdef void* __nvmlGpuInstanceGetComputeInstancePossiblePlacements = NULL +cdef void* __nvmlGpuInstanceCreateComputeInstance = NULL +cdef void* __nvmlGpuInstanceCreateComputeInstanceWithPlacement = NULL +cdef void* __nvmlComputeInstanceDestroy = NULL +cdef void* __nvmlGpuInstanceGetComputeInstances = NULL +cdef void* __nvmlGpuInstanceGetComputeInstanceById = NULL +cdef void* __nvmlComputeInstanceGetInfo_v2 = NULL +cdef void* __nvmlDeviceIsMigDeviceHandle = NULL +cdef void* __nvmlDeviceGetGpuInstanceId = NULL +cdef void* __nvmlDeviceGetComputeInstanceId = NULL +cdef void* __nvmlDeviceGetMaxMigDeviceCount = NULL +cdef void* __nvmlDeviceGetMigDeviceHandleByIndex = NULL +cdef void* __nvmlDeviceGetDeviceHandleFromMigDeviceHandle = NULL +cdef void* __nvmlDeviceGetCapabilities = NULL +cdef void* __nvmlDevicePowerSmoothingActivatePresetProfile = NULL +cdef void* __nvmlDevicePowerSmoothingUpdatePresetProfileParam = NULL +cdef void* __nvmlDevicePowerSmoothingSetState = NULL +cdef void* __nvmlDeviceGetAddressingMode = NULL +cdef void* __nvmlDeviceGetRepairStatus = NULL +cdef void* __nvmlDeviceGetPowerMizerMode_v1 = NULL +cdef void* __nvmlDeviceSetPowerMizerMode_v1 = NULL +cdef void* __nvmlDeviceGetPdi = NULL +cdef void* __nvmlDeviceSetHostname_v1 = NULL +cdef void* __nvmlDeviceGetHostname_v1 = NULL +cdef void* __nvmlDeviceGetNvLinkInfo = NULL +cdef void* __nvmlDeviceReadWritePRM_v1 = NULL +cdef void* __nvmlDeviceGetGpuInstanceProfileInfoByIdV = NULL +cdef void* __nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts = NULL +cdef void* __nvmlDeviceGetUnrepairableMemoryFlag_v1 = NULL +cdef void* __nvmlDeviceReadPRMCounters_v1 = NULL +cdef void* __nvmlDeviceSetRusdSettings_v1 = NULL +cdef void* __nvmlDeviceVgpuForceGspUnload = NULL +cdef void* __nvmlDeviceGetVgpuSchedulerState_v2 = NULL +cdef void* __nvmlGpuInstanceGetVgpuSchedulerState_v2 = NULL +cdef void* __nvmlDeviceGetVgpuSchedulerLog_v2 = NULL +cdef void* __nvmlGpuInstanceGetVgpuSchedulerLog_v2 = NULL +cdef void* __nvmlDeviceSetVgpuSchedulerState_v2 = NULL +cdef void* __nvmlGpuInstanceSetVgpuSchedulerState_v2 = NULL + +cdef int _init_nvml() except -1 nogil: + global _cyb___py_nvml_init + cdef void* handle = NULL + with gil, _cyb_symbol_lock: + if _cyb___py_nvml_init: return 0 + + global __nvmlInit_v2 + __nvmlInit_v2 = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlInit_v2') + if __nvmlInit_v2 == NULL: + if handle == NULL: + handle = load_library() + __nvmlInit_v2 = _cyb_dlsym(handle, 'nvmlInit_v2') + + global __nvmlInitWithFlags + __nvmlInitWithFlags = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlInitWithFlags') + if __nvmlInitWithFlags == NULL: + if handle == NULL: + handle = load_library() + __nvmlInitWithFlags = _cyb_dlsym(handle, 'nvmlInitWithFlags') + + global __nvmlShutdown + __nvmlShutdown = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlShutdown') + if __nvmlShutdown == NULL: + if handle == NULL: + handle = load_library() + __nvmlShutdown = _cyb_dlsym(handle, 'nvmlShutdown') + + global __nvmlErrorString + __nvmlErrorString = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlErrorString') + if __nvmlErrorString == NULL: + if handle == NULL: + handle = load_library() + __nvmlErrorString = _cyb_dlsym(handle, 'nvmlErrorString') + + global __nvmlSystemGetDriverVersion + __nvmlSystemGetDriverVersion = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlSystemGetDriverVersion') + if __nvmlSystemGetDriverVersion == NULL: + if handle == NULL: + handle = load_library() + __nvmlSystemGetDriverVersion = _cyb_dlsym(handle, 'nvmlSystemGetDriverVersion') + + global __nvmlSystemGetNVMLVersion + __nvmlSystemGetNVMLVersion = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlSystemGetNVMLVersion') + if __nvmlSystemGetNVMLVersion == NULL: + if handle == NULL: + handle = load_library() + __nvmlSystemGetNVMLVersion = _cyb_dlsym(handle, 'nvmlSystemGetNVMLVersion') + + global __nvmlSystemGetCudaDriverVersion + __nvmlSystemGetCudaDriverVersion = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlSystemGetCudaDriverVersion') + if __nvmlSystemGetCudaDriverVersion == NULL: + if handle == NULL: + handle = load_library() + __nvmlSystemGetCudaDriverVersion = _cyb_dlsym(handle, 'nvmlSystemGetCudaDriverVersion') + + global __nvmlSystemGetCudaDriverVersion_v2 + __nvmlSystemGetCudaDriverVersion_v2 = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlSystemGetCudaDriverVersion_v2') + if __nvmlSystemGetCudaDriverVersion_v2 == NULL: + if handle == NULL: + handle = load_library() + __nvmlSystemGetCudaDriverVersion_v2 = _cyb_dlsym(handle, 'nvmlSystemGetCudaDriverVersion_v2') + + global __nvmlSystemGetProcessName + __nvmlSystemGetProcessName = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlSystemGetProcessName') + if __nvmlSystemGetProcessName == NULL: + if handle == NULL: + handle = load_library() + __nvmlSystemGetProcessName = _cyb_dlsym(handle, 'nvmlSystemGetProcessName') + + global __nvmlSystemGetHicVersion + __nvmlSystemGetHicVersion = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlSystemGetHicVersion') + if __nvmlSystemGetHicVersion == NULL: + if handle == NULL: + handle = load_library() + __nvmlSystemGetHicVersion = _cyb_dlsym(handle, 'nvmlSystemGetHicVersion') + + global __nvmlSystemGetTopologyGpuSet + __nvmlSystemGetTopologyGpuSet = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlSystemGetTopologyGpuSet') + if __nvmlSystemGetTopologyGpuSet == NULL: + if handle == NULL: + handle = load_library() + __nvmlSystemGetTopologyGpuSet = _cyb_dlsym(handle, 'nvmlSystemGetTopologyGpuSet') + + global __nvmlSystemGetDriverBranch + __nvmlSystemGetDriverBranch = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlSystemGetDriverBranch') + if __nvmlSystemGetDriverBranch == NULL: + if handle == NULL: + handle = load_library() + __nvmlSystemGetDriverBranch = _cyb_dlsym(handle, 'nvmlSystemGetDriverBranch') + + global __nvmlUnitGetCount + __nvmlUnitGetCount = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlUnitGetCount') + if __nvmlUnitGetCount == NULL: + if handle == NULL: + handle = load_library() + __nvmlUnitGetCount = _cyb_dlsym(handle, 'nvmlUnitGetCount') + + global __nvmlUnitGetHandleByIndex + __nvmlUnitGetHandleByIndex = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlUnitGetHandleByIndex') + if __nvmlUnitGetHandleByIndex == NULL: + if handle == NULL: + handle = load_library() + __nvmlUnitGetHandleByIndex = _cyb_dlsym(handle, 'nvmlUnitGetHandleByIndex') + + global __nvmlUnitGetUnitInfo + __nvmlUnitGetUnitInfo = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlUnitGetUnitInfo') + if __nvmlUnitGetUnitInfo == NULL: + if handle == NULL: + handle = load_library() + __nvmlUnitGetUnitInfo = _cyb_dlsym(handle, 'nvmlUnitGetUnitInfo') + + global __nvmlUnitGetLedState + __nvmlUnitGetLedState = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlUnitGetLedState') + if __nvmlUnitGetLedState == NULL: + if handle == NULL: + handle = load_library() + __nvmlUnitGetLedState = _cyb_dlsym(handle, 'nvmlUnitGetLedState') + + global __nvmlUnitGetPsuInfo + __nvmlUnitGetPsuInfo = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlUnitGetPsuInfo') + if __nvmlUnitGetPsuInfo == NULL: + if handle == NULL: + handle = load_library() + __nvmlUnitGetPsuInfo = _cyb_dlsym(handle, 'nvmlUnitGetPsuInfo') + + global __nvmlUnitGetTemperature + __nvmlUnitGetTemperature = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlUnitGetTemperature') + if __nvmlUnitGetTemperature == NULL: + if handle == NULL: + handle = load_library() + __nvmlUnitGetTemperature = _cyb_dlsym(handle, 'nvmlUnitGetTemperature') + + global __nvmlUnitGetFanSpeedInfo + __nvmlUnitGetFanSpeedInfo = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlUnitGetFanSpeedInfo') + if __nvmlUnitGetFanSpeedInfo == NULL: + if handle == NULL: + handle = load_library() + __nvmlUnitGetFanSpeedInfo = _cyb_dlsym(handle, 'nvmlUnitGetFanSpeedInfo') + + global __nvmlUnitGetDevices + __nvmlUnitGetDevices = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlUnitGetDevices') + if __nvmlUnitGetDevices == NULL: + if handle == NULL: + handle = load_library() + __nvmlUnitGetDevices = _cyb_dlsym(handle, 'nvmlUnitGetDevices') + + global __nvmlDeviceGetCount_v2 + __nvmlDeviceGetCount_v2 = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetCount_v2') + if __nvmlDeviceGetCount_v2 == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetCount_v2 = _cyb_dlsym(handle, 'nvmlDeviceGetCount_v2') + + global __nvmlDeviceGetAttributes_v2 + __nvmlDeviceGetAttributes_v2 = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetAttributes_v2') + if __nvmlDeviceGetAttributes_v2 == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetAttributes_v2 = _cyb_dlsym(handle, 'nvmlDeviceGetAttributes_v2') + + global __nvmlDeviceGetHandleByIndex_v2 + __nvmlDeviceGetHandleByIndex_v2 = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetHandleByIndex_v2') + if __nvmlDeviceGetHandleByIndex_v2 == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetHandleByIndex_v2 = _cyb_dlsym(handle, 'nvmlDeviceGetHandleByIndex_v2') + + global __nvmlDeviceGetHandleBySerial + __nvmlDeviceGetHandleBySerial = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetHandleBySerial') + if __nvmlDeviceGetHandleBySerial == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetHandleBySerial = _cyb_dlsym(handle, 'nvmlDeviceGetHandleBySerial') + + global __nvmlDeviceGetHandleByUUID + __nvmlDeviceGetHandleByUUID = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetHandleByUUID') + if __nvmlDeviceGetHandleByUUID == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetHandleByUUID = _cyb_dlsym(handle, 'nvmlDeviceGetHandleByUUID') + + global __nvmlDeviceGetHandleByUUIDV + __nvmlDeviceGetHandleByUUIDV = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetHandleByUUIDV') + if __nvmlDeviceGetHandleByUUIDV == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetHandleByUUIDV = _cyb_dlsym(handle, 'nvmlDeviceGetHandleByUUIDV') + + global __nvmlDeviceGetHandleByPciBusId_v2 + __nvmlDeviceGetHandleByPciBusId_v2 = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetHandleByPciBusId_v2') + if __nvmlDeviceGetHandleByPciBusId_v2 == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetHandleByPciBusId_v2 = _cyb_dlsym(handle, 'nvmlDeviceGetHandleByPciBusId_v2') + + global __nvmlDeviceGetName + __nvmlDeviceGetName = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetName') + if __nvmlDeviceGetName == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetName = _cyb_dlsym(handle, 'nvmlDeviceGetName') + + global __nvmlDeviceGetBrand + __nvmlDeviceGetBrand = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetBrand') + if __nvmlDeviceGetBrand == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetBrand = _cyb_dlsym(handle, 'nvmlDeviceGetBrand') + + global __nvmlDeviceGetIndex + __nvmlDeviceGetIndex = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetIndex') + if __nvmlDeviceGetIndex == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetIndex = _cyb_dlsym(handle, 'nvmlDeviceGetIndex') + + global __nvmlDeviceGetSerial + __nvmlDeviceGetSerial = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetSerial') + if __nvmlDeviceGetSerial == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetSerial = _cyb_dlsym(handle, 'nvmlDeviceGetSerial') + + global __nvmlDeviceGetModuleId + __nvmlDeviceGetModuleId = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetModuleId') + if __nvmlDeviceGetModuleId == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetModuleId = _cyb_dlsym(handle, 'nvmlDeviceGetModuleId') + + global __nvmlDeviceGetC2cModeInfoV + __nvmlDeviceGetC2cModeInfoV = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetC2cModeInfoV') + if __nvmlDeviceGetC2cModeInfoV == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetC2cModeInfoV = _cyb_dlsym(handle, 'nvmlDeviceGetC2cModeInfoV') + + global __nvmlDeviceGetMemoryAffinity + __nvmlDeviceGetMemoryAffinity = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetMemoryAffinity') + if __nvmlDeviceGetMemoryAffinity == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetMemoryAffinity = _cyb_dlsym(handle, 'nvmlDeviceGetMemoryAffinity') + + global __nvmlDeviceGetCpuAffinityWithinScope + __nvmlDeviceGetCpuAffinityWithinScope = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetCpuAffinityWithinScope') + if __nvmlDeviceGetCpuAffinityWithinScope == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetCpuAffinityWithinScope = _cyb_dlsym(handle, 'nvmlDeviceGetCpuAffinityWithinScope') + + global __nvmlDeviceGetCpuAffinity + __nvmlDeviceGetCpuAffinity = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetCpuAffinity') + if __nvmlDeviceGetCpuAffinity == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetCpuAffinity = _cyb_dlsym(handle, 'nvmlDeviceGetCpuAffinity') + + global __nvmlDeviceSetCpuAffinity + __nvmlDeviceSetCpuAffinity = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceSetCpuAffinity') + if __nvmlDeviceSetCpuAffinity == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetCpuAffinity = _cyb_dlsym(handle, 'nvmlDeviceSetCpuAffinity') + + global __nvmlDeviceClearCpuAffinity + __nvmlDeviceClearCpuAffinity = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceClearCpuAffinity') + if __nvmlDeviceClearCpuAffinity == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceClearCpuAffinity = _cyb_dlsym(handle, 'nvmlDeviceClearCpuAffinity') + + global __nvmlDeviceGetNumaNodeId + __nvmlDeviceGetNumaNodeId = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetNumaNodeId') + if __nvmlDeviceGetNumaNodeId == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetNumaNodeId = _cyb_dlsym(handle, 'nvmlDeviceGetNumaNodeId') + + global __nvmlDeviceGetTopologyCommonAncestor + __nvmlDeviceGetTopologyCommonAncestor = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetTopologyCommonAncestor') + if __nvmlDeviceGetTopologyCommonAncestor == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetTopologyCommonAncestor = _cyb_dlsym(handle, 'nvmlDeviceGetTopologyCommonAncestor') + + global __nvmlDeviceGetTopologyNearestGpus + __nvmlDeviceGetTopologyNearestGpus = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetTopologyNearestGpus') + if __nvmlDeviceGetTopologyNearestGpus == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetTopologyNearestGpus = _cyb_dlsym(handle, 'nvmlDeviceGetTopologyNearestGpus') + + global __nvmlDeviceGetP2PStatus + __nvmlDeviceGetP2PStatus = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetP2PStatus') + if __nvmlDeviceGetP2PStatus == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetP2PStatus = _cyb_dlsym(handle, 'nvmlDeviceGetP2PStatus') + + global __nvmlDeviceGetUUID + __nvmlDeviceGetUUID = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetUUID') + if __nvmlDeviceGetUUID == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetUUID = _cyb_dlsym(handle, 'nvmlDeviceGetUUID') + + global __nvmlDeviceGetMinorNumber + __nvmlDeviceGetMinorNumber = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetMinorNumber') + if __nvmlDeviceGetMinorNumber == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetMinorNumber = _cyb_dlsym(handle, 'nvmlDeviceGetMinorNumber') + + global __nvmlDeviceGetBoardPartNumber + __nvmlDeviceGetBoardPartNumber = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetBoardPartNumber') + if __nvmlDeviceGetBoardPartNumber == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetBoardPartNumber = _cyb_dlsym(handle, 'nvmlDeviceGetBoardPartNumber') + + global __nvmlDeviceGetInforomVersion + __nvmlDeviceGetInforomVersion = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetInforomVersion') + if __nvmlDeviceGetInforomVersion == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetInforomVersion = _cyb_dlsym(handle, 'nvmlDeviceGetInforomVersion') + + global __nvmlDeviceGetInforomImageVersion + __nvmlDeviceGetInforomImageVersion = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetInforomImageVersion') + if __nvmlDeviceGetInforomImageVersion == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetInforomImageVersion = _cyb_dlsym(handle, 'nvmlDeviceGetInforomImageVersion') + + global __nvmlDeviceGetInforomConfigurationChecksum + __nvmlDeviceGetInforomConfigurationChecksum = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetInforomConfigurationChecksum') + if __nvmlDeviceGetInforomConfigurationChecksum == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetInforomConfigurationChecksum = _cyb_dlsym(handle, 'nvmlDeviceGetInforomConfigurationChecksum') + + global __nvmlDeviceValidateInforom + __nvmlDeviceValidateInforom = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceValidateInforom') + if __nvmlDeviceValidateInforom == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceValidateInforom = _cyb_dlsym(handle, 'nvmlDeviceValidateInforom') + + global __nvmlDeviceGetLastBBXFlushTime + __nvmlDeviceGetLastBBXFlushTime = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetLastBBXFlushTime') + if __nvmlDeviceGetLastBBXFlushTime == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetLastBBXFlushTime = _cyb_dlsym(handle, 'nvmlDeviceGetLastBBXFlushTime') + + global __nvmlDeviceGetDisplayMode + __nvmlDeviceGetDisplayMode = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetDisplayMode') + if __nvmlDeviceGetDisplayMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetDisplayMode = _cyb_dlsym(handle, 'nvmlDeviceGetDisplayMode') + + global __nvmlDeviceGetDisplayActive + __nvmlDeviceGetDisplayActive = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetDisplayActive') + if __nvmlDeviceGetDisplayActive == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetDisplayActive = _cyb_dlsym(handle, 'nvmlDeviceGetDisplayActive') + + global __nvmlDeviceGetPersistenceMode + __nvmlDeviceGetPersistenceMode = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetPersistenceMode') + if __nvmlDeviceGetPersistenceMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetPersistenceMode = _cyb_dlsym(handle, 'nvmlDeviceGetPersistenceMode') + + global __nvmlDeviceGetPciInfoExt + __nvmlDeviceGetPciInfoExt = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetPciInfoExt') + if __nvmlDeviceGetPciInfoExt == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetPciInfoExt = _cyb_dlsym(handle, 'nvmlDeviceGetPciInfoExt') + + global __nvmlDeviceGetPciInfo_v3 + __nvmlDeviceGetPciInfo_v3 = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetPciInfo_v3') + if __nvmlDeviceGetPciInfo_v3 == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetPciInfo_v3 = _cyb_dlsym(handle, 'nvmlDeviceGetPciInfo_v3') + + global __nvmlDeviceGetMaxPcieLinkGeneration + __nvmlDeviceGetMaxPcieLinkGeneration = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetMaxPcieLinkGeneration') + if __nvmlDeviceGetMaxPcieLinkGeneration == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetMaxPcieLinkGeneration = _cyb_dlsym(handle, 'nvmlDeviceGetMaxPcieLinkGeneration') + + global __nvmlDeviceGetGpuMaxPcieLinkGeneration + __nvmlDeviceGetGpuMaxPcieLinkGeneration = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetGpuMaxPcieLinkGeneration') + if __nvmlDeviceGetGpuMaxPcieLinkGeneration == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetGpuMaxPcieLinkGeneration = _cyb_dlsym(handle, 'nvmlDeviceGetGpuMaxPcieLinkGeneration') + + global __nvmlDeviceGetMaxPcieLinkWidth + __nvmlDeviceGetMaxPcieLinkWidth = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetMaxPcieLinkWidth') + if __nvmlDeviceGetMaxPcieLinkWidth == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetMaxPcieLinkWidth = _cyb_dlsym(handle, 'nvmlDeviceGetMaxPcieLinkWidth') + + global __nvmlDeviceGetCurrPcieLinkGeneration + __nvmlDeviceGetCurrPcieLinkGeneration = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetCurrPcieLinkGeneration') + if __nvmlDeviceGetCurrPcieLinkGeneration == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetCurrPcieLinkGeneration = _cyb_dlsym(handle, 'nvmlDeviceGetCurrPcieLinkGeneration') + + global __nvmlDeviceGetCurrPcieLinkWidth + __nvmlDeviceGetCurrPcieLinkWidth = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetCurrPcieLinkWidth') + if __nvmlDeviceGetCurrPcieLinkWidth == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetCurrPcieLinkWidth = _cyb_dlsym(handle, 'nvmlDeviceGetCurrPcieLinkWidth') + + global __nvmlDeviceGetPcieThroughput + __nvmlDeviceGetPcieThroughput = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetPcieThroughput') + if __nvmlDeviceGetPcieThroughput == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetPcieThroughput = _cyb_dlsym(handle, 'nvmlDeviceGetPcieThroughput') + + global __nvmlDeviceGetPcieReplayCounter + __nvmlDeviceGetPcieReplayCounter = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetPcieReplayCounter') + if __nvmlDeviceGetPcieReplayCounter == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetPcieReplayCounter = _cyb_dlsym(handle, 'nvmlDeviceGetPcieReplayCounter') + + global __nvmlDeviceGetClockInfo + __nvmlDeviceGetClockInfo = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetClockInfo') + if __nvmlDeviceGetClockInfo == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetClockInfo = _cyb_dlsym(handle, 'nvmlDeviceGetClockInfo') + + global __nvmlDeviceGetMaxClockInfo + __nvmlDeviceGetMaxClockInfo = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetMaxClockInfo') + if __nvmlDeviceGetMaxClockInfo == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetMaxClockInfo = _cyb_dlsym(handle, 'nvmlDeviceGetMaxClockInfo') + + global __nvmlDeviceGetGpcClkVfOffset + __nvmlDeviceGetGpcClkVfOffset = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetGpcClkVfOffset') + if __nvmlDeviceGetGpcClkVfOffset == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetGpcClkVfOffset = _cyb_dlsym(handle, 'nvmlDeviceGetGpcClkVfOffset') + + global __nvmlDeviceGetClock + __nvmlDeviceGetClock = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetClock') + if __nvmlDeviceGetClock == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetClock = _cyb_dlsym(handle, 'nvmlDeviceGetClock') + + global __nvmlDeviceGetMaxCustomerBoostClock + __nvmlDeviceGetMaxCustomerBoostClock = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetMaxCustomerBoostClock') + if __nvmlDeviceGetMaxCustomerBoostClock == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetMaxCustomerBoostClock = _cyb_dlsym(handle, 'nvmlDeviceGetMaxCustomerBoostClock') + + global __nvmlDeviceGetSupportedMemoryClocks + __nvmlDeviceGetSupportedMemoryClocks = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetSupportedMemoryClocks') + if __nvmlDeviceGetSupportedMemoryClocks == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetSupportedMemoryClocks = _cyb_dlsym(handle, 'nvmlDeviceGetSupportedMemoryClocks') + + global __nvmlDeviceGetSupportedGraphicsClocks + __nvmlDeviceGetSupportedGraphicsClocks = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetSupportedGraphicsClocks') + if __nvmlDeviceGetSupportedGraphicsClocks == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetSupportedGraphicsClocks = _cyb_dlsym(handle, 'nvmlDeviceGetSupportedGraphicsClocks') + + global __nvmlDeviceGetAutoBoostedClocksEnabled + __nvmlDeviceGetAutoBoostedClocksEnabled = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetAutoBoostedClocksEnabled') + if __nvmlDeviceGetAutoBoostedClocksEnabled == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetAutoBoostedClocksEnabled = _cyb_dlsym(handle, 'nvmlDeviceGetAutoBoostedClocksEnabled') + + global __nvmlDeviceGetFanSpeed + __nvmlDeviceGetFanSpeed = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetFanSpeed') + if __nvmlDeviceGetFanSpeed == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetFanSpeed = _cyb_dlsym(handle, 'nvmlDeviceGetFanSpeed') + + global __nvmlDeviceGetFanSpeed_v2 + __nvmlDeviceGetFanSpeed_v2 = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetFanSpeed_v2') + if __nvmlDeviceGetFanSpeed_v2 == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetFanSpeed_v2 = _cyb_dlsym(handle, 'nvmlDeviceGetFanSpeed_v2') + + global __nvmlDeviceGetFanSpeedRPM + __nvmlDeviceGetFanSpeedRPM = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetFanSpeedRPM') + if __nvmlDeviceGetFanSpeedRPM == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetFanSpeedRPM = _cyb_dlsym(handle, 'nvmlDeviceGetFanSpeedRPM') + + global __nvmlDeviceGetTargetFanSpeed + __nvmlDeviceGetTargetFanSpeed = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetTargetFanSpeed') + if __nvmlDeviceGetTargetFanSpeed == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetTargetFanSpeed = _cyb_dlsym(handle, 'nvmlDeviceGetTargetFanSpeed') + + global __nvmlDeviceGetMinMaxFanSpeed + __nvmlDeviceGetMinMaxFanSpeed = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetMinMaxFanSpeed') + if __nvmlDeviceGetMinMaxFanSpeed == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetMinMaxFanSpeed = _cyb_dlsym(handle, 'nvmlDeviceGetMinMaxFanSpeed') + + global __nvmlDeviceGetFanControlPolicy_v2 + __nvmlDeviceGetFanControlPolicy_v2 = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetFanControlPolicy_v2') + if __nvmlDeviceGetFanControlPolicy_v2 == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetFanControlPolicy_v2 = _cyb_dlsym(handle, 'nvmlDeviceGetFanControlPolicy_v2') + + global __nvmlDeviceGetNumFans + __nvmlDeviceGetNumFans = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetNumFans') + if __nvmlDeviceGetNumFans == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetNumFans = _cyb_dlsym(handle, 'nvmlDeviceGetNumFans') + + global __nvmlDeviceGetCoolerInfo + __nvmlDeviceGetCoolerInfo = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetCoolerInfo') + if __nvmlDeviceGetCoolerInfo == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetCoolerInfo = _cyb_dlsym(handle, 'nvmlDeviceGetCoolerInfo') + + global __nvmlDeviceGetTemperatureV + __nvmlDeviceGetTemperatureV = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetTemperatureV') + if __nvmlDeviceGetTemperatureV == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetTemperatureV = _cyb_dlsym(handle, 'nvmlDeviceGetTemperatureV') + + global __nvmlDeviceGetTemperatureThreshold + __nvmlDeviceGetTemperatureThreshold = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetTemperatureThreshold') + if __nvmlDeviceGetTemperatureThreshold == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetTemperatureThreshold = _cyb_dlsym(handle, 'nvmlDeviceGetTemperatureThreshold') + + global __nvmlDeviceGetMarginTemperature + __nvmlDeviceGetMarginTemperature = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetMarginTemperature') + if __nvmlDeviceGetMarginTemperature == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetMarginTemperature = _cyb_dlsym(handle, 'nvmlDeviceGetMarginTemperature') + + global __nvmlDeviceGetThermalSettings + __nvmlDeviceGetThermalSettings = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetThermalSettings') + if __nvmlDeviceGetThermalSettings == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetThermalSettings = _cyb_dlsym(handle, 'nvmlDeviceGetThermalSettings') + + global __nvmlDeviceGetPerformanceState + __nvmlDeviceGetPerformanceState = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetPerformanceState') + if __nvmlDeviceGetPerformanceState == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetPerformanceState = _cyb_dlsym(handle, 'nvmlDeviceGetPerformanceState') + + global __nvmlDeviceGetCurrentClocksEventReasons + __nvmlDeviceGetCurrentClocksEventReasons = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetCurrentClocksEventReasons') + if __nvmlDeviceGetCurrentClocksEventReasons == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetCurrentClocksEventReasons = _cyb_dlsym(handle, 'nvmlDeviceGetCurrentClocksEventReasons') + + global __nvmlDeviceGetSupportedClocksEventReasons + __nvmlDeviceGetSupportedClocksEventReasons = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetSupportedClocksEventReasons') + if __nvmlDeviceGetSupportedClocksEventReasons == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetSupportedClocksEventReasons = _cyb_dlsym(handle, 'nvmlDeviceGetSupportedClocksEventReasons') + + global __nvmlDeviceGetPowerState + __nvmlDeviceGetPowerState = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetPowerState') + if __nvmlDeviceGetPowerState == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetPowerState = _cyb_dlsym(handle, 'nvmlDeviceGetPowerState') + + global __nvmlDeviceGetDynamicPstatesInfo + __nvmlDeviceGetDynamicPstatesInfo = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetDynamicPstatesInfo') + if __nvmlDeviceGetDynamicPstatesInfo == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetDynamicPstatesInfo = _cyb_dlsym(handle, 'nvmlDeviceGetDynamicPstatesInfo') + + global __nvmlDeviceGetMemClkVfOffset + __nvmlDeviceGetMemClkVfOffset = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetMemClkVfOffset') + if __nvmlDeviceGetMemClkVfOffset == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetMemClkVfOffset = _cyb_dlsym(handle, 'nvmlDeviceGetMemClkVfOffset') + + global __nvmlDeviceGetMinMaxClockOfPState + __nvmlDeviceGetMinMaxClockOfPState = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetMinMaxClockOfPState') + if __nvmlDeviceGetMinMaxClockOfPState == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetMinMaxClockOfPState = _cyb_dlsym(handle, 'nvmlDeviceGetMinMaxClockOfPState') + + global __nvmlDeviceGetSupportedPerformanceStates + __nvmlDeviceGetSupportedPerformanceStates = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetSupportedPerformanceStates') + if __nvmlDeviceGetSupportedPerformanceStates == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetSupportedPerformanceStates = _cyb_dlsym(handle, 'nvmlDeviceGetSupportedPerformanceStates') + + global __nvmlDeviceGetGpcClkMinMaxVfOffset + __nvmlDeviceGetGpcClkMinMaxVfOffset = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetGpcClkMinMaxVfOffset') + if __nvmlDeviceGetGpcClkMinMaxVfOffset == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetGpcClkMinMaxVfOffset = _cyb_dlsym(handle, 'nvmlDeviceGetGpcClkMinMaxVfOffset') + + global __nvmlDeviceGetMemClkMinMaxVfOffset + __nvmlDeviceGetMemClkMinMaxVfOffset = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetMemClkMinMaxVfOffset') + if __nvmlDeviceGetMemClkMinMaxVfOffset == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetMemClkMinMaxVfOffset = _cyb_dlsym(handle, 'nvmlDeviceGetMemClkMinMaxVfOffset') + + global __nvmlDeviceGetClockOffsets + __nvmlDeviceGetClockOffsets = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetClockOffsets') + if __nvmlDeviceGetClockOffsets == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetClockOffsets = _cyb_dlsym(handle, 'nvmlDeviceGetClockOffsets') + + global __nvmlDeviceSetClockOffsets + __nvmlDeviceSetClockOffsets = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceSetClockOffsets') + if __nvmlDeviceSetClockOffsets == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetClockOffsets = _cyb_dlsym(handle, 'nvmlDeviceSetClockOffsets') + + global __nvmlDeviceGetPerformanceModes + __nvmlDeviceGetPerformanceModes = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetPerformanceModes') + if __nvmlDeviceGetPerformanceModes == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetPerformanceModes = _cyb_dlsym(handle, 'nvmlDeviceGetPerformanceModes') + + global __nvmlDeviceGetCurrentClockFreqs + __nvmlDeviceGetCurrentClockFreqs = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetCurrentClockFreqs') + if __nvmlDeviceGetCurrentClockFreqs == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetCurrentClockFreqs = _cyb_dlsym(handle, 'nvmlDeviceGetCurrentClockFreqs') + + global __nvmlDeviceGetPowerManagementLimit + __nvmlDeviceGetPowerManagementLimit = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetPowerManagementLimit') + if __nvmlDeviceGetPowerManagementLimit == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetPowerManagementLimit = _cyb_dlsym(handle, 'nvmlDeviceGetPowerManagementLimit') + + global __nvmlDeviceGetPowerManagementLimitConstraints + __nvmlDeviceGetPowerManagementLimitConstraints = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetPowerManagementLimitConstraints') + if __nvmlDeviceGetPowerManagementLimitConstraints == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetPowerManagementLimitConstraints = _cyb_dlsym(handle, 'nvmlDeviceGetPowerManagementLimitConstraints') + + global __nvmlDeviceGetPowerManagementDefaultLimit + __nvmlDeviceGetPowerManagementDefaultLimit = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetPowerManagementDefaultLimit') + if __nvmlDeviceGetPowerManagementDefaultLimit == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetPowerManagementDefaultLimit = _cyb_dlsym(handle, 'nvmlDeviceGetPowerManagementDefaultLimit') + + global __nvmlDeviceGetPowerUsage + __nvmlDeviceGetPowerUsage = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetPowerUsage') + if __nvmlDeviceGetPowerUsage == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetPowerUsage = _cyb_dlsym(handle, 'nvmlDeviceGetPowerUsage') + + global __nvmlDeviceGetTotalEnergyConsumption + __nvmlDeviceGetTotalEnergyConsumption = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetTotalEnergyConsumption') + if __nvmlDeviceGetTotalEnergyConsumption == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetTotalEnergyConsumption = _cyb_dlsym(handle, 'nvmlDeviceGetTotalEnergyConsumption') + + global __nvmlDeviceGetEnforcedPowerLimit + __nvmlDeviceGetEnforcedPowerLimit = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetEnforcedPowerLimit') + if __nvmlDeviceGetEnforcedPowerLimit == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetEnforcedPowerLimit = _cyb_dlsym(handle, 'nvmlDeviceGetEnforcedPowerLimit') + + global __nvmlDeviceGetGpuOperationMode + __nvmlDeviceGetGpuOperationMode = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetGpuOperationMode') + if __nvmlDeviceGetGpuOperationMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetGpuOperationMode = _cyb_dlsym(handle, 'nvmlDeviceGetGpuOperationMode') + + global __nvmlDeviceGetMemoryInfo_v2 + __nvmlDeviceGetMemoryInfo_v2 = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetMemoryInfo_v2') + if __nvmlDeviceGetMemoryInfo_v2 == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetMemoryInfo_v2 = _cyb_dlsym(handle, 'nvmlDeviceGetMemoryInfo_v2') + + global __nvmlDeviceGetComputeMode + __nvmlDeviceGetComputeMode = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetComputeMode') + if __nvmlDeviceGetComputeMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetComputeMode = _cyb_dlsym(handle, 'nvmlDeviceGetComputeMode') + + global __nvmlDeviceGetCudaComputeCapability + __nvmlDeviceGetCudaComputeCapability = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetCudaComputeCapability') + if __nvmlDeviceGetCudaComputeCapability == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetCudaComputeCapability = _cyb_dlsym(handle, 'nvmlDeviceGetCudaComputeCapability') + + global __nvmlDeviceGetDramEncryptionMode + __nvmlDeviceGetDramEncryptionMode = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetDramEncryptionMode') + if __nvmlDeviceGetDramEncryptionMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetDramEncryptionMode = _cyb_dlsym(handle, 'nvmlDeviceGetDramEncryptionMode') + + global __nvmlDeviceSetDramEncryptionMode + __nvmlDeviceSetDramEncryptionMode = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceSetDramEncryptionMode') + if __nvmlDeviceSetDramEncryptionMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetDramEncryptionMode = _cyb_dlsym(handle, 'nvmlDeviceSetDramEncryptionMode') + + global __nvmlDeviceGetEccMode + __nvmlDeviceGetEccMode = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetEccMode') + if __nvmlDeviceGetEccMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetEccMode = _cyb_dlsym(handle, 'nvmlDeviceGetEccMode') + + global __nvmlDeviceGetDefaultEccMode + __nvmlDeviceGetDefaultEccMode = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetDefaultEccMode') + if __nvmlDeviceGetDefaultEccMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetDefaultEccMode = _cyb_dlsym(handle, 'nvmlDeviceGetDefaultEccMode') + + global __nvmlDeviceGetBoardId + __nvmlDeviceGetBoardId = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetBoardId') + if __nvmlDeviceGetBoardId == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetBoardId = _cyb_dlsym(handle, 'nvmlDeviceGetBoardId') + + global __nvmlDeviceGetMultiGpuBoard + __nvmlDeviceGetMultiGpuBoard = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetMultiGpuBoard') + if __nvmlDeviceGetMultiGpuBoard == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetMultiGpuBoard = _cyb_dlsym(handle, 'nvmlDeviceGetMultiGpuBoard') + + global __nvmlDeviceGetTotalEccErrors + __nvmlDeviceGetTotalEccErrors = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetTotalEccErrors') + if __nvmlDeviceGetTotalEccErrors == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetTotalEccErrors = _cyb_dlsym(handle, 'nvmlDeviceGetTotalEccErrors') + + global __nvmlDeviceGetMemoryErrorCounter + __nvmlDeviceGetMemoryErrorCounter = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetMemoryErrorCounter') + if __nvmlDeviceGetMemoryErrorCounter == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetMemoryErrorCounter = _cyb_dlsym(handle, 'nvmlDeviceGetMemoryErrorCounter') + + global __nvmlDeviceGetUtilizationRates + __nvmlDeviceGetUtilizationRates = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetUtilizationRates') + if __nvmlDeviceGetUtilizationRates == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetUtilizationRates = _cyb_dlsym(handle, 'nvmlDeviceGetUtilizationRates') + + global __nvmlDeviceGetEncoderUtilization + __nvmlDeviceGetEncoderUtilization = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetEncoderUtilization') + if __nvmlDeviceGetEncoderUtilization == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetEncoderUtilization = _cyb_dlsym(handle, 'nvmlDeviceGetEncoderUtilization') + + global __nvmlDeviceGetEncoderCapacity + __nvmlDeviceGetEncoderCapacity = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetEncoderCapacity') + if __nvmlDeviceGetEncoderCapacity == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetEncoderCapacity = _cyb_dlsym(handle, 'nvmlDeviceGetEncoderCapacity') + + global __nvmlDeviceGetEncoderStats + __nvmlDeviceGetEncoderStats = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetEncoderStats') + if __nvmlDeviceGetEncoderStats == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetEncoderStats = _cyb_dlsym(handle, 'nvmlDeviceGetEncoderStats') + + global __nvmlDeviceGetEncoderSessions + __nvmlDeviceGetEncoderSessions = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetEncoderSessions') + if __nvmlDeviceGetEncoderSessions == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetEncoderSessions = _cyb_dlsym(handle, 'nvmlDeviceGetEncoderSessions') + + global __nvmlDeviceGetDecoderUtilization + __nvmlDeviceGetDecoderUtilization = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetDecoderUtilization') + if __nvmlDeviceGetDecoderUtilization == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetDecoderUtilization = _cyb_dlsym(handle, 'nvmlDeviceGetDecoderUtilization') + + global __nvmlDeviceGetJpgUtilization + __nvmlDeviceGetJpgUtilization = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetJpgUtilization') + if __nvmlDeviceGetJpgUtilization == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetJpgUtilization = _cyb_dlsym(handle, 'nvmlDeviceGetJpgUtilization') + + global __nvmlDeviceGetOfaUtilization + __nvmlDeviceGetOfaUtilization = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetOfaUtilization') + if __nvmlDeviceGetOfaUtilization == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetOfaUtilization = _cyb_dlsym(handle, 'nvmlDeviceGetOfaUtilization') + + global __nvmlDeviceGetFBCStats + __nvmlDeviceGetFBCStats = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetFBCStats') + if __nvmlDeviceGetFBCStats == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetFBCStats = _cyb_dlsym(handle, 'nvmlDeviceGetFBCStats') + + global __nvmlDeviceGetFBCSessions + __nvmlDeviceGetFBCSessions = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetFBCSessions') + if __nvmlDeviceGetFBCSessions == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetFBCSessions = _cyb_dlsym(handle, 'nvmlDeviceGetFBCSessions') + + global __nvmlDeviceGetDriverModel_v2 + __nvmlDeviceGetDriverModel_v2 = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetDriverModel_v2') + if __nvmlDeviceGetDriverModel_v2 == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetDriverModel_v2 = _cyb_dlsym(handle, 'nvmlDeviceGetDriverModel_v2') + + global __nvmlDeviceGetVbiosVersion + __nvmlDeviceGetVbiosVersion = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetVbiosVersion') + if __nvmlDeviceGetVbiosVersion == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetVbiosVersion = _cyb_dlsym(handle, 'nvmlDeviceGetVbiosVersion') + + global __nvmlDeviceGetBridgeChipInfo + __nvmlDeviceGetBridgeChipInfo = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetBridgeChipInfo') + if __nvmlDeviceGetBridgeChipInfo == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetBridgeChipInfo = _cyb_dlsym(handle, 'nvmlDeviceGetBridgeChipInfo') + + global __nvmlDeviceGetComputeRunningProcesses_v3 + __nvmlDeviceGetComputeRunningProcesses_v3 = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetComputeRunningProcesses_v3') + if __nvmlDeviceGetComputeRunningProcesses_v3 == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetComputeRunningProcesses_v3 = _cyb_dlsym(handle, 'nvmlDeviceGetComputeRunningProcesses_v3') + + global __nvmlDeviceGetGraphicsRunningProcesses_v3 + __nvmlDeviceGetGraphicsRunningProcesses_v3 = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetGraphicsRunningProcesses_v3') + if __nvmlDeviceGetGraphicsRunningProcesses_v3 == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetGraphicsRunningProcesses_v3 = _cyb_dlsym(handle, 'nvmlDeviceGetGraphicsRunningProcesses_v3') + + global __nvmlDeviceGetMPSComputeRunningProcesses_v3 + __nvmlDeviceGetMPSComputeRunningProcesses_v3 = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetMPSComputeRunningProcesses_v3') + if __nvmlDeviceGetMPSComputeRunningProcesses_v3 == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetMPSComputeRunningProcesses_v3 = _cyb_dlsym(handle, 'nvmlDeviceGetMPSComputeRunningProcesses_v3') + + global __nvmlDeviceGetRunningProcessDetailList + __nvmlDeviceGetRunningProcessDetailList = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetRunningProcessDetailList') + if __nvmlDeviceGetRunningProcessDetailList == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetRunningProcessDetailList = _cyb_dlsym(handle, 'nvmlDeviceGetRunningProcessDetailList') + + global __nvmlDeviceOnSameBoard + __nvmlDeviceOnSameBoard = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceOnSameBoard') + if __nvmlDeviceOnSameBoard == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceOnSameBoard = _cyb_dlsym(handle, 'nvmlDeviceOnSameBoard') + + global __nvmlDeviceGetAPIRestriction + __nvmlDeviceGetAPIRestriction = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetAPIRestriction') + if __nvmlDeviceGetAPIRestriction == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetAPIRestriction = _cyb_dlsym(handle, 'nvmlDeviceGetAPIRestriction') + + global __nvmlDeviceGetSamples + __nvmlDeviceGetSamples = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetSamples') + if __nvmlDeviceGetSamples == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetSamples = _cyb_dlsym(handle, 'nvmlDeviceGetSamples') + + global __nvmlDeviceGetBAR1MemoryInfo + __nvmlDeviceGetBAR1MemoryInfo = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetBAR1MemoryInfo') + if __nvmlDeviceGetBAR1MemoryInfo == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetBAR1MemoryInfo = _cyb_dlsym(handle, 'nvmlDeviceGetBAR1MemoryInfo') + + global __nvmlDeviceGetIrqNum + __nvmlDeviceGetIrqNum = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetIrqNum') + if __nvmlDeviceGetIrqNum == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetIrqNum = _cyb_dlsym(handle, 'nvmlDeviceGetIrqNum') + + global __nvmlDeviceGetNumGpuCores + __nvmlDeviceGetNumGpuCores = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetNumGpuCores') + if __nvmlDeviceGetNumGpuCores == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetNumGpuCores = _cyb_dlsym(handle, 'nvmlDeviceGetNumGpuCores') + + global __nvmlDeviceGetPowerSource + __nvmlDeviceGetPowerSource = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetPowerSource') + if __nvmlDeviceGetPowerSource == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetPowerSource = _cyb_dlsym(handle, 'nvmlDeviceGetPowerSource') + + global __nvmlDeviceGetMemoryBusWidth + __nvmlDeviceGetMemoryBusWidth = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetMemoryBusWidth') + if __nvmlDeviceGetMemoryBusWidth == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetMemoryBusWidth = _cyb_dlsym(handle, 'nvmlDeviceGetMemoryBusWidth') + + global __nvmlDeviceGetPcieLinkMaxSpeed + __nvmlDeviceGetPcieLinkMaxSpeed = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetPcieLinkMaxSpeed') + if __nvmlDeviceGetPcieLinkMaxSpeed == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetPcieLinkMaxSpeed = _cyb_dlsym(handle, 'nvmlDeviceGetPcieLinkMaxSpeed') + + global __nvmlDeviceGetPcieSpeed + __nvmlDeviceGetPcieSpeed = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetPcieSpeed') + if __nvmlDeviceGetPcieSpeed == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetPcieSpeed = _cyb_dlsym(handle, 'nvmlDeviceGetPcieSpeed') + + global __nvmlDeviceGetAdaptiveClockInfoStatus + __nvmlDeviceGetAdaptiveClockInfoStatus = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetAdaptiveClockInfoStatus') + if __nvmlDeviceGetAdaptiveClockInfoStatus == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetAdaptiveClockInfoStatus = _cyb_dlsym(handle, 'nvmlDeviceGetAdaptiveClockInfoStatus') + + global __nvmlDeviceGetBusType + __nvmlDeviceGetBusType = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetBusType') + if __nvmlDeviceGetBusType == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetBusType = _cyb_dlsym(handle, 'nvmlDeviceGetBusType') + + global __nvmlDeviceGetGpuFabricInfoV + __nvmlDeviceGetGpuFabricInfoV = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetGpuFabricInfoV') + if __nvmlDeviceGetGpuFabricInfoV == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetGpuFabricInfoV = _cyb_dlsym(handle, 'nvmlDeviceGetGpuFabricInfoV') + + global __nvmlSystemGetConfComputeCapabilities + __nvmlSystemGetConfComputeCapabilities = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlSystemGetConfComputeCapabilities') + if __nvmlSystemGetConfComputeCapabilities == NULL: + if handle == NULL: + handle = load_library() + __nvmlSystemGetConfComputeCapabilities = _cyb_dlsym(handle, 'nvmlSystemGetConfComputeCapabilities') + + global __nvmlSystemGetConfComputeState + __nvmlSystemGetConfComputeState = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlSystemGetConfComputeState') + if __nvmlSystemGetConfComputeState == NULL: + if handle == NULL: + handle = load_library() + __nvmlSystemGetConfComputeState = _cyb_dlsym(handle, 'nvmlSystemGetConfComputeState') + + global __nvmlDeviceGetConfComputeMemSizeInfo + __nvmlDeviceGetConfComputeMemSizeInfo = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetConfComputeMemSizeInfo') + if __nvmlDeviceGetConfComputeMemSizeInfo == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetConfComputeMemSizeInfo = _cyb_dlsym(handle, 'nvmlDeviceGetConfComputeMemSizeInfo') + + global __nvmlSystemGetConfComputeGpusReadyState + __nvmlSystemGetConfComputeGpusReadyState = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlSystemGetConfComputeGpusReadyState') + if __nvmlSystemGetConfComputeGpusReadyState == NULL: + if handle == NULL: + handle = load_library() + __nvmlSystemGetConfComputeGpusReadyState = _cyb_dlsym(handle, 'nvmlSystemGetConfComputeGpusReadyState') + + global __nvmlDeviceGetConfComputeProtectedMemoryUsage + __nvmlDeviceGetConfComputeProtectedMemoryUsage = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetConfComputeProtectedMemoryUsage') + if __nvmlDeviceGetConfComputeProtectedMemoryUsage == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetConfComputeProtectedMemoryUsage = _cyb_dlsym(handle, 'nvmlDeviceGetConfComputeProtectedMemoryUsage') + + global __nvmlDeviceGetConfComputeGpuCertificate + __nvmlDeviceGetConfComputeGpuCertificate = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetConfComputeGpuCertificate') + if __nvmlDeviceGetConfComputeGpuCertificate == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetConfComputeGpuCertificate = _cyb_dlsym(handle, 'nvmlDeviceGetConfComputeGpuCertificate') + + global __nvmlDeviceGetConfComputeGpuAttestationReport + __nvmlDeviceGetConfComputeGpuAttestationReport = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetConfComputeGpuAttestationReport') + if __nvmlDeviceGetConfComputeGpuAttestationReport == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetConfComputeGpuAttestationReport = _cyb_dlsym(handle, 'nvmlDeviceGetConfComputeGpuAttestationReport') + + global __nvmlSystemGetConfComputeKeyRotationThresholdInfo + __nvmlSystemGetConfComputeKeyRotationThresholdInfo = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlSystemGetConfComputeKeyRotationThresholdInfo') + if __nvmlSystemGetConfComputeKeyRotationThresholdInfo == NULL: + if handle == NULL: + handle = load_library() + __nvmlSystemGetConfComputeKeyRotationThresholdInfo = _cyb_dlsym(handle, 'nvmlSystemGetConfComputeKeyRotationThresholdInfo') + + global __nvmlDeviceSetConfComputeUnprotectedMemSize + __nvmlDeviceSetConfComputeUnprotectedMemSize = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceSetConfComputeUnprotectedMemSize') + if __nvmlDeviceSetConfComputeUnprotectedMemSize == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetConfComputeUnprotectedMemSize = _cyb_dlsym(handle, 'nvmlDeviceSetConfComputeUnprotectedMemSize') + + global __nvmlSystemSetConfComputeGpusReadyState + __nvmlSystemSetConfComputeGpusReadyState = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlSystemSetConfComputeGpusReadyState') + if __nvmlSystemSetConfComputeGpusReadyState == NULL: + if handle == NULL: + handle = load_library() + __nvmlSystemSetConfComputeGpusReadyState = _cyb_dlsym(handle, 'nvmlSystemSetConfComputeGpusReadyState') + + global __nvmlSystemSetConfComputeKeyRotationThresholdInfo + __nvmlSystemSetConfComputeKeyRotationThresholdInfo = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlSystemSetConfComputeKeyRotationThresholdInfo') + if __nvmlSystemSetConfComputeKeyRotationThresholdInfo == NULL: + if handle == NULL: + handle = load_library() + __nvmlSystemSetConfComputeKeyRotationThresholdInfo = _cyb_dlsym(handle, 'nvmlSystemSetConfComputeKeyRotationThresholdInfo') + + global __nvmlSystemGetConfComputeSettings + __nvmlSystemGetConfComputeSettings = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlSystemGetConfComputeSettings') + if __nvmlSystemGetConfComputeSettings == NULL: + if handle == NULL: + handle = load_library() + __nvmlSystemGetConfComputeSettings = _cyb_dlsym(handle, 'nvmlSystemGetConfComputeSettings') + + global __nvmlDeviceGetGspFirmwareVersion + __nvmlDeviceGetGspFirmwareVersion = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetGspFirmwareVersion') + if __nvmlDeviceGetGspFirmwareVersion == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetGspFirmwareVersion = _cyb_dlsym(handle, 'nvmlDeviceGetGspFirmwareVersion') + + global __nvmlDeviceGetGspFirmwareMode + __nvmlDeviceGetGspFirmwareMode = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetGspFirmwareMode') + if __nvmlDeviceGetGspFirmwareMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetGspFirmwareMode = _cyb_dlsym(handle, 'nvmlDeviceGetGspFirmwareMode') + + global __nvmlDeviceGetSramEccErrorStatus + __nvmlDeviceGetSramEccErrorStatus = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetSramEccErrorStatus') + if __nvmlDeviceGetSramEccErrorStatus == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetSramEccErrorStatus = _cyb_dlsym(handle, 'nvmlDeviceGetSramEccErrorStatus') + + global __nvmlDeviceGetAccountingMode + __nvmlDeviceGetAccountingMode = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetAccountingMode') + if __nvmlDeviceGetAccountingMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetAccountingMode = _cyb_dlsym(handle, 'nvmlDeviceGetAccountingMode') + + global __nvmlDeviceGetAccountingStats + __nvmlDeviceGetAccountingStats = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetAccountingStats') + if __nvmlDeviceGetAccountingStats == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetAccountingStats = _cyb_dlsym(handle, 'nvmlDeviceGetAccountingStats') + + global __nvmlDeviceGetAccountingPids + __nvmlDeviceGetAccountingPids = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetAccountingPids') + if __nvmlDeviceGetAccountingPids == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetAccountingPids = _cyb_dlsym(handle, 'nvmlDeviceGetAccountingPids') + + global __nvmlDeviceGetAccountingBufferSize + __nvmlDeviceGetAccountingBufferSize = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetAccountingBufferSize') + if __nvmlDeviceGetAccountingBufferSize == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetAccountingBufferSize = _cyb_dlsym(handle, 'nvmlDeviceGetAccountingBufferSize') + + global __nvmlDeviceGetRetiredPages + __nvmlDeviceGetRetiredPages = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetRetiredPages') + if __nvmlDeviceGetRetiredPages == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetRetiredPages = _cyb_dlsym(handle, 'nvmlDeviceGetRetiredPages') + + global __nvmlDeviceGetRetiredPages_v2 + __nvmlDeviceGetRetiredPages_v2 = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetRetiredPages_v2') + if __nvmlDeviceGetRetiredPages_v2 == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetRetiredPages_v2 = _cyb_dlsym(handle, 'nvmlDeviceGetRetiredPages_v2') + + global __nvmlDeviceGetRetiredPagesPendingStatus + __nvmlDeviceGetRetiredPagesPendingStatus = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetRetiredPagesPendingStatus') + if __nvmlDeviceGetRetiredPagesPendingStatus == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetRetiredPagesPendingStatus = _cyb_dlsym(handle, 'nvmlDeviceGetRetiredPagesPendingStatus') + + global __nvmlDeviceGetRemappedRows + __nvmlDeviceGetRemappedRows = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetRemappedRows') + if __nvmlDeviceGetRemappedRows == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetRemappedRows = _cyb_dlsym(handle, 'nvmlDeviceGetRemappedRows') + + global __nvmlDeviceGetRowRemapperHistogram + __nvmlDeviceGetRowRemapperHistogram = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetRowRemapperHistogram') + if __nvmlDeviceGetRowRemapperHistogram == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetRowRemapperHistogram = _cyb_dlsym(handle, 'nvmlDeviceGetRowRemapperHistogram') + + global __nvmlDeviceGetArchitecture + __nvmlDeviceGetArchitecture = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetArchitecture') + if __nvmlDeviceGetArchitecture == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetArchitecture = _cyb_dlsym(handle, 'nvmlDeviceGetArchitecture') + + global __nvmlDeviceGetClkMonStatus + __nvmlDeviceGetClkMonStatus = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetClkMonStatus') + if __nvmlDeviceGetClkMonStatus == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetClkMonStatus = _cyb_dlsym(handle, 'nvmlDeviceGetClkMonStatus') + + global __nvmlDeviceGetProcessUtilization + __nvmlDeviceGetProcessUtilization = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetProcessUtilization') + if __nvmlDeviceGetProcessUtilization == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetProcessUtilization = _cyb_dlsym(handle, 'nvmlDeviceGetProcessUtilization') + + global __nvmlDeviceGetProcessesUtilizationInfo + __nvmlDeviceGetProcessesUtilizationInfo = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetProcessesUtilizationInfo') + if __nvmlDeviceGetProcessesUtilizationInfo == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetProcessesUtilizationInfo = _cyb_dlsym(handle, 'nvmlDeviceGetProcessesUtilizationInfo') + + global __nvmlDeviceGetPlatformInfo + __nvmlDeviceGetPlatformInfo = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetPlatformInfo') + if __nvmlDeviceGetPlatformInfo == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetPlatformInfo = _cyb_dlsym(handle, 'nvmlDeviceGetPlatformInfo') + + global __nvmlUnitSetLedState + __nvmlUnitSetLedState = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlUnitSetLedState') + if __nvmlUnitSetLedState == NULL: + if handle == NULL: + handle = load_library() + __nvmlUnitSetLedState = _cyb_dlsym(handle, 'nvmlUnitSetLedState') + + global __nvmlDeviceSetPersistenceMode + __nvmlDeviceSetPersistenceMode = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceSetPersistenceMode') + if __nvmlDeviceSetPersistenceMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetPersistenceMode = _cyb_dlsym(handle, 'nvmlDeviceSetPersistenceMode') + + global __nvmlDeviceSetComputeMode + __nvmlDeviceSetComputeMode = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceSetComputeMode') + if __nvmlDeviceSetComputeMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetComputeMode = _cyb_dlsym(handle, 'nvmlDeviceSetComputeMode') + + global __nvmlDeviceSetEccMode + __nvmlDeviceSetEccMode = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceSetEccMode') + if __nvmlDeviceSetEccMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetEccMode = _cyb_dlsym(handle, 'nvmlDeviceSetEccMode') + + global __nvmlDeviceClearEccErrorCounts + __nvmlDeviceClearEccErrorCounts = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceClearEccErrorCounts') + if __nvmlDeviceClearEccErrorCounts == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceClearEccErrorCounts = _cyb_dlsym(handle, 'nvmlDeviceClearEccErrorCounts') + + global __nvmlDeviceSetDriverModel + __nvmlDeviceSetDriverModel = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceSetDriverModel') + if __nvmlDeviceSetDriverModel == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetDriverModel = _cyb_dlsym(handle, 'nvmlDeviceSetDriverModel') + + global __nvmlDeviceSetGpuLockedClocks + __nvmlDeviceSetGpuLockedClocks = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceSetGpuLockedClocks') + if __nvmlDeviceSetGpuLockedClocks == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetGpuLockedClocks = _cyb_dlsym(handle, 'nvmlDeviceSetGpuLockedClocks') + + global __nvmlDeviceResetGpuLockedClocks + __nvmlDeviceResetGpuLockedClocks = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceResetGpuLockedClocks') + if __nvmlDeviceResetGpuLockedClocks == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceResetGpuLockedClocks = _cyb_dlsym(handle, 'nvmlDeviceResetGpuLockedClocks') + + global __nvmlDeviceSetMemoryLockedClocks + __nvmlDeviceSetMemoryLockedClocks = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceSetMemoryLockedClocks') + if __nvmlDeviceSetMemoryLockedClocks == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetMemoryLockedClocks = _cyb_dlsym(handle, 'nvmlDeviceSetMemoryLockedClocks') + + global __nvmlDeviceResetMemoryLockedClocks + __nvmlDeviceResetMemoryLockedClocks = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceResetMemoryLockedClocks') + if __nvmlDeviceResetMemoryLockedClocks == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceResetMemoryLockedClocks = _cyb_dlsym(handle, 'nvmlDeviceResetMemoryLockedClocks') + + global __nvmlDeviceSetAutoBoostedClocksEnabled + __nvmlDeviceSetAutoBoostedClocksEnabled = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceSetAutoBoostedClocksEnabled') + if __nvmlDeviceSetAutoBoostedClocksEnabled == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetAutoBoostedClocksEnabled = _cyb_dlsym(handle, 'nvmlDeviceSetAutoBoostedClocksEnabled') + + global __nvmlDeviceSetDefaultAutoBoostedClocksEnabled + __nvmlDeviceSetDefaultAutoBoostedClocksEnabled = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceSetDefaultAutoBoostedClocksEnabled') + if __nvmlDeviceSetDefaultAutoBoostedClocksEnabled == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetDefaultAutoBoostedClocksEnabled = _cyb_dlsym(handle, 'nvmlDeviceSetDefaultAutoBoostedClocksEnabled') + + global __nvmlDeviceSetDefaultFanSpeed_v2 + __nvmlDeviceSetDefaultFanSpeed_v2 = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceSetDefaultFanSpeed_v2') + if __nvmlDeviceSetDefaultFanSpeed_v2 == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetDefaultFanSpeed_v2 = _cyb_dlsym(handle, 'nvmlDeviceSetDefaultFanSpeed_v2') + + global __nvmlDeviceSetFanControlPolicy + __nvmlDeviceSetFanControlPolicy = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceSetFanControlPolicy') + if __nvmlDeviceSetFanControlPolicy == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetFanControlPolicy = _cyb_dlsym(handle, 'nvmlDeviceSetFanControlPolicy') + + global __nvmlDeviceSetTemperatureThreshold + __nvmlDeviceSetTemperatureThreshold = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceSetTemperatureThreshold') + if __nvmlDeviceSetTemperatureThreshold == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetTemperatureThreshold = _cyb_dlsym(handle, 'nvmlDeviceSetTemperatureThreshold') + + global __nvmlDeviceSetGpuOperationMode + __nvmlDeviceSetGpuOperationMode = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceSetGpuOperationMode') + if __nvmlDeviceSetGpuOperationMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetGpuOperationMode = _cyb_dlsym(handle, 'nvmlDeviceSetGpuOperationMode') + + global __nvmlDeviceSetAPIRestriction + __nvmlDeviceSetAPIRestriction = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceSetAPIRestriction') + if __nvmlDeviceSetAPIRestriction == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetAPIRestriction = _cyb_dlsym(handle, 'nvmlDeviceSetAPIRestriction') + + global __nvmlDeviceSetFanSpeed_v2 + __nvmlDeviceSetFanSpeed_v2 = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceSetFanSpeed_v2') + if __nvmlDeviceSetFanSpeed_v2 == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetFanSpeed_v2 = _cyb_dlsym(handle, 'nvmlDeviceSetFanSpeed_v2') + + global __nvmlDeviceSetAccountingMode + __nvmlDeviceSetAccountingMode = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceSetAccountingMode') + if __nvmlDeviceSetAccountingMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetAccountingMode = _cyb_dlsym(handle, 'nvmlDeviceSetAccountingMode') + + global __nvmlDeviceClearAccountingPids + __nvmlDeviceClearAccountingPids = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceClearAccountingPids') + if __nvmlDeviceClearAccountingPids == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceClearAccountingPids = _cyb_dlsym(handle, 'nvmlDeviceClearAccountingPids') + + global __nvmlDeviceSetPowerManagementLimit_v2 + __nvmlDeviceSetPowerManagementLimit_v2 = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceSetPowerManagementLimit_v2') + if __nvmlDeviceSetPowerManagementLimit_v2 == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetPowerManagementLimit_v2 = _cyb_dlsym(handle, 'nvmlDeviceSetPowerManagementLimit_v2') + + global __nvmlDeviceGetNvLinkState + __nvmlDeviceGetNvLinkState = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetNvLinkState') + if __nvmlDeviceGetNvLinkState == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetNvLinkState = _cyb_dlsym(handle, 'nvmlDeviceGetNvLinkState') + + global __nvmlDeviceGetNvLinkVersion + __nvmlDeviceGetNvLinkVersion = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetNvLinkVersion') + if __nvmlDeviceGetNvLinkVersion == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetNvLinkVersion = _cyb_dlsym(handle, 'nvmlDeviceGetNvLinkVersion') + + global __nvmlDeviceGetNvLinkCapability + __nvmlDeviceGetNvLinkCapability = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetNvLinkCapability') + if __nvmlDeviceGetNvLinkCapability == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetNvLinkCapability = _cyb_dlsym(handle, 'nvmlDeviceGetNvLinkCapability') + + global __nvmlDeviceGetNvLinkRemotePciInfo_v2 + __nvmlDeviceGetNvLinkRemotePciInfo_v2 = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetNvLinkRemotePciInfo_v2') + if __nvmlDeviceGetNvLinkRemotePciInfo_v2 == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetNvLinkRemotePciInfo_v2 = _cyb_dlsym(handle, 'nvmlDeviceGetNvLinkRemotePciInfo_v2') + + global __nvmlDeviceGetNvLinkErrorCounter + __nvmlDeviceGetNvLinkErrorCounter = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetNvLinkErrorCounter') + if __nvmlDeviceGetNvLinkErrorCounter == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetNvLinkErrorCounter = _cyb_dlsym(handle, 'nvmlDeviceGetNvLinkErrorCounter') + + global __nvmlDeviceResetNvLinkErrorCounters + __nvmlDeviceResetNvLinkErrorCounters = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceResetNvLinkErrorCounters') + if __nvmlDeviceResetNvLinkErrorCounters == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceResetNvLinkErrorCounters = _cyb_dlsym(handle, 'nvmlDeviceResetNvLinkErrorCounters') + + global __nvmlDeviceGetNvLinkRemoteDeviceType + __nvmlDeviceGetNvLinkRemoteDeviceType = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetNvLinkRemoteDeviceType') + if __nvmlDeviceGetNvLinkRemoteDeviceType == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetNvLinkRemoteDeviceType = _cyb_dlsym(handle, 'nvmlDeviceGetNvLinkRemoteDeviceType') + + global __nvmlDeviceSetNvLinkDeviceLowPowerThreshold + __nvmlDeviceSetNvLinkDeviceLowPowerThreshold = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceSetNvLinkDeviceLowPowerThreshold') + if __nvmlDeviceSetNvLinkDeviceLowPowerThreshold == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetNvLinkDeviceLowPowerThreshold = _cyb_dlsym(handle, 'nvmlDeviceSetNvLinkDeviceLowPowerThreshold') + + global __nvmlSystemSetNvlinkBwMode + __nvmlSystemSetNvlinkBwMode = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlSystemSetNvlinkBwMode') + if __nvmlSystemSetNvlinkBwMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlSystemSetNvlinkBwMode = _cyb_dlsym(handle, 'nvmlSystemSetNvlinkBwMode') + + global __nvmlSystemGetNvlinkBwMode + __nvmlSystemGetNvlinkBwMode = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlSystemGetNvlinkBwMode') + if __nvmlSystemGetNvlinkBwMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlSystemGetNvlinkBwMode = _cyb_dlsym(handle, 'nvmlSystemGetNvlinkBwMode') + + global __nvmlDeviceGetNvlinkSupportedBwModes + __nvmlDeviceGetNvlinkSupportedBwModes = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetNvlinkSupportedBwModes') + if __nvmlDeviceGetNvlinkSupportedBwModes == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetNvlinkSupportedBwModes = _cyb_dlsym(handle, 'nvmlDeviceGetNvlinkSupportedBwModes') + + global __nvmlDeviceGetNvlinkBwMode + __nvmlDeviceGetNvlinkBwMode = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetNvlinkBwMode') + if __nvmlDeviceGetNvlinkBwMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetNvlinkBwMode = _cyb_dlsym(handle, 'nvmlDeviceGetNvlinkBwMode') + + global __nvmlDeviceSetNvlinkBwMode + __nvmlDeviceSetNvlinkBwMode = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceSetNvlinkBwMode') + if __nvmlDeviceSetNvlinkBwMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetNvlinkBwMode = _cyb_dlsym(handle, 'nvmlDeviceSetNvlinkBwMode') + + global __nvmlEventSetCreate + __nvmlEventSetCreate = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlEventSetCreate') + if __nvmlEventSetCreate == NULL: + if handle == NULL: + handle = load_library() + __nvmlEventSetCreate = _cyb_dlsym(handle, 'nvmlEventSetCreate') + + global __nvmlDeviceRegisterEvents + __nvmlDeviceRegisterEvents = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceRegisterEvents') + if __nvmlDeviceRegisterEvents == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceRegisterEvents = _cyb_dlsym(handle, 'nvmlDeviceRegisterEvents') + + global __nvmlDeviceGetSupportedEventTypes + __nvmlDeviceGetSupportedEventTypes = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetSupportedEventTypes') + if __nvmlDeviceGetSupportedEventTypes == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetSupportedEventTypes = _cyb_dlsym(handle, 'nvmlDeviceGetSupportedEventTypes') + + global __nvmlEventSetWait_v2 + __nvmlEventSetWait_v2 = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlEventSetWait_v2') + if __nvmlEventSetWait_v2 == NULL: + if handle == NULL: + handle = load_library() + __nvmlEventSetWait_v2 = _cyb_dlsym(handle, 'nvmlEventSetWait_v2') + + global __nvmlEventSetFree + __nvmlEventSetFree = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlEventSetFree') + if __nvmlEventSetFree == NULL: + if handle == NULL: + handle = load_library() + __nvmlEventSetFree = _cyb_dlsym(handle, 'nvmlEventSetFree') + + global __nvmlSystemEventSetCreate + __nvmlSystemEventSetCreate = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlSystemEventSetCreate') + if __nvmlSystemEventSetCreate == NULL: + if handle == NULL: + handle = load_library() + __nvmlSystemEventSetCreate = _cyb_dlsym(handle, 'nvmlSystemEventSetCreate') + + global __nvmlSystemEventSetFree + __nvmlSystemEventSetFree = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlSystemEventSetFree') + if __nvmlSystemEventSetFree == NULL: + if handle == NULL: + handle = load_library() + __nvmlSystemEventSetFree = _cyb_dlsym(handle, 'nvmlSystemEventSetFree') + + global __nvmlSystemRegisterEvents + __nvmlSystemRegisterEvents = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlSystemRegisterEvents') + if __nvmlSystemRegisterEvents == NULL: + if handle == NULL: + handle = load_library() + __nvmlSystemRegisterEvents = _cyb_dlsym(handle, 'nvmlSystemRegisterEvents') + + global __nvmlSystemEventSetWait + __nvmlSystemEventSetWait = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlSystemEventSetWait') + if __nvmlSystemEventSetWait == NULL: + if handle == NULL: + handle = load_library() + __nvmlSystemEventSetWait = _cyb_dlsym(handle, 'nvmlSystemEventSetWait') + + global __nvmlDeviceModifyDrainState + __nvmlDeviceModifyDrainState = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceModifyDrainState') + if __nvmlDeviceModifyDrainState == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceModifyDrainState = _cyb_dlsym(handle, 'nvmlDeviceModifyDrainState') + + global __nvmlDeviceQueryDrainState + __nvmlDeviceQueryDrainState = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceQueryDrainState') + if __nvmlDeviceQueryDrainState == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceQueryDrainState = _cyb_dlsym(handle, 'nvmlDeviceQueryDrainState') + + global __nvmlDeviceRemoveGpu_v2 + __nvmlDeviceRemoveGpu_v2 = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceRemoveGpu_v2') + if __nvmlDeviceRemoveGpu_v2 == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceRemoveGpu_v2 = _cyb_dlsym(handle, 'nvmlDeviceRemoveGpu_v2') + + global __nvmlDeviceDiscoverGpus + __nvmlDeviceDiscoverGpus = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceDiscoverGpus') + if __nvmlDeviceDiscoverGpus == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceDiscoverGpus = _cyb_dlsym(handle, 'nvmlDeviceDiscoverGpus') + + global __nvmlDeviceGetFieldValues + __nvmlDeviceGetFieldValues = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetFieldValues') + if __nvmlDeviceGetFieldValues == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetFieldValues = _cyb_dlsym(handle, 'nvmlDeviceGetFieldValues') + + global __nvmlDeviceClearFieldValues + __nvmlDeviceClearFieldValues = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceClearFieldValues') + if __nvmlDeviceClearFieldValues == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceClearFieldValues = _cyb_dlsym(handle, 'nvmlDeviceClearFieldValues') + + global __nvmlDeviceGetVirtualizationMode + __nvmlDeviceGetVirtualizationMode = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetVirtualizationMode') + if __nvmlDeviceGetVirtualizationMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetVirtualizationMode = _cyb_dlsym(handle, 'nvmlDeviceGetVirtualizationMode') + + global __nvmlDeviceGetHostVgpuMode + __nvmlDeviceGetHostVgpuMode = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetHostVgpuMode') + if __nvmlDeviceGetHostVgpuMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetHostVgpuMode = _cyb_dlsym(handle, 'nvmlDeviceGetHostVgpuMode') + + global __nvmlDeviceSetVirtualizationMode + __nvmlDeviceSetVirtualizationMode = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceSetVirtualizationMode') + if __nvmlDeviceSetVirtualizationMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetVirtualizationMode = _cyb_dlsym(handle, 'nvmlDeviceSetVirtualizationMode') + + global __nvmlDeviceGetVgpuHeterogeneousMode + __nvmlDeviceGetVgpuHeterogeneousMode = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetVgpuHeterogeneousMode') + if __nvmlDeviceGetVgpuHeterogeneousMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetVgpuHeterogeneousMode = _cyb_dlsym(handle, 'nvmlDeviceGetVgpuHeterogeneousMode') + + global __nvmlDeviceSetVgpuHeterogeneousMode + __nvmlDeviceSetVgpuHeterogeneousMode = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceSetVgpuHeterogeneousMode') + if __nvmlDeviceSetVgpuHeterogeneousMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetVgpuHeterogeneousMode = _cyb_dlsym(handle, 'nvmlDeviceSetVgpuHeterogeneousMode') + + global __nvmlVgpuInstanceGetPlacementId + __nvmlVgpuInstanceGetPlacementId = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlVgpuInstanceGetPlacementId') + if __nvmlVgpuInstanceGetPlacementId == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuInstanceGetPlacementId = _cyb_dlsym(handle, 'nvmlVgpuInstanceGetPlacementId') + + global __nvmlDeviceGetVgpuTypeSupportedPlacements + __nvmlDeviceGetVgpuTypeSupportedPlacements = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetVgpuTypeSupportedPlacements') + if __nvmlDeviceGetVgpuTypeSupportedPlacements == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetVgpuTypeSupportedPlacements = _cyb_dlsym(handle, 'nvmlDeviceGetVgpuTypeSupportedPlacements') + + global __nvmlDeviceGetVgpuTypeCreatablePlacements + __nvmlDeviceGetVgpuTypeCreatablePlacements = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetVgpuTypeCreatablePlacements') + if __nvmlDeviceGetVgpuTypeCreatablePlacements == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetVgpuTypeCreatablePlacements = _cyb_dlsym(handle, 'nvmlDeviceGetVgpuTypeCreatablePlacements') + + global __nvmlVgpuTypeGetGspHeapSize + __nvmlVgpuTypeGetGspHeapSize = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlVgpuTypeGetGspHeapSize') + if __nvmlVgpuTypeGetGspHeapSize == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuTypeGetGspHeapSize = _cyb_dlsym(handle, 'nvmlVgpuTypeGetGspHeapSize') + + global __nvmlVgpuTypeGetFbReservation + __nvmlVgpuTypeGetFbReservation = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlVgpuTypeGetFbReservation') + if __nvmlVgpuTypeGetFbReservation == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuTypeGetFbReservation = _cyb_dlsym(handle, 'nvmlVgpuTypeGetFbReservation') + + global __nvmlVgpuInstanceGetRuntimeStateSize + __nvmlVgpuInstanceGetRuntimeStateSize = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlVgpuInstanceGetRuntimeStateSize') + if __nvmlVgpuInstanceGetRuntimeStateSize == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuInstanceGetRuntimeStateSize = _cyb_dlsym(handle, 'nvmlVgpuInstanceGetRuntimeStateSize') + + global __nvmlDeviceSetVgpuCapabilities + __nvmlDeviceSetVgpuCapabilities = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceSetVgpuCapabilities') + if __nvmlDeviceSetVgpuCapabilities == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetVgpuCapabilities = _cyb_dlsym(handle, 'nvmlDeviceSetVgpuCapabilities') + + global __nvmlDeviceGetGridLicensableFeatures_v4 + __nvmlDeviceGetGridLicensableFeatures_v4 = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetGridLicensableFeatures_v4') + if __nvmlDeviceGetGridLicensableFeatures_v4 == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetGridLicensableFeatures_v4 = _cyb_dlsym(handle, 'nvmlDeviceGetGridLicensableFeatures_v4') + + global __nvmlGetVgpuDriverCapabilities + __nvmlGetVgpuDriverCapabilities = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlGetVgpuDriverCapabilities') + if __nvmlGetVgpuDriverCapabilities == NULL: + if handle == NULL: + handle = load_library() + __nvmlGetVgpuDriverCapabilities = _cyb_dlsym(handle, 'nvmlGetVgpuDriverCapabilities') + + global __nvmlDeviceGetVgpuCapabilities + __nvmlDeviceGetVgpuCapabilities = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetVgpuCapabilities') + if __nvmlDeviceGetVgpuCapabilities == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetVgpuCapabilities = _cyb_dlsym(handle, 'nvmlDeviceGetVgpuCapabilities') + + global __nvmlDeviceGetSupportedVgpus + __nvmlDeviceGetSupportedVgpus = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetSupportedVgpus') + if __nvmlDeviceGetSupportedVgpus == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetSupportedVgpus = _cyb_dlsym(handle, 'nvmlDeviceGetSupportedVgpus') + + global __nvmlDeviceGetCreatableVgpus + __nvmlDeviceGetCreatableVgpus = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetCreatableVgpus') + if __nvmlDeviceGetCreatableVgpus == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetCreatableVgpus = _cyb_dlsym(handle, 'nvmlDeviceGetCreatableVgpus') + + global __nvmlVgpuTypeGetClass + __nvmlVgpuTypeGetClass = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlVgpuTypeGetClass') + if __nvmlVgpuTypeGetClass == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuTypeGetClass = _cyb_dlsym(handle, 'nvmlVgpuTypeGetClass') + + global __nvmlVgpuTypeGetName + __nvmlVgpuTypeGetName = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlVgpuTypeGetName') + if __nvmlVgpuTypeGetName == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuTypeGetName = _cyb_dlsym(handle, 'nvmlVgpuTypeGetName') + + global __nvmlVgpuTypeGetGpuInstanceProfileId + __nvmlVgpuTypeGetGpuInstanceProfileId = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlVgpuTypeGetGpuInstanceProfileId') + if __nvmlVgpuTypeGetGpuInstanceProfileId == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuTypeGetGpuInstanceProfileId = _cyb_dlsym(handle, 'nvmlVgpuTypeGetGpuInstanceProfileId') + + global __nvmlVgpuTypeGetDeviceID + __nvmlVgpuTypeGetDeviceID = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlVgpuTypeGetDeviceID') + if __nvmlVgpuTypeGetDeviceID == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuTypeGetDeviceID = _cyb_dlsym(handle, 'nvmlVgpuTypeGetDeviceID') + + global __nvmlVgpuTypeGetFramebufferSize + __nvmlVgpuTypeGetFramebufferSize = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlVgpuTypeGetFramebufferSize') + if __nvmlVgpuTypeGetFramebufferSize == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuTypeGetFramebufferSize = _cyb_dlsym(handle, 'nvmlVgpuTypeGetFramebufferSize') + + global __nvmlVgpuTypeGetNumDisplayHeads + __nvmlVgpuTypeGetNumDisplayHeads = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlVgpuTypeGetNumDisplayHeads') + if __nvmlVgpuTypeGetNumDisplayHeads == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuTypeGetNumDisplayHeads = _cyb_dlsym(handle, 'nvmlVgpuTypeGetNumDisplayHeads') + + global __nvmlVgpuTypeGetResolution + __nvmlVgpuTypeGetResolution = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlVgpuTypeGetResolution') + if __nvmlVgpuTypeGetResolution == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuTypeGetResolution = _cyb_dlsym(handle, 'nvmlVgpuTypeGetResolution') + + global __nvmlVgpuTypeGetLicense + __nvmlVgpuTypeGetLicense = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlVgpuTypeGetLicense') + if __nvmlVgpuTypeGetLicense == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuTypeGetLicense = _cyb_dlsym(handle, 'nvmlVgpuTypeGetLicense') + + global __nvmlVgpuTypeGetFrameRateLimit + __nvmlVgpuTypeGetFrameRateLimit = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlVgpuTypeGetFrameRateLimit') + if __nvmlVgpuTypeGetFrameRateLimit == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuTypeGetFrameRateLimit = _cyb_dlsym(handle, 'nvmlVgpuTypeGetFrameRateLimit') + + global __nvmlVgpuTypeGetMaxInstances + __nvmlVgpuTypeGetMaxInstances = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlVgpuTypeGetMaxInstances') + if __nvmlVgpuTypeGetMaxInstances == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuTypeGetMaxInstances = _cyb_dlsym(handle, 'nvmlVgpuTypeGetMaxInstances') + + global __nvmlVgpuTypeGetMaxInstancesPerVm + __nvmlVgpuTypeGetMaxInstancesPerVm = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlVgpuTypeGetMaxInstancesPerVm') + if __nvmlVgpuTypeGetMaxInstancesPerVm == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuTypeGetMaxInstancesPerVm = _cyb_dlsym(handle, 'nvmlVgpuTypeGetMaxInstancesPerVm') + + global __nvmlVgpuTypeGetBAR1Info + __nvmlVgpuTypeGetBAR1Info = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlVgpuTypeGetBAR1Info') + if __nvmlVgpuTypeGetBAR1Info == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuTypeGetBAR1Info = _cyb_dlsym(handle, 'nvmlVgpuTypeGetBAR1Info') + + global __nvmlDeviceGetActiveVgpus + __nvmlDeviceGetActiveVgpus = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetActiveVgpus') + if __nvmlDeviceGetActiveVgpus == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetActiveVgpus = _cyb_dlsym(handle, 'nvmlDeviceGetActiveVgpus') + + global __nvmlVgpuInstanceGetVmID + __nvmlVgpuInstanceGetVmID = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlVgpuInstanceGetVmID') + if __nvmlVgpuInstanceGetVmID == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuInstanceGetVmID = _cyb_dlsym(handle, 'nvmlVgpuInstanceGetVmID') + + global __nvmlVgpuInstanceGetUUID + __nvmlVgpuInstanceGetUUID = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlVgpuInstanceGetUUID') + if __nvmlVgpuInstanceGetUUID == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuInstanceGetUUID = _cyb_dlsym(handle, 'nvmlVgpuInstanceGetUUID') + + global __nvmlVgpuInstanceGetVmDriverVersion + __nvmlVgpuInstanceGetVmDriverVersion = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlVgpuInstanceGetVmDriverVersion') + if __nvmlVgpuInstanceGetVmDriverVersion == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuInstanceGetVmDriverVersion = _cyb_dlsym(handle, 'nvmlVgpuInstanceGetVmDriverVersion') + + global __nvmlVgpuInstanceGetFbUsage + __nvmlVgpuInstanceGetFbUsage = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlVgpuInstanceGetFbUsage') + if __nvmlVgpuInstanceGetFbUsage == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuInstanceGetFbUsage = _cyb_dlsym(handle, 'nvmlVgpuInstanceGetFbUsage') + + global __nvmlVgpuInstanceGetLicenseStatus + __nvmlVgpuInstanceGetLicenseStatus = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlVgpuInstanceGetLicenseStatus') + if __nvmlVgpuInstanceGetLicenseStatus == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuInstanceGetLicenseStatus = _cyb_dlsym(handle, 'nvmlVgpuInstanceGetLicenseStatus') + + global __nvmlVgpuInstanceGetType + __nvmlVgpuInstanceGetType = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlVgpuInstanceGetType') + if __nvmlVgpuInstanceGetType == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuInstanceGetType = _cyb_dlsym(handle, 'nvmlVgpuInstanceGetType') + + global __nvmlVgpuInstanceGetFrameRateLimit + __nvmlVgpuInstanceGetFrameRateLimit = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlVgpuInstanceGetFrameRateLimit') + if __nvmlVgpuInstanceGetFrameRateLimit == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuInstanceGetFrameRateLimit = _cyb_dlsym(handle, 'nvmlVgpuInstanceGetFrameRateLimit') + + global __nvmlVgpuInstanceGetEccMode + __nvmlVgpuInstanceGetEccMode = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlVgpuInstanceGetEccMode') + if __nvmlVgpuInstanceGetEccMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuInstanceGetEccMode = _cyb_dlsym(handle, 'nvmlVgpuInstanceGetEccMode') + + global __nvmlVgpuInstanceGetEncoderCapacity + __nvmlVgpuInstanceGetEncoderCapacity = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlVgpuInstanceGetEncoderCapacity') + if __nvmlVgpuInstanceGetEncoderCapacity == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuInstanceGetEncoderCapacity = _cyb_dlsym(handle, 'nvmlVgpuInstanceGetEncoderCapacity') + + global __nvmlVgpuInstanceSetEncoderCapacity + __nvmlVgpuInstanceSetEncoderCapacity = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlVgpuInstanceSetEncoderCapacity') + if __nvmlVgpuInstanceSetEncoderCapacity == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuInstanceSetEncoderCapacity = _cyb_dlsym(handle, 'nvmlVgpuInstanceSetEncoderCapacity') + + global __nvmlVgpuInstanceGetEncoderStats + __nvmlVgpuInstanceGetEncoderStats = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlVgpuInstanceGetEncoderStats') + if __nvmlVgpuInstanceGetEncoderStats == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuInstanceGetEncoderStats = _cyb_dlsym(handle, 'nvmlVgpuInstanceGetEncoderStats') + + global __nvmlVgpuInstanceGetEncoderSessions + __nvmlVgpuInstanceGetEncoderSessions = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlVgpuInstanceGetEncoderSessions') + if __nvmlVgpuInstanceGetEncoderSessions == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuInstanceGetEncoderSessions = _cyb_dlsym(handle, 'nvmlVgpuInstanceGetEncoderSessions') + + global __nvmlVgpuInstanceGetFBCStats + __nvmlVgpuInstanceGetFBCStats = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlVgpuInstanceGetFBCStats') + if __nvmlVgpuInstanceGetFBCStats == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuInstanceGetFBCStats = _cyb_dlsym(handle, 'nvmlVgpuInstanceGetFBCStats') + + global __nvmlVgpuInstanceGetFBCSessions + __nvmlVgpuInstanceGetFBCSessions = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlVgpuInstanceGetFBCSessions') + if __nvmlVgpuInstanceGetFBCSessions == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuInstanceGetFBCSessions = _cyb_dlsym(handle, 'nvmlVgpuInstanceGetFBCSessions') + + global __nvmlVgpuInstanceGetGpuInstanceId + __nvmlVgpuInstanceGetGpuInstanceId = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlVgpuInstanceGetGpuInstanceId') + if __nvmlVgpuInstanceGetGpuInstanceId == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuInstanceGetGpuInstanceId = _cyb_dlsym(handle, 'nvmlVgpuInstanceGetGpuInstanceId') + + global __nvmlVgpuInstanceGetGpuPciId + __nvmlVgpuInstanceGetGpuPciId = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlVgpuInstanceGetGpuPciId') + if __nvmlVgpuInstanceGetGpuPciId == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuInstanceGetGpuPciId = _cyb_dlsym(handle, 'nvmlVgpuInstanceGetGpuPciId') + + global __nvmlVgpuTypeGetCapabilities + __nvmlVgpuTypeGetCapabilities = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlVgpuTypeGetCapabilities') + if __nvmlVgpuTypeGetCapabilities == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuTypeGetCapabilities = _cyb_dlsym(handle, 'nvmlVgpuTypeGetCapabilities') + + global __nvmlVgpuInstanceGetMdevUUID + __nvmlVgpuInstanceGetMdevUUID = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlVgpuInstanceGetMdevUUID') + if __nvmlVgpuInstanceGetMdevUUID == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuInstanceGetMdevUUID = _cyb_dlsym(handle, 'nvmlVgpuInstanceGetMdevUUID') + + global __nvmlGpuInstanceGetCreatableVgpus + __nvmlGpuInstanceGetCreatableVgpus = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlGpuInstanceGetCreatableVgpus') + if __nvmlGpuInstanceGetCreatableVgpus == NULL: + if handle == NULL: + handle = load_library() + __nvmlGpuInstanceGetCreatableVgpus = _cyb_dlsym(handle, 'nvmlGpuInstanceGetCreatableVgpus') + + global __nvmlVgpuTypeGetMaxInstancesPerGpuInstance + __nvmlVgpuTypeGetMaxInstancesPerGpuInstance = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlVgpuTypeGetMaxInstancesPerGpuInstance') + if __nvmlVgpuTypeGetMaxInstancesPerGpuInstance == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuTypeGetMaxInstancesPerGpuInstance = _cyb_dlsym(handle, 'nvmlVgpuTypeGetMaxInstancesPerGpuInstance') + + global __nvmlGpuInstanceGetActiveVgpus + __nvmlGpuInstanceGetActiveVgpus = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlGpuInstanceGetActiveVgpus') + if __nvmlGpuInstanceGetActiveVgpus == NULL: + if handle == NULL: + handle = load_library() + __nvmlGpuInstanceGetActiveVgpus = _cyb_dlsym(handle, 'nvmlGpuInstanceGetActiveVgpus') + + global __nvmlGpuInstanceSetVgpuSchedulerState + __nvmlGpuInstanceSetVgpuSchedulerState = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlGpuInstanceSetVgpuSchedulerState') + if __nvmlGpuInstanceSetVgpuSchedulerState == NULL: + if handle == NULL: + handle = load_library() + __nvmlGpuInstanceSetVgpuSchedulerState = _cyb_dlsym(handle, 'nvmlGpuInstanceSetVgpuSchedulerState') + + global __nvmlGpuInstanceGetVgpuSchedulerState + __nvmlGpuInstanceGetVgpuSchedulerState = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlGpuInstanceGetVgpuSchedulerState') + if __nvmlGpuInstanceGetVgpuSchedulerState == NULL: + if handle == NULL: + handle = load_library() + __nvmlGpuInstanceGetVgpuSchedulerState = _cyb_dlsym(handle, 'nvmlGpuInstanceGetVgpuSchedulerState') + + global __nvmlGpuInstanceGetVgpuSchedulerLog + __nvmlGpuInstanceGetVgpuSchedulerLog = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlGpuInstanceGetVgpuSchedulerLog') + if __nvmlGpuInstanceGetVgpuSchedulerLog == NULL: + if handle == NULL: + handle = load_library() + __nvmlGpuInstanceGetVgpuSchedulerLog = _cyb_dlsym(handle, 'nvmlGpuInstanceGetVgpuSchedulerLog') + + global __nvmlGpuInstanceGetVgpuTypeCreatablePlacements + __nvmlGpuInstanceGetVgpuTypeCreatablePlacements = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlGpuInstanceGetVgpuTypeCreatablePlacements') + if __nvmlGpuInstanceGetVgpuTypeCreatablePlacements == NULL: + if handle == NULL: + handle = load_library() + __nvmlGpuInstanceGetVgpuTypeCreatablePlacements = _cyb_dlsym(handle, 'nvmlGpuInstanceGetVgpuTypeCreatablePlacements') + + global __nvmlGpuInstanceGetVgpuHeterogeneousMode + __nvmlGpuInstanceGetVgpuHeterogeneousMode = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlGpuInstanceGetVgpuHeterogeneousMode') + if __nvmlGpuInstanceGetVgpuHeterogeneousMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlGpuInstanceGetVgpuHeterogeneousMode = _cyb_dlsym(handle, 'nvmlGpuInstanceGetVgpuHeterogeneousMode') + + global __nvmlGpuInstanceSetVgpuHeterogeneousMode + __nvmlGpuInstanceSetVgpuHeterogeneousMode = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlGpuInstanceSetVgpuHeterogeneousMode') + if __nvmlGpuInstanceSetVgpuHeterogeneousMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlGpuInstanceSetVgpuHeterogeneousMode = _cyb_dlsym(handle, 'nvmlGpuInstanceSetVgpuHeterogeneousMode') + + global __nvmlVgpuInstanceGetMetadata + __nvmlVgpuInstanceGetMetadata = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlVgpuInstanceGetMetadata') + if __nvmlVgpuInstanceGetMetadata == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuInstanceGetMetadata = _cyb_dlsym(handle, 'nvmlVgpuInstanceGetMetadata') + + global __nvmlDeviceGetVgpuMetadata + __nvmlDeviceGetVgpuMetadata = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetVgpuMetadata') + if __nvmlDeviceGetVgpuMetadata == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetVgpuMetadata = _cyb_dlsym(handle, 'nvmlDeviceGetVgpuMetadata') + + global __nvmlGetVgpuCompatibility + __nvmlGetVgpuCompatibility = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlGetVgpuCompatibility') + if __nvmlGetVgpuCompatibility == NULL: + if handle == NULL: + handle = load_library() + __nvmlGetVgpuCompatibility = _cyb_dlsym(handle, 'nvmlGetVgpuCompatibility') + + global __nvmlDeviceGetPgpuMetadataString + __nvmlDeviceGetPgpuMetadataString = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetPgpuMetadataString') + if __nvmlDeviceGetPgpuMetadataString == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetPgpuMetadataString = _cyb_dlsym(handle, 'nvmlDeviceGetPgpuMetadataString') + + global __nvmlDeviceGetVgpuSchedulerLog + __nvmlDeviceGetVgpuSchedulerLog = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetVgpuSchedulerLog') + if __nvmlDeviceGetVgpuSchedulerLog == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetVgpuSchedulerLog = _cyb_dlsym(handle, 'nvmlDeviceGetVgpuSchedulerLog') + + global __nvmlDeviceGetVgpuSchedulerState + __nvmlDeviceGetVgpuSchedulerState = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetVgpuSchedulerState') + if __nvmlDeviceGetVgpuSchedulerState == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetVgpuSchedulerState = _cyb_dlsym(handle, 'nvmlDeviceGetVgpuSchedulerState') + + global __nvmlDeviceGetVgpuSchedulerCapabilities + __nvmlDeviceGetVgpuSchedulerCapabilities = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetVgpuSchedulerCapabilities') + if __nvmlDeviceGetVgpuSchedulerCapabilities == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetVgpuSchedulerCapabilities = _cyb_dlsym(handle, 'nvmlDeviceGetVgpuSchedulerCapabilities') + + global __nvmlDeviceSetVgpuSchedulerState + __nvmlDeviceSetVgpuSchedulerState = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceSetVgpuSchedulerState') + if __nvmlDeviceSetVgpuSchedulerState == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetVgpuSchedulerState = _cyb_dlsym(handle, 'nvmlDeviceSetVgpuSchedulerState') + + global __nvmlGetVgpuVersion + __nvmlGetVgpuVersion = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlGetVgpuVersion') + if __nvmlGetVgpuVersion == NULL: + if handle == NULL: + handle = load_library() + __nvmlGetVgpuVersion = _cyb_dlsym(handle, 'nvmlGetVgpuVersion') + + global __nvmlSetVgpuVersion + __nvmlSetVgpuVersion = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlSetVgpuVersion') + if __nvmlSetVgpuVersion == NULL: + if handle == NULL: + handle = load_library() + __nvmlSetVgpuVersion = _cyb_dlsym(handle, 'nvmlSetVgpuVersion') + + global __nvmlDeviceGetVgpuUtilization + __nvmlDeviceGetVgpuUtilization = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetVgpuUtilization') + if __nvmlDeviceGetVgpuUtilization == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetVgpuUtilization = _cyb_dlsym(handle, 'nvmlDeviceGetVgpuUtilization') + + global __nvmlDeviceGetVgpuInstancesUtilizationInfo + __nvmlDeviceGetVgpuInstancesUtilizationInfo = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetVgpuInstancesUtilizationInfo') + if __nvmlDeviceGetVgpuInstancesUtilizationInfo == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetVgpuInstancesUtilizationInfo = _cyb_dlsym(handle, 'nvmlDeviceGetVgpuInstancesUtilizationInfo') + + global __nvmlDeviceGetVgpuProcessUtilization + __nvmlDeviceGetVgpuProcessUtilization = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetVgpuProcessUtilization') + if __nvmlDeviceGetVgpuProcessUtilization == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetVgpuProcessUtilization = _cyb_dlsym(handle, 'nvmlDeviceGetVgpuProcessUtilization') + + global __nvmlDeviceGetVgpuProcessesUtilizationInfo + __nvmlDeviceGetVgpuProcessesUtilizationInfo = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetVgpuProcessesUtilizationInfo') + if __nvmlDeviceGetVgpuProcessesUtilizationInfo == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetVgpuProcessesUtilizationInfo = _cyb_dlsym(handle, 'nvmlDeviceGetVgpuProcessesUtilizationInfo') + + global __nvmlVgpuInstanceGetAccountingMode + __nvmlVgpuInstanceGetAccountingMode = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlVgpuInstanceGetAccountingMode') + if __nvmlVgpuInstanceGetAccountingMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuInstanceGetAccountingMode = _cyb_dlsym(handle, 'nvmlVgpuInstanceGetAccountingMode') + + global __nvmlVgpuInstanceGetAccountingPids + __nvmlVgpuInstanceGetAccountingPids = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlVgpuInstanceGetAccountingPids') + if __nvmlVgpuInstanceGetAccountingPids == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuInstanceGetAccountingPids = _cyb_dlsym(handle, 'nvmlVgpuInstanceGetAccountingPids') + + global __nvmlVgpuInstanceGetAccountingStats + __nvmlVgpuInstanceGetAccountingStats = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlVgpuInstanceGetAccountingStats') + if __nvmlVgpuInstanceGetAccountingStats == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuInstanceGetAccountingStats = _cyb_dlsym(handle, 'nvmlVgpuInstanceGetAccountingStats') + + global __nvmlVgpuInstanceClearAccountingPids + __nvmlVgpuInstanceClearAccountingPids = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlVgpuInstanceClearAccountingPids') + if __nvmlVgpuInstanceClearAccountingPids == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuInstanceClearAccountingPids = _cyb_dlsym(handle, 'nvmlVgpuInstanceClearAccountingPids') + + global __nvmlVgpuInstanceGetLicenseInfo_v2 + __nvmlVgpuInstanceGetLicenseInfo_v2 = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlVgpuInstanceGetLicenseInfo_v2') + if __nvmlVgpuInstanceGetLicenseInfo_v2 == NULL: + if handle == NULL: + handle = load_library() + __nvmlVgpuInstanceGetLicenseInfo_v2 = _cyb_dlsym(handle, 'nvmlVgpuInstanceGetLicenseInfo_v2') + + global __nvmlGetExcludedDeviceCount + __nvmlGetExcludedDeviceCount = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlGetExcludedDeviceCount') + if __nvmlGetExcludedDeviceCount == NULL: + if handle == NULL: + handle = load_library() + __nvmlGetExcludedDeviceCount = _cyb_dlsym(handle, 'nvmlGetExcludedDeviceCount') + + global __nvmlGetExcludedDeviceInfoByIndex + __nvmlGetExcludedDeviceInfoByIndex = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlGetExcludedDeviceInfoByIndex') + if __nvmlGetExcludedDeviceInfoByIndex == NULL: + if handle == NULL: + handle = load_library() + __nvmlGetExcludedDeviceInfoByIndex = _cyb_dlsym(handle, 'nvmlGetExcludedDeviceInfoByIndex') + + global __nvmlDeviceSetMigMode + __nvmlDeviceSetMigMode = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceSetMigMode') + if __nvmlDeviceSetMigMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetMigMode = _cyb_dlsym(handle, 'nvmlDeviceSetMigMode') + + global __nvmlDeviceGetMigMode + __nvmlDeviceGetMigMode = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetMigMode') + if __nvmlDeviceGetMigMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetMigMode = _cyb_dlsym(handle, 'nvmlDeviceGetMigMode') + + global __nvmlDeviceGetGpuInstanceProfileInfoV + __nvmlDeviceGetGpuInstanceProfileInfoV = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetGpuInstanceProfileInfoV') + if __nvmlDeviceGetGpuInstanceProfileInfoV == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetGpuInstanceProfileInfoV = _cyb_dlsym(handle, 'nvmlDeviceGetGpuInstanceProfileInfoV') + + global __nvmlDeviceGetGpuInstancePossiblePlacements_v2 + __nvmlDeviceGetGpuInstancePossiblePlacements_v2 = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetGpuInstancePossiblePlacements_v2') + if __nvmlDeviceGetGpuInstancePossiblePlacements_v2 == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetGpuInstancePossiblePlacements_v2 = _cyb_dlsym(handle, 'nvmlDeviceGetGpuInstancePossiblePlacements_v2') + + global __nvmlDeviceGetGpuInstanceRemainingCapacity + __nvmlDeviceGetGpuInstanceRemainingCapacity = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetGpuInstanceRemainingCapacity') + if __nvmlDeviceGetGpuInstanceRemainingCapacity == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetGpuInstanceRemainingCapacity = _cyb_dlsym(handle, 'nvmlDeviceGetGpuInstanceRemainingCapacity') + + global __nvmlDeviceCreateGpuInstance + __nvmlDeviceCreateGpuInstance = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceCreateGpuInstance') + if __nvmlDeviceCreateGpuInstance == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceCreateGpuInstance = _cyb_dlsym(handle, 'nvmlDeviceCreateGpuInstance') + + global __nvmlDeviceCreateGpuInstanceWithPlacement + __nvmlDeviceCreateGpuInstanceWithPlacement = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceCreateGpuInstanceWithPlacement') + if __nvmlDeviceCreateGpuInstanceWithPlacement == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceCreateGpuInstanceWithPlacement = _cyb_dlsym(handle, 'nvmlDeviceCreateGpuInstanceWithPlacement') + + global __nvmlGpuInstanceDestroy + __nvmlGpuInstanceDestroy = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlGpuInstanceDestroy') + if __nvmlGpuInstanceDestroy == NULL: + if handle == NULL: + handle = load_library() + __nvmlGpuInstanceDestroy = _cyb_dlsym(handle, 'nvmlGpuInstanceDestroy') + + global __nvmlDeviceGetGpuInstances + __nvmlDeviceGetGpuInstances = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetGpuInstances') + if __nvmlDeviceGetGpuInstances == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetGpuInstances = _cyb_dlsym(handle, 'nvmlDeviceGetGpuInstances') + + global __nvmlDeviceGetGpuInstanceById + __nvmlDeviceGetGpuInstanceById = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetGpuInstanceById') + if __nvmlDeviceGetGpuInstanceById == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetGpuInstanceById = _cyb_dlsym(handle, 'nvmlDeviceGetGpuInstanceById') + + global __nvmlGpuInstanceGetInfo + __nvmlGpuInstanceGetInfo = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlGpuInstanceGetInfo') + if __nvmlGpuInstanceGetInfo == NULL: + if handle == NULL: + handle = load_library() + __nvmlGpuInstanceGetInfo = _cyb_dlsym(handle, 'nvmlGpuInstanceGetInfo') + + global __nvmlGpuInstanceGetComputeInstanceProfileInfoV + __nvmlGpuInstanceGetComputeInstanceProfileInfoV = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlGpuInstanceGetComputeInstanceProfileInfoV') + if __nvmlGpuInstanceGetComputeInstanceProfileInfoV == NULL: + if handle == NULL: + handle = load_library() + __nvmlGpuInstanceGetComputeInstanceProfileInfoV = _cyb_dlsym(handle, 'nvmlGpuInstanceGetComputeInstanceProfileInfoV') + + global __nvmlGpuInstanceGetComputeInstanceRemainingCapacity + __nvmlGpuInstanceGetComputeInstanceRemainingCapacity = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlGpuInstanceGetComputeInstanceRemainingCapacity') + if __nvmlGpuInstanceGetComputeInstanceRemainingCapacity == NULL: + if handle == NULL: + handle = load_library() + __nvmlGpuInstanceGetComputeInstanceRemainingCapacity = _cyb_dlsym(handle, 'nvmlGpuInstanceGetComputeInstanceRemainingCapacity') + + global __nvmlGpuInstanceGetComputeInstancePossiblePlacements + __nvmlGpuInstanceGetComputeInstancePossiblePlacements = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlGpuInstanceGetComputeInstancePossiblePlacements') + if __nvmlGpuInstanceGetComputeInstancePossiblePlacements == NULL: + if handle == NULL: + handle = load_library() + __nvmlGpuInstanceGetComputeInstancePossiblePlacements = _cyb_dlsym(handle, 'nvmlGpuInstanceGetComputeInstancePossiblePlacements') + + global __nvmlGpuInstanceCreateComputeInstance + __nvmlGpuInstanceCreateComputeInstance = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlGpuInstanceCreateComputeInstance') + if __nvmlGpuInstanceCreateComputeInstance == NULL: + if handle == NULL: + handle = load_library() + __nvmlGpuInstanceCreateComputeInstance = _cyb_dlsym(handle, 'nvmlGpuInstanceCreateComputeInstance') + + global __nvmlGpuInstanceCreateComputeInstanceWithPlacement + __nvmlGpuInstanceCreateComputeInstanceWithPlacement = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlGpuInstanceCreateComputeInstanceWithPlacement') + if __nvmlGpuInstanceCreateComputeInstanceWithPlacement == NULL: + if handle == NULL: + handle = load_library() + __nvmlGpuInstanceCreateComputeInstanceWithPlacement = _cyb_dlsym(handle, 'nvmlGpuInstanceCreateComputeInstanceWithPlacement') + + global __nvmlComputeInstanceDestroy + __nvmlComputeInstanceDestroy = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlComputeInstanceDestroy') + if __nvmlComputeInstanceDestroy == NULL: + if handle == NULL: + handle = load_library() + __nvmlComputeInstanceDestroy = _cyb_dlsym(handle, 'nvmlComputeInstanceDestroy') + + global __nvmlGpuInstanceGetComputeInstances + __nvmlGpuInstanceGetComputeInstances = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlGpuInstanceGetComputeInstances') + if __nvmlGpuInstanceGetComputeInstances == NULL: + if handle == NULL: + handle = load_library() + __nvmlGpuInstanceGetComputeInstances = _cyb_dlsym(handle, 'nvmlGpuInstanceGetComputeInstances') + + global __nvmlGpuInstanceGetComputeInstanceById + __nvmlGpuInstanceGetComputeInstanceById = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlGpuInstanceGetComputeInstanceById') + if __nvmlGpuInstanceGetComputeInstanceById == NULL: + if handle == NULL: + handle = load_library() + __nvmlGpuInstanceGetComputeInstanceById = _cyb_dlsym(handle, 'nvmlGpuInstanceGetComputeInstanceById') + + global __nvmlComputeInstanceGetInfo_v2 + __nvmlComputeInstanceGetInfo_v2 = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlComputeInstanceGetInfo_v2') + if __nvmlComputeInstanceGetInfo_v2 == NULL: + if handle == NULL: + handle = load_library() + __nvmlComputeInstanceGetInfo_v2 = _cyb_dlsym(handle, 'nvmlComputeInstanceGetInfo_v2') + + global __nvmlDeviceIsMigDeviceHandle + __nvmlDeviceIsMigDeviceHandle = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceIsMigDeviceHandle') + if __nvmlDeviceIsMigDeviceHandle == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceIsMigDeviceHandle = _cyb_dlsym(handle, 'nvmlDeviceIsMigDeviceHandle') + + global __nvmlDeviceGetGpuInstanceId + __nvmlDeviceGetGpuInstanceId = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetGpuInstanceId') + if __nvmlDeviceGetGpuInstanceId == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetGpuInstanceId = _cyb_dlsym(handle, 'nvmlDeviceGetGpuInstanceId') + + global __nvmlDeviceGetComputeInstanceId + __nvmlDeviceGetComputeInstanceId = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetComputeInstanceId') + if __nvmlDeviceGetComputeInstanceId == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetComputeInstanceId = _cyb_dlsym(handle, 'nvmlDeviceGetComputeInstanceId') + + global __nvmlDeviceGetMaxMigDeviceCount + __nvmlDeviceGetMaxMigDeviceCount = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetMaxMigDeviceCount') + if __nvmlDeviceGetMaxMigDeviceCount == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetMaxMigDeviceCount = _cyb_dlsym(handle, 'nvmlDeviceGetMaxMigDeviceCount') + + global __nvmlDeviceGetMigDeviceHandleByIndex + __nvmlDeviceGetMigDeviceHandleByIndex = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetMigDeviceHandleByIndex') + if __nvmlDeviceGetMigDeviceHandleByIndex == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetMigDeviceHandleByIndex = _cyb_dlsym(handle, 'nvmlDeviceGetMigDeviceHandleByIndex') + + global __nvmlDeviceGetDeviceHandleFromMigDeviceHandle + __nvmlDeviceGetDeviceHandleFromMigDeviceHandle = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetDeviceHandleFromMigDeviceHandle') + if __nvmlDeviceGetDeviceHandleFromMigDeviceHandle == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetDeviceHandleFromMigDeviceHandle = _cyb_dlsym(handle, 'nvmlDeviceGetDeviceHandleFromMigDeviceHandle') + + global __nvmlDeviceGetCapabilities + __nvmlDeviceGetCapabilities = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetCapabilities') + if __nvmlDeviceGetCapabilities == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetCapabilities = _cyb_dlsym(handle, 'nvmlDeviceGetCapabilities') + + global __nvmlDevicePowerSmoothingActivatePresetProfile + __nvmlDevicePowerSmoothingActivatePresetProfile = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDevicePowerSmoothingActivatePresetProfile') + if __nvmlDevicePowerSmoothingActivatePresetProfile == NULL: + if handle == NULL: + handle = load_library() + __nvmlDevicePowerSmoothingActivatePresetProfile = _cyb_dlsym(handle, 'nvmlDevicePowerSmoothingActivatePresetProfile') + + global __nvmlDevicePowerSmoothingUpdatePresetProfileParam + __nvmlDevicePowerSmoothingUpdatePresetProfileParam = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDevicePowerSmoothingUpdatePresetProfileParam') + if __nvmlDevicePowerSmoothingUpdatePresetProfileParam == NULL: + if handle == NULL: + handle = load_library() + __nvmlDevicePowerSmoothingUpdatePresetProfileParam = _cyb_dlsym(handle, 'nvmlDevicePowerSmoothingUpdatePresetProfileParam') + + global __nvmlDevicePowerSmoothingSetState + __nvmlDevicePowerSmoothingSetState = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDevicePowerSmoothingSetState') + if __nvmlDevicePowerSmoothingSetState == NULL: + if handle == NULL: + handle = load_library() + __nvmlDevicePowerSmoothingSetState = _cyb_dlsym(handle, 'nvmlDevicePowerSmoothingSetState') + + global __nvmlDeviceGetAddressingMode + __nvmlDeviceGetAddressingMode = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetAddressingMode') + if __nvmlDeviceGetAddressingMode == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetAddressingMode = _cyb_dlsym(handle, 'nvmlDeviceGetAddressingMode') + + global __nvmlDeviceGetRepairStatus + __nvmlDeviceGetRepairStatus = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetRepairStatus') + if __nvmlDeviceGetRepairStatus == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetRepairStatus = _cyb_dlsym(handle, 'nvmlDeviceGetRepairStatus') + + global __nvmlDeviceGetPowerMizerMode_v1 + __nvmlDeviceGetPowerMizerMode_v1 = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetPowerMizerMode_v1') + if __nvmlDeviceGetPowerMizerMode_v1 == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetPowerMizerMode_v1 = _cyb_dlsym(handle, 'nvmlDeviceGetPowerMizerMode_v1') + + global __nvmlDeviceSetPowerMizerMode_v1 + __nvmlDeviceSetPowerMizerMode_v1 = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceSetPowerMizerMode_v1') + if __nvmlDeviceSetPowerMizerMode_v1 == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetPowerMizerMode_v1 = _cyb_dlsym(handle, 'nvmlDeviceSetPowerMizerMode_v1') + + global __nvmlDeviceGetPdi + __nvmlDeviceGetPdi = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetPdi') + if __nvmlDeviceGetPdi == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetPdi = _cyb_dlsym(handle, 'nvmlDeviceGetPdi') + + global __nvmlDeviceSetHostname_v1 + __nvmlDeviceSetHostname_v1 = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceSetHostname_v1') + if __nvmlDeviceSetHostname_v1 == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetHostname_v1 = _cyb_dlsym(handle, 'nvmlDeviceSetHostname_v1') + + global __nvmlDeviceGetHostname_v1 + __nvmlDeviceGetHostname_v1 = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetHostname_v1') + if __nvmlDeviceGetHostname_v1 == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetHostname_v1 = _cyb_dlsym(handle, 'nvmlDeviceGetHostname_v1') + + global __nvmlDeviceGetNvLinkInfo + __nvmlDeviceGetNvLinkInfo = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetNvLinkInfo') + if __nvmlDeviceGetNvLinkInfo == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetNvLinkInfo = _cyb_dlsym(handle, 'nvmlDeviceGetNvLinkInfo') + + global __nvmlDeviceReadWritePRM_v1 + __nvmlDeviceReadWritePRM_v1 = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceReadWritePRM_v1') + if __nvmlDeviceReadWritePRM_v1 == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceReadWritePRM_v1 = _cyb_dlsym(handle, 'nvmlDeviceReadWritePRM_v1') + + global __nvmlDeviceGetGpuInstanceProfileInfoByIdV + __nvmlDeviceGetGpuInstanceProfileInfoByIdV = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetGpuInstanceProfileInfoByIdV') + if __nvmlDeviceGetGpuInstanceProfileInfoByIdV == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetGpuInstanceProfileInfoByIdV = _cyb_dlsym(handle, 'nvmlDeviceGetGpuInstanceProfileInfoByIdV') + + global __nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts + __nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts') + if __nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts = _cyb_dlsym(handle, 'nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts') + + global __nvmlDeviceGetUnrepairableMemoryFlag_v1 + __nvmlDeviceGetUnrepairableMemoryFlag_v1 = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetUnrepairableMemoryFlag_v1') + if __nvmlDeviceGetUnrepairableMemoryFlag_v1 == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetUnrepairableMemoryFlag_v1 = _cyb_dlsym(handle, 'nvmlDeviceGetUnrepairableMemoryFlag_v1') + + global __nvmlDeviceReadPRMCounters_v1 + __nvmlDeviceReadPRMCounters_v1 = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceReadPRMCounters_v1') + if __nvmlDeviceReadPRMCounters_v1 == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceReadPRMCounters_v1 = _cyb_dlsym(handle, 'nvmlDeviceReadPRMCounters_v1') + + global __nvmlDeviceSetRusdSettings_v1 + __nvmlDeviceSetRusdSettings_v1 = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceSetRusdSettings_v1') + if __nvmlDeviceSetRusdSettings_v1 == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetRusdSettings_v1 = _cyb_dlsym(handle, 'nvmlDeviceSetRusdSettings_v1') + + global __nvmlDeviceVgpuForceGspUnload + __nvmlDeviceVgpuForceGspUnload = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceVgpuForceGspUnload') + if __nvmlDeviceVgpuForceGspUnload == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceVgpuForceGspUnload = _cyb_dlsym(handle, 'nvmlDeviceVgpuForceGspUnload') + + global __nvmlDeviceGetVgpuSchedulerState_v2 + __nvmlDeviceGetVgpuSchedulerState_v2 = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetVgpuSchedulerState_v2') + if __nvmlDeviceGetVgpuSchedulerState_v2 == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetVgpuSchedulerState_v2 = _cyb_dlsym(handle, 'nvmlDeviceGetVgpuSchedulerState_v2') + + global __nvmlGpuInstanceGetVgpuSchedulerState_v2 + __nvmlGpuInstanceGetVgpuSchedulerState_v2 = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlGpuInstanceGetVgpuSchedulerState_v2') + if __nvmlGpuInstanceGetVgpuSchedulerState_v2 == NULL: + if handle == NULL: + handle = load_library() + __nvmlGpuInstanceGetVgpuSchedulerState_v2 = _cyb_dlsym(handle, 'nvmlGpuInstanceGetVgpuSchedulerState_v2') + + global __nvmlDeviceGetVgpuSchedulerLog_v2 + __nvmlDeviceGetVgpuSchedulerLog_v2 = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceGetVgpuSchedulerLog_v2') + if __nvmlDeviceGetVgpuSchedulerLog_v2 == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceGetVgpuSchedulerLog_v2 = _cyb_dlsym(handle, 'nvmlDeviceGetVgpuSchedulerLog_v2') + + global __nvmlGpuInstanceGetVgpuSchedulerLog_v2 + __nvmlGpuInstanceGetVgpuSchedulerLog_v2 = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlGpuInstanceGetVgpuSchedulerLog_v2') + if __nvmlGpuInstanceGetVgpuSchedulerLog_v2 == NULL: + if handle == NULL: + handle = load_library() + __nvmlGpuInstanceGetVgpuSchedulerLog_v2 = _cyb_dlsym(handle, 'nvmlGpuInstanceGetVgpuSchedulerLog_v2') + + global __nvmlDeviceSetVgpuSchedulerState_v2 + __nvmlDeviceSetVgpuSchedulerState_v2 = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlDeviceSetVgpuSchedulerState_v2') + if __nvmlDeviceSetVgpuSchedulerState_v2 == NULL: + if handle == NULL: + handle = load_library() + __nvmlDeviceSetVgpuSchedulerState_v2 = _cyb_dlsym(handle, 'nvmlDeviceSetVgpuSchedulerState_v2') + + global __nvmlGpuInstanceSetVgpuSchedulerState_v2 + __nvmlGpuInstanceSetVgpuSchedulerState_v2 = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvmlGpuInstanceSetVgpuSchedulerState_v2') + if __nvmlGpuInstanceSetVgpuSchedulerState_v2 == NULL: + if handle == NULL: + handle = load_library() + __nvmlGpuInstanceSetVgpuSchedulerState_v2 = _cyb_dlsym(handle, 'nvmlGpuInstanceSetVgpuSchedulerState_v2') + + _cyb___py_nvml_init = True + return 0 + +cdef inline int _check_or_init_nvml() except -1 nogil: + if _cyb___py_nvml_init: + return 0 + + return _init_nvml() + + +cpdef dict _inspect_function_pointers(): + global _cyb_func_ptrs + if _cyb_func_ptrs is not None: + return _cyb_func_ptrs + + _check_or_init_nvml() + cdef dict data = {} + global __nvmlInit_v2 + data["__nvmlInit_v2"] = <_cyb_intptr_t>__nvmlInit_v2 + + global __nvmlInitWithFlags + data["__nvmlInitWithFlags"] = <_cyb_intptr_t>__nvmlInitWithFlags + + global __nvmlShutdown + data["__nvmlShutdown"] = <_cyb_intptr_t>__nvmlShutdown + + global __nvmlErrorString + data["__nvmlErrorString"] = <_cyb_intptr_t>__nvmlErrorString + + global __nvmlSystemGetDriverVersion + data["__nvmlSystemGetDriverVersion"] = <_cyb_intptr_t>__nvmlSystemGetDriverVersion + + global __nvmlSystemGetNVMLVersion + data["__nvmlSystemGetNVMLVersion"] = <_cyb_intptr_t>__nvmlSystemGetNVMLVersion + + global __nvmlSystemGetCudaDriverVersion + data["__nvmlSystemGetCudaDriverVersion"] = <_cyb_intptr_t>__nvmlSystemGetCudaDriverVersion + + global __nvmlSystemGetCudaDriverVersion_v2 + data["__nvmlSystemGetCudaDriverVersion_v2"] = <_cyb_intptr_t>__nvmlSystemGetCudaDriverVersion_v2 + + global __nvmlSystemGetProcessName + data["__nvmlSystemGetProcessName"] = <_cyb_intptr_t>__nvmlSystemGetProcessName + + global __nvmlSystemGetHicVersion + data["__nvmlSystemGetHicVersion"] = <_cyb_intptr_t>__nvmlSystemGetHicVersion + + global __nvmlSystemGetTopologyGpuSet + data["__nvmlSystemGetTopologyGpuSet"] = <_cyb_intptr_t>__nvmlSystemGetTopologyGpuSet + + global __nvmlSystemGetDriverBranch + data["__nvmlSystemGetDriverBranch"] = <_cyb_intptr_t>__nvmlSystemGetDriverBranch + + global __nvmlUnitGetCount + data["__nvmlUnitGetCount"] = <_cyb_intptr_t>__nvmlUnitGetCount + + global __nvmlUnitGetHandleByIndex + data["__nvmlUnitGetHandleByIndex"] = <_cyb_intptr_t>__nvmlUnitGetHandleByIndex + + global __nvmlUnitGetUnitInfo + data["__nvmlUnitGetUnitInfo"] = <_cyb_intptr_t>__nvmlUnitGetUnitInfo + + global __nvmlUnitGetLedState + data["__nvmlUnitGetLedState"] = <_cyb_intptr_t>__nvmlUnitGetLedState + + global __nvmlUnitGetPsuInfo + data["__nvmlUnitGetPsuInfo"] = <_cyb_intptr_t>__nvmlUnitGetPsuInfo + + global __nvmlUnitGetTemperature + data["__nvmlUnitGetTemperature"] = <_cyb_intptr_t>__nvmlUnitGetTemperature + + global __nvmlUnitGetFanSpeedInfo + data["__nvmlUnitGetFanSpeedInfo"] = <_cyb_intptr_t>__nvmlUnitGetFanSpeedInfo + + global __nvmlUnitGetDevices + data["__nvmlUnitGetDevices"] = <_cyb_intptr_t>__nvmlUnitGetDevices + + global __nvmlDeviceGetCount_v2 + data["__nvmlDeviceGetCount_v2"] = <_cyb_intptr_t>__nvmlDeviceGetCount_v2 + + global __nvmlDeviceGetAttributes_v2 + data["__nvmlDeviceGetAttributes_v2"] = <_cyb_intptr_t>__nvmlDeviceGetAttributes_v2 + + global __nvmlDeviceGetHandleByIndex_v2 + data["__nvmlDeviceGetHandleByIndex_v2"] = <_cyb_intptr_t>__nvmlDeviceGetHandleByIndex_v2 + + global __nvmlDeviceGetHandleBySerial + data["__nvmlDeviceGetHandleBySerial"] = <_cyb_intptr_t>__nvmlDeviceGetHandleBySerial + + global __nvmlDeviceGetHandleByUUID + data["__nvmlDeviceGetHandleByUUID"] = <_cyb_intptr_t>__nvmlDeviceGetHandleByUUID + + global __nvmlDeviceGetHandleByUUIDV + data["__nvmlDeviceGetHandleByUUIDV"] = <_cyb_intptr_t>__nvmlDeviceGetHandleByUUIDV + + global __nvmlDeviceGetHandleByPciBusId_v2 + data["__nvmlDeviceGetHandleByPciBusId_v2"] = <_cyb_intptr_t>__nvmlDeviceGetHandleByPciBusId_v2 + + global __nvmlDeviceGetName + data["__nvmlDeviceGetName"] = <_cyb_intptr_t>__nvmlDeviceGetName + + global __nvmlDeviceGetBrand + data["__nvmlDeviceGetBrand"] = <_cyb_intptr_t>__nvmlDeviceGetBrand + + global __nvmlDeviceGetIndex + data["__nvmlDeviceGetIndex"] = <_cyb_intptr_t>__nvmlDeviceGetIndex + + global __nvmlDeviceGetSerial + data["__nvmlDeviceGetSerial"] = <_cyb_intptr_t>__nvmlDeviceGetSerial + + global __nvmlDeviceGetModuleId + data["__nvmlDeviceGetModuleId"] = <_cyb_intptr_t>__nvmlDeviceGetModuleId + + global __nvmlDeviceGetC2cModeInfoV + data["__nvmlDeviceGetC2cModeInfoV"] = <_cyb_intptr_t>__nvmlDeviceGetC2cModeInfoV + + global __nvmlDeviceGetMemoryAffinity + data["__nvmlDeviceGetMemoryAffinity"] = <_cyb_intptr_t>__nvmlDeviceGetMemoryAffinity + + global __nvmlDeviceGetCpuAffinityWithinScope + data["__nvmlDeviceGetCpuAffinityWithinScope"] = <_cyb_intptr_t>__nvmlDeviceGetCpuAffinityWithinScope + + global __nvmlDeviceGetCpuAffinity + data["__nvmlDeviceGetCpuAffinity"] = <_cyb_intptr_t>__nvmlDeviceGetCpuAffinity + + global __nvmlDeviceSetCpuAffinity + data["__nvmlDeviceSetCpuAffinity"] = <_cyb_intptr_t>__nvmlDeviceSetCpuAffinity + + global __nvmlDeviceClearCpuAffinity + data["__nvmlDeviceClearCpuAffinity"] = <_cyb_intptr_t>__nvmlDeviceClearCpuAffinity + + global __nvmlDeviceGetNumaNodeId + data["__nvmlDeviceGetNumaNodeId"] = <_cyb_intptr_t>__nvmlDeviceGetNumaNodeId + + global __nvmlDeviceGetTopologyCommonAncestor + data["__nvmlDeviceGetTopologyCommonAncestor"] = <_cyb_intptr_t>__nvmlDeviceGetTopologyCommonAncestor + + global __nvmlDeviceGetTopologyNearestGpus + data["__nvmlDeviceGetTopologyNearestGpus"] = <_cyb_intptr_t>__nvmlDeviceGetTopologyNearestGpus + + global __nvmlDeviceGetP2PStatus + data["__nvmlDeviceGetP2PStatus"] = <_cyb_intptr_t>__nvmlDeviceGetP2PStatus + + global __nvmlDeviceGetUUID + data["__nvmlDeviceGetUUID"] = <_cyb_intptr_t>__nvmlDeviceGetUUID + + global __nvmlDeviceGetMinorNumber + data["__nvmlDeviceGetMinorNumber"] = <_cyb_intptr_t>__nvmlDeviceGetMinorNumber + + global __nvmlDeviceGetBoardPartNumber + data["__nvmlDeviceGetBoardPartNumber"] = <_cyb_intptr_t>__nvmlDeviceGetBoardPartNumber + + global __nvmlDeviceGetInforomVersion + data["__nvmlDeviceGetInforomVersion"] = <_cyb_intptr_t>__nvmlDeviceGetInforomVersion + + global __nvmlDeviceGetInforomImageVersion + data["__nvmlDeviceGetInforomImageVersion"] = <_cyb_intptr_t>__nvmlDeviceGetInforomImageVersion + + global __nvmlDeviceGetInforomConfigurationChecksum + data["__nvmlDeviceGetInforomConfigurationChecksum"] = <_cyb_intptr_t>__nvmlDeviceGetInforomConfigurationChecksum + + global __nvmlDeviceValidateInforom + data["__nvmlDeviceValidateInforom"] = <_cyb_intptr_t>__nvmlDeviceValidateInforom + + global __nvmlDeviceGetLastBBXFlushTime + data["__nvmlDeviceGetLastBBXFlushTime"] = <_cyb_intptr_t>__nvmlDeviceGetLastBBXFlushTime + + global __nvmlDeviceGetDisplayMode + data["__nvmlDeviceGetDisplayMode"] = <_cyb_intptr_t>__nvmlDeviceGetDisplayMode + + global __nvmlDeviceGetDisplayActive + data["__nvmlDeviceGetDisplayActive"] = <_cyb_intptr_t>__nvmlDeviceGetDisplayActive + + global __nvmlDeviceGetPersistenceMode + data["__nvmlDeviceGetPersistenceMode"] = <_cyb_intptr_t>__nvmlDeviceGetPersistenceMode + + global __nvmlDeviceGetPciInfoExt + data["__nvmlDeviceGetPciInfoExt"] = <_cyb_intptr_t>__nvmlDeviceGetPciInfoExt + + global __nvmlDeviceGetPciInfo_v3 + data["__nvmlDeviceGetPciInfo_v3"] = <_cyb_intptr_t>__nvmlDeviceGetPciInfo_v3 + + global __nvmlDeviceGetMaxPcieLinkGeneration + data["__nvmlDeviceGetMaxPcieLinkGeneration"] = <_cyb_intptr_t>__nvmlDeviceGetMaxPcieLinkGeneration + + global __nvmlDeviceGetGpuMaxPcieLinkGeneration + data["__nvmlDeviceGetGpuMaxPcieLinkGeneration"] = <_cyb_intptr_t>__nvmlDeviceGetGpuMaxPcieLinkGeneration + + global __nvmlDeviceGetMaxPcieLinkWidth + data["__nvmlDeviceGetMaxPcieLinkWidth"] = <_cyb_intptr_t>__nvmlDeviceGetMaxPcieLinkWidth + + global __nvmlDeviceGetCurrPcieLinkGeneration + data["__nvmlDeviceGetCurrPcieLinkGeneration"] = <_cyb_intptr_t>__nvmlDeviceGetCurrPcieLinkGeneration + + global __nvmlDeviceGetCurrPcieLinkWidth + data["__nvmlDeviceGetCurrPcieLinkWidth"] = <_cyb_intptr_t>__nvmlDeviceGetCurrPcieLinkWidth + + global __nvmlDeviceGetPcieThroughput + data["__nvmlDeviceGetPcieThroughput"] = <_cyb_intptr_t>__nvmlDeviceGetPcieThroughput + + global __nvmlDeviceGetPcieReplayCounter + data["__nvmlDeviceGetPcieReplayCounter"] = <_cyb_intptr_t>__nvmlDeviceGetPcieReplayCounter + + global __nvmlDeviceGetClockInfo + data["__nvmlDeviceGetClockInfo"] = <_cyb_intptr_t>__nvmlDeviceGetClockInfo + + global __nvmlDeviceGetMaxClockInfo + data["__nvmlDeviceGetMaxClockInfo"] = <_cyb_intptr_t>__nvmlDeviceGetMaxClockInfo + + global __nvmlDeviceGetGpcClkVfOffset + data["__nvmlDeviceGetGpcClkVfOffset"] = <_cyb_intptr_t>__nvmlDeviceGetGpcClkVfOffset + + global __nvmlDeviceGetClock + data["__nvmlDeviceGetClock"] = <_cyb_intptr_t>__nvmlDeviceGetClock + + global __nvmlDeviceGetMaxCustomerBoostClock + data["__nvmlDeviceGetMaxCustomerBoostClock"] = <_cyb_intptr_t>__nvmlDeviceGetMaxCustomerBoostClock + + global __nvmlDeviceGetSupportedMemoryClocks + data["__nvmlDeviceGetSupportedMemoryClocks"] = <_cyb_intptr_t>__nvmlDeviceGetSupportedMemoryClocks + + global __nvmlDeviceGetSupportedGraphicsClocks + data["__nvmlDeviceGetSupportedGraphicsClocks"] = <_cyb_intptr_t>__nvmlDeviceGetSupportedGraphicsClocks + + global __nvmlDeviceGetAutoBoostedClocksEnabled + data["__nvmlDeviceGetAutoBoostedClocksEnabled"] = <_cyb_intptr_t>__nvmlDeviceGetAutoBoostedClocksEnabled + + global __nvmlDeviceGetFanSpeed + data["__nvmlDeviceGetFanSpeed"] = <_cyb_intptr_t>__nvmlDeviceGetFanSpeed + + global __nvmlDeviceGetFanSpeed_v2 + data["__nvmlDeviceGetFanSpeed_v2"] = <_cyb_intptr_t>__nvmlDeviceGetFanSpeed_v2 + + global __nvmlDeviceGetFanSpeedRPM + data["__nvmlDeviceGetFanSpeedRPM"] = <_cyb_intptr_t>__nvmlDeviceGetFanSpeedRPM + + global __nvmlDeviceGetTargetFanSpeed + data["__nvmlDeviceGetTargetFanSpeed"] = <_cyb_intptr_t>__nvmlDeviceGetTargetFanSpeed + + global __nvmlDeviceGetMinMaxFanSpeed + data["__nvmlDeviceGetMinMaxFanSpeed"] = <_cyb_intptr_t>__nvmlDeviceGetMinMaxFanSpeed + + global __nvmlDeviceGetFanControlPolicy_v2 + data["__nvmlDeviceGetFanControlPolicy_v2"] = <_cyb_intptr_t>__nvmlDeviceGetFanControlPolicy_v2 + + global __nvmlDeviceGetNumFans + data["__nvmlDeviceGetNumFans"] = <_cyb_intptr_t>__nvmlDeviceGetNumFans + + global __nvmlDeviceGetCoolerInfo + data["__nvmlDeviceGetCoolerInfo"] = <_cyb_intptr_t>__nvmlDeviceGetCoolerInfo + + global __nvmlDeviceGetTemperatureV + data["__nvmlDeviceGetTemperatureV"] = <_cyb_intptr_t>__nvmlDeviceGetTemperatureV + + global __nvmlDeviceGetTemperatureThreshold + data["__nvmlDeviceGetTemperatureThreshold"] = <_cyb_intptr_t>__nvmlDeviceGetTemperatureThreshold + + global __nvmlDeviceGetMarginTemperature + data["__nvmlDeviceGetMarginTemperature"] = <_cyb_intptr_t>__nvmlDeviceGetMarginTemperature + + global __nvmlDeviceGetThermalSettings + data["__nvmlDeviceGetThermalSettings"] = <_cyb_intptr_t>__nvmlDeviceGetThermalSettings + + global __nvmlDeviceGetPerformanceState + data["__nvmlDeviceGetPerformanceState"] = <_cyb_intptr_t>__nvmlDeviceGetPerformanceState + + global __nvmlDeviceGetCurrentClocksEventReasons + data["__nvmlDeviceGetCurrentClocksEventReasons"] = <_cyb_intptr_t>__nvmlDeviceGetCurrentClocksEventReasons + + global __nvmlDeviceGetSupportedClocksEventReasons + data["__nvmlDeviceGetSupportedClocksEventReasons"] = <_cyb_intptr_t>__nvmlDeviceGetSupportedClocksEventReasons + + global __nvmlDeviceGetPowerState + data["__nvmlDeviceGetPowerState"] = <_cyb_intptr_t>__nvmlDeviceGetPowerState + + global __nvmlDeviceGetDynamicPstatesInfo + data["__nvmlDeviceGetDynamicPstatesInfo"] = <_cyb_intptr_t>__nvmlDeviceGetDynamicPstatesInfo + + global __nvmlDeviceGetMemClkVfOffset + data["__nvmlDeviceGetMemClkVfOffset"] = <_cyb_intptr_t>__nvmlDeviceGetMemClkVfOffset + + global __nvmlDeviceGetMinMaxClockOfPState + data["__nvmlDeviceGetMinMaxClockOfPState"] = <_cyb_intptr_t>__nvmlDeviceGetMinMaxClockOfPState + + global __nvmlDeviceGetSupportedPerformanceStates + data["__nvmlDeviceGetSupportedPerformanceStates"] = <_cyb_intptr_t>__nvmlDeviceGetSupportedPerformanceStates + + global __nvmlDeviceGetGpcClkMinMaxVfOffset + data["__nvmlDeviceGetGpcClkMinMaxVfOffset"] = <_cyb_intptr_t>__nvmlDeviceGetGpcClkMinMaxVfOffset + + global __nvmlDeviceGetMemClkMinMaxVfOffset + data["__nvmlDeviceGetMemClkMinMaxVfOffset"] = <_cyb_intptr_t>__nvmlDeviceGetMemClkMinMaxVfOffset + + global __nvmlDeviceGetClockOffsets + data["__nvmlDeviceGetClockOffsets"] = <_cyb_intptr_t>__nvmlDeviceGetClockOffsets + + global __nvmlDeviceSetClockOffsets + data["__nvmlDeviceSetClockOffsets"] = <_cyb_intptr_t>__nvmlDeviceSetClockOffsets + + global __nvmlDeviceGetPerformanceModes + data["__nvmlDeviceGetPerformanceModes"] = <_cyb_intptr_t>__nvmlDeviceGetPerformanceModes + + global __nvmlDeviceGetCurrentClockFreqs + data["__nvmlDeviceGetCurrentClockFreqs"] = <_cyb_intptr_t>__nvmlDeviceGetCurrentClockFreqs + + global __nvmlDeviceGetPowerManagementLimit + data["__nvmlDeviceGetPowerManagementLimit"] = <_cyb_intptr_t>__nvmlDeviceGetPowerManagementLimit + + global __nvmlDeviceGetPowerManagementLimitConstraints + data["__nvmlDeviceGetPowerManagementLimitConstraints"] = <_cyb_intptr_t>__nvmlDeviceGetPowerManagementLimitConstraints + + global __nvmlDeviceGetPowerManagementDefaultLimit + data["__nvmlDeviceGetPowerManagementDefaultLimit"] = <_cyb_intptr_t>__nvmlDeviceGetPowerManagementDefaultLimit + + global __nvmlDeviceGetPowerUsage + data["__nvmlDeviceGetPowerUsage"] = <_cyb_intptr_t>__nvmlDeviceGetPowerUsage + + global __nvmlDeviceGetTotalEnergyConsumption + data["__nvmlDeviceGetTotalEnergyConsumption"] = <_cyb_intptr_t>__nvmlDeviceGetTotalEnergyConsumption + + global __nvmlDeviceGetEnforcedPowerLimit + data["__nvmlDeviceGetEnforcedPowerLimit"] = <_cyb_intptr_t>__nvmlDeviceGetEnforcedPowerLimit + + global __nvmlDeviceGetGpuOperationMode + data["__nvmlDeviceGetGpuOperationMode"] = <_cyb_intptr_t>__nvmlDeviceGetGpuOperationMode + + global __nvmlDeviceGetMemoryInfo_v2 + data["__nvmlDeviceGetMemoryInfo_v2"] = <_cyb_intptr_t>__nvmlDeviceGetMemoryInfo_v2 + + global __nvmlDeviceGetComputeMode + data["__nvmlDeviceGetComputeMode"] = <_cyb_intptr_t>__nvmlDeviceGetComputeMode + + global __nvmlDeviceGetCudaComputeCapability + data["__nvmlDeviceGetCudaComputeCapability"] = <_cyb_intptr_t>__nvmlDeviceGetCudaComputeCapability + + global __nvmlDeviceGetDramEncryptionMode + data["__nvmlDeviceGetDramEncryptionMode"] = <_cyb_intptr_t>__nvmlDeviceGetDramEncryptionMode + + global __nvmlDeviceSetDramEncryptionMode + data["__nvmlDeviceSetDramEncryptionMode"] = <_cyb_intptr_t>__nvmlDeviceSetDramEncryptionMode + + global __nvmlDeviceGetEccMode + data["__nvmlDeviceGetEccMode"] = <_cyb_intptr_t>__nvmlDeviceGetEccMode + + global __nvmlDeviceGetDefaultEccMode + data["__nvmlDeviceGetDefaultEccMode"] = <_cyb_intptr_t>__nvmlDeviceGetDefaultEccMode + + global __nvmlDeviceGetBoardId + data["__nvmlDeviceGetBoardId"] = <_cyb_intptr_t>__nvmlDeviceGetBoardId + + global __nvmlDeviceGetMultiGpuBoard + data["__nvmlDeviceGetMultiGpuBoard"] = <_cyb_intptr_t>__nvmlDeviceGetMultiGpuBoard + + global __nvmlDeviceGetTotalEccErrors + data["__nvmlDeviceGetTotalEccErrors"] = <_cyb_intptr_t>__nvmlDeviceGetTotalEccErrors + + global __nvmlDeviceGetMemoryErrorCounter + data["__nvmlDeviceGetMemoryErrorCounter"] = <_cyb_intptr_t>__nvmlDeviceGetMemoryErrorCounter + + global __nvmlDeviceGetUtilizationRates + data["__nvmlDeviceGetUtilizationRates"] = <_cyb_intptr_t>__nvmlDeviceGetUtilizationRates + + global __nvmlDeviceGetEncoderUtilization + data["__nvmlDeviceGetEncoderUtilization"] = <_cyb_intptr_t>__nvmlDeviceGetEncoderUtilization + + global __nvmlDeviceGetEncoderCapacity + data["__nvmlDeviceGetEncoderCapacity"] = <_cyb_intptr_t>__nvmlDeviceGetEncoderCapacity + + global __nvmlDeviceGetEncoderStats + data["__nvmlDeviceGetEncoderStats"] = <_cyb_intptr_t>__nvmlDeviceGetEncoderStats + + global __nvmlDeviceGetEncoderSessions + data["__nvmlDeviceGetEncoderSessions"] = <_cyb_intptr_t>__nvmlDeviceGetEncoderSessions + + global __nvmlDeviceGetDecoderUtilization + data["__nvmlDeviceGetDecoderUtilization"] = <_cyb_intptr_t>__nvmlDeviceGetDecoderUtilization + + global __nvmlDeviceGetJpgUtilization + data["__nvmlDeviceGetJpgUtilization"] = <_cyb_intptr_t>__nvmlDeviceGetJpgUtilization + + global __nvmlDeviceGetOfaUtilization + data["__nvmlDeviceGetOfaUtilization"] = <_cyb_intptr_t>__nvmlDeviceGetOfaUtilization + + global __nvmlDeviceGetFBCStats + data["__nvmlDeviceGetFBCStats"] = <_cyb_intptr_t>__nvmlDeviceGetFBCStats + + global __nvmlDeviceGetFBCSessions + data["__nvmlDeviceGetFBCSessions"] = <_cyb_intptr_t>__nvmlDeviceGetFBCSessions + + global __nvmlDeviceGetDriverModel_v2 + data["__nvmlDeviceGetDriverModel_v2"] = <_cyb_intptr_t>__nvmlDeviceGetDriverModel_v2 + + global __nvmlDeviceGetVbiosVersion + data["__nvmlDeviceGetVbiosVersion"] = <_cyb_intptr_t>__nvmlDeviceGetVbiosVersion + + global __nvmlDeviceGetBridgeChipInfo + data["__nvmlDeviceGetBridgeChipInfo"] = <_cyb_intptr_t>__nvmlDeviceGetBridgeChipInfo + + global __nvmlDeviceGetComputeRunningProcesses_v3 + data["__nvmlDeviceGetComputeRunningProcesses_v3"] = <_cyb_intptr_t>__nvmlDeviceGetComputeRunningProcesses_v3 + + global __nvmlDeviceGetGraphicsRunningProcesses_v3 + data["__nvmlDeviceGetGraphicsRunningProcesses_v3"] = <_cyb_intptr_t>__nvmlDeviceGetGraphicsRunningProcesses_v3 + + global __nvmlDeviceGetMPSComputeRunningProcesses_v3 + data["__nvmlDeviceGetMPSComputeRunningProcesses_v3"] = <_cyb_intptr_t>__nvmlDeviceGetMPSComputeRunningProcesses_v3 + + global __nvmlDeviceGetRunningProcessDetailList + data["__nvmlDeviceGetRunningProcessDetailList"] = <_cyb_intptr_t>__nvmlDeviceGetRunningProcessDetailList + + global __nvmlDeviceOnSameBoard + data["__nvmlDeviceOnSameBoard"] = <_cyb_intptr_t>__nvmlDeviceOnSameBoard + + global __nvmlDeviceGetAPIRestriction + data["__nvmlDeviceGetAPIRestriction"] = <_cyb_intptr_t>__nvmlDeviceGetAPIRestriction + + global __nvmlDeviceGetSamples + data["__nvmlDeviceGetSamples"] = <_cyb_intptr_t>__nvmlDeviceGetSamples + + global __nvmlDeviceGetBAR1MemoryInfo + data["__nvmlDeviceGetBAR1MemoryInfo"] = <_cyb_intptr_t>__nvmlDeviceGetBAR1MemoryInfo + + global __nvmlDeviceGetIrqNum + data["__nvmlDeviceGetIrqNum"] = <_cyb_intptr_t>__nvmlDeviceGetIrqNum + + global __nvmlDeviceGetNumGpuCores + data["__nvmlDeviceGetNumGpuCores"] = <_cyb_intptr_t>__nvmlDeviceGetNumGpuCores + + global __nvmlDeviceGetPowerSource + data["__nvmlDeviceGetPowerSource"] = <_cyb_intptr_t>__nvmlDeviceGetPowerSource + + global __nvmlDeviceGetMemoryBusWidth + data["__nvmlDeviceGetMemoryBusWidth"] = <_cyb_intptr_t>__nvmlDeviceGetMemoryBusWidth + + global __nvmlDeviceGetPcieLinkMaxSpeed + data["__nvmlDeviceGetPcieLinkMaxSpeed"] = <_cyb_intptr_t>__nvmlDeviceGetPcieLinkMaxSpeed + + global __nvmlDeviceGetPcieSpeed + data["__nvmlDeviceGetPcieSpeed"] = <_cyb_intptr_t>__nvmlDeviceGetPcieSpeed + + global __nvmlDeviceGetAdaptiveClockInfoStatus + data["__nvmlDeviceGetAdaptiveClockInfoStatus"] = <_cyb_intptr_t>__nvmlDeviceGetAdaptiveClockInfoStatus + + global __nvmlDeviceGetBusType + data["__nvmlDeviceGetBusType"] = <_cyb_intptr_t>__nvmlDeviceGetBusType + + global __nvmlDeviceGetGpuFabricInfoV + data["__nvmlDeviceGetGpuFabricInfoV"] = <_cyb_intptr_t>__nvmlDeviceGetGpuFabricInfoV + + global __nvmlSystemGetConfComputeCapabilities + data["__nvmlSystemGetConfComputeCapabilities"] = <_cyb_intptr_t>__nvmlSystemGetConfComputeCapabilities + + global __nvmlSystemGetConfComputeState + data["__nvmlSystemGetConfComputeState"] = <_cyb_intptr_t>__nvmlSystemGetConfComputeState + + global __nvmlDeviceGetConfComputeMemSizeInfo + data["__nvmlDeviceGetConfComputeMemSizeInfo"] = <_cyb_intptr_t>__nvmlDeviceGetConfComputeMemSizeInfo + + global __nvmlSystemGetConfComputeGpusReadyState + data["__nvmlSystemGetConfComputeGpusReadyState"] = <_cyb_intptr_t>__nvmlSystemGetConfComputeGpusReadyState + + global __nvmlDeviceGetConfComputeProtectedMemoryUsage + data["__nvmlDeviceGetConfComputeProtectedMemoryUsage"] = <_cyb_intptr_t>__nvmlDeviceGetConfComputeProtectedMemoryUsage + + global __nvmlDeviceGetConfComputeGpuCertificate + data["__nvmlDeviceGetConfComputeGpuCertificate"] = <_cyb_intptr_t>__nvmlDeviceGetConfComputeGpuCertificate + + global __nvmlDeviceGetConfComputeGpuAttestationReport + data["__nvmlDeviceGetConfComputeGpuAttestationReport"] = <_cyb_intptr_t>__nvmlDeviceGetConfComputeGpuAttestationReport + + global __nvmlSystemGetConfComputeKeyRotationThresholdInfo + data["__nvmlSystemGetConfComputeKeyRotationThresholdInfo"] = <_cyb_intptr_t>__nvmlSystemGetConfComputeKeyRotationThresholdInfo + + global __nvmlDeviceSetConfComputeUnprotectedMemSize + data["__nvmlDeviceSetConfComputeUnprotectedMemSize"] = <_cyb_intptr_t>__nvmlDeviceSetConfComputeUnprotectedMemSize + + global __nvmlSystemSetConfComputeGpusReadyState + data["__nvmlSystemSetConfComputeGpusReadyState"] = <_cyb_intptr_t>__nvmlSystemSetConfComputeGpusReadyState + + global __nvmlSystemSetConfComputeKeyRotationThresholdInfo + data["__nvmlSystemSetConfComputeKeyRotationThresholdInfo"] = <_cyb_intptr_t>__nvmlSystemSetConfComputeKeyRotationThresholdInfo + + global __nvmlSystemGetConfComputeSettings + data["__nvmlSystemGetConfComputeSettings"] = <_cyb_intptr_t>__nvmlSystemGetConfComputeSettings + + global __nvmlDeviceGetGspFirmwareVersion + data["__nvmlDeviceGetGspFirmwareVersion"] = <_cyb_intptr_t>__nvmlDeviceGetGspFirmwareVersion + + global __nvmlDeviceGetGspFirmwareMode + data["__nvmlDeviceGetGspFirmwareMode"] = <_cyb_intptr_t>__nvmlDeviceGetGspFirmwareMode + + global __nvmlDeviceGetSramEccErrorStatus + data["__nvmlDeviceGetSramEccErrorStatus"] = <_cyb_intptr_t>__nvmlDeviceGetSramEccErrorStatus + + global __nvmlDeviceGetAccountingMode + data["__nvmlDeviceGetAccountingMode"] = <_cyb_intptr_t>__nvmlDeviceGetAccountingMode + + global __nvmlDeviceGetAccountingStats + data["__nvmlDeviceGetAccountingStats"] = <_cyb_intptr_t>__nvmlDeviceGetAccountingStats + + global __nvmlDeviceGetAccountingPids + data["__nvmlDeviceGetAccountingPids"] = <_cyb_intptr_t>__nvmlDeviceGetAccountingPids + + global __nvmlDeviceGetAccountingBufferSize + data["__nvmlDeviceGetAccountingBufferSize"] = <_cyb_intptr_t>__nvmlDeviceGetAccountingBufferSize + + global __nvmlDeviceGetRetiredPages + data["__nvmlDeviceGetRetiredPages"] = <_cyb_intptr_t>__nvmlDeviceGetRetiredPages + + global __nvmlDeviceGetRetiredPages_v2 + data["__nvmlDeviceGetRetiredPages_v2"] = <_cyb_intptr_t>__nvmlDeviceGetRetiredPages_v2 + + global __nvmlDeviceGetRetiredPagesPendingStatus + data["__nvmlDeviceGetRetiredPagesPendingStatus"] = <_cyb_intptr_t>__nvmlDeviceGetRetiredPagesPendingStatus + + global __nvmlDeviceGetRemappedRows + data["__nvmlDeviceGetRemappedRows"] = <_cyb_intptr_t>__nvmlDeviceGetRemappedRows + + global __nvmlDeviceGetRowRemapperHistogram + data["__nvmlDeviceGetRowRemapperHistogram"] = <_cyb_intptr_t>__nvmlDeviceGetRowRemapperHistogram + + global __nvmlDeviceGetArchitecture + data["__nvmlDeviceGetArchitecture"] = <_cyb_intptr_t>__nvmlDeviceGetArchitecture + + global __nvmlDeviceGetClkMonStatus + data["__nvmlDeviceGetClkMonStatus"] = <_cyb_intptr_t>__nvmlDeviceGetClkMonStatus + + global __nvmlDeviceGetProcessUtilization + data["__nvmlDeviceGetProcessUtilization"] = <_cyb_intptr_t>__nvmlDeviceGetProcessUtilization + + global __nvmlDeviceGetProcessesUtilizationInfo + data["__nvmlDeviceGetProcessesUtilizationInfo"] = <_cyb_intptr_t>__nvmlDeviceGetProcessesUtilizationInfo + + global __nvmlDeviceGetPlatformInfo + data["__nvmlDeviceGetPlatformInfo"] = <_cyb_intptr_t>__nvmlDeviceGetPlatformInfo + + global __nvmlUnitSetLedState + data["__nvmlUnitSetLedState"] = <_cyb_intptr_t>__nvmlUnitSetLedState + + global __nvmlDeviceSetPersistenceMode + data["__nvmlDeviceSetPersistenceMode"] = <_cyb_intptr_t>__nvmlDeviceSetPersistenceMode + + global __nvmlDeviceSetComputeMode + data["__nvmlDeviceSetComputeMode"] = <_cyb_intptr_t>__nvmlDeviceSetComputeMode + + global __nvmlDeviceSetEccMode + data["__nvmlDeviceSetEccMode"] = <_cyb_intptr_t>__nvmlDeviceSetEccMode + + global __nvmlDeviceClearEccErrorCounts + data["__nvmlDeviceClearEccErrorCounts"] = <_cyb_intptr_t>__nvmlDeviceClearEccErrorCounts + + global __nvmlDeviceSetDriverModel + data["__nvmlDeviceSetDriverModel"] = <_cyb_intptr_t>__nvmlDeviceSetDriverModel + + global __nvmlDeviceSetGpuLockedClocks + data["__nvmlDeviceSetGpuLockedClocks"] = <_cyb_intptr_t>__nvmlDeviceSetGpuLockedClocks + + global __nvmlDeviceResetGpuLockedClocks + data["__nvmlDeviceResetGpuLockedClocks"] = <_cyb_intptr_t>__nvmlDeviceResetGpuLockedClocks + + global __nvmlDeviceSetMemoryLockedClocks + data["__nvmlDeviceSetMemoryLockedClocks"] = <_cyb_intptr_t>__nvmlDeviceSetMemoryLockedClocks + + global __nvmlDeviceResetMemoryLockedClocks + data["__nvmlDeviceResetMemoryLockedClocks"] = <_cyb_intptr_t>__nvmlDeviceResetMemoryLockedClocks + + global __nvmlDeviceSetAutoBoostedClocksEnabled + data["__nvmlDeviceSetAutoBoostedClocksEnabled"] = <_cyb_intptr_t>__nvmlDeviceSetAutoBoostedClocksEnabled + + global __nvmlDeviceSetDefaultAutoBoostedClocksEnabled + data["__nvmlDeviceSetDefaultAutoBoostedClocksEnabled"] = <_cyb_intptr_t>__nvmlDeviceSetDefaultAutoBoostedClocksEnabled + + global __nvmlDeviceSetDefaultFanSpeed_v2 + data["__nvmlDeviceSetDefaultFanSpeed_v2"] = <_cyb_intptr_t>__nvmlDeviceSetDefaultFanSpeed_v2 + + global __nvmlDeviceSetFanControlPolicy + data["__nvmlDeviceSetFanControlPolicy"] = <_cyb_intptr_t>__nvmlDeviceSetFanControlPolicy + + global __nvmlDeviceSetTemperatureThreshold + data["__nvmlDeviceSetTemperatureThreshold"] = <_cyb_intptr_t>__nvmlDeviceSetTemperatureThreshold + + global __nvmlDeviceSetGpuOperationMode + data["__nvmlDeviceSetGpuOperationMode"] = <_cyb_intptr_t>__nvmlDeviceSetGpuOperationMode + + global __nvmlDeviceSetAPIRestriction + data["__nvmlDeviceSetAPIRestriction"] = <_cyb_intptr_t>__nvmlDeviceSetAPIRestriction + + global __nvmlDeviceSetFanSpeed_v2 + data["__nvmlDeviceSetFanSpeed_v2"] = <_cyb_intptr_t>__nvmlDeviceSetFanSpeed_v2 + + global __nvmlDeviceSetAccountingMode + data["__nvmlDeviceSetAccountingMode"] = <_cyb_intptr_t>__nvmlDeviceSetAccountingMode + + global __nvmlDeviceClearAccountingPids + data["__nvmlDeviceClearAccountingPids"] = <_cyb_intptr_t>__nvmlDeviceClearAccountingPids + + global __nvmlDeviceSetPowerManagementLimit_v2 + data["__nvmlDeviceSetPowerManagementLimit_v2"] = <_cyb_intptr_t>__nvmlDeviceSetPowerManagementLimit_v2 + + global __nvmlDeviceGetNvLinkState + data["__nvmlDeviceGetNvLinkState"] = <_cyb_intptr_t>__nvmlDeviceGetNvLinkState + + global __nvmlDeviceGetNvLinkVersion + data["__nvmlDeviceGetNvLinkVersion"] = <_cyb_intptr_t>__nvmlDeviceGetNvLinkVersion + + global __nvmlDeviceGetNvLinkCapability + data["__nvmlDeviceGetNvLinkCapability"] = <_cyb_intptr_t>__nvmlDeviceGetNvLinkCapability + + global __nvmlDeviceGetNvLinkRemotePciInfo_v2 + data["__nvmlDeviceGetNvLinkRemotePciInfo_v2"] = <_cyb_intptr_t>__nvmlDeviceGetNvLinkRemotePciInfo_v2 + + global __nvmlDeviceGetNvLinkErrorCounter + data["__nvmlDeviceGetNvLinkErrorCounter"] = <_cyb_intptr_t>__nvmlDeviceGetNvLinkErrorCounter + + global __nvmlDeviceResetNvLinkErrorCounters + data["__nvmlDeviceResetNvLinkErrorCounters"] = <_cyb_intptr_t>__nvmlDeviceResetNvLinkErrorCounters + + global __nvmlDeviceGetNvLinkRemoteDeviceType + data["__nvmlDeviceGetNvLinkRemoteDeviceType"] = <_cyb_intptr_t>__nvmlDeviceGetNvLinkRemoteDeviceType + + global __nvmlDeviceSetNvLinkDeviceLowPowerThreshold + data["__nvmlDeviceSetNvLinkDeviceLowPowerThreshold"] = <_cyb_intptr_t>__nvmlDeviceSetNvLinkDeviceLowPowerThreshold + + global __nvmlSystemSetNvlinkBwMode + data["__nvmlSystemSetNvlinkBwMode"] = <_cyb_intptr_t>__nvmlSystemSetNvlinkBwMode + + global __nvmlSystemGetNvlinkBwMode + data["__nvmlSystemGetNvlinkBwMode"] = <_cyb_intptr_t>__nvmlSystemGetNvlinkBwMode + + global __nvmlDeviceGetNvlinkSupportedBwModes + data["__nvmlDeviceGetNvlinkSupportedBwModes"] = <_cyb_intptr_t>__nvmlDeviceGetNvlinkSupportedBwModes + + global __nvmlDeviceGetNvlinkBwMode + data["__nvmlDeviceGetNvlinkBwMode"] = <_cyb_intptr_t>__nvmlDeviceGetNvlinkBwMode + + global __nvmlDeviceSetNvlinkBwMode + data["__nvmlDeviceSetNvlinkBwMode"] = <_cyb_intptr_t>__nvmlDeviceSetNvlinkBwMode + + global __nvmlEventSetCreate + data["__nvmlEventSetCreate"] = <_cyb_intptr_t>__nvmlEventSetCreate + + global __nvmlDeviceRegisterEvents + data["__nvmlDeviceRegisterEvents"] = <_cyb_intptr_t>__nvmlDeviceRegisterEvents + + global __nvmlDeviceGetSupportedEventTypes + data["__nvmlDeviceGetSupportedEventTypes"] = <_cyb_intptr_t>__nvmlDeviceGetSupportedEventTypes + + global __nvmlEventSetWait_v2 + data["__nvmlEventSetWait_v2"] = <_cyb_intptr_t>__nvmlEventSetWait_v2 + + global __nvmlEventSetFree + data["__nvmlEventSetFree"] = <_cyb_intptr_t>__nvmlEventSetFree + + global __nvmlSystemEventSetCreate + data["__nvmlSystemEventSetCreate"] = <_cyb_intptr_t>__nvmlSystemEventSetCreate + + global __nvmlSystemEventSetFree + data["__nvmlSystemEventSetFree"] = <_cyb_intptr_t>__nvmlSystemEventSetFree + + global __nvmlSystemRegisterEvents + data["__nvmlSystemRegisterEvents"] = <_cyb_intptr_t>__nvmlSystemRegisterEvents + + global __nvmlSystemEventSetWait + data["__nvmlSystemEventSetWait"] = <_cyb_intptr_t>__nvmlSystemEventSetWait + + global __nvmlDeviceModifyDrainState + data["__nvmlDeviceModifyDrainState"] = <_cyb_intptr_t>__nvmlDeviceModifyDrainState + + global __nvmlDeviceQueryDrainState + data["__nvmlDeviceQueryDrainState"] = <_cyb_intptr_t>__nvmlDeviceQueryDrainState + + global __nvmlDeviceRemoveGpu_v2 + data["__nvmlDeviceRemoveGpu_v2"] = <_cyb_intptr_t>__nvmlDeviceRemoveGpu_v2 + + global __nvmlDeviceDiscoverGpus + data["__nvmlDeviceDiscoverGpus"] = <_cyb_intptr_t>__nvmlDeviceDiscoverGpus + + global __nvmlDeviceGetFieldValues + data["__nvmlDeviceGetFieldValues"] = <_cyb_intptr_t>__nvmlDeviceGetFieldValues + + global __nvmlDeviceClearFieldValues + data["__nvmlDeviceClearFieldValues"] = <_cyb_intptr_t>__nvmlDeviceClearFieldValues + + global __nvmlDeviceGetVirtualizationMode + data["__nvmlDeviceGetVirtualizationMode"] = <_cyb_intptr_t>__nvmlDeviceGetVirtualizationMode + + global __nvmlDeviceGetHostVgpuMode + data["__nvmlDeviceGetHostVgpuMode"] = <_cyb_intptr_t>__nvmlDeviceGetHostVgpuMode + + global __nvmlDeviceSetVirtualizationMode + data["__nvmlDeviceSetVirtualizationMode"] = <_cyb_intptr_t>__nvmlDeviceSetVirtualizationMode + + global __nvmlDeviceGetVgpuHeterogeneousMode + data["__nvmlDeviceGetVgpuHeterogeneousMode"] = <_cyb_intptr_t>__nvmlDeviceGetVgpuHeterogeneousMode + + global __nvmlDeviceSetVgpuHeterogeneousMode + data["__nvmlDeviceSetVgpuHeterogeneousMode"] = <_cyb_intptr_t>__nvmlDeviceSetVgpuHeterogeneousMode + + global __nvmlVgpuInstanceGetPlacementId + data["__nvmlVgpuInstanceGetPlacementId"] = <_cyb_intptr_t>__nvmlVgpuInstanceGetPlacementId + + global __nvmlDeviceGetVgpuTypeSupportedPlacements + data["__nvmlDeviceGetVgpuTypeSupportedPlacements"] = <_cyb_intptr_t>__nvmlDeviceGetVgpuTypeSupportedPlacements + + global __nvmlDeviceGetVgpuTypeCreatablePlacements + data["__nvmlDeviceGetVgpuTypeCreatablePlacements"] = <_cyb_intptr_t>__nvmlDeviceGetVgpuTypeCreatablePlacements + + global __nvmlVgpuTypeGetGspHeapSize + data["__nvmlVgpuTypeGetGspHeapSize"] = <_cyb_intptr_t>__nvmlVgpuTypeGetGspHeapSize + + global __nvmlVgpuTypeGetFbReservation + data["__nvmlVgpuTypeGetFbReservation"] = <_cyb_intptr_t>__nvmlVgpuTypeGetFbReservation + + global __nvmlVgpuInstanceGetRuntimeStateSize + data["__nvmlVgpuInstanceGetRuntimeStateSize"] = <_cyb_intptr_t>__nvmlVgpuInstanceGetRuntimeStateSize + + global __nvmlDeviceSetVgpuCapabilities + data["__nvmlDeviceSetVgpuCapabilities"] = <_cyb_intptr_t>__nvmlDeviceSetVgpuCapabilities + + global __nvmlDeviceGetGridLicensableFeatures_v4 + data["__nvmlDeviceGetGridLicensableFeatures_v4"] = <_cyb_intptr_t>__nvmlDeviceGetGridLicensableFeatures_v4 + + global __nvmlGetVgpuDriverCapabilities + data["__nvmlGetVgpuDriverCapabilities"] = <_cyb_intptr_t>__nvmlGetVgpuDriverCapabilities + + global __nvmlDeviceGetVgpuCapabilities + data["__nvmlDeviceGetVgpuCapabilities"] = <_cyb_intptr_t>__nvmlDeviceGetVgpuCapabilities + + global __nvmlDeviceGetSupportedVgpus + data["__nvmlDeviceGetSupportedVgpus"] = <_cyb_intptr_t>__nvmlDeviceGetSupportedVgpus + + global __nvmlDeviceGetCreatableVgpus + data["__nvmlDeviceGetCreatableVgpus"] = <_cyb_intptr_t>__nvmlDeviceGetCreatableVgpus + + global __nvmlVgpuTypeGetClass + data["__nvmlVgpuTypeGetClass"] = <_cyb_intptr_t>__nvmlVgpuTypeGetClass + + global __nvmlVgpuTypeGetName + data["__nvmlVgpuTypeGetName"] = <_cyb_intptr_t>__nvmlVgpuTypeGetName + + global __nvmlVgpuTypeGetGpuInstanceProfileId + data["__nvmlVgpuTypeGetGpuInstanceProfileId"] = <_cyb_intptr_t>__nvmlVgpuTypeGetGpuInstanceProfileId + + global __nvmlVgpuTypeGetDeviceID + data["__nvmlVgpuTypeGetDeviceID"] = <_cyb_intptr_t>__nvmlVgpuTypeGetDeviceID + + global __nvmlVgpuTypeGetFramebufferSize + data["__nvmlVgpuTypeGetFramebufferSize"] = <_cyb_intptr_t>__nvmlVgpuTypeGetFramebufferSize + + global __nvmlVgpuTypeGetNumDisplayHeads + data["__nvmlVgpuTypeGetNumDisplayHeads"] = <_cyb_intptr_t>__nvmlVgpuTypeGetNumDisplayHeads + + global __nvmlVgpuTypeGetResolution + data["__nvmlVgpuTypeGetResolution"] = <_cyb_intptr_t>__nvmlVgpuTypeGetResolution + + global __nvmlVgpuTypeGetLicense + data["__nvmlVgpuTypeGetLicense"] = <_cyb_intptr_t>__nvmlVgpuTypeGetLicense + + global __nvmlVgpuTypeGetFrameRateLimit + data["__nvmlVgpuTypeGetFrameRateLimit"] = <_cyb_intptr_t>__nvmlVgpuTypeGetFrameRateLimit + + global __nvmlVgpuTypeGetMaxInstances + data["__nvmlVgpuTypeGetMaxInstances"] = <_cyb_intptr_t>__nvmlVgpuTypeGetMaxInstances + + global __nvmlVgpuTypeGetMaxInstancesPerVm + data["__nvmlVgpuTypeGetMaxInstancesPerVm"] = <_cyb_intptr_t>__nvmlVgpuTypeGetMaxInstancesPerVm + + global __nvmlVgpuTypeGetBAR1Info + data["__nvmlVgpuTypeGetBAR1Info"] = <_cyb_intptr_t>__nvmlVgpuTypeGetBAR1Info + + global __nvmlDeviceGetActiveVgpus + data["__nvmlDeviceGetActiveVgpus"] = <_cyb_intptr_t>__nvmlDeviceGetActiveVgpus + + global __nvmlVgpuInstanceGetVmID + data["__nvmlVgpuInstanceGetVmID"] = <_cyb_intptr_t>__nvmlVgpuInstanceGetVmID + + global __nvmlVgpuInstanceGetUUID + data["__nvmlVgpuInstanceGetUUID"] = <_cyb_intptr_t>__nvmlVgpuInstanceGetUUID + + global __nvmlVgpuInstanceGetVmDriverVersion + data["__nvmlVgpuInstanceGetVmDriverVersion"] = <_cyb_intptr_t>__nvmlVgpuInstanceGetVmDriverVersion + + global __nvmlVgpuInstanceGetFbUsage + data["__nvmlVgpuInstanceGetFbUsage"] = <_cyb_intptr_t>__nvmlVgpuInstanceGetFbUsage + + global __nvmlVgpuInstanceGetLicenseStatus + data["__nvmlVgpuInstanceGetLicenseStatus"] = <_cyb_intptr_t>__nvmlVgpuInstanceGetLicenseStatus + + global __nvmlVgpuInstanceGetType + data["__nvmlVgpuInstanceGetType"] = <_cyb_intptr_t>__nvmlVgpuInstanceGetType + + global __nvmlVgpuInstanceGetFrameRateLimit + data["__nvmlVgpuInstanceGetFrameRateLimit"] = <_cyb_intptr_t>__nvmlVgpuInstanceGetFrameRateLimit + + global __nvmlVgpuInstanceGetEccMode + data["__nvmlVgpuInstanceGetEccMode"] = <_cyb_intptr_t>__nvmlVgpuInstanceGetEccMode + + global __nvmlVgpuInstanceGetEncoderCapacity + data["__nvmlVgpuInstanceGetEncoderCapacity"] = <_cyb_intptr_t>__nvmlVgpuInstanceGetEncoderCapacity + + global __nvmlVgpuInstanceSetEncoderCapacity + data["__nvmlVgpuInstanceSetEncoderCapacity"] = <_cyb_intptr_t>__nvmlVgpuInstanceSetEncoderCapacity + + global __nvmlVgpuInstanceGetEncoderStats + data["__nvmlVgpuInstanceGetEncoderStats"] = <_cyb_intptr_t>__nvmlVgpuInstanceGetEncoderStats + + global __nvmlVgpuInstanceGetEncoderSessions + data["__nvmlVgpuInstanceGetEncoderSessions"] = <_cyb_intptr_t>__nvmlVgpuInstanceGetEncoderSessions + + global __nvmlVgpuInstanceGetFBCStats + data["__nvmlVgpuInstanceGetFBCStats"] = <_cyb_intptr_t>__nvmlVgpuInstanceGetFBCStats + + global __nvmlVgpuInstanceGetFBCSessions + data["__nvmlVgpuInstanceGetFBCSessions"] = <_cyb_intptr_t>__nvmlVgpuInstanceGetFBCSessions + + global __nvmlVgpuInstanceGetGpuInstanceId + data["__nvmlVgpuInstanceGetGpuInstanceId"] = <_cyb_intptr_t>__nvmlVgpuInstanceGetGpuInstanceId + + global __nvmlVgpuInstanceGetGpuPciId + data["__nvmlVgpuInstanceGetGpuPciId"] = <_cyb_intptr_t>__nvmlVgpuInstanceGetGpuPciId + + global __nvmlVgpuTypeGetCapabilities + data["__nvmlVgpuTypeGetCapabilities"] = <_cyb_intptr_t>__nvmlVgpuTypeGetCapabilities + + global __nvmlVgpuInstanceGetMdevUUID + data["__nvmlVgpuInstanceGetMdevUUID"] = <_cyb_intptr_t>__nvmlVgpuInstanceGetMdevUUID + + global __nvmlGpuInstanceGetCreatableVgpus + data["__nvmlGpuInstanceGetCreatableVgpus"] = <_cyb_intptr_t>__nvmlGpuInstanceGetCreatableVgpus + + global __nvmlVgpuTypeGetMaxInstancesPerGpuInstance + data["__nvmlVgpuTypeGetMaxInstancesPerGpuInstance"] = <_cyb_intptr_t>__nvmlVgpuTypeGetMaxInstancesPerGpuInstance + + global __nvmlGpuInstanceGetActiveVgpus + data["__nvmlGpuInstanceGetActiveVgpus"] = <_cyb_intptr_t>__nvmlGpuInstanceGetActiveVgpus + + global __nvmlGpuInstanceSetVgpuSchedulerState + data["__nvmlGpuInstanceSetVgpuSchedulerState"] = <_cyb_intptr_t>__nvmlGpuInstanceSetVgpuSchedulerState + + global __nvmlGpuInstanceGetVgpuSchedulerState + data["__nvmlGpuInstanceGetVgpuSchedulerState"] = <_cyb_intptr_t>__nvmlGpuInstanceGetVgpuSchedulerState + + global __nvmlGpuInstanceGetVgpuSchedulerLog + data["__nvmlGpuInstanceGetVgpuSchedulerLog"] = <_cyb_intptr_t>__nvmlGpuInstanceGetVgpuSchedulerLog + + global __nvmlGpuInstanceGetVgpuTypeCreatablePlacements + data["__nvmlGpuInstanceGetVgpuTypeCreatablePlacements"] = <_cyb_intptr_t>__nvmlGpuInstanceGetVgpuTypeCreatablePlacements + + global __nvmlGpuInstanceGetVgpuHeterogeneousMode + data["__nvmlGpuInstanceGetVgpuHeterogeneousMode"] = <_cyb_intptr_t>__nvmlGpuInstanceGetVgpuHeterogeneousMode + + global __nvmlGpuInstanceSetVgpuHeterogeneousMode + data["__nvmlGpuInstanceSetVgpuHeterogeneousMode"] = <_cyb_intptr_t>__nvmlGpuInstanceSetVgpuHeterogeneousMode + + global __nvmlVgpuInstanceGetMetadata + data["__nvmlVgpuInstanceGetMetadata"] = <_cyb_intptr_t>__nvmlVgpuInstanceGetMetadata + + global __nvmlDeviceGetVgpuMetadata + data["__nvmlDeviceGetVgpuMetadata"] = <_cyb_intptr_t>__nvmlDeviceGetVgpuMetadata + + global __nvmlGetVgpuCompatibility + data["__nvmlGetVgpuCompatibility"] = <_cyb_intptr_t>__nvmlGetVgpuCompatibility + + global __nvmlDeviceGetPgpuMetadataString + data["__nvmlDeviceGetPgpuMetadataString"] = <_cyb_intptr_t>__nvmlDeviceGetPgpuMetadataString + + global __nvmlDeviceGetVgpuSchedulerLog + data["__nvmlDeviceGetVgpuSchedulerLog"] = <_cyb_intptr_t>__nvmlDeviceGetVgpuSchedulerLog + + global __nvmlDeviceGetVgpuSchedulerState + data["__nvmlDeviceGetVgpuSchedulerState"] = <_cyb_intptr_t>__nvmlDeviceGetVgpuSchedulerState + + global __nvmlDeviceGetVgpuSchedulerCapabilities + data["__nvmlDeviceGetVgpuSchedulerCapabilities"] = <_cyb_intptr_t>__nvmlDeviceGetVgpuSchedulerCapabilities + + global __nvmlDeviceSetVgpuSchedulerState + data["__nvmlDeviceSetVgpuSchedulerState"] = <_cyb_intptr_t>__nvmlDeviceSetVgpuSchedulerState + + global __nvmlGetVgpuVersion + data["__nvmlGetVgpuVersion"] = <_cyb_intptr_t>__nvmlGetVgpuVersion + + global __nvmlSetVgpuVersion + data["__nvmlSetVgpuVersion"] = <_cyb_intptr_t>__nvmlSetVgpuVersion + + global __nvmlDeviceGetVgpuUtilization + data["__nvmlDeviceGetVgpuUtilization"] = <_cyb_intptr_t>__nvmlDeviceGetVgpuUtilization + + global __nvmlDeviceGetVgpuInstancesUtilizationInfo + data["__nvmlDeviceGetVgpuInstancesUtilizationInfo"] = <_cyb_intptr_t>__nvmlDeviceGetVgpuInstancesUtilizationInfo + + global __nvmlDeviceGetVgpuProcessUtilization + data["__nvmlDeviceGetVgpuProcessUtilization"] = <_cyb_intptr_t>__nvmlDeviceGetVgpuProcessUtilization + + global __nvmlDeviceGetVgpuProcessesUtilizationInfo + data["__nvmlDeviceGetVgpuProcessesUtilizationInfo"] = <_cyb_intptr_t>__nvmlDeviceGetVgpuProcessesUtilizationInfo + + global __nvmlVgpuInstanceGetAccountingMode + data["__nvmlVgpuInstanceGetAccountingMode"] = <_cyb_intptr_t>__nvmlVgpuInstanceGetAccountingMode + + global __nvmlVgpuInstanceGetAccountingPids + data["__nvmlVgpuInstanceGetAccountingPids"] = <_cyb_intptr_t>__nvmlVgpuInstanceGetAccountingPids + + global __nvmlVgpuInstanceGetAccountingStats + data["__nvmlVgpuInstanceGetAccountingStats"] = <_cyb_intptr_t>__nvmlVgpuInstanceGetAccountingStats + + global __nvmlVgpuInstanceClearAccountingPids + data["__nvmlVgpuInstanceClearAccountingPids"] = <_cyb_intptr_t>__nvmlVgpuInstanceClearAccountingPids + + global __nvmlVgpuInstanceGetLicenseInfo_v2 + data["__nvmlVgpuInstanceGetLicenseInfo_v2"] = <_cyb_intptr_t>__nvmlVgpuInstanceGetLicenseInfo_v2 + + global __nvmlGetExcludedDeviceCount + data["__nvmlGetExcludedDeviceCount"] = <_cyb_intptr_t>__nvmlGetExcludedDeviceCount + + global __nvmlGetExcludedDeviceInfoByIndex + data["__nvmlGetExcludedDeviceInfoByIndex"] = <_cyb_intptr_t>__nvmlGetExcludedDeviceInfoByIndex + + global __nvmlDeviceSetMigMode + data["__nvmlDeviceSetMigMode"] = <_cyb_intptr_t>__nvmlDeviceSetMigMode + + global __nvmlDeviceGetMigMode + data["__nvmlDeviceGetMigMode"] = <_cyb_intptr_t>__nvmlDeviceGetMigMode + + global __nvmlDeviceGetGpuInstanceProfileInfoV + data["__nvmlDeviceGetGpuInstanceProfileInfoV"] = <_cyb_intptr_t>__nvmlDeviceGetGpuInstanceProfileInfoV + + global __nvmlDeviceGetGpuInstancePossiblePlacements_v2 + data["__nvmlDeviceGetGpuInstancePossiblePlacements_v2"] = <_cyb_intptr_t>__nvmlDeviceGetGpuInstancePossiblePlacements_v2 + + global __nvmlDeviceGetGpuInstanceRemainingCapacity + data["__nvmlDeviceGetGpuInstanceRemainingCapacity"] = <_cyb_intptr_t>__nvmlDeviceGetGpuInstanceRemainingCapacity + + global __nvmlDeviceCreateGpuInstance + data["__nvmlDeviceCreateGpuInstance"] = <_cyb_intptr_t>__nvmlDeviceCreateGpuInstance + + global __nvmlDeviceCreateGpuInstanceWithPlacement + data["__nvmlDeviceCreateGpuInstanceWithPlacement"] = <_cyb_intptr_t>__nvmlDeviceCreateGpuInstanceWithPlacement + + global __nvmlGpuInstanceDestroy + data["__nvmlGpuInstanceDestroy"] = <_cyb_intptr_t>__nvmlGpuInstanceDestroy + + global __nvmlDeviceGetGpuInstances + data["__nvmlDeviceGetGpuInstances"] = <_cyb_intptr_t>__nvmlDeviceGetGpuInstances + + global __nvmlDeviceGetGpuInstanceById + data["__nvmlDeviceGetGpuInstanceById"] = <_cyb_intptr_t>__nvmlDeviceGetGpuInstanceById + + global __nvmlGpuInstanceGetInfo + data["__nvmlGpuInstanceGetInfo"] = <_cyb_intptr_t>__nvmlGpuInstanceGetInfo + + global __nvmlGpuInstanceGetComputeInstanceProfileInfoV + data["__nvmlGpuInstanceGetComputeInstanceProfileInfoV"] = <_cyb_intptr_t>__nvmlGpuInstanceGetComputeInstanceProfileInfoV + + global __nvmlGpuInstanceGetComputeInstanceRemainingCapacity + data["__nvmlGpuInstanceGetComputeInstanceRemainingCapacity"] = <_cyb_intptr_t>__nvmlGpuInstanceGetComputeInstanceRemainingCapacity + + global __nvmlGpuInstanceGetComputeInstancePossiblePlacements + data["__nvmlGpuInstanceGetComputeInstancePossiblePlacements"] = <_cyb_intptr_t>__nvmlGpuInstanceGetComputeInstancePossiblePlacements + + global __nvmlGpuInstanceCreateComputeInstance + data["__nvmlGpuInstanceCreateComputeInstance"] = <_cyb_intptr_t>__nvmlGpuInstanceCreateComputeInstance + + global __nvmlGpuInstanceCreateComputeInstanceWithPlacement + data["__nvmlGpuInstanceCreateComputeInstanceWithPlacement"] = <_cyb_intptr_t>__nvmlGpuInstanceCreateComputeInstanceWithPlacement + + global __nvmlComputeInstanceDestroy + data["__nvmlComputeInstanceDestroy"] = <_cyb_intptr_t>__nvmlComputeInstanceDestroy + + global __nvmlGpuInstanceGetComputeInstances + data["__nvmlGpuInstanceGetComputeInstances"] = <_cyb_intptr_t>__nvmlGpuInstanceGetComputeInstances + + global __nvmlGpuInstanceGetComputeInstanceById + data["__nvmlGpuInstanceGetComputeInstanceById"] = <_cyb_intptr_t>__nvmlGpuInstanceGetComputeInstanceById + + global __nvmlComputeInstanceGetInfo_v2 + data["__nvmlComputeInstanceGetInfo_v2"] = <_cyb_intptr_t>__nvmlComputeInstanceGetInfo_v2 + + global __nvmlDeviceIsMigDeviceHandle + data["__nvmlDeviceIsMigDeviceHandle"] = <_cyb_intptr_t>__nvmlDeviceIsMigDeviceHandle + + global __nvmlDeviceGetGpuInstanceId + data["__nvmlDeviceGetGpuInstanceId"] = <_cyb_intptr_t>__nvmlDeviceGetGpuInstanceId + + global __nvmlDeviceGetComputeInstanceId + data["__nvmlDeviceGetComputeInstanceId"] = <_cyb_intptr_t>__nvmlDeviceGetComputeInstanceId + + global __nvmlDeviceGetMaxMigDeviceCount + data["__nvmlDeviceGetMaxMigDeviceCount"] = <_cyb_intptr_t>__nvmlDeviceGetMaxMigDeviceCount + + global __nvmlDeviceGetMigDeviceHandleByIndex + data["__nvmlDeviceGetMigDeviceHandleByIndex"] = <_cyb_intptr_t>__nvmlDeviceGetMigDeviceHandleByIndex + + global __nvmlDeviceGetDeviceHandleFromMigDeviceHandle + data["__nvmlDeviceGetDeviceHandleFromMigDeviceHandle"] = <_cyb_intptr_t>__nvmlDeviceGetDeviceHandleFromMigDeviceHandle + + global __nvmlDeviceGetCapabilities + data["__nvmlDeviceGetCapabilities"] = <_cyb_intptr_t>__nvmlDeviceGetCapabilities + + global __nvmlDevicePowerSmoothingActivatePresetProfile + data["__nvmlDevicePowerSmoothingActivatePresetProfile"] = <_cyb_intptr_t>__nvmlDevicePowerSmoothingActivatePresetProfile + + global __nvmlDevicePowerSmoothingUpdatePresetProfileParam + data["__nvmlDevicePowerSmoothingUpdatePresetProfileParam"] = <_cyb_intptr_t>__nvmlDevicePowerSmoothingUpdatePresetProfileParam + + global __nvmlDevicePowerSmoothingSetState + data["__nvmlDevicePowerSmoothingSetState"] = <_cyb_intptr_t>__nvmlDevicePowerSmoothingSetState + + global __nvmlDeviceGetAddressingMode + data["__nvmlDeviceGetAddressingMode"] = <_cyb_intptr_t>__nvmlDeviceGetAddressingMode + + global __nvmlDeviceGetRepairStatus + data["__nvmlDeviceGetRepairStatus"] = <_cyb_intptr_t>__nvmlDeviceGetRepairStatus + + global __nvmlDeviceGetPowerMizerMode_v1 + data["__nvmlDeviceGetPowerMizerMode_v1"] = <_cyb_intptr_t>__nvmlDeviceGetPowerMizerMode_v1 + + global __nvmlDeviceSetPowerMizerMode_v1 + data["__nvmlDeviceSetPowerMizerMode_v1"] = <_cyb_intptr_t>__nvmlDeviceSetPowerMizerMode_v1 + + global __nvmlDeviceGetPdi + data["__nvmlDeviceGetPdi"] = <_cyb_intptr_t>__nvmlDeviceGetPdi + + global __nvmlDeviceSetHostname_v1 + data["__nvmlDeviceSetHostname_v1"] = <_cyb_intptr_t>__nvmlDeviceSetHostname_v1 + + global __nvmlDeviceGetHostname_v1 + data["__nvmlDeviceGetHostname_v1"] = <_cyb_intptr_t>__nvmlDeviceGetHostname_v1 + + global __nvmlDeviceGetNvLinkInfo + data["__nvmlDeviceGetNvLinkInfo"] = <_cyb_intptr_t>__nvmlDeviceGetNvLinkInfo + + global __nvmlDeviceReadWritePRM_v1 + data["__nvmlDeviceReadWritePRM_v1"] = <_cyb_intptr_t>__nvmlDeviceReadWritePRM_v1 + + global __nvmlDeviceGetGpuInstanceProfileInfoByIdV + data["__nvmlDeviceGetGpuInstanceProfileInfoByIdV"] = <_cyb_intptr_t>__nvmlDeviceGetGpuInstanceProfileInfoByIdV + + global __nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts + data["__nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts"] = <_cyb_intptr_t>__nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts + + global __nvmlDeviceGetUnrepairableMemoryFlag_v1 + data["__nvmlDeviceGetUnrepairableMemoryFlag_v1"] = <_cyb_intptr_t>__nvmlDeviceGetUnrepairableMemoryFlag_v1 + + global __nvmlDeviceReadPRMCounters_v1 + data["__nvmlDeviceReadPRMCounters_v1"] = <_cyb_intptr_t>__nvmlDeviceReadPRMCounters_v1 + + global __nvmlDeviceSetRusdSettings_v1 + data["__nvmlDeviceSetRusdSettings_v1"] = <_cyb_intptr_t>__nvmlDeviceSetRusdSettings_v1 + + global __nvmlDeviceVgpuForceGspUnload + data["__nvmlDeviceVgpuForceGspUnload"] = <_cyb_intptr_t>__nvmlDeviceVgpuForceGspUnload + + global __nvmlDeviceGetVgpuSchedulerState_v2 + data["__nvmlDeviceGetVgpuSchedulerState_v2"] = <_cyb_intptr_t>__nvmlDeviceGetVgpuSchedulerState_v2 + + global __nvmlGpuInstanceGetVgpuSchedulerState_v2 + data["__nvmlGpuInstanceGetVgpuSchedulerState_v2"] = <_cyb_intptr_t>__nvmlGpuInstanceGetVgpuSchedulerState_v2 + + global __nvmlDeviceGetVgpuSchedulerLog_v2 + data["__nvmlDeviceGetVgpuSchedulerLog_v2"] = <_cyb_intptr_t>__nvmlDeviceGetVgpuSchedulerLog_v2 + + global __nvmlGpuInstanceGetVgpuSchedulerLog_v2 + data["__nvmlGpuInstanceGetVgpuSchedulerLog_v2"] = <_cyb_intptr_t>__nvmlGpuInstanceGetVgpuSchedulerLog_v2 + + global __nvmlDeviceSetVgpuSchedulerState_v2 + data["__nvmlDeviceSetVgpuSchedulerState_v2"] = <_cyb_intptr_t>__nvmlDeviceSetVgpuSchedulerState_v2 + + global __nvmlGpuInstanceSetVgpuSchedulerState_v2 + data["__nvmlGpuInstanceSetVgpuSchedulerState_v2"] = <_cyb_intptr_t>__nvmlGpuInstanceSetVgpuSchedulerState_v2 + _cyb_func_ptrs = data + return data + + +cpdef _inspect_function_pointer(str name): + global _cyb_func_ptrs + if _cyb_func_ptrs is None: + _cyb_func_ptrs = _inspect_function_pointers() + return _cyb_func_ptrs[name] + + + + +cdef void* load_library() except* with gil: + cdef uintptr_t handle = load_nvidia_dynamic_lib("nvml")._handle_uint + return handle + + +############################################################################### +# Wrapper functions +############################################################################### + +cdef nvmlReturn_t _nvmlInit_v2() except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlInit_v2 + _check_or_init_nvml() + if __nvmlInit_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlInit_v2 is not found") + return (__nvmlInit_v2)( + ) + + +cdef nvmlReturn_t _nvmlInitWithFlags(unsigned int flags) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlInitWithFlags + _check_or_init_nvml() + if __nvmlInitWithFlags == NULL: + with gil: + raise FunctionNotFoundError("function nvmlInitWithFlags is not found") + return (__nvmlInitWithFlags)( + flags) + + +cdef nvmlReturn_t _nvmlShutdown() except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlShutdown + _check_or_init_nvml() + if __nvmlShutdown == NULL: + with gil: + raise FunctionNotFoundError("function nvmlShutdown is not found") + return (__nvmlShutdown)( + ) + + +cdef const char* _nvmlErrorString(nvmlReturn_t result) except?NULL nogil: + global __nvmlErrorString + _check_or_init_nvml() + if __nvmlErrorString == NULL: + with gil: + raise FunctionNotFoundError("function nvmlErrorString is not found") + return (__nvmlErrorString)( + result) + + +cdef nvmlReturn_t _nvmlSystemGetDriverVersion(char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemGetDriverVersion + _check_or_init_nvml() + if __nvmlSystemGetDriverVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemGetDriverVersion is not found") + return (__nvmlSystemGetDriverVersion)( + version, length) + + +cdef nvmlReturn_t _nvmlSystemGetNVMLVersion(char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemGetNVMLVersion + _check_or_init_nvml() + if __nvmlSystemGetNVMLVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemGetNVMLVersion is not found") + return (__nvmlSystemGetNVMLVersion)( + version, length) + + +cdef nvmlReturn_t _nvmlSystemGetCudaDriverVersion(int* cudaDriverVersion) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemGetCudaDriverVersion + _check_or_init_nvml() + if __nvmlSystemGetCudaDriverVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemGetCudaDriverVersion is not found") + return (__nvmlSystemGetCudaDriverVersion)( + cudaDriverVersion) + + +cdef nvmlReturn_t _nvmlSystemGetCudaDriverVersion_v2(int* cudaDriverVersion) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemGetCudaDriverVersion_v2 + _check_or_init_nvml() + if __nvmlSystemGetCudaDriverVersion_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemGetCudaDriverVersion_v2 is not found") + return (__nvmlSystemGetCudaDriverVersion_v2)( + cudaDriverVersion) + + +cdef nvmlReturn_t _nvmlSystemGetProcessName(unsigned int pid, char* name, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemGetProcessName + _check_or_init_nvml() + if __nvmlSystemGetProcessName == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemGetProcessName is not found") + return (__nvmlSystemGetProcessName)( + pid, name, length) + + +cdef nvmlReturn_t _nvmlSystemGetHicVersion(unsigned int* hwbcCount, nvmlHwbcEntry_t* hwbcEntries) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemGetHicVersion + _check_or_init_nvml() + if __nvmlSystemGetHicVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemGetHicVersion is not found") + return (__nvmlSystemGetHicVersion)( + hwbcCount, hwbcEntries) + + +cdef nvmlReturn_t _nvmlSystemGetTopologyGpuSet(unsigned int cpuNumber, unsigned int* count, nvmlDevice_t* deviceArray) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemGetTopologyGpuSet + _check_or_init_nvml() + if __nvmlSystemGetTopologyGpuSet == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemGetTopologyGpuSet is not found") + return (__nvmlSystemGetTopologyGpuSet)( + cpuNumber, count, deviceArray) + + +cdef nvmlReturn_t _nvmlSystemGetDriverBranch(nvmlSystemDriverBranchInfo_t* branchInfo, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemGetDriverBranch + _check_or_init_nvml() + if __nvmlSystemGetDriverBranch == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemGetDriverBranch is not found") + return (__nvmlSystemGetDriverBranch)( + branchInfo, length) + + +cdef nvmlReturn_t _nvmlUnitGetCount(unsigned int* unitCount) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlUnitGetCount + _check_or_init_nvml() + if __nvmlUnitGetCount == NULL: + with gil: + raise FunctionNotFoundError("function nvmlUnitGetCount is not found") + return (__nvmlUnitGetCount)( + unitCount) + + +cdef nvmlReturn_t _nvmlUnitGetHandleByIndex(unsigned int index, nvmlUnit_t* unit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlUnitGetHandleByIndex + _check_or_init_nvml() + if __nvmlUnitGetHandleByIndex == NULL: + with gil: + raise FunctionNotFoundError("function nvmlUnitGetHandleByIndex is not found") + return (__nvmlUnitGetHandleByIndex)( + index, unit) + + +cdef nvmlReturn_t _nvmlUnitGetUnitInfo(nvmlUnit_t unit, nvmlUnitInfo_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlUnitGetUnitInfo + _check_or_init_nvml() + if __nvmlUnitGetUnitInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlUnitGetUnitInfo is not found") + return (__nvmlUnitGetUnitInfo)( + unit, info) + + +cdef nvmlReturn_t _nvmlUnitGetLedState(nvmlUnit_t unit, nvmlLedState_t* state) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlUnitGetLedState + _check_or_init_nvml() + if __nvmlUnitGetLedState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlUnitGetLedState is not found") + return (__nvmlUnitGetLedState)( + unit, state) + + +cdef nvmlReturn_t _nvmlUnitGetPsuInfo(nvmlUnit_t unit, nvmlPSUInfo_t* psu) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlUnitGetPsuInfo + _check_or_init_nvml() + if __nvmlUnitGetPsuInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlUnitGetPsuInfo is not found") + return (__nvmlUnitGetPsuInfo)( + unit, psu) + + +cdef nvmlReturn_t _nvmlUnitGetTemperature(nvmlUnit_t unit, unsigned int type, unsigned int* temp) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlUnitGetTemperature + _check_or_init_nvml() + if __nvmlUnitGetTemperature == NULL: + with gil: + raise FunctionNotFoundError("function nvmlUnitGetTemperature is not found") + return (__nvmlUnitGetTemperature)( + unit, type, temp) + + +cdef nvmlReturn_t _nvmlUnitGetFanSpeedInfo(nvmlUnit_t unit, nvmlUnitFanSpeeds_t* fanSpeeds) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlUnitGetFanSpeedInfo + _check_or_init_nvml() + if __nvmlUnitGetFanSpeedInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlUnitGetFanSpeedInfo is not found") + return (__nvmlUnitGetFanSpeedInfo)( + unit, fanSpeeds) + + +cdef nvmlReturn_t _nvmlUnitGetDevices(nvmlUnit_t unit, unsigned int* deviceCount, nvmlDevice_t* devices) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlUnitGetDevices + _check_or_init_nvml() + if __nvmlUnitGetDevices == NULL: + with gil: + raise FunctionNotFoundError("function nvmlUnitGetDevices is not found") + return (__nvmlUnitGetDevices)( + unit, deviceCount, devices) + + +cdef nvmlReturn_t _nvmlDeviceGetCount_v2(unsigned int* deviceCount) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetCount_v2 + _check_or_init_nvml() + if __nvmlDeviceGetCount_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetCount_v2 is not found") + return (__nvmlDeviceGetCount_v2)( + deviceCount) + + +cdef nvmlReturn_t _nvmlDeviceGetAttributes_v2(nvmlDevice_t device, nvmlDeviceAttributes_t* attributes) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetAttributes_v2 + _check_or_init_nvml() + if __nvmlDeviceGetAttributes_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetAttributes_v2 is not found") + return (__nvmlDeviceGetAttributes_v2)( + device, attributes) + + +cdef nvmlReturn_t _nvmlDeviceGetHandleByIndex_v2(unsigned int index, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetHandleByIndex_v2 + _check_or_init_nvml() + if __nvmlDeviceGetHandleByIndex_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetHandleByIndex_v2 is not found") + return (__nvmlDeviceGetHandleByIndex_v2)( + index, device) + + +cdef nvmlReturn_t _nvmlDeviceGetHandleBySerial(const char* serial, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetHandleBySerial + _check_or_init_nvml() + if __nvmlDeviceGetHandleBySerial == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetHandleBySerial is not found") + return (__nvmlDeviceGetHandleBySerial)( + serial, device) + + +cdef nvmlReturn_t _nvmlDeviceGetHandleByUUID(const char* uuid, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetHandleByUUID + _check_or_init_nvml() + if __nvmlDeviceGetHandleByUUID == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetHandleByUUID is not found") + return (__nvmlDeviceGetHandleByUUID)( + uuid, device) + + +cdef nvmlReturn_t _nvmlDeviceGetHandleByUUIDV(const nvmlUUID_t* uuid, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetHandleByUUIDV + _check_or_init_nvml() + if __nvmlDeviceGetHandleByUUIDV == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetHandleByUUIDV is not found") + return (__nvmlDeviceGetHandleByUUIDV)( + uuid, device) + + +cdef nvmlReturn_t _nvmlDeviceGetHandleByPciBusId_v2(const char* pciBusId, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetHandleByPciBusId_v2 + _check_or_init_nvml() + if __nvmlDeviceGetHandleByPciBusId_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetHandleByPciBusId_v2 is not found") + return (__nvmlDeviceGetHandleByPciBusId_v2)( + pciBusId, device) + + +cdef nvmlReturn_t _nvmlDeviceGetName(nvmlDevice_t device, char* name, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetName + _check_or_init_nvml() + if __nvmlDeviceGetName == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetName is not found") + return (__nvmlDeviceGetName)( + device, name, length) + + +cdef nvmlReturn_t _nvmlDeviceGetBrand(nvmlDevice_t device, nvmlBrandType_t* type) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetBrand + _check_or_init_nvml() + if __nvmlDeviceGetBrand == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetBrand is not found") + return (__nvmlDeviceGetBrand)( + device, type) + + +cdef nvmlReturn_t _nvmlDeviceGetIndex(nvmlDevice_t device, unsigned int* index) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetIndex + _check_or_init_nvml() + if __nvmlDeviceGetIndex == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetIndex is not found") + return (__nvmlDeviceGetIndex)( + device, index) + + +cdef nvmlReturn_t _nvmlDeviceGetSerial(nvmlDevice_t device, char* serial, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetSerial + _check_or_init_nvml() + if __nvmlDeviceGetSerial == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetSerial is not found") + return (__nvmlDeviceGetSerial)( + device, serial, length) + + +cdef nvmlReturn_t _nvmlDeviceGetModuleId(nvmlDevice_t device, unsigned int* moduleId) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetModuleId + _check_or_init_nvml() + if __nvmlDeviceGetModuleId == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetModuleId is not found") + return (__nvmlDeviceGetModuleId)( + device, moduleId) + + +cdef nvmlReturn_t _nvmlDeviceGetC2cModeInfoV(nvmlDevice_t device, nvmlC2cModeInfo_v1_t* c2cModeInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetC2cModeInfoV + _check_or_init_nvml() + if __nvmlDeviceGetC2cModeInfoV == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetC2cModeInfoV is not found") + return (__nvmlDeviceGetC2cModeInfoV)( + device, c2cModeInfo) + + +cdef nvmlReturn_t _nvmlDeviceGetMemoryAffinity(nvmlDevice_t device, unsigned int nodeSetSize, unsigned long* nodeSet, nvmlAffinityScope_t scope) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMemoryAffinity + _check_or_init_nvml() + if __nvmlDeviceGetMemoryAffinity == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMemoryAffinity is not found") + return (__nvmlDeviceGetMemoryAffinity)( + device, nodeSetSize, nodeSet, scope) + + +cdef nvmlReturn_t _nvmlDeviceGetCpuAffinityWithinScope(nvmlDevice_t device, unsigned int cpuSetSize, unsigned long* cpuSet, nvmlAffinityScope_t scope) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetCpuAffinityWithinScope + _check_or_init_nvml() + if __nvmlDeviceGetCpuAffinityWithinScope == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetCpuAffinityWithinScope is not found") + return (__nvmlDeviceGetCpuAffinityWithinScope)( + device, cpuSetSize, cpuSet, scope) + + +cdef nvmlReturn_t _nvmlDeviceGetCpuAffinity(nvmlDevice_t device, unsigned int cpuSetSize, unsigned long* cpuSet) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetCpuAffinity + _check_or_init_nvml() + if __nvmlDeviceGetCpuAffinity == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetCpuAffinity is not found") + return (__nvmlDeviceGetCpuAffinity)( + device, cpuSetSize, cpuSet) + + +cdef nvmlReturn_t _nvmlDeviceSetCpuAffinity(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetCpuAffinity + _check_or_init_nvml() + if __nvmlDeviceSetCpuAffinity == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetCpuAffinity is not found") + return (__nvmlDeviceSetCpuAffinity)( + device) + + +cdef nvmlReturn_t _nvmlDeviceClearCpuAffinity(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceClearCpuAffinity + _check_or_init_nvml() + if __nvmlDeviceClearCpuAffinity == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceClearCpuAffinity is not found") + return (__nvmlDeviceClearCpuAffinity)( + device) + + +cdef nvmlReturn_t _nvmlDeviceGetNumaNodeId(nvmlDevice_t device, unsigned int* node) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetNumaNodeId + _check_or_init_nvml() + if __nvmlDeviceGetNumaNodeId == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetNumaNodeId is not found") + return (__nvmlDeviceGetNumaNodeId)( + device, node) + + +cdef nvmlReturn_t _nvmlDeviceGetTopologyCommonAncestor(nvmlDevice_t device1, nvmlDevice_t device2, nvmlGpuTopologyLevel_t* pathInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetTopologyCommonAncestor + _check_or_init_nvml() + if __nvmlDeviceGetTopologyCommonAncestor == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetTopologyCommonAncestor is not found") + return (__nvmlDeviceGetTopologyCommonAncestor)( + device1, device2, pathInfo) + + +cdef nvmlReturn_t _nvmlDeviceGetTopologyNearestGpus(nvmlDevice_t device, nvmlGpuTopologyLevel_t level, unsigned int* count, nvmlDevice_t* deviceArray) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetTopologyNearestGpus + _check_or_init_nvml() + if __nvmlDeviceGetTopologyNearestGpus == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetTopologyNearestGpus is not found") + return (__nvmlDeviceGetTopologyNearestGpus)( + device, level, count, deviceArray) + + +cdef nvmlReturn_t _nvmlDeviceGetP2PStatus(nvmlDevice_t device1, nvmlDevice_t device2, nvmlGpuP2PCapsIndex_t p2pIndex, nvmlGpuP2PStatus_t* p2pStatus) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetP2PStatus + _check_or_init_nvml() + if __nvmlDeviceGetP2PStatus == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetP2PStatus is not found") + return (__nvmlDeviceGetP2PStatus)( + device1, device2, p2pIndex, p2pStatus) + + +cdef nvmlReturn_t _nvmlDeviceGetUUID(nvmlDevice_t device, char* uuid, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetUUID + _check_or_init_nvml() + if __nvmlDeviceGetUUID == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetUUID is not found") + return (__nvmlDeviceGetUUID)( + device, uuid, length) + + +cdef nvmlReturn_t _nvmlDeviceGetMinorNumber(nvmlDevice_t device, unsigned int* minorNumber) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMinorNumber + _check_or_init_nvml() + if __nvmlDeviceGetMinorNumber == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMinorNumber is not found") + return (__nvmlDeviceGetMinorNumber)( + device, minorNumber) + + +cdef nvmlReturn_t _nvmlDeviceGetBoardPartNumber(nvmlDevice_t device, char* partNumber, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetBoardPartNumber + _check_or_init_nvml() + if __nvmlDeviceGetBoardPartNumber == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetBoardPartNumber is not found") + return (__nvmlDeviceGetBoardPartNumber)( + device, partNumber, length) + + +cdef nvmlReturn_t _nvmlDeviceGetInforomVersion(nvmlDevice_t device, nvmlInforomObject_t object, char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetInforomVersion + _check_or_init_nvml() + if __nvmlDeviceGetInforomVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetInforomVersion is not found") + return (__nvmlDeviceGetInforomVersion)( + device, object, version, length) + + +cdef nvmlReturn_t _nvmlDeviceGetInforomImageVersion(nvmlDevice_t device, char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetInforomImageVersion + _check_or_init_nvml() + if __nvmlDeviceGetInforomImageVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetInforomImageVersion is not found") + return (__nvmlDeviceGetInforomImageVersion)( + device, version, length) + + +cdef nvmlReturn_t _nvmlDeviceGetInforomConfigurationChecksum(nvmlDevice_t device, unsigned int* checksum) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetInforomConfigurationChecksum + _check_or_init_nvml() + if __nvmlDeviceGetInforomConfigurationChecksum == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetInforomConfigurationChecksum is not found") + return (__nvmlDeviceGetInforomConfigurationChecksum)( + device, checksum) + + +cdef nvmlReturn_t _nvmlDeviceValidateInforom(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceValidateInforom + _check_or_init_nvml() + if __nvmlDeviceValidateInforom == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceValidateInforom is not found") + return (__nvmlDeviceValidateInforom)( + device) + + +cdef nvmlReturn_t _nvmlDeviceGetLastBBXFlushTime(nvmlDevice_t device, unsigned long long* timestamp, unsigned long* durationUs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetLastBBXFlushTime + _check_or_init_nvml() + if __nvmlDeviceGetLastBBXFlushTime == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetLastBBXFlushTime is not found") + return (__nvmlDeviceGetLastBBXFlushTime)( + device, timestamp, durationUs) + + +cdef nvmlReturn_t _nvmlDeviceGetDisplayMode(nvmlDevice_t device, nvmlEnableState_t* display) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetDisplayMode + _check_or_init_nvml() + if __nvmlDeviceGetDisplayMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetDisplayMode is not found") + return (__nvmlDeviceGetDisplayMode)( + device, display) + + +cdef nvmlReturn_t _nvmlDeviceGetDisplayActive(nvmlDevice_t device, nvmlEnableState_t* isActive) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetDisplayActive + _check_or_init_nvml() + if __nvmlDeviceGetDisplayActive == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetDisplayActive is not found") + return (__nvmlDeviceGetDisplayActive)( + device, isActive) + + +cdef nvmlReturn_t _nvmlDeviceGetPersistenceMode(nvmlDevice_t device, nvmlEnableState_t* mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPersistenceMode + _check_or_init_nvml() + if __nvmlDeviceGetPersistenceMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPersistenceMode is not found") + return (__nvmlDeviceGetPersistenceMode)( + device, mode) + + +cdef nvmlReturn_t _nvmlDeviceGetPciInfoExt(nvmlDevice_t device, nvmlPciInfoExt_t* pci) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPciInfoExt + _check_or_init_nvml() + if __nvmlDeviceGetPciInfoExt == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPciInfoExt is not found") + return (__nvmlDeviceGetPciInfoExt)( + device, pci) + + +cdef nvmlReturn_t _nvmlDeviceGetPciInfo_v3(nvmlDevice_t device, nvmlPciInfo_t* pci) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPciInfo_v3 + _check_or_init_nvml() + if __nvmlDeviceGetPciInfo_v3 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPciInfo_v3 is not found") + return (__nvmlDeviceGetPciInfo_v3)( + device, pci) + + +cdef nvmlReturn_t _nvmlDeviceGetMaxPcieLinkGeneration(nvmlDevice_t device, unsigned int* maxLinkGen) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMaxPcieLinkGeneration + _check_or_init_nvml() + if __nvmlDeviceGetMaxPcieLinkGeneration == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMaxPcieLinkGeneration is not found") + return (__nvmlDeviceGetMaxPcieLinkGeneration)( + device, maxLinkGen) + + +cdef nvmlReturn_t _nvmlDeviceGetGpuMaxPcieLinkGeneration(nvmlDevice_t device, unsigned int* maxLinkGenDevice) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGpuMaxPcieLinkGeneration + _check_or_init_nvml() + if __nvmlDeviceGetGpuMaxPcieLinkGeneration == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGpuMaxPcieLinkGeneration is not found") + return (__nvmlDeviceGetGpuMaxPcieLinkGeneration)( + device, maxLinkGenDevice) + + +cdef nvmlReturn_t _nvmlDeviceGetMaxPcieLinkWidth(nvmlDevice_t device, unsigned int* maxLinkWidth) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMaxPcieLinkWidth + _check_or_init_nvml() + if __nvmlDeviceGetMaxPcieLinkWidth == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMaxPcieLinkWidth is not found") + return (__nvmlDeviceGetMaxPcieLinkWidth)( + device, maxLinkWidth) + + +cdef nvmlReturn_t _nvmlDeviceGetCurrPcieLinkGeneration(nvmlDevice_t device, unsigned int* currLinkGen) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetCurrPcieLinkGeneration + _check_or_init_nvml() + if __nvmlDeviceGetCurrPcieLinkGeneration == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetCurrPcieLinkGeneration is not found") + return (__nvmlDeviceGetCurrPcieLinkGeneration)( + device, currLinkGen) + + +cdef nvmlReturn_t _nvmlDeviceGetCurrPcieLinkWidth(nvmlDevice_t device, unsigned int* currLinkWidth) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetCurrPcieLinkWidth + _check_or_init_nvml() + if __nvmlDeviceGetCurrPcieLinkWidth == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetCurrPcieLinkWidth is not found") + return (__nvmlDeviceGetCurrPcieLinkWidth)( + device, currLinkWidth) + + +cdef nvmlReturn_t _nvmlDeviceGetPcieThroughput(nvmlDevice_t device, nvmlPcieUtilCounter_t counter, unsigned int* value) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPcieThroughput + _check_or_init_nvml() + if __nvmlDeviceGetPcieThroughput == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPcieThroughput is not found") + return (__nvmlDeviceGetPcieThroughput)( + device, counter, value) + + +cdef nvmlReturn_t _nvmlDeviceGetPcieReplayCounter(nvmlDevice_t device, unsigned int* value) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPcieReplayCounter + _check_or_init_nvml() + if __nvmlDeviceGetPcieReplayCounter == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPcieReplayCounter is not found") + return (__nvmlDeviceGetPcieReplayCounter)( + device, value) + + +cdef nvmlReturn_t _nvmlDeviceGetClockInfo(nvmlDevice_t device, nvmlClockType_t type, unsigned int* clock) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetClockInfo + _check_or_init_nvml() + if __nvmlDeviceGetClockInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetClockInfo is not found") + return (__nvmlDeviceGetClockInfo)( + device, type, clock) + + +cdef nvmlReturn_t _nvmlDeviceGetMaxClockInfo(nvmlDevice_t device, nvmlClockType_t type, unsigned int* clock) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMaxClockInfo + _check_or_init_nvml() + if __nvmlDeviceGetMaxClockInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMaxClockInfo is not found") + return (__nvmlDeviceGetMaxClockInfo)( + device, type, clock) + + +cdef nvmlReturn_t _nvmlDeviceGetGpcClkVfOffset(nvmlDevice_t device, int* offset) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGpcClkVfOffset + _check_or_init_nvml() + if __nvmlDeviceGetGpcClkVfOffset == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGpcClkVfOffset is not found") + return (__nvmlDeviceGetGpcClkVfOffset)( + device, offset) + + +cdef nvmlReturn_t _nvmlDeviceGetClock(nvmlDevice_t device, nvmlClockType_t clockType, nvmlClockId_t clockId, unsigned int* clockMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetClock + _check_or_init_nvml() + if __nvmlDeviceGetClock == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetClock is not found") + return (__nvmlDeviceGetClock)( + device, clockType, clockId, clockMHz) + + +cdef nvmlReturn_t _nvmlDeviceGetMaxCustomerBoostClock(nvmlDevice_t device, nvmlClockType_t clockType, unsigned int* clockMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMaxCustomerBoostClock + _check_or_init_nvml() + if __nvmlDeviceGetMaxCustomerBoostClock == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMaxCustomerBoostClock is not found") + return (__nvmlDeviceGetMaxCustomerBoostClock)( + device, clockType, clockMHz) + + +cdef nvmlReturn_t _nvmlDeviceGetSupportedMemoryClocks(nvmlDevice_t device, unsigned int* count, unsigned int* clocksMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetSupportedMemoryClocks + _check_or_init_nvml() + if __nvmlDeviceGetSupportedMemoryClocks == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetSupportedMemoryClocks is not found") + return (__nvmlDeviceGetSupportedMemoryClocks)( + device, count, clocksMHz) + + +cdef nvmlReturn_t _nvmlDeviceGetSupportedGraphicsClocks(nvmlDevice_t device, unsigned int memoryClockMHz, unsigned int* count, unsigned int* clocksMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetSupportedGraphicsClocks + _check_or_init_nvml() + if __nvmlDeviceGetSupportedGraphicsClocks == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetSupportedGraphicsClocks is not found") + return (__nvmlDeviceGetSupportedGraphicsClocks)( + device, memoryClockMHz, count, clocksMHz) + + +cdef nvmlReturn_t _nvmlDeviceGetAutoBoostedClocksEnabled(nvmlDevice_t device, nvmlEnableState_t* isEnabled, nvmlEnableState_t* defaultIsEnabled) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetAutoBoostedClocksEnabled + _check_or_init_nvml() + if __nvmlDeviceGetAutoBoostedClocksEnabled == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetAutoBoostedClocksEnabled is not found") + return (__nvmlDeviceGetAutoBoostedClocksEnabled)( + device, isEnabled, defaultIsEnabled) + + +cdef nvmlReturn_t _nvmlDeviceGetFanSpeed(nvmlDevice_t device, unsigned int* speed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetFanSpeed + _check_or_init_nvml() + if __nvmlDeviceGetFanSpeed == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetFanSpeed is not found") + return (__nvmlDeviceGetFanSpeed)( + device, speed) + + +cdef nvmlReturn_t _nvmlDeviceGetFanSpeed_v2(nvmlDevice_t device, unsigned int fan, unsigned int* speed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetFanSpeed_v2 + _check_or_init_nvml() + if __nvmlDeviceGetFanSpeed_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetFanSpeed_v2 is not found") + return (__nvmlDeviceGetFanSpeed_v2)( + device, fan, speed) + + +cdef nvmlReturn_t _nvmlDeviceGetFanSpeedRPM(nvmlDevice_t device, nvmlFanSpeedInfo_t* fanSpeed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetFanSpeedRPM + _check_or_init_nvml() + if __nvmlDeviceGetFanSpeedRPM == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetFanSpeedRPM is not found") + return (__nvmlDeviceGetFanSpeedRPM)( + device, fanSpeed) + + +cdef nvmlReturn_t _nvmlDeviceGetTargetFanSpeed(nvmlDevice_t device, unsigned int fan, unsigned int* targetSpeed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetTargetFanSpeed + _check_or_init_nvml() + if __nvmlDeviceGetTargetFanSpeed == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetTargetFanSpeed is not found") + return (__nvmlDeviceGetTargetFanSpeed)( + device, fan, targetSpeed) + + +cdef nvmlReturn_t _nvmlDeviceGetMinMaxFanSpeed(nvmlDevice_t device, unsigned int* minSpeed, unsigned int* maxSpeed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMinMaxFanSpeed + _check_or_init_nvml() + if __nvmlDeviceGetMinMaxFanSpeed == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMinMaxFanSpeed is not found") + return (__nvmlDeviceGetMinMaxFanSpeed)( + device, minSpeed, maxSpeed) + + +cdef nvmlReturn_t _nvmlDeviceGetFanControlPolicy_v2(nvmlDevice_t device, unsigned int fan, nvmlFanControlPolicy_t* policy) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetFanControlPolicy_v2 + _check_or_init_nvml() + if __nvmlDeviceGetFanControlPolicy_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetFanControlPolicy_v2 is not found") + return (__nvmlDeviceGetFanControlPolicy_v2)( + device, fan, policy) + + +cdef nvmlReturn_t _nvmlDeviceGetNumFans(nvmlDevice_t device, unsigned int* numFans) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetNumFans + _check_or_init_nvml() + if __nvmlDeviceGetNumFans == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetNumFans is not found") + return (__nvmlDeviceGetNumFans)( + device, numFans) + + +cdef nvmlReturn_t _nvmlDeviceGetCoolerInfo(nvmlDevice_t device, nvmlCoolerInfo_t* coolerInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetCoolerInfo + _check_or_init_nvml() + if __nvmlDeviceGetCoolerInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetCoolerInfo is not found") + return (__nvmlDeviceGetCoolerInfo)( + device, coolerInfo) + + +cdef nvmlReturn_t _nvmlDeviceGetTemperatureV(nvmlDevice_t device, nvmlTemperature_t* temperature) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetTemperatureV + _check_or_init_nvml() + if __nvmlDeviceGetTemperatureV == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetTemperatureV is not found") + return (__nvmlDeviceGetTemperatureV)( + device, temperature) + + +cdef nvmlReturn_t _nvmlDeviceGetTemperatureThreshold(nvmlDevice_t device, nvmlTemperatureThresholds_t thresholdType, unsigned int* temp) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetTemperatureThreshold + _check_or_init_nvml() + if __nvmlDeviceGetTemperatureThreshold == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetTemperatureThreshold is not found") + return (__nvmlDeviceGetTemperatureThreshold)( + device, thresholdType, temp) + + +cdef nvmlReturn_t _nvmlDeviceGetMarginTemperature(nvmlDevice_t device, nvmlMarginTemperature_t* marginTempInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMarginTemperature + _check_or_init_nvml() + if __nvmlDeviceGetMarginTemperature == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMarginTemperature is not found") + return (__nvmlDeviceGetMarginTemperature)( + device, marginTempInfo) + + +cdef nvmlReturn_t _nvmlDeviceGetThermalSettings(nvmlDevice_t device, unsigned int sensorIndex, nvmlGpuThermalSettings_t* pThermalSettings) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetThermalSettings + _check_or_init_nvml() + if __nvmlDeviceGetThermalSettings == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetThermalSettings is not found") + return (__nvmlDeviceGetThermalSettings)( + device, sensorIndex, pThermalSettings) + + +cdef nvmlReturn_t _nvmlDeviceGetPerformanceState(nvmlDevice_t device, nvmlPstates_t* pState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPerformanceState + _check_or_init_nvml() + if __nvmlDeviceGetPerformanceState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPerformanceState is not found") + return (__nvmlDeviceGetPerformanceState)( + device, pState) + + +cdef nvmlReturn_t _nvmlDeviceGetCurrentClocksEventReasons(nvmlDevice_t device, unsigned long long* clocksEventReasons) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetCurrentClocksEventReasons + _check_or_init_nvml() + if __nvmlDeviceGetCurrentClocksEventReasons == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetCurrentClocksEventReasons is not found") + return (__nvmlDeviceGetCurrentClocksEventReasons)( + device, clocksEventReasons) + + +cdef nvmlReturn_t _nvmlDeviceGetSupportedClocksEventReasons(nvmlDevice_t device, unsigned long long* supportedClocksEventReasons) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetSupportedClocksEventReasons + _check_or_init_nvml() + if __nvmlDeviceGetSupportedClocksEventReasons == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetSupportedClocksEventReasons is not found") + return (__nvmlDeviceGetSupportedClocksEventReasons)( + device, supportedClocksEventReasons) + + +cdef nvmlReturn_t _nvmlDeviceGetPowerState(nvmlDevice_t device, nvmlPstates_t* pState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPowerState + _check_or_init_nvml() + if __nvmlDeviceGetPowerState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPowerState is not found") + return (__nvmlDeviceGetPowerState)( + device, pState) + + +cdef nvmlReturn_t _nvmlDeviceGetDynamicPstatesInfo(nvmlDevice_t device, nvmlGpuDynamicPstatesInfo_t* pDynamicPstatesInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetDynamicPstatesInfo + _check_or_init_nvml() + if __nvmlDeviceGetDynamicPstatesInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetDynamicPstatesInfo is not found") + return (__nvmlDeviceGetDynamicPstatesInfo)( + device, pDynamicPstatesInfo) + + +cdef nvmlReturn_t _nvmlDeviceGetMemClkVfOffset(nvmlDevice_t device, int* offset) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMemClkVfOffset + _check_or_init_nvml() + if __nvmlDeviceGetMemClkVfOffset == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMemClkVfOffset is not found") + return (__nvmlDeviceGetMemClkVfOffset)( + device, offset) + + +cdef nvmlReturn_t _nvmlDeviceGetMinMaxClockOfPState(nvmlDevice_t device, nvmlClockType_t type, nvmlPstates_t pstate, unsigned int* minClockMHz, unsigned int* maxClockMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMinMaxClockOfPState + _check_or_init_nvml() + if __nvmlDeviceGetMinMaxClockOfPState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMinMaxClockOfPState is not found") + return (__nvmlDeviceGetMinMaxClockOfPState)( + device, type, pstate, minClockMHz, maxClockMHz) + + +cdef nvmlReturn_t _nvmlDeviceGetSupportedPerformanceStates(nvmlDevice_t device, nvmlPstates_t* pstates, unsigned int size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetSupportedPerformanceStates + _check_or_init_nvml() + if __nvmlDeviceGetSupportedPerformanceStates == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetSupportedPerformanceStates is not found") + return (__nvmlDeviceGetSupportedPerformanceStates)( + device, pstates, size) + + +cdef nvmlReturn_t _nvmlDeviceGetGpcClkMinMaxVfOffset(nvmlDevice_t device, int* minOffset, int* maxOffset) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGpcClkMinMaxVfOffset + _check_or_init_nvml() + if __nvmlDeviceGetGpcClkMinMaxVfOffset == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGpcClkMinMaxVfOffset is not found") + return (__nvmlDeviceGetGpcClkMinMaxVfOffset)( + device, minOffset, maxOffset) + + +cdef nvmlReturn_t _nvmlDeviceGetMemClkMinMaxVfOffset(nvmlDevice_t device, int* minOffset, int* maxOffset) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMemClkMinMaxVfOffset + _check_or_init_nvml() + if __nvmlDeviceGetMemClkMinMaxVfOffset == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMemClkMinMaxVfOffset is not found") + return (__nvmlDeviceGetMemClkMinMaxVfOffset)( + device, minOffset, maxOffset) + + +cdef nvmlReturn_t _nvmlDeviceGetClockOffsets(nvmlDevice_t device, nvmlClockOffset_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetClockOffsets + _check_or_init_nvml() + if __nvmlDeviceGetClockOffsets == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetClockOffsets is not found") + return (__nvmlDeviceGetClockOffsets)( + device, info) + + +cdef nvmlReturn_t _nvmlDeviceSetClockOffsets(nvmlDevice_t device, nvmlClockOffset_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetClockOffsets + _check_or_init_nvml() + if __nvmlDeviceSetClockOffsets == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetClockOffsets is not found") + return (__nvmlDeviceSetClockOffsets)( + device, info) + + +cdef nvmlReturn_t _nvmlDeviceGetPerformanceModes(nvmlDevice_t device, nvmlDevicePerfModes_t* perfModes) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPerformanceModes + _check_or_init_nvml() + if __nvmlDeviceGetPerformanceModes == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPerformanceModes is not found") + return (__nvmlDeviceGetPerformanceModes)( + device, perfModes) + + +cdef nvmlReturn_t _nvmlDeviceGetCurrentClockFreqs(nvmlDevice_t device, nvmlDeviceCurrentClockFreqs_t* currentClockFreqs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetCurrentClockFreqs + _check_or_init_nvml() + if __nvmlDeviceGetCurrentClockFreqs == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetCurrentClockFreqs is not found") + return (__nvmlDeviceGetCurrentClockFreqs)( + device, currentClockFreqs) + + +cdef nvmlReturn_t _nvmlDeviceGetPowerManagementLimit(nvmlDevice_t device, unsigned int* limit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPowerManagementLimit + _check_or_init_nvml() + if __nvmlDeviceGetPowerManagementLimit == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPowerManagementLimit is not found") + return (__nvmlDeviceGetPowerManagementLimit)( + device, limit) + + +cdef nvmlReturn_t _nvmlDeviceGetPowerManagementLimitConstraints(nvmlDevice_t device, unsigned int* minLimit, unsigned int* maxLimit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPowerManagementLimitConstraints + _check_or_init_nvml() + if __nvmlDeviceGetPowerManagementLimitConstraints == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPowerManagementLimitConstraints is not found") + return (__nvmlDeviceGetPowerManagementLimitConstraints)( + device, minLimit, maxLimit) + + +cdef nvmlReturn_t _nvmlDeviceGetPowerManagementDefaultLimit(nvmlDevice_t device, unsigned int* defaultLimit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPowerManagementDefaultLimit + _check_or_init_nvml() + if __nvmlDeviceGetPowerManagementDefaultLimit == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPowerManagementDefaultLimit is not found") + return (__nvmlDeviceGetPowerManagementDefaultLimit)( + device, defaultLimit) + + +cdef nvmlReturn_t _nvmlDeviceGetPowerUsage(nvmlDevice_t device, unsigned int* power) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPowerUsage + _check_or_init_nvml() + if __nvmlDeviceGetPowerUsage == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPowerUsage is not found") + return (__nvmlDeviceGetPowerUsage)( + device, power) + + +cdef nvmlReturn_t _nvmlDeviceGetTotalEnergyConsumption(nvmlDevice_t device, unsigned long long* energy) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetTotalEnergyConsumption + _check_or_init_nvml() + if __nvmlDeviceGetTotalEnergyConsumption == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetTotalEnergyConsumption is not found") + return (__nvmlDeviceGetTotalEnergyConsumption)( + device, energy) + + +cdef nvmlReturn_t _nvmlDeviceGetEnforcedPowerLimit(nvmlDevice_t device, unsigned int* limit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetEnforcedPowerLimit + _check_or_init_nvml() + if __nvmlDeviceGetEnforcedPowerLimit == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetEnforcedPowerLimit is not found") + return (__nvmlDeviceGetEnforcedPowerLimit)( + device, limit) + + +cdef nvmlReturn_t _nvmlDeviceGetGpuOperationMode(nvmlDevice_t device, nvmlGpuOperationMode_t* current, nvmlGpuOperationMode_t* pending) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGpuOperationMode + _check_or_init_nvml() + if __nvmlDeviceGetGpuOperationMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGpuOperationMode is not found") + return (__nvmlDeviceGetGpuOperationMode)( + device, current, pending) + + +cdef nvmlReturn_t _nvmlDeviceGetMemoryInfo_v2(nvmlDevice_t device, nvmlMemory_v2_t* memory) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMemoryInfo_v2 + _check_or_init_nvml() + if __nvmlDeviceGetMemoryInfo_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMemoryInfo_v2 is not found") + return (__nvmlDeviceGetMemoryInfo_v2)( + device, memory) + + +cdef nvmlReturn_t _nvmlDeviceGetComputeMode(nvmlDevice_t device, nvmlComputeMode_t* mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetComputeMode + _check_or_init_nvml() + if __nvmlDeviceGetComputeMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetComputeMode is not found") + return (__nvmlDeviceGetComputeMode)( + device, mode) + + +cdef nvmlReturn_t _nvmlDeviceGetCudaComputeCapability(nvmlDevice_t device, int* major, int* minor) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetCudaComputeCapability + _check_or_init_nvml() + if __nvmlDeviceGetCudaComputeCapability == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetCudaComputeCapability is not found") + return (__nvmlDeviceGetCudaComputeCapability)( + device, major, minor) + + +cdef nvmlReturn_t _nvmlDeviceGetDramEncryptionMode(nvmlDevice_t device, nvmlDramEncryptionInfo_t* current, nvmlDramEncryptionInfo_t* pending) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetDramEncryptionMode + _check_or_init_nvml() + if __nvmlDeviceGetDramEncryptionMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetDramEncryptionMode is not found") + return (__nvmlDeviceGetDramEncryptionMode)( + device, current, pending) + + +cdef nvmlReturn_t _nvmlDeviceSetDramEncryptionMode(nvmlDevice_t device, const nvmlDramEncryptionInfo_t* dramEncryption) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetDramEncryptionMode + _check_or_init_nvml() + if __nvmlDeviceSetDramEncryptionMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetDramEncryptionMode is not found") + return (__nvmlDeviceSetDramEncryptionMode)( + device, dramEncryption) + + +cdef nvmlReturn_t _nvmlDeviceGetEccMode(nvmlDevice_t device, nvmlEnableState_t* current, nvmlEnableState_t* pending) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetEccMode + _check_or_init_nvml() + if __nvmlDeviceGetEccMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetEccMode is not found") + return (__nvmlDeviceGetEccMode)( + device, current, pending) + + +cdef nvmlReturn_t _nvmlDeviceGetDefaultEccMode(nvmlDevice_t device, nvmlEnableState_t* defaultMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetDefaultEccMode + _check_or_init_nvml() + if __nvmlDeviceGetDefaultEccMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetDefaultEccMode is not found") + return (__nvmlDeviceGetDefaultEccMode)( + device, defaultMode) + + +cdef nvmlReturn_t _nvmlDeviceGetBoardId(nvmlDevice_t device, unsigned int* boardId) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetBoardId + _check_or_init_nvml() + if __nvmlDeviceGetBoardId == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetBoardId is not found") + return (__nvmlDeviceGetBoardId)( + device, boardId) + + +cdef nvmlReturn_t _nvmlDeviceGetMultiGpuBoard(nvmlDevice_t device, unsigned int* multiGpuBool) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMultiGpuBoard + _check_or_init_nvml() + if __nvmlDeviceGetMultiGpuBoard == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMultiGpuBoard is not found") + return (__nvmlDeviceGetMultiGpuBoard)( + device, multiGpuBool) + + +cdef nvmlReturn_t _nvmlDeviceGetTotalEccErrors(nvmlDevice_t device, nvmlMemoryErrorType_t errorType, nvmlEccCounterType_t counterType, unsigned long long* eccCounts) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetTotalEccErrors + _check_or_init_nvml() + if __nvmlDeviceGetTotalEccErrors == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetTotalEccErrors is not found") + return (__nvmlDeviceGetTotalEccErrors)( + device, errorType, counterType, eccCounts) + + +cdef nvmlReturn_t _nvmlDeviceGetMemoryErrorCounter(nvmlDevice_t device, nvmlMemoryErrorType_t errorType, nvmlEccCounterType_t counterType, nvmlMemoryLocation_t locationType, unsigned long long* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMemoryErrorCounter + _check_or_init_nvml() + if __nvmlDeviceGetMemoryErrorCounter == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMemoryErrorCounter is not found") + return (__nvmlDeviceGetMemoryErrorCounter)( + device, errorType, counterType, locationType, count) + + +cdef nvmlReturn_t _nvmlDeviceGetUtilizationRates(nvmlDevice_t device, nvmlUtilization_t* utilization) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetUtilizationRates + _check_or_init_nvml() + if __nvmlDeviceGetUtilizationRates == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetUtilizationRates is not found") + return (__nvmlDeviceGetUtilizationRates)( + device, utilization) + + +cdef nvmlReturn_t _nvmlDeviceGetEncoderUtilization(nvmlDevice_t device, unsigned int* utilization, unsigned int* samplingPeriodUs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetEncoderUtilization + _check_or_init_nvml() + if __nvmlDeviceGetEncoderUtilization == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetEncoderUtilization is not found") + return (__nvmlDeviceGetEncoderUtilization)( + device, utilization, samplingPeriodUs) + + +cdef nvmlReturn_t _nvmlDeviceGetEncoderCapacity(nvmlDevice_t device, nvmlEncoderType_t encoderQueryType, unsigned int* encoderCapacity) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetEncoderCapacity + _check_or_init_nvml() + if __nvmlDeviceGetEncoderCapacity == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetEncoderCapacity is not found") + return (__nvmlDeviceGetEncoderCapacity)( + device, encoderQueryType, encoderCapacity) + + +cdef nvmlReturn_t _nvmlDeviceGetEncoderStats(nvmlDevice_t device, unsigned int* sessionCount, unsigned int* averageFps, unsigned int* averageLatency) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetEncoderStats + _check_or_init_nvml() + if __nvmlDeviceGetEncoderStats == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetEncoderStats is not found") + return (__nvmlDeviceGetEncoderStats)( + device, sessionCount, averageFps, averageLatency) + + +cdef nvmlReturn_t _nvmlDeviceGetEncoderSessions(nvmlDevice_t device, unsigned int* sessionCount, nvmlEncoderSessionInfo_t* sessionInfos) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetEncoderSessions + _check_or_init_nvml() + if __nvmlDeviceGetEncoderSessions == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetEncoderSessions is not found") + return (__nvmlDeviceGetEncoderSessions)( + device, sessionCount, sessionInfos) + + +cdef nvmlReturn_t _nvmlDeviceGetDecoderUtilization(nvmlDevice_t device, unsigned int* utilization, unsigned int* samplingPeriodUs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetDecoderUtilization + _check_or_init_nvml() + if __nvmlDeviceGetDecoderUtilization == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetDecoderUtilization is not found") + return (__nvmlDeviceGetDecoderUtilization)( + device, utilization, samplingPeriodUs) + + +cdef nvmlReturn_t _nvmlDeviceGetJpgUtilization(nvmlDevice_t device, unsigned int* utilization, unsigned int* samplingPeriodUs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetJpgUtilization + _check_or_init_nvml() + if __nvmlDeviceGetJpgUtilization == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetJpgUtilization is not found") + return (__nvmlDeviceGetJpgUtilization)( + device, utilization, samplingPeriodUs) + + +cdef nvmlReturn_t _nvmlDeviceGetOfaUtilization(nvmlDevice_t device, unsigned int* utilization, unsigned int* samplingPeriodUs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetOfaUtilization + _check_or_init_nvml() + if __nvmlDeviceGetOfaUtilization == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetOfaUtilization is not found") + return (__nvmlDeviceGetOfaUtilization)( + device, utilization, samplingPeriodUs) + + +cdef nvmlReturn_t _nvmlDeviceGetFBCStats(nvmlDevice_t device, nvmlFBCStats_t* fbcStats) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetFBCStats + _check_or_init_nvml() + if __nvmlDeviceGetFBCStats == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetFBCStats is not found") + return (__nvmlDeviceGetFBCStats)( + device, fbcStats) + + +cdef nvmlReturn_t _nvmlDeviceGetFBCSessions(nvmlDevice_t device, unsigned int* sessionCount, nvmlFBCSessionInfo_t* sessionInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetFBCSessions + _check_or_init_nvml() + if __nvmlDeviceGetFBCSessions == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetFBCSessions is not found") + return (__nvmlDeviceGetFBCSessions)( + device, sessionCount, sessionInfo) + + +cdef nvmlReturn_t _nvmlDeviceGetDriverModel_v2(nvmlDevice_t device, nvmlDriverModel_t* current, nvmlDriverModel_t* pending) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetDriverModel_v2 + _check_or_init_nvml() + if __nvmlDeviceGetDriverModel_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetDriverModel_v2 is not found") + return (__nvmlDeviceGetDriverModel_v2)( + device, current, pending) + + +cdef nvmlReturn_t _nvmlDeviceGetVbiosVersion(nvmlDevice_t device, char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVbiosVersion + _check_or_init_nvml() + if __nvmlDeviceGetVbiosVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVbiosVersion is not found") + return (__nvmlDeviceGetVbiosVersion)( + device, version, length) + + +cdef nvmlReturn_t _nvmlDeviceGetBridgeChipInfo(nvmlDevice_t device, nvmlBridgeChipHierarchy_t* bridgeHierarchy) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetBridgeChipInfo + _check_or_init_nvml() + if __nvmlDeviceGetBridgeChipInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetBridgeChipInfo is not found") + return (__nvmlDeviceGetBridgeChipInfo)( + device, bridgeHierarchy) + + +cdef nvmlReturn_t _nvmlDeviceGetComputeRunningProcesses_v3(nvmlDevice_t device, unsigned int* infoCount, nvmlProcessInfo_t* infos) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetComputeRunningProcesses_v3 + _check_or_init_nvml() + if __nvmlDeviceGetComputeRunningProcesses_v3 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetComputeRunningProcesses_v3 is not found") + return (__nvmlDeviceGetComputeRunningProcesses_v3)( + device, infoCount, infos) + + +cdef nvmlReturn_t _nvmlDeviceGetGraphicsRunningProcesses_v3(nvmlDevice_t device, unsigned int* infoCount, nvmlProcessInfo_t* infos) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGraphicsRunningProcesses_v3 + _check_or_init_nvml() + if __nvmlDeviceGetGraphicsRunningProcesses_v3 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGraphicsRunningProcesses_v3 is not found") + return (__nvmlDeviceGetGraphicsRunningProcesses_v3)( + device, infoCount, infos) + + +cdef nvmlReturn_t _nvmlDeviceGetMPSComputeRunningProcesses_v3(nvmlDevice_t device, unsigned int* infoCount, nvmlProcessInfo_t* infos) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMPSComputeRunningProcesses_v3 + _check_or_init_nvml() + if __nvmlDeviceGetMPSComputeRunningProcesses_v3 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMPSComputeRunningProcesses_v3 is not found") + return (__nvmlDeviceGetMPSComputeRunningProcesses_v3)( + device, infoCount, infos) + + +cdef nvmlReturn_t _nvmlDeviceGetRunningProcessDetailList(nvmlDevice_t device, nvmlProcessDetailList_t* plist) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetRunningProcessDetailList + _check_or_init_nvml() + if __nvmlDeviceGetRunningProcessDetailList == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetRunningProcessDetailList is not found") + return (__nvmlDeviceGetRunningProcessDetailList)( + device, plist) + + +cdef nvmlReturn_t _nvmlDeviceOnSameBoard(nvmlDevice_t device1, nvmlDevice_t device2, int* onSameBoard) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceOnSameBoard + _check_or_init_nvml() + if __nvmlDeviceOnSameBoard == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceOnSameBoard is not found") + return (__nvmlDeviceOnSameBoard)( + device1, device2, onSameBoard) + + +cdef nvmlReturn_t _nvmlDeviceGetAPIRestriction(nvmlDevice_t device, nvmlRestrictedAPI_t apiType, nvmlEnableState_t* isRestricted) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetAPIRestriction + _check_or_init_nvml() + if __nvmlDeviceGetAPIRestriction == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetAPIRestriction is not found") + return (__nvmlDeviceGetAPIRestriction)( + device, apiType, isRestricted) + + +cdef nvmlReturn_t _nvmlDeviceGetSamples(nvmlDevice_t device, nvmlSamplingType_t type, unsigned long long lastSeenTimeStamp, nvmlValueType_t* sampleValType, unsigned int* sampleCount, nvmlSample_t* samples) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetSamples + _check_or_init_nvml() + if __nvmlDeviceGetSamples == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetSamples is not found") + return (__nvmlDeviceGetSamples)( + device, type, lastSeenTimeStamp, sampleValType, sampleCount, samples) + + +cdef nvmlReturn_t _nvmlDeviceGetBAR1MemoryInfo(nvmlDevice_t device, nvmlBAR1Memory_t* bar1Memory) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetBAR1MemoryInfo + _check_or_init_nvml() + if __nvmlDeviceGetBAR1MemoryInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetBAR1MemoryInfo is not found") + return (__nvmlDeviceGetBAR1MemoryInfo)( + device, bar1Memory) + + +cdef nvmlReturn_t _nvmlDeviceGetIrqNum(nvmlDevice_t device, unsigned int* irqNum) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetIrqNum + _check_or_init_nvml() + if __nvmlDeviceGetIrqNum == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetIrqNum is not found") + return (__nvmlDeviceGetIrqNum)( + device, irqNum) + + +cdef nvmlReturn_t _nvmlDeviceGetNumGpuCores(nvmlDevice_t device, unsigned int* numCores) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetNumGpuCores + _check_or_init_nvml() + if __nvmlDeviceGetNumGpuCores == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetNumGpuCores is not found") + return (__nvmlDeviceGetNumGpuCores)( + device, numCores) + + +cdef nvmlReturn_t _nvmlDeviceGetPowerSource(nvmlDevice_t device, nvmlPowerSource_t* powerSource) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPowerSource + _check_or_init_nvml() + if __nvmlDeviceGetPowerSource == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPowerSource is not found") + return (__nvmlDeviceGetPowerSource)( + device, powerSource) + + +cdef nvmlReturn_t _nvmlDeviceGetMemoryBusWidth(nvmlDevice_t device, unsigned int* busWidth) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMemoryBusWidth + _check_or_init_nvml() + if __nvmlDeviceGetMemoryBusWidth == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMemoryBusWidth is not found") + return (__nvmlDeviceGetMemoryBusWidth)( + device, busWidth) + + +cdef nvmlReturn_t _nvmlDeviceGetPcieLinkMaxSpeed(nvmlDevice_t device, unsigned int* maxSpeed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPcieLinkMaxSpeed + _check_or_init_nvml() + if __nvmlDeviceGetPcieLinkMaxSpeed == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPcieLinkMaxSpeed is not found") + return (__nvmlDeviceGetPcieLinkMaxSpeed)( + device, maxSpeed) + + +cdef nvmlReturn_t _nvmlDeviceGetPcieSpeed(nvmlDevice_t device, unsigned int* pcieSpeed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPcieSpeed + _check_or_init_nvml() + if __nvmlDeviceGetPcieSpeed == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPcieSpeed is not found") + return (__nvmlDeviceGetPcieSpeed)( + device, pcieSpeed) + + +cdef nvmlReturn_t _nvmlDeviceGetAdaptiveClockInfoStatus(nvmlDevice_t device, unsigned int* adaptiveClockStatus) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetAdaptiveClockInfoStatus + _check_or_init_nvml() + if __nvmlDeviceGetAdaptiveClockInfoStatus == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetAdaptiveClockInfoStatus is not found") + return (__nvmlDeviceGetAdaptiveClockInfoStatus)( + device, adaptiveClockStatus) + + +cdef nvmlReturn_t _nvmlDeviceGetBusType(nvmlDevice_t device, nvmlBusType_t* type) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetBusType + _check_or_init_nvml() + if __nvmlDeviceGetBusType == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetBusType is not found") + return (__nvmlDeviceGetBusType)( + device, type) + + +cdef nvmlReturn_t _nvmlDeviceGetGpuFabricInfoV(nvmlDevice_t device, nvmlGpuFabricInfoV_t* gpuFabricInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGpuFabricInfoV + _check_or_init_nvml() + if __nvmlDeviceGetGpuFabricInfoV == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGpuFabricInfoV is not found") + return (__nvmlDeviceGetGpuFabricInfoV)( + device, gpuFabricInfo) + + +cdef nvmlReturn_t _nvmlSystemGetConfComputeCapabilities(nvmlConfComputeSystemCaps_t* capabilities) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemGetConfComputeCapabilities + _check_or_init_nvml() + if __nvmlSystemGetConfComputeCapabilities == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemGetConfComputeCapabilities is not found") + return (__nvmlSystemGetConfComputeCapabilities)( + capabilities) + + +cdef nvmlReturn_t _nvmlSystemGetConfComputeState(nvmlConfComputeSystemState_t* state) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemGetConfComputeState + _check_or_init_nvml() + if __nvmlSystemGetConfComputeState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemGetConfComputeState is not found") + return (__nvmlSystemGetConfComputeState)( + state) + + +cdef nvmlReturn_t _nvmlDeviceGetConfComputeMemSizeInfo(nvmlDevice_t device, nvmlConfComputeMemSizeInfo_t* memInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetConfComputeMemSizeInfo + _check_or_init_nvml() + if __nvmlDeviceGetConfComputeMemSizeInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetConfComputeMemSizeInfo is not found") + return (__nvmlDeviceGetConfComputeMemSizeInfo)( + device, memInfo) + + +cdef nvmlReturn_t _nvmlSystemGetConfComputeGpusReadyState(unsigned int* isAcceptingWork) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemGetConfComputeGpusReadyState + _check_or_init_nvml() + if __nvmlSystemGetConfComputeGpusReadyState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemGetConfComputeGpusReadyState is not found") + return (__nvmlSystemGetConfComputeGpusReadyState)( + isAcceptingWork) + + +cdef nvmlReturn_t _nvmlDeviceGetConfComputeProtectedMemoryUsage(nvmlDevice_t device, nvmlMemory_t* memory) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetConfComputeProtectedMemoryUsage + _check_or_init_nvml() + if __nvmlDeviceGetConfComputeProtectedMemoryUsage == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetConfComputeProtectedMemoryUsage is not found") + return (__nvmlDeviceGetConfComputeProtectedMemoryUsage)( + device, memory) + + +cdef nvmlReturn_t _nvmlDeviceGetConfComputeGpuCertificate(nvmlDevice_t device, nvmlConfComputeGpuCertificate_t* gpuCert) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetConfComputeGpuCertificate + _check_or_init_nvml() + if __nvmlDeviceGetConfComputeGpuCertificate == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetConfComputeGpuCertificate is not found") + return (__nvmlDeviceGetConfComputeGpuCertificate)( + device, gpuCert) + + +cdef nvmlReturn_t _nvmlDeviceGetConfComputeGpuAttestationReport(nvmlDevice_t device, nvmlConfComputeGpuAttestationReport_t* gpuAtstReport) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetConfComputeGpuAttestationReport + _check_or_init_nvml() + if __nvmlDeviceGetConfComputeGpuAttestationReport == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetConfComputeGpuAttestationReport is not found") + return (__nvmlDeviceGetConfComputeGpuAttestationReport)( + device, gpuAtstReport) + + +cdef nvmlReturn_t _nvmlSystemGetConfComputeKeyRotationThresholdInfo(nvmlConfComputeGetKeyRotationThresholdInfo_t* pKeyRotationThrInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemGetConfComputeKeyRotationThresholdInfo + _check_or_init_nvml() + if __nvmlSystemGetConfComputeKeyRotationThresholdInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemGetConfComputeKeyRotationThresholdInfo is not found") + return (__nvmlSystemGetConfComputeKeyRotationThresholdInfo)( + pKeyRotationThrInfo) + + +cdef nvmlReturn_t _nvmlDeviceSetConfComputeUnprotectedMemSize(nvmlDevice_t device, unsigned long long sizeKiB) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetConfComputeUnprotectedMemSize + _check_or_init_nvml() + if __nvmlDeviceSetConfComputeUnprotectedMemSize == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetConfComputeUnprotectedMemSize is not found") + return (__nvmlDeviceSetConfComputeUnprotectedMemSize)( + device, sizeKiB) + + +cdef nvmlReturn_t _nvmlSystemSetConfComputeGpusReadyState(unsigned int isAcceptingWork) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemSetConfComputeGpusReadyState + _check_or_init_nvml() + if __nvmlSystemSetConfComputeGpusReadyState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemSetConfComputeGpusReadyState is not found") + return (__nvmlSystemSetConfComputeGpusReadyState)( + isAcceptingWork) + + +cdef nvmlReturn_t _nvmlSystemSetConfComputeKeyRotationThresholdInfo(nvmlConfComputeSetKeyRotationThresholdInfo_t* pKeyRotationThrInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemSetConfComputeKeyRotationThresholdInfo + _check_or_init_nvml() + if __nvmlSystemSetConfComputeKeyRotationThresholdInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemSetConfComputeKeyRotationThresholdInfo is not found") + return (__nvmlSystemSetConfComputeKeyRotationThresholdInfo)( + pKeyRotationThrInfo) + + +cdef nvmlReturn_t _nvmlSystemGetConfComputeSettings(nvmlSystemConfComputeSettings_t* settings) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemGetConfComputeSettings + _check_or_init_nvml() + if __nvmlSystemGetConfComputeSettings == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemGetConfComputeSettings is not found") + return (__nvmlSystemGetConfComputeSettings)( + settings) + + +cdef nvmlReturn_t _nvmlDeviceGetGspFirmwareVersion(nvmlDevice_t device, char* version) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGspFirmwareVersion + _check_or_init_nvml() + if __nvmlDeviceGetGspFirmwareVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGspFirmwareVersion is not found") + return (__nvmlDeviceGetGspFirmwareVersion)( + device, version) + + +cdef nvmlReturn_t _nvmlDeviceGetGspFirmwareMode(nvmlDevice_t device, unsigned int* isEnabled, unsigned int* defaultMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGspFirmwareMode + _check_or_init_nvml() + if __nvmlDeviceGetGspFirmwareMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGspFirmwareMode is not found") + return (__nvmlDeviceGetGspFirmwareMode)( + device, isEnabled, defaultMode) + + +cdef nvmlReturn_t _nvmlDeviceGetSramEccErrorStatus(nvmlDevice_t device, nvmlEccSramErrorStatus_t* status) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetSramEccErrorStatus + _check_or_init_nvml() + if __nvmlDeviceGetSramEccErrorStatus == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetSramEccErrorStatus is not found") + return (__nvmlDeviceGetSramEccErrorStatus)( + device, status) + + +cdef nvmlReturn_t _nvmlDeviceGetAccountingMode(nvmlDevice_t device, nvmlEnableState_t* mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetAccountingMode + _check_or_init_nvml() + if __nvmlDeviceGetAccountingMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetAccountingMode is not found") + return (__nvmlDeviceGetAccountingMode)( + device, mode) + + +cdef nvmlReturn_t _nvmlDeviceGetAccountingStats(nvmlDevice_t device, unsigned int pid, nvmlAccountingStats_t* stats) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetAccountingStats + _check_or_init_nvml() + if __nvmlDeviceGetAccountingStats == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetAccountingStats is not found") + return (__nvmlDeviceGetAccountingStats)( + device, pid, stats) + + +cdef nvmlReturn_t _nvmlDeviceGetAccountingPids(nvmlDevice_t device, unsigned int* count, unsigned int* pids) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetAccountingPids + _check_or_init_nvml() + if __nvmlDeviceGetAccountingPids == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetAccountingPids is not found") + return (__nvmlDeviceGetAccountingPids)( + device, count, pids) + + +cdef nvmlReturn_t _nvmlDeviceGetAccountingBufferSize(nvmlDevice_t device, unsigned int* bufferSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetAccountingBufferSize + _check_or_init_nvml() + if __nvmlDeviceGetAccountingBufferSize == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetAccountingBufferSize is not found") + return (__nvmlDeviceGetAccountingBufferSize)( + device, bufferSize) + + +cdef nvmlReturn_t _nvmlDeviceGetRetiredPages(nvmlDevice_t device, nvmlPageRetirementCause_t cause, unsigned int* pageCount, unsigned long long* addresses) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetRetiredPages + _check_or_init_nvml() + if __nvmlDeviceGetRetiredPages == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetRetiredPages is not found") + return (__nvmlDeviceGetRetiredPages)( + device, cause, pageCount, addresses) + + +cdef nvmlReturn_t _nvmlDeviceGetRetiredPages_v2(nvmlDevice_t device, nvmlPageRetirementCause_t cause, unsigned int* pageCount, unsigned long long* addresses, unsigned long long* timestamps) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetRetiredPages_v2 + _check_or_init_nvml() + if __nvmlDeviceGetRetiredPages_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetRetiredPages_v2 is not found") + return (__nvmlDeviceGetRetiredPages_v2)( + device, cause, pageCount, addresses, timestamps) + + +cdef nvmlReturn_t _nvmlDeviceGetRetiredPagesPendingStatus(nvmlDevice_t device, nvmlEnableState_t* isPending) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetRetiredPagesPendingStatus + _check_or_init_nvml() + if __nvmlDeviceGetRetiredPagesPendingStatus == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetRetiredPagesPendingStatus is not found") + return (__nvmlDeviceGetRetiredPagesPendingStatus)( + device, isPending) + + +cdef nvmlReturn_t _nvmlDeviceGetRemappedRows(nvmlDevice_t device, unsigned int* corrRows, unsigned int* uncRows, unsigned int* isPending, unsigned int* failureOccurred) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetRemappedRows + _check_or_init_nvml() + if __nvmlDeviceGetRemappedRows == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetRemappedRows is not found") + return (__nvmlDeviceGetRemappedRows)( + device, corrRows, uncRows, isPending, failureOccurred) + + +cdef nvmlReturn_t _nvmlDeviceGetRowRemapperHistogram(nvmlDevice_t device, nvmlRowRemapperHistogramValues_t* values) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetRowRemapperHistogram + _check_or_init_nvml() + if __nvmlDeviceGetRowRemapperHistogram == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetRowRemapperHistogram is not found") + return (__nvmlDeviceGetRowRemapperHistogram)( + device, values) + + +cdef nvmlReturn_t _nvmlDeviceGetArchitecture(nvmlDevice_t device, nvmlDeviceArchitecture_t* arch) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetArchitecture + _check_or_init_nvml() + if __nvmlDeviceGetArchitecture == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetArchitecture is not found") + return (__nvmlDeviceGetArchitecture)( + device, arch) + + +cdef nvmlReturn_t _nvmlDeviceGetClkMonStatus(nvmlDevice_t device, nvmlClkMonStatus_t* status) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetClkMonStatus + _check_or_init_nvml() + if __nvmlDeviceGetClkMonStatus == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetClkMonStatus is not found") + return (__nvmlDeviceGetClkMonStatus)( + device, status) + + +cdef nvmlReturn_t _nvmlDeviceGetProcessUtilization(nvmlDevice_t device, nvmlProcessUtilizationSample_t* utilization, unsigned int* processSamplesCount, unsigned long long lastSeenTimeStamp) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetProcessUtilization + _check_or_init_nvml() + if __nvmlDeviceGetProcessUtilization == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetProcessUtilization is not found") + return (__nvmlDeviceGetProcessUtilization)( + device, utilization, processSamplesCount, lastSeenTimeStamp) + + +cdef nvmlReturn_t _nvmlDeviceGetProcessesUtilizationInfo(nvmlDevice_t device, nvmlProcessesUtilizationInfo_t* procesesUtilInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetProcessesUtilizationInfo + _check_or_init_nvml() + if __nvmlDeviceGetProcessesUtilizationInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetProcessesUtilizationInfo is not found") + return (__nvmlDeviceGetProcessesUtilizationInfo)( + device, procesesUtilInfo) + + +cdef nvmlReturn_t _nvmlDeviceGetPlatformInfo(nvmlDevice_t device, nvmlPlatformInfo_t* platformInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPlatformInfo + _check_or_init_nvml() + if __nvmlDeviceGetPlatformInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPlatformInfo is not found") + return (__nvmlDeviceGetPlatformInfo)( + device, platformInfo) + + +cdef nvmlReturn_t _nvmlUnitSetLedState(nvmlUnit_t unit, nvmlLedColor_t color) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlUnitSetLedState + _check_or_init_nvml() + if __nvmlUnitSetLedState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlUnitSetLedState is not found") + return (__nvmlUnitSetLedState)( + unit, color) + + +cdef nvmlReturn_t _nvmlDeviceSetPersistenceMode(nvmlDevice_t device, nvmlEnableState_t mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetPersistenceMode + _check_or_init_nvml() + if __nvmlDeviceSetPersistenceMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetPersistenceMode is not found") + return (__nvmlDeviceSetPersistenceMode)( + device, mode) + + +cdef nvmlReturn_t _nvmlDeviceSetComputeMode(nvmlDevice_t device, nvmlComputeMode_t mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetComputeMode + _check_or_init_nvml() + if __nvmlDeviceSetComputeMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetComputeMode is not found") + return (__nvmlDeviceSetComputeMode)( + device, mode) + + +cdef nvmlReturn_t _nvmlDeviceSetEccMode(nvmlDevice_t device, nvmlEnableState_t ecc) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetEccMode + _check_or_init_nvml() + if __nvmlDeviceSetEccMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetEccMode is not found") + return (__nvmlDeviceSetEccMode)( + device, ecc) + + +cdef nvmlReturn_t _nvmlDeviceClearEccErrorCounts(nvmlDevice_t device, nvmlEccCounterType_t counterType) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceClearEccErrorCounts + _check_or_init_nvml() + if __nvmlDeviceClearEccErrorCounts == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceClearEccErrorCounts is not found") + return (__nvmlDeviceClearEccErrorCounts)( + device, counterType) + + +cdef nvmlReturn_t _nvmlDeviceSetDriverModel(nvmlDevice_t device, nvmlDriverModel_t driverModel, unsigned int flags) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetDriverModel + _check_or_init_nvml() + if __nvmlDeviceSetDriverModel == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetDriverModel is not found") + return (__nvmlDeviceSetDriverModel)( + device, driverModel, flags) + + +cdef nvmlReturn_t _nvmlDeviceSetGpuLockedClocks(nvmlDevice_t device, unsigned int minGpuClockMHz, unsigned int maxGpuClockMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetGpuLockedClocks + _check_or_init_nvml() + if __nvmlDeviceSetGpuLockedClocks == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetGpuLockedClocks is not found") + return (__nvmlDeviceSetGpuLockedClocks)( + device, minGpuClockMHz, maxGpuClockMHz) + + +cdef nvmlReturn_t _nvmlDeviceResetGpuLockedClocks(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceResetGpuLockedClocks + _check_or_init_nvml() + if __nvmlDeviceResetGpuLockedClocks == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceResetGpuLockedClocks is not found") + return (__nvmlDeviceResetGpuLockedClocks)( + device) + + +cdef nvmlReturn_t _nvmlDeviceSetMemoryLockedClocks(nvmlDevice_t device, unsigned int minMemClockMHz, unsigned int maxMemClockMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetMemoryLockedClocks + _check_or_init_nvml() + if __nvmlDeviceSetMemoryLockedClocks == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetMemoryLockedClocks is not found") + return (__nvmlDeviceSetMemoryLockedClocks)( + device, minMemClockMHz, maxMemClockMHz) + + +cdef nvmlReturn_t _nvmlDeviceResetMemoryLockedClocks(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceResetMemoryLockedClocks + _check_or_init_nvml() + if __nvmlDeviceResetMemoryLockedClocks == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceResetMemoryLockedClocks is not found") + return (__nvmlDeviceResetMemoryLockedClocks)( + device) + + +cdef nvmlReturn_t _nvmlDeviceSetAutoBoostedClocksEnabled(nvmlDevice_t device, nvmlEnableState_t enabled) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetAutoBoostedClocksEnabled + _check_or_init_nvml() + if __nvmlDeviceSetAutoBoostedClocksEnabled == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetAutoBoostedClocksEnabled is not found") + return (__nvmlDeviceSetAutoBoostedClocksEnabled)( + device, enabled) + + +cdef nvmlReturn_t _nvmlDeviceSetDefaultAutoBoostedClocksEnabled(nvmlDevice_t device, nvmlEnableState_t enabled, unsigned int flags) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetDefaultAutoBoostedClocksEnabled + _check_or_init_nvml() + if __nvmlDeviceSetDefaultAutoBoostedClocksEnabled == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetDefaultAutoBoostedClocksEnabled is not found") + return (__nvmlDeviceSetDefaultAutoBoostedClocksEnabled)( + device, enabled, flags) + + +cdef nvmlReturn_t _nvmlDeviceSetDefaultFanSpeed_v2(nvmlDevice_t device, unsigned int fan) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetDefaultFanSpeed_v2 + _check_or_init_nvml() + if __nvmlDeviceSetDefaultFanSpeed_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetDefaultFanSpeed_v2 is not found") + return (__nvmlDeviceSetDefaultFanSpeed_v2)( + device, fan) + + +cdef nvmlReturn_t _nvmlDeviceSetFanControlPolicy(nvmlDevice_t device, unsigned int fan, nvmlFanControlPolicy_t policy) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetFanControlPolicy + _check_or_init_nvml() + if __nvmlDeviceSetFanControlPolicy == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetFanControlPolicy is not found") + return (__nvmlDeviceSetFanControlPolicy)( + device, fan, policy) + + +cdef nvmlReturn_t _nvmlDeviceSetTemperatureThreshold(nvmlDevice_t device, nvmlTemperatureThresholds_t thresholdType, int* temp) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetTemperatureThreshold + _check_or_init_nvml() + if __nvmlDeviceSetTemperatureThreshold == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetTemperatureThreshold is not found") + return (__nvmlDeviceSetTemperatureThreshold)( + device, thresholdType, temp) + + +cdef nvmlReturn_t _nvmlDeviceSetGpuOperationMode(nvmlDevice_t device, nvmlGpuOperationMode_t mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetGpuOperationMode + _check_or_init_nvml() + if __nvmlDeviceSetGpuOperationMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetGpuOperationMode is not found") + return (__nvmlDeviceSetGpuOperationMode)( + device, mode) + + +cdef nvmlReturn_t _nvmlDeviceSetAPIRestriction(nvmlDevice_t device, nvmlRestrictedAPI_t apiType, nvmlEnableState_t isRestricted) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetAPIRestriction + _check_or_init_nvml() + if __nvmlDeviceSetAPIRestriction == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetAPIRestriction is not found") + return (__nvmlDeviceSetAPIRestriction)( + device, apiType, isRestricted) + + +cdef nvmlReturn_t _nvmlDeviceSetFanSpeed_v2(nvmlDevice_t device, unsigned int fan, unsigned int speed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetFanSpeed_v2 + _check_or_init_nvml() + if __nvmlDeviceSetFanSpeed_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetFanSpeed_v2 is not found") + return (__nvmlDeviceSetFanSpeed_v2)( + device, fan, speed) + + +cdef nvmlReturn_t _nvmlDeviceSetAccountingMode(nvmlDevice_t device, nvmlEnableState_t mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetAccountingMode + _check_or_init_nvml() + if __nvmlDeviceSetAccountingMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetAccountingMode is not found") + return (__nvmlDeviceSetAccountingMode)( + device, mode) + + +cdef nvmlReturn_t _nvmlDeviceClearAccountingPids(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceClearAccountingPids + _check_or_init_nvml() + if __nvmlDeviceClearAccountingPids == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceClearAccountingPids is not found") + return (__nvmlDeviceClearAccountingPids)( + device) + + +cdef nvmlReturn_t _nvmlDeviceSetPowerManagementLimit_v2(nvmlDevice_t device, nvmlPowerValue_v2_t* powerValue) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetPowerManagementLimit_v2 + _check_or_init_nvml() + if __nvmlDeviceSetPowerManagementLimit_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetPowerManagementLimit_v2 is not found") + return (__nvmlDeviceSetPowerManagementLimit_v2)( + device, powerValue) + + +cdef nvmlReturn_t _nvmlDeviceGetNvLinkState(nvmlDevice_t device, unsigned int link, nvmlEnableState_t* isActive) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetNvLinkState + _check_or_init_nvml() + if __nvmlDeviceGetNvLinkState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetNvLinkState is not found") + return (__nvmlDeviceGetNvLinkState)( + device, link, isActive) + + +cdef nvmlReturn_t _nvmlDeviceGetNvLinkVersion(nvmlDevice_t device, unsigned int link, unsigned int* version) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetNvLinkVersion + _check_or_init_nvml() + if __nvmlDeviceGetNvLinkVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetNvLinkVersion is not found") + return (__nvmlDeviceGetNvLinkVersion)( + device, link, version) + + +cdef nvmlReturn_t _nvmlDeviceGetNvLinkCapability(nvmlDevice_t device, unsigned int link, nvmlNvLinkCapability_t capability, unsigned int* capResult) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetNvLinkCapability + _check_or_init_nvml() + if __nvmlDeviceGetNvLinkCapability == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetNvLinkCapability is not found") + return (__nvmlDeviceGetNvLinkCapability)( + device, link, capability, capResult) + + +cdef nvmlReturn_t _nvmlDeviceGetNvLinkRemotePciInfo_v2(nvmlDevice_t device, unsigned int link, nvmlPciInfo_t* pci) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetNvLinkRemotePciInfo_v2 + _check_or_init_nvml() + if __nvmlDeviceGetNvLinkRemotePciInfo_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetNvLinkRemotePciInfo_v2 is not found") + return (__nvmlDeviceGetNvLinkRemotePciInfo_v2)( + device, link, pci) + + +cdef nvmlReturn_t _nvmlDeviceGetNvLinkErrorCounter(nvmlDevice_t device, unsigned int link, nvmlNvLinkErrorCounter_t counter, unsigned long long* counterValue) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetNvLinkErrorCounter + _check_or_init_nvml() + if __nvmlDeviceGetNvLinkErrorCounter == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetNvLinkErrorCounter is not found") + return (__nvmlDeviceGetNvLinkErrorCounter)( + device, link, counter, counterValue) + + +cdef nvmlReturn_t _nvmlDeviceResetNvLinkErrorCounters(nvmlDevice_t device, unsigned int link) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceResetNvLinkErrorCounters + _check_or_init_nvml() + if __nvmlDeviceResetNvLinkErrorCounters == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceResetNvLinkErrorCounters is not found") + return (__nvmlDeviceResetNvLinkErrorCounters)( + device, link) + + +cdef nvmlReturn_t _nvmlDeviceGetNvLinkRemoteDeviceType(nvmlDevice_t device, unsigned int link, nvmlIntNvLinkDeviceType_t* pNvLinkDeviceType) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetNvLinkRemoteDeviceType + _check_or_init_nvml() + if __nvmlDeviceGetNvLinkRemoteDeviceType == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetNvLinkRemoteDeviceType is not found") + return (__nvmlDeviceGetNvLinkRemoteDeviceType)( + device, link, pNvLinkDeviceType) + + +cdef nvmlReturn_t _nvmlDeviceSetNvLinkDeviceLowPowerThreshold(nvmlDevice_t device, nvmlNvLinkPowerThres_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetNvLinkDeviceLowPowerThreshold + _check_or_init_nvml() + if __nvmlDeviceSetNvLinkDeviceLowPowerThreshold == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetNvLinkDeviceLowPowerThreshold is not found") + return (__nvmlDeviceSetNvLinkDeviceLowPowerThreshold)( + device, info) + + +cdef nvmlReturn_t _nvmlSystemSetNvlinkBwMode(unsigned int nvlinkBwMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemSetNvlinkBwMode + _check_or_init_nvml() + if __nvmlSystemSetNvlinkBwMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemSetNvlinkBwMode is not found") + return (__nvmlSystemSetNvlinkBwMode)( + nvlinkBwMode) + + +cdef nvmlReturn_t _nvmlSystemGetNvlinkBwMode(unsigned int* nvlinkBwMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemGetNvlinkBwMode + _check_or_init_nvml() + if __nvmlSystemGetNvlinkBwMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemGetNvlinkBwMode is not found") + return (__nvmlSystemGetNvlinkBwMode)( + nvlinkBwMode) + + +cdef nvmlReturn_t _nvmlDeviceGetNvlinkSupportedBwModes(nvmlDevice_t device, nvmlNvlinkSupportedBwModes_t* supportedBwMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetNvlinkSupportedBwModes + _check_or_init_nvml() + if __nvmlDeviceGetNvlinkSupportedBwModes == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetNvlinkSupportedBwModes is not found") + return (__nvmlDeviceGetNvlinkSupportedBwModes)( + device, supportedBwMode) + + +cdef nvmlReturn_t _nvmlDeviceGetNvlinkBwMode(nvmlDevice_t device, nvmlNvlinkGetBwMode_t* getBwMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetNvlinkBwMode + _check_or_init_nvml() + if __nvmlDeviceGetNvlinkBwMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetNvlinkBwMode is not found") + return (__nvmlDeviceGetNvlinkBwMode)( + device, getBwMode) + + +cdef nvmlReturn_t _nvmlDeviceSetNvlinkBwMode(nvmlDevice_t device, nvmlNvlinkSetBwMode_t* setBwMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetNvlinkBwMode + _check_or_init_nvml() + if __nvmlDeviceSetNvlinkBwMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetNvlinkBwMode is not found") + return (__nvmlDeviceSetNvlinkBwMode)( + device, setBwMode) + + +cdef nvmlReturn_t _nvmlEventSetCreate(nvmlEventSet_t* set) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlEventSetCreate + _check_or_init_nvml() + if __nvmlEventSetCreate == NULL: + with gil: + raise FunctionNotFoundError("function nvmlEventSetCreate is not found") + return (__nvmlEventSetCreate)( + set) + + +cdef nvmlReturn_t _nvmlDeviceRegisterEvents(nvmlDevice_t device, unsigned long long eventTypes, nvmlEventSet_t set) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceRegisterEvents + _check_or_init_nvml() + if __nvmlDeviceRegisterEvents == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceRegisterEvents is not found") + return (__nvmlDeviceRegisterEvents)( + device, eventTypes, set) + + +cdef nvmlReturn_t _nvmlDeviceGetSupportedEventTypes(nvmlDevice_t device, unsigned long long* eventTypes) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetSupportedEventTypes + _check_or_init_nvml() + if __nvmlDeviceGetSupportedEventTypes == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetSupportedEventTypes is not found") + return (__nvmlDeviceGetSupportedEventTypes)( + device, eventTypes) + + +cdef nvmlReturn_t _nvmlEventSetWait_v2(nvmlEventSet_t set, nvmlEventData_t* data, unsigned int timeoutms) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlEventSetWait_v2 + _check_or_init_nvml() + if __nvmlEventSetWait_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlEventSetWait_v2 is not found") + return (__nvmlEventSetWait_v2)( + set, data, timeoutms) + + +cdef nvmlReturn_t _nvmlEventSetFree(nvmlEventSet_t set) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlEventSetFree + _check_or_init_nvml() + if __nvmlEventSetFree == NULL: + with gil: + raise FunctionNotFoundError("function nvmlEventSetFree is not found") + return (__nvmlEventSetFree)( + set) + + +cdef nvmlReturn_t _nvmlSystemEventSetCreate(nvmlSystemEventSetCreateRequest_t* request) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemEventSetCreate + _check_or_init_nvml() + if __nvmlSystemEventSetCreate == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemEventSetCreate is not found") + return (__nvmlSystemEventSetCreate)( + request) + + +cdef nvmlReturn_t _nvmlSystemEventSetFree(nvmlSystemEventSetFreeRequest_t* request) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemEventSetFree + _check_or_init_nvml() + if __nvmlSystemEventSetFree == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemEventSetFree is not found") + return (__nvmlSystemEventSetFree)( + request) + + +cdef nvmlReturn_t _nvmlSystemRegisterEvents(nvmlSystemRegisterEventRequest_t* request) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemRegisterEvents + _check_or_init_nvml() + if __nvmlSystemRegisterEvents == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemRegisterEvents is not found") + return (__nvmlSystemRegisterEvents)( + request) + + +cdef nvmlReturn_t _nvmlSystemEventSetWait(nvmlSystemEventSetWaitRequest_t* request) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemEventSetWait + _check_or_init_nvml() + if __nvmlSystemEventSetWait == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemEventSetWait is not found") + return (__nvmlSystemEventSetWait)( + request) + + +cdef nvmlReturn_t _nvmlDeviceModifyDrainState(nvmlPciInfo_t* pciInfo, nvmlEnableState_t newState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceModifyDrainState + _check_or_init_nvml() + if __nvmlDeviceModifyDrainState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceModifyDrainState is not found") + return (__nvmlDeviceModifyDrainState)( + pciInfo, newState) + + +cdef nvmlReturn_t _nvmlDeviceQueryDrainState(nvmlPciInfo_t* pciInfo, nvmlEnableState_t* currentState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceQueryDrainState + _check_or_init_nvml() + if __nvmlDeviceQueryDrainState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceQueryDrainState is not found") + return (__nvmlDeviceQueryDrainState)( + pciInfo, currentState) + + +cdef nvmlReturn_t _nvmlDeviceRemoveGpu_v2(nvmlPciInfo_t* pciInfo, nvmlDetachGpuState_t gpuState, nvmlPcieLinkState_t linkState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceRemoveGpu_v2 + _check_or_init_nvml() + if __nvmlDeviceRemoveGpu_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceRemoveGpu_v2 is not found") + return (__nvmlDeviceRemoveGpu_v2)( + pciInfo, gpuState, linkState) + + +cdef nvmlReturn_t _nvmlDeviceDiscoverGpus(nvmlPciInfo_t* pciInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceDiscoverGpus + _check_or_init_nvml() + if __nvmlDeviceDiscoverGpus == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceDiscoverGpus is not found") + return (__nvmlDeviceDiscoverGpus)( + pciInfo) + + +cdef nvmlReturn_t _nvmlDeviceGetFieldValues(nvmlDevice_t device, int valuesCount, nvmlFieldValue_t* values) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetFieldValues + _check_or_init_nvml() + if __nvmlDeviceGetFieldValues == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetFieldValues is not found") + return (__nvmlDeviceGetFieldValues)( + device, valuesCount, values) + + +cdef nvmlReturn_t _nvmlDeviceClearFieldValues(nvmlDevice_t device, int valuesCount, nvmlFieldValue_t* values) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceClearFieldValues + _check_or_init_nvml() + if __nvmlDeviceClearFieldValues == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceClearFieldValues is not found") + return (__nvmlDeviceClearFieldValues)( + device, valuesCount, values) + + +cdef nvmlReturn_t _nvmlDeviceGetVirtualizationMode(nvmlDevice_t device, nvmlGpuVirtualizationMode_t* pVirtualMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVirtualizationMode + _check_or_init_nvml() + if __nvmlDeviceGetVirtualizationMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVirtualizationMode is not found") + return (__nvmlDeviceGetVirtualizationMode)( + device, pVirtualMode) + + +cdef nvmlReturn_t _nvmlDeviceGetHostVgpuMode(nvmlDevice_t device, nvmlHostVgpuMode_t* pHostVgpuMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetHostVgpuMode + _check_or_init_nvml() + if __nvmlDeviceGetHostVgpuMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetHostVgpuMode is not found") + return (__nvmlDeviceGetHostVgpuMode)( + device, pHostVgpuMode) + + +cdef nvmlReturn_t _nvmlDeviceSetVirtualizationMode(nvmlDevice_t device, nvmlGpuVirtualizationMode_t virtualMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetVirtualizationMode + _check_or_init_nvml() + if __nvmlDeviceSetVirtualizationMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetVirtualizationMode is not found") + return (__nvmlDeviceSetVirtualizationMode)( + device, virtualMode) + + +cdef nvmlReturn_t _nvmlDeviceGetVgpuHeterogeneousMode(nvmlDevice_t device, nvmlVgpuHeterogeneousMode_t* pHeterogeneousMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVgpuHeterogeneousMode + _check_or_init_nvml() + if __nvmlDeviceGetVgpuHeterogeneousMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVgpuHeterogeneousMode is not found") + return (__nvmlDeviceGetVgpuHeterogeneousMode)( + device, pHeterogeneousMode) + + +cdef nvmlReturn_t _nvmlDeviceSetVgpuHeterogeneousMode(nvmlDevice_t device, const nvmlVgpuHeterogeneousMode_t* pHeterogeneousMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetVgpuHeterogeneousMode + _check_or_init_nvml() + if __nvmlDeviceSetVgpuHeterogeneousMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetVgpuHeterogeneousMode is not found") + return (__nvmlDeviceSetVgpuHeterogeneousMode)( + device, pHeterogeneousMode) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetPlacementId(nvmlVgpuInstance_t vgpuInstance, nvmlVgpuPlacementId_t* pPlacement) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetPlacementId + _check_or_init_nvml() + if __nvmlVgpuInstanceGetPlacementId == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetPlacementId is not found") + return (__nvmlVgpuInstanceGetPlacementId)( + vgpuInstance, pPlacement) + + +cdef nvmlReturn_t _nvmlDeviceGetVgpuTypeSupportedPlacements(nvmlDevice_t device, nvmlVgpuTypeId_t vgpuTypeId, nvmlVgpuPlacementList_t* pPlacementList) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVgpuTypeSupportedPlacements + _check_or_init_nvml() + if __nvmlDeviceGetVgpuTypeSupportedPlacements == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVgpuTypeSupportedPlacements is not found") + return (__nvmlDeviceGetVgpuTypeSupportedPlacements)( + device, vgpuTypeId, pPlacementList) + + +cdef nvmlReturn_t _nvmlDeviceGetVgpuTypeCreatablePlacements(nvmlDevice_t device, nvmlVgpuTypeId_t vgpuTypeId, nvmlVgpuPlacementList_t* pPlacementList) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVgpuTypeCreatablePlacements + _check_or_init_nvml() + if __nvmlDeviceGetVgpuTypeCreatablePlacements == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVgpuTypeCreatablePlacements is not found") + return (__nvmlDeviceGetVgpuTypeCreatablePlacements)( + device, vgpuTypeId, pPlacementList) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetGspHeapSize(nvmlVgpuTypeId_t vgpuTypeId, unsigned long long* gspHeapSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetGspHeapSize + _check_or_init_nvml() + if __nvmlVgpuTypeGetGspHeapSize == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetGspHeapSize is not found") + return (__nvmlVgpuTypeGetGspHeapSize)( + vgpuTypeId, gspHeapSize) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetFbReservation(nvmlVgpuTypeId_t vgpuTypeId, unsigned long long* fbReservation) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetFbReservation + _check_or_init_nvml() + if __nvmlVgpuTypeGetFbReservation == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetFbReservation is not found") + return (__nvmlVgpuTypeGetFbReservation)( + vgpuTypeId, fbReservation) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetRuntimeStateSize(nvmlVgpuInstance_t vgpuInstance, nvmlVgpuRuntimeState_t* pState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetRuntimeStateSize + _check_or_init_nvml() + if __nvmlVgpuInstanceGetRuntimeStateSize == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetRuntimeStateSize is not found") + return (__nvmlVgpuInstanceGetRuntimeStateSize)( + vgpuInstance, pState) + + +cdef nvmlReturn_t _nvmlDeviceSetVgpuCapabilities(nvmlDevice_t device, nvmlDeviceVgpuCapability_t capability, nvmlEnableState_t state) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetVgpuCapabilities + _check_or_init_nvml() + if __nvmlDeviceSetVgpuCapabilities == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetVgpuCapabilities is not found") + return (__nvmlDeviceSetVgpuCapabilities)( + device, capability, state) + + +cdef nvmlReturn_t _nvmlDeviceGetGridLicensableFeatures_v4(nvmlDevice_t device, nvmlGridLicensableFeatures_t* pGridLicensableFeatures) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGridLicensableFeatures_v4 + _check_or_init_nvml() + if __nvmlDeviceGetGridLicensableFeatures_v4 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGridLicensableFeatures_v4 is not found") + return (__nvmlDeviceGetGridLicensableFeatures_v4)( + device, pGridLicensableFeatures) + + +cdef nvmlReturn_t _nvmlGetVgpuDriverCapabilities(nvmlVgpuDriverCapability_t capability, unsigned int* capResult) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGetVgpuDriverCapabilities + _check_or_init_nvml() + if __nvmlGetVgpuDriverCapabilities == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGetVgpuDriverCapabilities is not found") + return (__nvmlGetVgpuDriverCapabilities)( + capability, capResult) + + +cdef nvmlReturn_t _nvmlDeviceGetVgpuCapabilities(nvmlDevice_t device, nvmlDeviceVgpuCapability_t capability, unsigned int* capResult) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVgpuCapabilities + _check_or_init_nvml() + if __nvmlDeviceGetVgpuCapabilities == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVgpuCapabilities is not found") + return (__nvmlDeviceGetVgpuCapabilities)( + device, capability, capResult) + + +cdef nvmlReturn_t _nvmlDeviceGetSupportedVgpus(nvmlDevice_t device, unsigned int* vgpuCount, nvmlVgpuTypeId_t* vgpuTypeIds) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetSupportedVgpus + _check_or_init_nvml() + if __nvmlDeviceGetSupportedVgpus == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetSupportedVgpus is not found") + return (__nvmlDeviceGetSupportedVgpus)( + device, vgpuCount, vgpuTypeIds) + + +cdef nvmlReturn_t _nvmlDeviceGetCreatableVgpus(nvmlDevice_t device, unsigned int* vgpuCount, nvmlVgpuTypeId_t* vgpuTypeIds) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetCreatableVgpus + _check_or_init_nvml() + if __nvmlDeviceGetCreatableVgpus == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetCreatableVgpus is not found") + return (__nvmlDeviceGetCreatableVgpus)( + device, vgpuCount, vgpuTypeIds) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetClass(nvmlVgpuTypeId_t vgpuTypeId, char* vgpuTypeClass, unsigned int* size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetClass + _check_or_init_nvml() + if __nvmlVgpuTypeGetClass == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetClass is not found") + return (__nvmlVgpuTypeGetClass)( + vgpuTypeId, vgpuTypeClass, size) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetName(nvmlVgpuTypeId_t vgpuTypeId, char* vgpuTypeName, unsigned int* size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetName + _check_or_init_nvml() + if __nvmlVgpuTypeGetName == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetName is not found") + return (__nvmlVgpuTypeGetName)( + vgpuTypeId, vgpuTypeName, size) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetGpuInstanceProfileId(nvmlVgpuTypeId_t vgpuTypeId, unsigned int* gpuInstanceProfileId) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetGpuInstanceProfileId + _check_or_init_nvml() + if __nvmlVgpuTypeGetGpuInstanceProfileId == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetGpuInstanceProfileId is not found") + return (__nvmlVgpuTypeGetGpuInstanceProfileId)( + vgpuTypeId, gpuInstanceProfileId) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetDeviceID(nvmlVgpuTypeId_t vgpuTypeId, unsigned long long* deviceID, unsigned long long* subsystemID) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetDeviceID + _check_or_init_nvml() + if __nvmlVgpuTypeGetDeviceID == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetDeviceID is not found") + return (__nvmlVgpuTypeGetDeviceID)( + vgpuTypeId, deviceID, subsystemID) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetFramebufferSize(nvmlVgpuTypeId_t vgpuTypeId, unsigned long long* fbSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetFramebufferSize + _check_or_init_nvml() + if __nvmlVgpuTypeGetFramebufferSize == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetFramebufferSize is not found") + return (__nvmlVgpuTypeGetFramebufferSize)( + vgpuTypeId, fbSize) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetNumDisplayHeads(nvmlVgpuTypeId_t vgpuTypeId, unsigned int* numDisplayHeads) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetNumDisplayHeads + _check_or_init_nvml() + if __nvmlVgpuTypeGetNumDisplayHeads == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetNumDisplayHeads is not found") + return (__nvmlVgpuTypeGetNumDisplayHeads)( + vgpuTypeId, numDisplayHeads) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetResolution(nvmlVgpuTypeId_t vgpuTypeId, unsigned int displayIndex, unsigned int* xdim, unsigned int* ydim) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetResolution + _check_or_init_nvml() + if __nvmlVgpuTypeGetResolution == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetResolution is not found") + return (__nvmlVgpuTypeGetResolution)( + vgpuTypeId, displayIndex, xdim, ydim) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetLicense(nvmlVgpuTypeId_t vgpuTypeId, char* vgpuTypeLicenseString, unsigned int size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetLicense + _check_or_init_nvml() + if __nvmlVgpuTypeGetLicense == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetLicense is not found") + return (__nvmlVgpuTypeGetLicense)( + vgpuTypeId, vgpuTypeLicenseString, size) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetFrameRateLimit(nvmlVgpuTypeId_t vgpuTypeId, unsigned int* frameRateLimit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetFrameRateLimit + _check_or_init_nvml() + if __nvmlVgpuTypeGetFrameRateLimit == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetFrameRateLimit is not found") + return (__nvmlVgpuTypeGetFrameRateLimit)( + vgpuTypeId, frameRateLimit) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetMaxInstances(nvmlDevice_t device, nvmlVgpuTypeId_t vgpuTypeId, unsigned int* vgpuInstanceCount) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetMaxInstances + _check_or_init_nvml() + if __nvmlVgpuTypeGetMaxInstances == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetMaxInstances is not found") + return (__nvmlVgpuTypeGetMaxInstances)( + device, vgpuTypeId, vgpuInstanceCount) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetMaxInstancesPerVm(nvmlVgpuTypeId_t vgpuTypeId, unsigned int* vgpuInstanceCountPerVm) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetMaxInstancesPerVm + _check_or_init_nvml() + if __nvmlVgpuTypeGetMaxInstancesPerVm == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetMaxInstancesPerVm is not found") + return (__nvmlVgpuTypeGetMaxInstancesPerVm)( + vgpuTypeId, vgpuInstanceCountPerVm) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetBAR1Info(nvmlVgpuTypeId_t vgpuTypeId, nvmlVgpuTypeBar1Info_t* bar1Info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetBAR1Info + _check_or_init_nvml() + if __nvmlVgpuTypeGetBAR1Info == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetBAR1Info is not found") + return (__nvmlVgpuTypeGetBAR1Info)( + vgpuTypeId, bar1Info) + + +cdef nvmlReturn_t _nvmlDeviceGetActiveVgpus(nvmlDevice_t device, unsigned int* vgpuCount, nvmlVgpuInstance_t* vgpuInstances) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetActiveVgpus + _check_or_init_nvml() + if __nvmlDeviceGetActiveVgpus == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetActiveVgpus is not found") + return (__nvmlDeviceGetActiveVgpus)( + device, vgpuCount, vgpuInstances) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetVmID(nvmlVgpuInstance_t vgpuInstance, char* vmId, unsigned int size, nvmlVgpuVmIdType_t* vmIdType) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetVmID + _check_or_init_nvml() + if __nvmlVgpuInstanceGetVmID == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetVmID is not found") + return (__nvmlVgpuInstanceGetVmID)( + vgpuInstance, vmId, size, vmIdType) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetUUID(nvmlVgpuInstance_t vgpuInstance, char* uuid, unsigned int size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetUUID + _check_or_init_nvml() + if __nvmlVgpuInstanceGetUUID == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetUUID is not found") + return (__nvmlVgpuInstanceGetUUID)( + vgpuInstance, uuid, size) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetVmDriverVersion(nvmlVgpuInstance_t vgpuInstance, char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetVmDriverVersion + _check_or_init_nvml() + if __nvmlVgpuInstanceGetVmDriverVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetVmDriverVersion is not found") + return (__nvmlVgpuInstanceGetVmDriverVersion)( + vgpuInstance, version, length) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetFbUsage(nvmlVgpuInstance_t vgpuInstance, unsigned long long* fbUsage) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetFbUsage + _check_or_init_nvml() + if __nvmlVgpuInstanceGetFbUsage == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetFbUsage is not found") + return (__nvmlVgpuInstanceGetFbUsage)( + vgpuInstance, fbUsage) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetLicenseStatus(nvmlVgpuInstance_t vgpuInstance, unsigned int* licensed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetLicenseStatus + _check_or_init_nvml() + if __nvmlVgpuInstanceGetLicenseStatus == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetLicenseStatus is not found") + return (__nvmlVgpuInstanceGetLicenseStatus)( + vgpuInstance, licensed) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetType(nvmlVgpuInstance_t vgpuInstance, nvmlVgpuTypeId_t* vgpuTypeId) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetType + _check_or_init_nvml() + if __nvmlVgpuInstanceGetType == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetType is not found") + return (__nvmlVgpuInstanceGetType)( + vgpuInstance, vgpuTypeId) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetFrameRateLimit(nvmlVgpuInstance_t vgpuInstance, unsigned int* frameRateLimit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetFrameRateLimit + _check_or_init_nvml() + if __nvmlVgpuInstanceGetFrameRateLimit == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetFrameRateLimit is not found") + return (__nvmlVgpuInstanceGetFrameRateLimit)( + vgpuInstance, frameRateLimit) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetEccMode(nvmlVgpuInstance_t vgpuInstance, nvmlEnableState_t* eccMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetEccMode + _check_or_init_nvml() + if __nvmlVgpuInstanceGetEccMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetEccMode is not found") + return (__nvmlVgpuInstanceGetEccMode)( + vgpuInstance, eccMode) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetEncoderCapacity(nvmlVgpuInstance_t vgpuInstance, unsigned int* encoderCapacity) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetEncoderCapacity + _check_or_init_nvml() + if __nvmlVgpuInstanceGetEncoderCapacity == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetEncoderCapacity is not found") + return (__nvmlVgpuInstanceGetEncoderCapacity)( + vgpuInstance, encoderCapacity) + + +cdef nvmlReturn_t _nvmlVgpuInstanceSetEncoderCapacity(nvmlVgpuInstance_t vgpuInstance, unsigned int encoderCapacity) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceSetEncoderCapacity + _check_or_init_nvml() + if __nvmlVgpuInstanceSetEncoderCapacity == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceSetEncoderCapacity is not found") + return (__nvmlVgpuInstanceSetEncoderCapacity)( + vgpuInstance, encoderCapacity) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetEncoderStats(nvmlVgpuInstance_t vgpuInstance, unsigned int* sessionCount, unsigned int* averageFps, unsigned int* averageLatency) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetEncoderStats + _check_or_init_nvml() + if __nvmlVgpuInstanceGetEncoderStats == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetEncoderStats is not found") + return (__nvmlVgpuInstanceGetEncoderStats)( + vgpuInstance, sessionCount, averageFps, averageLatency) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetEncoderSessions(nvmlVgpuInstance_t vgpuInstance, unsigned int* sessionCount, nvmlEncoderSessionInfo_t* sessionInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetEncoderSessions + _check_or_init_nvml() + if __nvmlVgpuInstanceGetEncoderSessions == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetEncoderSessions is not found") + return (__nvmlVgpuInstanceGetEncoderSessions)( + vgpuInstance, sessionCount, sessionInfo) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetFBCStats(nvmlVgpuInstance_t vgpuInstance, nvmlFBCStats_t* fbcStats) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetFBCStats + _check_or_init_nvml() + if __nvmlVgpuInstanceGetFBCStats == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetFBCStats is not found") + return (__nvmlVgpuInstanceGetFBCStats)( + vgpuInstance, fbcStats) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetFBCSessions(nvmlVgpuInstance_t vgpuInstance, unsigned int* sessionCount, nvmlFBCSessionInfo_t* sessionInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetFBCSessions + _check_or_init_nvml() + if __nvmlVgpuInstanceGetFBCSessions == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetFBCSessions is not found") + return (__nvmlVgpuInstanceGetFBCSessions)( + vgpuInstance, sessionCount, sessionInfo) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetGpuInstanceId(nvmlVgpuInstance_t vgpuInstance, unsigned int* gpuInstanceId) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetGpuInstanceId + _check_or_init_nvml() + if __nvmlVgpuInstanceGetGpuInstanceId == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetGpuInstanceId is not found") + return (__nvmlVgpuInstanceGetGpuInstanceId)( + vgpuInstance, gpuInstanceId) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetGpuPciId(nvmlVgpuInstance_t vgpuInstance, char* vgpuPciId, unsigned int* length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetGpuPciId + _check_or_init_nvml() + if __nvmlVgpuInstanceGetGpuPciId == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetGpuPciId is not found") + return (__nvmlVgpuInstanceGetGpuPciId)( + vgpuInstance, vgpuPciId, length) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetCapabilities(nvmlVgpuTypeId_t vgpuTypeId, nvmlVgpuCapability_t capability, unsigned int* capResult) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetCapabilities + _check_or_init_nvml() + if __nvmlVgpuTypeGetCapabilities == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetCapabilities is not found") + return (__nvmlVgpuTypeGetCapabilities)( + vgpuTypeId, capability, capResult) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetMdevUUID(nvmlVgpuInstance_t vgpuInstance, char* mdevUuid, unsigned int size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetMdevUUID + _check_or_init_nvml() + if __nvmlVgpuInstanceGetMdevUUID == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetMdevUUID is not found") + return (__nvmlVgpuInstanceGetMdevUUID)( + vgpuInstance, mdevUuid, size) + + +cdef nvmlReturn_t _nvmlGpuInstanceGetCreatableVgpus(nvmlGpuInstance_t gpuInstance, nvmlVgpuTypeIdInfo_t* pVgpus) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceGetCreatableVgpus + _check_or_init_nvml() + if __nvmlGpuInstanceGetCreatableVgpus == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceGetCreatableVgpus is not found") + return (__nvmlGpuInstanceGetCreatableVgpus)( + gpuInstance, pVgpus) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetMaxInstancesPerGpuInstance(nvmlVgpuTypeMaxInstance_t* pMaxInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetMaxInstancesPerGpuInstance + _check_or_init_nvml() + if __nvmlVgpuTypeGetMaxInstancesPerGpuInstance == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetMaxInstancesPerGpuInstance is not found") + return (__nvmlVgpuTypeGetMaxInstancesPerGpuInstance)( + pMaxInstance) + + +cdef nvmlReturn_t _nvmlGpuInstanceGetActiveVgpus(nvmlGpuInstance_t gpuInstance, nvmlActiveVgpuInstanceInfo_t* pVgpuInstanceInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceGetActiveVgpus + _check_or_init_nvml() + if __nvmlGpuInstanceGetActiveVgpus == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceGetActiveVgpus is not found") + return (__nvmlGpuInstanceGetActiveVgpus)( + gpuInstance, pVgpuInstanceInfo) + + +cdef nvmlReturn_t _nvmlGpuInstanceSetVgpuSchedulerState(nvmlGpuInstance_t gpuInstance, nvmlVgpuSchedulerState_t* pScheduler) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceSetVgpuSchedulerState + _check_or_init_nvml() + if __nvmlGpuInstanceSetVgpuSchedulerState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceSetVgpuSchedulerState is not found") + return (__nvmlGpuInstanceSetVgpuSchedulerState)( + gpuInstance, pScheduler) + + +cdef nvmlReturn_t _nvmlGpuInstanceGetVgpuSchedulerState(nvmlGpuInstance_t gpuInstance, nvmlVgpuSchedulerStateInfo_t* pSchedulerStateInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceGetVgpuSchedulerState + _check_or_init_nvml() + if __nvmlGpuInstanceGetVgpuSchedulerState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceGetVgpuSchedulerState is not found") + return (__nvmlGpuInstanceGetVgpuSchedulerState)( + gpuInstance, pSchedulerStateInfo) + + +cdef nvmlReturn_t _nvmlGpuInstanceGetVgpuSchedulerLog(nvmlGpuInstance_t gpuInstance, nvmlVgpuSchedulerLogInfo_t* pSchedulerLogInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceGetVgpuSchedulerLog + _check_or_init_nvml() + if __nvmlGpuInstanceGetVgpuSchedulerLog == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceGetVgpuSchedulerLog is not found") + return (__nvmlGpuInstanceGetVgpuSchedulerLog)( + gpuInstance, pSchedulerLogInfo) + + +cdef nvmlReturn_t _nvmlGpuInstanceGetVgpuTypeCreatablePlacements(nvmlGpuInstance_t gpuInstance, nvmlVgpuCreatablePlacementInfo_t* pCreatablePlacementInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceGetVgpuTypeCreatablePlacements + _check_or_init_nvml() + if __nvmlGpuInstanceGetVgpuTypeCreatablePlacements == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceGetVgpuTypeCreatablePlacements is not found") + return (__nvmlGpuInstanceGetVgpuTypeCreatablePlacements)( + gpuInstance, pCreatablePlacementInfo) + + +cdef nvmlReturn_t _nvmlGpuInstanceGetVgpuHeterogeneousMode(nvmlGpuInstance_t gpuInstance, nvmlVgpuHeterogeneousMode_t* pHeterogeneousMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceGetVgpuHeterogeneousMode + _check_or_init_nvml() + if __nvmlGpuInstanceGetVgpuHeterogeneousMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceGetVgpuHeterogeneousMode is not found") + return (__nvmlGpuInstanceGetVgpuHeterogeneousMode)( + gpuInstance, pHeterogeneousMode) + + +cdef nvmlReturn_t _nvmlGpuInstanceSetVgpuHeterogeneousMode(nvmlGpuInstance_t gpuInstance, const nvmlVgpuHeterogeneousMode_t* pHeterogeneousMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceSetVgpuHeterogeneousMode + _check_or_init_nvml() + if __nvmlGpuInstanceSetVgpuHeterogeneousMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceSetVgpuHeterogeneousMode is not found") + return (__nvmlGpuInstanceSetVgpuHeterogeneousMode)( + gpuInstance, pHeterogeneousMode) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetMetadata(nvmlVgpuInstance_t vgpuInstance, nvmlVgpuMetadata_t* vgpuMetadata, unsigned int* bufferSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetMetadata + _check_or_init_nvml() + if __nvmlVgpuInstanceGetMetadata == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetMetadata is not found") + return (__nvmlVgpuInstanceGetMetadata)( + vgpuInstance, vgpuMetadata, bufferSize) + + +cdef nvmlReturn_t _nvmlDeviceGetVgpuMetadata(nvmlDevice_t device, nvmlVgpuPgpuMetadata_t* pgpuMetadata, unsigned int* bufferSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVgpuMetadata + _check_or_init_nvml() + if __nvmlDeviceGetVgpuMetadata == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVgpuMetadata is not found") + return (__nvmlDeviceGetVgpuMetadata)( + device, pgpuMetadata, bufferSize) + + +cdef nvmlReturn_t _nvmlGetVgpuCompatibility(nvmlVgpuMetadata_t* vgpuMetadata, nvmlVgpuPgpuMetadata_t* pgpuMetadata, nvmlVgpuPgpuCompatibility_t* compatibilityInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGetVgpuCompatibility + _check_or_init_nvml() + if __nvmlGetVgpuCompatibility == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGetVgpuCompatibility is not found") + return (__nvmlGetVgpuCompatibility)( + vgpuMetadata, pgpuMetadata, compatibilityInfo) + + +cdef nvmlReturn_t _nvmlDeviceGetPgpuMetadataString(nvmlDevice_t device, char* pgpuMetadata, unsigned int* bufferSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPgpuMetadataString + _check_or_init_nvml() + if __nvmlDeviceGetPgpuMetadataString == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPgpuMetadataString is not found") + return (__nvmlDeviceGetPgpuMetadataString)( + device, pgpuMetadata, bufferSize) + + +cdef nvmlReturn_t _nvmlDeviceGetVgpuSchedulerLog(nvmlDevice_t device, nvmlVgpuSchedulerLog_t* pSchedulerLog) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVgpuSchedulerLog + _check_or_init_nvml() + if __nvmlDeviceGetVgpuSchedulerLog == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVgpuSchedulerLog is not found") + return (__nvmlDeviceGetVgpuSchedulerLog)( + device, pSchedulerLog) + + +cdef nvmlReturn_t _nvmlDeviceGetVgpuSchedulerState(nvmlDevice_t device, nvmlVgpuSchedulerGetState_t* pSchedulerState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVgpuSchedulerState + _check_or_init_nvml() + if __nvmlDeviceGetVgpuSchedulerState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVgpuSchedulerState is not found") + return (__nvmlDeviceGetVgpuSchedulerState)( + device, pSchedulerState) + + +cdef nvmlReturn_t _nvmlDeviceGetVgpuSchedulerCapabilities(nvmlDevice_t device, nvmlVgpuSchedulerCapabilities_t* pCapabilities) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVgpuSchedulerCapabilities + _check_or_init_nvml() + if __nvmlDeviceGetVgpuSchedulerCapabilities == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVgpuSchedulerCapabilities is not found") + return (__nvmlDeviceGetVgpuSchedulerCapabilities)( + device, pCapabilities) + + +cdef nvmlReturn_t _nvmlDeviceSetVgpuSchedulerState(nvmlDevice_t device, nvmlVgpuSchedulerSetState_t* pSchedulerState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetVgpuSchedulerState + _check_or_init_nvml() + if __nvmlDeviceSetVgpuSchedulerState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetVgpuSchedulerState is not found") + return (__nvmlDeviceSetVgpuSchedulerState)( + device, pSchedulerState) + + +cdef nvmlReturn_t _nvmlGetVgpuVersion(nvmlVgpuVersion_t* supported, nvmlVgpuVersion_t* current) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGetVgpuVersion + _check_or_init_nvml() + if __nvmlGetVgpuVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGetVgpuVersion is not found") + return (__nvmlGetVgpuVersion)( + supported, current) + + +cdef nvmlReturn_t _nvmlSetVgpuVersion(nvmlVgpuVersion_t* vgpuVersion) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSetVgpuVersion + _check_or_init_nvml() + if __nvmlSetVgpuVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSetVgpuVersion is not found") + return (__nvmlSetVgpuVersion)( + vgpuVersion) + + +cdef nvmlReturn_t _nvmlDeviceGetVgpuUtilization(nvmlDevice_t device, unsigned long long lastSeenTimeStamp, nvmlValueType_t* sampleValType, unsigned int* vgpuInstanceSamplesCount, nvmlVgpuInstanceUtilizationSample_t* utilizationSamples) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVgpuUtilization + _check_or_init_nvml() + if __nvmlDeviceGetVgpuUtilization == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVgpuUtilization is not found") + return (__nvmlDeviceGetVgpuUtilization)( + device, lastSeenTimeStamp, sampleValType, vgpuInstanceSamplesCount, utilizationSamples) + + +cdef nvmlReturn_t _nvmlDeviceGetVgpuInstancesUtilizationInfo(nvmlDevice_t device, nvmlVgpuInstancesUtilizationInfo_t* vgpuUtilInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVgpuInstancesUtilizationInfo + _check_or_init_nvml() + if __nvmlDeviceGetVgpuInstancesUtilizationInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVgpuInstancesUtilizationInfo is not found") + return (__nvmlDeviceGetVgpuInstancesUtilizationInfo)( + device, vgpuUtilInfo) + + +cdef nvmlReturn_t _nvmlDeviceGetVgpuProcessUtilization(nvmlDevice_t device, unsigned long long lastSeenTimeStamp, unsigned int* vgpuProcessSamplesCount, nvmlVgpuProcessUtilizationSample_t* utilizationSamples) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVgpuProcessUtilization + _check_or_init_nvml() + if __nvmlDeviceGetVgpuProcessUtilization == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVgpuProcessUtilization is not found") + return (__nvmlDeviceGetVgpuProcessUtilization)( + device, lastSeenTimeStamp, vgpuProcessSamplesCount, utilizationSamples) + + +cdef nvmlReturn_t _nvmlDeviceGetVgpuProcessesUtilizationInfo(nvmlDevice_t device, nvmlVgpuProcessesUtilizationInfo_t* vgpuProcUtilInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVgpuProcessesUtilizationInfo + _check_or_init_nvml() + if __nvmlDeviceGetVgpuProcessesUtilizationInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVgpuProcessesUtilizationInfo is not found") + return (__nvmlDeviceGetVgpuProcessesUtilizationInfo)( + device, vgpuProcUtilInfo) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetAccountingMode(nvmlVgpuInstance_t vgpuInstance, nvmlEnableState_t* mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetAccountingMode + _check_or_init_nvml() + if __nvmlVgpuInstanceGetAccountingMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetAccountingMode is not found") + return (__nvmlVgpuInstanceGetAccountingMode)( + vgpuInstance, mode) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetAccountingPids(nvmlVgpuInstance_t vgpuInstance, unsigned int* count, unsigned int* pids) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetAccountingPids + _check_or_init_nvml() + if __nvmlVgpuInstanceGetAccountingPids == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetAccountingPids is not found") + return (__nvmlVgpuInstanceGetAccountingPids)( + vgpuInstance, count, pids) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetAccountingStats(nvmlVgpuInstance_t vgpuInstance, unsigned int pid, nvmlAccountingStats_t* stats) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetAccountingStats + _check_or_init_nvml() + if __nvmlVgpuInstanceGetAccountingStats == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetAccountingStats is not found") + return (__nvmlVgpuInstanceGetAccountingStats)( + vgpuInstance, pid, stats) + + +cdef nvmlReturn_t _nvmlVgpuInstanceClearAccountingPids(nvmlVgpuInstance_t vgpuInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceClearAccountingPids + _check_or_init_nvml() + if __nvmlVgpuInstanceClearAccountingPids == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceClearAccountingPids is not found") + return (__nvmlVgpuInstanceClearAccountingPids)( + vgpuInstance) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetLicenseInfo_v2(nvmlVgpuInstance_t vgpuInstance, nvmlVgpuLicenseInfo_t* licenseInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetLicenseInfo_v2 + _check_or_init_nvml() + if __nvmlVgpuInstanceGetLicenseInfo_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetLicenseInfo_v2 is not found") + return (__nvmlVgpuInstanceGetLicenseInfo_v2)( + vgpuInstance, licenseInfo) + + +cdef nvmlReturn_t _nvmlGetExcludedDeviceCount(unsigned int* deviceCount) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGetExcludedDeviceCount + _check_or_init_nvml() + if __nvmlGetExcludedDeviceCount == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGetExcludedDeviceCount is not found") + return (__nvmlGetExcludedDeviceCount)( + deviceCount) + + +cdef nvmlReturn_t _nvmlGetExcludedDeviceInfoByIndex(unsigned int index, nvmlExcludedDeviceInfo_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGetExcludedDeviceInfoByIndex + _check_or_init_nvml() + if __nvmlGetExcludedDeviceInfoByIndex == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGetExcludedDeviceInfoByIndex is not found") + return (__nvmlGetExcludedDeviceInfoByIndex)( + index, info) + + +cdef nvmlReturn_t _nvmlDeviceSetMigMode(nvmlDevice_t device, unsigned int mode, nvmlReturn_t* activationStatus) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetMigMode + _check_or_init_nvml() + if __nvmlDeviceSetMigMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetMigMode is not found") + return (__nvmlDeviceSetMigMode)( + device, mode, activationStatus) + + +cdef nvmlReturn_t _nvmlDeviceGetMigMode(nvmlDevice_t device, unsigned int* currentMode, unsigned int* pendingMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMigMode + _check_or_init_nvml() + if __nvmlDeviceGetMigMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMigMode is not found") + return (__nvmlDeviceGetMigMode)( + device, currentMode, pendingMode) + + +cdef nvmlReturn_t _nvmlDeviceGetGpuInstanceProfileInfoV(nvmlDevice_t device, unsigned int profile, nvmlGpuInstanceProfileInfo_v2_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGpuInstanceProfileInfoV + _check_or_init_nvml() + if __nvmlDeviceGetGpuInstanceProfileInfoV == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGpuInstanceProfileInfoV is not found") + return (__nvmlDeviceGetGpuInstanceProfileInfoV)( + device, profile, info) + + +cdef nvmlReturn_t _nvmlDeviceGetGpuInstancePossiblePlacements_v2(nvmlDevice_t device, unsigned int profileId, nvmlGpuInstancePlacement_t* placements, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGpuInstancePossiblePlacements_v2 + _check_or_init_nvml() + if __nvmlDeviceGetGpuInstancePossiblePlacements_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGpuInstancePossiblePlacements_v2 is not found") + return (__nvmlDeviceGetGpuInstancePossiblePlacements_v2)( + device, profileId, placements, count) + + +cdef nvmlReturn_t _nvmlDeviceGetGpuInstanceRemainingCapacity(nvmlDevice_t device, unsigned int profileId, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGpuInstanceRemainingCapacity + _check_or_init_nvml() + if __nvmlDeviceGetGpuInstanceRemainingCapacity == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGpuInstanceRemainingCapacity is not found") + return (__nvmlDeviceGetGpuInstanceRemainingCapacity)( + device, profileId, count) + + +cdef nvmlReturn_t _nvmlDeviceCreateGpuInstance(nvmlDevice_t device, unsigned int profileId, nvmlGpuInstance_t* gpuInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceCreateGpuInstance + _check_or_init_nvml() + if __nvmlDeviceCreateGpuInstance == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceCreateGpuInstance is not found") + return (__nvmlDeviceCreateGpuInstance)( + device, profileId, gpuInstance) + + +cdef nvmlReturn_t _nvmlDeviceCreateGpuInstanceWithPlacement(nvmlDevice_t device, unsigned int profileId, const nvmlGpuInstancePlacement_t* placement, nvmlGpuInstance_t* gpuInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceCreateGpuInstanceWithPlacement + _check_or_init_nvml() + if __nvmlDeviceCreateGpuInstanceWithPlacement == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceCreateGpuInstanceWithPlacement is not found") + return (__nvmlDeviceCreateGpuInstanceWithPlacement)( + device, profileId, placement, gpuInstance) + + +cdef nvmlReturn_t _nvmlGpuInstanceDestroy(nvmlGpuInstance_t gpuInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceDestroy + _check_or_init_nvml() + if __nvmlGpuInstanceDestroy == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceDestroy is not found") + return (__nvmlGpuInstanceDestroy)( + gpuInstance) + + +cdef nvmlReturn_t _nvmlDeviceGetGpuInstances(nvmlDevice_t device, unsigned int profileId, nvmlGpuInstance_t* gpuInstances, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGpuInstances + _check_or_init_nvml() + if __nvmlDeviceGetGpuInstances == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGpuInstances is not found") + return (__nvmlDeviceGetGpuInstances)( + device, profileId, gpuInstances, count) + + +cdef nvmlReturn_t _nvmlDeviceGetGpuInstanceById(nvmlDevice_t device, unsigned int id, nvmlGpuInstance_t* gpuInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGpuInstanceById + _check_or_init_nvml() + if __nvmlDeviceGetGpuInstanceById == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGpuInstanceById is not found") + return (__nvmlDeviceGetGpuInstanceById)( + device, id, gpuInstance) + + +cdef nvmlReturn_t _nvmlGpuInstanceGetInfo(nvmlGpuInstance_t gpuInstance, nvmlGpuInstanceInfo_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceGetInfo + _check_or_init_nvml() + if __nvmlGpuInstanceGetInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceGetInfo is not found") + return (__nvmlGpuInstanceGetInfo)( + gpuInstance, info) + + +cdef nvmlReturn_t _nvmlGpuInstanceGetComputeInstanceProfileInfoV(nvmlGpuInstance_t gpuInstance, unsigned int profile, unsigned int engProfile, nvmlComputeInstanceProfileInfo_v2_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceGetComputeInstanceProfileInfoV + _check_or_init_nvml() + if __nvmlGpuInstanceGetComputeInstanceProfileInfoV == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceGetComputeInstanceProfileInfoV is not found") + return (__nvmlGpuInstanceGetComputeInstanceProfileInfoV)( + gpuInstance, profile, engProfile, info) + + +cdef nvmlReturn_t _nvmlGpuInstanceGetComputeInstanceRemainingCapacity(nvmlGpuInstance_t gpuInstance, unsigned int profileId, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceGetComputeInstanceRemainingCapacity + _check_or_init_nvml() + if __nvmlGpuInstanceGetComputeInstanceRemainingCapacity == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceGetComputeInstanceRemainingCapacity is not found") + return (__nvmlGpuInstanceGetComputeInstanceRemainingCapacity)( + gpuInstance, profileId, count) + + +cdef nvmlReturn_t _nvmlGpuInstanceGetComputeInstancePossiblePlacements(nvmlGpuInstance_t gpuInstance, unsigned int profileId, nvmlComputeInstancePlacement_t* placements, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceGetComputeInstancePossiblePlacements + _check_or_init_nvml() + if __nvmlGpuInstanceGetComputeInstancePossiblePlacements == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceGetComputeInstancePossiblePlacements is not found") + return (__nvmlGpuInstanceGetComputeInstancePossiblePlacements)( + gpuInstance, profileId, placements, count) + + +cdef nvmlReturn_t _nvmlGpuInstanceCreateComputeInstance(nvmlGpuInstance_t gpuInstance, unsigned int profileId, nvmlComputeInstance_t* computeInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceCreateComputeInstance + _check_or_init_nvml() + if __nvmlGpuInstanceCreateComputeInstance == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceCreateComputeInstance is not found") + return (__nvmlGpuInstanceCreateComputeInstance)( + gpuInstance, profileId, computeInstance) + + +cdef nvmlReturn_t _nvmlGpuInstanceCreateComputeInstanceWithPlacement(nvmlGpuInstance_t gpuInstance, unsigned int profileId, const nvmlComputeInstancePlacement_t* placement, nvmlComputeInstance_t* computeInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceCreateComputeInstanceWithPlacement + _check_or_init_nvml() + if __nvmlGpuInstanceCreateComputeInstanceWithPlacement == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceCreateComputeInstanceWithPlacement is not found") + return (__nvmlGpuInstanceCreateComputeInstanceWithPlacement)( + gpuInstance, profileId, placement, computeInstance) + + +cdef nvmlReturn_t _nvmlComputeInstanceDestroy(nvmlComputeInstance_t computeInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlComputeInstanceDestroy + _check_or_init_nvml() + if __nvmlComputeInstanceDestroy == NULL: + with gil: + raise FunctionNotFoundError("function nvmlComputeInstanceDestroy is not found") + return (__nvmlComputeInstanceDestroy)( + computeInstance) + + +cdef nvmlReturn_t _nvmlGpuInstanceGetComputeInstances(nvmlGpuInstance_t gpuInstance, unsigned int profileId, nvmlComputeInstance_t* computeInstances, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceGetComputeInstances + _check_or_init_nvml() + if __nvmlGpuInstanceGetComputeInstances == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceGetComputeInstances is not found") + return (__nvmlGpuInstanceGetComputeInstances)( + gpuInstance, profileId, computeInstances, count) + + +cdef nvmlReturn_t _nvmlGpuInstanceGetComputeInstanceById(nvmlGpuInstance_t gpuInstance, unsigned int id, nvmlComputeInstance_t* computeInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceGetComputeInstanceById + _check_or_init_nvml() + if __nvmlGpuInstanceGetComputeInstanceById == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceGetComputeInstanceById is not found") + return (__nvmlGpuInstanceGetComputeInstanceById)( + gpuInstance, id, computeInstance) + + +cdef nvmlReturn_t _nvmlComputeInstanceGetInfo_v2(nvmlComputeInstance_t computeInstance, nvmlComputeInstanceInfo_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlComputeInstanceGetInfo_v2 + _check_or_init_nvml() + if __nvmlComputeInstanceGetInfo_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlComputeInstanceGetInfo_v2 is not found") + return (__nvmlComputeInstanceGetInfo_v2)( + computeInstance, info) + + +cdef nvmlReturn_t _nvmlDeviceIsMigDeviceHandle(nvmlDevice_t device, unsigned int* isMigDevice) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceIsMigDeviceHandle + _check_or_init_nvml() + if __nvmlDeviceIsMigDeviceHandle == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceIsMigDeviceHandle is not found") + return (__nvmlDeviceIsMigDeviceHandle)( + device, isMigDevice) + + +cdef nvmlReturn_t _nvmlDeviceGetGpuInstanceId(nvmlDevice_t device, unsigned int* id) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGpuInstanceId + _check_or_init_nvml() + if __nvmlDeviceGetGpuInstanceId == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGpuInstanceId is not found") + return (__nvmlDeviceGetGpuInstanceId)( + device, id) + + +cdef nvmlReturn_t _nvmlDeviceGetComputeInstanceId(nvmlDevice_t device, unsigned int* id) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetComputeInstanceId + _check_or_init_nvml() + if __nvmlDeviceGetComputeInstanceId == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetComputeInstanceId is not found") + return (__nvmlDeviceGetComputeInstanceId)( + device, id) + + +cdef nvmlReturn_t _nvmlDeviceGetMaxMigDeviceCount(nvmlDevice_t device, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMaxMigDeviceCount + _check_or_init_nvml() + if __nvmlDeviceGetMaxMigDeviceCount == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMaxMigDeviceCount is not found") + return (__nvmlDeviceGetMaxMigDeviceCount)( + device, count) + + +cdef nvmlReturn_t _nvmlDeviceGetMigDeviceHandleByIndex(nvmlDevice_t device, unsigned int index, nvmlDevice_t* migDevice) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMigDeviceHandleByIndex + _check_or_init_nvml() + if __nvmlDeviceGetMigDeviceHandleByIndex == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMigDeviceHandleByIndex is not found") + return (__nvmlDeviceGetMigDeviceHandleByIndex)( + device, index, migDevice) + + +cdef nvmlReturn_t _nvmlDeviceGetDeviceHandleFromMigDeviceHandle(nvmlDevice_t migDevice, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetDeviceHandleFromMigDeviceHandle + _check_or_init_nvml() + if __nvmlDeviceGetDeviceHandleFromMigDeviceHandle == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetDeviceHandleFromMigDeviceHandle is not found") + return (__nvmlDeviceGetDeviceHandleFromMigDeviceHandle)( + migDevice, device) + + +cdef nvmlReturn_t _nvmlDeviceGetCapabilities(nvmlDevice_t device, nvmlDeviceCapabilities_t* caps) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetCapabilities + _check_or_init_nvml() + if __nvmlDeviceGetCapabilities == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetCapabilities is not found") + return (__nvmlDeviceGetCapabilities)( + device, caps) + + +cdef nvmlReturn_t _nvmlDevicePowerSmoothingActivatePresetProfile(nvmlDevice_t device, nvmlPowerSmoothingProfile_t* profile) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDevicePowerSmoothingActivatePresetProfile + _check_or_init_nvml() + if __nvmlDevicePowerSmoothingActivatePresetProfile == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDevicePowerSmoothingActivatePresetProfile is not found") + return (__nvmlDevicePowerSmoothingActivatePresetProfile)( + device, profile) + + +cdef nvmlReturn_t _nvmlDevicePowerSmoothingUpdatePresetProfileParam(nvmlDevice_t device, nvmlPowerSmoothingProfile_t* profile) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDevicePowerSmoothingUpdatePresetProfileParam + _check_or_init_nvml() + if __nvmlDevicePowerSmoothingUpdatePresetProfileParam == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDevicePowerSmoothingUpdatePresetProfileParam is not found") + return (__nvmlDevicePowerSmoothingUpdatePresetProfileParam)( + device, profile) + + +cdef nvmlReturn_t _nvmlDevicePowerSmoothingSetState(nvmlDevice_t device, nvmlPowerSmoothingState_t* state) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDevicePowerSmoothingSetState + _check_or_init_nvml() + if __nvmlDevicePowerSmoothingSetState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDevicePowerSmoothingSetState is not found") + return (__nvmlDevicePowerSmoothingSetState)( + device, state) + + +cdef nvmlReturn_t _nvmlDeviceGetAddressingMode(nvmlDevice_t device, nvmlDeviceAddressingMode_t* mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetAddressingMode + _check_or_init_nvml() + if __nvmlDeviceGetAddressingMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetAddressingMode is not found") + return (__nvmlDeviceGetAddressingMode)( + device, mode) + + +cdef nvmlReturn_t _nvmlDeviceGetRepairStatus(nvmlDevice_t device, nvmlRepairStatus_t* repairStatus) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetRepairStatus + _check_or_init_nvml() + if __nvmlDeviceGetRepairStatus == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetRepairStatus is not found") + return (__nvmlDeviceGetRepairStatus)( + device, repairStatus) + + +cdef nvmlReturn_t _nvmlDeviceGetPowerMizerMode_v1(nvmlDevice_t device, nvmlDevicePowerMizerModes_v1_t* powerMizerMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPowerMizerMode_v1 + _check_or_init_nvml() + if __nvmlDeviceGetPowerMizerMode_v1 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPowerMizerMode_v1 is not found") + return (__nvmlDeviceGetPowerMizerMode_v1)( + device, powerMizerMode) + + +cdef nvmlReturn_t _nvmlDeviceSetPowerMizerMode_v1(nvmlDevice_t device, nvmlDevicePowerMizerModes_v1_t* powerMizerMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetPowerMizerMode_v1 + _check_or_init_nvml() + if __nvmlDeviceSetPowerMizerMode_v1 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetPowerMizerMode_v1 is not found") + return (__nvmlDeviceSetPowerMizerMode_v1)( + device, powerMizerMode) + + +cdef nvmlReturn_t _nvmlDeviceGetPdi(nvmlDevice_t device, nvmlPdi_t* pdi) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPdi + _check_or_init_nvml() + if __nvmlDeviceGetPdi == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPdi is not found") + return (__nvmlDeviceGetPdi)( + device, pdi) + + +cdef nvmlReturn_t _nvmlDeviceSetHostname_v1(nvmlDevice_t device, nvmlHostname_v1_t* hostname) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetHostname_v1 + _check_or_init_nvml() + if __nvmlDeviceSetHostname_v1 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetHostname_v1 is not found") + return (__nvmlDeviceSetHostname_v1)( + device, hostname) + + +cdef nvmlReturn_t _nvmlDeviceGetHostname_v1(nvmlDevice_t device, nvmlHostname_v1_t* hostname) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetHostname_v1 + _check_or_init_nvml() + if __nvmlDeviceGetHostname_v1 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetHostname_v1 is not found") + return (__nvmlDeviceGetHostname_v1)( + device, hostname) + + +cdef nvmlReturn_t _nvmlDeviceGetNvLinkInfo(nvmlDevice_t device, nvmlNvLinkInfo_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetNvLinkInfo + _check_or_init_nvml() + if __nvmlDeviceGetNvLinkInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetNvLinkInfo is not found") + return (__nvmlDeviceGetNvLinkInfo)( + device, info) + + +cdef nvmlReturn_t _nvmlDeviceReadWritePRM_v1(nvmlDevice_t device, nvmlPRMTLV_v1_t* buffer) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceReadWritePRM_v1 + _check_or_init_nvml() + if __nvmlDeviceReadWritePRM_v1 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceReadWritePRM_v1 is not found") + return (__nvmlDeviceReadWritePRM_v1)( + device, buffer) + + +cdef nvmlReturn_t _nvmlDeviceGetGpuInstanceProfileInfoByIdV(nvmlDevice_t device, unsigned int profileId, nvmlGpuInstanceProfileInfo_v2_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGpuInstanceProfileInfoByIdV + _check_or_init_nvml() + if __nvmlDeviceGetGpuInstanceProfileInfoByIdV == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGpuInstanceProfileInfoByIdV is not found") + return (__nvmlDeviceGetGpuInstanceProfileInfoByIdV)( + device, profileId, info) + + +cdef nvmlReturn_t _nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts(nvmlDevice_t device, nvmlEccSramUniqueUncorrectedErrorCounts_t* errorCounts) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts + _check_or_init_nvml() + if __nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts is not found") + return (__nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts)( + device, errorCounts) + + +cdef nvmlReturn_t _nvmlDeviceGetUnrepairableMemoryFlag_v1(nvmlDevice_t device, nvmlUnrepairableMemoryStatus_v1_t* unrepairableMemoryStatus) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetUnrepairableMemoryFlag_v1 + _check_or_init_nvml() + if __nvmlDeviceGetUnrepairableMemoryFlag_v1 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetUnrepairableMemoryFlag_v1 is not found") + return (__nvmlDeviceGetUnrepairableMemoryFlag_v1)( + device, unrepairableMemoryStatus) + + +cdef nvmlReturn_t _nvmlDeviceReadPRMCounters_v1(nvmlDevice_t device, nvmlPRMCounterList_v1_t* counterList) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceReadPRMCounters_v1 + _check_or_init_nvml() + if __nvmlDeviceReadPRMCounters_v1 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceReadPRMCounters_v1 is not found") + return (__nvmlDeviceReadPRMCounters_v1)( + device, counterList) + + +cdef nvmlReturn_t _nvmlDeviceSetRusdSettings_v1(nvmlDevice_t device, nvmlRusdSettings_v1_t* settings) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetRusdSettings_v1 + _check_or_init_nvml() + if __nvmlDeviceSetRusdSettings_v1 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetRusdSettings_v1 is not found") + return (__nvmlDeviceSetRusdSettings_v1)( + device, settings) + + +cdef nvmlReturn_t _nvmlDeviceVgpuForceGspUnload(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceVgpuForceGspUnload + _check_or_init_nvml() + if __nvmlDeviceVgpuForceGspUnload == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceVgpuForceGspUnload is not found") + return (__nvmlDeviceVgpuForceGspUnload)( + device) + + +cdef nvmlReturn_t _nvmlDeviceGetVgpuSchedulerState_v2(nvmlDevice_t device, nvmlVgpuSchedulerStateInfo_v2_t* pSchedulerStateInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVgpuSchedulerState_v2 + _check_or_init_nvml() + if __nvmlDeviceGetVgpuSchedulerState_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVgpuSchedulerState_v2 is not found") + return (__nvmlDeviceGetVgpuSchedulerState_v2)( + device, pSchedulerStateInfo) + + +cdef nvmlReturn_t _nvmlGpuInstanceGetVgpuSchedulerState_v2(nvmlGpuInstance_t gpuInstance, nvmlVgpuSchedulerStateInfo_v2_t* pSchedulerStateInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceGetVgpuSchedulerState_v2 + _check_or_init_nvml() + if __nvmlGpuInstanceGetVgpuSchedulerState_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceGetVgpuSchedulerState_v2 is not found") + return (__nvmlGpuInstanceGetVgpuSchedulerState_v2)( + gpuInstance, pSchedulerStateInfo) + + +cdef nvmlReturn_t _nvmlDeviceGetVgpuSchedulerLog_v2(nvmlDevice_t device, nvmlVgpuSchedulerLogInfo_v2_t* pSchedulerLogInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVgpuSchedulerLog_v2 + _check_or_init_nvml() + if __nvmlDeviceGetVgpuSchedulerLog_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVgpuSchedulerLog_v2 is not found") + return (__nvmlDeviceGetVgpuSchedulerLog_v2)( + device, pSchedulerLogInfo) + + +cdef nvmlReturn_t _nvmlGpuInstanceGetVgpuSchedulerLog_v2(nvmlGpuInstance_t gpuInstance, nvmlVgpuSchedulerLogInfo_v2_t* pSchedulerLogInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceGetVgpuSchedulerLog_v2 + _check_or_init_nvml() + if __nvmlGpuInstanceGetVgpuSchedulerLog_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceGetVgpuSchedulerLog_v2 is not found") + return (__nvmlGpuInstanceGetVgpuSchedulerLog_v2)( + gpuInstance, pSchedulerLogInfo) + + +cdef nvmlReturn_t _nvmlDeviceSetVgpuSchedulerState_v2(nvmlDevice_t device, nvmlVgpuSchedulerState_v2_t* pSchedulerState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetVgpuSchedulerState_v2 + _check_or_init_nvml() + if __nvmlDeviceSetVgpuSchedulerState_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetVgpuSchedulerState_v2 is not found") + return (__nvmlDeviceSetVgpuSchedulerState_v2)( + device, pSchedulerState) + + +cdef nvmlReturn_t _nvmlGpuInstanceSetVgpuSchedulerState_v2(nvmlGpuInstance_t gpuInstance, nvmlVgpuSchedulerState_v2_t* pSchedulerState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceSetVgpuSchedulerState_v2 + _check_or_init_nvml() + if __nvmlGpuInstanceSetVgpuSchedulerState_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceSetVgpuSchedulerState_v2 is not found") + return (__nvmlGpuInstanceSetVgpuSchedulerState_v2)( + gpuInstance, pSchedulerState) diff --git a/cuda_bindings/cuda/bindings/_internal/nvml_windows.pyx b/cuda_bindings/cuda/bindings/_internal/nvml_windows.pyx new file mode 100644 index 00000000000..e0e38c1913e --- /dev/null +++ b/cuda_bindings/cuda/bindings/_internal/nvml_windows.pyx @@ -0,0 +1,6043 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +# This code was automatically generated across versions from 12.9.1 to 13.3.0. Do not modify it directly. +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=71acdbf6d477ea00af29faeca397fad7352eec03aca08accffa76af57f2234f9 + + +# <<<< PREAMBLE CONTENT >>>> + +cdef extern from "": + ctypedef void* HMODULE + void* _cyb_GetProcAddress "GetProcAddress"(HMODULE, const char*) nogil + +from libc.stdint cimport intptr_t as _cyb_intptr_t + +import threading as _cyb_threading + +cdef bint _cyb___py_nvml_init = False +cdef dict _cyb_func_ptrs = None +cdef object _cyb_symbol_lock = _cyb_threading.Lock() + +# <<<< END OF PREAMBLE CONTENT >>>> + +from libc.stdint cimport uintptr_t +from cuda.pathfinder import load_nvidia_dynamic_lib +from .utils import FunctionNotFoundError, NotSupportedError +############################################################################### +# Wrapper init +############################################################################### + +cdef void* __nvmlInit_v2 = NULL +cdef void* __nvmlInitWithFlags = NULL +cdef void* __nvmlShutdown = NULL +cdef void* __nvmlErrorString = NULL +cdef void* __nvmlSystemGetDriverVersion = NULL +cdef void* __nvmlSystemGetNVMLVersion = NULL +cdef void* __nvmlSystemGetCudaDriverVersion = NULL +cdef void* __nvmlSystemGetCudaDriverVersion_v2 = NULL +cdef void* __nvmlSystemGetProcessName = NULL +cdef void* __nvmlSystemGetHicVersion = NULL +cdef void* __nvmlSystemGetTopologyGpuSet = NULL +cdef void* __nvmlSystemGetDriverBranch = NULL +cdef void* __nvmlUnitGetCount = NULL +cdef void* __nvmlUnitGetHandleByIndex = NULL +cdef void* __nvmlUnitGetUnitInfo = NULL +cdef void* __nvmlUnitGetLedState = NULL +cdef void* __nvmlUnitGetPsuInfo = NULL +cdef void* __nvmlUnitGetTemperature = NULL +cdef void* __nvmlUnitGetFanSpeedInfo = NULL +cdef void* __nvmlUnitGetDevices = NULL +cdef void* __nvmlDeviceGetCount_v2 = NULL +cdef void* __nvmlDeviceGetAttributes_v2 = NULL +cdef void* __nvmlDeviceGetHandleByIndex_v2 = NULL +cdef void* __nvmlDeviceGetHandleBySerial = NULL +cdef void* __nvmlDeviceGetHandleByUUID = NULL +cdef void* __nvmlDeviceGetHandleByUUIDV = NULL +cdef void* __nvmlDeviceGetHandleByPciBusId_v2 = NULL +cdef void* __nvmlDeviceGetName = NULL +cdef void* __nvmlDeviceGetBrand = NULL +cdef void* __nvmlDeviceGetIndex = NULL +cdef void* __nvmlDeviceGetSerial = NULL +cdef void* __nvmlDeviceGetModuleId = NULL +cdef void* __nvmlDeviceGetC2cModeInfoV = NULL +cdef void* __nvmlDeviceGetMemoryAffinity = NULL +cdef void* __nvmlDeviceGetCpuAffinityWithinScope = NULL +cdef void* __nvmlDeviceGetCpuAffinity = NULL +cdef void* __nvmlDeviceSetCpuAffinity = NULL +cdef void* __nvmlDeviceClearCpuAffinity = NULL +cdef void* __nvmlDeviceGetNumaNodeId = NULL +cdef void* __nvmlDeviceGetTopologyCommonAncestor = NULL +cdef void* __nvmlDeviceGetTopologyNearestGpus = NULL +cdef void* __nvmlDeviceGetP2PStatus = NULL +cdef void* __nvmlDeviceGetUUID = NULL +cdef void* __nvmlDeviceGetMinorNumber = NULL +cdef void* __nvmlDeviceGetBoardPartNumber = NULL +cdef void* __nvmlDeviceGetInforomVersion = NULL +cdef void* __nvmlDeviceGetInforomImageVersion = NULL +cdef void* __nvmlDeviceGetInforomConfigurationChecksum = NULL +cdef void* __nvmlDeviceValidateInforom = NULL +cdef void* __nvmlDeviceGetLastBBXFlushTime = NULL +cdef void* __nvmlDeviceGetDisplayMode = NULL +cdef void* __nvmlDeviceGetDisplayActive = NULL +cdef void* __nvmlDeviceGetPersistenceMode = NULL +cdef void* __nvmlDeviceGetPciInfoExt = NULL +cdef void* __nvmlDeviceGetPciInfo_v3 = NULL +cdef void* __nvmlDeviceGetMaxPcieLinkGeneration = NULL +cdef void* __nvmlDeviceGetGpuMaxPcieLinkGeneration = NULL +cdef void* __nvmlDeviceGetMaxPcieLinkWidth = NULL +cdef void* __nvmlDeviceGetCurrPcieLinkGeneration = NULL +cdef void* __nvmlDeviceGetCurrPcieLinkWidth = NULL +cdef void* __nvmlDeviceGetPcieThroughput = NULL +cdef void* __nvmlDeviceGetPcieReplayCounter = NULL +cdef void* __nvmlDeviceGetClockInfo = NULL +cdef void* __nvmlDeviceGetMaxClockInfo = NULL +cdef void* __nvmlDeviceGetGpcClkVfOffset = NULL +cdef void* __nvmlDeviceGetClock = NULL +cdef void* __nvmlDeviceGetMaxCustomerBoostClock = NULL +cdef void* __nvmlDeviceGetSupportedMemoryClocks = NULL +cdef void* __nvmlDeviceGetSupportedGraphicsClocks = NULL +cdef void* __nvmlDeviceGetAutoBoostedClocksEnabled = NULL +cdef void* __nvmlDeviceGetFanSpeed = NULL +cdef void* __nvmlDeviceGetFanSpeed_v2 = NULL +cdef void* __nvmlDeviceGetFanSpeedRPM = NULL +cdef void* __nvmlDeviceGetTargetFanSpeed = NULL +cdef void* __nvmlDeviceGetMinMaxFanSpeed = NULL +cdef void* __nvmlDeviceGetFanControlPolicy_v2 = NULL +cdef void* __nvmlDeviceGetNumFans = NULL +cdef void* __nvmlDeviceGetCoolerInfo = NULL +cdef void* __nvmlDeviceGetTemperatureV = NULL +cdef void* __nvmlDeviceGetTemperatureThreshold = NULL +cdef void* __nvmlDeviceGetMarginTemperature = NULL +cdef void* __nvmlDeviceGetThermalSettings = NULL +cdef void* __nvmlDeviceGetPerformanceState = NULL +cdef void* __nvmlDeviceGetCurrentClocksEventReasons = NULL +cdef void* __nvmlDeviceGetSupportedClocksEventReasons = NULL +cdef void* __nvmlDeviceGetPowerState = NULL +cdef void* __nvmlDeviceGetDynamicPstatesInfo = NULL +cdef void* __nvmlDeviceGetMemClkVfOffset = NULL +cdef void* __nvmlDeviceGetMinMaxClockOfPState = NULL +cdef void* __nvmlDeviceGetSupportedPerformanceStates = NULL +cdef void* __nvmlDeviceGetGpcClkMinMaxVfOffset = NULL +cdef void* __nvmlDeviceGetMemClkMinMaxVfOffset = NULL +cdef void* __nvmlDeviceGetClockOffsets = NULL +cdef void* __nvmlDeviceSetClockOffsets = NULL +cdef void* __nvmlDeviceGetPerformanceModes = NULL +cdef void* __nvmlDeviceGetCurrentClockFreqs = NULL +cdef void* __nvmlDeviceGetPowerManagementLimit = NULL +cdef void* __nvmlDeviceGetPowerManagementLimitConstraints = NULL +cdef void* __nvmlDeviceGetPowerManagementDefaultLimit = NULL +cdef void* __nvmlDeviceGetPowerUsage = NULL +cdef void* __nvmlDeviceGetTotalEnergyConsumption = NULL +cdef void* __nvmlDeviceGetEnforcedPowerLimit = NULL +cdef void* __nvmlDeviceGetGpuOperationMode = NULL +cdef void* __nvmlDeviceGetMemoryInfo_v2 = NULL +cdef void* __nvmlDeviceGetComputeMode = NULL +cdef void* __nvmlDeviceGetCudaComputeCapability = NULL +cdef void* __nvmlDeviceGetDramEncryptionMode = NULL +cdef void* __nvmlDeviceSetDramEncryptionMode = NULL +cdef void* __nvmlDeviceGetEccMode = NULL +cdef void* __nvmlDeviceGetDefaultEccMode = NULL +cdef void* __nvmlDeviceGetBoardId = NULL +cdef void* __nvmlDeviceGetMultiGpuBoard = NULL +cdef void* __nvmlDeviceGetTotalEccErrors = NULL +cdef void* __nvmlDeviceGetMemoryErrorCounter = NULL +cdef void* __nvmlDeviceGetUtilizationRates = NULL +cdef void* __nvmlDeviceGetEncoderUtilization = NULL +cdef void* __nvmlDeviceGetEncoderCapacity = NULL +cdef void* __nvmlDeviceGetEncoderStats = NULL +cdef void* __nvmlDeviceGetEncoderSessions = NULL +cdef void* __nvmlDeviceGetDecoderUtilization = NULL +cdef void* __nvmlDeviceGetJpgUtilization = NULL +cdef void* __nvmlDeviceGetOfaUtilization = NULL +cdef void* __nvmlDeviceGetFBCStats = NULL +cdef void* __nvmlDeviceGetFBCSessions = NULL +cdef void* __nvmlDeviceGetDriverModel_v2 = NULL +cdef void* __nvmlDeviceGetVbiosVersion = NULL +cdef void* __nvmlDeviceGetBridgeChipInfo = NULL +cdef void* __nvmlDeviceGetComputeRunningProcesses_v3 = NULL +cdef void* __nvmlDeviceGetGraphicsRunningProcesses_v3 = NULL +cdef void* __nvmlDeviceGetMPSComputeRunningProcesses_v3 = NULL +cdef void* __nvmlDeviceGetRunningProcessDetailList = NULL +cdef void* __nvmlDeviceOnSameBoard = NULL +cdef void* __nvmlDeviceGetAPIRestriction = NULL +cdef void* __nvmlDeviceGetSamples = NULL +cdef void* __nvmlDeviceGetBAR1MemoryInfo = NULL +cdef void* __nvmlDeviceGetIrqNum = NULL +cdef void* __nvmlDeviceGetNumGpuCores = NULL +cdef void* __nvmlDeviceGetPowerSource = NULL +cdef void* __nvmlDeviceGetMemoryBusWidth = NULL +cdef void* __nvmlDeviceGetPcieLinkMaxSpeed = NULL +cdef void* __nvmlDeviceGetPcieSpeed = NULL +cdef void* __nvmlDeviceGetAdaptiveClockInfoStatus = NULL +cdef void* __nvmlDeviceGetBusType = NULL +cdef void* __nvmlDeviceGetGpuFabricInfoV = NULL +cdef void* __nvmlSystemGetConfComputeCapabilities = NULL +cdef void* __nvmlSystemGetConfComputeState = NULL +cdef void* __nvmlDeviceGetConfComputeMemSizeInfo = NULL +cdef void* __nvmlSystemGetConfComputeGpusReadyState = NULL +cdef void* __nvmlDeviceGetConfComputeProtectedMemoryUsage = NULL +cdef void* __nvmlDeviceGetConfComputeGpuCertificate = NULL +cdef void* __nvmlDeviceGetConfComputeGpuAttestationReport = NULL +cdef void* __nvmlSystemGetConfComputeKeyRotationThresholdInfo = NULL +cdef void* __nvmlDeviceSetConfComputeUnprotectedMemSize = NULL +cdef void* __nvmlSystemSetConfComputeGpusReadyState = NULL +cdef void* __nvmlSystemSetConfComputeKeyRotationThresholdInfo = NULL +cdef void* __nvmlSystemGetConfComputeSettings = NULL +cdef void* __nvmlDeviceGetGspFirmwareVersion = NULL +cdef void* __nvmlDeviceGetGspFirmwareMode = NULL +cdef void* __nvmlDeviceGetSramEccErrorStatus = NULL +cdef void* __nvmlDeviceGetAccountingMode = NULL +cdef void* __nvmlDeviceGetAccountingStats = NULL +cdef void* __nvmlDeviceGetAccountingPids = NULL +cdef void* __nvmlDeviceGetAccountingBufferSize = NULL +cdef void* __nvmlDeviceGetRetiredPages = NULL +cdef void* __nvmlDeviceGetRetiredPages_v2 = NULL +cdef void* __nvmlDeviceGetRetiredPagesPendingStatus = NULL +cdef void* __nvmlDeviceGetRemappedRows = NULL +cdef void* __nvmlDeviceGetRowRemapperHistogram = NULL +cdef void* __nvmlDeviceGetArchitecture = NULL +cdef void* __nvmlDeviceGetClkMonStatus = NULL +cdef void* __nvmlDeviceGetProcessUtilization = NULL +cdef void* __nvmlDeviceGetProcessesUtilizationInfo = NULL +cdef void* __nvmlDeviceGetPlatformInfo = NULL +cdef void* __nvmlUnitSetLedState = NULL +cdef void* __nvmlDeviceSetPersistenceMode = NULL +cdef void* __nvmlDeviceSetComputeMode = NULL +cdef void* __nvmlDeviceSetEccMode = NULL +cdef void* __nvmlDeviceClearEccErrorCounts = NULL +cdef void* __nvmlDeviceSetDriverModel = NULL +cdef void* __nvmlDeviceSetGpuLockedClocks = NULL +cdef void* __nvmlDeviceResetGpuLockedClocks = NULL +cdef void* __nvmlDeviceSetMemoryLockedClocks = NULL +cdef void* __nvmlDeviceResetMemoryLockedClocks = NULL +cdef void* __nvmlDeviceSetAutoBoostedClocksEnabled = NULL +cdef void* __nvmlDeviceSetDefaultAutoBoostedClocksEnabled = NULL +cdef void* __nvmlDeviceSetDefaultFanSpeed_v2 = NULL +cdef void* __nvmlDeviceSetFanControlPolicy = NULL +cdef void* __nvmlDeviceSetTemperatureThreshold = NULL +cdef void* __nvmlDeviceSetGpuOperationMode = NULL +cdef void* __nvmlDeviceSetAPIRestriction = NULL +cdef void* __nvmlDeviceSetFanSpeed_v2 = NULL +cdef void* __nvmlDeviceSetAccountingMode = NULL +cdef void* __nvmlDeviceClearAccountingPids = NULL +cdef void* __nvmlDeviceSetPowerManagementLimit_v2 = NULL +cdef void* __nvmlDeviceGetNvLinkState = NULL +cdef void* __nvmlDeviceGetNvLinkVersion = NULL +cdef void* __nvmlDeviceGetNvLinkCapability = NULL +cdef void* __nvmlDeviceGetNvLinkRemotePciInfo_v2 = NULL +cdef void* __nvmlDeviceGetNvLinkErrorCounter = NULL +cdef void* __nvmlDeviceResetNvLinkErrorCounters = NULL +cdef void* __nvmlDeviceGetNvLinkRemoteDeviceType = NULL +cdef void* __nvmlDeviceSetNvLinkDeviceLowPowerThreshold = NULL +cdef void* __nvmlSystemSetNvlinkBwMode = NULL +cdef void* __nvmlSystemGetNvlinkBwMode = NULL +cdef void* __nvmlDeviceGetNvlinkSupportedBwModes = NULL +cdef void* __nvmlDeviceGetNvlinkBwMode = NULL +cdef void* __nvmlDeviceSetNvlinkBwMode = NULL +cdef void* __nvmlEventSetCreate = NULL +cdef void* __nvmlDeviceRegisterEvents = NULL +cdef void* __nvmlDeviceGetSupportedEventTypes = NULL +cdef void* __nvmlEventSetWait_v2 = NULL +cdef void* __nvmlEventSetFree = NULL +cdef void* __nvmlSystemEventSetCreate = NULL +cdef void* __nvmlSystemEventSetFree = NULL +cdef void* __nvmlSystemRegisterEvents = NULL +cdef void* __nvmlSystemEventSetWait = NULL +cdef void* __nvmlDeviceModifyDrainState = NULL +cdef void* __nvmlDeviceQueryDrainState = NULL +cdef void* __nvmlDeviceRemoveGpu_v2 = NULL +cdef void* __nvmlDeviceDiscoverGpus = NULL +cdef void* __nvmlDeviceGetFieldValues = NULL +cdef void* __nvmlDeviceClearFieldValues = NULL +cdef void* __nvmlDeviceGetVirtualizationMode = NULL +cdef void* __nvmlDeviceGetHostVgpuMode = NULL +cdef void* __nvmlDeviceSetVirtualizationMode = NULL +cdef void* __nvmlDeviceGetVgpuHeterogeneousMode = NULL +cdef void* __nvmlDeviceSetVgpuHeterogeneousMode = NULL +cdef void* __nvmlVgpuInstanceGetPlacementId = NULL +cdef void* __nvmlDeviceGetVgpuTypeSupportedPlacements = NULL +cdef void* __nvmlDeviceGetVgpuTypeCreatablePlacements = NULL +cdef void* __nvmlVgpuTypeGetGspHeapSize = NULL +cdef void* __nvmlVgpuTypeGetFbReservation = NULL +cdef void* __nvmlVgpuInstanceGetRuntimeStateSize = NULL +cdef void* __nvmlDeviceSetVgpuCapabilities = NULL +cdef void* __nvmlDeviceGetGridLicensableFeatures_v4 = NULL +cdef void* __nvmlGetVgpuDriverCapabilities = NULL +cdef void* __nvmlDeviceGetVgpuCapabilities = NULL +cdef void* __nvmlDeviceGetSupportedVgpus = NULL +cdef void* __nvmlDeviceGetCreatableVgpus = NULL +cdef void* __nvmlVgpuTypeGetClass = NULL +cdef void* __nvmlVgpuTypeGetName = NULL +cdef void* __nvmlVgpuTypeGetGpuInstanceProfileId = NULL +cdef void* __nvmlVgpuTypeGetDeviceID = NULL +cdef void* __nvmlVgpuTypeGetFramebufferSize = NULL +cdef void* __nvmlVgpuTypeGetNumDisplayHeads = NULL +cdef void* __nvmlVgpuTypeGetResolution = NULL +cdef void* __nvmlVgpuTypeGetLicense = NULL +cdef void* __nvmlVgpuTypeGetFrameRateLimit = NULL +cdef void* __nvmlVgpuTypeGetMaxInstances = NULL +cdef void* __nvmlVgpuTypeGetMaxInstancesPerVm = NULL +cdef void* __nvmlVgpuTypeGetBAR1Info = NULL +cdef void* __nvmlDeviceGetActiveVgpus = NULL +cdef void* __nvmlVgpuInstanceGetVmID = NULL +cdef void* __nvmlVgpuInstanceGetUUID = NULL +cdef void* __nvmlVgpuInstanceGetVmDriverVersion = NULL +cdef void* __nvmlVgpuInstanceGetFbUsage = NULL +cdef void* __nvmlVgpuInstanceGetLicenseStatus = NULL +cdef void* __nvmlVgpuInstanceGetType = NULL +cdef void* __nvmlVgpuInstanceGetFrameRateLimit = NULL +cdef void* __nvmlVgpuInstanceGetEccMode = NULL +cdef void* __nvmlVgpuInstanceGetEncoderCapacity = NULL +cdef void* __nvmlVgpuInstanceSetEncoderCapacity = NULL +cdef void* __nvmlVgpuInstanceGetEncoderStats = NULL +cdef void* __nvmlVgpuInstanceGetEncoderSessions = NULL +cdef void* __nvmlVgpuInstanceGetFBCStats = NULL +cdef void* __nvmlVgpuInstanceGetFBCSessions = NULL +cdef void* __nvmlVgpuInstanceGetGpuInstanceId = NULL +cdef void* __nvmlVgpuInstanceGetGpuPciId = NULL +cdef void* __nvmlVgpuTypeGetCapabilities = NULL +cdef void* __nvmlVgpuInstanceGetMdevUUID = NULL +cdef void* __nvmlGpuInstanceGetCreatableVgpus = NULL +cdef void* __nvmlVgpuTypeGetMaxInstancesPerGpuInstance = NULL +cdef void* __nvmlGpuInstanceGetActiveVgpus = NULL +cdef void* __nvmlGpuInstanceSetVgpuSchedulerState = NULL +cdef void* __nvmlGpuInstanceGetVgpuSchedulerState = NULL +cdef void* __nvmlGpuInstanceGetVgpuSchedulerLog = NULL +cdef void* __nvmlGpuInstanceGetVgpuTypeCreatablePlacements = NULL +cdef void* __nvmlGpuInstanceGetVgpuHeterogeneousMode = NULL +cdef void* __nvmlGpuInstanceSetVgpuHeterogeneousMode = NULL +cdef void* __nvmlVgpuInstanceGetMetadata = NULL +cdef void* __nvmlDeviceGetVgpuMetadata = NULL +cdef void* __nvmlGetVgpuCompatibility = NULL +cdef void* __nvmlDeviceGetPgpuMetadataString = NULL +cdef void* __nvmlDeviceGetVgpuSchedulerLog = NULL +cdef void* __nvmlDeviceGetVgpuSchedulerState = NULL +cdef void* __nvmlDeviceGetVgpuSchedulerCapabilities = NULL +cdef void* __nvmlDeviceSetVgpuSchedulerState = NULL +cdef void* __nvmlGetVgpuVersion = NULL +cdef void* __nvmlSetVgpuVersion = NULL +cdef void* __nvmlDeviceGetVgpuUtilization = NULL +cdef void* __nvmlDeviceGetVgpuInstancesUtilizationInfo = NULL +cdef void* __nvmlDeviceGetVgpuProcessUtilization = NULL +cdef void* __nvmlDeviceGetVgpuProcessesUtilizationInfo = NULL +cdef void* __nvmlVgpuInstanceGetAccountingMode = NULL +cdef void* __nvmlVgpuInstanceGetAccountingPids = NULL +cdef void* __nvmlVgpuInstanceGetAccountingStats = NULL +cdef void* __nvmlVgpuInstanceClearAccountingPids = NULL +cdef void* __nvmlVgpuInstanceGetLicenseInfo_v2 = NULL +cdef void* __nvmlGetExcludedDeviceCount = NULL +cdef void* __nvmlGetExcludedDeviceInfoByIndex = NULL +cdef void* __nvmlDeviceSetMigMode = NULL +cdef void* __nvmlDeviceGetMigMode = NULL +cdef void* __nvmlDeviceGetGpuInstanceProfileInfoV = NULL +cdef void* __nvmlDeviceGetGpuInstancePossiblePlacements_v2 = NULL +cdef void* __nvmlDeviceGetGpuInstanceRemainingCapacity = NULL +cdef void* __nvmlDeviceCreateGpuInstance = NULL +cdef void* __nvmlDeviceCreateGpuInstanceWithPlacement = NULL +cdef void* __nvmlGpuInstanceDestroy = NULL +cdef void* __nvmlDeviceGetGpuInstances = NULL +cdef void* __nvmlDeviceGetGpuInstanceById = NULL +cdef void* __nvmlGpuInstanceGetInfo = NULL +cdef void* __nvmlGpuInstanceGetComputeInstanceProfileInfoV = NULL +cdef void* __nvmlGpuInstanceGetComputeInstanceRemainingCapacity = NULL +cdef void* __nvmlGpuInstanceGetComputeInstancePossiblePlacements = NULL +cdef void* __nvmlGpuInstanceCreateComputeInstance = NULL +cdef void* __nvmlGpuInstanceCreateComputeInstanceWithPlacement = NULL +cdef void* __nvmlComputeInstanceDestroy = NULL +cdef void* __nvmlGpuInstanceGetComputeInstances = NULL +cdef void* __nvmlGpuInstanceGetComputeInstanceById = NULL +cdef void* __nvmlComputeInstanceGetInfo_v2 = NULL +cdef void* __nvmlDeviceIsMigDeviceHandle = NULL +cdef void* __nvmlDeviceGetGpuInstanceId = NULL +cdef void* __nvmlDeviceGetComputeInstanceId = NULL +cdef void* __nvmlDeviceGetMaxMigDeviceCount = NULL +cdef void* __nvmlDeviceGetMigDeviceHandleByIndex = NULL +cdef void* __nvmlDeviceGetDeviceHandleFromMigDeviceHandle = NULL +cdef void* __nvmlDeviceGetCapabilities = NULL +cdef void* __nvmlDevicePowerSmoothingActivatePresetProfile = NULL +cdef void* __nvmlDevicePowerSmoothingUpdatePresetProfileParam = NULL +cdef void* __nvmlDevicePowerSmoothingSetState = NULL +cdef void* __nvmlDeviceGetAddressingMode = NULL +cdef void* __nvmlDeviceGetRepairStatus = NULL +cdef void* __nvmlDeviceGetPowerMizerMode_v1 = NULL +cdef void* __nvmlDeviceSetPowerMizerMode_v1 = NULL +cdef void* __nvmlDeviceGetPdi = NULL +cdef void* __nvmlDeviceSetHostname_v1 = NULL +cdef void* __nvmlDeviceGetHostname_v1 = NULL +cdef void* __nvmlDeviceGetNvLinkInfo = NULL +cdef void* __nvmlDeviceReadWritePRM_v1 = NULL +cdef void* __nvmlDeviceGetGpuInstanceProfileInfoByIdV = NULL +cdef void* __nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts = NULL +cdef void* __nvmlDeviceGetUnrepairableMemoryFlag_v1 = NULL +cdef void* __nvmlDeviceReadPRMCounters_v1 = NULL +cdef void* __nvmlDeviceSetRusdSettings_v1 = NULL +cdef void* __nvmlDeviceVgpuForceGspUnload = NULL +cdef void* __nvmlDeviceGetVgpuSchedulerState_v2 = NULL +cdef void* __nvmlGpuInstanceGetVgpuSchedulerState_v2 = NULL +cdef void* __nvmlDeviceGetVgpuSchedulerLog_v2 = NULL +cdef void* __nvmlGpuInstanceGetVgpuSchedulerLog_v2 = NULL +cdef void* __nvmlDeviceSetVgpuSchedulerState_v2 = NULL +cdef void* __nvmlGpuInstanceSetVgpuSchedulerState_v2 = NULL + +cdef int _init_nvml() except -1 nogil: + global _cyb___py_nvml_init + + cdef int err + cdef uintptr_t handle + with gil, _cyb_symbol_lock: + if _cyb___py_nvml_init: return 0 + + handle = load_library() + global __nvmlInit_v2 + __nvmlInit_v2 = _cyb_GetProcAddress(handle, 'nvmlInit_v2') + + global __nvmlInitWithFlags + __nvmlInitWithFlags = _cyb_GetProcAddress(handle, 'nvmlInitWithFlags') + + global __nvmlShutdown + __nvmlShutdown = _cyb_GetProcAddress(handle, 'nvmlShutdown') + + global __nvmlErrorString + __nvmlErrorString = _cyb_GetProcAddress(handle, 'nvmlErrorString') + + global __nvmlSystemGetDriverVersion + __nvmlSystemGetDriverVersion = _cyb_GetProcAddress(handle, 'nvmlSystemGetDriverVersion') + + global __nvmlSystemGetNVMLVersion + __nvmlSystemGetNVMLVersion = _cyb_GetProcAddress(handle, 'nvmlSystemGetNVMLVersion') + + global __nvmlSystemGetCudaDriverVersion + __nvmlSystemGetCudaDriverVersion = _cyb_GetProcAddress(handle, 'nvmlSystemGetCudaDriverVersion') + + global __nvmlSystemGetCudaDriverVersion_v2 + __nvmlSystemGetCudaDriverVersion_v2 = _cyb_GetProcAddress(handle, 'nvmlSystemGetCudaDriverVersion_v2') + + global __nvmlSystemGetProcessName + __nvmlSystemGetProcessName = _cyb_GetProcAddress(handle, 'nvmlSystemGetProcessName') + + global __nvmlSystemGetHicVersion + __nvmlSystemGetHicVersion = _cyb_GetProcAddress(handle, 'nvmlSystemGetHicVersion') + + global __nvmlSystemGetTopologyGpuSet + __nvmlSystemGetTopologyGpuSet = _cyb_GetProcAddress(handle, 'nvmlSystemGetTopologyGpuSet') + + global __nvmlSystemGetDriverBranch + __nvmlSystemGetDriverBranch = _cyb_GetProcAddress(handle, 'nvmlSystemGetDriverBranch') + + global __nvmlUnitGetCount + __nvmlUnitGetCount = _cyb_GetProcAddress(handle, 'nvmlUnitGetCount') + + global __nvmlUnitGetHandleByIndex + __nvmlUnitGetHandleByIndex = _cyb_GetProcAddress(handle, 'nvmlUnitGetHandleByIndex') + + global __nvmlUnitGetUnitInfo + __nvmlUnitGetUnitInfo = _cyb_GetProcAddress(handle, 'nvmlUnitGetUnitInfo') + + global __nvmlUnitGetLedState + __nvmlUnitGetLedState = _cyb_GetProcAddress(handle, 'nvmlUnitGetLedState') + + global __nvmlUnitGetPsuInfo + __nvmlUnitGetPsuInfo = _cyb_GetProcAddress(handle, 'nvmlUnitGetPsuInfo') + + global __nvmlUnitGetTemperature + __nvmlUnitGetTemperature = _cyb_GetProcAddress(handle, 'nvmlUnitGetTemperature') + + global __nvmlUnitGetFanSpeedInfo + __nvmlUnitGetFanSpeedInfo = _cyb_GetProcAddress(handle, 'nvmlUnitGetFanSpeedInfo') + + global __nvmlUnitGetDevices + __nvmlUnitGetDevices = _cyb_GetProcAddress(handle, 'nvmlUnitGetDevices') + + global __nvmlDeviceGetCount_v2 + __nvmlDeviceGetCount_v2 = _cyb_GetProcAddress(handle, 'nvmlDeviceGetCount_v2') + + global __nvmlDeviceGetAttributes_v2 + __nvmlDeviceGetAttributes_v2 = _cyb_GetProcAddress(handle, 'nvmlDeviceGetAttributes_v2') + + global __nvmlDeviceGetHandleByIndex_v2 + __nvmlDeviceGetHandleByIndex_v2 = _cyb_GetProcAddress(handle, 'nvmlDeviceGetHandleByIndex_v2') + + global __nvmlDeviceGetHandleBySerial + __nvmlDeviceGetHandleBySerial = _cyb_GetProcAddress(handle, 'nvmlDeviceGetHandleBySerial') + + global __nvmlDeviceGetHandleByUUID + __nvmlDeviceGetHandleByUUID = _cyb_GetProcAddress(handle, 'nvmlDeviceGetHandleByUUID') + + global __nvmlDeviceGetHandleByUUIDV + __nvmlDeviceGetHandleByUUIDV = _cyb_GetProcAddress(handle, 'nvmlDeviceGetHandleByUUIDV') + + global __nvmlDeviceGetHandleByPciBusId_v2 + __nvmlDeviceGetHandleByPciBusId_v2 = _cyb_GetProcAddress(handle, 'nvmlDeviceGetHandleByPciBusId_v2') + + global __nvmlDeviceGetName + __nvmlDeviceGetName = _cyb_GetProcAddress(handle, 'nvmlDeviceGetName') + + global __nvmlDeviceGetBrand + __nvmlDeviceGetBrand = _cyb_GetProcAddress(handle, 'nvmlDeviceGetBrand') + + global __nvmlDeviceGetIndex + __nvmlDeviceGetIndex = _cyb_GetProcAddress(handle, 'nvmlDeviceGetIndex') + + global __nvmlDeviceGetSerial + __nvmlDeviceGetSerial = _cyb_GetProcAddress(handle, 'nvmlDeviceGetSerial') + + global __nvmlDeviceGetModuleId + __nvmlDeviceGetModuleId = _cyb_GetProcAddress(handle, 'nvmlDeviceGetModuleId') + + global __nvmlDeviceGetC2cModeInfoV + __nvmlDeviceGetC2cModeInfoV = _cyb_GetProcAddress(handle, 'nvmlDeviceGetC2cModeInfoV') + + global __nvmlDeviceGetMemoryAffinity + __nvmlDeviceGetMemoryAffinity = _cyb_GetProcAddress(handle, 'nvmlDeviceGetMemoryAffinity') + + global __nvmlDeviceGetCpuAffinityWithinScope + __nvmlDeviceGetCpuAffinityWithinScope = _cyb_GetProcAddress(handle, 'nvmlDeviceGetCpuAffinityWithinScope') + + global __nvmlDeviceGetCpuAffinity + __nvmlDeviceGetCpuAffinity = _cyb_GetProcAddress(handle, 'nvmlDeviceGetCpuAffinity') + + global __nvmlDeviceSetCpuAffinity + __nvmlDeviceSetCpuAffinity = _cyb_GetProcAddress(handle, 'nvmlDeviceSetCpuAffinity') + + global __nvmlDeviceClearCpuAffinity + __nvmlDeviceClearCpuAffinity = _cyb_GetProcAddress(handle, 'nvmlDeviceClearCpuAffinity') + + global __nvmlDeviceGetNumaNodeId + __nvmlDeviceGetNumaNodeId = _cyb_GetProcAddress(handle, 'nvmlDeviceGetNumaNodeId') + + global __nvmlDeviceGetTopologyCommonAncestor + __nvmlDeviceGetTopologyCommonAncestor = _cyb_GetProcAddress(handle, 'nvmlDeviceGetTopologyCommonAncestor') + + global __nvmlDeviceGetTopologyNearestGpus + __nvmlDeviceGetTopologyNearestGpus = _cyb_GetProcAddress(handle, 'nvmlDeviceGetTopologyNearestGpus') + + global __nvmlDeviceGetP2PStatus + __nvmlDeviceGetP2PStatus = _cyb_GetProcAddress(handle, 'nvmlDeviceGetP2PStatus') + + global __nvmlDeviceGetUUID + __nvmlDeviceGetUUID = _cyb_GetProcAddress(handle, 'nvmlDeviceGetUUID') + + global __nvmlDeviceGetMinorNumber + __nvmlDeviceGetMinorNumber = _cyb_GetProcAddress(handle, 'nvmlDeviceGetMinorNumber') + + global __nvmlDeviceGetBoardPartNumber + __nvmlDeviceGetBoardPartNumber = _cyb_GetProcAddress(handle, 'nvmlDeviceGetBoardPartNumber') + + global __nvmlDeviceGetInforomVersion + __nvmlDeviceGetInforomVersion = _cyb_GetProcAddress(handle, 'nvmlDeviceGetInforomVersion') + + global __nvmlDeviceGetInforomImageVersion + __nvmlDeviceGetInforomImageVersion = _cyb_GetProcAddress(handle, 'nvmlDeviceGetInforomImageVersion') + + global __nvmlDeviceGetInforomConfigurationChecksum + __nvmlDeviceGetInforomConfigurationChecksum = _cyb_GetProcAddress(handle, 'nvmlDeviceGetInforomConfigurationChecksum') + + global __nvmlDeviceValidateInforom + __nvmlDeviceValidateInforom = _cyb_GetProcAddress(handle, 'nvmlDeviceValidateInforom') + + global __nvmlDeviceGetLastBBXFlushTime + __nvmlDeviceGetLastBBXFlushTime = _cyb_GetProcAddress(handle, 'nvmlDeviceGetLastBBXFlushTime') + + global __nvmlDeviceGetDisplayMode + __nvmlDeviceGetDisplayMode = _cyb_GetProcAddress(handle, 'nvmlDeviceGetDisplayMode') + + global __nvmlDeviceGetDisplayActive + __nvmlDeviceGetDisplayActive = _cyb_GetProcAddress(handle, 'nvmlDeviceGetDisplayActive') + + global __nvmlDeviceGetPersistenceMode + __nvmlDeviceGetPersistenceMode = _cyb_GetProcAddress(handle, 'nvmlDeviceGetPersistenceMode') + + global __nvmlDeviceGetPciInfoExt + __nvmlDeviceGetPciInfoExt = _cyb_GetProcAddress(handle, 'nvmlDeviceGetPciInfoExt') + + global __nvmlDeviceGetPciInfo_v3 + __nvmlDeviceGetPciInfo_v3 = _cyb_GetProcAddress(handle, 'nvmlDeviceGetPciInfo_v3') + + global __nvmlDeviceGetMaxPcieLinkGeneration + __nvmlDeviceGetMaxPcieLinkGeneration = _cyb_GetProcAddress(handle, 'nvmlDeviceGetMaxPcieLinkGeneration') + + global __nvmlDeviceGetGpuMaxPcieLinkGeneration + __nvmlDeviceGetGpuMaxPcieLinkGeneration = _cyb_GetProcAddress(handle, 'nvmlDeviceGetGpuMaxPcieLinkGeneration') + + global __nvmlDeviceGetMaxPcieLinkWidth + __nvmlDeviceGetMaxPcieLinkWidth = _cyb_GetProcAddress(handle, 'nvmlDeviceGetMaxPcieLinkWidth') + + global __nvmlDeviceGetCurrPcieLinkGeneration + __nvmlDeviceGetCurrPcieLinkGeneration = _cyb_GetProcAddress(handle, 'nvmlDeviceGetCurrPcieLinkGeneration') + + global __nvmlDeviceGetCurrPcieLinkWidth + __nvmlDeviceGetCurrPcieLinkWidth = _cyb_GetProcAddress(handle, 'nvmlDeviceGetCurrPcieLinkWidth') + + global __nvmlDeviceGetPcieThroughput + __nvmlDeviceGetPcieThroughput = _cyb_GetProcAddress(handle, 'nvmlDeviceGetPcieThroughput') + + global __nvmlDeviceGetPcieReplayCounter + __nvmlDeviceGetPcieReplayCounter = _cyb_GetProcAddress(handle, 'nvmlDeviceGetPcieReplayCounter') + + global __nvmlDeviceGetClockInfo + __nvmlDeviceGetClockInfo = _cyb_GetProcAddress(handle, 'nvmlDeviceGetClockInfo') + + global __nvmlDeviceGetMaxClockInfo + __nvmlDeviceGetMaxClockInfo = _cyb_GetProcAddress(handle, 'nvmlDeviceGetMaxClockInfo') + + global __nvmlDeviceGetGpcClkVfOffset + __nvmlDeviceGetGpcClkVfOffset = _cyb_GetProcAddress(handle, 'nvmlDeviceGetGpcClkVfOffset') + + global __nvmlDeviceGetClock + __nvmlDeviceGetClock = _cyb_GetProcAddress(handle, 'nvmlDeviceGetClock') + + global __nvmlDeviceGetMaxCustomerBoostClock + __nvmlDeviceGetMaxCustomerBoostClock = _cyb_GetProcAddress(handle, 'nvmlDeviceGetMaxCustomerBoostClock') + + global __nvmlDeviceGetSupportedMemoryClocks + __nvmlDeviceGetSupportedMemoryClocks = _cyb_GetProcAddress(handle, 'nvmlDeviceGetSupportedMemoryClocks') + + global __nvmlDeviceGetSupportedGraphicsClocks + __nvmlDeviceGetSupportedGraphicsClocks = _cyb_GetProcAddress(handle, 'nvmlDeviceGetSupportedGraphicsClocks') + + global __nvmlDeviceGetAutoBoostedClocksEnabled + __nvmlDeviceGetAutoBoostedClocksEnabled = _cyb_GetProcAddress(handle, 'nvmlDeviceGetAutoBoostedClocksEnabled') + + global __nvmlDeviceGetFanSpeed + __nvmlDeviceGetFanSpeed = _cyb_GetProcAddress(handle, 'nvmlDeviceGetFanSpeed') + + global __nvmlDeviceGetFanSpeed_v2 + __nvmlDeviceGetFanSpeed_v2 = _cyb_GetProcAddress(handle, 'nvmlDeviceGetFanSpeed_v2') + + global __nvmlDeviceGetFanSpeedRPM + __nvmlDeviceGetFanSpeedRPM = _cyb_GetProcAddress(handle, 'nvmlDeviceGetFanSpeedRPM') + + global __nvmlDeviceGetTargetFanSpeed + __nvmlDeviceGetTargetFanSpeed = _cyb_GetProcAddress(handle, 'nvmlDeviceGetTargetFanSpeed') + + global __nvmlDeviceGetMinMaxFanSpeed + __nvmlDeviceGetMinMaxFanSpeed = _cyb_GetProcAddress(handle, 'nvmlDeviceGetMinMaxFanSpeed') + + global __nvmlDeviceGetFanControlPolicy_v2 + __nvmlDeviceGetFanControlPolicy_v2 = _cyb_GetProcAddress(handle, 'nvmlDeviceGetFanControlPolicy_v2') + + global __nvmlDeviceGetNumFans + __nvmlDeviceGetNumFans = _cyb_GetProcAddress(handle, 'nvmlDeviceGetNumFans') + + global __nvmlDeviceGetCoolerInfo + __nvmlDeviceGetCoolerInfo = _cyb_GetProcAddress(handle, 'nvmlDeviceGetCoolerInfo') + + global __nvmlDeviceGetTemperatureV + __nvmlDeviceGetTemperatureV = _cyb_GetProcAddress(handle, 'nvmlDeviceGetTemperatureV') + + global __nvmlDeviceGetTemperatureThreshold + __nvmlDeviceGetTemperatureThreshold = _cyb_GetProcAddress(handle, 'nvmlDeviceGetTemperatureThreshold') + + global __nvmlDeviceGetMarginTemperature + __nvmlDeviceGetMarginTemperature = _cyb_GetProcAddress(handle, 'nvmlDeviceGetMarginTemperature') + + global __nvmlDeviceGetThermalSettings + __nvmlDeviceGetThermalSettings = _cyb_GetProcAddress(handle, 'nvmlDeviceGetThermalSettings') + + global __nvmlDeviceGetPerformanceState + __nvmlDeviceGetPerformanceState = _cyb_GetProcAddress(handle, 'nvmlDeviceGetPerformanceState') + + global __nvmlDeviceGetCurrentClocksEventReasons + __nvmlDeviceGetCurrentClocksEventReasons = _cyb_GetProcAddress(handle, 'nvmlDeviceGetCurrentClocksEventReasons') + + global __nvmlDeviceGetSupportedClocksEventReasons + __nvmlDeviceGetSupportedClocksEventReasons = _cyb_GetProcAddress(handle, 'nvmlDeviceGetSupportedClocksEventReasons') + + global __nvmlDeviceGetPowerState + __nvmlDeviceGetPowerState = _cyb_GetProcAddress(handle, 'nvmlDeviceGetPowerState') + + global __nvmlDeviceGetDynamicPstatesInfo + __nvmlDeviceGetDynamicPstatesInfo = _cyb_GetProcAddress(handle, 'nvmlDeviceGetDynamicPstatesInfo') + + global __nvmlDeviceGetMemClkVfOffset + __nvmlDeviceGetMemClkVfOffset = _cyb_GetProcAddress(handle, 'nvmlDeviceGetMemClkVfOffset') + + global __nvmlDeviceGetMinMaxClockOfPState + __nvmlDeviceGetMinMaxClockOfPState = _cyb_GetProcAddress(handle, 'nvmlDeviceGetMinMaxClockOfPState') + + global __nvmlDeviceGetSupportedPerformanceStates + __nvmlDeviceGetSupportedPerformanceStates = _cyb_GetProcAddress(handle, 'nvmlDeviceGetSupportedPerformanceStates') + + global __nvmlDeviceGetGpcClkMinMaxVfOffset + __nvmlDeviceGetGpcClkMinMaxVfOffset = _cyb_GetProcAddress(handle, 'nvmlDeviceGetGpcClkMinMaxVfOffset') + + global __nvmlDeviceGetMemClkMinMaxVfOffset + __nvmlDeviceGetMemClkMinMaxVfOffset = _cyb_GetProcAddress(handle, 'nvmlDeviceGetMemClkMinMaxVfOffset') + + global __nvmlDeviceGetClockOffsets + __nvmlDeviceGetClockOffsets = _cyb_GetProcAddress(handle, 'nvmlDeviceGetClockOffsets') + + global __nvmlDeviceSetClockOffsets + __nvmlDeviceSetClockOffsets = _cyb_GetProcAddress(handle, 'nvmlDeviceSetClockOffsets') + + global __nvmlDeviceGetPerformanceModes + __nvmlDeviceGetPerformanceModes = _cyb_GetProcAddress(handle, 'nvmlDeviceGetPerformanceModes') + + global __nvmlDeviceGetCurrentClockFreqs + __nvmlDeviceGetCurrentClockFreqs = _cyb_GetProcAddress(handle, 'nvmlDeviceGetCurrentClockFreqs') + + global __nvmlDeviceGetPowerManagementLimit + __nvmlDeviceGetPowerManagementLimit = _cyb_GetProcAddress(handle, 'nvmlDeviceGetPowerManagementLimit') + + global __nvmlDeviceGetPowerManagementLimitConstraints + __nvmlDeviceGetPowerManagementLimitConstraints = _cyb_GetProcAddress(handle, 'nvmlDeviceGetPowerManagementLimitConstraints') + + global __nvmlDeviceGetPowerManagementDefaultLimit + __nvmlDeviceGetPowerManagementDefaultLimit = _cyb_GetProcAddress(handle, 'nvmlDeviceGetPowerManagementDefaultLimit') + + global __nvmlDeviceGetPowerUsage + __nvmlDeviceGetPowerUsage = _cyb_GetProcAddress(handle, 'nvmlDeviceGetPowerUsage') + + global __nvmlDeviceGetTotalEnergyConsumption + __nvmlDeviceGetTotalEnergyConsumption = _cyb_GetProcAddress(handle, 'nvmlDeviceGetTotalEnergyConsumption') + + global __nvmlDeviceGetEnforcedPowerLimit + __nvmlDeviceGetEnforcedPowerLimit = _cyb_GetProcAddress(handle, 'nvmlDeviceGetEnforcedPowerLimit') + + global __nvmlDeviceGetGpuOperationMode + __nvmlDeviceGetGpuOperationMode = _cyb_GetProcAddress(handle, 'nvmlDeviceGetGpuOperationMode') + + global __nvmlDeviceGetMemoryInfo_v2 + __nvmlDeviceGetMemoryInfo_v2 = _cyb_GetProcAddress(handle, 'nvmlDeviceGetMemoryInfo_v2') + + global __nvmlDeviceGetComputeMode + __nvmlDeviceGetComputeMode = _cyb_GetProcAddress(handle, 'nvmlDeviceGetComputeMode') + + global __nvmlDeviceGetCudaComputeCapability + __nvmlDeviceGetCudaComputeCapability = _cyb_GetProcAddress(handle, 'nvmlDeviceGetCudaComputeCapability') + + global __nvmlDeviceGetDramEncryptionMode + __nvmlDeviceGetDramEncryptionMode = _cyb_GetProcAddress(handle, 'nvmlDeviceGetDramEncryptionMode') + + global __nvmlDeviceSetDramEncryptionMode + __nvmlDeviceSetDramEncryptionMode = _cyb_GetProcAddress(handle, 'nvmlDeviceSetDramEncryptionMode') + + global __nvmlDeviceGetEccMode + __nvmlDeviceGetEccMode = _cyb_GetProcAddress(handle, 'nvmlDeviceGetEccMode') + + global __nvmlDeviceGetDefaultEccMode + __nvmlDeviceGetDefaultEccMode = _cyb_GetProcAddress(handle, 'nvmlDeviceGetDefaultEccMode') + + global __nvmlDeviceGetBoardId + __nvmlDeviceGetBoardId = _cyb_GetProcAddress(handle, 'nvmlDeviceGetBoardId') + + global __nvmlDeviceGetMultiGpuBoard + __nvmlDeviceGetMultiGpuBoard = _cyb_GetProcAddress(handle, 'nvmlDeviceGetMultiGpuBoard') + + global __nvmlDeviceGetTotalEccErrors + __nvmlDeviceGetTotalEccErrors = _cyb_GetProcAddress(handle, 'nvmlDeviceGetTotalEccErrors') + + global __nvmlDeviceGetMemoryErrorCounter + __nvmlDeviceGetMemoryErrorCounter = _cyb_GetProcAddress(handle, 'nvmlDeviceGetMemoryErrorCounter') + + global __nvmlDeviceGetUtilizationRates + __nvmlDeviceGetUtilizationRates = _cyb_GetProcAddress(handle, 'nvmlDeviceGetUtilizationRates') + + global __nvmlDeviceGetEncoderUtilization + __nvmlDeviceGetEncoderUtilization = _cyb_GetProcAddress(handle, 'nvmlDeviceGetEncoderUtilization') + + global __nvmlDeviceGetEncoderCapacity + __nvmlDeviceGetEncoderCapacity = _cyb_GetProcAddress(handle, 'nvmlDeviceGetEncoderCapacity') + + global __nvmlDeviceGetEncoderStats + __nvmlDeviceGetEncoderStats = _cyb_GetProcAddress(handle, 'nvmlDeviceGetEncoderStats') + + global __nvmlDeviceGetEncoderSessions + __nvmlDeviceGetEncoderSessions = _cyb_GetProcAddress(handle, 'nvmlDeviceGetEncoderSessions') + + global __nvmlDeviceGetDecoderUtilization + __nvmlDeviceGetDecoderUtilization = _cyb_GetProcAddress(handle, 'nvmlDeviceGetDecoderUtilization') + + global __nvmlDeviceGetJpgUtilization + __nvmlDeviceGetJpgUtilization = _cyb_GetProcAddress(handle, 'nvmlDeviceGetJpgUtilization') + + global __nvmlDeviceGetOfaUtilization + __nvmlDeviceGetOfaUtilization = _cyb_GetProcAddress(handle, 'nvmlDeviceGetOfaUtilization') + + global __nvmlDeviceGetFBCStats + __nvmlDeviceGetFBCStats = _cyb_GetProcAddress(handle, 'nvmlDeviceGetFBCStats') + + global __nvmlDeviceGetFBCSessions + __nvmlDeviceGetFBCSessions = _cyb_GetProcAddress(handle, 'nvmlDeviceGetFBCSessions') + + global __nvmlDeviceGetDriverModel_v2 + __nvmlDeviceGetDriverModel_v2 = _cyb_GetProcAddress(handle, 'nvmlDeviceGetDriverModel_v2') + + global __nvmlDeviceGetVbiosVersion + __nvmlDeviceGetVbiosVersion = _cyb_GetProcAddress(handle, 'nvmlDeviceGetVbiosVersion') + + global __nvmlDeviceGetBridgeChipInfo + __nvmlDeviceGetBridgeChipInfo = _cyb_GetProcAddress(handle, 'nvmlDeviceGetBridgeChipInfo') + + global __nvmlDeviceGetComputeRunningProcesses_v3 + __nvmlDeviceGetComputeRunningProcesses_v3 = _cyb_GetProcAddress(handle, 'nvmlDeviceGetComputeRunningProcesses_v3') + + global __nvmlDeviceGetGraphicsRunningProcesses_v3 + __nvmlDeviceGetGraphicsRunningProcesses_v3 = _cyb_GetProcAddress(handle, 'nvmlDeviceGetGraphicsRunningProcesses_v3') + + global __nvmlDeviceGetMPSComputeRunningProcesses_v3 + __nvmlDeviceGetMPSComputeRunningProcesses_v3 = _cyb_GetProcAddress(handle, 'nvmlDeviceGetMPSComputeRunningProcesses_v3') + + global __nvmlDeviceGetRunningProcessDetailList + __nvmlDeviceGetRunningProcessDetailList = _cyb_GetProcAddress(handle, 'nvmlDeviceGetRunningProcessDetailList') + + global __nvmlDeviceOnSameBoard + __nvmlDeviceOnSameBoard = _cyb_GetProcAddress(handle, 'nvmlDeviceOnSameBoard') + + global __nvmlDeviceGetAPIRestriction + __nvmlDeviceGetAPIRestriction = _cyb_GetProcAddress(handle, 'nvmlDeviceGetAPIRestriction') + + global __nvmlDeviceGetSamples + __nvmlDeviceGetSamples = _cyb_GetProcAddress(handle, 'nvmlDeviceGetSamples') + + global __nvmlDeviceGetBAR1MemoryInfo + __nvmlDeviceGetBAR1MemoryInfo = _cyb_GetProcAddress(handle, 'nvmlDeviceGetBAR1MemoryInfo') + + global __nvmlDeviceGetIrqNum + __nvmlDeviceGetIrqNum = _cyb_GetProcAddress(handle, 'nvmlDeviceGetIrqNum') + + global __nvmlDeviceGetNumGpuCores + __nvmlDeviceGetNumGpuCores = _cyb_GetProcAddress(handle, 'nvmlDeviceGetNumGpuCores') + + global __nvmlDeviceGetPowerSource + __nvmlDeviceGetPowerSource = _cyb_GetProcAddress(handle, 'nvmlDeviceGetPowerSource') + + global __nvmlDeviceGetMemoryBusWidth + __nvmlDeviceGetMemoryBusWidth = _cyb_GetProcAddress(handle, 'nvmlDeviceGetMemoryBusWidth') + + global __nvmlDeviceGetPcieLinkMaxSpeed + __nvmlDeviceGetPcieLinkMaxSpeed = _cyb_GetProcAddress(handle, 'nvmlDeviceGetPcieLinkMaxSpeed') + + global __nvmlDeviceGetPcieSpeed + __nvmlDeviceGetPcieSpeed = _cyb_GetProcAddress(handle, 'nvmlDeviceGetPcieSpeed') + + global __nvmlDeviceGetAdaptiveClockInfoStatus + __nvmlDeviceGetAdaptiveClockInfoStatus = _cyb_GetProcAddress(handle, 'nvmlDeviceGetAdaptiveClockInfoStatus') + + global __nvmlDeviceGetBusType + __nvmlDeviceGetBusType = _cyb_GetProcAddress(handle, 'nvmlDeviceGetBusType') + + global __nvmlDeviceGetGpuFabricInfoV + __nvmlDeviceGetGpuFabricInfoV = _cyb_GetProcAddress(handle, 'nvmlDeviceGetGpuFabricInfoV') + + global __nvmlSystemGetConfComputeCapabilities + __nvmlSystemGetConfComputeCapabilities = _cyb_GetProcAddress(handle, 'nvmlSystemGetConfComputeCapabilities') + + global __nvmlSystemGetConfComputeState + __nvmlSystemGetConfComputeState = _cyb_GetProcAddress(handle, 'nvmlSystemGetConfComputeState') + + global __nvmlDeviceGetConfComputeMemSizeInfo + __nvmlDeviceGetConfComputeMemSizeInfo = _cyb_GetProcAddress(handle, 'nvmlDeviceGetConfComputeMemSizeInfo') + + global __nvmlSystemGetConfComputeGpusReadyState + __nvmlSystemGetConfComputeGpusReadyState = _cyb_GetProcAddress(handle, 'nvmlSystemGetConfComputeGpusReadyState') + + global __nvmlDeviceGetConfComputeProtectedMemoryUsage + __nvmlDeviceGetConfComputeProtectedMemoryUsage = _cyb_GetProcAddress(handle, 'nvmlDeviceGetConfComputeProtectedMemoryUsage') + + global __nvmlDeviceGetConfComputeGpuCertificate + __nvmlDeviceGetConfComputeGpuCertificate = _cyb_GetProcAddress(handle, 'nvmlDeviceGetConfComputeGpuCertificate') + + global __nvmlDeviceGetConfComputeGpuAttestationReport + __nvmlDeviceGetConfComputeGpuAttestationReport = _cyb_GetProcAddress(handle, 'nvmlDeviceGetConfComputeGpuAttestationReport') + + global __nvmlSystemGetConfComputeKeyRotationThresholdInfo + __nvmlSystemGetConfComputeKeyRotationThresholdInfo = _cyb_GetProcAddress(handle, 'nvmlSystemGetConfComputeKeyRotationThresholdInfo') + + global __nvmlDeviceSetConfComputeUnprotectedMemSize + __nvmlDeviceSetConfComputeUnprotectedMemSize = _cyb_GetProcAddress(handle, 'nvmlDeviceSetConfComputeUnprotectedMemSize') + + global __nvmlSystemSetConfComputeGpusReadyState + __nvmlSystemSetConfComputeGpusReadyState = _cyb_GetProcAddress(handle, 'nvmlSystemSetConfComputeGpusReadyState') + + global __nvmlSystemSetConfComputeKeyRotationThresholdInfo + __nvmlSystemSetConfComputeKeyRotationThresholdInfo = _cyb_GetProcAddress(handle, 'nvmlSystemSetConfComputeKeyRotationThresholdInfo') + + global __nvmlSystemGetConfComputeSettings + __nvmlSystemGetConfComputeSettings = _cyb_GetProcAddress(handle, 'nvmlSystemGetConfComputeSettings') + + global __nvmlDeviceGetGspFirmwareVersion + __nvmlDeviceGetGspFirmwareVersion = _cyb_GetProcAddress(handle, 'nvmlDeviceGetGspFirmwareVersion') + + global __nvmlDeviceGetGspFirmwareMode + __nvmlDeviceGetGspFirmwareMode = _cyb_GetProcAddress(handle, 'nvmlDeviceGetGspFirmwareMode') + + global __nvmlDeviceGetSramEccErrorStatus + __nvmlDeviceGetSramEccErrorStatus = _cyb_GetProcAddress(handle, 'nvmlDeviceGetSramEccErrorStatus') + + global __nvmlDeviceGetAccountingMode + __nvmlDeviceGetAccountingMode = _cyb_GetProcAddress(handle, 'nvmlDeviceGetAccountingMode') + + global __nvmlDeviceGetAccountingStats + __nvmlDeviceGetAccountingStats = _cyb_GetProcAddress(handle, 'nvmlDeviceGetAccountingStats') + + global __nvmlDeviceGetAccountingPids + __nvmlDeviceGetAccountingPids = _cyb_GetProcAddress(handle, 'nvmlDeviceGetAccountingPids') + + global __nvmlDeviceGetAccountingBufferSize + __nvmlDeviceGetAccountingBufferSize = _cyb_GetProcAddress(handle, 'nvmlDeviceGetAccountingBufferSize') + + global __nvmlDeviceGetRetiredPages + __nvmlDeviceGetRetiredPages = _cyb_GetProcAddress(handle, 'nvmlDeviceGetRetiredPages') + + global __nvmlDeviceGetRetiredPages_v2 + __nvmlDeviceGetRetiredPages_v2 = _cyb_GetProcAddress(handle, 'nvmlDeviceGetRetiredPages_v2') + + global __nvmlDeviceGetRetiredPagesPendingStatus + __nvmlDeviceGetRetiredPagesPendingStatus = _cyb_GetProcAddress(handle, 'nvmlDeviceGetRetiredPagesPendingStatus') + + global __nvmlDeviceGetRemappedRows + __nvmlDeviceGetRemappedRows = _cyb_GetProcAddress(handle, 'nvmlDeviceGetRemappedRows') + + global __nvmlDeviceGetRowRemapperHistogram + __nvmlDeviceGetRowRemapperHistogram = _cyb_GetProcAddress(handle, 'nvmlDeviceGetRowRemapperHistogram') + + global __nvmlDeviceGetArchitecture + __nvmlDeviceGetArchitecture = _cyb_GetProcAddress(handle, 'nvmlDeviceGetArchitecture') + + global __nvmlDeviceGetClkMonStatus + __nvmlDeviceGetClkMonStatus = _cyb_GetProcAddress(handle, 'nvmlDeviceGetClkMonStatus') + + global __nvmlDeviceGetProcessUtilization + __nvmlDeviceGetProcessUtilization = _cyb_GetProcAddress(handle, 'nvmlDeviceGetProcessUtilization') + + global __nvmlDeviceGetProcessesUtilizationInfo + __nvmlDeviceGetProcessesUtilizationInfo = _cyb_GetProcAddress(handle, 'nvmlDeviceGetProcessesUtilizationInfo') + + global __nvmlDeviceGetPlatformInfo + __nvmlDeviceGetPlatformInfo = _cyb_GetProcAddress(handle, 'nvmlDeviceGetPlatformInfo') + + global __nvmlUnitSetLedState + __nvmlUnitSetLedState = _cyb_GetProcAddress(handle, 'nvmlUnitSetLedState') + + global __nvmlDeviceSetPersistenceMode + __nvmlDeviceSetPersistenceMode = _cyb_GetProcAddress(handle, 'nvmlDeviceSetPersistenceMode') + + global __nvmlDeviceSetComputeMode + __nvmlDeviceSetComputeMode = _cyb_GetProcAddress(handle, 'nvmlDeviceSetComputeMode') + + global __nvmlDeviceSetEccMode + __nvmlDeviceSetEccMode = _cyb_GetProcAddress(handle, 'nvmlDeviceSetEccMode') + + global __nvmlDeviceClearEccErrorCounts + __nvmlDeviceClearEccErrorCounts = _cyb_GetProcAddress(handle, 'nvmlDeviceClearEccErrorCounts') + + global __nvmlDeviceSetDriverModel + __nvmlDeviceSetDriverModel = _cyb_GetProcAddress(handle, 'nvmlDeviceSetDriverModel') + + global __nvmlDeviceSetGpuLockedClocks + __nvmlDeviceSetGpuLockedClocks = _cyb_GetProcAddress(handle, 'nvmlDeviceSetGpuLockedClocks') + + global __nvmlDeviceResetGpuLockedClocks + __nvmlDeviceResetGpuLockedClocks = _cyb_GetProcAddress(handle, 'nvmlDeviceResetGpuLockedClocks') + + global __nvmlDeviceSetMemoryLockedClocks + __nvmlDeviceSetMemoryLockedClocks = _cyb_GetProcAddress(handle, 'nvmlDeviceSetMemoryLockedClocks') + + global __nvmlDeviceResetMemoryLockedClocks + __nvmlDeviceResetMemoryLockedClocks = _cyb_GetProcAddress(handle, 'nvmlDeviceResetMemoryLockedClocks') + + global __nvmlDeviceSetAutoBoostedClocksEnabled + __nvmlDeviceSetAutoBoostedClocksEnabled = _cyb_GetProcAddress(handle, 'nvmlDeviceSetAutoBoostedClocksEnabled') + + global __nvmlDeviceSetDefaultAutoBoostedClocksEnabled + __nvmlDeviceSetDefaultAutoBoostedClocksEnabled = _cyb_GetProcAddress(handle, 'nvmlDeviceSetDefaultAutoBoostedClocksEnabled') + + global __nvmlDeviceSetDefaultFanSpeed_v2 + __nvmlDeviceSetDefaultFanSpeed_v2 = _cyb_GetProcAddress(handle, 'nvmlDeviceSetDefaultFanSpeed_v2') + + global __nvmlDeviceSetFanControlPolicy + __nvmlDeviceSetFanControlPolicy = _cyb_GetProcAddress(handle, 'nvmlDeviceSetFanControlPolicy') + + global __nvmlDeviceSetTemperatureThreshold + __nvmlDeviceSetTemperatureThreshold = _cyb_GetProcAddress(handle, 'nvmlDeviceSetTemperatureThreshold') + + global __nvmlDeviceSetGpuOperationMode + __nvmlDeviceSetGpuOperationMode = _cyb_GetProcAddress(handle, 'nvmlDeviceSetGpuOperationMode') + + global __nvmlDeviceSetAPIRestriction + __nvmlDeviceSetAPIRestriction = _cyb_GetProcAddress(handle, 'nvmlDeviceSetAPIRestriction') + + global __nvmlDeviceSetFanSpeed_v2 + __nvmlDeviceSetFanSpeed_v2 = _cyb_GetProcAddress(handle, 'nvmlDeviceSetFanSpeed_v2') + + global __nvmlDeviceSetAccountingMode + __nvmlDeviceSetAccountingMode = _cyb_GetProcAddress(handle, 'nvmlDeviceSetAccountingMode') + + global __nvmlDeviceClearAccountingPids + __nvmlDeviceClearAccountingPids = _cyb_GetProcAddress(handle, 'nvmlDeviceClearAccountingPids') + + global __nvmlDeviceSetPowerManagementLimit_v2 + __nvmlDeviceSetPowerManagementLimit_v2 = _cyb_GetProcAddress(handle, 'nvmlDeviceSetPowerManagementLimit_v2') + + global __nvmlDeviceGetNvLinkState + __nvmlDeviceGetNvLinkState = _cyb_GetProcAddress(handle, 'nvmlDeviceGetNvLinkState') + + global __nvmlDeviceGetNvLinkVersion + __nvmlDeviceGetNvLinkVersion = _cyb_GetProcAddress(handle, 'nvmlDeviceGetNvLinkVersion') + + global __nvmlDeviceGetNvLinkCapability + __nvmlDeviceGetNvLinkCapability = _cyb_GetProcAddress(handle, 'nvmlDeviceGetNvLinkCapability') + + global __nvmlDeviceGetNvLinkRemotePciInfo_v2 + __nvmlDeviceGetNvLinkRemotePciInfo_v2 = _cyb_GetProcAddress(handle, 'nvmlDeviceGetNvLinkRemotePciInfo_v2') + + global __nvmlDeviceGetNvLinkErrorCounter + __nvmlDeviceGetNvLinkErrorCounter = _cyb_GetProcAddress(handle, 'nvmlDeviceGetNvLinkErrorCounter') + + global __nvmlDeviceResetNvLinkErrorCounters + __nvmlDeviceResetNvLinkErrorCounters = _cyb_GetProcAddress(handle, 'nvmlDeviceResetNvLinkErrorCounters') + + global __nvmlDeviceGetNvLinkRemoteDeviceType + __nvmlDeviceGetNvLinkRemoteDeviceType = _cyb_GetProcAddress(handle, 'nvmlDeviceGetNvLinkRemoteDeviceType') + + global __nvmlDeviceSetNvLinkDeviceLowPowerThreshold + __nvmlDeviceSetNvLinkDeviceLowPowerThreshold = _cyb_GetProcAddress(handle, 'nvmlDeviceSetNvLinkDeviceLowPowerThreshold') + + global __nvmlSystemSetNvlinkBwMode + __nvmlSystemSetNvlinkBwMode = _cyb_GetProcAddress(handle, 'nvmlSystemSetNvlinkBwMode') + + global __nvmlSystemGetNvlinkBwMode + __nvmlSystemGetNvlinkBwMode = _cyb_GetProcAddress(handle, 'nvmlSystemGetNvlinkBwMode') + + global __nvmlDeviceGetNvlinkSupportedBwModes + __nvmlDeviceGetNvlinkSupportedBwModes = _cyb_GetProcAddress(handle, 'nvmlDeviceGetNvlinkSupportedBwModes') + + global __nvmlDeviceGetNvlinkBwMode + __nvmlDeviceGetNvlinkBwMode = _cyb_GetProcAddress(handle, 'nvmlDeviceGetNvlinkBwMode') + + global __nvmlDeviceSetNvlinkBwMode + __nvmlDeviceSetNvlinkBwMode = _cyb_GetProcAddress(handle, 'nvmlDeviceSetNvlinkBwMode') + + global __nvmlEventSetCreate + __nvmlEventSetCreate = _cyb_GetProcAddress(handle, 'nvmlEventSetCreate') + + global __nvmlDeviceRegisterEvents + __nvmlDeviceRegisterEvents = _cyb_GetProcAddress(handle, 'nvmlDeviceRegisterEvents') + + global __nvmlDeviceGetSupportedEventTypes + __nvmlDeviceGetSupportedEventTypes = _cyb_GetProcAddress(handle, 'nvmlDeviceGetSupportedEventTypes') + + global __nvmlEventSetWait_v2 + __nvmlEventSetWait_v2 = _cyb_GetProcAddress(handle, 'nvmlEventSetWait_v2') + + global __nvmlEventSetFree + __nvmlEventSetFree = _cyb_GetProcAddress(handle, 'nvmlEventSetFree') + + global __nvmlSystemEventSetCreate + __nvmlSystemEventSetCreate = _cyb_GetProcAddress(handle, 'nvmlSystemEventSetCreate') + + global __nvmlSystemEventSetFree + __nvmlSystemEventSetFree = _cyb_GetProcAddress(handle, 'nvmlSystemEventSetFree') + + global __nvmlSystemRegisterEvents + __nvmlSystemRegisterEvents = _cyb_GetProcAddress(handle, 'nvmlSystemRegisterEvents') + + global __nvmlSystemEventSetWait + __nvmlSystemEventSetWait = _cyb_GetProcAddress(handle, 'nvmlSystemEventSetWait') + + global __nvmlDeviceModifyDrainState + __nvmlDeviceModifyDrainState = _cyb_GetProcAddress(handle, 'nvmlDeviceModifyDrainState') + + global __nvmlDeviceQueryDrainState + __nvmlDeviceQueryDrainState = _cyb_GetProcAddress(handle, 'nvmlDeviceQueryDrainState') + + global __nvmlDeviceRemoveGpu_v2 + __nvmlDeviceRemoveGpu_v2 = _cyb_GetProcAddress(handle, 'nvmlDeviceRemoveGpu_v2') + + global __nvmlDeviceDiscoverGpus + __nvmlDeviceDiscoverGpus = _cyb_GetProcAddress(handle, 'nvmlDeviceDiscoverGpus') + + global __nvmlDeviceGetFieldValues + __nvmlDeviceGetFieldValues = _cyb_GetProcAddress(handle, 'nvmlDeviceGetFieldValues') + + global __nvmlDeviceClearFieldValues + __nvmlDeviceClearFieldValues = _cyb_GetProcAddress(handle, 'nvmlDeviceClearFieldValues') + + global __nvmlDeviceGetVirtualizationMode + __nvmlDeviceGetVirtualizationMode = _cyb_GetProcAddress(handle, 'nvmlDeviceGetVirtualizationMode') + + global __nvmlDeviceGetHostVgpuMode + __nvmlDeviceGetHostVgpuMode = _cyb_GetProcAddress(handle, 'nvmlDeviceGetHostVgpuMode') + + global __nvmlDeviceSetVirtualizationMode + __nvmlDeviceSetVirtualizationMode = _cyb_GetProcAddress(handle, 'nvmlDeviceSetVirtualizationMode') + + global __nvmlDeviceGetVgpuHeterogeneousMode + __nvmlDeviceGetVgpuHeterogeneousMode = _cyb_GetProcAddress(handle, 'nvmlDeviceGetVgpuHeterogeneousMode') + + global __nvmlDeviceSetVgpuHeterogeneousMode + __nvmlDeviceSetVgpuHeterogeneousMode = _cyb_GetProcAddress(handle, 'nvmlDeviceSetVgpuHeterogeneousMode') + + global __nvmlVgpuInstanceGetPlacementId + __nvmlVgpuInstanceGetPlacementId = _cyb_GetProcAddress(handle, 'nvmlVgpuInstanceGetPlacementId') + + global __nvmlDeviceGetVgpuTypeSupportedPlacements + __nvmlDeviceGetVgpuTypeSupportedPlacements = _cyb_GetProcAddress(handle, 'nvmlDeviceGetVgpuTypeSupportedPlacements') + + global __nvmlDeviceGetVgpuTypeCreatablePlacements + __nvmlDeviceGetVgpuTypeCreatablePlacements = _cyb_GetProcAddress(handle, 'nvmlDeviceGetVgpuTypeCreatablePlacements') + + global __nvmlVgpuTypeGetGspHeapSize + __nvmlVgpuTypeGetGspHeapSize = _cyb_GetProcAddress(handle, 'nvmlVgpuTypeGetGspHeapSize') + + global __nvmlVgpuTypeGetFbReservation + __nvmlVgpuTypeGetFbReservation = _cyb_GetProcAddress(handle, 'nvmlVgpuTypeGetFbReservation') + + global __nvmlVgpuInstanceGetRuntimeStateSize + __nvmlVgpuInstanceGetRuntimeStateSize = _cyb_GetProcAddress(handle, 'nvmlVgpuInstanceGetRuntimeStateSize') + + global __nvmlDeviceSetVgpuCapabilities + __nvmlDeviceSetVgpuCapabilities = _cyb_GetProcAddress(handle, 'nvmlDeviceSetVgpuCapabilities') + + global __nvmlDeviceGetGridLicensableFeatures_v4 + __nvmlDeviceGetGridLicensableFeatures_v4 = _cyb_GetProcAddress(handle, 'nvmlDeviceGetGridLicensableFeatures_v4') + + global __nvmlGetVgpuDriverCapabilities + __nvmlGetVgpuDriverCapabilities = _cyb_GetProcAddress(handle, 'nvmlGetVgpuDriverCapabilities') + + global __nvmlDeviceGetVgpuCapabilities + __nvmlDeviceGetVgpuCapabilities = _cyb_GetProcAddress(handle, 'nvmlDeviceGetVgpuCapabilities') + + global __nvmlDeviceGetSupportedVgpus + __nvmlDeviceGetSupportedVgpus = _cyb_GetProcAddress(handle, 'nvmlDeviceGetSupportedVgpus') + + global __nvmlDeviceGetCreatableVgpus + __nvmlDeviceGetCreatableVgpus = _cyb_GetProcAddress(handle, 'nvmlDeviceGetCreatableVgpus') + + global __nvmlVgpuTypeGetClass + __nvmlVgpuTypeGetClass = _cyb_GetProcAddress(handle, 'nvmlVgpuTypeGetClass') + + global __nvmlVgpuTypeGetName + __nvmlVgpuTypeGetName = _cyb_GetProcAddress(handle, 'nvmlVgpuTypeGetName') + + global __nvmlVgpuTypeGetGpuInstanceProfileId + __nvmlVgpuTypeGetGpuInstanceProfileId = _cyb_GetProcAddress(handle, 'nvmlVgpuTypeGetGpuInstanceProfileId') + + global __nvmlVgpuTypeGetDeviceID + __nvmlVgpuTypeGetDeviceID = _cyb_GetProcAddress(handle, 'nvmlVgpuTypeGetDeviceID') + + global __nvmlVgpuTypeGetFramebufferSize + __nvmlVgpuTypeGetFramebufferSize = _cyb_GetProcAddress(handle, 'nvmlVgpuTypeGetFramebufferSize') + + global __nvmlVgpuTypeGetNumDisplayHeads + __nvmlVgpuTypeGetNumDisplayHeads = _cyb_GetProcAddress(handle, 'nvmlVgpuTypeGetNumDisplayHeads') + + global __nvmlVgpuTypeGetResolution + __nvmlVgpuTypeGetResolution = _cyb_GetProcAddress(handle, 'nvmlVgpuTypeGetResolution') + + global __nvmlVgpuTypeGetLicense + __nvmlVgpuTypeGetLicense = _cyb_GetProcAddress(handle, 'nvmlVgpuTypeGetLicense') + + global __nvmlVgpuTypeGetFrameRateLimit + __nvmlVgpuTypeGetFrameRateLimit = _cyb_GetProcAddress(handle, 'nvmlVgpuTypeGetFrameRateLimit') + + global __nvmlVgpuTypeGetMaxInstances + __nvmlVgpuTypeGetMaxInstances = _cyb_GetProcAddress(handle, 'nvmlVgpuTypeGetMaxInstances') + + global __nvmlVgpuTypeGetMaxInstancesPerVm + __nvmlVgpuTypeGetMaxInstancesPerVm = _cyb_GetProcAddress(handle, 'nvmlVgpuTypeGetMaxInstancesPerVm') + + global __nvmlVgpuTypeGetBAR1Info + __nvmlVgpuTypeGetBAR1Info = _cyb_GetProcAddress(handle, 'nvmlVgpuTypeGetBAR1Info') + + global __nvmlDeviceGetActiveVgpus + __nvmlDeviceGetActiveVgpus = _cyb_GetProcAddress(handle, 'nvmlDeviceGetActiveVgpus') + + global __nvmlVgpuInstanceGetVmID + __nvmlVgpuInstanceGetVmID = _cyb_GetProcAddress(handle, 'nvmlVgpuInstanceGetVmID') + + global __nvmlVgpuInstanceGetUUID + __nvmlVgpuInstanceGetUUID = _cyb_GetProcAddress(handle, 'nvmlVgpuInstanceGetUUID') + + global __nvmlVgpuInstanceGetVmDriverVersion + __nvmlVgpuInstanceGetVmDriverVersion = _cyb_GetProcAddress(handle, 'nvmlVgpuInstanceGetVmDriverVersion') + + global __nvmlVgpuInstanceGetFbUsage + __nvmlVgpuInstanceGetFbUsage = _cyb_GetProcAddress(handle, 'nvmlVgpuInstanceGetFbUsage') + + global __nvmlVgpuInstanceGetLicenseStatus + __nvmlVgpuInstanceGetLicenseStatus = _cyb_GetProcAddress(handle, 'nvmlVgpuInstanceGetLicenseStatus') + + global __nvmlVgpuInstanceGetType + __nvmlVgpuInstanceGetType = _cyb_GetProcAddress(handle, 'nvmlVgpuInstanceGetType') + + global __nvmlVgpuInstanceGetFrameRateLimit + __nvmlVgpuInstanceGetFrameRateLimit = _cyb_GetProcAddress(handle, 'nvmlVgpuInstanceGetFrameRateLimit') + + global __nvmlVgpuInstanceGetEccMode + __nvmlVgpuInstanceGetEccMode = _cyb_GetProcAddress(handle, 'nvmlVgpuInstanceGetEccMode') + + global __nvmlVgpuInstanceGetEncoderCapacity + __nvmlVgpuInstanceGetEncoderCapacity = _cyb_GetProcAddress(handle, 'nvmlVgpuInstanceGetEncoderCapacity') + + global __nvmlVgpuInstanceSetEncoderCapacity + __nvmlVgpuInstanceSetEncoderCapacity = _cyb_GetProcAddress(handle, 'nvmlVgpuInstanceSetEncoderCapacity') + + global __nvmlVgpuInstanceGetEncoderStats + __nvmlVgpuInstanceGetEncoderStats = _cyb_GetProcAddress(handle, 'nvmlVgpuInstanceGetEncoderStats') + + global __nvmlVgpuInstanceGetEncoderSessions + __nvmlVgpuInstanceGetEncoderSessions = _cyb_GetProcAddress(handle, 'nvmlVgpuInstanceGetEncoderSessions') + + global __nvmlVgpuInstanceGetFBCStats + __nvmlVgpuInstanceGetFBCStats = _cyb_GetProcAddress(handle, 'nvmlVgpuInstanceGetFBCStats') + + global __nvmlVgpuInstanceGetFBCSessions + __nvmlVgpuInstanceGetFBCSessions = _cyb_GetProcAddress(handle, 'nvmlVgpuInstanceGetFBCSessions') + + global __nvmlVgpuInstanceGetGpuInstanceId + __nvmlVgpuInstanceGetGpuInstanceId = _cyb_GetProcAddress(handle, 'nvmlVgpuInstanceGetGpuInstanceId') + + global __nvmlVgpuInstanceGetGpuPciId + __nvmlVgpuInstanceGetGpuPciId = _cyb_GetProcAddress(handle, 'nvmlVgpuInstanceGetGpuPciId') + + global __nvmlVgpuTypeGetCapabilities + __nvmlVgpuTypeGetCapabilities = _cyb_GetProcAddress(handle, 'nvmlVgpuTypeGetCapabilities') + + global __nvmlVgpuInstanceGetMdevUUID + __nvmlVgpuInstanceGetMdevUUID = _cyb_GetProcAddress(handle, 'nvmlVgpuInstanceGetMdevUUID') + + global __nvmlGpuInstanceGetCreatableVgpus + __nvmlGpuInstanceGetCreatableVgpus = _cyb_GetProcAddress(handle, 'nvmlGpuInstanceGetCreatableVgpus') + + global __nvmlVgpuTypeGetMaxInstancesPerGpuInstance + __nvmlVgpuTypeGetMaxInstancesPerGpuInstance = _cyb_GetProcAddress(handle, 'nvmlVgpuTypeGetMaxInstancesPerGpuInstance') + + global __nvmlGpuInstanceGetActiveVgpus + __nvmlGpuInstanceGetActiveVgpus = _cyb_GetProcAddress(handle, 'nvmlGpuInstanceGetActiveVgpus') + + global __nvmlGpuInstanceSetVgpuSchedulerState + __nvmlGpuInstanceSetVgpuSchedulerState = _cyb_GetProcAddress(handle, 'nvmlGpuInstanceSetVgpuSchedulerState') + + global __nvmlGpuInstanceGetVgpuSchedulerState + __nvmlGpuInstanceGetVgpuSchedulerState = _cyb_GetProcAddress(handle, 'nvmlGpuInstanceGetVgpuSchedulerState') + + global __nvmlGpuInstanceGetVgpuSchedulerLog + __nvmlGpuInstanceGetVgpuSchedulerLog = _cyb_GetProcAddress(handle, 'nvmlGpuInstanceGetVgpuSchedulerLog') + + global __nvmlGpuInstanceGetVgpuTypeCreatablePlacements + __nvmlGpuInstanceGetVgpuTypeCreatablePlacements = _cyb_GetProcAddress(handle, 'nvmlGpuInstanceGetVgpuTypeCreatablePlacements') + + global __nvmlGpuInstanceGetVgpuHeterogeneousMode + __nvmlGpuInstanceGetVgpuHeterogeneousMode = _cyb_GetProcAddress(handle, 'nvmlGpuInstanceGetVgpuHeterogeneousMode') + + global __nvmlGpuInstanceSetVgpuHeterogeneousMode + __nvmlGpuInstanceSetVgpuHeterogeneousMode = _cyb_GetProcAddress(handle, 'nvmlGpuInstanceSetVgpuHeterogeneousMode') + + global __nvmlVgpuInstanceGetMetadata + __nvmlVgpuInstanceGetMetadata = _cyb_GetProcAddress(handle, 'nvmlVgpuInstanceGetMetadata') + + global __nvmlDeviceGetVgpuMetadata + __nvmlDeviceGetVgpuMetadata = _cyb_GetProcAddress(handle, 'nvmlDeviceGetVgpuMetadata') + + global __nvmlGetVgpuCompatibility + __nvmlGetVgpuCompatibility = _cyb_GetProcAddress(handle, 'nvmlGetVgpuCompatibility') + + global __nvmlDeviceGetPgpuMetadataString + __nvmlDeviceGetPgpuMetadataString = _cyb_GetProcAddress(handle, 'nvmlDeviceGetPgpuMetadataString') + + global __nvmlDeviceGetVgpuSchedulerLog + __nvmlDeviceGetVgpuSchedulerLog = _cyb_GetProcAddress(handle, 'nvmlDeviceGetVgpuSchedulerLog') + + global __nvmlDeviceGetVgpuSchedulerState + __nvmlDeviceGetVgpuSchedulerState = _cyb_GetProcAddress(handle, 'nvmlDeviceGetVgpuSchedulerState') + + global __nvmlDeviceGetVgpuSchedulerCapabilities + __nvmlDeviceGetVgpuSchedulerCapabilities = _cyb_GetProcAddress(handle, 'nvmlDeviceGetVgpuSchedulerCapabilities') + + global __nvmlDeviceSetVgpuSchedulerState + __nvmlDeviceSetVgpuSchedulerState = _cyb_GetProcAddress(handle, 'nvmlDeviceSetVgpuSchedulerState') + + global __nvmlGetVgpuVersion + __nvmlGetVgpuVersion = _cyb_GetProcAddress(handle, 'nvmlGetVgpuVersion') + + global __nvmlSetVgpuVersion + __nvmlSetVgpuVersion = _cyb_GetProcAddress(handle, 'nvmlSetVgpuVersion') + + global __nvmlDeviceGetVgpuUtilization + __nvmlDeviceGetVgpuUtilization = _cyb_GetProcAddress(handle, 'nvmlDeviceGetVgpuUtilization') + + global __nvmlDeviceGetVgpuInstancesUtilizationInfo + __nvmlDeviceGetVgpuInstancesUtilizationInfo = _cyb_GetProcAddress(handle, 'nvmlDeviceGetVgpuInstancesUtilizationInfo') + + global __nvmlDeviceGetVgpuProcessUtilization + __nvmlDeviceGetVgpuProcessUtilization = _cyb_GetProcAddress(handle, 'nvmlDeviceGetVgpuProcessUtilization') + + global __nvmlDeviceGetVgpuProcessesUtilizationInfo + __nvmlDeviceGetVgpuProcessesUtilizationInfo = _cyb_GetProcAddress(handle, 'nvmlDeviceGetVgpuProcessesUtilizationInfo') + + global __nvmlVgpuInstanceGetAccountingMode + __nvmlVgpuInstanceGetAccountingMode = _cyb_GetProcAddress(handle, 'nvmlVgpuInstanceGetAccountingMode') + + global __nvmlVgpuInstanceGetAccountingPids + __nvmlVgpuInstanceGetAccountingPids = _cyb_GetProcAddress(handle, 'nvmlVgpuInstanceGetAccountingPids') + + global __nvmlVgpuInstanceGetAccountingStats + __nvmlVgpuInstanceGetAccountingStats = _cyb_GetProcAddress(handle, 'nvmlVgpuInstanceGetAccountingStats') + + global __nvmlVgpuInstanceClearAccountingPids + __nvmlVgpuInstanceClearAccountingPids = _cyb_GetProcAddress(handle, 'nvmlVgpuInstanceClearAccountingPids') + + global __nvmlVgpuInstanceGetLicenseInfo_v2 + __nvmlVgpuInstanceGetLicenseInfo_v2 = _cyb_GetProcAddress(handle, 'nvmlVgpuInstanceGetLicenseInfo_v2') + + global __nvmlGetExcludedDeviceCount + __nvmlGetExcludedDeviceCount = _cyb_GetProcAddress(handle, 'nvmlGetExcludedDeviceCount') + + global __nvmlGetExcludedDeviceInfoByIndex + __nvmlGetExcludedDeviceInfoByIndex = _cyb_GetProcAddress(handle, 'nvmlGetExcludedDeviceInfoByIndex') + + global __nvmlDeviceSetMigMode + __nvmlDeviceSetMigMode = _cyb_GetProcAddress(handle, 'nvmlDeviceSetMigMode') + + global __nvmlDeviceGetMigMode + __nvmlDeviceGetMigMode = _cyb_GetProcAddress(handle, 'nvmlDeviceGetMigMode') + + global __nvmlDeviceGetGpuInstanceProfileInfoV + __nvmlDeviceGetGpuInstanceProfileInfoV = _cyb_GetProcAddress(handle, 'nvmlDeviceGetGpuInstanceProfileInfoV') + + global __nvmlDeviceGetGpuInstancePossiblePlacements_v2 + __nvmlDeviceGetGpuInstancePossiblePlacements_v2 = _cyb_GetProcAddress(handle, 'nvmlDeviceGetGpuInstancePossiblePlacements_v2') + + global __nvmlDeviceGetGpuInstanceRemainingCapacity + __nvmlDeviceGetGpuInstanceRemainingCapacity = _cyb_GetProcAddress(handle, 'nvmlDeviceGetGpuInstanceRemainingCapacity') + + global __nvmlDeviceCreateGpuInstance + __nvmlDeviceCreateGpuInstance = _cyb_GetProcAddress(handle, 'nvmlDeviceCreateGpuInstance') + + global __nvmlDeviceCreateGpuInstanceWithPlacement + __nvmlDeviceCreateGpuInstanceWithPlacement = _cyb_GetProcAddress(handle, 'nvmlDeviceCreateGpuInstanceWithPlacement') + + global __nvmlGpuInstanceDestroy + __nvmlGpuInstanceDestroy = _cyb_GetProcAddress(handle, 'nvmlGpuInstanceDestroy') + + global __nvmlDeviceGetGpuInstances + __nvmlDeviceGetGpuInstances = _cyb_GetProcAddress(handle, 'nvmlDeviceGetGpuInstances') + + global __nvmlDeviceGetGpuInstanceById + __nvmlDeviceGetGpuInstanceById = _cyb_GetProcAddress(handle, 'nvmlDeviceGetGpuInstanceById') + + global __nvmlGpuInstanceGetInfo + __nvmlGpuInstanceGetInfo = _cyb_GetProcAddress(handle, 'nvmlGpuInstanceGetInfo') + + global __nvmlGpuInstanceGetComputeInstanceProfileInfoV + __nvmlGpuInstanceGetComputeInstanceProfileInfoV = _cyb_GetProcAddress(handle, 'nvmlGpuInstanceGetComputeInstanceProfileInfoV') + + global __nvmlGpuInstanceGetComputeInstanceRemainingCapacity + __nvmlGpuInstanceGetComputeInstanceRemainingCapacity = _cyb_GetProcAddress(handle, 'nvmlGpuInstanceGetComputeInstanceRemainingCapacity') + + global __nvmlGpuInstanceGetComputeInstancePossiblePlacements + __nvmlGpuInstanceGetComputeInstancePossiblePlacements = _cyb_GetProcAddress(handle, 'nvmlGpuInstanceGetComputeInstancePossiblePlacements') + + global __nvmlGpuInstanceCreateComputeInstance + __nvmlGpuInstanceCreateComputeInstance = _cyb_GetProcAddress(handle, 'nvmlGpuInstanceCreateComputeInstance') + + global __nvmlGpuInstanceCreateComputeInstanceWithPlacement + __nvmlGpuInstanceCreateComputeInstanceWithPlacement = _cyb_GetProcAddress(handle, 'nvmlGpuInstanceCreateComputeInstanceWithPlacement') + + global __nvmlComputeInstanceDestroy + __nvmlComputeInstanceDestroy = _cyb_GetProcAddress(handle, 'nvmlComputeInstanceDestroy') + + global __nvmlGpuInstanceGetComputeInstances + __nvmlGpuInstanceGetComputeInstances = _cyb_GetProcAddress(handle, 'nvmlGpuInstanceGetComputeInstances') + + global __nvmlGpuInstanceGetComputeInstanceById + __nvmlGpuInstanceGetComputeInstanceById = _cyb_GetProcAddress(handle, 'nvmlGpuInstanceGetComputeInstanceById') + + global __nvmlComputeInstanceGetInfo_v2 + __nvmlComputeInstanceGetInfo_v2 = _cyb_GetProcAddress(handle, 'nvmlComputeInstanceGetInfo_v2') + + global __nvmlDeviceIsMigDeviceHandle + __nvmlDeviceIsMigDeviceHandle = _cyb_GetProcAddress(handle, 'nvmlDeviceIsMigDeviceHandle') + + global __nvmlDeviceGetGpuInstanceId + __nvmlDeviceGetGpuInstanceId = _cyb_GetProcAddress(handle, 'nvmlDeviceGetGpuInstanceId') + + global __nvmlDeviceGetComputeInstanceId + __nvmlDeviceGetComputeInstanceId = _cyb_GetProcAddress(handle, 'nvmlDeviceGetComputeInstanceId') + + global __nvmlDeviceGetMaxMigDeviceCount + __nvmlDeviceGetMaxMigDeviceCount = _cyb_GetProcAddress(handle, 'nvmlDeviceGetMaxMigDeviceCount') + + global __nvmlDeviceGetMigDeviceHandleByIndex + __nvmlDeviceGetMigDeviceHandleByIndex = _cyb_GetProcAddress(handle, 'nvmlDeviceGetMigDeviceHandleByIndex') + + global __nvmlDeviceGetDeviceHandleFromMigDeviceHandle + __nvmlDeviceGetDeviceHandleFromMigDeviceHandle = _cyb_GetProcAddress(handle, 'nvmlDeviceGetDeviceHandleFromMigDeviceHandle') + + global __nvmlDeviceGetCapabilities + __nvmlDeviceGetCapabilities = _cyb_GetProcAddress(handle, 'nvmlDeviceGetCapabilities') + + global __nvmlDevicePowerSmoothingActivatePresetProfile + __nvmlDevicePowerSmoothingActivatePresetProfile = _cyb_GetProcAddress(handle, 'nvmlDevicePowerSmoothingActivatePresetProfile') + + global __nvmlDevicePowerSmoothingUpdatePresetProfileParam + __nvmlDevicePowerSmoothingUpdatePresetProfileParam = _cyb_GetProcAddress(handle, 'nvmlDevicePowerSmoothingUpdatePresetProfileParam') + + global __nvmlDevicePowerSmoothingSetState + __nvmlDevicePowerSmoothingSetState = _cyb_GetProcAddress(handle, 'nvmlDevicePowerSmoothingSetState') + + global __nvmlDeviceGetAddressingMode + __nvmlDeviceGetAddressingMode = _cyb_GetProcAddress(handle, 'nvmlDeviceGetAddressingMode') + + global __nvmlDeviceGetRepairStatus + __nvmlDeviceGetRepairStatus = _cyb_GetProcAddress(handle, 'nvmlDeviceGetRepairStatus') + + global __nvmlDeviceGetPowerMizerMode_v1 + __nvmlDeviceGetPowerMizerMode_v1 = _cyb_GetProcAddress(handle, 'nvmlDeviceGetPowerMizerMode_v1') + + global __nvmlDeviceSetPowerMizerMode_v1 + __nvmlDeviceSetPowerMizerMode_v1 = _cyb_GetProcAddress(handle, 'nvmlDeviceSetPowerMizerMode_v1') + + global __nvmlDeviceGetPdi + __nvmlDeviceGetPdi = _cyb_GetProcAddress(handle, 'nvmlDeviceGetPdi') + + global __nvmlDeviceSetHostname_v1 + __nvmlDeviceSetHostname_v1 = _cyb_GetProcAddress(handle, 'nvmlDeviceSetHostname_v1') + + global __nvmlDeviceGetHostname_v1 + __nvmlDeviceGetHostname_v1 = _cyb_GetProcAddress(handle, 'nvmlDeviceGetHostname_v1') + + global __nvmlDeviceGetNvLinkInfo + __nvmlDeviceGetNvLinkInfo = _cyb_GetProcAddress(handle, 'nvmlDeviceGetNvLinkInfo') + + global __nvmlDeviceReadWritePRM_v1 + __nvmlDeviceReadWritePRM_v1 = _cyb_GetProcAddress(handle, 'nvmlDeviceReadWritePRM_v1') + + global __nvmlDeviceGetGpuInstanceProfileInfoByIdV + __nvmlDeviceGetGpuInstanceProfileInfoByIdV = _cyb_GetProcAddress(handle, 'nvmlDeviceGetGpuInstanceProfileInfoByIdV') + + global __nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts + __nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts = _cyb_GetProcAddress(handle, 'nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts') + + global __nvmlDeviceGetUnrepairableMemoryFlag_v1 + __nvmlDeviceGetUnrepairableMemoryFlag_v1 = _cyb_GetProcAddress(handle, 'nvmlDeviceGetUnrepairableMemoryFlag_v1') + + global __nvmlDeviceReadPRMCounters_v1 + __nvmlDeviceReadPRMCounters_v1 = _cyb_GetProcAddress(handle, 'nvmlDeviceReadPRMCounters_v1') + + global __nvmlDeviceSetRusdSettings_v1 + __nvmlDeviceSetRusdSettings_v1 = _cyb_GetProcAddress(handle, 'nvmlDeviceSetRusdSettings_v1') + + global __nvmlDeviceVgpuForceGspUnload + __nvmlDeviceVgpuForceGspUnload = _cyb_GetProcAddress(handle, 'nvmlDeviceVgpuForceGspUnload') + + global __nvmlDeviceGetVgpuSchedulerState_v2 + __nvmlDeviceGetVgpuSchedulerState_v2 = _cyb_GetProcAddress(handle, 'nvmlDeviceGetVgpuSchedulerState_v2') + + global __nvmlGpuInstanceGetVgpuSchedulerState_v2 + __nvmlGpuInstanceGetVgpuSchedulerState_v2 = _cyb_GetProcAddress(handle, 'nvmlGpuInstanceGetVgpuSchedulerState_v2') + + global __nvmlDeviceGetVgpuSchedulerLog_v2 + __nvmlDeviceGetVgpuSchedulerLog_v2 = _cyb_GetProcAddress(handle, 'nvmlDeviceGetVgpuSchedulerLog_v2') + + global __nvmlGpuInstanceGetVgpuSchedulerLog_v2 + __nvmlGpuInstanceGetVgpuSchedulerLog_v2 = _cyb_GetProcAddress(handle, 'nvmlGpuInstanceGetVgpuSchedulerLog_v2') + + global __nvmlDeviceSetVgpuSchedulerState_v2 + __nvmlDeviceSetVgpuSchedulerState_v2 = _cyb_GetProcAddress(handle, 'nvmlDeviceSetVgpuSchedulerState_v2') + + global __nvmlGpuInstanceSetVgpuSchedulerState_v2 + __nvmlGpuInstanceSetVgpuSchedulerState_v2 = _cyb_GetProcAddress(handle, 'nvmlGpuInstanceSetVgpuSchedulerState_v2') + + _cyb___py_nvml_init = True + return 0 + +cdef inline int _check_or_init_nvml() except -1 nogil: + if _cyb___py_nvml_init: + return 0 + + return _init_nvml() + + +cpdef dict _inspect_function_pointers(): + global _cyb_func_ptrs + if _cyb_func_ptrs is not None: + return _cyb_func_ptrs + + _check_or_init_nvml() + cdef dict data = {} + global __nvmlInit_v2 + data["__nvmlInit_v2"] = <_cyb_intptr_t>__nvmlInit_v2 + + global __nvmlInitWithFlags + data["__nvmlInitWithFlags"] = <_cyb_intptr_t>__nvmlInitWithFlags + + global __nvmlShutdown + data["__nvmlShutdown"] = <_cyb_intptr_t>__nvmlShutdown + + global __nvmlErrorString + data["__nvmlErrorString"] = <_cyb_intptr_t>__nvmlErrorString + + global __nvmlSystemGetDriverVersion + data["__nvmlSystemGetDriverVersion"] = <_cyb_intptr_t>__nvmlSystemGetDriverVersion + + global __nvmlSystemGetNVMLVersion + data["__nvmlSystemGetNVMLVersion"] = <_cyb_intptr_t>__nvmlSystemGetNVMLVersion + + global __nvmlSystemGetCudaDriverVersion + data["__nvmlSystemGetCudaDriverVersion"] = <_cyb_intptr_t>__nvmlSystemGetCudaDriverVersion + + global __nvmlSystemGetCudaDriverVersion_v2 + data["__nvmlSystemGetCudaDriverVersion_v2"] = <_cyb_intptr_t>__nvmlSystemGetCudaDriverVersion_v2 + + global __nvmlSystemGetProcessName + data["__nvmlSystemGetProcessName"] = <_cyb_intptr_t>__nvmlSystemGetProcessName + + global __nvmlSystemGetHicVersion + data["__nvmlSystemGetHicVersion"] = <_cyb_intptr_t>__nvmlSystemGetHicVersion + + global __nvmlSystemGetTopologyGpuSet + data["__nvmlSystemGetTopologyGpuSet"] = <_cyb_intptr_t>__nvmlSystemGetTopologyGpuSet + + global __nvmlSystemGetDriverBranch + data["__nvmlSystemGetDriverBranch"] = <_cyb_intptr_t>__nvmlSystemGetDriverBranch + + global __nvmlUnitGetCount + data["__nvmlUnitGetCount"] = <_cyb_intptr_t>__nvmlUnitGetCount + + global __nvmlUnitGetHandleByIndex + data["__nvmlUnitGetHandleByIndex"] = <_cyb_intptr_t>__nvmlUnitGetHandleByIndex + + global __nvmlUnitGetUnitInfo + data["__nvmlUnitGetUnitInfo"] = <_cyb_intptr_t>__nvmlUnitGetUnitInfo + + global __nvmlUnitGetLedState + data["__nvmlUnitGetLedState"] = <_cyb_intptr_t>__nvmlUnitGetLedState + + global __nvmlUnitGetPsuInfo + data["__nvmlUnitGetPsuInfo"] = <_cyb_intptr_t>__nvmlUnitGetPsuInfo + + global __nvmlUnitGetTemperature + data["__nvmlUnitGetTemperature"] = <_cyb_intptr_t>__nvmlUnitGetTemperature + + global __nvmlUnitGetFanSpeedInfo + data["__nvmlUnitGetFanSpeedInfo"] = <_cyb_intptr_t>__nvmlUnitGetFanSpeedInfo + + global __nvmlUnitGetDevices + data["__nvmlUnitGetDevices"] = <_cyb_intptr_t>__nvmlUnitGetDevices + + global __nvmlDeviceGetCount_v2 + data["__nvmlDeviceGetCount_v2"] = <_cyb_intptr_t>__nvmlDeviceGetCount_v2 + + global __nvmlDeviceGetAttributes_v2 + data["__nvmlDeviceGetAttributes_v2"] = <_cyb_intptr_t>__nvmlDeviceGetAttributes_v2 + + global __nvmlDeviceGetHandleByIndex_v2 + data["__nvmlDeviceGetHandleByIndex_v2"] = <_cyb_intptr_t>__nvmlDeviceGetHandleByIndex_v2 + + global __nvmlDeviceGetHandleBySerial + data["__nvmlDeviceGetHandleBySerial"] = <_cyb_intptr_t>__nvmlDeviceGetHandleBySerial + + global __nvmlDeviceGetHandleByUUID + data["__nvmlDeviceGetHandleByUUID"] = <_cyb_intptr_t>__nvmlDeviceGetHandleByUUID + + global __nvmlDeviceGetHandleByUUIDV + data["__nvmlDeviceGetHandleByUUIDV"] = <_cyb_intptr_t>__nvmlDeviceGetHandleByUUIDV + + global __nvmlDeviceGetHandleByPciBusId_v2 + data["__nvmlDeviceGetHandleByPciBusId_v2"] = <_cyb_intptr_t>__nvmlDeviceGetHandleByPciBusId_v2 + + global __nvmlDeviceGetName + data["__nvmlDeviceGetName"] = <_cyb_intptr_t>__nvmlDeviceGetName + + global __nvmlDeviceGetBrand + data["__nvmlDeviceGetBrand"] = <_cyb_intptr_t>__nvmlDeviceGetBrand + + global __nvmlDeviceGetIndex + data["__nvmlDeviceGetIndex"] = <_cyb_intptr_t>__nvmlDeviceGetIndex + + global __nvmlDeviceGetSerial + data["__nvmlDeviceGetSerial"] = <_cyb_intptr_t>__nvmlDeviceGetSerial + + global __nvmlDeviceGetModuleId + data["__nvmlDeviceGetModuleId"] = <_cyb_intptr_t>__nvmlDeviceGetModuleId + + global __nvmlDeviceGetC2cModeInfoV + data["__nvmlDeviceGetC2cModeInfoV"] = <_cyb_intptr_t>__nvmlDeviceGetC2cModeInfoV + + global __nvmlDeviceGetMemoryAffinity + data["__nvmlDeviceGetMemoryAffinity"] = <_cyb_intptr_t>__nvmlDeviceGetMemoryAffinity + + global __nvmlDeviceGetCpuAffinityWithinScope + data["__nvmlDeviceGetCpuAffinityWithinScope"] = <_cyb_intptr_t>__nvmlDeviceGetCpuAffinityWithinScope + + global __nvmlDeviceGetCpuAffinity + data["__nvmlDeviceGetCpuAffinity"] = <_cyb_intptr_t>__nvmlDeviceGetCpuAffinity + + global __nvmlDeviceSetCpuAffinity + data["__nvmlDeviceSetCpuAffinity"] = <_cyb_intptr_t>__nvmlDeviceSetCpuAffinity + + global __nvmlDeviceClearCpuAffinity + data["__nvmlDeviceClearCpuAffinity"] = <_cyb_intptr_t>__nvmlDeviceClearCpuAffinity + + global __nvmlDeviceGetNumaNodeId + data["__nvmlDeviceGetNumaNodeId"] = <_cyb_intptr_t>__nvmlDeviceGetNumaNodeId + + global __nvmlDeviceGetTopologyCommonAncestor + data["__nvmlDeviceGetTopologyCommonAncestor"] = <_cyb_intptr_t>__nvmlDeviceGetTopologyCommonAncestor + + global __nvmlDeviceGetTopologyNearestGpus + data["__nvmlDeviceGetTopologyNearestGpus"] = <_cyb_intptr_t>__nvmlDeviceGetTopologyNearestGpus + + global __nvmlDeviceGetP2PStatus + data["__nvmlDeviceGetP2PStatus"] = <_cyb_intptr_t>__nvmlDeviceGetP2PStatus + + global __nvmlDeviceGetUUID + data["__nvmlDeviceGetUUID"] = <_cyb_intptr_t>__nvmlDeviceGetUUID + + global __nvmlDeviceGetMinorNumber + data["__nvmlDeviceGetMinorNumber"] = <_cyb_intptr_t>__nvmlDeviceGetMinorNumber + + global __nvmlDeviceGetBoardPartNumber + data["__nvmlDeviceGetBoardPartNumber"] = <_cyb_intptr_t>__nvmlDeviceGetBoardPartNumber + + global __nvmlDeviceGetInforomVersion + data["__nvmlDeviceGetInforomVersion"] = <_cyb_intptr_t>__nvmlDeviceGetInforomVersion + + global __nvmlDeviceGetInforomImageVersion + data["__nvmlDeviceGetInforomImageVersion"] = <_cyb_intptr_t>__nvmlDeviceGetInforomImageVersion + + global __nvmlDeviceGetInforomConfigurationChecksum + data["__nvmlDeviceGetInforomConfigurationChecksum"] = <_cyb_intptr_t>__nvmlDeviceGetInforomConfigurationChecksum + + global __nvmlDeviceValidateInforom + data["__nvmlDeviceValidateInforom"] = <_cyb_intptr_t>__nvmlDeviceValidateInforom + + global __nvmlDeviceGetLastBBXFlushTime + data["__nvmlDeviceGetLastBBXFlushTime"] = <_cyb_intptr_t>__nvmlDeviceGetLastBBXFlushTime + + global __nvmlDeviceGetDisplayMode + data["__nvmlDeviceGetDisplayMode"] = <_cyb_intptr_t>__nvmlDeviceGetDisplayMode + + global __nvmlDeviceGetDisplayActive + data["__nvmlDeviceGetDisplayActive"] = <_cyb_intptr_t>__nvmlDeviceGetDisplayActive + + global __nvmlDeviceGetPersistenceMode + data["__nvmlDeviceGetPersistenceMode"] = <_cyb_intptr_t>__nvmlDeviceGetPersistenceMode + + global __nvmlDeviceGetPciInfoExt + data["__nvmlDeviceGetPciInfoExt"] = <_cyb_intptr_t>__nvmlDeviceGetPciInfoExt + + global __nvmlDeviceGetPciInfo_v3 + data["__nvmlDeviceGetPciInfo_v3"] = <_cyb_intptr_t>__nvmlDeviceGetPciInfo_v3 + + global __nvmlDeviceGetMaxPcieLinkGeneration + data["__nvmlDeviceGetMaxPcieLinkGeneration"] = <_cyb_intptr_t>__nvmlDeviceGetMaxPcieLinkGeneration + + global __nvmlDeviceGetGpuMaxPcieLinkGeneration + data["__nvmlDeviceGetGpuMaxPcieLinkGeneration"] = <_cyb_intptr_t>__nvmlDeviceGetGpuMaxPcieLinkGeneration + + global __nvmlDeviceGetMaxPcieLinkWidth + data["__nvmlDeviceGetMaxPcieLinkWidth"] = <_cyb_intptr_t>__nvmlDeviceGetMaxPcieLinkWidth + + global __nvmlDeviceGetCurrPcieLinkGeneration + data["__nvmlDeviceGetCurrPcieLinkGeneration"] = <_cyb_intptr_t>__nvmlDeviceGetCurrPcieLinkGeneration + + global __nvmlDeviceGetCurrPcieLinkWidth + data["__nvmlDeviceGetCurrPcieLinkWidth"] = <_cyb_intptr_t>__nvmlDeviceGetCurrPcieLinkWidth + + global __nvmlDeviceGetPcieThroughput + data["__nvmlDeviceGetPcieThroughput"] = <_cyb_intptr_t>__nvmlDeviceGetPcieThroughput + + global __nvmlDeviceGetPcieReplayCounter + data["__nvmlDeviceGetPcieReplayCounter"] = <_cyb_intptr_t>__nvmlDeviceGetPcieReplayCounter + + global __nvmlDeviceGetClockInfo + data["__nvmlDeviceGetClockInfo"] = <_cyb_intptr_t>__nvmlDeviceGetClockInfo + + global __nvmlDeviceGetMaxClockInfo + data["__nvmlDeviceGetMaxClockInfo"] = <_cyb_intptr_t>__nvmlDeviceGetMaxClockInfo + + global __nvmlDeviceGetGpcClkVfOffset + data["__nvmlDeviceGetGpcClkVfOffset"] = <_cyb_intptr_t>__nvmlDeviceGetGpcClkVfOffset + + global __nvmlDeviceGetClock + data["__nvmlDeviceGetClock"] = <_cyb_intptr_t>__nvmlDeviceGetClock + + global __nvmlDeviceGetMaxCustomerBoostClock + data["__nvmlDeviceGetMaxCustomerBoostClock"] = <_cyb_intptr_t>__nvmlDeviceGetMaxCustomerBoostClock + + global __nvmlDeviceGetSupportedMemoryClocks + data["__nvmlDeviceGetSupportedMemoryClocks"] = <_cyb_intptr_t>__nvmlDeviceGetSupportedMemoryClocks + + global __nvmlDeviceGetSupportedGraphicsClocks + data["__nvmlDeviceGetSupportedGraphicsClocks"] = <_cyb_intptr_t>__nvmlDeviceGetSupportedGraphicsClocks + + global __nvmlDeviceGetAutoBoostedClocksEnabled + data["__nvmlDeviceGetAutoBoostedClocksEnabled"] = <_cyb_intptr_t>__nvmlDeviceGetAutoBoostedClocksEnabled + + global __nvmlDeviceGetFanSpeed + data["__nvmlDeviceGetFanSpeed"] = <_cyb_intptr_t>__nvmlDeviceGetFanSpeed + + global __nvmlDeviceGetFanSpeed_v2 + data["__nvmlDeviceGetFanSpeed_v2"] = <_cyb_intptr_t>__nvmlDeviceGetFanSpeed_v2 + + global __nvmlDeviceGetFanSpeedRPM + data["__nvmlDeviceGetFanSpeedRPM"] = <_cyb_intptr_t>__nvmlDeviceGetFanSpeedRPM + + global __nvmlDeviceGetTargetFanSpeed + data["__nvmlDeviceGetTargetFanSpeed"] = <_cyb_intptr_t>__nvmlDeviceGetTargetFanSpeed + + global __nvmlDeviceGetMinMaxFanSpeed + data["__nvmlDeviceGetMinMaxFanSpeed"] = <_cyb_intptr_t>__nvmlDeviceGetMinMaxFanSpeed + + global __nvmlDeviceGetFanControlPolicy_v2 + data["__nvmlDeviceGetFanControlPolicy_v2"] = <_cyb_intptr_t>__nvmlDeviceGetFanControlPolicy_v2 + + global __nvmlDeviceGetNumFans + data["__nvmlDeviceGetNumFans"] = <_cyb_intptr_t>__nvmlDeviceGetNumFans + + global __nvmlDeviceGetCoolerInfo + data["__nvmlDeviceGetCoolerInfo"] = <_cyb_intptr_t>__nvmlDeviceGetCoolerInfo + + global __nvmlDeviceGetTemperatureV + data["__nvmlDeviceGetTemperatureV"] = <_cyb_intptr_t>__nvmlDeviceGetTemperatureV + + global __nvmlDeviceGetTemperatureThreshold + data["__nvmlDeviceGetTemperatureThreshold"] = <_cyb_intptr_t>__nvmlDeviceGetTemperatureThreshold + + global __nvmlDeviceGetMarginTemperature + data["__nvmlDeviceGetMarginTemperature"] = <_cyb_intptr_t>__nvmlDeviceGetMarginTemperature + + global __nvmlDeviceGetThermalSettings + data["__nvmlDeviceGetThermalSettings"] = <_cyb_intptr_t>__nvmlDeviceGetThermalSettings + + global __nvmlDeviceGetPerformanceState + data["__nvmlDeviceGetPerformanceState"] = <_cyb_intptr_t>__nvmlDeviceGetPerformanceState + + global __nvmlDeviceGetCurrentClocksEventReasons + data["__nvmlDeviceGetCurrentClocksEventReasons"] = <_cyb_intptr_t>__nvmlDeviceGetCurrentClocksEventReasons + + global __nvmlDeviceGetSupportedClocksEventReasons + data["__nvmlDeviceGetSupportedClocksEventReasons"] = <_cyb_intptr_t>__nvmlDeviceGetSupportedClocksEventReasons + + global __nvmlDeviceGetPowerState + data["__nvmlDeviceGetPowerState"] = <_cyb_intptr_t>__nvmlDeviceGetPowerState + + global __nvmlDeviceGetDynamicPstatesInfo + data["__nvmlDeviceGetDynamicPstatesInfo"] = <_cyb_intptr_t>__nvmlDeviceGetDynamicPstatesInfo + + global __nvmlDeviceGetMemClkVfOffset + data["__nvmlDeviceGetMemClkVfOffset"] = <_cyb_intptr_t>__nvmlDeviceGetMemClkVfOffset + + global __nvmlDeviceGetMinMaxClockOfPState + data["__nvmlDeviceGetMinMaxClockOfPState"] = <_cyb_intptr_t>__nvmlDeviceGetMinMaxClockOfPState + + global __nvmlDeviceGetSupportedPerformanceStates + data["__nvmlDeviceGetSupportedPerformanceStates"] = <_cyb_intptr_t>__nvmlDeviceGetSupportedPerformanceStates + + global __nvmlDeviceGetGpcClkMinMaxVfOffset + data["__nvmlDeviceGetGpcClkMinMaxVfOffset"] = <_cyb_intptr_t>__nvmlDeviceGetGpcClkMinMaxVfOffset + + global __nvmlDeviceGetMemClkMinMaxVfOffset + data["__nvmlDeviceGetMemClkMinMaxVfOffset"] = <_cyb_intptr_t>__nvmlDeviceGetMemClkMinMaxVfOffset + + global __nvmlDeviceGetClockOffsets + data["__nvmlDeviceGetClockOffsets"] = <_cyb_intptr_t>__nvmlDeviceGetClockOffsets + + global __nvmlDeviceSetClockOffsets + data["__nvmlDeviceSetClockOffsets"] = <_cyb_intptr_t>__nvmlDeviceSetClockOffsets + + global __nvmlDeviceGetPerformanceModes + data["__nvmlDeviceGetPerformanceModes"] = <_cyb_intptr_t>__nvmlDeviceGetPerformanceModes + + global __nvmlDeviceGetCurrentClockFreqs + data["__nvmlDeviceGetCurrentClockFreqs"] = <_cyb_intptr_t>__nvmlDeviceGetCurrentClockFreqs + + global __nvmlDeviceGetPowerManagementLimit + data["__nvmlDeviceGetPowerManagementLimit"] = <_cyb_intptr_t>__nvmlDeviceGetPowerManagementLimit + + global __nvmlDeviceGetPowerManagementLimitConstraints + data["__nvmlDeviceGetPowerManagementLimitConstraints"] = <_cyb_intptr_t>__nvmlDeviceGetPowerManagementLimitConstraints + + global __nvmlDeviceGetPowerManagementDefaultLimit + data["__nvmlDeviceGetPowerManagementDefaultLimit"] = <_cyb_intptr_t>__nvmlDeviceGetPowerManagementDefaultLimit + + global __nvmlDeviceGetPowerUsage + data["__nvmlDeviceGetPowerUsage"] = <_cyb_intptr_t>__nvmlDeviceGetPowerUsage + + global __nvmlDeviceGetTotalEnergyConsumption + data["__nvmlDeviceGetTotalEnergyConsumption"] = <_cyb_intptr_t>__nvmlDeviceGetTotalEnergyConsumption + + global __nvmlDeviceGetEnforcedPowerLimit + data["__nvmlDeviceGetEnforcedPowerLimit"] = <_cyb_intptr_t>__nvmlDeviceGetEnforcedPowerLimit + + global __nvmlDeviceGetGpuOperationMode + data["__nvmlDeviceGetGpuOperationMode"] = <_cyb_intptr_t>__nvmlDeviceGetGpuOperationMode + + global __nvmlDeviceGetMemoryInfo_v2 + data["__nvmlDeviceGetMemoryInfo_v2"] = <_cyb_intptr_t>__nvmlDeviceGetMemoryInfo_v2 + + global __nvmlDeviceGetComputeMode + data["__nvmlDeviceGetComputeMode"] = <_cyb_intptr_t>__nvmlDeviceGetComputeMode + + global __nvmlDeviceGetCudaComputeCapability + data["__nvmlDeviceGetCudaComputeCapability"] = <_cyb_intptr_t>__nvmlDeviceGetCudaComputeCapability + + global __nvmlDeviceGetDramEncryptionMode + data["__nvmlDeviceGetDramEncryptionMode"] = <_cyb_intptr_t>__nvmlDeviceGetDramEncryptionMode + + global __nvmlDeviceSetDramEncryptionMode + data["__nvmlDeviceSetDramEncryptionMode"] = <_cyb_intptr_t>__nvmlDeviceSetDramEncryptionMode + + global __nvmlDeviceGetEccMode + data["__nvmlDeviceGetEccMode"] = <_cyb_intptr_t>__nvmlDeviceGetEccMode + + global __nvmlDeviceGetDefaultEccMode + data["__nvmlDeviceGetDefaultEccMode"] = <_cyb_intptr_t>__nvmlDeviceGetDefaultEccMode + + global __nvmlDeviceGetBoardId + data["__nvmlDeviceGetBoardId"] = <_cyb_intptr_t>__nvmlDeviceGetBoardId + + global __nvmlDeviceGetMultiGpuBoard + data["__nvmlDeviceGetMultiGpuBoard"] = <_cyb_intptr_t>__nvmlDeviceGetMultiGpuBoard + + global __nvmlDeviceGetTotalEccErrors + data["__nvmlDeviceGetTotalEccErrors"] = <_cyb_intptr_t>__nvmlDeviceGetTotalEccErrors + + global __nvmlDeviceGetMemoryErrorCounter + data["__nvmlDeviceGetMemoryErrorCounter"] = <_cyb_intptr_t>__nvmlDeviceGetMemoryErrorCounter + + global __nvmlDeviceGetUtilizationRates + data["__nvmlDeviceGetUtilizationRates"] = <_cyb_intptr_t>__nvmlDeviceGetUtilizationRates + + global __nvmlDeviceGetEncoderUtilization + data["__nvmlDeviceGetEncoderUtilization"] = <_cyb_intptr_t>__nvmlDeviceGetEncoderUtilization + + global __nvmlDeviceGetEncoderCapacity + data["__nvmlDeviceGetEncoderCapacity"] = <_cyb_intptr_t>__nvmlDeviceGetEncoderCapacity + + global __nvmlDeviceGetEncoderStats + data["__nvmlDeviceGetEncoderStats"] = <_cyb_intptr_t>__nvmlDeviceGetEncoderStats + + global __nvmlDeviceGetEncoderSessions + data["__nvmlDeviceGetEncoderSessions"] = <_cyb_intptr_t>__nvmlDeviceGetEncoderSessions + + global __nvmlDeviceGetDecoderUtilization + data["__nvmlDeviceGetDecoderUtilization"] = <_cyb_intptr_t>__nvmlDeviceGetDecoderUtilization + + global __nvmlDeviceGetJpgUtilization + data["__nvmlDeviceGetJpgUtilization"] = <_cyb_intptr_t>__nvmlDeviceGetJpgUtilization + + global __nvmlDeviceGetOfaUtilization + data["__nvmlDeviceGetOfaUtilization"] = <_cyb_intptr_t>__nvmlDeviceGetOfaUtilization + + global __nvmlDeviceGetFBCStats + data["__nvmlDeviceGetFBCStats"] = <_cyb_intptr_t>__nvmlDeviceGetFBCStats + + global __nvmlDeviceGetFBCSessions + data["__nvmlDeviceGetFBCSessions"] = <_cyb_intptr_t>__nvmlDeviceGetFBCSessions + + global __nvmlDeviceGetDriverModel_v2 + data["__nvmlDeviceGetDriverModel_v2"] = <_cyb_intptr_t>__nvmlDeviceGetDriverModel_v2 + + global __nvmlDeviceGetVbiosVersion + data["__nvmlDeviceGetVbiosVersion"] = <_cyb_intptr_t>__nvmlDeviceGetVbiosVersion + + global __nvmlDeviceGetBridgeChipInfo + data["__nvmlDeviceGetBridgeChipInfo"] = <_cyb_intptr_t>__nvmlDeviceGetBridgeChipInfo + + global __nvmlDeviceGetComputeRunningProcesses_v3 + data["__nvmlDeviceGetComputeRunningProcesses_v3"] = <_cyb_intptr_t>__nvmlDeviceGetComputeRunningProcesses_v3 + + global __nvmlDeviceGetGraphicsRunningProcesses_v3 + data["__nvmlDeviceGetGraphicsRunningProcesses_v3"] = <_cyb_intptr_t>__nvmlDeviceGetGraphicsRunningProcesses_v3 + + global __nvmlDeviceGetMPSComputeRunningProcesses_v3 + data["__nvmlDeviceGetMPSComputeRunningProcesses_v3"] = <_cyb_intptr_t>__nvmlDeviceGetMPSComputeRunningProcesses_v3 + + global __nvmlDeviceGetRunningProcessDetailList + data["__nvmlDeviceGetRunningProcessDetailList"] = <_cyb_intptr_t>__nvmlDeviceGetRunningProcessDetailList + + global __nvmlDeviceOnSameBoard + data["__nvmlDeviceOnSameBoard"] = <_cyb_intptr_t>__nvmlDeviceOnSameBoard + + global __nvmlDeviceGetAPIRestriction + data["__nvmlDeviceGetAPIRestriction"] = <_cyb_intptr_t>__nvmlDeviceGetAPIRestriction + + global __nvmlDeviceGetSamples + data["__nvmlDeviceGetSamples"] = <_cyb_intptr_t>__nvmlDeviceGetSamples + + global __nvmlDeviceGetBAR1MemoryInfo + data["__nvmlDeviceGetBAR1MemoryInfo"] = <_cyb_intptr_t>__nvmlDeviceGetBAR1MemoryInfo + + global __nvmlDeviceGetIrqNum + data["__nvmlDeviceGetIrqNum"] = <_cyb_intptr_t>__nvmlDeviceGetIrqNum + + global __nvmlDeviceGetNumGpuCores + data["__nvmlDeviceGetNumGpuCores"] = <_cyb_intptr_t>__nvmlDeviceGetNumGpuCores + + global __nvmlDeviceGetPowerSource + data["__nvmlDeviceGetPowerSource"] = <_cyb_intptr_t>__nvmlDeviceGetPowerSource + + global __nvmlDeviceGetMemoryBusWidth + data["__nvmlDeviceGetMemoryBusWidth"] = <_cyb_intptr_t>__nvmlDeviceGetMemoryBusWidth + + global __nvmlDeviceGetPcieLinkMaxSpeed + data["__nvmlDeviceGetPcieLinkMaxSpeed"] = <_cyb_intptr_t>__nvmlDeviceGetPcieLinkMaxSpeed + + global __nvmlDeviceGetPcieSpeed + data["__nvmlDeviceGetPcieSpeed"] = <_cyb_intptr_t>__nvmlDeviceGetPcieSpeed + + global __nvmlDeviceGetAdaptiveClockInfoStatus + data["__nvmlDeviceGetAdaptiveClockInfoStatus"] = <_cyb_intptr_t>__nvmlDeviceGetAdaptiveClockInfoStatus + + global __nvmlDeviceGetBusType + data["__nvmlDeviceGetBusType"] = <_cyb_intptr_t>__nvmlDeviceGetBusType + + global __nvmlDeviceGetGpuFabricInfoV + data["__nvmlDeviceGetGpuFabricInfoV"] = <_cyb_intptr_t>__nvmlDeviceGetGpuFabricInfoV + + global __nvmlSystemGetConfComputeCapabilities + data["__nvmlSystemGetConfComputeCapabilities"] = <_cyb_intptr_t>__nvmlSystemGetConfComputeCapabilities + + global __nvmlSystemGetConfComputeState + data["__nvmlSystemGetConfComputeState"] = <_cyb_intptr_t>__nvmlSystemGetConfComputeState + + global __nvmlDeviceGetConfComputeMemSizeInfo + data["__nvmlDeviceGetConfComputeMemSizeInfo"] = <_cyb_intptr_t>__nvmlDeviceGetConfComputeMemSizeInfo + + global __nvmlSystemGetConfComputeGpusReadyState + data["__nvmlSystemGetConfComputeGpusReadyState"] = <_cyb_intptr_t>__nvmlSystemGetConfComputeGpusReadyState + + global __nvmlDeviceGetConfComputeProtectedMemoryUsage + data["__nvmlDeviceGetConfComputeProtectedMemoryUsage"] = <_cyb_intptr_t>__nvmlDeviceGetConfComputeProtectedMemoryUsage + + global __nvmlDeviceGetConfComputeGpuCertificate + data["__nvmlDeviceGetConfComputeGpuCertificate"] = <_cyb_intptr_t>__nvmlDeviceGetConfComputeGpuCertificate + + global __nvmlDeviceGetConfComputeGpuAttestationReport + data["__nvmlDeviceGetConfComputeGpuAttestationReport"] = <_cyb_intptr_t>__nvmlDeviceGetConfComputeGpuAttestationReport + + global __nvmlSystemGetConfComputeKeyRotationThresholdInfo + data["__nvmlSystemGetConfComputeKeyRotationThresholdInfo"] = <_cyb_intptr_t>__nvmlSystemGetConfComputeKeyRotationThresholdInfo + + global __nvmlDeviceSetConfComputeUnprotectedMemSize + data["__nvmlDeviceSetConfComputeUnprotectedMemSize"] = <_cyb_intptr_t>__nvmlDeviceSetConfComputeUnprotectedMemSize + + global __nvmlSystemSetConfComputeGpusReadyState + data["__nvmlSystemSetConfComputeGpusReadyState"] = <_cyb_intptr_t>__nvmlSystemSetConfComputeGpusReadyState + + global __nvmlSystemSetConfComputeKeyRotationThresholdInfo + data["__nvmlSystemSetConfComputeKeyRotationThresholdInfo"] = <_cyb_intptr_t>__nvmlSystemSetConfComputeKeyRotationThresholdInfo + + global __nvmlSystemGetConfComputeSettings + data["__nvmlSystemGetConfComputeSettings"] = <_cyb_intptr_t>__nvmlSystemGetConfComputeSettings + + global __nvmlDeviceGetGspFirmwareVersion + data["__nvmlDeviceGetGspFirmwareVersion"] = <_cyb_intptr_t>__nvmlDeviceGetGspFirmwareVersion + + global __nvmlDeviceGetGspFirmwareMode + data["__nvmlDeviceGetGspFirmwareMode"] = <_cyb_intptr_t>__nvmlDeviceGetGspFirmwareMode + + global __nvmlDeviceGetSramEccErrorStatus + data["__nvmlDeviceGetSramEccErrorStatus"] = <_cyb_intptr_t>__nvmlDeviceGetSramEccErrorStatus + + global __nvmlDeviceGetAccountingMode + data["__nvmlDeviceGetAccountingMode"] = <_cyb_intptr_t>__nvmlDeviceGetAccountingMode + + global __nvmlDeviceGetAccountingStats + data["__nvmlDeviceGetAccountingStats"] = <_cyb_intptr_t>__nvmlDeviceGetAccountingStats + + global __nvmlDeviceGetAccountingPids + data["__nvmlDeviceGetAccountingPids"] = <_cyb_intptr_t>__nvmlDeviceGetAccountingPids + + global __nvmlDeviceGetAccountingBufferSize + data["__nvmlDeviceGetAccountingBufferSize"] = <_cyb_intptr_t>__nvmlDeviceGetAccountingBufferSize + + global __nvmlDeviceGetRetiredPages + data["__nvmlDeviceGetRetiredPages"] = <_cyb_intptr_t>__nvmlDeviceGetRetiredPages + + global __nvmlDeviceGetRetiredPages_v2 + data["__nvmlDeviceGetRetiredPages_v2"] = <_cyb_intptr_t>__nvmlDeviceGetRetiredPages_v2 + + global __nvmlDeviceGetRetiredPagesPendingStatus + data["__nvmlDeviceGetRetiredPagesPendingStatus"] = <_cyb_intptr_t>__nvmlDeviceGetRetiredPagesPendingStatus + + global __nvmlDeviceGetRemappedRows + data["__nvmlDeviceGetRemappedRows"] = <_cyb_intptr_t>__nvmlDeviceGetRemappedRows + + global __nvmlDeviceGetRowRemapperHistogram + data["__nvmlDeviceGetRowRemapperHistogram"] = <_cyb_intptr_t>__nvmlDeviceGetRowRemapperHistogram + + global __nvmlDeviceGetArchitecture + data["__nvmlDeviceGetArchitecture"] = <_cyb_intptr_t>__nvmlDeviceGetArchitecture + + global __nvmlDeviceGetClkMonStatus + data["__nvmlDeviceGetClkMonStatus"] = <_cyb_intptr_t>__nvmlDeviceGetClkMonStatus + + global __nvmlDeviceGetProcessUtilization + data["__nvmlDeviceGetProcessUtilization"] = <_cyb_intptr_t>__nvmlDeviceGetProcessUtilization + + global __nvmlDeviceGetProcessesUtilizationInfo + data["__nvmlDeviceGetProcessesUtilizationInfo"] = <_cyb_intptr_t>__nvmlDeviceGetProcessesUtilizationInfo + + global __nvmlDeviceGetPlatformInfo + data["__nvmlDeviceGetPlatformInfo"] = <_cyb_intptr_t>__nvmlDeviceGetPlatformInfo + + global __nvmlUnitSetLedState + data["__nvmlUnitSetLedState"] = <_cyb_intptr_t>__nvmlUnitSetLedState + + global __nvmlDeviceSetPersistenceMode + data["__nvmlDeviceSetPersistenceMode"] = <_cyb_intptr_t>__nvmlDeviceSetPersistenceMode + + global __nvmlDeviceSetComputeMode + data["__nvmlDeviceSetComputeMode"] = <_cyb_intptr_t>__nvmlDeviceSetComputeMode + + global __nvmlDeviceSetEccMode + data["__nvmlDeviceSetEccMode"] = <_cyb_intptr_t>__nvmlDeviceSetEccMode + + global __nvmlDeviceClearEccErrorCounts + data["__nvmlDeviceClearEccErrorCounts"] = <_cyb_intptr_t>__nvmlDeviceClearEccErrorCounts + + global __nvmlDeviceSetDriverModel + data["__nvmlDeviceSetDriverModel"] = <_cyb_intptr_t>__nvmlDeviceSetDriverModel + + global __nvmlDeviceSetGpuLockedClocks + data["__nvmlDeviceSetGpuLockedClocks"] = <_cyb_intptr_t>__nvmlDeviceSetGpuLockedClocks + + global __nvmlDeviceResetGpuLockedClocks + data["__nvmlDeviceResetGpuLockedClocks"] = <_cyb_intptr_t>__nvmlDeviceResetGpuLockedClocks + + global __nvmlDeviceSetMemoryLockedClocks + data["__nvmlDeviceSetMemoryLockedClocks"] = <_cyb_intptr_t>__nvmlDeviceSetMemoryLockedClocks + + global __nvmlDeviceResetMemoryLockedClocks + data["__nvmlDeviceResetMemoryLockedClocks"] = <_cyb_intptr_t>__nvmlDeviceResetMemoryLockedClocks + + global __nvmlDeviceSetAutoBoostedClocksEnabled + data["__nvmlDeviceSetAutoBoostedClocksEnabled"] = <_cyb_intptr_t>__nvmlDeviceSetAutoBoostedClocksEnabled + + global __nvmlDeviceSetDefaultAutoBoostedClocksEnabled + data["__nvmlDeviceSetDefaultAutoBoostedClocksEnabled"] = <_cyb_intptr_t>__nvmlDeviceSetDefaultAutoBoostedClocksEnabled + + global __nvmlDeviceSetDefaultFanSpeed_v2 + data["__nvmlDeviceSetDefaultFanSpeed_v2"] = <_cyb_intptr_t>__nvmlDeviceSetDefaultFanSpeed_v2 + + global __nvmlDeviceSetFanControlPolicy + data["__nvmlDeviceSetFanControlPolicy"] = <_cyb_intptr_t>__nvmlDeviceSetFanControlPolicy + + global __nvmlDeviceSetTemperatureThreshold + data["__nvmlDeviceSetTemperatureThreshold"] = <_cyb_intptr_t>__nvmlDeviceSetTemperatureThreshold + + global __nvmlDeviceSetGpuOperationMode + data["__nvmlDeviceSetGpuOperationMode"] = <_cyb_intptr_t>__nvmlDeviceSetGpuOperationMode + + global __nvmlDeviceSetAPIRestriction + data["__nvmlDeviceSetAPIRestriction"] = <_cyb_intptr_t>__nvmlDeviceSetAPIRestriction + + global __nvmlDeviceSetFanSpeed_v2 + data["__nvmlDeviceSetFanSpeed_v2"] = <_cyb_intptr_t>__nvmlDeviceSetFanSpeed_v2 + + global __nvmlDeviceSetAccountingMode + data["__nvmlDeviceSetAccountingMode"] = <_cyb_intptr_t>__nvmlDeviceSetAccountingMode + + global __nvmlDeviceClearAccountingPids + data["__nvmlDeviceClearAccountingPids"] = <_cyb_intptr_t>__nvmlDeviceClearAccountingPids + + global __nvmlDeviceSetPowerManagementLimit_v2 + data["__nvmlDeviceSetPowerManagementLimit_v2"] = <_cyb_intptr_t>__nvmlDeviceSetPowerManagementLimit_v2 + + global __nvmlDeviceGetNvLinkState + data["__nvmlDeviceGetNvLinkState"] = <_cyb_intptr_t>__nvmlDeviceGetNvLinkState + + global __nvmlDeviceGetNvLinkVersion + data["__nvmlDeviceGetNvLinkVersion"] = <_cyb_intptr_t>__nvmlDeviceGetNvLinkVersion + + global __nvmlDeviceGetNvLinkCapability + data["__nvmlDeviceGetNvLinkCapability"] = <_cyb_intptr_t>__nvmlDeviceGetNvLinkCapability + + global __nvmlDeviceGetNvLinkRemotePciInfo_v2 + data["__nvmlDeviceGetNvLinkRemotePciInfo_v2"] = <_cyb_intptr_t>__nvmlDeviceGetNvLinkRemotePciInfo_v2 + + global __nvmlDeviceGetNvLinkErrorCounter + data["__nvmlDeviceGetNvLinkErrorCounter"] = <_cyb_intptr_t>__nvmlDeviceGetNvLinkErrorCounter + + global __nvmlDeviceResetNvLinkErrorCounters + data["__nvmlDeviceResetNvLinkErrorCounters"] = <_cyb_intptr_t>__nvmlDeviceResetNvLinkErrorCounters + + global __nvmlDeviceGetNvLinkRemoteDeviceType + data["__nvmlDeviceGetNvLinkRemoteDeviceType"] = <_cyb_intptr_t>__nvmlDeviceGetNvLinkRemoteDeviceType + + global __nvmlDeviceSetNvLinkDeviceLowPowerThreshold + data["__nvmlDeviceSetNvLinkDeviceLowPowerThreshold"] = <_cyb_intptr_t>__nvmlDeviceSetNvLinkDeviceLowPowerThreshold + + global __nvmlSystemSetNvlinkBwMode + data["__nvmlSystemSetNvlinkBwMode"] = <_cyb_intptr_t>__nvmlSystemSetNvlinkBwMode + + global __nvmlSystemGetNvlinkBwMode + data["__nvmlSystemGetNvlinkBwMode"] = <_cyb_intptr_t>__nvmlSystemGetNvlinkBwMode + + global __nvmlDeviceGetNvlinkSupportedBwModes + data["__nvmlDeviceGetNvlinkSupportedBwModes"] = <_cyb_intptr_t>__nvmlDeviceGetNvlinkSupportedBwModes + + global __nvmlDeviceGetNvlinkBwMode + data["__nvmlDeviceGetNvlinkBwMode"] = <_cyb_intptr_t>__nvmlDeviceGetNvlinkBwMode + + global __nvmlDeviceSetNvlinkBwMode + data["__nvmlDeviceSetNvlinkBwMode"] = <_cyb_intptr_t>__nvmlDeviceSetNvlinkBwMode + + global __nvmlEventSetCreate + data["__nvmlEventSetCreate"] = <_cyb_intptr_t>__nvmlEventSetCreate + + global __nvmlDeviceRegisterEvents + data["__nvmlDeviceRegisterEvents"] = <_cyb_intptr_t>__nvmlDeviceRegisterEvents + + global __nvmlDeviceGetSupportedEventTypes + data["__nvmlDeviceGetSupportedEventTypes"] = <_cyb_intptr_t>__nvmlDeviceGetSupportedEventTypes + + global __nvmlEventSetWait_v2 + data["__nvmlEventSetWait_v2"] = <_cyb_intptr_t>__nvmlEventSetWait_v2 + + global __nvmlEventSetFree + data["__nvmlEventSetFree"] = <_cyb_intptr_t>__nvmlEventSetFree + + global __nvmlSystemEventSetCreate + data["__nvmlSystemEventSetCreate"] = <_cyb_intptr_t>__nvmlSystemEventSetCreate + + global __nvmlSystemEventSetFree + data["__nvmlSystemEventSetFree"] = <_cyb_intptr_t>__nvmlSystemEventSetFree + + global __nvmlSystemRegisterEvents + data["__nvmlSystemRegisterEvents"] = <_cyb_intptr_t>__nvmlSystemRegisterEvents + + global __nvmlSystemEventSetWait + data["__nvmlSystemEventSetWait"] = <_cyb_intptr_t>__nvmlSystemEventSetWait + + global __nvmlDeviceModifyDrainState + data["__nvmlDeviceModifyDrainState"] = <_cyb_intptr_t>__nvmlDeviceModifyDrainState + + global __nvmlDeviceQueryDrainState + data["__nvmlDeviceQueryDrainState"] = <_cyb_intptr_t>__nvmlDeviceQueryDrainState + + global __nvmlDeviceRemoveGpu_v2 + data["__nvmlDeviceRemoveGpu_v2"] = <_cyb_intptr_t>__nvmlDeviceRemoveGpu_v2 + + global __nvmlDeviceDiscoverGpus + data["__nvmlDeviceDiscoverGpus"] = <_cyb_intptr_t>__nvmlDeviceDiscoverGpus + + global __nvmlDeviceGetFieldValues + data["__nvmlDeviceGetFieldValues"] = <_cyb_intptr_t>__nvmlDeviceGetFieldValues + + global __nvmlDeviceClearFieldValues + data["__nvmlDeviceClearFieldValues"] = <_cyb_intptr_t>__nvmlDeviceClearFieldValues + + global __nvmlDeviceGetVirtualizationMode + data["__nvmlDeviceGetVirtualizationMode"] = <_cyb_intptr_t>__nvmlDeviceGetVirtualizationMode + + global __nvmlDeviceGetHostVgpuMode + data["__nvmlDeviceGetHostVgpuMode"] = <_cyb_intptr_t>__nvmlDeviceGetHostVgpuMode + + global __nvmlDeviceSetVirtualizationMode + data["__nvmlDeviceSetVirtualizationMode"] = <_cyb_intptr_t>__nvmlDeviceSetVirtualizationMode + + global __nvmlDeviceGetVgpuHeterogeneousMode + data["__nvmlDeviceGetVgpuHeterogeneousMode"] = <_cyb_intptr_t>__nvmlDeviceGetVgpuHeterogeneousMode + + global __nvmlDeviceSetVgpuHeterogeneousMode + data["__nvmlDeviceSetVgpuHeterogeneousMode"] = <_cyb_intptr_t>__nvmlDeviceSetVgpuHeterogeneousMode + + global __nvmlVgpuInstanceGetPlacementId + data["__nvmlVgpuInstanceGetPlacementId"] = <_cyb_intptr_t>__nvmlVgpuInstanceGetPlacementId + + global __nvmlDeviceGetVgpuTypeSupportedPlacements + data["__nvmlDeviceGetVgpuTypeSupportedPlacements"] = <_cyb_intptr_t>__nvmlDeviceGetVgpuTypeSupportedPlacements + + global __nvmlDeviceGetVgpuTypeCreatablePlacements + data["__nvmlDeviceGetVgpuTypeCreatablePlacements"] = <_cyb_intptr_t>__nvmlDeviceGetVgpuTypeCreatablePlacements + + global __nvmlVgpuTypeGetGspHeapSize + data["__nvmlVgpuTypeGetGspHeapSize"] = <_cyb_intptr_t>__nvmlVgpuTypeGetGspHeapSize + + global __nvmlVgpuTypeGetFbReservation + data["__nvmlVgpuTypeGetFbReservation"] = <_cyb_intptr_t>__nvmlVgpuTypeGetFbReservation + + global __nvmlVgpuInstanceGetRuntimeStateSize + data["__nvmlVgpuInstanceGetRuntimeStateSize"] = <_cyb_intptr_t>__nvmlVgpuInstanceGetRuntimeStateSize + + global __nvmlDeviceSetVgpuCapabilities + data["__nvmlDeviceSetVgpuCapabilities"] = <_cyb_intptr_t>__nvmlDeviceSetVgpuCapabilities + + global __nvmlDeviceGetGridLicensableFeatures_v4 + data["__nvmlDeviceGetGridLicensableFeatures_v4"] = <_cyb_intptr_t>__nvmlDeviceGetGridLicensableFeatures_v4 + + global __nvmlGetVgpuDriverCapabilities + data["__nvmlGetVgpuDriverCapabilities"] = <_cyb_intptr_t>__nvmlGetVgpuDriverCapabilities + + global __nvmlDeviceGetVgpuCapabilities + data["__nvmlDeviceGetVgpuCapabilities"] = <_cyb_intptr_t>__nvmlDeviceGetVgpuCapabilities + + global __nvmlDeviceGetSupportedVgpus + data["__nvmlDeviceGetSupportedVgpus"] = <_cyb_intptr_t>__nvmlDeviceGetSupportedVgpus + + global __nvmlDeviceGetCreatableVgpus + data["__nvmlDeviceGetCreatableVgpus"] = <_cyb_intptr_t>__nvmlDeviceGetCreatableVgpus + + global __nvmlVgpuTypeGetClass + data["__nvmlVgpuTypeGetClass"] = <_cyb_intptr_t>__nvmlVgpuTypeGetClass + + global __nvmlVgpuTypeGetName + data["__nvmlVgpuTypeGetName"] = <_cyb_intptr_t>__nvmlVgpuTypeGetName + + global __nvmlVgpuTypeGetGpuInstanceProfileId + data["__nvmlVgpuTypeGetGpuInstanceProfileId"] = <_cyb_intptr_t>__nvmlVgpuTypeGetGpuInstanceProfileId + + global __nvmlVgpuTypeGetDeviceID + data["__nvmlVgpuTypeGetDeviceID"] = <_cyb_intptr_t>__nvmlVgpuTypeGetDeviceID + + global __nvmlVgpuTypeGetFramebufferSize + data["__nvmlVgpuTypeGetFramebufferSize"] = <_cyb_intptr_t>__nvmlVgpuTypeGetFramebufferSize + + global __nvmlVgpuTypeGetNumDisplayHeads + data["__nvmlVgpuTypeGetNumDisplayHeads"] = <_cyb_intptr_t>__nvmlVgpuTypeGetNumDisplayHeads + + global __nvmlVgpuTypeGetResolution + data["__nvmlVgpuTypeGetResolution"] = <_cyb_intptr_t>__nvmlVgpuTypeGetResolution + + global __nvmlVgpuTypeGetLicense + data["__nvmlVgpuTypeGetLicense"] = <_cyb_intptr_t>__nvmlVgpuTypeGetLicense + + global __nvmlVgpuTypeGetFrameRateLimit + data["__nvmlVgpuTypeGetFrameRateLimit"] = <_cyb_intptr_t>__nvmlVgpuTypeGetFrameRateLimit + + global __nvmlVgpuTypeGetMaxInstances + data["__nvmlVgpuTypeGetMaxInstances"] = <_cyb_intptr_t>__nvmlVgpuTypeGetMaxInstances + + global __nvmlVgpuTypeGetMaxInstancesPerVm + data["__nvmlVgpuTypeGetMaxInstancesPerVm"] = <_cyb_intptr_t>__nvmlVgpuTypeGetMaxInstancesPerVm + + global __nvmlVgpuTypeGetBAR1Info + data["__nvmlVgpuTypeGetBAR1Info"] = <_cyb_intptr_t>__nvmlVgpuTypeGetBAR1Info + + global __nvmlDeviceGetActiveVgpus + data["__nvmlDeviceGetActiveVgpus"] = <_cyb_intptr_t>__nvmlDeviceGetActiveVgpus + + global __nvmlVgpuInstanceGetVmID + data["__nvmlVgpuInstanceGetVmID"] = <_cyb_intptr_t>__nvmlVgpuInstanceGetVmID + + global __nvmlVgpuInstanceGetUUID + data["__nvmlVgpuInstanceGetUUID"] = <_cyb_intptr_t>__nvmlVgpuInstanceGetUUID + + global __nvmlVgpuInstanceGetVmDriverVersion + data["__nvmlVgpuInstanceGetVmDriverVersion"] = <_cyb_intptr_t>__nvmlVgpuInstanceGetVmDriverVersion + + global __nvmlVgpuInstanceGetFbUsage + data["__nvmlVgpuInstanceGetFbUsage"] = <_cyb_intptr_t>__nvmlVgpuInstanceGetFbUsage + + global __nvmlVgpuInstanceGetLicenseStatus + data["__nvmlVgpuInstanceGetLicenseStatus"] = <_cyb_intptr_t>__nvmlVgpuInstanceGetLicenseStatus + + global __nvmlVgpuInstanceGetType + data["__nvmlVgpuInstanceGetType"] = <_cyb_intptr_t>__nvmlVgpuInstanceGetType + + global __nvmlVgpuInstanceGetFrameRateLimit + data["__nvmlVgpuInstanceGetFrameRateLimit"] = <_cyb_intptr_t>__nvmlVgpuInstanceGetFrameRateLimit + + global __nvmlVgpuInstanceGetEccMode + data["__nvmlVgpuInstanceGetEccMode"] = <_cyb_intptr_t>__nvmlVgpuInstanceGetEccMode + + global __nvmlVgpuInstanceGetEncoderCapacity + data["__nvmlVgpuInstanceGetEncoderCapacity"] = <_cyb_intptr_t>__nvmlVgpuInstanceGetEncoderCapacity + + global __nvmlVgpuInstanceSetEncoderCapacity + data["__nvmlVgpuInstanceSetEncoderCapacity"] = <_cyb_intptr_t>__nvmlVgpuInstanceSetEncoderCapacity + + global __nvmlVgpuInstanceGetEncoderStats + data["__nvmlVgpuInstanceGetEncoderStats"] = <_cyb_intptr_t>__nvmlVgpuInstanceGetEncoderStats + + global __nvmlVgpuInstanceGetEncoderSessions + data["__nvmlVgpuInstanceGetEncoderSessions"] = <_cyb_intptr_t>__nvmlVgpuInstanceGetEncoderSessions + + global __nvmlVgpuInstanceGetFBCStats + data["__nvmlVgpuInstanceGetFBCStats"] = <_cyb_intptr_t>__nvmlVgpuInstanceGetFBCStats + + global __nvmlVgpuInstanceGetFBCSessions + data["__nvmlVgpuInstanceGetFBCSessions"] = <_cyb_intptr_t>__nvmlVgpuInstanceGetFBCSessions + + global __nvmlVgpuInstanceGetGpuInstanceId + data["__nvmlVgpuInstanceGetGpuInstanceId"] = <_cyb_intptr_t>__nvmlVgpuInstanceGetGpuInstanceId + + global __nvmlVgpuInstanceGetGpuPciId + data["__nvmlVgpuInstanceGetGpuPciId"] = <_cyb_intptr_t>__nvmlVgpuInstanceGetGpuPciId + + global __nvmlVgpuTypeGetCapabilities + data["__nvmlVgpuTypeGetCapabilities"] = <_cyb_intptr_t>__nvmlVgpuTypeGetCapabilities + + global __nvmlVgpuInstanceGetMdevUUID + data["__nvmlVgpuInstanceGetMdevUUID"] = <_cyb_intptr_t>__nvmlVgpuInstanceGetMdevUUID + + global __nvmlGpuInstanceGetCreatableVgpus + data["__nvmlGpuInstanceGetCreatableVgpus"] = <_cyb_intptr_t>__nvmlGpuInstanceGetCreatableVgpus + + global __nvmlVgpuTypeGetMaxInstancesPerGpuInstance + data["__nvmlVgpuTypeGetMaxInstancesPerGpuInstance"] = <_cyb_intptr_t>__nvmlVgpuTypeGetMaxInstancesPerGpuInstance + + global __nvmlGpuInstanceGetActiveVgpus + data["__nvmlGpuInstanceGetActiveVgpus"] = <_cyb_intptr_t>__nvmlGpuInstanceGetActiveVgpus + + global __nvmlGpuInstanceSetVgpuSchedulerState + data["__nvmlGpuInstanceSetVgpuSchedulerState"] = <_cyb_intptr_t>__nvmlGpuInstanceSetVgpuSchedulerState + + global __nvmlGpuInstanceGetVgpuSchedulerState + data["__nvmlGpuInstanceGetVgpuSchedulerState"] = <_cyb_intptr_t>__nvmlGpuInstanceGetVgpuSchedulerState + + global __nvmlGpuInstanceGetVgpuSchedulerLog + data["__nvmlGpuInstanceGetVgpuSchedulerLog"] = <_cyb_intptr_t>__nvmlGpuInstanceGetVgpuSchedulerLog + + global __nvmlGpuInstanceGetVgpuTypeCreatablePlacements + data["__nvmlGpuInstanceGetVgpuTypeCreatablePlacements"] = <_cyb_intptr_t>__nvmlGpuInstanceGetVgpuTypeCreatablePlacements + + global __nvmlGpuInstanceGetVgpuHeterogeneousMode + data["__nvmlGpuInstanceGetVgpuHeterogeneousMode"] = <_cyb_intptr_t>__nvmlGpuInstanceGetVgpuHeterogeneousMode + + global __nvmlGpuInstanceSetVgpuHeterogeneousMode + data["__nvmlGpuInstanceSetVgpuHeterogeneousMode"] = <_cyb_intptr_t>__nvmlGpuInstanceSetVgpuHeterogeneousMode + + global __nvmlVgpuInstanceGetMetadata + data["__nvmlVgpuInstanceGetMetadata"] = <_cyb_intptr_t>__nvmlVgpuInstanceGetMetadata + + global __nvmlDeviceGetVgpuMetadata + data["__nvmlDeviceGetVgpuMetadata"] = <_cyb_intptr_t>__nvmlDeviceGetVgpuMetadata + + global __nvmlGetVgpuCompatibility + data["__nvmlGetVgpuCompatibility"] = <_cyb_intptr_t>__nvmlGetVgpuCompatibility + + global __nvmlDeviceGetPgpuMetadataString + data["__nvmlDeviceGetPgpuMetadataString"] = <_cyb_intptr_t>__nvmlDeviceGetPgpuMetadataString + + global __nvmlDeviceGetVgpuSchedulerLog + data["__nvmlDeviceGetVgpuSchedulerLog"] = <_cyb_intptr_t>__nvmlDeviceGetVgpuSchedulerLog + + global __nvmlDeviceGetVgpuSchedulerState + data["__nvmlDeviceGetVgpuSchedulerState"] = <_cyb_intptr_t>__nvmlDeviceGetVgpuSchedulerState + + global __nvmlDeviceGetVgpuSchedulerCapabilities + data["__nvmlDeviceGetVgpuSchedulerCapabilities"] = <_cyb_intptr_t>__nvmlDeviceGetVgpuSchedulerCapabilities + + global __nvmlDeviceSetVgpuSchedulerState + data["__nvmlDeviceSetVgpuSchedulerState"] = <_cyb_intptr_t>__nvmlDeviceSetVgpuSchedulerState + + global __nvmlGetVgpuVersion + data["__nvmlGetVgpuVersion"] = <_cyb_intptr_t>__nvmlGetVgpuVersion + + global __nvmlSetVgpuVersion + data["__nvmlSetVgpuVersion"] = <_cyb_intptr_t>__nvmlSetVgpuVersion + + global __nvmlDeviceGetVgpuUtilization + data["__nvmlDeviceGetVgpuUtilization"] = <_cyb_intptr_t>__nvmlDeviceGetVgpuUtilization + + global __nvmlDeviceGetVgpuInstancesUtilizationInfo + data["__nvmlDeviceGetVgpuInstancesUtilizationInfo"] = <_cyb_intptr_t>__nvmlDeviceGetVgpuInstancesUtilizationInfo + + global __nvmlDeviceGetVgpuProcessUtilization + data["__nvmlDeviceGetVgpuProcessUtilization"] = <_cyb_intptr_t>__nvmlDeviceGetVgpuProcessUtilization + + global __nvmlDeviceGetVgpuProcessesUtilizationInfo + data["__nvmlDeviceGetVgpuProcessesUtilizationInfo"] = <_cyb_intptr_t>__nvmlDeviceGetVgpuProcessesUtilizationInfo + + global __nvmlVgpuInstanceGetAccountingMode + data["__nvmlVgpuInstanceGetAccountingMode"] = <_cyb_intptr_t>__nvmlVgpuInstanceGetAccountingMode + + global __nvmlVgpuInstanceGetAccountingPids + data["__nvmlVgpuInstanceGetAccountingPids"] = <_cyb_intptr_t>__nvmlVgpuInstanceGetAccountingPids + + global __nvmlVgpuInstanceGetAccountingStats + data["__nvmlVgpuInstanceGetAccountingStats"] = <_cyb_intptr_t>__nvmlVgpuInstanceGetAccountingStats + + global __nvmlVgpuInstanceClearAccountingPids + data["__nvmlVgpuInstanceClearAccountingPids"] = <_cyb_intptr_t>__nvmlVgpuInstanceClearAccountingPids + + global __nvmlVgpuInstanceGetLicenseInfo_v2 + data["__nvmlVgpuInstanceGetLicenseInfo_v2"] = <_cyb_intptr_t>__nvmlVgpuInstanceGetLicenseInfo_v2 + + global __nvmlGetExcludedDeviceCount + data["__nvmlGetExcludedDeviceCount"] = <_cyb_intptr_t>__nvmlGetExcludedDeviceCount + + global __nvmlGetExcludedDeviceInfoByIndex + data["__nvmlGetExcludedDeviceInfoByIndex"] = <_cyb_intptr_t>__nvmlGetExcludedDeviceInfoByIndex + + global __nvmlDeviceSetMigMode + data["__nvmlDeviceSetMigMode"] = <_cyb_intptr_t>__nvmlDeviceSetMigMode + + global __nvmlDeviceGetMigMode + data["__nvmlDeviceGetMigMode"] = <_cyb_intptr_t>__nvmlDeviceGetMigMode + + global __nvmlDeviceGetGpuInstanceProfileInfoV + data["__nvmlDeviceGetGpuInstanceProfileInfoV"] = <_cyb_intptr_t>__nvmlDeviceGetGpuInstanceProfileInfoV + + global __nvmlDeviceGetGpuInstancePossiblePlacements_v2 + data["__nvmlDeviceGetGpuInstancePossiblePlacements_v2"] = <_cyb_intptr_t>__nvmlDeviceGetGpuInstancePossiblePlacements_v2 + + global __nvmlDeviceGetGpuInstanceRemainingCapacity + data["__nvmlDeviceGetGpuInstanceRemainingCapacity"] = <_cyb_intptr_t>__nvmlDeviceGetGpuInstanceRemainingCapacity + + global __nvmlDeviceCreateGpuInstance + data["__nvmlDeviceCreateGpuInstance"] = <_cyb_intptr_t>__nvmlDeviceCreateGpuInstance + + global __nvmlDeviceCreateGpuInstanceWithPlacement + data["__nvmlDeviceCreateGpuInstanceWithPlacement"] = <_cyb_intptr_t>__nvmlDeviceCreateGpuInstanceWithPlacement + + global __nvmlGpuInstanceDestroy + data["__nvmlGpuInstanceDestroy"] = <_cyb_intptr_t>__nvmlGpuInstanceDestroy + + global __nvmlDeviceGetGpuInstances + data["__nvmlDeviceGetGpuInstances"] = <_cyb_intptr_t>__nvmlDeviceGetGpuInstances + + global __nvmlDeviceGetGpuInstanceById + data["__nvmlDeviceGetGpuInstanceById"] = <_cyb_intptr_t>__nvmlDeviceGetGpuInstanceById + + global __nvmlGpuInstanceGetInfo + data["__nvmlGpuInstanceGetInfo"] = <_cyb_intptr_t>__nvmlGpuInstanceGetInfo + + global __nvmlGpuInstanceGetComputeInstanceProfileInfoV + data["__nvmlGpuInstanceGetComputeInstanceProfileInfoV"] = <_cyb_intptr_t>__nvmlGpuInstanceGetComputeInstanceProfileInfoV + + global __nvmlGpuInstanceGetComputeInstanceRemainingCapacity + data["__nvmlGpuInstanceGetComputeInstanceRemainingCapacity"] = <_cyb_intptr_t>__nvmlGpuInstanceGetComputeInstanceRemainingCapacity + + global __nvmlGpuInstanceGetComputeInstancePossiblePlacements + data["__nvmlGpuInstanceGetComputeInstancePossiblePlacements"] = <_cyb_intptr_t>__nvmlGpuInstanceGetComputeInstancePossiblePlacements + + global __nvmlGpuInstanceCreateComputeInstance + data["__nvmlGpuInstanceCreateComputeInstance"] = <_cyb_intptr_t>__nvmlGpuInstanceCreateComputeInstance + + global __nvmlGpuInstanceCreateComputeInstanceWithPlacement + data["__nvmlGpuInstanceCreateComputeInstanceWithPlacement"] = <_cyb_intptr_t>__nvmlGpuInstanceCreateComputeInstanceWithPlacement + + global __nvmlComputeInstanceDestroy + data["__nvmlComputeInstanceDestroy"] = <_cyb_intptr_t>__nvmlComputeInstanceDestroy + + global __nvmlGpuInstanceGetComputeInstances + data["__nvmlGpuInstanceGetComputeInstances"] = <_cyb_intptr_t>__nvmlGpuInstanceGetComputeInstances + + global __nvmlGpuInstanceGetComputeInstanceById + data["__nvmlGpuInstanceGetComputeInstanceById"] = <_cyb_intptr_t>__nvmlGpuInstanceGetComputeInstanceById + + global __nvmlComputeInstanceGetInfo_v2 + data["__nvmlComputeInstanceGetInfo_v2"] = <_cyb_intptr_t>__nvmlComputeInstanceGetInfo_v2 + + global __nvmlDeviceIsMigDeviceHandle + data["__nvmlDeviceIsMigDeviceHandle"] = <_cyb_intptr_t>__nvmlDeviceIsMigDeviceHandle + + global __nvmlDeviceGetGpuInstanceId + data["__nvmlDeviceGetGpuInstanceId"] = <_cyb_intptr_t>__nvmlDeviceGetGpuInstanceId + + global __nvmlDeviceGetComputeInstanceId + data["__nvmlDeviceGetComputeInstanceId"] = <_cyb_intptr_t>__nvmlDeviceGetComputeInstanceId + + global __nvmlDeviceGetMaxMigDeviceCount + data["__nvmlDeviceGetMaxMigDeviceCount"] = <_cyb_intptr_t>__nvmlDeviceGetMaxMigDeviceCount + + global __nvmlDeviceGetMigDeviceHandleByIndex + data["__nvmlDeviceGetMigDeviceHandleByIndex"] = <_cyb_intptr_t>__nvmlDeviceGetMigDeviceHandleByIndex + + global __nvmlDeviceGetDeviceHandleFromMigDeviceHandle + data["__nvmlDeviceGetDeviceHandleFromMigDeviceHandle"] = <_cyb_intptr_t>__nvmlDeviceGetDeviceHandleFromMigDeviceHandle + + global __nvmlDeviceGetCapabilities + data["__nvmlDeviceGetCapabilities"] = <_cyb_intptr_t>__nvmlDeviceGetCapabilities + + global __nvmlDevicePowerSmoothingActivatePresetProfile + data["__nvmlDevicePowerSmoothingActivatePresetProfile"] = <_cyb_intptr_t>__nvmlDevicePowerSmoothingActivatePresetProfile + + global __nvmlDevicePowerSmoothingUpdatePresetProfileParam + data["__nvmlDevicePowerSmoothingUpdatePresetProfileParam"] = <_cyb_intptr_t>__nvmlDevicePowerSmoothingUpdatePresetProfileParam + + global __nvmlDevicePowerSmoothingSetState + data["__nvmlDevicePowerSmoothingSetState"] = <_cyb_intptr_t>__nvmlDevicePowerSmoothingSetState + + global __nvmlDeviceGetAddressingMode + data["__nvmlDeviceGetAddressingMode"] = <_cyb_intptr_t>__nvmlDeviceGetAddressingMode + + global __nvmlDeviceGetRepairStatus + data["__nvmlDeviceGetRepairStatus"] = <_cyb_intptr_t>__nvmlDeviceGetRepairStatus + + global __nvmlDeviceGetPowerMizerMode_v1 + data["__nvmlDeviceGetPowerMizerMode_v1"] = <_cyb_intptr_t>__nvmlDeviceGetPowerMizerMode_v1 + + global __nvmlDeviceSetPowerMizerMode_v1 + data["__nvmlDeviceSetPowerMizerMode_v1"] = <_cyb_intptr_t>__nvmlDeviceSetPowerMizerMode_v1 + + global __nvmlDeviceGetPdi + data["__nvmlDeviceGetPdi"] = <_cyb_intptr_t>__nvmlDeviceGetPdi + + global __nvmlDeviceSetHostname_v1 + data["__nvmlDeviceSetHostname_v1"] = <_cyb_intptr_t>__nvmlDeviceSetHostname_v1 + + global __nvmlDeviceGetHostname_v1 + data["__nvmlDeviceGetHostname_v1"] = <_cyb_intptr_t>__nvmlDeviceGetHostname_v1 + + global __nvmlDeviceGetNvLinkInfo + data["__nvmlDeviceGetNvLinkInfo"] = <_cyb_intptr_t>__nvmlDeviceGetNvLinkInfo + + global __nvmlDeviceReadWritePRM_v1 + data["__nvmlDeviceReadWritePRM_v1"] = <_cyb_intptr_t>__nvmlDeviceReadWritePRM_v1 + + global __nvmlDeviceGetGpuInstanceProfileInfoByIdV + data["__nvmlDeviceGetGpuInstanceProfileInfoByIdV"] = <_cyb_intptr_t>__nvmlDeviceGetGpuInstanceProfileInfoByIdV + + global __nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts + data["__nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts"] = <_cyb_intptr_t>__nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts + + global __nvmlDeviceGetUnrepairableMemoryFlag_v1 + data["__nvmlDeviceGetUnrepairableMemoryFlag_v1"] = <_cyb_intptr_t>__nvmlDeviceGetUnrepairableMemoryFlag_v1 + + global __nvmlDeviceReadPRMCounters_v1 + data["__nvmlDeviceReadPRMCounters_v1"] = <_cyb_intptr_t>__nvmlDeviceReadPRMCounters_v1 + + global __nvmlDeviceSetRusdSettings_v1 + data["__nvmlDeviceSetRusdSettings_v1"] = <_cyb_intptr_t>__nvmlDeviceSetRusdSettings_v1 + + global __nvmlDeviceVgpuForceGspUnload + data["__nvmlDeviceVgpuForceGspUnload"] = <_cyb_intptr_t>__nvmlDeviceVgpuForceGspUnload + + global __nvmlDeviceGetVgpuSchedulerState_v2 + data["__nvmlDeviceGetVgpuSchedulerState_v2"] = <_cyb_intptr_t>__nvmlDeviceGetVgpuSchedulerState_v2 + + global __nvmlGpuInstanceGetVgpuSchedulerState_v2 + data["__nvmlGpuInstanceGetVgpuSchedulerState_v2"] = <_cyb_intptr_t>__nvmlGpuInstanceGetVgpuSchedulerState_v2 + + global __nvmlDeviceGetVgpuSchedulerLog_v2 + data["__nvmlDeviceGetVgpuSchedulerLog_v2"] = <_cyb_intptr_t>__nvmlDeviceGetVgpuSchedulerLog_v2 + + global __nvmlGpuInstanceGetVgpuSchedulerLog_v2 + data["__nvmlGpuInstanceGetVgpuSchedulerLog_v2"] = <_cyb_intptr_t>__nvmlGpuInstanceGetVgpuSchedulerLog_v2 + + global __nvmlDeviceSetVgpuSchedulerState_v2 + data["__nvmlDeviceSetVgpuSchedulerState_v2"] = <_cyb_intptr_t>__nvmlDeviceSetVgpuSchedulerState_v2 + + global __nvmlGpuInstanceSetVgpuSchedulerState_v2 + data["__nvmlGpuInstanceSetVgpuSchedulerState_v2"] = <_cyb_intptr_t>__nvmlGpuInstanceSetVgpuSchedulerState_v2 + _cyb_func_ptrs = data + return data + + +cpdef _inspect_function_pointer(str name): + global _cyb_func_ptrs + if _cyb_func_ptrs is None: + _cyb_func_ptrs = _inspect_function_pointers() + return _cyb_func_ptrs[name] + + + + +cdef uintptr_t load_library() except* with gil: + return load_nvidia_dynamic_lib("nvml")._handle_uint + + +############################################################################### +# Wrapper functions +############################################################################### + +cdef nvmlReturn_t _nvmlInit_v2() except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlInit_v2 + _check_or_init_nvml() + if __nvmlInit_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlInit_v2 is not found") + return (__nvmlInit_v2)( + ) + + +cdef nvmlReturn_t _nvmlInitWithFlags(unsigned int flags) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlInitWithFlags + _check_or_init_nvml() + if __nvmlInitWithFlags == NULL: + with gil: + raise FunctionNotFoundError("function nvmlInitWithFlags is not found") + return (__nvmlInitWithFlags)( + flags) + + +cdef nvmlReturn_t _nvmlShutdown() except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlShutdown + _check_or_init_nvml() + if __nvmlShutdown == NULL: + with gil: + raise FunctionNotFoundError("function nvmlShutdown is not found") + return (__nvmlShutdown)( + ) + + +cdef const char* _nvmlErrorString(nvmlReturn_t result) except?NULL nogil: + global __nvmlErrorString + _check_or_init_nvml() + if __nvmlErrorString == NULL: + with gil: + raise FunctionNotFoundError("function nvmlErrorString is not found") + return (__nvmlErrorString)( + result) + + +cdef nvmlReturn_t _nvmlSystemGetDriverVersion(char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemGetDriverVersion + _check_or_init_nvml() + if __nvmlSystemGetDriverVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemGetDriverVersion is not found") + return (__nvmlSystemGetDriverVersion)( + version, length) + + +cdef nvmlReturn_t _nvmlSystemGetNVMLVersion(char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemGetNVMLVersion + _check_or_init_nvml() + if __nvmlSystemGetNVMLVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemGetNVMLVersion is not found") + return (__nvmlSystemGetNVMLVersion)( + version, length) + + +cdef nvmlReturn_t _nvmlSystemGetCudaDriverVersion(int* cudaDriverVersion) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemGetCudaDriverVersion + _check_or_init_nvml() + if __nvmlSystemGetCudaDriverVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemGetCudaDriverVersion is not found") + return (__nvmlSystemGetCudaDriverVersion)( + cudaDriverVersion) + + +cdef nvmlReturn_t _nvmlSystemGetCudaDriverVersion_v2(int* cudaDriverVersion) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemGetCudaDriverVersion_v2 + _check_or_init_nvml() + if __nvmlSystemGetCudaDriverVersion_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemGetCudaDriverVersion_v2 is not found") + return (__nvmlSystemGetCudaDriverVersion_v2)( + cudaDriverVersion) + + +cdef nvmlReturn_t _nvmlSystemGetProcessName(unsigned int pid, char* name, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemGetProcessName + _check_or_init_nvml() + if __nvmlSystemGetProcessName == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemGetProcessName is not found") + return (__nvmlSystemGetProcessName)( + pid, name, length) + + +cdef nvmlReturn_t _nvmlSystemGetHicVersion(unsigned int* hwbcCount, nvmlHwbcEntry_t* hwbcEntries) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemGetHicVersion + _check_or_init_nvml() + if __nvmlSystemGetHicVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemGetHicVersion is not found") + return (__nvmlSystemGetHicVersion)( + hwbcCount, hwbcEntries) + + +cdef nvmlReturn_t _nvmlSystemGetTopologyGpuSet(unsigned int cpuNumber, unsigned int* count, nvmlDevice_t* deviceArray) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemGetTopologyGpuSet + _check_or_init_nvml() + if __nvmlSystemGetTopologyGpuSet == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemGetTopologyGpuSet is not found") + return (__nvmlSystemGetTopologyGpuSet)( + cpuNumber, count, deviceArray) + + +cdef nvmlReturn_t _nvmlSystemGetDriverBranch(nvmlSystemDriverBranchInfo_t* branchInfo, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemGetDriverBranch + _check_or_init_nvml() + if __nvmlSystemGetDriverBranch == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemGetDriverBranch is not found") + return (__nvmlSystemGetDriverBranch)( + branchInfo, length) + + +cdef nvmlReturn_t _nvmlUnitGetCount(unsigned int* unitCount) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlUnitGetCount + _check_or_init_nvml() + if __nvmlUnitGetCount == NULL: + with gil: + raise FunctionNotFoundError("function nvmlUnitGetCount is not found") + return (__nvmlUnitGetCount)( + unitCount) + + +cdef nvmlReturn_t _nvmlUnitGetHandleByIndex(unsigned int index, nvmlUnit_t* unit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlUnitGetHandleByIndex + _check_or_init_nvml() + if __nvmlUnitGetHandleByIndex == NULL: + with gil: + raise FunctionNotFoundError("function nvmlUnitGetHandleByIndex is not found") + return (__nvmlUnitGetHandleByIndex)( + index, unit) + + +cdef nvmlReturn_t _nvmlUnitGetUnitInfo(nvmlUnit_t unit, nvmlUnitInfo_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlUnitGetUnitInfo + _check_or_init_nvml() + if __nvmlUnitGetUnitInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlUnitGetUnitInfo is not found") + return (__nvmlUnitGetUnitInfo)( + unit, info) + + +cdef nvmlReturn_t _nvmlUnitGetLedState(nvmlUnit_t unit, nvmlLedState_t* state) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlUnitGetLedState + _check_or_init_nvml() + if __nvmlUnitGetLedState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlUnitGetLedState is not found") + return (__nvmlUnitGetLedState)( + unit, state) + + +cdef nvmlReturn_t _nvmlUnitGetPsuInfo(nvmlUnit_t unit, nvmlPSUInfo_t* psu) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlUnitGetPsuInfo + _check_or_init_nvml() + if __nvmlUnitGetPsuInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlUnitGetPsuInfo is not found") + return (__nvmlUnitGetPsuInfo)( + unit, psu) + + +cdef nvmlReturn_t _nvmlUnitGetTemperature(nvmlUnit_t unit, unsigned int type, unsigned int* temp) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlUnitGetTemperature + _check_or_init_nvml() + if __nvmlUnitGetTemperature == NULL: + with gil: + raise FunctionNotFoundError("function nvmlUnitGetTemperature is not found") + return (__nvmlUnitGetTemperature)( + unit, type, temp) + + +cdef nvmlReturn_t _nvmlUnitGetFanSpeedInfo(nvmlUnit_t unit, nvmlUnitFanSpeeds_t* fanSpeeds) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlUnitGetFanSpeedInfo + _check_or_init_nvml() + if __nvmlUnitGetFanSpeedInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlUnitGetFanSpeedInfo is not found") + return (__nvmlUnitGetFanSpeedInfo)( + unit, fanSpeeds) + + +cdef nvmlReturn_t _nvmlUnitGetDevices(nvmlUnit_t unit, unsigned int* deviceCount, nvmlDevice_t* devices) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlUnitGetDevices + _check_or_init_nvml() + if __nvmlUnitGetDevices == NULL: + with gil: + raise FunctionNotFoundError("function nvmlUnitGetDevices is not found") + return (__nvmlUnitGetDevices)( + unit, deviceCount, devices) + + +cdef nvmlReturn_t _nvmlDeviceGetCount_v2(unsigned int* deviceCount) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetCount_v2 + _check_or_init_nvml() + if __nvmlDeviceGetCount_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetCount_v2 is not found") + return (__nvmlDeviceGetCount_v2)( + deviceCount) + + +cdef nvmlReturn_t _nvmlDeviceGetAttributes_v2(nvmlDevice_t device, nvmlDeviceAttributes_t* attributes) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetAttributes_v2 + _check_or_init_nvml() + if __nvmlDeviceGetAttributes_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetAttributes_v2 is not found") + return (__nvmlDeviceGetAttributes_v2)( + device, attributes) + + +cdef nvmlReturn_t _nvmlDeviceGetHandleByIndex_v2(unsigned int index, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetHandleByIndex_v2 + _check_or_init_nvml() + if __nvmlDeviceGetHandleByIndex_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetHandleByIndex_v2 is not found") + return (__nvmlDeviceGetHandleByIndex_v2)( + index, device) + + +cdef nvmlReturn_t _nvmlDeviceGetHandleBySerial(const char* serial, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetHandleBySerial + _check_or_init_nvml() + if __nvmlDeviceGetHandleBySerial == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetHandleBySerial is not found") + return (__nvmlDeviceGetHandleBySerial)( + serial, device) + + +cdef nvmlReturn_t _nvmlDeviceGetHandleByUUID(const char* uuid, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetHandleByUUID + _check_or_init_nvml() + if __nvmlDeviceGetHandleByUUID == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetHandleByUUID is not found") + return (__nvmlDeviceGetHandleByUUID)( + uuid, device) + + +cdef nvmlReturn_t _nvmlDeviceGetHandleByUUIDV(const nvmlUUID_t* uuid, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetHandleByUUIDV + _check_or_init_nvml() + if __nvmlDeviceGetHandleByUUIDV == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetHandleByUUIDV is not found") + return (__nvmlDeviceGetHandleByUUIDV)( + uuid, device) + + +cdef nvmlReturn_t _nvmlDeviceGetHandleByPciBusId_v2(const char* pciBusId, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetHandleByPciBusId_v2 + _check_or_init_nvml() + if __nvmlDeviceGetHandleByPciBusId_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetHandleByPciBusId_v2 is not found") + return (__nvmlDeviceGetHandleByPciBusId_v2)( + pciBusId, device) + + +cdef nvmlReturn_t _nvmlDeviceGetName(nvmlDevice_t device, char* name, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetName + _check_or_init_nvml() + if __nvmlDeviceGetName == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetName is not found") + return (__nvmlDeviceGetName)( + device, name, length) + + +cdef nvmlReturn_t _nvmlDeviceGetBrand(nvmlDevice_t device, nvmlBrandType_t* type) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetBrand + _check_or_init_nvml() + if __nvmlDeviceGetBrand == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetBrand is not found") + return (__nvmlDeviceGetBrand)( + device, type) + + +cdef nvmlReturn_t _nvmlDeviceGetIndex(nvmlDevice_t device, unsigned int* index) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetIndex + _check_or_init_nvml() + if __nvmlDeviceGetIndex == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetIndex is not found") + return (__nvmlDeviceGetIndex)( + device, index) + + +cdef nvmlReturn_t _nvmlDeviceGetSerial(nvmlDevice_t device, char* serial, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetSerial + _check_or_init_nvml() + if __nvmlDeviceGetSerial == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetSerial is not found") + return (__nvmlDeviceGetSerial)( + device, serial, length) + + +cdef nvmlReturn_t _nvmlDeviceGetModuleId(nvmlDevice_t device, unsigned int* moduleId) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetModuleId + _check_or_init_nvml() + if __nvmlDeviceGetModuleId == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetModuleId is not found") + return (__nvmlDeviceGetModuleId)( + device, moduleId) + + +cdef nvmlReturn_t _nvmlDeviceGetC2cModeInfoV(nvmlDevice_t device, nvmlC2cModeInfo_v1_t* c2cModeInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetC2cModeInfoV + _check_or_init_nvml() + if __nvmlDeviceGetC2cModeInfoV == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetC2cModeInfoV is not found") + return (__nvmlDeviceGetC2cModeInfoV)( + device, c2cModeInfo) + + +cdef nvmlReturn_t _nvmlDeviceGetMemoryAffinity(nvmlDevice_t device, unsigned int nodeSetSize, unsigned long* nodeSet, nvmlAffinityScope_t scope) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMemoryAffinity + _check_or_init_nvml() + if __nvmlDeviceGetMemoryAffinity == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMemoryAffinity is not found") + return (__nvmlDeviceGetMemoryAffinity)( + device, nodeSetSize, nodeSet, scope) + + +cdef nvmlReturn_t _nvmlDeviceGetCpuAffinityWithinScope(nvmlDevice_t device, unsigned int cpuSetSize, unsigned long* cpuSet, nvmlAffinityScope_t scope) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetCpuAffinityWithinScope + _check_or_init_nvml() + if __nvmlDeviceGetCpuAffinityWithinScope == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetCpuAffinityWithinScope is not found") + return (__nvmlDeviceGetCpuAffinityWithinScope)( + device, cpuSetSize, cpuSet, scope) + + +cdef nvmlReturn_t _nvmlDeviceGetCpuAffinity(nvmlDevice_t device, unsigned int cpuSetSize, unsigned long* cpuSet) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetCpuAffinity + _check_or_init_nvml() + if __nvmlDeviceGetCpuAffinity == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetCpuAffinity is not found") + return (__nvmlDeviceGetCpuAffinity)( + device, cpuSetSize, cpuSet) + + +cdef nvmlReturn_t _nvmlDeviceSetCpuAffinity(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetCpuAffinity + _check_or_init_nvml() + if __nvmlDeviceSetCpuAffinity == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetCpuAffinity is not found") + return (__nvmlDeviceSetCpuAffinity)( + device) + + +cdef nvmlReturn_t _nvmlDeviceClearCpuAffinity(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceClearCpuAffinity + _check_or_init_nvml() + if __nvmlDeviceClearCpuAffinity == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceClearCpuAffinity is not found") + return (__nvmlDeviceClearCpuAffinity)( + device) + + +cdef nvmlReturn_t _nvmlDeviceGetNumaNodeId(nvmlDevice_t device, unsigned int* node) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetNumaNodeId + _check_or_init_nvml() + if __nvmlDeviceGetNumaNodeId == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetNumaNodeId is not found") + return (__nvmlDeviceGetNumaNodeId)( + device, node) + + +cdef nvmlReturn_t _nvmlDeviceGetTopologyCommonAncestor(nvmlDevice_t device1, nvmlDevice_t device2, nvmlGpuTopologyLevel_t* pathInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetTopologyCommonAncestor + _check_or_init_nvml() + if __nvmlDeviceGetTopologyCommonAncestor == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetTopologyCommonAncestor is not found") + return (__nvmlDeviceGetTopologyCommonAncestor)( + device1, device2, pathInfo) + + +cdef nvmlReturn_t _nvmlDeviceGetTopologyNearestGpus(nvmlDevice_t device, nvmlGpuTopologyLevel_t level, unsigned int* count, nvmlDevice_t* deviceArray) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetTopologyNearestGpus + _check_or_init_nvml() + if __nvmlDeviceGetTopologyNearestGpus == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetTopologyNearestGpus is not found") + return (__nvmlDeviceGetTopologyNearestGpus)( + device, level, count, deviceArray) + + +cdef nvmlReturn_t _nvmlDeviceGetP2PStatus(nvmlDevice_t device1, nvmlDevice_t device2, nvmlGpuP2PCapsIndex_t p2pIndex, nvmlGpuP2PStatus_t* p2pStatus) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetP2PStatus + _check_or_init_nvml() + if __nvmlDeviceGetP2PStatus == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetP2PStatus is not found") + return (__nvmlDeviceGetP2PStatus)( + device1, device2, p2pIndex, p2pStatus) + + +cdef nvmlReturn_t _nvmlDeviceGetUUID(nvmlDevice_t device, char* uuid, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetUUID + _check_or_init_nvml() + if __nvmlDeviceGetUUID == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetUUID is not found") + return (__nvmlDeviceGetUUID)( + device, uuid, length) + + +cdef nvmlReturn_t _nvmlDeviceGetMinorNumber(nvmlDevice_t device, unsigned int* minorNumber) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMinorNumber + _check_or_init_nvml() + if __nvmlDeviceGetMinorNumber == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMinorNumber is not found") + return (__nvmlDeviceGetMinorNumber)( + device, minorNumber) + + +cdef nvmlReturn_t _nvmlDeviceGetBoardPartNumber(nvmlDevice_t device, char* partNumber, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetBoardPartNumber + _check_or_init_nvml() + if __nvmlDeviceGetBoardPartNumber == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetBoardPartNumber is not found") + return (__nvmlDeviceGetBoardPartNumber)( + device, partNumber, length) + + +cdef nvmlReturn_t _nvmlDeviceGetInforomVersion(nvmlDevice_t device, nvmlInforomObject_t object, char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetInforomVersion + _check_or_init_nvml() + if __nvmlDeviceGetInforomVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetInforomVersion is not found") + return (__nvmlDeviceGetInforomVersion)( + device, object, version, length) + + +cdef nvmlReturn_t _nvmlDeviceGetInforomImageVersion(nvmlDevice_t device, char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetInforomImageVersion + _check_or_init_nvml() + if __nvmlDeviceGetInforomImageVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetInforomImageVersion is not found") + return (__nvmlDeviceGetInforomImageVersion)( + device, version, length) + + +cdef nvmlReturn_t _nvmlDeviceGetInforomConfigurationChecksum(nvmlDevice_t device, unsigned int* checksum) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetInforomConfigurationChecksum + _check_or_init_nvml() + if __nvmlDeviceGetInforomConfigurationChecksum == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetInforomConfigurationChecksum is not found") + return (__nvmlDeviceGetInforomConfigurationChecksum)( + device, checksum) + + +cdef nvmlReturn_t _nvmlDeviceValidateInforom(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceValidateInforom + _check_or_init_nvml() + if __nvmlDeviceValidateInforom == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceValidateInforom is not found") + return (__nvmlDeviceValidateInforom)( + device) + + +cdef nvmlReturn_t _nvmlDeviceGetLastBBXFlushTime(nvmlDevice_t device, unsigned long long* timestamp, unsigned long* durationUs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetLastBBXFlushTime + _check_or_init_nvml() + if __nvmlDeviceGetLastBBXFlushTime == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetLastBBXFlushTime is not found") + return (__nvmlDeviceGetLastBBXFlushTime)( + device, timestamp, durationUs) + + +cdef nvmlReturn_t _nvmlDeviceGetDisplayMode(nvmlDevice_t device, nvmlEnableState_t* display) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetDisplayMode + _check_or_init_nvml() + if __nvmlDeviceGetDisplayMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetDisplayMode is not found") + return (__nvmlDeviceGetDisplayMode)( + device, display) + + +cdef nvmlReturn_t _nvmlDeviceGetDisplayActive(nvmlDevice_t device, nvmlEnableState_t* isActive) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetDisplayActive + _check_or_init_nvml() + if __nvmlDeviceGetDisplayActive == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetDisplayActive is not found") + return (__nvmlDeviceGetDisplayActive)( + device, isActive) + + +cdef nvmlReturn_t _nvmlDeviceGetPersistenceMode(nvmlDevice_t device, nvmlEnableState_t* mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPersistenceMode + _check_or_init_nvml() + if __nvmlDeviceGetPersistenceMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPersistenceMode is not found") + return (__nvmlDeviceGetPersistenceMode)( + device, mode) + + +cdef nvmlReturn_t _nvmlDeviceGetPciInfoExt(nvmlDevice_t device, nvmlPciInfoExt_t* pci) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPciInfoExt + _check_or_init_nvml() + if __nvmlDeviceGetPciInfoExt == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPciInfoExt is not found") + return (__nvmlDeviceGetPciInfoExt)( + device, pci) + + +cdef nvmlReturn_t _nvmlDeviceGetPciInfo_v3(nvmlDevice_t device, nvmlPciInfo_t* pci) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPciInfo_v3 + _check_or_init_nvml() + if __nvmlDeviceGetPciInfo_v3 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPciInfo_v3 is not found") + return (__nvmlDeviceGetPciInfo_v3)( + device, pci) + + +cdef nvmlReturn_t _nvmlDeviceGetMaxPcieLinkGeneration(nvmlDevice_t device, unsigned int* maxLinkGen) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMaxPcieLinkGeneration + _check_or_init_nvml() + if __nvmlDeviceGetMaxPcieLinkGeneration == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMaxPcieLinkGeneration is not found") + return (__nvmlDeviceGetMaxPcieLinkGeneration)( + device, maxLinkGen) + + +cdef nvmlReturn_t _nvmlDeviceGetGpuMaxPcieLinkGeneration(nvmlDevice_t device, unsigned int* maxLinkGenDevice) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGpuMaxPcieLinkGeneration + _check_or_init_nvml() + if __nvmlDeviceGetGpuMaxPcieLinkGeneration == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGpuMaxPcieLinkGeneration is not found") + return (__nvmlDeviceGetGpuMaxPcieLinkGeneration)( + device, maxLinkGenDevice) + + +cdef nvmlReturn_t _nvmlDeviceGetMaxPcieLinkWidth(nvmlDevice_t device, unsigned int* maxLinkWidth) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMaxPcieLinkWidth + _check_or_init_nvml() + if __nvmlDeviceGetMaxPcieLinkWidth == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMaxPcieLinkWidth is not found") + return (__nvmlDeviceGetMaxPcieLinkWidth)( + device, maxLinkWidth) + + +cdef nvmlReturn_t _nvmlDeviceGetCurrPcieLinkGeneration(nvmlDevice_t device, unsigned int* currLinkGen) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetCurrPcieLinkGeneration + _check_or_init_nvml() + if __nvmlDeviceGetCurrPcieLinkGeneration == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetCurrPcieLinkGeneration is not found") + return (__nvmlDeviceGetCurrPcieLinkGeneration)( + device, currLinkGen) + + +cdef nvmlReturn_t _nvmlDeviceGetCurrPcieLinkWidth(nvmlDevice_t device, unsigned int* currLinkWidth) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetCurrPcieLinkWidth + _check_or_init_nvml() + if __nvmlDeviceGetCurrPcieLinkWidth == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetCurrPcieLinkWidth is not found") + return (__nvmlDeviceGetCurrPcieLinkWidth)( + device, currLinkWidth) + + +cdef nvmlReturn_t _nvmlDeviceGetPcieThroughput(nvmlDevice_t device, nvmlPcieUtilCounter_t counter, unsigned int* value) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPcieThroughput + _check_or_init_nvml() + if __nvmlDeviceGetPcieThroughput == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPcieThroughput is not found") + return (__nvmlDeviceGetPcieThroughput)( + device, counter, value) + + +cdef nvmlReturn_t _nvmlDeviceGetPcieReplayCounter(nvmlDevice_t device, unsigned int* value) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPcieReplayCounter + _check_or_init_nvml() + if __nvmlDeviceGetPcieReplayCounter == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPcieReplayCounter is not found") + return (__nvmlDeviceGetPcieReplayCounter)( + device, value) + + +cdef nvmlReturn_t _nvmlDeviceGetClockInfo(nvmlDevice_t device, nvmlClockType_t type, unsigned int* clock) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetClockInfo + _check_or_init_nvml() + if __nvmlDeviceGetClockInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetClockInfo is not found") + return (__nvmlDeviceGetClockInfo)( + device, type, clock) + + +cdef nvmlReturn_t _nvmlDeviceGetMaxClockInfo(nvmlDevice_t device, nvmlClockType_t type, unsigned int* clock) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMaxClockInfo + _check_or_init_nvml() + if __nvmlDeviceGetMaxClockInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMaxClockInfo is not found") + return (__nvmlDeviceGetMaxClockInfo)( + device, type, clock) + + +cdef nvmlReturn_t _nvmlDeviceGetGpcClkVfOffset(nvmlDevice_t device, int* offset) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGpcClkVfOffset + _check_or_init_nvml() + if __nvmlDeviceGetGpcClkVfOffset == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGpcClkVfOffset is not found") + return (__nvmlDeviceGetGpcClkVfOffset)( + device, offset) + + +cdef nvmlReturn_t _nvmlDeviceGetClock(nvmlDevice_t device, nvmlClockType_t clockType, nvmlClockId_t clockId, unsigned int* clockMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetClock + _check_or_init_nvml() + if __nvmlDeviceGetClock == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetClock is not found") + return (__nvmlDeviceGetClock)( + device, clockType, clockId, clockMHz) + + +cdef nvmlReturn_t _nvmlDeviceGetMaxCustomerBoostClock(nvmlDevice_t device, nvmlClockType_t clockType, unsigned int* clockMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMaxCustomerBoostClock + _check_or_init_nvml() + if __nvmlDeviceGetMaxCustomerBoostClock == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMaxCustomerBoostClock is not found") + return (__nvmlDeviceGetMaxCustomerBoostClock)( + device, clockType, clockMHz) + + +cdef nvmlReturn_t _nvmlDeviceGetSupportedMemoryClocks(nvmlDevice_t device, unsigned int* count, unsigned int* clocksMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetSupportedMemoryClocks + _check_or_init_nvml() + if __nvmlDeviceGetSupportedMemoryClocks == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetSupportedMemoryClocks is not found") + return (__nvmlDeviceGetSupportedMemoryClocks)( + device, count, clocksMHz) + + +cdef nvmlReturn_t _nvmlDeviceGetSupportedGraphicsClocks(nvmlDevice_t device, unsigned int memoryClockMHz, unsigned int* count, unsigned int* clocksMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetSupportedGraphicsClocks + _check_or_init_nvml() + if __nvmlDeviceGetSupportedGraphicsClocks == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetSupportedGraphicsClocks is not found") + return (__nvmlDeviceGetSupportedGraphicsClocks)( + device, memoryClockMHz, count, clocksMHz) + + +cdef nvmlReturn_t _nvmlDeviceGetAutoBoostedClocksEnabled(nvmlDevice_t device, nvmlEnableState_t* isEnabled, nvmlEnableState_t* defaultIsEnabled) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetAutoBoostedClocksEnabled + _check_or_init_nvml() + if __nvmlDeviceGetAutoBoostedClocksEnabled == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetAutoBoostedClocksEnabled is not found") + return (__nvmlDeviceGetAutoBoostedClocksEnabled)( + device, isEnabled, defaultIsEnabled) + + +cdef nvmlReturn_t _nvmlDeviceGetFanSpeed(nvmlDevice_t device, unsigned int* speed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetFanSpeed + _check_or_init_nvml() + if __nvmlDeviceGetFanSpeed == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetFanSpeed is not found") + return (__nvmlDeviceGetFanSpeed)( + device, speed) + + +cdef nvmlReturn_t _nvmlDeviceGetFanSpeed_v2(nvmlDevice_t device, unsigned int fan, unsigned int* speed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetFanSpeed_v2 + _check_or_init_nvml() + if __nvmlDeviceGetFanSpeed_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetFanSpeed_v2 is not found") + return (__nvmlDeviceGetFanSpeed_v2)( + device, fan, speed) + + +cdef nvmlReturn_t _nvmlDeviceGetFanSpeedRPM(nvmlDevice_t device, nvmlFanSpeedInfo_t* fanSpeed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetFanSpeedRPM + _check_or_init_nvml() + if __nvmlDeviceGetFanSpeedRPM == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetFanSpeedRPM is not found") + return (__nvmlDeviceGetFanSpeedRPM)( + device, fanSpeed) + + +cdef nvmlReturn_t _nvmlDeviceGetTargetFanSpeed(nvmlDevice_t device, unsigned int fan, unsigned int* targetSpeed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetTargetFanSpeed + _check_or_init_nvml() + if __nvmlDeviceGetTargetFanSpeed == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetTargetFanSpeed is not found") + return (__nvmlDeviceGetTargetFanSpeed)( + device, fan, targetSpeed) + + +cdef nvmlReturn_t _nvmlDeviceGetMinMaxFanSpeed(nvmlDevice_t device, unsigned int* minSpeed, unsigned int* maxSpeed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMinMaxFanSpeed + _check_or_init_nvml() + if __nvmlDeviceGetMinMaxFanSpeed == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMinMaxFanSpeed is not found") + return (__nvmlDeviceGetMinMaxFanSpeed)( + device, minSpeed, maxSpeed) + + +cdef nvmlReturn_t _nvmlDeviceGetFanControlPolicy_v2(nvmlDevice_t device, unsigned int fan, nvmlFanControlPolicy_t* policy) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetFanControlPolicy_v2 + _check_or_init_nvml() + if __nvmlDeviceGetFanControlPolicy_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetFanControlPolicy_v2 is not found") + return (__nvmlDeviceGetFanControlPolicy_v2)( + device, fan, policy) + + +cdef nvmlReturn_t _nvmlDeviceGetNumFans(nvmlDevice_t device, unsigned int* numFans) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetNumFans + _check_or_init_nvml() + if __nvmlDeviceGetNumFans == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetNumFans is not found") + return (__nvmlDeviceGetNumFans)( + device, numFans) + + +cdef nvmlReturn_t _nvmlDeviceGetCoolerInfo(nvmlDevice_t device, nvmlCoolerInfo_t* coolerInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetCoolerInfo + _check_or_init_nvml() + if __nvmlDeviceGetCoolerInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetCoolerInfo is not found") + return (__nvmlDeviceGetCoolerInfo)( + device, coolerInfo) + + +cdef nvmlReturn_t _nvmlDeviceGetTemperatureV(nvmlDevice_t device, nvmlTemperature_t* temperature) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetTemperatureV + _check_or_init_nvml() + if __nvmlDeviceGetTemperatureV == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetTemperatureV is not found") + return (__nvmlDeviceGetTemperatureV)( + device, temperature) + + +cdef nvmlReturn_t _nvmlDeviceGetTemperatureThreshold(nvmlDevice_t device, nvmlTemperatureThresholds_t thresholdType, unsigned int* temp) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetTemperatureThreshold + _check_or_init_nvml() + if __nvmlDeviceGetTemperatureThreshold == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetTemperatureThreshold is not found") + return (__nvmlDeviceGetTemperatureThreshold)( + device, thresholdType, temp) + + +cdef nvmlReturn_t _nvmlDeviceGetMarginTemperature(nvmlDevice_t device, nvmlMarginTemperature_t* marginTempInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMarginTemperature + _check_or_init_nvml() + if __nvmlDeviceGetMarginTemperature == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMarginTemperature is not found") + return (__nvmlDeviceGetMarginTemperature)( + device, marginTempInfo) + + +cdef nvmlReturn_t _nvmlDeviceGetThermalSettings(nvmlDevice_t device, unsigned int sensorIndex, nvmlGpuThermalSettings_t* pThermalSettings) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetThermalSettings + _check_or_init_nvml() + if __nvmlDeviceGetThermalSettings == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetThermalSettings is not found") + return (__nvmlDeviceGetThermalSettings)( + device, sensorIndex, pThermalSettings) + + +cdef nvmlReturn_t _nvmlDeviceGetPerformanceState(nvmlDevice_t device, nvmlPstates_t* pState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPerformanceState + _check_or_init_nvml() + if __nvmlDeviceGetPerformanceState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPerformanceState is not found") + return (__nvmlDeviceGetPerformanceState)( + device, pState) + + +cdef nvmlReturn_t _nvmlDeviceGetCurrentClocksEventReasons(nvmlDevice_t device, unsigned long long* clocksEventReasons) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetCurrentClocksEventReasons + _check_or_init_nvml() + if __nvmlDeviceGetCurrentClocksEventReasons == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetCurrentClocksEventReasons is not found") + return (__nvmlDeviceGetCurrentClocksEventReasons)( + device, clocksEventReasons) + + +cdef nvmlReturn_t _nvmlDeviceGetSupportedClocksEventReasons(nvmlDevice_t device, unsigned long long* supportedClocksEventReasons) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetSupportedClocksEventReasons + _check_or_init_nvml() + if __nvmlDeviceGetSupportedClocksEventReasons == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetSupportedClocksEventReasons is not found") + return (__nvmlDeviceGetSupportedClocksEventReasons)( + device, supportedClocksEventReasons) + + +cdef nvmlReturn_t _nvmlDeviceGetPowerState(nvmlDevice_t device, nvmlPstates_t* pState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPowerState + _check_or_init_nvml() + if __nvmlDeviceGetPowerState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPowerState is not found") + return (__nvmlDeviceGetPowerState)( + device, pState) + + +cdef nvmlReturn_t _nvmlDeviceGetDynamicPstatesInfo(nvmlDevice_t device, nvmlGpuDynamicPstatesInfo_t* pDynamicPstatesInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetDynamicPstatesInfo + _check_or_init_nvml() + if __nvmlDeviceGetDynamicPstatesInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetDynamicPstatesInfo is not found") + return (__nvmlDeviceGetDynamicPstatesInfo)( + device, pDynamicPstatesInfo) + + +cdef nvmlReturn_t _nvmlDeviceGetMemClkVfOffset(nvmlDevice_t device, int* offset) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMemClkVfOffset + _check_or_init_nvml() + if __nvmlDeviceGetMemClkVfOffset == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMemClkVfOffset is not found") + return (__nvmlDeviceGetMemClkVfOffset)( + device, offset) + + +cdef nvmlReturn_t _nvmlDeviceGetMinMaxClockOfPState(nvmlDevice_t device, nvmlClockType_t type, nvmlPstates_t pstate, unsigned int* minClockMHz, unsigned int* maxClockMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMinMaxClockOfPState + _check_or_init_nvml() + if __nvmlDeviceGetMinMaxClockOfPState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMinMaxClockOfPState is not found") + return (__nvmlDeviceGetMinMaxClockOfPState)( + device, type, pstate, minClockMHz, maxClockMHz) + + +cdef nvmlReturn_t _nvmlDeviceGetSupportedPerformanceStates(nvmlDevice_t device, nvmlPstates_t* pstates, unsigned int size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetSupportedPerformanceStates + _check_or_init_nvml() + if __nvmlDeviceGetSupportedPerformanceStates == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetSupportedPerformanceStates is not found") + return (__nvmlDeviceGetSupportedPerformanceStates)( + device, pstates, size) + + +cdef nvmlReturn_t _nvmlDeviceGetGpcClkMinMaxVfOffset(nvmlDevice_t device, int* minOffset, int* maxOffset) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGpcClkMinMaxVfOffset + _check_or_init_nvml() + if __nvmlDeviceGetGpcClkMinMaxVfOffset == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGpcClkMinMaxVfOffset is not found") + return (__nvmlDeviceGetGpcClkMinMaxVfOffset)( + device, minOffset, maxOffset) + + +cdef nvmlReturn_t _nvmlDeviceGetMemClkMinMaxVfOffset(nvmlDevice_t device, int* minOffset, int* maxOffset) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMemClkMinMaxVfOffset + _check_or_init_nvml() + if __nvmlDeviceGetMemClkMinMaxVfOffset == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMemClkMinMaxVfOffset is not found") + return (__nvmlDeviceGetMemClkMinMaxVfOffset)( + device, minOffset, maxOffset) + + +cdef nvmlReturn_t _nvmlDeviceGetClockOffsets(nvmlDevice_t device, nvmlClockOffset_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetClockOffsets + _check_or_init_nvml() + if __nvmlDeviceGetClockOffsets == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetClockOffsets is not found") + return (__nvmlDeviceGetClockOffsets)( + device, info) + + +cdef nvmlReturn_t _nvmlDeviceSetClockOffsets(nvmlDevice_t device, nvmlClockOffset_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetClockOffsets + _check_or_init_nvml() + if __nvmlDeviceSetClockOffsets == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetClockOffsets is not found") + return (__nvmlDeviceSetClockOffsets)( + device, info) + + +cdef nvmlReturn_t _nvmlDeviceGetPerformanceModes(nvmlDevice_t device, nvmlDevicePerfModes_t* perfModes) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPerformanceModes + _check_or_init_nvml() + if __nvmlDeviceGetPerformanceModes == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPerformanceModes is not found") + return (__nvmlDeviceGetPerformanceModes)( + device, perfModes) + + +cdef nvmlReturn_t _nvmlDeviceGetCurrentClockFreqs(nvmlDevice_t device, nvmlDeviceCurrentClockFreqs_t* currentClockFreqs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetCurrentClockFreqs + _check_or_init_nvml() + if __nvmlDeviceGetCurrentClockFreqs == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetCurrentClockFreqs is not found") + return (__nvmlDeviceGetCurrentClockFreqs)( + device, currentClockFreqs) + + +cdef nvmlReturn_t _nvmlDeviceGetPowerManagementLimit(nvmlDevice_t device, unsigned int* limit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPowerManagementLimit + _check_or_init_nvml() + if __nvmlDeviceGetPowerManagementLimit == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPowerManagementLimit is not found") + return (__nvmlDeviceGetPowerManagementLimit)( + device, limit) + + +cdef nvmlReturn_t _nvmlDeviceGetPowerManagementLimitConstraints(nvmlDevice_t device, unsigned int* minLimit, unsigned int* maxLimit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPowerManagementLimitConstraints + _check_or_init_nvml() + if __nvmlDeviceGetPowerManagementLimitConstraints == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPowerManagementLimitConstraints is not found") + return (__nvmlDeviceGetPowerManagementLimitConstraints)( + device, minLimit, maxLimit) + + +cdef nvmlReturn_t _nvmlDeviceGetPowerManagementDefaultLimit(nvmlDevice_t device, unsigned int* defaultLimit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPowerManagementDefaultLimit + _check_or_init_nvml() + if __nvmlDeviceGetPowerManagementDefaultLimit == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPowerManagementDefaultLimit is not found") + return (__nvmlDeviceGetPowerManagementDefaultLimit)( + device, defaultLimit) + + +cdef nvmlReturn_t _nvmlDeviceGetPowerUsage(nvmlDevice_t device, unsigned int* power) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPowerUsage + _check_or_init_nvml() + if __nvmlDeviceGetPowerUsage == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPowerUsage is not found") + return (__nvmlDeviceGetPowerUsage)( + device, power) + + +cdef nvmlReturn_t _nvmlDeviceGetTotalEnergyConsumption(nvmlDevice_t device, unsigned long long* energy) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetTotalEnergyConsumption + _check_or_init_nvml() + if __nvmlDeviceGetTotalEnergyConsumption == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetTotalEnergyConsumption is not found") + return (__nvmlDeviceGetTotalEnergyConsumption)( + device, energy) + + +cdef nvmlReturn_t _nvmlDeviceGetEnforcedPowerLimit(nvmlDevice_t device, unsigned int* limit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetEnforcedPowerLimit + _check_or_init_nvml() + if __nvmlDeviceGetEnforcedPowerLimit == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetEnforcedPowerLimit is not found") + return (__nvmlDeviceGetEnforcedPowerLimit)( + device, limit) + + +cdef nvmlReturn_t _nvmlDeviceGetGpuOperationMode(nvmlDevice_t device, nvmlGpuOperationMode_t* current, nvmlGpuOperationMode_t* pending) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGpuOperationMode + _check_or_init_nvml() + if __nvmlDeviceGetGpuOperationMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGpuOperationMode is not found") + return (__nvmlDeviceGetGpuOperationMode)( + device, current, pending) + + +cdef nvmlReturn_t _nvmlDeviceGetMemoryInfo_v2(nvmlDevice_t device, nvmlMemory_v2_t* memory) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMemoryInfo_v2 + _check_or_init_nvml() + if __nvmlDeviceGetMemoryInfo_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMemoryInfo_v2 is not found") + return (__nvmlDeviceGetMemoryInfo_v2)( + device, memory) + + +cdef nvmlReturn_t _nvmlDeviceGetComputeMode(nvmlDevice_t device, nvmlComputeMode_t* mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetComputeMode + _check_or_init_nvml() + if __nvmlDeviceGetComputeMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetComputeMode is not found") + return (__nvmlDeviceGetComputeMode)( + device, mode) + + +cdef nvmlReturn_t _nvmlDeviceGetCudaComputeCapability(nvmlDevice_t device, int* major, int* minor) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetCudaComputeCapability + _check_or_init_nvml() + if __nvmlDeviceGetCudaComputeCapability == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetCudaComputeCapability is not found") + return (__nvmlDeviceGetCudaComputeCapability)( + device, major, minor) + + +cdef nvmlReturn_t _nvmlDeviceGetDramEncryptionMode(nvmlDevice_t device, nvmlDramEncryptionInfo_t* current, nvmlDramEncryptionInfo_t* pending) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetDramEncryptionMode + _check_or_init_nvml() + if __nvmlDeviceGetDramEncryptionMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetDramEncryptionMode is not found") + return (__nvmlDeviceGetDramEncryptionMode)( + device, current, pending) + + +cdef nvmlReturn_t _nvmlDeviceSetDramEncryptionMode(nvmlDevice_t device, const nvmlDramEncryptionInfo_t* dramEncryption) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetDramEncryptionMode + _check_or_init_nvml() + if __nvmlDeviceSetDramEncryptionMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetDramEncryptionMode is not found") + return (__nvmlDeviceSetDramEncryptionMode)( + device, dramEncryption) + + +cdef nvmlReturn_t _nvmlDeviceGetEccMode(nvmlDevice_t device, nvmlEnableState_t* current, nvmlEnableState_t* pending) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetEccMode + _check_or_init_nvml() + if __nvmlDeviceGetEccMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetEccMode is not found") + return (__nvmlDeviceGetEccMode)( + device, current, pending) + + +cdef nvmlReturn_t _nvmlDeviceGetDefaultEccMode(nvmlDevice_t device, nvmlEnableState_t* defaultMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetDefaultEccMode + _check_or_init_nvml() + if __nvmlDeviceGetDefaultEccMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetDefaultEccMode is not found") + return (__nvmlDeviceGetDefaultEccMode)( + device, defaultMode) + + +cdef nvmlReturn_t _nvmlDeviceGetBoardId(nvmlDevice_t device, unsigned int* boardId) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetBoardId + _check_or_init_nvml() + if __nvmlDeviceGetBoardId == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetBoardId is not found") + return (__nvmlDeviceGetBoardId)( + device, boardId) + + +cdef nvmlReturn_t _nvmlDeviceGetMultiGpuBoard(nvmlDevice_t device, unsigned int* multiGpuBool) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMultiGpuBoard + _check_or_init_nvml() + if __nvmlDeviceGetMultiGpuBoard == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMultiGpuBoard is not found") + return (__nvmlDeviceGetMultiGpuBoard)( + device, multiGpuBool) + + +cdef nvmlReturn_t _nvmlDeviceGetTotalEccErrors(nvmlDevice_t device, nvmlMemoryErrorType_t errorType, nvmlEccCounterType_t counterType, unsigned long long* eccCounts) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetTotalEccErrors + _check_or_init_nvml() + if __nvmlDeviceGetTotalEccErrors == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetTotalEccErrors is not found") + return (__nvmlDeviceGetTotalEccErrors)( + device, errorType, counterType, eccCounts) + + +cdef nvmlReturn_t _nvmlDeviceGetMemoryErrorCounter(nvmlDevice_t device, nvmlMemoryErrorType_t errorType, nvmlEccCounterType_t counterType, nvmlMemoryLocation_t locationType, unsigned long long* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMemoryErrorCounter + _check_or_init_nvml() + if __nvmlDeviceGetMemoryErrorCounter == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMemoryErrorCounter is not found") + return (__nvmlDeviceGetMemoryErrorCounter)( + device, errorType, counterType, locationType, count) + + +cdef nvmlReturn_t _nvmlDeviceGetUtilizationRates(nvmlDevice_t device, nvmlUtilization_t* utilization) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetUtilizationRates + _check_or_init_nvml() + if __nvmlDeviceGetUtilizationRates == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetUtilizationRates is not found") + return (__nvmlDeviceGetUtilizationRates)( + device, utilization) + + +cdef nvmlReturn_t _nvmlDeviceGetEncoderUtilization(nvmlDevice_t device, unsigned int* utilization, unsigned int* samplingPeriodUs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetEncoderUtilization + _check_or_init_nvml() + if __nvmlDeviceGetEncoderUtilization == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetEncoderUtilization is not found") + return (__nvmlDeviceGetEncoderUtilization)( + device, utilization, samplingPeriodUs) + + +cdef nvmlReturn_t _nvmlDeviceGetEncoderCapacity(nvmlDevice_t device, nvmlEncoderType_t encoderQueryType, unsigned int* encoderCapacity) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetEncoderCapacity + _check_or_init_nvml() + if __nvmlDeviceGetEncoderCapacity == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetEncoderCapacity is not found") + return (__nvmlDeviceGetEncoderCapacity)( + device, encoderQueryType, encoderCapacity) + + +cdef nvmlReturn_t _nvmlDeviceGetEncoderStats(nvmlDevice_t device, unsigned int* sessionCount, unsigned int* averageFps, unsigned int* averageLatency) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetEncoderStats + _check_or_init_nvml() + if __nvmlDeviceGetEncoderStats == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetEncoderStats is not found") + return (__nvmlDeviceGetEncoderStats)( + device, sessionCount, averageFps, averageLatency) + + +cdef nvmlReturn_t _nvmlDeviceGetEncoderSessions(nvmlDevice_t device, unsigned int* sessionCount, nvmlEncoderSessionInfo_t* sessionInfos) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetEncoderSessions + _check_or_init_nvml() + if __nvmlDeviceGetEncoderSessions == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetEncoderSessions is not found") + return (__nvmlDeviceGetEncoderSessions)( + device, sessionCount, sessionInfos) + + +cdef nvmlReturn_t _nvmlDeviceGetDecoderUtilization(nvmlDevice_t device, unsigned int* utilization, unsigned int* samplingPeriodUs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetDecoderUtilization + _check_or_init_nvml() + if __nvmlDeviceGetDecoderUtilization == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetDecoderUtilization is not found") + return (__nvmlDeviceGetDecoderUtilization)( + device, utilization, samplingPeriodUs) + + +cdef nvmlReturn_t _nvmlDeviceGetJpgUtilization(nvmlDevice_t device, unsigned int* utilization, unsigned int* samplingPeriodUs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetJpgUtilization + _check_or_init_nvml() + if __nvmlDeviceGetJpgUtilization == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetJpgUtilization is not found") + return (__nvmlDeviceGetJpgUtilization)( + device, utilization, samplingPeriodUs) + + +cdef nvmlReturn_t _nvmlDeviceGetOfaUtilization(nvmlDevice_t device, unsigned int* utilization, unsigned int* samplingPeriodUs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetOfaUtilization + _check_or_init_nvml() + if __nvmlDeviceGetOfaUtilization == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetOfaUtilization is not found") + return (__nvmlDeviceGetOfaUtilization)( + device, utilization, samplingPeriodUs) + + +cdef nvmlReturn_t _nvmlDeviceGetFBCStats(nvmlDevice_t device, nvmlFBCStats_t* fbcStats) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetFBCStats + _check_or_init_nvml() + if __nvmlDeviceGetFBCStats == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetFBCStats is not found") + return (__nvmlDeviceGetFBCStats)( + device, fbcStats) + + +cdef nvmlReturn_t _nvmlDeviceGetFBCSessions(nvmlDevice_t device, unsigned int* sessionCount, nvmlFBCSessionInfo_t* sessionInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetFBCSessions + _check_or_init_nvml() + if __nvmlDeviceGetFBCSessions == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetFBCSessions is not found") + return (__nvmlDeviceGetFBCSessions)( + device, sessionCount, sessionInfo) + + +cdef nvmlReturn_t _nvmlDeviceGetDriverModel_v2(nvmlDevice_t device, nvmlDriverModel_t* current, nvmlDriverModel_t* pending) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetDriverModel_v2 + _check_or_init_nvml() + if __nvmlDeviceGetDriverModel_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetDriverModel_v2 is not found") + return (__nvmlDeviceGetDriverModel_v2)( + device, current, pending) + + +cdef nvmlReturn_t _nvmlDeviceGetVbiosVersion(nvmlDevice_t device, char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVbiosVersion + _check_or_init_nvml() + if __nvmlDeviceGetVbiosVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVbiosVersion is not found") + return (__nvmlDeviceGetVbiosVersion)( + device, version, length) + + +cdef nvmlReturn_t _nvmlDeviceGetBridgeChipInfo(nvmlDevice_t device, nvmlBridgeChipHierarchy_t* bridgeHierarchy) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetBridgeChipInfo + _check_or_init_nvml() + if __nvmlDeviceGetBridgeChipInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetBridgeChipInfo is not found") + return (__nvmlDeviceGetBridgeChipInfo)( + device, bridgeHierarchy) + + +cdef nvmlReturn_t _nvmlDeviceGetComputeRunningProcesses_v3(nvmlDevice_t device, unsigned int* infoCount, nvmlProcessInfo_t* infos) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetComputeRunningProcesses_v3 + _check_or_init_nvml() + if __nvmlDeviceGetComputeRunningProcesses_v3 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetComputeRunningProcesses_v3 is not found") + return (__nvmlDeviceGetComputeRunningProcesses_v3)( + device, infoCount, infos) + + +cdef nvmlReturn_t _nvmlDeviceGetGraphicsRunningProcesses_v3(nvmlDevice_t device, unsigned int* infoCount, nvmlProcessInfo_t* infos) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGraphicsRunningProcesses_v3 + _check_or_init_nvml() + if __nvmlDeviceGetGraphicsRunningProcesses_v3 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGraphicsRunningProcesses_v3 is not found") + return (__nvmlDeviceGetGraphicsRunningProcesses_v3)( + device, infoCount, infos) + + +cdef nvmlReturn_t _nvmlDeviceGetMPSComputeRunningProcesses_v3(nvmlDevice_t device, unsigned int* infoCount, nvmlProcessInfo_t* infos) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMPSComputeRunningProcesses_v3 + _check_or_init_nvml() + if __nvmlDeviceGetMPSComputeRunningProcesses_v3 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMPSComputeRunningProcesses_v3 is not found") + return (__nvmlDeviceGetMPSComputeRunningProcesses_v3)( + device, infoCount, infos) + + +cdef nvmlReturn_t _nvmlDeviceGetRunningProcessDetailList(nvmlDevice_t device, nvmlProcessDetailList_t* plist) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetRunningProcessDetailList + _check_or_init_nvml() + if __nvmlDeviceGetRunningProcessDetailList == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetRunningProcessDetailList is not found") + return (__nvmlDeviceGetRunningProcessDetailList)( + device, plist) + + +cdef nvmlReturn_t _nvmlDeviceOnSameBoard(nvmlDevice_t device1, nvmlDevice_t device2, int* onSameBoard) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceOnSameBoard + _check_or_init_nvml() + if __nvmlDeviceOnSameBoard == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceOnSameBoard is not found") + return (__nvmlDeviceOnSameBoard)( + device1, device2, onSameBoard) + + +cdef nvmlReturn_t _nvmlDeviceGetAPIRestriction(nvmlDevice_t device, nvmlRestrictedAPI_t apiType, nvmlEnableState_t* isRestricted) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetAPIRestriction + _check_or_init_nvml() + if __nvmlDeviceGetAPIRestriction == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetAPIRestriction is not found") + return (__nvmlDeviceGetAPIRestriction)( + device, apiType, isRestricted) + + +cdef nvmlReturn_t _nvmlDeviceGetSamples(nvmlDevice_t device, nvmlSamplingType_t type, unsigned long long lastSeenTimeStamp, nvmlValueType_t* sampleValType, unsigned int* sampleCount, nvmlSample_t* samples) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetSamples + _check_or_init_nvml() + if __nvmlDeviceGetSamples == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetSamples is not found") + return (__nvmlDeviceGetSamples)( + device, type, lastSeenTimeStamp, sampleValType, sampleCount, samples) + + +cdef nvmlReturn_t _nvmlDeviceGetBAR1MemoryInfo(nvmlDevice_t device, nvmlBAR1Memory_t* bar1Memory) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetBAR1MemoryInfo + _check_or_init_nvml() + if __nvmlDeviceGetBAR1MemoryInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetBAR1MemoryInfo is not found") + return (__nvmlDeviceGetBAR1MemoryInfo)( + device, bar1Memory) + + +cdef nvmlReturn_t _nvmlDeviceGetIrqNum(nvmlDevice_t device, unsigned int* irqNum) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetIrqNum + _check_or_init_nvml() + if __nvmlDeviceGetIrqNum == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetIrqNum is not found") + return (__nvmlDeviceGetIrqNum)( + device, irqNum) + + +cdef nvmlReturn_t _nvmlDeviceGetNumGpuCores(nvmlDevice_t device, unsigned int* numCores) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetNumGpuCores + _check_or_init_nvml() + if __nvmlDeviceGetNumGpuCores == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetNumGpuCores is not found") + return (__nvmlDeviceGetNumGpuCores)( + device, numCores) + + +cdef nvmlReturn_t _nvmlDeviceGetPowerSource(nvmlDevice_t device, nvmlPowerSource_t* powerSource) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPowerSource + _check_or_init_nvml() + if __nvmlDeviceGetPowerSource == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPowerSource is not found") + return (__nvmlDeviceGetPowerSource)( + device, powerSource) + + +cdef nvmlReturn_t _nvmlDeviceGetMemoryBusWidth(nvmlDevice_t device, unsigned int* busWidth) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMemoryBusWidth + _check_or_init_nvml() + if __nvmlDeviceGetMemoryBusWidth == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMemoryBusWidth is not found") + return (__nvmlDeviceGetMemoryBusWidth)( + device, busWidth) + + +cdef nvmlReturn_t _nvmlDeviceGetPcieLinkMaxSpeed(nvmlDevice_t device, unsigned int* maxSpeed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPcieLinkMaxSpeed + _check_or_init_nvml() + if __nvmlDeviceGetPcieLinkMaxSpeed == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPcieLinkMaxSpeed is not found") + return (__nvmlDeviceGetPcieLinkMaxSpeed)( + device, maxSpeed) + + +cdef nvmlReturn_t _nvmlDeviceGetPcieSpeed(nvmlDevice_t device, unsigned int* pcieSpeed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPcieSpeed + _check_or_init_nvml() + if __nvmlDeviceGetPcieSpeed == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPcieSpeed is not found") + return (__nvmlDeviceGetPcieSpeed)( + device, pcieSpeed) + + +cdef nvmlReturn_t _nvmlDeviceGetAdaptiveClockInfoStatus(nvmlDevice_t device, unsigned int* adaptiveClockStatus) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetAdaptiveClockInfoStatus + _check_or_init_nvml() + if __nvmlDeviceGetAdaptiveClockInfoStatus == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetAdaptiveClockInfoStatus is not found") + return (__nvmlDeviceGetAdaptiveClockInfoStatus)( + device, adaptiveClockStatus) + + +cdef nvmlReturn_t _nvmlDeviceGetBusType(nvmlDevice_t device, nvmlBusType_t* type) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetBusType + _check_or_init_nvml() + if __nvmlDeviceGetBusType == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetBusType is not found") + return (__nvmlDeviceGetBusType)( + device, type) + + +cdef nvmlReturn_t _nvmlDeviceGetGpuFabricInfoV(nvmlDevice_t device, nvmlGpuFabricInfoV_t* gpuFabricInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGpuFabricInfoV + _check_or_init_nvml() + if __nvmlDeviceGetGpuFabricInfoV == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGpuFabricInfoV is not found") + return (__nvmlDeviceGetGpuFabricInfoV)( + device, gpuFabricInfo) + + +cdef nvmlReturn_t _nvmlSystemGetConfComputeCapabilities(nvmlConfComputeSystemCaps_t* capabilities) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemGetConfComputeCapabilities + _check_or_init_nvml() + if __nvmlSystemGetConfComputeCapabilities == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemGetConfComputeCapabilities is not found") + return (__nvmlSystemGetConfComputeCapabilities)( + capabilities) + + +cdef nvmlReturn_t _nvmlSystemGetConfComputeState(nvmlConfComputeSystemState_t* state) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemGetConfComputeState + _check_or_init_nvml() + if __nvmlSystemGetConfComputeState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemGetConfComputeState is not found") + return (__nvmlSystemGetConfComputeState)( + state) + + +cdef nvmlReturn_t _nvmlDeviceGetConfComputeMemSizeInfo(nvmlDevice_t device, nvmlConfComputeMemSizeInfo_t* memInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetConfComputeMemSizeInfo + _check_or_init_nvml() + if __nvmlDeviceGetConfComputeMemSizeInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetConfComputeMemSizeInfo is not found") + return (__nvmlDeviceGetConfComputeMemSizeInfo)( + device, memInfo) + + +cdef nvmlReturn_t _nvmlSystemGetConfComputeGpusReadyState(unsigned int* isAcceptingWork) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemGetConfComputeGpusReadyState + _check_or_init_nvml() + if __nvmlSystemGetConfComputeGpusReadyState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemGetConfComputeGpusReadyState is not found") + return (__nvmlSystemGetConfComputeGpusReadyState)( + isAcceptingWork) + + +cdef nvmlReturn_t _nvmlDeviceGetConfComputeProtectedMemoryUsage(nvmlDevice_t device, nvmlMemory_t* memory) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetConfComputeProtectedMemoryUsage + _check_or_init_nvml() + if __nvmlDeviceGetConfComputeProtectedMemoryUsage == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetConfComputeProtectedMemoryUsage is not found") + return (__nvmlDeviceGetConfComputeProtectedMemoryUsage)( + device, memory) + + +cdef nvmlReturn_t _nvmlDeviceGetConfComputeGpuCertificate(nvmlDevice_t device, nvmlConfComputeGpuCertificate_t* gpuCert) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetConfComputeGpuCertificate + _check_or_init_nvml() + if __nvmlDeviceGetConfComputeGpuCertificate == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetConfComputeGpuCertificate is not found") + return (__nvmlDeviceGetConfComputeGpuCertificate)( + device, gpuCert) + + +cdef nvmlReturn_t _nvmlDeviceGetConfComputeGpuAttestationReport(nvmlDevice_t device, nvmlConfComputeGpuAttestationReport_t* gpuAtstReport) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetConfComputeGpuAttestationReport + _check_or_init_nvml() + if __nvmlDeviceGetConfComputeGpuAttestationReport == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetConfComputeGpuAttestationReport is not found") + return (__nvmlDeviceGetConfComputeGpuAttestationReport)( + device, gpuAtstReport) + + +cdef nvmlReturn_t _nvmlSystemGetConfComputeKeyRotationThresholdInfo(nvmlConfComputeGetKeyRotationThresholdInfo_t* pKeyRotationThrInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemGetConfComputeKeyRotationThresholdInfo + _check_or_init_nvml() + if __nvmlSystemGetConfComputeKeyRotationThresholdInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemGetConfComputeKeyRotationThresholdInfo is not found") + return (__nvmlSystemGetConfComputeKeyRotationThresholdInfo)( + pKeyRotationThrInfo) + + +cdef nvmlReturn_t _nvmlDeviceSetConfComputeUnprotectedMemSize(nvmlDevice_t device, unsigned long long sizeKiB) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetConfComputeUnprotectedMemSize + _check_or_init_nvml() + if __nvmlDeviceSetConfComputeUnprotectedMemSize == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetConfComputeUnprotectedMemSize is not found") + return (__nvmlDeviceSetConfComputeUnprotectedMemSize)( + device, sizeKiB) + + +cdef nvmlReturn_t _nvmlSystemSetConfComputeGpusReadyState(unsigned int isAcceptingWork) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemSetConfComputeGpusReadyState + _check_or_init_nvml() + if __nvmlSystemSetConfComputeGpusReadyState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemSetConfComputeGpusReadyState is not found") + return (__nvmlSystemSetConfComputeGpusReadyState)( + isAcceptingWork) + + +cdef nvmlReturn_t _nvmlSystemSetConfComputeKeyRotationThresholdInfo(nvmlConfComputeSetKeyRotationThresholdInfo_t* pKeyRotationThrInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemSetConfComputeKeyRotationThresholdInfo + _check_or_init_nvml() + if __nvmlSystemSetConfComputeKeyRotationThresholdInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemSetConfComputeKeyRotationThresholdInfo is not found") + return (__nvmlSystemSetConfComputeKeyRotationThresholdInfo)( + pKeyRotationThrInfo) + + +cdef nvmlReturn_t _nvmlSystemGetConfComputeSettings(nvmlSystemConfComputeSettings_t* settings) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemGetConfComputeSettings + _check_or_init_nvml() + if __nvmlSystemGetConfComputeSettings == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemGetConfComputeSettings is not found") + return (__nvmlSystemGetConfComputeSettings)( + settings) + + +cdef nvmlReturn_t _nvmlDeviceGetGspFirmwareVersion(nvmlDevice_t device, char* version) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGspFirmwareVersion + _check_or_init_nvml() + if __nvmlDeviceGetGspFirmwareVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGspFirmwareVersion is not found") + return (__nvmlDeviceGetGspFirmwareVersion)( + device, version) + + +cdef nvmlReturn_t _nvmlDeviceGetGspFirmwareMode(nvmlDevice_t device, unsigned int* isEnabled, unsigned int* defaultMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGspFirmwareMode + _check_or_init_nvml() + if __nvmlDeviceGetGspFirmwareMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGspFirmwareMode is not found") + return (__nvmlDeviceGetGspFirmwareMode)( + device, isEnabled, defaultMode) + + +cdef nvmlReturn_t _nvmlDeviceGetSramEccErrorStatus(nvmlDevice_t device, nvmlEccSramErrorStatus_t* status) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetSramEccErrorStatus + _check_or_init_nvml() + if __nvmlDeviceGetSramEccErrorStatus == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetSramEccErrorStatus is not found") + return (__nvmlDeviceGetSramEccErrorStatus)( + device, status) + + +cdef nvmlReturn_t _nvmlDeviceGetAccountingMode(nvmlDevice_t device, nvmlEnableState_t* mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetAccountingMode + _check_or_init_nvml() + if __nvmlDeviceGetAccountingMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetAccountingMode is not found") + return (__nvmlDeviceGetAccountingMode)( + device, mode) + + +cdef nvmlReturn_t _nvmlDeviceGetAccountingStats(nvmlDevice_t device, unsigned int pid, nvmlAccountingStats_t* stats) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetAccountingStats + _check_or_init_nvml() + if __nvmlDeviceGetAccountingStats == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetAccountingStats is not found") + return (__nvmlDeviceGetAccountingStats)( + device, pid, stats) + + +cdef nvmlReturn_t _nvmlDeviceGetAccountingPids(nvmlDevice_t device, unsigned int* count, unsigned int* pids) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetAccountingPids + _check_or_init_nvml() + if __nvmlDeviceGetAccountingPids == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetAccountingPids is not found") + return (__nvmlDeviceGetAccountingPids)( + device, count, pids) + + +cdef nvmlReturn_t _nvmlDeviceGetAccountingBufferSize(nvmlDevice_t device, unsigned int* bufferSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetAccountingBufferSize + _check_or_init_nvml() + if __nvmlDeviceGetAccountingBufferSize == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetAccountingBufferSize is not found") + return (__nvmlDeviceGetAccountingBufferSize)( + device, bufferSize) + + +cdef nvmlReturn_t _nvmlDeviceGetRetiredPages(nvmlDevice_t device, nvmlPageRetirementCause_t cause, unsigned int* pageCount, unsigned long long* addresses) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetRetiredPages + _check_or_init_nvml() + if __nvmlDeviceGetRetiredPages == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetRetiredPages is not found") + return (__nvmlDeviceGetRetiredPages)( + device, cause, pageCount, addresses) + + +cdef nvmlReturn_t _nvmlDeviceGetRetiredPages_v2(nvmlDevice_t device, nvmlPageRetirementCause_t cause, unsigned int* pageCount, unsigned long long* addresses, unsigned long long* timestamps) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetRetiredPages_v2 + _check_or_init_nvml() + if __nvmlDeviceGetRetiredPages_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetRetiredPages_v2 is not found") + return (__nvmlDeviceGetRetiredPages_v2)( + device, cause, pageCount, addresses, timestamps) + + +cdef nvmlReturn_t _nvmlDeviceGetRetiredPagesPendingStatus(nvmlDevice_t device, nvmlEnableState_t* isPending) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetRetiredPagesPendingStatus + _check_or_init_nvml() + if __nvmlDeviceGetRetiredPagesPendingStatus == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetRetiredPagesPendingStatus is not found") + return (__nvmlDeviceGetRetiredPagesPendingStatus)( + device, isPending) + + +cdef nvmlReturn_t _nvmlDeviceGetRemappedRows(nvmlDevice_t device, unsigned int* corrRows, unsigned int* uncRows, unsigned int* isPending, unsigned int* failureOccurred) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetRemappedRows + _check_or_init_nvml() + if __nvmlDeviceGetRemappedRows == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetRemappedRows is not found") + return (__nvmlDeviceGetRemappedRows)( + device, corrRows, uncRows, isPending, failureOccurred) + + +cdef nvmlReturn_t _nvmlDeviceGetRowRemapperHistogram(nvmlDevice_t device, nvmlRowRemapperHistogramValues_t* values) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetRowRemapperHistogram + _check_or_init_nvml() + if __nvmlDeviceGetRowRemapperHistogram == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetRowRemapperHistogram is not found") + return (__nvmlDeviceGetRowRemapperHistogram)( + device, values) + + +cdef nvmlReturn_t _nvmlDeviceGetArchitecture(nvmlDevice_t device, nvmlDeviceArchitecture_t* arch) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetArchitecture + _check_or_init_nvml() + if __nvmlDeviceGetArchitecture == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetArchitecture is not found") + return (__nvmlDeviceGetArchitecture)( + device, arch) + + +cdef nvmlReturn_t _nvmlDeviceGetClkMonStatus(nvmlDevice_t device, nvmlClkMonStatus_t* status) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetClkMonStatus + _check_or_init_nvml() + if __nvmlDeviceGetClkMonStatus == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetClkMonStatus is not found") + return (__nvmlDeviceGetClkMonStatus)( + device, status) + + +cdef nvmlReturn_t _nvmlDeviceGetProcessUtilization(nvmlDevice_t device, nvmlProcessUtilizationSample_t* utilization, unsigned int* processSamplesCount, unsigned long long lastSeenTimeStamp) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetProcessUtilization + _check_or_init_nvml() + if __nvmlDeviceGetProcessUtilization == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetProcessUtilization is not found") + return (__nvmlDeviceGetProcessUtilization)( + device, utilization, processSamplesCount, lastSeenTimeStamp) + + +cdef nvmlReturn_t _nvmlDeviceGetProcessesUtilizationInfo(nvmlDevice_t device, nvmlProcessesUtilizationInfo_t* procesesUtilInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetProcessesUtilizationInfo + _check_or_init_nvml() + if __nvmlDeviceGetProcessesUtilizationInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetProcessesUtilizationInfo is not found") + return (__nvmlDeviceGetProcessesUtilizationInfo)( + device, procesesUtilInfo) + + +cdef nvmlReturn_t _nvmlDeviceGetPlatformInfo(nvmlDevice_t device, nvmlPlatformInfo_t* platformInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPlatformInfo + _check_or_init_nvml() + if __nvmlDeviceGetPlatformInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPlatformInfo is not found") + return (__nvmlDeviceGetPlatformInfo)( + device, platformInfo) + + +cdef nvmlReturn_t _nvmlUnitSetLedState(nvmlUnit_t unit, nvmlLedColor_t color) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlUnitSetLedState + _check_or_init_nvml() + if __nvmlUnitSetLedState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlUnitSetLedState is not found") + return (__nvmlUnitSetLedState)( + unit, color) + + +cdef nvmlReturn_t _nvmlDeviceSetPersistenceMode(nvmlDevice_t device, nvmlEnableState_t mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetPersistenceMode + _check_or_init_nvml() + if __nvmlDeviceSetPersistenceMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetPersistenceMode is not found") + return (__nvmlDeviceSetPersistenceMode)( + device, mode) + + +cdef nvmlReturn_t _nvmlDeviceSetComputeMode(nvmlDevice_t device, nvmlComputeMode_t mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetComputeMode + _check_or_init_nvml() + if __nvmlDeviceSetComputeMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetComputeMode is not found") + return (__nvmlDeviceSetComputeMode)( + device, mode) + + +cdef nvmlReturn_t _nvmlDeviceSetEccMode(nvmlDevice_t device, nvmlEnableState_t ecc) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetEccMode + _check_or_init_nvml() + if __nvmlDeviceSetEccMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetEccMode is not found") + return (__nvmlDeviceSetEccMode)( + device, ecc) + + +cdef nvmlReturn_t _nvmlDeviceClearEccErrorCounts(nvmlDevice_t device, nvmlEccCounterType_t counterType) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceClearEccErrorCounts + _check_or_init_nvml() + if __nvmlDeviceClearEccErrorCounts == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceClearEccErrorCounts is not found") + return (__nvmlDeviceClearEccErrorCounts)( + device, counterType) + + +cdef nvmlReturn_t _nvmlDeviceSetDriverModel(nvmlDevice_t device, nvmlDriverModel_t driverModel, unsigned int flags) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetDriverModel + _check_or_init_nvml() + if __nvmlDeviceSetDriverModel == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetDriverModel is not found") + return (__nvmlDeviceSetDriverModel)( + device, driverModel, flags) + + +cdef nvmlReturn_t _nvmlDeviceSetGpuLockedClocks(nvmlDevice_t device, unsigned int minGpuClockMHz, unsigned int maxGpuClockMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetGpuLockedClocks + _check_or_init_nvml() + if __nvmlDeviceSetGpuLockedClocks == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetGpuLockedClocks is not found") + return (__nvmlDeviceSetGpuLockedClocks)( + device, minGpuClockMHz, maxGpuClockMHz) + + +cdef nvmlReturn_t _nvmlDeviceResetGpuLockedClocks(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceResetGpuLockedClocks + _check_or_init_nvml() + if __nvmlDeviceResetGpuLockedClocks == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceResetGpuLockedClocks is not found") + return (__nvmlDeviceResetGpuLockedClocks)( + device) + + +cdef nvmlReturn_t _nvmlDeviceSetMemoryLockedClocks(nvmlDevice_t device, unsigned int minMemClockMHz, unsigned int maxMemClockMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetMemoryLockedClocks + _check_or_init_nvml() + if __nvmlDeviceSetMemoryLockedClocks == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetMemoryLockedClocks is not found") + return (__nvmlDeviceSetMemoryLockedClocks)( + device, minMemClockMHz, maxMemClockMHz) + + +cdef nvmlReturn_t _nvmlDeviceResetMemoryLockedClocks(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceResetMemoryLockedClocks + _check_or_init_nvml() + if __nvmlDeviceResetMemoryLockedClocks == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceResetMemoryLockedClocks is not found") + return (__nvmlDeviceResetMemoryLockedClocks)( + device) + + +cdef nvmlReturn_t _nvmlDeviceSetAutoBoostedClocksEnabled(nvmlDevice_t device, nvmlEnableState_t enabled) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetAutoBoostedClocksEnabled + _check_or_init_nvml() + if __nvmlDeviceSetAutoBoostedClocksEnabled == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetAutoBoostedClocksEnabled is not found") + return (__nvmlDeviceSetAutoBoostedClocksEnabled)( + device, enabled) + + +cdef nvmlReturn_t _nvmlDeviceSetDefaultAutoBoostedClocksEnabled(nvmlDevice_t device, nvmlEnableState_t enabled, unsigned int flags) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetDefaultAutoBoostedClocksEnabled + _check_or_init_nvml() + if __nvmlDeviceSetDefaultAutoBoostedClocksEnabled == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetDefaultAutoBoostedClocksEnabled is not found") + return (__nvmlDeviceSetDefaultAutoBoostedClocksEnabled)( + device, enabled, flags) + + +cdef nvmlReturn_t _nvmlDeviceSetDefaultFanSpeed_v2(nvmlDevice_t device, unsigned int fan) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetDefaultFanSpeed_v2 + _check_or_init_nvml() + if __nvmlDeviceSetDefaultFanSpeed_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetDefaultFanSpeed_v2 is not found") + return (__nvmlDeviceSetDefaultFanSpeed_v2)( + device, fan) + + +cdef nvmlReturn_t _nvmlDeviceSetFanControlPolicy(nvmlDevice_t device, unsigned int fan, nvmlFanControlPolicy_t policy) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetFanControlPolicy + _check_or_init_nvml() + if __nvmlDeviceSetFanControlPolicy == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetFanControlPolicy is not found") + return (__nvmlDeviceSetFanControlPolicy)( + device, fan, policy) + + +cdef nvmlReturn_t _nvmlDeviceSetTemperatureThreshold(nvmlDevice_t device, nvmlTemperatureThresholds_t thresholdType, int* temp) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetTemperatureThreshold + _check_or_init_nvml() + if __nvmlDeviceSetTemperatureThreshold == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetTemperatureThreshold is not found") + return (__nvmlDeviceSetTemperatureThreshold)( + device, thresholdType, temp) + + +cdef nvmlReturn_t _nvmlDeviceSetGpuOperationMode(nvmlDevice_t device, nvmlGpuOperationMode_t mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetGpuOperationMode + _check_or_init_nvml() + if __nvmlDeviceSetGpuOperationMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetGpuOperationMode is not found") + return (__nvmlDeviceSetGpuOperationMode)( + device, mode) + + +cdef nvmlReturn_t _nvmlDeviceSetAPIRestriction(nvmlDevice_t device, nvmlRestrictedAPI_t apiType, nvmlEnableState_t isRestricted) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetAPIRestriction + _check_or_init_nvml() + if __nvmlDeviceSetAPIRestriction == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetAPIRestriction is not found") + return (__nvmlDeviceSetAPIRestriction)( + device, apiType, isRestricted) + + +cdef nvmlReturn_t _nvmlDeviceSetFanSpeed_v2(nvmlDevice_t device, unsigned int fan, unsigned int speed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetFanSpeed_v2 + _check_or_init_nvml() + if __nvmlDeviceSetFanSpeed_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetFanSpeed_v2 is not found") + return (__nvmlDeviceSetFanSpeed_v2)( + device, fan, speed) + + +cdef nvmlReturn_t _nvmlDeviceSetAccountingMode(nvmlDevice_t device, nvmlEnableState_t mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetAccountingMode + _check_or_init_nvml() + if __nvmlDeviceSetAccountingMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetAccountingMode is not found") + return (__nvmlDeviceSetAccountingMode)( + device, mode) + + +cdef nvmlReturn_t _nvmlDeviceClearAccountingPids(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceClearAccountingPids + _check_or_init_nvml() + if __nvmlDeviceClearAccountingPids == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceClearAccountingPids is not found") + return (__nvmlDeviceClearAccountingPids)( + device) + + +cdef nvmlReturn_t _nvmlDeviceSetPowerManagementLimit_v2(nvmlDevice_t device, nvmlPowerValue_v2_t* powerValue) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetPowerManagementLimit_v2 + _check_or_init_nvml() + if __nvmlDeviceSetPowerManagementLimit_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetPowerManagementLimit_v2 is not found") + return (__nvmlDeviceSetPowerManagementLimit_v2)( + device, powerValue) + + +cdef nvmlReturn_t _nvmlDeviceGetNvLinkState(nvmlDevice_t device, unsigned int link, nvmlEnableState_t* isActive) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetNvLinkState + _check_or_init_nvml() + if __nvmlDeviceGetNvLinkState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetNvLinkState is not found") + return (__nvmlDeviceGetNvLinkState)( + device, link, isActive) + + +cdef nvmlReturn_t _nvmlDeviceGetNvLinkVersion(nvmlDevice_t device, unsigned int link, unsigned int* version) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetNvLinkVersion + _check_or_init_nvml() + if __nvmlDeviceGetNvLinkVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetNvLinkVersion is not found") + return (__nvmlDeviceGetNvLinkVersion)( + device, link, version) + + +cdef nvmlReturn_t _nvmlDeviceGetNvLinkCapability(nvmlDevice_t device, unsigned int link, nvmlNvLinkCapability_t capability, unsigned int* capResult) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetNvLinkCapability + _check_or_init_nvml() + if __nvmlDeviceGetNvLinkCapability == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetNvLinkCapability is not found") + return (__nvmlDeviceGetNvLinkCapability)( + device, link, capability, capResult) + + +cdef nvmlReturn_t _nvmlDeviceGetNvLinkRemotePciInfo_v2(nvmlDevice_t device, unsigned int link, nvmlPciInfo_t* pci) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetNvLinkRemotePciInfo_v2 + _check_or_init_nvml() + if __nvmlDeviceGetNvLinkRemotePciInfo_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetNvLinkRemotePciInfo_v2 is not found") + return (__nvmlDeviceGetNvLinkRemotePciInfo_v2)( + device, link, pci) + + +cdef nvmlReturn_t _nvmlDeviceGetNvLinkErrorCounter(nvmlDevice_t device, unsigned int link, nvmlNvLinkErrorCounter_t counter, unsigned long long* counterValue) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetNvLinkErrorCounter + _check_or_init_nvml() + if __nvmlDeviceGetNvLinkErrorCounter == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetNvLinkErrorCounter is not found") + return (__nvmlDeviceGetNvLinkErrorCounter)( + device, link, counter, counterValue) + + +cdef nvmlReturn_t _nvmlDeviceResetNvLinkErrorCounters(nvmlDevice_t device, unsigned int link) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceResetNvLinkErrorCounters + _check_or_init_nvml() + if __nvmlDeviceResetNvLinkErrorCounters == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceResetNvLinkErrorCounters is not found") + return (__nvmlDeviceResetNvLinkErrorCounters)( + device, link) + + +cdef nvmlReturn_t _nvmlDeviceGetNvLinkRemoteDeviceType(nvmlDevice_t device, unsigned int link, nvmlIntNvLinkDeviceType_t* pNvLinkDeviceType) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetNvLinkRemoteDeviceType + _check_or_init_nvml() + if __nvmlDeviceGetNvLinkRemoteDeviceType == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetNvLinkRemoteDeviceType is not found") + return (__nvmlDeviceGetNvLinkRemoteDeviceType)( + device, link, pNvLinkDeviceType) + + +cdef nvmlReturn_t _nvmlDeviceSetNvLinkDeviceLowPowerThreshold(nvmlDevice_t device, nvmlNvLinkPowerThres_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetNvLinkDeviceLowPowerThreshold + _check_or_init_nvml() + if __nvmlDeviceSetNvLinkDeviceLowPowerThreshold == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetNvLinkDeviceLowPowerThreshold is not found") + return (__nvmlDeviceSetNvLinkDeviceLowPowerThreshold)( + device, info) + + +cdef nvmlReturn_t _nvmlSystemSetNvlinkBwMode(unsigned int nvlinkBwMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemSetNvlinkBwMode + _check_or_init_nvml() + if __nvmlSystemSetNvlinkBwMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemSetNvlinkBwMode is not found") + return (__nvmlSystemSetNvlinkBwMode)( + nvlinkBwMode) + + +cdef nvmlReturn_t _nvmlSystemGetNvlinkBwMode(unsigned int* nvlinkBwMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemGetNvlinkBwMode + _check_or_init_nvml() + if __nvmlSystemGetNvlinkBwMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemGetNvlinkBwMode is not found") + return (__nvmlSystemGetNvlinkBwMode)( + nvlinkBwMode) + + +cdef nvmlReturn_t _nvmlDeviceGetNvlinkSupportedBwModes(nvmlDevice_t device, nvmlNvlinkSupportedBwModes_t* supportedBwMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetNvlinkSupportedBwModes + _check_or_init_nvml() + if __nvmlDeviceGetNvlinkSupportedBwModes == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetNvlinkSupportedBwModes is not found") + return (__nvmlDeviceGetNvlinkSupportedBwModes)( + device, supportedBwMode) + + +cdef nvmlReturn_t _nvmlDeviceGetNvlinkBwMode(nvmlDevice_t device, nvmlNvlinkGetBwMode_t* getBwMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetNvlinkBwMode + _check_or_init_nvml() + if __nvmlDeviceGetNvlinkBwMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetNvlinkBwMode is not found") + return (__nvmlDeviceGetNvlinkBwMode)( + device, getBwMode) + + +cdef nvmlReturn_t _nvmlDeviceSetNvlinkBwMode(nvmlDevice_t device, nvmlNvlinkSetBwMode_t* setBwMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetNvlinkBwMode + _check_or_init_nvml() + if __nvmlDeviceSetNvlinkBwMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetNvlinkBwMode is not found") + return (__nvmlDeviceSetNvlinkBwMode)( + device, setBwMode) + + +cdef nvmlReturn_t _nvmlEventSetCreate(nvmlEventSet_t* set) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlEventSetCreate + _check_or_init_nvml() + if __nvmlEventSetCreate == NULL: + with gil: + raise FunctionNotFoundError("function nvmlEventSetCreate is not found") + return (__nvmlEventSetCreate)( + set) + + +cdef nvmlReturn_t _nvmlDeviceRegisterEvents(nvmlDevice_t device, unsigned long long eventTypes, nvmlEventSet_t set) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceRegisterEvents + _check_or_init_nvml() + if __nvmlDeviceRegisterEvents == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceRegisterEvents is not found") + return (__nvmlDeviceRegisterEvents)( + device, eventTypes, set) + + +cdef nvmlReturn_t _nvmlDeviceGetSupportedEventTypes(nvmlDevice_t device, unsigned long long* eventTypes) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetSupportedEventTypes + _check_or_init_nvml() + if __nvmlDeviceGetSupportedEventTypes == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetSupportedEventTypes is not found") + return (__nvmlDeviceGetSupportedEventTypes)( + device, eventTypes) + + +cdef nvmlReturn_t _nvmlEventSetWait_v2(nvmlEventSet_t set, nvmlEventData_t* data, unsigned int timeoutms) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlEventSetWait_v2 + _check_or_init_nvml() + if __nvmlEventSetWait_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlEventSetWait_v2 is not found") + return (__nvmlEventSetWait_v2)( + set, data, timeoutms) + + +cdef nvmlReturn_t _nvmlEventSetFree(nvmlEventSet_t set) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlEventSetFree + _check_or_init_nvml() + if __nvmlEventSetFree == NULL: + with gil: + raise FunctionNotFoundError("function nvmlEventSetFree is not found") + return (__nvmlEventSetFree)( + set) + + +cdef nvmlReturn_t _nvmlSystemEventSetCreate(nvmlSystemEventSetCreateRequest_t* request) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemEventSetCreate + _check_or_init_nvml() + if __nvmlSystemEventSetCreate == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemEventSetCreate is not found") + return (__nvmlSystemEventSetCreate)( + request) + + +cdef nvmlReturn_t _nvmlSystemEventSetFree(nvmlSystemEventSetFreeRequest_t* request) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemEventSetFree + _check_or_init_nvml() + if __nvmlSystemEventSetFree == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemEventSetFree is not found") + return (__nvmlSystemEventSetFree)( + request) + + +cdef nvmlReturn_t _nvmlSystemRegisterEvents(nvmlSystemRegisterEventRequest_t* request) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemRegisterEvents + _check_or_init_nvml() + if __nvmlSystemRegisterEvents == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemRegisterEvents is not found") + return (__nvmlSystemRegisterEvents)( + request) + + +cdef nvmlReturn_t _nvmlSystemEventSetWait(nvmlSystemEventSetWaitRequest_t* request) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSystemEventSetWait + _check_or_init_nvml() + if __nvmlSystemEventSetWait == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSystemEventSetWait is not found") + return (__nvmlSystemEventSetWait)( + request) + + +cdef nvmlReturn_t _nvmlDeviceModifyDrainState(nvmlPciInfo_t* pciInfo, nvmlEnableState_t newState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceModifyDrainState + _check_or_init_nvml() + if __nvmlDeviceModifyDrainState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceModifyDrainState is not found") + return (__nvmlDeviceModifyDrainState)( + pciInfo, newState) + + +cdef nvmlReturn_t _nvmlDeviceQueryDrainState(nvmlPciInfo_t* pciInfo, nvmlEnableState_t* currentState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceQueryDrainState + _check_or_init_nvml() + if __nvmlDeviceQueryDrainState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceQueryDrainState is not found") + return (__nvmlDeviceQueryDrainState)( + pciInfo, currentState) + + +cdef nvmlReturn_t _nvmlDeviceRemoveGpu_v2(nvmlPciInfo_t* pciInfo, nvmlDetachGpuState_t gpuState, nvmlPcieLinkState_t linkState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceRemoveGpu_v2 + _check_or_init_nvml() + if __nvmlDeviceRemoveGpu_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceRemoveGpu_v2 is not found") + return (__nvmlDeviceRemoveGpu_v2)( + pciInfo, gpuState, linkState) + + +cdef nvmlReturn_t _nvmlDeviceDiscoverGpus(nvmlPciInfo_t* pciInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceDiscoverGpus + _check_or_init_nvml() + if __nvmlDeviceDiscoverGpus == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceDiscoverGpus is not found") + return (__nvmlDeviceDiscoverGpus)( + pciInfo) + + +cdef nvmlReturn_t _nvmlDeviceGetFieldValues(nvmlDevice_t device, int valuesCount, nvmlFieldValue_t* values) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetFieldValues + _check_or_init_nvml() + if __nvmlDeviceGetFieldValues == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetFieldValues is not found") + return (__nvmlDeviceGetFieldValues)( + device, valuesCount, values) + + +cdef nvmlReturn_t _nvmlDeviceClearFieldValues(nvmlDevice_t device, int valuesCount, nvmlFieldValue_t* values) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceClearFieldValues + _check_or_init_nvml() + if __nvmlDeviceClearFieldValues == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceClearFieldValues is not found") + return (__nvmlDeviceClearFieldValues)( + device, valuesCount, values) + + +cdef nvmlReturn_t _nvmlDeviceGetVirtualizationMode(nvmlDevice_t device, nvmlGpuVirtualizationMode_t* pVirtualMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVirtualizationMode + _check_or_init_nvml() + if __nvmlDeviceGetVirtualizationMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVirtualizationMode is not found") + return (__nvmlDeviceGetVirtualizationMode)( + device, pVirtualMode) + + +cdef nvmlReturn_t _nvmlDeviceGetHostVgpuMode(nvmlDevice_t device, nvmlHostVgpuMode_t* pHostVgpuMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetHostVgpuMode + _check_or_init_nvml() + if __nvmlDeviceGetHostVgpuMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetHostVgpuMode is not found") + return (__nvmlDeviceGetHostVgpuMode)( + device, pHostVgpuMode) + + +cdef nvmlReturn_t _nvmlDeviceSetVirtualizationMode(nvmlDevice_t device, nvmlGpuVirtualizationMode_t virtualMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetVirtualizationMode + _check_or_init_nvml() + if __nvmlDeviceSetVirtualizationMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetVirtualizationMode is not found") + return (__nvmlDeviceSetVirtualizationMode)( + device, virtualMode) + + +cdef nvmlReturn_t _nvmlDeviceGetVgpuHeterogeneousMode(nvmlDevice_t device, nvmlVgpuHeterogeneousMode_t* pHeterogeneousMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVgpuHeterogeneousMode + _check_or_init_nvml() + if __nvmlDeviceGetVgpuHeterogeneousMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVgpuHeterogeneousMode is not found") + return (__nvmlDeviceGetVgpuHeterogeneousMode)( + device, pHeterogeneousMode) + + +cdef nvmlReturn_t _nvmlDeviceSetVgpuHeterogeneousMode(nvmlDevice_t device, const nvmlVgpuHeterogeneousMode_t* pHeterogeneousMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetVgpuHeterogeneousMode + _check_or_init_nvml() + if __nvmlDeviceSetVgpuHeterogeneousMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetVgpuHeterogeneousMode is not found") + return (__nvmlDeviceSetVgpuHeterogeneousMode)( + device, pHeterogeneousMode) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetPlacementId(nvmlVgpuInstance_t vgpuInstance, nvmlVgpuPlacementId_t* pPlacement) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetPlacementId + _check_or_init_nvml() + if __nvmlVgpuInstanceGetPlacementId == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetPlacementId is not found") + return (__nvmlVgpuInstanceGetPlacementId)( + vgpuInstance, pPlacement) + + +cdef nvmlReturn_t _nvmlDeviceGetVgpuTypeSupportedPlacements(nvmlDevice_t device, nvmlVgpuTypeId_t vgpuTypeId, nvmlVgpuPlacementList_t* pPlacementList) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVgpuTypeSupportedPlacements + _check_or_init_nvml() + if __nvmlDeviceGetVgpuTypeSupportedPlacements == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVgpuTypeSupportedPlacements is not found") + return (__nvmlDeviceGetVgpuTypeSupportedPlacements)( + device, vgpuTypeId, pPlacementList) + + +cdef nvmlReturn_t _nvmlDeviceGetVgpuTypeCreatablePlacements(nvmlDevice_t device, nvmlVgpuTypeId_t vgpuTypeId, nvmlVgpuPlacementList_t* pPlacementList) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVgpuTypeCreatablePlacements + _check_or_init_nvml() + if __nvmlDeviceGetVgpuTypeCreatablePlacements == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVgpuTypeCreatablePlacements is not found") + return (__nvmlDeviceGetVgpuTypeCreatablePlacements)( + device, vgpuTypeId, pPlacementList) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetGspHeapSize(nvmlVgpuTypeId_t vgpuTypeId, unsigned long long* gspHeapSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetGspHeapSize + _check_or_init_nvml() + if __nvmlVgpuTypeGetGspHeapSize == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetGspHeapSize is not found") + return (__nvmlVgpuTypeGetGspHeapSize)( + vgpuTypeId, gspHeapSize) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetFbReservation(nvmlVgpuTypeId_t vgpuTypeId, unsigned long long* fbReservation) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetFbReservation + _check_or_init_nvml() + if __nvmlVgpuTypeGetFbReservation == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetFbReservation is not found") + return (__nvmlVgpuTypeGetFbReservation)( + vgpuTypeId, fbReservation) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetRuntimeStateSize(nvmlVgpuInstance_t vgpuInstance, nvmlVgpuRuntimeState_t* pState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetRuntimeStateSize + _check_or_init_nvml() + if __nvmlVgpuInstanceGetRuntimeStateSize == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetRuntimeStateSize is not found") + return (__nvmlVgpuInstanceGetRuntimeStateSize)( + vgpuInstance, pState) + + +cdef nvmlReturn_t _nvmlDeviceSetVgpuCapabilities(nvmlDevice_t device, nvmlDeviceVgpuCapability_t capability, nvmlEnableState_t state) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetVgpuCapabilities + _check_or_init_nvml() + if __nvmlDeviceSetVgpuCapabilities == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetVgpuCapabilities is not found") + return (__nvmlDeviceSetVgpuCapabilities)( + device, capability, state) + + +cdef nvmlReturn_t _nvmlDeviceGetGridLicensableFeatures_v4(nvmlDevice_t device, nvmlGridLicensableFeatures_t* pGridLicensableFeatures) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGridLicensableFeatures_v4 + _check_or_init_nvml() + if __nvmlDeviceGetGridLicensableFeatures_v4 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGridLicensableFeatures_v4 is not found") + return (__nvmlDeviceGetGridLicensableFeatures_v4)( + device, pGridLicensableFeatures) + + +cdef nvmlReturn_t _nvmlGetVgpuDriverCapabilities(nvmlVgpuDriverCapability_t capability, unsigned int* capResult) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGetVgpuDriverCapabilities + _check_or_init_nvml() + if __nvmlGetVgpuDriverCapabilities == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGetVgpuDriverCapabilities is not found") + return (__nvmlGetVgpuDriverCapabilities)( + capability, capResult) + + +cdef nvmlReturn_t _nvmlDeviceGetVgpuCapabilities(nvmlDevice_t device, nvmlDeviceVgpuCapability_t capability, unsigned int* capResult) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVgpuCapabilities + _check_or_init_nvml() + if __nvmlDeviceGetVgpuCapabilities == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVgpuCapabilities is not found") + return (__nvmlDeviceGetVgpuCapabilities)( + device, capability, capResult) + + +cdef nvmlReturn_t _nvmlDeviceGetSupportedVgpus(nvmlDevice_t device, unsigned int* vgpuCount, nvmlVgpuTypeId_t* vgpuTypeIds) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetSupportedVgpus + _check_or_init_nvml() + if __nvmlDeviceGetSupportedVgpus == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetSupportedVgpus is not found") + return (__nvmlDeviceGetSupportedVgpus)( + device, vgpuCount, vgpuTypeIds) + + +cdef nvmlReturn_t _nvmlDeviceGetCreatableVgpus(nvmlDevice_t device, unsigned int* vgpuCount, nvmlVgpuTypeId_t* vgpuTypeIds) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetCreatableVgpus + _check_or_init_nvml() + if __nvmlDeviceGetCreatableVgpus == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetCreatableVgpus is not found") + return (__nvmlDeviceGetCreatableVgpus)( + device, vgpuCount, vgpuTypeIds) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetClass(nvmlVgpuTypeId_t vgpuTypeId, char* vgpuTypeClass, unsigned int* size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetClass + _check_or_init_nvml() + if __nvmlVgpuTypeGetClass == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetClass is not found") + return (__nvmlVgpuTypeGetClass)( + vgpuTypeId, vgpuTypeClass, size) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetName(nvmlVgpuTypeId_t vgpuTypeId, char* vgpuTypeName, unsigned int* size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetName + _check_or_init_nvml() + if __nvmlVgpuTypeGetName == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetName is not found") + return (__nvmlVgpuTypeGetName)( + vgpuTypeId, vgpuTypeName, size) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetGpuInstanceProfileId(nvmlVgpuTypeId_t vgpuTypeId, unsigned int* gpuInstanceProfileId) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetGpuInstanceProfileId + _check_or_init_nvml() + if __nvmlVgpuTypeGetGpuInstanceProfileId == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetGpuInstanceProfileId is not found") + return (__nvmlVgpuTypeGetGpuInstanceProfileId)( + vgpuTypeId, gpuInstanceProfileId) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetDeviceID(nvmlVgpuTypeId_t vgpuTypeId, unsigned long long* deviceID, unsigned long long* subsystemID) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetDeviceID + _check_or_init_nvml() + if __nvmlVgpuTypeGetDeviceID == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetDeviceID is not found") + return (__nvmlVgpuTypeGetDeviceID)( + vgpuTypeId, deviceID, subsystemID) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetFramebufferSize(nvmlVgpuTypeId_t vgpuTypeId, unsigned long long* fbSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetFramebufferSize + _check_or_init_nvml() + if __nvmlVgpuTypeGetFramebufferSize == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetFramebufferSize is not found") + return (__nvmlVgpuTypeGetFramebufferSize)( + vgpuTypeId, fbSize) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetNumDisplayHeads(nvmlVgpuTypeId_t vgpuTypeId, unsigned int* numDisplayHeads) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetNumDisplayHeads + _check_or_init_nvml() + if __nvmlVgpuTypeGetNumDisplayHeads == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetNumDisplayHeads is not found") + return (__nvmlVgpuTypeGetNumDisplayHeads)( + vgpuTypeId, numDisplayHeads) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetResolution(nvmlVgpuTypeId_t vgpuTypeId, unsigned int displayIndex, unsigned int* xdim, unsigned int* ydim) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetResolution + _check_or_init_nvml() + if __nvmlVgpuTypeGetResolution == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetResolution is not found") + return (__nvmlVgpuTypeGetResolution)( + vgpuTypeId, displayIndex, xdim, ydim) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetLicense(nvmlVgpuTypeId_t vgpuTypeId, char* vgpuTypeLicenseString, unsigned int size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetLicense + _check_or_init_nvml() + if __nvmlVgpuTypeGetLicense == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetLicense is not found") + return (__nvmlVgpuTypeGetLicense)( + vgpuTypeId, vgpuTypeLicenseString, size) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetFrameRateLimit(nvmlVgpuTypeId_t vgpuTypeId, unsigned int* frameRateLimit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetFrameRateLimit + _check_or_init_nvml() + if __nvmlVgpuTypeGetFrameRateLimit == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetFrameRateLimit is not found") + return (__nvmlVgpuTypeGetFrameRateLimit)( + vgpuTypeId, frameRateLimit) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetMaxInstances(nvmlDevice_t device, nvmlVgpuTypeId_t vgpuTypeId, unsigned int* vgpuInstanceCount) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetMaxInstances + _check_or_init_nvml() + if __nvmlVgpuTypeGetMaxInstances == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetMaxInstances is not found") + return (__nvmlVgpuTypeGetMaxInstances)( + device, vgpuTypeId, vgpuInstanceCount) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetMaxInstancesPerVm(nvmlVgpuTypeId_t vgpuTypeId, unsigned int* vgpuInstanceCountPerVm) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetMaxInstancesPerVm + _check_or_init_nvml() + if __nvmlVgpuTypeGetMaxInstancesPerVm == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetMaxInstancesPerVm is not found") + return (__nvmlVgpuTypeGetMaxInstancesPerVm)( + vgpuTypeId, vgpuInstanceCountPerVm) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetBAR1Info(nvmlVgpuTypeId_t vgpuTypeId, nvmlVgpuTypeBar1Info_t* bar1Info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetBAR1Info + _check_or_init_nvml() + if __nvmlVgpuTypeGetBAR1Info == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetBAR1Info is not found") + return (__nvmlVgpuTypeGetBAR1Info)( + vgpuTypeId, bar1Info) + + +cdef nvmlReturn_t _nvmlDeviceGetActiveVgpus(nvmlDevice_t device, unsigned int* vgpuCount, nvmlVgpuInstance_t* vgpuInstances) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetActiveVgpus + _check_or_init_nvml() + if __nvmlDeviceGetActiveVgpus == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetActiveVgpus is not found") + return (__nvmlDeviceGetActiveVgpus)( + device, vgpuCount, vgpuInstances) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetVmID(nvmlVgpuInstance_t vgpuInstance, char* vmId, unsigned int size, nvmlVgpuVmIdType_t* vmIdType) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetVmID + _check_or_init_nvml() + if __nvmlVgpuInstanceGetVmID == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetVmID is not found") + return (__nvmlVgpuInstanceGetVmID)( + vgpuInstance, vmId, size, vmIdType) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetUUID(nvmlVgpuInstance_t vgpuInstance, char* uuid, unsigned int size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetUUID + _check_or_init_nvml() + if __nvmlVgpuInstanceGetUUID == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetUUID is not found") + return (__nvmlVgpuInstanceGetUUID)( + vgpuInstance, uuid, size) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetVmDriverVersion(nvmlVgpuInstance_t vgpuInstance, char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetVmDriverVersion + _check_or_init_nvml() + if __nvmlVgpuInstanceGetVmDriverVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetVmDriverVersion is not found") + return (__nvmlVgpuInstanceGetVmDriverVersion)( + vgpuInstance, version, length) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetFbUsage(nvmlVgpuInstance_t vgpuInstance, unsigned long long* fbUsage) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetFbUsage + _check_or_init_nvml() + if __nvmlVgpuInstanceGetFbUsage == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetFbUsage is not found") + return (__nvmlVgpuInstanceGetFbUsage)( + vgpuInstance, fbUsage) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetLicenseStatus(nvmlVgpuInstance_t vgpuInstance, unsigned int* licensed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetLicenseStatus + _check_or_init_nvml() + if __nvmlVgpuInstanceGetLicenseStatus == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetLicenseStatus is not found") + return (__nvmlVgpuInstanceGetLicenseStatus)( + vgpuInstance, licensed) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetType(nvmlVgpuInstance_t vgpuInstance, nvmlVgpuTypeId_t* vgpuTypeId) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetType + _check_or_init_nvml() + if __nvmlVgpuInstanceGetType == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetType is not found") + return (__nvmlVgpuInstanceGetType)( + vgpuInstance, vgpuTypeId) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetFrameRateLimit(nvmlVgpuInstance_t vgpuInstance, unsigned int* frameRateLimit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetFrameRateLimit + _check_or_init_nvml() + if __nvmlVgpuInstanceGetFrameRateLimit == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetFrameRateLimit is not found") + return (__nvmlVgpuInstanceGetFrameRateLimit)( + vgpuInstance, frameRateLimit) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetEccMode(nvmlVgpuInstance_t vgpuInstance, nvmlEnableState_t* eccMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetEccMode + _check_or_init_nvml() + if __nvmlVgpuInstanceGetEccMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetEccMode is not found") + return (__nvmlVgpuInstanceGetEccMode)( + vgpuInstance, eccMode) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetEncoderCapacity(nvmlVgpuInstance_t vgpuInstance, unsigned int* encoderCapacity) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetEncoderCapacity + _check_or_init_nvml() + if __nvmlVgpuInstanceGetEncoderCapacity == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetEncoderCapacity is not found") + return (__nvmlVgpuInstanceGetEncoderCapacity)( + vgpuInstance, encoderCapacity) + + +cdef nvmlReturn_t _nvmlVgpuInstanceSetEncoderCapacity(nvmlVgpuInstance_t vgpuInstance, unsigned int encoderCapacity) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceSetEncoderCapacity + _check_or_init_nvml() + if __nvmlVgpuInstanceSetEncoderCapacity == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceSetEncoderCapacity is not found") + return (__nvmlVgpuInstanceSetEncoderCapacity)( + vgpuInstance, encoderCapacity) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetEncoderStats(nvmlVgpuInstance_t vgpuInstance, unsigned int* sessionCount, unsigned int* averageFps, unsigned int* averageLatency) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetEncoderStats + _check_or_init_nvml() + if __nvmlVgpuInstanceGetEncoderStats == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetEncoderStats is not found") + return (__nvmlVgpuInstanceGetEncoderStats)( + vgpuInstance, sessionCount, averageFps, averageLatency) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetEncoderSessions(nvmlVgpuInstance_t vgpuInstance, unsigned int* sessionCount, nvmlEncoderSessionInfo_t* sessionInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetEncoderSessions + _check_or_init_nvml() + if __nvmlVgpuInstanceGetEncoderSessions == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetEncoderSessions is not found") + return (__nvmlVgpuInstanceGetEncoderSessions)( + vgpuInstance, sessionCount, sessionInfo) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetFBCStats(nvmlVgpuInstance_t vgpuInstance, nvmlFBCStats_t* fbcStats) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetFBCStats + _check_or_init_nvml() + if __nvmlVgpuInstanceGetFBCStats == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetFBCStats is not found") + return (__nvmlVgpuInstanceGetFBCStats)( + vgpuInstance, fbcStats) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetFBCSessions(nvmlVgpuInstance_t vgpuInstance, unsigned int* sessionCount, nvmlFBCSessionInfo_t* sessionInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetFBCSessions + _check_or_init_nvml() + if __nvmlVgpuInstanceGetFBCSessions == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetFBCSessions is not found") + return (__nvmlVgpuInstanceGetFBCSessions)( + vgpuInstance, sessionCount, sessionInfo) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetGpuInstanceId(nvmlVgpuInstance_t vgpuInstance, unsigned int* gpuInstanceId) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetGpuInstanceId + _check_or_init_nvml() + if __nvmlVgpuInstanceGetGpuInstanceId == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetGpuInstanceId is not found") + return (__nvmlVgpuInstanceGetGpuInstanceId)( + vgpuInstance, gpuInstanceId) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetGpuPciId(nvmlVgpuInstance_t vgpuInstance, char* vgpuPciId, unsigned int* length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetGpuPciId + _check_or_init_nvml() + if __nvmlVgpuInstanceGetGpuPciId == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetGpuPciId is not found") + return (__nvmlVgpuInstanceGetGpuPciId)( + vgpuInstance, vgpuPciId, length) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetCapabilities(nvmlVgpuTypeId_t vgpuTypeId, nvmlVgpuCapability_t capability, unsigned int* capResult) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetCapabilities + _check_or_init_nvml() + if __nvmlVgpuTypeGetCapabilities == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetCapabilities is not found") + return (__nvmlVgpuTypeGetCapabilities)( + vgpuTypeId, capability, capResult) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetMdevUUID(nvmlVgpuInstance_t vgpuInstance, char* mdevUuid, unsigned int size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetMdevUUID + _check_or_init_nvml() + if __nvmlVgpuInstanceGetMdevUUID == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetMdevUUID is not found") + return (__nvmlVgpuInstanceGetMdevUUID)( + vgpuInstance, mdevUuid, size) + + +cdef nvmlReturn_t _nvmlGpuInstanceGetCreatableVgpus(nvmlGpuInstance_t gpuInstance, nvmlVgpuTypeIdInfo_t* pVgpus) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceGetCreatableVgpus + _check_or_init_nvml() + if __nvmlGpuInstanceGetCreatableVgpus == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceGetCreatableVgpus is not found") + return (__nvmlGpuInstanceGetCreatableVgpus)( + gpuInstance, pVgpus) + + +cdef nvmlReturn_t _nvmlVgpuTypeGetMaxInstancesPerGpuInstance(nvmlVgpuTypeMaxInstance_t* pMaxInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuTypeGetMaxInstancesPerGpuInstance + _check_or_init_nvml() + if __nvmlVgpuTypeGetMaxInstancesPerGpuInstance == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuTypeGetMaxInstancesPerGpuInstance is not found") + return (__nvmlVgpuTypeGetMaxInstancesPerGpuInstance)( + pMaxInstance) + + +cdef nvmlReturn_t _nvmlGpuInstanceGetActiveVgpus(nvmlGpuInstance_t gpuInstance, nvmlActiveVgpuInstanceInfo_t* pVgpuInstanceInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceGetActiveVgpus + _check_or_init_nvml() + if __nvmlGpuInstanceGetActiveVgpus == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceGetActiveVgpus is not found") + return (__nvmlGpuInstanceGetActiveVgpus)( + gpuInstance, pVgpuInstanceInfo) + + +cdef nvmlReturn_t _nvmlGpuInstanceSetVgpuSchedulerState(nvmlGpuInstance_t gpuInstance, nvmlVgpuSchedulerState_t* pScheduler) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceSetVgpuSchedulerState + _check_or_init_nvml() + if __nvmlGpuInstanceSetVgpuSchedulerState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceSetVgpuSchedulerState is not found") + return (__nvmlGpuInstanceSetVgpuSchedulerState)( + gpuInstance, pScheduler) + + +cdef nvmlReturn_t _nvmlGpuInstanceGetVgpuSchedulerState(nvmlGpuInstance_t gpuInstance, nvmlVgpuSchedulerStateInfo_t* pSchedulerStateInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceGetVgpuSchedulerState + _check_or_init_nvml() + if __nvmlGpuInstanceGetVgpuSchedulerState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceGetVgpuSchedulerState is not found") + return (__nvmlGpuInstanceGetVgpuSchedulerState)( + gpuInstance, pSchedulerStateInfo) + + +cdef nvmlReturn_t _nvmlGpuInstanceGetVgpuSchedulerLog(nvmlGpuInstance_t gpuInstance, nvmlVgpuSchedulerLogInfo_t* pSchedulerLogInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceGetVgpuSchedulerLog + _check_or_init_nvml() + if __nvmlGpuInstanceGetVgpuSchedulerLog == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceGetVgpuSchedulerLog is not found") + return (__nvmlGpuInstanceGetVgpuSchedulerLog)( + gpuInstance, pSchedulerLogInfo) + + +cdef nvmlReturn_t _nvmlGpuInstanceGetVgpuTypeCreatablePlacements(nvmlGpuInstance_t gpuInstance, nvmlVgpuCreatablePlacementInfo_t* pCreatablePlacementInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceGetVgpuTypeCreatablePlacements + _check_or_init_nvml() + if __nvmlGpuInstanceGetVgpuTypeCreatablePlacements == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceGetVgpuTypeCreatablePlacements is not found") + return (__nvmlGpuInstanceGetVgpuTypeCreatablePlacements)( + gpuInstance, pCreatablePlacementInfo) + + +cdef nvmlReturn_t _nvmlGpuInstanceGetVgpuHeterogeneousMode(nvmlGpuInstance_t gpuInstance, nvmlVgpuHeterogeneousMode_t* pHeterogeneousMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceGetVgpuHeterogeneousMode + _check_or_init_nvml() + if __nvmlGpuInstanceGetVgpuHeterogeneousMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceGetVgpuHeterogeneousMode is not found") + return (__nvmlGpuInstanceGetVgpuHeterogeneousMode)( + gpuInstance, pHeterogeneousMode) + + +cdef nvmlReturn_t _nvmlGpuInstanceSetVgpuHeterogeneousMode(nvmlGpuInstance_t gpuInstance, const nvmlVgpuHeterogeneousMode_t* pHeterogeneousMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceSetVgpuHeterogeneousMode + _check_or_init_nvml() + if __nvmlGpuInstanceSetVgpuHeterogeneousMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceSetVgpuHeterogeneousMode is not found") + return (__nvmlGpuInstanceSetVgpuHeterogeneousMode)( + gpuInstance, pHeterogeneousMode) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetMetadata(nvmlVgpuInstance_t vgpuInstance, nvmlVgpuMetadata_t* vgpuMetadata, unsigned int* bufferSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetMetadata + _check_or_init_nvml() + if __nvmlVgpuInstanceGetMetadata == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetMetadata is not found") + return (__nvmlVgpuInstanceGetMetadata)( + vgpuInstance, vgpuMetadata, bufferSize) + + +cdef nvmlReturn_t _nvmlDeviceGetVgpuMetadata(nvmlDevice_t device, nvmlVgpuPgpuMetadata_t* pgpuMetadata, unsigned int* bufferSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVgpuMetadata + _check_or_init_nvml() + if __nvmlDeviceGetVgpuMetadata == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVgpuMetadata is not found") + return (__nvmlDeviceGetVgpuMetadata)( + device, pgpuMetadata, bufferSize) + + +cdef nvmlReturn_t _nvmlGetVgpuCompatibility(nvmlVgpuMetadata_t* vgpuMetadata, nvmlVgpuPgpuMetadata_t* pgpuMetadata, nvmlVgpuPgpuCompatibility_t* compatibilityInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGetVgpuCompatibility + _check_or_init_nvml() + if __nvmlGetVgpuCompatibility == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGetVgpuCompatibility is not found") + return (__nvmlGetVgpuCompatibility)( + vgpuMetadata, pgpuMetadata, compatibilityInfo) + + +cdef nvmlReturn_t _nvmlDeviceGetPgpuMetadataString(nvmlDevice_t device, char* pgpuMetadata, unsigned int* bufferSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPgpuMetadataString + _check_or_init_nvml() + if __nvmlDeviceGetPgpuMetadataString == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPgpuMetadataString is not found") + return (__nvmlDeviceGetPgpuMetadataString)( + device, pgpuMetadata, bufferSize) + + +cdef nvmlReturn_t _nvmlDeviceGetVgpuSchedulerLog(nvmlDevice_t device, nvmlVgpuSchedulerLog_t* pSchedulerLog) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVgpuSchedulerLog + _check_or_init_nvml() + if __nvmlDeviceGetVgpuSchedulerLog == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVgpuSchedulerLog is not found") + return (__nvmlDeviceGetVgpuSchedulerLog)( + device, pSchedulerLog) + + +cdef nvmlReturn_t _nvmlDeviceGetVgpuSchedulerState(nvmlDevice_t device, nvmlVgpuSchedulerGetState_t* pSchedulerState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVgpuSchedulerState + _check_or_init_nvml() + if __nvmlDeviceGetVgpuSchedulerState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVgpuSchedulerState is not found") + return (__nvmlDeviceGetVgpuSchedulerState)( + device, pSchedulerState) + + +cdef nvmlReturn_t _nvmlDeviceGetVgpuSchedulerCapabilities(nvmlDevice_t device, nvmlVgpuSchedulerCapabilities_t* pCapabilities) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVgpuSchedulerCapabilities + _check_or_init_nvml() + if __nvmlDeviceGetVgpuSchedulerCapabilities == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVgpuSchedulerCapabilities is not found") + return (__nvmlDeviceGetVgpuSchedulerCapabilities)( + device, pCapabilities) + + +cdef nvmlReturn_t _nvmlDeviceSetVgpuSchedulerState(nvmlDevice_t device, nvmlVgpuSchedulerSetState_t* pSchedulerState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetVgpuSchedulerState + _check_or_init_nvml() + if __nvmlDeviceSetVgpuSchedulerState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetVgpuSchedulerState is not found") + return (__nvmlDeviceSetVgpuSchedulerState)( + device, pSchedulerState) + + +cdef nvmlReturn_t _nvmlGetVgpuVersion(nvmlVgpuVersion_t* supported, nvmlVgpuVersion_t* current) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGetVgpuVersion + _check_or_init_nvml() + if __nvmlGetVgpuVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGetVgpuVersion is not found") + return (__nvmlGetVgpuVersion)( + supported, current) + + +cdef nvmlReturn_t _nvmlSetVgpuVersion(nvmlVgpuVersion_t* vgpuVersion) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlSetVgpuVersion + _check_or_init_nvml() + if __nvmlSetVgpuVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvmlSetVgpuVersion is not found") + return (__nvmlSetVgpuVersion)( + vgpuVersion) + + +cdef nvmlReturn_t _nvmlDeviceGetVgpuUtilization(nvmlDevice_t device, unsigned long long lastSeenTimeStamp, nvmlValueType_t* sampleValType, unsigned int* vgpuInstanceSamplesCount, nvmlVgpuInstanceUtilizationSample_t* utilizationSamples) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVgpuUtilization + _check_or_init_nvml() + if __nvmlDeviceGetVgpuUtilization == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVgpuUtilization is not found") + return (__nvmlDeviceGetVgpuUtilization)( + device, lastSeenTimeStamp, sampleValType, vgpuInstanceSamplesCount, utilizationSamples) + + +cdef nvmlReturn_t _nvmlDeviceGetVgpuInstancesUtilizationInfo(nvmlDevice_t device, nvmlVgpuInstancesUtilizationInfo_t* vgpuUtilInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVgpuInstancesUtilizationInfo + _check_or_init_nvml() + if __nvmlDeviceGetVgpuInstancesUtilizationInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVgpuInstancesUtilizationInfo is not found") + return (__nvmlDeviceGetVgpuInstancesUtilizationInfo)( + device, vgpuUtilInfo) + + +cdef nvmlReturn_t _nvmlDeviceGetVgpuProcessUtilization(nvmlDevice_t device, unsigned long long lastSeenTimeStamp, unsigned int* vgpuProcessSamplesCount, nvmlVgpuProcessUtilizationSample_t* utilizationSamples) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVgpuProcessUtilization + _check_or_init_nvml() + if __nvmlDeviceGetVgpuProcessUtilization == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVgpuProcessUtilization is not found") + return (__nvmlDeviceGetVgpuProcessUtilization)( + device, lastSeenTimeStamp, vgpuProcessSamplesCount, utilizationSamples) + + +cdef nvmlReturn_t _nvmlDeviceGetVgpuProcessesUtilizationInfo(nvmlDevice_t device, nvmlVgpuProcessesUtilizationInfo_t* vgpuProcUtilInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVgpuProcessesUtilizationInfo + _check_or_init_nvml() + if __nvmlDeviceGetVgpuProcessesUtilizationInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVgpuProcessesUtilizationInfo is not found") + return (__nvmlDeviceGetVgpuProcessesUtilizationInfo)( + device, vgpuProcUtilInfo) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetAccountingMode(nvmlVgpuInstance_t vgpuInstance, nvmlEnableState_t* mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetAccountingMode + _check_or_init_nvml() + if __nvmlVgpuInstanceGetAccountingMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetAccountingMode is not found") + return (__nvmlVgpuInstanceGetAccountingMode)( + vgpuInstance, mode) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetAccountingPids(nvmlVgpuInstance_t vgpuInstance, unsigned int* count, unsigned int* pids) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetAccountingPids + _check_or_init_nvml() + if __nvmlVgpuInstanceGetAccountingPids == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetAccountingPids is not found") + return (__nvmlVgpuInstanceGetAccountingPids)( + vgpuInstance, count, pids) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetAccountingStats(nvmlVgpuInstance_t vgpuInstance, unsigned int pid, nvmlAccountingStats_t* stats) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetAccountingStats + _check_or_init_nvml() + if __nvmlVgpuInstanceGetAccountingStats == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetAccountingStats is not found") + return (__nvmlVgpuInstanceGetAccountingStats)( + vgpuInstance, pid, stats) + + +cdef nvmlReturn_t _nvmlVgpuInstanceClearAccountingPids(nvmlVgpuInstance_t vgpuInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceClearAccountingPids + _check_or_init_nvml() + if __nvmlVgpuInstanceClearAccountingPids == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceClearAccountingPids is not found") + return (__nvmlVgpuInstanceClearAccountingPids)( + vgpuInstance) + + +cdef nvmlReturn_t _nvmlVgpuInstanceGetLicenseInfo_v2(nvmlVgpuInstance_t vgpuInstance, nvmlVgpuLicenseInfo_t* licenseInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlVgpuInstanceGetLicenseInfo_v2 + _check_or_init_nvml() + if __nvmlVgpuInstanceGetLicenseInfo_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlVgpuInstanceGetLicenseInfo_v2 is not found") + return (__nvmlVgpuInstanceGetLicenseInfo_v2)( + vgpuInstance, licenseInfo) + + +cdef nvmlReturn_t _nvmlGetExcludedDeviceCount(unsigned int* deviceCount) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGetExcludedDeviceCount + _check_or_init_nvml() + if __nvmlGetExcludedDeviceCount == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGetExcludedDeviceCount is not found") + return (__nvmlGetExcludedDeviceCount)( + deviceCount) + + +cdef nvmlReturn_t _nvmlGetExcludedDeviceInfoByIndex(unsigned int index, nvmlExcludedDeviceInfo_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGetExcludedDeviceInfoByIndex + _check_or_init_nvml() + if __nvmlGetExcludedDeviceInfoByIndex == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGetExcludedDeviceInfoByIndex is not found") + return (__nvmlGetExcludedDeviceInfoByIndex)( + index, info) + + +cdef nvmlReturn_t _nvmlDeviceSetMigMode(nvmlDevice_t device, unsigned int mode, nvmlReturn_t* activationStatus) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetMigMode + _check_or_init_nvml() + if __nvmlDeviceSetMigMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetMigMode is not found") + return (__nvmlDeviceSetMigMode)( + device, mode, activationStatus) + + +cdef nvmlReturn_t _nvmlDeviceGetMigMode(nvmlDevice_t device, unsigned int* currentMode, unsigned int* pendingMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMigMode + _check_or_init_nvml() + if __nvmlDeviceGetMigMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMigMode is not found") + return (__nvmlDeviceGetMigMode)( + device, currentMode, pendingMode) + + +cdef nvmlReturn_t _nvmlDeviceGetGpuInstanceProfileInfoV(nvmlDevice_t device, unsigned int profile, nvmlGpuInstanceProfileInfo_v2_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGpuInstanceProfileInfoV + _check_or_init_nvml() + if __nvmlDeviceGetGpuInstanceProfileInfoV == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGpuInstanceProfileInfoV is not found") + return (__nvmlDeviceGetGpuInstanceProfileInfoV)( + device, profile, info) + + +cdef nvmlReturn_t _nvmlDeviceGetGpuInstancePossiblePlacements_v2(nvmlDevice_t device, unsigned int profileId, nvmlGpuInstancePlacement_t* placements, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGpuInstancePossiblePlacements_v2 + _check_or_init_nvml() + if __nvmlDeviceGetGpuInstancePossiblePlacements_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGpuInstancePossiblePlacements_v2 is not found") + return (__nvmlDeviceGetGpuInstancePossiblePlacements_v2)( + device, profileId, placements, count) + + +cdef nvmlReturn_t _nvmlDeviceGetGpuInstanceRemainingCapacity(nvmlDevice_t device, unsigned int profileId, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGpuInstanceRemainingCapacity + _check_or_init_nvml() + if __nvmlDeviceGetGpuInstanceRemainingCapacity == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGpuInstanceRemainingCapacity is not found") + return (__nvmlDeviceGetGpuInstanceRemainingCapacity)( + device, profileId, count) + + +cdef nvmlReturn_t _nvmlDeviceCreateGpuInstance(nvmlDevice_t device, unsigned int profileId, nvmlGpuInstance_t* gpuInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceCreateGpuInstance + _check_or_init_nvml() + if __nvmlDeviceCreateGpuInstance == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceCreateGpuInstance is not found") + return (__nvmlDeviceCreateGpuInstance)( + device, profileId, gpuInstance) + + +cdef nvmlReturn_t _nvmlDeviceCreateGpuInstanceWithPlacement(nvmlDevice_t device, unsigned int profileId, const nvmlGpuInstancePlacement_t* placement, nvmlGpuInstance_t* gpuInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceCreateGpuInstanceWithPlacement + _check_or_init_nvml() + if __nvmlDeviceCreateGpuInstanceWithPlacement == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceCreateGpuInstanceWithPlacement is not found") + return (__nvmlDeviceCreateGpuInstanceWithPlacement)( + device, profileId, placement, gpuInstance) + + +cdef nvmlReturn_t _nvmlGpuInstanceDestroy(nvmlGpuInstance_t gpuInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceDestroy + _check_or_init_nvml() + if __nvmlGpuInstanceDestroy == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceDestroy is not found") + return (__nvmlGpuInstanceDestroy)( + gpuInstance) + + +cdef nvmlReturn_t _nvmlDeviceGetGpuInstances(nvmlDevice_t device, unsigned int profileId, nvmlGpuInstance_t* gpuInstances, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGpuInstances + _check_or_init_nvml() + if __nvmlDeviceGetGpuInstances == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGpuInstances is not found") + return (__nvmlDeviceGetGpuInstances)( + device, profileId, gpuInstances, count) + + +cdef nvmlReturn_t _nvmlDeviceGetGpuInstanceById(nvmlDevice_t device, unsigned int id, nvmlGpuInstance_t* gpuInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGpuInstanceById + _check_or_init_nvml() + if __nvmlDeviceGetGpuInstanceById == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGpuInstanceById is not found") + return (__nvmlDeviceGetGpuInstanceById)( + device, id, gpuInstance) + + +cdef nvmlReturn_t _nvmlGpuInstanceGetInfo(nvmlGpuInstance_t gpuInstance, nvmlGpuInstanceInfo_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceGetInfo + _check_or_init_nvml() + if __nvmlGpuInstanceGetInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceGetInfo is not found") + return (__nvmlGpuInstanceGetInfo)( + gpuInstance, info) + + +cdef nvmlReturn_t _nvmlGpuInstanceGetComputeInstanceProfileInfoV(nvmlGpuInstance_t gpuInstance, unsigned int profile, unsigned int engProfile, nvmlComputeInstanceProfileInfo_v2_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceGetComputeInstanceProfileInfoV + _check_or_init_nvml() + if __nvmlGpuInstanceGetComputeInstanceProfileInfoV == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceGetComputeInstanceProfileInfoV is not found") + return (__nvmlGpuInstanceGetComputeInstanceProfileInfoV)( + gpuInstance, profile, engProfile, info) + + +cdef nvmlReturn_t _nvmlGpuInstanceGetComputeInstanceRemainingCapacity(nvmlGpuInstance_t gpuInstance, unsigned int profileId, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceGetComputeInstanceRemainingCapacity + _check_or_init_nvml() + if __nvmlGpuInstanceGetComputeInstanceRemainingCapacity == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceGetComputeInstanceRemainingCapacity is not found") + return (__nvmlGpuInstanceGetComputeInstanceRemainingCapacity)( + gpuInstance, profileId, count) + + +cdef nvmlReturn_t _nvmlGpuInstanceGetComputeInstancePossiblePlacements(nvmlGpuInstance_t gpuInstance, unsigned int profileId, nvmlComputeInstancePlacement_t* placements, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceGetComputeInstancePossiblePlacements + _check_or_init_nvml() + if __nvmlGpuInstanceGetComputeInstancePossiblePlacements == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceGetComputeInstancePossiblePlacements is not found") + return (__nvmlGpuInstanceGetComputeInstancePossiblePlacements)( + gpuInstance, profileId, placements, count) + + +cdef nvmlReturn_t _nvmlGpuInstanceCreateComputeInstance(nvmlGpuInstance_t gpuInstance, unsigned int profileId, nvmlComputeInstance_t* computeInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceCreateComputeInstance + _check_or_init_nvml() + if __nvmlGpuInstanceCreateComputeInstance == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceCreateComputeInstance is not found") + return (__nvmlGpuInstanceCreateComputeInstance)( + gpuInstance, profileId, computeInstance) + + +cdef nvmlReturn_t _nvmlGpuInstanceCreateComputeInstanceWithPlacement(nvmlGpuInstance_t gpuInstance, unsigned int profileId, const nvmlComputeInstancePlacement_t* placement, nvmlComputeInstance_t* computeInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceCreateComputeInstanceWithPlacement + _check_or_init_nvml() + if __nvmlGpuInstanceCreateComputeInstanceWithPlacement == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceCreateComputeInstanceWithPlacement is not found") + return (__nvmlGpuInstanceCreateComputeInstanceWithPlacement)( + gpuInstance, profileId, placement, computeInstance) + + +cdef nvmlReturn_t _nvmlComputeInstanceDestroy(nvmlComputeInstance_t computeInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlComputeInstanceDestroy + _check_or_init_nvml() + if __nvmlComputeInstanceDestroy == NULL: + with gil: + raise FunctionNotFoundError("function nvmlComputeInstanceDestroy is not found") + return (__nvmlComputeInstanceDestroy)( + computeInstance) + + +cdef nvmlReturn_t _nvmlGpuInstanceGetComputeInstances(nvmlGpuInstance_t gpuInstance, unsigned int profileId, nvmlComputeInstance_t* computeInstances, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceGetComputeInstances + _check_or_init_nvml() + if __nvmlGpuInstanceGetComputeInstances == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceGetComputeInstances is not found") + return (__nvmlGpuInstanceGetComputeInstances)( + gpuInstance, profileId, computeInstances, count) + + +cdef nvmlReturn_t _nvmlGpuInstanceGetComputeInstanceById(nvmlGpuInstance_t gpuInstance, unsigned int id, nvmlComputeInstance_t* computeInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceGetComputeInstanceById + _check_or_init_nvml() + if __nvmlGpuInstanceGetComputeInstanceById == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceGetComputeInstanceById is not found") + return (__nvmlGpuInstanceGetComputeInstanceById)( + gpuInstance, id, computeInstance) + + +cdef nvmlReturn_t _nvmlComputeInstanceGetInfo_v2(nvmlComputeInstance_t computeInstance, nvmlComputeInstanceInfo_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlComputeInstanceGetInfo_v2 + _check_or_init_nvml() + if __nvmlComputeInstanceGetInfo_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlComputeInstanceGetInfo_v2 is not found") + return (__nvmlComputeInstanceGetInfo_v2)( + computeInstance, info) + + +cdef nvmlReturn_t _nvmlDeviceIsMigDeviceHandle(nvmlDevice_t device, unsigned int* isMigDevice) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceIsMigDeviceHandle + _check_or_init_nvml() + if __nvmlDeviceIsMigDeviceHandle == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceIsMigDeviceHandle is not found") + return (__nvmlDeviceIsMigDeviceHandle)( + device, isMigDevice) + + +cdef nvmlReturn_t _nvmlDeviceGetGpuInstanceId(nvmlDevice_t device, unsigned int* id) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGpuInstanceId + _check_or_init_nvml() + if __nvmlDeviceGetGpuInstanceId == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGpuInstanceId is not found") + return (__nvmlDeviceGetGpuInstanceId)( + device, id) + + +cdef nvmlReturn_t _nvmlDeviceGetComputeInstanceId(nvmlDevice_t device, unsigned int* id) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetComputeInstanceId + _check_or_init_nvml() + if __nvmlDeviceGetComputeInstanceId == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetComputeInstanceId is not found") + return (__nvmlDeviceGetComputeInstanceId)( + device, id) + + +cdef nvmlReturn_t _nvmlDeviceGetMaxMigDeviceCount(nvmlDevice_t device, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMaxMigDeviceCount + _check_or_init_nvml() + if __nvmlDeviceGetMaxMigDeviceCount == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMaxMigDeviceCount is not found") + return (__nvmlDeviceGetMaxMigDeviceCount)( + device, count) + + +cdef nvmlReturn_t _nvmlDeviceGetMigDeviceHandleByIndex(nvmlDevice_t device, unsigned int index, nvmlDevice_t* migDevice) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetMigDeviceHandleByIndex + _check_or_init_nvml() + if __nvmlDeviceGetMigDeviceHandleByIndex == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetMigDeviceHandleByIndex is not found") + return (__nvmlDeviceGetMigDeviceHandleByIndex)( + device, index, migDevice) + + +cdef nvmlReturn_t _nvmlDeviceGetDeviceHandleFromMigDeviceHandle(nvmlDevice_t migDevice, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetDeviceHandleFromMigDeviceHandle + _check_or_init_nvml() + if __nvmlDeviceGetDeviceHandleFromMigDeviceHandle == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetDeviceHandleFromMigDeviceHandle is not found") + return (__nvmlDeviceGetDeviceHandleFromMigDeviceHandle)( + migDevice, device) + + +cdef nvmlReturn_t _nvmlDeviceGetCapabilities(nvmlDevice_t device, nvmlDeviceCapabilities_t* caps) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetCapabilities + _check_or_init_nvml() + if __nvmlDeviceGetCapabilities == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetCapabilities is not found") + return (__nvmlDeviceGetCapabilities)( + device, caps) + + +cdef nvmlReturn_t _nvmlDevicePowerSmoothingActivatePresetProfile(nvmlDevice_t device, nvmlPowerSmoothingProfile_t* profile) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDevicePowerSmoothingActivatePresetProfile + _check_or_init_nvml() + if __nvmlDevicePowerSmoothingActivatePresetProfile == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDevicePowerSmoothingActivatePresetProfile is not found") + return (__nvmlDevicePowerSmoothingActivatePresetProfile)( + device, profile) + + +cdef nvmlReturn_t _nvmlDevicePowerSmoothingUpdatePresetProfileParam(nvmlDevice_t device, nvmlPowerSmoothingProfile_t* profile) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDevicePowerSmoothingUpdatePresetProfileParam + _check_or_init_nvml() + if __nvmlDevicePowerSmoothingUpdatePresetProfileParam == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDevicePowerSmoothingUpdatePresetProfileParam is not found") + return (__nvmlDevicePowerSmoothingUpdatePresetProfileParam)( + device, profile) + + +cdef nvmlReturn_t _nvmlDevicePowerSmoothingSetState(nvmlDevice_t device, nvmlPowerSmoothingState_t* state) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDevicePowerSmoothingSetState + _check_or_init_nvml() + if __nvmlDevicePowerSmoothingSetState == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDevicePowerSmoothingSetState is not found") + return (__nvmlDevicePowerSmoothingSetState)( + device, state) + + +cdef nvmlReturn_t _nvmlDeviceGetAddressingMode(nvmlDevice_t device, nvmlDeviceAddressingMode_t* mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetAddressingMode + _check_or_init_nvml() + if __nvmlDeviceGetAddressingMode == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetAddressingMode is not found") + return (__nvmlDeviceGetAddressingMode)( + device, mode) + + +cdef nvmlReturn_t _nvmlDeviceGetRepairStatus(nvmlDevice_t device, nvmlRepairStatus_t* repairStatus) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetRepairStatus + _check_or_init_nvml() + if __nvmlDeviceGetRepairStatus == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetRepairStatus is not found") + return (__nvmlDeviceGetRepairStatus)( + device, repairStatus) + + +cdef nvmlReturn_t _nvmlDeviceGetPowerMizerMode_v1(nvmlDevice_t device, nvmlDevicePowerMizerModes_v1_t* powerMizerMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPowerMizerMode_v1 + _check_or_init_nvml() + if __nvmlDeviceGetPowerMizerMode_v1 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPowerMizerMode_v1 is not found") + return (__nvmlDeviceGetPowerMizerMode_v1)( + device, powerMizerMode) + + +cdef nvmlReturn_t _nvmlDeviceSetPowerMizerMode_v1(nvmlDevice_t device, nvmlDevicePowerMizerModes_v1_t* powerMizerMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetPowerMizerMode_v1 + _check_or_init_nvml() + if __nvmlDeviceSetPowerMizerMode_v1 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetPowerMizerMode_v1 is not found") + return (__nvmlDeviceSetPowerMizerMode_v1)( + device, powerMizerMode) + + +cdef nvmlReturn_t _nvmlDeviceGetPdi(nvmlDevice_t device, nvmlPdi_t* pdi) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetPdi + _check_or_init_nvml() + if __nvmlDeviceGetPdi == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetPdi is not found") + return (__nvmlDeviceGetPdi)( + device, pdi) + + +cdef nvmlReturn_t _nvmlDeviceSetHostname_v1(nvmlDevice_t device, nvmlHostname_v1_t* hostname) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetHostname_v1 + _check_or_init_nvml() + if __nvmlDeviceSetHostname_v1 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetHostname_v1 is not found") + return (__nvmlDeviceSetHostname_v1)( + device, hostname) + + +cdef nvmlReturn_t _nvmlDeviceGetHostname_v1(nvmlDevice_t device, nvmlHostname_v1_t* hostname) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetHostname_v1 + _check_or_init_nvml() + if __nvmlDeviceGetHostname_v1 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetHostname_v1 is not found") + return (__nvmlDeviceGetHostname_v1)( + device, hostname) + + +cdef nvmlReturn_t _nvmlDeviceGetNvLinkInfo(nvmlDevice_t device, nvmlNvLinkInfo_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetNvLinkInfo + _check_or_init_nvml() + if __nvmlDeviceGetNvLinkInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetNvLinkInfo is not found") + return (__nvmlDeviceGetNvLinkInfo)( + device, info) + + +cdef nvmlReturn_t _nvmlDeviceReadWritePRM_v1(nvmlDevice_t device, nvmlPRMTLV_v1_t* buffer) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceReadWritePRM_v1 + _check_or_init_nvml() + if __nvmlDeviceReadWritePRM_v1 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceReadWritePRM_v1 is not found") + return (__nvmlDeviceReadWritePRM_v1)( + device, buffer) + + +cdef nvmlReturn_t _nvmlDeviceGetGpuInstanceProfileInfoByIdV(nvmlDevice_t device, unsigned int profileId, nvmlGpuInstanceProfileInfo_v2_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetGpuInstanceProfileInfoByIdV + _check_or_init_nvml() + if __nvmlDeviceGetGpuInstanceProfileInfoByIdV == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetGpuInstanceProfileInfoByIdV is not found") + return (__nvmlDeviceGetGpuInstanceProfileInfoByIdV)( + device, profileId, info) + + +cdef nvmlReturn_t _nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts(nvmlDevice_t device, nvmlEccSramUniqueUncorrectedErrorCounts_t* errorCounts) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts + _check_or_init_nvml() + if __nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts is not found") + return (__nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts)( + device, errorCounts) + + +cdef nvmlReturn_t _nvmlDeviceGetUnrepairableMemoryFlag_v1(nvmlDevice_t device, nvmlUnrepairableMemoryStatus_v1_t* unrepairableMemoryStatus) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetUnrepairableMemoryFlag_v1 + _check_or_init_nvml() + if __nvmlDeviceGetUnrepairableMemoryFlag_v1 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetUnrepairableMemoryFlag_v1 is not found") + return (__nvmlDeviceGetUnrepairableMemoryFlag_v1)( + device, unrepairableMemoryStatus) + + +cdef nvmlReturn_t _nvmlDeviceReadPRMCounters_v1(nvmlDevice_t device, nvmlPRMCounterList_v1_t* counterList) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceReadPRMCounters_v1 + _check_or_init_nvml() + if __nvmlDeviceReadPRMCounters_v1 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceReadPRMCounters_v1 is not found") + return (__nvmlDeviceReadPRMCounters_v1)( + device, counterList) + + +cdef nvmlReturn_t _nvmlDeviceSetRusdSettings_v1(nvmlDevice_t device, nvmlRusdSettings_v1_t* settings) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetRusdSettings_v1 + _check_or_init_nvml() + if __nvmlDeviceSetRusdSettings_v1 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetRusdSettings_v1 is not found") + return (__nvmlDeviceSetRusdSettings_v1)( + device, settings) + + +cdef nvmlReturn_t _nvmlDeviceVgpuForceGspUnload(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceVgpuForceGspUnload + _check_or_init_nvml() + if __nvmlDeviceVgpuForceGspUnload == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceVgpuForceGspUnload is not found") + return (__nvmlDeviceVgpuForceGspUnload)( + device) + + +cdef nvmlReturn_t _nvmlDeviceGetVgpuSchedulerState_v2(nvmlDevice_t device, nvmlVgpuSchedulerStateInfo_v2_t* pSchedulerStateInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVgpuSchedulerState_v2 + _check_or_init_nvml() + if __nvmlDeviceGetVgpuSchedulerState_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVgpuSchedulerState_v2 is not found") + return (__nvmlDeviceGetVgpuSchedulerState_v2)( + device, pSchedulerStateInfo) + + +cdef nvmlReturn_t _nvmlGpuInstanceGetVgpuSchedulerState_v2(nvmlGpuInstance_t gpuInstance, nvmlVgpuSchedulerStateInfo_v2_t* pSchedulerStateInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceGetVgpuSchedulerState_v2 + _check_or_init_nvml() + if __nvmlGpuInstanceGetVgpuSchedulerState_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceGetVgpuSchedulerState_v2 is not found") + return (__nvmlGpuInstanceGetVgpuSchedulerState_v2)( + gpuInstance, pSchedulerStateInfo) + + +cdef nvmlReturn_t _nvmlDeviceGetVgpuSchedulerLog_v2(nvmlDevice_t device, nvmlVgpuSchedulerLogInfo_v2_t* pSchedulerLogInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceGetVgpuSchedulerLog_v2 + _check_or_init_nvml() + if __nvmlDeviceGetVgpuSchedulerLog_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceGetVgpuSchedulerLog_v2 is not found") + return (__nvmlDeviceGetVgpuSchedulerLog_v2)( + device, pSchedulerLogInfo) + + +cdef nvmlReturn_t _nvmlGpuInstanceGetVgpuSchedulerLog_v2(nvmlGpuInstance_t gpuInstance, nvmlVgpuSchedulerLogInfo_v2_t* pSchedulerLogInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceGetVgpuSchedulerLog_v2 + _check_or_init_nvml() + if __nvmlGpuInstanceGetVgpuSchedulerLog_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceGetVgpuSchedulerLog_v2 is not found") + return (__nvmlGpuInstanceGetVgpuSchedulerLog_v2)( + gpuInstance, pSchedulerLogInfo) + + +cdef nvmlReturn_t _nvmlDeviceSetVgpuSchedulerState_v2(nvmlDevice_t device, nvmlVgpuSchedulerState_v2_t* pSchedulerState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlDeviceSetVgpuSchedulerState_v2 + _check_or_init_nvml() + if __nvmlDeviceSetVgpuSchedulerState_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlDeviceSetVgpuSchedulerState_v2 is not found") + return (__nvmlDeviceSetVgpuSchedulerState_v2)( + device, pSchedulerState) + + +cdef nvmlReturn_t _nvmlGpuInstanceSetVgpuSchedulerState_v2(nvmlGpuInstance_t gpuInstance, nvmlVgpuSchedulerState_v2_t* pSchedulerState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + global __nvmlGpuInstanceSetVgpuSchedulerState_v2 + _check_or_init_nvml() + if __nvmlGpuInstanceSetVgpuSchedulerState_v2 == NULL: + with gil: + raise FunctionNotFoundError("function nvmlGpuInstanceSetVgpuSchedulerState_v2 is not found") + return (__nvmlGpuInstanceSetVgpuSchedulerState_v2)( + gpuInstance, pSchedulerState) diff --git a/cuda/_cuda/cnvrtc.pxd.in b/cuda_bindings/cuda/bindings/_internal/nvrtc.pxd similarity index 54% rename from cuda/_cuda/cnvrtc.pxd.in rename to cuda_bindings/cuda/bindings/_internal/nvrtc.pxd index 4eccbee8513..020f113c03b 100644 --- a/cuda/_cuda/cnvrtc.pxd.in +++ b/cuda_bindings/cuda/bindings/_internal/nvrtc.pxd @@ -1,114 +1,43 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. +# SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # -# Please refer to the NVIDIA end user license agreement (EULA) associated -# with this source code for terms and conditions that govern your use of -# this software. Any use, reproduction, disclosure, or distribution of -# this software and related documentation outside the terms of the EULA -# is strictly prohibited. -from cuda.cnvrtc cimport * +# SPDX-License-Identifier: Apache-2.0 +# +# This code was automatically generated across versions from 12.9.0 to 13.3.0. Do not modify it directly. -{{if 'nvrtcGetErrorString' in found_functions}} +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=ff79428bd0afac112d0a9f6131f9ed097b8d0ebc4574444a0e4a41e7f6e260d0 +from ..cynvrtc cimport * -cdef const char* _nvrtcGetErrorString(nvrtcResult result) except ?NULL nogil -{{endif}} -{{if 'nvrtcVersion' in found_functions}} +############################################################################### +# Wrapper functions +############################################################################### +cdef const char* _nvrtcGetErrorString(nvrtcResult result) except?NULL nogil cdef nvrtcResult _nvrtcVersion(int* major, int* minor) except ?NVRTC_ERROR_INVALID_INPUT nogil -{{endif}} - -{{if 'nvrtcGetNumSupportedArchs' in found_functions}} - cdef nvrtcResult _nvrtcGetNumSupportedArchs(int* numArchs) except ?NVRTC_ERROR_INVALID_INPUT nogil -{{endif}} - -{{if 'nvrtcGetSupportedArchs' in found_functions}} - cdef nvrtcResult _nvrtcGetSupportedArchs(int* supportedArchs) except ?NVRTC_ERROR_INVALID_INPUT nogil -{{endif}} - -{{if 'nvrtcCreateProgram' in found_functions}} - cdef nvrtcResult _nvrtcCreateProgram(nvrtcProgram* prog, const char* src, const char* name, int numHeaders, const char** headers, const char** includeNames) except ?NVRTC_ERROR_INVALID_INPUT nogil -{{endif}} - -{{if 'nvrtcDestroyProgram' in found_functions}} - cdef nvrtcResult _nvrtcDestroyProgram(nvrtcProgram* prog) except ?NVRTC_ERROR_INVALID_INPUT nogil -{{endif}} - -{{if 'nvrtcCompileProgram' in found_functions}} - cdef nvrtcResult _nvrtcCompileProgram(nvrtcProgram prog, int numOptions, const char** options) except ?NVRTC_ERROR_INVALID_INPUT nogil -{{endif}} - -{{if 'nvrtcGetPTXSize' in found_functions}} - cdef nvrtcResult _nvrtcGetPTXSize(nvrtcProgram prog, size_t* ptxSizeRet) except ?NVRTC_ERROR_INVALID_INPUT nogil -{{endif}} - -{{if 'nvrtcGetPTX' in found_functions}} - cdef nvrtcResult _nvrtcGetPTX(nvrtcProgram prog, char* ptx) except ?NVRTC_ERROR_INVALID_INPUT nogil -{{endif}} - -{{if 'nvrtcGetCUBINSize' in found_functions}} - cdef nvrtcResult _nvrtcGetCUBINSize(nvrtcProgram prog, size_t* cubinSizeRet) except ?NVRTC_ERROR_INVALID_INPUT nogil -{{endif}} - -{{if 'nvrtcGetCUBIN' in found_functions}} - cdef nvrtcResult _nvrtcGetCUBIN(nvrtcProgram prog, char* cubin) except ?NVRTC_ERROR_INVALID_INPUT nogil -{{endif}} - -{{if 'nvrtcGetNVVMSize' in found_functions}} - -cdef nvrtcResult _nvrtcGetNVVMSize(nvrtcProgram prog, size_t* nvvmSizeRet) except ?NVRTC_ERROR_INVALID_INPUT nogil -{{endif}} - -{{if 'nvrtcGetNVVM' in found_functions}} - -cdef nvrtcResult _nvrtcGetNVVM(nvrtcProgram prog, char* nvvm) except ?NVRTC_ERROR_INVALID_INPUT nogil -{{endif}} - -{{if 'nvrtcGetLTOIRSize' in found_functions}} - cdef nvrtcResult _nvrtcGetLTOIRSize(nvrtcProgram prog, size_t* LTOIRSizeRet) except ?NVRTC_ERROR_INVALID_INPUT nogil -{{endif}} - -{{if 'nvrtcGetLTOIR' in found_functions}} - cdef nvrtcResult _nvrtcGetLTOIR(nvrtcProgram prog, char* LTOIR) except ?NVRTC_ERROR_INVALID_INPUT nogil -{{endif}} - -{{if 'nvrtcGetOptiXIRSize' in found_functions}} - cdef nvrtcResult _nvrtcGetOptiXIRSize(nvrtcProgram prog, size_t* optixirSizeRet) except ?NVRTC_ERROR_INVALID_INPUT nogil -{{endif}} - -{{if 'nvrtcGetOptiXIR' in found_functions}} - cdef nvrtcResult _nvrtcGetOptiXIR(nvrtcProgram prog, char* optixir) except ?NVRTC_ERROR_INVALID_INPUT nogil -{{endif}} - -{{if 'nvrtcGetProgramLogSize' in found_functions}} - cdef nvrtcResult _nvrtcGetProgramLogSize(nvrtcProgram prog, size_t* logSizeRet) except ?NVRTC_ERROR_INVALID_INPUT nogil -{{endif}} - -{{if 'nvrtcGetProgramLog' in found_functions}} - cdef nvrtcResult _nvrtcGetProgramLog(nvrtcProgram prog, char* log) except ?NVRTC_ERROR_INVALID_INPUT nogil -{{endif}} - -{{if 'nvrtcAddNameExpression' in found_functions}} - cdef nvrtcResult _nvrtcAddNameExpression(nvrtcProgram prog, const char* name_expression) except ?NVRTC_ERROR_INVALID_INPUT nogil -{{endif}} - -{{if 'nvrtcGetLoweredName' in found_functions}} - cdef nvrtcResult _nvrtcGetLoweredName(nvrtcProgram prog, const char* name_expression, const char** lowered_name) except ?NVRTC_ERROR_INVALID_INPUT nogil -{{endif}} - +cdef nvrtcResult _nvrtcGetPCHHeapSize(size_t* ret) except ?NVRTC_ERROR_INVALID_INPUT nogil +cdef nvrtcResult _nvrtcSetPCHHeapSize(size_t size) except ?NVRTC_ERROR_INVALID_INPUT nogil +cdef nvrtcResult _nvrtcGetPCHCreateStatus(nvrtcProgram prog) except ?NVRTC_ERROR_INVALID_INPUT nogil +cdef nvrtcResult _nvrtcGetPCHHeapSizeRequired(nvrtcProgram prog, size_t* size) except ?NVRTC_ERROR_INVALID_INPUT nogil +cdef nvrtcResult _nvrtcSetFlowCallback(nvrtcProgram prog, void * callback, void* payload) except ?NVRTC_ERROR_INVALID_INPUT nogil +cdef nvrtcResult _nvrtcGetTileIRSize(nvrtcProgram prog, size_t* TileIRSizeRet) except ?NVRTC_ERROR_INVALID_INPUT nogil +cdef nvrtcResult _nvrtcGetTileIR(nvrtcProgram prog, char* TileIR) except ?NVRTC_ERROR_INVALID_INPUT nogil +cdef nvrtcResult _nvrtcInstallBundledHeaders(const char* installPath, unsigned int flags, const char** errorLog) except ?NVRTC_ERROR_INVALID_INPUT nogil +cdef nvrtcResult _nvrtcGetBundledHeadersInfo(nvrtcBundledHeadersInfo* info, const char** errorLog) except ?NVRTC_ERROR_INVALID_INPUT nogil +cdef nvrtcResult _nvrtcRemoveBundledHeaders(const char* installPath, const char** errorLog) except ?NVRTC_ERROR_INVALID_INPUT nogil diff --git a/cuda_bindings/cuda/bindings/_internal/nvrtc_linux.pyx b/cuda_bindings/cuda/bindings/_internal/nvrtc_linux.pyx new file mode 100644 index 00000000000..bc635a3ca95 --- /dev/null +++ b/cuda_bindings/cuda/bindings/_internal/nvrtc_linux.pyx @@ -0,0 +1,686 @@ +# SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +# This code was automatically generated across versions from 12.9.0 to 13.3.0. Do not modify it directly. +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=0ca6f301335e0e0a3b70c6fddc4f54b7930b547f18e05f0ede5a9e0f437c79f8 + + +# <<<< PREAMBLE CONTENT >>>> + +cdef extern from "": + void* _cyb_dlsym "dlsym"(void*, const char*) nogil + const void * _cyb_RTLD_DEFAULT "RTLD_DEFAULT" + +from libc.stdint cimport intptr_t as _cyb_intptr_t + +import threading as _cyb_threading + +cdef bint _cyb___py_nvrtc_init = False +cdef dict _cyb_func_ptrs = None +cdef object _cyb_symbol_lock = _cyb_threading.Lock() + +# <<<< END OF PREAMBLE CONTENT >>>> + +from libc.stdint cimport uintptr_t + +from .utils import FunctionNotFoundError, NotSupportedError +from cuda.pathfinder import load_nvidia_dynamic_lib + + +############################################################################### +# Wrapper init +############################################################################### + +cdef void* __nvrtcGetErrorString = NULL +cdef void* __nvrtcVersion = NULL +cdef void* __nvrtcGetNumSupportedArchs = NULL +cdef void* __nvrtcGetSupportedArchs = NULL +cdef void* __nvrtcCreateProgram = NULL +cdef void* __nvrtcDestroyProgram = NULL +cdef void* __nvrtcCompileProgram = NULL +cdef void* __nvrtcGetPTXSize = NULL +cdef void* __nvrtcGetPTX = NULL +cdef void* __nvrtcGetCUBINSize = NULL +cdef void* __nvrtcGetCUBIN = NULL +cdef void* __nvrtcGetLTOIRSize = NULL +cdef void* __nvrtcGetLTOIR = NULL +cdef void* __nvrtcGetOptiXIRSize = NULL +cdef void* __nvrtcGetOptiXIR = NULL +cdef void* __nvrtcGetProgramLogSize = NULL +cdef void* __nvrtcGetProgramLog = NULL +cdef void* __nvrtcAddNameExpression = NULL +cdef void* __nvrtcGetLoweredName = NULL +cdef void* __nvrtcGetPCHHeapSize = NULL +cdef void* __nvrtcSetPCHHeapSize = NULL +cdef void* __nvrtcGetPCHCreateStatus = NULL +cdef void* __nvrtcGetPCHHeapSizeRequired = NULL +cdef void* __nvrtcSetFlowCallback = NULL +cdef void* __nvrtcGetTileIRSize = NULL +cdef void* __nvrtcGetTileIR = NULL +cdef void* __nvrtcInstallBundledHeaders = NULL +cdef void* __nvrtcGetBundledHeadersInfo = NULL +cdef void* __nvrtcRemoveBundledHeaders = NULL + +cdef int _init_nvrtc() except -1 nogil: + global _cyb___py_nvrtc_init + cdef void* handle = NULL + with gil, _cyb_symbol_lock: + if _cyb___py_nvrtc_init: return 0 + + global __nvrtcGetErrorString + __nvrtcGetErrorString = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvrtcGetErrorString') + if __nvrtcGetErrorString == NULL: + if handle == NULL: + handle = load_library() + __nvrtcGetErrorString = _cyb_dlsym(handle, 'nvrtcGetErrorString') + + global __nvrtcVersion + __nvrtcVersion = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvrtcVersion') + if __nvrtcVersion == NULL: + if handle == NULL: + handle = load_library() + __nvrtcVersion = _cyb_dlsym(handle, 'nvrtcVersion') + + global __nvrtcGetNumSupportedArchs + __nvrtcGetNumSupportedArchs = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvrtcGetNumSupportedArchs') + if __nvrtcGetNumSupportedArchs == NULL: + if handle == NULL: + handle = load_library() + __nvrtcGetNumSupportedArchs = _cyb_dlsym(handle, 'nvrtcGetNumSupportedArchs') + + global __nvrtcGetSupportedArchs + __nvrtcGetSupportedArchs = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvrtcGetSupportedArchs') + if __nvrtcGetSupportedArchs == NULL: + if handle == NULL: + handle = load_library() + __nvrtcGetSupportedArchs = _cyb_dlsym(handle, 'nvrtcGetSupportedArchs') + + global __nvrtcCreateProgram + __nvrtcCreateProgram = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvrtcCreateProgram') + if __nvrtcCreateProgram == NULL: + if handle == NULL: + handle = load_library() + __nvrtcCreateProgram = _cyb_dlsym(handle, 'nvrtcCreateProgram') + + global __nvrtcDestroyProgram + __nvrtcDestroyProgram = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvrtcDestroyProgram') + if __nvrtcDestroyProgram == NULL: + if handle == NULL: + handle = load_library() + __nvrtcDestroyProgram = _cyb_dlsym(handle, 'nvrtcDestroyProgram') + + global __nvrtcCompileProgram + __nvrtcCompileProgram = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvrtcCompileProgram') + if __nvrtcCompileProgram == NULL: + if handle == NULL: + handle = load_library() + __nvrtcCompileProgram = _cyb_dlsym(handle, 'nvrtcCompileProgram') + + global __nvrtcGetPTXSize + __nvrtcGetPTXSize = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvrtcGetPTXSize') + if __nvrtcGetPTXSize == NULL: + if handle == NULL: + handle = load_library() + __nvrtcGetPTXSize = _cyb_dlsym(handle, 'nvrtcGetPTXSize') + + global __nvrtcGetPTX + __nvrtcGetPTX = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvrtcGetPTX') + if __nvrtcGetPTX == NULL: + if handle == NULL: + handle = load_library() + __nvrtcGetPTX = _cyb_dlsym(handle, 'nvrtcGetPTX') + + global __nvrtcGetCUBINSize + __nvrtcGetCUBINSize = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvrtcGetCUBINSize') + if __nvrtcGetCUBINSize == NULL: + if handle == NULL: + handle = load_library() + __nvrtcGetCUBINSize = _cyb_dlsym(handle, 'nvrtcGetCUBINSize') + + global __nvrtcGetCUBIN + __nvrtcGetCUBIN = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvrtcGetCUBIN') + if __nvrtcGetCUBIN == NULL: + if handle == NULL: + handle = load_library() + __nvrtcGetCUBIN = _cyb_dlsym(handle, 'nvrtcGetCUBIN') + + global __nvrtcGetLTOIRSize + __nvrtcGetLTOIRSize = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvrtcGetLTOIRSize') + if __nvrtcGetLTOIRSize == NULL: + if handle == NULL: + handle = load_library() + __nvrtcGetLTOIRSize = _cyb_dlsym(handle, 'nvrtcGetLTOIRSize') + + global __nvrtcGetLTOIR + __nvrtcGetLTOIR = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvrtcGetLTOIR') + if __nvrtcGetLTOIR == NULL: + if handle == NULL: + handle = load_library() + __nvrtcGetLTOIR = _cyb_dlsym(handle, 'nvrtcGetLTOIR') + + global __nvrtcGetOptiXIRSize + __nvrtcGetOptiXIRSize = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvrtcGetOptiXIRSize') + if __nvrtcGetOptiXIRSize == NULL: + if handle == NULL: + handle = load_library() + __nvrtcGetOptiXIRSize = _cyb_dlsym(handle, 'nvrtcGetOptiXIRSize') + + global __nvrtcGetOptiXIR + __nvrtcGetOptiXIR = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvrtcGetOptiXIR') + if __nvrtcGetOptiXIR == NULL: + if handle == NULL: + handle = load_library() + __nvrtcGetOptiXIR = _cyb_dlsym(handle, 'nvrtcGetOptiXIR') + + global __nvrtcGetProgramLogSize + __nvrtcGetProgramLogSize = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvrtcGetProgramLogSize') + if __nvrtcGetProgramLogSize == NULL: + if handle == NULL: + handle = load_library() + __nvrtcGetProgramLogSize = _cyb_dlsym(handle, 'nvrtcGetProgramLogSize') + + global __nvrtcGetProgramLog + __nvrtcGetProgramLog = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvrtcGetProgramLog') + if __nvrtcGetProgramLog == NULL: + if handle == NULL: + handle = load_library() + __nvrtcGetProgramLog = _cyb_dlsym(handle, 'nvrtcGetProgramLog') + + global __nvrtcAddNameExpression + __nvrtcAddNameExpression = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvrtcAddNameExpression') + if __nvrtcAddNameExpression == NULL: + if handle == NULL: + handle = load_library() + __nvrtcAddNameExpression = _cyb_dlsym(handle, 'nvrtcAddNameExpression') + + global __nvrtcGetLoweredName + __nvrtcGetLoweredName = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvrtcGetLoweredName') + if __nvrtcGetLoweredName == NULL: + if handle == NULL: + handle = load_library() + __nvrtcGetLoweredName = _cyb_dlsym(handle, 'nvrtcGetLoweredName') + + global __nvrtcGetPCHHeapSize + __nvrtcGetPCHHeapSize = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvrtcGetPCHHeapSize') + if __nvrtcGetPCHHeapSize == NULL: + if handle == NULL: + handle = load_library() + __nvrtcGetPCHHeapSize = _cyb_dlsym(handle, 'nvrtcGetPCHHeapSize') + + global __nvrtcSetPCHHeapSize + __nvrtcSetPCHHeapSize = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvrtcSetPCHHeapSize') + if __nvrtcSetPCHHeapSize == NULL: + if handle == NULL: + handle = load_library() + __nvrtcSetPCHHeapSize = _cyb_dlsym(handle, 'nvrtcSetPCHHeapSize') + + global __nvrtcGetPCHCreateStatus + __nvrtcGetPCHCreateStatus = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvrtcGetPCHCreateStatus') + if __nvrtcGetPCHCreateStatus == NULL: + if handle == NULL: + handle = load_library() + __nvrtcGetPCHCreateStatus = _cyb_dlsym(handle, 'nvrtcGetPCHCreateStatus') + + global __nvrtcGetPCHHeapSizeRequired + __nvrtcGetPCHHeapSizeRequired = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvrtcGetPCHHeapSizeRequired') + if __nvrtcGetPCHHeapSizeRequired == NULL: + if handle == NULL: + handle = load_library() + __nvrtcGetPCHHeapSizeRequired = _cyb_dlsym(handle, 'nvrtcGetPCHHeapSizeRequired') + + global __nvrtcSetFlowCallback + __nvrtcSetFlowCallback = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvrtcSetFlowCallback') + if __nvrtcSetFlowCallback == NULL: + if handle == NULL: + handle = load_library() + __nvrtcSetFlowCallback = _cyb_dlsym(handle, 'nvrtcSetFlowCallback') + + global __nvrtcGetTileIRSize + __nvrtcGetTileIRSize = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvrtcGetTileIRSize') + if __nvrtcGetTileIRSize == NULL: + if handle == NULL: + handle = load_library() + __nvrtcGetTileIRSize = _cyb_dlsym(handle, 'nvrtcGetTileIRSize') + + global __nvrtcGetTileIR + __nvrtcGetTileIR = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvrtcGetTileIR') + if __nvrtcGetTileIR == NULL: + if handle == NULL: + handle = load_library() + __nvrtcGetTileIR = _cyb_dlsym(handle, 'nvrtcGetTileIR') + + global __nvrtcInstallBundledHeaders + __nvrtcInstallBundledHeaders = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvrtcInstallBundledHeaders') + if __nvrtcInstallBundledHeaders == NULL: + if handle == NULL: + handle = load_library() + __nvrtcInstallBundledHeaders = _cyb_dlsym(handle, 'nvrtcInstallBundledHeaders') + + global __nvrtcGetBundledHeadersInfo + __nvrtcGetBundledHeadersInfo = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvrtcGetBundledHeadersInfo') + if __nvrtcGetBundledHeadersInfo == NULL: + if handle == NULL: + handle = load_library() + __nvrtcGetBundledHeadersInfo = _cyb_dlsym(handle, 'nvrtcGetBundledHeadersInfo') + + global __nvrtcRemoveBundledHeaders + __nvrtcRemoveBundledHeaders = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvrtcRemoveBundledHeaders') + if __nvrtcRemoveBundledHeaders == NULL: + if handle == NULL: + handle = load_library() + __nvrtcRemoveBundledHeaders = _cyb_dlsym(handle, 'nvrtcRemoveBundledHeaders') + + _cyb___py_nvrtc_init = True + return 0 + +cdef inline int _check_or_init_nvrtc() except -1 nogil: + if _cyb___py_nvrtc_init: + return 0 + + return _init_nvrtc() + + +cpdef dict _inspect_function_pointers(): + global _cyb_func_ptrs + if _cyb_func_ptrs is not None: + return _cyb_func_ptrs + + _check_or_init_nvrtc() + cdef dict data = {} + global __nvrtcGetErrorString + data["__nvrtcGetErrorString"] = <_cyb_intptr_t>__nvrtcGetErrorString + + global __nvrtcVersion + data["__nvrtcVersion"] = <_cyb_intptr_t>__nvrtcVersion + + global __nvrtcGetNumSupportedArchs + data["__nvrtcGetNumSupportedArchs"] = <_cyb_intptr_t>__nvrtcGetNumSupportedArchs + + global __nvrtcGetSupportedArchs + data["__nvrtcGetSupportedArchs"] = <_cyb_intptr_t>__nvrtcGetSupportedArchs + + global __nvrtcCreateProgram + data["__nvrtcCreateProgram"] = <_cyb_intptr_t>__nvrtcCreateProgram + + global __nvrtcDestroyProgram + data["__nvrtcDestroyProgram"] = <_cyb_intptr_t>__nvrtcDestroyProgram + + global __nvrtcCompileProgram + data["__nvrtcCompileProgram"] = <_cyb_intptr_t>__nvrtcCompileProgram + + global __nvrtcGetPTXSize + data["__nvrtcGetPTXSize"] = <_cyb_intptr_t>__nvrtcGetPTXSize + + global __nvrtcGetPTX + data["__nvrtcGetPTX"] = <_cyb_intptr_t>__nvrtcGetPTX + + global __nvrtcGetCUBINSize + data["__nvrtcGetCUBINSize"] = <_cyb_intptr_t>__nvrtcGetCUBINSize + + global __nvrtcGetCUBIN + data["__nvrtcGetCUBIN"] = <_cyb_intptr_t>__nvrtcGetCUBIN + + global __nvrtcGetLTOIRSize + data["__nvrtcGetLTOIRSize"] = <_cyb_intptr_t>__nvrtcGetLTOIRSize + + global __nvrtcGetLTOIR + data["__nvrtcGetLTOIR"] = <_cyb_intptr_t>__nvrtcGetLTOIR + + global __nvrtcGetOptiXIRSize + data["__nvrtcGetOptiXIRSize"] = <_cyb_intptr_t>__nvrtcGetOptiXIRSize + + global __nvrtcGetOptiXIR + data["__nvrtcGetOptiXIR"] = <_cyb_intptr_t>__nvrtcGetOptiXIR + + global __nvrtcGetProgramLogSize + data["__nvrtcGetProgramLogSize"] = <_cyb_intptr_t>__nvrtcGetProgramLogSize + + global __nvrtcGetProgramLog + data["__nvrtcGetProgramLog"] = <_cyb_intptr_t>__nvrtcGetProgramLog + + global __nvrtcAddNameExpression + data["__nvrtcAddNameExpression"] = <_cyb_intptr_t>__nvrtcAddNameExpression + + global __nvrtcGetLoweredName + data["__nvrtcGetLoweredName"] = <_cyb_intptr_t>__nvrtcGetLoweredName + + global __nvrtcGetPCHHeapSize + data["__nvrtcGetPCHHeapSize"] = <_cyb_intptr_t>__nvrtcGetPCHHeapSize + + global __nvrtcSetPCHHeapSize + data["__nvrtcSetPCHHeapSize"] = <_cyb_intptr_t>__nvrtcSetPCHHeapSize + + global __nvrtcGetPCHCreateStatus + data["__nvrtcGetPCHCreateStatus"] = <_cyb_intptr_t>__nvrtcGetPCHCreateStatus + + global __nvrtcGetPCHHeapSizeRequired + data["__nvrtcGetPCHHeapSizeRequired"] = <_cyb_intptr_t>__nvrtcGetPCHHeapSizeRequired + + global __nvrtcSetFlowCallback + data["__nvrtcSetFlowCallback"] = <_cyb_intptr_t>__nvrtcSetFlowCallback + + global __nvrtcGetTileIRSize + data["__nvrtcGetTileIRSize"] = <_cyb_intptr_t>__nvrtcGetTileIRSize + + global __nvrtcGetTileIR + data["__nvrtcGetTileIR"] = <_cyb_intptr_t>__nvrtcGetTileIR + + global __nvrtcInstallBundledHeaders + data["__nvrtcInstallBundledHeaders"] = <_cyb_intptr_t>__nvrtcInstallBundledHeaders + + global __nvrtcGetBundledHeadersInfo + data["__nvrtcGetBundledHeadersInfo"] = <_cyb_intptr_t>__nvrtcGetBundledHeadersInfo + + global __nvrtcRemoveBundledHeaders + data["__nvrtcRemoveBundledHeaders"] = <_cyb_intptr_t>__nvrtcRemoveBundledHeaders + _cyb_func_ptrs = data + return data + + +cpdef _inspect_function_pointer(str name): + global _cyb_func_ptrs + if _cyb_func_ptrs is None: + _cyb_func_ptrs = _inspect_function_pointers() + return _cyb_func_ptrs[name] + + + + +cdef void* load_library() except* with gil: + cdef uintptr_t handle = load_nvidia_dynamic_lib("nvrtc")._handle_uint + return handle + + +############################################################################### +# Wrapper functions +############################################################################### + +cdef const char* _nvrtcGetErrorString(nvrtcResult result) except?NULL nogil: + global __nvrtcGetErrorString + _check_or_init_nvrtc() + if __nvrtcGetErrorString == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcGetErrorString is not found") + return (__nvrtcGetErrorString)( + result) + + +cdef nvrtcResult _nvrtcVersion(int* major, int* minor) except ?NVRTC_ERROR_INVALID_INPUT nogil: + global __nvrtcVersion + _check_or_init_nvrtc() + if __nvrtcVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcVersion is not found") + return (__nvrtcVersion)( + major, minor) + + +cdef nvrtcResult _nvrtcGetNumSupportedArchs(int* numArchs) except ?NVRTC_ERROR_INVALID_INPUT nogil: + global __nvrtcGetNumSupportedArchs + _check_or_init_nvrtc() + if __nvrtcGetNumSupportedArchs == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcGetNumSupportedArchs is not found") + return (__nvrtcGetNumSupportedArchs)( + numArchs) + + +cdef nvrtcResult _nvrtcGetSupportedArchs(int* supportedArchs) except ?NVRTC_ERROR_INVALID_INPUT nogil: + global __nvrtcGetSupportedArchs + _check_or_init_nvrtc() + if __nvrtcGetSupportedArchs == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcGetSupportedArchs is not found") + return (__nvrtcGetSupportedArchs)( + supportedArchs) + + +cdef nvrtcResult _nvrtcCreateProgram(nvrtcProgram* prog, const char* src, const char* name, int numHeaders, const char** headers, const char** includeNames) except ?NVRTC_ERROR_INVALID_INPUT nogil: + global __nvrtcCreateProgram + _check_or_init_nvrtc() + if __nvrtcCreateProgram == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcCreateProgram is not found") + return (__nvrtcCreateProgram)( + prog, src, name, numHeaders, headers, includeNames) + + +cdef nvrtcResult _nvrtcDestroyProgram(nvrtcProgram* prog) except ?NVRTC_ERROR_INVALID_INPUT nogil: + global __nvrtcDestroyProgram + _check_or_init_nvrtc() + if __nvrtcDestroyProgram == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcDestroyProgram is not found") + return (__nvrtcDestroyProgram)( + prog) + + +cdef nvrtcResult _nvrtcCompileProgram(nvrtcProgram prog, int numOptions, const char** options) except ?NVRTC_ERROR_INVALID_INPUT nogil: + global __nvrtcCompileProgram + _check_or_init_nvrtc() + if __nvrtcCompileProgram == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcCompileProgram is not found") + return (__nvrtcCompileProgram)( + prog, numOptions, options) + + +cdef nvrtcResult _nvrtcGetPTXSize(nvrtcProgram prog, size_t* ptxSizeRet) except ?NVRTC_ERROR_INVALID_INPUT nogil: + global __nvrtcGetPTXSize + _check_or_init_nvrtc() + if __nvrtcGetPTXSize == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcGetPTXSize is not found") + return (__nvrtcGetPTXSize)( + prog, ptxSizeRet) + + +cdef nvrtcResult _nvrtcGetPTX(nvrtcProgram prog, char* ptx) except ?NVRTC_ERROR_INVALID_INPUT nogil: + global __nvrtcGetPTX + _check_or_init_nvrtc() + if __nvrtcGetPTX == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcGetPTX is not found") + return (__nvrtcGetPTX)( + prog, ptx) + + +cdef nvrtcResult _nvrtcGetCUBINSize(nvrtcProgram prog, size_t* cubinSizeRet) except ?NVRTC_ERROR_INVALID_INPUT nogil: + global __nvrtcGetCUBINSize + _check_or_init_nvrtc() + if __nvrtcGetCUBINSize == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcGetCUBINSize is not found") + return (__nvrtcGetCUBINSize)( + prog, cubinSizeRet) + + +cdef nvrtcResult _nvrtcGetCUBIN(nvrtcProgram prog, char* cubin) except ?NVRTC_ERROR_INVALID_INPUT nogil: + global __nvrtcGetCUBIN + _check_or_init_nvrtc() + if __nvrtcGetCUBIN == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcGetCUBIN is not found") + return (__nvrtcGetCUBIN)( + prog, cubin) + + +cdef nvrtcResult _nvrtcGetLTOIRSize(nvrtcProgram prog, size_t* LTOIRSizeRet) except ?NVRTC_ERROR_INVALID_INPUT nogil: + global __nvrtcGetLTOIRSize + _check_or_init_nvrtc() + if __nvrtcGetLTOIRSize == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcGetLTOIRSize is not found") + return (__nvrtcGetLTOIRSize)( + prog, LTOIRSizeRet) + + +cdef nvrtcResult _nvrtcGetLTOIR(nvrtcProgram prog, char* LTOIR) except ?NVRTC_ERROR_INVALID_INPUT nogil: + global __nvrtcGetLTOIR + _check_or_init_nvrtc() + if __nvrtcGetLTOIR == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcGetLTOIR is not found") + return (__nvrtcGetLTOIR)( + prog, LTOIR) + + +cdef nvrtcResult _nvrtcGetOptiXIRSize(nvrtcProgram prog, size_t* optixirSizeRet) except ?NVRTC_ERROR_INVALID_INPUT nogil: + global __nvrtcGetOptiXIRSize + _check_or_init_nvrtc() + if __nvrtcGetOptiXIRSize == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcGetOptiXIRSize is not found") + return (__nvrtcGetOptiXIRSize)( + prog, optixirSizeRet) + + +cdef nvrtcResult _nvrtcGetOptiXIR(nvrtcProgram prog, char* optixir) except ?NVRTC_ERROR_INVALID_INPUT nogil: + global __nvrtcGetOptiXIR + _check_or_init_nvrtc() + if __nvrtcGetOptiXIR == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcGetOptiXIR is not found") + return (__nvrtcGetOptiXIR)( + prog, optixir) + + +cdef nvrtcResult _nvrtcGetProgramLogSize(nvrtcProgram prog, size_t* logSizeRet) except ?NVRTC_ERROR_INVALID_INPUT nogil: + global __nvrtcGetProgramLogSize + _check_or_init_nvrtc() + if __nvrtcGetProgramLogSize == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcGetProgramLogSize is not found") + return (__nvrtcGetProgramLogSize)( + prog, logSizeRet) + + +cdef nvrtcResult _nvrtcGetProgramLog(nvrtcProgram prog, char* log) except ?NVRTC_ERROR_INVALID_INPUT nogil: + global __nvrtcGetProgramLog + _check_or_init_nvrtc() + if __nvrtcGetProgramLog == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcGetProgramLog is not found") + return (__nvrtcGetProgramLog)( + prog, log) + + +cdef nvrtcResult _nvrtcAddNameExpression(nvrtcProgram prog, const char* name_expression) except ?NVRTC_ERROR_INVALID_INPUT nogil: + global __nvrtcAddNameExpression + _check_or_init_nvrtc() + if __nvrtcAddNameExpression == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcAddNameExpression is not found") + return (__nvrtcAddNameExpression)( + prog, name_expression) + + +cdef nvrtcResult _nvrtcGetLoweredName(nvrtcProgram prog, const char* name_expression, const char** lowered_name) except ?NVRTC_ERROR_INVALID_INPUT nogil: + global __nvrtcGetLoweredName + _check_or_init_nvrtc() + if __nvrtcGetLoweredName == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcGetLoweredName is not found") + return (__nvrtcGetLoweredName)( + prog, name_expression, lowered_name) + + +cdef nvrtcResult _nvrtcGetPCHHeapSize(size_t* ret) except ?NVRTC_ERROR_INVALID_INPUT nogil: + global __nvrtcGetPCHHeapSize + _check_or_init_nvrtc() + if __nvrtcGetPCHHeapSize == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcGetPCHHeapSize is not found") + return (__nvrtcGetPCHHeapSize)( + ret) + + +cdef nvrtcResult _nvrtcSetPCHHeapSize(size_t size) except ?NVRTC_ERROR_INVALID_INPUT nogil: + global __nvrtcSetPCHHeapSize + _check_or_init_nvrtc() + if __nvrtcSetPCHHeapSize == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcSetPCHHeapSize is not found") + return (__nvrtcSetPCHHeapSize)( + size) + + +cdef nvrtcResult _nvrtcGetPCHCreateStatus(nvrtcProgram prog) except ?NVRTC_ERROR_INVALID_INPUT nogil: + global __nvrtcGetPCHCreateStatus + _check_or_init_nvrtc() + if __nvrtcGetPCHCreateStatus == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcGetPCHCreateStatus is not found") + return (__nvrtcGetPCHCreateStatus)( + prog) + + +cdef nvrtcResult _nvrtcGetPCHHeapSizeRequired(nvrtcProgram prog, size_t* size) except ?NVRTC_ERROR_INVALID_INPUT nogil: + global __nvrtcGetPCHHeapSizeRequired + _check_or_init_nvrtc() + if __nvrtcGetPCHHeapSizeRequired == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcGetPCHHeapSizeRequired is not found") + return (__nvrtcGetPCHHeapSizeRequired)( + prog, size) + + +cdef nvrtcResult _nvrtcSetFlowCallback(nvrtcProgram prog, void * callback, void* payload) except ?NVRTC_ERROR_INVALID_INPUT nogil: + global __nvrtcSetFlowCallback + _check_or_init_nvrtc() + if __nvrtcSetFlowCallback == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcSetFlowCallback is not found") + return (__nvrtcSetFlowCallback)( + prog, callback, payload) + + +cdef nvrtcResult _nvrtcGetTileIRSize(nvrtcProgram prog, size_t* TileIRSizeRet) except ?NVRTC_ERROR_INVALID_INPUT nogil: + global __nvrtcGetTileIRSize + _check_or_init_nvrtc() + if __nvrtcGetTileIRSize == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcGetTileIRSize is not found") + return (__nvrtcGetTileIRSize)( + prog, TileIRSizeRet) + + +cdef nvrtcResult _nvrtcGetTileIR(nvrtcProgram prog, char* TileIR) except ?NVRTC_ERROR_INVALID_INPUT nogil: + global __nvrtcGetTileIR + _check_or_init_nvrtc() + if __nvrtcGetTileIR == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcGetTileIR is not found") + return (__nvrtcGetTileIR)( + prog, TileIR) + + +cdef nvrtcResult _nvrtcInstallBundledHeaders(const char* installPath, unsigned int flags, const char** errorLog) except ?NVRTC_ERROR_INVALID_INPUT nogil: + global __nvrtcInstallBundledHeaders + _check_or_init_nvrtc() + if __nvrtcInstallBundledHeaders == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcInstallBundledHeaders is not found") + return (__nvrtcInstallBundledHeaders)( + installPath, flags, errorLog) + + +cdef nvrtcResult _nvrtcGetBundledHeadersInfo(nvrtcBundledHeadersInfo* info, const char** errorLog) except ?NVRTC_ERROR_INVALID_INPUT nogil: + global __nvrtcGetBundledHeadersInfo + _check_or_init_nvrtc() + if __nvrtcGetBundledHeadersInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcGetBundledHeadersInfo is not found") + return (__nvrtcGetBundledHeadersInfo)( + info, errorLog) + + +cdef nvrtcResult _nvrtcRemoveBundledHeaders(const char* installPath, const char** errorLog) except ?NVRTC_ERROR_INVALID_INPUT nogil: + global __nvrtcRemoveBundledHeaders + _check_or_init_nvrtc() + if __nvrtcRemoveBundledHeaders == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcRemoveBundledHeaders is not found") + return (__nvrtcRemoveBundledHeaders)( + installPath, errorLog) diff --git a/cuda_bindings/cuda/bindings/_internal/nvrtc_windows.pyx b/cuda_bindings/cuda/bindings/_internal/nvrtc_windows.pyx new file mode 100644 index 00000000000..bb295d8faec --- /dev/null +++ b/cuda_bindings/cuda/bindings/_internal/nvrtc_windows.pyx @@ -0,0 +1,569 @@ +# SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +# This code was automatically generated across versions from 12.9.0 to 13.3.0. Do not modify it directly. +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=fb8577d2b93fb2a36b8f02f62b920524ff9c191b2f4d8203ee3105820bc6f28c + + +# <<<< PREAMBLE CONTENT >>>> + +cdef extern from "": + ctypedef void* HMODULE + void* _cyb_GetProcAddress "GetProcAddress"(HMODULE, const char*) nogil + +from libc.stdint cimport intptr_t as _cyb_intptr_t + +import threading as _cyb_threading + +cdef bint _cyb___py_nvrtc_init = False +cdef dict _cyb_func_ptrs = None +cdef object _cyb_symbol_lock = _cyb_threading.Lock() + +# <<<< END OF PREAMBLE CONTENT >>>> + +from libc.stdint cimport uintptr_t +from cuda.pathfinder import load_nvidia_dynamic_lib +from .utils import FunctionNotFoundError, NotSupportedError +############################################################################### +# Wrapper init +############################################################################### + +cdef void* __nvrtcGetErrorString = NULL +cdef void* __nvrtcVersion = NULL +cdef void* __nvrtcGetNumSupportedArchs = NULL +cdef void* __nvrtcGetSupportedArchs = NULL +cdef void* __nvrtcCreateProgram = NULL +cdef void* __nvrtcDestroyProgram = NULL +cdef void* __nvrtcCompileProgram = NULL +cdef void* __nvrtcGetPTXSize = NULL +cdef void* __nvrtcGetPTX = NULL +cdef void* __nvrtcGetCUBINSize = NULL +cdef void* __nvrtcGetCUBIN = NULL +cdef void* __nvrtcGetLTOIRSize = NULL +cdef void* __nvrtcGetLTOIR = NULL +cdef void* __nvrtcGetOptiXIRSize = NULL +cdef void* __nvrtcGetOptiXIR = NULL +cdef void* __nvrtcGetProgramLogSize = NULL +cdef void* __nvrtcGetProgramLog = NULL +cdef void* __nvrtcAddNameExpression = NULL +cdef void* __nvrtcGetLoweredName = NULL +cdef void* __nvrtcGetPCHHeapSize = NULL +cdef void* __nvrtcSetPCHHeapSize = NULL +cdef void* __nvrtcGetPCHCreateStatus = NULL +cdef void* __nvrtcGetPCHHeapSizeRequired = NULL +cdef void* __nvrtcSetFlowCallback = NULL +cdef void* __nvrtcGetTileIRSize = NULL +cdef void* __nvrtcGetTileIR = NULL +cdef void* __nvrtcInstallBundledHeaders = NULL +cdef void* __nvrtcGetBundledHeadersInfo = NULL +cdef void* __nvrtcRemoveBundledHeaders = NULL + +cdef int _init_nvrtc() except -1 nogil: + global _cyb___py_nvrtc_init + + cdef int err + cdef uintptr_t handle + with gil, _cyb_symbol_lock: + if _cyb___py_nvrtc_init: return 0 + + handle = load_library() + global __nvrtcGetErrorString + __nvrtcGetErrorString = _cyb_GetProcAddress(handle, 'nvrtcGetErrorString') + + global __nvrtcVersion + __nvrtcVersion = _cyb_GetProcAddress(handle, 'nvrtcVersion') + + global __nvrtcGetNumSupportedArchs + __nvrtcGetNumSupportedArchs = _cyb_GetProcAddress(handle, 'nvrtcGetNumSupportedArchs') + + global __nvrtcGetSupportedArchs + __nvrtcGetSupportedArchs = _cyb_GetProcAddress(handle, 'nvrtcGetSupportedArchs') + + global __nvrtcCreateProgram + __nvrtcCreateProgram = _cyb_GetProcAddress(handle, 'nvrtcCreateProgram') + + global __nvrtcDestroyProgram + __nvrtcDestroyProgram = _cyb_GetProcAddress(handle, 'nvrtcDestroyProgram') + + global __nvrtcCompileProgram + __nvrtcCompileProgram = _cyb_GetProcAddress(handle, 'nvrtcCompileProgram') + + global __nvrtcGetPTXSize + __nvrtcGetPTXSize = _cyb_GetProcAddress(handle, 'nvrtcGetPTXSize') + + global __nvrtcGetPTX + __nvrtcGetPTX = _cyb_GetProcAddress(handle, 'nvrtcGetPTX') + + global __nvrtcGetCUBINSize + __nvrtcGetCUBINSize = _cyb_GetProcAddress(handle, 'nvrtcGetCUBINSize') + + global __nvrtcGetCUBIN + __nvrtcGetCUBIN = _cyb_GetProcAddress(handle, 'nvrtcGetCUBIN') + + global __nvrtcGetLTOIRSize + __nvrtcGetLTOIRSize = _cyb_GetProcAddress(handle, 'nvrtcGetLTOIRSize') + + global __nvrtcGetLTOIR + __nvrtcGetLTOIR = _cyb_GetProcAddress(handle, 'nvrtcGetLTOIR') + + global __nvrtcGetOptiXIRSize + __nvrtcGetOptiXIRSize = _cyb_GetProcAddress(handle, 'nvrtcGetOptiXIRSize') + + global __nvrtcGetOptiXIR + __nvrtcGetOptiXIR = _cyb_GetProcAddress(handle, 'nvrtcGetOptiXIR') + + global __nvrtcGetProgramLogSize + __nvrtcGetProgramLogSize = _cyb_GetProcAddress(handle, 'nvrtcGetProgramLogSize') + + global __nvrtcGetProgramLog + __nvrtcGetProgramLog = _cyb_GetProcAddress(handle, 'nvrtcGetProgramLog') + + global __nvrtcAddNameExpression + __nvrtcAddNameExpression = _cyb_GetProcAddress(handle, 'nvrtcAddNameExpression') + + global __nvrtcGetLoweredName + __nvrtcGetLoweredName = _cyb_GetProcAddress(handle, 'nvrtcGetLoweredName') + + global __nvrtcGetPCHHeapSize + __nvrtcGetPCHHeapSize = _cyb_GetProcAddress(handle, 'nvrtcGetPCHHeapSize') + + global __nvrtcSetPCHHeapSize + __nvrtcSetPCHHeapSize = _cyb_GetProcAddress(handle, 'nvrtcSetPCHHeapSize') + + global __nvrtcGetPCHCreateStatus + __nvrtcGetPCHCreateStatus = _cyb_GetProcAddress(handle, 'nvrtcGetPCHCreateStatus') + + global __nvrtcGetPCHHeapSizeRequired + __nvrtcGetPCHHeapSizeRequired = _cyb_GetProcAddress(handle, 'nvrtcGetPCHHeapSizeRequired') + + global __nvrtcSetFlowCallback + __nvrtcSetFlowCallback = _cyb_GetProcAddress(handle, 'nvrtcSetFlowCallback') + + global __nvrtcGetTileIRSize + __nvrtcGetTileIRSize = _cyb_GetProcAddress(handle, 'nvrtcGetTileIRSize') + + global __nvrtcGetTileIR + __nvrtcGetTileIR = _cyb_GetProcAddress(handle, 'nvrtcGetTileIR') + + global __nvrtcInstallBundledHeaders + __nvrtcInstallBundledHeaders = _cyb_GetProcAddress(handle, 'nvrtcInstallBundledHeaders') + + global __nvrtcGetBundledHeadersInfo + __nvrtcGetBundledHeadersInfo = _cyb_GetProcAddress(handle, 'nvrtcGetBundledHeadersInfo') + + global __nvrtcRemoveBundledHeaders + __nvrtcRemoveBundledHeaders = _cyb_GetProcAddress(handle, 'nvrtcRemoveBundledHeaders') + + _cyb___py_nvrtc_init = True + return 0 + +cdef inline int _check_or_init_nvrtc() except -1 nogil: + if _cyb___py_nvrtc_init: + return 0 + + return _init_nvrtc() + + +cpdef dict _inspect_function_pointers(): + global _cyb_func_ptrs + if _cyb_func_ptrs is not None: + return _cyb_func_ptrs + + _check_or_init_nvrtc() + cdef dict data = {} + global __nvrtcGetErrorString + data["__nvrtcGetErrorString"] = <_cyb_intptr_t>__nvrtcGetErrorString + + global __nvrtcVersion + data["__nvrtcVersion"] = <_cyb_intptr_t>__nvrtcVersion + + global __nvrtcGetNumSupportedArchs + data["__nvrtcGetNumSupportedArchs"] = <_cyb_intptr_t>__nvrtcGetNumSupportedArchs + + global __nvrtcGetSupportedArchs + data["__nvrtcGetSupportedArchs"] = <_cyb_intptr_t>__nvrtcGetSupportedArchs + + global __nvrtcCreateProgram + data["__nvrtcCreateProgram"] = <_cyb_intptr_t>__nvrtcCreateProgram + + global __nvrtcDestroyProgram + data["__nvrtcDestroyProgram"] = <_cyb_intptr_t>__nvrtcDestroyProgram + + global __nvrtcCompileProgram + data["__nvrtcCompileProgram"] = <_cyb_intptr_t>__nvrtcCompileProgram + + global __nvrtcGetPTXSize + data["__nvrtcGetPTXSize"] = <_cyb_intptr_t>__nvrtcGetPTXSize + + global __nvrtcGetPTX + data["__nvrtcGetPTX"] = <_cyb_intptr_t>__nvrtcGetPTX + + global __nvrtcGetCUBINSize + data["__nvrtcGetCUBINSize"] = <_cyb_intptr_t>__nvrtcGetCUBINSize + + global __nvrtcGetCUBIN + data["__nvrtcGetCUBIN"] = <_cyb_intptr_t>__nvrtcGetCUBIN + + global __nvrtcGetLTOIRSize + data["__nvrtcGetLTOIRSize"] = <_cyb_intptr_t>__nvrtcGetLTOIRSize + + global __nvrtcGetLTOIR + data["__nvrtcGetLTOIR"] = <_cyb_intptr_t>__nvrtcGetLTOIR + + global __nvrtcGetOptiXIRSize + data["__nvrtcGetOptiXIRSize"] = <_cyb_intptr_t>__nvrtcGetOptiXIRSize + + global __nvrtcGetOptiXIR + data["__nvrtcGetOptiXIR"] = <_cyb_intptr_t>__nvrtcGetOptiXIR + + global __nvrtcGetProgramLogSize + data["__nvrtcGetProgramLogSize"] = <_cyb_intptr_t>__nvrtcGetProgramLogSize + + global __nvrtcGetProgramLog + data["__nvrtcGetProgramLog"] = <_cyb_intptr_t>__nvrtcGetProgramLog + + global __nvrtcAddNameExpression + data["__nvrtcAddNameExpression"] = <_cyb_intptr_t>__nvrtcAddNameExpression + + global __nvrtcGetLoweredName + data["__nvrtcGetLoweredName"] = <_cyb_intptr_t>__nvrtcGetLoweredName + + global __nvrtcGetPCHHeapSize + data["__nvrtcGetPCHHeapSize"] = <_cyb_intptr_t>__nvrtcGetPCHHeapSize + + global __nvrtcSetPCHHeapSize + data["__nvrtcSetPCHHeapSize"] = <_cyb_intptr_t>__nvrtcSetPCHHeapSize + + global __nvrtcGetPCHCreateStatus + data["__nvrtcGetPCHCreateStatus"] = <_cyb_intptr_t>__nvrtcGetPCHCreateStatus + + global __nvrtcGetPCHHeapSizeRequired + data["__nvrtcGetPCHHeapSizeRequired"] = <_cyb_intptr_t>__nvrtcGetPCHHeapSizeRequired + + global __nvrtcSetFlowCallback + data["__nvrtcSetFlowCallback"] = <_cyb_intptr_t>__nvrtcSetFlowCallback + + global __nvrtcGetTileIRSize + data["__nvrtcGetTileIRSize"] = <_cyb_intptr_t>__nvrtcGetTileIRSize + + global __nvrtcGetTileIR + data["__nvrtcGetTileIR"] = <_cyb_intptr_t>__nvrtcGetTileIR + + global __nvrtcInstallBundledHeaders + data["__nvrtcInstallBundledHeaders"] = <_cyb_intptr_t>__nvrtcInstallBundledHeaders + + global __nvrtcGetBundledHeadersInfo + data["__nvrtcGetBundledHeadersInfo"] = <_cyb_intptr_t>__nvrtcGetBundledHeadersInfo + + global __nvrtcRemoveBundledHeaders + data["__nvrtcRemoveBundledHeaders"] = <_cyb_intptr_t>__nvrtcRemoveBundledHeaders + _cyb_func_ptrs = data + return data + + +cpdef _inspect_function_pointer(str name): + global _cyb_func_ptrs + if _cyb_func_ptrs is None: + _cyb_func_ptrs = _inspect_function_pointers() + return _cyb_func_ptrs[name] + + + + +cdef uintptr_t load_library() except* with gil: + return load_nvidia_dynamic_lib("nvrtc")._handle_uint + + +############################################################################### +# Wrapper functions +############################################################################### + +cdef const char* _nvrtcGetErrorString(nvrtcResult result) except?NULL nogil: + global __nvrtcGetErrorString + _check_or_init_nvrtc() + if __nvrtcGetErrorString == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcGetErrorString is not found") + return (__nvrtcGetErrorString)( + result) + + +cdef nvrtcResult _nvrtcVersion(int* major, int* minor) except ?NVRTC_ERROR_INVALID_INPUT nogil: + global __nvrtcVersion + _check_or_init_nvrtc() + if __nvrtcVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcVersion is not found") + return (__nvrtcVersion)( + major, minor) + + +cdef nvrtcResult _nvrtcGetNumSupportedArchs(int* numArchs) except ?NVRTC_ERROR_INVALID_INPUT nogil: + global __nvrtcGetNumSupportedArchs + _check_or_init_nvrtc() + if __nvrtcGetNumSupportedArchs == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcGetNumSupportedArchs is not found") + return (__nvrtcGetNumSupportedArchs)( + numArchs) + + +cdef nvrtcResult _nvrtcGetSupportedArchs(int* supportedArchs) except ?NVRTC_ERROR_INVALID_INPUT nogil: + global __nvrtcGetSupportedArchs + _check_or_init_nvrtc() + if __nvrtcGetSupportedArchs == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcGetSupportedArchs is not found") + return (__nvrtcGetSupportedArchs)( + supportedArchs) + + +cdef nvrtcResult _nvrtcCreateProgram(nvrtcProgram* prog, const char* src, const char* name, int numHeaders, const char** headers, const char** includeNames) except ?NVRTC_ERROR_INVALID_INPUT nogil: + global __nvrtcCreateProgram + _check_or_init_nvrtc() + if __nvrtcCreateProgram == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcCreateProgram is not found") + return (__nvrtcCreateProgram)( + prog, src, name, numHeaders, headers, includeNames) + + +cdef nvrtcResult _nvrtcDestroyProgram(nvrtcProgram* prog) except ?NVRTC_ERROR_INVALID_INPUT nogil: + global __nvrtcDestroyProgram + _check_or_init_nvrtc() + if __nvrtcDestroyProgram == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcDestroyProgram is not found") + return (__nvrtcDestroyProgram)( + prog) + + +cdef nvrtcResult _nvrtcCompileProgram(nvrtcProgram prog, int numOptions, const char** options) except ?NVRTC_ERROR_INVALID_INPUT nogil: + global __nvrtcCompileProgram + _check_or_init_nvrtc() + if __nvrtcCompileProgram == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcCompileProgram is not found") + return (__nvrtcCompileProgram)( + prog, numOptions, options) + + +cdef nvrtcResult _nvrtcGetPTXSize(nvrtcProgram prog, size_t* ptxSizeRet) except ?NVRTC_ERROR_INVALID_INPUT nogil: + global __nvrtcGetPTXSize + _check_or_init_nvrtc() + if __nvrtcGetPTXSize == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcGetPTXSize is not found") + return (__nvrtcGetPTXSize)( + prog, ptxSizeRet) + + +cdef nvrtcResult _nvrtcGetPTX(nvrtcProgram prog, char* ptx) except ?NVRTC_ERROR_INVALID_INPUT nogil: + global __nvrtcGetPTX + _check_or_init_nvrtc() + if __nvrtcGetPTX == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcGetPTX is not found") + return (__nvrtcGetPTX)( + prog, ptx) + + +cdef nvrtcResult _nvrtcGetCUBINSize(nvrtcProgram prog, size_t* cubinSizeRet) except ?NVRTC_ERROR_INVALID_INPUT nogil: + global __nvrtcGetCUBINSize + _check_or_init_nvrtc() + if __nvrtcGetCUBINSize == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcGetCUBINSize is not found") + return (__nvrtcGetCUBINSize)( + prog, cubinSizeRet) + + +cdef nvrtcResult _nvrtcGetCUBIN(nvrtcProgram prog, char* cubin) except ?NVRTC_ERROR_INVALID_INPUT nogil: + global __nvrtcGetCUBIN + _check_or_init_nvrtc() + if __nvrtcGetCUBIN == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcGetCUBIN is not found") + return (__nvrtcGetCUBIN)( + prog, cubin) + + +cdef nvrtcResult _nvrtcGetLTOIRSize(nvrtcProgram prog, size_t* LTOIRSizeRet) except ?NVRTC_ERROR_INVALID_INPUT nogil: + global __nvrtcGetLTOIRSize + _check_or_init_nvrtc() + if __nvrtcGetLTOIRSize == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcGetLTOIRSize is not found") + return (__nvrtcGetLTOIRSize)( + prog, LTOIRSizeRet) + + +cdef nvrtcResult _nvrtcGetLTOIR(nvrtcProgram prog, char* LTOIR) except ?NVRTC_ERROR_INVALID_INPUT nogil: + global __nvrtcGetLTOIR + _check_or_init_nvrtc() + if __nvrtcGetLTOIR == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcGetLTOIR is not found") + return (__nvrtcGetLTOIR)( + prog, LTOIR) + + +cdef nvrtcResult _nvrtcGetOptiXIRSize(nvrtcProgram prog, size_t* optixirSizeRet) except ?NVRTC_ERROR_INVALID_INPUT nogil: + global __nvrtcGetOptiXIRSize + _check_or_init_nvrtc() + if __nvrtcGetOptiXIRSize == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcGetOptiXIRSize is not found") + return (__nvrtcGetOptiXIRSize)( + prog, optixirSizeRet) + + +cdef nvrtcResult _nvrtcGetOptiXIR(nvrtcProgram prog, char* optixir) except ?NVRTC_ERROR_INVALID_INPUT nogil: + global __nvrtcGetOptiXIR + _check_or_init_nvrtc() + if __nvrtcGetOptiXIR == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcGetOptiXIR is not found") + return (__nvrtcGetOptiXIR)( + prog, optixir) + + +cdef nvrtcResult _nvrtcGetProgramLogSize(nvrtcProgram prog, size_t* logSizeRet) except ?NVRTC_ERROR_INVALID_INPUT nogil: + global __nvrtcGetProgramLogSize + _check_or_init_nvrtc() + if __nvrtcGetProgramLogSize == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcGetProgramLogSize is not found") + return (__nvrtcGetProgramLogSize)( + prog, logSizeRet) + + +cdef nvrtcResult _nvrtcGetProgramLog(nvrtcProgram prog, char* log) except ?NVRTC_ERROR_INVALID_INPUT nogil: + global __nvrtcGetProgramLog + _check_or_init_nvrtc() + if __nvrtcGetProgramLog == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcGetProgramLog is not found") + return (__nvrtcGetProgramLog)( + prog, log) + + +cdef nvrtcResult _nvrtcAddNameExpression(nvrtcProgram prog, const char* name_expression) except ?NVRTC_ERROR_INVALID_INPUT nogil: + global __nvrtcAddNameExpression + _check_or_init_nvrtc() + if __nvrtcAddNameExpression == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcAddNameExpression is not found") + return (__nvrtcAddNameExpression)( + prog, name_expression) + + +cdef nvrtcResult _nvrtcGetLoweredName(nvrtcProgram prog, const char* name_expression, const char** lowered_name) except ?NVRTC_ERROR_INVALID_INPUT nogil: + global __nvrtcGetLoweredName + _check_or_init_nvrtc() + if __nvrtcGetLoweredName == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcGetLoweredName is not found") + return (__nvrtcGetLoweredName)( + prog, name_expression, lowered_name) + + +cdef nvrtcResult _nvrtcGetPCHHeapSize(size_t* ret) except ?NVRTC_ERROR_INVALID_INPUT nogil: + global __nvrtcGetPCHHeapSize + _check_or_init_nvrtc() + if __nvrtcGetPCHHeapSize == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcGetPCHHeapSize is not found") + return (__nvrtcGetPCHHeapSize)( + ret) + + +cdef nvrtcResult _nvrtcSetPCHHeapSize(size_t size) except ?NVRTC_ERROR_INVALID_INPUT nogil: + global __nvrtcSetPCHHeapSize + _check_or_init_nvrtc() + if __nvrtcSetPCHHeapSize == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcSetPCHHeapSize is not found") + return (__nvrtcSetPCHHeapSize)( + size) + + +cdef nvrtcResult _nvrtcGetPCHCreateStatus(nvrtcProgram prog) except ?NVRTC_ERROR_INVALID_INPUT nogil: + global __nvrtcGetPCHCreateStatus + _check_or_init_nvrtc() + if __nvrtcGetPCHCreateStatus == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcGetPCHCreateStatus is not found") + return (__nvrtcGetPCHCreateStatus)( + prog) + + +cdef nvrtcResult _nvrtcGetPCHHeapSizeRequired(nvrtcProgram prog, size_t* size) except ?NVRTC_ERROR_INVALID_INPUT nogil: + global __nvrtcGetPCHHeapSizeRequired + _check_or_init_nvrtc() + if __nvrtcGetPCHHeapSizeRequired == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcGetPCHHeapSizeRequired is not found") + return (__nvrtcGetPCHHeapSizeRequired)( + prog, size) + + +cdef nvrtcResult _nvrtcSetFlowCallback(nvrtcProgram prog, void * callback, void* payload) except ?NVRTC_ERROR_INVALID_INPUT nogil: + global __nvrtcSetFlowCallback + _check_or_init_nvrtc() + if __nvrtcSetFlowCallback == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcSetFlowCallback is not found") + return (__nvrtcSetFlowCallback)( + prog, callback, payload) + + +cdef nvrtcResult _nvrtcGetTileIRSize(nvrtcProgram prog, size_t* TileIRSizeRet) except ?NVRTC_ERROR_INVALID_INPUT nogil: + global __nvrtcGetTileIRSize + _check_or_init_nvrtc() + if __nvrtcGetTileIRSize == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcGetTileIRSize is not found") + return (__nvrtcGetTileIRSize)( + prog, TileIRSizeRet) + + +cdef nvrtcResult _nvrtcGetTileIR(nvrtcProgram prog, char* TileIR) except ?NVRTC_ERROR_INVALID_INPUT nogil: + global __nvrtcGetTileIR + _check_or_init_nvrtc() + if __nvrtcGetTileIR == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcGetTileIR is not found") + return (__nvrtcGetTileIR)( + prog, TileIR) + + +cdef nvrtcResult _nvrtcInstallBundledHeaders(const char* installPath, unsigned int flags, const char** errorLog) except ?NVRTC_ERROR_INVALID_INPUT nogil: + global __nvrtcInstallBundledHeaders + _check_or_init_nvrtc() + if __nvrtcInstallBundledHeaders == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcInstallBundledHeaders is not found") + return (__nvrtcInstallBundledHeaders)( + installPath, flags, errorLog) + + +cdef nvrtcResult _nvrtcGetBundledHeadersInfo(nvrtcBundledHeadersInfo* info, const char** errorLog) except ?NVRTC_ERROR_INVALID_INPUT nogil: + global __nvrtcGetBundledHeadersInfo + _check_or_init_nvrtc() + if __nvrtcGetBundledHeadersInfo == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcGetBundledHeadersInfo is not found") + return (__nvrtcGetBundledHeadersInfo)( + info, errorLog) + + +cdef nvrtcResult _nvrtcRemoveBundledHeaders(const char* installPath, const char** errorLog) except ?NVRTC_ERROR_INVALID_INPUT nogil: + global __nvrtcRemoveBundledHeaders + _check_or_init_nvrtc() + if __nvrtcRemoveBundledHeaders == NULL: + with gil: + raise FunctionNotFoundError("function nvrtcRemoveBundledHeaders is not found") + return (__nvrtcRemoveBundledHeaders)( + installPath, errorLog) diff --git a/cuda_bindings/cuda/bindings/_internal/nvvm.pxd b/cuda_bindings/cuda/bindings/_internal/nvvm.pxd new file mode 100644 index 00000000000..e4ac3cf1258 --- /dev/null +++ b/cuda_bindings/cuda/bindings/_internal/nvvm.pxd @@ -0,0 +1,28 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +# This code was automatically generated across versions from 12.0.1 to 13.3.0. Do not modify it directly. + +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=a27b041eb470b98bf5b1a0a92ace9467c5f3921d47ee10557a4f00ff1e4ac411 +from ..cynvvm cimport * + + +############################################################################### +# Wrapper functions +############################################################################### + +cdef const char* _nvvmGetErrorString(nvvmResult result) except?NULL nogil +cdef nvvmResult _nvvmVersion(int* major, int* minor) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvvmResult _nvvmIRVersion(int* majorIR, int* minorIR, int* majorDbg, int* minorDbg) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvvmResult _nvvmCreateProgram(nvvmProgram* prog) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvvmResult _nvvmDestroyProgram(nvvmProgram* prog) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvvmResult _nvvmAddModuleToProgram(nvvmProgram prog, const char* buffer, size_t size, const char* name) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvvmResult _nvvmLazyAddModuleToProgram(nvvmProgram prog, const char* buffer, size_t size, const char* name) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvvmResult _nvvmCompileProgram(nvvmProgram prog, int numOptions, const char** options) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvvmResult _nvvmVerifyProgram(nvvmProgram prog, int numOptions, const char** options) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvvmResult _nvvmGetCompiledResultSize(nvvmProgram prog, size_t* bufferSizeRet) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvvmResult _nvvmGetCompiledResult(nvvmProgram prog, char* buffer) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvvmResult _nvvmGetProgramLogSize(nvvmProgram prog, size_t* bufferSizeRet) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvvmResult _nvvmGetProgramLog(nvvmProgram prog, char* buffer) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvvmResult _nvvmLLVMVersion(const char* arch, int* major) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil diff --git a/cuda_bindings/cuda/bindings/_internal/nvvm_linux.pyx b/cuda_bindings/cuda/bindings/_internal/nvvm_linux.pyx new file mode 100644 index 00000000000..0aba7664f8b --- /dev/null +++ b/cuda_bindings/cuda/bindings/_internal/nvvm_linux.pyx @@ -0,0 +1,371 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +# This code was automatically generated across versions from 12.0.1 to 13.3.0. Do not modify it directly. +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=786a789c534d0bdda803be738a4f76f2db47bf188708dac946b41aec6c6aa4a4 + + +# <<<< PREAMBLE CONTENT >>>> + +cdef extern from "": + void* _cyb_dlsym "dlsym"(void*, const char*) nogil + const void * _cyb_RTLD_DEFAULT "RTLD_DEFAULT" + +from libc.stdint cimport intptr_t as _cyb_intptr_t + +import threading as _cyb_threading + +cdef bint _cyb___py_nvvm_init = False +cdef dict _cyb_func_ptrs = None +cdef object _cyb_symbol_lock = _cyb_threading.Lock() + +# <<<< END OF PREAMBLE CONTENT >>>> + +from libc.stdint cimport uintptr_t + +from .utils import FunctionNotFoundError, NotSupportedError +from cuda.pathfinder import load_nvidia_dynamic_lib + + +############################################################################### +# Wrapper init +############################################################################### + +cdef void* __nvvmGetErrorString = NULL +cdef void* __nvvmVersion = NULL +cdef void* __nvvmIRVersion = NULL +cdef void* __nvvmCreateProgram = NULL +cdef void* __nvvmDestroyProgram = NULL +cdef void* __nvvmAddModuleToProgram = NULL +cdef void* __nvvmLazyAddModuleToProgram = NULL +cdef void* __nvvmCompileProgram = NULL +cdef void* __nvvmVerifyProgram = NULL +cdef void* __nvvmGetCompiledResultSize = NULL +cdef void* __nvvmGetCompiledResult = NULL +cdef void* __nvvmGetProgramLogSize = NULL +cdef void* __nvvmGetProgramLog = NULL +cdef void* __nvvmLLVMVersion = NULL + +cdef int _init_nvvm() except -1 nogil: + global _cyb___py_nvvm_init + cdef void* handle = NULL + with gil, _cyb_symbol_lock: + if _cyb___py_nvvm_init: return 0 + + global __nvvmGetErrorString + __nvvmGetErrorString = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvvmGetErrorString') + if __nvvmGetErrorString == NULL: + if handle == NULL: + handle = load_library() + __nvvmGetErrorString = _cyb_dlsym(handle, 'nvvmGetErrorString') + + global __nvvmVersion + __nvvmVersion = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvvmVersion') + if __nvvmVersion == NULL: + if handle == NULL: + handle = load_library() + __nvvmVersion = _cyb_dlsym(handle, 'nvvmVersion') + + global __nvvmIRVersion + __nvvmIRVersion = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvvmIRVersion') + if __nvvmIRVersion == NULL: + if handle == NULL: + handle = load_library() + __nvvmIRVersion = _cyb_dlsym(handle, 'nvvmIRVersion') + + global __nvvmCreateProgram + __nvvmCreateProgram = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvvmCreateProgram') + if __nvvmCreateProgram == NULL: + if handle == NULL: + handle = load_library() + __nvvmCreateProgram = _cyb_dlsym(handle, 'nvvmCreateProgram') + + global __nvvmDestroyProgram + __nvvmDestroyProgram = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvvmDestroyProgram') + if __nvvmDestroyProgram == NULL: + if handle == NULL: + handle = load_library() + __nvvmDestroyProgram = _cyb_dlsym(handle, 'nvvmDestroyProgram') + + global __nvvmAddModuleToProgram + __nvvmAddModuleToProgram = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvvmAddModuleToProgram') + if __nvvmAddModuleToProgram == NULL: + if handle == NULL: + handle = load_library() + __nvvmAddModuleToProgram = _cyb_dlsym(handle, 'nvvmAddModuleToProgram') + + global __nvvmLazyAddModuleToProgram + __nvvmLazyAddModuleToProgram = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvvmLazyAddModuleToProgram') + if __nvvmLazyAddModuleToProgram == NULL: + if handle == NULL: + handle = load_library() + __nvvmLazyAddModuleToProgram = _cyb_dlsym(handle, 'nvvmLazyAddModuleToProgram') + + global __nvvmCompileProgram + __nvvmCompileProgram = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvvmCompileProgram') + if __nvvmCompileProgram == NULL: + if handle == NULL: + handle = load_library() + __nvvmCompileProgram = _cyb_dlsym(handle, 'nvvmCompileProgram') + + global __nvvmVerifyProgram + __nvvmVerifyProgram = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvvmVerifyProgram') + if __nvvmVerifyProgram == NULL: + if handle == NULL: + handle = load_library() + __nvvmVerifyProgram = _cyb_dlsym(handle, 'nvvmVerifyProgram') + + global __nvvmGetCompiledResultSize + __nvvmGetCompiledResultSize = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvvmGetCompiledResultSize') + if __nvvmGetCompiledResultSize == NULL: + if handle == NULL: + handle = load_library() + __nvvmGetCompiledResultSize = _cyb_dlsym(handle, 'nvvmGetCompiledResultSize') + + global __nvvmGetCompiledResult + __nvvmGetCompiledResult = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvvmGetCompiledResult') + if __nvvmGetCompiledResult == NULL: + if handle == NULL: + handle = load_library() + __nvvmGetCompiledResult = _cyb_dlsym(handle, 'nvvmGetCompiledResult') + + global __nvvmGetProgramLogSize + __nvvmGetProgramLogSize = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvvmGetProgramLogSize') + if __nvvmGetProgramLogSize == NULL: + if handle == NULL: + handle = load_library() + __nvvmGetProgramLogSize = _cyb_dlsym(handle, 'nvvmGetProgramLogSize') + + global __nvvmGetProgramLog + __nvvmGetProgramLog = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvvmGetProgramLog') + if __nvvmGetProgramLog == NULL: + if handle == NULL: + handle = load_library() + __nvvmGetProgramLog = _cyb_dlsym(handle, 'nvvmGetProgramLog') + + global __nvvmLLVMVersion + __nvvmLLVMVersion = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvvmLLVMVersion') + if __nvvmLLVMVersion == NULL: + if handle == NULL: + handle = load_library() + __nvvmLLVMVersion = _cyb_dlsym(handle, 'nvvmLLVMVersion') + + _cyb___py_nvvm_init = True + return 0 + +cdef inline int _check_or_init_nvvm() except -1 nogil: + if _cyb___py_nvvm_init: + return 0 + + return _init_nvvm() + + +cpdef dict _inspect_function_pointers(): + global _cyb_func_ptrs + if _cyb_func_ptrs is not None: + return _cyb_func_ptrs + + _check_or_init_nvvm() + cdef dict data = {} + global __nvvmGetErrorString + data["__nvvmGetErrorString"] = <_cyb_intptr_t>__nvvmGetErrorString + + global __nvvmVersion + data["__nvvmVersion"] = <_cyb_intptr_t>__nvvmVersion + + global __nvvmIRVersion + data["__nvvmIRVersion"] = <_cyb_intptr_t>__nvvmIRVersion + + global __nvvmCreateProgram + data["__nvvmCreateProgram"] = <_cyb_intptr_t>__nvvmCreateProgram + + global __nvvmDestroyProgram + data["__nvvmDestroyProgram"] = <_cyb_intptr_t>__nvvmDestroyProgram + + global __nvvmAddModuleToProgram + data["__nvvmAddModuleToProgram"] = <_cyb_intptr_t>__nvvmAddModuleToProgram + + global __nvvmLazyAddModuleToProgram + data["__nvvmLazyAddModuleToProgram"] = <_cyb_intptr_t>__nvvmLazyAddModuleToProgram + + global __nvvmCompileProgram + data["__nvvmCompileProgram"] = <_cyb_intptr_t>__nvvmCompileProgram + + global __nvvmVerifyProgram + data["__nvvmVerifyProgram"] = <_cyb_intptr_t>__nvvmVerifyProgram + + global __nvvmGetCompiledResultSize + data["__nvvmGetCompiledResultSize"] = <_cyb_intptr_t>__nvvmGetCompiledResultSize + + global __nvvmGetCompiledResult + data["__nvvmGetCompiledResult"] = <_cyb_intptr_t>__nvvmGetCompiledResult + + global __nvvmGetProgramLogSize + data["__nvvmGetProgramLogSize"] = <_cyb_intptr_t>__nvvmGetProgramLogSize + + global __nvvmGetProgramLog + data["__nvvmGetProgramLog"] = <_cyb_intptr_t>__nvvmGetProgramLog + + global __nvvmLLVMVersion + data["__nvvmLLVMVersion"] = <_cyb_intptr_t>__nvvmLLVMVersion + _cyb_func_ptrs = data + return data + + +cpdef _inspect_function_pointer(str name): + global _cyb_func_ptrs + if _cyb_func_ptrs is None: + _cyb_func_ptrs = _inspect_function_pointers() + return _cyb_func_ptrs[name] + + + + +cdef void* load_library() except* with gil: + cdef uintptr_t handle = load_nvidia_dynamic_lib("nvvm")._handle_uint + return handle + + +############################################################################### +# Wrapper functions +############################################################################### + +cdef const char* _nvvmGetErrorString(nvvmResult result) except?NULL nogil: + global __nvvmGetErrorString + _check_or_init_nvvm() + if __nvvmGetErrorString == NULL: + with gil: + raise FunctionNotFoundError("function nvvmGetErrorString is not found") + return (__nvvmGetErrorString)( + result) + + +cdef nvvmResult _nvvmVersion(int* major, int* minor) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvvmVersion + _check_or_init_nvvm() + if __nvvmVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvvmVersion is not found") + return (__nvvmVersion)( + major, minor) + + +cdef nvvmResult _nvvmIRVersion(int* majorIR, int* minorIR, int* majorDbg, int* minorDbg) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvvmIRVersion + _check_or_init_nvvm() + if __nvvmIRVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvvmIRVersion is not found") + return (__nvvmIRVersion)( + majorIR, minorIR, majorDbg, minorDbg) + + +cdef nvvmResult _nvvmCreateProgram(nvvmProgram* prog) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvvmCreateProgram + _check_or_init_nvvm() + if __nvvmCreateProgram == NULL: + with gil: + raise FunctionNotFoundError("function nvvmCreateProgram is not found") + return (__nvvmCreateProgram)( + prog) + + +cdef nvvmResult _nvvmDestroyProgram(nvvmProgram* prog) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvvmDestroyProgram + _check_or_init_nvvm() + if __nvvmDestroyProgram == NULL: + with gil: + raise FunctionNotFoundError("function nvvmDestroyProgram is not found") + return (__nvvmDestroyProgram)( + prog) + + +cdef nvvmResult _nvvmAddModuleToProgram(nvvmProgram prog, const char* buffer, size_t size, const char* name) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvvmAddModuleToProgram + _check_or_init_nvvm() + if __nvvmAddModuleToProgram == NULL: + with gil: + raise FunctionNotFoundError("function nvvmAddModuleToProgram is not found") + return (__nvvmAddModuleToProgram)( + prog, buffer, size, name) + + +cdef nvvmResult _nvvmLazyAddModuleToProgram(nvvmProgram prog, const char* buffer, size_t size, const char* name) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvvmLazyAddModuleToProgram + _check_or_init_nvvm() + if __nvvmLazyAddModuleToProgram == NULL: + with gil: + raise FunctionNotFoundError("function nvvmLazyAddModuleToProgram is not found") + return (__nvvmLazyAddModuleToProgram)( + prog, buffer, size, name) + + +cdef nvvmResult _nvvmCompileProgram(nvvmProgram prog, int numOptions, const char** options) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvvmCompileProgram + _check_or_init_nvvm() + if __nvvmCompileProgram == NULL: + with gil: + raise FunctionNotFoundError("function nvvmCompileProgram is not found") + return (__nvvmCompileProgram)( + prog, numOptions, options) + + +cdef nvvmResult _nvvmVerifyProgram(nvvmProgram prog, int numOptions, const char** options) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvvmVerifyProgram + _check_or_init_nvvm() + if __nvvmVerifyProgram == NULL: + with gil: + raise FunctionNotFoundError("function nvvmVerifyProgram is not found") + return (__nvvmVerifyProgram)( + prog, numOptions, options) + + +cdef nvvmResult _nvvmGetCompiledResultSize(nvvmProgram prog, size_t* bufferSizeRet) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvvmGetCompiledResultSize + _check_or_init_nvvm() + if __nvvmGetCompiledResultSize == NULL: + with gil: + raise FunctionNotFoundError("function nvvmGetCompiledResultSize is not found") + return (__nvvmGetCompiledResultSize)( + prog, bufferSizeRet) + + +cdef nvvmResult _nvvmGetCompiledResult(nvvmProgram prog, char* buffer) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvvmGetCompiledResult + _check_or_init_nvvm() + if __nvvmGetCompiledResult == NULL: + with gil: + raise FunctionNotFoundError("function nvvmGetCompiledResult is not found") + return (__nvvmGetCompiledResult)( + prog, buffer) + + +cdef nvvmResult _nvvmGetProgramLogSize(nvvmProgram prog, size_t* bufferSizeRet) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvvmGetProgramLogSize + _check_or_init_nvvm() + if __nvvmGetProgramLogSize == NULL: + with gil: + raise FunctionNotFoundError("function nvvmGetProgramLogSize is not found") + return (__nvvmGetProgramLogSize)( + prog, bufferSizeRet) + + +cdef nvvmResult _nvvmGetProgramLog(nvvmProgram prog, char* buffer) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvvmGetProgramLog + _check_or_init_nvvm() + if __nvvmGetProgramLog == NULL: + with gil: + raise FunctionNotFoundError("function nvvmGetProgramLog is not found") + return (__nvvmGetProgramLog)( + prog, buffer) + + +cdef nvvmResult _nvvmLLVMVersion(const char* arch, int* major) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvvmLLVMVersion + _check_or_init_nvvm() + if __nvvmLLVMVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvvmLLVMVersion is not found") + return (__nvvmLLVMVersion)( + arch, major) diff --git a/cuda_bindings/cuda/bindings/_internal/nvvm_windows.pyx b/cuda_bindings/cuda/bindings/_internal/nvvm_windows.pyx new file mode 100644 index 00000000000..72262266fac --- /dev/null +++ b/cuda_bindings/cuda/bindings/_internal/nvvm_windows.pyx @@ -0,0 +1,314 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +# This code was automatically generated across versions from 12.0.1 to 13.3.0. Do not modify it directly. +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=cd105988425e21a30e32255acbc5654de835d0c09b5dd1c4598b09146fa590c5 + + +# <<<< PREAMBLE CONTENT >>>> + +cdef extern from "": + ctypedef void* HMODULE + void* _cyb_GetProcAddress "GetProcAddress"(HMODULE, const char*) nogil + +from libc.stdint cimport intptr_t as _cyb_intptr_t + +import threading as _cyb_threading + +cdef bint _cyb___py_nvvm_init = False +cdef dict _cyb_func_ptrs = None +cdef object _cyb_symbol_lock = _cyb_threading.Lock() + +# <<<< END OF PREAMBLE CONTENT >>>> + +from libc.stdint cimport uintptr_t +from cuda.pathfinder import load_nvidia_dynamic_lib +from .utils import FunctionNotFoundError, NotSupportedError +############################################################################### +# Wrapper init +############################################################################### + +cdef void* __nvvmGetErrorString = NULL +cdef void* __nvvmVersion = NULL +cdef void* __nvvmIRVersion = NULL +cdef void* __nvvmCreateProgram = NULL +cdef void* __nvvmDestroyProgram = NULL +cdef void* __nvvmAddModuleToProgram = NULL +cdef void* __nvvmLazyAddModuleToProgram = NULL +cdef void* __nvvmCompileProgram = NULL +cdef void* __nvvmVerifyProgram = NULL +cdef void* __nvvmGetCompiledResultSize = NULL +cdef void* __nvvmGetCompiledResult = NULL +cdef void* __nvvmGetProgramLogSize = NULL +cdef void* __nvvmGetProgramLog = NULL +cdef void* __nvvmLLVMVersion = NULL + +cdef int _init_nvvm() except -1 nogil: + global _cyb___py_nvvm_init + + cdef int err + cdef uintptr_t handle + with gil, _cyb_symbol_lock: + if _cyb___py_nvvm_init: return 0 + + handle = load_library() + global __nvvmGetErrorString + __nvvmGetErrorString = _cyb_GetProcAddress(handle, 'nvvmGetErrorString') + + global __nvvmVersion + __nvvmVersion = _cyb_GetProcAddress(handle, 'nvvmVersion') + + global __nvvmIRVersion + __nvvmIRVersion = _cyb_GetProcAddress(handle, 'nvvmIRVersion') + + global __nvvmCreateProgram + __nvvmCreateProgram = _cyb_GetProcAddress(handle, 'nvvmCreateProgram') + + global __nvvmDestroyProgram + __nvvmDestroyProgram = _cyb_GetProcAddress(handle, 'nvvmDestroyProgram') + + global __nvvmAddModuleToProgram + __nvvmAddModuleToProgram = _cyb_GetProcAddress(handle, 'nvvmAddModuleToProgram') + + global __nvvmLazyAddModuleToProgram + __nvvmLazyAddModuleToProgram = _cyb_GetProcAddress(handle, 'nvvmLazyAddModuleToProgram') + + global __nvvmCompileProgram + __nvvmCompileProgram = _cyb_GetProcAddress(handle, 'nvvmCompileProgram') + + global __nvvmVerifyProgram + __nvvmVerifyProgram = _cyb_GetProcAddress(handle, 'nvvmVerifyProgram') + + global __nvvmGetCompiledResultSize + __nvvmGetCompiledResultSize = _cyb_GetProcAddress(handle, 'nvvmGetCompiledResultSize') + + global __nvvmGetCompiledResult + __nvvmGetCompiledResult = _cyb_GetProcAddress(handle, 'nvvmGetCompiledResult') + + global __nvvmGetProgramLogSize + __nvvmGetProgramLogSize = _cyb_GetProcAddress(handle, 'nvvmGetProgramLogSize') + + global __nvvmGetProgramLog + __nvvmGetProgramLog = _cyb_GetProcAddress(handle, 'nvvmGetProgramLog') + + global __nvvmLLVMVersion + __nvvmLLVMVersion = _cyb_GetProcAddress(handle, 'nvvmLLVMVersion') + + _cyb___py_nvvm_init = True + return 0 + +cdef inline int _check_or_init_nvvm() except -1 nogil: + if _cyb___py_nvvm_init: + return 0 + + return _init_nvvm() + + +cpdef dict _inspect_function_pointers(): + global _cyb_func_ptrs + if _cyb_func_ptrs is not None: + return _cyb_func_ptrs + + _check_or_init_nvvm() + cdef dict data = {} + global __nvvmGetErrorString + data["__nvvmGetErrorString"] = <_cyb_intptr_t>__nvvmGetErrorString + + global __nvvmVersion + data["__nvvmVersion"] = <_cyb_intptr_t>__nvvmVersion + + global __nvvmIRVersion + data["__nvvmIRVersion"] = <_cyb_intptr_t>__nvvmIRVersion + + global __nvvmCreateProgram + data["__nvvmCreateProgram"] = <_cyb_intptr_t>__nvvmCreateProgram + + global __nvvmDestroyProgram + data["__nvvmDestroyProgram"] = <_cyb_intptr_t>__nvvmDestroyProgram + + global __nvvmAddModuleToProgram + data["__nvvmAddModuleToProgram"] = <_cyb_intptr_t>__nvvmAddModuleToProgram + + global __nvvmLazyAddModuleToProgram + data["__nvvmLazyAddModuleToProgram"] = <_cyb_intptr_t>__nvvmLazyAddModuleToProgram + + global __nvvmCompileProgram + data["__nvvmCompileProgram"] = <_cyb_intptr_t>__nvvmCompileProgram + + global __nvvmVerifyProgram + data["__nvvmVerifyProgram"] = <_cyb_intptr_t>__nvvmVerifyProgram + + global __nvvmGetCompiledResultSize + data["__nvvmGetCompiledResultSize"] = <_cyb_intptr_t>__nvvmGetCompiledResultSize + + global __nvvmGetCompiledResult + data["__nvvmGetCompiledResult"] = <_cyb_intptr_t>__nvvmGetCompiledResult + + global __nvvmGetProgramLogSize + data["__nvvmGetProgramLogSize"] = <_cyb_intptr_t>__nvvmGetProgramLogSize + + global __nvvmGetProgramLog + data["__nvvmGetProgramLog"] = <_cyb_intptr_t>__nvvmGetProgramLog + + global __nvvmLLVMVersion + data["__nvvmLLVMVersion"] = <_cyb_intptr_t>__nvvmLLVMVersion + _cyb_func_ptrs = data + return data + + +cpdef _inspect_function_pointer(str name): + global _cyb_func_ptrs + if _cyb_func_ptrs is None: + _cyb_func_ptrs = _inspect_function_pointers() + return _cyb_func_ptrs[name] + + + + +cdef uintptr_t load_library() except* with gil: + return load_nvidia_dynamic_lib("nvvm")._handle_uint + + +############################################################################### +# Wrapper functions +############################################################################### + +cdef const char* _nvvmGetErrorString(nvvmResult result) except?NULL nogil: + global __nvvmGetErrorString + _check_or_init_nvvm() + if __nvvmGetErrorString == NULL: + with gil: + raise FunctionNotFoundError("function nvvmGetErrorString is not found") + return (__nvvmGetErrorString)( + result) + + +cdef nvvmResult _nvvmVersion(int* major, int* minor) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvvmVersion + _check_or_init_nvvm() + if __nvvmVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvvmVersion is not found") + return (__nvvmVersion)( + major, minor) + + +cdef nvvmResult _nvvmIRVersion(int* majorIR, int* minorIR, int* majorDbg, int* minorDbg) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvvmIRVersion + _check_or_init_nvvm() + if __nvvmIRVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvvmIRVersion is not found") + return (__nvvmIRVersion)( + majorIR, minorIR, majorDbg, minorDbg) + + +cdef nvvmResult _nvvmCreateProgram(nvvmProgram* prog) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvvmCreateProgram + _check_or_init_nvvm() + if __nvvmCreateProgram == NULL: + with gil: + raise FunctionNotFoundError("function nvvmCreateProgram is not found") + return (__nvvmCreateProgram)( + prog) + + +cdef nvvmResult _nvvmDestroyProgram(nvvmProgram* prog) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvvmDestroyProgram + _check_or_init_nvvm() + if __nvvmDestroyProgram == NULL: + with gil: + raise FunctionNotFoundError("function nvvmDestroyProgram is not found") + return (__nvvmDestroyProgram)( + prog) + + +cdef nvvmResult _nvvmAddModuleToProgram(nvvmProgram prog, const char* buffer, size_t size, const char* name) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvvmAddModuleToProgram + _check_or_init_nvvm() + if __nvvmAddModuleToProgram == NULL: + with gil: + raise FunctionNotFoundError("function nvvmAddModuleToProgram is not found") + return (__nvvmAddModuleToProgram)( + prog, buffer, size, name) + + +cdef nvvmResult _nvvmLazyAddModuleToProgram(nvvmProgram prog, const char* buffer, size_t size, const char* name) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvvmLazyAddModuleToProgram + _check_or_init_nvvm() + if __nvvmLazyAddModuleToProgram == NULL: + with gil: + raise FunctionNotFoundError("function nvvmLazyAddModuleToProgram is not found") + return (__nvvmLazyAddModuleToProgram)( + prog, buffer, size, name) + + +cdef nvvmResult _nvvmCompileProgram(nvvmProgram prog, int numOptions, const char** options) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvvmCompileProgram + _check_or_init_nvvm() + if __nvvmCompileProgram == NULL: + with gil: + raise FunctionNotFoundError("function nvvmCompileProgram is not found") + return (__nvvmCompileProgram)( + prog, numOptions, options) + + +cdef nvvmResult _nvvmVerifyProgram(nvvmProgram prog, int numOptions, const char** options) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvvmVerifyProgram + _check_or_init_nvvm() + if __nvvmVerifyProgram == NULL: + with gil: + raise FunctionNotFoundError("function nvvmVerifyProgram is not found") + return (__nvvmVerifyProgram)( + prog, numOptions, options) + + +cdef nvvmResult _nvvmGetCompiledResultSize(nvvmProgram prog, size_t* bufferSizeRet) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvvmGetCompiledResultSize + _check_or_init_nvvm() + if __nvvmGetCompiledResultSize == NULL: + with gil: + raise FunctionNotFoundError("function nvvmGetCompiledResultSize is not found") + return (__nvvmGetCompiledResultSize)( + prog, bufferSizeRet) + + +cdef nvvmResult _nvvmGetCompiledResult(nvvmProgram prog, char* buffer) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvvmGetCompiledResult + _check_or_init_nvvm() + if __nvvmGetCompiledResult == NULL: + with gil: + raise FunctionNotFoundError("function nvvmGetCompiledResult is not found") + return (__nvvmGetCompiledResult)( + prog, buffer) + + +cdef nvvmResult _nvvmGetProgramLogSize(nvvmProgram prog, size_t* bufferSizeRet) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvvmGetProgramLogSize + _check_or_init_nvvm() + if __nvvmGetProgramLogSize == NULL: + with gil: + raise FunctionNotFoundError("function nvvmGetProgramLogSize is not found") + return (__nvvmGetProgramLogSize)( + prog, bufferSizeRet) + + +cdef nvvmResult _nvvmGetProgramLog(nvvmProgram prog, char* buffer) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvvmGetProgramLog + _check_or_init_nvvm() + if __nvvmGetProgramLog == NULL: + with gil: + raise FunctionNotFoundError("function nvvmGetProgramLog is not found") + return (__nvvmGetProgramLog)( + prog, buffer) + + +cdef nvvmResult _nvvmLLVMVersion(const char* arch, int* major) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil: + global __nvvmLLVMVersion + _check_or_init_nvvm() + if __nvvmLLVMVersion == NULL: + with gil: + raise FunctionNotFoundError("function nvvmLLVMVersion is not found") + return (__nvvmLLVMVersion)( + arch, major) diff --git a/cuda_bindings/cuda/bindings/_internal/runtime.pxd b/cuda_bindings/cuda/bindings/_internal/runtime.pxd new file mode 100644 index 00000000000..04a943808a3 --- /dev/null +++ b/cuda_bindings/cuda/bindings/_internal/runtime.pxd @@ -0,0 +1,339 @@ +# SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +# This code was automatically generated across versions from 12.9.0 to 13.3.0. Do not modify it directly. + +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=afc5b9003f3efc6f826b46b17b5294f581a00a97f82beaad39634b5037b7669a +from ..cyruntime cimport * + +# EGL/GL/VDPAU helper declarations (implementations included in runtime_linux/windows.pyx) +include "../_lib/cyruntime/cyruntime.pxd" + +cdef cudaError_t _getLocalRuntimeVersion(int* runtimeVersion) except ?cudaErrorCallRequiresNewerDriver nogil + + +############################################################################### +# Wrapper functions +############################################################################### + +cdef cudaError_t _cudaDeviceReset() except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceSynchronize() except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceSetLimit(cudaLimit limit, size_t value) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceGetLimit(size_t* pValue, cudaLimit limit) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceGetTexture1DLinearMaxWidth(size_t* maxWidthInElements, const cudaChannelFormatDesc* fmtDesc, int device) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceGetCacheConfig(cudaFuncCache* pCacheConfig) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceGetStreamPriorityRange(int* leastPriority, int* greatestPriority) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceSetCacheConfig(cudaFuncCache cacheConfig) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceGetByPCIBusId(int* device, const char* pciBusId) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceGetPCIBusId(char* pciBusId, int len, int device) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaIpcGetEventHandle(cudaIpcEventHandle_t* handle, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaIpcOpenEventHandle(cudaEvent_t* event, cudaIpcEventHandle_t handle) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaIpcGetMemHandle(cudaIpcMemHandle_t* handle, void* devPtr) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaIpcOpenMemHandle(void** devPtr, cudaIpcMemHandle_t handle, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaIpcCloseMemHandle(void* devPtr) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceFlushGPUDirectRDMAWrites(cudaFlushGPUDirectRDMAWritesTarget target, cudaFlushGPUDirectRDMAWritesScope scope) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceRegisterAsyncNotification(int device, cudaAsyncCallback callbackFunc, void* userData, cudaAsyncCallbackHandle_t* callback) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceUnregisterAsyncNotification(int device, cudaAsyncCallbackHandle_t callback) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceGetSharedMemConfig(cudaSharedMemConfig* pConfig) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceSetSharedMemConfig(cudaSharedMemConfig config) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGetLastError() except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaPeekAtLastError() except ?cudaErrorCallRequiresNewerDriver nogil +cdef const char* _cudaGetErrorName(cudaError_t error) except?NULL nogil +cdef const char* _cudaGetErrorString(cudaError_t error) except?NULL nogil +cdef cudaError_t _cudaGetDeviceCount(int* count) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceGetAttribute(int* value, cudaDeviceAttr attr, int device) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceGetDefaultMemPool(cudaMemPool_t* memPool, int device) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceSetMemPool(int device, cudaMemPool_t memPool) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceGetMemPool(cudaMemPool_t* memPool, int device) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceGetNvSciSyncAttributes(void* nvSciSyncAttrList, int device, int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceGetP2PAttribute(int* value, cudaDeviceP2PAttr attr, int srcDevice, int dstDevice) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaChooseDevice(int* device, const cudaDeviceProp* prop) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaInitDevice(int device, unsigned int deviceFlags, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaSetDevice(int device) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGetDevice(int* device) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaSetDeviceFlags(unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGetDeviceFlags(unsigned int* flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaStreamCreate(cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaStreamCreateWithFlags(cudaStream_t* pStream, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaStreamCreateWithPriority(cudaStream_t* pStream, unsigned int flags, int priority) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaStreamGetPriority(cudaStream_t hStream, int* priority) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaStreamGetFlags(cudaStream_t hStream, unsigned int* flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaStreamGetId(cudaStream_t hStream, unsigned long long* streamId) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaStreamGetDevice(cudaStream_t hStream, int* device) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaCtxResetPersistingL2Cache() except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaStreamCopyAttributes(cudaStream_t dst, cudaStream_t src) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaStreamGetAttribute(cudaStream_t hStream, cudaStreamAttrID attr, cudaStreamAttrValue* value_out) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaStreamSetAttribute(cudaStream_t hStream, cudaStreamAttrID attr, const cudaStreamAttrValue* value) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaStreamDestroy(cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaStreamWaitEvent(cudaStream_t stream, cudaEvent_t event, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaStreamAddCallback(cudaStream_t stream, cudaStreamCallback_t callback, void* userData, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaStreamSynchronize(cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaStreamQuery(cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaStreamAttachMemAsync(cudaStream_t stream, void* devPtr, size_t length, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaStreamBeginCapture(cudaStream_t stream, cudaStreamCaptureMode mode) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaStreamBeginCaptureToGraph(cudaStream_t stream, cudaGraph_t graph, const cudaGraphNode_t* dependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, cudaStreamCaptureMode mode) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaThreadExchangeStreamCaptureMode(cudaStreamCaptureMode* mode) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaStreamEndCapture(cudaStream_t stream, cudaGraph_t* pGraph) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaStreamIsCapturing(cudaStream_t stream, cudaStreamCaptureStatus* pCaptureStatus) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaStreamUpdateCaptureDependencies(cudaStream_t stream, cudaGraphNode_t* dependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaEventCreate(cudaEvent_t* event) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaEventCreateWithFlags(cudaEvent_t* event, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaEventRecord(cudaEvent_t event, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaEventRecordWithFlags(cudaEvent_t event, cudaStream_t stream, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaEventQuery(cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaEventSynchronize(cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaEventDestroy(cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaEventElapsedTime(float* ms, cudaEvent_t start, cudaEvent_t end) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaImportExternalMemory(cudaExternalMemory_t* extMem_out, const cudaExternalMemoryHandleDesc* memHandleDesc) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaExternalMemoryGetMappedBuffer(void** devPtr, cudaExternalMemory_t extMem, const cudaExternalMemoryBufferDesc* bufferDesc) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaExternalMemoryGetMappedMipmappedArray(cudaMipmappedArray_t* mipmap, cudaExternalMemory_t extMem, const cudaExternalMemoryMipmappedArrayDesc* mipmapDesc) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDestroyExternalMemory(cudaExternalMemory_t extMem) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaImportExternalSemaphore(cudaExternalSemaphore_t* extSem_out, const cudaExternalSemaphoreHandleDesc* semHandleDesc) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDestroyExternalSemaphore(cudaExternalSemaphore_t extSem) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaFuncSetCacheConfig(const void* func, cudaFuncCache cacheConfig) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaFuncGetAttributes(cudaFuncAttributes* attr, const void* func) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaFuncSetAttribute(const void* func, cudaFuncAttribute attr, int value) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaFuncGetName(const char** name, const void* func) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaFuncGetParamInfo(const void* func, size_t paramIndex, size_t* paramOffset, size_t* paramSize) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaLaunchHostFunc(cudaStream_t stream, cudaHostFn_t fn, void* userData) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaFuncSetSharedMemConfig(const void* func, cudaSharedMemConfig config) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaOccupancyMaxActiveBlocksPerMultiprocessor(int* numBlocks, const void* func, int blockSize, size_t dynamicSMemSize) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaOccupancyAvailableDynamicSMemPerBlock(size_t* dynamicSmemSize, const void* func, int numBlocks, int blockSize) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(int* numBlocks, const void* func, int blockSize, size_t dynamicSMemSize, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMallocManaged(void** devPtr, size_t size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMalloc(void** devPtr, size_t size) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMallocHost(void** ptr, size_t size) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMallocPitch(void** devPtr, size_t* pitch, size_t width, size_t height) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMallocArray(cudaArray_t* array, const cudaChannelFormatDesc* desc, size_t width, size_t height, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaFree(void* devPtr) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaFreeHost(void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaFreeArray(cudaArray_t array) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaFreeMipmappedArray(cudaMipmappedArray_t mipmappedArray) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaHostAlloc(void** pHost, size_t size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaHostRegister(void* ptr, size_t size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaHostUnregister(void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaHostGetDevicePointer(void** pDevice, void* pHost, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaHostGetFlags(unsigned int* pFlags, void* pHost) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMalloc3D(cudaPitchedPtr* pitchedDevPtr, cudaExtent extent) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMalloc3DArray(cudaArray_t* array, const cudaChannelFormatDesc* desc, cudaExtent extent, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMallocMipmappedArray(cudaMipmappedArray_t* mipmappedArray, const cudaChannelFormatDesc* desc, cudaExtent extent, unsigned int numLevels, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGetMipmappedArrayLevel(cudaArray_t* levelArray, cudaMipmappedArray_const_t mipmappedArray, unsigned int level) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemcpy3D(const cudaMemcpy3DParms* p) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemcpy3DPeer(const cudaMemcpy3DPeerParms* p) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemcpy3DAsync(const cudaMemcpy3DParms* p, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemcpy3DPeerAsync(const cudaMemcpy3DPeerParms* p, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemGetInfo(size_t* free, size_t* total) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaArrayGetInfo(cudaChannelFormatDesc* desc, cudaExtent* extent, unsigned int* flags, cudaArray_t array) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaArrayGetPlane(cudaArray_t* pPlaneArray, cudaArray_t hArray, unsigned int planeIdx) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaArrayGetMemoryRequirements(cudaArrayMemoryRequirements* memoryRequirements, cudaArray_t array, int device) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMipmappedArrayGetMemoryRequirements(cudaArrayMemoryRequirements* memoryRequirements, cudaMipmappedArray_t mipmap, int device) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaArrayGetSparseProperties(cudaArraySparseProperties* sparseProperties, cudaArray_t array) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMipmappedArrayGetSparseProperties(cudaArraySparseProperties* sparseProperties, cudaMipmappedArray_t mipmap) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemcpy(void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemcpyPeer(void* dst, int dstDevice, const void* src, int srcDevice, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemcpy2D(void* dst, size_t dpitch, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemcpy2DToArray(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemcpy2DFromArray(void* dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemcpy2DArrayToArray(cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemcpyAsync(void* dst, const void* src, size_t count, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemcpyPeerAsync(void* dst, int dstDevice, const void* src, int srcDevice, size_t count, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemcpyBatchAsync(const void** dsts, const void** srcs, const size_t* sizes, size_t count, cudaMemcpyAttributes* attrs, size_t* attrsIdxs, size_t numAttrs, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemcpy3DBatchAsync(size_t numOps, cudaMemcpy3DBatchOp* opList, unsigned long long flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemcpy2DAsync(void* dst, size_t dpitch, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemcpy2DToArrayAsync(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemcpy2DFromArrayAsync(void* dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemset(void* devPtr, int value, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemset2D(void* devPtr, size_t pitch, int value, size_t width, size_t height) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemset3D(cudaPitchedPtr pitchedDevPtr, int value, cudaExtent extent) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemsetAsync(void* devPtr, int value, size_t count, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemset2DAsync(void* devPtr, size_t pitch, int value, size_t width, size_t height, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemset3DAsync(cudaPitchedPtr pitchedDevPtr, int value, cudaExtent extent, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemPrefetchAsync(const void* devPtr, size_t count, cudaMemLocation location, unsigned int flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemAdvise(const void* devPtr, size_t count, cudaMemoryAdvise advice, cudaMemLocation location) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemRangeGetAttribute(void* data, size_t dataSize, cudaMemRangeAttribute attribute, const void* devPtr, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemRangeGetAttributes(void** data, size_t* dataSizes, cudaMemRangeAttribute* attributes, size_t numAttributes, const void* devPtr, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemcpyToArray(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemcpyFromArray(void* dst, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemcpyArrayToArray(cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemcpyToArrayAsync(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t count, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemcpyFromArrayAsync(void* dst, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMallocAsync(void** devPtr, size_t size, cudaStream_t hStream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaFreeAsync(void* devPtr, cudaStream_t hStream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemPoolTrimTo(cudaMemPool_t memPool, size_t minBytesToKeep) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemPoolSetAttribute(cudaMemPool_t memPool, cudaMemPoolAttr attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemPoolGetAttribute(cudaMemPool_t memPool, cudaMemPoolAttr attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemPoolSetAccess(cudaMemPool_t memPool, const cudaMemAccessDesc* descList, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemPoolGetAccess(cudaMemAccessFlags* flags, cudaMemPool_t memPool, cudaMemLocation* location) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemPoolCreate(cudaMemPool_t* memPool, const cudaMemPoolProps* poolProps) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemPoolDestroy(cudaMemPool_t memPool) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMallocFromPoolAsync(void** ptr, size_t size, cudaMemPool_t memPool, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemPoolExportToShareableHandle(void* shareableHandle, cudaMemPool_t memPool, cudaMemAllocationHandleType handleType, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemPoolImportFromShareableHandle(cudaMemPool_t* memPool, void* shareableHandle, cudaMemAllocationHandleType handleType, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemPoolExportPointer(cudaMemPoolPtrExportData* exportData, void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemPoolImportPointer(void** ptr, cudaMemPool_t memPool, cudaMemPoolPtrExportData* exportData) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaPointerGetAttributes(cudaPointerAttributes* attributes, const void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceCanAccessPeer(int* canAccessPeer, int device, int peerDevice) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceEnablePeerAccess(int peerDevice, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceDisablePeerAccess(int peerDevice) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphicsUnregisterResource(cudaGraphicsResource_t resource) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphicsResourceSetMapFlags(cudaGraphicsResource_t resource, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphicsMapResources(int count, cudaGraphicsResource_t* resources, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphicsUnmapResources(int count, cudaGraphicsResource_t* resources, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphicsResourceGetMappedPointer(void** devPtr, size_t* size, cudaGraphicsResource_t resource) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphicsSubResourceGetMappedArray(cudaArray_t* array, cudaGraphicsResource_t resource, unsigned int arrayIndex, unsigned int mipLevel) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphicsResourceGetMappedMipmappedArray(cudaMipmappedArray_t* mipmappedArray, cudaGraphicsResource_t resource) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGetChannelDesc(cudaChannelFormatDesc* desc, cudaArray_const_t array) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaChannelFormatDesc _cudaCreateChannelDesc(int x, int y, int z, int w, cudaChannelFormatKind f) except* nogil +cdef cudaError_t _cudaCreateTextureObject(cudaTextureObject_t* pTexObject, const cudaResourceDesc* pResDesc, const cudaTextureDesc* pTexDesc, const cudaResourceViewDesc* pResViewDesc) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDestroyTextureObject(cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGetTextureObjectResourceDesc(cudaResourceDesc* pResDesc, cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGetTextureObjectTextureDesc(cudaTextureDesc* pTexDesc, cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGetTextureObjectResourceViewDesc(cudaResourceViewDesc* pResViewDesc, cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaCreateSurfaceObject(cudaSurfaceObject_t* pSurfObject, const cudaResourceDesc* pResDesc) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDestroySurfaceObject(cudaSurfaceObject_t surfObject) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGetSurfaceObjectResourceDesc(cudaResourceDesc* pResDesc, cudaSurfaceObject_t surfObject) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDriverGetVersion(int* driverVersion) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaRuntimeGetVersion(int* runtimeVersion) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphCreate(cudaGraph_t* pGraph, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphAddKernelNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphKernelNodeGetParams(cudaGraphNode_t node, cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphKernelNodeSetParams(cudaGraphNode_t node, const cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphKernelNodeCopyAttributes(cudaGraphNode_t hDst, cudaGraphNode_t hSrc) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphKernelNodeGetAttribute(cudaGraphNode_t hNode, cudaKernelNodeAttrID attr, cudaKernelNodeAttrValue* value_out) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphKernelNodeSetAttribute(cudaGraphNode_t hNode, cudaKernelNodeAttrID attr, const cudaKernelNodeAttrValue* value) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphAddMemcpyNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaMemcpy3DParms* pCopyParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphAddMemcpyNode1D(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphMemcpyNodeGetParams(cudaGraphNode_t node, cudaMemcpy3DParms* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphMemcpyNodeSetParams(cudaGraphNode_t node, const cudaMemcpy3DParms* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphMemcpyNodeSetParams1D(cudaGraphNode_t node, void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphAddMemsetNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaMemsetParams* pMemsetParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphMemsetNodeGetParams(cudaGraphNode_t node, cudaMemsetParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphMemsetNodeSetParams(cudaGraphNode_t node, const cudaMemsetParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphAddHostNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphHostNodeGetParams(cudaGraphNode_t node, cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphHostNodeSetParams(cudaGraphNode_t node, const cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphAddChildGraphNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaGraph_t childGraph) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphChildGraphNodeGetGraph(cudaGraphNode_t node, cudaGraph_t* pGraph) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphAddEmptyNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphAddEventRecordNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphEventRecordNodeGetEvent(cudaGraphNode_t node, cudaEvent_t* event_out) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphEventRecordNodeSetEvent(cudaGraphNode_t node, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphAddEventWaitNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphEventWaitNodeGetEvent(cudaGraphNode_t node, cudaEvent_t* event_out) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphEventWaitNodeSetEvent(cudaGraphNode_t node, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphAddExternalSemaphoresSignalNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphExternalSemaphoresSignalNodeGetParams(cudaGraphNode_t hNode, cudaExternalSemaphoreSignalNodeParams* params_out) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphExternalSemaphoresSignalNodeSetParams(cudaGraphNode_t hNode, const cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphAddExternalSemaphoresWaitNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphExternalSemaphoresWaitNodeGetParams(cudaGraphNode_t hNode, cudaExternalSemaphoreWaitNodeParams* params_out) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphExternalSemaphoresWaitNodeSetParams(cudaGraphNode_t hNode, const cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphAddMemAllocNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaMemAllocNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphMemAllocNodeGetParams(cudaGraphNode_t node, cudaMemAllocNodeParams* params_out) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphAddMemFreeNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, void* dptr) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphMemFreeNodeGetParams(cudaGraphNode_t node, void* dptr_out) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceGraphMemTrim(int device) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceGetGraphMemAttribute(int device, cudaGraphMemAttributeType attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceSetGraphMemAttribute(int device, cudaGraphMemAttributeType attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphClone(cudaGraph_t* pGraphClone, cudaGraph_t originalGraph) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphNodeFindInClone(cudaGraphNode_t* pNode, cudaGraphNode_t originalNode, cudaGraph_t clonedGraph) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphNodeGetType(cudaGraphNode_t node, cudaGraphNodeType* pType) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphGetNodes(cudaGraph_t graph, cudaGraphNode_t* nodes, size_t* numNodes) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphGetRootNodes(cudaGraph_t graph, cudaGraphNode_t* pRootNodes, size_t* pNumRootNodes) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphGetEdges(cudaGraph_t graph, cudaGraphNode_t* from_, cudaGraphNode_t* to, cudaGraphEdgeData* edgeData, size_t* numEdges) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphNodeGetDependencies(cudaGraphNode_t node, cudaGraphNode_t* pDependencies, cudaGraphEdgeData* edgeData, size_t* pNumDependencies) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphNodeGetDependentNodes(cudaGraphNode_t node, cudaGraphNode_t* pDependentNodes, cudaGraphEdgeData* edgeData, size_t* pNumDependentNodes) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphAddDependencies(cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, const cudaGraphEdgeData* edgeData, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphRemoveDependencies(cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, const cudaGraphEdgeData* edgeData, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphDestroyNode(cudaGraphNode_t node) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphInstantiate(cudaGraphExec_t* pGraphExec, cudaGraph_t graph, unsigned long long flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphInstantiateWithFlags(cudaGraphExec_t* pGraphExec, cudaGraph_t graph, unsigned long long flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphInstantiateWithParams(cudaGraphExec_t* pGraphExec, cudaGraph_t graph, cudaGraphInstantiateParams* instantiateParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphExecGetFlags(cudaGraphExec_t graphExec, unsigned long long* flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphExecKernelNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphExecMemcpyNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaMemcpy3DParms* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphExecMemcpyNodeSetParams1D(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphExecMemsetNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaMemsetParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphExecHostNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphExecChildGraphNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, cudaGraph_t childGraph) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphExecEventRecordNodeSetEvent(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphExecEventWaitNodeSetEvent(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphExecExternalSemaphoresSignalNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, const cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphExecExternalSemaphoresWaitNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, const cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphNodeSetEnabled(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, unsigned int isEnabled) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphNodeGetEnabled(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, unsigned int* isEnabled) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphExecUpdate(cudaGraphExec_t hGraphExec, cudaGraph_t hGraph, cudaGraphExecUpdateResultInfo* resultInfo) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphUpload(cudaGraphExec_t graphExec, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphLaunch(cudaGraphExec_t graphExec, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphExecDestroy(cudaGraphExec_t graphExec) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphDestroy(cudaGraph_t graph) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphDebugDotPrint(cudaGraph_t graph, const char* path, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaUserObjectCreate(cudaUserObject_t* object_out, void* ptr, cudaHostFn_t destroy, unsigned int initialRefcount, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaUserObjectRetain(cudaUserObject_t object, unsigned int count) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaUserObjectRelease(cudaUserObject_t object, unsigned int count) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphRetainUserObject(cudaGraph_t graph, cudaUserObject_t object, unsigned int count, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphReleaseUserObject(cudaGraph_t graph, cudaUserObject_t object, unsigned int count) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphAddNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphNodeSetParams(cudaGraphNode_t node, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphExecNodeSetParams(cudaGraphExec_t graphExec, cudaGraphNode_t node, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphConditionalHandleCreate(cudaGraphConditionalHandle* pHandle_out, cudaGraph_t graph, unsigned int defaultLaunchValue, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGetDriverEntryPoint(const char* symbol, void** funcPtr, unsigned long long flags, cudaDriverEntryPointQueryResult* driverStatus) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGetDriverEntryPointByVersion(const char* symbol, void** funcPtr, unsigned int cudaVersion, unsigned long long flags, cudaDriverEntryPointQueryResult* driverStatus) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaLibraryLoadData(cudaLibrary_t* library, const void* code, cudaJitOption* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, cudaLibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaLibraryLoadFromFile(cudaLibrary_t* library, const char* fileName, cudaJitOption* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, cudaLibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaLibraryUnload(cudaLibrary_t library) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaLibraryGetKernel(cudaKernel_t* pKernel, cudaLibrary_t library, const char* name) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaLibraryGetGlobal(void** dptr, size_t* bytes, cudaLibrary_t library, const char* name) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaLibraryGetManaged(void** dptr, size_t* bytes, cudaLibrary_t library, const char* name) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaLibraryGetUnifiedFunction(void** fptr, cudaLibrary_t library, const char* symbol) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaLibraryGetKernelCount(unsigned int* count, cudaLibrary_t lib) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaLibraryEnumerateKernels(cudaKernel_t* kernels, unsigned int numKernels, cudaLibrary_t lib) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaKernelSetAttributeForDevice(cudaKernel_t kernel, cudaFuncAttribute attr, int value, int device) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGetExportTable(const void** ppExportTable, const cudaUUID_t* pExportTableId) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGetKernel(cudaKernel_t* kernelPtr, const void* entryFuncAddr) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaProfilerStart() except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaProfilerStop() except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGetDeviceProperties(cudaDeviceProp* prop, int device) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceGetHostAtomicCapabilities(unsigned int* capabilities, const cudaAtomicOperation* operations, unsigned int count, int device) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceGetP2PAtomicCapabilities(unsigned int* capabilities, const cudaAtomicOperation* operations, unsigned int count, int srcDevice, int dstDevice) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaStreamGetCaptureInfo(cudaStream_t stream, cudaStreamCaptureStatus* captureStatus_out, unsigned long long* id_out, cudaGraph_t* graph_out, const cudaGraphNode_t** dependencies_out, const cudaGraphEdgeData** edgeData_out, size_t* numDependencies_out) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaSignalExternalSemaphoresAsync(const cudaExternalSemaphore_t* extSemArray, const cudaExternalSemaphoreSignalParams* paramsArray, unsigned int numExtSems, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaWaitExternalSemaphoresAsync(const cudaExternalSemaphore_t* extSemArray, const cudaExternalSemaphoreWaitParams* paramsArray, unsigned int numExtSems, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemPrefetchBatchAsync(void** dptrs, size_t* sizes, size_t count, cudaMemLocation* prefetchLocs, size_t* prefetchLocIdxs, size_t numPrefetchLocs, unsigned long long flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemDiscardBatchAsync(void** dptrs, size_t* sizes, size_t count, unsigned long long flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemDiscardAndPrefetchBatchAsync(void** dptrs, size_t* sizes, size_t count, cudaMemLocation* prefetchLocs, size_t* prefetchLocIdxs, size_t numPrefetchLocs, unsigned long long flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemGetDefaultMemPool(cudaMemPool_t* memPool, cudaMemLocation* location, cudaMemAllocationType type) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemGetMemPool(cudaMemPool_t* memPool, cudaMemLocation* location, cudaMemAllocationType type) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemSetMemPool(cudaMemLocation* location, cudaMemAllocationType type, cudaMemPool_t memPool) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaLogsRegisterCallback(cudaLogsCallback_t callbackFunc, void* userData, cudaLogsCallbackHandle* callback_out) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaLogsUnregisterCallback(cudaLogsCallbackHandle callback) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaLogsCurrent(cudaLogIterator* iterator_out, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaLogsDumpToFile(cudaLogIterator* iterator, const char* pathToFile, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaLogsDumpToMemory(cudaLogIterator* iterator, char* buffer, size_t* size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphNodeGetContainingGraph(cudaGraphNode_t hNode, cudaGraph_t* phGraph) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphNodeGetLocalId(cudaGraphNode_t hNode, unsigned int* nodeId) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphNodeGetToolsId(cudaGraphNode_t hNode, unsigned long long* toolsNodeId) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphGetId(cudaGraph_t hGraph, unsigned int* graphID) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphExecGetId(cudaGraphExec_t hGraphExec, unsigned int* graphID) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphConditionalHandleCreate_v2(cudaGraphConditionalHandle* pHandle_out, cudaGraph_t graph, cudaExecutionContext_t ctx, unsigned int defaultLaunchValue, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceGetDevResource(int device, cudaDevResource* resource, cudaDevResourceType type) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDevSmResourceSplitByCount(cudaDevResource* result, unsigned int* nbGroups, const cudaDevResource* input, cudaDevResource* remaining, unsigned int flags, unsigned int minCount) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDevSmResourceSplit(cudaDevResource* result, unsigned int nbGroups, const cudaDevResource* input, cudaDevResource* remainder, unsigned int flags, cudaDevSmResourceGroupParams* groupParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDevResourceGenerateDesc(cudaDevResourceDesc_t* phDesc, cudaDevResource* resources, unsigned int nbResources) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGreenCtxCreate(cudaExecutionContext_t* phCtx, cudaDevResourceDesc_t desc, int device, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaExecutionCtxDestroy(cudaExecutionContext_t ctx) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaExecutionCtxGetDevResource(cudaExecutionContext_t ctx, cudaDevResource* resource, cudaDevResourceType type) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaExecutionCtxGetDevice(int* device, cudaExecutionContext_t ctx) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaExecutionCtxGetId(cudaExecutionContext_t ctx, unsigned long long* ctxId) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaExecutionCtxStreamCreate(cudaStream_t* phStream, cudaExecutionContext_t ctx, unsigned int flags, int priority) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaExecutionCtxSynchronize(cudaExecutionContext_t ctx) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaStreamGetDevResource(cudaStream_t hStream, cudaDevResource* resource, cudaDevResourceType type) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaExecutionCtxRecordEvent(cudaExecutionContext_t ctx, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaExecutionCtxWaitEvent(cudaExecutionContext_t ctx, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceGetExecutionCtx(cudaExecutionContext_t* ctx, int device) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaFuncGetParamCount(const void* func, size_t* paramCount) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaLaunchHostFunc_v2(cudaStream_t stream, cudaHostFn_t fn, void* userData, unsigned int syncMode) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemcpyWithAttributesAsync(void* dst, const void* src, size_t size, cudaMemcpyAttributes* attr, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemcpy3DWithAttributesAsync(cudaMemcpy3DBatchOp* op, unsigned long long flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphNodeGetParams(cudaGraphNode_t node, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaStreamBeginRecaptureToGraph(cudaStream_t stream, cudaStreamCaptureMode mode, cudaGraph_t graph, cudaGraphRecaptureCallbackData* callbackData) except ?cudaErrorCallRequiresNewerDriver nogil diff --git a/cuda_bindings/cuda/bindings/_internal/runtime_linux.pyx b/cuda_bindings/cuda/bindings/_internal/runtime_linux.pyx new file mode 100644 index 00000000000..2d1409ce2be --- /dev/null +++ b/cuda_bindings/cuda/bindings/_internal/runtime_linux.pyx @@ -0,0 +1,3288 @@ +# SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +# This code was automatically generated across versions from 12.9.0 to 13.3.0. Do not modify it directly. + +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=c45a1e41ddef35af045f2ff91e9703cb77870bf90603b3c5c7369e76f7a539f0 +import os + +from libc.stdint cimport uintptr_t + +from cuda.pathfinder import load_nvidia_dynamic_lib +cimport cuda.bindings._lib.dlfcn as dlfcn +cimport cuda.bindings._internal.runtime_ptds as ptds +cimport cython + + +############################################################################### +# Per-thread default stream dispatch +############################################################################### + +cdef bint __cudaPythonInit = False +cdef bint __usePTDS = False + +cdef int _cudaPythonInit() except -1 nogil: + global __cudaPythonInit + global __usePTDS + with gil: + __usePTDS = bool(int(os.getenv('CUDA_PYTHON_CUDA_PER_THREAD_DEFAULT_STREAM', default=0))) + __cudaPythonInit = True + return __usePTDS + +cdef inline int cudaPythonInit() except -1 nogil: + if __cudaPythonInit: + return __usePTDS + return _cudaPythonInit() + + +############################################################################### +# EGL/GL/VDPAU helpers (implementations delegating to driver EGL/VDPAU/GL APIs) +############################################################################### + +include "../_lib/cyruntime/cyruntime.pxi" + + +############################################################################### +# getLocalRuntimeVersion — dynamically loads cudart to read its own version +############################################################################### + +cdef cudaError_t _getLocalRuntimeVersion(int* runtimeVersion) except ?cudaErrorCallRequiresNewerDriver nogil: + # Load cudart dynamically to read its embedded version number. + with gil: + loaded_dl = load_nvidia_dynamic_lib("cudart") + handle = loaded_dl._handle_uint + + cdef void* __cudaRuntimeGetVersion = dlfcn.dlsym(handle, 'cudaRuntimeGetVersion') + + if __cudaRuntimeGetVersion == NULL: + with gil: + raise RuntimeError(f'Function "cudaRuntimeGetVersion" not found in {loaded_dl.abs_path}') + + # We explicitly do *NOT* cleanup the library handle here, acknowledging + # that, yes, the handle leaks. The reason is that there's a + # `functools.cache` on the top-level caller of this function. + # + # This means this library would be opened once and then immediately closed, + # all the while remaining in the cache lurking there for people to call. + # + # Since we open the library one time (technically once per unique library name), + # there's not a ton of leakage, which we deem acceptable for the 1000x speedup + # achieved by caching (ultimately) `ctypes.CDLL` calls. + # + # Long(er)-term we can explore cleaning up the library using higher-level + # Python mechanisms, like `__del__` or `weakref.finalizer`s. + + cdef cudaError_t err = cudaSuccess + err = ( __cudaRuntimeGetVersion)(runtimeVersion) + return err + + +############################################################################### +# C function declarations for static cudart (avoids infinite recursion through +# the same-named Cython wrappers imported via `from ..cyruntime cimport *`) +############################################################################### + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceReset "cudaDeviceReset" () noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceSynchronize "cudaDeviceSynchronize" () noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceSetLimit "cudaDeviceSetLimit" (cudaLimit limit, size_t value) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetLimit "cudaDeviceGetLimit" (size_t* pValue, cudaLimit limit) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetTexture1DLinearMaxWidth "cudaDeviceGetTexture1DLinearMaxWidth" (size_t* maxWidthInElements, const cudaChannelFormatDesc* fmtDesc, int device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetCacheConfig "cudaDeviceGetCacheConfig" (cudaFuncCache* pCacheConfig) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetStreamPriorityRange "cudaDeviceGetStreamPriorityRange" (int* leastPriority, int* greatestPriority) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceSetCacheConfig "cudaDeviceSetCacheConfig" (cudaFuncCache cacheConfig) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetByPCIBusId "cudaDeviceGetByPCIBusId" (int* device, const char* pciBusId) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetPCIBusId "cudaDeviceGetPCIBusId" (char* pciBusId, int len, int device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaIpcGetEventHandle "cudaIpcGetEventHandle" (cudaIpcEventHandle_t* handle, cudaEvent_t event) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaIpcOpenEventHandle "cudaIpcOpenEventHandle" (cudaEvent_t* event, cudaIpcEventHandle_t handle) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaIpcGetMemHandle "cudaIpcGetMemHandle" (cudaIpcMemHandle_t* handle, void* devPtr) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaIpcOpenMemHandle "cudaIpcOpenMemHandle" (void** devPtr, cudaIpcMemHandle_t handle, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaIpcCloseMemHandle "cudaIpcCloseMemHandle" (void* devPtr) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceFlushGPUDirectRDMAWrites "cudaDeviceFlushGPUDirectRDMAWrites" (cudaFlushGPUDirectRDMAWritesTarget target, cudaFlushGPUDirectRDMAWritesScope scope) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceRegisterAsyncNotification "cudaDeviceRegisterAsyncNotification" (int device, cudaAsyncCallback callbackFunc, void* userData, cudaAsyncCallbackHandle_t* callback) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceUnregisterAsyncNotification "cudaDeviceUnregisterAsyncNotification" (int device, cudaAsyncCallbackHandle_t callback) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetSharedMemConfig "cudaDeviceGetSharedMemConfig" (cudaSharedMemConfig* pConfig) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceSetSharedMemConfig "cudaDeviceSetSharedMemConfig" (cudaSharedMemConfig config) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetLastError "cudaGetLastError" () noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaPeekAtLastError "cudaPeekAtLastError" () noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + const char* _static_cudaGetErrorName "cudaGetErrorName" (cudaError_t error) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + const char* _static_cudaGetErrorString "cudaGetErrorString" (cudaError_t error) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetDeviceCount "cudaGetDeviceCount" (int* count) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetAttribute "cudaDeviceGetAttribute" (int* value, cudaDeviceAttr attr, int device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetDefaultMemPool "cudaDeviceGetDefaultMemPool" (cudaMemPool_t* memPool, int device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceSetMemPool "cudaDeviceSetMemPool" (int device, cudaMemPool_t memPool) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetMemPool "cudaDeviceGetMemPool" (cudaMemPool_t* memPool, int device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetNvSciSyncAttributes "cudaDeviceGetNvSciSyncAttributes" (void* nvSciSyncAttrList, int device, int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetP2PAttribute "cudaDeviceGetP2PAttribute" (int* value, cudaDeviceP2PAttr attr, int srcDevice, int dstDevice) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaChooseDevice "cudaChooseDevice" (int* device, const cudaDeviceProp* prop) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaInitDevice "cudaInitDevice" (int device, unsigned int deviceFlags, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaSetDevice "cudaSetDevice" (int device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetDevice "cudaGetDevice" (int* device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaSetDeviceFlags "cudaSetDeviceFlags" (unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetDeviceFlags "cudaGetDeviceFlags" (unsigned int* flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamCreate "cudaStreamCreate" (cudaStream_t* pStream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamCreateWithFlags "cudaStreamCreateWithFlags" (cudaStream_t* pStream, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamCreateWithPriority "cudaStreamCreateWithPriority" (cudaStream_t* pStream, unsigned int flags, int priority) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamGetPriority "cudaStreamGetPriority" (cudaStream_t hStream, int* priority) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamGetFlags "cudaStreamGetFlags" (cudaStream_t hStream, unsigned int* flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamGetId "cudaStreamGetId" (cudaStream_t hStream, unsigned long long* streamId) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamGetDevice "cudaStreamGetDevice" (cudaStream_t hStream, int* device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaCtxResetPersistingL2Cache "cudaCtxResetPersistingL2Cache" () noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamCopyAttributes "cudaStreamCopyAttributes" (cudaStream_t dst, cudaStream_t src) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamGetAttribute "cudaStreamGetAttribute" (cudaStream_t hStream, cudaLaunchAttributeID attr, cudaLaunchAttributeValue* value_out) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamSetAttribute "cudaStreamSetAttribute" (cudaStream_t hStream, cudaLaunchAttributeID attr, const cudaLaunchAttributeValue* value) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamDestroy "cudaStreamDestroy" (cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamWaitEvent "cudaStreamWaitEvent" (cudaStream_t stream, cudaEvent_t event, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamAddCallback "cudaStreamAddCallback" (cudaStream_t stream, cudaStreamCallback_t callback, void* userData, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamSynchronize "cudaStreamSynchronize" (cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamQuery "cudaStreamQuery" (cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamAttachMemAsync "cudaStreamAttachMemAsync" (cudaStream_t stream, void* devPtr, size_t length, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamBeginCapture "cudaStreamBeginCapture" (cudaStream_t stream, cudaStreamCaptureMode mode) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamBeginCaptureToGraph "cudaStreamBeginCaptureToGraph" (cudaStream_t stream, cudaGraph_t graph, const cudaGraphNode_t* dependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, cudaStreamCaptureMode mode) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaThreadExchangeStreamCaptureMode "cudaThreadExchangeStreamCaptureMode" (cudaStreamCaptureMode* mode) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamEndCapture "cudaStreamEndCapture" (cudaStream_t stream, cudaGraph_t* pGraph) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamIsCapturing "cudaStreamIsCapturing" (cudaStream_t stream, cudaStreamCaptureStatus* pCaptureStatus) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamUpdateCaptureDependencies "cudaStreamUpdateCaptureDependencies" (cudaStream_t stream, cudaGraphNode_t* dependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaEventCreate "cudaEventCreate" (cudaEvent_t* event) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaEventCreateWithFlags "cudaEventCreateWithFlags" (cudaEvent_t* event, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaEventRecord "cudaEventRecord" (cudaEvent_t event, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaEventRecordWithFlags "cudaEventRecordWithFlags" (cudaEvent_t event, cudaStream_t stream, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaEventQuery "cudaEventQuery" (cudaEvent_t event) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaEventSynchronize "cudaEventSynchronize" (cudaEvent_t event) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaEventDestroy "cudaEventDestroy" (cudaEvent_t event) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaEventElapsedTime "cudaEventElapsedTime" (float* ms, cudaEvent_t start, cudaEvent_t end) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaImportExternalMemory "cudaImportExternalMemory" (cudaExternalMemory_t* extMem_out, const cudaExternalMemoryHandleDesc* memHandleDesc) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaExternalMemoryGetMappedBuffer "cudaExternalMemoryGetMappedBuffer" (void** devPtr, cudaExternalMemory_t extMem, const cudaExternalMemoryBufferDesc* bufferDesc) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaExternalMemoryGetMappedMipmappedArray "cudaExternalMemoryGetMappedMipmappedArray" (cudaMipmappedArray_t* mipmap, cudaExternalMemory_t extMem, const cudaExternalMemoryMipmappedArrayDesc* mipmapDesc) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDestroyExternalMemory "cudaDestroyExternalMemory" (cudaExternalMemory_t extMem) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaImportExternalSemaphore "cudaImportExternalSemaphore" (cudaExternalSemaphore_t* extSem_out, const cudaExternalSemaphoreHandleDesc* semHandleDesc) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDestroyExternalSemaphore "cudaDestroyExternalSemaphore" (cudaExternalSemaphore_t extSem) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaFuncSetCacheConfig "cudaFuncSetCacheConfig" (const void* func, cudaFuncCache cacheConfig) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaFuncGetAttributes "cudaFuncGetAttributes" (cudaFuncAttributes* attr, const void* func) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaFuncSetAttribute "cudaFuncSetAttribute" (const void* func, cudaFuncAttribute attr, int value) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaFuncGetName "cudaFuncGetName" (const char** name, const void* func) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaFuncGetParamInfo "cudaFuncGetParamInfo" (const void* func, size_t paramIndex, size_t* paramOffset, size_t* paramSize) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLaunchHostFunc "cudaLaunchHostFunc" (cudaStream_t stream, cudaHostFn_t fn, void* userData) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaFuncSetSharedMemConfig "cudaFuncSetSharedMemConfig" (const void* func, cudaSharedMemConfig config) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaOccupancyMaxActiveBlocksPerMultiprocessor "cudaOccupancyMaxActiveBlocksPerMultiprocessor" (int* numBlocks, const void* func, int blockSize, size_t dynamicSMemSize) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaOccupancyAvailableDynamicSMemPerBlock "cudaOccupancyAvailableDynamicSMemPerBlock" (size_t* dynamicSmemSize, const void* func, int numBlocks, int blockSize) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags "cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags" (int* numBlocks, const void* func, int blockSize, size_t dynamicSMemSize, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMallocManaged "cudaMallocManaged" (void** devPtr, size_t size, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMalloc "cudaMalloc" (void** devPtr, size_t size) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMallocHost "cudaMallocHost" (void** ptr, size_t size) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMallocPitch "cudaMallocPitch" (void** devPtr, size_t* pitch, size_t width, size_t height) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMallocArray "cudaMallocArray" (cudaArray_t* array, const cudaChannelFormatDesc* desc, size_t width, size_t height, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaFree "cudaFree" (void* devPtr) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaFreeHost "cudaFreeHost" (void* ptr) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaFreeArray "cudaFreeArray" (cudaArray_t array) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaFreeMipmappedArray "cudaFreeMipmappedArray" (cudaMipmappedArray_t mipmappedArray) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaHostAlloc "cudaHostAlloc" (void** pHost, size_t size, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaHostRegister "cudaHostRegister" (void* ptr, size_t size, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaHostUnregister "cudaHostUnregister" (void* ptr) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaHostGetDevicePointer "cudaHostGetDevicePointer" (void** pDevice, void* pHost, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaHostGetFlags "cudaHostGetFlags" (unsigned int* pFlags, void* pHost) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMalloc3D "cudaMalloc3D" (cudaPitchedPtr* pitchedDevPtr, cudaExtent extent) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMalloc3DArray "cudaMalloc3DArray" (cudaArray_t* array, const cudaChannelFormatDesc* desc, cudaExtent extent, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMallocMipmappedArray "cudaMallocMipmappedArray" (cudaMipmappedArray_t* mipmappedArray, const cudaChannelFormatDesc* desc, cudaExtent extent, unsigned int numLevels, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetMipmappedArrayLevel "cudaGetMipmappedArrayLevel" (cudaArray_t* levelArray, cudaMipmappedArray_const_t mipmappedArray, unsigned int level) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpy3D "cudaMemcpy3D" (const cudaMemcpy3DParms* p) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpy3DPeer "cudaMemcpy3DPeer" (const cudaMemcpy3DPeerParms* p) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpy3DAsync "cudaMemcpy3DAsync" (const cudaMemcpy3DParms* p, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpy3DPeerAsync "cudaMemcpy3DPeerAsync" (const cudaMemcpy3DPeerParms* p, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemGetInfo "cudaMemGetInfo" (size_t* free, size_t* total) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaArrayGetInfo "cudaArrayGetInfo" (cudaChannelFormatDesc* desc, cudaExtent* extent, unsigned int* flags, cudaArray_t array) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaArrayGetPlane "cudaArrayGetPlane" (cudaArray_t* pPlaneArray, cudaArray_t hArray, unsigned int planeIdx) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaArrayGetMemoryRequirements "cudaArrayGetMemoryRequirements" (cudaArrayMemoryRequirements* memoryRequirements, cudaArray_t array, int device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMipmappedArrayGetMemoryRequirements "cudaMipmappedArrayGetMemoryRequirements" (cudaArrayMemoryRequirements* memoryRequirements, cudaMipmappedArray_t mipmap, int device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaArrayGetSparseProperties "cudaArrayGetSparseProperties" (cudaArraySparseProperties* sparseProperties, cudaArray_t array) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMipmappedArrayGetSparseProperties "cudaMipmappedArrayGetSparseProperties" (cudaArraySparseProperties* sparseProperties, cudaMipmappedArray_t mipmap) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpy "cudaMemcpy" (void* dst, const void* src, size_t count, cudaMemcpyKind kind) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpyPeer "cudaMemcpyPeer" (void* dst, int dstDevice, const void* src, int srcDevice, size_t count) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpy2D "cudaMemcpy2D" (void* dst, size_t dpitch, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpy2DToArray "cudaMemcpy2DToArray" (cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpy2DFromArray "cudaMemcpy2DFromArray" (void* dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t width, size_t height, cudaMemcpyKind kind) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpy2DArrayToArray "cudaMemcpy2DArrayToArray" (cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t width, size_t height, cudaMemcpyKind kind) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpyAsync "cudaMemcpyAsync" (void* dst, const void* src, size_t count, cudaMemcpyKind kind, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpyPeerAsync "cudaMemcpyPeerAsync" (void* dst, int dstDevice, const void* src, int srcDevice, size_t count, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpyBatchAsync "cudaMemcpyBatchAsync" (void** dsts, const void** srcs, const size_t* sizes, size_t count, cudaMemcpyAttributes* attrs, size_t* attrsIdxs, size_t numAttrs, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpy3DBatchAsync "cudaMemcpy3DBatchAsync" (size_t numOps, cudaMemcpy3DBatchOp* opList, unsigned long long flags, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpy2DAsync "cudaMemcpy2DAsync" (void* dst, size_t dpitch, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpy2DToArrayAsync "cudaMemcpy2DToArrayAsync" (cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpy2DFromArrayAsync "cudaMemcpy2DFromArrayAsync" (void* dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemset "cudaMemset" (void* devPtr, int value, size_t count) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemset2D "cudaMemset2D" (void* devPtr, size_t pitch, int value, size_t width, size_t height) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemset3D "cudaMemset3D" (cudaPitchedPtr pitchedDevPtr, int value, cudaExtent extent) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemsetAsync "cudaMemsetAsync" (void* devPtr, int value, size_t count, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemset2DAsync "cudaMemset2DAsync" (void* devPtr, size_t pitch, int value, size_t width, size_t height, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemset3DAsync "cudaMemset3DAsync" (cudaPitchedPtr pitchedDevPtr, int value, cudaExtent extent, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemPrefetchAsync "cudaMemPrefetchAsync" (const void* devPtr, size_t count, cudaMemLocation location, unsigned int flags, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemAdvise "cudaMemAdvise" (const void* devPtr, size_t count, cudaMemoryAdvise advice, cudaMemLocation location) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemRangeGetAttribute "cudaMemRangeGetAttribute" (void* data, size_t dataSize, cudaMemRangeAttribute attribute, const void* devPtr, size_t count) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemRangeGetAttributes "cudaMemRangeGetAttributes" (void** data, size_t* dataSizes, cudaMemRangeAttribute* attributes, size_t numAttributes, const void* devPtr, size_t count) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpyToArray "cudaMemcpyToArray" (cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t count, cudaMemcpyKind kind) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpyFromArray "cudaMemcpyFromArray" (void* dst, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, cudaMemcpyKind kind) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpyArrayToArray "cudaMemcpyArrayToArray" (cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t count, cudaMemcpyKind kind) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpyToArrayAsync "cudaMemcpyToArrayAsync" (cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t count, cudaMemcpyKind kind, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpyFromArrayAsync "cudaMemcpyFromArrayAsync" (void* dst, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, cudaMemcpyKind kind, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMallocAsync "cudaMallocAsync" (void** devPtr, size_t size, cudaStream_t hStream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaFreeAsync "cudaFreeAsync" (void* devPtr, cudaStream_t hStream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemPoolTrimTo "cudaMemPoolTrimTo" (cudaMemPool_t memPool, size_t minBytesToKeep) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemPoolSetAttribute "cudaMemPoolSetAttribute" (cudaMemPool_t memPool, cudaMemPoolAttr attr, void* value) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemPoolGetAttribute "cudaMemPoolGetAttribute" (cudaMemPool_t memPool, cudaMemPoolAttr attr, void* value) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemPoolSetAccess "cudaMemPoolSetAccess" (cudaMemPool_t memPool, const cudaMemAccessDesc* descList, size_t count) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemPoolGetAccess "cudaMemPoolGetAccess" (cudaMemAccessFlags* flags, cudaMemPool_t memPool, cudaMemLocation* location) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemPoolCreate "cudaMemPoolCreate" (cudaMemPool_t* memPool, const cudaMemPoolProps* poolProps) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemPoolDestroy "cudaMemPoolDestroy" (cudaMemPool_t memPool) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMallocFromPoolAsync "cudaMallocFromPoolAsync" (void** ptr, size_t size, cudaMemPool_t memPool, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemPoolExportToShareableHandle "cudaMemPoolExportToShareableHandle" (void* shareableHandle, cudaMemPool_t memPool, cudaMemAllocationHandleType handleType, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemPoolImportFromShareableHandle "cudaMemPoolImportFromShareableHandle" (cudaMemPool_t* memPool, void* shareableHandle, cudaMemAllocationHandleType handleType, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemPoolExportPointer "cudaMemPoolExportPointer" (cudaMemPoolPtrExportData* exportData, void* ptr) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemPoolImportPointer "cudaMemPoolImportPointer" (void** ptr, cudaMemPool_t memPool, cudaMemPoolPtrExportData* exportData) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaPointerGetAttributes "cudaPointerGetAttributes" (cudaPointerAttributes* attributes, const void* ptr) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceCanAccessPeer "cudaDeviceCanAccessPeer" (int* canAccessPeer, int device, int peerDevice) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceEnablePeerAccess "cudaDeviceEnablePeerAccess" (int peerDevice, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceDisablePeerAccess "cudaDeviceDisablePeerAccess" (int peerDevice) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphicsUnregisterResource "cudaGraphicsUnregisterResource" (cudaGraphicsResource_t resource) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphicsResourceSetMapFlags "cudaGraphicsResourceSetMapFlags" (cudaGraphicsResource_t resource, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphicsMapResources "cudaGraphicsMapResources" (int count, cudaGraphicsResource_t* resources, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphicsUnmapResources "cudaGraphicsUnmapResources" (int count, cudaGraphicsResource_t* resources, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphicsResourceGetMappedPointer "cudaGraphicsResourceGetMappedPointer" (void** devPtr, size_t* size, cudaGraphicsResource_t resource) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphicsSubResourceGetMappedArray "cudaGraphicsSubResourceGetMappedArray" (cudaArray_t* array, cudaGraphicsResource_t resource, unsigned int arrayIndex, unsigned int mipLevel) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphicsResourceGetMappedMipmappedArray "cudaGraphicsResourceGetMappedMipmappedArray" (cudaMipmappedArray_t* mipmappedArray, cudaGraphicsResource_t resource) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetChannelDesc "cudaGetChannelDesc" (cudaChannelFormatDesc* desc, cudaArray_const_t array) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaChannelFormatDesc _static_cudaCreateChannelDesc "cudaCreateChannelDesc" (int x, int y, int z, int w, cudaChannelFormatKind f) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaCreateTextureObject "cudaCreateTextureObject" (cudaTextureObject_t* pTexObject, const cudaResourceDesc* pResDesc, const cudaTextureDesc* pTexDesc, const cudaResourceViewDesc* pResViewDesc) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDestroyTextureObject "cudaDestroyTextureObject" (cudaTextureObject_t texObject) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetTextureObjectResourceDesc "cudaGetTextureObjectResourceDesc" (cudaResourceDesc* pResDesc, cudaTextureObject_t texObject) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetTextureObjectTextureDesc "cudaGetTextureObjectTextureDesc" (cudaTextureDesc* pTexDesc, cudaTextureObject_t texObject) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetTextureObjectResourceViewDesc "cudaGetTextureObjectResourceViewDesc" (cudaResourceViewDesc* pResViewDesc, cudaTextureObject_t texObject) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaCreateSurfaceObject "cudaCreateSurfaceObject" (cudaSurfaceObject_t* pSurfObject, const cudaResourceDesc* pResDesc) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDestroySurfaceObject "cudaDestroySurfaceObject" (cudaSurfaceObject_t surfObject) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetSurfaceObjectResourceDesc "cudaGetSurfaceObjectResourceDesc" (cudaResourceDesc* pResDesc, cudaSurfaceObject_t surfObject) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDriverGetVersion "cudaDriverGetVersion" (int* driverVersion) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaRuntimeGetVersion "cudaRuntimeGetVersion" (int* runtimeVersion) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphCreate "cudaGraphCreate" (cudaGraph_t* pGraph, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddKernelNode "cudaGraphAddKernelNode" (cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaKernelNodeParams* pNodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphKernelNodeGetParams "cudaGraphKernelNodeGetParams" (cudaGraphNode_t node, cudaKernelNodeParams* pNodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphKernelNodeSetParams "cudaGraphKernelNodeSetParams" (cudaGraphNode_t node, const cudaKernelNodeParams* pNodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphKernelNodeCopyAttributes "cudaGraphKernelNodeCopyAttributes" (cudaGraphNode_t hDst, cudaGraphNode_t hSrc) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphKernelNodeGetAttribute "cudaGraphKernelNodeGetAttribute" (cudaGraphNode_t hNode, cudaLaunchAttributeID attr, cudaLaunchAttributeValue* value_out) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphKernelNodeSetAttribute "cudaGraphKernelNodeSetAttribute" (cudaGraphNode_t hNode, cudaLaunchAttributeID attr, const cudaLaunchAttributeValue* value) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddMemcpyNode "cudaGraphAddMemcpyNode" (cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaMemcpy3DParms* pCopyParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddMemcpyNode1D "cudaGraphAddMemcpyNode1D" (cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, void* dst, const void* src, size_t count, cudaMemcpyKind kind) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphMemcpyNodeGetParams "cudaGraphMemcpyNodeGetParams" (cudaGraphNode_t node, cudaMemcpy3DParms* pNodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphMemcpyNodeSetParams "cudaGraphMemcpyNodeSetParams" (cudaGraphNode_t node, const cudaMemcpy3DParms* pNodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphMemcpyNodeSetParams1D "cudaGraphMemcpyNodeSetParams1D" (cudaGraphNode_t node, void* dst, const void* src, size_t count, cudaMemcpyKind kind) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddMemsetNode "cudaGraphAddMemsetNode" (cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaMemsetParams* pMemsetParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphMemsetNodeGetParams "cudaGraphMemsetNodeGetParams" (cudaGraphNode_t node, cudaMemsetParams* pNodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphMemsetNodeSetParams "cudaGraphMemsetNodeSetParams" (cudaGraphNode_t node, const cudaMemsetParams* pNodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddHostNode "cudaGraphAddHostNode" (cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaHostNodeParams* pNodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphHostNodeGetParams "cudaGraphHostNodeGetParams" (cudaGraphNode_t node, cudaHostNodeParams* pNodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphHostNodeSetParams "cudaGraphHostNodeSetParams" (cudaGraphNode_t node, const cudaHostNodeParams* pNodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddChildGraphNode "cudaGraphAddChildGraphNode" (cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaGraph_t childGraph) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphChildGraphNodeGetGraph "cudaGraphChildGraphNodeGetGraph" (cudaGraphNode_t node, cudaGraph_t* pGraph) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddEmptyNode "cudaGraphAddEmptyNode" (cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddEventRecordNode "cudaGraphAddEventRecordNode" (cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaEvent_t event) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphEventRecordNodeGetEvent "cudaGraphEventRecordNodeGetEvent" (cudaGraphNode_t node, cudaEvent_t* event_out) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphEventRecordNodeSetEvent "cudaGraphEventRecordNodeSetEvent" (cudaGraphNode_t node, cudaEvent_t event) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddEventWaitNode "cudaGraphAddEventWaitNode" (cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaEvent_t event) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphEventWaitNodeGetEvent "cudaGraphEventWaitNodeGetEvent" (cudaGraphNode_t node, cudaEvent_t* event_out) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphEventWaitNodeSetEvent "cudaGraphEventWaitNodeSetEvent" (cudaGraphNode_t node, cudaEvent_t event) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddExternalSemaphoresSignalNode "cudaGraphAddExternalSemaphoresSignalNode" (cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaExternalSemaphoreSignalNodeParams* nodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExternalSemaphoresSignalNodeGetParams "cudaGraphExternalSemaphoresSignalNodeGetParams" (cudaGraphNode_t hNode, cudaExternalSemaphoreSignalNodeParams* params_out) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExternalSemaphoresSignalNodeSetParams "cudaGraphExternalSemaphoresSignalNodeSetParams" (cudaGraphNode_t hNode, const cudaExternalSemaphoreSignalNodeParams* nodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddExternalSemaphoresWaitNode "cudaGraphAddExternalSemaphoresWaitNode" (cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaExternalSemaphoreWaitNodeParams* nodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExternalSemaphoresWaitNodeGetParams "cudaGraphExternalSemaphoresWaitNodeGetParams" (cudaGraphNode_t hNode, cudaExternalSemaphoreWaitNodeParams* params_out) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExternalSemaphoresWaitNodeSetParams "cudaGraphExternalSemaphoresWaitNodeSetParams" (cudaGraphNode_t hNode, const cudaExternalSemaphoreWaitNodeParams* nodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddMemAllocNode "cudaGraphAddMemAllocNode" (cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaMemAllocNodeParams* nodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphMemAllocNodeGetParams "cudaGraphMemAllocNodeGetParams" (cudaGraphNode_t node, cudaMemAllocNodeParams* params_out) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddMemFreeNode "cudaGraphAddMemFreeNode" (cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, void* dptr) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphMemFreeNodeGetParams "cudaGraphMemFreeNodeGetParams" (cudaGraphNode_t node, void* dptr_out) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGraphMemTrim "cudaDeviceGraphMemTrim" (int device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetGraphMemAttribute "cudaDeviceGetGraphMemAttribute" (int device, cudaGraphMemAttributeType attr, void* value) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceSetGraphMemAttribute "cudaDeviceSetGraphMemAttribute" (int device, cudaGraphMemAttributeType attr, void* value) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphClone "cudaGraphClone" (cudaGraph_t* pGraphClone, cudaGraph_t originalGraph) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphNodeFindInClone "cudaGraphNodeFindInClone" (cudaGraphNode_t* pNode, cudaGraphNode_t originalNode, cudaGraph_t clonedGraph) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphNodeGetType "cudaGraphNodeGetType" (cudaGraphNode_t node, cudaGraphNodeType* pType) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphGetNodes "cudaGraphGetNodes" (cudaGraph_t graph, cudaGraphNode_t* nodes, size_t* numNodes) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphGetRootNodes "cudaGraphGetRootNodes" (cudaGraph_t graph, cudaGraphNode_t* pRootNodes, size_t* pNumRootNodes) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphGetEdges "cudaGraphGetEdges" (cudaGraph_t graph, cudaGraphNode_t* from_, cudaGraphNode_t* to, cudaGraphEdgeData* edgeData, size_t* numEdges) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphNodeGetDependencies "cudaGraphNodeGetDependencies" (cudaGraphNode_t node, cudaGraphNode_t* pDependencies, cudaGraphEdgeData* edgeData, size_t* pNumDependencies) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphNodeGetDependentNodes "cudaGraphNodeGetDependentNodes" (cudaGraphNode_t node, cudaGraphNode_t* pDependentNodes, cudaGraphEdgeData* edgeData, size_t* pNumDependentNodes) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddDependencies "cudaGraphAddDependencies" (cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, const cudaGraphEdgeData* edgeData, size_t numDependencies) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphRemoveDependencies "cudaGraphRemoveDependencies" (cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, const cudaGraphEdgeData* edgeData, size_t numDependencies) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphDestroyNode "cudaGraphDestroyNode" (cudaGraphNode_t node) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphInstantiate "cudaGraphInstantiate" (cudaGraphExec_t* pGraphExec, cudaGraph_t graph, unsigned long long flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphInstantiateWithFlags "cudaGraphInstantiateWithFlags" (cudaGraphExec_t* pGraphExec, cudaGraph_t graph, unsigned long long flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphInstantiateWithParams "cudaGraphInstantiateWithParams" (cudaGraphExec_t* pGraphExec, cudaGraph_t graph, cudaGraphInstantiateParams* instantiateParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecGetFlags "cudaGraphExecGetFlags" (cudaGraphExec_t graphExec, unsigned long long* flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecKernelNodeSetParams "cudaGraphExecKernelNodeSetParams" (cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaKernelNodeParams* pNodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecMemcpyNodeSetParams "cudaGraphExecMemcpyNodeSetParams" (cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaMemcpy3DParms* pNodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecMemcpyNodeSetParams1D "cudaGraphExecMemcpyNodeSetParams1D" (cudaGraphExec_t hGraphExec, cudaGraphNode_t node, void* dst, const void* src, size_t count, cudaMemcpyKind kind) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecMemsetNodeSetParams "cudaGraphExecMemsetNodeSetParams" (cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaMemsetParams* pNodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecHostNodeSetParams "cudaGraphExecHostNodeSetParams" (cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaHostNodeParams* pNodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecChildGraphNodeSetParams "cudaGraphExecChildGraphNodeSetParams" (cudaGraphExec_t hGraphExec, cudaGraphNode_t node, cudaGraph_t childGraph) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecEventRecordNodeSetEvent "cudaGraphExecEventRecordNodeSetEvent" (cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, cudaEvent_t event) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecEventWaitNodeSetEvent "cudaGraphExecEventWaitNodeSetEvent" (cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, cudaEvent_t event) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecExternalSemaphoresSignalNodeSetParams "cudaGraphExecExternalSemaphoresSignalNodeSetParams" (cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, const cudaExternalSemaphoreSignalNodeParams* nodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecExternalSemaphoresWaitNodeSetParams "cudaGraphExecExternalSemaphoresWaitNodeSetParams" (cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, const cudaExternalSemaphoreWaitNodeParams* nodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphNodeSetEnabled "cudaGraphNodeSetEnabled" (cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, unsigned int isEnabled) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphNodeGetEnabled "cudaGraphNodeGetEnabled" (cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, unsigned int* isEnabled) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecUpdate "cudaGraphExecUpdate" (cudaGraphExec_t hGraphExec, cudaGraph_t hGraph, cudaGraphExecUpdateResultInfo* resultInfo) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphUpload "cudaGraphUpload" (cudaGraphExec_t graphExec, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphLaunch "cudaGraphLaunch" (cudaGraphExec_t graphExec, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecDestroy "cudaGraphExecDestroy" (cudaGraphExec_t graphExec) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphDestroy "cudaGraphDestroy" (cudaGraph_t graph) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphDebugDotPrint "cudaGraphDebugDotPrint" (cudaGraph_t graph, const char* path, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaUserObjectCreate "cudaUserObjectCreate" (cudaUserObject_t* object_out, void* ptr, cudaHostFn_t destroy, unsigned int initialRefcount, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaUserObjectRetain "cudaUserObjectRetain" (cudaUserObject_t object, unsigned int count) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaUserObjectRelease "cudaUserObjectRelease" (cudaUserObject_t object, unsigned int count) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphRetainUserObject "cudaGraphRetainUserObject" (cudaGraph_t graph, cudaUserObject_t object, unsigned int count, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphReleaseUserObject "cudaGraphReleaseUserObject" (cudaGraph_t graph, cudaUserObject_t object, unsigned int count) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddNode "cudaGraphAddNode" (cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, cudaGraphNodeParams* nodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphNodeSetParams "cudaGraphNodeSetParams" (cudaGraphNode_t node, cudaGraphNodeParams* nodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecNodeSetParams "cudaGraphExecNodeSetParams" (cudaGraphExec_t graphExec, cudaGraphNode_t node, cudaGraphNodeParams* nodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphConditionalHandleCreate "cudaGraphConditionalHandleCreate" (cudaGraphConditionalHandle* pHandle_out, cudaGraph_t graph, unsigned int defaultLaunchValue, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetDriverEntryPoint "cudaGetDriverEntryPoint" (const char* symbol, void** funcPtr, unsigned long long flags, cudaDriverEntryPointQueryResult* driverStatus) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetDriverEntryPointByVersion "cudaGetDriverEntryPointByVersion" (const char* symbol, void** funcPtr, unsigned int cudaVersion, unsigned long long flags, cudaDriverEntryPointQueryResult* driverStatus) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLibraryLoadData "cudaLibraryLoadData" (cudaLibrary_t* library, const void* code, cudaJitOption* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, cudaLibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLibraryLoadFromFile "cudaLibraryLoadFromFile" (cudaLibrary_t* library, const char* fileName, cudaJitOption* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, cudaLibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLibraryUnload "cudaLibraryUnload" (cudaLibrary_t library) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLibraryGetKernel "cudaLibraryGetKernel" (cudaKernel_t* pKernel, cudaLibrary_t library, const char* name) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLibraryGetGlobal "cudaLibraryGetGlobal" (void** dptr, size_t* bytes, cudaLibrary_t library, const char* name) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLibraryGetManaged "cudaLibraryGetManaged" (void** dptr, size_t* bytes, cudaLibrary_t library, const char* name) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLibraryGetUnifiedFunction "cudaLibraryGetUnifiedFunction" (void** fptr, cudaLibrary_t library, const char* symbol) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLibraryGetKernelCount "cudaLibraryGetKernelCount" (unsigned int* count, cudaLibrary_t lib) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLibraryEnumerateKernels "cudaLibraryEnumerateKernels" (cudaKernel_t* kernels, unsigned int numKernels, cudaLibrary_t lib) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaKernelSetAttributeForDevice "cudaKernelSetAttributeForDevice" (cudaKernel_t kernel, cudaFuncAttribute attr, int value, int device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetExportTable "cudaGetExportTable" (const void** ppExportTable, const cudaUUID_t* pExportTableId) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetKernel "cudaGetKernel" (cudaKernel_t* kernelPtr, const void* entryFuncAddr) noexcept + +cdef extern from 'cuda_profiler_api.h' nogil: + cudaError_t _static_cudaProfilerStart "cudaProfilerStart" () noexcept + +cdef extern from 'cuda_profiler_api.h' nogil: + cudaError_t _static_cudaProfilerStop "cudaProfilerStop" () noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetDeviceProperties "cudaGetDeviceProperties" (cudaDeviceProp* prop, int device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetHostAtomicCapabilities "cudaDeviceGetHostAtomicCapabilities" (unsigned int* capabilities, const cudaAtomicOperation* operations, unsigned int count, int device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetP2PAtomicCapabilities "cudaDeviceGetP2PAtomicCapabilities" (unsigned int* capabilities, const cudaAtomicOperation* operations, unsigned int count, int srcDevice, int dstDevice) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamGetCaptureInfo "cudaStreamGetCaptureInfo" (cudaStream_t stream, cudaStreamCaptureStatus* captureStatus_out, unsigned long long* id_out, cudaGraph_t* graph_out, const cudaGraphNode_t** dependencies_out, const cudaGraphEdgeData** edgeData_out, size_t* numDependencies_out) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaSignalExternalSemaphoresAsync "cudaSignalExternalSemaphoresAsync" (const cudaExternalSemaphore_t* extSemArray, const cudaExternalSemaphoreSignalParams* paramsArray, unsigned int numExtSems, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaWaitExternalSemaphoresAsync "cudaWaitExternalSemaphoresAsync" (const cudaExternalSemaphore_t* extSemArray, const cudaExternalSemaphoreWaitParams* paramsArray, unsigned int numExtSems, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemPrefetchBatchAsync "cudaMemPrefetchBatchAsync" (void** dptrs, size_t* sizes, size_t count, cudaMemLocation* prefetchLocs, size_t* prefetchLocIdxs, size_t numPrefetchLocs, unsigned long long flags, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemDiscardBatchAsync "cudaMemDiscardBatchAsync" (void** dptrs, size_t* sizes, size_t count, unsigned long long flags, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemDiscardAndPrefetchBatchAsync "cudaMemDiscardAndPrefetchBatchAsync" (void** dptrs, size_t* sizes, size_t count, cudaMemLocation* prefetchLocs, size_t* prefetchLocIdxs, size_t numPrefetchLocs, unsigned long long flags, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemGetDefaultMemPool "cudaMemGetDefaultMemPool" (cudaMemPool_t* memPool, cudaMemLocation* location, cudaMemAllocationType type) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemGetMemPool "cudaMemGetMemPool" (cudaMemPool_t* memPool, cudaMemLocation* location, cudaMemAllocationType type) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemSetMemPool "cudaMemSetMemPool" (cudaMemLocation* location, cudaMemAllocationType type, cudaMemPool_t memPool) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLogsRegisterCallback "cudaLogsRegisterCallback" (cudaLogsCallback_t callbackFunc, void* userData, cudaLogsCallbackHandle* callback_out) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLogsUnregisterCallback "cudaLogsUnregisterCallback" (cudaLogsCallbackHandle callback) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLogsCurrent "cudaLogsCurrent" (cudaLogIterator* iterator_out, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLogsDumpToFile "cudaLogsDumpToFile" (cudaLogIterator* iterator, const char* pathToFile, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLogsDumpToMemory "cudaLogsDumpToMemory" (cudaLogIterator* iterator, char* buffer, size_t* size, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphNodeGetContainingGraph "cudaGraphNodeGetContainingGraph" (cudaGraphNode_t hNode, cudaGraph_t* phGraph) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphNodeGetLocalId "cudaGraphNodeGetLocalId" (cudaGraphNode_t hNode, unsigned int* nodeId) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphNodeGetToolsId "cudaGraphNodeGetToolsId" (cudaGraphNode_t hNode, unsigned long long* toolsNodeId) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphGetId "cudaGraphGetId" (cudaGraph_t hGraph, unsigned int* graphID) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecGetId "cudaGraphExecGetId" (cudaGraphExec_t hGraphExec, unsigned int* graphID) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphConditionalHandleCreate_v2 "cudaGraphConditionalHandleCreate_v2" (cudaGraphConditionalHandle* pHandle_out, cudaGraph_t graph, cudaExecutionContext_t ctx, unsigned int defaultLaunchValue, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetDevResource "cudaDeviceGetDevResource" (int device, cudaDevResource* resource, cudaDevResourceType type) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDevSmResourceSplitByCount "cudaDevSmResourceSplitByCount" (cudaDevResource* result, unsigned int* nbGroups, const cudaDevResource* input, cudaDevResource* remaining, unsigned int flags, unsigned int minCount) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDevSmResourceSplit "cudaDevSmResourceSplit" (cudaDevResource* result, unsigned int nbGroups, const cudaDevResource* input, cudaDevResource* remainder, unsigned int flags, cudaDevSmResourceGroupParams* groupParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDevResourceGenerateDesc "cudaDevResourceGenerateDesc" (cudaDevResourceDesc_t* phDesc, cudaDevResource* resources, unsigned int nbResources) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGreenCtxCreate "cudaGreenCtxCreate" (cudaExecutionContext_t* phCtx, cudaDevResourceDesc_t desc, int device, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaExecutionCtxDestroy "cudaExecutionCtxDestroy" (cudaExecutionContext_t ctx) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaExecutionCtxGetDevResource "cudaExecutionCtxGetDevResource" (cudaExecutionContext_t ctx, cudaDevResource* resource, cudaDevResourceType type) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaExecutionCtxGetDevice "cudaExecutionCtxGetDevice" (int* device, cudaExecutionContext_t ctx) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaExecutionCtxGetId "cudaExecutionCtxGetId" (cudaExecutionContext_t ctx, unsigned long long* ctxId) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaExecutionCtxStreamCreate "cudaExecutionCtxStreamCreate" (cudaStream_t* phStream, cudaExecutionContext_t ctx, unsigned int flags, int priority) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaExecutionCtxSynchronize "cudaExecutionCtxSynchronize" (cudaExecutionContext_t ctx) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamGetDevResource "cudaStreamGetDevResource" (cudaStream_t hStream, cudaDevResource* resource, cudaDevResourceType type) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaExecutionCtxRecordEvent "cudaExecutionCtxRecordEvent" (cudaExecutionContext_t ctx, cudaEvent_t event) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaExecutionCtxWaitEvent "cudaExecutionCtxWaitEvent" (cudaExecutionContext_t ctx, cudaEvent_t event) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetExecutionCtx "cudaDeviceGetExecutionCtx" (cudaExecutionContext_t* ctx, int device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaFuncGetParamCount "cudaFuncGetParamCount" (const void* func, size_t* paramCount) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLaunchHostFunc_v2 "cudaLaunchHostFunc_v2" (cudaStream_t stream, cudaHostFn_t fn, void* userData, unsigned int syncMode) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpyWithAttributesAsync "cudaMemcpyWithAttributesAsync" (void* dst, const void* src, size_t size, cudaMemcpyAttributes* attr, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpy3DWithAttributesAsync "cudaMemcpy3DWithAttributesAsync" (cudaMemcpy3DBatchOp* op, unsigned long long flags, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphNodeGetParams "cudaGraphNodeGetParams" (cudaGraphNode_t node, cudaGraphNodeParams* nodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamBeginRecaptureToGraph "cudaStreamBeginRecaptureToGraph" (cudaStream_t stream, cudaStreamCaptureMode mode, cudaGraph_t graph, cudaGraphRecaptureCallbackData* callbackData) noexcept + + +############################################################################### +# Wrapper functions +############################################################################### + +cdef cudaError_t _cudaDeviceReset() except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceReset() + return _static_cudaDeviceReset() + + +cdef cudaError_t _cudaDeviceSynchronize() except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceSynchronize() + return _static_cudaDeviceSynchronize() + + +cdef cudaError_t _cudaDeviceSetLimit(cudaLimit limit, size_t value) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceSetLimit(limit, value) + return _static_cudaDeviceSetLimit(limit, value) + + +cdef cudaError_t _cudaDeviceGetLimit(size_t* pValue, cudaLimit limit) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceGetLimit(pValue, limit) + return _static_cudaDeviceGetLimit(pValue, limit) + + +cdef cudaError_t _cudaDeviceGetTexture1DLinearMaxWidth(size_t* maxWidthInElements, const cudaChannelFormatDesc* fmtDesc, int device) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceGetTexture1DLinearMaxWidth(maxWidthInElements, fmtDesc, device) + return _static_cudaDeviceGetTexture1DLinearMaxWidth(maxWidthInElements, fmtDesc, device) + + +cdef cudaError_t _cudaDeviceGetCacheConfig(cudaFuncCache* pCacheConfig) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceGetCacheConfig(pCacheConfig) + return _static_cudaDeviceGetCacheConfig(pCacheConfig) + + +cdef cudaError_t _cudaDeviceGetStreamPriorityRange(int* leastPriority, int* greatestPriority) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceGetStreamPriorityRange(leastPriority, greatestPriority) + return _static_cudaDeviceGetStreamPriorityRange(leastPriority, greatestPriority) + + +cdef cudaError_t _cudaDeviceSetCacheConfig(cudaFuncCache cacheConfig) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceSetCacheConfig(cacheConfig) + return _static_cudaDeviceSetCacheConfig(cacheConfig) + + +cdef cudaError_t _cudaDeviceGetByPCIBusId(int* device, const char* pciBusId) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceGetByPCIBusId(device, pciBusId) + return _static_cudaDeviceGetByPCIBusId(device, pciBusId) + + +cdef cudaError_t _cudaDeviceGetPCIBusId(char* pciBusId, int len, int device) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceGetPCIBusId(pciBusId, len, device) + return _static_cudaDeviceGetPCIBusId(pciBusId, len, device) + + +cdef cudaError_t _cudaIpcGetEventHandle(cudaIpcEventHandle_t* handle, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaIpcGetEventHandle(handle, event) + return _static_cudaIpcGetEventHandle(handle, event) + + +cdef cudaError_t _cudaIpcOpenEventHandle(cudaEvent_t* event, cudaIpcEventHandle_t handle) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaIpcOpenEventHandle(event, handle) + return _static_cudaIpcOpenEventHandle(event, handle) + + +cdef cudaError_t _cudaIpcGetMemHandle(cudaIpcMemHandle_t* handle, void* devPtr) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaIpcGetMemHandle(handle, devPtr) + return _static_cudaIpcGetMemHandle(handle, devPtr) + + +cdef cudaError_t _cudaIpcOpenMemHandle(void** devPtr, cudaIpcMemHandle_t handle, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaIpcOpenMemHandle(devPtr, handle, flags) + return _static_cudaIpcOpenMemHandle(devPtr, handle, flags) + + +cdef cudaError_t _cudaIpcCloseMemHandle(void* devPtr) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaIpcCloseMemHandle(devPtr) + return _static_cudaIpcCloseMemHandle(devPtr) + + +cdef cudaError_t _cudaDeviceFlushGPUDirectRDMAWrites(cudaFlushGPUDirectRDMAWritesTarget target, cudaFlushGPUDirectRDMAWritesScope scope) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceFlushGPUDirectRDMAWrites(target, scope) + return _static_cudaDeviceFlushGPUDirectRDMAWrites(target, scope) + + +cdef cudaError_t _cudaDeviceRegisterAsyncNotification(int device, cudaAsyncCallback callbackFunc, void* userData, cudaAsyncCallbackHandle_t* callback) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceRegisterAsyncNotification(device, callbackFunc, userData, callback) + return _static_cudaDeviceRegisterAsyncNotification(device, callbackFunc, userData, callback) + + +cdef cudaError_t _cudaDeviceUnregisterAsyncNotification(int device, cudaAsyncCallbackHandle_t callback) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceUnregisterAsyncNotification(device, callback) + return _static_cudaDeviceUnregisterAsyncNotification(device, callback) + + +cdef cudaError_t _cudaDeviceGetSharedMemConfig(cudaSharedMemConfig* pConfig) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceGetSharedMemConfig(pConfig) + return _static_cudaDeviceGetSharedMemConfig(pConfig) + + +cdef cudaError_t _cudaDeviceSetSharedMemConfig(cudaSharedMemConfig config) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceSetSharedMemConfig(config) + return _static_cudaDeviceSetSharedMemConfig(config) + + +cdef cudaError_t _cudaGetLastError() except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGetLastError() + return _static_cudaGetLastError() + + +cdef cudaError_t _cudaPeekAtLastError() except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaPeekAtLastError() + return _static_cudaPeekAtLastError() + + +cdef const char* _cudaGetErrorName(cudaError_t error) except?NULL nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGetErrorName(error) + return _static_cudaGetErrorName(error) + + +cdef const char* _cudaGetErrorString(cudaError_t error) except?NULL nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGetErrorString(error) + return _static_cudaGetErrorString(error) + + +cdef cudaError_t _cudaGetDeviceCount(int* count) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGetDeviceCount(count) + return _static_cudaGetDeviceCount(count) + + +cdef cudaError_t _cudaDeviceGetAttribute(int* value, cudaDeviceAttr attr, int device) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceGetAttribute(value, attr, device) + return _static_cudaDeviceGetAttribute(value, attr, device) + + +cdef cudaError_t _cudaDeviceGetDefaultMemPool(cudaMemPool_t* memPool, int device) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceGetDefaultMemPool(memPool, device) + return _static_cudaDeviceGetDefaultMemPool(memPool, device) + + +cdef cudaError_t _cudaDeviceSetMemPool(int device, cudaMemPool_t memPool) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceSetMemPool(device, memPool) + return _static_cudaDeviceSetMemPool(device, memPool) + + +cdef cudaError_t _cudaDeviceGetMemPool(cudaMemPool_t* memPool, int device) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceGetMemPool(memPool, device) + return _static_cudaDeviceGetMemPool(memPool, device) + + +cdef cudaError_t _cudaDeviceGetNvSciSyncAttributes(void* nvSciSyncAttrList, int device, int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceGetNvSciSyncAttributes(nvSciSyncAttrList, device, flags) + return _static_cudaDeviceGetNvSciSyncAttributes(nvSciSyncAttrList, device, flags) + + +cdef cudaError_t _cudaDeviceGetP2PAttribute(int* value, cudaDeviceP2PAttr attr, int srcDevice, int dstDevice) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceGetP2PAttribute(value, attr, srcDevice, dstDevice) + return _static_cudaDeviceGetP2PAttribute(value, attr, srcDevice, dstDevice) + + +cdef cudaError_t _cudaChooseDevice(int* device, const cudaDeviceProp* prop) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaChooseDevice(device, prop) + return _static_cudaChooseDevice(device, prop) + + +cdef cudaError_t _cudaInitDevice(int device, unsigned int deviceFlags, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaInitDevice(device, deviceFlags, flags) + return _static_cudaInitDevice(device, deviceFlags, flags) + + +cdef cudaError_t _cudaSetDevice(int device) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaSetDevice(device) + return _static_cudaSetDevice(device) + + +cdef cudaError_t _cudaGetDevice(int* device) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGetDevice(device) + return _static_cudaGetDevice(device) + + +cdef cudaError_t _cudaSetDeviceFlags(unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaSetDeviceFlags(flags) + return _static_cudaSetDeviceFlags(flags) + + +cdef cudaError_t _cudaGetDeviceFlags(unsigned int* flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGetDeviceFlags(flags) + return _static_cudaGetDeviceFlags(flags) + + +cdef cudaError_t _cudaStreamCreate(cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamCreate(pStream) + return _static_cudaStreamCreate(pStream) + + +cdef cudaError_t _cudaStreamCreateWithFlags(cudaStream_t* pStream, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamCreateWithFlags(pStream, flags) + return _static_cudaStreamCreateWithFlags(pStream, flags) + + +cdef cudaError_t _cudaStreamCreateWithPriority(cudaStream_t* pStream, unsigned int flags, int priority) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamCreateWithPriority(pStream, flags, priority) + return _static_cudaStreamCreateWithPriority(pStream, flags, priority) + + +cdef cudaError_t _cudaStreamGetPriority(cudaStream_t hStream, int* priority) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamGetPriority(hStream, priority) + return _static_cudaStreamGetPriority(hStream, priority) + + +cdef cudaError_t _cudaStreamGetFlags(cudaStream_t hStream, unsigned int* flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamGetFlags(hStream, flags) + return _static_cudaStreamGetFlags(hStream, flags) + + +cdef cudaError_t _cudaStreamGetId(cudaStream_t hStream, unsigned long long* streamId) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamGetId(hStream, streamId) + return _static_cudaStreamGetId(hStream, streamId) + + +cdef cudaError_t _cudaStreamGetDevice(cudaStream_t hStream, int* device) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamGetDevice(hStream, device) + return _static_cudaStreamGetDevice(hStream, device) + + +cdef cudaError_t _cudaCtxResetPersistingL2Cache() except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaCtxResetPersistingL2Cache() + return _static_cudaCtxResetPersistingL2Cache() + + +cdef cudaError_t _cudaStreamCopyAttributes(cudaStream_t dst, cudaStream_t src) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamCopyAttributes(dst, src) + return _static_cudaStreamCopyAttributes(dst, src) + + +cdef cudaError_t _cudaStreamGetAttribute(cudaStream_t hStream, cudaStreamAttrID attr, cudaStreamAttrValue* value_out) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamGetAttribute(hStream, attr, value_out) + return _static_cudaStreamGetAttribute(hStream, attr, value_out) + + +cdef cudaError_t _cudaStreamSetAttribute(cudaStream_t hStream, cudaStreamAttrID attr, const cudaStreamAttrValue* value) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamSetAttribute(hStream, attr, value) + return _static_cudaStreamSetAttribute(hStream, attr, value) + + +cdef cudaError_t _cudaStreamDestroy(cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamDestroy(stream) + return _static_cudaStreamDestroy(stream) + + +cdef cudaError_t _cudaStreamWaitEvent(cudaStream_t stream, cudaEvent_t event, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamWaitEvent(stream, event, flags) + return _static_cudaStreamWaitEvent(stream, event, flags) + + +cdef cudaError_t _cudaStreamAddCallback(cudaStream_t stream, cudaStreamCallback_t callback, void* userData, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamAddCallback(stream, callback, userData, flags) + return _static_cudaStreamAddCallback(stream, callback, userData, flags) + + +cdef cudaError_t _cudaStreamSynchronize(cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamSynchronize(stream) + return _static_cudaStreamSynchronize(stream) + + +cdef cudaError_t _cudaStreamQuery(cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamQuery(stream) + return _static_cudaStreamQuery(stream) + + +cdef cudaError_t _cudaStreamAttachMemAsync(cudaStream_t stream, void* devPtr, size_t length, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamAttachMemAsync(stream, devPtr, length, flags) + return _static_cudaStreamAttachMemAsync(stream, devPtr, length, flags) + + +cdef cudaError_t _cudaStreamBeginCapture(cudaStream_t stream, cudaStreamCaptureMode mode) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamBeginCapture(stream, mode) + return _static_cudaStreamBeginCapture(stream, mode) + + +cdef cudaError_t _cudaStreamBeginCaptureToGraph(cudaStream_t stream, cudaGraph_t graph, const cudaGraphNode_t* dependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, cudaStreamCaptureMode mode) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamBeginCaptureToGraph(stream, graph, dependencies, dependencyData, numDependencies, mode) + return _static_cudaStreamBeginCaptureToGraph(stream, graph, dependencies, dependencyData, numDependencies, mode) + + +cdef cudaError_t _cudaThreadExchangeStreamCaptureMode(cudaStreamCaptureMode* mode) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaThreadExchangeStreamCaptureMode(mode) + return _static_cudaThreadExchangeStreamCaptureMode(mode) + + +cdef cudaError_t _cudaStreamEndCapture(cudaStream_t stream, cudaGraph_t* pGraph) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamEndCapture(stream, pGraph) + return _static_cudaStreamEndCapture(stream, pGraph) + + +cdef cudaError_t _cudaStreamIsCapturing(cudaStream_t stream, cudaStreamCaptureStatus* pCaptureStatus) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamIsCapturing(stream, pCaptureStatus) + return _static_cudaStreamIsCapturing(stream, pCaptureStatus) + + +cdef cudaError_t _cudaStreamUpdateCaptureDependencies(cudaStream_t stream, cudaGraphNode_t* dependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamUpdateCaptureDependencies(stream, dependencies, dependencyData, numDependencies, flags) + return _static_cudaStreamUpdateCaptureDependencies(stream, dependencies, dependencyData, numDependencies, flags) + + +cdef cudaError_t _cudaEventCreate(cudaEvent_t* event) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaEventCreate(event) + return _static_cudaEventCreate(event) + + +cdef cudaError_t _cudaEventCreateWithFlags(cudaEvent_t* event, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaEventCreateWithFlags(event, flags) + return _static_cudaEventCreateWithFlags(event, flags) + + +cdef cudaError_t _cudaEventRecord(cudaEvent_t event, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaEventRecord(event, stream) + return _static_cudaEventRecord(event, stream) + + +cdef cudaError_t _cudaEventRecordWithFlags(cudaEvent_t event, cudaStream_t stream, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaEventRecordWithFlags(event, stream, flags) + return _static_cudaEventRecordWithFlags(event, stream, flags) + + +cdef cudaError_t _cudaEventQuery(cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaEventQuery(event) + return _static_cudaEventQuery(event) + + +cdef cudaError_t _cudaEventSynchronize(cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaEventSynchronize(event) + return _static_cudaEventSynchronize(event) + + +cdef cudaError_t _cudaEventDestroy(cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaEventDestroy(event) + return _static_cudaEventDestroy(event) + + +cdef cudaError_t _cudaEventElapsedTime(float* ms, cudaEvent_t start, cudaEvent_t end) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaEventElapsedTime(ms, start, end) + return _static_cudaEventElapsedTime(ms, start, end) + + +cdef cudaError_t _cudaImportExternalMemory(cudaExternalMemory_t* extMem_out, const cudaExternalMemoryHandleDesc* memHandleDesc) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaImportExternalMemory(extMem_out, memHandleDesc) + return _static_cudaImportExternalMemory(extMem_out, memHandleDesc) + + +cdef cudaError_t _cudaExternalMemoryGetMappedBuffer(void** devPtr, cudaExternalMemory_t extMem, const cudaExternalMemoryBufferDesc* bufferDesc) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaExternalMemoryGetMappedBuffer(devPtr, extMem, bufferDesc) + return _static_cudaExternalMemoryGetMappedBuffer(devPtr, extMem, bufferDesc) + + +cdef cudaError_t _cudaExternalMemoryGetMappedMipmappedArray(cudaMipmappedArray_t* mipmap, cudaExternalMemory_t extMem, const cudaExternalMemoryMipmappedArrayDesc* mipmapDesc) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaExternalMemoryGetMappedMipmappedArray(mipmap, extMem, mipmapDesc) + return _static_cudaExternalMemoryGetMappedMipmappedArray(mipmap, extMem, mipmapDesc) + + +cdef cudaError_t _cudaDestroyExternalMemory(cudaExternalMemory_t extMem) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDestroyExternalMemory(extMem) + return _static_cudaDestroyExternalMemory(extMem) + + +cdef cudaError_t _cudaImportExternalSemaphore(cudaExternalSemaphore_t* extSem_out, const cudaExternalSemaphoreHandleDesc* semHandleDesc) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaImportExternalSemaphore(extSem_out, semHandleDesc) + return _static_cudaImportExternalSemaphore(extSem_out, semHandleDesc) + + +cdef cudaError_t _cudaDestroyExternalSemaphore(cudaExternalSemaphore_t extSem) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDestroyExternalSemaphore(extSem) + return _static_cudaDestroyExternalSemaphore(extSem) + + +cdef cudaError_t _cudaFuncSetCacheConfig(const void* func, cudaFuncCache cacheConfig) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaFuncSetCacheConfig(func, cacheConfig) + return _static_cudaFuncSetCacheConfig(func, cacheConfig) + + +cdef cudaError_t _cudaFuncGetAttributes(cudaFuncAttributes* attr, const void* func) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaFuncGetAttributes(attr, func) + return _static_cudaFuncGetAttributes(attr, func) + + +cdef cudaError_t _cudaFuncSetAttribute(const void* func, cudaFuncAttribute attr, int value) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaFuncSetAttribute(func, attr, value) + return _static_cudaFuncSetAttribute(func, attr, value) + + +cdef cudaError_t _cudaFuncGetName(const char** name, const void* func) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaFuncGetName(name, func) + return _static_cudaFuncGetName(name, func) + + +cdef cudaError_t _cudaFuncGetParamInfo(const void* func, size_t paramIndex, size_t* paramOffset, size_t* paramSize) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaFuncGetParamInfo(func, paramIndex, paramOffset, paramSize) + return _static_cudaFuncGetParamInfo(func, paramIndex, paramOffset, paramSize) + + +cdef cudaError_t _cudaLaunchHostFunc(cudaStream_t stream, cudaHostFn_t fn, void* userData) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaLaunchHostFunc(stream, fn, userData) + return _static_cudaLaunchHostFunc(stream, fn, userData) + + +cdef cudaError_t _cudaFuncSetSharedMemConfig(const void* func, cudaSharedMemConfig config) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaFuncSetSharedMemConfig(func, config) + return _static_cudaFuncSetSharedMemConfig(func, config) + + +cdef cudaError_t _cudaOccupancyMaxActiveBlocksPerMultiprocessor(int* numBlocks, const void* func, int blockSize, size_t dynamicSMemSize) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaOccupancyMaxActiveBlocksPerMultiprocessor(numBlocks, func, blockSize, dynamicSMemSize) + return _static_cudaOccupancyMaxActiveBlocksPerMultiprocessor(numBlocks, func, blockSize, dynamicSMemSize) + + +cdef cudaError_t _cudaOccupancyAvailableDynamicSMemPerBlock(size_t* dynamicSmemSize, const void* func, int numBlocks, int blockSize) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaOccupancyAvailableDynamicSMemPerBlock(dynamicSmemSize, func, numBlocks, blockSize) + return _static_cudaOccupancyAvailableDynamicSMemPerBlock(dynamicSmemSize, func, numBlocks, blockSize) + + +cdef cudaError_t _cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(int* numBlocks, const void* func, int blockSize, size_t dynamicSMemSize, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(numBlocks, func, blockSize, dynamicSMemSize, flags) + return _static_cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(numBlocks, func, blockSize, dynamicSMemSize, flags) + + +cdef cudaError_t _cudaMallocManaged(void** devPtr, size_t size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMallocManaged(devPtr, size, flags) + return _static_cudaMallocManaged(devPtr, size, flags) + + +cdef cudaError_t _cudaMalloc(void** devPtr, size_t size) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMalloc(devPtr, size) + return _static_cudaMalloc(devPtr, size) + + +cdef cudaError_t _cudaMallocHost(void** ptr, size_t size) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMallocHost(ptr, size) + return _static_cudaMallocHost(ptr, size) + + +cdef cudaError_t _cudaMallocPitch(void** devPtr, size_t* pitch, size_t width, size_t height) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMallocPitch(devPtr, pitch, width, height) + return _static_cudaMallocPitch(devPtr, pitch, width, height) + + +cdef cudaError_t _cudaMallocArray(cudaArray_t* array, const cudaChannelFormatDesc* desc, size_t width, size_t height, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMallocArray(array, desc, width, height, flags) + return _static_cudaMallocArray(array, desc, width, height, flags) + + +cdef cudaError_t _cudaFree(void* devPtr) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaFree(devPtr) + return _static_cudaFree(devPtr) + + +cdef cudaError_t _cudaFreeHost(void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaFreeHost(ptr) + return _static_cudaFreeHost(ptr) + + +cdef cudaError_t _cudaFreeArray(cudaArray_t array) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaFreeArray(array) + return _static_cudaFreeArray(array) + + +cdef cudaError_t _cudaFreeMipmappedArray(cudaMipmappedArray_t mipmappedArray) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaFreeMipmappedArray(mipmappedArray) + return _static_cudaFreeMipmappedArray(mipmappedArray) + + +cdef cudaError_t _cudaHostAlloc(void** pHost, size_t size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaHostAlloc(pHost, size, flags) + return _static_cudaHostAlloc(pHost, size, flags) + + +cdef cudaError_t _cudaHostRegister(void* ptr, size_t size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaHostRegister(ptr, size, flags) + return _static_cudaHostRegister(ptr, size, flags) + + +cdef cudaError_t _cudaHostUnregister(void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaHostUnregister(ptr) + return _static_cudaHostUnregister(ptr) + + +cdef cudaError_t _cudaHostGetDevicePointer(void** pDevice, void* pHost, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaHostGetDevicePointer(pDevice, pHost, flags) + return _static_cudaHostGetDevicePointer(pDevice, pHost, flags) + + +cdef cudaError_t _cudaHostGetFlags(unsigned int* pFlags, void* pHost) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaHostGetFlags(pFlags, pHost) + return _static_cudaHostGetFlags(pFlags, pHost) + + +cdef cudaError_t _cudaMalloc3D(cudaPitchedPtr* pitchedDevPtr, cudaExtent extent) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMalloc3D(pitchedDevPtr, extent) + return _static_cudaMalloc3D(pitchedDevPtr, extent) + + +cdef cudaError_t _cudaMalloc3DArray(cudaArray_t* array, const cudaChannelFormatDesc* desc, cudaExtent extent, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMalloc3DArray(array, desc, extent, flags) + return _static_cudaMalloc3DArray(array, desc, extent, flags) + + +cdef cudaError_t _cudaMallocMipmappedArray(cudaMipmappedArray_t* mipmappedArray, const cudaChannelFormatDesc* desc, cudaExtent extent, unsigned int numLevels, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMallocMipmappedArray(mipmappedArray, desc, extent, numLevels, flags) + return _static_cudaMallocMipmappedArray(mipmappedArray, desc, extent, numLevels, flags) + + +cdef cudaError_t _cudaGetMipmappedArrayLevel(cudaArray_t* levelArray, cudaMipmappedArray_const_t mipmappedArray, unsigned int level) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGetMipmappedArrayLevel(levelArray, mipmappedArray, level) + return _static_cudaGetMipmappedArrayLevel(levelArray, mipmappedArray, level) + + +cdef cudaError_t _cudaMemcpy3D(const cudaMemcpy3DParms* p) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpy3D(p) + return _static_cudaMemcpy3D(p) + + +cdef cudaError_t _cudaMemcpy3DPeer(const cudaMemcpy3DPeerParms* p) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpy3DPeer(p) + return _static_cudaMemcpy3DPeer(p) + + +cdef cudaError_t _cudaMemcpy3DAsync(const cudaMemcpy3DParms* p, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpy3DAsync(p, stream) + return _static_cudaMemcpy3DAsync(p, stream) + + +cdef cudaError_t _cudaMemcpy3DPeerAsync(const cudaMemcpy3DPeerParms* p, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpy3DPeerAsync(p, stream) + return _static_cudaMemcpy3DPeerAsync(p, stream) + + +cdef cudaError_t _cudaMemGetInfo(size_t* free, size_t* total) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemGetInfo(free, total) + return _static_cudaMemGetInfo(free, total) + + +cdef cudaError_t _cudaArrayGetInfo(cudaChannelFormatDesc* desc, cudaExtent* extent, unsigned int* flags, cudaArray_t array) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaArrayGetInfo(desc, extent, flags, array) + return _static_cudaArrayGetInfo(desc, extent, flags, array) + + +cdef cudaError_t _cudaArrayGetPlane(cudaArray_t* pPlaneArray, cudaArray_t hArray, unsigned int planeIdx) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaArrayGetPlane(pPlaneArray, hArray, planeIdx) + return _static_cudaArrayGetPlane(pPlaneArray, hArray, planeIdx) + + +cdef cudaError_t _cudaArrayGetMemoryRequirements(cudaArrayMemoryRequirements* memoryRequirements, cudaArray_t array, int device) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaArrayGetMemoryRequirements(memoryRequirements, array, device) + return _static_cudaArrayGetMemoryRequirements(memoryRequirements, array, device) + + +cdef cudaError_t _cudaMipmappedArrayGetMemoryRequirements(cudaArrayMemoryRequirements* memoryRequirements, cudaMipmappedArray_t mipmap, int device) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMipmappedArrayGetMemoryRequirements(memoryRequirements, mipmap, device) + return _static_cudaMipmappedArrayGetMemoryRequirements(memoryRequirements, mipmap, device) + + +cdef cudaError_t _cudaArrayGetSparseProperties(cudaArraySparseProperties* sparseProperties, cudaArray_t array) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaArrayGetSparseProperties(sparseProperties, array) + return _static_cudaArrayGetSparseProperties(sparseProperties, array) + + +cdef cudaError_t _cudaMipmappedArrayGetSparseProperties(cudaArraySparseProperties* sparseProperties, cudaMipmappedArray_t mipmap) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMipmappedArrayGetSparseProperties(sparseProperties, mipmap) + return _static_cudaMipmappedArrayGetSparseProperties(sparseProperties, mipmap) + + +cdef cudaError_t _cudaMemcpy(void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpy(dst, src, count, kind) + return _static_cudaMemcpy(dst, src, count, kind) + + +cdef cudaError_t _cudaMemcpyPeer(void* dst, int dstDevice, const void* src, int srcDevice, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpyPeer(dst, dstDevice, src, srcDevice, count) + return _static_cudaMemcpyPeer(dst, dstDevice, src, srcDevice, count) + + +cdef cudaError_t _cudaMemcpy2D(void* dst, size_t dpitch, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpy2D(dst, dpitch, src, spitch, width, height, kind) + return _static_cudaMemcpy2D(dst, dpitch, src, spitch, width, height, kind) + + +cdef cudaError_t _cudaMemcpy2DToArray(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpy2DToArray(dst, wOffset, hOffset, src, spitch, width, height, kind) + return _static_cudaMemcpy2DToArray(dst, wOffset, hOffset, src, spitch, width, height, kind) + + +cdef cudaError_t _cudaMemcpy2DFromArray(void* dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpy2DFromArray(dst, dpitch, src, wOffset, hOffset, width, height, kind) + return _static_cudaMemcpy2DFromArray(dst, dpitch, src, wOffset, hOffset, width, height, kind) + + +cdef cudaError_t _cudaMemcpy2DArrayToArray(cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpy2DArrayToArray(dst, wOffsetDst, hOffsetDst, src, wOffsetSrc, hOffsetSrc, width, height, kind) + return _static_cudaMemcpy2DArrayToArray(dst, wOffsetDst, hOffsetDst, src, wOffsetSrc, hOffsetSrc, width, height, kind) + + +cdef cudaError_t _cudaMemcpyAsync(void* dst, const void* src, size_t count, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpyAsync(dst, src, count, kind, stream) + return _static_cudaMemcpyAsync(dst, src, count, kind, stream) + + +cdef cudaError_t _cudaMemcpyPeerAsync(void* dst, int dstDevice, const void* src, int srcDevice, size_t count, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpyPeerAsync(dst, dstDevice, src, srcDevice, count, stream) + return _static_cudaMemcpyPeerAsync(dst, dstDevice, src, srcDevice, count, stream) + + +cdef cudaError_t _cudaMemcpyBatchAsync(const void** dsts, const void** srcs, const size_t* sizes, size_t count, cudaMemcpyAttributes* attrs, size_t* attrsIdxs, size_t numAttrs, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpyBatchAsync(dsts, srcs, sizes, count, attrs, attrsIdxs, numAttrs, stream) + return _static_cudaMemcpyBatchAsync(dsts, srcs, sizes, count, attrs, attrsIdxs, numAttrs, stream) + + +cdef cudaError_t _cudaMemcpy3DBatchAsync(size_t numOps, cudaMemcpy3DBatchOp* opList, unsigned long long flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpy3DBatchAsync(numOps, opList, flags, stream) + return _static_cudaMemcpy3DBatchAsync(numOps, opList, flags, stream) + + +cdef cudaError_t _cudaMemcpy2DAsync(void* dst, size_t dpitch, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpy2DAsync(dst, dpitch, src, spitch, width, height, kind, stream) + return _static_cudaMemcpy2DAsync(dst, dpitch, src, spitch, width, height, kind, stream) + + +cdef cudaError_t _cudaMemcpy2DToArrayAsync(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpy2DToArrayAsync(dst, wOffset, hOffset, src, spitch, width, height, kind, stream) + return _static_cudaMemcpy2DToArrayAsync(dst, wOffset, hOffset, src, spitch, width, height, kind, stream) + + +cdef cudaError_t _cudaMemcpy2DFromArrayAsync(void* dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpy2DFromArrayAsync(dst, dpitch, src, wOffset, hOffset, width, height, kind, stream) + return _static_cudaMemcpy2DFromArrayAsync(dst, dpitch, src, wOffset, hOffset, width, height, kind, stream) + + +cdef cudaError_t _cudaMemset(void* devPtr, int value, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemset(devPtr, value, count) + return _static_cudaMemset(devPtr, value, count) + + +cdef cudaError_t _cudaMemset2D(void* devPtr, size_t pitch, int value, size_t width, size_t height) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemset2D(devPtr, pitch, value, width, height) + return _static_cudaMemset2D(devPtr, pitch, value, width, height) + + +cdef cudaError_t _cudaMemset3D(cudaPitchedPtr pitchedDevPtr, int value, cudaExtent extent) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemset3D(pitchedDevPtr, value, extent) + return _static_cudaMemset3D(pitchedDevPtr, value, extent) + + +cdef cudaError_t _cudaMemsetAsync(void* devPtr, int value, size_t count, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemsetAsync(devPtr, value, count, stream) + return _static_cudaMemsetAsync(devPtr, value, count, stream) + + +cdef cudaError_t _cudaMemset2DAsync(void* devPtr, size_t pitch, int value, size_t width, size_t height, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemset2DAsync(devPtr, pitch, value, width, height, stream) + return _static_cudaMemset2DAsync(devPtr, pitch, value, width, height, stream) + + +cdef cudaError_t _cudaMemset3DAsync(cudaPitchedPtr pitchedDevPtr, int value, cudaExtent extent, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemset3DAsync(pitchedDevPtr, value, extent, stream) + return _static_cudaMemset3DAsync(pitchedDevPtr, value, extent, stream) + + +cdef cudaError_t _cudaMemPrefetchAsync(const void* devPtr, size_t count, cudaMemLocation location, unsigned int flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemPrefetchAsync(devPtr, count, location, flags, stream) + return _static_cudaMemPrefetchAsync(devPtr, count, location, flags, stream) + + +cdef cudaError_t _cudaMemAdvise(const void* devPtr, size_t count, cudaMemoryAdvise advice, cudaMemLocation location) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemAdvise(devPtr, count, advice, location) + return _static_cudaMemAdvise(devPtr, count, advice, location) + + +cdef cudaError_t _cudaMemRangeGetAttribute(void* data, size_t dataSize, cudaMemRangeAttribute attribute, const void* devPtr, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemRangeGetAttribute(data, dataSize, attribute, devPtr, count) + return _static_cudaMemRangeGetAttribute(data, dataSize, attribute, devPtr, count) + + +cdef cudaError_t _cudaMemRangeGetAttributes(void** data, size_t* dataSizes, cudaMemRangeAttribute* attributes, size_t numAttributes, const void* devPtr, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemRangeGetAttributes(data, dataSizes, attributes, numAttributes, devPtr, count) + return _static_cudaMemRangeGetAttributes(data, dataSizes, attributes, numAttributes, devPtr, count) + + +cdef cudaError_t _cudaMemcpyToArray(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpyToArray(dst, wOffset, hOffset, src, count, kind) + return _static_cudaMemcpyToArray(dst, wOffset, hOffset, src, count, kind) + + +cdef cudaError_t _cudaMemcpyFromArray(void* dst, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpyFromArray(dst, src, wOffset, hOffset, count, kind) + return _static_cudaMemcpyFromArray(dst, src, wOffset, hOffset, count, kind) + + +cdef cudaError_t _cudaMemcpyArrayToArray(cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpyArrayToArray(dst, wOffsetDst, hOffsetDst, src, wOffsetSrc, hOffsetSrc, count, kind) + return _static_cudaMemcpyArrayToArray(dst, wOffsetDst, hOffsetDst, src, wOffsetSrc, hOffsetSrc, count, kind) + + +cdef cudaError_t _cudaMemcpyToArrayAsync(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t count, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpyToArrayAsync(dst, wOffset, hOffset, src, count, kind, stream) + return _static_cudaMemcpyToArrayAsync(dst, wOffset, hOffset, src, count, kind, stream) + + +cdef cudaError_t _cudaMemcpyFromArrayAsync(void* dst, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpyFromArrayAsync(dst, src, wOffset, hOffset, count, kind, stream) + return _static_cudaMemcpyFromArrayAsync(dst, src, wOffset, hOffset, count, kind, stream) + + +cdef cudaError_t _cudaMallocAsync(void** devPtr, size_t size, cudaStream_t hStream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMallocAsync(devPtr, size, hStream) + return _static_cudaMallocAsync(devPtr, size, hStream) + + +cdef cudaError_t _cudaFreeAsync(void* devPtr, cudaStream_t hStream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaFreeAsync(devPtr, hStream) + return _static_cudaFreeAsync(devPtr, hStream) + + +cdef cudaError_t _cudaMemPoolTrimTo(cudaMemPool_t memPool, size_t minBytesToKeep) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemPoolTrimTo(memPool, minBytesToKeep) + return _static_cudaMemPoolTrimTo(memPool, minBytesToKeep) + + +cdef cudaError_t _cudaMemPoolSetAttribute(cudaMemPool_t memPool, cudaMemPoolAttr attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemPoolSetAttribute(memPool, attr, value) + return _static_cudaMemPoolSetAttribute(memPool, attr, value) + + +cdef cudaError_t _cudaMemPoolGetAttribute(cudaMemPool_t memPool, cudaMemPoolAttr attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemPoolGetAttribute(memPool, attr, value) + return _static_cudaMemPoolGetAttribute(memPool, attr, value) + + +cdef cudaError_t _cudaMemPoolSetAccess(cudaMemPool_t memPool, const cudaMemAccessDesc* descList, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemPoolSetAccess(memPool, descList, count) + return _static_cudaMemPoolSetAccess(memPool, descList, count) + + +cdef cudaError_t _cudaMemPoolGetAccess(cudaMemAccessFlags* flags, cudaMemPool_t memPool, cudaMemLocation* location) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemPoolGetAccess(flags, memPool, location) + return _static_cudaMemPoolGetAccess(flags, memPool, location) + + +cdef cudaError_t _cudaMemPoolCreate(cudaMemPool_t* memPool, const cudaMemPoolProps* poolProps) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemPoolCreate(memPool, poolProps) + return _static_cudaMemPoolCreate(memPool, poolProps) + + +cdef cudaError_t _cudaMemPoolDestroy(cudaMemPool_t memPool) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemPoolDestroy(memPool) + return _static_cudaMemPoolDestroy(memPool) + + +cdef cudaError_t _cudaMallocFromPoolAsync(void** ptr, size_t size, cudaMemPool_t memPool, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMallocFromPoolAsync(ptr, size, memPool, stream) + return _static_cudaMallocFromPoolAsync(ptr, size, memPool, stream) + + +cdef cudaError_t _cudaMemPoolExportToShareableHandle(void* shareableHandle, cudaMemPool_t memPool, cudaMemAllocationHandleType handleType, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemPoolExportToShareableHandle(shareableHandle, memPool, handleType, flags) + return _static_cudaMemPoolExportToShareableHandle(shareableHandle, memPool, handleType, flags) + + +cdef cudaError_t _cudaMemPoolImportFromShareableHandle(cudaMemPool_t* memPool, void* shareableHandle, cudaMemAllocationHandleType handleType, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemPoolImportFromShareableHandle(memPool, shareableHandle, handleType, flags) + return _static_cudaMemPoolImportFromShareableHandle(memPool, shareableHandle, handleType, flags) + + +cdef cudaError_t _cudaMemPoolExportPointer(cudaMemPoolPtrExportData* exportData, void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemPoolExportPointer(exportData, ptr) + return _static_cudaMemPoolExportPointer(exportData, ptr) + + +cdef cudaError_t _cudaMemPoolImportPointer(void** ptr, cudaMemPool_t memPool, cudaMemPoolPtrExportData* exportData) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemPoolImportPointer(ptr, memPool, exportData) + return _static_cudaMemPoolImportPointer(ptr, memPool, exportData) + + +cdef cudaError_t _cudaPointerGetAttributes(cudaPointerAttributes* attributes, const void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaPointerGetAttributes(attributes, ptr) + return _static_cudaPointerGetAttributes(attributes, ptr) + + +cdef cudaError_t _cudaDeviceCanAccessPeer(int* canAccessPeer, int device, int peerDevice) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceCanAccessPeer(canAccessPeer, device, peerDevice) + return _static_cudaDeviceCanAccessPeer(canAccessPeer, device, peerDevice) + + +cdef cudaError_t _cudaDeviceEnablePeerAccess(int peerDevice, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceEnablePeerAccess(peerDevice, flags) + return _static_cudaDeviceEnablePeerAccess(peerDevice, flags) + + +cdef cudaError_t _cudaDeviceDisablePeerAccess(int peerDevice) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceDisablePeerAccess(peerDevice) + return _static_cudaDeviceDisablePeerAccess(peerDevice) + + +cdef cudaError_t _cudaGraphicsUnregisterResource(cudaGraphicsResource_t resource) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphicsUnregisterResource(resource) + return _static_cudaGraphicsUnregisterResource(resource) + + +cdef cudaError_t _cudaGraphicsResourceSetMapFlags(cudaGraphicsResource_t resource, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphicsResourceSetMapFlags(resource, flags) + return _static_cudaGraphicsResourceSetMapFlags(resource, flags) + + +cdef cudaError_t _cudaGraphicsMapResources(int count, cudaGraphicsResource_t* resources, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphicsMapResources(count, resources, stream) + return _static_cudaGraphicsMapResources(count, resources, stream) + + +cdef cudaError_t _cudaGraphicsUnmapResources(int count, cudaGraphicsResource_t* resources, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphicsUnmapResources(count, resources, stream) + return _static_cudaGraphicsUnmapResources(count, resources, stream) + + +cdef cudaError_t _cudaGraphicsResourceGetMappedPointer(void** devPtr, size_t* size, cudaGraphicsResource_t resource) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphicsResourceGetMappedPointer(devPtr, size, resource) + return _static_cudaGraphicsResourceGetMappedPointer(devPtr, size, resource) + + +cdef cudaError_t _cudaGraphicsSubResourceGetMappedArray(cudaArray_t* array, cudaGraphicsResource_t resource, unsigned int arrayIndex, unsigned int mipLevel) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphicsSubResourceGetMappedArray(array, resource, arrayIndex, mipLevel) + return _static_cudaGraphicsSubResourceGetMappedArray(array, resource, arrayIndex, mipLevel) + + +cdef cudaError_t _cudaGraphicsResourceGetMappedMipmappedArray(cudaMipmappedArray_t* mipmappedArray, cudaGraphicsResource_t resource) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphicsResourceGetMappedMipmappedArray(mipmappedArray, resource) + return _static_cudaGraphicsResourceGetMappedMipmappedArray(mipmappedArray, resource) + + +cdef cudaError_t _cudaGetChannelDesc(cudaChannelFormatDesc* desc, cudaArray_const_t array) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGetChannelDesc(desc, array) + return _static_cudaGetChannelDesc(desc, array) + + +cdef cudaChannelFormatDesc _cudaCreateChannelDesc(int x, int y, int z, int w, cudaChannelFormatKind f) except* nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaCreateChannelDesc(x, y, z, w, f) + return _static_cudaCreateChannelDesc(x, y, z, w, f) + + +cdef cudaError_t _cudaCreateTextureObject(cudaTextureObject_t* pTexObject, const cudaResourceDesc* pResDesc, const cudaTextureDesc* pTexDesc, const cudaResourceViewDesc* pResViewDesc) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaCreateTextureObject(pTexObject, pResDesc, pTexDesc, pResViewDesc) + return _static_cudaCreateTextureObject(pTexObject, pResDesc, pTexDesc, pResViewDesc) + + +cdef cudaError_t _cudaDestroyTextureObject(cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDestroyTextureObject(texObject) + return _static_cudaDestroyTextureObject(texObject) + + +cdef cudaError_t _cudaGetTextureObjectResourceDesc(cudaResourceDesc* pResDesc, cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGetTextureObjectResourceDesc(pResDesc, texObject) + return _static_cudaGetTextureObjectResourceDesc(pResDesc, texObject) + + +cdef cudaError_t _cudaGetTextureObjectTextureDesc(cudaTextureDesc* pTexDesc, cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGetTextureObjectTextureDesc(pTexDesc, texObject) + return _static_cudaGetTextureObjectTextureDesc(pTexDesc, texObject) + + +cdef cudaError_t _cudaGetTextureObjectResourceViewDesc(cudaResourceViewDesc* pResViewDesc, cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGetTextureObjectResourceViewDesc(pResViewDesc, texObject) + return _static_cudaGetTextureObjectResourceViewDesc(pResViewDesc, texObject) + + +cdef cudaError_t _cudaCreateSurfaceObject(cudaSurfaceObject_t* pSurfObject, const cudaResourceDesc* pResDesc) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaCreateSurfaceObject(pSurfObject, pResDesc) + return _static_cudaCreateSurfaceObject(pSurfObject, pResDesc) + + +cdef cudaError_t _cudaDestroySurfaceObject(cudaSurfaceObject_t surfObject) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDestroySurfaceObject(surfObject) + return _static_cudaDestroySurfaceObject(surfObject) + + +cdef cudaError_t _cudaGetSurfaceObjectResourceDesc(cudaResourceDesc* pResDesc, cudaSurfaceObject_t surfObject) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGetSurfaceObjectResourceDesc(pResDesc, surfObject) + return _static_cudaGetSurfaceObjectResourceDesc(pResDesc, surfObject) + + +cdef cudaError_t _cudaDriverGetVersion(int* driverVersion) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDriverGetVersion(driverVersion) + return _static_cudaDriverGetVersion(driverVersion) + + +cdef cudaError_t _cudaRuntimeGetVersion(int* runtimeVersion) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaRuntimeGetVersion(runtimeVersion) + return _static_cudaRuntimeGetVersion(runtimeVersion) + + +cdef cudaError_t _cudaGraphCreate(cudaGraph_t* pGraph, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphCreate(pGraph, flags) + return _static_cudaGraphCreate(pGraph, flags) + + +cdef cudaError_t _cudaGraphAddKernelNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphAddKernelNode(pGraphNode, graph, pDependencies, numDependencies, pNodeParams) + return _static_cudaGraphAddKernelNode(pGraphNode, graph, pDependencies, numDependencies, pNodeParams) + + +cdef cudaError_t _cudaGraphKernelNodeGetParams(cudaGraphNode_t node, cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphKernelNodeGetParams(node, pNodeParams) + return _static_cudaGraphKernelNodeGetParams(node, pNodeParams) + + +cdef cudaError_t _cudaGraphKernelNodeSetParams(cudaGraphNode_t node, const cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphKernelNodeSetParams(node, pNodeParams) + return _static_cudaGraphKernelNodeSetParams(node, pNodeParams) + + +cdef cudaError_t _cudaGraphKernelNodeCopyAttributes(cudaGraphNode_t hDst, cudaGraphNode_t hSrc) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphKernelNodeCopyAttributes(hDst, hSrc) + return _static_cudaGraphKernelNodeCopyAttributes(hDst, hSrc) + + +cdef cudaError_t _cudaGraphKernelNodeGetAttribute(cudaGraphNode_t hNode, cudaKernelNodeAttrID attr, cudaKernelNodeAttrValue* value_out) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphKernelNodeGetAttribute(hNode, attr, value_out) + return _static_cudaGraphKernelNodeGetAttribute(hNode, attr, value_out) + + +cdef cudaError_t _cudaGraphKernelNodeSetAttribute(cudaGraphNode_t hNode, cudaKernelNodeAttrID attr, const cudaKernelNodeAttrValue* value) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphKernelNodeSetAttribute(hNode, attr, value) + return _static_cudaGraphKernelNodeSetAttribute(hNode, attr, value) + + +cdef cudaError_t _cudaGraphAddMemcpyNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaMemcpy3DParms* pCopyParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphAddMemcpyNode(pGraphNode, graph, pDependencies, numDependencies, pCopyParams) + return _static_cudaGraphAddMemcpyNode(pGraphNode, graph, pDependencies, numDependencies, pCopyParams) + + +cdef cudaError_t _cudaGraphAddMemcpyNode1D(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphAddMemcpyNode1D(pGraphNode, graph, pDependencies, numDependencies, dst, src, count, kind) + return _static_cudaGraphAddMemcpyNode1D(pGraphNode, graph, pDependencies, numDependencies, dst, src, count, kind) + + +cdef cudaError_t _cudaGraphMemcpyNodeGetParams(cudaGraphNode_t node, cudaMemcpy3DParms* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphMemcpyNodeGetParams(node, pNodeParams) + return _static_cudaGraphMemcpyNodeGetParams(node, pNodeParams) + + +cdef cudaError_t _cudaGraphMemcpyNodeSetParams(cudaGraphNode_t node, const cudaMemcpy3DParms* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphMemcpyNodeSetParams(node, pNodeParams) + return _static_cudaGraphMemcpyNodeSetParams(node, pNodeParams) + + +cdef cudaError_t _cudaGraphMemcpyNodeSetParams1D(cudaGraphNode_t node, void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphMemcpyNodeSetParams1D(node, dst, src, count, kind) + return _static_cudaGraphMemcpyNodeSetParams1D(node, dst, src, count, kind) + + +cdef cudaError_t _cudaGraphAddMemsetNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaMemsetParams* pMemsetParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphAddMemsetNode(pGraphNode, graph, pDependencies, numDependencies, pMemsetParams) + return _static_cudaGraphAddMemsetNode(pGraphNode, graph, pDependencies, numDependencies, pMemsetParams) + + +cdef cudaError_t _cudaGraphMemsetNodeGetParams(cudaGraphNode_t node, cudaMemsetParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphMemsetNodeGetParams(node, pNodeParams) + return _static_cudaGraphMemsetNodeGetParams(node, pNodeParams) + + +cdef cudaError_t _cudaGraphMemsetNodeSetParams(cudaGraphNode_t node, const cudaMemsetParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphMemsetNodeSetParams(node, pNodeParams) + return _static_cudaGraphMemsetNodeSetParams(node, pNodeParams) + + +cdef cudaError_t _cudaGraphAddHostNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphAddHostNode(pGraphNode, graph, pDependencies, numDependencies, pNodeParams) + return _static_cudaGraphAddHostNode(pGraphNode, graph, pDependencies, numDependencies, pNodeParams) + + +cdef cudaError_t _cudaGraphHostNodeGetParams(cudaGraphNode_t node, cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphHostNodeGetParams(node, pNodeParams) + return _static_cudaGraphHostNodeGetParams(node, pNodeParams) + + +cdef cudaError_t _cudaGraphHostNodeSetParams(cudaGraphNode_t node, const cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphHostNodeSetParams(node, pNodeParams) + return _static_cudaGraphHostNodeSetParams(node, pNodeParams) + + +cdef cudaError_t _cudaGraphAddChildGraphNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaGraph_t childGraph) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphAddChildGraphNode(pGraphNode, graph, pDependencies, numDependencies, childGraph) + return _static_cudaGraphAddChildGraphNode(pGraphNode, graph, pDependencies, numDependencies, childGraph) + + +cdef cudaError_t _cudaGraphChildGraphNodeGetGraph(cudaGraphNode_t node, cudaGraph_t* pGraph) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphChildGraphNodeGetGraph(node, pGraph) + return _static_cudaGraphChildGraphNodeGetGraph(node, pGraph) + + +cdef cudaError_t _cudaGraphAddEmptyNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphAddEmptyNode(pGraphNode, graph, pDependencies, numDependencies) + return _static_cudaGraphAddEmptyNode(pGraphNode, graph, pDependencies, numDependencies) + + +cdef cudaError_t _cudaGraphAddEventRecordNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphAddEventRecordNode(pGraphNode, graph, pDependencies, numDependencies, event) + return _static_cudaGraphAddEventRecordNode(pGraphNode, graph, pDependencies, numDependencies, event) + + +cdef cudaError_t _cudaGraphEventRecordNodeGetEvent(cudaGraphNode_t node, cudaEvent_t* event_out) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphEventRecordNodeGetEvent(node, event_out) + return _static_cudaGraphEventRecordNodeGetEvent(node, event_out) + + +cdef cudaError_t _cudaGraphEventRecordNodeSetEvent(cudaGraphNode_t node, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphEventRecordNodeSetEvent(node, event) + return _static_cudaGraphEventRecordNodeSetEvent(node, event) + + +cdef cudaError_t _cudaGraphAddEventWaitNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphAddEventWaitNode(pGraphNode, graph, pDependencies, numDependencies, event) + return _static_cudaGraphAddEventWaitNode(pGraphNode, graph, pDependencies, numDependencies, event) + + +cdef cudaError_t _cudaGraphEventWaitNodeGetEvent(cudaGraphNode_t node, cudaEvent_t* event_out) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphEventWaitNodeGetEvent(node, event_out) + return _static_cudaGraphEventWaitNodeGetEvent(node, event_out) + + +cdef cudaError_t _cudaGraphEventWaitNodeSetEvent(cudaGraphNode_t node, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphEventWaitNodeSetEvent(node, event) + return _static_cudaGraphEventWaitNodeSetEvent(node, event) + + +cdef cudaError_t _cudaGraphAddExternalSemaphoresSignalNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphAddExternalSemaphoresSignalNode(pGraphNode, graph, pDependencies, numDependencies, nodeParams) + return _static_cudaGraphAddExternalSemaphoresSignalNode(pGraphNode, graph, pDependencies, numDependencies, nodeParams) + + +cdef cudaError_t _cudaGraphExternalSemaphoresSignalNodeGetParams(cudaGraphNode_t hNode, cudaExternalSemaphoreSignalNodeParams* params_out) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphExternalSemaphoresSignalNodeGetParams(hNode, params_out) + return _static_cudaGraphExternalSemaphoresSignalNodeGetParams(hNode, params_out) + + +cdef cudaError_t _cudaGraphExternalSemaphoresSignalNodeSetParams(cudaGraphNode_t hNode, const cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphExternalSemaphoresSignalNodeSetParams(hNode, nodeParams) + return _static_cudaGraphExternalSemaphoresSignalNodeSetParams(hNode, nodeParams) + + +cdef cudaError_t _cudaGraphAddExternalSemaphoresWaitNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphAddExternalSemaphoresWaitNode(pGraphNode, graph, pDependencies, numDependencies, nodeParams) + return _static_cudaGraphAddExternalSemaphoresWaitNode(pGraphNode, graph, pDependencies, numDependencies, nodeParams) + + +cdef cudaError_t _cudaGraphExternalSemaphoresWaitNodeGetParams(cudaGraphNode_t hNode, cudaExternalSemaphoreWaitNodeParams* params_out) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphExternalSemaphoresWaitNodeGetParams(hNode, params_out) + return _static_cudaGraphExternalSemaphoresWaitNodeGetParams(hNode, params_out) + + +cdef cudaError_t _cudaGraphExternalSemaphoresWaitNodeSetParams(cudaGraphNode_t hNode, const cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphExternalSemaphoresWaitNodeSetParams(hNode, nodeParams) + return _static_cudaGraphExternalSemaphoresWaitNodeSetParams(hNode, nodeParams) + + +cdef cudaError_t _cudaGraphAddMemAllocNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaMemAllocNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphAddMemAllocNode(pGraphNode, graph, pDependencies, numDependencies, nodeParams) + return _static_cudaGraphAddMemAllocNode(pGraphNode, graph, pDependencies, numDependencies, nodeParams) + + +cdef cudaError_t _cudaGraphMemAllocNodeGetParams(cudaGraphNode_t node, cudaMemAllocNodeParams* params_out) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphMemAllocNodeGetParams(node, params_out) + return _static_cudaGraphMemAllocNodeGetParams(node, params_out) + + +cdef cudaError_t _cudaGraphAddMemFreeNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, void* dptr) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphAddMemFreeNode(pGraphNode, graph, pDependencies, numDependencies, dptr) + return _static_cudaGraphAddMemFreeNode(pGraphNode, graph, pDependencies, numDependencies, dptr) + + +cdef cudaError_t _cudaGraphMemFreeNodeGetParams(cudaGraphNode_t node, void* dptr_out) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphMemFreeNodeGetParams(node, dptr_out) + return _static_cudaGraphMemFreeNodeGetParams(node, dptr_out) + + +cdef cudaError_t _cudaDeviceGraphMemTrim(int device) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceGraphMemTrim(device) + return _static_cudaDeviceGraphMemTrim(device) + + +cdef cudaError_t _cudaDeviceGetGraphMemAttribute(int device, cudaGraphMemAttributeType attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceGetGraphMemAttribute(device, attr, value) + return _static_cudaDeviceGetGraphMemAttribute(device, attr, value) + + +cdef cudaError_t _cudaDeviceSetGraphMemAttribute(int device, cudaGraphMemAttributeType attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceSetGraphMemAttribute(device, attr, value) + return _static_cudaDeviceSetGraphMemAttribute(device, attr, value) + + +cdef cudaError_t _cudaGraphClone(cudaGraph_t* pGraphClone, cudaGraph_t originalGraph) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphClone(pGraphClone, originalGraph) + return _static_cudaGraphClone(pGraphClone, originalGraph) + + +cdef cudaError_t _cudaGraphNodeFindInClone(cudaGraphNode_t* pNode, cudaGraphNode_t originalNode, cudaGraph_t clonedGraph) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphNodeFindInClone(pNode, originalNode, clonedGraph) + return _static_cudaGraphNodeFindInClone(pNode, originalNode, clonedGraph) + + +cdef cudaError_t _cudaGraphNodeGetType(cudaGraphNode_t node, cudaGraphNodeType* pType) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphNodeGetType(node, pType) + return _static_cudaGraphNodeGetType(node, pType) + + +cdef cudaError_t _cudaGraphGetNodes(cudaGraph_t graph, cudaGraphNode_t* nodes, size_t* numNodes) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphGetNodes(graph, nodes, numNodes) + return _static_cudaGraphGetNodes(graph, nodes, numNodes) + + +cdef cudaError_t _cudaGraphGetRootNodes(cudaGraph_t graph, cudaGraphNode_t* pRootNodes, size_t* pNumRootNodes) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphGetRootNodes(graph, pRootNodes, pNumRootNodes) + return _static_cudaGraphGetRootNodes(graph, pRootNodes, pNumRootNodes) + + +cdef cudaError_t _cudaGraphGetEdges(cudaGraph_t graph, cudaGraphNode_t* from_, cudaGraphNode_t* to, cudaGraphEdgeData* edgeData, size_t* numEdges) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphGetEdges(graph, from_, to, edgeData, numEdges) + return _static_cudaGraphGetEdges(graph, from_, to, edgeData, numEdges) + + +cdef cudaError_t _cudaGraphNodeGetDependencies(cudaGraphNode_t node, cudaGraphNode_t* pDependencies, cudaGraphEdgeData* edgeData, size_t* pNumDependencies) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphNodeGetDependencies(node, pDependencies, edgeData, pNumDependencies) + return _static_cudaGraphNodeGetDependencies(node, pDependencies, edgeData, pNumDependencies) + + +cdef cudaError_t _cudaGraphNodeGetDependentNodes(cudaGraphNode_t node, cudaGraphNode_t* pDependentNodes, cudaGraphEdgeData* edgeData, size_t* pNumDependentNodes) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphNodeGetDependentNodes(node, pDependentNodes, edgeData, pNumDependentNodes) + return _static_cudaGraphNodeGetDependentNodes(node, pDependentNodes, edgeData, pNumDependentNodes) + + +cdef cudaError_t _cudaGraphAddDependencies(cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, const cudaGraphEdgeData* edgeData, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphAddDependencies(graph, from_, to, edgeData, numDependencies) + return _static_cudaGraphAddDependencies(graph, from_, to, edgeData, numDependencies) + + +cdef cudaError_t _cudaGraphRemoveDependencies(cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, const cudaGraphEdgeData* edgeData, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphRemoveDependencies(graph, from_, to, edgeData, numDependencies) + return _static_cudaGraphRemoveDependencies(graph, from_, to, edgeData, numDependencies) + + +cdef cudaError_t _cudaGraphDestroyNode(cudaGraphNode_t node) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphDestroyNode(node) + return _static_cudaGraphDestroyNode(node) + + +cdef cudaError_t _cudaGraphInstantiate(cudaGraphExec_t* pGraphExec, cudaGraph_t graph, unsigned long long flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphInstantiate(pGraphExec, graph, flags) + return _static_cudaGraphInstantiate(pGraphExec, graph, flags) + + +cdef cudaError_t _cudaGraphInstantiateWithFlags(cudaGraphExec_t* pGraphExec, cudaGraph_t graph, unsigned long long flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphInstantiateWithFlags(pGraphExec, graph, flags) + return _static_cudaGraphInstantiateWithFlags(pGraphExec, graph, flags) + + +cdef cudaError_t _cudaGraphInstantiateWithParams(cudaGraphExec_t* pGraphExec, cudaGraph_t graph, cudaGraphInstantiateParams* instantiateParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphInstantiateWithParams(pGraphExec, graph, instantiateParams) + return _static_cudaGraphInstantiateWithParams(pGraphExec, graph, instantiateParams) + + +cdef cudaError_t _cudaGraphExecGetFlags(cudaGraphExec_t graphExec, unsigned long long* flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphExecGetFlags(graphExec, flags) + return _static_cudaGraphExecGetFlags(graphExec, flags) + + +cdef cudaError_t _cudaGraphExecKernelNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphExecKernelNodeSetParams(hGraphExec, node, pNodeParams) + return _static_cudaGraphExecKernelNodeSetParams(hGraphExec, node, pNodeParams) + + +cdef cudaError_t _cudaGraphExecMemcpyNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaMemcpy3DParms* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphExecMemcpyNodeSetParams(hGraphExec, node, pNodeParams) + return _static_cudaGraphExecMemcpyNodeSetParams(hGraphExec, node, pNodeParams) + + +cdef cudaError_t _cudaGraphExecMemcpyNodeSetParams1D(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphExecMemcpyNodeSetParams1D(hGraphExec, node, dst, src, count, kind) + return _static_cudaGraphExecMemcpyNodeSetParams1D(hGraphExec, node, dst, src, count, kind) + + +cdef cudaError_t _cudaGraphExecMemsetNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaMemsetParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphExecMemsetNodeSetParams(hGraphExec, node, pNodeParams) + return _static_cudaGraphExecMemsetNodeSetParams(hGraphExec, node, pNodeParams) + + +cdef cudaError_t _cudaGraphExecHostNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphExecHostNodeSetParams(hGraphExec, node, pNodeParams) + return _static_cudaGraphExecHostNodeSetParams(hGraphExec, node, pNodeParams) + + +cdef cudaError_t _cudaGraphExecChildGraphNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, cudaGraph_t childGraph) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphExecChildGraphNodeSetParams(hGraphExec, node, childGraph) + return _static_cudaGraphExecChildGraphNodeSetParams(hGraphExec, node, childGraph) + + +cdef cudaError_t _cudaGraphExecEventRecordNodeSetEvent(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphExecEventRecordNodeSetEvent(hGraphExec, hNode, event) + return _static_cudaGraphExecEventRecordNodeSetEvent(hGraphExec, hNode, event) + + +cdef cudaError_t _cudaGraphExecEventWaitNodeSetEvent(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphExecEventWaitNodeSetEvent(hGraphExec, hNode, event) + return _static_cudaGraphExecEventWaitNodeSetEvent(hGraphExec, hNode, event) + + +cdef cudaError_t _cudaGraphExecExternalSemaphoresSignalNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, const cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphExecExternalSemaphoresSignalNodeSetParams(hGraphExec, hNode, nodeParams) + return _static_cudaGraphExecExternalSemaphoresSignalNodeSetParams(hGraphExec, hNode, nodeParams) + + +cdef cudaError_t _cudaGraphExecExternalSemaphoresWaitNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, const cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphExecExternalSemaphoresWaitNodeSetParams(hGraphExec, hNode, nodeParams) + return _static_cudaGraphExecExternalSemaphoresWaitNodeSetParams(hGraphExec, hNode, nodeParams) + + +cdef cudaError_t _cudaGraphNodeSetEnabled(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, unsigned int isEnabled) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphNodeSetEnabled(hGraphExec, hNode, isEnabled) + return _static_cudaGraphNodeSetEnabled(hGraphExec, hNode, isEnabled) + + +cdef cudaError_t _cudaGraphNodeGetEnabled(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, unsigned int* isEnabled) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphNodeGetEnabled(hGraphExec, hNode, isEnabled) + return _static_cudaGraphNodeGetEnabled(hGraphExec, hNode, isEnabled) + + +cdef cudaError_t _cudaGraphExecUpdate(cudaGraphExec_t hGraphExec, cudaGraph_t hGraph, cudaGraphExecUpdateResultInfo* resultInfo) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphExecUpdate(hGraphExec, hGraph, resultInfo) + return _static_cudaGraphExecUpdate(hGraphExec, hGraph, resultInfo) + + +cdef cudaError_t _cudaGraphUpload(cudaGraphExec_t graphExec, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphUpload(graphExec, stream) + return _static_cudaGraphUpload(graphExec, stream) + + +cdef cudaError_t _cudaGraphLaunch(cudaGraphExec_t graphExec, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphLaunch(graphExec, stream) + return _static_cudaGraphLaunch(graphExec, stream) + + +cdef cudaError_t _cudaGraphExecDestroy(cudaGraphExec_t graphExec) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphExecDestroy(graphExec) + return _static_cudaGraphExecDestroy(graphExec) + + +cdef cudaError_t _cudaGraphDestroy(cudaGraph_t graph) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphDestroy(graph) + return _static_cudaGraphDestroy(graph) + + +cdef cudaError_t _cudaGraphDebugDotPrint(cudaGraph_t graph, const char* path, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphDebugDotPrint(graph, path, flags) + return _static_cudaGraphDebugDotPrint(graph, path, flags) + + +cdef cudaError_t _cudaUserObjectCreate(cudaUserObject_t* object_out, void* ptr, cudaHostFn_t destroy, unsigned int initialRefcount, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaUserObjectCreate(object_out, ptr, destroy, initialRefcount, flags) + return _static_cudaUserObjectCreate(object_out, ptr, destroy, initialRefcount, flags) + + +cdef cudaError_t _cudaUserObjectRetain(cudaUserObject_t object, unsigned int count) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaUserObjectRetain(object, count) + return _static_cudaUserObjectRetain(object, count) + + +cdef cudaError_t _cudaUserObjectRelease(cudaUserObject_t object, unsigned int count) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaUserObjectRelease(object, count) + return _static_cudaUserObjectRelease(object, count) + + +cdef cudaError_t _cudaGraphRetainUserObject(cudaGraph_t graph, cudaUserObject_t object, unsigned int count, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphRetainUserObject(graph, object, count, flags) + return _static_cudaGraphRetainUserObject(graph, object, count, flags) + + +cdef cudaError_t _cudaGraphReleaseUserObject(cudaGraph_t graph, cudaUserObject_t object, unsigned int count) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphReleaseUserObject(graph, object, count) + return _static_cudaGraphReleaseUserObject(graph, object, count) + + +cdef cudaError_t _cudaGraphAddNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphAddNode(pGraphNode, graph, pDependencies, dependencyData, numDependencies, nodeParams) + return _static_cudaGraphAddNode(pGraphNode, graph, pDependencies, dependencyData, numDependencies, nodeParams) + + +cdef cudaError_t _cudaGraphNodeSetParams(cudaGraphNode_t node, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphNodeSetParams(node, nodeParams) + return _static_cudaGraphNodeSetParams(node, nodeParams) + + +cdef cudaError_t _cudaGraphExecNodeSetParams(cudaGraphExec_t graphExec, cudaGraphNode_t node, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphExecNodeSetParams(graphExec, node, nodeParams) + return _static_cudaGraphExecNodeSetParams(graphExec, node, nodeParams) + + +cdef cudaError_t _cudaGraphConditionalHandleCreate(cudaGraphConditionalHandle* pHandle_out, cudaGraph_t graph, unsigned int defaultLaunchValue, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphConditionalHandleCreate(pHandle_out, graph, defaultLaunchValue, flags) + return _static_cudaGraphConditionalHandleCreate(pHandle_out, graph, defaultLaunchValue, flags) + + +cdef cudaError_t _cudaGetDriverEntryPoint(const char* symbol, void** funcPtr, unsigned long long flags, cudaDriverEntryPointQueryResult* driverStatus) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGetDriverEntryPoint(symbol, funcPtr, flags, driverStatus) + return _static_cudaGetDriverEntryPoint(symbol, funcPtr, flags, driverStatus) + + +cdef cudaError_t _cudaGetDriverEntryPointByVersion(const char* symbol, void** funcPtr, unsigned int cudaVersion, unsigned long long flags, cudaDriverEntryPointQueryResult* driverStatus) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGetDriverEntryPointByVersion(symbol, funcPtr, cudaVersion, flags, driverStatus) + return _static_cudaGetDriverEntryPointByVersion(symbol, funcPtr, cudaVersion, flags, driverStatus) + + +cdef cudaError_t _cudaLibraryLoadData(cudaLibrary_t* library, const void* code, cudaJitOption* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, cudaLibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaLibraryLoadData(library, code, jitOptions, jitOptionsValues, numJitOptions, libraryOptions, libraryOptionValues, numLibraryOptions) + return _static_cudaLibraryLoadData(library, code, jitOptions, jitOptionsValues, numJitOptions, libraryOptions, libraryOptionValues, numLibraryOptions) + + +cdef cudaError_t _cudaLibraryLoadFromFile(cudaLibrary_t* library, const char* fileName, cudaJitOption* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, cudaLibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaLibraryLoadFromFile(library, fileName, jitOptions, jitOptionsValues, numJitOptions, libraryOptions, libraryOptionValues, numLibraryOptions) + return _static_cudaLibraryLoadFromFile(library, fileName, jitOptions, jitOptionsValues, numJitOptions, libraryOptions, libraryOptionValues, numLibraryOptions) + + +cdef cudaError_t _cudaLibraryUnload(cudaLibrary_t library) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaLibraryUnload(library) + return _static_cudaLibraryUnload(library) + + +cdef cudaError_t _cudaLibraryGetKernel(cudaKernel_t* pKernel, cudaLibrary_t library, const char* name) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaLibraryGetKernel(pKernel, library, name) + return _static_cudaLibraryGetKernel(pKernel, library, name) + + +cdef cudaError_t _cudaLibraryGetGlobal(void** dptr, size_t* bytes, cudaLibrary_t library, const char* name) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaLibraryGetGlobal(dptr, bytes, library, name) + return _static_cudaLibraryGetGlobal(dptr, bytes, library, name) + + +cdef cudaError_t _cudaLibraryGetManaged(void** dptr, size_t* bytes, cudaLibrary_t library, const char* name) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaLibraryGetManaged(dptr, bytes, library, name) + return _static_cudaLibraryGetManaged(dptr, bytes, library, name) + + +cdef cudaError_t _cudaLibraryGetUnifiedFunction(void** fptr, cudaLibrary_t library, const char* symbol) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaLibraryGetUnifiedFunction(fptr, library, symbol) + return _static_cudaLibraryGetUnifiedFunction(fptr, library, symbol) + + +cdef cudaError_t _cudaLibraryGetKernelCount(unsigned int* count, cudaLibrary_t lib) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaLibraryGetKernelCount(count, lib) + return _static_cudaLibraryGetKernelCount(count, lib) + + +cdef cudaError_t _cudaLibraryEnumerateKernels(cudaKernel_t* kernels, unsigned int numKernels, cudaLibrary_t lib) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaLibraryEnumerateKernels(kernels, numKernels, lib) + return _static_cudaLibraryEnumerateKernels(kernels, numKernels, lib) + + +cdef cudaError_t _cudaKernelSetAttributeForDevice(cudaKernel_t kernel, cudaFuncAttribute attr, int value, int device) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaKernelSetAttributeForDevice(kernel, attr, value, device) + return _static_cudaKernelSetAttributeForDevice(kernel, attr, value, device) + + +cdef cudaError_t _cudaGetExportTable(const void** ppExportTable, const cudaUUID_t* pExportTableId) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGetExportTable(ppExportTable, pExportTableId) + return _static_cudaGetExportTable(ppExportTable, pExportTableId) + + +cdef cudaError_t _cudaGetKernel(cudaKernel_t* kernelPtr, const void* entryFuncAddr) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGetKernel(kernelPtr, entryFuncAddr) + return _static_cudaGetKernel(kernelPtr, entryFuncAddr) + + +cdef cudaError_t _cudaProfilerStart() except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaProfilerStart() + return _static_cudaProfilerStart() + + +cdef cudaError_t _cudaProfilerStop() except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaProfilerStop() + return _static_cudaProfilerStop() + + +cdef cudaError_t _cudaGetDeviceProperties(cudaDeviceProp* prop, int device) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGetDeviceProperties(prop, device) + return _static_cudaGetDeviceProperties(prop, device) + + +cdef cudaError_t _cudaDeviceGetHostAtomicCapabilities(unsigned int* capabilities, const cudaAtomicOperation* operations, unsigned int count, int device) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceGetHostAtomicCapabilities(capabilities, operations, count, device) + return _static_cudaDeviceGetHostAtomicCapabilities(capabilities, operations, count, device) + + +cdef cudaError_t _cudaDeviceGetP2PAtomicCapabilities(unsigned int* capabilities, const cudaAtomicOperation* operations, unsigned int count, int srcDevice, int dstDevice) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceGetP2PAtomicCapabilities(capabilities, operations, count, srcDevice, dstDevice) + return _static_cudaDeviceGetP2PAtomicCapabilities(capabilities, operations, count, srcDevice, dstDevice) + + +cdef cudaError_t _cudaStreamGetCaptureInfo(cudaStream_t stream, cudaStreamCaptureStatus* captureStatus_out, unsigned long long* id_out, cudaGraph_t* graph_out, const cudaGraphNode_t** dependencies_out, const cudaGraphEdgeData** edgeData_out, size_t* numDependencies_out) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamGetCaptureInfo(stream, captureStatus_out, id_out, graph_out, dependencies_out, edgeData_out, numDependencies_out) + return _static_cudaStreamGetCaptureInfo(stream, captureStatus_out, id_out, graph_out, dependencies_out, edgeData_out, numDependencies_out) + + +cdef cudaError_t _cudaSignalExternalSemaphoresAsync(const cudaExternalSemaphore_t* extSemArray, const cudaExternalSemaphoreSignalParams* paramsArray, unsigned int numExtSems, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaSignalExternalSemaphoresAsync(extSemArray, paramsArray, numExtSems, stream) + return _static_cudaSignalExternalSemaphoresAsync(extSemArray, paramsArray, numExtSems, stream) + + +cdef cudaError_t _cudaWaitExternalSemaphoresAsync(const cudaExternalSemaphore_t* extSemArray, const cudaExternalSemaphoreWaitParams* paramsArray, unsigned int numExtSems, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaWaitExternalSemaphoresAsync(extSemArray, paramsArray, numExtSems, stream) + return _static_cudaWaitExternalSemaphoresAsync(extSemArray, paramsArray, numExtSems, stream) + + +cdef cudaError_t _cudaMemPrefetchBatchAsync(void** dptrs, size_t* sizes, size_t count, cudaMemLocation* prefetchLocs, size_t* prefetchLocIdxs, size_t numPrefetchLocs, unsigned long long flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemPrefetchBatchAsync(dptrs, sizes, count, prefetchLocs, prefetchLocIdxs, numPrefetchLocs, flags, stream) + return _static_cudaMemPrefetchBatchAsync(dptrs, sizes, count, prefetchLocs, prefetchLocIdxs, numPrefetchLocs, flags, stream) + + +cdef cudaError_t _cudaMemDiscardBatchAsync(void** dptrs, size_t* sizes, size_t count, unsigned long long flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemDiscardBatchAsync(dptrs, sizes, count, flags, stream) + return _static_cudaMemDiscardBatchAsync(dptrs, sizes, count, flags, stream) + + +cdef cudaError_t _cudaMemDiscardAndPrefetchBatchAsync(void** dptrs, size_t* sizes, size_t count, cudaMemLocation* prefetchLocs, size_t* prefetchLocIdxs, size_t numPrefetchLocs, unsigned long long flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemDiscardAndPrefetchBatchAsync(dptrs, sizes, count, prefetchLocs, prefetchLocIdxs, numPrefetchLocs, flags, stream) + return _static_cudaMemDiscardAndPrefetchBatchAsync(dptrs, sizes, count, prefetchLocs, prefetchLocIdxs, numPrefetchLocs, flags, stream) + + +cdef cudaError_t _cudaMemGetDefaultMemPool(cudaMemPool_t* memPool, cudaMemLocation* location, cudaMemAllocationType type) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemGetDefaultMemPool(memPool, location, type) + return _static_cudaMemGetDefaultMemPool(memPool, location, type) + + +cdef cudaError_t _cudaMemGetMemPool(cudaMemPool_t* memPool, cudaMemLocation* location, cudaMemAllocationType type) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemGetMemPool(memPool, location, type) + return _static_cudaMemGetMemPool(memPool, location, type) + + +cdef cudaError_t _cudaMemSetMemPool(cudaMemLocation* location, cudaMemAllocationType type, cudaMemPool_t memPool) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemSetMemPool(location, type, memPool) + return _static_cudaMemSetMemPool(location, type, memPool) + + +cdef cudaError_t _cudaLogsRegisterCallback(cudaLogsCallback_t callbackFunc, void* userData, cudaLogsCallbackHandle* callback_out) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaLogsRegisterCallback(callbackFunc, userData, callback_out) + return _static_cudaLogsRegisterCallback(callbackFunc, userData, callback_out) + + +cdef cudaError_t _cudaLogsUnregisterCallback(cudaLogsCallbackHandle callback) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaLogsUnregisterCallback(callback) + return _static_cudaLogsUnregisterCallback(callback) + + +cdef cudaError_t _cudaLogsCurrent(cudaLogIterator* iterator_out, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaLogsCurrent(iterator_out, flags) + return _static_cudaLogsCurrent(iterator_out, flags) + + +cdef cudaError_t _cudaLogsDumpToFile(cudaLogIterator* iterator, const char* pathToFile, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaLogsDumpToFile(iterator, pathToFile, flags) + return _static_cudaLogsDumpToFile(iterator, pathToFile, flags) + + +cdef cudaError_t _cudaLogsDumpToMemory(cudaLogIterator* iterator, char* buffer, size_t* size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaLogsDumpToMemory(iterator, buffer, size, flags) + return _static_cudaLogsDumpToMemory(iterator, buffer, size, flags) + + +cdef cudaError_t _cudaGraphNodeGetContainingGraph(cudaGraphNode_t hNode, cudaGraph_t* phGraph) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphNodeGetContainingGraph(hNode, phGraph) + return _static_cudaGraphNodeGetContainingGraph(hNode, phGraph) + + +cdef cudaError_t _cudaGraphNodeGetLocalId(cudaGraphNode_t hNode, unsigned int* nodeId) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphNodeGetLocalId(hNode, nodeId) + return _static_cudaGraphNodeGetLocalId(hNode, nodeId) + + +cdef cudaError_t _cudaGraphNodeGetToolsId(cudaGraphNode_t hNode, unsigned long long* toolsNodeId) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphNodeGetToolsId(hNode, toolsNodeId) + return _static_cudaGraphNodeGetToolsId(hNode, toolsNodeId) + + +cdef cudaError_t _cudaGraphGetId(cudaGraph_t hGraph, unsigned int* graphID) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphGetId(hGraph, graphID) + return _static_cudaGraphGetId(hGraph, graphID) + + +cdef cudaError_t _cudaGraphExecGetId(cudaGraphExec_t hGraphExec, unsigned int* graphID) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphExecGetId(hGraphExec, graphID) + return _static_cudaGraphExecGetId(hGraphExec, graphID) + + +cdef cudaError_t _cudaGraphConditionalHandleCreate_v2(cudaGraphConditionalHandle* pHandle_out, cudaGraph_t graph, cudaExecutionContext_t ctx, unsigned int defaultLaunchValue, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphConditionalHandleCreate_v2(pHandle_out, graph, ctx, defaultLaunchValue, flags) + return _static_cudaGraphConditionalHandleCreate_v2(pHandle_out, graph, ctx, defaultLaunchValue, flags) + + +cdef cudaError_t _cudaDeviceGetDevResource(int device, cudaDevResource* resource, cudaDevResourceType type) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceGetDevResource(device, resource, type) + return _static_cudaDeviceGetDevResource(device, resource, type) + + +cdef cudaError_t _cudaDevSmResourceSplitByCount(cudaDevResource* result, unsigned int* nbGroups, const cudaDevResource* input, cudaDevResource* remaining, unsigned int flags, unsigned int minCount) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDevSmResourceSplitByCount(result, nbGroups, input, remaining, flags, minCount) + return _static_cudaDevSmResourceSplitByCount(result, nbGroups, input, remaining, flags, minCount) + + +cdef cudaError_t _cudaDevSmResourceSplit(cudaDevResource* result, unsigned int nbGroups, const cudaDevResource* input, cudaDevResource* remainder, unsigned int flags, cudaDevSmResourceGroupParams* groupParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDevSmResourceSplit(result, nbGroups, input, remainder, flags, groupParams) + return _static_cudaDevSmResourceSplit(result, nbGroups, input, remainder, flags, groupParams) + + +cdef cudaError_t _cudaDevResourceGenerateDesc(cudaDevResourceDesc_t* phDesc, cudaDevResource* resources, unsigned int nbResources) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDevResourceGenerateDesc(phDesc, resources, nbResources) + return _static_cudaDevResourceGenerateDesc(phDesc, resources, nbResources) + + +cdef cudaError_t _cudaGreenCtxCreate(cudaExecutionContext_t* phCtx, cudaDevResourceDesc_t desc, int device, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGreenCtxCreate(phCtx, desc, device, flags) + return _static_cudaGreenCtxCreate(phCtx, desc, device, flags) + + +cdef cudaError_t _cudaExecutionCtxDestroy(cudaExecutionContext_t ctx) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaExecutionCtxDestroy(ctx) + return _static_cudaExecutionCtxDestroy(ctx) + + +cdef cudaError_t _cudaExecutionCtxGetDevResource(cudaExecutionContext_t ctx, cudaDevResource* resource, cudaDevResourceType type) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaExecutionCtxGetDevResource(ctx, resource, type) + return _static_cudaExecutionCtxGetDevResource(ctx, resource, type) + + +cdef cudaError_t _cudaExecutionCtxGetDevice(int* device, cudaExecutionContext_t ctx) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaExecutionCtxGetDevice(device, ctx) + return _static_cudaExecutionCtxGetDevice(device, ctx) + + +cdef cudaError_t _cudaExecutionCtxGetId(cudaExecutionContext_t ctx, unsigned long long* ctxId) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaExecutionCtxGetId(ctx, ctxId) + return _static_cudaExecutionCtxGetId(ctx, ctxId) + + +cdef cudaError_t _cudaExecutionCtxStreamCreate(cudaStream_t* phStream, cudaExecutionContext_t ctx, unsigned int flags, int priority) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaExecutionCtxStreamCreate(phStream, ctx, flags, priority) + return _static_cudaExecutionCtxStreamCreate(phStream, ctx, flags, priority) + + +cdef cudaError_t _cudaExecutionCtxSynchronize(cudaExecutionContext_t ctx) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaExecutionCtxSynchronize(ctx) + return _static_cudaExecutionCtxSynchronize(ctx) + + +cdef cudaError_t _cudaStreamGetDevResource(cudaStream_t hStream, cudaDevResource* resource, cudaDevResourceType type) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamGetDevResource(hStream, resource, type) + return _static_cudaStreamGetDevResource(hStream, resource, type) + + +cdef cudaError_t _cudaExecutionCtxRecordEvent(cudaExecutionContext_t ctx, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaExecutionCtxRecordEvent(ctx, event) + return _static_cudaExecutionCtxRecordEvent(ctx, event) + + +cdef cudaError_t _cudaExecutionCtxWaitEvent(cudaExecutionContext_t ctx, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaExecutionCtxWaitEvent(ctx, event) + return _static_cudaExecutionCtxWaitEvent(ctx, event) + + +cdef cudaError_t _cudaDeviceGetExecutionCtx(cudaExecutionContext_t* ctx, int device) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceGetExecutionCtx(ctx, device) + return _static_cudaDeviceGetExecutionCtx(ctx, device) + + +cdef cudaError_t _cudaFuncGetParamCount(const void* func, size_t* paramCount) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaFuncGetParamCount(func, paramCount) + return _static_cudaFuncGetParamCount(func, paramCount) + + +cdef cudaError_t _cudaLaunchHostFunc_v2(cudaStream_t stream, cudaHostFn_t fn, void* userData, unsigned int syncMode) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaLaunchHostFunc_v2(stream, fn, userData, syncMode) + return _static_cudaLaunchHostFunc_v2(stream, fn, userData, syncMode) + + +cdef cudaError_t _cudaMemcpyWithAttributesAsync(void* dst, const void* src, size_t size, cudaMemcpyAttributes* attr, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpyWithAttributesAsync(dst, src, size, attr, stream) + return _static_cudaMemcpyWithAttributesAsync(dst, src, size, attr, stream) + + +cdef cudaError_t _cudaMemcpy3DWithAttributesAsync(cudaMemcpy3DBatchOp* op, unsigned long long flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpy3DWithAttributesAsync(op, flags, stream) + return _static_cudaMemcpy3DWithAttributesAsync(op, flags, stream) + + +cdef cudaError_t _cudaGraphNodeGetParams(cudaGraphNode_t node, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphNodeGetParams(node, nodeParams) + return _static_cudaGraphNodeGetParams(node, nodeParams) + + +cdef cudaError_t _cudaStreamBeginRecaptureToGraph(cudaStream_t stream, cudaStreamCaptureMode mode, cudaGraph_t graph, cudaGraphRecaptureCallbackData* callbackData) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamBeginRecaptureToGraph(stream, mode, graph, callbackData) + return _static_cudaStreamBeginRecaptureToGraph(stream, mode, graph, callbackData) diff --git a/cuda_bindings/cuda/bindings/_internal/runtime_ptds.pxd b/cuda_bindings/cuda/bindings/_internal/runtime_ptds.pxd new file mode 100644 index 00000000000..e1685cd3680 --- /dev/null +++ b/cuda_bindings/cuda/bindings/_internal/runtime_ptds.pxd @@ -0,0 +1,334 @@ +# SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +# This code was automatically generated across versions from 12.9.0 to 13.3.0. Do not modify it directly. + +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=fa210f57cc23e0c4cdcad28a1ab8292bc74cc6b557bb3ca1700d1be8c25aa6af +from ..cyruntime cimport * + + +############################################################################### +# Wrapper functions +############################################################################### + +cdef cudaError_t _cudaDeviceReset() except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceSynchronize() except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceSetLimit(cudaLimit limit, size_t value) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceGetLimit(size_t* pValue, cudaLimit limit) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceGetTexture1DLinearMaxWidth(size_t* maxWidthInElements, const cudaChannelFormatDesc* fmtDesc, int device) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceGetCacheConfig(cudaFuncCache* pCacheConfig) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceGetStreamPriorityRange(int* leastPriority, int* greatestPriority) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceSetCacheConfig(cudaFuncCache cacheConfig) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceGetByPCIBusId(int* device, const char* pciBusId) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceGetPCIBusId(char* pciBusId, int len, int device) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaIpcGetEventHandle(cudaIpcEventHandle_t* handle, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaIpcOpenEventHandle(cudaEvent_t* event, cudaIpcEventHandle_t handle) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaIpcGetMemHandle(cudaIpcMemHandle_t* handle, void* devPtr) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaIpcOpenMemHandle(void** devPtr, cudaIpcMemHandle_t handle, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaIpcCloseMemHandle(void* devPtr) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceFlushGPUDirectRDMAWrites(cudaFlushGPUDirectRDMAWritesTarget target, cudaFlushGPUDirectRDMAWritesScope scope) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceRegisterAsyncNotification(int device, cudaAsyncCallback callbackFunc, void* userData, cudaAsyncCallbackHandle_t* callback) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceUnregisterAsyncNotification(int device, cudaAsyncCallbackHandle_t callback) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceGetSharedMemConfig(cudaSharedMemConfig* pConfig) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceSetSharedMemConfig(cudaSharedMemConfig config) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGetLastError() except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaPeekAtLastError() except ?cudaErrorCallRequiresNewerDriver nogil +cdef const char* _cudaGetErrorName(cudaError_t error) except?NULL nogil +cdef const char* _cudaGetErrorString(cudaError_t error) except?NULL nogil +cdef cudaError_t _cudaGetDeviceCount(int* count) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceGetAttribute(int* value, cudaDeviceAttr attr, int device) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceGetDefaultMemPool(cudaMemPool_t* memPool, int device) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceSetMemPool(int device, cudaMemPool_t memPool) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceGetMemPool(cudaMemPool_t* memPool, int device) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceGetNvSciSyncAttributes(void* nvSciSyncAttrList, int device, int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceGetP2PAttribute(int* value, cudaDeviceP2PAttr attr, int srcDevice, int dstDevice) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaChooseDevice(int* device, const cudaDeviceProp* prop) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaInitDevice(int device, unsigned int deviceFlags, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaSetDevice(int device) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGetDevice(int* device) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaSetDeviceFlags(unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGetDeviceFlags(unsigned int* flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaStreamCreate(cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaStreamCreateWithFlags(cudaStream_t* pStream, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaStreamCreateWithPriority(cudaStream_t* pStream, unsigned int flags, int priority) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaStreamGetPriority(cudaStream_t hStream, int* priority) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaStreamGetFlags(cudaStream_t hStream, unsigned int* flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaStreamGetId(cudaStream_t hStream, unsigned long long* streamId) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaStreamGetDevice(cudaStream_t hStream, int* device) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaCtxResetPersistingL2Cache() except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaStreamCopyAttributes(cudaStream_t dst, cudaStream_t src) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaStreamGetAttribute(cudaStream_t hStream, cudaStreamAttrID attr, cudaStreamAttrValue* value_out) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaStreamSetAttribute(cudaStream_t hStream, cudaStreamAttrID attr, const cudaStreamAttrValue* value) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaStreamDestroy(cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaStreamWaitEvent(cudaStream_t stream, cudaEvent_t event, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaStreamAddCallback(cudaStream_t stream, cudaStreamCallback_t callback, void* userData, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaStreamSynchronize(cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaStreamQuery(cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaStreamAttachMemAsync(cudaStream_t stream, void* devPtr, size_t length, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaStreamBeginCapture(cudaStream_t stream, cudaStreamCaptureMode mode) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaStreamBeginCaptureToGraph(cudaStream_t stream, cudaGraph_t graph, const cudaGraphNode_t* dependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, cudaStreamCaptureMode mode) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaThreadExchangeStreamCaptureMode(cudaStreamCaptureMode* mode) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaStreamEndCapture(cudaStream_t stream, cudaGraph_t* pGraph) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaStreamIsCapturing(cudaStream_t stream, cudaStreamCaptureStatus* pCaptureStatus) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaStreamUpdateCaptureDependencies(cudaStream_t stream, cudaGraphNode_t* dependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaEventCreate(cudaEvent_t* event) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaEventCreateWithFlags(cudaEvent_t* event, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaEventRecord(cudaEvent_t event, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaEventRecordWithFlags(cudaEvent_t event, cudaStream_t stream, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaEventQuery(cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaEventSynchronize(cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaEventDestroy(cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaEventElapsedTime(float* ms, cudaEvent_t start, cudaEvent_t end) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaImportExternalMemory(cudaExternalMemory_t* extMem_out, const cudaExternalMemoryHandleDesc* memHandleDesc) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaExternalMemoryGetMappedBuffer(void** devPtr, cudaExternalMemory_t extMem, const cudaExternalMemoryBufferDesc* bufferDesc) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaExternalMemoryGetMappedMipmappedArray(cudaMipmappedArray_t* mipmap, cudaExternalMemory_t extMem, const cudaExternalMemoryMipmappedArrayDesc* mipmapDesc) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDestroyExternalMemory(cudaExternalMemory_t extMem) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaImportExternalSemaphore(cudaExternalSemaphore_t* extSem_out, const cudaExternalSemaphoreHandleDesc* semHandleDesc) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDestroyExternalSemaphore(cudaExternalSemaphore_t extSem) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaFuncSetCacheConfig(const void* func, cudaFuncCache cacheConfig) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaFuncGetAttributes(cudaFuncAttributes* attr, const void* func) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaFuncSetAttribute(const void* func, cudaFuncAttribute attr, int value) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaFuncGetName(const char** name, const void* func) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaFuncGetParamInfo(const void* func, size_t paramIndex, size_t* paramOffset, size_t* paramSize) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaLaunchHostFunc(cudaStream_t stream, cudaHostFn_t fn, void* userData) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaFuncSetSharedMemConfig(const void* func, cudaSharedMemConfig config) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaOccupancyMaxActiveBlocksPerMultiprocessor(int* numBlocks, const void* func, int blockSize, size_t dynamicSMemSize) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaOccupancyAvailableDynamicSMemPerBlock(size_t* dynamicSmemSize, const void* func, int numBlocks, int blockSize) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(int* numBlocks, const void* func, int blockSize, size_t dynamicSMemSize, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMallocManaged(void** devPtr, size_t size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMalloc(void** devPtr, size_t size) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMallocHost(void** ptr, size_t size) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMallocPitch(void** devPtr, size_t* pitch, size_t width, size_t height) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMallocArray(cudaArray_t* array, const cudaChannelFormatDesc* desc, size_t width, size_t height, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaFree(void* devPtr) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaFreeHost(void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaFreeArray(cudaArray_t array) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaFreeMipmappedArray(cudaMipmappedArray_t mipmappedArray) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaHostAlloc(void** pHost, size_t size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaHostRegister(void* ptr, size_t size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaHostUnregister(void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaHostGetDevicePointer(void** pDevice, void* pHost, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaHostGetFlags(unsigned int* pFlags, void* pHost) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMalloc3D(cudaPitchedPtr* pitchedDevPtr, cudaExtent extent) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMalloc3DArray(cudaArray_t* array, const cudaChannelFormatDesc* desc, cudaExtent extent, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMallocMipmappedArray(cudaMipmappedArray_t* mipmappedArray, const cudaChannelFormatDesc* desc, cudaExtent extent, unsigned int numLevels, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGetMipmappedArrayLevel(cudaArray_t* levelArray, cudaMipmappedArray_const_t mipmappedArray, unsigned int level) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemcpy3D(const cudaMemcpy3DParms* p) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemcpy3DPeer(const cudaMemcpy3DPeerParms* p) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemcpy3DAsync(const cudaMemcpy3DParms* p, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemcpy3DPeerAsync(const cudaMemcpy3DPeerParms* p, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemGetInfo(size_t* free, size_t* total) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaArrayGetInfo(cudaChannelFormatDesc* desc, cudaExtent* extent, unsigned int* flags, cudaArray_t array) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaArrayGetPlane(cudaArray_t* pPlaneArray, cudaArray_t hArray, unsigned int planeIdx) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaArrayGetMemoryRequirements(cudaArrayMemoryRequirements* memoryRequirements, cudaArray_t array, int device) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMipmappedArrayGetMemoryRequirements(cudaArrayMemoryRequirements* memoryRequirements, cudaMipmappedArray_t mipmap, int device) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaArrayGetSparseProperties(cudaArraySparseProperties* sparseProperties, cudaArray_t array) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMipmappedArrayGetSparseProperties(cudaArraySparseProperties* sparseProperties, cudaMipmappedArray_t mipmap) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemcpy(void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemcpyPeer(void* dst, int dstDevice, const void* src, int srcDevice, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemcpy2D(void* dst, size_t dpitch, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemcpy2DToArray(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemcpy2DFromArray(void* dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemcpy2DArrayToArray(cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemcpyAsync(void* dst, const void* src, size_t count, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemcpyPeerAsync(void* dst, int dstDevice, const void* src, int srcDevice, size_t count, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemcpyBatchAsync(const void** dsts, const void** srcs, const size_t* sizes, size_t count, cudaMemcpyAttributes* attrs, size_t* attrsIdxs, size_t numAttrs, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemcpy3DBatchAsync(size_t numOps, cudaMemcpy3DBatchOp* opList, unsigned long long flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemcpy2DAsync(void* dst, size_t dpitch, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemcpy2DToArrayAsync(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemcpy2DFromArrayAsync(void* dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemset(void* devPtr, int value, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemset2D(void* devPtr, size_t pitch, int value, size_t width, size_t height) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemset3D(cudaPitchedPtr pitchedDevPtr, int value, cudaExtent extent) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemsetAsync(void* devPtr, int value, size_t count, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemset2DAsync(void* devPtr, size_t pitch, int value, size_t width, size_t height, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemset3DAsync(cudaPitchedPtr pitchedDevPtr, int value, cudaExtent extent, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemPrefetchAsync(const void* devPtr, size_t count, cudaMemLocation location, unsigned int flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemAdvise(const void* devPtr, size_t count, cudaMemoryAdvise advice, cudaMemLocation location) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemRangeGetAttribute(void* data, size_t dataSize, cudaMemRangeAttribute attribute, const void* devPtr, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemRangeGetAttributes(void** data, size_t* dataSizes, cudaMemRangeAttribute* attributes, size_t numAttributes, const void* devPtr, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemcpyToArray(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemcpyFromArray(void* dst, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemcpyArrayToArray(cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemcpyToArrayAsync(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t count, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemcpyFromArrayAsync(void* dst, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMallocAsync(void** devPtr, size_t size, cudaStream_t hStream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaFreeAsync(void* devPtr, cudaStream_t hStream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemPoolTrimTo(cudaMemPool_t memPool, size_t minBytesToKeep) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemPoolSetAttribute(cudaMemPool_t memPool, cudaMemPoolAttr attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemPoolGetAttribute(cudaMemPool_t memPool, cudaMemPoolAttr attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemPoolSetAccess(cudaMemPool_t memPool, const cudaMemAccessDesc* descList, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemPoolGetAccess(cudaMemAccessFlags* flags, cudaMemPool_t memPool, cudaMemLocation* location) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemPoolCreate(cudaMemPool_t* memPool, const cudaMemPoolProps* poolProps) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemPoolDestroy(cudaMemPool_t memPool) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMallocFromPoolAsync(void** ptr, size_t size, cudaMemPool_t memPool, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemPoolExportToShareableHandle(void* shareableHandle, cudaMemPool_t memPool, cudaMemAllocationHandleType handleType, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemPoolImportFromShareableHandle(cudaMemPool_t* memPool, void* shareableHandle, cudaMemAllocationHandleType handleType, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemPoolExportPointer(cudaMemPoolPtrExportData* exportData, void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemPoolImportPointer(void** ptr, cudaMemPool_t memPool, cudaMemPoolPtrExportData* exportData) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaPointerGetAttributes(cudaPointerAttributes* attributes, const void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceCanAccessPeer(int* canAccessPeer, int device, int peerDevice) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceEnablePeerAccess(int peerDevice, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceDisablePeerAccess(int peerDevice) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphicsUnregisterResource(cudaGraphicsResource_t resource) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphicsResourceSetMapFlags(cudaGraphicsResource_t resource, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphicsMapResources(int count, cudaGraphicsResource_t* resources, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphicsUnmapResources(int count, cudaGraphicsResource_t* resources, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphicsResourceGetMappedPointer(void** devPtr, size_t* size, cudaGraphicsResource_t resource) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphicsSubResourceGetMappedArray(cudaArray_t* array, cudaGraphicsResource_t resource, unsigned int arrayIndex, unsigned int mipLevel) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphicsResourceGetMappedMipmappedArray(cudaMipmappedArray_t* mipmappedArray, cudaGraphicsResource_t resource) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGetChannelDesc(cudaChannelFormatDesc* desc, cudaArray_const_t array) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaChannelFormatDesc _cudaCreateChannelDesc(int x, int y, int z, int w, cudaChannelFormatKind f) except* nogil +cdef cudaError_t _cudaCreateTextureObject(cudaTextureObject_t* pTexObject, const cudaResourceDesc* pResDesc, const cudaTextureDesc* pTexDesc, const cudaResourceViewDesc* pResViewDesc) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDestroyTextureObject(cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGetTextureObjectResourceDesc(cudaResourceDesc* pResDesc, cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGetTextureObjectTextureDesc(cudaTextureDesc* pTexDesc, cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGetTextureObjectResourceViewDesc(cudaResourceViewDesc* pResViewDesc, cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaCreateSurfaceObject(cudaSurfaceObject_t* pSurfObject, const cudaResourceDesc* pResDesc) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDestroySurfaceObject(cudaSurfaceObject_t surfObject) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGetSurfaceObjectResourceDesc(cudaResourceDesc* pResDesc, cudaSurfaceObject_t surfObject) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDriverGetVersion(int* driverVersion) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaRuntimeGetVersion(int* runtimeVersion) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphCreate(cudaGraph_t* pGraph, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphAddKernelNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphKernelNodeGetParams(cudaGraphNode_t node, cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphKernelNodeSetParams(cudaGraphNode_t node, const cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphKernelNodeCopyAttributes(cudaGraphNode_t hDst, cudaGraphNode_t hSrc) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphKernelNodeGetAttribute(cudaGraphNode_t hNode, cudaKernelNodeAttrID attr, cudaKernelNodeAttrValue* value_out) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphKernelNodeSetAttribute(cudaGraphNode_t hNode, cudaKernelNodeAttrID attr, const cudaKernelNodeAttrValue* value) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphAddMemcpyNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaMemcpy3DParms* pCopyParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphAddMemcpyNode1D(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphMemcpyNodeGetParams(cudaGraphNode_t node, cudaMemcpy3DParms* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphMemcpyNodeSetParams(cudaGraphNode_t node, const cudaMemcpy3DParms* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphMemcpyNodeSetParams1D(cudaGraphNode_t node, void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphAddMemsetNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaMemsetParams* pMemsetParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphMemsetNodeGetParams(cudaGraphNode_t node, cudaMemsetParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphMemsetNodeSetParams(cudaGraphNode_t node, const cudaMemsetParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphAddHostNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphHostNodeGetParams(cudaGraphNode_t node, cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphHostNodeSetParams(cudaGraphNode_t node, const cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphAddChildGraphNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaGraph_t childGraph) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphChildGraphNodeGetGraph(cudaGraphNode_t node, cudaGraph_t* pGraph) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphAddEmptyNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphAddEventRecordNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphEventRecordNodeGetEvent(cudaGraphNode_t node, cudaEvent_t* event_out) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphEventRecordNodeSetEvent(cudaGraphNode_t node, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphAddEventWaitNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphEventWaitNodeGetEvent(cudaGraphNode_t node, cudaEvent_t* event_out) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphEventWaitNodeSetEvent(cudaGraphNode_t node, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphAddExternalSemaphoresSignalNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphExternalSemaphoresSignalNodeGetParams(cudaGraphNode_t hNode, cudaExternalSemaphoreSignalNodeParams* params_out) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphExternalSemaphoresSignalNodeSetParams(cudaGraphNode_t hNode, const cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphAddExternalSemaphoresWaitNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphExternalSemaphoresWaitNodeGetParams(cudaGraphNode_t hNode, cudaExternalSemaphoreWaitNodeParams* params_out) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphExternalSemaphoresWaitNodeSetParams(cudaGraphNode_t hNode, const cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphAddMemAllocNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaMemAllocNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphMemAllocNodeGetParams(cudaGraphNode_t node, cudaMemAllocNodeParams* params_out) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphAddMemFreeNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, void* dptr) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphMemFreeNodeGetParams(cudaGraphNode_t node, void* dptr_out) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceGraphMemTrim(int device) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceGetGraphMemAttribute(int device, cudaGraphMemAttributeType attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceSetGraphMemAttribute(int device, cudaGraphMemAttributeType attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphClone(cudaGraph_t* pGraphClone, cudaGraph_t originalGraph) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphNodeFindInClone(cudaGraphNode_t* pNode, cudaGraphNode_t originalNode, cudaGraph_t clonedGraph) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphNodeGetType(cudaGraphNode_t node, cudaGraphNodeType* pType) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphGetNodes(cudaGraph_t graph, cudaGraphNode_t* nodes, size_t* numNodes) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphGetRootNodes(cudaGraph_t graph, cudaGraphNode_t* pRootNodes, size_t* pNumRootNodes) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphGetEdges(cudaGraph_t graph, cudaGraphNode_t* from_, cudaGraphNode_t* to, cudaGraphEdgeData* edgeData, size_t* numEdges) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphNodeGetDependencies(cudaGraphNode_t node, cudaGraphNode_t* pDependencies, cudaGraphEdgeData* edgeData, size_t* pNumDependencies) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphNodeGetDependentNodes(cudaGraphNode_t node, cudaGraphNode_t* pDependentNodes, cudaGraphEdgeData* edgeData, size_t* pNumDependentNodes) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphAddDependencies(cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, const cudaGraphEdgeData* edgeData, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphRemoveDependencies(cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, const cudaGraphEdgeData* edgeData, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphDestroyNode(cudaGraphNode_t node) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphInstantiate(cudaGraphExec_t* pGraphExec, cudaGraph_t graph, unsigned long long flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphInstantiateWithFlags(cudaGraphExec_t* pGraphExec, cudaGraph_t graph, unsigned long long flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphInstantiateWithParams(cudaGraphExec_t* pGraphExec, cudaGraph_t graph, cudaGraphInstantiateParams* instantiateParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphExecGetFlags(cudaGraphExec_t graphExec, unsigned long long* flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphExecKernelNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphExecMemcpyNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaMemcpy3DParms* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphExecMemcpyNodeSetParams1D(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphExecMemsetNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaMemsetParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphExecHostNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphExecChildGraphNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, cudaGraph_t childGraph) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphExecEventRecordNodeSetEvent(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphExecEventWaitNodeSetEvent(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphExecExternalSemaphoresSignalNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, const cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphExecExternalSemaphoresWaitNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, const cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphNodeSetEnabled(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, unsigned int isEnabled) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphNodeGetEnabled(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, unsigned int* isEnabled) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphExecUpdate(cudaGraphExec_t hGraphExec, cudaGraph_t hGraph, cudaGraphExecUpdateResultInfo* resultInfo) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphUpload(cudaGraphExec_t graphExec, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphLaunch(cudaGraphExec_t graphExec, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphExecDestroy(cudaGraphExec_t graphExec) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphDestroy(cudaGraph_t graph) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphDebugDotPrint(cudaGraph_t graph, const char* path, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaUserObjectCreate(cudaUserObject_t* object_out, void* ptr, cudaHostFn_t destroy, unsigned int initialRefcount, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaUserObjectRetain(cudaUserObject_t object, unsigned int count) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaUserObjectRelease(cudaUserObject_t object, unsigned int count) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphRetainUserObject(cudaGraph_t graph, cudaUserObject_t object, unsigned int count, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphReleaseUserObject(cudaGraph_t graph, cudaUserObject_t object, unsigned int count) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphAddNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphNodeSetParams(cudaGraphNode_t node, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphExecNodeSetParams(cudaGraphExec_t graphExec, cudaGraphNode_t node, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphConditionalHandleCreate(cudaGraphConditionalHandle* pHandle_out, cudaGraph_t graph, unsigned int defaultLaunchValue, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGetDriverEntryPoint(const char* symbol, void** funcPtr, unsigned long long flags, cudaDriverEntryPointQueryResult* driverStatus) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGetDriverEntryPointByVersion(const char* symbol, void** funcPtr, unsigned int cudaVersion, unsigned long long flags, cudaDriverEntryPointQueryResult* driverStatus) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaLibraryLoadData(cudaLibrary_t* library, const void* code, cudaJitOption* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, cudaLibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaLibraryLoadFromFile(cudaLibrary_t* library, const char* fileName, cudaJitOption* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, cudaLibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaLibraryUnload(cudaLibrary_t library) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaLibraryGetKernel(cudaKernel_t* pKernel, cudaLibrary_t library, const char* name) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaLibraryGetGlobal(void** dptr, size_t* bytes, cudaLibrary_t library, const char* name) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaLibraryGetManaged(void** dptr, size_t* bytes, cudaLibrary_t library, const char* name) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaLibraryGetUnifiedFunction(void** fptr, cudaLibrary_t library, const char* symbol) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaLibraryGetKernelCount(unsigned int* count, cudaLibrary_t lib) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaLibraryEnumerateKernels(cudaKernel_t* kernels, unsigned int numKernels, cudaLibrary_t lib) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaKernelSetAttributeForDevice(cudaKernel_t kernel, cudaFuncAttribute attr, int value, int device) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGetExportTable(const void** ppExportTable, const cudaUUID_t* pExportTableId) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGetKernel(cudaKernel_t* kernelPtr, const void* entryFuncAddr) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaProfilerStart() except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaProfilerStop() except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGetDeviceProperties(cudaDeviceProp* prop, int device) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceGetHostAtomicCapabilities(unsigned int* capabilities, const cudaAtomicOperation* operations, unsigned int count, int device) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceGetP2PAtomicCapabilities(unsigned int* capabilities, const cudaAtomicOperation* operations, unsigned int count, int srcDevice, int dstDevice) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaStreamGetCaptureInfo(cudaStream_t stream, cudaStreamCaptureStatus* captureStatus_out, unsigned long long* id_out, cudaGraph_t* graph_out, const cudaGraphNode_t** dependencies_out, const cudaGraphEdgeData** edgeData_out, size_t* numDependencies_out) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaSignalExternalSemaphoresAsync(const cudaExternalSemaphore_t* extSemArray, const cudaExternalSemaphoreSignalParams* paramsArray, unsigned int numExtSems, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaWaitExternalSemaphoresAsync(const cudaExternalSemaphore_t* extSemArray, const cudaExternalSemaphoreWaitParams* paramsArray, unsigned int numExtSems, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemPrefetchBatchAsync(void** dptrs, size_t* sizes, size_t count, cudaMemLocation* prefetchLocs, size_t* prefetchLocIdxs, size_t numPrefetchLocs, unsigned long long flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemDiscardBatchAsync(void** dptrs, size_t* sizes, size_t count, unsigned long long flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemDiscardAndPrefetchBatchAsync(void** dptrs, size_t* sizes, size_t count, cudaMemLocation* prefetchLocs, size_t* prefetchLocIdxs, size_t numPrefetchLocs, unsigned long long flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemGetDefaultMemPool(cudaMemPool_t* memPool, cudaMemLocation* location, cudaMemAllocationType type) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemGetMemPool(cudaMemPool_t* memPool, cudaMemLocation* location, cudaMemAllocationType type) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemSetMemPool(cudaMemLocation* location, cudaMemAllocationType type, cudaMemPool_t memPool) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaLogsRegisterCallback(cudaLogsCallback_t callbackFunc, void* userData, cudaLogsCallbackHandle* callback_out) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaLogsUnregisterCallback(cudaLogsCallbackHandle callback) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaLogsCurrent(cudaLogIterator* iterator_out, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaLogsDumpToFile(cudaLogIterator* iterator, const char* pathToFile, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaLogsDumpToMemory(cudaLogIterator* iterator, char* buffer, size_t* size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphNodeGetContainingGraph(cudaGraphNode_t hNode, cudaGraph_t* phGraph) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphNodeGetLocalId(cudaGraphNode_t hNode, unsigned int* nodeId) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphNodeGetToolsId(cudaGraphNode_t hNode, unsigned long long* toolsNodeId) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphGetId(cudaGraph_t hGraph, unsigned int* graphID) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphExecGetId(cudaGraphExec_t hGraphExec, unsigned int* graphID) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphConditionalHandleCreate_v2(cudaGraphConditionalHandle* pHandle_out, cudaGraph_t graph, cudaExecutionContext_t ctx, unsigned int defaultLaunchValue, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceGetDevResource(int device, cudaDevResource* resource, cudaDevResourceType type) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDevSmResourceSplitByCount(cudaDevResource* result, unsigned int* nbGroups, const cudaDevResource* input, cudaDevResource* remaining, unsigned int flags, unsigned int minCount) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDevSmResourceSplit(cudaDevResource* result, unsigned int nbGroups, const cudaDevResource* input, cudaDevResource* remainder, unsigned int flags, cudaDevSmResourceGroupParams* groupParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDevResourceGenerateDesc(cudaDevResourceDesc_t* phDesc, cudaDevResource* resources, unsigned int nbResources) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGreenCtxCreate(cudaExecutionContext_t* phCtx, cudaDevResourceDesc_t desc, int device, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaExecutionCtxDestroy(cudaExecutionContext_t ctx) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaExecutionCtxGetDevResource(cudaExecutionContext_t ctx, cudaDevResource* resource, cudaDevResourceType type) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaExecutionCtxGetDevice(int* device, cudaExecutionContext_t ctx) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaExecutionCtxGetId(cudaExecutionContext_t ctx, unsigned long long* ctxId) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaExecutionCtxStreamCreate(cudaStream_t* phStream, cudaExecutionContext_t ctx, unsigned int flags, int priority) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaExecutionCtxSynchronize(cudaExecutionContext_t ctx) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaStreamGetDevResource(cudaStream_t hStream, cudaDevResource* resource, cudaDevResourceType type) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaExecutionCtxRecordEvent(cudaExecutionContext_t ctx, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaExecutionCtxWaitEvent(cudaExecutionContext_t ctx, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaDeviceGetExecutionCtx(cudaExecutionContext_t* ctx, int device) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaFuncGetParamCount(const void* func, size_t* paramCount) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaLaunchHostFunc_v2(cudaStream_t stream, cudaHostFn_t fn, void* userData, unsigned int syncMode) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemcpyWithAttributesAsync(void* dst, const void* src, size_t size, cudaMemcpyAttributes* attr, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaMemcpy3DWithAttributesAsync(cudaMemcpy3DBatchOp* op, unsigned long long flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphNodeGetParams(cudaGraphNode_t node, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaStreamBeginRecaptureToGraph(cudaStream_t stream, cudaStreamCaptureMode mode, cudaGraph_t graph, cudaGraphRecaptureCallbackData* callbackData) except ?cudaErrorCallRequiresNewerDriver nogil diff --git a/cuda_bindings/cuda/bindings/_internal/runtime_ptds_linux.pyx b/cuda_bindings/cuda/bindings/_internal/runtime_ptds_linux.pyx new file mode 100644 index 00000000000..0f940954d0d --- /dev/null +++ b/cuda_bindings/cuda/bindings/_internal/runtime_ptds_linux.pyx @@ -0,0 +1,2262 @@ +# SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +# This code was automatically generated across versions from 12.9.0 to 13.3.0. Do not modify it directly. + +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=33b0c77f7174d41189a91abfe73613b5ba48bd31b5da37d509da61c00b11a004 +cdef extern from "": + """ + #define CUDA_API_PER_THREAD_DEFAULT_STREAM + """ + + +############################################################################### +# C function declarations for static cudart with per-thread default stream +# (CUDA_API_PER_THREAD_DEFAULT_STREAM causes cudaXxx to resolve to the _ptsz +# per-thread-stream symbol variants) +############################################################################### + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceReset "cudaDeviceReset" () noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceSynchronize "cudaDeviceSynchronize" () noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceSetLimit "cudaDeviceSetLimit" (cudaLimit limit, size_t value) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetLimit "cudaDeviceGetLimit" (size_t* pValue, cudaLimit limit) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetTexture1DLinearMaxWidth "cudaDeviceGetTexture1DLinearMaxWidth" (size_t* maxWidthInElements, const cudaChannelFormatDesc* fmtDesc, int device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetCacheConfig "cudaDeviceGetCacheConfig" (cudaFuncCache* pCacheConfig) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetStreamPriorityRange "cudaDeviceGetStreamPriorityRange" (int* leastPriority, int* greatestPriority) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceSetCacheConfig "cudaDeviceSetCacheConfig" (cudaFuncCache cacheConfig) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetByPCIBusId "cudaDeviceGetByPCIBusId" (int* device, const char* pciBusId) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetPCIBusId "cudaDeviceGetPCIBusId" (char* pciBusId, int len, int device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaIpcGetEventHandle "cudaIpcGetEventHandle" (cudaIpcEventHandle_t* handle, cudaEvent_t event) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaIpcOpenEventHandle "cudaIpcOpenEventHandle" (cudaEvent_t* event, cudaIpcEventHandle_t handle) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaIpcGetMemHandle "cudaIpcGetMemHandle" (cudaIpcMemHandle_t* handle, void* devPtr) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaIpcOpenMemHandle "cudaIpcOpenMemHandle" (void** devPtr, cudaIpcMemHandle_t handle, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaIpcCloseMemHandle "cudaIpcCloseMemHandle" (void* devPtr) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceFlushGPUDirectRDMAWrites "cudaDeviceFlushGPUDirectRDMAWrites" (cudaFlushGPUDirectRDMAWritesTarget target, cudaFlushGPUDirectRDMAWritesScope scope) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceRegisterAsyncNotification "cudaDeviceRegisterAsyncNotification" (int device, cudaAsyncCallback callbackFunc, void* userData, cudaAsyncCallbackHandle_t* callback) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceUnregisterAsyncNotification "cudaDeviceUnregisterAsyncNotification" (int device, cudaAsyncCallbackHandle_t callback) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetSharedMemConfig "cudaDeviceGetSharedMemConfig" (cudaSharedMemConfig* pConfig) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceSetSharedMemConfig "cudaDeviceSetSharedMemConfig" (cudaSharedMemConfig config) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetLastError "cudaGetLastError" () noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaPeekAtLastError "cudaPeekAtLastError" () noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + const char* _static_cudaGetErrorName "cudaGetErrorName" (cudaError_t error) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + const char* _static_cudaGetErrorString "cudaGetErrorString" (cudaError_t error) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetDeviceCount "cudaGetDeviceCount" (int* count) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetAttribute "cudaDeviceGetAttribute" (int* value, cudaDeviceAttr attr, int device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetDefaultMemPool "cudaDeviceGetDefaultMemPool" (cudaMemPool_t* memPool, int device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceSetMemPool "cudaDeviceSetMemPool" (int device, cudaMemPool_t memPool) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetMemPool "cudaDeviceGetMemPool" (cudaMemPool_t* memPool, int device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetNvSciSyncAttributes "cudaDeviceGetNvSciSyncAttributes" (void* nvSciSyncAttrList, int device, int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetP2PAttribute "cudaDeviceGetP2PAttribute" (int* value, cudaDeviceP2PAttr attr, int srcDevice, int dstDevice) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaChooseDevice "cudaChooseDevice" (int* device, const cudaDeviceProp* prop) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaInitDevice "cudaInitDevice" (int device, unsigned int deviceFlags, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaSetDevice "cudaSetDevice" (int device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetDevice "cudaGetDevice" (int* device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaSetDeviceFlags "cudaSetDeviceFlags" (unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetDeviceFlags "cudaGetDeviceFlags" (unsigned int* flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamCreate "cudaStreamCreate" (cudaStream_t* pStream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamCreateWithFlags "cudaStreamCreateWithFlags" (cudaStream_t* pStream, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamCreateWithPriority "cudaStreamCreateWithPriority" (cudaStream_t* pStream, unsigned int flags, int priority) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamGetPriority "cudaStreamGetPriority" (cudaStream_t hStream, int* priority) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamGetFlags "cudaStreamGetFlags" (cudaStream_t hStream, unsigned int* flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamGetId "cudaStreamGetId" (cudaStream_t hStream, unsigned long long* streamId) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamGetDevice "cudaStreamGetDevice" (cudaStream_t hStream, int* device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaCtxResetPersistingL2Cache "cudaCtxResetPersistingL2Cache" () noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamCopyAttributes "cudaStreamCopyAttributes" (cudaStream_t dst, cudaStream_t src) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamGetAttribute "cudaStreamGetAttribute" (cudaStream_t hStream, cudaLaunchAttributeID attr, cudaLaunchAttributeValue* value_out) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamSetAttribute "cudaStreamSetAttribute" (cudaStream_t hStream, cudaLaunchAttributeID attr, const cudaLaunchAttributeValue* value) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamDestroy "cudaStreamDestroy" (cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamWaitEvent "cudaStreamWaitEvent" (cudaStream_t stream, cudaEvent_t event, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamAddCallback "cudaStreamAddCallback" (cudaStream_t stream, cudaStreamCallback_t callback, void* userData, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamSynchronize "cudaStreamSynchronize" (cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamQuery "cudaStreamQuery" (cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamAttachMemAsync "cudaStreamAttachMemAsync" (cudaStream_t stream, void* devPtr, size_t length, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamBeginCapture "cudaStreamBeginCapture" (cudaStream_t stream, cudaStreamCaptureMode mode) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamBeginCaptureToGraph "cudaStreamBeginCaptureToGraph" (cudaStream_t stream, cudaGraph_t graph, const cudaGraphNode_t* dependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, cudaStreamCaptureMode mode) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaThreadExchangeStreamCaptureMode "cudaThreadExchangeStreamCaptureMode" (cudaStreamCaptureMode* mode) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamEndCapture "cudaStreamEndCapture" (cudaStream_t stream, cudaGraph_t* pGraph) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamIsCapturing "cudaStreamIsCapturing" (cudaStream_t stream, cudaStreamCaptureStatus* pCaptureStatus) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamUpdateCaptureDependencies "cudaStreamUpdateCaptureDependencies" (cudaStream_t stream, cudaGraphNode_t* dependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaEventCreate "cudaEventCreate" (cudaEvent_t* event) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaEventCreateWithFlags "cudaEventCreateWithFlags" (cudaEvent_t* event, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaEventRecord "cudaEventRecord" (cudaEvent_t event, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaEventRecordWithFlags "cudaEventRecordWithFlags" (cudaEvent_t event, cudaStream_t stream, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaEventQuery "cudaEventQuery" (cudaEvent_t event) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaEventSynchronize "cudaEventSynchronize" (cudaEvent_t event) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaEventDestroy "cudaEventDestroy" (cudaEvent_t event) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaEventElapsedTime "cudaEventElapsedTime" (float* ms, cudaEvent_t start, cudaEvent_t end) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaImportExternalMemory "cudaImportExternalMemory" (cudaExternalMemory_t* extMem_out, const cudaExternalMemoryHandleDesc* memHandleDesc) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaExternalMemoryGetMappedBuffer "cudaExternalMemoryGetMappedBuffer" (void** devPtr, cudaExternalMemory_t extMem, const cudaExternalMemoryBufferDesc* bufferDesc) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaExternalMemoryGetMappedMipmappedArray "cudaExternalMemoryGetMappedMipmappedArray" (cudaMipmappedArray_t* mipmap, cudaExternalMemory_t extMem, const cudaExternalMemoryMipmappedArrayDesc* mipmapDesc) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDestroyExternalMemory "cudaDestroyExternalMemory" (cudaExternalMemory_t extMem) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaImportExternalSemaphore "cudaImportExternalSemaphore" (cudaExternalSemaphore_t* extSem_out, const cudaExternalSemaphoreHandleDesc* semHandleDesc) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDestroyExternalSemaphore "cudaDestroyExternalSemaphore" (cudaExternalSemaphore_t extSem) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaFuncSetCacheConfig "cudaFuncSetCacheConfig" (const void* func, cudaFuncCache cacheConfig) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaFuncGetAttributes "cudaFuncGetAttributes" (cudaFuncAttributes* attr, const void* func) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaFuncSetAttribute "cudaFuncSetAttribute" (const void* func, cudaFuncAttribute attr, int value) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaFuncGetName "cudaFuncGetName" (const char** name, const void* func) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaFuncGetParamInfo "cudaFuncGetParamInfo" (const void* func, size_t paramIndex, size_t* paramOffset, size_t* paramSize) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLaunchHostFunc "cudaLaunchHostFunc" (cudaStream_t stream, cudaHostFn_t fn, void* userData) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaFuncSetSharedMemConfig "cudaFuncSetSharedMemConfig" (const void* func, cudaSharedMemConfig config) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaOccupancyMaxActiveBlocksPerMultiprocessor "cudaOccupancyMaxActiveBlocksPerMultiprocessor" (int* numBlocks, const void* func, int blockSize, size_t dynamicSMemSize) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaOccupancyAvailableDynamicSMemPerBlock "cudaOccupancyAvailableDynamicSMemPerBlock" (size_t* dynamicSmemSize, const void* func, int numBlocks, int blockSize) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags "cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags" (int* numBlocks, const void* func, int blockSize, size_t dynamicSMemSize, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMallocManaged "cudaMallocManaged" (void** devPtr, size_t size, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMalloc "cudaMalloc" (void** devPtr, size_t size) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMallocHost "cudaMallocHost" (void** ptr, size_t size) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMallocPitch "cudaMallocPitch" (void** devPtr, size_t* pitch, size_t width, size_t height) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMallocArray "cudaMallocArray" (cudaArray_t* array, const cudaChannelFormatDesc* desc, size_t width, size_t height, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaFree "cudaFree" (void* devPtr) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaFreeHost "cudaFreeHost" (void* ptr) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaFreeArray "cudaFreeArray" (cudaArray_t array) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaFreeMipmappedArray "cudaFreeMipmappedArray" (cudaMipmappedArray_t mipmappedArray) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaHostAlloc "cudaHostAlloc" (void** pHost, size_t size, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaHostRegister "cudaHostRegister" (void* ptr, size_t size, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaHostUnregister "cudaHostUnregister" (void* ptr) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaHostGetDevicePointer "cudaHostGetDevicePointer" (void** pDevice, void* pHost, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaHostGetFlags "cudaHostGetFlags" (unsigned int* pFlags, void* pHost) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMalloc3D "cudaMalloc3D" (cudaPitchedPtr* pitchedDevPtr, cudaExtent extent) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMalloc3DArray "cudaMalloc3DArray" (cudaArray_t* array, const cudaChannelFormatDesc* desc, cudaExtent extent, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMallocMipmappedArray "cudaMallocMipmappedArray" (cudaMipmappedArray_t* mipmappedArray, const cudaChannelFormatDesc* desc, cudaExtent extent, unsigned int numLevels, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetMipmappedArrayLevel "cudaGetMipmappedArrayLevel" (cudaArray_t* levelArray, cudaMipmappedArray_const_t mipmappedArray, unsigned int level) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpy3D "cudaMemcpy3D" (const cudaMemcpy3DParms* p) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpy3DPeer "cudaMemcpy3DPeer" (const cudaMemcpy3DPeerParms* p) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpy3DAsync "cudaMemcpy3DAsync" (const cudaMemcpy3DParms* p, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpy3DPeerAsync "cudaMemcpy3DPeerAsync" (const cudaMemcpy3DPeerParms* p, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemGetInfo "cudaMemGetInfo" (size_t* free, size_t* total) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaArrayGetInfo "cudaArrayGetInfo" (cudaChannelFormatDesc* desc, cudaExtent* extent, unsigned int* flags, cudaArray_t array) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaArrayGetPlane "cudaArrayGetPlane" (cudaArray_t* pPlaneArray, cudaArray_t hArray, unsigned int planeIdx) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaArrayGetMemoryRequirements "cudaArrayGetMemoryRequirements" (cudaArrayMemoryRequirements* memoryRequirements, cudaArray_t array, int device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMipmappedArrayGetMemoryRequirements "cudaMipmappedArrayGetMemoryRequirements" (cudaArrayMemoryRequirements* memoryRequirements, cudaMipmappedArray_t mipmap, int device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaArrayGetSparseProperties "cudaArrayGetSparseProperties" (cudaArraySparseProperties* sparseProperties, cudaArray_t array) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMipmappedArrayGetSparseProperties "cudaMipmappedArrayGetSparseProperties" (cudaArraySparseProperties* sparseProperties, cudaMipmappedArray_t mipmap) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpy "cudaMemcpy" (void* dst, const void* src, size_t count, cudaMemcpyKind kind) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpyPeer "cudaMemcpyPeer" (void* dst, int dstDevice, const void* src, int srcDevice, size_t count) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpy2D "cudaMemcpy2D" (void* dst, size_t dpitch, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpy2DToArray "cudaMemcpy2DToArray" (cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpy2DFromArray "cudaMemcpy2DFromArray" (void* dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t width, size_t height, cudaMemcpyKind kind) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpy2DArrayToArray "cudaMemcpy2DArrayToArray" (cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t width, size_t height, cudaMemcpyKind kind) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpyAsync "cudaMemcpyAsync" (void* dst, const void* src, size_t count, cudaMemcpyKind kind, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpyPeerAsync "cudaMemcpyPeerAsync" (void* dst, int dstDevice, const void* src, int srcDevice, size_t count, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpyBatchAsync "cudaMemcpyBatchAsync" (void** dsts, const void** srcs, const size_t* sizes, size_t count, cudaMemcpyAttributes* attrs, size_t* attrsIdxs, size_t numAttrs, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpy3DBatchAsync "cudaMemcpy3DBatchAsync" (size_t numOps, cudaMemcpy3DBatchOp* opList, unsigned long long flags, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpy2DAsync "cudaMemcpy2DAsync" (void* dst, size_t dpitch, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpy2DToArrayAsync "cudaMemcpy2DToArrayAsync" (cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpy2DFromArrayAsync "cudaMemcpy2DFromArrayAsync" (void* dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemset "cudaMemset" (void* devPtr, int value, size_t count) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemset2D "cudaMemset2D" (void* devPtr, size_t pitch, int value, size_t width, size_t height) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemset3D "cudaMemset3D" (cudaPitchedPtr pitchedDevPtr, int value, cudaExtent extent) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemsetAsync "cudaMemsetAsync" (void* devPtr, int value, size_t count, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemset2DAsync "cudaMemset2DAsync" (void* devPtr, size_t pitch, int value, size_t width, size_t height, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemset3DAsync "cudaMemset3DAsync" (cudaPitchedPtr pitchedDevPtr, int value, cudaExtent extent, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemPrefetchAsync "cudaMemPrefetchAsync" (const void* devPtr, size_t count, cudaMemLocation location, unsigned int flags, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemAdvise "cudaMemAdvise" (const void* devPtr, size_t count, cudaMemoryAdvise advice, cudaMemLocation location) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemRangeGetAttribute "cudaMemRangeGetAttribute" (void* data, size_t dataSize, cudaMemRangeAttribute attribute, const void* devPtr, size_t count) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemRangeGetAttributes "cudaMemRangeGetAttributes" (void** data, size_t* dataSizes, cudaMemRangeAttribute* attributes, size_t numAttributes, const void* devPtr, size_t count) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpyToArray "cudaMemcpyToArray" (cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t count, cudaMemcpyKind kind) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpyFromArray "cudaMemcpyFromArray" (void* dst, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, cudaMemcpyKind kind) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpyArrayToArray "cudaMemcpyArrayToArray" (cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t count, cudaMemcpyKind kind) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpyToArrayAsync "cudaMemcpyToArrayAsync" (cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t count, cudaMemcpyKind kind, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpyFromArrayAsync "cudaMemcpyFromArrayAsync" (void* dst, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, cudaMemcpyKind kind, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMallocAsync "cudaMallocAsync" (void** devPtr, size_t size, cudaStream_t hStream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaFreeAsync "cudaFreeAsync" (void* devPtr, cudaStream_t hStream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemPoolTrimTo "cudaMemPoolTrimTo" (cudaMemPool_t memPool, size_t minBytesToKeep) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemPoolSetAttribute "cudaMemPoolSetAttribute" (cudaMemPool_t memPool, cudaMemPoolAttr attr, void* value) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemPoolGetAttribute "cudaMemPoolGetAttribute" (cudaMemPool_t memPool, cudaMemPoolAttr attr, void* value) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemPoolSetAccess "cudaMemPoolSetAccess" (cudaMemPool_t memPool, const cudaMemAccessDesc* descList, size_t count) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemPoolGetAccess "cudaMemPoolGetAccess" (cudaMemAccessFlags* flags, cudaMemPool_t memPool, cudaMemLocation* location) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemPoolCreate "cudaMemPoolCreate" (cudaMemPool_t* memPool, const cudaMemPoolProps* poolProps) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemPoolDestroy "cudaMemPoolDestroy" (cudaMemPool_t memPool) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMallocFromPoolAsync "cudaMallocFromPoolAsync" (void** ptr, size_t size, cudaMemPool_t memPool, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemPoolExportToShareableHandle "cudaMemPoolExportToShareableHandle" (void* shareableHandle, cudaMemPool_t memPool, cudaMemAllocationHandleType handleType, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemPoolImportFromShareableHandle "cudaMemPoolImportFromShareableHandle" (cudaMemPool_t* memPool, void* shareableHandle, cudaMemAllocationHandleType handleType, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemPoolExportPointer "cudaMemPoolExportPointer" (cudaMemPoolPtrExportData* exportData, void* ptr) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemPoolImportPointer "cudaMemPoolImportPointer" (void** ptr, cudaMemPool_t memPool, cudaMemPoolPtrExportData* exportData) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaPointerGetAttributes "cudaPointerGetAttributes" (cudaPointerAttributes* attributes, const void* ptr) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceCanAccessPeer "cudaDeviceCanAccessPeer" (int* canAccessPeer, int device, int peerDevice) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceEnablePeerAccess "cudaDeviceEnablePeerAccess" (int peerDevice, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceDisablePeerAccess "cudaDeviceDisablePeerAccess" (int peerDevice) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphicsUnregisterResource "cudaGraphicsUnregisterResource" (cudaGraphicsResource_t resource) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphicsResourceSetMapFlags "cudaGraphicsResourceSetMapFlags" (cudaGraphicsResource_t resource, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphicsMapResources "cudaGraphicsMapResources" (int count, cudaGraphicsResource_t* resources, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphicsUnmapResources "cudaGraphicsUnmapResources" (int count, cudaGraphicsResource_t* resources, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphicsResourceGetMappedPointer "cudaGraphicsResourceGetMappedPointer" (void** devPtr, size_t* size, cudaGraphicsResource_t resource) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphicsSubResourceGetMappedArray "cudaGraphicsSubResourceGetMappedArray" (cudaArray_t* array, cudaGraphicsResource_t resource, unsigned int arrayIndex, unsigned int mipLevel) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphicsResourceGetMappedMipmappedArray "cudaGraphicsResourceGetMappedMipmappedArray" (cudaMipmappedArray_t* mipmappedArray, cudaGraphicsResource_t resource) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetChannelDesc "cudaGetChannelDesc" (cudaChannelFormatDesc* desc, cudaArray_const_t array) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaChannelFormatDesc _static_cudaCreateChannelDesc "cudaCreateChannelDesc" (int x, int y, int z, int w, cudaChannelFormatKind f) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaCreateTextureObject "cudaCreateTextureObject" (cudaTextureObject_t* pTexObject, const cudaResourceDesc* pResDesc, const cudaTextureDesc* pTexDesc, const cudaResourceViewDesc* pResViewDesc) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDestroyTextureObject "cudaDestroyTextureObject" (cudaTextureObject_t texObject) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetTextureObjectResourceDesc "cudaGetTextureObjectResourceDesc" (cudaResourceDesc* pResDesc, cudaTextureObject_t texObject) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetTextureObjectTextureDesc "cudaGetTextureObjectTextureDesc" (cudaTextureDesc* pTexDesc, cudaTextureObject_t texObject) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetTextureObjectResourceViewDesc "cudaGetTextureObjectResourceViewDesc" (cudaResourceViewDesc* pResViewDesc, cudaTextureObject_t texObject) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaCreateSurfaceObject "cudaCreateSurfaceObject" (cudaSurfaceObject_t* pSurfObject, const cudaResourceDesc* pResDesc) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDestroySurfaceObject "cudaDestroySurfaceObject" (cudaSurfaceObject_t surfObject) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetSurfaceObjectResourceDesc "cudaGetSurfaceObjectResourceDesc" (cudaResourceDesc* pResDesc, cudaSurfaceObject_t surfObject) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDriverGetVersion "cudaDriverGetVersion" (int* driverVersion) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaRuntimeGetVersion "cudaRuntimeGetVersion" (int* runtimeVersion) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphCreate "cudaGraphCreate" (cudaGraph_t* pGraph, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddKernelNode "cudaGraphAddKernelNode" (cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaKernelNodeParams* pNodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphKernelNodeGetParams "cudaGraphKernelNodeGetParams" (cudaGraphNode_t node, cudaKernelNodeParams* pNodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphKernelNodeSetParams "cudaGraphKernelNodeSetParams" (cudaGraphNode_t node, const cudaKernelNodeParams* pNodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphKernelNodeCopyAttributes "cudaGraphKernelNodeCopyAttributes" (cudaGraphNode_t hDst, cudaGraphNode_t hSrc) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphKernelNodeGetAttribute "cudaGraphKernelNodeGetAttribute" (cudaGraphNode_t hNode, cudaLaunchAttributeID attr, cudaLaunchAttributeValue* value_out) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphKernelNodeSetAttribute "cudaGraphKernelNodeSetAttribute" (cudaGraphNode_t hNode, cudaLaunchAttributeID attr, const cudaLaunchAttributeValue* value) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddMemcpyNode "cudaGraphAddMemcpyNode" (cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaMemcpy3DParms* pCopyParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddMemcpyNode1D "cudaGraphAddMemcpyNode1D" (cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, void* dst, const void* src, size_t count, cudaMemcpyKind kind) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphMemcpyNodeGetParams "cudaGraphMemcpyNodeGetParams" (cudaGraphNode_t node, cudaMemcpy3DParms* pNodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphMemcpyNodeSetParams "cudaGraphMemcpyNodeSetParams" (cudaGraphNode_t node, const cudaMemcpy3DParms* pNodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphMemcpyNodeSetParams1D "cudaGraphMemcpyNodeSetParams1D" (cudaGraphNode_t node, void* dst, const void* src, size_t count, cudaMemcpyKind kind) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddMemsetNode "cudaGraphAddMemsetNode" (cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaMemsetParams* pMemsetParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphMemsetNodeGetParams "cudaGraphMemsetNodeGetParams" (cudaGraphNode_t node, cudaMemsetParams* pNodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphMemsetNodeSetParams "cudaGraphMemsetNodeSetParams" (cudaGraphNode_t node, const cudaMemsetParams* pNodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddHostNode "cudaGraphAddHostNode" (cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaHostNodeParams* pNodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphHostNodeGetParams "cudaGraphHostNodeGetParams" (cudaGraphNode_t node, cudaHostNodeParams* pNodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphHostNodeSetParams "cudaGraphHostNodeSetParams" (cudaGraphNode_t node, const cudaHostNodeParams* pNodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddChildGraphNode "cudaGraphAddChildGraphNode" (cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaGraph_t childGraph) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphChildGraphNodeGetGraph "cudaGraphChildGraphNodeGetGraph" (cudaGraphNode_t node, cudaGraph_t* pGraph) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddEmptyNode "cudaGraphAddEmptyNode" (cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddEventRecordNode "cudaGraphAddEventRecordNode" (cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaEvent_t event) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphEventRecordNodeGetEvent "cudaGraphEventRecordNodeGetEvent" (cudaGraphNode_t node, cudaEvent_t* event_out) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphEventRecordNodeSetEvent "cudaGraphEventRecordNodeSetEvent" (cudaGraphNode_t node, cudaEvent_t event) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddEventWaitNode "cudaGraphAddEventWaitNode" (cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaEvent_t event) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphEventWaitNodeGetEvent "cudaGraphEventWaitNodeGetEvent" (cudaGraphNode_t node, cudaEvent_t* event_out) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphEventWaitNodeSetEvent "cudaGraphEventWaitNodeSetEvent" (cudaGraphNode_t node, cudaEvent_t event) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddExternalSemaphoresSignalNode "cudaGraphAddExternalSemaphoresSignalNode" (cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaExternalSemaphoreSignalNodeParams* nodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExternalSemaphoresSignalNodeGetParams "cudaGraphExternalSemaphoresSignalNodeGetParams" (cudaGraphNode_t hNode, cudaExternalSemaphoreSignalNodeParams* params_out) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExternalSemaphoresSignalNodeSetParams "cudaGraphExternalSemaphoresSignalNodeSetParams" (cudaGraphNode_t hNode, const cudaExternalSemaphoreSignalNodeParams* nodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddExternalSemaphoresWaitNode "cudaGraphAddExternalSemaphoresWaitNode" (cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaExternalSemaphoreWaitNodeParams* nodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExternalSemaphoresWaitNodeGetParams "cudaGraphExternalSemaphoresWaitNodeGetParams" (cudaGraphNode_t hNode, cudaExternalSemaphoreWaitNodeParams* params_out) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExternalSemaphoresWaitNodeSetParams "cudaGraphExternalSemaphoresWaitNodeSetParams" (cudaGraphNode_t hNode, const cudaExternalSemaphoreWaitNodeParams* nodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddMemAllocNode "cudaGraphAddMemAllocNode" (cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaMemAllocNodeParams* nodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphMemAllocNodeGetParams "cudaGraphMemAllocNodeGetParams" (cudaGraphNode_t node, cudaMemAllocNodeParams* params_out) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddMemFreeNode "cudaGraphAddMemFreeNode" (cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, void* dptr) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphMemFreeNodeGetParams "cudaGraphMemFreeNodeGetParams" (cudaGraphNode_t node, void* dptr_out) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGraphMemTrim "cudaDeviceGraphMemTrim" (int device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetGraphMemAttribute "cudaDeviceGetGraphMemAttribute" (int device, cudaGraphMemAttributeType attr, void* value) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceSetGraphMemAttribute "cudaDeviceSetGraphMemAttribute" (int device, cudaGraphMemAttributeType attr, void* value) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphClone "cudaGraphClone" (cudaGraph_t* pGraphClone, cudaGraph_t originalGraph) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphNodeFindInClone "cudaGraphNodeFindInClone" (cudaGraphNode_t* pNode, cudaGraphNode_t originalNode, cudaGraph_t clonedGraph) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphNodeGetType "cudaGraphNodeGetType" (cudaGraphNode_t node, cudaGraphNodeType* pType) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphGetNodes "cudaGraphGetNodes" (cudaGraph_t graph, cudaGraphNode_t* nodes, size_t* numNodes) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphGetRootNodes "cudaGraphGetRootNodes" (cudaGraph_t graph, cudaGraphNode_t* pRootNodes, size_t* pNumRootNodes) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphGetEdges "cudaGraphGetEdges" (cudaGraph_t graph, cudaGraphNode_t* from_, cudaGraphNode_t* to, cudaGraphEdgeData* edgeData, size_t* numEdges) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphNodeGetDependencies "cudaGraphNodeGetDependencies" (cudaGraphNode_t node, cudaGraphNode_t* pDependencies, cudaGraphEdgeData* edgeData, size_t* pNumDependencies) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphNodeGetDependentNodes "cudaGraphNodeGetDependentNodes" (cudaGraphNode_t node, cudaGraphNode_t* pDependentNodes, cudaGraphEdgeData* edgeData, size_t* pNumDependentNodes) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddDependencies "cudaGraphAddDependencies" (cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, const cudaGraphEdgeData* edgeData, size_t numDependencies) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphRemoveDependencies "cudaGraphRemoveDependencies" (cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, const cudaGraphEdgeData* edgeData, size_t numDependencies) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphDestroyNode "cudaGraphDestroyNode" (cudaGraphNode_t node) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphInstantiate "cudaGraphInstantiate" (cudaGraphExec_t* pGraphExec, cudaGraph_t graph, unsigned long long flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphInstantiateWithFlags "cudaGraphInstantiateWithFlags" (cudaGraphExec_t* pGraphExec, cudaGraph_t graph, unsigned long long flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphInstantiateWithParams "cudaGraphInstantiateWithParams" (cudaGraphExec_t* pGraphExec, cudaGraph_t graph, cudaGraphInstantiateParams* instantiateParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecGetFlags "cudaGraphExecGetFlags" (cudaGraphExec_t graphExec, unsigned long long* flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecKernelNodeSetParams "cudaGraphExecKernelNodeSetParams" (cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaKernelNodeParams* pNodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecMemcpyNodeSetParams "cudaGraphExecMemcpyNodeSetParams" (cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaMemcpy3DParms* pNodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecMemcpyNodeSetParams1D "cudaGraphExecMemcpyNodeSetParams1D" (cudaGraphExec_t hGraphExec, cudaGraphNode_t node, void* dst, const void* src, size_t count, cudaMemcpyKind kind) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecMemsetNodeSetParams "cudaGraphExecMemsetNodeSetParams" (cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaMemsetParams* pNodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecHostNodeSetParams "cudaGraphExecHostNodeSetParams" (cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaHostNodeParams* pNodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecChildGraphNodeSetParams "cudaGraphExecChildGraphNodeSetParams" (cudaGraphExec_t hGraphExec, cudaGraphNode_t node, cudaGraph_t childGraph) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecEventRecordNodeSetEvent "cudaGraphExecEventRecordNodeSetEvent" (cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, cudaEvent_t event) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecEventWaitNodeSetEvent "cudaGraphExecEventWaitNodeSetEvent" (cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, cudaEvent_t event) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecExternalSemaphoresSignalNodeSetParams "cudaGraphExecExternalSemaphoresSignalNodeSetParams" (cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, const cudaExternalSemaphoreSignalNodeParams* nodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecExternalSemaphoresWaitNodeSetParams "cudaGraphExecExternalSemaphoresWaitNodeSetParams" (cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, const cudaExternalSemaphoreWaitNodeParams* nodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphNodeSetEnabled "cudaGraphNodeSetEnabled" (cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, unsigned int isEnabled) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphNodeGetEnabled "cudaGraphNodeGetEnabled" (cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, unsigned int* isEnabled) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecUpdate "cudaGraphExecUpdate" (cudaGraphExec_t hGraphExec, cudaGraph_t hGraph, cudaGraphExecUpdateResultInfo* resultInfo) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphUpload "cudaGraphUpload" (cudaGraphExec_t graphExec, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphLaunch "cudaGraphLaunch" (cudaGraphExec_t graphExec, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecDestroy "cudaGraphExecDestroy" (cudaGraphExec_t graphExec) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphDestroy "cudaGraphDestroy" (cudaGraph_t graph) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphDebugDotPrint "cudaGraphDebugDotPrint" (cudaGraph_t graph, const char* path, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaUserObjectCreate "cudaUserObjectCreate" (cudaUserObject_t* object_out, void* ptr, cudaHostFn_t destroy, unsigned int initialRefcount, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaUserObjectRetain "cudaUserObjectRetain" (cudaUserObject_t object, unsigned int count) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaUserObjectRelease "cudaUserObjectRelease" (cudaUserObject_t object, unsigned int count) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphRetainUserObject "cudaGraphRetainUserObject" (cudaGraph_t graph, cudaUserObject_t object, unsigned int count, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphReleaseUserObject "cudaGraphReleaseUserObject" (cudaGraph_t graph, cudaUserObject_t object, unsigned int count) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddNode "cudaGraphAddNode" (cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, cudaGraphNodeParams* nodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphNodeSetParams "cudaGraphNodeSetParams" (cudaGraphNode_t node, cudaGraphNodeParams* nodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecNodeSetParams "cudaGraphExecNodeSetParams" (cudaGraphExec_t graphExec, cudaGraphNode_t node, cudaGraphNodeParams* nodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphConditionalHandleCreate "cudaGraphConditionalHandleCreate" (cudaGraphConditionalHandle* pHandle_out, cudaGraph_t graph, unsigned int defaultLaunchValue, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetDriverEntryPoint "cudaGetDriverEntryPoint" (const char* symbol, void** funcPtr, unsigned long long flags, cudaDriverEntryPointQueryResult* driverStatus) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetDriverEntryPointByVersion "cudaGetDriverEntryPointByVersion" (const char* symbol, void** funcPtr, unsigned int cudaVersion, unsigned long long flags, cudaDriverEntryPointQueryResult* driverStatus) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLibraryLoadData "cudaLibraryLoadData" (cudaLibrary_t* library, const void* code, cudaJitOption* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, cudaLibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLibraryLoadFromFile "cudaLibraryLoadFromFile" (cudaLibrary_t* library, const char* fileName, cudaJitOption* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, cudaLibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLibraryUnload "cudaLibraryUnload" (cudaLibrary_t library) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLibraryGetKernel "cudaLibraryGetKernel" (cudaKernel_t* pKernel, cudaLibrary_t library, const char* name) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLibraryGetGlobal "cudaLibraryGetGlobal" (void** dptr, size_t* bytes, cudaLibrary_t library, const char* name) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLibraryGetManaged "cudaLibraryGetManaged" (void** dptr, size_t* bytes, cudaLibrary_t library, const char* name) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLibraryGetUnifiedFunction "cudaLibraryGetUnifiedFunction" (void** fptr, cudaLibrary_t library, const char* symbol) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLibraryGetKernelCount "cudaLibraryGetKernelCount" (unsigned int* count, cudaLibrary_t lib) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLibraryEnumerateKernels "cudaLibraryEnumerateKernels" (cudaKernel_t* kernels, unsigned int numKernels, cudaLibrary_t lib) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaKernelSetAttributeForDevice "cudaKernelSetAttributeForDevice" (cudaKernel_t kernel, cudaFuncAttribute attr, int value, int device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetExportTable "cudaGetExportTable" (const void** ppExportTable, const cudaUUID_t* pExportTableId) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetKernel "cudaGetKernel" (cudaKernel_t* kernelPtr, const void* entryFuncAddr) noexcept + +cdef extern from 'cuda_profiler_api.h' nogil: + cudaError_t _static_cudaProfilerStart "cudaProfilerStart" () noexcept + +cdef extern from 'cuda_profiler_api.h' nogil: + cudaError_t _static_cudaProfilerStop "cudaProfilerStop" () noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetDeviceProperties "cudaGetDeviceProperties" (cudaDeviceProp* prop, int device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetHostAtomicCapabilities "cudaDeviceGetHostAtomicCapabilities" (unsigned int* capabilities, const cudaAtomicOperation* operations, unsigned int count, int device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetP2PAtomicCapabilities "cudaDeviceGetP2PAtomicCapabilities" (unsigned int* capabilities, const cudaAtomicOperation* operations, unsigned int count, int srcDevice, int dstDevice) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamGetCaptureInfo "cudaStreamGetCaptureInfo" (cudaStream_t stream, cudaStreamCaptureStatus* captureStatus_out, unsigned long long* id_out, cudaGraph_t* graph_out, const cudaGraphNode_t** dependencies_out, const cudaGraphEdgeData** edgeData_out, size_t* numDependencies_out) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaSignalExternalSemaphoresAsync "cudaSignalExternalSemaphoresAsync" (const cudaExternalSemaphore_t* extSemArray, const cudaExternalSemaphoreSignalParams* paramsArray, unsigned int numExtSems, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaWaitExternalSemaphoresAsync "cudaWaitExternalSemaphoresAsync" (const cudaExternalSemaphore_t* extSemArray, const cudaExternalSemaphoreWaitParams* paramsArray, unsigned int numExtSems, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemPrefetchBatchAsync "cudaMemPrefetchBatchAsync" (void** dptrs, size_t* sizes, size_t count, cudaMemLocation* prefetchLocs, size_t* prefetchLocIdxs, size_t numPrefetchLocs, unsigned long long flags, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemDiscardBatchAsync "cudaMemDiscardBatchAsync" (void** dptrs, size_t* sizes, size_t count, unsigned long long flags, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemDiscardAndPrefetchBatchAsync "cudaMemDiscardAndPrefetchBatchAsync" (void** dptrs, size_t* sizes, size_t count, cudaMemLocation* prefetchLocs, size_t* prefetchLocIdxs, size_t numPrefetchLocs, unsigned long long flags, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemGetDefaultMemPool "cudaMemGetDefaultMemPool" (cudaMemPool_t* memPool, cudaMemLocation* location, cudaMemAllocationType type) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemGetMemPool "cudaMemGetMemPool" (cudaMemPool_t* memPool, cudaMemLocation* location, cudaMemAllocationType type) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemSetMemPool "cudaMemSetMemPool" (cudaMemLocation* location, cudaMemAllocationType type, cudaMemPool_t memPool) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLogsRegisterCallback "cudaLogsRegisterCallback" (cudaLogsCallback_t callbackFunc, void* userData, cudaLogsCallbackHandle* callback_out) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLogsUnregisterCallback "cudaLogsUnregisterCallback" (cudaLogsCallbackHandle callback) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLogsCurrent "cudaLogsCurrent" (cudaLogIterator* iterator_out, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLogsDumpToFile "cudaLogsDumpToFile" (cudaLogIterator* iterator, const char* pathToFile, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLogsDumpToMemory "cudaLogsDumpToMemory" (cudaLogIterator* iterator, char* buffer, size_t* size, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphNodeGetContainingGraph "cudaGraphNodeGetContainingGraph" (cudaGraphNode_t hNode, cudaGraph_t* phGraph) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphNodeGetLocalId "cudaGraphNodeGetLocalId" (cudaGraphNode_t hNode, unsigned int* nodeId) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphNodeGetToolsId "cudaGraphNodeGetToolsId" (cudaGraphNode_t hNode, unsigned long long* toolsNodeId) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphGetId "cudaGraphGetId" (cudaGraph_t hGraph, unsigned int* graphID) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecGetId "cudaGraphExecGetId" (cudaGraphExec_t hGraphExec, unsigned int* graphID) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphConditionalHandleCreate_v2 "cudaGraphConditionalHandleCreate_v2" (cudaGraphConditionalHandle* pHandle_out, cudaGraph_t graph, cudaExecutionContext_t ctx, unsigned int defaultLaunchValue, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetDevResource "cudaDeviceGetDevResource" (int device, cudaDevResource* resource, cudaDevResourceType type) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDevSmResourceSplitByCount "cudaDevSmResourceSplitByCount" (cudaDevResource* result, unsigned int* nbGroups, const cudaDevResource* input, cudaDevResource* remaining, unsigned int flags, unsigned int minCount) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDevSmResourceSplit "cudaDevSmResourceSplit" (cudaDevResource* result, unsigned int nbGroups, const cudaDevResource* input, cudaDevResource* remainder, unsigned int flags, cudaDevSmResourceGroupParams* groupParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDevResourceGenerateDesc "cudaDevResourceGenerateDesc" (cudaDevResourceDesc_t* phDesc, cudaDevResource* resources, unsigned int nbResources) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGreenCtxCreate "cudaGreenCtxCreate" (cudaExecutionContext_t* phCtx, cudaDevResourceDesc_t desc, int device, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaExecutionCtxDestroy "cudaExecutionCtxDestroy" (cudaExecutionContext_t ctx) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaExecutionCtxGetDevResource "cudaExecutionCtxGetDevResource" (cudaExecutionContext_t ctx, cudaDevResource* resource, cudaDevResourceType type) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaExecutionCtxGetDevice "cudaExecutionCtxGetDevice" (int* device, cudaExecutionContext_t ctx) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaExecutionCtxGetId "cudaExecutionCtxGetId" (cudaExecutionContext_t ctx, unsigned long long* ctxId) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaExecutionCtxStreamCreate "cudaExecutionCtxStreamCreate" (cudaStream_t* phStream, cudaExecutionContext_t ctx, unsigned int flags, int priority) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaExecutionCtxSynchronize "cudaExecutionCtxSynchronize" (cudaExecutionContext_t ctx) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamGetDevResource "cudaStreamGetDevResource" (cudaStream_t hStream, cudaDevResource* resource, cudaDevResourceType type) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaExecutionCtxRecordEvent "cudaExecutionCtxRecordEvent" (cudaExecutionContext_t ctx, cudaEvent_t event) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaExecutionCtxWaitEvent "cudaExecutionCtxWaitEvent" (cudaExecutionContext_t ctx, cudaEvent_t event) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetExecutionCtx "cudaDeviceGetExecutionCtx" (cudaExecutionContext_t* ctx, int device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaFuncGetParamCount "cudaFuncGetParamCount" (const void* func, size_t* paramCount) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLaunchHostFunc_v2 "cudaLaunchHostFunc_v2" (cudaStream_t stream, cudaHostFn_t fn, void* userData, unsigned int syncMode) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpyWithAttributesAsync "cudaMemcpyWithAttributesAsync" (void* dst, const void* src, size_t size, cudaMemcpyAttributes* attr, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpy3DWithAttributesAsync "cudaMemcpy3DWithAttributesAsync" (cudaMemcpy3DBatchOp* op, unsigned long long flags, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphNodeGetParams "cudaGraphNodeGetParams" (cudaGraphNode_t node, cudaGraphNodeParams* nodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamBeginRecaptureToGraph "cudaStreamBeginRecaptureToGraph" (cudaStream_t stream, cudaStreamCaptureMode mode, cudaGraph_t graph, cudaGraphRecaptureCallbackData* callbackData) noexcept + + +############################################################################### +# Wrapper functions +############################################################################### + +cdef cudaError_t _cudaDeviceReset() except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceReset() + + +cdef cudaError_t _cudaDeviceSynchronize() except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceSynchronize() + + +cdef cudaError_t _cudaDeviceSetLimit(cudaLimit limit, size_t value) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceSetLimit(limit, value) + + +cdef cudaError_t _cudaDeviceGetLimit(size_t* pValue, cudaLimit limit) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceGetLimit(pValue, limit) + + +cdef cudaError_t _cudaDeviceGetTexture1DLinearMaxWidth(size_t* maxWidthInElements, const cudaChannelFormatDesc* fmtDesc, int device) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceGetTexture1DLinearMaxWidth(maxWidthInElements, fmtDesc, device) + + +cdef cudaError_t _cudaDeviceGetCacheConfig(cudaFuncCache* pCacheConfig) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceGetCacheConfig(pCacheConfig) + + +cdef cudaError_t _cudaDeviceGetStreamPriorityRange(int* leastPriority, int* greatestPriority) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceGetStreamPriorityRange(leastPriority, greatestPriority) + + +cdef cudaError_t _cudaDeviceSetCacheConfig(cudaFuncCache cacheConfig) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceSetCacheConfig(cacheConfig) + + +cdef cudaError_t _cudaDeviceGetByPCIBusId(int* device, const char* pciBusId) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceGetByPCIBusId(device, pciBusId) + + +cdef cudaError_t _cudaDeviceGetPCIBusId(char* pciBusId, int len, int device) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceGetPCIBusId(pciBusId, len, device) + + +cdef cudaError_t _cudaIpcGetEventHandle(cudaIpcEventHandle_t* handle, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaIpcGetEventHandle(handle, event) + + +cdef cudaError_t _cudaIpcOpenEventHandle(cudaEvent_t* event, cudaIpcEventHandle_t handle) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaIpcOpenEventHandle(event, handle) + + +cdef cudaError_t _cudaIpcGetMemHandle(cudaIpcMemHandle_t* handle, void* devPtr) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaIpcGetMemHandle(handle, devPtr) + + +cdef cudaError_t _cudaIpcOpenMemHandle(void** devPtr, cudaIpcMemHandle_t handle, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaIpcOpenMemHandle(devPtr, handle, flags) + + +cdef cudaError_t _cudaIpcCloseMemHandle(void* devPtr) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaIpcCloseMemHandle(devPtr) + + +cdef cudaError_t _cudaDeviceFlushGPUDirectRDMAWrites(cudaFlushGPUDirectRDMAWritesTarget target, cudaFlushGPUDirectRDMAWritesScope scope) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceFlushGPUDirectRDMAWrites(target, scope) + + +cdef cudaError_t _cudaDeviceRegisterAsyncNotification(int device, cudaAsyncCallback callbackFunc, void* userData, cudaAsyncCallbackHandle_t* callback) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceRegisterAsyncNotification(device, callbackFunc, userData, callback) + + +cdef cudaError_t _cudaDeviceUnregisterAsyncNotification(int device, cudaAsyncCallbackHandle_t callback) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceUnregisterAsyncNotification(device, callback) + + +cdef cudaError_t _cudaDeviceGetSharedMemConfig(cudaSharedMemConfig* pConfig) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceGetSharedMemConfig(pConfig) + + +cdef cudaError_t _cudaDeviceSetSharedMemConfig(cudaSharedMemConfig config) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceSetSharedMemConfig(config) + + +cdef cudaError_t _cudaGetLastError() except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGetLastError() + + +cdef cudaError_t _cudaPeekAtLastError() except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaPeekAtLastError() + + +cdef const char* _cudaGetErrorName(cudaError_t error) except?NULL nogil: + return _static_cudaGetErrorName(error) + + +cdef const char* _cudaGetErrorString(cudaError_t error) except?NULL nogil: + return _static_cudaGetErrorString(error) + + +cdef cudaError_t _cudaGetDeviceCount(int* count) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGetDeviceCount(count) + + +cdef cudaError_t _cudaDeviceGetAttribute(int* value, cudaDeviceAttr attr, int device) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceGetAttribute(value, attr, device) + + +cdef cudaError_t _cudaDeviceGetDefaultMemPool(cudaMemPool_t* memPool, int device) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceGetDefaultMemPool(memPool, device) + + +cdef cudaError_t _cudaDeviceSetMemPool(int device, cudaMemPool_t memPool) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceSetMemPool(device, memPool) + + +cdef cudaError_t _cudaDeviceGetMemPool(cudaMemPool_t* memPool, int device) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceGetMemPool(memPool, device) + + +cdef cudaError_t _cudaDeviceGetNvSciSyncAttributes(void* nvSciSyncAttrList, int device, int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceGetNvSciSyncAttributes(nvSciSyncAttrList, device, flags) + + +cdef cudaError_t _cudaDeviceGetP2PAttribute(int* value, cudaDeviceP2PAttr attr, int srcDevice, int dstDevice) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceGetP2PAttribute(value, attr, srcDevice, dstDevice) + + +cdef cudaError_t _cudaChooseDevice(int* device, const cudaDeviceProp* prop) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaChooseDevice(device, prop) + + +cdef cudaError_t _cudaInitDevice(int device, unsigned int deviceFlags, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaInitDevice(device, deviceFlags, flags) + + +cdef cudaError_t _cudaSetDevice(int device) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaSetDevice(device) + + +cdef cudaError_t _cudaGetDevice(int* device) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGetDevice(device) + + +cdef cudaError_t _cudaSetDeviceFlags(unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaSetDeviceFlags(flags) + + +cdef cudaError_t _cudaGetDeviceFlags(unsigned int* flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGetDeviceFlags(flags) + + +cdef cudaError_t _cudaStreamCreate(cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaStreamCreate(pStream) + + +cdef cudaError_t _cudaStreamCreateWithFlags(cudaStream_t* pStream, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaStreamCreateWithFlags(pStream, flags) + + +cdef cudaError_t _cudaStreamCreateWithPriority(cudaStream_t* pStream, unsigned int flags, int priority) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaStreamCreateWithPriority(pStream, flags, priority) + + +cdef cudaError_t _cudaStreamGetPriority(cudaStream_t hStream, int* priority) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaStreamGetPriority(hStream, priority) + + +cdef cudaError_t _cudaStreamGetFlags(cudaStream_t hStream, unsigned int* flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaStreamGetFlags(hStream, flags) + + +cdef cudaError_t _cudaStreamGetId(cudaStream_t hStream, unsigned long long* streamId) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaStreamGetId(hStream, streamId) + + +cdef cudaError_t _cudaStreamGetDevice(cudaStream_t hStream, int* device) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaStreamGetDevice(hStream, device) + + +cdef cudaError_t _cudaCtxResetPersistingL2Cache() except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaCtxResetPersistingL2Cache() + + +cdef cudaError_t _cudaStreamCopyAttributes(cudaStream_t dst, cudaStream_t src) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaStreamCopyAttributes(dst, src) + + +cdef cudaError_t _cudaStreamGetAttribute(cudaStream_t hStream, cudaStreamAttrID attr, cudaStreamAttrValue* value_out) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaStreamGetAttribute(hStream, attr, value_out) + + +cdef cudaError_t _cudaStreamSetAttribute(cudaStream_t hStream, cudaStreamAttrID attr, const cudaStreamAttrValue* value) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaStreamSetAttribute(hStream, attr, value) + + +cdef cudaError_t _cudaStreamDestroy(cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaStreamDestroy(stream) + + +cdef cudaError_t _cudaStreamWaitEvent(cudaStream_t stream, cudaEvent_t event, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaStreamWaitEvent(stream, event, flags) + + +cdef cudaError_t _cudaStreamAddCallback(cudaStream_t stream, cudaStreamCallback_t callback, void* userData, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaStreamAddCallback(stream, callback, userData, flags) + + +cdef cudaError_t _cudaStreamSynchronize(cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaStreamSynchronize(stream) + + +cdef cudaError_t _cudaStreamQuery(cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaStreamQuery(stream) + + +cdef cudaError_t _cudaStreamAttachMemAsync(cudaStream_t stream, void* devPtr, size_t length, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaStreamAttachMemAsync(stream, devPtr, length, flags) + + +cdef cudaError_t _cudaStreamBeginCapture(cudaStream_t stream, cudaStreamCaptureMode mode) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaStreamBeginCapture(stream, mode) + + +cdef cudaError_t _cudaStreamBeginCaptureToGraph(cudaStream_t stream, cudaGraph_t graph, const cudaGraphNode_t* dependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, cudaStreamCaptureMode mode) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaStreamBeginCaptureToGraph(stream, graph, dependencies, dependencyData, numDependencies, mode) + + +cdef cudaError_t _cudaThreadExchangeStreamCaptureMode(cudaStreamCaptureMode* mode) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaThreadExchangeStreamCaptureMode(mode) + + +cdef cudaError_t _cudaStreamEndCapture(cudaStream_t stream, cudaGraph_t* pGraph) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaStreamEndCapture(stream, pGraph) + + +cdef cudaError_t _cudaStreamIsCapturing(cudaStream_t stream, cudaStreamCaptureStatus* pCaptureStatus) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaStreamIsCapturing(stream, pCaptureStatus) + + +cdef cudaError_t _cudaStreamUpdateCaptureDependencies(cudaStream_t stream, cudaGraphNode_t* dependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaStreamUpdateCaptureDependencies(stream, dependencies, dependencyData, numDependencies, flags) + + +cdef cudaError_t _cudaEventCreate(cudaEvent_t* event) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaEventCreate(event) + + +cdef cudaError_t _cudaEventCreateWithFlags(cudaEvent_t* event, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaEventCreateWithFlags(event, flags) + + +cdef cudaError_t _cudaEventRecord(cudaEvent_t event, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaEventRecord(event, stream) + + +cdef cudaError_t _cudaEventRecordWithFlags(cudaEvent_t event, cudaStream_t stream, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaEventRecordWithFlags(event, stream, flags) + + +cdef cudaError_t _cudaEventQuery(cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaEventQuery(event) + + +cdef cudaError_t _cudaEventSynchronize(cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaEventSynchronize(event) + + +cdef cudaError_t _cudaEventDestroy(cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaEventDestroy(event) + + +cdef cudaError_t _cudaEventElapsedTime(float* ms, cudaEvent_t start, cudaEvent_t end) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaEventElapsedTime(ms, start, end) + + +cdef cudaError_t _cudaImportExternalMemory(cudaExternalMemory_t* extMem_out, const cudaExternalMemoryHandleDesc* memHandleDesc) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaImportExternalMemory(extMem_out, memHandleDesc) + + +cdef cudaError_t _cudaExternalMemoryGetMappedBuffer(void** devPtr, cudaExternalMemory_t extMem, const cudaExternalMemoryBufferDesc* bufferDesc) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaExternalMemoryGetMappedBuffer(devPtr, extMem, bufferDesc) + + +cdef cudaError_t _cudaExternalMemoryGetMappedMipmappedArray(cudaMipmappedArray_t* mipmap, cudaExternalMemory_t extMem, const cudaExternalMemoryMipmappedArrayDesc* mipmapDesc) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaExternalMemoryGetMappedMipmappedArray(mipmap, extMem, mipmapDesc) + + +cdef cudaError_t _cudaDestroyExternalMemory(cudaExternalMemory_t extMem) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDestroyExternalMemory(extMem) + + +cdef cudaError_t _cudaImportExternalSemaphore(cudaExternalSemaphore_t* extSem_out, const cudaExternalSemaphoreHandleDesc* semHandleDesc) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaImportExternalSemaphore(extSem_out, semHandleDesc) + + +cdef cudaError_t _cudaDestroyExternalSemaphore(cudaExternalSemaphore_t extSem) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDestroyExternalSemaphore(extSem) + + +cdef cudaError_t _cudaFuncSetCacheConfig(const void* func, cudaFuncCache cacheConfig) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaFuncSetCacheConfig(func, cacheConfig) + + +cdef cudaError_t _cudaFuncGetAttributes(cudaFuncAttributes* attr, const void* func) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaFuncGetAttributes(attr, func) + + +cdef cudaError_t _cudaFuncSetAttribute(const void* func, cudaFuncAttribute attr, int value) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaFuncSetAttribute(func, attr, value) + + +cdef cudaError_t _cudaFuncGetName(const char** name, const void* func) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaFuncGetName(name, func) + + +cdef cudaError_t _cudaFuncGetParamInfo(const void* func, size_t paramIndex, size_t* paramOffset, size_t* paramSize) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaFuncGetParamInfo(func, paramIndex, paramOffset, paramSize) + + +cdef cudaError_t _cudaLaunchHostFunc(cudaStream_t stream, cudaHostFn_t fn, void* userData) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaLaunchHostFunc(stream, fn, userData) + + +cdef cudaError_t _cudaFuncSetSharedMemConfig(const void* func, cudaSharedMemConfig config) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaFuncSetSharedMemConfig(func, config) + + +cdef cudaError_t _cudaOccupancyMaxActiveBlocksPerMultiprocessor(int* numBlocks, const void* func, int blockSize, size_t dynamicSMemSize) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaOccupancyMaxActiveBlocksPerMultiprocessor(numBlocks, func, blockSize, dynamicSMemSize) + + +cdef cudaError_t _cudaOccupancyAvailableDynamicSMemPerBlock(size_t* dynamicSmemSize, const void* func, int numBlocks, int blockSize) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaOccupancyAvailableDynamicSMemPerBlock(dynamicSmemSize, func, numBlocks, blockSize) + + +cdef cudaError_t _cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(int* numBlocks, const void* func, int blockSize, size_t dynamicSMemSize, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(numBlocks, func, blockSize, dynamicSMemSize, flags) + + +cdef cudaError_t _cudaMallocManaged(void** devPtr, size_t size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMallocManaged(devPtr, size, flags) + + +cdef cudaError_t _cudaMalloc(void** devPtr, size_t size) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMalloc(devPtr, size) + + +cdef cudaError_t _cudaMallocHost(void** ptr, size_t size) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMallocHost(ptr, size) + + +cdef cudaError_t _cudaMallocPitch(void** devPtr, size_t* pitch, size_t width, size_t height) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMallocPitch(devPtr, pitch, width, height) + + +cdef cudaError_t _cudaMallocArray(cudaArray_t* array, const cudaChannelFormatDesc* desc, size_t width, size_t height, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMallocArray(array, desc, width, height, flags) + + +cdef cudaError_t _cudaFree(void* devPtr) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaFree(devPtr) + + +cdef cudaError_t _cudaFreeHost(void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaFreeHost(ptr) + + +cdef cudaError_t _cudaFreeArray(cudaArray_t array) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaFreeArray(array) + + +cdef cudaError_t _cudaFreeMipmappedArray(cudaMipmappedArray_t mipmappedArray) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaFreeMipmappedArray(mipmappedArray) + + +cdef cudaError_t _cudaHostAlloc(void** pHost, size_t size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaHostAlloc(pHost, size, flags) + + +cdef cudaError_t _cudaHostRegister(void* ptr, size_t size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaHostRegister(ptr, size, flags) + + +cdef cudaError_t _cudaHostUnregister(void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaHostUnregister(ptr) + + +cdef cudaError_t _cudaHostGetDevicePointer(void** pDevice, void* pHost, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaHostGetDevicePointer(pDevice, pHost, flags) + + +cdef cudaError_t _cudaHostGetFlags(unsigned int* pFlags, void* pHost) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaHostGetFlags(pFlags, pHost) + + +cdef cudaError_t _cudaMalloc3D(cudaPitchedPtr* pitchedDevPtr, cudaExtent extent) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMalloc3D(pitchedDevPtr, extent) + + +cdef cudaError_t _cudaMalloc3DArray(cudaArray_t* array, const cudaChannelFormatDesc* desc, cudaExtent extent, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMalloc3DArray(array, desc, extent, flags) + + +cdef cudaError_t _cudaMallocMipmappedArray(cudaMipmappedArray_t* mipmappedArray, const cudaChannelFormatDesc* desc, cudaExtent extent, unsigned int numLevels, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMallocMipmappedArray(mipmappedArray, desc, extent, numLevels, flags) + + +cdef cudaError_t _cudaGetMipmappedArrayLevel(cudaArray_t* levelArray, cudaMipmappedArray_const_t mipmappedArray, unsigned int level) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGetMipmappedArrayLevel(levelArray, mipmappedArray, level) + + +cdef cudaError_t _cudaMemcpy3D(const cudaMemcpy3DParms* p) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemcpy3D(p) + + +cdef cudaError_t _cudaMemcpy3DPeer(const cudaMemcpy3DPeerParms* p) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemcpy3DPeer(p) + + +cdef cudaError_t _cudaMemcpy3DAsync(const cudaMemcpy3DParms* p, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemcpy3DAsync(p, stream) + + +cdef cudaError_t _cudaMemcpy3DPeerAsync(const cudaMemcpy3DPeerParms* p, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemcpy3DPeerAsync(p, stream) + + +cdef cudaError_t _cudaMemGetInfo(size_t* free, size_t* total) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemGetInfo(free, total) + + +cdef cudaError_t _cudaArrayGetInfo(cudaChannelFormatDesc* desc, cudaExtent* extent, unsigned int* flags, cudaArray_t array) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaArrayGetInfo(desc, extent, flags, array) + + +cdef cudaError_t _cudaArrayGetPlane(cudaArray_t* pPlaneArray, cudaArray_t hArray, unsigned int planeIdx) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaArrayGetPlane(pPlaneArray, hArray, planeIdx) + + +cdef cudaError_t _cudaArrayGetMemoryRequirements(cudaArrayMemoryRequirements* memoryRequirements, cudaArray_t array, int device) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaArrayGetMemoryRequirements(memoryRequirements, array, device) + + +cdef cudaError_t _cudaMipmappedArrayGetMemoryRequirements(cudaArrayMemoryRequirements* memoryRequirements, cudaMipmappedArray_t mipmap, int device) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMipmappedArrayGetMemoryRequirements(memoryRequirements, mipmap, device) + + +cdef cudaError_t _cudaArrayGetSparseProperties(cudaArraySparseProperties* sparseProperties, cudaArray_t array) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaArrayGetSparseProperties(sparseProperties, array) + + +cdef cudaError_t _cudaMipmappedArrayGetSparseProperties(cudaArraySparseProperties* sparseProperties, cudaMipmappedArray_t mipmap) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMipmappedArrayGetSparseProperties(sparseProperties, mipmap) + + +cdef cudaError_t _cudaMemcpy(void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemcpy(dst, src, count, kind) + + +cdef cudaError_t _cudaMemcpyPeer(void* dst, int dstDevice, const void* src, int srcDevice, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemcpyPeer(dst, dstDevice, src, srcDevice, count) + + +cdef cudaError_t _cudaMemcpy2D(void* dst, size_t dpitch, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemcpy2D(dst, dpitch, src, spitch, width, height, kind) + + +cdef cudaError_t _cudaMemcpy2DToArray(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemcpy2DToArray(dst, wOffset, hOffset, src, spitch, width, height, kind) + + +cdef cudaError_t _cudaMemcpy2DFromArray(void* dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemcpy2DFromArray(dst, dpitch, src, wOffset, hOffset, width, height, kind) + + +cdef cudaError_t _cudaMemcpy2DArrayToArray(cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemcpy2DArrayToArray(dst, wOffsetDst, hOffsetDst, src, wOffsetSrc, hOffsetSrc, width, height, kind) + + +cdef cudaError_t _cudaMemcpyAsync(void* dst, const void* src, size_t count, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemcpyAsync(dst, src, count, kind, stream) + + +cdef cudaError_t _cudaMemcpyPeerAsync(void* dst, int dstDevice, const void* src, int srcDevice, size_t count, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemcpyPeerAsync(dst, dstDevice, src, srcDevice, count, stream) + + +cdef cudaError_t _cudaMemcpyBatchAsync(const void** dsts, const void** srcs, const size_t* sizes, size_t count, cudaMemcpyAttributes* attrs, size_t* attrsIdxs, size_t numAttrs, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemcpyBatchAsync(dsts, srcs, sizes, count, attrs, attrsIdxs, numAttrs, stream) + + +cdef cudaError_t _cudaMemcpy3DBatchAsync(size_t numOps, cudaMemcpy3DBatchOp* opList, unsigned long long flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemcpy3DBatchAsync(numOps, opList, flags, stream) + + +cdef cudaError_t _cudaMemcpy2DAsync(void* dst, size_t dpitch, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemcpy2DAsync(dst, dpitch, src, spitch, width, height, kind, stream) + + +cdef cudaError_t _cudaMemcpy2DToArrayAsync(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemcpy2DToArrayAsync(dst, wOffset, hOffset, src, spitch, width, height, kind, stream) + + +cdef cudaError_t _cudaMemcpy2DFromArrayAsync(void* dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemcpy2DFromArrayAsync(dst, dpitch, src, wOffset, hOffset, width, height, kind, stream) + + +cdef cudaError_t _cudaMemset(void* devPtr, int value, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemset(devPtr, value, count) + + +cdef cudaError_t _cudaMemset2D(void* devPtr, size_t pitch, int value, size_t width, size_t height) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemset2D(devPtr, pitch, value, width, height) + + +cdef cudaError_t _cudaMemset3D(cudaPitchedPtr pitchedDevPtr, int value, cudaExtent extent) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemset3D(pitchedDevPtr, value, extent) + + +cdef cudaError_t _cudaMemsetAsync(void* devPtr, int value, size_t count, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemsetAsync(devPtr, value, count, stream) + + +cdef cudaError_t _cudaMemset2DAsync(void* devPtr, size_t pitch, int value, size_t width, size_t height, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemset2DAsync(devPtr, pitch, value, width, height, stream) + + +cdef cudaError_t _cudaMemset3DAsync(cudaPitchedPtr pitchedDevPtr, int value, cudaExtent extent, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemset3DAsync(pitchedDevPtr, value, extent, stream) + + +cdef cudaError_t _cudaMemPrefetchAsync(const void* devPtr, size_t count, cudaMemLocation location, unsigned int flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemPrefetchAsync(devPtr, count, location, flags, stream) + + +cdef cudaError_t _cudaMemAdvise(const void* devPtr, size_t count, cudaMemoryAdvise advice, cudaMemLocation location) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemAdvise(devPtr, count, advice, location) + + +cdef cudaError_t _cudaMemRangeGetAttribute(void* data, size_t dataSize, cudaMemRangeAttribute attribute, const void* devPtr, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemRangeGetAttribute(data, dataSize, attribute, devPtr, count) + + +cdef cudaError_t _cudaMemRangeGetAttributes(void** data, size_t* dataSizes, cudaMemRangeAttribute* attributes, size_t numAttributes, const void* devPtr, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemRangeGetAttributes(data, dataSizes, attributes, numAttributes, devPtr, count) + + +cdef cudaError_t _cudaMemcpyToArray(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemcpyToArray(dst, wOffset, hOffset, src, count, kind) + + +cdef cudaError_t _cudaMemcpyFromArray(void* dst, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemcpyFromArray(dst, src, wOffset, hOffset, count, kind) + + +cdef cudaError_t _cudaMemcpyArrayToArray(cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemcpyArrayToArray(dst, wOffsetDst, hOffsetDst, src, wOffsetSrc, hOffsetSrc, count, kind) + + +cdef cudaError_t _cudaMemcpyToArrayAsync(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t count, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemcpyToArrayAsync(dst, wOffset, hOffset, src, count, kind, stream) + + +cdef cudaError_t _cudaMemcpyFromArrayAsync(void* dst, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemcpyFromArrayAsync(dst, src, wOffset, hOffset, count, kind, stream) + + +cdef cudaError_t _cudaMallocAsync(void** devPtr, size_t size, cudaStream_t hStream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMallocAsync(devPtr, size, hStream) + + +cdef cudaError_t _cudaFreeAsync(void* devPtr, cudaStream_t hStream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaFreeAsync(devPtr, hStream) + + +cdef cudaError_t _cudaMemPoolTrimTo(cudaMemPool_t memPool, size_t minBytesToKeep) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemPoolTrimTo(memPool, minBytesToKeep) + + +cdef cudaError_t _cudaMemPoolSetAttribute(cudaMemPool_t memPool, cudaMemPoolAttr attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemPoolSetAttribute(memPool, attr, value) + + +cdef cudaError_t _cudaMemPoolGetAttribute(cudaMemPool_t memPool, cudaMemPoolAttr attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemPoolGetAttribute(memPool, attr, value) + + +cdef cudaError_t _cudaMemPoolSetAccess(cudaMemPool_t memPool, const cudaMemAccessDesc* descList, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemPoolSetAccess(memPool, descList, count) + + +cdef cudaError_t _cudaMemPoolGetAccess(cudaMemAccessFlags* flags, cudaMemPool_t memPool, cudaMemLocation* location) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemPoolGetAccess(flags, memPool, location) + + +cdef cudaError_t _cudaMemPoolCreate(cudaMemPool_t* memPool, const cudaMemPoolProps* poolProps) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemPoolCreate(memPool, poolProps) + + +cdef cudaError_t _cudaMemPoolDestroy(cudaMemPool_t memPool) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemPoolDestroy(memPool) + + +cdef cudaError_t _cudaMallocFromPoolAsync(void** ptr, size_t size, cudaMemPool_t memPool, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMallocFromPoolAsync(ptr, size, memPool, stream) + + +cdef cudaError_t _cudaMemPoolExportToShareableHandle(void* shareableHandle, cudaMemPool_t memPool, cudaMemAllocationHandleType handleType, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemPoolExportToShareableHandle(shareableHandle, memPool, handleType, flags) + + +cdef cudaError_t _cudaMemPoolImportFromShareableHandle(cudaMemPool_t* memPool, void* shareableHandle, cudaMemAllocationHandleType handleType, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemPoolImportFromShareableHandle(memPool, shareableHandle, handleType, flags) + + +cdef cudaError_t _cudaMemPoolExportPointer(cudaMemPoolPtrExportData* exportData, void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemPoolExportPointer(exportData, ptr) + + +cdef cudaError_t _cudaMemPoolImportPointer(void** ptr, cudaMemPool_t memPool, cudaMemPoolPtrExportData* exportData) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemPoolImportPointer(ptr, memPool, exportData) + + +cdef cudaError_t _cudaPointerGetAttributes(cudaPointerAttributes* attributes, const void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaPointerGetAttributes(attributes, ptr) + + +cdef cudaError_t _cudaDeviceCanAccessPeer(int* canAccessPeer, int device, int peerDevice) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceCanAccessPeer(canAccessPeer, device, peerDevice) + + +cdef cudaError_t _cudaDeviceEnablePeerAccess(int peerDevice, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceEnablePeerAccess(peerDevice, flags) + + +cdef cudaError_t _cudaDeviceDisablePeerAccess(int peerDevice) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceDisablePeerAccess(peerDevice) + + +cdef cudaError_t _cudaGraphicsUnregisterResource(cudaGraphicsResource_t resource) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphicsUnregisterResource(resource) + + +cdef cudaError_t _cudaGraphicsResourceSetMapFlags(cudaGraphicsResource_t resource, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphicsResourceSetMapFlags(resource, flags) + + +cdef cudaError_t _cudaGraphicsMapResources(int count, cudaGraphicsResource_t* resources, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphicsMapResources(count, resources, stream) + + +cdef cudaError_t _cudaGraphicsUnmapResources(int count, cudaGraphicsResource_t* resources, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphicsUnmapResources(count, resources, stream) + + +cdef cudaError_t _cudaGraphicsResourceGetMappedPointer(void** devPtr, size_t* size, cudaGraphicsResource_t resource) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphicsResourceGetMappedPointer(devPtr, size, resource) + + +cdef cudaError_t _cudaGraphicsSubResourceGetMappedArray(cudaArray_t* array, cudaGraphicsResource_t resource, unsigned int arrayIndex, unsigned int mipLevel) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphicsSubResourceGetMappedArray(array, resource, arrayIndex, mipLevel) + + +cdef cudaError_t _cudaGraphicsResourceGetMappedMipmappedArray(cudaMipmappedArray_t* mipmappedArray, cudaGraphicsResource_t resource) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphicsResourceGetMappedMipmappedArray(mipmappedArray, resource) + + +cdef cudaError_t _cudaGetChannelDesc(cudaChannelFormatDesc* desc, cudaArray_const_t array) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGetChannelDesc(desc, array) + + +cdef cudaChannelFormatDesc _cudaCreateChannelDesc(int x, int y, int z, int w, cudaChannelFormatKind f) except* nogil: + return _static_cudaCreateChannelDesc(x, y, z, w, f) + + +cdef cudaError_t _cudaCreateTextureObject(cudaTextureObject_t* pTexObject, const cudaResourceDesc* pResDesc, const cudaTextureDesc* pTexDesc, const cudaResourceViewDesc* pResViewDesc) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaCreateTextureObject(pTexObject, pResDesc, pTexDesc, pResViewDesc) + + +cdef cudaError_t _cudaDestroyTextureObject(cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDestroyTextureObject(texObject) + + +cdef cudaError_t _cudaGetTextureObjectResourceDesc(cudaResourceDesc* pResDesc, cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGetTextureObjectResourceDesc(pResDesc, texObject) + + +cdef cudaError_t _cudaGetTextureObjectTextureDesc(cudaTextureDesc* pTexDesc, cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGetTextureObjectTextureDesc(pTexDesc, texObject) + + +cdef cudaError_t _cudaGetTextureObjectResourceViewDesc(cudaResourceViewDesc* pResViewDesc, cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGetTextureObjectResourceViewDesc(pResViewDesc, texObject) + + +cdef cudaError_t _cudaCreateSurfaceObject(cudaSurfaceObject_t* pSurfObject, const cudaResourceDesc* pResDesc) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaCreateSurfaceObject(pSurfObject, pResDesc) + + +cdef cudaError_t _cudaDestroySurfaceObject(cudaSurfaceObject_t surfObject) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDestroySurfaceObject(surfObject) + + +cdef cudaError_t _cudaGetSurfaceObjectResourceDesc(cudaResourceDesc* pResDesc, cudaSurfaceObject_t surfObject) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGetSurfaceObjectResourceDesc(pResDesc, surfObject) + + +cdef cudaError_t _cudaDriverGetVersion(int* driverVersion) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDriverGetVersion(driverVersion) + + +cdef cudaError_t _cudaRuntimeGetVersion(int* runtimeVersion) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaRuntimeGetVersion(runtimeVersion) + + +cdef cudaError_t _cudaGraphCreate(cudaGraph_t* pGraph, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphCreate(pGraph, flags) + + +cdef cudaError_t _cudaGraphAddKernelNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphAddKernelNode(pGraphNode, graph, pDependencies, numDependencies, pNodeParams) + + +cdef cudaError_t _cudaGraphKernelNodeGetParams(cudaGraphNode_t node, cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphKernelNodeGetParams(node, pNodeParams) + + +cdef cudaError_t _cudaGraphKernelNodeSetParams(cudaGraphNode_t node, const cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphKernelNodeSetParams(node, pNodeParams) + + +cdef cudaError_t _cudaGraphKernelNodeCopyAttributes(cudaGraphNode_t hDst, cudaGraphNode_t hSrc) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphKernelNodeCopyAttributes(hDst, hSrc) + + +cdef cudaError_t _cudaGraphKernelNodeGetAttribute(cudaGraphNode_t hNode, cudaKernelNodeAttrID attr, cudaKernelNodeAttrValue* value_out) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphKernelNodeGetAttribute(hNode, attr, value_out) + + +cdef cudaError_t _cudaGraphKernelNodeSetAttribute(cudaGraphNode_t hNode, cudaKernelNodeAttrID attr, const cudaKernelNodeAttrValue* value) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphKernelNodeSetAttribute(hNode, attr, value) + + +cdef cudaError_t _cudaGraphAddMemcpyNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaMemcpy3DParms* pCopyParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphAddMemcpyNode(pGraphNode, graph, pDependencies, numDependencies, pCopyParams) + + +cdef cudaError_t _cudaGraphAddMemcpyNode1D(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphAddMemcpyNode1D(pGraphNode, graph, pDependencies, numDependencies, dst, src, count, kind) + + +cdef cudaError_t _cudaGraphMemcpyNodeGetParams(cudaGraphNode_t node, cudaMemcpy3DParms* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphMemcpyNodeGetParams(node, pNodeParams) + + +cdef cudaError_t _cudaGraphMemcpyNodeSetParams(cudaGraphNode_t node, const cudaMemcpy3DParms* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphMemcpyNodeSetParams(node, pNodeParams) + + +cdef cudaError_t _cudaGraphMemcpyNodeSetParams1D(cudaGraphNode_t node, void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphMemcpyNodeSetParams1D(node, dst, src, count, kind) + + +cdef cudaError_t _cudaGraphAddMemsetNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaMemsetParams* pMemsetParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphAddMemsetNode(pGraphNode, graph, pDependencies, numDependencies, pMemsetParams) + + +cdef cudaError_t _cudaGraphMemsetNodeGetParams(cudaGraphNode_t node, cudaMemsetParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphMemsetNodeGetParams(node, pNodeParams) + + +cdef cudaError_t _cudaGraphMemsetNodeSetParams(cudaGraphNode_t node, const cudaMemsetParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphMemsetNodeSetParams(node, pNodeParams) + + +cdef cudaError_t _cudaGraphAddHostNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphAddHostNode(pGraphNode, graph, pDependencies, numDependencies, pNodeParams) + + +cdef cudaError_t _cudaGraphHostNodeGetParams(cudaGraphNode_t node, cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphHostNodeGetParams(node, pNodeParams) + + +cdef cudaError_t _cudaGraphHostNodeSetParams(cudaGraphNode_t node, const cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphHostNodeSetParams(node, pNodeParams) + + +cdef cudaError_t _cudaGraphAddChildGraphNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaGraph_t childGraph) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphAddChildGraphNode(pGraphNode, graph, pDependencies, numDependencies, childGraph) + + +cdef cudaError_t _cudaGraphChildGraphNodeGetGraph(cudaGraphNode_t node, cudaGraph_t* pGraph) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphChildGraphNodeGetGraph(node, pGraph) + + +cdef cudaError_t _cudaGraphAddEmptyNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphAddEmptyNode(pGraphNode, graph, pDependencies, numDependencies) + + +cdef cudaError_t _cudaGraphAddEventRecordNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphAddEventRecordNode(pGraphNode, graph, pDependencies, numDependencies, event) + + +cdef cudaError_t _cudaGraphEventRecordNodeGetEvent(cudaGraphNode_t node, cudaEvent_t* event_out) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphEventRecordNodeGetEvent(node, event_out) + + +cdef cudaError_t _cudaGraphEventRecordNodeSetEvent(cudaGraphNode_t node, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphEventRecordNodeSetEvent(node, event) + + +cdef cudaError_t _cudaGraphAddEventWaitNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphAddEventWaitNode(pGraphNode, graph, pDependencies, numDependencies, event) + + +cdef cudaError_t _cudaGraphEventWaitNodeGetEvent(cudaGraphNode_t node, cudaEvent_t* event_out) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphEventWaitNodeGetEvent(node, event_out) + + +cdef cudaError_t _cudaGraphEventWaitNodeSetEvent(cudaGraphNode_t node, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphEventWaitNodeSetEvent(node, event) + + +cdef cudaError_t _cudaGraphAddExternalSemaphoresSignalNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphAddExternalSemaphoresSignalNode(pGraphNode, graph, pDependencies, numDependencies, nodeParams) + + +cdef cudaError_t _cudaGraphExternalSemaphoresSignalNodeGetParams(cudaGraphNode_t hNode, cudaExternalSemaphoreSignalNodeParams* params_out) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphExternalSemaphoresSignalNodeGetParams(hNode, params_out) + + +cdef cudaError_t _cudaGraphExternalSemaphoresSignalNodeSetParams(cudaGraphNode_t hNode, const cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphExternalSemaphoresSignalNodeSetParams(hNode, nodeParams) + + +cdef cudaError_t _cudaGraphAddExternalSemaphoresWaitNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphAddExternalSemaphoresWaitNode(pGraphNode, graph, pDependencies, numDependencies, nodeParams) + + +cdef cudaError_t _cudaGraphExternalSemaphoresWaitNodeGetParams(cudaGraphNode_t hNode, cudaExternalSemaphoreWaitNodeParams* params_out) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphExternalSemaphoresWaitNodeGetParams(hNode, params_out) + + +cdef cudaError_t _cudaGraphExternalSemaphoresWaitNodeSetParams(cudaGraphNode_t hNode, const cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphExternalSemaphoresWaitNodeSetParams(hNode, nodeParams) + + +cdef cudaError_t _cudaGraphAddMemAllocNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaMemAllocNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphAddMemAllocNode(pGraphNode, graph, pDependencies, numDependencies, nodeParams) + + +cdef cudaError_t _cudaGraphMemAllocNodeGetParams(cudaGraphNode_t node, cudaMemAllocNodeParams* params_out) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphMemAllocNodeGetParams(node, params_out) + + +cdef cudaError_t _cudaGraphAddMemFreeNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, void* dptr) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphAddMemFreeNode(pGraphNode, graph, pDependencies, numDependencies, dptr) + + +cdef cudaError_t _cudaGraphMemFreeNodeGetParams(cudaGraphNode_t node, void* dptr_out) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphMemFreeNodeGetParams(node, dptr_out) + + +cdef cudaError_t _cudaDeviceGraphMemTrim(int device) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceGraphMemTrim(device) + + +cdef cudaError_t _cudaDeviceGetGraphMemAttribute(int device, cudaGraphMemAttributeType attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceGetGraphMemAttribute(device, attr, value) + + +cdef cudaError_t _cudaDeviceSetGraphMemAttribute(int device, cudaGraphMemAttributeType attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceSetGraphMemAttribute(device, attr, value) + + +cdef cudaError_t _cudaGraphClone(cudaGraph_t* pGraphClone, cudaGraph_t originalGraph) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphClone(pGraphClone, originalGraph) + + +cdef cudaError_t _cudaGraphNodeFindInClone(cudaGraphNode_t* pNode, cudaGraphNode_t originalNode, cudaGraph_t clonedGraph) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphNodeFindInClone(pNode, originalNode, clonedGraph) + + +cdef cudaError_t _cudaGraphNodeGetType(cudaGraphNode_t node, cudaGraphNodeType* pType) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphNodeGetType(node, pType) + + +cdef cudaError_t _cudaGraphGetNodes(cudaGraph_t graph, cudaGraphNode_t* nodes, size_t* numNodes) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphGetNodes(graph, nodes, numNodes) + + +cdef cudaError_t _cudaGraphGetRootNodes(cudaGraph_t graph, cudaGraphNode_t* pRootNodes, size_t* pNumRootNodes) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphGetRootNodes(graph, pRootNodes, pNumRootNodes) + + +cdef cudaError_t _cudaGraphGetEdges(cudaGraph_t graph, cudaGraphNode_t* from_, cudaGraphNode_t* to, cudaGraphEdgeData* edgeData, size_t* numEdges) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphGetEdges(graph, from_, to, edgeData, numEdges) + + +cdef cudaError_t _cudaGraphNodeGetDependencies(cudaGraphNode_t node, cudaGraphNode_t* pDependencies, cudaGraphEdgeData* edgeData, size_t* pNumDependencies) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphNodeGetDependencies(node, pDependencies, edgeData, pNumDependencies) + + +cdef cudaError_t _cudaGraphNodeGetDependentNodes(cudaGraphNode_t node, cudaGraphNode_t* pDependentNodes, cudaGraphEdgeData* edgeData, size_t* pNumDependentNodes) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphNodeGetDependentNodes(node, pDependentNodes, edgeData, pNumDependentNodes) + + +cdef cudaError_t _cudaGraphAddDependencies(cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, const cudaGraphEdgeData* edgeData, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphAddDependencies(graph, from_, to, edgeData, numDependencies) + + +cdef cudaError_t _cudaGraphRemoveDependencies(cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, const cudaGraphEdgeData* edgeData, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphRemoveDependencies(graph, from_, to, edgeData, numDependencies) + + +cdef cudaError_t _cudaGraphDestroyNode(cudaGraphNode_t node) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphDestroyNode(node) + + +cdef cudaError_t _cudaGraphInstantiate(cudaGraphExec_t* pGraphExec, cudaGraph_t graph, unsigned long long flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphInstantiate(pGraphExec, graph, flags) + + +cdef cudaError_t _cudaGraphInstantiateWithFlags(cudaGraphExec_t* pGraphExec, cudaGraph_t graph, unsigned long long flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphInstantiateWithFlags(pGraphExec, graph, flags) + + +cdef cudaError_t _cudaGraphInstantiateWithParams(cudaGraphExec_t* pGraphExec, cudaGraph_t graph, cudaGraphInstantiateParams* instantiateParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphInstantiateWithParams(pGraphExec, graph, instantiateParams) + + +cdef cudaError_t _cudaGraphExecGetFlags(cudaGraphExec_t graphExec, unsigned long long* flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphExecGetFlags(graphExec, flags) + + +cdef cudaError_t _cudaGraphExecKernelNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphExecKernelNodeSetParams(hGraphExec, node, pNodeParams) + + +cdef cudaError_t _cudaGraphExecMemcpyNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaMemcpy3DParms* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphExecMemcpyNodeSetParams(hGraphExec, node, pNodeParams) + + +cdef cudaError_t _cudaGraphExecMemcpyNodeSetParams1D(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphExecMemcpyNodeSetParams1D(hGraphExec, node, dst, src, count, kind) + + +cdef cudaError_t _cudaGraphExecMemsetNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaMemsetParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphExecMemsetNodeSetParams(hGraphExec, node, pNodeParams) + + +cdef cudaError_t _cudaGraphExecHostNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphExecHostNodeSetParams(hGraphExec, node, pNodeParams) + + +cdef cudaError_t _cudaGraphExecChildGraphNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, cudaGraph_t childGraph) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphExecChildGraphNodeSetParams(hGraphExec, node, childGraph) + + +cdef cudaError_t _cudaGraphExecEventRecordNodeSetEvent(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphExecEventRecordNodeSetEvent(hGraphExec, hNode, event) + + +cdef cudaError_t _cudaGraphExecEventWaitNodeSetEvent(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphExecEventWaitNodeSetEvent(hGraphExec, hNode, event) + + +cdef cudaError_t _cudaGraphExecExternalSemaphoresSignalNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, const cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphExecExternalSemaphoresSignalNodeSetParams(hGraphExec, hNode, nodeParams) + + +cdef cudaError_t _cudaGraphExecExternalSemaphoresWaitNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, const cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphExecExternalSemaphoresWaitNodeSetParams(hGraphExec, hNode, nodeParams) + + +cdef cudaError_t _cudaGraphNodeSetEnabled(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, unsigned int isEnabled) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphNodeSetEnabled(hGraphExec, hNode, isEnabled) + + +cdef cudaError_t _cudaGraphNodeGetEnabled(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, unsigned int* isEnabled) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphNodeGetEnabled(hGraphExec, hNode, isEnabled) + + +cdef cudaError_t _cudaGraphExecUpdate(cudaGraphExec_t hGraphExec, cudaGraph_t hGraph, cudaGraphExecUpdateResultInfo* resultInfo) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphExecUpdate(hGraphExec, hGraph, resultInfo) + + +cdef cudaError_t _cudaGraphUpload(cudaGraphExec_t graphExec, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphUpload(graphExec, stream) + + +cdef cudaError_t _cudaGraphLaunch(cudaGraphExec_t graphExec, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphLaunch(graphExec, stream) + + +cdef cudaError_t _cudaGraphExecDestroy(cudaGraphExec_t graphExec) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphExecDestroy(graphExec) + + +cdef cudaError_t _cudaGraphDestroy(cudaGraph_t graph) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphDestroy(graph) + + +cdef cudaError_t _cudaGraphDebugDotPrint(cudaGraph_t graph, const char* path, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphDebugDotPrint(graph, path, flags) + + +cdef cudaError_t _cudaUserObjectCreate(cudaUserObject_t* object_out, void* ptr, cudaHostFn_t destroy, unsigned int initialRefcount, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaUserObjectCreate(object_out, ptr, destroy, initialRefcount, flags) + + +cdef cudaError_t _cudaUserObjectRetain(cudaUserObject_t object, unsigned int count) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaUserObjectRetain(object, count) + + +cdef cudaError_t _cudaUserObjectRelease(cudaUserObject_t object, unsigned int count) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaUserObjectRelease(object, count) + + +cdef cudaError_t _cudaGraphRetainUserObject(cudaGraph_t graph, cudaUserObject_t object, unsigned int count, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphRetainUserObject(graph, object, count, flags) + + +cdef cudaError_t _cudaGraphReleaseUserObject(cudaGraph_t graph, cudaUserObject_t object, unsigned int count) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphReleaseUserObject(graph, object, count) + + +cdef cudaError_t _cudaGraphAddNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphAddNode(pGraphNode, graph, pDependencies, dependencyData, numDependencies, nodeParams) + + +cdef cudaError_t _cudaGraphNodeSetParams(cudaGraphNode_t node, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphNodeSetParams(node, nodeParams) + + +cdef cudaError_t _cudaGraphExecNodeSetParams(cudaGraphExec_t graphExec, cudaGraphNode_t node, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphExecNodeSetParams(graphExec, node, nodeParams) + + +cdef cudaError_t _cudaGraphConditionalHandleCreate(cudaGraphConditionalHandle* pHandle_out, cudaGraph_t graph, unsigned int defaultLaunchValue, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphConditionalHandleCreate(pHandle_out, graph, defaultLaunchValue, flags) + + +cdef cudaError_t _cudaGetDriverEntryPoint(const char* symbol, void** funcPtr, unsigned long long flags, cudaDriverEntryPointQueryResult* driverStatus) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGetDriverEntryPoint(symbol, funcPtr, flags, driverStatus) + + +cdef cudaError_t _cudaGetDriverEntryPointByVersion(const char* symbol, void** funcPtr, unsigned int cudaVersion, unsigned long long flags, cudaDriverEntryPointQueryResult* driverStatus) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGetDriverEntryPointByVersion(symbol, funcPtr, cudaVersion, flags, driverStatus) + + +cdef cudaError_t _cudaLibraryLoadData(cudaLibrary_t* library, const void* code, cudaJitOption* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, cudaLibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaLibraryLoadData(library, code, jitOptions, jitOptionsValues, numJitOptions, libraryOptions, libraryOptionValues, numLibraryOptions) + + +cdef cudaError_t _cudaLibraryLoadFromFile(cudaLibrary_t* library, const char* fileName, cudaJitOption* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, cudaLibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaLibraryLoadFromFile(library, fileName, jitOptions, jitOptionsValues, numJitOptions, libraryOptions, libraryOptionValues, numLibraryOptions) + + +cdef cudaError_t _cudaLibraryUnload(cudaLibrary_t library) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaLibraryUnload(library) + + +cdef cudaError_t _cudaLibraryGetKernel(cudaKernel_t* pKernel, cudaLibrary_t library, const char* name) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaLibraryGetKernel(pKernel, library, name) + + +cdef cudaError_t _cudaLibraryGetGlobal(void** dptr, size_t* bytes, cudaLibrary_t library, const char* name) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaLibraryGetGlobal(dptr, bytes, library, name) + + +cdef cudaError_t _cudaLibraryGetManaged(void** dptr, size_t* bytes, cudaLibrary_t library, const char* name) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaLibraryGetManaged(dptr, bytes, library, name) + + +cdef cudaError_t _cudaLibraryGetUnifiedFunction(void** fptr, cudaLibrary_t library, const char* symbol) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaLibraryGetUnifiedFunction(fptr, library, symbol) + + +cdef cudaError_t _cudaLibraryGetKernelCount(unsigned int* count, cudaLibrary_t lib) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaLibraryGetKernelCount(count, lib) + + +cdef cudaError_t _cudaLibraryEnumerateKernels(cudaKernel_t* kernels, unsigned int numKernels, cudaLibrary_t lib) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaLibraryEnumerateKernels(kernels, numKernels, lib) + + +cdef cudaError_t _cudaKernelSetAttributeForDevice(cudaKernel_t kernel, cudaFuncAttribute attr, int value, int device) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaKernelSetAttributeForDevice(kernel, attr, value, device) + + +cdef cudaError_t _cudaGetExportTable(const void** ppExportTable, const cudaUUID_t* pExportTableId) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGetExportTable(ppExportTable, pExportTableId) + + +cdef cudaError_t _cudaGetKernel(cudaKernel_t* kernelPtr, const void* entryFuncAddr) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGetKernel(kernelPtr, entryFuncAddr) + + +cdef cudaError_t _cudaProfilerStart() except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaProfilerStart() + + +cdef cudaError_t _cudaProfilerStop() except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaProfilerStop() + + +cdef cudaError_t _cudaGetDeviceProperties(cudaDeviceProp* prop, int device) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGetDeviceProperties(prop, device) + + +cdef cudaError_t _cudaDeviceGetHostAtomicCapabilities(unsigned int* capabilities, const cudaAtomicOperation* operations, unsigned int count, int device) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceGetHostAtomicCapabilities(capabilities, operations, count, device) + + +cdef cudaError_t _cudaDeviceGetP2PAtomicCapabilities(unsigned int* capabilities, const cudaAtomicOperation* operations, unsigned int count, int srcDevice, int dstDevice) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceGetP2PAtomicCapabilities(capabilities, operations, count, srcDevice, dstDevice) + + +cdef cudaError_t _cudaStreamGetCaptureInfo(cudaStream_t stream, cudaStreamCaptureStatus* captureStatus_out, unsigned long long* id_out, cudaGraph_t* graph_out, const cudaGraphNode_t** dependencies_out, const cudaGraphEdgeData** edgeData_out, size_t* numDependencies_out) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaStreamGetCaptureInfo(stream, captureStatus_out, id_out, graph_out, dependencies_out, edgeData_out, numDependencies_out) + + +cdef cudaError_t _cudaSignalExternalSemaphoresAsync(const cudaExternalSemaphore_t* extSemArray, const cudaExternalSemaphoreSignalParams* paramsArray, unsigned int numExtSems, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaSignalExternalSemaphoresAsync(extSemArray, paramsArray, numExtSems, stream) + + +cdef cudaError_t _cudaWaitExternalSemaphoresAsync(const cudaExternalSemaphore_t* extSemArray, const cudaExternalSemaphoreWaitParams* paramsArray, unsigned int numExtSems, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaWaitExternalSemaphoresAsync(extSemArray, paramsArray, numExtSems, stream) + + +cdef cudaError_t _cudaMemPrefetchBatchAsync(void** dptrs, size_t* sizes, size_t count, cudaMemLocation* prefetchLocs, size_t* prefetchLocIdxs, size_t numPrefetchLocs, unsigned long long flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemPrefetchBatchAsync(dptrs, sizes, count, prefetchLocs, prefetchLocIdxs, numPrefetchLocs, flags, stream) + + +cdef cudaError_t _cudaMemDiscardBatchAsync(void** dptrs, size_t* sizes, size_t count, unsigned long long flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemDiscardBatchAsync(dptrs, sizes, count, flags, stream) + + +cdef cudaError_t _cudaMemDiscardAndPrefetchBatchAsync(void** dptrs, size_t* sizes, size_t count, cudaMemLocation* prefetchLocs, size_t* prefetchLocIdxs, size_t numPrefetchLocs, unsigned long long flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemDiscardAndPrefetchBatchAsync(dptrs, sizes, count, prefetchLocs, prefetchLocIdxs, numPrefetchLocs, flags, stream) + + +cdef cudaError_t _cudaMemGetDefaultMemPool(cudaMemPool_t* memPool, cudaMemLocation* location, cudaMemAllocationType type) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemGetDefaultMemPool(memPool, location, type) + + +cdef cudaError_t _cudaMemGetMemPool(cudaMemPool_t* memPool, cudaMemLocation* location, cudaMemAllocationType type) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemGetMemPool(memPool, location, type) + + +cdef cudaError_t _cudaMemSetMemPool(cudaMemLocation* location, cudaMemAllocationType type, cudaMemPool_t memPool) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemSetMemPool(location, type, memPool) + + +cdef cudaError_t _cudaLogsRegisterCallback(cudaLogsCallback_t callbackFunc, void* userData, cudaLogsCallbackHandle* callback_out) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaLogsRegisterCallback(callbackFunc, userData, callback_out) + + +cdef cudaError_t _cudaLogsUnregisterCallback(cudaLogsCallbackHandle callback) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaLogsUnregisterCallback(callback) + + +cdef cudaError_t _cudaLogsCurrent(cudaLogIterator* iterator_out, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaLogsCurrent(iterator_out, flags) + + +cdef cudaError_t _cudaLogsDumpToFile(cudaLogIterator* iterator, const char* pathToFile, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaLogsDumpToFile(iterator, pathToFile, flags) + + +cdef cudaError_t _cudaLogsDumpToMemory(cudaLogIterator* iterator, char* buffer, size_t* size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaLogsDumpToMemory(iterator, buffer, size, flags) + + +cdef cudaError_t _cudaGraphNodeGetContainingGraph(cudaGraphNode_t hNode, cudaGraph_t* phGraph) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphNodeGetContainingGraph(hNode, phGraph) + + +cdef cudaError_t _cudaGraphNodeGetLocalId(cudaGraphNode_t hNode, unsigned int* nodeId) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphNodeGetLocalId(hNode, nodeId) + + +cdef cudaError_t _cudaGraphNodeGetToolsId(cudaGraphNode_t hNode, unsigned long long* toolsNodeId) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphNodeGetToolsId(hNode, toolsNodeId) + + +cdef cudaError_t _cudaGraphGetId(cudaGraph_t hGraph, unsigned int* graphID) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphGetId(hGraph, graphID) + + +cdef cudaError_t _cudaGraphExecGetId(cudaGraphExec_t hGraphExec, unsigned int* graphID) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphExecGetId(hGraphExec, graphID) + + +cdef cudaError_t _cudaGraphConditionalHandleCreate_v2(cudaGraphConditionalHandle* pHandle_out, cudaGraph_t graph, cudaExecutionContext_t ctx, unsigned int defaultLaunchValue, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphConditionalHandleCreate_v2(pHandle_out, graph, ctx, defaultLaunchValue, flags) + + +cdef cudaError_t _cudaDeviceGetDevResource(int device, cudaDevResource* resource, cudaDevResourceType type) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceGetDevResource(device, resource, type) + + +cdef cudaError_t _cudaDevSmResourceSplitByCount(cudaDevResource* result, unsigned int* nbGroups, const cudaDevResource* input, cudaDevResource* remaining, unsigned int flags, unsigned int minCount) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDevSmResourceSplitByCount(result, nbGroups, input, remaining, flags, minCount) + + +cdef cudaError_t _cudaDevSmResourceSplit(cudaDevResource* result, unsigned int nbGroups, const cudaDevResource* input, cudaDevResource* remainder, unsigned int flags, cudaDevSmResourceGroupParams* groupParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDevSmResourceSplit(result, nbGroups, input, remainder, flags, groupParams) + + +cdef cudaError_t _cudaDevResourceGenerateDesc(cudaDevResourceDesc_t* phDesc, cudaDevResource* resources, unsigned int nbResources) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDevResourceGenerateDesc(phDesc, resources, nbResources) + + +cdef cudaError_t _cudaGreenCtxCreate(cudaExecutionContext_t* phCtx, cudaDevResourceDesc_t desc, int device, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGreenCtxCreate(phCtx, desc, device, flags) + + +cdef cudaError_t _cudaExecutionCtxDestroy(cudaExecutionContext_t ctx) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaExecutionCtxDestroy(ctx) + + +cdef cudaError_t _cudaExecutionCtxGetDevResource(cudaExecutionContext_t ctx, cudaDevResource* resource, cudaDevResourceType type) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaExecutionCtxGetDevResource(ctx, resource, type) + + +cdef cudaError_t _cudaExecutionCtxGetDevice(int* device, cudaExecutionContext_t ctx) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaExecutionCtxGetDevice(device, ctx) + + +cdef cudaError_t _cudaExecutionCtxGetId(cudaExecutionContext_t ctx, unsigned long long* ctxId) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaExecutionCtxGetId(ctx, ctxId) + + +cdef cudaError_t _cudaExecutionCtxStreamCreate(cudaStream_t* phStream, cudaExecutionContext_t ctx, unsigned int flags, int priority) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaExecutionCtxStreamCreate(phStream, ctx, flags, priority) + + +cdef cudaError_t _cudaExecutionCtxSynchronize(cudaExecutionContext_t ctx) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaExecutionCtxSynchronize(ctx) + + +cdef cudaError_t _cudaStreamGetDevResource(cudaStream_t hStream, cudaDevResource* resource, cudaDevResourceType type) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaStreamGetDevResource(hStream, resource, type) + + +cdef cudaError_t _cudaExecutionCtxRecordEvent(cudaExecutionContext_t ctx, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaExecutionCtxRecordEvent(ctx, event) + + +cdef cudaError_t _cudaExecutionCtxWaitEvent(cudaExecutionContext_t ctx, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaExecutionCtxWaitEvent(ctx, event) + + +cdef cudaError_t _cudaDeviceGetExecutionCtx(cudaExecutionContext_t* ctx, int device) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceGetExecutionCtx(ctx, device) + + +cdef cudaError_t _cudaFuncGetParamCount(const void* func, size_t* paramCount) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaFuncGetParamCount(func, paramCount) + + +cdef cudaError_t _cudaLaunchHostFunc_v2(cudaStream_t stream, cudaHostFn_t fn, void* userData, unsigned int syncMode) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaLaunchHostFunc_v2(stream, fn, userData, syncMode) + + +cdef cudaError_t _cudaMemcpyWithAttributesAsync(void* dst, const void* src, size_t size, cudaMemcpyAttributes* attr, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemcpyWithAttributesAsync(dst, src, size, attr, stream) + + +cdef cudaError_t _cudaMemcpy3DWithAttributesAsync(cudaMemcpy3DBatchOp* op, unsigned long long flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemcpy3DWithAttributesAsync(op, flags, stream) + + +cdef cudaError_t _cudaGraphNodeGetParams(cudaGraphNode_t node, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphNodeGetParams(node, nodeParams) + + +cdef cudaError_t _cudaStreamBeginRecaptureToGraph(cudaStream_t stream, cudaStreamCaptureMode mode, cudaGraph_t graph, cudaGraphRecaptureCallbackData* callbackData) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaStreamBeginRecaptureToGraph(stream, mode, graph, callbackData) diff --git a/cuda_bindings/cuda/bindings/_internal/runtime_ptds_windows.pyx b/cuda_bindings/cuda/bindings/_internal/runtime_ptds_windows.pyx new file mode 100644 index 00000000000..0f940954d0d --- /dev/null +++ b/cuda_bindings/cuda/bindings/_internal/runtime_ptds_windows.pyx @@ -0,0 +1,2262 @@ +# SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +# This code was automatically generated across versions from 12.9.0 to 13.3.0. Do not modify it directly. + +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=33b0c77f7174d41189a91abfe73613b5ba48bd31b5da37d509da61c00b11a004 +cdef extern from "": + """ + #define CUDA_API_PER_THREAD_DEFAULT_STREAM + """ + + +############################################################################### +# C function declarations for static cudart with per-thread default stream +# (CUDA_API_PER_THREAD_DEFAULT_STREAM causes cudaXxx to resolve to the _ptsz +# per-thread-stream symbol variants) +############################################################################### + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceReset "cudaDeviceReset" () noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceSynchronize "cudaDeviceSynchronize" () noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceSetLimit "cudaDeviceSetLimit" (cudaLimit limit, size_t value) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetLimit "cudaDeviceGetLimit" (size_t* pValue, cudaLimit limit) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetTexture1DLinearMaxWidth "cudaDeviceGetTexture1DLinearMaxWidth" (size_t* maxWidthInElements, const cudaChannelFormatDesc* fmtDesc, int device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetCacheConfig "cudaDeviceGetCacheConfig" (cudaFuncCache* pCacheConfig) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetStreamPriorityRange "cudaDeviceGetStreamPriorityRange" (int* leastPriority, int* greatestPriority) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceSetCacheConfig "cudaDeviceSetCacheConfig" (cudaFuncCache cacheConfig) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetByPCIBusId "cudaDeviceGetByPCIBusId" (int* device, const char* pciBusId) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetPCIBusId "cudaDeviceGetPCIBusId" (char* pciBusId, int len, int device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaIpcGetEventHandle "cudaIpcGetEventHandle" (cudaIpcEventHandle_t* handle, cudaEvent_t event) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaIpcOpenEventHandle "cudaIpcOpenEventHandle" (cudaEvent_t* event, cudaIpcEventHandle_t handle) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaIpcGetMemHandle "cudaIpcGetMemHandle" (cudaIpcMemHandle_t* handle, void* devPtr) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaIpcOpenMemHandle "cudaIpcOpenMemHandle" (void** devPtr, cudaIpcMemHandle_t handle, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaIpcCloseMemHandle "cudaIpcCloseMemHandle" (void* devPtr) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceFlushGPUDirectRDMAWrites "cudaDeviceFlushGPUDirectRDMAWrites" (cudaFlushGPUDirectRDMAWritesTarget target, cudaFlushGPUDirectRDMAWritesScope scope) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceRegisterAsyncNotification "cudaDeviceRegisterAsyncNotification" (int device, cudaAsyncCallback callbackFunc, void* userData, cudaAsyncCallbackHandle_t* callback) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceUnregisterAsyncNotification "cudaDeviceUnregisterAsyncNotification" (int device, cudaAsyncCallbackHandle_t callback) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetSharedMemConfig "cudaDeviceGetSharedMemConfig" (cudaSharedMemConfig* pConfig) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceSetSharedMemConfig "cudaDeviceSetSharedMemConfig" (cudaSharedMemConfig config) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetLastError "cudaGetLastError" () noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaPeekAtLastError "cudaPeekAtLastError" () noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + const char* _static_cudaGetErrorName "cudaGetErrorName" (cudaError_t error) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + const char* _static_cudaGetErrorString "cudaGetErrorString" (cudaError_t error) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetDeviceCount "cudaGetDeviceCount" (int* count) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetAttribute "cudaDeviceGetAttribute" (int* value, cudaDeviceAttr attr, int device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetDefaultMemPool "cudaDeviceGetDefaultMemPool" (cudaMemPool_t* memPool, int device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceSetMemPool "cudaDeviceSetMemPool" (int device, cudaMemPool_t memPool) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetMemPool "cudaDeviceGetMemPool" (cudaMemPool_t* memPool, int device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetNvSciSyncAttributes "cudaDeviceGetNvSciSyncAttributes" (void* nvSciSyncAttrList, int device, int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetP2PAttribute "cudaDeviceGetP2PAttribute" (int* value, cudaDeviceP2PAttr attr, int srcDevice, int dstDevice) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaChooseDevice "cudaChooseDevice" (int* device, const cudaDeviceProp* prop) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaInitDevice "cudaInitDevice" (int device, unsigned int deviceFlags, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaSetDevice "cudaSetDevice" (int device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetDevice "cudaGetDevice" (int* device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaSetDeviceFlags "cudaSetDeviceFlags" (unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetDeviceFlags "cudaGetDeviceFlags" (unsigned int* flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamCreate "cudaStreamCreate" (cudaStream_t* pStream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamCreateWithFlags "cudaStreamCreateWithFlags" (cudaStream_t* pStream, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamCreateWithPriority "cudaStreamCreateWithPriority" (cudaStream_t* pStream, unsigned int flags, int priority) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamGetPriority "cudaStreamGetPriority" (cudaStream_t hStream, int* priority) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamGetFlags "cudaStreamGetFlags" (cudaStream_t hStream, unsigned int* flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamGetId "cudaStreamGetId" (cudaStream_t hStream, unsigned long long* streamId) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamGetDevice "cudaStreamGetDevice" (cudaStream_t hStream, int* device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaCtxResetPersistingL2Cache "cudaCtxResetPersistingL2Cache" () noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamCopyAttributes "cudaStreamCopyAttributes" (cudaStream_t dst, cudaStream_t src) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamGetAttribute "cudaStreamGetAttribute" (cudaStream_t hStream, cudaLaunchAttributeID attr, cudaLaunchAttributeValue* value_out) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamSetAttribute "cudaStreamSetAttribute" (cudaStream_t hStream, cudaLaunchAttributeID attr, const cudaLaunchAttributeValue* value) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamDestroy "cudaStreamDestroy" (cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamWaitEvent "cudaStreamWaitEvent" (cudaStream_t stream, cudaEvent_t event, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamAddCallback "cudaStreamAddCallback" (cudaStream_t stream, cudaStreamCallback_t callback, void* userData, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamSynchronize "cudaStreamSynchronize" (cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamQuery "cudaStreamQuery" (cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamAttachMemAsync "cudaStreamAttachMemAsync" (cudaStream_t stream, void* devPtr, size_t length, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamBeginCapture "cudaStreamBeginCapture" (cudaStream_t stream, cudaStreamCaptureMode mode) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamBeginCaptureToGraph "cudaStreamBeginCaptureToGraph" (cudaStream_t stream, cudaGraph_t graph, const cudaGraphNode_t* dependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, cudaStreamCaptureMode mode) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaThreadExchangeStreamCaptureMode "cudaThreadExchangeStreamCaptureMode" (cudaStreamCaptureMode* mode) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamEndCapture "cudaStreamEndCapture" (cudaStream_t stream, cudaGraph_t* pGraph) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamIsCapturing "cudaStreamIsCapturing" (cudaStream_t stream, cudaStreamCaptureStatus* pCaptureStatus) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamUpdateCaptureDependencies "cudaStreamUpdateCaptureDependencies" (cudaStream_t stream, cudaGraphNode_t* dependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaEventCreate "cudaEventCreate" (cudaEvent_t* event) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaEventCreateWithFlags "cudaEventCreateWithFlags" (cudaEvent_t* event, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaEventRecord "cudaEventRecord" (cudaEvent_t event, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaEventRecordWithFlags "cudaEventRecordWithFlags" (cudaEvent_t event, cudaStream_t stream, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaEventQuery "cudaEventQuery" (cudaEvent_t event) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaEventSynchronize "cudaEventSynchronize" (cudaEvent_t event) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaEventDestroy "cudaEventDestroy" (cudaEvent_t event) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaEventElapsedTime "cudaEventElapsedTime" (float* ms, cudaEvent_t start, cudaEvent_t end) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaImportExternalMemory "cudaImportExternalMemory" (cudaExternalMemory_t* extMem_out, const cudaExternalMemoryHandleDesc* memHandleDesc) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaExternalMemoryGetMappedBuffer "cudaExternalMemoryGetMappedBuffer" (void** devPtr, cudaExternalMemory_t extMem, const cudaExternalMemoryBufferDesc* bufferDesc) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaExternalMemoryGetMappedMipmappedArray "cudaExternalMemoryGetMappedMipmappedArray" (cudaMipmappedArray_t* mipmap, cudaExternalMemory_t extMem, const cudaExternalMemoryMipmappedArrayDesc* mipmapDesc) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDestroyExternalMemory "cudaDestroyExternalMemory" (cudaExternalMemory_t extMem) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaImportExternalSemaphore "cudaImportExternalSemaphore" (cudaExternalSemaphore_t* extSem_out, const cudaExternalSemaphoreHandleDesc* semHandleDesc) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDestroyExternalSemaphore "cudaDestroyExternalSemaphore" (cudaExternalSemaphore_t extSem) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaFuncSetCacheConfig "cudaFuncSetCacheConfig" (const void* func, cudaFuncCache cacheConfig) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaFuncGetAttributes "cudaFuncGetAttributes" (cudaFuncAttributes* attr, const void* func) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaFuncSetAttribute "cudaFuncSetAttribute" (const void* func, cudaFuncAttribute attr, int value) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaFuncGetName "cudaFuncGetName" (const char** name, const void* func) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaFuncGetParamInfo "cudaFuncGetParamInfo" (const void* func, size_t paramIndex, size_t* paramOffset, size_t* paramSize) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLaunchHostFunc "cudaLaunchHostFunc" (cudaStream_t stream, cudaHostFn_t fn, void* userData) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaFuncSetSharedMemConfig "cudaFuncSetSharedMemConfig" (const void* func, cudaSharedMemConfig config) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaOccupancyMaxActiveBlocksPerMultiprocessor "cudaOccupancyMaxActiveBlocksPerMultiprocessor" (int* numBlocks, const void* func, int blockSize, size_t dynamicSMemSize) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaOccupancyAvailableDynamicSMemPerBlock "cudaOccupancyAvailableDynamicSMemPerBlock" (size_t* dynamicSmemSize, const void* func, int numBlocks, int blockSize) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags "cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags" (int* numBlocks, const void* func, int blockSize, size_t dynamicSMemSize, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMallocManaged "cudaMallocManaged" (void** devPtr, size_t size, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMalloc "cudaMalloc" (void** devPtr, size_t size) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMallocHost "cudaMallocHost" (void** ptr, size_t size) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMallocPitch "cudaMallocPitch" (void** devPtr, size_t* pitch, size_t width, size_t height) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMallocArray "cudaMallocArray" (cudaArray_t* array, const cudaChannelFormatDesc* desc, size_t width, size_t height, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaFree "cudaFree" (void* devPtr) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaFreeHost "cudaFreeHost" (void* ptr) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaFreeArray "cudaFreeArray" (cudaArray_t array) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaFreeMipmappedArray "cudaFreeMipmappedArray" (cudaMipmappedArray_t mipmappedArray) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaHostAlloc "cudaHostAlloc" (void** pHost, size_t size, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaHostRegister "cudaHostRegister" (void* ptr, size_t size, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaHostUnregister "cudaHostUnregister" (void* ptr) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaHostGetDevicePointer "cudaHostGetDevicePointer" (void** pDevice, void* pHost, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaHostGetFlags "cudaHostGetFlags" (unsigned int* pFlags, void* pHost) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMalloc3D "cudaMalloc3D" (cudaPitchedPtr* pitchedDevPtr, cudaExtent extent) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMalloc3DArray "cudaMalloc3DArray" (cudaArray_t* array, const cudaChannelFormatDesc* desc, cudaExtent extent, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMallocMipmappedArray "cudaMallocMipmappedArray" (cudaMipmappedArray_t* mipmappedArray, const cudaChannelFormatDesc* desc, cudaExtent extent, unsigned int numLevels, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetMipmappedArrayLevel "cudaGetMipmappedArrayLevel" (cudaArray_t* levelArray, cudaMipmappedArray_const_t mipmappedArray, unsigned int level) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpy3D "cudaMemcpy3D" (const cudaMemcpy3DParms* p) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpy3DPeer "cudaMemcpy3DPeer" (const cudaMemcpy3DPeerParms* p) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpy3DAsync "cudaMemcpy3DAsync" (const cudaMemcpy3DParms* p, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpy3DPeerAsync "cudaMemcpy3DPeerAsync" (const cudaMemcpy3DPeerParms* p, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemGetInfo "cudaMemGetInfo" (size_t* free, size_t* total) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaArrayGetInfo "cudaArrayGetInfo" (cudaChannelFormatDesc* desc, cudaExtent* extent, unsigned int* flags, cudaArray_t array) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaArrayGetPlane "cudaArrayGetPlane" (cudaArray_t* pPlaneArray, cudaArray_t hArray, unsigned int planeIdx) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaArrayGetMemoryRequirements "cudaArrayGetMemoryRequirements" (cudaArrayMemoryRequirements* memoryRequirements, cudaArray_t array, int device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMipmappedArrayGetMemoryRequirements "cudaMipmappedArrayGetMemoryRequirements" (cudaArrayMemoryRequirements* memoryRequirements, cudaMipmappedArray_t mipmap, int device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaArrayGetSparseProperties "cudaArrayGetSparseProperties" (cudaArraySparseProperties* sparseProperties, cudaArray_t array) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMipmappedArrayGetSparseProperties "cudaMipmappedArrayGetSparseProperties" (cudaArraySparseProperties* sparseProperties, cudaMipmappedArray_t mipmap) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpy "cudaMemcpy" (void* dst, const void* src, size_t count, cudaMemcpyKind kind) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpyPeer "cudaMemcpyPeer" (void* dst, int dstDevice, const void* src, int srcDevice, size_t count) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpy2D "cudaMemcpy2D" (void* dst, size_t dpitch, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpy2DToArray "cudaMemcpy2DToArray" (cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpy2DFromArray "cudaMemcpy2DFromArray" (void* dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t width, size_t height, cudaMemcpyKind kind) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpy2DArrayToArray "cudaMemcpy2DArrayToArray" (cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t width, size_t height, cudaMemcpyKind kind) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpyAsync "cudaMemcpyAsync" (void* dst, const void* src, size_t count, cudaMemcpyKind kind, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpyPeerAsync "cudaMemcpyPeerAsync" (void* dst, int dstDevice, const void* src, int srcDevice, size_t count, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpyBatchAsync "cudaMemcpyBatchAsync" (void** dsts, const void** srcs, const size_t* sizes, size_t count, cudaMemcpyAttributes* attrs, size_t* attrsIdxs, size_t numAttrs, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpy3DBatchAsync "cudaMemcpy3DBatchAsync" (size_t numOps, cudaMemcpy3DBatchOp* opList, unsigned long long flags, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpy2DAsync "cudaMemcpy2DAsync" (void* dst, size_t dpitch, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpy2DToArrayAsync "cudaMemcpy2DToArrayAsync" (cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpy2DFromArrayAsync "cudaMemcpy2DFromArrayAsync" (void* dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemset "cudaMemset" (void* devPtr, int value, size_t count) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemset2D "cudaMemset2D" (void* devPtr, size_t pitch, int value, size_t width, size_t height) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemset3D "cudaMemset3D" (cudaPitchedPtr pitchedDevPtr, int value, cudaExtent extent) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemsetAsync "cudaMemsetAsync" (void* devPtr, int value, size_t count, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemset2DAsync "cudaMemset2DAsync" (void* devPtr, size_t pitch, int value, size_t width, size_t height, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemset3DAsync "cudaMemset3DAsync" (cudaPitchedPtr pitchedDevPtr, int value, cudaExtent extent, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemPrefetchAsync "cudaMemPrefetchAsync" (const void* devPtr, size_t count, cudaMemLocation location, unsigned int flags, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemAdvise "cudaMemAdvise" (const void* devPtr, size_t count, cudaMemoryAdvise advice, cudaMemLocation location) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemRangeGetAttribute "cudaMemRangeGetAttribute" (void* data, size_t dataSize, cudaMemRangeAttribute attribute, const void* devPtr, size_t count) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemRangeGetAttributes "cudaMemRangeGetAttributes" (void** data, size_t* dataSizes, cudaMemRangeAttribute* attributes, size_t numAttributes, const void* devPtr, size_t count) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpyToArray "cudaMemcpyToArray" (cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t count, cudaMemcpyKind kind) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpyFromArray "cudaMemcpyFromArray" (void* dst, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, cudaMemcpyKind kind) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpyArrayToArray "cudaMemcpyArrayToArray" (cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t count, cudaMemcpyKind kind) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpyToArrayAsync "cudaMemcpyToArrayAsync" (cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t count, cudaMemcpyKind kind, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpyFromArrayAsync "cudaMemcpyFromArrayAsync" (void* dst, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, cudaMemcpyKind kind, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMallocAsync "cudaMallocAsync" (void** devPtr, size_t size, cudaStream_t hStream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaFreeAsync "cudaFreeAsync" (void* devPtr, cudaStream_t hStream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemPoolTrimTo "cudaMemPoolTrimTo" (cudaMemPool_t memPool, size_t minBytesToKeep) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemPoolSetAttribute "cudaMemPoolSetAttribute" (cudaMemPool_t memPool, cudaMemPoolAttr attr, void* value) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemPoolGetAttribute "cudaMemPoolGetAttribute" (cudaMemPool_t memPool, cudaMemPoolAttr attr, void* value) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemPoolSetAccess "cudaMemPoolSetAccess" (cudaMemPool_t memPool, const cudaMemAccessDesc* descList, size_t count) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemPoolGetAccess "cudaMemPoolGetAccess" (cudaMemAccessFlags* flags, cudaMemPool_t memPool, cudaMemLocation* location) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemPoolCreate "cudaMemPoolCreate" (cudaMemPool_t* memPool, const cudaMemPoolProps* poolProps) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemPoolDestroy "cudaMemPoolDestroy" (cudaMemPool_t memPool) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMallocFromPoolAsync "cudaMallocFromPoolAsync" (void** ptr, size_t size, cudaMemPool_t memPool, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemPoolExportToShareableHandle "cudaMemPoolExportToShareableHandle" (void* shareableHandle, cudaMemPool_t memPool, cudaMemAllocationHandleType handleType, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemPoolImportFromShareableHandle "cudaMemPoolImportFromShareableHandle" (cudaMemPool_t* memPool, void* shareableHandle, cudaMemAllocationHandleType handleType, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemPoolExportPointer "cudaMemPoolExportPointer" (cudaMemPoolPtrExportData* exportData, void* ptr) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemPoolImportPointer "cudaMemPoolImportPointer" (void** ptr, cudaMemPool_t memPool, cudaMemPoolPtrExportData* exportData) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaPointerGetAttributes "cudaPointerGetAttributes" (cudaPointerAttributes* attributes, const void* ptr) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceCanAccessPeer "cudaDeviceCanAccessPeer" (int* canAccessPeer, int device, int peerDevice) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceEnablePeerAccess "cudaDeviceEnablePeerAccess" (int peerDevice, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceDisablePeerAccess "cudaDeviceDisablePeerAccess" (int peerDevice) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphicsUnregisterResource "cudaGraphicsUnregisterResource" (cudaGraphicsResource_t resource) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphicsResourceSetMapFlags "cudaGraphicsResourceSetMapFlags" (cudaGraphicsResource_t resource, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphicsMapResources "cudaGraphicsMapResources" (int count, cudaGraphicsResource_t* resources, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphicsUnmapResources "cudaGraphicsUnmapResources" (int count, cudaGraphicsResource_t* resources, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphicsResourceGetMappedPointer "cudaGraphicsResourceGetMappedPointer" (void** devPtr, size_t* size, cudaGraphicsResource_t resource) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphicsSubResourceGetMappedArray "cudaGraphicsSubResourceGetMappedArray" (cudaArray_t* array, cudaGraphicsResource_t resource, unsigned int arrayIndex, unsigned int mipLevel) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphicsResourceGetMappedMipmappedArray "cudaGraphicsResourceGetMappedMipmappedArray" (cudaMipmappedArray_t* mipmappedArray, cudaGraphicsResource_t resource) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetChannelDesc "cudaGetChannelDesc" (cudaChannelFormatDesc* desc, cudaArray_const_t array) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaChannelFormatDesc _static_cudaCreateChannelDesc "cudaCreateChannelDesc" (int x, int y, int z, int w, cudaChannelFormatKind f) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaCreateTextureObject "cudaCreateTextureObject" (cudaTextureObject_t* pTexObject, const cudaResourceDesc* pResDesc, const cudaTextureDesc* pTexDesc, const cudaResourceViewDesc* pResViewDesc) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDestroyTextureObject "cudaDestroyTextureObject" (cudaTextureObject_t texObject) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetTextureObjectResourceDesc "cudaGetTextureObjectResourceDesc" (cudaResourceDesc* pResDesc, cudaTextureObject_t texObject) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetTextureObjectTextureDesc "cudaGetTextureObjectTextureDesc" (cudaTextureDesc* pTexDesc, cudaTextureObject_t texObject) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetTextureObjectResourceViewDesc "cudaGetTextureObjectResourceViewDesc" (cudaResourceViewDesc* pResViewDesc, cudaTextureObject_t texObject) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaCreateSurfaceObject "cudaCreateSurfaceObject" (cudaSurfaceObject_t* pSurfObject, const cudaResourceDesc* pResDesc) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDestroySurfaceObject "cudaDestroySurfaceObject" (cudaSurfaceObject_t surfObject) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetSurfaceObjectResourceDesc "cudaGetSurfaceObjectResourceDesc" (cudaResourceDesc* pResDesc, cudaSurfaceObject_t surfObject) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDriverGetVersion "cudaDriverGetVersion" (int* driverVersion) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaRuntimeGetVersion "cudaRuntimeGetVersion" (int* runtimeVersion) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphCreate "cudaGraphCreate" (cudaGraph_t* pGraph, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddKernelNode "cudaGraphAddKernelNode" (cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaKernelNodeParams* pNodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphKernelNodeGetParams "cudaGraphKernelNodeGetParams" (cudaGraphNode_t node, cudaKernelNodeParams* pNodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphKernelNodeSetParams "cudaGraphKernelNodeSetParams" (cudaGraphNode_t node, const cudaKernelNodeParams* pNodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphKernelNodeCopyAttributes "cudaGraphKernelNodeCopyAttributes" (cudaGraphNode_t hDst, cudaGraphNode_t hSrc) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphKernelNodeGetAttribute "cudaGraphKernelNodeGetAttribute" (cudaGraphNode_t hNode, cudaLaunchAttributeID attr, cudaLaunchAttributeValue* value_out) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphKernelNodeSetAttribute "cudaGraphKernelNodeSetAttribute" (cudaGraphNode_t hNode, cudaLaunchAttributeID attr, const cudaLaunchAttributeValue* value) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddMemcpyNode "cudaGraphAddMemcpyNode" (cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaMemcpy3DParms* pCopyParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddMemcpyNode1D "cudaGraphAddMemcpyNode1D" (cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, void* dst, const void* src, size_t count, cudaMemcpyKind kind) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphMemcpyNodeGetParams "cudaGraphMemcpyNodeGetParams" (cudaGraphNode_t node, cudaMemcpy3DParms* pNodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphMemcpyNodeSetParams "cudaGraphMemcpyNodeSetParams" (cudaGraphNode_t node, const cudaMemcpy3DParms* pNodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphMemcpyNodeSetParams1D "cudaGraphMemcpyNodeSetParams1D" (cudaGraphNode_t node, void* dst, const void* src, size_t count, cudaMemcpyKind kind) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddMemsetNode "cudaGraphAddMemsetNode" (cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaMemsetParams* pMemsetParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphMemsetNodeGetParams "cudaGraphMemsetNodeGetParams" (cudaGraphNode_t node, cudaMemsetParams* pNodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphMemsetNodeSetParams "cudaGraphMemsetNodeSetParams" (cudaGraphNode_t node, const cudaMemsetParams* pNodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddHostNode "cudaGraphAddHostNode" (cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaHostNodeParams* pNodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphHostNodeGetParams "cudaGraphHostNodeGetParams" (cudaGraphNode_t node, cudaHostNodeParams* pNodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphHostNodeSetParams "cudaGraphHostNodeSetParams" (cudaGraphNode_t node, const cudaHostNodeParams* pNodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddChildGraphNode "cudaGraphAddChildGraphNode" (cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaGraph_t childGraph) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphChildGraphNodeGetGraph "cudaGraphChildGraphNodeGetGraph" (cudaGraphNode_t node, cudaGraph_t* pGraph) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddEmptyNode "cudaGraphAddEmptyNode" (cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddEventRecordNode "cudaGraphAddEventRecordNode" (cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaEvent_t event) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphEventRecordNodeGetEvent "cudaGraphEventRecordNodeGetEvent" (cudaGraphNode_t node, cudaEvent_t* event_out) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphEventRecordNodeSetEvent "cudaGraphEventRecordNodeSetEvent" (cudaGraphNode_t node, cudaEvent_t event) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddEventWaitNode "cudaGraphAddEventWaitNode" (cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaEvent_t event) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphEventWaitNodeGetEvent "cudaGraphEventWaitNodeGetEvent" (cudaGraphNode_t node, cudaEvent_t* event_out) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphEventWaitNodeSetEvent "cudaGraphEventWaitNodeSetEvent" (cudaGraphNode_t node, cudaEvent_t event) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddExternalSemaphoresSignalNode "cudaGraphAddExternalSemaphoresSignalNode" (cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaExternalSemaphoreSignalNodeParams* nodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExternalSemaphoresSignalNodeGetParams "cudaGraphExternalSemaphoresSignalNodeGetParams" (cudaGraphNode_t hNode, cudaExternalSemaphoreSignalNodeParams* params_out) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExternalSemaphoresSignalNodeSetParams "cudaGraphExternalSemaphoresSignalNodeSetParams" (cudaGraphNode_t hNode, const cudaExternalSemaphoreSignalNodeParams* nodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddExternalSemaphoresWaitNode "cudaGraphAddExternalSemaphoresWaitNode" (cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaExternalSemaphoreWaitNodeParams* nodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExternalSemaphoresWaitNodeGetParams "cudaGraphExternalSemaphoresWaitNodeGetParams" (cudaGraphNode_t hNode, cudaExternalSemaphoreWaitNodeParams* params_out) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExternalSemaphoresWaitNodeSetParams "cudaGraphExternalSemaphoresWaitNodeSetParams" (cudaGraphNode_t hNode, const cudaExternalSemaphoreWaitNodeParams* nodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddMemAllocNode "cudaGraphAddMemAllocNode" (cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaMemAllocNodeParams* nodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphMemAllocNodeGetParams "cudaGraphMemAllocNodeGetParams" (cudaGraphNode_t node, cudaMemAllocNodeParams* params_out) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddMemFreeNode "cudaGraphAddMemFreeNode" (cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, void* dptr) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphMemFreeNodeGetParams "cudaGraphMemFreeNodeGetParams" (cudaGraphNode_t node, void* dptr_out) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGraphMemTrim "cudaDeviceGraphMemTrim" (int device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetGraphMemAttribute "cudaDeviceGetGraphMemAttribute" (int device, cudaGraphMemAttributeType attr, void* value) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceSetGraphMemAttribute "cudaDeviceSetGraphMemAttribute" (int device, cudaGraphMemAttributeType attr, void* value) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphClone "cudaGraphClone" (cudaGraph_t* pGraphClone, cudaGraph_t originalGraph) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphNodeFindInClone "cudaGraphNodeFindInClone" (cudaGraphNode_t* pNode, cudaGraphNode_t originalNode, cudaGraph_t clonedGraph) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphNodeGetType "cudaGraphNodeGetType" (cudaGraphNode_t node, cudaGraphNodeType* pType) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphGetNodes "cudaGraphGetNodes" (cudaGraph_t graph, cudaGraphNode_t* nodes, size_t* numNodes) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphGetRootNodes "cudaGraphGetRootNodes" (cudaGraph_t graph, cudaGraphNode_t* pRootNodes, size_t* pNumRootNodes) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphGetEdges "cudaGraphGetEdges" (cudaGraph_t graph, cudaGraphNode_t* from_, cudaGraphNode_t* to, cudaGraphEdgeData* edgeData, size_t* numEdges) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphNodeGetDependencies "cudaGraphNodeGetDependencies" (cudaGraphNode_t node, cudaGraphNode_t* pDependencies, cudaGraphEdgeData* edgeData, size_t* pNumDependencies) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphNodeGetDependentNodes "cudaGraphNodeGetDependentNodes" (cudaGraphNode_t node, cudaGraphNode_t* pDependentNodes, cudaGraphEdgeData* edgeData, size_t* pNumDependentNodes) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddDependencies "cudaGraphAddDependencies" (cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, const cudaGraphEdgeData* edgeData, size_t numDependencies) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphRemoveDependencies "cudaGraphRemoveDependencies" (cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, const cudaGraphEdgeData* edgeData, size_t numDependencies) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphDestroyNode "cudaGraphDestroyNode" (cudaGraphNode_t node) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphInstantiate "cudaGraphInstantiate" (cudaGraphExec_t* pGraphExec, cudaGraph_t graph, unsigned long long flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphInstantiateWithFlags "cudaGraphInstantiateWithFlags" (cudaGraphExec_t* pGraphExec, cudaGraph_t graph, unsigned long long flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphInstantiateWithParams "cudaGraphInstantiateWithParams" (cudaGraphExec_t* pGraphExec, cudaGraph_t graph, cudaGraphInstantiateParams* instantiateParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecGetFlags "cudaGraphExecGetFlags" (cudaGraphExec_t graphExec, unsigned long long* flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecKernelNodeSetParams "cudaGraphExecKernelNodeSetParams" (cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaKernelNodeParams* pNodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecMemcpyNodeSetParams "cudaGraphExecMemcpyNodeSetParams" (cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaMemcpy3DParms* pNodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecMemcpyNodeSetParams1D "cudaGraphExecMemcpyNodeSetParams1D" (cudaGraphExec_t hGraphExec, cudaGraphNode_t node, void* dst, const void* src, size_t count, cudaMemcpyKind kind) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecMemsetNodeSetParams "cudaGraphExecMemsetNodeSetParams" (cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaMemsetParams* pNodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecHostNodeSetParams "cudaGraphExecHostNodeSetParams" (cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaHostNodeParams* pNodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecChildGraphNodeSetParams "cudaGraphExecChildGraphNodeSetParams" (cudaGraphExec_t hGraphExec, cudaGraphNode_t node, cudaGraph_t childGraph) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecEventRecordNodeSetEvent "cudaGraphExecEventRecordNodeSetEvent" (cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, cudaEvent_t event) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecEventWaitNodeSetEvent "cudaGraphExecEventWaitNodeSetEvent" (cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, cudaEvent_t event) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecExternalSemaphoresSignalNodeSetParams "cudaGraphExecExternalSemaphoresSignalNodeSetParams" (cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, const cudaExternalSemaphoreSignalNodeParams* nodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecExternalSemaphoresWaitNodeSetParams "cudaGraphExecExternalSemaphoresWaitNodeSetParams" (cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, const cudaExternalSemaphoreWaitNodeParams* nodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphNodeSetEnabled "cudaGraphNodeSetEnabled" (cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, unsigned int isEnabled) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphNodeGetEnabled "cudaGraphNodeGetEnabled" (cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, unsigned int* isEnabled) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecUpdate "cudaGraphExecUpdate" (cudaGraphExec_t hGraphExec, cudaGraph_t hGraph, cudaGraphExecUpdateResultInfo* resultInfo) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphUpload "cudaGraphUpload" (cudaGraphExec_t graphExec, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphLaunch "cudaGraphLaunch" (cudaGraphExec_t graphExec, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecDestroy "cudaGraphExecDestroy" (cudaGraphExec_t graphExec) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphDestroy "cudaGraphDestroy" (cudaGraph_t graph) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphDebugDotPrint "cudaGraphDebugDotPrint" (cudaGraph_t graph, const char* path, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaUserObjectCreate "cudaUserObjectCreate" (cudaUserObject_t* object_out, void* ptr, cudaHostFn_t destroy, unsigned int initialRefcount, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaUserObjectRetain "cudaUserObjectRetain" (cudaUserObject_t object, unsigned int count) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaUserObjectRelease "cudaUserObjectRelease" (cudaUserObject_t object, unsigned int count) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphRetainUserObject "cudaGraphRetainUserObject" (cudaGraph_t graph, cudaUserObject_t object, unsigned int count, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphReleaseUserObject "cudaGraphReleaseUserObject" (cudaGraph_t graph, cudaUserObject_t object, unsigned int count) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddNode "cudaGraphAddNode" (cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, cudaGraphNodeParams* nodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphNodeSetParams "cudaGraphNodeSetParams" (cudaGraphNode_t node, cudaGraphNodeParams* nodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecNodeSetParams "cudaGraphExecNodeSetParams" (cudaGraphExec_t graphExec, cudaGraphNode_t node, cudaGraphNodeParams* nodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphConditionalHandleCreate "cudaGraphConditionalHandleCreate" (cudaGraphConditionalHandle* pHandle_out, cudaGraph_t graph, unsigned int defaultLaunchValue, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetDriverEntryPoint "cudaGetDriverEntryPoint" (const char* symbol, void** funcPtr, unsigned long long flags, cudaDriverEntryPointQueryResult* driverStatus) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetDriverEntryPointByVersion "cudaGetDriverEntryPointByVersion" (const char* symbol, void** funcPtr, unsigned int cudaVersion, unsigned long long flags, cudaDriverEntryPointQueryResult* driverStatus) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLibraryLoadData "cudaLibraryLoadData" (cudaLibrary_t* library, const void* code, cudaJitOption* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, cudaLibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLibraryLoadFromFile "cudaLibraryLoadFromFile" (cudaLibrary_t* library, const char* fileName, cudaJitOption* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, cudaLibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLibraryUnload "cudaLibraryUnload" (cudaLibrary_t library) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLibraryGetKernel "cudaLibraryGetKernel" (cudaKernel_t* pKernel, cudaLibrary_t library, const char* name) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLibraryGetGlobal "cudaLibraryGetGlobal" (void** dptr, size_t* bytes, cudaLibrary_t library, const char* name) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLibraryGetManaged "cudaLibraryGetManaged" (void** dptr, size_t* bytes, cudaLibrary_t library, const char* name) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLibraryGetUnifiedFunction "cudaLibraryGetUnifiedFunction" (void** fptr, cudaLibrary_t library, const char* symbol) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLibraryGetKernelCount "cudaLibraryGetKernelCount" (unsigned int* count, cudaLibrary_t lib) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLibraryEnumerateKernels "cudaLibraryEnumerateKernels" (cudaKernel_t* kernels, unsigned int numKernels, cudaLibrary_t lib) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaKernelSetAttributeForDevice "cudaKernelSetAttributeForDevice" (cudaKernel_t kernel, cudaFuncAttribute attr, int value, int device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetExportTable "cudaGetExportTable" (const void** ppExportTable, const cudaUUID_t* pExportTableId) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetKernel "cudaGetKernel" (cudaKernel_t* kernelPtr, const void* entryFuncAddr) noexcept + +cdef extern from 'cuda_profiler_api.h' nogil: + cudaError_t _static_cudaProfilerStart "cudaProfilerStart" () noexcept + +cdef extern from 'cuda_profiler_api.h' nogil: + cudaError_t _static_cudaProfilerStop "cudaProfilerStop" () noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetDeviceProperties "cudaGetDeviceProperties" (cudaDeviceProp* prop, int device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetHostAtomicCapabilities "cudaDeviceGetHostAtomicCapabilities" (unsigned int* capabilities, const cudaAtomicOperation* operations, unsigned int count, int device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetP2PAtomicCapabilities "cudaDeviceGetP2PAtomicCapabilities" (unsigned int* capabilities, const cudaAtomicOperation* operations, unsigned int count, int srcDevice, int dstDevice) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamGetCaptureInfo "cudaStreamGetCaptureInfo" (cudaStream_t stream, cudaStreamCaptureStatus* captureStatus_out, unsigned long long* id_out, cudaGraph_t* graph_out, const cudaGraphNode_t** dependencies_out, const cudaGraphEdgeData** edgeData_out, size_t* numDependencies_out) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaSignalExternalSemaphoresAsync "cudaSignalExternalSemaphoresAsync" (const cudaExternalSemaphore_t* extSemArray, const cudaExternalSemaphoreSignalParams* paramsArray, unsigned int numExtSems, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaWaitExternalSemaphoresAsync "cudaWaitExternalSemaphoresAsync" (const cudaExternalSemaphore_t* extSemArray, const cudaExternalSemaphoreWaitParams* paramsArray, unsigned int numExtSems, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemPrefetchBatchAsync "cudaMemPrefetchBatchAsync" (void** dptrs, size_t* sizes, size_t count, cudaMemLocation* prefetchLocs, size_t* prefetchLocIdxs, size_t numPrefetchLocs, unsigned long long flags, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemDiscardBatchAsync "cudaMemDiscardBatchAsync" (void** dptrs, size_t* sizes, size_t count, unsigned long long flags, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemDiscardAndPrefetchBatchAsync "cudaMemDiscardAndPrefetchBatchAsync" (void** dptrs, size_t* sizes, size_t count, cudaMemLocation* prefetchLocs, size_t* prefetchLocIdxs, size_t numPrefetchLocs, unsigned long long flags, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemGetDefaultMemPool "cudaMemGetDefaultMemPool" (cudaMemPool_t* memPool, cudaMemLocation* location, cudaMemAllocationType type) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemGetMemPool "cudaMemGetMemPool" (cudaMemPool_t* memPool, cudaMemLocation* location, cudaMemAllocationType type) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemSetMemPool "cudaMemSetMemPool" (cudaMemLocation* location, cudaMemAllocationType type, cudaMemPool_t memPool) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLogsRegisterCallback "cudaLogsRegisterCallback" (cudaLogsCallback_t callbackFunc, void* userData, cudaLogsCallbackHandle* callback_out) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLogsUnregisterCallback "cudaLogsUnregisterCallback" (cudaLogsCallbackHandle callback) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLogsCurrent "cudaLogsCurrent" (cudaLogIterator* iterator_out, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLogsDumpToFile "cudaLogsDumpToFile" (cudaLogIterator* iterator, const char* pathToFile, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLogsDumpToMemory "cudaLogsDumpToMemory" (cudaLogIterator* iterator, char* buffer, size_t* size, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphNodeGetContainingGraph "cudaGraphNodeGetContainingGraph" (cudaGraphNode_t hNode, cudaGraph_t* phGraph) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphNodeGetLocalId "cudaGraphNodeGetLocalId" (cudaGraphNode_t hNode, unsigned int* nodeId) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphNodeGetToolsId "cudaGraphNodeGetToolsId" (cudaGraphNode_t hNode, unsigned long long* toolsNodeId) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphGetId "cudaGraphGetId" (cudaGraph_t hGraph, unsigned int* graphID) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecGetId "cudaGraphExecGetId" (cudaGraphExec_t hGraphExec, unsigned int* graphID) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphConditionalHandleCreate_v2 "cudaGraphConditionalHandleCreate_v2" (cudaGraphConditionalHandle* pHandle_out, cudaGraph_t graph, cudaExecutionContext_t ctx, unsigned int defaultLaunchValue, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetDevResource "cudaDeviceGetDevResource" (int device, cudaDevResource* resource, cudaDevResourceType type) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDevSmResourceSplitByCount "cudaDevSmResourceSplitByCount" (cudaDevResource* result, unsigned int* nbGroups, const cudaDevResource* input, cudaDevResource* remaining, unsigned int flags, unsigned int minCount) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDevSmResourceSplit "cudaDevSmResourceSplit" (cudaDevResource* result, unsigned int nbGroups, const cudaDevResource* input, cudaDevResource* remainder, unsigned int flags, cudaDevSmResourceGroupParams* groupParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDevResourceGenerateDesc "cudaDevResourceGenerateDesc" (cudaDevResourceDesc_t* phDesc, cudaDevResource* resources, unsigned int nbResources) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGreenCtxCreate "cudaGreenCtxCreate" (cudaExecutionContext_t* phCtx, cudaDevResourceDesc_t desc, int device, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaExecutionCtxDestroy "cudaExecutionCtxDestroy" (cudaExecutionContext_t ctx) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaExecutionCtxGetDevResource "cudaExecutionCtxGetDevResource" (cudaExecutionContext_t ctx, cudaDevResource* resource, cudaDevResourceType type) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaExecutionCtxGetDevice "cudaExecutionCtxGetDevice" (int* device, cudaExecutionContext_t ctx) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaExecutionCtxGetId "cudaExecutionCtxGetId" (cudaExecutionContext_t ctx, unsigned long long* ctxId) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaExecutionCtxStreamCreate "cudaExecutionCtxStreamCreate" (cudaStream_t* phStream, cudaExecutionContext_t ctx, unsigned int flags, int priority) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaExecutionCtxSynchronize "cudaExecutionCtxSynchronize" (cudaExecutionContext_t ctx) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamGetDevResource "cudaStreamGetDevResource" (cudaStream_t hStream, cudaDevResource* resource, cudaDevResourceType type) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaExecutionCtxRecordEvent "cudaExecutionCtxRecordEvent" (cudaExecutionContext_t ctx, cudaEvent_t event) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaExecutionCtxWaitEvent "cudaExecutionCtxWaitEvent" (cudaExecutionContext_t ctx, cudaEvent_t event) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetExecutionCtx "cudaDeviceGetExecutionCtx" (cudaExecutionContext_t* ctx, int device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaFuncGetParamCount "cudaFuncGetParamCount" (const void* func, size_t* paramCount) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLaunchHostFunc_v2 "cudaLaunchHostFunc_v2" (cudaStream_t stream, cudaHostFn_t fn, void* userData, unsigned int syncMode) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpyWithAttributesAsync "cudaMemcpyWithAttributesAsync" (void* dst, const void* src, size_t size, cudaMemcpyAttributes* attr, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpy3DWithAttributesAsync "cudaMemcpy3DWithAttributesAsync" (cudaMemcpy3DBatchOp* op, unsigned long long flags, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphNodeGetParams "cudaGraphNodeGetParams" (cudaGraphNode_t node, cudaGraphNodeParams* nodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamBeginRecaptureToGraph "cudaStreamBeginRecaptureToGraph" (cudaStream_t stream, cudaStreamCaptureMode mode, cudaGraph_t graph, cudaGraphRecaptureCallbackData* callbackData) noexcept + + +############################################################################### +# Wrapper functions +############################################################################### + +cdef cudaError_t _cudaDeviceReset() except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceReset() + + +cdef cudaError_t _cudaDeviceSynchronize() except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceSynchronize() + + +cdef cudaError_t _cudaDeviceSetLimit(cudaLimit limit, size_t value) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceSetLimit(limit, value) + + +cdef cudaError_t _cudaDeviceGetLimit(size_t* pValue, cudaLimit limit) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceGetLimit(pValue, limit) + + +cdef cudaError_t _cudaDeviceGetTexture1DLinearMaxWidth(size_t* maxWidthInElements, const cudaChannelFormatDesc* fmtDesc, int device) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceGetTexture1DLinearMaxWidth(maxWidthInElements, fmtDesc, device) + + +cdef cudaError_t _cudaDeviceGetCacheConfig(cudaFuncCache* pCacheConfig) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceGetCacheConfig(pCacheConfig) + + +cdef cudaError_t _cudaDeviceGetStreamPriorityRange(int* leastPriority, int* greatestPriority) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceGetStreamPriorityRange(leastPriority, greatestPriority) + + +cdef cudaError_t _cudaDeviceSetCacheConfig(cudaFuncCache cacheConfig) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceSetCacheConfig(cacheConfig) + + +cdef cudaError_t _cudaDeviceGetByPCIBusId(int* device, const char* pciBusId) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceGetByPCIBusId(device, pciBusId) + + +cdef cudaError_t _cudaDeviceGetPCIBusId(char* pciBusId, int len, int device) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceGetPCIBusId(pciBusId, len, device) + + +cdef cudaError_t _cudaIpcGetEventHandle(cudaIpcEventHandle_t* handle, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaIpcGetEventHandle(handle, event) + + +cdef cudaError_t _cudaIpcOpenEventHandle(cudaEvent_t* event, cudaIpcEventHandle_t handle) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaIpcOpenEventHandle(event, handle) + + +cdef cudaError_t _cudaIpcGetMemHandle(cudaIpcMemHandle_t* handle, void* devPtr) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaIpcGetMemHandle(handle, devPtr) + + +cdef cudaError_t _cudaIpcOpenMemHandle(void** devPtr, cudaIpcMemHandle_t handle, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaIpcOpenMemHandle(devPtr, handle, flags) + + +cdef cudaError_t _cudaIpcCloseMemHandle(void* devPtr) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaIpcCloseMemHandle(devPtr) + + +cdef cudaError_t _cudaDeviceFlushGPUDirectRDMAWrites(cudaFlushGPUDirectRDMAWritesTarget target, cudaFlushGPUDirectRDMAWritesScope scope) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceFlushGPUDirectRDMAWrites(target, scope) + + +cdef cudaError_t _cudaDeviceRegisterAsyncNotification(int device, cudaAsyncCallback callbackFunc, void* userData, cudaAsyncCallbackHandle_t* callback) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceRegisterAsyncNotification(device, callbackFunc, userData, callback) + + +cdef cudaError_t _cudaDeviceUnregisterAsyncNotification(int device, cudaAsyncCallbackHandle_t callback) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceUnregisterAsyncNotification(device, callback) + + +cdef cudaError_t _cudaDeviceGetSharedMemConfig(cudaSharedMemConfig* pConfig) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceGetSharedMemConfig(pConfig) + + +cdef cudaError_t _cudaDeviceSetSharedMemConfig(cudaSharedMemConfig config) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceSetSharedMemConfig(config) + + +cdef cudaError_t _cudaGetLastError() except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGetLastError() + + +cdef cudaError_t _cudaPeekAtLastError() except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaPeekAtLastError() + + +cdef const char* _cudaGetErrorName(cudaError_t error) except?NULL nogil: + return _static_cudaGetErrorName(error) + + +cdef const char* _cudaGetErrorString(cudaError_t error) except?NULL nogil: + return _static_cudaGetErrorString(error) + + +cdef cudaError_t _cudaGetDeviceCount(int* count) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGetDeviceCount(count) + + +cdef cudaError_t _cudaDeviceGetAttribute(int* value, cudaDeviceAttr attr, int device) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceGetAttribute(value, attr, device) + + +cdef cudaError_t _cudaDeviceGetDefaultMemPool(cudaMemPool_t* memPool, int device) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceGetDefaultMemPool(memPool, device) + + +cdef cudaError_t _cudaDeviceSetMemPool(int device, cudaMemPool_t memPool) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceSetMemPool(device, memPool) + + +cdef cudaError_t _cudaDeviceGetMemPool(cudaMemPool_t* memPool, int device) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceGetMemPool(memPool, device) + + +cdef cudaError_t _cudaDeviceGetNvSciSyncAttributes(void* nvSciSyncAttrList, int device, int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceGetNvSciSyncAttributes(nvSciSyncAttrList, device, flags) + + +cdef cudaError_t _cudaDeviceGetP2PAttribute(int* value, cudaDeviceP2PAttr attr, int srcDevice, int dstDevice) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceGetP2PAttribute(value, attr, srcDevice, dstDevice) + + +cdef cudaError_t _cudaChooseDevice(int* device, const cudaDeviceProp* prop) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaChooseDevice(device, prop) + + +cdef cudaError_t _cudaInitDevice(int device, unsigned int deviceFlags, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaInitDevice(device, deviceFlags, flags) + + +cdef cudaError_t _cudaSetDevice(int device) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaSetDevice(device) + + +cdef cudaError_t _cudaGetDevice(int* device) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGetDevice(device) + + +cdef cudaError_t _cudaSetDeviceFlags(unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaSetDeviceFlags(flags) + + +cdef cudaError_t _cudaGetDeviceFlags(unsigned int* flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGetDeviceFlags(flags) + + +cdef cudaError_t _cudaStreamCreate(cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaStreamCreate(pStream) + + +cdef cudaError_t _cudaStreamCreateWithFlags(cudaStream_t* pStream, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaStreamCreateWithFlags(pStream, flags) + + +cdef cudaError_t _cudaStreamCreateWithPriority(cudaStream_t* pStream, unsigned int flags, int priority) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaStreamCreateWithPriority(pStream, flags, priority) + + +cdef cudaError_t _cudaStreamGetPriority(cudaStream_t hStream, int* priority) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaStreamGetPriority(hStream, priority) + + +cdef cudaError_t _cudaStreamGetFlags(cudaStream_t hStream, unsigned int* flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaStreamGetFlags(hStream, flags) + + +cdef cudaError_t _cudaStreamGetId(cudaStream_t hStream, unsigned long long* streamId) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaStreamGetId(hStream, streamId) + + +cdef cudaError_t _cudaStreamGetDevice(cudaStream_t hStream, int* device) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaStreamGetDevice(hStream, device) + + +cdef cudaError_t _cudaCtxResetPersistingL2Cache() except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaCtxResetPersistingL2Cache() + + +cdef cudaError_t _cudaStreamCopyAttributes(cudaStream_t dst, cudaStream_t src) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaStreamCopyAttributes(dst, src) + + +cdef cudaError_t _cudaStreamGetAttribute(cudaStream_t hStream, cudaStreamAttrID attr, cudaStreamAttrValue* value_out) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaStreamGetAttribute(hStream, attr, value_out) + + +cdef cudaError_t _cudaStreamSetAttribute(cudaStream_t hStream, cudaStreamAttrID attr, const cudaStreamAttrValue* value) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaStreamSetAttribute(hStream, attr, value) + + +cdef cudaError_t _cudaStreamDestroy(cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaStreamDestroy(stream) + + +cdef cudaError_t _cudaStreamWaitEvent(cudaStream_t stream, cudaEvent_t event, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaStreamWaitEvent(stream, event, flags) + + +cdef cudaError_t _cudaStreamAddCallback(cudaStream_t stream, cudaStreamCallback_t callback, void* userData, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaStreamAddCallback(stream, callback, userData, flags) + + +cdef cudaError_t _cudaStreamSynchronize(cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaStreamSynchronize(stream) + + +cdef cudaError_t _cudaStreamQuery(cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaStreamQuery(stream) + + +cdef cudaError_t _cudaStreamAttachMemAsync(cudaStream_t stream, void* devPtr, size_t length, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaStreamAttachMemAsync(stream, devPtr, length, flags) + + +cdef cudaError_t _cudaStreamBeginCapture(cudaStream_t stream, cudaStreamCaptureMode mode) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaStreamBeginCapture(stream, mode) + + +cdef cudaError_t _cudaStreamBeginCaptureToGraph(cudaStream_t stream, cudaGraph_t graph, const cudaGraphNode_t* dependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, cudaStreamCaptureMode mode) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaStreamBeginCaptureToGraph(stream, graph, dependencies, dependencyData, numDependencies, mode) + + +cdef cudaError_t _cudaThreadExchangeStreamCaptureMode(cudaStreamCaptureMode* mode) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaThreadExchangeStreamCaptureMode(mode) + + +cdef cudaError_t _cudaStreamEndCapture(cudaStream_t stream, cudaGraph_t* pGraph) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaStreamEndCapture(stream, pGraph) + + +cdef cudaError_t _cudaStreamIsCapturing(cudaStream_t stream, cudaStreamCaptureStatus* pCaptureStatus) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaStreamIsCapturing(stream, pCaptureStatus) + + +cdef cudaError_t _cudaStreamUpdateCaptureDependencies(cudaStream_t stream, cudaGraphNode_t* dependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaStreamUpdateCaptureDependencies(stream, dependencies, dependencyData, numDependencies, flags) + + +cdef cudaError_t _cudaEventCreate(cudaEvent_t* event) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaEventCreate(event) + + +cdef cudaError_t _cudaEventCreateWithFlags(cudaEvent_t* event, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaEventCreateWithFlags(event, flags) + + +cdef cudaError_t _cudaEventRecord(cudaEvent_t event, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaEventRecord(event, stream) + + +cdef cudaError_t _cudaEventRecordWithFlags(cudaEvent_t event, cudaStream_t stream, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaEventRecordWithFlags(event, stream, flags) + + +cdef cudaError_t _cudaEventQuery(cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaEventQuery(event) + + +cdef cudaError_t _cudaEventSynchronize(cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaEventSynchronize(event) + + +cdef cudaError_t _cudaEventDestroy(cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaEventDestroy(event) + + +cdef cudaError_t _cudaEventElapsedTime(float* ms, cudaEvent_t start, cudaEvent_t end) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaEventElapsedTime(ms, start, end) + + +cdef cudaError_t _cudaImportExternalMemory(cudaExternalMemory_t* extMem_out, const cudaExternalMemoryHandleDesc* memHandleDesc) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaImportExternalMemory(extMem_out, memHandleDesc) + + +cdef cudaError_t _cudaExternalMemoryGetMappedBuffer(void** devPtr, cudaExternalMemory_t extMem, const cudaExternalMemoryBufferDesc* bufferDesc) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaExternalMemoryGetMappedBuffer(devPtr, extMem, bufferDesc) + + +cdef cudaError_t _cudaExternalMemoryGetMappedMipmappedArray(cudaMipmappedArray_t* mipmap, cudaExternalMemory_t extMem, const cudaExternalMemoryMipmappedArrayDesc* mipmapDesc) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaExternalMemoryGetMappedMipmappedArray(mipmap, extMem, mipmapDesc) + + +cdef cudaError_t _cudaDestroyExternalMemory(cudaExternalMemory_t extMem) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDestroyExternalMemory(extMem) + + +cdef cudaError_t _cudaImportExternalSemaphore(cudaExternalSemaphore_t* extSem_out, const cudaExternalSemaphoreHandleDesc* semHandleDesc) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaImportExternalSemaphore(extSem_out, semHandleDesc) + + +cdef cudaError_t _cudaDestroyExternalSemaphore(cudaExternalSemaphore_t extSem) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDestroyExternalSemaphore(extSem) + + +cdef cudaError_t _cudaFuncSetCacheConfig(const void* func, cudaFuncCache cacheConfig) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaFuncSetCacheConfig(func, cacheConfig) + + +cdef cudaError_t _cudaFuncGetAttributes(cudaFuncAttributes* attr, const void* func) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaFuncGetAttributes(attr, func) + + +cdef cudaError_t _cudaFuncSetAttribute(const void* func, cudaFuncAttribute attr, int value) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaFuncSetAttribute(func, attr, value) + + +cdef cudaError_t _cudaFuncGetName(const char** name, const void* func) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaFuncGetName(name, func) + + +cdef cudaError_t _cudaFuncGetParamInfo(const void* func, size_t paramIndex, size_t* paramOffset, size_t* paramSize) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaFuncGetParamInfo(func, paramIndex, paramOffset, paramSize) + + +cdef cudaError_t _cudaLaunchHostFunc(cudaStream_t stream, cudaHostFn_t fn, void* userData) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaLaunchHostFunc(stream, fn, userData) + + +cdef cudaError_t _cudaFuncSetSharedMemConfig(const void* func, cudaSharedMemConfig config) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaFuncSetSharedMemConfig(func, config) + + +cdef cudaError_t _cudaOccupancyMaxActiveBlocksPerMultiprocessor(int* numBlocks, const void* func, int blockSize, size_t dynamicSMemSize) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaOccupancyMaxActiveBlocksPerMultiprocessor(numBlocks, func, blockSize, dynamicSMemSize) + + +cdef cudaError_t _cudaOccupancyAvailableDynamicSMemPerBlock(size_t* dynamicSmemSize, const void* func, int numBlocks, int blockSize) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaOccupancyAvailableDynamicSMemPerBlock(dynamicSmemSize, func, numBlocks, blockSize) + + +cdef cudaError_t _cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(int* numBlocks, const void* func, int blockSize, size_t dynamicSMemSize, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(numBlocks, func, blockSize, dynamicSMemSize, flags) + + +cdef cudaError_t _cudaMallocManaged(void** devPtr, size_t size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMallocManaged(devPtr, size, flags) + + +cdef cudaError_t _cudaMalloc(void** devPtr, size_t size) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMalloc(devPtr, size) + + +cdef cudaError_t _cudaMallocHost(void** ptr, size_t size) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMallocHost(ptr, size) + + +cdef cudaError_t _cudaMallocPitch(void** devPtr, size_t* pitch, size_t width, size_t height) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMallocPitch(devPtr, pitch, width, height) + + +cdef cudaError_t _cudaMallocArray(cudaArray_t* array, const cudaChannelFormatDesc* desc, size_t width, size_t height, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMallocArray(array, desc, width, height, flags) + + +cdef cudaError_t _cudaFree(void* devPtr) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaFree(devPtr) + + +cdef cudaError_t _cudaFreeHost(void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaFreeHost(ptr) + + +cdef cudaError_t _cudaFreeArray(cudaArray_t array) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaFreeArray(array) + + +cdef cudaError_t _cudaFreeMipmappedArray(cudaMipmappedArray_t mipmappedArray) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaFreeMipmappedArray(mipmappedArray) + + +cdef cudaError_t _cudaHostAlloc(void** pHost, size_t size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaHostAlloc(pHost, size, flags) + + +cdef cudaError_t _cudaHostRegister(void* ptr, size_t size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaHostRegister(ptr, size, flags) + + +cdef cudaError_t _cudaHostUnregister(void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaHostUnregister(ptr) + + +cdef cudaError_t _cudaHostGetDevicePointer(void** pDevice, void* pHost, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaHostGetDevicePointer(pDevice, pHost, flags) + + +cdef cudaError_t _cudaHostGetFlags(unsigned int* pFlags, void* pHost) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaHostGetFlags(pFlags, pHost) + + +cdef cudaError_t _cudaMalloc3D(cudaPitchedPtr* pitchedDevPtr, cudaExtent extent) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMalloc3D(pitchedDevPtr, extent) + + +cdef cudaError_t _cudaMalloc3DArray(cudaArray_t* array, const cudaChannelFormatDesc* desc, cudaExtent extent, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMalloc3DArray(array, desc, extent, flags) + + +cdef cudaError_t _cudaMallocMipmappedArray(cudaMipmappedArray_t* mipmappedArray, const cudaChannelFormatDesc* desc, cudaExtent extent, unsigned int numLevels, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMallocMipmappedArray(mipmappedArray, desc, extent, numLevels, flags) + + +cdef cudaError_t _cudaGetMipmappedArrayLevel(cudaArray_t* levelArray, cudaMipmappedArray_const_t mipmappedArray, unsigned int level) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGetMipmappedArrayLevel(levelArray, mipmappedArray, level) + + +cdef cudaError_t _cudaMemcpy3D(const cudaMemcpy3DParms* p) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemcpy3D(p) + + +cdef cudaError_t _cudaMemcpy3DPeer(const cudaMemcpy3DPeerParms* p) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemcpy3DPeer(p) + + +cdef cudaError_t _cudaMemcpy3DAsync(const cudaMemcpy3DParms* p, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemcpy3DAsync(p, stream) + + +cdef cudaError_t _cudaMemcpy3DPeerAsync(const cudaMemcpy3DPeerParms* p, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemcpy3DPeerAsync(p, stream) + + +cdef cudaError_t _cudaMemGetInfo(size_t* free, size_t* total) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemGetInfo(free, total) + + +cdef cudaError_t _cudaArrayGetInfo(cudaChannelFormatDesc* desc, cudaExtent* extent, unsigned int* flags, cudaArray_t array) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaArrayGetInfo(desc, extent, flags, array) + + +cdef cudaError_t _cudaArrayGetPlane(cudaArray_t* pPlaneArray, cudaArray_t hArray, unsigned int planeIdx) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaArrayGetPlane(pPlaneArray, hArray, planeIdx) + + +cdef cudaError_t _cudaArrayGetMemoryRequirements(cudaArrayMemoryRequirements* memoryRequirements, cudaArray_t array, int device) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaArrayGetMemoryRequirements(memoryRequirements, array, device) + + +cdef cudaError_t _cudaMipmappedArrayGetMemoryRequirements(cudaArrayMemoryRequirements* memoryRequirements, cudaMipmappedArray_t mipmap, int device) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMipmappedArrayGetMemoryRequirements(memoryRequirements, mipmap, device) + + +cdef cudaError_t _cudaArrayGetSparseProperties(cudaArraySparseProperties* sparseProperties, cudaArray_t array) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaArrayGetSparseProperties(sparseProperties, array) + + +cdef cudaError_t _cudaMipmappedArrayGetSparseProperties(cudaArraySparseProperties* sparseProperties, cudaMipmappedArray_t mipmap) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMipmappedArrayGetSparseProperties(sparseProperties, mipmap) + + +cdef cudaError_t _cudaMemcpy(void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemcpy(dst, src, count, kind) + + +cdef cudaError_t _cudaMemcpyPeer(void* dst, int dstDevice, const void* src, int srcDevice, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemcpyPeer(dst, dstDevice, src, srcDevice, count) + + +cdef cudaError_t _cudaMemcpy2D(void* dst, size_t dpitch, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemcpy2D(dst, dpitch, src, spitch, width, height, kind) + + +cdef cudaError_t _cudaMemcpy2DToArray(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemcpy2DToArray(dst, wOffset, hOffset, src, spitch, width, height, kind) + + +cdef cudaError_t _cudaMemcpy2DFromArray(void* dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemcpy2DFromArray(dst, dpitch, src, wOffset, hOffset, width, height, kind) + + +cdef cudaError_t _cudaMemcpy2DArrayToArray(cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemcpy2DArrayToArray(dst, wOffsetDst, hOffsetDst, src, wOffsetSrc, hOffsetSrc, width, height, kind) + + +cdef cudaError_t _cudaMemcpyAsync(void* dst, const void* src, size_t count, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemcpyAsync(dst, src, count, kind, stream) + + +cdef cudaError_t _cudaMemcpyPeerAsync(void* dst, int dstDevice, const void* src, int srcDevice, size_t count, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemcpyPeerAsync(dst, dstDevice, src, srcDevice, count, stream) + + +cdef cudaError_t _cudaMemcpyBatchAsync(const void** dsts, const void** srcs, const size_t* sizes, size_t count, cudaMemcpyAttributes* attrs, size_t* attrsIdxs, size_t numAttrs, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemcpyBatchAsync(dsts, srcs, sizes, count, attrs, attrsIdxs, numAttrs, stream) + + +cdef cudaError_t _cudaMemcpy3DBatchAsync(size_t numOps, cudaMemcpy3DBatchOp* opList, unsigned long long flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemcpy3DBatchAsync(numOps, opList, flags, stream) + + +cdef cudaError_t _cudaMemcpy2DAsync(void* dst, size_t dpitch, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemcpy2DAsync(dst, dpitch, src, spitch, width, height, kind, stream) + + +cdef cudaError_t _cudaMemcpy2DToArrayAsync(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemcpy2DToArrayAsync(dst, wOffset, hOffset, src, spitch, width, height, kind, stream) + + +cdef cudaError_t _cudaMemcpy2DFromArrayAsync(void* dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemcpy2DFromArrayAsync(dst, dpitch, src, wOffset, hOffset, width, height, kind, stream) + + +cdef cudaError_t _cudaMemset(void* devPtr, int value, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemset(devPtr, value, count) + + +cdef cudaError_t _cudaMemset2D(void* devPtr, size_t pitch, int value, size_t width, size_t height) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemset2D(devPtr, pitch, value, width, height) + + +cdef cudaError_t _cudaMemset3D(cudaPitchedPtr pitchedDevPtr, int value, cudaExtent extent) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemset3D(pitchedDevPtr, value, extent) + + +cdef cudaError_t _cudaMemsetAsync(void* devPtr, int value, size_t count, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemsetAsync(devPtr, value, count, stream) + + +cdef cudaError_t _cudaMemset2DAsync(void* devPtr, size_t pitch, int value, size_t width, size_t height, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemset2DAsync(devPtr, pitch, value, width, height, stream) + + +cdef cudaError_t _cudaMemset3DAsync(cudaPitchedPtr pitchedDevPtr, int value, cudaExtent extent, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemset3DAsync(pitchedDevPtr, value, extent, stream) + + +cdef cudaError_t _cudaMemPrefetchAsync(const void* devPtr, size_t count, cudaMemLocation location, unsigned int flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemPrefetchAsync(devPtr, count, location, flags, stream) + + +cdef cudaError_t _cudaMemAdvise(const void* devPtr, size_t count, cudaMemoryAdvise advice, cudaMemLocation location) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemAdvise(devPtr, count, advice, location) + + +cdef cudaError_t _cudaMemRangeGetAttribute(void* data, size_t dataSize, cudaMemRangeAttribute attribute, const void* devPtr, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemRangeGetAttribute(data, dataSize, attribute, devPtr, count) + + +cdef cudaError_t _cudaMemRangeGetAttributes(void** data, size_t* dataSizes, cudaMemRangeAttribute* attributes, size_t numAttributes, const void* devPtr, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemRangeGetAttributes(data, dataSizes, attributes, numAttributes, devPtr, count) + + +cdef cudaError_t _cudaMemcpyToArray(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemcpyToArray(dst, wOffset, hOffset, src, count, kind) + + +cdef cudaError_t _cudaMemcpyFromArray(void* dst, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemcpyFromArray(dst, src, wOffset, hOffset, count, kind) + + +cdef cudaError_t _cudaMemcpyArrayToArray(cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemcpyArrayToArray(dst, wOffsetDst, hOffsetDst, src, wOffsetSrc, hOffsetSrc, count, kind) + + +cdef cudaError_t _cudaMemcpyToArrayAsync(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t count, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemcpyToArrayAsync(dst, wOffset, hOffset, src, count, kind, stream) + + +cdef cudaError_t _cudaMemcpyFromArrayAsync(void* dst, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemcpyFromArrayAsync(dst, src, wOffset, hOffset, count, kind, stream) + + +cdef cudaError_t _cudaMallocAsync(void** devPtr, size_t size, cudaStream_t hStream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMallocAsync(devPtr, size, hStream) + + +cdef cudaError_t _cudaFreeAsync(void* devPtr, cudaStream_t hStream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaFreeAsync(devPtr, hStream) + + +cdef cudaError_t _cudaMemPoolTrimTo(cudaMemPool_t memPool, size_t minBytesToKeep) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemPoolTrimTo(memPool, minBytesToKeep) + + +cdef cudaError_t _cudaMemPoolSetAttribute(cudaMemPool_t memPool, cudaMemPoolAttr attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemPoolSetAttribute(memPool, attr, value) + + +cdef cudaError_t _cudaMemPoolGetAttribute(cudaMemPool_t memPool, cudaMemPoolAttr attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemPoolGetAttribute(memPool, attr, value) + + +cdef cudaError_t _cudaMemPoolSetAccess(cudaMemPool_t memPool, const cudaMemAccessDesc* descList, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemPoolSetAccess(memPool, descList, count) + + +cdef cudaError_t _cudaMemPoolGetAccess(cudaMemAccessFlags* flags, cudaMemPool_t memPool, cudaMemLocation* location) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemPoolGetAccess(flags, memPool, location) + + +cdef cudaError_t _cudaMemPoolCreate(cudaMemPool_t* memPool, const cudaMemPoolProps* poolProps) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemPoolCreate(memPool, poolProps) + + +cdef cudaError_t _cudaMemPoolDestroy(cudaMemPool_t memPool) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemPoolDestroy(memPool) + + +cdef cudaError_t _cudaMallocFromPoolAsync(void** ptr, size_t size, cudaMemPool_t memPool, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMallocFromPoolAsync(ptr, size, memPool, stream) + + +cdef cudaError_t _cudaMemPoolExportToShareableHandle(void* shareableHandle, cudaMemPool_t memPool, cudaMemAllocationHandleType handleType, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemPoolExportToShareableHandle(shareableHandle, memPool, handleType, flags) + + +cdef cudaError_t _cudaMemPoolImportFromShareableHandle(cudaMemPool_t* memPool, void* shareableHandle, cudaMemAllocationHandleType handleType, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemPoolImportFromShareableHandle(memPool, shareableHandle, handleType, flags) + + +cdef cudaError_t _cudaMemPoolExportPointer(cudaMemPoolPtrExportData* exportData, void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemPoolExportPointer(exportData, ptr) + + +cdef cudaError_t _cudaMemPoolImportPointer(void** ptr, cudaMemPool_t memPool, cudaMemPoolPtrExportData* exportData) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemPoolImportPointer(ptr, memPool, exportData) + + +cdef cudaError_t _cudaPointerGetAttributes(cudaPointerAttributes* attributes, const void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaPointerGetAttributes(attributes, ptr) + + +cdef cudaError_t _cudaDeviceCanAccessPeer(int* canAccessPeer, int device, int peerDevice) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceCanAccessPeer(canAccessPeer, device, peerDevice) + + +cdef cudaError_t _cudaDeviceEnablePeerAccess(int peerDevice, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceEnablePeerAccess(peerDevice, flags) + + +cdef cudaError_t _cudaDeviceDisablePeerAccess(int peerDevice) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceDisablePeerAccess(peerDevice) + + +cdef cudaError_t _cudaGraphicsUnregisterResource(cudaGraphicsResource_t resource) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphicsUnregisterResource(resource) + + +cdef cudaError_t _cudaGraphicsResourceSetMapFlags(cudaGraphicsResource_t resource, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphicsResourceSetMapFlags(resource, flags) + + +cdef cudaError_t _cudaGraphicsMapResources(int count, cudaGraphicsResource_t* resources, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphicsMapResources(count, resources, stream) + + +cdef cudaError_t _cudaGraphicsUnmapResources(int count, cudaGraphicsResource_t* resources, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphicsUnmapResources(count, resources, stream) + + +cdef cudaError_t _cudaGraphicsResourceGetMappedPointer(void** devPtr, size_t* size, cudaGraphicsResource_t resource) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphicsResourceGetMappedPointer(devPtr, size, resource) + + +cdef cudaError_t _cudaGraphicsSubResourceGetMappedArray(cudaArray_t* array, cudaGraphicsResource_t resource, unsigned int arrayIndex, unsigned int mipLevel) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphicsSubResourceGetMappedArray(array, resource, arrayIndex, mipLevel) + + +cdef cudaError_t _cudaGraphicsResourceGetMappedMipmappedArray(cudaMipmappedArray_t* mipmappedArray, cudaGraphicsResource_t resource) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphicsResourceGetMappedMipmappedArray(mipmappedArray, resource) + + +cdef cudaError_t _cudaGetChannelDesc(cudaChannelFormatDesc* desc, cudaArray_const_t array) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGetChannelDesc(desc, array) + + +cdef cudaChannelFormatDesc _cudaCreateChannelDesc(int x, int y, int z, int w, cudaChannelFormatKind f) except* nogil: + return _static_cudaCreateChannelDesc(x, y, z, w, f) + + +cdef cudaError_t _cudaCreateTextureObject(cudaTextureObject_t* pTexObject, const cudaResourceDesc* pResDesc, const cudaTextureDesc* pTexDesc, const cudaResourceViewDesc* pResViewDesc) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaCreateTextureObject(pTexObject, pResDesc, pTexDesc, pResViewDesc) + + +cdef cudaError_t _cudaDestroyTextureObject(cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDestroyTextureObject(texObject) + + +cdef cudaError_t _cudaGetTextureObjectResourceDesc(cudaResourceDesc* pResDesc, cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGetTextureObjectResourceDesc(pResDesc, texObject) + + +cdef cudaError_t _cudaGetTextureObjectTextureDesc(cudaTextureDesc* pTexDesc, cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGetTextureObjectTextureDesc(pTexDesc, texObject) + + +cdef cudaError_t _cudaGetTextureObjectResourceViewDesc(cudaResourceViewDesc* pResViewDesc, cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGetTextureObjectResourceViewDesc(pResViewDesc, texObject) + + +cdef cudaError_t _cudaCreateSurfaceObject(cudaSurfaceObject_t* pSurfObject, const cudaResourceDesc* pResDesc) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaCreateSurfaceObject(pSurfObject, pResDesc) + + +cdef cudaError_t _cudaDestroySurfaceObject(cudaSurfaceObject_t surfObject) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDestroySurfaceObject(surfObject) + + +cdef cudaError_t _cudaGetSurfaceObjectResourceDesc(cudaResourceDesc* pResDesc, cudaSurfaceObject_t surfObject) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGetSurfaceObjectResourceDesc(pResDesc, surfObject) + + +cdef cudaError_t _cudaDriverGetVersion(int* driverVersion) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDriverGetVersion(driverVersion) + + +cdef cudaError_t _cudaRuntimeGetVersion(int* runtimeVersion) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaRuntimeGetVersion(runtimeVersion) + + +cdef cudaError_t _cudaGraphCreate(cudaGraph_t* pGraph, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphCreate(pGraph, flags) + + +cdef cudaError_t _cudaGraphAddKernelNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphAddKernelNode(pGraphNode, graph, pDependencies, numDependencies, pNodeParams) + + +cdef cudaError_t _cudaGraphKernelNodeGetParams(cudaGraphNode_t node, cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphKernelNodeGetParams(node, pNodeParams) + + +cdef cudaError_t _cudaGraphKernelNodeSetParams(cudaGraphNode_t node, const cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphKernelNodeSetParams(node, pNodeParams) + + +cdef cudaError_t _cudaGraphKernelNodeCopyAttributes(cudaGraphNode_t hDst, cudaGraphNode_t hSrc) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphKernelNodeCopyAttributes(hDst, hSrc) + + +cdef cudaError_t _cudaGraphKernelNodeGetAttribute(cudaGraphNode_t hNode, cudaKernelNodeAttrID attr, cudaKernelNodeAttrValue* value_out) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphKernelNodeGetAttribute(hNode, attr, value_out) + + +cdef cudaError_t _cudaGraphKernelNodeSetAttribute(cudaGraphNode_t hNode, cudaKernelNodeAttrID attr, const cudaKernelNodeAttrValue* value) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphKernelNodeSetAttribute(hNode, attr, value) + + +cdef cudaError_t _cudaGraphAddMemcpyNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaMemcpy3DParms* pCopyParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphAddMemcpyNode(pGraphNode, graph, pDependencies, numDependencies, pCopyParams) + + +cdef cudaError_t _cudaGraphAddMemcpyNode1D(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphAddMemcpyNode1D(pGraphNode, graph, pDependencies, numDependencies, dst, src, count, kind) + + +cdef cudaError_t _cudaGraphMemcpyNodeGetParams(cudaGraphNode_t node, cudaMemcpy3DParms* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphMemcpyNodeGetParams(node, pNodeParams) + + +cdef cudaError_t _cudaGraphMemcpyNodeSetParams(cudaGraphNode_t node, const cudaMemcpy3DParms* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphMemcpyNodeSetParams(node, pNodeParams) + + +cdef cudaError_t _cudaGraphMemcpyNodeSetParams1D(cudaGraphNode_t node, void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphMemcpyNodeSetParams1D(node, dst, src, count, kind) + + +cdef cudaError_t _cudaGraphAddMemsetNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaMemsetParams* pMemsetParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphAddMemsetNode(pGraphNode, graph, pDependencies, numDependencies, pMemsetParams) + + +cdef cudaError_t _cudaGraphMemsetNodeGetParams(cudaGraphNode_t node, cudaMemsetParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphMemsetNodeGetParams(node, pNodeParams) + + +cdef cudaError_t _cudaGraphMemsetNodeSetParams(cudaGraphNode_t node, const cudaMemsetParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphMemsetNodeSetParams(node, pNodeParams) + + +cdef cudaError_t _cudaGraphAddHostNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphAddHostNode(pGraphNode, graph, pDependencies, numDependencies, pNodeParams) + + +cdef cudaError_t _cudaGraphHostNodeGetParams(cudaGraphNode_t node, cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphHostNodeGetParams(node, pNodeParams) + + +cdef cudaError_t _cudaGraphHostNodeSetParams(cudaGraphNode_t node, const cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphHostNodeSetParams(node, pNodeParams) + + +cdef cudaError_t _cudaGraphAddChildGraphNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaGraph_t childGraph) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphAddChildGraphNode(pGraphNode, graph, pDependencies, numDependencies, childGraph) + + +cdef cudaError_t _cudaGraphChildGraphNodeGetGraph(cudaGraphNode_t node, cudaGraph_t* pGraph) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphChildGraphNodeGetGraph(node, pGraph) + + +cdef cudaError_t _cudaGraphAddEmptyNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphAddEmptyNode(pGraphNode, graph, pDependencies, numDependencies) + + +cdef cudaError_t _cudaGraphAddEventRecordNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphAddEventRecordNode(pGraphNode, graph, pDependencies, numDependencies, event) + + +cdef cudaError_t _cudaGraphEventRecordNodeGetEvent(cudaGraphNode_t node, cudaEvent_t* event_out) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphEventRecordNodeGetEvent(node, event_out) + + +cdef cudaError_t _cudaGraphEventRecordNodeSetEvent(cudaGraphNode_t node, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphEventRecordNodeSetEvent(node, event) + + +cdef cudaError_t _cudaGraphAddEventWaitNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphAddEventWaitNode(pGraphNode, graph, pDependencies, numDependencies, event) + + +cdef cudaError_t _cudaGraphEventWaitNodeGetEvent(cudaGraphNode_t node, cudaEvent_t* event_out) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphEventWaitNodeGetEvent(node, event_out) + + +cdef cudaError_t _cudaGraphEventWaitNodeSetEvent(cudaGraphNode_t node, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphEventWaitNodeSetEvent(node, event) + + +cdef cudaError_t _cudaGraphAddExternalSemaphoresSignalNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphAddExternalSemaphoresSignalNode(pGraphNode, graph, pDependencies, numDependencies, nodeParams) + + +cdef cudaError_t _cudaGraphExternalSemaphoresSignalNodeGetParams(cudaGraphNode_t hNode, cudaExternalSemaphoreSignalNodeParams* params_out) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphExternalSemaphoresSignalNodeGetParams(hNode, params_out) + + +cdef cudaError_t _cudaGraphExternalSemaphoresSignalNodeSetParams(cudaGraphNode_t hNode, const cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphExternalSemaphoresSignalNodeSetParams(hNode, nodeParams) + + +cdef cudaError_t _cudaGraphAddExternalSemaphoresWaitNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphAddExternalSemaphoresWaitNode(pGraphNode, graph, pDependencies, numDependencies, nodeParams) + + +cdef cudaError_t _cudaGraphExternalSemaphoresWaitNodeGetParams(cudaGraphNode_t hNode, cudaExternalSemaphoreWaitNodeParams* params_out) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphExternalSemaphoresWaitNodeGetParams(hNode, params_out) + + +cdef cudaError_t _cudaGraphExternalSemaphoresWaitNodeSetParams(cudaGraphNode_t hNode, const cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphExternalSemaphoresWaitNodeSetParams(hNode, nodeParams) + + +cdef cudaError_t _cudaGraphAddMemAllocNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaMemAllocNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphAddMemAllocNode(pGraphNode, graph, pDependencies, numDependencies, nodeParams) + + +cdef cudaError_t _cudaGraphMemAllocNodeGetParams(cudaGraphNode_t node, cudaMemAllocNodeParams* params_out) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphMemAllocNodeGetParams(node, params_out) + + +cdef cudaError_t _cudaGraphAddMemFreeNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, void* dptr) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphAddMemFreeNode(pGraphNode, graph, pDependencies, numDependencies, dptr) + + +cdef cudaError_t _cudaGraphMemFreeNodeGetParams(cudaGraphNode_t node, void* dptr_out) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphMemFreeNodeGetParams(node, dptr_out) + + +cdef cudaError_t _cudaDeviceGraphMemTrim(int device) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceGraphMemTrim(device) + + +cdef cudaError_t _cudaDeviceGetGraphMemAttribute(int device, cudaGraphMemAttributeType attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceGetGraphMemAttribute(device, attr, value) + + +cdef cudaError_t _cudaDeviceSetGraphMemAttribute(int device, cudaGraphMemAttributeType attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceSetGraphMemAttribute(device, attr, value) + + +cdef cudaError_t _cudaGraphClone(cudaGraph_t* pGraphClone, cudaGraph_t originalGraph) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphClone(pGraphClone, originalGraph) + + +cdef cudaError_t _cudaGraphNodeFindInClone(cudaGraphNode_t* pNode, cudaGraphNode_t originalNode, cudaGraph_t clonedGraph) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphNodeFindInClone(pNode, originalNode, clonedGraph) + + +cdef cudaError_t _cudaGraphNodeGetType(cudaGraphNode_t node, cudaGraphNodeType* pType) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphNodeGetType(node, pType) + + +cdef cudaError_t _cudaGraphGetNodes(cudaGraph_t graph, cudaGraphNode_t* nodes, size_t* numNodes) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphGetNodes(graph, nodes, numNodes) + + +cdef cudaError_t _cudaGraphGetRootNodes(cudaGraph_t graph, cudaGraphNode_t* pRootNodes, size_t* pNumRootNodes) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphGetRootNodes(graph, pRootNodes, pNumRootNodes) + + +cdef cudaError_t _cudaGraphGetEdges(cudaGraph_t graph, cudaGraphNode_t* from_, cudaGraphNode_t* to, cudaGraphEdgeData* edgeData, size_t* numEdges) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphGetEdges(graph, from_, to, edgeData, numEdges) + + +cdef cudaError_t _cudaGraphNodeGetDependencies(cudaGraphNode_t node, cudaGraphNode_t* pDependencies, cudaGraphEdgeData* edgeData, size_t* pNumDependencies) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphNodeGetDependencies(node, pDependencies, edgeData, pNumDependencies) + + +cdef cudaError_t _cudaGraphNodeGetDependentNodes(cudaGraphNode_t node, cudaGraphNode_t* pDependentNodes, cudaGraphEdgeData* edgeData, size_t* pNumDependentNodes) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphNodeGetDependentNodes(node, pDependentNodes, edgeData, pNumDependentNodes) + + +cdef cudaError_t _cudaGraphAddDependencies(cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, const cudaGraphEdgeData* edgeData, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphAddDependencies(graph, from_, to, edgeData, numDependencies) + + +cdef cudaError_t _cudaGraphRemoveDependencies(cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, const cudaGraphEdgeData* edgeData, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphRemoveDependencies(graph, from_, to, edgeData, numDependencies) + + +cdef cudaError_t _cudaGraphDestroyNode(cudaGraphNode_t node) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphDestroyNode(node) + + +cdef cudaError_t _cudaGraphInstantiate(cudaGraphExec_t* pGraphExec, cudaGraph_t graph, unsigned long long flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphInstantiate(pGraphExec, graph, flags) + + +cdef cudaError_t _cudaGraphInstantiateWithFlags(cudaGraphExec_t* pGraphExec, cudaGraph_t graph, unsigned long long flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphInstantiateWithFlags(pGraphExec, graph, flags) + + +cdef cudaError_t _cudaGraphInstantiateWithParams(cudaGraphExec_t* pGraphExec, cudaGraph_t graph, cudaGraphInstantiateParams* instantiateParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphInstantiateWithParams(pGraphExec, graph, instantiateParams) + + +cdef cudaError_t _cudaGraphExecGetFlags(cudaGraphExec_t graphExec, unsigned long long* flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphExecGetFlags(graphExec, flags) + + +cdef cudaError_t _cudaGraphExecKernelNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphExecKernelNodeSetParams(hGraphExec, node, pNodeParams) + + +cdef cudaError_t _cudaGraphExecMemcpyNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaMemcpy3DParms* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphExecMemcpyNodeSetParams(hGraphExec, node, pNodeParams) + + +cdef cudaError_t _cudaGraphExecMemcpyNodeSetParams1D(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphExecMemcpyNodeSetParams1D(hGraphExec, node, dst, src, count, kind) + + +cdef cudaError_t _cudaGraphExecMemsetNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaMemsetParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphExecMemsetNodeSetParams(hGraphExec, node, pNodeParams) + + +cdef cudaError_t _cudaGraphExecHostNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphExecHostNodeSetParams(hGraphExec, node, pNodeParams) + + +cdef cudaError_t _cudaGraphExecChildGraphNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, cudaGraph_t childGraph) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphExecChildGraphNodeSetParams(hGraphExec, node, childGraph) + + +cdef cudaError_t _cudaGraphExecEventRecordNodeSetEvent(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphExecEventRecordNodeSetEvent(hGraphExec, hNode, event) + + +cdef cudaError_t _cudaGraphExecEventWaitNodeSetEvent(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphExecEventWaitNodeSetEvent(hGraphExec, hNode, event) + + +cdef cudaError_t _cudaGraphExecExternalSemaphoresSignalNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, const cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphExecExternalSemaphoresSignalNodeSetParams(hGraphExec, hNode, nodeParams) + + +cdef cudaError_t _cudaGraphExecExternalSemaphoresWaitNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, const cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphExecExternalSemaphoresWaitNodeSetParams(hGraphExec, hNode, nodeParams) + + +cdef cudaError_t _cudaGraphNodeSetEnabled(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, unsigned int isEnabled) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphNodeSetEnabled(hGraphExec, hNode, isEnabled) + + +cdef cudaError_t _cudaGraphNodeGetEnabled(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, unsigned int* isEnabled) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphNodeGetEnabled(hGraphExec, hNode, isEnabled) + + +cdef cudaError_t _cudaGraphExecUpdate(cudaGraphExec_t hGraphExec, cudaGraph_t hGraph, cudaGraphExecUpdateResultInfo* resultInfo) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphExecUpdate(hGraphExec, hGraph, resultInfo) + + +cdef cudaError_t _cudaGraphUpload(cudaGraphExec_t graphExec, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphUpload(graphExec, stream) + + +cdef cudaError_t _cudaGraphLaunch(cudaGraphExec_t graphExec, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphLaunch(graphExec, stream) + + +cdef cudaError_t _cudaGraphExecDestroy(cudaGraphExec_t graphExec) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphExecDestroy(graphExec) + + +cdef cudaError_t _cudaGraphDestroy(cudaGraph_t graph) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphDestroy(graph) + + +cdef cudaError_t _cudaGraphDebugDotPrint(cudaGraph_t graph, const char* path, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphDebugDotPrint(graph, path, flags) + + +cdef cudaError_t _cudaUserObjectCreate(cudaUserObject_t* object_out, void* ptr, cudaHostFn_t destroy, unsigned int initialRefcount, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaUserObjectCreate(object_out, ptr, destroy, initialRefcount, flags) + + +cdef cudaError_t _cudaUserObjectRetain(cudaUserObject_t object, unsigned int count) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaUserObjectRetain(object, count) + + +cdef cudaError_t _cudaUserObjectRelease(cudaUserObject_t object, unsigned int count) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaUserObjectRelease(object, count) + + +cdef cudaError_t _cudaGraphRetainUserObject(cudaGraph_t graph, cudaUserObject_t object, unsigned int count, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphRetainUserObject(graph, object, count, flags) + + +cdef cudaError_t _cudaGraphReleaseUserObject(cudaGraph_t graph, cudaUserObject_t object, unsigned int count) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphReleaseUserObject(graph, object, count) + + +cdef cudaError_t _cudaGraphAddNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphAddNode(pGraphNode, graph, pDependencies, dependencyData, numDependencies, nodeParams) + + +cdef cudaError_t _cudaGraphNodeSetParams(cudaGraphNode_t node, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphNodeSetParams(node, nodeParams) + + +cdef cudaError_t _cudaGraphExecNodeSetParams(cudaGraphExec_t graphExec, cudaGraphNode_t node, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphExecNodeSetParams(graphExec, node, nodeParams) + + +cdef cudaError_t _cudaGraphConditionalHandleCreate(cudaGraphConditionalHandle* pHandle_out, cudaGraph_t graph, unsigned int defaultLaunchValue, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphConditionalHandleCreate(pHandle_out, graph, defaultLaunchValue, flags) + + +cdef cudaError_t _cudaGetDriverEntryPoint(const char* symbol, void** funcPtr, unsigned long long flags, cudaDriverEntryPointQueryResult* driverStatus) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGetDriverEntryPoint(symbol, funcPtr, flags, driverStatus) + + +cdef cudaError_t _cudaGetDriverEntryPointByVersion(const char* symbol, void** funcPtr, unsigned int cudaVersion, unsigned long long flags, cudaDriverEntryPointQueryResult* driverStatus) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGetDriverEntryPointByVersion(symbol, funcPtr, cudaVersion, flags, driverStatus) + + +cdef cudaError_t _cudaLibraryLoadData(cudaLibrary_t* library, const void* code, cudaJitOption* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, cudaLibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaLibraryLoadData(library, code, jitOptions, jitOptionsValues, numJitOptions, libraryOptions, libraryOptionValues, numLibraryOptions) + + +cdef cudaError_t _cudaLibraryLoadFromFile(cudaLibrary_t* library, const char* fileName, cudaJitOption* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, cudaLibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaLibraryLoadFromFile(library, fileName, jitOptions, jitOptionsValues, numJitOptions, libraryOptions, libraryOptionValues, numLibraryOptions) + + +cdef cudaError_t _cudaLibraryUnload(cudaLibrary_t library) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaLibraryUnload(library) + + +cdef cudaError_t _cudaLibraryGetKernel(cudaKernel_t* pKernel, cudaLibrary_t library, const char* name) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaLibraryGetKernel(pKernel, library, name) + + +cdef cudaError_t _cudaLibraryGetGlobal(void** dptr, size_t* bytes, cudaLibrary_t library, const char* name) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaLibraryGetGlobal(dptr, bytes, library, name) + + +cdef cudaError_t _cudaLibraryGetManaged(void** dptr, size_t* bytes, cudaLibrary_t library, const char* name) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaLibraryGetManaged(dptr, bytes, library, name) + + +cdef cudaError_t _cudaLibraryGetUnifiedFunction(void** fptr, cudaLibrary_t library, const char* symbol) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaLibraryGetUnifiedFunction(fptr, library, symbol) + + +cdef cudaError_t _cudaLibraryGetKernelCount(unsigned int* count, cudaLibrary_t lib) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaLibraryGetKernelCount(count, lib) + + +cdef cudaError_t _cudaLibraryEnumerateKernels(cudaKernel_t* kernels, unsigned int numKernels, cudaLibrary_t lib) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaLibraryEnumerateKernels(kernels, numKernels, lib) + + +cdef cudaError_t _cudaKernelSetAttributeForDevice(cudaKernel_t kernel, cudaFuncAttribute attr, int value, int device) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaKernelSetAttributeForDevice(kernel, attr, value, device) + + +cdef cudaError_t _cudaGetExportTable(const void** ppExportTable, const cudaUUID_t* pExportTableId) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGetExportTable(ppExportTable, pExportTableId) + + +cdef cudaError_t _cudaGetKernel(cudaKernel_t* kernelPtr, const void* entryFuncAddr) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGetKernel(kernelPtr, entryFuncAddr) + + +cdef cudaError_t _cudaProfilerStart() except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaProfilerStart() + + +cdef cudaError_t _cudaProfilerStop() except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaProfilerStop() + + +cdef cudaError_t _cudaGetDeviceProperties(cudaDeviceProp* prop, int device) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGetDeviceProperties(prop, device) + + +cdef cudaError_t _cudaDeviceGetHostAtomicCapabilities(unsigned int* capabilities, const cudaAtomicOperation* operations, unsigned int count, int device) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceGetHostAtomicCapabilities(capabilities, operations, count, device) + + +cdef cudaError_t _cudaDeviceGetP2PAtomicCapabilities(unsigned int* capabilities, const cudaAtomicOperation* operations, unsigned int count, int srcDevice, int dstDevice) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceGetP2PAtomicCapabilities(capabilities, operations, count, srcDevice, dstDevice) + + +cdef cudaError_t _cudaStreamGetCaptureInfo(cudaStream_t stream, cudaStreamCaptureStatus* captureStatus_out, unsigned long long* id_out, cudaGraph_t* graph_out, const cudaGraphNode_t** dependencies_out, const cudaGraphEdgeData** edgeData_out, size_t* numDependencies_out) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaStreamGetCaptureInfo(stream, captureStatus_out, id_out, graph_out, dependencies_out, edgeData_out, numDependencies_out) + + +cdef cudaError_t _cudaSignalExternalSemaphoresAsync(const cudaExternalSemaphore_t* extSemArray, const cudaExternalSemaphoreSignalParams* paramsArray, unsigned int numExtSems, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaSignalExternalSemaphoresAsync(extSemArray, paramsArray, numExtSems, stream) + + +cdef cudaError_t _cudaWaitExternalSemaphoresAsync(const cudaExternalSemaphore_t* extSemArray, const cudaExternalSemaphoreWaitParams* paramsArray, unsigned int numExtSems, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaWaitExternalSemaphoresAsync(extSemArray, paramsArray, numExtSems, stream) + + +cdef cudaError_t _cudaMemPrefetchBatchAsync(void** dptrs, size_t* sizes, size_t count, cudaMemLocation* prefetchLocs, size_t* prefetchLocIdxs, size_t numPrefetchLocs, unsigned long long flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemPrefetchBatchAsync(dptrs, sizes, count, prefetchLocs, prefetchLocIdxs, numPrefetchLocs, flags, stream) + + +cdef cudaError_t _cudaMemDiscardBatchAsync(void** dptrs, size_t* sizes, size_t count, unsigned long long flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemDiscardBatchAsync(dptrs, sizes, count, flags, stream) + + +cdef cudaError_t _cudaMemDiscardAndPrefetchBatchAsync(void** dptrs, size_t* sizes, size_t count, cudaMemLocation* prefetchLocs, size_t* prefetchLocIdxs, size_t numPrefetchLocs, unsigned long long flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemDiscardAndPrefetchBatchAsync(dptrs, sizes, count, prefetchLocs, prefetchLocIdxs, numPrefetchLocs, flags, stream) + + +cdef cudaError_t _cudaMemGetDefaultMemPool(cudaMemPool_t* memPool, cudaMemLocation* location, cudaMemAllocationType type) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemGetDefaultMemPool(memPool, location, type) + + +cdef cudaError_t _cudaMemGetMemPool(cudaMemPool_t* memPool, cudaMemLocation* location, cudaMemAllocationType type) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemGetMemPool(memPool, location, type) + + +cdef cudaError_t _cudaMemSetMemPool(cudaMemLocation* location, cudaMemAllocationType type, cudaMemPool_t memPool) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemSetMemPool(location, type, memPool) + + +cdef cudaError_t _cudaLogsRegisterCallback(cudaLogsCallback_t callbackFunc, void* userData, cudaLogsCallbackHandle* callback_out) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaLogsRegisterCallback(callbackFunc, userData, callback_out) + + +cdef cudaError_t _cudaLogsUnregisterCallback(cudaLogsCallbackHandle callback) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaLogsUnregisterCallback(callback) + + +cdef cudaError_t _cudaLogsCurrent(cudaLogIterator* iterator_out, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaLogsCurrent(iterator_out, flags) + + +cdef cudaError_t _cudaLogsDumpToFile(cudaLogIterator* iterator, const char* pathToFile, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaLogsDumpToFile(iterator, pathToFile, flags) + + +cdef cudaError_t _cudaLogsDumpToMemory(cudaLogIterator* iterator, char* buffer, size_t* size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaLogsDumpToMemory(iterator, buffer, size, flags) + + +cdef cudaError_t _cudaGraphNodeGetContainingGraph(cudaGraphNode_t hNode, cudaGraph_t* phGraph) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphNodeGetContainingGraph(hNode, phGraph) + + +cdef cudaError_t _cudaGraphNodeGetLocalId(cudaGraphNode_t hNode, unsigned int* nodeId) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphNodeGetLocalId(hNode, nodeId) + + +cdef cudaError_t _cudaGraphNodeGetToolsId(cudaGraphNode_t hNode, unsigned long long* toolsNodeId) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphNodeGetToolsId(hNode, toolsNodeId) + + +cdef cudaError_t _cudaGraphGetId(cudaGraph_t hGraph, unsigned int* graphID) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphGetId(hGraph, graphID) + + +cdef cudaError_t _cudaGraphExecGetId(cudaGraphExec_t hGraphExec, unsigned int* graphID) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphExecGetId(hGraphExec, graphID) + + +cdef cudaError_t _cudaGraphConditionalHandleCreate_v2(cudaGraphConditionalHandle* pHandle_out, cudaGraph_t graph, cudaExecutionContext_t ctx, unsigned int defaultLaunchValue, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphConditionalHandleCreate_v2(pHandle_out, graph, ctx, defaultLaunchValue, flags) + + +cdef cudaError_t _cudaDeviceGetDevResource(int device, cudaDevResource* resource, cudaDevResourceType type) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceGetDevResource(device, resource, type) + + +cdef cudaError_t _cudaDevSmResourceSplitByCount(cudaDevResource* result, unsigned int* nbGroups, const cudaDevResource* input, cudaDevResource* remaining, unsigned int flags, unsigned int minCount) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDevSmResourceSplitByCount(result, nbGroups, input, remaining, flags, minCount) + + +cdef cudaError_t _cudaDevSmResourceSplit(cudaDevResource* result, unsigned int nbGroups, const cudaDevResource* input, cudaDevResource* remainder, unsigned int flags, cudaDevSmResourceGroupParams* groupParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDevSmResourceSplit(result, nbGroups, input, remainder, flags, groupParams) + + +cdef cudaError_t _cudaDevResourceGenerateDesc(cudaDevResourceDesc_t* phDesc, cudaDevResource* resources, unsigned int nbResources) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDevResourceGenerateDesc(phDesc, resources, nbResources) + + +cdef cudaError_t _cudaGreenCtxCreate(cudaExecutionContext_t* phCtx, cudaDevResourceDesc_t desc, int device, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGreenCtxCreate(phCtx, desc, device, flags) + + +cdef cudaError_t _cudaExecutionCtxDestroy(cudaExecutionContext_t ctx) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaExecutionCtxDestroy(ctx) + + +cdef cudaError_t _cudaExecutionCtxGetDevResource(cudaExecutionContext_t ctx, cudaDevResource* resource, cudaDevResourceType type) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaExecutionCtxGetDevResource(ctx, resource, type) + + +cdef cudaError_t _cudaExecutionCtxGetDevice(int* device, cudaExecutionContext_t ctx) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaExecutionCtxGetDevice(device, ctx) + + +cdef cudaError_t _cudaExecutionCtxGetId(cudaExecutionContext_t ctx, unsigned long long* ctxId) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaExecutionCtxGetId(ctx, ctxId) + + +cdef cudaError_t _cudaExecutionCtxStreamCreate(cudaStream_t* phStream, cudaExecutionContext_t ctx, unsigned int flags, int priority) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaExecutionCtxStreamCreate(phStream, ctx, flags, priority) + + +cdef cudaError_t _cudaExecutionCtxSynchronize(cudaExecutionContext_t ctx) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaExecutionCtxSynchronize(ctx) + + +cdef cudaError_t _cudaStreamGetDevResource(cudaStream_t hStream, cudaDevResource* resource, cudaDevResourceType type) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaStreamGetDevResource(hStream, resource, type) + + +cdef cudaError_t _cudaExecutionCtxRecordEvent(cudaExecutionContext_t ctx, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaExecutionCtxRecordEvent(ctx, event) + + +cdef cudaError_t _cudaExecutionCtxWaitEvent(cudaExecutionContext_t ctx, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaExecutionCtxWaitEvent(ctx, event) + + +cdef cudaError_t _cudaDeviceGetExecutionCtx(cudaExecutionContext_t* ctx, int device) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaDeviceGetExecutionCtx(ctx, device) + + +cdef cudaError_t _cudaFuncGetParamCount(const void* func, size_t* paramCount) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaFuncGetParamCount(func, paramCount) + + +cdef cudaError_t _cudaLaunchHostFunc_v2(cudaStream_t stream, cudaHostFn_t fn, void* userData, unsigned int syncMode) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaLaunchHostFunc_v2(stream, fn, userData, syncMode) + + +cdef cudaError_t _cudaMemcpyWithAttributesAsync(void* dst, const void* src, size_t size, cudaMemcpyAttributes* attr, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemcpyWithAttributesAsync(dst, src, size, attr, stream) + + +cdef cudaError_t _cudaMemcpy3DWithAttributesAsync(cudaMemcpy3DBatchOp* op, unsigned long long flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaMemcpy3DWithAttributesAsync(op, flags, stream) + + +cdef cudaError_t _cudaGraphNodeGetParams(cudaGraphNode_t node, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaGraphNodeGetParams(node, nodeParams) + + +cdef cudaError_t _cudaStreamBeginRecaptureToGraph(cudaStream_t stream, cudaStreamCaptureMode mode, cudaGraph_t graph, cudaGraphRecaptureCallbackData* callbackData) except ?cudaErrorCallRequiresNewerDriver nogil: + return _static_cudaStreamBeginRecaptureToGraph(stream, mode, graph, callbackData) diff --git a/cuda_bindings/cuda/bindings/_internal/runtime_windows.pyx b/cuda_bindings/cuda/bindings/_internal/runtime_windows.pyx new file mode 100644 index 00000000000..f848344f483 --- /dev/null +++ b/cuda_bindings/cuda/bindings/_internal/runtime_windows.pyx @@ -0,0 +1,3276 @@ +# SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +# This code was automatically generated across versions from 12.9.0 to 13.3.0. Do not modify it directly. + +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=5f0e930fd8c13f49036a66fc40729a3270cc44d8b16234b1387b93e51f0e0a0f +import os + +from libc.stdint cimport uintptr_t + +from cuda.pathfinder import load_nvidia_dynamic_lib +cimport cuda.bindings._lib.windll as windll +cimport cuda.bindings._internal.runtime_ptds as ptds +cimport cython + + +############################################################################### +# Per-thread default stream dispatch +############################################################################### + +cdef bint __cudaPythonInit = False +cdef bint __usePTDS = False + +cdef int _cudaPythonInit() except -1 nogil: + global __cudaPythonInit + global __usePTDS + with gil: + __usePTDS = bool(int(os.getenv('CUDA_PYTHON_CUDA_PER_THREAD_DEFAULT_STREAM', default=0))) + __cudaPythonInit = True + return __usePTDS + +cdef inline int cudaPythonInit() except -1 nogil: + if __cudaPythonInit: + return __usePTDS + return _cudaPythonInit() + + +############################################################################### +# EGL/GL/VDPAU helpers (implementations delegating to driver EGL/VDPAU/GL APIs) +############################################################################### + +include "../_lib/cyruntime/cyruntime.pxi" + + +############################################################################### +# getLocalRuntimeVersion — dynamically loads cudart to read its own version +############################################################################### + +cdef cudaError_t _getLocalRuntimeVersion(int* runtimeVersion) except ?cudaErrorCallRequiresNewerDriver nogil: + # Load cudart dynamically to read its embedded version number. + with gil: + loaded_dl = load_nvidia_dynamic_lib("cudart") + handle = loaded_dl._handle_uint + + cdef void* __cudaRuntimeGetVersion = windll.GetProcAddress(handle, b'cudaRuntimeGetVersion') + + if __cudaRuntimeGetVersion == NULL: + with gil: + raise RuntimeError(f'Function "cudaRuntimeGetVersion" not found in {loaded_dl.abs_path}') + + # We explicitly do *NOT* cleanup the library handle here — see runtime_linux.pyx comment. + + cdef cudaError_t err = cudaSuccess + err = ( __cudaRuntimeGetVersion)(runtimeVersion) + return err + + +############################################################################### +# C function declarations for static cudart (avoids infinite recursion through +# the same-named Cython wrappers imported via `from ..cyruntime cimport *`) +############################################################################### + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceReset "cudaDeviceReset" () noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceSynchronize "cudaDeviceSynchronize" () noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceSetLimit "cudaDeviceSetLimit" (cudaLimit limit, size_t value) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetLimit "cudaDeviceGetLimit" (size_t* pValue, cudaLimit limit) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetTexture1DLinearMaxWidth "cudaDeviceGetTexture1DLinearMaxWidth" (size_t* maxWidthInElements, const cudaChannelFormatDesc* fmtDesc, int device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetCacheConfig "cudaDeviceGetCacheConfig" (cudaFuncCache* pCacheConfig) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetStreamPriorityRange "cudaDeviceGetStreamPriorityRange" (int* leastPriority, int* greatestPriority) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceSetCacheConfig "cudaDeviceSetCacheConfig" (cudaFuncCache cacheConfig) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetByPCIBusId "cudaDeviceGetByPCIBusId" (int* device, const char* pciBusId) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetPCIBusId "cudaDeviceGetPCIBusId" (char* pciBusId, int len, int device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaIpcGetEventHandle "cudaIpcGetEventHandle" (cudaIpcEventHandle_t* handle, cudaEvent_t event) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaIpcOpenEventHandle "cudaIpcOpenEventHandle" (cudaEvent_t* event, cudaIpcEventHandle_t handle) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaIpcGetMemHandle "cudaIpcGetMemHandle" (cudaIpcMemHandle_t* handle, void* devPtr) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaIpcOpenMemHandle "cudaIpcOpenMemHandle" (void** devPtr, cudaIpcMemHandle_t handle, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaIpcCloseMemHandle "cudaIpcCloseMemHandle" (void* devPtr) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceFlushGPUDirectRDMAWrites "cudaDeviceFlushGPUDirectRDMAWrites" (cudaFlushGPUDirectRDMAWritesTarget target, cudaFlushGPUDirectRDMAWritesScope scope) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceRegisterAsyncNotification "cudaDeviceRegisterAsyncNotification" (int device, cudaAsyncCallback callbackFunc, void* userData, cudaAsyncCallbackHandle_t* callback) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceUnregisterAsyncNotification "cudaDeviceUnregisterAsyncNotification" (int device, cudaAsyncCallbackHandle_t callback) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetSharedMemConfig "cudaDeviceGetSharedMemConfig" (cudaSharedMemConfig* pConfig) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceSetSharedMemConfig "cudaDeviceSetSharedMemConfig" (cudaSharedMemConfig config) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetLastError "cudaGetLastError" () noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaPeekAtLastError "cudaPeekAtLastError" () noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + const char* _static_cudaGetErrorName "cudaGetErrorName" (cudaError_t error) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + const char* _static_cudaGetErrorString "cudaGetErrorString" (cudaError_t error) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetDeviceCount "cudaGetDeviceCount" (int* count) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetAttribute "cudaDeviceGetAttribute" (int* value, cudaDeviceAttr attr, int device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetDefaultMemPool "cudaDeviceGetDefaultMemPool" (cudaMemPool_t* memPool, int device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceSetMemPool "cudaDeviceSetMemPool" (int device, cudaMemPool_t memPool) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetMemPool "cudaDeviceGetMemPool" (cudaMemPool_t* memPool, int device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetNvSciSyncAttributes "cudaDeviceGetNvSciSyncAttributes" (void* nvSciSyncAttrList, int device, int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetP2PAttribute "cudaDeviceGetP2PAttribute" (int* value, cudaDeviceP2PAttr attr, int srcDevice, int dstDevice) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaChooseDevice "cudaChooseDevice" (int* device, const cudaDeviceProp* prop) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaInitDevice "cudaInitDevice" (int device, unsigned int deviceFlags, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaSetDevice "cudaSetDevice" (int device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetDevice "cudaGetDevice" (int* device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaSetDeviceFlags "cudaSetDeviceFlags" (unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetDeviceFlags "cudaGetDeviceFlags" (unsigned int* flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamCreate "cudaStreamCreate" (cudaStream_t* pStream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamCreateWithFlags "cudaStreamCreateWithFlags" (cudaStream_t* pStream, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamCreateWithPriority "cudaStreamCreateWithPriority" (cudaStream_t* pStream, unsigned int flags, int priority) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamGetPriority "cudaStreamGetPriority" (cudaStream_t hStream, int* priority) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamGetFlags "cudaStreamGetFlags" (cudaStream_t hStream, unsigned int* flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamGetId "cudaStreamGetId" (cudaStream_t hStream, unsigned long long* streamId) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamGetDevice "cudaStreamGetDevice" (cudaStream_t hStream, int* device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaCtxResetPersistingL2Cache "cudaCtxResetPersistingL2Cache" () noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamCopyAttributes "cudaStreamCopyAttributes" (cudaStream_t dst, cudaStream_t src) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamGetAttribute "cudaStreamGetAttribute" (cudaStream_t hStream, cudaLaunchAttributeID attr, cudaLaunchAttributeValue* value_out) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamSetAttribute "cudaStreamSetAttribute" (cudaStream_t hStream, cudaLaunchAttributeID attr, const cudaLaunchAttributeValue* value) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamDestroy "cudaStreamDestroy" (cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamWaitEvent "cudaStreamWaitEvent" (cudaStream_t stream, cudaEvent_t event, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamAddCallback "cudaStreamAddCallback" (cudaStream_t stream, cudaStreamCallback_t callback, void* userData, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamSynchronize "cudaStreamSynchronize" (cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamQuery "cudaStreamQuery" (cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamAttachMemAsync "cudaStreamAttachMemAsync" (cudaStream_t stream, void* devPtr, size_t length, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamBeginCapture "cudaStreamBeginCapture" (cudaStream_t stream, cudaStreamCaptureMode mode) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamBeginCaptureToGraph "cudaStreamBeginCaptureToGraph" (cudaStream_t stream, cudaGraph_t graph, const cudaGraphNode_t* dependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, cudaStreamCaptureMode mode) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaThreadExchangeStreamCaptureMode "cudaThreadExchangeStreamCaptureMode" (cudaStreamCaptureMode* mode) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamEndCapture "cudaStreamEndCapture" (cudaStream_t stream, cudaGraph_t* pGraph) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamIsCapturing "cudaStreamIsCapturing" (cudaStream_t stream, cudaStreamCaptureStatus* pCaptureStatus) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamUpdateCaptureDependencies "cudaStreamUpdateCaptureDependencies" (cudaStream_t stream, cudaGraphNode_t* dependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaEventCreate "cudaEventCreate" (cudaEvent_t* event) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaEventCreateWithFlags "cudaEventCreateWithFlags" (cudaEvent_t* event, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaEventRecord "cudaEventRecord" (cudaEvent_t event, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaEventRecordWithFlags "cudaEventRecordWithFlags" (cudaEvent_t event, cudaStream_t stream, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaEventQuery "cudaEventQuery" (cudaEvent_t event) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaEventSynchronize "cudaEventSynchronize" (cudaEvent_t event) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaEventDestroy "cudaEventDestroy" (cudaEvent_t event) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaEventElapsedTime "cudaEventElapsedTime" (float* ms, cudaEvent_t start, cudaEvent_t end) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaImportExternalMemory "cudaImportExternalMemory" (cudaExternalMemory_t* extMem_out, const cudaExternalMemoryHandleDesc* memHandleDesc) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaExternalMemoryGetMappedBuffer "cudaExternalMemoryGetMappedBuffer" (void** devPtr, cudaExternalMemory_t extMem, const cudaExternalMemoryBufferDesc* bufferDesc) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaExternalMemoryGetMappedMipmappedArray "cudaExternalMemoryGetMappedMipmappedArray" (cudaMipmappedArray_t* mipmap, cudaExternalMemory_t extMem, const cudaExternalMemoryMipmappedArrayDesc* mipmapDesc) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDestroyExternalMemory "cudaDestroyExternalMemory" (cudaExternalMemory_t extMem) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaImportExternalSemaphore "cudaImportExternalSemaphore" (cudaExternalSemaphore_t* extSem_out, const cudaExternalSemaphoreHandleDesc* semHandleDesc) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDestroyExternalSemaphore "cudaDestroyExternalSemaphore" (cudaExternalSemaphore_t extSem) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaFuncSetCacheConfig "cudaFuncSetCacheConfig" (const void* func, cudaFuncCache cacheConfig) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaFuncGetAttributes "cudaFuncGetAttributes" (cudaFuncAttributes* attr, const void* func) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaFuncSetAttribute "cudaFuncSetAttribute" (const void* func, cudaFuncAttribute attr, int value) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaFuncGetName "cudaFuncGetName" (const char** name, const void* func) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaFuncGetParamInfo "cudaFuncGetParamInfo" (const void* func, size_t paramIndex, size_t* paramOffset, size_t* paramSize) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLaunchHostFunc "cudaLaunchHostFunc" (cudaStream_t stream, cudaHostFn_t fn, void* userData) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaFuncSetSharedMemConfig "cudaFuncSetSharedMemConfig" (const void* func, cudaSharedMemConfig config) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaOccupancyMaxActiveBlocksPerMultiprocessor "cudaOccupancyMaxActiveBlocksPerMultiprocessor" (int* numBlocks, const void* func, int blockSize, size_t dynamicSMemSize) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaOccupancyAvailableDynamicSMemPerBlock "cudaOccupancyAvailableDynamicSMemPerBlock" (size_t* dynamicSmemSize, const void* func, int numBlocks, int blockSize) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags "cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags" (int* numBlocks, const void* func, int blockSize, size_t dynamicSMemSize, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMallocManaged "cudaMallocManaged" (void** devPtr, size_t size, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMalloc "cudaMalloc" (void** devPtr, size_t size) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMallocHost "cudaMallocHost" (void** ptr, size_t size) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMallocPitch "cudaMallocPitch" (void** devPtr, size_t* pitch, size_t width, size_t height) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMallocArray "cudaMallocArray" (cudaArray_t* array, const cudaChannelFormatDesc* desc, size_t width, size_t height, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaFree "cudaFree" (void* devPtr) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaFreeHost "cudaFreeHost" (void* ptr) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaFreeArray "cudaFreeArray" (cudaArray_t array) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaFreeMipmappedArray "cudaFreeMipmappedArray" (cudaMipmappedArray_t mipmappedArray) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaHostAlloc "cudaHostAlloc" (void** pHost, size_t size, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaHostRegister "cudaHostRegister" (void* ptr, size_t size, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaHostUnregister "cudaHostUnregister" (void* ptr) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaHostGetDevicePointer "cudaHostGetDevicePointer" (void** pDevice, void* pHost, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaHostGetFlags "cudaHostGetFlags" (unsigned int* pFlags, void* pHost) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMalloc3D "cudaMalloc3D" (cudaPitchedPtr* pitchedDevPtr, cudaExtent extent) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMalloc3DArray "cudaMalloc3DArray" (cudaArray_t* array, const cudaChannelFormatDesc* desc, cudaExtent extent, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMallocMipmappedArray "cudaMallocMipmappedArray" (cudaMipmappedArray_t* mipmappedArray, const cudaChannelFormatDesc* desc, cudaExtent extent, unsigned int numLevels, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetMipmappedArrayLevel "cudaGetMipmappedArrayLevel" (cudaArray_t* levelArray, cudaMipmappedArray_const_t mipmappedArray, unsigned int level) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpy3D "cudaMemcpy3D" (const cudaMemcpy3DParms* p) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpy3DPeer "cudaMemcpy3DPeer" (const cudaMemcpy3DPeerParms* p) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpy3DAsync "cudaMemcpy3DAsync" (const cudaMemcpy3DParms* p, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpy3DPeerAsync "cudaMemcpy3DPeerAsync" (const cudaMemcpy3DPeerParms* p, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemGetInfo "cudaMemGetInfo" (size_t* free, size_t* total) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaArrayGetInfo "cudaArrayGetInfo" (cudaChannelFormatDesc* desc, cudaExtent* extent, unsigned int* flags, cudaArray_t array) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaArrayGetPlane "cudaArrayGetPlane" (cudaArray_t* pPlaneArray, cudaArray_t hArray, unsigned int planeIdx) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaArrayGetMemoryRequirements "cudaArrayGetMemoryRequirements" (cudaArrayMemoryRequirements* memoryRequirements, cudaArray_t array, int device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMipmappedArrayGetMemoryRequirements "cudaMipmappedArrayGetMemoryRequirements" (cudaArrayMemoryRequirements* memoryRequirements, cudaMipmappedArray_t mipmap, int device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaArrayGetSparseProperties "cudaArrayGetSparseProperties" (cudaArraySparseProperties* sparseProperties, cudaArray_t array) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMipmappedArrayGetSparseProperties "cudaMipmappedArrayGetSparseProperties" (cudaArraySparseProperties* sparseProperties, cudaMipmappedArray_t mipmap) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpy "cudaMemcpy" (void* dst, const void* src, size_t count, cudaMemcpyKind kind) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpyPeer "cudaMemcpyPeer" (void* dst, int dstDevice, const void* src, int srcDevice, size_t count) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpy2D "cudaMemcpy2D" (void* dst, size_t dpitch, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpy2DToArray "cudaMemcpy2DToArray" (cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpy2DFromArray "cudaMemcpy2DFromArray" (void* dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t width, size_t height, cudaMemcpyKind kind) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpy2DArrayToArray "cudaMemcpy2DArrayToArray" (cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t width, size_t height, cudaMemcpyKind kind) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpyAsync "cudaMemcpyAsync" (void* dst, const void* src, size_t count, cudaMemcpyKind kind, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpyPeerAsync "cudaMemcpyPeerAsync" (void* dst, int dstDevice, const void* src, int srcDevice, size_t count, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpyBatchAsync "cudaMemcpyBatchAsync" (void** dsts, const void** srcs, const size_t* sizes, size_t count, cudaMemcpyAttributes* attrs, size_t* attrsIdxs, size_t numAttrs, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpy3DBatchAsync "cudaMemcpy3DBatchAsync" (size_t numOps, cudaMemcpy3DBatchOp* opList, unsigned long long flags, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpy2DAsync "cudaMemcpy2DAsync" (void* dst, size_t dpitch, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpy2DToArrayAsync "cudaMemcpy2DToArrayAsync" (cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpy2DFromArrayAsync "cudaMemcpy2DFromArrayAsync" (void* dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemset "cudaMemset" (void* devPtr, int value, size_t count) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemset2D "cudaMemset2D" (void* devPtr, size_t pitch, int value, size_t width, size_t height) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemset3D "cudaMemset3D" (cudaPitchedPtr pitchedDevPtr, int value, cudaExtent extent) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemsetAsync "cudaMemsetAsync" (void* devPtr, int value, size_t count, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemset2DAsync "cudaMemset2DAsync" (void* devPtr, size_t pitch, int value, size_t width, size_t height, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemset3DAsync "cudaMemset3DAsync" (cudaPitchedPtr pitchedDevPtr, int value, cudaExtent extent, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemPrefetchAsync "cudaMemPrefetchAsync" (const void* devPtr, size_t count, cudaMemLocation location, unsigned int flags, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemAdvise "cudaMemAdvise" (const void* devPtr, size_t count, cudaMemoryAdvise advice, cudaMemLocation location) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemRangeGetAttribute "cudaMemRangeGetAttribute" (void* data, size_t dataSize, cudaMemRangeAttribute attribute, const void* devPtr, size_t count) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemRangeGetAttributes "cudaMemRangeGetAttributes" (void** data, size_t* dataSizes, cudaMemRangeAttribute* attributes, size_t numAttributes, const void* devPtr, size_t count) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpyToArray "cudaMemcpyToArray" (cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t count, cudaMemcpyKind kind) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpyFromArray "cudaMemcpyFromArray" (void* dst, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, cudaMemcpyKind kind) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpyArrayToArray "cudaMemcpyArrayToArray" (cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t count, cudaMemcpyKind kind) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpyToArrayAsync "cudaMemcpyToArrayAsync" (cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t count, cudaMemcpyKind kind, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpyFromArrayAsync "cudaMemcpyFromArrayAsync" (void* dst, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, cudaMemcpyKind kind, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMallocAsync "cudaMallocAsync" (void** devPtr, size_t size, cudaStream_t hStream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaFreeAsync "cudaFreeAsync" (void* devPtr, cudaStream_t hStream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemPoolTrimTo "cudaMemPoolTrimTo" (cudaMemPool_t memPool, size_t minBytesToKeep) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemPoolSetAttribute "cudaMemPoolSetAttribute" (cudaMemPool_t memPool, cudaMemPoolAttr attr, void* value) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemPoolGetAttribute "cudaMemPoolGetAttribute" (cudaMemPool_t memPool, cudaMemPoolAttr attr, void* value) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemPoolSetAccess "cudaMemPoolSetAccess" (cudaMemPool_t memPool, const cudaMemAccessDesc* descList, size_t count) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemPoolGetAccess "cudaMemPoolGetAccess" (cudaMemAccessFlags* flags, cudaMemPool_t memPool, cudaMemLocation* location) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemPoolCreate "cudaMemPoolCreate" (cudaMemPool_t* memPool, const cudaMemPoolProps* poolProps) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemPoolDestroy "cudaMemPoolDestroy" (cudaMemPool_t memPool) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMallocFromPoolAsync "cudaMallocFromPoolAsync" (void** ptr, size_t size, cudaMemPool_t memPool, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemPoolExportToShareableHandle "cudaMemPoolExportToShareableHandle" (void* shareableHandle, cudaMemPool_t memPool, cudaMemAllocationHandleType handleType, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemPoolImportFromShareableHandle "cudaMemPoolImportFromShareableHandle" (cudaMemPool_t* memPool, void* shareableHandle, cudaMemAllocationHandleType handleType, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemPoolExportPointer "cudaMemPoolExportPointer" (cudaMemPoolPtrExportData* exportData, void* ptr) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemPoolImportPointer "cudaMemPoolImportPointer" (void** ptr, cudaMemPool_t memPool, cudaMemPoolPtrExportData* exportData) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaPointerGetAttributes "cudaPointerGetAttributes" (cudaPointerAttributes* attributes, const void* ptr) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceCanAccessPeer "cudaDeviceCanAccessPeer" (int* canAccessPeer, int device, int peerDevice) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceEnablePeerAccess "cudaDeviceEnablePeerAccess" (int peerDevice, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceDisablePeerAccess "cudaDeviceDisablePeerAccess" (int peerDevice) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphicsUnregisterResource "cudaGraphicsUnregisterResource" (cudaGraphicsResource_t resource) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphicsResourceSetMapFlags "cudaGraphicsResourceSetMapFlags" (cudaGraphicsResource_t resource, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphicsMapResources "cudaGraphicsMapResources" (int count, cudaGraphicsResource_t* resources, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphicsUnmapResources "cudaGraphicsUnmapResources" (int count, cudaGraphicsResource_t* resources, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphicsResourceGetMappedPointer "cudaGraphicsResourceGetMappedPointer" (void** devPtr, size_t* size, cudaGraphicsResource_t resource) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphicsSubResourceGetMappedArray "cudaGraphicsSubResourceGetMappedArray" (cudaArray_t* array, cudaGraphicsResource_t resource, unsigned int arrayIndex, unsigned int mipLevel) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphicsResourceGetMappedMipmappedArray "cudaGraphicsResourceGetMappedMipmappedArray" (cudaMipmappedArray_t* mipmappedArray, cudaGraphicsResource_t resource) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetChannelDesc "cudaGetChannelDesc" (cudaChannelFormatDesc* desc, cudaArray_const_t array) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaChannelFormatDesc _static_cudaCreateChannelDesc "cudaCreateChannelDesc" (int x, int y, int z, int w, cudaChannelFormatKind f) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaCreateTextureObject "cudaCreateTextureObject" (cudaTextureObject_t* pTexObject, const cudaResourceDesc* pResDesc, const cudaTextureDesc* pTexDesc, const cudaResourceViewDesc* pResViewDesc) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDestroyTextureObject "cudaDestroyTextureObject" (cudaTextureObject_t texObject) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetTextureObjectResourceDesc "cudaGetTextureObjectResourceDesc" (cudaResourceDesc* pResDesc, cudaTextureObject_t texObject) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetTextureObjectTextureDesc "cudaGetTextureObjectTextureDesc" (cudaTextureDesc* pTexDesc, cudaTextureObject_t texObject) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetTextureObjectResourceViewDesc "cudaGetTextureObjectResourceViewDesc" (cudaResourceViewDesc* pResViewDesc, cudaTextureObject_t texObject) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaCreateSurfaceObject "cudaCreateSurfaceObject" (cudaSurfaceObject_t* pSurfObject, const cudaResourceDesc* pResDesc) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDestroySurfaceObject "cudaDestroySurfaceObject" (cudaSurfaceObject_t surfObject) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetSurfaceObjectResourceDesc "cudaGetSurfaceObjectResourceDesc" (cudaResourceDesc* pResDesc, cudaSurfaceObject_t surfObject) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDriverGetVersion "cudaDriverGetVersion" (int* driverVersion) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaRuntimeGetVersion "cudaRuntimeGetVersion" (int* runtimeVersion) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphCreate "cudaGraphCreate" (cudaGraph_t* pGraph, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddKernelNode "cudaGraphAddKernelNode" (cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaKernelNodeParams* pNodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphKernelNodeGetParams "cudaGraphKernelNodeGetParams" (cudaGraphNode_t node, cudaKernelNodeParams* pNodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphKernelNodeSetParams "cudaGraphKernelNodeSetParams" (cudaGraphNode_t node, const cudaKernelNodeParams* pNodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphKernelNodeCopyAttributes "cudaGraphKernelNodeCopyAttributes" (cudaGraphNode_t hDst, cudaGraphNode_t hSrc) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphKernelNodeGetAttribute "cudaGraphKernelNodeGetAttribute" (cudaGraphNode_t hNode, cudaLaunchAttributeID attr, cudaLaunchAttributeValue* value_out) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphKernelNodeSetAttribute "cudaGraphKernelNodeSetAttribute" (cudaGraphNode_t hNode, cudaLaunchAttributeID attr, const cudaLaunchAttributeValue* value) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddMemcpyNode "cudaGraphAddMemcpyNode" (cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaMemcpy3DParms* pCopyParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddMemcpyNode1D "cudaGraphAddMemcpyNode1D" (cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, void* dst, const void* src, size_t count, cudaMemcpyKind kind) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphMemcpyNodeGetParams "cudaGraphMemcpyNodeGetParams" (cudaGraphNode_t node, cudaMemcpy3DParms* pNodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphMemcpyNodeSetParams "cudaGraphMemcpyNodeSetParams" (cudaGraphNode_t node, const cudaMemcpy3DParms* pNodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphMemcpyNodeSetParams1D "cudaGraphMemcpyNodeSetParams1D" (cudaGraphNode_t node, void* dst, const void* src, size_t count, cudaMemcpyKind kind) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddMemsetNode "cudaGraphAddMemsetNode" (cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaMemsetParams* pMemsetParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphMemsetNodeGetParams "cudaGraphMemsetNodeGetParams" (cudaGraphNode_t node, cudaMemsetParams* pNodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphMemsetNodeSetParams "cudaGraphMemsetNodeSetParams" (cudaGraphNode_t node, const cudaMemsetParams* pNodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddHostNode "cudaGraphAddHostNode" (cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaHostNodeParams* pNodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphHostNodeGetParams "cudaGraphHostNodeGetParams" (cudaGraphNode_t node, cudaHostNodeParams* pNodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphHostNodeSetParams "cudaGraphHostNodeSetParams" (cudaGraphNode_t node, const cudaHostNodeParams* pNodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddChildGraphNode "cudaGraphAddChildGraphNode" (cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaGraph_t childGraph) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphChildGraphNodeGetGraph "cudaGraphChildGraphNodeGetGraph" (cudaGraphNode_t node, cudaGraph_t* pGraph) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddEmptyNode "cudaGraphAddEmptyNode" (cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddEventRecordNode "cudaGraphAddEventRecordNode" (cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaEvent_t event) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphEventRecordNodeGetEvent "cudaGraphEventRecordNodeGetEvent" (cudaGraphNode_t node, cudaEvent_t* event_out) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphEventRecordNodeSetEvent "cudaGraphEventRecordNodeSetEvent" (cudaGraphNode_t node, cudaEvent_t event) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddEventWaitNode "cudaGraphAddEventWaitNode" (cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaEvent_t event) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphEventWaitNodeGetEvent "cudaGraphEventWaitNodeGetEvent" (cudaGraphNode_t node, cudaEvent_t* event_out) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphEventWaitNodeSetEvent "cudaGraphEventWaitNodeSetEvent" (cudaGraphNode_t node, cudaEvent_t event) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddExternalSemaphoresSignalNode "cudaGraphAddExternalSemaphoresSignalNode" (cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaExternalSemaphoreSignalNodeParams* nodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExternalSemaphoresSignalNodeGetParams "cudaGraphExternalSemaphoresSignalNodeGetParams" (cudaGraphNode_t hNode, cudaExternalSemaphoreSignalNodeParams* params_out) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExternalSemaphoresSignalNodeSetParams "cudaGraphExternalSemaphoresSignalNodeSetParams" (cudaGraphNode_t hNode, const cudaExternalSemaphoreSignalNodeParams* nodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddExternalSemaphoresWaitNode "cudaGraphAddExternalSemaphoresWaitNode" (cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaExternalSemaphoreWaitNodeParams* nodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExternalSemaphoresWaitNodeGetParams "cudaGraphExternalSemaphoresWaitNodeGetParams" (cudaGraphNode_t hNode, cudaExternalSemaphoreWaitNodeParams* params_out) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExternalSemaphoresWaitNodeSetParams "cudaGraphExternalSemaphoresWaitNodeSetParams" (cudaGraphNode_t hNode, const cudaExternalSemaphoreWaitNodeParams* nodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddMemAllocNode "cudaGraphAddMemAllocNode" (cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaMemAllocNodeParams* nodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphMemAllocNodeGetParams "cudaGraphMemAllocNodeGetParams" (cudaGraphNode_t node, cudaMemAllocNodeParams* params_out) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddMemFreeNode "cudaGraphAddMemFreeNode" (cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, void* dptr) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphMemFreeNodeGetParams "cudaGraphMemFreeNodeGetParams" (cudaGraphNode_t node, void* dptr_out) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGraphMemTrim "cudaDeviceGraphMemTrim" (int device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetGraphMemAttribute "cudaDeviceGetGraphMemAttribute" (int device, cudaGraphMemAttributeType attr, void* value) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceSetGraphMemAttribute "cudaDeviceSetGraphMemAttribute" (int device, cudaGraphMemAttributeType attr, void* value) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphClone "cudaGraphClone" (cudaGraph_t* pGraphClone, cudaGraph_t originalGraph) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphNodeFindInClone "cudaGraphNodeFindInClone" (cudaGraphNode_t* pNode, cudaGraphNode_t originalNode, cudaGraph_t clonedGraph) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphNodeGetType "cudaGraphNodeGetType" (cudaGraphNode_t node, cudaGraphNodeType* pType) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphGetNodes "cudaGraphGetNodes" (cudaGraph_t graph, cudaGraphNode_t* nodes, size_t* numNodes) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphGetRootNodes "cudaGraphGetRootNodes" (cudaGraph_t graph, cudaGraphNode_t* pRootNodes, size_t* pNumRootNodes) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphGetEdges "cudaGraphGetEdges" (cudaGraph_t graph, cudaGraphNode_t* from_, cudaGraphNode_t* to, cudaGraphEdgeData* edgeData, size_t* numEdges) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphNodeGetDependencies "cudaGraphNodeGetDependencies" (cudaGraphNode_t node, cudaGraphNode_t* pDependencies, cudaGraphEdgeData* edgeData, size_t* pNumDependencies) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphNodeGetDependentNodes "cudaGraphNodeGetDependentNodes" (cudaGraphNode_t node, cudaGraphNode_t* pDependentNodes, cudaGraphEdgeData* edgeData, size_t* pNumDependentNodes) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddDependencies "cudaGraphAddDependencies" (cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, const cudaGraphEdgeData* edgeData, size_t numDependencies) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphRemoveDependencies "cudaGraphRemoveDependencies" (cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, const cudaGraphEdgeData* edgeData, size_t numDependencies) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphDestroyNode "cudaGraphDestroyNode" (cudaGraphNode_t node) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphInstantiate "cudaGraphInstantiate" (cudaGraphExec_t* pGraphExec, cudaGraph_t graph, unsigned long long flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphInstantiateWithFlags "cudaGraphInstantiateWithFlags" (cudaGraphExec_t* pGraphExec, cudaGraph_t graph, unsigned long long flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphInstantiateWithParams "cudaGraphInstantiateWithParams" (cudaGraphExec_t* pGraphExec, cudaGraph_t graph, cudaGraphInstantiateParams* instantiateParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecGetFlags "cudaGraphExecGetFlags" (cudaGraphExec_t graphExec, unsigned long long* flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecKernelNodeSetParams "cudaGraphExecKernelNodeSetParams" (cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaKernelNodeParams* pNodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecMemcpyNodeSetParams "cudaGraphExecMemcpyNodeSetParams" (cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaMemcpy3DParms* pNodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecMemcpyNodeSetParams1D "cudaGraphExecMemcpyNodeSetParams1D" (cudaGraphExec_t hGraphExec, cudaGraphNode_t node, void* dst, const void* src, size_t count, cudaMemcpyKind kind) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecMemsetNodeSetParams "cudaGraphExecMemsetNodeSetParams" (cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaMemsetParams* pNodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecHostNodeSetParams "cudaGraphExecHostNodeSetParams" (cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaHostNodeParams* pNodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecChildGraphNodeSetParams "cudaGraphExecChildGraphNodeSetParams" (cudaGraphExec_t hGraphExec, cudaGraphNode_t node, cudaGraph_t childGraph) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecEventRecordNodeSetEvent "cudaGraphExecEventRecordNodeSetEvent" (cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, cudaEvent_t event) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecEventWaitNodeSetEvent "cudaGraphExecEventWaitNodeSetEvent" (cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, cudaEvent_t event) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecExternalSemaphoresSignalNodeSetParams "cudaGraphExecExternalSemaphoresSignalNodeSetParams" (cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, const cudaExternalSemaphoreSignalNodeParams* nodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecExternalSemaphoresWaitNodeSetParams "cudaGraphExecExternalSemaphoresWaitNodeSetParams" (cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, const cudaExternalSemaphoreWaitNodeParams* nodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphNodeSetEnabled "cudaGraphNodeSetEnabled" (cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, unsigned int isEnabled) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphNodeGetEnabled "cudaGraphNodeGetEnabled" (cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, unsigned int* isEnabled) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecUpdate "cudaGraphExecUpdate" (cudaGraphExec_t hGraphExec, cudaGraph_t hGraph, cudaGraphExecUpdateResultInfo* resultInfo) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphUpload "cudaGraphUpload" (cudaGraphExec_t graphExec, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphLaunch "cudaGraphLaunch" (cudaGraphExec_t graphExec, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecDestroy "cudaGraphExecDestroy" (cudaGraphExec_t graphExec) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphDestroy "cudaGraphDestroy" (cudaGraph_t graph) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphDebugDotPrint "cudaGraphDebugDotPrint" (cudaGraph_t graph, const char* path, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaUserObjectCreate "cudaUserObjectCreate" (cudaUserObject_t* object_out, void* ptr, cudaHostFn_t destroy, unsigned int initialRefcount, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaUserObjectRetain "cudaUserObjectRetain" (cudaUserObject_t object, unsigned int count) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaUserObjectRelease "cudaUserObjectRelease" (cudaUserObject_t object, unsigned int count) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphRetainUserObject "cudaGraphRetainUserObject" (cudaGraph_t graph, cudaUserObject_t object, unsigned int count, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphReleaseUserObject "cudaGraphReleaseUserObject" (cudaGraph_t graph, cudaUserObject_t object, unsigned int count) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphAddNode "cudaGraphAddNode" (cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, cudaGraphNodeParams* nodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphNodeSetParams "cudaGraphNodeSetParams" (cudaGraphNode_t node, cudaGraphNodeParams* nodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecNodeSetParams "cudaGraphExecNodeSetParams" (cudaGraphExec_t graphExec, cudaGraphNode_t node, cudaGraphNodeParams* nodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphConditionalHandleCreate "cudaGraphConditionalHandleCreate" (cudaGraphConditionalHandle* pHandle_out, cudaGraph_t graph, unsigned int defaultLaunchValue, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetDriverEntryPoint "cudaGetDriverEntryPoint" (const char* symbol, void** funcPtr, unsigned long long flags, cudaDriverEntryPointQueryResult* driverStatus) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetDriverEntryPointByVersion "cudaGetDriverEntryPointByVersion" (const char* symbol, void** funcPtr, unsigned int cudaVersion, unsigned long long flags, cudaDriverEntryPointQueryResult* driverStatus) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLibraryLoadData "cudaLibraryLoadData" (cudaLibrary_t* library, const void* code, cudaJitOption* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, cudaLibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLibraryLoadFromFile "cudaLibraryLoadFromFile" (cudaLibrary_t* library, const char* fileName, cudaJitOption* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, cudaLibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLibraryUnload "cudaLibraryUnload" (cudaLibrary_t library) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLibraryGetKernel "cudaLibraryGetKernel" (cudaKernel_t* pKernel, cudaLibrary_t library, const char* name) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLibraryGetGlobal "cudaLibraryGetGlobal" (void** dptr, size_t* bytes, cudaLibrary_t library, const char* name) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLibraryGetManaged "cudaLibraryGetManaged" (void** dptr, size_t* bytes, cudaLibrary_t library, const char* name) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLibraryGetUnifiedFunction "cudaLibraryGetUnifiedFunction" (void** fptr, cudaLibrary_t library, const char* symbol) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLibraryGetKernelCount "cudaLibraryGetKernelCount" (unsigned int* count, cudaLibrary_t lib) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLibraryEnumerateKernels "cudaLibraryEnumerateKernels" (cudaKernel_t* kernels, unsigned int numKernels, cudaLibrary_t lib) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaKernelSetAttributeForDevice "cudaKernelSetAttributeForDevice" (cudaKernel_t kernel, cudaFuncAttribute attr, int value, int device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetExportTable "cudaGetExportTable" (const void** ppExportTable, const cudaUUID_t* pExportTableId) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetKernel "cudaGetKernel" (cudaKernel_t* kernelPtr, const void* entryFuncAddr) noexcept + +cdef extern from 'cuda_profiler_api.h' nogil: + cudaError_t _static_cudaProfilerStart "cudaProfilerStart" () noexcept + +cdef extern from 'cuda_profiler_api.h' nogil: + cudaError_t _static_cudaProfilerStop "cudaProfilerStop" () noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGetDeviceProperties "cudaGetDeviceProperties" (cudaDeviceProp* prop, int device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetHostAtomicCapabilities "cudaDeviceGetHostAtomicCapabilities" (unsigned int* capabilities, const cudaAtomicOperation* operations, unsigned int count, int device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetP2PAtomicCapabilities "cudaDeviceGetP2PAtomicCapabilities" (unsigned int* capabilities, const cudaAtomicOperation* operations, unsigned int count, int srcDevice, int dstDevice) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamGetCaptureInfo "cudaStreamGetCaptureInfo" (cudaStream_t stream, cudaStreamCaptureStatus* captureStatus_out, unsigned long long* id_out, cudaGraph_t* graph_out, const cudaGraphNode_t** dependencies_out, const cudaGraphEdgeData** edgeData_out, size_t* numDependencies_out) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaSignalExternalSemaphoresAsync "cudaSignalExternalSemaphoresAsync" (const cudaExternalSemaphore_t* extSemArray, const cudaExternalSemaphoreSignalParams* paramsArray, unsigned int numExtSems, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaWaitExternalSemaphoresAsync "cudaWaitExternalSemaphoresAsync" (const cudaExternalSemaphore_t* extSemArray, const cudaExternalSemaphoreWaitParams* paramsArray, unsigned int numExtSems, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemPrefetchBatchAsync "cudaMemPrefetchBatchAsync" (void** dptrs, size_t* sizes, size_t count, cudaMemLocation* prefetchLocs, size_t* prefetchLocIdxs, size_t numPrefetchLocs, unsigned long long flags, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemDiscardBatchAsync "cudaMemDiscardBatchAsync" (void** dptrs, size_t* sizes, size_t count, unsigned long long flags, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemDiscardAndPrefetchBatchAsync "cudaMemDiscardAndPrefetchBatchAsync" (void** dptrs, size_t* sizes, size_t count, cudaMemLocation* prefetchLocs, size_t* prefetchLocIdxs, size_t numPrefetchLocs, unsigned long long flags, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemGetDefaultMemPool "cudaMemGetDefaultMemPool" (cudaMemPool_t* memPool, cudaMemLocation* location, cudaMemAllocationType type) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemGetMemPool "cudaMemGetMemPool" (cudaMemPool_t* memPool, cudaMemLocation* location, cudaMemAllocationType type) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemSetMemPool "cudaMemSetMemPool" (cudaMemLocation* location, cudaMemAllocationType type, cudaMemPool_t memPool) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLogsRegisterCallback "cudaLogsRegisterCallback" (cudaLogsCallback_t callbackFunc, void* userData, cudaLogsCallbackHandle* callback_out) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLogsUnregisterCallback "cudaLogsUnregisterCallback" (cudaLogsCallbackHandle callback) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLogsCurrent "cudaLogsCurrent" (cudaLogIterator* iterator_out, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLogsDumpToFile "cudaLogsDumpToFile" (cudaLogIterator* iterator, const char* pathToFile, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLogsDumpToMemory "cudaLogsDumpToMemory" (cudaLogIterator* iterator, char* buffer, size_t* size, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphNodeGetContainingGraph "cudaGraphNodeGetContainingGraph" (cudaGraphNode_t hNode, cudaGraph_t* phGraph) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphNodeGetLocalId "cudaGraphNodeGetLocalId" (cudaGraphNode_t hNode, unsigned int* nodeId) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphNodeGetToolsId "cudaGraphNodeGetToolsId" (cudaGraphNode_t hNode, unsigned long long* toolsNodeId) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphGetId "cudaGraphGetId" (cudaGraph_t hGraph, unsigned int* graphID) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphExecGetId "cudaGraphExecGetId" (cudaGraphExec_t hGraphExec, unsigned int* graphID) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphConditionalHandleCreate_v2 "cudaGraphConditionalHandleCreate_v2" (cudaGraphConditionalHandle* pHandle_out, cudaGraph_t graph, cudaExecutionContext_t ctx, unsigned int defaultLaunchValue, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetDevResource "cudaDeviceGetDevResource" (int device, cudaDevResource* resource, cudaDevResourceType type) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDevSmResourceSplitByCount "cudaDevSmResourceSplitByCount" (cudaDevResource* result, unsigned int* nbGroups, const cudaDevResource* input, cudaDevResource* remaining, unsigned int flags, unsigned int minCount) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDevSmResourceSplit "cudaDevSmResourceSplit" (cudaDevResource* result, unsigned int nbGroups, const cudaDevResource* input, cudaDevResource* remainder, unsigned int flags, cudaDevSmResourceGroupParams* groupParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDevResourceGenerateDesc "cudaDevResourceGenerateDesc" (cudaDevResourceDesc_t* phDesc, cudaDevResource* resources, unsigned int nbResources) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGreenCtxCreate "cudaGreenCtxCreate" (cudaExecutionContext_t* phCtx, cudaDevResourceDesc_t desc, int device, unsigned int flags) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaExecutionCtxDestroy "cudaExecutionCtxDestroy" (cudaExecutionContext_t ctx) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaExecutionCtxGetDevResource "cudaExecutionCtxGetDevResource" (cudaExecutionContext_t ctx, cudaDevResource* resource, cudaDevResourceType type) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaExecutionCtxGetDevice "cudaExecutionCtxGetDevice" (int* device, cudaExecutionContext_t ctx) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaExecutionCtxGetId "cudaExecutionCtxGetId" (cudaExecutionContext_t ctx, unsigned long long* ctxId) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaExecutionCtxStreamCreate "cudaExecutionCtxStreamCreate" (cudaStream_t* phStream, cudaExecutionContext_t ctx, unsigned int flags, int priority) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaExecutionCtxSynchronize "cudaExecutionCtxSynchronize" (cudaExecutionContext_t ctx) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamGetDevResource "cudaStreamGetDevResource" (cudaStream_t hStream, cudaDevResource* resource, cudaDevResourceType type) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaExecutionCtxRecordEvent "cudaExecutionCtxRecordEvent" (cudaExecutionContext_t ctx, cudaEvent_t event) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaExecutionCtxWaitEvent "cudaExecutionCtxWaitEvent" (cudaExecutionContext_t ctx, cudaEvent_t event) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaDeviceGetExecutionCtx "cudaDeviceGetExecutionCtx" (cudaExecutionContext_t* ctx, int device) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaFuncGetParamCount "cudaFuncGetParamCount" (const void* func, size_t* paramCount) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaLaunchHostFunc_v2 "cudaLaunchHostFunc_v2" (cudaStream_t stream, cudaHostFn_t fn, void* userData, unsigned int syncMode) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpyWithAttributesAsync "cudaMemcpyWithAttributesAsync" (void* dst, const void* src, size_t size, cudaMemcpyAttributes* attr, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaMemcpy3DWithAttributesAsync "cudaMemcpy3DWithAttributesAsync" (cudaMemcpy3DBatchOp* op, unsigned long long flags, cudaStream_t stream) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaGraphNodeGetParams "cudaGraphNodeGetParams" (cudaGraphNode_t node, cudaGraphNodeParams* nodeParams) noexcept + +cdef extern from 'cuda_runtime_api.h' nogil: + cudaError_t _static_cudaStreamBeginRecaptureToGraph "cudaStreamBeginRecaptureToGraph" (cudaStream_t stream, cudaStreamCaptureMode mode, cudaGraph_t graph, cudaGraphRecaptureCallbackData* callbackData) noexcept + + +############################################################################### +# Wrapper functions +############################################################################### + +cdef cudaError_t _cudaDeviceReset() except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceReset() + return _static_cudaDeviceReset() + + +cdef cudaError_t _cudaDeviceSynchronize() except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceSynchronize() + return _static_cudaDeviceSynchronize() + + +cdef cudaError_t _cudaDeviceSetLimit(cudaLimit limit, size_t value) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceSetLimit(limit, value) + return _static_cudaDeviceSetLimit(limit, value) + + +cdef cudaError_t _cudaDeviceGetLimit(size_t* pValue, cudaLimit limit) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceGetLimit(pValue, limit) + return _static_cudaDeviceGetLimit(pValue, limit) + + +cdef cudaError_t _cudaDeviceGetTexture1DLinearMaxWidth(size_t* maxWidthInElements, const cudaChannelFormatDesc* fmtDesc, int device) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceGetTexture1DLinearMaxWidth(maxWidthInElements, fmtDesc, device) + return _static_cudaDeviceGetTexture1DLinearMaxWidth(maxWidthInElements, fmtDesc, device) + + +cdef cudaError_t _cudaDeviceGetCacheConfig(cudaFuncCache* pCacheConfig) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceGetCacheConfig(pCacheConfig) + return _static_cudaDeviceGetCacheConfig(pCacheConfig) + + +cdef cudaError_t _cudaDeviceGetStreamPriorityRange(int* leastPriority, int* greatestPriority) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceGetStreamPriorityRange(leastPriority, greatestPriority) + return _static_cudaDeviceGetStreamPriorityRange(leastPriority, greatestPriority) + + +cdef cudaError_t _cudaDeviceSetCacheConfig(cudaFuncCache cacheConfig) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceSetCacheConfig(cacheConfig) + return _static_cudaDeviceSetCacheConfig(cacheConfig) + + +cdef cudaError_t _cudaDeviceGetByPCIBusId(int* device, const char* pciBusId) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceGetByPCIBusId(device, pciBusId) + return _static_cudaDeviceGetByPCIBusId(device, pciBusId) + + +cdef cudaError_t _cudaDeviceGetPCIBusId(char* pciBusId, int len, int device) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceGetPCIBusId(pciBusId, len, device) + return _static_cudaDeviceGetPCIBusId(pciBusId, len, device) + + +cdef cudaError_t _cudaIpcGetEventHandle(cudaIpcEventHandle_t* handle, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaIpcGetEventHandle(handle, event) + return _static_cudaIpcGetEventHandle(handle, event) + + +cdef cudaError_t _cudaIpcOpenEventHandle(cudaEvent_t* event, cudaIpcEventHandle_t handle) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaIpcOpenEventHandle(event, handle) + return _static_cudaIpcOpenEventHandle(event, handle) + + +cdef cudaError_t _cudaIpcGetMemHandle(cudaIpcMemHandle_t* handle, void* devPtr) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaIpcGetMemHandle(handle, devPtr) + return _static_cudaIpcGetMemHandle(handle, devPtr) + + +cdef cudaError_t _cudaIpcOpenMemHandle(void** devPtr, cudaIpcMemHandle_t handle, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaIpcOpenMemHandle(devPtr, handle, flags) + return _static_cudaIpcOpenMemHandle(devPtr, handle, flags) + + +cdef cudaError_t _cudaIpcCloseMemHandle(void* devPtr) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaIpcCloseMemHandle(devPtr) + return _static_cudaIpcCloseMemHandle(devPtr) + + +cdef cudaError_t _cudaDeviceFlushGPUDirectRDMAWrites(cudaFlushGPUDirectRDMAWritesTarget target, cudaFlushGPUDirectRDMAWritesScope scope) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceFlushGPUDirectRDMAWrites(target, scope) + return _static_cudaDeviceFlushGPUDirectRDMAWrites(target, scope) + + +cdef cudaError_t _cudaDeviceRegisterAsyncNotification(int device, cudaAsyncCallback callbackFunc, void* userData, cudaAsyncCallbackHandle_t* callback) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceRegisterAsyncNotification(device, callbackFunc, userData, callback) + return _static_cudaDeviceRegisterAsyncNotification(device, callbackFunc, userData, callback) + + +cdef cudaError_t _cudaDeviceUnregisterAsyncNotification(int device, cudaAsyncCallbackHandle_t callback) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceUnregisterAsyncNotification(device, callback) + return _static_cudaDeviceUnregisterAsyncNotification(device, callback) + + +cdef cudaError_t _cudaDeviceGetSharedMemConfig(cudaSharedMemConfig* pConfig) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceGetSharedMemConfig(pConfig) + return _static_cudaDeviceGetSharedMemConfig(pConfig) + + +cdef cudaError_t _cudaDeviceSetSharedMemConfig(cudaSharedMemConfig config) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceSetSharedMemConfig(config) + return _static_cudaDeviceSetSharedMemConfig(config) + + +cdef cudaError_t _cudaGetLastError() except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGetLastError() + return _static_cudaGetLastError() + + +cdef cudaError_t _cudaPeekAtLastError() except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaPeekAtLastError() + return _static_cudaPeekAtLastError() + + +cdef const char* _cudaGetErrorName(cudaError_t error) except?NULL nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGetErrorName(error) + return _static_cudaGetErrorName(error) + + +cdef const char* _cudaGetErrorString(cudaError_t error) except?NULL nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGetErrorString(error) + return _static_cudaGetErrorString(error) + + +cdef cudaError_t _cudaGetDeviceCount(int* count) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGetDeviceCount(count) + return _static_cudaGetDeviceCount(count) + + +cdef cudaError_t _cudaDeviceGetAttribute(int* value, cudaDeviceAttr attr, int device) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceGetAttribute(value, attr, device) + return _static_cudaDeviceGetAttribute(value, attr, device) + + +cdef cudaError_t _cudaDeviceGetDefaultMemPool(cudaMemPool_t* memPool, int device) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceGetDefaultMemPool(memPool, device) + return _static_cudaDeviceGetDefaultMemPool(memPool, device) + + +cdef cudaError_t _cudaDeviceSetMemPool(int device, cudaMemPool_t memPool) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceSetMemPool(device, memPool) + return _static_cudaDeviceSetMemPool(device, memPool) + + +cdef cudaError_t _cudaDeviceGetMemPool(cudaMemPool_t* memPool, int device) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceGetMemPool(memPool, device) + return _static_cudaDeviceGetMemPool(memPool, device) + + +cdef cudaError_t _cudaDeviceGetNvSciSyncAttributes(void* nvSciSyncAttrList, int device, int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceGetNvSciSyncAttributes(nvSciSyncAttrList, device, flags) + return _static_cudaDeviceGetNvSciSyncAttributes(nvSciSyncAttrList, device, flags) + + +cdef cudaError_t _cudaDeviceGetP2PAttribute(int* value, cudaDeviceP2PAttr attr, int srcDevice, int dstDevice) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceGetP2PAttribute(value, attr, srcDevice, dstDevice) + return _static_cudaDeviceGetP2PAttribute(value, attr, srcDevice, dstDevice) + + +cdef cudaError_t _cudaChooseDevice(int* device, const cudaDeviceProp* prop) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaChooseDevice(device, prop) + return _static_cudaChooseDevice(device, prop) + + +cdef cudaError_t _cudaInitDevice(int device, unsigned int deviceFlags, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaInitDevice(device, deviceFlags, flags) + return _static_cudaInitDevice(device, deviceFlags, flags) + + +cdef cudaError_t _cudaSetDevice(int device) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaSetDevice(device) + return _static_cudaSetDevice(device) + + +cdef cudaError_t _cudaGetDevice(int* device) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGetDevice(device) + return _static_cudaGetDevice(device) + + +cdef cudaError_t _cudaSetDeviceFlags(unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaSetDeviceFlags(flags) + return _static_cudaSetDeviceFlags(flags) + + +cdef cudaError_t _cudaGetDeviceFlags(unsigned int* flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGetDeviceFlags(flags) + return _static_cudaGetDeviceFlags(flags) + + +cdef cudaError_t _cudaStreamCreate(cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamCreate(pStream) + return _static_cudaStreamCreate(pStream) + + +cdef cudaError_t _cudaStreamCreateWithFlags(cudaStream_t* pStream, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamCreateWithFlags(pStream, flags) + return _static_cudaStreamCreateWithFlags(pStream, flags) + + +cdef cudaError_t _cudaStreamCreateWithPriority(cudaStream_t* pStream, unsigned int flags, int priority) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamCreateWithPriority(pStream, flags, priority) + return _static_cudaStreamCreateWithPriority(pStream, flags, priority) + + +cdef cudaError_t _cudaStreamGetPriority(cudaStream_t hStream, int* priority) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamGetPriority(hStream, priority) + return _static_cudaStreamGetPriority(hStream, priority) + + +cdef cudaError_t _cudaStreamGetFlags(cudaStream_t hStream, unsigned int* flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamGetFlags(hStream, flags) + return _static_cudaStreamGetFlags(hStream, flags) + + +cdef cudaError_t _cudaStreamGetId(cudaStream_t hStream, unsigned long long* streamId) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamGetId(hStream, streamId) + return _static_cudaStreamGetId(hStream, streamId) + + +cdef cudaError_t _cudaStreamGetDevice(cudaStream_t hStream, int* device) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamGetDevice(hStream, device) + return _static_cudaStreamGetDevice(hStream, device) + + +cdef cudaError_t _cudaCtxResetPersistingL2Cache() except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaCtxResetPersistingL2Cache() + return _static_cudaCtxResetPersistingL2Cache() + + +cdef cudaError_t _cudaStreamCopyAttributes(cudaStream_t dst, cudaStream_t src) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamCopyAttributes(dst, src) + return _static_cudaStreamCopyAttributes(dst, src) + + +cdef cudaError_t _cudaStreamGetAttribute(cudaStream_t hStream, cudaStreamAttrID attr, cudaStreamAttrValue* value_out) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamGetAttribute(hStream, attr, value_out) + return _static_cudaStreamGetAttribute(hStream, attr, value_out) + + +cdef cudaError_t _cudaStreamSetAttribute(cudaStream_t hStream, cudaStreamAttrID attr, const cudaStreamAttrValue* value) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamSetAttribute(hStream, attr, value) + return _static_cudaStreamSetAttribute(hStream, attr, value) + + +cdef cudaError_t _cudaStreamDestroy(cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamDestroy(stream) + return _static_cudaStreamDestroy(stream) + + +cdef cudaError_t _cudaStreamWaitEvent(cudaStream_t stream, cudaEvent_t event, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamWaitEvent(stream, event, flags) + return _static_cudaStreamWaitEvent(stream, event, flags) + + +cdef cudaError_t _cudaStreamAddCallback(cudaStream_t stream, cudaStreamCallback_t callback, void* userData, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamAddCallback(stream, callback, userData, flags) + return _static_cudaStreamAddCallback(stream, callback, userData, flags) + + +cdef cudaError_t _cudaStreamSynchronize(cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamSynchronize(stream) + return _static_cudaStreamSynchronize(stream) + + +cdef cudaError_t _cudaStreamQuery(cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamQuery(stream) + return _static_cudaStreamQuery(stream) + + +cdef cudaError_t _cudaStreamAttachMemAsync(cudaStream_t stream, void* devPtr, size_t length, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamAttachMemAsync(stream, devPtr, length, flags) + return _static_cudaStreamAttachMemAsync(stream, devPtr, length, flags) + + +cdef cudaError_t _cudaStreamBeginCapture(cudaStream_t stream, cudaStreamCaptureMode mode) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamBeginCapture(stream, mode) + return _static_cudaStreamBeginCapture(stream, mode) + + +cdef cudaError_t _cudaStreamBeginCaptureToGraph(cudaStream_t stream, cudaGraph_t graph, const cudaGraphNode_t* dependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, cudaStreamCaptureMode mode) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamBeginCaptureToGraph(stream, graph, dependencies, dependencyData, numDependencies, mode) + return _static_cudaStreamBeginCaptureToGraph(stream, graph, dependencies, dependencyData, numDependencies, mode) + + +cdef cudaError_t _cudaThreadExchangeStreamCaptureMode(cudaStreamCaptureMode* mode) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaThreadExchangeStreamCaptureMode(mode) + return _static_cudaThreadExchangeStreamCaptureMode(mode) + + +cdef cudaError_t _cudaStreamEndCapture(cudaStream_t stream, cudaGraph_t* pGraph) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamEndCapture(stream, pGraph) + return _static_cudaStreamEndCapture(stream, pGraph) + + +cdef cudaError_t _cudaStreamIsCapturing(cudaStream_t stream, cudaStreamCaptureStatus* pCaptureStatus) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamIsCapturing(stream, pCaptureStatus) + return _static_cudaStreamIsCapturing(stream, pCaptureStatus) + + +cdef cudaError_t _cudaStreamUpdateCaptureDependencies(cudaStream_t stream, cudaGraphNode_t* dependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamUpdateCaptureDependencies(stream, dependencies, dependencyData, numDependencies, flags) + return _static_cudaStreamUpdateCaptureDependencies(stream, dependencies, dependencyData, numDependencies, flags) + + +cdef cudaError_t _cudaEventCreate(cudaEvent_t* event) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaEventCreate(event) + return _static_cudaEventCreate(event) + + +cdef cudaError_t _cudaEventCreateWithFlags(cudaEvent_t* event, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaEventCreateWithFlags(event, flags) + return _static_cudaEventCreateWithFlags(event, flags) + + +cdef cudaError_t _cudaEventRecord(cudaEvent_t event, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaEventRecord(event, stream) + return _static_cudaEventRecord(event, stream) + + +cdef cudaError_t _cudaEventRecordWithFlags(cudaEvent_t event, cudaStream_t stream, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaEventRecordWithFlags(event, stream, flags) + return _static_cudaEventRecordWithFlags(event, stream, flags) + + +cdef cudaError_t _cudaEventQuery(cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaEventQuery(event) + return _static_cudaEventQuery(event) + + +cdef cudaError_t _cudaEventSynchronize(cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaEventSynchronize(event) + return _static_cudaEventSynchronize(event) + + +cdef cudaError_t _cudaEventDestroy(cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaEventDestroy(event) + return _static_cudaEventDestroy(event) + + +cdef cudaError_t _cudaEventElapsedTime(float* ms, cudaEvent_t start, cudaEvent_t end) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaEventElapsedTime(ms, start, end) + return _static_cudaEventElapsedTime(ms, start, end) + + +cdef cudaError_t _cudaImportExternalMemory(cudaExternalMemory_t* extMem_out, const cudaExternalMemoryHandleDesc* memHandleDesc) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaImportExternalMemory(extMem_out, memHandleDesc) + return _static_cudaImportExternalMemory(extMem_out, memHandleDesc) + + +cdef cudaError_t _cudaExternalMemoryGetMappedBuffer(void** devPtr, cudaExternalMemory_t extMem, const cudaExternalMemoryBufferDesc* bufferDesc) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaExternalMemoryGetMappedBuffer(devPtr, extMem, bufferDesc) + return _static_cudaExternalMemoryGetMappedBuffer(devPtr, extMem, bufferDesc) + + +cdef cudaError_t _cudaExternalMemoryGetMappedMipmappedArray(cudaMipmappedArray_t* mipmap, cudaExternalMemory_t extMem, const cudaExternalMemoryMipmappedArrayDesc* mipmapDesc) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaExternalMemoryGetMappedMipmappedArray(mipmap, extMem, mipmapDesc) + return _static_cudaExternalMemoryGetMappedMipmappedArray(mipmap, extMem, mipmapDesc) + + +cdef cudaError_t _cudaDestroyExternalMemory(cudaExternalMemory_t extMem) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDestroyExternalMemory(extMem) + return _static_cudaDestroyExternalMemory(extMem) + + +cdef cudaError_t _cudaImportExternalSemaphore(cudaExternalSemaphore_t* extSem_out, const cudaExternalSemaphoreHandleDesc* semHandleDesc) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaImportExternalSemaphore(extSem_out, semHandleDesc) + return _static_cudaImportExternalSemaphore(extSem_out, semHandleDesc) + + +cdef cudaError_t _cudaDestroyExternalSemaphore(cudaExternalSemaphore_t extSem) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDestroyExternalSemaphore(extSem) + return _static_cudaDestroyExternalSemaphore(extSem) + + +cdef cudaError_t _cudaFuncSetCacheConfig(const void* func, cudaFuncCache cacheConfig) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaFuncSetCacheConfig(func, cacheConfig) + return _static_cudaFuncSetCacheConfig(func, cacheConfig) + + +cdef cudaError_t _cudaFuncGetAttributes(cudaFuncAttributes* attr, const void* func) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaFuncGetAttributes(attr, func) + return _static_cudaFuncGetAttributes(attr, func) + + +cdef cudaError_t _cudaFuncSetAttribute(const void* func, cudaFuncAttribute attr, int value) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaFuncSetAttribute(func, attr, value) + return _static_cudaFuncSetAttribute(func, attr, value) + + +cdef cudaError_t _cudaFuncGetName(const char** name, const void* func) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaFuncGetName(name, func) + return _static_cudaFuncGetName(name, func) + + +cdef cudaError_t _cudaFuncGetParamInfo(const void* func, size_t paramIndex, size_t* paramOffset, size_t* paramSize) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaFuncGetParamInfo(func, paramIndex, paramOffset, paramSize) + return _static_cudaFuncGetParamInfo(func, paramIndex, paramOffset, paramSize) + + +cdef cudaError_t _cudaLaunchHostFunc(cudaStream_t stream, cudaHostFn_t fn, void* userData) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaLaunchHostFunc(stream, fn, userData) + return _static_cudaLaunchHostFunc(stream, fn, userData) + + +cdef cudaError_t _cudaFuncSetSharedMemConfig(const void* func, cudaSharedMemConfig config) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaFuncSetSharedMemConfig(func, config) + return _static_cudaFuncSetSharedMemConfig(func, config) + + +cdef cudaError_t _cudaOccupancyMaxActiveBlocksPerMultiprocessor(int* numBlocks, const void* func, int blockSize, size_t dynamicSMemSize) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaOccupancyMaxActiveBlocksPerMultiprocessor(numBlocks, func, blockSize, dynamicSMemSize) + return _static_cudaOccupancyMaxActiveBlocksPerMultiprocessor(numBlocks, func, blockSize, dynamicSMemSize) + + +cdef cudaError_t _cudaOccupancyAvailableDynamicSMemPerBlock(size_t* dynamicSmemSize, const void* func, int numBlocks, int blockSize) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaOccupancyAvailableDynamicSMemPerBlock(dynamicSmemSize, func, numBlocks, blockSize) + return _static_cudaOccupancyAvailableDynamicSMemPerBlock(dynamicSmemSize, func, numBlocks, blockSize) + + +cdef cudaError_t _cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(int* numBlocks, const void* func, int blockSize, size_t dynamicSMemSize, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(numBlocks, func, blockSize, dynamicSMemSize, flags) + return _static_cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(numBlocks, func, blockSize, dynamicSMemSize, flags) + + +cdef cudaError_t _cudaMallocManaged(void** devPtr, size_t size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMallocManaged(devPtr, size, flags) + return _static_cudaMallocManaged(devPtr, size, flags) + + +cdef cudaError_t _cudaMalloc(void** devPtr, size_t size) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMalloc(devPtr, size) + return _static_cudaMalloc(devPtr, size) + + +cdef cudaError_t _cudaMallocHost(void** ptr, size_t size) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMallocHost(ptr, size) + return _static_cudaMallocHost(ptr, size) + + +cdef cudaError_t _cudaMallocPitch(void** devPtr, size_t* pitch, size_t width, size_t height) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMallocPitch(devPtr, pitch, width, height) + return _static_cudaMallocPitch(devPtr, pitch, width, height) + + +cdef cudaError_t _cudaMallocArray(cudaArray_t* array, const cudaChannelFormatDesc* desc, size_t width, size_t height, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMallocArray(array, desc, width, height, flags) + return _static_cudaMallocArray(array, desc, width, height, flags) + + +cdef cudaError_t _cudaFree(void* devPtr) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaFree(devPtr) + return _static_cudaFree(devPtr) + + +cdef cudaError_t _cudaFreeHost(void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaFreeHost(ptr) + return _static_cudaFreeHost(ptr) + + +cdef cudaError_t _cudaFreeArray(cudaArray_t array) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaFreeArray(array) + return _static_cudaFreeArray(array) + + +cdef cudaError_t _cudaFreeMipmappedArray(cudaMipmappedArray_t mipmappedArray) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaFreeMipmappedArray(mipmappedArray) + return _static_cudaFreeMipmappedArray(mipmappedArray) + + +cdef cudaError_t _cudaHostAlloc(void** pHost, size_t size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaHostAlloc(pHost, size, flags) + return _static_cudaHostAlloc(pHost, size, flags) + + +cdef cudaError_t _cudaHostRegister(void* ptr, size_t size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaHostRegister(ptr, size, flags) + return _static_cudaHostRegister(ptr, size, flags) + + +cdef cudaError_t _cudaHostUnregister(void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaHostUnregister(ptr) + return _static_cudaHostUnregister(ptr) + + +cdef cudaError_t _cudaHostGetDevicePointer(void** pDevice, void* pHost, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaHostGetDevicePointer(pDevice, pHost, flags) + return _static_cudaHostGetDevicePointer(pDevice, pHost, flags) + + +cdef cudaError_t _cudaHostGetFlags(unsigned int* pFlags, void* pHost) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaHostGetFlags(pFlags, pHost) + return _static_cudaHostGetFlags(pFlags, pHost) + + +cdef cudaError_t _cudaMalloc3D(cudaPitchedPtr* pitchedDevPtr, cudaExtent extent) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMalloc3D(pitchedDevPtr, extent) + return _static_cudaMalloc3D(pitchedDevPtr, extent) + + +cdef cudaError_t _cudaMalloc3DArray(cudaArray_t* array, const cudaChannelFormatDesc* desc, cudaExtent extent, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMalloc3DArray(array, desc, extent, flags) + return _static_cudaMalloc3DArray(array, desc, extent, flags) + + +cdef cudaError_t _cudaMallocMipmappedArray(cudaMipmappedArray_t* mipmappedArray, const cudaChannelFormatDesc* desc, cudaExtent extent, unsigned int numLevels, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMallocMipmappedArray(mipmappedArray, desc, extent, numLevels, flags) + return _static_cudaMallocMipmappedArray(mipmappedArray, desc, extent, numLevels, flags) + + +cdef cudaError_t _cudaGetMipmappedArrayLevel(cudaArray_t* levelArray, cudaMipmappedArray_const_t mipmappedArray, unsigned int level) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGetMipmappedArrayLevel(levelArray, mipmappedArray, level) + return _static_cudaGetMipmappedArrayLevel(levelArray, mipmappedArray, level) + + +cdef cudaError_t _cudaMemcpy3D(const cudaMemcpy3DParms* p) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpy3D(p) + return _static_cudaMemcpy3D(p) + + +cdef cudaError_t _cudaMemcpy3DPeer(const cudaMemcpy3DPeerParms* p) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpy3DPeer(p) + return _static_cudaMemcpy3DPeer(p) + + +cdef cudaError_t _cudaMemcpy3DAsync(const cudaMemcpy3DParms* p, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpy3DAsync(p, stream) + return _static_cudaMemcpy3DAsync(p, stream) + + +cdef cudaError_t _cudaMemcpy3DPeerAsync(const cudaMemcpy3DPeerParms* p, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpy3DPeerAsync(p, stream) + return _static_cudaMemcpy3DPeerAsync(p, stream) + + +cdef cudaError_t _cudaMemGetInfo(size_t* free, size_t* total) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemGetInfo(free, total) + return _static_cudaMemGetInfo(free, total) + + +cdef cudaError_t _cudaArrayGetInfo(cudaChannelFormatDesc* desc, cudaExtent* extent, unsigned int* flags, cudaArray_t array) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaArrayGetInfo(desc, extent, flags, array) + return _static_cudaArrayGetInfo(desc, extent, flags, array) + + +cdef cudaError_t _cudaArrayGetPlane(cudaArray_t* pPlaneArray, cudaArray_t hArray, unsigned int planeIdx) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaArrayGetPlane(pPlaneArray, hArray, planeIdx) + return _static_cudaArrayGetPlane(pPlaneArray, hArray, planeIdx) + + +cdef cudaError_t _cudaArrayGetMemoryRequirements(cudaArrayMemoryRequirements* memoryRequirements, cudaArray_t array, int device) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaArrayGetMemoryRequirements(memoryRequirements, array, device) + return _static_cudaArrayGetMemoryRequirements(memoryRequirements, array, device) + + +cdef cudaError_t _cudaMipmappedArrayGetMemoryRequirements(cudaArrayMemoryRequirements* memoryRequirements, cudaMipmappedArray_t mipmap, int device) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMipmappedArrayGetMemoryRequirements(memoryRequirements, mipmap, device) + return _static_cudaMipmappedArrayGetMemoryRequirements(memoryRequirements, mipmap, device) + + +cdef cudaError_t _cudaArrayGetSparseProperties(cudaArraySparseProperties* sparseProperties, cudaArray_t array) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaArrayGetSparseProperties(sparseProperties, array) + return _static_cudaArrayGetSparseProperties(sparseProperties, array) + + +cdef cudaError_t _cudaMipmappedArrayGetSparseProperties(cudaArraySparseProperties* sparseProperties, cudaMipmappedArray_t mipmap) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMipmappedArrayGetSparseProperties(sparseProperties, mipmap) + return _static_cudaMipmappedArrayGetSparseProperties(sparseProperties, mipmap) + + +cdef cudaError_t _cudaMemcpy(void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpy(dst, src, count, kind) + return _static_cudaMemcpy(dst, src, count, kind) + + +cdef cudaError_t _cudaMemcpyPeer(void* dst, int dstDevice, const void* src, int srcDevice, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpyPeer(dst, dstDevice, src, srcDevice, count) + return _static_cudaMemcpyPeer(dst, dstDevice, src, srcDevice, count) + + +cdef cudaError_t _cudaMemcpy2D(void* dst, size_t dpitch, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpy2D(dst, dpitch, src, spitch, width, height, kind) + return _static_cudaMemcpy2D(dst, dpitch, src, spitch, width, height, kind) + + +cdef cudaError_t _cudaMemcpy2DToArray(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpy2DToArray(dst, wOffset, hOffset, src, spitch, width, height, kind) + return _static_cudaMemcpy2DToArray(dst, wOffset, hOffset, src, spitch, width, height, kind) + + +cdef cudaError_t _cudaMemcpy2DFromArray(void* dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpy2DFromArray(dst, dpitch, src, wOffset, hOffset, width, height, kind) + return _static_cudaMemcpy2DFromArray(dst, dpitch, src, wOffset, hOffset, width, height, kind) + + +cdef cudaError_t _cudaMemcpy2DArrayToArray(cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpy2DArrayToArray(dst, wOffsetDst, hOffsetDst, src, wOffsetSrc, hOffsetSrc, width, height, kind) + return _static_cudaMemcpy2DArrayToArray(dst, wOffsetDst, hOffsetDst, src, wOffsetSrc, hOffsetSrc, width, height, kind) + + +cdef cudaError_t _cudaMemcpyAsync(void* dst, const void* src, size_t count, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpyAsync(dst, src, count, kind, stream) + return _static_cudaMemcpyAsync(dst, src, count, kind, stream) + + +cdef cudaError_t _cudaMemcpyPeerAsync(void* dst, int dstDevice, const void* src, int srcDevice, size_t count, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpyPeerAsync(dst, dstDevice, src, srcDevice, count, stream) + return _static_cudaMemcpyPeerAsync(dst, dstDevice, src, srcDevice, count, stream) + + +cdef cudaError_t _cudaMemcpyBatchAsync(const void** dsts, const void** srcs, const size_t* sizes, size_t count, cudaMemcpyAttributes* attrs, size_t* attrsIdxs, size_t numAttrs, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpyBatchAsync(dsts, srcs, sizes, count, attrs, attrsIdxs, numAttrs, stream) + return _static_cudaMemcpyBatchAsync(dsts, srcs, sizes, count, attrs, attrsIdxs, numAttrs, stream) + + +cdef cudaError_t _cudaMemcpy3DBatchAsync(size_t numOps, cudaMemcpy3DBatchOp* opList, unsigned long long flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpy3DBatchAsync(numOps, opList, flags, stream) + return _static_cudaMemcpy3DBatchAsync(numOps, opList, flags, stream) + + +cdef cudaError_t _cudaMemcpy2DAsync(void* dst, size_t dpitch, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpy2DAsync(dst, dpitch, src, spitch, width, height, kind, stream) + return _static_cudaMemcpy2DAsync(dst, dpitch, src, spitch, width, height, kind, stream) + + +cdef cudaError_t _cudaMemcpy2DToArrayAsync(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpy2DToArrayAsync(dst, wOffset, hOffset, src, spitch, width, height, kind, stream) + return _static_cudaMemcpy2DToArrayAsync(dst, wOffset, hOffset, src, spitch, width, height, kind, stream) + + +cdef cudaError_t _cudaMemcpy2DFromArrayAsync(void* dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpy2DFromArrayAsync(dst, dpitch, src, wOffset, hOffset, width, height, kind, stream) + return _static_cudaMemcpy2DFromArrayAsync(dst, dpitch, src, wOffset, hOffset, width, height, kind, stream) + + +cdef cudaError_t _cudaMemset(void* devPtr, int value, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemset(devPtr, value, count) + return _static_cudaMemset(devPtr, value, count) + + +cdef cudaError_t _cudaMemset2D(void* devPtr, size_t pitch, int value, size_t width, size_t height) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemset2D(devPtr, pitch, value, width, height) + return _static_cudaMemset2D(devPtr, pitch, value, width, height) + + +cdef cudaError_t _cudaMemset3D(cudaPitchedPtr pitchedDevPtr, int value, cudaExtent extent) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemset3D(pitchedDevPtr, value, extent) + return _static_cudaMemset3D(pitchedDevPtr, value, extent) + + +cdef cudaError_t _cudaMemsetAsync(void* devPtr, int value, size_t count, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemsetAsync(devPtr, value, count, stream) + return _static_cudaMemsetAsync(devPtr, value, count, stream) + + +cdef cudaError_t _cudaMemset2DAsync(void* devPtr, size_t pitch, int value, size_t width, size_t height, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemset2DAsync(devPtr, pitch, value, width, height, stream) + return _static_cudaMemset2DAsync(devPtr, pitch, value, width, height, stream) + + +cdef cudaError_t _cudaMemset3DAsync(cudaPitchedPtr pitchedDevPtr, int value, cudaExtent extent, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemset3DAsync(pitchedDevPtr, value, extent, stream) + return _static_cudaMemset3DAsync(pitchedDevPtr, value, extent, stream) + + +cdef cudaError_t _cudaMemPrefetchAsync(const void* devPtr, size_t count, cudaMemLocation location, unsigned int flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemPrefetchAsync(devPtr, count, location, flags, stream) + return _static_cudaMemPrefetchAsync(devPtr, count, location, flags, stream) + + +cdef cudaError_t _cudaMemAdvise(const void* devPtr, size_t count, cudaMemoryAdvise advice, cudaMemLocation location) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemAdvise(devPtr, count, advice, location) + return _static_cudaMemAdvise(devPtr, count, advice, location) + + +cdef cudaError_t _cudaMemRangeGetAttribute(void* data, size_t dataSize, cudaMemRangeAttribute attribute, const void* devPtr, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemRangeGetAttribute(data, dataSize, attribute, devPtr, count) + return _static_cudaMemRangeGetAttribute(data, dataSize, attribute, devPtr, count) + + +cdef cudaError_t _cudaMemRangeGetAttributes(void** data, size_t* dataSizes, cudaMemRangeAttribute* attributes, size_t numAttributes, const void* devPtr, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemRangeGetAttributes(data, dataSizes, attributes, numAttributes, devPtr, count) + return _static_cudaMemRangeGetAttributes(data, dataSizes, attributes, numAttributes, devPtr, count) + + +cdef cudaError_t _cudaMemcpyToArray(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpyToArray(dst, wOffset, hOffset, src, count, kind) + return _static_cudaMemcpyToArray(dst, wOffset, hOffset, src, count, kind) + + +cdef cudaError_t _cudaMemcpyFromArray(void* dst, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpyFromArray(dst, src, wOffset, hOffset, count, kind) + return _static_cudaMemcpyFromArray(dst, src, wOffset, hOffset, count, kind) + + +cdef cudaError_t _cudaMemcpyArrayToArray(cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpyArrayToArray(dst, wOffsetDst, hOffsetDst, src, wOffsetSrc, hOffsetSrc, count, kind) + return _static_cudaMemcpyArrayToArray(dst, wOffsetDst, hOffsetDst, src, wOffsetSrc, hOffsetSrc, count, kind) + + +cdef cudaError_t _cudaMemcpyToArrayAsync(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t count, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpyToArrayAsync(dst, wOffset, hOffset, src, count, kind, stream) + return _static_cudaMemcpyToArrayAsync(dst, wOffset, hOffset, src, count, kind, stream) + + +cdef cudaError_t _cudaMemcpyFromArrayAsync(void* dst, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpyFromArrayAsync(dst, src, wOffset, hOffset, count, kind, stream) + return _static_cudaMemcpyFromArrayAsync(dst, src, wOffset, hOffset, count, kind, stream) + + +cdef cudaError_t _cudaMallocAsync(void** devPtr, size_t size, cudaStream_t hStream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMallocAsync(devPtr, size, hStream) + return _static_cudaMallocAsync(devPtr, size, hStream) + + +cdef cudaError_t _cudaFreeAsync(void* devPtr, cudaStream_t hStream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaFreeAsync(devPtr, hStream) + return _static_cudaFreeAsync(devPtr, hStream) + + +cdef cudaError_t _cudaMemPoolTrimTo(cudaMemPool_t memPool, size_t minBytesToKeep) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemPoolTrimTo(memPool, minBytesToKeep) + return _static_cudaMemPoolTrimTo(memPool, minBytesToKeep) + + +cdef cudaError_t _cudaMemPoolSetAttribute(cudaMemPool_t memPool, cudaMemPoolAttr attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemPoolSetAttribute(memPool, attr, value) + return _static_cudaMemPoolSetAttribute(memPool, attr, value) + + +cdef cudaError_t _cudaMemPoolGetAttribute(cudaMemPool_t memPool, cudaMemPoolAttr attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemPoolGetAttribute(memPool, attr, value) + return _static_cudaMemPoolGetAttribute(memPool, attr, value) + + +cdef cudaError_t _cudaMemPoolSetAccess(cudaMemPool_t memPool, const cudaMemAccessDesc* descList, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemPoolSetAccess(memPool, descList, count) + return _static_cudaMemPoolSetAccess(memPool, descList, count) + + +cdef cudaError_t _cudaMemPoolGetAccess(cudaMemAccessFlags* flags, cudaMemPool_t memPool, cudaMemLocation* location) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemPoolGetAccess(flags, memPool, location) + return _static_cudaMemPoolGetAccess(flags, memPool, location) + + +cdef cudaError_t _cudaMemPoolCreate(cudaMemPool_t* memPool, const cudaMemPoolProps* poolProps) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemPoolCreate(memPool, poolProps) + return _static_cudaMemPoolCreate(memPool, poolProps) + + +cdef cudaError_t _cudaMemPoolDestroy(cudaMemPool_t memPool) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemPoolDestroy(memPool) + return _static_cudaMemPoolDestroy(memPool) + + +cdef cudaError_t _cudaMallocFromPoolAsync(void** ptr, size_t size, cudaMemPool_t memPool, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMallocFromPoolAsync(ptr, size, memPool, stream) + return _static_cudaMallocFromPoolAsync(ptr, size, memPool, stream) + + +cdef cudaError_t _cudaMemPoolExportToShareableHandle(void* shareableHandle, cudaMemPool_t memPool, cudaMemAllocationHandleType handleType, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemPoolExportToShareableHandle(shareableHandle, memPool, handleType, flags) + return _static_cudaMemPoolExportToShareableHandle(shareableHandle, memPool, handleType, flags) + + +cdef cudaError_t _cudaMemPoolImportFromShareableHandle(cudaMemPool_t* memPool, void* shareableHandle, cudaMemAllocationHandleType handleType, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemPoolImportFromShareableHandle(memPool, shareableHandle, handleType, flags) + return _static_cudaMemPoolImportFromShareableHandle(memPool, shareableHandle, handleType, flags) + + +cdef cudaError_t _cudaMemPoolExportPointer(cudaMemPoolPtrExportData* exportData, void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemPoolExportPointer(exportData, ptr) + return _static_cudaMemPoolExportPointer(exportData, ptr) + + +cdef cudaError_t _cudaMemPoolImportPointer(void** ptr, cudaMemPool_t memPool, cudaMemPoolPtrExportData* exportData) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemPoolImportPointer(ptr, memPool, exportData) + return _static_cudaMemPoolImportPointer(ptr, memPool, exportData) + + +cdef cudaError_t _cudaPointerGetAttributes(cudaPointerAttributes* attributes, const void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaPointerGetAttributes(attributes, ptr) + return _static_cudaPointerGetAttributes(attributes, ptr) + + +cdef cudaError_t _cudaDeviceCanAccessPeer(int* canAccessPeer, int device, int peerDevice) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceCanAccessPeer(canAccessPeer, device, peerDevice) + return _static_cudaDeviceCanAccessPeer(canAccessPeer, device, peerDevice) + + +cdef cudaError_t _cudaDeviceEnablePeerAccess(int peerDevice, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceEnablePeerAccess(peerDevice, flags) + return _static_cudaDeviceEnablePeerAccess(peerDevice, flags) + + +cdef cudaError_t _cudaDeviceDisablePeerAccess(int peerDevice) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceDisablePeerAccess(peerDevice) + return _static_cudaDeviceDisablePeerAccess(peerDevice) + + +cdef cudaError_t _cudaGraphicsUnregisterResource(cudaGraphicsResource_t resource) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphicsUnregisterResource(resource) + return _static_cudaGraphicsUnregisterResource(resource) + + +cdef cudaError_t _cudaGraphicsResourceSetMapFlags(cudaGraphicsResource_t resource, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphicsResourceSetMapFlags(resource, flags) + return _static_cudaGraphicsResourceSetMapFlags(resource, flags) + + +cdef cudaError_t _cudaGraphicsMapResources(int count, cudaGraphicsResource_t* resources, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphicsMapResources(count, resources, stream) + return _static_cudaGraphicsMapResources(count, resources, stream) + + +cdef cudaError_t _cudaGraphicsUnmapResources(int count, cudaGraphicsResource_t* resources, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphicsUnmapResources(count, resources, stream) + return _static_cudaGraphicsUnmapResources(count, resources, stream) + + +cdef cudaError_t _cudaGraphicsResourceGetMappedPointer(void** devPtr, size_t* size, cudaGraphicsResource_t resource) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphicsResourceGetMappedPointer(devPtr, size, resource) + return _static_cudaGraphicsResourceGetMappedPointer(devPtr, size, resource) + + +cdef cudaError_t _cudaGraphicsSubResourceGetMappedArray(cudaArray_t* array, cudaGraphicsResource_t resource, unsigned int arrayIndex, unsigned int mipLevel) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphicsSubResourceGetMappedArray(array, resource, arrayIndex, mipLevel) + return _static_cudaGraphicsSubResourceGetMappedArray(array, resource, arrayIndex, mipLevel) + + +cdef cudaError_t _cudaGraphicsResourceGetMappedMipmappedArray(cudaMipmappedArray_t* mipmappedArray, cudaGraphicsResource_t resource) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphicsResourceGetMappedMipmappedArray(mipmappedArray, resource) + return _static_cudaGraphicsResourceGetMappedMipmappedArray(mipmappedArray, resource) + + +cdef cudaError_t _cudaGetChannelDesc(cudaChannelFormatDesc* desc, cudaArray_const_t array) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGetChannelDesc(desc, array) + return _static_cudaGetChannelDesc(desc, array) + + +cdef cudaChannelFormatDesc _cudaCreateChannelDesc(int x, int y, int z, int w, cudaChannelFormatKind f) except* nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaCreateChannelDesc(x, y, z, w, f) + return _static_cudaCreateChannelDesc(x, y, z, w, f) + + +cdef cudaError_t _cudaCreateTextureObject(cudaTextureObject_t* pTexObject, const cudaResourceDesc* pResDesc, const cudaTextureDesc* pTexDesc, const cudaResourceViewDesc* pResViewDesc) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaCreateTextureObject(pTexObject, pResDesc, pTexDesc, pResViewDesc) + return _static_cudaCreateTextureObject(pTexObject, pResDesc, pTexDesc, pResViewDesc) + + +cdef cudaError_t _cudaDestroyTextureObject(cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDestroyTextureObject(texObject) + return _static_cudaDestroyTextureObject(texObject) + + +cdef cudaError_t _cudaGetTextureObjectResourceDesc(cudaResourceDesc* pResDesc, cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGetTextureObjectResourceDesc(pResDesc, texObject) + return _static_cudaGetTextureObjectResourceDesc(pResDesc, texObject) + + +cdef cudaError_t _cudaGetTextureObjectTextureDesc(cudaTextureDesc* pTexDesc, cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGetTextureObjectTextureDesc(pTexDesc, texObject) + return _static_cudaGetTextureObjectTextureDesc(pTexDesc, texObject) + + +cdef cudaError_t _cudaGetTextureObjectResourceViewDesc(cudaResourceViewDesc* pResViewDesc, cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGetTextureObjectResourceViewDesc(pResViewDesc, texObject) + return _static_cudaGetTextureObjectResourceViewDesc(pResViewDesc, texObject) + + +cdef cudaError_t _cudaCreateSurfaceObject(cudaSurfaceObject_t* pSurfObject, const cudaResourceDesc* pResDesc) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaCreateSurfaceObject(pSurfObject, pResDesc) + return _static_cudaCreateSurfaceObject(pSurfObject, pResDesc) + + +cdef cudaError_t _cudaDestroySurfaceObject(cudaSurfaceObject_t surfObject) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDestroySurfaceObject(surfObject) + return _static_cudaDestroySurfaceObject(surfObject) + + +cdef cudaError_t _cudaGetSurfaceObjectResourceDesc(cudaResourceDesc* pResDesc, cudaSurfaceObject_t surfObject) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGetSurfaceObjectResourceDesc(pResDesc, surfObject) + return _static_cudaGetSurfaceObjectResourceDesc(pResDesc, surfObject) + + +cdef cudaError_t _cudaDriverGetVersion(int* driverVersion) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDriverGetVersion(driverVersion) + return _static_cudaDriverGetVersion(driverVersion) + + +cdef cudaError_t _cudaRuntimeGetVersion(int* runtimeVersion) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaRuntimeGetVersion(runtimeVersion) + return _static_cudaRuntimeGetVersion(runtimeVersion) + + +cdef cudaError_t _cudaGraphCreate(cudaGraph_t* pGraph, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphCreate(pGraph, flags) + return _static_cudaGraphCreate(pGraph, flags) + + +cdef cudaError_t _cudaGraphAddKernelNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphAddKernelNode(pGraphNode, graph, pDependencies, numDependencies, pNodeParams) + return _static_cudaGraphAddKernelNode(pGraphNode, graph, pDependencies, numDependencies, pNodeParams) + + +cdef cudaError_t _cudaGraphKernelNodeGetParams(cudaGraphNode_t node, cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphKernelNodeGetParams(node, pNodeParams) + return _static_cudaGraphKernelNodeGetParams(node, pNodeParams) + + +cdef cudaError_t _cudaGraphKernelNodeSetParams(cudaGraphNode_t node, const cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphKernelNodeSetParams(node, pNodeParams) + return _static_cudaGraphKernelNodeSetParams(node, pNodeParams) + + +cdef cudaError_t _cudaGraphKernelNodeCopyAttributes(cudaGraphNode_t hDst, cudaGraphNode_t hSrc) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphKernelNodeCopyAttributes(hDst, hSrc) + return _static_cudaGraphKernelNodeCopyAttributes(hDst, hSrc) + + +cdef cudaError_t _cudaGraphKernelNodeGetAttribute(cudaGraphNode_t hNode, cudaKernelNodeAttrID attr, cudaKernelNodeAttrValue* value_out) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphKernelNodeGetAttribute(hNode, attr, value_out) + return _static_cudaGraphKernelNodeGetAttribute(hNode, attr, value_out) + + +cdef cudaError_t _cudaGraphKernelNodeSetAttribute(cudaGraphNode_t hNode, cudaKernelNodeAttrID attr, const cudaKernelNodeAttrValue* value) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphKernelNodeSetAttribute(hNode, attr, value) + return _static_cudaGraphKernelNodeSetAttribute(hNode, attr, value) + + +cdef cudaError_t _cudaGraphAddMemcpyNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaMemcpy3DParms* pCopyParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphAddMemcpyNode(pGraphNode, graph, pDependencies, numDependencies, pCopyParams) + return _static_cudaGraphAddMemcpyNode(pGraphNode, graph, pDependencies, numDependencies, pCopyParams) + + +cdef cudaError_t _cudaGraphAddMemcpyNode1D(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphAddMemcpyNode1D(pGraphNode, graph, pDependencies, numDependencies, dst, src, count, kind) + return _static_cudaGraphAddMemcpyNode1D(pGraphNode, graph, pDependencies, numDependencies, dst, src, count, kind) + + +cdef cudaError_t _cudaGraphMemcpyNodeGetParams(cudaGraphNode_t node, cudaMemcpy3DParms* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphMemcpyNodeGetParams(node, pNodeParams) + return _static_cudaGraphMemcpyNodeGetParams(node, pNodeParams) + + +cdef cudaError_t _cudaGraphMemcpyNodeSetParams(cudaGraphNode_t node, const cudaMemcpy3DParms* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphMemcpyNodeSetParams(node, pNodeParams) + return _static_cudaGraphMemcpyNodeSetParams(node, pNodeParams) + + +cdef cudaError_t _cudaGraphMemcpyNodeSetParams1D(cudaGraphNode_t node, void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphMemcpyNodeSetParams1D(node, dst, src, count, kind) + return _static_cudaGraphMemcpyNodeSetParams1D(node, dst, src, count, kind) + + +cdef cudaError_t _cudaGraphAddMemsetNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaMemsetParams* pMemsetParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphAddMemsetNode(pGraphNode, graph, pDependencies, numDependencies, pMemsetParams) + return _static_cudaGraphAddMemsetNode(pGraphNode, graph, pDependencies, numDependencies, pMemsetParams) + + +cdef cudaError_t _cudaGraphMemsetNodeGetParams(cudaGraphNode_t node, cudaMemsetParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphMemsetNodeGetParams(node, pNodeParams) + return _static_cudaGraphMemsetNodeGetParams(node, pNodeParams) + + +cdef cudaError_t _cudaGraphMemsetNodeSetParams(cudaGraphNode_t node, const cudaMemsetParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphMemsetNodeSetParams(node, pNodeParams) + return _static_cudaGraphMemsetNodeSetParams(node, pNodeParams) + + +cdef cudaError_t _cudaGraphAddHostNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphAddHostNode(pGraphNode, graph, pDependencies, numDependencies, pNodeParams) + return _static_cudaGraphAddHostNode(pGraphNode, graph, pDependencies, numDependencies, pNodeParams) + + +cdef cudaError_t _cudaGraphHostNodeGetParams(cudaGraphNode_t node, cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphHostNodeGetParams(node, pNodeParams) + return _static_cudaGraphHostNodeGetParams(node, pNodeParams) + + +cdef cudaError_t _cudaGraphHostNodeSetParams(cudaGraphNode_t node, const cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphHostNodeSetParams(node, pNodeParams) + return _static_cudaGraphHostNodeSetParams(node, pNodeParams) + + +cdef cudaError_t _cudaGraphAddChildGraphNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaGraph_t childGraph) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphAddChildGraphNode(pGraphNode, graph, pDependencies, numDependencies, childGraph) + return _static_cudaGraphAddChildGraphNode(pGraphNode, graph, pDependencies, numDependencies, childGraph) + + +cdef cudaError_t _cudaGraphChildGraphNodeGetGraph(cudaGraphNode_t node, cudaGraph_t* pGraph) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphChildGraphNodeGetGraph(node, pGraph) + return _static_cudaGraphChildGraphNodeGetGraph(node, pGraph) + + +cdef cudaError_t _cudaGraphAddEmptyNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphAddEmptyNode(pGraphNode, graph, pDependencies, numDependencies) + return _static_cudaGraphAddEmptyNode(pGraphNode, graph, pDependencies, numDependencies) + + +cdef cudaError_t _cudaGraphAddEventRecordNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphAddEventRecordNode(pGraphNode, graph, pDependencies, numDependencies, event) + return _static_cudaGraphAddEventRecordNode(pGraphNode, graph, pDependencies, numDependencies, event) + + +cdef cudaError_t _cudaGraphEventRecordNodeGetEvent(cudaGraphNode_t node, cudaEvent_t* event_out) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphEventRecordNodeGetEvent(node, event_out) + return _static_cudaGraphEventRecordNodeGetEvent(node, event_out) + + +cdef cudaError_t _cudaGraphEventRecordNodeSetEvent(cudaGraphNode_t node, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphEventRecordNodeSetEvent(node, event) + return _static_cudaGraphEventRecordNodeSetEvent(node, event) + + +cdef cudaError_t _cudaGraphAddEventWaitNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphAddEventWaitNode(pGraphNode, graph, pDependencies, numDependencies, event) + return _static_cudaGraphAddEventWaitNode(pGraphNode, graph, pDependencies, numDependencies, event) + + +cdef cudaError_t _cudaGraphEventWaitNodeGetEvent(cudaGraphNode_t node, cudaEvent_t* event_out) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphEventWaitNodeGetEvent(node, event_out) + return _static_cudaGraphEventWaitNodeGetEvent(node, event_out) + + +cdef cudaError_t _cudaGraphEventWaitNodeSetEvent(cudaGraphNode_t node, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphEventWaitNodeSetEvent(node, event) + return _static_cudaGraphEventWaitNodeSetEvent(node, event) + + +cdef cudaError_t _cudaGraphAddExternalSemaphoresSignalNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphAddExternalSemaphoresSignalNode(pGraphNode, graph, pDependencies, numDependencies, nodeParams) + return _static_cudaGraphAddExternalSemaphoresSignalNode(pGraphNode, graph, pDependencies, numDependencies, nodeParams) + + +cdef cudaError_t _cudaGraphExternalSemaphoresSignalNodeGetParams(cudaGraphNode_t hNode, cudaExternalSemaphoreSignalNodeParams* params_out) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphExternalSemaphoresSignalNodeGetParams(hNode, params_out) + return _static_cudaGraphExternalSemaphoresSignalNodeGetParams(hNode, params_out) + + +cdef cudaError_t _cudaGraphExternalSemaphoresSignalNodeSetParams(cudaGraphNode_t hNode, const cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphExternalSemaphoresSignalNodeSetParams(hNode, nodeParams) + return _static_cudaGraphExternalSemaphoresSignalNodeSetParams(hNode, nodeParams) + + +cdef cudaError_t _cudaGraphAddExternalSemaphoresWaitNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphAddExternalSemaphoresWaitNode(pGraphNode, graph, pDependencies, numDependencies, nodeParams) + return _static_cudaGraphAddExternalSemaphoresWaitNode(pGraphNode, graph, pDependencies, numDependencies, nodeParams) + + +cdef cudaError_t _cudaGraphExternalSemaphoresWaitNodeGetParams(cudaGraphNode_t hNode, cudaExternalSemaphoreWaitNodeParams* params_out) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphExternalSemaphoresWaitNodeGetParams(hNode, params_out) + return _static_cudaGraphExternalSemaphoresWaitNodeGetParams(hNode, params_out) + + +cdef cudaError_t _cudaGraphExternalSemaphoresWaitNodeSetParams(cudaGraphNode_t hNode, const cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphExternalSemaphoresWaitNodeSetParams(hNode, nodeParams) + return _static_cudaGraphExternalSemaphoresWaitNodeSetParams(hNode, nodeParams) + + +cdef cudaError_t _cudaGraphAddMemAllocNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaMemAllocNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphAddMemAllocNode(pGraphNode, graph, pDependencies, numDependencies, nodeParams) + return _static_cudaGraphAddMemAllocNode(pGraphNode, graph, pDependencies, numDependencies, nodeParams) + + +cdef cudaError_t _cudaGraphMemAllocNodeGetParams(cudaGraphNode_t node, cudaMemAllocNodeParams* params_out) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphMemAllocNodeGetParams(node, params_out) + return _static_cudaGraphMemAllocNodeGetParams(node, params_out) + + +cdef cudaError_t _cudaGraphAddMemFreeNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, void* dptr) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphAddMemFreeNode(pGraphNode, graph, pDependencies, numDependencies, dptr) + return _static_cudaGraphAddMemFreeNode(pGraphNode, graph, pDependencies, numDependencies, dptr) + + +cdef cudaError_t _cudaGraphMemFreeNodeGetParams(cudaGraphNode_t node, void* dptr_out) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphMemFreeNodeGetParams(node, dptr_out) + return _static_cudaGraphMemFreeNodeGetParams(node, dptr_out) + + +cdef cudaError_t _cudaDeviceGraphMemTrim(int device) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceGraphMemTrim(device) + return _static_cudaDeviceGraphMemTrim(device) + + +cdef cudaError_t _cudaDeviceGetGraphMemAttribute(int device, cudaGraphMemAttributeType attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceGetGraphMemAttribute(device, attr, value) + return _static_cudaDeviceGetGraphMemAttribute(device, attr, value) + + +cdef cudaError_t _cudaDeviceSetGraphMemAttribute(int device, cudaGraphMemAttributeType attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceSetGraphMemAttribute(device, attr, value) + return _static_cudaDeviceSetGraphMemAttribute(device, attr, value) + + +cdef cudaError_t _cudaGraphClone(cudaGraph_t* pGraphClone, cudaGraph_t originalGraph) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphClone(pGraphClone, originalGraph) + return _static_cudaGraphClone(pGraphClone, originalGraph) + + +cdef cudaError_t _cudaGraphNodeFindInClone(cudaGraphNode_t* pNode, cudaGraphNode_t originalNode, cudaGraph_t clonedGraph) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphNodeFindInClone(pNode, originalNode, clonedGraph) + return _static_cudaGraphNodeFindInClone(pNode, originalNode, clonedGraph) + + +cdef cudaError_t _cudaGraphNodeGetType(cudaGraphNode_t node, cudaGraphNodeType* pType) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphNodeGetType(node, pType) + return _static_cudaGraphNodeGetType(node, pType) + + +cdef cudaError_t _cudaGraphGetNodes(cudaGraph_t graph, cudaGraphNode_t* nodes, size_t* numNodes) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphGetNodes(graph, nodes, numNodes) + return _static_cudaGraphGetNodes(graph, nodes, numNodes) + + +cdef cudaError_t _cudaGraphGetRootNodes(cudaGraph_t graph, cudaGraphNode_t* pRootNodes, size_t* pNumRootNodes) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphGetRootNodes(graph, pRootNodes, pNumRootNodes) + return _static_cudaGraphGetRootNodes(graph, pRootNodes, pNumRootNodes) + + +cdef cudaError_t _cudaGraphGetEdges(cudaGraph_t graph, cudaGraphNode_t* from_, cudaGraphNode_t* to, cudaGraphEdgeData* edgeData, size_t* numEdges) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphGetEdges(graph, from_, to, edgeData, numEdges) + return _static_cudaGraphGetEdges(graph, from_, to, edgeData, numEdges) + + +cdef cudaError_t _cudaGraphNodeGetDependencies(cudaGraphNode_t node, cudaGraphNode_t* pDependencies, cudaGraphEdgeData* edgeData, size_t* pNumDependencies) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphNodeGetDependencies(node, pDependencies, edgeData, pNumDependencies) + return _static_cudaGraphNodeGetDependencies(node, pDependencies, edgeData, pNumDependencies) + + +cdef cudaError_t _cudaGraphNodeGetDependentNodes(cudaGraphNode_t node, cudaGraphNode_t* pDependentNodes, cudaGraphEdgeData* edgeData, size_t* pNumDependentNodes) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphNodeGetDependentNodes(node, pDependentNodes, edgeData, pNumDependentNodes) + return _static_cudaGraphNodeGetDependentNodes(node, pDependentNodes, edgeData, pNumDependentNodes) + + +cdef cudaError_t _cudaGraphAddDependencies(cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, const cudaGraphEdgeData* edgeData, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphAddDependencies(graph, from_, to, edgeData, numDependencies) + return _static_cudaGraphAddDependencies(graph, from_, to, edgeData, numDependencies) + + +cdef cudaError_t _cudaGraphRemoveDependencies(cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, const cudaGraphEdgeData* edgeData, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphRemoveDependencies(graph, from_, to, edgeData, numDependencies) + return _static_cudaGraphRemoveDependencies(graph, from_, to, edgeData, numDependencies) + + +cdef cudaError_t _cudaGraphDestroyNode(cudaGraphNode_t node) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphDestroyNode(node) + return _static_cudaGraphDestroyNode(node) + + +cdef cudaError_t _cudaGraphInstantiate(cudaGraphExec_t* pGraphExec, cudaGraph_t graph, unsigned long long flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphInstantiate(pGraphExec, graph, flags) + return _static_cudaGraphInstantiate(pGraphExec, graph, flags) + + +cdef cudaError_t _cudaGraphInstantiateWithFlags(cudaGraphExec_t* pGraphExec, cudaGraph_t graph, unsigned long long flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphInstantiateWithFlags(pGraphExec, graph, flags) + return _static_cudaGraphInstantiateWithFlags(pGraphExec, graph, flags) + + +cdef cudaError_t _cudaGraphInstantiateWithParams(cudaGraphExec_t* pGraphExec, cudaGraph_t graph, cudaGraphInstantiateParams* instantiateParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphInstantiateWithParams(pGraphExec, graph, instantiateParams) + return _static_cudaGraphInstantiateWithParams(pGraphExec, graph, instantiateParams) + + +cdef cudaError_t _cudaGraphExecGetFlags(cudaGraphExec_t graphExec, unsigned long long* flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphExecGetFlags(graphExec, flags) + return _static_cudaGraphExecGetFlags(graphExec, flags) + + +cdef cudaError_t _cudaGraphExecKernelNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphExecKernelNodeSetParams(hGraphExec, node, pNodeParams) + return _static_cudaGraphExecKernelNodeSetParams(hGraphExec, node, pNodeParams) + + +cdef cudaError_t _cudaGraphExecMemcpyNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaMemcpy3DParms* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphExecMemcpyNodeSetParams(hGraphExec, node, pNodeParams) + return _static_cudaGraphExecMemcpyNodeSetParams(hGraphExec, node, pNodeParams) + + +cdef cudaError_t _cudaGraphExecMemcpyNodeSetParams1D(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphExecMemcpyNodeSetParams1D(hGraphExec, node, dst, src, count, kind) + return _static_cudaGraphExecMemcpyNodeSetParams1D(hGraphExec, node, dst, src, count, kind) + + +cdef cudaError_t _cudaGraphExecMemsetNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaMemsetParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphExecMemsetNodeSetParams(hGraphExec, node, pNodeParams) + return _static_cudaGraphExecMemsetNodeSetParams(hGraphExec, node, pNodeParams) + + +cdef cudaError_t _cudaGraphExecHostNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphExecHostNodeSetParams(hGraphExec, node, pNodeParams) + return _static_cudaGraphExecHostNodeSetParams(hGraphExec, node, pNodeParams) + + +cdef cudaError_t _cudaGraphExecChildGraphNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, cudaGraph_t childGraph) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphExecChildGraphNodeSetParams(hGraphExec, node, childGraph) + return _static_cudaGraphExecChildGraphNodeSetParams(hGraphExec, node, childGraph) + + +cdef cudaError_t _cudaGraphExecEventRecordNodeSetEvent(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphExecEventRecordNodeSetEvent(hGraphExec, hNode, event) + return _static_cudaGraphExecEventRecordNodeSetEvent(hGraphExec, hNode, event) + + +cdef cudaError_t _cudaGraphExecEventWaitNodeSetEvent(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphExecEventWaitNodeSetEvent(hGraphExec, hNode, event) + return _static_cudaGraphExecEventWaitNodeSetEvent(hGraphExec, hNode, event) + + +cdef cudaError_t _cudaGraphExecExternalSemaphoresSignalNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, const cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphExecExternalSemaphoresSignalNodeSetParams(hGraphExec, hNode, nodeParams) + return _static_cudaGraphExecExternalSemaphoresSignalNodeSetParams(hGraphExec, hNode, nodeParams) + + +cdef cudaError_t _cudaGraphExecExternalSemaphoresWaitNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, const cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphExecExternalSemaphoresWaitNodeSetParams(hGraphExec, hNode, nodeParams) + return _static_cudaGraphExecExternalSemaphoresWaitNodeSetParams(hGraphExec, hNode, nodeParams) + + +cdef cudaError_t _cudaGraphNodeSetEnabled(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, unsigned int isEnabled) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphNodeSetEnabled(hGraphExec, hNode, isEnabled) + return _static_cudaGraphNodeSetEnabled(hGraphExec, hNode, isEnabled) + + +cdef cudaError_t _cudaGraphNodeGetEnabled(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, unsigned int* isEnabled) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphNodeGetEnabled(hGraphExec, hNode, isEnabled) + return _static_cudaGraphNodeGetEnabled(hGraphExec, hNode, isEnabled) + + +cdef cudaError_t _cudaGraphExecUpdate(cudaGraphExec_t hGraphExec, cudaGraph_t hGraph, cudaGraphExecUpdateResultInfo* resultInfo) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphExecUpdate(hGraphExec, hGraph, resultInfo) + return _static_cudaGraphExecUpdate(hGraphExec, hGraph, resultInfo) + + +cdef cudaError_t _cudaGraphUpload(cudaGraphExec_t graphExec, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphUpload(graphExec, stream) + return _static_cudaGraphUpload(graphExec, stream) + + +cdef cudaError_t _cudaGraphLaunch(cudaGraphExec_t graphExec, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphLaunch(graphExec, stream) + return _static_cudaGraphLaunch(graphExec, stream) + + +cdef cudaError_t _cudaGraphExecDestroy(cudaGraphExec_t graphExec) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphExecDestroy(graphExec) + return _static_cudaGraphExecDestroy(graphExec) + + +cdef cudaError_t _cudaGraphDestroy(cudaGraph_t graph) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphDestroy(graph) + return _static_cudaGraphDestroy(graph) + + +cdef cudaError_t _cudaGraphDebugDotPrint(cudaGraph_t graph, const char* path, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphDebugDotPrint(graph, path, flags) + return _static_cudaGraphDebugDotPrint(graph, path, flags) + + +cdef cudaError_t _cudaUserObjectCreate(cudaUserObject_t* object_out, void* ptr, cudaHostFn_t destroy, unsigned int initialRefcount, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaUserObjectCreate(object_out, ptr, destroy, initialRefcount, flags) + return _static_cudaUserObjectCreate(object_out, ptr, destroy, initialRefcount, flags) + + +cdef cudaError_t _cudaUserObjectRetain(cudaUserObject_t object, unsigned int count) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaUserObjectRetain(object, count) + return _static_cudaUserObjectRetain(object, count) + + +cdef cudaError_t _cudaUserObjectRelease(cudaUserObject_t object, unsigned int count) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaUserObjectRelease(object, count) + return _static_cudaUserObjectRelease(object, count) + + +cdef cudaError_t _cudaGraphRetainUserObject(cudaGraph_t graph, cudaUserObject_t object, unsigned int count, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphRetainUserObject(graph, object, count, flags) + return _static_cudaGraphRetainUserObject(graph, object, count, flags) + + +cdef cudaError_t _cudaGraphReleaseUserObject(cudaGraph_t graph, cudaUserObject_t object, unsigned int count) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphReleaseUserObject(graph, object, count) + return _static_cudaGraphReleaseUserObject(graph, object, count) + + +cdef cudaError_t _cudaGraphAddNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphAddNode(pGraphNode, graph, pDependencies, dependencyData, numDependencies, nodeParams) + return _static_cudaGraphAddNode(pGraphNode, graph, pDependencies, dependencyData, numDependencies, nodeParams) + + +cdef cudaError_t _cudaGraphNodeSetParams(cudaGraphNode_t node, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphNodeSetParams(node, nodeParams) + return _static_cudaGraphNodeSetParams(node, nodeParams) + + +cdef cudaError_t _cudaGraphExecNodeSetParams(cudaGraphExec_t graphExec, cudaGraphNode_t node, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphExecNodeSetParams(graphExec, node, nodeParams) + return _static_cudaGraphExecNodeSetParams(graphExec, node, nodeParams) + + +cdef cudaError_t _cudaGraphConditionalHandleCreate(cudaGraphConditionalHandle* pHandle_out, cudaGraph_t graph, unsigned int defaultLaunchValue, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphConditionalHandleCreate(pHandle_out, graph, defaultLaunchValue, flags) + return _static_cudaGraphConditionalHandleCreate(pHandle_out, graph, defaultLaunchValue, flags) + + +cdef cudaError_t _cudaGetDriverEntryPoint(const char* symbol, void** funcPtr, unsigned long long flags, cudaDriverEntryPointQueryResult* driverStatus) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGetDriverEntryPoint(symbol, funcPtr, flags, driverStatus) + return _static_cudaGetDriverEntryPoint(symbol, funcPtr, flags, driverStatus) + + +cdef cudaError_t _cudaGetDriverEntryPointByVersion(const char* symbol, void** funcPtr, unsigned int cudaVersion, unsigned long long flags, cudaDriverEntryPointQueryResult* driverStatus) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGetDriverEntryPointByVersion(symbol, funcPtr, cudaVersion, flags, driverStatus) + return _static_cudaGetDriverEntryPointByVersion(symbol, funcPtr, cudaVersion, flags, driverStatus) + + +cdef cudaError_t _cudaLibraryLoadData(cudaLibrary_t* library, const void* code, cudaJitOption* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, cudaLibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaLibraryLoadData(library, code, jitOptions, jitOptionsValues, numJitOptions, libraryOptions, libraryOptionValues, numLibraryOptions) + return _static_cudaLibraryLoadData(library, code, jitOptions, jitOptionsValues, numJitOptions, libraryOptions, libraryOptionValues, numLibraryOptions) + + +cdef cudaError_t _cudaLibraryLoadFromFile(cudaLibrary_t* library, const char* fileName, cudaJitOption* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, cudaLibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaLibraryLoadFromFile(library, fileName, jitOptions, jitOptionsValues, numJitOptions, libraryOptions, libraryOptionValues, numLibraryOptions) + return _static_cudaLibraryLoadFromFile(library, fileName, jitOptions, jitOptionsValues, numJitOptions, libraryOptions, libraryOptionValues, numLibraryOptions) + + +cdef cudaError_t _cudaLibraryUnload(cudaLibrary_t library) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaLibraryUnload(library) + return _static_cudaLibraryUnload(library) + + +cdef cudaError_t _cudaLibraryGetKernel(cudaKernel_t* pKernel, cudaLibrary_t library, const char* name) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaLibraryGetKernel(pKernel, library, name) + return _static_cudaLibraryGetKernel(pKernel, library, name) + + +cdef cudaError_t _cudaLibraryGetGlobal(void** dptr, size_t* bytes, cudaLibrary_t library, const char* name) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaLibraryGetGlobal(dptr, bytes, library, name) + return _static_cudaLibraryGetGlobal(dptr, bytes, library, name) + + +cdef cudaError_t _cudaLibraryGetManaged(void** dptr, size_t* bytes, cudaLibrary_t library, const char* name) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaLibraryGetManaged(dptr, bytes, library, name) + return _static_cudaLibraryGetManaged(dptr, bytes, library, name) + + +cdef cudaError_t _cudaLibraryGetUnifiedFunction(void** fptr, cudaLibrary_t library, const char* symbol) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaLibraryGetUnifiedFunction(fptr, library, symbol) + return _static_cudaLibraryGetUnifiedFunction(fptr, library, symbol) + + +cdef cudaError_t _cudaLibraryGetKernelCount(unsigned int* count, cudaLibrary_t lib) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaLibraryGetKernelCount(count, lib) + return _static_cudaLibraryGetKernelCount(count, lib) + + +cdef cudaError_t _cudaLibraryEnumerateKernels(cudaKernel_t* kernels, unsigned int numKernels, cudaLibrary_t lib) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaLibraryEnumerateKernels(kernels, numKernels, lib) + return _static_cudaLibraryEnumerateKernels(kernels, numKernels, lib) + + +cdef cudaError_t _cudaKernelSetAttributeForDevice(cudaKernel_t kernel, cudaFuncAttribute attr, int value, int device) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaKernelSetAttributeForDevice(kernel, attr, value, device) + return _static_cudaKernelSetAttributeForDevice(kernel, attr, value, device) + + +cdef cudaError_t _cudaGetExportTable(const void** ppExportTable, const cudaUUID_t* pExportTableId) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGetExportTable(ppExportTable, pExportTableId) + return _static_cudaGetExportTable(ppExportTable, pExportTableId) + + +cdef cudaError_t _cudaGetKernel(cudaKernel_t* kernelPtr, const void* entryFuncAddr) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGetKernel(kernelPtr, entryFuncAddr) + return _static_cudaGetKernel(kernelPtr, entryFuncAddr) + + +cdef cudaError_t _cudaProfilerStart() except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaProfilerStart() + return _static_cudaProfilerStart() + + +cdef cudaError_t _cudaProfilerStop() except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaProfilerStop() + return _static_cudaProfilerStop() + + +cdef cudaError_t _cudaGetDeviceProperties(cudaDeviceProp* prop, int device) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGetDeviceProperties(prop, device) + return _static_cudaGetDeviceProperties(prop, device) + + +cdef cudaError_t _cudaDeviceGetHostAtomicCapabilities(unsigned int* capabilities, const cudaAtomicOperation* operations, unsigned int count, int device) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceGetHostAtomicCapabilities(capabilities, operations, count, device) + return _static_cudaDeviceGetHostAtomicCapabilities(capabilities, operations, count, device) + + +cdef cudaError_t _cudaDeviceGetP2PAtomicCapabilities(unsigned int* capabilities, const cudaAtomicOperation* operations, unsigned int count, int srcDevice, int dstDevice) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceGetP2PAtomicCapabilities(capabilities, operations, count, srcDevice, dstDevice) + return _static_cudaDeviceGetP2PAtomicCapabilities(capabilities, operations, count, srcDevice, dstDevice) + + +cdef cudaError_t _cudaStreamGetCaptureInfo(cudaStream_t stream, cudaStreamCaptureStatus* captureStatus_out, unsigned long long* id_out, cudaGraph_t* graph_out, const cudaGraphNode_t** dependencies_out, const cudaGraphEdgeData** edgeData_out, size_t* numDependencies_out) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamGetCaptureInfo(stream, captureStatus_out, id_out, graph_out, dependencies_out, edgeData_out, numDependencies_out) + return _static_cudaStreamGetCaptureInfo(stream, captureStatus_out, id_out, graph_out, dependencies_out, edgeData_out, numDependencies_out) + + +cdef cudaError_t _cudaSignalExternalSemaphoresAsync(const cudaExternalSemaphore_t* extSemArray, const cudaExternalSemaphoreSignalParams* paramsArray, unsigned int numExtSems, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaSignalExternalSemaphoresAsync(extSemArray, paramsArray, numExtSems, stream) + return _static_cudaSignalExternalSemaphoresAsync(extSemArray, paramsArray, numExtSems, stream) + + +cdef cudaError_t _cudaWaitExternalSemaphoresAsync(const cudaExternalSemaphore_t* extSemArray, const cudaExternalSemaphoreWaitParams* paramsArray, unsigned int numExtSems, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaWaitExternalSemaphoresAsync(extSemArray, paramsArray, numExtSems, stream) + return _static_cudaWaitExternalSemaphoresAsync(extSemArray, paramsArray, numExtSems, stream) + + +cdef cudaError_t _cudaMemPrefetchBatchAsync(void** dptrs, size_t* sizes, size_t count, cudaMemLocation* prefetchLocs, size_t* prefetchLocIdxs, size_t numPrefetchLocs, unsigned long long flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemPrefetchBatchAsync(dptrs, sizes, count, prefetchLocs, prefetchLocIdxs, numPrefetchLocs, flags, stream) + return _static_cudaMemPrefetchBatchAsync(dptrs, sizes, count, prefetchLocs, prefetchLocIdxs, numPrefetchLocs, flags, stream) + + +cdef cudaError_t _cudaMemDiscardBatchAsync(void** dptrs, size_t* sizes, size_t count, unsigned long long flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemDiscardBatchAsync(dptrs, sizes, count, flags, stream) + return _static_cudaMemDiscardBatchAsync(dptrs, sizes, count, flags, stream) + + +cdef cudaError_t _cudaMemDiscardAndPrefetchBatchAsync(void** dptrs, size_t* sizes, size_t count, cudaMemLocation* prefetchLocs, size_t* prefetchLocIdxs, size_t numPrefetchLocs, unsigned long long flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemDiscardAndPrefetchBatchAsync(dptrs, sizes, count, prefetchLocs, prefetchLocIdxs, numPrefetchLocs, flags, stream) + return _static_cudaMemDiscardAndPrefetchBatchAsync(dptrs, sizes, count, prefetchLocs, prefetchLocIdxs, numPrefetchLocs, flags, stream) + + +cdef cudaError_t _cudaMemGetDefaultMemPool(cudaMemPool_t* memPool, cudaMemLocation* location, cudaMemAllocationType type) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemGetDefaultMemPool(memPool, location, type) + return _static_cudaMemGetDefaultMemPool(memPool, location, type) + + +cdef cudaError_t _cudaMemGetMemPool(cudaMemPool_t* memPool, cudaMemLocation* location, cudaMemAllocationType type) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemGetMemPool(memPool, location, type) + return _static_cudaMemGetMemPool(memPool, location, type) + + +cdef cudaError_t _cudaMemSetMemPool(cudaMemLocation* location, cudaMemAllocationType type, cudaMemPool_t memPool) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemSetMemPool(location, type, memPool) + return _static_cudaMemSetMemPool(location, type, memPool) + + +cdef cudaError_t _cudaLogsRegisterCallback(cudaLogsCallback_t callbackFunc, void* userData, cudaLogsCallbackHandle* callback_out) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaLogsRegisterCallback(callbackFunc, userData, callback_out) + return _static_cudaLogsRegisterCallback(callbackFunc, userData, callback_out) + + +cdef cudaError_t _cudaLogsUnregisterCallback(cudaLogsCallbackHandle callback) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaLogsUnregisterCallback(callback) + return _static_cudaLogsUnregisterCallback(callback) + + +cdef cudaError_t _cudaLogsCurrent(cudaLogIterator* iterator_out, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaLogsCurrent(iterator_out, flags) + return _static_cudaLogsCurrent(iterator_out, flags) + + +cdef cudaError_t _cudaLogsDumpToFile(cudaLogIterator* iterator, const char* pathToFile, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaLogsDumpToFile(iterator, pathToFile, flags) + return _static_cudaLogsDumpToFile(iterator, pathToFile, flags) + + +cdef cudaError_t _cudaLogsDumpToMemory(cudaLogIterator* iterator, char* buffer, size_t* size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaLogsDumpToMemory(iterator, buffer, size, flags) + return _static_cudaLogsDumpToMemory(iterator, buffer, size, flags) + + +cdef cudaError_t _cudaGraphNodeGetContainingGraph(cudaGraphNode_t hNode, cudaGraph_t* phGraph) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphNodeGetContainingGraph(hNode, phGraph) + return _static_cudaGraphNodeGetContainingGraph(hNode, phGraph) + + +cdef cudaError_t _cudaGraphNodeGetLocalId(cudaGraphNode_t hNode, unsigned int* nodeId) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphNodeGetLocalId(hNode, nodeId) + return _static_cudaGraphNodeGetLocalId(hNode, nodeId) + + +cdef cudaError_t _cudaGraphNodeGetToolsId(cudaGraphNode_t hNode, unsigned long long* toolsNodeId) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphNodeGetToolsId(hNode, toolsNodeId) + return _static_cudaGraphNodeGetToolsId(hNode, toolsNodeId) + + +cdef cudaError_t _cudaGraphGetId(cudaGraph_t hGraph, unsigned int* graphID) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphGetId(hGraph, graphID) + return _static_cudaGraphGetId(hGraph, graphID) + + +cdef cudaError_t _cudaGraphExecGetId(cudaGraphExec_t hGraphExec, unsigned int* graphID) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphExecGetId(hGraphExec, graphID) + return _static_cudaGraphExecGetId(hGraphExec, graphID) + + +cdef cudaError_t _cudaGraphConditionalHandleCreate_v2(cudaGraphConditionalHandle* pHandle_out, cudaGraph_t graph, cudaExecutionContext_t ctx, unsigned int defaultLaunchValue, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphConditionalHandleCreate_v2(pHandle_out, graph, ctx, defaultLaunchValue, flags) + return _static_cudaGraphConditionalHandleCreate_v2(pHandle_out, graph, ctx, defaultLaunchValue, flags) + + +cdef cudaError_t _cudaDeviceGetDevResource(int device, cudaDevResource* resource, cudaDevResourceType type) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceGetDevResource(device, resource, type) + return _static_cudaDeviceGetDevResource(device, resource, type) + + +cdef cudaError_t _cudaDevSmResourceSplitByCount(cudaDevResource* result, unsigned int* nbGroups, const cudaDevResource* input, cudaDevResource* remaining, unsigned int flags, unsigned int minCount) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDevSmResourceSplitByCount(result, nbGroups, input, remaining, flags, minCount) + return _static_cudaDevSmResourceSplitByCount(result, nbGroups, input, remaining, flags, minCount) + + +cdef cudaError_t _cudaDevSmResourceSplit(cudaDevResource* result, unsigned int nbGroups, const cudaDevResource* input, cudaDevResource* remainder, unsigned int flags, cudaDevSmResourceGroupParams* groupParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDevSmResourceSplit(result, nbGroups, input, remainder, flags, groupParams) + return _static_cudaDevSmResourceSplit(result, nbGroups, input, remainder, flags, groupParams) + + +cdef cudaError_t _cudaDevResourceGenerateDesc(cudaDevResourceDesc_t* phDesc, cudaDevResource* resources, unsigned int nbResources) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDevResourceGenerateDesc(phDesc, resources, nbResources) + return _static_cudaDevResourceGenerateDesc(phDesc, resources, nbResources) + + +cdef cudaError_t _cudaGreenCtxCreate(cudaExecutionContext_t* phCtx, cudaDevResourceDesc_t desc, int device, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGreenCtxCreate(phCtx, desc, device, flags) + return _static_cudaGreenCtxCreate(phCtx, desc, device, flags) + + +cdef cudaError_t _cudaExecutionCtxDestroy(cudaExecutionContext_t ctx) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaExecutionCtxDestroy(ctx) + return _static_cudaExecutionCtxDestroy(ctx) + + +cdef cudaError_t _cudaExecutionCtxGetDevResource(cudaExecutionContext_t ctx, cudaDevResource* resource, cudaDevResourceType type) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaExecutionCtxGetDevResource(ctx, resource, type) + return _static_cudaExecutionCtxGetDevResource(ctx, resource, type) + + +cdef cudaError_t _cudaExecutionCtxGetDevice(int* device, cudaExecutionContext_t ctx) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaExecutionCtxGetDevice(device, ctx) + return _static_cudaExecutionCtxGetDevice(device, ctx) + + +cdef cudaError_t _cudaExecutionCtxGetId(cudaExecutionContext_t ctx, unsigned long long* ctxId) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaExecutionCtxGetId(ctx, ctxId) + return _static_cudaExecutionCtxGetId(ctx, ctxId) + + +cdef cudaError_t _cudaExecutionCtxStreamCreate(cudaStream_t* phStream, cudaExecutionContext_t ctx, unsigned int flags, int priority) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaExecutionCtxStreamCreate(phStream, ctx, flags, priority) + return _static_cudaExecutionCtxStreamCreate(phStream, ctx, flags, priority) + + +cdef cudaError_t _cudaExecutionCtxSynchronize(cudaExecutionContext_t ctx) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaExecutionCtxSynchronize(ctx) + return _static_cudaExecutionCtxSynchronize(ctx) + + +cdef cudaError_t _cudaStreamGetDevResource(cudaStream_t hStream, cudaDevResource* resource, cudaDevResourceType type) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamGetDevResource(hStream, resource, type) + return _static_cudaStreamGetDevResource(hStream, resource, type) + + +cdef cudaError_t _cudaExecutionCtxRecordEvent(cudaExecutionContext_t ctx, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaExecutionCtxRecordEvent(ctx, event) + return _static_cudaExecutionCtxRecordEvent(ctx, event) + + +cdef cudaError_t _cudaExecutionCtxWaitEvent(cudaExecutionContext_t ctx, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaExecutionCtxWaitEvent(ctx, event) + return _static_cudaExecutionCtxWaitEvent(ctx, event) + + +cdef cudaError_t _cudaDeviceGetExecutionCtx(cudaExecutionContext_t* ctx, int device) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceGetExecutionCtx(ctx, device) + return _static_cudaDeviceGetExecutionCtx(ctx, device) + + +cdef cudaError_t _cudaFuncGetParamCount(const void* func, size_t* paramCount) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaFuncGetParamCount(func, paramCount) + return _static_cudaFuncGetParamCount(func, paramCount) + + +cdef cudaError_t _cudaLaunchHostFunc_v2(cudaStream_t stream, cudaHostFn_t fn, void* userData, unsigned int syncMode) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaLaunchHostFunc_v2(stream, fn, userData, syncMode) + return _static_cudaLaunchHostFunc_v2(stream, fn, userData, syncMode) + + +cdef cudaError_t _cudaMemcpyWithAttributesAsync(void* dst, const void* src, size_t size, cudaMemcpyAttributes* attr, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpyWithAttributesAsync(dst, src, size, attr, stream) + return _static_cudaMemcpyWithAttributesAsync(dst, src, size, attr, stream) + + +cdef cudaError_t _cudaMemcpy3DWithAttributesAsync(cudaMemcpy3DBatchOp* op, unsigned long long flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpy3DWithAttributesAsync(op, flags, stream) + return _static_cudaMemcpy3DWithAttributesAsync(op, flags, stream) + + +cdef cudaError_t _cudaGraphNodeGetParams(cudaGraphNode_t node, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphNodeGetParams(node, nodeParams) + return _static_cudaGraphNodeGetParams(node, nodeParams) + + +cdef cudaError_t _cudaStreamBeginRecaptureToGraph(cudaStream_t stream, cudaStreamCaptureMode mode, cudaGraph_t graph, cudaGraphRecaptureCallbackData* callbackData) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamBeginRecaptureToGraph(stream, mode, graph, callbackData) + return _static_cudaStreamBeginRecaptureToGraph(stream, mode, graph, callbackData) diff --git a/cuda_bindings/cuda/bindings/_internal/utils.pxd b/cuda_bindings/cuda/bindings/_internal/utils.pxd new file mode 100644 index 00000000000..f4a76de327e --- /dev/null +++ b/cuda_bindings/cuda/bindings/_internal/utils.pxd @@ -0,0 +1,167 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from libc.stdint cimport int32_t, int64_t, intptr_t +from libcpp.vector cimport vector +from libcpp cimport bool as cppbool +from libcpp cimport nullptr_t, nullptr +from libcpp.memory cimport unique_ptr + + +cdef extern from * nogil: + """ + template + class nullable_unique_ptr { + public: + nullable_unique_ptr() noexcept = default; + + nullable_unique_ptr(std::nullptr_t) noexcept = delete; + + explicit nullable_unique_ptr(T* data, bool own_data): + own_data_(own_data) + { + if (own_data) + manager_.reset(data); + else + raw_data_ = data; + } + + nullable_unique_ptr(const nullable_unique_ptr&) = delete; + + nullable_unique_ptr& operator=(const nullable_unique_ptr&) = delete; + + nullable_unique_ptr(nullable_unique_ptr&& other) noexcept + { + own_data_ = other.own_data_; + other.own_data_ = false; // ownership is transferred + if (own_data_) + { + manager_ = std::move(other.manager_); + raw_data_ = nullptr; // just in case + } + else + { + manager_.reset(nullptr); // just in case + raw_data_ = other.raw_data_; + } + } + + nullable_unique_ptr& operator=(nullable_unique_ptr&& other) noexcept + { + own_data_ = other.own_data_; + other.own_data_ = false; // ownership is transferred + if (own_data_) + { + manager_ = std::move(other.manager_); + raw_data_ = nullptr; // just in case + } + else + { + manager_.reset(nullptr); // just in case + raw_data_ = other.raw_data_; + } + return *this; + } + + ~nullable_unique_ptr() = default; + + void reset(T* data, bool own_data) + { + own_data_ = own_data; + if (own_data_) + { + manager_.reset(data); + raw_data_ = nullptr; + } + else + { + manager_.reset(nullptr); + raw_data_ = data; + } + } + + void swap(nullable_unique_ptr& other) noexcept + { + std::swap(manager_, other.manager_); + std::swap(raw_data_, other.raw_data_); + std::swap(own_data_, other.own_data_); + } + + /* + * Get the pointer to the underlying object (this is different from data()!). + */ + T* get() const noexcept + { + if (own_data_) + return manager_.get(); + else + return raw_data_; + } + + /* + * Get the pointer to the underlying buffer (this is different from get()!). + */ + void* data() noexcept + { + if (own_data_) + return manager_.get()->data(); + else + return raw_data_; + } + + T& operator*() + { + if (own_data_) + return *manager_; + else + return *raw_data_; + } + + private: + std::unique_ptr manager_{}; + T* raw_data_{nullptr}; + bool own_data_{false}; + }; + """ + # xref: cython/Cython/Includes/libcpp/memory.pxd + cdef cppclass nullable_unique_ptr[T]: + nullable_unique_ptr() + nullable_unique_ptr(T*, cppbool) + nullable_unique_ptr(nullable_unique_ptr[T]&) + + # Modifiers + void reset(T*, cppbool) + void swap(nullable_unique_ptr&) + + # Observers + T* get() + T& operator*() + void* data() + + +ctypedef fused ResT: + int + int32_t + int64_t + char + float + double + + +ctypedef fused PtrT: + void + + +cdef cppclass nested_resource[T]: + nullable_unique_ptr[ vector[intptr_t] ] ptrs + nullable_unique_ptr[ vector[vector[T]] ] nested_resource_ptr + + +# accepts the output pointer as input to use the return value for exception propagation +cdef int get_resource_ptr(nullable_unique_ptr[vector[ResT]] &in_out_ptr, object obj, ResT* __unused) except 1 +cdef int get_resource_ptrs(nullable_unique_ptr[ vector[PtrT*] ] &in_out_ptr, object obj, PtrT* __unused) except 1 +cdef int get_nested_resource_ptr(nested_resource[ResT] &in_out_ptr, object obj, ResT* __unused) except 1 + +cdef bint is_nested_sequence(data) +cdef void* get_buffer_pointer(buf, Py_ssize_t size, readonly=*) except* diff --git a/cuda_bindings/cuda/bindings/_internal/utils.pyx b/cuda_bindings/cuda/bindings/_internal/utils.pyx new file mode 100644 index 00000000000..a5931f1f080 --- /dev/null +++ b/cuda_bindings/cuda/bindings/_internal/utils.pyx @@ -0,0 +1,158 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +cimport cpython +from libc.stdint cimport intptr_t +from libcpp.utility cimport move +from cython.operator cimport dereference as deref + + +cdef extern from *: + """ + #if defined(__clang__) + #define _COMPILER_VERSION ("Clang " __clang_version__) + #elif defined(__GNUC__) || defined(__GNUG__) + #define _COMPILER_VERSION ("GCC " __VERSION__) + #elif defined(_MSC_VER) + #define _COMPILER_VERSION ("MSVC " Py_STRINGIFY(_MSC_VER)) + #else + #define _COMPILER_VERSION ("Unknown Compiler") + #endif + """ + cdef char *_COMPILER_VERSION + + +cpdef str get_c_compiler(): + """ + Returns a string describing the C compiler used to build cuda.bindings + """ + return _COMPILER_VERSION.decode() + + +cdef bint is_nested_sequence(data): + if not cpython.PySequence_Check(data): + return False + else: + for i in data: + if not cpython.PySequence_Check(i): + return False + else: + return True + + +cdef void* get_buffer_pointer(buf, Py_ssize_t size, readonly=True) except*: + """The caller must ensure ``buf`` is alive when the returned pointer is in use.""" + cdef void* bufPtr + cdef int flags = cpython.PyBUF_ANY_CONTIGUOUS + if not readonly: + flags |= cpython.PyBUF_WRITABLE + cdef int status = -1 + cdef cpython.Py_buffer view + + if isinstance(buf, int): + bufPtr = buf + else: # try buffer protocol + try: + status = cpython.PyObject_GetBuffer(buf, &view, flags) + # when the caller does not provide a size, it is set to -1 at generate-time by cybind + if size != -1: + assert view.len == size + assert view.ndim == 1 + except Exception as e: + adj = "writable " if not readonly else "" + raise ValueError( + "buf must be either a Python int representing the pointer " + f"address to a valid buffer, or a 1D contiguous {adj}" + "buffer, of size bytes") from e + else: + bufPtr = view.buf + finally: + if status == 0: + cpython.PyBuffer_Release(&view) + + return bufPtr + + +# Cython can't infer the ResT overload when it is wrapped in nullable_unique_ptr, +# so we need a dummy (__unused) input argument to help it +cdef int get_resource_ptr(nullable_unique_ptr[vector[ResT]] &in_out_ptr, object obj, ResT* __unused) except 1: + if cpython.PySequence_Check(obj): + vec = new vector[ResT](len(obj)) + # set the ownership immediately to avoid leaking the `vec` memory in + # case of exception in the following loop + in_out_ptr.reset(vec, True) + for i in range(len(obj)): + deref(vec)[i] = obj[i] + else: + in_out_ptr.reset(obj, False) + return 0 + + +cdef int get_resource_ptrs(nullable_unique_ptr[ vector[PtrT*] ] &in_out_ptr, object obj, PtrT* __unused) except 1: + if cpython.PySequence_Check(obj): + vec = new vector[PtrT*](len(obj)) + # set the ownership immediately to avoid leaking the `vec` memory in + # case of exception in the following loop + in_out_ptr.reset(vec, True) + for i in range(len(obj)): + deref(vec)[i] = (obj[i]) + else: + in_out_ptr.reset(obj, False) + return 0 + + +cdef int get_nested_resource_ptr(nested_resource[ResT] &in_out_ptr, object obj, ResT* __unused) except 1: + cdef nullable_unique_ptr[ vector[intptr_t] ] nested_ptr + cdef nullable_unique_ptr[ vector[vector[ResT]] ] nested_res_ptr + cdef vector[intptr_t]* nested_vec = NULL + cdef vector[vector[ResT]]* nested_res_vec = NULL + cdef size_t i = 0, length = 0 + cdef intptr_t addr + + if is_nested_sequence(obj): + length = len(obj) + nested_res_vec = new vector[vector[ResT]](length) + nested_vec = new vector[intptr_t](length) + # set the ownership immediately to avoid leaking memory in case of + # exception in the following loop + nested_res_ptr.reset(nested_res_vec, True) + nested_ptr.reset(nested_vec, True) + for i, obj_i in enumerate(obj): + if ResT is char: + obj_i_type = type(obj_i) + if obj_i_type is str: + obj_i_bytes = obj_i.encode("utf-8") + elif obj_i_type is bytes: + obj_i_bytes = obj_i + else: + raise TypeError( + f"Expected str or bytes, got {obj_i_type.__name__}") + str_len = (len(obj_i_bytes)) + 1 # including null termination + deref(nested_res_vec)[i].resize(str_len) + obj_i_ptr = (obj_i_bytes) + # cast to size_t explicitly to work around a potentially Cython bug + deref(nested_res_vec)[i].assign(obj_i_ptr, obj_i_ptr + str_len) + else: + deref(nested_res_vec)[i] = obj_i + deref(nested_vec)[i] = (deref(nested_res_vec)[i].data()) + elif cpython.PySequence_Check(obj): + length = len(obj) + nested_vec = new vector[intptr_t](length) + nested_ptr.reset(nested_vec, True) + for i, addr in enumerate(obj): + deref(nested_vec)[i] = addr + nested_res_ptr.reset(NULL, False) + else: + # obj is an int (ResT**) + nested_res_ptr.reset(NULL, False) + nested_ptr.reset(obj, False) + + in_out_ptr.ptrs = move(nested_ptr) + in_out_ptr.nested_resource_ptr = move(nested_res_ptr) + return 0 + + +class FunctionNotFoundError(RuntimeError): pass + +class NotSupportedError(RuntimeError): pass diff --git a/cuda/_lib/__init__.py b/cuda_bindings/cuda/bindings/_lib/__init__.py similarity index 100% rename from cuda/_lib/__init__.py rename to cuda_bindings/cuda/bindings/_lib/__init__.py diff --git a/cuda_bindings/cuda/bindings/_lib/cyruntime/cyruntime.pxd b/cuda_bindings/cuda/bindings/_lib/cyruntime/cyruntime.pxd new file mode 100644 index 00000000000..7258d4b43cc --- /dev/null +++ b/cuda_bindings/cuda/bindings/_lib/cyruntime/cyruntime.pxd @@ -0,0 +1,42 @@ +# SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +cimport cuda.bindings._internal.driver as _cydriver + +# These graphics API are the reimplemented version of what's supported by CUDA Runtime. +# Issue https://github.com/NVIDIA/cuda-python/issues/488 will remove them by letting us +# use call into the static library directly. +# +# This is an ABI breaking change which can only happen in a major version bump. + +# This file is included from cuda/bindings/_bindings/cyruntime.pxd.in but kept in a +# separate file to keep it separated from the auto-generated code there. + +# Prior to https://github.com/NVIDIA/cuda-python/pull/914, this was two +# independent modules (c.b._lib.cyruntime.cyruntime and +# c.b._lib.cyruntime.utils), but was merged into one. + +cdef cudaError_t _cudaEGLStreamProducerPresentFrame(cudaEglStreamConnection* conn, cudaEglFrame eglframe, cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaEGLStreamProducerReturnFrame(cudaEglStreamConnection* conn, cudaEglFrame* eglframe, cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphicsResourceGetMappedEglFrame(cudaEglFrame* eglFrame, cudaGraphicsResource_t resource, unsigned int index, unsigned int mipLevel) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaVDPAUSetVDPAUDevice(int device, VdpDevice vdpDevice, VdpGetProcAddress* vdpGetProcAddress) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaVDPAUGetDevice(int* device, VdpDevice vdpDevice, VdpGetProcAddress* vdpGetProcAddress) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphicsVDPAURegisterVideoSurface(cudaGraphicsResource** resource, VdpVideoSurface vdpSurface, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphicsVDPAURegisterOutputSurface(cudaGraphicsResource** resource, VdpOutputSurface vdpSurface, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGLGetDevices(unsigned int* pCudaDeviceCount, int* pCudaDevices, unsigned int cudaDeviceCount, cudaGLDeviceList deviceList) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphicsGLRegisterImage(cudaGraphicsResource** resource, GLuint image, GLenum target, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphicsGLRegisterBuffer(cudaGraphicsResource** resource, GLuint buffer, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaGraphicsEGLRegisterImage(cudaGraphicsResource_t* pCudaResource, EGLImageKHR image, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaEGLStreamConsumerConnect(cudaEglStreamConnection* conn, EGLStreamKHR eglStream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaEGLStreamConsumerConnectWithFlags(cudaEglStreamConnection* conn, EGLStreamKHR eglStream, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaEGLStreamConsumerDisconnect(cudaEglStreamConnection* conn) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaEGLStreamConsumerAcquireFrame(cudaEglStreamConnection* conn, cudaGraphicsResource_t* pCudaResource, cudaStream_t* pStream, unsigned int timeout) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaEGLStreamConsumerReleaseFrame(cudaEglStreamConnection* conn, cudaGraphicsResource_t pCudaResource, cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaEGLStreamProducerConnect(cudaEglStreamConnection* conn, EGLStreamKHR eglStream, EGLint width, EGLint height) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaEGLStreamProducerDisconnect(cudaEglStreamConnection* conn) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t _cudaEventCreateFromEGLSync(cudaEvent_t* phEvent, EGLSyncKHR eglSync, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil + +# utility functions + +cdef cudaError_t getDriverEglFrame(_cydriver.CUeglFrame *cuEglFrame, cudaEglFrame eglFrame) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t getRuntimeEglFrame(cudaEglFrame *eglFrame, _cydriver.CUeglFrame cueglFrame) except ?cudaErrorCallRequiresNewerDriver nogil diff --git a/cuda_bindings/cuda/bindings/_lib/cyruntime/cyruntime.pxi b/cuda_bindings/cuda/bindings/_lib/cyruntime/cyruntime.pxi new file mode 100644 index 00000000000..cd99c894ca6 --- /dev/null +++ b/cuda_bindings/cuda/bindings/_lib/cyruntime/cyruntime.pxi @@ -0,0 +1,1184 @@ +# SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +# These graphics API are the reimplemented version of what's supported by CUDA Runtime. +# Issue https://github.com/NVIDIA/cuda-python/issues/488 will remove them by letting us +# use call into the static library directly. + +# This file is included from cuda/bindings/_bindings/cyruntime.pyx.in but kept in a +# separate file to keep it separated from the auto-generated code there. + +# Prior to https://github.com/NVIDIA/cuda-python/pull/914, this was two +# independent modules (c.b._lib.cyruntime.cyruntime and +# c.b._lib.cyruntime.utils), but was merged into one. +import cython +cimport cython + +from libc.string cimport memset +cimport cuda.bindings._internal.driver as cydriver + +# Call make_cudaPitchedPtr directly from the C header to avoid a runtime import +# of cuda.bindings.cyruntime (the Cython wrapper lives there but including it +# here would create a circular import via _internal.runtime → cyruntime → _internal.runtime). +cdef extern from 'driver_functions.h': + cudaPitchedPtr _cylib_make_cudaPitchedPtr "make_cudaPitchedPtr"(void* d, size_t p, size_t xsz, size_t ysz) nogil + +cdef cudaError_t _cudaEGLStreamProducerPresentFrame(cudaEglStreamConnection* conn, cudaEglFrame eglframe, cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef cudaError_t err = cudaSuccess + # cudaFree(0) is a NOP operations that initializes the context state + err = _cudaFree(0) + if err != cudaSuccess: + return err + cdef cydriver.CUeglFrame cueglFrame + err = getDriverEglFrame(&cueglFrame, eglframe) + if err != cudaSuccess: + return err + err = cydriver._cuEGLStreamProducerPresentFrame(conn, cueglFrame, pStream) + return err + +cdef cudaError_t _cudaEGLStreamProducerReturnFrame(cudaEglStreamConnection* conn, cudaEglFrame* eglframe, cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef cudaError_t err = cudaSuccess + # cudaFree(0) is a NOP operations that initializes the context state + err = _cudaFree(0) + if err != cudaSuccess: + return err + if eglframe == NULL: + err = cudaErrorInvalidResourceHandle + return err + cdef cydriver.CUeglFrame cueglFrame + err = cydriver._cuEGLStreamProducerReturnFrame(conn, &cueglFrame, pStream) + if err != cudaSuccess: + return err + err = getRuntimeEglFrame(eglframe, cueglFrame) + return err + +cdef cudaError_t _cudaGraphicsResourceGetMappedEglFrame(cudaEglFrame* eglFrame, cudaGraphicsResource_t resource, unsigned int index, unsigned int mipLevel) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef cudaError_t err = cudaSuccess + # cudaFree(0) is a NOP operations that initializes the context state + err = _cudaFree(0) + if err != cudaSuccess: + return err + cdef cydriver.CUeglFrame cueglFrame + memset(&cueglFrame, 0, sizeof(cueglFrame)) + err = cydriver._cuGraphicsResourceGetMappedEglFrame(&cueglFrame, resource, index, mipLevel) + if err != cudaSuccess: + return err + err = getRuntimeEglFrame(eglFrame, cueglFrame) + return err + +cdef cudaError_t _cudaVDPAUSetVDPAUDevice(int device, VdpDevice vdpDevice, VdpGetProcAddress* vdpGetProcAddress) except ?cudaErrorCallRequiresNewerDriver nogil: + return cudaErrorNotSupported + +cdef cudaError_t _cudaVDPAUGetDevice(int* device, VdpDevice vdpDevice, VdpGetProcAddress* vdpGetProcAddress) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef cudaError_t err = cudaSuccess + # cudaFree(0) is a NOP operations that initializes the context state + err = _cudaFree(0) + if err != cudaSuccess: + return err + err = cydriver._cuVDPAUGetDevice(device, vdpDevice, vdpGetProcAddress) + return err + +cdef cudaError_t _cudaGraphicsVDPAURegisterVideoSurface(cudaGraphicsResource** resource, VdpVideoSurface vdpSurface, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef cudaError_t err = cudaSuccess + # cudaFree(0) is a NOP operations that initializes the context state + err = _cudaFree(0) + if err != cudaSuccess: + return err + err = cydriver._cuGraphicsVDPAURegisterVideoSurface(resource, vdpSurface, flags) + return err + +cdef cudaError_t _cudaGraphicsVDPAURegisterOutputSurface(cudaGraphicsResource** resource, VdpOutputSurface vdpSurface, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef cudaError_t err = cudaSuccess + # cudaFree(0) is a NOP operations that initializes the context state + err = _cudaFree(0) + if err != cudaSuccess: + return err + err = cydriver._cuGraphicsVDPAURegisterOutputSurface(resource, vdpSurface, flags) + return err + +cdef cudaError_t _cudaGLGetDevices(unsigned int* pCudaDeviceCount, int* pCudaDevices, unsigned int cudaDeviceCount, cudaGLDeviceList deviceList) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef cudaError_t err = cudaSuccess + # cudaFree(0) is a NOP operations that initializes the context state + err = _cudaFree(0) + if err != cudaSuccess: + return err + err = cydriver._cuGLGetDevices_v2(pCudaDeviceCount, pCudaDevices, cudaDeviceCount, deviceList) + return err + +cdef cudaError_t _cudaGraphicsGLRegisterImage(cudaGraphicsResource** resource, GLuint image, GLenum target, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef cudaError_t err = cudaSuccess + # cudaFree(0) is a NOP operations that initializes the context state + err = _cudaFree(0) + if err != cudaSuccess: + return err + err = cydriver._cuGraphicsGLRegisterImage(resource, image, target, flags) + return err + +cdef cudaError_t _cudaGraphicsGLRegisterBuffer(cudaGraphicsResource** resource, GLuint buffer, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef cudaError_t err = cudaSuccess + # cudaFree(0) is a NOP operations that initializes the context state + err = _cudaFree(0) + if err != cudaSuccess: + return err + err = cydriver._cuGraphicsGLRegisterBuffer(resource, buffer, flags) + return err + +cdef cudaError_t _cudaGraphicsEGLRegisterImage(cudaGraphicsResource_t* pCudaResource, EGLImageKHR image, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef cudaError_t err = cudaSuccess + # cudaFree(0) is a NOP operations that initializes the context state + err = _cudaFree(0) + if err != cudaSuccess: + return err + err = cydriver._cuGraphicsEGLRegisterImage(pCudaResource, image, flags) + return err + +cdef cudaError_t _cudaEGLStreamConsumerConnect(cudaEglStreamConnection* conn, EGLStreamKHR eglStream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef cudaError_t err = cudaSuccess + # cudaFree(0) is a NOP operations that initializes the context state + err = _cudaFree(0) + if err != cudaSuccess: + return err + err = cydriver._cuEGLStreamConsumerConnect(conn, eglStream) + return err + +cdef cudaError_t _cudaEGLStreamConsumerConnectWithFlags(cudaEglStreamConnection* conn, EGLStreamKHR eglStream, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef cudaError_t err = cudaSuccess + # cudaFree(0) is a NOP operations that initializes the context state + err = _cudaFree(0) + if err != cudaSuccess: + return err + err = cydriver._cuEGLStreamConsumerConnectWithFlags(conn, eglStream, flags) + return err + +cdef cudaError_t _cudaEGLStreamConsumerDisconnect(cudaEglStreamConnection* conn) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef cudaError_t err = cudaSuccess + # cudaFree(0) is a NOP operations that initializes the context state + err = _cudaFree(0) + if err != cudaSuccess: + return err + err = cydriver._cuEGLStreamConsumerDisconnect(conn) + return err + +cdef cudaError_t _cudaEGLStreamConsumerAcquireFrame(cudaEglStreamConnection* conn, cudaGraphicsResource_t* pCudaResource, cudaStream_t* pStream, unsigned int timeout) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef cudaError_t err = cudaSuccess + # cudaFree(0) is a NOP operations that initializes the context state + err = _cudaFree(0) + if err != cudaSuccess: + return err + err = cydriver._cuEGLStreamConsumerAcquireFrame(conn, pCudaResource, pStream, timeout) + return err + +cdef cudaError_t _cudaEGLStreamConsumerReleaseFrame(cudaEglStreamConnection* conn, cudaGraphicsResource_t pCudaResource, cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef cudaError_t err = cudaSuccess + # cudaFree(0) is a NOP operations that initializes the context state + err = _cudaFree(0) + if err != cudaSuccess: + return err + err = cydriver._cuEGLStreamConsumerReleaseFrame(conn, pCudaResource, pStream) + return err + +cdef cudaError_t _cudaEGLStreamProducerConnect(cudaEglStreamConnection* conn, EGLStreamKHR eglStream, EGLint width, EGLint height) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef cudaError_t err = cudaSuccess + # cudaFree(0) is a NOP operations that initializes the context state + err = _cudaFree(0) + if err != cudaSuccess: + return err + err = cydriver._cuEGLStreamProducerConnect(conn, eglStream, width, height) + return err + +cdef cudaError_t _cudaEGLStreamProducerDisconnect(cudaEglStreamConnection* conn) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef cudaError_t err = cudaSuccess + # cudaFree(0) is a NOP operations that initializes the context state + err = _cudaFree(0) + if err != cudaSuccess: + return err + err = cydriver._cuEGLStreamProducerDisconnect(conn) + return err + +cdef cudaError_t _cudaEventCreateFromEGLSync(cudaEvent_t* phEvent, EGLSyncKHR eglSync, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef cudaError_t err = cudaSuccess + # cudaFree(0) is a NOP operations that initializes the context state + err = _cudaFree(0) + if err != cudaSuccess: + return err + err = cydriver._cuEventCreateFromEGLSync(phEvent, eglSync, flags) + return err + +## utility functions + +cdef int case_desc(const cudaChannelFormatDesc* d, int x, int y, int z, int w, int f) except ?cudaErrorCallRequiresNewerDriver nogil: + return d[0].x == x and d[0].y == y and d[0].z == z and d[0].w == w and d[0].f == f + + +cdef cudaError_t getDescInfo(const cudaChannelFormatDesc* d, int *numberOfChannels, cydriver.CUarray_format *format) except ?cudaErrorCallRequiresNewerDriver nogil: + # Check validity + if d[0].f in (cudaChannelFormatKind.cudaChannelFormatKindSigned, + cudaChannelFormatKind.cudaChannelFormatKindUnsigned): + if (d[0].x != 8) and (d[0].x != 16) and (d[0].x != 32): + return cudaErrorInvalidChannelDescriptor + elif d[0].f in (cudaChannelFormatKind.cudaChannelFormatKindFloat,): + if (d[0].x != 16) and (d[0].x != 32): + return cudaErrorInvalidChannelDescriptor + elif d[0].f in (cudaChannelFormatKind.cudaChannelFormatKindNV12,): + if (d[0].x != 8) or (d[0].y != 8) or (d[0].z != 8) or (d[0].w != 0): + return cudaErrorInvalidChannelDescriptor + elif d[0].f in (cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized8X1, + cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized8X2, + cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized8X4, + cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized8X1, + cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized8X2, + cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized8X4,): + if (d[0].x != 8): + return cudaErrorInvalidChannelDescriptor + elif d[0].f in (cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized16X1, + cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized16X2, + cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized16X4, + cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized16X1, + cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized16X2, + cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized16X4,): + if (d[0].x != 16): + return cudaErrorInvalidChannelDescriptor + elif d[0].f in (cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed1, + cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed1SRGB, + cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed2, + cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed2SRGB, + cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed3, + cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed3SRGB, + cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed4, + cudaChannelFormatKind.cudaChannelFormatKindSignedBlockCompressed4, + cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed5, + cudaChannelFormatKind.cudaChannelFormatKindSignedBlockCompressed5, + cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed7, + cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed7SRGB,): + if (d[0].x != 8): + return cudaErrorInvalidChannelDescriptor + elif d[0].f in (cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed6H, + cudaChannelFormatKind.cudaChannelFormatKindSignedBlockCompressed6H,): + if (d[0].x != 16) or (d[0].y != 16) or (d[0].z != 16) or (d[0].w != 0): + return cudaErrorInvalidChannelDescriptor + elif d[0].f in (cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized1010102,): + if (d[0].x != 10) or (d[0].y != 10) or (d[0].z != 10) or (d[0].w != 2): + return cudaErrorInvalidChannelDescriptor + else: + return cudaErrorInvalidChannelDescriptor + + # If Y is non-zero, it must match X + # If Z is non-zero, it must match Y + # If W is non-zero, it must match Z + if (((d[0].y != 0) and (d[0].y != d[0].x)) or + ((d[0].z != 0) and (d[0].z != d[0].y)) or + ((d[0].w != 0) and (d[0].w != d[0].z))): + if d[0].f != cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized1010102: + return cudaErrorInvalidChannelDescriptor + if case_desc(d, 8, 0, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindSigned): + numberOfChannels[0] = 1 + format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_SIGNED_INT8 + elif case_desc(d, 8, 8, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindSigned): + numberOfChannels[0] = 2 + format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_SIGNED_INT8 + elif case_desc(d, 8, 8, 8, 0, cudaChannelFormatKind.cudaChannelFormatKindSigned): + numberOfChannels[0] = 3 + format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_SIGNED_INT8 + elif case_desc(d, 8, 8, 8, 8, cudaChannelFormatKind.cudaChannelFormatKindSigned): + numberOfChannels[0] = 4 + format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_SIGNED_INT8 + elif case_desc(d, 8, 0, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindUnsigned): + numberOfChannels[0] = 1 + format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_UNSIGNED_INT8 + elif case_desc(d, 8, 8, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindUnsigned): + numberOfChannels[0] = 2 + format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_UNSIGNED_INT8 + elif case_desc(d, 8, 8, 8, 0, cudaChannelFormatKind.cudaChannelFormatKindUnsigned): + numberOfChannels[0] = 3 + format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_UNSIGNED_INT8 + elif case_desc(d, 8, 8, 8, 8, cudaChannelFormatKind.cudaChannelFormatKindUnsigned): + numberOfChannels[0] = 4 + format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_UNSIGNED_INT8 + elif case_desc(d, 16, 0, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindSigned): + numberOfChannels[0] = 1 + format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_SIGNED_INT16 + elif case_desc(d, 16, 16, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindSigned): + numberOfChannels[0] = 2 + format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_SIGNED_INT16 + elif case_desc(d, 16, 16, 16, 0, cudaChannelFormatKind.cudaChannelFormatKindSigned): + numberOfChannels[0] = 3 + format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_SIGNED_INT16 + elif case_desc(d, 16, 16, 16, 16, cudaChannelFormatKind.cudaChannelFormatKindSigned): + numberOfChannels[0] = 4 + format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_SIGNED_INT16 + elif case_desc(d, 16, 0, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindUnsigned): + numberOfChannels[0] = 1 + format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_UNSIGNED_INT16 + elif case_desc(d, 16, 16, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindUnsigned): + numberOfChannels[0] = 2 + format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_UNSIGNED_INT16 + elif case_desc(d, 16, 16, 16, 0, cudaChannelFormatKind.cudaChannelFormatKindUnsigned): + numberOfChannels[0] = 3 + format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_UNSIGNED_INT16 + elif case_desc(d, 16, 16, 16, 16, cudaChannelFormatKind.cudaChannelFormatKindUnsigned): + numberOfChannels[0] = 4 + format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_UNSIGNED_INT16 + elif case_desc(d, 32, 0, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindSigned): + numberOfChannels[0] = 1 + format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_SIGNED_INT32 + elif case_desc(d, 32, 32, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindSigned): + numberOfChannels[0] = 2 + format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_SIGNED_INT32 + elif case_desc(d, 32, 32, 32, 0, cudaChannelFormatKind.cudaChannelFormatKindSigned): + numberOfChannels[0] = 3 + format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_SIGNED_INT32 + elif case_desc(d, 32, 32, 32, 32, cudaChannelFormatKind.cudaChannelFormatKindSigned): + numberOfChannels[0] = 4 + format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_SIGNED_INT32 + elif case_desc(d, 32, 0, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindUnsigned): + numberOfChannels[0] = 1 + format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_UNSIGNED_INT32 + elif case_desc(d, 32, 32, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindUnsigned): + numberOfChannels[0] = 2 + format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_UNSIGNED_INT32 + elif case_desc(d, 32, 32, 32, 0, cudaChannelFormatKind.cudaChannelFormatKindUnsigned): + numberOfChannels[0] = 3 + format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_UNSIGNED_INT32 + elif case_desc(d, 32, 32, 32, 32, cudaChannelFormatKind.cudaChannelFormatKindUnsigned): + numberOfChannels[0] = 4 + format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_UNSIGNED_INT32 + elif case_desc(d, 16, 0, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindFloat): + numberOfChannels[0] = 1 + format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_HALF + elif case_desc(d, 16, 16, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindFloat): + numberOfChannels[0] = 2 + format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_HALF + elif case_desc(d, 16, 16, 16, 0, cudaChannelFormatKind.cudaChannelFormatKindFloat): + numberOfChannels[0] = 3 + format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_HALF + elif case_desc(d, 16, 16, 16, 16, cudaChannelFormatKind.cudaChannelFormatKindFloat): + numberOfChannels[0] = 4 + format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_HALF + elif case_desc(d, 32, 0, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindFloat): + numberOfChannels[0] = 1 + format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_FLOAT + elif case_desc(d, 32, 32, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindFloat): + numberOfChannels[0] = 2 + format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_FLOAT + elif case_desc(d, 32, 32, 32, 0, cudaChannelFormatKind.cudaChannelFormatKindFloat): + numberOfChannels[0] = 3 + format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_FLOAT + elif case_desc(d, 32, 32, 32, 32, cudaChannelFormatKind.cudaChannelFormatKindFloat): + numberOfChannels[0] = 4 + format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_FLOAT + elif case_desc(d, 8, 8, 8, 0, cudaChannelFormatKind.cudaChannelFormatKindNV12): + numberOfChannels[0] = 3 + format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_NV12 + elif case_desc(d, 8, 8, 8, 8, cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed1): + numberOfChannels[0] = 4 + format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_BC1_UNORM + elif case_desc(d, 8, 8, 8, 8, cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed1SRGB): + numberOfChannels[0] = 4 + format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_BC1_UNORM_SRGB + elif case_desc(d, 8, 8, 8, 8, cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed2): + numberOfChannels[0] = 4 + format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_BC2_UNORM + elif case_desc(d, 8, 8, 8, 8, cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed2SRGB): + numberOfChannels[0] = 4 + format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_BC2_UNORM_SRGB + elif case_desc(d, 8, 8, 8, 8, cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed3): + numberOfChannels[0] = 4 + format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_BC3_UNORM + elif case_desc(d, 8, 8, 8, 8, cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed3SRGB): + numberOfChannels[0] = 4 + format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_BC3_UNORM_SRGB + elif case_desc(d, 8, 0, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed4): + numberOfChannels[0] = 1 + format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_BC4_UNORM + elif case_desc(d, 8, 0, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindSignedBlockCompressed4): + numberOfChannels[0] = 1 + format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_BC4_SNORM + elif case_desc(d, 8, 8, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed5): + numberOfChannels[0] = 2 + format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_BC5_UNORM + elif case_desc(d, 8, 8, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindSignedBlockCompressed5): + numberOfChannels[0] = 2 + format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_BC5_SNORM + elif case_desc(d, 16, 16, 16, 0, cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed6H): + numberOfChannels[0] = 3 + format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_BC6H_UF16 + elif case_desc(d, 16, 16, 16, 0, cudaChannelFormatKind.cudaChannelFormatKindSignedBlockCompressed6H): + numberOfChannels[0] = 3 + format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_BC6H_SF16 + elif case_desc(d, 8, 8, 8, 8, cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed7): + numberOfChannels[0] = 4 + format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_BC7_UNORM + elif case_desc(d, 8, 8, 8, 8, cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed7SRGB): + numberOfChannels[0] = 4 + format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_BC7_UNORM_SRGB + elif case_desc(d, 10, 10, 10, 2, cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized1010102): + numberOfChannels[0] = 4 + format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_UNORM_INT_101010_2 + else: + return cudaErrorInvalidChannelDescriptor + + if d[0].f in (cudaChannelFormatKind.cudaChannelFormatKindNV12, + cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed6H, + cudaChannelFormatKind.cudaChannelFormatKindSignedBlockCompressed6H,): + if numberOfChannels[0] != 3: + return cudaErrorInvalidChannelDescriptor + else: + if (numberOfChannels[0] != 1) and (numberOfChannels[0] != 2) and (numberOfChannels[0] != 4): + return cudaErrorInvalidChannelDescriptor + return cudaSuccess + +cdef cudaError_t getChannelFormatDescFromDriverDesc(cudaChannelFormatDesc* pRuntimeDesc, size_t* pDepth, size_t* pHeight, size_t* pWidth, const cydriver.CUDA_ARRAY3D_DESCRIPTOR_v2* pDriverDesc) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef int channel_size = 0 + if pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_UNSIGNED_INT8: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsigned + channel_size = 8 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_UNSIGNED_INT16: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsigned + channel_size = 16 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_UNSIGNED_INT32: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsigned + channel_size = 32 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_SIGNED_INT8: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSigned + channel_size = 8 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_SIGNED_INT16: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSigned + channel_size = 16 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_SIGNED_INT32: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSigned + channel_size = 32 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_HALF: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindFloat + channel_size = 16 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_FLOAT: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindFloat + channel_size = 32 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_NV12: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindNV12 + channel_size = 8 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_UNORM_INT8X1: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized8X1 + channel_size = 8 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_UNORM_INT8X2: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized8X2 + channel_size = 8 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_UNORM_INT8X4: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized8X4 + channel_size = 8 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_SNORM_INT8X1: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized8X1 + channel_size = 8 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_SNORM_INT8X2: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized8X2 + channel_size = 8 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_SNORM_INT8X4: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized8X4 + channel_size = 8 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_UNORM_INT16X1: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized16X1 + channel_size = 16 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_UNORM_INT16X2: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized16X2 + channel_size = 16 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_UNORM_INT16X4: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized16X4 + channel_size = 16 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_SNORM_INT16X1: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized16X1 + channel_size = 16 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_SNORM_INT16X2: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized16X2 + channel_size = 16 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_SNORM_INT16X4: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized16X4 + channel_size = 16 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_BC1_UNORM: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed1 + channel_size = 8 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_BC1_UNORM_SRGB: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed1SRGB + channel_size = 8 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_BC2_UNORM: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed2 + channel_size = 8 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_BC2_UNORM_SRGB: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed2SRGB + channel_size = 8 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_BC3_UNORM: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed3 + channel_size = 8 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_BC3_UNORM_SRGB: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed3SRGB + channel_size = 8 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_BC4_UNORM: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed4 + channel_size = 8 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_BC4_SNORM: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSignedBlockCompressed4 + channel_size = 8 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_BC5_UNORM: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed5 + channel_size = 8 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_BC5_SNORM: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSignedBlockCompressed5 + channel_size = 8 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_BC6H_UF16: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed6H + channel_size = 16 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_BC6H_SF16: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSignedBlockCompressed6H + channel_size = 16 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_BC7_UNORM: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed7 + channel_size = 8 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_BC7_UNORM_SRGB: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed7SRGB + channel_size = 8 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_UNORM_INT_101010_2: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized1010102 + else: + return cudaErrorInvalidChannelDescriptor + + # populate bits per channel + pRuntimeDesc[0].x = 0 + pRuntimeDesc[0].y = 0 + pRuntimeDesc[0].z = 0 + pRuntimeDesc[0].w = 0 + + if pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_UNORM_INT_101010_2 and pDriverDesc[0].NumChannels == 4: + pRuntimeDesc[0].w = 2 + pRuntimeDesc[0].z = 10 + pRuntimeDesc[0].y = 10 + pRuntimeDesc[0].x = 10 + else: + if pDriverDesc[0].NumChannels >= 4: + pRuntimeDesc[0].w = channel_size + if pDriverDesc[0].NumChannels >= 3: + pRuntimeDesc[0].z = channel_size + if pDriverDesc[0].NumChannels >= 2: + pRuntimeDesc[0].y = channel_size + if pDriverDesc[0].NumChannels >= 1: + pRuntimeDesc[0].x = channel_size + + if pDriverDesc[0].NumChannels not in (4, 3, 2, 1): + return cudaErrorInvalidChannelDescriptor + + # populate dimensions + if pDepth != NULL: + pDepth[0] = pDriverDesc[0].Depth + if pHeight != NULL: + pHeight[0] = pDriverDesc[0].Height + if pWidth != NULL: + pWidth[0] = pDriverDesc[0].Width + return cudaSuccess + +cdef cudaError_t getDriverEglFrame(cydriver.CUeglFrame *cuEglFrame, cudaEglFrame eglFrame) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef cudaError_t err = cudaSuccess + cdef unsigned int i = 0 + + err = getDescInfo(&eglFrame.planeDesc[0].channelDesc, &cuEglFrame[0].numChannels, &cuEglFrame[0].cuFormat) + if err != cudaSuccess: + return err + for i in range(eglFrame.planeCount): + if eglFrame.frameType == cudaEglFrameTypeArray: + cuEglFrame[0].frame.pArray[i] = eglFrame.frame.pArray[i] + else: + cuEglFrame[0].frame.pPitch[i] = eglFrame.frame.pPitch[i].ptr + cuEglFrame[0].width = eglFrame.planeDesc[0].width + cuEglFrame[0].height = eglFrame.planeDesc[0].height + cuEglFrame[0].depth = eglFrame.planeDesc[0].depth + cuEglFrame[0].pitch = eglFrame.planeDesc[0].pitch + cuEglFrame[0].planeCount = eglFrame.planeCount + if eglFrame.eglColorFormat == cudaEglColorFormatYUV420Planar: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_PLANAR + elif eglFrame.eglColorFormat == cudaEglColorFormatYUV420SemiPlanar: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR + elif eglFrame.eglColorFormat == cudaEglColorFormatYUV422Planar: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV422_PLANAR + elif eglFrame.eglColorFormat == cudaEglColorFormatYUV422SemiPlanar: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV422_SEMIPLANAR + elif eglFrame.eglColorFormat == cudaEglColorFormatYUV444Planar: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV444_PLANAR + elif eglFrame.eglColorFormat == cudaEglColorFormatYUV444SemiPlanar: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV444_SEMIPLANAR + elif eglFrame.eglColorFormat == cudaEglColorFormatYUYV422: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUYV_422 + elif eglFrame.eglColorFormat == cudaEglColorFormatUYVY422: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_UYVY_422 + elif eglFrame.eglColorFormat == cudaEglColorFormatUYVY709: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_UYVY_709 + elif eglFrame.eglColorFormat == cudaEglColorFormatUYVY709_ER: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_UYVY_709_ER + elif eglFrame.eglColorFormat == cudaEglColorFormatUYVY2020: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_UYVY_2020 + elif eglFrame.eglColorFormat == cudaEglColorFormatARGB: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_ARGB + elif eglFrame.eglColorFormat == cudaEglColorFormatRGBA: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_RGBA + elif eglFrame.eglColorFormat == cudaEglColorFormatABGR: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_ABGR + elif eglFrame.eglColorFormat == cudaEglColorFormatBGRA: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BGRA + elif eglFrame.eglColorFormat == cudaEglColorFormatL: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_L + elif eglFrame.eglColorFormat == cudaEglColorFormatR: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_R + elif eglFrame.eglColorFormat == cudaEglColorFormatA: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_A + elif eglFrame.eglColorFormat == cudaEglColorFormatRG: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_RG + elif eglFrame.eglColorFormat == cudaEglColorFormatAYUV: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_AYUV + elif eglFrame.eglColorFormat == cudaEglColorFormatYVU444SemiPlanar: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU444_SEMIPLANAR + elif eglFrame.eglColorFormat == cudaEglColorFormatYVU422SemiPlanar: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU422_SEMIPLANAR + elif eglFrame.eglColorFormat == cudaEglColorFormatYVU420SemiPlanar: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR + elif eglFrame.eglColorFormat == cudaEglColorFormatY10V10U10_444SemiPlanar: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR + elif eglFrame.eglColorFormat == cudaEglColorFormatY10V10U10_420SemiPlanar: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR + elif eglFrame.eglColorFormat == cudaEglColorFormatY12V12U12_444SemiPlanar: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR + elif eglFrame.eglColorFormat == cudaEglColorFormatY12V12U12_420SemiPlanar: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR + elif eglFrame.eglColorFormat == cudaEglColorFormatVYUY_ER: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_VYUY_ER + elif eglFrame.eglColorFormat == cudaEglColorFormatUYVY_ER: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_UYVY_ER + elif eglFrame.eglColorFormat == cudaEglColorFormatYUYV_ER: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUYV_ER + elif eglFrame.eglColorFormat == cudaEglColorFormatYVYU_ER: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVYU_ER + elif eglFrame.eglColorFormat == cudaEglColorFormatYUVA_ER: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUVA_ER + elif eglFrame.eglColorFormat == cudaEglColorFormatAYUV_ER: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_AYUV_ER + elif eglFrame.eglColorFormat == cudaEglColorFormatYUV444Planar_ER: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV444_PLANAR_ER + elif eglFrame.eglColorFormat == cudaEglColorFormatYUV422Planar_ER: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV422_PLANAR_ER + elif eglFrame.eglColorFormat == cudaEglColorFormatYUV420Planar_ER: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_PLANAR_ER + elif eglFrame.eglColorFormat == cudaEglColorFormatYUV444SemiPlanar_ER: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV444_SEMIPLANAR_ER + elif eglFrame.eglColorFormat == cudaEglColorFormatYUV422SemiPlanar_ER: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV422_SEMIPLANAR_ER + elif eglFrame.eglColorFormat == cudaEglColorFormatYUV420SemiPlanar_ER: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR_ER + elif eglFrame.eglColorFormat == cudaEglColorFormatYVU444Planar_ER: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU444_PLANAR_ER + elif eglFrame.eglColorFormat == cudaEglColorFormatYVU422Planar_ER: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU422_PLANAR_ER + elif eglFrame.eglColorFormat == cudaEglColorFormatYVU420Planar_ER: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_PLANAR_ER + elif eglFrame.eglColorFormat == cudaEglColorFormatYVU444SemiPlanar_ER: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU444_SEMIPLANAR_ER + elif eglFrame.eglColorFormat == cudaEglColorFormatYVU422SemiPlanar_ER: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU422_SEMIPLANAR_ER + elif eglFrame.eglColorFormat == cudaEglColorFormatYVU420SemiPlanar_ER: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR_ER + elif eglFrame.eglColorFormat == cudaEglColorFormatBayerRGGB: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_RGGB + elif eglFrame.eglColorFormat == cudaEglColorFormatBayerBGGR: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_BGGR + elif eglFrame.eglColorFormat == cudaEglColorFormatBayerGRBG: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_GRBG + elif eglFrame.eglColorFormat == cudaEglColorFormatBayerGBRG: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_GBRG + elif eglFrame.eglColorFormat == cudaEglColorFormatBayer10RGGB: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER10_RGGB + elif eglFrame.eglColorFormat == cudaEglColorFormatBayer10BGGR: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER10_BGGR + elif eglFrame.eglColorFormat == cudaEglColorFormatBayer10GRBG: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER10_GRBG + elif eglFrame.eglColorFormat == cudaEglColorFormatBayer10GBRG: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER10_GBRG + elif eglFrame.eglColorFormat == cudaEglColorFormatBayer12RGGB: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_RGGB + elif eglFrame.eglColorFormat == cudaEglColorFormatBayer12BGGR: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_BGGR + elif eglFrame.eglColorFormat == cudaEglColorFormatBayer12GRBG: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_GRBG + elif eglFrame.eglColorFormat == cudaEglColorFormatBayer12GBRG: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_GBRG + elif eglFrame.eglColorFormat == cudaEglColorFormatBayer14RGGB: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER14_RGGB + elif eglFrame.eglColorFormat == cudaEglColorFormatBayer14BGGR: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER14_BGGR + elif eglFrame.eglColorFormat == cudaEglColorFormatBayer14GRBG: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER14_GRBG + elif eglFrame.eglColorFormat == cudaEglColorFormatBayer14GBRG: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER14_GBRG + elif eglFrame.eglColorFormat == cudaEglColorFormatBayer20RGGB: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER20_RGGB + elif eglFrame.eglColorFormat == cudaEglColorFormatBayer20BGGR: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER20_BGGR + elif eglFrame.eglColorFormat == cudaEglColorFormatBayer20GRBG: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER20_GRBG + elif eglFrame.eglColorFormat == cudaEglColorFormatBayer20GBRG: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER20_GBRG + elif eglFrame.eglColorFormat == cudaEglColorFormatBayerIspRGGB: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_ISP_RGGB + elif eglFrame.eglColorFormat == cudaEglColorFormatBayerIspBGGR: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_ISP_BGGR + elif eglFrame.eglColorFormat == cudaEglColorFormatBayerIspGRBG: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_ISP_GRBG + elif eglFrame.eglColorFormat == cudaEglColorFormatBayerIspGBRG: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_ISP_GBRG + elif eglFrame.eglColorFormat == cudaEglColorFormatYVU444Planar: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU444_PLANAR + elif eglFrame.eglColorFormat == cudaEglColorFormatYVU422Planar: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU422_PLANAR + elif eglFrame.eglColorFormat == cudaEglColorFormatYVU420Planar: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_PLANAR + elif eglFrame.eglColorFormat == cudaEglColorFormatBayerBCCR: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_BCCR + elif eglFrame.eglColorFormat == cudaEglColorFormatBayerRCCB: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_RCCB + elif eglFrame.eglColorFormat == cudaEglColorFormatBayerCRBC: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_CRBC + elif eglFrame.eglColorFormat == cudaEglColorFormatBayerCBRC: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_CBRC + elif eglFrame.eglColorFormat == cudaEglColorFormatBayer10CCCC: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER10_CCCC + elif eglFrame.eglColorFormat == cudaEglColorFormatBayer12BCCR: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_BCCR + elif eglFrame.eglColorFormat == cudaEglColorFormatBayer12RCCB: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_RCCB + elif eglFrame.eglColorFormat == cudaEglColorFormatBayer12CRBC: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_CRBC + elif eglFrame.eglColorFormat == cudaEglColorFormatBayer12CBRC: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_CBRC + elif eglFrame.eglColorFormat == cudaEglColorFormatBayer12CCCC: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_CCCC + elif eglFrame.eglColorFormat == cudaEglColorFormatY: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y + elif eglFrame.eglColorFormat == cudaEglColorFormatYUV420SemiPlanar_2020: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR_2020 + elif eglFrame.eglColorFormat == cudaEglColorFormatYVU420SemiPlanar_2020: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR_2020 + elif eglFrame.eglColorFormat == cudaEglColorFormatYUV420Planar_2020: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_PLANAR_2020 + elif eglFrame.eglColorFormat == cudaEglColorFormatYVU420Planar_2020: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_PLANAR_2020 + elif eglFrame.eglColorFormat == cudaEglColorFormatYUV420SemiPlanar_709: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR_709 + elif eglFrame.eglColorFormat == cudaEglColorFormatYVU420SemiPlanar_709: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR_709 + elif eglFrame.eglColorFormat == cudaEglColorFormatYUV420Planar_709: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_PLANAR_709 + elif eglFrame.eglColorFormat == cudaEglColorFormatYVU420Planar_709: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_PLANAR_709 + elif eglFrame.eglColorFormat == cudaEglColorFormatY10V10U10_420SemiPlanar_709: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_709 + elif eglFrame.eglColorFormat == cudaEglColorFormatY10V10U10_420SemiPlanar_2020: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_2020 + elif eglFrame.eglColorFormat == cudaEglColorFormatY10V10U10_422SemiPlanar_2020: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR_2020 + elif eglFrame.eglColorFormat == cudaEglColorFormatY10V10U10_422SemiPlanar: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR + elif eglFrame.eglColorFormat == cudaEglColorFormatY10V10U10_422SemiPlanar_709: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR_709 + elif eglFrame.eglColorFormat == cudaEglColorFormatY_ER: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y_ER + elif eglFrame.eglColorFormat == cudaEglColorFormatY_709_ER: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y_709_ER + elif eglFrame.eglColorFormat == cudaEglColorFormatY10_ER: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10_ER + elif eglFrame.eglColorFormat == cudaEglColorFormatY10_709_ER: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10_709_ER + elif eglFrame.eglColorFormat == cudaEglColorFormatY12_ER: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12_ER + elif eglFrame.eglColorFormat == cudaEglColorFormatY12_709_ER: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12_709_ER + elif eglFrame.eglColorFormat == cudaEglColorFormatYUVA: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUVA + elif eglFrame.eglColorFormat == cudaEglColorFormatYVYU: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVYU + elif eglFrame.eglColorFormat == cudaEglColorFormatVYUY: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_VYUY + elif eglFrame.eglColorFormat == cudaEglColorFormatY10V10U10_420SemiPlanar_ER: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_ER + elif eglFrame.eglColorFormat == cudaEglColorFormatY10V10U10_420SemiPlanar_709_ER: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_709_ER + elif eglFrame.eglColorFormat == cudaEglColorFormatY10V10U10_444SemiPlanar_ER: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR_ER + elif eglFrame.eglColorFormat == cudaEglColorFormatY10V10U10_444SemiPlanar_709_ER: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR_709_ER + elif eglFrame.eglColorFormat == cudaEglColorFormatY12V12U12_420SemiPlanar_ER: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR_ER + elif eglFrame.eglColorFormat == cudaEglColorFormatY12V12U12_420SemiPlanar_709_ER: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR_709_ER + elif eglFrame.eglColorFormat == cudaEglColorFormatY12V12U12_444SemiPlanar_ER: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR_ER + elif eglFrame.eglColorFormat == cudaEglColorFormatY12V12U12_444SemiPlanar_709_ER: + cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR_709_ER + else: + return cudaErrorInvalidValue + if eglFrame.frameType == cudaEglFrameTypeArray: + cuEglFrame[0].frameType = cydriver.CUeglFrameType_enum.CU_EGL_FRAME_TYPE_ARRAY + elif eglFrame.frameType == cudaEglFrameTypePitch: + cuEglFrame[0].frameType = cydriver.CUeglFrameType_enum.CU_EGL_FRAME_TYPE_PITCH + else: + return cudaErrorInvalidValue + +@cython.show_performance_hints(False) +cdef cudaError_t getRuntimeEglFrame(cudaEglFrame *eglFrame, cydriver.CUeglFrame cueglFrame) except ?cudaErrorCallRequiresNewerDriver nogil: + cdef cudaError_t err = cudaSuccess + cdef unsigned int i + cdef cydriver.CUDA_ARRAY3D_DESCRIPTOR_v2 ad + cdef cudaPitchedPtr pPtr + memset(eglFrame, 0, sizeof(eglFrame[0])) + memset(&ad, 0, sizeof(ad)) + for i in range(cueglFrame.planeCount): + ad.Depth = cueglFrame.depth + ad.Flags = 0 + ad.Format = cueglFrame.cuFormat + ad.Height = cueglFrame.height + ad.NumChannels = cueglFrame.numChannels + ad.Width = cueglFrame.width + + err = getChannelFormatDescFromDriverDesc(&eglFrame[0].planeDesc[i].channelDesc, NULL, NULL, NULL, &ad) + if err != cudaSuccess: + return err + + eglFrame[0].planeDesc[i].depth = cueglFrame.depth + eglFrame[0].planeDesc[i].numChannels = cueglFrame.numChannels + if i == 0: + eglFrame[0].planeDesc[i].width = cueglFrame.width + eglFrame[0].planeDesc[i].height = cueglFrame.height + eglFrame[0].planeDesc[i].pitch = cueglFrame.pitch + elif (cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_PLANAR or + cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_PLANAR_ER or + cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_PLANAR or + cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_PLANAR_ER or + cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_PLANAR_2020 or + cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_PLANAR_2020 or + cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_PLANAR_709 or + cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_PLANAR_709): + eglFrame[0].planeDesc[i].width = (cueglFrame.width / 2) + eglFrame[0].planeDesc[i].height = (cueglFrame.height / 2) + eglFrame[0].planeDesc[i].pitch = (cueglFrame.pitch / 2) + elif (cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR or + cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR_ER or + cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR or + cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR_ER or + cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR or + cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR or + cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR_2020 or + cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR_2020 or + cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR_709 or + cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR_709 or + cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_709 or + cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_2020 or + cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_ER or + cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_709_ER or + cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR_ER or + cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR_709_ER): + eglFrame[0].planeDesc[i].width = (cueglFrame.width / 2) + eglFrame[0].planeDesc[i].height = (cueglFrame.height / 2) + eglFrame[0].planeDesc[i].pitch = (cueglFrame.pitch / 2) + eglFrame[0].planeDesc[1].channelDesc.y = 8 + if (cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR or + cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR or + cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_709 or + cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_2020 or + cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_ER or + cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_709_ER or + cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR_ER or + cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR_709_ER): + eglFrame[0].planeDesc[1].channelDesc.y = 16 + elif (cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV422_PLANAR or + cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV422_PLANAR_ER or + cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU422_PLANAR or + cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU422_PLANAR_ER): + eglFrame[0].planeDesc[i].height = cueglFrame.height + eglFrame[0].planeDesc[i].width = (cueglFrame.width / 2) + eglFrame[0].planeDesc[i].pitch = (cueglFrame.pitch / 2) + elif (cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV422_SEMIPLANAR or + cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV422_SEMIPLANAR_ER or + cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU422_SEMIPLANAR or + cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU422_SEMIPLANAR_ER or + cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR_2020 or + cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR or + cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR_709): + eglFrame[0].planeDesc[i].width = (cueglFrame.width / 2) + eglFrame[0].planeDesc[i].height = cueglFrame.height + eglFrame[0].planeDesc[i].pitch = (cueglFrame.pitch / 2) + eglFrame[0].planeDesc[1].channelDesc.y = 8 + if (cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR_2020 or + cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR or + cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR_709): + eglFrame[0].planeDesc[1].channelDesc.y = 16 + elif (cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV444_PLANAR or + cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV444_PLANAR_ER or + cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU444_PLANAR or + cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU444_PLANAR_ER): + eglFrame[0].planeDesc[i].height = cueglFrame.height + eglFrame[0].planeDesc[i].width = cueglFrame.width + eglFrame[0].planeDesc[i].pitch = cueglFrame.pitch + elif (cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV444_SEMIPLANAR or + cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV444_SEMIPLANAR_ER or + cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU444_SEMIPLANAR or + cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU444_SEMIPLANAR_ER or + cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR or + cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR or + cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR_ER or + cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR_709_ER or + cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR_ER or + cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR_709_ER): + eglFrame[0].planeDesc[i].height = cueglFrame.height + eglFrame[0].planeDesc[i].width = cueglFrame.width + eglFrame[0].planeDesc[i].pitch = cueglFrame.pitch + eglFrame[0].planeDesc[1].channelDesc.y = 8 + if (cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR or + cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR or + cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR_ER or + cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR_709_ER or + cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR_ER or + cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR_709_ER): + eglFrame[0].planeDesc[1].channelDesc.y = 16 + if cueglFrame.frameType == cydriver.CUeglFrameType_enum.CU_EGL_FRAME_TYPE_ARRAY: + eglFrame[0].frame.pArray[i] = cueglFrame.frame.pArray[i] + else: + pPtr = _cylib_make_cudaPitchedPtr(cueglFrame.frame.pPitch[i], eglFrame[0].planeDesc[i].pitch, + eglFrame[0].planeDesc[i].width, eglFrame[0].planeDesc[i].height) + eglFrame[0].frame.pPitch[i] = pPtr + + eglFrame[0].planeCount = cueglFrame.planeCount + if cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_PLANAR: + eglFrame[0].eglColorFormat = cudaEglColorFormatYUV420Planar + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR: + eglFrame[0].eglColorFormat = cudaEglColorFormatYUV420SemiPlanar + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV422_PLANAR: + eglFrame[0].eglColorFormat = cudaEglColorFormatYUV422Planar + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV422_SEMIPLANAR: + eglFrame[0].eglColorFormat = cudaEglColorFormatYUV422SemiPlanar + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV444_PLANAR: + eglFrame[0].eglColorFormat = cudaEglColorFormatYUV444Planar + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV444_SEMIPLANAR: + eglFrame[0].eglColorFormat = cudaEglColorFormatYUV444SemiPlanar + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUYV_422: + eglFrame[0].eglColorFormat = cudaEglColorFormatYUYV422 + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_UYVY_422: + eglFrame[0].eglColorFormat = cudaEglColorFormatUYVY422 + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_UYVY_709: + eglFrame[0].eglColorFormat = cudaEglColorFormatUYVY709 + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_UYVY_709_ER: + eglFrame[0].eglColorFormat = cudaEglColorFormatUYVY709_ER + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_UYVY_2020: + eglFrame[0].eglColorFormat = cudaEglColorFormatUYVY2020 + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_ARGB: + eglFrame[0].eglColorFormat = cudaEglColorFormatARGB + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_RGBA: + eglFrame[0].eglColorFormat = cudaEglColorFormatRGBA + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_ABGR: + eglFrame[0].eglColorFormat = cudaEglColorFormatABGR + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BGRA: + eglFrame[0].eglColorFormat = cudaEglColorFormatBGRA + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_L: + eglFrame[0].eglColorFormat = cudaEglColorFormatL + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_R: + eglFrame[0].eglColorFormat = cudaEglColorFormatR + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_A: + eglFrame[0].eglColorFormat = cudaEglColorFormatA + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_RG: + eglFrame[0].eglColorFormat = cudaEglColorFormatRG + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_AYUV: + eglFrame[0].eglColorFormat = cudaEglColorFormatAYUV + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU444_SEMIPLANAR: + eglFrame[0].eglColorFormat = cudaEglColorFormatYVU444SemiPlanar + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU422_SEMIPLANAR: + eglFrame[0].eglColorFormat = cudaEglColorFormatYVU422SemiPlanar + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR: + eglFrame[0].eglColorFormat = cudaEglColorFormatYVU420SemiPlanar + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR: + eglFrame[0].eglColorFormat = cudaEglColorFormatY10V10U10_444SemiPlanar + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR: + eglFrame[0].eglColorFormat = cudaEglColorFormatY10V10U10_420SemiPlanar + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR: + eglFrame[0].eglColorFormat = cudaEglColorFormatY12V12U12_444SemiPlanar + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR: + eglFrame[0].eglColorFormat = cudaEglColorFormatY12V12U12_420SemiPlanar + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_VYUY_ER: + eglFrame[0].eglColorFormat = cudaEglColorFormatVYUY_ER + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_UYVY_ER: + eglFrame[0].eglColorFormat = cudaEglColorFormatUYVY_ER + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUYV_ER: + eglFrame[0].eglColorFormat = cudaEglColorFormatYUYV_ER + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVYU_ER: + eglFrame[0].eglColorFormat = cudaEglColorFormatYVYU_ER + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUVA_ER: + eglFrame[0].eglColorFormat = cudaEglColorFormatYUVA_ER + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_AYUV_ER: + eglFrame[0].eglColorFormat = cudaEglColorFormatAYUV_ER + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV444_PLANAR_ER: + eglFrame[0].eglColorFormat = cudaEglColorFormatYUV444Planar_ER + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV422_PLANAR_ER: + eglFrame[0].eglColorFormat = cudaEglColorFormatYUV422Planar_ER + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_PLANAR_ER: + eglFrame[0].eglColorFormat = cudaEglColorFormatYUV420Planar_ER + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV444_SEMIPLANAR_ER: + eglFrame[0].eglColorFormat = cudaEglColorFormatYUV444SemiPlanar_ER + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV422_SEMIPLANAR_ER: + eglFrame[0].eglColorFormat = cudaEglColorFormatYUV422SemiPlanar_ER + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR_ER: + eglFrame[0].eglColorFormat = cudaEglColorFormatYUV420SemiPlanar_ER + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU444_PLANAR_ER: + eglFrame[0].eglColorFormat = cudaEglColorFormatYVU444Planar_ER + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU422_PLANAR_ER: + eglFrame[0].eglColorFormat = cudaEglColorFormatYVU422Planar_ER + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_PLANAR_ER: + eglFrame[0].eglColorFormat = cudaEglColorFormatYVU420Planar_ER + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU444_SEMIPLANAR_ER: + eglFrame[0].eglColorFormat = cudaEglColorFormatYVU444SemiPlanar_ER + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU422_SEMIPLANAR_ER: + eglFrame[0].eglColorFormat = cudaEglColorFormatYVU422SemiPlanar_ER + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR_ER: + eglFrame[0].eglColorFormat = cudaEglColorFormatYVU420SemiPlanar_ER + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_RGGB: + eglFrame[0].eglColorFormat = cudaEglColorFormatBayerRGGB + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_BGGR: + eglFrame[0].eglColorFormat = cudaEglColorFormatBayerBGGR + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_GRBG: + eglFrame[0].eglColorFormat = cudaEglColorFormatBayerGRBG + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_GBRG: + eglFrame[0].eglColorFormat = cudaEglColorFormatBayerGBRG + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER10_RGGB: + eglFrame[0].eglColorFormat = cudaEglColorFormatBayer10RGGB + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER10_BGGR: + eglFrame[0].eglColorFormat = cudaEglColorFormatBayer10BGGR + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER10_GRBG: + eglFrame[0].eglColorFormat = cudaEglColorFormatBayer10GRBG + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER10_GBRG: + eglFrame[0].eglColorFormat = cudaEglColorFormatBayer10GBRG + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_RGGB: + eglFrame[0].eglColorFormat = cudaEglColorFormatBayer12RGGB + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_BGGR: + eglFrame[0].eglColorFormat = cudaEglColorFormatBayer12BGGR + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_GRBG: + eglFrame[0].eglColorFormat = cudaEglColorFormatBayer12GRBG + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_GBRG: + eglFrame[0].eglColorFormat = cudaEglColorFormatBayer12GBRG + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER14_RGGB: + eglFrame[0].eglColorFormat = cudaEglColorFormatBayer14RGGB + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER14_BGGR: + eglFrame[0].eglColorFormat = cudaEglColorFormatBayer14BGGR + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER14_GRBG: + eglFrame[0].eglColorFormat = cudaEglColorFormatBayer14GRBG + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER14_GBRG: + eglFrame[0].eglColorFormat = cudaEglColorFormatBayer14GBRG + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER20_RGGB: + eglFrame[0].eglColorFormat = cudaEglColorFormatBayer20RGGB + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER20_BGGR: + eglFrame[0].eglColorFormat = cudaEglColorFormatBayer20BGGR + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER20_GRBG: + eglFrame[0].eglColorFormat = cudaEglColorFormatBayer20GRBG + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER20_GBRG: + eglFrame[0].eglColorFormat = cudaEglColorFormatBayer20GBRG + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_ISP_RGGB: + eglFrame[0].eglColorFormat = cudaEglColorFormatBayerIspRGGB + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_ISP_BGGR: + eglFrame[0].eglColorFormat = cudaEglColorFormatBayerIspBGGR + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_ISP_GRBG: + eglFrame[0].eglColorFormat = cudaEglColorFormatBayerIspGRBG + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_ISP_GBRG: + eglFrame[0].eglColorFormat = cudaEglColorFormatBayerIspGBRG + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU444_PLANAR: + eglFrame[0].eglColorFormat = cudaEglColorFormatYVU444Planar + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU422_PLANAR: + eglFrame[0].eglColorFormat = cudaEglColorFormatYVU422Planar + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_PLANAR: + eglFrame[0].eglColorFormat = cudaEglColorFormatYVU420Planar + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_BCCR: + eglFrame[0].eglColorFormat = cudaEglColorFormatBayerBCCR + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_RCCB: + eglFrame[0].eglColorFormat = cudaEglColorFormatBayerRCCB + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_CRBC: + eglFrame[0].eglColorFormat = cudaEglColorFormatBayerCRBC + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_CBRC: + eglFrame[0].eglColorFormat = cudaEglColorFormatBayerCBRC + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER10_CCCC: + eglFrame[0].eglColorFormat = cudaEglColorFormatBayer10CCCC + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_BCCR: + eglFrame[0].eglColorFormat = cudaEglColorFormatBayer12BCCR + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_RCCB: + eglFrame[0].eglColorFormat = cudaEglColorFormatBayer12RCCB + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_CRBC: + eglFrame[0].eglColorFormat = cudaEglColorFormatBayer12CRBC + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_CBRC: + eglFrame[0].eglColorFormat = cudaEglColorFormatBayer12CBRC + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_CCCC: + eglFrame[0].eglColorFormat = cudaEglColorFormatBayer12CCCC + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y: + eglFrame[0].eglColorFormat = cudaEglColorFormatY + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR_2020: + eglFrame[0].eglColorFormat = cudaEglColorFormatYUV420SemiPlanar_2020 + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR_2020: + eglFrame[0].eglColorFormat = cudaEglColorFormatYVU420SemiPlanar_2020 + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_PLANAR_2020: + eglFrame[0].eglColorFormat = cudaEglColorFormatYUV420Planar_2020 + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_PLANAR_2020: + eglFrame[0].eglColorFormat = cudaEglColorFormatYVU420Planar_2020 + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR_709: + eglFrame[0].eglColorFormat = cudaEglColorFormatYUV420SemiPlanar_709 + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR_709: + eglFrame[0].eglColorFormat = cudaEglColorFormatYVU420SemiPlanar_709 + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_PLANAR_709: + eglFrame[0].eglColorFormat = cudaEglColorFormatYUV420Planar_709 + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_PLANAR_709: + eglFrame[0].eglColorFormat = cudaEglColorFormatYVU420Planar_709 + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_709: + eglFrame[0].eglColorFormat = cudaEglColorFormatY10V10U10_420SemiPlanar_709 + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_2020: + eglFrame[0].eglColorFormat = cudaEglColorFormatY10V10U10_420SemiPlanar_2020 + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR_2020: + eglFrame[0].eglColorFormat = cudaEglColorFormatY10V10U10_422SemiPlanar_2020 + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR: + eglFrame[0].eglColorFormat = cudaEglColorFormatY10V10U10_422SemiPlanar + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR_709: + eglFrame[0].eglColorFormat = cudaEglColorFormatY10V10U10_422SemiPlanar_709 + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y_ER: + eglFrame[0].eglColorFormat = cudaEglColorFormatY_ER + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y_709_ER: + eglFrame[0].eglColorFormat = cudaEglColorFormatY_709_ER + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10_ER: + eglFrame[0].eglColorFormat = cudaEglColorFormatY10_ER + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10_709_ER: + eglFrame[0].eglColorFormat = cudaEglColorFormatY10_709_ER + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12_ER: + eglFrame[0].eglColorFormat = cudaEglColorFormatY12_ER + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12_709_ER: + eglFrame[0].eglColorFormat = cudaEglColorFormatY12_709_ER + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUVA: + eglFrame[0].eglColorFormat = cudaEglColorFormatYUVA + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVYU: + eglFrame[0].eglColorFormat = cudaEglColorFormatYVYU + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_VYUY: + eglFrame[0].eglColorFormat = cudaEglColorFormatVYUY + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_ER: + eglFrame[0].eglColorFormat = cudaEglColorFormatY10V10U10_420SemiPlanar_ER + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_709_ER: + eglFrame[0].eglColorFormat = cudaEglColorFormatY10V10U10_420SemiPlanar_709_ER + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR_ER: + eglFrame[0].eglColorFormat = cudaEglColorFormatY10V10U10_444SemiPlanar_ER + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR_709_ER: + eglFrame[0].eglColorFormat = cudaEglColorFormatY10V10U10_444SemiPlanar_709_ER + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR_ER: + eglFrame[0].eglColorFormat = cudaEglColorFormatY12V12U12_420SemiPlanar_ER + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR_709_ER: + eglFrame[0].eglColorFormat = cudaEglColorFormatY12V12U12_420SemiPlanar_709_ER + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR_ER: + eglFrame[0].eglColorFormat = cudaEglColorFormatY12V12U12_444SemiPlanar_ER + elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR_709_ER: + eglFrame[0].eglColorFormat = cudaEglColorFormatY12V12U12_444SemiPlanar_709_ER + else: + return cudaErrorInvalidValue + if cueglFrame.frameType == cydriver.CUeglFrameType_enum.CU_EGL_FRAME_TYPE_ARRAY: + eglFrame[0].frameType = cudaEglFrameTypeArray + elif cueglFrame.frameType == cydriver.CUeglFrameType_enum.CU_EGL_FRAME_TYPE_PITCH: + eglFrame[0].frameType = cudaEglFrameTypePitch + else: + return cudaErrorInvalidValue diff --git a/cuda_bindings/cuda/bindings/_lib/dlfcn.pxd b/cuda_bindings/cuda/bindings/_lib/dlfcn.pxd new file mode 100644 index 00000000000..23fbe256484 --- /dev/null +++ b/cuda_bindings/cuda/bindings/_lib/dlfcn.pxd @@ -0,0 +1,14 @@ +# SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +cdef extern from "" nogil: + void *dlopen(const char *, int) + char *dlerror() + void *dlsym(void *, const char *) + int dlclose(void *) + + enum: + RTLD_LAZY + RTLD_NOW + RTLD_GLOBAL + RTLD_LOCAL diff --git a/cuda/_lib/param_packer.cpp b/cuda_bindings/cuda/bindings/_lib/param_packer.h similarity index 70% rename from cuda/_lib/param_packer.cpp rename to cuda_bindings/cuda/bindings/_lib/param_packer.h index 63386a1779f..160ef5f7c92 100644 --- a/cuda/_lib/param_packer.cpp +++ b/cuda_bindings/cuda/bindings/_lib/param_packer.h @@ -1,50 +1,34 @@ -// Copyright 2021-2024 NVIDIA Corporation. All rights reserved. -// -// Please refer to the NVIDIA end user license agreement (EULA) associated -// with this source code for terms and conditions that govern your use of -// this software. Any use, reproduction, disclosure, or distribution of -// this software and related documentation outside the terms of the EULA -// is strictly prohibited. +// SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// SPDX-License-Identifier: Apache-2.0 + #include -#include "param_packer.h" #include #include #include #include -PyObject* enum_module = nullptr; -PyTypeObject* enum_Enum = nullptr; - -PyObject* ctypes_module = nullptr; -PyObject* ctypes_addressof = nullptr; -PyObject* addressof_param_tuple = nullptr; +static PyObject* ctypes_module = nullptr; -PyTypeObject* ctypes_c_char = nullptr; -PyTypeObject* ctypes_c_bool = nullptr; -PyTypeObject* ctypes_c_wchar = nullptr; -PyTypeObject* ctypes_c_byte = nullptr; -PyTypeObject* ctypes_c_ubyte = nullptr; -PyTypeObject* ctypes_c_short = nullptr; -PyTypeObject* ctypes_c_ushort = nullptr; -PyTypeObject* ctypes_c_int = nullptr; -PyTypeObject* ctypes_c_uint = nullptr; -PyTypeObject* ctypes_c_long = nullptr; -PyTypeObject* ctypes_c_ulong = nullptr; -PyTypeObject* ctypes_c_longlong = nullptr; -PyTypeObject* ctypes_c_ulonglong = nullptr; -PyTypeObject* ctypes_c_size_t = nullptr; -PyTypeObject* ctypes_c_float = nullptr; -PyTypeObject* ctypes_c_double = nullptr; -PyTypeObject* ctypes_c_void_p = nullptr; +static PyTypeObject* ctypes_c_char = nullptr; +static PyTypeObject* ctypes_c_bool = nullptr; +static PyTypeObject* ctypes_c_wchar = nullptr; +static PyTypeObject* ctypes_c_byte = nullptr; +static PyTypeObject* ctypes_c_ubyte = nullptr; +static PyTypeObject* ctypes_c_short = nullptr; +static PyTypeObject* ctypes_c_ushort = nullptr; +static PyTypeObject* ctypes_c_int = nullptr; +static PyTypeObject* ctypes_c_uint = nullptr; +static PyTypeObject* ctypes_c_long = nullptr; +static PyTypeObject* ctypes_c_ulong = nullptr; +static PyTypeObject* ctypes_c_longlong = nullptr; +static PyTypeObject* ctypes_c_ulonglong = nullptr; +static PyTypeObject* ctypes_c_size_t = nullptr; +static PyTypeObject* ctypes_c_float = nullptr; +static PyTypeObject* ctypes_c_double = nullptr; +static PyTypeObject* ctypes_c_void_p = nullptr; -PyTypeObject* ctypes_c_ssize_t = nullptr; -PyTypeObject* ctypes_c_longdouble = nullptr; -PyTypeObject* ctypes_c_char_p = nullptr; -PyTypeObject* ctypes_c_wchar_p = nullptr; -PyTypeObject* ctypes_c_structure = nullptr; - -void fetch_ctypes() +static void fetch_ctypes() { ctypes_module = PyImport_ImportModule("ctypes"); if (ctypes_module == nullptr) @@ -54,7 +38,6 @@ void fetch_ctypes() if (ctypes_dict == nullptr) throw std::runtime_error(std::string("FAILURE @ ") + std::string(__FILE__) + " : " + std::to_string(__LINE__)); // supportedtypes - ctypes_c_int = (PyTypeObject*) PyDict_GetItemString(ctypes_dict, "c_int"); ctypes_c_char = (PyTypeObject*) PyDict_GetItemString(ctypes_dict, "c_char"); ctypes_c_bool = (PyTypeObject*) PyDict_GetItemString(ctypes_dict, "c_bool"); ctypes_c_wchar = (PyTypeObject*) PyDict_GetItemString(ctypes_dict, "c_wchar"); @@ -76,9 +59,9 @@ void fetch_ctypes() // (target type, source type) -std::map, std::function> m_feeders; +static std::map, std::function> m_feeders; -void populate_feeders(PyTypeObject* target_t, PyTypeObject* source_t) +static void populate_feeders(PyTypeObject* target_t, PyTypeObject* source_t) { if (target_t == ctypes_c_int) { @@ -144,7 +127,7 @@ void populate_feeders(PyTypeObject* target_t, PyTypeObject* source_t) } } -int feed(void* ptr, PyObject* value, PyObject* type) +static int feed(void* ptr, PyObject* value, PyObject* type) { PyTypeObject* pto = (PyTypeObject*)type; if (ctypes_c_int == nullptr) diff --git a/cuda_bindings/cuda/bindings/_lib/param_packer.pxd b/cuda_bindings/cuda/bindings/_lib/param_packer.pxd new file mode 100644 index 00000000000..1c0ad690be4 --- /dev/null +++ b/cuda_bindings/cuda/bindings/_lib/param_packer.pxd @@ -0,0 +1,7 @@ +# SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +# Include "param_packer.h" so its contents get compiled into every +# Cython extension module that depends on param_packer.pxd. +cdef extern from "param_packer.h": + int feed(void* ptr, object o, object ct) diff --git a/cuda_bindings/cuda/bindings/_lib/utils.pxd b/cuda_bindings/cuda/bindings/_lib/utils.pxd new file mode 100644 index 00000000000..24b0ae8de93 --- /dev/null +++ b/cuda_bindings/cuda/bindings/_lib/utils.pxd @@ -0,0 +1,168 @@ +# SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +cimport cuda.bindings.driver as driver +cimport cuda.bindings.cydriver as cydriver +cimport cuda.bindings.cyruntime as cyruntime +from libcpp.vector cimport vector +from cpython.buffer cimport PyBuffer_Release, Py_buffer + +cdef class _HelperKernelParams: + cdef Py_buffer _pybuffer + cdef bint _pyobj_acquired + cdef void** _ckernelParams + cdef char* _ckernelParamsData + cdef int _length + cdef bint _malloc_list_created + +cdef struct _HelperInputVoidPtrStruct: + Py_buffer _pybuffer + +cdef class _HelperInputVoidPtr: + cdef _HelperInputVoidPtrStruct _helper + cdef void* _cptr + +cdef void * _helper_input_void_ptr(ptr, _HelperInputVoidPtrStruct *buffer) + +cdef inline void * _helper_input_void_ptr_free(_HelperInputVoidPtrStruct *helper): + if helper[0]._pybuffer.buf != NULL: + PyBuffer_Release(&helper[0]._pybuffer) + + + +cdef class _HelperCUmemPool_attribute: + cdef void* _cptr + cdef cydriver.CUmemPool_attribute_enum _attr + cdef bint _is_getter + + # Return values + cdef int _int_val + cdef driver.cuuint64_t _cuuint64_t_val + + + +cdef class _HelperCUmem_range_attribute: + cdef void* _cptr + cdef cydriver.CUmem_range_attribute_enum _attr + cdef size_t _data_size + + # Return values + cdef int _int_val # 32 bit integer + cdef int* _int_val_list # 32 bit integer array + + + +cdef class _HelperCUpointer_attribute: + cdef void* _cptr + cdef cydriver.CUpointer_attribute_enum _attr + cdef bint _is_getter + + # Return values + cdef driver.CUcontext _ctx + cdef unsigned int _uint + cdef int _int + cdef driver.CUdeviceptr _devptr + cdef void** _void + cdef driver.CUDA_POINTER_ATTRIBUTE_P2P_TOKENS _token + cdef bint _bool + cdef unsigned long long _ull + cdef size_t _size + cdef driver.CUmemoryPool _mempool + + + +cdef class _HelperCUgraphMem_attribute: + cdef void* _cptr + cdef cydriver.CUgraphMem_attribute_enum _attr + cdef bint _is_getter + + # Return values + cdef driver.cuuint64_t _cuuint64_t_val + + + +cdef class _HelperCUjit_option: + cdef void* _cptr + cdef cydriver.CUjit_option_enum _attr + + # Return values + cdef unsigned int _uint + cdef float _float + cdef char* _charstar + cdef cydriver.CUjit_target_enum _target + cdef cydriver.CUjit_fallback_enum _fallback + cdef int _int + cdef cydriver.CUjit_cacheMode_enum _cacheMode + cdef vector[char*] _charstarstar # list of names + cdef _InputVoidPtrPtrHelper _voidstarstar # list of addresses + + + +cdef class _HelperCudaJitOption: + cdef void* _cptr + cdef cyruntime.cudaJitOption _attr + + # Return values + cdef unsigned int _uint + cdef float _float + cdef char* _charstar + cdef cyruntime.cudaJit_Fallback _fallback + cdef int _int + cdef cyruntime.cudaJit_CacheMode _cacheMode + + + +cdef class _HelperCUlibraryOption: + cdef void* _cptr + cdef cydriver.CUlibraryOption_enum _attr + + # Return values + cdef unsigned int _uint + + + +cdef class _HelperCudaLibraryOption: + cdef void* _cptr + cdef cyruntime.cudaLibraryOption _attr + + # Return values + cdef unsigned int _uint + + + +cdef class _HelperCUmemAllocationHandleType: + cdef void* _cptr + cdef cydriver.CUmemAllocationHandleType_enum _type + + # Return values + cdef int _int + cdef void* _handle + cdef unsigned int _d3dkmt_handle + + cdef driver.CUmemFabricHandle _mem_fabric_handle + + +cdef class _HelperCUlogicalEndpointIpcHandleType: + cdef void* _cptr + cdef cydriver.CUlogicalEndpointIpcHandleType_enum _type + + # Return values + cdef int _int + cdef driver.CUlogicalEndpointFabricHandle _fabric_handle + + +cdef class _InputVoidPtrPtrHelper: + cdef object _references + cdef void** _cptr + + + +cdef class _HelperCUcoredumpSettings: + cdef void* _cptr + cdef cydriver.CUcoredumpSettings_enum _attrib + cdef bint _is_getter + cdef size_t _size + + # Return values + cdef bint _bool + cdef char* _charstar diff --git a/cuda_bindings/cuda/bindings/_lib/utils.pxi b/cuda_bindings/cuda/bindings/_lib/utils.pxi new file mode 100644 index 00000000000..2dd4d5c1a27 --- /dev/null +++ b/cuda_bindings/cuda/bindings/_lib/utils.pxi @@ -0,0 +1,703 @@ +# SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +from cpython.buffer cimport PyObject_CheckBuffer, PyObject_GetBuffer, PyBuffer_Release, PyBUF_SIMPLE, PyBUF_ANY_CONTIGUOUS +from libc.stdlib cimport calloc, free +from libc.stdint cimport int32_t, uint32_t, int64_t, uint64_t +from libc.stddef cimport wchar_t +from libc.string cimport memcpy +from cuda.bindings._internal._fast_enum import FastEnum as _FastEnum +import ctypes as _ctypes +cimport cuda.bindings.cydriver as cydriver +cimport cuda.bindings._lib.param_packer as param_packer + +cdef void* _callocWrapper(length, size): + cdef void* out = calloc(length, size) + if out is NULL: + raise MemoryError('Failed to allocated length x size memory: {}x{}'.format(length, size)) + return out + +cdef class _HelperKernelParams: + supported_types = { # excluding void_p and None, which are handled specially + _ctypes.c_bool, + _ctypes.c_char, + _ctypes.c_wchar, + _ctypes.c_byte, + _ctypes.c_ubyte, + _ctypes.c_short, + _ctypes.c_ushort, + _ctypes.c_int, + _ctypes.c_uint, + _ctypes.c_long, + _ctypes.c_ulong, + _ctypes.c_longlong, + _ctypes.c_ulonglong, + _ctypes.c_size_t, + _ctypes.c_float, + _ctypes.c_double + } + + max_param_size = max(_ctypes.sizeof(max(_HelperKernelParams.supported_types, key=lambda t:_ctypes.sizeof(t))), sizeof(void_ptr)) + + def __cinit__(self, kernelParams): + self._pyobj_acquired = False + self._malloc_list_created = False + if kernelParams is None: + self._ckernelParams = NULL + elif isinstance(kernelParams, (int)): + # Easy run, user gave us an already configured void** address + self._ckernelParams = kernelParams + elif PyObject_CheckBuffer(kernelParams): + # Easy run, get address from Python Buffer Protocol + err_buffer = PyObject_GetBuffer(kernelParams, &self._pybuffer, PyBUF_SIMPLE | PyBUF_ANY_CONTIGUOUS) + if err_buffer == -1: + raise RuntimeError("Argument 'kernelParams' failed to retrieve buffer through Buffer Protocol") + self._pyobj_acquired = True + self._ckernelParams = self._pybuffer.buf + elif isinstance(kernelParams, (tuple)) and len(kernelParams) == 2 and isinstance(kernelParams[0], (tuple)) and isinstance(kernelParams[1], (tuple)): + # Hard run, construct and fill out contigues memory using provided kernel values and types based + if len(kernelParams[0]) != len(kernelParams[1]): + raise TypeError("Argument 'kernelParams' has tuples with different length") + if len(kernelParams[0]) != 0: + self._length = len(kernelParams[0]) + self._ckernelParams = _callocWrapper(len(kernelParams[0]), sizeof(void*)) + self._ckernelParamsData = _callocWrapper(len(kernelParams[0]), _HelperKernelParams.max_param_size) + self._malloc_list_created = True + + idx = 0 + data_idx = 0 + for value, ctype in zip(kernelParams[0], kernelParams[1]): + if ctype is None: + # special cases for None + if callable(getattr(value, 'getPtr', None)): + self._ckernelParams[idx] = value.getPtr() + elif isinstance(value, (_ctypes.Structure)): + self._ckernelParams[idx] = _ctypes.addressof(value) + elif isinstance(value, (_FastEnum)): + self._ckernelParams[idx] = &(self._ckernelParamsData[data_idx]) + (self._ckernelParams[idx])[0] = value.value + data_idx += sizeof(int) + else: + raise TypeError("Provided argument is of type {} but expected Type {}, {} or CUDA Binding structure with getPtr() attribute".format(type(value), type(_ctypes.Structure), type(_ctypes.c_void_p))) + elif ctype in _HelperKernelParams.supported_types: + self._ckernelParams[idx] = &(self._ckernelParamsData[data_idx]) + + # handle case where a float is passed as a double + if ctype == _ctypes.c_double and isinstance(value, _ctypes.c_float): + value = ctype(value.value) + if not isinstance(value, ctype): # make it a ctype + size = param_packer.feed(self._ckernelParams[idx], value, ctype) + if size == 0: # feed failed + value = ctype(value) + size = _ctypes.sizeof(ctype) + addr = (_ctypes.addressof(value)) + memcpy(self._ckernelParams[idx], addr, size) + else: + size = _ctypes.sizeof(ctype) + addr = (_ctypes.addressof(value)) + memcpy(self._ckernelParams[idx], addr, size) + data_idx += size + elif ctype == _ctypes.c_void_p: + # special cases for void_p + if isinstance(value, (int, _ctypes.c_void_p)): + self._ckernelParams[idx] = &(self._ckernelParamsData[data_idx]) + (self._ckernelParams[idx])[0] = value.value if isinstance(value, (_ctypes.c_void_p)) else value + data_idx += sizeof(void_ptr) + elif callable(getattr(value, 'getPtr', None)): + self._ckernelParams[idx] = &(self._ckernelParamsData[data_idx]) + (self._ckernelParams[idx])[0] = value.getPtr() + data_idx += sizeof(void_ptr) + else: + raise TypeError("Provided argument is of type {} but expected Type {}, {} or CUDA Binding structure with getPtr() attribute".format(type(value), type(int), type(_ctypes.c_void_p))) + else: + raise TypeError("Unsupported type: " + str(type(ctype))) + idx += 1 + else: + raise TypeError("Argument 'kernelParams' is not a valid type: tuple[tuple[Any, ...], tuple[Any, ...]] or PyObject implimenting Buffer Protocol or Int") + + def __dealloc__(self): + if self._pyobj_acquired is True: + PyBuffer_Release(&self._pybuffer) + if self._malloc_list_created is True: + free(self._ckernelParams) + free(self._ckernelParamsData) + + @property + def ckernelParams(self): + return self._ckernelParams + +cdef class _HelperInputVoidPtr: + def __cinit__(self, ptr): + self._cptr = _helper_input_void_ptr(ptr, &self._helper) + + def __dealloc__(self): + _helper_input_void_ptr_free(&self._helper) + + @property + def cptr(self): + return self._cptr + + +cdef void * _helper_input_void_ptr(ptr, _HelperInputVoidPtrStruct *helper): + helper[0]._pybuffer.buf = NULL + try: + return ptr + except: + if ptr is None: + return NULL + elif PyObject_CheckBuffer(ptr): + # Easy run, get address from Python Buffer Protocol + err_buffer = PyObject_GetBuffer(ptr, &helper[0]._pybuffer, PyBUF_SIMPLE | PyBUF_ANY_CONTIGUOUS) + if err_buffer == -1: + raise RuntimeError("Failed to retrieve buffer through Buffer Protocol") + return (helper[0]._pybuffer.buf) + else: + raise TypeError("Provided argument is of type {} but expected Type {}, {} or object with Buffer Protocol".format(type(ptr), type(None), type(int))) + + + + +cdef class _HelperCUmemPool_attribute: + def __cinit__(self, attr, init_value, is_getter=False): + self._is_getter = is_getter + self._attr = attr.value + if self._attr in (cydriver.CUmemPool_attribute_enum.CU_MEMPOOL_ATTR_REUSE_FOLLOW_EVENT_DEPENDENCIES, + cydriver.CUmemPool_attribute_enum.CU_MEMPOOL_ATTR_REUSE_ALLOW_OPPORTUNISTIC, + cydriver.CUmemPool_attribute_enum.CU_MEMPOOL_ATTR_REUSE_ALLOW_INTERNAL_DEPENDENCIES,): + self._int_val = init_value + self._cptr = &self._int_val + elif self._attr in (cydriver.CUmemPool_attribute_enum.CU_MEMPOOL_ATTR_RELEASE_THRESHOLD, + cydriver.CUmemPool_attribute_enum.CU_MEMPOOL_ATTR_RESERVED_MEM_CURRENT, + cydriver.CUmemPool_attribute_enum.CU_MEMPOOL_ATTR_RESERVED_MEM_HIGH, + cydriver.CUmemPool_attribute_enum.CU_MEMPOOL_ATTR_USED_MEM_CURRENT, + cydriver.CUmemPool_attribute_enum.CU_MEMPOOL_ATTR_USED_MEM_HIGH,): + if self._is_getter: + self._cuuint64_t_val = _driver["cuuint64_t"]() + self._cptr = self._cuuint64_t_val.getPtr() + else: + self._cptr = init_value.getPtr() + else: + raise TypeError('Unsupported attribute: {}'.format(attr.name)) + + def __dealloc__(self): + pass + + @property + def cptr(self): + return self._cptr + + def pyObj(self): + assert(self._is_getter == True) + if self._attr in (cydriver.CUmemPool_attribute_enum.CU_MEMPOOL_ATTR_REUSE_FOLLOW_EVENT_DEPENDENCIES, + cydriver.CUmemPool_attribute_enum.CU_MEMPOOL_ATTR_REUSE_ALLOW_OPPORTUNISTIC, + cydriver.CUmemPool_attribute_enum.CU_MEMPOOL_ATTR_REUSE_ALLOW_INTERNAL_DEPENDENCIES,): + return self._int_val + elif self._attr in (cydriver.CUmemPool_attribute_enum.CU_MEMPOOL_ATTR_RELEASE_THRESHOLD, + cydriver.CUmemPool_attribute_enum.CU_MEMPOOL_ATTR_RESERVED_MEM_CURRENT, + cydriver.CUmemPool_attribute_enum.CU_MEMPOOL_ATTR_RESERVED_MEM_HIGH, + cydriver.CUmemPool_attribute_enum.CU_MEMPOOL_ATTR_USED_MEM_CURRENT, + cydriver.CUmemPool_attribute_enum.CU_MEMPOOL_ATTR_USED_MEM_HIGH,): + return self._cuuint64_t_val + else: + raise TypeError('Unsupported attribute value: {}'.format(self._attr)) + + + +cdef class _HelperCUmem_range_attribute: + def __cinit__(self, attr, data_size): + self._data_size = data_size + self._attr = attr.value + if self._attr in (cydriver.CUmem_range_attribute_enum.CU_MEM_RANGE_ATTRIBUTE_READ_MOSTLY, + cydriver.CUmem_range_attribute_enum.CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION, + cydriver.CUmem_range_attribute_enum.CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION,): + self._cptr = &self._int_val + elif self._attr in (cydriver.CUmem_range_attribute_enum.CU_MEM_RANGE_ATTRIBUTE_ACCESSED_BY,): + self._cptr = _callocWrapper(1, self._data_size) + self._int_val_list = self._cptr + else: + raise TypeError('Unsupported attribute: {}'.format(attr.name)) + + def __dealloc__(self): + if self._attr in (cydriver.CUmem_range_attribute_enum.CU_MEM_RANGE_ATTRIBUTE_ACCESSED_BY,): + free(self._cptr) + + @property + def cptr(self): + return self._cptr + + def pyObj(self): + if self._attr in (cydriver.CUmem_range_attribute_enum.CU_MEM_RANGE_ATTRIBUTE_READ_MOSTLY, + cydriver.CUmem_range_attribute_enum.CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION, + cydriver.CUmem_range_attribute_enum.CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION,): + return self._int_val + elif self._attr in (cydriver.CUmem_range_attribute_enum.CU_MEM_RANGE_ATTRIBUTE_ACCESSED_BY,): + return [self._int_val_list[idx] for idx in range(int(self._data_size/4))] + else: + raise TypeError('Unsupported attribute value: {}'.format(self._attr)) + + + +cdef class _HelperCUpointer_attribute: + def __cinit__(self, attr, init_value, is_getter=False): + self._is_getter = is_getter + self._attr = attr.value + if self._attr in (cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_CONTEXT,): + if self._is_getter: + self._ctx = _driver["CUcontext"]() + self._cptr = self._ctx.getPtr() + else: + self._cptr = init_value.getPtr() + elif self._attr in (cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_MEMORY_TYPE, + cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_ALLOWED_HANDLE_TYPES, + cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_IS_GPU_DIRECT_RDMA_CAPABLE, + cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_ACCESS_FLAGS,): + self._uint = init_value + self._cptr = &self._uint + elif self._attr in (cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_DEVICE_ORDINAL,): + self._int = init_value + self._cptr = &self._int + elif self._attr in (cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_DEVICE_POINTER, + cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_RANGE_START_ADDR,): + if self._is_getter: + self._devptr = _driver["CUdeviceptr"]() + self._cptr = self._devptr.getPtr() + else: + self._cptr = init_value.getPtr() + elif self._attr in (cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_HOST_POINTER,): + self._void = init_value + self._cptr = &self._void + elif self._attr in (cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_P2P_TOKENS,): + if self._is_getter: + self._token = _driver["CUDA_POINTER_ATTRIBUTE_P2P_TOKENS"]() + self._cptr = self._token.getPtr() + else: + self._cptr = init_value.getPtr() + elif self._attr in (cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_SYNC_MEMOPS, + cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_IS_MANAGED, + cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_IS_LEGACY_CUDA_IPC_CAPABLE, + cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_MAPPED,): + self._bool = init_value + self._cptr = &self._bool + elif self._attr in (cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_BUFFER_ID,): + self._ull = init_value + self._cptr = &self._ull + elif self._attr in (cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_RANGE_SIZE,): + self._size = init_value + self._cptr = &self._size + elif self._attr in (cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_MEMPOOL_HANDLE,): + if self._is_getter: + self._mempool = _driver["CUmemoryPool"]() + self._cptr = self._mempool.getPtr() + else: + self._cptr = init_value.getPtr() + else: + raise TypeError('Unsupported attribute: {}'.format(attr.name)) + + def __dealloc__(self): + pass + + @property + def cptr(self): + return self._cptr + + def pyObj(self): + assert(self._is_getter == True) + if self._attr in (cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_CONTEXT,): + return self._ctx + elif self._attr in (cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_MEMORY_TYPE, + cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_DEVICE_ORDINAL, + cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_ALLOWED_HANDLE_TYPES, + cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_IS_GPU_DIRECT_RDMA_CAPABLE, + cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_ACCESS_FLAGS,): + return self._uint + elif self._attr in (cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_DEVICE_POINTER, + cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_RANGE_START_ADDR,): + return self._devptr + elif self._attr in (cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_HOST_POINTER,): + return self._void + elif self._attr in (cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_P2P_TOKENS,): + return self._token + elif self._attr in (cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_SYNC_MEMOPS, + cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_IS_MANAGED, + cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_IS_LEGACY_CUDA_IPC_CAPABLE, + cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_MAPPED,): + return self._bool + elif self._attr in (cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_BUFFER_ID,): + return self._ull + elif self._attr in (cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_RANGE_SIZE,): + return self._size + elif self._attr in (cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_MEMPOOL_HANDLE,): + return self._mempool + else: + raise TypeError('Unsupported attribute value: {}'.format(self._attr)) + + + +cdef class _HelperCUgraphMem_attribute: + def __cinit__(self, attr, init_value, is_getter=False): + self._is_getter = is_getter + self._attr = attr.value + if self._attr in (cydriver.CUgraphMem_attribute_enum.CU_GRAPH_MEM_ATTR_USED_MEM_CURRENT, + cydriver.CUgraphMem_attribute_enum.CU_GRAPH_MEM_ATTR_USED_MEM_HIGH, + cydriver.CUgraphMem_attribute_enum.CU_GRAPH_MEM_ATTR_RESERVED_MEM_CURRENT, + cydriver.CUgraphMem_attribute_enum.CU_GRAPH_MEM_ATTR_RESERVED_MEM_HIGH,): + if self._is_getter: + self._cuuint64_t_val = _driver["cuuint64_t"]() + self._cptr = self._cuuint64_t_val.getPtr() + else: + self._cptr = init_value.getPtr() + else: + raise TypeError('Unsupported attribute: {}'.format(attr.name)) + + def __dealloc__(self): + pass + + @property + def cptr(self): + return self._cptr + + def pyObj(self): + assert(self._is_getter == True) + if self._attr in (cydriver.CUgraphMem_attribute_enum.CU_GRAPH_MEM_ATTR_USED_MEM_CURRENT, + cydriver.CUgraphMem_attribute_enum.CU_GRAPH_MEM_ATTR_USED_MEM_HIGH, + cydriver.CUgraphMem_attribute_enum.CU_GRAPH_MEM_ATTR_RESERVED_MEM_CURRENT, + cydriver.CUgraphMem_attribute_enum.CU_GRAPH_MEM_ATTR_RESERVED_MEM_HIGH,): + return self._cuuint64_t_val + else: + raise TypeError('Unsupported attribute value: {}'.format(self._attr)) + + + +cdef class _HelperCUjit_option: + def __cinit__(self, attr, init_value): + self._attr = attr.value + if self._attr in (cydriver.CUjit_option_enum.CU_JIT_MAX_REGISTERS, + cydriver.CUjit_option_enum.CU_JIT_THREADS_PER_BLOCK, + cydriver.CUjit_option_enum.CU_JIT_INFO_LOG_BUFFER_SIZE_BYTES, + cydriver.CUjit_option_enum.CU_JIT_ERROR_LOG_BUFFER_SIZE_BYTES, + cydriver.CUjit_option_enum.CU_JIT_OPTIMIZATION_LEVEL, + cydriver.CUjit_option_enum.CU_JIT_GLOBAL_SYMBOL_COUNT, + cydriver.CUjit_option_enum.CU_JIT_TARGET_FROM_CUCONTEXT, + cydriver.CUjit_option_enum.CU_JIT_REFERENCED_KERNEL_COUNT, + cydriver.CUjit_option_enum.CU_JIT_REFERENCED_VARIABLE_COUNT, + cydriver.CUjit_option_enum.CU_JIT_MIN_CTA_PER_SM, + cydriver.CUjit_option_enum.CU_JIT_SPLIT_COMPILE,): + self._uint = init_value + self._cptr = self._uint + elif self._attr in (cydriver.CUjit_option_enum.CU_JIT_WALL_TIME,): + self._float = init_value + self._cptr = self._float + elif self._attr in (cydriver.CUjit_option_enum.CU_JIT_INFO_LOG_BUFFER, + cydriver.CUjit_option_enum.CU_JIT_ERROR_LOG_BUFFER): + self._charstar = init_value + self._cptr = self._charstar + elif self._attr in (cydriver.CUjit_option_enum.CU_JIT_TARGET,): + self._target = init_value.value + self._cptr = self._target + elif self._attr in (cydriver.CUjit_option_enum.CU_JIT_FALLBACK_STRATEGY,): + self._fallback = init_value.value + self._cptr = self._fallback + elif self._attr in (cydriver.CUjit_option_enum.CU_JIT_GENERATE_DEBUG_INFO, + cydriver.CUjit_option_enum.CU_JIT_LOG_VERBOSE, + cydriver.CUjit_option_enum.CU_JIT_GENERATE_LINE_INFO, + cydriver.CUjit_option_enum.CU_JIT_LTO, + cydriver.CUjit_option_enum.CU_JIT_FTZ, + cydriver.CUjit_option_enum.CU_JIT_PREC_DIV, + cydriver.CUjit_option_enum.CU_JIT_PREC_SQRT, + cydriver.CUjit_option_enum.CU_JIT_FMA, + cydriver.CUjit_option_enum.CU_JIT_OPTIMIZE_UNUSED_DEVICE_VARIABLES,): + self._int = init_value + self._cptr = self._int + elif self._attr in (cydriver.CUjit_option_enum.CU_JIT_CACHE_MODE,): + self._cacheMode = init_value.value + self._cptr = self._cacheMode + elif self._attr in (cydriver.CUjit_option_enum.CU_JIT_GLOBAL_SYMBOL_NAMES, + cydriver.CUjit_option_enum.CU_JIT_REFERENCED_KERNEL_NAMES, + cydriver.CUjit_option_enum.CU_JIT_REFERENCED_VARIABLE_NAMES,): + self._charstarstar = init_value + self._cptr = &self._charstarstar[0] + elif self._attr in (cydriver.CUjit_option_enum.CU_JIT_GLOBAL_SYMBOL_ADDRESSES,): + pylist = [_HelperInputVoidPtr(val) for val in init_value] + self._voidstarstar = _InputVoidPtrPtrHelper(pylist) + self._cptr = self._voidstarstar.cptr + else: + raise TypeError('Unsupported attribute: {}'.format(attr.name)) + + def __dealloc__(self): + pass + + @property + def cptr(self): + return self._cptr + + + + +cdef class _HelperCudaJitOption: + def __cinit__(self, attr, init_value): + self._attr = attr.value + if self._attr in (cyruntime.cudaJitOption.cudaJitMaxRegisters, + cyruntime.cudaJitOption.cudaJitThreadsPerBlock, + cyruntime.cudaJitOption.cudaJitInfoLogBufferSizeBytes, + cyruntime.cudaJitOption.cudaJitErrorLogBufferSizeBytes, + cyruntime.cudaJitOption.cudaJitOptimizationLevel, + cyruntime.cudaJitOption.cudaJitMinCtaPerSm,): + self._uint = init_value + self._cptr = self._uint + elif self._attr in (cyruntime.cudaJitOption.cudaJitWallTime,): + self._float = init_value + self._cptr = self._float + elif self._attr in (cyruntime.cudaJitOption.cudaJitInfoLogBuffer, + cyruntime.cudaJitOption.cudaJitErrorLogBuffer): + self._charstar = init_value + self._cptr = self._charstar + elif self._attr in (cyruntime.cudaJitOption.cudaJitFallbackStrategy,): + self._fallback = init_value.value + self._cptr = self._fallback + elif self._attr in (cyruntime.cudaJitOption.cudaJitGenerateDebugInfo, + cyruntime.cudaJitOption.cudaJitLogVerbose, + cyruntime.cudaJitOption.cudaJitGenerateLineInfo, + cyruntime.cudaJitOption.cudaJitPositionIndependentCode, + cyruntime.cudaJitOption.cudaJitMaxThreadsPerBlock, + cyruntime.cudaJitOption.cudaJitOverrideDirectiveValues,): + self._int = init_value + self._cptr = self._int + elif self._attr in (cyruntime.cudaJitOption.cudaJitCacheMode,): + self._cacheMode = init_value.value + self._cptr = self._cacheMode + else: + raise TypeError('Unsupported attribute: {}'.format(attr.name)) + + def __dealloc__(self): + pass + + @property + def cptr(self): + return self._cptr + + + + +cdef class _HelperCUlibraryOption: + def __cinit__(self, attr, init_value): + self._attr = attr.value + if False: + pass + + elif self._attr in (cydriver.CUlibraryOption_enum.CU_LIBRARY_HOST_UNIVERSAL_FUNCTION_AND_DATA_TABLE,): + self._cptr = init_value.getPtr() + + + elif self._attr in (cydriver.CUlibraryOption_enum.CU_LIBRARY_BINARY_IS_PRESERVED,): + self._uint = init_value + self._cptr = self._uint + + else: + raise TypeError('Unsupported attribute: {}'.format(attr.name)) + + def __dealloc__(self): + pass + + @property + def cptr(self): + return self._cptr + + + + +cdef class _HelperCudaLibraryOption: + def __cinit__(self, attr, init_value): + self._attr = attr.value + if False: + pass + + elif self._attr in (cyruntime.cudaLibraryOption.cudaLibraryHostUniversalFunctionAndDataTable,): + self._cptr = init_value.getPtr() + + + elif self._attr in (cyruntime.cudaLibraryOption.cudaLibraryBinaryIsPreserved,): + self._uint = init_value + self._cptr = self._uint + + else: + raise TypeError('Unsupported attribute: {}'.format(attr.name)) + + def __dealloc__(self): + pass + + @property + def cptr(self): + return self._cptr + + + + +cdef class _HelperCUmemAllocationHandleType: + def __cinit__(self, attr): + self._type = attr.value + if False: + pass + + elif self._type in (cydriver.CUmemAllocationHandleType_enum.CU_MEM_HANDLE_TYPE_NONE,): + self._cptr = &self._int + + + elif self._type in (cydriver.CUmemAllocationHandleType_enum.CU_MEM_HANDLE_TYPE_POSIX_FILE_DESCRIPTOR,): + self._cptr = &self._int + + + elif self._type in (cydriver.CUmemAllocationHandleType_enum.CU_MEM_HANDLE_TYPE_WIN32,): + self._cptr = &self._handle + + + elif self._type in (cydriver.CUmemAllocationHandleType_enum.CU_MEM_HANDLE_TYPE_WIN32_KMT,): + self._cptr = &self._d3dkmt_handle + + + elif self._type in (cydriver.CUmemAllocationHandleType_enum.CU_MEM_HANDLE_TYPE_FABRIC,): + self._mem_fabric_handle = _driver["CUmemFabricHandle"]() + self._cptr = self._mem_fabric_handle.getPtr() + + else: + raise TypeError('Unsupported attribute: {}'.format(attr.name)) + + def __dealloc__(self): + pass + + @property + def cptr(self): + return self._cptr + + def pyObj(self): + if False: + pass + + elif self._type in (cydriver.CUmemAllocationHandleType_enum.CU_MEM_HANDLE_TYPE_NONE,): + return self._int + + + elif self._type in (cydriver.CUmemAllocationHandleType_enum.CU_MEM_HANDLE_TYPE_POSIX_FILE_DESCRIPTOR,): + return self._int + + + elif self._type in (cydriver.CUmemAllocationHandleType_enum.CU_MEM_HANDLE_TYPE_WIN32,): + return self._handle + + + elif self._type in (cydriver.CUmemAllocationHandleType_enum.CU_MEM_HANDLE_TYPE_WIN32_KMT,): + return self._d3dkmt_handle + + + elif self._type in (cydriver.CUmemAllocationHandleType_enum.CU_MEM_HANDLE_TYPE_FABRIC,): + return self._mem_fabric_handle + + else: + raise TypeError('Unsupported attribute: {}'.format(self._type)) + + + +cdef class _HelperCUlogicalEndpointIpcHandleType: + def __cinit__(self, attr): + self._type = attr.value + if False: + pass + + elif self._type in (cydriver.CUlogicalEndpointIpcHandleType_enum.CU_LOGICAL_ENDPOINT_IPC_HANDLE_TYPE_NONE,): + self._cptr = &self._int + + + elif self._type in (cydriver.CUlogicalEndpointIpcHandleType_enum.CU_LOGICAL_ENDPOINT_IPC_HANDLE_TYPE_FABRIC,): + self._fabric_handle = _driver["CUlogicalEndpointFabricHandle"]() + self._cptr = self._fabric_handle.getPtr() + + else: + raise TypeError('Unsupported attribute: {}'.format(attr.name)) + + def __dealloc__(self): + pass + + @property + def cptr(self): + return self._cptr + + def pyObj(self): + if False: + pass + + elif self._type in (cydriver.CUlogicalEndpointIpcHandleType_enum.CU_LOGICAL_ENDPOINT_IPC_HANDLE_TYPE_NONE,): + return self._int + + + elif self._type in (cydriver.CUlogicalEndpointIpcHandleType_enum.CU_LOGICAL_ENDPOINT_IPC_HANDLE_TYPE_FABRIC,): + return self._fabric_handle + + else: + raise TypeError('Unsupported attribute: {}'.format(self._type)) + + +cdef class _InputVoidPtrPtrHelper: + def __cinit__(self, lst): + # Hold onto references to the original buffers so they + # won't be free'd behind our back + self._references = lst + self._cptr = _callocWrapper(len(lst), sizeof(void*)) + for idx in range(len(lst)): + self._cptr[idx] = lst[idx].cptr + + def __dealloc__(self): + free(self._cptr) + + @property + def cptr(self): + return self._cptr + + + +cdef class _HelperCUcoredumpSettings: + def __cinit__(self, attr, init_value, is_getter=False): + self._is_getter = is_getter + self._attrib = attr.value + if self._attrib in (cydriver.CUcoredumpSettings_enum.CU_COREDUMP_FILE, + cydriver.CUcoredumpSettings_enum.CU_COREDUMP_PIPE,): + if self._is_getter: + self._charstar = _callocWrapper(1024, 1) + self._cptr = self._charstar + self._size = 1024 + else: + self._charstar = init_value + self._cptr = self._charstar + self._size = len(init_value) + elif self._attrib in (cydriver.CUcoredumpSettings_enum.CU_COREDUMP_ENABLE_ON_EXCEPTION, + cydriver.CUcoredumpSettings_enum.CU_COREDUMP_TRIGGER_HOST, + cydriver.CUcoredumpSettings_enum.CU_COREDUMP_LIGHTWEIGHT, + cydriver.CUcoredumpSettings_enum.CU_COREDUMP_ENABLE_USER_TRIGGER,): + if self._is_getter == False: + self._bool = init_value + + self._cptr = &self._bool + self._size = 1 + else: + raise TypeError('Unsupported attribute: {}'.format(attr.name)) + + def __dealloc__(self): + pass + + @property + def cptr(self): + return self._cptr + + def size(self): + return self._size + + def pyObj(self): + assert(self._is_getter == True) + if self._attrib in (cydriver.CUcoredumpSettings_enum.CU_COREDUMP_FILE, + cydriver.CUcoredumpSettings_enum.CU_COREDUMP_PIPE,): + return self._charstar + elif self._attrib in (cydriver.CUcoredumpSettings_enum.CU_COREDUMP_ENABLE_ON_EXCEPTION, + cydriver.CUcoredumpSettings_enum.CU_COREDUMP_TRIGGER_HOST, + cydriver.CUcoredumpSettings_enum.CU_COREDUMP_LIGHTWEIGHT, + cydriver.CUcoredumpSettings_enum.CU_COREDUMP_ENABLE_USER_TRIGGER,): + return self._bool + else: + raise TypeError('Unsupported attribute value: {}'.format(self._attrib)) diff --git a/cuda_bindings/cuda/bindings/_lib/windll.pxd b/cuda_bindings/cuda/bindings/_lib/windll.pxd new file mode 100644 index 00000000000..294a1a9fd90 --- /dev/null +++ b/cuda_bindings/cuda/bindings/_lib/windll.pxd @@ -0,0 +1,45 @@ +# SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +from libc.stddef cimport wchar_t +from libc.stdint cimport uintptr_t +from cpython cimport PyUnicode_AsWideCharString, PyMem_Free + +cdef extern from "windows.h" nogil: + ctypedef void* HMODULE + ctypedef void* HANDLE + ctypedef void* FARPROC + ctypedef unsigned long DWORD + ctypedef const wchar_t *LPCWSTR + ctypedef const char *LPCSTR + ctypedef int BOOL + + cdef DWORD LOAD_LIBRARY_SEARCH_SYSTEM32 = 0x00000800 + + HMODULE _LoadLibraryExW "LoadLibraryExW"( + LPCWSTR lpLibFileName, + HANDLE hFile, + DWORD dwFlags + ) + + FARPROC _GetProcAddress "GetProcAddress"(HMODULE hModule, LPCSTR lpProcName) + + BOOL _FreeLibrary "FreeLibrary"(HMODULE hLibModule) + +cdef inline uintptr_t LoadLibraryExW(str path, HANDLE hFile, DWORD dwFlags): + cdef uintptr_t result + cdef wchar_t* wpath = PyUnicode_AsWideCharString(path, NULL) + with nogil: + result = _LoadLibraryExW( + wpath, + hFile, + dwFlags + ) + PyMem_Free(wpath) + return result + +cdef inline FARPROC GetProcAddress(uintptr_t hModule, const char* lpProcName) nogil: + return _GetProcAddress(hModule, lpProcName) + +cdef inline BOOL FreeLibrary(uintptr_t hLibModule) nogil: + return _FreeLibrary(hLibModule) diff --git a/cuda_bindings/cuda/bindings/_test_helpers/__init__.py b/cuda_bindings/cuda/bindings/_test_helpers/__init__.py new file mode 100644 index 00000000000..2cfab242d2a --- /dev/null +++ b/cuda_bindings/cuda/bindings/_test_helpers/__init__.py @@ -0,0 +1,6 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + + +# This package contains test helper utilities that may also be useful for other libraries outside of `cuda.bindings`, +# such as `cuda.core`. These utilities are not part of the public API of `cuda.bindings` and may change without notice. diff --git a/cuda_bindings/cuda/bindings/_test_helpers/arch_check.py b/cuda_bindings/cuda/bindings/_test_helpers/arch_check.py new file mode 100644 index 00000000000..3ab48be6e02 --- /dev/null +++ b/cuda_bindings/cuda/bindings/_test_helpers/arch_check.py @@ -0,0 +1,70 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + + +from contextlib import contextmanager +from functools import cache + +import pytest + +from cuda.bindings import nvml +from cuda.bindings._internal.utils import FunctionNotFoundError as NvmlSymbolNotFoundError + + +@cache +def hardware_supports_nvml(): + """ + Tries to call the simplest NVML API possible to see if just the basics + works. If not we are probably on one of the platforms where NVML is not + supported at all (e.g. Jetson Orin). + """ + nvml.init_v2() + try: + nvml.system_get_driver_branch() + except (nvml.NotSupportedError, nvml.UnknownError): + return False + else: + return True + finally: + nvml.shutdown() + + +@contextmanager +def unsupported_before(device: int, expected_device_arch: nvml.DeviceArch | str | None): + device_arch = nvml.device_get_architecture(device) + + if isinstance(expected_device_arch, nvml.DeviceArch): + expected_device_arch_int = int(expected_device_arch) + elif expected_device_arch == "FERMI": + expected_device_arch_int = 1 + else: + expected_device_arch_int = 0 + + if expected_device_arch is None or expected_device_arch == "HAS_INFOROM" or device_arch == nvml.DeviceArch.UNKNOWN: + # In this case, we don't /know/ if it will fail, but we are ok if it + # does or does not. + + # TODO: There are APIs that are documented as supported only if the + # device has an InfoROM, but I couldn't find a way to detect that. For + # now, they are just handled as "possibly failing". + + try: + yield + except (nvml.NotSupportedError, nvml.FunctionNotFoundError, NvmlSymbolNotFoundError): + # The API call raised NotSupportedError, NVML status FunctionNotFoundError, + # or NvmlSymbolNotFoundError (symbol absent from the loaded NVML DLL), so we + # skip the test but don't fail it + pytest.skip( + f"Unsupported call for device architecture {nvml.DeviceArch(device_arch).name} " + f"on device '{nvml.device_get_name(device)}'" + ) + # If the API call worked, just continue + elif int(device_arch) < expected_device_arch_int: + # In this case, we /know/ if will fail, and we want to assert that it does. + with pytest.raises(nvml.NotSupportedError): + yield + # The above call was unsupported, so the rest of the test is skipped + pytest.skip(f"Unsupported before {expected_device_arch.name}, got {nvml.device_get_name(device)}") + else: + # In this case, we /know/ it should work, and if it fails, the test should fail. + yield diff --git a/cuda_bindings/cuda/bindings/_test_helpers/mempool.py b/cuda_bindings/cuda/bindings/_test_helpers/mempool.py new file mode 100644 index 00000000000..e2a61e48c53 --- /dev/null +++ b/cuda_bindings/cuda/bindings/_test_helpers/mempool.py @@ -0,0 +1,57 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +import sys + +import pytest + +from cuda.bindings import driver, runtime + + +# Keep in sync with the fallback in cuda_core/tests/conftest.py. The cuda_core +# copy is intentionally simpler because it only handles cuda_core CUDAError +# exceptions when this helper is absent from older published bindings. +def is_windows_mcdm_device(device=0): + if sys.platform != "win32": + return False + import cuda.bindings.nvml as nvml + + device_id = int(getattr(device, "device_id", device)) + (err,) = driver.cuInit(0) + if err != driver.CUresult.CUDA_SUCCESS: + return False + err, pci_bus_id = driver.cuDeviceGetPCIBusId(13, device_id) + if err != driver.CUresult.CUDA_SUCCESS: + return False + pci_bus_id = pci_bus_id.split(b"\x00", 1)[0].decode("ascii") + nvml.init_v2() + try: + handle = nvml.device_get_handle_by_pci_bus_id_v2(pci_bus_id) + current, _ = nvml.device_get_driver_model_v2(handle) + return current == nvml.DriverModel.DRIVER_MCDM + finally: + nvml.shutdown() + + +def xfail_if_mempool_oom(err_or_exc, api_name=None, device=0): + if api_name is not None and not isinstance(api_name, str): + device = api_name + api_name = None + + is_oom = err_or_exc in ( + driver.CUresult.CUDA_ERROR_OUT_OF_MEMORY, + runtime.cudaError_t.cudaErrorMemoryAllocation, + ) or "CUDA_ERROR_OUT_OF_MEMORY" in str(err_or_exc) + + if not is_oom: + return + try: + is_windows_mcdm = is_windows_mcdm_device(device) + except Exception: + # If MCDM detection fails, leave the primary test failure visible. + return + if not is_windows_mcdm: + return + + api_context = f"{api_name} " if api_name else "" + pytest.xfail(f"{api_context}could not reserve VA for mempool operations on Windows MCDM") diff --git a/cuda_bindings/cuda/bindings/_test_helpers/pep723.py b/cuda_bindings/cuda/bindings/_test_helpers/pep723.py new file mode 100644 index 00000000000..5ae21e622d3 --- /dev/null +++ b/cuda_bindings/cuda/bindings/_test_helpers/pep723.py @@ -0,0 +1,46 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + + +import importlib.metadata +import os +import re + +import pytest + + +def has_package_requirements_or_skip(example): + example_name = os.path.basename(example) + + with open(example, encoding="utf-8") as f: + content = f.read() + + # The canonical regex as defined in PEP 723 + pep723 = re.search(r"(?m)^# /// (?P[a-zA-Z0-9-]+)$\s(?P(^#(| .*)$\s)+)^# ///$", content) + if not pep723: + raise ValueError(f"PEP 723 metadata not found in {example_name}") + + metadata = {} + for line in pep723.group("content").splitlines(): + line = line.lstrip("# ").rstrip() + if not line: + continue + key, value = line.split("=", 1) + key = key.strip() + value = value.strip() + metadata[key] = value + + if "dependencies" not in metadata: + raise ValueError(f"PEP 723 dependencies not found in {example_name}") + + missing_dependencies = [] + dependencies = eval(metadata["dependencies"]) # noqa: S307 + for dependency in dependencies: + name = re.match("[a-zA-Z0-9_-]+", dependency) + try: + importlib.metadata.distribution(name.group(0)) + except importlib.metadata.PackageNotFoundError: + missing_dependencies.append(name.string) + + if missing_dependencies: + pytest.skip(f"Skipping {example} due to missing package requirement: {', '.join(missing_dependencies)}") diff --git a/cuda_bindings/cuda/bindings/cudla.pxd b/cuda_bindings/cuda/bindings/cudla.pxd new file mode 100644 index 00000000000..cb58d685a24 --- /dev/null +++ b/cuda_bindings/cuda/bindings/cudla.pxd @@ -0,0 +1,53 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +# This code was automatically generated across versions from 1.5.0 to 13.3.0. Do not modify it directly. + +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=e64a78a1b3e010d167373d7c9635ff4637dfd1a6a38ffafb671dcde4e12aaaad +from libc.stdint cimport intptr_t + +from .cycudla cimport * + + + + +############################################################################### +# Types +############################################################################### + +ctypedef cudlaDevHandle DevHandle +ctypedef cudlaModule Module + + +############################################################################### +# Enum +############################################################################### + +ctypedef cudlaStatus _Status +ctypedef cudlaMode _Mode +ctypedef cudlaModuleAttributeType _ModuleAttributeType +ctypedef cudlaFenceType _FenceType +ctypedef cudlaModuleLoadFlags _ModuleLoadFlags +ctypedef cudlaSubmissionFlags _SubmissionFlags +ctypedef cudlaAccessPermissionFlags _AccessPermissionFlags +ctypedef cudlaDevAttributeType _DevAttributeType + + +############################################################################### +# Functions +############################################################################### + +cpdef uint64_t get_version() except? -1 +cpdef uint64_t device_get_count() except? -1 +cpdef intptr_t create_device(uint64_t device, uint32_t flags) except * +cpdef intptr_t mem_register(intptr_t dev_handle, intptr_t ptr, size_t size, uint32_t flags) except * +cpdef intptr_t module_load_from_memory(intptr_t dev_handle, p_module, size_t module_size, uint32_t flags) except * +cpdef module_unload(intptr_t h_module, uint32_t flags) +cpdef submit_task(intptr_t dev_handle, intptr_t ptr_to_tasks, uint32_t num_tasks, intptr_t stream, uint32_t flags) +cpdef object device_get_attribute(intptr_t dev_handle, int attrib) except * +cpdef mem_unregister(intptr_t dev_handle, intptr_t dev_ptr) +cpdef int get_last_error(intptr_t dev_handle) except? 0 +cpdef destroy_device(intptr_t dev_handle) +cpdef set_task_timeout_in_ms(intptr_t dev_handle, uint32_t timeout) + +cpdef module_get_attributes(intptr_t h_module, int attr_type) except * diff --git a/cuda_bindings/cuda/bindings/cudla.pyx b/cuda_bindings/cuda/bindings/cudla.pyx new file mode 100644 index 00000000000..175a6ba0d22 --- /dev/null +++ b/cuda_bindings/cuda/bindings/cudla.pyx @@ -0,0 +1,1843 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +# This code was automatically generated across versions from 1.5.0 to 13.3.0. Do not modify it directly. +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=3ee237ed16e651bae93e2bc6d4d63dcf99b309ad7a74cb3e2bd5b9e540e714f4 + + +# <<<< PREAMBLE CONTENT >>>> + +cimport cpython as _cyb_cpython +cimport cpython.buffer as _cyb_cpython_buffer +from cython cimport view as _cyb_view +from libc.stdlib cimport ( + calloc as _cyb_calloc, + free as _cyb_free, + malloc as _cyb_malloc, +) +from libc.string cimport ( + memcmp as _cyb_memcmp, + memcpy as _cyb_memcpy, +) + +from enum import IntEnum as _cyb_IntEnum + +import numpy as _numpy + +cdef _cyb___getbuffer(object self, _cyb_cpython.Py_buffer *buffer, void *ptr, int size, bint readonly): + buffer.buf = ptr + buffer.format = 'b' + buffer.internal = NULL + buffer.itemsize = 1 + buffer.len = size + buffer.ndim = 1 + buffer.obj = self + buffer.readonly = readonly + buffer.shape = &buffer.len + buffer.strides = &buffer.itemsize + buffer.suboffsets = NULL + +cdef _cyb_from_buffer(buffer, size, lowpp_type): + cdef _cyb_cpython.Py_buffer view + if _cyb_cpython.PyObject_GetBuffer(buffer, &view, _cyb_cpython_buffer.PyBUF_SIMPLE) != 0: + raise TypeError("buffer argument does not support the buffer protocol") + try: + if view.itemsize != 1: + raise ValueError("buffer itemsize must be 1 byte") + if view.len != size: + raise ValueError(f"buffer length must be {size} bytes") + return lowpp_type.from_ptr(view.buf, not view.readonly, buffer) + finally: + _cyb_cpython.PyBuffer_Release(&view) + +cdef _cyb_from_data(data, dtype_name, expected_dtype, lowpp_type): + # _numpy.recarray is a subclass of _numpy.ndarray, so implicitly handled here. + if isinstance(data, lowpp_type): + return data + if not isinstance(data, _numpy.ndarray): + raise TypeError("data argument must be a NumPy ndarray") + if data.size != 1: + raise ValueError("data array must have a size of 1") + if data.dtype != expected_dtype: + raise ValueError(f"data array must be of dtype {dtype_name}") + return lowpp_type.from_ptr(data.ctypes.data, not data.flags.writeable, data) + + +# <<<< END OF PREAMBLE CONTENT >>>> + +cimport cython # NOQA +from libc.stdint cimport intptr_t, uintptr_t +from libc.stdlib cimport malloc, free + +from ._internal.utils cimport get_buffer_pointer + + + + +############################################################################### +# POD +############################################################################### + +cdef _get_external_memory_handle_desc_dtype_offsets(): + cdef cudlaExternalMemoryHandleDesc_t pod + return _numpy.dtype({ + 'names': ['ext_buf_object', 'size_'], + 'formats': [_numpy.intp, _numpy.uint64], + 'offsets': [ + (&(pod.extBufObject)) - (&pod), + (&(pod.size)) - (&pod), + ], + 'itemsize': sizeof(cudlaExternalMemoryHandleDesc_t), + }) + +external_memory_handle_desc_dtype = _get_external_memory_handle_desc_dtype_offsets() + +cdef class ExternalMemoryHandleDesc: + """Empty-initialize an instance of `cudlaExternalMemoryHandleDesc_t`. + + + .. seealso:: `cudlaExternalMemoryHandleDesc_t` + """ + cdef: + cudlaExternalMemoryHandleDesc_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(cudlaExternalMemoryHandleDesc_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ExternalMemoryHandleDesc") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef cudlaExternalMemoryHandleDesc_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.ExternalMemoryHandleDesc object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef ExternalMemoryHandleDesc other_ + if not isinstance(other, ExternalMemoryHandleDesc): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(cudlaExternalMemoryHandleDesc_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(cudlaExternalMemoryHandleDesc_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(cudlaExternalMemoryHandleDesc_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ExternalMemoryHandleDesc") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(cudlaExternalMemoryHandleDesc_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def ext_buf_object(self): + """int: """ + return (self._ptr[0].extBufObject) + + @ext_buf_object.setter + def ext_buf_object(self, val): + if self._readonly: + raise ValueError("This ExternalMemoryHandleDesc instance is read-only") + self._ptr[0].extBufObject = val + + @property + def size_(self): + """int: """ + return self._ptr[0].size + + @size_.setter + def size_(self, val): + if self._readonly: + raise ValueError("This ExternalMemoryHandleDesc instance is read-only") + self._ptr[0].size = val + + @staticmethod + def from_buffer(buffer): + """Create an ExternalMemoryHandleDesc instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(cudlaExternalMemoryHandleDesc_t), ExternalMemoryHandleDesc) + + @staticmethod + def from_data(data): + """Create an ExternalMemoryHandleDesc instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `external_memory_handle_desc_dtype` holding the data. + """ + return _cyb_from_data(data, "external_memory_handle_desc_dtype", external_memory_handle_desc_dtype, ExternalMemoryHandleDesc) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an ExternalMemoryHandleDesc instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef ExternalMemoryHandleDesc obj = ExternalMemoryHandleDesc.__new__(ExternalMemoryHandleDesc) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(cudlaExternalMemoryHandleDesc_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating ExternalMemoryHandleDesc") + _cyb_memcpy((obj._ptr), ptr, sizeof(cudlaExternalMemoryHandleDesc_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_external_semaphore_handle_desc_dtype_offsets(): + cdef cudlaExternalSemaphoreHandleDesc_t pod + return _numpy.dtype({ + 'names': ['ext_sync_object'], + 'formats': [_numpy.intp], + 'offsets': [ + (&(pod.extSyncObject)) - (&pod), + ], + 'itemsize': sizeof(cudlaExternalSemaphoreHandleDesc_t), + }) + +external_semaphore_handle_desc_dtype = _get_external_semaphore_handle_desc_dtype_offsets() + +cdef class ExternalSemaphoreHandleDesc: + """Empty-initialize an instance of `cudlaExternalSemaphoreHandleDesc_t`. + + + .. seealso:: `cudlaExternalSemaphoreHandleDesc_t` + """ + cdef: + cudlaExternalSemaphoreHandleDesc_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(cudlaExternalSemaphoreHandleDesc_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ExternalSemaphoreHandleDesc") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef cudlaExternalSemaphoreHandleDesc_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.ExternalSemaphoreHandleDesc object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef ExternalSemaphoreHandleDesc other_ + if not isinstance(other, ExternalSemaphoreHandleDesc): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(cudlaExternalSemaphoreHandleDesc_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(cudlaExternalSemaphoreHandleDesc_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(cudlaExternalSemaphoreHandleDesc_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ExternalSemaphoreHandleDesc") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(cudlaExternalSemaphoreHandleDesc_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def ext_sync_object(self): + """int: """ + return (self._ptr[0].extSyncObject) + + @ext_sync_object.setter + def ext_sync_object(self, val): + if self._readonly: + raise ValueError("This ExternalSemaphoreHandleDesc instance is read-only") + self._ptr[0].extSyncObject = val + + @staticmethod + def from_buffer(buffer): + """Create an ExternalSemaphoreHandleDesc instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(cudlaExternalSemaphoreHandleDesc_t), ExternalSemaphoreHandleDesc) + + @staticmethod + def from_data(data): + """Create an ExternalSemaphoreHandleDesc instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `external_semaphore_handle_desc_dtype` holding the data. + """ + return _cyb_from_data(data, "external_semaphore_handle_desc_dtype", external_semaphore_handle_desc_dtype, ExternalSemaphoreHandleDesc) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an ExternalSemaphoreHandleDesc instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef ExternalSemaphoreHandleDesc obj = ExternalSemaphoreHandleDesc.__new__(ExternalSemaphoreHandleDesc) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(cudlaExternalSemaphoreHandleDesc_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating ExternalSemaphoreHandleDesc") + _cyb_memcpy((obj._ptr), ptr, sizeof(cudlaExternalSemaphoreHandleDesc_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_module_tensor_descriptor_dtype_offsets(): + cdef cudlaModuleTensorDescriptor pod + return _numpy.dtype({ + 'names': ['name', 'size_', 'n', 'c', 'h', 'w', 'data_format', 'data_type', 'data_category', 'pixel_format', 'pixel_mapping', 'stride'], + 'formats': [(_numpy.int8, 81), _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint8, _numpy.uint8, _numpy.uint8, _numpy.uint8, _numpy.uint8, (_numpy.uint32, 8)], + 'offsets': [ + (&(pod.name)) - (&pod), + (&(pod.size)) - (&pod), + (&(pod.n)) - (&pod), + (&(pod.c)) - (&pod), + (&(pod.h)) - (&pod), + (&(pod.w)) - (&pod), + (&(pod.dataFormat)) - (&pod), + (&(pod.dataType)) - (&pod), + (&(pod.dataCategory)) - (&pod), + (&(pod.pixelFormat)) - (&pod), + (&(pod.pixelMapping)) - (&pod), + (&(pod.stride)) - (&pod), + ], + 'itemsize': sizeof(cudlaModuleTensorDescriptor), + }) + +module_tensor_descriptor_dtype = _get_module_tensor_descriptor_dtype_offsets() + +cdef class ModuleTensorDescriptor: + """Empty-initialize an instance of `cudlaModuleTensorDescriptor`. + + + .. seealso:: `cudlaModuleTensorDescriptor` + """ + cdef: + cudlaModuleTensorDescriptor *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(cudlaModuleTensorDescriptor)) + if self._ptr == NULL: + raise MemoryError("Error allocating ModuleTensorDescriptor") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef cudlaModuleTensorDescriptor *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.ModuleTensorDescriptor object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef ModuleTensorDescriptor other_ + if not isinstance(other, ModuleTensorDescriptor): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(cudlaModuleTensorDescriptor)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(cudlaModuleTensorDescriptor), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(cudlaModuleTensorDescriptor)) + if self._ptr == NULL: + raise MemoryError("Error allocating ModuleTensorDescriptor") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(cudlaModuleTensorDescriptor)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def name(self): + """~_numpy.int8: (array of length 81).""" + return _cyb_cpython.PyUnicode_FromString(self._ptr[0].name) + + @name.setter + def name(self, val): + if self._readonly: + raise ValueError("This ModuleTensorDescriptor instance is read-only") + cdef bytes buf = val.encode() + if len(buf) >= 81: + raise ValueError("String too long for field name, max length is 80") + cdef char *ptr = buf + _cyb_memcpy((self._ptr[0].name), ptr, 81) + + @property + def size_(self): + """int: """ + return self._ptr[0].size + + @size_.setter + def size_(self, val): + if self._readonly: + raise ValueError("This ModuleTensorDescriptor instance is read-only") + self._ptr[0].size = val + + @property + def n(self): + """int: """ + return self._ptr[0].n + + @n.setter + def n(self, val): + if self._readonly: + raise ValueError("This ModuleTensorDescriptor instance is read-only") + self._ptr[0].n = val + + @property + def c(self): + """int: """ + return self._ptr[0].c + + @c.setter + def c(self, val): + if self._readonly: + raise ValueError("This ModuleTensorDescriptor instance is read-only") + self._ptr[0].c = val + + @property + def h(self): + """int: """ + return self._ptr[0].h + + @h.setter + def h(self, val): + if self._readonly: + raise ValueError("This ModuleTensorDescriptor instance is read-only") + self._ptr[0].h = val + + @property + def w(self): + """int: """ + return self._ptr[0].w + + @w.setter + def w(self, val): + if self._readonly: + raise ValueError("This ModuleTensorDescriptor instance is read-only") + self._ptr[0].w = val + + @property + def data_format(self): + """int: """ + return self._ptr[0].dataFormat + + @data_format.setter + def data_format(self, val): + if self._readonly: + raise ValueError("This ModuleTensorDescriptor instance is read-only") + self._ptr[0].dataFormat = val + + @property + def data_type(self): + """int: """ + return self._ptr[0].dataType + + @data_type.setter + def data_type(self, val): + if self._readonly: + raise ValueError("This ModuleTensorDescriptor instance is read-only") + self._ptr[0].dataType = val + + @property + def data_category(self): + """int: """ + return self._ptr[0].dataCategory + + @data_category.setter + def data_category(self, val): + if self._readonly: + raise ValueError("This ModuleTensorDescriptor instance is read-only") + self._ptr[0].dataCategory = val + + @property + def pixel_format(self): + """int: """ + return self._ptr[0].pixelFormat + + @pixel_format.setter + def pixel_format(self, val): + if self._readonly: + raise ValueError("This ModuleTensorDescriptor instance is read-only") + self._ptr[0].pixelFormat = val + + @property + def pixel_mapping(self): + """int: """ + return self._ptr[0].pixelMapping + + @pixel_mapping.setter + def pixel_mapping(self, val): + if self._readonly: + raise ValueError("This ModuleTensorDescriptor instance is read-only") + self._ptr[0].pixelMapping = val + + @property + def stride(self): + """~_numpy.uint32: (array of length 8).""" + cdef _cyb_view.array arr = _cyb_view.array(shape=(8,), itemsize=sizeof(uint32_t), format="I", mode="c", allocate_buffer=False) + arr.data = (&(self._ptr[0].stride)) + return _numpy.asarray(arr) + + @stride.setter + def stride(self, val): + if self._readonly: + raise ValueError("This ModuleTensorDescriptor instance is read-only") + if len(val) != 8: + raise ValueError(f"Expected length { 8 } for field stride, got {len(val)}") + cdef _cyb_view.array arr = _cyb_view.array(shape=(8,), itemsize=sizeof(uint32_t), format="I", mode="c") + arr[:] = _numpy.asarray(val, dtype=_numpy.uint32) + _cyb_memcpy((&(self._ptr[0].stride)), (arr.data), sizeof(uint32_t) * len(val)) + + @staticmethod + def from_buffer(buffer): + """Create an ModuleTensorDescriptor instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(cudlaModuleTensorDescriptor), ModuleTensorDescriptor) + + @staticmethod + def from_data(data): + """Create an ModuleTensorDescriptor instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `module_tensor_descriptor_dtype` holding the data. + """ + return _cyb_from_data(data, "module_tensor_descriptor_dtype", module_tensor_descriptor_dtype, ModuleTensorDescriptor) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an ModuleTensorDescriptor instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef ModuleTensorDescriptor obj = ModuleTensorDescriptor.__new__(ModuleTensorDescriptor) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(cudlaModuleTensorDescriptor)) + if obj._ptr == NULL: + raise MemoryError("Error allocating ModuleTensorDescriptor") + _cyb_memcpy((obj._ptr), ptr, sizeof(cudlaModuleTensorDescriptor)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_fence_dtype_offsets(): + cdef CudlaFence pod + return _numpy.dtype({ + 'names': ['fence', 'type'], + 'formats': [_numpy.intp, _numpy.int32], + 'offsets': [ + (&(pod.fence)) - (&pod), + (&(pod.type)) - (&pod), + ], + 'itemsize': sizeof(CudlaFence), + }) + +fence_dtype = _get_fence_dtype_offsets() + +cdef class Fence: + """Empty-initialize an instance of `CudlaFence`. + + + .. seealso:: `CudlaFence` + """ + cdef: + CudlaFence *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(CudlaFence)) + if self._ptr == NULL: + raise MemoryError("Error allocating Fence") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef CudlaFence *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.Fence object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef Fence other_ + if not isinstance(other, Fence): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(CudlaFence)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(CudlaFence), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(CudlaFence)) + if self._ptr == NULL: + raise MemoryError("Error allocating Fence") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(CudlaFence)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def fence(self): + """int: """ + return (self._ptr[0].fence) + + @fence.setter + def fence(self, val): + if self._readonly: + raise ValueError("This Fence instance is read-only") + self._ptr[0].fence = val + + @property + def type(self): + """int: """ + return (self._ptr[0].type) + + @type.setter + def type(self, val): + if self._readonly: + raise ValueError("This Fence instance is read-only") + self._ptr[0].type = val + + @staticmethod + def from_buffer(buffer): + """Create an Fence instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(CudlaFence), Fence) + + @staticmethod + def from_data(data): + """Create an Fence instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `fence_dtype` holding the data. + """ + return _cyb_from_data(data, "fence_dtype", fence_dtype, Fence) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an Fence instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef Fence obj = Fence.__new__(Fence) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(CudlaFence)) + if obj._ptr == NULL: + raise MemoryError("Error allocating Fence") + _cyb_memcpy((obj._ptr), ptr, sizeof(CudlaFence)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +dev_attribute_dtype = _numpy.dtype(( + _numpy.dtype((_numpy.void, sizeof(cudlaDevAttribute))), + { + "unified_addressing_supported": (_numpy.uint8, 0), + "device_version": (_numpy.uint32, 0), + } + )) + +cdef class DevAttribute: + """Empty-initialize an instance of `cudlaDevAttribute`. + + + .. seealso:: `cudlaDevAttribute` + """ + cdef: + cudlaDevAttribute *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(cudlaDevAttribute)) + if self._ptr == NULL: + raise MemoryError("Error allocating DevAttribute") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef cudlaDevAttribute *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.DevAttribute object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef DevAttribute other_ + if not isinstance(other, DevAttribute): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(cudlaDevAttribute)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(cudlaDevAttribute), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(cudlaDevAttribute)) + if self._ptr == NULL: + raise MemoryError("Error allocating DevAttribute") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(cudlaDevAttribute)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def unified_addressing_supported(self): + """int: """ + return self._ptr[0].unifiedAddressingSupported + + @unified_addressing_supported.setter + def unified_addressing_supported(self, val): + if self._readonly: + raise ValueError("This DevAttribute instance is read-only") + self._ptr[0].unifiedAddressingSupported = val + + @property + def device_version(self): + """int: """ + return self._ptr[0].deviceVersion + + @device_version.setter + def device_version(self, val): + if self._readonly: + raise ValueError("This DevAttribute instance is read-only") + self._ptr[0].deviceVersion = val + + @staticmethod + def from_buffer(buffer): + """Create an DevAttribute instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(cudlaDevAttribute), DevAttribute) + + @staticmethod + def from_data(data): + """Create an DevAttribute instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `dev_attribute_dtype` holding the data. + """ + return _cyb_from_data(data, "dev_attribute_dtype", dev_attribute_dtype, DevAttribute) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an DevAttribute instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef DevAttribute obj = DevAttribute.__new__(DevAttribute) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(cudlaDevAttribute)) + if obj._ptr == NULL: + raise MemoryError("Error allocating DevAttribute") + _cyb_memcpy((obj._ptr), ptr, sizeof(cudlaDevAttribute)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +module_attribute_dtype = _numpy.dtype(( + _numpy.dtype((_numpy.void, sizeof(cudlaModuleAttribute))), + { + "num_input_tensors": (_numpy.uint32, 0), + "num_output_tensors": (_numpy.uint32, 0), + "input_tensor_desc": (_numpy.intp, 0), + "output_tensor_desc": (_numpy.intp, 0), + } + )) + +cdef class ModuleAttribute: + """Empty-initialize an instance of `cudlaModuleAttribute`. + + + .. seealso:: `cudlaModuleAttribute` + """ + cdef: + cudlaModuleAttribute *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(cudlaModuleAttribute)) + if self._ptr == NULL: + raise MemoryError("Error allocating ModuleAttribute") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef cudlaModuleAttribute *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.ModuleAttribute object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef ModuleAttribute other_ + if not isinstance(other, ModuleAttribute): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(cudlaModuleAttribute)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(cudlaModuleAttribute), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(cudlaModuleAttribute)) + if self._ptr == NULL: + raise MemoryError("Error allocating ModuleAttribute") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(cudlaModuleAttribute)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def num_input_tensors(self): + """int: """ + return self._ptr[0].numInputTensors + + @num_input_tensors.setter + def num_input_tensors(self, val): + if self._readonly: + raise ValueError("This ModuleAttribute instance is read-only") + self._ptr[0].numInputTensors = val + + @property + def num_output_tensors(self): + """int: """ + return self._ptr[0].numOutputTensors + + @num_output_tensors.setter + def num_output_tensors(self, val): + if self._readonly: + raise ValueError("This ModuleAttribute instance is read-only") + self._ptr[0].numOutputTensors = val + + @property + def input_tensor_desc(self): + """int: """ + return (self._ptr[0].inputTensorDesc) + + @input_tensor_desc.setter + def input_tensor_desc(self, val): + if self._readonly: + raise ValueError("This ModuleAttribute instance is read-only") + self._ptr[0].inputTensorDesc = val + + @property + def output_tensor_desc(self): + """int: """ + return (self._ptr[0].outputTensorDesc) + + @output_tensor_desc.setter + def output_tensor_desc(self, val): + if self._readonly: + raise ValueError("This ModuleAttribute instance is read-only") + self._ptr[0].outputTensorDesc = val + + @staticmethod + def from_buffer(buffer): + """Create an ModuleAttribute instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(cudlaModuleAttribute), ModuleAttribute) + + @staticmethod + def from_data(data): + """Create an ModuleAttribute instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `module_attribute_dtype` holding the data. + """ + return _cyb_from_data(data, "module_attribute_dtype", module_attribute_dtype, ModuleAttribute) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an ModuleAttribute instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef ModuleAttribute obj = ModuleAttribute.__new__(ModuleAttribute) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(cudlaModuleAttribute)) + if obj._ptr == NULL: + raise MemoryError("Error allocating ModuleAttribute") + _cyb_memcpy((obj._ptr), ptr, sizeof(cudlaModuleAttribute)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_wait_events_dtype_offsets(): + cdef cudlaWaitEvents pod + return _numpy.dtype({ + 'names': ['pre_fences', 'num_events'], + 'formats': [_numpy.intp, _numpy.uint32], + 'offsets': [ + (&(pod.preFences)) - (&pod), + (&(pod.numEvents)) - (&pod), + ], + 'itemsize': sizeof(cudlaWaitEvents), + }) + +wait_events_dtype = _get_wait_events_dtype_offsets() + +cdef class WaitEvents: + """Empty-initialize an instance of `cudlaWaitEvents`. + + + .. seealso:: `cudlaWaitEvents` + """ + cdef: + cudlaWaitEvents *_ptr + object _owner + bint _owned + bint _readonly + dict _refs + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(cudlaWaitEvents)) + if self._ptr == NULL: + raise MemoryError("Error allocating WaitEvents") + self._owner = None + self._owned = True + self._readonly = False + self._refs = {} + + def __dealloc__(self): + cdef cudlaWaitEvents *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.WaitEvents object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef WaitEvents other_ + if not isinstance(other, WaitEvents): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(cudlaWaitEvents)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(cudlaWaitEvents), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(cudlaWaitEvents)) + if self._ptr == NULL: + raise MemoryError("Error allocating WaitEvents") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(cudlaWaitEvents)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def pre_fences(self): + """int: """ + if self._ptr[0].preFences == NULL or self._ptr[0].numEvents == 0: + return [] + return Fence.from_ptr((self._ptr[0].preFences), self._ptr[0].numEvents) + + @pre_fences.setter + def pre_fences(self, val): + if self._readonly: + raise ValueError("This WaitEvents instance is read-only") + cdef Fence arr = val + self._ptr[0].preFences = (arr._get_ptr()) + self._ptr[0].numEvents = len(arr) + self._refs["pre_fences"] = arr + + @staticmethod + def from_buffer(buffer): + """Create an WaitEvents instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(cudlaWaitEvents), WaitEvents) + + @staticmethod + def from_data(data): + """Create an WaitEvents instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `wait_events_dtype` holding the data. + """ + return _cyb_from_data(data, "wait_events_dtype", wait_events_dtype, WaitEvents) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an WaitEvents instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef WaitEvents obj = WaitEvents.__new__(WaitEvents) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(cudlaWaitEvents)) + if obj._ptr == NULL: + raise MemoryError("Error allocating WaitEvents") + _cyb_memcpy((obj._ptr), ptr, sizeof(cudlaWaitEvents)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + obj._refs = {} + return obj + + +cdef _get_signal_events_dtype_offsets(): + cdef cudlaSignalEvents pod + return _numpy.dtype({ + 'names': ['dev_ptrs', 'eof_fences', 'num_events'], + 'formats': [_numpy.intp, _numpy.intp, _numpy.uint32], + 'offsets': [ + (&(pod.devPtrs)) - (&pod), + (&(pod.eofFences)) - (&pod), + (&(pod.numEvents)) - (&pod), + ], + 'itemsize': sizeof(cudlaSignalEvents), + }) + +signal_events_dtype = _get_signal_events_dtype_offsets() + +cdef class SignalEvents: + """Empty-initialize an instance of `cudlaSignalEvents`. + + + .. seealso:: `cudlaSignalEvents` + """ + cdef: + cudlaSignalEvents *_ptr + object _owner + bint _owned + bint _readonly + dict _refs + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(cudlaSignalEvents)) + if self._ptr == NULL: + raise MemoryError("Error allocating SignalEvents") + self._owner = None + self._owned = True + self._readonly = False + self._refs = {} + + def __dealloc__(self): + cdef cudlaSignalEvents *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.SignalEvents object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef SignalEvents other_ + if not isinstance(other, SignalEvents): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(cudlaSignalEvents)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(cudlaSignalEvents), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(cudlaSignalEvents)) + if self._ptr == NULL: + raise MemoryError("Error allocating SignalEvents") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(cudlaSignalEvents)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def dev_ptrs(self): + """int: """ + if self._ptr[0].devPtrs == NULL or self._ptr[0].numEvents == 0: + return _cyb_view.array(shape=(1,), itemsize=sizeof(intptr_t), format="q", mode="c")[:0] + cdef _cyb_view.array arr = _cyb_view.array(shape=(self._ptr[0].numEvents,), itemsize=sizeof(intptr_t), format="q", mode="c", allocate_buffer=False) + arr.data = (self._ptr[0].devPtrs) + return arr + + @dev_ptrs.setter + def dev_ptrs(self, val): + if self._readonly: + raise ValueError("This SignalEvents instance is read-only") + cdef Py_ssize_t _n = len(val) + self._ptr[0].numEvents = _n + if _n == 0: + return + cdef _cyb_view.array arr = _cyb_view.array(shape=(_n,), itemsize=sizeof(intptr_t), format="q", mode="c") + cdef intptr_t[:] mv = arr + cdef Py_ssize_t i + for i in range(_n): + mv[i] = val[i] + self._ptr[0].devPtrs = (arr.data) + self._refs["dev_ptrs"] = arr + + @property + def eof_fences(self): + """int: """ + if self._ptr[0].eofFences == NULL or self._ptr[0].numEvents == 0: + return [] + return Fence.from_ptr((self._ptr[0].eofFences), self._ptr[0].numEvents) + + @eof_fences.setter + def eof_fences(self, val): + if self._readonly: + raise ValueError("This SignalEvents instance is read-only") + cdef Fence arr = val + self._ptr[0].eofFences = (arr._get_ptr()) + self._ptr[0].numEvents = len(arr) + self._refs["eof_fences"] = arr + + @staticmethod + def from_buffer(buffer): + """Create an SignalEvents instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(cudlaSignalEvents), SignalEvents) + + @staticmethod + def from_data(data): + """Create an SignalEvents instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `signal_events_dtype` holding the data. + """ + return _cyb_from_data(data, "signal_events_dtype", signal_events_dtype, SignalEvents) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an SignalEvents instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef SignalEvents obj = SignalEvents.__new__(SignalEvents) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(cudlaSignalEvents)) + if obj._ptr == NULL: + raise MemoryError("Error allocating SignalEvents") + _cyb_memcpy((obj._ptr), ptr, sizeof(cudlaSignalEvents)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + obj._refs = {} + return obj + + +cdef _get_task_dtype_offsets(): + cdef cudlaTask pod + return _numpy.dtype({ + 'names': ['module_handle', 'output_tensor', 'num_output_tensors', 'num_input_tensors', 'input_tensor', 'wait_events', 'signal_events'], + 'formats': [_numpy.intp, _numpy.intp, _numpy.uint32, _numpy.uint32, _numpy.intp, _numpy.intp, _numpy.intp], + 'offsets': [ + (&(pod.moduleHandle)) - (&pod), + (&(pod.outputTensor)) - (&pod), + (&(pod.numOutputTensors)) - (&pod), + (&(pod.numInputTensors)) - (&pod), + (&(pod.inputTensor)) - (&pod), + (&(pod.waitEvents)) - (&pod), + (&(pod.signalEvents)) - (&pod), + ], + 'itemsize': sizeof(cudlaTask), + }) + +task_dtype = _get_task_dtype_offsets() + +cdef class Task: + """Empty-initialize an instance of `cudlaTask`. + + + .. seealso:: `cudlaTask` + """ + cdef: + cudlaTask *_ptr + object _owner + bint _owned + bint _readonly + dict _refs + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(cudlaTask)) + if self._ptr == NULL: + raise MemoryError("Error allocating Task") + self._owner = None + self._owned = True + self._readonly = False + self._refs = {} + + def __dealloc__(self): + cdef cudlaTask *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.Task object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef Task other_ + if not isinstance(other, Task): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(cudlaTask)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(cudlaTask), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(cudlaTask)) + if self._ptr == NULL: + raise MemoryError("Error allocating Task") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(cudlaTask)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def module_handle(self): + """int: """ + return (self._ptr[0].moduleHandle) + + @module_handle.setter + def module_handle(self, val): + if self._readonly: + raise ValueError("This Task instance is read-only") + self._ptr[0].moduleHandle = val + + @property + def output_tensor(self): + """int: """ + if self._ptr[0].outputTensor == NULL or self._ptr[0].numOutputTensors == 0: + return _cyb_view.array(shape=(1,), itemsize=sizeof(intptr_t), format="q", mode="c")[:0] + cdef _cyb_view.array arr = _cyb_view.array(shape=(self._ptr[0].numOutputTensors,), itemsize=sizeof(intptr_t), format="q", mode="c", allocate_buffer=False) + arr.data = (self._ptr[0].outputTensor) + return arr + + @output_tensor.setter + def output_tensor(self, val): + if self._readonly: + raise ValueError("This Task instance is read-only") + cdef Py_ssize_t _n = len(val) + self._ptr[0].numOutputTensors = _n + if _n == 0: + return + cdef _cyb_view.array arr = _cyb_view.array(shape=(_n,), itemsize=sizeof(intptr_t), format="q", mode="c") + cdef intptr_t[:] mv = arr + cdef Py_ssize_t i + for i in range(_n): + mv[i] = val[i] + self._ptr[0].outputTensor = (arr.data) + self._refs["output_tensor"] = arr + + @property + def input_tensor(self): + """int: """ + if self._ptr[0].inputTensor == NULL or self._ptr[0].numInputTensors == 0: + return _cyb_view.array(shape=(1,), itemsize=sizeof(intptr_t), format="q", mode="c")[:0] + cdef _cyb_view.array arr = _cyb_view.array(shape=(self._ptr[0].numInputTensors,), itemsize=sizeof(intptr_t), format="q", mode="c", allocate_buffer=False) + arr.data = (self._ptr[0].inputTensor) + return arr + + @input_tensor.setter + def input_tensor(self, val): + if self._readonly: + raise ValueError("This Task instance is read-only") + cdef Py_ssize_t _n = len(val) + self._ptr[0].numInputTensors = _n + if _n == 0: + return + cdef _cyb_view.array arr = _cyb_view.array(shape=(_n,), itemsize=sizeof(intptr_t), format="q", mode="c") + cdef intptr_t[:] mv = arr + cdef Py_ssize_t i + for i in range(_n): + mv[i] = val[i] + self._ptr[0].inputTensor = (arr.data) + self._refs["input_tensor"] = arr + + @property + def wait_events(self): + """int: """ + return (self._ptr[0].waitEvents) + + @wait_events.setter + def wait_events(self, val): + if self._readonly: + raise ValueError("This Task instance is read-only") + self._ptr[0].waitEvents = val + + @property + def signal_events(self): + """int: """ + return (self._ptr[0].signalEvents) + + @signal_events.setter + def signal_events(self, val): + if self._readonly: + raise ValueError("This Task instance is read-only") + self._ptr[0].signalEvents = val + + @staticmethod + def from_buffer(buffer): + """Create an Task instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(cudlaTask), Task) + + @staticmethod + def from_data(data): + """Create an Task instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `task_dtype` holding the data. + """ + return _cyb_from_data(data, "task_dtype", task_dtype, Task) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an Task instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef Task obj = Task.__new__(Task) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(cudlaTask)) + if obj._ptr == NULL: + raise MemoryError("Error allocating Task") + _cyb_memcpy((obj._ptr), ptr, sizeof(cudlaTask)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + obj._refs = {} + return obj + + +############################################################################### +# Enum +############################################################################### + +class Status(_cyb_IntEnum): + """ + See `cudlaStatus`. + """ + Success = cudlaSuccess + ErrorInvalidParam = cudlaErrorInvalidParam + ErrorOutOfResources = cudlaErrorOutOfResources + ErrorCreationFailed = cudlaErrorCreationFailed + ErrorInvalidAddress = cudlaErrorInvalidAddress + ErrorOs = cudlaErrorOs + ErrorCuda = cudlaErrorCuda + ErrorUmd = cudlaErrorUmd + ErrorInvalidDevice = cudlaErrorInvalidDevice + ErrorInvalidAttribute = cudlaErrorInvalidAttribute + ErrorIncompatibleDlaSWVersion = cudlaErrorIncompatibleDlaSWVersion + ErrorMemoryRegistered = cudlaErrorMemoryRegistered + ErrorInvalidModule = cudlaErrorInvalidModule + ErrorUnsupportedOperation = cudlaErrorUnsupportedOperation + ErrorNvSci = cudlaErrorNvSci + ErrorDriverNotFound = cudlaErrorDriverNotFound + ErrorDlaErrInvalidInput = cudlaErrorDlaErrInvalidInput + ErrorDlaErrInvalidPreAction = cudlaErrorDlaErrInvalidPreAction + ErrorDlaErrNoMem = cudlaErrorDlaErrNoMem + ErrorDlaErrProcessorBusy = cudlaErrorDlaErrProcessorBusy + ErrorDlaErrTaskStatusMismatch = cudlaErrorDlaErrTaskStatusMismatch + ErrorDlaErrEngineTimeout = cudlaErrorDlaErrEngineTimeout + ErrorDlaErrDataMismatch = cudlaErrorDlaErrDataMismatch + ErrorUnknown = cudlaErrorUnknown + +class Mode(_cyb_IntEnum): + """ + See `cudlaMode`. + """ + CUDA_DLA = CUDLA_CUDA_DLA + STANDALONE = CUDLA_STANDALONE + +class ModuleAttributeType(_cyb_IntEnum): + """ + See `cudlaModuleAttributeType`. + """ + NUM_INPUT_TENSORS = CUDLA_NUM_INPUT_TENSORS + NUM_OUTPUT_TENSORS = CUDLA_NUM_OUTPUT_TENSORS + INPUT_TENSOR_DESCRIPTORS = CUDLA_INPUT_TENSOR_DESCRIPTORS + OUTPUT_TENSOR_DESCRIPTORS = CUDLA_OUTPUT_TENSOR_DESCRIPTORS + NUM_OUTPUT_TASK_STATISTICS = CUDLA_NUM_OUTPUT_TASK_STATISTICS + OUTPUT_TASK_STATISTICS_DESCRIPTORS = CUDLA_OUTPUT_TASK_STATISTICS_DESCRIPTORS + +class FenceType(_cyb_IntEnum): + """ + See `cudlaFenceType`. + """ + NVSCISYNC_FENCE = CUDLA_NVSCISYNC_FENCE + NVSCISYNC_FENCE_SOF = CUDLA_NVSCISYNC_FENCE_SOF + +class ModuleLoadFlags(_cyb_IntEnum): + """ + See `cudlaModuleLoadFlags`. + """ + MODULE_DEFAULT = CUDLA_MODULE_DEFAULT + MODULE_ENABLE_FAULT_DIAGNOSTICS = CUDLA_MODULE_ENABLE_FAULT_DIAGNOSTICS + +class SubmissionFlags(_cyb_IntEnum): + """ + See `cudlaSubmissionFlags`. + """ + SUBMIT_NOOP = CUDLA_SUBMIT_NOOP + SUBMIT_SKIP_LOCK_ACQUIRE = CUDLA_SUBMIT_SKIP_LOCK_ACQUIRE + SUBMIT_DIAGNOSTICS_TASK = CUDLA_SUBMIT_DIAGNOSTICS_TASK + +class AccessPermissionFlags(_cyb_IntEnum): + """ + See `cudlaAccessPermissionFlags`. + """ + READ_WRITE_PERM = CUDLA_READ_WRITE_PERM + READ_ONLY_PERM = CUDLA_READ_ONLY_PERM + TASK_STATISTICS = CUDLA_TASK_STATISTICS + +class DevAttributeType(_cyb_IntEnum): + """ + See `cudlaDevAttributeType`. + """ + UNIFIED_ADDRESSING = CUDLA_UNIFIED_ADDRESSING + DEVICE_VERSION = CUDLA_DEVICE_VERSION + + +############################################################################### +# Error handling +############################################################################### + +class CudlaError(Exception): + + def __init__(self, status): + self.status = status + s = Status(status) + cdef str err = f"{s.name} ({s.value})" + super(CudlaError, self).__init__(err) + + def __reduce__(self): + return (type(self), (self.status,)) + + +@cython.profile(False) +cpdef inline check_status(int status): + if status != 0: + raise CudlaError(status) + + +############################################################################### +# Wrapper functions +############################################################################### + +cpdef uint64_t get_version() except? -1: + cdef uint64_t version + with nogil: + __status__ = cudlaGetVersion(&version) + check_status(__status__) + return version + + +cpdef uint64_t device_get_count() except? -1: + cdef uint64_t p_num_devices + with nogil: + __status__ = cudlaDeviceGetCount(&p_num_devices) + check_status(__status__) + return p_num_devices + + +cpdef intptr_t create_device(uint64_t device, uint32_t flags) except *: + cdef DevHandle dev_handle + if flags == CUDLA_STANDALONE: + raise CudlaError(cudlaErrorUnsupportedOperation) + with nogil: + __status__ = cudlaCreateDevice(device, &dev_handle, flags) + check_status(__status__) + return dev_handle + + +cpdef intptr_t mem_register(intptr_t dev_handle, intptr_t ptr, size_t size, uint32_t flags) except *: + cdef uint64_t* dev_ptr + with nogil: + __status__ = cudlaMemRegister(dev_handle, ptr, size, &dev_ptr, flags) + check_status(__status__) + return dev_ptr + + +cpdef intptr_t module_load_from_memory(intptr_t dev_handle, p_module, size_t module_size, uint32_t flags) except *: + cdef void* _p_module_ = get_buffer_pointer(p_module, module_size, readonly=True) + cdef Module h_module + with nogil: + __status__ = cudlaModuleLoadFromMemory(dev_handle, _p_module_, module_size, &h_module, flags) + check_status(__status__) + return h_module + + +cpdef module_unload(intptr_t h_module, uint32_t flags): + with nogil: + __status__ = cudlaModuleUnload(h_module, flags) + check_status(__status__) + + +cpdef submit_task(intptr_t dev_handle, intptr_t ptr_to_tasks, uint32_t num_tasks, intptr_t stream, uint32_t flags): + with nogil: + __status__ = cudlaSubmitTask(dev_handle, ptr_to_tasks, num_tasks, stream, flags) + check_status(__status__) + + +cpdef object device_get_attribute(intptr_t dev_handle, int attrib) except *: + cdef DevAttribute p_attribute_py = DevAttribute() + cdef cudlaDevAttribute *p_attribute = (p_attribute_py._get_ptr()) + with nogil: + __status__ = cudlaDeviceGetAttribute(dev_handle, attrib, p_attribute) + check_status(__status__) + return p_attribute_py + + +cpdef mem_unregister(intptr_t dev_handle, intptr_t dev_ptr): + with nogil: + __status__ = cudlaMemUnregister(dev_handle, dev_ptr) + check_status(__status__) + + +cpdef int get_last_error(intptr_t dev_handle) except? 0: + cdef int ret + with nogil: + ret = cudlaGetLastError(dev_handle) + return ret + + +cpdef destroy_device(intptr_t dev_handle): + with nogil: + __status__ = cudlaDestroyDevice(dev_handle) + check_status(__status__) + + +cpdef set_task_timeout_in_ms(intptr_t dev_handle, uint32_t timeout): + with nogil: + __status__ = cudlaSetTaskTimeoutInMs(dev_handle, timeout) + check_status(__status__) + + +cpdef module_get_attributes(intptr_t h_module, int attr_type) except *: + """Query module attributes, interpreting the cudlaModuleAttribute union + based on the requested attribute type. + + For count attributes (NUM_INPUT_TENSORS, NUM_OUTPUT_TENSORS, + NUM_OUTPUT_TASK_STATISTICS), returns an int. + + For descriptor attributes (INPUT_TENSOR_DESCRIPTORS, + OUTPUT_TENSOR_DESCRIPTORS, OUTPUT_TASK_STATISTICS_DESCRIPTORS), + returns a list of ModuleTensorDescriptor objects. + """ + cdef int _attr_type = attr_type + cdef cudlaModuleAttribute count_attr + cdef cudlaModuleAttribute num_attr + cdef cudlaModuleAttribute desc_attr + cdef uint32_t count + cdef cudlaModuleTensorDescriptor* desc_buf + cdef uint32_t i + cdef int num_attr_type + + if _attr_type == CUDLA_NUM_INPUT_TENSORS or _attr_type == CUDLA_NUM_OUTPUT_TENSORS or _attr_type == CUDLA_NUM_OUTPUT_TASK_STATISTICS: + with nogil: + __status__ = cudlaModuleGetAttributes(h_module, _attr_type, &count_attr) + check_status(__status__) + return (count_attr.numInputTensors) + elif _attr_type == CUDLA_INPUT_TENSOR_DESCRIPTORS or _attr_type == CUDLA_OUTPUT_TENSOR_DESCRIPTORS or _attr_type == CUDLA_OUTPUT_TASK_STATISTICS_DESCRIPTORS: + if _attr_type == CUDLA_INPUT_TENSOR_DESCRIPTORS: + num_attr_type = CUDLA_NUM_INPUT_TENSORS + elif _attr_type == CUDLA_OUTPUT_TENSOR_DESCRIPTORS: + num_attr_type = CUDLA_NUM_OUTPUT_TENSORS + else: + num_attr_type = CUDLA_NUM_OUTPUT_TASK_STATISTICS + with nogil: + __status__ = cudlaModuleGetAttributes(h_module, num_attr_type, &num_attr) + check_status(__status__) + count = num_attr.numInputTensors + desc_buf = malloc(count * sizeof(cudlaModuleTensorDescriptor)) + if desc_buf == NULL: + raise MemoryError("Failed to allocate descriptor buffer") + try: + desc_attr.inputTensorDesc = desc_buf + with nogil: + __status__ = cudlaModuleGetAttributes(h_module, _attr_type, &desc_attr) + check_status(__status__) + result = [] + for i in range(count): + result.append(ModuleTensorDescriptor.from_ptr(&desc_buf[i], readonly=True)) + return result + finally: + free(desc_buf) + else: + raise ValueError(f"Unknown attribute type: {attr_type}") +del _cyb_IntEnum diff --git a/cuda_bindings/cuda/bindings/cufile.pxd b/cuda_bindings/cuda/bindings/cufile.pxd new file mode 100644 index 00000000000..2bd8c7489ca --- /dev/null +++ b/cuda_bindings/cuda/bindings/cufile.pxd @@ -0,0 +1,86 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +# This code was automatically generated across versions from 12.9.1 to 13.3.0. Do not modify it directly. + +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=232df43b5a8960f10286c172abc71222a3822087a1f6134e12d9341f3b53886c +from libc.stdint cimport intptr_t + +from .cycufile cimport * + + +############################################################################### +# Types +############################################################################### + +ctypedef CUfileHandle_t Handle +ctypedef CUfileBatchHandle_t BatchHandle +ctypedef CUfileError_t Error +ctypedef cufileRDMAInfo_t RDMAInfo +ctypedef CUfileFSOps_t FSOps +ctypedef CUfileDrvProps_t DrvProps + + +############################################################################### +# Enum +############################################################################### + +ctypedef CUfileOpError _OpError +ctypedef CUfileDriverStatusFlags_t _DriverStatusFlags +ctypedef CUfileDriverControlFlags_t _DriverControlFlags +ctypedef CUfileFeatureFlags_t _FeatureFlags +ctypedef CUfileFileHandleType _FileHandleType +ctypedef CUfileOpcode_t _Opcode +ctypedef CUfileStatus_t _Status +ctypedef CUfileBatchMode_t _BatchMode +ctypedef CUFileSizeTConfigParameter_t _SizeTConfigParameter +ctypedef CUFileBoolConfigParameter_t _BoolConfigParameter +ctypedef CUFileStringConfigParameter_t _StringConfigParameter +ctypedef CUFileArrayConfigParameter_t _ArrayConfigParameter +ctypedef CUfileP2PFlags_t _P2PFlags + + +############################################################################### +# Functions +############################################################################### + +cpdef intptr_t handle_register(intptr_t descr) except? 0 +cpdef void handle_deregister(intptr_t fh) except* +cpdef buf_register(intptr_t buf_ptr_base, size_t length, int flags) +cpdef buf_deregister(intptr_t buf_ptr_base) +cpdef driver_open() +cpdef use_count() +cpdef driver_get_properties(intptr_t props) +cpdef driver_set_poll_mode(bint poll, size_t poll_threshold_size) +cpdef driver_set_max_direct_io_size(size_t max_direct_io_size) +cpdef driver_set_max_cache_size(size_t max_cache_size) +cpdef driver_set_max_pinned_mem_size(size_t max_pinned_size) +cpdef intptr_t batch_io_set_up(unsigned nr) except? 0 +cpdef batch_io_submit(intptr_t batch_idp, unsigned nr, intptr_t iocbp, unsigned int flags) +cpdef batch_io_get_status(intptr_t batch_idp, unsigned min_nr, intptr_t nr, intptr_t iocbp, intptr_t timeout) +cpdef batch_io_cancel(intptr_t batch_idp) +cpdef void batch_io_destroy(intptr_t batch_idp) except* +cpdef read_async(intptr_t fh, intptr_t buf_ptr_base, intptr_t size_p, intptr_t file_offset_p, intptr_t buf_ptr_offset_p, intptr_t bytes_read_p, intptr_t stream) +cpdef write_async(intptr_t fh, intptr_t buf_ptr_base, intptr_t size_p, intptr_t file_offset_p, intptr_t buf_ptr_offset_p, intptr_t bytes_written_p, intptr_t stream) +cpdef stream_register(intptr_t stream, unsigned flags) +cpdef stream_deregister(intptr_t stream) +cpdef int get_version() except? 0 +cpdef size_t get_parameter_size_t(int param) except? 0 +cpdef bint get_parameter_bool(int param) except? 0 +cpdef str get_parameter_string(int param, int len) +cpdef set_parameter_size_t(int param, size_t value) +cpdef set_parameter_bool(int param, bint value) +cpdef set_parameter_string(int param, intptr_t desc_str) +cpdef tuple get_parameter_min_max_value(int param) +cpdef set_stats_level(int level) +cpdef int get_stats_level() except? 0 +cpdef stats_start() +cpdef stats_stop() +cpdef stats_reset() +cpdef get_stats_l1(intptr_t stats) +cpdef get_stats_l2(intptr_t stats) +cpdef get_stats_l3(intptr_t stats) +cpdef size_t get_bar_size_in_kb(int gpu_index) except? 0 +cpdef set_parameter_posix_pool_slab_array(intptr_t size_values, intptr_t count_values, int len) +cpdef get_parameter_posix_pool_slab_array(intptr_t size_values, intptr_t count_values, int len) diff --git a/cuda_bindings/cuda/bindings/cufile.pyx b/cuda_bindings/cuda/bindings/cufile.pyx new file mode 100644 index 00000000000..fbc9c20dc47 --- /dev/null +++ b/cuda_bindings/cuda/bindings/cufile.pyx @@ -0,0 +1,3349 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +# This code was automatically generated across versions from 12.9.1 to 13.3.0. Do not modify it directly. +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=4567ca64d02631fc8d6ed11af8164d72c86b4686c105fd733d186e6c92512749 + + +# <<<< PREAMBLE CONTENT >>>> + +cimport cpython as _cyb_cpython +cimport cpython.buffer as _cyb_cpython_buffer +cimport cpython.memoryview as _cyb_cpython_memoryview +from cython cimport view as _cyb_view +from libc.stdlib cimport ( + calloc as _cyb_calloc, + free as _cyb_free, + malloc as _cyb_malloc, +) +from libc.string cimport ( + memcmp as _cyb_memcmp, + memcpy as _cyb_memcpy, +) + +from cuda.bindings._internal._fast_enum import FastEnum as _cyb_FastEnum + +import numpy as _numpy + +cdef _cyb___getbuffer(object self, _cyb_cpython.Py_buffer *buffer, void *ptr, int size, bint readonly): + buffer.buf = ptr + buffer.format = 'b' + buffer.internal = NULL + buffer.itemsize = 1 + buffer.len = size + buffer.ndim = 1 + buffer.obj = self + buffer.readonly = readonly + buffer.shape = &buffer.len + buffer.strides = &buffer.itemsize + buffer.suboffsets = NULL + +cdef _cyb_from_buffer(buffer, size, lowpp_type): + cdef _cyb_cpython.Py_buffer view + if _cyb_cpython.PyObject_GetBuffer(buffer, &view, _cyb_cpython_buffer.PyBUF_SIMPLE) != 0: + raise TypeError("buffer argument does not support the buffer protocol") + try: + if view.itemsize != 1: + raise ValueError("buffer itemsize must be 1 byte") + if view.len != size: + raise ValueError(f"buffer length must be {size} bytes") + return lowpp_type.from_ptr(view.buf, not view.readonly, buffer) + finally: + _cyb_cpython.PyBuffer_Release(&view) + +cdef _cyb_from_data(data, dtype_name, expected_dtype, lowpp_type): + # _numpy.recarray is a subclass of _numpy.ndarray, so implicitly handled here. + if isinstance(data, lowpp_type): + return data + if not isinstance(data, _numpy.ndarray): + raise TypeError("data argument must be a NumPy ndarray") + if data.size != 1: + raise ValueError("data array must have a size of 1") + if data.dtype != expected_dtype: + raise ValueError(f"data array must be of dtype {dtype_name}") + return lowpp_type.from_ptr(data.ctypes.data, not data.flags.writeable, data) + + +# <<<< END OF PREAMBLE CONTENT >>>> + +cimport cython # NOQA +from libc cimport errno +from ._internal.utils cimport (get_buffer_pointer, get_nested_resource_ptr, + nested_resource) + +import cython + +from cuda.bindings.driver import CUresult as pyCUresult + +############################################################################### +# POD +############################################################################### + +_py_anon_pod1_dtype = _numpy.dtype(( + _numpy.dtype((_numpy.void, sizeof((NULL).handle))), + { + "fd": (_numpy.int32, 0), + "handle": (_numpy.intp, 0), + } + )) + +cdef class _py_anon_pod1: + """Empty-initialize an instance of `cuda_bindings_cufile__anon_pod1`. + + + .. seealso:: `cuda_bindings_cufile__anon_pod1` + """ + cdef: + cuda_bindings_cufile__anon_pod1 *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof((NULL).handle)) + if self._ptr == NULL: + raise MemoryError("Error allocating _py_anon_pod1") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef cuda_bindings_cufile__anon_pod1 *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}._py_anon_pod1 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef _py_anon_pod1 other_ + if not isinstance(other, _py_anon_pod1): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof((NULL).handle)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof((NULL).handle), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof((NULL).handle)) + if self._ptr == NULL: + raise MemoryError("Error allocating _py_anon_pod1") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof((NULL).handle)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def fd(self): + """int: """ + return self._ptr[0].fd + + @fd.setter + def fd(self, val): + if self._readonly: + raise ValueError("This _py_anon_pod1 instance is read-only") + self._ptr[0].fd = val + + @property + def handle(self): + """int: """ + return (self._ptr[0].handle) + + @handle.setter + def handle(self, val): + if self._readonly: + raise ValueError("This _py_anon_pod1 instance is read-only") + self._ptr[0].handle = val + + @staticmethod + def from_buffer(buffer): + """Create an _py_anon_pod1 instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof((NULL).handle), _py_anon_pod1) + + @staticmethod + def from_data(data): + """Create an _py_anon_pod1 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `_py_anon_pod1_dtype` holding the data. + """ + return _cyb_from_data(data, "_py_anon_pod1_dtype", _py_anon_pod1_dtype, _py_anon_pod1) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an _py_anon_pod1 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef _py_anon_pod1 obj = _py_anon_pod1.__new__(_py_anon_pod1) + if owner is None: + obj._ptr = _cyb_malloc(sizeof((NULL).handle)) + if obj._ptr == NULL: + raise MemoryError("Error allocating _py_anon_pod1") + _cyb_memcpy((obj._ptr), ptr, sizeof((NULL).handle)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get__py_anon_pod3_dtype_offsets(): + cdef cuda_bindings_cufile__anon_pod3 pod + return _numpy.dtype({ + 'names': ['dev_ptr_base', 'file_offset', 'dev_ptr_offset', 'size_'], + 'formats': [_numpy.intp, _numpy.int64, _numpy.int64, _numpy.uint64], + 'offsets': [ + (&(pod.devPtr_base)) - (&pod), + (&(pod.file_offset)) - (&pod), + (&(pod.devPtr_offset)) - (&pod), + (&(pod.size)) - (&pod), + ], + 'itemsize': sizeof((NULL).u.batch), + }) + +_py_anon_pod3_dtype = _get__py_anon_pod3_dtype_offsets() + +cdef class _py_anon_pod3: + """Empty-initialize an instance of `cuda_bindings_cufile__anon_pod3`. + + + .. seealso:: `cuda_bindings_cufile__anon_pod3` + """ + cdef: + cuda_bindings_cufile__anon_pod3 *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof((NULL).u.batch)) + if self._ptr == NULL: + raise MemoryError("Error allocating _py_anon_pod3") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef cuda_bindings_cufile__anon_pod3 *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}._py_anon_pod3 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef _py_anon_pod3 other_ + if not isinstance(other, _py_anon_pod3): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof((NULL).u.batch)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof((NULL).u.batch), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof((NULL).u.batch)) + if self._ptr == NULL: + raise MemoryError("Error allocating _py_anon_pod3") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof((NULL).u.batch)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def dev_ptr_base(self): + """int: """ + return (self._ptr[0].devPtr_base) + + @dev_ptr_base.setter + def dev_ptr_base(self, val): + if self._readonly: + raise ValueError("This _py_anon_pod3 instance is read-only") + self._ptr[0].devPtr_base = val + + @property + def file_offset(self): + """int: """ + return self._ptr[0].file_offset + + @file_offset.setter + def file_offset(self, val): + if self._readonly: + raise ValueError("This _py_anon_pod3 instance is read-only") + self._ptr[0].file_offset = val + + @property + def dev_ptr_offset(self): + """int: """ + return self._ptr[0].devPtr_offset + + @dev_ptr_offset.setter + def dev_ptr_offset(self, val): + if self._readonly: + raise ValueError("This _py_anon_pod3 instance is read-only") + self._ptr[0].devPtr_offset = val + + @property + def size_(self): + """int: """ + return self._ptr[0].size + + @size_.setter + def size_(self, val): + if self._readonly: + raise ValueError("This _py_anon_pod3 instance is read-only") + self._ptr[0].size = val + + @staticmethod + def from_buffer(buffer): + """Create an _py_anon_pod3 instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof((NULL).u.batch), _py_anon_pod3) + + @staticmethod + def from_data(data): + """Create an _py_anon_pod3 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `_py_anon_pod3_dtype` holding the data. + """ + return _cyb_from_data(data, "_py_anon_pod3_dtype", _py_anon_pod3_dtype, _py_anon_pod3) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an _py_anon_pod3 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef _py_anon_pod3 obj = _py_anon_pod3.__new__(_py_anon_pod3) + if owner is None: + obj._ptr = _cyb_malloc(sizeof((NULL).u.batch)) + if obj._ptr == NULL: + raise MemoryError("Error allocating _py_anon_pod3") + _cyb_memcpy((obj._ptr), ptr, sizeof((NULL).u.batch)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_io_events_dtype_offsets(): + cdef CUfileIOEvents_t pod + return _numpy.dtype({ + 'names': ['cookie', 'status', 'ret'], + 'formats': [_numpy.intp, _numpy.int32, _numpy.uint64], + 'offsets': [ + (&(pod.cookie)) - (&pod), + (&(pod.status)) - (&pod), + (&(pod.ret)) - (&pod), + ], + 'itemsize': sizeof(CUfileIOEvents_t), + }) + +io_events_dtype = _get_io_events_dtype_offsets() + +cdef class IOEvents: + """Empty-initialize an array of `CUfileIOEvents_t`. + The resulting object is of length `size` and of dtype `io_events_dtype`. + If default-constructed, the instance represents a single struct. + + Args: + size (int): number of structs, default=1. + + .. seealso:: `CUfileIOEvents_t` + """ + cdef: + readonly object _data + + def __init__(self, size=1): + arr = _numpy.empty(size, dtype=io_events_dtype) + self._data = arr.view(_numpy.recarray) + assert self._data.itemsize == sizeof(CUfileIOEvents_t), \ + f"itemsize {self._data.itemsize} mismatches struct size { sizeof(CUfileIOEvents_t) }" + + def __repr__(self): + if self._data.size > 1: + return f"<{__name__}.IOEvents_Array_{self._data.size} object at {hex(id(self))}>" + else: + return f"<{__name__}.IOEvents object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return self._data.ctypes.data + + cdef intptr_t _get_ptr(self): + return self._data.ctypes.data + + def __int__(self): + if self._data.size > 1: + raise TypeError("int() argument must be a bytes-like object of size 1. " + "To get the pointer address of an array, use .ptr") + return self._data.ctypes.data + + def __len__(self): + return self._data.size + + def __eq__(self, other): + cdef object self_data = self._data + if (not isinstance(other, IOEvents)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype: + return False + return bool((self_data == other._data).all()) + + def __getbuffer__(self, Py_buffer *buffer, int flags): + _cyb_cpython.PyObject_GetBuffer(self._data, buffer, flags) + + def __releasebuffer__(self, Py_buffer *buffer): + _cyb_cpython.PyBuffer_Release(buffer) + + @property + def cookie(self): + """Union[~_numpy.intp, int]: """ + if self._data.size == 1: + return int(self._data.cookie[0]) + return self._data.cookie + + @cookie.setter + def cookie(self, val): + self._data.cookie = val + + @property + def status(self): + """Union[~_numpy.int32, int]: """ + if self._data.size == 1: + return int(self._data.status[0]) + return self._data.status + + @status.setter + def status(self, val): + self._data.status = val + + @property + def ret(self): + """Union[~_numpy.uint64, int]: """ + if self._data.size == 1: + return int(self._data.ret[0]) + return self._data.ret + + @ret.setter + def ret(self, val): + self._data.ret = val + + def __getitem__(self, key): + cdef ssize_t key_ + cdef ssize_t size + if isinstance(key, int): + key_ = key + size = self._data.size + if key_ >= size or key_ <= -(size+1): + raise IndexError("index is out of bounds") + if key_ < 0: + key_ += size + return IOEvents.from_data(self._data[key_:key_+1]) + out = self._data[key] + if isinstance(out, _numpy.recarray) and out.dtype == io_events_dtype: + return IOEvents.from_data(out) + return out + + def __setitem__(self, key, val): + self._data[key] = val + + @staticmethod + def from_buffer(buffer): + """Create an IOEvents instance with the memory from the given buffer.""" + return IOEvents.from_data(_numpy.frombuffer(buffer, dtype=io_events_dtype)) + + @staticmethod + def from_data(data): + """Create an IOEvents instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a 1D array of dtype `io_events_dtype` holding the data. + """ + cdef IOEvents obj = IOEvents.__new__(IOEvents) + if not isinstance(data, _numpy.ndarray): + raise TypeError("data argument must be a NumPy ndarray") + if data.ndim != 1: + raise ValueError("data array must be 1D") + if data.dtype != io_events_dtype: + raise ValueError("data array must be of dtype io_events_dtype") + obj._data = data.view(_numpy.recarray) + + return obj + + @staticmethod + def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False): + """Create an IOEvents instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + size (int): number of structs, default=1. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef IOEvents obj = IOEvents.__new__(IOEvents) + cdef flag = _cyb_cpython_buffer.PyBUF_READ if readonly else _cyb_cpython_buffer.PyBUF_WRITE + cdef object buf = _cyb_cpython_memoryview.PyMemoryView_FromMemory( + ptr, sizeof(CUfileIOEvents_t) * size, flag) + data = _numpy.ndarray(size, buffer=buf, dtype=io_events_dtype) + obj._data = data.view(_numpy.recarray) + + return obj + + +cdef _get_op_counter_dtype_offsets(): + cdef CUfileOpCounter_t pod + return _numpy.dtype({ + 'names': ['ok', 'err'], + 'formats': [_numpy.uint64, _numpy.uint64], + 'offsets': [ + (&(pod.ok)) - (&pod), + (&(pod.err)) - (&pod), + ], + 'itemsize': sizeof(CUfileOpCounter_t), + }) + +op_counter_dtype = _get_op_counter_dtype_offsets() + +cdef class OpCounter: + """Empty-initialize an instance of `CUfileOpCounter_t`. + + + .. seealso:: `CUfileOpCounter_t` + """ + cdef: + CUfileOpCounter_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(CUfileOpCounter_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating OpCounter") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef CUfileOpCounter_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.OpCounter object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef OpCounter other_ + if not isinstance(other, OpCounter): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(CUfileOpCounter_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(CUfileOpCounter_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(CUfileOpCounter_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating OpCounter") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(CUfileOpCounter_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def ok(self): + """int: """ + return self._ptr[0].ok + + @ok.setter + def ok(self, val): + if self._readonly: + raise ValueError("This OpCounter instance is read-only") + self._ptr[0].ok = val + + @property + def err(self): + """int: """ + return self._ptr[0].err + + @err.setter + def err(self, val): + if self._readonly: + raise ValueError("This OpCounter instance is read-only") + self._ptr[0].err = val + + @staticmethod + def from_buffer(buffer): + """Create an OpCounter instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(CUfileOpCounter_t), OpCounter) + + @staticmethod + def from_data(data): + """Create an OpCounter instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `op_counter_dtype` holding the data. + """ + return _cyb_from_data(data, "op_counter_dtype", op_counter_dtype, OpCounter) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an OpCounter instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef OpCounter obj = OpCounter.__new__(OpCounter) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(CUfileOpCounter_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating OpCounter") + _cyb_memcpy((obj._ptr), ptr, sizeof(CUfileOpCounter_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_per_gpu_stats_dtype_offsets(): + cdef CUfilePerGpuStats_t pod + return _numpy.dtype({ + 'names': ['uuid', 'read_bytes', 'read_bw_bytes_per_sec', 'read_utilization', 'read_duration_us', 'n_total_reads', 'n_p2p_reads', 'n_nvfs_reads', 'n_posix_reads', 'n_unaligned_reads', 'n_dr_reads', 'n_sparse_regions', 'n_inline_regions', 'n_reads_err', 'writes_bytes', 'write_bw_bytes_per_sec', 'write_utilization', 'write_duration_us', 'n_total_writes', 'n_p2p_writes', 'n_nvfs_writes', 'n_posix_writes', 'n_unaligned_writes', 'n_dr_writes', 'n_writes_err', 'n_mmap', 'n_mmap_ok', 'n_mmap_err', 'n_mmap_free', 'reg_bytes'], + 'formats': [(_numpy.int8, 16), _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64], + 'offsets': [ + (&(pod.uuid)) - (&pod), + (&(pod.read_bytes)) - (&pod), + (&(pod.read_bw_bytes_per_sec)) - (&pod), + (&(pod.read_utilization)) - (&pod), + (&(pod.read_duration_us)) - (&pod), + (&(pod.n_total_reads)) - (&pod), + (&(pod.n_p2p_reads)) - (&pod), + (&(pod.n_nvfs_reads)) - (&pod), + (&(pod.n_posix_reads)) - (&pod), + (&(pod.n_unaligned_reads)) - (&pod), + (&(pod.n_dr_reads)) - (&pod), + (&(pod.n_sparse_regions)) - (&pod), + (&(pod.n_inline_regions)) - (&pod), + (&(pod.n_reads_err)) - (&pod), + (&(pod.writes_bytes)) - (&pod), + (&(pod.write_bw_bytes_per_sec)) - (&pod), + (&(pod.write_utilization)) - (&pod), + (&(pod.write_duration_us)) - (&pod), + (&(pod.n_total_writes)) - (&pod), + (&(pod.n_p2p_writes)) - (&pod), + (&(pod.n_nvfs_writes)) - (&pod), + (&(pod.n_posix_writes)) - (&pod), + (&(pod.n_unaligned_writes)) - (&pod), + (&(pod.n_dr_writes)) - (&pod), + (&(pod.n_writes_err)) - (&pod), + (&(pod.n_mmap)) - (&pod), + (&(pod.n_mmap_ok)) - (&pod), + (&(pod.n_mmap_err)) - (&pod), + (&(pod.n_mmap_free)) - (&pod), + (&(pod.reg_bytes)) - (&pod), + ], + 'itemsize': sizeof(CUfilePerGpuStats_t), + }) + +per_gpu_stats_dtype = _get_per_gpu_stats_dtype_offsets() + +cdef class PerGpuStats: + """Empty-initialize an array of `CUfilePerGpuStats_t`. + The resulting object is of length `size` and of dtype `per_gpu_stats_dtype`. + If default-constructed, the instance represents a single struct. + + Args: + size (int): number of structs, default=1. + + .. seealso:: `CUfilePerGpuStats_t` + """ + cdef: + readonly object _data + + def __init__(self, size=1): + arr = _numpy.empty(size, dtype=per_gpu_stats_dtype) + self._data = arr.view(_numpy.recarray) + assert self._data.itemsize == sizeof(CUfilePerGpuStats_t), \ + f"itemsize {self._data.itemsize} mismatches struct size { sizeof(CUfilePerGpuStats_t) }" + + def __repr__(self): + if self._data.size > 1: + return f"<{__name__}.PerGpuStats_Array_{self._data.size} object at {hex(id(self))}>" + else: + return f"<{__name__}.PerGpuStats object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return self._data.ctypes.data + + cdef intptr_t _get_ptr(self): + return self._data.ctypes.data + + def __int__(self): + if self._data.size > 1: + raise TypeError("int() argument must be a bytes-like object of size 1. " + "To get the pointer address of an array, use .ptr") + return self._data.ctypes.data + + def __len__(self): + return self._data.size + + def __eq__(self, other): + cdef object self_data = self._data + if (not isinstance(other, PerGpuStats)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype: + return False + return bool((self_data == other._data).all()) + + def __getbuffer__(self, Py_buffer *buffer, int flags): + _cyb_cpython.PyObject_GetBuffer(self._data, buffer, flags) + + def __releasebuffer__(self, Py_buffer *buffer): + _cyb_cpython.PyBuffer_Release(buffer) + + @property + def uuid(self): + """~_numpy.int8: (array of length 16).""" + return self._data.uuid + + @uuid.setter + def uuid(self, val): + self._data.uuid = val + + @property + def read_bytes(self): + """Union[~_numpy.uint64, int]: """ + if self._data.size == 1: + return int(self._data.read_bytes[0]) + return self._data.read_bytes + + @read_bytes.setter + def read_bytes(self, val): + self._data.read_bytes = val + + @property + def read_bw_bytes_per_sec(self): + """Union[~_numpy.uint64, int]: """ + if self._data.size == 1: + return int(self._data.read_bw_bytes_per_sec[0]) + return self._data.read_bw_bytes_per_sec + + @read_bw_bytes_per_sec.setter + def read_bw_bytes_per_sec(self, val): + self._data.read_bw_bytes_per_sec = val + + @property + def read_utilization(self): + """Union[~_numpy.uint64, int]: """ + if self._data.size == 1: + return int(self._data.read_utilization[0]) + return self._data.read_utilization + + @read_utilization.setter + def read_utilization(self, val): + self._data.read_utilization = val + + @property + def read_duration_us(self): + """Union[~_numpy.uint64, int]: """ + if self._data.size == 1: + return int(self._data.read_duration_us[0]) + return self._data.read_duration_us + + @read_duration_us.setter + def read_duration_us(self, val): + self._data.read_duration_us = val + + @property + def n_total_reads(self): + """Union[~_numpy.uint64, int]: """ + if self._data.size == 1: + return int(self._data.n_total_reads[0]) + return self._data.n_total_reads + + @n_total_reads.setter + def n_total_reads(self, val): + self._data.n_total_reads = val + + @property + def n_p2p_reads(self): + """Union[~_numpy.uint64, int]: """ + if self._data.size == 1: + return int(self._data.n_p2p_reads[0]) + return self._data.n_p2p_reads + + @n_p2p_reads.setter + def n_p2p_reads(self, val): + self._data.n_p2p_reads = val + + @property + def n_nvfs_reads(self): + """Union[~_numpy.uint64, int]: """ + if self._data.size == 1: + return int(self._data.n_nvfs_reads[0]) + return self._data.n_nvfs_reads + + @n_nvfs_reads.setter + def n_nvfs_reads(self, val): + self._data.n_nvfs_reads = val + + @property + def n_posix_reads(self): + """Union[~_numpy.uint64, int]: """ + if self._data.size == 1: + return int(self._data.n_posix_reads[0]) + return self._data.n_posix_reads + + @n_posix_reads.setter + def n_posix_reads(self, val): + self._data.n_posix_reads = val + + @property + def n_unaligned_reads(self): + """Union[~_numpy.uint64, int]: """ + if self._data.size == 1: + return int(self._data.n_unaligned_reads[0]) + return self._data.n_unaligned_reads + + @n_unaligned_reads.setter + def n_unaligned_reads(self, val): + self._data.n_unaligned_reads = val + + @property + def n_dr_reads(self): + """Union[~_numpy.uint64, int]: """ + if self._data.size == 1: + return int(self._data.n_dr_reads[0]) + return self._data.n_dr_reads + + @n_dr_reads.setter + def n_dr_reads(self, val): + self._data.n_dr_reads = val + + @property + def n_sparse_regions(self): + """Union[~_numpy.uint64, int]: """ + if self._data.size == 1: + return int(self._data.n_sparse_regions[0]) + return self._data.n_sparse_regions + + @n_sparse_regions.setter + def n_sparse_regions(self, val): + self._data.n_sparse_regions = val + + @property + def n_inline_regions(self): + """Union[~_numpy.uint64, int]: """ + if self._data.size == 1: + return int(self._data.n_inline_regions[0]) + return self._data.n_inline_regions + + @n_inline_regions.setter + def n_inline_regions(self, val): + self._data.n_inline_regions = val + + @property + def n_reads_err(self): + """Union[~_numpy.uint64, int]: """ + if self._data.size == 1: + return int(self._data.n_reads_err[0]) + return self._data.n_reads_err + + @n_reads_err.setter + def n_reads_err(self, val): + self._data.n_reads_err = val + + @property + def writes_bytes(self): + """Union[~_numpy.uint64, int]: """ + if self._data.size == 1: + return int(self._data.writes_bytes[0]) + return self._data.writes_bytes + + @writes_bytes.setter + def writes_bytes(self, val): + self._data.writes_bytes = val + + @property + def write_bw_bytes_per_sec(self): + """Union[~_numpy.uint64, int]: """ + if self._data.size == 1: + return int(self._data.write_bw_bytes_per_sec[0]) + return self._data.write_bw_bytes_per_sec + + @write_bw_bytes_per_sec.setter + def write_bw_bytes_per_sec(self, val): + self._data.write_bw_bytes_per_sec = val + + @property + def write_utilization(self): + """Union[~_numpy.uint64, int]: """ + if self._data.size == 1: + return int(self._data.write_utilization[0]) + return self._data.write_utilization + + @write_utilization.setter + def write_utilization(self, val): + self._data.write_utilization = val + + @property + def write_duration_us(self): + """Union[~_numpy.uint64, int]: """ + if self._data.size == 1: + return int(self._data.write_duration_us[0]) + return self._data.write_duration_us + + @write_duration_us.setter + def write_duration_us(self, val): + self._data.write_duration_us = val + + @property + def n_total_writes(self): + """Union[~_numpy.uint64, int]: """ + if self._data.size == 1: + return int(self._data.n_total_writes[0]) + return self._data.n_total_writes + + @n_total_writes.setter + def n_total_writes(self, val): + self._data.n_total_writes = val + + @property + def n_p2p_writes(self): + """Union[~_numpy.uint64, int]: """ + if self._data.size == 1: + return int(self._data.n_p2p_writes[0]) + return self._data.n_p2p_writes + + @n_p2p_writes.setter + def n_p2p_writes(self, val): + self._data.n_p2p_writes = val + + @property + def n_nvfs_writes(self): + """Union[~_numpy.uint64, int]: """ + if self._data.size == 1: + return int(self._data.n_nvfs_writes[0]) + return self._data.n_nvfs_writes + + @n_nvfs_writes.setter + def n_nvfs_writes(self, val): + self._data.n_nvfs_writes = val + + @property + def n_posix_writes(self): + """Union[~_numpy.uint64, int]: """ + if self._data.size == 1: + return int(self._data.n_posix_writes[0]) + return self._data.n_posix_writes + + @n_posix_writes.setter + def n_posix_writes(self, val): + self._data.n_posix_writes = val + + @property + def n_unaligned_writes(self): + """Union[~_numpy.uint64, int]: """ + if self._data.size == 1: + return int(self._data.n_unaligned_writes[0]) + return self._data.n_unaligned_writes + + @n_unaligned_writes.setter + def n_unaligned_writes(self, val): + self._data.n_unaligned_writes = val + + @property + def n_dr_writes(self): + """Union[~_numpy.uint64, int]: """ + if self._data.size == 1: + return int(self._data.n_dr_writes[0]) + return self._data.n_dr_writes + + @n_dr_writes.setter + def n_dr_writes(self, val): + self._data.n_dr_writes = val + + @property + def n_writes_err(self): + """Union[~_numpy.uint64, int]: """ + if self._data.size == 1: + return int(self._data.n_writes_err[0]) + return self._data.n_writes_err + + @n_writes_err.setter + def n_writes_err(self, val): + self._data.n_writes_err = val + + @property + def n_mmap(self): + """Union[~_numpy.uint64, int]: """ + if self._data.size == 1: + return int(self._data.n_mmap[0]) + return self._data.n_mmap + + @n_mmap.setter + def n_mmap(self, val): + self._data.n_mmap = val + + @property + def n_mmap_ok(self): + """Union[~_numpy.uint64, int]: """ + if self._data.size == 1: + return int(self._data.n_mmap_ok[0]) + return self._data.n_mmap_ok + + @n_mmap_ok.setter + def n_mmap_ok(self, val): + self._data.n_mmap_ok = val + + @property + def n_mmap_err(self): + """Union[~_numpy.uint64, int]: """ + if self._data.size == 1: + return int(self._data.n_mmap_err[0]) + return self._data.n_mmap_err + + @n_mmap_err.setter + def n_mmap_err(self, val): + self._data.n_mmap_err = val + + @property + def n_mmap_free(self): + """Union[~_numpy.uint64, int]: """ + if self._data.size == 1: + return int(self._data.n_mmap_free[0]) + return self._data.n_mmap_free + + @n_mmap_free.setter + def n_mmap_free(self, val): + self._data.n_mmap_free = val + + @property + def reg_bytes(self): + """Union[~_numpy.uint64, int]: """ + if self._data.size == 1: + return int(self._data.reg_bytes[0]) + return self._data.reg_bytes + + @reg_bytes.setter + def reg_bytes(self, val): + self._data.reg_bytes = val + + def __getitem__(self, key): + cdef ssize_t key_ + cdef ssize_t size + if isinstance(key, int): + key_ = key + size = self._data.size + if key_ >= size or key_ <= -(size+1): + raise IndexError("index is out of bounds") + if key_ < 0: + key_ += size + return PerGpuStats.from_data(self._data[key_:key_+1]) + out = self._data[key] + if isinstance(out, _numpy.recarray) and out.dtype == per_gpu_stats_dtype: + return PerGpuStats.from_data(out) + return out + + def __setitem__(self, key, val): + self._data[key] = val + + @staticmethod + def from_buffer(buffer): + """Create an PerGpuStats instance with the memory from the given buffer.""" + return PerGpuStats.from_data(_numpy.frombuffer(buffer, dtype=per_gpu_stats_dtype)) + + @staticmethod + def from_data(data): + """Create an PerGpuStats instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a 1D array of dtype `per_gpu_stats_dtype` holding the data. + """ + cdef PerGpuStats obj = PerGpuStats.__new__(PerGpuStats) + if not isinstance(data, _numpy.ndarray): + raise TypeError("data argument must be a NumPy ndarray") + if data.ndim != 1: + raise ValueError("data array must be 1D") + if data.dtype != per_gpu_stats_dtype: + raise ValueError("data array must be of dtype per_gpu_stats_dtype") + obj._data = data.view(_numpy.recarray) + + return obj + + @staticmethod + def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False): + """Create an PerGpuStats instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + size (int): number of structs, default=1. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef PerGpuStats obj = PerGpuStats.__new__(PerGpuStats) + cdef flag = _cyb_cpython_buffer.PyBUF_READ if readonly else _cyb_cpython_buffer.PyBUF_WRITE + cdef object buf = _cyb_cpython_memoryview.PyMemoryView_FromMemory( + ptr, sizeof(CUfilePerGpuStats_t) * size, flag) + data = _numpy.ndarray(size, buffer=buf, dtype=per_gpu_stats_dtype) + obj._data = data.view(_numpy.recarray) + + return obj + + +cdef _get_descr_dtype_offsets(): + cdef CUfileDescr_t pod + return _numpy.dtype({ + 'names': ['type', 'handle', 'fs_ops'], + 'formats': [_numpy.int32, _py_anon_pod1_dtype, _numpy.intp], + 'offsets': [ + (&(pod.type)) - (&pod), + (&(pod.handle)) - (&pod), + (&(pod.fs_ops)) - (&pod), + ], + 'itemsize': sizeof(CUfileDescr_t), + }) + +descr_dtype = _get_descr_dtype_offsets() + +cdef class Descr: + """Empty-initialize an array of `CUfileDescr_t`. + The resulting object is of length `size` and of dtype `descr_dtype`. + If default-constructed, the instance represents a single struct. + + Args: + size (int): number of structs, default=1. + + .. seealso:: `CUfileDescr_t` + """ + cdef: + readonly object _data + + def __init__(self, size=1): + arr = _numpy.empty(size, dtype=descr_dtype) + self._data = arr.view(_numpy.recarray) + assert self._data.itemsize == sizeof(CUfileDescr_t), \ + f"itemsize {self._data.itemsize} mismatches struct size { sizeof(CUfileDescr_t) }" + + def __repr__(self): + if self._data.size > 1: + return f"<{__name__}.Descr_Array_{self._data.size} object at {hex(id(self))}>" + else: + return f"<{__name__}.Descr object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return self._data.ctypes.data + + cdef intptr_t _get_ptr(self): + return self._data.ctypes.data + + def __int__(self): + if self._data.size > 1: + raise TypeError("int() argument must be a bytes-like object of size 1. " + "To get the pointer address of an array, use .ptr") + return self._data.ctypes.data + + def __len__(self): + return self._data.size + + def __eq__(self, other): + cdef object self_data = self._data + if (not isinstance(other, Descr)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype: + return False + return bool((self_data == other._data).all()) + + def __getbuffer__(self, Py_buffer *buffer, int flags): + _cyb_cpython.PyObject_GetBuffer(self._data, buffer, flags) + + def __releasebuffer__(self, Py_buffer *buffer): + _cyb_cpython.PyBuffer_Release(buffer) + + @property + def type(self): + """Union[~_numpy.int32, int]: """ + if self._data.size == 1: + return int(self._data.type[0]) + return self._data.type + + @type.setter + def type(self, val): + self._data.type = val + + @property + def handle(self): + """_py_anon_pod1_dtype: """ + return self._data.handle + + @handle.setter + def handle(self, val): + self._data.handle = val + + @property + def fs_ops(self): + """Union[~_numpy.intp, int]: """ + if self._data.size == 1: + return int(self._data.fs_ops[0]) + return self._data.fs_ops + + @fs_ops.setter + def fs_ops(self, val): + self._data.fs_ops = val + + def __getitem__(self, key): + cdef ssize_t key_ + cdef ssize_t size + if isinstance(key, int): + key_ = key + size = self._data.size + if key_ >= size or key_ <= -(size+1): + raise IndexError("index is out of bounds") + if key_ < 0: + key_ += size + return Descr.from_data(self._data[key_:key_+1]) + out = self._data[key] + if isinstance(out, _numpy.recarray) and out.dtype == descr_dtype: + return Descr.from_data(out) + return out + + def __setitem__(self, key, val): + self._data[key] = val + + @staticmethod + def from_buffer(buffer): + """Create an Descr instance with the memory from the given buffer.""" + return Descr.from_data(_numpy.frombuffer(buffer, dtype=descr_dtype)) + + @staticmethod + def from_data(data): + """Create an Descr instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a 1D array of dtype `descr_dtype` holding the data. + """ + cdef Descr obj = Descr.__new__(Descr) + if not isinstance(data, _numpy.ndarray): + raise TypeError("data argument must be a NumPy ndarray") + if data.ndim != 1: + raise ValueError("data array must be 1D") + if data.dtype != descr_dtype: + raise ValueError("data array must be of dtype descr_dtype") + obj._data = data.view(_numpy.recarray) + + return obj + + @staticmethod + def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False): + """Create an Descr instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + size (int): number of structs, default=1. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef Descr obj = Descr.__new__(Descr) + cdef flag = _cyb_cpython_buffer.PyBUF_READ if readonly else _cyb_cpython_buffer.PyBUF_WRITE + cdef object buf = _cyb_cpython_memoryview.PyMemoryView_FromMemory( + ptr, sizeof(CUfileDescr_t) * size, flag) + data = _numpy.ndarray(size, buffer=buf, dtype=descr_dtype) + obj._data = data.view(_numpy.recarray) + + return obj + + +_py_anon_pod2_dtype = _numpy.dtype(( + _numpy.dtype((_numpy.void, sizeof((NULL).u))), + { + "batch": (_py_anon_pod3_dtype, 0), + } + )) + +cdef class _py_anon_pod2: + """Empty-initialize an instance of `cuda_bindings_cufile__anon_pod2`. + + + .. seealso:: `cuda_bindings_cufile__anon_pod2` + """ + cdef: + cuda_bindings_cufile__anon_pod2 *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof((NULL).u)) + if self._ptr == NULL: + raise MemoryError("Error allocating _py_anon_pod2") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef cuda_bindings_cufile__anon_pod2 *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}._py_anon_pod2 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef _py_anon_pod2 other_ + if not isinstance(other, _py_anon_pod2): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof((NULL).u)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof((NULL).u), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof((NULL).u)) + if self._ptr == NULL: + raise MemoryError("Error allocating _py_anon_pod2") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof((NULL).u)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def batch(self): + """_py_anon_pod3: """ + return _py_anon_pod3.from_ptr(&(self._ptr[0].batch), self._readonly, self) + + @batch.setter + def batch(self, val): + if self._readonly: + raise ValueError("This _py_anon_pod2 instance is read-only") + cdef _py_anon_pod3 val_ = val + _cyb_memcpy(&(self._ptr[0].batch), (val_._get_ptr()), sizeof(cuda_bindings_cufile__anon_pod3) * 1) + + @staticmethod + def from_buffer(buffer): + """Create an _py_anon_pod2 instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof((NULL).u), _py_anon_pod2) + + @staticmethod + def from_data(data): + """Create an _py_anon_pod2 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `_py_anon_pod2_dtype` holding the data. + """ + return _cyb_from_data(data, "_py_anon_pod2_dtype", _py_anon_pod2_dtype, _py_anon_pod2) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an _py_anon_pod2 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef _py_anon_pod2 obj = _py_anon_pod2.__new__(_py_anon_pod2) + if owner is None: + obj._ptr = _cyb_malloc(sizeof((NULL).u)) + if obj._ptr == NULL: + raise MemoryError("Error allocating _py_anon_pod2") + _cyb_memcpy((obj._ptr), ptr, sizeof((NULL).u)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_stats_level1_dtype_offsets(): + cdef CUfileStatsLevel1_t pod + return _numpy.dtype({ + 'names': ['read_ops', 'write_ops', 'hdl_register_ops', 'hdl_deregister_ops', 'buf_register_ops', 'buf_deregister_ops', 'read_bytes', 'write_bytes', 'read_bw_bytes_per_sec', 'write_bw_bytes_per_sec', 'read_lat_avg_us', 'write_lat_avg_us', 'read_ops_per_sec', 'write_ops_per_sec', 'read_lat_sum_us', 'write_lat_sum_us', 'batch_submit_ops', 'batch_complete_ops', 'batch_setup_ops', 'batch_cancel_ops', 'batch_destroy_ops', 'batch_enqueued_ops', 'batch_posix_enqueued_ops', 'batch_processed_ops', 'batch_posix_processed_ops', 'batch_nvfs_submit_ops', 'batch_p2p_submit_ops', 'batch_aio_submit_ops', 'batch_iouring_submit_ops', 'batch_mixed_io_submit_ops', 'batch_total_submit_ops', 'batch_read_bytes', 'batch_write_bytes', 'batch_read_bw_bytes', 'batch_write_bw_bytes', 'batch_submit_lat_avg_us', 'batch_completion_lat_avg_us', 'batch_submit_ops_per_sec', 'batch_complete_ops_per_sec', 'batch_submit_lat_sum_us', 'batch_completion_lat_sum_us', 'last_batch_read_bytes', 'last_batch_write_bytes'], + 'formats': [op_counter_dtype, op_counter_dtype, op_counter_dtype, op_counter_dtype, op_counter_dtype, op_counter_dtype, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, op_counter_dtype, op_counter_dtype, op_counter_dtype, op_counter_dtype, op_counter_dtype, op_counter_dtype, op_counter_dtype, op_counter_dtype, op_counter_dtype, op_counter_dtype, op_counter_dtype, op_counter_dtype, op_counter_dtype, op_counter_dtype, op_counter_dtype, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64], + 'offsets': [ + (&(pod.read_ops)) - (&pod), + (&(pod.write_ops)) - (&pod), + (&(pod.hdl_register_ops)) - (&pod), + (&(pod.hdl_deregister_ops)) - (&pod), + (&(pod.buf_register_ops)) - (&pod), + (&(pod.buf_deregister_ops)) - (&pod), + (&(pod.read_bytes)) - (&pod), + (&(pod.write_bytes)) - (&pod), + (&(pod.read_bw_bytes_per_sec)) - (&pod), + (&(pod.write_bw_bytes_per_sec)) - (&pod), + (&(pod.read_lat_avg_us)) - (&pod), + (&(pod.write_lat_avg_us)) - (&pod), + (&(pod.read_ops_per_sec)) - (&pod), + (&(pod.write_ops_per_sec)) - (&pod), + (&(pod.read_lat_sum_us)) - (&pod), + (&(pod.write_lat_sum_us)) - (&pod), + (&(pod.batch_submit_ops)) - (&pod), + (&(pod.batch_complete_ops)) - (&pod), + (&(pod.batch_setup_ops)) - (&pod), + (&(pod.batch_cancel_ops)) - (&pod), + (&(pod.batch_destroy_ops)) - (&pod), + (&(pod.batch_enqueued_ops)) - (&pod), + (&(pod.batch_posix_enqueued_ops)) - (&pod), + (&(pod.batch_processed_ops)) - (&pod), + (&(pod.batch_posix_processed_ops)) - (&pod), + (&(pod.batch_nvfs_submit_ops)) - (&pod), + (&(pod.batch_p2p_submit_ops)) - (&pod), + (&(pod.batch_aio_submit_ops)) - (&pod), + (&(pod.batch_iouring_submit_ops)) - (&pod), + (&(pod.batch_mixed_io_submit_ops)) - (&pod), + (&(pod.batch_total_submit_ops)) - (&pod), + (&(pod.batch_read_bytes)) - (&pod), + (&(pod.batch_write_bytes)) - (&pod), + (&(pod.batch_read_bw_bytes)) - (&pod), + (&(pod.batch_write_bw_bytes)) - (&pod), + (&(pod.batch_submit_lat_avg_us)) - (&pod), + (&(pod.batch_completion_lat_avg_us)) - (&pod), + (&(pod.batch_submit_ops_per_sec)) - (&pod), + (&(pod.batch_complete_ops_per_sec)) - (&pod), + (&(pod.batch_submit_lat_sum_us)) - (&pod), + (&(pod.batch_completion_lat_sum_us)) - (&pod), + (&(pod.last_batch_read_bytes)) - (&pod), + (&(pod.last_batch_write_bytes)) - (&pod), + ], + 'itemsize': sizeof(CUfileStatsLevel1_t), + }) + +stats_level1_dtype = _get_stats_level1_dtype_offsets() + +cdef class StatsLevel1: + """Empty-initialize an instance of `CUfileStatsLevel1_t`. + + + .. seealso:: `CUfileStatsLevel1_t` + """ + cdef: + CUfileStatsLevel1_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(CUfileStatsLevel1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating StatsLevel1") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef CUfileStatsLevel1_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.StatsLevel1 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef StatsLevel1 other_ + if not isinstance(other, StatsLevel1): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(CUfileStatsLevel1_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(CUfileStatsLevel1_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(CUfileStatsLevel1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating StatsLevel1") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(CUfileStatsLevel1_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def read_ops(self): + """OpCounter: """ + return OpCounter.from_ptr(&(self._ptr[0].read_ops), self._readonly, self) + + @read_ops.setter + def read_ops(self, val): + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + cdef OpCounter val_ = val + _cyb_memcpy(&(self._ptr[0].read_ops), (val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) + + @property + def write_ops(self): + """OpCounter: """ + return OpCounter.from_ptr(&(self._ptr[0].write_ops), self._readonly, self) + + @write_ops.setter + def write_ops(self, val): + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + cdef OpCounter val_ = val + _cyb_memcpy(&(self._ptr[0].write_ops), (val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) + + @property + def hdl_register_ops(self): + """OpCounter: """ + return OpCounter.from_ptr(&(self._ptr[0].hdl_register_ops), self._readonly, self) + + @hdl_register_ops.setter + def hdl_register_ops(self, val): + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + cdef OpCounter val_ = val + _cyb_memcpy(&(self._ptr[0].hdl_register_ops), (val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) + + @property + def hdl_deregister_ops(self): + """OpCounter: """ + return OpCounter.from_ptr(&(self._ptr[0].hdl_deregister_ops), self._readonly, self) + + @hdl_deregister_ops.setter + def hdl_deregister_ops(self, val): + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + cdef OpCounter val_ = val + _cyb_memcpy(&(self._ptr[0].hdl_deregister_ops), (val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) + + @property + def buf_register_ops(self): + """OpCounter: """ + return OpCounter.from_ptr(&(self._ptr[0].buf_register_ops), self._readonly, self) + + @buf_register_ops.setter + def buf_register_ops(self, val): + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + cdef OpCounter val_ = val + _cyb_memcpy(&(self._ptr[0].buf_register_ops), (val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) + + @property + def buf_deregister_ops(self): + """OpCounter: """ + return OpCounter.from_ptr(&(self._ptr[0].buf_deregister_ops), self._readonly, self) + + @buf_deregister_ops.setter + def buf_deregister_ops(self, val): + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + cdef OpCounter val_ = val + _cyb_memcpy(&(self._ptr[0].buf_deregister_ops), (val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) + + @property + def batch_submit_ops(self): + """OpCounter: """ + return OpCounter.from_ptr(&(self._ptr[0].batch_submit_ops), self._readonly, self) + + @batch_submit_ops.setter + def batch_submit_ops(self, val): + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + cdef OpCounter val_ = val + _cyb_memcpy(&(self._ptr[0].batch_submit_ops), (val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) + + @property + def batch_complete_ops(self): + """OpCounter: """ + return OpCounter.from_ptr(&(self._ptr[0].batch_complete_ops), self._readonly, self) + + @batch_complete_ops.setter + def batch_complete_ops(self, val): + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + cdef OpCounter val_ = val + _cyb_memcpy(&(self._ptr[0].batch_complete_ops), (val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) + + @property + def batch_setup_ops(self): + """OpCounter: """ + return OpCounter.from_ptr(&(self._ptr[0].batch_setup_ops), self._readonly, self) + + @batch_setup_ops.setter + def batch_setup_ops(self, val): + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + cdef OpCounter val_ = val + _cyb_memcpy(&(self._ptr[0].batch_setup_ops), (val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) + + @property + def batch_cancel_ops(self): + """OpCounter: """ + return OpCounter.from_ptr(&(self._ptr[0].batch_cancel_ops), self._readonly, self) + + @batch_cancel_ops.setter + def batch_cancel_ops(self, val): + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + cdef OpCounter val_ = val + _cyb_memcpy(&(self._ptr[0].batch_cancel_ops), (val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) + + @property + def batch_destroy_ops(self): + """OpCounter: """ + return OpCounter.from_ptr(&(self._ptr[0].batch_destroy_ops), self._readonly, self) + + @batch_destroy_ops.setter + def batch_destroy_ops(self, val): + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + cdef OpCounter val_ = val + _cyb_memcpy(&(self._ptr[0].batch_destroy_ops), (val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) + + @property + def batch_enqueued_ops(self): + """OpCounter: """ + return OpCounter.from_ptr(&(self._ptr[0].batch_enqueued_ops), self._readonly, self) + + @batch_enqueued_ops.setter + def batch_enqueued_ops(self, val): + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + cdef OpCounter val_ = val + _cyb_memcpy(&(self._ptr[0].batch_enqueued_ops), (val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) + + @property + def batch_posix_enqueued_ops(self): + """OpCounter: """ + return OpCounter.from_ptr(&(self._ptr[0].batch_posix_enqueued_ops), self._readonly, self) + + @batch_posix_enqueued_ops.setter + def batch_posix_enqueued_ops(self, val): + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + cdef OpCounter val_ = val + _cyb_memcpy(&(self._ptr[0].batch_posix_enqueued_ops), (val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) + + @property + def batch_processed_ops(self): + """OpCounter: """ + return OpCounter.from_ptr(&(self._ptr[0].batch_processed_ops), self._readonly, self) + + @batch_processed_ops.setter + def batch_processed_ops(self, val): + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + cdef OpCounter val_ = val + _cyb_memcpy(&(self._ptr[0].batch_processed_ops), (val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) + + @property + def batch_posix_processed_ops(self): + """OpCounter: """ + return OpCounter.from_ptr(&(self._ptr[0].batch_posix_processed_ops), self._readonly, self) + + @batch_posix_processed_ops.setter + def batch_posix_processed_ops(self, val): + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + cdef OpCounter val_ = val + _cyb_memcpy(&(self._ptr[0].batch_posix_processed_ops), (val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) + + @property + def batch_nvfs_submit_ops(self): + """OpCounter: """ + return OpCounter.from_ptr(&(self._ptr[0].batch_nvfs_submit_ops), self._readonly, self) + + @batch_nvfs_submit_ops.setter + def batch_nvfs_submit_ops(self, val): + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + cdef OpCounter val_ = val + _cyb_memcpy(&(self._ptr[0].batch_nvfs_submit_ops), (val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) + + @property + def batch_p2p_submit_ops(self): + """OpCounter: """ + return OpCounter.from_ptr(&(self._ptr[0].batch_p2p_submit_ops), self._readonly, self) + + @batch_p2p_submit_ops.setter + def batch_p2p_submit_ops(self, val): + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + cdef OpCounter val_ = val + _cyb_memcpy(&(self._ptr[0].batch_p2p_submit_ops), (val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) + + @property + def batch_aio_submit_ops(self): + """OpCounter: """ + return OpCounter.from_ptr(&(self._ptr[0].batch_aio_submit_ops), self._readonly, self) + + @batch_aio_submit_ops.setter + def batch_aio_submit_ops(self, val): + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + cdef OpCounter val_ = val + _cyb_memcpy(&(self._ptr[0].batch_aio_submit_ops), (val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) + + @property + def batch_iouring_submit_ops(self): + """OpCounter: """ + return OpCounter.from_ptr(&(self._ptr[0].batch_iouring_submit_ops), self._readonly, self) + + @batch_iouring_submit_ops.setter + def batch_iouring_submit_ops(self, val): + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + cdef OpCounter val_ = val + _cyb_memcpy(&(self._ptr[0].batch_iouring_submit_ops), (val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) + + @property + def batch_mixed_io_submit_ops(self): + """OpCounter: """ + return OpCounter.from_ptr(&(self._ptr[0].batch_mixed_io_submit_ops), self._readonly, self) + + @batch_mixed_io_submit_ops.setter + def batch_mixed_io_submit_ops(self, val): + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + cdef OpCounter val_ = val + _cyb_memcpy(&(self._ptr[0].batch_mixed_io_submit_ops), (val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) + + @property + def batch_total_submit_ops(self): + """OpCounter: """ + return OpCounter.from_ptr(&(self._ptr[0].batch_total_submit_ops), self._readonly, self) + + @batch_total_submit_ops.setter + def batch_total_submit_ops(self, val): + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + cdef OpCounter val_ = val + _cyb_memcpy(&(self._ptr[0].batch_total_submit_ops), (val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) + + @property + def read_bytes(self): + """int: """ + return self._ptr[0].read_bytes + + @read_bytes.setter + def read_bytes(self, val): + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + self._ptr[0].read_bytes = val + + @property + def write_bytes(self): + """int: """ + return self._ptr[0].write_bytes + + @write_bytes.setter + def write_bytes(self, val): + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + self._ptr[0].write_bytes = val + + @property + def read_bw_bytes_per_sec(self): + """int: """ + return self._ptr[0].read_bw_bytes_per_sec + + @read_bw_bytes_per_sec.setter + def read_bw_bytes_per_sec(self, val): + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + self._ptr[0].read_bw_bytes_per_sec = val + + @property + def write_bw_bytes_per_sec(self): + """int: """ + return self._ptr[0].write_bw_bytes_per_sec + + @write_bw_bytes_per_sec.setter + def write_bw_bytes_per_sec(self, val): + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + self._ptr[0].write_bw_bytes_per_sec = val + + @property + def read_lat_avg_us(self): + """int: """ + return self._ptr[0].read_lat_avg_us + + @read_lat_avg_us.setter + def read_lat_avg_us(self, val): + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + self._ptr[0].read_lat_avg_us = val + + @property + def write_lat_avg_us(self): + """int: """ + return self._ptr[0].write_lat_avg_us + + @write_lat_avg_us.setter + def write_lat_avg_us(self, val): + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + self._ptr[0].write_lat_avg_us = val + + @property + def read_ops_per_sec(self): + """int: """ + return self._ptr[0].read_ops_per_sec + + @read_ops_per_sec.setter + def read_ops_per_sec(self, val): + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + self._ptr[0].read_ops_per_sec = val + + @property + def write_ops_per_sec(self): + """int: """ + return self._ptr[0].write_ops_per_sec + + @write_ops_per_sec.setter + def write_ops_per_sec(self, val): + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + self._ptr[0].write_ops_per_sec = val + + @property + def read_lat_sum_us(self): + """int: """ + return self._ptr[0].read_lat_sum_us + + @read_lat_sum_us.setter + def read_lat_sum_us(self, val): + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + self._ptr[0].read_lat_sum_us = val + + @property + def write_lat_sum_us(self): + """int: """ + return self._ptr[0].write_lat_sum_us + + @write_lat_sum_us.setter + def write_lat_sum_us(self, val): + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + self._ptr[0].write_lat_sum_us = val + + @property + def batch_read_bytes(self): + """int: """ + return self._ptr[0].batch_read_bytes + + @batch_read_bytes.setter + def batch_read_bytes(self, val): + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + self._ptr[0].batch_read_bytes = val + + @property + def batch_write_bytes(self): + """int: """ + return self._ptr[0].batch_write_bytes + + @batch_write_bytes.setter + def batch_write_bytes(self, val): + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + self._ptr[0].batch_write_bytes = val + + @property + def batch_read_bw_bytes(self): + """int: """ + return self._ptr[0].batch_read_bw_bytes + + @batch_read_bw_bytes.setter + def batch_read_bw_bytes(self, val): + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + self._ptr[0].batch_read_bw_bytes = val + + @property + def batch_write_bw_bytes(self): + """int: """ + return self._ptr[0].batch_write_bw_bytes + + @batch_write_bw_bytes.setter + def batch_write_bw_bytes(self, val): + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + self._ptr[0].batch_write_bw_bytes = val + + @property + def batch_submit_lat_avg_us(self): + """int: """ + return self._ptr[0].batch_submit_lat_avg_us + + @batch_submit_lat_avg_us.setter + def batch_submit_lat_avg_us(self, val): + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + self._ptr[0].batch_submit_lat_avg_us = val + + @property + def batch_completion_lat_avg_us(self): + """int: """ + return self._ptr[0].batch_completion_lat_avg_us + + @batch_completion_lat_avg_us.setter + def batch_completion_lat_avg_us(self, val): + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + self._ptr[0].batch_completion_lat_avg_us = val + + @property + def batch_submit_ops_per_sec(self): + """int: """ + return self._ptr[0].batch_submit_ops_per_sec + + @batch_submit_ops_per_sec.setter + def batch_submit_ops_per_sec(self, val): + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + self._ptr[0].batch_submit_ops_per_sec = val + + @property + def batch_complete_ops_per_sec(self): + """int: """ + return self._ptr[0].batch_complete_ops_per_sec + + @batch_complete_ops_per_sec.setter + def batch_complete_ops_per_sec(self, val): + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + self._ptr[0].batch_complete_ops_per_sec = val + + @property + def batch_submit_lat_sum_us(self): + """int: """ + return self._ptr[0].batch_submit_lat_sum_us + + @batch_submit_lat_sum_us.setter + def batch_submit_lat_sum_us(self, val): + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + self._ptr[0].batch_submit_lat_sum_us = val + + @property + def batch_completion_lat_sum_us(self): + """int: """ + return self._ptr[0].batch_completion_lat_sum_us + + @batch_completion_lat_sum_us.setter + def batch_completion_lat_sum_us(self, val): + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + self._ptr[0].batch_completion_lat_sum_us = val + + @property + def last_batch_read_bytes(self): + """int: """ + return self._ptr[0].last_batch_read_bytes + + @last_batch_read_bytes.setter + def last_batch_read_bytes(self, val): + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + self._ptr[0].last_batch_read_bytes = val + + @property + def last_batch_write_bytes(self): + """int: """ + return self._ptr[0].last_batch_write_bytes + + @last_batch_write_bytes.setter + def last_batch_write_bytes(self, val): + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + self._ptr[0].last_batch_write_bytes = val + + @staticmethod + def from_buffer(buffer): + """Create an StatsLevel1 instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(CUfileStatsLevel1_t), StatsLevel1) + + @staticmethod + def from_data(data): + """Create an StatsLevel1 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `stats_level1_dtype` holding the data. + """ + return _cyb_from_data(data, "stats_level1_dtype", stats_level1_dtype, StatsLevel1) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an StatsLevel1 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef StatsLevel1 obj = StatsLevel1.__new__(StatsLevel1) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(CUfileStatsLevel1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating StatsLevel1") + _cyb_memcpy((obj._ptr), ptr, sizeof(CUfileStatsLevel1_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_io_params_dtype_offsets(): + cdef CUfileIOParams_t pod + return _numpy.dtype({ + 'names': ['mode', 'u', 'fh', 'opcode', 'cookie'], + 'formats': [_numpy.int32, _py_anon_pod2_dtype, _numpy.intp, _numpy.int32, _numpy.intp], + 'offsets': [ + (&(pod.mode)) - (&pod), + (&(pod.u)) - (&pod), + (&(pod.fh)) - (&pod), + (&(pod.opcode)) - (&pod), + (&(pod.cookie)) - (&pod), + ], + 'itemsize': sizeof(CUfileIOParams_t), + }) + +io_params_dtype = _get_io_params_dtype_offsets() + +cdef class IOParams: + """Empty-initialize an array of `CUfileIOParams_t`. + The resulting object is of length `size` and of dtype `io_params_dtype`. + If default-constructed, the instance represents a single struct. + + Args: + size (int): number of structs, default=1. + + .. seealso:: `CUfileIOParams_t` + """ + cdef: + readonly object _data + + def __init__(self, size=1): + arr = _numpy.empty(size, dtype=io_params_dtype) + self._data = arr.view(_numpy.recarray) + assert self._data.itemsize == sizeof(CUfileIOParams_t), \ + f"itemsize {self._data.itemsize} mismatches struct size { sizeof(CUfileIOParams_t) }" + + def __repr__(self): + if self._data.size > 1: + return f"<{__name__}.IOParams_Array_{self._data.size} object at {hex(id(self))}>" + else: + return f"<{__name__}.IOParams object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return self._data.ctypes.data + + cdef intptr_t _get_ptr(self): + return self._data.ctypes.data + + def __int__(self): + if self._data.size > 1: + raise TypeError("int() argument must be a bytes-like object of size 1. " + "To get the pointer address of an array, use .ptr") + return self._data.ctypes.data + + def __len__(self): + return self._data.size + + def __eq__(self, other): + cdef object self_data = self._data + if (not isinstance(other, IOParams)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype: + return False + return bool((self_data == other._data).all()) + + def __getbuffer__(self, Py_buffer *buffer, int flags): + _cyb_cpython.PyObject_GetBuffer(self._data, buffer, flags) + + def __releasebuffer__(self, Py_buffer *buffer): + _cyb_cpython.PyBuffer_Release(buffer) + + @property + def mode(self): + """Union[~_numpy.int32, int]: """ + if self._data.size == 1: + return int(self._data.mode[0]) + return self._data.mode + + @mode.setter + def mode(self, val): + self._data.mode = val + + @property + def u(self): + """_py_anon_pod2_dtype: """ + return self._data.u + + @u.setter + def u(self, val): + self._data.u = val + + @property + def fh(self): + """Union[~_numpy.intp, int]: """ + if self._data.size == 1: + return int(self._data.fh[0]) + return self._data.fh + + @fh.setter + def fh(self, val): + self._data.fh = val + + @property + def opcode(self): + """Union[~_numpy.int32, int]: """ + if self._data.size == 1: + return int(self._data.opcode[0]) + return self._data.opcode + + @opcode.setter + def opcode(self, val): + self._data.opcode = val + + @property + def cookie(self): + """Union[~_numpy.intp, int]: """ + if self._data.size == 1: + return int(self._data.cookie[0]) + return self._data.cookie + + @cookie.setter + def cookie(self, val): + self._data.cookie = val + + def __getitem__(self, key): + cdef ssize_t key_ + cdef ssize_t size + if isinstance(key, int): + key_ = key + size = self._data.size + if key_ >= size or key_ <= -(size+1): + raise IndexError("index is out of bounds") + if key_ < 0: + key_ += size + return IOParams.from_data(self._data[key_:key_+1]) + out = self._data[key] + if isinstance(out, _numpy.recarray) and out.dtype == io_params_dtype: + return IOParams.from_data(out) + return out + + def __setitem__(self, key, val): + self._data[key] = val + + @staticmethod + def from_buffer(buffer): + """Create an IOParams instance with the memory from the given buffer.""" + return IOParams.from_data(_numpy.frombuffer(buffer, dtype=io_params_dtype)) + + @staticmethod + def from_data(data): + """Create an IOParams instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a 1D array of dtype `io_params_dtype` holding the data. + """ + cdef IOParams obj = IOParams.__new__(IOParams) + if not isinstance(data, _numpy.ndarray): + raise TypeError("data argument must be a NumPy ndarray") + if data.ndim != 1: + raise ValueError("data array must be 1D") + if data.dtype != io_params_dtype: + raise ValueError("data array must be of dtype io_params_dtype") + obj._data = data.view(_numpy.recarray) + + return obj + + @staticmethod + def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False): + """Create an IOParams instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + size (int): number of structs, default=1. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef IOParams obj = IOParams.__new__(IOParams) + cdef flag = _cyb_cpython_buffer.PyBUF_READ if readonly else _cyb_cpython_buffer.PyBUF_WRITE + cdef object buf = _cyb_cpython_memoryview.PyMemoryView_FromMemory( + ptr, sizeof(CUfileIOParams_t) * size, flag) + data = _numpy.ndarray(size, buffer=buf, dtype=io_params_dtype) + obj._data = data.view(_numpy.recarray) + + return obj + + +cdef _get_stats_level2_dtype_offsets(): + cdef CUfileStatsLevel2_t pod + return _numpy.dtype({ + 'names': ['basic', 'read_size_kb_hist', 'write_size_kb_hist'], + 'formats': [stats_level1_dtype, (_numpy.uint64, 32), (_numpy.uint64, 32)], + 'offsets': [ + (&(pod.basic)) - (&pod), + (&(pod.read_size_kb_hist)) - (&pod), + (&(pod.write_size_kb_hist)) - (&pod), + ], + 'itemsize': sizeof(CUfileStatsLevel2_t), + }) + +stats_level2_dtype = _get_stats_level2_dtype_offsets() + +cdef class StatsLevel2: + """Empty-initialize an instance of `CUfileStatsLevel2_t`. + + + .. seealso:: `CUfileStatsLevel2_t` + """ + cdef: + CUfileStatsLevel2_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(CUfileStatsLevel2_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating StatsLevel2") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef CUfileStatsLevel2_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.StatsLevel2 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef StatsLevel2 other_ + if not isinstance(other, StatsLevel2): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(CUfileStatsLevel2_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(CUfileStatsLevel2_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(CUfileStatsLevel2_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating StatsLevel2") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(CUfileStatsLevel2_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def basic(self): + """StatsLevel1: """ + return StatsLevel1.from_ptr(&(self._ptr[0].basic), self._readonly, self) + + @basic.setter + def basic(self, val): + if self._readonly: + raise ValueError("This StatsLevel2 instance is read-only") + cdef StatsLevel1 val_ = val + _cyb_memcpy(&(self._ptr[0].basic), (val_._get_ptr()), sizeof(CUfileStatsLevel1_t) * 1) + + @property + def read_size_kb_hist(self): + """~_numpy.uint64: (array of length 32).""" + cdef _cyb_view.array arr = _cyb_view.array(shape=(32,), itemsize=sizeof(uint64_t), format="Q", mode="c", allocate_buffer=False) + arr.data = (&(self._ptr[0].read_size_kb_hist)) + return _numpy.asarray(arr) + + @read_size_kb_hist.setter + def read_size_kb_hist(self, val): + if self._readonly: + raise ValueError("This StatsLevel2 instance is read-only") + if len(val) != 32: + raise ValueError(f"Expected length { 32 } for field read_size_kb_hist, got {len(val)}") + cdef _cyb_view.array arr = _cyb_view.array(shape=(32,), itemsize=sizeof(uint64_t), format="Q", mode="c") + arr[:] = _numpy.asarray(val, dtype=_numpy.uint64) + _cyb_memcpy((&(self._ptr[0].read_size_kb_hist)), (arr.data), sizeof(uint64_t) * len(val)) + + @property + def write_size_kb_hist(self): + """~_numpy.uint64: (array of length 32).""" + cdef _cyb_view.array arr = _cyb_view.array(shape=(32,), itemsize=sizeof(uint64_t), format="Q", mode="c", allocate_buffer=False) + arr.data = (&(self._ptr[0].write_size_kb_hist)) + return _numpy.asarray(arr) + + @write_size_kb_hist.setter + def write_size_kb_hist(self, val): + if self._readonly: + raise ValueError("This StatsLevel2 instance is read-only") + if len(val) != 32: + raise ValueError(f"Expected length { 32 } for field write_size_kb_hist, got {len(val)}") + cdef _cyb_view.array arr = _cyb_view.array(shape=(32,), itemsize=sizeof(uint64_t), format="Q", mode="c") + arr[:] = _numpy.asarray(val, dtype=_numpy.uint64) + _cyb_memcpy((&(self._ptr[0].write_size_kb_hist)), (arr.data), sizeof(uint64_t) * len(val)) + + @staticmethod + def from_buffer(buffer): + """Create an StatsLevel2 instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(CUfileStatsLevel2_t), StatsLevel2) + + @staticmethod + def from_data(data): + """Create an StatsLevel2 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `stats_level2_dtype` holding the data. + """ + return _cyb_from_data(data, "stats_level2_dtype", stats_level2_dtype, StatsLevel2) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an StatsLevel2 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef StatsLevel2 obj = StatsLevel2.__new__(StatsLevel2) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(CUfileStatsLevel2_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating StatsLevel2") + _cyb_memcpy((obj._ptr), ptr, sizeof(CUfileStatsLevel2_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_stats_level3_dtype_offsets(): + cdef CUfileStatsLevel3_t pod + return _numpy.dtype({ + 'names': ['detailed', 'num_gpus', 'per_gpu_stats'], + 'formats': [stats_level2_dtype, _numpy.uint32, (per_gpu_stats_dtype, 16)], + 'offsets': [ + (&(pod.detailed)) - (&pod), + (&(pod.num_gpus)) - (&pod), + (&(pod.per_gpu_stats)) - (&pod), + ], + 'itemsize': sizeof(CUfileStatsLevel3_t), + }) + +stats_level3_dtype = _get_stats_level3_dtype_offsets() + +cdef class StatsLevel3: + """Empty-initialize an instance of `CUfileStatsLevel3_t`. + + + .. seealso:: `CUfileStatsLevel3_t` + """ + cdef: + CUfileStatsLevel3_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(CUfileStatsLevel3_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating StatsLevel3") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef CUfileStatsLevel3_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.StatsLevel3 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef StatsLevel3 other_ + if not isinstance(other, StatsLevel3): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(CUfileStatsLevel3_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(CUfileStatsLevel3_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(CUfileStatsLevel3_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating StatsLevel3") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(CUfileStatsLevel3_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def detailed(self): + """StatsLevel2: """ + return StatsLevel2.from_ptr(&(self._ptr[0].detailed), self._readonly, self) + + @detailed.setter + def detailed(self, val): + if self._readonly: + raise ValueError("This StatsLevel3 instance is read-only") + cdef StatsLevel2 val_ = val + _cyb_memcpy(&(self._ptr[0].detailed), (val_._get_ptr()), sizeof(CUfileStatsLevel2_t) * 1) + + @property + def per_gpu_stats(self): + """PerGpuStats: """ + return PerGpuStats.from_ptr(&(self._ptr[0].per_gpu_stats), 16, self._readonly) + + @per_gpu_stats.setter + def per_gpu_stats(self, val): + if self._readonly: + raise ValueError("This StatsLevel3 instance is read-only") + cdef PerGpuStats val_ = val + if len(val) != 16: + raise ValueError(f"Expected length { 16 } for field per_gpu_stats, got {len(val)}") + _cyb_memcpy(&(self._ptr[0].per_gpu_stats), (val_._get_ptr()), sizeof(CUfilePerGpuStats_t) * 16) + + @property + def num_gpus(self): + """int: """ + return self._ptr[0].num_gpus + + @num_gpus.setter + def num_gpus(self, val): + if self._readonly: + raise ValueError("This StatsLevel3 instance is read-only") + self._ptr[0].num_gpus = val + + @staticmethod + def from_buffer(buffer): + """Create an StatsLevel3 instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(CUfileStatsLevel3_t), StatsLevel3) + + @staticmethod + def from_data(data): + """Create an StatsLevel3 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `stats_level3_dtype` holding the data. + """ + return _cyb_from_data(data, "stats_level3_dtype", stats_level3_dtype, StatsLevel3) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an StatsLevel3 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef StatsLevel3 obj = StatsLevel3.__new__(StatsLevel3) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(CUfileStatsLevel3_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating StatsLevel3") + _cyb_memcpy((obj._ptr), ptr, sizeof(CUfileStatsLevel3_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +############################################################################### +# Enum +############################################################################### + +class OpError(_cyb_FastEnum): + """ + See `CUfileOpError`. + """ + SUCCESS = CU_FILE_SUCCESS + DRIVER_NOT_INITIALIZED = CU_FILE_DRIVER_NOT_INITIALIZED + DRIVER_INVALID_PROPS = CU_FILE_DRIVER_INVALID_PROPS + DRIVER_UNSUPPORTED_LIMIT = CU_FILE_DRIVER_UNSUPPORTED_LIMIT + DRIVER_VERSION_MISMATCH = CU_FILE_DRIVER_VERSION_MISMATCH + DRIVER_VERSION_READ_ERROR = CU_FILE_DRIVER_VERSION_READ_ERROR + DRIVER_CLOSING = CU_FILE_DRIVER_CLOSING + PLATFORM_NOT_SUPPORTED = CU_FILE_PLATFORM_NOT_SUPPORTED + IO_NOT_SUPPORTED = CU_FILE_IO_NOT_SUPPORTED + DEVICE_NOT_SUPPORTED = CU_FILE_DEVICE_NOT_SUPPORTED + NVFS_DRIVER_ERROR = CU_FILE_NVFS_DRIVER_ERROR + CUDA_DRIVER_ERROR = CU_FILE_CUDA_DRIVER_ERROR + CUDA_POINTER_INVALID = CU_FILE_CUDA_POINTER_INVALID + CUDA_MEMORY_TYPE_INVALID = CU_FILE_CUDA_MEMORY_TYPE_INVALID + CUDA_POINTER_RANGE_ERROR = CU_FILE_CUDA_POINTER_RANGE_ERROR + CUDA_CONTEXT_MISMATCH = CU_FILE_CUDA_CONTEXT_MISMATCH + INVALID_MAPPING_SIZE = CU_FILE_INVALID_MAPPING_SIZE + INVALID_MAPPING_RANGE = CU_FILE_INVALID_MAPPING_RANGE + INVALID_FILE_TYPE = CU_FILE_INVALID_FILE_TYPE + INVALID_FILE_OPEN_FLAG = CU_FILE_INVALID_FILE_OPEN_FLAG + DIO_NOT_SET = CU_FILE_DIO_NOT_SET + INVALID_VALUE = CU_FILE_INVALID_VALUE + MEMORY_ALREADY_REGISTERED = CU_FILE_MEMORY_ALREADY_REGISTERED + MEMORY_NOT_REGISTERED = CU_FILE_MEMORY_NOT_REGISTERED + PERMISSION_DENIED = CU_FILE_PERMISSION_DENIED + DRIVER_ALREADY_OPEN = CU_FILE_DRIVER_ALREADY_OPEN + HANDLE_NOT_REGISTERED = CU_FILE_HANDLE_NOT_REGISTERED + HANDLE_ALREADY_REGISTERED = CU_FILE_HANDLE_ALREADY_REGISTERED + DEVICE_NOT_FOUND = CU_FILE_DEVICE_NOT_FOUND + INTERNAL_ERROR = CU_FILE_INTERNAL_ERROR + GETNEWFD_FAILED = CU_FILE_GETNEWFD_FAILED + NVFS_SETUP_ERROR = CU_FILE_NVFS_SETUP_ERROR + IO_DISABLED = CU_FILE_IO_DISABLED + BATCH_SUBMIT_FAILED = CU_FILE_BATCH_SUBMIT_FAILED + GPU_MEMORY_PINNING_FAILED = CU_FILE_GPU_MEMORY_PINNING_FAILED + BATCH_FULL = CU_FILE_BATCH_FULL + ASYNC_NOT_SUPPORTED = CU_FILE_ASYNC_NOT_SUPPORTED + INTERNAL_BATCH_SETUP_ERROR = CU_FILE_INTERNAL_BATCH_SETUP_ERROR + INTERNAL_BATCH_SUBMIT_ERROR = CU_FILE_INTERNAL_BATCH_SUBMIT_ERROR + INTERNAL_BATCH_GETSTATUS_ERROR = CU_FILE_INTERNAL_BATCH_GETSTATUS_ERROR + INTERNAL_BATCH_CANCEL_ERROR = CU_FILE_INTERNAL_BATCH_CANCEL_ERROR + NOMEM_ERROR = CU_FILE_NOMEM_ERROR + IO_ERROR = CU_FILE_IO_ERROR + INTERNAL_BUF_REGISTER_ERROR = CU_FILE_INTERNAL_BUF_REGISTER_ERROR + HASH_OPR_ERROR = CU_FILE_HASH_OPR_ERROR + INVALID_CONTEXT_ERROR = CU_FILE_INVALID_CONTEXT_ERROR + NVFS_INTERNAL_DRIVER_ERROR = CU_FILE_NVFS_INTERNAL_DRIVER_ERROR + BATCH_NOCOMPAT_ERROR = CU_FILE_BATCH_NOCOMPAT_ERROR + IO_MAX_ERROR = CU_FILE_IO_MAX_ERROR + +class DriverStatusFlags(_cyb_FastEnum): + """ + See `CUfileDriverStatusFlags_t`. + """ + LUSTRE_SUPPORTED = (CU_FILE_LUSTRE_SUPPORTED, 'Support for DDN LUSTRE') + WEKAFS_SUPPORTED = (CU_FILE_WEKAFS_SUPPORTED, 'Support for WEKAFS') + NFS_SUPPORTED = (CU_FILE_NFS_SUPPORTED, 'Support for NFS') + GPFS_SUPPORTED = CU_FILE_GPFS_SUPPORTED + NVME_SUPPORTED = (CU_FILE_NVME_SUPPORTED, '< Support for GPFS Support for NVMe') + NVMEOF_SUPPORTED = (CU_FILE_NVMEOF_SUPPORTED, 'Support for NVMeOF') + SCSI_SUPPORTED = (CU_FILE_SCSI_SUPPORTED, 'Support for SCSI') + SCALEFLUX_CSD_SUPPORTED = (CU_FILE_SCALEFLUX_CSD_SUPPORTED, 'Support for Scaleflux CSD') + NVMESH_SUPPORTED = (CU_FILE_NVMESH_SUPPORTED, 'Support for NVMesh Block Dev') + BEEGFS_SUPPORTED = (CU_FILE_BEEGFS_SUPPORTED, 'Support for BeeGFS') + NVME_P2P_SUPPORTED = (CU_FILE_NVME_P2P_SUPPORTED, 'Do not use this macro. This is deprecated now') + SCATEFS_SUPPORTED = (CU_FILE_SCATEFS_SUPPORTED, 'Support for ScateFS') + VIRTIOFS_SUPPORTED = (CU_FILE_VIRTIOFS_SUPPORTED, 'Support for VirtioFS') + MAX_TARGET_TYPES = (CU_FILE_MAX_TARGET_TYPES, 'Maximum FS supported') + +class DriverControlFlags(_cyb_FastEnum): + """ + See `CUfileDriverControlFlags_t`. + """ + USE_POLL_MODE = (CU_FILE_USE_POLL_MODE, 'use POLL mode. properties.use_poll_mode') + ALLOW_COMPAT_MODE = (CU_FILE_ALLOW_COMPAT_MODE, 'allow COMPATIBILITY mode. properties.allow_compat_mode') + POSIX_IO_MODE = (CU_FILE_POSIX_IO_MODE, 'Vanilla posix io mode. properties.posix_io_mode') + FALLBACK_IO_MODE = (CU_FILE_FALLBACK_IO_MODE, 'Fallback io mode. properties.gds_fallback_io') + +class FeatureFlags(_cyb_FastEnum): + """ + See `CUfileFeatureFlags_t`. + """ + DYN_ROUTING_SUPPORTED = (CU_FILE_DYN_ROUTING_SUPPORTED, 'Support for Dynamic routing to handle devices across the PCIe bridges') + BATCH_IO_SUPPORTED = (CU_FILE_BATCH_IO_SUPPORTED, 'Supported') + STREAMS_SUPPORTED = (CU_FILE_STREAMS_SUPPORTED, 'Supported') + PARALLEL_IO_SUPPORTED = (CU_FILE_PARALLEL_IO_SUPPORTED, 'Supported') + P2P_SUPPORTED = (CU_FILE_P2P_SUPPORTED, 'Support for PCI P2PDMA') + +class FileHandleType(_cyb_FastEnum): + """ + See `CUfileFileHandleType`. + """ + OPAQUE_FD = (CU_FILE_HANDLE_TYPE_OPAQUE_FD, 'Linux based fd') + OPAQUE_WIN32 = (CU_FILE_HANDLE_TYPE_OPAQUE_WIN32, 'Windows based handle (unsupported)') + USERSPACE_FS = CU_FILE_HANDLE_TYPE_USERSPACE_FS + +class Opcode(_cyb_FastEnum): + """ + See `CUfileOpcode_t`. + """ + READ = CUFILE_READ + WRITE = CUFILE_WRITE + +class Status(_cyb_FastEnum): + """ + See `CUfileStatus_t`. + """ + WAITING = CUFILE_WAITING + PENDING = CUFILE_PENDING + INVALID = CUFILE_INVALID + CANCELED = CUFILE_CANCELED + COMPLETE = CUFILE_COMPLETE + TIMEOUT = CUFILE_TIMEOUT + FAILED = CUFILE_FAILED + +class BatchMode(_cyb_FastEnum): + """ + See `CUfileBatchMode_t`. + """ + BATCH = CUFILE_BATCH + +class SizeTConfigParameter(_cyb_FastEnum): + """ + See `CUFileSizeTConfigParameter_t`. + """ + PROFILE_STATS = CUFILE_PARAM_PROFILE_STATS + EXECUTION_MAX_IO_QUEUE_DEPTH = CUFILE_PARAM_EXECUTION_MAX_IO_QUEUE_DEPTH + EXECUTION_MAX_IO_THREADS = CUFILE_PARAM_EXECUTION_MAX_IO_THREADS + EXECUTION_MIN_IO_THRESHOLD_SIZE_KB = CUFILE_PARAM_EXECUTION_MIN_IO_THRESHOLD_SIZE_KB + EXECUTION_MAX_REQUEST_PARALLELISM = CUFILE_PARAM_EXECUTION_MAX_REQUEST_PARALLELISM + PROPERTIES_MAX_DIRECT_IO_SIZE_KB = CUFILE_PARAM_PROPERTIES_MAX_DIRECT_IO_SIZE_KB + PROPERTIES_MAX_DEVICE_CACHE_SIZE_KB = CUFILE_PARAM_PROPERTIES_MAX_DEVICE_CACHE_SIZE_KB + PROPERTIES_PER_BUFFER_CACHE_SIZE_KB = CUFILE_PARAM_PROPERTIES_PER_BUFFER_CACHE_SIZE_KB + PROPERTIES_MAX_DEVICE_PINNED_MEM_SIZE_KB = CUFILE_PARAM_PROPERTIES_MAX_DEVICE_PINNED_MEM_SIZE_KB + PROPERTIES_IO_BATCHSIZE = CUFILE_PARAM_PROPERTIES_IO_BATCHSIZE + POLLTHRESHOLD_SIZE_KB = CUFILE_PARAM_POLLTHRESHOLD_SIZE_KB + PROPERTIES_BATCH_IO_TIMEOUT_MS = CUFILE_PARAM_PROPERTIES_BATCH_IO_TIMEOUT_MS + +class BoolConfigParameter(_cyb_FastEnum): + """ + See `CUFileBoolConfigParameter_t`. + """ + PROPERTIES_USE_POLL_MODE = CUFILE_PARAM_PROPERTIES_USE_POLL_MODE + PROPERTIES_ALLOW_COMPAT_MODE = CUFILE_PARAM_PROPERTIES_ALLOW_COMPAT_MODE + FORCE_COMPAT_MODE = CUFILE_PARAM_FORCE_COMPAT_MODE + FS_MISC_API_CHECK_AGGRESSIVE = CUFILE_PARAM_FS_MISC_API_CHECK_AGGRESSIVE + EXECUTION_PARALLEL_IO = CUFILE_PARAM_EXECUTION_PARALLEL_IO + PROFILE_NVTX = CUFILE_PARAM_PROFILE_NVTX + PROPERTIES_ALLOW_SYSTEM_MEMORY = CUFILE_PARAM_PROPERTIES_ALLOW_SYSTEM_MEMORY + USE_PCIP2PDMA = CUFILE_PARAM_USE_PCIP2PDMA + PREFER_IO_URING = CUFILE_PARAM_PREFER_IO_URING + FORCE_ODIRECT_MODE = CUFILE_PARAM_FORCE_ODIRECT_MODE + SKIP_TOPOLOGY_DETECTION = CUFILE_PARAM_SKIP_TOPOLOGY_DETECTION + STREAM_MEMOPS_BYPASS = CUFILE_PARAM_STREAM_MEMOPS_BYPASS + +class StringConfigParameter(_cyb_FastEnum): + """ + See `CUFileStringConfigParameter_t`. + """ + LOGGING_LEVEL = CUFILE_PARAM_LOGGING_LEVEL + ENV_LOGFILE_PATH = CUFILE_PARAM_ENV_LOGFILE_PATH + LOG_DIR = CUFILE_PARAM_LOG_DIR + +class ArrayConfigParameter(_cyb_FastEnum): + """ + See `CUFileArrayConfigParameter_t`. + """ + POSIX_POOL_SLAB_SIZE_KB = CUFILE_PARAM_POSIX_POOL_SLAB_SIZE_KB + POSIX_POOL_SLAB_COUNT = CUFILE_PARAM_POSIX_POOL_SLAB_COUNT + GPU_BOUNCE_BUFFER_SLAB_SIZE_KB = CUFILE_PARAM_GPU_BOUNCE_BUFFER_SLAB_SIZE_KB + GPU_BOUNCE_BUFFER_SLAB_COUNT = CUFILE_PARAM_GPU_BOUNCE_BUFFER_SLAB_COUNT + +class P2PFlags(_cyb_FastEnum): + """ + See `CUfileP2PFlags_t`. + """ + P2PDMA = (CUFILE_P2PDMA, 'Support for PCI P2PDMA') + NVFS = (CUFILE_NVFS, 'Support for nvidia-fs') + DMABUF = (CUFILE_DMABUF, 'Support for DMA Buffer') + C2C = (CUFILE_C2C, 'Support for Chip-to-Chip (Grace-based systems)') + NVIDIA_PEERMEM = (CUFILE_NVIDIA_PEERMEM, 'Only for IBM Spectrum Scale and WekaFS') + + +############################################################################### +# Error handling +############################################################################### + +ctypedef fused ReturnT: + CUfileError_t + ssize_t + + +class cuFileError(Exception): + + def __init__(self, status, cu_err=None): + self.status = status + self.cuda_error = cu_err + s = OpError(status) + cdef str err = f"{s.name} ({s.value}): {op_status_error(status)}" + if cu_err is not None: + e = pyCUresult(cu_err) + err += f"; CUDA status: {e.name} ({e.value})" + super(cuFileError, self).__init__(err) + + def __reduce__(self): + return (type(self), (self.status, self.cuda_error)) + + +@cython.profile(False) +cdef int check_status(ReturnT status) except 1 nogil: + if ReturnT is CUfileError_t: + if status.err != 0 or status.cu_err != 0: + with gil: + raise cuFileError(status.err, status.cu_err) + elif ReturnT is ssize_t: + if status == -1: + # note: this assumes cuFile already properly resets errno in each API + with gil: + raise cuFileError(errno.errno) + return 0 + + +############################################################################### +# Wrapper functions +############################################################################### + +cpdef intptr_t handle_register(intptr_t descr) except? 0: + """cuFileHandleRegister is required, and performs extra checking that is memoized to provide increased performance on later cuFile operations. + + Args: + descr (intptr_t): ``CUfileDescr_t`` file descriptor (OS agnostic). + + Returns: + intptr_t: ``CUfileHandle_t`` opaque file handle for IO operations. + + .. seealso:: `cuFileHandleRegister` + """ + cdef Handle fh + with nogil: + __status__ = cuFileHandleRegister(&fh, descr) + check_status(__status__) + return fh + + +cpdef void handle_deregister(intptr_t fh) except*: + """releases a registered filehandle from cuFile. + + Args: + fh (intptr_t): ``CUfileHandle_t`` file handle. + + .. seealso:: `cuFileHandleDeregister` + """ + with nogil: + cuFileHandleDeregister(fh) + + +cpdef buf_register(intptr_t buf_ptr_base, size_t length, int flags): + """register an existing cudaMalloced memory with cuFile to pin for GPUDirect Storage access or register host allocated memory with cuFile. + + Args: + buf_ptr_base (intptr_t): buffer pointer allocated. + length (size_t): size of memory region from the above specified bufPtr. + flags (int): CU_FILE_RDMA_REGISTER. + + .. seealso:: `cuFileBufRegister` + """ + with nogil: + __status__ = cuFileBufRegister(buf_ptr_base, length, flags) + check_status(__status__) + + +cpdef buf_deregister(intptr_t buf_ptr_base): + """deregister an already registered device or host memory from cuFile. + + Args: + buf_ptr_base (intptr_t): buffer pointer to deregister. + + .. seealso:: `cuFileBufDeregister` + """ + with nogil: + __status__ = cuFileBufDeregister(buf_ptr_base) + check_status(__status__) + + +cpdef driver_open(): + """Initialize the cuFile library and open the nvidia-fs driver. + + .. seealso:: `cuFileDriverOpen` + """ + with nogil: + __status__ = cuFileDriverOpen() + check_status(__status__) + + +cpdef use_count(): + """returns use count of cufile drivers at that moment by the process. + + .. seealso:: `cuFileUseCount` + """ + with nogil: + __status__ = cuFileUseCount() + check_status(__status__) + + +cpdef driver_get_properties(intptr_t props): + """Gets the Driver session properties If the driver is not opened, it will return the staged/default properties If the driver is opened, it will return the current properties. + + Args: + props (intptr_t): Properties to get. + + .. seealso:: `cuFileDriverGetProperties` + """ + with nogil: + __status__ = cuFileDriverGetProperties(props) + check_status(__status__) + + +cpdef driver_set_poll_mode(bint poll, size_t poll_threshold_size): + """Sets whether the Read/Write APIs use polling to do IO operations This takes place before the driver is opened. No-op if driver is already open. + + Args: + poll (bint): boolean to indicate whether to use poll mode or not. + poll_threshold_size (size_t): max IO size to use for POLLING mode in KB. + + .. seealso:: `cuFileDriverSetPollMode` + """ + with nogil: + __status__ = cuFileDriverSetPollMode(poll, poll_threshold_size) + check_status(__status__) + + +cpdef driver_set_max_direct_io_size(size_t max_direct_io_size): + """Control parameter to set max IO size(KB) used by the library to talk to nvidia-fs driver This takes place before the driver is opened. No-op if driver is already open. + + Args: + max_direct_io_size (size_t): maximum allowed direct io size in KB. + + .. seealso:: `cuFileDriverSetMaxDirectIOSize` + """ + with nogil: + __status__ = cuFileDriverSetMaxDirectIOSize(max_direct_io_size) + check_status(__status__) + + +cpdef driver_set_max_cache_size(size_t max_cache_size): + """Control parameter to set maximum GPU memory reserved per device by the library for internal buffering This takes place before the driver is opened. No-op if driver is already open. + + Args: + max_cache_size (size_t): The maximum GPU buffer space per device used for internal use in KB. + + .. seealso:: `cuFileDriverSetMaxCacheSize` + """ + with nogil: + __status__ = cuFileDriverSetMaxCacheSize(max_cache_size) + check_status(__status__) + + +cpdef driver_set_max_pinned_mem_size(size_t max_pinned_size): + """Sets maximum buffer space that is pinned in KB for use by ``cuFileBufRegister`` This takes place before the driver is opened. No-op if driver is already open. + + Args: + max_pinned_size (size_t): maximum buffer space that is pinned in KB. + + .. seealso:: `cuFileDriverSetMaxPinnedMemSize` + """ + with nogil: + __status__ = cuFileDriverSetMaxPinnedMemSize(max_pinned_size) + check_status(__status__) + + +cpdef intptr_t batch_io_set_up(unsigned nr) except? 0: + cdef BatchHandle batch_idp + with nogil: + __status__ = cuFileBatchIOSetUp(&batch_idp, nr) + check_status(__status__) + return batch_idp + + +cpdef batch_io_submit(intptr_t batch_idp, unsigned nr, intptr_t iocbp, unsigned int flags): + with nogil: + __status__ = cuFileBatchIOSubmit(batch_idp, nr, iocbp, flags) + check_status(__status__) + + +cpdef batch_io_get_status(intptr_t batch_idp, unsigned min_nr, intptr_t nr, intptr_t iocbp, intptr_t timeout): + with nogil: + __status__ = cuFileBatchIOGetStatus(batch_idp, min_nr, nr, iocbp, timeout) + check_status(__status__) + + +cpdef batch_io_cancel(intptr_t batch_idp): + with nogil: + __status__ = cuFileBatchIOCancel(batch_idp) + check_status(__status__) + + +cpdef void batch_io_destroy(intptr_t batch_idp) except*: + with nogil: + cuFileBatchIODestroy(batch_idp) + + +cpdef read_async(intptr_t fh, intptr_t buf_ptr_base, intptr_t size_p, intptr_t file_offset_p, intptr_t buf_ptr_offset_p, intptr_t bytes_read_p, intptr_t stream): + with nogil: + __status__ = cuFileReadAsync(fh, buf_ptr_base, size_p, file_offset_p, buf_ptr_offset_p, bytes_read_p, stream) + check_status(__status__) + + +cpdef write_async(intptr_t fh, intptr_t buf_ptr_base, intptr_t size_p, intptr_t file_offset_p, intptr_t buf_ptr_offset_p, intptr_t bytes_written_p, intptr_t stream): + with nogil: + __status__ = cuFileWriteAsync(fh, buf_ptr_base, size_p, file_offset_p, buf_ptr_offset_p, bytes_written_p, stream) + check_status(__status__) + + +cpdef stream_register(intptr_t stream, unsigned flags): + with nogil: + __status__ = cuFileStreamRegister(stream, flags) + check_status(__status__) + + +cpdef stream_deregister(intptr_t stream): + with nogil: + __status__ = cuFileStreamDeregister(stream) + check_status(__status__) + + +cpdef int get_version() except? 0: + """Get the cuFile library version. + + Returns: + int: Pointer to an integer where the version will be stored. + + .. seealso:: `cuFileGetVersion` + """ + cdef int version + with nogil: + __status__ = cuFileGetVersion(&version) + check_status(__status__) + return version + + +cpdef size_t get_parameter_size_t(int param) except? 0: + cdef size_t value + with nogil: + __status__ = cuFileGetParameterSizeT(<_SizeTConfigParameter>param, &value) + check_status(__status__) + return value + + +cpdef bint get_parameter_bool(int param) except? 0: + cdef cpp_bool value + with nogil: + __status__ = cuFileGetParameterBool(<_BoolConfigParameter>param, &value) + check_status(__status__) + return value + + +cpdef str get_parameter_string(int param, int len): + cdef bytes _desc_str_ = bytes(len) + cdef char* desc_str = _desc_str_ + with nogil: + __status__ = cuFileGetParameterString(<_StringConfigParameter>param, desc_str, len) + check_status(__status__) + return _cyb_cpython.PyUnicode_FromString(desc_str) + + +cpdef set_parameter_size_t(int param, size_t value): + with nogil: + __status__ = cuFileSetParameterSizeT(<_SizeTConfigParameter>param, value) + check_status(__status__) + + +cpdef set_parameter_bool(int param, bint value): + with nogil: + __status__ = cuFileSetParameterBool(<_BoolConfigParameter>param, value) + check_status(__status__) + + +cpdef set_parameter_string(int param, intptr_t desc_str): + with nogil: + __status__ = cuFileSetParameterString(<_StringConfigParameter>param, desc_str) + check_status(__status__) + + +cpdef tuple get_parameter_min_max_value(int param): + """Get both the minimum and maximum settable values for a given size_t parameter in a single call. + + Args: + param (SizeTConfigParameter): CUfile SizeT configuration parameter. + + Returns: + A 2-tuple containing: + + - size_t: Pointer to store the minimum value. + - size_t: Pointer to store the maximum value. + + .. seealso:: `cuFileGetParameterMinMaxValue` + """ + cdef size_t min_value + cdef size_t max_value + with nogil: + __status__ = cuFileGetParameterMinMaxValue(<_SizeTConfigParameter>param, &min_value, &max_value) + check_status(__status__) + return (min_value, max_value) + + +cpdef set_stats_level(int level): + """Set the level of statistics collection for cuFile operations. This will override the cufile.json settings for stats. + + Args: + level (int): Statistics level (0 = disabled, 1 = basic, 2 = detailed, 3 = verbose). + + .. seealso:: `cuFileSetStatsLevel` + """ + with nogil: + __status__ = cuFileSetStatsLevel(level) + check_status(__status__) + + +cpdef int get_stats_level() except? 0: + """Get the current level of statistics collection for cuFile operations. + + Returns: + int: Pointer to store the current statistics level. + + .. seealso:: `cuFileGetStatsLevel` + """ + cdef int level + with nogil: + __status__ = cuFileGetStatsLevel(&level) + check_status(__status__) + return level + + +cpdef stats_start(): + """Start collecting cuFile statistics. + + .. seealso:: `cuFileStatsStart` + """ + with nogil: + __status__ = cuFileStatsStart() + check_status(__status__) + + +cpdef stats_stop(): + """Stop collecting cuFile statistics. + + .. seealso:: `cuFileStatsStop` + """ + with nogil: + __status__ = cuFileStatsStop() + check_status(__status__) + + +cpdef stats_reset(): + """Reset all cuFile statistics counters. + + .. seealso:: `cuFileStatsReset` + """ + with nogil: + __status__ = cuFileStatsReset() + check_status(__status__) + + +cpdef get_stats_l1(intptr_t stats): + """Get Level 1 cuFile statistics. + + Args: + stats (intptr_t): Pointer to ``CUfileStatsLevel1_t`` structure to be filled. + + .. seealso:: `cuFileGetStatsL1` + """ + with nogil: + __status__ = cuFileGetStatsL1(stats) + check_status(__status__) + + +cpdef get_stats_l2(intptr_t stats): + """Get Level 2 cuFile statistics. + + Args: + stats (intptr_t): Pointer to ``CUfileStatsLevel2_t`` structure to be filled. + + .. seealso:: `cuFileGetStatsL2` + """ + with nogil: + __status__ = cuFileGetStatsL2(stats) + check_status(__status__) + + +cpdef get_stats_l3(intptr_t stats): + """Get Level 3 cuFile statistics. + + Args: + stats (intptr_t): Pointer to ``CUfileStatsLevel3_t`` structure to be filled. + + .. seealso:: `cuFileGetStatsL3` + """ + with nogil: + __status__ = cuFileGetStatsL3(stats) + check_status(__status__) + + +cpdef size_t get_bar_size_in_kb(int gpu_index) except? 0: + cdef size_t bar_size + with nogil: + __status__ = cuFileGetBARSizeInKB(gpu_index, &bar_size) + check_status(__status__) + return bar_size + + +cpdef set_parameter_posix_pool_slab_array(intptr_t size_values, intptr_t count_values, int len): + """Set both POSIX pool slab size and count parameters as a pair. + + Args: + size_values (intptr_t): Array of slab sizes in KB. + count_values (intptr_t): Array of slab counts. + len (int): Length of both arrays (must be the same). + + .. seealso:: `cuFileSetParameterPosixPoolSlabArray` + """ + with nogil: + __status__ = cuFileSetParameterPosixPoolSlabArray(size_values, count_values, len) + check_status(__status__) + + +cpdef get_parameter_posix_pool_slab_array(intptr_t size_values, intptr_t count_values, int len): + """Get both POSIX pool slab size and count parameters as a pair. + + Args: + size_values (intptr_t): Buffer to receive slab sizes in KB. + count_values (intptr_t): Buffer to receive slab counts. + len (int): Buffer size (must match the actual parameter length). + + .. seealso:: `cuFileGetParameterPosixPoolSlabArray` + """ + with nogil: + __status__ = cuFileGetParameterPosixPoolSlabArray(size_values, count_values, len) + check_status(__status__) + + +cpdef str op_status_error(int status): + """cufileop status string. + + Args: + status (OpError): the error status to query. + + .. seealso:: `cufileop_status_error` + """ + cdef bytes _output_ + _output_ = cufileop_status_error(<_OpError>status) + return _output_.decode() + + +cpdef driver_close(): + """reset the cuFile library and release the nvidia-fs driver + """ + with nogil: + status = cuFileDriverClose_v2() + check_status(status) + +cpdef read(intptr_t fh, intptr_t buf_ptr_base, size_t size, off_t file_offset, off_t buf_ptr_offset): + """read data from a registered file handle to a specified device or host memory. + + Args: + fh (intptr_t): ``CUfileHandle_t`` opaque file handle. + buf_ptr_base (intptr_t): base address of buffer in device or host memory. + size (size_t): size bytes to read. + file_offset (off_t): file-offset from begining of the file. + buf_ptr_offset (off_t): offset relative to the buf_ptr_base pointer to read into. + + Returns: + ssize_t: number of bytes read on success. + + .. seealso:: `cuFileRead` + """ + with nogil: + status = cuFileRead(fh, buf_ptr_base, size, file_offset, buf_ptr_offset) + check_status(status) + return status + + +cpdef write(intptr_t fh, intptr_t buf_ptr_base, size_t size, off_t file_offset, off_t buf_ptr_offset): + """write data from a specified device or host memory to a registered file handle. + + Args: + fh (intptr_t): ``CUfileHandle_t`` opaque file handle. + buf_ptr_base (intptr_t): base address of buffer in device or host memory. + size (size_t): size bytes to write. + file_offset (off_t): file-offset from begining of the file. + buf_ptr_offset (off_t): offset relative to the buf_ptr_base pointer to write from. + + Returns: + ssize_t: number of bytes written on success. + + .. seealso:: `cuFileWrite` + """ + with nogil: + status = cuFileWrite(fh, buf_ptr_base, size, file_offset, buf_ptr_offset) + check_status(status) + return status +del _cyb_FastEnum diff --git a/cuda_bindings/cuda/bindings/cycudla.pxd b/cuda_bindings/cuda/bindings/cycudla.pxd new file mode 100644 index 00000000000..6eee248e7d5 --- /dev/null +++ b/cuda_bindings/cuda/bindings/cycudla.pxd @@ -0,0 +1,161 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +# This code was automatically generated across versions from 1.5.0 to 13.3.0. Do not modify it directly. +# This layer exposes the C header to Cython as-is. + +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=c4dacd5de0bc9a6ac0cc92dabed1728cc6133d0448924ea6db4f9c740ff089b6 +from libc.stdint cimport int8_t, int16_t, int32_t, int64_t +from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t +from libc.stdint cimport intptr_t, uintptr_t +from libc.stddef cimport size_t + + + + +############################################################################### +# Types (structs, enums, ...) +############################################################################### + +# enums +ctypedef enum cudlaStatus "cudlaStatus": + cudlaSuccess "cudlaSuccess" = 0 + cudlaErrorInvalidParam "cudlaErrorInvalidParam" = 1 + cudlaErrorOutOfResources "cudlaErrorOutOfResources" = 2 + cudlaErrorCreationFailed "cudlaErrorCreationFailed" = 3 + cudlaErrorInvalidAddress "cudlaErrorInvalidAddress" = 4 + cudlaErrorOs "cudlaErrorOs" = 5 + cudlaErrorCuda "cudlaErrorCuda" = 6 + cudlaErrorUmd "cudlaErrorUmd" = 7 + cudlaErrorInvalidDevice "cudlaErrorInvalidDevice" = 8 + cudlaErrorInvalidAttribute "cudlaErrorInvalidAttribute" = 9 + cudlaErrorIncompatibleDlaSWVersion "cudlaErrorIncompatibleDlaSWVersion" = 10 + cudlaErrorMemoryRegistered "cudlaErrorMemoryRegistered" = 11 + cudlaErrorInvalidModule "cudlaErrorInvalidModule" = 12 + cudlaErrorUnsupportedOperation "cudlaErrorUnsupportedOperation" = 13 + cudlaErrorNvSci "cudlaErrorNvSci" = 14 + cudlaErrorDriverNotFound "cudlaErrorDriverNotFound" = 15 + cudlaErrorDlaErrInvalidInput "cudlaErrorDlaErrInvalidInput" = 0x40000001 + cudlaErrorDlaErrInvalidPreAction "cudlaErrorDlaErrInvalidPreAction" = 0x40000002 + cudlaErrorDlaErrNoMem "cudlaErrorDlaErrNoMem" = 0x40000003 + cudlaErrorDlaErrProcessorBusy "cudlaErrorDlaErrProcessorBusy" = 0x40000004 + cudlaErrorDlaErrTaskStatusMismatch "cudlaErrorDlaErrTaskStatusMismatch" = 0x40000005 + cudlaErrorDlaErrEngineTimeout "cudlaErrorDlaErrEngineTimeout" = 0x40000006 + cudlaErrorDlaErrDataMismatch "cudlaErrorDlaErrDataMismatch" = 0x40000007 + cudlaErrorUnknown "cudlaErrorUnknown" = 0x7fffffff + _CUDLASTATUS_INTERNAL_LOADING_ERROR "_CUDLASTATUS_INTERNAL_LOADING_ERROR" = -42 + +ctypedef enum cudlaMode "cudlaMode": + CUDLA_CUDA_DLA "CUDLA_CUDA_DLA" = 0 + CUDLA_STANDALONE "CUDLA_STANDALONE" = 1 + +ctypedef enum cudlaModuleAttributeType "cudlaModuleAttributeType": + CUDLA_NUM_INPUT_TENSORS "CUDLA_NUM_INPUT_TENSORS" = 0 + CUDLA_NUM_OUTPUT_TENSORS "CUDLA_NUM_OUTPUT_TENSORS" = 1 + CUDLA_INPUT_TENSOR_DESCRIPTORS "CUDLA_INPUT_TENSOR_DESCRIPTORS" = 2 + CUDLA_OUTPUT_TENSOR_DESCRIPTORS "CUDLA_OUTPUT_TENSOR_DESCRIPTORS" = 3 + CUDLA_NUM_OUTPUT_TASK_STATISTICS "CUDLA_NUM_OUTPUT_TASK_STATISTICS" = 4 + CUDLA_OUTPUT_TASK_STATISTICS_DESCRIPTORS "CUDLA_OUTPUT_TASK_STATISTICS_DESCRIPTORS" = 5 + +ctypedef enum cudlaFenceType "cudlaFenceType": + CUDLA_NVSCISYNC_FENCE "CUDLA_NVSCISYNC_FENCE" = 1 + CUDLA_NVSCISYNC_FENCE_SOF "CUDLA_NVSCISYNC_FENCE_SOF" = 2 + +ctypedef enum cudlaModuleLoadFlags "cudlaModuleLoadFlags": + CUDLA_MODULE_DEFAULT "CUDLA_MODULE_DEFAULT" = 0 + CUDLA_MODULE_ENABLE_FAULT_DIAGNOSTICS "CUDLA_MODULE_ENABLE_FAULT_DIAGNOSTICS" = 1 + +ctypedef enum cudlaSubmissionFlags "cudlaSubmissionFlags": + CUDLA_SUBMIT_NOOP "CUDLA_SUBMIT_NOOP" = 1 + CUDLA_SUBMIT_SKIP_LOCK_ACQUIRE "CUDLA_SUBMIT_SKIP_LOCK_ACQUIRE" = (1 << 1) + CUDLA_SUBMIT_DIAGNOSTICS_TASK "CUDLA_SUBMIT_DIAGNOSTICS_TASK" = (1 << 2) + +ctypedef enum cudlaAccessPermissionFlags "cudlaAccessPermissionFlags": + CUDLA_READ_WRITE_PERM "CUDLA_READ_WRITE_PERM" = 0 + CUDLA_READ_ONLY_PERM "CUDLA_READ_ONLY_PERM" = 1 + CUDLA_TASK_STATISTICS "CUDLA_TASK_STATISTICS" = (1 << 1) + +ctypedef enum cudlaDevAttributeType "cudlaDevAttributeType": + CUDLA_UNIFIED_ADDRESSING "CUDLA_UNIFIED_ADDRESSING" = 0 + CUDLA_DEVICE_VERSION "CUDLA_DEVICE_VERSION" = 1 + +# types +ctypedef void* cudlaDevHandle 'cudlaDevHandle' + +ctypedef void* cudlaModule 'cudlaModule' + +ctypedef struct cudlaExternalMemoryHandleDesc_t 'cudlaExternalMemoryHandleDesc_t': + void* extBufObject + unsigned long long size + +ctypedef struct cudlaExternalSemaphoreHandleDesc_t 'cudlaExternalSemaphoreHandleDesc_t': + void* extSyncObject + +ctypedef struct cudlaModuleTensorDescriptor 'cudlaModuleTensorDescriptor': + char name[(80U + 1)] + uint64_t size + uint64_t n + uint64_t c + uint64_t h + uint64_t w + uint8_t dataFormat + uint8_t dataType + uint8_t dataCategory + uint8_t pixelFormat + uint8_t pixelMapping + uint32_t stride[8U] + +ctypedef struct CudlaFence 'CudlaFence': + void* fence + cudlaFenceType type + +ctypedef union cudlaDevAttribute 'cudlaDevAttribute': + uint8_t unifiedAddressingSupported + uint32_t deviceVersion + +ctypedef union cudlaModuleAttribute 'cudlaModuleAttribute': + uint32_t numInputTensors + uint32_t numOutputTensors + cudlaModuleTensorDescriptor* inputTensorDesc + cudlaModuleTensorDescriptor* outputTensorDesc + +ctypedef struct cudlaWaitEvents 'cudlaWaitEvents': + CudlaFence* preFences + uint32_t numEvents + +ctypedef struct cudlaSignalEvents 'cudlaSignalEvents': + uint64_t** devPtrs + CudlaFence* eofFences + uint32_t numEvents + +ctypedef struct cudlaTask 'cudlaTask': + cudlaModule moduleHandle + uint64_t** outputTensor + uint32_t numOutputTensors + uint32_t numInputTensors + uint64_t** inputTensor + cudlaWaitEvents* waitEvents + cudlaSignalEvents* signalEvents + +# Typedef aliases for struct types (struct has _t, typedef doesn't) +ctypedef cudlaExternalMemoryHandleDesc_t cudlaExternalMemoryHandleDesc 'cudlaExternalMemoryHandleDesc' +ctypedef cudlaExternalSemaphoreHandleDesc_t cudlaExternalSemaphoreHandleDesc 'cudlaExternalSemaphoreHandleDesc' + + +############################################################################### +# Functions +############################################################################### + +cdef cudlaStatus cudlaGetVersion(uint64_t* const version) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil +cdef cudlaStatus cudlaDeviceGetCount(uint64_t* const pNumDevices) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil +cdef cudlaStatus cudlaCreateDevice(const uint64_t device, cudlaDevHandle* const devHandle, const uint32_t flags) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil +cdef cudlaStatus cudlaMemRegister(const cudlaDevHandle devHandle, const uint64_t* const ptr, const size_t size, uint64_t** const devPtr, const uint32_t flags) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil +cdef cudlaStatus cudlaModuleLoadFromMemory(const cudlaDevHandle devHandle, const uint8_t* const pModule, const size_t moduleSize, cudlaModule* const hModule, const uint32_t flags) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil +cdef cudlaStatus cudlaModuleGetAttributes(const cudlaModule hModule, const cudlaModuleAttributeType attrType, cudlaModuleAttribute* const attribute) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil +cdef cudlaStatus cudlaModuleUnload(const cudlaModule hModule, const uint32_t flags) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil +cdef cudlaStatus cudlaSubmitTask(const cudlaDevHandle devHandle, const cudlaTask* const ptrToTasks, const uint32_t numTasks, void* const stream, const uint32_t flags) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil +cdef cudlaStatus cudlaDeviceGetAttribute(const cudlaDevHandle devHandle, const cudlaDevAttributeType attrib, cudlaDevAttribute* const pAttribute) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil +cdef cudlaStatus cudlaMemUnregister(const cudlaDevHandle devHandle, const uint64_t* const devPtr) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil +cdef cudlaStatus cudlaGetLastError(const cudlaDevHandle devHandle) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil +cdef cudlaStatus cudlaDestroyDevice(const cudlaDevHandle devHandle) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil +cdef cudlaStatus cudlaSetTaskTimeoutInMs(const cudlaDevHandle devHandle, const uint32_t timeout) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil diff --git a/cuda_bindings/cuda/bindings/cycudla.pyx b/cuda_bindings/cuda/bindings/cycudla.pyx new file mode 100644 index 00000000000..42a7bd651c6 --- /dev/null +++ b/cuda_bindings/cuda/bindings/cycudla.pyx @@ -0,0 +1,65 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +# This code was automatically generated across versions from 1.5.0 to 13.3.0. Do not modify it directly. + +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=b134ed8cb83eb5a5c6ff30be817e64d09d421d7257761e58fbc06b131690a392 +from ._internal cimport cudla as _cudla + + + + +############################################################################### +# Wrapper functions +############################################################################### + +cdef cudlaStatus cudlaGetVersion(uint64_t* const version) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil: + return _cudla._cudlaGetVersion(version) + + +cdef cudlaStatus cudlaDeviceGetCount(uint64_t* const pNumDevices) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil: + return _cudla._cudlaDeviceGetCount(pNumDevices) + + +cdef cudlaStatus cudlaCreateDevice(const uint64_t device, cudlaDevHandle* const devHandle, const uint32_t flags) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil: + return _cudla._cudlaCreateDevice(device, devHandle, flags) + + +cdef cudlaStatus cudlaMemRegister(const cudlaDevHandle devHandle, const uint64_t* const ptr, const size_t size, uint64_t** const devPtr, const uint32_t flags) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil: + return _cudla._cudlaMemRegister(devHandle, ptr, size, devPtr, flags) + + +cdef cudlaStatus cudlaModuleLoadFromMemory(const cudlaDevHandle devHandle, const uint8_t* const pModule, const size_t moduleSize, cudlaModule* const hModule, const uint32_t flags) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil: + return _cudla._cudlaModuleLoadFromMemory(devHandle, pModule, moduleSize, hModule, flags) + + +cdef cudlaStatus cudlaModuleGetAttributes(const cudlaModule hModule, const cudlaModuleAttributeType attrType, cudlaModuleAttribute* const attribute) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil: + return _cudla._cudlaModuleGetAttributes(hModule, attrType, attribute) + + +cdef cudlaStatus cudlaModuleUnload(const cudlaModule hModule, const uint32_t flags) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil: + return _cudla._cudlaModuleUnload(hModule, flags) + + +cdef cudlaStatus cudlaSubmitTask(const cudlaDevHandle devHandle, const cudlaTask* const ptrToTasks, const uint32_t numTasks, void* const stream, const uint32_t flags) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil: + return _cudla._cudlaSubmitTask(devHandle, ptrToTasks, numTasks, stream, flags) + + +cdef cudlaStatus cudlaDeviceGetAttribute(const cudlaDevHandle devHandle, const cudlaDevAttributeType attrib, cudlaDevAttribute* const pAttribute) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil: + return _cudla._cudlaDeviceGetAttribute(devHandle, attrib, pAttribute) + + +cdef cudlaStatus cudlaMemUnregister(const cudlaDevHandle devHandle, const uint64_t* const devPtr) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil: + return _cudla._cudlaMemUnregister(devHandle, devPtr) + + +cdef cudlaStatus cudlaGetLastError(const cudlaDevHandle devHandle) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil: + return _cudla._cudlaGetLastError(devHandle) + + +cdef cudlaStatus cudlaDestroyDevice(const cudlaDevHandle devHandle) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil: + return _cudla._cudlaDestroyDevice(devHandle) + + +cdef cudlaStatus cudlaSetTaskTimeoutInMs(const cudlaDevHandle devHandle, const uint32_t timeout) except?_CUDLASTATUS_INTERNAL_LOADING_ERROR nogil: + return _cudla._cudlaSetTaskTimeoutInMs(devHandle, timeout) diff --git a/cuda_bindings/cuda/bindings/cycufile.pxd b/cuda_bindings/cuda/bindings/cycufile.pxd new file mode 100644 index 00000000000..b5a0c9cb884 --- /dev/null +++ b/cuda_bindings/cuda/bindings/cycufile.pxd @@ -0,0 +1,434 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +# This code was automatically generated across versions from 12.9.1 to 13.3.0. Do not modify it directly. + +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=f840820f160e36eebe6e052b5a5d3a35b55704060301ee2ab7d5cd7a7d580418 +from libc.stdint cimport uint32_t, uint64_t +from libc.time cimport time_t +from libcpp cimport bool as cpp_bool +from posix.types cimport off_t + +cimport cuda.bindings.cydriver +from cuda.bindings.cydriver cimport CUresult + + +############################################################################### +# Types (structs, enums, ...) +############################################################################### + +# TODO: switch to "from libc.time cimport timespec" once we can use recent +# Cython to build +cdef extern from "": + cdef struct timespec: + time_t tv_sec + long tv_nsec +cdef extern from "": + cdef struct sockaddr: + unsigned short sa_family + char sa_data[14] + ctypedef sockaddr sockaddr_t + + + + + # enums +cdef extern from 'cufile.h': + ctypedef enum CUfileOpError: + CU_FILE_SUCCESS + CU_FILE_DRIVER_NOT_INITIALIZED + CU_FILE_DRIVER_INVALID_PROPS + CU_FILE_DRIVER_UNSUPPORTED_LIMIT + CU_FILE_DRIVER_VERSION_MISMATCH + CU_FILE_DRIVER_VERSION_READ_ERROR + CU_FILE_DRIVER_CLOSING + CU_FILE_PLATFORM_NOT_SUPPORTED + CU_FILE_IO_NOT_SUPPORTED + CU_FILE_DEVICE_NOT_SUPPORTED + CU_FILE_NVFS_DRIVER_ERROR + CU_FILE_CUDA_DRIVER_ERROR + CU_FILE_CUDA_POINTER_INVALID + CU_FILE_CUDA_MEMORY_TYPE_INVALID + CU_FILE_CUDA_POINTER_RANGE_ERROR + CU_FILE_CUDA_CONTEXT_MISMATCH + CU_FILE_INVALID_MAPPING_SIZE + CU_FILE_INVALID_MAPPING_RANGE + CU_FILE_INVALID_FILE_TYPE + CU_FILE_INVALID_FILE_OPEN_FLAG + CU_FILE_DIO_NOT_SET + CU_FILE_INVALID_VALUE + CU_FILE_MEMORY_ALREADY_REGISTERED + CU_FILE_MEMORY_NOT_REGISTERED + CU_FILE_PERMISSION_DENIED + CU_FILE_DRIVER_ALREADY_OPEN + CU_FILE_HANDLE_NOT_REGISTERED + CU_FILE_HANDLE_ALREADY_REGISTERED + CU_FILE_DEVICE_NOT_FOUND + CU_FILE_INTERNAL_ERROR + CU_FILE_GETNEWFD_FAILED + CU_FILE_NVFS_SETUP_ERROR + CU_FILE_IO_DISABLED + CU_FILE_BATCH_SUBMIT_FAILED + CU_FILE_GPU_MEMORY_PINNING_FAILED + CU_FILE_BATCH_FULL + CU_FILE_ASYNC_NOT_SUPPORTED + CU_FILE_INTERNAL_BATCH_SETUP_ERROR + CU_FILE_INTERNAL_BATCH_SUBMIT_ERROR + CU_FILE_INTERNAL_BATCH_GETSTATUS_ERROR + CU_FILE_INTERNAL_BATCH_CANCEL_ERROR + CU_FILE_NOMEM_ERROR + CU_FILE_IO_ERROR + CU_FILE_INTERNAL_BUF_REGISTER_ERROR + CU_FILE_HASH_OPR_ERROR + CU_FILE_INVALID_CONTEXT_ERROR + CU_FILE_NVFS_INTERNAL_DRIVER_ERROR + CU_FILE_BATCH_NOCOMPAT_ERROR + CU_FILE_IO_MAX_ERROR + +cdef extern from 'cufile.h': + ctypedef enum CUfileDriverStatusFlags_t: + CU_FILE_LUSTRE_SUPPORTED + CU_FILE_WEKAFS_SUPPORTED + CU_FILE_NFS_SUPPORTED + CU_FILE_GPFS_SUPPORTED + CU_FILE_NVME_SUPPORTED + CU_FILE_NVMEOF_SUPPORTED + CU_FILE_SCSI_SUPPORTED + CU_FILE_SCALEFLUX_CSD_SUPPORTED + CU_FILE_NVMESH_SUPPORTED + CU_FILE_BEEGFS_SUPPORTED + CU_FILE_NVME_P2P_SUPPORTED + CU_FILE_SCATEFS_SUPPORTED + CU_FILE_VIRTIOFS_SUPPORTED + CU_FILE_MAX_TARGET_TYPES + +cdef extern from 'cufile.h': + ctypedef enum CUfileDriverControlFlags_t: + CU_FILE_USE_POLL_MODE + CU_FILE_ALLOW_COMPAT_MODE + CU_FILE_POSIX_IO_MODE + CU_FILE_FALLBACK_IO_MODE + +cdef extern from 'cufile.h': + ctypedef enum CUfileFeatureFlags_t: + CU_FILE_DYN_ROUTING_SUPPORTED + CU_FILE_BATCH_IO_SUPPORTED + CU_FILE_STREAMS_SUPPORTED + CU_FILE_PARALLEL_IO_SUPPORTED + CU_FILE_P2P_SUPPORTED + +cdef extern from 'cufile.h': + ctypedef enum CUfileFileHandleType: + CU_FILE_HANDLE_TYPE_OPAQUE_FD + CU_FILE_HANDLE_TYPE_OPAQUE_WIN32 + CU_FILE_HANDLE_TYPE_USERSPACE_FS + +cdef extern from 'cufile.h': + ctypedef enum CUfileOpcode_t: + CUFILE_READ + CUFILE_WRITE + +cdef extern from 'cufile.h': + ctypedef enum CUfileStatus_t: + CUFILE_WAITING + CUFILE_PENDING + CUFILE_INVALID + CUFILE_CANCELED + CUFILE_COMPLETE + CUFILE_TIMEOUT + CUFILE_FAILED + +cdef extern from 'cufile.h': + ctypedef enum CUfileBatchMode_t: + CUFILE_BATCH + +cdef extern from 'cufile.h': + ctypedef enum CUFileSizeTConfigParameter_t: + CUFILE_PARAM_PROFILE_STATS + CUFILE_PARAM_EXECUTION_MAX_IO_QUEUE_DEPTH + CUFILE_PARAM_EXECUTION_MAX_IO_THREADS + CUFILE_PARAM_EXECUTION_MIN_IO_THRESHOLD_SIZE_KB + CUFILE_PARAM_EXECUTION_MAX_REQUEST_PARALLELISM + CUFILE_PARAM_PROPERTIES_MAX_DIRECT_IO_SIZE_KB + CUFILE_PARAM_PROPERTIES_MAX_DEVICE_CACHE_SIZE_KB + CUFILE_PARAM_PROPERTIES_PER_BUFFER_CACHE_SIZE_KB + CUFILE_PARAM_PROPERTIES_MAX_DEVICE_PINNED_MEM_SIZE_KB + CUFILE_PARAM_PROPERTIES_IO_BATCHSIZE + CUFILE_PARAM_POLLTHRESHOLD_SIZE_KB + CUFILE_PARAM_PROPERTIES_BATCH_IO_TIMEOUT_MS + +cdef extern from 'cufile.h': + ctypedef enum CUFileBoolConfigParameter_t: + CUFILE_PARAM_PROPERTIES_USE_POLL_MODE + CUFILE_PARAM_PROPERTIES_ALLOW_COMPAT_MODE + CUFILE_PARAM_FORCE_COMPAT_MODE + CUFILE_PARAM_FS_MISC_API_CHECK_AGGRESSIVE + CUFILE_PARAM_EXECUTION_PARALLEL_IO + CUFILE_PARAM_PROFILE_NVTX + CUFILE_PARAM_PROPERTIES_ALLOW_SYSTEM_MEMORY + CUFILE_PARAM_USE_PCIP2PDMA + CUFILE_PARAM_PREFER_IO_URING + CUFILE_PARAM_FORCE_ODIRECT_MODE + CUFILE_PARAM_SKIP_TOPOLOGY_DETECTION + CUFILE_PARAM_STREAM_MEMOPS_BYPASS + +cdef extern from 'cufile.h': + ctypedef enum CUFileStringConfigParameter_t: + CUFILE_PARAM_LOGGING_LEVEL + CUFILE_PARAM_ENV_LOGFILE_PATH + CUFILE_PARAM_LOG_DIR + +cdef extern from 'cufile.h': + ctypedef enum CUFileArrayConfigParameter_t: + CUFILE_PARAM_POSIX_POOL_SLAB_SIZE_KB + CUFILE_PARAM_POSIX_POOL_SLAB_COUNT + CUFILE_PARAM_GPU_BOUNCE_BUFFER_SLAB_SIZE_KB + CUFILE_PARAM_GPU_BOUNCE_BUFFER_SLAB_COUNT + +cdef extern from 'cufile.h': + ctypedef enum CUfileP2PFlags_t: + CUFILE_P2PDMA + CUFILE_NVFS + CUFILE_DMABUF + CUFILE_C2C + CUFILE_NVIDIA_PEERMEM +cdef enum: _CUFILEERROR_T_INTERNAL_LOADING_ERROR = -42 + + # types +cdef extern from 'cufile.h': + ctypedef void* CUfileHandle_t 'CUfileHandle_t' + + +cdef extern from 'cufile.h': + ctypedef void* CUfileBatchHandle_t 'CUfileBatchHandle_t' + + +cdef extern from 'cufile.h': + ctypedef struct CUfileError_t 'CUfileError_t': + CUfileOpError err + CUresult cu_err + +cdef struct cuda_bindings_cufile__anon_pod0: + unsigned int major_version + unsigned int minor_version + size_t poll_thresh_size + size_t max_direct_io_size + unsigned int dstatusflags + unsigned int dcontrolflags + +cdef extern from 'cufile.h': + ctypedef struct cufileRDMAInfo_t 'cufileRDMAInfo_t': + int version + int desc_len + char* desc_str + +cdef extern from 'cufile.h': + ctypedef struct CUfileFSOps_t 'CUfileFSOps_t': + char* (*fs_type)(const void*) + int (*getRDMADeviceList)(const void*, sockaddr_t**) + int (*getRDMADevicePriority)(const void*, char*, size_t, loff_t, const sockaddr_t*) + ssize_t (*read)(const void*, char*, size_t, loff_t, const cufileRDMAInfo_t*) + ssize_t (*write)(const void*, const char*, size_t, loff_t, const cufileRDMAInfo_t*) + +cdef union cuda_bindings_cufile__anon_pod1: + int fd + void* handle + +cdef struct cuda_bindings_cufile__anon_pod3: + void* devPtr_base + off_t file_offset + off_t devPtr_offset + size_t size + +cdef extern from 'cufile.h': + ctypedef struct CUfileIOEvents_t 'CUfileIOEvents_t': + void* cookie + CUfileStatus_t status + size_t ret + +cdef extern from 'cufile.h': + ctypedef struct CUfileOpCounter_t 'CUfileOpCounter_t': + uint64_t ok + uint64_t err + +cdef extern from 'cufile.h': + ctypedef struct CUfilePerGpuStats_t 'CUfilePerGpuStats_t': + char uuid[16] + uint64_t read_bytes + uint64_t read_bw_bytes_per_sec + uint64_t read_utilization + uint64_t read_duration_us + uint64_t n_total_reads + uint64_t n_p2p_reads + uint64_t n_nvfs_reads + uint64_t n_posix_reads + uint64_t n_unaligned_reads + uint64_t n_dr_reads + uint64_t n_sparse_regions + uint64_t n_inline_regions + uint64_t n_reads_err + uint64_t writes_bytes + uint64_t write_bw_bytes_per_sec + uint64_t write_utilization + uint64_t write_duration_us + uint64_t n_total_writes + uint64_t n_p2p_writes + uint64_t n_nvfs_writes + uint64_t n_posix_writes + uint64_t n_unaligned_writes + uint64_t n_dr_writes + uint64_t n_writes_err + uint64_t n_mmap + uint64_t n_mmap_ok + uint64_t n_mmap_err + uint64_t n_mmap_free + uint64_t reg_bytes + +cdef extern from 'cufile.h': + ctypedef struct CUfileDrvProps_t 'CUfileDrvProps_t': + cuda_bindings_cufile__anon_pod0 nvfs + unsigned int fflags + unsigned int max_device_cache_size + unsigned int per_buffer_cache_size + unsigned int max_device_pinned_mem_size + unsigned int max_batch_io_size + unsigned int max_batch_io_timeout_msecs + +cdef extern from 'cufile.h': + ctypedef struct CUfileDescr_t 'CUfileDescr_t': + CUfileFileHandleType type + cuda_bindings_cufile__anon_pod1 handle + CUfileFSOps_t* fs_ops + +cdef union cuda_bindings_cufile__anon_pod2: + cuda_bindings_cufile__anon_pod3 batch + +cdef extern from 'cufile.h': + ctypedef struct CUfileStatsLevel1_t 'CUfileStatsLevel1_t': + CUfileOpCounter_t read_ops + CUfileOpCounter_t write_ops + CUfileOpCounter_t hdl_register_ops + CUfileOpCounter_t hdl_deregister_ops + CUfileOpCounter_t buf_register_ops + CUfileOpCounter_t buf_deregister_ops + uint64_t read_bytes + uint64_t write_bytes + uint64_t read_bw_bytes_per_sec + uint64_t write_bw_bytes_per_sec + uint64_t read_lat_avg_us + uint64_t write_lat_avg_us + uint64_t read_ops_per_sec + uint64_t write_ops_per_sec + uint64_t read_lat_sum_us + uint64_t write_lat_sum_us + CUfileOpCounter_t batch_submit_ops + CUfileOpCounter_t batch_complete_ops + CUfileOpCounter_t batch_setup_ops + CUfileOpCounter_t batch_cancel_ops + CUfileOpCounter_t batch_destroy_ops + CUfileOpCounter_t batch_enqueued_ops + CUfileOpCounter_t batch_posix_enqueued_ops + CUfileOpCounter_t batch_processed_ops + CUfileOpCounter_t batch_posix_processed_ops + CUfileOpCounter_t batch_nvfs_submit_ops + CUfileOpCounter_t batch_p2p_submit_ops + CUfileOpCounter_t batch_aio_submit_ops + CUfileOpCounter_t batch_iouring_submit_ops + CUfileOpCounter_t batch_mixed_io_submit_ops + CUfileOpCounter_t batch_total_submit_ops + uint64_t batch_read_bytes + uint64_t batch_write_bytes + uint64_t batch_read_bw_bytes + uint64_t batch_write_bw_bytes + uint64_t batch_submit_lat_avg_us + uint64_t batch_completion_lat_avg_us + uint64_t batch_submit_ops_per_sec + uint64_t batch_complete_ops_per_sec + uint64_t batch_submit_lat_sum_us + uint64_t batch_completion_lat_sum_us + uint64_t last_batch_read_bytes + uint64_t last_batch_write_bytes + +cdef extern from 'cufile.h': + ctypedef struct CUfileIOParams_t 'CUfileIOParams_t': + CUfileBatchMode_t mode + cuda_bindings_cufile__anon_pod2 u + CUfileHandle_t fh + CUfileOpcode_t opcode + void* cookie + +cdef extern from 'cufile.h': + ctypedef struct CUfileStatsLevel2_t 'CUfileStatsLevel2_t': + CUfileStatsLevel1_t basic + uint64_t read_size_kb_hist[32] + uint64_t write_size_kb_hist[32] + +cdef extern from 'cufile.h': + ctypedef struct CUfileStatsLevel3_t 'CUfileStatsLevel3_t': + CUfileStatsLevel2_t detailed + uint32_t num_gpus + CUfilePerGpuStats_t per_gpu_stats[16] + + +cdef extern from *: + """ + // This is the missing piece we need to supply to help Cython & C++ compilers. + inline bool operator==(const CUfileError_t& lhs, const CUfileError_t& rhs) { + return (lhs.err == rhs.err) && (lhs.cu_err == rhs.cu_err); + } + static CUfileError_t CUFILE_LOADING_ERROR{(CUfileOpError)-1, (CUresult)-1}; + """ + const CUfileError_t CUFILE_LOADING_ERROR + ctypedef void* CUstream "CUstream" + + const char* cufileop_status_error(CUfileOpError) + + +############################################################################### +# Functions +############################################################################### + +cdef CUfileError_t cuFileHandleRegister(CUfileHandle_t* fh, CUfileDescr_t* descr) except?CUFILE_LOADING_ERROR nogil +cdef void cuFileHandleDeregister(CUfileHandle_t fh) except* nogil +cdef CUfileError_t cuFileBufRegister(const void* bufPtr_base, size_t length, int flags) except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t cuFileBufDeregister(const void* bufPtr_base) except?CUFILE_LOADING_ERROR nogil +cdef ssize_t cuFileRead(CUfileHandle_t fh, void* bufPtr_base, size_t size, off_t file_offset, off_t bufPtr_offset) except* nogil +cdef ssize_t cuFileWrite(CUfileHandle_t fh, const void* bufPtr_base, size_t size, off_t file_offset, off_t bufPtr_offset) except* nogil +cdef CUfileError_t cuFileDriverOpen() except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t cuFileDriverClose() except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t cuFileDriverClose_v2() except?CUFILE_LOADING_ERROR nogil +cdef long cuFileUseCount() except* nogil +cdef CUfileError_t cuFileDriverGetProperties(CUfileDrvProps_t* props) except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t cuFileDriverSetPollMode(cpp_bool poll, size_t poll_threshold_size) except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t cuFileDriverSetMaxDirectIOSize(size_t max_direct_io_size) except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t cuFileDriverSetMaxCacheSize(size_t max_cache_size) except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t cuFileDriverSetMaxPinnedMemSize(size_t max_pinned_size) except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t cuFileBatchIOSetUp(CUfileBatchHandle_t* batch_idp, unsigned nr) except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t cuFileBatchIOSubmit(CUfileBatchHandle_t batch_idp, unsigned nr, CUfileIOParams_t* iocbp, unsigned int flags) except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t cuFileBatchIOGetStatus(CUfileBatchHandle_t batch_idp, unsigned min_nr, unsigned* nr, CUfileIOEvents_t* iocbp, timespec* timeout) except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t cuFileBatchIOCancel(CUfileBatchHandle_t batch_idp) except?CUFILE_LOADING_ERROR nogil +cdef void cuFileBatchIODestroy(CUfileBatchHandle_t batch_idp) except* nogil +cdef CUfileError_t cuFileReadAsync(CUfileHandle_t fh, void* bufPtr_base, size_t* size_p, off_t* file_offset_p, off_t* bufPtr_offset_p, ssize_t* bytes_read_p, CUstream stream) except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t cuFileWriteAsync(CUfileHandle_t fh, void* bufPtr_base, size_t* size_p, off_t* file_offset_p, off_t* bufPtr_offset_p, ssize_t* bytes_written_p, CUstream stream) except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t cuFileStreamRegister(CUstream stream, unsigned flags) except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t cuFileStreamDeregister(CUstream stream) except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t cuFileGetVersion(int* version) except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t cuFileGetParameterSizeT(CUFileSizeTConfigParameter_t param, size_t* value) except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t cuFileGetParameterBool(CUFileBoolConfigParameter_t param, cpp_bool* value) except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t cuFileGetParameterString(CUFileStringConfigParameter_t param, char* desc_str, int len) except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t cuFileSetParameterSizeT(CUFileSizeTConfigParameter_t param, size_t value) except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t cuFileSetParameterBool(CUFileBoolConfigParameter_t param, cpp_bool value) except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t cuFileSetParameterString(CUFileStringConfigParameter_t param, const char* desc_str) except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t cuFileGetParameterMinMaxValue(CUFileSizeTConfigParameter_t param, size_t* min_value, size_t* max_value) except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t cuFileSetStatsLevel(int level) except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t cuFileGetStatsLevel(int* level) except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t cuFileStatsStart() except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t cuFileStatsStop() except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t cuFileStatsReset() except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t cuFileGetStatsL1(CUfileStatsLevel1_t* stats) except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t cuFileGetStatsL2(CUfileStatsLevel2_t* stats) except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t cuFileGetStatsL3(CUfileStatsLevel3_t* stats) except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t cuFileGetBARSizeInKB(int gpuIndex, size_t* barSize) except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t cuFileSetParameterPosixPoolSlabArray(const size_t* size_values, const size_t* count_values, int len) except?CUFILE_LOADING_ERROR nogil +cdef CUfileError_t cuFileGetParameterPosixPoolSlabArray(size_t* size_values, size_t* count_values, int len) except?CUFILE_LOADING_ERROR nogil diff --git a/cuda_bindings/cuda/bindings/cycufile.pyx b/cuda_bindings/cuda/bindings/cycufile.pyx new file mode 100644 index 00000000000..c8d240560b0 --- /dev/null +++ b/cuda_bindings/cuda/bindings/cycufile.pyx @@ -0,0 +1,195 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +# This code was automatically generated across versions from 12.9.1 to 13.3.0. Do not modify it directly. +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=a68ff13250f4b5131f4b4adf8a37a4283b27749e8429b5f6e57bfc68bf656b00 + + +# <<<< PREAMBLE CONTENT >>>> + +cimport cython as _cyb_cython + + +# <<<< END OF PREAMBLE CONTENT >>>> + +from ._internal cimport cufile as _cufile + +import cython + +############################################################################### +# Wrapper functions +############################################################################### + +cdef CUfileError_t cuFileHandleRegister(CUfileHandle_t* fh, CUfileDescr_t* descr) except?CUFILE_LOADING_ERROR nogil: + return _cufile._cuFileHandleRegister(fh, descr) + + +@_cyb_cython.show_performance_hints(False) +cdef void cuFileHandleDeregister(CUfileHandle_t fh) except* nogil: + _cufile._cuFileHandleDeregister(fh) + + +cdef CUfileError_t cuFileBufRegister(const void* bufPtr_base, size_t length, int flags) except?CUFILE_LOADING_ERROR nogil: + return _cufile._cuFileBufRegister(bufPtr_base, length, flags) + + +cdef CUfileError_t cuFileBufDeregister(const void* bufPtr_base) except?CUFILE_LOADING_ERROR nogil: + return _cufile._cuFileBufDeregister(bufPtr_base) + + +cdef ssize_t cuFileRead(CUfileHandle_t fh, void* bufPtr_base, size_t size, off_t file_offset, off_t bufPtr_offset) except* nogil: + return _cufile._cuFileRead(fh, bufPtr_base, size, file_offset, bufPtr_offset) + + +cdef ssize_t cuFileWrite(CUfileHandle_t fh, const void* bufPtr_base, size_t size, off_t file_offset, off_t bufPtr_offset) except* nogil: + return _cufile._cuFileWrite(fh, bufPtr_base, size, file_offset, bufPtr_offset) + + +cdef CUfileError_t cuFileDriverOpen() except?CUFILE_LOADING_ERROR nogil: + return _cufile._cuFileDriverOpen() + + +cdef CUfileError_t cuFileDriverClose() except?CUFILE_LOADING_ERROR nogil: + return _cufile._cuFileDriverClose() + + +cdef CUfileError_t cuFileDriverClose_v2() except?CUFILE_LOADING_ERROR nogil: + return _cufile._cuFileDriverClose_v2() + + +cdef long cuFileUseCount() except* nogil: + return _cufile._cuFileUseCount() + + +cdef CUfileError_t cuFileDriverGetProperties(CUfileDrvProps_t* props) except?CUFILE_LOADING_ERROR nogil: + return _cufile._cuFileDriverGetProperties(props) + + +cdef CUfileError_t cuFileDriverSetPollMode(cpp_bool poll, size_t poll_threshold_size) except?CUFILE_LOADING_ERROR nogil: + return _cufile._cuFileDriverSetPollMode(poll, poll_threshold_size) + + +cdef CUfileError_t cuFileDriverSetMaxDirectIOSize(size_t max_direct_io_size) except?CUFILE_LOADING_ERROR nogil: + return _cufile._cuFileDriverSetMaxDirectIOSize(max_direct_io_size) + + +cdef CUfileError_t cuFileDriverSetMaxCacheSize(size_t max_cache_size) except?CUFILE_LOADING_ERROR nogil: + return _cufile._cuFileDriverSetMaxCacheSize(max_cache_size) + + +cdef CUfileError_t cuFileDriverSetMaxPinnedMemSize(size_t max_pinned_size) except?CUFILE_LOADING_ERROR nogil: + return _cufile._cuFileDriverSetMaxPinnedMemSize(max_pinned_size) + + +cdef CUfileError_t cuFileBatchIOSetUp(CUfileBatchHandle_t* batch_idp, unsigned nr) except?CUFILE_LOADING_ERROR nogil: + return _cufile._cuFileBatchIOSetUp(batch_idp, nr) + + +cdef CUfileError_t cuFileBatchIOSubmit(CUfileBatchHandle_t batch_idp, unsigned nr, CUfileIOParams_t* iocbp, unsigned int flags) except?CUFILE_LOADING_ERROR nogil: + return _cufile._cuFileBatchIOSubmit(batch_idp, nr, iocbp, flags) + + +cdef CUfileError_t cuFileBatchIOGetStatus(CUfileBatchHandle_t batch_idp, unsigned min_nr, unsigned* nr, CUfileIOEvents_t* iocbp, timespec* timeout) except?CUFILE_LOADING_ERROR nogil: + return _cufile._cuFileBatchIOGetStatus(batch_idp, min_nr, nr, iocbp, timeout) + + +cdef CUfileError_t cuFileBatchIOCancel(CUfileBatchHandle_t batch_idp) except?CUFILE_LOADING_ERROR nogil: + return _cufile._cuFileBatchIOCancel(batch_idp) + + +@_cyb_cython.show_performance_hints(False) +cdef void cuFileBatchIODestroy(CUfileBatchHandle_t batch_idp) except* nogil: + _cufile._cuFileBatchIODestroy(batch_idp) + + +cdef CUfileError_t cuFileReadAsync(CUfileHandle_t fh, void* bufPtr_base, size_t* size_p, off_t* file_offset_p, off_t* bufPtr_offset_p, ssize_t* bytes_read_p, CUstream stream) except?CUFILE_LOADING_ERROR nogil: + return _cufile._cuFileReadAsync(fh, bufPtr_base, size_p, file_offset_p, bufPtr_offset_p, bytes_read_p, stream) + + +cdef CUfileError_t cuFileWriteAsync(CUfileHandle_t fh, void* bufPtr_base, size_t* size_p, off_t* file_offset_p, off_t* bufPtr_offset_p, ssize_t* bytes_written_p, CUstream stream) except?CUFILE_LOADING_ERROR nogil: + return _cufile._cuFileWriteAsync(fh, bufPtr_base, size_p, file_offset_p, bufPtr_offset_p, bytes_written_p, stream) + + +cdef CUfileError_t cuFileStreamRegister(CUstream stream, unsigned flags) except?CUFILE_LOADING_ERROR nogil: + return _cufile._cuFileStreamRegister(stream, flags) + + +cdef CUfileError_t cuFileStreamDeregister(CUstream stream) except?CUFILE_LOADING_ERROR nogil: + return _cufile._cuFileStreamDeregister(stream) + + +cdef CUfileError_t cuFileGetVersion(int* version) except?CUFILE_LOADING_ERROR nogil: + return _cufile._cuFileGetVersion(version) + + +cdef CUfileError_t cuFileGetParameterSizeT(CUFileSizeTConfigParameter_t param, size_t* value) except?CUFILE_LOADING_ERROR nogil: + return _cufile._cuFileGetParameterSizeT(param, value) + + +cdef CUfileError_t cuFileGetParameterBool(CUFileBoolConfigParameter_t param, cpp_bool* value) except?CUFILE_LOADING_ERROR nogil: + return _cufile._cuFileGetParameterBool(param, value) + + +cdef CUfileError_t cuFileGetParameterString(CUFileStringConfigParameter_t param, char* desc_str, int len) except?CUFILE_LOADING_ERROR nogil: + return _cufile._cuFileGetParameterString(param, desc_str, len) + + +cdef CUfileError_t cuFileSetParameterSizeT(CUFileSizeTConfigParameter_t param, size_t value) except?CUFILE_LOADING_ERROR nogil: + return _cufile._cuFileSetParameterSizeT(param, value) + + +cdef CUfileError_t cuFileSetParameterBool(CUFileBoolConfigParameter_t param, cpp_bool value) except?CUFILE_LOADING_ERROR nogil: + return _cufile._cuFileSetParameterBool(param, value) + + +cdef CUfileError_t cuFileSetParameterString(CUFileStringConfigParameter_t param, const char* desc_str) except?CUFILE_LOADING_ERROR nogil: + return _cufile._cuFileSetParameterString(param, desc_str) + + +cdef CUfileError_t cuFileGetParameterMinMaxValue(CUFileSizeTConfigParameter_t param, size_t* min_value, size_t* max_value) except?CUFILE_LOADING_ERROR nogil: + return _cufile._cuFileGetParameterMinMaxValue(param, min_value, max_value) + + +cdef CUfileError_t cuFileSetStatsLevel(int level) except?CUFILE_LOADING_ERROR nogil: + return _cufile._cuFileSetStatsLevel(level) + + +cdef CUfileError_t cuFileGetStatsLevel(int* level) except?CUFILE_LOADING_ERROR nogil: + return _cufile._cuFileGetStatsLevel(level) + + +cdef CUfileError_t cuFileStatsStart() except?CUFILE_LOADING_ERROR nogil: + return _cufile._cuFileStatsStart() + + +cdef CUfileError_t cuFileStatsStop() except?CUFILE_LOADING_ERROR nogil: + return _cufile._cuFileStatsStop() + + +cdef CUfileError_t cuFileStatsReset() except?CUFILE_LOADING_ERROR nogil: + return _cufile._cuFileStatsReset() + + +cdef CUfileError_t cuFileGetStatsL1(CUfileStatsLevel1_t* stats) except?CUFILE_LOADING_ERROR nogil: + return _cufile._cuFileGetStatsL1(stats) + + +cdef CUfileError_t cuFileGetStatsL2(CUfileStatsLevel2_t* stats) except?CUFILE_LOADING_ERROR nogil: + return _cufile._cuFileGetStatsL2(stats) + + +cdef CUfileError_t cuFileGetStatsL3(CUfileStatsLevel3_t* stats) except?CUFILE_LOADING_ERROR nogil: + return _cufile._cuFileGetStatsL3(stats) + + +cdef CUfileError_t cuFileGetBARSizeInKB(int gpuIndex, size_t* barSize) except?CUFILE_LOADING_ERROR nogil: + return _cufile._cuFileGetBARSizeInKB(gpuIndex, barSize) + + +cdef CUfileError_t cuFileSetParameterPosixPoolSlabArray(const size_t* size_values, const size_t* count_values, int len) except?CUFILE_LOADING_ERROR nogil: + return _cufile._cuFileSetParameterPosixPoolSlabArray(size_values, count_values, len) + + +cdef CUfileError_t cuFileGetParameterPosixPoolSlabArray(size_t* size_values, size_t* count_values, int len) except?CUFILE_LOADING_ERROR nogil: + return _cufile._cuFileGetParameterPosixPoolSlabArray(size_values, count_values, len) diff --git a/cuda_bindings/cuda/bindings/cydriver.pxd b/cuda_bindings/cuda/bindings/cydriver.pxd new file mode 100644 index 00000000000..43f9d031e24 --- /dev/null +++ b/cuda_bindings/cuda/bindings/cydriver.pxd @@ -0,0 +1,3783 @@ +# SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +# This code was automatically generated across versions from 12.9.0 to 13.3.0. Do not modify it directly. + +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=cccb0572002cd20232f2b9f5c7acf559c92813d33dfc364136d57c8f453e50c6 +from libc.stdint cimport uint32_t, uint64_t + + +# Overridden types from _extras.h + +# GL +ctypedef unsigned int GLenum +ctypedef unsigned int GLuint + +# EGL +ctypedef void *EGLImageKHR +ctypedef void *EGLStreamKHR +ctypedef unsigned int EGLint +ctypedef void *EGLSyncKHR + +# VDPAU +ctypedef uint32_t VdpDevice +ctypedef unsigned long long VdpGetProcAddress +ctypedef uint32_t VdpVideoSurface +ctypedef uint32_t VdpOutputSurface + + +# ENUMS +cdef extern from 'cuda.h': + ctypedef enum CUipcMem_flags_enum: + CU_IPC_MEM_LAZY_ENABLE_PEER_ACCESS + ctypedef CUipcMem_flags_enum CUipcMem_flags + +cdef extern from 'cuda.h': + ctypedef enum CUmemAttach_flags_enum: + CU_MEM_ATTACH_GLOBAL + CU_MEM_ATTACH_HOST + CU_MEM_ATTACH_SINGLE + ctypedef CUmemAttach_flags_enum CUmemAttach_flags + +cdef extern from 'cuda.h': + ctypedef enum CUctx_flags_enum: + CU_CTX_SCHED_AUTO + CU_CTX_SCHED_SPIN + CU_CTX_SCHED_YIELD + CU_CTX_SCHED_BLOCKING_SYNC + CU_CTX_BLOCKING_SYNC + CU_CTX_SCHED_MASK + CU_CTX_MAP_HOST + CU_CTX_LMEM_RESIZE_TO_MAX + CU_CTX_COREDUMP_ENABLE + CU_CTX_USER_COREDUMP_ENABLE + CU_CTX_SYNC_MEMOPS + CU_CTX_FLAGS_MASK + ctypedef CUctx_flags_enum CUctx_flags + +cdef extern from 'cuda.h': + ctypedef enum CUevent_sched_flags_enum: + CU_EVENT_SCHED_AUTO + CU_EVENT_SCHED_SPIN + CU_EVENT_SCHED_YIELD + CU_EVENT_SCHED_BLOCKING_SYNC + ctypedef CUevent_sched_flags_enum CUevent_sched_flags + +cdef extern from 'cuda.h': + ctypedef enum cl_event_flags_enum: + NVCL_EVENT_SCHED_AUTO + NVCL_EVENT_SCHED_SPIN + NVCL_EVENT_SCHED_YIELD + NVCL_EVENT_SCHED_BLOCKING_SYNC + ctypedef cl_event_flags_enum cl_event_flags + +cdef extern from 'cuda.h': + ctypedef enum cl_context_flags_enum: + NVCL_CTX_SCHED_AUTO + NVCL_CTX_SCHED_SPIN + NVCL_CTX_SCHED_YIELD + NVCL_CTX_SCHED_BLOCKING_SYNC + ctypedef cl_context_flags_enum cl_context_flags + +cdef extern from 'cuda.h': + ctypedef enum CUstream_flags_enum: + CU_STREAM_DEFAULT + CU_STREAM_NON_BLOCKING + ctypedef CUstream_flags_enum CUstream_flags + +cdef extern from 'cuda.h': + ctypedef enum CUevent_flags_enum: + CU_EVENT_DEFAULT + CU_EVENT_BLOCKING_SYNC + CU_EVENT_DISABLE_TIMING + CU_EVENT_INTERPROCESS + ctypedef CUevent_flags_enum CUevent_flags + +cdef extern from 'cuda.h': + ctypedef enum CUevent_record_flags_enum: + CU_EVENT_RECORD_DEFAULT + CU_EVENT_RECORD_EXTERNAL + ctypedef CUevent_record_flags_enum CUevent_record_flags + +cdef extern from 'cuda.h': + ctypedef enum CUevent_wait_flags_enum: + CU_EVENT_WAIT_DEFAULT + CU_EVENT_WAIT_EXTERNAL + ctypedef CUevent_wait_flags_enum CUevent_wait_flags + +cdef extern from 'cuda.h': + ctypedef enum CUstreamWaitValue_flags_enum: + CU_STREAM_WAIT_VALUE_GEQ + CU_STREAM_WAIT_VALUE_EQ + CU_STREAM_WAIT_VALUE_AND + CU_STREAM_WAIT_VALUE_NOR + CU_STREAM_WAIT_VALUE_FLUSH + ctypedef CUstreamWaitValue_flags_enum CUstreamWaitValue_flags + +cdef extern from 'cuda.h': + ctypedef enum CUstreamWriteValue_flags_enum: + CU_STREAM_WRITE_VALUE_DEFAULT + CU_STREAM_WRITE_VALUE_NO_MEMORY_BARRIER + ctypedef CUstreamWriteValue_flags_enum CUstreamWriteValue_flags + +cdef extern from 'cuda.h': + ctypedef enum CUstreamBatchMemOpType_enum: + CU_STREAM_MEM_OP_WAIT_VALUE_32 + CU_STREAM_MEM_OP_WRITE_VALUE_32 + CU_STREAM_MEM_OP_WAIT_VALUE_64 + CU_STREAM_MEM_OP_WRITE_VALUE_64 + CU_STREAM_MEM_OP_BARRIER + CU_STREAM_MEM_OP_ATOMIC_REDUCTION + CU_STREAM_MEM_OP_FLUSH_REMOTE_WRITES + ctypedef CUstreamBatchMemOpType_enum CUstreamBatchMemOpType + +cdef extern from 'cuda.h': + ctypedef enum CUstreamMemoryBarrier_flags_enum: + CU_STREAM_MEMORY_BARRIER_TYPE_SYS + CU_STREAM_MEMORY_BARRIER_TYPE_GPU + ctypedef CUstreamMemoryBarrier_flags_enum CUstreamMemoryBarrier_flags + +cdef extern from 'cuda.h': + ctypedef enum CUoccupancy_flags_enum: + CU_OCCUPANCY_DEFAULT + CU_OCCUPANCY_DISABLE_CACHING_OVERRIDE + ctypedef CUoccupancy_flags_enum CUoccupancy_flags + +cdef extern from 'cuda.h': + ctypedef enum CUstreamUpdateCaptureDependencies_flags_enum: + CU_STREAM_ADD_CAPTURE_DEPENDENCIES + CU_STREAM_SET_CAPTURE_DEPENDENCIES + ctypedef CUstreamUpdateCaptureDependencies_flags_enum CUstreamUpdateCaptureDependencies_flags + +cdef extern from 'cuda.h': + ctypedef enum CUasyncNotificationType_enum: + CU_ASYNC_NOTIFICATION_TYPE_OVER_BUDGET + ctypedef CUasyncNotificationType_enum CUasyncNotificationType + +cdef extern from 'cuda.h': + ctypedef enum CUarray_format_enum: + CU_AD_FORMAT_UNSIGNED_INT8 + CU_AD_FORMAT_UNSIGNED_INT16 + CU_AD_FORMAT_UNSIGNED_INT32 + CU_AD_FORMAT_SIGNED_INT8 + CU_AD_FORMAT_SIGNED_INT16 + CU_AD_FORMAT_SIGNED_INT32 + CU_AD_FORMAT_HALF + CU_AD_FORMAT_FLOAT + CU_AD_FORMAT_NV12 + CU_AD_FORMAT_UNORM_INT8X1 + CU_AD_FORMAT_UNORM_INT8X2 + CU_AD_FORMAT_UNORM_INT8X4 + CU_AD_FORMAT_UNORM_INT16X1 + CU_AD_FORMAT_UNORM_INT16X2 + CU_AD_FORMAT_UNORM_INT16X4 + CU_AD_FORMAT_SNORM_INT8X1 + CU_AD_FORMAT_SNORM_INT8X2 + CU_AD_FORMAT_SNORM_INT8X4 + CU_AD_FORMAT_SNORM_INT16X1 + CU_AD_FORMAT_SNORM_INT16X2 + CU_AD_FORMAT_SNORM_INT16X4 + CU_AD_FORMAT_BC1_UNORM + CU_AD_FORMAT_BC1_UNORM_SRGB + CU_AD_FORMAT_BC2_UNORM + CU_AD_FORMAT_BC2_UNORM_SRGB + CU_AD_FORMAT_BC3_UNORM + CU_AD_FORMAT_BC3_UNORM_SRGB + CU_AD_FORMAT_BC4_UNORM + CU_AD_FORMAT_BC4_SNORM + CU_AD_FORMAT_BC5_UNORM + CU_AD_FORMAT_BC5_SNORM + CU_AD_FORMAT_BC6H_UF16 + CU_AD_FORMAT_BC6H_SF16 + CU_AD_FORMAT_BC7_UNORM + CU_AD_FORMAT_BC7_UNORM_SRGB + CU_AD_FORMAT_P010 + CU_AD_FORMAT_P016 + CU_AD_FORMAT_NV16 + CU_AD_FORMAT_P210 + CU_AD_FORMAT_P216 + CU_AD_FORMAT_YUY2 + CU_AD_FORMAT_Y210 + CU_AD_FORMAT_Y216 + CU_AD_FORMAT_AYUV + CU_AD_FORMAT_Y410 + CU_AD_FORMAT_Y416 + CU_AD_FORMAT_Y444_PLANAR8 + CU_AD_FORMAT_Y444_PLANAR10 + CU_AD_FORMAT_YUV444_8bit_SemiPlanar + CU_AD_FORMAT_YUV444_16bit_SemiPlanar + CU_AD_FORMAT_UNORM_INT_101010_2 + CU_AD_FORMAT_UINT8_PACKED_422 + CU_AD_FORMAT_UINT8_PACKED_444 + CU_AD_FORMAT_UINT8_SEMIPLANAR_420 + CU_AD_FORMAT_UINT16_SEMIPLANAR_420 + CU_AD_FORMAT_UINT8_SEMIPLANAR_422 + CU_AD_FORMAT_UINT16_SEMIPLANAR_422 + CU_AD_FORMAT_UINT8_SEMIPLANAR_444 + CU_AD_FORMAT_UINT16_SEMIPLANAR_444 + CU_AD_FORMAT_UINT8_PLANAR_420 + CU_AD_FORMAT_UINT16_PLANAR_420 + CU_AD_FORMAT_UINT8_PLANAR_422 + CU_AD_FORMAT_UINT16_PLANAR_422 + CU_AD_FORMAT_UINT8_PLANAR_444 + CU_AD_FORMAT_UINT16_PLANAR_444 + CU_AD_FORMAT_MAX + ctypedef CUarray_format_enum CUarray_format + +cdef extern from 'cuda.h': + ctypedef enum CUaddress_mode_enum: + CU_TR_ADDRESS_MODE_WRAP + CU_TR_ADDRESS_MODE_CLAMP + CU_TR_ADDRESS_MODE_MIRROR + CU_TR_ADDRESS_MODE_BORDER + ctypedef CUaddress_mode_enum CUaddress_mode + +cdef extern from 'cuda.h': + ctypedef enum CUfilter_mode_enum: + CU_TR_FILTER_MODE_POINT + CU_TR_FILTER_MODE_LINEAR + ctypedef CUfilter_mode_enum CUfilter_mode + +cdef extern from 'cuda.h': + ctypedef enum CUdevice_attribute_enum: + CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_BLOCK + CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_X + CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Y + CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Z + CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_X + CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Y + CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Z + CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK + CU_DEVICE_ATTRIBUTE_SHARED_MEMORY_PER_BLOCK + CU_DEVICE_ATTRIBUTE_TOTAL_CONSTANT_MEMORY + CU_DEVICE_ATTRIBUTE_WARP_SIZE + CU_DEVICE_ATTRIBUTE_MAX_PITCH + CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_BLOCK + CU_DEVICE_ATTRIBUTE_REGISTERS_PER_BLOCK + CU_DEVICE_ATTRIBUTE_CLOCK_RATE + CU_DEVICE_ATTRIBUTE_TEXTURE_ALIGNMENT + CU_DEVICE_ATTRIBUTE_GPU_OVERLAP + CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT + CU_DEVICE_ATTRIBUTE_KERNEL_EXEC_TIMEOUT + CU_DEVICE_ATTRIBUTE_INTEGRATED + CU_DEVICE_ATTRIBUTE_CAN_MAP_HOST_MEMORY + CU_DEVICE_ATTRIBUTE_COMPUTE_MODE + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_WIDTH + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_WIDTH + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_HEIGHT + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_WIDTH + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_HEIGHT + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_DEPTH + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_WIDTH + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_HEIGHT + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_LAYERS + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_WIDTH + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_HEIGHT + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_NUMSLICES + CU_DEVICE_ATTRIBUTE_SURFACE_ALIGNMENT + CU_DEVICE_ATTRIBUTE_CONCURRENT_KERNELS + CU_DEVICE_ATTRIBUTE_ECC_ENABLED + CU_DEVICE_ATTRIBUTE_PCI_BUS_ID + CU_DEVICE_ATTRIBUTE_PCI_DEVICE_ID + CU_DEVICE_ATTRIBUTE_TCC_DRIVER + CU_DEVICE_ATTRIBUTE_MEMORY_CLOCK_RATE + CU_DEVICE_ATTRIBUTE_GLOBAL_MEMORY_BUS_WIDTH + CU_DEVICE_ATTRIBUTE_L2_CACHE_SIZE + CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_MULTIPROCESSOR + CU_DEVICE_ATTRIBUTE_ASYNC_ENGINE_COUNT + CU_DEVICE_ATTRIBUTE_UNIFIED_ADDRESSING + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LAYERED_WIDTH + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LAYERED_LAYERS + CU_DEVICE_ATTRIBUTE_CAN_TEX2D_GATHER + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_GATHER_WIDTH + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_GATHER_HEIGHT + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_WIDTH_ALTERNATE + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_HEIGHT_ALTERNATE + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_DEPTH_ALTERNATE + CU_DEVICE_ATTRIBUTE_PCI_DOMAIN_ID + CU_DEVICE_ATTRIBUTE_TEXTURE_PITCH_ALIGNMENT + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_WIDTH + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_LAYERED_WIDTH + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_LAYERED_LAYERS + CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_WIDTH + CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_WIDTH + CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_HEIGHT + CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_WIDTH + CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_HEIGHT + CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_DEPTH + CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_LAYERED_WIDTH + CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_LAYERED_LAYERS + CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_WIDTH + CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_HEIGHT + CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_LAYERS + CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_WIDTH + CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_LAYERED_WIDTH + CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_LAYERED_LAYERS + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LINEAR_WIDTH + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_WIDTH + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_HEIGHT + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_PITCH + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_MIPMAPPED_WIDTH + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_MIPMAPPED_HEIGHT + CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR + CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_MIPMAPPED_WIDTH + CU_DEVICE_ATTRIBUTE_STREAM_PRIORITIES_SUPPORTED + CU_DEVICE_ATTRIBUTE_GLOBAL_L1_CACHE_SUPPORTED + CU_DEVICE_ATTRIBUTE_LOCAL_L1_CACHE_SUPPORTED + CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_MULTIPROCESSOR + CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_MULTIPROCESSOR + CU_DEVICE_ATTRIBUTE_MANAGED_MEMORY + CU_DEVICE_ATTRIBUTE_MULTI_GPU_BOARD + CU_DEVICE_ATTRIBUTE_MULTI_GPU_BOARD_GROUP_ID + CU_DEVICE_ATTRIBUTE_HOST_NATIVE_ATOMIC_SUPPORTED + CU_DEVICE_ATTRIBUTE_SINGLE_TO_DOUBLE_PRECISION_PERF_RATIO + CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS + CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS + CU_DEVICE_ATTRIBUTE_COMPUTE_PREEMPTION_SUPPORTED + CU_DEVICE_ATTRIBUTE_CAN_USE_HOST_POINTER_FOR_REGISTERED_MEM + CU_DEVICE_ATTRIBUTE_CAN_USE_STREAM_MEM_OPS_V1 + CU_DEVICE_ATTRIBUTE_CAN_USE_64_BIT_STREAM_MEM_OPS_V1 + CU_DEVICE_ATTRIBUTE_CAN_USE_STREAM_WAIT_VALUE_NOR_V1 + CU_DEVICE_ATTRIBUTE_COOPERATIVE_LAUNCH + CU_DEVICE_ATTRIBUTE_COOPERATIVE_MULTI_DEVICE_LAUNCH + CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK_OPTIN + CU_DEVICE_ATTRIBUTE_CAN_FLUSH_REMOTE_WRITES + CU_DEVICE_ATTRIBUTE_HOST_REGISTER_SUPPORTED + CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS_USES_HOST_PAGE_TABLES + CU_DEVICE_ATTRIBUTE_DIRECT_MANAGED_MEM_ACCESS_FROM_HOST + CU_DEVICE_ATTRIBUTE_VIRTUAL_ADDRESS_MANAGEMENT_SUPPORTED + CU_DEVICE_ATTRIBUTE_VIRTUAL_MEMORY_MANAGEMENT_SUPPORTED + CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_POSIX_FILE_DESCRIPTOR_SUPPORTED + CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_WIN32_HANDLE_SUPPORTED + CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_WIN32_KMT_HANDLE_SUPPORTED + CU_DEVICE_ATTRIBUTE_MAX_BLOCKS_PER_MULTIPROCESSOR + CU_DEVICE_ATTRIBUTE_GENERIC_COMPRESSION_SUPPORTED + CU_DEVICE_ATTRIBUTE_MAX_PERSISTING_L2_CACHE_SIZE + CU_DEVICE_ATTRIBUTE_MAX_ACCESS_POLICY_WINDOW_SIZE + CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_WITH_CUDA_VMM_SUPPORTED + CU_DEVICE_ATTRIBUTE_RESERVED_SHARED_MEMORY_PER_BLOCK + CU_DEVICE_ATTRIBUTE_SPARSE_CUDA_ARRAY_SUPPORTED + CU_DEVICE_ATTRIBUTE_READ_ONLY_HOST_REGISTER_SUPPORTED + CU_DEVICE_ATTRIBUTE_TIMELINE_SEMAPHORE_INTEROP_SUPPORTED + CU_DEVICE_ATTRIBUTE_MEMORY_POOLS_SUPPORTED + CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_SUPPORTED + CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_FLUSH_WRITES_OPTIONS + CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_WRITES_ORDERING + CU_DEVICE_ATTRIBUTE_MEMPOOL_SUPPORTED_HANDLE_TYPES + CU_DEVICE_ATTRIBUTE_CLUSTER_LAUNCH + CU_DEVICE_ATTRIBUTE_DEFERRED_MAPPING_CUDA_ARRAY_SUPPORTED + CU_DEVICE_ATTRIBUTE_CAN_USE_64_BIT_STREAM_MEM_OPS + CU_DEVICE_ATTRIBUTE_CAN_USE_STREAM_WAIT_VALUE_NOR + CU_DEVICE_ATTRIBUTE_DMA_BUF_SUPPORTED + CU_DEVICE_ATTRIBUTE_IPC_EVENT_SUPPORTED + CU_DEVICE_ATTRIBUTE_MEM_SYNC_DOMAIN_COUNT + CU_DEVICE_ATTRIBUTE_TENSOR_MAP_ACCESS_SUPPORTED + CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_FABRIC_SUPPORTED + CU_DEVICE_ATTRIBUTE_UNIFIED_FUNCTION_POINTERS + CU_DEVICE_ATTRIBUTE_NUMA_CONFIG + CU_DEVICE_ATTRIBUTE_NUMA_ID + CU_DEVICE_ATTRIBUTE_MULTICAST_SUPPORTED + CU_DEVICE_ATTRIBUTE_MPS_ENABLED + CU_DEVICE_ATTRIBUTE_HOST_NUMA_ID + CU_DEVICE_ATTRIBUTE_D3D12_CIG_SUPPORTED + CU_DEVICE_ATTRIBUTE_MEM_DECOMPRESS_ALGORITHM_MASK + CU_DEVICE_ATTRIBUTE_MEM_DECOMPRESS_MAXIMUM_LENGTH + CU_DEVICE_ATTRIBUTE_VULKAN_CIG_SUPPORTED + CU_DEVICE_ATTRIBUTE_GPU_PCI_DEVICE_ID + CU_DEVICE_ATTRIBUTE_GPU_PCI_SUBSYSTEM_ID + CU_DEVICE_ATTRIBUTE_HOST_NUMA_VIRTUAL_MEMORY_MANAGEMENT_SUPPORTED + CU_DEVICE_ATTRIBUTE_HOST_NUMA_MEMORY_POOLS_SUPPORTED + CU_DEVICE_ATTRIBUTE_HOST_NUMA_MULTINODE_IPC_SUPPORTED + CU_DEVICE_ATTRIBUTE_HOST_MEMORY_POOLS_SUPPORTED + CU_DEVICE_ATTRIBUTE_HOST_VIRTUAL_MEMORY_MANAGEMENT_SUPPORTED + CU_DEVICE_ATTRIBUTE_HOST_ALLOC_DMA_BUF_SUPPORTED + CU_DEVICE_ATTRIBUTE_ONLY_PARTIAL_HOST_NATIVE_ATOMIC_SUPPORTED + CU_DEVICE_ATTRIBUTE_ATOMIC_REDUCTION_SUPPORTED + CU_DEVICE_ATTRIBUTE_D3D12_CIG_STREAMS_SUPPORTED + CU_DEVICE_ATTRIBUTE_DMA_BUF_MMAP_SUPPORTED + CU_DEVICE_ATTRIBUTE_LOGICAL_ENDPOINT_UNICAST_SUPPORTED + CU_DEVICE_ATTRIBUTE_LOGICAL_ENDPOINT_MULTICAST_SUPPORTED + CU_DEVICE_ATTRIBUTE_LOGICAL_ENDPOINT_COUNTED_OPS_SUPPORTED + CU_DEVICE_ATTRIBUTE_LOGICAL_ENDPOINT_UNICAST_ACCESS_ON_OWNER_DEVICE_SUPPORTED + CU_DEVICE_ATTRIBUTE_MAX + ctypedef CUdevice_attribute_enum CUdevice_attribute + +cdef extern from 'cuda.h': + ctypedef enum CUpointer_attribute_enum: + CU_POINTER_ATTRIBUTE_CONTEXT + CU_POINTER_ATTRIBUTE_MEMORY_TYPE + CU_POINTER_ATTRIBUTE_DEVICE_POINTER + CU_POINTER_ATTRIBUTE_HOST_POINTER + CU_POINTER_ATTRIBUTE_P2P_TOKENS + CU_POINTER_ATTRIBUTE_SYNC_MEMOPS + CU_POINTER_ATTRIBUTE_BUFFER_ID + CU_POINTER_ATTRIBUTE_IS_MANAGED + CU_POINTER_ATTRIBUTE_DEVICE_ORDINAL + CU_POINTER_ATTRIBUTE_IS_LEGACY_CUDA_IPC_CAPABLE + CU_POINTER_ATTRIBUTE_RANGE_START_ADDR + CU_POINTER_ATTRIBUTE_RANGE_SIZE + CU_POINTER_ATTRIBUTE_MAPPED + CU_POINTER_ATTRIBUTE_ALLOWED_HANDLE_TYPES + CU_POINTER_ATTRIBUTE_IS_GPU_DIRECT_RDMA_CAPABLE + CU_POINTER_ATTRIBUTE_ACCESS_FLAGS + CU_POINTER_ATTRIBUTE_MEMPOOL_HANDLE + CU_POINTER_ATTRIBUTE_MAPPING_SIZE + CU_POINTER_ATTRIBUTE_MAPPING_BASE_ADDR + CU_POINTER_ATTRIBUTE_MEMORY_BLOCK_ID + CU_POINTER_ATTRIBUTE_IS_HW_DECOMPRESS_CAPABLE + ctypedef CUpointer_attribute_enum CUpointer_attribute + +cdef extern from 'cuda.h': + ctypedef enum CUfunction_attribute_enum: + CU_FUNC_ATTRIBUTE_MAX_THREADS_PER_BLOCK + CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES + CU_FUNC_ATTRIBUTE_CONST_SIZE_BYTES + CU_FUNC_ATTRIBUTE_LOCAL_SIZE_BYTES + CU_FUNC_ATTRIBUTE_NUM_REGS + CU_FUNC_ATTRIBUTE_PTX_VERSION + CU_FUNC_ATTRIBUTE_BINARY_VERSION + CU_FUNC_ATTRIBUTE_CACHE_MODE_CA + CU_FUNC_ATTRIBUTE_MAX_DYNAMIC_SHARED_SIZE_BYTES + CU_FUNC_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT + CU_FUNC_ATTRIBUTE_CLUSTER_SIZE_MUST_BE_SET + CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_WIDTH + CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_HEIGHT + CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_DEPTH + CU_FUNC_ATTRIBUTE_NON_PORTABLE_CLUSTER_SIZE_ALLOWED + CU_FUNC_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE + CU_FUNC_ATTRIBUTE_DEVICE_NODE_UPDATE_SUPPORTED + CU_FUNC_ATTRIBUTE_MAX + ctypedef CUfunction_attribute_enum CUfunction_attribute + +cdef extern from 'cuda.h': + ctypedef enum CUfunc_cache_enum: + CU_FUNC_CACHE_PREFER_NONE + CU_FUNC_CACHE_PREFER_SHARED + CU_FUNC_CACHE_PREFER_L1 + CU_FUNC_CACHE_PREFER_EQUAL + ctypedef CUfunc_cache_enum CUfunc_cache + +cdef extern from 'cuda.h': + ctypedef enum CUsharedconfig_enum: + CU_SHARED_MEM_CONFIG_DEFAULT_BANK_SIZE + CU_SHARED_MEM_CONFIG_FOUR_BYTE_BANK_SIZE + CU_SHARED_MEM_CONFIG_EIGHT_BYTE_BANK_SIZE + ctypedef CUsharedconfig_enum CUsharedconfig + +cdef extern from 'cuda.h': + ctypedef enum CUshared_carveout_enum: + CU_SHAREDMEM_CARVEOUT_DEFAULT + CU_SHAREDMEM_CARVEOUT_MAX_SHARED + CU_SHAREDMEM_CARVEOUT_MAX_L1 + ctypedef CUshared_carveout_enum CUshared_carveout + +cdef extern from 'cuda.h': + ctypedef enum CUmemorytype_enum: + CU_MEMORYTYPE_HOST + CU_MEMORYTYPE_DEVICE + CU_MEMORYTYPE_ARRAY + CU_MEMORYTYPE_UNIFIED + ctypedef CUmemorytype_enum CUmemorytype + +cdef extern from 'cuda.h': + ctypedef enum CUcomputemode_enum: + CU_COMPUTEMODE_DEFAULT + CU_COMPUTEMODE_PROHIBITED + CU_COMPUTEMODE_EXCLUSIVE_PROCESS + ctypedef CUcomputemode_enum CUcomputemode + +cdef extern from 'cuda.h': + ctypedef enum CUmem_advise_enum: + CU_MEM_ADVISE_SET_READ_MOSTLY + CU_MEM_ADVISE_UNSET_READ_MOSTLY + CU_MEM_ADVISE_SET_PREFERRED_LOCATION + CU_MEM_ADVISE_UNSET_PREFERRED_LOCATION + CU_MEM_ADVISE_SET_ACCESSED_BY + CU_MEM_ADVISE_UNSET_ACCESSED_BY + ctypedef CUmem_advise_enum CUmem_advise + +cdef extern from 'cuda.h': + ctypedef enum CUmem_range_attribute_enum: + CU_MEM_RANGE_ATTRIBUTE_READ_MOSTLY + CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION + CU_MEM_RANGE_ATTRIBUTE_ACCESSED_BY + CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION + CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION_TYPE + CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION_ID + CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION_TYPE + CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION_ID + ctypedef CUmem_range_attribute_enum CUmem_range_attribute + +cdef extern from 'cuda.h': + ctypedef enum CUjit_option_enum: + CU_JIT_MAX_REGISTERS + CU_JIT_THREADS_PER_BLOCK + CU_JIT_WALL_TIME + CU_JIT_INFO_LOG_BUFFER + CU_JIT_INFO_LOG_BUFFER_SIZE_BYTES + CU_JIT_ERROR_LOG_BUFFER + CU_JIT_ERROR_LOG_BUFFER_SIZE_BYTES + CU_JIT_OPTIMIZATION_LEVEL + CU_JIT_TARGET_FROM_CUCONTEXT + CU_JIT_TARGET + CU_JIT_FALLBACK_STRATEGY + CU_JIT_GENERATE_DEBUG_INFO + CU_JIT_LOG_VERBOSE + CU_JIT_GENERATE_LINE_INFO + CU_JIT_CACHE_MODE + CU_JIT_NEW_SM3X_OPT + CU_JIT_FAST_COMPILE + CU_JIT_GLOBAL_SYMBOL_NAMES + CU_JIT_GLOBAL_SYMBOL_ADDRESSES + CU_JIT_GLOBAL_SYMBOL_COUNT + CU_JIT_LTO + CU_JIT_FTZ + CU_JIT_PREC_DIV + CU_JIT_PREC_SQRT + CU_JIT_FMA + CU_JIT_REFERENCED_KERNEL_NAMES + CU_JIT_REFERENCED_KERNEL_COUNT + CU_JIT_REFERENCED_VARIABLE_NAMES + CU_JIT_REFERENCED_VARIABLE_COUNT + CU_JIT_OPTIMIZE_UNUSED_DEVICE_VARIABLES + CU_JIT_POSITION_INDEPENDENT_CODE + CU_JIT_MIN_CTA_PER_SM + CU_JIT_MAX_THREADS_PER_BLOCK + CU_JIT_OVERRIDE_DIRECTIVE_VALUES + CU_JIT_SPLIT_COMPILE + CU_JIT_BINARY_LOADER_THREAD_COUNT + CU_JIT_NUM_OPTIONS + ctypedef CUjit_option_enum CUjit_option + +cdef extern from 'cuda.h': + ctypedef enum CUjit_target_enum: + CU_TARGET_COMPUTE_30 + CU_TARGET_COMPUTE_32 + CU_TARGET_COMPUTE_35 + CU_TARGET_COMPUTE_37 + CU_TARGET_COMPUTE_50 + CU_TARGET_COMPUTE_52 + CU_TARGET_COMPUTE_53 + CU_TARGET_COMPUTE_60 + CU_TARGET_COMPUTE_61 + CU_TARGET_COMPUTE_62 + CU_TARGET_COMPUTE_70 + CU_TARGET_COMPUTE_72 + CU_TARGET_COMPUTE_75 + CU_TARGET_COMPUTE_80 + CU_TARGET_COMPUTE_86 + CU_TARGET_COMPUTE_87 + CU_TARGET_COMPUTE_89 + CU_TARGET_COMPUTE_90 + CU_TARGET_COMPUTE_100 + CU_TARGET_COMPUTE_110 + CU_TARGET_COMPUTE_103 + CU_TARGET_COMPUTE_120 + CU_TARGET_COMPUTE_121 + CU_TARGET_COMPUTE_90A + CU_TARGET_COMPUTE_100A + CU_TARGET_COMPUTE_110A + CU_TARGET_COMPUTE_103A + CU_TARGET_COMPUTE_120A + CU_TARGET_COMPUTE_121A + CU_TARGET_COMPUTE_100F + CU_TARGET_COMPUTE_110F + CU_TARGET_COMPUTE_103F + CU_TARGET_COMPUTE_120F + CU_TARGET_COMPUTE_121F + CU_TARGET_COMPUTE_101 + CU_TARGET_COMPUTE_101A + CU_TARGET_COMPUTE_101F + ctypedef CUjit_target_enum CUjit_target + +cdef extern from 'cuda.h': + ctypedef enum CUjit_fallback_enum: + CU_PREFER_PTX + CU_PREFER_BINARY + ctypedef CUjit_fallback_enum CUjit_fallback + +cdef extern from 'cuda.h': + ctypedef enum CUjit_cacheMode_enum: + CU_JIT_CACHE_OPTION_NONE + CU_JIT_CACHE_OPTION_CG + CU_JIT_CACHE_OPTION_CA + ctypedef CUjit_cacheMode_enum CUjit_cacheMode + +cdef extern from 'cuda.h': + ctypedef enum CUjitInputType_enum: + CU_JIT_INPUT_CUBIN + CU_JIT_INPUT_PTX + CU_JIT_INPUT_FATBINARY + CU_JIT_INPUT_OBJECT + CU_JIT_INPUT_LIBRARY + CU_JIT_INPUT_NVVM + CU_JIT_NUM_INPUT_TYPES + ctypedef CUjitInputType_enum CUjitInputType + +cdef extern from 'cuda.h': + ctypedef enum CUgraphicsRegisterFlags_enum: + CU_GRAPHICS_REGISTER_FLAGS_NONE + CU_GRAPHICS_REGISTER_FLAGS_READ_ONLY + CU_GRAPHICS_REGISTER_FLAGS_WRITE_DISCARD + CU_GRAPHICS_REGISTER_FLAGS_SURFACE_LDST + CU_GRAPHICS_REGISTER_FLAGS_TEXTURE_GATHER + ctypedef CUgraphicsRegisterFlags_enum CUgraphicsRegisterFlags + +cdef extern from 'cuda.h': + ctypedef enum CUgraphicsMapResourceFlags_enum: + CU_GRAPHICS_MAP_RESOURCE_FLAGS_NONE + CU_GRAPHICS_MAP_RESOURCE_FLAGS_READ_ONLY + CU_GRAPHICS_MAP_RESOURCE_FLAGS_WRITE_DISCARD + ctypedef CUgraphicsMapResourceFlags_enum CUgraphicsMapResourceFlags + +cdef extern from 'cuda.h': + ctypedef enum CUarray_cubemap_face_enum: + CU_CUBEMAP_FACE_POSITIVE_X + CU_CUBEMAP_FACE_NEGATIVE_X + CU_CUBEMAP_FACE_POSITIVE_Y + CU_CUBEMAP_FACE_NEGATIVE_Y + CU_CUBEMAP_FACE_POSITIVE_Z + CU_CUBEMAP_FACE_NEGATIVE_Z + ctypedef CUarray_cubemap_face_enum CUarray_cubemap_face + +cdef extern from 'cuda.h': + ctypedef enum CUlimit_enum: + CU_LIMIT_STACK_SIZE + CU_LIMIT_PRINTF_FIFO_SIZE + CU_LIMIT_MALLOC_HEAP_SIZE + CU_LIMIT_DEV_RUNTIME_SYNC_DEPTH + CU_LIMIT_DEV_RUNTIME_PENDING_LAUNCH_COUNT + CU_LIMIT_MAX_L2_FETCH_GRANULARITY + CU_LIMIT_PERSISTING_L2_CACHE_SIZE + CU_LIMIT_SHMEM_SIZE + CU_LIMIT_CIG_ENABLED + CU_LIMIT_CIG_SHMEM_FALLBACK_ENABLED + CU_LIMIT_MAX + ctypedef CUlimit_enum CUlimit + +cdef extern from 'cuda.h': + ctypedef enum CUresourcetype_enum: + CU_RESOURCE_TYPE_ARRAY + CU_RESOURCE_TYPE_MIPMAPPED_ARRAY + CU_RESOURCE_TYPE_LINEAR + CU_RESOURCE_TYPE_PITCH2D + ctypedef CUresourcetype_enum CUresourcetype + +cdef extern from 'cuda.h': + ctypedef enum CUaccessProperty_enum: + CU_ACCESS_PROPERTY_NORMAL + CU_ACCESS_PROPERTY_STREAMING + CU_ACCESS_PROPERTY_PERSISTING + ctypedef CUaccessProperty_enum CUaccessProperty + +cdef extern from 'cuda.h': + ctypedef enum CUgraphConditionalNodeType_enum: + CU_GRAPH_COND_TYPE_IF + CU_GRAPH_COND_TYPE_WHILE + CU_GRAPH_COND_TYPE_SWITCH + ctypedef CUgraphConditionalNodeType_enum CUgraphConditionalNodeType + +cdef extern from 'cuda.h': + ctypedef enum CUgraphNodeType_enum: + CU_GRAPH_NODE_TYPE_KERNEL + CU_GRAPH_NODE_TYPE_MEMCPY + CU_GRAPH_NODE_TYPE_MEMSET + CU_GRAPH_NODE_TYPE_HOST + CU_GRAPH_NODE_TYPE_GRAPH + CU_GRAPH_NODE_TYPE_EMPTY + CU_GRAPH_NODE_TYPE_WAIT_EVENT + CU_GRAPH_NODE_TYPE_EVENT_RECORD + CU_GRAPH_NODE_TYPE_EXT_SEMAS_SIGNAL + CU_GRAPH_NODE_TYPE_EXT_SEMAS_WAIT + CU_GRAPH_NODE_TYPE_MEM_ALLOC + CU_GRAPH_NODE_TYPE_MEM_FREE + CU_GRAPH_NODE_TYPE_BATCH_MEM_OP + CU_GRAPH_NODE_TYPE_CONDITIONAL + CU_GRAPH_NODE_TYPE_RESERVED_16 + ctypedef CUgraphNodeType_enum CUgraphNodeType + +cdef extern from 'cuda.h': + ctypedef enum CUgraphDependencyType_enum: + CU_GRAPH_DEPENDENCY_TYPE_DEFAULT + CU_GRAPH_DEPENDENCY_TYPE_PROGRAMMATIC + ctypedef CUgraphDependencyType_enum CUgraphDependencyType + +cdef extern from 'cuda.h': + ctypedef enum CUgraphInstantiateResult_enum: + CUDA_GRAPH_INSTANTIATE_SUCCESS + CUDA_GRAPH_INSTANTIATE_ERROR + CUDA_GRAPH_INSTANTIATE_INVALID_STRUCTURE + CUDA_GRAPH_INSTANTIATE_NODE_OPERATION_NOT_SUPPORTED + CUDA_GRAPH_INSTANTIATE_MULTIPLE_CTXS_NOT_SUPPORTED + CUDA_GRAPH_INSTANTIATE_CONDITIONAL_HANDLE_UNUSED + ctypedef CUgraphInstantiateResult_enum CUgraphInstantiateResult + +cdef extern from 'cuda.h': + ctypedef enum CUsynchronizationPolicy_enum: + CU_SYNC_POLICY_AUTO + CU_SYNC_POLICY_SPIN + CU_SYNC_POLICY_YIELD + CU_SYNC_POLICY_BLOCKING_SYNC + ctypedef CUsynchronizationPolicy_enum CUsynchronizationPolicy + +cdef extern from 'cuda.h': + ctypedef enum CUclusterSchedulingPolicy_enum: + CU_CLUSTER_SCHEDULING_POLICY_DEFAULT + CU_CLUSTER_SCHEDULING_POLICY_SPREAD + CU_CLUSTER_SCHEDULING_POLICY_LOAD_BALANCING + ctypedef CUclusterSchedulingPolicy_enum CUclusterSchedulingPolicy + +cdef extern from 'cuda.h': + ctypedef enum CUlaunchMemSyncDomain_enum: + CU_LAUNCH_MEM_SYNC_DOMAIN_DEFAULT + CU_LAUNCH_MEM_SYNC_DOMAIN_REMOTE + ctypedef CUlaunchMemSyncDomain_enum CUlaunchMemSyncDomain + +cdef extern from 'cuda.h': + ctypedef enum CUlaunchAttributeID_enum: + CU_LAUNCH_ATTRIBUTE_IGNORE + CU_LAUNCH_ATTRIBUTE_ACCESS_POLICY_WINDOW + CU_LAUNCH_ATTRIBUTE_COOPERATIVE + CU_LAUNCH_ATTRIBUTE_SYNCHRONIZATION_POLICY + CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION + CU_LAUNCH_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE + CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_STREAM_SERIALIZATION + CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_EVENT + CU_LAUNCH_ATTRIBUTE_PRIORITY + CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP + CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN + CU_LAUNCH_ATTRIBUTE_PREFERRED_CLUSTER_DIMENSION + CU_LAUNCH_ATTRIBUTE_LAUNCH_COMPLETION_EVENT + CU_LAUNCH_ATTRIBUTE_DEVICE_UPDATABLE_KERNEL_NODE + CU_LAUNCH_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT + CU_LAUNCH_ATTRIBUTE_NVLINK_UTIL_CENTRIC_SCHEDULING + CU_LAUNCH_ATTRIBUTE_PORTABLE_CLUSTER_SIZE_MODE + CU_LAUNCH_ATTRIBUTE_SHARED_MEMORY_MODE + ctypedef CUlaunchAttributeID_enum CUlaunchAttributeID + +cdef extern from 'cuda.h': + ctypedef enum CUstreamCaptureStatus_enum: + CU_STREAM_CAPTURE_STATUS_NONE + CU_STREAM_CAPTURE_STATUS_ACTIVE + CU_STREAM_CAPTURE_STATUS_INVALIDATED + ctypedef CUstreamCaptureStatus_enum CUstreamCaptureStatus + +cdef extern from 'cuda.h': + ctypedef enum CUstreamCaptureMode_enum: + CU_STREAM_CAPTURE_MODE_GLOBAL + CU_STREAM_CAPTURE_MODE_THREAD_LOCAL + CU_STREAM_CAPTURE_MODE_RELAXED + ctypedef CUstreamCaptureMode_enum CUstreamCaptureMode + +cdef extern from 'cuda.h': + ctypedef enum CUdriverProcAddress_flags_enum: + CU_GET_PROC_ADDRESS_DEFAULT + CU_GET_PROC_ADDRESS_LEGACY_STREAM + CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM + ctypedef CUdriverProcAddress_flags_enum CUdriverProcAddress_flags + +cdef extern from 'cuda.h': + ctypedef enum CUdriverProcAddressQueryResult_enum: + CU_GET_PROC_ADDRESS_SUCCESS + CU_GET_PROC_ADDRESS_SYMBOL_NOT_FOUND + CU_GET_PROC_ADDRESS_VERSION_NOT_SUFFICIENT + ctypedef CUdriverProcAddressQueryResult_enum CUdriverProcAddressQueryResult + +cdef extern from 'cuda.h': + ctypedef enum CUexecAffinityType_enum: + CU_EXEC_AFFINITY_TYPE_SM_COUNT + CU_EXEC_AFFINITY_TYPE_MAX + ctypedef CUexecAffinityType_enum CUexecAffinityType + +cdef extern from 'cuda.h': + ctypedef enum CUcigDataType_enum: + CIG_DATA_TYPE_D3D12_COMMAND_QUEUE + CIG_DATA_TYPE_NV_BLOB + ctypedef CUcigDataType_enum CUcigDataType + +cdef extern from 'cuda.h': + ctypedef enum CUlibraryOption_enum: + CU_LIBRARY_HOST_UNIVERSAL_FUNCTION_AND_DATA_TABLE + CU_LIBRARY_BINARY_IS_PRESERVED + CU_LIBRARY_NUM_OPTIONS + ctypedef CUlibraryOption_enum CUlibraryOption + +cdef extern from 'cuda.h': + ctypedef enum cudaError_enum: + CUDA_SUCCESS + CUDA_ERROR_INVALID_VALUE + CUDA_ERROR_OUT_OF_MEMORY + CUDA_ERROR_NOT_INITIALIZED + CUDA_ERROR_DEINITIALIZED + CUDA_ERROR_PROFILER_DISABLED + CUDA_ERROR_PROFILER_NOT_INITIALIZED + CUDA_ERROR_PROFILER_ALREADY_STARTED + CUDA_ERROR_PROFILER_ALREADY_STOPPED + CUDA_ERROR_STUB_LIBRARY + CUDA_ERROR_CALL_REQUIRES_NEWER_DRIVER + CUDA_ERROR_DEVICE_UNAVAILABLE + CUDA_ERROR_NO_DEVICE + CUDA_ERROR_INVALID_DEVICE + CUDA_ERROR_DEVICE_NOT_LICENSED + CUDA_ERROR_INVALID_IMAGE + CUDA_ERROR_INVALID_CONTEXT + CUDA_ERROR_CONTEXT_ALREADY_CURRENT + CUDA_ERROR_MAP_FAILED + CUDA_ERROR_UNMAP_FAILED + CUDA_ERROR_ARRAY_IS_MAPPED + CUDA_ERROR_ALREADY_MAPPED + CUDA_ERROR_NO_BINARY_FOR_GPU + CUDA_ERROR_ALREADY_ACQUIRED + CUDA_ERROR_NOT_MAPPED + CUDA_ERROR_NOT_MAPPED_AS_ARRAY + CUDA_ERROR_NOT_MAPPED_AS_POINTER + CUDA_ERROR_ECC_UNCORRECTABLE + CUDA_ERROR_UNSUPPORTED_LIMIT + CUDA_ERROR_CONTEXT_ALREADY_IN_USE + CUDA_ERROR_PEER_ACCESS_UNSUPPORTED + CUDA_ERROR_INVALID_PTX + CUDA_ERROR_INVALID_GRAPHICS_CONTEXT + CUDA_ERROR_NVLINK_UNCORRECTABLE + CUDA_ERROR_JIT_COMPILER_NOT_FOUND + CUDA_ERROR_UNSUPPORTED_PTX_VERSION + CUDA_ERROR_JIT_COMPILATION_DISABLED + CUDA_ERROR_UNSUPPORTED_EXEC_AFFINITY + CUDA_ERROR_UNSUPPORTED_DEVSIDE_SYNC + CUDA_ERROR_CONTAINED + CUDA_ERROR_INVALID_SOURCE + CUDA_ERROR_FILE_NOT_FOUND + CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND + CUDA_ERROR_SHARED_OBJECT_INIT_FAILED + CUDA_ERROR_OPERATING_SYSTEM + CUDA_ERROR_INVALID_HANDLE + CUDA_ERROR_ILLEGAL_STATE + CUDA_ERROR_LOSSY_QUERY + CUDA_ERROR_NOT_FOUND + CUDA_ERROR_NOT_READY + CUDA_ERROR_ILLEGAL_ADDRESS + CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES + CUDA_ERROR_LAUNCH_TIMEOUT + CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING + CUDA_ERROR_PEER_ACCESS_ALREADY_ENABLED + CUDA_ERROR_PEER_ACCESS_NOT_ENABLED + CUDA_ERROR_PRIMARY_CONTEXT_ACTIVE + CUDA_ERROR_CONTEXT_IS_DESTROYED + CUDA_ERROR_ASSERT + CUDA_ERROR_TOO_MANY_PEERS + CUDA_ERROR_HOST_MEMORY_ALREADY_REGISTERED + CUDA_ERROR_HOST_MEMORY_NOT_REGISTERED + CUDA_ERROR_HARDWARE_STACK_ERROR + CUDA_ERROR_ILLEGAL_INSTRUCTION + CUDA_ERROR_MISALIGNED_ADDRESS + CUDA_ERROR_INVALID_ADDRESS_SPACE + CUDA_ERROR_INVALID_PC + CUDA_ERROR_LAUNCH_FAILED + CUDA_ERROR_COOPERATIVE_LAUNCH_TOO_LARGE + CUDA_ERROR_TENSOR_MEMORY_LEAK + CUDA_ERROR_NOT_PERMITTED + CUDA_ERROR_NOT_SUPPORTED + CUDA_ERROR_SYSTEM_NOT_READY + CUDA_ERROR_SYSTEM_DRIVER_MISMATCH + CUDA_ERROR_COMPAT_NOT_SUPPORTED_ON_DEVICE + CUDA_ERROR_MPS_CONNECTION_FAILED + CUDA_ERROR_MPS_RPC_FAILURE + CUDA_ERROR_MPS_SERVER_NOT_READY + CUDA_ERROR_MPS_MAX_CLIENTS_REACHED + CUDA_ERROR_MPS_MAX_CONNECTIONS_REACHED + CUDA_ERROR_MPS_CLIENT_TERMINATED + CUDA_ERROR_CDP_NOT_SUPPORTED + CUDA_ERROR_CDP_VERSION_MISMATCH + CUDA_ERROR_STREAM_CAPTURE_UNSUPPORTED + CUDA_ERROR_STREAM_CAPTURE_INVALIDATED + CUDA_ERROR_STREAM_CAPTURE_MERGE + CUDA_ERROR_STREAM_CAPTURE_UNMATCHED + CUDA_ERROR_STREAM_CAPTURE_UNJOINED + CUDA_ERROR_STREAM_CAPTURE_ISOLATION + CUDA_ERROR_STREAM_CAPTURE_IMPLICIT + CUDA_ERROR_CAPTURED_EVENT + CUDA_ERROR_STREAM_CAPTURE_WRONG_THREAD + CUDA_ERROR_TIMEOUT + CUDA_ERROR_GRAPH_EXEC_UPDATE_FAILURE + CUDA_ERROR_EXTERNAL_DEVICE + CUDA_ERROR_INVALID_CLUSTER_SIZE + CUDA_ERROR_FUNCTION_NOT_LOADED + CUDA_ERROR_INVALID_RESOURCE_TYPE + CUDA_ERROR_INVALID_RESOURCE_CONFIGURATION + CUDA_ERROR_KEY_ROTATION + CUDA_ERROR_STREAM_DETACHED + CUDA_ERROR_GRAPH_RECAPTURE_FAILURE + CUDA_ERROR_UNKNOWN + ctypedef cudaError_enum CUresult + +cdef extern from 'cuda.h': + ctypedef enum CUdevice_P2PAttribute_enum: + CU_DEVICE_P2P_ATTRIBUTE_PERFORMANCE_RANK + CU_DEVICE_P2P_ATTRIBUTE_ACCESS_SUPPORTED + CU_DEVICE_P2P_ATTRIBUTE_NATIVE_ATOMIC_SUPPORTED + CU_DEVICE_P2P_ATTRIBUTE_ACCESS_ACCESS_SUPPORTED + CU_DEVICE_P2P_ATTRIBUTE_CUDA_ARRAY_ACCESS_SUPPORTED + CU_DEVICE_P2P_ATTRIBUTE_ONLY_PARTIAL_NATIVE_ATOMIC_SUPPORTED + ctypedef CUdevice_P2PAttribute_enum CUdevice_P2PAttribute + +cdef extern from 'cuda.h': + ctypedef enum CUresourceViewFormat_enum: + CU_RES_VIEW_FORMAT_NONE + CU_RES_VIEW_FORMAT_UINT_1X8 + CU_RES_VIEW_FORMAT_UINT_2X8 + CU_RES_VIEW_FORMAT_UINT_4X8 + CU_RES_VIEW_FORMAT_SINT_1X8 + CU_RES_VIEW_FORMAT_SINT_2X8 + CU_RES_VIEW_FORMAT_SINT_4X8 + CU_RES_VIEW_FORMAT_UINT_1X16 + CU_RES_VIEW_FORMAT_UINT_2X16 + CU_RES_VIEW_FORMAT_UINT_4X16 + CU_RES_VIEW_FORMAT_SINT_1X16 + CU_RES_VIEW_FORMAT_SINT_2X16 + CU_RES_VIEW_FORMAT_SINT_4X16 + CU_RES_VIEW_FORMAT_UINT_1X32 + CU_RES_VIEW_FORMAT_UINT_2X32 + CU_RES_VIEW_FORMAT_UINT_4X32 + CU_RES_VIEW_FORMAT_SINT_1X32 + CU_RES_VIEW_FORMAT_SINT_2X32 + CU_RES_VIEW_FORMAT_SINT_4X32 + CU_RES_VIEW_FORMAT_FLOAT_1X16 + CU_RES_VIEW_FORMAT_FLOAT_2X16 + CU_RES_VIEW_FORMAT_FLOAT_4X16 + CU_RES_VIEW_FORMAT_FLOAT_1X32 + CU_RES_VIEW_FORMAT_FLOAT_2X32 + CU_RES_VIEW_FORMAT_FLOAT_4X32 + CU_RES_VIEW_FORMAT_UNSIGNED_BC1 + CU_RES_VIEW_FORMAT_UNSIGNED_BC2 + CU_RES_VIEW_FORMAT_UNSIGNED_BC3 + CU_RES_VIEW_FORMAT_UNSIGNED_BC4 + CU_RES_VIEW_FORMAT_SIGNED_BC4 + CU_RES_VIEW_FORMAT_UNSIGNED_BC5 + CU_RES_VIEW_FORMAT_SIGNED_BC5 + CU_RES_VIEW_FORMAT_UNSIGNED_BC6H + CU_RES_VIEW_FORMAT_SIGNED_BC6H + CU_RES_VIEW_FORMAT_UNSIGNED_BC7 + ctypedef CUresourceViewFormat_enum CUresourceViewFormat + +cdef extern from 'cuda.h': + ctypedef enum CUtensorMapDataType_enum: + CU_TENSOR_MAP_DATA_TYPE_UINT8 + CU_TENSOR_MAP_DATA_TYPE_UINT16 + CU_TENSOR_MAP_DATA_TYPE_UINT32 + CU_TENSOR_MAP_DATA_TYPE_INT32 + CU_TENSOR_MAP_DATA_TYPE_UINT64 + CU_TENSOR_MAP_DATA_TYPE_INT64 + CU_TENSOR_MAP_DATA_TYPE_FLOAT16 + CU_TENSOR_MAP_DATA_TYPE_FLOAT32 + CU_TENSOR_MAP_DATA_TYPE_FLOAT64 + CU_TENSOR_MAP_DATA_TYPE_BFLOAT16 + CU_TENSOR_MAP_DATA_TYPE_FLOAT32_FTZ + CU_TENSOR_MAP_DATA_TYPE_TFLOAT32 + CU_TENSOR_MAP_DATA_TYPE_TFLOAT32_FTZ + CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN8B + CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN16B + CU_TENSOR_MAP_DATA_TYPE_16U6_ALIGN16B + ctypedef CUtensorMapDataType_enum CUtensorMapDataType + +cdef extern from 'cuda.h': + ctypedef enum CUtensorMapInterleave_enum: + CU_TENSOR_MAP_INTERLEAVE_NONE + CU_TENSOR_MAP_INTERLEAVE_16B + CU_TENSOR_MAP_INTERLEAVE_32B + ctypedef CUtensorMapInterleave_enum CUtensorMapInterleave + +cdef extern from 'cuda.h': + ctypedef enum CUtensorMapSwizzle_enum: + CU_TENSOR_MAP_SWIZZLE_NONE + CU_TENSOR_MAP_SWIZZLE_32B + CU_TENSOR_MAP_SWIZZLE_64B + CU_TENSOR_MAP_SWIZZLE_128B + CU_TENSOR_MAP_SWIZZLE_128B_ATOM_32B + CU_TENSOR_MAP_SWIZZLE_128B_ATOM_32B_FLIP_8B + CU_TENSOR_MAP_SWIZZLE_128B_ATOM_64B + ctypedef CUtensorMapSwizzle_enum CUtensorMapSwizzle + +cdef extern from 'cuda.h': + ctypedef enum CUtensorMapL2promotion_enum: + CU_TENSOR_MAP_L2_PROMOTION_NONE + CU_TENSOR_MAP_L2_PROMOTION_L2_64B + CU_TENSOR_MAP_L2_PROMOTION_L2_128B + CU_TENSOR_MAP_L2_PROMOTION_L2_256B + ctypedef CUtensorMapL2promotion_enum CUtensorMapL2promotion + +cdef extern from 'cuda.h': + ctypedef enum CUtensorMapFloatOOBfill_enum: + CU_TENSOR_MAP_FLOAT_OOB_FILL_NONE + CU_TENSOR_MAP_FLOAT_OOB_FILL_NAN_REQUEST_ZERO_FMA + ctypedef CUtensorMapFloatOOBfill_enum CUtensorMapFloatOOBfill + +cdef extern from 'cuda.h': + ctypedef enum CUtensorMapIm2ColWideMode_enum: + CU_TENSOR_MAP_IM2COL_WIDE_MODE_W + CU_TENSOR_MAP_IM2COL_WIDE_MODE_W128 + ctypedef CUtensorMapIm2ColWideMode_enum CUtensorMapIm2ColWideMode + +cdef extern from 'cuda.h': + ctypedef enum CUDA_POINTER_ATTRIBUTE_ACCESS_FLAGS_enum: + CU_POINTER_ATTRIBUTE_ACCESS_FLAG_NONE + CU_POINTER_ATTRIBUTE_ACCESS_FLAG_READ + CU_POINTER_ATTRIBUTE_ACCESS_FLAG_READWRITE + ctypedef CUDA_POINTER_ATTRIBUTE_ACCESS_FLAGS_enum CUDA_POINTER_ATTRIBUTE_ACCESS_FLAGS + +cdef extern from 'cuda.h': + ctypedef enum CUexternalMemoryHandleType_enum: + CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD + CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32 + CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT + CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP + CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE + CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE + CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE_KMT + CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF + CU_EXTERNAL_MEMORY_HANDLE_TYPE_DMABUF_FD + ctypedef CUexternalMemoryHandleType_enum CUexternalMemoryHandleType + +cdef extern from 'cuda.h': + ctypedef enum CUexternalSemaphoreHandleType_enum: + CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD + CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32 + CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT + CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE + CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_FENCE + CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC + CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX + CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX_KMT + CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_FD + CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_WIN32 + ctypedef CUexternalSemaphoreHandleType_enum CUexternalSemaphoreHandleType + +cdef extern from 'cuda.h': + ctypedef enum CUmemAllocationHandleType_enum: + CU_MEM_HANDLE_TYPE_NONE + CU_MEM_HANDLE_TYPE_POSIX_FILE_DESCRIPTOR + CU_MEM_HANDLE_TYPE_WIN32 + CU_MEM_HANDLE_TYPE_WIN32_KMT + CU_MEM_HANDLE_TYPE_FABRIC + CU_MEM_HANDLE_TYPE_MAX + ctypedef CUmemAllocationHandleType_enum CUmemAllocationHandleType + +cdef extern from 'cuda.h': + ctypedef enum CUmemAccess_flags_enum: + CU_MEM_ACCESS_FLAGS_PROT_NONE + CU_MEM_ACCESS_FLAGS_PROT_READ + CU_MEM_ACCESS_FLAGS_PROT_READWRITE + CU_MEM_ACCESS_FLAGS_PROT_MAX + ctypedef CUmemAccess_flags_enum CUmemAccess_flags + +cdef extern from 'cuda.h': + ctypedef enum CUmemLocationType_enum: + CU_MEM_LOCATION_TYPE_INVALID + CU_MEM_LOCATION_TYPE_NONE + CU_MEM_LOCATION_TYPE_DEVICE + CU_MEM_LOCATION_TYPE_HOST + CU_MEM_LOCATION_TYPE_HOST_NUMA + CU_MEM_LOCATION_TYPE_HOST_NUMA_CURRENT + CU_MEM_LOCATION_TYPE_INVISIBLE + CU_MEM_LOCATION_TYPE_MAX + ctypedef CUmemLocationType_enum CUmemLocationType + +cdef extern from 'cuda.h': + ctypedef enum CUmemAllocationType_enum: + CU_MEM_ALLOCATION_TYPE_INVALID + CU_MEM_ALLOCATION_TYPE_PINNED + CU_MEM_ALLOCATION_TYPE_MANAGED + CU_MEM_ALLOCATION_TYPE_MAX + ctypedef CUmemAllocationType_enum CUmemAllocationType + +cdef extern from 'cuda.h': + ctypedef enum CUmemAllocationGranularity_flags_enum: + CU_MEM_ALLOC_GRANULARITY_MINIMUM + CU_MEM_ALLOC_GRANULARITY_RECOMMENDED + ctypedef CUmemAllocationGranularity_flags_enum CUmemAllocationGranularity_flags + +cdef extern from 'cuda.h': + ctypedef enum CUmemRangeHandleType_enum: + CU_MEM_RANGE_HANDLE_TYPE_DMA_BUF_FD + CU_MEM_RANGE_HANDLE_TYPE_MAX + ctypedef CUmemRangeHandleType_enum CUmemRangeHandleType + +cdef extern from 'cuda.h': + ctypedef enum CUmemRangeFlags_enum: + CU_MEM_RANGE_FLAG_DMA_BUF_MAPPING_TYPE_PCIE + ctypedef CUmemRangeFlags_enum CUmemRangeFlags + +cdef extern from 'cuda.h': + ctypedef enum CUarraySparseSubresourceType_enum: + CU_ARRAY_SPARSE_SUBRESOURCE_TYPE_SPARSE_LEVEL + CU_ARRAY_SPARSE_SUBRESOURCE_TYPE_MIPTAIL + ctypedef CUarraySparseSubresourceType_enum CUarraySparseSubresourceType + +cdef extern from 'cuda.h': + ctypedef enum CUmemOperationType_enum: + CU_MEM_OPERATION_TYPE_MAP + CU_MEM_OPERATION_TYPE_UNMAP + ctypedef CUmemOperationType_enum CUmemOperationType + +cdef extern from 'cuda.h': + ctypedef enum CUmemHandleType_enum: + CU_MEM_HANDLE_TYPE_GENERIC + ctypedef CUmemHandleType_enum CUmemHandleType + +cdef extern from 'cuda.h': + ctypedef enum CUmemAllocationCompType_enum: + CU_MEM_ALLOCATION_COMP_NONE + CU_MEM_ALLOCATION_COMP_GENERIC + ctypedef CUmemAllocationCompType_enum CUmemAllocationCompType + +cdef extern from 'cuda.h': + ctypedef enum CUmulticastGranularity_flags_enum: + CU_MULTICAST_GRANULARITY_MINIMUM + CU_MULTICAST_GRANULARITY_RECOMMENDED + ctypedef CUmulticastGranularity_flags_enum CUmulticastGranularity_flags + +cdef extern from 'cuda.h': + ctypedef enum CUgraphExecUpdateResult_enum: + CU_GRAPH_EXEC_UPDATE_SUCCESS + CU_GRAPH_EXEC_UPDATE_ERROR + CU_GRAPH_EXEC_UPDATE_ERROR_TOPOLOGY_CHANGED + CU_GRAPH_EXEC_UPDATE_ERROR_NODE_TYPE_CHANGED + CU_GRAPH_EXEC_UPDATE_ERROR_FUNCTION_CHANGED + CU_GRAPH_EXEC_UPDATE_ERROR_PARAMETERS_CHANGED + CU_GRAPH_EXEC_UPDATE_ERROR_NOT_SUPPORTED + CU_GRAPH_EXEC_UPDATE_ERROR_UNSUPPORTED_FUNCTION_CHANGE + CU_GRAPH_EXEC_UPDATE_ERROR_ATTRIBUTES_CHANGED + ctypedef CUgraphExecUpdateResult_enum CUgraphExecUpdateResult + +cdef extern from 'cuda.h': + ctypedef enum CUmemPool_attribute_enum: + CU_MEMPOOL_ATTR_REUSE_FOLLOW_EVENT_DEPENDENCIES + CU_MEMPOOL_ATTR_REUSE_ALLOW_OPPORTUNISTIC + CU_MEMPOOL_ATTR_REUSE_ALLOW_INTERNAL_DEPENDENCIES + CU_MEMPOOL_ATTR_RELEASE_THRESHOLD + CU_MEMPOOL_ATTR_RESERVED_MEM_CURRENT + CU_MEMPOOL_ATTR_RESERVED_MEM_HIGH + CU_MEMPOOL_ATTR_USED_MEM_CURRENT + CU_MEMPOOL_ATTR_USED_MEM_HIGH + CU_MEMPOOL_ATTR_ALLOCATION_TYPE + CU_MEMPOOL_ATTR_EXPORT_HANDLE_TYPES + CU_MEMPOOL_ATTR_LOCATION_ID + CU_MEMPOOL_ATTR_LOCATION_TYPE + CU_MEMPOOL_ATTR_MAX_POOL_SIZE + CU_MEMPOOL_ATTR_HW_DECOMPRESS_ENABLED + ctypedef CUmemPool_attribute_enum CUmemPool_attribute + +cdef extern from 'cuda.h': + ctypedef enum CUmemcpyFlags_enum: + CU_MEMCPY_FLAG_DEFAULT + CU_MEMCPY_FLAG_PREFER_OVERLAP_WITH_COMPUTE + ctypedef CUmemcpyFlags_enum CUmemcpyFlags + +cdef extern from 'cuda.h': + ctypedef enum CUmemcpySrcAccessOrder_enum: + CU_MEMCPY_SRC_ACCESS_ORDER_INVALID + CU_MEMCPY_SRC_ACCESS_ORDER_STREAM + CU_MEMCPY_SRC_ACCESS_ORDER_DURING_API_CALL + CU_MEMCPY_SRC_ACCESS_ORDER_ANY + CU_MEMCPY_SRC_ACCESS_ORDER_MAX + ctypedef CUmemcpySrcAccessOrder_enum CUmemcpySrcAccessOrder + +cdef extern from 'cuda.h': + ctypedef enum CUmemcpy3DOperandType_enum: + CU_MEMCPY_OPERAND_TYPE_POINTER + CU_MEMCPY_OPERAND_TYPE_ARRAY + CU_MEMCPY_OPERAND_TYPE_MAX + ctypedef CUmemcpy3DOperandType_enum CUmemcpy3DOperandType + +cdef extern from 'cuda.h': + ctypedef enum CUgraphMem_attribute_enum: + CU_GRAPH_MEM_ATTR_USED_MEM_CURRENT + CU_GRAPH_MEM_ATTR_USED_MEM_HIGH + CU_GRAPH_MEM_ATTR_RESERVED_MEM_CURRENT + CU_GRAPH_MEM_ATTR_RESERVED_MEM_HIGH + ctypedef CUgraphMem_attribute_enum CUgraphMem_attribute + +cdef extern from 'cuda.h': + ctypedef enum CUgraphChildGraphNodeOwnership_enum: + CU_GRAPH_CHILD_GRAPH_OWNERSHIP_CLONE + CU_GRAPH_CHILD_GRAPH_OWNERSHIP_MOVE + CU_GRAPH_CHILD_GRAPH_OWNERSHIP_INVALID + ctypedef CUgraphChildGraphNodeOwnership_enum CUgraphChildGraphNodeOwnership + +cdef extern from 'cuda.h': + ctypedef enum CUflushGPUDirectRDMAWritesOptions_enum: + CU_FLUSH_GPU_DIRECT_RDMA_WRITES_OPTION_HOST + CU_FLUSH_GPU_DIRECT_RDMA_WRITES_OPTION_MEMOPS + ctypedef CUflushGPUDirectRDMAWritesOptions_enum CUflushGPUDirectRDMAWritesOptions + +cdef extern from 'cuda.h': + ctypedef enum CUGPUDirectRDMAWritesOrdering_enum: + CU_GPU_DIRECT_RDMA_WRITES_ORDERING_NONE + CU_GPU_DIRECT_RDMA_WRITES_ORDERING_OWNER + CU_GPU_DIRECT_RDMA_WRITES_ORDERING_ALL_DEVICES + ctypedef CUGPUDirectRDMAWritesOrdering_enum CUGPUDirectRDMAWritesOrdering + +cdef extern from 'cuda.h': + ctypedef enum CUflushGPUDirectRDMAWritesScope_enum: + CU_FLUSH_GPU_DIRECT_RDMA_WRITES_TO_OWNER + CU_FLUSH_GPU_DIRECT_RDMA_WRITES_TO_ALL_DEVICES + ctypedef CUflushGPUDirectRDMAWritesScope_enum CUflushGPUDirectRDMAWritesScope + +cdef extern from 'cuda.h': + ctypedef enum CUflushGPUDirectRDMAWritesTarget_enum: + CU_FLUSH_GPU_DIRECT_RDMA_WRITES_TARGET_CURRENT_CTX + ctypedef CUflushGPUDirectRDMAWritesTarget_enum CUflushGPUDirectRDMAWritesTarget + +cdef extern from 'cuda.h': + ctypedef enum CUgraphDebugDot_flags_enum: + CU_GRAPH_DEBUG_DOT_FLAGS_VERBOSE + CU_GRAPH_DEBUG_DOT_FLAGS_RUNTIME_TYPES + CU_GRAPH_DEBUG_DOT_FLAGS_KERNEL_NODE_PARAMS + CU_GRAPH_DEBUG_DOT_FLAGS_MEMCPY_NODE_PARAMS + CU_GRAPH_DEBUG_DOT_FLAGS_MEMSET_NODE_PARAMS + CU_GRAPH_DEBUG_DOT_FLAGS_HOST_NODE_PARAMS + CU_GRAPH_DEBUG_DOT_FLAGS_EVENT_NODE_PARAMS + CU_GRAPH_DEBUG_DOT_FLAGS_EXT_SEMAS_SIGNAL_NODE_PARAMS + CU_GRAPH_DEBUG_DOT_FLAGS_EXT_SEMAS_WAIT_NODE_PARAMS + CU_GRAPH_DEBUG_DOT_FLAGS_KERNEL_NODE_ATTRIBUTES + CU_GRAPH_DEBUG_DOT_FLAGS_HANDLES + CU_GRAPH_DEBUG_DOT_FLAGS_MEM_ALLOC_NODE_PARAMS + CU_GRAPH_DEBUG_DOT_FLAGS_MEM_FREE_NODE_PARAMS + CU_GRAPH_DEBUG_DOT_FLAGS_BATCH_MEM_OP_NODE_PARAMS + CU_GRAPH_DEBUG_DOT_FLAGS_EXTRA_TOPO_INFO + CU_GRAPH_DEBUG_DOT_FLAGS_CONDITIONAL_NODE_PARAMS + ctypedef CUgraphDebugDot_flags_enum CUgraphDebugDot_flags + +cdef extern from 'cuda.h': + ctypedef enum CUuserObject_flags_enum: + CU_USER_OBJECT_NO_DESTRUCTOR_SYNC + ctypedef CUuserObject_flags_enum CUuserObject_flags + +cdef extern from 'cuda.h': + ctypedef enum CUuserObjectRetain_flags_enum: + CU_GRAPH_USER_OBJECT_MOVE + ctypedef CUuserObjectRetain_flags_enum CUuserObjectRetain_flags + +cdef extern from 'cuda.h': + ctypedef enum CUgraphInstantiate_flags_enum: + CUDA_GRAPH_INSTANTIATE_FLAG_AUTO_FREE_ON_LAUNCH + CUDA_GRAPH_INSTANTIATE_FLAG_UPLOAD + CUDA_GRAPH_INSTANTIATE_FLAG_DEVICE_LAUNCH + CUDA_GRAPH_INSTANTIATE_FLAG_USE_NODE_PRIORITY + ctypedef CUgraphInstantiate_flags_enum CUgraphInstantiate_flags + +cdef extern from 'cuda.h': + ctypedef enum CUdeviceNumaConfig_enum: + CU_DEVICE_NUMA_CONFIG_NONE + CU_DEVICE_NUMA_CONFIG_NUMA_NODE + ctypedef CUdeviceNumaConfig_enum CUdeviceNumaConfig + +cdef extern from 'cuda.h': + ctypedef enum CUprocessState_enum: + CU_PROCESS_STATE_RUNNING + CU_PROCESS_STATE_LOCKED + CU_PROCESS_STATE_CHECKPOINTED + CU_PROCESS_STATE_FAILED + ctypedef CUprocessState_enum CUprocessState + +cdef extern from 'cuda.h': + ctypedef enum CUmoduleLoadingMode_enum: + CU_MODULE_EAGER_LOADING + CU_MODULE_LAZY_LOADING + ctypedef CUmoduleLoadingMode_enum CUmoduleLoadingMode + +cdef extern from 'cuda.h': + ctypedef enum CUmemDecompressAlgorithm_enum: + CU_MEM_DECOMPRESS_UNSUPPORTED + CU_MEM_DECOMPRESS_ALGORITHM_DEFLATE + CU_MEM_DECOMPRESS_ALGORITHM_SNAPPY + CU_MEM_DECOMPRESS_ALGORITHM_LZ4 + ctypedef CUmemDecompressAlgorithm_enum CUmemDecompressAlgorithm + +cdef extern from 'cuda.h': + ctypedef enum CUfunctionLoadingState_enum: + CU_FUNCTION_LOADING_STATE_UNLOADED + CU_FUNCTION_LOADING_STATE_LOADED + CU_FUNCTION_LOADING_STATE_MAX + ctypedef CUfunctionLoadingState_enum CUfunctionLoadingState + +cdef extern from 'cuda.h': + ctypedef enum CUcoredumpSettings_enum: + CU_COREDUMP_ENABLE_ON_EXCEPTION + CU_COREDUMP_TRIGGER_HOST + CU_COREDUMP_LIGHTWEIGHT + CU_COREDUMP_ENABLE_USER_TRIGGER + CU_COREDUMP_FILE + CU_COREDUMP_PIPE + CU_COREDUMP_GENERATION_FLAGS + CU_COREDUMP_MAX + ctypedef CUcoredumpSettings_enum CUcoredumpSettings + +cdef extern from 'cuda.h': + ctypedef enum CUCoredumpGenerationFlags: + CU_COREDUMP_DEFAULT_FLAGS + CU_COREDUMP_SKIP_NONRELOCATED_ELF_IMAGES + CU_COREDUMP_SKIP_GLOBAL_MEMORY + CU_COREDUMP_SKIP_SHARED_MEMORY + CU_COREDUMP_SKIP_LOCAL_MEMORY + CU_COREDUMP_SKIP_ABORT + CU_COREDUMP_SKIP_CONSTBANK_MEMORY + CU_COREDUMP_GZIP_COMPRESS + CU_COREDUMP_FAULTED_CONTEXTS_ONLY + CU_COREDUMP_NO_ERRBAR_AT_EXIT + CU_COREDUMP_LOG_ONLY + CU_COREDUMP_LIGHTWEIGHT_FLAGS + +cdef extern from 'cuda.h': + ctypedef enum CUgreenCtxCreate_flags "CUgreenCtxCreate_flags": + CU_GREEN_CTX_NONE + CU_GREEN_CTX_DEFAULT_STREAM + +cdef extern from 'cuda.h': + ctypedef enum CUdevResourceType "CUdevResourceType": + CU_DEV_RESOURCE_TYPE_INVALID + CU_DEV_RESOURCE_TYPE_SM + CU_DEV_RESOURCE_TYPE_WORKQUEUE_CONFIG + CU_DEV_RESOURCE_TYPE_WORKQUEUE + +cdef extern from 'cuda.h': + ctypedef enum CUlogLevel_enum: + CU_LOG_LEVEL_ERROR + CU_LOG_LEVEL_WARNING + ctypedef CUlogLevel_enum CUlogLevel + +ctypedef enum CUeglFrameType_enum "CUeglFrameType_enum": + CU_EGL_FRAME_TYPE_ARRAY "CU_EGL_FRAME_TYPE_ARRAY" = 0 + CU_EGL_FRAME_TYPE_PITCH "CU_EGL_FRAME_TYPE_PITCH" = 1 +ctypedef CUeglFrameType_enum CUeglFrameType "CUeglFrameType" + +ctypedef enum CUeglResourceLocationFlags_enum "CUeglResourceLocationFlags_enum": + CU_EGL_RESOURCE_LOCATION_SYSMEM "CU_EGL_RESOURCE_LOCATION_SYSMEM" = 0x00 + CU_EGL_RESOURCE_LOCATION_VIDMEM "CU_EGL_RESOURCE_LOCATION_VIDMEM" = 0x01 +ctypedef CUeglResourceLocationFlags_enum CUeglResourceLocationFlags "CUeglResourceLocationFlags" + +ctypedef enum CUeglColorFormat_enum "CUeglColorFormat_enum": + CU_EGL_COLOR_FORMAT_YUV420_PLANAR "CU_EGL_COLOR_FORMAT_YUV420_PLANAR" = 0x00 + CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR "CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR" = 0x01 + CU_EGL_COLOR_FORMAT_YUV422_PLANAR "CU_EGL_COLOR_FORMAT_YUV422_PLANAR" = 0x02 + CU_EGL_COLOR_FORMAT_YUV422_SEMIPLANAR "CU_EGL_COLOR_FORMAT_YUV422_SEMIPLANAR" = 0x03 + CU_EGL_COLOR_FORMAT_RGB "CU_EGL_COLOR_FORMAT_RGB" = 0x04 + CU_EGL_COLOR_FORMAT_BGR "CU_EGL_COLOR_FORMAT_BGR" = 0x05 + CU_EGL_COLOR_FORMAT_ARGB "CU_EGL_COLOR_FORMAT_ARGB" = 0x06 + CU_EGL_COLOR_FORMAT_RGBA "CU_EGL_COLOR_FORMAT_RGBA" = 0x07 + CU_EGL_COLOR_FORMAT_L "CU_EGL_COLOR_FORMAT_L" = 0x08 + CU_EGL_COLOR_FORMAT_R "CU_EGL_COLOR_FORMAT_R" = 0x09 + CU_EGL_COLOR_FORMAT_YUV444_PLANAR "CU_EGL_COLOR_FORMAT_YUV444_PLANAR" = 0x0A + CU_EGL_COLOR_FORMAT_YUV444_SEMIPLANAR "CU_EGL_COLOR_FORMAT_YUV444_SEMIPLANAR" = 0x0B + CU_EGL_COLOR_FORMAT_YUYV_422 "CU_EGL_COLOR_FORMAT_YUYV_422" = 0x0C + CU_EGL_COLOR_FORMAT_UYVY_422 "CU_EGL_COLOR_FORMAT_UYVY_422" = 0x0D + CU_EGL_COLOR_FORMAT_ABGR "CU_EGL_COLOR_FORMAT_ABGR" = 0x0E + CU_EGL_COLOR_FORMAT_BGRA "CU_EGL_COLOR_FORMAT_BGRA" = 0x0F + CU_EGL_COLOR_FORMAT_A "CU_EGL_COLOR_FORMAT_A" = 0x10 + CU_EGL_COLOR_FORMAT_RG "CU_EGL_COLOR_FORMAT_RG" = 0x11 + CU_EGL_COLOR_FORMAT_AYUV "CU_EGL_COLOR_FORMAT_AYUV" = 0x12 + CU_EGL_COLOR_FORMAT_YVU444_SEMIPLANAR "CU_EGL_COLOR_FORMAT_YVU444_SEMIPLANAR" = 0x13 + CU_EGL_COLOR_FORMAT_YVU422_SEMIPLANAR "CU_EGL_COLOR_FORMAT_YVU422_SEMIPLANAR" = 0x14 + CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR "CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR" = 0x15 + CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR "CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR" = 0x16 + CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR "CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR" = 0x17 + CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR "CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR" = 0x18 + CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR "CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR" = 0x19 + CU_EGL_COLOR_FORMAT_VYUY_ER "CU_EGL_COLOR_FORMAT_VYUY_ER" = 0x1A + CU_EGL_COLOR_FORMAT_UYVY_ER "CU_EGL_COLOR_FORMAT_UYVY_ER" = 0x1B + CU_EGL_COLOR_FORMAT_YUYV_ER "CU_EGL_COLOR_FORMAT_YUYV_ER" = 0x1C + CU_EGL_COLOR_FORMAT_YVYU_ER "CU_EGL_COLOR_FORMAT_YVYU_ER" = 0x1D + CU_EGL_COLOR_FORMAT_YUV_ER "CU_EGL_COLOR_FORMAT_YUV_ER" = 0x1E + CU_EGL_COLOR_FORMAT_YUVA_ER "CU_EGL_COLOR_FORMAT_YUVA_ER" = 0x1F + CU_EGL_COLOR_FORMAT_AYUV_ER "CU_EGL_COLOR_FORMAT_AYUV_ER" = 0x20 + CU_EGL_COLOR_FORMAT_YUV444_PLANAR_ER "CU_EGL_COLOR_FORMAT_YUV444_PLANAR_ER" = 0x21 + CU_EGL_COLOR_FORMAT_YUV422_PLANAR_ER "CU_EGL_COLOR_FORMAT_YUV422_PLANAR_ER" = 0x22 + CU_EGL_COLOR_FORMAT_YUV420_PLANAR_ER "CU_EGL_COLOR_FORMAT_YUV420_PLANAR_ER" = 0x23 + CU_EGL_COLOR_FORMAT_YUV444_SEMIPLANAR_ER "CU_EGL_COLOR_FORMAT_YUV444_SEMIPLANAR_ER" = 0x24 + CU_EGL_COLOR_FORMAT_YUV422_SEMIPLANAR_ER "CU_EGL_COLOR_FORMAT_YUV422_SEMIPLANAR_ER" = 0x25 + CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR_ER "CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR_ER" = 0x26 + CU_EGL_COLOR_FORMAT_YVU444_PLANAR_ER "CU_EGL_COLOR_FORMAT_YVU444_PLANAR_ER" = 0x27 + CU_EGL_COLOR_FORMAT_YVU422_PLANAR_ER "CU_EGL_COLOR_FORMAT_YVU422_PLANAR_ER" = 0x28 + CU_EGL_COLOR_FORMAT_YVU420_PLANAR_ER "CU_EGL_COLOR_FORMAT_YVU420_PLANAR_ER" = 0x29 + CU_EGL_COLOR_FORMAT_YVU444_SEMIPLANAR_ER "CU_EGL_COLOR_FORMAT_YVU444_SEMIPLANAR_ER" = 0x2A + CU_EGL_COLOR_FORMAT_YVU422_SEMIPLANAR_ER "CU_EGL_COLOR_FORMAT_YVU422_SEMIPLANAR_ER" = 0x2B + CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR_ER "CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR_ER" = 0x2C + CU_EGL_COLOR_FORMAT_BAYER_RGGB "CU_EGL_COLOR_FORMAT_BAYER_RGGB" = 0x2D + CU_EGL_COLOR_FORMAT_BAYER_BGGR "CU_EGL_COLOR_FORMAT_BAYER_BGGR" = 0x2E + CU_EGL_COLOR_FORMAT_BAYER_GRBG "CU_EGL_COLOR_FORMAT_BAYER_GRBG" = 0x2F + CU_EGL_COLOR_FORMAT_BAYER_GBRG "CU_EGL_COLOR_FORMAT_BAYER_GBRG" = 0x30 + CU_EGL_COLOR_FORMAT_BAYER10_RGGB "CU_EGL_COLOR_FORMAT_BAYER10_RGGB" = 0x31 + CU_EGL_COLOR_FORMAT_BAYER10_BGGR "CU_EGL_COLOR_FORMAT_BAYER10_BGGR" = 0x32 + CU_EGL_COLOR_FORMAT_BAYER10_GRBG "CU_EGL_COLOR_FORMAT_BAYER10_GRBG" = 0x33 + CU_EGL_COLOR_FORMAT_BAYER10_GBRG "CU_EGL_COLOR_FORMAT_BAYER10_GBRG" = 0x34 + CU_EGL_COLOR_FORMAT_BAYER12_RGGB "CU_EGL_COLOR_FORMAT_BAYER12_RGGB" = 0x35 + CU_EGL_COLOR_FORMAT_BAYER12_BGGR "CU_EGL_COLOR_FORMAT_BAYER12_BGGR" = 0x36 + CU_EGL_COLOR_FORMAT_BAYER12_GRBG "CU_EGL_COLOR_FORMAT_BAYER12_GRBG" = 0x37 + CU_EGL_COLOR_FORMAT_BAYER12_GBRG "CU_EGL_COLOR_FORMAT_BAYER12_GBRG" = 0x38 + CU_EGL_COLOR_FORMAT_BAYER14_RGGB "CU_EGL_COLOR_FORMAT_BAYER14_RGGB" = 0x39 + CU_EGL_COLOR_FORMAT_BAYER14_BGGR "CU_EGL_COLOR_FORMAT_BAYER14_BGGR" = 0x3A + CU_EGL_COLOR_FORMAT_BAYER14_GRBG "CU_EGL_COLOR_FORMAT_BAYER14_GRBG" = 0x3B + CU_EGL_COLOR_FORMAT_BAYER14_GBRG "CU_EGL_COLOR_FORMAT_BAYER14_GBRG" = 0x3C + CU_EGL_COLOR_FORMAT_BAYER20_RGGB "CU_EGL_COLOR_FORMAT_BAYER20_RGGB" = 0x3D + CU_EGL_COLOR_FORMAT_BAYER20_BGGR "CU_EGL_COLOR_FORMAT_BAYER20_BGGR" = 0x3E + CU_EGL_COLOR_FORMAT_BAYER20_GRBG "CU_EGL_COLOR_FORMAT_BAYER20_GRBG" = 0x3F + CU_EGL_COLOR_FORMAT_BAYER20_GBRG "CU_EGL_COLOR_FORMAT_BAYER20_GBRG" = 0x40 + CU_EGL_COLOR_FORMAT_YVU444_PLANAR "CU_EGL_COLOR_FORMAT_YVU444_PLANAR" = 0x41 + CU_EGL_COLOR_FORMAT_YVU422_PLANAR "CU_EGL_COLOR_FORMAT_YVU422_PLANAR" = 0x42 + CU_EGL_COLOR_FORMAT_YVU420_PLANAR "CU_EGL_COLOR_FORMAT_YVU420_PLANAR" = 0x43 + CU_EGL_COLOR_FORMAT_BAYER_ISP_RGGB "CU_EGL_COLOR_FORMAT_BAYER_ISP_RGGB" = 0x44 + CU_EGL_COLOR_FORMAT_BAYER_ISP_BGGR "CU_EGL_COLOR_FORMAT_BAYER_ISP_BGGR" = 0x45 + CU_EGL_COLOR_FORMAT_BAYER_ISP_GRBG "CU_EGL_COLOR_FORMAT_BAYER_ISP_GRBG" = 0x46 + CU_EGL_COLOR_FORMAT_BAYER_ISP_GBRG "CU_EGL_COLOR_FORMAT_BAYER_ISP_GBRG" = 0x47 + CU_EGL_COLOR_FORMAT_BAYER_BCCR "CU_EGL_COLOR_FORMAT_BAYER_BCCR" = 0x48 + CU_EGL_COLOR_FORMAT_BAYER_RCCB "CU_EGL_COLOR_FORMAT_BAYER_RCCB" = 0x49 + CU_EGL_COLOR_FORMAT_BAYER_CRBC "CU_EGL_COLOR_FORMAT_BAYER_CRBC" = 0x4A + CU_EGL_COLOR_FORMAT_BAYER_CBRC "CU_EGL_COLOR_FORMAT_BAYER_CBRC" = 0x4B + CU_EGL_COLOR_FORMAT_BAYER10_CCCC "CU_EGL_COLOR_FORMAT_BAYER10_CCCC" = 0x4C + CU_EGL_COLOR_FORMAT_BAYER12_BCCR "CU_EGL_COLOR_FORMAT_BAYER12_BCCR" = 0x4D + CU_EGL_COLOR_FORMAT_BAYER12_RCCB "CU_EGL_COLOR_FORMAT_BAYER12_RCCB" = 0x4E + CU_EGL_COLOR_FORMAT_BAYER12_CRBC "CU_EGL_COLOR_FORMAT_BAYER12_CRBC" = 0x4F + CU_EGL_COLOR_FORMAT_BAYER12_CBRC "CU_EGL_COLOR_FORMAT_BAYER12_CBRC" = 0x50 + CU_EGL_COLOR_FORMAT_BAYER12_CCCC "CU_EGL_COLOR_FORMAT_BAYER12_CCCC" = 0x51 + CU_EGL_COLOR_FORMAT_Y "CU_EGL_COLOR_FORMAT_Y" = 0x52 + CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR_2020 "CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR_2020" = 0x53 + CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR_2020 "CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR_2020" = 0x54 + CU_EGL_COLOR_FORMAT_YUV420_PLANAR_2020 "CU_EGL_COLOR_FORMAT_YUV420_PLANAR_2020" = 0x55 + CU_EGL_COLOR_FORMAT_YVU420_PLANAR_2020 "CU_EGL_COLOR_FORMAT_YVU420_PLANAR_2020" = 0x56 + CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR_709 "CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR_709" = 0x57 + CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR_709 "CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR_709" = 0x58 + CU_EGL_COLOR_FORMAT_YUV420_PLANAR_709 "CU_EGL_COLOR_FORMAT_YUV420_PLANAR_709" = 0x59 + CU_EGL_COLOR_FORMAT_YVU420_PLANAR_709 "CU_EGL_COLOR_FORMAT_YVU420_PLANAR_709" = 0x5A + CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_709 "CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_709" = 0x5B + CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_2020 "CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_2020" = 0x5C + CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR_2020 "CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR_2020" = 0x5D + CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR "CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR" = 0x5E + CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR_709 "CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR_709" = 0x5F + CU_EGL_COLOR_FORMAT_Y_ER "CU_EGL_COLOR_FORMAT_Y_ER" = 0x60 + CU_EGL_COLOR_FORMAT_Y_709_ER "CU_EGL_COLOR_FORMAT_Y_709_ER" = 0x61 + CU_EGL_COLOR_FORMAT_Y10_ER "CU_EGL_COLOR_FORMAT_Y10_ER" = 0x62 + CU_EGL_COLOR_FORMAT_Y10_709_ER "CU_EGL_COLOR_FORMAT_Y10_709_ER" = 0x63 + CU_EGL_COLOR_FORMAT_Y12_ER "CU_EGL_COLOR_FORMAT_Y12_ER" = 0x64 + CU_EGL_COLOR_FORMAT_Y12_709_ER "CU_EGL_COLOR_FORMAT_Y12_709_ER" = 0x65 + CU_EGL_COLOR_FORMAT_YUVA "CU_EGL_COLOR_FORMAT_YUVA" = 0x66 + CU_EGL_COLOR_FORMAT_YUV "CU_EGL_COLOR_FORMAT_YUV" = 0x67 + CU_EGL_COLOR_FORMAT_YVYU "CU_EGL_COLOR_FORMAT_YVYU" = 0x68 + CU_EGL_COLOR_FORMAT_VYUY "CU_EGL_COLOR_FORMAT_VYUY" = 0x69 + CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_ER "CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_ER" = 0x6A + CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_709_ER "CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_709_ER" = 0x6B + CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR_ER "CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR_ER" = 0x6C + CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR_709_ER "CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR_709_ER" = 0x6D + CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR_ER "CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR_ER" = 0x6E + CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR_709_ER "CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR_709_ER" = 0x6F + CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR_ER "CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR_ER" = 0x70 + CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR_709_ER "CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR_709_ER" = 0x71 + CU_EGL_COLOR_FORMAT_UYVY_709 "CU_EGL_COLOR_FORMAT_UYVY_709" = 0x72 + CU_EGL_COLOR_FORMAT_UYVY_709_ER "CU_EGL_COLOR_FORMAT_UYVY_709_ER" = 0x73 + CU_EGL_COLOR_FORMAT_UYVY_2020 "CU_EGL_COLOR_FORMAT_UYVY_2020" = 0x74 + CU_EGL_COLOR_FORMAT_MAX "CU_EGL_COLOR_FORMAT_MAX" +ctypedef CUeglColorFormat_enum CUeglColorFormat "CUeglColorFormat" + +ctypedef enum CUGLmap_flags_enum "CUGLmap_flags_enum": + CU_GL_MAP_RESOURCE_FLAGS_NONE "CU_GL_MAP_RESOURCE_FLAGS_NONE" = 0x00 + CU_GL_MAP_RESOURCE_FLAGS_READ_ONLY "CU_GL_MAP_RESOURCE_FLAGS_READ_ONLY" = 0x01 + CU_GL_MAP_RESOURCE_FLAGS_WRITE_DISCARD "CU_GL_MAP_RESOURCE_FLAGS_WRITE_DISCARD" = 0x02 +ctypedef CUGLmap_flags_enum CUGLmap_flags "CUGLmap_flags" + +ctypedef enum CUoutput_mode_enum "CUoutput_mode_enum": + CU_OUT_KEY_VALUE_PAIR "CU_OUT_KEY_VALUE_PAIR" = 0x00 + CU_OUT_CSV "CU_OUT_CSV" = 0x01 +ctypedef CUoutput_mode_enum CUoutput_mode "CUoutput_mode" + +cdef extern from 'cuda.h': + ctypedef enum CUatomicOperation_enum: + CU_ATOMIC_OPERATION_INTEGER_ADD + CU_ATOMIC_OPERATION_INTEGER_MIN + CU_ATOMIC_OPERATION_INTEGER_MAX + CU_ATOMIC_OPERATION_INTEGER_INCREMENT + CU_ATOMIC_OPERATION_INTEGER_DECREMENT + CU_ATOMIC_OPERATION_AND + CU_ATOMIC_OPERATION_OR + CU_ATOMIC_OPERATION_XOR + CU_ATOMIC_OPERATION_EXCHANGE + CU_ATOMIC_OPERATION_CAS + CU_ATOMIC_OPERATION_FLOAT_ADD + CU_ATOMIC_OPERATION_FLOAT_MIN + CU_ATOMIC_OPERATION_FLOAT_MAX + CU_ATOMIC_OPERATION_MAX + ctypedef CUatomicOperation_enum CUatomicOperation + +cdef extern from 'cuda.h': + ctypedef enum CUatomicOperationCapability_enum: + CU_ATOMIC_CAPABILITY_SIGNED + CU_ATOMIC_CAPABILITY_UNSIGNED + CU_ATOMIC_CAPABILITY_REDUCTION + CU_ATOMIC_CAPABILITY_SCALAR_32 + CU_ATOMIC_CAPABILITY_SCALAR_64 + CU_ATOMIC_CAPABILITY_SCALAR_128 + CU_ATOMIC_CAPABILITY_VECTOR_32x4 + ctypedef CUatomicOperationCapability_enum CUatomicOperationCapability + +cdef extern from 'cuda.h': + ctypedef enum CUstreamAtomicReductionOpType_enum: + CU_STREAM_ATOMIC_REDUCTION_OP_OR + CU_STREAM_ATOMIC_REDUCTION_OP_AND + CU_STREAM_ATOMIC_REDUCTION_OP_ADD + ctypedef CUstreamAtomicReductionOpType_enum CUstreamAtomicReductionOpType + +cdef extern from 'cuda.h': + ctypedef enum CUstreamAtomicReductionDataType_enum: + CU_STREAM_ATOMIC_REDUCTION_UNSIGNED_32 + CU_STREAM_ATOMIC_REDUCTION_UNSIGNED_64 + ctypedef CUstreamAtomicReductionDataType_enum CUstreamAtomicReductionDataType + +cdef extern from 'cuda.h': + ctypedef enum CUdevSmResourceGroup_flags "CUdevSmResourceGroup_flags": + CU_DEV_SM_RESOURCE_GROUP_DEFAULT + CU_DEV_SM_RESOURCE_GROUP_BACKFILL + +cdef extern from 'cuda.h': + ctypedef enum CUdevSmResourceSplitByCount_flags "CUdevSmResourceSplitByCount_flags": + CU_DEV_SM_RESOURCE_SPLIT_IGNORE_SM_COSCHEDULING + CU_DEV_SM_RESOURCE_SPLIT_MAX_POTENTIAL_CLUSTER_SIZE + +cdef extern from 'cuda.h': + ctypedef enum CUdevWorkqueueConfigScope "CUdevWorkqueueConfigScope": + CU_WORKQUEUE_SCOPE_DEVICE_CTX + CU_WORKQUEUE_SCOPE_GREEN_CTX_BALANCED + +cdef extern from 'cuda.h': + ctypedef enum CUhostTaskSyncMode_enum: + CU_HOST_TASK_BLOCKING + CU_HOST_TASK_SPINWAIT + ctypedef CUhostTaskSyncMode_enum CUhostTaskSyncMode + +cdef extern from 'cuda.h': + ctypedef enum CUlaunchAttributePortableClusterMode_enum: + CU_LAUNCH_PORTABLE_CLUSTER_MODE_DEFAULT + CU_LAUNCH_PORTABLE_CLUSTER_MODE_REQUIRE_PORTABLE + CU_LAUNCH_PORTABLE_CLUSTER_MODE_ALLOW_NON_PORTABLE + ctypedef CUlaunchAttributePortableClusterMode_enum CUlaunchAttributePortableClusterMode + +cdef extern from 'cuda.h': + ctypedef enum CUsharedMemoryMode_enum: + CU_SHARED_MEMORY_MODE_DEFAULT + CU_SHARED_MEMORY_MODE_REQUIRE_PORTABLE + CU_SHARED_MEMORY_MODE_ALLOW_NON_PORTABLE + ctypedef CUsharedMemoryMode_enum CUsharedMemoryMode + +cdef extern from 'cuda.h': + ctypedef enum CUstreamCigDataType_enum: + STREAM_CIG_DATA_TYPE_D3D12_COMMAND_LIST + ctypedef CUstreamCigDataType_enum CUstreamCigDataType + +cdef extern from 'cuda.h': + ctypedef enum CUlogicalEndpointIpcHandleType_enum: + CU_LOGICAL_ENDPOINT_IPC_HANDLE_TYPE_NONE + CU_LOGICAL_ENDPOINT_IPC_HANDLE_TYPE_FABRIC + ctypedef CUlogicalEndpointIpcHandleType_enum CUlogicalEndpointIpcHandleType + +cdef extern from 'cuda.h': + ctypedef enum CUlogicalEndpointType_enum: + CU_LOGICAL_ENDPOINT_TYPE_INVALID + CU_LOGICAL_ENDPOINT_TYPE_UNICAST + CU_LOGICAL_ENDPOINT_TYPE_MULTICAST + ctypedef CUlogicalEndpointType_enum CUlogicalEndpointType + +cdef extern from 'cuda.h': + ctypedef enum CUlogicalEndpointFlag_enum: + CU_LOGICAL_ENDPOINT_FLAG_NONE + CU_LOGICAL_ENDPOINT_FLAG_COUNTED_OPS + ctypedef CUlogicalEndpointFlag_enum CUlogicalEndpointFlag + +cdef extern from 'cuda.h': + ctypedef enum CUgraphRecaptureStatus_enum: + CU_GRAPH_RECAPTURE_ELIGIBLE_FOR_UPDATE + CU_GRAPH_RECAPTURE_INELIGIBLE_FOR_UPDATE + CU_GRAPH_RECAPTURE_ERROR + ctypedef CUgraphRecaptureStatus_enum CUgraphRecaptureStatus +cdef enum: _CURESULT_INTERNAL_LOADING_ERROR = CUresult.CUDA_ERROR_NOT_FOUND +cdef enum: CUDA_VERSION = 13030 + + +# TYPES +cdef extern from 'cuda.h': + ctypedef uint32_t cuuint32_t 'cuuint32_t' + + +cdef extern from 'cuda.h': + ctypedef uint64_t cuuint64_t 'cuuint64_t' + + +cdef extern from 'cuda.h': + ctypedef unsigned long long CUdeviceptr_v2 'CUdeviceptr_v2' + + +cdef extern from 'cuda.h': + ctypedef int CUdevice_v1 'CUdevice_v1' + + +cdef extern from 'cuda.h': + ctypedef unsigned long long CUtexObject_v1 'CUtexObject_v1' + + +cdef extern from 'cuda.h': + ctypedef unsigned long long CUsurfObject_v1 'CUsurfObject_v1' + + +cdef extern from 'cuda.h': + cdef struct CUmemFabricHandle_st: + unsigned char data[64] + ctypedef CUmemFabricHandle_st CUmemFabricHandle_v1 + +cdef extern from 'cuda.h': + cdef struct CUipcEventHandle_st: + char reserved[64] + ctypedef CUipcEventHandle_st CUipcEventHandle_v1 + +cdef extern from 'cuda.h': + cdef struct CUipcMemHandle_st: + char reserved[64] + ctypedef CUipcMemHandle_st CUipcMemHandle_v1 + +cdef extern from 'cuda.h': + cdef struct CUdevprop_st: + int maxThreadsPerBlock + int maxThreadsDim[3] + int maxGridSize[3] + int sharedMemPerBlock + int totalConstantMemory + int SIMDWidth + int memPitch + int regsPerBlock + int clockRate + int textureAlign + ctypedef CUdevprop_st CUdevprop_v1 + +cdef extern from 'cuda.h': + cdef struct CUaccessPolicyWindow_st: + void* base_ptr + size_t num_bytes + float hitRatio + CUaccessProperty hitProp + CUaccessProperty missProp + ctypedef CUaccessPolicyWindow_st CUaccessPolicyWindow_v1 + +cdef extern from 'cuda.h': + ctypedef CUlaunchAttributeID CUkernelNodeAttrID 'CUkernelNodeAttrID' + + +cdef extern from 'cuda.h': + ctypedef CUlaunchAttributeID CUstreamAttrID 'CUstreamAttrID' + + +cdef extern from 'cuda.h': + cdef struct CUexecAffinitySmCount_st: + unsigned int val + ctypedef CUexecAffinitySmCount_st CUexecAffinitySmCount_v1 + +cdef extern from 'cuda.h': + cdef struct CUDA_ARRAY_DESCRIPTOR_st: + size_t Width + size_t Height + CUarray_format Format + unsigned int NumChannels + ctypedef CUDA_ARRAY_DESCRIPTOR_st CUDA_ARRAY_DESCRIPTOR_v2 + +cdef extern from 'cuda.h': + cdef struct CUDA_ARRAY3D_DESCRIPTOR_st: + size_t Width + size_t Height + size_t Depth + CUarray_format Format + unsigned int NumChannels + unsigned int Flags + ctypedef CUDA_ARRAY3D_DESCRIPTOR_st CUDA_ARRAY3D_DESCRIPTOR_v2 + +cdef extern from 'cuda.h': + cdef struct CUDA_ARRAY_MEMORY_REQUIREMENTS_st: + size_t size + size_t alignment + unsigned int reserved[4] + ctypedef CUDA_ARRAY_MEMORY_REQUIREMENTS_st CUDA_ARRAY_MEMORY_REQUIREMENTS_v1 + +cdef extern from 'cuda.h': + cdef struct CUDA_TEXTURE_DESC_st: + CUaddress_mode addressMode[3] + CUfilter_mode filterMode + unsigned int flags + unsigned int maxAnisotropy + CUfilter_mode mipmapFilterMode + float mipmapLevelBias + float minMipmapLevelClamp + float maxMipmapLevelClamp + float borderColor[4] + int reserved[12] + ctypedef CUDA_TEXTURE_DESC_st CUDA_TEXTURE_DESC_v1 + +cdef extern from 'cuda.h': + cdef struct CUDA_RESOURCE_VIEW_DESC_st: + CUresourceViewFormat format + size_t width + size_t height + size_t depth + unsigned int firstMipmapLevel + unsigned int lastMipmapLevel + unsigned int firstLayer + unsigned int lastLayer + unsigned int reserved[16] + ctypedef CUDA_RESOURCE_VIEW_DESC_st CUDA_RESOURCE_VIEW_DESC_v1 + +cdef extern from 'cuda.h': + cdef struct CUDA_POINTER_ATTRIBUTE_P2P_TOKENS_st: + unsigned long long p2pToken + unsigned int vaSpaceToken + ctypedef CUDA_POINTER_ATTRIBUTE_P2P_TOKENS_st CUDA_POINTER_ATTRIBUTE_P2P_TOKENS_v1 + +cdef extern from 'cuda.h': + cdef struct CUDA_EXTERNAL_MEMORY_BUFFER_DESC_st: + unsigned long long offset + unsigned long long size + unsigned int flags + unsigned int reserved[16] + ctypedef CUDA_EXTERNAL_MEMORY_BUFFER_DESC_st CUDA_EXTERNAL_MEMORY_BUFFER_DESC_v1 + +cdef extern from 'cuda.h': + ctypedef unsigned long long CUmemGenericAllocationHandle_v1 'CUmemGenericAllocationHandle_v1' + + +cdef extern from 'cuda.h': + cdef struct CUmulticastObjectProp_st: + unsigned int numDevices + size_t size + unsigned long long handleTypes + unsigned long long flags + ctypedef CUmulticastObjectProp_st CUmulticastObjectProp_v1 + +cdef extern from 'cuda.h': + cdef struct CUmemPoolPtrExportData_st: + unsigned char reserved[64] + ctypedef CUmemPoolPtrExportData_st CUmemPoolPtrExportData_v1 + +cdef extern from 'cuda.h': + cdef struct CUoffset3D_st: + size_t x + size_t y + size_t z + ctypedef CUoffset3D_st CUoffset3D_v1 + +cdef extern from 'cuda.h': + cdef struct CUextent3D_st: + size_t width + size_t height + size_t depth + ctypedef CUextent3D_st CUextent3D_v1 + +cdef extern from 'cuda.h': + ctypedef unsigned int CUlogIterator 'CUlogIterator' + + +cdef extern from 'cuda.h': + ctypedef struct CUctx_st: + pass + ctypedef CUctx_st* CUcontext 'CUcontext' + + +cdef extern from 'cuda.h': + ctypedef struct CUmod_st: + pass + ctypedef CUmod_st* CUmodule 'CUmodule' + + +cdef extern from 'cuda.h': + ctypedef struct CUfunc_st: + pass + ctypedef CUfunc_st* CUfunction 'CUfunction' + + +cdef extern from 'cuda.h': + ctypedef struct CUlib_st: + pass + ctypedef CUlib_st* CUlibrary 'CUlibrary' + + +cdef extern from 'cuda.h': + ctypedef struct CUkern_st: + pass + ctypedef CUkern_st* CUkernel 'CUkernel' + + +cdef extern from 'cuda.h': + ctypedef struct CUarray_st: + pass + ctypedef CUarray_st* CUarray 'CUarray' + + +cdef extern from 'cuda.h': + ctypedef struct CUmipmappedArray_st: + pass + ctypedef CUmipmappedArray_st* CUmipmappedArray 'CUmipmappedArray' + + +cdef extern from 'cuda.h': + ctypedef struct CUtexref_st: + pass + ctypedef CUtexref_st* CUtexref 'CUtexref' + + +cdef extern from 'cuda.h': + ctypedef struct CUsurfref_st: + pass + ctypedef CUsurfref_st* CUsurfref 'CUsurfref' + + +cdef extern from 'cuda.h': + ctypedef struct CUevent_st: + pass + ctypedef CUevent_st* CUevent 'CUevent' + + +cdef extern from 'cuda.h': + ctypedef struct CUstream_st: + pass + ctypedef CUstream_st* CUstream 'CUstream' + + +cdef extern from 'cuda.h': + ctypedef struct CUgraphicsResource_st: + pass + ctypedef CUgraphicsResource_st* CUgraphicsResource 'CUgraphicsResource' + + +cdef extern from 'cuda.h': + ctypedef struct CUextMemory_st: + pass + ctypedef CUextMemory_st* CUexternalMemory 'CUexternalMemory' + + +cdef extern from 'cuda.h': + ctypedef struct CUextSemaphore_st: + pass + ctypedef CUextSemaphore_st* CUexternalSemaphore 'CUexternalSemaphore' + + +cdef extern from 'cuda.h': + ctypedef struct CUgraph_st: + pass + ctypedef CUgraph_st* CUgraph 'CUgraph' + + +cdef extern from 'cuda.h': + ctypedef struct CUgraphNode_st: + pass + ctypedef CUgraphNode_st* CUgraphNode 'CUgraphNode' + + +cdef extern from 'cuda.h': + ctypedef struct CUgraphExec_st: + pass + ctypedef CUgraphExec_st* CUgraphExec 'CUgraphExec' + + +cdef extern from 'cuda.h': + ctypedef struct CUmemPoolHandle_st: + pass + ctypedef CUmemPoolHandle_st* CUmemoryPool 'CUmemoryPool' + + +cdef extern from 'cuda.h': + ctypedef struct CUuserObject_st: + pass + ctypedef CUuserObject_st* CUuserObject 'CUuserObject' + + +cdef extern from 'cuda.h': + ctypedef struct CUgraphDeviceUpdatableNode_st: + pass + ctypedef CUgraphDeviceUpdatableNode_st* CUgraphDeviceNode 'CUgraphDeviceNode' + + +cdef extern from 'cuda.h': + ctypedef struct CUasyncCallbackEntry_st: + pass + ctypedef CUasyncCallbackEntry_st* CUasyncCallbackHandle 'CUasyncCallbackHandle' + + +cdef extern from 'cuda.h': + ctypedef struct CUgreenCtx_st: + pass + ctypedef CUgreenCtx_st* CUgreenCtx 'CUgreenCtx' + + +cdef extern from 'cuda.h': + ctypedef struct CUlinkState_st: + pass + ctypedef CUlinkState_st* CUlinkState 'CUlinkState' + + +cdef extern from 'cuda.h': + ctypedef struct CUdevResourceDesc_st: + pass + ctypedef CUdevResourceDesc_st* CUdevResourceDesc 'CUdevResourceDesc' + + +cdef extern from 'cuda.h': + ctypedef struct CUlogsCallbackEntry_st: + pass + ctypedef CUlogsCallbackEntry_st* CUlogsCallbackHandle 'CUlogsCallbackHandle' + + +cdef extern from 'cuda.h': + ctypedef struct CUcoredumpCallbackEntry_st: + pass + ctypedef CUcoredumpCallbackEntry_st* CUcoredumpCallbackHandle 'CUcoredumpCallbackHandle' + + +cdef extern from 'cuda.h': + cdef struct CUuuid_st: + char bytes[16] + ctypedef CUuuid_st CUuuid + +cdef extern from 'cuda.h': + ctypedef struct CUstreamMemOpFlushRemoteWritesParams_st 'CUstreamMemOpFlushRemoteWritesParams_st': + CUstreamBatchMemOpType operation + unsigned int flags + +cdef extern from 'cuda.h': + ctypedef struct CUstreamMemOpMemoryBarrierParams_st 'CUstreamMemOpMemoryBarrierParams_st': + CUstreamBatchMemOpType operation + unsigned int flags + +cdef struct cuda_bindings_driver__anon_pod3: + unsigned long long bytesOverBudget + +cdef extern from 'cuda.h': + ctypedef void (*CUhostFn 'CUhostFn')( + void* userData + ) + + +cdef extern from 'cuda.h': + cdef struct CUgraphEdgeData_st: + unsigned char from_port + unsigned char to_port + unsigned char type + unsigned char reserved[5] + ctypedef CUgraphEdgeData_st CUgraphEdgeData + +cdef extern from 'cuda.h': + cdef struct CUlaunchMemSyncDomainMap_st: + unsigned char default_ + unsigned char remote + ctypedef CUlaunchMemSyncDomainMap_st CUlaunchMemSyncDomainMap + +cdef struct cuda_bindings_driver__anon_pod4: + unsigned int x + unsigned int y + unsigned int z + +cdef struct cuda_bindings_driver__anon_pod7: + unsigned int x + unsigned int y + unsigned int z + +cdef extern from 'cuda.h': + cdef struct CUctxCigParam_st: + CUcigDataType sharedDataType + void* sharedData + ctypedef CUctxCigParam_st CUctxCigParam + +cdef extern from 'cuda.h': + cdef struct CUlibraryHostUniversalFunctionAndDataTable_st: + void* functionTable + size_t functionWindowSize + void* dataTable + size_t dataWindowSize + ctypedef CUlibraryHostUniversalFunctionAndDataTable_st CUlibraryHostUniversalFunctionAndDataTable + +cdef struct cuda_bindings_driver__anon_pod10: + unsigned int width + unsigned int height + unsigned int depth + +cdef struct cuda_bindings_driver__anon_pod16: + int reserved[32] + +cdef struct cuda_bindings_driver__anon_pod18: + void* handle + void* name + +cdef struct cuda_bindings_driver__anon_pod20: + void* handle + void* name + +cdef struct cuda_bindings_driver__anon_pod22: + unsigned long long value + +cdef union cuda_bindings_driver__anon_pod23: + void* fence + unsigned long long reserved + +cdef struct cuda_bindings_driver__anon_pod24: + unsigned long long key + +cdef struct cuda_bindings_driver__anon_pod26: + unsigned long long value + +cdef union cuda_bindings_driver__anon_pod27: + void* fence + unsigned long long reserved + +cdef struct cuda_bindings_driver__anon_pod28: + unsigned long long key + unsigned int timeoutMs + +cdef struct cuda_bindings_driver__anon_pod31: + unsigned int level + unsigned int layer + unsigned int offsetX + unsigned int offsetY + unsigned int offsetZ + unsigned int extentWidth + unsigned int extentHeight + unsigned int extentDepth + +cdef struct cuda_bindings_driver__anon_pod32: + unsigned int layer + unsigned long long offset + unsigned long long size + +cdef struct cuda_bindings_driver__anon_pod35: + unsigned char compressionType + unsigned char gpuDirectRDMACapable + unsigned short usage + unsigned char reserved[4] + +cdef extern from 'cuda.h': + cdef struct CUdevSmResource_st: + unsigned int smCount + unsigned int minSmPartitionSize + unsigned int smCoscheduledAlignment + unsigned int flags + ctypedef CUdevSmResource_st CUdevSmResource + +cdef extern from 'cuda.h': + cdef struct CUdevWorkqueueResource_st: + unsigned char reserved[40] + ctypedef CUdevWorkqueueResource_st CUdevWorkqueueResource + +cdef extern from 'cuda.h': + cdef struct CU_DEV_SM_RESOURCE_GROUP_PARAMS_st: + unsigned int smCount + unsigned int coscheduledSmCount + unsigned int preferredCoscheduledSmCount + unsigned int flags + unsigned int reserved[12] + ctypedef CU_DEV_SM_RESOURCE_GROUP_PARAMS_st CU_DEV_SM_RESOURCE_GROUP_PARAMS + +cdef extern from 'cuda.h': + cdef struct CUstreamCigParam_st: + CUstreamCigDataType streamSharedDataType + void* streamSharedData + ctypedef CUstreamCigParam_st CUstreamCigParam + +cdef extern from 'cuda.h': + cdef struct CUlogicalEndpointFabricHandle_st: + unsigned char data[64] + ctypedef CUlogicalEndpointFabricHandle_st CUlogicalEndpointFabricHandle + +cdef struct cuda_bindings_driver__anon_pod43: + unsigned int numDevices + +cdef extern from 'cuda.h': + ctypedef size_t (*CUoccupancyB2DSize 'CUoccupancyB2DSize')( + int blockSize + ) + + +cdef extern from 'cuda.h': + ctypedef void (*CUlogsCallback 'CUlogsCallback')( + void* data, + CUlogLevel logLevel, + char* message, + size_t length + ) + + +cdef extern from 'cuda.h': + ctypedef cuuint32_t CUlogicalEndpointId 'CUlogicalEndpointId' + + +cdef extern from 'cuda.h': + cdef struct CUmemDecompressParams_st: + size_t srcNumBytes + size_t dstNumBytes + cuuint32_t* dstActBytes + void* src + void* dst + CUmemDecompressAlgorithm algo + unsigned char padding[20] + ctypedef CUmemDecompressParams_st CUmemDecompressParams + +cdef extern from 'cuda.h': + ctypedef cuuint64_t CUgraphConditionalHandle 'CUgraphConditionalHandle' + + +cdef extern from 'cuda.h': + cdef struct CUtensorMap_st: + cuuint64_t opaque[16] + ctypedef CUtensorMap_st CUtensorMap + +cdef extern from 'cuda.h': + cdef struct CUcheckpointLockArgs_st: + unsigned int timeoutMs + unsigned int reserved0 + cuuint64_t reserved1[7] + ctypedef CUcheckpointLockArgs_st CUcheckpointLockArgs + +cdef extern from 'cuda.h': + cdef struct CUcheckpointCheckpointArgs_st: + cuuint64_t reserved[8] + ctypedef CUcheckpointCheckpointArgs_st CUcheckpointCheckpointArgs + +cdef extern from 'cuda.h': + cdef struct CUcheckpointUnlockArgs_st: + cuuint64_t reserved[8] + ctypedef CUcheckpointUnlockArgs_st CUcheckpointUnlockArgs + +cdef extern from 'cuda.h': + ctypedef CUdeviceptr_v2 CUdeviceptr 'CUdeviceptr' + + +cdef extern from 'cuda.h': + ctypedef CUdevice_v1 CUdevice 'CUdevice' + + +cdef extern from 'cuda.h': + ctypedef CUtexObject_v1 CUtexObject 'CUtexObject' + + +cdef extern from 'cuda.h': + ctypedef CUsurfObject_v1 CUsurfObject 'CUsurfObject' + + +cdef extern from 'cuda.h': + ctypedef CUmemFabricHandle_v1 CUmemFabricHandle 'CUmemFabricHandle' + + +cdef extern from 'cuda.h': + ctypedef CUipcEventHandle_v1 CUipcEventHandle 'CUipcEventHandle' + + +cdef extern from 'cuda.h': + ctypedef CUipcMemHandle_v1 CUipcMemHandle 'CUipcMemHandle' + + +cdef extern from 'cuda.h': + ctypedef CUdevprop_v1 CUdevprop 'CUdevprop' + + +cdef extern from 'cuda.h': + ctypedef CUaccessPolicyWindow_v1 CUaccessPolicyWindow 'CUaccessPolicyWindow' + + +cdef extern from 'cuda.h': + ctypedef CUexecAffinitySmCount_v1 CUexecAffinitySmCount 'CUexecAffinitySmCount' + + +cdef extern from 'cuda.h': + ctypedef CUDA_ARRAY_DESCRIPTOR_v2 CUDA_ARRAY_DESCRIPTOR 'CUDA_ARRAY_DESCRIPTOR' + + +cdef extern from 'cuda.h': + ctypedef CUDA_ARRAY3D_DESCRIPTOR_v2 CUDA_ARRAY3D_DESCRIPTOR 'CUDA_ARRAY3D_DESCRIPTOR' + + +cdef extern from 'cuda.h': + ctypedef CUDA_ARRAY_MEMORY_REQUIREMENTS_v1 CUDA_ARRAY_MEMORY_REQUIREMENTS 'CUDA_ARRAY_MEMORY_REQUIREMENTS' + + +cdef extern from 'cuda.h': + ctypedef CUDA_TEXTURE_DESC_v1 CUDA_TEXTURE_DESC 'CUDA_TEXTURE_DESC' + + +cdef extern from 'cuda.h': + ctypedef CUDA_RESOURCE_VIEW_DESC_v1 CUDA_RESOURCE_VIEW_DESC 'CUDA_RESOURCE_VIEW_DESC' + + +cdef extern from 'cuda.h': + ctypedef CUDA_POINTER_ATTRIBUTE_P2P_TOKENS_v1 CUDA_POINTER_ATTRIBUTE_P2P_TOKENS 'CUDA_POINTER_ATTRIBUTE_P2P_TOKENS' + + +cdef extern from 'cuda.h': + ctypedef CUDA_EXTERNAL_MEMORY_BUFFER_DESC_v1 CUDA_EXTERNAL_MEMORY_BUFFER_DESC 'CUDA_EXTERNAL_MEMORY_BUFFER_DESC' + + +cdef extern from 'cuda.h': + ctypedef CUmemGenericAllocationHandle_v1 CUmemGenericAllocationHandle 'CUmemGenericAllocationHandle' + + +cdef extern from 'cuda.h': + ctypedef CUmulticastObjectProp_v1 CUmulticastObjectProp 'CUmulticastObjectProp' + + +cdef extern from 'cuda.h': + ctypedef CUmemPoolPtrExportData_v1 CUmemPoolPtrExportData 'CUmemPoolPtrExportData' + + +cdef extern from 'cuda.h': + ctypedef CUoffset3D_v1 CUoffset3D 'CUoffset3D' + + +cdef extern from 'cuda.h': + ctypedef CUextent3D_v1 CUextent3D 'CUextent3D' + + +cdef extern from 'cuda.h': + cdef struct CUDA_KERNEL_NODE_PARAMS_st: + CUfunction func + unsigned int gridDimX + unsigned int gridDimY + unsigned int gridDimZ + unsigned int blockDimX + unsigned int blockDimY + unsigned int blockDimZ + unsigned int sharedMemBytes + void** kernelParams + void** extra + ctypedef CUDA_KERNEL_NODE_PARAMS_st CUDA_KERNEL_NODE_PARAMS_v1 + +cdef extern from 'cuda.h': + cdef struct CUDA_KERNEL_NODE_PARAMS_v2_st: + CUfunction func + unsigned int gridDimX + unsigned int gridDimY + unsigned int gridDimZ + unsigned int blockDimX + unsigned int blockDimY + unsigned int blockDimZ + unsigned int sharedMemBytes + void** kernelParams + void** extra + CUkernel kern + CUcontext ctx + ctypedef CUDA_KERNEL_NODE_PARAMS_v2_st CUDA_KERNEL_NODE_PARAMS_v2 + +cdef extern from 'cuda.h': + cdef struct CUDA_KERNEL_NODE_PARAMS_v3_st: + CUfunction func + unsigned int gridDimX + unsigned int gridDimY + unsigned int gridDimZ + unsigned int blockDimX + unsigned int blockDimY + unsigned int blockDimZ + unsigned int sharedMemBytes + void** kernelParams + void** extra + CUkernel kern + CUcontext ctx + ctypedef CUDA_KERNEL_NODE_PARAMS_v3_st CUDA_KERNEL_NODE_PARAMS_v3 + +cdef struct cuda_bindings_driver__anon_pod12: + CUarray hArray + +cdef struct cuda_bindings_driver__anon_pod13: + CUmipmappedArray hMipmappedArray + +cdef union cuda_bindings_driver__anon_pod29: + CUmipmappedArray mipmap + CUarray array + +cdef struct cuda_bindings_driver__anon_pod5: + CUevent event + int flags + int triggerAtBlockStart + +cdef struct cuda_bindings_driver__anon_pod6: + CUevent event + int flags + +cdef extern from 'cuda.h': + cdef struct CUDA_EVENT_RECORD_NODE_PARAMS_st: + CUevent event + ctypedef CUDA_EVENT_RECORD_NODE_PARAMS_st CUDA_EVENT_RECORD_NODE_PARAMS + +cdef extern from 'cuda.h': + cdef struct CUDA_EVENT_WAIT_NODE_PARAMS_st: + CUevent event + ctypedef CUDA_EVENT_WAIT_NODE_PARAMS_st CUDA_EVENT_WAIT_NODE_PARAMS + +cdef extern from 'cuda.h': + cdef struct CUDA_LAUNCH_PARAMS_st: + CUfunction function + unsigned int gridDimX + unsigned int gridDimY + unsigned int gridDimZ + unsigned int blockDimX + unsigned int blockDimY + unsigned int blockDimZ + unsigned int sharedMemBytes + CUstream hStream + void** kernelParams + ctypedef CUDA_LAUNCH_PARAMS_st CUDA_LAUNCH_PARAMS_v1 + +cdef extern from 'cuda.h': + ctypedef void (*CUstreamCallback 'CUstreamCallback')( + CUstream hStream, + CUresult status, + void* userData + ) + + +cdef extern from 'cuda.h': + cdef struct CUDA_CHILD_GRAPH_NODE_PARAMS_st: + CUgraph graph + CUgraphChildGraphNodeOwnership ownership + ctypedef CUDA_CHILD_GRAPH_NODE_PARAMS_st CUDA_CHILD_GRAPH_NODE_PARAMS + +cdef extern from 'cuda.h': + cdef struct CUDA_GRAPH_INSTANTIATE_PARAMS_st: + cuuint64_t flags + CUstream hUploadStream + CUgraphNode hErrNode_out + CUgraphInstantiateResult result_out + ctypedef CUDA_GRAPH_INSTANTIATE_PARAMS_st CUDA_GRAPH_INSTANTIATE_PARAMS + +cdef extern from 'cuda.h': + cdef struct CUgraphExecUpdateResultInfo_st: + CUgraphExecUpdateResult result + CUgraphNode errorNode + CUgraphNode errorFromNode + ctypedef CUgraphExecUpdateResultInfo_st CUgraphExecUpdateResultInfo_v1 + +cdef struct cuda_bindings_driver__anon_pod8: + int deviceUpdatable + CUgraphDeviceNode devNode + +cdef extern from 'cuda.h': + cdef struct CUcheckpointGpuPair_st: + CUuuid oldUuid + CUuuid newUuid + ctypedef CUcheckpointGpuPair_st CUcheckpointGpuPair + +cdef union cuda_bindings_driver__anon_pod2: + cuda_bindings_driver__anon_pod3 overBudget + +cdef extern from 'cuda.h': + cdef struct CUDA_HOST_NODE_PARAMS_st: + CUhostFn fn + void* userData + ctypedef CUDA_HOST_NODE_PARAMS_st CUDA_HOST_NODE_PARAMS_v1 + +cdef extern from 'cuda.h': + cdef struct CUDA_HOST_NODE_PARAMS_v2_st: + CUhostFn fn + void* userData + unsigned int syncMode + ctypedef CUDA_HOST_NODE_PARAMS_v2_st CUDA_HOST_NODE_PARAMS_v2 + +cdef extern from 'cuda.h': + cdef struct CUDA_ARRAY_SPARSE_PROPERTIES_st: + cuda_bindings_driver__anon_pod10 tileExtent + unsigned int miptailFirstLevel + unsigned long long miptailSize + unsigned int flags + unsigned int reserved[4] + ctypedef CUDA_ARRAY_SPARSE_PROPERTIES_st CUDA_ARRAY_SPARSE_PROPERTIES_v1 + +cdef union cuda_bindings_driver__anon_pod17: + int fd + cuda_bindings_driver__anon_pod18 win32 + void* nvSciBufObject + +cdef union cuda_bindings_driver__anon_pod19: + int fd + cuda_bindings_driver__anon_pod20 win32 + void* nvSciSyncObj + +cdef struct cuda_bindings_driver__anon_pod21: + cuda_bindings_driver__anon_pod22 fence + cuda_bindings_driver__anon_pod23 nvSciSync + cuda_bindings_driver__anon_pod24 keyedMutex + unsigned int reserved[12] + +cdef struct cuda_bindings_driver__anon_pod25: + cuda_bindings_driver__anon_pod26 fence + cuda_bindings_driver__anon_pod27 nvSciSync + cuda_bindings_driver__anon_pod28 keyedMutex + unsigned int reserved[10] + +cdef union cuda_bindings_driver__anon_pod30: + cuda_bindings_driver__anon_pod31 sparseLevel + cuda_bindings_driver__anon_pod32 miptail + +cdef extern from 'cuda.h': + cdef struct CUmemLocation_st: + CUmemLocationType type + int id + ctypedef CUmemLocation_st CUmemLocation_v1 + +cdef extern from 'cuda.h': + cdef struct CUstreamCigCaptureParams_st: + CUstreamCigParam* streamCigParams + ctypedef CUstreamCigCaptureParams_st CUstreamCigCaptureParams + +cdef extern from 'cuda.h': + ctypedef struct CUDA_CONDITIONAL_NODE_PARAMS 'CUDA_CONDITIONAL_NODE_PARAMS': + CUgraphConditionalHandle handle + CUgraphConditionalNodeType type + unsigned int size + CUgraph* phGraph_out + CUcontext ctx + +cdef extern from 'cuda.h': + ctypedef struct CUstreamMemOpWaitValueParams_st 'CUstreamMemOpWaitValueParams_st': + CUstreamBatchMemOpType operation + CUdeviceptr address + cuuint32_t value + cuuint64_t value64 + unsigned int flags + CUdeviceptr alias + +cdef extern from 'cuda.h': + ctypedef struct CUstreamMemOpWriteValueParams_st 'CUstreamMemOpWriteValueParams_st': + CUstreamBatchMemOpType operation + CUdeviceptr address + cuuint32_t value + cuuint64_t value64 + unsigned int flags + CUdeviceptr alias + +cdef extern from 'cuda.h': + ctypedef struct CUstreamMemOpAtomicReductionParams_st 'CUstreamMemOpAtomicReductionParams_st': + CUstreamBatchMemOpType operation + unsigned int flags + CUstreamAtomicReductionOpType reductionOp + CUstreamAtomicReductionDataType dataType + CUdeviceptr address + cuuint64_t value + CUdeviceptr alias + +cdef extern from 'cuda.h': + cdef struct CUDA_MEMSET_NODE_PARAMS_st: + CUdeviceptr dst + size_t pitch + unsigned int value + unsigned int elementSize + size_t width + size_t height + ctypedef CUDA_MEMSET_NODE_PARAMS_st CUDA_MEMSET_NODE_PARAMS_v1 + +cdef extern from 'cuda.h': + cdef struct CUDA_MEMSET_NODE_PARAMS_v2_st: + CUdeviceptr dst + size_t pitch + unsigned int value + unsigned int elementSize + size_t width + size_t height + CUcontext ctx + ctypedef CUDA_MEMSET_NODE_PARAMS_v2_st CUDA_MEMSET_NODE_PARAMS_v2 + +cdef extern from 'cuda.h': + cdef struct CUDA_MEMCPY2D_st: + size_t srcXInBytes + size_t srcY + CUmemorytype srcMemoryType + void* srcHost + CUdeviceptr srcDevice + CUarray srcArray + size_t srcPitch + size_t dstXInBytes + size_t dstY + CUmemorytype dstMemoryType + void* dstHost + CUdeviceptr dstDevice + CUarray dstArray + size_t dstPitch + size_t WidthInBytes + size_t Height + ctypedef CUDA_MEMCPY2D_st CUDA_MEMCPY2D_v2 + +cdef extern from 'cuda.h': + cdef struct CUDA_MEMCPY3D_st: + size_t srcXInBytes + size_t srcY + size_t srcZ + size_t srcLOD + CUmemorytype srcMemoryType + void* srcHost + CUdeviceptr srcDevice + CUarray srcArray + void* reserved0 + size_t srcPitch + size_t srcHeight + size_t dstXInBytes + size_t dstY + size_t dstZ + size_t dstLOD + CUmemorytype dstMemoryType + void* dstHost + CUdeviceptr dstDevice + CUarray dstArray + void* reserved1 + size_t dstPitch + size_t dstHeight + size_t WidthInBytes + size_t Height + size_t Depth + ctypedef CUDA_MEMCPY3D_st CUDA_MEMCPY3D_v2 + +cdef extern from 'cuda.h': + cdef struct CUDA_MEMCPY3D_PEER_st: + size_t srcXInBytes + size_t srcY + size_t srcZ + size_t srcLOD + CUmemorytype srcMemoryType + void* srcHost + CUdeviceptr srcDevice + CUarray srcArray + CUcontext srcContext + size_t srcPitch + size_t srcHeight + size_t dstXInBytes + size_t dstY + size_t dstZ + size_t dstLOD + CUmemorytype dstMemoryType + void* dstHost + CUdeviceptr dstDevice + CUarray dstArray + CUcontext dstContext + size_t dstPitch + size_t dstHeight + size_t WidthInBytes + size_t Height + size_t Depth + ctypedef CUDA_MEMCPY3D_PEER_st CUDA_MEMCPY3D_PEER_v1 + +cdef struct cuda_bindings_driver__anon_pod14: + CUdeviceptr devPtr + CUarray_format format + unsigned int numChannels + size_t sizeInBytes + +cdef struct cuda_bindings_driver__anon_pod15: + CUdeviceptr devPtr + CUarray_format format + unsigned int numChannels + size_t width + size_t height + size_t pitchInBytes + +cdef extern from 'cuda.h': + cdef struct CUDA_MEM_FREE_NODE_PARAMS_st: + CUdeviceptr dptr + ctypedef CUDA_MEM_FREE_NODE_PARAMS_st CUDA_MEM_FREE_NODE_PARAMS + +cdef extern from 'cuda.h': + cdef struct CUdevWorkqueueConfigResource_st: + CUdevice device + unsigned int wqConcurrencyLimit + CUdevWorkqueueConfigScope sharingScope + ctypedef CUdevWorkqueueConfigResource_st CUdevWorkqueueConfigResource + +cdef struct cuda_bindings_driver__anon_pod42: + CUdevice device + +cdef extern from 'cuda.h': + ctypedef void (*CUcoredumpStatusCallback 'CUcoredumpStatusCallback')( + void* userData, + int pid, + CUdevice dev + ) + + +cdef union cuda_bindings_driver__anon_pod9: + CUexecAffinitySmCount smCount + +cdef extern from 'cuda.h': + cdef struct CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_st: + unsigned long long offset + CUDA_ARRAY3D_DESCRIPTOR arrayDesc + unsigned int numLevels + unsigned int reserved[16] + ctypedef CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_st CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_v1 + +cdef union cuda_bindings_driver__anon_pod33: + CUmemGenericAllocationHandle memHandle + +cdef struct cuda_bindings_driver__anon_pod38: + CUarray array + CUoffset3D offset + +cdef extern from 'cuda.h': + ctypedef CUDA_KERNEL_NODE_PARAMS_v2 CUDA_KERNEL_NODE_PARAMS 'CUDA_KERNEL_NODE_PARAMS' + + +cdef extern from 'cuda.h': + ctypedef CUDA_LAUNCH_PARAMS_v1 CUDA_LAUNCH_PARAMS 'CUDA_LAUNCH_PARAMS' + + +cdef extern from 'cuda.h': + ctypedef CUgraphExecUpdateResultInfo_v1 CUgraphExecUpdateResultInfo 'CUgraphExecUpdateResultInfo' + + +cdef extern from 'cuda.h': + cdef union CUlaunchAttributeValue_union: + char pad[64] + CUaccessPolicyWindow accessPolicyWindow + int cooperative + CUsynchronizationPolicy syncPolicy + cuda_bindings_driver__anon_pod4 clusterDim + CUclusterSchedulingPolicy clusterSchedulingPolicyPreference + int programmaticStreamSerializationAllowed + cuda_bindings_driver__anon_pod5 programmaticEvent + cuda_bindings_driver__anon_pod6 launchCompletionEvent + int priority + CUlaunchMemSyncDomainMap memSyncDomainMap + CUlaunchMemSyncDomain memSyncDomain + cuda_bindings_driver__anon_pod7 preferredClusterDim + cuda_bindings_driver__anon_pod8 deviceUpdatableKernelNode + unsigned int sharedMemCarveout + unsigned int nvlinkUtilCentricScheduling + CUlaunchAttributePortableClusterMode portableClusterSizeMode + CUsharedMemoryMode sharedMemoryMode + ctypedef CUlaunchAttributeValue_union CUlaunchAttributeValue + +cdef extern from 'cuda.h': + cdef struct CUcheckpointRestoreArgs_st: + CUcheckpointGpuPair* gpuPairs + unsigned int gpuPairsCount + char reserved[((64 - 8) - 4)] + ctypedef CUcheckpointRestoreArgs_st CUcheckpointRestoreArgs + +cdef extern from 'cuda.h': + cdef struct CUasyncNotificationInfo_st: + CUasyncNotificationType type + cuda_bindings_driver__anon_pod2 info + ctypedef CUasyncNotificationInfo_st CUasyncNotificationInfo + +cdef extern from 'cuda.h': + ctypedef CUDA_HOST_NODE_PARAMS_v1 CUDA_HOST_NODE_PARAMS 'CUDA_HOST_NODE_PARAMS' + + +cdef extern from 'cuda.h': + ctypedef CUDA_ARRAY_SPARSE_PROPERTIES_v1 CUDA_ARRAY_SPARSE_PROPERTIES 'CUDA_ARRAY_SPARSE_PROPERTIES' + + +cdef extern from 'cuda.h': + cdef struct CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st: + CUexternalMemoryHandleType type + cuda_bindings_driver__anon_pod17 handle + unsigned long long size + unsigned int flags + unsigned int reserved[16] + ctypedef CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st CUDA_EXTERNAL_MEMORY_HANDLE_DESC_v1 + +cdef extern from 'cuda.h': + cdef struct CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st: + CUexternalSemaphoreHandleType type + cuda_bindings_driver__anon_pod19 handle + unsigned int flags + unsigned int reserved[16] + ctypedef CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_v1 + +cdef extern from 'cuda.h': + cdef struct CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st: + cuda_bindings_driver__anon_pod21 params + unsigned int flags + unsigned int reserved[16] + ctypedef CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_v1 + +cdef extern from 'cuda.h': + cdef struct CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st: + cuda_bindings_driver__anon_pod25 params + unsigned int flags + unsigned int reserved[16] + ctypedef CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_v1 + +cdef extern from 'cuda.h': + ctypedef CUmemLocation_v1 CUmemLocation 'CUmemLocation' + + +cdef extern from 'cuda.h': + cdef union CUstreamBatchMemOpParams_union: + CUstreamBatchMemOpType operation + CUstreamMemOpWaitValueParams_st waitValue + CUstreamMemOpWriteValueParams_st writeValue + CUstreamMemOpFlushRemoteWritesParams_st flushRemoteWrites + CUstreamMemOpMemoryBarrierParams_st memoryBarrier + CUstreamMemOpAtomicReductionParams_st atomicReduction + cuuint64_t pad[6] + ctypedef CUstreamBatchMemOpParams_union CUstreamBatchMemOpParams_v1 + +cdef extern from 'cuda.h': + ctypedef CUDA_MEMSET_NODE_PARAMS_v1 CUDA_MEMSET_NODE_PARAMS 'CUDA_MEMSET_NODE_PARAMS' + + +cdef extern from 'cuda.h': + ctypedef CUDA_MEMCPY2D_v2 CUDA_MEMCPY2D 'CUDA_MEMCPY2D' + + +cdef extern from 'cuda.h': + ctypedef CUDA_MEMCPY3D_v2 CUDA_MEMCPY3D 'CUDA_MEMCPY3D' + + +cdef extern from 'cuda.h': + ctypedef CUDA_MEMCPY3D_PEER_v1 CUDA_MEMCPY3D_PEER 'CUDA_MEMCPY3D_PEER' + + +cdef union cuda_bindings_driver__anon_pod11: + cuda_bindings_driver__anon_pod12 array + cuda_bindings_driver__anon_pod13 mipmap + cuda_bindings_driver__anon_pod14 linear + cuda_bindings_driver__anon_pod15 pitch2D + cuda_bindings_driver__anon_pod16 reserved + +cdef extern from 'cuda.h': + cdef struct CUexecAffinityParam_st: + CUexecAffinityType type + cuda_bindings_driver__anon_pod9 param + ctypedef CUexecAffinityParam_st CUexecAffinityParam_v1 + +cdef extern from 'cuda.h': + ctypedef CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_v1 CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC 'CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC' + + +cdef extern from 'cuda.h': + cdef struct CUarrayMapInfo_st: + CUresourcetype resourceType + cuda_bindings_driver__anon_pod29 resource + CUarraySparseSubresourceType subresourceType + cuda_bindings_driver__anon_pod30 subresource + CUmemOperationType memOperationType + CUmemHandleType memHandleType + cuda_bindings_driver__anon_pod33 memHandle + unsigned long long offset + unsigned int deviceBitMask + unsigned int flags + unsigned int reserved[2] + ctypedef CUarrayMapInfo_st CUarrayMapInfo_v1 + +cdef extern from 'cuda.h': + ctypedef CUlaunchAttributeValue CUkernelNodeAttrValue_v1 'CUkernelNodeAttrValue_v1' + + +cdef extern from 'cuda.h': + ctypedef CUlaunchAttributeValue CUstreamAttrValue_v1 'CUstreamAttrValue_v1' + + +cdef extern from 'cuda.h': + cdef struct CUlaunchAttribute_st: + CUlaunchAttributeID id + CUlaunchAttributeValue value + ctypedef CUlaunchAttribute_st CUlaunchAttribute + +cdef extern from 'cuda.h': + ctypedef void (*CUasyncCallback 'CUasyncCallback')( + CUasyncNotificationInfo* info, + void* userData, + CUasyncCallbackHandle callback + ) + + +cdef extern from 'cuda.h': + ctypedef CUDA_EXTERNAL_MEMORY_HANDLE_DESC_v1 CUDA_EXTERNAL_MEMORY_HANDLE_DESC 'CUDA_EXTERNAL_MEMORY_HANDLE_DESC' + + +cdef extern from 'cuda.h': + ctypedef CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_v1 CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC 'CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC' + + +cdef extern from 'cuda.h': + ctypedef CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_v1 CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS 'CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS' + + +cdef extern from 'cuda.h': + ctypedef CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_v1 CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS 'CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS' + + +cdef extern from 'cuda.h': + cdef struct CUmemAllocationProp_st: + CUmemAllocationType type + CUmemAllocationHandleType requestedHandleTypes + CUmemLocation location + void* win32HandleMetaData + cuda_bindings_driver__anon_pod35 allocFlags + ctypedef CUmemAllocationProp_st CUmemAllocationProp_v1 + +cdef extern from 'cuda.h': + cdef struct CUmemAccessDesc_st: + CUmemLocation location + CUmemAccess_flags flags + ctypedef CUmemAccessDesc_st CUmemAccessDesc_v1 + +cdef extern from 'cuda.h': + cdef struct CUmemPoolProps_st: + CUmemAllocationType allocType + CUmemAllocationHandleType handleTypes + CUmemLocation location + void* win32SecurityAttributes + size_t maxSize + unsigned short usage + unsigned char reserved[54] + ctypedef CUmemPoolProps_st CUmemPoolProps_v1 + +cdef extern from 'cuda.h': + cdef struct CUmemcpyAttributes_st: + CUmemcpySrcAccessOrder srcAccessOrder + CUmemLocation srcLocHint + CUmemLocation dstLocHint + unsigned int flags + ctypedef CUmemcpyAttributes_st CUmemcpyAttributes_v1 + +cdef struct cuda_bindings_driver__anon_pod37: + CUdeviceptr ptr + size_t rowLength + size_t layerHeight + CUmemLocation locHint + +cdef extern from 'cuda.h': + ctypedef CUstreamBatchMemOpParams_v1 CUstreamBatchMemOpParams 'CUstreamBatchMemOpParams' + + +cdef extern from 'cuda.h': + cdef struct CUDA_MEMCPY_NODE_PARAMS_st: + int flags + int reserved + CUcontext copyCtx + CUDA_MEMCPY3D copyParams + ctypedef CUDA_MEMCPY_NODE_PARAMS_st CUDA_MEMCPY_NODE_PARAMS + +cdef extern from 'cuda.h': + cdef struct CUDA_RESOURCE_DESC_st: + CUresourcetype resType + cuda_bindings_driver__anon_pod11 res + unsigned int flags + ctypedef CUDA_RESOURCE_DESC_st CUDA_RESOURCE_DESC_v1 + +cdef extern from 'cuda.h': + cdef struct CUdevResource_st: + CUdevResourceType type + unsigned char _internal_padding[92] + CUdevSmResource sm + CUdevWorkqueueConfigResource wqConfig + CUdevWorkqueueResource wq + unsigned char _oversize[40] + CUdevResource_st* nextResource + ctypedef CUdevResource_st CUdevResource_v1 + +cdef extern from 'cuda.h': + cdef struct CUlogicalEndpointProp_struct: + CUlogicalEndpointType type + cuda_bindings_driver__anon_pod42 unicast + cuda_bindings_driver__anon_pod43 multicast + unsigned long long size + unsigned int ipcHandleTypes + unsigned int flags + ctypedef CUlogicalEndpointProp_struct CUlogicalEndpointProp + +cdef extern from 'cuda.h': + ctypedef CUexecAffinityParam_v1 CUexecAffinityParam 'CUexecAffinityParam' + + +cdef extern from 'cuda.h': + ctypedef CUarrayMapInfo_v1 CUarrayMapInfo 'CUarrayMapInfo' + + +cdef extern from 'cuda.h': + ctypedef CUkernelNodeAttrValue_v1 CUkernelNodeAttrValue 'CUkernelNodeAttrValue' + + +cdef extern from 'cuda.h': + ctypedef CUstreamAttrValue_v1 CUstreamAttrValue 'CUstreamAttrValue' + + +cdef extern from 'cuda.h': + cdef struct CUlaunchConfig_st: + unsigned int gridDimX + unsigned int gridDimY + unsigned int gridDimZ + unsigned int blockDimX + unsigned int blockDimY + unsigned int blockDimZ + unsigned int sharedMemBytes + CUstream hStream + CUlaunchAttribute* attrs + unsigned int numAttrs + ctypedef CUlaunchConfig_st CUlaunchConfig + +cdef extern from 'cuda.h': + cdef struct CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_st: + CUexternalSemaphore* extSemArray + CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS* paramsArray + unsigned int numExtSems + ctypedef CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_st CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v1 + +cdef extern from 'cuda.h': + cdef struct CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2_st: + CUexternalSemaphore* extSemArray + CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS* paramsArray + unsigned int numExtSems + ctypedef CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2_st CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2 + +cdef extern from 'cuda.h': + cdef struct CUDA_EXT_SEM_WAIT_NODE_PARAMS_st: + CUexternalSemaphore* extSemArray + CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS* paramsArray + unsigned int numExtSems + ctypedef CUDA_EXT_SEM_WAIT_NODE_PARAMS_st CUDA_EXT_SEM_WAIT_NODE_PARAMS_v1 + +cdef extern from 'cuda.h': + cdef struct CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2_st: + CUexternalSemaphore* extSemArray + CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS* paramsArray + unsigned int numExtSems + ctypedef CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2_st CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2 + +cdef extern from 'cuda.h': + ctypedef CUmemAllocationProp_v1 CUmemAllocationProp 'CUmemAllocationProp' + + +cdef extern from 'cuda.h': + ctypedef CUmemAccessDesc_v1 CUmemAccessDesc 'CUmemAccessDesc' + + +cdef extern from 'cuda.h': + ctypedef CUmemPoolProps_v1 CUmemPoolProps 'CUmemPoolProps' + + +cdef extern from 'cuda.h': + ctypedef CUmemcpyAttributes_v1 CUmemcpyAttributes 'CUmemcpyAttributes' + + +cdef union cuda_bindings_driver__anon_pod36: + cuda_bindings_driver__anon_pod37 ptr + cuda_bindings_driver__anon_pod38 array + +cdef extern from 'cuda.h': + cdef struct CUDA_BATCH_MEM_OP_NODE_PARAMS_v1_st: + CUcontext ctx + unsigned int count + CUstreamBatchMemOpParams* paramArray + unsigned int flags + ctypedef CUDA_BATCH_MEM_OP_NODE_PARAMS_v1_st CUDA_BATCH_MEM_OP_NODE_PARAMS_v1 + +cdef extern from 'cuda.h': + cdef struct CUDA_BATCH_MEM_OP_NODE_PARAMS_v2_st: + CUcontext ctx + unsigned int count + CUstreamBatchMemOpParams* paramArray + unsigned int flags + ctypedef CUDA_BATCH_MEM_OP_NODE_PARAMS_v2_st CUDA_BATCH_MEM_OP_NODE_PARAMS_v2 + +cdef extern from 'cuda.h': + ctypedef CUDA_RESOURCE_DESC_v1 CUDA_RESOURCE_DESC 'CUDA_RESOURCE_DESC' + + +cdef extern from 'cuda.h': + ctypedef CUdevResource_v1 CUdevResource 'CUdevResource' + + +cdef extern from 'cuda.h': + cdef struct CUctxCreateParams_st: + CUexecAffinityParam* execAffinityParams + int numExecAffinityParams + CUctxCigParam* cigParams + ctypedef CUctxCreateParams_st CUctxCreateParams + +cdef extern from 'cuda.h': + ctypedef CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v1 CUDA_EXT_SEM_SIGNAL_NODE_PARAMS 'CUDA_EXT_SEM_SIGNAL_NODE_PARAMS' + + +cdef extern from 'cuda.h': + ctypedef CUDA_EXT_SEM_WAIT_NODE_PARAMS_v1 CUDA_EXT_SEM_WAIT_NODE_PARAMS 'CUDA_EXT_SEM_WAIT_NODE_PARAMS' + + +cdef extern from 'cuda.h': + cdef struct CUDA_MEM_ALLOC_NODE_PARAMS_v1_st: + CUmemPoolProps poolProps + CUmemAccessDesc* accessDescs + size_t accessDescCount + size_t bytesize + CUdeviceptr dptr + ctypedef CUDA_MEM_ALLOC_NODE_PARAMS_v1_st CUDA_MEM_ALLOC_NODE_PARAMS_v1 + +cdef extern from 'cuda.h': + cdef struct CUDA_MEM_ALLOC_NODE_PARAMS_v2_st: + CUmemPoolProps poolProps + CUmemAccessDesc* accessDescs + size_t accessDescCount + size_t bytesize + CUdeviceptr dptr + ctypedef CUDA_MEM_ALLOC_NODE_PARAMS_v2_st CUDA_MEM_ALLOC_NODE_PARAMS_v2 + +cdef extern from 'cuda.h': + cdef struct CUmemcpy3DOperand_st: + CUmemcpy3DOperandType type + cuda_bindings_driver__anon_pod36 op + ctypedef CUmemcpy3DOperand_st CUmemcpy3DOperand_v1 + +cdef extern from 'cuda.h': + ctypedef CUDA_BATCH_MEM_OP_NODE_PARAMS_v1 CUDA_BATCH_MEM_OP_NODE_PARAMS 'CUDA_BATCH_MEM_OP_NODE_PARAMS' + + +cdef extern from 'cuda.h': + ctypedef CUDA_MEM_ALLOC_NODE_PARAMS_v1 CUDA_MEM_ALLOC_NODE_PARAMS 'CUDA_MEM_ALLOC_NODE_PARAMS' + + +cdef extern from 'cuda.h': + ctypedef CUmemcpy3DOperand_v1 CUmemcpy3DOperand 'CUmemcpy3DOperand' + + +cdef extern from 'cuda.h': + cdef struct CUgraphNodeParams_st: + CUgraphNodeType type + int reserved0[3] + long long reserved1[29] + CUDA_KERNEL_NODE_PARAMS_v3 kernel + CUDA_MEMCPY_NODE_PARAMS memcpy + CUDA_MEMSET_NODE_PARAMS_v2 memset + CUDA_HOST_NODE_PARAMS_v2 host + CUDA_CHILD_GRAPH_NODE_PARAMS graph + CUDA_EVENT_WAIT_NODE_PARAMS eventWait + CUDA_EVENT_RECORD_NODE_PARAMS eventRecord + CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2 extSemSignal + CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2 extSemWait + CUDA_MEM_ALLOC_NODE_PARAMS_v2 alloc + CUDA_MEM_FREE_NODE_PARAMS free + CUDA_BATCH_MEM_OP_NODE_PARAMS_v2 memOp + CUDA_CONDITIONAL_NODE_PARAMS conditional + char asBytes[232] + long long reserved2 + ctypedef CUgraphNodeParams_st CUgraphNodeParams + +cdef extern from 'cuda.h': + cdef struct CUDA_MEMCPY3D_BATCH_OP_st: + CUmemcpy3DOperand src + CUmemcpy3DOperand dst + CUextent3D extent + CUmemcpySrcAccessOrder srcAccessOrder + unsigned int flags + ctypedef CUDA_MEMCPY3D_BATCH_OP_st CUDA_MEMCPY3D_BATCH_OP_v1 + +cdef extern from 'cuda.h': + ctypedef CUresult (*CUgraphRecaptureCallback 'CUgraphRecaptureCallback')( + void* data, + CUgraphNode node, + const CUgraphNodeParams* originalParams, + const CUgraphNodeParams* recaptureParams, + CUgraphRecaptureStatus status + ) + + +cdef extern from 'cuda.h': + ctypedef CUDA_MEMCPY3D_BATCH_OP_v1 CUDA_MEMCPY3D_BATCH_OP 'CUDA_MEMCPY3D_BATCH_OP' + + + +# Defining the types here in this way is not necessary to work, but we need to +# define them as 'cdef extern from ""' to be ABI-backward-compatible with the +# old cython-gen based bindings. +cdef extern from "": + cdef struct CUeglStreamConnection_st: + pass +ctypedef CUeglStreamConnection_st* CUeglStreamConnection + +cdef union anon_union16: + CUarray pArray[3] + void* pPitch[3] + +cdef struct CUeglFrame_st: + anon_union16 frame + unsigned int width + unsigned int height + unsigned int depth + unsigned int pitch + unsigned int planeCount + unsigned int numChannels + CUeglFrameType frameType + CUeglColorFormat eglColorFormat + CUarray_format cuFormat + +ctypedef CUeglFrame_st CUeglFrame_v1 + +ctypedef CUeglFrame_v1 CUeglFrame + +cdef enum CUGLDeviceList_enum: + CU_GL_DEVICE_LIST_ALL = 1 + CU_GL_DEVICE_LIST_CURRENT_FRAME = 2 + CU_GL_DEVICE_LIST_NEXT_FRAME = 3 + +ctypedef CUGLDeviceList_enum CUGLDeviceList + + +# FUNCS +cdef CUresult cuGetErrorString(CUresult error, const char** pStr) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGetErrorName(CUresult error, const char** pStr) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuInit(unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuDriverGetVersion(int* driverVersion) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuDeviceGet(CUdevice* device, int ordinal) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuDeviceGetCount(int* count) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuDeviceGetName(char* name, int len, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuDeviceGetUuid(CUuuid* uuid, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuDeviceGetLuid(char* luid, unsigned int* deviceNodeMask, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuDeviceTotalMem(size_t* bytes, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuDeviceGetTexture1DLinearMaxWidth(size_t* maxWidthInElements, CUarray_format format, unsigned numChannels, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuDeviceGetAttribute(int* pi, CUdevice_attribute attrib, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuDeviceGetNvSciSyncAttributes(void* nvSciSyncAttrList, CUdevice dev, int flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuDeviceSetMemPool(CUdevice dev, CUmemoryPool pool) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuDeviceGetMemPool(CUmemoryPool* pool, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuDeviceGetDefaultMemPool(CUmemoryPool* pool_out, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuDeviceGetExecAffinitySupport(int* pi, CUexecAffinityType type, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuFlushGPUDirectRDMAWrites(CUflushGPUDirectRDMAWritesTarget target, CUflushGPUDirectRDMAWritesScope scope) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuDeviceGetProperties(CUdevprop* prop, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuDeviceComputeCapability(int* major, int* minor, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuDevicePrimaryCtxRetain(CUcontext* pctx, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuDevicePrimaryCtxRelease(CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuDevicePrimaryCtxSetFlags(CUdevice dev, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuDevicePrimaryCtxGetState(CUdevice dev, unsigned int* flags, int* active) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuDevicePrimaryCtxReset(CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuCtxCreate_v2(CUcontext* pctx, unsigned int flags, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuCtxCreate_v3(CUcontext* pctx, CUexecAffinityParam* paramsArray, int numParams, unsigned int flags, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuCtxCreate(CUcontext* pctx, CUctxCreateParams* ctxCreateParams, unsigned int flags, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuCtxDestroy(CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuCtxPushCurrent(CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuCtxPopCurrent(CUcontext* pctx) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuCtxSetCurrent(CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuCtxGetCurrent(CUcontext* pctx) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuCtxGetDevice(CUdevice* device) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuCtxGetFlags(unsigned int* flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuCtxSetFlags(unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuCtxGetId(CUcontext ctx, unsigned long long* ctxId) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuCtxSynchronize() except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuCtxSetLimit(CUlimit limit, size_t value) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuCtxGetLimit(size_t* pvalue, CUlimit limit) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuCtxGetCacheConfig(CUfunc_cache* pconfig) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuCtxSetCacheConfig(CUfunc_cache config) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuCtxGetApiVersion(CUcontext ctx, unsigned int* version) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuCtxGetStreamPriorityRange(int* leastPriority, int* greatestPriority) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuCtxResetPersistingL2Cache() except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuCtxGetExecAffinity(CUexecAffinityParam* pExecAffinity, CUexecAffinityType type) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuCtxRecordEvent(CUcontext hCtx, CUevent hEvent) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuCtxWaitEvent(CUcontext hCtx, CUevent hEvent) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuCtxAttach(CUcontext* pctx, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuCtxDetach(CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuCtxGetSharedMemConfig(CUsharedconfig* pConfig) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuCtxSetSharedMemConfig(CUsharedconfig config) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuModuleLoad(CUmodule* module, const char* fname) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuModuleLoadData(CUmodule* module, const void* image) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuModuleLoadDataEx(CUmodule* module, const void* image, unsigned int numOptions, CUjit_option* options, void** optionValues) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuModuleLoadFatBinary(CUmodule* module, const void* fatCubin) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuModuleUnload(CUmodule hmod) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuModuleGetLoadingMode(CUmoduleLoadingMode* mode) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuModuleGetFunction(CUfunction* hfunc, CUmodule hmod, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuModuleGetFunctionCount(unsigned int* count, CUmodule mod) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuModuleEnumerateFunctions(CUfunction* functions, unsigned int numFunctions, CUmodule mod) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuModuleGetGlobal(CUdeviceptr* dptr, size_t* bytes, CUmodule hmod, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuLinkCreate(unsigned int numOptions, CUjit_option* options, void** optionValues, CUlinkState* stateOut) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuLinkAddData(CUlinkState state, CUjitInputType type, void* data, size_t size, const char* name, unsigned int numOptions, CUjit_option* options, void** optionValues) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuLinkAddFile(CUlinkState state, CUjitInputType type, const char* path, unsigned int numOptions, CUjit_option* options, void** optionValues) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuLinkComplete(CUlinkState state, void** cubinOut, size_t* sizeOut) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuLinkDestroy(CUlinkState state) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuModuleGetTexRef(CUtexref* pTexRef, CUmodule hmod, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuModuleGetSurfRef(CUsurfref* pSurfRef, CUmodule hmod, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuLibraryLoadData(CUlibrary* library, const void* code, CUjit_option* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, CUlibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuLibraryLoadFromFile(CUlibrary* library, const char* fileName, CUjit_option* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, CUlibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuLibraryUnload(CUlibrary library) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuLibraryGetKernel(CUkernel* pKernel, CUlibrary library, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuLibraryGetKernelCount(unsigned int* count, CUlibrary lib) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuLibraryEnumerateKernels(CUkernel* kernels, unsigned int numKernels, CUlibrary lib) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuLibraryGetModule(CUmodule* pMod, CUlibrary library) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuKernelGetFunction(CUfunction* pFunc, CUkernel kernel) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuKernelGetLibrary(CUlibrary* pLib, CUkernel kernel) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuLibraryGetGlobal(CUdeviceptr* dptr, size_t* bytes, CUlibrary library, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuLibraryGetManaged(CUdeviceptr* dptr, size_t* bytes, CUlibrary library, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuLibraryGetUnifiedFunction(void** fptr, CUlibrary library, const char* symbol) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuKernelGetAttribute(int* pi, CUfunction_attribute attrib, CUkernel kernel, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuKernelSetAttribute(CUfunction_attribute attrib, int val, CUkernel kernel, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuKernelSetCacheConfig(CUkernel kernel, CUfunc_cache config, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuKernelGetName(const char** name, CUkernel hfunc) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuKernelGetParamInfo(CUkernel kernel, size_t paramIndex, size_t* paramOffset, size_t* paramSize) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemGetInfo(size_t* free, size_t* total) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemAlloc(CUdeviceptr* dptr, size_t bytesize) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemAllocPitch(CUdeviceptr* dptr, size_t* pPitch, size_t WidthInBytes, size_t Height, unsigned int ElementSizeBytes) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemFree(CUdeviceptr dptr) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemGetAddressRange(CUdeviceptr* pbase, size_t* psize, CUdeviceptr dptr) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemAllocHost(void** pp, size_t bytesize) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemFreeHost(void* p) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemHostAlloc(void** pp, size_t bytesize, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemHostGetDevicePointer(CUdeviceptr* pdptr, void* p, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemHostGetFlags(unsigned int* pFlags, void* p) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemAllocManaged(CUdeviceptr* dptr, size_t bytesize, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuDeviceRegisterAsyncNotification(CUdevice device, CUasyncCallback callbackFunc, void* userData, CUasyncCallbackHandle* callback) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuDeviceUnregisterAsyncNotification(CUdevice device, CUasyncCallbackHandle callback) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuDeviceGetByPCIBusId(CUdevice* dev, const char* pciBusId) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuDeviceGetPCIBusId(char* pciBusId, int len, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuIpcGetEventHandle(CUipcEventHandle* pHandle, CUevent event) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuIpcOpenEventHandle(CUevent* phEvent, CUipcEventHandle handle) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuIpcGetMemHandle(CUipcMemHandle* pHandle, CUdeviceptr dptr) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuIpcOpenMemHandle(CUdeviceptr* pdptr, CUipcMemHandle handle, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuIpcCloseMemHandle(CUdeviceptr dptr) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemHostRegister(void* p, size_t bytesize, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemHostUnregister(void* p) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemcpy(CUdeviceptr dst, CUdeviceptr src, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemcpyPeer(CUdeviceptr dstDevice, CUcontext dstContext, CUdeviceptr srcDevice, CUcontext srcContext, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemcpyHtoD(CUdeviceptr dstDevice, const void* srcHost, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemcpyDtoH(void* dstHost, CUdeviceptr srcDevice, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemcpyDtoD(CUdeviceptr dstDevice, CUdeviceptr srcDevice, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemcpyDtoA(CUarray dstArray, size_t dstOffset, CUdeviceptr srcDevice, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemcpyAtoD(CUdeviceptr dstDevice, CUarray srcArray, size_t srcOffset, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemcpyHtoA(CUarray dstArray, size_t dstOffset, const void* srcHost, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemcpyAtoH(void* dstHost, CUarray srcArray, size_t srcOffset, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemcpyAtoA(CUarray dstArray, size_t dstOffset, CUarray srcArray, size_t srcOffset, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemcpy2D(const CUDA_MEMCPY2D* pCopy) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemcpy2DUnaligned(const CUDA_MEMCPY2D* pCopy) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemcpy3D(const CUDA_MEMCPY3D* pCopy) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemcpy3DPeer(const CUDA_MEMCPY3D_PEER* pCopy) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemcpyAsync(CUdeviceptr dst, CUdeviceptr src, size_t ByteCount, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemcpyPeerAsync(CUdeviceptr dstDevice, CUcontext dstContext, CUdeviceptr srcDevice, CUcontext srcContext, size_t ByteCount, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemcpyHtoDAsync(CUdeviceptr dstDevice, const void* srcHost, size_t ByteCount, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemcpyDtoHAsync(void* dstHost, CUdeviceptr srcDevice, size_t ByteCount, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemcpyDtoDAsync(CUdeviceptr dstDevice, CUdeviceptr srcDevice, size_t ByteCount, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemcpyHtoAAsync(CUarray dstArray, size_t dstOffset, const void* srcHost, size_t ByteCount, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemcpyAtoHAsync(void* dstHost, CUarray srcArray, size_t srcOffset, size_t ByteCount, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemcpy2DAsync(const CUDA_MEMCPY2D* pCopy, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemcpy3DAsync(const CUDA_MEMCPY3D* pCopy, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemcpy3DPeerAsync(const CUDA_MEMCPY3D_PEER* pCopy, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemsetD8(CUdeviceptr dstDevice, unsigned char uc, size_t N) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemsetD16(CUdeviceptr dstDevice, unsigned short us, size_t N) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemsetD32(CUdeviceptr dstDevice, unsigned int ui, size_t N) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemsetD2D8(CUdeviceptr dstDevice, size_t dstPitch, unsigned char uc, size_t Width, size_t Height) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemsetD2D16(CUdeviceptr dstDevice, size_t dstPitch, unsigned short us, size_t Width, size_t Height) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemsetD2D32(CUdeviceptr dstDevice, size_t dstPitch, unsigned int ui, size_t Width, size_t Height) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemsetD8Async(CUdeviceptr dstDevice, unsigned char uc, size_t N, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemsetD16Async(CUdeviceptr dstDevice, unsigned short us, size_t N, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemsetD32Async(CUdeviceptr dstDevice, unsigned int ui, size_t N, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemsetD2D8Async(CUdeviceptr dstDevice, size_t dstPitch, unsigned char uc, size_t Width, size_t Height, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemsetD2D16Async(CUdeviceptr dstDevice, size_t dstPitch, unsigned short us, size_t Width, size_t Height, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemsetD2D32Async(CUdeviceptr dstDevice, size_t dstPitch, unsigned int ui, size_t Width, size_t Height, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuArrayCreate(CUarray* pHandle, const CUDA_ARRAY_DESCRIPTOR* pAllocateArray) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuArrayGetDescriptor(CUDA_ARRAY_DESCRIPTOR* pArrayDescriptor, CUarray hArray) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuArrayGetSparseProperties(CUDA_ARRAY_SPARSE_PROPERTIES* sparseProperties, CUarray array) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMipmappedArrayGetSparseProperties(CUDA_ARRAY_SPARSE_PROPERTIES* sparseProperties, CUmipmappedArray mipmap) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuArrayGetMemoryRequirements(CUDA_ARRAY_MEMORY_REQUIREMENTS* memoryRequirements, CUarray array, CUdevice device) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMipmappedArrayGetMemoryRequirements(CUDA_ARRAY_MEMORY_REQUIREMENTS* memoryRequirements, CUmipmappedArray mipmap, CUdevice device) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuArrayGetPlane(CUarray* pPlaneArray, CUarray hArray, unsigned int planeIdx) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuArrayDestroy(CUarray hArray) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuArray3DCreate(CUarray* pHandle, const CUDA_ARRAY3D_DESCRIPTOR* pAllocateArray) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuArray3DGetDescriptor(CUDA_ARRAY3D_DESCRIPTOR* pArrayDescriptor, CUarray hArray) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMipmappedArrayCreate(CUmipmappedArray* pHandle, const CUDA_ARRAY3D_DESCRIPTOR* pMipmappedArrayDesc, unsigned int numMipmapLevels) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMipmappedArrayGetLevel(CUarray* pLevelArray, CUmipmappedArray hMipmappedArray, unsigned int level) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMipmappedArrayDestroy(CUmipmappedArray hMipmappedArray) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemGetHandleForAddressRange(void* handle, CUdeviceptr dptr, size_t size, CUmemRangeHandleType handleType, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemBatchDecompressAsync(CUmemDecompressParams* paramsArray, size_t count, unsigned int flags, size_t* errorIndex, CUstream stream) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemAddressReserve(CUdeviceptr* ptr, size_t size, size_t alignment, CUdeviceptr addr, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemAddressFree(CUdeviceptr ptr, size_t size) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemCreate(CUmemGenericAllocationHandle* handle, size_t size, const CUmemAllocationProp* prop, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemRelease(CUmemGenericAllocationHandle handle) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemMap(CUdeviceptr ptr, size_t size, size_t offset, CUmemGenericAllocationHandle handle, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemMapArrayAsync(CUarrayMapInfo* mapInfoList, unsigned int count, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemUnmap(CUdeviceptr ptr, size_t size) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemSetAccess(CUdeviceptr ptr, size_t size, const CUmemAccessDesc* desc, size_t count) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemGetAccess(unsigned long long* flags, const CUmemLocation* location, CUdeviceptr ptr) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemExportToShareableHandle(void* shareableHandle, CUmemGenericAllocationHandle handle, CUmemAllocationHandleType handleType, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemImportFromShareableHandle(CUmemGenericAllocationHandle* handle, void* osHandle, CUmemAllocationHandleType shHandleType) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemGetAllocationGranularity(size_t* granularity, const CUmemAllocationProp* prop, CUmemAllocationGranularity_flags option) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemGetAllocationPropertiesFromHandle(CUmemAllocationProp* prop, CUmemGenericAllocationHandle handle) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemRetainAllocationHandle(CUmemGenericAllocationHandle* handle, void* addr) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemFreeAsync(CUdeviceptr dptr, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemAllocAsync(CUdeviceptr* dptr, size_t bytesize, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemPoolTrimTo(CUmemoryPool pool, size_t minBytesToKeep) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemPoolSetAttribute(CUmemoryPool pool, CUmemPool_attribute attr, void* value) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemPoolGetAttribute(CUmemoryPool pool, CUmemPool_attribute attr, void* value) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemPoolSetAccess(CUmemoryPool pool, const CUmemAccessDesc* map, size_t count) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemPoolGetAccess(CUmemAccess_flags* flags, CUmemoryPool memPool, CUmemLocation* location) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemPoolCreate(CUmemoryPool* pool, const CUmemPoolProps* poolProps) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemPoolDestroy(CUmemoryPool pool) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemAllocFromPoolAsync(CUdeviceptr* dptr, size_t bytesize, CUmemoryPool pool, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemPoolExportToShareableHandle(void* handle_out, CUmemoryPool pool, CUmemAllocationHandleType handleType, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemPoolImportFromShareableHandle(CUmemoryPool* pool_out, void* handle, CUmemAllocationHandleType handleType, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemPoolExportPointer(CUmemPoolPtrExportData* shareData_out, CUdeviceptr ptr) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemPoolImportPointer(CUdeviceptr* ptr_out, CUmemoryPool pool, CUmemPoolPtrExportData* shareData) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMulticastCreate(CUmemGenericAllocationHandle* mcHandle, const CUmulticastObjectProp* prop) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMulticastAddDevice(CUmemGenericAllocationHandle mcHandle, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMulticastBindMem(CUmemGenericAllocationHandle mcHandle, size_t mcOffset, CUmemGenericAllocationHandle memHandle, size_t memOffset, size_t size, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMulticastBindAddr(CUmemGenericAllocationHandle mcHandle, size_t mcOffset, CUdeviceptr memptr, size_t size, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMulticastUnbind(CUmemGenericAllocationHandle mcHandle, CUdevice dev, size_t mcOffset, size_t size) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMulticastGetGranularity(size_t* granularity, const CUmulticastObjectProp* prop, CUmulticastGranularity_flags option) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuPointerGetAttribute(void* data, CUpointer_attribute attribute, CUdeviceptr ptr) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemPrefetchAsync(CUdeviceptr devPtr, size_t count, CUmemLocation location, unsigned int flags, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemAdvise(CUdeviceptr devPtr, size_t count, CUmem_advise advice, CUmemLocation location) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemRangeGetAttribute(void* data, size_t dataSize, CUmem_range_attribute attribute, CUdeviceptr devPtr, size_t count) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemRangeGetAttributes(void** data, size_t* dataSizes, CUmem_range_attribute* attributes, size_t numAttributes, CUdeviceptr devPtr, size_t count) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuPointerSetAttribute(const void* value, CUpointer_attribute attribute, CUdeviceptr ptr) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuPointerGetAttributes(unsigned int numAttributes, CUpointer_attribute* attributes, void** data, CUdeviceptr ptr) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuStreamCreate(CUstream* phStream, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuStreamCreateWithPriority(CUstream* phStream, unsigned int flags, int priority) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuStreamGetPriority(CUstream hStream, int* priority) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuStreamGetDevice(CUstream hStream, CUdevice* device) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuStreamGetFlags(CUstream hStream, unsigned int* flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuStreamGetId(CUstream hStream, unsigned long long* streamId) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuStreamGetCtx(CUstream hStream, CUcontext* pctx) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuStreamGetCtx_v2(CUstream hStream, CUcontext* pCtx, CUgreenCtx* pGreenCtx) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuStreamWaitEvent(CUstream hStream, CUevent hEvent, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuStreamAddCallback(CUstream hStream, CUstreamCallback callback, void* userData, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuStreamBeginCapture(CUstream hStream, CUstreamCaptureMode mode) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuStreamBeginCaptureToGraph(CUstream hStream, CUgraph hGraph, const CUgraphNode* dependencies, const CUgraphEdgeData* dependencyData, size_t numDependencies, CUstreamCaptureMode mode) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuThreadExchangeStreamCaptureMode(CUstreamCaptureMode* mode) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuStreamEndCapture(CUstream hStream, CUgraph* phGraph) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuStreamIsCapturing(CUstream hStream, CUstreamCaptureStatus* captureStatus) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuStreamGetCaptureInfo_v2(CUstream hStream, CUstreamCaptureStatus* captureStatus_out, cuuint64_t* id_out, CUgraph* graph_out, const CUgraphNode** dependencies_out, size_t* numDependencies_out) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuStreamGetCaptureInfo(CUstream hStream, CUstreamCaptureStatus* captureStatus_out, cuuint64_t* id_out, CUgraph* graph_out, const CUgraphNode** dependencies_out, const CUgraphEdgeData** edgeData_out, size_t* numDependencies_out) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuStreamUpdateCaptureDependencies(CUstream hStream, CUgraphNode* dependencies, const CUgraphEdgeData* dependencyData, size_t numDependencies, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuStreamAttachMemAsync(CUstream hStream, CUdeviceptr dptr, size_t length, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuStreamQuery(CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuStreamSynchronize(CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuStreamDestroy(CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuStreamCopyAttributes(CUstream dst, CUstream src) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuStreamGetAttribute(CUstream hStream, CUstreamAttrID attr, CUstreamAttrValue* value_out) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuStreamSetAttribute(CUstream hStream, CUstreamAttrID attr, const CUstreamAttrValue* value) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuEventCreate(CUevent* phEvent, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuEventRecord(CUevent hEvent, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuEventRecordWithFlags(CUevent hEvent, CUstream hStream, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuEventQuery(CUevent hEvent) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuEventSynchronize(CUevent hEvent) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuEventDestroy(CUevent hEvent) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuEventElapsedTime(float* pMilliseconds, CUevent hStart, CUevent hEnd) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuImportExternalMemory(CUexternalMemory* extMem_out, const CUDA_EXTERNAL_MEMORY_HANDLE_DESC* memHandleDesc) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuExternalMemoryGetMappedBuffer(CUdeviceptr* devPtr, CUexternalMemory extMem, const CUDA_EXTERNAL_MEMORY_BUFFER_DESC* bufferDesc) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuExternalMemoryGetMappedMipmappedArray(CUmipmappedArray* mipmap, CUexternalMemory extMem, const CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC* mipmapDesc) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuDestroyExternalMemory(CUexternalMemory extMem) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuImportExternalSemaphore(CUexternalSemaphore* extSem_out, const CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC* semHandleDesc) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuSignalExternalSemaphoresAsync(const CUexternalSemaphore* extSemArray, const CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS* paramsArray, unsigned int numExtSems, CUstream stream) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuWaitExternalSemaphoresAsync(const CUexternalSemaphore* extSemArray, const CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS* paramsArray, unsigned int numExtSems, CUstream stream) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuDestroyExternalSemaphore(CUexternalSemaphore extSem) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuStreamWaitValue32(CUstream stream, CUdeviceptr addr, cuuint32_t value, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuStreamWaitValue64(CUstream stream, CUdeviceptr addr, cuuint64_t value, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuStreamWriteValue32(CUstream stream, CUdeviceptr addr, cuuint32_t value, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuStreamWriteValue64(CUstream stream, CUdeviceptr addr, cuuint64_t value, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuStreamBatchMemOp(CUstream stream, unsigned int count, CUstreamBatchMemOpParams* paramArray, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuFuncGetAttribute(int* pi, CUfunction_attribute attrib, CUfunction hfunc) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuFuncSetAttribute(CUfunction hfunc, CUfunction_attribute attrib, int value) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuFuncSetCacheConfig(CUfunction hfunc, CUfunc_cache config) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuFuncGetModule(CUmodule* hmod, CUfunction hfunc) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuFuncGetName(const char** name, CUfunction hfunc) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuFuncGetParamInfo(CUfunction func, size_t paramIndex, size_t* paramOffset, size_t* paramSize) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuFuncIsLoaded(CUfunctionLoadingState* state, CUfunction function) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuFuncLoad(CUfunction function) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuLaunchKernel(CUfunction f, unsigned int gridDimX, unsigned int gridDimY, unsigned int gridDimZ, unsigned int blockDimX, unsigned int blockDimY, unsigned int blockDimZ, unsigned int sharedMemBytes, CUstream hStream, void** kernelParams, void** extra) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuLaunchKernelEx(const CUlaunchConfig* config, CUfunction f, void** kernelParams, void** extra) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuLaunchCooperativeKernel(CUfunction f, unsigned int gridDimX, unsigned int gridDimY, unsigned int gridDimZ, unsigned int blockDimX, unsigned int blockDimY, unsigned int blockDimZ, unsigned int sharedMemBytes, CUstream hStream, void** kernelParams) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuLaunchCooperativeKernelMultiDevice(CUDA_LAUNCH_PARAMS* launchParamsList, unsigned int numDevices, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuLaunchHostFunc(CUstream hStream, CUhostFn fn, void* userData) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuFuncSetBlockShape(CUfunction hfunc, int x, int y, int z) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuFuncSetSharedSize(CUfunction hfunc, unsigned int bytes) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuParamSetSize(CUfunction hfunc, unsigned int numbytes) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuParamSeti(CUfunction hfunc, int offset, unsigned int value) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuParamSetf(CUfunction hfunc, int offset, float value) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuParamSetv(CUfunction hfunc, int offset, void* ptr, unsigned int numbytes) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuLaunch(CUfunction f) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuLaunchGrid(CUfunction f, int grid_width, int grid_height) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuLaunchGridAsync(CUfunction f, int grid_width, int grid_height, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuParamSetTexRef(CUfunction hfunc, int texunit, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuFuncSetSharedMemConfig(CUfunction hfunc, CUsharedconfig config) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphCreate(CUgraph* phGraph, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphAddKernelNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, const CUDA_KERNEL_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphKernelNodeGetParams(CUgraphNode hNode, CUDA_KERNEL_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphKernelNodeSetParams(CUgraphNode hNode, const CUDA_KERNEL_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphAddMemcpyNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, const CUDA_MEMCPY3D* copyParams, CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphMemcpyNodeGetParams(CUgraphNode hNode, CUDA_MEMCPY3D* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphMemcpyNodeSetParams(CUgraphNode hNode, const CUDA_MEMCPY3D* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphAddMemsetNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, const CUDA_MEMSET_NODE_PARAMS* memsetParams, CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphMemsetNodeGetParams(CUgraphNode hNode, CUDA_MEMSET_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphMemsetNodeSetParams(CUgraphNode hNode, const CUDA_MEMSET_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphAddHostNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, const CUDA_HOST_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphHostNodeGetParams(CUgraphNode hNode, CUDA_HOST_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphHostNodeSetParams(CUgraphNode hNode, const CUDA_HOST_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphAddChildGraphNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, CUgraph childGraph) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphChildGraphNodeGetGraph(CUgraphNode hNode, CUgraph* phGraph) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphAddEmptyNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphAddEventRecordNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, CUevent event) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphEventRecordNodeGetEvent(CUgraphNode hNode, CUevent* event_out) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphEventRecordNodeSetEvent(CUgraphNode hNode, CUevent event) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphAddEventWaitNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, CUevent event) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphEventWaitNodeGetEvent(CUgraphNode hNode, CUevent* event_out) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphEventWaitNodeSetEvent(CUgraphNode hNode, CUevent event) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphAddExternalSemaphoresSignalNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, const CUDA_EXT_SEM_SIGNAL_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphExternalSemaphoresSignalNodeGetParams(CUgraphNode hNode, CUDA_EXT_SEM_SIGNAL_NODE_PARAMS* params_out) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphExternalSemaphoresSignalNodeSetParams(CUgraphNode hNode, const CUDA_EXT_SEM_SIGNAL_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphAddExternalSemaphoresWaitNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, const CUDA_EXT_SEM_WAIT_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphExternalSemaphoresWaitNodeGetParams(CUgraphNode hNode, CUDA_EXT_SEM_WAIT_NODE_PARAMS* params_out) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphExternalSemaphoresWaitNodeSetParams(CUgraphNode hNode, const CUDA_EXT_SEM_WAIT_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphAddBatchMemOpNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, const CUDA_BATCH_MEM_OP_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphBatchMemOpNodeGetParams(CUgraphNode hNode, CUDA_BATCH_MEM_OP_NODE_PARAMS* nodeParams_out) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphBatchMemOpNodeSetParams(CUgraphNode hNode, const CUDA_BATCH_MEM_OP_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphExecBatchMemOpNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_BATCH_MEM_OP_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphAddMemAllocNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, CUDA_MEM_ALLOC_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphMemAllocNodeGetParams(CUgraphNode hNode, CUDA_MEM_ALLOC_NODE_PARAMS* params_out) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphAddMemFreeNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, CUdeviceptr dptr) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphMemFreeNodeGetParams(CUgraphNode hNode, CUdeviceptr* dptr_out) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuDeviceGraphMemTrim(CUdevice device) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuDeviceGetGraphMemAttribute(CUdevice device, CUgraphMem_attribute attr, void* value) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuDeviceSetGraphMemAttribute(CUdevice device, CUgraphMem_attribute attr, void* value) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphClone(CUgraph* phGraphClone, CUgraph originalGraph) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphNodeFindInClone(CUgraphNode* phNode, CUgraphNode hOriginalNode, CUgraph hClonedGraph) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphNodeGetType(CUgraphNode hNode, CUgraphNodeType* type) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphGetNodes(CUgraph hGraph, CUgraphNode* nodes, size_t* numNodes) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphGetRootNodes(CUgraph hGraph, CUgraphNode* rootNodes, size_t* numRootNodes) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphGetEdges(CUgraph hGraph, CUgraphNode* from_, CUgraphNode* to, CUgraphEdgeData* edgeData, size_t* numEdges) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphNodeGetDependencies(CUgraphNode hNode, CUgraphNode* dependencies, CUgraphEdgeData* edgeData, size_t* numDependencies) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphNodeGetDependentNodes(CUgraphNode hNode, CUgraphNode* dependentNodes, CUgraphEdgeData* edgeData, size_t* numDependentNodes) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphAddDependencies(CUgraph hGraph, const CUgraphNode* from_, const CUgraphNode* to, const CUgraphEdgeData* edgeData, size_t numDependencies) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphRemoveDependencies(CUgraph hGraph, const CUgraphNode* from_, const CUgraphNode* to, const CUgraphEdgeData* edgeData, size_t numDependencies) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphDestroyNode(CUgraphNode hNode) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphInstantiate(CUgraphExec* phGraphExec, CUgraph hGraph, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphInstantiateWithParams(CUgraphExec* phGraphExec, CUgraph hGraph, CUDA_GRAPH_INSTANTIATE_PARAMS* instantiateParams) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphExecGetFlags(CUgraphExec hGraphExec, cuuint64_t* flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphExecKernelNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_KERNEL_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphExecMemcpyNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_MEMCPY3D* copyParams, CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphExecMemsetNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_MEMSET_NODE_PARAMS* memsetParams, CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphExecHostNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_HOST_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphExecChildGraphNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, CUgraph childGraph) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphExecEventRecordNodeSetEvent(CUgraphExec hGraphExec, CUgraphNode hNode, CUevent event) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphExecEventWaitNodeSetEvent(CUgraphExec hGraphExec, CUgraphNode hNode, CUevent event) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphExecExternalSemaphoresSignalNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_EXT_SEM_SIGNAL_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphExecExternalSemaphoresWaitNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_EXT_SEM_WAIT_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphNodeSetEnabled(CUgraphExec hGraphExec, CUgraphNode hNode, unsigned int isEnabled) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphNodeGetEnabled(CUgraphExec hGraphExec, CUgraphNode hNode, unsigned int* isEnabled) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphUpload(CUgraphExec hGraphExec, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphLaunch(CUgraphExec hGraphExec, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphExecDestroy(CUgraphExec hGraphExec) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphDestroy(CUgraph hGraph) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphExecUpdate(CUgraphExec hGraphExec, CUgraph hGraph, CUgraphExecUpdateResultInfo* resultInfo) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphKernelNodeCopyAttributes(CUgraphNode dst, CUgraphNode src) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphKernelNodeGetAttribute(CUgraphNode hNode, CUkernelNodeAttrID attr, CUkernelNodeAttrValue* value_out) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphKernelNodeSetAttribute(CUgraphNode hNode, CUkernelNodeAttrID attr, const CUkernelNodeAttrValue* value) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphDebugDotPrint(CUgraph hGraph, const char* path, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuUserObjectCreate(CUuserObject* object_out, void* ptr, CUhostFn destroy, unsigned int initialRefcount, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuUserObjectRetain(CUuserObject object, unsigned int count) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuUserObjectRelease(CUuserObject object, unsigned int count) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphRetainUserObject(CUgraph graph, CUuserObject object, unsigned int count, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphReleaseUserObject(CUgraph graph, CUuserObject object, unsigned int count) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphAddNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, const CUgraphEdgeData* dependencyData, size_t numDependencies, CUgraphNodeParams* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphNodeSetParams(CUgraphNode hNode, CUgraphNodeParams* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphExecNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, CUgraphNodeParams* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphConditionalHandleCreate(CUgraphConditionalHandle* pHandle_out, CUgraph hGraph, CUcontext ctx, unsigned int defaultLaunchValue, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuOccupancyMaxActiveBlocksPerMultiprocessor(int* numBlocks, CUfunction func, int blockSize, size_t dynamicSMemSize) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(int* numBlocks, CUfunction func, int blockSize, size_t dynamicSMemSize, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuOccupancyMaxPotentialBlockSize(int* minGridSize, int* blockSize, CUfunction func, CUoccupancyB2DSize blockSizeToDynamicSMemSize, size_t dynamicSMemSize, int blockSizeLimit) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuOccupancyMaxPotentialBlockSizeWithFlags(int* minGridSize, int* blockSize, CUfunction func, CUoccupancyB2DSize blockSizeToDynamicSMemSize, size_t dynamicSMemSize, int blockSizeLimit, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuOccupancyAvailableDynamicSMemPerBlock(size_t* dynamicSmemSize, CUfunction func, int numBlocks, int blockSize) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuOccupancyMaxPotentialClusterSize(int* clusterSize, CUfunction func, const CUlaunchConfig* config) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuOccupancyMaxActiveClusters(int* numClusters, CUfunction func, const CUlaunchConfig* config) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuTexRefSetArray(CUtexref hTexRef, CUarray hArray, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuTexRefSetMipmappedArray(CUtexref hTexRef, CUmipmappedArray hMipmappedArray, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuTexRefSetAddress(size_t* ByteOffset, CUtexref hTexRef, CUdeviceptr dptr, size_t bytes) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuTexRefSetAddress2D(CUtexref hTexRef, const CUDA_ARRAY_DESCRIPTOR* desc, CUdeviceptr dptr, size_t Pitch) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuTexRefSetFormat(CUtexref hTexRef, CUarray_format fmt, int NumPackedComponents) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuTexRefSetAddressMode(CUtexref hTexRef, int dim, CUaddress_mode am) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuTexRefSetFilterMode(CUtexref hTexRef, CUfilter_mode fm) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuTexRefSetMipmapFilterMode(CUtexref hTexRef, CUfilter_mode fm) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuTexRefSetMipmapLevelBias(CUtexref hTexRef, float bias) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuTexRefSetMipmapLevelClamp(CUtexref hTexRef, float minMipmapLevelClamp, float maxMipmapLevelClamp) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuTexRefSetMaxAnisotropy(CUtexref hTexRef, unsigned int maxAniso) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuTexRefSetBorderColor(CUtexref hTexRef, float* pBorderColor) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuTexRefSetFlags(CUtexref hTexRef, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuTexRefGetAddress(CUdeviceptr* pdptr, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuTexRefGetArray(CUarray* phArray, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuTexRefGetMipmappedArray(CUmipmappedArray* phMipmappedArray, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuTexRefGetAddressMode(CUaddress_mode* pam, CUtexref hTexRef, int dim) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuTexRefGetFilterMode(CUfilter_mode* pfm, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuTexRefGetFormat(CUarray_format* pFormat, int* pNumChannels, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuTexRefGetMipmapFilterMode(CUfilter_mode* pfm, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuTexRefGetMipmapLevelBias(float* pbias, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuTexRefGetMipmapLevelClamp(float* pminMipmapLevelClamp, float* pmaxMipmapLevelClamp, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuTexRefGetMaxAnisotropy(int* pmaxAniso, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuTexRefGetBorderColor(float* pBorderColor, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuTexRefGetFlags(unsigned int* pFlags, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuTexRefCreate(CUtexref* pTexRef) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuTexRefDestroy(CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuSurfRefSetArray(CUsurfref hSurfRef, CUarray hArray, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuSurfRefGetArray(CUarray* phArray, CUsurfref hSurfRef) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuTexObjectCreate(CUtexObject* pTexObject, const CUDA_RESOURCE_DESC* pResDesc, const CUDA_TEXTURE_DESC* pTexDesc, const CUDA_RESOURCE_VIEW_DESC* pResViewDesc) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuTexObjectDestroy(CUtexObject texObject) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuTexObjectGetResourceDesc(CUDA_RESOURCE_DESC* pResDesc, CUtexObject texObject) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuTexObjectGetTextureDesc(CUDA_TEXTURE_DESC* pTexDesc, CUtexObject texObject) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuTexObjectGetResourceViewDesc(CUDA_RESOURCE_VIEW_DESC* pResViewDesc, CUtexObject texObject) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuSurfObjectCreate(CUsurfObject* pSurfObject, const CUDA_RESOURCE_DESC* pResDesc) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuSurfObjectDestroy(CUsurfObject surfObject) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuSurfObjectGetResourceDesc(CUDA_RESOURCE_DESC* pResDesc, CUsurfObject surfObject) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuTensorMapEncodeTiled(CUtensorMap* tensorMap, CUtensorMapDataType tensorDataType, cuuint32_t tensorRank, void* globalAddress, const cuuint64_t* globalDim, const cuuint64_t* globalStrides, const cuuint32_t* boxDim, const cuuint32_t* elementStrides, CUtensorMapInterleave interleave, CUtensorMapSwizzle swizzle, CUtensorMapL2promotion l2Promotion, CUtensorMapFloatOOBfill oobFill) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuTensorMapEncodeIm2col(CUtensorMap* tensorMap, CUtensorMapDataType tensorDataType, cuuint32_t tensorRank, void* globalAddress, const cuuint64_t* globalDim, const cuuint64_t* globalStrides, const int* pixelBoxLowerCorner, const int* pixelBoxUpperCorner, cuuint32_t channelsPerPixel, cuuint32_t pixelsPerColumn, const cuuint32_t* elementStrides, CUtensorMapInterleave interleave, CUtensorMapSwizzle swizzle, CUtensorMapL2promotion l2Promotion, CUtensorMapFloatOOBfill oobFill) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuTensorMapEncodeIm2colWide(CUtensorMap* tensorMap, CUtensorMapDataType tensorDataType, cuuint32_t tensorRank, void* globalAddress, const cuuint64_t* globalDim, const cuuint64_t* globalStrides, int pixelBoxLowerCornerWidth, int pixelBoxUpperCornerWidth, cuuint32_t channelsPerPixel, cuuint32_t pixelsPerColumn, const cuuint32_t* elementStrides, CUtensorMapInterleave interleave, CUtensorMapIm2ColWideMode mode, CUtensorMapSwizzle swizzle, CUtensorMapL2promotion l2Promotion, CUtensorMapFloatOOBfill oobFill) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuTensorMapReplaceAddress(CUtensorMap* tensorMap, void* globalAddress) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuDeviceCanAccessPeer(int* canAccessPeer, CUdevice dev, CUdevice peerDev) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuCtxEnablePeerAccess(CUcontext peerContext, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuCtxDisablePeerAccess(CUcontext peerContext) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuDeviceGetP2PAttribute(int* value, CUdevice_P2PAttribute attrib, CUdevice srcDevice, CUdevice dstDevice) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphicsUnregisterResource(CUgraphicsResource resource) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphicsSubResourceGetMappedArray(CUarray* pArray, CUgraphicsResource resource, unsigned int arrayIndex, unsigned int mipLevel) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphicsResourceGetMappedMipmappedArray(CUmipmappedArray* pMipmappedArray, CUgraphicsResource resource) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphicsResourceGetMappedPointer(CUdeviceptr* pDevPtr, size_t* pSize, CUgraphicsResource resource) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphicsResourceSetMapFlags(CUgraphicsResource resource, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphicsMapResources(unsigned int count, CUgraphicsResource* resources, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphicsUnmapResources(unsigned int count, CUgraphicsResource* resources, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGetProcAddress(const char* symbol, void** pfn, int cudaVersion, cuuint64_t flags, CUdriverProcAddressQueryResult* symbolStatus) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuCoredumpGetAttribute(CUcoredumpSettings attrib, void* value, size_t* size) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuCoredumpGetAttributeGlobal(CUcoredumpSettings attrib, void* value, size_t* size) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuCoredumpSetAttribute(CUcoredumpSettings attrib, void* value, size_t* size) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuCoredumpSetAttributeGlobal(CUcoredumpSettings attrib, void* value, size_t* size) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGetExportTable(const void** ppExportTable, const CUuuid* pExportTableId) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGreenCtxCreate(CUgreenCtx* phCtx, CUdevResourceDesc desc, CUdevice dev, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGreenCtxDestroy(CUgreenCtx hCtx) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuCtxFromGreenCtx(CUcontext* pContext, CUgreenCtx hCtx) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuDeviceGetDevResource(CUdevice device, CUdevResource* resource, CUdevResourceType type) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuCtxGetDevResource(CUcontext hCtx, CUdevResource* resource, CUdevResourceType type) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGreenCtxGetDevResource(CUgreenCtx hCtx, CUdevResource* resource, CUdevResourceType type) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuDevSmResourceSplitByCount(CUdevResource* result, unsigned int* nbGroups, const CUdevResource* input, CUdevResource* remainder, unsigned int flags, unsigned int minCount) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuDevResourceGenerateDesc(CUdevResourceDesc* phDesc, CUdevResource* resources, unsigned int nbResources) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGreenCtxRecordEvent(CUgreenCtx hCtx, CUevent hEvent) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGreenCtxWaitEvent(CUgreenCtx hCtx, CUevent hEvent) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuStreamGetGreenCtx(CUstream hStream, CUgreenCtx* phCtx) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGreenCtxStreamCreate(CUstream* phStream, CUgreenCtx greenCtx, unsigned int flags, int priority) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuLogsRegisterCallback(CUlogsCallback callbackFunc, void* userData, CUlogsCallbackHandle* callback_out) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuLogsUnregisterCallback(CUlogsCallbackHandle callback) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuLogsCurrent(CUlogIterator* iterator_out, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuLogsDumpToFile(CUlogIterator* iterator, const char* pathToFile, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuLogsDumpToMemory(CUlogIterator* iterator, char* buffer, size_t* size, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuCheckpointProcessGetRestoreThreadId(int pid, int* tid) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuCheckpointProcessGetState(int pid, CUprocessState* state) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuCheckpointProcessLock(int pid, CUcheckpointLockArgs* args) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuCheckpointProcessCheckpoint(int pid, CUcheckpointCheckpointArgs* args) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuCheckpointProcessRestore(int pid, CUcheckpointRestoreArgs* args) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuCheckpointProcessUnlock(int pid, CUcheckpointUnlockArgs* args) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphicsEGLRegisterImage(CUgraphicsResource* pCudaResource, EGLImageKHR image, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuEGLStreamConsumerConnect(CUeglStreamConnection* conn, EGLStreamKHR stream) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuEGLStreamConsumerConnectWithFlags(CUeglStreamConnection* conn, EGLStreamKHR stream, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuEGLStreamConsumerDisconnect(CUeglStreamConnection* conn) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuEGLStreamConsumerAcquireFrame(CUeglStreamConnection* conn, CUgraphicsResource* pCudaResource, CUstream* pStream, unsigned int timeout) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuEGLStreamConsumerReleaseFrame(CUeglStreamConnection* conn, CUgraphicsResource pCudaResource, CUstream* pStream) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuEGLStreamProducerConnect(CUeglStreamConnection* conn, EGLStreamKHR stream, EGLint width, EGLint height) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuEGLStreamProducerDisconnect(CUeglStreamConnection* conn) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuEGLStreamProducerPresentFrame(CUeglStreamConnection* conn, CUeglFrame eglframe, CUstream* pStream) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuEGLStreamProducerReturnFrame(CUeglStreamConnection* conn, CUeglFrame* eglframe, CUstream* pStream) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphicsResourceGetMappedEglFrame(CUeglFrame* eglFrame, CUgraphicsResource resource, unsigned int index, unsigned int mipLevel) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuEventCreateFromEGLSync(CUevent* phEvent, EGLSyncKHR eglSync, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphicsGLRegisterBuffer(CUgraphicsResource* pCudaResource, GLuint buffer, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphicsGLRegisterImage(CUgraphicsResource* pCudaResource, GLuint image, GLenum target, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGLGetDevices(unsigned int* pCudaDeviceCount, CUdevice* pCudaDevices, unsigned int cudaDeviceCount, CUGLDeviceList deviceList) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGLCtxCreate(CUcontext* pCtx, unsigned int Flags, CUdevice device) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGLInit() except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGLRegisterBufferObject(GLuint buffer) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGLMapBufferObject(CUdeviceptr* dptr, size_t* size, GLuint buffer) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGLUnmapBufferObject(GLuint buffer) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGLUnregisterBufferObject(GLuint buffer) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGLSetBufferObjectMapFlags(GLuint buffer, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGLMapBufferObjectAsync(CUdeviceptr* dptr, size_t* size, GLuint buffer, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGLUnmapBufferObjectAsync(GLuint buffer, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuProfilerInitialize(const char* configFile, const char* outputFile, CUoutput_mode outputMode) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuProfilerStart() except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuProfilerStop() except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuVDPAUGetDevice(CUdevice* pDevice, VdpDevice vdpDevice, VdpGetProcAddress* vdpGetProcAddress) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuVDPAUCtxCreate(CUcontext* pCtx, unsigned int flags, CUdevice device, VdpDevice vdpDevice, VdpGetProcAddress* vdpGetProcAddress) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphicsVDPAURegisterVideoSurface(CUgraphicsResource* pCudaResource, VdpVideoSurface vdpSurface, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphicsVDPAURegisterOutputSurface(CUgraphicsResource* pCudaResource, VdpOutputSurface vdpSurface, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuDeviceGetHostAtomicCapabilities(unsigned int* capabilities, const CUatomicOperation* operations, unsigned int count, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuCtxGetDevice_v2(CUdevice* device, CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuCtxSynchronize_v2(CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemcpyBatchAsync(CUdeviceptr* dsts, CUdeviceptr* srcs, size_t* sizes, size_t count, CUmemcpyAttributes* attrs, size_t* attrsIdxs, size_t numAttrs, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemcpy3DBatchAsync(size_t numOps, CUDA_MEMCPY3D_BATCH_OP* opList, unsigned long long flags, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemGetDefaultMemPool(CUmemoryPool* pool_out, CUmemLocation* location, CUmemAllocationType type) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemGetMemPool(CUmemoryPool* pool, CUmemLocation* location, CUmemAllocationType type) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemSetMemPool(CUmemLocation* location, CUmemAllocationType type, CUmemoryPool pool) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemPrefetchBatchAsync(CUdeviceptr* dptrs, size_t* sizes, size_t count, CUmemLocation* prefetchLocs, size_t* prefetchLocIdxs, size_t numPrefetchLocs, unsigned long long flags, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemDiscardBatchAsync(CUdeviceptr* dptrs, size_t* sizes, size_t count, unsigned long long flags, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemDiscardAndPrefetchBatchAsync(CUdeviceptr* dptrs, size_t* sizes, size_t count, CUmemLocation* prefetchLocs, size_t* prefetchLocIdxs, size_t numPrefetchLocs, unsigned long long flags, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuDeviceGetP2PAtomicCapabilities(unsigned int* capabilities, const CUatomicOperation* operations, unsigned int count, CUdevice srcDevice, CUdevice dstDevice) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGreenCtxGetId(CUgreenCtx greenCtx, unsigned long long* greenCtxId) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMulticastBindMem_v2(CUmemGenericAllocationHandle mcHandle, CUdevice dev, size_t mcOffset, CUmemGenericAllocationHandle memHandle, size_t memOffset, size_t size, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMulticastBindAddr_v2(CUmemGenericAllocationHandle mcHandle, CUdevice dev, size_t mcOffset, CUdeviceptr memptr, size_t size, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphNodeGetContainingGraph(CUgraphNode hNode, CUgraph* phGraph) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphNodeGetLocalId(CUgraphNode hNode, unsigned int* nodeId) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphNodeGetToolsId(CUgraphNode hNode, unsigned long long* toolsNodeId) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphGetId(CUgraph hGraph, unsigned int* graphId) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphExecGetId(CUgraphExec hGraphExec, unsigned int* graphId) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuDevSmResourceSplit(CUdevResource* result, unsigned int nbGroups, const CUdevResource* input, CUdevResource* remainder, unsigned int flags, CU_DEV_SM_RESOURCE_GROUP_PARAMS* groupParams) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuStreamGetDevResource(CUstream hStream, CUdevResource* resource, CUdevResourceType type) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuKernelGetParamCount(CUkernel kernel, size_t* paramCount) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemcpyWithAttributesAsync(CUdeviceptr dst, CUdeviceptr src, size_t size, CUmemcpyAttributes* attr, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuMemcpy3DWithAttributesAsync(CUDA_MEMCPY3D_BATCH_OP* op, unsigned long long flags, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuStreamBeginCaptureToCig(CUstream hStream, CUstreamCigCaptureParams* streamCigCaptureParams) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuStreamEndCaptureToCig(CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuFuncGetParamCount(CUfunction func, size_t* paramCount) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuLaunchHostFunc_v2(CUstream hStream, CUhostFn fn, void* userData, unsigned int syncMode) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuGraphNodeGetParams(CUgraphNode hNode, CUgraphNodeParams* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuCoredumpRegisterStartCallback(CUcoredumpStatusCallback callback, void* userData, CUcoredumpCallbackHandle* callbackOut) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuCoredumpRegisterCompleteCallback(CUcoredumpStatusCallback callback, void* userData, CUcoredumpCallbackHandle* callbackOut) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuCoredumpDeregisterStartCallback(CUcoredumpCallbackHandle callback) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuCoredumpDeregisterCompleteCallback(CUcoredumpCallbackHandle callback) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuLogicalEndpointIdReserve(CUlogicalEndpointId* baseLeId, cuuint32_t count) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuLogicalEndpointIdRelease(CUlogicalEndpointId baseLeId, cuuint32_t count) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuLogicalEndpointCreate(CUlogicalEndpointId leId, const CUlogicalEndpointProp* prop) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuLogicalEndpointAddDevice(CUlogicalEndpointId leId, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuLogicalEndpointDestroy(CUlogicalEndpointId leId) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuLogicalEndpointBindAddr(CUlogicalEndpointId leId, CUdevice dev, cuuint64_t offset, void* ptr, cuuint64_t size, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuLogicalEndpointBindMem(CUlogicalEndpointId leId, CUdevice dev, cuuint64_t offset, CUmemGenericAllocationHandle memHandle, cuuint64_t memOffset, cuuint64_t size, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuLogicalEndpointUnbind(CUlogicalEndpointId leId, CUdevice dev, cuuint64_t offset, cuuint64_t size) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuLogicalEndpointExport(void* handle, CUlogicalEndpointId leId, CUlogicalEndpointIpcHandleType handleType) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuLogicalEndpointImport(CUlogicalEndpointId leId, const void* handle, CUlogicalEndpointIpcHandleType handleType) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuLogicalEndpointGetLimits(cuuint64_t* bindAlignment, cuuint64_t* maxSize, const CUlogicalEndpointProp* prop) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuLogicalEndpointQuery(CUlogicalEndpointId leId, cuuint32_t count, int* queryStatus) except ?CUDA_ERROR_NOT_FOUND nogil +cdef CUresult cuStreamBeginRecaptureToGraph(CUstream hStream, CUstreamCaptureMode mode, CUgraph hGraph, CUgraphRecaptureCallback callbackFunc, void* userData) except ?CUDA_ERROR_NOT_FOUND nogil + + +# TODO: Extract these defines somehow? + +cdef enum: CU_IPC_HANDLE_SIZE = 64 + +cdef enum: CU_STREAM_LEGACY = 1 + +cdef enum: CU_STREAM_PER_THREAD = 2 + +cdef enum: CU_COMPUTE_ACCELERATED_TARGET_BASE = 65536 + +cdef enum: CU_COMPUTE_FAMILY_TARGET_BASE = 131072 + +cdef enum: CU_GRAPH_COND_ASSIGN_DEFAULT = 1 + +cdef enum: CU_GRAPH_KERNEL_NODE_PORT_DEFAULT = 0 + +cdef enum: CU_GRAPH_KERNEL_NODE_PORT_PROGRAMMATIC = 1 + +cdef enum: CU_GRAPH_KERNEL_NODE_PORT_LAUNCH_ORDER = 2 + +cdef enum: CU_KERNEL_NODE_ATTRIBUTE_ACCESS_POLICY_WINDOW = 1 + +cdef enum: CU_KERNEL_NODE_ATTRIBUTE_COOPERATIVE = 2 + +cdef enum: CU_KERNEL_NODE_ATTRIBUTE_CLUSTER_DIMENSION = 4 + +cdef enum: CU_KERNEL_NODE_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE = 5 + +cdef enum: CU_KERNEL_NODE_ATTRIBUTE_PRIORITY = 8 + +cdef enum: CU_KERNEL_NODE_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP = 9 + +cdef enum: CU_KERNEL_NODE_ATTRIBUTE_MEM_SYNC_DOMAIN = 10 + +cdef enum: CU_KERNEL_NODE_ATTRIBUTE_PREFERRED_CLUSTER_DIMENSION = 11 + +cdef enum: CU_KERNEL_NODE_ATTRIBUTE_DEVICE_UPDATABLE_KERNEL_NODE = 13 + +cdef enum: CU_KERNEL_NODE_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT = 14 + +cdef enum: CU_STREAM_ATTRIBUTE_ACCESS_POLICY_WINDOW = 1 + +cdef enum: CU_STREAM_ATTRIBUTE_SYNCHRONIZATION_POLICY = 3 + +cdef enum: CU_STREAM_ATTRIBUTE_PRIORITY = 8 + +cdef enum: CU_STREAM_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP = 9 + +cdef enum: CU_STREAM_ATTRIBUTE_MEM_SYNC_DOMAIN = 10 + +cdef enum: CU_MEMHOSTALLOC_PORTABLE = 1 + +cdef enum: CU_MEMHOSTALLOC_DEVICEMAP = 2 + +cdef enum: CU_MEMHOSTALLOC_WRITECOMBINED = 4 + +cdef enum: CU_MEMHOSTREGISTER_PORTABLE = 1 + +cdef enum: CU_MEMHOSTREGISTER_DEVICEMAP = 2 + +cdef enum: CU_MEMHOSTREGISTER_IOMEMORY = 4 + +cdef enum: CU_MEMHOSTREGISTER_READ_ONLY = 8 + +cdef enum: CU_ARRAY_SPARSE_PROPERTIES_SINGLE_MIPTAIL = 1 + +cdef enum: CU_TENSOR_MAP_NUM_QWORDS = 16 + +cdef enum: CUDA_EXTERNAL_MEMORY_DEDICATED = 1 + +cdef enum: CUDA_EXTERNAL_SEMAPHORE_SIGNAL_SKIP_NVSCIBUF_MEMSYNC = 1 + +cdef enum: CUDA_EXTERNAL_SEMAPHORE_WAIT_SKIP_NVSCIBUF_MEMSYNC = 2 + +cdef enum: CUDA_NVSCISYNC_ATTR_SIGNAL = 1 + +cdef enum: CUDA_NVSCISYNC_ATTR_WAIT = 2 + +cdef enum: CU_MEM_CREATE_USAGE_TILE_POOL = 1 + +cdef enum: CU_MEM_CREATE_USAGE_HW_DECOMPRESS = 2 + +cdef enum: CU_MEM_POOL_CREATE_USAGE_HW_DECOMPRESS = 2 + +cdef enum: CUDA_COOPERATIVE_LAUNCH_MULTI_DEVICE_NO_PRE_LAUNCH_SYNC = 1 + +cdef enum: CUDA_COOPERATIVE_LAUNCH_MULTI_DEVICE_NO_POST_LAUNCH_SYNC = 2 + +cdef enum: CUDA_ARRAY3D_LAYERED = 1 + +cdef enum: CUDA_ARRAY3D_2DARRAY = 1 + +cdef enum: CUDA_ARRAY3D_SURFACE_LDST = 2 + +cdef enum: CUDA_ARRAY3D_CUBEMAP = 4 + +cdef enum: CUDA_ARRAY3D_TEXTURE_GATHER = 8 + +cdef enum: CUDA_ARRAY3D_DEPTH_TEXTURE = 16 + +cdef enum: CUDA_ARRAY3D_COLOR_ATTACHMENT = 32 + +cdef enum: CUDA_ARRAY3D_SPARSE = 64 + +cdef enum: CUDA_ARRAY3D_DEFERRED_MAPPING = 128 + +cdef enum: CUDA_ARRAY3D_VIDEO_ENCODE_DECODE = 256 + +cdef enum: CU_TRSA_OVERRIDE_FORMAT = 1 + +cdef enum: CU_TRSF_READ_AS_INTEGER = 1 + +cdef enum: CU_TRSF_NORMALIZED_COORDINATES = 2 + +cdef enum: CU_TRSF_SRGB = 16 + +cdef enum: CU_TRSF_DISABLE_TRILINEAR_OPTIMIZATION = 32 + +cdef enum: CU_TRSF_SEAMLESS_CUBEMAP = 64 + +cdef enum: CU_LAUNCH_KERNEL_REQUIRED_BLOCK_DIM = 1 + +cdef enum: CU_LAUNCH_PARAM_END_AS_INT = 0 + +cdef enum: CU_LAUNCH_PARAM_END = 0 + +cdef enum: CU_LAUNCH_PARAM_BUFFER_POINTER_AS_INT = 1 + +cdef enum: CU_LAUNCH_PARAM_BUFFER_POINTER = 1 + +cdef enum: CU_LAUNCH_PARAM_BUFFER_SIZE_AS_INT = 2 + +cdef enum: CU_LAUNCH_PARAM_BUFFER_SIZE = 2 + +cdef enum: CU_PARAM_TR_DEFAULT = -1 + +cdef enum: CU_DEVICE_CPU = -1 + +cdef enum: CU_DEVICE_INVALID = -2 + +cdef enum: MAX_PLANES = 3 + +cdef enum: CUDA_EGL_INFINITE_TIMEOUT = 4294967295 + +cdef enum: RESOURCE_ABI_VERSION = 1 + +cdef enum: RESOURCE_ABI_EXTERNAL_BYTES = 42 diff --git a/cuda_bindings/cuda/bindings/cydriver.pyx b/cuda_bindings/cuda/bindings/cydriver.pyx new file mode 100644 index 00000000000..2ca1d97644e --- /dev/null +++ b/cuda_bindings/cuda/bindings/cydriver.pyx @@ -0,0 +1,2075 @@ +# SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +# This code was automatically generated across versions from 12.9.0 to 13.3.0. Do not modify it directly. + +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=5b828e2ee0de9b245c71a6ba9361656ab10f7564caa7e3d9c162b2c6a07fb3df +from ._internal cimport driver as _driver + +cdef CUresult cuGetErrorString(CUresult error, const char** pStr) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGetErrorString(error, pStr) + + +cdef CUresult cuGetErrorName(CUresult error, const char** pStr) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGetErrorName(error, pStr) + + +cdef CUresult cuInit(unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuInit(Flags) + + +cdef CUresult cuDriverGetVersion(int* driverVersion) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuDriverGetVersion(driverVersion) + + +cdef CUresult cuDeviceGet(CUdevice* device, int ordinal) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuDeviceGet(device, ordinal) + + +cdef CUresult cuDeviceGetCount(int* count) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuDeviceGetCount(count) + + +cdef CUresult cuDeviceGetName(char* name, int len, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuDeviceGetName(name, len, dev) + + +cdef CUresult cuDeviceGetUuid(CUuuid* uuid, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuDeviceGetUuid_v2(uuid, dev) + + +cdef CUresult cuDeviceGetLuid(char* luid, unsigned int* deviceNodeMask, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuDeviceGetLuid(luid, deviceNodeMask, dev) + + +cdef CUresult cuDeviceTotalMem(size_t* bytes, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuDeviceTotalMem_v2(bytes, dev) + + +cdef CUresult cuDeviceGetTexture1DLinearMaxWidth(size_t* maxWidthInElements, CUarray_format format, unsigned numChannels, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuDeviceGetTexture1DLinearMaxWidth(maxWidthInElements, format, numChannels, dev) + + +cdef CUresult cuDeviceGetAttribute(int* pi, CUdevice_attribute attrib, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuDeviceGetAttribute(pi, attrib, dev) + + +cdef CUresult cuDeviceGetNvSciSyncAttributes(void* nvSciSyncAttrList, CUdevice dev, int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuDeviceGetNvSciSyncAttributes(nvSciSyncAttrList, dev, flags) + + +cdef CUresult cuDeviceSetMemPool(CUdevice dev, CUmemoryPool pool) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuDeviceSetMemPool(dev, pool) + + +cdef CUresult cuDeviceGetMemPool(CUmemoryPool* pool, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuDeviceGetMemPool(pool, dev) + + +cdef CUresult cuDeviceGetDefaultMemPool(CUmemoryPool* pool_out, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuDeviceGetDefaultMemPool(pool_out, dev) + + +cdef CUresult cuDeviceGetExecAffinitySupport(int* pi, CUexecAffinityType type, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuDeviceGetExecAffinitySupport(pi, type, dev) + + +cdef CUresult cuFlushGPUDirectRDMAWrites(CUflushGPUDirectRDMAWritesTarget target, CUflushGPUDirectRDMAWritesScope scope) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuFlushGPUDirectRDMAWrites(target, scope) + + +cdef CUresult cuDeviceGetProperties(CUdevprop* prop, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuDeviceGetProperties(prop, dev) + + +cdef CUresult cuDeviceComputeCapability(int* major, int* minor, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuDeviceComputeCapability(major, minor, dev) + + +cdef CUresult cuDevicePrimaryCtxRetain(CUcontext* pctx, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuDevicePrimaryCtxRetain(pctx, dev) + + +cdef CUresult cuDevicePrimaryCtxRelease(CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuDevicePrimaryCtxRelease_v2(dev) + + +cdef CUresult cuDevicePrimaryCtxSetFlags(CUdevice dev, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuDevicePrimaryCtxSetFlags_v2(dev, flags) + + +cdef CUresult cuDevicePrimaryCtxGetState(CUdevice dev, unsigned int* flags, int* active) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuDevicePrimaryCtxGetState(dev, flags, active) + + +cdef CUresult cuDevicePrimaryCtxReset(CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuDevicePrimaryCtxReset_v2(dev) + + +cdef CUresult cuCtxCreate_v2(CUcontext* pctx, unsigned int flags, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuCtxCreate_v2(pctx, flags, dev) + + +cdef CUresult cuCtxCreate_v3(CUcontext* pctx, CUexecAffinityParam* paramsArray, int numParams, unsigned int flags, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuCtxCreate_v3(pctx, paramsArray, numParams, flags, dev) + + +cdef CUresult cuCtxCreate(CUcontext* pctx, CUctxCreateParams* ctxCreateParams, unsigned int flags, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuCtxCreate_v4(pctx, ctxCreateParams, flags, dev) + + +cdef CUresult cuCtxDestroy(CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuCtxDestroy_v2(ctx) + + +cdef CUresult cuCtxPushCurrent(CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuCtxPushCurrent_v2(ctx) + + +cdef CUresult cuCtxPopCurrent(CUcontext* pctx) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuCtxPopCurrent_v2(pctx) + + +cdef CUresult cuCtxSetCurrent(CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuCtxSetCurrent(ctx) + + +cdef CUresult cuCtxGetCurrent(CUcontext* pctx) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuCtxGetCurrent(pctx) + + +cdef CUresult cuCtxGetDevice(CUdevice* device) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuCtxGetDevice(device) + + +cdef CUresult cuCtxGetFlags(unsigned int* flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuCtxGetFlags(flags) + + +cdef CUresult cuCtxSetFlags(unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuCtxSetFlags(flags) + + +cdef CUresult cuCtxGetId(CUcontext ctx, unsigned long long* ctxId) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuCtxGetId(ctx, ctxId) + + +cdef CUresult cuCtxSynchronize() except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuCtxSynchronize() + + +cdef CUresult cuCtxSetLimit(CUlimit limit, size_t value) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuCtxSetLimit(limit, value) + + +cdef CUresult cuCtxGetLimit(size_t* pvalue, CUlimit limit) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuCtxGetLimit(pvalue, limit) + + +cdef CUresult cuCtxGetCacheConfig(CUfunc_cache* pconfig) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuCtxGetCacheConfig(pconfig) + + +cdef CUresult cuCtxSetCacheConfig(CUfunc_cache config) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuCtxSetCacheConfig(config) + + +cdef CUresult cuCtxGetApiVersion(CUcontext ctx, unsigned int* version) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuCtxGetApiVersion(ctx, version) + + +cdef CUresult cuCtxGetStreamPriorityRange(int* leastPriority, int* greatestPriority) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuCtxGetStreamPriorityRange(leastPriority, greatestPriority) + + +cdef CUresult cuCtxResetPersistingL2Cache() except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuCtxResetPersistingL2Cache() + + +cdef CUresult cuCtxGetExecAffinity(CUexecAffinityParam* pExecAffinity, CUexecAffinityType type) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuCtxGetExecAffinity(pExecAffinity, type) + + +cdef CUresult cuCtxRecordEvent(CUcontext hCtx, CUevent hEvent) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuCtxRecordEvent(hCtx, hEvent) + + +cdef CUresult cuCtxWaitEvent(CUcontext hCtx, CUevent hEvent) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuCtxWaitEvent(hCtx, hEvent) + + +cdef CUresult cuCtxAttach(CUcontext* pctx, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuCtxAttach(pctx, flags) + + +cdef CUresult cuCtxDetach(CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuCtxDetach(ctx) + + +cdef CUresult cuCtxGetSharedMemConfig(CUsharedconfig* pConfig) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuCtxGetSharedMemConfig(pConfig) + + +cdef CUresult cuCtxSetSharedMemConfig(CUsharedconfig config) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuCtxSetSharedMemConfig(config) + + +cdef CUresult cuModuleLoad(CUmodule* module, const char* fname) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuModuleLoad(module, fname) + + +cdef CUresult cuModuleLoadData(CUmodule* module, const void* image) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuModuleLoadData(module, image) + + +cdef CUresult cuModuleLoadDataEx(CUmodule* module, const void* image, unsigned int numOptions, CUjit_option* options, void** optionValues) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuModuleLoadDataEx(module, image, numOptions, options, optionValues) + + +cdef CUresult cuModuleLoadFatBinary(CUmodule* module, const void* fatCubin) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuModuleLoadFatBinary(module, fatCubin) + + +cdef CUresult cuModuleUnload(CUmodule hmod) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuModuleUnload(hmod) + + +cdef CUresult cuModuleGetLoadingMode(CUmoduleLoadingMode* mode) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuModuleGetLoadingMode(mode) + + +cdef CUresult cuModuleGetFunction(CUfunction* hfunc, CUmodule hmod, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuModuleGetFunction(hfunc, hmod, name) + + +cdef CUresult cuModuleGetFunctionCount(unsigned int* count, CUmodule mod) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuModuleGetFunctionCount(count, mod) + + +cdef CUresult cuModuleEnumerateFunctions(CUfunction* functions, unsigned int numFunctions, CUmodule mod) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuModuleEnumerateFunctions(functions, numFunctions, mod) + + +cdef CUresult cuModuleGetGlobal(CUdeviceptr* dptr, size_t* bytes, CUmodule hmod, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuModuleGetGlobal_v2(dptr, bytes, hmod, name) + + +cdef CUresult cuLinkCreate(unsigned int numOptions, CUjit_option* options, void** optionValues, CUlinkState* stateOut) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuLinkCreate_v2(numOptions, options, optionValues, stateOut) + + +cdef CUresult cuLinkAddData(CUlinkState state, CUjitInputType type, void* data, size_t size, const char* name, unsigned int numOptions, CUjit_option* options, void** optionValues) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuLinkAddData_v2(state, type, data, size, name, numOptions, options, optionValues) + + +cdef CUresult cuLinkAddFile(CUlinkState state, CUjitInputType type, const char* path, unsigned int numOptions, CUjit_option* options, void** optionValues) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuLinkAddFile_v2(state, type, path, numOptions, options, optionValues) + + +cdef CUresult cuLinkComplete(CUlinkState state, void** cubinOut, size_t* sizeOut) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuLinkComplete(state, cubinOut, sizeOut) + + +cdef CUresult cuLinkDestroy(CUlinkState state) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuLinkDestroy(state) + + +cdef CUresult cuModuleGetTexRef(CUtexref* pTexRef, CUmodule hmod, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuModuleGetTexRef(pTexRef, hmod, name) + + +cdef CUresult cuModuleGetSurfRef(CUsurfref* pSurfRef, CUmodule hmod, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuModuleGetSurfRef(pSurfRef, hmod, name) + + +cdef CUresult cuLibraryLoadData(CUlibrary* library, const void* code, CUjit_option* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, CUlibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuLibraryLoadData(library, code, jitOptions, jitOptionsValues, numJitOptions, libraryOptions, libraryOptionValues, numLibraryOptions) + + +cdef CUresult cuLibraryLoadFromFile(CUlibrary* library, const char* fileName, CUjit_option* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, CUlibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuLibraryLoadFromFile(library, fileName, jitOptions, jitOptionsValues, numJitOptions, libraryOptions, libraryOptionValues, numLibraryOptions) + + +cdef CUresult cuLibraryUnload(CUlibrary library) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuLibraryUnload(library) + + +cdef CUresult cuLibraryGetKernel(CUkernel* pKernel, CUlibrary library, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuLibraryGetKernel(pKernel, library, name) + + +cdef CUresult cuLibraryGetKernelCount(unsigned int* count, CUlibrary lib) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuLibraryGetKernelCount(count, lib) + + +cdef CUresult cuLibraryEnumerateKernels(CUkernel* kernels, unsigned int numKernels, CUlibrary lib) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuLibraryEnumerateKernels(kernels, numKernels, lib) + + +cdef CUresult cuLibraryGetModule(CUmodule* pMod, CUlibrary library) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuLibraryGetModule(pMod, library) + + +cdef CUresult cuKernelGetFunction(CUfunction* pFunc, CUkernel kernel) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuKernelGetFunction(pFunc, kernel) + + +cdef CUresult cuKernelGetLibrary(CUlibrary* pLib, CUkernel kernel) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuKernelGetLibrary(pLib, kernel) + + +cdef CUresult cuLibraryGetGlobal(CUdeviceptr* dptr, size_t* bytes, CUlibrary library, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuLibraryGetGlobal(dptr, bytes, library, name) + + +cdef CUresult cuLibraryGetManaged(CUdeviceptr* dptr, size_t* bytes, CUlibrary library, const char* name) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuLibraryGetManaged(dptr, bytes, library, name) + + +cdef CUresult cuLibraryGetUnifiedFunction(void** fptr, CUlibrary library, const char* symbol) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuLibraryGetUnifiedFunction(fptr, library, symbol) + + +cdef CUresult cuKernelGetAttribute(int* pi, CUfunction_attribute attrib, CUkernel kernel, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuKernelGetAttribute(pi, attrib, kernel, dev) + + +cdef CUresult cuKernelSetAttribute(CUfunction_attribute attrib, int val, CUkernel kernel, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuKernelSetAttribute(attrib, val, kernel, dev) + + +cdef CUresult cuKernelSetCacheConfig(CUkernel kernel, CUfunc_cache config, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuKernelSetCacheConfig(kernel, config, dev) + + +cdef CUresult cuKernelGetName(const char** name, CUkernel hfunc) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuKernelGetName(name, hfunc) + + +cdef CUresult cuKernelGetParamInfo(CUkernel kernel, size_t paramIndex, size_t* paramOffset, size_t* paramSize) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuKernelGetParamInfo(kernel, paramIndex, paramOffset, paramSize) + + +cdef CUresult cuMemGetInfo(size_t* free, size_t* total) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemGetInfo_v2(free, total) + + +cdef CUresult cuMemAlloc(CUdeviceptr* dptr, size_t bytesize) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemAlloc_v2(dptr, bytesize) + + +cdef CUresult cuMemAllocPitch(CUdeviceptr* dptr, size_t* pPitch, size_t WidthInBytes, size_t Height, unsigned int ElementSizeBytes) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemAllocPitch_v2(dptr, pPitch, WidthInBytes, Height, ElementSizeBytes) + + +cdef CUresult cuMemFree(CUdeviceptr dptr) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemFree_v2(dptr) + + +cdef CUresult cuMemGetAddressRange(CUdeviceptr* pbase, size_t* psize, CUdeviceptr dptr) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemGetAddressRange_v2(pbase, psize, dptr) + + +cdef CUresult cuMemAllocHost(void** pp, size_t bytesize) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemAllocHost_v2(pp, bytesize) + + +cdef CUresult cuMemFreeHost(void* p) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemFreeHost(p) + + +cdef CUresult cuMemHostAlloc(void** pp, size_t bytesize, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemHostAlloc(pp, bytesize, Flags) + + +cdef CUresult cuMemHostGetDevicePointer(CUdeviceptr* pdptr, void* p, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemHostGetDevicePointer_v2(pdptr, p, Flags) + + +cdef CUresult cuMemHostGetFlags(unsigned int* pFlags, void* p) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemHostGetFlags(pFlags, p) + + +cdef CUresult cuMemAllocManaged(CUdeviceptr* dptr, size_t bytesize, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemAllocManaged(dptr, bytesize, flags) + + +cdef CUresult cuDeviceRegisterAsyncNotification(CUdevice device, CUasyncCallback callbackFunc, void* userData, CUasyncCallbackHandle* callback) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuDeviceRegisterAsyncNotification(device, callbackFunc, userData, callback) + + +cdef CUresult cuDeviceUnregisterAsyncNotification(CUdevice device, CUasyncCallbackHandle callback) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuDeviceUnregisterAsyncNotification(device, callback) + + +cdef CUresult cuDeviceGetByPCIBusId(CUdevice* dev, const char* pciBusId) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuDeviceGetByPCIBusId(dev, pciBusId) + + +cdef CUresult cuDeviceGetPCIBusId(char* pciBusId, int len, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuDeviceGetPCIBusId(pciBusId, len, dev) + + +cdef CUresult cuIpcGetEventHandle(CUipcEventHandle* pHandle, CUevent event) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuIpcGetEventHandle(pHandle, event) + + +cdef CUresult cuIpcOpenEventHandle(CUevent* phEvent, CUipcEventHandle handle) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuIpcOpenEventHandle(phEvent, handle) + + +cdef CUresult cuIpcGetMemHandle(CUipcMemHandle* pHandle, CUdeviceptr dptr) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuIpcGetMemHandle(pHandle, dptr) + + +cdef CUresult cuIpcOpenMemHandle(CUdeviceptr* pdptr, CUipcMemHandle handle, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuIpcOpenMemHandle_v2(pdptr, handle, Flags) + + +cdef CUresult cuIpcCloseMemHandle(CUdeviceptr dptr) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuIpcCloseMemHandle(dptr) + + +cdef CUresult cuMemHostRegister(void* p, size_t bytesize, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemHostRegister_v2(p, bytesize, Flags) + + +cdef CUresult cuMemHostUnregister(void* p) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemHostUnregister(p) + + +cdef CUresult cuMemcpy(CUdeviceptr dst, CUdeviceptr src, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemcpy(dst, src, ByteCount) + + +cdef CUresult cuMemcpyPeer(CUdeviceptr dstDevice, CUcontext dstContext, CUdeviceptr srcDevice, CUcontext srcContext, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemcpyPeer(dstDevice, dstContext, srcDevice, srcContext, ByteCount) + + +cdef CUresult cuMemcpyHtoD(CUdeviceptr dstDevice, const void* srcHost, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemcpyHtoD_v2(dstDevice, srcHost, ByteCount) + + +cdef CUresult cuMemcpyDtoH(void* dstHost, CUdeviceptr srcDevice, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemcpyDtoH_v2(dstHost, srcDevice, ByteCount) + + +cdef CUresult cuMemcpyDtoD(CUdeviceptr dstDevice, CUdeviceptr srcDevice, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemcpyDtoD_v2(dstDevice, srcDevice, ByteCount) + + +cdef CUresult cuMemcpyDtoA(CUarray dstArray, size_t dstOffset, CUdeviceptr srcDevice, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemcpyDtoA_v2(dstArray, dstOffset, srcDevice, ByteCount) + + +cdef CUresult cuMemcpyAtoD(CUdeviceptr dstDevice, CUarray srcArray, size_t srcOffset, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemcpyAtoD_v2(dstDevice, srcArray, srcOffset, ByteCount) + + +cdef CUresult cuMemcpyHtoA(CUarray dstArray, size_t dstOffset, const void* srcHost, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemcpyHtoA_v2(dstArray, dstOffset, srcHost, ByteCount) + + +cdef CUresult cuMemcpyAtoH(void* dstHost, CUarray srcArray, size_t srcOffset, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemcpyAtoH_v2(dstHost, srcArray, srcOffset, ByteCount) + + +cdef CUresult cuMemcpyAtoA(CUarray dstArray, size_t dstOffset, CUarray srcArray, size_t srcOffset, size_t ByteCount) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemcpyAtoA_v2(dstArray, dstOffset, srcArray, srcOffset, ByteCount) + + +cdef CUresult cuMemcpy2D(const CUDA_MEMCPY2D* pCopy) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemcpy2D_v2(pCopy) + + +cdef CUresult cuMemcpy2DUnaligned(const CUDA_MEMCPY2D* pCopy) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemcpy2DUnaligned_v2(pCopy) + + +cdef CUresult cuMemcpy3D(const CUDA_MEMCPY3D* pCopy) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemcpy3D_v2(pCopy) + + +cdef CUresult cuMemcpy3DPeer(const CUDA_MEMCPY3D_PEER* pCopy) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemcpy3DPeer(pCopy) + + +cdef CUresult cuMemcpyAsync(CUdeviceptr dst, CUdeviceptr src, size_t ByteCount, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemcpyAsync(dst, src, ByteCount, hStream) + + +cdef CUresult cuMemcpyPeerAsync(CUdeviceptr dstDevice, CUcontext dstContext, CUdeviceptr srcDevice, CUcontext srcContext, size_t ByteCount, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemcpyPeerAsync(dstDevice, dstContext, srcDevice, srcContext, ByteCount, hStream) + + +cdef CUresult cuMemcpyHtoDAsync(CUdeviceptr dstDevice, const void* srcHost, size_t ByteCount, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemcpyHtoDAsync_v2(dstDevice, srcHost, ByteCount, hStream) + + +cdef CUresult cuMemcpyDtoHAsync(void* dstHost, CUdeviceptr srcDevice, size_t ByteCount, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemcpyDtoHAsync_v2(dstHost, srcDevice, ByteCount, hStream) + + +cdef CUresult cuMemcpyDtoDAsync(CUdeviceptr dstDevice, CUdeviceptr srcDevice, size_t ByteCount, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemcpyDtoDAsync_v2(dstDevice, srcDevice, ByteCount, hStream) + + +cdef CUresult cuMemcpyHtoAAsync(CUarray dstArray, size_t dstOffset, const void* srcHost, size_t ByteCount, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemcpyHtoAAsync_v2(dstArray, dstOffset, srcHost, ByteCount, hStream) + + +cdef CUresult cuMemcpyAtoHAsync(void* dstHost, CUarray srcArray, size_t srcOffset, size_t ByteCount, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemcpyAtoHAsync_v2(dstHost, srcArray, srcOffset, ByteCount, hStream) + + +cdef CUresult cuMemcpy2DAsync(const CUDA_MEMCPY2D* pCopy, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemcpy2DAsync_v2(pCopy, hStream) + + +cdef CUresult cuMemcpy3DAsync(const CUDA_MEMCPY3D* pCopy, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemcpy3DAsync_v2(pCopy, hStream) + + +cdef CUresult cuMemcpy3DPeerAsync(const CUDA_MEMCPY3D_PEER* pCopy, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemcpy3DPeerAsync(pCopy, hStream) + + +cdef CUresult cuMemsetD8(CUdeviceptr dstDevice, unsigned char uc, size_t N) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemsetD8_v2(dstDevice, uc, N) + + +cdef CUresult cuMemsetD16(CUdeviceptr dstDevice, unsigned short us, size_t N) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemsetD16_v2(dstDevice, us, N) + + +cdef CUresult cuMemsetD32(CUdeviceptr dstDevice, unsigned int ui, size_t N) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemsetD32_v2(dstDevice, ui, N) + + +cdef CUresult cuMemsetD2D8(CUdeviceptr dstDevice, size_t dstPitch, unsigned char uc, size_t Width, size_t Height) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemsetD2D8_v2(dstDevice, dstPitch, uc, Width, Height) + + +cdef CUresult cuMemsetD2D16(CUdeviceptr dstDevice, size_t dstPitch, unsigned short us, size_t Width, size_t Height) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemsetD2D16_v2(dstDevice, dstPitch, us, Width, Height) + + +cdef CUresult cuMemsetD2D32(CUdeviceptr dstDevice, size_t dstPitch, unsigned int ui, size_t Width, size_t Height) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemsetD2D32_v2(dstDevice, dstPitch, ui, Width, Height) + + +cdef CUresult cuMemsetD8Async(CUdeviceptr dstDevice, unsigned char uc, size_t N, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemsetD8Async(dstDevice, uc, N, hStream) + + +cdef CUresult cuMemsetD16Async(CUdeviceptr dstDevice, unsigned short us, size_t N, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemsetD16Async(dstDevice, us, N, hStream) + + +cdef CUresult cuMemsetD32Async(CUdeviceptr dstDevice, unsigned int ui, size_t N, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemsetD32Async(dstDevice, ui, N, hStream) + + +cdef CUresult cuMemsetD2D8Async(CUdeviceptr dstDevice, size_t dstPitch, unsigned char uc, size_t Width, size_t Height, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemsetD2D8Async(dstDevice, dstPitch, uc, Width, Height, hStream) + + +cdef CUresult cuMemsetD2D16Async(CUdeviceptr dstDevice, size_t dstPitch, unsigned short us, size_t Width, size_t Height, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemsetD2D16Async(dstDevice, dstPitch, us, Width, Height, hStream) + + +cdef CUresult cuMemsetD2D32Async(CUdeviceptr dstDevice, size_t dstPitch, unsigned int ui, size_t Width, size_t Height, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemsetD2D32Async(dstDevice, dstPitch, ui, Width, Height, hStream) + + +cdef CUresult cuArrayCreate(CUarray* pHandle, const CUDA_ARRAY_DESCRIPTOR* pAllocateArray) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuArrayCreate_v2(pHandle, pAllocateArray) + + +cdef CUresult cuArrayGetDescriptor(CUDA_ARRAY_DESCRIPTOR* pArrayDescriptor, CUarray hArray) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuArrayGetDescriptor_v2(pArrayDescriptor, hArray) + + +cdef CUresult cuArrayGetSparseProperties(CUDA_ARRAY_SPARSE_PROPERTIES* sparseProperties, CUarray array) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuArrayGetSparseProperties(sparseProperties, array) + + +cdef CUresult cuMipmappedArrayGetSparseProperties(CUDA_ARRAY_SPARSE_PROPERTIES* sparseProperties, CUmipmappedArray mipmap) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMipmappedArrayGetSparseProperties(sparseProperties, mipmap) + + +cdef CUresult cuArrayGetMemoryRequirements(CUDA_ARRAY_MEMORY_REQUIREMENTS* memoryRequirements, CUarray array, CUdevice device) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuArrayGetMemoryRequirements(memoryRequirements, array, device) + + +cdef CUresult cuMipmappedArrayGetMemoryRequirements(CUDA_ARRAY_MEMORY_REQUIREMENTS* memoryRequirements, CUmipmappedArray mipmap, CUdevice device) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMipmappedArrayGetMemoryRequirements(memoryRequirements, mipmap, device) + + +cdef CUresult cuArrayGetPlane(CUarray* pPlaneArray, CUarray hArray, unsigned int planeIdx) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuArrayGetPlane(pPlaneArray, hArray, planeIdx) + + +cdef CUresult cuArrayDestroy(CUarray hArray) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuArrayDestroy(hArray) + + +cdef CUresult cuArray3DCreate(CUarray* pHandle, const CUDA_ARRAY3D_DESCRIPTOR* pAllocateArray) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuArray3DCreate_v2(pHandle, pAllocateArray) + + +cdef CUresult cuArray3DGetDescriptor(CUDA_ARRAY3D_DESCRIPTOR* pArrayDescriptor, CUarray hArray) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuArray3DGetDescriptor_v2(pArrayDescriptor, hArray) + + +cdef CUresult cuMipmappedArrayCreate(CUmipmappedArray* pHandle, const CUDA_ARRAY3D_DESCRIPTOR* pMipmappedArrayDesc, unsigned int numMipmapLevels) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMipmappedArrayCreate(pHandle, pMipmappedArrayDesc, numMipmapLevels) + + +cdef CUresult cuMipmappedArrayGetLevel(CUarray* pLevelArray, CUmipmappedArray hMipmappedArray, unsigned int level) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMipmappedArrayGetLevel(pLevelArray, hMipmappedArray, level) + + +cdef CUresult cuMipmappedArrayDestroy(CUmipmappedArray hMipmappedArray) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMipmappedArrayDestroy(hMipmappedArray) + + +cdef CUresult cuMemGetHandleForAddressRange(void* handle, CUdeviceptr dptr, size_t size, CUmemRangeHandleType handleType, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemGetHandleForAddressRange(handle, dptr, size, handleType, flags) + + +cdef CUresult cuMemBatchDecompressAsync(CUmemDecompressParams* paramsArray, size_t count, unsigned int flags, size_t* errorIndex, CUstream stream) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemBatchDecompressAsync(paramsArray, count, flags, errorIndex, stream) + + +cdef CUresult cuMemAddressReserve(CUdeviceptr* ptr, size_t size, size_t alignment, CUdeviceptr addr, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemAddressReserve(ptr, size, alignment, addr, flags) + + +cdef CUresult cuMemAddressFree(CUdeviceptr ptr, size_t size) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemAddressFree(ptr, size) + + +cdef CUresult cuMemCreate(CUmemGenericAllocationHandle* handle, size_t size, const CUmemAllocationProp* prop, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemCreate(handle, size, prop, flags) + + +cdef CUresult cuMemRelease(CUmemGenericAllocationHandle handle) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemRelease(handle) + + +cdef CUresult cuMemMap(CUdeviceptr ptr, size_t size, size_t offset, CUmemGenericAllocationHandle handle, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemMap(ptr, size, offset, handle, flags) + + +cdef CUresult cuMemMapArrayAsync(CUarrayMapInfo* mapInfoList, unsigned int count, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemMapArrayAsync(mapInfoList, count, hStream) + + +cdef CUresult cuMemUnmap(CUdeviceptr ptr, size_t size) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemUnmap(ptr, size) + + +cdef CUresult cuMemSetAccess(CUdeviceptr ptr, size_t size, const CUmemAccessDesc* desc, size_t count) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemSetAccess(ptr, size, desc, count) + + +cdef CUresult cuMemGetAccess(unsigned long long* flags, const CUmemLocation* location, CUdeviceptr ptr) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemGetAccess(flags, location, ptr) + + +cdef CUresult cuMemExportToShareableHandle(void* shareableHandle, CUmemGenericAllocationHandle handle, CUmemAllocationHandleType handleType, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemExportToShareableHandle(shareableHandle, handle, handleType, flags) + + +cdef CUresult cuMemImportFromShareableHandle(CUmemGenericAllocationHandle* handle, void* osHandle, CUmemAllocationHandleType shHandleType) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemImportFromShareableHandle(handle, osHandle, shHandleType) + + +cdef CUresult cuMemGetAllocationGranularity(size_t* granularity, const CUmemAllocationProp* prop, CUmemAllocationGranularity_flags option) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemGetAllocationGranularity(granularity, prop, option) + + +cdef CUresult cuMemGetAllocationPropertiesFromHandle(CUmemAllocationProp* prop, CUmemGenericAllocationHandle handle) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemGetAllocationPropertiesFromHandle(prop, handle) + + +cdef CUresult cuMemRetainAllocationHandle(CUmemGenericAllocationHandle* handle, void* addr) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemRetainAllocationHandle(handle, addr) + + +cdef CUresult cuMemFreeAsync(CUdeviceptr dptr, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemFreeAsync(dptr, hStream) + + +cdef CUresult cuMemAllocAsync(CUdeviceptr* dptr, size_t bytesize, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemAllocAsync(dptr, bytesize, hStream) + + +cdef CUresult cuMemPoolTrimTo(CUmemoryPool pool, size_t minBytesToKeep) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemPoolTrimTo(pool, minBytesToKeep) + + +cdef CUresult cuMemPoolSetAttribute(CUmemoryPool pool, CUmemPool_attribute attr, void* value) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemPoolSetAttribute(pool, attr, value) + + +cdef CUresult cuMemPoolGetAttribute(CUmemoryPool pool, CUmemPool_attribute attr, void* value) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemPoolGetAttribute(pool, attr, value) + + +cdef CUresult cuMemPoolSetAccess(CUmemoryPool pool, const CUmemAccessDesc* map, size_t count) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemPoolSetAccess(pool, map, count) + + +cdef CUresult cuMemPoolGetAccess(CUmemAccess_flags* flags, CUmemoryPool memPool, CUmemLocation* location) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemPoolGetAccess(flags, memPool, location) + + +cdef CUresult cuMemPoolCreate(CUmemoryPool* pool, const CUmemPoolProps* poolProps) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemPoolCreate(pool, poolProps) + + +cdef CUresult cuMemPoolDestroy(CUmemoryPool pool) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemPoolDestroy(pool) + + +cdef CUresult cuMemAllocFromPoolAsync(CUdeviceptr* dptr, size_t bytesize, CUmemoryPool pool, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemAllocFromPoolAsync(dptr, bytesize, pool, hStream) + + +cdef CUresult cuMemPoolExportToShareableHandle(void* handle_out, CUmemoryPool pool, CUmemAllocationHandleType handleType, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemPoolExportToShareableHandle(handle_out, pool, handleType, flags) + + +cdef CUresult cuMemPoolImportFromShareableHandle(CUmemoryPool* pool_out, void* handle, CUmemAllocationHandleType handleType, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemPoolImportFromShareableHandle(pool_out, handle, handleType, flags) + + +cdef CUresult cuMemPoolExportPointer(CUmemPoolPtrExportData* shareData_out, CUdeviceptr ptr) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemPoolExportPointer(shareData_out, ptr) + + +cdef CUresult cuMemPoolImportPointer(CUdeviceptr* ptr_out, CUmemoryPool pool, CUmemPoolPtrExportData* shareData) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemPoolImportPointer(ptr_out, pool, shareData) + + +cdef CUresult cuMulticastCreate(CUmemGenericAllocationHandle* mcHandle, const CUmulticastObjectProp* prop) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMulticastCreate(mcHandle, prop) + + +cdef CUresult cuMulticastAddDevice(CUmemGenericAllocationHandle mcHandle, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMulticastAddDevice(mcHandle, dev) + + +cdef CUresult cuMulticastBindMem(CUmemGenericAllocationHandle mcHandle, size_t mcOffset, CUmemGenericAllocationHandle memHandle, size_t memOffset, size_t size, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMulticastBindMem(mcHandle, mcOffset, memHandle, memOffset, size, flags) + + +cdef CUresult cuMulticastBindAddr(CUmemGenericAllocationHandle mcHandle, size_t mcOffset, CUdeviceptr memptr, size_t size, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMulticastBindAddr(mcHandle, mcOffset, memptr, size, flags) + + +cdef CUresult cuMulticastUnbind(CUmemGenericAllocationHandle mcHandle, CUdevice dev, size_t mcOffset, size_t size) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMulticastUnbind(mcHandle, dev, mcOffset, size) + + +cdef CUresult cuMulticastGetGranularity(size_t* granularity, const CUmulticastObjectProp* prop, CUmulticastGranularity_flags option) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMulticastGetGranularity(granularity, prop, option) + + +cdef CUresult cuPointerGetAttribute(void* data, CUpointer_attribute attribute, CUdeviceptr ptr) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuPointerGetAttribute(data, attribute, ptr) + + +cdef CUresult cuMemPrefetchAsync(CUdeviceptr devPtr, size_t count, CUmemLocation location, unsigned int flags, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemPrefetchAsync_v2(devPtr, count, location, flags, hStream) + + +cdef CUresult cuMemAdvise(CUdeviceptr devPtr, size_t count, CUmem_advise advice, CUmemLocation location) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemAdvise_v2(devPtr, count, advice, location) + + +cdef CUresult cuMemRangeGetAttribute(void* data, size_t dataSize, CUmem_range_attribute attribute, CUdeviceptr devPtr, size_t count) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemRangeGetAttribute(data, dataSize, attribute, devPtr, count) + + +cdef CUresult cuMemRangeGetAttributes(void** data, size_t* dataSizes, CUmem_range_attribute* attributes, size_t numAttributes, CUdeviceptr devPtr, size_t count) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemRangeGetAttributes(data, dataSizes, attributes, numAttributes, devPtr, count) + + +cdef CUresult cuPointerSetAttribute(const void* value, CUpointer_attribute attribute, CUdeviceptr ptr) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuPointerSetAttribute(value, attribute, ptr) + + +cdef CUresult cuPointerGetAttributes(unsigned int numAttributes, CUpointer_attribute* attributes, void** data, CUdeviceptr ptr) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuPointerGetAttributes(numAttributes, attributes, data, ptr) + + +cdef CUresult cuStreamCreate(CUstream* phStream, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuStreamCreate(phStream, Flags) + + +cdef CUresult cuStreamCreateWithPriority(CUstream* phStream, unsigned int flags, int priority) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuStreamCreateWithPriority(phStream, flags, priority) + + +cdef CUresult cuStreamGetPriority(CUstream hStream, int* priority) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuStreamGetPriority(hStream, priority) + + +cdef CUresult cuStreamGetDevice(CUstream hStream, CUdevice* device) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuStreamGetDevice(hStream, device) + + +cdef CUresult cuStreamGetFlags(CUstream hStream, unsigned int* flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuStreamGetFlags(hStream, flags) + + +cdef CUresult cuStreamGetId(CUstream hStream, unsigned long long* streamId) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuStreamGetId(hStream, streamId) + + +cdef CUresult cuStreamGetCtx(CUstream hStream, CUcontext* pctx) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuStreamGetCtx(hStream, pctx) + + +cdef CUresult cuStreamGetCtx_v2(CUstream hStream, CUcontext* pCtx, CUgreenCtx* pGreenCtx) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuStreamGetCtx_v2(hStream, pCtx, pGreenCtx) + + +cdef CUresult cuStreamWaitEvent(CUstream hStream, CUevent hEvent, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuStreamWaitEvent(hStream, hEvent, Flags) + + +cdef CUresult cuStreamAddCallback(CUstream hStream, CUstreamCallback callback, void* userData, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuStreamAddCallback(hStream, callback, userData, flags) + + +cdef CUresult cuStreamBeginCapture(CUstream hStream, CUstreamCaptureMode mode) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuStreamBeginCapture_v2(hStream, mode) + + +cdef CUresult cuStreamBeginCaptureToGraph(CUstream hStream, CUgraph hGraph, const CUgraphNode* dependencies, const CUgraphEdgeData* dependencyData, size_t numDependencies, CUstreamCaptureMode mode) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuStreamBeginCaptureToGraph(hStream, hGraph, dependencies, dependencyData, numDependencies, mode) + + +cdef CUresult cuThreadExchangeStreamCaptureMode(CUstreamCaptureMode* mode) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuThreadExchangeStreamCaptureMode(mode) + + +cdef CUresult cuStreamEndCapture(CUstream hStream, CUgraph* phGraph) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuStreamEndCapture(hStream, phGraph) + + +cdef CUresult cuStreamIsCapturing(CUstream hStream, CUstreamCaptureStatus* captureStatus) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuStreamIsCapturing(hStream, captureStatus) + + +cdef CUresult cuStreamGetCaptureInfo_v2(CUstream hStream, CUstreamCaptureStatus* captureStatus_out, cuuint64_t* id_out, CUgraph* graph_out, const CUgraphNode** dependencies_out, size_t* numDependencies_out) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuStreamGetCaptureInfo_v2(hStream, captureStatus_out, id_out, graph_out, dependencies_out, numDependencies_out) + + +cdef CUresult cuStreamGetCaptureInfo(CUstream hStream, CUstreamCaptureStatus* captureStatus_out, cuuint64_t* id_out, CUgraph* graph_out, const CUgraphNode** dependencies_out, const CUgraphEdgeData** edgeData_out, size_t* numDependencies_out) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuStreamGetCaptureInfo_v3(hStream, captureStatus_out, id_out, graph_out, dependencies_out, edgeData_out, numDependencies_out) + + +cdef CUresult cuStreamUpdateCaptureDependencies(CUstream hStream, CUgraphNode* dependencies, const CUgraphEdgeData* dependencyData, size_t numDependencies, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuStreamUpdateCaptureDependencies_v2(hStream, dependencies, dependencyData, numDependencies, flags) + + +cdef CUresult cuStreamAttachMemAsync(CUstream hStream, CUdeviceptr dptr, size_t length, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuStreamAttachMemAsync(hStream, dptr, length, flags) + + +cdef CUresult cuStreamQuery(CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuStreamQuery(hStream) + + +cdef CUresult cuStreamSynchronize(CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuStreamSynchronize(hStream) + + +cdef CUresult cuStreamDestroy(CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuStreamDestroy_v2(hStream) + + +cdef CUresult cuStreamCopyAttributes(CUstream dst, CUstream src) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuStreamCopyAttributes(dst, src) + + +cdef CUresult cuStreamGetAttribute(CUstream hStream, CUstreamAttrID attr, CUstreamAttrValue* value_out) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuStreamGetAttribute(hStream, attr, value_out) + + +cdef CUresult cuStreamSetAttribute(CUstream hStream, CUstreamAttrID attr, const CUstreamAttrValue* value) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuStreamSetAttribute(hStream, attr, value) + + +cdef CUresult cuEventCreate(CUevent* phEvent, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuEventCreate(phEvent, Flags) + + +cdef CUresult cuEventRecord(CUevent hEvent, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuEventRecord(hEvent, hStream) + + +cdef CUresult cuEventRecordWithFlags(CUevent hEvent, CUstream hStream, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuEventRecordWithFlags(hEvent, hStream, flags) + + +cdef CUresult cuEventQuery(CUevent hEvent) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuEventQuery(hEvent) + + +cdef CUresult cuEventSynchronize(CUevent hEvent) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuEventSynchronize(hEvent) + + +cdef CUresult cuEventDestroy(CUevent hEvent) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuEventDestroy_v2(hEvent) + + +cdef CUresult cuEventElapsedTime(float* pMilliseconds, CUevent hStart, CUevent hEnd) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuEventElapsedTime_v2(pMilliseconds, hStart, hEnd) + + +cdef CUresult cuImportExternalMemory(CUexternalMemory* extMem_out, const CUDA_EXTERNAL_MEMORY_HANDLE_DESC* memHandleDesc) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuImportExternalMemory(extMem_out, memHandleDesc) + + +cdef CUresult cuExternalMemoryGetMappedBuffer(CUdeviceptr* devPtr, CUexternalMemory extMem, const CUDA_EXTERNAL_MEMORY_BUFFER_DESC* bufferDesc) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuExternalMemoryGetMappedBuffer(devPtr, extMem, bufferDesc) + + +cdef CUresult cuExternalMemoryGetMappedMipmappedArray(CUmipmappedArray* mipmap, CUexternalMemory extMem, const CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC* mipmapDesc) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuExternalMemoryGetMappedMipmappedArray(mipmap, extMem, mipmapDesc) + + +cdef CUresult cuDestroyExternalMemory(CUexternalMemory extMem) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuDestroyExternalMemory(extMem) + + +cdef CUresult cuImportExternalSemaphore(CUexternalSemaphore* extSem_out, const CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC* semHandleDesc) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuImportExternalSemaphore(extSem_out, semHandleDesc) + + +cdef CUresult cuSignalExternalSemaphoresAsync(const CUexternalSemaphore* extSemArray, const CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS* paramsArray, unsigned int numExtSems, CUstream stream) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuSignalExternalSemaphoresAsync(extSemArray, paramsArray, numExtSems, stream) + + +cdef CUresult cuWaitExternalSemaphoresAsync(const CUexternalSemaphore* extSemArray, const CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS* paramsArray, unsigned int numExtSems, CUstream stream) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuWaitExternalSemaphoresAsync(extSemArray, paramsArray, numExtSems, stream) + + +cdef CUresult cuDestroyExternalSemaphore(CUexternalSemaphore extSem) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuDestroyExternalSemaphore(extSem) + + +cdef CUresult cuStreamWaitValue32(CUstream stream, CUdeviceptr addr, cuuint32_t value, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuStreamWaitValue32_v2(stream, addr, value, flags) + + +cdef CUresult cuStreamWaitValue64(CUstream stream, CUdeviceptr addr, cuuint64_t value, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuStreamWaitValue64_v2(stream, addr, value, flags) + + +cdef CUresult cuStreamWriteValue32(CUstream stream, CUdeviceptr addr, cuuint32_t value, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuStreamWriteValue32_v2(stream, addr, value, flags) + + +cdef CUresult cuStreamWriteValue64(CUstream stream, CUdeviceptr addr, cuuint64_t value, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuStreamWriteValue64_v2(stream, addr, value, flags) + + +cdef CUresult cuStreamBatchMemOp(CUstream stream, unsigned int count, CUstreamBatchMemOpParams* paramArray, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuStreamBatchMemOp_v2(stream, count, paramArray, flags) + + +cdef CUresult cuFuncGetAttribute(int* pi, CUfunction_attribute attrib, CUfunction hfunc) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuFuncGetAttribute(pi, attrib, hfunc) + + +cdef CUresult cuFuncSetAttribute(CUfunction hfunc, CUfunction_attribute attrib, int value) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuFuncSetAttribute(hfunc, attrib, value) + + +cdef CUresult cuFuncSetCacheConfig(CUfunction hfunc, CUfunc_cache config) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuFuncSetCacheConfig(hfunc, config) + + +cdef CUresult cuFuncGetModule(CUmodule* hmod, CUfunction hfunc) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuFuncGetModule(hmod, hfunc) + + +cdef CUresult cuFuncGetName(const char** name, CUfunction hfunc) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuFuncGetName(name, hfunc) + + +cdef CUresult cuFuncGetParamInfo(CUfunction func, size_t paramIndex, size_t* paramOffset, size_t* paramSize) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuFuncGetParamInfo(func, paramIndex, paramOffset, paramSize) + + +cdef CUresult cuFuncIsLoaded(CUfunctionLoadingState* state, CUfunction function) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuFuncIsLoaded(state, function) + + +cdef CUresult cuFuncLoad(CUfunction function) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuFuncLoad(function) + + +cdef CUresult cuLaunchKernel(CUfunction f, unsigned int gridDimX, unsigned int gridDimY, unsigned int gridDimZ, unsigned int blockDimX, unsigned int blockDimY, unsigned int blockDimZ, unsigned int sharedMemBytes, CUstream hStream, void** kernelParams, void** extra) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuLaunchKernel(f, gridDimX, gridDimY, gridDimZ, blockDimX, blockDimY, blockDimZ, sharedMemBytes, hStream, kernelParams, extra) + + +cdef CUresult cuLaunchKernelEx(const CUlaunchConfig* config, CUfunction f, void** kernelParams, void** extra) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuLaunchKernelEx(config, f, kernelParams, extra) + + +cdef CUresult cuLaunchCooperativeKernel(CUfunction f, unsigned int gridDimX, unsigned int gridDimY, unsigned int gridDimZ, unsigned int blockDimX, unsigned int blockDimY, unsigned int blockDimZ, unsigned int sharedMemBytes, CUstream hStream, void** kernelParams) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuLaunchCooperativeKernel(f, gridDimX, gridDimY, gridDimZ, blockDimX, blockDimY, blockDimZ, sharedMemBytes, hStream, kernelParams) + + +cdef CUresult cuLaunchCooperativeKernelMultiDevice(CUDA_LAUNCH_PARAMS* launchParamsList, unsigned int numDevices, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuLaunchCooperativeKernelMultiDevice(launchParamsList, numDevices, flags) + + +cdef CUresult cuLaunchHostFunc(CUstream hStream, CUhostFn fn, void* userData) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuLaunchHostFunc(hStream, fn, userData) + + +cdef CUresult cuFuncSetBlockShape(CUfunction hfunc, int x, int y, int z) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuFuncSetBlockShape(hfunc, x, y, z) + + +cdef CUresult cuFuncSetSharedSize(CUfunction hfunc, unsigned int bytes) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuFuncSetSharedSize(hfunc, bytes) + + +cdef CUresult cuParamSetSize(CUfunction hfunc, unsigned int numbytes) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuParamSetSize(hfunc, numbytes) + + +cdef CUresult cuParamSeti(CUfunction hfunc, int offset, unsigned int value) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuParamSeti(hfunc, offset, value) + + +cdef CUresult cuParamSetf(CUfunction hfunc, int offset, float value) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuParamSetf(hfunc, offset, value) + + +cdef CUresult cuParamSetv(CUfunction hfunc, int offset, void* ptr, unsigned int numbytes) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuParamSetv(hfunc, offset, ptr, numbytes) + + +cdef CUresult cuLaunch(CUfunction f) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuLaunch(f) + + +cdef CUresult cuLaunchGrid(CUfunction f, int grid_width, int grid_height) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuLaunchGrid(f, grid_width, grid_height) + + +cdef CUresult cuLaunchGridAsync(CUfunction f, int grid_width, int grid_height, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuLaunchGridAsync(f, grid_width, grid_height, hStream) + + +cdef CUresult cuParamSetTexRef(CUfunction hfunc, int texunit, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuParamSetTexRef(hfunc, texunit, hTexRef) + + +cdef CUresult cuFuncSetSharedMemConfig(CUfunction hfunc, CUsharedconfig config) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuFuncSetSharedMemConfig(hfunc, config) + + +cdef CUresult cuGraphCreate(CUgraph* phGraph, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphCreate(phGraph, flags) + + +cdef CUresult cuGraphAddKernelNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, const CUDA_KERNEL_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphAddKernelNode_v2(phGraphNode, hGraph, dependencies, numDependencies, nodeParams) + + +cdef CUresult cuGraphKernelNodeGetParams(CUgraphNode hNode, CUDA_KERNEL_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphKernelNodeGetParams_v2(hNode, nodeParams) + + +cdef CUresult cuGraphKernelNodeSetParams(CUgraphNode hNode, const CUDA_KERNEL_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphKernelNodeSetParams_v2(hNode, nodeParams) + + +cdef CUresult cuGraphAddMemcpyNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, const CUDA_MEMCPY3D* copyParams, CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphAddMemcpyNode(phGraphNode, hGraph, dependencies, numDependencies, copyParams, ctx) + + +cdef CUresult cuGraphMemcpyNodeGetParams(CUgraphNode hNode, CUDA_MEMCPY3D* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphMemcpyNodeGetParams(hNode, nodeParams) + + +cdef CUresult cuGraphMemcpyNodeSetParams(CUgraphNode hNode, const CUDA_MEMCPY3D* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphMemcpyNodeSetParams(hNode, nodeParams) + + +cdef CUresult cuGraphAddMemsetNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, const CUDA_MEMSET_NODE_PARAMS* memsetParams, CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphAddMemsetNode(phGraphNode, hGraph, dependencies, numDependencies, memsetParams, ctx) + + +cdef CUresult cuGraphMemsetNodeGetParams(CUgraphNode hNode, CUDA_MEMSET_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphMemsetNodeGetParams(hNode, nodeParams) + + +cdef CUresult cuGraphMemsetNodeSetParams(CUgraphNode hNode, const CUDA_MEMSET_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphMemsetNodeSetParams(hNode, nodeParams) + + +cdef CUresult cuGraphAddHostNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, const CUDA_HOST_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphAddHostNode(phGraphNode, hGraph, dependencies, numDependencies, nodeParams) + + +cdef CUresult cuGraphHostNodeGetParams(CUgraphNode hNode, CUDA_HOST_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphHostNodeGetParams(hNode, nodeParams) + + +cdef CUresult cuGraphHostNodeSetParams(CUgraphNode hNode, const CUDA_HOST_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphHostNodeSetParams(hNode, nodeParams) + + +cdef CUresult cuGraphAddChildGraphNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, CUgraph childGraph) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphAddChildGraphNode(phGraphNode, hGraph, dependencies, numDependencies, childGraph) + + +cdef CUresult cuGraphChildGraphNodeGetGraph(CUgraphNode hNode, CUgraph* phGraph) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphChildGraphNodeGetGraph(hNode, phGraph) + + +cdef CUresult cuGraphAddEmptyNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphAddEmptyNode(phGraphNode, hGraph, dependencies, numDependencies) + + +cdef CUresult cuGraphAddEventRecordNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, CUevent event) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphAddEventRecordNode(phGraphNode, hGraph, dependencies, numDependencies, event) + + +cdef CUresult cuGraphEventRecordNodeGetEvent(CUgraphNode hNode, CUevent* event_out) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphEventRecordNodeGetEvent(hNode, event_out) + + +cdef CUresult cuGraphEventRecordNodeSetEvent(CUgraphNode hNode, CUevent event) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphEventRecordNodeSetEvent(hNode, event) + + +cdef CUresult cuGraphAddEventWaitNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, CUevent event) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphAddEventWaitNode(phGraphNode, hGraph, dependencies, numDependencies, event) + + +cdef CUresult cuGraphEventWaitNodeGetEvent(CUgraphNode hNode, CUevent* event_out) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphEventWaitNodeGetEvent(hNode, event_out) + + +cdef CUresult cuGraphEventWaitNodeSetEvent(CUgraphNode hNode, CUevent event) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphEventWaitNodeSetEvent(hNode, event) + + +cdef CUresult cuGraphAddExternalSemaphoresSignalNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, const CUDA_EXT_SEM_SIGNAL_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphAddExternalSemaphoresSignalNode(phGraphNode, hGraph, dependencies, numDependencies, nodeParams) + + +cdef CUresult cuGraphExternalSemaphoresSignalNodeGetParams(CUgraphNode hNode, CUDA_EXT_SEM_SIGNAL_NODE_PARAMS* params_out) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphExternalSemaphoresSignalNodeGetParams(hNode, params_out) + + +cdef CUresult cuGraphExternalSemaphoresSignalNodeSetParams(CUgraphNode hNode, const CUDA_EXT_SEM_SIGNAL_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphExternalSemaphoresSignalNodeSetParams(hNode, nodeParams) + + +cdef CUresult cuGraphAddExternalSemaphoresWaitNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, const CUDA_EXT_SEM_WAIT_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphAddExternalSemaphoresWaitNode(phGraphNode, hGraph, dependencies, numDependencies, nodeParams) + + +cdef CUresult cuGraphExternalSemaphoresWaitNodeGetParams(CUgraphNode hNode, CUDA_EXT_SEM_WAIT_NODE_PARAMS* params_out) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphExternalSemaphoresWaitNodeGetParams(hNode, params_out) + + +cdef CUresult cuGraphExternalSemaphoresWaitNodeSetParams(CUgraphNode hNode, const CUDA_EXT_SEM_WAIT_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphExternalSemaphoresWaitNodeSetParams(hNode, nodeParams) + + +cdef CUresult cuGraphAddBatchMemOpNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, const CUDA_BATCH_MEM_OP_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphAddBatchMemOpNode(phGraphNode, hGraph, dependencies, numDependencies, nodeParams) + + +cdef CUresult cuGraphBatchMemOpNodeGetParams(CUgraphNode hNode, CUDA_BATCH_MEM_OP_NODE_PARAMS* nodeParams_out) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphBatchMemOpNodeGetParams(hNode, nodeParams_out) + + +cdef CUresult cuGraphBatchMemOpNodeSetParams(CUgraphNode hNode, const CUDA_BATCH_MEM_OP_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphBatchMemOpNodeSetParams(hNode, nodeParams) + + +cdef CUresult cuGraphExecBatchMemOpNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_BATCH_MEM_OP_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphExecBatchMemOpNodeSetParams(hGraphExec, hNode, nodeParams) + + +cdef CUresult cuGraphAddMemAllocNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, CUDA_MEM_ALLOC_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphAddMemAllocNode(phGraphNode, hGraph, dependencies, numDependencies, nodeParams) + + +cdef CUresult cuGraphMemAllocNodeGetParams(CUgraphNode hNode, CUDA_MEM_ALLOC_NODE_PARAMS* params_out) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphMemAllocNodeGetParams(hNode, params_out) + + +cdef CUresult cuGraphAddMemFreeNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, size_t numDependencies, CUdeviceptr dptr) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphAddMemFreeNode(phGraphNode, hGraph, dependencies, numDependencies, dptr) + + +cdef CUresult cuGraphMemFreeNodeGetParams(CUgraphNode hNode, CUdeviceptr* dptr_out) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphMemFreeNodeGetParams(hNode, dptr_out) + + +cdef CUresult cuDeviceGraphMemTrim(CUdevice device) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuDeviceGraphMemTrim(device) + + +cdef CUresult cuDeviceGetGraphMemAttribute(CUdevice device, CUgraphMem_attribute attr, void* value) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuDeviceGetGraphMemAttribute(device, attr, value) + + +cdef CUresult cuDeviceSetGraphMemAttribute(CUdevice device, CUgraphMem_attribute attr, void* value) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuDeviceSetGraphMemAttribute(device, attr, value) + + +cdef CUresult cuGraphClone(CUgraph* phGraphClone, CUgraph originalGraph) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphClone(phGraphClone, originalGraph) + + +cdef CUresult cuGraphNodeFindInClone(CUgraphNode* phNode, CUgraphNode hOriginalNode, CUgraph hClonedGraph) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphNodeFindInClone(phNode, hOriginalNode, hClonedGraph) + + +cdef CUresult cuGraphNodeGetType(CUgraphNode hNode, CUgraphNodeType* type) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphNodeGetType(hNode, type) + + +cdef CUresult cuGraphGetNodes(CUgraph hGraph, CUgraphNode* nodes, size_t* numNodes) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphGetNodes(hGraph, nodes, numNodes) + + +cdef CUresult cuGraphGetRootNodes(CUgraph hGraph, CUgraphNode* rootNodes, size_t* numRootNodes) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphGetRootNodes(hGraph, rootNodes, numRootNodes) + + +cdef CUresult cuGraphGetEdges(CUgraph hGraph, CUgraphNode* from_, CUgraphNode* to, CUgraphEdgeData* edgeData, size_t* numEdges) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphGetEdges_v2(hGraph, from_, to, edgeData, numEdges) + + +cdef CUresult cuGraphNodeGetDependencies(CUgraphNode hNode, CUgraphNode* dependencies, CUgraphEdgeData* edgeData, size_t* numDependencies) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphNodeGetDependencies_v2(hNode, dependencies, edgeData, numDependencies) + + +cdef CUresult cuGraphNodeGetDependentNodes(CUgraphNode hNode, CUgraphNode* dependentNodes, CUgraphEdgeData* edgeData, size_t* numDependentNodes) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphNodeGetDependentNodes_v2(hNode, dependentNodes, edgeData, numDependentNodes) + + +cdef CUresult cuGraphAddDependencies(CUgraph hGraph, const CUgraphNode* from_, const CUgraphNode* to, const CUgraphEdgeData* edgeData, size_t numDependencies) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphAddDependencies_v2(hGraph, from_, to, edgeData, numDependencies) + + +cdef CUresult cuGraphRemoveDependencies(CUgraph hGraph, const CUgraphNode* from_, const CUgraphNode* to, const CUgraphEdgeData* edgeData, size_t numDependencies) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphRemoveDependencies_v2(hGraph, from_, to, edgeData, numDependencies) + + +cdef CUresult cuGraphDestroyNode(CUgraphNode hNode) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphDestroyNode(hNode) + + +cdef CUresult cuGraphInstantiate(CUgraphExec* phGraphExec, CUgraph hGraph, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphInstantiateWithFlags(phGraphExec, hGraph, flags) + + +cdef CUresult cuGraphInstantiateWithParams(CUgraphExec* phGraphExec, CUgraph hGraph, CUDA_GRAPH_INSTANTIATE_PARAMS* instantiateParams) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphInstantiateWithParams(phGraphExec, hGraph, instantiateParams) + + +cdef CUresult cuGraphExecGetFlags(CUgraphExec hGraphExec, cuuint64_t* flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphExecGetFlags(hGraphExec, flags) + + +cdef CUresult cuGraphExecKernelNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_KERNEL_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphExecKernelNodeSetParams_v2(hGraphExec, hNode, nodeParams) + + +cdef CUresult cuGraphExecMemcpyNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_MEMCPY3D* copyParams, CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphExecMemcpyNodeSetParams(hGraphExec, hNode, copyParams, ctx) + + +cdef CUresult cuGraphExecMemsetNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_MEMSET_NODE_PARAMS* memsetParams, CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphExecMemsetNodeSetParams(hGraphExec, hNode, memsetParams, ctx) + + +cdef CUresult cuGraphExecHostNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_HOST_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphExecHostNodeSetParams(hGraphExec, hNode, nodeParams) + + +cdef CUresult cuGraphExecChildGraphNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, CUgraph childGraph) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphExecChildGraphNodeSetParams(hGraphExec, hNode, childGraph) + + +cdef CUresult cuGraphExecEventRecordNodeSetEvent(CUgraphExec hGraphExec, CUgraphNode hNode, CUevent event) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphExecEventRecordNodeSetEvent(hGraphExec, hNode, event) + + +cdef CUresult cuGraphExecEventWaitNodeSetEvent(CUgraphExec hGraphExec, CUgraphNode hNode, CUevent event) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphExecEventWaitNodeSetEvent(hGraphExec, hNode, event) + + +cdef CUresult cuGraphExecExternalSemaphoresSignalNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_EXT_SEM_SIGNAL_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphExecExternalSemaphoresSignalNodeSetParams(hGraphExec, hNode, nodeParams) + + +cdef CUresult cuGraphExecExternalSemaphoresWaitNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_EXT_SEM_WAIT_NODE_PARAMS* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphExecExternalSemaphoresWaitNodeSetParams(hGraphExec, hNode, nodeParams) + + +cdef CUresult cuGraphNodeSetEnabled(CUgraphExec hGraphExec, CUgraphNode hNode, unsigned int isEnabled) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphNodeSetEnabled(hGraphExec, hNode, isEnabled) + + +cdef CUresult cuGraphNodeGetEnabled(CUgraphExec hGraphExec, CUgraphNode hNode, unsigned int* isEnabled) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphNodeGetEnabled(hGraphExec, hNode, isEnabled) + + +cdef CUresult cuGraphUpload(CUgraphExec hGraphExec, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphUpload(hGraphExec, hStream) + + +cdef CUresult cuGraphLaunch(CUgraphExec hGraphExec, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphLaunch(hGraphExec, hStream) + + +cdef CUresult cuGraphExecDestroy(CUgraphExec hGraphExec) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphExecDestroy(hGraphExec) + + +cdef CUresult cuGraphDestroy(CUgraph hGraph) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphDestroy(hGraph) + + +cdef CUresult cuGraphExecUpdate(CUgraphExec hGraphExec, CUgraph hGraph, CUgraphExecUpdateResultInfo* resultInfo) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphExecUpdate_v2(hGraphExec, hGraph, resultInfo) + + +cdef CUresult cuGraphKernelNodeCopyAttributes(CUgraphNode dst, CUgraphNode src) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphKernelNodeCopyAttributes(dst, src) + + +cdef CUresult cuGraphKernelNodeGetAttribute(CUgraphNode hNode, CUkernelNodeAttrID attr, CUkernelNodeAttrValue* value_out) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphKernelNodeGetAttribute(hNode, attr, value_out) + + +cdef CUresult cuGraphKernelNodeSetAttribute(CUgraphNode hNode, CUkernelNodeAttrID attr, const CUkernelNodeAttrValue* value) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphKernelNodeSetAttribute(hNode, attr, value) + + +cdef CUresult cuGraphDebugDotPrint(CUgraph hGraph, const char* path, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphDebugDotPrint(hGraph, path, flags) + + +cdef CUresult cuUserObjectCreate(CUuserObject* object_out, void* ptr, CUhostFn destroy, unsigned int initialRefcount, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuUserObjectCreate(object_out, ptr, destroy, initialRefcount, flags) + + +cdef CUresult cuUserObjectRetain(CUuserObject object, unsigned int count) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuUserObjectRetain(object, count) + + +cdef CUresult cuUserObjectRelease(CUuserObject object, unsigned int count) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuUserObjectRelease(object, count) + + +cdef CUresult cuGraphRetainUserObject(CUgraph graph, CUuserObject object, unsigned int count, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphRetainUserObject(graph, object, count, flags) + + +cdef CUresult cuGraphReleaseUserObject(CUgraph graph, CUuserObject object, unsigned int count) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphReleaseUserObject(graph, object, count) + + +cdef CUresult cuGraphAddNode(CUgraphNode* phGraphNode, CUgraph hGraph, const CUgraphNode* dependencies, const CUgraphEdgeData* dependencyData, size_t numDependencies, CUgraphNodeParams* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphAddNode_v2(phGraphNode, hGraph, dependencies, dependencyData, numDependencies, nodeParams) + + +cdef CUresult cuGraphNodeSetParams(CUgraphNode hNode, CUgraphNodeParams* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphNodeSetParams(hNode, nodeParams) + + +cdef CUresult cuGraphExecNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, CUgraphNodeParams* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphExecNodeSetParams(hGraphExec, hNode, nodeParams) + + +cdef CUresult cuGraphConditionalHandleCreate(CUgraphConditionalHandle* pHandle_out, CUgraph hGraph, CUcontext ctx, unsigned int defaultLaunchValue, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphConditionalHandleCreate(pHandle_out, hGraph, ctx, defaultLaunchValue, flags) + + +cdef CUresult cuOccupancyMaxActiveBlocksPerMultiprocessor(int* numBlocks, CUfunction func, int blockSize, size_t dynamicSMemSize) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuOccupancyMaxActiveBlocksPerMultiprocessor(numBlocks, func, blockSize, dynamicSMemSize) + + +cdef CUresult cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(int* numBlocks, CUfunction func, int blockSize, size_t dynamicSMemSize, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(numBlocks, func, blockSize, dynamicSMemSize, flags) + + +cdef CUresult cuOccupancyMaxPotentialBlockSize(int* minGridSize, int* blockSize, CUfunction func, CUoccupancyB2DSize blockSizeToDynamicSMemSize, size_t dynamicSMemSize, int blockSizeLimit) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuOccupancyMaxPotentialBlockSize(minGridSize, blockSize, func, blockSizeToDynamicSMemSize, dynamicSMemSize, blockSizeLimit) + + +cdef CUresult cuOccupancyMaxPotentialBlockSizeWithFlags(int* minGridSize, int* blockSize, CUfunction func, CUoccupancyB2DSize blockSizeToDynamicSMemSize, size_t dynamicSMemSize, int blockSizeLimit, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuOccupancyMaxPotentialBlockSizeWithFlags(minGridSize, blockSize, func, blockSizeToDynamicSMemSize, dynamicSMemSize, blockSizeLimit, flags) + + +cdef CUresult cuOccupancyAvailableDynamicSMemPerBlock(size_t* dynamicSmemSize, CUfunction func, int numBlocks, int blockSize) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuOccupancyAvailableDynamicSMemPerBlock(dynamicSmemSize, func, numBlocks, blockSize) + + +cdef CUresult cuOccupancyMaxPotentialClusterSize(int* clusterSize, CUfunction func, const CUlaunchConfig* config) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuOccupancyMaxPotentialClusterSize(clusterSize, func, config) + + +cdef CUresult cuOccupancyMaxActiveClusters(int* numClusters, CUfunction func, const CUlaunchConfig* config) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuOccupancyMaxActiveClusters(numClusters, func, config) + + +cdef CUresult cuTexRefSetArray(CUtexref hTexRef, CUarray hArray, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuTexRefSetArray(hTexRef, hArray, Flags) + + +cdef CUresult cuTexRefSetMipmappedArray(CUtexref hTexRef, CUmipmappedArray hMipmappedArray, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuTexRefSetMipmappedArray(hTexRef, hMipmappedArray, Flags) + + +cdef CUresult cuTexRefSetAddress(size_t* ByteOffset, CUtexref hTexRef, CUdeviceptr dptr, size_t bytes) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuTexRefSetAddress_v2(ByteOffset, hTexRef, dptr, bytes) + + +cdef CUresult cuTexRefSetAddress2D(CUtexref hTexRef, const CUDA_ARRAY_DESCRIPTOR* desc, CUdeviceptr dptr, size_t Pitch) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuTexRefSetAddress2D_v3(hTexRef, desc, dptr, Pitch) + + +cdef CUresult cuTexRefSetFormat(CUtexref hTexRef, CUarray_format fmt, int NumPackedComponents) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuTexRefSetFormat(hTexRef, fmt, NumPackedComponents) + + +cdef CUresult cuTexRefSetAddressMode(CUtexref hTexRef, int dim, CUaddress_mode am) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuTexRefSetAddressMode(hTexRef, dim, am) + + +cdef CUresult cuTexRefSetFilterMode(CUtexref hTexRef, CUfilter_mode fm) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuTexRefSetFilterMode(hTexRef, fm) + + +cdef CUresult cuTexRefSetMipmapFilterMode(CUtexref hTexRef, CUfilter_mode fm) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuTexRefSetMipmapFilterMode(hTexRef, fm) + + +cdef CUresult cuTexRefSetMipmapLevelBias(CUtexref hTexRef, float bias) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuTexRefSetMipmapLevelBias(hTexRef, bias) + + +cdef CUresult cuTexRefSetMipmapLevelClamp(CUtexref hTexRef, float minMipmapLevelClamp, float maxMipmapLevelClamp) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuTexRefSetMipmapLevelClamp(hTexRef, minMipmapLevelClamp, maxMipmapLevelClamp) + + +cdef CUresult cuTexRefSetMaxAnisotropy(CUtexref hTexRef, unsigned int maxAniso) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuTexRefSetMaxAnisotropy(hTexRef, maxAniso) + + +cdef CUresult cuTexRefSetBorderColor(CUtexref hTexRef, float* pBorderColor) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuTexRefSetBorderColor(hTexRef, pBorderColor) + + +cdef CUresult cuTexRefSetFlags(CUtexref hTexRef, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuTexRefSetFlags(hTexRef, Flags) + + +cdef CUresult cuTexRefGetAddress(CUdeviceptr* pdptr, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuTexRefGetAddress_v2(pdptr, hTexRef) + + +cdef CUresult cuTexRefGetArray(CUarray* phArray, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuTexRefGetArray(phArray, hTexRef) + + +cdef CUresult cuTexRefGetMipmappedArray(CUmipmappedArray* phMipmappedArray, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuTexRefGetMipmappedArray(phMipmappedArray, hTexRef) + + +cdef CUresult cuTexRefGetAddressMode(CUaddress_mode* pam, CUtexref hTexRef, int dim) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuTexRefGetAddressMode(pam, hTexRef, dim) + + +cdef CUresult cuTexRefGetFilterMode(CUfilter_mode* pfm, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuTexRefGetFilterMode(pfm, hTexRef) + + +cdef CUresult cuTexRefGetFormat(CUarray_format* pFormat, int* pNumChannels, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuTexRefGetFormat(pFormat, pNumChannels, hTexRef) + + +cdef CUresult cuTexRefGetMipmapFilterMode(CUfilter_mode* pfm, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuTexRefGetMipmapFilterMode(pfm, hTexRef) + + +cdef CUresult cuTexRefGetMipmapLevelBias(float* pbias, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuTexRefGetMipmapLevelBias(pbias, hTexRef) + + +cdef CUresult cuTexRefGetMipmapLevelClamp(float* pminMipmapLevelClamp, float* pmaxMipmapLevelClamp, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuTexRefGetMipmapLevelClamp(pminMipmapLevelClamp, pmaxMipmapLevelClamp, hTexRef) + + +cdef CUresult cuTexRefGetMaxAnisotropy(int* pmaxAniso, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuTexRefGetMaxAnisotropy(pmaxAniso, hTexRef) + + +cdef CUresult cuTexRefGetBorderColor(float* pBorderColor, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuTexRefGetBorderColor(pBorderColor, hTexRef) + + +cdef CUresult cuTexRefGetFlags(unsigned int* pFlags, CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuTexRefGetFlags(pFlags, hTexRef) + + +cdef CUresult cuTexRefCreate(CUtexref* pTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuTexRefCreate(pTexRef) + + +cdef CUresult cuTexRefDestroy(CUtexref hTexRef) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuTexRefDestroy(hTexRef) + + +cdef CUresult cuSurfRefSetArray(CUsurfref hSurfRef, CUarray hArray, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuSurfRefSetArray(hSurfRef, hArray, Flags) + + +cdef CUresult cuSurfRefGetArray(CUarray* phArray, CUsurfref hSurfRef) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuSurfRefGetArray(phArray, hSurfRef) + + +cdef CUresult cuTexObjectCreate(CUtexObject* pTexObject, const CUDA_RESOURCE_DESC* pResDesc, const CUDA_TEXTURE_DESC* pTexDesc, const CUDA_RESOURCE_VIEW_DESC* pResViewDesc) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuTexObjectCreate(pTexObject, pResDesc, pTexDesc, pResViewDesc) + + +cdef CUresult cuTexObjectDestroy(CUtexObject texObject) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuTexObjectDestroy(texObject) + + +cdef CUresult cuTexObjectGetResourceDesc(CUDA_RESOURCE_DESC* pResDesc, CUtexObject texObject) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuTexObjectGetResourceDesc(pResDesc, texObject) + + +cdef CUresult cuTexObjectGetTextureDesc(CUDA_TEXTURE_DESC* pTexDesc, CUtexObject texObject) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuTexObjectGetTextureDesc(pTexDesc, texObject) + + +cdef CUresult cuTexObjectGetResourceViewDesc(CUDA_RESOURCE_VIEW_DESC* pResViewDesc, CUtexObject texObject) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuTexObjectGetResourceViewDesc(pResViewDesc, texObject) + + +cdef CUresult cuSurfObjectCreate(CUsurfObject* pSurfObject, const CUDA_RESOURCE_DESC* pResDesc) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuSurfObjectCreate(pSurfObject, pResDesc) + + +cdef CUresult cuSurfObjectDestroy(CUsurfObject surfObject) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuSurfObjectDestroy(surfObject) + + +cdef CUresult cuSurfObjectGetResourceDesc(CUDA_RESOURCE_DESC* pResDesc, CUsurfObject surfObject) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuSurfObjectGetResourceDesc(pResDesc, surfObject) + + +cdef CUresult cuTensorMapEncodeTiled(CUtensorMap* tensorMap, CUtensorMapDataType tensorDataType, cuuint32_t tensorRank, void* globalAddress, const cuuint64_t* globalDim, const cuuint64_t* globalStrides, const cuuint32_t* boxDim, const cuuint32_t* elementStrides, CUtensorMapInterleave interleave, CUtensorMapSwizzle swizzle, CUtensorMapL2promotion l2Promotion, CUtensorMapFloatOOBfill oobFill) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuTensorMapEncodeTiled(tensorMap, tensorDataType, tensorRank, globalAddress, globalDim, globalStrides, boxDim, elementStrides, interleave, swizzle, l2Promotion, oobFill) + + +cdef CUresult cuTensorMapEncodeIm2col(CUtensorMap* tensorMap, CUtensorMapDataType tensorDataType, cuuint32_t tensorRank, void* globalAddress, const cuuint64_t* globalDim, const cuuint64_t* globalStrides, const int* pixelBoxLowerCorner, const int* pixelBoxUpperCorner, cuuint32_t channelsPerPixel, cuuint32_t pixelsPerColumn, const cuuint32_t* elementStrides, CUtensorMapInterleave interleave, CUtensorMapSwizzle swizzle, CUtensorMapL2promotion l2Promotion, CUtensorMapFloatOOBfill oobFill) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuTensorMapEncodeIm2col(tensorMap, tensorDataType, tensorRank, globalAddress, globalDim, globalStrides, pixelBoxLowerCorner, pixelBoxUpperCorner, channelsPerPixel, pixelsPerColumn, elementStrides, interleave, swizzle, l2Promotion, oobFill) + + +cdef CUresult cuTensorMapEncodeIm2colWide(CUtensorMap* tensorMap, CUtensorMapDataType tensorDataType, cuuint32_t tensorRank, void* globalAddress, const cuuint64_t* globalDim, const cuuint64_t* globalStrides, int pixelBoxLowerCornerWidth, int pixelBoxUpperCornerWidth, cuuint32_t channelsPerPixel, cuuint32_t pixelsPerColumn, const cuuint32_t* elementStrides, CUtensorMapInterleave interleave, CUtensorMapIm2ColWideMode mode, CUtensorMapSwizzle swizzle, CUtensorMapL2promotion l2Promotion, CUtensorMapFloatOOBfill oobFill) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuTensorMapEncodeIm2colWide(tensorMap, tensorDataType, tensorRank, globalAddress, globalDim, globalStrides, pixelBoxLowerCornerWidth, pixelBoxUpperCornerWidth, channelsPerPixel, pixelsPerColumn, elementStrides, interleave, mode, swizzle, l2Promotion, oobFill) + + +cdef CUresult cuTensorMapReplaceAddress(CUtensorMap* tensorMap, void* globalAddress) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuTensorMapReplaceAddress(tensorMap, globalAddress) + + +cdef CUresult cuDeviceCanAccessPeer(int* canAccessPeer, CUdevice dev, CUdevice peerDev) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuDeviceCanAccessPeer(canAccessPeer, dev, peerDev) + + +cdef CUresult cuCtxEnablePeerAccess(CUcontext peerContext, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuCtxEnablePeerAccess(peerContext, Flags) + + +cdef CUresult cuCtxDisablePeerAccess(CUcontext peerContext) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuCtxDisablePeerAccess(peerContext) + + +cdef CUresult cuDeviceGetP2PAttribute(int* value, CUdevice_P2PAttribute attrib, CUdevice srcDevice, CUdevice dstDevice) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuDeviceGetP2PAttribute(value, attrib, srcDevice, dstDevice) + + +cdef CUresult cuGraphicsUnregisterResource(CUgraphicsResource resource) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphicsUnregisterResource(resource) + + +cdef CUresult cuGraphicsSubResourceGetMappedArray(CUarray* pArray, CUgraphicsResource resource, unsigned int arrayIndex, unsigned int mipLevel) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphicsSubResourceGetMappedArray(pArray, resource, arrayIndex, mipLevel) + + +cdef CUresult cuGraphicsResourceGetMappedMipmappedArray(CUmipmappedArray* pMipmappedArray, CUgraphicsResource resource) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphicsResourceGetMappedMipmappedArray(pMipmappedArray, resource) + + +cdef CUresult cuGraphicsResourceGetMappedPointer(CUdeviceptr* pDevPtr, size_t* pSize, CUgraphicsResource resource) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphicsResourceGetMappedPointer_v2(pDevPtr, pSize, resource) + + +cdef CUresult cuGraphicsResourceSetMapFlags(CUgraphicsResource resource, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphicsResourceSetMapFlags_v2(resource, flags) + + +cdef CUresult cuGraphicsMapResources(unsigned int count, CUgraphicsResource* resources, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphicsMapResources(count, resources, hStream) + + +cdef CUresult cuGraphicsUnmapResources(unsigned int count, CUgraphicsResource* resources, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphicsUnmapResources(count, resources, hStream) + + +cdef CUresult cuGetProcAddress(const char* symbol, void** pfn, int cudaVersion, cuuint64_t flags, CUdriverProcAddressQueryResult* symbolStatus) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGetProcAddress_v2(symbol, pfn, cudaVersion, flags, symbolStatus) + + +cdef CUresult cuCoredumpGetAttribute(CUcoredumpSettings attrib, void* value, size_t* size) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuCoredumpGetAttribute(attrib, value, size) + + +cdef CUresult cuCoredumpGetAttributeGlobal(CUcoredumpSettings attrib, void* value, size_t* size) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuCoredumpGetAttributeGlobal(attrib, value, size) + + +cdef CUresult cuCoredumpSetAttribute(CUcoredumpSettings attrib, void* value, size_t* size) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuCoredumpSetAttribute(attrib, value, size) + + +cdef CUresult cuCoredumpSetAttributeGlobal(CUcoredumpSettings attrib, void* value, size_t* size) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuCoredumpSetAttributeGlobal(attrib, value, size) + + +cdef CUresult cuGetExportTable(const void** ppExportTable, const CUuuid* pExportTableId) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGetExportTable(ppExportTable, pExportTableId) + + +cdef CUresult cuGreenCtxCreate(CUgreenCtx* phCtx, CUdevResourceDesc desc, CUdevice dev, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGreenCtxCreate(phCtx, desc, dev, flags) + + +cdef CUresult cuGreenCtxDestroy(CUgreenCtx hCtx) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGreenCtxDestroy(hCtx) + + +cdef CUresult cuCtxFromGreenCtx(CUcontext* pContext, CUgreenCtx hCtx) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuCtxFromGreenCtx(pContext, hCtx) + + +cdef CUresult cuDeviceGetDevResource(CUdevice device, CUdevResource* resource, CUdevResourceType type) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuDeviceGetDevResource(device, resource, type) + + +cdef CUresult cuCtxGetDevResource(CUcontext hCtx, CUdevResource* resource, CUdevResourceType type) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuCtxGetDevResource(hCtx, resource, type) + + +cdef CUresult cuGreenCtxGetDevResource(CUgreenCtx hCtx, CUdevResource* resource, CUdevResourceType type) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGreenCtxGetDevResource(hCtx, resource, type) + + +cdef CUresult cuDevSmResourceSplitByCount(CUdevResource* result, unsigned int* nbGroups, const CUdevResource* input, CUdevResource* remainder, unsigned int flags, unsigned int minCount) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuDevSmResourceSplitByCount(result, nbGroups, input, remainder, flags, minCount) + + +cdef CUresult cuDevResourceGenerateDesc(CUdevResourceDesc* phDesc, CUdevResource* resources, unsigned int nbResources) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuDevResourceGenerateDesc(phDesc, resources, nbResources) + + +cdef CUresult cuGreenCtxRecordEvent(CUgreenCtx hCtx, CUevent hEvent) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGreenCtxRecordEvent(hCtx, hEvent) + + +cdef CUresult cuGreenCtxWaitEvent(CUgreenCtx hCtx, CUevent hEvent) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGreenCtxWaitEvent(hCtx, hEvent) + + +cdef CUresult cuStreamGetGreenCtx(CUstream hStream, CUgreenCtx* phCtx) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuStreamGetGreenCtx(hStream, phCtx) + + +cdef CUresult cuGreenCtxStreamCreate(CUstream* phStream, CUgreenCtx greenCtx, unsigned int flags, int priority) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGreenCtxStreamCreate(phStream, greenCtx, flags, priority) + + +cdef CUresult cuLogsRegisterCallback(CUlogsCallback callbackFunc, void* userData, CUlogsCallbackHandle* callback_out) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuLogsRegisterCallback(callbackFunc, userData, callback_out) + + +cdef CUresult cuLogsUnregisterCallback(CUlogsCallbackHandle callback) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuLogsUnregisterCallback(callback) + + +cdef CUresult cuLogsCurrent(CUlogIterator* iterator_out, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuLogsCurrent(iterator_out, flags) + + +cdef CUresult cuLogsDumpToFile(CUlogIterator* iterator, const char* pathToFile, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuLogsDumpToFile(iterator, pathToFile, flags) + + +cdef CUresult cuLogsDumpToMemory(CUlogIterator* iterator, char* buffer, size_t* size, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuLogsDumpToMemory(iterator, buffer, size, flags) + + +cdef CUresult cuCheckpointProcessGetRestoreThreadId(int pid, int* tid) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuCheckpointProcessGetRestoreThreadId(pid, tid) + + +cdef CUresult cuCheckpointProcessGetState(int pid, CUprocessState* state) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuCheckpointProcessGetState(pid, state) + + +cdef CUresult cuCheckpointProcessLock(int pid, CUcheckpointLockArgs* args) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuCheckpointProcessLock(pid, args) + + +cdef CUresult cuCheckpointProcessCheckpoint(int pid, CUcheckpointCheckpointArgs* args) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuCheckpointProcessCheckpoint(pid, args) + + +cdef CUresult cuCheckpointProcessRestore(int pid, CUcheckpointRestoreArgs* args) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuCheckpointProcessRestore(pid, args) + + +cdef CUresult cuCheckpointProcessUnlock(int pid, CUcheckpointUnlockArgs* args) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuCheckpointProcessUnlock(pid, args) + + +cdef CUresult cuGraphicsEGLRegisterImage(CUgraphicsResource* pCudaResource, EGLImageKHR image, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphicsEGLRegisterImage(pCudaResource, image, flags) + + +cdef CUresult cuEGLStreamConsumerConnect(CUeglStreamConnection* conn, EGLStreamKHR stream) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuEGLStreamConsumerConnect(conn, stream) + + +cdef CUresult cuEGLStreamConsumerConnectWithFlags(CUeglStreamConnection* conn, EGLStreamKHR stream, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuEGLStreamConsumerConnectWithFlags(conn, stream, flags) + + +cdef CUresult cuEGLStreamConsumerDisconnect(CUeglStreamConnection* conn) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuEGLStreamConsumerDisconnect(conn) + + +cdef CUresult cuEGLStreamConsumerAcquireFrame(CUeglStreamConnection* conn, CUgraphicsResource* pCudaResource, CUstream* pStream, unsigned int timeout) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuEGLStreamConsumerAcquireFrame(conn, pCudaResource, pStream, timeout) + + +cdef CUresult cuEGLStreamConsumerReleaseFrame(CUeglStreamConnection* conn, CUgraphicsResource pCudaResource, CUstream* pStream) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuEGLStreamConsumerReleaseFrame(conn, pCudaResource, pStream) + + +cdef CUresult cuEGLStreamProducerConnect(CUeglStreamConnection* conn, EGLStreamKHR stream, EGLint width, EGLint height) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuEGLStreamProducerConnect(conn, stream, width, height) + + +cdef CUresult cuEGLStreamProducerDisconnect(CUeglStreamConnection* conn) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuEGLStreamProducerDisconnect(conn) + + +cdef CUresult cuEGLStreamProducerPresentFrame(CUeglStreamConnection* conn, CUeglFrame eglframe, CUstream* pStream) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuEGLStreamProducerPresentFrame(conn, eglframe, pStream) + + +cdef CUresult cuEGLStreamProducerReturnFrame(CUeglStreamConnection* conn, CUeglFrame* eglframe, CUstream* pStream) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuEGLStreamProducerReturnFrame(conn, eglframe, pStream) + + +cdef CUresult cuGraphicsResourceGetMappedEglFrame(CUeglFrame* eglFrame, CUgraphicsResource resource, unsigned int index, unsigned int mipLevel) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphicsResourceGetMappedEglFrame(eglFrame, resource, index, mipLevel) + + +cdef CUresult cuEventCreateFromEGLSync(CUevent* phEvent, EGLSyncKHR eglSync, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuEventCreateFromEGLSync(phEvent, eglSync, flags) + + +cdef CUresult cuGraphicsGLRegisterBuffer(CUgraphicsResource* pCudaResource, GLuint buffer, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphicsGLRegisterBuffer(pCudaResource, buffer, Flags) + + +cdef CUresult cuGraphicsGLRegisterImage(CUgraphicsResource* pCudaResource, GLuint image, GLenum target, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphicsGLRegisterImage(pCudaResource, image, target, Flags) + + +cdef CUresult cuGLGetDevices(unsigned int* pCudaDeviceCount, CUdevice* pCudaDevices, unsigned int cudaDeviceCount, CUGLDeviceList deviceList) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGLGetDevices_v2(pCudaDeviceCount, pCudaDevices, cudaDeviceCount, deviceList) + + +cdef CUresult cuGLCtxCreate(CUcontext* pCtx, unsigned int Flags, CUdevice device) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGLCtxCreate_v2(pCtx, Flags, device) + + +cdef CUresult cuGLInit() except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGLInit() + + +cdef CUresult cuGLRegisterBufferObject(GLuint buffer) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGLRegisterBufferObject(buffer) + + +cdef CUresult cuGLMapBufferObject(CUdeviceptr* dptr, size_t* size, GLuint buffer) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGLMapBufferObject_v2(dptr, size, buffer) + + +cdef CUresult cuGLUnmapBufferObject(GLuint buffer) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGLUnmapBufferObject(buffer) + + +cdef CUresult cuGLUnregisterBufferObject(GLuint buffer) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGLUnregisterBufferObject(buffer) + + +cdef CUresult cuGLSetBufferObjectMapFlags(GLuint buffer, unsigned int Flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGLSetBufferObjectMapFlags(buffer, Flags) + + +cdef CUresult cuGLMapBufferObjectAsync(CUdeviceptr* dptr, size_t* size, GLuint buffer, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGLMapBufferObjectAsync_v2(dptr, size, buffer, hStream) + + +cdef CUresult cuGLUnmapBufferObjectAsync(GLuint buffer, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGLUnmapBufferObjectAsync(buffer, hStream) + + +cdef CUresult cuProfilerInitialize(const char* configFile, const char* outputFile, CUoutput_mode outputMode) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuProfilerInitialize(configFile, outputFile, outputMode) + + +cdef CUresult cuProfilerStart() except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuProfilerStart() + + +cdef CUresult cuProfilerStop() except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuProfilerStop() + + +cdef CUresult cuVDPAUGetDevice(CUdevice* pDevice, VdpDevice vdpDevice, VdpGetProcAddress* vdpGetProcAddress) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuVDPAUGetDevice(pDevice, vdpDevice, vdpGetProcAddress) + + +cdef CUresult cuVDPAUCtxCreate(CUcontext* pCtx, unsigned int flags, CUdevice device, VdpDevice vdpDevice, VdpGetProcAddress* vdpGetProcAddress) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuVDPAUCtxCreate_v2(pCtx, flags, device, vdpDevice, vdpGetProcAddress) + + +cdef CUresult cuGraphicsVDPAURegisterVideoSurface(CUgraphicsResource* pCudaResource, VdpVideoSurface vdpSurface, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphicsVDPAURegisterVideoSurface(pCudaResource, vdpSurface, flags) + + +cdef CUresult cuGraphicsVDPAURegisterOutputSurface(CUgraphicsResource* pCudaResource, VdpOutputSurface vdpSurface, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphicsVDPAURegisterOutputSurface(pCudaResource, vdpSurface, flags) + + +cdef CUresult cuDeviceGetHostAtomicCapabilities(unsigned int* capabilities, const CUatomicOperation* operations, unsigned int count, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuDeviceGetHostAtomicCapabilities(capabilities, operations, count, dev) + + +cdef CUresult cuCtxGetDevice_v2(CUdevice* device, CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuCtxGetDevice_v2(device, ctx) + + +cdef CUresult cuCtxSynchronize_v2(CUcontext ctx) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuCtxSynchronize_v2(ctx) + + +cdef CUresult cuMemcpyBatchAsync(CUdeviceptr* dsts, CUdeviceptr* srcs, size_t* sizes, size_t count, CUmemcpyAttributes* attrs, size_t* attrsIdxs, size_t numAttrs, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemcpyBatchAsync_v2(dsts, srcs, sizes, count, attrs, attrsIdxs, numAttrs, hStream) + + +cdef CUresult cuMemcpy3DBatchAsync(size_t numOps, CUDA_MEMCPY3D_BATCH_OP* opList, unsigned long long flags, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemcpy3DBatchAsync_v2(numOps, opList, flags, hStream) + + +cdef CUresult cuMemGetDefaultMemPool(CUmemoryPool* pool_out, CUmemLocation* location, CUmemAllocationType type) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemGetDefaultMemPool(pool_out, location, type) + + +cdef CUresult cuMemGetMemPool(CUmemoryPool* pool, CUmemLocation* location, CUmemAllocationType type) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemGetMemPool(pool, location, type) + + +cdef CUresult cuMemSetMemPool(CUmemLocation* location, CUmemAllocationType type, CUmemoryPool pool) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemSetMemPool(location, type, pool) + + +cdef CUresult cuMemPrefetchBatchAsync(CUdeviceptr* dptrs, size_t* sizes, size_t count, CUmemLocation* prefetchLocs, size_t* prefetchLocIdxs, size_t numPrefetchLocs, unsigned long long flags, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemPrefetchBatchAsync(dptrs, sizes, count, prefetchLocs, prefetchLocIdxs, numPrefetchLocs, flags, hStream) + + +cdef CUresult cuMemDiscardBatchAsync(CUdeviceptr* dptrs, size_t* sizes, size_t count, unsigned long long flags, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemDiscardBatchAsync(dptrs, sizes, count, flags, hStream) + + +cdef CUresult cuMemDiscardAndPrefetchBatchAsync(CUdeviceptr* dptrs, size_t* sizes, size_t count, CUmemLocation* prefetchLocs, size_t* prefetchLocIdxs, size_t numPrefetchLocs, unsigned long long flags, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemDiscardAndPrefetchBatchAsync(dptrs, sizes, count, prefetchLocs, prefetchLocIdxs, numPrefetchLocs, flags, hStream) + + +cdef CUresult cuDeviceGetP2PAtomicCapabilities(unsigned int* capabilities, const CUatomicOperation* operations, unsigned int count, CUdevice srcDevice, CUdevice dstDevice) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuDeviceGetP2PAtomicCapabilities(capabilities, operations, count, srcDevice, dstDevice) + + +cdef CUresult cuGreenCtxGetId(CUgreenCtx greenCtx, unsigned long long* greenCtxId) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGreenCtxGetId(greenCtx, greenCtxId) + + +cdef CUresult cuMulticastBindMem_v2(CUmemGenericAllocationHandle mcHandle, CUdevice dev, size_t mcOffset, CUmemGenericAllocationHandle memHandle, size_t memOffset, size_t size, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMulticastBindMem_v2(mcHandle, dev, mcOffset, memHandle, memOffset, size, flags) + + +cdef CUresult cuMulticastBindAddr_v2(CUmemGenericAllocationHandle mcHandle, CUdevice dev, size_t mcOffset, CUdeviceptr memptr, size_t size, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMulticastBindAddr_v2(mcHandle, dev, mcOffset, memptr, size, flags) + + +cdef CUresult cuGraphNodeGetContainingGraph(CUgraphNode hNode, CUgraph* phGraph) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphNodeGetContainingGraph(hNode, phGraph) + + +cdef CUresult cuGraphNodeGetLocalId(CUgraphNode hNode, unsigned int* nodeId) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphNodeGetLocalId(hNode, nodeId) + + +cdef CUresult cuGraphNodeGetToolsId(CUgraphNode hNode, unsigned long long* toolsNodeId) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphNodeGetToolsId(hNode, toolsNodeId) + + +cdef CUresult cuGraphGetId(CUgraph hGraph, unsigned int* graphId) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphGetId(hGraph, graphId) + + +cdef CUresult cuGraphExecGetId(CUgraphExec hGraphExec, unsigned int* graphId) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphExecGetId(hGraphExec, graphId) + + +cdef CUresult cuDevSmResourceSplit(CUdevResource* result, unsigned int nbGroups, const CUdevResource* input, CUdevResource* remainder, unsigned int flags, CU_DEV_SM_RESOURCE_GROUP_PARAMS* groupParams) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuDevSmResourceSplit(result, nbGroups, input, remainder, flags, groupParams) + + +cdef CUresult cuStreamGetDevResource(CUstream hStream, CUdevResource* resource, CUdevResourceType type) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuStreamGetDevResource(hStream, resource, type) + + +cdef CUresult cuKernelGetParamCount(CUkernel kernel, size_t* paramCount) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuKernelGetParamCount(kernel, paramCount) + + +cdef CUresult cuMemcpyWithAttributesAsync(CUdeviceptr dst, CUdeviceptr src, size_t size, CUmemcpyAttributes* attr, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemcpyWithAttributesAsync(dst, src, size, attr, hStream) + + +cdef CUresult cuMemcpy3DWithAttributesAsync(CUDA_MEMCPY3D_BATCH_OP* op, unsigned long long flags, CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuMemcpy3DWithAttributesAsync(op, flags, hStream) + + +cdef CUresult cuStreamBeginCaptureToCig(CUstream hStream, CUstreamCigCaptureParams* streamCigCaptureParams) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuStreamBeginCaptureToCig(hStream, streamCigCaptureParams) + + +cdef CUresult cuStreamEndCaptureToCig(CUstream hStream) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuStreamEndCaptureToCig(hStream) + + +cdef CUresult cuFuncGetParamCount(CUfunction func, size_t* paramCount) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuFuncGetParamCount(func, paramCount) + + +cdef CUresult cuLaunchHostFunc_v2(CUstream hStream, CUhostFn fn, void* userData, unsigned int syncMode) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuLaunchHostFunc_v2(hStream, fn, userData, syncMode) + + +cdef CUresult cuGraphNodeGetParams(CUgraphNode hNode, CUgraphNodeParams* nodeParams) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuGraphNodeGetParams(hNode, nodeParams) + + +cdef CUresult cuCoredumpRegisterStartCallback(CUcoredumpStatusCallback callback, void* userData, CUcoredumpCallbackHandle* callbackOut) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuCoredumpRegisterStartCallback(callback, userData, callbackOut) + + +cdef CUresult cuCoredumpRegisterCompleteCallback(CUcoredumpStatusCallback callback, void* userData, CUcoredumpCallbackHandle* callbackOut) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuCoredumpRegisterCompleteCallback(callback, userData, callbackOut) + + +cdef CUresult cuCoredumpDeregisterStartCallback(CUcoredumpCallbackHandle callback) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuCoredumpDeregisterStartCallback(callback) + + +cdef CUresult cuCoredumpDeregisterCompleteCallback(CUcoredumpCallbackHandle callback) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuCoredumpDeregisterCompleteCallback(callback) + + +cdef CUresult cuLogicalEndpointIdReserve(CUlogicalEndpointId* baseLeId, cuuint32_t count) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuLogicalEndpointIdReserve(baseLeId, count) + + +cdef CUresult cuLogicalEndpointIdRelease(CUlogicalEndpointId baseLeId, cuuint32_t count) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuLogicalEndpointIdRelease(baseLeId, count) + + +cdef CUresult cuLogicalEndpointCreate(CUlogicalEndpointId leId, const CUlogicalEndpointProp* prop) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuLogicalEndpointCreate(leId, prop) + + +cdef CUresult cuLogicalEndpointAddDevice(CUlogicalEndpointId leId, CUdevice dev) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuLogicalEndpointAddDevice(leId, dev) + + +cdef CUresult cuLogicalEndpointDestroy(CUlogicalEndpointId leId) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuLogicalEndpointDestroy(leId) + + +cdef CUresult cuLogicalEndpointBindAddr(CUlogicalEndpointId leId, CUdevice dev, cuuint64_t offset, void* ptr, cuuint64_t size, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuLogicalEndpointBindAddr(leId, dev, offset, ptr, size, flags) + + +cdef CUresult cuLogicalEndpointBindMem(CUlogicalEndpointId leId, CUdevice dev, cuuint64_t offset, CUmemGenericAllocationHandle memHandle, cuuint64_t memOffset, cuuint64_t size, unsigned long long flags) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuLogicalEndpointBindMem(leId, dev, offset, memHandle, memOffset, size, flags) + + +cdef CUresult cuLogicalEndpointUnbind(CUlogicalEndpointId leId, CUdevice dev, cuuint64_t offset, cuuint64_t size) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuLogicalEndpointUnbind(leId, dev, offset, size) + + +cdef CUresult cuLogicalEndpointExport(void* handle, CUlogicalEndpointId leId, CUlogicalEndpointIpcHandleType handleType) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuLogicalEndpointExport(handle, leId, handleType) + + +cdef CUresult cuLogicalEndpointImport(CUlogicalEndpointId leId, const void* handle, CUlogicalEndpointIpcHandleType handleType) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuLogicalEndpointImport(leId, handle, handleType) + + +cdef CUresult cuLogicalEndpointGetLimits(cuuint64_t* bindAlignment, cuuint64_t* maxSize, const CUlogicalEndpointProp* prop) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuLogicalEndpointGetLimits(bindAlignment, maxSize, prop) + + +cdef CUresult cuLogicalEndpointQuery(CUlogicalEndpointId leId, cuuint32_t count, int* queryStatus) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuLogicalEndpointQuery(leId, count, queryStatus) + + +cdef CUresult cuStreamBeginRecaptureToGraph(CUstream hStream, CUstreamCaptureMode mode, CUgraph hGraph, CUgraphRecaptureCallback callbackFunc, void* userData) except ?CUDA_ERROR_NOT_FOUND nogil: + return _driver._cuStreamBeginRecaptureToGraph(hStream, mode, hGraph, callbackFunc, userData) diff --git a/cuda_bindings/cuda/bindings/cynvfatbin.pxd b/cuda_bindings/cuda/bindings/cynvfatbin.pxd new file mode 100644 index 00000000000..ef8951fbcc3 --- /dev/null +++ b/cuda_bindings/cuda/bindings/cynvfatbin.pxd @@ -0,0 +1,57 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +# This code was automatically generated across versions from 12.4.1 to 13.3.0. Do not modify it directly. + +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=fede358631d711050e04c9b0f7582773ba7012844987bc47358f1378d484a136 +from libc.stdint cimport intptr_t, uint32_t + + +############################################################################### +# Types (structs, enums, ...) +############################################################################### + +# enums +ctypedef enum nvFatbinResult "nvFatbinResult": + NVFATBIN_SUCCESS "NVFATBIN_SUCCESS" = 0 + NVFATBIN_ERROR_INTERNAL "NVFATBIN_ERROR_INTERNAL" + NVFATBIN_ERROR_ELF_ARCH_MISMATCH "NVFATBIN_ERROR_ELF_ARCH_MISMATCH" + NVFATBIN_ERROR_ELF_SIZE_MISMATCH "NVFATBIN_ERROR_ELF_SIZE_MISMATCH" + NVFATBIN_ERROR_MISSING_PTX_VERSION "NVFATBIN_ERROR_MISSING_PTX_VERSION" + NVFATBIN_ERROR_NULL_POINTER "NVFATBIN_ERROR_NULL_POINTER" + NVFATBIN_ERROR_COMPRESSION_FAILED "NVFATBIN_ERROR_COMPRESSION_FAILED" + NVFATBIN_ERROR_COMPRESSED_SIZE_EXCEEDED "NVFATBIN_ERROR_COMPRESSED_SIZE_EXCEEDED" + NVFATBIN_ERROR_UNRECOGNIZED_OPTION "NVFATBIN_ERROR_UNRECOGNIZED_OPTION" + NVFATBIN_ERROR_INVALID_ARCH "NVFATBIN_ERROR_INVALID_ARCH" + NVFATBIN_ERROR_INVALID_NVVM "NVFATBIN_ERROR_INVALID_NVVM" + NVFATBIN_ERROR_EMPTY_INPUT "NVFATBIN_ERROR_EMPTY_INPUT" + NVFATBIN_ERROR_MISSING_PTX_ARCH "NVFATBIN_ERROR_MISSING_PTX_ARCH" + NVFATBIN_ERROR_PTX_ARCH_MISMATCH "NVFATBIN_ERROR_PTX_ARCH_MISMATCH" + NVFATBIN_ERROR_MISSING_FATBIN "NVFATBIN_ERROR_MISSING_FATBIN" + NVFATBIN_ERROR_INVALID_INDEX "NVFATBIN_ERROR_INVALID_INDEX" + NVFATBIN_ERROR_IDENTIFIER_REUSE "NVFATBIN_ERROR_IDENTIFIER_REUSE" + NVFATBIN_ERROR_INTERNAL_PTX_OPTION "NVFATBIN_ERROR_INTERNAL_PTX_OPTION" + _NVFATBINRESULT_INTERNAL_LOADING_ERROR "_NVFATBINRESULT_INTERNAL_LOADING_ERROR" = -42 + + +# types +ctypedef void* nvFatbinHandle 'nvFatbinHandle' + + +############################################################################### +# Functions +############################################################################### + +cdef const char* nvFatbinGetErrorString(nvFatbinResult result) except?NULL nogil +cdef nvFatbinResult nvFatbinCreate(nvFatbinHandle* handle_indirect, const char** options, size_t optionsCount) except?_NVFATBINRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvFatbinResult nvFatbinDestroy(nvFatbinHandle* handle_indirect) except?_NVFATBINRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvFatbinResult nvFatbinAddPTX(nvFatbinHandle handle, const char* code, size_t size, const char* arch, const char* identifier, const char* optionsCmdLine) except?_NVFATBINRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvFatbinResult nvFatbinAddCubin(nvFatbinHandle handle, const void* code, size_t size, const char* arch, const char* identifier) except?_NVFATBINRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvFatbinResult nvFatbinAddLTOIR(nvFatbinHandle handle, const void* code, size_t size, const char* arch, const char* identifier, const char* optionsCmdLine) except?_NVFATBINRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvFatbinResult nvFatbinSize(nvFatbinHandle handle, size_t* size) except?_NVFATBINRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvFatbinResult nvFatbinGet(nvFatbinHandle handle, void* buffer) except?_NVFATBINRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvFatbinResult nvFatbinVersion(unsigned int* major, unsigned int* minor) except?_NVFATBINRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvFatbinResult nvFatbinAddIndex(nvFatbinHandle handle, const void* code, size_t size, const char* identifier) except?_NVFATBINRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvFatbinResult nvFatbinAddReloc(nvFatbinHandle handle, const void* code, size_t size) except?_NVFATBINRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvFatbinResult nvFatbinAddTileIR(nvFatbinHandle handle, const void* code, size_t size, const char* identifier, const char* optionsCmdLine) except?_NVFATBINRESULT_INTERNAL_LOADING_ERROR nogil diff --git a/cuda_bindings/cuda/bindings/cynvfatbin.pyx b/cuda_bindings/cuda/bindings/cynvfatbin.pyx new file mode 100644 index 00000000000..86bdd89f0f3 --- /dev/null +++ b/cuda_bindings/cuda/bindings/cynvfatbin.pyx @@ -0,0 +1,60 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +# This code was automatically generated across versions from 12.4.1 to 13.3.0. Do not modify it directly. + +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=bae30bbdaff2009b86c05de2a46bbaecad9e63327c93a10b6f2e8a2d95fd6a60 +from ._internal cimport nvfatbin as _nvfatbin + + +############################################################################### +# Wrapper functions +############################################################################### + +cdef const char* nvFatbinGetErrorString(nvFatbinResult result) except?NULL nogil: + return _nvfatbin._nvFatbinGetErrorString(result) + + +cdef nvFatbinResult nvFatbinCreate(nvFatbinHandle* handle_indirect, const char** options, size_t optionsCount) except?_NVFATBINRESULT_INTERNAL_LOADING_ERROR nogil: + return _nvfatbin._nvFatbinCreate(handle_indirect, options, optionsCount) + + +cdef nvFatbinResult nvFatbinDestroy(nvFatbinHandle* handle_indirect) except?_NVFATBINRESULT_INTERNAL_LOADING_ERROR nogil: + return _nvfatbin._nvFatbinDestroy(handle_indirect) + + +cdef nvFatbinResult nvFatbinAddPTX(nvFatbinHandle handle, const char* code, size_t size, const char* arch, const char* identifier, const char* optionsCmdLine) except?_NVFATBINRESULT_INTERNAL_LOADING_ERROR nogil: + return _nvfatbin._nvFatbinAddPTX(handle, code, size, arch, identifier, optionsCmdLine) + + +cdef nvFatbinResult nvFatbinAddCubin(nvFatbinHandle handle, const void* code, size_t size, const char* arch, const char* identifier) except?_NVFATBINRESULT_INTERNAL_LOADING_ERROR nogil: + return _nvfatbin._nvFatbinAddCubin(handle, code, size, arch, identifier) + + +cdef nvFatbinResult nvFatbinAddLTOIR(nvFatbinHandle handle, const void* code, size_t size, const char* arch, const char* identifier, const char* optionsCmdLine) except?_NVFATBINRESULT_INTERNAL_LOADING_ERROR nogil: + return _nvfatbin._nvFatbinAddLTOIR(handle, code, size, arch, identifier, optionsCmdLine) + + +cdef nvFatbinResult nvFatbinSize(nvFatbinHandle handle, size_t* size) except?_NVFATBINRESULT_INTERNAL_LOADING_ERROR nogil: + return _nvfatbin._nvFatbinSize(handle, size) + + +cdef nvFatbinResult nvFatbinGet(nvFatbinHandle handle, void* buffer) except?_NVFATBINRESULT_INTERNAL_LOADING_ERROR nogil: + return _nvfatbin._nvFatbinGet(handle, buffer) + + +cdef nvFatbinResult nvFatbinVersion(unsigned int* major, unsigned int* minor) except?_NVFATBINRESULT_INTERNAL_LOADING_ERROR nogil: + return _nvfatbin._nvFatbinVersion(major, minor) + + +cdef nvFatbinResult nvFatbinAddIndex(nvFatbinHandle handle, const void* code, size_t size, const char* identifier) except?_NVFATBINRESULT_INTERNAL_LOADING_ERROR nogil: + return _nvfatbin._nvFatbinAddIndex(handle, code, size, identifier) + + +cdef nvFatbinResult nvFatbinAddReloc(nvFatbinHandle handle, const void* code, size_t size) except?_NVFATBINRESULT_INTERNAL_LOADING_ERROR nogil: + return _nvfatbin._nvFatbinAddReloc(handle, code, size) + + +cdef nvFatbinResult nvFatbinAddTileIR(nvFatbinHandle handle, const void* code, size_t size, const char* identifier, const char* optionsCmdLine) except?_NVFATBINRESULT_INTERNAL_LOADING_ERROR nogil: + return _nvfatbin._nvFatbinAddTileIR(handle, code, size, identifier, optionsCmdLine) diff --git a/cuda_bindings/cuda/bindings/cynvjitlink.pxd b/cuda_bindings/cuda/bindings/cynvjitlink.pxd new file mode 100644 index 00000000000..ff80a17c5ab --- /dev/null +++ b/cuda_bindings/cuda/bindings/cynvjitlink.pxd @@ -0,0 +1,73 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +# This code was automatically generated across versions from 12.0.1 to 13.3.0. Do not modify it directly. + +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=58778b073e81f54fcf5c42775b45944d22b6e944fe6965b42d83898239f1e1b6 +from libc.stdint cimport intptr_t, uint32_t + + +############################################################################### +# Types (structs, enums, ...) +############################################################################### + +# enums +ctypedef enum nvJitLinkResult "nvJitLinkResult": + NVJITLINK_SUCCESS "NVJITLINK_SUCCESS" = 0 + NVJITLINK_ERROR_UNRECOGNIZED_OPTION "NVJITLINK_ERROR_UNRECOGNIZED_OPTION" + NVJITLINK_ERROR_MISSING_ARCH "NVJITLINK_ERROR_MISSING_ARCH" + NVJITLINK_ERROR_INVALID_INPUT "NVJITLINK_ERROR_INVALID_INPUT" + NVJITLINK_ERROR_PTX_COMPILE "NVJITLINK_ERROR_PTX_COMPILE" + NVJITLINK_ERROR_NVVM_COMPILE "NVJITLINK_ERROR_NVVM_COMPILE" + NVJITLINK_ERROR_INTERNAL "NVJITLINK_ERROR_INTERNAL" + NVJITLINK_ERROR_THREADPOOL "NVJITLINK_ERROR_THREADPOOL" + NVJITLINK_ERROR_UNRECOGNIZED_INPUT "NVJITLINK_ERROR_UNRECOGNIZED_INPUT" + NVJITLINK_ERROR_FINALIZE "NVJITLINK_ERROR_FINALIZE" + NVJITLINK_ERROR_NULL_INPUT "NVJITLINK_ERROR_NULL_INPUT" + NVJITLINK_ERROR_INCOMPATIBLE_OPTIONS "NVJITLINK_ERROR_INCOMPATIBLE_OPTIONS" + NVJITLINK_ERROR_INCORRECT_INPUT_TYPE "NVJITLINK_ERROR_INCORRECT_INPUT_TYPE" + NVJITLINK_ERROR_ARCH_MISMATCH "NVJITLINK_ERROR_ARCH_MISMATCH" + NVJITLINK_ERROR_OUTDATED_LIBRARY "NVJITLINK_ERROR_OUTDATED_LIBRARY" + NVJITLINK_ERROR_MISSING_FATBIN "NVJITLINK_ERROR_MISSING_FATBIN" + NVJITLINK_ERROR_UNRECOGNIZED_ARCH "NVJITLINK_ERROR_UNRECOGNIZED_ARCH" + NVJITLINK_ERROR_UNSUPPORTED_ARCH "NVJITLINK_ERROR_UNSUPPORTED_ARCH" + NVJITLINK_ERROR_LTO_NOT_ENABLED "NVJITLINK_ERROR_LTO_NOT_ENABLED" + _NVJITLINKRESULT_INTERNAL_LOADING_ERROR "_NVJITLINKRESULT_INTERNAL_LOADING_ERROR" = -42 + +ctypedef enum nvJitLinkInputType "nvJitLinkInputType": + NVJITLINK_INPUT_NONE "NVJITLINK_INPUT_NONE" = 0 + NVJITLINK_INPUT_CUBIN "NVJITLINK_INPUT_CUBIN" = 1 + NVJITLINK_INPUT_PTX "NVJITLINK_INPUT_PTX" + NVJITLINK_INPUT_LTOIR "NVJITLINK_INPUT_LTOIR" + NVJITLINK_INPUT_FATBIN "NVJITLINK_INPUT_FATBIN" + NVJITLINK_INPUT_OBJECT "NVJITLINK_INPUT_OBJECT" + NVJITLINK_INPUT_LIBRARY "NVJITLINK_INPUT_LIBRARY" + NVJITLINK_INPUT_INDEX "NVJITLINK_INPUT_INDEX" + NVJITLINK_INPUT_ANY "NVJITLINK_INPUT_ANY" = 10 + + +# types +ctypedef void* nvJitLinkHandle 'nvJitLinkHandle' + + +############################################################################### +# Functions +############################################################################### + +cdef nvJitLinkResult nvJitLinkCreate(nvJitLinkHandle* handle, uint32_t numOptions, const char** options) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvJitLinkResult nvJitLinkDestroy(nvJitLinkHandle* handle) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvJitLinkResult nvJitLinkAddData(nvJitLinkHandle handle, nvJitLinkInputType inputType, const void* data, size_t size, const char* name) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvJitLinkResult nvJitLinkAddFile(nvJitLinkHandle handle, nvJitLinkInputType inputType, const char* fileName) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvJitLinkResult nvJitLinkComplete(nvJitLinkHandle handle) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvJitLinkResult nvJitLinkGetLinkedCubinSize(nvJitLinkHandle handle, size_t* size) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvJitLinkResult nvJitLinkGetLinkedCubin(nvJitLinkHandle handle, void* cubin) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvJitLinkResult nvJitLinkGetLinkedPtxSize(nvJitLinkHandle handle, size_t* size) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvJitLinkResult nvJitLinkGetLinkedPtx(nvJitLinkHandle handle, char* ptx) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvJitLinkResult nvJitLinkGetErrorLogSize(nvJitLinkHandle handle, size_t* size) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvJitLinkResult nvJitLinkGetErrorLog(nvJitLinkHandle handle, char* log) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvJitLinkResult nvJitLinkGetInfoLogSize(nvJitLinkHandle handle, size_t* size) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvJitLinkResult nvJitLinkGetInfoLog(nvJitLinkHandle handle, char* log) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvJitLinkResult nvJitLinkVersion(unsigned int* major, unsigned int* minor) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvJitLinkResult nvJitLinkGetLinkedLTOIRSize(nvJitLinkHandle handle, size_t* size) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvJitLinkResult nvJitLinkGetLinkedLTOIR(nvJitLinkHandle handle, void* ltoir) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil diff --git a/cuda_bindings/cuda/bindings/cynvjitlink.pyx b/cuda_bindings/cuda/bindings/cynvjitlink.pyx new file mode 100644 index 00000000000..cf4ee0332a0 --- /dev/null +++ b/cuda_bindings/cuda/bindings/cynvjitlink.pyx @@ -0,0 +1,76 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +# This code was automatically generated across versions from 12.0.1 to 13.3.0. Do not modify it directly. + +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=e507515291c3bc20b88d0b58ab5b01a1cc38c5d21bca87a4f379cc846b869ed4 +from ._internal cimport nvjitlink as _nvjitlink + + +############################################################################### +# Wrapper functions +############################################################################### + +cdef nvJitLinkResult nvJitLinkCreate(nvJitLinkHandle* handle, uint32_t numOptions, const char** options) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil: + return _nvjitlink._nvJitLinkCreate(handle, numOptions, options) + + +cdef nvJitLinkResult nvJitLinkDestroy(nvJitLinkHandle* handle) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil: + return _nvjitlink._nvJitLinkDestroy(handle) + + +cdef nvJitLinkResult nvJitLinkAddData(nvJitLinkHandle handle, nvJitLinkInputType inputType, const void* data, size_t size, const char* name) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil: + return _nvjitlink._nvJitLinkAddData(handle, inputType, data, size, name) + + +cdef nvJitLinkResult nvJitLinkAddFile(nvJitLinkHandle handle, nvJitLinkInputType inputType, const char* fileName) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil: + return _nvjitlink._nvJitLinkAddFile(handle, inputType, fileName) + + +cdef nvJitLinkResult nvJitLinkComplete(nvJitLinkHandle handle) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil: + return _nvjitlink._nvJitLinkComplete(handle) + + +cdef nvJitLinkResult nvJitLinkGetLinkedCubinSize(nvJitLinkHandle handle, size_t* size) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil: + return _nvjitlink._nvJitLinkGetLinkedCubinSize(handle, size) + + +cdef nvJitLinkResult nvJitLinkGetLinkedCubin(nvJitLinkHandle handle, void* cubin) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil: + return _nvjitlink._nvJitLinkGetLinkedCubin(handle, cubin) + + +cdef nvJitLinkResult nvJitLinkGetLinkedPtxSize(nvJitLinkHandle handle, size_t* size) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil: + return _nvjitlink._nvJitLinkGetLinkedPtxSize(handle, size) + + +cdef nvJitLinkResult nvJitLinkGetLinkedPtx(nvJitLinkHandle handle, char* ptx) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil: + return _nvjitlink._nvJitLinkGetLinkedPtx(handle, ptx) + + +cdef nvJitLinkResult nvJitLinkGetErrorLogSize(nvJitLinkHandle handle, size_t* size) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil: + return _nvjitlink._nvJitLinkGetErrorLogSize(handle, size) + + +cdef nvJitLinkResult nvJitLinkGetErrorLog(nvJitLinkHandle handle, char* log) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil: + return _nvjitlink._nvJitLinkGetErrorLog(handle, log) + + +cdef nvJitLinkResult nvJitLinkGetInfoLogSize(nvJitLinkHandle handle, size_t* size) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil: + return _nvjitlink._nvJitLinkGetInfoLogSize(handle, size) + + +cdef nvJitLinkResult nvJitLinkGetInfoLog(nvJitLinkHandle handle, char* log) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil: + return _nvjitlink._nvJitLinkGetInfoLog(handle, log) + + +cdef nvJitLinkResult nvJitLinkVersion(unsigned int* major, unsigned int* minor) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil: + return _nvjitlink._nvJitLinkVersion(major, minor) + + +cdef nvJitLinkResult nvJitLinkGetLinkedLTOIRSize(nvJitLinkHandle handle, size_t* size) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil: + return _nvjitlink._nvJitLinkGetLinkedLTOIRSize(handle, size) + + +cdef nvJitLinkResult nvJitLinkGetLinkedLTOIR(nvJitLinkHandle handle, void* ltoir) except?_NVJITLINKRESULT_INTERNAL_LOADING_ERROR nogil: + return _nvjitlink._nvJitLinkGetLinkedLTOIR(handle, ltoir) diff --git a/cuda_bindings/cuda/bindings/cynvml.pxd b/cuda_bindings/cuda/bindings/cynvml.pxd new file mode 100644 index 00000000000..61ac3fa0da7 --- /dev/null +++ b/cuda_bindings/cuda/bindings/cynvml.pxd @@ -0,0 +1,2359 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +# This code was automatically generated across versions from 12.9.1 to 13.3.0. Do not modify it directly. + +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=5e55307c8ff89e076c29fc7c2a36bf0af7ecf3162693a4c94d7fca65454d6a9e +from libc.stdint cimport int64_t + + +############################################################################### +# Types (structs, enums, ...) +############################################################################### + +# enums +ctypedef enum nvmlBridgeChipType_t "nvmlBridgeChipType_t": + NVML_BRIDGE_CHIP_PLX "NVML_BRIDGE_CHIP_PLX" = 0 + NVML_BRIDGE_CHIP_BRO4 "NVML_BRIDGE_CHIP_BRO4" = 1 + +ctypedef enum nvmlNvLinkUtilizationCountUnits_t "nvmlNvLinkUtilizationCountUnits_t": + NVML_NVLINK_COUNTER_UNIT_CYCLES "NVML_NVLINK_COUNTER_UNIT_CYCLES" = 0 + NVML_NVLINK_COUNTER_UNIT_PACKETS "NVML_NVLINK_COUNTER_UNIT_PACKETS" = 1 + NVML_NVLINK_COUNTER_UNIT_BYTES "NVML_NVLINK_COUNTER_UNIT_BYTES" = 2 + NVML_NVLINK_COUNTER_UNIT_RESERVED "NVML_NVLINK_COUNTER_UNIT_RESERVED" = 3 + NVML_NVLINK_COUNTER_UNIT_COUNT "NVML_NVLINK_COUNTER_UNIT_COUNT" + +ctypedef enum nvmlNvLinkUtilizationCountPktTypes_t "nvmlNvLinkUtilizationCountPktTypes_t": + NVML_NVLINK_COUNTER_PKTFILTER_NOP "NVML_NVLINK_COUNTER_PKTFILTER_NOP" = 0x1 + NVML_NVLINK_COUNTER_PKTFILTER_READ "NVML_NVLINK_COUNTER_PKTFILTER_READ" = 0x2 + NVML_NVLINK_COUNTER_PKTFILTER_WRITE "NVML_NVLINK_COUNTER_PKTFILTER_WRITE" = 0x4 + NVML_NVLINK_COUNTER_PKTFILTER_RATOM "NVML_NVLINK_COUNTER_PKTFILTER_RATOM" = 0x8 + NVML_NVLINK_COUNTER_PKTFILTER_NRATOM "NVML_NVLINK_COUNTER_PKTFILTER_NRATOM" = 0x10 + NVML_NVLINK_COUNTER_PKTFILTER_FLUSH "NVML_NVLINK_COUNTER_PKTFILTER_FLUSH" = 0x20 + NVML_NVLINK_COUNTER_PKTFILTER_RESPDATA "NVML_NVLINK_COUNTER_PKTFILTER_RESPDATA" = 0x40 + NVML_NVLINK_COUNTER_PKTFILTER_RESPNODATA "NVML_NVLINK_COUNTER_PKTFILTER_RESPNODATA" = 0x80 + NVML_NVLINK_COUNTER_PKTFILTER_ALL "NVML_NVLINK_COUNTER_PKTFILTER_ALL" = 0xFF + +ctypedef enum nvmlNvLinkCapability_t "nvmlNvLinkCapability_t": + NVML_NVLINK_CAP_P2P_SUPPORTED "NVML_NVLINK_CAP_P2P_SUPPORTED" = 0 + NVML_NVLINK_CAP_SYSMEM_ACCESS "NVML_NVLINK_CAP_SYSMEM_ACCESS" = 1 + NVML_NVLINK_CAP_P2P_ATOMICS "NVML_NVLINK_CAP_P2P_ATOMICS" = 2 + NVML_NVLINK_CAP_SYSMEM_ATOMICS "NVML_NVLINK_CAP_SYSMEM_ATOMICS" = 3 + NVML_NVLINK_CAP_SLI_BRIDGE "NVML_NVLINK_CAP_SLI_BRIDGE" = 4 + NVML_NVLINK_CAP_VALID "NVML_NVLINK_CAP_VALID" = 5 + NVML_NVLINK_CAP_COUNT "NVML_NVLINK_CAP_COUNT" + +ctypedef enum nvmlNvLinkErrorCounter_t "nvmlNvLinkErrorCounter_t": + NVML_NVLINK_ERROR_DL_REPLAY "NVML_NVLINK_ERROR_DL_REPLAY" = 0 + NVML_NVLINK_ERROR_DL_RECOVERY "NVML_NVLINK_ERROR_DL_RECOVERY" = 1 + NVML_NVLINK_ERROR_DL_CRC_FLIT "NVML_NVLINK_ERROR_DL_CRC_FLIT" = 2 + NVML_NVLINK_ERROR_DL_CRC_DATA "NVML_NVLINK_ERROR_DL_CRC_DATA" = 3 + NVML_NVLINK_ERROR_DL_ECC_DATA "NVML_NVLINK_ERROR_DL_ECC_DATA" = 4 + NVML_NVLINK_ERROR_COUNT "NVML_NVLINK_ERROR_COUNT" + +ctypedef enum nvmlIntNvLinkDeviceType_t "nvmlIntNvLinkDeviceType_t": + NVML_NVLINK_DEVICE_TYPE_GPU "NVML_NVLINK_DEVICE_TYPE_GPU" = 0x00 + NVML_NVLINK_DEVICE_TYPE_IBMNPU "NVML_NVLINK_DEVICE_TYPE_IBMNPU" = 0x01 + NVML_NVLINK_DEVICE_TYPE_SWITCH "NVML_NVLINK_DEVICE_TYPE_SWITCH" = 0x02 + NVML_NVLINK_DEVICE_TYPE_UNKNOWN "NVML_NVLINK_DEVICE_TYPE_UNKNOWN" = 0xFF + +ctypedef enum nvmlGpuTopologyLevel_t "nvmlGpuTopologyLevel_t": + NVML_TOPOLOGY_INTERNAL "NVML_TOPOLOGY_INTERNAL" = 0 + NVML_TOPOLOGY_SINGLE "NVML_TOPOLOGY_SINGLE" = 10 + NVML_TOPOLOGY_MULTIPLE "NVML_TOPOLOGY_MULTIPLE" = 20 + NVML_TOPOLOGY_HOSTBRIDGE "NVML_TOPOLOGY_HOSTBRIDGE" = 30 + NVML_TOPOLOGY_NODE "NVML_TOPOLOGY_NODE" = 40 + NVML_TOPOLOGY_SYSTEM "NVML_TOPOLOGY_SYSTEM" = 50 + +ctypedef enum nvmlGpuP2PStatus_t "nvmlGpuP2PStatus_t": + NVML_P2P_STATUS_OK "NVML_P2P_STATUS_OK" = 0 + NVML_P2P_STATUS_CHIPSET_NOT_SUPPORED "NVML_P2P_STATUS_CHIPSET_NOT_SUPPORED" + NVML_P2P_STATUS_CHIPSET_NOT_SUPPORTED "NVML_P2P_STATUS_CHIPSET_NOT_SUPPORTED" = NVML_P2P_STATUS_CHIPSET_NOT_SUPPORED + NVML_P2P_STATUS_GPU_NOT_SUPPORTED "NVML_P2P_STATUS_GPU_NOT_SUPPORTED" + NVML_P2P_STATUS_IOH_TOPOLOGY_NOT_SUPPORTED "NVML_P2P_STATUS_IOH_TOPOLOGY_NOT_SUPPORTED" + NVML_P2P_STATUS_DISABLED_BY_REGKEY "NVML_P2P_STATUS_DISABLED_BY_REGKEY" + NVML_P2P_STATUS_NOT_SUPPORTED "NVML_P2P_STATUS_NOT_SUPPORTED" + NVML_P2P_STATUS_UNKNOWN "NVML_P2P_STATUS_UNKNOWN" + +ctypedef enum nvmlGpuP2PCapsIndex_t "nvmlGpuP2PCapsIndex_t": + NVML_P2P_CAPS_INDEX_READ "NVML_P2P_CAPS_INDEX_READ" = 0 + NVML_P2P_CAPS_INDEX_WRITE "NVML_P2P_CAPS_INDEX_WRITE" = 1 + NVML_P2P_CAPS_INDEX_NVLINK "NVML_P2P_CAPS_INDEX_NVLINK" = 2 + NVML_P2P_CAPS_INDEX_ATOMICS "NVML_P2P_CAPS_INDEX_ATOMICS" = 3 + NVML_P2P_CAPS_INDEX_PCI "NVML_P2P_CAPS_INDEX_PCI" = 4 + NVML_P2P_CAPS_INDEX_PROP "NVML_P2P_CAPS_INDEX_PROP" = NVML_P2P_CAPS_INDEX_PCI + NVML_P2P_CAPS_INDEX_UNKNOWN "NVML_P2P_CAPS_INDEX_UNKNOWN" = 5 + +ctypedef enum nvmlSamplingType_t "nvmlSamplingType_t": + NVML_TOTAL_POWER_SAMPLES "NVML_TOTAL_POWER_SAMPLES" = 0 + NVML_GPU_UTILIZATION_SAMPLES "NVML_GPU_UTILIZATION_SAMPLES" = 1 + NVML_MEMORY_UTILIZATION_SAMPLES "NVML_MEMORY_UTILIZATION_SAMPLES" = 2 + NVML_ENC_UTILIZATION_SAMPLES "NVML_ENC_UTILIZATION_SAMPLES" = 3 + NVML_DEC_UTILIZATION_SAMPLES "NVML_DEC_UTILIZATION_SAMPLES" = 4 + NVML_PROCESSOR_CLK_SAMPLES "NVML_PROCESSOR_CLK_SAMPLES" = 5 + NVML_MEMORY_CLK_SAMPLES "NVML_MEMORY_CLK_SAMPLES" = 6 + NVML_MODULE_POWER_SAMPLES "NVML_MODULE_POWER_SAMPLES" = 7 + NVML_JPG_UTILIZATION_SAMPLES "NVML_JPG_UTILIZATION_SAMPLES" = 8 + NVML_OFA_UTILIZATION_SAMPLES "NVML_OFA_UTILIZATION_SAMPLES" = 9 + NVML_SAMPLINGTYPE_COUNT "NVML_SAMPLINGTYPE_COUNT" + +ctypedef enum nvmlPcieUtilCounter_t "nvmlPcieUtilCounter_t": + NVML_PCIE_UTIL_TX_BYTES "NVML_PCIE_UTIL_TX_BYTES" = 0 + NVML_PCIE_UTIL_RX_BYTES "NVML_PCIE_UTIL_RX_BYTES" = 1 + NVML_PCIE_UTIL_COUNT "NVML_PCIE_UTIL_COUNT" + +ctypedef enum nvmlValueType_t "nvmlValueType_t": + NVML_VALUE_TYPE_DOUBLE "NVML_VALUE_TYPE_DOUBLE" = 0 + NVML_VALUE_TYPE_UNSIGNED_INT "NVML_VALUE_TYPE_UNSIGNED_INT" = 1 + NVML_VALUE_TYPE_UNSIGNED_LONG "NVML_VALUE_TYPE_UNSIGNED_LONG" = 2 + NVML_VALUE_TYPE_UNSIGNED_LONG_LONG "NVML_VALUE_TYPE_UNSIGNED_LONG_LONG" = 3 + NVML_VALUE_TYPE_SIGNED_LONG_LONG "NVML_VALUE_TYPE_SIGNED_LONG_LONG" = 4 + NVML_VALUE_TYPE_SIGNED_INT "NVML_VALUE_TYPE_SIGNED_INT" = 5 + NVML_VALUE_TYPE_UNSIGNED_SHORT "NVML_VALUE_TYPE_UNSIGNED_SHORT" = 6 + NVML_VALUE_TYPE_COUNT "NVML_VALUE_TYPE_COUNT" + +ctypedef enum nvmlPerfPolicyType_t "nvmlPerfPolicyType_t": + NVML_PERF_POLICY_POWER "NVML_PERF_POLICY_POWER" = 0 + NVML_PERF_POLICY_THERMAL "NVML_PERF_POLICY_THERMAL" = 1 + NVML_PERF_POLICY_SYNC_BOOST "NVML_PERF_POLICY_SYNC_BOOST" = 2 + NVML_PERF_POLICY_BOARD_LIMIT "NVML_PERF_POLICY_BOARD_LIMIT" = 3 + NVML_PERF_POLICY_LOW_UTILIZATION "NVML_PERF_POLICY_LOW_UTILIZATION" = 4 + NVML_PERF_POLICY_RELIABILITY "NVML_PERF_POLICY_RELIABILITY" = 5 + NVML_PERF_POLICY_TOTAL_APP_CLOCKS "NVML_PERF_POLICY_TOTAL_APP_CLOCKS" = 10 + NVML_PERF_POLICY_TOTAL_BASE_CLOCKS "NVML_PERF_POLICY_TOTAL_BASE_CLOCKS" = 11 + NVML_PERF_POLICY_COUNT "NVML_PERF_POLICY_COUNT" + +ctypedef enum nvmlThermalTarget_t "nvmlThermalTarget_t": + NVML_THERMAL_TARGET_NONE "NVML_THERMAL_TARGET_NONE" = 0 + NVML_THERMAL_TARGET_GPU "NVML_THERMAL_TARGET_GPU" = 1 + NVML_THERMAL_TARGET_MEMORY "NVML_THERMAL_TARGET_MEMORY" = 2 + NVML_THERMAL_TARGET_POWER_SUPPLY "NVML_THERMAL_TARGET_POWER_SUPPLY" = 4 + NVML_THERMAL_TARGET_BOARD "NVML_THERMAL_TARGET_BOARD" = 8 + NVML_THERMAL_TARGET_VCD_BOARD "NVML_THERMAL_TARGET_VCD_BOARD" = 9 + NVML_THERMAL_TARGET_VCD_INLET "NVML_THERMAL_TARGET_VCD_INLET" = 10 + NVML_THERMAL_TARGET_VCD_OUTLET "NVML_THERMAL_TARGET_VCD_OUTLET" = 11 + NVML_THERMAL_TARGET_ALL "NVML_THERMAL_TARGET_ALL" = 15 + NVML_THERMAL_TARGET_UNKNOWN "NVML_THERMAL_TARGET_UNKNOWN" = -(1) + +ctypedef enum nvmlThermalController_t "nvmlThermalController_t": + NVML_THERMAL_CONTROLLER_NONE "NVML_THERMAL_CONTROLLER_NONE" = 0 + NVML_THERMAL_CONTROLLER_GPU_INTERNAL "NVML_THERMAL_CONTROLLER_GPU_INTERNAL" + NVML_THERMAL_CONTROLLER_ADM1032 "NVML_THERMAL_CONTROLLER_ADM1032" + NVML_THERMAL_CONTROLLER_ADT7461 "NVML_THERMAL_CONTROLLER_ADT7461" + NVML_THERMAL_CONTROLLER_MAX6649 "NVML_THERMAL_CONTROLLER_MAX6649" + NVML_THERMAL_CONTROLLER_MAX1617 "NVML_THERMAL_CONTROLLER_MAX1617" + NVML_THERMAL_CONTROLLER_LM99 "NVML_THERMAL_CONTROLLER_LM99" + NVML_THERMAL_CONTROLLER_LM89 "NVML_THERMAL_CONTROLLER_LM89" + NVML_THERMAL_CONTROLLER_LM64 "NVML_THERMAL_CONTROLLER_LM64" + NVML_THERMAL_CONTROLLER_G781 "NVML_THERMAL_CONTROLLER_G781" + NVML_THERMAL_CONTROLLER_ADT7473 "NVML_THERMAL_CONTROLLER_ADT7473" + NVML_THERMAL_CONTROLLER_SBMAX6649 "NVML_THERMAL_CONTROLLER_SBMAX6649" + NVML_THERMAL_CONTROLLER_VBIOSEVT "NVML_THERMAL_CONTROLLER_VBIOSEVT" + NVML_THERMAL_CONTROLLER_OS "NVML_THERMAL_CONTROLLER_OS" + NVML_THERMAL_CONTROLLER_NVSYSCON_CANOAS "NVML_THERMAL_CONTROLLER_NVSYSCON_CANOAS" + NVML_THERMAL_CONTROLLER_NVSYSCON_E551 "NVML_THERMAL_CONTROLLER_NVSYSCON_E551" + NVML_THERMAL_CONTROLLER_MAX6649R "NVML_THERMAL_CONTROLLER_MAX6649R" + NVML_THERMAL_CONTROLLER_ADT7473S "NVML_THERMAL_CONTROLLER_ADT7473S" + NVML_THERMAL_CONTROLLER_UNKNOWN "NVML_THERMAL_CONTROLLER_UNKNOWN" = -(1) + +ctypedef enum nvmlCoolerControl_t "nvmlCoolerControl_t": + NVML_THERMAL_COOLER_SIGNAL_NONE "NVML_THERMAL_COOLER_SIGNAL_NONE" = 0 + NVML_THERMAL_COOLER_SIGNAL_TOGGLE "NVML_THERMAL_COOLER_SIGNAL_TOGGLE" = 1 + NVML_THERMAL_COOLER_SIGNAL_VARIABLE "NVML_THERMAL_COOLER_SIGNAL_VARIABLE" = 2 + NVML_THERMAL_COOLER_SIGNAL_COUNT "NVML_THERMAL_COOLER_SIGNAL_COUNT" + +ctypedef enum nvmlCoolerTarget_t "nvmlCoolerTarget_t": + NVML_THERMAL_COOLER_TARGET_NONE "NVML_THERMAL_COOLER_TARGET_NONE" = (1 << 0) + NVML_THERMAL_COOLER_TARGET_GPU "NVML_THERMAL_COOLER_TARGET_GPU" = (1 << 1) + NVML_THERMAL_COOLER_TARGET_MEMORY "NVML_THERMAL_COOLER_TARGET_MEMORY" = (1 << 2) + NVML_THERMAL_COOLER_TARGET_POWER_SUPPLY "NVML_THERMAL_COOLER_TARGET_POWER_SUPPLY" = (1 << 3) + NVML_THERMAL_COOLER_TARGET_GPU_RELATED "NVML_THERMAL_COOLER_TARGET_GPU_RELATED" = ((NVML_THERMAL_COOLER_TARGET_GPU | NVML_THERMAL_COOLER_TARGET_MEMORY) | NVML_THERMAL_COOLER_TARGET_POWER_SUPPLY) + +ctypedef enum nvmlUUIDType_t "nvmlUUIDType_t": + NVML_UUID_TYPE_NONE "NVML_UUID_TYPE_NONE" = 0 + NVML_UUID_TYPE_ASCII "NVML_UUID_TYPE_ASCII" = 1 + NVML_UUID_TYPE_BINARY "NVML_UUID_TYPE_BINARY" = 2 + +ctypedef enum nvmlEnableState_t "nvmlEnableState_t": + NVML_FEATURE_DISABLED "NVML_FEATURE_DISABLED" = 0 + NVML_FEATURE_ENABLED "NVML_FEATURE_ENABLED" = 1 + +ctypedef enum nvmlBrandType_t "nvmlBrandType_t": + NVML_BRAND_UNKNOWN "NVML_BRAND_UNKNOWN" = 0 + NVML_BRAND_QUADRO "NVML_BRAND_QUADRO" = 1 + NVML_BRAND_TESLA "NVML_BRAND_TESLA" = 2 + NVML_BRAND_NVS "NVML_BRAND_NVS" = 3 + NVML_BRAND_GRID "NVML_BRAND_GRID" = 4 + NVML_BRAND_GEFORCE "NVML_BRAND_GEFORCE" = 5 + NVML_BRAND_TITAN "NVML_BRAND_TITAN" = 6 + NVML_BRAND_NVIDIA_VAPPS "NVML_BRAND_NVIDIA_VAPPS" = 7 + NVML_BRAND_NVIDIA_VPC "NVML_BRAND_NVIDIA_VPC" = 8 + NVML_BRAND_NVIDIA_VCS "NVML_BRAND_NVIDIA_VCS" = 9 + NVML_BRAND_NVIDIA_VWS "NVML_BRAND_NVIDIA_VWS" = 10 + NVML_BRAND_NVIDIA_CLOUD_GAMING "NVML_BRAND_NVIDIA_CLOUD_GAMING" = 11 + NVML_BRAND_NVIDIA_VGAMING "NVML_BRAND_NVIDIA_VGAMING" = NVML_BRAND_NVIDIA_CLOUD_GAMING + NVML_BRAND_QUADRO_RTX "NVML_BRAND_QUADRO_RTX" = 12 + NVML_BRAND_NVIDIA_RTX "NVML_BRAND_NVIDIA_RTX" = 13 + NVML_BRAND_NVIDIA "NVML_BRAND_NVIDIA" = 14 + NVML_BRAND_GEFORCE_RTX "NVML_BRAND_GEFORCE_RTX" = 15 + NVML_BRAND_TITAN_RTX "NVML_BRAND_TITAN_RTX" = 16 + NVML_BRAND_COUNT "NVML_BRAND_COUNT" = 18 + +ctypedef enum nvmlTemperatureThresholds_t "nvmlTemperatureThresholds_t": + NVML_TEMPERATURE_THRESHOLD_SHUTDOWN "NVML_TEMPERATURE_THRESHOLD_SHUTDOWN" = 0 + NVML_TEMPERATURE_THRESHOLD_SLOWDOWN "NVML_TEMPERATURE_THRESHOLD_SLOWDOWN" = 1 + NVML_TEMPERATURE_THRESHOLD_MEM_MAX "NVML_TEMPERATURE_THRESHOLD_MEM_MAX" = 2 + NVML_TEMPERATURE_THRESHOLD_GPU_MAX "NVML_TEMPERATURE_THRESHOLD_GPU_MAX" = 3 + NVML_TEMPERATURE_THRESHOLD_ACOUSTIC_MIN "NVML_TEMPERATURE_THRESHOLD_ACOUSTIC_MIN" = 4 + NVML_TEMPERATURE_THRESHOLD_ACOUSTIC_CURR "NVML_TEMPERATURE_THRESHOLD_ACOUSTIC_CURR" = 5 + NVML_TEMPERATURE_THRESHOLD_ACOUSTIC_MAX "NVML_TEMPERATURE_THRESHOLD_ACOUSTIC_MAX" = 6 + NVML_TEMPERATURE_THRESHOLD_GPS_CURR "NVML_TEMPERATURE_THRESHOLD_GPS_CURR" = 7 + NVML_TEMPERATURE_THRESHOLD_COUNT "NVML_TEMPERATURE_THRESHOLD_COUNT" + +ctypedef enum nvmlTemperatureSensors_t "nvmlTemperatureSensors_t": + NVML_TEMPERATURE_GPU "NVML_TEMPERATURE_GPU" = 0 + NVML_TEMPERATURE_COUNT "NVML_TEMPERATURE_COUNT" + +ctypedef enum nvmlComputeMode_t "nvmlComputeMode_t": + NVML_COMPUTEMODE_DEFAULT "NVML_COMPUTEMODE_DEFAULT" = 0 + NVML_COMPUTEMODE_EXCLUSIVE_THREAD "NVML_COMPUTEMODE_EXCLUSIVE_THREAD" = 1 + NVML_COMPUTEMODE_PROHIBITED "NVML_COMPUTEMODE_PROHIBITED" = 2 + NVML_COMPUTEMODE_EXCLUSIVE_PROCESS "NVML_COMPUTEMODE_EXCLUSIVE_PROCESS" = 3 + NVML_COMPUTEMODE_COUNT "NVML_COMPUTEMODE_COUNT" + +ctypedef enum nvmlMemoryErrorType_t "nvmlMemoryErrorType_t": + NVML_MEMORY_ERROR_TYPE_CORRECTED "NVML_MEMORY_ERROR_TYPE_CORRECTED" = 0 + NVML_MEMORY_ERROR_TYPE_UNCORRECTED "NVML_MEMORY_ERROR_TYPE_UNCORRECTED" = 1 + NVML_MEMORY_ERROR_TYPE_COUNT "NVML_MEMORY_ERROR_TYPE_COUNT" + +ctypedef enum nvmlNvlinkVersion_t "nvmlNvlinkVersion_t": + NVML_NVLINK_VERSION_INVALID "NVML_NVLINK_VERSION_INVALID" = 0 + NVML_NVLINK_VERSION_1_0 "NVML_NVLINK_VERSION_1_0" = 1 + NVML_NVLINK_VERSION_2_0 "NVML_NVLINK_VERSION_2_0" = 2 + NVML_NVLINK_VERSION_2_2 "NVML_NVLINK_VERSION_2_2" = 3 + NVML_NVLINK_VERSION_3_0 "NVML_NVLINK_VERSION_3_0" = 4 + NVML_NVLINK_VERSION_3_1 "NVML_NVLINK_VERSION_3_1" = 5 + NVML_NVLINK_VERSION_4_0 "NVML_NVLINK_VERSION_4_0" = 6 + NVML_NVLINK_VERSION_5_0 "NVML_NVLINK_VERSION_5_0" = 7 + NVML_NVLINK_VERSION_6_0 "NVML_NVLINK_VERSION_6_0" = 8 + +ctypedef enum nvmlEccCounterType_t "nvmlEccCounterType_t": + NVML_VOLATILE_ECC "NVML_VOLATILE_ECC" = 0 + NVML_AGGREGATE_ECC "NVML_AGGREGATE_ECC" = 1 + NVML_ECC_COUNTER_TYPE_COUNT "NVML_ECC_COUNTER_TYPE_COUNT" + +ctypedef enum nvmlClockType_t "nvmlClockType_t": + NVML_CLOCK_GRAPHICS "NVML_CLOCK_GRAPHICS" = 0 + NVML_CLOCK_SM "NVML_CLOCK_SM" = 1 + NVML_CLOCK_MEM "NVML_CLOCK_MEM" = 2 + NVML_CLOCK_VIDEO "NVML_CLOCK_VIDEO" = 3 + NVML_CLOCK_COUNT "NVML_CLOCK_COUNT" + +ctypedef enum nvmlClockId_t "nvmlClockId_t": + NVML_CLOCK_ID_CURRENT "NVML_CLOCK_ID_CURRENT" = 0 + NVML_CLOCK_ID_APP_CLOCK_TARGET "NVML_CLOCK_ID_APP_CLOCK_TARGET" = 1 + NVML_CLOCK_ID_APP_CLOCK_DEFAULT "NVML_CLOCK_ID_APP_CLOCK_DEFAULT" = 2 + NVML_CLOCK_ID_CUSTOMER_BOOST_MAX "NVML_CLOCK_ID_CUSTOMER_BOOST_MAX" = 3 + NVML_CLOCK_ID_COUNT "NVML_CLOCK_ID_COUNT" + +ctypedef enum nvmlDriverModel_t "nvmlDriverModel_t": + NVML_DRIVER_WDDM "NVML_DRIVER_WDDM" = 0 + NVML_DRIVER_WDM "NVML_DRIVER_WDM" = 1 + NVML_DRIVER_MCDM "NVML_DRIVER_MCDM" = 2 + +ctypedef enum nvmlPstates_t "nvmlPstates_t": + NVML_PSTATE_0 "NVML_PSTATE_0" = 0 + NVML_PSTATE_1 "NVML_PSTATE_1" = 1 + NVML_PSTATE_2 "NVML_PSTATE_2" = 2 + NVML_PSTATE_3 "NVML_PSTATE_3" = 3 + NVML_PSTATE_4 "NVML_PSTATE_4" = 4 + NVML_PSTATE_5 "NVML_PSTATE_5" = 5 + NVML_PSTATE_6 "NVML_PSTATE_6" = 6 + NVML_PSTATE_7 "NVML_PSTATE_7" = 7 + NVML_PSTATE_8 "NVML_PSTATE_8" = 8 + NVML_PSTATE_9 "NVML_PSTATE_9" = 9 + NVML_PSTATE_10 "NVML_PSTATE_10" = 10 + NVML_PSTATE_11 "NVML_PSTATE_11" = 11 + NVML_PSTATE_12 "NVML_PSTATE_12" = 12 + NVML_PSTATE_13 "NVML_PSTATE_13" = 13 + NVML_PSTATE_14 "NVML_PSTATE_14" = 14 + NVML_PSTATE_15 "NVML_PSTATE_15" = 15 + NVML_PSTATE_UNKNOWN "NVML_PSTATE_UNKNOWN" = 32 + +ctypedef enum nvmlGpuOperationMode_t "nvmlGpuOperationMode_t": + NVML_GOM_ALL_ON "NVML_GOM_ALL_ON" = 0 + NVML_GOM_COMPUTE "NVML_GOM_COMPUTE" = 1 + NVML_GOM_LOW_DP "NVML_GOM_LOW_DP" = 2 + +ctypedef enum nvmlInforomObject_t "nvmlInforomObject_t": + NVML_INFOROM_OEM "NVML_INFOROM_OEM" = 0 + NVML_INFOROM_ECC "NVML_INFOROM_ECC" = 1 + NVML_INFOROM_POWER "NVML_INFOROM_POWER" = 2 + NVML_INFOROM_DEN "NVML_INFOROM_DEN" = 3 + NVML_INFOROM_COUNT "NVML_INFOROM_COUNT" + +ctypedef enum nvmlReturn_t "nvmlReturn_t": + NVML_SUCCESS "NVML_SUCCESS" = 0 + NVML_ERROR_UNINITIALIZED "NVML_ERROR_UNINITIALIZED" = 1 + NVML_ERROR_INVALID_ARGUMENT "NVML_ERROR_INVALID_ARGUMENT" = 2 + NVML_ERROR_NOT_SUPPORTED "NVML_ERROR_NOT_SUPPORTED" = 3 + NVML_ERROR_NO_PERMISSION "NVML_ERROR_NO_PERMISSION" = 4 + NVML_ERROR_ALREADY_INITIALIZED "NVML_ERROR_ALREADY_INITIALIZED" = 5 + NVML_ERROR_NOT_FOUND "NVML_ERROR_NOT_FOUND" = 6 + NVML_ERROR_INSUFFICIENT_SIZE "NVML_ERROR_INSUFFICIENT_SIZE" = 7 + NVML_ERROR_INSUFFICIENT_POWER "NVML_ERROR_INSUFFICIENT_POWER" = 8 + NVML_ERROR_DRIVER_NOT_LOADED "NVML_ERROR_DRIVER_NOT_LOADED" = 9 + NVML_ERROR_TIMEOUT "NVML_ERROR_TIMEOUT" = 10 + NVML_ERROR_IRQ_ISSUE "NVML_ERROR_IRQ_ISSUE" = 11 + NVML_ERROR_LIBRARY_NOT_FOUND "NVML_ERROR_LIBRARY_NOT_FOUND" = 12 + NVML_ERROR_FUNCTION_NOT_FOUND "NVML_ERROR_FUNCTION_NOT_FOUND" = 13 + NVML_ERROR_CORRUPTED_INFOROM "NVML_ERROR_CORRUPTED_INFOROM" = 14 + NVML_ERROR_GPU_IS_LOST "NVML_ERROR_GPU_IS_LOST" = 15 + NVML_ERROR_RESET_REQUIRED "NVML_ERROR_RESET_REQUIRED" = 16 + NVML_ERROR_OPERATING_SYSTEM "NVML_ERROR_OPERATING_SYSTEM" = 17 + NVML_ERROR_LIB_RM_VERSION_MISMATCH "NVML_ERROR_LIB_RM_VERSION_MISMATCH" = 18 + NVML_ERROR_IN_USE "NVML_ERROR_IN_USE" = 19 + NVML_ERROR_MEMORY "NVML_ERROR_MEMORY" = 20 + NVML_ERROR_NO_DATA "NVML_ERROR_NO_DATA" = 21 + NVML_ERROR_VGPU_ECC_NOT_SUPPORTED "NVML_ERROR_VGPU_ECC_NOT_SUPPORTED" = 22 + NVML_ERROR_INSUFFICIENT_RESOURCES "NVML_ERROR_INSUFFICIENT_RESOURCES" = 23 + NVML_ERROR_FREQ_NOT_SUPPORTED "NVML_ERROR_FREQ_NOT_SUPPORTED" = 24 + NVML_ERROR_ARGUMENT_VERSION_MISMATCH "NVML_ERROR_ARGUMENT_VERSION_MISMATCH" = 25 + NVML_ERROR_DEPRECATED "NVML_ERROR_DEPRECATED" = 26 + NVML_ERROR_NOT_READY "NVML_ERROR_NOT_READY" = 27 + NVML_ERROR_GPU_NOT_FOUND "NVML_ERROR_GPU_NOT_FOUND" = 28 + NVML_ERROR_INVALID_STATE "NVML_ERROR_INVALID_STATE" = 29 + NVML_ERROR_RESET_TYPE_NOT_SUPPORTED "NVML_ERROR_RESET_TYPE_NOT_SUPPORTED" = 30 + NVML_ERROR_UNKNOWN "NVML_ERROR_UNKNOWN" = 999 + _NVMLRETURN_T_INTERNAL_LOADING_ERROR "_NVMLRETURN_T_INTERNAL_LOADING_ERROR" = -42 + +ctypedef enum nvmlMemoryLocation_t "nvmlMemoryLocation_t": + NVML_MEMORY_LOCATION_L1_CACHE "NVML_MEMORY_LOCATION_L1_CACHE" = 0 + NVML_MEMORY_LOCATION_L2_CACHE "NVML_MEMORY_LOCATION_L2_CACHE" = 1 + NVML_MEMORY_LOCATION_DRAM "NVML_MEMORY_LOCATION_DRAM" = 2 + NVML_MEMORY_LOCATION_DEVICE_MEMORY "NVML_MEMORY_LOCATION_DEVICE_MEMORY" = 2 + NVML_MEMORY_LOCATION_REGISTER_FILE "NVML_MEMORY_LOCATION_REGISTER_FILE" = 3 + NVML_MEMORY_LOCATION_TEXTURE_MEMORY "NVML_MEMORY_LOCATION_TEXTURE_MEMORY" = 4 + NVML_MEMORY_LOCATION_TEXTURE_SHM "NVML_MEMORY_LOCATION_TEXTURE_SHM" = 5 + NVML_MEMORY_LOCATION_CBU "NVML_MEMORY_LOCATION_CBU" = 6 + NVML_MEMORY_LOCATION_SRAM "NVML_MEMORY_LOCATION_SRAM" = 7 + NVML_MEMORY_LOCATION_COUNT "NVML_MEMORY_LOCATION_COUNT" + +ctypedef enum nvmlPageRetirementCause_t "nvmlPageRetirementCause_t": + NVML_PAGE_RETIREMENT_CAUSE_MULTIPLE_SINGLE_BIT_ECC_ERRORS "NVML_PAGE_RETIREMENT_CAUSE_MULTIPLE_SINGLE_BIT_ECC_ERRORS" = 0 + NVML_PAGE_RETIREMENT_CAUSE_DOUBLE_BIT_ECC_ERROR "NVML_PAGE_RETIREMENT_CAUSE_DOUBLE_BIT_ECC_ERROR" = 1 + NVML_PAGE_RETIREMENT_CAUSE_COUNT "NVML_PAGE_RETIREMENT_CAUSE_COUNT" + +ctypedef enum nvmlRestrictedAPI_t "nvmlRestrictedAPI_t": + NVML_RESTRICTED_API_SET_APPLICATION_CLOCKS "NVML_RESTRICTED_API_SET_APPLICATION_CLOCKS" = 0 + NVML_RESTRICTED_API_SET_AUTO_BOOSTED_CLOCKS "NVML_RESTRICTED_API_SET_AUTO_BOOSTED_CLOCKS" = 1 + NVML_RESTRICTED_API_COUNT "NVML_RESTRICTED_API_COUNT" + +ctypedef enum nvmlGpuUtilizationDomainId_t "nvmlGpuUtilizationDomainId_t": + NVML_GPU_UTILIZATION_DOMAIN_GPU "NVML_GPU_UTILIZATION_DOMAIN_GPU" = 0 + NVML_GPU_UTILIZATION_DOMAIN_FB "NVML_GPU_UTILIZATION_DOMAIN_FB" = 1 + NVML_GPU_UTILIZATION_DOMAIN_VID "NVML_GPU_UTILIZATION_DOMAIN_VID" = 2 + NVML_GPU_UTILIZATION_DOMAIN_BUS "NVML_GPU_UTILIZATION_DOMAIN_BUS" = 3 + +ctypedef enum nvmlGpuVirtualizationMode_t "nvmlGpuVirtualizationMode_t": + NVML_GPU_VIRTUALIZATION_MODE_NONE "NVML_GPU_VIRTUALIZATION_MODE_NONE" = 0 + NVML_GPU_VIRTUALIZATION_MODE_PASSTHROUGH "NVML_GPU_VIRTUALIZATION_MODE_PASSTHROUGH" = 1 + NVML_GPU_VIRTUALIZATION_MODE_VGPU "NVML_GPU_VIRTUALIZATION_MODE_VGPU" = 2 + NVML_GPU_VIRTUALIZATION_MODE_HOST_VGPU "NVML_GPU_VIRTUALIZATION_MODE_HOST_VGPU" = 3 + NVML_GPU_VIRTUALIZATION_MODE_HOST_VSGA "NVML_GPU_VIRTUALIZATION_MODE_HOST_VSGA" = 4 + +ctypedef enum nvmlHostVgpuMode_t "nvmlHostVgpuMode_t": + NVML_HOST_VGPU_MODE_NON_SRIOV "NVML_HOST_VGPU_MODE_NON_SRIOV" = 0 + NVML_HOST_VGPU_MODE_SRIOV "NVML_HOST_VGPU_MODE_SRIOV" = 1 + +ctypedef enum nvmlVgpuVmIdType_t "nvmlVgpuVmIdType_t": + NVML_VGPU_VM_ID_DOMAIN_ID "NVML_VGPU_VM_ID_DOMAIN_ID" = 0 + NVML_VGPU_VM_ID_UUID "NVML_VGPU_VM_ID_UUID" = 1 + +ctypedef enum nvmlVgpuGuestInfoState_t "nvmlVgpuGuestInfoState_t": + NVML_VGPU_INSTANCE_GUEST_INFO_STATE_UNINITIALIZED "NVML_VGPU_INSTANCE_GUEST_INFO_STATE_UNINITIALIZED" = 0 + NVML_VGPU_INSTANCE_GUEST_INFO_STATE_INITIALIZED "NVML_VGPU_INSTANCE_GUEST_INFO_STATE_INITIALIZED" = 1 + +ctypedef enum nvmlGridLicenseFeatureCode_t "nvmlGridLicenseFeatureCode_t": + NVML_GRID_LICENSE_FEATURE_CODE_UNKNOWN "NVML_GRID_LICENSE_FEATURE_CODE_UNKNOWN" = 0 + NVML_GRID_LICENSE_FEATURE_CODE_VGPU "NVML_GRID_LICENSE_FEATURE_CODE_VGPU" = 1 + NVML_GRID_LICENSE_FEATURE_CODE_NVIDIA_RTX "NVML_GRID_LICENSE_FEATURE_CODE_NVIDIA_RTX" = 2 + NVML_GRID_LICENSE_FEATURE_CODE_VWORKSTATION "NVML_GRID_LICENSE_FEATURE_CODE_VWORKSTATION" = NVML_GRID_LICENSE_FEATURE_CODE_NVIDIA_RTX + NVML_GRID_LICENSE_FEATURE_CODE_GAMING "NVML_GRID_LICENSE_FEATURE_CODE_GAMING" = 3 + NVML_GRID_LICENSE_FEATURE_CODE_COMPUTE "NVML_GRID_LICENSE_FEATURE_CODE_COMPUTE" = 4 + +ctypedef enum nvmlVgpuCapability_t "nvmlVgpuCapability_t": + NVML_VGPU_CAP_NVLINK_P2P "NVML_VGPU_CAP_NVLINK_P2P" = 0 + NVML_VGPU_CAP_GPUDIRECT "NVML_VGPU_CAP_GPUDIRECT" = 1 + NVML_VGPU_CAP_MULTI_VGPU_EXCLUSIVE "NVML_VGPU_CAP_MULTI_VGPU_EXCLUSIVE" = 2 + NVML_VGPU_CAP_EXCLUSIVE_TYPE "NVML_VGPU_CAP_EXCLUSIVE_TYPE" = 3 + NVML_VGPU_CAP_EXCLUSIVE_SIZE "NVML_VGPU_CAP_EXCLUSIVE_SIZE" = 4 + NVML_VGPU_CAP_COUNT "NVML_VGPU_CAP_COUNT" + +ctypedef enum nvmlVgpuDriverCapability_t "nvmlVgpuDriverCapability_t": + NVML_VGPU_DRIVER_CAP_HETEROGENEOUS_MULTI_VGPU "NVML_VGPU_DRIVER_CAP_HETEROGENEOUS_MULTI_VGPU" = 0 + NVML_VGPU_DRIVER_CAP_WARM_UPDATE "NVML_VGPU_DRIVER_CAP_WARM_UPDATE" = 1 + NVML_VGPU_DRIVER_CAP_COUNT "NVML_VGPU_DRIVER_CAP_COUNT" + +ctypedef enum nvmlDeviceVgpuCapability_t "nvmlDeviceVgpuCapability_t": + NVML_DEVICE_VGPU_CAP_FRACTIONAL_MULTI_VGPU "NVML_DEVICE_VGPU_CAP_FRACTIONAL_MULTI_VGPU" = 0 + NVML_DEVICE_VGPU_CAP_HETEROGENEOUS_TIMESLICE_PROFILES "NVML_DEVICE_VGPU_CAP_HETEROGENEOUS_TIMESLICE_PROFILES" = 1 + NVML_DEVICE_VGPU_CAP_HETEROGENEOUS_TIMESLICE_SIZES "NVML_DEVICE_VGPU_CAP_HETEROGENEOUS_TIMESLICE_SIZES" = 2 + NVML_DEVICE_VGPU_CAP_READ_DEVICE_BUFFER_BW "NVML_DEVICE_VGPU_CAP_READ_DEVICE_BUFFER_BW" = 3 + NVML_DEVICE_VGPU_CAP_WRITE_DEVICE_BUFFER_BW "NVML_DEVICE_VGPU_CAP_WRITE_DEVICE_BUFFER_BW" = 4 + NVML_DEVICE_VGPU_CAP_DEVICE_STREAMING "NVML_DEVICE_VGPU_CAP_DEVICE_STREAMING" = 5 + NVML_DEVICE_VGPU_CAP_MINI_QUARTER_GPU "NVML_DEVICE_VGPU_CAP_MINI_QUARTER_GPU" = 6 + NVML_DEVICE_VGPU_CAP_COMPUTE_MEDIA_ENGINE_GPU "NVML_DEVICE_VGPU_CAP_COMPUTE_MEDIA_ENGINE_GPU" = 7 + NVML_DEVICE_VGPU_CAP_WARM_UPDATE "NVML_DEVICE_VGPU_CAP_WARM_UPDATE" = 8 + NVML_DEVICE_VGPU_CAP_HOMOGENEOUS_PLACEMENTS "NVML_DEVICE_VGPU_CAP_HOMOGENEOUS_PLACEMENTS" = 9 + NVML_DEVICE_VGPU_CAP_MIG_TIMESLICING_SUPPORTED "NVML_DEVICE_VGPU_CAP_MIG_TIMESLICING_SUPPORTED" = 10 + NVML_DEVICE_VGPU_CAP_MIG_TIMESLICING_ENABLED "NVML_DEVICE_VGPU_CAP_MIG_TIMESLICING_ENABLED" = 11 + NVML_DEVICE_VGPU_CAP_COUNT "NVML_DEVICE_VGPU_CAP_COUNT" + +ctypedef enum nvmlDeviceGpuRecoveryAction_t "nvmlDeviceGpuRecoveryAction_t": + NVML_GPU_RECOVERY_ACTION_NONE "NVML_GPU_RECOVERY_ACTION_NONE" = 0 + NVML_GPU_RECOVERY_ACTION_GPU_RESET "NVML_GPU_RECOVERY_ACTION_GPU_RESET" = 1 + NVML_GPU_RECOVERY_ACTION_NODE_REBOOT "NVML_GPU_RECOVERY_ACTION_NODE_REBOOT" = 2 + NVML_GPU_RECOVERY_ACTION_DRAIN_P2P "NVML_GPU_RECOVERY_ACTION_DRAIN_P2P" = 3 + NVML_GPU_RECOVERY_ACTION_DRAIN_AND_RESET "NVML_GPU_RECOVERY_ACTION_DRAIN_AND_RESET" = 4 + NVML_GPU_RECOVERY_ACTION_RECOVER_IMEX_DOMAIN "NVML_GPU_RECOVERY_ACTION_RECOVER_IMEX_DOMAIN" = 5 + +ctypedef enum nvmlFanState_t "nvmlFanState_t": + NVML_FAN_NORMAL "NVML_FAN_NORMAL" = 0 + NVML_FAN_FAILED "NVML_FAN_FAILED" = 1 + +ctypedef enum nvmlLedColor_t "nvmlLedColor_t": + NVML_LED_COLOR_GREEN "NVML_LED_COLOR_GREEN" = 0 + NVML_LED_COLOR_AMBER "NVML_LED_COLOR_AMBER" = 1 + +ctypedef enum nvmlEncoderType_t "nvmlEncoderType_t": + NVML_ENCODER_QUERY_H264 "NVML_ENCODER_QUERY_H264" = 0x00 + NVML_ENCODER_QUERY_HEVC "NVML_ENCODER_QUERY_HEVC" = 0x01 + NVML_ENCODER_QUERY_AV1 "NVML_ENCODER_QUERY_AV1" = 0x02 + NVML_ENCODER_QUERY_UNKNOWN "NVML_ENCODER_QUERY_UNKNOWN" = 0xFF + +ctypedef enum nvmlFBCSessionType_t "nvmlFBCSessionType_t": + NVML_FBC_SESSION_TYPE_UNKNOWN "NVML_FBC_SESSION_TYPE_UNKNOWN" = 0 + NVML_FBC_SESSION_TYPE_TOSYS "NVML_FBC_SESSION_TYPE_TOSYS" + NVML_FBC_SESSION_TYPE_CUDA "NVML_FBC_SESSION_TYPE_CUDA" + NVML_FBC_SESSION_TYPE_VID "NVML_FBC_SESSION_TYPE_VID" + NVML_FBC_SESSION_TYPE_HWENC "NVML_FBC_SESSION_TYPE_HWENC" + +ctypedef enum nvmlDetachGpuState_t "nvmlDetachGpuState_t": + NVML_DETACH_GPU_KEEP "NVML_DETACH_GPU_KEEP" = 0 + NVML_DETACH_GPU_REMOVE "NVML_DETACH_GPU_REMOVE" + +ctypedef enum nvmlPcieLinkState_t "nvmlPcieLinkState_t": + NVML_PCIE_LINK_KEEP "NVML_PCIE_LINK_KEEP" = 0 + NVML_PCIE_LINK_SHUT_DOWN "NVML_PCIE_LINK_SHUT_DOWN" + +ctypedef enum nvmlClockLimitId_t "nvmlClockLimitId_t": + NVML_CLOCK_LIMIT_ID_RANGE_START "NVML_CLOCK_LIMIT_ID_RANGE_START" = 0xffffff00 + NVML_CLOCK_LIMIT_ID_TDP "NVML_CLOCK_LIMIT_ID_TDP" + NVML_CLOCK_LIMIT_ID_UNLIMITED "NVML_CLOCK_LIMIT_ID_UNLIMITED" + +ctypedef enum nvmlVgpuVmCompatibility_t "nvmlVgpuVmCompatibility_t": + NVML_VGPU_VM_COMPATIBILITY_NONE "NVML_VGPU_VM_COMPATIBILITY_NONE" = 0x0 + NVML_VGPU_VM_COMPATIBILITY_COLD "NVML_VGPU_VM_COMPATIBILITY_COLD" = 0x1 + NVML_VGPU_VM_COMPATIBILITY_HIBERNATE "NVML_VGPU_VM_COMPATIBILITY_HIBERNATE" = 0x2 + NVML_VGPU_VM_COMPATIBILITY_SLEEP "NVML_VGPU_VM_COMPATIBILITY_SLEEP" = 0x4 + NVML_VGPU_VM_COMPATIBILITY_LIVE "NVML_VGPU_VM_COMPATIBILITY_LIVE" = 0x8 + +ctypedef enum nvmlVgpuPgpuCompatibilityLimitCode_t "nvmlVgpuPgpuCompatibilityLimitCode_t": + NVML_VGPU_COMPATIBILITY_LIMIT_NONE "NVML_VGPU_COMPATIBILITY_LIMIT_NONE" = 0x0 + NVML_VGPU_COMPATIBILITY_LIMIT_HOST_DRIVER "NVML_VGPU_COMPATIBILITY_LIMIT_HOST_DRIVER" = 0x1 + NVML_VGPU_COMPATIBILITY_LIMIT_GUEST_DRIVER "NVML_VGPU_COMPATIBILITY_LIMIT_GUEST_DRIVER" = 0x2 + NVML_VGPU_COMPATIBILITY_LIMIT_GPU "NVML_VGPU_COMPATIBILITY_LIMIT_GPU" = 0x4 + NVML_VGPU_COMPATIBILITY_LIMIT_OTHER "NVML_VGPU_COMPATIBILITY_LIMIT_OTHER" = 0x80000000 + +ctypedef enum nvmlGpmMetricId_t "nvmlGpmMetricId_t": + NVML_GPM_METRIC_GRAPHICS_UTIL "NVML_GPM_METRIC_GRAPHICS_UTIL" = 1 + NVML_GPM_METRIC_SM_UTIL "NVML_GPM_METRIC_SM_UTIL" = 2 + NVML_GPM_METRIC_SM_OCCUPANCY "NVML_GPM_METRIC_SM_OCCUPANCY" = 3 + NVML_GPM_METRIC_INTEGER_UTIL "NVML_GPM_METRIC_INTEGER_UTIL" = 4 + NVML_GPM_METRIC_ANY_TENSOR_UTIL "NVML_GPM_METRIC_ANY_TENSOR_UTIL" = 5 + NVML_GPM_METRIC_DFMA_TENSOR_UTIL "NVML_GPM_METRIC_DFMA_TENSOR_UTIL" = 6 + NVML_GPM_METRIC_HMMA_TENSOR_UTIL "NVML_GPM_METRIC_HMMA_TENSOR_UTIL" = 7 + NVML_GPM_METRIC_DMMA_TENSOR_UTIL "NVML_GPM_METRIC_DMMA_TENSOR_UTIL" = 8 + NVML_GPM_METRIC_IMMA_TENSOR_UTIL "NVML_GPM_METRIC_IMMA_TENSOR_UTIL" = 9 + NVML_GPM_METRIC_DRAM_BW_UTIL "NVML_GPM_METRIC_DRAM_BW_UTIL" = 10 + NVML_GPM_METRIC_FP64_UTIL "NVML_GPM_METRIC_FP64_UTIL" = 11 + NVML_GPM_METRIC_FP32_UTIL "NVML_GPM_METRIC_FP32_UTIL" = 12 + NVML_GPM_METRIC_FP16_UTIL "NVML_GPM_METRIC_FP16_UTIL" = 13 + NVML_GPM_METRIC_PCIE_TX_PER_SEC "NVML_GPM_METRIC_PCIE_TX_PER_SEC" = 20 + NVML_GPM_METRIC_PCIE_RX_PER_SEC "NVML_GPM_METRIC_PCIE_RX_PER_SEC" = 21 + NVML_GPM_METRIC_NVDEC_0_UTIL "NVML_GPM_METRIC_NVDEC_0_UTIL" = 30 + NVML_GPM_METRIC_NVDEC_1_UTIL "NVML_GPM_METRIC_NVDEC_1_UTIL" = 31 + NVML_GPM_METRIC_NVDEC_2_UTIL "NVML_GPM_METRIC_NVDEC_2_UTIL" = 32 + NVML_GPM_METRIC_NVDEC_3_UTIL "NVML_GPM_METRIC_NVDEC_3_UTIL" = 33 + NVML_GPM_METRIC_NVDEC_4_UTIL "NVML_GPM_METRIC_NVDEC_4_UTIL" = 34 + NVML_GPM_METRIC_NVDEC_5_UTIL "NVML_GPM_METRIC_NVDEC_5_UTIL" = 35 + NVML_GPM_METRIC_NVDEC_6_UTIL "NVML_GPM_METRIC_NVDEC_6_UTIL" = 36 + NVML_GPM_METRIC_NVDEC_7_UTIL "NVML_GPM_METRIC_NVDEC_7_UTIL" = 37 + NVML_GPM_METRIC_NVJPG_0_UTIL "NVML_GPM_METRIC_NVJPG_0_UTIL" = 40 + NVML_GPM_METRIC_NVJPG_1_UTIL "NVML_GPM_METRIC_NVJPG_1_UTIL" = 41 + NVML_GPM_METRIC_NVJPG_2_UTIL "NVML_GPM_METRIC_NVJPG_2_UTIL" = 42 + NVML_GPM_METRIC_NVJPG_3_UTIL "NVML_GPM_METRIC_NVJPG_3_UTIL" = 43 + NVML_GPM_METRIC_NVJPG_4_UTIL "NVML_GPM_METRIC_NVJPG_4_UTIL" = 44 + NVML_GPM_METRIC_NVJPG_5_UTIL "NVML_GPM_METRIC_NVJPG_5_UTIL" = 45 + NVML_GPM_METRIC_NVJPG_6_UTIL "NVML_GPM_METRIC_NVJPG_6_UTIL" = 46 + NVML_GPM_METRIC_NVJPG_7_UTIL "NVML_GPM_METRIC_NVJPG_7_UTIL" = 47 + NVML_GPM_METRIC_NVOFA_0_UTIL "NVML_GPM_METRIC_NVOFA_0_UTIL" = 50 + NVML_GPM_METRIC_NVOFA_1_UTIL "NVML_GPM_METRIC_NVOFA_1_UTIL" = 51 + NVML_GPM_METRIC_NVLINK_TOTAL_RX_PER_SEC "NVML_GPM_METRIC_NVLINK_TOTAL_RX_PER_SEC" = 60 + NVML_GPM_METRIC_NVLINK_TOTAL_TX_PER_SEC "NVML_GPM_METRIC_NVLINK_TOTAL_TX_PER_SEC" = 61 + NVML_GPM_METRIC_NVLINK_L0_RX_PER_SEC "NVML_GPM_METRIC_NVLINK_L0_RX_PER_SEC" = 62 + NVML_GPM_METRIC_NVLINK_L0_TX_PER_SEC "NVML_GPM_METRIC_NVLINK_L0_TX_PER_SEC" = 63 + NVML_GPM_METRIC_NVLINK_L1_RX_PER_SEC "NVML_GPM_METRIC_NVLINK_L1_RX_PER_SEC" = 64 + NVML_GPM_METRIC_NVLINK_L1_TX_PER_SEC "NVML_GPM_METRIC_NVLINK_L1_TX_PER_SEC" = 65 + NVML_GPM_METRIC_NVLINK_L2_RX_PER_SEC "NVML_GPM_METRIC_NVLINK_L2_RX_PER_SEC" = 66 + NVML_GPM_METRIC_NVLINK_L2_TX_PER_SEC "NVML_GPM_METRIC_NVLINK_L2_TX_PER_SEC" = 67 + NVML_GPM_METRIC_NVLINK_L3_RX_PER_SEC "NVML_GPM_METRIC_NVLINK_L3_RX_PER_SEC" = 68 + NVML_GPM_METRIC_NVLINK_L3_TX_PER_SEC "NVML_GPM_METRIC_NVLINK_L3_TX_PER_SEC" = 69 + NVML_GPM_METRIC_NVLINK_L4_RX_PER_SEC "NVML_GPM_METRIC_NVLINK_L4_RX_PER_SEC" = 70 + NVML_GPM_METRIC_NVLINK_L4_TX_PER_SEC "NVML_GPM_METRIC_NVLINK_L4_TX_PER_SEC" = 71 + NVML_GPM_METRIC_NVLINK_L5_RX_PER_SEC "NVML_GPM_METRIC_NVLINK_L5_RX_PER_SEC" = 72 + NVML_GPM_METRIC_NVLINK_L5_TX_PER_SEC "NVML_GPM_METRIC_NVLINK_L5_TX_PER_SEC" = 73 + NVML_GPM_METRIC_NVLINK_L6_RX_PER_SEC "NVML_GPM_METRIC_NVLINK_L6_RX_PER_SEC" = 74 + NVML_GPM_METRIC_NVLINK_L6_TX_PER_SEC "NVML_GPM_METRIC_NVLINK_L6_TX_PER_SEC" = 75 + NVML_GPM_METRIC_NVLINK_L7_RX_PER_SEC "NVML_GPM_METRIC_NVLINK_L7_RX_PER_SEC" = 76 + NVML_GPM_METRIC_NVLINK_L7_TX_PER_SEC "NVML_GPM_METRIC_NVLINK_L7_TX_PER_SEC" = 77 + NVML_GPM_METRIC_NVLINK_L8_RX_PER_SEC "NVML_GPM_METRIC_NVLINK_L8_RX_PER_SEC" = 78 + NVML_GPM_METRIC_NVLINK_L8_TX_PER_SEC "NVML_GPM_METRIC_NVLINK_L8_TX_PER_SEC" = 79 + NVML_GPM_METRIC_NVLINK_L9_RX_PER_SEC "NVML_GPM_METRIC_NVLINK_L9_RX_PER_SEC" = 80 + NVML_GPM_METRIC_NVLINK_L9_TX_PER_SEC "NVML_GPM_METRIC_NVLINK_L9_TX_PER_SEC" = 81 + NVML_GPM_METRIC_NVLINK_L10_RX_PER_SEC "NVML_GPM_METRIC_NVLINK_L10_RX_PER_SEC" = 82 + NVML_GPM_METRIC_NVLINK_L10_TX_PER_SEC "NVML_GPM_METRIC_NVLINK_L10_TX_PER_SEC" = 83 + NVML_GPM_METRIC_NVLINK_L11_RX_PER_SEC "NVML_GPM_METRIC_NVLINK_L11_RX_PER_SEC" = 84 + NVML_GPM_METRIC_NVLINK_L11_TX_PER_SEC "NVML_GPM_METRIC_NVLINK_L11_TX_PER_SEC" = 85 + NVML_GPM_METRIC_NVLINK_L12_RX_PER_SEC "NVML_GPM_METRIC_NVLINK_L12_RX_PER_SEC" = 86 + NVML_GPM_METRIC_NVLINK_L12_TX_PER_SEC "NVML_GPM_METRIC_NVLINK_L12_TX_PER_SEC" = 87 + NVML_GPM_METRIC_NVLINK_L13_RX_PER_SEC "NVML_GPM_METRIC_NVLINK_L13_RX_PER_SEC" = 88 + NVML_GPM_METRIC_NVLINK_L13_TX_PER_SEC "NVML_GPM_METRIC_NVLINK_L13_TX_PER_SEC" = 89 + NVML_GPM_METRIC_NVLINK_L14_RX_PER_SEC "NVML_GPM_METRIC_NVLINK_L14_RX_PER_SEC" = 90 + NVML_GPM_METRIC_NVLINK_L14_TX_PER_SEC "NVML_GPM_METRIC_NVLINK_L14_TX_PER_SEC" = 91 + NVML_GPM_METRIC_NVLINK_L15_RX_PER_SEC "NVML_GPM_METRIC_NVLINK_L15_RX_PER_SEC" = 92 + NVML_GPM_METRIC_NVLINK_L15_TX_PER_SEC "NVML_GPM_METRIC_NVLINK_L15_TX_PER_SEC" = 93 + NVML_GPM_METRIC_NVLINK_L16_RX_PER_SEC "NVML_GPM_METRIC_NVLINK_L16_RX_PER_SEC" = 94 + NVML_GPM_METRIC_NVLINK_L16_TX_PER_SEC "NVML_GPM_METRIC_NVLINK_L16_TX_PER_SEC" = 95 + NVML_GPM_METRIC_NVLINK_L17_RX_PER_SEC "NVML_GPM_METRIC_NVLINK_L17_RX_PER_SEC" = 96 + NVML_GPM_METRIC_NVLINK_L17_TX_PER_SEC "NVML_GPM_METRIC_NVLINK_L17_TX_PER_SEC" = 97 + NVML_GPM_METRIC_C2C_TOTAL_TX_PER_SEC "NVML_GPM_METRIC_C2C_TOTAL_TX_PER_SEC" = 100 + NVML_GPM_METRIC_C2C_TOTAL_RX_PER_SEC "NVML_GPM_METRIC_C2C_TOTAL_RX_PER_SEC" = 101 + NVML_GPM_METRIC_C2C_DATA_TX_PER_SEC "NVML_GPM_METRIC_C2C_DATA_TX_PER_SEC" = 102 + NVML_GPM_METRIC_C2C_DATA_RX_PER_SEC "NVML_GPM_METRIC_C2C_DATA_RX_PER_SEC" = 103 + NVML_GPM_METRIC_C2C_LINK0_TOTAL_TX_PER_SEC "NVML_GPM_METRIC_C2C_LINK0_TOTAL_TX_PER_SEC" = 104 + NVML_GPM_METRIC_C2C_LINK0_TOTAL_RX_PER_SEC "NVML_GPM_METRIC_C2C_LINK0_TOTAL_RX_PER_SEC" = 105 + NVML_GPM_METRIC_C2C_LINK0_DATA_TX_PER_SEC "NVML_GPM_METRIC_C2C_LINK0_DATA_TX_PER_SEC" = 106 + NVML_GPM_METRIC_C2C_LINK0_DATA_RX_PER_SEC "NVML_GPM_METRIC_C2C_LINK0_DATA_RX_PER_SEC" = 107 + NVML_GPM_METRIC_C2C_LINK1_TOTAL_TX_PER_SEC "NVML_GPM_METRIC_C2C_LINK1_TOTAL_TX_PER_SEC" = 108 + NVML_GPM_METRIC_C2C_LINK1_TOTAL_RX_PER_SEC "NVML_GPM_METRIC_C2C_LINK1_TOTAL_RX_PER_SEC" = 109 + NVML_GPM_METRIC_C2C_LINK1_DATA_TX_PER_SEC "NVML_GPM_METRIC_C2C_LINK1_DATA_TX_PER_SEC" = 110 + NVML_GPM_METRIC_C2C_LINK1_DATA_RX_PER_SEC "NVML_GPM_METRIC_C2C_LINK1_DATA_RX_PER_SEC" = 111 + NVML_GPM_METRIC_C2C_LINK2_TOTAL_TX_PER_SEC "NVML_GPM_METRIC_C2C_LINK2_TOTAL_TX_PER_SEC" = 112 + NVML_GPM_METRIC_C2C_LINK2_TOTAL_RX_PER_SEC "NVML_GPM_METRIC_C2C_LINK2_TOTAL_RX_PER_SEC" = 113 + NVML_GPM_METRIC_C2C_LINK2_DATA_TX_PER_SEC "NVML_GPM_METRIC_C2C_LINK2_DATA_TX_PER_SEC" = 114 + NVML_GPM_METRIC_C2C_LINK2_DATA_RX_PER_SEC "NVML_GPM_METRIC_C2C_LINK2_DATA_RX_PER_SEC" = 115 + NVML_GPM_METRIC_C2C_LINK3_TOTAL_TX_PER_SEC "NVML_GPM_METRIC_C2C_LINK3_TOTAL_TX_PER_SEC" = 116 + NVML_GPM_METRIC_C2C_LINK3_TOTAL_RX_PER_SEC "NVML_GPM_METRIC_C2C_LINK3_TOTAL_RX_PER_SEC" = 117 + NVML_GPM_METRIC_C2C_LINK3_DATA_TX_PER_SEC "NVML_GPM_METRIC_C2C_LINK3_DATA_TX_PER_SEC" = 118 + NVML_GPM_METRIC_C2C_LINK3_DATA_RX_PER_SEC "NVML_GPM_METRIC_C2C_LINK3_DATA_RX_PER_SEC" = 119 + NVML_GPM_METRIC_C2C_LINK4_TOTAL_TX_PER_SEC "NVML_GPM_METRIC_C2C_LINK4_TOTAL_TX_PER_SEC" = 120 + NVML_GPM_METRIC_C2C_LINK4_TOTAL_RX_PER_SEC "NVML_GPM_METRIC_C2C_LINK4_TOTAL_RX_PER_SEC" = 121 + NVML_GPM_METRIC_C2C_LINK4_DATA_TX_PER_SEC "NVML_GPM_METRIC_C2C_LINK4_DATA_TX_PER_SEC" = 122 + NVML_GPM_METRIC_C2C_LINK4_DATA_RX_PER_SEC "NVML_GPM_METRIC_C2C_LINK4_DATA_RX_PER_SEC" = 123 + NVML_GPM_METRIC_C2C_LINK5_TOTAL_TX_PER_SEC "NVML_GPM_METRIC_C2C_LINK5_TOTAL_TX_PER_SEC" = 124 + NVML_GPM_METRIC_C2C_LINK5_TOTAL_RX_PER_SEC "NVML_GPM_METRIC_C2C_LINK5_TOTAL_RX_PER_SEC" = 125 + NVML_GPM_METRIC_C2C_LINK5_DATA_TX_PER_SEC "NVML_GPM_METRIC_C2C_LINK5_DATA_TX_PER_SEC" = 126 + NVML_GPM_METRIC_C2C_LINK5_DATA_RX_PER_SEC "NVML_GPM_METRIC_C2C_LINK5_DATA_RX_PER_SEC" = 127 + NVML_GPM_METRIC_C2C_LINK6_TOTAL_TX_PER_SEC "NVML_GPM_METRIC_C2C_LINK6_TOTAL_TX_PER_SEC" = 128 + NVML_GPM_METRIC_C2C_LINK6_TOTAL_RX_PER_SEC "NVML_GPM_METRIC_C2C_LINK6_TOTAL_RX_PER_SEC" = 129 + NVML_GPM_METRIC_C2C_LINK6_DATA_TX_PER_SEC "NVML_GPM_METRIC_C2C_LINK6_DATA_TX_PER_SEC" = 130 + NVML_GPM_METRIC_C2C_LINK6_DATA_RX_PER_SEC "NVML_GPM_METRIC_C2C_LINK6_DATA_RX_PER_SEC" = 131 + NVML_GPM_METRIC_C2C_LINK7_TOTAL_TX_PER_SEC "NVML_GPM_METRIC_C2C_LINK7_TOTAL_TX_PER_SEC" = 132 + NVML_GPM_METRIC_C2C_LINK7_TOTAL_RX_PER_SEC "NVML_GPM_METRIC_C2C_LINK7_TOTAL_RX_PER_SEC" = 133 + NVML_GPM_METRIC_C2C_LINK7_DATA_TX_PER_SEC "NVML_GPM_METRIC_C2C_LINK7_DATA_TX_PER_SEC" = 134 + NVML_GPM_METRIC_C2C_LINK7_DATA_RX_PER_SEC "NVML_GPM_METRIC_C2C_LINK7_DATA_RX_PER_SEC" = 135 + NVML_GPM_METRIC_C2C_LINK8_TOTAL_TX_PER_SEC "NVML_GPM_METRIC_C2C_LINK8_TOTAL_TX_PER_SEC" = 136 + NVML_GPM_METRIC_C2C_LINK8_TOTAL_RX_PER_SEC "NVML_GPM_METRIC_C2C_LINK8_TOTAL_RX_PER_SEC" = 137 + NVML_GPM_METRIC_C2C_LINK8_DATA_TX_PER_SEC "NVML_GPM_METRIC_C2C_LINK8_DATA_TX_PER_SEC" = 138 + NVML_GPM_METRIC_C2C_LINK8_DATA_RX_PER_SEC "NVML_GPM_METRIC_C2C_LINK8_DATA_RX_PER_SEC" = 139 + NVML_GPM_METRIC_C2C_LINK9_TOTAL_TX_PER_SEC "NVML_GPM_METRIC_C2C_LINK9_TOTAL_TX_PER_SEC" = 140 + NVML_GPM_METRIC_C2C_LINK9_TOTAL_RX_PER_SEC "NVML_GPM_METRIC_C2C_LINK9_TOTAL_RX_PER_SEC" = 141 + NVML_GPM_METRIC_C2C_LINK9_DATA_TX_PER_SEC "NVML_GPM_METRIC_C2C_LINK9_DATA_TX_PER_SEC" = 142 + NVML_GPM_METRIC_C2C_LINK9_DATA_RX_PER_SEC "NVML_GPM_METRIC_C2C_LINK9_DATA_RX_PER_SEC" = 143 + NVML_GPM_METRIC_C2C_LINK10_TOTAL_TX_PER_SEC "NVML_GPM_METRIC_C2C_LINK10_TOTAL_TX_PER_SEC" = 144 + NVML_GPM_METRIC_C2C_LINK10_TOTAL_RX_PER_SEC "NVML_GPM_METRIC_C2C_LINK10_TOTAL_RX_PER_SEC" = 145 + NVML_GPM_METRIC_C2C_LINK10_DATA_TX_PER_SEC "NVML_GPM_METRIC_C2C_LINK10_DATA_TX_PER_SEC" = 146 + NVML_GPM_METRIC_C2C_LINK10_DATA_RX_PER_SEC "NVML_GPM_METRIC_C2C_LINK10_DATA_RX_PER_SEC" = 147 + NVML_GPM_METRIC_C2C_LINK11_TOTAL_TX_PER_SEC "NVML_GPM_METRIC_C2C_LINK11_TOTAL_TX_PER_SEC" = 148 + NVML_GPM_METRIC_C2C_LINK11_TOTAL_RX_PER_SEC "NVML_GPM_METRIC_C2C_LINK11_TOTAL_RX_PER_SEC" = 149 + NVML_GPM_METRIC_C2C_LINK11_DATA_TX_PER_SEC "NVML_GPM_METRIC_C2C_LINK11_DATA_TX_PER_SEC" = 150 + NVML_GPM_METRIC_C2C_LINK11_DATA_RX_PER_SEC "NVML_GPM_METRIC_C2C_LINK11_DATA_RX_PER_SEC" = 151 + NVML_GPM_METRIC_C2C_LINK12_TOTAL_TX_PER_SEC "NVML_GPM_METRIC_C2C_LINK12_TOTAL_TX_PER_SEC" = 152 + NVML_GPM_METRIC_C2C_LINK12_TOTAL_RX_PER_SEC "NVML_GPM_METRIC_C2C_LINK12_TOTAL_RX_PER_SEC" = 153 + NVML_GPM_METRIC_C2C_LINK12_DATA_TX_PER_SEC "NVML_GPM_METRIC_C2C_LINK12_DATA_TX_PER_SEC" = 154 + NVML_GPM_METRIC_C2C_LINK12_DATA_RX_PER_SEC "NVML_GPM_METRIC_C2C_LINK12_DATA_RX_PER_SEC" = 155 + NVML_GPM_METRIC_C2C_LINK13_TOTAL_TX_PER_SEC "NVML_GPM_METRIC_C2C_LINK13_TOTAL_TX_PER_SEC" = 156 + NVML_GPM_METRIC_C2C_LINK13_TOTAL_RX_PER_SEC "NVML_GPM_METRIC_C2C_LINK13_TOTAL_RX_PER_SEC" = 157 + NVML_GPM_METRIC_C2C_LINK13_DATA_TX_PER_SEC "NVML_GPM_METRIC_C2C_LINK13_DATA_TX_PER_SEC" = 158 + NVML_GPM_METRIC_C2C_LINK13_DATA_RX_PER_SEC "NVML_GPM_METRIC_C2C_LINK13_DATA_RX_PER_SEC" = 159 + NVML_GPM_METRIC_HOSTMEM_CACHE_HIT "NVML_GPM_METRIC_HOSTMEM_CACHE_HIT" = 160 + NVML_GPM_METRIC_HOSTMEM_CACHE_MISS "NVML_GPM_METRIC_HOSTMEM_CACHE_MISS" = 161 + NVML_GPM_METRIC_PEERMEM_CACHE_HIT "NVML_GPM_METRIC_PEERMEM_CACHE_HIT" = 162 + NVML_GPM_METRIC_PEERMEM_CACHE_MISS "NVML_GPM_METRIC_PEERMEM_CACHE_MISS" = 163 + NVML_GPM_METRIC_DRAM_CACHE_HIT "NVML_GPM_METRIC_DRAM_CACHE_HIT" = 164 + NVML_GPM_METRIC_DRAM_CACHE_MISS "NVML_GPM_METRIC_DRAM_CACHE_MISS" = 165 + NVML_GPM_METRIC_NVENC_0_UTIL "NVML_GPM_METRIC_NVENC_0_UTIL" = 166 + NVML_GPM_METRIC_NVENC_1_UTIL "NVML_GPM_METRIC_NVENC_1_UTIL" = 167 + NVML_GPM_METRIC_NVENC_2_UTIL "NVML_GPM_METRIC_NVENC_2_UTIL" = 168 + NVML_GPM_METRIC_NVENC_3_UTIL "NVML_GPM_METRIC_NVENC_3_UTIL" = 169 + NVML_GPM_METRIC_GR0_CTXSW_CYCLES_ELAPSED "NVML_GPM_METRIC_GR0_CTXSW_CYCLES_ELAPSED" = 170 + NVML_GPM_METRIC_GR0_CTXSW_CYCLES_ACTIVE "NVML_GPM_METRIC_GR0_CTXSW_CYCLES_ACTIVE" = 171 + NVML_GPM_METRIC_GR0_CTXSW_REQUESTS "NVML_GPM_METRIC_GR0_CTXSW_REQUESTS" = 172 + NVML_GPM_METRIC_GR0_CTXSW_CYCLES_PER_REQ "NVML_GPM_METRIC_GR0_CTXSW_CYCLES_PER_REQ" = 173 + NVML_GPM_METRIC_GR0_CTXSW_ACTIVE_PCT "NVML_GPM_METRIC_GR0_CTXSW_ACTIVE_PCT" = 174 + NVML_GPM_METRIC_GR1_CTXSW_CYCLES_ELAPSED "NVML_GPM_METRIC_GR1_CTXSW_CYCLES_ELAPSED" = 175 + NVML_GPM_METRIC_GR1_CTXSW_CYCLES_ACTIVE "NVML_GPM_METRIC_GR1_CTXSW_CYCLES_ACTIVE" = 176 + NVML_GPM_METRIC_GR1_CTXSW_REQUESTS "NVML_GPM_METRIC_GR1_CTXSW_REQUESTS" = 177 + NVML_GPM_METRIC_GR1_CTXSW_CYCLES_PER_REQ "NVML_GPM_METRIC_GR1_CTXSW_CYCLES_PER_REQ" = 178 + NVML_GPM_METRIC_GR1_CTXSW_ACTIVE_PCT "NVML_GPM_METRIC_GR1_CTXSW_ACTIVE_PCT" = 179 + NVML_GPM_METRIC_GR2_CTXSW_CYCLES_ELAPSED "NVML_GPM_METRIC_GR2_CTXSW_CYCLES_ELAPSED" = 180 + NVML_GPM_METRIC_GR2_CTXSW_CYCLES_ACTIVE "NVML_GPM_METRIC_GR2_CTXSW_CYCLES_ACTIVE" = 181 + NVML_GPM_METRIC_GR2_CTXSW_REQUESTS "NVML_GPM_METRIC_GR2_CTXSW_REQUESTS" = 182 + NVML_GPM_METRIC_GR2_CTXSW_CYCLES_PER_REQ "NVML_GPM_METRIC_GR2_CTXSW_CYCLES_PER_REQ" = 183 + NVML_GPM_METRIC_GR2_CTXSW_ACTIVE_PCT "NVML_GPM_METRIC_GR2_CTXSW_ACTIVE_PCT" = 184 + NVML_GPM_METRIC_GR3_CTXSW_CYCLES_ELAPSED "NVML_GPM_METRIC_GR3_CTXSW_CYCLES_ELAPSED" = 185 + NVML_GPM_METRIC_GR3_CTXSW_CYCLES_ACTIVE "NVML_GPM_METRIC_GR3_CTXSW_CYCLES_ACTIVE" = 186 + NVML_GPM_METRIC_GR3_CTXSW_REQUESTS "NVML_GPM_METRIC_GR3_CTXSW_REQUESTS" = 187 + NVML_GPM_METRIC_GR3_CTXSW_CYCLES_PER_REQ "NVML_GPM_METRIC_GR3_CTXSW_CYCLES_PER_REQ" = 188 + NVML_GPM_METRIC_GR3_CTXSW_ACTIVE_PCT "NVML_GPM_METRIC_GR3_CTXSW_ACTIVE_PCT" = 189 + NVML_GPM_METRIC_GR4_CTXSW_CYCLES_ELAPSED "NVML_GPM_METRIC_GR4_CTXSW_CYCLES_ELAPSED" = 190 + NVML_GPM_METRIC_GR4_CTXSW_CYCLES_ACTIVE "NVML_GPM_METRIC_GR4_CTXSW_CYCLES_ACTIVE" = 191 + NVML_GPM_METRIC_GR4_CTXSW_REQUESTS "NVML_GPM_METRIC_GR4_CTXSW_REQUESTS" = 192 + NVML_GPM_METRIC_GR4_CTXSW_CYCLES_PER_REQ "NVML_GPM_METRIC_GR4_CTXSW_CYCLES_PER_REQ" = 193 + NVML_GPM_METRIC_GR4_CTXSW_ACTIVE_PCT "NVML_GPM_METRIC_GR4_CTXSW_ACTIVE_PCT" = 194 + NVML_GPM_METRIC_GR5_CTXSW_CYCLES_ELAPSED "NVML_GPM_METRIC_GR5_CTXSW_CYCLES_ELAPSED" = 195 + NVML_GPM_METRIC_GR5_CTXSW_CYCLES_ACTIVE "NVML_GPM_METRIC_GR5_CTXSW_CYCLES_ACTIVE" = 196 + NVML_GPM_METRIC_GR5_CTXSW_REQUESTS "NVML_GPM_METRIC_GR5_CTXSW_REQUESTS" = 197 + NVML_GPM_METRIC_GR5_CTXSW_CYCLES_PER_REQ "NVML_GPM_METRIC_GR5_CTXSW_CYCLES_PER_REQ" = 198 + NVML_GPM_METRIC_GR5_CTXSW_ACTIVE_PCT "NVML_GPM_METRIC_GR5_CTXSW_ACTIVE_PCT" = 199 + NVML_GPM_METRIC_GR6_CTXSW_CYCLES_ELAPSED "NVML_GPM_METRIC_GR6_CTXSW_CYCLES_ELAPSED" = 200 + NVML_GPM_METRIC_GR6_CTXSW_CYCLES_ACTIVE "NVML_GPM_METRIC_GR6_CTXSW_CYCLES_ACTIVE" = 201 + NVML_GPM_METRIC_GR6_CTXSW_REQUESTS "NVML_GPM_METRIC_GR6_CTXSW_REQUESTS" = 202 + NVML_GPM_METRIC_GR6_CTXSW_CYCLES_PER_REQ "NVML_GPM_METRIC_GR6_CTXSW_CYCLES_PER_REQ" = 203 + NVML_GPM_METRIC_GR6_CTXSW_ACTIVE_PCT "NVML_GPM_METRIC_GR6_CTXSW_ACTIVE_PCT" = 204 + NVML_GPM_METRIC_GR7_CTXSW_CYCLES_ELAPSED "NVML_GPM_METRIC_GR7_CTXSW_CYCLES_ELAPSED" = 205 + NVML_GPM_METRIC_GR7_CTXSW_CYCLES_ACTIVE "NVML_GPM_METRIC_GR7_CTXSW_CYCLES_ACTIVE" = 206 + NVML_GPM_METRIC_GR7_CTXSW_REQUESTS "NVML_GPM_METRIC_GR7_CTXSW_REQUESTS" = 207 + NVML_GPM_METRIC_GR7_CTXSW_CYCLES_PER_REQ "NVML_GPM_METRIC_GR7_CTXSW_CYCLES_PER_REQ" = 208 + NVML_GPM_METRIC_GR7_CTXSW_ACTIVE_PCT "NVML_GPM_METRIC_GR7_CTXSW_ACTIVE_PCT" = 209 + NVML_GPM_METRIC_NVLINK_L18_RX_PER_SEC "NVML_GPM_METRIC_NVLINK_L18_RX_PER_SEC" = 212 + NVML_GPM_METRIC_NVLINK_L18_TX_PER_SEC "NVML_GPM_METRIC_NVLINK_L18_TX_PER_SEC" = 213 + NVML_GPM_METRIC_NVLINK_L19_RX_PER_SEC "NVML_GPM_METRIC_NVLINK_L19_RX_PER_SEC" = 214 + NVML_GPM_METRIC_NVLINK_L19_TX_PER_SEC "NVML_GPM_METRIC_NVLINK_L19_TX_PER_SEC" = 215 + NVML_GPM_METRIC_NVLINK_L20_RX_PER_SEC "NVML_GPM_METRIC_NVLINK_L20_RX_PER_SEC" = 216 + NVML_GPM_METRIC_NVLINK_L20_TX_PER_SEC "NVML_GPM_METRIC_NVLINK_L20_TX_PER_SEC" = 217 + NVML_GPM_METRIC_NVLINK_L21_RX_PER_SEC "NVML_GPM_METRIC_NVLINK_L21_RX_PER_SEC" = 218 + NVML_GPM_METRIC_NVLINK_L21_TX_PER_SEC "NVML_GPM_METRIC_NVLINK_L21_TX_PER_SEC" = 219 + NVML_GPM_METRIC_NVLINK_L22_RX_PER_SEC "NVML_GPM_METRIC_NVLINK_L22_RX_PER_SEC" = 220 + NVML_GPM_METRIC_NVLINK_L22_TX_PER_SEC "NVML_GPM_METRIC_NVLINK_L22_TX_PER_SEC" = 221 + NVML_GPM_METRIC_NVLINK_L23_RX_PER_SEC "NVML_GPM_METRIC_NVLINK_L23_RX_PER_SEC" = 222 + NVML_GPM_METRIC_NVLINK_L23_TX_PER_SEC "NVML_GPM_METRIC_NVLINK_L23_TX_PER_SEC" = 223 + NVML_GPM_METRIC_NVLINK_L24_RX_PER_SEC "NVML_GPM_METRIC_NVLINK_L24_RX_PER_SEC" = 224 + NVML_GPM_METRIC_NVLINK_L24_TX_PER_SEC "NVML_GPM_METRIC_NVLINK_L24_TX_PER_SEC" = 225 + NVML_GPM_METRIC_NVLINK_L25_RX_PER_SEC "NVML_GPM_METRIC_NVLINK_L25_RX_PER_SEC" = 226 + NVML_GPM_METRIC_NVLINK_L25_TX_PER_SEC "NVML_GPM_METRIC_NVLINK_L25_TX_PER_SEC" = 227 + NVML_GPM_METRIC_NVLINK_L26_RX_PER_SEC "NVML_GPM_METRIC_NVLINK_L26_RX_PER_SEC" = 228 + NVML_GPM_METRIC_NVLINK_L26_TX_PER_SEC "NVML_GPM_METRIC_NVLINK_L26_TX_PER_SEC" = 229 + NVML_GPM_METRIC_NVLINK_L27_RX_PER_SEC "NVML_GPM_METRIC_NVLINK_L27_RX_PER_SEC" = 230 + NVML_GPM_METRIC_NVLINK_L27_TX_PER_SEC "NVML_GPM_METRIC_NVLINK_L27_TX_PER_SEC" = 231 + NVML_GPM_METRIC_NVLINK_L28_RX_PER_SEC "NVML_GPM_METRIC_NVLINK_L28_RX_PER_SEC" = 232 + NVML_GPM_METRIC_NVLINK_L28_TX_PER_SEC "NVML_GPM_METRIC_NVLINK_L28_TX_PER_SEC" = 233 + NVML_GPM_METRIC_NVLINK_L29_RX_PER_SEC "NVML_GPM_METRIC_NVLINK_L29_RX_PER_SEC" = 234 + NVML_GPM_METRIC_NVLINK_L29_TX_PER_SEC "NVML_GPM_METRIC_NVLINK_L29_TX_PER_SEC" = 235 + NVML_GPM_METRIC_NVLINK_L30_RX_PER_SEC "NVML_GPM_METRIC_NVLINK_L30_RX_PER_SEC" = 236 + NVML_GPM_METRIC_NVLINK_L30_TX_PER_SEC "NVML_GPM_METRIC_NVLINK_L30_TX_PER_SEC" = 237 + NVML_GPM_METRIC_NVLINK_L31_RX_PER_SEC "NVML_GPM_METRIC_NVLINK_L31_RX_PER_SEC" = 238 + NVML_GPM_METRIC_NVLINK_L31_TX_PER_SEC "NVML_GPM_METRIC_NVLINK_L31_TX_PER_SEC" = 239 + NVML_GPM_METRIC_NVLINK_L32_RX_PER_SEC "NVML_GPM_METRIC_NVLINK_L32_RX_PER_SEC" = 240 + NVML_GPM_METRIC_NVLINK_L32_TX_PER_SEC "NVML_GPM_METRIC_NVLINK_L32_TX_PER_SEC" = 241 + NVML_GPM_METRIC_NVLINK_L33_RX_PER_SEC "NVML_GPM_METRIC_NVLINK_L33_RX_PER_SEC" = 242 + NVML_GPM_METRIC_NVLINK_L33_TX_PER_SEC "NVML_GPM_METRIC_NVLINK_L33_TX_PER_SEC" = 243 + NVML_GPM_METRIC_NVLINK_L34_RX_PER_SEC "NVML_GPM_METRIC_NVLINK_L34_RX_PER_SEC" = 244 + NVML_GPM_METRIC_NVLINK_L34_TX_PER_SEC "NVML_GPM_METRIC_NVLINK_L34_TX_PER_SEC" = 245 + NVML_GPM_METRIC_NVLINK_L35_RX_PER_SEC "NVML_GPM_METRIC_NVLINK_L35_RX_PER_SEC" = 246 + NVML_GPM_METRIC_NVLINK_L35_TX_PER_SEC "NVML_GPM_METRIC_NVLINK_L35_TX_PER_SEC" = 247 + NVML_GPM_METRIC_SM_CYCLES_ELAPSED "NVML_GPM_METRIC_SM_CYCLES_ELAPSED" = 248 + NVML_GPM_METRIC_SM_CYCLES_ACTIVE "NVML_GPM_METRIC_SM_CYCLES_ACTIVE" = 249 + NVML_GPM_METRIC_MMA_CYCLES_ACTIVE "NVML_GPM_METRIC_MMA_CYCLES_ACTIVE" = 250 + NVML_GPM_METRIC_DMMA_CYCLES_ACTIVE "NVML_GPM_METRIC_DMMA_CYCLES_ACTIVE" = 251 + NVML_GPM_METRIC_HMMA_CYCLES_ACTIVE "NVML_GPM_METRIC_HMMA_CYCLES_ACTIVE" = 252 + NVML_GPM_METRIC_IMMA_CYCLES_ACTIVE "NVML_GPM_METRIC_IMMA_CYCLES_ACTIVE" = 253 + NVML_GPM_METRIC_DFMA_CYCLES_ACTIVE "NVML_GPM_METRIC_DFMA_CYCLES_ACTIVE" = 254 + NVML_GPM_METRIC_PCIE_TX "NVML_GPM_METRIC_PCIE_TX" = 255 + NVML_GPM_METRIC_PCIE_RX "NVML_GPM_METRIC_PCIE_RX" = 256 + NVML_GPM_METRIC_INTEGER_CYCLES_ACTIVE "NVML_GPM_METRIC_INTEGER_CYCLES_ACTIVE" = 257 + NVML_GPM_METRIC_FP64_CYCLES_ACTIVE "NVML_GPM_METRIC_FP64_CYCLES_ACTIVE" = 258 + NVML_GPM_METRIC_FP32_CYCLES_ACTIVE "NVML_GPM_METRIC_FP32_CYCLES_ACTIVE" = 259 + NVML_GPM_METRIC_FP16_CYCLES_ACTIVE "NVML_GPM_METRIC_FP16_CYCLES_ACTIVE" = 260 + NVML_GPM_METRIC_NVLINK_L0_RX "NVML_GPM_METRIC_NVLINK_L0_RX" = 261 + NVML_GPM_METRIC_NVLINK_L0_TX "NVML_GPM_METRIC_NVLINK_L0_TX" = 262 + NVML_GPM_METRIC_NVLINK_L1_RX "NVML_GPM_METRIC_NVLINK_L1_RX" = 263 + NVML_GPM_METRIC_NVLINK_L1_TX "NVML_GPM_METRIC_NVLINK_L1_TX" = 264 + NVML_GPM_METRIC_NVLINK_L2_RX "NVML_GPM_METRIC_NVLINK_L2_RX" = 265 + NVML_GPM_METRIC_NVLINK_L2_TX "NVML_GPM_METRIC_NVLINK_L2_TX" = 266 + NVML_GPM_METRIC_NVLINK_L3_RX "NVML_GPM_METRIC_NVLINK_L3_RX" = 267 + NVML_GPM_METRIC_NVLINK_L3_TX "NVML_GPM_METRIC_NVLINK_L3_TX" = 268 + NVML_GPM_METRIC_NVLINK_L4_RX "NVML_GPM_METRIC_NVLINK_L4_RX" = 269 + NVML_GPM_METRIC_NVLINK_L4_TX "NVML_GPM_METRIC_NVLINK_L4_TX" = 270 + NVML_GPM_METRIC_NVLINK_L5_RX "NVML_GPM_METRIC_NVLINK_L5_RX" = 271 + NVML_GPM_METRIC_NVLINK_L5_TX "NVML_GPM_METRIC_NVLINK_L5_TX" = 272 + NVML_GPM_METRIC_NVLINK_L6_RX "NVML_GPM_METRIC_NVLINK_L6_RX" = 273 + NVML_GPM_METRIC_NVLINK_L6_TX "NVML_GPM_METRIC_NVLINK_L6_TX" = 274 + NVML_GPM_METRIC_NVLINK_L7_RX "NVML_GPM_METRIC_NVLINK_L7_RX" = 275 + NVML_GPM_METRIC_NVLINK_L7_TX "NVML_GPM_METRIC_NVLINK_L7_TX" = 276 + NVML_GPM_METRIC_NVLINK_L8_RX "NVML_GPM_METRIC_NVLINK_L8_RX" = 277 + NVML_GPM_METRIC_NVLINK_L8_TX "NVML_GPM_METRIC_NVLINK_L8_TX" = 278 + NVML_GPM_METRIC_NVLINK_L9_RX "NVML_GPM_METRIC_NVLINK_L9_RX" = 279 + NVML_GPM_METRIC_NVLINK_L9_TX "NVML_GPM_METRIC_NVLINK_L9_TX" = 280 + NVML_GPM_METRIC_NVLINK_L10_RX "NVML_GPM_METRIC_NVLINK_L10_RX" = 281 + NVML_GPM_METRIC_NVLINK_L10_TX "NVML_GPM_METRIC_NVLINK_L10_TX" = 282 + NVML_GPM_METRIC_NVLINK_L11_RX "NVML_GPM_METRIC_NVLINK_L11_RX" = 283 + NVML_GPM_METRIC_NVLINK_L11_TX "NVML_GPM_METRIC_NVLINK_L11_TX" = 284 + NVML_GPM_METRIC_NVLINK_L12_RX "NVML_GPM_METRIC_NVLINK_L12_RX" = 285 + NVML_GPM_METRIC_NVLINK_L12_TX "NVML_GPM_METRIC_NVLINK_L12_TX" = 286 + NVML_GPM_METRIC_NVLINK_L13_RX "NVML_GPM_METRIC_NVLINK_L13_RX" = 287 + NVML_GPM_METRIC_NVLINK_L13_TX "NVML_GPM_METRIC_NVLINK_L13_TX" = 288 + NVML_GPM_METRIC_NVLINK_L14_RX "NVML_GPM_METRIC_NVLINK_L14_RX" = 289 + NVML_GPM_METRIC_NVLINK_L14_TX "NVML_GPM_METRIC_NVLINK_L14_TX" = 290 + NVML_GPM_METRIC_NVLINK_L15_RX "NVML_GPM_METRIC_NVLINK_L15_RX" = 291 + NVML_GPM_METRIC_NVLINK_L15_TX "NVML_GPM_METRIC_NVLINK_L15_TX" = 292 + NVML_GPM_METRIC_NVLINK_L16_RX "NVML_GPM_METRIC_NVLINK_L16_RX" = 293 + NVML_GPM_METRIC_NVLINK_L16_TX "NVML_GPM_METRIC_NVLINK_L16_TX" = 294 + NVML_GPM_METRIC_NVLINK_L17_RX "NVML_GPM_METRIC_NVLINK_L17_RX" = 295 + NVML_GPM_METRIC_NVLINK_L17_TX "NVML_GPM_METRIC_NVLINK_L17_TX" = 296 + NVML_GPM_METRIC_NVLINK_L18_RX "NVML_GPM_METRIC_NVLINK_L18_RX" = 297 + NVML_GPM_METRIC_NVLINK_L18_TX "NVML_GPM_METRIC_NVLINK_L18_TX" = 298 + NVML_GPM_METRIC_NVLINK_L19_RX "NVML_GPM_METRIC_NVLINK_L19_RX" = 299 + NVML_GPM_METRIC_NVLINK_L19_TX "NVML_GPM_METRIC_NVLINK_L19_TX" = 300 + NVML_GPM_METRIC_NVLINK_L20_RX "NVML_GPM_METRIC_NVLINK_L20_RX" = 301 + NVML_GPM_METRIC_NVLINK_L20_TX "NVML_GPM_METRIC_NVLINK_L20_TX" = 302 + NVML_GPM_METRIC_NVLINK_L21_RX "NVML_GPM_METRIC_NVLINK_L21_RX" = 303 + NVML_GPM_METRIC_NVLINK_L21_TX "NVML_GPM_METRIC_NVLINK_L21_TX" = 304 + NVML_GPM_METRIC_NVLINK_L22_RX "NVML_GPM_METRIC_NVLINK_L22_RX" = 305 + NVML_GPM_METRIC_NVLINK_L22_TX "NVML_GPM_METRIC_NVLINK_L22_TX" = 306 + NVML_GPM_METRIC_NVLINK_L23_RX "NVML_GPM_METRIC_NVLINK_L23_RX" = 307 + NVML_GPM_METRIC_NVLINK_L23_TX "NVML_GPM_METRIC_NVLINK_L23_TX" = 308 + NVML_GPM_METRIC_NVLINK_L24_RX "NVML_GPM_METRIC_NVLINK_L24_RX" = 309 + NVML_GPM_METRIC_NVLINK_L24_TX "NVML_GPM_METRIC_NVLINK_L24_TX" = 310 + NVML_GPM_METRIC_NVLINK_L25_RX "NVML_GPM_METRIC_NVLINK_L25_RX" = 311 + NVML_GPM_METRIC_NVLINK_L25_TX "NVML_GPM_METRIC_NVLINK_L25_TX" = 312 + NVML_GPM_METRIC_NVLINK_L26_RX "NVML_GPM_METRIC_NVLINK_L26_RX" = 313 + NVML_GPM_METRIC_NVLINK_L26_TX "NVML_GPM_METRIC_NVLINK_L26_TX" = 314 + NVML_GPM_METRIC_NVLINK_L27_RX "NVML_GPM_METRIC_NVLINK_L27_RX" = 315 + NVML_GPM_METRIC_NVLINK_L27_TX "NVML_GPM_METRIC_NVLINK_L27_TX" = 316 + NVML_GPM_METRIC_NVLINK_L28_RX "NVML_GPM_METRIC_NVLINK_L28_RX" = 317 + NVML_GPM_METRIC_NVLINK_L28_TX "NVML_GPM_METRIC_NVLINK_L28_TX" = 318 + NVML_GPM_METRIC_NVLINK_L29_RX "NVML_GPM_METRIC_NVLINK_L29_RX" = 319 + NVML_GPM_METRIC_NVLINK_L29_TX "NVML_GPM_METRIC_NVLINK_L29_TX" = 320 + NVML_GPM_METRIC_NVLINK_L30_RX "NVML_GPM_METRIC_NVLINK_L30_RX" = 321 + NVML_GPM_METRIC_NVLINK_L30_TX "NVML_GPM_METRIC_NVLINK_L30_TX" = 322 + NVML_GPM_METRIC_NVLINK_L31_RX "NVML_GPM_METRIC_NVLINK_L31_RX" = 323 + NVML_GPM_METRIC_NVLINK_L31_TX "NVML_GPM_METRIC_NVLINK_L31_TX" = 324 + NVML_GPM_METRIC_NVLINK_L32_RX "NVML_GPM_METRIC_NVLINK_L32_RX" = 325 + NVML_GPM_METRIC_NVLINK_L32_TX "NVML_GPM_METRIC_NVLINK_L32_TX" = 326 + NVML_GPM_METRIC_NVLINK_L33_RX "NVML_GPM_METRIC_NVLINK_L33_RX" = 327 + NVML_GPM_METRIC_NVLINK_L33_TX "NVML_GPM_METRIC_NVLINK_L33_TX" = 328 + NVML_GPM_METRIC_NVLINK_L34_RX "NVML_GPM_METRIC_NVLINK_L34_RX" = 329 + NVML_GPM_METRIC_NVLINK_L34_TX "NVML_GPM_METRIC_NVLINK_L34_TX" = 330 + NVML_GPM_METRIC_NVLINK_L35_RX "NVML_GPM_METRIC_NVLINK_L35_RX" = 331 + NVML_GPM_METRIC_NVLINK_L35_TX "NVML_GPM_METRIC_NVLINK_L35_TX" = 332 + NVML_GPM_METRIC_MAX "NVML_GPM_METRIC_MAX" = 333 + +ctypedef enum nvmlPowerProfileType_t "nvmlPowerProfileType_t": + NVML_POWER_PROFILE_MAX_P "NVML_POWER_PROFILE_MAX_P" = 0 + NVML_POWER_PROFILE_MAX_Q "NVML_POWER_PROFILE_MAX_Q" = 1 + NVML_POWER_PROFILE_COMPUTE "NVML_POWER_PROFILE_COMPUTE" = 2 + NVML_POWER_PROFILE_MEMORY_BOUND "NVML_POWER_PROFILE_MEMORY_BOUND" = 3 + NVML_POWER_PROFILE_NETWORK "NVML_POWER_PROFILE_NETWORK" = 4 + NVML_POWER_PROFILE_BALANCED "NVML_POWER_PROFILE_BALANCED" = 5 + NVML_POWER_PROFILE_LLM_INFERENCE "NVML_POWER_PROFILE_LLM_INFERENCE" = 6 + NVML_POWER_PROFILE_LLM_TRAINING "NVML_POWER_PROFILE_LLM_TRAINING" = 7 + NVML_POWER_PROFILE_RBM "NVML_POWER_PROFILE_RBM" = 8 + NVML_POWER_PROFILE_DCPCIE "NVML_POWER_PROFILE_DCPCIE" = 9 + NVML_POWER_PROFILE_HMMA_SPARSE "NVML_POWER_PROFILE_HMMA_SPARSE" = 10 + NVML_POWER_PROFILE_HMMA_DENSE "NVML_POWER_PROFILE_HMMA_DENSE" = 11 + NVML_POWER_PROFILE_SYNC_BALANCED "NVML_POWER_PROFILE_SYNC_BALANCED" = 12 + NVML_POWER_PROFILE_HPC "NVML_POWER_PROFILE_HPC" = 13 + NVML_POWER_PROFILE_MIG "NVML_POWER_PROFILE_MIG" = 14 + NVML_POWER_PROFILE_MAX "NVML_POWER_PROFILE_MAX" = 15 + +ctypedef enum nvmlDeviceAddressingModeType_t "nvmlDeviceAddressingModeType_t": + NVML_DEVICE_ADDRESSING_MODE_NONE "NVML_DEVICE_ADDRESSING_MODE_NONE" = 0 + NVML_DEVICE_ADDRESSING_MODE_HMM "NVML_DEVICE_ADDRESSING_MODE_HMM" = 1 + NVML_DEVICE_ADDRESSING_MODE_ATS "NVML_DEVICE_ADDRESSING_MODE_ATS" = 2 + +ctypedef enum nvmlPRMCounterId_t "nvmlPRMCounterId_t": + NVML_PRM_COUNTER_ID_NONE "NVML_PRM_COUNTER_ID_NONE" = 0 + NVML_PRM_COUNTER_ID_PPCNT_PHYSICAL_LAYER_CTRS_LINK_DOWN_EVENTS "NVML_PRM_COUNTER_ID_PPCNT_PHYSICAL_LAYER_CTRS_LINK_DOWN_EVENTS" = 1 + NVML_PRM_COUNTER_ID_PPCNT_PHYSICAL_LAYER_CTRS_SUCCESSFUL_RECOVERY_EVENTS "NVML_PRM_COUNTER_ID_PPCNT_PHYSICAL_LAYER_CTRS_SUCCESSFUL_RECOVERY_EVENTS" = 2 + NVML_PRM_COUNTER_ID_PPCNT_RECOVERY_CTRS_TOTAL_SUCCESSFUL_RECOVERY_EVENTS "NVML_PRM_COUNTER_ID_PPCNT_RECOVERY_CTRS_TOTAL_SUCCESSFUL_RECOVERY_EVENTS" = 101 + NVML_PRM_COUNTER_ID_PPCNT_RECOVERY_CTRS_TIME_SINCE_LAST_RECOVERY "NVML_PRM_COUNTER_ID_PPCNT_RECOVERY_CTRS_TIME_SINCE_LAST_RECOVERY" = 102 + NVML_PRM_COUNTER_ID_PPCNT_RECOVERY_CTRS_TIME_BETWEEN_LAST_TWO_RECOVERIES "NVML_PRM_COUNTER_ID_PPCNT_RECOVERY_CTRS_TIME_BETWEEN_LAST_TWO_RECOVERIES" = 103 + NVML_PRM_COUNTER_ID_PPCNT_PORTCOUNTERS_PORT_XMIT_WAIT "NVML_PRM_COUNTER_ID_PPCNT_PORTCOUNTERS_PORT_XMIT_WAIT" = 201 + NVML_PRM_COUNTER_ID_PPCNT_PLR_RCV_CODES "NVML_PRM_COUNTER_ID_PPCNT_PLR_RCV_CODES" = 301 + NVML_PRM_COUNTER_ID_PPCNT_PLR_RCV_CODE_ERR "NVML_PRM_COUNTER_ID_PPCNT_PLR_RCV_CODE_ERR" = 302 + NVML_PRM_COUNTER_ID_PPCNT_PLR_RCV_UNCORRECTABLE_CODE "NVML_PRM_COUNTER_ID_PPCNT_PLR_RCV_UNCORRECTABLE_CODE" = 303 + NVML_PRM_COUNTER_ID_PPCNT_PLR_XMIT_CODES "NVML_PRM_COUNTER_ID_PPCNT_PLR_XMIT_CODES" = 304 + NVML_PRM_COUNTER_ID_PPCNT_PLR_XMIT_RETRY_CODES "NVML_PRM_COUNTER_ID_PPCNT_PLR_XMIT_RETRY_CODES" = 305 + NVML_PRM_COUNTER_ID_PPCNT_PLR_XMIT_RETRY_EVENTS "NVML_PRM_COUNTER_ID_PPCNT_PLR_XMIT_RETRY_EVENTS" = 306 + NVML_PRM_COUNTER_ID_PPCNT_PLR_SYNC_EVENTS "NVML_PRM_COUNTER_ID_PPCNT_PLR_SYNC_EVENTS" = 307 + NVML_PRM_COUNTER_ID_PPRM_OPER_RECOVERY "NVML_PRM_COUNTER_ID_PPRM_OPER_RECOVERY" = 1001 + +ctypedef enum nvmlPowerProfileOperation_t "nvmlPowerProfileOperation_t": + NVML_POWER_PROFILE_OPERATION_CLEAR "NVML_POWER_PROFILE_OPERATION_CLEAR" = 0 + NVML_POWER_PROFILE_OPERATION_SET "NVML_POWER_PROFILE_OPERATION_SET" = 1 + NVML_POWER_PROFILE_OPERATION_SET_AND_OVERWRITE "NVML_POWER_PROFILE_OPERATION_SET_AND_OVERWRITE" = 2 + NVML_POWER_PROFILE_OPERATION_MAX "NVML_POWER_PROFILE_OPERATION_MAX" = 3 + +ctypedef enum nvmlProcessMode_t "nvmlProcessMode_t": + NVML_PROCESS_MODE_COMPUTE "NVML_PROCESS_MODE_COMPUTE" = 0 + NVML_PROCESS_MODE_GRAPHICS "NVML_PROCESS_MODE_GRAPHICS" = 1 + NVML_PROCESS_MODE_MPS "NVML_PROCESS_MODE_MPS" = 2 + NVML_PROCESS_MODE_ALL "NVML_PROCESS_MODE_ALL" = 3 + NVML_PROCESS_MODE_MAX "NVML_PROCESS_MODE_MAX" = (NVML_PROCESS_MODE_ALL + 1) + +ctypedef enum nvmlCPERType_t "nvmlCPERType_t": + NVML_CPER_ACCESS_TYPE_GPU "NVML_CPER_ACCESS_TYPE_GPU" = (1 << 0) + + +# types +ctypedef struct nvmlPciInfoExt_v1_t 'nvmlPciInfoExt_v1_t': + unsigned int version + unsigned int domain + unsigned int bus + unsigned int device + unsigned int pciDeviceId + unsigned int pciSubSystemId + unsigned int baseClass + unsigned int subClass + char busId[32] + +ctypedef struct nvmlCoolerInfo_v1_t 'nvmlCoolerInfo_v1_t': + unsigned int version + unsigned int index + nvmlCoolerControl_t signalType + nvmlCoolerTarget_t target + +ctypedef struct nvmlDramEncryptionInfo_v1_t 'nvmlDramEncryptionInfo_v1_t': + unsigned int version + nvmlEnableState_t encryptionState + +ctypedef struct nvmlMarginTemperature_v1_t 'nvmlMarginTemperature_v1_t': + unsigned int version + int marginTemperature + +ctypedef struct nvmlClockOffset_v1_t 'nvmlClockOffset_v1_t': + unsigned int version + nvmlClockType_t type + nvmlPstates_t pstate + int clockOffsetMHz + int minClockOffsetMHz + int maxClockOffsetMHz + +ctypedef struct nvmlFanSpeedInfo_v1_t 'nvmlFanSpeedInfo_v1_t': + unsigned int version + unsigned int fan + unsigned int speed + +ctypedef struct nvmlDevicePerfModes_v1_t 'nvmlDevicePerfModes_v1_t': + unsigned int version + char str[2048] + +ctypedef struct nvmlDeviceCurrentClockFreqs_v1_t 'nvmlDeviceCurrentClockFreqs_v1_t': + unsigned int version + char str[2048] + +ctypedef struct nvmlEccSramErrorStatus_v1_t 'nvmlEccSramErrorStatus_v1_t': + unsigned int version + unsigned long long aggregateUncParity + unsigned long long aggregateUncSecDed + unsigned long long aggregateCor + unsigned long long volatileUncParity + unsigned long long volatileUncSecDed + unsigned long long volatileCor + unsigned long long aggregateUncBucketL2 + unsigned long long aggregateUncBucketSm + unsigned long long aggregateUncBucketPcie + unsigned long long aggregateUncBucketMcu + unsigned long long aggregateUncBucketOther + unsigned int bThresholdExceeded + +ctypedef struct nvmlPlatformInfo_v2_t 'nvmlPlatformInfo_v2_t': + unsigned int version + unsigned char ibGuid[16] + unsigned char chassisSerialNumber[16] + unsigned char slotNumber + unsigned char trayIndex + unsigned char hostId + unsigned char peerType + unsigned char moduleId + +ctypedef unsigned int nvmlDeviceArchitecture_t 'nvmlDeviceArchitecture_t' + +ctypedef unsigned int nvmlBusType_t 'nvmlBusType_t' + +ctypedef unsigned int nvmlFanControlPolicy_t 'nvmlFanControlPolicy_t' + +ctypedef unsigned int nvmlPowerSource_t 'nvmlPowerSource_t' + +ctypedef unsigned char nvmlPowerScopeType_t 'nvmlPowerScopeType_t' + +ctypedef unsigned int nvmlVgpuTypeId_t 'nvmlVgpuTypeId_t' + +ctypedef unsigned int nvmlVgpuInstance_t 'nvmlVgpuInstance_t' + +ctypedef struct nvmlVgpuHeterogeneousMode_v1_t 'nvmlVgpuHeterogeneousMode_v1_t': + unsigned int version + unsigned int mode + +ctypedef struct nvmlVgpuPlacementId_v1_t 'nvmlVgpuPlacementId_v1_t': + unsigned int version + unsigned int placementId + +ctypedef struct nvmlVgpuPlacementList_v2_t 'nvmlVgpuPlacementList_v2_t': + unsigned int version + unsigned int placementSize + unsigned int count + unsigned int* placementIds + unsigned int mode + +ctypedef struct nvmlVgpuTypeBar1Info_v1_t 'nvmlVgpuTypeBar1Info_v1_t': + unsigned int version + unsigned long long bar1Size + +ctypedef struct nvmlVgpuRuntimeState_v1_t 'nvmlVgpuRuntimeState_v1_t': + unsigned int version + unsigned long long size + +ctypedef struct nvmlSystemConfComputeSettings_v1_t 'nvmlSystemConfComputeSettings_v1_t': + unsigned int version + unsigned int environment + unsigned int ccFeature + unsigned int devToolsMode + unsigned int multiGpuMode + +ctypedef struct nvmlConfComputeSetKeyRotationThresholdInfo_v1_t 'nvmlConfComputeSetKeyRotationThresholdInfo_v1_t': + unsigned int version + unsigned long long maxAttackerAdvantage + +ctypedef struct nvmlConfComputeGetKeyRotationThresholdInfo_v1_t 'nvmlConfComputeGetKeyRotationThresholdInfo_v1_t': + unsigned int version + unsigned long long attackerAdvantage + +ctypedef unsigned char nvmlGpuFabricState_t 'nvmlGpuFabricState_t' + +ctypedef struct nvmlSystemDriverBranchInfo_v1_t 'nvmlSystemDriverBranchInfo_v1_t': + unsigned int version + char branch[80] + +ctypedef unsigned int nvmlAffinityScope_t 'nvmlAffinityScope_t' + +ctypedef struct nvmlTemperature_v1_t 'nvmlTemperature_v1_t': + unsigned int version + nvmlTemperatureSensors_t sensorType + int temperature + +ctypedef struct nvmlNvlinkSupportedBwModes_v1_t 'nvmlNvlinkSupportedBwModes_v1_t': + unsigned int version + unsigned char bwModes[23] + unsigned char totalBwModes + +ctypedef struct nvmlNvlinkGetBwMode_v1_t 'nvmlNvlinkGetBwMode_v1_t': + unsigned int version + unsigned int bIsBest + unsigned char bwMode + +ctypedef struct nvmlNvlinkSetBwMode_v1_t 'nvmlNvlinkSetBwMode_v1_t': + unsigned int version + unsigned int bSetBest + unsigned char bwMode + +ctypedef struct nvmlDeviceCapabilities_v1_t 'nvmlDeviceCapabilities_v1_t': + unsigned int version + unsigned int capMask + +ctypedef struct nvmlPowerSmoothingProfile_v1_t 'nvmlPowerSmoothingProfile_v1_t': + unsigned int version + unsigned int profileId + unsigned int paramId + double value + +ctypedef struct nvmlPowerSmoothingState_v1_t 'nvmlPowerSmoothingState_v1_t': + unsigned int version + nvmlEnableState_t state + +ctypedef struct nvmlDeviceAddressingMode_v1_t 'nvmlDeviceAddressingMode_v1_t': + unsigned int version + unsigned int value + +ctypedef struct nvmlRepairStatus_v1_t 'nvmlRepairStatus_v1_t': + unsigned int version + unsigned int bChannelRepairPending + unsigned int bTpcRepairPending + +ctypedef struct nvmlPdi_v1_t 'nvmlPdi_v1_t': + unsigned int version + unsigned long long value + +ctypedef unsigned long long nvmlCPERCursorHandle_t 'nvmlCPERCursorHandle_t' + +ctypedef void* nvmlDevice_t 'nvmlDevice_t' + +ctypedef void* nvmlGpuInstance_t 'nvmlGpuInstance_t' + +ctypedef void* nvmlUnit_t 'nvmlUnit_t' + +ctypedef void* nvmlEventSet_t 'nvmlEventSet_t' + +ctypedef void* nvmlSystemEventSet_t 'nvmlSystemEventSet_t' + +ctypedef void* nvmlComputeInstance_t 'nvmlComputeInstance_t' + +ctypedef void* nvmlGpmSample_t 'nvmlGpmSample_t' + +ctypedef struct nvmlPciInfo_t 'nvmlPciInfo_t': + char busIdLegacy[16] + unsigned int domain + unsigned int bus + unsigned int device + unsigned int pciDeviceId + unsigned int pciSubSystemId + char busId[32] + +ctypedef struct nvmlEccErrorCounts_t 'nvmlEccErrorCounts_t': + unsigned long long l1Cache + unsigned long long l2Cache + unsigned long long deviceMemory + unsigned long long registerFile + +ctypedef struct nvmlUtilization_t 'nvmlUtilization_t': + unsigned int gpu + unsigned int memory + +ctypedef struct nvmlMemory_t 'nvmlMemory_t': + unsigned long long total + unsigned long long free + unsigned long long used + +ctypedef struct nvmlMemory_v2_t 'nvmlMemory_v2_t': + unsigned int version + unsigned long long total + unsigned long long reserved + unsigned long long free + unsigned long long used + +ctypedef struct nvmlBAR1Memory_t 'nvmlBAR1Memory_t': + unsigned long long bar1Total + unsigned long long bar1Free + unsigned long long bar1Used + +ctypedef struct nvmlProcessInfo_v1_t 'nvmlProcessInfo_v1_t': + unsigned int pid + unsigned long long usedGpuMemory + +ctypedef struct nvmlProcessInfo_v2_t 'nvmlProcessInfo_v2_t': + unsigned int pid + unsigned long long usedGpuMemory + unsigned int gpuInstanceId + unsigned int computeInstanceId + +ctypedef struct nvmlProcessInfo_t 'nvmlProcessInfo_t': + unsigned int pid + unsigned long long usedGpuMemory + unsigned int gpuInstanceId + unsigned int computeInstanceId + +ctypedef struct nvmlProcessDetail_v1_t 'nvmlProcessDetail_v1_t': + unsigned int pid + unsigned long long usedGpuMemory + unsigned int gpuInstanceId + unsigned int computeInstanceId + unsigned long long usedGpuCcProtectedMemory + +ctypedef struct nvmlDeviceAttributes_t 'nvmlDeviceAttributes_t': + unsigned int multiprocessorCount + unsigned int sharedCopyEngineCount + unsigned int sharedDecoderCount + unsigned int sharedEncoderCount + unsigned int sharedJpegCount + unsigned int sharedOfaCount + unsigned int gpuInstanceSliceCount + unsigned int computeInstanceSliceCount + unsigned long long memorySizeMB + +ctypedef struct nvmlC2cModeInfo_v1_t 'nvmlC2cModeInfo_v1_t': + unsigned int isC2cEnabled + +ctypedef struct nvmlRowRemapperHistogramValues_t 'nvmlRowRemapperHistogramValues_t': + unsigned int max + unsigned int high + unsigned int partial + unsigned int low + unsigned int none + +ctypedef struct nvmlNvLinkUtilizationControl_t 'nvmlNvLinkUtilizationControl_t': + nvmlNvLinkUtilizationCountUnits_t units + nvmlNvLinkUtilizationCountPktTypes_t pktfilter + +ctypedef struct nvmlBridgeChipInfo_t 'nvmlBridgeChipInfo_t': + nvmlBridgeChipType_t type + unsigned int fwVersion + +ctypedef union nvmlValue_t 'nvmlValue_t': + double dVal + int siVal + unsigned int uiVal + unsigned long ulVal + unsigned long long ullVal + signed long long sllVal + unsigned short usVal + +ctypedef struct nvmlViolationTime_t 'nvmlViolationTime_t': + unsigned long long referenceTime + unsigned long long violationTime + +ctypedef struct cuda_bindings_nvml__anon_pod0: + nvmlThermalController_t controller + int defaultMinTemp + int defaultMaxTemp + int currentTemp + nvmlThermalTarget_t target + +ctypedef union nvmlUUIDValue_t 'nvmlUUIDValue_t': + char str[41] + unsigned char bytes[16] + +ctypedef struct nvmlClkMonFaultInfo_t 'nvmlClkMonFaultInfo_t': + unsigned int clkApiDomain + unsigned int clkDomainFaultMask + +ctypedef struct nvmlProcessUtilizationSample_t 'nvmlProcessUtilizationSample_t': + unsigned int pid + unsigned long long timeStamp + unsigned int smUtil + unsigned int memUtil + unsigned int encUtil + unsigned int decUtil + +ctypedef struct nvmlProcessUtilizationInfo_v1_t 'nvmlProcessUtilizationInfo_v1_t': + unsigned long long timeStamp + unsigned int pid + unsigned int smUtil + unsigned int memUtil + unsigned int encUtil + unsigned int decUtil + unsigned int jpgUtil + unsigned int ofaUtil + +ctypedef struct nvmlPlatformInfo_v1_t 'nvmlPlatformInfo_v1_t': + unsigned int version + unsigned char ibGuid[16] + unsigned char rackGuid[16] + unsigned char chassisPhysicalSlotNumber + unsigned char computeSlotIndex + unsigned char nodeIndex + unsigned char peerType + unsigned char moduleId + +ctypedef struct cuda_bindings_nvml__anon_pod1: + unsigned int bIsPresent + unsigned int percentage + unsigned int incThreshold + unsigned int decThreshold + +ctypedef struct nvmlVgpuPlacementList_v1_t 'nvmlVgpuPlacementList_v1_t': + unsigned int version + unsigned int placementSize + unsigned int count + unsigned int* placementIds + +ctypedef struct cuda_bindings_nvml__anon_pod2: + unsigned int avgFactor + unsigned int timeslice + +ctypedef struct cuda_bindings_nvml__anon_pod3: + unsigned int timeslice + +ctypedef struct nvmlVgpuSchedulerLogEntry_t 'nvmlVgpuSchedulerLogEntry_t': + unsigned long long timestamp + unsigned long long timeRunTotal + unsigned long long timeRun + unsigned int swRunlistId + unsigned long long targetTimeSlice + unsigned long long cumulativePreemptionTime + +ctypedef struct cuda_bindings_nvml__anon_pod4: + unsigned int avgFactor + unsigned int frequency + +ctypedef struct cuda_bindings_nvml__anon_pod5: + unsigned int timeslice + +ctypedef struct nvmlVgpuSchedulerCapabilities_t 'nvmlVgpuSchedulerCapabilities_t': + unsigned int supportedSchedulers[3] + unsigned int maxTimeslice + unsigned int minTimeslice + unsigned int isArrModeSupported + unsigned int maxFrequencyForARR + unsigned int minFrequencyForARR + unsigned int maxAvgFactorForARR + unsigned int minAvgFactorForARR + +ctypedef struct nvmlVgpuLicenseExpiry_t 'nvmlVgpuLicenseExpiry_t': + unsigned int year + unsigned short month + unsigned short day + unsigned short hour + unsigned short min + unsigned short sec + unsigned char status + +ctypedef struct nvmlGridLicenseExpiry_t 'nvmlGridLicenseExpiry_t': + unsigned int year + unsigned short month + unsigned short day + unsigned short hour + unsigned short min + unsigned short sec + unsigned char status + +ctypedef struct nvmlNvLinkPowerThres_t 'nvmlNvLinkPowerThres_t': + unsigned int lowPwrThreshold + +ctypedef struct nvmlHwbcEntry_t 'nvmlHwbcEntry_t': + unsigned int hwbcId + char firmwareVersion[32] + +ctypedef struct nvmlLedState_t 'nvmlLedState_t': + char cause[256] + nvmlLedColor_t color + +ctypedef struct nvmlUnitInfo_t 'nvmlUnitInfo_t': + char name[96] + char id[96] + char serial[96] + char firmwareVersion[96] + +ctypedef struct nvmlPSUInfo_t 'nvmlPSUInfo_t': + char state[256] + unsigned int current + unsigned int voltage + unsigned int power + +ctypedef struct nvmlUnitFanInfo_t 'nvmlUnitFanInfo_t': + unsigned int speed + nvmlFanState_t state + +ctypedef struct nvmlSystemEventData_v1_t 'nvmlSystemEventData_v1_t': + unsigned long long eventType + unsigned int gpuId + +ctypedef struct nvmlAccountingStats_t 'nvmlAccountingStats_t': + unsigned int gpuUtilization + unsigned int memoryUtilization + unsigned long long maxMemoryUsage + unsigned long long time + unsigned long long startTime + unsigned int isRunning + unsigned int reserved[5] + +ctypedef struct nvmlFBCStats_t 'nvmlFBCStats_t': + unsigned int sessionsCount + unsigned int averageFPS + unsigned int averageLatency + +ctypedef struct nvmlConfComputeSystemCaps_t 'nvmlConfComputeSystemCaps_t': + unsigned int cpuCaps + unsigned int gpusCaps + +ctypedef struct nvmlConfComputeSystemState_t 'nvmlConfComputeSystemState_t': + unsigned int environment + unsigned int ccFeature + unsigned int devToolsMode + +ctypedef struct nvmlConfComputeMemSizeInfo_t 'nvmlConfComputeMemSizeInfo_t': + unsigned long long protectedMemSizeKib + unsigned long long unprotectedMemSizeKib + +ctypedef struct nvmlConfComputeGpuCertificate_t 'nvmlConfComputeGpuCertificate_t': + unsigned int certChainSize + unsigned int attestationCertChainSize + unsigned char certChain[0x1000] + unsigned char attestationCertChain[0x1400] + +ctypedef struct nvmlConfComputeGpuAttestationReport_t 'nvmlConfComputeGpuAttestationReport_t': + unsigned int isCecAttestationReportPresent + unsigned int attestationReportSize + unsigned int cecAttestationReportSize + unsigned char nonce[0x20] + unsigned char attestationReport[0x2000] + unsigned char cecAttestationReport[0x1000] + +ctypedef struct nvmlVgpuVersion_t 'nvmlVgpuVersion_t': + unsigned int minVersion + unsigned int maxVersion + +ctypedef struct nvmlVgpuMetadata_t 'nvmlVgpuMetadata_t': + unsigned int version + unsigned int revision + nvmlVgpuGuestInfoState_t guestInfoState + char guestDriverVersion[80] + char hostDriverVersion[80] + unsigned int reserved[6] + unsigned int vgpuVirtualizationCaps + unsigned int guestVgpuVersion + unsigned int opaqueDataSize + char opaqueData[4] + +ctypedef struct nvmlVgpuPgpuCompatibility_t 'nvmlVgpuPgpuCompatibility_t': + nvmlVgpuVmCompatibility_t vgpuVmCompatibility + nvmlVgpuPgpuCompatibilityLimitCode_t compatibilityLimitCode + +ctypedef struct nvmlGpuInstancePlacement_t 'nvmlGpuInstancePlacement_t': + unsigned int start + unsigned int size + +ctypedef struct nvmlGpuInstanceProfileInfo_t 'nvmlGpuInstanceProfileInfo_t': + unsigned int id + unsigned int isP2pSupported + unsigned int sliceCount + unsigned int instanceCount + unsigned int multiprocessorCount + unsigned int copyEngineCount + unsigned int decoderCount + unsigned int encoderCount + unsigned int jpegCount + unsigned int ofaCount + unsigned long long memorySizeMB + +ctypedef struct nvmlGpuInstanceProfileInfo_v2_t 'nvmlGpuInstanceProfileInfo_v2_t': + unsigned int version + unsigned int id + unsigned int isP2pSupported + unsigned int sliceCount + unsigned int instanceCount + unsigned int multiprocessorCount + unsigned int copyEngineCount + unsigned int decoderCount + unsigned int encoderCount + unsigned int jpegCount + unsigned int ofaCount + unsigned long long memorySizeMB + char name[96] + +ctypedef struct nvmlGpuInstanceProfileInfo_v3_t 'nvmlGpuInstanceProfileInfo_v3_t': + unsigned int version + unsigned int id + unsigned int sliceCount + unsigned int instanceCount + unsigned int multiprocessorCount + unsigned int copyEngineCount + unsigned int decoderCount + unsigned int encoderCount + unsigned int jpegCount + unsigned int ofaCount + unsigned long long memorySizeMB + char name[96] + unsigned int capabilities + +ctypedef struct nvmlComputeInstancePlacement_t 'nvmlComputeInstancePlacement_t': + unsigned int start + unsigned int size + +ctypedef struct nvmlComputeInstanceProfileInfo_t 'nvmlComputeInstanceProfileInfo_t': + unsigned int id + unsigned int sliceCount + unsigned int instanceCount + unsigned int multiprocessorCount + unsigned int sharedCopyEngineCount + unsigned int sharedDecoderCount + unsigned int sharedEncoderCount + unsigned int sharedJpegCount + unsigned int sharedOfaCount + +ctypedef struct nvmlComputeInstanceProfileInfo_v2_t 'nvmlComputeInstanceProfileInfo_v2_t': + unsigned int version + unsigned int id + unsigned int sliceCount + unsigned int instanceCount + unsigned int multiprocessorCount + unsigned int sharedCopyEngineCount + unsigned int sharedDecoderCount + unsigned int sharedEncoderCount + unsigned int sharedJpegCount + unsigned int sharedOfaCount + char name[96] + +ctypedef struct nvmlComputeInstanceProfileInfo_v3_t 'nvmlComputeInstanceProfileInfo_v3_t': + unsigned int version + unsigned int id + unsigned int sliceCount + unsigned int instanceCount + unsigned int multiprocessorCount + unsigned int sharedCopyEngineCount + unsigned int sharedDecoderCount + unsigned int sharedEncoderCount + unsigned int sharedJpegCount + unsigned int sharedOfaCount + char name[96] + unsigned int capabilities + +ctypedef struct cuda_bindings_nvml__anon_pod6: + char* shortName + char* longName + char* unit + +ctypedef struct nvmlGpmSupport_t 'nvmlGpmSupport_t': + unsigned int version + unsigned int isSupportedDevice + +ctypedef struct nvmlMask255_t 'nvmlMask255_t': + unsigned int mask[8] + +ctypedef struct nvmlDevicePowerMizerModes_v1_t 'nvmlDevicePowerMizerModes_v1_t': + unsigned int currentMode + unsigned int mode + unsigned int supportedPowerMizerModes + +ctypedef struct nvmlHostname_v1_t 'nvmlHostname_v1_t': + char value[64] + +ctypedef struct nvmlEccSramUniqueUncorrectedErrorEntry_v1_t 'nvmlEccSramUniqueUncorrectedErrorEntry_v1_t': + unsigned int unit + unsigned int location + unsigned int sublocation + unsigned int extlocation + unsigned int address + unsigned int isParity + unsigned int count + +ctypedef struct nvmlNvLinkInfo_v1_t 'nvmlNvLinkInfo_v1_t': + unsigned int version + unsigned int isNvleEnabled + +ctypedef struct nvmlNvlinkFirmwareVersion_t 'nvmlNvlinkFirmwareVersion_t': + unsigned char ucodeType + unsigned int major + unsigned int minor + unsigned int subMinor + +ctypedef union cuda_bindings_nvml__anon_pod7: + unsigned char inData[496] + unsigned char outData[496] + +ctypedef struct nvmlUnrepairableMemoryStatus_v1_t 'nvmlUnrepairableMemoryStatus_v1_t': + unsigned int bUnrepairableMemory + +ctypedef struct nvmlRusdSettings_v1_t 'nvmlRusdSettings_v1_t': + unsigned int version + unsigned long long pollMask + +ctypedef struct nvmlPRMCounterInput_v1_t 'nvmlPRMCounterInput_v1_t': + unsigned int localPort + +ctypedef struct nvmlVgpuSchedulerStateInfo_v2_t 'nvmlVgpuSchedulerStateInfo_v2_t': + unsigned int engineId + unsigned int schedulerPolicy + unsigned int avgFactor + unsigned int timeslice + +ctypedef struct nvmlVgpuSchedulerLogEntry_v2_t 'nvmlVgpuSchedulerLogEntry_v2_t': + unsigned long long timestamp + unsigned long long timeRunTotal + unsigned long long timeRun + unsigned int swRunlistId + unsigned long long targetTimeSlice + unsigned long long cumulativePreemptionTime + unsigned int weight + +ctypedef struct nvmlVgpuSchedulerState_v2_t 'nvmlVgpuSchedulerState_v2_t': + unsigned int engineId + unsigned int schedulerPolicy + unsigned int avgFactor + unsigned int frequency + +ctypedef struct nvmlBBXTimeData_v1_t 'nvmlBBXTimeData_v1_t': + unsigned int timeRun + +ctypedef struct nvmlRemappedRowsInfo_v2_t 'nvmlRemappedRowsInfo_v2_t': + unsigned int corrActiveRemaps + unsigned int corrInactiveRemaps + unsigned int uncActiveRemaps + unsigned int uncInactiveRemaps + unsigned int bPending + unsigned int bFailureOccurred + +ctypedef struct nvmlAccountingStats_v2_t 'nvmlAccountingStats_v2_t': + unsigned int pid + unsigned int isRunning + unsigned int gpuUtilization + unsigned int memoryUtilization + unsigned long long maxMemoryUsage + unsigned int sampleCount + unsigned long long sumGpuUtil + unsigned long long sumFbUtil + unsigned long long time + unsigned long long startTime + +ctypedef nvmlPciInfoExt_v1_t nvmlPciInfoExt_t 'nvmlPciInfoExt_t' + +ctypedef nvmlCoolerInfo_v1_t nvmlCoolerInfo_t 'nvmlCoolerInfo_t' + +ctypedef nvmlDramEncryptionInfo_v1_t nvmlDramEncryptionInfo_t 'nvmlDramEncryptionInfo_t' + +ctypedef nvmlMarginTemperature_v1_t nvmlMarginTemperature_t 'nvmlMarginTemperature_t' + +ctypedef nvmlClockOffset_v1_t nvmlClockOffset_t 'nvmlClockOffset_t' + +ctypedef nvmlFanSpeedInfo_v1_t nvmlFanSpeedInfo_t 'nvmlFanSpeedInfo_t' + +ctypedef nvmlDevicePerfModes_v1_t nvmlDevicePerfModes_t 'nvmlDevicePerfModes_t' + +ctypedef nvmlDeviceCurrentClockFreqs_v1_t nvmlDeviceCurrentClockFreqs_t 'nvmlDeviceCurrentClockFreqs_t' + +ctypedef nvmlEccSramErrorStatus_v1_t nvmlEccSramErrorStatus_t 'nvmlEccSramErrorStatus_t' + +ctypedef nvmlPlatformInfo_v2_t nvmlPlatformInfo_t 'nvmlPlatformInfo_t' + +ctypedef struct nvmlPowerValue_v2_t 'nvmlPowerValue_v2_t': + unsigned int version + nvmlPowerScopeType_t powerScope + unsigned int powerValueMw + +ctypedef struct nvmlVgpuTypeIdInfo_v1_t 'nvmlVgpuTypeIdInfo_v1_t': + unsigned int version + unsigned int vgpuCount + nvmlVgpuTypeId_t* vgpuTypeIds + +ctypedef struct nvmlVgpuTypeMaxInstance_v1_t 'nvmlVgpuTypeMaxInstance_v1_t': + unsigned int version + nvmlVgpuTypeId_t vgpuTypeId + unsigned int maxInstancePerGI + +ctypedef struct nvmlVgpuCreatablePlacementInfo_v1_t 'nvmlVgpuCreatablePlacementInfo_v1_t': + unsigned int version + nvmlVgpuTypeId_t vgpuTypeId + unsigned int count + unsigned int* placementIds + unsigned int placementSize + +ctypedef struct nvmlVgpuProcessUtilizationSample_t 'nvmlVgpuProcessUtilizationSample_t': + nvmlVgpuInstance_t vgpuInstance + unsigned int pid + char processName[64] + unsigned long long timeStamp + unsigned int smUtil + unsigned int memUtil + unsigned int encUtil + unsigned int decUtil + +ctypedef struct nvmlVgpuProcessUtilizationInfo_v1_t 'nvmlVgpuProcessUtilizationInfo_v1_t': + char processName[64] + unsigned long long timeStamp + nvmlVgpuInstance_t vgpuInstance + unsigned int pid + unsigned int smUtil + unsigned int memUtil + unsigned int encUtil + unsigned int decUtil + unsigned int jpgUtil + unsigned int ofaUtil + +ctypedef struct nvmlActiveVgpuInstanceInfo_v1_t 'nvmlActiveVgpuInstanceInfo_v1_t': + unsigned int version + unsigned int vgpuCount + nvmlVgpuInstance_t* vgpuInstances + +ctypedef struct nvmlEncoderSessionInfo_t 'nvmlEncoderSessionInfo_t': + unsigned int sessionId + unsigned int pid + nvmlVgpuInstance_t vgpuInstance + nvmlEncoderType_t codecType + unsigned int hResolution + unsigned int vResolution + unsigned int averageFps + unsigned int averageLatency + +ctypedef struct nvmlFBCSessionInfo_t 'nvmlFBCSessionInfo_t': + unsigned int sessionId + unsigned int pid + nvmlVgpuInstance_t vgpuInstance + unsigned int displayOrdinal + nvmlFBCSessionType_t sessionType + unsigned int sessionFlags + unsigned int hMaxResolution + unsigned int vMaxResolution + unsigned int hResolution + unsigned int vResolution + unsigned int averageFPS + unsigned int averageLatency + +ctypedef nvmlVgpuHeterogeneousMode_v1_t nvmlVgpuHeterogeneousMode_t 'nvmlVgpuHeterogeneousMode_t' + +ctypedef nvmlVgpuPlacementId_v1_t nvmlVgpuPlacementId_t 'nvmlVgpuPlacementId_t' + +ctypedef nvmlVgpuPlacementList_v2_t nvmlVgpuPlacementList_t 'nvmlVgpuPlacementList_t' + +ctypedef nvmlVgpuTypeBar1Info_v1_t nvmlVgpuTypeBar1Info_t 'nvmlVgpuTypeBar1Info_t' + +ctypedef nvmlVgpuRuntimeState_v1_t nvmlVgpuRuntimeState_t 'nvmlVgpuRuntimeState_t' + +ctypedef nvmlSystemConfComputeSettings_v1_t nvmlSystemConfComputeSettings_t 'nvmlSystemConfComputeSettings_t' + +ctypedef nvmlConfComputeSetKeyRotationThresholdInfo_v1_t nvmlConfComputeSetKeyRotationThresholdInfo_t 'nvmlConfComputeSetKeyRotationThresholdInfo_t' + +ctypedef nvmlConfComputeGetKeyRotationThresholdInfo_v1_t nvmlConfComputeGetKeyRotationThresholdInfo_t 'nvmlConfComputeGetKeyRotationThresholdInfo_t' + +ctypedef struct nvmlGpuFabricInfo_t 'nvmlGpuFabricInfo_t': + unsigned char clusterUuid[16] + nvmlReturn_t status + unsigned int cliqueId + nvmlGpuFabricState_t state + +ctypedef struct nvmlGpuFabricInfo_v2_t 'nvmlGpuFabricInfo_v2_t': + unsigned int version + unsigned char clusterUuid[16] + nvmlReturn_t status + unsigned int cliqueId + nvmlGpuFabricState_t state + unsigned int healthMask + +ctypedef struct nvmlGpuFabricInfo_v3_t 'nvmlGpuFabricInfo_v3_t': + unsigned int version + unsigned char clusterUuid[16] + nvmlReturn_t status + unsigned int cliqueId + nvmlGpuFabricState_t state + unsigned int healthMask + unsigned char healthSummary + +ctypedef nvmlSystemDriverBranchInfo_v1_t nvmlSystemDriverBranchInfo_t 'nvmlSystemDriverBranchInfo_t' + +ctypedef nvmlTemperature_v1_t nvmlTemperature_t 'nvmlTemperature_t' + +ctypedef nvmlNvlinkSupportedBwModes_v1_t nvmlNvlinkSupportedBwModes_t 'nvmlNvlinkSupportedBwModes_t' + +ctypedef nvmlNvlinkGetBwMode_v1_t nvmlNvlinkGetBwMode_t 'nvmlNvlinkGetBwMode_t' + +ctypedef nvmlNvlinkSetBwMode_v1_t nvmlNvlinkSetBwMode_t 'nvmlNvlinkSetBwMode_t' + +ctypedef nvmlDeviceCapabilities_v1_t nvmlDeviceCapabilities_t 'nvmlDeviceCapabilities_t' + +ctypedef nvmlPowerSmoothingProfile_v1_t nvmlPowerSmoothingProfile_t 'nvmlPowerSmoothingProfile_t' + +ctypedef nvmlPowerSmoothingState_v1_t nvmlPowerSmoothingState_t 'nvmlPowerSmoothingState_t' + +ctypedef nvmlDeviceAddressingMode_v1_t nvmlDeviceAddressingMode_t 'nvmlDeviceAddressingMode_t' + +ctypedef nvmlRepairStatus_v1_t nvmlRepairStatus_t 'nvmlRepairStatus_t' + +ctypedef nvmlPdi_v1_t nvmlPdi_t 'nvmlPdi_t' + +ctypedef struct nvmlCPERCursor_v1_t 'nvmlCPERCursor_v1_t': + unsigned int cperTypeMask + char uuid[80] + nvmlCPERCursorHandle_t handle + +ctypedef struct nvmlEventData_t 'nvmlEventData_t': + nvmlDevice_t device + unsigned long long eventType + unsigned long long eventData + unsigned int gpuInstanceId + unsigned int computeInstanceId + +ctypedef struct nvmlSystemEventSetCreateRequest_v1_t 'nvmlSystemEventSetCreateRequest_v1_t': + unsigned int version + nvmlSystemEventSet_t set + +ctypedef struct nvmlSystemEventSetFreeRequest_v1_t 'nvmlSystemEventSetFreeRequest_v1_t': + unsigned int version + nvmlSystemEventSet_t set + +ctypedef struct nvmlSystemRegisterEventRequest_v1_t 'nvmlSystemRegisterEventRequest_v1_t': + unsigned int version + unsigned long long eventTypes + nvmlSystemEventSet_t set + +ctypedef struct nvmlExcludedDeviceInfo_t 'nvmlExcludedDeviceInfo_t': + nvmlPciInfo_t pciInfo + char uuid[80] + +ctypedef struct nvmlProcessDetailList_v1_t 'nvmlProcessDetailList_v1_t': + unsigned int version + unsigned int mode + unsigned int numProcArrayEntries + nvmlProcessDetail_v1_t* procArray + +ctypedef struct nvmlBridgeChipHierarchy_t 'nvmlBridgeChipHierarchy_t': + unsigned char bridgeCount + nvmlBridgeChipInfo_t bridgeChipInfo[128] + +ctypedef struct nvmlSample_t 'nvmlSample_t': + unsigned long long timeStamp + nvmlValue_t sampleValue + +ctypedef struct nvmlVgpuInstanceUtilizationSample_t 'nvmlVgpuInstanceUtilizationSample_t': + nvmlVgpuInstance_t vgpuInstance + unsigned long long timeStamp + nvmlValue_t smUtil + nvmlValue_t memUtil + nvmlValue_t encUtil + nvmlValue_t decUtil + +ctypedef struct nvmlVgpuInstanceUtilizationInfo_v1_t 'nvmlVgpuInstanceUtilizationInfo_v1_t': + unsigned long long timeStamp + nvmlVgpuInstance_t vgpuInstance + nvmlValue_t smUtil + nvmlValue_t memUtil + nvmlValue_t encUtil + nvmlValue_t decUtil + nvmlValue_t jpgUtil + nvmlValue_t ofaUtil + +ctypedef struct nvmlFieldValue_t 'nvmlFieldValue_t': + unsigned int fieldId + unsigned int scopeId + long long timestamp + long long latencyUsec + nvmlValueType_t valueType + nvmlReturn_t nvmlReturn + nvmlValue_t value + +ctypedef struct nvmlPRMCounterValue_v1_t 'nvmlPRMCounterValue_v1_t': + nvmlReturn_t status + nvmlValueType_t outputType + nvmlValue_t outputValue + +ctypedef struct nvmlGpuThermalSettings_t 'nvmlGpuThermalSettings_t': + unsigned int count + cuda_bindings_nvml__anon_pod0 sensor[3] + +ctypedef struct nvmlUUID_v1_t 'nvmlUUID_v1_t': + unsigned int version + unsigned int type + nvmlUUIDValue_t value + +ctypedef struct nvmlClkMonStatus_t 'nvmlClkMonStatus_t': + unsigned int bGlobalStatus + unsigned int clkMonListSize + nvmlClkMonFaultInfo_t clkMonList[32] + +ctypedef struct nvmlProcessesUtilizationInfo_v1_t 'nvmlProcessesUtilizationInfo_v1_t': + unsigned int version + unsigned int processSamplesCount + unsigned long long lastSeenTimeStamp + nvmlProcessUtilizationInfo_v1_t* procUtilArray + +ctypedef struct nvmlGpuDynamicPstatesInfo_t 'nvmlGpuDynamicPstatesInfo_t': + unsigned int flags + cuda_bindings_nvml__anon_pod1 utilization[8] + +ctypedef union nvmlVgpuSchedulerParams_t 'nvmlVgpuSchedulerParams_t': + cuda_bindings_nvml__anon_pod2 vgpuSchedDataWithARR + cuda_bindings_nvml__anon_pod3 vgpuSchedData + +ctypedef union nvmlVgpuSchedulerSetParams_t 'nvmlVgpuSchedulerSetParams_t': + cuda_bindings_nvml__anon_pod4 vgpuSchedDataWithARR + cuda_bindings_nvml__anon_pod5 vgpuSchedData + +ctypedef struct nvmlVgpuLicenseInfo_t 'nvmlVgpuLicenseInfo_t': + unsigned char isLicensed + nvmlVgpuLicenseExpiry_t licenseExpiry + unsigned int currentState + +ctypedef struct nvmlGridLicensableFeature_t 'nvmlGridLicensableFeature_t': + nvmlGridLicenseFeatureCode_t featureCode + unsigned int featureState + char licenseInfo[128] + char productName[128] + unsigned int featureEnabled + nvmlGridLicenseExpiry_t licenseExpiry + +ctypedef struct nvmlUnitFanSpeeds_t 'nvmlUnitFanSpeeds_t': + nvmlUnitFanInfo_t fans[24] + unsigned int count + +ctypedef struct nvmlSystemEventSetWaitRequest_v1_t 'nvmlSystemEventSetWaitRequest_v1_t': + unsigned int version + unsigned int timeoutms + nvmlSystemEventSet_t set + nvmlSystemEventData_v1_t* data + unsigned int dataSize + unsigned int numEvent + +ctypedef struct nvmlVgpuPgpuMetadata_t 'nvmlVgpuPgpuMetadata_t': + unsigned int version + unsigned int revision + char hostDriverVersion[80] + unsigned int pgpuVirtualizationCaps + unsigned int reserved[5] + nvmlVgpuVersion_t hostSupportedVgpuRange + unsigned int opaqueDataSize + char opaqueData[4] + +ctypedef struct nvmlGpuInstanceInfo_t 'nvmlGpuInstanceInfo_t': + nvmlDevice_t device + unsigned int id + unsigned int profileId + nvmlGpuInstancePlacement_t placement + +ctypedef struct nvmlComputeInstanceInfo_t 'nvmlComputeInstanceInfo_t': + nvmlDevice_t device + nvmlGpuInstance_t gpuInstance + unsigned int id + unsigned int profileId + nvmlComputeInstancePlacement_t placement + +ctypedef struct nvmlGpmMetric_t 'nvmlGpmMetric_t': + unsigned int metricId + nvmlReturn_t nvmlReturn + double value + cuda_bindings_nvml__anon_pod6 metricInfo + +ctypedef struct nvmlWorkloadPowerProfileInfo_v1_t 'nvmlWorkloadPowerProfileInfo_v1_t': + unsigned int version + unsigned int profileId + unsigned int priority + nvmlMask255_t conflictingMask + +ctypedef struct nvmlWorkloadPowerProfileCurrentProfiles_v1_t 'nvmlWorkloadPowerProfileCurrentProfiles_v1_t': + unsigned int version + nvmlMask255_t perfProfilesMask + nvmlMask255_t requestedProfilesMask + nvmlMask255_t enforcedProfilesMask + +ctypedef struct nvmlWorkloadPowerProfileRequestedProfiles_v1_t 'nvmlWorkloadPowerProfileRequestedProfiles_v1_t': + unsigned int version + nvmlMask255_t requestedProfilesMask + +ctypedef struct nvmlWorkloadPowerProfileUpdateProfiles_v1_t 'nvmlWorkloadPowerProfileUpdateProfiles_v1_t': + nvmlPowerProfileOperation_t operation + nvmlMask255_t updateProfilesMask + +ctypedef struct nvmlEccSramUniqueUncorrectedErrorCounts_v1_t 'nvmlEccSramUniqueUncorrectedErrorCounts_v1_t': + unsigned int version + unsigned int entryCount + nvmlEccSramUniqueUncorrectedErrorEntry_v1_t* entries + +ctypedef struct nvmlNvlinkFirmwareInfo_t 'nvmlNvlinkFirmwareInfo_t': + nvmlNvlinkFirmwareVersion_t firmwareVersion[100] + unsigned int numValidEntries + +ctypedef struct nvmlPRMTLV_v1_t 'nvmlPRMTLV_v1_t': + unsigned dataSize + unsigned status + cuda_bindings_nvml__anon_pod7 _anon_pod_member0 + +ctypedef struct nvmlVgpuSchedulerLogInfo_v2_t 'nvmlVgpuSchedulerLogInfo_v2_t': + unsigned int engineId + unsigned int schedulerPolicy + unsigned int avgFactor + unsigned int timeslice + unsigned int entriesCount + nvmlVgpuSchedulerLogEntry_v2_t logEntries[200] + +ctypedef nvmlVgpuTypeIdInfo_v1_t nvmlVgpuTypeIdInfo_t 'nvmlVgpuTypeIdInfo_t' + +ctypedef nvmlVgpuTypeMaxInstance_v1_t nvmlVgpuTypeMaxInstance_t 'nvmlVgpuTypeMaxInstance_t' + +ctypedef nvmlVgpuCreatablePlacementInfo_v1_t nvmlVgpuCreatablePlacementInfo_t 'nvmlVgpuCreatablePlacementInfo_t' + +ctypedef struct nvmlVgpuProcessesUtilizationInfo_v1_t 'nvmlVgpuProcessesUtilizationInfo_v1_t': + unsigned int version + unsigned int vgpuProcessCount + unsigned long long lastSeenTimeStamp + nvmlVgpuProcessUtilizationInfo_v1_t* vgpuProcUtilArray + +ctypedef nvmlActiveVgpuInstanceInfo_v1_t nvmlActiveVgpuInstanceInfo_t 'nvmlActiveVgpuInstanceInfo_t' + +ctypedef nvmlGpuFabricInfo_v3_t nvmlGpuFabricInfoV_t 'nvmlGpuFabricInfoV_t' + +ctypedef struct nvmlGetCPER_v1_t 'nvmlGetCPER_v1_t': + nvmlCPERCursor_v1_t cursor + unsigned char* buffer + unsigned int bufferSize + +ctypedef nvmlSystemEventSetCreateRequest_v1_t nvmlSystemEventSetCreateRequest_t 'nvmlSystemEventSetCreateRequest_t' + +ctypedef nvmlSystemEventSetFreeRequest_v1_t nvmlSystemEventSetFreeRequest_t 'nvmlSystemEventSetFreeRequest_t' + +ctypedef nvmlSystemRegisterEventRequest_v1_t nvmlSystemRegisterEventRequest_t 'nvmlSystemRegisterEventRequest_t' + +ctypedef nvmlProcessDetailList_v1_t nvmlProcessDetailList_t 'nvmlProcessDetailList_t' + +ctypedef struct nvmlVgpuInstancesUtilizationInfo_v1_t 'nvmlVgpuInstancesUtilizationInfo_v1_t': + unsigned int version + nvmlValueType_t sampleValType + unsigned int vgpuInstanceCount + unsigned long long lastSeenTimeStamp + nvmlVgpuInstanceUtilizationInfo_v1_t* vgpuUtilArray + +ctypedef struct nvmlPRMCounter_v1_t 'nvmlPRMCounter_v1_t': + unsigned int counterId + nvmlPRMCounterInput_v1_t inData + nvmlPRMCounterValue_v1_t counterValue + +ctypedef nvmlUUID_v1_t nvmlUUID_t 'nvmlUUID_t' + +ctypedef nvmlProcessesUtilizationInfo_v1_t nvmlProcessesUtilizationInfo_t 'nvmlProcessesUtilizationInfo_t' + +ctypedef struct nvmlVgpuSchedulerLog_t 'nvmlVgpuSchedulerLog_t': + unsigned int engineId + unsigned int schedulerPolicy + unsigned int arrMode + nvmlVgpuSchedulerParams_t schedulerParams + unsigned int entriesCount + nvmlVgpuSchedulerLogEntry_t logEntries[200] + +ctypedef struct nvmlVgpuSchedulerGetState_t 'nvmlVgpuSchedulerGetState_t': + unsigned int schedulerPolicy + unsigned int arrMode + nvmlVgpuSchedulerParams_t schedulerParams + +ctypedef struct nvmlVgpuSchedulerStateInfo_v1_t 'nvmlVgpuSchedulerStateInfo_v1_t': + unsigned int version + unsigned int engineId + unsigned int schedulerPolicy + unsigned int arrMode + nvmlVgpuSchedulerParams_t schedulerParams + +ctypedef struct nvmlVgpuSchedulerLogInfo_v1_t 'nvmlVgpuSchedulerLogInfo_v1_t': + unsigned int version + unsigned int engineId + unsigned int schedulerPolicy + unsigned int arrMode + nvmlVgpuSchedulerParams_t schedulerParams + unsigned int entriesCount + nvmlVgpuSchedulerLogEntry_t logEntries[200] + +ctypedef struct nvmlVgpuSchedulerSetState_t 'nvmlVgpuSchedulerSetState_t': + unsigned int schedulerPolicy + unsigned int enableARRMode + nvmlVgpuSchedulerSetParams_t schedulerParams + +ctypedef struct nvmlVgpuSchedulerState_v1_t 'nvmlVgpuSchedulerState_v1_t': + unsigned int version + unsigned int engineId + unsigned int schedulerPolicy + unsigned int enableARRMode + nvmlVgpuSchedulerSetParams_t schedulerParams + +ctypedef struct nvmlGridLicensableFeatures_t 'nvmlGridLicensableFeatures_t': + int isGridLicenseSupported + unsigned int licensableFeaturesCount + nvmlGridLicensableFeature_t gridLicensableFeatures[3] + +ctypedef nvmlSystemEventSetWaitRequest_v1_t nvmlSystemEventSetWaitRequest_t 'nvmlSystemEventSetWaitRequest_t' + +ctypedef struct nvmlGpmMetricsGet_t 'nvmlGpmMetricsGet_t': + unsigned int version + unsigned int numMetrics + nvmlGpmSample_t sample1 + nvmlGpmSample_t sample2 + nvmlGpmMetric_t metrics[333] + +ctypedef nvmlWorkloadPowerProfileInfo_v1_t nvmlWorkloadPowerProfileInfo_t 'nvmlWorkloadPowerProfileInfo_t' + +ctypedef nvmlWorkloadPowerProfileCurrentProfiles_v1_t nvmlWorkloadPowerProfileCurrentProfiles_t 'nvmlWorkloadPowerProfileCurrentProfiles_t' + +ctypedef nvmlWorkloadPowerProfileRequestedProfiles_v1_t nvmlWorkloadPowerProfileRequestedProfiles_t 'nvmlWorkloadPowerProfileRequestedProfiles_t' + +ctypedef nvmlEccSramUniqueUncorrectedErrorCounts_v1_t nvmlEccSramUniqueUncorrectedErrorCounts_t 'nvmlEccSramUniqueUncorrectedErrorCounts_t' + +ctypedef struct nvmlNvLinkInfo_v2_t 'nvmlNvLinkInfo_v2_t': + unsigned int version + unsigned int isNvleEnabled + nvmlNvlinkFirmwareInfo_t firmwareInfo + +ctypedef nvmlVgpuProcessesUtilizationInfo_v1_t nvmlVgpuProcessesUtilizationInfo_t 'nvmlVgpuProcessesUtilizationInfo_t' + +ctypedef nvmlVgpuInstancesUtilizationInfo_v1_t nvmlVgpuInstancesUtilizationInfo_t 'nvmlVgpuInstancesUtilizationInfo_t' + +ctypedef struct nvmlPRMCounterList_v1_t 'nvmlPRMCounterList_v1_t': + unsigned int numCounters + nvmlPRMCounter_v1_t* counters + +ctypedef nvmlVgpuSchedulerStateInfo_v1_t nvmlVgpuSchedulerStateInfo_t 'nvmlVgpuSchedulerStateInfo_t' + +ctypedef nvmlVgpuSchedulerLogInfo_v1_t nvmlVgpuSchedulerLogInfo_t 'nvmlVgpuSchedulerLogInfo_t' + +ctypedef nvmlVgpuSchedulerState_v1_t nvmlVgpuSchedulerState_t 'nvmlVgpuSchedulerState_t' + +ctypedef struct nvmlWorkloadPowerProfileProfilesInfo_v1_t 'nvmlWorkloadPowerProfileProfilesInfo_v1_t': + unsigned int version + nvmlMask255_t perfProfilesMask + nvmlWorkloadPowerProfileInfo_t perfProfile[255] + +ctypedef nvmlNvLinkInfo_v2_t nvmlNvLinkInfo_t 'nvmlNvLinkInfo_t' + +ctypedef nvmlWorkloadPowerProfileProfilesInfo_v1_t nvmlWorkloadPowerProfileProfilesInfo_t 'nvmlWorkloadPowerProfileProfilesInfo_t' + + +############################################################################### +# Functions +############################################################################### + +cdef nvmlReturn_t nvmlInit_v2() except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlInitWithFlags(unsigned int flags) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlShutdown() except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef const char* nvmlErrorString(nvmlReturn_t result) except?NULL nogil +cdef nvmlReturn_t nvmlSystemGetDriverVersion(char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlSystemGetNVMLVersion(char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlSystemGetCudaDriverVersion(int* cudaDriverVersion) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlSystemGetCudaDriverVersion_v2(int* cudaDriverVersion) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlSystemGetProcessName(unsigned int pid, char* name, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlSystemGetHicVersion(unsigned int* hwbcCount, nvmlHwbcEntry_t* hwbcEntries) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlSystemGetTopologyGpuSet(unsigned int cpuNumber, unsigned int* count, nvmlDevice_t* deviceArray) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlSystemGetDriverBranch(nvmlSystemDriverBranchInfo_t* branchInfo, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlUnitGetCount(unsigned int* unitCount) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlUnitGetHandleByIndex(unsigned int index, nvmlUnit_t* unit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlUnitGetUnitInfo(nvmlUnit_t unit, nvmlUnitInfo_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlUnitGetLedState(nvmlUnit_t unit, nvmlLedState_t* state) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlUnitGetPsuInfo(nvmlUnit_t unit, nvmlPSUInfo_t* psu) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlUnitGetTemperature(nvmlUnit_t unit, unsigned int type, unsigned int* temp) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlUnitGetFanSpeedInfo(nvmlUnit_t unit, nvmlUnitFanSpeeds_t* fanSpeeds) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlUnitGetDevices(nvmlUnit_t unit, unsigned int* deviceCount, nvmlDevice_t* devices) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetCount_v2(unsigned int* deviceCount) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetAttributes_v2(nvmlDevice_t device, nvmlDeviceAttributes_t* attributes) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetHandleByIndex_v2(unsigned int index, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetHandleBySerial(const char* serial, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetHandleByUUID(const char* uuid, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetHandleByUUIDV(const nvmlUUID_t* uuid, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetHandleByPciBusId_v2(const char* pciBusId, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetName(nvmlDevice_t device, char* name, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetBrand(nvmlDevice_t device, nvmlBrandType_t* type) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetIndex(nvmlDevice_t device, unsigned int* index) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetSerial(nvmlDevice_t device, char* serial, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetModuleId(nvmlDevice_t device, unsigned int* moduleId) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetC2cModeInfoV(nvmlDevice_t device, nvmlC2cModeInfo_v1_t* c2cModeInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetMemoryAffinity(nvmlDevice_t device, unsigned int nodeSetSize, unsigned long* nodeSet, nvmlAffinityScope_t scope) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetCpuAffinityWithinScope(nvmlDevice_t device, unsigned int cpuSetSize, unsigned long* cpuSet, nvmlAffinityScope_t scope) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetCpuAffinity(nvmlDevice_t device, unsigned int cpuSetSize, unsigned long* cpuSet) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetCpuAffinity(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceClearCpuAffinity(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetNumaNodeId(nvmlDevice_t device, unsigned int* node) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetTopologyCommonAncestor(nvmlDevice_t device1, nvmlDevice_t device2, nvmlGpuTopologyLevel_t* pathInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetTopologyNearestGpus(nvmlDevice_t device, nvmlGpuTopologyLevel_t level, unsigned int* count, nvmlDevice_t* deviceArray) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetP2PStatus(nvmlDevice_t device1, nvmlDevice_t device2, nvmlGpuP2PCapsIndex_t p2pIndex, nvmlGpuP2PStatus_t* p2pStatus) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetUUID(nvmlDevice_t device, char* uuid, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetMinorNumber(nvmlDevice_t device, unsigned int* minorNumber) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetBoardPartNumber(nvmlDevice_t device, char* partNumber, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetInforomVersion(nvmlDevice_t device, nvmlInforomObject_t object, char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetInforomImageVersion(nvmlDevice_t device, char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetInforomConfigurationChecksum(nvmlDevice_t device, unsigned int* checksum) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceValidateInforom(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetLastBBXFlushTime(nvmlDevice_t device, unsigned long long* timestamp, unsigned long* durationUs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetDisplayMode(nvmlDevice_t device, nvmlEnableState_t* display) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetDisplayActive(nvmlDevice_t device, nvmlEnableState_t* isActive) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetPersistenceMode(nvmlDevice_t device, nvmlEnableState_t* mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetPciInfoExt(nvmlDevice_t device, nvmlPciInfoExt_t* pci) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetPciInfo_v3(nvmlDevice_t device, nvmlPciInfo_t* pci) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetMaxPcieLinkGeneration(nvmlDevice_t device, unsigned int* maxLinkGen) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetGpuMaxPcieLinkGeneration(nvmlDevice_t device, unsigned int* maxLinkGenDevice) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetMaxPcieLinkWidth(nvmlDevice_t device, unsigned int* maxLinkWidth) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetCurrPcieLinkGeneration(nvmlDevice_t device, unsigned int* currLinkGen) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetCurrPcieLinkWidth(nvmlDevice_t device, unsigned int* currLinkWidth) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetPcieThroughput(nvmlDevice_t device, nvmlPcieUtilCounter_t counter, unsigned int* value) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetPcieReplayCounter(nvmlDevice_t device, unsigned int* value) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetClockInfo(nvmlDevice_t device, nvmlClockType_t type, unsigned int* clock) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetMaxClockInfo(nvmlDevice_t device, nvmlClockType_t type, unsigned int* clock) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetGpcClkVfOffset(nvmlDevice_t device, int* offset) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetClock(nvmlDevice_t device, nvmlClockType_t clockType, nvmlClockId_t clockId, unsigned int* clockMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetMaxCustomerBoostClock(nvmlDevice_t device, nvmlClockType_t clockType, unsigned int* clockMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetSupportedMemoryClocks(nvmlDevice_t device, unsigned int* count, unsigned int* clocksMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetSupportedGraphicsClocks(nvmlDevice_t device, unsigned int memoryClockMHz, unsigned int* count, unsigned int* clocksMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetAutoBoostedClocksEnabled(nvmlDevice_t device, nvmlEnableState_t* isEnabled, nvmlEnableState_t* defaultIsEnabled) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetFanSpeed(nvmlDevice_t device, unsigned int* speed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetFanSpeed_v2(nvmlDevice_t device, unsigned int fan, unsigned int* speed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetFanSpeedRPM(nvmlDevice_t device, nvmlFanSpeedInfo_t* fanSpeed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetTargetFanSpeed(nvmlDevice_t device, unsigned int fan, unsigned int* targetSpeed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetMinMaxFanSpeed(nvmlDevice_t device, unsigned int* minSpeed, unsigned int* maxSpeed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetFanControlPolicy_v2(nvmlDevice_t device, unsigned int fan, nvmlFanControlPolicy_t* policy) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetNumFans(nvmlDevice_t device, unsigned int* numFans) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetCoolerInfo(nvmlDevice_t device, nvmlCoolerInfo_t* coolerInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetTemperatureV(nvmlDevice_t device, nvmlTemperature_t* temperature) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetTemperatureThreshold(nvmlDevice_t device, nvmlTemperatureThresholds_t thresholdType, unsigned int* temp) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetMarginTemperature(nvmlDevice_t device, nvmlMarginTemperature_t* marginTempInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetThermalSettings(nvmlDevice_t device, unsigned int sensorIndex, nvmlGpuThermalSettings_t* pThermalSettings) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetPerformanceState(nvmlDevice_t device, nvmlPstates_t* pState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetCurrentClocksEventReasons(nvmlDevice_t device, unsigned long long* clocksEventReasons) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetSupportedClocksEventReasons(nvmlDevice_t device, unsigned long long* supportedClocksEventReasons) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetPowerState(nvmlDevice_t device, nvmlPstates_t* pState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetDynamicPstatesInfo(nvmlDevice_t device, nvmlGpuDynamicPstatesInfo_t* pDynamicPstatesInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetMemClkVfOffset(nvmlDevice_t device, int* offset) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetMinMaxClockOfPState(nvmlDevice_t device, nvmlClockType_t type, nvmlPstates_t pstate, unsigned int* minClockMHz, unsigned int* maxClockMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetSupportedPerformanceStates(nvmlDevice_t device, nvmlPstates_t* pstates, unsigned int size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetGpcClkMinMaxVfOffset(nvmlDevice_t device, int* minOffset, int* maxOffset) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetMemClkMinMaxVfOffset(nvmlDevice_t device, int* minOffset, int* maxOffset) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetClockOffsets(nvmlDevice_t device, nvmlClockOffset_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetClockOffsets(nvmlDevice_t device, nvmlClockOffset_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetPerformanceModes(nvmlDevice_t device, nvmlDevicePerfModes_t* perfModes) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetCurrentClockFreqs(nvmlDevice_t device, nvmlDeviceCurrentClockFreqs_t* currentClockFreqs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetPowerManagementLimit(nvmlDevice_t device, unsigned int* limit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetPowerManagementLimitConstraints(nvmlDevice_t device, unsigned int* minLimit, unsigned int* maxLimit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetPowerManagementDefaultLimit(nvmlDevice_t device, unsigned int* defaultLimit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetPowerUsage(nvmlDevice_t device, unsigned int* power) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetTotalEnergyConsumption(nvmlDevice_t device, unsigned long long* energy) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetEnforcedPowerLimit(nvmlDevice_t device, unsigned int* limit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetGpuOperationMode(nvmlDevice_t device, nvmlGpuOperationMode_t* current, nvmlGpuOperationMode_t* pending) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetMemoryInfo_v2(nvmlDevice_t device, nvmlMemory_v2_t* memory) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetComputeMode(nvmlDevice_t device, nvmlComputeMode_t* mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetCudaComputeCapability(nvmlDevice_t device, int* major, int* minor) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetDramEncryptionMode(nvmlDevice_t device, nvmlDramEncryptionInfo_t* current, nvmlDramEncryptionInfo_t* pending) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetDramEncryptionMode(nvmlDevice_t device, const nvmlDramEncryptionInfo_t* dramEncryption) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetEccMode(nvmlDevice_t device, nvmlEnableState_t* current, nvmlEnableState_t* pending) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetDefaultEccMode(nvmlDevice_t device, nvmlEnableState_t* defaultMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetBoardId(nvmlDevice_t device, unsigned int* boardId) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetMultiGpuBoard(nvmlDevice_t device, unsigned int* multiGpuBool) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetTotalEccErrors(nvmlDevice_t device, nvmlMemoryErrorType_t errorType, nvmlEccCounterType_t counterType, unsigned long long* eccCounts) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetMemoryErrorCounter(nvmlDevice_t device, nvmlMemoryErrorType_t errorType, nvmlEccCounterType_t counterType, nvmlMemoryLocation_t locationType, unsigned long long* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetUtilizationRates(nvmlDevice_t device, nvmlUtilization_t* utilization) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetEncoderUtilization(nvmlDevice_t device, unsigned int* utilization, unsigned int* samplingPeriodUs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetEncoderCapacity(nvmlDevice_t device, nvmlEncoderType_t encoderQueryType, unsigned int* encoderCapacity) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetEncoderStats(nvmlDevice_t device, unsigned int* sessionCount, unsigned int* averageFps, unsigned int* averageLatency) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetEncoderSessions(nvmlDevice_t device, unsigned int* sessionCount, nvmlEncoderSessionInfo_t* sessionInfos) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetDecoderUtilization(nvmlDevice_t device, unsigned int* utilization, unsigned int* samplingPeriodUs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetJpgUtilization(nvmlDevice_t device, unsigned int* utilization, unsigned int* samplingPeriodUs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetOfaUtilization(nvmlDevice_t device, unsigned int* utilization, unsigned int* samplingPeriodUs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetFBCStats(nvmlDevice_t device, nvmlFBCStats_t* fbcStats) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetFBCSessions(nvmlDevice_t device, unsigned int* sessionCount, nvmlFBCSessionInfo_t* sessionInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetDriverModel_v2(nvmlDevice_t device, nvmlDriverModel_t* current, nvmlDriverModel_t* pending) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetVbiosVersion(nvmlDevice_t device, char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetBridgeChipInfo(nvmlDevice_t device, nvmlBridgeChipHierarchy_t* bridgeHierarchy) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetComputeRunningProcesses_v3(nvmlDevice_t device, unsigned int* infoCount, nvmlProcessInfo_t* infos) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetGraphicsRunningProcesses_v3(nvmlDevice_t device, unsigned int* infoCount, nvmlProcessInfo_t* infos) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetMPSComputeRunningProcesses_v3(nvmlDevice_t device, unsigned int* infoCount, nvmlProcessInfo_t* infos) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetRunningProcessDetailList(nvmlDevice_t device, nvmlProcessDetailList_t* plist) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceOnSameBoard(nvmlDevice_t device1, nvmlDevice_t device2, int* onSameBoard) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetAPIRestriction(nvmlDevice_t device, nvmlRestrictedAPI_t apiType, nvmlEnableState_t* isRestricted) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetSamples(nvmlDevice_t device, nvmlSamplingType_t type, unsigned long long lastSeenTimeStamp, nvmlValueType_t* sampleValType, unsigned int* sampleCount, nvmlSample_t* samples) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetBAR1MemoryInfo(nvmlDevice_t device, nvmlBAR1Memory_t* bar1Memory) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetIrqNum(nvmlDevice_t device, unsigned int* irqNum) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetNumGpuCores(nvmlDevice_t device, unsigned int* numCores) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetPowerSource(nvmlDevice_t device, nvmlPowerSource_t* powerSource) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetMemoryBusWidth(nvmlDevice_t device, unsigned int* busWidth) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetPcieLinkMaxSpeed(nvmlDevice_t device, unsigned int* maxSpeed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetPcieSpeed(nvmlDevice_t device, unsigned int* pcieSpeed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetAdaptiveClockInfoStatus(nvmlDevice_t device, unsigned int* adaptiveClockStatus) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetBusType(nvmlDevice_t device, nvmlBusType_t* type) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetGpuFabricInfoV(nvmlDevice_t device, nvmlGpuFabricInfoV_t* gpuFabricInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlSystemGetConfComputeCapabilities(nvmlConfComputeSystemCaps_t* capabilities) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlSystemGetConfComputeState(nvmlConfComputeSystemState_t* state) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetConfComputeMemSizeInfo(nvmlDevice_t device, nvmlConfComputeMemSizeInfo_t* memInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlSystemGetConfComputeGpusReadyState(unsigned int* isAcceptingWork) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetConfComputeProtectedMemoryUsage(nvmlDevice_t device, nvmlMemory_t* memory) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetConfComputeGpuCertificate(nvmlDevice_t device, nvmlConfComputeGpuCertificate_t* gpuCert) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetConfComputeGpuAttestationReport(nvmlDevice_t device, nvmlConfComputeGpuAttestationReport_t* gpuAtstReport) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlSystemGetConfComputeKeyRotationThresholdInfo(nvmlConfComputeGetKeyRotationThresholdInfo_t* pKeyRotationThrInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetConfComputeUnprotectedMemSize(nvmlDevice_t device, unsigned long long sizeKiB) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlSystemSetConfComputeGpusReadyState(unsigned int isAcceptingWork) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlSystemSetConfComputeKeyRotationThresholdInfo(nvmlConfComputeSetKeyRotationThresholdInfo_t* pKeyRotationThrInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlSystemGetConfComputeSettings(nvmlSystemConfComputeSettings_t* settings) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetGspFirmwareVersion(nvmlDevice_t device, char* version) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetGspFirmwareMode(nvmlDevice_t device, unsigned int* isEnabled, unsigned int* defaultMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetSramEccErrorStatus(nvmlDevice_t device, nvmlEccSramErrorStatus_t* status) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetAccountingMode(nvmlDevice_t device, nvmlEnableState_t* mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetAccountingStats(nvmlDevice_t device, unsigned int pid, nvmlAccountingStats_t* stats) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetAccountingPids(nvmlDevice_t device, unsigned int* count, unsigned int* pids) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetAccountingBufferSize(nvmlDevice_t device, unsigned int* bufferSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetRetiredPages(nvmlDevice_t device, nvmlPageRetirementCause_t cause, unsigned int* pageCount, unsigned long long* addresses) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetRetiredPages_v2(nvmlDevice_t device, nvmlPageRetirementCause_t cause, unsigned int* pageCount, unsigned long long* addresses, unsigned long long* timestamps) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetRetiredPagesPendingStatus(nvmlDevice_t device, nvmlEnableState_t* isPending) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetRemappedRows(nvmlDevice_t device, unsigned int* corrRows, unsigned int* uncRows, unsigned int* isPending, unsigned int* failureOccurred) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetRowRemapperHistogram(nvmlDevice_t device, nvmlRowRemapperHistogramValues_t* values) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetArchitecture(nvmlDevice_t device, nvmlDeviceArchitecture_t* arch) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetClkMonStatus(nvmlDevice_t device, nvmlClkMonStatus_t* status) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetProcessUtilization(nvmlDevice_t device, nvmlProcessUtilizationSample_t* utilization, unsigned int* processSamplesCount, unsigned long long lastSeenTimeStamp) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetProcessesUtilizationInfo(nvmlDevice_t device, nvmlProcessesUtilizationInfo_t* procesesUtilInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetPlatformInfo(nvmlDevice_t device, nvmlPlatformInfo_t* platformInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlUnitSetLedState(nvmlUnit_t unit, nvmlLedColor_t color) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetPersistenceMode(nvmlDevice_t device, nvmlEnableState_t mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetComputeMode(nvmlDevice_t device, nvmlComputeMode_t mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetEccMode(nvmlDevice_t device, nvmlEnableState_t ecc) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceClearEccErrorCounts(nvmlDevice_t device, nvmlEccCounterType_t counterType) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetDriverModel(nvmlDevice_t device, nvmlDriverModel_t driverModel, unsigned int flags) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetGpuLockedClocks(nvmlDevice_t device, unsigned int minGpuClockMHz, unsigned int maxGpuClockMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceResetGpuLockedClocks(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetMemoryLockedClocks(nvmlDevice_t device, unsigned int minMemClockMHz, unsigned int maxMemClockMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceResetMemoryLockedClocks(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetAutoBoostedClocksEnabled(nvmlDevice_t device, nvmlEnableState_t enabled) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetDefaultAutoBoostedClocksEnabled(nvmlDevice_t device, nvmlEnableState_t enabled, unsigned int flags) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetDefaultFanSpeed_v2(nvmlDevice_t device, unsigned int fan) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetFanControlPolicy(nvmlDevice_t device, unsigned int fan, nvmlFanControlPolicy_t policy) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetTemperatureThreshold(nvmlDevice_t device, nvmlTemperatureThresholds_t thresholdType, int* temp) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetGpuOperationMode(nvmlDevice_t device, nvmlGpuOperationMode_t mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetAPIRestriction(nvmlDevice_t device, nvmlRestrictedAPI_t apiType, nvmlEnableState_t isRestricted) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetFanSpeed_v2(nvmlDevice_t device, unsigned int fan, unsigned int speed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetAccountingMode(nvmlDevice_t device, nvmlEnableState_t mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceClearAccountingPids(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetPowerManagementLimit_v2(nvmlDevice_t device, nvmlPowerValue_v2_t* powerValue) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetNvLinkState(nvmlDevice_t device, unsigned int link, nvmlEnableState_t* isActive) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetNvLinkVersion(nvmlDevice_t device, unsigned int link, unsigned int* version) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetNvLinkCapability(nvmlDevice_t device, unsigned int link, nvmlNvLinkCapability_t capability, unsigned int* capResult) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetNvLinkRemotePciInfo_v2(nvmlDevice_t device, unsigned int link, nvmlPciInfo_t* pci) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetNvLinkErrorCounter(nvmlDevice_t device, unsigned int link, nvmlNvLinkErrorCounter_t counter, unsigned long long* counterValue) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceResetNvLinkErrorCounters(nvmlDevice_t device, unsigned int link) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetNvLinkRemoteDeviceType(nvmlDevice_t device, unsigned int link, nvmlIntNvLinkDeviceType_t* pNvLinkDeviceType) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetNvLinkDeviceLowPowerThreshold(nvmlDevice_t device, nvmlNvLinkPowerThres_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlSystemSetNvlinkBwMode(unsigned int nvlinkBwMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlSystemGetNvlinkBwMode(unsigned int* nvlinkBwMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetNvlinkSupportedBwModes(nvmlDevice_t device, nvmlNvlinkSupportedBwModes_t* supportedBwMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetNvlinkBwMode(nvmlDevice_t device, nvmlNvlinkGetBwMode_t* getBwMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetNvlinkBwMode(nvmlDevice_t device, nvmlNvlinkSetBwMode_t* setBwMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlEventSetCreate(nvmlEventSet_t* set) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceRegisterEvents(nvmlDevice_t device, unsigned long long eventTypes, nvmlEventSet_t set) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetSupportedEventTypes(nvmlDevice_t device, unsigned long long* eventTypes) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlEventSetWait_v2(nvmlEventSet_t set, nvmlEventData_t* data, unsigned int timeoutms) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlEventSetFree(nvmlEventSet_t set) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlSystemEventSetCreate(nvmlSystemEventSetCreateRequest_t* request) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlSystemEventSetFree(nvmlSystemEventSetFreeRequest_t* request) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlSystemRegisterEvents(nvmlSystemRegisterEventRequest_t* request) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlSystemEventSetWait(nvmlSystemEventSetWaitRequest_t* request) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceModifyDrainState(nvmlPciInfo_t* pciInfo, nvmlEnableState_t newState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceQueryDrainState(nvmlPciInfo_t* pciInfo, nvmlEnableState_t* currentState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceRemoveGpu_v2(nvmlPciInfo_t* pciInfo, nvmlDetachGpuState_t gpuState, nvmlPcieLinkState_t linkState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceDiscoverGpus(nvmlPciInfo_t* pciInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetFieldValues(nvmlDevice_t device, int valuesCount, nvmlFieldValue_t* values) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceClearFieldValues(nvmlDevice_t device, int valuesCount, nvmlFieldValue_t* values) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetVirtualizationMode(nvmlDevice_t device, nvmlGpuVirtualizationMode_t* pVirtualMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetHostVgpuMode(nvmlDevice_t device, nvmlHostVgpuMode_t* pHostVgpuMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetVirtualizationMode(nvmlDevice_t device, nvmlGpuVirtualizationMode_t virtualMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetVgpuHeterogeneousMode(nvmlDevice_t device, nvmlVgpuHeterogeneousMode_t* pHeterogeneousMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetVgpuHeterogeneousMode(nvmlDevice_t device, const nvmlVgpuHeterogeneousMode_t* pHeterogeneousMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuInstanceGetPlacementId(nvmlVgpuInstance_t vgpuInstance, nvmlVgpuPlacementId_t* pPlacement) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetVgpuTypeSupportedPlacements(nvmlDevice_t device, nvmlVgpuTypeId_t vgpuTypeId, nvmlVgpuPlacementList_t* pPlacementList) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetVgpuTypeCreatablePlacements(nvmlDevice_t device, nvmlVgpuTypeId_t vgpuTypeId, nvmlVgpuPlacementList_t* pPlacementList) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuTypeGetGspHeapSize(nvmlVgpuTypeId_t vgpuTypeId, unsigned long long* gspHeapSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuTypeGetFbReservation(nvmlVgpuTypeId_t vgpuTypeId, unsigned long long* fbReservation) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuInstanceGetRuntimeStateSize(nvmlVgpuInstance_t vgpuInstance, nvmlVgpuRuntimeState_t* pState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetVgpuCapabilities(nvmlDevice_t device, nvmlDeviceVgpuCapability_t capability, nvmlEnableState_t state) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetGridLicensableFeatures_v4(nvmlDevice_t device, nvmlGridLicensableFeatures_t* pGridLicensableFeatures) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlGetVgpuDriverCapabilities(nvmlVgpuDriverCapability_t capability, unsigned int* capResult) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetVgpuCapabilities(nvmlDevice_t device, nvmlDeviceVgpuCapability_t capability, unsigned int* capResult) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetSupportedVgpus(nvmlDevice_t device, unsigned int* vgpuCount, nvmlVgpuTypeId_t* vgpuTypeIds) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetCreatableVgpus(nvmlDevice_t device, unsigned int* vgpuCount, nvmlVgpuTypeId_t* vgpuTypeIds) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuTypeGetClass(nvmlVgpuTypeId_t vgpuTypeId, char* vgpuTypeClass, unsigned int* size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuTypeGetName(nvmlVgpuTypeId_t vgpuTypeId, char* vgpuTypeName, unsigned int* size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuTypeGetGpuInstanceProfileId(nvmlVgpuTypeId_t vgpuTypeId, unsigned int* gpuInstanceProfileId) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuTypeGetDeviceID(nvmlVgpuTypeId_t vgpuTypeId, unsigned long long* deviceID, unsigned long long* subsystemID) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuTypeGetFramebufferSize(nvmlVgpuTypeId_t vgpuTypeId, unsigned long long* fbSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuTypeGetNumDisplayHeads(nvmlVgpuTypeId_t vgpuTypeId, unsigned int* numDisplayHeads) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuTypeGetResolution(nvmlVgpuTypeId_t vgpuTypeId, unsigned int displayIndex, unsigned int* xdim, unsigned int* ydim) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuTypeGetLicense(nvmlVgpuTypeId_t vgpuTypeId, char* vgpuTypeLicenseString, unsigned int size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuTypeGetFrameRateLimit(nvmlVgpuTypeId_t vgpuTypeId, unsigned int* frameRateLimit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuTypeGetMaxInstances(nvmlDevice_t device, nvmlVgpuTypeId_t vgpuTypeId, unsigned int* vgpuInstanceCount) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuTypeGetMaxInstancesPerVm(nvmlVgpuTypeId_t vgpuTypeId, unsigned int* vgpuInstanceCountPerVm) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuTypeGetBAR1Info(nvmlVgpuTypeId_t vgpuTypeId, nvmlVgpuTypeBar1Info_t* bar1Info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetActiveVgpus(nvmlDevice_t device, unsigned int* vgpuCount, nvmlVgpuInstance_t* vgpuInstances) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuInstanceGetVmID(nvmlVgpuInstance_t vgpuInstance, char* vmId, unsigned int size, nvmlVgpuVmIdType_t* vmIdType) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuInstanceGetUUID(nvmlVgpuInstance_t vgpuInstance, char* uuid, unsigned int size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuInstanceGetVmDriverVersion(nvmlVgpuInstance_t vgpuInstance, char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuInstanceGetFbUsage(nvmlVgpuInstance_t vgpuInstance, unsigned long long* fbUsage) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuInstanceGetLicenseStatus(nvmlVgpuInstance_t vgpuInstance, unsigned int* licensed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuInstanceGetType(nvmlVgpuInstance_t vgpuInstance, nvmlVgpuTypeId_t* vgpuTypeId) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuInstanceGetFrameRateLimit(nvmlVgpuInstance_t vgpuInstance, unsigned int* frameRateLimit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuInstanceGetEccMode(nvmlVgpuInstance_t vgpuInstance, nvmlEnableState_t* eccMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuInstanceGetEncoderCapacity(nvmlVgpuInstance_t vgpuInstance, unsigned int* encoderCapacity) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuInstanceSetEncoderCapacity(nvmlVgpuInstance_t vgpuInstance, unsigned int encoderCapacity) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuInstanceGetEncoderStats(nvmlVgpuInstance_t vgpuInstance, unsigned int* sessionCount, unsigned int* averageFps, unsigned int* averageLatency) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuInstanceGetEncoderSessions(nvmlVgpuInstance_t vgpuInstance, unsigned int* sessionCount, nvmlEncoderSessionInfo_t* sessionInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuInstanceGetFBCStats(nvmlVgpuInstance_t vgpuInstance, nvmlFBCStats_t* fbcStats) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuInstanceGetFBCSessions(nvmlVgpuInstance_t vgpuInstance, unsigned int* sessionCount, nvmlFBCSessionInfo_t* sessionInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuInstanceGetGpuInstanceId(nvmlVgpuInstance_t vgpuInstance, unsigned int* gpuInstanceId) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuInstanceGetGpuPciId(nvmlVgpuInstance_t vgpuInstance, char* vgpuPciId, unsigned int* length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuTypeGetCapabilities(nvmlVgpuTypeId_t vgpuTypeId, nvmlVgpuCapability_t capability, unsigned int* capResult) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuInstanceGetMdevUUID(nvmlVgpuInstance_t vgpuInstance, char* mdevUuid, unsigned int size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlGpuInstanceGetCreatableVgpus(nvmlGpuInstance_t gpuInstance, nvmlVgpuTypeIdInfo_t* pVgpus) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuTypeGetMaxInstancesPerGpuInstance(nvmlVgpuTypeMaxInstance_t* pMaxInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlGpuInstanceGetActiveVgpus(nvmlGpuInstance_t gpuInstance, nvmlActiveVgpuInstanceInfo_t* pVgpuInstanceInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlGpuInstanceSetVgpuSchedulerState(nvmlGpuInstance_t gpuInstance, nvmlVgpuSchedulerState_t* pScheduler) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlGpuInstanceGetVgpuSchedulerState(nvmlGpuInstance_t gpuInstance, nvmlVgpuSchedulerStateInfo_t* pSchedulerStateInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlGpuInstanceGetVgpuSchedulerLog(nvmlGpuInstance_t gpuInstance, nvmlVgpuSchedulerLogInfo_t* pSchedulerLogInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlGpuInstanceGetVgpuTypeCreatablePlacements(nvmlGpuInstance_t gpuInstance, nvmlVgpuCreatablePlacementInfo_t* pCreatablePlacementInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlGpuInstanceGetVgpuHeterogeneousMode(nvmlGpuInstance_t gpuInstance, nvmlVgpuHeterogeneousMode_t* pHeterogeneousMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlGpuInstanceSetVgpuHeterogeneousMode(nvmlGpuInstance_t gpuInstance, const nvmlVgpuHeterogeneousMode_t* pHeterogeneousMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuInstanceGetMetadata(nvmlVgpuInstance_t vgpuInstance, nvmlVgpuMetadata_t* vgpuMetadata, unsigned int* bufferSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetVgpuMetadata(nvmlDevice_t device, nvmlVgpuPgpuMetadata_t* pgpuMetadata, unsigned int* bufferSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlGetVgpuCompatibility(nvmlVgpuMetadata_t* vgpuMetadata, nvmlVgpuPgpuMetadata_t* pgpuMetadata, nvmlVgpuPgpuCompatibility_t* compatibilityInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetPgpuMetadataString(nvmlDevice_t device, char* pgpuMetadata, unsigned int* bufferSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetVgpuSchedulerLog(nvmlDevice_t device, nvmlVgpuSchedulerLog_t* pSchedulerLog) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetVgpuSchedulerState(nvmlDevice_t device, nvmlVgpuSchedulerGetState_t* pSchedulerState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetVgpuSchedulerCapabilities(nvmlDevice_t device, nvmlVgpuSchedulerCapabilities_t* pCapabilities) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetVgpuSchedulerState(nvmlDevice_t device, nvmlVgpuSchedulerSetState_t* pSchedulerState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlGetVgpuVersion(nvmlVgpuVersion_t* supported, nvmlVgpuVersion_t* current) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlSetVgpuVersion(nvmlVgpuVersion_t* vgpuVersion) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetVgpuUtilization(nvmlDevice_t device, unsigned long long lastSeenTimeStamp, nvmlValueType_t* sampleValType, unsigned int* vgpuInstanceSamplesCount, nvmlVgpuInstanceUtilizationSample_t* utilizationSamples) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetVgpuInstancesUtilizationInfo(nvmlDevice_t device, nvmlVgpuInstancesUtilizationInfo_t* vgpuUtilInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetVgpuProcessUtilization(nvmlDevice_t device, unsigned long long lastSeenTimeStamp, unsigned int* vgpuProcessSamplesCount, nvmlVgpuProcessUtilizationSample_t* utilizationSamples) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetVgpuProcessesUtilizationInfo(nvmlDevice_t device, nvmlVgpuProcessesUtilizationInfo_t* vgpuProcUtilInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuInstanceGetAccountingMode(nvmlVgpuInstance_t vgpuInstance, nvmlEnableState_t* mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuInstanceGetAccountingPids(nvmlVgpuInstance_t vgpuInstance, unsigned int* count, unsigned int* pids) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuInstanceGetAccountingStats(nvmlVgpuInstance_t vgpuInstance, unsigned int pid, nvmlAccountingStats_t* stats) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuInstanceClearAccountingPids(nvmlVgpuInstance_t vgpuInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlVgpuInstanceGetLicenseInfo_v2(nvmlVgpuInstance_t vgpuInstance, nvmlVgpuLicenseInfo_t* licenseInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlGetExcludedDeviceCount(unsigned int* deviceCount) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlGetExcludedDeviceInfoByIndex(unsigned int index, nvmlExcludedDeviceInfo_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetMigMode(nvmlDevice_t device, unsigned int mode, nvmlReturn_t* activationStatus) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetMigMode(nvmlDevice_t device, unsigned int* currentMode, unsigned int* pendingMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetGpuInstanceProfileInfoV(nvmlDevice_t device, unsigned int profile, nvmlGpuInstanceProfileInfo_v2_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetGpuInstancePossiblePlacements_v2(nvmlDevice_t device, unsigned int profileId, nvmlGpuInstancePlacement_t* placements, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetGpuInstanceRemainingCapacity(nvmlDevice_t device, unsigned int profileId, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceCreateGpuInstance(nvmlDevice_t device, unsigned int profileId, nvmlGpuInstance_t* gpuInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceCreateGpuInstanceWithPlacement(nvmlDevice_t device, unsigned int profileId, const nvmlGpuInstancePlacement_t* placement, nvmlGpuInstance_t* gpuInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlGpuInstanceDestroy(nvmlGpuInstance_t gpuInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetGpuInstances(nvmlDevice_t device, unsigned int profileId, nvmlGpuInstance_t* gpuInstances, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetGpuInstanceById(nvmlDevice_t device, unsigned int id, nvmlGpuInstance_t* gpuInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlGpuInstanceGetInfo(nvmlGpuInstance_t gpuInstance, nvmlGpuInstanceInfo_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlGpuInstanceGetComputeInstanceProfileInfoV(nvmlGpuInstance_t gpuInstance, unsigned int profile, unsigned int engProfile, nvmlComputeInstanceProfileInfo_v2_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlGpuInstanceGetComputeInstanceRemainingCapacity(nvmlGpuInstance_t gpuInstance, unsigned int profileId, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlGpuInstanceGetComputeInstancePossiblePlacements(nvmlGpuInstance_t gpuInstance, unsigned int profileId, nvmlComputeInstancePlacement_t* placements, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlGpuInstanceCreateComputeInstance(nvmlGpuInstance_t gpuInstance, unsigned int profileId, nvmlComputeInstance_t* computeInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlGpuInstanceCreateComputeInstanceWithPlacement(nvmlGpuInstance_t gpuInstance, unsigned int profileId, const nvmlComputeInstancePlacement_t* placement, nvmlComputeInstance_t* computeInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlComputeInstanceDestroy(nvmlComputeInstance_t computeInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlGpuInstanceGetComputeInstances(nvmlGpuInstance_t gpuInstance, unsigned int profileId, nvmlComputeInstance_t* computeInstances, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlGpuInstanceGetComputeInstanceById(nvmlGpuInstance_t gpuInstance, unsigned int id, nvmlComputeInstance_t* computeInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlComputeInstanceGetInfo_v2(nvmlComputeInstance_t computeInstance, nvmlComputeInstanceInfo_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceIsMigDeviceHandle(nvmlDevice_t device, unsigned int* isMigDevice) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetGpuInstanceId(nvmlDevice_t device, unsigned int* id) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetComputeInstanceId(nvmlDevice_t device, unsigned int* id) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetMaxMigDeviceCount(nvmlDevice_t device, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetMigDeviceHandleByIndex(nvmlDevice_t device, unsigned int index, nvmlDevice_t* migDevice) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetDeviceHandleFromMigDeviceHandle(nvmlDevice_t migDevice, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetCapabilities(nvmlDevice_t device, nvmlDeviceCapabilities_t* caps) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDevicePowerSmoothingActivatePresetProfile(nvmlDevice_t device, nvmlPowerSmoothingProfile_t* profile) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDevicePowerSmoothingUpdatePresetProfileParam(nvmlDevice_t device, nvmlPowerSmoothingProfile_t* profile) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDevicePowerSmoothingSetState(nvmlDevice_t device, nvmlPowerSmoothingState_t* state) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetAddressingMode(nvmlDevice_t device, nvmlDeviceAddressingMode_t* mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetRepairStatus(nvmlDevice_t device, nvmlRepairStatus_t* repairStatus) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetPowerMizerMode_v1(nvmlDevice_t device, nvmlDevicePowerMizerModes_v1_t* powerMizerMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetPowerMizerMode_v1(nvmlDevice_t device, nvmlDevicePowerMizerModes_v1_t* powerMizerMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetPdi(nvmlDevice_t device, nvmlPdi_t* pdi) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetHostname_v1(nvmlDevice_t device, nvmlHostname_v1_t* hostname) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetHostname_v1(nvmlDevice_t device, nvmlHostname_v1_t* hostname) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetNvLinkInfo(nvmlDevice_t device, nvmlNvLinkInfo_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceReadWritePRM_v1(nvmlDevice_t device, nvmlPRMTLV_v1_t* buffer) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetGpuInstanceProfileInfoByIdV(nvmlDevice_t device, unsigned int profileId, nvmlGpuInstanceProfileInfo_v2_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts(nvmlDevice_t device, nvmlEccSramUniqueUncorrectedErrorCounts_t* errorCounts) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetUnrepairableMemoryFlag_v1(nvmlDevice_t device, nvmlUnrepairableMemoryStatus_v1_t* unrepairableMemoryStatus) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceReadPRMCounters_v1(nvmlDevice_t device, nvmlPRMCounterList_v1_t* counterList) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetRusdSettings_v1(nvmlDevice_t device, nvmlRusdSettings_v1_t* settings) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceVgpuForceGspUnload(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetVgpuSchedulerState_v2(nvmlDevice_t device, nvmlVgpuSchedulerStateInfo_v2_t* pSchedulerStateInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlGpuInstanceGetVgpuSchedulerState_v2(nvmlGpuInstance_t gpuInstance, nvmlVgpuSchedulerStateInfo_v2_t* pSchedulerStateInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceGetVgpuSchedulerLog_v2(nvmlDevice_t device, nvmlVgpuSchedulerLogInfo_v2_t* pSchedulerLogInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlGpuInstanceGetVgpuSchedulerLog_v2(nvmlGpuInstance_t gpuInstance, nvmlVgpuSchedulerLogInfo_v2_t* pSchedulerLogInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlDeviceSetVgpuSchedulerState_v2(nvmlDevice_t device, nvmlVgpuSchedulerState_v2_t* pSchedulerState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil +cdef nvmlReturn_t nvmlGpuInstanceSetVgpuSchedulerState_v2(nvmlGpuInstance_t gpuInstance, nvmlVgpuSchedulerState_v2_t* pSchedulerState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil diff --git a/cuda_bindings/cuda/bindings/cynvml.pyx b/cuda_bindings/cuda/bindings/cynvml.pyx new file mode 100644 index 00000000000..612368c7736 --- /dev/null +++ b/cuda_bindings/cuda/bindings/cynvml.pyx @@ -0,0 +1,1416 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +# This code was automatically generated across versions from 12.9.1 to 13.3.0. Do not modify it directly. + +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=ec221879a459b2de9b3dfe54cba58613e9c08b279a95f782a450c98fd7cea532 +from ._internal cimport nvml as _nvml + + +############################################################################### +# Wrapper functions +############################################################################### + +cdef nvmlReturn_t nvmlInit_v2() except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlInit_v2() + + +cdef nvmlReturn_t nvmlInitWithFlags(unsigned int flags) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlInitWithFlags(flags) + + +cdef nvmlReturn_t nvmlShutdown() except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlShutdown() + + +cdef const char* nvmlErrorString(nvmlReturn_t result) except?NULL nogil: + return _nvml._nvmlErrorString(result) + + +cdef nvmlReturn_t nvmlSystemGetDriverVersion(char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlSystemGetDriverVersion(version, length) + + +cdef nvmlReturn_t nvmlSystemGetNVMLVersion(char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlSystemGetNVMLVersion(version, length) + + +cdef nvmlReturn_t nvmlSystemGetCudaDriverVersion(int* cudaDriverVersion) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlSystemGetCudaDriverVersion(cudaDriverVersion) + + +cdef nvmlReturn_t nvmlSystemGetCudaDriverVersion_v2(int* cudaDriverVersion) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlSystemGetCudaDriverVersion_v2(cudaDriverVersion) + + +cdef nvmlReturn_t nvmlSystemGetProcessName(unsigned int pid, char* name, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlSystemGetProcessName(pid, name, length) + + +cdef nvmlReturn_t nvmlSystemGetHicVersion(unsigned int* hwbcCount, nvmlHwbcEntry_t* hwbcEntries) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlSystemGetHicVersion(hwbcCount, hwbcEntries) + + +cdef nvmlReturn_t nvmlSystemGetTopologyGpuSet(unsigned int cpuNumber, unsigned int* count, nvmlDevice_t* deviceArray) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlSystemGetTopologyGpuSet(cpuNumber, count, deviceArray) + + +cdef nvmlReturn_t nvmlSystemGetDriverBranch(nvmlSystemDriverBranchInfo_t* branchInfo, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlSystemGetDriverBranch(branchInfo, length) + + +cdef nvmlReturn_t nvmlUnitGetCount(unsigned int* unitCount) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlUnitGetCount(unitCount) + + +cdef nvmlReturn_t nvmlUnitGetHandleByIndex(unsigned int index, nvmlUnit_t* unit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlUnitGetHandleByIndex(index, unit) + + +cdef nvmlReturn_t nvmlUnitGetUnitInfo(nvmlUnit_t unit, nvmlUnitInfo_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlUnitGetUnitInfo(unit, info) + + +cdef nvmlReturn_t nvmlUnitGetLedState(nvmlUnit_t unit, nvmlLedState_t* state) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlUnitGetLedState(unit, state) + + +cdef nvmlReturn_t nvmlUnitGetPsuInfo(nvmlUnit_t unit, nvmlPSUInfo_t* psu) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlUnitGetPsuInfo(unit, psu) + + +cdef nvmlReturn_t nvmlUnitGetTemperature(nvmlUnit_t unit, unsigned int type, unsigned int* temp) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlUnitGetTemperature(unit, type, temp) + + +cdef nvmlReturn_t nvmlUnitGetFanSpeedInfo(nvmlUnit_t unit, nvmlUnitFanSpeeds_t* fanSpeeds) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlUnitGetFanSpeedInfo(unit, fanSpeeds) + + +cdef nvmlReturn_t nvmlUnitGetDevices(nvmlUnit_t unit, unsigned int* deviceCount, nvmlDevice_t* devices) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlUnitGetDevices(unit, deviceCount, devices) + + +cdef nvmlReturn_t nvmlDeviceGetCount_v2(unsigned int* deviceCount) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetCount_v2(deviceCount) + + +cdef nvmlReturn_t nvmlDeviceGetAttributes_v2(nvmlDevice_t device, nvmlDeviceAttributes_t* attributes) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetAttributes_v2(device, attributes) + + +cdef nvmlReturn_t nvmlDeviceGetHandleByIndex_v2(unsigned int index, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetHandleByIndex_v2(index, device) + + +cdef nvmlReturn_t nvmlDeviceGetHandleBySerial(const char* serial, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetHandleBySerial(serial, device) + + +cdef nvmlReturn_t nvmlDeviceGetHandleByUUID(const char* uuid, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetHandleByUUID(uuid, device) + + +cdef nvmlReturn_t nvmlDeviceGetHandleByUUIDV(const nvmlUUID_t* uuid, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetHandleByUUIDV(uuid, device) + + +cdef nvmlReturn_t nvmlDeviceGetHandleByPciBusId_v2(const char* pciBusId, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetHandleByPciBusId_v2(pciBusId, device) + + +cdef nvmlReturn_t nvmlDeviceGetName(nvmlDevice_t device, char* name, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetName(device, name, length) + + +cdef nvmlReturn_t nvmlDeviceGetBrand(nvmlDevice_t device, nvmlBrandType_t* type) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetBrand(device, type) + + +cdef nvmlReturn_t nvmlDeviceGetIndex(nvmlDevice_t device, unsigned int* index) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetIndex(device, index) + + +cdef nvmlReturn_t nvmlDeviceGetSerial(nvmlDevice_t device, char* serial, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetSerial(device, serial, length) + + +cdef nvmlReturn_t nvmlDeviceGetModuleId(nvmlDevice_t device, unsigned int* moduleId) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetModuleId(device, moduleId) + + +cdef nvmlReturn_t nvmlDeviceGetC2cModeInfoV(nvmlDevice_t device, nvmlC2cModeInfo_v1_t* c2cModeInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetC2cModeInfoV(device, c2cModeInfo) + + +cdef nvmlReturn_t nvmlDeviceGetMemoryAffinity(nvmlDevice_t device, unsigned int nodeSetSize, unsigned long* nodeSet, nvmlAffinityScope_t scope) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetMemoryAffinity(device, nodeSetSize, nodeSet, scope) + + +cdef nvmlReturn_t nvmlDeviceGetCpuAffinityWithinScope(nvmlDevice_t device, unsigned int cpuSetSize, unsigned long* cpuSet, nvmlAffinityScope_t scope) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetCpuAffinityWithinScope(device, cpuSetSize, cpuSet, scope) + + +cdef nvmlReturn_t nvmlDeviceGetCpuAffinity(nvmlDevice_t device, unsigned int cpuSetSize, unsigned long* cpuSet) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetCpuAffinity(device, cpuSetSize, cpuSet) + + +cdef nvmlReturn_t nvmlDeviceSetCpuAffinity(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetCpuAffinity(device) + + +cdef nvmlReturn_t nvmlDeviceClearCpuAffinity(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceClearCpuAffinity(device) + + +cdef nvmlReturn_t nvmlDeviceGetNumaNodeId(nvmlDevice_t device, unsigned int* node) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetNumaNodeId(device, node) + + +cdef nvmlReturn_t nvmlDeviceGetTopologyCommonAncestor(nvmlDevice_t device1, nvmlDevice_t device2, nvmlGpuTopologyLevel_t* pathInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetTopologyCommonAncestor(device1, device2, pathInfo) + + +cdef nvmlReturn_t nvmlDeviceGetTopologyNearestGpus(nvmlDevice_t device, nvmlGpuTopologyLevel_t level, unsigned int* count, nvmlDevice_t* deviceArray) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetTopologyNearestGpus(device, level, count, deviceArray) + + +cdef nvmlReturn_t nvmlDeviceGetP2PStatus(nvmlDevice_t device1, nvmlDevice_t device2, nvmlGpuP2PCapsIndex_t p2pIndex, nvmlGpuP2PStatus_t* p2pStatus) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetP2PStatus(device1, device2, p2pIndex, p2pStatus) + + +cdef nvmlReturn_t nvmlDeviceGetUUID(nvmlDevice_t device, char* uuid, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetUUID(device, uuid, length) + + +cdef nvmlReturn_t nvmlDeviceGetMinorNumber(nvmlDevice_t device, unsigned int* minorNumber) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetMinorNumber(device, minorNumber) + + +cdef nvmlReturn_t nvmlDeviceGetBoardPartNumber(nvmlDevice_t device, char* partNumber, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetBoardPartNumber(device, partNumber, length) + + +cdef nvmlReturn_t nvmlDeviceGetInforomVersion(nvmlDevice_t device, nvmlInforomObject_t object, char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetInforomVersion(device, object, version, length) + + +cdef nvmlReturn_t nvmlDeviceGetInforomImageVersion(nvmlDevice_t device, char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetInforomImageVersion(device, version, length) + + +cdef nvmlReturn_t nvmlDeviceGetInforomConfigurationChecksum(nvmlDevice_t device, unsigned int* checksum) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetInforomConfigurationChecksum(device, checksum) + + +cdef nvmlReturn_t nvmlDeviceValidateInforom(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceValidateInforom(device) + + +cdef nvmlReturn_t nvmlDeviceGetLastBBXFlushTime(nvmlDevice_t device, unsigned long long* timestamp, unsigned long* durationUs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetLastBBXFlushTime(device, timestamp, durationUs) + + +cdef nvmlReturn_t nvmlDeviceGetDisplayMode(nvmlDevice_t device, nvmlEnableState_t* display) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetDisplayMode(device, display) + + +cdef nvmlReturn_t nvmlDeviceGetDisplayActive(nvmlDevice_t device, nvmlEnableState_t* isActive) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetDisplayActive(device, isActive) + + +cdef nvmlReturn_t nvmlDeviceGetPersistenceMode(nvmlDevice_t device, nvmlEnableState_t* mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetPersistenceMode(device, mode) + + +cdef nvmlReturn_t nvmlDeviceGetPciInfoExt(nvmlDevice_t device, nvmlPciInfoExt_t* pci) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetPciInfoExt(device, pci) + + +cdef nvmlReturn_t nvmlDeviceGetPciInfo_v3(nvmlDevice_t device, nvmlPciInfo_t* pci) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetPciInfo_v3(device, pci) + + +cdef nvmlReturn_t nvmlDeviceGetMaxPcieLinkGeneration(nvmlDevice_t device, unsigned int* maxLinkGen) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetMaxPcieLinkGeneration(device, maxLinkGen) + + +cdef nvmlReturn_t nvmlDeviceGetGpuMaxPcieLinkGeneration(nvmlDevice_t device, unsigned int* maxLinkGenDevice) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetGpuMaxPcieLinkGeneration(device, maxLinkGenDevice) + + +cdef nvmlReturn_t nvmlDeviceGetMaxPcieLinkWidth(nvmlDevice_t device, unsigned int* maxLinkWidth) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetMaxPcieLinkWidth(device, maxLinkWidth) + + +cdef nvmlReturn_t nvmlDeviceGetCurrPcieLinkGeneration(nvmlDevice_t device, unsigned int* currLinkGen) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetCurrPcieLinkGeneration(device, currLinkGen) + + +cdef nvmlReturn_t nvmlDeviceGetCurrPcieLinkWidth(nvmlDevice_t device, unsigned int* currLinkWidth) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetCurrPcieLinkWidth(device, currLinkWidth) + + +cdef nvmlReturn_t nvmlDeviceGetPcieThroughput(nvmlDevice_t device, nvmlPcieUtilCounter_t counter, unsigned int* value) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetPcieThroughput(device, counter, value) + + +cdef nvmlReturn_t nvmlDeviceGetPcieReplayCounter(nvmlDevice_t device, unsigned int* value) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetPcieReplayCounter(device, value) + + +cdef nvmlReturn_t nvmlDeviceGetClockInfo(nvmlDevice_t device, nvmlClockType_t type, unsigned int* clock) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetClockInfo(device, type, clock) + + +cdef nvmlReturn_t nvmlDeviceGetMaxClockInfo(nvmlDevice_t device, nvmlClockType_t type, unsigned int* clock) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetMaxClockInfo(device, type, clock) + + +cdef nvmlReturn_t nvmlDeviceGetGpcClkVfOffset(nvmlDevice_t device, int* offset) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetGpcClkVfOffset(device, offset) + + +cdef nvmlReturn_t nvmlDeviceGetClock(nvmlDevice_t device, nvmlClockType_t clockType, nvmlClockId_t clockId, unsigned int* clockMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetClock(device, clockType, clockId, clockMHz) + + +cdef nvmlReturn_t nvmlDeviceGetMaxCustomerBoostClock(nvmlDevice_t device, nvmlClockType_t clockType, unsigned int* clockMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetMaxCustomerBoostClock(device, clockType, clockMHz) + + +cdef nvmlReturn_t nvmlDeviceGetSupportedMemoryClocks(nvmlDevice_t device, unsigned int* count, unsigned int* clocksMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetSupportedMemoryClocks(device, count, clocksMHz) + + +cdef nvmlReturn_t nvmlDeviceGetSupportedGraphicsClocks(nvmlDevice_t device, unsigned int memoryClockMHz, unsigned int* count, unsigned int* clocksMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetSupportedGraphicsClocks(device, memoryClockMHz, count, clocksMHz) + + +cdef nvmlReturn_t nvmlDeviceGetAutoBoostedClocksEnabled(nvmlDevice_t device, nvmlEnableState_t* isEnabled, nvmlEnableState_t* defaultIsEnabled) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetAutoBoostedClocksEnabled(device, isEnabled, defaultIsEnabled) + + +cdef nvmlReturn_t nvmlDeviceGetFanSpeed(nvmlDevice_t device, unsigned int* speed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetFanSpeed(device, speed) + + +cdef nvmlReturn_t nvmlDeviceGetFanSpeed_v2(nvmlDevice_t device, unsigned int fan, unsigned int* speed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetFanSpeed_v2(device, fan, speed) + + +cdef nvmlReturn_t nvmlDeviceGetFanSpeedRPM(nvmlDevice_t device, nvmlFanSpeedInfo_t* fanSpeed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetFanSpeedRPM(device, fanSpeed) + + +cdef nvmlReturn_t nvmlDeviceGetTargetFanSpeed(nvmlDevice_t device, unsigned int fan, unsigned int* targetSpeed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetTargetFanSpeed(device, fan, targetSpeed) + + +cdef nvmlReturn_t nvmlDeviceGetMinMaxFanSpeed(nvmlDevice_t device, unsigned int* minSpeed, unsigned int* maxSpeed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetMinMaxFanSpeed(device, minSpeed, maxSpeed) + + +cdef nvmlReturn_t nvmlDeviceGetFanControlPolicy_v2(nvmlDevice_t device, unsigned int fan, nvmlFanControlPolicy_t* policy) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetFanControlPolicy_v2(device, fan, policy) + + +cdef nvmlReturn_t nvmlDeviceGetNumFans(nvmlDevice_t device, unsigned int* numFans) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetNumFans(device, numFans) + + +cdef nvmlReturn_t nvmlDeviceGetCoolerInfo(nvmlDevice_t device, nvmlCoolerInfo_t* coolerInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetCoolerInfo(device, coolerInfo) + + +cdef nvmlReturn_t nvmlDeviceGetTemperatureV(nvmlDevice_t device, nvmlTemperature_t* temperature) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetTemperatureV(device, temperature) + + +cdef nvmlReturn_t nvmlDeviceGetTemperatureThreshold(nvmlDevice_t device, nvmlTemperatureThresholds_t thresholdType, unsigned int* temp) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetTemperatureThreshold(device, thresholdType, temp) + + +cdef nvmlReturn_t nvmlDeviceGetMarginTemperature(nvmlDevice_t device, nvmlMarginTemperature_t* marginTempInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetMarginTemperature(device, marginTempInfo) + + +cdef nvmlReturn_t nvmlDeviceGetThermalSettings(nvmlDevice_t device, unsigned int sensorIndex, nvmlGpuThermalSettings_t* pThermalSettings) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetThermalSettings(device, sensorIndex, pThermalSettings) + + +cdef nvmlReturn_t nvmlDeviceGetPerformanceState(nvmlDevice_t device, nvmlPstates_t* pState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetPerformanceState(device, pState) + + +cdef nvmlReturn_t nvmlDeviceGetCurrentClocksEventReasons(nvmlDevice_t device, unsigned long long* clocksEventReasons) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetCurrentClocksEventReasons(device, clocksEventReasons) + + +cdef nvmlReturn_t nvmlDeviceGetSupportedClocksEventReasons(nvmlDevice_t device, unsigned long long* supportedClocksEventReasons) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetSupportedClocksEventReasons(device, supportedClocksEventReasons) + + +cdef nvmlReturn_t nvmlDeviceGetPowerState(nvmlDevice_t device, nvmlPstates_t* pState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetPowerState(device, pState) + + +cdef nvmlReturn_t nvmlDeviceGetDynamicPstatesInfo(nvmlDevice_t device, nvmlGpuDynamicPstatesInfo_t* pDynamicPstatesInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetDynamicPstatesInfo(device, pDynamicPstatesInfo) + + +cdef nvmlReturn_t nvmlDeviceGetMemClkVfOffset(nvmlDevice_t device, int* offset) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetMemClkVfOffset(device, offset) + + +cdef nvmlReturn_t nvmlDeviceGetMinMaxClockOfPState(nvmlDevice_t device, nvmlClockType_t type, nvmlPstates_t pstate, unsigned int* minClockMHz, unsigned int* maxClockMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetMinMaxClockOfPState(device, type, pstate, minClockMHz, maxClockMHz) + + +cdef nvmlReturn_t nvmlDeviceGetSupportedPerformanceStates(nvmlDevice_t device, nvmlPstates_t* pstates, unsigned int size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetSupportedPerformanceStates(device, pstates, size) + + +cdef nvmlReturn_t nvmlDeviceGetGpcClkMinMaxVfOffset(nvmlDevice_t device, int* minOffset, int* maxOffset) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetGpcClkMinMaxVfOffset(device, minOffset, maxOffset) + + +cdef nvmlReturn_t nvmlDeviceGetMemClkMinMaxVfOffset(nvmlDevice_t device, int* minOffset, int* maxOffset) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetMemClkMinMaxVfOffset(device, minOffset, maxOffset) + + +cdef nvmlReturn_t nvmlDeviceGetClockOffsets(nvmlDevice_t device, nvmlClockOffset_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetClockOffsets(device, info) + + +cdef nvmlReturn_t nvmlDeviceSetClockOffsets(nvmlDevice_t device, nvmlClockOffset_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetClockOffsets(device, info) + + +cdef nvmlReturn_t nvmlDeviceGetPerformanceModes(nvmlDevice_t device, nvmlDevicePerfModes_t* perfModes) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetPerformanceModes(device, perfModes) + + +cdef nvmlReturn_t nvmlDeviceGetCurrentClockFreqs(nvmlDevice_t device, nvmlDeviceCurrentClockFreqs_t* currentClockFreqs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetCurrentClockFreqs(device, currentClockFreqs) + + +cdef nvmlReturn_t nvmlDeviceGetPowerManagementLimit(nvmlDevice_t device, unsigned int* limit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetPowerManagementLimit(device, limit) + + +cdef nvmlReturn_t nvmlDeviceGetPowerManagementLimitConstraints(nvmlDevice_t device, unsigned int* minLimit, unsigned int* maxLimit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetPowerManagementLimitConstraints(device, minLimit, maxLimit) + + +cdef nvmlReturn_t nvmlDeviceGetPowerManagementDefaultLimit(nvmlDevice_t device, unsigned int* defaultLimit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetPowerManagementDefaultLimit(device, defaultLimit) + + +cdef nvmlReturn_t nvmlDeviceGetPowerUsage(nvmlDevice_t device, unsigned int* power) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetPowerUsage(device, power) + + +cdef nvmlReturn_t nvmlDeviceGetTotalEnergyConsumption(nvmlDevice_t device, unsigned long long* energy) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetTotalEnergyConsumption(device, energy) + + +cdef nvmlReturn_t nvmlDeviceGetEnforcedPowerLimit(nvmlDevice_t device, unsigned int* limit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetEnforcedPowerLimit(device, limit) + + +cdef nvmlReturn_t nvmlDeviceGetGpuOperationMode(nvmlDevice_t device, nvmlGpuOperationMode_t* current, nvmlGpuOperationMode_t* pending) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetGpuOperationMode(device, current, pending) + + +cdef nvmlReturn_t nvmlDeviceGetMemoryInfo_v2(nvmlDevice_t device, nvmlMemory_v2_t* memory) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetMemoryInfo_v2(device, memory) + + +cdef nvmlReturn_t nvmlDeviceGetComputeMode(nvmlDevice_t device, nvmlComputeMode_t* mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetComputeMode(device, mode) + + +cdef nvmlReturn_t nvmlDeviceGetCudaComputeCapability(nvmlDevice_t device, int* major, int* minor) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetCudaComputeCapability(device, major, minor) + + +cdef nvmlReturn_t nvmlDeviceGetDramEncryptionMode(nvmlDevice_t device, nvmlDramEncryptionInfo_t* current, nvmlDramEncryptionInfo_t* pending) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetDramEncryptionMode(device, current, pending) + + +cdef nvmlReturn_t nvmlDeviceSetDramEncryptionMode(nvmlDevice_t device, const nvmlDramEncryptionInfo_t* dramEncryption) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetDramEncryptionMode(device, dramEncryption) + + +cdef nvmlReturn_t nvmlDeviceGetEccMode(nvmlDevice_t device, nvmlEnableState_t* current, nvmlEnableState_t* pending) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetEccMode(device, current, pending) + + +cdef nvmlReturn_t nvmlDeviceGetDefaultEccMode(nvmlDevice_t device, nvmlEnableState_t* defaultMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetDefaultEccMode(device, defaultMode) + + +cdef nvmlReturn_t nvmlDeviceGetBoardId(nvmlDevice_t device, unsigned int* boardId) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetBoardId(device, boardId) + + +cdef nvmlReturn_t nvmlDeviceGetMultiGpuBoard(nvmlDevice_t device, unsigned int* multiGpuBool) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetMultiGpuBoard(device, multiGpuBool) + + +cdef nvmlReturn_t nvmlDeviceGetTotalEccErrors(nvmlDevice_t device, nvmlMemoryErrorType_t errorType, nvmlEccCounterType_t counterType, unsigned long long* eccCounts) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetTotalEccErrors(device, errorType, counterType, eccCounts) + + +cdef nvmlReturn_t nvmlDeviceGetMemoryErrorCounter(nvmlDevice_t device, nvmlMemoryErrorType_t errorType, nvmlEccCounterType_t counterType, nvmlMemoryLocation_t locationType, unsigned long long* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetMemoryErrorCounter(device, errorType, counterType, locationType, count) + + +cdef nvmlReturn_t nvmlDeviceGetUtilizationRates(nvmlDevice_t device, nvmlUtilization_t* utilization) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetUtilizationRates(device, utilization) + + +cdef nvmlReturn_t nvmlDeviceGetEncoderUtilization(nvmlDevice_t device, unsigned int* utilization, unsigned int* samplingPeriodUs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetEncoderUtilization(device, utilization, samplingPeriodUs) + + +cdef nvmlReturn_t nvmlDeviceGetEncoderCapacity(nvmlDevice_t device, nvmlEncoderType_t encoderQueryType, unsigned int* encoderCapacity) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetEncoderCapacity(device, encoderQueryType, encoderCapacity) + + +cdef nvmlReturn_t nvmlDeviceGetEncoderStats(nvmlDevice_t device, unsigned int* sessionCount, unsigned int* averageFps, unsigned int* averageLatency) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetEncoderStats(device, sessionCount, averageFps, averageLatency) + + +cdef nvmlReturn_t nvmlDeviceGetEncoderSessions(nvmlDevice_t device, unsigned int* sessionCount, nvmlEncoderSessionInfo_t* sessionInfos) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetEncoderSessions(device, sessionCount, sessionInfos) + + +cdef nvmlReturn_t nvmlDeviceGetDecoderUtilization(nvmlDevice_t device, unsigned int* utilization, unsigned int* samplingPeriodUs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetDecoderUtilization(device, utilization, samplingPeriodUs) + + +cdef nvmlReturn_t nvmlDeviceGetJpgUtilization(nvmlDevice_t device, unsigned int* utilization, unsigned int* samplingPeriodUs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetJpgUtilization(device, utilization, samplingPeriodUs) + + +cdef nvmlReturn_t nvmlDeviceGetOfaUtilization(nvmlDevice_t device, unsigned int* utilization, unsigned int* samplingPeriodUs) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetOfaUtilization(device, utilization, samplingPeriodUs) + + +cdef nvmlReturn_t nvmlDeviceGetFBCStats(nvmlDevice_t device, nvmlFBCStats_t* fbcStats) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetFBCStats(device, fbcStats) + + +cdef nvmlReturn_t nvmlDeviceGetFBCSessions(nvmlDevice_t device, unsigned int* sessionCount, nvmlFBCSessionInfo_t* sessionInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetFBCSessions(device, sessionCount, sessionInfo) + + +cdef nvmlReturn_t nvmlDeviceGetDriverModel_v2(nvmlDevice_t device, nvmlDriverModel_t* current, nvmlDriverModel_t* pending) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetDriverModel_v2(device, current, pending) + + +cdef nvmlReturn_t nvmlDeviceGetVbiosVersion(nvmlDevice_t device, char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetVbiosVersion(device, version, length) + + +cdef nvmlReturn_t nvmlDeviceGetBridgeChipInfo(nvmlDevice_t device, nvmlBridgeChipHierarchy_t* bridgeHierarchy) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetBridgeChipInfo(device, bridgeHierarchy) + + +cdef nvmlReturn_t nvmlDeviceGetComputeRunningProcesses_v3(nvmlDevice_t device, unsigned int* infoCount, nvmlProcessInfo_t* infos) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetComputeRunningProcesses_v3(device, infoCount, infos) + + +cdef nvmlReturn_t nvmlDeviceGetGraphicsRunningProcesses_v3(nvmlDevice_t device, unsigned int* infoCount, nvmlProcessInfo_t* infos) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetGraphicsRunningProcesses_v3(device, infoCount, infos) + + +cdef nvmlReturn_t nvmlDeviceGetMPSComputeRunningProcesses_v3(nvmlDevice_t device, unsigned int* infoCount, nvmlProcessInfo_t* infos) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetMPSComputeRunningProcesses_v3(device, infoCount, infos) + + +cdef nvmlReturn_t nvmlDeviceGetRunningProcessDetailList(nvmlDevice_t device, nvmlProcessDetailList_t* plist) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetRunningProcessDetailList(device, plist) + + +cdef nvmlReturn_t nvmlDeviceOnSameBoard(nvmlDevice_t device1, nvmlDevice_t device2, int* onSameBoard) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceOnSameBoard(device1, device2, onSameBoard) + + +cdef nvmlReturn_t nvmlDeviceGetAPIRestriction(nvmlDevice_t device, nvmlRestrictedAPI_t apiType, nvmlEnableState_t* isRestricted) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetAPIRestriction(device, apiType, isRestricted) + + +cdef nvmlReturn_t nvmlDeviceGetSamples(nvmlDevice_t device, nvmlSamplingType_t type, unsigned long long lastSeenTimeStamp, nvmlValueType_t* sampleValType, unsigned int* sampleCount, nvmlSample_t* samples) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetSamples(device, type, lastSeenTimeStamp, sampleValType, sampleCount, samples) + + +cdef nvmlReturn_t nvmlDeviceGetBAR1MemoryInfo(nvmlDevice_t device, nvmlBAR1Memory_t* bar1Memory) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetBAR1MemoryInfo(device, bar1Memory) + + +cdef nvmlReturn_t nvmlDeviceGetIrqNum(nvmlDevice_t device, unsigned int* irqNum) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetIrqNum(device, irqNum) + + +cdef nvmlReturn_t nvmlDeviceGetNumGpuCores(nvmlDevice_t device, unsigned int* numCores) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetNumGpuCores(device, numCores) + + +cdef nvmlReturn_t nvmlDeviceGetPowerSource(nvmlDevice_t device, nvmlPowerSource_t* powerSource) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetPowerSource(device, powerSource) + + +cdef nvmlReturn_t nvmlDeviceGetMemoryBusWidth(nvmlDevice_t device, unsigned int* busWidth) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetMemoryBusWidth(device, busWidth) + + +cdef nvmlReturn_t nvmlDeviceGetPcieLinkMaxSpeed(nvmlDevice_t device, unsigned int* maxSpeed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetPcieLinkMaxSpeed(device, maxSpeed) + + +cdef nvmlReturn_t nvmlDeviceGetPcieSpeed(nvmlDevice_t device, unsigned int* pcieSpeed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetPcieSpeed(device, pcieSpeed) + + +cdef nvmlReturn_t nvmlDeviceGetAdaptiveClockInfoStatus(nvmlDevice_t device, unsigned int* adaptiveClockStatus) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetAdaptiveClockInfoStatus(device, adaptiveClockStatus) + + +cdef nvmlReturn_t nvmlDeviceGetBusType(nvmlDevice_t device, nvmlBusType_t* type) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetBusType(device, type) + + +cdef nvmlReturn_t nvmlDeviceGetGpuFabricInfoV(nvmlDevice_t device, nvmlGpuFabricInfoV_t* gpuFabricInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetGpuFabricInfoV(device, gpuFabricInfo) + + +cdef nvmlReturn_t nvmlSystemGetConfComputeCapabilities(nvmlConfComputeSystemCaps_t* capabilities) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlSystemGetConfComputeCapabilities(capabilities) + + +cdef nvmlReturn_t nvmlSystemGetConfComputeState(nvmlConfComputeSystemState_t* state) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlSystemGetConfComputeState(state) + + +cdef nvmlReturn_t nvmlDeviceGetConfComputeMemSizeInfo(nvmlDevice_t device, nvmlConfComputeMemSizeInfo_t* memInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetConfComputeMemSizeInfo(device, memInfo) + + +cdef nvmlReturn_t nvmlSystemGetConfComputeGpusReadyState(unsigned int* isAcceptingWork) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlSystemGetConfComputeGpusReadyState(isAcceptingWork) + + +cdef nvmlReturn_t nvmlDeviceGetConfComputeProtectedMemoryUsage(nvmlDevice_t device, nvmlMemory_t* memory) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetConfComputeProtectedMemoryUsage(device, memory) + + +cdef nvmlReturn_t nvmlDeviceGetConfComputeGpuCertificate(nvmlDevice_t device, nvmlConfComputeGpuCertificate_t* gpuCert) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetConfComputeGpuCertificate(device, gpuCert) + + +cdef nvmlReturn_t nvmlDeviceGetConfComputeGpuAttestationReport(nvmlDevice_t device, nvmlConfComputeGpuAttestationReport_t* gpuAtstReport) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetConfComputeGpuAttestationReport(device, gpuAtstReport) + + +cdef nvmlReturn_t nvmlSystemGetConfComputeKeyRotationThresholdInfo(nvmlConfComputeGetKeyRotationThresholdInfo_t* pKeyRotationThrInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlSystemGetConfComputeKeyRotationThresholdInfo(pKeyRotationThrInfo) + + +cdef nvmlReturn_t nvmlDeviceSetConfComputeUnprotectedMemSize(nvmlDevice_t device, unsigned long long sizeKiB) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetConfComputeUnprotectedMemSize(device, sizeKiB) + + +cdef nvmlReturn_t nvmlSystemSetConfComputeGpusReadyState(unsigned int isAcceptingWork) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlSystemSetConfComputeGpusReadyState(isAcceptingWork) + + +cdef nvmlReturn_t nvmlSystemSetConfComputeKeyRotationThresholdInfo(nvmlConfComputeSetKeyRotationThresholdInfo_t* pKeyRotationThrInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlSystemSetConfComputeKeyRotationThresholdInfo(pKeyRotationThrInfo) + + +cdef nvmlReturn_t nvmlSystemGetConfComputeSettings(nvmlSystemConfComputeSettings_t* settings) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlSystemGetConfComputeSettings(settings) + + +cdef nvmlReturn_t nvmlDeviceGetGspFirmwareVersion(nvmlDevice_t device, char* version) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetGspFirmwareVersion(device, version) + + +cdef nvmlReturn_t nvmlDeviceGetGspFirmwareMode(nvmlDevice_t device, unsigned int* isEnabled, unsigned int* defaultMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetGspFirmwareMode(device, isEnabled, defaultMode) + + +cdef nvmlReturn_t nvmlDeviceGetSramEccErrorStatus(nvmlDevice_t device, nvmlEccSramErrorStatus_t* status) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetSramEccErrorStatus(device, status) + + +cdef nvmlReturn_t nvmlDeviceGetAccountingMode(nvmlDevice_t device, nvmlEnableState_t* mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetAccountingMode(device, mode) + + +cdef nvmlReturn_t nvmlDeviceGetAccountingStats(nvmlDevice_t device, unsigned int pid, nvmlAccountingStats_t* stats) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetAccountingStats(device, pid, stats) + + +cdef nvmlReturn_t nvmlDeviceGetAccountingPids(nvmlDevice_t device, unsigned int* count, unsigned int* pids) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetAccountingPids(device, count, pids) + + +cdef nvmlReturn_t nvmlDeviceGetAccountingBufferSize(nvmlDevice_t device, unsigned int* bufferSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetAccountingBufferSize(device, bufferSize) + + +cdef nvmlReturn_t nvmlDeviceGetRetiredPages(nvmlDevice_t device, nvmlPageRetirementCause_t cause, unsigned int* pageCount, unsigned long long* addresses) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetRetiredPages(device, cause, pageCount, addresses) + + +cdef nvmlReturn_t nvmlDeviceGetRetiredPages_v2(nvmlDevice_t device, nvmlPageRetirementCause_t cause, unsigned int* pageCount, unsigned long long* addresses, unsigned long long* timestamps) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetRetiredPages_v2(device, cause, pageCount, addresses, timestamps) + + +cdef nvmlReturn_t nvmlDeviceGetRetiredPagesPendingStatus(nvmlDevice_t device, nvmlEnableState_t* isPending) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetRetiredPagesPendingStatus(device, isPending) + + +cdef nvmlReturn_t nvmlDeviceGetRemappedRows(nvmlDevice_t device, unsigned int* corrRows, unsigned int* uncRows, unsigned int* isPending, unsigned int* failureOccurred) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetRemappedRows(device, corrRows, uncRows, isPending, failureOccurred) + + +cdef nvmlReturn_t nvmlDeviceGetRowRemapperHistogram(nvmlDevice_t device, nvmlRowRemapperHistogramValues_t* values) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetRowRemapperHistogram(device, values) + + +cdef nvmlReturn_t nvmlDeviceGetArchitecture(nvmlDevice_t device, nvmlDeviceArchitecture_t* arch) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetArchitecture(device, arch) + + +cdef nvmlReturn_t nvmlDeviceGetClkMonStatus(nvmlDevice_t device, nvmlClkMonStatus_t* status) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetClkMonStatus(device, status) + + +cdef nvmlReturn_t nvmlDeviceGetProcessUtilization(nvmlDevice_t device, nvmlProcessUtilizationSample_t* utilization, unsigned int* processSamplesCount, unsigned long long lastSeenTimeStamp) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetProcessUtilization(device, utilization, processSamplesCount, lastSeenTimeStamp) + + +cdef nvmlReturn_t nvmlDeviceGetProcessesUtilizationInfo(nvmlDevice_t device, nvmlProcessesUtilizationInfo_t* procesesUtilInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetProcessesUtilizationInfo(device, procesesUtilInfo) + + +cdef nvmlReturn_t nvmlDeviceGetPlatformInfo(nvmlDevice_t device, nvmlPlatformInfo_t* platformInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetPlatformInfo(device, platformInfo) + + +cdef nvmlReturn_t nvmlUnitSetLedState(nvmlUnit_t unit, nvmlLedColor_t color) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlUnitSetLedState(unit, color) + + +cdef nvmlReturn_t nvmlDeviceSetPersistenceMode(nvmlDevice_t device, nvmlEnableState_t mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetPersistenceMode(device, mode) + + +cdef nvmlReturn_t nvmlDeviceSetComputeMode(nvmlDevice_t device, nvmlComputeMode_t mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetComputeMode(device, mode) + + +cdef nvmlReturn_t nvmlDeviceSetEccMode(nvmlDevice_t device, nvmlEnableState_t ecc) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetEccMode(device, ecc) + + +cdef nvmlReturn_t nvmlDeviceClearEccErrorCounts(nvmlDevice_t device, nvmlEccCounterType_t counterType) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceClearEccErrorCounts(device, counterType) + + +cdef nvmlReturn_t nvmlDeviceSetDriverModel(nvmlDevice_t device, nvmlDriverModel_t driverModel, unsigned int flags) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetDriverModel(device, driverModel, flags) + + +cdef nvmlReturn_t nvmlDeviceSetGpuLockedClocks(nvmlDevice_t device, unsigned int minGpuClockMHz, unsigned int maxGpuClockMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetGpuLockedClocks(device, minGpuClockMHz, maxGpuClockMHz) + + +cdef nvmlReturn_t nvmlDeviceResetGpuLockedClocks(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceResetGpuLockedClocks(device) + + +cdef nvmlReturn_t nvmlDeviceSetMemoryLockedClocks(nvmlDevice_t device, unsigned int minMemClockMHz, unsigned int maxMemClockMHz) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetMemoryLockedClocks(device, minMemClockMHz, maxMemClockMHz) + + +cdef nvmlReturn_t nvmlDeviceResetMemoryLockedClocks(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceResetMemoryLockedClocks(device) + + +cdef nvmlReturn_t nvmlDeviceSetAutoBoostedClocksEnabled(nvmlDevice_t device, nvmlEnableState_t enabled) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetAutoBoostedClocksEnabled(device, enabled) + + +cdef nvmlReturn_t nvmlDeviceSetDefaultAutoBoostedClocksEnabled(nvmlDevice_t device, nvmlEnableState_t enabled, unsigned int flags) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetDefaultAutoBoostedClocksEnabled(device, enabled, flags) + + +cdef nvmlReturn_t nvmlDeviceSetDefaultFanSpeed_v2(nvmlDevice_t device, unsigned int fan) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetDefaultFanSpeed_v2(device, fan) + + +cdef nvmlReturn_t nvmlDeviceSetFanControlPolicy(nvmlDevice_t device, unsigned int fan, nvmlFanControlPolicy_t policy) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetFanControlPolicy(device, fan, policy) + + +cdef nvmlReturn_t nvmlDeviceSetTemperatureThreshold(nvmlDevice_t device, nvmlTemperatureThresholds_t thresholdType, int* temp) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetTemperatureThreshold(device, thresholdType, temp) + + +cdef nvmlReturn_t nvmlDeviceSetGpuOperationMode(nvmlDevice_t device, nvmlGpuOperationMode_t mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetGpuOperationMode(device, mode) + + +cdef nvmlReturn_t nvmlDeviceSetAPIRestriction(nvmlDevice_t device, nvmlRestrictedAPI_t apiType, nvmlEnableState_t isRestricted) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetAPIRestriction(device, apiType, isRestricted) + + +cdef nvmlReturn_t nvmlDeviceSetFanSpeed_v2(nvmlDevice_t device, unsigned int fan, unsigned int speed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetFanSpeed_v2(device, fan, speed) + + +cdef nvmlReturn_t nvmlDeviceSetAccountingMode(nvmlDevice_t device, nvmlEnableState_t mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetAccountingMode(device, mode) + + +cdef nvmlReturn_t nvmlDeviceClearAccountingPids(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceClearAccountingPids(device) + + +cdef nvmlReturn_t nvmlDeviceSetPowerManagementLimit_v2(nvmlDevice_t device, nvmlPowerValue_v2_t* powerValue) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetPowerManagementLimit_v2(device, powerValue) + + +cdef nvmlReturn_t nvmlDeviceGetNvLinkState(nvmlDevice_t device, unsigned int link, nvmlEnableState_t* isActive) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetNvLinkState(device, link, isActive) + + +cdef nvmlReturn_t nvmlDeviceGetNvLinkVersion(nvmlDevice_t device, unsigned int link, unsigned int* version) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetNvLinkVersion(device, link, version) + + +cdef nvmlReturn_t nvmlDeviceGetNvLinkCapability(nvmlDevice_t device, unsigned int link, nvmlNvLinkCapability_t capability, unsigned int* capResult) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetNvLinkCapability(device, link, capability, capResult) + + +cdef nvmlReturn_t nvmlDeviceGetNvLinkRemotePciInfo_v2(nvmlDevice_t device, unsigned int link, nvmlPciInfo_t* pci) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetNvLinkRemotePciInfo_v2(device, link, pci) + + +cdef nvmlReturn_t nvmlDeviceGetNvLinkErrorCounter(nvmlDevice_t device, unsigned int link, nvmlNvLinkErrorCounter_t counter, unsigned long long* counterValue) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetNvLinkErrorCounter(device, link, counter, counterValue) + + +cdef nvmlReturn_t nvmlDeviceResetNvLinkErrorCounters(nvmlDevice_t device, unsigned int link) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceResetNvLinkErrorCounters(device, link) + + +cdef nvmlReturn_t nvmlDeviceGetNvLinkRemoteDeviceType(nvmlDevice_t device, unsigned int link, nvmlIntNvLinkDeviceType_t* pNvLinkDeviceType) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetNvLinkRemoteDeviceType(device, link, pNvLinkDeviceType) + + +cdef nvmlReturn_t nvmlDeviceSetNvLinkDeviceLowPowerThreshold(nvmlDevice_t device, nvmlNvLinkPowerThres_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetNvLinkDeviceLowPowerThreshold(device, info) + + +cdef nvmlReturn_t nvmlSystemSetNvlinkBwMode(unsigned int nvlinkBwMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlSystemSetNvlinkBwMode(nvlinkBwMode) + + +cdef nvmlReturn_t nvmlSystemGetNvlinkBwMode(unsigned int* nvlinkBwMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlSystemGetNvlinkBwMode(nvlinkBwMode) + + +cdef nvmlReturn_t nvmlDeviceGetNvlinkSupportedBwModes(nvmlDevice_t device, nvmlNvlinkSupportedBwModes_t* supportedBwMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetNvlinkSupportedBwModes(device, supportedBwMode) + + +cdef nvmlReturn_t nvmlDeviceGetNvlinkBwMode(nvmlDevice_t device, nvmlNvlinkGetBwMode_t* getBwMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetNvlinkBwMode(device, getBwMode) + + +cdef nvmlReturn_t nvmlDeviceSetNvlinkBwMode(nvmlDevice_t device, nvmlNvlinkSetBwMode_t* setBwMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetNvlinkBwMode(device, setBwMode) + + +cdef nvmlReturn_t nvmlEventSetCreate(nvmlEventSet_t* set) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlEventSetCreate(set) + + +cdef nvmlReturn_t nvmlDeviceRegisterEvents(nvmlDevice_t device, unsigned long long eventTypes, nvmlEventSet_t set) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceRegisterEvents(device, eventTypes, set) + + +cdef nvmlReturn_t nvmlDeviceGetSupportedEventTypes(nvmlDevice_t device, unsigned long long* eventTypes) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetSupportedEventTypes(device, eventTypes) + + +cdef nvmlReturn_t nvmlEventSetWait_v2(nvmlEventSet_t set, nvmlEventData_t* data, unsigned int timeoutms) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlEventSetWait_v2(set, data, timeoutms) + + +cdef nvmlReturn_t nvmlEventSetFree(nvmlEventSet_t set) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlEventSetFree(set) + + +cdef nvmlReturn_t nvmlSystemEventSetCreate(nvmlSystemEventSetCreateRequest_t* request) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlSystemEventSetCreate(request) + + +cdef nvmlReturn_t nvmlSystemEventSetFree(nvmlSystemEventSetFreeRequest_t* request) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlSystemEventSetFree(request) + + +cdef nvmlReturn_t nvmlSystemRegisterEvents(nvmlSystemRegisterEventRequest_t* request) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlSystemRegisterEvents(request) + + +cdef nvmlReturn_t nvmlSystemEventSetWait(nvmlSystemEventSetWaitRequest_t* request) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlSystemEventSetWait(request) + + +cdef nvmlReturn_t nvmlDeviceModifyDrainState(nvmlPciInfo_t* pciInfo, nvmlEnableState_t newState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceModifyDrainState(pciInfo, newState) + + +cdef nvmlReturn_t nvmlDeviceQueryDrainState(nvmlPciInfo_t* pciInfo, nvmlEnableState_t* currentState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceQueryDrainState(pciInfo, currentState) + + +cdef nvmlReturn_t nvmlDeviceRemoveGpu_v2(nvmlPciInfo_t* pciInfo, nvmlDetachGpuState_t gpuState, nvmlPcieLinkState_t linkState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceRemoveGpu_v2(pciInfo, gpuState, linkState) + + +cdef nvmlReturn_t nvmlDeviceDiscoverGpus(nvmlPciInfo_t* pciInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceDiscoverGpus(pciInfo) + + +cdef nvmlReturn_t nvmlDeviceGetFieldValues(nvmlDevice_t device, int valuesCount, nvmlFieldValue_t* values) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetFieldValues(device, valuesCount, values) + + +cdef nvmlReturn_t nvmlDeviceClearFieldValues(nvmlDevice_t device, int valuesCount, nvmlFieldValue_t* values) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceClearFieldValues(device, valuesCount, values) + + +cdef nvmlReturn_t nvmlDeviceGetVirtualizationMode(nvmlDevice_t device, nvmlGpuVirtualizationMode_t* pVirtualMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetVirtualizationMode(device, pVirtualMode) + + +cdef nvmlReturn_t nvmlDeviceGetHostVgpuMode(nvmlDevice_t device, nvmlHostVgpuMode_t* pHostVgpuMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetHostVgpuMode(device, pHostVgpuMode) + + +cdef nvmlReturn_t nvmlDeviceSetVirtualizationMode(nvmlDevice_t device, nvmlGpuVirtualizationMode_t virtualMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetVirtualizationMode(device, virtualMode) + + +cdef nvmlReturn_t nvmlDeviceGetVgpuHeterogeneousMode(nvmlDevice_t device, nvmlVgpuHeterogeneousMode_t* pHeterogeneousMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetVgpuHeterogeneousMode(device, pHeterogeneousMode) + + +cdef nvmlReturn_t nvmlDeviceSetVgpuHeterogeneousMode(nvmlDevice_t device, const nvmlVgpuHeterogeneousMode_t* pHeterogeneousMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetVgpuHeterogeneousMode(device, pHeterogeneousMode) + + +cdef nvmlReturn_t nvmlVgpuInstanceGetPlacementId(nvmlVgpuInstance_t vgpuInstance, nvmlVgpuPlacementId_t* pPlacement) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuInstanceGetPlacementId(vgpuInstance, pPlacement) + + +cdef nvmlReturn_t nvmlDeviceGetVgpuTypeSupportedPlacements(nvmlDevice_t device, nvmlVgpuTypeId_t vgpuTypeId, nvmlVgpuPlacementList_t* pPlacementList) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetVgpuTypeSupportedPlacements(device, vgpuTypeId, pPlacementList) + + +cdef nvmlReturn_t nvmlDeviceGetVgpuTypeCreatablePlacements(nvmlDevice_t device, nvmlVgpuTypeId_t vgpuTypeId, nvmlVgpuPlacementList_t* pPlacementList) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetVgpuTypeCreatablePlacements(device, vgpuTypeId, pPlacementList) + + +cdef nvmlReturn_t nvmlVgpuTypeGetGspHeapSize(nvmlVgpuTypeId_t vgpuTypeId, unsigned long long* gspHeapSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuTypeGetGspHeapSize(vgpuTypeId, gspHeapSize) + + +cdef nvmlReturn_t nvmlVgpuTypeGetFbReservation(nvmlVgpuTypeId_t vgpuTypeId, unsigned long long* fbReservation) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuTypeGetFbReservation(vgpuTypeId, fbReservation) + + +cdef nvmlReturn_t nvmlVgpuInstanceGetRuntimeStateSize(nvmlVgpuInstance_t vgpuInstance, nvmlVgpuRuntimeState_t* pState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuInstanceGetRuntimeStateSize(vgpuInstance, pState) + + +cdef nvmlReturn_t nvmlDeviceSetVgpuCapabilities(nvmlDevice_t device, nvmlDeviceVgpuCapability_t capability, nvmlEnableState_t state) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetVgpuCapabilities(device, capability, state) + + +cdef nvmlReturn_t nvmlDeviceGetGridLicensableFeatures_v4(nvmlDevice_t device, nvmlGridLicensableFeatures_t* pGridLicensableFeatures) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetGridLicensableFeatures_v4(device, pGridLicensableFeatures) + + +cdef nvmlReturn_t nvmlGetVgpuDriverCapabilities(nvmlVgpuDriverCapability_t capability, unsigned int* capResult) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlGetVgpuDriverCapabilities(capability, capResult) + + +cdef nvmlReturn_t nvmlDeviceGetVgpuCapabilities(nvmlDevice_t device, nvmlDeviceVgpuCapability_t capability, unsigned int* capResult) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetVgpuCapabilities(device, capability, capResult) + + +cdef nvmlReturn_t nvmlDeviceGetSupportedVgpus(nvmlDevice_t device, unsigned int* vgpuCount, nvmlVgpuTypeId_t* vgpuTypeIds) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetSupportedVgpus(device, vgpuCount, vgpuTypeIds) + + +cdef nvmlReturn_t nvmlDeviceGetCreatableVgpus(nvmlDevice_t device, unsigned int* vgpuCount, nvmlVgpuTypeId_t* vgpuTypeIds) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetCreatableVgpus(device, vgpuCount, vgpuTypeIds) + + +cdef nvmlReturn_t nvmlVgpuTypeGetClass(nvmlVgpuTypeId_t vgpuTypeId, char* vgpuTypeClass, unsigned int* size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuTypeGetClass(vgpuTypeId, vgpuTypeClass, size) + + +cdef nvmlReturn_t nvmlVgpuTypeGetName(nvmlVgpuTypeId_t vgpuTypeId, char* vgpuTypeName, unsigned int* size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuTypeGetName(vgpuTypeId, vgpuTypeName, size) + + +cdef nvmlReturn_t nvmlVgpuTypeGetGpuInstanceProfileId(nvmlVgpuTypeId_t vgpuTypeId, unsigned int* gpuInstanceProfileId) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuTypeGetGpuInstanceProfileId(vgpuTypeId, gpuInstanceProfileId) + + +cdef nvmlReturn_t nvmlVgpuTypeGetDeviceID(nvmlVgpuTypeId_t vgpuTypeId, unsigned long long* deviceID, unsigned long long* subsystemID) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuTypeGetDeviceID(vgpuTypeId, deviceID, subsystemID) + + +cdef nvmlReturn_t nvmlVgpuTypeGetFramebufferSize(nvmlVgpuTypeId_t vgpuTypeId, unsigned long long* fbSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuTypeGetFramebufferSize(vgpuTypeId, fbSize) + + +cdef nvmlReturn_t nvmlVgpuTypeGetNumDisplayHeads(nvmlVgpuTypeId_t vgpuTypeId, unsigned int* numDisplayHeads) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuTypeGetNumDisplayHeads(vgpuTypeId, numDisplayHeads) + + +cdef nvmlReturn_t nvmlVgpuTypeGetResolution(nvmlVgpuTypeId_t vgpuTypeId, unsigned int displayIndex, unsigned int* xdim, unsigned int* ydim) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuTypeGetResolution(vgpuTypeId, displayIndex, xdim, ydim) + + +cdef nvmlReturn_t nvmlVgpuTypeGetLicense(nvmlVgpuTypeId_t vgpuTypeId, char* vgpuTypeLicenseString, unsigned int size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuTypeGetLicense(vgpuTypeId, vgpuTypeLicenseString, size) + + +cdef nvmlReturn_t nvmlVgpuTypeGetFrameRateLimit(nvmlVgpuTypeId_t vgpuTypeId, unsigned int* frameRateLimit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuTypeGetFrameRateLimit(vgpuTypeId, frameRateLimit) + + +cdef nvmlReturn_t nvmlVgpuTypeGetMaxInstances(nvmlDevice_t device, nvmlVgpuTypeId_t vgpuTypeId, unsigned int* vgpuInstanceCount) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuTypeGetMaxInstances(device, vgpuTypeId, vgpuInstanceCount) + + +cdef nvmlReturn_t nvmlVgpuTypeGetMaxInstancesPerVm(nvmlVgpuTypeId_t vgpuTypeId, unsigned int* vgpuInstanceCountPerVm) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuTypeGetMaxInstancesPerVm(vgpuTypeId, vgpuInstanceCountPerVm) + + +cdef nvmlReturn_t nvmlVgpuTypeGetBAR1Info(nvmlVgpuTypeId_t vgpuTypeId, nvmlVgpuTypeBar1Info_t* bar1Info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuTypeGetBAR1Info(vgpuTypeId, bar1Info) + + +cdef nvmlReturn_t nvmlDeviceGetActiveVgpus(nvmlDevice_t device, unsigned int* vgpuCount, nvmlVgpuInstance_t* vgpuInstances) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetActiveVgpus(device, vgpuCount, vgpuInstances) + + +cdef nvmlReturn_t nvmlVgpuInstanceGetVmID(nvmlVgpuInstance_t vgpuInstance, char* vmId, unsigned int size, nvmlVgpuVmIdType_t* vmIdType) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuInstanceGetVmID(vgpuInstance, vmId, size, vmIdType) + + +cdef nvmlReturn_t nvmlVgpuInstanceGetUUID(nvmlVgpuInstance_t vgpuInstance, char* uuid, unsigned int size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuInstanceGetUUID(vgpuInstance, uuid, size) + + +cdef nvmlReturn_t nvmlVgpuInstanceGetVmDriverVersion(nvmlVgpuInstance_t vgpuInstance, char* version, unsigned int length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuInstanceGetVmDriverVersion(vgpuInstance, version, length) + + +cdef nvmlReturn_t nvmlVgpuInstanceGetFbUsage(nvmlVgpuInstance_t vgpuInstance, unsigned long long* fbUsage) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuInstanceGetFbUsage(vgpuInstance, fbUsage) + + +cdef nvmlReturn_t nvmlVgpuInstanceGetLicenseStatus(nvmlVgpuInstance_t vgpuInstance, unsigned int* licensed) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuInstanceGetLicenseStatus(vgpuInstance, licensed) + + +cdef nvmlReturn_t nvmlVgpuInstanceGetType(nvmlVgpuInstance_t vgpuInstance, nvmlVgpuTypeId_t* vgpuTypeId) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuInstanceGetType(vgpuInstance, vgpuTypeId) + + +cdef nvmlReturn_t nvmlVgpuInstanceGetFrameRateLimit(nvmlVgpuInstance_t vgpuInstance, unsigned int* frameRateLimit) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuInstanceGetFrameRateLimit(vgpuInstance, frameRateLimit) + + +cdef nvmlReturn_t nvmlVgpuInstanceGetEccMode(nvmlVgpuInstance_t vgpuInstance, nvmlEnableState_t* eccMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuInstanceGetEccMode(vgpuInstance, eccMode) + + +cdef nvmlReturn_t nvmlVgpuInstanceGetEncoderCapacity(nvmlVgpuInstance_t vgpuInstance, unsigned int* encoderCapacity) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuInstanceGetEncoderCapacity(vgpuInstance, encoderCapacity) + + +cdef nvmlReturn_t nvmlVgpuInstanceSetEncoderCapacity(nvmlVgpuInstance_t vgpuInstance, unsigned int encoderCapacity) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuInstanceSetEncoderCapacity(vgpuInstance, encoderCapacity) + + +cdef nvmlReturn_t nvmlVgpuInstanceGetEncoderStats(nvmlVgpuInstance_t vgpuInstance, unsigned int* sessionCount, unsigned int* averageFps, unsigned int* averageLatency) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuInstanceGetEncoderStats(vgpuInstance, sessionCount, averageFps, averageLatency) + + +cdef nvmlReturn_t nvmlVgpuInstanceGetEncoderSessions(nvmlVgpuInstance_t vgpuInstance, unsigned int* sessionCount, nvmlEncoderSessionInfo_t* sessionInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuInstanceGetEncoderSessions(vgpuInstance, sessionCount, sessionInfo) + + +cdef nvmlReturn_t nvmlVgpuInstanceGetFBCStats(nvmlVgpuInstance_t vgpuInstance, nvmlFBCStats_t* fbcStats) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuInstanceGetFBCStats(vgpuInstance, fbcStats) + + +cdef nvmlReturn_t nvmlVgpuInstanceGetFBCSessions(nvmlVgpuInstance_t vgpuInstance, unsigned int* sessionCount, nvmlFBCSessionInfo_t* sessionInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuInstanceGetFBCSessions(vgpuInstance, sessionCount, sessionInfo) + + +cdef nvmlReturn_t nvmlVgpuInstanceGetGpuInstanceId(nvmlVgpuInstance_t vgpuInstance, unsigned int* gpuInstanceId) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuInstanceGetGpuInstanceId(vgpuInstance, gpuInstanceId) + + +cdef nvmlReturn_t nvmlVgpuInstanceGetGpuPciId(nvmlVgpuInstance_t vgpuInstance, char* vgpuPciId, unsigned int* length) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuInstanceGetGpuPciId(vgpuInstance, vgpuPciId, length) + + +cdef nvmlReturn_t nvmlVgpuTypeGetCapabilities(nvmlVgpuTypeId_t vgpuTypeId, nvmlVgpuCapability_t capability, unsigned int* capResult) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuTypeGetCapabilities(vgpuTypeId, capability, capResult) + + +cdef nvmlReturn_t nvmlVgpuInstanceGetMdevUUID(nvmlVgpuInstance_t vgpuInstance, char* mdevUuid, unsigned int size) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuInstanceGetMdevUUID(vgpuInstance, mdevUuid, size) + + +cdef nvmlReturn_t nvmlGpuInstanceGetCreatableVgpus(nvmlGpuInstance_t gpuInstance, nvmlVgpuTypeIdInfo_t* pVgpus) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlGpuInstanceGetCreatableVgpus(gpuInstance, pVgpus) + + +cdef nvmlReturn_t nvmlVgpuTypeGetMaxInstancesPerGpuInstance(nvmlVgpuTypeMaxInstance_t* pMaxInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuTypeGetMaxInstancesPerGpuInstance(pMaxInstance) + + +cdef nvmlReturn_t nvmlGpuInstanceGetActiveVgpus(nvmlGpuInstance_t gpuInstance, nvmlActiveVgpuInstanceInfo_t* pVgpuInstanceInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlGpuInstanceGetActiveVgpus(gpuInstance, pVgpuInstanceInfo) + + +cdef nvmlReturn_t nvmlGpuInstanceSetVgpuSchedulerState(nvmlGpuInstance_t gpuInstance, nvmlVgpuSchedulerState_t* pScheduler) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlGpuInstanceSetVgpuSchedulerState(gpuInstance, pScheduler) + + +cdef nvmlReturn_t nvmlGpuInstanceGetVgpuSchedulerState(nvmlGpuInstance_t gpuInstance, nvmlVgpuSchedulerStateInfo_t* pSchedulerStateInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlGpuInstanceGetVgpuSchedulerState(gpuInstance, pSchedulerStateInfo) + + +cdef nvmlReturn_t nvmlGpuInstanceGetVgpuSchedulerLog(nvmlGpuInstance_t gpuInstance, nvmlVgpuSchedulerLogInfo_t* pSchedulerLogInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlGpuInstanceGetVgpuSchedulerLog(gpuInstance, pSchedulerLogInfo) + + +cdef nvmlReturn_t nvmlGpuInstanceGetVgpuTypeCreatablePlacements(nvmlGpuInstance_t gpuInstance, nvmlVgpuCreatablePlacementInfo_t* pCreatablePlacementInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlGpuInstanceGetVgpuTypeCreatablePlacements(gpuInstance, pCreatablePlacementInfo) + + +cdef nvmlReturn_t nvmlGpuInstanceGetVgpuHeterogeneousMode(nvmlGpuInstance_t gpuInstance, nvmlVgpuHeterogeneousMode_t* pHeterogeneousMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlGpuInstanceGetVgpuHeterogeneousMode(gpuInstance, pHeterogeneousMode) + + +cdef nvmlReturn_t nvmlGpuInstanceSetVgpuHeterogeneousMode(nvmlGpuInstance_t gpuInstance, const nvmlVgpuHeterogeneousMode_t* pHeterogeneousMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlGpuInstanceSetVgpuHeterogeneousMode(gpuInstance, pHeterogeneousMode) + + +cdef nvmlReturn_t nvmlVgpuInstanceGetMetadata(nvmlVgpuInstance_t vgpuInstance, nvmlVgpuMetadata_t* vgpuMetadata, unsigned int* bufferSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuInstanceGetMetadata(vgpuInstance, vgpuMetadata, bufferSize) + + +cdef nvmlReturn_t nvmlDeviceGetVgpuMetadata(nvmlDevice_t device, nvmlVgpuPgpuMetadata_t* pgpuMetadata, unsigned int* bufferSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetVgpuMetadata(device, pgpuMetadata, bufferSize) + + +cdef nvmlReturn_t nvmlGetVgpuCompatibility(nvmlVgpuMetadata_t* vgpuMetadata, nvmlVgpuPgpuMetadata_t* pgpuMetadata, nvmlVgpuPgpuCompatibility_t* compatibilityInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlGetVgpuCompatibility(vgpuMetadata, pgpuMetadata, compatibilityInfo) + + +cdef nvmlReturn_t nvmlDeviceGetPgpuMetadataString(nvmlDevice_t device, char* pgpuMetadata, unsigned int* bufferSize) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetPgpuMetadataString(device, pgpuMetadata, bufferSize) + + +cdef nvmlReturn_t nvmlDeviceGetVgpuSchedulerLog(nvmlDevice_t device, nvmlVgpuSchedulerLog_t* pSchedulerLog) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetVgpuSchedulerLog(device, pSchedulerLog) + + +cdef nvmlReturn_t nvmlDeviceGetVgpuSchedulerState(nvmlDevice_t device, nvmlVgpuSchedulerGetState_t* pSchedulerState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetVgpuSchedulerState(device, pSchedulerState) + + +cdef nvmlReturn_t nvmlDeviceGetVgpuSchedulerCapabilities(nvmlDevice_t device, nvmlVgpuSchedulerCapabilities_t* pCapabilities) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetVgpuSchedulerCapabilities(device, pCapabilities) + + +cdef nvmlReturn_t nvmlDeviceSetVgpuSchedulerState(nvmlDevice_t device, nvmlVgpuSchedulerSetState_t* pSchedulerState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetVgpuSchedulerState(device, pSchedulerState) + + +cdef nvmlReturn_t nvmlGetVgpuVersion(nvmlVgpuVersion_t* supported, nvmlVgpuVersion_t* current) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlGetVgpuVersion(supported, current) + + +cdef nvmlReturn_t nvmlSetVgpuVersion(nvmlVgpuVersion_t* vgpuVersion) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlSetVgpuVersion(vgpuVersion) + + +cdef nvmlReturn_t nvmlDeviceGetVgpuUtilization(nvmlDevice_t device, unsigned long long lastSeenTimeStamp, nvmlValueType_t* sampleValType, unsigned int* vgpuInstanceSamplesCount, nvmlVgpuInstanceUtilizationSample_t* utilizationSamples) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetVgpuUtilization(device, lastSeenTimeStamp, sampleValType, vgpuInstanceSamplesCount, utilizationSamples) + + +cdef nvmlReturn_t nvmlDeviceGetVgpuInstancesUtilizationInfo(nvmlDevice_t device, nvmlVgpuInstancesUtilizationInfo_t* vgpuUtilInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetVgpuInstancesUtilizationInfo(device, vgpuUtilInfo) + + +cdef nvmlReturn_t nvmlDeviceGetVgpuProcessUtilization(nvmlDevice_t device, unsigned long long lastSeenTimeStamp, unsigned int* vgpuProcessSamplesCount, nvmlVgpuProcessUtilizationSample_t* utilizationSamples) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetVgpuProcessUtilization(device, lastSeenTimeStamp, vgpuProcessSamplesCount, utilizationSamples) + + +cdef nvmlReturn_t nvmlDeviceGetVgpuProcessesUtilizationInfo(nvmlDevice_t device, nvmlVgpuProcessesUtilizationInfo_t* vgpuProcUtilInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetVgpuProcessesUtilizationInfo(device, vgpuProcUtilInfo) + + +cdef nvmlReturn_t nvmlVgpuInstanceGetAccountingMode(nvmlVgpuInstance_t vgpuInstance, nvmlEnableState_t* mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuInstanceGetAccountingMode(vgpuInstance, mode) + + +cdef nvmlReturn_t nvmlVgpuInstanceGetAccountingPids(nvmlVgpuInstance_t vgpuInstance, unsigned int* count, unsigned int* pids) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuInstanceGetAccountingPids(vgpuInstance, count, pids) + + +cdef nvmlReturn_t nvmlVgpuInstanceGetAccountingStats(nvmlVgpuInstance_t vgpuInstance, unsigned int pid, nvmlAccountingStats_t* stats) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuInstanceGetAccountingStats(vgpuInstance, pid, stats) + + +cdef nvmlReturn_t nvmlVgpuInstanceClearAccountingPids(nvmlVgpuInstance_t vgpuInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuInstanceClearAccountingPids(vgpuInstance) + + +cdef nvmlReturn_t nvmlVgpuInstanceGetLicenseInfo_v2(nvmlVgpuInstance_t vgpuInstance, nvmlVgpuLicenseInfo_t* licenseInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlVgpuInstanceGetLicenseInfo_v2(vgpuInstance, licenseInfo) + + +cdef nvmlReturn_t nvmlGetExcludedDeviceCount(unsigned int* deviceCount) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlGetExcludedDeviceCount(deviceCount) + + +cdef nvmlReturn_t nvmlGetExcludedDeviceInfoByIndex(unsigned int index, nvmlExcludedDeviceInfo_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlGetExcludedDeviceInfoByIndex(index, info) + + +cdef nvmlReturn_t nvmlDeviceSetMigMode(nvmlDevice_t device, unsigned int mode, nvmlReturn_t* activationStatus) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetMigMode(device, mode, activationStatus) + + +cdef nvmlReturn_t nvmlDeviceGetMigMode(nvmlDevice_t device, unsigned int* currentMode, unsigned int* pendingMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetMigMode(device, currentMode, pendingMode) + + +cdef nvmlReturn_t nvmlDeviceGetGpuInstanceProfileInfoV(nvmlDevice_t device, unsigned int profile, nvmlGpuInstanceProfileInfo_v2_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetGpuInstanceProfileInfoV(device, profile, info) + + +cdef nvmlReturn_t nvmlDeviceGetGpuInstancePossiblePlacements_v2(nvmlDevice_t device, unsigned int profileId, nvmlGpuInstancePlacement_t* placements, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetGpuInstancePossiblePlacements_v2(device, profileId, placements, count) + + +cdef nvmlReturn_t nvmlDeviceGetGpuInstanceRemainingCapacity(nvmlDevice_t device, unsigned int profileId, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetGpuInstanceRemainingCapacity(device, profileId, count) + + +cdef nvmlReturn_t nvmlDeviceCreateGpuInstance(nvmlDevice_t device, unsigned int profileId, nvmlGpuInstance_t* gpuInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceCreateGpuInstance(device, profileId, gpuInstance) + + +cdef nvmlReturn_t nvmlDeviceCreateGpuInstanceWithPlacement(nvmlDevice_t device, unsigned int profileId, const nvmlGpuInstancePlacement_t* placement, nvmlGpuInstance_t* gpuInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceCreateGpuInstanceWithPlacement(device, profileId, placement, gpuInstance) + + +cdef nvmlReturn_t nvmlGpuInstanceDestroy(nvmlGpuInstance_t gpuInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlGpuInstanceDestroy(gpuInstance) + + +cdef nvmlReturn_t nvmlDeviceGetGpuInstances(nvmlDevice_t device, unsigned int profileId, nvmlGpuInstance_t* gpuInstances, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetGpuInstances(device, profileId, gpuInstances, count) + + +cdef nvmlReturn_t nvmlDeviceGetGpuInstanceById(nvmlDevice_t device, unsigned int id, nvmlGpuInstance_t* gpuInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetGpuInstanceById(device, id, gpuInstance) + + +cdef nvmlReturn_t nvmlGpuInstanceGetInfo(nvmlGpuInstance_t gpuInstance, nvmlGpuInstanceInfo_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlGpuInstanceGetInfo(gpuInstance, info) + + +cdef nvmlReturn_t nvmlGpuInstanceGetComputeInstanceProfileInfoV(nvmlGpuInstance_t gpuInstance, unsigned int profile, unsigned int engProfile, nvmlComputeInstanceProfileInfo_v2_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlGpuInstanceGetComputeInstanceProfileInfoV(gpuInstance, profile, engProfile, info) + + +cdef nvmlReturn_t nvmlGpuInstanceGetComputeInstanceRemainingCapacity(nvmlGpuInstance_t gpuInstance, unsigned int profileId, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlGpuInstanceGetComputeInstanceRemainingCapacity(gpuInstance, profileId, count) + + +cdef nvmlReturn_t nvmlGpuInstanceGetComputeInstancePossiblePlacements(nvmlGpuInstance_t gpuInstance, unsigned int profileId, nvmlComputeInstancePlacement_t* placements, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlGpuInstanceGetComputeInstancePossiblePlacements(gpuInstance, profileId, placements, count) + + +cdef nvmlReturn_t nvmlGpuInstanceCreateComputeInstance(nvmlGpuInstance_t gpuInstance, unsigned int profileId, nvmlComputeInstance_t* computeInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlGpuInstanceCreateComputeInstance(gpuInstance, profileId, computeInstance) + + +cdef nvmlReturn_t nvmlGpuInstanceCreateComputeInstanceWithPlacement(nvmlGpuInstance_t gpuInstance, unsigned int profileId, const nvmlComputeInstancePlacement_t* placement, nvmlComputeInstance_t* computeInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlGpuInstanceCreateComputeInstanceWithPlacement(gpuInstance, profileId, placement, computeInstance) + + +cdef nvmlReturn_t nvmlComputeInstanceDestroy(nvmlComputeInstance_t computeInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlComputeInstanceDestroy(computeInstance) + + +cdef nvmlReturn_t nvmlGpuInstanceGetComputeInstances(nvmlGpuInstance_t gpuInstance, unsigned int profileId, nvmlComputeInstance_t* computeInstances, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlGpuInstanceGetComputeInstances(gpuInstance, profileId, computeInstances, count) + + +cdef nvmlReturn_t nvmlGpuInstanceGetComputeInstanceById(nvmlGpuInstance_t gpuInstance, unsigned int id, nvmlComputeInstance_t* computeInstance) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlGpuInstanceGetComputeInstanceById(gpuInstance, id, computeInstance) + + +cdef nvmlReturn_t nvmlComputeInstanceGetInfo_v2(nvmlComputeInstance_t computeInstance, nvmlComputeInstanceInfo_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlComputeInstanceGetInfo_v2(computeInstance, info) + + +cdef nvmlReturn_t nvmlDeviceIsMigDeviceHandle(nvmlDevice_t device, unsigned int* isMigDevice) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceIsMigDeviceHandle(device, isMigDevice) + + +cdef nvmlReturn_t nvmlDeviceGetGpuInstanceId(nvmlDevice_t device, unsigned int* id) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetGpuInstanceId(device, id) + + +cdef nvmlReturn_t nvmlDeviceGetComputeInstanceId(nvmlDevice_t device, unsigned int* id) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetComputeInstanceId(device, id) + + +cdef nvmlReturn_t nvmlDeviceGetMaxMigDeviceCount(nvmlDevice_t device, unsigned int* count) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetMaxMigDeviceCount(device, count) + + +cdef nvmlReturn_t nvmlDeviceGetMigDeviceHandleByIndex(nvmlDevice_t device, unsigned int index, nvmlDevice_t* migDevice) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetMigDeviceHandleByIndex(device, index, migDevice) + + +cdef nvmlReturn_t nvmlDeviceGetDeviceHandleFromMigDeviceHandle(nvmlDevice_t migDevice, nvmlDevice_t* device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetDeviceHandleFromMigDeviceHandle(migDevice, device) + + +cdef nvmlReturn_t nvmlDeviceGetCapabilities(nvmlDevice_t device, nvmlDeviceCapabilities_t* caps) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetCapabilities(device, caps) + + +cdef nvmlReturn_t nvmlDevicePowerSmoothingActivatePresetProfile(nvmlDevice_t device, nvmlPowerSmoothingProfile_t* profile) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDevicePowerSmoothingActivatePresetProfile(device, profile) + + +cdef nvmlReturn_t nvmlDevicePowerSmoothingUpdatePresetProfileParam(nvmlDevice_t device, nvmlPowerSmoothingProfile_t* profile) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDevicePowerSmoothingUpdatePresetProfileParam(device, profile) + + +cdef nvmlReturn_t nvmlDevicePowerSmoothingSetState(nvmlDevice_t device, nvmlPowerSmoothingState_t* state) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDevicePowerSmoothingSetState(device, state) + + +cdef nvmlReturn_t nvmlDeviceGetAddressingMode(nvmlDevice_t device, nvmlDeviceAddressingMode_t* mode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetAddressingMode(device, mode) + + +cdef nvmlReturn_t nvmlDeviceGetRepairStatus(nvmlDevice_t device, nvmlRepairStatus_t* repairStatus) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetRepairStatus(device, repairStatus) + + +cdef nvmlReturn_t nvmlDeviceGetPowerMizerMode_v1(nvmlDevice_t device, nvmlDevicePowerMizerModes_v1_t* powerMizerMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetPowerMizerMode_v1(device, powerMizerMode) + + +cdef nvmlReturn_t nvmlDeviceSetPowerMizerMode_v1(nvmlDevice_t device, nvmlDevicePowerMizerModes_v1_t* powerMizerMode) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetPowerMizerMode_v1(device, powerMizerMode) + + +cdef nvmlReturn_t nvmlDeviceGetPdi(nvmlDevice_t device, nvmlPdi_t* pdi) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetPdi(device, pdi) + + +cdef nvmlReturn_t nvmlDeviceSetHostname_v1(nvmlDevice_t device, nvmlHostname_v1_t* hostname) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetHostname_v1(device, hostname) + + +cdef nvmlReturn_t nvmlDeviceGetHostname_v1(nvmlDevice_t device, nvmlHostname_v1_t* hostname) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetHostname_v1(device, hostname) + + +cdef nvmlReturn_t nvmlDeviceGetNvLinkInfo(nvmlDevice_t device, nvmlNvLinkInfo_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetNvLinkInfo(device, info) + + +cdef nvmlReturn_t nvmlDeviceReadWritePRM_v1(nvmlDevice_t device, nvmlPRMTLV_v1_t* buffer) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceReadWritePRM_v1(device, buffer) + + +cdef nvmlReturn_t nvmlDeviceGetGpuInstanceProfileInfoByIdV(nvmlDevice_t device, unsigned int profileId, nvmlGpuInstanceProfileInfo_v2_t* info) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetGpuInstanceProfileInfoByIdV(device, profileId, info) + + +cdef nvmlReturn_t nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts(nvmlDevice_t device, nvmlEccSramUniqueUncorrectedErrorCounts_t* errorCounts) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts(device, errorCounts) + + +cdef nvmlReturn_t nvmlDeviceGetUnrepairableMemoryFlag_v1(nvmlDevice_t device, nvmlUnrepairableMemoryStatus_v1_t* unrepairableMemoryStatus) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetUnrepairableMemoryFlag_v1(device, unrepairableMemoryStatus) + + +cdef nvmlReturn_t nvmlDeviceReadPRMCounters_v1(nvmlDevice_t device, nvmlPRMCounterList_v1_t* counterList) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceReadPRMCounters_v1(device, counterList) + + +cdef nvmlReturn_t nvmlDeviceSetRusdSettings_v1(nvmlDevice_t device, nvmlRusdSettings_v1_t* settings) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetRusdSettings_v1(device, settings) + + +cdef nvmlReturn_t nvmlDeviceVgpuForceGspUnload(nvmlDevice_t device) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceVgpuForceGspUnload(device) + + +cdef nvmlReturn_t nvmlDeviceGetVgpuSchedulerState_v2(nvmlDevice_t device, nvmlVgpuSchedulerStateInfo_v2_t* pSchedulerStateInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetVgpuSchedulerState_v2(device, pSchedulerStateInfo) + + +cdef nvmlReturn_t nvmlGpuInstanceGetVgpuSchedulerState_v2(nvmlGpuInstance_t gpuInstance, nvmlVgpuSchedulerStateInfo_v2_t* pSchedulerStateInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlGpuInstanceGetVgpuSchedulerState_v2(gpuInstance, pSchedulerStateInfo) + + +cdef nvmlReturn_t nvmlDeviceGetVgpuSchedulerLog_v2(nvmlDevice_t device, nvmlVgpuSchedulerLogInfo_v2_t* pSchedulerLogInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceGetVgpuSchedulerLog_v2(device, pSchedulerLogInfo) + + +cdef nvmlReturn_t nvmlGpuInstanceGetVgpuSchedulerLog_v2(nvmlGpuInstance_t gpuInstance, nvmlVgpuSchedulerLogInfo_v2_t* pSchedulerLogInfo) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlGpuInstanceGetVgpuSchedulerLog_v2(gpuInstance, pSchedulerLogInfo) + + +cdef nvmlReturn_t nvmlDeviceSetVgpuSchedulerState_v2(nvmlDevice_t device, nvmlVgpuSchedulerState_v2_t* pSchedulerState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlDeviceSetVgpuSchedulerState_v2(device, pSchedulerState) + + +cdef nvmlReturn_t nvmlGpuInstanceSetVgpuSchedulerState_v2(nvmlGpuInstance_t gpuInstance, nvmlVgpuSchedulerState_v2_t* pSchedulerState) except?_NVMLRETURN_T_INTERNAL_LOADING_ERROR nogil: + return _nvml._nvmlGpuInstanceSetVgpuSchedulerState_v2(gpuInstance, pSchedulerState) diff --git a/cuda_bindings/cuda/bindings/cynvrtc.pxd b/cuda_bindings/cuda/bindings/cynvrtc.pxd new file mode 100644 index 00000000000..e377fd316e2 --- /dev/null +++ b/cuda_bindings/cuda/bindings/cynvrtc.pxd @@ -0,0 +1,87 @@ +# SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +# This code was automatically generated across versions from 12.9.0 to 13.3.0. Do not modify it directly. + +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=dbbc8028df717e2c963cb78a4e59700459ad88e1ac111c61e5992d7d007ecc5e +from libc.stdint cimport uint32_t, uint64_t + + +# ENUMS +cdef extern from 'nvrtc.h': + ctypedef enum nvrtcResult "nvrtcResult": + NVRTC_SUCCESS + NVRTC_ERROR_OUT_OF_MEMORY + NVRTC_ERROR_PROGRAM_CREATION_FAILURE + NVRTC_ERROR_INVALID_INPUT + NVRTC_ERROR_INVALID_PROGRAM + NVRTC_ERROR_INVALID_OPTION + NVRTC_ERROR_COMPILATION + NVRTC_ERROR_BUILTIN_OPERATION_FAILURE + NVRTC_ERROR_NO_NAME_EXPRESSIONS_AFTER_COMPILATION + NVRTC_ERROR_NO_LOWERED_NAMES_BEFORE_COMPILATION + NVRTC_ERROR_NAME_EXPRESSION_NOT_VALID + NVRTC_ERROR_INTERNAL_ERROR + NVRTC_ERROR_TIME_FILE_WRITE_FAILED + NVRTC_ERROR_NO_PCH_CREATE_ATTEMPTED + NVRTC_ERROR_PCH_CREATE_HEAP_EXHAUSTED + NVRTC_ERROR_PCH_CREATE + NVRTC_ERROR_CANCELLED + NVRTC_ERROR_TIME_TRACE_FILE_WRITE_FAILED + NVRTC_ERROR_BUSY +cdef enum: _NVRTCRESULT_INTERNAL_LOADING_ERROR = -42 + + +cdef enum: NVRTC_INSTALL_HEADERS_SKIP_IF_EXISTS = 0 +cdef enum: NVRTC_INSTALL_HEADERS_FORCE_OVERWRITE = 1 +cdef enum: NVRTC_INSTALL_HEADERS_NO_WAIT = 2 + + +# TYPES +cdef extern from 'nvrtc.h': + ctypedef struct _nvrtcProgram: + pass + ctypedef _nvrtcProgram* nvrtcProgram 'nvrtcProgram' + + +cdef extern from 'nvrtc.h': + ctypedef struct nvrtcBundledHeadersInfo 'nvrtcBundledHeadersInfo': + int available + size_t compressedSize + size_t uncompressedSize + int cudaVersionMajor + int cudaVersionMinor + unsigned int numFiles + + +# FUNCTIONS +cdef const char* nvrtcGetErrorString(nvrtcResult result) except?NULL nogil +cdef nvrtcResult nvrtcVersion(int* major, int* minor) except ?NVRTC_ERROR_INVALID_INPUT nogil +cdef nvrtcResult nvrtcGetNumSupportedArchs(int* numArchs) except ?NVRTC_ERROR_INVALID_INPUT nogil +cdef nvrtcResult nvrtcGetSupportedArchs(int* supportedArchs) except ?NVRTC_ERROR_INVALID_INPUT nogil +cdef nvrtcResult nvrtcCreateProgram(nvrtcProgram* prog, const char* src, const char* name, int numHeaders, const char** headers, const char** includeNames) except ?NVRTC_ERROR_INVALID_INPUT nogil +cdef nvrtcResult nvrtcDestroyProgram(nvrtcProgram* prog) except ?NVRTC_ERROR_INVALID_INPUT nogil +cdef nvrtcResult nvrtcCompileProgram(nvrtcProgram prog, int numOptions, const char** options) except ?NVRTC_ERROR_INVALID_INPUT nogil +cdef nvrtcResult nvrtcGetPTXSize(nvrtcProgram prog, size_t* ptxSizeRet) except ?NVRTC_ERROR_INVALID_INPUT nogil +cdef nvrtcResult nvrtcGetPTX(nvrtcProgram prog, char* ptx) except ?NVRTC_ERROR_INVALID_INPUT nogil +cdef nvrtcResult nvrtcGetCUBINSize(nvrtcProgram prog, size_t* cubinSizeRet) except ?NVRTC_ERROR_INVALID_INPUT nogil +cdef nvrtcResult nvrtcGetCUBIN(nvrtcProgram prog, char* cubin) except ?NVRTC_ERROR_INVALID_INPUT nogil +cdef nvrtcResult nvrtcGetLTOIRSize(nvrtcProgram prog, size_t* LTOIRSizeRet) except ?NVRTC_ERROR_INVALID_INPUT nogil +cdef nvrtcResult nvrtcGetLTOIR(nvrtcProgram prog, char* LTOIR) except ?NVRTC_ERROR_INVALID_INPUT nogil +cdef nvrtcResult nvrtcGetOptiXIRSize(nvrtcProgram prog, size_t* optixirSizeRet) except ?NVRTC_ERROR_INVALID_INPUT nogil +cdef nvrtcResult nvrtcGetOptiXIR(nvrtcProgram prog, char* optixir) except ?NVRTC_ERROR_INVALID_INPUT nogil +cdef nvrtcResult nvrtcGetProgramLogSize(nvrtcProgram prog, size_t* logSizeRet) except ?NVRTC_ERROR_INVALID_INPUT nogil +cdef nvrtcResult nvrtcGetProgramLog(nvrtcProgram prog, char* log) except ?NVRTC_ERROR_INVALID_INPUT nogil +cdef nvrtcResult nvrtcAddNameExpression(nvrtcProgram prog, const char* name_expression) except ?NVRTC_ERROR_INVALID_INPUT nogil +cdef nvrtcResult nvrtcGetLoweredName(nvrtcProgram prog, const char* name_expression, const char** lowered_name) except ?NVRTC_ERROR_INVALID_INPUT nogil +cdef nvrtcResult nvrtcGetPCHHeapSize(size_t* ret) except ?NVRTC_ERROR_INVALID_INPUT nogil +cdef nvrtcResult nvrtcSetPCHHeapSize(size_t size) except ?NVRTC_ERROR_INVALID_INPUT nogil +cdef nvrtcResult nvrtcGetPCHCreateStatus(nvrtcProgram prog) except ?NVRTC_ERROR_INVALID_INPUT nogil +cdef nvrtcResult nvrtcGetPCHHeapSizeRequired(nvrtcProgram prog, size_t* size) except ?NVRTC_ERROR_INVALID_INPUT nogil +cdef nvrtcResult nvrtcSetFlowCallback(nvrtcProgram prog, void * callback, void* payload) except ?NVRTC_ERROR_INVALID_INPUT nogil +cdef nvrtcResult nvrtcGetTileIRSize(nvrtcProgram prog, size_t* TileIRSizeRet) except ?NVRTC_ERROR_INVALID_INPUT nogil +cdef nvrtcResult nvrtcGetTileIR(nvrtcProgram prog, char* TileIR) except ?NVRTC_ERROR_INVALID_INPUT nogil +cdef nvrtcResult nvrtcInstallBundledHeaders(const char* installPath, unsigned int flags, const char** errorLog) except ?NVRTC_ERROR_INVALID_INPUT nogil +cdef nvrtcResult nvrtcGetBundledHeadersInfo(nvrtcBundledHeadersInfo* info, const char** errorLog) except ?NVRTC_ERROR_INVALID_INPUT nogil +cdef nvrtcResult nvrtcRemoveBundledHeaders(const char* installPath, const char** errorLog) except ?NVRTC_ERROR_INVALID_INPUT nogil diff --git a/cuda_bindings/cuda/bindings/cynvrtc.pyx b/cuda_bindings/cuda/bindings/cynvrtc.pyx new file mode 100644 index 00000000000..6289a40092a --- /dev/null +++ b/cuda_bindings/cuda/bindings/cynvrtc.pyx @@ -0,0 +1,123 @@ +# SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +# This code was automatically generated across versions from 12.9.0 to 13.3.0. Do not modify it directly. + +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=9725757222bfc514253ab6a6113b4e6b1c33fab841fe2fff8ebb1012ecf7715b +from ._internal cimport nvrtc as _nvrtc + +cdef const char* nvrtcGetErrorString(nvrtcResult result) except?NULL nogil: + return _nvrtc._nvrtcGetErrorString(result) + + +cdef nvrtcResult nvrtcVersion(int* major, int* minor) except ?NVRTC_ERROR_INVALID_INPUT nogil: + return _nvrtc._nvrtcVersion(major, minor) + + +cdef nvrtcResult nvrtcGetNumSupportedArchs(int* numArchs) except ?NVRTC_ERROR_INVALID_INPUT nogil: + return _nvrtc._nvrtcGetNumSupportedArchs(numArchs) + + +cdef nvrtcResult nvrtcGetSupportedArchs(int* supportedArchs) except ?NVRTC_ERROR_INVALID_INPUT nogil: + return _nvrtc._nvrtcGetSupportedArchs(supportedArchs) + + +cdef nvrtcResult nvrtcCreateProgram(nvrtcProgram* prog, const char* src, const char* name, int numHeaders, const char** headers, const char** includeNames) except ?NVRTC_ERROR_INVALID_INPUT nogil: + return _nvrtc._nvrtcCreateProgram(prog, src, name, numHeaders, headers, includeNames) + + +cdef nvrtcResult nvrtcDestroyProgram(nvrtcProgram* prog) except ?NVRTC_ERROR_INVALID_INPUT nogil: + return _nvrtc._nvrtcDestroyProgram(prog) + + +cdef nvrtcResult nvrtcCompileProgram(nvrtcProgram prog, int numOptions, const char** options) except ?NVRTC_ERROR_INVALID_INPUT nogil: + return _nvrtc._nvrtcCompileProgram(prog, numOptions, options) + + +cdef nvrtcResult nvrtcGetPTXSize(nvrtcProgram prog, size_t* ptxSizeRet) except ?NVRTC_ERROR_INVALID_INPUT nogil: + return _nvrtc._nvrtcGetPTXSize(prog, ptxSizeRet) + + +cdef nvrtcResult nvrtcGetPTX(nvrtcProgram prog, char* ptx) except ?NVRTC_ERROR_INVALID_INPUT nogil: + return _nvrtc._nvrtcGetPTX(prog, ptx) + + +cdef nvrtcResult nvrtcGetCUBINSize(nvrtcProgram prog, size_t* cubinSizeRet) except ?NVRTC_ERROR_INVALID_INPUT nogil: + return _nvrtc._nvrtcGetCUBINSize(prog, cubinSizeRet) + + +cdef nvrtcResult nvrtcGetCUBIN(nvrtcProgram prog, char* cubin) except ?NVRTC_ERROR_INVALID_INPUT nogil: + return _nvrtc._nvrtcGetCUBIN(prog, cubin) + + +cdef nvrtcResult nvrtcGetLTOIRSize(nvrtcProgram prog, size_t* LTOIRSizeRet) except ?NVRTC_ERROR_INVALID_INPUT nogil: + return _nvrtc._nvrtcGetLTOIRSize(prog, LTOIRSizeRet) + + +cdef nvrtcResult nvrtcGetLTOIR(nvrtcProgram prog, char* LTOIR) except ?NVRTC_ERROR_INVALID_INPUT nogil: + return _nvrtc._nvrtcGetLTOIR(prog, LTOIR) + + +cdef nvrtcResult nvrtcGetOptiXIRSize(nvrtcProgram prog, size_t* optixirSizeRet) except ?NVRTC_ERROR_INVALID_INPUT nogil: + return _nvrtc._nvrtcGetOptiXIRSize(prog, optixirSizeRet) + + +cdef nvrtcResult nvrtcGetOptiXIR(nvrtcProgram prog, char* optixir) except ?NVRTC_ERROR_INVALID_INPUT nogil: + return _nvrtc._nvrtcGetOptiXIR(prog, optixir) + + +cdef nvrtcResult nvrtcGetProgramLogSize(nvrtcProgram prog, size_t* logSizeRet) except ?NVRTC_ERROR_INVALID_INPUT nogil: + return _nvrtc._nvrtcGetProgramLogSize(prog, logSizeRet) + + +cdef nvrtcResult nvrtcGetProgramLog(nvrtcProgram prog, char* log) except ?NVRTC_ERROR_INVALID_INPUT nogil: + return _nvrtc._nvrtcGetProgramLog(prog, log) + + +cdef nvrtcResult nvrtcAddNameExpression(nvrtcProgram prog, const char* name_expression) except ?NVRTC_ERROR_INVALID_INPUT nogil: + return _nvrtc._nvrtcAddNameExpression(prog, name_expression) + + +cdef nvrtcResult nvrtcGetLoweredName(nvrtcProgram prog, const char* name_expression, const char** lowered_name) except ?NVRTC_ERROR_INVALID_INPUT nogil: + return _nvrtc._nvrtcGetLoweredName(prog, name_expression, lowered_name) + + +cdef nvrtcResult nvrtcGetPCHHeapSize(size_t* ret) except ?NVRTC_ERROR_INVALID_INPUT nogil: + return _nvrtc._nvrtcGetPCHHeapSize(ret) + + +cdef nvrtcResult nvrtcSetPCHHeapSize(size_t size) except ?NVRTC_ERROR_INVALID_INPUT nogil: + return _nvrtc._nvrtcSetPCHHeapSize(size) + + +cdef nvrtcResult nvrtcGetPCHCreateStatus(nvrtcProgram prog) except ?NVRTC_ERROR_INVALID_INPUT nogil: + return _nvrtc._nvrtcGetPCHCreateStatus(prog) + + +cdef nvrtcResult nvrtcGetPCHHeapSizeRequired(nvrtcProgram prog, size_t* size) except ?NVRTC_ERROR_INVALID_INPUT nogil: + return _nvrtc._nvrtcGetPCHHeapSizeRequired(prog, size) + + +cdef nvrtcResult nvrtcSetFlowCallback(nvrtcProgram prog, void * callback, void* payload) except ?NVRTC_ERROR_INVALID_INPUT nogil: + return _nvrtc._nvrtcSetFlowCallback(prog, callback, payload) + + +cdef nvrtcResult nvrtcGetTileIRSize(nvrtcProgram prog, size_t* TileIRSizeRet) except ?NVRTC_ERROR_INVALID_INPUT nogil: + return _nvrtc._nvrtcGetTileIRSize(prog, TileIRSizeRet) + + +cdef nvrtcResult nvrtcGetTileIR(nvrtcProgram prog, char* TileIR) except ?NVRTC_ERROR_INVALID_INPUT nogil: + return _nvrtc._nvrtcGetTileIR(prog, TileIR) + + +cdef nvrtcResult nvrtcInstallBundledHeaders(const char* installPath, unsigned int flags, const char** errorLog) except ?NVRTC_ERROR_INVALID_INPUT nogil: + return _nvrtc._nvrtcInstallBundledHeaders(installPath, flags, errorLog) + + +cdef nvrtcResult nvrtcGetBundledHeadersInfo(nvrtcBundledHeadersInfo* info, const char** errorLog) except ?NVRTC_ERROR_INVALID_INPUT nogil: + return _nvrtc._nvrtcGetBundledHeadersInfo(info, errorLog) + + +cdef nvrtcResult nvrtcRemoveBundledHeaders(const char* installPath, const char** errorLog) except ?NVRTC_ERROR_INVALID_INPUT nogil: + return _nvrtc._nvrtcRemoveBundledHeaders(installPath, errorLog) diff --git a/cuda_bindings/cuda/bindings/cynvvm.pxd b/cuda_bindings/cuda/bindings/cynvvm.pxd new file mode 100644 index 00000000000..f25e7e84b3b --- /dev/null +++ b/cuda_bindings/cuda/bindings/cynvvm.pxd @@ -0,0 +1,50 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +# This code was automatically generated across versions from 12.0.1 to 13.3.0. Do not modify it directly. + + +############################################################################### +# Types (structs, enums, ...) +############################################################################### + +# enums +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=79be0fd21f7c6b6112743eb60ce9e69287a66999ecaaa063d87a52ab64982bce +ctypedef enum nvvmResult "nvvmResult": + NVVM_SUCCESS "NVVM_SUCCESS" = 0 + NVVM_ERROR_OUT_OF_MEMORY "NVVM_ERROR_OUT_OF_MEMORY" = 1 + NVVM_ERROR_PROGRAM_CREATION_FAILURE "NVVM_ERROR_PROGRAM_CREATION_FAILURE" = 2 + NVVM_ERROR_IR_VERSION_MISMATCH "NVVM_ERROR_IR_VERSION_MISMATCH" = 3 + NVVM_ERROR_INVALID_INPUT "NVVM_ERROR_INVALID_INPUT" = 4 + NVVM_ERROR_INVALID_PROGRAM "NVVM_ERROR_INVALID_PROGRAM" = 5 + NVVM_ERROR_INVALID_IR "NVVM_ERROR_INVALID_IR" = 6 + NVVM_ERROR_INVALID_OPTION "NVVM_ERROR_INVALID_OPTION" = 7 + NVVM_ERROR_NO_MODULE_IN_PROGRAM "NVVM_ERROR_NO_MODULE_IN_PROGRAM" = 8 + NVVM_ERROR_COMPILATION "NVVM_ERROR_COMPILATION" = 9 + NVVM_ERROR_CANCELLED "NVVM_ERROR_CANCELLED" = 10 + _NVVMRESULT_INTERNAL_LOADING_ERROR "_NVVMRESULT_INTERNAL_LOADING_ERROR" = -42 + + +# types +ctypedef void* nvvmProgram 'nvvmProgram' + + +############################################################################### +# Functions +############################################################################### + +cdef const char* nvvmGetErrorString(nvvmResult result) except?NULL nogil +cdef nvvmResult nvvmVersion(int* major, int* minor) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvvmResult nvvmIRVersion(int* majorIR, int* minorIR, int* majorDbg, int* minorDbg) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvvmResult nvvmCreateProgram(nvvmProgram* prog) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvvmResult nvvmDestroyProgram(nvvmProgram* prog) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvvmResult nvvmAddModuleToProgram(nvvmProgram prog, const char* buffer, size_t size, const char* name) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvvmResult nvvmLazyAddModuleToProgram(nvvmProgram prog, const char* buffer, size_t size, const char* name) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvvmResult nvvmCompileProgram(nvvmProgram prog, int numOptions, const char** options) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvvmResult nvvmVerifyProgram(nvvmProgram prog, int numOptions, const char** options) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvvmResult nvvmGetCompiledResultSize(nvvmProgram prog, size_t* bufferSizeRet) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvvmResult nvvmGetCompiledResult(nvvmProgram prog, char* buffer) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvvmResult nvvmGetProgramLogSize(nvvmProgram prog, size_t* bufferSizeRet) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvvmResult nvvmGetProgramLog(nvvmProgram prog, char* buffer) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil +cdef nvvmResult nvvmLLVMVersion(const char* arch, int* major) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil diff --git a/cuda_bindings/cuda/bindings/cynvvm.pyx b/cuda_bindings/cuda/bindings/cynvvm.pyx new file mode 100644 index 00000000000..43f036a36c0 --- /dev/null +++ b/cuda_bindings/cuda/bindings/cynvvm.pyx @@ -0,0 +1,68 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +# This code was automatically generated across versions from 12.0.1 to 13.3.0. Do not modify it directly. + +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=7ea5803be62646c287bad43350e27d3254f35d25ab50b9c54f7ac5695b4c3114 +from ._internal cimport nvvm as _nvvm + + +############################################################################### +# Wrapper functions +############################################################################### + +cdef const char* nvvmGetErrorString(nvvmResult result) except?NULL nogil: + return _nvvm._nvvmGetErrorString(result) + + +cdef nvvmResult nvvmVersion(int* major, int* minor) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil: + return _nvvm._nvvmVersion(major, minor) + + +cdef nvvmResult nvvmIRVersion(int* majorIR, int* minorIR, int* majorDbg, int* minorDbg) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil: + return _nvvm._nvvmIRVersion(majorIR, minorIR, majorDbg, minorDbg) + + +cdef nvvmResult nvvmCreateProgram(nvvmProgram* prog) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil: + return _nvvm._nvvmCreateProgram(prog) + + +cdef nvvmResult nvvmDestroyProgram(nvvmProgram* prog) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil: + return _nvvm._nvvmDestroyProgram(prog) + + +cdef nvvmResult nvvmAddModuleToProgram(nvvmProgram prog, const char* buffer, size_t size, const char* name) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil: + return _nvvm._nvvmAddModuleToProgram(prog, buffer, size, name) + + +cdef nvvmResult nvvmLazyAddModuleToProgram(nvvmProgram prog, const char* buffer, size_t size, const char* name) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil: + return _nvvm._nvvmLazyAddModuleToProgram(prog, buffer, size, name) + + +cdef nvvmResult nvvmCompileProgram(nvvmProgram prog, int numOptions, const char** options) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil: + return _nvvm._nvvmCompileProgram(prog, numOptions, options) + + +cdef nvvmResult nvvmVerifyProgram(nvvmProgram prog, int numOptions, const char** options) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil: + return _nvvm._nvvmVerifyProgram(prog, numOptions, options) + + +cdef nvvmResult nvvmGetCompiledResultSize(nvvmProgram prog, size_t* bufferSizeRet) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil: + return _nvvm._nvvmGetCompiledResultSize(prog, bufferSizeRet) + + +cdef nvvmResult nvvmGetCompiledResult(nvvmProgram prog, char* buffer) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil: + return _nvvm._nvvmGetCompiledResult(prog, buffer) + + +cdef nvvmResult nvvmGetProgramLogSize(nvvmProgram prog, size_t* bufferSizeRet) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil: + return _nvvm._nvvmGetProgramLogSize(prog, bufferSizeRet) + + +cdef nvvmResult nvvmGetProgramLog(nvvmProgram prog, char* buffer) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil: + return _nvvm._nvvmGetProgramLog(prog, buffer) + + +cdef nvvmResult nvvmLLVMVersion(const char* arch, int* major) except?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil: + return _nvvm._nvvmLLVMVersion(arch, major) diff --git a/cuda_bindings/cuda/bindings/cyruntime.pxd b/cuda_bindings/cuda/bindings/cyruntime.pxd new file mode 100644 index 00000000000..58e0a14ca60 --- /dev/null +++ b/cuda_bindings/cuda/bindings/cyruntime.pxd @@ -0,0 +1,2662 @@ +# SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +# This code was automatically generated across versions from 12.9.0 to 13.3.0. Do not modify it directly. + +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=2b62a3b56226f5cf6953f578057af792369a100b7775328c5aa66d81d780d2ac +from libc.stdint cimport uint32_t, uint64_t + + +# Types overridden or aliased here because they are macros in driver_types.h +# (not real C types) and cannot be generated from headers directly. + +# GL +ctypedef unsigned int GLenum +ctypedef unsigned int GLuint + +# EGL +ctypedef void *EGLImageKHR +ctypedef void *EGLStreamKHR +ctypedef unsigned int EGLint +ctypedef void *EGLSyncKHR + +# VDPAU +ctypedef uint32_t VdpDevice +ctypedef unsigned long long VdpGetProcAddress +ctypedef uint32_t VdpVideoSurface +ctypedef uint32_t VdpOutputSurface + +# These four names are preprocessor macros in driver_types.h that alias the +# cudaLaunchAttribute* types. Omitting the C alias string is intentional: it +# preserves the Cython-mangled ABI (__pyx_t_...) that legacy_cython_gen produced, +# so downstream extensions compiled against the old headers keep working. +# Do NOT add 'CName' aliases here — that would break binary compatibility. +ctypedef cudaLaunchAttributeID cudaStreamAttrID +ctypedef cudaLaunchAttributeID cudaKernelNodeAttrID +ctypedef cudaLaunchAttributeValue cudaStreamAttrValue +ctypedef cudaLaunchAttributeValue cudaKernelNodeAttrValue + +# dim3 is used as a member type in several CUDA structs +cdef extern from 'vector_types.h': + ctypedef struct dim3 'dim3': + unsigned int x + unsigned int y + unsigned int z + +# Opaque CUDA runtime handle types declared as their underlying CU*_st pointer types +# (matching cydriver's declarations) so that runtime wrapper classes sharing _pvt_ptr +# with driver wrapper classes can assign values without Cython type errors. +cdef extern from 'driver_types.h': + cdef struct CUstream_st 'CUstream_st': + pass + ctypedef CUstream_st* cudaStream_t 'cudaStream_t' + +cdef extern from 'driver_types.h': + cdef struct CUevent_st 'CUevent_st': + pass + ctypedef CUevent_st* cudaEvent_t 'cudaEvent_t' + +cdef extern from 'driver_types.h': + cdef struct CUexternalMemory_st 'CUexternalMemory_st': + pass + ctypedef CUexternalMemory_st* cudaExternalMemory_t 'cudaExternalMemory_t' + +cdef extern from 'driver_types.h': + cdef struct CUexternalSemaphore_st 'CUexternalSemaphore_st': + pass + ctypedef CUexternalSemaphore_st* cudaExternalSemaphore_t 'cudaExternalSemaphore_t' + +cdef extern from 'driver_types.h': + cdef struct CUgraph_st 'CUgraph_st': + pass + ctypedef CUgraph_st* cudaGraph_t 'cudaGraph_t' + +cdef extern from 'driver_types.h': + cdef struct CUgraphNode_st 'CUgraphNode_st': + pass + ctypedef CUgraphNode_st* cudaGraphNode_t 'cudaGraphNode_t' + +cdef extern from 'driver_types.h': + cdef struct CUuserObject_st 'CUuserObject_st': + pass + ctypedef CUuserObject_st* cudaUserObject_t 'cudaUserObject_t' + +cdef extern from 'driver_types.h': + cdef struct CUfunc_st 'CUfunc_st': + pass + ctypedef CUfunc_st* cudaFunction_t 'cudaFunction_t' + +cdef extern from 'driver_types.h': + cdef struct CUkern_st 'CUkern_st': + pass + ctypedef CUkern_st* cudaKernel_t 'cudaKernel_t' + +cdef extern from 'driver_types.h': + cdef struct CUlib_st 'CUlib_st': + pass + ctypedef CUlib_st* cudaLibrary_t 'cudaLibrary_t' + +cdef extern from 'driver_types.h': + cdef struct CUmemPoolHandle_st 'CUmemPoolHandle_st': + pass + ctypedef CUmemPoolHandle_st* cudaMemPool_t 'cudaMemPool_t' + +cdef extern from 'driver_types.h': + cdef struct CUgraphExec_st 'CUgraphExec_st': + pass + ctypedef CUgraphExec_st* cudaGraphExec_t 'cudaGraphExec_t' + +cdef extern from 'driver_types.h': + cdef struct CUgraphDeviceUpdatableNode_st 'CUgraphDeviceUpdatableNode_st': + pass + ctypedef CUgraphDeviceUpdatableNode_st* cudaGraphDeviceNode_t 'cudaGraphDeviceNode_t' + +cdef extern from 'driver_types.h': + cdef struct CUlogsCallbackEntry_st 'CUlogsCallbackEntry_st': + pass + ctypedef CUlogsCallbackEntry_st* cudaLogsCallbackHandle 'cudaLogsCallbackHandle' + +cdef extern from 'driver_types.h': + cdef struct CUdevResourceDesc_st 'CUdevResourceDesc_st': + pass + ctypedef CUdevResourceDesc_st* cudaDevResourceDesc_t 'cudaDevResourceDesc_t' + +cdef extern from 'driver_types.h': + cdef struct cudaExecutionContext_st 'cudaExecutionContext_st': + pass + ctypedef cudaExecutionContext_st* cudaExecutionContext_t 'cudaExecutionContext_t' + +# Types that are outside the naming pattern or SKIPped but required for ABI compatibility +# with the lowpp layer (runtime.pxd) which was generated by legacy_cython_gen. +cdef extern from 'driver_types.h': + cdef struct CUuuid_st 'CUuuid_st': + char bytes[16] + ctypedef CUuuid_st CUuuid 'CUuuid' + +cdef extern from 'driver_types.h': + cdef struct cudalibraryHostUniversalFunctionAndDataTable 'cudalibraryHostUniversalFunctionAndDataTable': + void* functionTable + size_t functionWindowSize + void* dataTable + size_t dataWindowSize + +# Forward declarations for types that are SKIPped but referenced in non-skipped structs/functions +cdef extern from 'driver_types.h': + ctypedef struct cudaUUID_t 'cudaUUID_t': + char bytes[16] + +cdef extern from 'driver_types.h': + cdef struct cudaGraphicsResource 'cudaGraphicsResource': + pass + ctypedef cudaGraphicsResource* cudaGraphicsResource_t 'cudaGraphicsResource_t' + +cdef extern from *: + """ + struct CUeglStreamConnection_st; + typedef struct CUeglStreamConnection_st *cudaEglStreamConnection; + """ + cdef struct CUeglStreamConnection_st 'CUeglStreamConnection_st': + pass + +# Declared at module scope (not inside cdef extern from) so that Cython assigns +# its own mangled name (__pyx_t_...) to this typedef, preserving the Cython ABI +# that legacy_cython_gen produced for the EGL functions that take this type. +# Do NOT move this declaration back inside the cdef extern from block. +ctypedef CUeglStreamConnection_st* cudaEglStreamConnection + + +# ENUMS +cdef extern from 'driver_types.h': + cdef enum cudaError: + cudaSuccess + cudaErrorInvalidValue + cudaErrorMemoryAllocation + cudaErrorInitializationError + cudaErrorCudartUnloading + cudaErrorProfilerDisabled + cudaErrorProfilerNotInitialized + cudaErrorProfilerAlreadyStarted + cudaErrorProfilerAlreadyStopped + cudaErrorInvalidConfiguration + cudaErrorVersionTranslation + cudaErrorInvalidPitchValue + cudaErrorInvalidSymbol + cudaErrorInvalidHostPointer + cudaErrorInvalidDevicePointer + cudaErrorInvalidTexture + cudaErrorInvalidTextureBinding + cudaErrorInvalidChannelDescriptor + cudaErrorInvalidMemcpyDirection + cudaErrorAddressOfConstant + cudaErrorTextureFetchFailed + cudaErrorTextureNotBound + cudaErrorSynchronizationError + cudaErrorInvalidFilterSetting + cudaErrorInvalidNormSetting + cudaErrorMixedDeviceExecution + cudaErrorNotYetImplemented + cudaErrorMemoryValueTooLarge + cudaErrorStubLibrary + cudaErrorInsufficientDriver + cudaErrorCallRequiresNewerDriver + cudaErrorInvalidSurface + cudaErrorDuplicateVariableName + cudaErrorDuplicateTextureName + cudaErrorDuplicateSurfaceName + cudaErrorDevicesUnavailable + cudaErrorIncompatibleDriverContext + cudaErrorMissingConfiguration + cudaErrorPriorLaunchFailure + cudaErrorLaunchMaxDepthExceeded + cudaErrorLaunchFileScopedTex + cudaErrorLaunchFileScopedSurf + cudaErrorSyncDepthExceeded + cudaErrorLaunchPendingCountExceeded + cudaErrorInvalidDeviceFunction + cudaErrorNoDevice + cudaErrorInvalidDevice + cudaErrorDeviceNotLicensed + cudaErrorSoftwareValidityNotEstablished + cudaErrorStartupFailure + cudaErrorInvalidKernelImage + cudaErrorDeviceUninitialized + cudaErrorMapBufferObjectFailed + cudaErrorUnmapBufferObjectFailed + cudaErrorArrayIsMapped + cudaErrorAlreadyMapped + cudaErrorNoKernelImageForDevice + cudaErrorAlreadyAcquired + cudaErrorNotMapped + cudaErrorNotMappedAsArray + cudaErrorNotMappedAsPointer + cudaErrorECCUncorrectable + cudaErrorUnsupportedLimit + cudaErrorDeviceAlreadyInUse + cudaErrorPeerAccessUnsupported + cudaErrorInvalidPtx + cudaErrorInvalidGraphicsContext + cudaErrorNvlinkUncorrectable + cudaErrorJitCompilerNotFound + cudaErrorUnsupportedPtxVersion + cudaErrorJitCompilationDisabled + cudaErrorUnsupportedExecAffinity + cudaErrorUnsupportedDevSideSync + cudaErrorContained + cudaErrorInvalidSource + cudaErrorFileNotFound + cudaErrorSharedObjectSymbolNotFound + cudaErrorSharedObjectInitFailed + cudaErrorOperatingSystem + cudaErrorInvalidResourceHandle + cudaErrorIllegalState + cudaErrorLossyQuery + cudaErrorSymbolNotFound + cudaErrorNotReady + cudaErrorIllegalAddress + cudaErrorLaunchOutOfResources + cudaErrorLaunchTimeout + cudaErrorLaunchIncompatibleTexturing + cudaErrorPeerAccessAlreadyEnabled + cudaErrorPeerAccessNotEnabled + cudaErrorSetOnActiveProcess + cudaErrorContextIsDestroyed + cudaErrorAssert + cudaErrorTooManyPeers + cudaErrorHostMemoryAlreadyRegistered + cudaErrorHostMemoryNotRegistered + cudaErrorHardwareStackError + cudaErrorIllegalInstruction + cudaErrorMisalignedAddress + cudaErrorInvalidAddressSpace + cudaErrorInvalidPc + cudaErrorLaunchFailure + cudaErrorCooperativeLaunchTooLarge + cudaErrorTensorMemoryLeak + cudaErrorNotPermitted + cudaErrorNotSupported + cudaErrorSystemNotReady + cudaErrorSystemDriverMismatch + cudaErrorCompatNotSupportedOnDevice + cudaErrorMpsConnectionFailed + cudaErrorMpsRpcFailure + cudaErrorMpsServerNotReady + cudaErrorMpsMaxClientsReached + cudaErrorMpsMaxConnectionsReached + cudaErrorMpsClientTerminated + cudaErrorCdpNotSupported + cudaErrorCdpVersionMismatch + cudaErrorStreamCaptureUnsupported + cudaErrorStreamCaptureInvalidated + cudaErrorStreamCaptureMerge + cudaErrorStreamCaptureUnmatched + cudaErrorStreamCaptureUnjoined + cudaErrorStreamCaptureIsolation + cudaErrorStreamCaptureImplicit + cudaErrorCapturedEvent + cudaErrorStreamCaptureWrongThread + cudaErrorTimeout + cudaErrorGraphExecUpdateFailure + cudaErrorExternalDevice + cudaErrorInvalidClusterSize + cudaErrorFunctionNotLoaded + cudaErrorInvalidResourceType + cudaErrorInvalidResourceConfiguration + cudaErrorStreamDetached + cudaErrorGraphRecaptureFailure + cudaErrorUnknown + cudaErrorApiFailureBase + +cdef extern from 'driver_types.h': + cdef enum cudaChannelFormatKind: + cudaChannelFormatKindSigned + cudaChannelFormatKindUnsigned + cudaChannelFormatKindFloat + cudaChannelFormatKindNone + cudaChannelFormatKindNV12 + cudaChannelFormatKindUnsignedNormalized8X1 + cudaChannelFormatKindUnsignedNormalized8X2 + cudaChannelFormatKindUnsignedNormalized8X4 + cudaChannelFormatKindUnsignedNormalized16X1 + cudaChannelFormatKindUnsignedNormalized16X2 + cudaChannelFormatKindUnsignedNormalized16X4 + cudaChannelFormatKindSignedNormalized8X1 + cudaChannelFormatKindSignedNormalized8X2 + cudaChannelFormatKindSignedNormalized8X4 + cudaChannelFormatKindSignedNormalized16X1 + cudaChannelFormatKindSignedNormalized16X2 + cudaChannelFormatKindSignedNormalized16X4 + cudaChannelFormatKindUnsignedBlockCompressed1 + cudaChannelFormatKindUnsignedBlockCompressed1SRGB + cudaChannelFormatKindUnsignedBlockCompressed2 + cudaChannelFormatKindUnsignedBlockCompressed2SRGB + cudaChannelFormatKindUnsignedBlockCompressed3 + cudaChannelFormatKindUnsignedBlockCompressed3SRGB + cudaChannelFormatKindUnsignedBlockCompressed4 + cudaChannelFormatKindSignedBlockCompressed4 + cudaChannelFormatKindUnsignedBlockCompressed5 + cudaChannelFormatKindSignedBlockCompressed5 + cudaChannelFormatKindUnsignedBlockCompressed6H + cudaChannelFormatKindSignedBlockCompressed6H + cudaChannelFormatKindUnsignedBlockCompressed7 + cudaChannelFormatKindUnsignedBlockCompressed7SRGB + cudaChannelFormatKindUnsignedNormalized1010102 + cudaChannelFormatKindUnsigned8Packed422 + cudaChannelFormatKindUnsigned8Packed444 + cudaChannelFormatKindUnsigned8SemiPlanar420 + cudaChannelFormatKindUnsigned16SemiPlanar420 + cudaChannelFormatKindUnsigned8SemiPlanar422 + cudaChannelFormatKindUnsigned16SemiPlanar422 + cudaChannelFormatKindUnsigned8SemiPlanar444 + cudaChannelFormatKindUnsigned16SemiPlanar444 + cudaChannelFormatKindUnsigned8Planar420 + cudaChannelFormatKindUnsigned16Planar420 + cudaChannelFormatKindUnsigned8Planar422 + cudaChannelFormatKindUnsigned16Planar422 + cudaChannelFormatKindUnsigned8Planar444 + cudaChannelFormatKindUnsigned16Planar444 + +cdef extern from 'driver_types.h': + cdef enum cudaMemoryType: + cudaMemoryTypeUnregistered + cudaMemoryTypeHost + cudaMemoryTypeDevice + cudaMemoryTypeManaged + +cdef extern from 'driver_types.h': + cdef enum cudaMemcpyKind: + cudaMemcpyHostToHost + cudaMemcpyHostToDevice + cudaMemcpyDeviceToHost + cudaMemcpyDeviceToDevice + cudaMemcpyDefault + +cdef extern from 'driver_types.h': + cdef enum cudaAccessProperty: + cudaAccessPropertyNormal + cudaAccessPropertyStreaming + cudaAccessPropertyPersisting + +cdef extern from 'driver_types.h': + cdef enum cudaStreamCaptureStatus: + cudaStreamCaptureStatusNone + cudaStreamCaptureStatusActive + cudaStreamCaptureStatusInvalidated + +cdef extern from 'driver_types.h': + cdef enum cudaStreamCaptureMode: + cudaStreamCaptureModeGlobal + cudaStreamCaptureModeThreadLocal + cudaStreamCaptureModeRelaxed + +cdef extern from 'driver_types.h': + cdef enum cudaSynchronizationPolicy: + cudaSyncPolicyAuto + cudaSyncPolicySpin + cudaSyncPolicyYield + cudaSyncPolicyBlockingSync + +cdef extern from 'driver_types.h': + cdef enum cudaClusterSchedulingPolicy: + cudaClusterSchedulingPolicyDefault + cudaClusterSchedulingPolicySpread + cudaClusterSchedulingPolicyLoadBalancing + +cdef extern from 'driver_types.h': + cdef enum cudaStreamUpdateCaptureDependenciesFlags: + cudaStreamAddCaptureDependencies + cudaStreamSetCaptureDependencies + +cdef extern from 'driver_types.h': + cdef enum cudaUserObjectFlags: + cudaUserObjectNoDestructorSync + +cdef extern from 'driver_types.h': + cdef enum cudaUserObjectRetainFlags: + cudaGraphUserObjectMove + +cdef extern from 'driver_types.h': + cdef enum cudaGraphicsRegisterFlags: + cudaGraphicsRegisterFlagsNone + cudaGraphicsRegisterFlagsReadOnly + cudaGraphicsRegisterFlagsWriteDiscard + cudaGraphicsRegisterFlagsSurfaceLoadStore + cudaGraphicsRegisterFlagsTextureGather + +cdef extern from 'driver_types.h': + cdef enum cudaGraphicsMapFlags: + cudaGraphicsMapFlagsNone + cudaGraphicsMapFlagsReadOnly + cudaGraphicsMapFlagsWriteDiscard + +cdef extern from 'driver_types.h': + cdef enum cudaGraphicsCubeFace: + cudaGraphicsCubeFacePositiveX + cudaGraphicsCubeFaceNegativeX + cudaGraphicsCubeFacePositiveY + cudaGraphicsCubeFaceNegativeY + cudaGraphicsCubeFacePositiveZ + cudaGraphicsCubeFaceNegativeZ + +cdef extern from 'driver_types.h': + cdef enum cudaResourceType: + cudaResourceTypeArray + cudaResourceTypeMipmappedArray + cudaResourceTypeLinear + cudaResourceTypePitch2D + +cdef extern from 'driver_types.h': + cdef enum cudaResourceViewFormat: + cudaResViewFormatNone + cudaResViewFormatUnsignedChar1 + cudaResViewFormatUnsignedChar2 + cudaResViewFormatUnsignedChar4 + cudaResViewFormatSignedChar1 + cudaResViewFormatSignedChar2 + cudaResViewFormatSignedChar4 + cudaResViewFormatUnsignedShort1 + cudaResViewFormatUnsignedShort2 + cudaResViewFormatUnsignedShort4 + cudaResViewFormatSignedShort1 + cudaResViewFormatSignedShort2 + cudaResViewFormatSignedShort4 + cudaResViewFormatUnsignedInt1 + cudaResViewFormatUnsignedInt2 + cudaResViewFormatUnsignedInt4 + cudaResViewFormatSignedInt1 + cudaResViewFormatSignedInt2 + cudaResViewFormatSignedInt4 + cudaResViewFormatHalf1 + cudaResViewFormatHalf2 + cudaResViewFormatHalf4 + cudaResViewFormatFloat1 + cudaResViewFormatFloat2 + cudaResViewFormatFloat4 + cudaResViewFormatUnsignedBlockCompressed1 + cudaResViewFormatUnsignedBlockCompressed2 + cudaResViewFormatUnsignedBlockCompressed3 + cudaResViewFormatUnsignedBlockCompressed4 + cudaResViewFormatSignedBlockCompressed4 + cudaResViewFormatUnsignedBlockCompressed5 + cudaResViewFormatSignedBlockCompressed5 + cudaResViewFormatUnsignedBlockCompressed6H + cudaResViewFormatSignedBlockCompressed6H + cudaResViewFormatUnsignedBlockCompressed7 + +cdef extern from 'driver_types.h': + cdef enum cudaFuncAttribute: + cudaFuncAttributeMaxDynamicSharedMemorySize + cudaFuncAttributePreferredSharedMemoryCarveout + cudaFuncAttributeClusterDimMustBeSet + cudaFuncAttributeRequiredClusterWidth + cudaFuncAttributeRequiredClusterHeight + cudaFuncAttributeRequiredClusterDepth + cudaFuncAttributeNonPortableClusterSizeAllowed + cudaFuncAttributeClusterSchedulingPolicyPreference + cudaFuncAttributeMax + +cdef extern from 'driver_types.h': + cdef enum cudaFuncCache: + cudaFuncCachePreferNone + cudaFuncCachePreferShared + cudaFuncCachePreferL1 + cudaFuncCachePreferEqual + +cdef extern from 'driver_types.h': + cdef enum cudaSharedMemConfig: + cudaSharedMemBankSizeDefault + cudaSharedMemBankSizeFourByte + cudaSharedMemBankSizeEightByte + +cdef extern from 'driver_types.h': + cdef enum cudaSharedCarveout: + cudaSharedmemCarveoutDefault + cudaSharedmemCarveoutMaxShared + cudaSharedmemCarveoutMaxL1 + +cdef extern from 'driver_types.h': + cdef enum cudaComputeMode: + cudaComputeModeDefault + cudaComputeModeExclusive + cudaComputeModeProhibited + cudaComputeModeExclusiveProcess + +cdef extern from 'driver_types.h': + cdef enum cudaLimit: + cudaLimitStackSize + cudaLimitPrintfFifoSize + cudaLimitMallocHeapSize + cudaLimitDevRuntimeSyncDepth + cudaLimitDevRuntimePendingLaunchCount + cudaLimitMaxL2FetchGranularity + cudaLimitPersistingL2CacheSize + +cdef extern from 'driver_types.h': + cdef enum cudaMemoryAdvise: + cudaMemAdviseSetReadMostly + cudaMemAdviseUnsetReadMostly + cudaMemAdviseSetPreferredLocation + cudaMemAdviseUnsetPreferredLocation + cudaMemAdviseSetAccessedBy + cudaMemAdviseUnsetAccessedBy + +cdef extern from 'driver_types.h': + cdef enum cudaMemRangeAttribute: + cudaMemRangeAttributeReadMostly + cudaMemRangeAttributePreferredLocation + cudaMemRangeAttributeAccessedBy + cudaMemRangeAttributeLastPrefetchLocation + cudaMemRangeAttributePreferredLocationType + cudaMemRangeAttributePreferredLocationId + cudaMemRangeAttributeLastPrefetchLocationType + cudaMemRangeAttributeLastPrefetchLocationId + +cdef extern from 'driver_types.h': + cdef enum cudaFlushGPUDirectRDMAWritesOptions: + cudaFlushGPUDirectRDMAWritesOptionHost + cudaFlushGPUDirectRDMAWritesOptionMemOps + +cdef extern from 'driver_types.h': + cdef enum cudaGPUDirectRDMAWritesOrdering: + cudaGPUDirectRDMAWritesOrderingNone + cudaGPUDirectRDMAWritesOrderingOwner + cudaGPUDirectRDMAWritesOrderingAllDevices + +cdef extern from 'driver_types.h': + cdef enum cudaFlushGPUDirectRDMAWritesScope: + cudaFlushGPUDirectRDMAWritesToOwner + cudaFlushGPUDirectRDMAWritesToAllDevices + +cdef extern from 'driver_types.h': + cdef enum cudaFlushGPUDirectRDMAWritesTarget: + cudaFlushGPUDirectRDMAWritesTargetCurrentDevice + +cdef extern from 'driver_types.h': + cdef enum cudaDeviceAttr: + cudaDevAttrMaxThreadsPerBlock + cudaDevAttrMaxBlockDimX + cudaDevAttrMaxBlockDimY + cudaDevAttrMaxBlockDimZ + cudaDevAttrMaxGridDimX + cudaDevAttrMaxGridDimY + cudaDevAttrMaxGridDimZ + cudaDevAttrMaxSharedMemoryPerBlock + cudaDevAttrTotalConstantMemory + cudaDevAttrWarpSize + cudaDevAttrMaxPitch + cudaDevAttrMaxRegistersPerBlock + cudaDevAttrClockRate + cudaDevAttrTextureAlignment + cudaDevAttrGpuOverlap + cudaDevAttrMultiProcessorCount + cudaDevAttrKernelExecTimeout + cudaDevAttrIntegrated + cudaDevAttrCanMapHostMemory + cudaDevAttrComputeMode + cudaDevAttrMaxTexture1DWidth + cudaDevAttrMaxTexture2DWidth + cudaDevAttrMaxTexture2DHeight + cudaDevAttrMaxTexture3DWidth + cudaDevAttrMaxTexture3DHeight + cudaDevAttrMaxTexture3DDepth + cudaDevAttrMaxTexture2DLayeredWidth + cudaDevAttrMaxTexture2DLayeredHeight + cudaDevAttrMaxTexture2DLayeredLayers + cudaDevAttrSurfaceAlignment + cudaDevAttrConcurrentKernels + cudaDevAttrEccEnabled + cudaDevAttrPciBusId + cudaDevAttrPciDeviceId + cudaDevAttrTccDriver + cudaDevAttrMemoryClockRate + cudaDevAttrGlobalMemoryBusWidth + cudaDevAttrL2CacheSize + cudaDevAttrMaxThreadsPerMultiProcessor + cudaDevAttrAsyncEngineCount + cudaDevAttrUnifiedAddressing + cudaDevAttrMaxTexture1DLayeredWidth + cudaDevAttrMaxTexture1DLayeredLayers + cudaDevAttrMaxTexture2DGatherWidth + cudaDevAttrMaxTexture2DGatherHeight + cudaDevAttrMaxTexture3DWidthAlt + cudaDevAttrMaxTexture3DHeightAlt + cudaDevAttrMaxTexture3DDepthAlt + cudaDevAttrPciDomainId + cudaDevAttrTexturePitchAlignment + cudaDevAttrMaxTextureCubemapWidth + cudaDevAttrMaxTextureCubemapLayeredWidth + cudaDevAttrMaxTextureCubemapLayeredLayers + cudaDevAttrMaxSurface1DWidth + cudaDevAttrMaxSurface2DWidth + cudaDevAttrMaxSurface2DHeight + cudaDevAttrMaxSurface3DWidth + cudaDevAttrMaxSurface3DHeight + cudaDevAttrMaxSurface3DDepth + cudaDevAttrMaxSurface1DLayeredWidth + cudaDevAttrMaxSurface1DLayeredLayers + cudaDevAttrMaxSurface2DLayeredWidth + cudaDevAttrMaxSurface2DLayeredHeight + cudaDevAttrMaxSurface2DLayeredLayers + cudaDevAttrMaxSurfaceCubemapWidth + cudaDevAttrMaxSurfaceCubemapLayeredWidth + cudaDevAttrMaxSurfaceCubemapLayeredLayers + cudaDevAttrMaxTexture1DLinearWidth + cudaDevAttrMaxTexture2DLinearWidth + cudaDevAttrMaxTexture2DLinearHeight + cudaDevAttrMaxTexture2DLinearPitch + cudaDevAttrMaxTexture2DMipmappedWidth + cudaDevAttrMaxTexture2DMipmappedHeight + cudaDevAttrComputeCapabilityMajor + cudaDevAttrComputeCapabilityMinor + cudaDevAttrMaxTexture1DMipmappedWidth + cudaDevAttrStreamPrioritiesSupported + cudaDevAttrGlobalL1CacheSupported + cudaDevAttrLocalL1CacheSupported + cudaDevAttrMaxSharedMemoryPerMultiprocessor + cudaDevAttrMaxRegistersPerMultiprocessor + cudaDevAttrManagedMemory + cudaDevAttrIsMultiGpuBoard + cudaDevAttrMultiGpuBoardGroupID + cudaDevAttrHostNativeAtomicSupported + cudaDevAttrSingleToDoublePrecisionPerfRatio + cudaDevAttrPageableMemoryAccess + cudaDevAttrConcurrentManagedAccess + cudaDevAttrComputePreemptionSupported + cudaDevAttrCanUseHostPointerForRegisteredMem + cudaDevAttrReserved92 + cudaDevAttrReserved93 + cudaDevAttrReserved94 + cudaDevAttrCooperativeLaunch + cudaDevAttrReserved96 + cudaDevAttrMaxSharedMemoryPerBlockOptin + cudaDevAttrCanFlushRemoteWrites + cudaDevAttrHostRegisterSupported + cudaDevAttrPageableMemoryAccessUsesHostPageTables + cudaDevAttrDirectManagedMemAccessFromHost + cudaDevAttrMaxBlocksPerMultiprocessor + cudaDevAttrMaxPersistingL2CacheSize + cudaDevAttrMaxAccessPolicyWindowSize + cudaDevAttrReservedSharedMemoryPerBlock + cudaDevAttrSparseCudaArraySupported + cudaDevAttrHostRegisterReadOnlySupported + cudaDevAttrTimelineSemaphoreInteropSupported + cudaDevAttrMemoryPoolsSupported + cudaDevAttrGPUDirectRDMASupported + cudaDevAttrGPUDirectRDMAFlushWritesOptions + cudaDevAttrGPUDirectRDMAWritesOrdering + cudaDevAttrMemoryPoolSupportedHandleTypes + cudaDevAttrClusterLaunch + cudaDevAttrDeferredMappingCudaArraySupported + cudaDevAttrReserved122 + cudaDevAttrReserved123 + cudaDevAttrReserved124 + cudaDevAttrIpcEventSupport + cudaDevAttrMemSyncDomainCount + cudaDevAttrReserved127 + cudaDevAttrReserved128 + cudaDevAttrReserved129 + cudaDevAttrNumaConfig + cudaDevAttrNumaId + cudaDevAttrReserved132 + cudaDevAttrMpsEnabled + cudaDevAttrHostNumaId + cudaDevAttrD3D12CigSupported + cudaDevAttrVulkanCigSupported + cudaDevAttrGpuPciDeviceId + cudaDevAttrGpuPciSubsystemId + cudaDevAttrReserved141 + cudaDevAttrHostNumaMemoryPoolsSupported + cudaDevAttrHostNumaMultinodeIpcSupported + cudaDevAttrHostMemoryPoolsSupported + cudaDevAttrReserved145 + cudaDevAttrOnlyPartialHostNativeAtomicSupported + cudaDevAttrAtomicReductionSupported + cudaDevAttrCigStreamsSupported + cudaDevAttrMax + cudaDevAttrCooperativeMultiDeviceLaunch + cudaDevAttrMaxTimelineSemaphoreInteropSupported + +cdef extern from 'driver_types.h': + cdef enum cudaMemPoolAttr: + cudaMemPoolReuseFollowEventDependencies + cudaMemPoolReuseAllowOpportunistic + cudaMemPoolReuseAllowInternalDependencies + cudaMemPoolAttrReleaseThreshold + cudaMemPoolAttrReservedMemCurrent + cudaMemPoolAttrReservedMemHigh + cudaMemPoolAttrUsedMemCurrent + cudaMemPoolAttrUsedMemHigh + cudaMemPoolAttrAllocationType + cudaMemPoolAttrExportHandleTypes + cudaMemPoolAttrLocationId + cudaMemPoolAttrLocationType + cudaMemPoolAttrMaxPoolSize + cudaMemPoolAttrHwDecompressEnabled + +cdef extern from 'driver_types.h': + cdef enum cudaMemLocationType: + cudaMemLocationTypeInvalid + cudaMemLocationTypeNone + cudaMemLocationTypeDevice + cudaMemLocationTypeHost + cudaMemLocationTypeHostNuma + cudaMemLocationTypeHostNumaCurrent + cudaMemLocationTypeInvisible + +cdef extern from 'driver_types.h': + cdef enum cudaMemAccessFlags: + cudaMemAccessFlagsProtNone + cudaMemAccessFlagsProtRead + cudaMemAccessFlagsProtReadWrite + +cdef extern from 'driver_types.h': + cdef enum cudaMemAllocationType: + cudaMemAllocationTypeInvalid + cudaMemAllocationTypePinned + cudaMemAllocationTypeManaged + cudaMemAllocationTypeMax + +cdef extern from 'driver_types.h': + cdef enum cudaMemAllocationHandleType: + cudaMemHandleTypeNone + cudaMemHandleTypePosixFileDescriptor + cudaMemHandleTypeWin32 + cudaMemHandleTypeWin32Kmt + cudaMemHandleTypeFabric + +cdef extern from 'driver_types.h': + cdef enum cudaGraphMemAttributeType: + cudaGraphMemAttrUsedMemCurrent + cudaGraphMemAttrUsedMemHigh + cudaGraphMemAttrReservedMemCurrent + cudaGraphMemAttrReservedMemHigh + +cdef extern from 'driver_types.h': + cdef enum cudaMemcpyFlags: + cudaMemcpyFlagDefault + cudaMemcpyFlagPreferOverlapWithCompute + +cdef extern from 'driver_types.h': + cdef enum cudaMemcpySrcAccessOrder: + cudaMemcpySrcAccessOrderInvalid + cudaMemcpySrcAccessOrderStream + cudaMemcpySrcAccessOrderDuringApiCall + cudaMemcpySrcAccessOrderAny + cudaMemcpySrcAccessOrderMax + +cdef extern from 'driver_types.h': + cdef enum cudaMemcpy3DOperandType: + cudaMemcpyOperandTypePointer + cudaMemcpyOperandTypeArray + cudaMemcpyOperandTypeMax + +cdef extern from 'driver_types.h': + cdef enum cudaDeviceP2PAttr: + cudaDevP2PAttrPerformanceRank + cudaDevP2PAttrAccessSupported + cudaDevP2PAttrNativeAtomicSupported + cudaDevP2PAttrCudaArrayAccessSupported + cudaDevP2PAttrOnlyPartialNativeAtomicSupported + +cdef extern from 'driver_types.h': + cdef enum cudaExternalMemoryHandleType: + cudaExternalMemoryHandleTypeOpaqueFd + cudaExternalMemoryHandleTypeOpaqueWin32 + cudaExternalMemoryHandleTypeOpaqueWin32Kmt + cudaExternalMemoryHandleTypeD3D12Heap + cudaExternalMemoryHandleTypeD3D12Resource + cudaExternalMemoryHandleTypeD3D11Resource + cudaExternalMemoryHandleTypeD3D11ResourceKmt + cudaExternalMemoryHandleTypeNvSciBuf + +cdef extern from 'driver_types.h': + cdef enum cudaExternalSemaphoreHandleType: + cudaExternalSemaphoreHandleTypeOpaqueFd + cudaExternalSemaphoreHandleTypeOpaqueWin32 + cudaExternalSemaphoreHandleTypeOpaqueWin32Kmt + cudaExternalSemaphoreHandleTypeD3D12Fence + cudaExternalSemaphoreHandleTypeD3D11Fence + cudaExternalSemaphoreHandleTypeNvSciSync + cudaExternalSemaphoreHandleTypeKeyedMutex + cudaExternalSemaphoreHandleTypeKeyedMutexKmt + cudaExternalSemaphoreHandleTypeTimelineSemaphoreFd + cudaExternalSemaphoreHandleTypeTimelineSemaphoreWin32 + +cdef extern from 'driver_types.h': + ctypedef cudaError cudaError_t + +cdef extern from 'driver_types.h': + cdef enum cudaJitOption: + cudaJitMaxRegisters + cudaJitThreadsPerBlock + cudaJitWallTime + cudaJitInfoLogBuffer + cudaJitInfoLogBufferSizeBytes + cudaJitErrorLogBuffer + cudaJitErrorLogBufferSizeBytes + cudaJitOptimizationLevel + cudaJitFallbackStrategy + cudaJitGenerateDebugInfo + cudaJitLogVerbose + cudaJitGenerateLineInfo + cudaJitCacheMode + cudaJitPositionIndependentCode + cudaJitMinCtaPerSm + cudaJitMaxThreadsPerBlock + cudaJitOverrideDirectiveValues + +cdef extern from 'driver_types.h': + cdef enum cudaLibraryOption: + cudaLibraryHostUniversalFunctionAndDataTable + cudaLibraryBinaryIsPreserved + +cdef extern from 'driver_types.h': + cdef enum cudaJit_CacheMode: + cudaJitCacheOptionNone + cudaJitCacheOptionCG + cudaJitCacheOptionCA + +cdef extern from 'driver_types.h': + cdef enum cudaJit_Fallback: + cudaPreferPtx + cudaPreferBinary + +cdef extern from 'driver_types.h': + cdef enum cudaCGScope: + cudaCGScopeInvalid + cudaCGScopeGrid + cudaCGScopeReserved + cudaCGScopeMultiGrid + +cdef extern from 'driver_types.h': + cdef enum cudaGraphConditionalHandleFlags: + cudaGraphCondAssignDefault + +cdef extern from 'driver_types.h': + cdef enum cudaGraphConditionalNodeType: + cudaGraphCondTypeIf + cudaGraphCondTypeWhile + cudaGraphCondTypeSwitch + +cdef extern from 'driver_types.h': + cdef enum cudaGraphNodeType: + cudaGraphNodeTypeKernel + cudaGraphNodeTypeMemcpy + cudaGraphNodeTypeMemset + cudaGraphNodeTypeHost + cudaGraphNodeTypeGraph + cudaGraphNodeTypeEmpty + cudaGraphNodeTypeWaitEvent + cudaGraphNodeTypeEventRecord + cudaGraphNodeTypeExtSemaphoreSignal + cudaGraphNodeTypeExtSemaphoreWait + cudaGraphNodeTypeMemAlloc + cudaGraphNodeTypeMemFree + cudaGraphNodeTypeConditional + cudaGraphNodeTypeReserved16 + cudaGraphNodeTypeCount + +cdef extern from 'driver_types.h': + cdef enum cudaGraphChildGraphNodeOwnership: + cudaGraphChildGraphOwnershipClone + cudaGraphChildGraphOwnershipMove + cudaGraphChildGraphOwnershipInvalid + +cdef extern from 'driver_types.h': + cdef enum cudaGraphDependencyType_enum: + cudaGraphDependencyTypeDefault + cudaGraphDependencyTypeProgrammatic + ctypedef cudaGraphDependencyType_enum cudaGraphDependencyType + +cdef extern from 'driver_types.h': + cdef enum cudaGraphExecUpdateResult: + cudaGraphExecUpdateSuccess + cudaGraphExecUpdateError + cudaGraphExecUpdateErrorTopologyChanged + cudaGraphExecUpdateErrorNodeTypeChanged + cudaGraphExecUpdateErrorFunctionChanged + cudaGraphExecUpdateErrorParametersChanged + cudaGraphExecUpdateErrorNotSupported + cudaGraphExecUpdateErrorUnsupportedFunctionChange + cudaGraphExecUpdateErrorAttributesChanged + +cdef extern from 'driver_types.h': + cdef enum cudaGraphInstantiateResult: + cudaGraphInstantiateSuccess + cudaGraphInstantiateError + cudaGraphInstantiateInvalidStructure + cudaGraphInstantiateNodeOperationNotSupported + cudaGraphInstantiateMultipleDevicesNotSupported + cudaGraphInstantiateConditionalHandleUnused + +cdef extern from 'driver_types.h': + cdef enum cudaGraphKernelNodeField: + cudaGraphKernelNodeFieldInvalid + cudaGraphKernelNodeFieldGridDim + cudaGraphKernelNodeFieldParam + cudaGraphKernelNodeFieldEnabled + +cdef extern from 'driver_types.h': + cdef enum cudaGetDriverEntryPointFlags: + cudaEnableDefault + cudaEnableLegacyStream + cudaEnablePerThreadDefaultStream + +cdef extern from 'driver_types.h': + cdef enum cudaDriverEntryPointQueryResult: + cudaDriverEntryPointSuccess + cudaDriverEntryPointSymbolNotFound + cudaDriverEntryPointVersionNotSufficent + +cdef extern from 'driver_types.h': + cdef enum cudaGraphDebugDotFlags: + cudaGraphDebugDotFlagsVerbose + cudaGraphDebugDotFlagsKernelNodeParams + cudaGraphDebugDotFlagsMemcpyNodeParams + cudaGraphDebugDotFlagsMemsetNodeParams + cudaGraphDebugDotFlagsHostNodeParams + cudaGraphDebugDotFlagsEventNodeParams + cudaGraphDebugDotFlagsExtSemasSignalNodeParams + cudaGraphDebugDotFlagsExtSemasWaitNodeParams + cudaGraphDebugDotFlagsKernelNodeAttributes + cudaGraphDebugDotFlagsHandles + cudaGraphDebugDotFlagsConditionalNodeParams + +cdef extern from 'driver_types.h': + cdef enum cudaGraphInstantiateFlags: + cudaGraphInstantiateFlagAutoFreeOnLaunch + cudaGraphInstantiateFlagUpload + cudaGraphInstantiateFlagDeviceLaunch + cudaGraphInstantiateFlagUseNodePriority + +cdef extern from 'driver_types.h': + cdef enum cudaLaunchMemSyncDomain: + cudaLaunchMemSyncDomainDefault + cudaLaunchMemSyncDomainRemote + +cdef extern from 'driver_types.h': + cdef enum cudaLaunchAttributeID: + cudaLaunchAttributeIgnore + cudaLaunchAttributeAccessPolicyWindow + cudaLaunchAttributeCooperative + cudaLaunchAttributeSynchronizationPolicy + cudaLaunchAttributeClusterDimension + cudaLaunchAttributeClusterSchedulingPolicyPreference + cudaLaunchAttributeProgrammaticStreamSerialization + cudaLaunchAttributeProgrammaticEvent + cudaLaunchAttributePriority + cudaLaunchAttributeMemSyncDomainMap + cudaLaunchAttributeMemSyncDomain + cudaLaunchAttributePreferredClusterDimension + cudaLaunchAttributeLaunchCompletionEvent + cudaLaunchAttributeDeviceUpdatableKernelNode + cudaLaunchAttributePreferredSharedMemoryCarveout + cudaLaunchAttributeNvlinkUtilCentricScheduling + cudaLaunchAttributePortableClusterSizeMode + cudaLaunchAttributeSharedMemoryMode + +cdef extern from 'driver_types.h': + cdef enum cudaDeviceNumaConfig: + cudaDeviceNumaConfigNone + cudaDeviceNumaConfigNumaNode + +cdef extern from 'driver_types.h': + cdef enum cudaAsyncNotificationType_enum: + cudaAsyncNotificationTypeOverBudget + ctypedef cudaAsyncNotificationType_enum cudaAsyncNotificationType + +cdef extern from 'device_types.h': + cdef enum cudaRoundMode: + cudaRoundNearest + cudaRoundZero + cudaRoundPosInf + cudaRoundMinInf + +cdef extern from 'surface_types.h': + cdef enum cudaSurfaceBoundaryMode: + cudaBoundaryModeZero + cudaBoundaryModeClamp + cudaBoundaryModeTrap + +cdef extern from 'surface_types.h': + cdef enum cudaSurfaceFormatMode: + cudaFormatModeForced + cudaFormatModeAuto + +cdef extern from 'texture_types.h': + cdef enum cudaTextureAddressMode: + cudaAddressModeWrap + cudaAddressModeClamp + cudaAddressModeMirror + cudaAddressModeBorder + +cdef extern from 'texture_types.h': + cdef enum cudaTextureFilterMode: + cudaFilterModePoint + cudaFilterModeLinear + +cdef extern from 'texture_types.h': + cdef enum cudaTextureReadMode: + cudaReadModeElementType + cudaReadModeNormalizedFloat + +cdef extern from 'library_types.h': + cdef enum cudaDataType_t: + CUDA_R_16F + CUDA_C_16F + CUDA_R_16BF + CUDA_C_16BF + CUDA_R_32F + CUDA_C_32F + CUDA_R_64F + CUDA_C_64F + CUDA_R_4I + CUDA_C_4I + CUDA_R_4U + CUDA_C_4U + CUDA_R_8I + CUDA_C_8I + CUDA_R_8U + CUDA_C_8U + CUDA_R_16I + CUDA_C_16I + CUDA_R_16U + CUDA_C_16U + CUDA_R_32I + CUDA_C_32I + CUDA_R_32U + CUDA_C_32U + CUDA_R_64I + CUDA_C_64I + CUDA_R_64U + CUDA_C_64U + CUDA_R_8F_E4M3 + CUDA_R_8F_UE4M3 + CUDA_R_8F_E5M2 + CUDA_R_8F_UE8M0 + CUDA_R_6F_E2M3 + CUDA_R_6F_E3M2 + CUDA_R_4F_E2M1 + ctypedef cudaDataType_t cudaDataType + +cdef enum cudaEglFrameType_enum: + cudaEglFrameTypeArray = 0 + cudaEglFrameTypePitch = 1 +ctypedef cudaEglFrameType_enum cudaEglFrameType + +cdef enum cudaEglResourceLocationFlags_enum: + cudaEglResourceLocationSysmem = 0x00 + cudaEglResourceLocationVidmem = 0x01 +ctypedef cudaEglResourceLocationFlags_enum cudaEglResourceLocationFlags + +cdef enum cudaEglColorFormat_enum: + cudaEglColorFormatYUV420Planar = 0 + cudaEglColorFormatYUV420SemiPlanar = 1 + cudaEglColorFormatYUV422Planar = 2 + cudaEglColorFormatYUV422SemiPlanar = 3 + cudaEglColorFormatARGB = 6 + cudaEglColorFormatRGBA = 7 + cudaEglColorFormatL = 8 + cudaEglColorFormatR = 9 + cudaEglColorFormatYUV444Planar = 10 + cudaEglColorFormatYUV444SemiPlanar = 11 + cudaEglColorFormatYUYV422 = 12 + cudaEglColorFormatUYVY422 = 13 + cudaEglColorFormatABGR = 14 + cudaEglColorFormatBGRA = 15 + cudaEglColorFormatA = 16 + cudaEglColorFormatRG = 17 + cudaEglColorFormatAYUV = 18 + cudaEglColorFormatYVU444SemiPlanar = 19 + cudaEglColorFormatYVU422SemiPlanar = 20 + cudaEglColorFormatYVU420SemiPlanar = 21 + cudaEglColorFormatY10V10U10_444SemiPlanar = 22 + cudaEglColorFormatY10V10U10_420SemiPlanar = 23 + cudaEglColorFormatY12V12U12_444SemiPlanar = 24 + cudaEglColorFormatY12V12U12_420SemiPlanar = 25 + cudaEglColorFormatVYUY_ER = 26 + cudaEglColorFormatUYVY_ER = 27 + cudaEglColorFormatYUYV_ER = 28 + cudaEglColorFormatYVYU_ER = 29 + cudaEglColorFormatYUVA_ER = 31 + cudaEglColorFormatAYUV_ER = 32 + cudaEglColorFormatYUV444Planar_ER = 33 + cudaEglColorFormatYUV422Planar_ER = 34 + cudaEglColorFormatYUV420Planar_ER = 35 + cudaEglColorFormatYUV444SemiPlanar_ER = 36 + cudaEglColorFormatYUV422SemiPlanar_ER = 37 + cudaEglColorFormatYUV420SemiPlanar_ER = 38 + cudaEglColorFormatYVU444Planar_ER = 39 + cudaEglColorFormatYVU422Planar_ER = 40 + cudaEglColorFormatYVU420Planar_ER = 41 + cudaEglColorFormatYVU444SemiPlanar_ER = 42 + cudaEglColorFormatYVU422SemiPlanar_ER = 43 + cudaEglColorFormatYVU420SemiPlanar_ER = 44 + cudaEglColorFormatBayerRGGB = 45 + cudaEglColorFormatBayerBGGR = 46 + cudaEglColorFormatBayerGRBG = 47 + cudaEglColorFormatBayerGBRG = 48 + cudaEglColorFormatBayer10RGGB = 49 + cudaEglColorFormatBayer10BGGR = 50 + cudaEglColorFormatBayer10GRBG = 51 + cudaEglColorFormatBayer10GBRG = 52 + cudaEglColorFormatBayer12RGGB = 53 + cudaEglColorFormatBayer12BGGR = 54 + cudaEglColorFormatBayer12GRBG = 55 + cudaEglColorFormatBayer12GBRG = 56 + cudaEglColorFormatBayer14RGGB = 57 + cudaEglColorFormatBayer14BGGR = 58 + cudaEglColorFormatBayer14GRBG = 59 + cudaEglColorFormatBayer14GBRG = 60 + cudaEglColorFormatBayer20RGGB = 61 + cudaEglColorFormatBayer20BGGR = 62 + cudaEglColorFormatBayer20GRBG = 63 + cudaEglColorFormatBayer20GBRG = 64 + cudaEglColorFormatYVU444Planar = 65 + cudaEglColorFormatYVU422Planar = 66 + cudaEglColorFormatYVU420Planar = 67 + cudaEglColorFormatBayerIspRGGB = 68 + cudaEglColorFormatBayerIspBGGR = 69 + cudaEglColorFormatBayerIspGRBG = 70 + cudaEglColorFormatBayerIspGBRG = 71 + cudaEglColorFormatBayerBCCR = 72 + cudaEglColorFormatBayerRCCB = 73 + cudaEglColorFormatBayerCRBC = 74 + cudaEglColorFormatBayerCBRC = 75 + cudaEglColorFormatBayer10CCCC = 76 + cudaEglColorFormatBayer12BCCR = 77 + cudaEglColorFormatBayer12RCCB = 78 + cudaEglColorFormatBayer12CRBC = 79 + cudaEglColorFormatBayer12CBRC = 80 + cudaEglColorFormatBayer12CCCC = 81 + cudaEglColorFormatY = 82 + cudaEglColorFormatYUV420SemiPlanar_2020 = 83 + cudaEglColorFormatYVU420SemiPlanar_2020 = 84 + cudaEglColorFormatYUV420Planar_2020 = 85 + cudaEglColorFormatYVU420Planar_2020 = 86 + cudaEglColorFormatYUV420SemiPlanar_709 = 87 + cudaEglColorFormatYVU420SemiPlanar_709 = 88 + cudaEglColorFormatYUV420Planar_709 = 89 + cudaEglColorFormatYVU420Planar_709 = 90 + cudaEglColorFormatY10V10U10_420SemiPlanar_709 = 91 + cudaEglColorFormatY10V10U10_420SemiPlanar_2020 = 92 + cudaEglColorFormatY10V10U10_422SemiPlanar_2020 = 93 + cudaEglColorFormatY10V10U10_422SemiPlanar = 94 + cudaEglColorFormatY10V10U10_422SemiPlanar_709 = 95 + cudaEglColorFormatY_ER = 96 + cudaEglColorFormatY_709_ER = 97 + cudaEglColorFormatY10_ER = 98 + cudaEglColorFormatY10_709_ER = 99 + cudaEglColorFormatY12_ER = 100 + cudaEglColorFormatY12_709_ER = 101 + cudaEglColorFormatYUVA = 102 + cudaEglColorFormatYVYU = 104 + cudaEglColorFormatVYUY = 105 + cudaEglColorFormatY10V10U10_420SemiPlanar_ER = 106 + cudaEglColorFormatY10V10U10_420SemiPlanar_709_ER = 107 + cudaEglColorFormatY10V10U10_444SemiPlanar_ER = 108 + cudaEglColorFormatY10V10U10_444SemiPlanar_709_ER = 109 + cudaEglColorFormatY12V12U12_420SemiPlanar_ER = 110 + cudaEglColorFormatY12V12U12_420SemiPlanar_709_ER = 111 + cudaEglColorFormatY12V12U12_444SemiPlanar_ER = 112 + cudaEglColorFormatY12V12U12_444SemiPlanar_709_ER = 113 + cudaEglColorFormatUYVY709 = 114 + cudaEglColorFormatUYVY709_ER = 115 + cudaEglColorFormatUYVY2020 = 116 +ctypedef cudaEglColorFormat_enum cudaEglColorFormat + +cdef enum cudaGLDeviceList: + cudaGLDeviceListAll = 1 + cudaGLDeviceListCurrentFrame = 2 + cudaGLDeviceListNextFrame = 3 + +cdef enum cudaGLMapFlags: + cudaGLMapFlagsNone = 0 + cudaGLMapFlagsReadOnly = 1 + cudaGLMapFlagsWriteDiscard = 2 + +cdef extern from 'driver_types.h': + cdef enum cudaAtomicOperation: + cudaAtomicOperationIntegerAdd + cudaAtomicOperationIntegerMin + cudaAtomicOperationIntegerMax + cudaAtomicOperationIntegerIncrement + cudaAtomicOperationIntegerDecrement + cudaAtomicOperationAnd + cudaAtomicOperationOr + cudaAtomicOperationXOR + cudaAtomicOperationExchange + cudaAtomicOperationCAS + cudaAtomicOperationFloatAdd + cudaAtomicOperationFloatMin + cudaAtomicOperationFloatMax + +cdef extern from 'driver_types.h': + cdef enum cudaAtomicOperationCapability: + cudaAtomicCapabilitySigned + cudaAtomicCapabilityUnsigned + cudaAtomicCapabilityReduction + cudaAtomicCapabilityScalar32 + cudaAtomicCapabilityScalar64 + cudaAtomicCapabilityScalar128 + cudaAtomicCapabilityVector32x4 + +cdef extern from 'driver_types.h': + cdef enum CUDAlogLevel_enum: + cudaLogLevelError + cudaLogLevelWarning + ctypedef CUDAlogLevel_enum cudaLogLevel + +cdef extern from 'library_types.h': + cdef enum cudaEmulationStrategy_t: + CUDA_EMULATION_STRATEGY_DEFAULT + CUDA_EMULATION_STRATEGY_PERFORMANT + CUDA_EMULATION_STRATEGY_EAGER + ctypedef cudaEmulationStrategy_t cudaEmulationStrategy + +cdef extern from 'driver_types.h': + cdef enum cudaDevSmResourceGroup_flags: + cudaDevSmResourceGroupDefault + cudaDevSmResourceGroupBackfill + +cdef extern from 'driver_types.h': + cdef enum cudaDevSmResourceSplitByCount_flags: + cudaDevSmResourceSplitIgnoreSmCoscheduling + cudaDevSmResourceSplitMaxPotentialClusterSize + +cdef extern from 'driver_types.h': + cdef enum cudaDevResourceType: + cudaDevResourceTypeInvalid + cudaDevResourceTypeSm + cudaDevResourceTypeWorkqueueConfig + cudaDevResourceTypeWorkqueue + +cdef extern from 'driver_types.h': + cdef enum cudaDevWorkqueueConfigScope: + cudaDevWorkqueueConfigScopeDeviceCtx + cudaDevWorkqueueConfigScopeGreenCtxBalanced + +cdef extern from 'library_types.h': + cdef enum cudaEmulationMantissaControl_t: + CUDA_EMULATION_MANTISSA_CONTROL_DYNAMIC + CUDA_EMULATION_MANTISSA_CONTROL_FIXED + ctypedef cudaEmulationMantissaControl_t cudaEmulationMantissaControl + +cdef extern from 'library_types.h': + cdef enum cudaEmulationSpecialValuesSupport_t: + CUDA_EMULATION_SPECIAL_VALUES_SUPPORT_DEFAULT + CUDA_EMULATION_SPECIAL_VALUES_SUPPORT_NONE + CUDA_EMULATION_SPECIAL_VALUES_SUPPORT_INFINITY + CUDA_EMULATION_SPECIAL_VALUES_SUPPORT_NAN + ctypedef cudaEmulationSpecialValuesSupport_t cudaEmulationSpecialValuesSupport + +cdef extern from 'driver_types.h': + cdef enum cudaHostTaskSyncMode: + cudaHostTaskBlocking + cudaHostTaskSpinWait + +cdef extern from 'driver_types.h': + cdef enum cudaKernelFunctionType: + cudaKernelFunctionTypeUnspecified + cudaKernelFunctionTypeDeviceEntry + cudaKernelFunctionTypeKernel + cudaKernelFunctionTypeFunction + +cdef extern from 'driver_types.h': + cdef enum cudaLaunchAttributePortableClusterMode: + cudaLaunchPortableClusterModeDefault + cudaLaunchPortableClusterModeRequirePortable + cudaLaunchPortableClusterModeAllowNonPortable + +cdef extern from 'driver_types.h': + cdef enum cudaSharedMemoryMode: + cudaSharedMemoryModeDefault + cudaSharedMemoryModeRequirePortable + cudaSharedMemoryModeAllowNonPortable + +cdef extern from 'driver_types.h': + cdef enum cudaGraphRecaptureStatus: + cudaGraphRecaptureEligibleForUpdate + cudaGraphRecaptureIneligibleForUpdate + cudaGraphRecaptureError + +cdef extern from 'driver_types.h': + cdef enum cudaFabricOpStatusSource: + cudaFabricOpStatusSourceMbarrierV1 + cudaFabricOpStatusSourceMax + +cdef extern from 'driver_types.h': + cdef enum cudaFabricOpStatusInfo: + cudaFabricOpStatusInfoSuccess + cudaFabricOpStatusInfoLast + cudaFabricOpStatusInfoMax +cdef enum: _CUDAERROR_T_INTERNAL_LOADING_ERROR = cudaError_t.cudaErrorCallRequiresNewerDriver + + +# TYPES +cdef extern from 'driver_types.h': + ctypedef unsigned long long cudaGraphConditionalHandle 'cudaGraphConditionalHandle' + + +cdef extern from 'surface_types.h': + ctypedef unsigned long long cudaSurfaceObject_t 'cudaSurfaceObject_t' + + +cdef extern from 'texture_types.h': + ctypedef unsigned long long cudaTextureObject_t 'cudaTextureObject_t' + + +cdef extern from 'driver_types.h': + ctypedef unsigned int cudaLogIterator 'cudaLogIterator' + + +cdef extern from 'driver_types.h': + ctypedef struct cudaArray: + pass + ctypedef cudaArray* cudaArray_t 'cudaArray_t' + + +cdef extern from 'driver_types.h': + ctypedef struct cudaArray: + pass + ctypedef cudaArray* cudaArray_const_t 'cudaArray_const_t' + + +cdef extern from 'driver_types.h': + ctypedef struct cudaMipmappedArray: + pass + ctypedef cudaMipmappedArray* cudaMipmappedArray_t 'cudaMipmappedArray_t' + + +cdef extern from 'driver_types.h': + ctypedef struct cudaMipmappedArray: + pass + ctypedef cudaMipmappedArray* cudaMipmappedArray_const_t 'cudaMipmappedArray_const_t' + + +cdef extern from 'driver_types.h': + ctypedef struct cudaAsyncCallbackEntry: + pass + ctypedef cudaAsyncCallbackEntry* cudaAsyncCallbackHandle_t 'cudaAsyncCallbackHandle_t' + + +cdef extern from 'driver_types.h': + cdef struct cudaChannelFormatDesc: + int x + int y + int z + int w + cudaChannelFormatKind f + +cdef struct cuda_bindings_runtime__anon_pod0: + unsigned int width + unsigned int height + unsigned int depth + +cdef extern from 'driver_types.h': + cdef struct cudaArrayMemoryRequirements: + size_t size + size_t alignment + unsigned int reserved[4] + +cdef extern from 'driver_types.h': + cdef struct cudaPitchedPtr: + void* ptr + size_t pitch + size_t xsize + size_t ysize + +cdef extern from 'driver_types.h': + cdef struct cudaExtent: + size_t width + size_t height + size_t depth + +cdef extern from 'driver_types.h': + cdef struct cudaPos: + size_t x + size_t y + size_t z + +cdef extern from 'driver_types.h': + cdef struct cudaMemsetParams: + void* dst + size_t pitch + unsigned int value + unsigned int elementSize + size_t width + size_t height + +cdef extern from 'driver_types.h': + cdef struct cudaAccessPolicyWindow: + void* base_ptr + size_t num_bytes + float hitRatio + cudaAccessProperty hitProp + cudaAccessProperty missProp + +cdef extern from 'driver_types.h': + ctypedef void (*cudaHostFn_t 'cudaHostFn_t')( + void* userData + ) + + +cdef struct cuda_bindings_runtime__anon_pod6: + int reserved[32] + +cdef extern from 'driver_types.h': + cdef struct cudaResourceViewDesc: + cudaResourceViewFormat format + size_t width + size_t height + size_t depth + unsigned int firstMipmapLevel + unsigned int lastMipmapLevel + unsigned int firstLayer + unsigned int lastLayer + unsigned int reserved[16] + +cdef extern from 'driver_types.h': + cdef struct cudaPointerAttributes: + cudaMemoryType type + int device + void* devicePointer + void* hostPointer + long reserved[8] + +cdef extern from 'driver_types.h': + cdef struct cudaFuncAttributes: + size_t sharedSizeBytes + size_t constSizeBytes + size_t localSizeBytes + int maxThreadsPerBlock + int numRegs + int ptxVersion + int binaryVersion + int cacheModeCA + int maxDynamicSharedSizeBytes + int preferredShmemCarveout + int clusterDimMustBeSet + int requiredClusterWidth + int requiredClusterHeight + int requiredClusterDepth + int clusterSchedulingPolicyPreference + int nonPortableClusterSizeAllowed + int deviceNodeUpdateStatus + int reserved1 + int reserved[14] + +cdef extern from 'driver_types.h': + cdef struct cudaMemPoolPtrExportData: + unsigned char reserved[64] + +cdef extern from 'driver_types.h': + cdef struct cudaMemFreeNodeParams: + void* dptr + +cdef extern from 'driver_types.h': + cdef struct cudaOffset3D: + size_t x + size_t y + size_t z + +cdef extern from 'driver_types.h': + cdef struct cudaDeviceProp: + char name[256] + cudaUUID_t uuid + char luid[8] + unsigned int luidDeviceNodeMask + size_t totalGlobalMem + size_t sharedMemPerBlock + int regsPerBlock + int warpSize + size_t memPitch + int maxThreadsPerBlock + int maxThreadsDim[3] + int maxGridSize[3] + size_t totalConstMem + int major + int minor + size_t textureAlignment + size_t texturePitchAlignment + int multiProcessorCount + int integrated + int canMapHostMemory + int maxTexture1D + int maxTexture1DMipmap + int maxTexture2D[2] + int maxTexture2DMipmap[2] + int maxTexture2DLinear[3] + int maxTexture2DGather[2] + int maxTexture3D[3] + int maxTexture3DAlt[3] + int maxTextureCubemap + int maxTexture1DLayered[2] + int maxTexture2DLayered[3] + int maxTextureCubemapLayered[2] + int maxSurface1D + int maxSurface2D[2] + int maxSurface3D[3] + int maxSurface1DLayered[2] + int maxSurface2DLayered[3] + int maxSurfaceCubemap + int maxSurfaceCubemapLayered[2] + size_t surfaceAlignment + int concurrentKernels + int ECCEnabled + int pciBusID + int pciDeviceID + int pciDomainID + int tccDriver + int asyncEngineCount + int unifiedAddressing + int memoryBusWidth + int l2CacheSize + int persistingL2CacheMaxSize + int maxThreadsPerMultiProcessor + int streamPrioritiesSupported + int globalL1CacheSupported + int localL1CacheSupported + size_t sharedMemPerMultiprocessor + int regsPerMultiprocessor + int managedMemory + int isMultiGpuBoard + int multiGpuBoardGroupID + int hostNativeAtomicSupported + int pageableMemoryAccess + int concurrentManagedAccess + int computePreemptionSupported + int canUseHostPointerForRegisteredMem + int cooperativeLaunch + size_t sharedMemPerBlockOptin + int pageableMemoryAccessUsesHostPageTables + int directManagedMemAccessFromHost + int maxBlocksPerMultiProcessor + int accessPolicyMaxWindowSize + size_t reservedSharedMemPerBlock + int hostRegisterSupported + int sparseCudaArraySupported + int hostRegisterReadOnlySupported + int timelineSemaphoreInteropSupported + int memoryPoolsSupported + int gpuDirectRDMASupported + unsigned int gpuDirectRDMAFlushWritesOptions + int gpuDirectRDMAWritesOrdering + unsigned int memoryPoolSupportedHandleTypes + int deferredMappingCudaArraySupported + int ipcEventSupported + int clusterLaunch + int unifiedFunctionPointers + int deviceNumaConfig + int deviceNumaId + int mpsEnabled + int hostNumaId + unsigned int gpuPciDeviceID + unsigned int gpuPciSubsystemID + int hostNumaMultinodeIpcSupported + int reserved[56] + +cdef extern from 'driver_types.h': + cdef struct cudaIpcEventHandle_st: + char reserved[64] + ctypedef cudaIpcEventHandle_st cudaIpcEventHandle_t + +cdef extern from 'driver_types.h': + cdef struct cudaIpcMemHandle_st: + char reserved[64] + ctypedef cudaIpcMemHandle_st cudaIpcMemHandle_t + +cdef extern from 'driver_types.h': + cdef struct cudaMemFabricHandle_st: + char reserved[64] + ctypedef cudaMemFabricHandle_st cudaMemFabricHandle_t + +cdef struct cuda_bindings_runtime__anon_pod12: + void* handle + void* name + +cdef extern from 'driver_types.h': + cdef struct cudaExternalMemoryBufferDesc: + unsigned long long offset + unsigned long long size + unsigned int flags + unsigned int reserved[16] + +cdef struct cuda_bindings_runtime__anon_pod14: + void* handle + void* name + +cdef struct cuda_bindings_runtime__anon_pod16: + unsigned long long value + +cdef union cuda_bindings_runtime__anon_pod17: + void* fence + unsigned long long reserved + +cdef struct cuda_bindings_runtime__anon_pod18: + unsigned long long key + +cdef struct cuda_bindings_runtime__anon_pod20: + unsigned long long value + +cdef union cuda_bindings_runtime__anon_pod21: + void* fence + unsigned long long reserved + +cdef struct cuda_bindings_runtime__anon_pod22: + unsigned long long key + unsigned int timeoutMs + +cdef extern from 'driver_types.h': + cdef struct cudaKernelNodeParams: + void* func + dim3 gridDim + dim3 blockDim + unsigned int sharedMemBytes + void** kernelParams + void** extra + +cdef extern from 'driver_types.h': + cdef struct cudaGraphEdgeData_st: + unsigned char from_port + unsigned char to_port + unsigned char type + unsigned char reserved[5] + ctypedef cudaGraphEdgeData_st cudaGraphEdgeData + +cdef struct cuda_bindings_runtime__anon_pod26: + void* pValue + size_t offset + size_t size + +cdef extern from 'driver_types.h': + cdef struct cudaLaunchMemSyncDomainMap_st: + unsigned char default_ + unsigned char remote + ctypedef cudaLaunchMemSyncDomainMap_st cudaLaunchMemSyncDomainMap + +cdef struct cuda_bindings_runtime__anon_pod27: + unsigned int x + unsigned int y + unsigned int z + +cdef struct cuda_bindings_runtime__anon_pod29: + unsigned int x + unsigned int y + unsigned int z + +cdef struct cuda_bindings_runtime__anon_pod33: + unsigned long long bytesOverBudget + +cdef extern from '': + cdef struct cudaTextureDesc: + cudaTextureAddressMode addressMode[3] + cudaTextureFilterMode filterMode + cudaTextureReadMode readMode + int sRGB + float borderColor[4] + int normalizedCoords + unsigned int maxAnisotropy + cudaTextureFilterMode mipmapFilterMode + float mipmapLevelBias + float minMipmapLevelClamp + float maxMipmapLevelClamp + int disableTrilinearOptimization + int seamlessCubemap + +cdef extern from 'driver_types.h': + cdef struct cudaDevSmResource: + unsigned int smCount + unsigned int minSmPartitionSize + unsigned int smCoscheduledAlignment + unsigned int flags + +cdef extern from 'driver_types.h': + cdef struct cudaDevWorkqueueConfigResource: + int device + unsigned int wqConcurrencyLimit + cudaDevWorkqueueConfigScope sharingScope + +cdef extern from 'driver_types.h': + cdef struct cudaDevWorkqueueResource: + unsigned char reserved[40] + +cdef extern from 'driver_types.h': + cdef struct cudaDevSmResourceGroupParams_st: + unsigned int smCount + unsigned int coscheduledSmCount + unsigned int preferredCoscheduledSmCount + unsigned int flags + unsigned int reserved[12] + ctypedef cudaDevSmResourceGroupParams_st cudaDevSmResourceGroupParams + +cdef extern from 'cuda_runtime_api.h': + ctypedef void (*cudaLogsCallback_t 'cudaLogsCallback_t')( + void* data, + cudaLogLevel logLevel, + char* message, + size_t length + ) + + +cdef struct cuda_bindings_runtime__anon_pod2: + cudaArray_t array + +cdef struct cuda_bindings_runtime__anon_pod3: + cudaMipmappedArray_t mipmap + +cdef extern from 'cuda_runtime_api.h': + ctypedef void (*cudaStreamCallback_t 'cudaStreamCallback_t')( + cudaStream_t stream, + cudaError_t status, + void* userData + ) + + +cdef extern from 'driver_types.h': + cdef struct cudaEventRecordNodeParams: + cudaEvent_t event + +cdef extern from 'driver_types.h': + cdef struct cudaEventWaitNodeParams: + cudaEvent_t event + +cdef struct cuda_bindings_runtime__anon_pod28: + cudaEvent_t event + int flags + int triggerAtBlockStart + +cdef struct cuda_bindings_runtime__anon_pod30: + cudaEvent_t event + int flags + +cdef extern from 'driver_types.h': + cdef struct cudaChildGraphNodeParams: + cudaGraph_t graph + cudaGraphChildGraphNodeOwnership ownership + +cdef extern from 'driver_types.h': + cdef struct cudaGraphInstantiateParams_st: + unsigned long long flags + cudaStream_t uploadStream + cudaGraphNode_t errNode_out + cudaGraphInstantiateResult result_out + ctypedef cudaGraphInstantiateParams_st cudaGraphInstantiateParams + +cdef extern from 'driver_types.h': + cdef struct cudaGraphExecUpdateResultInfo_st: + cudaGraphExecUpdateResult result + cudaGraphNode_t errorNode + cudaGraphNode_t errorFromNode + ctypedef cudaGraphExecUpdateResultInfo_st cudaGraphExecUpdateResultInfo + +cdef struct cuda_bindings_runtime__anon_pod31: + int deviceUpdatable + cudaGraphDeviceNode_t devNode + +cdef extern from 'driver_types.h': + cdef struct cudaMemsetParamsV2: + void* dst + size_t pitch + unsigned int value + unsigned int elementSize + size_t width + size_t height + cudaExecutionContext_t ctx + +cdef extern from 'driver_types.h': + cdef struct cudaConditionalNodeParams: + cudaGraphConditionalHandle handle + cudaGraphConditionalNodeType type + unsigned int size + cudaGraph_t* phGraph_out + cudaExecutionContext_t ctx + +cdef struct cuda_bindings_runtime__anon_pod4: + void* devPtr + cudaChannelFormatDesc desc + size_t sizeInBytes + +cdef struct cuda_bindings_runtime__anon_pod5: + void* devPtr + cudaChannelFormatDesc desc + size_t width + size_t height + size_t pitchInBytes + +cdef struct cudaEglPlaneDesc_st: + unsigned int width + unsigned int height + unsigned int depth + unsigned int pitch + unsigned int numChannels + cudaChannelFormatDesc channelDesc + unsigned int reserved[4] +ctypedef cudaEglPlaneDesc_st cudaEglPlaneDesc + +cdef extern from 'driver_types.h': + cdef struct cudaArraySparseProperties: + cuda_bindings_runtime__anon_pod0 tileExtent + unsigned int miptailFirstLevel + unsigned long long miptailSize + unsigned int flags + unsigned int reserved[4] + +cdef union cuda_bindings_runtime__anon_pod34: + cudaArray_t pArray[3] + cudaPitchedPtr pPitch[3] + +cdef extern from 'driver_types.h': + cdef struct cudaExternalMemoryMipmappedArrayDesc: + unsigned long long offset + cudaChannelFormatDesc formatDesc + cudaExtent extent + unsigned int flags + unsigned int numLevels + unsigned int reserved[16] + +cdef extern from 'driver_types.h': + cdef struct cudaMemcpy3DParms: + cudaArray_t srcArray + cudaPos srcPos + cudaPitchedPtr srcPtr + cudaArray_t dstArray + cudaPos dstPos + cudaPitchedPtr dstPtr + cudaExtent extent + cudaMemcpyKind kind + +cdef extern from 'driver_types.h': + cdef struct cudaMemcpy3DPeerParms: + cudaArray_t srcArray + cudaPos srcPos + cudaPitchedPtr srcPtr + int srcDevice + cudaArray_t dstArray + cudaPos dstPos + cudaPitchedPtr dstPtr + int dstDevice + cudaExtent extent + +cdef extern from 'driver_types.h': + cdef struct cudaHostNodeParams: + cudaHostFn_t fn + void* userData + +cdef extern from 'driver_types.h': + cdef struct cudaHostNodeParamsV2: + cudaHostFn_t fn + void* userData + unsigned int syncMode + +cdef extern from 'driver_types.h': + cdef struct cudaMemLocation: + cudaMemLocationType type + int id + +cdef struct cuda_bindings_runtime__anon_pod10: + cudaArray_t array + cudaOffset3D offset + +cdef union cuda_bindings_runtime__anon_pod11: + int fd + cuda_bindings_runtime__anon_pod12 win32 + void* nvSciBufObject + +cdef union cuda_bindings_runtime__anon_pod13: + int fd + cuda_bindings_runtime__anon_pod14 win32 + void* nvSciSyncObj + +cdef struct cuda_bindings_runtime__anon_pod15: + cuda_bindings_runtime__anon_pod16 fence + cuda_bindings_runtime__anon_pod17 nvSciSync + cuda_bindings_runtime__anon_pod18 keyedMutex + unsigned int reserved[12] + +cdef struct cuda_bindings_runtime__anon_pod19: + cuda_bindings_runtime__anon_pod20 fence + cuda_bindings_runtime__anon_pod21 nvSciSync + cuda_bindings_runtime__anon_pod22 keyedMutex + unsigned int reserved[10] + +cdef union cuda_bindings_runtime__anon_pod25: + dim3 gridDim + cuda_bindings_runtime__anon_pod26 param + unsigned int isEnabled + +cdef union cuda_bindings_runtime__anon_pod32: + cuda_bindings_runtime__anon_pod33 overBudget + +cdef extern from 'driver_types.h': + cdef struct cudaKernelNodeParamsV2: + void* func + cudaKernel_t kern + cudaFunction_t cuFunc + dim3 gridDim + dim3 blockDim + unsigned int sharedMemBytes + void** kernelParams + void** extra + cudaExecutionContext_t ctx + cudaKernelFunctionType functionType + +cdef extern from 'driver_types.h': + cdef union cudaLaunchAttributeValue: + char pad[64] + cudaAccessPolicyWindow accessPolicyWindow + int cooperative + cudaSynchronizationPolicy syncPolicy + cuda_bindings_runtime__anon_pod27 clusterDim + cudaClusterSchedulingPolicy clusterSchedulingPolicyPreference + int programmaticStreamSerializationAllowed + cuda_bindings_runtime__anon_pod28 programmaticEvent + int priority + cudaLaunchMemSyncDomainMap memSyncDomainMap + cudaLaunchMemSyncDomain memSyncDomain + cuda_bindings_runtime__anon_pod29 preferredClusterDim + cuda_bindings_runtime__anon_pod30 launchCompletionEvent + cuda_bindings_runtime__anon_pod31 deviceUpdatableKernelNode + unsigned int sharedMemCarveout + unsigned int nvlinkUtilCentricScheduling + cudaLaunchAttributePortableClusterMode portableClusterSizeMode + cudaSharedMemoryMode sharedMemoryMode + +cdef union cuda_bindings_runtime__anon_pod1: + cuda_bindings_runtime__anon_pod2 array + cuda_bindings_runtime__anon_pod3 mipmap + cuda_bindings_runtime__anon_pod4 linear + cuda_bindings_runtime__anon_pod5 pitch2D + cuda_bindings_runtime__anon_pod6 reserved + +cdef struct cudaEglFrame_st: + cuda_bindings_runtime__anon_pod34 frame + cudaEglPlaneDesc planeDesc[3] + unsigned int planeCount + cudaEglFrameType frameType + cudaEglColorFormat eglColorFormat +ctypedef cudaEglFrame_st cudaEglFrame + +cdef extern from 'driver_types.h': + cdef struct cudaMemcpyNodeParams: + int flags + int reserved + cudaExecutionContext_t ctx + cudaMemcpy3DParms copyParams + +cdef extern from 'driver_types.h': + cdef struct cudaMemAccessDesc: + cudaMemLocation location + cudaMemAccessFlags flags + +cdef extern from 'driver_types.h': + cdef struct cudaMemPoolProps: + cudaMemAllocationType allocType + cudaMemAllocationHandleType handleTypes + cudaMemLocation location + void* win32SecurityAttributes + size_t maxSize + unsigned short usage + unsigned char reserved[54] + +cdef extern from 'driver_types.h': + cdef struct cudaMemcpyAttributes: + cudaMemcpySrcAccessOrder srcAccessOrder + cudaMemLocation srcLocHint + cudaMemLocation dstLocHint + unsigned int flags + +cdef struct cuda_bindings_runtime__anon_pod9: + void* ptr + size_t rowLength + size_t layerHeight + cudaMemLocation locHint + +cdef extern from 'driver_types.h': + cdef struct cudaExternalMemoryHandleDesc: + cudaExternalMemoryHandleType type + cuda_bindings_runtime__anon_pod11 handle + unsigned long long size + unsigned int flags + unsigned int reserved[16] + +cdef extern from 'driver_types.h': + cdef struct cudaExternalSemaphoreHandleDesc: + cudaExternalSemaphoreHandleType type + cuda_bindings_runtime__anon_pod13 handle + unsigned int flags + unsigned int reserved[16] + +cdef extern from 'driver_types.h': + cdef struct cudaExternalSemaphoreSignalParams: + cuda_bindings_runtime__anon_pod15 params + unsigned int flags + unsigned int reserved[16] + +cdef extern from 'driver_types.h': + cdef struct cudaExternalSemaphoreWaitParams: + cuda_bindings_runtime__anon_pod19 params + unsigned int flags + unsigned int reserved[16] + +cdef extern from 'driver_types.h': + cdef struct cudaGraphKernelNodeUpdate: + cudaGraphDeviceNode_t node + cudaGraphKernelNodeField field + cuda_bindings_runtime__anon_pod25 updateData + +cdef extern from 'driver_types.h': + cdef struct cudaAsyncNotificationInfo: + cudaAsyncNotificationType type + cuda_bindings_runtime__anon_pod32 info + ctypedef cudaAsyncNotificationInfo cudaAsyncNotificationInfo_t + +cdef extern from 'driver_types.h': + cdef struct cudaDevResource_st: + cudaDevResourceType type + unsigned char _internal_padding[92] + cudaDevSmResource sm + cudaDevWorkqueueConfigResource wqConfig + cudaDevWorkqueueResource wq + unsigned char _oversize[40] + cudaDevResource_st* nextResource + ctypedef cudaDevResource_st cudaDevResource + +cdef extern from 'driver_types.h': + cdef struct cudaResourceDesc: + cudaResourceType resType + cuda_bindings_runtime__anon_pod1 res + unsigned int flags + +cdef extern from 'driver_types.h': + cdef struct cudaMemAllocNodeParams: + cudaMemPoolProps poolProps + cudaMemAccessDesc* accessDescs + size_t accessDescCount + size_t bytesize + void* dptr + +cdef extern from 'driver_types.h': + cdef struct cudaMemAllocNodeParamsV2: + cudaMemPoolProps poolProps + cudaMemAccessDesc* accessDescs + size_t accessDescCount + size_t bytesize + void* dptr + +cdef union cuda_bindings_runtime__anon_pod8: + cuda_bindings_runtime__anon_pod9 ptr + cuda_bindings_runtime__anon_pod10 array + +cdef extern from 'driver_types.h': + cdef struct cudaExternalSemaphoreSignalNodeParams: + cudaExternalSemaphore_t* extSemArray + cudaExternalSemaphoreSignalParams* paramsArray + unsigned int numExtSems + +cdef extern from 'driver_types.h': + cdef struct cudaExternalSemaphoreSignalNodeParamsV2: + cudaExternalSemaphore_t* extSemArray + cudaExternalSemaphoreSignalParams* paramsArray + unsigned int numExtSems + +cdef extern from 'driver_types.h': + cdef struct cudaExternalSemaphoreWaitNodeParams: + cudaExternalSemaphore_t* extSemArray + cudaExternalSemaphoreWaitParams* paramsArray + unsigned int numExtSems + +cdef extern from 'driver_types.h': + cdef struct cudaExternalSemaphoreWaitNodeParamsV2: + cudaExternalSemaphore_t* extSemArray + cudaExternalSemaphoreWaitParams* paramsArray + unsigned int numExtSems + +cdef extern from 'driver_types.h': + cdef struct cudaMemcpy3DOperand: + cudaMemcpy3DOperandType type + cuda_bindings_runtime__anon_pod8 op + +cdef extern from 'driver_types.h': + cdef struct cudaMemcpy3DBatchOp: + cudaMemcpy3DOperand src + cudaMemcpy3DOperand dst + cudaExtent extent + cudaMemcpySrcAccessOrder srcAccessOrder + unsigned int flags + +cdef extern from 'driver_types.h': + cdef struct cudaGraphNodeParams: + cudaGraphNodeType type + int reserved0[3] + long long reserved1[29] + cudaKernelNodeParamsV2 kernel + cudaMemcpyNodeParams memcpy + cudaMemsetParamsV2 memset + cudaHostNodeParamsV2 host + cudaChildGraphNodeParams graph + cudaEventWaitNodeParams eventWait + cudaEventRecordNodeParams eventRecord + cudaExternalSemaphoreSignalNodeParamsV2 extSemSignal + cudaExternalSemaphoreWaitNodeParamsV2 extSemWait + cudaMemAllocNodeParamsV2 alloc + cudaMemFreeNodeParams free + cudaConditionalNodeParams conditional + long long reserved2 + +cdef extern from 'cuda_runtime_api.h': + ctypedef cudaError_t (*cudaGraphRecaptureCallback_t 'cudaGraphRecaptureCallback_t')( + void* data, + cudaGraphNode_t node, + const cudaGraphNodeParams* originalParams, + const cudaGraphNodeParams* recaptureParams, + cudaGraphRecaptureStatus status + ) + + +cdef extern from '': + cdef struct cudaGraphRecaptureCallbackData: + cudaGraphRecaptureCallback_t callbackFunc + void* userData + +cdef extern from 'driver_types.h': + # cudaLaunchAttribute_st is SKIPped (sizeof-based array dimension in pad field). + # Declared here (after the enum and type sections) so that cudaLaunchAttributeID and + # cudaLaunchAttributeValue are already in scope — Cython requires forward types to + # be visible at the point of use even inside cdef extern from blocks. + # Field types must match the legacy_cython_gen ABI baseline for __pyx_capi__ compat. + ctypedef struct cudaLaunchAttribute_st 'cudaLaunchAttribute_st': + cudaLaunchAttributeID id + cudaLaunchAttributeValue val + +cdef extern from 'driver_types.h': + ctypedef cudaLaunchAttribute_st cudaLaunchAttribute 'cudaLaunchAttribute' + +# cudaLaunchConfig_st references cudaLaunchAttribute* so it must follow the above. +# Declared here rather than auto-generated (which would land in type_decls, before +# cudaLaunchAttribute) to satisfy Cython's forward-declaration requirement. +cdef extern from '': + cdef struct cudaLaunchConfig_st: + dim3 gridDim + dim3 blockDim + size_t dynamicSmemBytes + cudaStream_t stream + cudaLaunchAttribute* attrs + unsigned int numAttrs + ctypedef cudaLaunchConfig_st cudaLaunchConfig_t + +cdef extern from 'cuda_runtime_api.h': + ctypedef void (*cudaAsyncCallback)(cudaAsyncNotificationInfo_t* info, void* userData, cudaAsyncCallbackHandle_t handle) nogil + + +# FUNCTIONS +cdef cudaError_t cudaDeviceReset() except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaDeviceSynchronize() except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaDeviceSetLimit(cudaLimit limit, size_t value) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaDeviceGetLimit(size_t* pValue, cudaLimit limit) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaDeviceGetTexture1DLinearMaxWidth(size_t* maxWidthInElements, const cudaChannelFormatDesc* fmtDesc, int device) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaDeviceGetCacheConfig(cudaFuncCache* pCacheConfig) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaDeviceGetStreamPriorityRange(int* leastPriority, int* greatestPriority) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaDeviceSetCacheConfig(cudaFuncCache cacheConfig) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaDeviceGetByPCIBusId(int* device, const char* pciBusId) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaDeviceGetPCIBusId(char* pciBusId, int len, int device) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaIpcGetEventHandle(cudaIpcEventHandle_t* handle, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaIpcOpenEventHandle(cudaEvent_t* event, cudaIpcEventHandle_t handle) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaIpcGetMemHandle(cudaIpcMemHandle_t* handle, void* devPtr) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaIpcOpenMemHandle(void** devPtr, cudaIpcMemHandle_t handle, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaIpcCloseMemHandle(void* devPtr) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaDeviceFlushGPUDirectRDMAWrites(cudaFlushGPUDirectRDMAWritesTarget target, cudaFlushGPUDirectRDMAWritesScope scope) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaDeviceRegisterAsyncNotification(int device, cudaAsyncCallback callbackFunc, void* userData, cudaAsyncCallbackHandle_t* callback) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaDeviceUnregisterAsyncNotification(int device, cudaAsyncCallbackHandle_t callback) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaDeviceGetSharedMemConfig(cudaSharedMemConfig* pConfig) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaDeviceSetSharedMemConfig(cudaSharedMemConfig config) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGetLastError() except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaPeekAtLastError() except ?cudaErrorCallRequiresNewerDriver nogil +cdef const char* cudaGetErrorName(cudaError_t error) except?NULL nogil +cdef const char* cudaGetErrorString(cudaError_t error) except?NULL nogil +cdef cudaError_t cudaGetDeviceCount(int* count) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaDeviceGetAttribute(int* value, cudaDeviceAttr attr, int device) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaDeviceGetDefaultMemPool(cudaMemPool_t* memPool, int device) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaDeviceSetMemPool(int device, cudaMemPool_t memPool) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaDeviceGetMemPool(cudaMemPool_t* memPool, int device) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaDeviceGetNvSciSyncAttributes(void* nvSciSyncAttrList, int device, int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaDeviceGetP2PAttribute(int* value, cudaDeviceP2PAttr attr, int srcDevice, int dstDevice) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaChooseDevice(int* device, const cudaDeviceProp* prop) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaInitDevice(int device, unsigned int deviceFlags, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaSetDevice(int device) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGetDevice(int* device) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaSetDeviceFlags(unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGetDeviceFlags(unsigned int* flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaStreamCreate(cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaStreamCreateWithFlags(cudaStream_t* pStream, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaStreamCreateWithPriority(cudaStream_t* pStream, unsigned int flags, int priority) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaStreamGetPriority(cudaStream_t hStream, int* priority) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaStreamGetFlags(cudaStream_t hStream, unsigned int* flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaStreamGetId(cudaStream_t hStream, unsigned long long* streamId) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaStreamGetDevice(cudaStream_t hStream, int* device) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaCtxResetPersistingL2Cache() except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaStreamCopyAttributes(cudaStream_t dst, cudaStream_t src) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaStreamGetAttribute(cudaStream_t hStream, cudaStreamAttrID attr, cudaStreamAttrValue* value_out) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaStreamSetAttribute(cudaStream_t hStream, cudaStreamAttrID attr, const cudaStreamAttrValue* value) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaStreamDestroy(cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaStreamWaitEvent(cudaStream_t stream, cudaEvent_t event, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaStreamAddCallback(cudaStream_t stream, cudaStreamCallback_t callback, void* userData, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaStreamSynchronize(cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaStreamQuery(cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaStreamAttachMemAsync(cudaStream_t stream, void* devPtr, size_t length, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaStreamBeginCapture(cudaStream_t stream, cudaStreamCaptureMode mode) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaStreamBeginCaptureToGraph(cudaStream_t stream, cudaGraph_t graph, const cudaGraphNode_t* dependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, cudaStreamCaptureMode mode) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaThreadExchangeStreamCaptureMode(cudaStreamCaptureMode* mode) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaStreamEndCapture(cudaStream_t stream, cudaGraph_t* pGraph) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaStreamIsCapturing(cudaStream_t stream, cudaStreamCaptureStatus* pCaptureStatus) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaStreamUpdateCaptureDependencies(cudaStream_t stream, cudaGraphNode_t* dependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaEventCreate(cudaEvent_t* event) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaEventCreateWithFlags(cudaEvent_t* event, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaEventRecord(cudaEvent_t event, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaEventRecordWithFlags(cudaEvent_t event, cudaStream_t stream, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaEventQuery(cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaEventSynchronize(cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaEventDestroy(cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaEventElapsedTime(float* ms, cudaEvent_t start, cudaEvent_t end) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaImportExternalMemory(cudaExternalMemory_t* extMem_out, const cudaExternalMemoryHandleDesc* memHandleDesc) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaExternalMemoryGetMappedBuffer(void** devPtr, cudaExternalMemory_t extMem, const cudaExternalMemoryBufferDesc* bufferDesc) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaExternalMemoryGetMappedMipmappedArray(cudaMipmappedArray_t* mipmap, cudaExternalMemory_t extMem, const cudaExternalMemoryMipmappedArrayDesc* mipmapDesc) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaDestroyExternalMemory(cudaExternalMemory_t extMem) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaImportExternalSemaphore(cudaExternalSemaphore_t* extSem_out, const cudaExternalSemaphoreHandleDesc* semHandleDesc) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaDestroyExternalSemaphore(cudaExternalSemaphore_t extSem) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaFuncSetCacheConfig(const void* func, cudaFuncCache cacheConfig) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaFuncGetAttributes(cudaFuncAttributes* attr, const void* func) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaFuncSetAttribute(const void* func, cudaFuncAttribute attr, int value) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaFuncGetName(const char** name, const void* func) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaFuncGetParamInfo(const void* func, size_t paramIndex, size_t* paramOffset, size_t* paramSize) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaLaunchHostFunc(cudaStream_t stream, cudaHostFn_t fn, void* userData) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaFuncSetSharedMemConfig(const void* func, cudaSharedMemConfig config) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaOccupancyMaxActiveBlocksPerMultiprocessor(int* numBlocks, const void* func, int blockSize, size_t dynamicSMemSize) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaOccupancyAvailableDynamicSMemPerBlock(size_t* dynamicSmemSize, const void* func, int numBlocks, int blockSize) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(int* numBlocks, const void* func, int blockSize, size_t dynamicSMemSize, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMallocManaged(void** devPtr, size_t size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMalloc(void** devPtr, size_t size) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMallocHost(void** ptr, size_t size) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMallocPitch(void** devPtr, size_t* pitch, size_t width, size_t height) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMallocArray(cudaArray_t* array, const cudaChannelFormatDesc* desc, size_t width, size_t height, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaFree(void* devPtr) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaFreeHost(void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaFreeArray(cudaArray_t array) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaFreeMipmappedArray(cudaMipmappedArray_t mipmappedArray) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaHostAlloc(void** pHost, size_t size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaHostRegister(void* ptr, size_t size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaHostUnregister(void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaHostGetDevicePointer(void** pDevice, void* pHost, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaHostGetFlags(unsigned int* pFlags, void* pHost) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMalloc3D(cudaPitchedPtr* pitchedDevPtr, cudaExtent extent) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMalloc3DArray(cudaArray_t* array, const cudaChannelFormatDesc* desc, cudaExtent extent, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMallocMipmappedArray(cudaMipmappedArray_t* mipmappedArray, const cudaChannelFormatDesc* desc, cudaExtent extent, unsigned int numLevels, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGetMipmappedArrayLevel(cudaArray_t* levelArray, cudaMipmappedArray_const_t mipmappedArray, unsigned int level) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMemcpy3D(const cudaMemcpy3DParms* p) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMemcpy3DPeer(const cudaMemcpy3DPeerParms* p) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMemcpy3DAsync(const cudaMemcpy3DParms* p, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMemcpy3DPeerAsync(const cudaMemcpy3DPeerParms* p, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMemGetInfo(size_t* free, size_t* total) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaArrayGetInfo(cudaChannelFormatDesc* desc, cudaExtent* extent, unsigned int* flags, cudaArray_t array) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaArrayGetPlane(cudaArray_t* pPlaneArray, cudaArray_t hArray, unsigned int planeIdx) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaArrayGetMemoryRequirements(cudaArrayMemoryRequirements* memoryRequirements, cudaArray_t array, int device) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMipmappedArrayGetMemoryRequirements(cudaArrayMemoryRequirements* memoryRequirements, cudaMipmappedArray_t mipmap, int device) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaArrayGetSparseProperties(cudaArraySparseProperties* sparseProperties, cudaArray_t array) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMipmappedArrayGetSparseProperties(cudaArraySparseProperties* sparseProperties, cudaMipmappedArray_t mipmap) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMemcpy(void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMemcpyPeer(void* dst, int dstDevice, const void* src, int srcDevice, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMemcpy2D(void* dst, size_t dpitch, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMemcpy2DToArray(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMemcpy2DFromArray(void* dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMemcpy2DArrayToArray(cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMemcpyAsync(void* dst, const void* src, size_t count, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMemcpyPeerAsync(void* dst, int dstDevice, const void* src, int srcDevice, size_t count, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMemcpyBatchAsync(const void** dsts, const void** srcs, const size_t* sizes, size_t count, cudaMemcpyAttributes* attrs, size_t* attrsIdxs, size_t numAttrs, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMemcpy3DBatchAsync(size_t numOps, cudaMemcpy3DBatchOp* opList, unsigned long long flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMemcpy2DAsync(void* dst, size_t dpitch, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMemcpy2DToArrayAsync(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMemcpy2DFromArrayAsync(void* dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMemset(void* devPtr, int value, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMemset2D(void* devPtr, size_t pitch, int value, size_t width, size_t height) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMemset3D(cudaPitchedPtr pitchedDevPtr, int value, cudaExtent extent) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMemsetAsync(void* devPtr, int value, size_t count, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMemset2DAsync(void* devPtr, size_t pitch, int value, size_t width, size_t height, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMemset3DAsync(cudaPitchedPtr pitchedDevPtr, int value, cudaExtent extent, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMemPrefetchAsync(const void* devPtr, size_t count, cudaMemLocation location, unsigned int flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMemAdvise(const void* devPtr, size_t count, cudaMemoryAdvise advice, cudaMemLocation location) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMemRangeGetAttribute(void* data, size_t dataSize, cudaMemRangeAttribute attribute, const void* devPtr, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMemRangeGetAttributes(void** data, size_t* dataSizes, cudaMemRangeAttribute* attributes, size_t numAttributes, const void* devPtr, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMemcpyToArray(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMemcpyFromArray(void* dst, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMemcpyArrayToArray(cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMemcpyToArrayAsync(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t count, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMemcpyFromArrayAsync(void* dst, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMallocAsync(void** devPtr, size_t size, cudaStream_t hStream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaFreeAsync(void* devPtr, cudaStream_t hStream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMemPoolTrimTo(cudaMemPool_t memPool, size_t minBytesToKeep) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMemPoolSetAttribute(cudaMemPool_t memPool, cudaMemPoolAttr attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMemPoolGetAttribute(cudaMemPool_t memPool, cudaMemPoolAttr attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMemPoolSetAccess(cudaMemPool_t memPool, const cudaMemAccessDesc* descList, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMemPoolGetAccess(cudaMemAccessFlags* flags, cudaMemPool_t memPool, cudaMemLocation* location) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMemPoolCreate(cudaMemPool_t* memPool, const cudaMemPoolProps* poolProps) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMemPoolDestroy(cudaMemPool_t memPool) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMallocFromPoolAsync(void** ptr, size_t size, cudaMemPool_t memPool, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMemPoolExportToShareableHandle(void* shareableHandle, cudaMemPool_t memPool, cudaMemAllocationHandleType handleType, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMemPoolImportFromShareableHandle(cudaMemPool_t* memPool, void* shareableHandle, cudaMemAllocationHandleType handleType, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMemPoolExportPointer(cudaMemPoolPtrExportData* exportData, void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMemPoolImportPointer(void** ptr, cudaMemPool_t memPool, cudaMemPoolPtrExportData* exportData) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaPointerGetAttributes(cudaPointerAttributes* attributes, const void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaDeviceCanAccessPeer(int* canAccessPeer, int device, int peerDevice) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaDeviceEnablePeerAccess(int peerDevice, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaDeviceDisablePeerAccess(int peerDevice) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphicsUnregisterResource(cudaGraphicsResource_t resource) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphicsResourceSetMapFlags(cudaGraphicsResource_t resource, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphicsMapResources(int count, cudaGraphicsResource_t* resources, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphicsUnmapResources(int count, cudaGraphicsResource_t* resources, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphicsResourceGetMappedPointer(void** devPtr, size_t* size, cudaGraphicsResource_t resource) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphicsSubResourceGetMappedArray(cudaArray_t* array, cudaGraphicsResource_t resource, unsigned int arrayIndex, unsigned int mipLevel) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphicsResourceGetMappedMipmappedArray(cudaMipmappedArray_t* mipmappedArray, cudaGraphicsResource_t resource) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGetChannelDesc(cudaChannelFormatDesc* desc, cudaArray_const_t array) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaChannelFormatDesc cudaCreateChannelDesc(int x, int y, int z, int w, cudaChannelFormatKind f) except* nogil +cdef cudaError_t cudaCreateTextureObject(cudaTextureObject_t* pTexObject, const cudaResourceDesc* pResDesc, const cudaTextureDesc* pTexDesc, const cudaResourceViewDesc* pResViewDesc) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaDestroyTextureObject(cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGetTextureObjectResourceDesc(cudaResourceDesc* pResDesc, cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGetTextureObjectTextureDesc(cudaTextureDesc* pTexDesc, cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGetTextureObjectResourceViewDesc(cudaResourceViewDesc* pResViewDesc, cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaCreateSurfaceObject(cudaSurfaceObject_t* pSurfObject, const cudaResourceDesc* pResDesc) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaDestroySurfaceObject(cudaSurfaceObject_t surfObject) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGetSurfaceObjectResourceDesc(cudaResourceDesc* pResDesc, cudaSurfaceObject_t surfObject) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaDriverGetVersion(int* driverVersion) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaRuntimeGetVersion(int* runtimeVersion) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphCreate(cudaGraph_t* pGraph, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphAddKernelNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphKernelNodeGetParams(cudaGraphNode_t node, cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphKernelNodeSetParams(cudaGraphNode_t node, const cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphKernelNodeCopyAttributes(cudaGraphNode_t hDst, cudaGraphNode_t hSrc) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphKernelNodeGetAttribute(cudaGraphNode_t hNode, cudaKernelNodeAttrID attr, cudaKernelNodeAttrValue* value_out) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphKernelNodeSetAttribute(cudaGraphNode_t hNode, cudaKernelNodeAttrID attr, const cudaKernelNodeAttrValue* value) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphAddMemcpyNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaMemcpy3DParms* pCopyParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphAddMemcpyNode1D(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphMemcpyNodeGetParams(cudaGraphNode_t node, cudaMemcpy3DParms* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphMemcpyNodeSetParams(cudaGraphNode_t node, const cudaMemcpy3DParms* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphMemcpyNodeSetParams1D(cudaGraphNode_t node, void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphAddMemsetNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaMemsetParams* pMemsetParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphMemsetNodeGetParams(cudaGraphNode_t node, cudaMemsetParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphMemsetNodeSetParams(cudaGraphNode_t node, const cudaMemsetParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphAddHostNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphHostNodeGetParams(cudaGraphNode_t node, cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphHostNodeSetParams(cudaGraphNode_t node, const cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphAddChildGraphNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaGraph_t childGraph) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphChildGraphNodeGetGraph(cudaGraphNode_t node, cudaGraph_t* pGraph) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphAddEmptyNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphAddEventRecordNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphEventRecordNodeGetEvent(cudaGraphNode_t node, cudaEvent_t* event_out) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphEventRecordNodeSetEvent(cudaGraphNode_t node, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphAddEventWaitNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphEventWaitNodeGetEvent(cudaGraphNode_t node, cudaEvent_t* event_out) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphEventWaitNodeSetEvent(cudaGraphNode_t node, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphAddExternalSemaphoresSignalNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphExternalSemaphoresSignalNodeGetParams(cudaGraphNode_t hNode, cudaExternalSemaphoreSignalNodeParams* params_out) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphExternalSemaphoresSignalNodeSetParams(cudaGraphNode_t hNode, const cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphAddExternalSemaphoresWaitNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphExternalSemaphoresWaitNodeGetParams(cudaGraphNode_t hNode, cudaExternalSemaphoreWaitNodeParams* params_out) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphExternalSemaphoresWaitNodeSetParams(cudaGraphNode_t hNode, const cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphAddMemAllocNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaMemAllocNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphMemAllocNodeGetParams(cudaGraphNode_t node, cudaMemAllocNodeParams* params_out) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphAddMemFreeNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, void* dptr) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphMemFreeNodeGetParams(cudaGraphNode_t node, void* dptr_out) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaDeviceGraphMemTrim(int device) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaDeviceGetGraphMemAttribute(int device, cudaGraphMemAttributeType attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaDeviceSetGraphMemAttribute(int device, cudaGraphMemAttributeType attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphClone(cudaGraph_t* pGraphClone, cudaGraph_t originalGraph) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphNodeFindInClone(cudaGraphNode_t* pNode, cudaGraphNode_t originalNode, cudaGraph_t clonedGraph) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphNodeGetType(cudaGraphNode_t node, cudaGraphNodeType* pType) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphGetNodes(cudaGraph_t graph, cudaGraphNode_t* nodes, size_t* numNodes) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphGetRootNodes(cudaGraph_t graph, cudaGraphNode_t* pRootNodes, size_t* pNumRootNodes) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphGetEdges(cudaGraph_t graph, cudaGraphNode_t* from_, cudaGraphNode_t* to, cudaGraphEdgeData* edgeData, size_t* numEdges) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphNodeGetDependencies(cudaGraphNode_t node, cudaGraphNode_t* pDependencies, cudaGraphEdgeData* edgeData, size_t* pNumDependencies) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphNodeGetDependentNodes(cudaGraphNode_t node, cudaGraphNode_t* pDependentNodes, cudaGraphEdgeData* edgeData, size_t* pNumDependentNodes) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphAddDependencies(cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, const cudaGraphEdgeData* edgeData, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphRemoveDependencies(cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, const cudaGraphEdgeData* edgeData, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphDestroyNode(cudaGraphNode_t node) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphInstantiate(cudaGraphExec_t* pGraphExec, cudaGraph_t graph, unsigned long long flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphInstantiateWithFlags(cudaGraphExec_t* pGraphExec, cudaGraph_t graph, unsigned long long flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphInstantiateWithParams(cudaGraphExec_t* pGraphExec, cudaGraph_t graph, cudaGraphInstantiateParams* instantiateParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphExecGetFlags(cudaGraphExec_t graphExec, unsigned long long* flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphExecKernelNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphExecMemcpyNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaMemcpy3DParms* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphExecMemcpyNodeSetParams1D(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphExecMemsetNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaMemsetParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphExecHostNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphExecChildGraphNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, cudaGraph_t childGraph) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphExecEventRecordNodeSetEvent(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphExecEventWaitNodeSetEvent(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphExecExternalSemaphoresSignalNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, const cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphExecExternalSemaphoresWaitNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, const cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphNodeSetEnabled(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, unsigned int isEnabled) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphNodeGetEnabled(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, unsigned int* isEnabled) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphExecUpdate(cudaGraphExec_t hGraphExec, cudaGraph_t hGraph, cudaGraphExecUpdateResultInfo* resultInfo) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphUpload(cudaGraphExec_t graphExec, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphLaunch(cudaGraphExec_t graphExec, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphExecDestroy(cudaGraphExec_t graphExec) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphDestroy(cudaGraph_t graph) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphDebugDotPrint(cudaGraph_t graph, const char* path, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaUserObjectCreate(cudaUserObject_t* object_out, void* ptr, cudaHostFn_t destroy, unsigned int initialRefcount, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaUserObjectRetain(cudaUserObject_t object, unsigned int count) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaUserObjectRelease(cudaUserObject_t object, unsigned int count) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphRetainUserObject(cudaGraph_t graph, cudaUserObject_t object, unsigned int count, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphReleaseUserObject(cudaGraph_t graph, cudaUserObject_t object, unsigned int count) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphAddNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphNodeSetParams(cudaGraphNode_t node, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphExecNodeSetParams(cudaGraphExec_t graphExec, cudaGraphNode_t node, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphConditionalHandleCreate(cudaGraphConditionalHandle* pHandle_out, cudaGraph_t graph, unsigned int defaultLaunchValue, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGetDriverEntryPoint(const char* symbol, void** funcPtr, unsigned long long flags, cudaDriverEntryPointQueryResult* driverStatus) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGetDriverEntryPointByVersion(const char* symbol, void** funcPtr, unsigned int cudaVersion, unsigned long long flags, cudaDriverEntryPointQueryResult* driverStatus) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaLibraryLoadData(cudaLibrary_t* library, const void* code, cudaJitOption* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, cudaLibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaLibraryLoadFromFile(cudaLibrary_t* library, const char* fileName, cudaJitOption* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, cudaLibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaLibraryUnload(cudaLibrary_t library) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaLibraryGetKernel(cudaKernel_t* pKernel, cudaLibrary_t library, const char* name) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaLibraryGetGlobal(void** dptr, size_t* bytes, cudaLibrary_t library, const char* name) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaLibraryGetManaged(void** dptr, size_t* bytes, cudaLibrary_t library, const char* name) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaLibraryGetUnifiedFunction(void** fptr, cudaLibrary_t library, const char* symbol) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaLibraryGetKernelCount(unsigned int* count, cudaLibrary_t lib) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaLibraryEnumerateKernels(cudaKernel_t* kernels, unsigned int numKernels, cudaLibrary_t lib) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaKernelSetAttributeForDevice(cudaKernel_t kernel, cudaFuncAttribute attr, int value, int device) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGetExportTable(const void** ppExportTable, const cudaUUID_t* pExportTableId) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGetKernel(cudaKernel_t* kernelPtr, const void* entryFuncAddr) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphicsEGLRegisterImage(cudaGraphicsResource** pCudaResource, EGLImageKHR image, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaEGLStreamConsumerConnect(cudaEglStreamConnection* conn, EGLStreamKHR eglStream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaEGLStreamConsumerConnectWithFlags(cudaEglStreamConnection* conn, EGLStreamKHR eglStream, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaEGLStreamConsumerDisconnect(cudaEglStreamConnection* conn) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaEGLStreamConsumerAcquireFrame(cudaEglStreamConnection* conn, cudaGraphicsResource_t* pCudaResource, cudaStream_t* pStream, unsigned int timeout) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaEGLStreamConsumerReleaseFrame(cudaEglStreamConnection* conn, cudaGraphicsResource_t pCudaResource, cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaEGLStreamProducerConnect(cudaEglStreamConnection* conn, EGLStreamKHR eglStream, EGLint width, EGLint height) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaEGLStreamProducerDisconnect(cudaEglStreamConnection* conn) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaEGLStreamProducerPresentFrame(cudaEglStreamConnection* conn, cudaEglFrame eglframe, cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaEGLStreamProducerReturnFrame(cudaEglStreamConnection* conn, cudaEglFrame* eglframe, cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphicsResourceGetMappedEglFrame(cudaEglFrame* eglFrame, cudaGraphicsResource_t resource, unsigned int index, unsigned int mipLevel) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaEventCreateFromEGLSync(cudaEvent_t* phEvent, EGLSyncKHR eglSync, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaProfilerStart() except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaProfilerStop() except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGLGetDevices(unsigned int* pCudaDeviceCount, int* pCudaDevices, unsigned int cudaDeviceCount, cudaGLDeviceList deviceList) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphicsGLRegisterImage(cudaGraphicsResource** resource, GLuint image, GLenum target, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphicsGLRegisterBuffer(cudaGraphicsResource** resource, GLuint buffer, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaVDPAUGetDevice(int* device, VdpDevice vdpDevice, VdpGetProcAddress* vdpGetProcAddress) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaVDPAUSetVDPAUDevice(int device, VdpDevice vdpDevice, VdpGetProcAddress* vdpGetProcAddress) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphicsVDPAURegisterVideoSurface(cudaGraphicsResource** resource, VdpVideoSurface vdpSurface, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphicsVDPAURegisterOutputSurface(cudaGraphicsResource** resource, VdpOutputSurface vdpSurface, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGetDeviceProperties(cudaDeviceProp* prop, int device) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaDeviceGetHostAtomicCapabilities(unsigned int* capabilities, const cudaAtomicOperation* operations, unsigned int count, int device) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaDeviceGetP2PAtomicCapabilities(unsigned int* capabilities, const cudaAtomicOperation* operations, unsigned int count, int srcDevice, int dstDevice) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaStreamGetCaptureInfo(cudaStream_t stream, cudaStreamCaptureStatus* captureStatus_out, unsigned long long* id_out, cudaGraph_t* graph_out, const cudaGraphNode_t** dependencies_out, const cudaGraphEdgeData** edgeData_out, size_t* numDependencies_out) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaSignalExternalSemaphoresAsync(const cudaExternalSemaphore_t* extSemArray, const cudaExternalSemaphoreSignalParams* paramsArray, unsigned int numExtSems, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaWaitExternalSemaphoresAsync(const cudaExternalSemaphore_t* extSemArray, const cudaExternalSemaphoreWaitParams* paramsArray, unsigned int numExtSems, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMemPrefetchBatchAsync(void** dptrs, size_t* sizes, size_t count, cudaMemLocation* prefetchLocs, size_t* prefetchLocIdxs, size_t numPrefetchLocs, unsigned long long flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMemDiscardBatchAsync(void** dptrs, size_t* sizes, size_t count, unsigned long long flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMemDiscardAndPrefetchBatchAsync(void** dptrs, size_t* sizes, size_t count, cudaMemLocation* prefetchLocs, size_t* prefetchLocIdxs, size_t numPrefetchLocs, unsigned long long flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMemGetDefaultMemPool(cudaMemPool_t* memPool, cudaMemLocation* location, cudaMemAllocationType type) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMemGetMemPool(cudaMemPool_t* memPool, cudaMemLocation* location, cudaMemAllocationType type) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMemSetMemPool(cudaMemLocation* location, cudaMemAllocationType type, cudaMemPool_t memPool) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaLogsRegisterCallback(cudaLogsCallback_t callbackFunc, void* userData, cudaLogsCallbackHandle* callback_out) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaLogsUnregisterCallback(cudaLogsCallbackHandle callback) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaLogsCurrent(cudaLogIterator* iterator_out, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaLogsDumpToFile(cudaLogIterator* iterator, const char* pathToFile, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaLogsDumpToMemory(cudaLogIterator* iterator, char* buffer, size_t* size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphNodeGetContainingGraph(cudaGraphNode_t hNode, cudaGraph_t* phGraph) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphNodeGetLocalId(cudaGraphNode_t hNode, unsigned int* nodeId) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphNodeGetToolsId(cudaGraphNode_t hNode, unsigned long long* toolsNodeId) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphGetId(cudaGraph_t hGraph, unsigned int* graphID) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphExecGetId(cudaGraphExec_t hGraphExec, unsigned int* graphID) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphConditionalHandleCreate_v2(cudaGraphConditionalHandle* pHandle_out, cudaGraph_t graph, cudaExecutionContext_t ctx, unsigned int defaultLaunchValue, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaDeviceGetDevResource(int device, cudaDevResource* resource, cudaDevResourceType type) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaDevSmResourceSplitByCount(cudaDevResource* result, unsigned int* nbGroups, const cudaDevResource* input, cudaDevResource* remaining, unsigned int flags, unsigned int minCount) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaDevSmResourceSplit(cudaDevResource* result, unsigned int nbGroups, const cudaDevResource* input, cudaDevResource* remainder, unsigned int flags, cudaDevSmResourceGroupParams* groupParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaDevResourceGenerateDesc(cudaDevResourceDesc_t* phDesc, cudaDevResource* resources, unsigned int nbResources) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGreenCtxCreate(cudaExecutionContext_t* phCtx, cudaDevResourceDesc_t desc, int device, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaExecutionCtxDestroy(cudaExecutionContext_t ctx) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaExecutionCtxGetDevResource(cudaExecutionContext_t ctx, cudaDevResource* resource, cudaDevResourceType type) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaExecutionCtxGetDevice(int* device, cudaExecutionContext_t ctx) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaExecutionCtxGetId(cudaExecutionContext_t ctx, unsigned long long* ctxId) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaExecutionCtxStreamCreate(cudaStream_t* phStream, cudaExecutionContext_t ctx, unsigned int flags, int priority) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaExecutionCtxSynchronize(cudaExecutionContext_t ctx) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaStreamGetDevResource(cudaStream_t hStream, cudaDevResource* resource, cudaDevResourceType type) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaExecutionCtxRecordEvent(cudaExecutionContext_t ctx, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaExecutionCtxWaitEvent(cudaExecutionContext_t ctx, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaDeviceGetExecutionCtx(cudaExecutionContext_t* ctx, int device) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaFuncGetParamCount(const void* func, size_t* paramCount) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaLaunchHostFunc_v2(cudaStream_t stream, cudaHostFn_t fn, void* userData, unsigned int syncMode) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMemcpyWithAttributesAsync(void* dst, const void* src, size_t size, cudaMemcpyAttributes* attr, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaMemcpy3DWithAttributesAsync(cudaMemcpy3DBatchOp* op, unsigned long long flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaGraphNodeGetParams(cudaGraphNode_t node, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil +cdef cudaError_t cudaStreamBeginRecaptureToGraph(cudaStream_t stream, cudaStreamCaptureMode mode, cudaGraph_t graph, cudaGraphRecaptureCallbackData* callbackData) except ?cudaErrorCallRequiresNewerDriver nogil + +# C #define integer constants from driver_types.h required for ABI compat with lowpp layer +cdef extern from 'driver_types.h': + cdef enum: + cudaHostAllocDefault + cudaHostAllocPortable + cudaHostAllocMapped + cudaHostAllocWriteCombined + cudaHostRegisterDefault + cudaHostRegisterPortable + cudaHostRegisterMapped + cudaHostRegisterIoMemory + cudaHostRegisterReadOnly + cudaPeerAccessDefault + cudaStreamDefault + cudaStreamNonBlocking + cudaEventDefault + cudaEventBlockingSync + cudaEventDisableTiming + cudaEventInterprocess + cudaEventRecordDefault + cudaEventRecordExternal + cudaEventWaitDefault + cudaEventWaitExternal + cudaDeviceScheduleAuto + cudaDeviceScheduleSpin + cudaDeviceScheduleYield + cudaDeviceScheduleBlockingSync + cudaDeviceBlockingSync + cudaDeviceScheduleMask + cudaDeviceMapHost + cudaDeviceLmemResizeToMax + cudaDeviceSyncMemops + cudaDeviceMask + cudaArrayDefault + cudaArrayLayered + cudaArraySurfaceLoadStore + cudaArrayCubemap + cudaArrayTextureGather + cudaArrayColorAttachment + cudaArraySparse + cudaArrayDeferredMapping + cudaIpcMemLazyEnablePeerAccess + cudaMemAttachGlobal + cudaMemAttachHost + cudaMemAttachSingle + cudaOccupancyDefault + cudaOccupancyDisableCachingOverride + cudaCpuDeviceId + cudaInvalidDeviceId + cudaInitDeviceFlagsAreValid + cudaArraySparsePropertiesSingleMipTail + cudaMemPoolCreateUsageHwDecompress + CUDA_IPC_HANDLE_SIZE + cudaExternalMemoryDedicated + cudaExternalSemaphoreSignalSkipNvSciBufMemSync + cudaExternalSemaphoreWaitSkipNvSciBufMemSync + cudaNvSciSyncAttrSignal + cudaNvSciSyncAttrWait + cudaGraphKernelNodePortDefault + cudaGraphKernelNodePortProgrammatic + cudaGraphKernelNodePortLaunchCompletion + cudaStreamAttributeAccessPolicyWindow + cudaStreamAttributeSynchronizationPolicy + cudaStreamAttributeMemSyncDomainMap + cudaStreamAttributeMemSyncDomain + cudaStreamAttributePriority + cudaKernelNodeAttributeAccessPolicyWindow + cudaKernelNodeAttributeCooperative + cudaKernelNodeAttributePriority + cudaKernelNodeAttributeClusterDimension + cudaKernelNodeAttributeClusterSchedulingPolicyPreference + cudaKernelNodeAttributeMemSyncDomainMap + cudaKernelNodeAttributeMemSyncDomain + cudaKernelNodeAttributePreferredSharedMemoryCarveout + cudaKernelNodeAttributeDeviceUpdatableKernelNode + cudaKernelNodeAttributeNvlinkUtilCentricScheduling + +# cudaStreamLegacy/PerThread are pointer-cast macros: ((cudaStream_t)0x1/0x2); use integer values +cdef enum: + cudaStreamLegacy = 1 + cudaStreamPerThread = 2 + +# Surface and texture type constants +cdef extern from 'surface_types.h': + cdef enum: + cudaSurfaceType1D + cudaSurfaceType2D + cudaSurfaceType3D + cudaSurfaceTypeCubemap + cudaSurfaceType1DLayered + cudaSurfaceType2DLayered + cudaSurfaceTypeCubemapLayered + +cdef extern from 'texture_types.h': + cdef enum: + cudaTextureType1D + cudaTextureType2D + cudaTextureType3D + cudaTextureTypeCubemap + cudaTextureType1DLayered + cudaTextureType2DLayered + cudaTextureTypeCubemapLayered + +# Version constants +cdef extern from 'cuda_runtime.h': + cdef enum: + CUDART_VERSION + +cdef extern from 'cuda_runtime_api.h': + cdef enum: + __CUDART_API_VERSION + +# CUDA_EGL_MAX_PLANES is defined as 3 in cuda_egl_interop.h; hardcoded to avoid EGL deps +cdef enum: + CUDA_EGL_MAX_PLANES = 3 + +# libraryPropertyType_t (starts lowercase, outside type pattern) +cdef extern from 'library_types.h': + ctypedef enum libraryPropertyType_t 'libraryPropertyType_t': + MAJOR_VERSION + MINOR_VERSION + PATCH_LEVEL + + +# Static inline helpers from driver_functions.h — wrapped as cdef so the lowpp layer can cimport them. +cdef cudaPitchedPtr make_cudaPitchedPtr(void* d, size_t p, size_t xsz, size_t ysz) except* nogil +cdef cudaPos make_cudaPos(size_t x, size_t y, size_t z) except* nogil +cdef cudaExtent make_cudaExtent(size_t w, size_t h, size_t d) except* nogil + +cdef cudaError_t getLocalRuntimeVersion(int* runtimeVersion) except ?cudaErrorCallRequiresNewerDriver nogil diff --git a/cuda_bindings/cuda/bindings/cyruntime.pyx b/cuda_bindings/cuda/bindings/cyruntime.pyx new file mode 100644 index 00000000000..bc3f12896c8 --- /dev/null +++ b/cuda_bindings/cuda/bindings/cyruntime.pyx @@ -0,0 +1,1393 @@ +# SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +# This code was automatically generated across versions from 12.9.0 to 13.3.0. Do not modify it directly. + +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=034f6c5c936d547d3106aa249f8f85b67389eac8b90ab569aa74815f08d699af +from ._internal cimport runtime as _runtime + +cdef cudaError_t cudaDeviceReset() except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaDeviceReset() + + +cdef cudaError_t cudaDeviceSynchronize() except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaDeviceSynchronize() + + +cdef cudaError_t cudaDeviceSetLimit(cudaLimit limit, size_t value) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaDeviceSetLimit(limit, value) + + +cdef cudaError_t cudaDeviceGetLimit(size_t* pValue, cudaLimit limit) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaDeviceGetLimit(pValue, limit) + + +cdef cudaError_t cudaDeviceGetTexture1DLinearMaxWidth(size_t* maxWidthInElements, const cudaChannelFormatDesc* fmtDesc, int device) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaDeviceGetTexture1DLinearMaxWidth(maxWidthInElements, fmtDesc, device) + + +cdef cudaError_t cudaDeviceGetCacheConfig(cudaFuncCache* pCacheConfig) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaDeviceGetCacheConfig(pCacheConfig) + + +cdef cudaError_t cudaDeviceGetStreamPriorityRange(int* leastPriority, int* greatestPriority) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaDeviceGetStreamPriorityRange(leastPriority, greatestPriority) + + +cdef cudaError_t cudaDeviceSetCacheConfig(cudaFuncCache cacheConfig) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaDeviceSetCacheConfig(cacheConfig) + + +cdef cudaError_t cudaDeviceGetByPCIBusId(int* device, const char* pciBusId) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaDeviceGetByPCIBusId(device, pciBusId) + + +cdef cudaError_t cudaDeviceGetPCIBusId(char* pciBusId, int len, int device) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaDeviceGetPCIBusId(pciBusId, len, device) + + +cdef cudaError_t cudaIpcGetEventHandle(cudaIpcEventHandle_t* handle, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaIpcGetEventHandle(handle, event) + + +cdef cudaError_t cudaIpcOpenEventHandle(cudaEvent_t* event, cudaIpcEventHandle_t handle) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaIpcOpenEventHandle(event, handle) + + +cdef cudaError_t cudaIpcGetMemHandle(cudaIpcMemHandle_t* handle, void* devPtr) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaIpcGetMemHandle(handle, devPtr) + + +cdef cudaError_t cudaIpcOpenMemHandle(void** devPtr, cudaIpcMemHandle_t handle, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaIpcOpenMemHandle(devPtr, handle, flags) + + +cdef cudaError_t cudaIpcCloseMemHandle(void* devPtr) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaIpcCloseMemHandle(devPtr) + + +cdef cudaError_t cudaDeviceFlushGPUDirectRDMAWrites(cudaFlushGPUDirectRDMAWritesTarget target, cudaFlushGPUDirectRDMAWritesScope scope) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaDeviceFlushGPUDirectRDMAWrites(target, scope) + + +cdef cudaError_t cudaDeviceRegisterAsyncNotification(int device, cudaAsyncCallback callbackFunc, void* userData, cudaAsyncCallbackHandle_t* callback) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaDeviceRegisterAsyncNotification(device, callbackFunc, userData, callback) + + +cdef cudaError_t cudaDeviceUnregisterAsyncNotification(int device, cudaAsyncCallbackHandle_t callback) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaDeviceUnregisterAsyncNotification(device, callback) + + +cdef cudaError_t cudaDeviceGetSharedMemConfig(cudaSharedMemConfig* pConfig) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaDeviceGetSharedMemConfig(pConfig) + + +cdef cudaError_t cudaDeviceSetSharedMemConfig(cudaSharedMemConfig config) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaDeviceSetSharedMemConfig(config) + + +cdef cudaError_t cudaGetLastError() except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGetLastError() + + +cdef cudaError_t cudaPeekAtLastError() except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaPeekAtLastError() + + +cdef const char* cudaGetErrorName(cudaError_t error) except?NULL nogil: + return _runtime._cudaGetErrorName(error) + + +cdef const char* cudaGetErrorString(cudaError_t error) except?NULL nogil: + return _runtime._cudaGetErrorString(error) + + +cdef cudaError_t cudaGetDeviceCount(int* count) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGetDeviceCount(count) + + +cdef cudaError_t cudaDeviceGetAttribute(int* value, cudaDeviceAttr attr, int device) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaDeviceGetAttribute(value, attr, device) + + +cdef cudaError_t cudaDeviceGetDefaultMemPool(cudaMemPool_t* memPool, int device) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaDeviceGetDefaultMemPool(memPool, device) + + +cdef cudaError_t cudaDeviceSetMemPool(int device, cudaMemPool_t memPool) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaDeviceSetMemPool(device, memPool) + + +cdef cudaError_t cudaDeviceGetMemPool(cudaMemPool_t* memPool, int device) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaDeviceGetMemPool(memPool, device) + + +cdef cudaError_t cudaDeviceGetNvSciSyncAttributes(void* nvSciSyncAttrList, int device, int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaDeviceGetNvSciSyncAttributes(nvSciSyncAttrList, device, flags) + + +cdef cudaError_t cudaDeviceGetP2PAttribute(int* value, cudaDeviceP2PAttr attr, int srcDevice, int dstDevice) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaDeviceGetP2PAttribute(value, attr, srcDevice, dstDevice) + + +cdef cudaError_t cudaChooseDevice(int* device, const cudaDeviceProp* prop) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaChooseDevice(device, prop) + + +cdef cudaError_t cudaInitDevice(int device, unsigned int deviceFlags, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaInitDevice(device, deviceFlags, flags) + + +cdef cudaError_t cudaSetDevice(int device) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaSetDevice(device) + + +cdef cudaError_t cudaGetDevice(int* device) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGetDevice(device) + + +cdef cudaError_t cudaSetDeviceFlags(unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaSetDeviceFlags(flags) + + +cdef cudaError_t cudaGetDeviceFlags(unsigned int* flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGetDeviceFlags(flags) + + +cdef cudaError_t cudaStreamCreate(cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaStreamCreate(pStream) + + +cdef cudaError_t cudaStreamCreateWithFlags(cudaStream_t* pStream, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaStreamCreateWithFlags(pStream, flags) + + +cdef cudaError_t cudaStreamCreateWithPriority(cudaStream_t* pStream, unsigned int flags, int priority) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaStreamCreateWithPriority(pStream, flags, priority) + + +cdef cudaError_t cudaStreamGetPriority(cudaStream_t hStream, int* priority) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaStreamGetPriority(hStream, priority) + + +cdef cudaError_t cudaStreamGetFlags(cudaStream_t hStream, unsigned int* flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaStreamGetFlags(hStream, flags) + + +cdef cudaError_t cudaStreamGetId(cudaStream_t hStream, unsigned long long* streamId) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaStreamGetId(hStream, streamId) + + +cdef cudaError_t cudaStreamGetDevice(cudaStream_t hStream, int* device) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaStreamGetDevice(hStream, device) + + +cdef cudaError_t cudaCtxResetPersistingL2Cache() except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaCtxResetPersistingL2Cache() + + +cdef cudaError_t cudaStreamCopyAttributes(cudaStream_t dst, cudaStream_t src) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaStreamCopyAttributes(dst, src) + + +cdef cudaError_t cudaStreamGetAttribute(cudaStream_t hStream, cudaStreamAttrID attr, cudaStreamAttrValue* value_out) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaStreamGetAttribute(hStream, attr, value_out) + + +cdef cudaError_t cudaStreamSetAttribute(cudaStream_t hStream, cudaStreamAttrID attr, const cudaStreamAttrValue* value) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaStreamSetAttribute(hStream, attr, value) + + +cdef cudaError_t cudaStreamDestroy(cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaStreamDestroy(stream) + + +cdef cudaError_t cudaStreamWaitEvent(cudaStream_t stream, cudaEvent_t event, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaStreamWaitEvent(stream, event, flags) + + +cdef cudaError_t cudaStreamAddCallback(cudaStream_t stream, cudaStreamCallback_t callback, void* userData, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaStreamAddCallback(stream, callback, userData, flags) + + +cdef cudaError_t cudaStreamSynchronize(cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaStreamSynchronize(stream) + + +cdef cudaError_t cudaStreamQuery(cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaStreamQuery(stream) + + +cdef cudaError_t cudaStreamAttachMemAsync(cudaStream_t stream, void* devPtr, size_t length, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaStreamAttachMemAsync(stream, devPtr, length, flags) + + +cdef cudaError_t cudaStreamBeginCapture(cudaStream_t stream, cudaStreamCaptureMode mode) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaStreamBeginCapture(stream, mode) + + +cdef cudaError_t cudaStreamBeginCaptureToGraph(cudaStream_t stream, cudaGraph_t graph, const cudaGraphNode_t* dependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, cudaStreamCaptureMode mode) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaStreamBeginCaptureToGraph(stream, graph, dependencies, dependencyData, numDependencies, mode) + + +cdef cudaError_t cudaThreadExchangeStreamCaptureMode(cudaStreamCaptureMode* mode) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaThreadExchangeStreamCaptureMode(mode) + + +cdef cudaError_t cudaStreamEndCapture(cudaStream_t stream, cudaGraph_t* pGraph) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaStreamEndCapture(stream, pGraph) + + +cdef cudaError_t cudaStreamIsCapturing(cudaStream_t stream, cudaStreamCaptureStatus* pCaptureStatus) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaStreamIsCapturing(stream, pCaptureStatus) + + +cdef cudaError_t cudaStreamUpdateCaptureDependencies(cudaStream_t stream, cudaGraphNode_t* dependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaStreamUpdateCaptureDependencies(stream, dependencies, dependencyData, numDependencies, flags) + + +cdef cudaError_t cudaEventCreate(cudaEvent_t* event) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaEventCreate(event) + + +cdef cudaError_t cudaEventCreateWithFlags(cudaEvent_t* event, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaEventCreateWithFlags(event, flags) + + +cdef cudaError_t cudaEventRecord(cudaEvent_t event, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaEventRecord(event, stream) + + +cdef cudaError_t cudaEventRecordWithFlags(cudaEvent_t event, cudaStream_t stream, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaEventRecordWithFlags(event, stream, flags) + + +cdef cudaError_t cudaEventQuery(cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaEventQuery(event) + + +cdef cudaError_t cudaEventSynchronize(cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaEventSynchronize(event) + + +cdef cudaError_t cudaEventDestroy(cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaEventDestroy(event) + + +cdef cudaError_t cudaEventElapsedTime(float* ms, cudaEvent_t start, cudaEvent_t end) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaEventElapsedTime(ms, start, end) + + +cdef cudaError_t cudaImportExternalMemory(cudaExternalMemory_t* extMem_out, const cudaExternalMemoryHandleDesc* memHandleDesc) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaImportExternalMemory(extMem_out, memHandleDesc) + + +cdef cudaError_t cudaExternalMemoryGetMappedBuffer(void** devPtr, cudaExternalMemory_t extMem, const cudaExternalMemoryBufferDesc* bufferDesc) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaExternalMemoryGetMappedBuffer(devPtr, extMem, bufferDesc) + + +cdef cudaError_t cudaExternalMemoryGetMappedMipmappedArray(cudaMipmappedArray_t* mipmap, cudaExternalMemory_t extMem, const cudaExternalMemoryMipmappedArrayDesc* mipmapDesc) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaExternalMemoryGetMappedMipmappedArray(mipmap, extMem, mipmapDesc) + + +cdef cudaError_t cudaDestroyExternalMemory(cudaExternalMemory_t extMem) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaDestroyExternalMemory(extMem) + + +cdef cudaError_t cudaImportExternalSemaphore(cudaExternalSemaphore_t* extSem_out, const cudaExternalSemaphoreHandleDesc* semHandleDesc) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaImportExternalSemaphore(extSem_out, semHandleDesc) + + +cdef cudaError_t cudaDestroyExternalSemaphore(cudaExternalSemaphore_t extSem) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaDestroyExternalSemaphore(extSem) + + +cdef cudaError_t cudaFuncSetCacheConfig(const void* func, cudaFuncCache cacheConfig) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaFuncSetCacheConfig(func, cacheConfig) + + +cdef cudaError_t cudaFuncGetAttributes(cudaFuncAttributes* attr, const void* func) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaFuncGetAttributes(attr, func) + + +cdef cudaError_t cudaFuncSetAttribute(const void* func, cudaFuncAttribute attr, int value) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaFuncSetAttribute(func, attr, value) + + +cdef cudaError_t cudaFuncGetName(const char** name, const void* func) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaFuncGetName(name, func) + + +cdef cudaError_t cudaFuncGetParamInfo(const void* func, size_t paramIndex, size_t* paramOffset, size_t* paramSize) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaFuncGetParamInfo(func, paramIndex, paramOffset, paramSize) + + +cdef cudaError_t cudaLaunchHostFunc(cudaStream_t stream, cudaHostFn_t fn, void* userData) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaLaunchHostFunc(stream, fn, userData) + + +cdef cudaError_t cudaFuncSetSharedMemConfig(const void* func, cudaSharedMemConfig config) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaFuncSetSharedMemConfig(func, config) + + +cdef cudaError_t cudaOccupancyMaxActiveBlocksPerMultiprocessor(int* numBlocks, const void* func, int blockSize, size_t dynamicSMemSize) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaOccupancyMaxActiveBlocksPerMultiprocessor(numBlocks, func, blockSize, dynamicSMemSize) + + +cdef cudaError_t cudaOccupancyAvailableDynamicSMemPerBlock(size_t* dynamicSmemSize, const void* func, int numBlocks, int blockSize) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaOccupancyAvailableDynamicSMemPerBlock(dynamicSmemSize, func, numBlocks, blockSize) + + +cdef cudaError_t cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(int* numBlocks, const void* func, int blockSize, size_t dynamicSMemSize, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(numBlocks, func, blockSize, dynamicSMemSize, flags) + + +cdef cudaError_t cudaMallocManaged(void** devPtr, size_t size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMallocManaged(devPtr, size, flags) + + +cdef cudaError_t cudaMalloc(void** devPtr, size_t size) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMalloc(devPtr, size) + + +cdef cudaError_t cudaMallocHost(void** ptr, size_t size) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMallocHost(ptr, size) + + +cdef cudaError_t cudaMallocPitch(void** devPtr, size_t* pitch, size_t width, size_t height) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMallocPitch(devPtr, pitch, width, height) + + +cdef cudaError_t cudaMallocArray(cudaArray_t* array, const cudaChannelFormatDesc* desc, size_t width, size_t height, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMallocArray(array, desc, width, height, flags) + + +cdef cudaError_t cudaFree(void* devPtr) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaFree(devPtr) + + +cdef cudaError_t cudaFreeHost(void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaFreeHost(ptr) + + +cdef cudaError_t cudaFreeArray(cudaArray_t array) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaFreeArray(array) + + +cdef cudaError_t cudaFreeMipmappedArray(cudaMipmappedArray_t mipmappedArray) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaFreeMipmappedArray(mipmappedArray) + + +cdef cudaError_t cudaHostAlloc(void** pHost, size_t size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaHostAlloc(pHost, size, flags) + + +cdef cudaError_t cudaHostRegister(void* ptr, size_t size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaHostRegister(ptr, size, flags) + + +cdef cudaError_t cudaHostUnregister(void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaHostUnregister(ptr) + + +cdef cudaError_t cudaHostGetDevicePointer(void** pDevice, void* pHost, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaHostGetDevicePointer(pDevice, pHost, flags) + + +cdef cudaError_t cudaHostGetFlags(unsigned int* pFlags, void* pHost) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaHostGetFlags(pFlags, pHost) + + +cdef cudaError_t cudaMalloc3D(cudaPitchedPtr* pitchedDevPtr, cudaExtent extent) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMalloc3D(pitchedDevPtr, extent) + + +cdef cudaError_t cudaMalloc3DArray(cudaArray_t* array, const cudaChannelFormatDesc* desc, cudaExtent extent, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMalloc3DArray(array, desc, extent, flags) + + +cdef cudaError_t cudaMallocMipmappedArray(cudaMipmappedArray_t* mipmappedArray, const cudaChannelFormatDesc* desc, cudaExtent extent, unsigned int numLevels, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMallocMipmappedArray(mipmappedArray, desc, extent, numLevels, flags) + + +cdef cudaError_t cudaGetMipmappedArrayLevel(cudaArray_t* levelArray, cudaMipmappedArray_const_t mipmappedArray, unsigned int level) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGetMipmappedArrayLevel(levelArray, mipmappedArray, level) + + +cdef cudaError_t cudaMemcpy3D(const cudaMemcpy3DParms* p) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMemcpy3D(p) + + +cdef cudaError_t cudaMemcpy3DPeer(const cudaMemcpy3DPeerParms* p) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMemcpy3DPeer(p) + + +cdef cudaError_t cudaMemcpy3DAsync(const cudaMemcpy3DParms* p, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMemcpy3DAsync(p, stream) + + +cdef cudaError_t cudaMemcpy3DPeerAsync(const cudaMemcpy3DPeerParms* p, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMemcpy3DPeerAsync(p, stream) + + +cdef cudaError_t cudaMemGetInfo(size_t* free, size_t* total) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMemGetInfo(free, total) + + +cdef cudaError_t cudaArrayGetInfo(cudaChannelFormatDesc* desc, cudaExtent* extent, unsigned int* flags, cudaArray_t array) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaArrayGetInfo(desc, extent, flags, array) + + +cdef cudaError_t cudaArrayGetPlane(cudaArray_t* pPlaneArray, cudaArray_t hArray, unsigned int planeIdx) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaArrayGetPlane(pPlaneArray, hArray, planeIdx) + + +cdef cudaError_t cudaArrayGetMemoryRequirements(cudaArrayMemoryRequirements* memoryRequirements, cudaArray_t array, int device) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaArrayGetMemoryRequirements(memoryRequirements, array, device) + + +cdef cudaError_t cudaMipmappedArrayGetMemoryRequirements(cudaArrayMemoryRequirements* memoryRequirements, cudaMipmappedArray_t mipmap, int device) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMipmappedArrayGetMemoryRequirements(memoryRequirements, mipmap, device) + + +cdef cudaError_t cudaArrayGetSparseProperties(cudaArraySparseProperties* sparseProperties, cudaArray_t array) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaArrayGetSparseProperties(sparseProperties, array) + + +cdef cudaError_t cudaMipmappedArrayGetSparseProperties(cudaArraySparseProperties* sparseProperties, cudaMipmappedArray_t mipmap) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMipmappedArrayGetSparseProperties(sparseProperties, mipmap) + + +cdef cudaError_t cudaMemcpy(void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMemcpy(dst, src, count, kind) + + +cdef cudaError_t cudaMemcpyPeer(void* dst, int dstDevice, const void* src, int srcDevice, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMemcpyPeer(dst, dstDevice, src, srcDevice, count) + + +cdef cudaError_t cudaMemcpy2D(void* dst, size_t dpitch, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMemcpy2D(dst, dpitch, src, spitch, width, height, kind) + + +cdef cudaError_t cudaMemcpy2DToArray(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMemcpy2DToArray(dst, wOffset, hOffset, src, spitch, width, height, kind) + + +cdef cudaError_t cudaMemcpy2DFromArray(void* dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMemcpy2DFromArray(dst, dpitch, src, wOffset, hOffset, width, height, kind) + + +cdef cudaError_t cudaMemcpy2DArrayToArray(cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMemcpy2DArrayToArray(dst, wOffsetDst, hOffsetDst, src, wOffsetSrc, hOffsetSrc, width, height, kind) + + +cdef cudaError_t cudaMemcpyAsync(void* dst, const void* src, size_t count, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMemcpyAsync(dst, src, count, kind, stream) + + +cdef cudaError_t cudaMemcpyPeerAsync(void* dst, int dstDevice, const void* src, int srcDevice, size_t count, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMemcpyPeerAsync(dst, dstDevice, src, srcDevice, count, stream) + + +cdef cudaError_t cudaMemcpyBatchAsync(const void** dsts, const void** srcs, const size_t* sizes, size_t count, cudaMemcpyAttributes* attrs, size_t* attrsIdxs, size_t numAttrs, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMemcpyBatchAsync(dsts, srcs, sizes, count, attrs, attrsIdxs, numAttrs, stream) + + +cdef cudaError_t cudaMemcpy3DBatchAsync(size_t numOps, cudaMemcpy3DBatchOp* opList, unsigned long long flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMemcpy3DBatchAsync(numOps, opList, flags, stream) + + +cdef cudaError_t cudaMemcpy2DAsync(void* dst, size_t dpitch, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMemcpy2DAsync(dst, dpitch, src, spitch, width, height, kind, stream) + + +cdef cudaError_t cudaMemcpy2DToArrayAsync(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMemcpy2DToArrayAsync(dst, wOffset, hOffset, src, spitch, width, height, kind, stream) + + +cdef cudaError_t cudaMemcpy2DFromArrayAsync(void* dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMemcpy2DFromArrayAsync(dst, dpitch, src, wOffset, hOffset, width, height, kind, stream) + + +cdef cudaError_t cudaMemset(void* devPtr, int value, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMemset(devPtr, value, count) + + +cdef cudaError_t cudaMemset2D(void* devPtr, size_t pitch, int value, size_t width, size_t height) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMemset2D(devPtr, pitch, value, width, height) + + +cdef cudaError_t cudaMemset3D(cudaPitchedPtr pitchedDevPtr, int value, cudaExtent extent) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMemset3D(pitchedDevPtr, value, extent) + + +cdef cudaError_t cudaMemsetAsync(void* devPtr, int value, size_t count, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMemsetAsync(devPtr, value, count, stream) + + +cdef cudaError_t cudaMemset2DAsync(void* devPtr, size_t pitch, int value, size_t width, size_t height, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMemset2DAsync(devPtr, pitch, value, width, height, stream) + + +cdef cudaError_t cudaMemset3DAsync(cudaPitchedPtr pitchedDevPtr, int value, cudaExtent extent, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMemset3DAsync(pitchedDevPtr, value, extent, stream) + + +cdef cudaError_t cudaMemPrefetchAsync(const void* devPtr, size_t count, cudaMemLocation location, unsigned int flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMemPrefetchAsync(devPtr, count, location, flags, stream) + + +cdef cudaError_t cudaMemAdvise(const void* devPtr, size_t count, cudaMemoryAdvise advice, cudaMemLocation location) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMemAdvise(devPtr, count, advice, location) + + +cdef cudaError_t cudaMemRangeGetAttribute(void* data, size_t dataSize, cudaMemRangeAttribute attribute, const void* devPtr, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMemRangeGetAttribute(data, dataSize, attribute, devPtr, count) + + +cdef cudaError_t cudaMemRangeGetAttributes(void** data, size_t* dataSizes, cudaMemRangeAttribute* attributes, size_t numAttributes, const void* devPtr, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMemRangeGetAttributes(data, dataSizes, attributes, numAttributes, devPtr, count) + + +cdef cudaError_t cudaMemcpyToArray(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMemcpyToArray(dst, wOffset, hOffset, src, count, kind) + + +cdef cudaError_t cudaMemcpyFromArray(void* dst, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMemcpyFromArray(dst, src, wOffset, hOffset, count, kind) + + +cdef cudaError_t cudaMemcpyArrayToArray(cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMemcpyArrayToArray(dst, wOffsetDst, hOffsetDst, src, wOffsetSrc, hOffsetSrc, count, kind) + + +cdef cudaError_t cudaMemcpyToArrayAsync(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t count, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMemcpyToArrayAsync(dst, wOffset, hOffset, src, count, kind, stream) + + +cdef cudaError_t cudaMemcpyFromArrayAsync(void* dst, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMemcpyFromArrayAsync(dst, src, wOffset, hOffset, count, kind, stream) + + +cdef cudaError_t cudaMallocAsync(void** devPtr, size_t size, cudaStream_t hStream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMallocAsync(devPtr, size, hStream) + + +cdef cudaError_t cudaFreeAsync(void* devPtr, cudaStream_t hStream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaFreeAsync(devPtr, hStream) + + +cdef cudaError_t cudaMemPoolTrimTo(cudaMemPool_t memPool, size_t minBytesToKeep) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMemPoolTrimTo(memPool, minBytesToKeep) + + +cdef cudaError_t cudaMemPoolSetAttribute(cudaMemPool_t memPool, cudaMemPoolAttr attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMemPoolSetAttribute(memPool, attr, value) + + +cdef cudaError_t cudaMemPoolGetAttribute(cudaMemPool_t memPool, cudaMemPoolAttr attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMemPoolGetAttribute(memPool, attr, value) + + +cdef cudaError_t cudaMemPoolSetAccess(cudaMemPool_t memPool, const cudaMemAccessDesc* descList, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMemPoolSetAccess(memPool, descList, count) + + +cdef cudaError_t cudaMemPoolGetAccess(cudaMemAccessFlags* flags, cudaMemPool_t memPool, cudaMemLocation* location) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMemPoolGetAccess(flags, memPool, location) + + +cdef cudaError_t cudaMemPoolCreate(cudaMemPool_t* memPool, const cudaMemPoolProps* poolProps) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMemPoolCreate(memPool, poolProps) + + +cdef cudaError_t cudaMemPoolDestroy(cudaMemPool_t memPool) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMemPoolDestroy(memPool) + + +cdef cudaError_t cudaMallocFromPoolAsync(void** ptr, size_t size, cudaMemPool_t memPool, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMallocFromPoolAsync(ptr, size, memPool, stream) + + +cdef cudaError_t cudaMemPoolExportToShareableHandle(void* shareableHandle, cudaMemPool_t memPool, cudaMemAllocationHandleType handleType, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMemPoolExportToShareableHandle(shareableHandle, memPool, handleType, flags) + + +cdef cudaError_t cudaMemPoolImportFromShareableHandle(cudaMemPool_t* memPool, void* shareableHandle, cudaMemAllocationHandleType handleType, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMemPoolImportFromShareableHandle(memPool, shareableHandle, handleType, flags) + + +cdef cudaError_t cudaMemPoolExportPointer(cudaMemPoolPtrExportData* exportData, void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMemPoolExportPointer(exportData, ptr) + + +cdef cudaError_t cudaMemPoolImportPointer(void** ptr, cudaMemPool_t memPool, cudaMemPoolPtrExportData* exportData) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMemPoolImportPointer(ptr, memPool, exportData) + + +cdef cudaError_t cudaPointerGetAttributes(cudaPointerAttributes* attributes, const void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaPointerGetAttributes(attributes, ptr) + + +cdef cudaError_t cudaDeviceCanAccessPeer(int* canAccessPeer, int device, int peerDevice) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaDeviceCanAccessPeer(canAccessPeer, device, peerDevice) + + +cdef cudaError_t cudaDeviceEnablePeerAccess(int peerDevice, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaDeviceEnablePeerAccess(peerDevice, flags) + + +cdef cudaError_t cudaDeviceDisablePeerAccess(int peerDevice) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaDeviceDisablePeerAccess(peerDevice) + + +cdef cudaError_t cudaGraphicsUnregisterResource(cudaGraphicsResource_t resource) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphicsUnregisterResource(resource) + + +cdef cudaError_t cudaGraphicsResourceSetMapFlags(cudaGraphicsResource_t resource, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphicsResourceSetMapFlags(resource, flags) + + +cdef cudaError_t cudaGraphicsMapResources(int count, cudaGraphicsResource_t* resources, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphicsMapResources(count, resources, stream) + + +cdef cudaError_t cudaGraphicsUnmapResources(int count, cudaGraphicsResource_t* resources, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphicsUnmapResources(count, resources, stream) + + +cdef cudaError_t cudaGraphicsResourceGetMappedPointer(void** devPtr, size_t* size, cudaGraphicsResource_t resource) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphicsResourceGetMappedPointer(devPtr, size, resource) + + +cdef cudaError_t cudaGraphicsSubResourceGetMappedArray(cudaArray_t* array, cudaGraphicsResource_t resource, unsigned int arrayIndex, unsigned int mipLevel) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphicsSubResourceGetMappedArray(array, resource, arrayIndex, mipLevel) + + +cdef cudaError_t cudaGraphicsResourceGetMappedMipmappedArray(cudaMipmappedArray_t* mipmappedArray, cudaGraphicsResource_t resource) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphicsResourceGetMappedMipmappedArray(mipmappedArray, resource) + + +cdef cudaError_t cudaGetChannelDesc(cudaChannelFormatDesc* desc, cudaArray_const_t array) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGetChannelDesc(desc, array) + + +cdef cudaChannelFormatDesc cudaCreateChannelDesc(int x, int y, int z, int w, cudaChannelFormatKind f) except* nogil: + return _runtime._cudaCreateChannelDesc(x, y, z, w, f) + + +cdef cudaError_t cudaCreateTextureObject(cudaTextureObject_t* pTexObject, const cudaResourceDesc* pResDesc, const cudaTextureDesc* pTexDesc, const cudaResourceViewDesc* pResViewDesc) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaCreateTextureObject(pTexObject, pResDesc, pTexDesc, pResViewDesc) + + +cdef cudaError_t cudaDestroyTextureObject(cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaDestroyTextureObject(texObject) + + +cdef cudaError_t cudaGetTextureObjectResourceDesc(cudaResourceDesc* pResDesc, cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGetTextureObjectResourceDesc(pResDesc, texObject) + + +cdef cudaError_t cudaGetTextureObjectTextureDesc(cudaTextureDesc* pTexDesc, cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGetTextureObjectTextureDesc(pTexDesc, texObject) + + +cdef cudaError_t cudaGetTextureObjectResourceViewDesc(cudaResourceViewDesc* pResViewDesc, cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGetTextureObjectResourceViewDesc(pResViewDesc, texObject) + + +cdef cudaError_t cudaCreateSurfaceObject(cudaSurfaceObject_t* pSurfObject, const cudaResourceDesc* pResDesc) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaCreateSurfaceObject(pSurfObject, pResDesc) + + +cdef cudaError_t cudaDestroySurfaceObject(cudaSurfaceObject_t surfObject) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaDestroySurfaceObject(surfObject) + + +cdef cudaError_t cudaGetSurfaceObjectResourceDesc(cudaResourceDesc* pResDesc, cudaSurfaceObject_t surfObject) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGetSurfaceObjectResourceDesc(pResDesc, surfObject) + + +cdef cudaError_t cudaDriverGetVersion(int* driverVersion) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaDriverGetVersion(driverVersion) + + +cdef cudaError_t cudaRuntimeGetVersion(int* runtimeVersion) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaRuntimeGetVersion(runtimeVersion) + + +cdef cudaError_t cudaGraphCreate(cudaGraph_t* pGraph, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphCreate(pGraph, flags) + + +cdef cudaError_t cudaGraphAddKernelNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphAddKernelNode(pGraphNode, graph, pDependencies, numDependencies, pNodeParams) + + +cdef cudaError_t cudaGraphKernelNodeGetParams(cudaGraphNode_t node, cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphKernelNodeGetParams(node, pNodeParams) + + +cdef cudaError_t cudaGraphKernelNodeSetParams(cudaGraphNode_t node, const cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphKernelNodeSetParams(node, pNodeParams) + + +cdef cudaError_t cudaGraphKernelNodeCopyAttributes(cudaGraphNode_t hDst, cudaGraphNode_t hSrc) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphKernelNodeCopyAttributes(hDst, hSrc) + + +cdef cudaError_t cudaGraphKernelNodeGetAttribute(cudaGraphNode_t hNode, cudaKernelNodeAttrID attr, cudaKernelNodeAttrValue* value_out) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphKernelNodeGetAttribute(hNode, attr, value_out) + + +cdef cudaError_t cudaGraphKernelNodeSetAttribute(cudaGraphNode_t hNode, cudaKernelNodeAttrID attr, const cudaKernelNodeAttrValue* value) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphKernelNodeSetAttribute(hNode, attr, value) + + +cdef cudaError_t cudaGraphAddMemcpyNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaMemcpy3DParms* pCopyParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphAddMemcpyNode(pGraphNode, graph, pDependencies, numDependencies, pCopyParams) + + +cdef cudaError_t cudaGraphAddMemcpyNode1D(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphAddMemcpyNode1D(pGraphNode, graph, pDependencies, numDependencies, dst, src, count, kind) + + +cdef cudaError_t cudaGraphMemcpyNodeGetParams(cudaGraphNode_t node, cudaMemcpy3DParms* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphMemcpyNodeGetParams(node, pNodeParams) + + +cdef cudaError_t cudaGraphMemcpyNodeSetParams(cudaGraphNode_t node, const cudaMemcpy3DParms* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphMemcpyNodeSetParams(node, pNodeParams) + + +cdef cudaError_t cudaGraphMemcpyNodeSetParams1D(cudaGraphNode_t node, void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphMemcpyNodeSetParams1D(node, dst, src, count, kind) + + +cdef cudaError_t cudaGraphAddMemsetNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaMemsetParams* pMemsetParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphAddMemsetNode(pGraphNode, graph, pDependencies, numDependencies, pMemsetParams) + + +cdef cudaError_t cudaGraphMemsetNodeGetParams(cudaGraphNode_t node, cudaMemsetParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphMemsetNodeGetParams(node, pNodeParams) + + +cdef cudaError_t cudaGraphMemsetNodeSetParams(cudaGraphNode_t node, const cudaMemsetParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphMemsetNodeSetParams(node, pNodeParams) + + +cdef cudaError_t cudaGraphAddHostNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphAddHostNode(pGraphNode, graph, pDependencies, numDependencies, pNodeParams) + + +cdef cudaError_t cudaGraphHostNodeGetParams(cudaGraphNode_t node, cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphHostNodeGetParams(node, pNodeParams) + + +cdef cudaError_t cudaGraphHostNodeSetParams(cudaGraphNode_t node, const cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphHostNodeSetParams(node, pNodeParams) + + +cdef cudaError_t cudaGraphAddChildGraphNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaGraph_t childGraph) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphAddChildGraphNode(pGraphNode, graph, pDependencies, numDependencies, childGraph) + + +cdef cudaError_t cudaGraphChildGraphNodeGetGraph(cudaGraphNode_t node, cudaGraph_t* pGraph) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphChildGraphNodeGetGraph(node, pGraph) + + +cdef cudaError_t cudaGraphAddEmptyNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphAddEmptyNode(pGraphNode, graph, pDependencies, numDependencies) + + +cdef cudaError_t cudaGraphAddEventRecordNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphAddEventRecordNode(pGraphNode, graph, pDependencies, numDependencies, event) + + +cdef cudaError_t cudaGraphEventRecordNodeGetEvent(cudaGraphNode_t node, cudaEvent_t* event_out) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphEventRecordNodeGetEvent(node, event_out) + + +cdef cudaError_t cudaGraphEventRecordNodeSetEvent(cudaGraphNode_t node, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphEventRecordNodeSetEvent(node, event) + + +cdef cudaError_t cudaGraphAddEventWaitNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphAddEventWaitNode(pGraphNode, graph, pDependencies, numDependencies, event) + + +cdef cudaError_t cudaGraphEventWaitNodeGetEvent(cudaGraphNode_t node, cudaEvent_t* event_out) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphEventWaitNodeGetEvent(node, event_out) + + +cdef cudaError_t cudaGraphEventWaitNodeSetEvent(cudaGraphNode_t node, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphEventWaitNodeSetEvent(node, event) + + +cdef cudaError_t cudaGraphAddExternalSemaphoresSignalNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphAddExternalSemaphoresSignalNode(pGraphNode, graph, pDependencies, numDependencies, nodeParams) + + +cdef cudaError_t cudaGraphExternalSemaphoresSignalNodeGetParams(cudaGraphNode_t hNode, cudaExternalSemaphoreSignalNodeParams* params_out) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphExternalSemaphoresSignalNodeGetParams(hNode, params_out) + + +cdef cudaError_t cudaGraphExternalSemaphoresSignalNodeSetParams(cudaGraphNode_t hNode, const cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphExternalSemaphoresSignalNodeSetParams(hNode, nodeParams) + + +cdef cudaError_t cudaGraphAddExternalSemaphoresWaitNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphAddExternalSemaphoresWaitNode(pGraphNode, graph, pDependencies, numDependencies, nodeParams) + + +cdef cudaError_t cudaGraphExternalSemaphoresWaitNodeGetParams(cudaGraphNode_t hNode, cudaExternalSemaphoreWaitNodeParams* params_out) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphExternalSemaphoresWaitNodeGetParams(hNode, params_out) + + +cdef cudaError_t cudaGraphExternalSemaphoresWaitNodeSetParams(cudaGraphNode_t hNode, const cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphExternalSemaphoresWaitNodeSetParams(hNode, nodeParams) + + +cdef cudaError_t cudaGraphAddMemAllocNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaMemAllocNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphAddMemAllocNode(pGraphNode, graph, pDependencies, numDependencies, nodeParams) + + +cdef cudaError_t cudaGraphMemAllocNodeGetParams(cudaGraphNode_t node, cudaMemAllocNodeParams* params_out) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphMemAllocNodeGetParams(node, params_out) + + +cdef cudaError_t cudaGraphAddMemFreeNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, void* dptr) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphAddMemFreeNode(pGraphNode, graph, pDependencies, numDependencies, dptr) + + +cdef cudaError_t cudaGraphMemFreeNodeGetParams(cudaGraphNode_t node, void* dptr_out) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphMemFreeNodeGetParams(node, dptr_out) + + +cdef cudaError_t cudaDeviceGraphMemTrim(int device) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaDeviceGraphMemTrim(device) + + +cdef cudaError_t cudaDeviceGetGraphMemAttribute(int device, cudaGraphMemAttributeType attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaDeviceGetGraphMemAttribute(device, attr, value) + + +cdef cudaError_t cudaDeviceSetGraphMemAttribute(int device, cudaGraphMemAttributeType attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaDeviceSetGraphMemAttribute(device, attr, value) + + +cdef cudaError_t cudaGraphClone(cudaGraph_t* pGraphClone, cudaGraph_t originalGraph) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphClone(pGraphClone, originalGraph) + + +cdef cudaError_t cudaGraphNodeFindInClone(cudaGraphNode_t* pNode, cudaGraphNode_t originalNode, cudaGraph_t clonedGraph) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphNodeFindInClone(pNode, originalNode, clonedGraph) + + +cdef cudaError_t cudaGraphNodeGetType(cudaGraphNode_t node, cudaGraphNodeType* pType) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphNodeGetType(node, pType) + + +cdef cudaError_t cudaGraphGetNodes(cudaGraph_t graph, cudaGraphNode_t* nodes, size_t* numNodes) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphGetNodes(graph, nodes, numNodes) + + +cdef cudaError_t cudaGraphGetRootNodes(cudaGraph_t graph, cudaGraphNode_t* pRootNodes, size_t* pNumRootNodes) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphGetRootNodes(graph, pRootNodes, pNumRootNodes) + + +cdef cudaError_t cudaGraphGetEdges(cudaGraph_t graph, cudaGraphNode_t* from_, cudaGraphNode_t* to, cudaGraphEdgeData* edgeData, size_t* numEdges) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphGetEdges(graph, from_, to, edgeData, numEdges) + + +cdef cudaError_t cudaGraphNodeGetDependencies(cudaGraphNode_t node, cudaGraphNode_t* pDependencies, cudaGraphEdgeData* edgeData, size_t* pNumDependencies) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphNodeGetDependencies(node, pDependencies, edgeData, pNumDependencies) + + +cdef cudaError_t cudaGraphNodeGetDependentNodes(cudaGraphNode_t node, cudaGraphNode_t* pDependentNodes, cudaGraphEdgeData* edgeData, size_t* pNumDependentNodes) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphNodeGetDependentNodes(node, pDependentNodes, edgeData, pNumDependentNodes) + + +cdef cudaError_t cudaGraphAddDependencies(cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, const cudaGraphEdgeData* edgeData, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphAddDependencies(graph, from_, to, edgeData, numDependencies) + + +cdef cudaError_t cudaGraphRemoveDependencies(cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, const cudaGraphEdgeData* edgeData, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphRemoveDependencies(graph, from_, to, edgeData, numDependencies) + + +cdef cudaError_t cudaGraphDestroyNode(cudaGraphNode_t node) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphDestroyNode(node) + + +cdef cudaError_t cudaGraphInstantiate(cudaGraphExec_t* pGraphExec, cudaGraph_t graph, unsigned long long flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphInstantiate(pGraphExec, graph, flags) + + +cdef cudaError_t cudaGraphInstantiateWithFlags(cudaGraphExec_t* pGraphExec, cudaGraph_t graph, unsigned long long flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphInstantiateWithFlags(pGraphExec, graph, flags) + + +cdef cudaError_t cudaGraphInstantiateWithParams(cudaGraphExec_t* pGraphExec, cudaGraph_t graph, cudaGraphInstantiateParams* instantiateParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphInstantiateWithParams(pGraphExec, graph, instantiateParams) + + +cdef cudaError_t cudaGraphExecGetFlags(cudaGraphExec_t graphExec, unsigned long long* flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphExecGetFlags(graphExec, flags) + + +cdef cudaError_t cudaGraphExecKernelNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphExecKernelNodeSetParams(hGraphExec, node, pNodeParams) + + +cdef cudaError_t cudaGraphExecMemcpyNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaMemcpy3DParms* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphExecMemcpyNodeSetParams(hGraphExec, node, pNodeParams) + + +cdef cudaError_t cudaGraphExecMemcpyNodeSetParams1D(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphExecMemcpyNodeSetParams1D(hGraphExec, node, dst, src, count, kind) + + +cdef cudaError_t cudaGraphExecMemsetNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaMemsetParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphExecMemsetNodeSetParams(hGraphExec, node, pNodeParams) + + +cdef cudaError_t cudaGraphExecHostNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphExecHostNodeSetParams(hGraphExec, node, pNodeParams) + + +cdef cudaError_t cudaGraphExecChildGraphNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, cudaGraph_t childGraph) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphExecChildGraphNodeSetParams(hGraphExec, node, childGraph) + + +cdef cudaError_t cudaGraphExecEventRecordNodeSetEvent(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphExecEventRecordNodeSetEvent(hGraphExec, hNode, event) + + +cdef cudaError_t cudaGraphExecEventWaitNodeSetEvent(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphExecEventWaitNodeSetEvent(hGraphExec, hNode, event) + + +cdef cudaError_t cudaGraphExecExternalSemaphoresSignalNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, const cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphExecExternalSemaphoresSignalNodeSetParams(hGraphExec, hNode, nodeParams) + + +cdef cudaError_t cudaGraphExecExternalSemaphoresWaitNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, const cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphExecExternalSemaphoresWaitNodeSetParams(hGraphExec, hNode, nodeParams) + + +cdef cudaError_t cudaGraphNodeSetEnabled(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, unsigned int isEnabled) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphNodeSetEnabled(hGraphExec, hNode, isEnabled) + + +cdef cudaError_t cudaGraphNodeGetEnabled(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, unsigned int* isEnabled) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphNodeGetEnabled(hGraphExec, hNode, isEnabled) + + +cdef cudaError_t cudaGraphExecUpdate(cudaGraphExec_t hGraphExec, cudaGraph_t hGraph, cudaGraphExecUpdateResultInfo* resultInfo) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphExecUpdate(hGraphExec, hGraph, resultInfo) + + +cdef cudaError_t cudaGraphUpload(cudaGraphExec_t graphExec, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphUpload(graphExec, stream) + + +cdef cudaError_t cudaGraphLaunch(cudaGraphExec_t graphExec, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphLaunch(graphExec, stream) + + +cdef cudaError_t cudaGraphExecDestroy(cudaGraphExec_t graphExec) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphExecDestroy(graphExec) + + +cdef cudaError_t cudaGraphDestroy(cudaGraph_t graph) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphDestroy(graph) + + +cdef cudaError_t cudaGraphDebugDotPrint(cudaGraph_t graph, const char* path, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphDebugDotPrint(graph, path, flags) + + +cdef cudaError_t cudaUserObjectCreate(cudaUserObject_t* object_out, void* ptr, cudaHostFn_t destroy, unsigned int initialRefcount, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaUserObjectCreate(object_out, ptr, destroy, initialRefcount, flags) + + +cdef cudaError_t cudaUserObjectRetain(cudaUserObject_t object, unsigned int count) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaUserObjectRetain(object, count) + + +cdef cudaError_t cudaUserObjectRelease(cudaUserObject_t object, unsigned int count) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaUserObjectRelease(object, count) + + +cdef cudaError_t cudaGraphRetainUserObject(cudaGraph_t graph, cudaUserObject_t object, unsigned int count, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphRetainUserObject(graph, object, count, flags) + + +cdef cudaError_t cudaGraphReleaseUserObject(cudaGraph_t graph, cudaUserObject_t object, unsigned int count) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphReleaseUserObject(graph, object, count) + + +cdef cudaError_t cudaGraphAddNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphAddNode(pGraphNode, graph, pDependencies, dependencyData, numDependencies, nodeParams) + + +cdef cudaError_t cudaGraphNodeSetParams(cudaGraphNode_t node, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphNodeSetParams(node, nodeParams) + + +cdef cudaError_t cudaGraphExecNodeSetParams(cudaGraphExec_t graphExec, cudaGraphNode_t node, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphExecNodeSetParams(graphExec, node, nodeParams) + + +cdef cudaError_t cudaGraphConditionalHandleCreate(cudaGraphConditionalHandle* pHandle_out, cudaGraph_t graph, unsigned int defaultLaunchValue, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphConditionalHandleCreate(pHandle_out, graph, defaultLaunchValue, flags) + + +cdef cudaError_t cudaGetDriverEntryPoint(const char* symbol, void** funcPtr, unsigned long long flags, cudaDriverEntryPointQueryResult* driverStatus) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGetDriverEntryPoint(symbol, funcPtr, flags, driverStatus) + + +cdef cudaError_t cudaGetDriverEntryPointByVersion(const char* symbol, void** funcPtr, unsigned int cudaVersion, unsigned long long flags, cudaDriverEntryPointQueryResult* driverStatus) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGetDriverEntryPointByVersion(symbol, funcPtr, cudaVersion, flags, driverStatus) + + +cdef cudaError_t cudaLibraryLoadData(cudaLibrary_t* library, const void* code, cudaJitOption* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, cudaLibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaLibraryLoadData(library, code, jitOptions, jitOptionsValues, numJitOptions, libraryOptions, libraryOptionValues, numLibraryOptions) + + +cdef cudaError_t cudaLibraryLoadFromFile(cudaLibrary_t* library, const char* fileName, cudaJitOption* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, cudaLibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaLibraryLoadFromFile(library, fileName, jitOptions, jitOptionsValues, numJitOptions, libraryOptions, libraryOptionValues, numLibraryOptions) + + +cdef cudaError_t cudaLibraryUnload(cudaLibrary_t library) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaLibraryUnload(library) + + +cdef cudaError_t cudaLibraryGetKernel(cudaKernel_t* pKernel, cudaLibrary_t library, const char* name) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaLibraryGetKernel(pKernel, library, name) + + +cdef cudaError_t cudaLibraryGetGlobal(void** dptr, size_t* bytes, cudaLibrary_t library, const char* name) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaLibraryGetGlobal(dptr, bytes, library, name) + + +cdef cudaError_t cudaLibraryGetManaged(void** dptr, size_t* bytes, cudaLibrary_t library, const char* name) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaLibraryGetManaged(dptr, bytes, library, name) + + +cdef cudaError_t cudaLibraryGetUnifiedFunction(void** fptr, cudaLibrary_t library, const char* symbol) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaLibraryGetUnifiedFunction(fptr, library, symbol) + + +cdef cudaError_t cudaLibraryGetKernelCount(unsigned int* count, cudaLibrary_t lib) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaLibraryGetKernelCount(count, lib) + + +cdef cudaError_t cudaLibraryEnumerateKernels(cudaKernel_t* kernels, unsigned int numKernels, cudaLibrary_t lib) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaLibraryEnumerateKernels(kernels, numKernels, lib) + + +cdef cudaError_t cudaKernelSetAttributeForDevice(cudaKernel_t kernel, cudaFuncAttribute attr, int value, int device) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaKernelSetAttributeForDevice(kernel, attr, value, device) + + +cdef cudaError_t cudaGetExportTable(const void** ppExportTable, const cudaUUID_t* pExportTableId) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGetExportTable(ppExportTable, pExportTableId) + + +cdef cudaError_t cudaGetKernel(cudaKernel_t* kernelPtr, const void* entryFuncAddr) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGetKernel(kernelPtr, entryFuncAddr) + + +cdef cudaError_t cudaGraphicsEGLRegisterImage(cudaGraphicsResource** pCudaResource, EGLImageKHR image, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphicsEGLRegisterImage(pCudaResource, image, flags) + + +cdef cudaError_t cudaEGLStreamConsumerConnect(cudaEglStreamConnection* conn, EGLStreamKHR eglStream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaEGLStreamConsumerConnect(conn, eglStream) + + +cdef cudaError_t cudaEGLStreamConsumerConnectWithFlags(cudaEglStreamConnection* conn, EGLStreamKHR eglStream, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaEGLStreamConsumerConnectWithFlags(conn, eglStream, flags) + + +cdef cudaError_t cudaEGLStreamConsumerDisconnect(cudaEglStreamConnection* conn) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaEGLStreamConsumerDisconnect(conn) + + +cdef cudaError_t cudaEGLStreamConsumerAcquireFrame(cudaEglStreamConnection* conn, cudaGraphicsResource_t* pCudaResource, cudaStream_t* pStream, unsigned int timeout) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaEGLStreamConsumerAcquireFrame(conn, pCudaResource, pStream, timeout) + + +cdef cudaError_t cudaEGLStreamConsumerReleaseFrame(cudaEglStreamConnection* conn, cudaGraphicsResource_t pCudaResource, cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaEGLStreamConsumerReleaseFrame(conn, pCudaResource, pStream) + + +cdef cudaError_t cudaEGLStreamProducerConnect(cudaEglStreamConnection* conn, EGLStreamKHR eglStream, EGLint width, EGLint height) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaEGLStreamProducerConnect(conn, eglStream, width, height) + + +cdef cudaError_t cudaEGLStreamProducerDisconnect(cudaEglStreamConnection* conn) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaEGLStreamProducerDisconnect(conn) + + +cdef cudaError_t cudaEGLStreamProducerPresentFrame(cudaEglStreamConnection* conn, cudaEglFrame eglframe, cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaEGLStreamProducerPresentFrame(conn, eglframe, pStream) + + +cdef cudaError_t cudaEGLStreamProducerReturnFrame(cudaEglStreamConnection* conn, cudaEglFrame* eglframe, cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaEGLStreamProducerReturnFrame(conn, eglframe, pStream) + + +cdef cudaError_t cudaGraphicsResourceGetMappedEglFrame(cudaEglFrame* eglFrame, cudaGraphicsResource_t resource, unsigned int index, unsigned int mipLevel) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphicsResourceGetMappedEglFrame(eglFrame, resource, index, mipLevel) + + +cdef cudaError_t cudaEventCreateFromEGLSync(cudaEvent_t* phEvent, EGLSyncKHR eglSync, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaEventCreateFromEGLSync(phEvent, eglSync, flags) + + +cdef cudaError_t cudaProfilerStart() except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaProfilerStart() + + +cdef cudaError_t cudaProfilerStop() except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaProfilerStop() + + +cdef cudaError_t cudaGLGetDevices(unsigned int* pCudaDeviceCount, int* pCudaDevices, unsigned int cudaDeviceCount, cudaGLDeviceList deviceList) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGLGetDevices(pCudaDeviceCount, pCudaDevices, cudaDeviceCount, deviceList) + + +cdef cudaError_t cudaGraphicsGLRegisterImage(cudaGraphicsResource** resource, GLuint image, GLenum target, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphicsGLRegisterImage(resource, image, target, flags) + + +cdef cudaError_t cudaGraphicsGLRegisterBuffer(cudaGraphicsResource** resource, GLuint buffer, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphicsGLRegisterBuffer(resource, buffer, flags) + + +cdef cudaError_t cudaVDPAUGetDevice(int* device, VdpDevice vdpDevice, VdpGetProcAddress* vdpGetProcAddress) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaVDPAUGetDevice(device, vdpDevice, vdpGetProcAddress) + + +cdef cudaError_t cudaVDPAUSetVDPAUDevice(int device, VdpDevice vdpDevice, VdpGetProcAddress* vdpGetProcAddress) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaVDPAUSetVDPAUDevice(device, vdpDevice, vdpGetProcAddress) + + +cdef cudaError_t cudaGraphicsVDPAURegisterVideoSurface(cudaGraphicsResource** resource, VdpVideoSurface vdpSurface, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphicsVDPAURegisterVideoSurface(resource, vdpSurface, flags) + + +cdef cudaError_t cudaGraphicsVDPAURegisterOutputSurface(cudaGraphicsResource** resource, VdpOutputSurface vdpSurface, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphicsVDPAURegisterOutputSurface(resource, vdpSurface, flags) + + +cdef cudaError_t cudaGetDeviceProperties(cudaDeviceProp* prop, int device) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGetDeviceProperties(prop, device) + + +cdef cudaError_t cudaDeviceGetHostAtomicCapabilities(unsigned int* capabilities, const cudaAtomicOperation* operations, unsigned int count, int device) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaDeviceGetHostAtomicCapabilities(capabilities, operations, count, device) + + +cdef cudaError_t cudaDeviceGetP2PAtomicCapabilities(unsigned int* capabilities, const cudaAtomicOperation* operations, unsigned int count, int srcDevice, int dstDevice) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaDeviceGetP2PAtomicCapabilities(capabilities, operations, count, srcDevice, dstDevice) + + +cdef cudaError_t cudaStreamGetCaptureInfo(cudaStream_t stream, cudaStreamCaptureStatus* captureStatus_out, unsigned long long* id_out, cudaGraph_t* graph_out, const cudaGraphNode_t** dependencies_out, const cudaGraphEdgeData** edgeData_out, size_t* numDependencies_out) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaStreamGetCaptureInfo(stream, captureStatus_out, id_out, graph_out, dependencies_out, edgeData_out, numDependencies_out) + + +cdef cudaError_t cudaSignalExternalSemaphoresAsync(const cudaExternalSemaphore_t* extSemArray, const cudaExternalSemaphoreSignalParams* paramsArray, unsigned int numExtSems, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaSignalExternalSemaphoresAsync(extSemArray, paramsArray, numExtSems, stream) + + +cdef cudaError_t cudaWaitExternalSemaphoresAsync(const cudaExternalSemaphore_t* extSemArray, const cudaExternalSemaphoreWaitParams* paramsArray, unsigned int numExtSems, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaWaitExternalSemaphoresAsync(extSemArray, paramsArray, numExtSems, stream) + + +cdef cudaError_t cudaMemPrefetchBatchAsync(void** dptrs, size_t* sizes, size_t count, cudaMemLocation* prefetchLocs, size_t* prefetchLocIdxs, size_t numPrefetchLocs, unsigned long long flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMemPrefetchBatchAsync(dptrs, sizes, count, prefetchLocs, prefetchLocIdxs, numPrefetchLocs, flags, stream) + + +cdef cudaError_t cudaMemDiscardBatchAsync(void** dptrs, size_t* sizes, size_t count, unsigned long long flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMemDiscardBatchAsync(dptrs, sizes, count, flags, stream) + + +cdef cudaError_t cudaMemDiscardAndPrefetchBatchAsync(void** dptrs, size_t* sizes, size_t count, cudaMemLocation* prefetchLocs, size_t* prefetchLocIdxs, size_t numPrefetchLocs, unsigned long long flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMemDiscardAndPrefetchBatchAsync(dptrs, sizes, count, prefetchLocs, prefetchLocIdxs, numPrefetchLocs, flags, stream) + + +cdef cudaError_t cudaMemGetDefaultMemPool(cudaMemPool_t* memPool, cudaMemLocation* location, cudaMemAllocationType type) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMemGetDefaultMemPool(memPool, location, type) + + +cdef cudaError_t cudaMemGetMemPool(cudaMemPool_t* memPool, cudaMemLocation* location, cudaMemAllocationType type) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMemGetMemPool(memPool, location, type) + + +cdef cudaError_t cudaMemSetMemPool(cudaMemLocation* location, cudaMemAllocationType type, cudaMemPool_t memPool) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMemSetMemPool(location, type, memPool) + + +cdef cudaError_t cudaLogsRegisterCallback(cudaLogsCallback_t callbackFunc, void* userData, cudaLogsCallbackHandle* callback_out) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaLogsRegisterCallback(callbackFunc, userData, callback_out) + + +cdef cudaError_t cudaLogsUnregisterCallback(cudaLogsCallbackHandle callback) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaLogsUnregisterCallback(callback) + + +cdef cudaError_t cudaLogsCurrent(cudaLogIterator* iterator_out, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaLogsCurrent(iterator_out, flags) + + +cdef cudaError_t cudaLogsDumpToFile(cudaLogIterator* iterator, const char* pathToFile, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaLogsDumpToFile(iterator, pathToFile, flags) + + +cdef cudaError_t cudaLogsDumpToMemory(cudaLogIterator* iterator, char* buffer, size_t* size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaLogsDumpToMemory(iterator, buffer, size, flags) + + +cdef cudaError_t cudaGraphNodeGetContainingGraph(cudaGraphNode_t hNode, cudaGraph_t* phGraph) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphNodeGetContainingGraph(hNode, phGraph) + + +cdef cudaError_t cudaGraphNodeGetLocalId(cudaGraphNode_t hNode, unsigned int* nodeId) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphNodeGetLocalId(hNode, nodeId) + + +cdef cudaError_t cudaGraphNodeGetToolsId(cudaGraphNode_t hNode, unsigned long long* toolsNodeId) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphNodeGetToolsId(hNode, toolsNodeId) + + +cdef cudaError_t cudaGraphGetId(cudaGraph_t hGraph, unsigned int* graphID) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphGetId(hGraph, graphID) + + +cdef cudaError_t cudaGraphExecGetId(cudaGraphExec_t hGraphExec, unsigned int* graphID) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphExecGetId(hGraphExec, graphID) + + +cdef cudaError_t cudaGraphConditionalHandleCreate_v2(cudaGraphConditionalHandle* pHandle_out, cudaGraph_t graph, cudaExecutionContext_t ctx, unsigned int defaultLaunchValue, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphConditionalHandleCreate_v2(pHandle_out, graph, ctx, defaultLaunchValue, flags) + + +cdef cudaError_t cudaDeviceGetDevResource(int device, cudaDevResource* resource, cudaDevResourceType type) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaDeviceGetDevResource(device, resource, type) + + +cdef cudaError_t cudaDevSmResourceSplitByCount(cudaDevResource* result, unsigned int* nbGroups, const cudaDevResource* input, cudaDevResource* remaining, unsigned int flags, unsigned int minCount) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaDevSmResourceSplitByCount(result, nbGroups, input, remaining, flags, minCount) + + +cdef cudaError_t cudaDevSmResourceSplit(cudaDevResource* result, unsigned int nbGroups, const cudaDevResource* input, cudaDevResource* remainder, unsigned int flags, cudaDevSmResourceGroupParams* groupParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaDevSmResourceSplit(result, nbGroups, input, remainder, flags, groupParams) + + +cdef cudaError_t cudaDevResourceGenerateDesc(cudaDevResourceDesc_t* phDesc, cudaDevResource* resources, unsigned int nbResources) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaDevResourceGenerateDesc(phDesc, resources, nbResources) + + +cdef cudaError_t cudaGreenCtxCreate(cudaExecutionContext_t* phCtx, cudaDevResourceDesc_t desc, int device, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGreenCtxCreate(phCtx, desc, device, flags) + + +cdef cudaError_t cudaExecutionCtxDestroy(cudaExecutionContext_t ctx) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaExecutionCtxDestroy(ctx) + + +cdef cudaError_t cudaExecutionCtxGetDevResource(cudaExecutionContext_t ctx, cudaDevResource* resource, cudaDevResourceType type) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaExecutionCtxGetDevResource(ctx, resource, type) + + +cdef cudaError_t cudaExecutionCtxGetDevice(int* device, cudaExecutionContext_t ctx) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaExecutionCtxGetDevice(device, ctx) + + +cdef cudaError_t cudaExecutionCtxGetId(cudaExecutionContext_t ctx, unsigned long long* ctxId) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaExecutionCtxGetId(ctx, ctxId) + + +cdef cudaError_t cudaExecutionCtxStreamCreate(cudaStream_t* phStream, cudaExecutionContext_t ctx, unsigned int flags, int priority) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaExecutionCtxStreamCreate(phStream, ctx, flags, priority) + + +cdef cudaError_t cudaExecutionCtxSynchronize(cudaExecutionContext_t ctx) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaExecutionCtxSynchronize(ctx) + + +cdef cudaError_t cudaStreamGetDevResource(cudaStream_t hStream, cudaDevResource* resource, cudaDevResourceType type) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaStreamGetDevResource(hStream, resource, type) + + +cdef cudaError_t cudaExecutionCtxRecordEvent(cudaExecutionContext_t ctx, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaExecutionCtxRecordEvent(ctx, event) + + +cdef cudaError_t cudaExecutionCtxWaitEvent(cudaExecutionContext_t ctx, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaExecutionCtxWaitEvent(ctx, event) + + +cdef cudaError_t cudaDeviceGetExecutionCtx(cudaExecutionContext_t* ctx, int device) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaDeviceGetExecutionCtx(ctx, device) + + +cdef cudaError_t cudaFuncGetParamCount(const void* func, size_t* paramCount) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaFuncGetParamCount(func, paramCount) + + +cdef cudaError_t cudaLaunchHostFunc_v2(cudaStream_t stream, cudaHostFn_t fn, void* userData, unsigned int syncMode) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaLaunchHostFunc_v2(stream, fn, userData, syncMode) + + +cdef cudaError_t cudaMemcpyWithAttributesAsync(void* dst, const void* src, size_t size, cudaMemcpyAttributes* attr, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMemcpyWithAttributesAsync(dst, src, size, attr, stream) + + +cdef cudaError_t cudaMemcpy3DWithAttributesAsync(cudaMemcpy3DBatchOp* op, unsigned long long flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaMemcpy3DWithAttributesAsync(op, flags, stream) + + +cdef cudaError_t cudaGraphNodeGetParams(cudaGraphNode_t node, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaGraphNodeGetParams(node, nodeParams) + + +cdef cudaError_t cudaStreamBeginRecaptureToGraph(cudaStream_t stream, cudaStreamCaptureMode mode, cudaGraph_t graph, cudaGraphRecaptureCallbackData* callbackData) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._cudaStreamBeginRecaptureToGraph(stream, mode, graph, callbackData) + + +############################################################################### +# Static inline helpers from driver_functions.h +############################################################################### + +cdef extern from 'driver_functions.h': + cudaPitchedPtr _c_make_cudaPitchedPtr "make_cudaPitchedPtr"(void* d, size_t p, size_t xsz, size_t ysz) nogil + cudaPos _c_make_cudaPos "make_cudaPos"(size_t x, size_t y, size_t z) nogil + cudaExtent _c_make_cudaExtent "make_cudaExtent"(size_t w, size_t h, size_t d) nogil + + +cdef cudaPitchedPtr make_cudaPitchedPtr(void* d, size_t p, size_t xsz, size_t ysz) except* nogil: + return _c_make_cudaPitchedPtr(d, p, xsz, ysz) + + +cdef cudaPos make_cudaPos(size_t x, size_t y, size_t z) except* nogil: + return _c_make_cudaPos(x, y, z) + + +cdef cudaExtent make_cudaExtent(size_t w, size_t h, size_t d) except* nogil: + return _c_make_cudaExtent(w, h, d) + + +############################################################################### +# getLocalRuntimeVersion +############################################################################### + +cdef cudaError_t getLocalRuntimeVersion(int* runtimeVersion) except ?cudaErrorCallRequiresNewerDriver nogil: + return _runtime._getLocalRuntimeVersion(runtimeVersion) diff --git a/cuda/cuda.pxd.in b/cuda_bindings/cuda/bindings/driver.pxd similarity index 66% rename from cuda/cuda.pxd.in rename to cuda_bindings/cuda/bindings/driver.pxd index bf7010408df..9f4d912a3c4 100644 --- a/cuda/cuda.pxd.in +++ b/cuda_bindings/cuda/bindings/driver.pxd @@ -1,14 +1,11 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. -# -# Please refer to the NVIDIA end user license agreement (EULA) associated -# with this source code for terms and conditions that govern your use of -# this software. Any use, reproduction, disclosure, or distribution of -# this software and related documentation outside the terms of the EULA -# is strictly prohibited. -cimport cuda.ccuda as ccuda -cimport cuda._lib.utils as utils - -{{if 'CUcontext' in found_types}} +# SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +# This code was automatically generated with version 13.3.0. Do not modify it directly. +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=f4b08b7f4b26966f9f462562819700500a100748c5b34ab47de79836e6bec3f2 +cimport cuda.bindings.cydriver as cydriver + +include "_lib/utils.pxd" cdef class CUcontext: """ @@ -21,11 +18,8 @@ cdef class CUcontext: Get memory address of class instance """ - cdef ccuda.CUcontext __val - cdef ccuda.CUcontext* _ptr -{{endif}} - -{{if 'CUmodule' in found_types}} + cdef cydriver.CUcontext _pvt_val + cdef cydriver.CUcontext* _pvt_ptr cdef class CUmodule: """ @@ -38,11 +32,8 @@ cdef class CUmodule: Get memory address of class instance """ - cdef ccuda.CUmodule __val - cdef ccuda.CUmodule* _ptr -{{endif}} - -{{if 'CUfunction' in found_types}} + cdef cydriver.CUmodule _pvt_val + cdef cydriver.CUmodule* _pvt_ptr cdef class CUfunction: """ @@ -55,11 +46,8 @@ cdef class CUfunction: Get memory address of class instance """ - cdef ccuda.CUfunction __val - cdef ccuda.CUfunction* _ptr -{{endif}} - -{{if 'CUlibrary' in found_types}} + cdef cydriver.CUfunction _pvt_val + cdef cydriver.CUfunction* _pvt_ptr cdef class CUlibrary: """ @@ -72,11 +60,8 @@ cdef class CUlibrary: Get memory address of class instance """ - cdef ccuda.CUlibrary __val - cdef ccuda.CUlibrary* _ptr -{{endif}} - -{{if 'CUkernel' in found_types}} + cdef cydriver.CUlibrary _pvt_val + cdef cydriver.CUlibrary* _pvt_ptr cdef class CUkernel: """ @@ -89,11 +74,8 @@ cdef class CUkernel: Get memory address of class instance """ - cdef ccuda.CUkernel __val - cdef ccuda.CUkernel* _ptr -{{endif}} - -{{if 'CUarray' in found_types}} + cdef cydriver.CUkernel _pvt_val + cdef cydriver.CUkernel* _pvt_ptr cdef class CUarray: """ @@ -106,11 +88,8 @@ cdef class CUarray: Get memory address of class instance """ - cdef ccuda.CUarray __val - cdef ccuda.CUarray* _ptr -{{endif}} - -{{if 'CUmipmappedArray' in found_types}} + cdef cydriver.CUarray _pvt_val + cdef cydriver.CUarray* _pvt_ptr cdef class CUmipmappedArray: """ @@ -123,11 +102,8 @@ cdef class CUmipmappedArray: Get memory address of class instance """ - cdef ccuda.CUmipmappedArray __val - cdef ccuda.CUmipmappedArray* _ptr -{{endif}} - -{{if 'CUtexref' in found_types}} + cdef cydriver.CUmipmappedArray _pvt_val + cdef cydriver.CUmipmappedArray* _pvt_ptr cdef class CUtexref: """ @@ -140,11 +116,8 @@ cdef class CUtexref: Get memory address of class instance """ - cdef ccuda.CUtexref __val - cdef ccuda.CUtexref* _ptr -{{endif}} - -{{if 'CUsurfref' in found_types}} + cdef cydriver.CUtexref _pvt_val + cdef cydriver.CUtexref* _pvt_ptr cdef class CUsurfref: """ @@ -157,11 +130,8 @@ cdef class CUsurfref: Get memory address of class instance """ - cdef ccuda.CUsurfref __val - cdef ccuda.CUsurfref* _ptr -{{endif}} - -{{if 'CUevent' in found_types}} + cdef cydriver.CUsurfref _pvt_val + cdef cydriver.CUsurfref* _pvt_ptr cdef class CUevent: """ @@ -174,11 +144,8 @@ cdef class CUevent: Get memory address of class instance """ - cdef ccuda.CUevent __val - cdef ccuda.CUevent* _ptr -{{endif}} - -{{if 'CUstream' in found_types}} + cdef cydriver.CUevent _pvt_val + cdef cydriver.CUevent* _pvt_ptr cdef class CUstream: """ @@ -191,11 +158,8 @@ cdef class CUstream: Get memory address of class instance """ - cdef ccuda.CUstream __val - cdef ccuda.CUstream* _ptr -{{endif}} - -{{if 'CUgraphicsResource' in found_types}} + cdef cydriver.CUstream _pvt_val + cdef cydriver.CUstream* _pvt_ptr cdef class CUgraphicsResource: """ @@ -208,11 +172,8 @@ cdef class CUgraphicsResource: Get memory address of class instance """ - cdef ccuda.CUgraphicsResource __val - cdef ccuda.CUgraphicsResource* _ptr -{{endif}} - -{{if 'CUexternalMemory' in found_types}} + cdef cydriver.CUgraphicsResource _pvt_val + cdef cydriver.CUgraphicsResource* _pvt_ptr cdef class CUexternalMemory: """ @@ -225,11 +186,8 @@ cdef class CUexternalMemory: Get memory address of class instance """ - cdef ccuda.CUexternalMemory __val - cdef ccuda.CUexternalMemory* _ptr -{{endif}} - -{{if 'CUexternalSemaphore' in found_types}} + cdef cydriver.CUexternalMemory _pvt_val + cdef cydriver.CUexternalMemory* _pvt_ptr cdef class CUexternalSemaphore: """ @@ -242,11 +200,8 @@ cdef class CUexternalSemaphore: Get memory address of class instance """ - cdef ccuda.CUexternalSemaphore __val - cdef ccuda.CUexternalSemaphore* _ptr -{{endif}} - -{{if 'CUgraph' in found_types}} + cdef cydriver.CUexternalSemaphore _pvt_val + cdef cydriver.CUexternalSemaphore* _pvt_ptr cdef class CUgraph: """ @@ -259,11 +214,8 @@ cdef class CUgraph: Get memory address of class instance """ - cdef ccuda.CUgraph __val - cdef ccuda.CUgraph* _ptr -{{endif}} - -{{if 'CUgraphNode' in found_types}} + cdef cydriver.CUgraph _pvt_val + cdef cydriver.CUgraph* _pvt_ptr cdef class CUgraphNode: """ @@ -276,11 +228,8 @@ cdef class CUgraphNode: Get memory address of class instance """ - cdef ccuda.CUgraphNode __val - cdef ccuda.CUgraphNode* _ptr -{{endif}} - -{{if 'CUgraphExec' in found_types}} + cdef cydriver.CUgraphNode _pvt_val + cdef cydriver.CUgraphNode* _pvt_ptr cdef class CUgraphExec: """ @@ -293,11 +242,8 @@ cdef class CUgraphExec: Get memory address of class instance """ - cdef ccuda.CUgraphExec __val - cdef ccuda.CUgraphExec* _ptr -{{endif}} - -{{if 'CUmemoryPool' in found_types}} + cdef cydriver.CUgraphExec _pvt_val + cdef cydriver.CUgraphExec* _pvt_ptr cdef class CUmemoryPool: """ @@ -310,11 +256,8 @@ cdef class CUmemoryPool: Get memory address of class instance """ - cdef ccuda.CUmemoryPool __val - cdef ccuda.CUmemoryPool* _ptr -{{endif}} - -{{if 'CUuserObject' in found_types}} + cdef cydriver.CUmemoryPool _pvt_val + cdef cydriver.CUmemoryPool* _pvt_ptr cdef class CUuserObject: """ @@ -327,11 +270,8 @@ cdef class CUuserObject: Get memory address of class instance """ - cdef ccuda.CUuserObject __val - cdef ccuda.CUuserObject* _ptr -{{endif}} - -{{if 'CUgraphDeviceNode' in found_types}} + cdef cydriver.CUuserObject _pvt_val + cdef cydriver.CUuserObject* _pvt_ptr cdef class CUgraphDeviceNode: """ @@ -344,11 +284,8 @@ cdef class CUgraphDeviceNode: Get memory address of class instance """ - cdef ccuda.CUgraphDeviceNode __val - cdef ccuda.CUgraphDeviceNode* _ptr -{{endif}} - -{{if 'CUasyncCallbackHandle' in found_types}} + cdef cydriver.CUgraphDeviceNode _pvt_val + cdef cydriver.CUgraphDeviceNode* _pvt_ptr cdef class CUasyncCallbackHandle: """ @@ -361,11 +298,8 @@ cdef class CUasyncCallbackHandle: Get memory address of class instance """ - cdef ccuda.CUasyncCallbackHandle __val - cdef ccuda.CUasyncCallbackHandle* _ptr -{{endif}} - -{{if 'CUgreenCtx' in found_types}} + cdef cydriver.CUasyncCallbackHandle _pvt_val + cdef cydriver.CUasyncCallbackHandle* _pvt_ptr cdef class CUgreenCtx: """ @@ -378,11 +312,8 @@ cdef class CUgreenCtx: Get memory address of class instance """ - cdef ccuda.CUgreenCtx __val - cdef ccuda.CUgreenCtx* _ptr -{{endif}} - -{{if 'CUlinkState' in found_types}} + cdef cydriver.CUgreenCtx _pvt_val + cdef cydriver.CUgreenCtx* _pvt_ptr cdef class CUlinkState: """ @@ -393,12 +324,23 @@ cdef class CUlinkState: Get memory address of class instance """ - cdef ccuda.CUlinkState __val - cdef ccuda.CUlinkState* _ptr + cdef cydriver.CUlinkState _pvt_val + cdef cydriver.CUlinkState* _pvt_ptr cdef list _keepalive -{{endif}} -{{if 'CUdevResourceDesc' in found_types}} +cdef class CUcoredumpCallbackHandle: + """ Opaque handle representing a registered coredump status callback. + + This handle is returned when registering a callback and must be provided when deregistering the callback. + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + cdef cydriver.CUcoredumpCallbackHandle _pvt_val + cdef cydriver.CUcoredumpCallbackHandle* _pvt_ptr cdef class CUdevResourceDesc: """ @@ -411,11 +353,20 @@ cdef class CUdevResourceDesc: Get memory address of class instance """ - cdef ccuda.CUdevResourceDesc __val - cdef ccuda.CUdevResourceDesc* _ptr -{{endif}} + cdef cydriver.CUdevResourceDesc _pvt_val + cdef cydriver.CUdevResourceDesc* _pvt_ptr -{{if True}} +cdef class CUlogsCallbackHandle: + """ + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + cdef cydriver.CUlogsCallbackHandle _pvt_val + cdef cydriver.CUlogsCallbackHandle* _pvt_ptr cdef class CUeglStreamConnection: """ @@ -428,11 +379,8 @@ cdef class CUeglStreamConnection: Get memory address of class instance """ - cdef ccuda.CUeglStreamConnection __val - cdef ccuda.CUeglStreamConnection* _ptr -{{endif}} - -{{if True}} + cdef cydriver.CUeglStreamConnection _pvt_val + cdef cydriver.CUeglStreamConnection* _pvt_ptr cdef class EGLImageKHR: """ @@ -443,11 +391,8 @@ cdef class EGLImageKHR: Get memory address of class instance """ - cdef ccuda.EGLImageKHR __val - cdef ccuda.EGLImageKHR* _ptr -{{endif}} - -{{if True}} + cdef cydriver.EGLImageKHR _pvt_val + cdef cydriver.EGLImageKHR* _pvt_ptr cdef class EGLStreamKHR: """ @@ -458,11 +403,8 @@ cdef class EGLStreamKHR: Get memory address of class instance """ - cdef ccuda.EGLStreamKHR __val - cdef ccuda.EGLStreamKHR* _ptr -{{endif}} - -{{if True}} + cdef cydriver.EGLStreamKHR _pvt_val + cdef cydriver.EGLStreamKHR* _pvt_ptr cdef class EGLSyncKHR: """ @@ -473,11 +415,8 @@ cdef class EGLSyncKHR: Get memory address of class instance """ - cdef ccuda.EGLSyncKHR __val - cdef ccuda.EGLSyncKHR* _ptr -{{endif}} - -{{if 'CUasyncCallback' in found_types}} + cdef cydriver.EGLSyncKHR _pvt_val + cdef cydriver.EGLSyncKHR* _pvt_ptr cdef class CUasyncCallback: """ @@ -488,11 +427,8 @@ cdef class CUasyncCallback: Get memory address of class instance """ - cdef ccuda.CUasyncCallback __val - cdef ccuda.CUasyncCallback* _ptr -{{endif}} - -{{if 'CUhostFn' in found_types}} + cdef cydriver.CUasyncCallback _pvt_val + cdef cydriver.CUasyncCallback* _pvt_ptr cdef class CUhostFn: """ @@ -503,11 +439,8 @@ cdef class CUhostFn: Get memory address of class instance """ - cdef ccuda.CUhostFn __val - cdef ccuda.CUhostFn* _ptr -{{endif}} - -{{if 'CUstreamCallback' in found_types}} + cdef cydriver.CUhostFn _pvt_val + cdef cydriver.CUhostFn* _pvt_ptr cdef class CUstreamCallback: """ @@ -518,11 +451,8 @@ cdef class CUstreamCallback: Get memory address of class instance """ - cdef ccuda.CUstreamCallback __val - cdef ccuda.CUstreamCallback* _ptr -{{endif}} - -{{if 'CUoccupancyB2DSize' in found_types}} + cdef cydriver.CUstreamCallback _pvt_val + cdef cydriver.CUstreamCallback* _pvt_ptr cdef class CUoccupancyB2DSize: """ @@ -533,29 +463,61 @@ cdef class CUoccupancyB2DSize: Get memory address of class instance """ - cdef ccuda.CUoccupancyB2DSize __val - cdef ccuda.CUoccupancyB2DSize* _ptr -{{endif}} + cdef cydriver.CUoccupancyB2DSize _pvt_val + cdef cydriver.CUoccupancyB2DSize* _pvt_ptr + +cdef class CUgraphRecaptureCallback: + """ + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + cdef cydriver.CUgraphRecaptureCallback _pvt_val + cdef cydriver.CUgraphRecaptureCallback* _pvt_ptr + +cdef class CUcoredumpStatusCallback: + """ + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + cdef cydriver.CUcoredumpStatusCallback _pvt_val + cdef cydriver.CUcoredumpStatusCallback* _pvt_ptr + +cdef class CUlogsCallback: + """ + + Methods + ------- + getPtr() + Get memory address of class instance -{{if 'struct CUuuid_st' in found_types}} + """ + cdef cydriver.CUlogsCallback _pvt_val + cdef cydriver.CUlogsCallback* _pvt_ptr cdef class CUuuid_st: """ Attributes ---------- + bytes : bytes < CUDA definition of UUID + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUuuid_st __val - cdef ccuda.CUuuid_st* _ptr -{{endif}} -{{if 'struct CUmemFabricHandle_st' in found_types}} + cdef cydriver.CUuuid_st _pvt_val + cdef cydriver.CUuuid_st* _pvt_ptr cdef class CUmemFabricHandle_st: """ @@ -566,19 +528,18 @@ cdef class CUmemFabricHandle_st: Attributes ---------- + data : bytes + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUmemFabricHandle_st __val - cdef ccuda.CUmemFabricHandle_st* _ptr -{{endif}} -{{if 'struct CUipcEventHandle_st' in found_types}} + cdef cydriver.CUmemFabricHandle_st _pvt_val + cdef cydriver.CUmemFabricHandle_st* _pvt_ptr cdef class CUipcEventHandle_st: """ @@ -586,19 +547,18 @@ cdef class CUipcEventHandle_st: Attributes ---------- + reserved : bytes + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUipcEventHandle_st __val - cdef ccuda.CUipcEventHandle_st* _ptr -{{endif}} -{{if 'struct CUipcMemHandle_st' in found_types}} + cdef cydriver.CUipcEventHandle_st _pvt_val + cdef cydriver.CUipcEventHandle_st* _pvt_ptr cdef class CUipcMemHandle_st: """ @@ -606,119 +566,203 @@ cdef class CUipcMemHandle_st: Attributes ---------- + reserved : bytes + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUipcMemHandle_st __val - cdef ccuda.CUipcMemHandle_st* _ptr -{{endif}} -{{if 'union CUstreamBatchMemOpParams_union' in found_types}} + cdef cydriver.CUipcMemHandle_st _pvt_val + cdef cydriver.CUipcMemHandle_st* _pvt_ptr cdef class CUstreamMemOpWaitValueParams_st: """ Attributes ---------- + operation : CUstreamBatchMemOpType + + address : CUdeviceptr + + value : cuuint32_t + + value64 : cuuint64_t + + flags : unsigned int + See CUstreamWaitValue_flags. + alias : CUdeviceptr For driver internal use. Initial value is unimportant. + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUstreamBatchMemOpParams_union* _ptr + cdef cydriver.CUstreamBatchMemOpParams_union* _pvt_ptr + cdef CUdeviceptr _address + + cdef cuuint32_t _value + + cdef cuuint64_t _value64 + + cdef CUdeviceptr _alias -{{endif}} -{{if 'union CUstreamBatchMemOpParams_union' in found_types}} + cdef class CUstreamMemOpWriteValueParams_st: """ Attributes ---------- + operation : CUstreamBatchMemOpType + + address : CUdeviceptr + + value : cuuint32_t + + value64 : cuuint64_t + + flags : unsigned int + See CUstreamWriteValue_flags. + alias : CUdeviceptr For driver internal use. Initial value is unimportant. + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUstreamBatchMemOpParams_union* _ptr + cdef cydriver.CUstreamBatchMemOpParams_union* _pvt_ptr + cdef CUdeviceptr _address + + cdef cuuint32_t _value + + cdef cuuint64_t _value64 + + cdef CUdeviceptr _alias -{{endif}} -{{if 'union CUstreamBatchMemOpParams_union' in found_types}} + cdef class CUstreamMemOpFlushRemoteWritesParams_st: """ Attributes ---------- + operation : CUstreamBatchMemOpType + + flags : unsigned int + Must be 0. Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUstreamBatchMemOpParams_union* _ptr -{{endif}} -{{if 'union CUstreamBatchMemOpParams_union' in found_types}} + cdef cydriver.CUstreamBatchMemOpParams_union* _pvt_ptr cdef class CUstreamMemOpMemoryBarrierParams_st: """ Attributes ---------- + operation : CUstreamBatchMemOpType < Only supported in the _v2 API + + flags : unsigned int + See CUstreamMemoryBarrier_flags Methods ------- getPtr() Get memory address of class instance + """ + cdef cydriver.CUstreamBatchMemOpParams_union* _pvt_ptr + +cdef class CUstreamMemOpAtomicReductionParams_st: + """ + Attributes + ---------- + + operation : CUstreamBatchMemOpType + + + + flags : unsigned int + Must be 0 + + reductionOp : CUstreamAtomicReductionOpType + See CUstreamAtomicReductionOpType + + + dataType : CUstreamAtomicReductionDataType + See CUstreamAtomicReductionDataType + + + address : CUdeviceptr + The address the atomic operation will be operated on + + + value : cuuint64_t + The operand value the atomic operation will operate with + + + alias : CUdeviceptr + For driver internal use. Initial value is unimportant. + + + Methods + ------- + getPtr() + Get memory address of class instance """ - cdef ccuda.CUstreamBatchMemOpParams_union* _ptr -{{endif}} -{{if 'union CUstreamBatchMemOpParams_union' in found_types}} + cdef cydriver.CUstreamBatchMemOpParams_union* _pvt_ptr + + cdef CUdeviceptr _address + + + cdef cuuint64_t _value + + + cdef CUdeviceptr _alias + cdef class CUstreamBatchMemOpParams_union: """ @@ -726,61 +770,99 @@ cdef class CUstreamBatchMemOpParams_union: Attributes ---------- + operation : CUstreamBatchMemOpType + Operation. This is the first field of all the union elemets and + acts as a TAG to determine which union member is valid. + waitValue : CUstreamMemOpWaitValueParams_st + Params for CU_STREAM_MEM_OP_WAIT_VALUE_32 and + CU_STREAM_MEM_OP_WAIT_VALUE_64 operations. + writeValue : CUstreamMemOpWriteValueParams_st + Params for CU_STREAM_MEM_OP_WRITE_VALUE_32 and + CU_STREAM_MEM_OP_WRITE_VALUE_64 operations. + flushRemoteWrites : CUstreamMemOpFlushRemoteWritesParams_st + Params for CU_STREAM_MEM_OP_FLUSH_REMOTE_WRITES operations. + memoryBarrier : CUstreamMemOpMemoryBarrierParams_st + Params for CU_STREAM_MEM_OP_BARRIER operations. + + + atomicReduction : CUstreamMemOpAtomicReductionParams_st + + + + pad : list[cuuint64_t] - pad : List[cuuint64_t] Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUstreamBatchMemOpParams_union __val - cdef ccuda.CUstreamBatchMemOpParams_union* _ptr + cdef cydriver.CUstreamBatchMemOpParams_union _pvt_val + cdef cydriver.CUstreamBatchMemOpParams_union* _pvt_ptr + cdef CUstreamMemOpWaitValueParams_st _waitValue + + cdef CUstreamMemOpWriteValueParams_st _writeValue + + cdef CUstreamMemOpFlushRemoteWritesParams_st _flushRemoteWrites + + cdef CUstreamMemOpMemoryBarrierParams_st _memoryBarrier -{{endif}} -{{if 'struct CUDA_BATCH_MEM_OP_NODE_PARAMS_v1_st' in found_types}} + + + cdef CUstreamMemOpAtomicReductionParams_st _atomicReduction + cdef class CUDA_BATCH_MEM_OP_NODE_PARAMS_v1_st: """ + Batch memory operation node parameters Used in the legacy + cuGraphAddBatchMemOpNode api. New code should use cuGraphAddNode() + Attributes ---------- + ctx : CUcontext + + count : unsigned int + + paramArray : CUstreamBatchMemOpParams + + flags : unsigned int + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUDA_BATCH_MEM_OP_NODE_PARAMS_v1_st __val - cdef ccuda.CUDA_BATCH_MEM_OP_NODE_PARAMS_v1_st* _ptr + cdef cydriver.CUDA_BATCH_MEM_OP_NODE_PARAMS_v1_st _pvt_val + cdef cydriver.CUDA_BATCH_MEM_OP_NODE_PARAMS_v1_st* _pvt_ptr + cdef CUcontext _ctx + + cdef size_t _paramArray_length - cdef ccuda.CUstreamBatchMemOpParams* _paramArray + cdef cydriver.CUstreamBatchMemOpParams* _paramArray -{{endif}} -{{if 'struct CUDA_BATCH_MEM_OP_NODE_PARAMS_v2_st' in found_types}} cdef class CUDA_BATCH_MEM_OP_NODE_PARAMS_v2_st: """ @@ -788,64 +870,72 @@ cdef class CUDA_BATCH_MEM_OP_NODE_PARAMS_v2_st: Attributes ---------- + ctx : CUcontext Context to use for the operations. + + count : unsigned int Number of operations in paramArray. + + paramArray : CUstreamBatchMemOpParams Array of batch memory operations. + + flags : unsigned int Flags to control the node. + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUDA_BATCH_MEM_OP_NODE_PARAMS_v2_st __val - cdef ccuda.CUDA_BATCH_MEM_OP_NODE_PARAMS_v2_st* _ptr + cdef cydriver.CUDA_BATCH_MEM_OP_NODE_PARAMS_v2_st _pvt_val + cdef cydriver.CUDA_BATCH_MEM_OP_NODE_PARAMS_v2_st* _pvt_ptr + cdef CUcontext _ctx + + cdef size_t _paramArray_length - cdef ccuda.CUstreamBatchMemOpParams* _paramArray + cdef cydriver.CUstreamBatchMemOpParams* _paramArray -{{endif}} -{{if 'struct CUasyncNotificationInfo_st' in found_types}} cdef class anon_struct0: """ Attributes ---------- + bytesOverBudget : unsigned long long + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUasyncNotificationInfo_st* _ptr -{{endif}} -{{if 'struct CUasyncNotificationInfo_st' in found_types}} + cdef cydriver.CUasyncNotificationInfo_st* _pvt_ptr cdef class anon_union2: """ Attributes ---------- + overBudget : anon_struct0 + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUasyncNotificationInfo_st* _ptr + cdef cydriver.CUasyncNotificationInfo_st* _pvt_ptr + cdef anon_struct0 _overBudget -{{endif}} -{{if 'struct CUasyncNotificationInfo_st' in found_types}} + cdef class CUasyncNotificationInfo_st: """ @@ -853,22 +943,26 @@ cdef class CUasyncNotificationInfo_st: Attributes ---------- + type : CUasyncNotificationType + The type of notification being sent + info : anon_union2 + Information about the notification. `typename` must be checked in + order to interpret this field. Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUasyncNotificationInfo_st* _val_ptr - cdef ccuda.CUasyncNotificationInfo_st* _ptr + cdef cydriver.CUasyncNotificationInfo_st* _val_ptr + cdef cydriver.CUasyncNotificationInfo_st* _pvt_ptr + cdef anon_union2 _info -{{endif}} -{{if 'struct CUdevprop_st' in found_types}} + cdef class CUdevprop_st: """ @@ -876,37 +970,54 @@ cdef class CUdevprop_st: Attributes ---------- + maxThreadsPerBlock : int Maximum number of threads per block - maxThreadsDim : List[int] + + + maxThreadsDim : list[int] Maximum size of each dimension of a block - maxGridSize : List[int] + + + maxGridSize : list[int] Maximum size of each dimension of a grid + + sharedMemPerBlock : int Shared memory available per block in bytes + + totalConstantMemory : int Constant memory available on device in bytes + + SIMDWidth : int Warp size in threads + + memPitch : int Maximum pitch in bytes allowed by memory copies + + regsPerBlock : int 32-bit registers available per block + + clockRate : int Clock frequency in kilohertz + + textureAlign : int Alignment requirement for textures + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUdevprop_st __val - cdef ccuda.CUdevprop_st* _ptr -{{endif}} -{{if 'struct CUaccessPolicyWindow_st' in found_types}} + cdef cydriver.CUdevprop_st _pvt_val + cdef cydriver.CUdevprop_st* _pvt_ptr cdef class CUaccessPolicyWindow_st: """ @@ -923,30 +1034,40 @@ cdef class CUaccessPolicyWindow_st: Attributes ---------- + base_ptr : Any Starting address of the access policy window. CUDA driver may align it. + + num_bytes : size_t Size in bytes of the window policy. CUDA driver may restrict the maximum size and alignment. + + hitRatio : float hitRatio specifies percentage of lines assigned hitProp, rest are assigned missProp. + + hitProp : CUaccessProperty CUaccessProperty set for hit. + + missProp : CUaccessProperty CUaccessProperty set for miss. Must be either NORMAL or STREAMING + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUaccessPolicyWindow_st __val - cdef ccuda.CUaccessPolicyWindow_st* _ptr -{{endif}} -{{if 'struct CUDA_KERNEL_NODE_PARAMS_st' in found_types}} + cdef cydriver.CUaccessPolicyWindow_st _pvt_val + cdef cydriver.CUaccessPolicyWindow_st* _pvt_ptr + + cdef _HelperInputVoidPtr _cybase_ptr + cdef class CUDA_KERNEL_NODE_PARAMS_st: """ @@ -954,39 +1075,60 @@ cdef class CUDA_KERNEL_NODE_PARAMS_st: Attributes ---------- + func : CUfunction Kernel to launch + + gridDimX : unsigned int Width of grid in blocks + + gridDimY : unsigned int Height of grid in blocks + + gridDimZ : unsigned int Depth of grid in blocks + + blockDimX : unsigned int X dimension of each thread block + + blockDimY : unsigned int Y dimension of each thread block + + blockDimZ : unsigned int Z dimension of each thread block + + sharedMemBytes : unsigned int Dynamic shared-memory size per thread block in bytes + + kernelParams : Any Array of pointers to kernel parameters + + extra : Any Extra options + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUDA_KERNEL_NODE_PARAMS_st __val - cdef ccuda.CUDA_KERNEL_NODE_PARAMS_st* _ptr + cdef cydriver.CUDA_KERNEL_NODE_PARAMS_st _pvt_val + cdef cydriver.CUDA_KERNEL_NODE_PARAMS_st* _pvt_ptr + cdef CUfunction _func - cdef utils.HelperKernelParams _ckernelParams -{{endif}} -{{if 'struct CUDA_KERNEL_NODE_PARAMS_v2_st' in found_types}} + + + cdef _HelperKernelParams _cykernelParams + cdef class CUDA_KERNEL_NODE_PARAMS_v2_st: """ @@ -994,47 +1136,76 @@ cdef class CUDA_KERNEL_NODE_PARAMS_v2_st: Attributes ---------- + func : CUfunction Kernel to launch + + gridDimX : unsigned int Width of grid in blocks + + gridDimY : unsigned int Height of grid in blocks + + gridDimZ : unsigned int Depth of grid in blocks + + blockDimX : unsigned int X dimension of each thread block + + blockDimY : unsigned int Y dimension of each thread block + + blockDimZ : unsigned int Z dimension of each thread block + + sharedMemBytes : unsigned int Dynamic shared-memory size per thread block in bytes + + kernelParams : Any Array of pointers to kernel parameters + + extra : Any Extra options + + kern : CUkernel Kernel to launch, will only be referenced if func is NULL + + ctx : CUcontext Context for the kernel task to run in. The value NULL will indicate the current context should be used by the api. This field is ignored if func is set. + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUDA_KERNEL_NODE_PARAMS_v2_st __val - cdef ccuda.CUDA_KERNEL_NODE_PARAMS_v2_st* _ptr + cdef cydriver.CUDA_KERNEL_NODE_PARAMS_v2_st _pvt_val + cdef cydriver.CUDA_KERNEL_NODE_PARAMS_v2_st* _pvt_ptr + cdef CUfunction _func - cdef utils.HelperKernelParams _ckernelParams + + + cdef _HelperKernelParams _cykernelParams + + cdef CUkernel _kern + + cdef CUcontext _ctx -{{endif}} -{{if 'struct CUDA_KERNEL_NODE_PARAMS_v3_st' in found_types}} + cdef class CUDA_KERNEL_NODE_PARAMS_v3_st: """ @@ -1042,47 +1213,76 @@ cdef class CUDA_KERNEL_NODE_PARAMS_v3_st: Attributes ---------- + func : CUfunction Kernel to launch + + gridDimX : unsigned int Width of grid in blocks + + gridDimY : unsigned int Height of grid in blocks + + gridDimZ : unsigned int Depth of grid in blocks + + blockDimX : unsigned int X dimension of each thread block + + blockDimY : unsigned int Y dimension of each thread block + + blockDimZ : unsigned int Z dimension of each thread block + + sharedMemBytes : unsigned int Dynamic shared-memory size per thread block in bytes + + kernelParams : Any Array of pointers to kernel parameters + + extra : Any Extra options + + kern : CUkernel Kernel to launch, will only be referenced if func is NULL + + ctx : CUcontext Context for the kernel task to run in. The value NULL will indicate the current context should be used by the api. This field is ignored if func is set. + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUDA_KERNEL_NODE_PARAMS_v3_st __val - cdef ccuda.CUDA_KERNEL_NODE_PARAMS_v3_st* _ptr + cdef cydriver.CUDA_KERNEL_NODE_PARAMS_v3_st _pvt_val + cdef cydriver.CUDA_KERNEL_NODE_PARAMS_v3_st* _pvt_ptr + cdef CUfunction _func - cdef utils.HelperKernelParams _ckernelParams + + + cdef _HelperKernelParams _cykernelParams + + cdef CUkernel _kern + + cdef CUcontext _ctx -{{endif}} -{{if 'struct CUDA_MEMSET_NODE_PARAMS_st' in found_types}} + cdef class CUDA_MEMSET_NODE_PARAMS_st: """ @@ -1090,30 +1290,41 @@ cdef class CUDA_MEMSET_NODE_PARAMS_st: Attributes ---------- + dst : CUdeviceptr Destination device pointer + + pitch : size_t Pitch of destination device pointer. Unused if height is 1 + + value : unsigned int Value to be set + + elementSize : unsigned int Size of each element in bytes. Must be 1, 2, or 4. + + width : size_t Width of the row in elements + + height : size_t Number of rows + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUDA_MEMSET_NODE_PARAMS_st __val - cdef ccuda.CUDA_MEMSET_NODE_PARAMS_st* _ptr + cdef cydriver.CUDA_MEMSET_NODE_PARAMS_st _pvt_val + cdef cydriver.CUDA_MEMSET_NODE_PARAMS_st* _pvt_ptr + cdef CUdeviceptr _dst -{{endif}} -{{if 'struct CUDA_MEMSET_NODE_PARAMS_v2_st' in found_types}} + cdef class CUDA_MEMSET_NODE_PARAMS_v2_st: """ @@ -1121,33 +1332,48 @@ cdef class CUDA_MEMSET_NODE_PARAMS_v2_st: Attributes ---------- + dst : CUdeviceptr Destination device pointer + + pitch : size_t Pitch of destination device pointer. Unused if height is 1 + + value : unsigned int Value to be set + + elementSize : unsigned int Size of each element in bytes. Must be 1, 2, or 4. + + width : size_t Width of the row in elements + + height : size_t Number of rows + + ctx : CUcontext Context on which to run the node + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUDA_MEMSET_NODE_PARAMS_v2_st __val - cdef ccuda.CUDA_MEMSET_NODE_PARAMS_v2_st* _ptr + cdef cydriver.CUDA_MEMSET_NODE_PARAMS_v2_st _pvt_val + cdef cydriver.CUDA_MEMSET_NODE_PARAMS_v2_st* _pvt_ptr + cdef CUdeviceptr _dst + + cdef CUcontext _ctx -{{endif}} -{{if 'struct CUDA_HOST_NODE_PARAMS_st' in found_types}} + cdef class CUDA_HOST_NODE_PARAMS_st: """ @@ -1155,22 +1381,28 @@ cdef class CUDA_HOST_NODE_PARAMS_st: Attributes ---------- + fn : CUhostFn The function to call when the node executes + + userData : Any Argument to pass to the function + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUDA_HOST_NODE_PARAMS_st __val - cdef ccuda.CUDA_HOST_NODE_PARAMS_st* _ptr + cdef cydriver.CUDA_HOST_NODE_PARAMS_st _pvt_val + cdef cydriver.CUDA_HOST_NODE_PARAMS_st* _pvt_ptr + cdef CUhostFn _fn -{{endif}} -{{if 'struct CUDA_HOST_NODE_PARAMS_v2_st' in found_types}} + + + cdef _HelperInputVoidPtr _cyuserData + cdef class CUDA_HOST_NODE_PARAMS_v2_st: """ @@ -1178,22 +1410,32 @@ cdef class CUDA_HOST_NODE_PARAMS_v2_st: Attributes ---------- + fn : CUhostFn The function to call when the node executes + + userData : Any Argument to pass to the function + + syncMode : unsigned int + The sync mode to use for the host task + + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUDA_HOST_NODE_PARAMS_v2_st __val - cdef ccuda.CUDA_HOST_NODE_PARAMS_v2_st* _ptr + cdef cydriver.CUDA_HOST_NODE_PARAMS_v2_st _pvt_val + cdef cydriver.CUDA_HOST_NODE_PARAMS_v2_st* _pvt_ptr + cdef CUhostFn _fn -{{endif}} -{{if 'struct CUDA_CONDITIONAL_NODE_PARAMS' in found_types}} + + + cdef _HelperInputVoidPtr _cyuserData + cdef class CUDA_CONDITIONAL_NODE_PARAMS: """ @@ -1201,13 +1443,22 @@ cdef class CUDA_CONDITIONAL_NODE_PARAMS: Attributes ---------- + handle : CUgraphConditionalHandle Conditional node handle. Handles must be created in advance of creating the node using cuGraphConditionalHandleCreate. + + type : CUgraphConditionalNodeType Type of conditional node. + + size : unsigned int - Size of graph output array. Must be 1. + Size of graph output array. Allowed values are 1 for + CU_GRAPH_COND_TYPE_WHILE, 1 or 2 for CU_GRAPH_COND_TYPE_IF, or any + value greater than zero for CU_GRAPH_COND_TYPE_SWITCH. + + phGraph_out : CUgraph CUDA-owned array populated with conditional node child graphs during creation of the node. Valid for the lifetime of the @@ -1218,26 +1469,37 @@ cdef class CUDA_CONDITIONAL_NODE_PARAMS: - All kernels, including kernels in nested conditionals or child graphs at any level, must belong to the same CUDA context. These graphs may be populated using graph node creation APIs or - cuStreamBeginCaptureToGraph. + cuStreamBeginCaptureToGraph. CU_GRAPH_COND_TYPE_IF: phGraph_out[0] + is executed when the condition is non-zero. If `size` == 2, + phGraph_out[1] will be executed when the condition is zero. + CU_GRAPH_COND_TYPE_WHILE: phGraph_out[0] is executed as long as the + condition is non-zero. CU_GRAPH_COND_TYPE_SWITCH: phGraph_out[n] is + executed when the condition is equal to n. If the condition >= + `size`, no body graph is executed. + + ctx : CUcontext Context on which to run the node. Must match context used to create the handle and all body nodes. + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUDA_CONDITIONAL_NODE_PARAMS __val - cdef ccuda.CUDA_CONDITIONAL_NODE_PARAMS* _ptr + cdef cydriver.CUDA_CONDITIONAL_NODE_PARAMS _pvt_val + cdef cydriver.CUDA_CONDITIONAL_NODE_PARAMS* _pvt_ptr + cdef CUgraphConditionalHandle _handle + + cdef size_t _phGraph_out_length - cdef ccuda.CUgraph* _phGraph_out + cdef cydriver.CUgraph* _phGraph_out + cdef CUcontext _ctx -{{endif}} -{{if 'struct CUgraphEdgeData_st' in found_types}} + cdef class CUgraphEdgeData_st: """ @@ -1248,6 +1510,7 @@ cdef class CUgraphEdgeData_st: Attributes ---------- + from_port : bytes This indicates when the dependency is triggered from the upstream node on the edge. The meaning is specfic to the node type. A value @@ -1258,6 +1521,8 @@ cdef class CUgraphEdgeData_st: CU_GRAPH_KERNEL_NODE_PORT_DEFAULT, CU_GRAPH_KERNEL_NODE_PORT_PROGRAMMATIC, or CU_GRAPH_KERNEL_NODE_PORT_LAUNCH_ORDER. + + to_port : bytes This indicates what portion of the downstream node is dependent on the upstream node or portion thereof (indicated by `from_port`). @@ -1265,24 +1530,26 @@ cdef class CUgraphEdgeData_st: means the entirety of the downstream node is dependent on the upstream work. Currently no node types define non-zero ports. Accordingly, this field must be set to zero. + + type : bytes This should be populated with a value from CUgraphDependencyType. (It is typed as char due to compiler-specific layout of bitfields.) See CUgraphDependencyType. + + reserved : bytes These bytes are unused and must be zeroed. This ensures compatibility if additional fields are added in the future. + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUgraphEdgeData_st __val - cdef ccuda.CUgraphEdgeData_st* _ptr -{{endif}} -{{if 'struct CUDA_GRAPH_INSTANTIATE_PARAMS_st' in found_types}} + cdef cydriver.CUgraphEdgeData_st _pvt_val + cdef cydriver.CUgraphEdgeData_st* _pvt_ptr cdef class CUDA_GRAPH_INSTANTIATE_PARAMS_st: """ @@ -1290,28 +1557,39 @@ cdef class CUDA_GRAPH_INSTANTIATE_PARAMS_st: Attributes ---------- + flags : cuuint64_t Instantiation flags + + hUploadStream : CUstream Upload stream + + hErrNode_out : CUgraphNode The node which caused instantiation to fail, if any + + result_out : CUgraphInstantiateResult Whether instantiation was successful. If it failed, the reason why + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUDA_GRAPH_INSTANTIATE_PARAMS_st __val - cdef ccuda.CUDA_GRAPH_INSTANTIATE_PARAMS_st* _ptr + cdef cydriver.CUDA_GRAPH_INSTANTIATE_PARAMS_st _pvt_val + cdef cydriver.CUDA_GRAPH_INSTANTIATE_PARAMS_st* _pvt_ptr + cdef cuuint64_t _flags + + cdef CUstream _hUploadStream + + cdef CUgraphNode _hErrNode_out -{{endif}} -{{if 'struct CUlaunchMemSyncDomainMap_st' in found_types}} + cdef class CUlaunchMemSyncDomainMap_st: """ @@ -1325,104 +1603,143 @@ cdef class CUlaunchMemSyncDomainMap_st: Attributes ---------- + default_ : bytes The default domain ID to use for designated kernels + + remote : bytes The remote domain ID to use for designated kernels + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUlaunchMemSyncDomainMap_st __val - cdef ccuda.CUlaunchMemSyncDomainMap_st* _ptr -{{endif}} -{{if 'union CUlaunchAttributeValue_union' in found_types}} + cdef cydriver.CUlaunchMemSyncDomainMap_st _pvt_val + cdef cydriver.CUlaunchMemSyncDomainMap_st* _pvt_ptr cdef class anon_struct1: """ Attributes ---------- + x : unsigned int + + y : unsigned int + + z : unsigned int + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUlaunchAttributeValue_union* _ptr -{{endif}} -{{if 'union CUlaunchAttributeValue_union' in found_types}} + cdef cydriver.CUlaunchAttributeValue_union* _pvt_ptr cdef class anon_struct2: """ Attributes ---------- + event : CUevent + + flags : int + + triggerAtBlockStart : int + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUlaunchAttributeValue_union* _ptr + cdef cydriver.CUlaunchAttributeValue_union* _pvt_ptr + cdef CUevent _event -{{endif}} -{{if 'union CUlaunchAttributeValue_union' in found_types}} + cdef class anon_struct3: """ Attributes ---------- + event : CUevent + + flags : int + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUlaunchAttributeValue_union* _ptr + cdef cydriver.CUlaunchAttributeValue_union* _pvt_ptr + cdef CUevent _event -{{endif}} -{{if 'union CUlaunchAttributeValue_union' in found_types}} + cdef class anon_struct4: """ Attributes ---------- + + x : unsigned int + + + + y : unsigned int + + + + z : unsigned int + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + cdef cydriver.CUlaunchAttributeValue_union* _pvt_ptr + +cdef class anon_struct5: + """ + Attributes + ---------- + deviceUpdatable : int + + devNode : CUgraphDeviceNode + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUlaunchAttributeValue_union* _ptr + cdef cydriver.CUlaunchAttributeValue_union* _pvt_ptr + cdef CUgraphDeviceNode _devNode -{{endif}} -{{if 'union CUlaunchAttributeValue_union' in found_types}} + cdef class CUlaunchAttributeValue_union: """ @@ -1430,17 +1747,26 @@ cdef class CUlaunchAttributeValue_union: Attributes ---------- + pad : bytes + + accessPolicyWindow : CUaccessPolicyWindow Value of launch attribute CU_LAUNCH_ATTRIBUTE_ACCESS_POLICY_WINDOW. + + cooperative : int Value of launch attribute CU_LAUNCH_ATTRIBUTE_COOPERATIVE. Nonzero indicates a cooperative kernel (see cuLaunchCooperativeKernel). + + syncPolicy : CUsynchronizationPolicy Value of launch attribute - CU_LAUNCH_ATTRIBUTE_SYNCHRONIZATION_POLICY. - ::CUsynchronizationPolicy for work queued up in this stream + CU_LAUNCH_ATTRIBUTE_SYNCHRONIZATION_POLICY. CUsynchronizationPolicy + for work queued up in this stream + + clusterDim : anon_struct1 Value of launch attribute CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION that represents the desired cluster dimensions for the kernel. @@ -1449,50 +1775,122 @@ cdef class CUlaunchAttributeValue_union: - `y` - The Y dimension of the cluster, in blocks. Must be a divisor of the grid Y dimension. - `z` - The Z dimension of the cluster, in blocks. Must be a divisor of the grid Z dimension. + + clusterSchedulingPolicyPreference : CUclusterSchedulingPolicy Value of launch attribute CU_LAUNCH_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE. Cluster scheduling policy preference for the kernel. + + programmaticStreamSerializationAllowed : int Value of launch attribute CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_STREAM_SERIALIZATION. + + programmaticEvent : anon_struct2 - Value of launch attribute CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_EVENT. + Value of launch attribute CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_EVENT + with the following fields: - `CUevent` event - Event to fire when + all blocks trigger it. - `Event` record flags, see + cuEventRecordWithFlags. Does not accept :CU_EVENT_RECORD_EXTERNAL. + - `triggerAtBlockStart` - If this is set to non-0, each block + launch will automatically trigger the event. + + launchCompletionEvent : anon_struct3 Value of launch attribute - CU_LAUNCH_ATTRIBUTE_LAUNCH_COMPLETION_EVENT. + CU_LAUNCH_ATTRIBUTE_LAUNCH_COMPLETION_EVENT with the following + fields: - `CUevent` event - Event to fire when the last block + launches - `int` flags; - Event record flags, see + cuEventRecordWithFlags. Does not accept CU_EVENT_RECORD_EXTERNAL. + + priority : int Value of launch attribute CU_LAUNCH_ATTRIBUTE_PRIORITY. Execution priority of the kernel. + + memSyncDomainMap : CUlaunchMemSyncDomainMap Value of launch attribute CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP. See CUlaunchMemSyncDomainMap. + + memSyncDomain : CUlaunchMemSyncDomain Value of launch attribute CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN. See::CUlaunchMemSyncDomain - deviceUpdatableKernelNode : anon_struct4 + + + preferredClusterDim : anon_struct4 Value of launch attribute - CU_LAUNCH_ATTRIBUTE_DEVICE_UPDATABLE_KERNEL_NODE. + CU_LAUNCH_ATTRIBUTE_PREFERRED_CLUSTER_DIMENSION that represents the + desired preferred cluster dimensions for the kernel. Opaque type + with the following fields: - `x` - The X dimension of the preferred + cluster, in blocks. Must be a divisor of the grid X dimension, and + must be a multiple of the `x` field of + CUlaunchAttributeValue::clusterDim. - `y` - The Y dimension of + the preferred cluster, in blocks. Must be a divisor of the grid Y + dimension, and must be a multiple of the `y` field of + CUlaunchAttributeValue::clusterDim. - `z` - The Z dimension of + the preferred cluster, in blocks. Must be equal to the `z` field of + CUlaunchAttributeValue::clusterDim. + + + deviceUpdatableKernelNode : anon_struct5 + Value of launch attribute + CU_LAUNCH_ATTRIBUTE_DEVICE_UPDATABLE_KERNEL_NODE. with the + following fields: - `int` deviceUpdatable - Whether or not the + resulting kernel node should be device-updatable. - + `CUgraphDeviceNode` devNode - Returns a handle to pass to the + various device-side update functions. + + sharedMemCarveout : unsigned int Value of launch attribute CU_LAUNCH_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT. + + nvlinkUtilCentricScheduling : unsigned int + + + + portableClusterSizeMode : CUlaunchAttributePortableClusterMode + Value of launch attribute + CU_LAUNCH_ATTRIBUTE_PORTABLE_CLUSTER_SIZE_MODE. + + + sharedMemoryMode : CUsharedMemoryMode + Value of launch attribute CU_LAUNCH_ATTRIBUTE_SHARED_MEMORY_MODE. + See CUsharedMemoryMode for acceptable values. + + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUlaunchAttributeValue_union __val - cdef ccuda.CUlaunchAttributeValue_union* _ptr + cdef cydriver.CUlaunchAttributeValue_union _pvt_val + cdef cydriver.CUlaunchAttributeValue_union* _pvt_ptr + cdef CUaccessPolicyWindow _accessPolicyWindow + + cdef anon_struct1 _clusterDim + + cdef anon_struct2 _programmaticEvent + + cdef anon_struct3 _launchCompletionEvent + + cdef CUlaunchMemSyncDomainMap _memSyncDomainMap - cdef anon_struct4 _deviceUpdatableKernelNode -{{endif}} -{{if 'struct CUlaunchAttribute_st' in found_types}} + + + cdef anon_struct4 _preferredClusterDim + + + cdef anon_struct5 _deviceUpdatableKernelNode + cdef class CUlaunchAttribute_st: """ @@ -1500,22 +1898,25 @@ cdef class CUlaunchAttribute_st: Attributes ---------- + id : CUlaunchAttributeID Attribute to set + + value : CUlaunchAttributeValue Value of the attribute + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUlaunchAttribute_st __val - cdef ccuda.CUlaunchAttribute_st* _ptr + cdef cydriver.CUlaunchAttribute_st _pvt_val + cdef cydriver.CUlaunchAttribute_st* _pvt_ptr + cdef CUlaunchAttributeValue _value -{{endif}} -{{if 'struct CUlaunchConfig_st' in found_types}} + cdef class CUlaunchConfig_st: """ @@ -1523,41 +1924,61 @@ cdef class CUlaunchConfig_st: Attributes ---------- + gridDimX : unsigned int Width of grid in blocks + + gridDimY : unsigned int Height of grid in blocks + + gridDimZ : unsigned int Depth of grid in blocks + + blockDimX : unsigned int X dimension of each thread block + + blockDimY : unsigned int Y dimension of each thread block + + blockDimZ : unsigned int Z dimension of each thread block + + sharedMemBytes : unsigned int Dynamic shared-memory size per thread block in bytes + + hStream : CUstream Stream identifier + + attrs : CUlaunchAttribute List of attributes; nullable if CUlaunchConfig::numAttrs == 0 + + numAttrs : unsigned int Number of attributes populated in CUlaunchConfig::attrs + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUlaunchConfig_st __val - cdef ccuda.CUlaunchConfig_st* _ptr + cdef cydriver.CUlaunchConfig_st _pvt_val + cdef cydriver.CUlaunchConfig_st* _pvt_ptr + cdef CUstream _hStream + + cdef size_t _attrs_length - cdef ccuda.CUlaunchAttribute* _attrs + cdef cydriver.CUlaunchAttribute* _attrs -{{endif}} -{{if 'struct CUexecAffinitySmCount_st' in found_types}} cdef class CUexecAffinitySmCount_st: """ @@ -1565,37 +1986,37 @@ cdef class CUexecAffinitySmCount_st: Attributes ---------- + val : unsigned int The number of SMs the context is limited to use. + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUexecAffinitySmCount_st __val - cdef ccuda.CUexecAffinitySmCount_st* _ptr -{{endif}} -{{if 'struct CUexecAffinityParam_st' in found_types}} + cdef cydriver.CUexecAffinitySmCount_st _pvt_val + cdef cydriver.CUexecAffinitySmCount_st* _pvt_ptr cdef class anon_union3: """ Attributes ---------- + smCount : CUexecAffinitySmCount + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUexecAffinityParam_st* _ptr + cdef cydriver.CUexecAffinityParam_st* _pvt_ptr + cdef CUexecAffinitySmCount _smCount -{{endif}} -{{if 'struct CUexecAffinityParam_st' in found_types}} + cdef class CUexecAffinityParam_st: """ @@ -1603,22 +2024,25 @@ cdef class CUexecAffinityParam_st: Attributes ---------- + type : CUexecAffinityType + Type of execution affinity. + param : anon_union3 + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUexecAffinityParam_st* _val_ptr - cdef ccuda.CUexecAffinityParam_st* _ptr + cdef cydriver.CUexecAffinityParam_st* _val_ptr + cdef cydriver.CUexecAffinityParam_st* _pvt_ptr + cdef anon_union3 _param -{{endif}} -{{if 'struct CUctxCigParam_st' in found_types}} + cdef class CUctxCigParam_st: """ @@ -1626,76 +2050,155 @@ cdef class CUctxCigParam_st: Attributes ---------- + sharedDataType : CUcigDataType + Type of shared data from graphics client (D3D12 or Vulkan). + sharedData : Any + Graphics client data handle (ID3D12CommandQueue or Nvidia specific + data blob). Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUctxCigParam_st __val - cdef ccuda.CUctxCigParam_st* _ptr -{{endif}} -{{if 'struct CUctxCreateParams_st' in found_types}} + cdef cydriver.CUctxCigParam_st _pvt_val + cdef cydriver.CUctxCigParam_st* _pvt_ptr + + cdef _HelperInputVoidPtr _cysharedData + cdef class CUctxCreateParams_st: """ - Params for creating CUDA context Exactly one of execAffinityParams - and cigParams must be non-NULL. + Params for creating CUDA context. Both execAffinityParams and + cigParams cannot be non-NULL at the same time. If both are NULL, + the context will be created as a regular CUDA context. Attributes ---------- + execAffinityParams : CUexecAffinityParam + Array of execution affinity parameters to limit context resources + (e.g., SM count). Only supported Volta+ MPS. Mutually exclusive + with cigParams. + numExecAffinityParams : int + Number of elements in execAffinityParams array. Must be 0 if + execAffinityParams is NULL. + cigParams : CUctxCigParam + CIG (CUDA in Graphics) parameters for sharing data from + D3D12/Vulkan graphics clients. Mutually exclusive with + execAffinityParams. Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUctxCreateParams_st __val - cdef ccuda.CUctxCreateParams_st* _ptr + cdef cydriver.CUctxCreateParams_st _pvt_val + cdef cydriver.CUctxCreateParams_st* _pvt_ptr + cdef size_t _execAffinityParams_length - cdef ccuda.CUexecAffinityParam* _execAffinityParams + cdef cydriver.CUexecAffinityParam* _execAffinityParams + cdef size_t _cigParams_length - cdef ccuda.CUctxCigParam* _cigParams + cdef cydriver.CUctxCigParam* _cigParams + + +cdef class CUstreamCigParam_st: + """ + CIG Stream Capture Params + + Attributes + ---------- + + streamSharedDataType : CUstreamCigDataType + Type of shared data from graphics client (D3D12). + + + streamSharedData : Any + Graphics client data handle + (ID3D12CommandList/ID3D12GraphicsCommandList). + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + cdef cydriver.CUstreamCigParam_st _pvt_val + cdef cydriver.CUstreamCigParam_st* _pvt_ptr + + cdef _HelperInputVoidPtr _cystreamSharedData + + +cdef class CUstreamCigCaptureParams_st: + """ + Params for capturing CUDA stream to CIG streamCigParams must be + non-NULL. + + Attributes + ---------- + + streamCigParams : CUstreamCigParam + CIG (CUDA in Graphics) parameters for sharing command list data + from D3D12 graphics clients. + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + cdef cydriver.CUstreamCigCaptureParams_st _pvt_val + cdef cydriver.CUstreamCigCaptureParams_st* _pvt_ptr + + cdef size_t _streamCigParams_length + cdef cydriver.CUstreamCigParam* _streamCigParams -{{endif}} -{{if 'struct CUlibraryHostUniversalFunctionAndDataTable_st' in found_types}} cdef class CUlibraryHostUniversalFunctionAndDataTable_st: """ Attributes ---------- + functionTable : Any + + functionWindowSize : size_t + + dataTable : Any + + dataWindowSize : size_t + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUlibraryHostUniversalFunctionAndDataTable_st __val - cdef ccuda.CUlibraryHostUniversalFunctionAndDataTable_st* _ptr -{{endif}} -{{if 'struct CUDA_MEMCPY2D_st' in found_types}} + cdef cydriver.CUlibraryHostUniversalFunctionAndDataTable_st _pvt_val + cdef cydriver.CUlibraryHostUniversalFunctionAndDataTable_st* _pvt_ptr + + cdef _HelperInputVoidPtr _cyfunctionTable + + + cdef _HelperInputVoidPtr _cydataTable + cdef class CUDA_MEMCPY2D_st: """ @@ -1703,53 +2206,96 @@ cdef class CUDA_MEMCPY2D_st: Attributes ---------- + srcXInBytes : size_t Source X in bytes + + srcY : size_t Source Y + + srcMemoryType : CUmemorytype Source memory type (host, device, array) + + srcHost : Any Source host pointer + + srcDevice : CUdeviceptr Source device pointer + + srcArray : CUarray Source array reference + + srcPitch : size_t Source pitch (ignored when src is array) + + dstXInBytes : size_t Destination X in bytes + + dstY : size_t Destination Y + + dstMemoryType : CUmemorytype Destination memory type (host, device, array) + + dstHost : Any Destination host pointer + + dstDevice : CUdeviceptr Destination device pointer + + dstArray : CUarray Destination array reference + + dstPitch : size_t Destination pitch (ignored when dst is array) + + WidthInBytes : size_t Width of 2D memory copy in bytes + + Height : size_t Height of 2D memory copy + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUDA_MEMCPY2D_st __val - cdef ccuda.CUDA_MEMCPY2D_st* _ptr + cdef cydriver.CUDA_MEMCPY2D_st _pvt_val + cdef cydriver.CUDA_MEMCPY2D_st* _pvt_ptr + + cdef _HelperInputVoidPtr _cysrcHost + + cdef CUdeviceptr _srcDevice + + cdef CUarray _srcArray + + + cdef _HelperInputVoidPtr _cydstHost + + cdef CUdeviceptr _dstDevice + + cdef CUarray _dstArray -{{endif}} -{{if 'struct CUDA_MEMCPY3D_st' in found_types}} + cdef class CUDA_MEMCPY3D_st: """ @@ -1757,148 +2303,280 @@ cdef class CUDA_MEMCPY3D_st: Attributes ---------- + srcXInBytes : size_t Source X in bytes + + srcY : size_t Source Y + + srcZ : size_t Source Z + + srcLOD : size_t Source LOD + + srcMemoryType : CUmemorytype Source memory type (host, device, array) + + srcHost : Any Source host pointer + + srcDevice : CUdeviceptr Source device pointer + + srcArray : CUarray Source array reference + + reserved0 : Any Must be NULL + + srcPitch : size_t Source pitch (ignored when src is array) + + srcHeight : size_t Source height (ignored when src is array; may be 0 if Depth==1) + + dstXInBytes : size_t Destination X in bytes + + dstY : size_t Destination Y + + dstZ : size_t Destination Z + + dstLOD : size_t Destination LOD + + dstMemoryType : CUmemorytype Destination memory type (host, device, array) + + dstHost : Any Destination host pointer + + dstDevice : CUdeviceptr Destination device pointer + + dstArray : CUarray Destination array reference + + reserved1 : Any Must be NULL + + dstPitch : size_t Destination pitch (ignored when dst is array) + + dstHeight : size_t Destination height (ignored when dst is array; may be 0 if Depth==1) + + WidthInBytes : size_t Width of 3D memory copy in bytes + + Height : size_t Height of 3D memory copy + + Depth : size_t Depth of 3D memory copy + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUDA_MEMCPY3D_st __val - cdef ccuda.CUDA_MEMCPY3D_st* _ptr + cdef cydriver.CUDA_MEMCPY3D_st _pvt_val + cdef cydriver.CUDA_MEMCPY3D_st* _pvt_ptr + + cdef _HelperInputVoidPtr _cysrcHost + + cdef CUdeviceptr _srcDevice + + cdef CUarray _srcArray + + + cdef _HelperInputVoidPtr _cyreserved0 + + + cdef _HelperInputVoidPtr _cydstHost + + cdef CUdeviceptr _dstDevice + + cdef CUarray _dstArray -{{endif}} -{{if 'struct CUDA_MEMCPY3D_PEER_st' in found_types}} -cdef class CUDA_MEMCPY3D_PEER_st: + + cdef _HelperInputVoidPtr _cyreserved1 + + +cdef class CUDA_MEMCPY3D_PEER_st: """ 3D memory cross-context copy parameters Attributes ---------- + srcXInBytes : size_t Source X in bytes + + srcY : size_t Source Y + + srcZ : size_t Source Z + + srcLOD : size_t Source LOD + + srcMemoryType : CUmemorytype Source memory type (host, device, array) + + srcHost : Any Source host pointer + + srcDevice : CUdeviceptr Source device pointer + + srcArray : CUarray Source array reference + + srcContext : CUcontext Source context (ignored with srcMemoryType is CU_MEMORYTYPE_ARRAY) + + srcPitch : size_t Source pitch (ignored when src is array) + + srcHeight : size_t Source height (ignored when src is array; may be 0 if Depth==1) + + dstXInBytes : size_t Destination X in bytes + + dstY : size_t Destination Y + + dstZ : size_t Destination Z + + dstLOD : size_t Destination LOD + + dstMemoryType : CUmemorytype Destination memory type (host, device, array) + + dstHost : Any Destination host pointer + + dstDevice : CUdeviceptr Destination device pointer + + dstArray : CUarray Destination array reference + + dstContext : CUcontext Destination context (ignored with dstMemoryType is CU_MEMORYTYPE_ARRAY) + + dstPitch : size_t Destination pitch (ignored when dst is array) + + dstHeight : size_t Destination height (ignored when dst is array; may be 0 if Depth==1) + + WidthInBytes : size_t Width of 3D memory copy in bytes + + Height : size_t Height of 3D memory copy + + Depth : size_t Depth of 3D memory copy + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUDA_MEMCPY3D_PEER_st __val - cdef ccuda.CUDA_MEMCPY3D_PEER_st* _ptr + cdef cydriver.CUDA_MEMCPY3D_PEER_st _pvt_val + cdef cydriver.CUDA_MEMCPY3D_PEER_st* _pvt_ptr + + cdef _HelperInputVoidPtr _cysrcHost + + cdef CUdeviceptr _srcDevice + + cdef CUarray _srcArray + + cdef CUcontext _srcContext + + + cdef _HelperInputVoidPtr _cydstHost + + cdef CUdeviceptr _dstDevice + + cdef CUarray _dstArray + + cdef CUcontext _dstContext -{{endif}} -{{if 'struct CUDA_MEMCPY_NODE_PARAMS_st' in found_types}} + cdef class CUDA_MEMCPY_NODE_PARAMS_st: """ @@ -1906,27 +2584,36 @@ cdef class CUDA_MEMCPY_NODE_PARAMS_st: Attributes ---------- + flags : int Must be zero + + reserved : int Must be zero + + copyCtx : CUcontext Context on which to run the node + + copyParams : CUDA_MEMCPY3D Parameters for the memory copy + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUDA_MEMCPY_NODE_PARAMS_st __val - cdef ccuda.CUDA_MEMCPY_NODE_PARAMS_st* _ptr + cdef cydriver.CUDA_MEMCPY_NODE_PARAMS_st _pvt_val + cdef cydriver.CUDA_MEMCPY_NODE_PARAMS_st* _pvt_ptr + cdef CUcontext _copyCtx + + cdef CUDA_MEMCPY3D _copyParams -{{endif}} -{{if 'struct CUDA_ARRAY_DESCRIPTOR_st' in found_types}} + cdef class CUDA_ARRAY_DESCRIPTOR_st: """ @@ -1934,25 +2621,30 @@ cdef class CUDA_ARRAY_DESCRIPTOR_st: Attributes ---------- + Width : size_t Width of array + + Height : size_t Height of array + + Format : CUarray_format Array format + + NumChannels : unsigned int Channels per array element + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUDA_ARRAY_DESCRIPTOR_st __val - cdef ccuda.CUDA_ARRAY_DESCRIPTOR_st* _ptr -{{endif}} -{{if 'struct CUDA_ARRAY3D_DESCRIPTOR_st' in found_types}} + cdef cydriver.CUDA_ARRAY_DESCRIPTOR_st _pvt_val + cdef cydriver.CUDA_ARRAY_DESCRIPTOR_st* _pvt_ptr cdef class CUDA_ARRAY3D_DESCRIPTOR_st: """ @@ -1960,50 +2652,62 @@ cdef class CUDA_ARRAY3D_DESCRIPTOR_st: Attributes ---------- + Width : size_t Width of 3D array + + Height : size_t Height of 3D array + + Depth : size_t Depth of 3D array + + Format : CUarray_format Array format + + NumChannels : unsigned int Channels per array element + + Flags : unsigned int Flags + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUDA_ARRAY3D_DESCRIPTOR_st __val - cdef ccuda.CUDA_ARRAY3D_DESCRIPTOR_st* _ptr -{{endif}} -{{if 'struct CUDA_ARRAY_SPARSE_PROPERTIES_st' in found_types}} + cdef cydriver.CUDA_ARRAY3D_DESCRIPTOR_st _pvt_val + cdef cydriver.CUDA_ARRAY3D_DESCRIPTOR_st* _pvt_ptr -cdef class anon_struct5: +cdef class anon_struct6: """ Attributes ---------- + width : unsigned int + + height : unsigned int + + depth : unsigned int + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUDA_ARRAY_SPARSE_PROPERTIES_st* _ptr -{{endif}} -{{if 'struct CUDA_ARRAY_SPARSE_PROPERTIES_st' in found_types}} + cdef cydriver.CUDA_ARRAY_SPARSE_PROPERTIES_st* _pvt_ptr cdef class CUDA_ARRAY_SPARSE_PROPERTIES_st: """ @@ -2011,29 +2715,38 @@ cdef class CUDA_ARRAY_SPARSE_PROPERTIES_st: Attributes ---------- - tileExtent : anon_struct5 + + tileExtent : anon_struct6 + + miptailFirstLevel : unsigned int First mip level at which the mip tail begins. + + miptailSize : unsigned long long Total size of the mip tail. + + flags : unsigned int Flags will either be zero or CU_ARRAY_SPARSE_PROPERTIES_SINGLE_MIPTAIL - reserved : List[unsigned int] + + + reserved : list[unsigned int] + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUDA_ARRAY_SPARSE_PROPERTIES_st __val - cdef ccuda.CUDA_ARRAY_SPARSE_PROPERTIES_st* _ptr - cdef anon_struct5 _tileExtent -{{endif}} -{{if 'struct CUDA_ARRAY_MEMORY_REQUIREMENTS_st' in found_types}} + cdef cydriver.CUDA_ARRAY_SPARSE_PROPERTIES_st _pvt_val + cdef cydriver.CUDA_ARRAY_SPARSE_PROPERTIES_st* _pvt_ptr + + cdef anon_struct6 _tileExtent + cdef class CUDA_ARRAY_MEMORY_REQUIREMENTS_st: """ @@ -2041,158 +2754,197 @@ cdef class CUDA_ARRAY_MEMORY_REQUIREMENTS_st: Attributes ---------- + size : size_t Total required memory size + + alignment : size_t alignment requirement - reserved : List[unsigned int] + + + reserved : list[unsigned int] + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUDA_ARRAY_MEMORY_REQUIREMENTS_st __val - cdef ccuda.CUDA_ARRAY_MEMORY_REQUIREMENTS_st* _ptr -{{endif}} -{{if 'struct CUDA_RESOURCE_DESC_st' in found_types}} + cdef cydriver.CUDA_ARRAY_MEMORY_REQUIREMENTS_st _pvt_val + cdef cydriver.CUDA_ARRAY_MEMORY_REQUIREMENTS_st* _pvt_ptr -cdef class anon_struct6: +cdef class anon_struct7: """ Attributes ---------- + hArray : CUarray + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUDA_RESOURCE_DESC_st* _ptr + cdef cydriver.CUDA_RESOURCE_DESC_st* _pvt_ptr + cdef CUarray _hArray -{{endif}} -{{if 'struct CUDA_RESOURCE_DESC_st' in found_types}} -cdef class anon_struct7: + +cdef class anon_struct8: """ Attributes ---------- + hMipmappedArray : CUmipmappedArray + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUDA_RESOURCE_DESC_st* _ptr + cdef cydriver.CUDA_RESOURCE_DESC_st* _pvt_ptr + cdef CUmipmappedArray _hMipmappedArray -{{endif}} -{{if 'struct CUDA_RESOURCE_DESC_st' in found_types}} -cdef class anon_struct8: + +cdef class anon_struct9: """ Attributes ---------- + devPtr : CUdeviceptr + + format : CUarray_format + + numChannels : unsigned int + + sizeInBytes : size_t + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUDA_RESOURCE_DESC_st* _ptr + cdef cydriver.CUDA_RESOURCE_DESC_st* _pvt_ptr + cdef CUdeviceptr _devPtr -{{endif}} -{{if 'struct CUDA_RESOURCE_DESC_st' in found_types}} -cdef class anon_struct9: + +cdef class anon_struct10: """ Attributes ---------- + devPtr : CUdeviceptr + + format : CUarray_format + + numChannels : unsigned int + + width : size_t + + height : size_t + + pitchInBytes : size_t + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUDA_RESOURCE_DESC_st* _ptr + cdef cydriver.CUDA_RESOURCE_DESC_st* _pvt_ptr + cdef CUdeviceptr _devPtr -{{endif}} -{{if 'struct CUDA_RESOURCE_DESC_st' in found_types}} -cdef class anon_struct10: + +cdef class anon_struct11: """ Attributes ---------- - reserved : List[int] + + reserved : list[int] + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUDA_RESOURCE_DESC_st* _ptr -{{endif}} -{{if 'struct CUDA_RESOURCE_DESC_st' in found_types}} + cdef cydriver.CUDA_RESOURCE_DESC_st* _pvt_ptr cdef class anon_union4: """ Attributes ---------- - array : anon_struct6 - mipmap : anon_struct7 + array : anon_struct7 + + + + mipmap : anon_struct8 + + + + linear : anon_struct9 + + - linear : anon_struct8 + pitch2D : anon_struct10 - pitch2D : anon_struct9 - reserved : anon_struct10 + + reserved : anon_struct11 + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUDA_RESOURCE_DESC_st* _ptr - cdef anon_struct6 _array - cdef anon_struct7 _mipmap - cdef anon_struct8 _linear - cdef anon_struct9 _pitch2D - cdef anon_struct10 _reserved -{{endif}} -{{if 'struct CUDA_RESOURCE_DESC_st' in found_types}} + cdef cydriver.CUDA_RESOURCE_DESC_st* _pvt_ptr + + cdef anon_struct7 _array + + + cdef anon_struct8 _mipmap + + + cdef anon_struct9 _linear + + + cdef anon_struct10 _pitch2D + + + cdef anon_struct11 _reserved + cdef class CUDA_RESOURCE_DESC_st: """ @@ -2200,24 +2952,29 @@ cdef class CUDA_RESOURCE_DESC_st: Attributes ---------- + resType : CUresourcetype Resource type + + res : anon_union4 + + flags : unsigned int Flags (must be zero) + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUDA_RESOURCE_DESC_st* _val_ptr - cdef ccuda.CUDA_RESOURCE_DESC_st* _ptr + cdef cydriver.CUDA_RESOURCE_DESC_st* _val_ptr + cdef cydriver.CUDA_RESOURCE_DESC_st* _pvt_ptr + cdef anon_union4 _res -{{endif}} -{{if 'struct CUDA_TEXTURE_DESC_st' in found_types}} + cdef class CUDA_TEXTURE_DESC_st: """ @@ -2225,37 +2982,54 @@ cdef class CUDA_TEXTURE_DESC_st: Attributes ---------- - addressMode : List[CUaddress_mode] + + addressMode : list[CUaddress_mode] Address modes + + filterMode : CUfilter_mode Filter mode + + flags : unsigned int Flags + + maxAnisotropy : unsigned int Maximum anisotropy ratio + + mipmapFilterMode : CUfilter_mode Mipmap filter mode + + mipmapLevelBias : float Mipmap level bias + + minMipmapLevelClamp : float Mipmap minimum level clamp + + maxMipmapLevelClamp : float Mipmap maximum level clamp - borderColor : List[float] + + + borderColor : list[float] Border Color - reserved : List[int] + + + reserved : list[int] + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUDA_TEXTURE_DESC_st __val - cdef ccuda.CUDA_TEXTURE_DESC_st* _ptr -{{endif}} -{{if 'struct CUDA_RESOURCE_VIEW_DESC_st' in found_types}} + cdef cydriver.CUDA_TEXTURE_DESC_st _pvt_val + cdef cydriver.CUDA_TEXTURE_DESC_st* _pvt_ptr cdef class CUDA_RESOURCE_VIEW_DESC_st: """ @@ -2263,56 +3037,70 @@ cdef class CUDA_RESOURCE_VIEW_DESC_st: Attributes ---------- + format : CUresourceViewFormat Resource view format + + width : size_t Width of the resource view + + height : size_t Height of the resource view + + depth : size_t Depth of the resource view + + firstMipmapLevel : unsigned int First defined mipmap level + + lastMipmapLevel : unsigned int Last defined mipmap level + + firstLayer : unsigned int First layer index + + lastLayer : unsigned int Last layer index - reserved : List[unsigned int] + + + reserved : list[unsigned int] + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUDA_RESOURCE_VIEW_DESC_st __val - cdef ccuda.CUDA_RESOURCE_VIEW_DESC_st* _ptr -{{endif}} -{{if 'struct CUtensorMap_st' in found_types}} + cdef cydriver.CUDA_RESOURCE_VIEW_DESC_st _pvt_val + cdef cydriver.CUDA_RESOURCE_VIEW_DESC_st* _pvt_ptr cdef class CUtensorMap_st: """ - Tensor map descriptor. Requires compiler support for aligning to 64 - bytes. + Tensor map descriptor. Requires compiler support for aligning to + 128 bytes. Attributes ---------- - opaque : List[cuuint64_t] + + opaque : list[cuuint64_t] + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUtensorMap_st __val - cdef ccuda.CUtensorMap_st* _ptr -{{endif}} -{{if 'struct CUDA_POINTER_ATTRIBUTE_P2P_TOKENS_st' in found_types}} + cdef cydriver.CUtensorMap_st _pvt_val + cdef cydriver.CUtensorMap_st* _pvt_ptr cdef class CUDA_POINTER_ATTRIBUTE_P2P_TOKENS_st: """ @@ -2320,21 +3108,22 @@ cdef class CUDA_POINTER_ATTRIBUTE_P2P_TOKENS_st: Attributes ---------- + p2pToken : unsigned long long + + vaSpaceToken : unsigned int + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUDA_POINTER_ATTRIBUTE_P2P_TOKENS_st __val - cdef ccuda.CUDA_POINTER_ATTRIBUTE_P2P_TOKENS_st* _ptr -{{endif}} -{{if 'struct CUDA_LAUNCH_PARAMS_st' in found_types}} + cdef cydriver.CUDA_POINTER_ATTRIBUTE_P2P_TOKENS_st _pvt_val + cdef cydriver.CUDA_POINTER_ATTRIBUTE_P2P_TOKENS_st* _pvt_ptr cdef class CUDA_LAUNCH_PARAMS_st: """ @@ -2342,81 +3131,119 @@ cdef class CUDA_LAUNCH_PARAMS_st: Attributes ---------- + function : CUfunction Kernel to launch + + gridDimX : unsigned int Width of grid in blocks + + gridDimY : unsigned int Height of grid in blocks + + gridDimZ : unsigned int Depth of grid in blocks + + blockDimX : unsigned int X dimension of each thread block + + blockDimY : unsigned int Y dimension of each thread block + + blockDimZ : unsigned int Z dimension of each thread block + + sharedMemBytes : unsigned int Dynamic shared-memory size per thread block in bytes + + hStream : CUstream Stream identifier + + kernelParams : Any Array of pointers to kernel parameters + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUDA_LAUNCH_PARAMS_st __val - cdef ccuda.CUDA_LAUNCH_PARAMS_st* _ptr + cdef cydriver.CUDA_LAUNCH_PARAMS_st _pvt_val + cdef cydriver.CUDA_LAUNCH_PARAMS_st* _pvt_ptr + cdef CUfunction _function + + cdef CUstream _hStream - cdef utils.HelperKernelParams _ckernelParams -{{endif}} -{{if 'struct CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st' in found_types}} -cdef class anon_struct11: + + cdef _HelperKernelParams _cykernelParams + + +cdef class anon_struct12: """ Attributes ---------- + handle : Any + + name : Any + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st* _ptr -{{endif}} -{{if 'struct CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st' in found_types}} + cdef cydriver.CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st* _pvt_ptr + + cdef _HelperInputVoidPtr _cyhandle + + + cdef _HelperInputVoidPtr _cyname + cdef class anon_union5: """ Attributes ---------- + fd : int - win32 : anon_struct11 + + + win32 : anon_struct12 + + nvSciBufObject : Any + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st* _ptr - cdef anon_struct11 _win32 -{{endif}} -{{if 'struct CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st' in found_types}} + cdef cydriver.CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st* _pvt_ptr + + cdef anon_struct12 _win32 + + + cdef _HelperInputVoidPtr _cynvSciBufObject + cdef class CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st: """ @@ -2424,28 +3251,37 @@ cdef class CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st: Attributes ---------- + type : CUexternalMemoryHandleType Type of the handle + + handle : anon_union5 + + size : unsigned long long Size of the memory allocation + + flags : unsigned int Flags must either be zero or CUDA_EXTERNAL_MEMORY_DEDICATED - reserved : List[unsigned int] + + + reserved : list[unsigned int] + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st* _val_ptr - cdef ccuda.CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st* _ptr + cdef cydriver.CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st* _val_ptr + cdef cydriver.CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st* _pvt_ptr + cdef anon_union5 _handle -{{endif}} -{{if 'struct CUDA_EXTERNAL_MEMORY_BUFFER_DESC_st' in found_types}} + cdef class CUDA_EXTERNAL_MEMORY_BUFFER_DESC_st: """ @@ -2453,25 +3289,30 @@ cdef class CUDA_EXTERNAL_MEMORY_BUFFER_DESC_st: Attributes ---------- + offset : unsigned long long Offset into the memory object where the buffer's base is + + size : unsigned long long Size of the buffer + + flags : unsigned int Flags reserved for future use. Must be zero. - reserved : List[unsigned int] + + + reserved : list[unsigned int] + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUDA_EXTERNAL_MEMORY_BUFFER_DESC_st __val - cdef ccuda.CUDA_EXTERNAL_MEMORY_BUFFER_DESC_st* _ptr -{{endif}} -{{if 'struct CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_st' in found_types}} + cdef cydriver.CUDA_EXTERNAL_MEMORY_BUFFER_DESC_st _pvt_val + cdef cydriver.CUDA_EXTERNAL_MEMORY_BUFFER_DESC_st* _pvt_ptr cdef class CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_st: """ @@ -2479,68 +3320,90 @@ cdef class CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_st: Attributes ---------- + offset : unsigned long long Offset into the memory object where the base level of the mipmap chain is. + + arrayDesc : CUDA_ARRAY3D_DESCRIPTOR Format, dimension and type of base level of the mipmap chain + + numLevels : unsigned int Total number of levels in the mipmap chain - reserved : List[unsigned int] + + + reserved : list[unsigned int] + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_st __val - cdef ccuda.CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_st* _ptr + cdef cydriver.CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_st _pvt_val + cdef cydriver.CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_st* _pvt_ptr + cdef CUDA_ARRAY3D_DESCRIPTOR _arrayDesc -{{endif}} -{{if 'struct CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st' in found_types}} -cdef class anon_struct12: + +cdef class anon_struct13: """ Attributes ---------- + handle : Any + + name : Any + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st* _ptr -{{endif}} -{{if 'struct CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st' in found_types}} + cdef cydriver.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st* _pvt_ptr + + cdef _HelperInputVoidPtr _cyhandle + + + cdef _HelperInputVoidPtr _cyname + cdef class anon_union6: """ Attributes ---------- + fd : int - win32 : anon_struct12 + + + win32 : anon_struct13 + + nvSciSyncObj : Any + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st* _ptr - cdef anon_struct12 _win32 -{{endif}} -{{if 'struct CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st' in found_types}} + cdef cydriver.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st* _pvt_ptr + + cdef anon_struct13 _win32 + + + cdef _HelperInputVoidPtr _cynvSciSyncObj + cdef class CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st: """ @@ -2548,105 +3411,125 @@ cdef class CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st: Attributes ---------- + type : CUexternalSemaphoreHandleType Type of the handle + + handle : anon_union6 + + flags : unsigned int Flags reserved for the future. Must be zero. - reserved : List[unsigned int] + + + reserved : list[unsigned int] + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st* _val_ptr - cdef ccuda.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st* _ptr + cdef cydriver.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st* _val_ptr + cdef cydriver.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st* _pvt_ptr + cdef anon_union6 _handle -{{endif}} -{{if 'struct CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st' in found_types}} -cdef class anon_struct13: + +cdef class anon_struct14: """ Attributes ---------- + value : unsigned long long + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st* _ptr -{{endif}} -{{if 'struct CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st' in found_types}} + cdef cydriver.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st* _pvt_ptr cdef class anon_union7: """ Attributes ---------- + fence : Any + + reserved : unsigned long long + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st* _ptr -{{endif}} -{{if 'struct CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st' in found_types}} + cdef cydriver.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st* _pvt_ptr -cdef class anon_struct14: + cdef _HelperInputVoidPtr _cyfence + + +cdef class anon_struct15: """ Attributes ---------- + key : unsigned long long + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st* _ptr -{{endif}} -{{if 'struct CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st' in found_types}} + cdef cydriver.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st* _pvt_ptr -cdef class anon_struct15: +cdef class anon_struct16: """ Attributes ---------- - fence : anon_struct13 + + fence : anon_struct14 + + nvSciSync : anon_union7 - keyedMutex : anon_struct14 - reserved : List[unsigned int] + + keyedMutex : anon_struct15 + + + + reserved : list[unsigned int] + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st* _ptr - cdef anon_struct13 _fence + cdef cydriver.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st* _pvt_ptr + + cdef anon_struct14 _fence + + cdef anon_union7 _nvSciSync - cdef anon_struct14 _keyedMutex -{{endif}} -{{if 'struct CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st' in found_types}} + + + cdef anon_struct15 _keyedMutex + cdef class CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st: """ @@ -2654,112 +3537,132 @@ cdef class CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st: Attributes ---------- - params : anon_struct15 + + params : anon_struct16 + + flags : unsigned int - Only when ::CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS is used to signal - a CUexternalSemaphore of type + Only when CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS is used to signal a + CUexternalSemaphore of type CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC, the valid flag is CUDA_EXTERNAL_SEMAPHORE_SIGNAL_SKIP_NVSCIBUF_MEMSYNC which indicates that while signaling the CUexternalSemaphore, no memory synchronization operations should be performed for any external memory object imported as CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF. For all other types of CUexternalSemaphore, flags must be zero. - reserved : List[unsigned int] + + + reserved : list[unsigned int] + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st __val - cdef ccuda.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st* _ptr - cdef anon_struct15 _params -{{endif}} -{{if 'struct CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st' in found_types}} + cdef cydriver.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st _pvt_val + cdef cydriver.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st* _pvt_ptr -cdef class anon_struct16: + cdef anon_struct16 _params + + +cdef class anon_struct17: """ Attributes ---------- + value : unsigned long long + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st* _ptr -{{endif}} -{{if 'struct CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st' in found_types}} + cdef cydriver.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st* _pvt_ptr cdef class anon_union8: """ Attributes ---------- + fence : Any + + reserved : unsigned long long + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st* _ptr -{{endif}} -{{if 'struct CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st' in found_types}} + cdef cydriver.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st* _pvt_ptr -cdef class anon_struct17: + cdef _HelperInputVoidPtr _cyfence + + +cdef class anon_struct18: """ Attributes ---------- + key : unsigned long long + + timeoutMs : unsigned int + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st* _ptr -{{endif}} -{{if 'struct CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st' in found_types}} + cdef cydriver.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st* _pvt_ptr -cdef class anon_struct18: +cdef class anon_struct19: """ Attributes ---------- - fence : anon_struct16 + + fence : anon_struct17 + + nvSciSync : anon_union8 - keyedMutex : anon_struct17 - reserved : List[unsigned int] + + keyedMutex : anon_struct18 + + + + reserved : list[unsigned int] + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st* _ptr - cdef anon_struct16 _fence + cdef cydriver.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st* _pvt_ptr + + cdef anon_struct17 _fence + + cdef anon_union8 _nvSciSync - cdef anon_struct17 _keyedMutex -{{endif}} -{{if 'struct CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st' in found_types}} + + + cdef anon_struct18 _keyedMutex + cdef class CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st: """ @@ -2767,31 +3670,36 @@ cdef class CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st: Attributes ---------- - params : anon_struct18 + + params : anon_struct19 + + flags : unsigned int - Only when ::CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS is used to wait on - a CUexternalSemaphore of type + Only when CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS is used to wait on a + CUexternalSemaphore of type CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC, the valid flag is CUDA_EXTERNAL_SEMAPHORE_WAIT_SKIP_NVSCIBUF_MEMSYNC which indicates that while waiting for the CUexternalSemaphore, no memory synchronization operations should be performed for any external memory object imported as CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF. For all other types of CUexternalSemaphore, flags must be zero. - reserved : List[unsigned int] + + + reserved : list[unsigned int] + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st __val - cdef ccuda.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st* _ptr - cdef anon_struct18 _params -{{endif}} -{{if 'struct CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_st' in found_types}} + cdef cydriver.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st _pvt_val + cdef cydriver.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st* _pvt_ptr + + cdef anon_struct19 _params + cdef class CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_st: """ @@ -2799,30 +3707,35 @@ cdef class CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_st: Attributes ---------- + extSemArray : CUexternalSemaphore Array of external semaphore handles. + + paramsArray : CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS Array of external semaphore signal parameters. + + numExtSems : unsigned int Number of handles and parameters supplied in extSemArray and paramsArray. + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_st __val - cdef ccuda.CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_st* _ptr + cdef cydriver.CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_st _pvt_val + cdef cydriver.CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_st* _pvt_ptr + cdef size_t _extSemArray_length - cdef ccuda.CUexternalSemaphore* _extSemArray + cdef cydriver.CUexternalSemaphore* _extSemArray + cdef size_t _paramsArray_length - cdef ccuda.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS* _paramsArray + cdef cydriver.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS* _paramsArray -{{endif}} -{{if 'struct CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2_st' in found_types}} cdef class CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2_st: """ @@ -2830,30 +3743,35 @@ cdef class CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2_st: Attributes ---------- + extSemArray : CUexternalSemaphore Array of external semaphore handles. + + paramsArray : CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS Array of external semaphore signal parameters. + + numExtSems : unsigned int Number of handles and parameters supplied in extSemArray and paramsArray. + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2_st __val - cdef ccuda.CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2_st* _ptr + cdef cydriver.CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2_st _pvt_val + cdef cydriver.CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2_st* _pvt_ptr + cdef size_t _extSemArray_length - cdef ccuda.CUexternalSemaphore* _extSemArray + cdef cydriver.CUexternalSemaphore* _extSemArray + cdef size_t _paramsArray_length - cdef ccuda.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS* _paramsArray + cdef cydriver.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS* _paramsArray -{{endif}} -{{if 'struct CUDA_EXT_SEM_WAIT_NODE_PARAMS_st' in found_types}} cdef class CUDA_EXT_SEM_WAIT_NODE_PARAMS_st: """ @@ -2861,30 +3779,35 @@ cdef class CUDA_EXT_SEM_WAIT_NODE_PARAMS_st: Attributes ---------- + extSemArray : CUexternalSemaphore Array of external semaphore handles. + + paramsArray : CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS Array of external semaphore wait parameters. + + numExtSems : unsigned int Number of handles and parameters supplied in extSemArray and paramsArray. + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUDA_EXT_SEM_WAIT_NODE_PARAMS_st __val - cdef ccuda.CUDA_EXT_SEM_WAIT_NODE_PARAMS_st* _ptr + cdef cydriver.CUDA_EXT_SEM_WAIT_NODE_PARAMS_st _pvt_val + cdef cydriver.CUDA_EXT_SEM_WAIT_NODE_PARAMS_st* _pvt_ptr + cdef size_t _extSemArray_length - cdef ccuda.CUexternalSemaphore* _extSemArray + cdef cydriver.CUexternalSemaphore* _extSemArray + cdef size_t _paramsArray_length - cdef ccuda.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS* _paramsArray + cdef cydriver.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS* _paramsArray -{{endif}} -{{if 'struct CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2_st' in found_types}} cdef class CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2_st: """ @@ -2892,142 +3815,174 @@ cdef class CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2_st: Attributes ---------- + extSemArray : CUexternalSemaphore Array of external semaphore handles. + + paramsArray : CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS Array of external semaphore wait parameters. + + numExtSems : unsigned int Number of handles and parameters supplied in extSemArray and paramsArray. + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2_st __val - cdef ccuda.CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2_st* _ptr + cdef cydriver.CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2_st _pvt_val + cdef cydriver.CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2_st* _pvt_ptr + cdef size_t _extSemArray_length - cdef ccuda.CUexternalSemaphore* _extSemArray + cdef cydriver.CUexternalSemaphore* _extSemArray + cdef size_t _paramsArray_length - cdef ccuda.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS* _paramsArray + cdef cydriver.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS* _paramsArray -{{endif}} -{{if 'struct CUarrayMapInfo_st' in found_types}} cdef class anon_union9: """ Attributes ---------- + mipmap : CUmipmappedArray + + array : CUarray + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUarrayMapInfo_st* _ptr + cdef cydriver.CUarrayMapInfo_st* _pvt_ptr + cdef CUmipmappedArray _mipmap - cdef CUarray _array -{{endif}} -{{if 'struct CUarrayMapInfo_st' in found_types}} -cdef class anon_struct19: + + cdef CUarray _array + + +cdef class anon_struct20: """ Attributes ---------- + level : unsigned int + + layer : unsigned int + + offsetX : unsigned int + + offsetY : unsigned int + + offsetZ : unsigned int + + extentWidth : unsigned int + + extentHeight : unsigned int + + extentDepth : unsigned int + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUarrayMapInfo_st* _ptr -{{endif}} -{{if 'struct CUarrayMapInfo_st' in found_types}} + cdef cydriver.CUarrayMapInfo_st* _pvt_ptr -cdef class anon_struct20: +cdef class anon_struct21: """ Attributes ---------- + layer : unsigned int + + offset : unsigned long long + + size : unsigned long long + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUarrayMapInfo_st* _ptr -{{endif}} -{{if 'struct CUarrayMapInfo_st' in found_types}} + cdef cydriver.CUarrayMapInfo_st* _pvt_ptr cdef class anon_union10: """ Attributes ---------- - sparseLevel : anon_struct19 - miptail : anon_struct20 + sparseLevel : anon_struct20 + + + + miptail : anon_struct21 + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUarrayMapInfo_st* _ptr - cdef anon_struct19 _sparseLevel - cdef anon_struct20 _miptail -{{endif}} -{{if 'struct CUarrayMapInfo_st' in found_types}} + cdef cydriver.CUarrayMapInfo_st* _pvt_ptr + + cdef anon_struct20 _sparseLevel + + + cdef anon_struct21 _miptail + cdef class anon_union11: """ Attributes ---------- + memHandle : CUmemGenericAllocationHandle + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUarrayMapInfo_st* _ptr + cdef cydriver.CUarrayMapInfo_st* _pvt_ptr + cdef CUmemGenericAllocationHandle _memHandle -{{endif}} -{{if 'struct CUarrayMapInfo_st' in found_types}} + cdef class CUarrayMapInfo_st: """ @@ -3036,42 +3991,67 @@ cdef class CUarrayMapInfo_st: Attributes ---------- + resourceType : CUresourcetype Resource type + + resource : anon_union9 + + subresourceType : CUarraySparseSubresourceType Sparse subresource type + + subresource : anon_union10 + + memOperationType : CUmemOperationType Memory operation type + + memHandleType : CUmemHandleType Memory handle type + + memHandle : anon_union11 + + offset : unsigned long long Offset within mip tail Offset within the memory + + deviceBitMask : unsigned int Device ordinal bit mask + + flags : unsigned int flags for future use, must be zero now. - reserved : List[unsigned int] + + + reserved : list[unsigned int] Reserved for future use, must be zero now. + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUarrayMapInfo_st* _val_ptr - cdef ccuda.CUarrayMapInfo_st* _ptr + cdef cydriver.CUarrayMapInfo_st* _val_ptr + cdef cydriver.CUarrayMapInfo_st* _pvt_ptr + cdef anon_union9 _resource + + cdef anon_union10 _subresource + + cdef anon_union11 _memHandle -{{endif}} -{{if 'struct CUmemLocation_st' in found_types}} + cdef class CUmemLocation_st: """ @@ -3079,44 +4059,52 @@ cdef class CUmemLocation_st: Attributes ---------- + type : CUmemLocationType Specifies the location type, which modifies the meaning of id. + + id : int - identifier for a given this location's CUmemLocationType. + Identifier for CUmemLocationType::CU_MEM_LOCATION_TYPE_DEVICE, + CUmemLocationType::CU_MEM_LOCATION_TYPE_HOST, + CUmemLocationType::CU_MEM_LOCATION_TYPE_HOST_NUMA. + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUmemLocation_st __val - cdef ccuda.CUmemLocation_st* _ptr -{{endif}} -{{if 'struct CUmemAllocationProp_st' in found_types}} + cdef cydriver.CUmemLocation_st* _val_ptr + cdef cydriver.CUmemLocation_st* _pvt_ptr -cdef class anon_struct21: +cdef class anon_struct22: """ Attributes ---------- + compressionType : bytes + + gpuDirectRDMACapable : bytes + + usage : unsigned short + + reserved : bytes + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUmemAllocationProp_st* _ptr -{{endif}} -{{if 'struct CUmemAllocationProp_st' in found_types}} + cdef cydriver.CUmemAllocationProp_st* _pvt_ptr cdef class CUmemAllocationProp_st: """ @@ -3124,33 +4112,47 @@ cdef class CUmemAllocationProp_st: Attributes ---------- + type : CUmemAllocationType Allocation type + + requestedHandleTypes : CUmemAllocationHandleType requested CUmemAllocationHandleType + + location : CUmemLocation Location of allocation + + win32HandleMetaData : Any Windows-specific POBJECT_ATTRIBUTES required when CU_MEM_HANDLE_TYPE_WIN32 is specified. This object attributes structure includes security attributes that define the scope of which exported allocations may be transferred to other processes. In all other cases, this field is required to be zero. - allocFlags : anon_struct21 + + + allocFlags : anon_struct22 + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUmemAllocationProp_st __val - cdef ccuda.CUmemAllocationProp_st* _ptr + cdef cydriver.CUmemAllocationProp_st _pvt_val + cdef cydriver.CUmemAllocationProp_st* _pvt_ptr + cdef CUmemLocation _location - cdef anon_struct21 _allocFlags -{{endif}} -{{if 'struct CUmulticastObjectProp_st' in found_types}} + + + cdef _HelperInputVoidPtr _cywin32HandleMetaData + + + cdef anon_struct22 _allocFlags + cdef class CUmulticastObjectProp_st: """ @@ -3158,28 +4160,33 @@ cdef class CUmulticastObjectProp_st: Attributes ---------- + numDevices : unsigned int The number of devices in the multicast team that will bind memory to this object + + size : size_t The maximum amount of memory that can be bound to this multicast object per device + + handleTypes : unsigned long long Bitmask of exportable handle types (see CUmemAllocationHandleType) for this object + + flags : unsigned long long Flags for future use, must be zero now + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUmulticastObjectProp_st __val - cdef ccuda.CUmulticastObjectProp_st* _ptr -{{endif}} -{{if 'struct CUmemAccessDesc_st' in found_types}} + cdef cydriver.CUmulticastObjectProp_st _pvt_val + cdef cydriver.CUmulticastObjectProp_st* _pvt_ptr cdef class CUmemAccessDesc_st: """ @@ -3187,22 +4194,25 @@ cdef class CUmemAccessDesc_st: Attributes ---------- + location : CUmemLocation Location on which the request is to change it's accessibility + + flags : CUmemAccess_flags ::CUmemProt accessibility flags to set on the request + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUmemAccessDesc_st __val - cdef ccuda.CUmemAccessDesc_st* _ptr + cdef cydriver.CUmemAccessDesc_st _pvt_val + cdef cydriver.CUmemAccessDesc_st* _pvt_ptr + cdef CUmemLocation _location -{{endif}} -{{if 'struct CUgraphExecUpdateResultInfo_st' in found_types}} + cdef class CUgraphExecUpdateResultInfo_st: """ @@ -3210,28 +4220,35 @@ cdef class CUgraphExecUpdateResultInfo_st: Attributes ---------- + result : CUgraphExecUpdateResult Gives more specific detail when a cuda graph update fails. + + errorNode : CUgraphNode The "to node" of the error edge when the topologies do not match. The error node when the error is associated with a specific node. NULL when the error is generic. + + errorFromNode : CUgraphNode The from node of error edge when the topologies do not match. Otherwise NULL. + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUgraphExecUpdateResultInfo_st __val - cdef ccuda.CUgraphExecUpdateResultInfo_st* _ptr + cdef cydriver.CUgraphExecUpdateResultInfo_st _pvt_val + cdef cydriver.CUgraphExecUpdateResultInfo_st* _pvt_ptr + cdef CUgraphNode _errorNode + + cdef CUgraphNode _errorFromNode -{{endif}} -{{if 'struct CUmemPoolProps_st' in found_types}} + cdef class CUmemPoolProps_st: """ @@ -3239,36 +4256,54 @@ cdef class CUmemPoolProps_st: Attributes ---------- + allocType : CUmemAllocationType Allocation type. Currently must be specified as CU_MEM_ALLOCATION_TYPE_PINNED + + handleTypes : CUmemAllocationHandleType Handle types that will be supported by allocations from the pool. + + location : CUmemLocation Location where allocations should reside. + + win32SecurityAttributes : Any Windows-specific LPSECURITYATTRIBUTES required when CU_MEM_HANDLE_TYPE_WIN32 is specified. This security attribute defines the scope of which exported allocations may be transferred to other processes. In all other cases, this field is required to be zero. + + maxSize : size_t Maximum pool size. When set to 0, defaults to a system dependent value. + + + usage : unsigned short + Bitmask indicating intended usage for the pool. + + reserved : bytes reserved for future use, must be 0 + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUmemPoolProps_st __val - cdef ccuda.CUmemPoolProps_st* _ptr + cdef cydriver.CUmemPoolProps_st _pvt_val + cdef cydriver.CUmemPoolProps_st* _pvt_ptr + cdef CUmemLocation _location -{{endif}} -{{if 'struct CUmemPoolPtrExportData_st' in found_types}} + + + cdef _HelperInputVoidPtr _cywin32SecurityAttributes + cdef class CUmemPoolPtrExportData_st: """ @@ -3276,1578 +4311,1148 @@ cdef class CUmemPoolPtrExportData_st: Attributes ---------- + reserved : bytes + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUmemPoolPtrExportData_st __val - cdef ccuda.CUmemPoolPtrExportData_st* _ptr -{{endif}} -{{if 'struct CUDA_MEM_ALLOC_NODE_PARAMS_v1_st' in found_types}} + cdef cydriver.CUmemPoolPtrExportData_st _pvt_val + cdef cydriver.CUmemPoolPtrExportData_st* _pvt_ptr -cdef class CUDA_MEM_ALLOC_NODE_PARAMS_v1_st: +cdef class CUmemcpyAttributes_st: """ - Memory allocation node parameters + Attributes specific to copies within a batch. For more details on + usage see cuMemcpyBatchAsync. Attributes ---------- - poolProps : CUmemPoolProps - in: location where the allocation should reside (specified in - ::location). ::handleTypes must be CU_MEM_HANDLE_TYPE_NONE. IPC is - not supported. - accessDescs : CUmemAccessDesc - in: array of memory access descriptors. Used to describe peer GPU - access - accessDescCount : size_t - in: number of memory access descriptors. Must not exceed the number - of GPUs. - bytesize : size_t - in: size in bytes of the requested allocation - dptr : CUdeviceptr - out: address of the allocation returned by CUDA - Methods - ------- - getPtr() - Get memory address of class instance + srcAccessOrder : CUmemcpySrcAccessOrder + Source access ordering to be observed for copies with this + attribute. - """ - cdef ccuda.CUDA_MEM_ALLOC_NODE_PARAMS_v1_st __val - cdef ccuda.CUDA_MEM_ALLOC_NODE_PARAMS_v1_st* _ptr - cdef CUmemPoolProps _poolProps - cdef size_t _accessDescs_length - cdef ccuda.CUmemAccessDesc* _accessDescs - cdef CUdeviceptr _dptr -{{endif}} -{{if 'struct CUDA_MEM_ALLOC_NODE_PARAMS_v2_st' in found_types}} + srcLocHint : CUmemLocation + Hint location for the source operand. Ignored when the pointers are + not managed memory or memory allocated outside CUDA. -cdef class CUDA_MEM_ALLOC_NODE_PARAMS_v2_st: - """ - Memory allocation node parameters - Attributes - ---------- - poolProps : CUmemPoolProps - in: location where the allocation should reside (specified in - ::location). ::handleTypes must be CU_MEM_HANDLE_TYPE_NONE. IPC is - not supported. - accessDescs : CUmemAccessDesc - in: array of memory access descriptors. Used to describe peer GPU - access - accessDescCount : size_t - in: number of memory access descriptors. Must not exceed the number - of GPUs. - bytesize : size_t - in: size in bytes of the requested allocation - dptr : CUdeviceptr - out: address of the allocation returned by CUDA + dstLocHint : CUmemLocation + Hint location for the destination operand. Ignored when the + pointers are not managed memory or memory allocated outside CUDA. + + + flags : unsigned int + Additional flags for copies with this attribute. See CUmemcpyFlags + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUDA_MEM_ALLOC_NODE_PARAMS_v2_st __val - cdef ccuda.CUDA_MEM_ALLOC_NODE_PARAMS_v2_st* _ptr - cdef CUmemPoolProps _poolProps - cdef size_t _accessDescs_length - cdef ccuda.CUmemAccessDesc* _accessDescs + cdef cydriver.CUmemcpyAttributes_st _pvt_val + cdef cydriver.CUmemcpyAttributes_st* _pvt_ptr - cdef CUdeviceptr _dptr -{{endif}} -{{if 'struct CUDA_MEM_FREE_NODE_PARAMS_st' in found_types}} + cdef CUmemLocation _srcLocHint -cdef class CUDA_MEM_FREE_NODE_PARAMS_st: + + cdef CUmemLocation _dstLocHint + + +cdef class CUoffset3D_st: """ - Memory free node parameters + Struct representing a 3D offset Attributes ---------- - dptr : CUdeviceptr - in: the pointer to free - Methods - ------- - getPtr() - Get memory address of class instance + x : size_t - """ - cdef ccuda.CUDA_MEM_FREE_NODE_PARAMS_st __val - cdef ccuda.CUDA_MEM_FREE_NODE_PARAMS_st* _ptr - cdef CUdeviceptr _dptr -{{endif}} -{{if 'struct CUDA_CHILD_GRAPH_NODE_PARAMS_st' in found_types}} -cdef class CUDA_CHILD_GRAPH_NODE_PARAMS_st: - """ - Child graph node parameters - Attributes - ---------- - graph : CUgraph - The child graph to clone into the node for node creation, or a - handle to the graph owned by the node for node query + y : size_t + + + + z : size_t + + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUDA_CHILD_GRAPH_NODE_PARAMS_st __val - cdef ccuda.CUDA_CHILD_GRAPH_NODE_PARAMS_st* _ptr - cdef CUgraph _graph -{{endif}} -{{if 'struct CUDA_EVENT_RECORD_NODE_PARAMS_st' in found_types}} + cdef cydriver.CUoffset3D_st _pvt_val + cdef cydriver.CUoffset3D_st* _pvt_ptr -cdef class CUDA_EVENT_RECORD_NODE_PARAMS_st: +cdef class CUextent3D_st: """ - Event record node parameters + Struct representing width/height/depth of a CUarray in elements Attributes ---------- - event : CUevent - The event to record when the node executes + + width : size_t + + + + height : size_t + + + + depth : size_t + + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUDA_EVENT_RECORD_NODE_PARAMS_st __val - cdef ccuda.CUDA_EVENT_RECORD_NODE_PARAMS_st* _ptr - cdef CUevent _event -{{endif}} -{{if 'struct CUDA_EVENT_WAIT_NODE_PARAMS_st' in found_types}} + cdef cydriver.CUextent3D_st _pvt_val + cdef cydriver.CUextent3D_st* _pvt_ptr -cdef class CUDA_EVENT_WAIT_NODE_PARAMS_st: +cdef class anon_struct23: """ - Event wait node parameters - Attributes ---------- - event : CUevent - The event to wait on from the node - Methods - ------- - getPtr() - Get memory address of class instance + ptr : CUdeviceptr - """ - cdef ccuda.CUDA_EVENT_WAIT_NODE_PARAMS_st __val - cdef ccuda.CUDA_EVENT_WAIT_NODE_PARAMS_st* _ptr - cdef CUevent _event -{{endif}} -{{if 'struct CUgraphNodeParams_st' in found_types}} -cdef class CUgraphNodeParams_st: - """ - Graph node parameters. See cuGraphAddNode. - Attributes - ---------- - type : CUgraphNodeType - Type of the node - reserved0 : List[int] - Reserved. Must be zero. - reserved1 : List[long long] - Padding. Unused bytes must be zero. - kernel : CUDA_KERNEL_NODE_PARAMS_v3 - Kernel node parameters. - memcpy : CUDA_MEMCPY_NODE_PARAMS - Memcpy node parameters. - memset : CUDA_MEMSET_NODE_PARAMS_v2 - Memset node parameters. - host : CUDA_HOST_NODE_PARAMS_v2 - Host node parameters. - graph : CUDA_CHILD_GRAPH_NODE_PARAMS - Child graph node parameters. - eventWait : CUDA_EVENT_WAIT_NODE_PARAMS - Event wait node parameters. - eventRecord : CUDA_EVENT_RECORD_NODE_PARAMS - Event record node parameters. - extSemSignal : CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2 - External semaphore signal node parameters. - extSemWait : CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2 - External semaphore wait node parameters. - alloc : CUDA_MEM_ALLOC_NODE_PARAMS_v2 - Memory allocation node parameters. - free : CUDA_MEM_FREE_NODE_PARAMS - Memory free node parameters. - memOp : CUDA_BATCH_MEM_OP_NODE_PARAMS_v2 - MemOp node parameters. - conditional : CUDA_CONDITIONAL_NODE_PARAMS - Conditional node parameters. - reserved2 : long long - Reserved bytes. Must be zero. + rowLength : size_t - Methods - ------- - getPtr() - Get memory address of class instance - """ - cdef ccuda.CUgraphNodeParams_st* _val_ptr - cdef ccuda.CUgraphNodeParams_st* _ptr - cdef CUDA_KERNEL_NODE_PARAMS_v3 _kernel - cdef CUDA_MEMCPY_NODE_PARAMS _memcpy - cdef CUDA_MEMSET_NODE_PARAMS_v2 _memset - cdef CUDA_HOST_NODE_PARAMS_v2 _host - cdef CUDA_CHILD_GRAPH_NODE_PARAMS _graph - cdef CUDA_EVENT_WAIT_NODE_PARAMS _eventWait - cdef CUDA_EVENT_RECORD_NODE_PARAMS _eventRecord - cdef CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2 _extSemSignal - cdef CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2 _extSemWait - cdef CUDA_MEM_ALLOC_NODE_PARAMS_v2 _alloc - cdef CUDA_MEM_FREE_NODE_PARAMS _free - cdef CUDA_BATCH_MEM_OP_NODE_PARAMS_v2 _memOp - cdef CUDA_CONDITIONAL_NODE_PARAMS _conditional -{{endif}} -{{if 'struct CUdevSmResource_st' in found_types}} -cdef class CUdevSmResource_st: - """ - Attributes - ---------- - smCount : unsigned int - The amount of streaming multiprocessors available in this resource. - This is an output parameter only, do not write to this field. + layerHeight : size_t - Methods - ------- - getPtr() - Get memory address of class instance - """ - cdef ccuda.CUdevSmResource_st __val - cdef ccuda.CUdevSmResource_st* _ptr -{{endif}} -{{if 'struct CUdevResource_st' in found_types}} -cdef class CUdevResource_st: - """ - Attributes - ---------- - type : CUdevResourceType - Type of resource, dictates which union field was last set - _internal_padding : bytes + locHint : CUmemLocation - sm : CUdevSmResource - Resource corresponding to CU_DEV_RESOURCE_TYPE_SM ``. type. - _oversize : bytes Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUdevResource_st* _val_ptr - cdef ccuda.CUdevResource_st* _ptr - cdef CUdevSmResource _sm -{{endif}} -{{if True}} - -cdef class anon_union14: - """ - Attributes - ---------- - pArray : List[CUarray] + cdef cydriver.CUmemcpy3DOperand_st* _pvt_ptr - pPitch : List[Any] + cdef CUdeviceptr _ptr - Methods - ------- - getPtr() - Get memory address of class instance + cdef CUmemLocation _locHint - """ - cdef ccuda.CUeglFrame_st* _ptr -{{endif}} -{{if True}} -cdef class CUeglFrame_st: +cdef class anon_struct24: """ - CUDA EGLFrame structure Descriptor - structure defining one frame - of EGL. Each frame may contain one or more planes depending on - whether the surface * is Multiplanar or not. - Attributes ---------- - frame : anon_union14 - width : unsigned int - Width of first plane - height : unsigned int - Height of first plane - depth : unsigned int - Depth of first plane - pitch : unsigned int - Pitch of first plane - planeCount : unsigned int - Number of planes - numChannels : unsigned int - Number of channels for the plane - frameType : CUeglFrameType - Array or Pitch - eglColorFormat : CUeglColorFormat - CUDA EGL Color Format - cuFormat : CUarray_format - CUDA Array Format + array : CUarray - Methods - ------- - getPtr() - Get memory address of class instance - """ - cdef ccuda.CUeglFrame_st* _val_ptr - cdef ccuda.CUeglFrame_st* _ptr - cdef anon_union14 _frame -{{endif}} -{{if 'CUdeviceptr' in found_types}} -cdef class CUdeviceptr: - """ + offset : CUoffset3D + - CUDA device pointer CUdeviceptr is defined as an unsigned integer type whose size matches the size of a pointer on the target platform. Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUdeviceptr __val - cdef ccuda.CUdeviceptr* _ptr -{{endif}} -{{if 'CUdevice' in found_types}} + cdef cydriver.CUmemcpy3DOperand_st* _pvt_ptr -cdef class CUdevice: - """ + cdef CUarray _array - CUDA device - Methods - ------- - getPtr() - Get memory address of class instance + cdef CUoffset3D _offset - """ - cdef ccuda.CUdevice __val - cdef ccuda.CUdevice* _ptr -{{endif}} -{{if 'CUtexObject' in found_types}} -cdef class CUtexObject: +cdef class anon_union13: """ + Attributes + ---------- - An opaque value that represents a CUDA texture object - - Methods - ------- - getPtr() - Get memory address of class instance - - """ - cdef ccuda.CUtexObject __val - cdef ccuda.CUtexObject* _ptr -{{endif}} -{{if 'CUsurfObject' in found_types}} + ptr : anon_struct23 -cdef class CUsurfObject: - """ - An opaque value that represents a CUDA surface object - Methods - ------- - getPtr() - Get memory address of class instance + array : anon_struct24 - """ - cdef ccuda.CUsurfObject __val - cdef ccuda.CUsurfObject* _ptr -{{endif}} -{{if 'CUgraphConditionalHandle' in found_types}} -cdef class CUgraphConditionalHandle: - """ Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUgraphConditionalHandle __val - cdef ccuda.CUgraphConditionalHandle* _ptr -{{endif}} -{{if 'CUuuid' in found_types}} + cdef cydriver.CUmemcpy3DOperand_st* _pvt_ptr -cdef class CUuuid(CUuuid_st): - """ - Attributes - ---------- - bytes : bytes - < CUDA definition of UUID + cdef anon_struct23 _ptr - Methods - ------- - getPtr() - Get memory address of class instance - """ - pass -{{endif}} -{{if 'CUmemFabricHandle_v1' in found_types}} + cdef anon_struct24 _array -cdef class CUmemFabricHandle_v1(CUmemFabricHandle_st): + +cdef class CUmemcpy3DOperand_st: """ - Fabric handle - An opaque handle representing a memory allocation - that can be exported to processes in same or different nodes. For - IPC between processes on different nodes they must be connected via - the NVSwitch fabric. + Struct representing an operand for copy with cuMemcpy3DBatchAsync Attributes ---------- - data : bytes + type : CUmemcpy3DOperandType - Methods - ------- - getPtr() - Get memory address of class instance - """ - pass -{{endif}} -{{if 'CUmemFabricHandle' in found_types}} -cdef class CUmemFabricHandle(CUmemFabricHandle_v1): - """ - Fabric handle - An opaque handle representing a memory allocation - that can be exported to processes in same or different nodes. For - IPC between processes on different nodes they must be connected via - the NVSwitch fabric. + op : anon_union13 - Attributes - ---------- - data : bytes Methods ------- getPtr() Get memory address of class instance - """ - pass -{{endif}} -{{if 'CUipcEventHandle_v1' in found_types}} + cdef cydriver.CUmemcpy3DOperand_st* _val_ptr + cdef cydriver.CUmemcpy3DOperand_st* _pvt_ptr -cdef class CUipcEventHandle_v1(CUipcEventHandle_st): - """ - CUDA IPC event handle + cdef anon_union13 _op + +cdef class CUDA_MEMCPY3D_BATCH_OP_st: + """ Attributes ---------- - reserved : bytes - - Methods - ------- - getPtr() - Get memory address of class instance + src : CUmemcpy3DOperand + Source memcpy operand. - """ - pass -{{endif}} -{{if 'CUipcEventHandle' in found_types}} -cdef class CUipcEventHandle(CUipcEventHandle_v1): - """ - CUDA IPC event handle + dst : CUmemcpy3DOperand + Destination memcpy operand. - Attributes - ---------- - reserved : bytes + extent : CUextent3D + Extents of the memcpy between src and dst. The width, height and + depth components must not be 0. - Methods - ------- - getPtr() - Get memory address of class instance - """ - pass -{{endif}} -{{if 'CUipcMemHandle_v1' in found_types}} + srcAccessOrder : CUmemcpySrcAccessOrder + Source access ordering to be observed for copy from src to dst. -cdef class CUipcMemHandle_v1(CUipcMemHandle_st): - """ - CUDA IPC mem handle - Attributes - ---------- - reserved : bytes + flags : unsigned int + Additional flags for copies with this attribute. See CUmemcpyFlags Methods ------- getPtr() Get memory address of class instance - """ - pass -{{endif}} -{{if 'CUipcMemHandle' in found_types}} + cdef cydriver.CUDA_MEMCPY3D_BATCH_OP_st _pvt_val + cdef cydriver.CUDA_MEMCPY3D_BATCH_OP_st* _pvt_ptr -cdef class CUipcMemHandle(CUipcMemHandle_v1): - """ - CUDA IPC mem handle + cdef CUmemcpy3DOperand _src - Attributes - ---------- - reserved : bytes + cdef CUmemcpy3DOperand _dst - Methods - ------- - getPtr() - Get memory address of class instance - """ - pass -{{endif}} -{{if 'CUstreamBatchMemOpParams_v1' in found_types}} + cdef CUextent3D _extent -cdef class CUstreamBatchMemOpParams_v1(CUstreamBatchMemOpParams_union): + +cdef class CUDA_MEM_ALLOC_NODE_PARAMS_v1_st: """ - Per-operation parameters for cuStreamBatchMemOp + Memory allocation node parameters Attributes ---------- - operation : CUstreamBatchMemOpType - - waitValue : CUstreamMemOpWaitValueParams_st - writeValue : CUstreamMemOpWriteValueParams_st + poolProps : CUmemPoolProps + in: location where the allocation should reside (specified in + ::location). ::handleTypes must be CU_MEM_HANDLE_TYPE_NONE. IPC is + not supported. - flushRemoteWrites : CUstreamMemOpFlushRemoteWritesParams_st - memoryBarrier : CUstreamMemOpMemoryBarrierParams_st + accessDescs : CUmemAccessDesc + in: array of memory access descriptors. Used to describe peer GPU + access + + + accessDescCount : size_t + in: number of memory access descriptors. Must not exceed the number + of GPUs. - pad : List[cuuint64_t] + + bytesize : size_t + in: size in bytes of the requested allocation + + + dptr : CUdeviceptr + out: address of the allocation returned by CUDA Methods ------- getPtr() Get memory address of class instance - """ - pass -{{endif}} -{{if 'CUstreamBatchMemOpParams' in found_types}} - -cdef class CUstreamBatchMemOpParams(CUstreamBatchMemOpParams_v1): - """ - Per-operation parameters for cuStreamBatchMemOp - - Attributes - ---------- - operation : CUstreamBatchMemOpType - - waitValue : CUstreamMemOpWaitValueParams_st + cdef cydriver.CUDA_MEM_ALLOC_NODE_PARAMS_v1_st _pvt_val + cdef cydriver.CUDA_MEM_ALLOC_NODE_PARAMS_v1_st* _pvt_ptr - writeValue : CUstreamMemOpWriteValueParams_st + cdef CUmemPoolProps _poolProps - flushRemoteWrites : CUstreamMemOpFlushRemoteWritesParams_st - memoryBarrier : CUstreamMemOpMemoryBarrierParams_st + cdef size_t _accessDescs_length + cdef cydriver.CUmemAccessDesc* _accessDescs - pad : List[cuuint64_t] + cdef CUdeviceptr _dptr - Methods - ------- - getPtr() - Get memory address of class instance +cdef class CUDA_MEM_ALLOC_NODE_PARAMS_v2_st: """ - pass -{{endif}} -{{if 'CUDA_BATCH_MEM_OP_NODE_PARAMS_v1' in found_types}} + Memory allocation node parameters -cdef class CUDA_BATCH_MEM_OP_NODE_PARAMS_v1(CUDA_BATCH_MEM_OP_NODE_PARAMS_v1_st): - """ Attributes ---------- - ctx : CUcontext - - count : unsigned int - paramArray : CUstreamBatchMemOpParams + poolProps : CUmemPoolProps + in: location where the allocation should reside (specified in + ::location). ::handleTypes must be CU_MEM_HANDLE_TYPE_NONE. IPC is + not supported. - flags : unsigned int + accessDescs : CUmemAccessDesc + in: array of memory access descriptors. Used to describe peer GPU + access - Methods - ------- - getPtr() - Get memory address of class instance - """ - pass -{{endif}} -{{if 'CUDA_BATCH_MEM_OP_NODE_PARAMS' in found_types}} + accessDescCount : size_t + in: number of memory access descriptors. Must not exceed the number + of GPUs. -cdef class CUDA_BATCH_MEM_OP_NODE_PARAMS(CUDA_BATCH_MEM_OP_NODE_PARAMS_v1): - """ - Attributes - ---------- - ctx : CUcontext - count : unsigned int + bytesize : size_t + in: size in bytes of the requested allocation - paramArray : CUstreamBatchMemOpParams - flags : unsigned int + dptr : CUdeviceptr + out: address of the allocation returned by CUDA Methods ------- getPtr() Get memory address of class instance - """ - pass -{{endif}} -{{if 'CUDA_BATCH_MEM_OP_NODE_PARAMS_v2' in found_types}} + cdef cydriver.CUDA_MEM_ALLOC_NODE_PARAMS_v2_st _pvt_val + cdef cydriver.CUDA_MEM_ALLOC_NODE_PARAMS_v2_st* _pvt_ptr -cdef class CUDA_BATCH_MEM_OP_NODE_PARAMS_v2(CUDA_BATCH_MEM_OP_NODE_PARAMS_v2_st): - """ - Batch memory operation node parameters + cdef CUmemPoolProps _poolProps - Attributes - ---------- - ctx : CUcontext - Context to use for the operations. - count : unsigned int - Number of operations in paramArray. - paramArray : CUstreamBatchMemOpParams - Array of batch memory operations. - flags : unsigned int - Flags to control the node. - Methods - ------- - getPtr() - Get memory address of class instance + cdef size_t _accessDescs_length + cdef cydriver.CUmemAccessDesc* _accessDescs - """ - pass -{{endif}} -{{if 'CUasyncNotificationInfo' in found_types}} -cdef class CUasyncNotificationInfo(CUasyncNotificationInfo_st): + cdef CUdeviceptr _dptr + + +cdef class CUDA_MEM_FREE_NODE_PARAMS_st: """ - Information passed to the user via the async notification callback + Memory free node parameters Attributes ---------- - type : CUasyncNotificationType - info : anon_union2 + dptr : CUdeviceptr + in: the pointer to free Methods ------- getPtr() Get memory address of class instance - """ - pass -{{endif}} -{{if 'CUdevprop_v1' in found_types}} + cdef cydriver.CUDA_MEM_FREE_NODE_PARAMS_st _pvt_val + cdef cydriver.CUDA_MEM_FREE_NODE_PARAMS_st* _pvt_ptr -cdef class CUdevprop_v1(CUdevprop_st): + cdef CUdeviceptr _dptr + + +cdef class CUDA_CHILD_GRAPH_NODE_PARAMS_st: """ - Legacy device properties + Child graph node parameters Attributes ---------- - maxThreadsPerBlock : int - Maximum number of threads per block - maxThreadsDim : List[int] - Maximum size of each dimension of a block - maxGridSize : List[int] - Maximum size of each dimension of a grid - sharedMemPerBlock : int - Shared memory available per block in bytes - totalConstantMemory : int - Constant memory available on device in bytes - SIMDWidth : int - Warp size in threads - memPitch : int - Maximum pitch in bytes allowed by memory copies - regsPerBlock : int - 32-bit registers available per block - clockRate : int - Clock frequency in kilohertz - textureAlign : int - Alignment requirement for textures - Methods - ------- - getPtr() - Get memory address of class instance + graph : CUgraph + The child graph to clone into the node for node creation, or a + handle to the graph owned by the node for node query. The graph + must not contain conditional nodes. Graphs containing memory + allocation or memory free nodes must set the ownership to be moved + to the parent. - """ - pass -{{endif}} -{{if 'CUdevprop' in found_types}} -cdef class CUdevprop(CUdevprop_v1): - """ - Legacy device properties + ownership : CUgraphChildGraphNodeOwnership + The ownership relationship of the child graph node. - Attributes - ---------- - maxThreadsPerBlock : int - Maximum number of threads per block - maxThreadsDim : List[int] - Maximum size of each dimension of a block - maxGridSize : List[int] - Maximum size of each dimension of a grid - sharedMemPerBlock : int - Shared memory available per block in bytes - totalConstantMemory : int - Constant memory available on device in bytes - SIMDWidth : int - Warp size in threads - memPitch : int - Maximum pitch in bytes allowed by memory copies - regsPerBlock : int - 32-bit registers available per block - clockRate : int - Clock frequency in kilohertz - textureAlign : int - Alignment requirement for textures Methods ------- getPtr() Get memory address of class instance - """ - pass -{{endif}} -{{if 'CUaccessPolicyWindow_v1' in found_types}} + cdef cydriver.CUDA_CHILD_GRAPH_NODE_PARAMS_st _pvt_val + cdef cydriver.CUDA_CHILD_GRAPH_NODE_PARAMS_st* _pvt_ptr -cdef class CUaccessPolicyWindow_v1(CUaccessPolicyWindow_st): + cdef CUgraph _graph + + +cdef class CUDA_EVENT_RECORD_NODE_PARAMS_st: """ - Specifies an access policy for a window, a contiguous extent of - memory beginning at base_ptr and ending at base_ptr + num_bytes. - num_bytes is limited by - CU_DEVICE_ATTRIBUTE_MAX_ACCESS_POLICY_WINDOW_SIZE. Partition into - many segments and assign segments such that: sum of "hit segments" - / window == approx. ratio. sum of "miss segments" / window == - approx 1-ratio. Segments and ratio specifications are fitted to the - capabilities of the architecture. Accesses in a hit segment apply - the hitProp access policy. Accesses in a miss segment apply the - missProp access policy. + Event record node parameters Attributes ---------- - base_ptr : Any - Starting address of the access policy window. CUDA driver may align - it. - num_bytes : size_t - Size in bytes of the window policy. CUDA driver may restrict the - maximum size and alignment. - hitRatio : float - hitRatio specifies percentage of lines assigned hitProp, rest are - assigned missProp. - hitProp : CUaccessProperty - CUaccessProperty set for hit. - missProp : CUaccessProperty - CUaccessProperty set for miss. Must be either NORMAL or STREAMING + + event : CUevent + The event to record when the node executes + Methods ------- getPtr() Get memory address of class instance - """ - pass -{{endif}} -{{if 'CUaccessPolicyWindow' in found_types}} + cdef cydriver.CUDA_EVENT_RECORD_NODE_PARAMS_st _pvt_val + cdef cydriver.CUDA_EVENT_RECORD_NODE_PARAMS_st* _pvt_ptr -cdef class CUaccessPolicyWindow(CUaccessPolicyWindow_v1): + cdef CUevent _event + + +cdef class CUDA_EVENT_WAIT_NODE_PARAMS_st: """ - Specifies an access policy for a window, a contiguous extent of - memory beginning at base_ptr and ending at base_ptr + num_bytes. - num_bytes is limited by - CU_DEVICE_ATTRIBUTE_MAX_ACCESS_POLICY_WINDOW_SIZE. Partition into - many segments and assign segments such that: sum of "hit segments" - / window == approx. ratio. sum of "miss segments" / window == - approx 1-ratio. Segments and ratio specifications are fitted to the - capabilities of the architecture. Accesses in a hit segment apply - the hitProp access policy. Accesses in a miss segment apply the - missProp access policy. + Event wait node parameters Attributes ---------- - base_ptr : Any - Starting address of the access policy window. CUDA driver may align - it. - num_bytes : size_t - Size in bytes of the window policy. CUDA driver may restrict the - maximum size and alignment. - hitRatio : float - hitRatio specifies percentage of lines assigned hitProp, rest are - assigned missProp. - hitProp : CUaccessProperty - CUaccessProperty set for hit. - missProp : CUaccessProperty - CUaccessProperty set for miss. Must be either NORMAL or STREAMING + + event : CUevent + The event to wait on from the node + Methods ------- getPtr() Get memory address of class instance - """ - pass -{{endif}} -{{if 'CUDA_KERNEL_NODE_PARAMS_v1' in found_types}} + cdef cydriver.CUDA_EVENT_WAIT_NODE_PARAMS_st _pvt_val + cdef cydriver.CUDA_EVENT_WAIT_NODE_PARAMS_st* _pvt_ptr -cdef class CUDA_KERNEL_NODE_PARAMS_v1(CUDA_KERNEL_NODE_PARAMS_st): + cdef CUevent _event + + +cdef class CUgraphNodeParams_st: """ - GPU kernel node parameters + Graph node parameters. See cuGraphAddNode. Attributes ---------- - func : CUfunction - Kernel to launch - gridDimX : unsigned int - Width of grid in blocks - gridDimY : unsigned int - Height of grid in blocks - gridDimZ : unsigned int - Depth of grid in blocks - blockDimX : unsigned int - X dimension of each thread block - blockDimY : unsigned int - Y dimension of each thread block - blockDimZ : unsigned int - Z dimension of each thread block - sharedMemBytes : unsigned int - Dynamic shared-memory size per thread block in bytes - kernelParams : Any - Array of pointers to kernel parameters - extra : Any - Extra options + + type : CUgraphNodeType + Type of the node + + + reserved0 : list[int] + Reserved. Must be zero. + + + reserved1 : list[long long] + Padding. Unused bytes must be zero. + + + kernel : CUDA_KERNEL_NODE_PARAMS_v3 + Kernel node parameters. + + + memcpy : CUDA_MEMCPY_NODE_PARAMS + Memcpy node parameters. + + + memset : CUDA_MEMSET_NODE_PARAMS_v2 + Memset node parameters. + + + host : CUDA_HOST_NODE_PARAMS_v2 + Host node parameters. + + + graph : CUDA_CHILD_GRAPH_NODE_PARAMS + Child graph node parameters. + + + eventWait : CUDA_EVENT_WAIT_NODE_PARAMS + Event wait node parameters. + + + eventRecord : CUDA_EVENT_RECORD_NODE_PARAMS + Event record node parameters. + + + extSemSignal : CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2 + External semaphore signal node parameters. + + + extSemWait : CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2 + External semaphore wait node parameters. + + + alloc : CUDA_MEM_ALLOC_NODE_PARAMS_v2 + Memory allocation node parameters. + + + free : CUDA_MEM_FREE_NODE_PARAMS + Memory free node parameters. + + + memOp : CUDA_BATCH_MEM_OP_NODE_PARAMS_v2 + MemOp node parameters. + + + conditional : CUDA_CONDITIONAL_NODE_PARAMS + Conditional node parameters. + + + asBytes : bytes + Padding as bytes + + + reserved2 : long long + Reserved bytes. Must be zero. + Methods ------- getPtr() Get memory address of class instance - """ - pass -{{endif}} -{{if 'CUDA_KERNEL_NODE_PARAMS_v2' in found_types}} + cdef cydriver.CUgraphNodeParams_st* _val_ptr + cdef cydriver.CUgraphNodeParams_st* _pvt_ptr -cdef class CUDA_KERNEL_NODE_PARAMS_v2(CUDA_KERNEL_NODE_PARAMS_v2_st): + cdef CUDA_KERNEL_NODE_PARAMS_v3 _kernel + + + cdef CUDA_MEMCPY_NODE_PARAMS _memcpy + + + cdef CUDA_MEMSET_NODE_PARAMS_v2 _memset + + + cdef CUDA_HOST_NODE_PARAMS_v2 _host + + + cdef CUDA_CHILD_GRAPH_NODE_PARAMS _graph + + + cdef CUDA_EVENT_WAIT_NODE_PARAMS _eventWait + + + cdef CUDA_EVENT_RECORD_NODE_PARAMS _eventRecord + + + cdef CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2 _extSemSignal + + + cdef CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2 _extSemWait + + + cdef CUDA_MEM_ALLOC_NODE_PARAMS_v2 _alloc + + + cdef CUDA_MEM_FREE_NODE_PARAMS _free + + + cdef CUDA_BATCH_MEM_OP_NODE_PARAMS_v2 _memOp + + + cdef CUDA_CONDITIONAL_NODE_PARAMS _conditional + + +cdef class CUcheckpointLockArgs_st: """ - GPU kernel node parameters + CUDA checkpoint optional lock arguments Attributes ---------- - func : CUfunction - Kernel to launch - gridDimX : unsigned int - Width of grid in blocks - gridDimY : unsigned int - Height of grid in blocks - gridDimZ : unsigned int - Depth of grid in blocks - blockDimX : unsigned int - X dimension of each thread block - blockDimY : unsigned int - Y dimension of each thread block - blockDimZ : unsigned int - Z dimension of each thread block - sharedMemBytes : unsigned int - Dynamic shared-memory size per thread block in bytes - kernelParams : Any - Array of pointers to kernel parameters - extra : Any - Extra options - kern : CUkernel - Kernel to launch, will only be referenced if func is NULL - ctx : CUcontext - Context for the kernel task to run in. The value NULL will indicate - the current context should be used by the api. This field is - ignored if func is set. + + timeoutMs : unsigned int + Timeout in milliseconds to attempt to lock the process, 0 indicates + no timeout + + + reserved0 : unsigned int + Reserved for future use, must be zero + + + reserved1 : list[cuuint64_t] + Reserved for future use, must be zeroed + Methods ------- getPtr() Get memory address of class instance - """ - pass -{{endif}} -{{if 'CUDA_KERNEL_NODE_PARAMS' in found_types}} + cdef cydriver.CUcheckpointLockArgs_st _pvt_val + cdef cydriver.CUcheckpointLockArgs_st* _pvt_ptr -cdef class CUDA_KERNEL_NODE_PARAMS(CUDA_KERNEL_NODE_PARAMS_v2): +cdef class CUcheckpointCheckpointArgs_st: """ - GPU kernel node parameters + CUDA checkpoint optional checkpoint arguments Attributes ---------- - func : CUfunction - Kernel to launch - gridDimX : unsigned int - Width of grid in blocks - gridDimY : unsigned int - Height of grid in blocks - gridDimZ : unsigned int - Depth of grid in blocks - blockDimX : unsigned int - X dimension of each thread block - blockDimY : unsigned int - Y dimension of each thread block - blockDimZ : unsigned int - Z dimension of each thread block - sharedMemBytes : unsigned int - Dynamic shared-memory size per thread block in bytes - kernelParams : Any - Array of pointers to kernel parameters - extra : Any - Extra options - kern : CUkernel - Kernel to launch, will only be referenced if func is NULL - ctx : CUcontext - Context for the kernel task to run in. The value NULL will indicate - the current context should be used by the api. This field is - ignored if func is set. + + reserved : list[cuuint64_t] + Reserved for future use, must be zeroed + Methods ------- getPtr() Get memory address of class instance - """ - pass -{{endif}} -{{if 'CUDA_KERNEL_NODE_PARAMS_v3' in found_types}} + cdef cydriver.CUcheckpointCheckpointArgs_st _pvt_val + cdef cydriver.CUcheckpointCheckpointArgs_st* _pvt_ptr -cdef class CUDA_KERNEL_NODE_PARAMS_v3(CUDA_KERNEL_NODE_PARAMS_v3_st): +cdef class CUcheckpointGpuPair_st: """ - GPU kernel node parameters + CUDA checkpoint GPU UUID pairs for device remapping during restore Attributes ---------- - func : CUfunction - Kernel to launch - gridDimX : unsigned int - Width of grid in blocks - gridDimY : unsigned int - Height of grid in blocks - gridDimZ : unsigned int - Depth of grid in blocks - blockDimX : unsigned int - X dimension of each thread block - blockDimY : unsigned int - Y dimension of each thread block - blockDimZ : unsigned int - Z dimension of each thread block - sharedMemBytes : unsigned int - Dynamic shared-memory size per thread block in bytes - kernelParams : Any - Array of pointers to kernel parameters - extra : Any - Extra options - kern : CUkernel - Kernel to launch, will only be referenced if func is NULL - ctx : CUcontext - Context for the kernel task to run in. The value NULL will indicate - the current context should be used by the api. This field is - ignored if func is set. + + oldUuid : CUuuid + UUID of the GPU that was checkpointed + + + newUuid : CUuuid + UUID of the GPU to restore onto + Methods ------- getPtr() Get memory address of class instance - """ - pass -{{endif}} -{{if 'CUDA_MEMSET_NODE_PARAMS_v1' in found_types}} + cdef cydriver.CUcheckpointGpuPair_st _pvt_val + cdef cydriver.CUcheckpointGpuPair_st* _pvt_ptr -cdef class CUDA_MEMSET_NODE_PARAMS_v1(CUDA_MEMSET_NODE_PARAMS_st): + cdef CUuuid _oldUuid + + + cdef CUuuid _newUuid + + +cdef class CUcheckpointRestoreArgs_st: """ - Memset node parameters + CUDA checkpoint optional restore arguments Attributes ---------- - dst : CUdeviceptr - Destination device pointer - pitch : size_t - Pitch of destination device pointer. Unused if height is 1 - value : unsigned int - Value to be set - elementSize : unsigned int - Size of each element in bytes. Must be 1, 2, or 4. - width : size_t - Width of the row in elements - height : size_t - Number of rows + + gpuPairs : CUcheckpointGpuPair + Pointer to array of gpu pairs that indicate how to remap GPUs + during restore + + + gpuPairsCount : unsigned int + Number of gpu pairs to remap + + + reserved : bytes + Reserved for future use, must be zeroed + + + reserved : list[cuuint64_t] + Reserved for future use, must be zeroed + Methods ------- getPtr() Get memory address of class instance - """ - pass -{{endif}} -{{if 'CUDA_MEMSET_NODE_PARAMS' in found_types}} + cdef cydriver.CUcheckpointRestoreArgs_st _pvt_val + cdef cydriver.CUcheckpointRestoreArgs_st* _pvt_ptr -cdef class CUDA_MEMSET_NODE_PARAMS(CUDA_MEMSET_NODE_PARAMS_v1): + cdef size_t _gpuPairs_length + cdef cydriver.CUcheckpointGpuPair* _gpuPairs + + +cdef class CUcheckpointUnlockArgs_st: """ - Memset node parameters + CUDA checkpoint optional unlock arguments Attributes ---------- - dst : CUdeviceptr - Destination device pointer - pitch : size_t - Pitch of destination device pointer. Unused if height is 1 - value : unsigned int - Value to be set - elementSize : unsigned int - Size of each element in bytes. Must be 1, 2, or 4. - width : size_t - Width of the row in elements - height : size_t - Number of rows + + reserved : list[cuuint64_t] + Reserved for future use, must be zeroed + Methods ------- getPtr() Get memory address of class instance - """ - pass -{{endif}} -{{if 'CUDA_MEMSET_NODE_PARAMS_v2' in found_types}} + cdef cydriver.CUcheckpointUnlockArgs_st _pvt_val + cdef cydriver.CUcheckpointUnlockArgs_st* _pvt_ptr -cdef class CUDA_MEMSET_NODE_PARAMS_v2(CUDA_MEMSET_NODE_PARAMS_v2_st): +cdef class CUmemDecompressParams_st: """ - Memset node parameters + Structure describing the parameters that compose a single + decompression operation. Attributes ---------- - dst : CUdeviceptr - Destination device pointer - pitch : size_t - Pitch of destination device pointer. Unused if height is 1 - value : unsigned int - Value to be set - elementSize : unsigned int - Size of each element in bytes. Must be 1, 2, or 4. - width : size_t - Width of the row in elements - height : size_t - Number of rows - ctx : CUcontext - Context on which to run the node + + srcNumBytes : size_t + The number of bytes to be read and decompressed from + CUmemDecompressParams_st.src. + + + dstNumBytes : size_t + The number of bytes that the decompression operation will be + expected to write to CUmemDecompressParams_st.dst. This value is + optional; if present, it may be used by the CUDA driver as a + heuristic for scheduling the individual decompression operations. + + + dstActBytes : cuuint32_t + After the decompression operation has completed, the actual number + of bytes written to CUmemDecompressParams.dst will be recorded as a + 32-bit unsigned integer in the memory at this address. + + + src : Any + Pointer to a buffer of at least + CUmemDecompressParams_st.srcNumBytes compressed bytes. + + + dst : Any + Pointer to a buffer where the decompressed data will be written. + The number of bytes written to this location will be recorded in + the memory pointed to by CUmemDecompressParams_st.dstActBytes + + + algo : CUmemDecompressAlgorithm + The decompression algorithm to use. + + + padding : bytes + + Methods ------- getPtr() Get memory address of class instance - """ - pass -{{endif}} -{{if 'CUDA_HOST_NODE_PARAMS_v1' in found_types}} + cdef cydriver.CUmemDecompressParams_st _pvt_val + cdef cydriver.CUmemDecompressParams_st* _pvt_ptr -cdef class CUDA_HOST_NODE_PARAMS_v1(CUDA_HOST_NODE_PARAMS_st): + cdef _HelperInputVoidPtr _cysrc + + + cdef _HelperInputVoidPtr _cydst + + +cdef class CUlogicalEndpointFabricHandle_st: """ - Host node parameters + Fabric handle for a logical endpoint Attributes ---------- - fn : CUhostFn - The function to call when the node executes - userData : Any - Argument to pass to the function + + data : bytes + + Methods ------- getPtr() Get memory address of class instance - """ - pass -{{endif}} -{{if 'CUDA_HOST_NODE_PARAMS' in found_types}} + cdef cydriver.CUlogicalEndpointFabricHandle_st _pvt_val + cdef cydriver.CUlogicalEndpointFabricHandle_st* _pvt_ptr -cdef class CUDA_HOST_NODE_PARAMS(CUDA_HOST_NODE_PARAMS_v1): +cdef class anon_struct25: """ - Host node parameters - Attributes ---------- - fn : CUhostFn - The function to call when the node executes - userData : Any - Argument to pass to the function + + device : CUdevice + + Methods ------- getPtr() Get memory address of class instance - """ - pass -{{endif}} -{{if 'CUDA_HOST_NODE_PARAMS_v2' in found_types}} + cdef cydriver.CUlogicalEndpointProp_struct* _pvt_ptr + + cdef CUdevice _device -cdef class CUDA_HOST_NODE_PARAMS_v2(CUDA_HOST_NODE_PARAMS_v2_st): - """ - Host node parameters +cdef class anon_struct26: + """ Attributes ---------- - fn : CUhostFn - The function to call when the node executes - userData : Any - Argument to pass to the function + + numDevices : unsigned int + + Methods ------- getPtr() Get memory address of class instance - """ - pass -{{endif}} -{{if 'CUgraphEdgeData' in found_types}} + cdef cydriver.CUlogicalEndpointProp_struct* _pvt_ptr -cdef class CUgraphEdgeData(CUgraphEdgeData_st): +cdef class CUlogicalEndpointProp_struct: """ - Optional annotation for edges in a CUDA graph. Note, all edges - implicitly have annotations and default to a zero-initialized value - if not specified. A zero-initialized struct indicates a standard - full serialization of two nodes with memory visibility. + Properties of a logical endpoint construction Attributes ---------- - from_port : bytes - This indicates when the dependency is triggered from the upstream - node on the edge. The meaning is specfic to the node type. A value - of 0 in all cases means full completion of the upstream node, with - memory visibility to the downstream node or portion thereof - (indicated by `to_port`). Only kernel nodes define non-zero - ports. A kernel node can use the following output port types: - CU_GRAPH_KERNEL_NODE_PORT_DEFAULT, - CU_GRAPH_KERNEL_NODE_PORT_PROGRAMMATIC, or - CU_GRAPH_KERNEL_NODE_PORT_LAUNCH_ORDER. - to_port : bytes - This indicates what portion of the downstream node is dependent on - the upstream node or portion thereof (indicated by `from_port`). - The meaning is specific to the node type. A value of 0 in all cases - means the entirety of the downstream node is dependent on the - upstream work. Currently no node types define non-zero ports. - Accordingly, this field must be set to zero. - type : bytes - This should be populated with a value from CUgraphDependencyType. - (It is typed as char due to compiler-specific layout of bitfields.) - See CUgraphDependencyType. - reserved : bytes - These bytes are unused and must be zeroed. This ensures - compatibility if additional fields are added in the future. + + type : CUlogicalEndpointType + Type of the logical endpoint defined in CUlogicalEndpointType + + + unicast : anon_struct25 + + + + multicast : anon_struct26 + + + + size : unsigned long long + Size of the logical endpoint + + + ipcHandleTypes : unsigned int + A bitmask of IPC handle types defined in + CUlogicalEndpointIpcHandleType + + + flags : unsigned int + A bitmask of flags defined in CUlogicalEndpointFlag + Methods ------- getPtr() Get memory address of class instance - """ - pass -{{endif}} -{{if 'CUDA_GRAPH_INSTANTIATE_PARAMS' in found_types}} + cdef cydriver.CUlogicalEndpointProp_struct* _val_ptr + cdef cydriver.CUlogicalEndpointProp_struct* _pvt_ptr + + cdef anon_struct25 _unicast + + + cdef anon_struct26 _multicast -cdef class CUDA_GRAPH_INSTANTIATE_PARAMS(CUDA_GRAPH_INSTANTIATE_PARAMS_st): - """ - Graph instantiation parameters +cdef class CUdevSmResource_st: + """ Attributes ---------- - flags : cuuint64_t - Instantiation flags - hUploadStream : CUstream - Upload stream - hErrNode_out : CUgraphNode - The node which caused instantiation to fail, if any - result_out : CUgraphInstantiateResult - Whether instantiation was successful. If it failed, the reason why + + smCount : unsigned int + The amount of streaming multiprocessors available in this resource. + + + minSmPartitionSize : unsigned int + The minimum number of streaming multiprocessors required to + partition this resource. + + + smCoscheduledAlignment : unsigned int + The number of streaming multiprocessors in this resource that are + guaranteed to be co-scheduled on the same GPU processing cluster. + smCount will be a multiple of this value, unless the backfill flag + is set. + + + flags : unsigned int + The flags set on this SM resource. For possible values see + CUdevSmResourceGroup_flags. + Methods ------- getPtr() Get memory address of class instance - """ - pass -{{endif}} -{{if 'CUlaunchMemSyncDomainMap' in found_types}} + cdef cydriver.CUdevSmResource_st _pvt_val + cdef cydriver.CUdevSmResource_st* _pvt_ptr -cdef class CUlaunchMemSyncDomainMap(CUlaunchMemSyncDomainMap_st): +cdef class CUdevWorkqueueConfigResource_st: """ - Memory Synchronization Domain map See ::cudaLaunchMemSyncDomain. - By default, kernels are launched in domain 0. Kernel launched with - CU_LAUNCH_MEM_SYNC_DOMAIN_REMOTE will have a different domain ID. - User may also alter the domain ID with CUlaunchMemSyncDomainMap for - a specific stream / graph node / kernel launch. See - CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP. Domain ID range is - available through CU_DEVICE_ATTRIBUTE_MEM_SYNC_DOMAIN_COUNT. - Attributes ---------- - default_ : bytes - The default domain ID to use for designated kernels - remote : bytes - The remote domain ID to use for designated kernels + + device : CUdevice + The device on which the workqueue resources are available + + + wqConcurrencyLimit : unsigned int + The expected maximum number of concurrent stream-ordered workloads + + + sharingScope : CUdevWorkqueueConfigScope + The sharing scope for the workqueue resources + Methods ------- getPtr() Get memory address of class instance - """ - pass -{{endif}} -{{if 'CUlaunchAttributeValue' in found_types}} + cdef cydriver.CUdevWorkqueueConfigResource_st _pvt_val + cdef cydriver.CUdevWorkqueueConfigResource_st* _pvt_ptr + + cdef CUdevice _device -cdef class CUlaunchAttributeValue(CUlaunchAttributeValue_union): - """ - Launch attributes union; used as value field of CUlaunchAttribute +cdef class CUdevWorkqueueResource_st: + """ Attributes ---------- - pad : bytes - accessPolicyWindow : CUaccessPolicyWindow - Value of launch attribute CU_LAUNCH_ATTRIBUTE_ACCESS_POLICY_WINDOW. - cooperative : int - Value of launch attribute CU_LAUNCH_ATTRIBUTE_COOPERATIVE. Nonzero - indicates a cooperative kernel (see cuLaunchCooperativeKernel). - syncPolicy : CUsynchronizationPolicy - Value of launch attribute - CU_LAUNCH_ATTRIBUTE_SYNCHRONIZATION_POLICY. - ::CUsynchronizationPolicy for work queued up in this stream - clusterDim : anon_struct1 - Value of launch attribute CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION - that represents the desired cluster dimensions for the kernel. - Opaque type with the following fields: - `x` - The X dimension of - the cluster, in blocks. Must be a divisor of the grid X dimension. - - `y` - The Y dimension of the cluster, in blocks. Must be a - divisor of the grid Y dimension. - `z` - The Z dimension of the - cluster, in blocks. Must be a divisor of the grid Z dimension. - clusterSchedulingPolicyPreference : CUclusterSchedulingPolicy - Value of launch attribute - CU_LAUNCH_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE. Cluster - scheduling policy preference for the kernel. - programmaticStreamSerializationAllowed : int - Value of launch attribute - CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_STREAM_SERIALIZATION. - programmaticEvent : anon_struct2 - Value of launch attribute CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_EVENT. - launchCompletionEvent : anon_struct3 - Value of launch attribute - CU_LAUNCH_ATTRIBUTE_LAUNCH_COMPLETION_EVENT. - priority : int - Value of launch attribute CU_LAUNCH_ATTRIBUTE_PRIORITY. Execution - priority of the kernel. - memSyncDomainMap : CUlaunchMemSyncDomainMap - Value of launch attribute CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP. - See CUlaunchMemSyncDomainMap. - memSyncDomain : CUlaunchMemSyncDomain - Value of launch attribute CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN. - See::CUlaunchMemSyncDomain - deviceUpdatableKernelNode : anon_struct4 - Value of launch attribute - CU_LAUNCH_ATTRIBUTE_DEVICE_UPDATABLE_KERNEL_NODE. - sharedMemCarveout : unsigned int - Value of launch attribute - CU_LAUNCH_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT. + reserved : bytes + Reserved for future use + Methods ------- getPtr() Get memory address of class instance - """ - pass -{{endif}} -{{if 'CUlaunchAttribute' in found_types}} + cdef cydriver.CUdevWorkqueueResource_st _pvt_val + cdef cydriver.CUdevWorkqueueResource_st* _pvt_ptr -cdef class CUlaunchAttribute(CUlaunchAttribute_st): +cdef class CU_DEV_SM_RESOURCE_GROUP_PARAMS_st: """ - Launch attribute - Attributes ---------- - id : CUlaunchAttributeID - Attribute to set - value : CUlaunchAttributeValue - Value of the attribute + + smCount : unsigned int + The amount of SMs available in this resource. + + + coscheduledSmCount : unsigned int + The amount of co-scheduled SMs grouped together for locality + purposes. + + + preferredCoscheduledSmCount : unsigned int + When possible, combine co-scheduled groups together into larger + groups of this size. + + + flags : unsigned int + The flags set on this SM resource group. For possible values see + CUdevSmResourceGroup_flags. + + + reserved : list[unsigned int] + + Methods ------- getPtr() Get memory address of class instance - """ - pass -{{endif}} -{{if 'CUlaunchConfig' in found_types}} + cdef cydriver.CU_DEV_SM_RESOURCE_GROUP_PARAMS_st _pvt_val + cdef cydriver.CU_DEV_SM_RESOURCE_GROUP_PARAMS_st* _pvt_ptr -cdef class CUlaunchConfig(CUlaunchConfig_st): +cdef class CUdevResource_st: """ - CUDA extensible launch configuration - Attributes ---------- - gridDimX : unsigned int - Width of grid in blocks - gridDimY : unsigned int - Height of grid in blocks - gridDimZ : unsigned int - Depth of grid in blocks - blockDimX : unsigned int - X dimension of each thread block - blockDimY : unsigned int - Y dimension of each thread block - blockDimZ : unsigned int - Z dimension of each thread block - sharedMemBytes : unsigned int - Dynamic shared-memory size per thread block in bytes - hStream : CUstream - Stream identifier - attrs : CUlaunchAttribute - List of attributes; nullable if CUlaunchConfig::numAttrs == 0 - numAttrs : unsigned int - Number of attributes populated in CUlaunchConfig::attrs + + type : CUdevResourceType + Type of resource, dictates which union field was last set + + + _internal_padding : bytes + + + + sm : CUdevSmResource + Resource corresponding to CU_DEV_RESOURCE_TYPE_SM `typename`. + + + wqConfig : CUdevWorkqueueConfigResource + Resource corresponding to CU_DEV_RESOURCE_TYPE_WORKQUEUE_CONFIG + `typename`. + + + wq : CUdevWorkqueueResource + Resource corresponding to CU_DEV_RESOURCE_TYPE_WORKQUEUE + `typename`. + + + _oversize : bytes + + + + nextResource : CUdevResource_st + + Methods ------- getPtr() Get memory address of class instance - """ - pass -{{endif}} -{{if 'CUkernelNodeAttrValue_v1' in found_types}} + cdef cydriver.CUdevResource_st* _val_ptr + cdef cydriver.CUdevResource_st* _pvt_ptr -cdef class CUkernelNodeAttrValue_v1(CUlaunchAttributeValue): - """ - Launch attributes union; used as value field of CUlaunchAttribute + cdef CUdevSmResource _sm + + + cdef CUdevWorkqueueConfigResource _wqConfig + + cdef CUdevWorkqueueResource _wq + + + cdef size_t _nextResource_length + cdef cydriver.CUdevResource_st* _nextResource + + +cdef class anon_union17: + """ Attributes ---------- - pad : bytes - accessPolicyWindow : CUaccessPolicyWindow - Value of launch attribute CU_LAUNCH_ATTRIBUTE_ACCESS_POLICY_WINDOW. - cooperative : int - Value of launch attribute CU_LAUNCH_ATTRIBUTE_COOPERATIVE. Nonzero - indicates a cooperative kernel (see cuLaunchCooperativeKernel). - syncPolicy : CUsynchronizationPolicy - Value of launch attribute - CU_LAUNCH_ATTRIBUTE_SYNCHRONIZATION_POLICY. - ::CUsynchronizationPolicy for work queued up in this stream - clusterDim : anon_struct1 - Value of launch attribute CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION - that represents the desired cluster dimensions for the kernel. - Opaque type with the following fields: - `x` - The X dimension of - the cluster, in blocks. Must be a divisor of the grid X dimension. - - `y` - The Y dimension of the cluster, in blocks. Must be a - divisor of the grid Y dimension. - `z` - The Z dimension of the - cluster, in blocks. Must be a divisor of the grid Z dimension. - clusterSchedulingPolicyPreference : CUclusterSchedulingPolicy - Value of launch attribute - CU_LAUNCH_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE. Cluster - scheduling policy preference for the kernel. - programmaticStreamSerializationAllowed : int - Value of launch attribute - CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_STREAM_SERIALIZATION. - programmaticEvent : anon_struct2 - Value of launch attribute CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_EVENT. - launchCompletionEvent : anon_struct3 - Value of launch attribute - CU_LAUNCH_ATTRIBUTE_LAUNCH_COMPLETION_EVENT. - priority : int - Value of launch attribute CU_LAUNCH_ATTRIBUTE_PRIORITY. Execution - priority of the kernel. - memSyncDomainMap : CUlaunchMemSyncDomainMap - Value of launch attribute CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP. - See CUlaunchMemSyncDomainMap. - memSyncDomain : CUlaunchMemSyncDomain - Value of launch attribute CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN. - See::CUlaunchMemSyncDomain - deviceUpdatableKernelNode : anon_struct4 - Value of launch attribute - CU_LAUNCH_ATTRIBUTE_DEVICE_UPDATABLE_KERNEL_NODE. - sharedMemCarveout : unsigned int - Value of launch attribute - CU_LAUNCH_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT. + pArray : list[CUarray] + + + + pPitch : list[Any] + + Methods ------- getPtr() Get memory address of class instance - """ - pass -{{endif}} -{{if 'CUkernelNodeAttrValue' in found_types}} + cdef cydriver.CUeglFrame_st* _pvt_ptr -cdef class CUkernelNodeAttrValue(CUkernelNodeAttrValue_v1): +cdef class CUeglFrame_st: """ - Launch attributes union; used as value field of CUlaunchAttribute + CUDA EGLFrame structure Descriptor - structure defining one frame + of EGL. Each frame may contain one or more planes depending on + whether the surface * is Multiplanar or not. Attributes ---------- - pad : bytes - accessPolicyWindow : CUaccessPolicyWindow - Value of launch attribute CU_LAUNCH_ATTRIBUTE_ACCESS_POLICY_WINDOW. - cooperative : int - Value of launch attribute CU_LAUNCH_ATTRIBUTE_COOPERATIVE. Nonzero - indicates a cooperative kernel (see cuLaunchCooperativeKernel). - syncPolicy : CUsynchronizationPolicy - Value of launch attribute - CU_LAUNCH_ATTRIBUTE_SYNCHRONIZATION_POLICY. - ::CUsynchronizationPolicy for work queued up in this stream - clusterDim : anon_struct1 - Value of launch attribute CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION - that represents the desired cluster dimensions for the kernel. - Opaque type with the following fields: - `x` - The X dimension of - the cluster, in blocks. Must be a divisor of the grid X dimension. - - `y` - The Y dimension of the cluster, in blocks. Must be a - divisor of the grid Y dimension. - `z` - The Z dimension of the - cluster, in blocks. Must be a divisor of the grid Z dimension. - clusterSchedulingPolicyPreference : CUclusterSchedulingPolicy - Value of launch attribute - CU_LAUNCH_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE. Cluster - scheduling policy preference for the kernel. - programmaticStreamSerializationAllowed : int - Value of launch attribute - CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_STREAM_SERIALIZATION. - programmaticEvent : anon_struct2 - Value of launch attribute CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_EVENT. - launchCompletionEvent : anon_struct3 - Value of launch attribute - CU_LAUNCH_ATTRIBUTE_LAUNCH_COMPLETION_EVENT. - priority : int - Value of launch attribute CU_LAUNCH_ATTRIBUTE_PRIORITY. Execution - priority of the kernel. - memSyncDomainMap : CUlaunchMemSyncDomainMap - Value of launch attribute CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP. - See CUlaunchMemSyncDomainMap. - memSyncDomain : CUlaunchMemSyncDomain - Value of launch attribute CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN. - See::CUlaunchMemSyncDomain - deviceUpdatableKernelNode : anon_struct4 - Value of launch attribute - CU_LAUNCH_ATTRIBUTE_DEVICE_UPDATABLE_KERNEL_NODE. - sharedMemCarveout : unsigned int - Value of launch attribute - CU_LAUNCH_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT. + frame : anon_union17 + + + + width : unsigned int + Width of first plane + + + height : unsigned int + Height of first plane + + + depth : unsigned int + Depth of first plane + + + pitch : unsigned int + Pitch of first plane + + + planeCount : unsigned int + Number of planes + + + numChannels : unsigned int + Number of channels for the plane + + + frameType : CUeglFrameType + Array or Pitch + + + eglColorFormat : CUeglColorFormat + CUDA EGL Color Format + + + cuFormat : CUarray_format + CUDA Array Format + Methods ------- getPtr() Get memory address of class instance + """ + cdef cydriver.CUeglFrame_st* _val_ptr + cdef cydriver.CUeglFrame_st* _pvt_ptr + cdef anon_union17 _frame + + +cdef class CUdeviceptr: """ - pass -{{endif}} -{{if 'CUstreamAttrValue_v1' in found_types}} -cdef class CUstreamAttrValue_v1(CUlaunchAttributeValue): + CUDA device pointer CUdeviceptr is defined as an unsigned integer type whose size matches the size of a pointer on the target platform. + + Methods + ------- + getPtr() + Get memory address of class instance + """ - Launch attributes union; used as value field of CUlaunchAttribute + cdef cydriver.CUdeviceptr _pvt_val + cdef cydriver.CUdeviceptr* _pvt_ptr - Attributes - ---------- - pad : bytes +cdef class CUdevice: + """ - accessPolicyWindow : CUaccessPolicyWindow - Value of launch attribute CU_LAUNCH_ATTRIBUTE_ACCESS_POLICY_WINDOW. - cooperative : int - Value of launch attribute CU_LAUNCH_ATTRIBUTE_COOPERATIVE. Nonzero - indicates a cooperative kernel (see cuLaunchCooperativeKernel). - syncPolicy : CUsynchronizationPolicy - Value of launch attribute - CU_LAUNCH_ATTRIBUTE_SYNCHRONIZATION_POLICY. - ::CUsynchronizationPolicy for work queued up in this stream - clusterDim : anon_struct1 - Value of launch attribute CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION - that represents the desired cluster dimensions for the kernel. - Opaque type with the following fields: - `x` - The X dimension of - the cluster, in blocks. Must be a divisor of the grid X dimension. - - `y` - The Y dimension of the cluster, in blocks. Must be a - divisor of the grid Y dimension. - `z` - The Z dimension of the - cluster, in blocks. Must be a divisor of the grid Z dimension. - clusterSchedulingPolicyPreference : CUclusterSchedulingPolicy - Value of launch attribute - CU_LAUNCH_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE. Cluster - scheduling policy preference for the kernel. - programmaticStreamSerializationAllowed : int - Value of launch attribute - CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_STREAM_SERIALIZATION. - programmaticEvent : anon_struct2 - Value of launch attribute CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_EVENT. - launchCompletionEvent : anon_struct3 - Value of launch attribute - CU_LAUNCH_ATTRIBUTE_LAUNCH_COMPLETION_EVENT. - priority : int - Value of launch attribute CU_LAUNCH_ATTRIBUTE_PRIORITY. Execution - priority of the kernel. - memSyncDomainMap : CUlaunchMemSyncDomainMap - Value of launch attribute CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP. - See CUlaunchMemSyncDomainMap. - memSyncDomain : CUlaunchMemSyncDomain - Value of launch attribute CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN. - See::CUlaunchMemSyncDomain - deviceUpdatableKernelNode : anon_struct4 - Value of launch attribute - CU_LAUNCH_ATTRIBUTE_DEVICE_UPDATABLE_KERNEL_NODE. - sharedMemCarveout : unsigned int - Value of launch attribute - CU_LAUNCH_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT. + CUDA device Methods ------- @@ -4855,62 +5460,27 @@ cdef class CUstreamAttrValue_v1(CUlaunchAttributeValue): Get memory address of class instance """ - pass -{{endif}} -{{if 'CUstreamAttrValue' in found_types}} + cdef cydriver.CUdevice _pvt_val + cdef cydriver.CUdevice* _pvt_ptr -cdef class CUstreamAttrValue(CUstreamAttrValue_v1): +cdef class CUtexObject: """ - Launch attributes union; used as value field of CUlaunchAttribute - Attributes - ---------- - pad : bytes + An opaque value that represents a CUDA texture object - accessPolicyWindow : CUaccessPolicyWindow - Value of launch attribute CU_LAUNCH_ATTRIBUTE_ACCESS_POLICY_WINDOW. - cooperative : int - Value of launch attribute CU_LAUNCH_ATTRIBUTE_COOPERATIVE. Nonzero - indicates a cooperative kernel (see cuLaunchCooperativeKernel). - syncPolicy : CUsynchronizationPolicy - Value of launch attribute - CU_LAUNCH_ATTRIBUTE_SYNCHRONIZATION_POLICY. - ::CUsynchronizationPolicy for work queued up in this stream - clusterDim : anon_struct1 - Value of launch attribute CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION - that represents the desired cluster dimensions for the kernel. - Opaque type with the following fields: - `x` - The X dimension of - the cluster, in blocks. Must be a divisor of the grid X dimension. - - `y` - The Y dimension of the cluster, in blocks. Must be a - divisor of the grid Y dimension. - `z` - The Z dimension of the - cluster, in blocks. Must be a divisor of the grid Z dimension. - clusterSchedulingPolicyPreference : CUclusterSchedulingPolicy - Value of launch attribute - CU_LAUNCH_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE. Cluster - scheduling policy preference for the kernel. - programmaticStreamSerializationAllowed : int - Value of launch attribute - CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_STREAM_SERIALIZATION. - programmaticEvent : anon_struct2 - Value of launch attribute CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_EVENT. - launchCompletionEvent : anon_struct3 - Value of launch attribute - CU_LAUNCH_ATTRIBUTE_LAUNCH_COMPLETION_EVENT. - priority : int - Value of launch attribute CU_LAUNCH_ATTRIBUTE_PRIORITY. Execution - priority of the kernel. - memSyncDomainMap : CUlaunchMemSyncDomainMap - Value of launch attribute CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP. - See CUlaunchMemSyncDomainMap. - memSyncDomain : CUlaunchMemSyncDomain - Value of launch attribute CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN. - See::CUlaunchMemSyncDomain - deviceUpdatableKernelNode : anon_struct4 - Value of launch attribute - CU_LAUNCH_ATTRIBUTE_DEVICE_UPDATABLE_KERNEL_NODE. - sharedMemCarveout : unsigned int - Value of launch attribute - CU_LAUNCH_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT. + Methods + ------- + getPtr() + Get memory address of class instance + + """ + cdef cydriver.CUtexObject _pvt_val + cdef cydriver.CUtexObject* _pvt_ptr + +cdef class CUsurfObject: + """ + + An opaque value that represents a CUDA surface object Methods ------- @@ -4918,800 +5488,3908 @@ cdef class CUstreamAttrValue(CUstreamAttrValue_v1): Get memory address of class instance """ - pass -{{endif}} -{{if 'CUexecAffinitySmCount_v1' in found_types}} + cdef cydriver.CUsurfObject _pvt_val + cdef cydriver.CUsurfObject* _pvt_ptr -cdef class CUexecAffinitySmCount_v1(CUexecAffinitySmCount_st): +cdef class CUgraphConditionalHandle: """ - Value for CU_EXEC_AFFINITY_TYPE_SM_COUNT + Methods + ------- + getPtr() + Get memory address of class instance + + """ + cdef cydriver.CUgraphConditionalHandle _pvt_val + cdef cydriver.CUgraphConditionalHandle* _pvt_ptr + +cdef class CUuuid(CUuuid_st): + """ Attributes ---------- - val : unsigned int - The number of SMs the context is limited to use. + + bytes : bytes + < CUDA definition of UUID + Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUexecAffinitySmCount' in found_types}} -cdef class CUexecAffinitySmCount(CUexecAffinitySmCount_v1): +cdef class CUmemFabricHandle_v1(CUmemFabricHandle_st): """ - Value for CU_EXEC_AFFINITY_TYPE_SM_COUNT + Fabric handle - An opaque handle representing a memory allocation + that can be exported to processes in same or different nodes. For + IPC between processes on different nodes they must be connected via + the NVSwitch fabric. Attributes ---------- - val : unsigned int - The number of SMs the context is limited to use. + + data : bytes + + Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUexecAffinityParam_v1' in found_types}} -cdef class CUexecAffinityParam_v1(CUexecAffinityParam_st): +cdef class CUmemFabricHandle(CUmemFabricHandle_v1): """ - Execution Affinity Parameters + Fabric handle - An opaque handle representing a memory allocation + that can be exported to processes in same or different nodes. For + IPC between processes on different nodes they must be connected via + the NVSwitch fabric. Attributes ---------- - type : CUexecAffinityType - param : anon_union3 + data : bytes + Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUexecAffinityParam' in found_types}} -cdef class CUexecAffinityParam(CUexecAffinityParam_v1): +cdef class CUipcEventHandle_v1(CUipcEventHandle_st): """ - Execution Affinity Parameters + CUDA IPC event handle Attributes ---------- - type : CUexecAffinityType - param : anon_union3 + reserved : bytes + Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUctxCigParam' in found_types}} -cdef class CUctxCigParam(CUctxCigParam_st): +cdef class CUipcEventHandle(CUipcEventHandle_v1): """ - CIG Context Create Params + CUDA IPC event handle Attributes ---------- - sharedDataType : CUcigDataType - sharedData : Any + reserved : bytes + Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUctxCreateParams' in found_types}} -cdef class CUctxCreateParams(CUctxCreateParams_st): +cdef class CUipcMemHandle_v1(CUipcMemHandle_st): """ - Params for creating CUDA context Exactly one of execAffinityParams - and cigParams must be non-NULL. + CUDA IPC mem handle Attributes ---------- - execAffinityParams : CUexecAffinityParam - numExecAffinityParams : int + reserved : bytes - cigParams : CUctxCigParam Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUlibraryHostUniversalFunctionAndDataTable' in found_types}} -cdef class CUlibraryHostUniversalFunctionAndDataTable(CUlibraryHostUniversalFunctionAndDataTable_st): +cdef class CUipcMemHandle(CUipcMemHandle_v1): """ + CUDA IPC mem handle + Attributes ---------- - functionTable : Any - - functionWindowSize : size_t - dataTable : Any + reserved : bytes - dataWindowSize : size_t Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUDA_MEMCPY2D_v2' in found_types}} -cdef class CUDA_MEMCPY2D_v2(CUDA_MEMCPY2D_st): +cdef class CUstreamBatchMemOpParams_v1(CUstreamBatchMemOpParams_union): """ - 2D memory copy parameters + Per-operation parameters for cuStreamBatchMemOp Attributes ---------- - srcXInBytes : size_t - Source X in bytes - srcY : size_t - Source Y - srcMemoryType : CUmemorytype - Source memory type (host, device, array) - srcHost : Any - Source host pointer - srcDevice : CUdeviceptr - Source device pointer - srcArray : CUarray - Source array reference - srcPitch : size_t - Source pitch (ignored when src is array) - dstXInBytes : size_t - Destination X in bytes - dstY : size_t - Destination Y - dstMemoryType : CUmemorytype - Destination memory type (host, device, array) - dstHost : Any - Destination host pointer - dstDevice : CUdeviceptr - Destination device pointer - dstArray : CUarray - Destination array reference - dstPitch : size_t - Destination pitch (ignored when dst is array) - WidthInBytes : size_t - Width of 2D memory copy in bytes - Height : size_t - Height of 2D memory copy + + operation : CUstreamBatchMemOpType + Operation. This is the first field of all the union elemets and + acts as a TAG to determine which union member is valid. + + + waitValue : CUstreamMemOpWaitValueParams_st + Params for CU_STREAM_MEM_OP_WAIT_VALUE_32 and + CU_STREAM_MEM_OP_WAIT_VALUE_64 operations. + + + writeValue : CUstreamMemOpWriteValueParams_st + Params for CU_STREAM_MEM_OP_WRITE_VALUE_32 and + CU_STREAM_MEM_OP_WRITE_VALUE_64 operations. + + + flushRemoteWrites : CUstreamMemOpFlushRemoteWritesParams_st + Params for CU_STREAM_MEM_OP_FLUSH_REMOTE_WRITES operations. + + + memoryBarrier : CUstreamMemOpMemoryBarrierParams_st + Params for CU_STREAM_MEM_OP_BARRIER operations. + + + atomicReduction : CUstreamMemOpAtomicReductionParams_st + + + + pad : list[cuuint64_t] + + Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUDA_MEMCPY2D' in found_types}} -cdef class CUDA_MEMCPY2D(CUDA_MEMCPY2D_v2): +cdef class CUstreamBatchMemOpParams(CUstreamBatchMemOpParams_v1): """ - 2D memory copy parameters + Per-operation parameters for cuStreamBatchMemOp Attributes ---------- - srcXInBytes : size_t - Source X in bytes - srcY : size_t - Source Y - srcMemoryType : CUmemorytype - Source memory type (host, device, array) - srcHost : Any - Source host pointer - srcDevice : CUdeviceptr - Source device pointer - srcArray : CUarray - Source array reference - srcPitch : size_t - Source pitch (ignored when src is array) - dstXInBytes : size_t - Destination X in bytes - dstY : size_t - Destination Y - dstMemoryType : CUmemorytype - Destination memory type (host, device, array) - dstHost : Any - Destination host pointer - dstDevice : CUdeviceptr - Destination device pointer - dstArray : CUarray - Destination array reference - dstPitch : size_t - Destination pitch (ignored when dst is array) - WidthInBytes : size_t - Width of 2D memory copy in bytes - Height : size_t - Height of 2D memory copy + + operation : CUstreamBatchMemOpType + Operation. This is the first field of all the union elemets and + acts as a TAG to determine which union member is valid. + + + waitValue : CUstreamMemOpWaitValueParams_st + Params for CU_STREAM_MEM_OP_WAIT_VALUE_32 and + CU_STREAM_MEM_OP_WAIT_VALUE_64 operations. + + + writeValue : CUstreamMemOpWriteValueParams_st + Params for CU_STREAM_MEM_OP_WRITE_VALUE_32 and + CU_STREAM_MEM_OP_WRITE_VALUE_64 operations. + + + flushRemoteWrites : CUstreamMemOpFlushRemoteWritesParams_st + Params for CU_STREAM_MEM_OP_FLUSH_REMOTE_WRITES operations. + + + memoryBarrier : CUstreamMemOpMemoryBarrierParams_st + Params for CU_STREAM_MEM_OP_BARRIER operations. + + + atomicReduction : CUstreamMemOpAtomicReductionParams_st + + + + pad : list[cuuint64_t] + + Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUDA_MEMCPY3D_v2' in found_types}} -cdef class CUDA_MEMCPY3D_v2(CUDA_MEMCPY3D_st): +cdef class CUDA_BATCH_MEM_OP_NODE_PARAMS_v1(CUDA_BATCH_MEM_OP_NODE_PARAMS_v1_st): """ - 3D memory copy parameters + Batch memory operation node parameters Used in the legacy + cuGraphAddBatchMemOpNode api. New code should use cuGraphAddNode() Attributes ---------- - srcXInBytes : size_t - Source X in bytes - srcY : size_t - Source Y + + ctx : CUcontext + + + + count : unsigned int + + + + paramArray : CUstreamBatchMemOpParams + + + + flags : unsigned int + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUDA_BATCH_MEM_OP_NODE_PARAMS(CUDA_BATCH_MEM_OP_NODE_PARAMS_v1): + """ + Batch memory operation node parameters Used in the legacy + cuGraphAddBatchMemOpNode api. New code should use cuGraphAddNode() + + Attributes + ---------- + + ctx : CUcontext + + + + count : unsigned int + + + + paramArray : CUstreamBatchMemOpParams + + + + flags : unsigned int + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUDA_BATCH_MEM_OP_NODE_PARAMS_v2(CUDA_BATCH_MEM_OP_NODE_PARAMS_v2_st): + """ + Batch memory operation node parameters + + Attributes + ---------- + + ctx : CUcontext + Context to use for the operations. + + + count : unsigned int + Number of operations in paramArray. + + + paramArray : CUstreamBatchMemOpParams + Array of batch memory operations. + + + flags : unsigned int + Flags to control the node. + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUasyncNotificationInfo(CUasyncNotificationInfo_st): + """ + Information passed to the user via the async notification callback + + Attributes + ---------- + + type : CUasyncNotificationType + The type of notification being sent + + + info : anon_union2 + Information about the notification. `typename` must be checked in + order to interpret this field. + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUdevprop_v1(CUdevprop_st): + """ + Legacy device properties + + Attributes + ---------- + + maxThreadsPerBlock : int + Maximum number of threads per block + + + maxThreadsDim : list[int] + Maximum size of each dimension of a block + + + maxGridSize : list[int] + Maximum size of each dimension of a grid + + + sharedMemPerBlock : int + Shared memory available per block in bytes + + + totalConstantMemory : int + Constant memory available on device in bytes + + + SIMDWidth : int + Warp size in threads + + + memPitch : int + Maximum pitch in bytes allowed by memory copies + + + regsPerBlock : int + 32-bit registers available per block + + + clockRate : int + Clock frequency in kilohertz + + + textureAlign : int + Alignment requirement for textures + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUdevprop(CUdevprop_v1): + """ + Legacy device properties + + Attributes + ---------- + + maxThreadsPerBlock : int + Maximum number of threads per block + + + maxThreadsDim : list[int] + Maximum size of each dimension of a block + + + maxGridSize : list[int] + Maximum size of each dimension of a grid + + + sharedMemPerBlock : int + Shared memory available per block in bytes + + + totalConstantMemory : int + Constant memory available on device in bytes + + + SIMDWidth : int + Warp size in threads + + + memPitch : int + Maximum pitch in bytes allowed by memory copies + + + regsPerBlock : int + 32-bit registers available per block + + + clockRate : int + Clock frequency in kilohertz + + + textureAlign : int + Alignment requirement for textures + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUaccessPolicyWindow_v1(CUaccessPolicyWindow_st): + """ + Specifies an access policy for a window, a contiguous extent of + memory beginning at base_ptr and ending at base_ptr + num_bytes. + num_bytes is limited by + CU_DEVICE_ATTRIBUTE_MAX_ACCESS_POLICY_WINDOW_SIZE. Partition into + many segments and assign segments such that: sum of "hit segments" + / window == approx. ratio. sum of "miss segments" / window == + approx 1-ratio. Segments and ratio specifications are fitted to the + capabilities of the architecture. Accesses in a hit segment apply + the hitProp access policy. Accesses in a miss segment apply the + missProp access policy. + + Attributes + ---------- + + base_ptr : Any + Starting address of the access policy window. CUDA driver may align + it. + + + num_bytes : size_t + Size in bytes of the window policy. CUDA driver may restrict the + maximum size and alignment. + + + hitRatio : float + hitRatio specifies percentage of lines assigned hitProp, rest are + assigned missProp. + + + hitProp : CUaccessProperty + CUaccessProperty set for hit. + + + missProp : CUaccessProperty + CUaccessProperty set for miss. Must be either NORMAL or STREAMING + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUaccessPolicyWindow(CUaccessPolicyWindow_v1): + """ + Specifies an access policy for a window, a contiguous extent of + memory beginning at base_ptr and ending at base_ptr + num_bytes. + num_bytes is limited by + CU_DEVICE_ATTRIBUTE_MAX_ACCESS_POLICY_WINDOW_SIZE. Partition into + many segments and assign segments such that: sum of "hit segments" + / window == approx. ratio. sum of "miss segments" / window == + approx 1-ratio. Segments and ratio specifications are fitted to the + capabilities of the architecture. Accesses in a hit segment apply + the hitProp access policy. Accesses in a miss segment apply the + missProp access policy. + + Attributes + ---------- + + base_ptr : Any + Starting address of the access policy window. CUDA driver may align + it. + + + num_bytes : size_t + Size in bytes of the window policy. CUDA driver may restrict the + maximum size and alignment. + + + hitRatio : float + hitRatio specifies percentage of lines assigned hitProp, rest are + assigned missProp. + + + hitProp : CUaccessProperty + CUaccessProperty set for hit. + + + missProp : CUaccessProperty + CUaccessProperty set for miss. Must be either NORMAL or STREAMING + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUDA_KERNEL_NODE_PARAMS_v1(CUDA_KERNEL_NODE_PARAMS_st): + """ + GPU kernel node parameters + + Attributes + ---------- + + func : CUfunction + Kernel to launch + + + gridDimX : unsigned int + Width of grid in blocks + + + gridDimY : unsigned int + Height of grid in blocks + + + gridDimZ : unsigned int + Depth of grid in blocks + + + blockDimX : unsigned int + X dimension of each thread block + + + blockDimY : unsigned int + Y dimension of each thread block + + + blockDimZ : unsigned int + Z dimension of each thread block + + + sharedMemBytes : unsigned int + Dynamic shared-memory size per thread block in bytes + + + kernelParams : Any + Array of pointers to kernel parameters + + + extra : Any + Extra options + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUDA_KERNEL_NODE_PARAMS_v2(CUDA_KERNEL_NODE_PARAMS_v2_st): + """ + GPU kernel node parameters + + Attributes + ---------- + + func : CUfunction + Kernel to launch + + + gridDimX : unsigned int + Width of grid in blocks + + + gridDimY : unsigned int + Height of grid in blocks + + + gridDimZ : unsigned int + Depth of grid in blocks + + + blockDimX : unsigned int + X dimension of each thread block + + + blockDimY : unsigned int + Y dimension of each thread block + + + blockDimZ : unsigned int + Z dimension of each thread block + + + sharedMemBytes : unsigned int + Dynamic shared-memory size per thread block in bytes + + + kernelParams : Any + Array of pointers to kernel parameters + + + extra : Any + Extra options + + + kern : CUkernel + Kernel to launch, will only be referenced if func is NULL + + + ctx : CUcontext + Context for the kernel task to run in. The value NULL will indicate + the current context should be used by the api. This field is + ignored if func is set. + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUDA_KERNEL_NODE_PARAMS(CUDA_KERNEL_NODE_PARAMS_v2): + """ + GPU kernel node parameters + + Attributes + ---------- + + func : CUfunction + Kernel to launch + + + gridDimX : unsigned int + Width of grid in blocks + + + gridDimY : unsigned int + Height of grid in blocks + + + gridDimZ : unsigned int + Depth of grid in blocks + + + blockDimX : unsigned int + X dimension of each thread block + + + blockDimY : unsigned int + Y dimension of each thread block + + + blockDimZ : unsigned int + Z dimension of each thread block + + + sharedMemBytes : unsigned int + Dynamic shared-memory size per thread block in bytes + + + kernelParams : Any + Array of pointers to kernel parameters + + + extra : Any + Extra options + + + kern : CUkernel + Kernel to launch, will only be referenced if func is NULL + + + ctx : CUcontext + Context for the kernel task to run in. The value NULL will indicate + the current context should be used by the api. This field is + ignored if func is set. + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUDA_KERNEL_NODE_PARAMS_v3(CUDA_KERNEL_NODE_PARAMS_v3_st): + """ + GPU kernel node parameters + + Attributes + ---------- + + func : CUfunction + Kernel to launch + + + gridDimX : unsigned int + Width of grid in blocks + + + gridDimY : unsigned int + Height of grid in blocks + + + gridDimZ : unsigned int + Depth of grid in blocks + + + blockDimX : unsigned int + X dimension of each thread block + + + blockDimY : unsigned int + Y dimension of each thread block + + + blockDimZ : unsigned int + Z dimension of each thread block + + + sharedMemBytes : unsigned int + Dynamic shared-memory size per thread block in bytes + + + kernelParams : Any + Array of pointers to kernel parameters + + + extra : Any + Extra options + + + kern : CUkernel + Kernel to launch, will only be referenced if func is NULL + + + ctx : CUcontext + Context for the kernel task to run in. The value NULL will indicate + the current context should be used by the api. This field is + ignored if func is set. + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUDA_MEMSET_NODE_PARAMS_v1(CUDA_MEMSET_NODE_PARAMS_st): + """ + Memset node parameters + + Attributes + ---------- + + dst : CUdeviceptr + Destination device pointer + + + pitch : size_t + Pitch of destination device pointer. Unused if height is 1 + + + value : unsigned int + Value to be set + + + elementSize : unsigned int + Size of each element in bytes. Must be 1, 2, or 4. + + + width : size_t + Width of the row in elements + + + height : size_t + Number of rows + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUDA_MEMSET_NODE_PARAMS(CUDA_MEMSET_NODE_PARAMS_v1): + """ + Memset node parameters + + Attributes + ---------- + + dst : CUdeviceptr + Destination device pointer + + + pitch : size_t + Pitch of destination device pointer. Unused if height is 1 + + + value : unsigned int + Value to be set + + + elementSize : unsigned int + Size of each element in bytes. Must be 1, 2, or 4. + + + width : size_t + Width of the row in elements + + + height : size_t + Number of rows + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUDA_MEMSET_NODE_PARAMS_v2(CUDA_MEMSET_NODE_PARAMS_v2_st): + """ + Memset node parameters + + Attributes + ---------- + + dst : CUdeviceptr + Destination device pointer + + + pitch : size_t + Pitch of destination device pointer. Unused if height is 1 + + + value : unsigned int + Value to be set + + + elementSize : unsigned int + Size of each element in bytes. Must be 1, 2, or 4. + + + width : size_t + Width of the row in elements + + + height : size_t + Number of rows + + + ctx : CUcontext + Context on which to run the node + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUDA_HOST_NODE_PARAMS_v1(CUDA_HOST_NODE_PARAMS_st): + """ + Host node parameters + + Attributes + ---------- + + fn : CUhostFn + The function to call when the node executes + + + userData : Any + Argument to pass to the function + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUDA_HOST_NODE_PARAMS(CUDA_HOST_NODE_PARAMS_v1): + """ + Host node parameters + + Attributes + ---------- + + fn : CUhostFn + The function to call when the node executes + + + userData : Any + Argument to pass to the function + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUDA_HOST_NODE_PARAMS_v2(CUDA_HOST_NODE_PARAMS_v2_st): + """ + Host node parameters + + Attributes + ---------- + + fn : CUhostFn + The function to call when the node executes + + + userData : Any + Argument to pass to the function + + + syncMode : unsigned int + The sync mode to use for the host task + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUgraphEdgeData(CUgraphEdgeData_st): + """ + Optional annotation for edges in a CUDA graph. Note, all edges + implicitly have annotations and default to a zero-initialized value + if not specified. A zero-initialized struct indicates a standard + full serialization of two nodes with memory visibility. + + Attributes + ---------- + + from_port : bytes + This indicates when the dependency is triggered from the upstream + node on the edge. The meaning is specfic to the node type. A value + of 0 in all cases means full completion of the upstream node, with + memory visibility to the downstream node or portion thereof + (indicated by `to_port`). Only kernel nodes define non-zero + ports. A kernel node can use the following output port types: + CU_GRAPH_KERNEL_NODE_PORT_DEFAULT, + CU_GRAPH_KERNEL_NODE_PORT_PROGRAMMATIC, or + CU_GRAPH_KERNEL_NODE_PORT_LAUNCH_ORDER. + + + to_port : bytes + This indicates what portion of the downstream node is dependent on + the upstream node or portion thereof (indicated by `from_port`). + The meaning is specific to the node type. A value of 0 in all cases + means the entirety of the downstream node is dependent on the + upstream work. Currently no node types define non-zero ports. + Accordingly, this field must be set to zero. + + + type : bytes + This should be populated with a value from CUgraphDependencyType. + (It is typed as char due to compiler-specific layout of bitfields.) + See CUgraphDependencyType. + + + reserved : bytes + These bytes are unused and must be zeroed. This ensures + compatibility if additional fields are added in the future. + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUDA_GRAPH_INSTANTIATE_PARAMS(CUDA_GRAPH_INSTANTIATE_PARAMS_st): + """ + Graph instantiation parameters + + Attributes + ---------- + + flags : cuuint64_t + Instantiation flags + + + hUploadStream : CUstream + Upload stream + + + hErrNode_out : CUgraphNode + The node which caused instantiation to fail, if any + + + result_out : CUgraphInstantiateResult + Whether instantiation was successful. If it failed, the reason why + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUlaunchMemSyncDomainMap(CUlaunchMemSyncDomainMap_st): + """ + Memory Synchronization Domain map See ::cudaLaunchMemSyncDomain. + By default, kernels are launched in domain 0. Kernel launched with + CU_LAUNCH_MEM_SYNC_DOMAIN_REMOTE will have a different domain ID. + User may also alter the domain ID with CUlaunchMemSyncDomainMap for + a specific stream / graph node / kernel launch. See + CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP. Domain ID range is + available through CU_DEVICE_ATTRIBUTE_MEM_SYNC_DOMAIN_COUNT. + + Attributes + ---------- + + default_ : bytes + The default domain ID to use for designated kernels + + + remote : bytes + The remote domain ID to use for designated kernels + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUlaunchAttributeValue(CUlaunchAttributeValue_union): + """ + Launch attributes union; used as value field of CUlaunchAttribute + + Attributes + ---------- + + pad : bytes + + + + accessPolicyWindow : CUaccessPolicyWindow + Value of launch attribute CU_LAUNCH_ATTRIBUTE_ACCESS_POLICY_WINDOW. + + + cooperative : int + Value of launch attribute CU_LAUNCH_ATTRIBUTE_COOPERATIVE. Nonzero + indicates a cooperative kernel (see cuLaunchCooperativeKernel). + + + syncPolicy : CUsynchronizationPolicy + Value of launch attribute + CU_LAUNCH_ATTRIBUTE_SYNCHRONIZATION_POLICY. CUsynchronizationPolicy + for work queued up in this stream + + + clusterDim : anon_struct1 + Value of launch attribute CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION + that represents the desired cluster dimensions for the kernel. + Opaque type with the following fields: - `x` - The X dimension of + the cluster, in blocks. Must be a divisor of the grid X dimension. + - `y` - The Y dimension of the cluster, in blocks. Must be a + divisor of the grid Y dimension. - `z` - The Z dimension of the + cluster, in blocks. Must be a divisor of the grid Z dimension. + + + clusterSchedulingPolicyPreference : CUclusterSchedulingPolicy + Value of launch attribute + CU_LAUNCH_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE. Cluster + scheduling policy preference for the kernel. + + + programmaticStreamSerializationAllowed : int + Value of launch attribute + CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_STREAM_SERIALIZATION. + + + programmaticEvent : anon_struct2 + Value of launch attribute CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_EVENT + with the following fields: - `CUevent` event - Event to fire when + all blocks trigger it. - `Event` record flags, see + cuEventRecordWithFlags. Does not accept :CU_EVENT_RECORD_EXTERNAL. + - `triggerAtBlockStart` - If this is set to non-0, each block + launch will automatically trigger the event. + + + launchCompletionEvent : anon_struct3 + Value of launch attribute + CU_LAUNCH_ATTRIBUTE_LAUNCH_COMPLETION_EVENT with the following + fields: - `CUevent` event - Event to fire when the last block + launches - `int` flags; - Event record flags, see + cuEventRecordWithFlags. Does not accept CU_EVENT_RECORD_EXTERNAL. + + + priority : int + Value of launch attribute CU_LAUNCH_ATTRIBUTE_PRIORITY. Execution + priority of the kernel. + + + memSyncDomainMap : CUlaunchMemSyncDomainMap + Value of launch attribute CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP. + See CUlaunchMemSyncDomainMap. + + + memSyncDomain : CUlaunchMemSyncDomain + Value of launch attribute CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN. + See::CUlaunchMemSyncDomain + + + preferredClusterDim : anon_struct4 + Value of launch attribute + CU_LAUNCH_ATTRIBUTE_PREFERRED_CLUSTER_DIMENSION that represents the + desired preferred cluster dimensions for the kernel. Opaque type + with the following fields: - `x` - The X dimension of the preferred + cluster, in blocks. Must be a divisor of the grid X dimension, and + must be a multiple of the `x` field of + CUlaunchAttributeValue::clusterDim. - `y` - The Y dimension of + the preferred cluster, in blocks. Must be a divisor of the grid Y + dimension, and must be a multiple of the `y` field of + CUlaunchAttributeValue::clusterDim. - `z` - The Z dimension of + the preferred cluster, in blocks. Must be equal to the `z` field of + CUlaunchAttributeValue::clusterDim. + + + deviceUpdatableKernelNode : anon_struct5 + Value of launch attribute + CU_LAUNCH_ATTRIBUTE_DEVICE_UPDATABLE_KERNEL_NODE. with the + following fields: - `int` deviceUpdatable - Whether or not the + resulting kernel node should be device-updatable. - + `CUgraphDeviceNode` devNode - Returns a handle to pass to the + various device-side update functions. + + + sharedMemCarveout : unsigned int + Value of launch attribute + CU_LAUNCH_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT. + + + nvlinkUtilCentricScheduling : unsigned int + + + + portableClusterSizeMode : CUlaunchAttributePortableClusterMode + Value of launch attribute + CU_LAUNCH_ATTRIBUTE_PORTABLE_CLUSTER_SIZE_MODE. + + + sharedMemoryMode : CUsharedMemoryMode + Value of launch attribute CU_LAUNCH_ATTRIBUTE_SHARED_MEMORY_MODE. + See CUsharedMemoryMode for acceptable values. + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUlaunchAttribute(CUlaunchAttribute_st): + """ + Launch attribute + + Attributes + ---------- + + id : CUlaunchAttributeID + Attribute to set + + + value : CUlaunchAttributeValue + Value of the attribute + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUlaunchConfig(CUlaunchConfig_st): + """ + CUDA extensible launch configuration + + Attributes + ---------- + + gridDimX : unsigned int + Width of grid in blocks + + + gridDimY : unsigned int + Height of grid in blocks + + + gridDimZ : unsigned int + Depth of grid in blocks + + + blockDimX : unsigned int + X dimension of each thread block + + + blockDimY : unsigned int + Y dimension of each thread block + + + blockDimZ : unsigned int + Z dimension of each thread block + + + sharedMemBytes : unsigned int + Dynamic shared-memory size per thread block in bytes + + + hStream : CUstream + Stream identifier + + + attrs : CUlaunchAttribute + List of attributes; nullable if CUlaunchConfig::numAttrs == 0 + + + numAttrs : unsigned int + Number of attributes populated in CUlaunchConfig::attrs + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUkernelNodeAttrValue_v1(CUlaunchAttributeValue): + """ + Launch attributes union; used as value field of CUlaunchAttribute + + Attributes + ---------- + + pad : bytes + + + + accessPolicyWindow : CUaccessPolicyWindow + Value of launch attribute CU_LAUNCH_ATTRIBUTE_ACCESS_POLICY_WINDOW. + + + cooperative : int + Value of launch attribute CU_LAUNCH_ATTRIBUTE_COOPERATIVE. Nonzero + indicates a cooperative kernel (see cuLaunchCooperativeKernel). + + + syncPolicy : CUsynchronizationPolicy + Value of launch attribute + CU_LAUNCH_ATTRIBUTE_SYNCHRONIZATION_POLICY. CUsynchronizationPolicy + for work queued up in this stream + + + clusterDim : anon_struct1 + Value of launch attribute CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION + that represents the desired cluster dimensions for the kernel. + Opaque type with the following fields: - `x` - The X dimension of + the cluster, in blocks. Must be a divisor of the grid X dimension. + - `y` - The Y dimension of the cluster, in blocks. Must be a + divisor of the grid Y dimension. - `z` - The Z dimension of the + cluster, in blocks. Must be a divisor of the grid Z dimension. + + + clusterSchedulingPolicyPreference : CUclusterSchedulingPolicy + Value of launch attribute + CU_LAUNCH_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE. Cluster + scheduling policy preference for the kernel. + + + programmaticStreamSerializationAllowed : int + Value of launch attribute + CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_STREAM_SERIALIZATION. + + + programmaticEvent : anon_struct2 + Value of launch attribute CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_EVENT + with the following fields: - `CUevent` event - Event to fire when + all blocks trigger it. - `Event` record flags, see + cuEventRecordWithFlags. Does not accept :CU_EVENT_RECORD_EXTERNAL. + - `triggerAtBlockStart` - If this is set to non-0, each block + launch will automatically trigger the event. + + + launchCompletionEvent : anon_struct3 + Value of launch attribute + CU_LAUNCH_ATTRIBUTE_LAUNCH_COMPLETION_EVENT with the following + fields: - `CUevent` event - Event to fire when the last block + launches - `int` flags; - Event record flags, see + cuEventRecordWithFlags. Does not accept CU_EVENT_RECORD_EXTERNAL. + + + priority : int + Value of launch attribute CU_LAUNCH_ATTRIBUTE_PRIORITY. Execution + priority of the kernel. + + + memSyncDomainMap : CUlaunchMemSyncDomainMap + Value of launch attribute CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP. + See CUlaunchMemSyncDomainMap. + + + memSyncDomain : CUlaunchMemSyncDomain + Value of launch attribute CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN. + See::CUlaunchMemSyncDomain + + + preferredClusterDim : anon_struct4 + Value of launch attribute + CU_LAUNCH_ATTRIBUTE_PREFERRED_CLUSTER_DIMENSION that represents the + desired preferred cluster dimensions for the kernel. Opaque type + with the following fields: - `x` - The X dimension of the preferred + cluster, in blocks. Must be a divisor of the grid X dimension, and + must be a multiple of the `x` field of + CUlaunchAttributeValue::clusterDim. - `y` - The Y dimension of + the preferred cluster, in blocks. Must be a divisor of the grid Y + dimension, and must be a multiple of the `y` field of + CUlaunchAttributeValue::clusterDim. - `z` - The Z dimension of + the preferred cluster, in blocks. Must be equal to the `z` field of + CUlaunchAttributeValue::clusterDim. + + + deviceUpdatableKernelNode : anon_struct5 + Value of launch attribute + CU_LAUNCH_ATTRIBUTE_DEVICE_UPDATABLE_KERNEL_NODE. with the + following fields: - `int` deviceUpdatable - Whether or not the + resulting kernel node should be device-updatable. - + `CUgraphDeviceNode` devNode - Returns a handle to pass to the + various device-side update functions. + + + sharedMemCarveout : unsigned int + Value of launch attribute + CU_LAUNCH_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT. + + + nvlinkUtilCentricScheduling : unsigned int + + + + portableClusterSizeMode : CUlaunchAttributePortableClusterMode + Value of launch attribute + CU_LAUNCH_ATTRIBUTE_PORTABLE_CLUSTER_SIZE_MODE. + + + sharedMemoryMode : CUsharedMemoryMode + Value of launch attribute CU_LAUNCH_ATTRIBUTE_SHARED_MEMORY_MODE. + See CUsharedMemoryMode for acceptable values. + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUkernelNodeAttrValue(CUkernelNodeAttrValue_v1): + """ + Launch attributes union; used as value field of CUlaunchAttribute + + Attributes + ---------- + + pad : bytes + + + + accessPolicyWindow : CUaccessPolicyWindow + Value of launch attribute CU_LAUNCH_ATTRIBUTE_ACCESS_POLICY_WINDOW. + + + cooperative : int + Value of launch attribute CU_LAUNCH_ATTRIBUTE_COOPERATIVE. Nonzero + indicates a cooperative kernel (see cuLaunchCooperativeKernel). + + + syncPolicy : CUsynchronizationPolicy + Value of launch attribute + CU_LAUNCH_ATTRIBUTE_SYNCHRONIZATION_POLICY. CUsynchronizationPolicy + for work queued up in this stream + + + clusterDim : anon_struct1 + Value of launch attribute CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION + that represents the desired cluster dimensions for the kernel. + Opaque type with the following fields: - `x` - The X dimension of + the cluster, in blocks. Must be a divisor of the grid X dimension. + - `y` - The Y dimension of the cluster, in blocks. Must be a + divisor of the grid Y dimension. - `z` - The Z dimension of the + cluster, in blocks. Must be a divisor of the grid Z dimension. + + + clusterSchedulingPolicyPreference : CUclusterSchedulingPolicy + Value of launch attribute + CU_LAUNCH_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE. Cluster + scheduling policy preference for the kernel. + + + programmaticStreamSerializationAllowed : int + Value of launch attribute + CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_STREAM_SERIALIZATION. + + + programmaticEvent : anon_struct2 + Value of launch attribute CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_EVENT + with the following fields: - `CUevent` event - Event to fire when + all blocks trigger it. - `Event` record flags, see + cuEventRecordWithFlags. Does not accept :CU_EVENT_RECORD_EXTERNAL. + - `triggerAtBlockStart` - If this is set to non-0, each block + launch will automatically trigger the event. + + + launchCompletionEvent : anon_struct3 + Value of launch attribute + CU_LAUNCH_ATTRIBUTE_LAUNCH_COMPLETION_EVENT with the following + fields: - `CUevent` event - Event to fire when the last block + launches - `int` flags; - Event record flags, see + cuEventRecordWithFlags. Does not accept CU_EVENT_RECORD_EXTERNAL. + + + priority : int + Value of launch attribute CU_LAUNCH_ATTRIBUTE_PRIORITY. Execution + priority of the kernel. + + + memSyncDomainMap : CUlaunchMemSyncDomainMap + Value of launch attribute CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP. + See CUlaunchMemSyncDomainMap. + + + memSyncDomain : CUlaunchMemSyncDomain + Value of launch attribute CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN. + See::CUlaunchMemSyncDomain + + + preferredClusterDim : anon_struct4 + Value of launch attribute + CU_LAUNCH_ATTRIBUTE_PREFERRED_CLUSTER_DIMENSION that represents the + desired preferred cluster dimensions for the kernel. Opaque type + with the following fields: - `x` - The X dimension of the preferred + cluster, in blocks. Must be a divisor of the grid X dimension, and + must be a multiple of the `x` field of + CUlaunchAttributeValue::clusterDim. - `y` - The Y dimension of + the preferred cluster, in blocks. Must be a divisor of the grid Y + dimension, and must be a multiple of the `y` field of + CUlaunchAttributeValue::clusterDim. - `z` - The Z dimension of + the preferred cluster, in blocks. Must be equal to the `z` field of + CUlaunchAttributeValue::clusterDim. + + + deviceUpdatableKernelNode : anon_struct5 + Value of launch attribute + CU_LAUNCH_ATTRIBUTE_DEVICE_UPDATABLE_KERNEL_NODE. with the + following fields: - `int` deviceUpdatable - Whether or not the + resulting kernel node should be device-updatable. - + `CUgraphDeviceNode` devNode - Returns a handle to pass to the + various device-side update functions. + + + sharedMemCarveout : unsigned int + Value of launch attribute + CU_LAUNCH_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT. + + + nvlinkUtilCentricScheduling : unsigned int + + + + portableClusterSizeMode : CUlaunchAttributePortableClusterMode + Value of launch attribute + CU_LAUNCH_ATTRIBUTE_PORTABLE_CLUSTER_SIZE_MODE. + + + sharedMemoryMode : CUsharedMemoryMode + Value of launch attribute CU_LAUNCH_ATTRIBUTE_SHARED_MEMORY_MODE. + See CUsharedMemoryMode for acceptable values. + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUstreamAttrValue_v1(CUlaunchAttributeValue): + """ + Launch attributes union; used as value field of CUlaunchAttribute + + Attributes + ---------- + + pad : bytes + + + + accessPolicyWindow : CUaccessPolicyWindow + Value of launch attribute CU_LAUNCH_ATTRIBUTE_ACCESS_POLICY_WINDOW. + + + cooperative : int + Value of launch attribute CU_LAUNCH_ATTRIBUTE_COOPERATIVE. Nonzero + indicates a cooperative kernel (see cuLaunchCooperativeKernel). + + + syncPolicy : CUsynchronizationPolicy + Value of launch attribute + CU_LAUNCH_ATTRIBUTE_SYNCHRONIZATION_POLICY. CUsynchronizationPolicy + for work queued up in this stream + + + clusterDim : anon_struct1 + Value of launch attribute CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION + that represents the desired cluster dimensions for the kernel. + Opaque type with the following fields: - `x` - The X dimension of + the cluster, in blocks. Must be a divisor of the grid X dimension. + - `y` - The Y dimension of the cluster, in blocks. Must be a + divisor of the grid Y dimension. - `z` - The Z dimension of the + cluster, in blocks. Must be a divisor of the grid Z dimension. + + + clusterSchedulingPolicyPreference : CUclusterSchedulingPolicy + Value of launch attribute + CU_LAUNCH_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE. Cluster + scheduling policy preference for the kernel. + + + programmaticStreamSerializationAllowed : int + Value of launch attribute + CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_STREAM_SERIALIZATION. + + + programmaticEvent : anon_struct2 + Value of launch attribute CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_EVENT + with the following fields: - `CUevent` event - Event to fire when + all blocks trigger it. - `Event` record flags, see + cuEventRecordWithFlags. Does not accept :CU_EVENT_RECORD_EXTERNAL. + - `triggerAtBlockStart` - If this is set to non-0, each block + launch will automatically trigger the event. + + + launchCompletionEvent : anon_struct3 + Value of launch attribute + CU_LAUNCH_ATTRIBUTE_LAUNCH_COMPLETION_EVENT with the following + fields: - `CUevent` event - Event to fire when the last block + launches - `int` flags; - Event record flags, see + cuEventRecordWithFlags. Does not accept CU_EVENT_RECORD_EXTERNAL. + + + priority : int + Value of launch attribute CU_LAUNCH_ATTRIBUTE_PRIORITY. Execution + priority of the kernel. + + + memSyncDomainMap : CUlaunchMemSyncDomainMap + Value of launch attribute CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP. + See CUlaunchMemSyncDomainMap. + + + memSyncDomain : CUlaunchMemSyncDomain + Value of launch attribute CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN. + See::CUlaunchMemSyncDomain + + + preferredClusterDim : anon_struct4 + Value of launch attribute + CU_LAUNCH_ATTRIBUTE_PREFERRED_CLUSTER_DIMENSION that represents the + desired preferred cluster dimensions for the kernel. Opaque type + with the following fields: - `x` - The X dimension of the preferred + cluster, in blocks. Must be a divisor of the grid X dimension, and + must be a multiple of the `x` field of + CUlaunchAttributeValue::clusterDim. - `y` - The Y dimension of + the preferred cluster, in blocks. Must be a divisor of the grid Y + dimension, and must be a multiple of the `y` field of + CUlaunchAttributeValue::clusterDim. - `z` - The Z dimension of + the preferred cluster, in blocks. Must be equal to the `z` field of + CUlaunchAttributeValue::clusterDim. + + + deviceUpdatableKernelNode : anon_struct5 + Value of launch attribute + CU_LAUNCH_ATTRIBUTE_DEVICE_UPDATABLE_KERNEL_NODE. with the + following fields: - `int` deviceUpdatable - Whether or not the + resulting kernel node should be device-updatable. - + `CUgraphDeviceNode` devNode - Returns a handle to pass to the + various device-side update functions. + + + sharedMemCarveout : unsigned int + Value of launch attribute + CU_LAUNCH_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT. + + + nvlinkUtilCentricScheduling : unsigned int + + + + portableClusterSizeMode : CUlaunchAttributePortableClusterMode + Value of launch attribute + CU_LAUNCH_ATTRIBUTE_PORTABLE_CLUSTER_SIZE_MODE. + + + sharedMemoryMode : CUsharedMemoryMode + Value of launch attribute CU_LAUNCH_ATTRIBUTE_SHARED_MEMORY_MODE. + See CUsharedMemoryMode for acceptable values. + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUstreamAttrValue(CUstreamAttrValue_v1): + """ + Launch attributes union; used as value field of CUlaunchAttribute + + Attributes + ---------- + + pad : bytes + + + + accessPolicyWindow : CUaccessPolicyWindow + Value of launch attribute CU_LAUNCH_ATTRIBUTE_ACCESS_POLICY_WINDOW. + + + cooperative : int + Value of launch attribute CU_LAUNCH_ATTRIBUTE_COOPERATIVE. Nonzero + indicates a cooperative kernel (see cuLaunchCooperativeKernel). + + + syncPolicy : CUsynchronizationPolicy + Value of launch attribute + CU_LAUNCH_ATTRIBUTE_SYNCHRONIZATION_POLICY. CUsynchronizationPolicy + for work queued up in this stream + + + clusterDim : anon_struct1 + Value of launch attribute CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION + that represents the desired cluster dimensions for the kernel. + Opaque type with the following fields: - `x` - The X dimension of + the cluster, in blocks. Must be a divisor of the grid X dimension. + - `y` - The Y dimension of the cluster, in blocks. Must be a + divisor of the grid Y dimension. - `z` - The Z dimension of the + cluster, in blocks. Must be a divisor of the grid Z dimension. + + + clusterSchedulingPolicyPreference : CUclusterSchedulingPolicy + Value of launch attribute + CU_LAUNCH_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE. Cluster + scheduling policy preference for the kernel. + + + programmaticStreamSerializationAllowed : int + Value of launch attribute + CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_STREAM_SERIALIZATION. + + + programmaticEvent : anon_struct2 + Value of launch attribute CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_EVENT + with the following fields: - `CUevent` event - Event to fire when + all blocks trigger it. - `Event` record flags, see + cuEventRecordWithFlags. Does not accept :CU_EVENT_RECORD_EXTERNAL. + - `triggerAtBlockStart` - If this is set to non-0, each block + launch will automatically trigger the event. + + + launchCompletionEvent : anon_struct3 + Value of launch attribute + CU_LAUNCH_ATTRIBUTE_LAUNCH_COMPLETION_EVENT with the following + fields: - `CUevent` event - Event to fire when the last block + launches - `int` flags; - Event record flags, see + cuEventRecordWithFlags. Does not accept CU_EVENT_RECORD_EXTERNAL. + + + priority : int + Value of launch attribute CU_LAUNCH_ATTRIBUTE_PRIORITY. Execution + priority of the kernel. + + + memSyncDomainMap : CUlaunchMemSyncDomainMap + Value of launch attribute CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP. + See CUlaunchMemSyncDomainMap. + + + memSyncDomain : CUlaunchMemSyncDomain + Value of launch attribute CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN. + See::CUlaunchMemSyncDomain + + + preferredClusterDim : anon_struct4 + Value of launch attribute + CU_LAUNCH_ATTRIBUTE_PREFERRED_CLUSTER_DIMENSION that represents the + desired preferred cluster dimensions for the kernel. Opaque type + with the following fields: - `x` - The X dimension of the preferred + cluster, in blocks. Must be a divisor of the grid X dimension, and + must be a multiple of the `x` field of + CUlaunchAttributeValue::clusterDim. - `y` - The Y dimension of + the preferred cluster, in blocks. Must be a divisor of the grid Y + dimension, and must be a multiple of the `y` field of + CUlaunchAttributeValue::clusterDim. - `z` - The Z dimension of + the preferred cluster, in blocks. Must be equal to the `z` field of + CUlaunchAttributeValue::clusterDim. + + + deviceUpdatableKernelNode : anon_struct5 + Value of launch attribute + CU_LAUNCH_ATTRIBUTE_DEVICE_UPDATABLE_KERNEL_NODE. with the + following fields: - `int` deviceUpdatable - Whether or not the + resulting kernel node should be device-updatable. - + `CUgraphDeviceNode` devNode - Returns a handle to pass to the + various device-side update functions. + + + sharedMemCarveout : unsigned int + Value of launch attribute + CU_LAUNCH_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT. + + + nvlinkUtilCentricScheduling : unsigned int + + + + portableClusterSizeMode : CUlaunchAttributePortableClusterMode + Value of launch attribute + CU_LAUNCH_ATTRIBUTE_PORTABLE_CLUSTER_SIZE_MODE. + + + sharedMemoryMode : CUsharedMemoryMode + Value of launch attribute CU_LAUNCH_ATTRIBUTE_SHARED_MEMORY_MODE. + See CUsharedMemoryMode for acceptable values. + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUexecAffinitySmCount_v1(CUexecAffinitySmCount_st): + """ + Value for CU_EXEC_AFFINITY_TYPE_SM_COUNT + + Attributes + ---------- + + val : unsigned int + The number of SMs the context is limited to use. + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUexecAffinitySmCount(CUexecAffinitySmCount_v1): + """ + Value for CU_EXEC_AFFINITY_TYPE_SM_COUNT + + Attributes + ---------- + + val : unsigned int + The number of SMs the context is limited to use. + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUexecAffinityParam_v1(CUexecAffinityParam_st): + """ + Execution Affinity Parameters + + Attributes + ---------- + + type : CUexecAffinityType + Type of execution affinity. + + + param : anon_union3 + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUexecAffinityParam(CUexecAffinityParam_v1): + """ + Execution Affinity Parameters + + Attributes + ---------- + + type : CUexecAffinityType + Type of execution affinity. + + + param : anon_union3 + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUctxCigParam(CUctxCigParam_st): + """ + CIG Context Create Params + + Attributes + ---------- + + sharedDataType : CUcigDataType + Type of shared data from graphics client (D3D12 or Vulkan). + + + sharedData : Any + Graphics client data handle (ID3D12CommandQueue or Nvidia specific + data blob). + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUctxCreateParams(CUctxCreateParams_st): + """ + Params for creating CUDA context. Both execAffinityParams and + cigParams cannot be non-NULL at the same time. If both are NULL, + the context will be created as a regular CUDA context. + + Attributes + ---------- + + execAffinityParams : CUexecAffinityParam + Array of execution affinity parameters to limit context resources + (e.g., SM count). Only supported Volta+ MPS. Mutually exclusive + with cigParams. + + + numExecAffinityParams : int + Number of elements in execAffinityParams array. Must be 0 if + execAffinityParams is NULL. + + + cigParams : CUctxCigParam + CIG (CUDA in Graphics) parameters for sharing data from + D3D12/Vulkan graphics clients. Mutually exclusive with + execAffinityParams. + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUstreamCigParam(CUstreamCigParam_st): + """ + CIG Stream Capture Params + + Attributes + ---------- + + streamSharedDataType : CUstreamCigDataType + Type of shared data from graphics client (D3D12). + + + streamSharedData : Any + Graphics client data handle + (ID3D12CommandList/ID3D12GraphicsCommandList). + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUstreamCigCaptureParams(CUstreamCigCaptureParams_st): + """ + Params for capturing CUDA stream to CIG streamCigParams must be + non-NULL. + + Attributes + ---------- + + streamCigParams : CUstreamCigParam + CIG (CUDA in Graphics) parameters for sharing command list data + from D3D12 graphics clients. + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUlibraryHostUniversalFunctionAndDataTable(CUlibraryHostUniversalFunctionAndDataTable_st): + """ + Attributes + ---------- + + functionTable : Any + + + + functionWindowSize : size_t + + + + dataTable : Any + + + + dataWindowSize : size_t + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUDA_MEMCPY2D_v2(CUDA_MEMCPY2D_st): + """ + 2D memory copy parameters + + Attributes + ---------- + + srcXInBytes : size_t + Source X in bytes + + + srcY : size_t + Source Y + + + srcMemoryType : CUmemorytype + Source memory type (host, device, array) + + + srcHost : Any + Source host pointer + + + srcDevice : CUdeviceptr + Source device pointer + + + srcArray : CUarray + Source array reference + + + srcPitch : size_t + Source pitch (ignored when src is array) + + + dstXInBytes : size_t + Destination X in bytes + + + dstY : size_t + Destination Y + + + dstMemoryType : CUmemorytype + Destination memory type (host, device, array) + + + dstHost : Any + Destination host pointer + + + dstDevice : CUdeviceptr + Destination device pointer + + + dstArray : CUarray + Destination array reference + + + dstPitch : size_t + Destination pitch (ignored when dst is array) + + + WidthInBytes : size_t + Width of 2D memory copy in bytes + + + Height : size_t + Height of 2D memory copy + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUDA_MEMCPY2D(CUDA_MEMCPY2D_v2): + """ + 2D memory copy parameters + + Attributes + ---------- + + srcXInBytes : size_t + Source X in bytes + + + srcY : size_t + Source Y + + + srcMemoryType : CUmemorytype + Source memory type (host, device, array) + + + srcHost : Any + Source host pointer + + + srcDevice : CUdeviceptr + Source device pointer + + + srcArray : CUarray + Source array reference + + + srcPitch : size_t + Source pitch (ignored when src is array) + + + dstXInBytes : size_t + Destination X in bytes + + + dstY : size_t + Destination Y + + + dstMemoryType : CUmemorytype + Destination memory type (host, device, array) + + + dstHost : Any + Destination host pointer + + + dstDevice : CUdeviceptr + Destination device pointer + + + dstArray : CUarray + Destination array reference + + + dstPitch : size_t + Destination pitch (ignored when dst is array) + + + WidthInBytes : size_t + Width of 2D memory copy in bytes + + + Height : size_t + Height of 2D memory copy + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUDA_MEMCPY3D_v2(CUDA_MEMCPY3D_st): + """ + 3D memory copy parameters + + Attributes + ---------- + + srcXInBytes : size_t + Source X in bytes + + + srcY : size_t + Source Y + + + srcZ : size_t + Source Z + + + srcLOD : size_t + Source LOD + + + srcMemoryType : CUmemorytype + Source memory type (host, device, array) + + + srcHost : Any + Source host pointer + + + srcDevice : CUdeviceptr + Source device pointer + + + srcArray : CUarray + Source array reference + + + reserved0 : Any + Must be NULL + + + srcPitch : size_t + Source pitch (ignored when src is array) + + + srcHeight : size_t + Source height (ignored when src is array; may be 0 if Depth==1) + + + dstXInBytes : size_t + Destination X in bytes + + + dstY : size_t + Destination Y + + + dstZ : size_t + Destination Z + + + dstLOD : size_t + Destination LOD + + + dstMemoryType : CUmemorytype + Destination memory type (host, device, array) + + + dstHost : Any + Destination host pointer + + + dstDevice : CUdeviceptr + Destination device pointer + + + dstArray : CUarray + Destination array reference + + + reserved1 : Any + Must be NULL + + + dstPitch : size_t + Destination pitch (ignored when dst is array) + + + dstHeight : size_t + Destination height (ignored when dst is array; may be 0 if + Depth==1) + + + WidthInBytes : size_t + Width of 3D memory copy in bytes + + + Height : size_t + Height of 3D memory copy + + + Depth : size_t + Depth of 3D memory copy + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUDA_MEMCPY3D(CUDA_MEMCPY3D_v2): + """ + 3D memory copy parameters + + Attributes + ---------- + + srcXInBytes : size_t + Source X in bytes + + + srcY : size_t + Source Y + + + srcZ : size_t + Source Z + + + srcLOD : size_t + Source LOD + + + srcMemoryType : CUmemorytype + Source memory type (host, device, array) + + + srcHost : Any + Source host pointer + + + srcDevice : CUdeviceptr + Source device pointer + + + srcArray : CUarray + Source array reference + + + reserved0 : Any + Must be NULL + + + srcPitch : size_t + Source pitch (ignored when src is array) + + + srcHeight : size_t + Source height (ignored when src is array; may be 0 if Depth==1) + + + dstXInBytes : size_t + Destination X in bytes + + + dstY : size_t + Destination Y + + + dstZ : size_t + Destination Z + + + dstLOD : size_t + Destination LOD + + + dstMemoryType : CUmemorytype + Destination memory type (host, device, array) + + + dstHost : Any + Destination host pointer + + + dstDevice : CUdeviceptr + Destination device pointer + + + dstArray : CUarray + Destination array reference + + + reserved1 : Any + Must be NULL + + + dstPitch : size_t + Destination pitch (ignored when dst is array) + + + dstHeight : size_t + Destination height (ignored when dst is array; may be 0 if + Depth==1) + + + WidthInBytes : size_t + Width of 3D memory copy in bytes + + + Height : size_t + Height of 3D memory copy + + + Depth : size_t + Depth of 3D memory copy + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUDA_MEMCPY3D_PEER_v1(CUDA_MEMCPY3D_PEER_st): + """ + 3D memory cross-context copy parameters + + Attributes + ---------- + + srcXInBytes : size_t + Source X in bytes + + + srcY : size_t + Source Y + + + srcZ : size_t + Source Z + + + srcLOD : size_t + Source LOD + + + srcMemoryType : CUmemorytype + Source memory type (host, device, array) + + + srcHost : Any + Source host pointer + + + srcDevice : CUdeviceptr + Source device pointer + + + srcArray : CUarray + Source array reference + + + srcContext : CUcontext + Source context (ignored with srcMemoryType is CU_MEMORYTYPE_ARRAY) + + + srcPitch : size_t + Source pitch (ignored when src is array) + + + srcHeight : size_t + Source height (ignored when src is array; may be 0 if Depth==1) + + + dstXInBytes : size_t + Destination X in bytes + + + dstY : size_t + Destination Y + + + dstZ : size_t + Destination Z + + + dstLOD : size_t + Destination LOD + + + dstMemoryType : CUmemorytype + Destination memory type (host, device, array) + + + dstHost : Any + Destination host pointer + + + dstDevice : CUdeviceptr + Destination device pointer + + + dstArray : CUarray + Destination array reference + + + dstContext : CUcontext + Destination context (ignored with dstMemoryType is + CU_MEMORYTYPE_ARRAY) + + + dstPitch : size_t + Destination pitch (ignored when dst is array) + + + dstHeight : size_t + Destination height (ignored when dst is array; may be 0 if + Depth==1) + + + WidthInBytes : size_t + Width of 3D memory copy in bytes + + + Height : size_t + Height of 3D memory copy + + + Depth : size_t + Depth of 3D memory copy + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUDA_MEMCPY3D_PEER(CUDA_MEMCPY3D_PEER_v1): + """ + 3D memory cross-context copy parameters + + Attributes + ---------- + + srcXInBytes : size_t + Source X in bytes + + + srcY : size_t + Source Y + + srcZ : size_t Source Z + + srcLOD : size_t Source LOD + + srcMemoryType : CUmemorytype Source memory type (host, device, array) + + srcHost : Any Source host pointer + + srcDevice : CUdeviceptr Source device pointer + + srcArray : CUarray Source array reference - reserved0 : Any - Must be NULL + + + srcContext : CUcontext + Source context (ignored with srcMemoryType is CU_MEMORYTYPE_ARRAY) + + srcPitch : size_t Source pitch (ignored when src is array) + + srcHeight : size_t Source height (ignored when src is array; may be 0 if Depth==1) + + dstXInBytes : size_t Destination X in bytes + + dstY : size_t Destination Y + + dstZ : size_t Destination Z + + dstLOD : size_t Destination LOD + + dstMemoryType : CUmemorytype Destination memory type (host, device, array) + + dstHost : Any Destination host pointer + + dstDevice : CUdeviceptr Destination device pointer + + dstArray : CUarray Destination array reference - reserved1 : Any - Must be NULL + + + dstContext : CUcontext + Destination context (ignored with dstMemoryType is + CU_MEMORYTYPE_ARRAY) + + dstPitch : size_t Destination pitch (ignored when dst is array) + + dstHeight : size_t Destination height (ignored when dst is array; may be 0 if Depth==1) + + WidthInBytes : size_t Width of 3D memory copy in bytes + + Height : size_t Height of 3D memory copy + + Depth : size_t Depth of 3D memory copy + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUDA_MEMCPY_NODE_PARAMS(CUDA_MEMCPY_NODE_PARAMS_st): + """ + Memcpy node parameters + + Attributes + ---------- + + flags : int + Must be zero + + + reserved : int + Must be zero + + + copyCtx : CUcontext + Context on which to run the node + + + copyParams : CUDA_MEMCPY3D + Parameters for the memory copy + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUDA_ARRAY_DESCRIPTOR_v2(CUDA_ARRAY_DESCRIPTOR_st): + """ + Array descriptor + + Attributes + ---------- + + Width : size_t + Width of array + + + Height : size_t + Height of array + + + Format : CUarray_format + Array format + + + NumChannels : unsigned int + Channels per array element + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUDA_ARRAY_DESCRIPTOR(CUDA_ARRAY_DESCRIPTOR_v2): + """ + Array descriptor + + Attributes + ---------- + + Width : size_t + Width of array + + + Height : size_t + Height of array + + + Format : CUarray_format + Array format + + + NumChannels : unsigned int + Channels per array element + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUDA_ARRAY3D_DESCRIPTOR_v2(CUDA_ARRAY3D_DESCRIPTOR_st): + """ + 3D array descriptor + + Attributes + ---------- + + Width : size_t + Width of 3D array + + + Height : size_t + Height of 3D array + + + Depth : size_t + Depth of 3D array + + + Format : CUarray_format + Array format + + + NumChannels : unsigned int + Channels per array element + + + Flags : unsigned int + Flags + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUDA_ARRAY3D_DESCRIPTOR(CUDA_ARRAY3D_DESCRIPTOR_v2): + """ + 3D array descriptor + + Attributes + ---------- + + Width : size_t + Width of 3D array + + + Height : size_t + Height of 3D array + + + Depth : size_t + Depth of 3D array + + + Format : CUarray_format + Array format + + + NumChannels : unsigned int + Channels per array element + + + Flags : unsigned int + Flags + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUDA_ARRAY_SPARSE_PROPERTIES_v1(CUDA_ARRAY_SPARSE_PROPERTIES_st): + """ + CUDA array sparse properties + + Attributes + ---------- + + tileExtent : anon_struct6 + + + + miptailFirstLevel : unsigned int + First mip level at which the mip tail begins. + + + miptailSize : unsigned long long + Total size of the mip tail. + + + flags : unsigned int + Flags will either be zero or + CU_ARRAY_SPARSE_PROPERTIES_SINGLE_MIPTAIL + + + reserved : list[unsigned int] + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUDA_ARRAY_SPARSE_PROPERTIES(CUDA_ARRAY_SPARSE_PROPERTIES_v1): + """ + CUDA array sparse properties + + Attributes + ---------- + + tileExtent : anon_struct6 + + + + miptailFirstLevel : unsigned int + First mip level at which the mip tail begins. + + + miptailSize : unsigned long long + Total size of the mip tail. + + + flags : unsigned int + Flags will either be zero or + CU_ARRAY_SPARSE_PROPERTIES_SINGLE_MIPTAIL + + + reserved : list[unsigned int] + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUDA_ARRAY_MEMORY_REQUIREMENTS_v1(CUDA_ARRAY_MEMORY_REQUIREMENTS_st): + """ + CUDA array memory requirements + + Attributes + ---------- + + size : size_t + Total required memory size + + + alignment : size_t + alignment requirement + + + reserved : list[unsigned int] + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUDA_ARRAY_MEMORY_REQUIREMENTS(CUDA_ARRAY_MEMORY_REQUIREMENTS_v1): + """ + CUDA array memory requirements + + Attributes + ---------- + + size : size_t + Total required memory size + + + alignment : size_t + alignment requirement + + + reserved : list[unsigned int] + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUDA_RESOURCE_DESC_v1(CUDA_RESOURCE_DESC_st): + """ + CUDA Resource descriptor + + Attributes + ---------- + + resType : CUresourcetype + Resource type + + + res : anon_union4 + + + + flags : unsigned int + Flags (must be zero) + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUDA_RESOURCE_DESC(CUDA_RESOURCE_DESC_v1): + """ + CUDA Resource descriptor + + Attributes + ---------- + + resType : CUresourcetype + Resource type + + + res : anon_union4 + + + + flags : unsigned int + Flags (must be zero) + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUDA_TEXTURE_DESC_v1(CUDA_TEXTURE_DESC_st): + """ + Texture descriptor + + Attributes + ---------- + + addressMode : list[CUaddress_mode] + Address modes + + + filterMode : CUfilter_mode + Filter mode + + + flags : unsigned int + Flags + + + maxAnisotropy : unsigned int + Maximum anisotropy ratio + + + mipmapFilterMode : CUfilter_mode + Mipmap filter mode + + + mipmapLevelBias : float + Mipmap level bias + + + minMipmapLevelClamp : float + Mipmap minimum level clamp + + + maxMipmapLevelClamp : float + Mipmap maximum level clamp + + + borderColor : list[float] + Border Color + + + reserved : list[int] + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUDA_TEXTURE_DESC(CUDA_TEXTURE_DESC_v1): + """ + Texture descriptor + + Attributes + ---------- + + addressMode : list[CUaddress_mode] + Address modes + + + filterMode : CUfilter_mode + Filter mode + + + flags : unsigned int + Flags + + + maxAnisotropy : unsigned int + Maximum anisotropy ratio + + + mipmapFilterMode : CUfilter_mode + Mipmap filter mode + + + mipmapLevelBias : float + Mipmap level bias + + + minMipmapLevelClamp : float + Mipmap minimum level clamp + + + maxMipmapLevelClamp : float + Mipmap maximum level clamp + + + borderColor : list[float] + Border Color + + + reserved : list[int] + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUDA_RESOURCE_VIEW_DESC_v1(CUDA_RESOURCE_VIEW_DESC_st): + """ + Resource view descriptor + + Attributes + ---------- + + format : CUresourceViewFormat + Resource view format + + + width : size_t + Width of the resource view + + + height : size_t + Height of the resource view + + + depth : size_t + Depth of the resource view + + + firstMipmapLevel : unsigned int + First defined mipmap level + + + lastMipmapLevel : unsigned int + Last defined mipmap level + + + firstLayer : unsigned int + First layer index + + + lastLayer : unsigned int + Last layer index + + + reserved : list[unsigned int] + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUDA_RESOURCE_VIEW_DESC(CUDA_RESOURCE_VIEW_DESC_v1): + """ + Resource view descriptor + + Attributes + ---------- + + format : CUresourceViewFormat + Resource view format + + + width : size_t + Width of the resource view + + + height : size_t + Height of the resource view + + + depth : size_t + Depth of the resource view + + + firstMipmapLevel : unsigned int + First defined mipmap level + + + lastMipmapLevel : unsigned int + Last defined mipmap level + + + firstLayer : unsigned int + First layer index + + + lastLayer : unsigned int + Last layer index + + + reserved : list[unsigned int] + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUtensorMap(CUtensorMap_st): + """ + Tensor map descriptor. Requires compiler support for aligning to + 128 bytes. + + Attributes + ---------- + + opaque : list[cuuint64_t] + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUDA_POINTER_ATTRIBUTE_P2P_TOKENS_v1(CUDA_POINTER_ATTRIBUTE_P2P_TOKENS_st): + """ + GPU Direct v3 tokens + + Attributes + ---------- + + p2pToken : unsigned long long + + + + vaSpaceToken : unsigned int + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUDA_POINTER_ATTRIBUTE_P2P_TOKENS(CUDA_POINTER_ATTRIBUTE_P2P_TOKENS_v1): + """ + GPU Direct v3 tokens + + Attributes + ---------- + + p2pToken : unsigned long long + + + + vaSpaceToken : unsigned int + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUDA_LAUNCH_PARAMS_v1(CUDA_LAUNCH_PARAMS_st): + """ + Kernel launch parameters + + Attributes + ---------- + + function : CUfunction + Kernel to launch + + + gridDimX : unsigned int + Width of grid in blocks + + + gridDimY : unsigned int + Height of grid in blocks + + + gridDimZ : unsigned int + Depth of grid in blocks + + + blockDimX : unsigned int + X dimension of each thread block + + + blockDimY : unsigned int + Y dimension of each thread block + + + blockDimZ : unsigned int + Z dimension of each thread block + + + sharedMemBytes : unsigned int + Dynamic shared-memory size per thread block in bytes + + + hStream : CUstream + Stream identifier + + + kernelParams : Any + Array of pointers to kernel parameters + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUDA_LAUNCH_PARAMS(CUDA_LAUNCH_PARAMS_v1): + """ + Kernel launch parameters + + Attributes + ---------- + + function : CUfunction + Kernel to launch + + + gridDimX : unsigned int + Width of grid in blocks + + + gridDimY : unsigned int + Height of grid in blocks + + + gridDimZ : unsigned int + Depth of grid in blocks + + + blockDimX : unsigned int + X dimension of each thread block + + + blockDimY : unsigned int + Y dimension of each thread block + + + blockDimZ : unsigned int + Z dimension of each thread block + + + sharedMemBytes : unsigned int + Dynamic shared-memory size per thread block in bytes + + + hStream : CUstream + Stream identifier + + + kernelParams : Any + Array of pointers to kernel parameters + + Methods ------- getPtr() Get memory address of class instance + """ + pass + +cdef class CUDA_EXTERNAL_MEMORY_HANDLE_DESC_v1(CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st): + """ + External memory handle descriptor + + Attributes + ---------- + + type : CUexternalMemoryHandleType + Type of the handle + + + handle : anon_union5 + + + + size : unsigned long long + Size of the memory allocation + + + flags : unsigned int + Flags must either be zero or CUDA_EXTERNAL_MEMORY_DEDICATED + + + reserved : list[unsigned int] + + + Methods + ------- + getPtr() + Get memory address of class instance """ pass -{{endif}} -{{if 'CUDA_MEMCPY3D' in found_types}} -cdef class CUDA_MEMCPY3D(CUDA_MEMCPY3D_v2): +cdef class CUDA_EXTERNAL_MEMORY_HANDLE_DESC(CUDA_EXTERNAL_MEMORY_HANDLE_DESC_v1): """ - 3D memory copy parameters + External memory handle descriptor Attributes ---------- - srcXInBytes : size_t - Source X in bytes - srcY : size_t - Source Y - srcZ : size_t - Source Z - srcLOD : size_t - Source LOD - srcMemoryType : CUmemorytype - Source memory type (host, device, array) - srcHost : Any - Source host pointer - srcDevice : CUdeviceptr - Source device pointer - srcArray : CUarray - Source array reference - reserved0 : Any - Must be NULL - srcPitch : size_t - Source pitch (ignored when src is array) - srcHeight : size_t - Source height (ignored when src is array; may be 0 if Depth==1) - dstXInBytes : size_t - Destination X in bytes - dstY : size_t - Destination Y - dstZ : size_t - Destination Z - dstLOD : size_t - Destination LOD - dstMemoryType : CUmemorytype - Destination memory type (host, device, array) - dstHost : Any - Destination host pointer - dstDevice : CUdeviceptr - Destination device pointer - dstArray : CUarray - Destination array reference - reserved1 : Any - Must be NULL - dstPitch : size_t - Destination pitch (ignored when dst is array) - dstHeight : size_t - Destination height (ignored when dst is array; may be 0 if - Depth==1) - WidthInBytes : size_t - Width of 3D memory copy in bytes - Height : size_t - Height of 3D memory copy - Depth : size_t - Depth of 3D memory copy + + type : CUexternalMemoryHandleType + Type of the handle + + + handle : anon_union5 + + + + size : unsigned long long + Size of the memory allocation + + + flags : unsigned int + Flags must either be zero or CUDA_EXTERNAL_MEMORY_DEDICATED + + + reserved : list[unsigned int] + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUDA_EXTERNAL_MEMORY_BUFFER_DESC_v1(CUDA_EXTERNAL_MEMORY_BUFFER_DESC_st): + """ + External memory buffer descriptor + + Attributes + ---------- + + offset : unsigned long long + Offset into the memory object where the buffer's base is + + + size : unsigned long long + Size of the buffer + + + flags : unsigned int + Flags reserved for future use. Must be zero. + + + reserved : list[unsigned int] + + Methods ------- getPtr() Get memory address of class instance + """ + pass + +cdef class CUDA_EXTERNAL_MEMORY_BUFFER_DESC(CUDA_EXTERNAL_MEMORY_BUFFER_DESC_v1): + """ + External memory buffer descriptor + + Attributes + ---------- + + offset : unsigned long long + Offset into the memory object where the buffer's base is + + + size : unsigned long long + Size of the buffer + + + flags : unsigned int + Flags reserved for future use. Must be zero. + + + reserved : list[unsigned int] + + + Methods + ------- + getPtr() + Get memory address of class instance """ pass -{{endif}} -{{if 'CUDA_MEMCPY3D_PEER_v1' in found_types}} -cdef class CUDA_MEMCPY3D_PEER_v1(CUDA_MEMCPY3D_PEER_st): +cdef class CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_v1(CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_st): """ - 3D memory cross-context copy parameters + External memory mipmap descriptor Attributes ---------- - srcXInBytes : size_t - Source X in bytes - srcY : size_t - Source Y - srcZ : size_t - Source Z - srcLOD : size_t - Source LOD - srcMemoryType : CUmemorytype - Source memory type (host, device, array) - srcHost : Any - Source host pointer - srcDevice : CUdeviceptr - Source device pointer - srcArray : CUarray - Source array reference - srcContext : CUcontext - Source context (ignored with srcMemoryType is CU_MEMORYTYPE_ARRAY) - srcPitch : size_t - Source pitch (ignored when src is array) - srcHeight : size_t - Source height (ignored when src is array; may be 0 if Depth==1) - dstXInBytes : size_t - Destination X in bytes - dstY : size_t - Destination Y - dstZ : size_t - Destination Z - dstLOD : size_t - Destination LOD - dstMemoryType : CUmemorytype - Destination memory type (host, device, array) - dstHost : Any - Destination host pointer - dstDevice : CUdeviceptr - Destination device pointer - dstArray : CUarray - Destination array reference - dstContext : CUcontext - Destination context (ignored with dstMemoryType is - CU_MEMORYTYPE_ARRAY) - dstPitch : size_t - Destination pitch (ignored when dst is array) - dstHeight : size_t - Destination height (ignored when dst is array; may be 0 if - Depth==1) - WidthInBytes : size_t - Width of 3D memory copy in bytes - Height : size_t - Height of 3D memory copy - Depth : size_t - Depth of 3D memory copy + + offset : unsigned long long + Offset into the memory object where the base level of the mipmap + chain is. + + + arrayDesc : CUDA_ARRAY3D_DESCRIPTOR + Format, dimension and type of base level of the mipmap chain + + + numLevels : unsigned int + Total number of levels in the mipmap chain + + + reserved : list[unsigned int] + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC(CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_v1): + """ + External memory mipmap descriptor + + Attributes + ---------- + + offset : unsigned long long + Offset into the memory object where the base level of the mipmap + chain is. + + + arrayDesc : CUDA_ARRAY3D_DESCRIPTOR + Format, dimension and type of base level of the mipmap chain + + + numLevels : unsigned int + Total number of levels in the mipmap chain + + + reserved : list[unsigned int] + + Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUDA_MEMCPY3D_PEER' in found_types}} -cdef class CUDA_MEMCPY3D_PEER(CUDA_MEMCPY3D_PEER_v1): +cdef class CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_v1(CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st): """ - 3D memory cross-context copy parameters + External semaphore handle descriptor Attributes ---------- - srcXInBytes : size_t - Source X in bytes - srcY : size_t - Source Y - srcZ : size_t - Source Z - srcLOD : size_t - Source LOD - srcMemoryType : CUmemorytype - Source memory type (host, device, array) - srcHost : Any - Source host pointer - srcDevice : CUdeviceptr - Source device pointer - srcArray : CUarray - Source array reference - srcContext : CUcontext - Source context (ignored with srcMemoryType is CU_MEMORYTYPE_ARRAY) - srcPitch : size_t - Source pitch (ignored when src is array) - srcHeight : size_t - Source height (ignored when src is array; may be 0 if Depth==1) - dstXInBytes : size_t - Destination X in bytes - dstY : size_t - Destination Y - dstZ : size_t - Destination Z - dstLOD : size_t - Destination LOD - dstMemoryType : CUmemorytype - Destination memory type (host, device, array) - dstHost : Any - Destination host pointer - dstDevice : CUdeviceptr - Destination device pointer - dstArray : CUarray - Destination array reference - dstContext : CUcontext - Destination context (ignored with dstMemoryType is - CU_MEMORYTYPE_ARRAY) - dstPitch : size_t - Destination pitch (ignored when dst is array) - dstHeight : size_t - Destination height (ignored when dst is array; may be 0 if - Depth==1) - WidthInBytes : size_t - Width of 3D memory copy in bytes - Height : size_t - Height of 3D memory copy - Depth : size_t - Depth of 3D memory copy + + type : CUexternalSemaphoreHandleType + Type of the handle + + + handle : anon_union6 + + + + flags : unsigned int + Flags reserved for the future. Must be zero. + + + reserved : list[unsigned int] + + Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUDA_MEMCPY_NODE_PARAMS' in found_types}} -cdef class CUDA_MEMCPY_NODE_PARAMS(CUDA_MEMCPY_NODE_PARAMS_st): +cdef class CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC(CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_v1): """ - Memcpy node parameters + External semaphore handle descriptor Attributes ---------- - flags : int - Must be zero - reserved : int - Must be zero - copyCtx : CUcontext - Context on which to run the node - copyParams : CUDA_MEMCPY3D - Parameters for the memory copy + + type : CUexternalSemaphoreHandleType + Type of the handle + + + handle : anon_union6 + + + + flags : unsigned int + Flags reserved for the future. Must be zero. + + + reserved : list[unsigned int] + + Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUDA_ARRAY_DESCRIPTOR_v2' in found_types}} -cdef class CUDA_ARRAY_DESCRIPTOR_v2(CUDA_ARRAY_DESCRIPTOR_st): +cdef class CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_v1(CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st): """ - Array descriptor + External semaphore signal parameters Attributes ---------- - Width : size_t - Width of array - Height : size_t - Height of array - Format : CUarray_format - Array format - NumChannels : unsigned int - Channels per array element + + params : anon_struct16 + + + + flags : unsigned int + Only when CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS is used to signal a + CUexternalSemaphore of type + CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC, the valid flag is + CUDA_EXTERNAL_SEMAPHORE_SIGNAL_SKIP_NVSCIBUF_MEMSYNC which + indicates that while signaling the CUexternalSemaphore, no memory + synchronization operations should be performed for any external + memory object imported as CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF. + For all other types of CUexternalSemaphore, flags must be zero. + + + reserved : list[unsigned int] + + Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUDA_ARRAY_DESCRIPTOR' in found_types}} -cdef class CUDA_ARRAY_DESCRIPTOR(CUDA_ARRAY_DESCRIPTOR_v2): +cdef class CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS(CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_v1): """ - Array descriptor + External semaphore signal parameters Attributes ---------- - Width : size_t - Width of array - Height : size_t - Height of array - Format : CUarray_format - Array format - NumChannels : unsigned int - Channels per array element + + params : anon_struct16 + + + + flags : unsigned int + Only when CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS is used to signal a + CUexternalSemaphore of type + CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC, the valid flag is + CUDA_EXTERNAL_SEMAPHORE_SIGNAL_SKIP_NVSCIBUF_MEMSYNC which + indicates that while signaling the CUexternalSemaphore, no memory + synchronization operations should be performed for any external + memory object imported as CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF. + For all other types of CUexternalSemaphore, flags must be zero. + + + reserved : list[unsigned int] + + Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUDA_ARRAY3D_DESCRIPTOR_v2' in found_types}} -cdef class CUDA_ARRAY3D_DESCRIPTOR_v2(CUDA_ARRAY3D_DESCRIPTOR_st): +cdef class CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_v1(CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st): """ - 3D array descriptor + External semaphore wait parameters Attributes ---------- - Width : size_t - Width of 3D array - Height : size_t - Height of 3D array - Depth : size_t - Depth of 3D array - Format : CUarray_format - Array format - NumChannels : unsigned int - Channels per array element - Flags : unsigned int - Flags + + params : anon_struct19 + + + + flags : unsigned int + Only when CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS is used to wait on a + CUexternalSemaphore of type + CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC, the valid flag is + CUDA_EXTERNAL_SEMAPHORE_WAIT_SKIP_NVSCIBUF_MEMSYNC which indicates + that while waiting for the CUexternalSemaphore, no memory + synchronization operations should be performed for any external + memory object imported as CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF. + For all other types of CUexternalSemaphore, flags must be zero. + + + reserved : list[unsigned int] + + Methods ------- getPtr() Get memory address of class instance + """ + pass + +cdef class CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS(CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_v1): + """ + External semaphore wait parameters + + Attributes + ---------- + + params : anon_struct19 + + + + flags : unsigned int + Only when CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS is used to wait on a + CUexternalSemaphore of type + CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC, the valid flag is + CUDA_EXTERNAL_SEMAPHORE_WAIT_SKIP_NVSCIBUF_MEMSYNC which indicates + that while waiting for the CUexternalSemaphore, no memory + synchronization operations should be performed for any external + memory object imported as CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF. + For all other types of CUexternalSemaphore, flags must be zero. + + reserved : list[unsigned int] + + + + Methods + ------- + getPtr() + Get memory address of class instance """ pass -{{endif}} -{{if 'CUDA_ARRAY3D_DESCRIPTOR' in found_types}} -cdef class CUDA_ARRAY3D_DESCRIPTOR(CUDA_ARRAY3D_DESCRIPTOR_v2): +cdef class CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v1(CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_st): """ - 3D array descriptor + Semaphore signal node parameters Attributes ---------- - Width : size_t - Width of 3D array - Height : size_t - Height of 3D array - Depth : size_t - Depth of 3D array - Format : CUarray_format - Array format - NumChannels : unsigned int - Channels per array element - Flags : unsigned int - Flags + + extSemArray : CUexternalSemaphore + Array of external semaphore handles. + + + paramsArray : CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS + Array of external semaphore signal parameters. + + + numExtSems : unsigned int + Number of handles and parameters supplied in extSemArray and + paramsArray. + Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUDA_ARRAY_SPARSE_PROPERTIES_v1' in found_types}} -cdef class CUDA_ARRAY_SPARSE_PROPERTIES_v1(CUDA_ARRAY_SPARSE_PROPERTIES_st): +cdef class CUDA_EXT_SEM_SIGNAL_NODE_PARAMS(CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v1): """ - CUDA array sparse properties + Semaphore signal node parameters Attributes ---------- - tileExtent : anon_struct5 - miptailFirstLevel : unsigned int - First mip level at which the mip tail begins. - miptailSize : unsigned long long - Total size of the mip tail. - flags : unsigned int - Flags will either be zero or - CU_ARRAY_SPARSE_PROPERTIES_SINGLE_MIPTAIL - reserved : List[unsigned int] + extSemArray : CUexternalSemaphore + Array of external semaphore handles. + + + paramsArray : CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS + Array of external semaphore signal parameters. + + + numExtSems : unsigned int + Number of handles and parameters supplied in extSemArray and + paramsArray. Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUDA_ARRAY_SPARSE_PROPERTIES' in found_types}} -cdef class CUDA_ARRAY_SPARSE_PROPERTIES(CUDA_ARRAY_SPARSE_PROPERTIES_v1): +cdef class CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2(CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2_st): """ - CUDA array sparse properties + Semaphore signal node parameters Attributes ---------- - tileExtent : anon_struct5 - miptailFirstLevel : unsigned int - First mip level at which the mip tail begins. - miptailSize : unsigned long long - Total size of the mip tail. - flags : unsigned int - Flags will either be zero or - CU_ARRAY_SPARSE_PROPERTIES_SINGLE_MIPTAIL - reserved : List[unsigned int] + extSemArray : CUexternalSemaphore + Array of external semaphore handles. + + + paramsArray : CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS + Array of external semaphore signal parameters. + + + numExtSems : unsigned int + Number of handles and parameters supplied in extSemArray and + paramsArray. Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUDA_ARRAY_MEMORY_REQUIREMENTS_v1' in found_types}} -cdef class CUDA_ARRAY_MEMORY_REQUIREMENTS_v1(CUDA_ARRAY_MEMORY_REQUIREMENTS_st): +cdef class CUDA_EXT_SEM_WAIT_NODE_PARAMS_v1(CUDA_EXT_SEM_WAIT_NODE_PARAMS_st): """ - CUDA array memory requirements + Semaphore wait node parameters Attributes ---------- - size : size_t - Total required memory size - alignment : size_t - alignment requirement - reserved : List[unsigned int] + + extSemArray : CUexternalSemaphore + Array of external semaphore handles. + + + paramsArray : CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS + Array of external semaphore wait parameters. + + + numExtSems : unsigned int + Number of handles and parameters supplied in extSemArray and + paramsArray. Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUDA_ARRAY_MEMORY_REQUIREMENTS' in found_types}} -cdef class CUDA_ARRAY_MEMORY_REQUIREMENTS(CUDA_ARRAY_MEMORY_REQUIREMENTS_v1): +cdef class CUDA_EXT_SEM_WAIT_NODE_PARAMS(CUDA_EXT_SEM_WAIT_NODE_PARAMS_v1): """ - CUDA array memory requirements + Semaphore wait node parameters Attributes ---------- - size : size_t - Total required memory size - alignment : size_t - alignment requirement - reserved : List[unsigned int] + + extSemArray : CUexternalSemaphore + Array of external semaphore handles. + + + paramsArray : CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS + Array of external semaphore wait parameters. + + + numExtSems : unsigned int + Number of handles and parameters supplied in extSemArray and + paramsArray. Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUDA_RESOURCE_DESC_v1' in found_types}} -cdef class CUDA_RESOURCE_DESC_v1(CUDA_RESOURCE_DESC_st): +cdef class CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2(CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2_st): """ - CUDA Resource descriptor + Semaphore wait node parameters Attributes ---------- - resType : CUresourcetype - Resource type - res : anon_union4 - flags : unsigned int - Flags (must be zero) + extSemArray : CUexternalSemaphore + Array of external semaphore handles. + + + paramsArray : CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS + Array of external semaphore wait parameters. + + + numExtSems : unsigned int + Number of handles and parameters supplied in extSemArray and + paramsArray. + Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUDA_RESOURCE_DESC' in found_types}} -cdef class CUDA_RESOURCE_DESC(CUDA_RESOURCE_DESC_v1): +cdef class CUmemGenericAllocationHandle: """ - CUDA Resource descriptor - - Attributes - ---------- - resType : CUresourcetype - Resource type - res : anon_union4 - - flags : unsigned int - Flags (must be zero) Methods ------- @@ -5719,1298 +9397,1283 @@ cdef class CUDA_RESOURCE_DESC(CUDA_RESOURCE_DESC_v1): Get memory address of class instance """ - pass -{{endif}} -{{if 'CUDA_TEXTURE_DESC_v1' in found_types}} + cdef cydriver.CUmemGenericAllocationHandle _pvt_val + cdef cydriver.CUmemGenericAllocationHandle* _pvt_ptr -cdef class CUDA_TEXTURE_DESC_v1(CUDA_TEXTURE_DESC_st): +cdef class CUarrayMapInfo_v1(CUarrayMapInfo_st): """ - Texture descriptor + Specifies the CUDA array or CUDA mipmapped array memory mapping + information Attributes ---------- - addressMode : List[CUaddress_mode] - Address modes - filterMode : CUfilter_mode - Filter mode + + resourceType : CUresourcetype + Resource type + + + resource : anon_union9 + + + + subresourceType : CUarraySparseSubresourceType + Sparse subresource type + + + subresource : anon_union10 + + + + memOperationType : CUmemOperationType + Memory operation type + + + memHandleType : CUmemHandleType + Memory handle type + + + memHandle : anon_union11 + + + + offset : unsigned long long + Offset within mip tail Offset within the memory + + + deviceBitMask : unsigned int + Device ordinal bit mask + + flags : unsigned int - Flags - maxAnisotropy : unsigned int - Maximum anisotropy ratio - mipmapFilterMode : CUfilter_mode - Mipmap filter mode - mipmapLevelBias : float - Mipmap level bias - minMipmapLevelClamp : float - Mipmap minimum level clamp - maxMipmapLevelClamp : float - Mipmap maximum level clamp - borderColor : List[float] - Border Color - reserved : List[int] + flags for future use, must be zero now. + + + reserved : list[unsigned int] + Reserved for future use, must be zero now. Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUDA_TEXTURE_DESC' in found_types}} -cdef class CUDA_TEXTURE_DESC(CUDA_TEXTURE_DESC_v1): +cdef class CUarrayMapInfo(CUarrayMapInfo_v1): """ - Texture descriptor + Specifies the CUDA array or CUDA mipmapped array memory mapping + information Attributes ---------- - addressMode : List[CUaddress_mode] - Address modes - filterMode : CUfilter_mode - Filter mode - flags : unsigned int - Flags - maxAnisotropy : unsigned int - Maximum anisotropy ratio - mipmapFilterMode : CUfilter_mode - Mipmap filter mode - mipmapLevelBias : float - Mipmap level bias - minMipmapLevelClamp : float - Mipmap minimum level clamp - maxMipmapLevelClamp : float - Mipmap maximum level clamp - borderColor : List[float] - Border Color - reserved : List[int] + + resourceType : CUresourcetype + Resource type + + + resource : anon_union9 + + + + subresourceType : CUarraySparseSubresourceType + Sparse subresource type + + + subresource : anon_union10 + + + + memOperationType : CUmemOperationType + Memory operation type + + + memHandleType : CUmemHandleType + Memory handle type + + + memHandle : anon_union11 + + + + offset : unsigned long long + Offset within mip tail Offset within the memory + + + deviceBitMask : unsigned int + Device ordinal bit mask + + + flags : unsigned int + flags for future use, must be zero now. + + + reserved : list[unsigned int] + Reserved for future use, must be zero now. Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUDA_RESOURCE_VIEW_DESC_v1' in found_types}} -cdef class CUDA_RESOURCE_VIEW_DESC_v1(CUDA_RESOURCE_VIEW_DESC_st): +cdef class CUmemLocation_v1(CUmemLocation_st): """ - Resource view descriptor + Specifies a memory location. Attributes ---------- - format : CUresourceViewFormat - Resource view format - width : size_t - Width of the resource view - height : size_t - Height of the resource view - depth : size_t - Depth of the resource view - firstMipmapLevel : unsigned int - First defined mipmap level - lastMipmapLevel : unsigned int - Last defined mipmap level - firstLayer : unsigned int - First layer index - lastLayer : unsigned int - Last layer index - reserved : List[unsigned int] + + type : CUmemLocationType + Specifies the location type, which modifies the meaning of id. + + + id : int + Identifier for CUmemLocationType::CU_MEM_LOCATION_TYPE_DEVICE, + CUmemLocationType::CU_MEM_LOCATION_TYPE_HOST, + CUmemLocationType::CU_MEM_LOCATION_TYPE_HOST_NUMA. Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUDA_RESOURCE_VIEW_DESC' in found_types}} -cdef class CUDA_RESOURCE_VIEW_DESC(CUDA_RESOURCE_VIEW_DESC_v1): +cdef class CUmemLocation(CUmemLocation_v1): """ - Resource view descriptor + Specifies a memory location. Attributes ---------- - format : CUresourceViewFormat - Resource view format - width : size_t - Width of the resource view - height : size_t - Height of the resource view - depth : size_t - Depth of the resource view - firstMipmapLevel : unsigned int - First defined mipmap level - lastMipmapLevel : unsigned int - Last defined mipmap level - firstLayer : unsigned int - First layer index - lastLayer : unsigned int - Last layer index - reserved : List[unsigned int] + + type : CUmemLocationType + Specifies the location type, which modifies the meaning of id. + + + id : int + Identifier for CUmemLocationType::CU_MEM_LOCATION_TYPE_DEVICE, + CUmemLocationType::CU_MEM_LOCATION_TYPE_HOST, + CUmemLocationType::CU_MEM_LOCATION_TYPE_HOST_NUMA. Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUtensorMap' in found_types}} -cdef class CUtensorMap(CUtensorMap_st): +cdef class CUmemAllocationProp_v1(CUmemAllocationProp_st): """ - Tensor map descriptor. Requires compiler support for aligning to 64 - bytes. + Specifies the allocation properties for a allocation. Attributes ---------- - opaque : List[cuuint64_t] + + type : CUmemAllocationType + Allocation type - Methods - ------- - getPtr() - Get memory address of class instance + requestedHandleTypes : CUmemAllocationHandleType + requested CUmemAllocationHandleType - """ - pass -{{endif}} -{{if 'CUDA_POINTER_ATTRIBUTE_P2P_TOKENS_v1' in found_types}} -cdef class CUDA_POINTER_ATTRIBUTE_P2P_TOKENS_v1(CUDA_POINTER_ATTRIBUTE_P2P_TOKENS_st): - """ - GPU Direct v3 tokens + location : CUmemLocation + Location of allocation - Attributes - ---------- - p2pToken : unsigned long long - vaSpaceToken : unsigned int + win32HandleMetaData : Any + Windows-specific POBJECT_ATTRIBUTES required when + CU_MEM_HANDLE_TYPE_WIN32 is specified. This object attributes + structure includes security attributes that define the scope of + which exported allocations may be transferred to other processes. + In all other cases, this field is required to be zero. + + + allocFlags : anon_struct22 + Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUDA_POINTER_ATTRIBUTE_P2P_TOKENS' in found_types}} -cdef class CUDA_POINTER_ATTRIBUTE_P2P_TOKENS(CUDA_POINTER_ATTRIBUTE_P2P_TOKENS_v1): +cdef class CUmemAllocationProp(CUmemAllocationProp_v1): """ - GPU Direct v3 tokens + Specifies the allocation properties for a allocation. Attributes ---------- - p2pToken : unsigned long long - vaSpaceToken : unsigned int + type : CUmemAllocationType + Allocation type - Methods - ------- - getPtr() - Get memory address of class instance + requestedHandleTypes : CUmemAllocationHandleType + requested CUmemAllocationHandleType - """ - pass -{{endif}} -{{if 'CUDA_LAUNCH_PARAMS_v1' in found_types}} -cdef class CUDA_LAUNCH_PARAMS_v1(CUDA_LAUNCH_PARAMS_st): - """ - Kernel launch parameters + location : CUmemLocation + Location of allocation - Attributes - ---------- - function : CUfunction - Kernel to launch - gridDimX : unsigned int - Width of grid in blocks - gridDimY : unsigned int - Height of grid in blocks - gridDimZ : unsigned int - Depth of grid in blocks - blockDimX : unsigned int - X dimension of each thread block - blockDimY : unsigned int - Y dimension of each thread block - blockDimZ : unsigned int - Z dimension of each thread block - sharedMemBytes : unsigned int - Dynamic shared-memory size per thread block in bytes - hStream : CUstream - Stream identifier - kernelParams : Any - Array of pointers to kernel parameters - Methods - ------- - getPtr() - Get memory address of class instance + win32HandleMetaData : Any + Windows-specific POBJECT_ATTRIBUTES required when + CU_MEM_HANDLE_TYPE_WIN32 is specified. This object attributes + structure includes security attributes that define the scope of + which exported allocations may be transferred to other processes. + In all other cases, this field is required to be zero. - """ - pass -{{endif}} -{{if 'CUDA_LAUNCH_PARAMS' in found_types}} -cdef class CUDA_LAUNCH_PARAMS(CUDA_LAUNCH_PARAMS_v1): - """ - Kernel launch parameters + allocFlags : anon_struct22 + - Attributes - ---------- - function : CUfunction - Kernel to launch - gridDimX : unsigned int - Width of grid in blocks - gridDimY : unsigned int - Height of grid in blocks - gridDimZ : unsigned int - Depth of grid in blocks - blockDimX : unsigned int - X dimension of each thread block - blockDimY : unsigned int - Y dimension of each thread block - blockDimZ : unsigned int - Z dimension of each thread block - sharedMemBytes : unsigned int - Dynamic shared-memory size per thread block in bytes - hStream : CUstream - Stream identifier - kernelParams : Any - Array of pointers to kernel parameters Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUDA_EXTERNAL_MEMORY_HANDLE_DESC_v1' in found_types}} -cdef class CUDA_EXTERNAL_MEMORY_HANDLE_DESC_v1(CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st): +cdef class CUmulticastObjectProp_v1(CUmulticastObjectProp_st): """ - External memory handle descriptor + Specifies the properties for a multicast object. Attributes ---------- - type : CUexternalMemoryHandleType - Type of the handle - handle : anon_union5 - size : unsigned long long - Size of the memory allocation - flags : unsigned int - Flags must either be zero or CUDA_EXTERNAL_MEMORY_DEDICATED - reserved : List[unsigned int] + numDevices : unsigned int + The number of devices in the multicast team that will bind memory + to this object - Methods - ------- - getPtr() - Get memory address of class instance + size : size_t + The maximum amount of memory that can be bound to this multicast + object per device - """ - pass -{{endif}} -{{if 'CUDA_EXTERNAL_MEMORY_HANDLE_DESC' in found_types}} -cdef class CUDA_EXTERNAL_MEMORY_HANDLE_DESC(CUDA_EXTERNAL_MEMORY_HANDLE_DESC_v1): - """ - External memory handle descriptor + handleTypes : unsigned long long + Bitmask of exportable handle types (see CUmemAllocationHandleType) + for this object - Attributes - ---------- - type : CUexternalMemoryHandleType - Type of the handle - handle : anon_union5 - size : unsigned long long - Size of the memory allocation - flags : unsigned int - Flags must either be zero or CUDA_EXTERNAL_MEMORY_DEDICATED - reserved : List[unsigned int] + flags : unsigned long long + Flags for future use, must be zero now Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUDA_EXTERNAL_MEMORY_BUFFER_DESC_v1' in found_types}} -cdef class CUDA_EXTERNAL_MEMORY_BUFFER_DESC_v1(CUDA_EXTERNAL_MEMORY_BUFFER_DESC_st): +cdef class CUmulticastObjectProp(CUmulticastObjectProp_v1): """ - External memory buffer descriptor + Specifies the properties for a multicast object. Attributes ---------- - offset : unsigned long long - Offset into the memory object where the buffer's base is - size : unsigned long long - Size of the buffer - flags : unsigned int - Flags reserved for future use. Must be zero. - reserved : List[unsigned int] + + numDevices : unsigned int + The number of devices in the multicast team that will bind memory + to this object + + + size : size_t + The maximum amount of memory that can be bound to this multicast + object per device + + + handleTypes : unsigned long long + Bitmask of exportable handle types (see CUmemAllocationHandleType) + for this object + + + flags : unsigned long long + Flags for future use, must be zero now Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUDA_EXTERNAL_MEMORY_BUFFER_DESC' in found_types}} -cdef class CUDA_EXTERNAL_MEMORY_BUFFER_DESC(CUDA_EXTERNAL_MEMORY_BUFFER_DESC_v1): +cdef class CUmemAccessDesc_v1(CUmemAccessDesc_st): """ - External memory buffer descriptor + Memory access descriptor Attributes ---------- - offset : unsigned long long - Offset into the memory object where the buffer's base is - size : unsigned long long - Size of the buffer - flags : unsigned int - Flags reserved for future use. Must be zero. - reserved : List[unsigned int] + + location : CUmemLocation + Location on which the request is to change it's accessibility + + + flags : CUmemAccess_flags + ::CUmemProt accessibility flags to set on the request Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_v1' in found_types}} -cdef class CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_v1(CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_st): +cdef class CUmemAccessDesc(CUmemAccessDesc_v1): """ - External memory mipmap descriptor + Memory access descriptor Attributes ---------- - offset : unsigned long long - Offset into the memory object where the base level of the mipmap - chain is. - arrayDesc : CUDA_ARRAY3D_DESCRIPTOR - Format, dimension and type of base level of the mipmap chain - numLevels : unsigned int - Total number of levels in the mipmap chain - reserved : List[unsigned int] + + location : CUmemLocation + Location on which the request is to change it's accessibility + + + flags : CUmemAccess_flags + ::CUmemProt accessibility flags to set on the request Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC' in found_types}} -cdef class CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC(CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_v1): +cdef class CUgraphExecUpdateResultInfo_v1(CUgraphExecUpdateResultInfo_st): """ - External memory mipmap descriptor + Result information returned by cuGraphExecUpdate Attributes ---------- - offset : unsigned long long - Offset into the memory object where the base level of the mipmap - chain is. - arrayDesc : CUDA_ARRAY3D_DESCRIPTOR - Format, dimension and type of base level of the mipmap chain - numLevels : unsigned int - Total number of levels in the mipmap chain - reserved : List[unsigned int] + + result : CUgraphExecUpdateResult + Gives more specific detail when a cuda graph update fails. + + + errorNode : CUgraphNode + The "to node" of the error edge when the topologies do not match. + The error node when the error is associated with a specific node. + NULL when the error is generic. + + + errorFromNode : CUgraphNode + The from node of error edge when the topologies do not match. + Otherwise NULL. Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_v1' in found_types}} -cdef class CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_v1(CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st): +cdef class CUgraphExecUpdateResultInfo(CUgraphExecUpdateResultInfo_v1): """ - External semaphore handle descriptor + Result information returned by cuGraphExecUpdate Attributes ---------- - type : CUexternalSemaphoreHandleType - Type of the handle - handle : anon_union6 - flags : unsigned int - Flags reserved for the future. Must be zero. - reserved : List[unsigned int] + result : CUgraphExecUpdateResult + Gives more specific detail when a cuda graph update fails. + + + errorNode : CUgraphNode + The "to node" of the error edge when the topologies do not match. + The error node when the error is associated with a specific node. + NULL when the error is generic. + + + errorFromNode : CUgraphNode + The from node of error edge when the topologies do not match. + Otherwise NULL. Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC' in found_types}} -cdef class CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC(CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_v1): +cdef class CUmemPoolProps_v1(CUmemPoolProps_st): """ - External semaphore handle descriptor + Specifies the properties of allocations made from the pool. Attributes ---------- - type : CUexternalSemaphoreHandleType - Type of the handle - handle : anon_union6 - flags : unsigned int - Flags reserved for the future. Must be zero. - reserved : List[unsigned int] + allocType : CUmemAllocationType + Allocation type. Currently must be specified as + CU_MEM_ALLOCATION_TYPE_PINNED + + + handleTypes : CUmemAllocationHandleType + Handle types that will be supported by allocations from the pool. + + + location : CUmemLocation + Location where allocations should reside. + + + win32SecurityAttributes : Any + Windows-specific LPSECURITYATTRIBUTES required when + CU_MEM_HANDLE_TYPE_WIN32 is specified. This security attribute + defines the scope of which exported allocations may be transferred + to other processes. In all other cases, this field is required to + be zero. + + + maxSize : size_t + Maximum pool size. When set to 0, defaults to a system dependent + value. + + + usage : unsigned short + Bitmask indicating intended usage for the pool. + + + reserved : bytes + reserved for future use, must be 0 Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_v1' in found_types}} -cdef class CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_v1(CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st): +cdef class CUmemPoolProps(CUmemPoolProps_v1): """ - External semaphore signal parameters + Specifies the properties of allocations made from the pool. Attributes ---------- - params : anon_struct15 - flags : unsigned int - Only when ::CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS is used to signal - a CUexternalSemaphore of type - CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC, the valid flag is - CUDA_EXTERNAL_SEMAPHORE_SIGNAL_SKIP_NVSCIBUF_MEMSYNC which - indicates that while signaling the CUexternalSemaphore, no memory - synchronization operations should be performed for any external - memory object imported as CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF. - For all other types of CUexternalSemaphore, flags must be zero. - reserved : List[unsigned int] + allocType : CUmemAllocationType + Allocation type. Currently must be specified as + CU_MEM_ALLOCATION_TYPE_PINNED + + + handleTypes : CUmemAllocationHandleType + Handle types that will be supported by allocations from the pool. + + + location : CUmemLocation + Location where allocations should reside. + + + win32SecurityAttributes : Any + Windows-specific LPSECURITYATTRIBUTES required when + CU_MEM_HANDLE_TYPE_WIN32 is specified. This security attribute + defines the scope of which exported allocations may be transferred + to other processes. In all other cases, this field is required to + be zero. + + + maxSize : size_t + Maximum pool size. When set to 0, defaults to a system dependent + value. + + + usage : unsigned short + Bitmask indicating intended usage for the pool. + + + reserved : bytes + reserved for future use, must be 0 Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS' in found_types}} -cdef class CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS(CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_v1): +cdef class CUmemPoolPtrExportData_v1(CUmemPoolPtrExportData_st): """ - External semaphore signal parameters + Opaque data for exporting a pool allocation Attributes ---------- - params : anon_struct15 - flags : unsigned int - Only when ::CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS is used to signal - a CUexternalSemaphore of type - CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC, the valid flag is - CUDA_EXTERNAL_SEMAPHORE_SIGNAL_SKIP_NVSCIBUF_MEMSYNC which - indicates that while signaling the CUexternalSemaphore, no memory - synchronization operations should be performed for any external - memory object imported as CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF. - For all other types of CUexternalSemaphore, flags must be zero. - reserved : List[unsigned int] + reserved : bytes + Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_v1' in found_types}} -cdef class CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_v1(CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st): +cdef class CUmemPoolPtrExportData(CUmemPoolPtrExportData_v1): """ - External semaphore wait parameters + Opaque data for exporting a pool allocation Attributes ---------- - params : anon_struct18 - flags : unsigned int - Only when ::CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS is used to wait on - a CUexternalSemaphore of type - CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC, the valid flag is - CUDA_EXTERNAL_SEMAPHORE_WAIT_SKIP_NVSCIBUF_MEMSYNC which indicates - that while waiting for the CUexternalSemaphore, no memory - synchronization operations should be performed for any external - memory object imported as CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF. - For all other types of CUexternalSemaphore, flags must be zero. - reserved : List[unsigned int] + reserved : bytes + Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS' in found_types}} -cdef class CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS(CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_v1): +cdef class CUmemcpyAttributes_v1(CUmemcpyAttributes_st): """ - External semaphore wait parameters + Attributes specific to copies within a batch. For more details on + usage see cuMemcpyBatchAsync. Attributes ---------- - params : anon_struct18 + + srcAccessOrder : CUmemcpySrcAccessOrder + Source access ordering to be observed for copies with this + attribute. + + + srcLocHint : CUmemLocation + Hint location for the source operand. Ignored when the pointers are + not managed memory or memory allocated outside CUDA. + + + dstLocHint : CUmemLocation + Hint location for the destination operand. Ignored when the + pointers are not managed memory or memory allocated outside CUDA. + flags : unsigned int - Only when ::CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS is used to wait on - a CUexternalSemaphore of type - CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC, the valid flag is - CUDA_EXTERNAL_SEMAPHORE_WAIT_SKIP_NVSCIBUF_MEMSYNC which indicates - that while waiting for the CUexternalSemaphore, no memory - synchronization operations should be performed for any external - memory object imported as CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF. - For all other types of CUexternalSemaphore, flags must be zero. - reserved : List[unsigned int] + Additional flags for copies with this attribute. See CUmemcpyFlags Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v1' in found_types}} -cdef class CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v1(CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_st): +cdef class CUmemcpyAttributes(CUmemcpyAttributes_v1): """ - Semaphore signal node parameters + Attributes specific to copies within a batch. For more details on + usage see cuMemcpyBatchAsync. Attributes ---------- - extSemArray : CUexternalSemaphore - Array of external semaphore handles. - paramsArray : CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS - Array of external semaphore signal parameters. - numExtSems : unsigned int - Number of handles and parameters supplied in extSemArray and - paramsArray. + + srcAccessOrder : CUmemcpySrcAccessOrder + Source access ordering to be observed for copies with this + attribute. + + + srcLocHint : CUmemLocation + Hint location for the source operand. Ignored when the pointers are + not managed memory or memory allocated outside CUDA. + + + dstLocHint : CUmemLocation + Hint location for the destination operand. Ignored when the + pointers are not managed memory or memory allocated outside CUDA. + + + flags : unsigned int + Additional flags for copies with this attribute. See CUmemcpyFlags + Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUDA_EXT_SEM_SIGNAL_NODE_PARAMS' in found_types}} -cdef class CUDA_EXT_SEM_SIGNAL_NODE_PARAMS(CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v1): +cdef class CUoffset3D_v1(CUoffset3D_st): """ - Semaphore signal node parameters + Struct representing a 3D offset Attributes ---------- - extSemArray : CUexternalSemaphore - Array of external semaphore handles. - paramsArray : CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS - Array of external semaphore signal parameters. - numExtSems : unsigned int - Number of handles and parameters supplied in extSemArray and - paramsArray. + + x : size_t + + + + y : size_t + + + + z : size_t + + Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2' in found_types}} -cdef class CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2(CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2_st): +cdef class CUoffset3D(CUoffset3D_v1): """ - Semaphore signal node parameters + Struct representing a 3D offset Attributes ---------- - extSemArray : CUexternalSemaphore - Array of external semaphore handles. - paramsArray : CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS - Array of external semaphore signal parameters. - numExtSems : unsigned int - Number of handles and parameters supplied in extSemArray and - paramsArray. + + x : size_t + + + + y : size_t + + + + z : size_t + + Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUDA_EXT_SEM_WAIT_NODE_PARAMS_v1' in found_types}} -cdef class CUDA_EXT_SEM_WAIT_NODE_PARAMS_v1(CUDA_EXT_SEM_WAIT_NODE_PARAMS_st): +cdef class CUextent3D_v1(CUextent3D_st): """ - Semaphore wait node parameters + Struct representing width/height/depth of a CUarray in elements Attributes ---------- - extSemArray : CUexternalSemaphore - Array of external semaphore handles. - paramsArray : CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS - Array of external semaphore wait parameters. - numExtSems : unsigned int - Number of handles and parameters supplied in extSemArray and - paramsArray. + + width : size_t + + + + height : size_t + + + + depth : size_t + + Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUDA_EXT_SEM_WAIT_NODE_PARAMS' in found_types}} -cdef class CUDA_EXT_SEM_WAIT_NODE_PARAMS(CUDA_EXT_SEM_WAIT_NODE_PARAMS_v1): +cdef class CUextent3D(CUextent3D_v1): """ - Semaphore wait node parameters + Struct representing width/height/depth of a CUarray in elements Attributes ---------- - extSemArray : CUexternalSemaphore - Array of external semaphore handles. - paramsArray : CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS - Array of external semaphore wait parameters. - numExtSems : unsigned int - Number of handles and parameters supplied in extSemArray and - paramsArray. + + width : size_t + + + + height : size_t + + + + depth : size_t + + Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2' in found_types}} -cdef class CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2(CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2_st): +cdef class CUmemcpy3DOperand_v1(CUmemcpy3DOperand_st): """ - Semaphore wait node parameters + Struct representing an operand for copy with cuMemcpy3DBatchAsync Attributes ---------- - extSemArray : CUexternalSemaphore - Array of external semaphore handles. - paramsArray : CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS - Array of external semaphore wait parameters. - numExtSems : unsigned int - Number of handles and parameters supplied in extSemArray and - paramsArray. + + type : CUmemcpy3DOperandType + + + + op : anon_union13 + + Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUmemGenericAllocationHandle' in found_types}} -cdef class CUmemGenericAllocationHandle: +cdef class CUmemcpy3DOperand(CUmemcpy3DOperand_v1): """ + Struct representing an operand for copy with cuMemcpy3DBatchAsync + + Attributes + ---------- + + type : CUmemcpy3DOperandType + + + + op : anon_union13 + + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccuda.CUmemGenericAllocationHandle __val - cdef ccuda.CUmemGenericAllocationHandle* _ptr -{{endif}} -{{if 'CUarrayMapInfo_v1' in found_types}} + pass -cdef class CUarrayMapInfo_v1(CUarrayMapInfo_st): +cdef class CUDA_MEMCPY3D_BATCH_OP_v1(CUDA_MEMCPY3D_BATCH_OP_st): """ - Specifies the CUDA array or CUDA mipmapped array memory mapping - information - Attributes ---------- - resourceType : CUresourcetype - Resource type - resource : anon_union9 - subresourceType : CUarraySparseSubresourceType - Sparse subresource type - subresource : anon_union10 + src : CUmemcpy3DOperand + Source memcpy operand. + + + dst : CUmemcpy3DOperand + Destination memcpy operand. + + + extent : CUextent3D + Extents of the memcpy between src and dst. The width, height and + depth components must not be 0. + + + srcAccessOrder : CUmemcpySrcAccessOrder + Source access ordering to be observed for copy from src to dst. - memOperationType : CUmemOperationType - Memory operation type - memHandleType : CUmemHandleType - Memory handle type - memHandle : anon_union11 - offset : unsigned long long - Offset within mip tail Offset within the memory - deviceBitMask : unsigned int - Device ordinal bit mask flags : unsigned int - flags for future use, must be zero now. - reserved : List[unsigned int] - Reserved for future use, must be zero now. + Additional flags for copies with this attribute. See CUmemcpyFlags + Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUarrayMapInfo' in found_types}} -cdef class CUarrayMapInfo(CUarrayMapInfo_v1): +cdef class CUDA_MEMCPY3D_BATCH_OP(CUDA_MEMCPY3D_BATCH_OP_v1): """ - Specifies the CUDA array or CUDA mipmapped array memory mapping - information - Attributes ---------- - resourceType : CUresourcetype - Resource type - resource : anon_union9 - subresourceType : CUarraySparseSubresourceType - Sparse subresource type - subresource : anon_union10 + src : CUmemcpy3DOperand + Source memcpy operand. + + + dst : CUmemcpy3DOperand + Destination memcpy operand. + + + extent : CUextent3D + Extents of the memcpy between src and dst. The width, height and + depth components must not be 0. + + + srcAccessOrder : CUmemcpySrcAccessOrder + Source access ordering to be observed for copy from src to dst. - memOperationType : CUmemOperationType - Memory operation type - memHandleType : CUmemHandleType - Memory handle type - memHandle : anon_union11 - offset : unsigned long long - Offset within mip tail Offset within the memory - deviceBitMask : unsigned int - Device ordinal bit mask flags : unsigned int - flags for future use, must be zero now. - reserved : List[unsigned int] - Reserved for future use, must be zero now. + Additional flags for copies with this attribute. See CUmemcpyFlags + Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUmemLocation_v1' in found_types}} -cdef class CUmemLocation_v1(CUmemLocation_st): +cdef class CUDA_MEM_ALLOC_NODE_PARAMS_v1(CUDA_MEM_ALLOC_NODE_PARAMS_v1_st): """ - Specifies a memory location. + Memory allocation node parameters Attributes ---------- - type : CUmemLocationType - Specifies the location type, which modifies the meaning of id. - id : int - identifier for a given this location's CUmemLocationType. + + poolProps : CUmemPoolProps + in: location where the allocation should reside (specified in + ::location). ::handleTypes must be CU_MEM_HANDLE_TYPE_NONE. IPC is + not supported. + + + accessDescs : CUmemAccessDesc + in: array of memory access descriptors. Used to describe peer GPU + access + + + accessDescCount : size_t + in: number of memory access descriptors. Must not exceed the number + of GPUs. + + + bytesize : size_t + in: size in bytes of the requested allocation + + + dptr : CUdeviceptr + out: address of the allocation returned by CUDA + Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUmemLocation' in found_types}} -cdef class CUmemLocation(CUmemLocation_v1): +cdef class CUDA_MEM_ALLOC_NODE_PARAMS(CUDA_MEM_ALLOC_NODE_PARAMS_v1): """ - Specifies a memory location. + Memory allocation node parameters Attributes ---------- - type : CUmemLocationType - Specifies the location type, which modifies the meaning of id. - id : int - identifier for a given this location's CUmemLocationType. + + poolProps : CUmemPoolProps + in: location where the allocation should reside (specified in + ::location). ::handleTypes must be CU_MEM_HANDLE_TYPE_NONE. IPC is + not supported. + + + accessDescs : CUmemAccessDesc + in: array of memory access descriptors. Used to describe peer GPU + access + + + accessDescCount : size_t + in: number of memory access descriptors. Must not exceed the number + of GPUs. + + + bytesize : size_t + in: size in bytes of the requested allocation + + + dptr : CUdeviceptr + out: address of the allocation returned by CUDA + Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUmemAllocationProp_v1' in found_types}} -cdef class CUmemAllocationProp_v1(CUmemAllocationProp_st): +cdef class CUDA_MEM_ALLOC_NODE_PARAMS_v2(CUDA_MEM_ALLOC_NODE_PARAMS_v2_st): """ - Specifies the allocation properties for a allocation. + Memory allocation node parameters Attributes ---------- - type : CUmemAllocationType - Allocation type - requestedHandleTypes : CUmemAllocationHandleType - requested CUmemAllocationHandleType - location : CUmemLocation - Location of allocation - win32HandleMetaData : Any - Windows-specific POBJECT_ATTRIBUTES required when - CU_MEM_HANDLE_TYPE_WIN32 is specified. This object attributes - structure includes security attributes that define the scope of - which exported allocations may be transferred to other processes. - In all other cases, this field is required to be zero. - allocFlags : anon_struct21 + + poolProps : CUmemPoolProps + in: location where the allocation should reside (specified in + ::location). ::handleTypes must be CU_MEM_HANDLE_TYPE_NONE. IPC is + not supported. + + + accessDescs : CUmemAccessDesc + in: array of memory access descriptors. Used to describe peer GPU + access + + + accessDescCount : size_t + in: number of memory access descriptors. Must not exceed the number + of GPUs. + + + bytesize : size_t + in: size in bytes of the requested allocation + + + dptr : CUdeviceptr + out: address of the allocation returned by CUDA Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUmemAllocationProp' in found_types}} -cdef class CUmemAllocationProp(CUmemAllocationProp_v1): +cdef class CUDA_MEM_FREE_NODE_PARAMS(CUDA_MEM_FREE_NODE_PARAMS_st): """ - Specifies the allocation properties for a allocation. + Memory free node parameters Attributes ---------- - type : CUmemAllocationType - Allocation type - requestedHandleTypes : CUmemAllocationHandleType - requested CUmemAllocationHandleType - location : CUmemLocation - Location of allocation - win32HandleMetaData : Any - Windows-specific POBJECT_ATTRIBUTES required when - CU_MEM_HANDLE_TYPE_WIN32 is specified. This object attributes - structure includes security attributes that define the scope of - which exported allocations may be transferred to other processes. - In all other cases, this field is required to be zero. - allocFlags : anon_struct21 + + dptr : CUdeviceptr + in: the pointer to free Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUmulticastObjectProp_v1' in found_types}} -cdef class CUmulticastObjectProp_v1(CUmulticastObjectProp_st): +cdef class CUDA_CHILD_GRAPH_NODE_PARAMS(CUDA_CHILD_GRAPH_NODE_PARAMS_st): """ - Specifies the properties for a multicast object. + Child graph node parameters Attributes ---------- - numDevices : unsigned int - The number of devices in the multicast team that will bind memory - to this object - size : size_t - The maximum amount of memory that can be bound to this multicast - object per device - handleTypes : unsigned long long - Bitmask of exportable handle types (see CUmemAllocationHandleType) - for this object - flags : unsigned long long - Flags for future use, must be zero now - Methods - ------- - getPtr() - Get memory address of class instance + graph : CUgraph + The child graph to clone into the node for node creation, or a + handle to the graph owned by the node for node query. The graph + must not contain conditional nodes. Graphs containing memory + allocation or memory free nodes must set the ownership to be moved + to the parent. - """ - pass -{{endif}} -{{if 'CUmulticastObjectProp' in found_types}} -cdef class CUmulticastObjectProp(CUmulticastObjectProp_v1): - """ - Specifies the properties for a multicast object. + ownership : CUgraphChildGraphNodeOwnership + The ownership relationship of the child graph node. - Attributes - ---------- - numDevices : unsigned int - The number of devices in the multicast team that will bind memory - to this object - size : size_t - The maximum amount of memory that can be bound to this multicast - object per device - handleTypes : unsigned long long - Bitmask of exportable handle types (see CUmemAllocationHandleType) - for this object - flags : unsigned long long - Flags for future use, must be zero now Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUmemAccessDesc_v1' in found_types}} -cdef class CUmemAccessDesc_v1(CUmemAccessDesc_st): +cdef class CUDA_EVENT_RECORD_NODE_PARAMS(CUDA_EVENT_RECORD_NODE_PARAMS_st): """ - Memory access descriptor + Event record node parameters Attributes ---------- - location : CUmemLocation - Location on which the request is to change it's accessibility - flags : CUmemAccess_flags - ::CUmemProt accessibility flags to set on the request + + event : CUevent + The event to record when the node executes + Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUmemAccessDesc' in found_types}} -cdef class CUmemAccessDesc(CUmemAccessDesc_v1): +cdef class CUDA_EVENT_WAIT_NODE_PARAMS(CUDA_EVENT_WAIT_NODE_PARAMS_st): """ - Memory access descriptor + Event wait node parameters Attributes ---------- - location : CUmemLocation - Location on which the request is to change it's accessibility - flags : CUmemAccess_flags - ::CUmemProt accessibility flags to set on the request + + event : CUevent + The event to wait on from the node + Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUgraphExecUpdateResultInfo_v1' in found_types}} -cdef class CUgraphExecUpdateResultInfo_v1(CUgraphExecUpdateResultInfo_st): +cdef class CUgraphNodeParams(CUgraphNodeParams_st): """ - Result information returned by cuGraphExecUpdate + Graph node parameters. See cuGraphAddNode. Attributes ---------- - result : CUgraphExecUpdateResult - Gives more specific detail when a cuda graph update fails. - errorNode : CUgraphNode - The "to node" of the error edge when the topologies do not match. - The error node when the error is associated with a specific node. - NULL when the error is generic. - errorFromNode : CUgraphNode - The from node of error edge when the topologies do not match. - Otherwise NULL. + + type : CUgraphNodeType + Type of the node + + + reserved0 : list[int] + Reserved. Must be zero. + + + reserved1 : list[long long] + Padding. Unused bytes must be zero. + + + kernel : CUDA_KERNEL_NODE_PARAMS_v3 + Kernel node parameters. + + + memcpy : CUDA_MEMCPY_NODE_PARAMS + Memcpy node parameters. + + + memset : CUDA_MEMSET_NODE_PARAMS_v2 + Memset node parameters. + + + host : CUDA_HOST_NODE_PARAMS_v2 + Host node parameters. + + + graph : CUDA_CHILD_GRAPH_NODE_PARAMS + Child graph node parameters. + + + eventWait : CUDA_EVENT_WAIT_NODE_PARAMS + Event wait node parameters. + + + eventRecord : CUDA_EVENT_RECORD_NODE_PARAMS + Event record node parameters. + + + extSemSignal : CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2 + External semaphore signal node parameters. + + + extSemWait : CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2 + External semaphore wait node parameters. + + + alloc : CUDA_MEM_ALLOC_NODE_PARAMS_v2 + Memory allocation node parameters. + + + free : CUDA_MEM_FREE_NODE_PARAMS + Memory free node parameters. + + + memOp : CUDA_BATCH_MEM_OP_NODE_PARAMS_v2 + MemOp node parameters. + + + conditional : CUDA_CONDITIONAL_NODE_PARAMS + Conditional node parameters. + + + asBytes : bytes + Padding as bytes + + + reserved2 : long long + Reserved bytes. Must be zero. + Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUgraphExecUpdateResultInfo' in found_types}} -cdef class CUgraphExecUpdateResultInfo(CUgraphExecUpdateResultInfo_v1): +cdef class CUcheckpointLockArgs(CUcheckpointLockArgs_st): """ - Result information returned by cuGraphExecUpdate + CUDA checkpoint optional lock arguments Attributes ---------- - result : CUgraphExecUpdateResult - Gives more specific detail when a cuda graph update fails. - errorNode : CUgraphNode - The "to node" of the error edge when the topologies do not match. - The error node when the error is associated with a specific node. - NULL when the error is generic. - errorFromNode : CUgraphNode - The from node of error edge when the topologies do not match. - Otherwise NULL. + + timeoutMs : unsigned int + Timeout in milliseconds to attempt to lock the process, 0 indicates + no timeout + + + reserved0 : unsigned int + Reserved for future use, must be zero + + + reserved1 : list[cuuint64_t] + Reserved for future use, must be zeroed + Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUmemPoolProps_v1' in found_types}} -cdef class CUmemPoolProps_v1(CUmemPoolProps_st): +cdef class CUcheckpointCheckpointArgs(CUcheckpointCheckpointArgs_st): """ - Specifies the properties of allocations made from the pool. + CUDA checkpoint optional checkpoint arguments Attributes ---------- - allocType : CUmemAllocationType - Allocation type. Currently must be specified as - CU_MEM_ALLOCATION_TYPE_PINNED - handleTypes : CUmemAllocationHandleType - Handle types that will be supported by allocations from the pool. - location : CUmemLocation - Location where allocations should reside. - win32SecurityAttributes : Any - Windows-specific LPSECURITYATTRIBUTES required when - CU_MEM_HANDLE_TYPE_WIN32 is specified. This security attribute - defines the scope of which exported allocations may be transferred - to other processes. In all other cases, this field is required to - be zero. - maxSize : size_t - Maximum pool size. When set to 0, defaults to a system dependent - value. - reserved : bytes - reserved for future use, must be 0 + + reserved : list[cuuint64_t] + Reserved for future use, must be zeroed + Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUmemPoolProps' in found_types}} -cdef class CUmemPoolProps(CUmemPoolProps_v1): +cdef class CUcheckpointGpuPair(CUcheckpointGpuPair_st): """ - Specifies the properties of allocations made from the pool. + CUDA checkpoint GPU UUID pairs for device remapping during restore Attributes ---------- - allocType : CUmemAllocationType - Allocation type. Currently must be specified as - CU_MEM_ALLOCATION_TYPE_PINNED - handleTypes : CUmemAllocationHandleType - Handle types that will be supported by allocations from the pool. - location : CUmemLocation - Location where allocations should reside. - win32SecurityAttributes : Any - Windows-specific LPSECURITYATTRIBUTES required when - CU_MEM_HANDLE_TYPE_WIN32 is specified. This security attribute - defines the scope of which exported allocations may be transferred - to other processes. In all other cases, this field is required to - be zero. - maxSize : size_t - Maximum pool size. When set to 0, defaults to a system dependent - value. - reserved : bytes - reserved for future use, must be 0 + + oldUuid : CUuuid + UUID of the GPU that was checkpointed + + + newUuid : CUuuid + UUID of the GPU to restore onto + Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUmemPoolPtrExportData_v1' in found_types}} -cdef class CUmemPoolPtrExportData_v1(CUmemPoolPtrExportData_st): +cdef class CUcheckpointRestoreArgs(CUcheckpointRestoreArgs_st): """ - Opaque data for exporting a pool allocation + CUDA checkpoint optional restore arguments Attributes ---------- + + gpuPairs : CUcheckpointGpuPair + Pointer to array of gpu pairs that indicate how to remap GPUs + during restore + + + gpuPairsCount : unsigned int + Number of gpu pairs to remap + + reserved : bytes + Reserved for future use, must be zeroed + + + reserved : list[cuuint64_t] + Reserved for future use, must be zeroed Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUmemPoolPtrExportData' in found_types}} -cdef class CUmemPoolPtrExportData(CUmemPoolPtrExportData_v1): +cdef class CUcheckpointUnlockArgs(CUcheckpointUnlockArgs_st): """ - Opaque data for exporting a pool allocation + CUDA checkpoint optional unlock arguments Attributes ---------- - reserved : bytes + + reserved : list[cuuint64_t] + Reserved for future use, must be zeroed Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUDA_MEM_ALLOC_NODE_PARAMS_v1' in found_types}} -cdef class CUDA_MEM_ALLOC_NODE_PARAMS_v1(CUDA_MEM_ALLOC_NODE_PARAMS_v1_st): +cdef class CUmemDecompressParams(CUmemDecompressParams_st): """ - Memory allocation node parameters + Structure describing the parameters that compose a single + decompression operation. Attributes ---------- - poolProps : CUmemPoolProps - in: location where the allocation should reside (specified in - ::location). ::handleTypes must be CU_MEM_HANDLE_TYPE_NONE. IPC is - not supported. - accessDescs : CUmemAccessDesc - in: array of memory access descriptors. Used to describe peer GPU - access - accessDescCount : size_t - in: number of memory access descriptors. Must not exceed the number - of GPUs. - bytesize : size_t - in: size in bytes of the requested allocation - dptr : CUdeviceptr - out: address of the allocation returned by CUDA - Methods - ------- - getPtr() - Get memory address of class instance + srcNumBytes : size_t + The number of bytes to be read and decompressed from + CUmemDecompressParams_st.src. + + + dstNumBytes : size_t + The number of bytes that the decompression operation will be + expected to write to CUmemDecompressParams_st.dst. This value is + optional; if present, it may be used by the CUDA driver as a + heuristic for scheduling the individual decompression operations. + + + dstActBytes : cuuint32_t + After the decompression operation has completed, the actual number + of bytes written to CUmemDecompressParams.dst will be recorded as a + 32-bit unsigned integer in the memory at this address. + + + src : Any + Pointer to a buffer of at least + CUmemDecompressParams_st.srcNumBytes compressed bytes. + + + dst : Any + Pointer to a buffer where the decompressed data will be written. + The number of bytes written to this location will be recorded in + the memory pointed to by CUmemDecompressParams_st.dstActBytes + - """ - pass -{{endif}} -{{if 'CUDA_MEM_ALLOC_NODE_PARAMS' in found_types}} + algo : CUmemDecompressAlgorithm + The decompression algorithm to use. + + + padding : bytes -cdef class CUDA_MEM_ALLOC_NODE_PARAMS(CUDA_MEM_ALLOC_NODE_PARAMS_v1): - """ - Memory allocation node parameters - Attributes - ---------- - poolProps : CUmemPoolProps - in: location where the allocation should reside (specified in - ::location). ::handleTypes must be CU_MEM_HANDLE_TYPE_NONE. IPC is - not supported. - accessDescs : CUmemAccessDesc - in: array of memory access descriptors. Used to describe peer GPU - access - accessDescCount : size_t - in: number of memory access descriptors. Must not exceed the number - of GPUs. - bytesize : size_t - in: size in bytes of the requested allocation - dptr : CUdeviceptr - out: address of the allocation returned by CUDA Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUDA_MEM_ALLOC_NODE_PARAMS_v2' in found_types}} -cdef class CUDA_MEM_ALLOC_NODE_PARAMS_v2(CUDA_MEM_ALLOC_NODE_PARAMS_v2_st): +cdef class CUlogicalEndpointId: """ - Memory allocation node parameters - - Attributes - ---------- - poolProps : CUmemPoolProps - in: location where the allocation should reside (specified in - ::location). ::handleTypes must be CU_MEM_HANDLE_TYPE_NONE. IPC is - not supported. - accessDescs : CUmemAccessDesc - in: array of memory access descriptors. Used to describe peer GPU - access - accessDescCount : size_t - in: number of memory access descriptors. Must not exceed the number - of GPUs. - bytesize : size_t - in: size in bytes of the requested allocation - dptr : CUdeviceptr - out: address of the allocation returned by CUDA Methods ------- @@ -7018,201 +10681,257 @@ cdef class CUDA_MEM_ALLOC_NODE_PARAMS_v2(CUDA_MEM_ALLOC_NODE_PARAMS_v2_st): Get memory address of class instance """ - pass -{{endif}} -{{if 'CUDA_MEM_FREE_NODE_PARAMS' in found_types}} + cdef cydriver.CUlogicalEndpointId _pvt_val + cdef cydriver.CUlogicalEndpointId* _pvt_ptr -cdef class CUDA_MEM_FREE_NODE_PARAMS(CUDA_MEM_FREE_NODE_PARAMS_st): +cdef class CUlogicalEndpointFabricHandle(CUlogicalEndpointFabricHandle_st): """ - Memory free node parameters + Fabric handle for a logical endpoint Attributes ---------- - dptr : CUdeviceptr - in: the pointer to free + + data : bytes + + Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUDA_CHILD_GRAPH_NODE_PARAMS' in found_types}} -cdef class CUDA_CHILD_GRAPH_NODE_PARAMS(CUDA_CHILD_GRAPH_NODE_PARAMS_st): +cdef class CUlogicalEndpointProp(CUlogicalEndpointProp_struct): """ - Child graph node parameters + Properties of a logical endpoint construction Attributes ---------- - graph : CUgraph - The child graph to clone into the node for node creation, or a - handle to the graph owned by the node for node query + + type : CUlogicalEndpointType + Type of the logical endpoint defined in CUlogicalEndpointType + + + unicast : anon_struct25 + + + + multicast : anon_struct26 + + + + size : unsigned long long + Size of the logical endpoint + + + ipcHandleTypes : unsigned int + A bitmask of IPC handle types defined in + CUlogicalEndpointIpcHandleType + + + flags : unsigned int + A bitmask of flags defined in CUlogicalEndpointFlag + Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUDA_EVENT_RECORD_NODE_PARAMS' in found_types}} -cdef class CUDA_EVENT_RECORD_NODE_PARAMS(CUDA_EVENT_RECORD_NODE_PARAMS_st): +cdef class CUdevSmResource(CUdevSmResource_st): """ - Event record node parameters - Attributes ---------- - event : CUevent - The event to record when the node executes + + smCount : unsigned int + The amount of streaming multiprocessors available in this resource. + + + minSmPartitionSize : unsigned int + The minimum number of streaming multiprocessors required to + partition this resource. + + + smCoscheduledAlignment : unsigned int + The number of streaming multiprocessors in this resource that are + guaranteed to be co-scheduled on the same GPU processing cluster. + smCount will be a multiple of this value, unless the backfill flag + is set. + + + flags : unsigned int + The flags set on this SM resource. For possible values see + CUdevSmResourceGroup_flags. + Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUDA_EVENT_WAIT_NODE_PARAMS' in found_types}} -cdef class CUDA_EVENT_WAIT_NODE_PARAMS(CUDA_EVENT_WAIT_NODE_PARAMS_st): +cdef class CUdevWorkqueueConfigResource(CUdevWorkqueueConfigResource_st): """ - Event wait node parameters - Attributes ---------- - event : CUevent - The event to wait on from the node + + device : CUdevice + The device on which the workqueue resources are available + + + wqConcurrencyLimit : unsigned int + The expected maximum number of concurrent stream-ordered workloads + + + sharingScope : CUdevWorkqueueConfigScope + The sharing scope for the workqueue resources + Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUgraphNodeParams' in found_types}} -cdef class CUgraphNodeParams(CUgraphNodeParams_st): +cdef class CUdevWorkqueueResource(CUdevWorkqueueResource_st): """ - Graph node parameters. See cuGraphAddNode. - Attributes ---------- - type : CUgraphNodeType - Type of the node - reserved0 : List[int] - Reserved. Must be zero. - reserved1 : List[long long] - Padding. Unused bytes must be zero. - kernel : CUDA_KERNEL_NODE_PARAMS_v3 - Kernel node parameters. - memcpy : CUDA_MEMCPY_NODE_PARAMS - Memcpy node parameters. - memset : CUDA_MEMSET_NODE_PARAMS_v2 - Memset node parameters. - host : CUDA_HOST_NODE_PARAMS_v2 - Host node parameters. - graph : CUDA_CHILD_GRAPH_NODE_PARAMS - Child graph node parameters. - eventWait : CUDA_EVENT_WAIT_NODE_PARAMS - Event wait node parameters. - eventRecord : CUDA_EVENT_RECORD_NODE_PARAMS - Event record node parameters. - extSemSignal : CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2 - External semaphore signal node parameters. - extSemWait : CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2 - External semaphore wait node parameters. - alloc : CUDA_MEM_ALLOC_NODE_PARAMS_v2 - Memory allocation node parameters. - free : CUDA_MEM_FREE_NODE_PARAMS - Memory free node parameters. - memOp : CUDA_BATCH_MEM_OP_NODE_PARAMS_v2 - MemOp node parameters. - conditional : CUDA_CONDITIONAL_NODE_PARAMS - Conditional node parameters. - reserved2 : long long - Reserved bytes. Must be zero. + + reserved : bytes + Reserved for future use + Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'CUdevSmResource' in found_types}} -cdef class CUdevSmResource(CUdevSmResource_st): +cdef class CU_DEV_SM_RESOURCE_GROUP_PARAMS(CU_DEV_SM_RESOURCE_GROUP_PARAMS_st): """ Attributes ---------- + smCount : unsigned int - The amount of streaming multiprocessors available in this resource. - This is an output parameter only, do not write to this field. + The amount of SMs available in this resource. + + + coscheduledSmCount : unsigned int + The amount of co-scheduled SMs grouped together for locality + purposes. + + + preferredCoscheduledSmCount : unsigned int + When possible, combine co-scheduled groups together into larger + groups of this size. + + + flags : unsigned int + The flags set on this SM resource group. For possible values see + CUdevSmResourceGroup_flags. + + + reserved : list[unsigned int] + + Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'struct CUdevResource_st' in found_types}} cdef class CUdevResource_v1(CUdevResource_st): """ Attributes ---------- + type : CUdevResourceType Type of resource, dictates which union field was last set + + _internal_padding : bytes + + sm : CUdevSmResource - Resource corresponding to CU_DEV_RESOURCE_TYPE_SM ``. type. + Resource corresponding to CU_DEV_RESOURCE_TYPE_SM `typename`. + + + wqConfig : CUdevWorkqueueConfigResource + Resource corresponding to CU_DEV_RESOURCE_TYPE_WORKQUEUE_CONFIG + `typename`. + + + wq : CUdevWorkqueueResource + Resource corresponding to CU_DEV_RESOURCE_TYPE_WORKQUEUE + `typename`. + + _oversize : bytes + + nextResource : CUdevResource_st + + + Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'struct CUdevResource_st' in found_types}} cdef class CUdevResource(CUdevResource_v1): """ Attributes ---------- + type : CUdevResourceType Type of resource, dictates which union field was last set + + _internal_padding : bytes + + sm : CUdevSmResource - Resource corresponding to CU_DEV_RESOURCE_TYPE_SM ``. type. + Resource corresponding to CU_DEV_RESOURCE_TYPE_SM `typename`. + + + wqConfig : CUdevWorkqueueConfigResource + Resource corresponding to CU_DEV_RESOURCE_TYPE_WORKQUEUE_CONFIG + `typename`. + + + wq : CUdevWorkqueueResource + Resource corresponding to CU_DEV_RESOURCE_TYPE_WORKQUEUE + `typename`. + + _oversize : bytes + + nextResource : CUdevResource_st + + + Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if True}} cdef class CUeglFrame_v1(CUeglFrame_st): """ @@ -7222,36 +10941,53 @@ cdef class CUeglFrame_v1(CUeglFrame_st): Attributes ---------- - frame : anon_union14 + + frame : anon_union17 + + width : unsigned int Width of first plane + + height : unsigned int Height of first plane + + depth : unsigned int Depth of first plane + + pitch : unsigned int Pitch of first plane + + planeCount : unsigned int Number of planes + + numChannels : unsigned int Number of channels for the plane + + frameType : CUeglFrameType Array or Pitch + + eglColorFormat : CUeglColorFormat CUDA EGL Color Format + + cuFormat : CUarray_format CUDA Array Format + Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if True}} cdef class CUeglFrame(CUeglFrame_v1): """ @@ -7261,36 +10997,53 @@ cdef class CUeglFrame(CUeglFrame_v1): Attributes ---------- - frame : anon_union14 + + frame : anon_union17 + + width : unsigned int Width of first plane + + height : unsigned int Height of first plane + + depth : unsigned int Depth of first plane + + pitch : unsigned int Pitch of first plane + + planeCount : unsigned int Number of planes + + numChannels : unsigned int Number of channels for the plane + + frameType : CUeglFrameType Array or Pitch + + eglColorFormat : CUeglColorFormat CUDA EGL Color Format + + cuFormat : CUarray_format CUDA Array Format + Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'cuuint32_t' in found_types}} cdef class cuuint32_t: """ @@ -7301,11 +11054,8 @@ cdef class cuuint32_t: Get memory address of class instance """ - cdef ccuda.cuuint32_t __val - cdef ccuda.cuuint32_t* _ptr -{{endif}} - -{{if 'cuuint64_t' in found_types}} + cdef cydriver.cuuint32_t _pvt_val + cdef cydriver.cuuint32_t* _pvt_ptr cdef class cuuint64_t: """ @@ -7316,11 +11066,8 @@ cdef class cuuint64_t: Get memory address of class instance """ - cdef ccuda.cuuint64_t __val - cdef ccuda.cuuint64_t* _ptr -{{endif}} - -{{if 'CUdeviceptr_v2' in found_types}} + cdef cydriver.cuuint64_t _pvt_val + cdef cydriver.cuuint64_t* _pvt_ptr cdef class CUdeviceptr_v2: """ @@ -7333,11 +11080,8 @@ cdef class CUdeviceptr_v2: Get memory address of class instance """ - cdef ccuda.CUdeviceptr_v2 __val - cdef ccuda.CUdeviceptr_v2* _ptr -{{endif}} - -{{if 'CUdevice_v1' in found_types}} + cdef cydriver.CUdeviceptr_v2 _pvt_val + cdef cydriver.CUdeviceptr_v2* _pvt_ptr cdef class CUdevice_v1: """ @@ -7350,11 +11094,8 @@ cdef class CUdevice_v1: Get memory address of class instance """ - cdef ccuda.CUdevice_v1 __val - cdef ccuda.CUdevice_v1* _ptr -{{endif}} - -{{if 'CUtexObject_v1' in found_types}} + cdef cydriver.CUdevice_v1 _pvt_val + cdef cydriver.CUdevice_v1* _pvt_ptr cdef class CUtexObject_v1: """ @@ -7367,11 +11108,8 @@ cdef class CUtexObject_v1: Get memory address of class instance """ - cdef ccuda.CUtexObject_v1 __val - cdef ccuda.CUtexObject_v1* _ptr -{{endif}} - -{{if 'CUsurfObject_v1' in found_types}} + cdef cydriver.CUtexObject_v1 _pvt_val + cdef cydriver.CUtexObject_v1* _pvt_ptr cdef class CUsurfObject_v1: """ @@ -7384,11 +11122,8 @@ cdef class CUsurfObject_v1: Get memory address of class instance """ - cdef ccuda.CUsurfObject_v1 __val - cdef ccuda.CUsurfObject_v1* _ptr -{{endif}} - -{{if 'CUmemGenericAllocationHandle_v1' in found_types}} + cdef cydriver.CUsurfObject_v1 _pvt_val + cdef cydriver.CUsurfObject_v1* _pvt_ptr cdef class CUmemGenericAllocationHandle_v1: """ @@ -7399,11 +11134,20 @@ cdef class CUmemGenericAllocationHandle_v1: Get memory address of class instance """ - cdef ccuda.CUmemGenericAllocationHandle_v1 __val - cdef ccuda.CUmemGenericAllocationHandle_v1* _ptr -{{endif}} + cdef cydriver.CUmemGenericAllocationHandle_v1 _pvt_val + cdef cydriver.CUmemGenericAllocationHandle_v1* _pvt_ptr + +cdef class CUlogIterator: + """ + + Methods + ------- + getPtr() + Get memory address of class instance -{{if True}} + """ + cdef cydriver.CUlogIterator _pvt_val + cdef cydriver.CUlogIterator* _pvt_ptr cdef class GLenum: """ @@ -7414,11 +11158,8 @@ cdef class GLenum: Get memory address of class instance """ - cdef ccuda.GLenum __val - cdef ccuda.GLenum* _ptr -{{endif}} - -{{if True}} + cdef cydriver.GLenum _pvt_val + cdef cydriver.GLenum* _pvt_ptr cdef class GLuint: """ @@ -7429,11 +11170,8 @@ cdef class GLuint: Get memory address of class instance """ - cdef ccuda.GLuint __val - cdef ccuda.GLuint* _ptr -{{endif}} - -{{if True}} + cdef cydriver.GLuint _pvt_val + cdef cydriver.GLuint* _pvt_ptr cdef class EGLint: """ @@ -7444,11 +11182,8 @@ cdef class EGLint: Get memory address of class instance """ - cdef ccuda.EGLint __val - cdef ccuda.EGLint* _ptr -{{endif}} - -{{if True}} + cdef cydriver.EGLint _pvt_val + cdef cydriver.EGLint* _pvt_ptr cdef class VdpDevice: """ @@ -7459,11 +11194,8 @@ cdef class VdpDevice: Get memory address of class instance """ - cdef ccuda.VdpDevice __val - cdef ccuda.VdpDevice* _ptr -{{endif}} - -{{if True}} + cdef cydriver.VdpDevice _pvt_val + cdef cydriver.VdpDevice* _pvt_ptr cdef class VdpGetProcAddress: """ @@ -7474,11 +11206,8 @@ cdef class VdpGetProcAddress: Get memory address of class instance """ - cdef ccuda.VdpGetProcAddress __val - cdef ccuda.VdpGetProcAddress* _ptr -{{endif}} - -{{if True}} + cdef cydriver.VdpGetProcAddress _pvt_val + cdef cydriver.VdpGetProcAddress* _pvt_ptr cdef class VdpVideoSurface: """ @@ -7489,11 +11218,8 @@ cdef class VdpVideoSurface: Get memory address of class instance """ - cdef ccuda.VdpVideoSurface __val - cdef ccuda.VdpVideoSurface* _ptr -{{endif}} - -{{if True}} + cdef cydriver.VdpVideoSurface _pvt_val + cdef cydriver.VdpVideoSurface* _pvt_ptr cdef class VdpOutputSurface: """ @@ -7504,6 +11230,5 @@ cdef class VdpOutputSurface: Get memory address of class instance """ - cdef ccuda.VdpOutputSurface __val - cdef ccuda.VdpOutputSurface* _ptr -{{endif}} + cdef cydriver.VdpOutputSurface _pvt_val + cdef cydriver.VdpOutputSurface* _pvt_ptr diff --git a/cuda/cuda.pyx.in b/cuda_bindings/cuda/bindings/driver.pyx similarity index 58% rename from cuda/cuda.pyx.in rename to cuda_bindings/cuda/bindings/driver.pyx index 74f49d971f7..44b7c4c567c 100644 --- a/cuda/cuda.pyx.in +++ b/cuda_bindings/cuda/bindings/driver.pyx @@ -1,22 +1,25 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. -# -# Please refer to the NVIDIA end user license agreement (EULA) associated -# with this source code for terms and conditions that govern your use of -# this software. Any use, reproduction, disclosure, or distribution of -# this software and related documentation outside the terms of the EULA -# is strictly prohibited. -from typing import List, Tuple, Any, Optional -from enum import IntEnum +# SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +# This code was automatically generated with version 13.3.0. Do not modify it directly. +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=4a70be46627269cff03a2b89504463158d6e50d738cfde91e8c3ed1bf88fd9e0 +from typing import Any, Optional import cython import ctypes -from libc.stdlib cimport calloc, free +from libc.stdlib cimport calloc, malloc, free from libc cimport string -from libc.stdint cimport int32_t, uint32_t, int64_t, uint64_t +from libc.stdint cimport int32_t, uint32_t, int64_t, uint64_t, uintptr_t from libc.stddef cimport wchar_t from libc.limits cimport CHAR_MIN from libcpp.vector cimport vector from cpython.buffer cimport PyObject_CheckBuffer, PyObject_GetBuffer, PyBuffer_Release, PyBUF_SIMPLE, PyBUF_ANY_CONTIGUOUS from cpython.bytes cimport PyBytes_FromStringAndSize +from ._internal._fast_enum import FastEnum as _FastEnum +import cuda.bindings.driver +from libcpp.map cimport map + +_driver = globals() +include "_lib/utils.pxi" ctypedef unsigned long long signed_char_ptr ctypedef unsigned long long unsigned_char_ptr @@ -37,101 +40,106 @@ ctypedef unsigned long long unsigned_ptr ctypedef unsigned long long unsigned_long_long_ptr ctypedef unsigned long long long_long_ptr ctypedef unsigned long long size_t_ptr +ctypedef unsigned long long long_ptr ctypedef unsigned long long float_ptr ctypedef unsigned long long double_ptr ctypedef unsigned long long void_ptr #: CUDA API version number -CUDA_VERSION = ccuda.CUDA_VERSION +CUDA_VERSION = cydriver.CUDA_VERSION #: CUDA IPC handle size -CU_IPC_HANDLE_SIZE = ccuda.CU_IPC_HANDLE_SIZE +CU_IPC_HANDLE_SIZE = cydriver.CU_IPC_HANDLE_SIZE #: Legacy stream handle #: -#: Stream handle that can be passed as a CUstream to use an implicit stream -#: with legacy synchronization behavior. +#: Stream handle that can be passed as a :py:obj:`~.CUstream` to use an +#: implicit stream with legacy synchronization behavior. #: #: See details of the \link_sync_behavior -CU_STREAM_LEGACY = ccuda.CU_STREAM_LEGACY +CU_STREAM_LEGACY = cydriver.CU_STREAM_LEGACY #: Per-thread stream handle #: -#: Stream handle that can be passed as a CUstream to use an implicit stream -#: with per-thread synchronization behavior. +#: Stream handle that can be passed as a :py:obj:`~.CUstream` to use an +#: implicit stream with per-thread synchronization behavior. #: #: See details of the \link_sync_behavior -CU_STREAM_PER_THREAD = ccuda.CU_STREAM_PER_THREAD +CU_STREAM_PER_THREAD = cydriver.CU_STREAM_PER_THREAD + +CU_COMPUTE_ACCELERATED_TARGET_BASE = cydriver.CU_COMPUTE_ACCELERATED_TARGET_BASE -CU_COMPUTE_ACCELERATED_TARGET_BASE = ccuda.CU_COMPUTE_ACCELERATED_TARGET_BASE +CU_COMPUTE_FAMILY_TARGET_BASE = cydriver.CU_COMPUTE_FAMILY_TARGET_BASE #: Conditional node handle flags Default value is applied when graph is #: launched. -CU_GRAPH_COND_ASSIGN_DEFAULT = ccuda.CU_GRAPH_COND_ASSIGN_DEFAULT +CU_GRAPH_COND_ASSIGN_DEFAULT = cydriver.CU_GRAPH_COND_ASSIGN_DEFAULT #: This port activates when the kernel has finished executing. -CU_GRAPH_KERNEL_NODE_PORT_DEFAULT = ccuda.CU_GRAPH_KERNEL_NODE_PORT_DEFAULT +CU_GRAPH_KERNEL_NODE_PORT_DEFAULT = cydriver.CU_GRAPH_KERNEL_NODE_PORT_DEFAULT #: This port activates when all blocks of the kernel have performed #: cudaTriggerProgrammaticLaunchCompletion() or have terminated. It must be #: used with edge type :py:obj:`~.CU_GRAPH_DEPENDENCY_TYPE_PROGRAMMATIC`. #: See also :py:obj:`~.CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_EVENT`. -CU_GRAPH_KERNEL_NODE_PORT_PROGRAMMATIC = ccuda.CU_GRAPH_KERNEL_NODE_PORT_PROGRAMMATIC +CU_GRAPH_KERNEL_NODE_PORT_PROGRAMMATIC = cydriver.CU_GRAPH_KERNEL_NODE_PORT_PROGRAMMATIC #: This port activates when all blocks of the kernel have begun execution. #: See also :py:obj:`~.CU_LAUNCH_ATTRIBUTE_LAUNCH_COMPLETION_EVENT`. -CU_GRAPH_KERNEL_NODE_PORT_LAUNCH_ORDER = ccuda.CU_GRAPH_KERNEL_NODE_PORT_LAUNCH_ORDER +CU_GRAPH_KERNEL_NODE_PORT_LAUNCH_ORDER = cydriver.CU_GRAPH_KERNEL_NODE_PORT_LAUNCH_ORDER -CU_KERNEL_NODE_ATTRIBUTE_ACCESS_POLICY_WINDOW = ccuda.CU_KERNEL_NODE_ATTRIBUTE_ACCESS_POLICY_WINDOW +CU_KERNEL_NODE_ATTRIBUTE_ACCESS_POLICY_WINDOW = cydriver.CU_KERNEL_NODE_ATTRIBUTE_ACCESS_POLICY_WINDOW -CU_KERNEL_NODE_ATTRIBUTE_COOPERATIVE = ccuda.CU_KERNEL_NODE_ATTRIBUTE_COOPERATIVE +CU_KERNEL_NODE_ATTRIBUTE_COOPERATIVE = cydriver.CU_KERNEL_NODE_ATTRIBUTE_COOPERATIVE -CU_KERNEL_NODE_ATTRIBUTE_CLUSTER_DIMENSION = ccuda.CU_KERNEL_NODE_ATTRIBUTE_CLUSTER_DIMENSION +CU_KERNEL_NODE_ATTRIBUTE_CLUSTER_DIMENSION = cydriver.CU_KERNEL_NODE_ATTRIBUTE_CLUSTER_DIMENSION -CU_KERNEL_NODE_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE = ccuda.CU_KERNEL_NODE_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE +CU_KERNEL_NODE_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE = cydriver.CU_KERNEL_NODE_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE -CU_KERNEL_NODE_ATTRIBUTE_PRIORITY = ccuda.CU_KERNEL_NODE_ATTRIBUTE_PRIORITY +CU_KERNEL_NODE_ATTRIBUTE_PRIORITY = cydriver.CU_KERNEL_NODE_ATTRIBUTE_PRIORITY -CU_KERNEL_NODE_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP = ccuda.CU_KERNEL_NODE_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP +CU_KERNEL_NODE_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP = cydriver.CU_KERNEL_NODE_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP -CU_KERNEL_NODE_ATTRIBUTE_MEM_SYNC_DOMAIN = ccuda.CU_KERNEL_NODE_ATTRIBUTE_MEM_SYNC_DOMAIN +CU_KERNEL_NODE_ATTRIBUTE_MEM_SYNC_DOMAIN = cydriver.CU_KERNEL_NODE_ATTRIBUTE_MEM_SYNC_DOMAIN -CU_KERNEL_NODE_ATTRIBUTE_DEVICE_UPDATABLE_KERNEL_NODE = ccuda.CU_KERNEL_NODE_ATTRIBUTE_DEVICE_UPDATABLE_KERNEL_NODE +CU_KERNEL_NODE_ATTRIBUTE_PREFERRED_CLUSTER_DIMENSION = cydriver.CU_KERNEL_NODE_ATTRIBUTE_PREFERRED_CLUSTER_DIMENSION -CU_KERNEL_NODE_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT = ccuda.CU_KERNEL_NODE_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT +CU_KERNEL_NODE_ATTRIBUTE_DEVICE_UPDATABLE_KERNEL_NODE = cydriver.CU_KERNEL_NODE_ATTRIBUTE_DEVICE_UPDATABLE_KERNEL_NODE -CU_STREAM_ATTRIBUTE_ACCESS_POLICY_WINDOW = ccuda.CU_STREAM_ATTRIBUTE_ACCESS_POLICY_WINDOW +CU_KERNEL_NODE_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT = cydriver.CU_KERNEL_NODE_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT -CU_STREAM_ATTRIBUTE_SYNCHRONIZATION_POLICY = ccuda.CU_STREAM_ATTRIBUTE_SYNCHRONIZATION_POLICY +CU_STREAM_ATTRIBUTE_ACCESS_POLICY_WINDOW = cydriver.CU_STREAM_ATTRIBUTE_ACCESS_POLICY_WINDOW -CU_STREAM_ATTRIBUTE_PRIORITY = ccuda.CU_STREAM_ATTRIBUTE_PRIORITY +CU_STREAM_ATTRIBUTE_SYNCHRONIZATION_POLICY = cydriver.CU_STREAM_ATTRIBUTE_SYNCHRONIZATION_POLICY -CU_STREAM_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP = ccuda.CU_STREAM_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP +CU_STREAM_ATTRIBUTE_PRIORITY = cydriver.CU_STREAM_ATTRIBUTE_PRIORITY -CU_STREAM_ATTRIBUTE_MEM_SYNC_DOMAIN = ccuda.CU_STREAM_ATTRIBUTE_MEM_SYNC_DOMAIN +CU_STREAM_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP = cydriver.CU_STREAM_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP + +CU_STREAM_ATTRIBUTE_MEM_SYNC_DOMAIN = cydriver.CU_STREAM_ATTRIBUTE_MEM_SYNC_DOMAIN #: If set, host memory is portable between CUDA contexts. Flag for #: :py:obj:`~.cuMemHostAlloc()` -CU_MEMHOSTALLOC_PORTABLE = ccuda.CU_MEMHOSTALLOC_PORTABLE +CU_MEMHOSTALLOC_PORTABLE = cydriver.CU_MEMHOSTALLOC_PORTABLE #: If set, host memory is mapped into CUDA address space and #: :py:obj:`~.cuMemHostGetDevicePointer()` may be called on the host #: pointer. Flag for :py:obj:`~.cuMemHostAlloc()` -CU_MEMHOSTALLOC_DEVICEMAP = ccuda.CU_MEMHOSTALLOC_DEVICEMAP +CU_MEMHOSTALLOC_DEVICEMAP = cydriver.CU_MEMHOSTALLOC_DEVICEMAP #: If set, host memory is allocated as write-combined - fast to write, #: faster to DMA, slow to read except via SSE4 streaming load instruction #: (MOVNTDQA). Flag for :py:obj:`~.cuMemHostAlloc()` -CU_MEMHOSTALLOC_WRITECOMBINED = ccuda.CU_MEMHOSTALLOC_WRITECOMBINED +CU_MEMHOSTALLOC_WRITECOMBINED = cydriver.CU_MEMHOSTALLOC_WRITECOMBINED #: If set, host memory is portable between CUDA contexts. Flag for #: :py:obj:`~.cuMemHostRegister()` -CU_MEMHOSTREGISTER_PORTABLE = ccuda.CU_MEMHOSTREGISTER_PORTABLE +CU_MEMHOSTREGISTER_PORTABLE = cydriver.CU_MEMHOSTREGISTER_PORTABLE #: If set, host memory is mapped into CUDA address space and #: :py:obj:`~.cuMemHostGetDevicePointer()` may be called on the host #: pointer. Flag for :py:obj:`~.cuMemHostRegister()` -CU_MEMHOSTREGISTER_DEVICEMAP = ccuda.CU_MEMHOSTREGISTER_DEVICEMAP +CU_MEMHOSTREGISTER_DEVICEMAP = cydriver.CU_MEMHOSTREGISTER_DEVICEMAP #: If set, the passed memory pointer is treated as pointing to some memory- #: mapped I/O space, e.g. belonging to a third-party PCIe device. On @@ -142,7 +150,7 @@ CU_MEMHOSTREGISTER_DEVICEMAP = ccuda.CU_MEMHOSTREGISTER_DEVICEMAP #: kernel versions. On all other platforms, it is not supported and #: :py:obj:`~.CUDA_ERROR_NOT_SUPPORTED` is returned. Flag for #: :py:obj:`~.cuMemHostRegister()` -CU_MEMHOSTREGISTER_IOMEMORY = ccuda.CU_MEMHOSTREGISTER_IOMEMORY +CU_MEMHOSTREGISTER_IOMEMORY = cydriver.CU_MEMHOSTREGISTER_IOMEMORY #: If set, the passed memory pointer is treated as pointing to memory that #: is considered read-only by the device. On platforms without @@ -154,17 +162,17 @@ CU_MEMHOSTREGISTER_IOMEMORY = ccuda.CU_MEMHOSTREGISTER_IOMEMORY #: this flag with a current context associated with a device that does not #: have this attribute set will cause :py:obj:`~.cuMemHostRegister` to #: error with :py:obj:`~.CUDA_ERROR_NOT_SUPPORTED`. -CU_MEMHOSTREGISTER_READ_ONLY = ccuda.CU_MEMHOSTREGISTER_READ_ONLY +CU_MEMHOSTREGISTER_READ_ONLY = cydriver.CU_MEMHOSTREGISTER_READ_ONLY #: Indicates that the layered sparse CUDA array or CUDA mipmapped array has #: a single mip tail region for all layers -CU_ARRAY_SPARSE_PROPERTIES_SINGLE_MIPTAIL = ccuda.CU_ARRAY_SPARSE_PROPERTIES_SINGLE_MIPTAIL +CU_ARRAY_SPARSE_PROPERTIES_SINGLE_MIPTAIL = cydriver.CU_ARRAY_SPARSE_PROPERTIES_SINGLE_MIPTAIL #: Size of tensor map descriptor -CU_TENSOR_MAP_NUM_QWORDS = ccuda.CU_TENSOR_MAP_NUM_QWORDS +CU_TENSOR_MAP_NUM_QWORDS = cydriver.CU_TENSOR_MAP_NUM_QWORDS #: Indicates that the external memory object is a dedicated resource -CUDA_EXTERNAL_MEMORY_DEDICATED = ccuda.CUDA_EXTERNAL_MEMORY_DEDICATED +CUDA_EXTERNAL_MEMORY_DEDICATED = cydriver.CUDA_EXTERNAL_MEMORY_DEDICATED #: When the `flags` parameter of #: :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS` contains this flag, it @@ -174,7 +182,7 @@ CUDA_EXTERNAL_MEMORY_DEDICATED = ccuda.CUDA_EXTERNAL_MEMORY_DEDICATED #: :py:obj:`~.CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF`, which otherwise are #: performed by default to ensure data coherency with other importers of #: the same NvSciBuf memory objects. -CUDA_EXTERNAL_SEMAPHORE_SIGNAL_SKIP_NVSCIBUF_MEMSYNC = ccuda.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_SKIP_NVSCIBUF_MEMSYNC +CUDA_EXTERNAL_SEMAPHORE_SIGNAL_SKIP_NVSCIBUF_MEMSYNC = cydriver.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_SKIP_NVSCIBUF_MEMSYNC #: When the `flags` parameter of #: :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS` contains this flag, it @@ -184,112 +192,123 @@ CUDA_EXTERNAL_SEMAPHORE_SIGNAL_SKIP_NVSCIBUF_MEMSYNC = ccuda.CUDA_EXTERNAL_SEMAP #: :py:obj:`~.CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF`, which otherwise are #: performed by default to ensure data coherency with other importers of #: the same NvSciBuf memory objects. -CUDA_EXTERNAL_SEMAPHORE_WAIT_SKIP_NVSCIBUF_MEMSYNC = ccuda.CUDA_EXTERNAL_SEMAPHORE_WAIT_SKIP_NVSCIBUF_MEMSYNC +CUDA_EXTERNAL_SEMAPHORE_WAIT_SKIP_NVSCIBUF_MEMSYNC = cydriver.CUDA_EXTERNAL_SEMAPHORE_WAIT_SKIP_NVSCIBUF_MEMSYNC #: When `flags` of :py:obj:`~.cuDeviceGetNvSciSyncAttributes` is set to #: this, it indicates that application needs signaler specific #: NvSciSyncAttr to be filled by #: :py:obj:`~.cuDeviceGetNvSciSyncAttributes`. -CUDA_NVSCISYNC_ATTR_SIGNAL = ccuda.CUDA_NVSCISYNC_ATTR_SIGNAL +CUDA_NVSCISYNC_ATTR_SIGNAL = cydriver.CUDA_NVSCISYNC_ATTR_SIGNAL #: When `flags` of :py:obj:`~.cuDeviceGetNvSciSyncAttributes` is set to #: this, it indicates that application needs waiter specific NvSciSyncAttr #: to be filled by :py:obj:`~.cuDeviceGetNvSciSyncAttributes`. -CUDA_NVSCISYNC_ATTR_WAIT = ccuda.CUDA_NVSCISYNC_ATTR_WAIT +CUDA_NVSCISYNC_ATTR_WAIT = cydriver.CUDA_NVSCISYNC_ATTR_WAIT #: This flag if set indicates that the memory will be used as a tile pool. -CU_MEM_CREATE_USAGE_TILE_POOL = ccuda.CU_MEM_CREATE_USAGE_TILE_POOL +CU_MEM_CREATE_USAGE_TILE_POOL = cydriver.CU_MEM_CREATE_USAGE_TILE_POOL + +#: This flag, if set, indicates that the memory will be used as a buffer +#: for hardware accelerated decompression. +CU_MEM_CREATE_USAGE_HW_DECOMPRESS = cydriver.CU_MEM_CREATE_USAGE_HW_DECOMPRESS + +#: This flag, if set, indicates that the memory will be used as a buffer +#: for hardware accelerated decompression. +CU_MEM_POOL_CREATE_USAGE_HW_DECOMPRESS = cydriver.CU_MEM_POOL_CREATE_USAGE_HW_DECOMPRESS #: If set, each kernel launched as part of #: :py:obj:`~.cuLaunchCooperativeKernelMultiDevice` only waits for prior #: work in the stream corresponding to that GPU to complete before the #: kernel begins execution. -CUDA_COOPERATIVE_LAUNCH_MULTI_DEVICE_NO_PRE_LAUNCH_SYNC = ccuda.CUDA_COOPERATIVE_LAUNCH_MULTI_DEVICE_NO_PRE_LAUNCH_SYNC +CUDA_COOPERATIVE_LAUNCH_MULTI_DEVICE_NO_PRE_LAUNCH_SYNC = cydriver.CUDA_COOPERATIVE_LAUNCH_MULTI_DEVICE_NO_PRE_LAUNCH_SYNC #: If set, any subsequent work pushed in a stream that participated in a #: call to :py:obj:`~.cuLaunchCooperativeKernelMultiDevice` will only wait #: for the kernel launched on the GPU corresponding to that stream to #: complete before it begins execution. -CUDA_COOPERATIVE_LAUNCH_MULTI_DEVICE_NO_POST_LAUNCH_SYNC = ccuda.CUDA_COOPERATIVE_LAUNCH_MULTI_DEVICE_NO_POST_LAUNCH_SYNC +CUDA_COOPERATIVE_LAUNCH_MULTI_DEVICE_NO_POST_LAUNCH_SYNC = cydriver.CUDA_COOPERATIVE_LAUNCH_MULTI_DEVICE_NO_POST_LAUNCH_SYNC #: If set, the CUDA array is a collection of layers, where each layer is #: either a 1D or a 2D array and the Depth member of -#: CUDA_ARRAY3D_DESCRIPTOR specifies the number of layers, not the depth of -#: a 3D array. -CUDA_ARRAY3D_LAYERED = ccuda.CUDA_ARRAY3D_LAYERED +#: :py:obj:`~.CUDA_ARRAY3D_DESCRIPTOR` specifies the number of layers, not +#: the depth of a 3D array. +CUDA_ARRAY3D_LAYERED = cydriver.CUDA_ARRAY3D_LAYERED #: Deprecated, use CUDA_ARRAY3D_LAYERED -CUDA_ARRAY3D_2DARRAY = ccuda.CUDA_ARRAY3D_2DARRAY +CUDA_ARRAY3D_2DARRAY = cydriver.CUDA_ARRAY3D_2DARRAY #: This flag must be set in order to bind a surface reference to the CUDA #: array -CUDA_ARRAY3D_SURFACE_LDST = ccuda.CUDA_ARRAY3D_SURFACE_LDST +CUDA_ARRAY3D_SURFACE_LDST = cydriver.CUDA_ARRAY3D_SURFACE_LDST #: If set, the CUDA array is a collection of six 2D arrays, representing #: faces of a cube. The width of such a CUDA array must be equal to its #: height, and Depth must be six. If :py:obj:`~.CUDA_ARRAY3D_LAYERED` flag #: is also set, then the CUDA array is a collection of cubemaps and Depth #: must be a multiple of six. -CUDA_ARRAY3D_CUBEMAP = ccuda.CUDA_ARRAY3D_CUBEMAP +CUDA_ARRAY3D_CUBEMAP = cydriver.CUDA_ARRAY3D_CUBEMAP #: This flag must be set in order to perform texture gather operations on a #: CUDA array. -CUDA_ARRAY3D_TEXTURE_GATHER = ccuda.CUDA_ARRAY3D_TEXTURE_GATHER +CUDA_ARRAY3D_TEXTURE_GATHER = cydriver.CUDA_ARRAY3D_TEXTURE_GATHER #: This flag if set indicates that the CUDA array is a DEPTH_TEXTURE. -CUDA_ARRAY3D_DEPTH_TEXTURE = ccuda.CUDA_ARRAY3D_DEPTH_TEXTURE +CUDA_ARRAY3D_DEPTH_TEXTURE = cydriver.CUDA_ARRAY3D_DEPTH_TEXTURE #: This flag indicates that the CUDA array may be bound as a color target #: in an external graphics API -CUDA_ARRAY3D_COLOR_ATTACHMENT = ccuda.CUDA_ARRAY3D_COLOR_ATTACHMENT +CUDA_ARRAY3D_COLOR_ATTACHMENT = cydriver.CUDA_ARRAY3D_COLOR_ATTACHMENT #: This flag if set indicates that the CUDA array or CUDA mipmapped array #: is a sparse CUDA array or CUDA mipmapped array respectively -CUDA_ARRAY3D_SPARSE = ccuda.CUDA_ARRAY3D_SPARSE +CUDA_ARRAY3D_SPARSE = cydriver.CUDA_ARRAY3D_SPARSE #: This flag if set indicates that the CUDA array or CUDA mipmapped array #: will allow deferred memory mapping -CUDA_ARRAY3D_DEFERRED_MAPPING = ccuda.CUDA_ARRAY3D_DEFERRED_MAPPING +CUDA_ARRAY3D_DEFERRED_MAPPING = cydriver.CUDA_ARRAY3D_DEFERRED_MAPPING #: This flag indicates that the CUDA array will be used for hardware #: accelerated video encode/decode operations. -CUDA_ARRAY3D_VIDEO_ENCODE_DECODE = ccuda.CUDA_ARRAY3D_VIDEO_ENCODE_DECODE +CUDA_ARRAY3D_VIDEO_ENCODE_DECODE = cydriver.CUDA_ARRAY3D_VIDEO_ENCODE_DECODE #: Override the texref format with a format inferred from the array. Flag #: for :py:obj:`~.cuTexRefSetArray()` -CU_TRSA_OVERRIDE_FORMAT = ccuda.CU_TRSA_OVERRIDE_FORMAT +CU_TRSA_OVERRIDE_FORMAT = cydriver.CU_TRSA_OVERRIDE_FORMAT #: Read the texture as integers rather than promoting the values to floats #: in the range [0,1]. Flag for :py:obj:`~.cuTexRefSetFlags()` and #: :py:obj:`~.cuTexObjectCreate()` -CU_TRSF_READ_AS_INTEGER = ccuda.CU_TRSF_READ_AS_INTEGER +CU_TRSF_READ_AS_INTEGER = cydriver.CU_TRSF_READ_AS_INTEGER #: Use normalized texture coordinates in the range [0,1) instead of #: [0,dim). Flag for :py:obj:`~.cuTexRefSetFlags()` and #: :py:obj:`~.cuTexObjectCreate()` -CU_TRSF_NORMALIZED_COORDINATES = ccuda.CU_TRSF_NORMALIZED_COORDINATES +CU_TRSF_NORMALIZED_COORDINATES = cydriver.CU_TRSF_NORMALIZED_COORDINATES #: Perform sRGB->linear conversion during texture read. Flag for #: :py:obj:`~.cuTexRefSetFlags()` and :py:obj:`~.cuTexObjectCreate()` -CU_TRSF_SRGB = ccuda.CU_TRSF_SRGB +CU_TRSF_SRGB = cydriver.CU_TRSF_SRGB #: Disable any trilinear filtering optimizations. Flag for #: :py:obj:`~.cuTexRefSetFlags()` and :py:obj:`~.cuTexObjectCreate()` -CU_TRSF_DISABLE_TRILINEAR_OPTIMIZATION = ccuda.CU_TRSF_DISABLE_TRILINEAR_OPTIMIZATION +CU_TRSF_DISABLE_TRILINEAR_OPTIMIZATION = cydriver.CU_TRSF_DISABLE_TRILINEAR_OPTIMIZATION #: Enable seamless cube map filtering. Flag for #: :py:obj:`~.cuTexObjectCreate()` -CU_TRSF_SEAMLESS_CUBEMAP = ccuda.CU_TRSF_SEAMLESS_CUBEMAP +CU_TRSF_SEAMLESS_CUBEMAP = cydriver.CU_TRSF_SEAMLESS_CUBEMAP + +#: Launch with the required block dimension. +CU_LAUNCH_KERNEL_REQUIRED_BLOCK_DIM = cydriver.CU_LAUNCH_KERNEL_REQUIRED_BLOCK_DIM #: C++ compile time constant for CU_LAUNCH_PARAM_END -CU_LAUNCH_PARAM_END_AS_INT = ccuda.CU_LAUNCH_PARAM_END_AS_INT +CU_LAUNCH_PARAM_END_AS_INT = cydriver.CU_LAUNCH_PARAM_END_AS_INT #: End of array terminator for the `extra` parameter to #: :py:obj:`~.cuLaunchKernel` -CU_LAUNCH_PARAM_END = ccuda.CU_LAUNCH_PARAM_END +CU_LAUNCH_PARAM_END = cydriver.CU_LAUNCH_PARAM_END #: C++ compile time constant for CU_LAUNCH_PARAM_BUFFER_POINTER -CU_LAUNCH_PARAM_BUFFER_POINTER_AS_INT = ccuda.CU_LAUNCH_PARAM_BUFFER_POINTER_AS_INT +CU_LAUNCH_PARAM_BUFFER_POINTER_AS_INT = cydriver.CU_LAUNCH_PARAM_BUFFER_POINTER_AS_INT #: Indicator that the next value in the `extra` parameter to #: :py:obj:`~.cuLaunchKernel` will be a pointer to a buffer containing all @@ -298,10 +317,10 @@ CU_LAUNCH_PARAM_BUFFER_POINTER_AS_INT = ccuda.CU_LAUNCH_PARAM_BUFFER_POINTER_AS_ #: If :py:obj:`~.CU_LAUNCH_PARAM_BUFFER_SIZE` is not also specified in the #: `extra` array, then :py:obj:`~.CU_LAUNCH_PARAM_BUFFER_POINTER` will have #: no effect. -CU_LAUNCH_PARAM_BUFFER_POINTER = ccuda.CU_LAUNCH_PARAM_BUFFER_POINTER +CU_LAUNCH_PARAM_BUFFER_POINTER = cydriver.CU_LAUNCH_PARAM_BUFFER_POINTER #: C++ compile time constant for CU_LAUNCH_PARAM_BUFFER_SIZE -CU_LAUNCH_PARAM_BUFFER_SIZE_AS_INT = ccuda.CU_LAUNCH_PARAM_BUFFER_SIZE_AS_INT +CU_LAUNCH_PARAM_BUFFER_SIZE_AS_INT = cydriver.CU_LAUNCH_PARAM_BUFFER_SIZE_AS_INT #: Indicator that the next value in the `extra` parameter to #: :py:obj:`~.cuLaunchKernel` will be a pointer to a size_t which contains @@ -310,16555 +329,24886 @@ CU_LAUNCH_PARAM_BUFFER_SIZE_AS_INT = ccuda.CU_LAUNCH_PARAM_BUFFER_SIZE_AS_INT #: :py:obj:`~.CU_LAUNCH_PARAM_BUFFER_POINTER` also be specified in the #: `extra` array if the value associated with #: :py:obj:`~.CU_LAUNCH_PARAM_BUFFER_SIZE` is not zero. -CU_LAUNCH_PARAM_BUFFER_SIZE = ccuda.CU_LAUNCH_PARAM_BUFFER_SIZE +CU_LAUNCH_PARAM_BUFFER_SIZE = cydriver.CU_LAUNCH_PARAM_BUFFER_SIZE #: For texture references loaded into the module, use default texunit from #: texture reference. -CU_PARAM_TR_DEFAULT = ccuda.CU_PARAM_TR_DEFAULT +CU_PARAM_TR_DEFAULT = cydriver.CU_PARAM_TR_DEFAULT #: Device that represents the CPU -CU_DEVICE_CPU = ccuda.CU_DEVICE_CPU +CU_DEVICE_CPU = cydriver.CU_DEVICE_CPU #: Device that represents an invalid device -CU_DEVICE_INVALID = ccuda.CU_DEVICE_INVALID - -RESOURCE_ABI_VERSION = ccuda.RESOURCE_ABI_VERSION - -RESOURCE_ABI_EXTERNAL_BYTES = ccuda.RESOURCE_ABI_EXTERNAL_BYTES +CU_DEVICE_INVALID = cydriver.CU_DEVICE_INVALID #: Maximum number of planes per frame -MAX_PLANES = ccuda.MAX_PLANES +MAX_PLANES = cydriver.MAX_PLANES #: Indicates that timeout for :py:obj:`~.cuEGLStreamConsumerAcquireFrame` #: is infinite. -CUDA_EGL_INFINITE_TIMEOUT = ccuda.CUDA_EGL_INFINITE_TIMEOUT +CUDA_EGL_INFINITE_TIMEOUT = cydriver.CUDA_EGL_INFINITE_TIMEOUT -{{if 'CUipcMem_flags_enum' in found_types}} - -class CUipcMem_flags(IntEnum): +class CUipcMem_flags(_FastEnum): """ CUDA Ipc Mem Flags """ - {{if 'CU_IPC_MEM_LAZY_ENABLE_PEER_ACCESS' in found_values}} - #: Automatically enable peer access between remote devices as needed - CU_IPC_MEM_LAZY_ENABLE_PEER_ACCESS = ccuda.CUipcMem_flags_enum.CU_IPC_MEM_LAZY_ENABLE_PEER_ACCESS{{endif}} -{{endif}} -{{if 'CUmemAttach_flags_enum' in found_types}} -class CUmemAttach_flags(IntEnum): + CU_IPC_MEM_LAZY_ENABLE_PEER_ACCESS = ( + cydriver.CUipcMem_flags_enum.CU_IPC_MEM_LAZY_ENABLE_PEER_ACCESS, + 'Automatically enable peer access between remote devices as needed\n' + ) + +class CUmemAttach_flags(_FastEnum): """ CUDA Mem Attach Flags """ - {{if 'CU_MEM_ATTACH_GLOBAL' in found_values}} - #: Memory can be accessed by any stream on any device - CU_MEM_ATTACH_GLOBAL = ccuda.CUmemAttach_flags_enum.CU_MEM_ATTACH_GLOBAL{{endif}} - {{if 'CU_MEM_ATTACH_HOST' in found_values}} - #: Memory cannot be accessed by any stream on any device - CU_MEM_ATTACH_HOST = ccuda.CUmemAttach_flags_enum.CU_MEM_ATTACH_HOST{{endif}} - {{if 'CU_MEM_ATTACH_SINGLE' in found_values}} + CU_MEM_ATTACH_GLOBAL = ( + cydriver.CUmemAttach_flags_enum.CU_MEM_ATTACH_GLOBAL, + 'Memory can be accessed by any stream on any device\n' + ) + + + CU_MEM_ATTACH_HOST = ( + cydriver.CUmemAttach_flags_enum.CU_MEM_ATTACH_HOST, + 'Memory cannot be accessed by any stream on any device\n' + ) - #: Memory can only be accessed by a single stream on the associated - #: device - CU_MEM_ATTACH_SINGLE = ccuda.CUmemAttach_flags_enum.CU_MEM_ATTACH_SINGLE{{endif}} -{{endif}} -{{if 'CUctx_flags_enum' in found_types}} -class CUctx_flags(IntEnum): + CU_MEM_ATTACH_SINGLE = ( + cydriver.CUmemAttach_flags_enum.CU_MEM_ATTACH_SINGLE, + 'Memory can only be accessed by a single stream on the associated device\n' + ) + +class CUctx_flags(_FastEnum): """ Context creation flags """ - {{if 'CU_CTX_SCHED_AUTO' in found_values}} - #: Automatic scheduling - CU_CTX_SCHED_AUTO = ccuda.CUctx_flags_enum.CU_CTX_SCHED_AUTO{{endif}} - {{if 'CU_CTX_SCHED_SPIN' in found_values}} - #: Set spin as default scheduling - CU_CTX_SCHED_SPIN = ccuda.CUctx_flags_enum.CU_CTX_SCHED_SPIN{{endif}} - {{if 'CU_CTX_SCHED_YIELD' in found_values}} + CU_CTX_SCHED_AUTO = ( + cydriver.CUctx_flags_enum.CU_CTX_SCHED_AUTO, + 'Automatic scheduling\n' + ) + + + CU_CTX_SCHED_SPIN = ( + cydriver.CUctx_flags_enum.CU_CTX_SCHED_SPIN, + 'Set spin as default scheduling\n' + ) + - #: Set yield as default scheduling - CU_CTX_SCHED_YIELD = ccuda.CUctx_flags_enum.CU_CTX_SCHED_YIELD{{endif}} - {{if 'CU_CTX_SCHED_BLOCKING_SYNC' in found_values}} + CU_CTX_SCHED_YIELD = ( + cydriver.CUctx_flags_enum.CU_CTX_SCHED_YIELD, + 'Set yield as default scheduling\n' + ) - #: Set blocking synchronization as default scheduling - CU_CTX_SCHED_BLOCKING_SYNC = ccuda.CUctx_flags_enum.CU_CTX_SCHED_BLOCKING_SYNC{{endif}} - {{if 'CU_CTX_BLOCKING_SYNC' in found_values}} - #: Set blocking synchronization as default scheduling [Deprecated] - CU_CTX_BLOCKING_SYNC = ccuda.CUctx_flags_enum.CU_CTX_BLOCKING_SYNC{{endif}} - {{if 'CU_CTX_SCHED_MASK' in found_values}} - CU_CTX_SCHED_MASK = ccuda.CUctx_flags_enum.CU_CTX_SCHED_MASK{{endif}} - {{if 'CU_CTX_MAP_HOST' in found_values}} + CU_CTX_SCHED_BLOCKING_SYNC = ( + cydriver.CUctx_flags_enum.CU_CTX_SCHED_BLOCKING_SYNC, + 'Set blocking synchronization as default scheduling\n' + ) - #: [Deprecated] - CU_CTX_MAP_HOST = ccuda.CUctx_flags_enum.CU_CTX_MAP_HOST{{endif}} - {{if 'CU_CTX_LMEM_RESIZE_TO_MAX' in found_values}} - #: Keep local memory allocation after launch - CU_CTX_LMEM_RESIZE_TO_MAX = ccuda.CUctx_flags_enum.CU_CTX_LMEM_RESIZE_TO_MAX{{endif}} - {{if 'CU_CTX_COREDUMP_ENABLE' in found_values}} + CU_CTX_BLOCKING_SYNC = ( + cydriver.CUctx_flags_enum.CU_CTX_BLOCKING_SYNC, + 'Set blocking synchronization as default scheduling\n' + '[Deprecated]\n' + ) - #: Trigger coredumps from exceptions in this context - CU_CTX_COREDUMP_ENABLE = ccuda.CUctx_flags_enum.CU_CTX_COREDUMP_ENABLE{{endif}} - {{if 'CU_CTX_USER_COREDUMP_ENABLE' in found_values}} + CU_CTX_SCHED_MASK = cydriver.CUctx_flags_enum.CU_CTX_SCHED_MASK - #: Enable user pipe to trigger coredumps in this context - CU_CTX_USER_COREDUMP_ENABLE = ccuda.CUctx_flags_enum.CU_CTX_USER_COREDUMP_ENABLE{{endif}} - {{if 'CU_CTX_SYNC_MEMOPS' in found_values}} - #: Ensure synchronous memory operations on this context will - #: synchronize - CU_CTX_SYNC_MEMOPS = ccuda.CUctx_flags_enum.CU_CTX_SYNC_MEMOPS{{endif}} - {{if 'CU_CTX_FLAGS_MASK' in found_values}} - CU_CTX_FLAGS_MASK = ccuda.CUctx_flags_enum.CU_CTX_FLAGS_MASK{{endif}} -{{endif}} -{{if 'CUevent_sched_flags_enum' in found_types}} + CU_CTX_MAP_HOST = ( + cydriver.CUctx_flags_enum.CU_CTX_MAP_HOST, + '[Deprecated]\n' + ) -class CUevent_sched_flags(IntEnum): + + CU_CTX_LMEM_RESIZE_TO_MAX = ( + cydriver.CUctx_flags_enum.CU_CTX_LMEM_RESIZE_TO_MAX, + 'Keep local memory allocation after launch\n' + ) + + + CU_CTX_COREDUMP_ENABLE = ( + cydriver.CUctx_flags_enum.CU_CTX_COREDUMP_ENABLE, + 'Trigger coredumps from exceptions in this context\n' + ) + + + CU_CTX_USER_COREDUMP_ENABLE = ( + cydriver.CUctx_flags_enum.CU_CTX_USER_COREDUMP_ENABLE, + 'Enable user pipe to trigger coredumps in this context\n' + ) + + + CU_CTX_SYNC_MEMOPS = ( + cydriver.CUctx_flags_enum.CU_CTX_SYNC_MEMOPS, + 'Ensure synchronous memory operations on this context will synchronize\n' + ) + + CU_CTX_FLAGS_MASK = cydriver.CUctx_flags_enum.CU_CTX_FLAGS_MASK + +class CUevent_sched_flags(_FastEnum): """ Event sched flags """ - {{if 'CU_EVENT_SCHED_AUTO' in found_values}} - #: Automatic scheduling - CU_EVENT_SCHED_AUTO = ccuda.CUevent_sched_flags_enum.CU_EVENT_SCHED_AUTO{{endif}} - {{if 'CU_EVENT_SCHED_SPIN' in found_values}} - #: Set spin as default scheduling - CU_EVENT_SCHED_SPIN = ccuda.CUevent_sched_flags_enum.CU_EVENT_SCHED_SPIN{{endif}} - {{if 'CU_EVENT_SCHED_YIELD' in found_values}} + CU_EVENT_SCHED_AUTO = ( + cydriver.CUevent_sched_flags_enum.CU_EVENT_SCHED_AUTO, + 'Automatic scheduling\n' + ) + + + CU_EVENT_SCHED_SPIN = ( + cydriver.CUevent_sched_flags_enum.CU_EVENT_SCHED_SPIN, + 'Set spin as default scheduling\n' + ) + - #: Set yield as default scheduling - CU_EVENT_SCHED_YIELD = ccuda.CUevent_sched_flags_enum.CU_EVENT_SCHED_YIELD{{endif}} - {{if 'CU_EVENT_SCHED_BLOCKING_SYNC' in found_values}} + CU_EVENT_SCHED_YIELD = ( + cydriver.CUevent_sched_flags_enum.CU_EVENT_SCHED_YIELD, + 'Set yield as default scheduling\n' + ) - #: Set blocking synchronization as default scheduling - CU_EVENT_SCHED_BLOCKING_SYNC = ccuda.CUevent_sched_flags_enum.CU_EVENT_SCHED_BLOCKING_SYNC{{endif}} -{{endif}} -{{if 'cl_event_flags_enum' in found_types}} -class cl_event_flags(IntEnum): + CU_EVENT_SCHED_BLOCKING_SYNC = ( + cydriver.CUevent_sched_flags_enum.CU_EVENT_SCHED_BLOCKING_SYNC, + 'Set blocking synchronization as default scheduling\n' + ) + +class cl_event_flags(_FastEnum): """ NVCL event scheduling flags """ - {{if 'NVCL_EVENT_SCHED_AUTO' in found_values}} - #: Automatic scheduling - NVCL_EVENT_SCHED_AUTO = ccuda.cl_event_flags_enum.NVCL_EVENT_SCHED_AUTO{{endif}} - {{if 'NVCL_EVENT_SCHED_SPIN' in found_values}} - #: Set spin as default scheduling - NVCL_EVENT_SCHED_SPIN = ccuda.cl_event_flags_enum.NVCL_EVENT_SCHED_SPIN{{endif}} - {{if 'NVCL_EVENT_SCHED_YIELD' in found_values}} + NVCL_EVENT_SCHED_AUTO = ( + cydriver.cl_event_flags_enum.NVCL_EVENT_SCHED_AUTO, + 'Automatic scheduling\n' + ) + + + NVCL_EVENT_SCHED_SPIN = ( + cydriver.cl_event_flags_enum.NVCL_EVENT_SCHED_SPIN, + 'Set spin as default scheduling\n' + ) + - #: Set yield as default scheduling - NVCL_EVENT_SCHED_YIELD = ccuda.cl_event_flags_enum.NVCL_EVENT_SCHED_YIELD{{endif}} - {{if 'NVCL_EVENT_SCHED_BLOCKING_SYNC' in found_values}} + NVCL_EVENT_SCHED_YIELD = ( + cydriver.cl_event_flags_enum.NVCL_EVENT_SCHED_YIELD, + 'Set yield as default scheduling\n' + ) - #: Set blocking synchronization as default scheduling - NVCL_EVENT_SCHED_BLOCKING_SYNC = ccuda.cl_event_flags_enum.NVCL_EVENT_SCHED_BLOCKING_SYNC{{endif}} -{{endif}} -{{if 'cl_context_flags_enum' in found_types}} -class cl_context_flags(IntEnum): + NVCL_EVENT_SCHED_BLOCKING_SYNC = ( + cydriver.cl_event_flags_enum.NVCL_EVENT_SCHED_BLOCKING_SYNC, + 'Set blocking synchronization as default scheduling\n' + ) + +class cl_context_flags(_FastEnum): """ NVCL context scheduling flags """ - {{if 'NVCL_CTX_SCHED_AUTO' in found_values}} - #: Automatic scheduling - NVCL_CTX_SCHED_AUTO = ccuda.cl_context_flags_enum.NVCL_CTX_SCHED_AUTO{{endif}} - {{if 'NVCL_CTX_SCHED_SPIN' in found_values}} - #: Set spin as default scheduling - NVCL_CTX_SCHED_SPIN = ccuda.cl_context_flags_enum.NVCL_CTX_SCHED_SPIN{{endif}} - {{if 'NVCL_CTX_SCHED_YIELD' in found_values}} + NVCL_CTX_SCHED_AUTO = ( + cydriver.cl_context_flags_enum.NVCL_CTX_SCHED_AUTO, + 'Automatic scheduling\n' + ) + + + NVCL_CTX_SCHED_SPIN = ( + cydriver.cl_context_flags_enum.NVCL_CTX_SCHED_SPIN, + 'Set spin as default scheduling\n' + ) + + + NVCL_CTX_SCHED_YIELD = ( + cydriver.cl_context_flags_enum.NVCL_CTX_SCHED_YIELD, + 'Set yield as default scheduling\n' + ) + + + NVCL_CTX_SCHED_BLOCKING_SYNC = ( + cydriver.cl_context_flags_enum.NVCL_CTX_SCHED_BLOCKING_SYNC, + 'Set blocking synchronization as default scheduling\n' + ) + +class CUhostTaskSyncMode(_FastEnum): + """ + + """ + + + CU_HOST_TASK_BLOCKING = ( + cydriver.CUhostTaskSyncMode_enum.CU_HOST_TASK_BLOCKING, + 'The execution thread will block until new host tasks are ready to run\n' + ) - #: Set yield as default scheduling - NVCL_CTX_SCHED_YIELD = ccuda.cl_context_flags_enum.NVCL_CTX_SCHED_YIELD{{endif}} - {{if 'NVCL_CTX_SCHED_BLOCKING_SYNC' in found_values}} - #: Set blocking synchronization as default scheduling - NVCL_CTX_SCHED_BLOCKING_SYNC = ccuda.cl_context_flags_enum.NVCL_CTX_SCHED_BLOCKING_SYNC{{endif}} -{{endif}} -{{if 'CUstream_flags_enum' in found_types}} + CU_HOST_TASK_SPINWAIT = ( + cydriver.CUhostTaskSyncMode_enum.CU_HOST_TASK_SPINWAIT, + 'The execution thread will spin wait until new host tasks are ready to run\n' + ) -class CUstream_flags(IntEnum): +class CUstream_flags(_FastEnum): """ Stream creation flags """ - {{if 'CU_STREAM_DEFAULT' in found_values}} - #: Default stream flag - CU_STREAM_DEFAULT = ccuda.CUstream_flags_enum.CU_STREAM_DEFAULT{{endif}} - {{if 'CU_STREAM_NON_BLOCKING' in found_values}} - #: Stream does not synchronize with stream 0 (the NULL stream) - CU_STREAM_NON_BLOCKING = ccuda.CUstream_flags_enum.CU_STREAM_NON_BLOCKING{{endif}} -{{endif}} -{{if 'CUevent_flags_enum' in found_types}} + CU_STREAM_DEFAULT = ( + cydriver.CUstream_flags_enum.CU_STREAM_DEFAULT, + 'Default stream flag\n' + ) + -class CUevent_flags(IntEnum): + CU_STREAM_NON_BLOCKING = ( + cydriver.CUstream_flags_enum.CU_STREAM_NON_BLOCKING, + 'Stream does not synchronize with stream 0 (the NULL stream)\n' + ) + +class CUevent_flags(_FastEnum): """ Event creation flags """ - {{if 'CU_EVENT_DEFAULT' in found_values}} - #: Default event flag - CU_EVENT_DEFAULT = ccuda.CUevent_flags_enum.CU_EVENT_DEFAULT{{endif}} - {{if 'CU_EVENT_BLOCKING_SYNC' in found_values}} - #: Event uses blocking synchronization - CU_EVENT_BLOCKING_SYNC = ccuda.CUevent_flags_enum.CU_EVENT_BLOCKING_SYNC{{endif}} - {{if 'CU_EVENT_DISABLE_TIMING' in found_values}} + CU_EVENT_DEFAULT = ( + cydriver.CUevent_flags_enum.CU_EVENT_DEFAULT, + 'Default event flag\n' + ) + - #: Event will not record timing data - CU_EVENT_DISABLE_TIMING = ccuda.CUevent_flags_enum.CU_EVENT_DISABLE_TIMING{{endif}} - {{if 'CU_EVENT_INTERPROCESS' in found_values}} + CU_EVENT_BLOCKING_SYNC = ( + cydriver.CUevent_flags_enum.CU_EVENT_BLOCKING_SYNC, + 'Event uses blocking synchronization\n' + ) - #: Event is suitable for interprocess use. CU_EVENT_DISABLE_TIMING must - #: be set - CU_EVENT_INTERPROCESS = ccuda.CUevent_flags_enum.CU_EVENT_INTERPROCESS{{endif}} -{{endif}} -{{if 'CUevent_record_flags_enum' in found_types}} -class CUevent_record_flags(IntEnum): + CU_EVENT_DISABLE_TIMING = ( + cydriver.CUevent_flags_enum.CU_EVENT_DISABLE_TIMING, + 'Event will not record timing data\n' + ) + + + CU_EVENT_INTERPROCESS = ( + cydriver.CUevent_flags_enum.CU_EVENT_INTERPROCESS, + 'Event is suitable for interprocess use. CU_EVENT_DISABLE_TIMING must be set\n' + ) + +class CUevent_record_flags(_FastEnum): """ Event record flags """ - {{if 'CU_EVENT_RECORD_DEFAULT' in found_values}} - #: Default event record flag - CU_EVENT_RECORD_DEFAULT = ccuda.CUevent_record_flags_enum.CU_EVENT_RECORD_DEFAULT{{endif}} - {{if 'CU_EVENT_RECORD_EXTERNAL' in found_values}} - #: When using stream capture, create an event record node instead of - #: the default behavior. This flag is invalid when used outside of - #: capture. - CU_EVENT_RECORD_EXTERNAL = ccuda.CUevent_record_flags_enum.CU_EVENT_RECORD_EXTERNAL{{endif}} -{{endif}} -{{if 'CUevent_wait_flags_enum' in found_types}} + CU_EVENT_RECORD_DEFAULT = ( + cydriver.CUevent_record_flags_enum.CU_EVENT_RECORD_DEFAULT, + 'Default event record flag\n' + ) + -class CUevent_wait_flags(IntEnum): + CU_EVENT_RECORD_EXTERNAL = ( + cydriver.CUevent_record_flags_enum.CU_EVENT_RECORD_EXTERNAL, + 'When using stream capture, create an event record node instead of the\n' + 'default behavior. This flag is invalid when used outside of capture.\n' + ) + +class CUevent_wait_flags(_FastEnum): """ Event wait flags """ - {{if 'CU_EVENT_WAIT_DEFAULT' in found_values}} - #: Default event wait flag - CU_EVENT_WAIT_DEFAULT = ccuda.CUevent_wait_flags_enum.CU_EVENT_WAIT_DEFAULT{{endif}} - {{if 'CU_EVENT_WAIT_EXTERNAL' in found_values}} - #: When using stream capture, create an event wait node instead of the - #: default behavior. This flag is invalid when used outside of capture. - CU_EVENT_WAIT_EXTERNAL = ccuda.CUevent_wait_flags_enum.CU_EVENT_WAIT_EXTERNAL{{endif}} -{{endif}} -{{if 'CUstreamWaitValue_flags_enum' in found_types}} + CU_EVENT_WAIT_DEFAULT = ( + cydriver.CUevent_wait_flags_enum.CU_EVENT_WAIT_DEFAULT, + 'Default event wait flag\n' + ) -class CUstreamWaitValue_flags(IntEnum): - """ - Flags for :py:obj:`~.cuStreamWaitValue32` and - :py:obj:`~.cuStreamWaitValue64` - """ - {{if 'CU_STREAM_WAIT_VALUE_GEQ' in found_values}} - - #: Wait until (int32_t)(*addr - value) >= 0 (or int64_t for 64 bit - #: values). Note this is a cyclic comparison which ignores wraparound. - #: (Default behavior.) - CU_STREAM_WAIT_VALUE_GEQ = ccuda.CUstreamWaitValue_flags_enum.CU_STREAM_WAIT_VALUE_GEQ{{endif}} - {{if 'CU_STREAM_WAIT_VALUE_EQ' in found_values}} - - #: Wait until *addr == value. - CU_STREAM_WAIT_VALUE_EQ = ccuda.CUstreamWaitValue_flags_enum.CU_STREAM_WAIT_VALUE_EQ{{endif}} - {{if 'CU_STREAM_WAIT_VALUE_AND' in found_values}} - - #: Wait until (*addr & value) != 0. - CU_STREAM_WAIT_VALUE_AND = ccuda.CUstreamWaitValue_flags_enum.CU_STREAM_WAIT_VALUE_AND{{endif}} - {{if 'CU_STREAM_WAIT_VALUE_NOR' in found_values}} - - #: Wait until ~(*addr | value) != 0. Support for this operation can be - #: queried with :py:obj:`~.cuDeviceGetAttribute()` and - #: :py:obj:`~.CU_DEVICE_ATTRIBUTE_CAN_USE_STREAM_WAIT_VALUE_NOR`. - CU_STREAM_WAIT_VALUE_NOR = ccuda.CUstreamWaitValue_flags_enum.CU_STREAM_WAIT_VALUE_NOR{{endif}} - {{if 'CU_STREAM_WAIT_VALUE_FLUSH' in found_values}} - - #: Follow the wait operation with a flush of outstanding remote writes. - #: This means that, if a remote write operation is guaranteed to have - #: reached the device before the wait can be satisfied, that write is - #: guaranteed to be visible to downstream device work. The device is - #: permitted to reorder remote writes internally. For example, this - #: flag would be required if two remote writes arrive in a defined - #: order, the wait is satisfied by the second write, and downstream - #: work needs to observe the first write. Support for this operation is - #: restricted to selected platforms and can be queried with - #: :py:obj:`~.CU_DEVICE_ATTRIBUTE_CAN_FLUSH_REMOTE_WRITES`. - CU_STREAM_WAIT_VALUE_FLUSH = ccuda.CUstreamWaitValue_flags_enum.CU_STREAM_WAIT_VALUE_FLUSH{{endif}} -{{endif}} -{{if 'CUstreamWriteValue_flags_enum' in found_types}} - -class CUstreamWriteValue_flags(IntEnum): + + CU_EVENT_WAIT_EXTERNAL = ( + cydriver.CUevent_wait_flags_enum.CU_EVENT_WAIT_EXTERNAL, + 'When using stream capture, create an event wait node instead of the default\n' + 'behavior. This flag is invalid when used outside of capture.\n' + ) + +class CUatomicOperation(_FastEnum): """ - Flags for :py:obj:`~.cuStreamWriteValue32` + CUDA-valid Atomic Operations """ - {{if 'CU_STREAM_WRITE_VALUE_DEFAULT' in found_values}} - #: Default behavior - CU_STREAM_WRITE_VALUE_DEFAULT = ccuda.CUstreamWriteValue_flags_enum.CU_STREAM_WRITE_VALUE_DEFAULT{{endif}} - {{if 'CU_STREAM_WRITE_VALUE_NO_MEMORY_BARRIER' in found_values}} + CU_ATOMIC_OPERATION_INTEGER_ADD = cydriver.CUatomicOperation_enum.CU_ATOMIC_OPERATION_INTEGER_ADD - #: Permits the write to be reordered with writes which were issued - #: before it, as a performance optimization. Normally, - #: :py:obj:`~.cuStreamWriteValue32` will provide a memory fence before - #: the write, which has similar semantics to __threadfence_system() but - #: is scoped to the stream rather than a CUDA thread. This flag is not - #: supported in the v2 API. - CU_STREAM_WRITE_VALUE_NO_MEMORY_BARRIER = ccuda.CUstreamWriteValue_flags_enum.CU_STREAM_WRITE_VALUE_NO_MEMORY_BARRIER{{endif}} -{{endif}} -{{if 'CUstreamBatchMemOpType_enum' in found_types}} + CU_ATOMIC_OPERATION_INTEGER_MIN = cydriver.CUatomicOperation_enum.CU_ATOMIC_OPERATION_INTEGER_MIN -class CUstreamBatchMemOpType(IntEnum): - """ - Operations for :py:obj:`~.cuStreamBatchMemOp` - """ - {{if 'CU_STREAM_MEM_OP_WAIT_VALUE_32' in found_values}} + CU_ATOMIC_OPERATION_INTEGER_MAX = cydriver.CUatomicOperation_enum.CU_ATOMIC_OPERATION_INTEGER_MAX - #: Represents a :py:obj:`~.cuStreamWaitValue32` operation - CU_STREAM_MEM_OP_WAIT_VALUE_32 = ccuda.CUstreamBatchMemOpType_enum.CU_STREAM_MEM_OP_WAIT_VALUE_32{{endif}} - {{if 'CU_STREAM_MEM_OP_WRITE_VALUE_32' in found_values}} + CU_ATOMIC_OPERATION_INTEGER_INCREMENT = cydriver.CUatomicOperation_enum.CU_ATOMIC_OPERATION_INTEGER_INCREMENT - #: Represents a :py:obj:`~.cuStreamWriteValue32` operation - CU_STREAM_MEM_OP_WRITE_VALUE_32 = ccuda.CUstreamBatchMemOpType_enum.CU_STREAM_MEM_OP_WRITE_VALUE_32{{endif}} - {{if 'CU_STREAM_MEM_OP_FLUSH_REMOTE_WRITES' in found_values}} + CU_ATOMIC_OPERATION_INTEGER_DECREMENT = cydriver.CUatomicOperation_enum.CU_ATOMIC_OPERATION_INTEGER_DECREMENT - #: This has the same effect as :py:obj:`~.CU_STREAM_WAIT_VALUE_FLUSH`, - #: but as a standalone operation. - CU_STREAM_MEM_OP_FLUSH_REMOTE_WRITES = ccuda.CUstreamBatchMemOpType_enum.CU_STREAM_MEM_OP_FLUSH_REMOTE_WRITES{{endif}} - {{if 'CU_STREAM_MEM_OP_WAIT_VALUE_64' in found_values}} + CU_ATOMIC_OPERATION_AND = cydriver.CUatomicOperation_enum.CU_ATOMIC_OPERATION_AND - #: Represents a :py:obj:`~.cuStreamWaitValue64` operation - CU_STREAM_MEM_OP_WAIT_VALUE_64 = ccuda.CUstreamBatchMemOpType_enum.CU_STREAM_MEM_OP_WAIT_VALUE_64{{endif}} - {{if 'CU_STREAM_MEM_OP_WRITE_VALUE_64' in found_values}} + CU_ATOMIC_OPERATION_OR = cydriver.CUatomicOperation_enum.CU_ATOMIC_OPERATION_OR - #: Represents a :py:obj:`~.cuStreamWriteValue64` operation - CU_STREAM_MEM_OP_WRITE_VALUE_64 = ccuda.CUstreamBatchMemOpType_enum.CU_STREAM_MEM_OP_WRITE_VALUE_64{{endif}} - {{if 'CU_STREAM_MEM_OP_BARRIER' in found_values}} + CU_ATOMIC_OPERATION_XOR = cydriver.CUatomicOperation_enum.CU_ATOMIC_OPERATION_XOR - #: Insert a memory barrier of the specified type - CU_STREAM_MEM_OP_BARRIER = ccuda.CUstreamBatchMemOpType_enum.CU_STREAM_MEM_OP_BARRIER{{endif}} -{{endif}} -{{if 'CUstreamMemoryBarrier_flags_enum' in found_types}} + CU_ATOMIC_OPERATION_EXCHANGE = cydriver.CUatomicOperation_enum.CU_ATOMIC_OPERATION_EXCHANGE -class CUstreamMemoryBarrier_flags(IntEnum): - """ - Flags for :py:obj:`~.cuStreamMemoryBarrier` - """ - {{if 'CU_STREAM_MEMORY_BARRIER_TYPE_SYS' in found_values}} + CU_ATOMIC_OPERATION_CAS = cydriver.CUatomicOperation_enum.CU_ATOMIC_OPERATION_CAS + + CU_ATOMIC_OPERATION_FLOAT_ADD = cydriver.CUatomicOperation_enum.CU_ATOMIC_OPERATION_FLOAT_ADD - #: System-wide memory barrier. - CU_STREAM_MEMORY_BARRIER_TYPE_SYS = ccuda.CUstreamMemoryBarrier_flags_enum.CU_STREAM_MEMORY_BARRIER_TYPE_SYS{{endif}} - {{if 'CU_STREAM_MEMORY_BARRIER_TYPE_GPU' in found_values}} + CU_ATOMIC_OPERATION_FLOAT_MIN = cydriver.CUatomicOperation_enum.CU_ATOMIC_OPERATION_FLOAT_MIN - #: Limit memory barrier scope to the GPU. - CU_STREAM_MEMORY_BARRIER_TYPE_GPU = ccuda.CUstreamMemoryBarrier_flags_enum.CU_STREAM_MEMORY_BARRIER_TYPE_GPU{{endif}} -{{endif}} -{{if 'CUoccupancy_flags_enum' in found_types}} + CU_ATOMIC_OPERATION_FLOAT_MAX = cydriver.CUatomicOperation_enum.CU_ATOMIC_OPERATION_FLOAT_MAX -class CUoccupancy_flags(IntEnum): + CU_ATOMIC_OPERATION_MAX = cydriver.CUatomicOperation_enum.CU_ATOMIC_OPERATION_MAX + +class CUatomicOperationCapability(_FastEnum): """ - Occupancy calculator flag + CUDA-valid Atomic Operation capabilities """ - {{if 'CU_OCCUPANCY_DEFAULT' in found_values}} - #: Default behavior - CU_OCCUPANCY_DEFAULT = ccuda.CUoccupancy_flags_enum.CU_OCCUPANCY_DEFAULT{{endif}} - {{if 'CU_OCCUPANCY_DISABLE_CACHING_OVERRIDE' in found_values}} + CU_ATOMIC_CAPABILITY_SIGNED = cydriver.CUatomicOperationCapability_enum.CU_ATOMIC_CAPABILITY_SIGNED + + CU_ATOMIC_CAPABILITY_UNSIGNED = cydriver.CUatomicOperationCapability_enum.CU_ATOMIC_CAPABILITY_UNSIGNED + + CU_ATOMIC_CAPABILITY_REDUCTION = cydriver.CUatomicOperationCapability_enum.CU_ATOMIC_CAPABILITY_REDUCTION + + CU_ATOMIC_CAPABILITY_SCALAR_32 = cydriver.CUatomicOperationCapability_enum.CU_ATOMIC_CAPABILITY_SCALAR_32 + + CU_ATOMIC_CAPABILITY_SCALAR_64 = cydriver.CUatomicOperationCapability_enum.CU_ATOMIC_CAPABILITY_SCALAR_64 - #: Assume global caching is enabled and cannot be automatically turned - #: off - CU_OCCUPANCY_DISABLE_CACHING_OVERRIDE = ccuda.CUoccupancy_flags_enum.CU_OCCUPANCY_DISABLE_CACHING_OVERRIDE{{endif}} -{{endif}} -{{if 'CUstreamUpdateCaptureDependencies_flags_enum' in found_types}} + CU_ATOMIC_CAPABILITY_SCALAR_128 = cydriver.CUatomicOperationCapability_enum.CU_ATOMIC_CAPABILITY_SCALAR_128 -class CUstreamUpdateCaptureDependencies_flags(IntEnum): + CU_ATOMIC_CAPABILITY_VECTOR_32x4 = cydriver.CUatomicOperationCapability_enum.CU_ATOMIC_CAPABILITY_VECTOR_32x4 + +class CUstreamWaitValue_flags(_FastEnum): """ - Flags for :py:obj:`~.cuStreamUpdateCaptureDependencies` + Flags for :py:obj:`~.cuStreamWaitValue32` and + :py:obj:`~.cuStreamWaitValue64` """ - {{if 'CU_STREAM_ADD_CAPTURE_DEPENDENCIES' in found_values}} - #: Add new nodes to the dependency set - CU_STREAM_ADD_CAPTURE_DEPENDENCIES = ccuda.CUstreamUpdateCaptureDependencies_flags_enum.CU_STREAM_ADD_CAPTURE_DEPENDENCIES{{endif}} - {{if 'CU_STREAM_SET_CAPTURE_DEPENDENCIES' in found_values}} - #: Replace the dependency set with the new nodes - CU_STREAM_SET_CAPTURE_DEPENDENCIES = ccuda.CUstreamUpdateCaptureDependencies_flags_enum.CU_STREAM_SET_CAPTURE_DEPENDENCIES{{endif}} -{{endif}} -{{if 'CUasyncNotificationType_enum' in found_types}} + CU_STREAM_WAIT_VALUE_GEQ = ( + cydriver.CUstreamWaitValue_flags_enum.CU_STREAM_WAIT_VALUE_GEQ, + 'Wait until (int32_t)(*addr - value) >= 0 (or int64_t for 64 bit values).\n' + 'Note this is a cyclic comparison which ignores wraparound. (Default\n' + 'behavior.)\n' + ) + + + CU_STREAM_WAIT_VALUE_EQ = ( + cydriver.CUstreamWaitValue_flags_enum.CU_STREAM_WAIT_VALUE_EQ, + 'Wait until *addr == value.\n' + ) + + + CU_STREAM_WAIT_VALUE_AND = ( + cydriver.CUstreamWaitValue_flags_enum.CU_STREAM_WAIT_VALUE_AND, + 'Wait until (*addr & value) != 0.\n' + ) -class CUasyncNotificationType(IntEnum): + + CU_STREAM_WAIT_VALUE_NOR = ( + cydriver.CUstreamWaitValue_flags_enum.CU_STREAM_WAIT_VALUE_NOR, + 'Wait until ~(*addr | value) != 0. Support for this operation can be queried\n' + 'with :py:obj:`~.cuDeviceGetAttribute()` and\n' + ':py:obj:`~.CU_DEVICE_ATTRIBUTE_CAN_USE_STREAM_WAIT_VALUE_NOR`.\n' + ) + + + CU_STREAM_WAIT_VALUE_FLUSH = ( + cydriver.CUstreamWaitValue_flags_enum.CU_STREAM_WAIT_VALUE_FLUSH, + 'Follow the wait operation with a flush of outstanding remote writes. This\n' + 'means that, if a remote write operation is guaranteed to have reached the\n' + 'device before the wait can be satisfied, that write is guaranteed to be\n' + 'visible to downstream device work. The device is permitted to reorder\n' + 'remote writes internally. For example, this flag would be required if two\n' + 'remote writes arrive in a defined order, the wait is satisfied by the\n' + 'second write, and downstream work needs to observe the first write. Support\n' + 'for this operation is restricted to selected platforms and can be queried\n' + 'with :py:obj:`~.CU_DEVICE_ATTRIBUTE_CAN_FLUSH_REMOTE_WRITES`.\n' + ) + +class CUstreamWriteValue_flags(_FastEnum): """ - Types of async notification that can be sent + Flags for :py:obj:`~.cuStreamWriteValue32` """ - {{if 'CU_ASYNC_NOTIFICATION_TYPE_OVER_BUDGET' in found_values}} - CU_ASYNC_NOTIFICATION_TYPE_OVER_BUDGET = ccuda.CUasyncNotificationType_enum.CU_ASYNC_NOTIFICATION_TYPE_OVER_BUDGET{{endif}} -{{endif}} -{{if 'CUarray_format_enum' in found_types}} -class CUarray_format(IntEnum): + + CU_STREAM_WRITE_VALUE_DEFAULT = ( + cydriver.CUstreamWriteValue_flags_enum.CU_STREAM_WRITE_VALUE_DEFAULT, + 'Default behavior\n' + ) + + + CU_STREAM_WRITE_VALUE_NO_MEMORY_BARRIER = ( + cydriver.CUstreamWriteValue_flags_enum.CU_STREAM_WRITE_VALUE_NO_MEMORY_BARRIER, + 'Permits the write to be reordered with writes which were issued before it,\n' + 'as a performance optimization. Normally, :py:obj:`~.cuStreamWriteValue32`\n' + 'will provide a memory fence before the write, which has similar semantics\n' + 'to __threadfence_system() but is scoped to the stream rather than a CUDA\n' + 'thread. This flag is not supported in the v2 API.\n' + ) + +class CUstreamBatchMemOpType(_FastEnum): """ - Array formats + Operations for :py:obj:`~.cuStreamBatchMemOp` """ - {{if 'CU_AD_FORMAT_UNSIGNED_INT8' in found_values}} - - #: Unsigned 8-bit integers - CU_AD_FORMAT_UNSIGNED_INT8 = ccuda.CUarray_format_enum.CU_AD_FORMAT_UNSIGNED_INT8{{endif}} - {{if 'CU_AD_FORMAT_UNSIGNED_INT16' in found_values}} - - #: Unsigned 16-bit integers - CU_AD_FORMAT_UNSIGNED_INT16 = ccuda.CUarray_format_enum.CU_AD_FORMAT_UNSIGNED_INT16{{endif}} - {{if 'CU_AD_FORMAT_UNSIGNED_INT32' in found_values}} - - #: Unsigned 32-bit integers - CU_AD_FORMAT_UNSIGNED_INT32 = ccuda.CUarray_format_enum.CU_AD_FORMAT_UNSIGNED_INT32{{endif}} - {{if 'CU_AD_FORMAT_SIGNED_INT8' in found_values}} - - #: Signed 8-bit integers - CU_AD_FORMAT_SIGNED_INT8 = ccuda.CUarray_format_enum.CU_AD_FORMAT_SIGNED_INT8{{endif}} - {{if 'CU_AD_FORMAT_SIGNED_INT16' in found_values}} - - #: Signed 16-bit integers - CU_AD_FORMAT_SIGNED_INT16 = ccuda.CUarray_format_enum.CU_AD_FORMAT_SIGNED_INT16{{endif}} - {{if 'CU_AD_FORMAT_SIGNED_INT32' in found_values}} - - #: Signed 32-bit integers - CU_AD_FORMAT_SIGNED_INT32 = ccuda.CUarray_format_enum.CU_AD_FORMAT_SIGNED_INT32{{endif}} - {{if 'CU_AD_FORMAT_HALF' in found_values}} - - #: 16-bit floating point - CU_AD_FORMAT_HALF = ccuda.CUarray_format_enum.CU_AD_FORMAT_HALF{{endif}} - {{if 'CU_AD_FORMAT_FLOAT' in found_values}} - - #: 32-bit floating point - CU_AD_FORMAT_FLOAT = ccuda.CUarray_format_enum.CU_AD_FORMAT_FLOAT{{endif}} - {{if 'CU_AD_FORMAT_BC1_UNORM' in found_values}} - - #: 4 channel unsigned normalized block-compressed (BC1 compression) - #: format - CU_AD_FORMAT_BC1_UNORM = ccuda.CUarray_format_enum.CU_AD_FORMAT_BC1_UNORM{{endif}} - {{if 'CU_AD_FORMAT_BC1_UNORM_SRGB' in found_values}} - - #: 4 channel unsigned normalized block-compressed (BC1 compression) - #: format with sRGB encoding - CU_AD_FORMAT_BC1_UNORM_SRGB = ccuda.CUarray_format_enum.CU_AD_FORMAT_BC1_UNORM_SRGB{{endif}} - {{if 'CU_AD_FORMAT_BC2_UNORM' in found_values}} - - #: 4 channel unsigned normalized block-compressed (BC2 compression) - #: format - CU_AD_FORMAT_BC2_UNORM = ccuda.CUarray_format_enum.CU_AD_FORMAT_BC2_UNORM{{endif}} - {{if 'CU_AD_FORMAT_BC2_UNORM_SRGB' in found_values}} - - #: 4 channel unsigned normalized block-compressed (BC2 compression) - #: format with sRGB encoding - CU_AD_FORMAT_BC2_UNORM_SRGB = ccuda.CUarray_format_enum.CU_AD_FORMAT_BC2_UNORM_SRGB{{endif}} - {{if 'CU_AD_FORMAT_BC3_UNORM' in found_values}} - - #: 4 channel unsigned normalized block-compressed (BC3 compression) - #: format - CU_AD_FORMAT_BC3_UNORM = ccuda.CUarray_format_enum.CU_AD_FORMAT_BC3_UNORM{{endif}} - {{if 'CU_AD_FORMAT_BC3_UNORM_SRGB' in found_values}} - - #: 4 channel unsigned normalized block-compressed (BC3 compression) - #: format with sRGB encoding - CU_AD_FORMAT_BC3_UNORM_SRGB = ccuda.CUarray_format_enum.CU_AD_FORMAT_BC3_UNORM_SRGB{{endif}} - {{if 'CU_AD_FORMAT_BC4_UNORM' in found_values}} - - #: 1 channel unsigned normalized block-compressed (BC4 compression) - #: format - CU_AD_FORMAT_BC4_UNORM = ccuda.CUarray_format_enum.CU_AD_FORMAT_BC4_UNORM{{endif}} - {{if 'CU_AD_FORMAT_BC4_SNORM' in found_values}} - - #: 1 channel signed normalized block-compressed (BC4 compression) - #: format - CU_AD_FORMAT_BC4_SNORM = ccuda.CUarray_format_enum.CU_AD_FORMAT_BC4_SNORM{{endif}} - {{if 'CU_AD_FORMAT_BC5_UNORM' in found_values}} - - #: 2 channel unsigned normalized block-compressed (BC5 compression) - #: format - CU_AD_FORMAT_BC5_UNORM = ccuda.CUarray_format_enum.CU_AD_FORMAT_BC5_UNORM{{endif}} - {{if 'CU_AD_FORMAT_BC5_SNORM' in found_values}} - - #: 2 channel signed normalized block-compressed (BC5 compression) - #: format - CU_AD_FORMAT_BC5_SNORM = ccuda.CUarray_format_enum.CU_AD_FORMAT_BC5_SNORM{{endif}} - {{if 'CU_AD_FORMAT_BC6H_UF16' in found_values}} - - #: 3 channel unsigned half-float block-compressed (BC6H compression) - #: format - CU_AD_FORMAT_BC6H_UF16 = ccuda.CUarray_format_enum.CU_AD_FORMAT_BC6H_UF16{{endif}} - {{if 'CU_AD_FORMAT_BC6H_SF16' in found_values}} - - #: 3 channel signed half-float block-compressed (BC6H compression) - #: format - CU_AD_FORMAT_BC6H_SF16 = ccuda.CUarray_format_enum.CU_AD_FORMAT_BC6H_SF16{{endif}} - {{if 'CU_AD_FORMAT_BC7_UNORM' in found_values}} - - #: 4 channel unsigned normalized block-compressed (BC7 compression) - #: format - CU_AD_FORMAT_BC7_UNORM = ccuda.CUarray_format_enum.CU_AD_FORMAT_BC7_UNORM{{endif}} - {{if 'CU_AD_FORMAT_BC7_UNORM_SRGB' in found_values}} - - #: 4 channel unsigned normalized block-compressed (BC7 compression) - #: format with sRGB encoding - CU_AD_FORMAT_BC7_UNORM_SRGB = ccuda.CUarray_format_enum.CU_AD_FORMAT_BC7_UNORM_SRGB{{endif}} - {{if 'CU_AD_FORMAT_P010' in found_values}} - - #: 10-bit YUV planar format, with 4:2:0 sampling - CU_AD_FORMAT_P010 = ccuda.CUarray_format_enum.CU_AD_FORMAT_P010{{endif}} - {{if 'CU_AD_FORMAT_P016' in found_values}} - - #: 16-bit YUV planar format, with 4:2:0 sampling - CU_AD_FORMAT_P016 = ccuda.CUarray_format_enum.CU_AD_FORMAT_P016{{endif}} - {{if 'CU_AD_FORMAT_NV16' in found_values}} - - #: 8-bit YUV planar format, with 4:2:2 sampling - CU_AD_FORMAT_NV16 = ccuda.CUarray_format_enum.CU_AD_FORMAT_NV16{{endif}} - {{if 'CU_AD_FORMAT_P210' in found_values}} - - #: 10-bit YUV planar format, with 4:2:2 sampling - CU_AD_FORMAT_P210 = ccuda.CUarray_format_enum.CU_AD_FORMAT_P210{{endif}} - {{if 'CU_AD_FORMAT_P216' in found_values}} - - #: 16-bit YUV planar format, with 4:2:2 sampling - CU_AD_FORMAT_P216 = ccuda.CUarray_format_enum.CU_AD_FORMAT_P216{{endif}} - {{if 'CU_AD_FORMAT_YUY2' in found_values}} - - #: 2 channel, 8-bit YUV packed planar format, with 4:2:2 sampling - CU_AD_FORMAT_YUY2 = ccuda.CUarray_format_enum.CU_AD_FORMAT_YUY2{{endif}} - {{if 'CU_AD_FORMAT_Y210' in found_values}} - - #: 2 channel, 10-bit YUV packed planar format, with 4:2:2 sampling - CU_AD_FORMAT_Y210 = ccuda.CUarray_format_enum.CU_AD_FORMAT_Y210{{endif}} - {{if 'CU_AD_FORMAT_Y216' in found_values}} - - #: 2 channel, 16-bit YUV packed planar format, with 4:2:2 sampling - CU_AD_FORMAT_Y216 = ccuda.CUarray_format_enum.CU_AD_FORMAT_Y216{{endif}} - {{if 'CU_AD_FORMAT_AYUV' in found_values}} - - #: 4 channel, 8-bit YUV packed planar format, with 4:4:4 sampling - CU_AD_FORMAT_AYUV = ccuda.CUarray_format_enum.CU_AD_FORMAT_AYUV{{endif}} - {{if 'CU_AD_FORMAT_Y410' in found_values}} - - #: 10-bit YUV packed planar format, with 4:4:4 sampling - CU_AD_FORMAT_Y410 = ccuda.CUarray_format_enum.CU_AD_FORMAT_Y410{{endif}} - {{if 'CU_AD_FORMAT_NV12' in found_values}} - - #: 8-bit YUV planar format, with 4:2:0 sampling - CU_AD_FORMAT_NV12 = ccuda.CUarray_format_enum.CU_AD_FORMAT_NV12{{endif}} - {{if 'CU_AD_FORMAT_Y416' in found_values}} - - #: 4 channel, 12-bit YUV packed planar format, with 4:4:4 sampling - CU_AD_FORMAT_Y416 = ccuda.CUarray_format_enum.CU_AD_FORMAT_Y416{{endif}} - {{if 'CU_AD_FORMAT_Y444_PLANAR8' in found_values}} - - #: 3 channel 8-bit YUV planar format, with 4:4:4 sampling - CU_AD_FORMAT_Y444_PLANAR8 = ccuda.CUarray_format_enum.CU_AD_FORMAT_Y444_PLANAR8{{endif}} - {{if 'CU_AD_FORMAT_Y444_PLANAR10' in found_values}} - - #: 3 channel 10-bit YUV planar format, with 4:4:4 sampling - CU_AD_FORMAT_Y444_PLANAR10 = ccuda.CUarray_format_enum.CU_AD_FORMAT_Y444_PLANAR10{{endif}} - {{if 'CU_AD_FORMAT_UNORM_INT8X1' in found_values}} - - #: 1 channel unsigned 8-bit normalized integer - CU_AD_FORMAT_UNORM_INT8X1 = ccuda.CUarray_format_enum.CU_AD_FORMAT_UNORM_INT8X1{{endif}} - {{if 'CU_AD_FORMAT_UNORM_INT8X2' in found_values}} - - #: 2 channel unsigned 8-bit normalized integer - CU_AD_FORMAT_UNORM_INT8X2 = ccuda.CUarray_format_enum.CU_AD_FORMAT_UNORM_INT8X2{{endif}} - {{if 'CU_AD_FORMAT_UNORM_INT8X4' in found_values}} - - #: 4 channel unsigned 8-bit normalized integer - CU_AD_FORMAT_UNORM_INT8X4 = ccuda.CUarray_format_enum.CU_AD_FORMAT_UNORM_INT8X4{{endif}} - {{if 'CU_AD_FORMAT_UNORM_INT16X1' in found_values}} - - #: 1 channel unsigned 16-bit normalized integer - CU_AD_FORMAT_UNORM_INT16X1 = ccuda.CUarray_format_enum.CU_AD_FORMAT_UNORM_INT16X1{{endif}} - {{if 'CU_AD_FORMAT_UNORM_INT16X2' in found_values}} - - #: 2 channel unsigned 16-bit normalized integer - CU_AD_FORMAT_UNORM_INT16X2 = ccuda.CUarray_format_enum.CU_AD_FORMAT_UNORM_INT16X2{{endif}} - {{if 'CU_AD_FORMAT_UNORM_INT16X4' in found_values}} - - #: 4 channel unsigned 16-bit normalized integer - CU_AD_FORMAT_UNORM_INT16X4 = ccuda.CUarray_format_enum.CU_AD_FORMAT_UNORM_INT16X4{{endif}} - {{if 'CU_AD_FORMAT_SNORM_INT8X1' in found_values}} - #: 1 channel signed 8-bit normalized integer - CU_AD_FORMAT_SNORM_INT8X1 = ccuda.CUarray_format_enum.CU_AD_FORMAT_SNORM_INT8X1{{endif}} - {{if 'CU_AD_FORMAT_SNORM_INT8X2' in found_values}} - #: 2 channel signed 8-bit normalized integer - CU_AD_FORMAT_SNORM_INT8X2 = ccuda.CUarray_format_enum.CU_AD_FORMAT_SNORM_INT8X2{{endif}} - {{if 'CU_AD_FORMAT_SNORM_INT8X4' in found_values}} + CU_STREAM_MEM_OP_WAIT_VALUE_32 = ( + cydriver.CUstreamBatchMemOpType_enum.CU_STREAM_MEM_OP_WAIT_VALUE_32, + 'Represents a :py:obj:`~.cuStreamWaitValue32` operation\n' + ) - #: 4 channel signed 8-bit normalized integer - CU_AD_FORMAT_SNORM_INT8X4 = ccuda.CUarray_format_enum.CU_AD_FORMAT_SNORM_INT8X4{{endif}} - {{if 'CU_AD_FORMAT_SNORM_INT16X1' in found_values}} - #: 1 channel signed 16-bit normalized integer - CU_AD_FORMAT_SNORM_INT16X1 = ccuda.CUarray_format_enum.CU_AD_FORMAT_SNORM_INT16X1{{endif}} - {{if 'CU_AD_FORMAT_SNORM_INT16X2' in found_values}} + CU_STREAM_MEM_OP_WRITE_VALUE_32 = ( + cydriver.CUstreamBatchMemOpType_enum.CU_STREAM_MEM_OP_WRITE_VALUE_32, + 'Represents a :py:obj:`~.cuStreamWriteValue32` operation\n' + ) - #: 2 channel signed 16-bit normalized integer - CU_AD_FORMAT_SNORM_INT16X2 = ccuda.CUarray_format_enum.CU_AD_FORMAT_SNORM_INT16X2{{endif}} - {{if 'CU_AD_FORMAT_SNORM_INT16X4' in found_values}} - #: 4 channel signed 16-bit normalized integer - CU_AD_FORMAT_SNORM_INT16X4 = ccuda.CUarray_format_enum.CU_AD_FORMAT_SNORM_INT16X4{{endif}} - {{if 'CU_AD_FORMAT_MAX' in found_values}} - CU_AD_FORMAT_MAX = ccuda.CUarray_format_enum.CU_AD_FORMAT_MAX{{endif}} -{{endif}} -{{if 'CUaddress_mode_enum' in found_types}} + CU_STREAM_MEM_OP_FLUSH_REMOTE_WRITES = ( + cydriver.CUstreamBatchMemOpType_enum.CU_STREAM_MEM_OP_FLUSH_REMOTE_WRITES, + 'This has the same effect as :py:obj:`~.CU_STREAM_WAIT_VALUE_FLUSH`, but as\n' + 'a standalone operation.\n' + ) -class CUaddress_mode(IntEnum): - """ - Texture reference addressing modes - """ - {{if 'CU_TR_ADDRESS_MODE_WRAP' in found_values}} - #: Wrapping address mode - CU_TR_ADDRESS_MODE_WRAP = ccuda.CUaddress_mode_enum.CU_TR_ADDRESS_MODE_WRAP{{endif}} - {{if 'CU_TR_ADDRESS_MODE_CLAMP' in found_values}} + CU_STREAM_MEM_OP_WAIT_VALUE_64 = ( + cydriver.CUstreamBatchMemOpType_enum.CU_STREAM_MEM_OP_WAIT_VALUE_64, + 'Represents a :py:obj:`~.cuStreamWaitValue64` operation\n' + ) + - #: Clamp to edge address mode - CU_TR_ADDRESS_MODE_CLAMP = ccuda.CUaddress_mode_enum.CU_TR_ADDRESS_MODE_CLAMP{{endif}} - {{if 'CU_TR_ADDRESS_MODE_MIRROR' in found_values}} + CU_STREAM_MEM_OP_WRITE_VALUE_64 = ( + cydriver.CUstreamBatchMemOpType_enum.CU_STREAM_MEM_OP_WRITE_VALUE_64, + 'Represents a :py:obj:`~.cuStreamWriteValue64` operation\n' + ) - #: Mirror address mode - CU_TR_ADDRESS_MODE_MIRROR = ccuda.CUaddress_mode_enum.CU_TR_ADDRESS_MODE_MIRROR{{endif}} - {{if 'CU_TR_ADDRESS_MODE_BORDER' in found_values}} - #: Border address mode - CU_TR_ADDRESS_MODE_BORDER = ccuda.CUaddress_mode_enum.CU_TR_ADDRESS_MODE_BORDER{{endif}} -{{endif}} -{{if 'CUfilter_mode_enum' in found_types}} + CU_STREAM_MEM_OP_BARRIER = ( + cydriver.CUstreamBatchMemOpType_enum.CU_STREAM_MEM_OP_BARRIER, + 'Insert a memory barrier of the specified type\n' + ) -class CUfilter_mode(IntEnum): + + CU_STREAM_MEM_OP_ATOMIC_REDUCTION = ( + cydriver.CUstreamBatchMemOpType_enum.CU_STREAM_MEM_OP_ATOMIC_REDUCTION, + 'Perform a atomic reduction. See\n' + ':py:obj:`~.CUstreamBatchMemOpParams.atomicReduction`\n' + ) + +class CUstreamMemoryBarrier_flags(_FastEnum): """ - Texture reference filtering modes + Flags for :py:obj:`~.CUstreamBatchMemOpParams.memoryBarrier` """ - {{if 'CU_TR_FILTER_MODE_POINT' in found_values}} - #: Point filter mode - CU_TR_FILTER_MODE_POINT = ccuda.CUfilter_mode_enum.CU_TR_FILTER_MODE_POINT{{endif}} - {{if 'CU_TR_FILTER_MODE_LINEAR' in found_values}} - #: Linear filter mode - CU_TR_FILTER_MODE_LINEAR = ccuda.CUfilter_mode_enum.CU_TR_FILTER_MODE_LINEAR{{endif}} -{{endif}} -{{if 'CUdevice_attribute_enum' in found_types}} + CU_STREAM_MEMORY_BARRIER_TYPE_SYS = ( + cydriver.CUstreamMemoryBarrier_flags_enum.CU_STREAM_MEMORY_BARRIER_TYPE_SYS, + 'System-wide memory barrier.\n' + ) + -class CUdevice_attribute(IntEnum): + CU_STREAM_MEMORY_BARRIER_TYPE_GPU = ( + cydriver.CUstreamMemoryBarrier_flags_enum.CU_STREAM_MEMORY_BARRIER_TYPE_GPU, + 'Limit memory barrier scope to the GPU.\n' + ) + +class CUstreamAtomicReductionOpType(_FastEnum): """ - Device properties + Atomic reduction operation types for + :py:obj:`~.CUstreamBatchMemOpParams.atomicReduction.reductionOp` """ - {{if 'CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_BLOCK' in found_values}} - #: Maximum number of threads per block - CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_BLOCK = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_BLOCK{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_X' in found_values}} - #: Maximum block dimension X - CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_X = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_X{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Y' in found_values}} + CU_STREAM_ATOMIC_REDUCTION_OP_ADD = ( + cydriver.CUstreamAtomicReductionOpType_enum.CU_STREAM_ATOMIC_REDUCTION_OP_ADD, + 'Performs an atomic ADD: *(address) = *(address) + value\n' + ) - #: Maximum block dimension Y - CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Y = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Y{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Z' in found_values}} - #: Maximum block dimension Z - CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Z = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Z{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_X' in found_values}} + CU_STREAM_ATOMIC_REDUCTION_OP_AND = ( + cydriver.CUstreamAtomicReductionOpType_enum.CU_STREAM_ATOMIC_REDUCTION_OP_AND, + 'Performs an atomic AND: *(address) = *(address) & value\n' + ) - #: Maximum grid dimension X - CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_X = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_X{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Y' in found_values}} - #: Maximum grid dimension Y - CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Y = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Y{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Z' in found_values}} + CU_STREAM_ATOMIC_REDUCTION_OP_OR = ( + cydriver.CUstreamAtomicReductionOpType_enum.CU_STREAM_ATOMIC_REDUCTION_OP_OR, + 'Performs an atomic OR: *(address) = *(address) | value\n' + ) - #: Maximum grid dimension Z - CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Z = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Z{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK' in found_values}} +class CUstreamAtomicReductionDataType(_FastEnum): + """ + Atomic reduction data types for + :py:obj:`~.CUstreamBatchMemOpParams.atomicReduction.dataType` + """ - #: Maximum shared memory available per block in bytes - CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_SHARED_MEMORY_PER_BLOCK' in found_values}} + CU_STREAM_ATOMIC_REDUCTION_UNSIGNED_32 = cydriver.CUstreamAtomicReductionDataType_enum.CU_STREAM_ATOMIC_REDUCTION_UNSIGNED_32 - #: Deprecated, use CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK - CU_DEVICE_ATTRIBUTE_SHARED_MEMORY_PER_BLOCK = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_SHARED_MEMORY_PER_BLOCK{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_TOTAL_CONSTANT_MEMORY' in found_values}} + CU_STREAM_ATOMIC_REDUCTION_UNSIGNED_64 = cydriver.CUstreamAtomicReductionDataType_enum.CU_STREAM_ATOMIC_REDUCTION_UNSIGNED_64 - #: Memory available on device for constant variables in a CUDA C kernel - #: in bytes - CU_DEVICE_ATTRIBUTE_TOTAL_CONSTANT_MEMORY = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_TOTAL_CONSTANT_MEMORY{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_WARP_SIZE' in found_values}} +class CUoccupancy_flags(_FastEnum): + """ + Occupancy calculator flag + """ - #: Warp size in threads - CU_DEVICE_ATTRIBUTE_WARP_SIZE = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_WARP_SIZE{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAX_PITCH' in found_values}} - #: Maximum pitch in bytes allowed by memory copies - CU_DEVICE_ATTRIBUTE_MAX_PITCH = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAX_PITCH{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_BLOCK' in found_values}} + CU_OCCUPANCY_DEFAULT = ( + cydriver.CUoccupancy_flags_enum.CU_OCCUPANCY_DEFAULT, + 'Default behavior\n' + ) - #: Maximum number of 32-bit registers available per block - CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_BLOCK = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_BLOCK{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_REGISTERS_PER_BLOCK' in found_values}} - #: Deprecated, use CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_BLOCK - CU_DEVICE_ATTRIBUTE_REGISTERS_PER_BLOCK = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_REGISTERS_PER_BLOCK{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_CLOCK_RATE' in found_values}} + CU_OCCUPANCY_DISABLE_CACHING_OVERRIDE = ( + cydriver.CUoccupancy_flags_enum.CU_OCCUPANCY_DISABLE_CACHING_OVERRIDE, + 'Assume global caching is enabled and cannot be automatically turned off\n' + ) - #: Typical clock frequency in kilohertz - CU_DEVICE_ATTRIBUTE_CLOCK_RATE = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_CLOCK_RATE{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_TEXTURE_ALIGNMENT' in found_values}} +class CUstreamUpdateCaptureDependencies_flags(_FastEnum): + """ + Flags for :py:obj:`~.cuStreamUpdateCaptureDependencies` + """ - #: Alignment requirement for textures - CU_DEVICE_ATTRIBUTE_TEXTURE_ALIGNMENT = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_TEXTURE_ALIGNMENT{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_GPU_OVERLAP' in found_values}} - #: Device can possibly copy memory and execute a kernel concurrently. - #: Deprecated. Use instead CU_DEVICE_ATTRIBUTE_ASYNC_ENGINE_COUNT. - CU_DEVICE_ATTRIBUTE_GPU_OVERLAP = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_GPU_OVERLAP{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT' in found_values}} + CU_STREAM_ADD_CAPTURE_DEPENDENCIES = ( + cydriver.CUstreamUpdateCaptureDependencies_flags_enum.CU_STREAM_ADD_CAPTURE_DEPENDENCIES, + 'Add new nodes to the dependency set\n' + ) - #: Number of multiprocessors on device - CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_KERNEL_EXEC_TIMEOUT' in found_values}} - #: Specifies whether there is a run time limit on kernels - CU_DEVICE_ATTRIBUTE_KERNEL_EXEC_TIMEOUT = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_KERNEL_EXEC_TIMEOUT{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_INTEGRATED' in found_values}} + CU_STREAM_SET_CAPTURE_DEPENDENCIES = ( + cydriver.CUstreamUpdateCaptureDependencies_flags_enum.CU_STREAM_SET_CAPTURE_DEPENDENCIES, + 'Replace the dependency set with the new nodes\n' + ) - #: Device is integrated with host memory - CU_DEVICE_ATTRIBUTE_INTEGRATED = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_INTEGRATED{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_CAN_MAP_HOST_MEMORY' in found_values}} +class CUasyncNotificationType(_FastEnum): + """ + Types of async notification that can be sent + """ - #: Device can map host memory into CUDA address space - CU_DEVICE_ATTRIBUTE_CAN_MAP_HOST_MEMORY = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_CAN_MAP_HOST_MEMORY{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_COMPUTE_MODE' in found_values}} - #: Compute mode (See :py:obj:`~.CUcomputemode` for details) - CU_DEVICE_ATTRIBUTE_COMPUTE_MODE = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_COMPUTE_MODE{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_WIDTH' in found_values}} + CU_ASYNC_NOTIFICATION_TYPE_OVER_BUDGET = ( + cydriver.CUasyncNotificationType_enum.CU_ASYNC_NOTIFICATION_TYPE_OVER_BUDGET, + 'Sent when the process has exceeded its device memory budget\n' + ) - #: Maximum 1D texture width - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_WIDTH = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_WIDTH{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_WIDTH' in found_values}} +class CUarray_format(_FastEnum): + """ + Array formats + """ - #: Maximum 2D texture width - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_WIDTH = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_WIDTH{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_HEIGHT' in found_values}} - #: Maximum 2D texture height - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_HEIGHT = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_HEIGHT{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_WIDTH' in found_values}} + CU_AD_FORMAT_UNSIGNED_INT8 = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_UNSIGNED_INT8, + 'Unsigned 8-bit integers\n' + ) - #: Maximum 3D texture width - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_WIDTH = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_WIDTH{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_HEIGHT' in found_values}} - #: Maximum 3D texture height - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_HEIGHT = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_HEIGHT{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_DEPTH' in found_values}} + CU_AD_FORMAT_UNSIGNED_INT16 = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_UNSIGNED_INT16, + 'Unsigned 16-bit integers\n' + ) - #: Maximum 3D texture depth - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_DEPTH = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_DEPTH{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_WIDTH' in found_values}} - #: Maximum 2D layered texture width - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_WIDTH = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_WIDTH{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_WIDTH' in found_values}} + CU_AD_FORMAT_UNSIGNED_INT32 = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_UNSIGNED_INT32, + 'Unsigned 32-bit integers\n' + ) - #: Deprecated, use CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_WIDTH - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_WIDTH = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_WIDTH{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_HEIGHT' in found_values}} - #: Maximum 2D layered texture height - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_HEIGHT = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_HEIGHT{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_HEIGHT' in found_values}} + CU_AD_FORMAT_SIGNED_INT8 = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_SIGNED_INT8, + 'Signed 8-bit integers\n' + ) - #: Deprecated, use CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_HEIGHT - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_HEIGHT = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_HEIGHT{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_LAYERS' in found_values}} - #: Maximum layers in a 2D layered texture - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_LAYERS = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_LAYERS{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_NUMSLICES' in found_values}} + CU_AD_FORMAT_SIGNED_INT16 = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_SIGNED_INT16, + 'Signed 16-bit integers\n' + ) - #: Deprecated, use CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_LAYERS - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_NUMSLICES = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_NUMSLICES{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_SURFACE_ALIGNMENT' in found_values}} - #: Alignment requirement for surfaces - CU_DEVICE_ATTRIBUTE_SURFACE_ALIGNMENT = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_SURFACE_ALIGNMENT{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_CONCURRENT_KERNELS' in found_values}} + CU_AD_FORMAT_SIGNED_INT32 = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_SIGNED_INT32, + 'Signed 32-bit integers\n' + ) - #: Device can possibly execute multiple kernels concurrently - CU_DEVICE_ATTRIBUTE_CONCURRENT_KERNELS = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_CONCURRENT_KERNELS{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_ECC_ENABLED' in found_values}} - #: Device has ECC support enabled - CU_DEVICE_ATTRIBUTE_ECC_ENABLED = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_ECC_ENABLED{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_PCI_BUS_ID' in found_values}} + CU_AD_FORMAT_HALF = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_HALF, + '16-bit floating point\n' + ) - #: PCI bus ID of the device - CU_DEVICE_ATTRIBUTE_PCI_BUS_ID = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_PCI_BUS_ID{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_PCI_DEVICE_ID' in found_values}} - #: PCI device ID of the device - CU_DEVICE_ATTRIBUTE_PCI_DEVICE_ID = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_PCI_DEVICE_ID{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_TCC_DRIVER' in found_values}} + CU_AD_FORMAT_FLOAT = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_FLOAT, + '32-bit floating point\n' + ) - #: Device is using TCC driver model - CU_DEVICE_ATTRIBUTE_TCC_DRIVER = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_TCC_DRIVER{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MEMORY_CLOCK_RATE' in found_values}} - #: Peak memory clock frequency in kilohertz - CU_DEVICE_ATTRIBUTE_MEMORY_CLOCK_RATE = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MEMORY_CLOCK_RATE{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_GLOBAL_MEMORY_BUS_WIDTH' in found_values}} + CU_AD_FORMAT_UNORM_INT_101010_2 = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_UNORM_INT_101010_2, + '4 channel unorm R10G10B10A2 RGB format\n' + ) - #: Global memory bus width in bits - CU_DEVICE_ATTRIBUTE_GLOBAL_MEMORY_BUS_WIDTH = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_GLOBAL_MEMORY_BUS_WIDTH{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_L2_CACHE_SIZE' in found_values}} - #: Size of L2 cache in bytes - CU_DEVICE_ATTRIBUTE_L2_CACHE_SIZE = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_L2_CACHE_SIZE{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_MULTIPROCESSOR' in found_values}} + CU_AD_FORMAT_UINT8_PACKED_422 = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_UINT8_PACKED_422, + '4 channel unsigned 8-bit YUV packed format, with 4:2:2 sampling\n' + ) - #: Maximum resident threads per multiprocessor - CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_MULTIPROCESSOR = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_MULTIPROCESSOR{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_ASYNC_ENGINE_COUNT' in found_values}} - #: Number of asynchronous engines - CU_DEVICE_ATTRIBUTE_ASYNC_ENGINE_COUNT = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_ASYNC_ENGINE_COUNT{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_UNIFIED_ADDRESSING' in found_values}} + CU_AD_FORMAT_UINT8_PACKED_444 = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_UINT8_PACKED_444, + '4 channel unsigned 8-bit YUV packed format, with 4:4:4 sampling\n' + ) - #: Device shares a unified address space with the host - CU_DEVICE_ATTRIBUTE_UNIFIED_ADDRESSING = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_UNIFIED_ADDRESSING{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LAYERED_WIDTH' in found_values}} - #: Maximum 1D layered texture width - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LAYERED_WIDTH = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LAYERED_WIDTH{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LAYERED_LAYERS' in found_values}} + CU_AD_FORMAT_UINT8_SEMIPLANAR_420 = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_UINT8_SEMIPLANAR_420, + '3 channel unsigned 8-bit YUV semi-planar format, with 4:2:0 sampling\n' + ) - #: Maximum layers in a 1D layered texture - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LAYERED_LAYERS = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LAYERED_LAYERS{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_CAN_TEX2D_GATHER' in found_values}} - #: Deprecated, do not use. - CU_DEVICE_ATTRIBUTE_CAN_TEX2D_GATHER = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_CAN_TEX2D_GATHER{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_GATHER_WIDTH' in found_values}} + CU_AD_FORMAT_UINT16_SEMIPLANAR_420 = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_UINT16_SEMIPLANAR_420, + '3 channel unsigned 16-bit YUV semi-planar format, with 4:2:0 sampling\n' + ) - #: Maximum 2D texture width if CUDA_ARRAY3D_TEXTURE_GATHER is set - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_GATHER_WIDTH = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_GATHER_WIDTH{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_GATHER_HEIGHT' in found_values}} - #: Maximum 2D texture height if CUDA_ARRAY3D_TEXTURE_GATHER is set - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_GATHER_HEIGHT = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_GATHER_HEIGHT{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_WIDTH_ALTERNATE' in found_values}} + CU_AD_FORMAT_UINT8_SEMIPLANAR_422 = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_UINT8_SEMIPLANAR_422, + '3 channel unsigned 8-bit YUV semi-planar format, with 4:2:2 sampling\n' + ) - #: Alternate maximum 3D texture width - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_WIDTH_ALTERNATE = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_WIDTH_ALTERNATE{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_HEIGHT_ALTERNATE' in found_values}} - #: Alternate maximum 3D texture height - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_HEIGHT_ALTERNATE = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_HEIGHT_ALTERNATE{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_DEPTH_ALTERNATE' in found_values}} + CU_AD_FORMAT_UINT16_SEMIPLANAR_422 = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_UINT16_SEMIPLANAR_422, + '3 channel unsigned 16-bit YUV semi-planar format, with 4:2:2 sampling\n' + ) - #: Alternate maximum 3D texture depth - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_DEPTH_ALTERNATE = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_DEPTH_ALTERNATE{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_PCI_DOMAIN_ID' in found_values}} - #: PCI domain ID of the device - CU_DEVICE_ATTRIBUTE_PCI_DOMAIN_ID = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_PCI_DOMAIN_ID{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_TEXTURE_PITCH_ALIGNMENT' in found_values}} + CU_AD_FORMAT_UINT8_SEMIPLANAR_444 = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_UINT8_SEMIPLANAR_444, + '3 channel unsigned 8-bit YUV semi-planar format, with 4:4:4 sampling\n' + ) - #: Pitch alignment requirement for textures - CU_DEVICE_ATTRIBUTE_TEXTURE_PITCH_ALIGNMENT = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_TEXTURE_PITCH_ALIGNMENT{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_WIDTH' in found_values}} - #: Maximum cubemap texture width/height - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_WIDTH = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_WIDTH{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_LAYERED_WIDTH' in found_values}} + CU_AD_FORMAT_UINT16_SEMIPLANAR_444 = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_UINT16_SEMIPLANAR_444, + '3 channel unsigned 16-bit YUV semi-planar format, with 4:4:4 sampling\n' + ) - #: Maximum cubemap layered texture width/height - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_LAYERED_WIDTH = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_LAYERED_WIDTH{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_LAYERED_LAYERS' in found_values}} - #: Maximum layers in a cubemap layered texture - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_LAYERED_LAYERS = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_LAYERED_LAYERS{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_WIDTH' in found_values}} + CU_AD_FORMAT_UINT8_PLANAR_420 = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_UINT8_PLANAR_420, + '3 channel unsigned 8-bit YUV planar format, with 4:2:0 sampling\n' + ) - #: Maximum 1D surface width - CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_WIDTH = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_WIDTH{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_WIDTH' in found_values}} - #: Maximum 2D surface width - CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_WIDTH = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_WIDTH{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_HEIGHT' in found_values}} + CU_AD_FORMAT_UINT16_PLANAR_420 = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_UINT16_PLANAR_420, + '3 channel unsigned 16-bit YUV planar format, with 4:2:0 sampling\n' + ) - #: Maximum 2D surface height - CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_HEIGHT = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_HEIGHT{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_WIDTH' in found_values}} - #: Maximum 3D surface width - CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_WIDTH = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_WIDTH{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_HEIGHT' in found_values}} + CU_AD_FORMAT_UINT8_PLANAR_422 = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_UINT8_PLANAR_422, + '3 channel unsigned 8-bit YUV planar format, with 4:2:2 sampling\n' + ) - #: Maximum 3D surface height - CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_HEIGHT = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_HEIGHT{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_DEPTH' in found_values}} - #: Maximum 3D surface depth - CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_DEPTH = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_DEPTH{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_LAYERED_WIDTH' in found_values}} + CU_AD_FORMAT_UINT16_PLANAR_422 = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_UINT16_PLANAR_422, + '3 channel unsigned 16-bit YUV planar format, with 4:2:2 sampling\n' + ) - #: Maximum 1D layered surface width - CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_LAYERED_WIDTH = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_LAYERED_WIDTH{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_LAYERED_LAYERS' in found_values}} - #: Maximum layers in a 1D layered surface - CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_LAYERED_LAYERS = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_LAYERED_LAYERS{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_WIDTH' in found_values}} + CU_AD_FORMAT_UINT8_PLANAR_444 = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_UINT8_PLANAR_444, + '3 channel unsigned 8-bit YUV planar format, with 4:4:4 sampling\n' + ) - #: Maximum 2D layered surface width - CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_WIDTH = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_WIDTH{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_HEIGHT' in found_values}} - #: Maximum 2D layered surface height - CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_HEIGHT = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_HEIGHT{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_LAYERS' in found_values}} - - #: Maximum layers in a 2D layered surface - CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_LAYERS = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_LAYERS{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_WIDTH' in found_values}} - - #: Maximum cubemap surface width - CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_WIDTH = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_WIDTH{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_LAYERED_WIDTH' in found_values}} - - #: Maximum cubemap layered surface width - CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_LAYERED_WIDTH = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_LAYERED_WIDTH{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_LAYERED_LAYERS' in found_values}} - - #: Maximum layers in a cubemap layered surface - CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_LAYERED_LAYERS = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_LAYERED_LAYERS{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LINEAR_WIDTH' in found_values}} - - #: Deprecated, do not use. Use cudaDeviceGetTexture1DLinearMaxWidth() - #: or :py:obj:`~.cuDeviceGetTexture1DLinearMaxWidth()` instead. - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LINEAR_WIDTH = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LINEAR_WIDTH{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_WIDTH' in found_values}} - - #: Maximum 2D linear texture width - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_WIDTH = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_WIDTH{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_HEIGHT' in found_values}} - - #: Maximum 2D linear texture height - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_HEIGHT = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_HEIGHT{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_PITCH' in found_values}} - - #: Maximum 2D linear texture pitch in bytes - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_PITCH = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_PITCH{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_MIPMAPPED_WIDTH' in found_values}} - - #: Maximum mipmapped 2D texture width - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_MIPMAPPED_WIDTH = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_MIPMAPPED_WIDTH{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_MIPMAPPED_HEIGHT' in found_values}} - - #: Maximum mipmapped 2D texture height - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_MIPMAPPED_HEIGHT = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_MIPMAPPED_HEIGHT{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR' in found_values}} - - #: Major compute capability version number - CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR' in found_values}} - - #: Minor compute capability version number - CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_MIPMAPPED_WIDTH' in found_values}} - - #: Maximum mipmapped 1D texture width - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_MIPMAPPED_WIDTH = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_MIPMAPPED_WIDTH{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_STREAM_PRIORITIES_SUPPORTED' in found_values}} - - #: Device supports stream priorities - CU_DEVICE_ATTRIBUTE_STREAM_PRIORITIES_SUPPORTED = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_STREAM_PRIORITIES_SUPPORTED{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_GLOBAL_L1_CACHE_SUPPORTED' in found_values}} - - #: Device supports caching globals in L1 - CU_DEVICE_ATTRIBUTE_GLOBAL_L1_CACHE_SUPPORTED = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_GLOBAL_L1_CACHE_SUPPORTED{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_LOCAL_L1_CACHE_SUPPORTED' in found_values}} - - #: Device supports caching locals in L1 - CU_DEVICE_ATTRIBUTE_LOCAL_L1_CACHE_SUPPORTED = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_LOCAL_L1_CACHE_SUPPORTED{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_MULTIPROCESSOR' in found_values}} - - #: Maximum shared memory available per multiprocessor in bytes - CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_MULTIPROCESSOR = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_MULTIPROCESSOR{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_MULTIPROCESSOR' in found_values}} - - #: Maximum number of 32-bit registers available per multiprocessor - CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_MULTIPROCESSOR = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_MULTIPROCESSOR{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MANAGED_MEMORY' in found_values}} - - #: Device can allocate managed memory on this system - CU_DEVICE_ATTRIBUTE_MANAGED_MEMORY = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MANAGED_MEMORY{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MULTI_GPU_BOARD' in found_values}} - - #: Device is on a multi-GPU board - CU_DEVICE_ATTRIBUTE_MULTI_GPU_BOARD = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MULTI_GPU_BOARD{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MULTI_GPU_BOARD_GROUP_ID' in found_values}} - - #: Unique id for a group of devices on the same multi-GPU board - CU_DEVICE_ATTRIBUTE_MULTI_GPU_BOARD_GROUP_ID = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MULTI_GPU_BOARD_GROUP_ID{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_HOST_NATIVE_ATOMIC_SUPPORTED' in found_values}} - - #: Link between the device and the host supports native atomic - #: operations (this is a placeholder attribute, and is not supported on - #: any current hardware) - CU_DEVICE_ATTRIBUTE_HOST_NATIVE_ATOMIC_SUPPORTED = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_HOST_NATIVE_ATOMIC_SUPPORTED{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_SINGLE_TO_DOUBLE_PRECISION_PERF_RATIO' in found_values}} - - #: Ratio of single precision performance (in floating-point operations - #: per second) to double precision performance - CU_DEVICE_ATTRIBUTE_SINGLE_TO_DOUBLE_PRECISION_PERF_RATIO = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_SINGLE_TO_DOUBLE_PRECISION_PERF_RATIO{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS' in found_values}} - - #: Device supports coherently accessing pageable memory without calling - #: cudaHostRegister on it - CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS' in found_values}} - - #: Device can coherently access managed memory concurrently with the - #: CPU - CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_COMPUTE_PREEMPTION_SUPPORTED' in found_values}} - - #: Device supports compute preemption. - CU_DEVICE_ATTRIBUTE_COMPUTE_PREEMPTION_SUPPORTED = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_COMPUTE_PREEMPTION_SUPPORTED{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_CAN_USE_HOST_POINTER_FOR_REGISTERED_MEM' in found_values}} - - #: Device can access host registered memory at the same virtual address - #: as the CPU - CU_DEVICE_ATTRIBUTE_CAN_USE_HOST_POINTER_FOR_REGISTERED_MEM = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_CAN_USE_HOST_POINTER_FOR_REGISTERED_MEM{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_CAN_USE_STREAM_MEM_OPS_V1' in found_values}} - - #: Deprecated, along with v1 MemOps API, :py:obj:`~.cuStreamBatchMemOp` - #: and related APIs are supported. - CU_DEVICE_ATTRIBUTE_CAN_USE_STREAM_MEM_OPS_V1 = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_CAN_USE_STREAM_MEM_OPS_V1{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_CAN_USE_64_BIT_STREAM_MEM_OPS_V1' in found_values}} - - #: Deprecated, along with v1 MemOps API, 64-bit operations are - #: supported in :py:obj:`~.cuStreamBatchMemOp` and related APIs. - CU_DEVICE_ATTRIBUTE_CAN_USE_64_BIT_STREAM_MEM_OPS_V1 = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_CAN_USE_64_BIT_STREAM_MEM_OPS_V1{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_CAN_USE_STREAM_WAIT_VALUE_NOR_V1' in found_values}} - - #: Deprecated, along with v1 MemOps API, - #: :py:obj:`~.CU_STREAM_WAIT_VALUE_NOR` is supported. - CU_DEVICE_ATTRIBUTE_CAN_USE_STREAM_WAIT_VALUE_NOR_V1 = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_CAN_USE_STREAM_WAIT_VALUE_NOR_V1{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_COOPERATIVE_LAUNCH' in found_values}} - - #: Device supports launching cooperative kernels via - #: :py:obj:`~.cuLaunchCooperativeKernel` - CU_DEVICE_ATTRIBUTE_COOPERATIVE_LAUNCH = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_COOPERATIVE_LAUNCH{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_COOPERATIVE_MULTI_DEVICE_LAUNCH' in found_values}} - - #: Deprecated, :py:obj:`~.cuLaunchCooperativeKernelMultiDevice` is - #: deprecated. - CU_DEVICE_ATTRIBUTE_COOPERATIVE_MULTI_DEVICE_LAUNCH = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_COOPERATIVE_MULTI_DEVICE_LAUNCH{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK_OPTIN' in found_values}} - - #: Maximum optin shared memory per block - CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK_OPTIN = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK_OPTIN{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_CAN_FLUSH_REMOTE_WRITES' in found_values}} - - #: The :py:obj:`~.CU_STREAM_WAIT_VALUE_FLUSH` flag and the - #: :py:obj:`~.CU_STREAM_MEM_OP_FLUSH_REMOTE_WRITES` MemOp are supported - #: on the device. See :py:obj:`~.Stream Memory Operations` for - #: additional details. - CU_DEVICE_ATTRIBUTE_CAN_FLUSH_REMOTE_WRITES = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_CAN_FLUSH_REMOTE_WRITES{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_HOST_REGISTER_SUPPORTED' in found_values}} - - #: Device supports host memory registration via - #: :py:obj:`~.cudaHostRegister`. - CU_DEVICE_ATTRIBUTE_HOST_REGISTER_SUPPORTED = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_HOST_REGISTER_SUPPORTED{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS_USES_HOST_PAGE_TABLES' in found_values}} - - #: Device accesses pageable memory via the host's page tables. - CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS_USES_HOST_PAGE_TABLES = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS_USES_HOST_PAGE_TABLES{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_DIRECT_MANAGED_MEM_ACCESS_FROM_HOST' in found_values}} - - #: The host can directly access managed memory on the device without - #: migration. - CU_DEVICE_ATTRIBUTE_DIRECT_MANAGED_MEM_ACCESS_FROM_HOST = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_DIRECT_MANAGED_MEM_ACCESS_FROM_HOST{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_VIRTUAL_ADDRESS_MANAGEMENT_SUPPORTED' in found_values}} - - #: Deprecated, Use - #: CU_DEVICE_ATTRIBUTE_VIRTUAL_MEMORY_MANAGEMENT_SUPPORTED - CU_DEVICE_ATTRIBUTE_VIRTUAL_ADDRESS_MANAGEMENT_SUPPORTED = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_VIRTUAL_ADDRESS_MANAGEMENT_SUPPORTED{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_VIRTUAL_MEMORY_MANAGEMENT_SUPPORTED' in found_values}} - - #: Device supports virtual memory management APIs like - #: :py:obj:`~.cuMemAddressReserve`, :py:obj:`~.cuMemCreate`, - #: :py:obj:`~.cuMemMap` and related APIs - CU_DEVICE_ATTRIBUTE_VIRTUAL_MEMORY_MANAGEMENT_SUPPORTED = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_VIRTUAL_MEMORY_MANAGEMENT_SUPPORTED{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_POSIX_FILE_DESCRIPTOR_SUPPORTED' in found_values}} - - #: Device supports exporting memory to a posix file descriptor with - #: :py:obj:`~.cuMemExportToShareableHandle`, if requested via - #: :py:obj:`~.cuMemCreate` - CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_POSIX_FILE_DESCRIPTOR_SUPPORTED = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_POSIX_FILE_DESCRIPTOR_SUPPORTED{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_WIN32_HANDLE_SUPPORTED' in found_values}} - - #: Device supports exporting memory to a Win32 NT handle with - #: :py:obj:`~.cuMemExportToShareableHandle`, if requested via - #: :py:obj:`~.cuMemCreate` - CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_WIN32_HANDLE_SUPPORTED = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_WIN32_HANDLE_SUPPORTED{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_WIN32_KMT_HANDLE_SUPPORTED' in found_values}} - - #: Device supports exporting memory to a Win32 KMT handle with - #: :py:obj:`~.cuMemExportToShareableHandle`, if requested via - #: :py:obj:`~.cuMemCreate` - CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_WIN32_KMT_HANDLE_SUPPORTED = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_WIN32_KMT_HANDLE_SUPPORTED{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAX_BLOCKS_PER_MULTIPROCESSOR' in found_values}} - - #: Maximum number of blocks per multiprocessor - CU_DEVICE_ATTRIBUTE_MAX_BLOCKS_PER_MULTIPROCESSOR = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAX_BLOCKS_PER_MULTIPROCESSOR{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_GENERIC_COMPRESSION_SUPPORTED' in found_values}} - - #: Device supports compression of memory - CU_DEVICE_ATTRIBUTE_GENERIC_COMPRESSION_SUPPORTED = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_GENERIC_COMPRESSION_SUPPORTED{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAX_PERSISTING_L2_CACHE_SIZE' in found_values}} - - #: Maximum L2 persisting lines capacity setting in bytes. - CU_DEVICE_ATTRIBUTE_MAX_PERSISTING_L2_CACHE_SIZE = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAX_PERSISTING_L2_CACHE_SIZE{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAX_ACCESS_POLICY_WINDOW_SIZE' in found_values}} - - #: Maximum value of :py:obj:`~.CUaccessPolicyWindow.num_bytes`. - CU_DEVICE_ATTRIBUTE_MAX_ACCESS_POLICY_WINDOW_SIZE = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAX_ACCESS_POLICY_WINDOW_SIZE{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_WITH_CUDA_VMM_SUPPORTED' in found_values}} - - #: Device supports specifying the GPUDirect RDMA flag with - #: :py:obj:`~.cuMemCreate` - CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_WITH_CUDA_VMM_SUPPORTED = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_WITH_CUDA_VMM_SUPPORTED{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_RESERVED_SHARED_MEMORY_PER_BLOCK' in found_values}} - - #: Shared memory reserved by CUDA driver per block in bytes - CU_DEVICE_ATTRIBUTE_RESERVED_SHARED_MEMORY_PER_BLOCK = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_RESERVED_SHARED_MEMORY_PER_BLOCK{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_SPARSE_CUDA_ARRAY_SUPPORTED' in found_values}} - - #: Device supports sparse CUDA arrays and sparse CUDA mipmapped arrays - CU_DEVICE_ATTRIBUTE_SPARSE_CUDA_ARRAY_SUPPORTED = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_SPARSE_CUDA_ARRAY_SUPPORTED{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_READ_ONLY_HOST_REGISTER_SUPPORTED' in found_values}} - - #: Device supports using the :py:obj:`~.cuMemHostRegister` flag - #: :py:obj:`~.CU_MEMHOSTERGISTER_READ_ONLY` to register memory that - #: must be mapped as read-only to the GPU - CU_DEVICE_ATTRIBUTE_READ_ONLY_HOST_REGISTER_SUPPORTED = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_READ_ONLY_HOST_REGISTER_SUPPORTED{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_TIMELINE_SEMAPHORE_INTEROP_SUPPORTED' in found_values}} - - #: External timeline semaphore interop is supported on the device - CU_DEVICE_ATTRIBUTE_TIMELINE_SEMAPHORE_INTEROP_SUPPORTED = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_TIMELINE_SEMAPHORE_INTEROP_SUPPORTED{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MEMORY_POOLS_SUPPORTED' in found_values}} - - #: Device supports using the :py:obj:`~.cuMemAllocAsync` and - #: :py:obj:`~.cuMemPool` family of APIs - CU_DEVICE_ATTRIBUTE_MEMORY_POOLS_SUPPORTED = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MEMORY_POOLS_SUPPORTED{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_SUPPORTED' in found_values}} - - #: Device supports GPUDirect RDMA APIs, like nvidia_p2p_get_pages (see - #: https://docs.nvidia.com/cuda/gpudirect-rdma for more information) - CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_SUPPORTED = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_SUPPORTED{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_FLUSH_WRITES_OPTIONS' in found_values}} - - #: The returned attribute shall be interpreted as a bitmask, where the - #: individual bits are described by the - #: :py:obj:`~.CUflushGPUDirectRDMAWritesOptions` enum - CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_FLUSH_WRITES_OPTIONS = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_FLUSH_WRITES_OPTIONS{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_WRITES_ORDERING' in found_values}} - - #: GPUDirect RDMA writes to the device do not need to be flushed for - #: consumers within the scope indicated by the returned attribute. See - #: :py:obj:`~.CUGPUDirectRDMAWritesOrdering` for the numerical values - #: returned here. - CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_WRITES_ORDERING = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_WRITES_ORDERING{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MEMPOOL_SUPPORTED_HANDLE_TYPES' in found_values}} - - #: Handle types supported with mempool based IPC - CU_DEVICE_ATTRIBUTE_MEMPOOL_SUPPORTED_HANDLE_TYPES = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MEMPOOL_SUPPORTED_HANDLE_TYPES{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_CLUSTER_LAUNCH' in found_values}} - - #: Indicates device supports cluster launch - CU_DEVICE_ATTRIBUTE_CLUSTER_LAUNCH = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_CLUSTER_LAUNCH{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_DEFERRED_MAPPING_CUDA_ARRAY_SUPPORTED' in found_values}} - - #: Device supports deferred mapping CUDA arrays and CUDA mipmapped - #: arrays - CU_DEVICE_ATTRIBUTE_DEFERRED_MAPPING_CUDA_ARRAY_SUPPORTED = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_DEFERRED_MAPPING_CUDA_ARRAY_SUPPORTED{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_CAN_USE_64_BIT_STREAM_MEM_OPS' in found_values}} - - #: 64-bit operations are supported in :py:obj:`~.cuStreamBatchMemOp` - #: and related MemOp APIs. - CU_DEVICE_ATTRIBUTE_CAN_USE_64_BIT_STREAM_MEM_OPS = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_CAN_USE_64_BIT_STREAM_MEM_OPS{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_CAN_USE_STREAM_WAIT_VALUE_NOR' in found_values}} - - #: :py:obj:`~.CU_STREAM_WAIT_VALUE_NOR` is supported by MemOp APIs. - CU_DEVICE_ATTRIBUTE_CAN_USE_STREAM_WAIT_VALUE_NOR = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_CAN_USE_STREAM_WAIT_VALUE_NOR{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_DMA_BUF_SUPPORTED' in found_values}} - - #: Device supports buffer sharing with dma_buf mechanism. - CU_DEVICE_ATTRIBUTE_DMA_BUF_SUPPORTED = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_DMA_BUF_SUPPORTED{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_IPC_EVENT_SUPPORTED' in found_values}} - - #: Device supports IPC Events. - CU_DEVICE_ATTRIBUTE_IPC_EVENT_SUPPORTED = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_IPC_EVENT_SUPPORTED{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MEM_SYNC_DOMAIN_COUNT' in found_values}} - - #: Number of memory domains the device supports. - CU_DEVICE_ATTRIBUTE_MEM_SYNC_DOMAIN_COUNT = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MEM_SYNC_DOMAIN_COUNT{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_TENSOR_MAP_ACCESS_SUPPORTED' in found_values}} - - #: Device supports accessing memory using Tensor Map. - CU_DEVICE_ATTRIBUTE_TENSOR_MAP_ACCESS_SUPPORTED = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_TENSOR_MAP_ACCESS_SUPPORTED{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_FABRIC_SUPPORTED' in found_values}} - - #: Device supports exporting memory to a fabric handle with - #: :py:obj:`~.cuMemExportToShareableHandle()` or requested with - #: :py:obj:`~.cuMemCreate()` - CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_FABRIC_SUPPORTED = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_FABRIC_SUPPORTED{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_UNIFIED_FUNCTION_POINTERS' in found_values}} - - #: Device supports unified function pointers. - CU_DEVICE_ATTRIBUTE_UNIFIED_FUNCTION_POINTERS = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_UNIFIED_FUNCTION_POINTERS{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_NUMA_CONFIG' in found_values}} - - #: NUMA configuration of a device: value is of type - #: :py:obj:`~.CUdeviceNumaConfig` enum - CU_DEVICE_ATTRIBUTE_NUMA_CONFIG = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_NUMA_CONFIG{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_NUMA_ID' in found_values}} - - #: NUMA node ID of the GPU memory - CU_DEVICE_ATTRIBUTE_NUMA_ID = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_NUMA_ID{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MULTICAST_SUPPORTED' in found_values}} - - #: Device supports switch multicast and reduction operations. - CU_DEVICE_ATTRIBUTE_MULTICAST_SUPPORTED = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MULTICAST_SUPPORTED{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MPS_ENABLED' in found_values}} - - #: Indicates if contexts created on this device will be shared via MPS - CU_DEVICE_ATTRIBUTE_MPS_ENABLED = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MPS_ENABLED{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_HOST_NUMA_ID' in found_values}} - - #: NUMA ID of the host node closest to the device. Returns -1 when - #: system does not support NUMA. - CU_DEVICE_ATTRIBUTE_HOST_NUMA_ID = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_HOST_NUMA_ID{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_D3D12_CIG_SUPPORTED' in found_values}} - - #: Device supports CIG with D3D12. - CU_DEVICE_ATTRIBUTE_D3D12_CIG_SUPPORTED = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_D3D12_CIG_SUPPORTED{{endif}} - {{if 'CU_DEVICE_ATTRIBUTE_MAX' in found_values}} - CU_DEVICE_ATTRIBUTE_MAX = ccuda.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAX{{endif}} -{{endif}} -{{if 'CUpointer_attribute_enum' in found_types}} - -class CUpointer_attribute(IntEnum): - """ - Pointer information - """ - {{if 'CU_POINTER_ATTRIBUTE_CONTEXT' in found_values}} - - #: The :py:obj:`~.CUcontext` on which a pointer was allocated or - #: registered - CU_POINTER_ATTRIBUTE_CONTEXT = ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_CONTEXT{{endif}} - {{if 'CU_POINTER_ATTRIBUTE_MEMORY_TYPE' in found_values}} - - #: The :py:obj:`~.CUmemorytype` describing the physical location of a - #: pointer - CU_POINTER_ATTRIBUTE_MEMORY_TYPE = ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_MEMORY_TYPE{{endif}} - {{if 'CU_POINTER_ATTRIBUTE_DEVICE_POINTER' in found_values}} - - #: The address at which a pointer's memory may be accessed on the - #: device - CU_POINTER_ATTRIBUTE_DEVICE_POINTER = ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_DEVICE_POINTER{{endif}} - {{if 'CU_POINTER_ATTRIBUTE_HOST_POINTER' in found_values}} - - #: The address at which a pointer's memory may be accessed on the host - CU_POINTER_ATTRIBUTE_HOST_POINTER = ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_HOST_POINTER{{endif}} - {{if 'CU_POINTER_ATTRIBUTE_P2P_TOKENS' in found_values}} - - #: A pair of tokens for use with the nv-p2p.h Linux kernel interface - CU_POINTER_ATTRIBUTE_P2P_TOKENS = ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_P2P_TOKENS{{endif}} - {{if 'CU_POINTER_ATTRIBUTE_SYNC_MEMOPS' in found_values}} - - #: Synchronize every synchronous memory operation initiated on this - #: region - CU_POINTER_ATTRIBUTE_SYNC_MEMOPS = ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_SYNC_MEMOPS{{endif}} - {{if 'CU_POINTER_ATTRIBUTE_BUFFER_ID' in found_values}} - - #: A process-wide unique ID for an allocated memory region - CU_POINTER_ATTRIBUTE_BUFFER_ID = ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_BUFFER_ID{{endif}} - {{if 'CU_POINTER_ATTRIBUTE_IS_MANAGED' in found_values}} - - #: Indicates if the pointer points to managed memory - CU_POINTER_ATTRIBUTE_IS_MANAGED = ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_IS_MANAGED{{endif}} - {{if 'CU_POINTER_ATTRIBUTE_DEVICE_ORDINAL' in found_values}} - - #: A device ordinal of a device on which a pointer was allocated or - #: registered - CU_POINTER_ATTRIBUTE_DEVICE_ORDINAL = ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_DEVICE_ORDINAL{{endif}} - {{if 'CU_POINTER_ATTRIBUTE_IS_LEGACY_CUDA_IPC_CAPABLE' in found_values}} - - #: 1 if this pointer maps to an allocation that is suitable for - #: :py:obj:`~.cudaIpcGetMemHandle`, 0 otherwise - CU_POINTER_ATTRIBUTE_IS_LEGACY_CUDA_IPC_CAPABLE = ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_IS_LEGACY_CUDA_IPC_CAPABLE{{endif}} - {{if 'CU_POINTER_ATTRIBUTE_RANGE_START_ADDR' in found_values}} - - #: Starting address for this requested pointer - CU_POINTER_ATTRIBUTE_RANGE_START_ADDR = ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_RANGE_START_ADDR{{endif}} - {{if 'CU_POINTER_ATTRIBUTE_RANGE_SIZE' in found_values}} - - #: Size of the address range for this requested pointer - CU_POINTER_ATTRIBUTE_RANGE_SIZE = ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_RANGE_SIZE{{endif}} - {{if 'CU_POINTER_ATTRIBUTE_MAPPED' in found_values}} - - #: 1 if this pointer is in a valid address range that is mapped to a - #: backing allocation, 0 otherwise - CU_POINTER_ATTRIBUTE_MAPPED = ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_MAPPED{{endif}} - {{if 'CU_POINTER_ATTRIBUTE_ALLOWED_HANDLE_TYPES' in found_values}} - - #: Bitmask of allowed :py:obj:`~.CUmemAllocationHandleType` for this - #: allocation - CU_POINTER_ATTRIBUTE_ALLOWED_HANDLE_TYPES = ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_ALLOWED_HANDLE_TYPES{{endif}} - {{if 'CU_POINTER_ATTRIBUTE_IS_GPU_DIRECT_RDMA_CAPABLE' in found_values}} - - #: 1 if the memory this pointer is referencing can be used with the - #: GPUDirect RDMA API - CU_POINTER_ATTRIBUTE_IS_GPU_DIRECT_RDMA_CAPABLE = ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_IS_GPU_DIRECT_RDMA_CAPABLE{{endif}} - {{if 'CU_POINTER_ATTRIBUTE_ACCESS_FLAGS' in found_values}} - - #: Returns the access flags the device associated with the current - #: context has on the corresponding memory referenced by the pointer - #: given - CU_POINTER_ATTRIBUTE_ACCESS_FLAGS = ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_ACCESS_FLAGS{{endif}} - {{if 'CU_POINTER_ATTRIBUTE_MEMPOOL_HANDLE' in found_values}} - - #: Returns the mempool handle for the allocation if it was allocated - #: from a mempool. Otherwise returns NULL. - CU_POINTER_ATTRIBUTE_MEMPOOL_HANDLE = ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_MEMPOOL_HANDLE{{endif}} - {{if 'CU_POINTER_ATTRIBUTE_MAPPING_SIZE' in found_values}} - - #: Size of the actual underlying mapping that the pointer belongs to - CU_POINTER_ATTRIBUTE_MAPPING_SIZE = ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_MAPPING_SIZE{{endif}} - {{if 'CU_POINTER_ATTRIBUTE_MAPPING_BASE_ADDR' in found_values}} - - #: The start address of the mapping that the pointer belongs to - CU_POINTER_ATTRIBUTE_MAPPING_BASE_ADDR = ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_MAPPING_BASE_ADDR{{endif}} - {{if 'CU_POINTER_ATTRIBUTE_MEMORY_BLOCK_ID' in found_values}} - - #: A process-wide unique id corresponding to the physical allocation - #: the pointer belongs to - CU_POINTER_ATTRIBUTE_MEMORY_BLOCK_ID = ccuda.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_MEMORY_BLOCK_ID{{endif}} -{{endif}} -{{if 'CUfunction_attribute_enum' in found_types}} - -class CUfunction_attribute(IntEnum): - """ - Function properties - """ - {{if 'CU_FUNC_ATTRIBUTE_MAX_THREADS_PER_BLOCK' in found_values}} - - #: The maximum number of threads per block, beyond which a launch of - #: the function would fail. This number depends on both the function - #: and the device on which the function is currently loaded. - CU_FUNC_ATTRIBUTE_MAX_THREADS_PER_BLOCK = ccuda.CUfunction_attribute_enum.CU_FUNC_ATTRIBUTE_MAX_THREADS_PER_BLOCK{{endif}} - {{if 'CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES' in found_values}} - - #: The size in bytes of statically-allocated shared memory required by - #: this function. This does not include dynamically-allocated shared - #: memory requested by the user at runtime. - CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES = ccuda.CUfunction_attribute_enum.CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES{{endif}} - {{if 'CU_FUNC_ATTRIBUTE_CONST_SIZE_BYTES' in found_values}} - - #: The size in bytes of user-allocated constant memory required by this - #: function. - CU_FUNC_ATTRIBUTE_CONST_SIZE_BYTES = ccuda.CUfunction_attribute_enum.CU_FUNC_ATTRIBUTE_CONST_SIZE_BYTES{{endif}} - {{if 'CU_FUNC_ATTRIBUTE_LOCAL_SIZE_BYTES' in found_values}} - - #: The size in bytes of local memory used by each thread of this - #: function. - CU_FUNC_ATTRIBUTE_LOCAL_SIZE_BYTES = ccuda.CUfunction_attribute_enum.CU_FUNC_ATTRIBUTE_LOCAL_SIZE_BYTES{{endif}} - {{if 'CU_FUNC_ATTRIBUTE_NUM_REGS' in found_values}} - - #: The number of registers used by each thread of this function. - CU_FUNC_ATTRIBUTE_NUM_REGS = ccuda.CUfunction_attribute_enum.CU_FUNC_ATTRIBUTE_NUM_REGS{{endif}} - {{if 'CU_FUNC_ATTRIBUTE_PTX_VERSION' in found_values}} - - #: The PTX virtual architecture version for which the function was - #: compiled. This value is the major PTX version * 10 + the minor PTX - #: version, so a PTX version 1.3 function would return the value 13. - #: Note that this may return the undefined value of 0 for cubins - #: compiled prior to CUDA 3.0. - CU_FUNC_ATTRIBUTE_PTX_VERSION = ccuda.CUfunction_attribute_enum.CU_FUNC_ATTRIBUTE_PTX_VERSION{{endif}} - {{if 'CU_FUNC_ATTRIBUTE_BINARY_VERSION' in found_values}} - - #: The binary architecture version for which the function was compiled. - #: This value is the major binary version * 10 + the minor binary - #: version, so a binary version 1.3 function would return the value 13. - #: Note that this will return a value of 10 for legacy cubins that do - #: not have a properly-encoded binary architecture version. - CU_FUNC_ATTRIBUTE_BINARY_VERSION = ccuda.CUfunction_attribute_enum.CU_FUNC_ATTRIBUTE_BINARY_VERSION{{endif}} - {{if 'CU_FUNC_ATTRIBUTE_CACHE_MODE_CA' in found_values}} - - #: The attribute to indicate whether the function has been compiled - #: with user specified option "-Xptxas --dlcm=ca" set . - CU_FUNC_ATTRIBUTE_CACHE_MODE_CA = ccuda.CUfunction_attribute_enum.CU_FUNC_ATTRIBUTE_CACHE_MODE_CA{{endif}} - {{if 'CU_FUNC_ATTRIBUTE_MAX_DYNAMIC_SHARED_SIZE_BYTES' in found_values}} - - #: The maximum size in bytes of dynamically-allocated shared memory - #: that can be used by this function. If the user-specified dynamic - #: shared memory size is larger than this value, the launch will fail. - #: See :py:obj:`~.cuFuncSetAttribute`, :py:obj:`~.cuKernelSetAttribute` - CU_FUNC_ATTRIBUTE_MAX_DYNAMIC_SHARED_SIZE_BYTES = ccuda.CUfunction_attribute_enum.CU_FUNC_ATTRIBUTE_MAX_DYNAMIC_SHARED_SIZE_BYTES{{endif}} - {{if 'CU_FUNC_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT' in found_values}} - - #: On devices where the L1 cache and shared memory use the same - #: hardware resources, this sets the shared memory carveout preference, - #: in percent of the total shared memory. Refer to - #: :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_MULTIPROCESSOR`. - #: This is only a hint, and the driver can choose a different ratio if - #: required to execute the function. See - #: :py:obj:`~.cuFuncSetAttribute`, :py:obj:`~.cuKernelSetAttribute` - CU_FUNC_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT = ccuda.CUfunction_attribute_enum.CU_FUNC_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT{{endif}} - {{if 'CU_FUNC_ATTRIBUTE_CLUSTER_SIZE_MUST_BE_SET' in found_values}} - - #: If this attribute is set, the kernel must launch with a valid - #: cluster size specified. See :py:obj:`~.cuFuncSetAttribute`, - #: :py:obj:`~.cuKernelSetAttribute` - CU_FUNC_ATTRIBUTE_CLUSTER_SIZE_MUST_BE_SET = ccuda.CUfunction_attribute_enum.CU_FUNC_ATTRIBUTE_CLUSTER_SIZE_MUST_BE_SET{{endif}} - {{if 'CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_WIDTH' in found_values}} - - #: The required cluster width in blocks. The values must either all be - #: 0 or all be positive. The validity of the cluster dimensions is - #: otherwise checked at launch time. - #: - #: If the value is set during compile time, it cannot be set at - #: runtime. Setting it at runtime will return CUDA_ERROR_NOT_PERMITTED. - #: See :py:obj:`~.cuFuncSetAttribute`, :py:obj:`~.cuKernelSetAttribute` - CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_WIDTH = ccuda.CUfunction_attribute_enum.CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_WIDTH{{endif}} - {{if 'CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_HEIGHT' in found_values}} - - #: The required cluster height in blocks. The values must either all be - #: 0 or all be positive. The validity of the cluster dimensions is - #: otherwise checked at launch time. - #: - #: If the value is set during compile time, it cannot be set at - #: runtime. Setting it at runtime should return - #: CUDA_ERROR_NOT_PERMITTED. See :py:obj:`~.cuFuncSetAttribute`, - #: :py:obj:`~.cuKernelSetAttribute` - CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_HEIGHT = ccuda.CUfunction_attribute_enum.CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_HEIGHT{{endif}} - {{if 'CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_DEPTH' in found_values}} - - #: The required cluster depth in blocks. The values must either all be - #: 0 or all be positive. The validity of the cluster dimensions is - #: otherwise checked at launch time. - #: - #: If the value is set during compile time, it cannot be set at - #: runtime. Setting it at runtime should return - #: CUDA_ERROR_NOT_PERMITTED. See :py:obj:`~.cuFuncSetAttribute`, - #: :py:obj:`~.cuKernelSetAttribute` - CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_DEPTH = ccuda.CUfunction_attribute_enum.CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_DEPTH{{endif}} - {{if 'CU_FUNC_ATTRIBUTE_NON_PORTABLE_CLUSTER_SIZE_ALLOWED' in found_values}} - - #: Whether the function can be launched with non-portable cluster size. - #: 1 is allowed, 0 is disallowed. A non-portable cluster size may only - #: function on the specific SKUs the program is tested on. The launch - #: might fail if the program is run on a different hardware platform. - #: - #: CUDA API provides cudaOccupancyMaxActiveClusters to assist with - #: checking whether the desired size can be launched on the current - #: device. - #: - #: Portable Cluster Size - #: - #: A portable cluster size is guaranteed to be functional on all - #: compute capabilities higher than the target compute capability. The - #: portable cluster size for sm_90 is 8 blocks per cluster. This value - #: may increase for future compute capabilities. - #: - #: The specific hardware unit may support higher cluster sizes that’s - #: not guaranteed to be portable. See :py:obj:`~.cuFuncSetAttribute`, - #: :py:obj:`~.cuKernelSetAttribute` - CU_FUNC_ATTRIBUTE_NON_PORTABLE_CLUSTER_SIZE_ALLOWED = ccuda.CUfunction_attribute_enum.CU_FUNC_ATTRIBUTE_NON_PORTABLE_CLUSTER_SIZE_ALLOWED{{endif}} - {{if 'CU_FUNC_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE' in found_values}} - - #: The block scheduling policy of a function. The value type is - #: CUclusterSchedulingPolicy / cudaClusterSchedulingPolicy. See - #: :py:obj:`~.cuFuncSetAttribute`, :py:obj:`~.cuKernelSetAttribute` - CU_FUNC_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE = ccuda.CUfunction_attribute_enum.CU_FUNC_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE{{endif}} - {{if 'CU_FUNC_ATTRIBUTE_MAX' in found_values}} - CU_FUNC_ATTRIBUTE_MAX = ccuda.CUfunction_attribute_enum.CU_FUNC_ATTRIBUTE_MAX{{endif}} -{{endif}} -{{if 'CUfunc_cache_enum' in found_types}} - -class CUfunc_cache(IntEnum): - """ - Function cache configurations - """ - {{if 'CU_FUNC_CACHE_PREFER_NONE' in found_values}} + CU_AD_FORMAT_UINT16_PLANAR_444 = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_UINT16_PLANAR_444, + '3 channel unsigned 16-bit YUV planar format, with 4:4:4 sampling\n' + ) - #: no preference for shared memory or L1 (default) - CU_FUNC_CACHE_PREFER_NONE = ccuda.CUfunc_cache_enum.CU_FUNC_CACHE_PREFER_NONE{{endif}} - {{if 'CU_FUNC_CACHE_PREFER_SHARED' in found_values}} - #: prefer larger shared memory and smaller L1 cache - CU_FUNC_CACHE_PREFER_SHARED = ccuda.CUfunc_cache_enum.CU_FUNC_CACHE_PREFER_SHARED{{endif}} - {{if 'CU_FUNC_CACHE_PREFER_L1' in found_values}} + CU_AD_FORMAT_BC1_UNORM = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_BC1_UNORM, + '4 channel unsigned normalized block-compressed (BC1 compression) format\n' + ) - #: prefer larger L1 cache and smaller shared memory - CU_FUNC_CACHE_PREFER_L1 = ccuda.CUfunc_cache_enum.CU_FUNC_CACHE_PREFER_L1{{endif}} - {{if 'CU_FUNC_CACHE_PREFER_EQUAL' in found_values}} - #: prefer equal sized L1 cache and shared memory - CU_FUNC_CACHE_PREFER_EQUAL = ccuda.CUfunc_cache_enum.CU_FUNC_CACHE_PREFER_EQUAL{{endif}} -{{endif}} -{{if 'CUsharedconfig_enum' in found_types}} + CU_AD_FORMAT_BC1_UNORM_SRGB = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_BC1_UNORM_SRGB, + '4 channel unsigned normalized block-compressed (BC1 compression) format\n' + 'with sRGB encoding\n' + ) -class CUsharedconfig(IntEnum): - """ - [Deprecated] Shared memory configurations - """ - {{if 'CU_SHARED_MEM_CONFIG_DEFAULT_BANK_SIZE' in found_values}} - #: set default shared memory bank size - CU_SHARED_MEM_CONFIG_DEFAULT_BANK_SIZE = ccuda.CUsharedconfig_enum.CU_SHARED_MEM_CONFIG_DEFAULT_BANK_SIZE{{endif}} - {{if 'CU_SHARED_MEM_CONFIG_FOUR_BYTE_BANK_SIZE' in found_values}} + CU_AD_FORMAT_BC2_UNORM = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_BC2_UNORM, + '4 channel unsigned normalized block-compressed (BC2 compression) format\n' + ) - #: set shared memory bank width to four bytes - CU_SHARED_MEM_CONFIG_FOUR_BYTE_BANK_SIZE = ccuda.CUsharedconfig_enum.CU_SHARED_MEM_CONFIG_FOUR_BYTE_BANK_SIZE{{endif}} - {{if 'CU_SHARED_MEM_CONFIG_EIGHT_BYTE_BANK_SIZE' in found_values}} - #: set shared memory bank width to eight bytes - CU_SHARED_MEM_CONFIG_EIGHT_BYTE_BANK_SIZE = ccuda.CUsharedconfig_enum.CU_SHARED_MEM_CONFIG_EIGHT_BYTE_BANK_SIZE{{endif}} -{{endif}} -{{if 'CUshared_carveout_enum' in found_types}} + CU_AD_FORMAT_BC2_UNORM_SRGB = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_BC2_UNORM_SRGB, + '4 channel unsigned normalized block-compressed (BC2 compression) format\n' + 'with sRGB encoding\n' + ) -class CUshared_carveout(IntEnum): - """ - Shared memory carveout configurations. These may be passed to - :py:obj:`~.cuFuncSetAttribute` or :py:obj:`~.cuKernelSetAttribute` - """ - {{if 'CU_SHAREDMEM_CARVEOUT_DEFAULT' in found_values}} - #: No preference for shared memory or L1 (default) - CU_SHAREDMEM_CARVEOUT_DEFAULT = ccuda.CUshared_carveout_enum.CU_SHAREDMEM_CARVEOUT_DEFAULT{{endif}} - {{if 'CU_SHAREDMEM_CARVEOUT_MAX_L1' in found_values}} + CU_AD_FORMAT_BC3_UNORM = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_BC3_UNORM, + '4 channel unsigned normalized block-compressed (BC3 compression) format\n' + ) - #: Prefer maximum available L1 cache, minimum shared memory - CU_SHAREDMEM_CARVEOUT_MAX_L1 = ccuda.CUshared_carveout_enum.CU_SHAREDMEM_CARVEOUT_MAX_L1{{endif}} - {{if 'CU_SHAREDMEM_CARVEOUT_MAX_SHARED' in found_values}} - #: Prefer maximum available shared memory, minimum L1 cache - CU_SHAREDMEM_CARVEOUT_MAX_SHARED = ccuda.CUshared_carveout_enum.CU_SHAREDMEM_CARVEOUT_MAX_SHARED{{endif}} -{{endif}} -{{if 'CUmemorytype_enum' in found_types}} + CU_AD_FORMAT_BC3_UNORM_SRGB = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_BC3_UNORM_SRGB, + '4 channel unsigned normalized block-compressed (BC3 compression) format\n' + 'with sRGB encoding\n' + ) -class CUmemorytype(IntEnum): - """ - Memory types - """ - {{if 'CU_MEMORYTYPE_HOST' in found_values}} - #: Host memory - CU_MEMORYTYPE_HOST = ccuda.CUmemorytype_enum.CU_MEMORYTYPE_HOST{{endif}} - {{if 'CU_MEMORYTYPE_DEVICE' in found_values}} + CU_AD_FORMAT_BC4_UNORM = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_BC4_UNORM, + '1 channel unsigned normalized block-compressed (BC4 compression) format\n' + ) - #: Device memory - CU_MEMORYTYPE_DEVICE = ccuda.CUmemorytype_enum.CU_MEMORYTYPE_DEVICE{{endif}} - {{if 'CU_MEMORYTYPE_ARRAY' in found_values}} - #: Array memory - CU_MEMORYTYPE_ARRAY = ccuda.CUmemorytype_enum.CU_MEMORYTYPE_ARRAY{{endif}} - {{if 'CU_MEMORYTYPE_UNIFIED' in found_values}} + CU_AD_FORMAT_BC4_SNORM = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_BC4_SNORM, + '1 channel signed normalized block-compressed (BC4 compression) format\n' + ) - #: Unified device or host memory - CU_MEMORYTYPE_UNIFIED = ccuda.CUmemorytype_enum.CU_MEMORYTYPE_UNIFIED{{endif}} -{{endif}} -{{if 'CUcomputemode_enum' in found_types}} -class CUcomputemode(IntEnum): - """ - Compute Modes - """ - {{if 'CU_COMPUTEMODE_DEFAULT' in found_values}} + CU_AD_FORMAT_BC5_UNORM = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_BC5_UNORM, + '2 channel unsigned normalized block-compressed (BC5 compression) format\n' + ) - #: Default compute mode (Multiple contexts allowed per device) - CU_COMPUTEMODE_DEFAULT = ccuda.CUcomputemode_enum.CU_COMPUTEMODE_DEFAULT{{endif}} - {{if 'CU_COMPUTEMODE_PROHIBITED' in found_values}} - #: Compute-prohibited mode (No contexts can be created on this device - #: at this time) - CU_COMPUTEMODE_PROHIBITED = ccuda.CUcomputemode_enum.CU_COMPUTEMODE_PROHIBITED{{endif}} - {{if 'CU_COMPUTEMODE_EXCLUSIVE_PROCESS' in found_values}} + CU_AD_FORMAT_BC5_SNORM = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_BC5_SNORM, + '2 channel signed normalized block-compressed (BC5 compression) format\n' + ) - #: Compute-exclusive-process mode (Only one context used by a single - #: process can be present on this device at a time) - CU_COMPUTEMODE_EXCLUSIVE_PROCESS = ccuda.CUcomputemode_enum.CU_COMPUTEMODE_EXCLUSIVE_PROCESS{{endif}} -{{endif}} -{{if 'CUmem_advise_enum' in found_types}} -class CUmem_advise(IntEnum): - """ - Memory advise values - """ - {{if 'CU_MEM_ADVISE_SET_READ_MOSTLY' in found_values}} + CU_AD_FORMAT_BC6H_UF16 = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_BC6H_UF16, + '3 channel unsigned half-float block-compressed (BC6H compression) format\n' + ) - #: Data will mostly be read and only occasionally be written to - CU_MEM_ADVISE_SET_READ_MOSTLY = ccuda.CUmem_advise_enum.CU_MEM_ADVISE_SET_READ_MOSTLY{{endif}} - {{if 'CU_MEM_ADVISE_UNSET_READ_MOSTLY' in found_values}} - #: Undo the effect of :py:obj:`~.CU_MEM_ADVISE_SET_READ_MOSTLY` - CU_MEM_ADVISE_UNSET_READ_MOSTLY = ccuda.CUmem_advise_enum.CU_MEM_ADVISE_UNSET_READ_MOSTLY{{endif}} - {{if 'CU_MEM_ADVISE_SET_PREFERRED_LOCATION' in found_values}} + CU_AD_FORMAT_BC6H_SF16 = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_BC6H_SF16, + '3 channel signed half-float block-compressed (BC6H compression) format\n' + ) - #: Set the preferred location for the data as the specified device - CU_MEM_ADVISE_SET_PREFERRED_LOCATION = ccuda.CUmem_advise_enum.CU_MEM_ADVISE_SET_PREFERRED_LOCATION{{endif}} - {{if 'CU_MEM_ADVISE_UNSET_PREFERRED_LOCATION' in found_values}} - #: Clear the preferred location for the data - CU_MEM_ADVISE_UNSET_PREFERRED_LOCATION = ccuda.CUmem_advise_enum.CU_MEM_ADVISE_UNSET_PREFERRED_LOCATION{{endif}} - {{if 'CU_MEM_ADVISE_SET_ACCESSED_BY' in found_values}} + CU_AD_FORMAT_BC7_UNORM = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_BC7_UNORM, + '4 channel unsigned normalized block-compressed (BC7 compression) format\n' + ) - #: Data will be accessed by the specified device, so prevent page - #: faults as much as possible - CU_MEM_ADVISE_SET_ACCESSED_BY = ccuda.CUmem_advise_enum.CU_MEM_ADVISE_SET_ACCESSED_BY{{endif}} - {{if 'CU_MEM_ADVISE_UNSET_ACCESSED_BY' in found_values}} - #: Let the Unified Memory subsystem decide on the page faulting policy - #: for the specified device - CU_MEM_ADVISE_UNSET_ACCESSED_BY = ccuda.CUmem_advise_enum.CU_MEM_ADVISE_UNSET_ACCESSED_BY{{endif}} -{{endif}} -{{if 'CUmem_range_attribute_enum' in found_types}} + CU_AD_FORMAT_BC7_UNORM_SRGB = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_BC7_UNORM_SRGB, + '4 channel unsigned normalized block-compressed (BC7 compression) format\n' + 'with sRGB encoding\n' + ) -class CUmem_range_attribute(IntEnum): - """ - """ - {{if 'CU_MEM_RANGE_ATTRIBUTE_READ_MOSTLY' in found_values}} + CU_AD_FORMAT_P010 = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_P010, + '10-bit YUV planar format, with 4:2:0 sampling\n' + ) - #: Whether the range will mostly be read and only occasionally be - #: written to - CU_MEM_RANGE_ATTRIBUTE_READ_MOSTLY = ccuda.CUmem_range_attribute_enum.CU_MEM_RANGE_ATTRIBUTE_READ_MOSTLY{{endif}} - {{if 'CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION' in found_values}} - #: The preferred location of the range - CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION = ccuda.CUmem_range_attribute_enum.CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION{{endif}} - {{if 'CU_MEM_RANGE_ATTRIBUTE_ACCESSED_BY' in found_values}} + CU_AD_FORMAT_P016 = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_P016, + '16-bit YUV planar format, with 4:2:0 sampling\n' + ) - #: Memory range has :py:obj:`~.CU_MEM_ADVISE_SET_ACCESSED_BY` set for - #: specified device - CU_MEM_RANGE_ATTRIBUTE_ACCESSED_BY = ccuda.CUmem_range_attribute_enum.CU_MEM_RANGE_ATTRIBUTE_ACCESSED_BY{{endif}} - {{if 'CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION' in found_values}} - #: The last location to which the range was prefetched - CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION = ccuda.CUmem_range_attribute_enum.CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION{{endif}} - {{if 'CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION_TYPE' in found_values}} + CU_AD_FORMAT_NV16 = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_NV16, + '8-bit YUV planar format, with 4:2:2 sampling\n' + ) - #: The preferred location type of the range - CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION_TYPE = ccuda.CUmem_range_attribute_enum.CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION_TYPE{{endif}} - {{if 'CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION_ID' in found_values}} - #: The preferred location id of the range - CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION_ID = ccuda.CUmem_range_attribute_enum.CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION_ID{{endif}} - {{if 'CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION_TYPE' in found_values}} + CU_AD_FORMAT_P210 = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_P210, + '10-bit YUV planar format, with 4:2:2 sampling\n' + ) - #: The last location type to which the range was prefetched - CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION_TYPE = ccuda.CUmem_range_attribute_enum.CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION_TYPE{{endif}} - {{if 'CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION_ID' in found_values}} - #: The last location id to which the range was prefetched - CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION_ID = ccuda.CUmem_range_attribute_enum.CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION_ID{{endif}} -{{endif}} -{{if 'CUjit_option_enum' in found_types}} + CU_AD_FORMAT_P216 = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_P216, + '16-bit YUV planar format, with 4:2:2 sampling\n' + ) -class CUjit_option(IntEnum): - """ - Online compiler and linker options - """ - {{if 'CU_JIT_MAX_REGISTERS' in found_values}} - - #: Max number of registers that a thread may use. - #: Option type: unsigned int - #: Applies to: compiler only - CU_JIT_MAX_REGISTERS = ccuda.CUjit_option_enum.CU_JIT_MAX_REGISTERS{{endif}} - {{if 'CU_JIT_THREADS_PER_BLOCK' in found_values}} - - #: IN: Specifies minimum number of threads per block to target - #: compilation for - #: OUT: Returns the number of threads the compiler actually targeted. - #: This restricts the resource utilization of the compiler (e.g. max - #: registers) such that a block with the given number of threads should - #: be able to launch based on register limitations. Note, this option - #: does not currently take into account any other resource limitations, - #: such as shared memory utilization. - #: Cannot be combined with :py:obj:`~.CU_JIT_TARGET`. - #: Option type: unsigned int - #: Applies to: compiler only - CU_JIT_THREADS_PER_BLOCK = ccuda.CUjit_option_enum.CU_JIT_THREADS_PER_BLOCK{{endif}} - {{if 'CU_JIT_WALL_TIME' in found_values}} - - #: Overwrites the option value with the total wall clock time, in - #: milliseconds, spent in the compiler and linker - #: Option type: float - #: Applies to: compiler and linker - CU_JIT_WALL_TIME = ccuda.CUjit_option_enum.CU_JIT_WALL_TIME{{endif}} - {{if 'CU_JIT_INFO_LOG_BUFFER' in found_values}} - - #: Pointer to a buffer in which to print any log messages that are - #: informational in nature (the buffer size is specified via option - #: :py:obj:`~.CU_JIT_INFO_LOG_BUFFER_SIZE_BYTES`) - #: Option type: char * - #: Applies to: compiler and linker - CU_JIT_INFO_LOG_BUFFER = ccuda.CUjit_option_enum.CU_JIT_INFO_LOG_BUFFER{{endif}} - {{if 'CU_JIT_INFO_LOG_BUFFER_SIZE_BYTES' in found_values}} - - #: IN: Log buffer size in bytes. Log messages will be capped at this - #: size (including null terminator) - #: OUT: Amount of log buffer filled with messages - #: Option type: unsigned int - #: Applies to: compiler and linker - CU_JIT_INFO_LOG_BUFFER_SIZE_BYTES = ccuda.CUjit_option_enum.CU_JIT_INFO_LOG_BUFFER_SIZE_BYTES{{endif}} - {{if 'CU_JIT_ERROR_LOG_BUFFER' in found_values}} - - #: Pointer to a buffer in which to print any log messages that reflect - #: errors (the buffer size is specified via option - #: :py:obj:`~.CU_JIT_ERROR_LOG_BUFFER_SIZE_BYTES`) - #: Option type: char * - #: Applies to: compiler and linker - CU_JIT_ERROR_LOG_BUFFER = ccuda.CUjit_option_enum.CU_JIT_ERROR_LOG_BUFFER{{endif}} - {{if 'CU_JIT_ERROR_LOG_BUFFER_SIZE_BYTES' in found_values}} - - #: IN: Log buffer size in bytes. Log messages will be capped at this - #: size (including null terminator) - #: OUT: Amount of log buffer filled with messages - #: Option type: unsigned int - #: Applies to: compiler and linker - CU_JIT_ERROR_LOG_BUFFER_SIZE_BYTES = ccuda.CUjit_option_enum.CU_JIT_ERROR_LOG_BUFFER_SIZE_BYTES{{endif}} - {{if 'CU_JIT_OPTIMIZATION_LEVEL' in found_values}} - - #: Level of optimizations to apply to generated code (0 - 4), with 4 - #: being the default and highest level of optimizations. - #: Option type: unsigned int - #: Applies to: compiler only - CU_JIT_OPTIMIZATION_LEVEL = ccuda.CUjit_option_enum.CU_JIT_OPTIMIZATION_LEVEL{{endif}} - {{if 'CU_JIT_TARGET_FROM_CUCONTEXT' in found_values}} - - #: No option value required. Determines the target based on the current - #: attached context (default) - #: Option type: No option value needed - #: Applies to: compiler and linker - CU_JIT_TARGET_FROM_CUCONTEXT = ccuda.CUjit_option_enum.CU_JIT_TARGET_FROM_CUCONTEXT{{endif}} - {{if 'CU_JIT_TARGET' in found_values}} - - #: Target is chosen based on supplied :py:obj:`~.CUjit_target`. Cannot - #: be combined with :py:obj:`~.CU_JIT_THREADS_PER_BLOCK`. - #: Option type: unsigned int for enumerated type - #: :py:obj:`~.CUjit_target` - #: Applies to: compiler and linker - CU_JIT_TARGET = ccuda.CUjit_option_enum.CU_JIT_TARGET{{endif}} - {{if 'CU_JIT_FALLBACK_STRATEGY' in found_values}} - - #: Specifies choice of fallback strategy if matching cubin is not - #: found. Choice is based on supplied :py:obj:`~.CUjit_fallback`. This - #: option cannot be used with cuLink* APIs as the linker requires exact - #: matches. - #: Option type: unsigned int for enumerated type - #: :py:obj:`~.CUjit_fallback` - #: Applies to: compiler only - CU_JIT_FALLBACK_STRATEGY = ccuda.CUjit_option_enum.CU_JIT_FALLBACK_STRATEGY{{endif}} - {{if 'CU_JIT_GENERATE_DEBUG_INFO' in found_values}} - - #: Specifies whether to create debug information in output (-g) (0: - #: false, default) - #: Option type: int - #: Applies to: compiler and linker - CU_JIT_GENERATE_DEBUG_INFO = ccuda.CUjit_option_enum.CU_JIT_GENERATE_DEBUG_INFO{{endif}} - {{if 'CU_JIT_LOG_VERBOSE' in found_values}} - - #: Generate verbose log messages (0: false, default) - #: Option type: int - #: Applies to: compiler and linker - CU_JIT_LOG_VERBOSE = ccuda.CUjit_option_enum.CU_JIT_LOG_VERBOSE{{endif}} - {{if 'CU_JIT_GENERATE_LINE_INFO' in found_values}} - - #: Generate line number information (-lineinfo) (0: false, default) - #: Option type: int - #: Applies to: compiler only - CU_JIT_GENERATE_LINE_INFO = ccuda.CUjit_option_enum.CU_JIT_GENERATE_LINE_INFO{{endif}} - {{if 'CU_JIT_CACHE_MODE' in found_values}} - - #: Specifies whether to enable caching explicitly (-dlcm) - #: Choice is based on supplied :py:obj:`~.CUjit_cacheMode_enum`. - #: Option type: unsigned int for enumerated type - #: :py:obj:`~.CUjit_cacheMode_enum` - #: Applies to: compiler only - CU_JIT_CACHE_MODE = ccuda.CUjit_option_enum.CU_JIT_CACHE_MODE{{endif}} - {{if 'CU_JIT_NEW_SM3X_OPT' in found_values}} - - #: [Deprecated] - CU_JIT_NEW_SM3X_OPT = ccuda.CUjit_option_enum.CU_JIT_NEW_SM3X_OPT{{endif}} - {{if 'CU_JIT_FAST_COMPILE' in found_values}} - - #: This jit option is used for internal purpose only. - CU_JIT_FAST_COMPILE = ccuda.CUjit_option_enum.CU_JIT_FAST_COMPILE{{endif}} - {{if 'CU_JIT_GLOBAL_SYMBOL_NAMES' in found_values}} - - #: Array of device symbol names that will be relocated to the - #: corresponding host addresses stored in - #: :py:obj:`~.CU_JIT_GLOBAL_SYMBOL_ADDRESSES`. - #: Must contain :py:obj:`~.CU_JIT_GLOBAL_SYMBOL_COUNT` entries. - #: When loading a device module, driver will relocate all encountered - #: unresolved symbols to the host addresses. - #: It is only allowed to register symbols that correspond to unresolved - #: global variables. - #: It is illegal to register the same device symbol at multiple - #: addresses. - #: Option type: const char ** - #: Applies to: dynamic linker only - CU_JIT_GLOBAL_SYMBOL_NAMES = ccuda.CUjit_option_enum.CU_JIT_GLOBAL_SYMBOL_NAMES{{endif}} - {{if 'CU_JIT_GLOBAL_SYMBOL_ADDRESSES' in found_values}} - - #: Array of host addresses that will be used to relocate corresponding - #: device symbols stored in :py:obj:`~.CU_JIT_GLOBAL_SYMBOL_NAMES`. - #: Must contain :py:obj:`~.CU_JIT_GLOBAL_SYMBOL_COUNT` entries. - #: Option type: void ** - #: Applies to: dynamic linker only - CU_JIT_GLOBAL_SYMBOL_ADDRESSES = ccuda.CUjit_option_enum.CU_JIT_GLOBAL_SYMBOL_ADDRESSES{{endif}} - {{if 'CU_JIT_GLOBAL_SYMBOL_COUNT' in found_values}} - - #: Number of entries in :py:obj:`~.CU_JIT_GLOBAL_SYMBOL_NAMES` and - #: :py:obj:`~.CU_JIT_GLOBAL_SYMBOL_ADDRESSES` arrays. - #: Option type: unsigned int - #: Applies to: dynamic linker only - CU_JIT_GLOBAL_SYMBOL_COUNT = ccuda.CUjit_option_enum.CU_JIT_GLOBAL_SYMBOL_COUNT{{endif}} - {{if 'CU_JIT_LTO' in found_values}} - - #: [Deprecated] - #: - #: Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0 - CU_JIT_LTO = ccuda.CUjit_option_enum.CU_JIT_LTO{{endif}} - {{if 'CU_JIT_FTZ' in found_values}} - - #: [Deprecated] - #: - #: Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0 - CU_JIT_FTZ = ccuda.CUjit_option_enum.CU_JIT_FTZ{{endif}} - {{if 'CU_JIT_PREC_DIV' in found_values}} - - #: [Deprecated] - #: - #: Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0 - CU_JIT_PREC_DIV = ccuda.CUjit_option_enum.CU_JIT_PREC_DIV{{endif}} - {{if 'CU_JIT_PREC_SQRT' in found_values}} - - #: [Deprecated] - #: - #: Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0 - CU_JIT_PREC_SQRT = ccuda.CUjit_option_enum.CU_JIT_PREC_SQRT{{endif}} - {{if 'CU_JIT_FMA' in found_values}} - - #: [Deprecated] - #: - #: Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0 - CU_JIT_FMA = ccuda.CUjit_option_enum.CU_JIT_FMA{{endif}} - {{if 'CU_JIT_REFERENCED_KERNEL_NAMES' in found_values}} - - #: [Deprecated] - #: - #: Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0 - CU_JIT_REFERENCED_KERNEL_NAMES = ccuda.CUjit_option_enum.CU_JIT_REFERENCED_KERNEL_NAMES{{endif}} - {{if 'CU_JIT_REFERENCED_KERNEL_COUNT' in found_values}} - - #: [Deprecated] - #: - #: Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0 - CU_JIT_REFERENCED_KERNEL_COUNT = ccuda.CUjit_option_enum.CU_JIT_REFERENCED_KERNEL_COUNT{{endif}} - {{if 'CU_JIT_REFERENCED_VARIABLE_NAMES' in found_values}} - - #: [Deprecated] - #: - #: Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0 - CU_JIT_REFERENCED_VARIABLE_NAMES = ccuda.CUjit_option_enum.CU_JIT_REFERENCED_VARIABLE_NAMES{{endif}} - {{if 'CU_JIT_REFERENCED_VARIABLE_COUNT' in found_values}} - - #: [Deprecated] - #: - #: Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0 - CU_JIT_REFERENCED_VARIABLE_COUNT = ccuda.CUjit_option_enum.CU_JIT_REFERENCED_VARIABLE_COUNT{{endif}} - {{if 'CU_JIT_OPTIMIZE_UNUSED_DEVICE_VARIABLES' in found_values}} - - #: [Deprecated] - #: - #: Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0 - CU_JIT_OPTIMIZE_UNUSED_DEVICE_VARIABLES = ccuda.CUjit_option_enum.CU_JIT_OPTIMIZE_UNUSED_DEVICE_VARIABLES{{endif}} - {{if 'CU_JIT_POSITION_INDEPENDENT_CODE' in found_values}} - - #: Generate position independent code (0: false) - #: Option type: int - #: Applies to: compiler only - CU_JIT_POSITION_INDEPENDENT_CODE = ccuda.CUjit_option_enum.CU_JIT_POSITION_INDEPENDENT_CODE{{endif}} - {{if 'CU_JIT_MIN_CTA_PER_SM' in found_values}} - - #: This option hints to the JIT compiler the minimum number of CTAs - #: from the kernel’s grid to be mapped to a SM. This option is ignored - #: when used together with :py:obj:`~.CU_JIT_MAX_REGISTERS` or - #: :py:obj:`~.CU_JIT_THREADS_PER_BLOCK`. Optimizations based on this - #: option need :py:obj:`~.CU_JIT_MAX_THREADS_PER_BLOCK` to be specified - #: as well. For kernels already using PTX directive .minnctapersm, this - #: option will be ignored by default. Use - #: :py:obj:`~.CU_JIT_OVERRIDE_DIRECTIVE_VALUES` to let this option take - #: precedence over the PTX directive. Option type: unsigned int - #: Applies to: compiler only - CU_JIT_MIN_CTA_PER_SM = ccuda.CUjit_option_enum.CU_JIT_MIN_CTA_PER_SM{{endif}} - {{if 'CU_JIT_MAX_THREADS_PER_BLOCK' in found_values}} - - #: Maximum number threads in a thread block, computed as the product of - #: the maximum extent specifed for each dimension of the block. This - #: limit is guaranteed not to be exeeded in any invocation of the - #: kernel. Exceeding the the maximum number of threads results in - #: runtime error or kernel launch failure. For kernels already using - #: PTX directive .maxntid, this option will be ignored by default. Use - #: :py:obj:`~.CU_JIT_OVERRIDE_DIRECTIVE_VALUES` to let this option take - #: precedence over the PTX directive. Option type: int - #: Applies to: compiler only - CU_JIT_MAX_THREADS_PER_BLOCK = ccuda.CUjit_option_enum.CU_JIT_MAX_THREADS_PER_BLOCK{{endif}} - {{if 'CU_JIT_OVERRIDE_DIRECTIVE_VALUES' in found_values}} - - #: This option lets the values specified using - #: :py:obj:`~.CU_JIT_MAX_REGISTERS`, - #: :py:obj:`~.CU_JIT_THREADS_PER_BLOCK`, - #: :py:obj:`~.CU_JIT_MAX_THREADS_PER_BLOCK` and - #: :py:obj:`~.CU_JIT_MIN_CTA_PER_SM` take precedence over any PTX - #: directives. (0: Disable, default; 1: Enable) Option type: int - #: Applies to: compiler only - CU_JIT_OVERRIDE_DIRECTIVE_VALUES = ccuda.CUjit_option_enum.CU_JIT_OVERRIDE_DIRECTIVE_VALUES{{endif}} - {{if 'CU_JIT_NUM_OPTIONS' in found_values}} - CU_JIT_NUM_OPTIONS = ccuda.CUjit_option_enum.CU_JIT_NUM_OPTIONS{{endif}} -{{endif}} -{{if 'CUjit_target_enum' in found_types}} - -class CUjit_target(IntEnum): - """ - Online compilation targets - """ - {{if 'CU_TARGET_COMPUTE_30' in found_values}} - #: Compute device class 3.0 - CU_TARGET_COMPUTE_30 = ccuda.CUjit_target_enum.CU_TARGET_COMPUTE_30{{endif}} - {{if 'CU_TARGET_COMPUTE_32' in found_values}} + CU_AD_FORMAT_YUY2 = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_YUY2, + '2 channel, 8-bit YUV packed planar format, with 4:2:2 sampling\n' + ) - #: Compute device class 3.2 - CU_TARGET_COMPUTE_32 = ccuda.CUjit_target_enum.CU_TARGET_COMPUTE_32{{endif}} - {{if 'CU_TARGET_COMPUTE_35' in found_values}} - #: Compute device class 3.5 - CU_TARGET_COMPUTE_35 = ccuda.CUjit_target_enum.CU_TARGET_COMPUTE_35{{endif}} - {{if 'CU_TARGET_COMPUTE_37' in found_values}} + CU_AD_FORMAT_Y210 = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_Y210, + '2 channel, 10-bit YUV packed planar format, with 4:2:2 sampling\n' + ) - #: Compute device class 3.7 - CU_TARGET_COMPUTE_37 = ccuda.CUjit_target_enum.CU_TARGET_COMPUTE_37{{endif}} - {{if 'CU_TARGET_COMPUTE_50' in found_values}} - #: Compute device class 5.0 - CU_TARGET_COMPUTE_50 = ccuda.CUjit_target_enum.CU_TARGET_COMPUTE_50{{endif}} - {{if 'CU_TARGET_COMPUTE_52' in found_values}} + CU_AD_FORMAT_Y216 = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_Y216, + '2 channel, 16-bit YUV packed planar format, with 4:2:2 sampling\n' + ) - #: Compute device class 5.2 - CU_TARGET_COMPUTE_52 = ccuda.CUjit_target_enum.CU_TARGET_COMPUTE_52{{endif}} - {{if 'CU_TARGET_COMPUTE_53' in found_values}} - #: Compute device class 5.3 - CU_TARGET_COMPUTE_53 = ccuda.CUjit_target_enum.CU_TARGET_COMPUTE_53{{endif}} - {{if 'CU_TARGET_COMPUTE_60' in found_values}} + CU_AD_FORMAT_AYUV = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_AYUV, + '4 channel, 8-bit YUV packed planar format, with 4:4:4 sampling\n' + ) - #: Compute device class 6.0. - CU_TARGET_COMPUTE_60 = ccuda.CUjit_target_enum.CU_TARGET_COMPUTE_60{{endif}} - {{if 'CU_TARGET_COMPUTE_61' in found_values}} - #: Compute device class 6.1. - CU_TARGET_COMPUTE_61 = ccuda.CUjit_target_enum.CU_TARGET_COMPUTE_61{{endif}} - {{if 'CU_TARGET_COMPUTE_62' in found_values}} + CU_AD_FORMAT_Y410 = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_Y410, + '10-bit YUV packed planar format, with 4:4:4 sampling\n' + ) - #: Compute device class 6.2. - CU_TARGET_COMPUTE_62 = ccuda.CUjit_target_enum.CU_TARGET_COMPUTE_62{{endif}} - {{if 'CU_TARGET_COMPUTE_70' in found_values}} - #: Compute device class 7.0. - CU_TARGET_COMPUTE_70 = ccuda.CUjit_target_enum.CU_TARGET_COMPUTE_70{{endif}} - {{if 'CU_TARGET_COMPUTE_72' in found_values}} + CU_AD_FORMAT_NV12 = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_NV12, + '8-bit YUV planar format, with 4:2:0 sampling\n' + ) - #: Compute device class 7.2. - CU_TARGET_COMPUTE_72 = ccuda.CUjit_target_enum.CU_TARGET_COMPUTE_72{{endif}} - {{if 'CU_TARGET_COMPUTE_75' in found_values}} - #: Compute device class 7.5. - CU_TARGET_COMPUTE_75 = ccuda.CUjit_target_enum.CU_TARGET_COMPUTE_75{{endif}} - {{if 'CU_TARGET_COMPUTE_80' in found_values}} + CU_AD_FORMAT_Y416 = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_Y416, + '4 channel, 12-bit YUV packed planar format, with 4:4:4 sampling\n' + ) - #: Compute device class 8.0. - CU_TARGET_COMPUTE_80 = ccuda.CUjit_target_enum.CU_TARGET_COMPUTE_80{{endif}} - {{if 'CU_TARGET_COMPUTE_86' in found_values}} - #: Compute device class 8.6. - CU_TARGET_COMPUTE_86 = ccuda.CUjit_target_enum.CU_TARGET_COMPUTE_86{{endif}} - {{if 'CU_TARGET_COMPUTE_87' in found_values}} + CU_AD_FORMAT_Y444_PLANAR8 = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_Y444_PLANAR8, + '3 channel 8-bit YUV planar format, with 4:4:4 sampling\n' + ) - #: Compute device class 8.7. - CU_TARGET_COMPUTE_87 = ccuda.CUjit_target_enum.CU_TARGET_COMPUTE_87{{endif}} - {{if 'CU_TARGET_COMPUTE_89' in found_values}} - #: Compute device class 8.9. - CU_TARGET_COMPUTE_89 = ccuda.CUjit_target_enum.CU_TARGET_COMPUTE_89{{endif}} - {{if 'CU_TARGET_COMPUTE_90' in found_values}} + CU_AD_FORMAT_Y444_PLANAR10 = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_Y444_PLANAR10, + '3 channel 10-bit YUV planar format, with 4:4:4 sampling\n' + ) - #: Compute device class 9.0. Compute device class 9.0. with accelerated - #: features. - CU_TARGET_COMPUTE_90 = ccuda.CUjit_target_enum.CU_TARGET_COMPUTE_90{{endif}} - {{if 'CU_TARGET_COMPUTE_90A' in found_values}} - CU_TARGET_COMPUTE_90A = ccuda.CUjit_target_enum.CU_TARGET_COMPUTE_90A{{endif}} -{{endif}} -{{if 'CUjit_fallback_enum' in found_types}} -class CUjit_fallback(IntEnum): - """ - Cubin matching fallback strategies - """ - {{if 'CU_PREFER_PTX' in found_values}} + CU_AD_FORMAT_YUV444_8bit_SemiPlanar = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_YUV444_8bit_SemiPlanar, + '3 channel 8-bit YUV semi-planar format, with 4:4:4 sampling\n' + ) - #: Prefer to compile ptx if exact binary match not found - CU_PREFER_PTX = ccuda.CUjit_fallback_enum.CU_PREFER_PTX{{endif}} - {{if 'CU_PREFER_BINARY' in found_values}} - #: Prefer to fall back to compatible binary code if exact match not - #: found - CU_PREFER_BINARY = ccuda.CUjit_fallback_enum.CU_PREFER_BINARY{{endif}} -{{endif}} -{{if 'CUjit_cacheMode_enum' in found_types}} + CU_AD_FORMAT_YUV444_16bit_SemiPlanar = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_YUV444_16bit_SemiPlanar, + '3 channel 16-bit YUV semi-planar format, with 4:4:4 sampling\n' + ) -class CUjit_cacheMode(IntEnum): - """ - Caching modes for dlcm - """ - {{if 'CU_JIT_CACHE_OPTION_NONE' in found_values}} - #: Compile with no -dlcm flag specified - CU_JIT_CACHE_OPTION_NONE = ccuda.CUjit_cacheMode_enum.CU_JIT_CACHE_OPTION_NONE{{endif}} - {{if 'CU_JIT_CACHE_OPTION_CG' in found_values}} + CU_AD_FORMAT_UNORM_INT8X1 = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_UNORM_INT8X1, + '1 channel unsigned 8-bit normalized integer\n' + ) - #: Compile with L1 cache disabled - CU_JIT_CACHE_OPTION_CG = ccuda.CUjit_cacheMode_enum.CU_JIT_CACHE_OPTION_CG{{endif}} - {{if 'CU_JIT_CACHE_OPTION_CA' in found_values}} - #: Compile with L1 cache enabled - CU_JIT_CACHE_OPTION_CA = ccuda.CUjit_cacheMode_enum.CU_JIT_CACHE_OPTION_CA{{endif}} -{{endif}} -{{if 'CUjitInputType_enum' in found_types}} + CU_AD_FORMAT_UNORM_INT8X2 = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_UNORM_INT8X2, + '2 channel unsigned 8-bit normalized integer\n' + ) -class CUjitInputType(IntEnum): - """ - Device code formats - """ - {{if 'CU_JIT_INPUT_CUBIN' in found_values}} - - #: Compiled device-class-specific device code - #: Applicable options: none - CU_JIT_INPUT_CUBIN = ccuda.CUjitInputType_enum.CU_JIT_INPUT_CUBIN{{endif}} - {{if 'CU_JIT_INPUT_PTX' in found_values}} - - #: PTX source code - #: Applicable options: PTX compiler options - CU_JIT_INPUT_PTX = ccuda.CUjitInputType_enum.CU_JIT_INPUT_PTX{{endif}} - {{if 'CU_JIT_INPUT_FATBINARY' in found_values}} - - #: Bundle of multiple cubins and/or PTX of some device code - #: Applicable options: PTX compiler options, - #: :py:obj:`~.CU_JIT_FALLBACK_STRATEGY` - CU_JIT_INPUT_FATBINARY = ccuda.CUjitInputType_enum.CU_JIT_INPUT_FATBINARY{{endif}} - {{if 'CU_JIT_INPUT_OBJECT' in found_values}} - - #: Host object with embedded device code - #: Applicable options: PTX compiler options, - #: :py:obj:`~.CU_JIT_FALLBACK_STRATEGY` - CU_JIT_INPUT_OBJECT = ccuda.CUjitInputType_enum.CU_JIT_INPUT_OBJECT{{endif}} - {{if 'CU_JIT_INPUT_LIBRARY' in found_values}} - - #: Archive of host objects with embedded device code - #: Applicable options: PTX compiler options, - #: :py:obj:`~.CU_JIT_FALLBACK_STRATEGY` - CU_JIT_INPUT_LIBRARY = ccuda.CUjitInputType_enum.CU_JIT_INPUT_LIBRARY{{endif}} - {{if 'CU_JIT_INPUT_NVVM' in found_values}} - - #: [Deprecated] - #: - #: Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0 - CU_JIT_INPUT_NVVM = ccuda.CUjitInputType_enum.CU_JIT_INPUT_NVVM{{endif}} - {{if 'CU_JIT_NUM_INPUT_TYPES' in found_values}} - CU_JIT_NUM_INPUT_TYPES = ccuda.CUjitInputType_enum.CU_JIT_NUM_INPUT_TYPES{{endif}} -{{endif}} -{{if 'CUgraphicsRegisterFlags_enum' in found_types}} - -class CUgraphicsRegisterFlags(IntEnum): - """ - Flags to register a graphics resource - """ - {{if 'CU_GRAPHICS_REGISTER_FLAGS_NONE' in found_values}} - CU_GRAPHICS_REGISTER_FLAGS_NONE = ccuda.CUgraphicsRegisterFlags_enum.CU_GRAPHICS_REGISTER_FLAGS_NONE{{endif}} - {{if 'CU_GRAPHICS_REGISTER_FLAGS_READ_ONLY' in found_values}} - CU_GRAPHICS_REGISTER_FLAGS_READ_ONLY = ccuda.CUgraphicsRegisterFlags_enum.CU_GRAPHICS_REGISTER_FLAGS_READ_ONLY{{endif}} - {{if 'CU_GRAPHICS_REGISTER_FLAGS_WRITE_DISCARD' in found_values}} - CU_GRAPHICS_REGISTER_FLAGS_WRITE_DISCARD = ccuda.CUgraphicsRegisterFlags_enum.CU_GRAPHICS_REGISTER_FLAGS_WRITE_DISCARD{{endif}} - {{if 'CU_GRAPHICS_REGISTER_FLAGS_SURFACE_LDST' in found_values}} - CU_GRAPHICS_REGISTER_FLAGS_SURFACE_LDST = ccuda.CUgraphicsRegisterFlags_enum.CU_GRAPHICS_REGISTER_FLAGS_SURFACE_LDST{{endif}} - {{if 'CU_GRAPHICS_REGISTER_FLAGS_TEXTURE_GATHER' in found_values}} - CU_GRAPHICS_REGISTER_FLAGS_TEXTURE_GATHER = ccuda.CUgraphicsRegisterFlags_enum.CU_GRAPHICS_REGISTER_FLAGS_TEXTURE_GATHER{{endif}} -{{endif}} -{{if 'CUgraphicsMapResourceFlags_enum' in found_types}} - -class CUgraphicsMapResourceFlags(IntEnum): - """ - Flags for mapping and unmapping interop resources - """ - {{if 'CU_GRAPHICS_MAP_RESOURCE_FLAGS_NONE' in found_values}} - CU_GRAPHICS_MAP_RESOURCE_FLAGS_NONE = ccuda.CUgraphicsMapResourceFlags_enum.CU_GRAPHICS_MAP_RESOURCE_FLAGS_NONE{{endif}} - {{if 'CU_GRAPHICS_MAP_RESOURCE_FLAGS_READ_ONLY' in found_values}} - CU_GRAPHICS_MAP_RESOURCE_FLAGS_READ_ONLY = ccuda.CUgraphicsMapResourceFlags_enum.CU_GRAPHICS_MAP_RESOURCE_FLAGS_READ_ONLY{{endif}} - {{if 'CU_GRAPHICS_MAP_RESOURCE_FLAGS_WRITE_DISCARD' in found_values}} - CU_GRAPHICS_MAP_RESOURCE_FLAGS_WRITE_DISCARD = ccuda.CUgraphicsMapResourceFlags_enum.CU_GRAPHICS_MAP_RESOURCE_FLAGS_WRITE_DISCARD{{endif}} -{{endif}} -{{if 'CUarray_cubemap_face_enum' in found_types}} -class CUarray_cubemap_face(IntEnum): - """ - Array indices for cube faces - """ - {{if 'CU_CUBEMAP_FACE_POSITIVE_X' in found_values}} + CU_AD_FORMAT_UNORM_INT8X4 = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_UNORM_INT8X4, + '4 channel unsigned 8-bit normalized integer\n' + ) - #: Positive X face of cubemap - CU_CUBEMAP_FACE_POSITIVE_X = ccuda.CUarray_cubemap_face_enum.CU_CUBEMAP_FACE_POSITIVE_X{{endif}} - {{if 'CU_CUBEMAP_FACE_NEGATIVE_X' in found_values}} - #: Negative X face of cubemap - CU_CUBEMAP_FACE_NEGATIVE_X = ccuda.CUarray_cubemap_face_enum.CU_CUBEMAP_FACE_NEGATIVE_X{{endif}} - {{if 'CU_CUBEMAP_FACE_POSITIVE_Y' in found_values}} + CU_AD_FORMAT_UNORM_INT16X1 = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_UNORM_INT16X1, + '1 channel unsigned 16-bit normalized integer\n' + ) - #: Positive Y face of cubemap - CU_CUBEMAP_FACE_POSITIVE_Y = ccuda.CUarray_cubemap_face_enum.CU_CUBEMAP_FACE_POSITIVE_Y{{endif}} - {{if 'CU_CUBEMAP_FACE_NEGATIVE_Y' in found_values}} - #: Negative Y face of cubemap - CU_CUBEMAP_FACE_NEGATIVE_Y = ccuda.CUarray_cubemap_face_enum.CU_CUBEMAP_FACE_NEGATIVE_Y{{endif}} - {{if 'CU_CUBEMAP_FACE_POSITIVE_Z' in found_values}} + CU_AD_FORMAT_UNORM_INT16X2 = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_UNORM_INT16X2, + '2 channel unsigned 16-bit normalized integer\n' + ) - #: Positive Z face of cubemap - CU_CUBEMAP_FACE_POSITIVE_Z = ccuda.CUarray_cubemap_face_enum.CU_CUBEMAP_FACE_POSITIVE_Z{{endif}} - {{if 'CU_CUBEMAP_FACE_NEGATIVE_Z' in found_values}} - #: Negative Z face of cubemap - CU_CUBEMAP_FACE_NEGATIVE_Z = ccuda.CUarray_cubemap_face_enum.CU_CUBEMAP_FACE_NEGATIVE_Z{{endif}} -{{endif}} -{{if 'CUlimit_enum' in found_types}} + CU_AD_FORMAT_UNORM_INT16X4 = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_UNORM_INT16X4, + '4 channel unsigned 16-bit normalized integer\n' + ) + + + CU_AD_FORMAT_SNORM_INT8X1 = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_SNORM_INT8X1, + '1 channel signed 8-bit normalized integer\n' + ) -class CUlimit(IntEnum): - """ - Limits - """ - {{if 'CU_LIMIT_STACK_SIZE' in found_values}} - #: GPU thread stack size - CU_LIMIT_STACK_SIZE = ccuda.CUlimit_enum.CU_LIMIT_STACK_SIZE{{endif}} - {{if 'CU_LIMIT_PRINTF_FIFO_SIZE' in found_values}} + CU_AD_FORMAT_SNORM_INT8X2 = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_SNORM_INT8X2, + '2 channel signed 8-bit normalized integer\n' + ) - #: GPU printf FIFO size - CU_LIMIT_PRINTF_FIFO_SIZE = ccuda.CUlimit_enum.CU_LIMIT_PRINTF_FIFO_SIZE{{endif}} - {{if 'CU_LIMIT_MALLOC_HEAP_SIZE' in found_values}} - #: GPU malloc heap size - CU_LIMIT_MALLOC_HEAP_SIZE = ccuda.CUlimit_enum.CU_LIMIT_MALLOC_HEAP_SIZE{{endif}} - {{if 'CU_LIMIT_DEV_RUNTIME_SYNC_DEPTH' in found_values}} + CU_AD_FORMAT_SNORM_INT8X4 = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_SNORM_INT8X4, + '4 channel signed 8-bit normalized integer\n' + ) - #: GPU device runtime launch synchronize depth - CU_LIMIT_DEV_RUNTIME_SYNC_DEPTH = ccuda.CUlimit_enum.CU_LIMIT_DEV_RUNTIME_SYNC_DEPTH{{endif}} - {{if 'CU_LIMIT_DEV_RUNTIME_PENDING_LAUNCH_COUNT' in found_values}} - #: GPU device runtime pending launch count - CU_LIMIT_DEV_RUNTIME_PENDING_LAUNCH_COUNT = ccuda.CUlimit_enum.CU_LIMIT_DEV_RUNTIME_PENDING_LAUNCH_COUNT{{endif}} - {{if 'CU_LIMIT_MAX_L2_FETCH_GRANULARITY' in found_values}} + CU_AD_FORMAT_SNORM_INT16X1 = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_SNORM_INT16X1, + '1 channel signed 16-bit normalized integer\n' + ) - #: A value between 0 and 128 that indicates the maximum fetch - #: granularity of L2 (in Bytes). This is a hint - CU_LIMIT_MAX_L2_FETCH_GRANULARITY = ccuda.CUlimit_enum.CU_LIMIT_MAX_L2_FETCH_GRANULARITY{{endif}} - {{if 'CU_LIMIT_PERSISTING_L2_CACHE_SIZE' in found_values}} - #: A size in bytes for L2 persisting lines cache size - CU_LIMIT_PERSISTING_L2_CACHE_SIZE = ccuda.CUlimit_enum.CU_LIMIT_PERSISTING_L2_CACHE_SIZE{{endif}} - {{if 'CU_LIMIT_SHMEM_SIZE' in found_values}} + CU_AD_FORMAT_SNORM_INT16X2 = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_SNORM_INT16X2, + '2 channel signed 16-bit normalized integer\n' + ) - #: A maximum size in bytes of shared memory available to CUDA kernels - #: on a CIG context. Can only be queried, cannot be set - CU_LIMIT_SHMEM_SIZE = ccuda.CUlimit_enum.CU_LIMIT_SHMEM_SIZE{{endif}} - {{if 'CU_LIMIT_CIG_ENABLED' in found_values}} - #: A non-zero value indicates this CUDA context is a CIG-enabled - #: context. Can only be queried, cannot be set - CU_LIMIT_CIG_ENABLED = ccuda.CUlimit_enum.CU_LIMIT_CIG_ENABLED{{endif}} - {{if 'CU_LIMIT_CIG_SHMEM_FALLBACK_ENABLED' in found_values}} + CU_AD_FORMAT_SNORM_INT16X4 = ( + cydriver.CUarray_format_enum.CU_AD_FORMAT_SNORM_INT16X4, + '4 channel signed 16-bit normalized integer\n' + ) - #: When set to a non-zero value, CUDA will fail to launch a kernel on a - #: CIG context, instead of using the fallback path, if the kernel uses - #: more shared memory than available - CU_LIMIT_CIG_SHMEM_FALLBACK_ENABLED = ccuda.CUlimit_enum.CU_LIMIT_CIG_SHMEM_FALLBACK_ENABLED{{endif}} - {{if 'CU_LIMIT_MAX' in found_values}} - CU_LIMIT_MAX = ccuda.CUlimit_enum.CU_LIMIT_MAX{{endif}} -{{endif}} -{{if 'CUresourcetype_enum' in found_types}} + CU_AD_FORMAT_MAX = cydriver.CUarray_format_enum.CU_AD_FORMAT_MAX -class CUresourcetype(IntEnum): +class CUaddress_mode(_FastEnum): """ - Resource types + Texture reference addressing modes """ - {{if 'CU_RESOURCE_TYPE_ARRAY' in found_values}} - #: Array resource - CU_RESOURCE_TYPE_ARRAY = ccuda.CUresourcetype_enum.CU_RESOURCE_TYPE_ARRAY{{endif}} - {{if 'CU_RESOURCE_TYPE_MIPMAPPED_ARRAY' in found_values}} - #: Mipmapped array resource - CU_RESOURCE_TYPE_MIPMAPPED_ARRAY = ccuda.CUresourcetype_enum.CU_RESOURCE_TYPE_MIPMAPPED_ARRAY{{endif}} - {{if 'CU_RESOURCE_TYPE_LINEAR' in found_values}} + CU_TR_ADDRESS_MODE_WRAP = ( + cydriver.CUaddress_mode_enum.CU_TR_ADDRESS_MODE_WRAP, + 'Wrapping address mode\n' + ) - #: Linear resource - CU_RESOURCE_TYPE_LINEAR = ccuda.CUresourcetype_enum.CU_RESOURCE_TYPE_LINEAR{{endif}} - {{if 'CU_RESOURCE_TYPE_PITCH2D' in found_values}} - #: Pitch 2D resource - CU_RESOURCE_TYPE_PITCH2D = ccuda.CUresourcetype_enum.CU_RESOURCE_TYPE_PITCH2D{{endif}} -{{endif}} -{{if 'CUaccessProperty_enum' in found_types}} + CU_TR_ADDRESS_MODE_CLAMP = ( + cydriver.CUaddress_mode_enum.CU_TR_ADDRESS_MODE_CLAMP, + 'Clamp to edge address mode\n' + ) -class CUaccessProperty(IntEnum): - """ - Specifies performance hint with :py:obj:`~.CUaccessPolicyWindow` - for hitProp and missProp members. - """ - {{if 'CU_ACCESS_PROPERTY_NORMAL' in found_values}} - #: Normal cache persistence. - CU_ACCESS_PROPERTY_NORMAL = ccuda.CUaccessProperty_enum.CU_ACCESS_PROPERTY_NORMAL{{endif}} - {{if 'CU_ACCESS_PROPERTY_STREAMING' in found_values}} + CU_TR_ADDRESS_MODE_MIRROR = ( + cydriver.CUaddress_mode_enum.CU_TR_ADDRESS_MODE_MIRROR, + 'Mirror address mode\n' + ) - #: Streaming access is less likely to persit from cache. - CU_ACCESS_PROPERTY_STREAMING = ccuda.CUaccessProperty_enum.CU_ACCESS_PROPERTY_STREAMING{{endif}} - {{if 'CU_ACCESS_PROPERTY_PERSISTING' in found_values}} - #: Persisting access is more likely to persist in cache. - CU_ACCESS_PROPERTY_PERSISTING = ccuda.CUaccessProperty_enum.CU_ACCESS_PROPERTY_PERSISTING{{endif}} -{{endif}} -{{if 'CUgraphConditionalNodeType_enum' in found_types}} + CU_TR_ADDRESS_MODE_BORDER = ( + cydriver.CUaddress_mode_enum.CU_TR_ADDRESS_MODE_BORDER, + 'Border address mode\n' + ) -class CUgraphConditionalNodeType(IntEnum): +class CUfilter_mode(_FastEnum): """ - Conditional node types + Texture reference filtering modes """ - {{if 'CU_GRAPH_COND_TYPE_IF' in found_values}} - #: Conditional 'if' Node. Body executed once if condition value is non- - #: zero. - CU_GRAPH_COND_TYPE_IF = ccuda.CUgraphConditionalNodeType_enum.CU_GRAPH_COND_TYPE_IF{{endif}} - {{if 'CU_GRAPH_COND_TYPE_WHILE' in found_values}} - #: Conditional 'while' Node. Body executed repeatedly while condition - #: value is non-zero. - CU_GRAPH_COND_TYPE_WHILE = ccuda.CUgraphConditionalNodeType_enum.CU_GRAPH_COND_TYPE_WHILE{{endif}} -{{endif}} -{{if 'CUgraphNodeType_enum' in found_types}} - -class CUgraphNodeType(IntEnum): - """ - Graph node types - """ - {{if 'CU_GRAPH_NODE_TYPE_KERNEL' in found_values}} - - #: GPU kernel node - CU_GRAPH_NODE_TYPE_KERNEL = ccuda.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_KERNEL{{endif}} - {{if 'CU_GRAPH_NODE_TYPE_MEMCPY' in found_values}} - - #: Memcpy node - CU_GRAPH_NODE_TYPE_MEMCPY = ccuda.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_MEMCPY{{endif}} - {{if 'CU_GRAPH_NODE_TYPE_MEMSET' in found_values}} - - #: Memset node - CU_GRAPH_NODE_TYPE_MEMSET = ccuda.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_MEMSET{{endif}} - {{if 'CU_GRAPH_NODE_TYPE_HOST' in found_values}} - - #: Host (executable) node - CU_GRAPH_NODE_TYPE_HOST = ccuda.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_HOST{{endif}} - {{if 'CU_GRAPH_NODE_TYPE_GRAPH' in found_values}} - - #: Node which executes an embedded graph - CU_GRAPH_NODE_TYPE_GRAPH = ccuda.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_GRAPH{{endif}} - {{if 'CU_GRAPH_NODE_TYPE_EMPTY' in found_values}} - - #: Empty (no-op) node - CU_GRAPH_NODE_TYPE_EMPTY = ccuda.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_EMPTY{{endif}} - {{if 'CU_GRAPH_NODE_TYPE_WAIT_EVENT' in found_values}} - - #: External event wait node - CU_GRAPH_NODE_TYPE_WAIT_EVENT = ccuda.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_WAIT_EVENT{{endif}} - {{if 'CU_GRAPH_NODE_TYPE_EVENT_RECORD' in found_values}} - - #: External event record node - CU_GRAPH_NODE_TYPE_EVENT_RECORD = ccuda.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_EVENT_RECORD{{endif}} - {{if 'CU_GRAPH_NODE_TYPE_EXT_SEMAS_SIGNAL' in found_values}} - - #: External semaphore signal node - CU_GRAPH_NODE_TYPE_EXT_SEMAS_SIGNAL = ccuda.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_EXT_SEMAS_SIGNAL{{endif}} - {{if 'CU_GRAPH_NODE_TYPE_EXT_SEMAS_WAIT' in found_values}} - - #: External semaphore wait node - CU_GRAPH_NODE_TYPE_EXT_SEMAS_WAIT = ccuda.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_EXT_SEMAS_WAIT{{endif}} - {{if 'CU_GRAPH_NODE_TYPE_MEM_ALLOC' in found_values}} - - #: Memory Allocation Node - CU_GRAPH_NODE_TYPE_MEM_ALLOC = ccuda.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_MEM_ALLOC{{endif}} - {{if 'CU_GRAPH_NODE_TYPE_MEM_FREE' in found_values}} - - #: Memory Free Node - CU_GRAPH_NODE_TYPE_MEM_FREE = ccuda.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_MEM_FREE{{endif}} - {{if 'CU_GRAPH_NODE_TYPE_BATCH_MEM_OP' in found_values}} - - #: Batch MemOp Node - CU_GRAPH_NODE_TYPE_BATCH_MEM_OP = ccuda.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_BATCH_MEM_OP{{endif}} - {{if 'CU_GRAPH_NODE_TYPE_CONDITIONAL' in found_values}} - - #: Conditional Node May be used - #: to implement a conditional execution path or loop - #: inside of a graph. The - #: graph(s) contained within the body of the conditional node - #: can be selectively executed - #: or iterated upon based on the value of a conditional - #: variable. - #: - #: Handles must be created in - #: advance of creating the node - #: using - #: :py:obj:`~.cuGraphConditionalHandleCreate`. - #: - #: The following restrictions - #: apply to graphs which contain conditional nodes: - #: The graph cannot be used in - #: a child node. - #: Only one instantiation of - #: the graph may exist at any point in time. - #: The graph cannot be cloned. - #: - #: To set the control value, - #: supply a default value when creating the handle and/or - #: call - #: :py:obj:`~.cudaGraphSetConditional` from device code. - CU_GRAPH_NODE_TYPE_CONDITIONAL = ccuda.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_CONDITIONAL{{endif}} -{{endif}} -{{if 'CUgraphDependencyType_enum' in found_types}} - -class CUgraphDependencyType(IntEnum): - """ - Type annotations that can be applied to graph edges as part of - :py:obj:`~.CUgraphEdgeData`. - """ - {{if 'CU_GRAPH_DEPENDENCY_TYPE_DEFAULT' in found_values}} + CU_TR_FILTER_MODE_POINT = ( + cydriver.CUfilter_mode_enum.CU_TR_FILTER_MODE_POINT, + 'Point filter mode\n' + ) - #: This is an ordinary dependency. - CU_GRAPH_DEPENDENCY_TYPE_DEFAULT = ccuda.CUgraphDependencyType_enum.CU_GRAPH_DEPENDENCY_TYPE_DEFAULT{{endif}} - {{if 'CU_GRAPH_DEPENDENCY_TYPE_PROGRAMMATIC' in found_values}} - #: This dependency type allows the downstream node to use - #: `cudaGridDependencySynchronize()`. It may only be used between - #: kernel nodes, and must be used with either the - #: :py:obj:`~.CU_GRAPH_KERNEL_NODE_PORT_PROGRAMMATIC` or - #: :py:obj:`~.CU_GRAPH_KERNEL_NODE_PORT_LAUNCH_ORDER` outgoing port. - CU_GRAPH_DEPENDENCY_TYPE_PROGRAMMATIC = ccuda.CUgraphDependencyType_enum.CU_GRAPH_DEPENDENCY_TYPE_PROGRAMMATIC{{endif}} -{{endif}} -{{if 'CUgraphInstantiateResult_enum' in found_types}} + CU_TR_FILTER_MODE_LINEAR = ( + cydriver.CUfilter_mode_enum.CU_TR_FILTER_MODE_LINEAR, + 'Linear filter mode\n' + ) -class CUgraphInstantiateResult(IntEnum): +class CUdevice_attribute(_FastEnum): """ - Graph instantiation results + Device properties """ - {{if 'CUDA_GRAPH_INSTANTIATE_SUCCESS' in found_values}} - #: Instantiation succeeded - CUDA_GRAPH_INSTANTIATE_SUCCESS = ccuda.CUgraphInstantiateResult_enum.CUDA_GRAPH_INSTANTIATE_SUCCESS{{endif}} - {{if 'CUDA_GRAPH_INSTANTIATE_ERROR' in found_values}} - #: Instantiation failed for an unexpected reason which is described in - #: the return value of the function - CUDA_GRAPH_INSTANTIATE_ERROR = ccuda.CUgraphInstantiateResult_enum.CUDA_GRAPH_INSTANTIATE_ERROR{{endif}} - {{if 'CUDA_GRAPH_INSTANTIATE_INVALID_STRUCTURE' in found_values}} + CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_BLOCK = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_BLOCK, + 'Maximum number of threads per block\n' + ) - #: Instantiation failed due to invalid structure, such as cycles - CUDA_GRAPH_INSTANTIATE_INVALID_STRUCTURE = ccuda.CUgraphInstantiateResult_enum.CUDA_GRAPH_INSTANTIATE_INVALID_STRUCTURE{{endif}} - {{if 'CUDA_GRAPH_INSTANTIATE_NODE_OPERATION_NOT_SUPPORTED' in found_values}} - #: Instantiation for device launch failed because the graph contained - #: an unsupported operation - CUDA_GRAPH_INSTANTIATE_NODE_OPERATION_NOT_SUPPORTED = ccuda.CUgraphInstantiateResult_enum.CUDA_GRAPH_INSTANTIATE_NODE_OPERATION_NOT_SUPPORTED{{endif}} - {{if 'CUDA_GRAPH_INSTANTIATE_MULTIPLE_CTXS_NOT_SUPPORTED' in found_values}} + CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_X = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_X, + 'Maximum block dimension X\n' + ) - #: Instantiation for device launch failed due to the nodes belonging to - #: different contexts - CUDA_GRAPH_INSTANTIATE_MULTIPLE_CTXS_NOT_SUPPORTED = ccuda.CUgraphInstantiateResult_enum.CUDA_GRAPH_INSTANTIATE_MULTIPLE_CTXS_NOT_SUPPORTED{{endif}} -{{endif}} -{{if 'CUsynchronizationPolicy_enum' in found_types}} -class CUsynchronizationPolicy(IntEnum): - """ + CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Y = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Y, + 'Maximum block dimension Y\n' + ) - """ - {{if 'CU_SYNC_POLICY_AUTO' in found_values}} - CU_SYNC_POLICY_AUTO = ccuda.CUsynchronizationPolicy_enum.CU_SYNC_POLICY_AUTO{{endif}} - {{if 'CU_SYNC_POLICY_SPIN' in found_values}} - CU_SYNC_POLICY_SPIN = ccuda.CUsynchronizationPolicy_enum.CU_SYNC_POLICY_SPIN{{endif}} - {{if 'CU_SYNC_POLICY_YIELD' in found_values}} - CU_SYNC_POLICY_YIELD = ccuda.CUsynchronizationPolicy_enum.CU_SYNC_POLICY_YIELD{{endif}} - {{if 'CU_SYNC_POLICY_BLOCKING_SYNC' in found_values}} - CU_SYNC_POLICY_BLOCKING_SYNC = ccuda.CUsynchronizationPolicy_enum.CU_SYNC_POLICY_BLOCKING_SYNC{{endif}} -{{endif}} -{{if 'CUclusterSchedulingPolicy_enum' in found_types}} -class CUclusterSchedulingPolicy(IntEnum): - """ - Cluster scheduling policies. These may be passed to - :py:obj:`~.cuFuncSetAttribute` or :py:obj:`~.cuKernelSetAttribute` - """ - {{if 'CU_CLUSTER_SCHEDULING_POLICY_DEFAULT' in found_values}} + CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Z = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Z, + 'Maximum block dimension Z\n' + ) - #: the default policy - CU_CLUSTER_SCHEDULING_POLICY_DEFAULT = ccuda.CUclusterSchedulingPolicy_enum.CU_CLUSTER_SCHEDULING_POLICY_DEFAULT{{endif}} - {{if 'CU_CLUSTER_SCHEDULING_POLICY_SPREAD' in found_values}} - #: spread the blocks within a cluster to the SMs - CU_CLUSTER_SCHEDULING_POLICY_SPREAD = ccuda.CUclusterSchedulingPolicy_enum.CU_CLUSTER_SCHEDULING_POLICY_SPREAD{{endif}} - {{if 'CU_CLUSTER_SCHEDULING_POLICY_LOAD_BALANCING' in found_values}} + CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_X = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_X, + 'Maximum grid dimension X\n' + ) - #: allow the hardware to load-balance the blocks in a cluster to the - #: SMs - CU_CLUSTER_SCHEDULING_POLICY_LOAD_BALANCING = ccuda.CUclusterSchedulingPolicy_enum.CU_CLUSTER_SCHEDULING_POLICY_LOAD_BALANCING{{endif}} -{{endif}} -{{if 'CUlaunchMemSyncDomain_enum' in found_types}} -class CUlaunchMemSyncDomain(IntEnum): - """ - Memory Synchronization Domain A kernel can be launched in a - specified memory synchronization domain that affects all memory - operations issued by that kernel. A memory barrier issued in one - domain will only order memory operations in that domain, thus - eliminating latency increase from memory barriers ordering - unrelated traffic. By default, kernels are launched in domain 0. - Kernel launched with :py:obj:`~.CU_LAUNCH_MEM_SYNC_DOMAIN_REMOTE` - will have a different domain ID. User may also alter the domain ID - with :py:obj:`~.CUlaunchMemSyncDomainMap` for a specific stream / - graph node / kernel launch. See - :py:obj:`~.CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN`, - :py:obj:`~.cuStreamSetAttribute`, :py:obj:`~.cuLaunchKernelEx`, - :py:obj:`~.cuGraphKernelNodeSetAttribute`. Memory operations done - in kernels launched in different domains are considered system- - scope distanced. In other words, a GPU scoped memory - synchronization is not sufficient for memory order to be observed - by kernels in another memory synchronization domain even if they - are on the same GPU. - """ - {{if 'CU_LAUNCH_MEM_SYNC_DOMAIN_DEFAULT' in found_values}} + CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Y = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Y, + 'Maximum grid dimension Y\n' + ) - #: Launch kernels in the default domain - CU_LAUNCH_MEM_SYNC_DOMAIN_DEFAULT = ccuda.CUlaunchMemSyncDomain_enum.CU_LAUNCH_MEM_SYNC_DOMAIN_DEFAULT{{endif}} - {{if 'CU_LAUNCH_MEM_SYNC_DOMAIN_REMOTE' in found_values}} - #: Launch kernels in the remote domain - CU_LAUNCH_MEM_SYNC_DOMAIN_REMOTE = ccuda.CUlaunchMemSyncDomain_enum.CU_LAUNCH_MEM_SYNC_DOMAIN_REMOTE{{endif}} -{{endif}} -{{if 'CUlaunchAttributeID_enum' in found_types}} + CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Z = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Z, + 'Maximum grid dimension Z\n' + ) -class CUlaunchAttributeID(IntEnum): - """ - Launch attributes enum; used as id field of - :py:obj:`~.CUlaunchAttribute` - """ - {{if 'CU_LAUNCH_ATTRIBUTE_IGNORE' in found_values}} - - #: Ignored entry, for convenient composition - CU_LAUNCH_ATTRIBUTE_IGNORE = ccuda.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_IGNORE{{endif}} - {{if 'CU_LAUNCH_ATTRIBUTE_ACCESS_POLICY_WINDOW' in found_values}} - - #: Valid for streams, graph nodes, launches. See - #: :py:obj:`~.CUlaunchAttributeValue.accessPolicyWindow`. - CU_LAUNCH_ATTRIBUTE_ACCESS_POLICY_WINDOW = ccuda.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_ACCESS_POLICY_WINDOW{{endif}} - {{if 'CU_LAUNCH_ATTRIBUTE_COOPERATIVE' in found_values}} - - #: Valid for graph nodes, launches. See - #: :py:obj:`~.CUlaunchAttributeValue.cooperative`. - CU_LAUNCH_ATTRIBUTE_COOPERATIVE = ccuda.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_COOPERATIVE{{endif}} - {{if 'CU_LAUNCH_ATTRIBUTE_SYNCHRONIZATION_POLICY' in found_values}} - - #: Valid for streams. See - #: :py:obj:`~.CUlaunchAttributeValue.syncPolicy`. - CU_LAUNCH_ATTRIBUTE_SYNCHRONIZATION_POLICY = ccuda.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_SYNCHRONIZATION_POLICY{{endif}} - {{if 'CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION' in found_values}} - - #: Valid for graph nodes, launches. See - #: :py:obj:`~.CUlaunchAttributeValue.clusterDim`. - CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION = ccuda.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION{{endif}} - {{if 'CU_LAUNCH_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE' in found_values}} - - #: Valid for graph nodes, launches. See - #: :py:obj:`~.CUlaunchAttributeValue.clusterSchedulingPolicyPreference`. - CU_LAUNCH_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE = ccuda.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE{{endif}} - {{if 'CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_STREAM_SERIALIZATION' in found_values}} - - #: Valid for launches. Setting - #: :py:obj:`~.CUlaunchAttributeValue.programmaticStreamSerializationAllowed` - #: to non-0 signals that the kernel will use programmatic means to - #: resolve its stream dependency, so that the CUDA runtime should - #: opportunistically allow the grid's execution to overlap with the - #: previous kernel in the stream, if that kernel requests the overlap. - #: The dependent launches can choose to wait on the dependency using - #: the programmatic sync (cudaGridDependencySynchronize() or equivalent - #: PTX instructions). - CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_STREAM_SERIALIZATION = ccuda.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_STREAM_SERIALIZATION{{endif}} - {{if 'CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_EVENT' in found_values}} - - #: Valid for launches. Set - #: :py:obj:`~.CUlaunchAttributeValue.programmaticEvent` to record the - #: event. Event recorded through this launch attribute is guaranteed to - #: only trigger after all block in the associated kernel trigger the - #: event. A block can trigger the event through PTX launchdep.release - #: or CUDA builtin function cudaTriggerProgrammaticLaunchCompletion(). - #: A trigger can also be inserted at the beginning of each block's - #: execution if triggerAtBlockStart is set to non-0. The dependent - #: launches can choose to wait on the dependency using the programmatic - #: sync (cudaGridDependencySynchronize() or equivalent PTX - #: instructions). Note that dependents (including the CPU thread - #: calling :py:obj:`~.cuEventSynchronize()`) are not guaranteed to - #: observe the release precisely when it is released. For example, - #: :py:obj:`~.cuEventSynchronize()` may only observe the event trigger - #: long after the associated kernel has completed. This recording type - #: is primarily meant for establishing programmatic dependency between - #: device tasks. Note also this type of dependency allows, but does not - #: guarantee, concurrent execution of tasks. - #: The event supplied must not be an interprocess or interop event. - #: The event must disable timing (i.e. must be created with the - #: :py:obj:`~.CU_EVENT_DISABLE_TIMING` flag set). - CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_EVENT = ccuda.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_EVENT{{endif}} - {{if 'CU_LAUNCH_ATTRIBUTE_PRIORITY' in found_values}} - - #: Valid for streams, graph nodes, launches. See - #: :py:obj:`~.CUlaunchAttributeValue.priority`. - CU_LAUNCH_ATTRIBUTE_PRIORITY = ccuda.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_PRIORITY{{endif}} - {{if 'CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP' in found_values}} - - #: Valid for streams, graph nodes, launches. See - #: :py:obj:`~.CUlaunchAttributeValue.memSyncDomainMap`. - CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP = ccuda.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP{{endif}} - {{if 'CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN' in found_values}} - - #: Valid for streams, graph nodes, launches. See - #: :py:obj:`~.CUlaunchAttributeValue.memSyncDomain`. - CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN = ccuda.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN{{endif}} - {{if 'CU_LAUNCH_ATTRIBUTE_LAUNCH_COMPLETION_EVENT' in found_values}} - - #: Valid for launches. Set - #: :py:obj:`~.CUlaunchAttributeValue.launchCompletionEvent` to record - #: the event. - #: Nominally, the event is triggered once all blocks of the kernel - #: have begun execution. Currently this is a best effort. If a kernel B - #: has a launch completion dependency on a kernel A, B may wait until A - #: is complete. Alternatively, blocks of B may begin before all blocks - #: of A have begun, for example if B can claim execution resources - #: unavailable to A (e.g. they run on different GPUs) or if B is a - #: higher priority than A. Exercise caution if such an ordering - #: inversion could lead to deadlock. - #: A launch completion event is nominally similar to a programmatic - #: event with `triggerAtBlockStart` set except that it is not visible - #: to `cudaGridDependencySynchronize()` and can be used with compute - #: capability less than 9.0. - #: The event supplied must not be an interprocess or interop event. - #: The event must disable timing (i.e. must be created with the - #: :py:obj:`~.CU_EVENT_DISABLE_TIMING` flag set). - CU_LAUNCH_ATTRIBUTE_LAUNCH_COMPLETION_EVENT = ccuda.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_LAUNCH_COMPLETION_EVENT{{endif}} - {{if 'CU_LAUNCH_ATTRIBUTE_DEVICE_UPDATABLE_KERNEL_NODE' in found_values}} - - #: Valid for graph nodes, launches. This attribute is graphs-only, and - #: passing it to a launch in a non-capturing stream will result in an - #: error. - #: :py:obj:`~.CUlaunchAttributeValue`::deviceUpdatableKernelNode::deviceUpdatable - #: can only be set to 0 or 1. Setting the field to 1 indicates that the - #: corresponding kernel node should be device-updatable. On success, a - #: handle will be returned via - #: :py:obj:`~.CUlaunchAttributeValue`::deviceUpdatableKernelNode::devNode - #: which can be passed to the various device-side update functions to - #: update the node's kernel parameters from within another kernel. For - #: more information on the types of device updates that can be made, as - #: well as the relevant limitations thereof, see - #: :py:obj:`~.cudaGraphKernelNodeUpdatesApply`. - #: Nodes which are device-updatable have additional restrictions - #: compared to regular kernel nodes. Firstly, device-updatable nodes - #: cannot be removed from their graph via - #: :py:obj:`~.cuGraphDestroyNode`. Additionally, once opted-in to this - #: functionality, a node cannot opt out, and any attempt to set the - #: deviceUpdatable attribute to 0 will result in an error. Device- - #: updatable kernel nodes also cannot have their attributes copied - #: to/from another kernel node via - #: :py:obj:`~.cuGraphKernelNodeCopyAttributes`. Graphs containing one - #: or more device-updatable nodes also do not allow multiple - #: instantiation, and neither the graph nor its instantiated version - #: can be passed to :py:obj:`~.cuGraphExecUpdate`. - #: If a graph contains device-updatable nodes and updates those nodes - #: from the device from within the graph, the graph must be uploaded - #: with :py:obj:`~.cuGraphUpload` before it is launched. For such a - #: graph, if host-side executable graph updates are made to the device- - #: updatable nodes, the graph must be uploaded before it is launched - #: again. - CU_LAUNCH_ATTRIBUTE_DEVICE_UPDATABLE_KERNEL_NODE = ccuda.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_DEVICE_UPDATABLE_KERNEL_NODE{{endif}} - {{if 'CU_LAUNCH_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT' in found_values}} - - #: Valid for launches. On devices where the L1 cache and shared memory - #: use the same hardware resources, setting - #: :py:obj:`~.CUlaunchAttributeValue.sharedMemCarveout` to a percentage - #: between 0-100 signals the CUDA driver to set the shared memory - #: carveout preference, in percent of the total shared memory for that - #: kernel launch. This attribute takes precedence over - #: :py:obj:`~.CU_FUNC_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT`. This - #: is only a hint, and the CUDA driver can choose a different - #: configuration if required for the launch. - CU_LAUNCH_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT = ccuda.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT{{endif}} -{{endif}} -{{if 'CUstreamCaptureStatus_enum' in found_types}} - -class CUstreamCaptureStatus(IntEnum): - """ - Possible stream capture statuses returned by - :py:obj:`~.cuStreamIsCapturing` - """ - {{if 'CU_STREAM_CAPTURE_STATUS_NONE' in found_values}} - #: Stream is not capturing - CU_STREAM_CAPTURE_STATUS_NONE = ccuda.CUstreamCaptureStatus_enum.CU_STREAM_CAPTURE_STATUS_NONE{{endif}} - {{if 'CU_STREAM_CAPTURE_STATUS_ACTIVE' in found_values}} + CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK, + 'Maximum shared memory available per block in bytes\n' + ) - #: Stream is actively capturing - CU_STREAM_CAPTURE_STATUS_ACTIVE = ccuda.CUstreamCaptureStatus_enum.CU_STREAM_CAPTURE_STATUS_ACTIVE{{endif}} - {{if 'CU_STREAM_CAPTURE_STATUS_INVALIDATED' in found_values}} - #: Stream is part of a capture sequence that has been invalidated, but - #: not terminated - CU_STREAM_CAPTURE_STATUS_INVALIDATED = ccuda.CUstreamCaptureStatus_enum.CU_STREAM_CAPTURE_STATUS_INVALIDATED{{endif}} -{{endif}} -{{if 'CUstreamCaptureMode_enum' in found_types}} + CU_DEVICE_ATTRIBUTE_SHARED_MEMORY_PER_BLOCK = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_SHARED_MEMORY_PER_BLOCK, + 'Deprecated, use CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK\n' + ) -class CUstreamCaptureMode(IntEnum): - """ - Possible modes for stream capture thread interactions. For more - details see :py:obj:`~.cuStreamBeginCapture` and - :py:obj:`~.cuThreadExchangeStreamCaptureMode` - """ - {{if 'CU_STREAM_CAPTURE_MODE_GLOBAL' in found_values}} - CU_STREAM_CAPTURE_MODE_GLOBAL = ccuda.CUstreamCaptureMode_enum.CU_STREAM_CAPTURE_MODE_GLOBAL{{endif}} - {{if 'CU_STREAM_CAPTURE_MODE_THREAD_LOCAL' in found_values}} - CU_STREAM_CAPTURE_MODE_THREAD_LOCAL = ccuda.CUstreamCaptureMode_enum.CU_STREAM_CAPTURE_MODE_THREAD_LOCAL{{endif}} - {{if 'CU_STREAM_CAPTURE_MODE_RELAXED' in found_values}} - CU_STREAM_CAPTURE_MODE_RELAXED = ccuda.CUstreamCaptureMode_enum.CU_STREAM_CAPTURE_MODE_RELAXED{{endif}} -{{endif}} -{{if 'CUdriverProcAddress_flags_enum' in found_types}} -class CUdriverProcAddress_flags(IntEnum): - """ - Flags to specify search options. For more details see - :py:obj:`~.cuGetProcAddress` - """ - {{if 'CU_GET_PROC_ADDRESS_DEFAULT' in found_values}} + CU_DEVICE_ATTRIBUTE_TOTAL_CONSTANT_MEMORY = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_TOTAL_CONSTANT_MEMORY, + 'Memory available on device for constant variables in a CUDA C kernel in\n' + 'bytes\n' + ) - #: Default search mode for driver symbols. - CU_GET_PROC_ADDRESS_DEFAULT = ccuda.CUdriverProcAddress_flags_enum.CU_GET_PROC_ADDRESS_DEFAULT{{endif}} - {{if 'CU_GET_PROC_ADDRESS_LEGACY_STREAM' in found_values}} - #: Search for legacy versions of driver symbols. - CU_GET_PROC_ADDRESS_LEGACY_STREAM = ccuda.CUdriverProcAddress_flags_enum.CU_GET_PROC_ADDRESS_LEGACY_STREAM{{endif}} - {{if 'CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM' in found_values}} + CU_DEVICE_ATTRIBUTE_WARP_SIZE = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_WARP_SIZE, + 'Warp size in threads\n' + ) - #: Search for per-thread versions of driver symbols. - CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM = ccuda.CUdriverProcAddress_flags_enum.CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM{{endif}} -{{endif}} -{{if 'CUdriverProcAddressQueryResult_enum' in found_types}} -class CUdriverProcAddressQueryResult(IntEnum): - """ - Flags to indicate search status. For more details see - :py:obj:`~.cuGetProcAddress` - """ - {{if 'CU_GET_PROC_ADDRESS_SUCCESS' in found_values}} + CU_DEVICE_ATTRIBUTE_MAX_PITCH = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAX_PITCH, + 'Maximum pitch in bytes allowed by memory copies\n' + ) - #: Symbol was succesfully found - CU_GET_PROC_ADDRESS_SUCCESS = ccuda.CUdriverProcAddressQueryResult_enum.CU_GET_PROC_ADDRESS_SUCCESS{{endif}} - {{if 'CU_GET_PROC_ADDRESS_SYMBOL_NOT_FOUND' in found_values}} - #: Symbol was not found in search - CU_GET_PROC_ADDRESS_SYMBOL_NOT_FOUND = ccuda.CUdriverProcAddressQueryResult_enum.CU_GET_PROC_ADDRESS_SYMBOL_NOT_FOUND{{endif}} - {{if 'CU_GET_PROC_ADDRESS_VERSION_NOT_SUFFICIENT' in found_values}} + CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_BLOCK = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_BLOCK, + 'Maximum number of 32-bit registers available per block\n' + ) - #: Symbol was found but version supplied was not sufficient - CU_GET_PROC_ADDRESS_VERSION_NOT_SUFFICIENT = ccuda.CUdriverProcAddressQueryResult_enum.CU_GET_PROC_ADDRESS_VERSION_NOT_SUFFICIENT{{endif}} -{{endif}} -{{if 'CUexecAffinityType_enum' in found_types}} -class CUexecAffinityType(IntEnum): - """ - Execution Affinity Types - """ - {{if 'CU_EXEC_AFFINITY_TYPE_SM_COUNT' in found_values}} + CU_DEVICE_ATTRIBUTE_REGISTERS_PER_BLOCK = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_REGISTERS_PER_BLOCK, + 'Deprecated, use CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_BLOCK\n' + ) - #: Create a context with limited SMs. - CU_EXEC_AFFINITY_TYPE_SM_COUNT = ccuda.CUexecAffinityType_enum.CU_EXEC_AFFINITY_TYPE_SM_COUNT{{endif}} - {{if 'CU_EXEC_AFFINITY_TYPE_MAX' in found_values}} - CU_EXEC_AFFINITY_TYPE_MAX = ccuda.CUexecAffinityType_enum.CU_EXEC_AFFINITY_TYPE_MAX{{endif}} -{{endif}} -{{if 'CUcigDataType_enum' in found_types}} -class CUcigDataType(IntEnum): - """ + CU_DEVICE_ATTRIBUTE_CLOCK_RATE = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_CLOCK_RATE, + 'Typical clock frequency in kilohertz\n' + ) - """ - {{if 'CIG_DATA_TYPE_D3D12_COMMAND_QUEUE' in found_values}} - CIG_DATA_TYPE_D3D12_COMMAND_QUEUE = ccuda.CUcigDataType_enum.CIG_DATA_TYPE_D3D12_COMMAND_QUEUE{{endif}} -{{endif}} -{{if 'CUlibraryOption_enum' in found_types}} -class CUlibraryOption(IntEnum): - """ - Library options to be specified with - :py:obj:`~.cuLibraryLoadData()` or - :py:obj:`~.cuLibraryLoadFromFile()` - """ - {{if 'CU_LIBRARY_HOST_UNIVERSAL_FUNCTION_AND_DATA_TABLE' in found_values}} - CU_LIBRARY_HOST_UNIVERSAL_FUNCTION_AND_DATA_TABLE = ccuda.CUlibraryOption_enum.CU_LIBRARY_HOST_UNIVERSAL_FUNCTION_AND_DATA_TABLE{{endif}} - {{if 'CU_LIBRARY_BINARY_IS_PRESERVED' in found_values}} - - #: Specifes that the argument `code` passed to - #: :py:obj:`~.cuLibraryLoadData()` will be preserved. Specifying this - #: option will let the driver know that `code` can be accessed at any - #: point until :py:obj:`~.cuLibraryUnload()`. The default behavior is - #: for the driver to allocate and maintain its own copy of `code`. Note - #: that this is only a memory usage optimization hint and the driver - #: can choose to ignore it if required. Specifying this option with - #: :py:obj:`~.cuLibraryLoadFromFile()` is invalid and will return - #: :py:obj:`~.CUDA_ERROR_INVALID_VALUE`. - CU_LIBRARY_BINARY_IS_PRESERVED = ccuda.CUlibraryOption_enum.CU_LIBRARY_BINARY_IS_PRESERVED{{endif}} - {{if 'CU_LIBRARY_NUM_OPTIONS' in found_values}} - CU_LIBRARY_NUM_OPTIONS = ccuda.CUlibraryOption_enum.CU_LIBRARY_NUM_OPTIONS{{endif}} -{{endif}} -{{if 'cudaError_enum' in found_types}} - -class CUresult(IntEnum): - """ - Error codes - """ - {{if 'CUDA_SUCCESS' in found_values}} - - #: The API call returned with no errors. In the case of query calls, - #: this also means that the operation being queried is complete (see - #: :py:obj:`~.cuEventQuery()` and :py:obj:`~.cuStreamQuery()`). - CUDA_SUCCESS = ccuda.cudaError_enum.CUDA_SUCCESS{{endif}} - {{if 'CUDA_ERROR_INVALID_VALUE' in found_values}} - - #: This indicates that one or more of the parameters passed to the API - #: call is not within an acceptable range of values. - CUDA_ERROR_INVALID_VALUE = ccuda.cudaError_enum.CUDA_ERROR_INVALID_VALUE{{endif}} - {{if 'CUDA_ERROR_OUT_OF_MEMORY' in found_values}} - - #: The API call failed because it was unable to allocate enough memory - #: or other resources to perform the requested operation. - CUDA_ERROR_OUT_OF_MEMORY = ccuda.cudaError_enum.CUDA_ERROR_OUT_OF_MEMORY{{endif}} - {{if 'CUDA_ERROR_NOT_INITIALIZED' in found_values}} - - #: This indicates that the CUDA driver has not been initialized with - #: :py:obj:`~.cuInit()` or that initialization has failed. - CUDA_ERROR_NOT_INITIALIZED = ccuda.cudaError_enum.CUDA_ERROR_NOT_INITIALIZED{{endif}} - {{if 'CUDA_ERROR_DEINITIALIZED' in found_values}} - - #: This indicates that the CUDA driver is in the process of shutting - #: down. - CUDA_ERROR_DEINITIALIZED = ccuda.cudaError_enum.CUDA_ERROR_DEINITIALIZED{{endif}} - {{if 'CUDA_ERROR_PROFILER_DISABLED' in found_values}} - - #: This indicates profiler is not initialized for this run. This can - #: happen when the application is running with external profiling tools - #: like visual profiler. - CUDA_ERROR_PROFILER_DISABLED = ccuda.cudaError_enum.CUDA_ERROR_PROFILER_DISABLED{{endif}} - {{if 'CUDA_ERROR_PROFILER_NOT_INITIALIZED' in found_values}} - - #: [Deprecated] - CUDA_ERROR_PROFILER_NOT_INITIALIZED = ccuda.cudaError_enum.CUDA_ERROR_PROFILER_NOT_INITIALIZED{{endif}} - {{if 'CUDA_ERROR_PROFILER_ALREADY_STARTED' in found_values}} - - #: [Deprecated] - CUDA_ERROR_PROFILER_ALREADY_STARTED = ccuda.cudaError_enum.CUDA_ERROR_PROFILER_ALREADY_STARTED{{endif}} - {{if 'CUDA_ERROR_PROFILER_ALREADY_STOPPED' in found_values}} - - #: [Deprecated] - CUDA_ERROR_PROFILER_ALREADY_STOPPED = ccuda.cudaError_enum.CUDA_ERROR_PROFILER_ALREADY_STOPPED{{endif}} - {{if 'CUDA_ERROR_STUB_LIBRARY' in found_values}} - - #: This indicates that the CUDA driver that the application has loaded - #: is a stub library. Applications that run with the stub rather than a - #: real driver loaded will result in CUDA API returning this error. - CUDA_ERROR_STUB_LIBRARY = ccuda.cudaError_enum.CUDA_ERROR_STUB_LIBRARY{{endif}} - {{if 'CUDA_ERROR_DEVICE_UNAVAILABLE' in found_values}} - - #: This indicates that requested CUDA device is unavailable at the - #: current time. Devices are often unavailable due to use of - #: :py:obj:`~.CU_COMPUTEMODE_EXCLUSIVE_PROCESS` or - #: :py:obj:`~.CU_COMPUTEMODE_PROHIBITED`. - CUDA_ERROR_DEVICE_UNAVAILABLE = ccuda.cudaError_enum.CUDA_ERROR_DEVICE_UNAVAILABLE{{endif}} - {{if 'CUDA_ERROR_NO_DEVICE' in found_values}} - - #: This indicates that no CUDA-capable devices were detected by the - #: installed CUDA driver. - CUDA_ERROR_NO_DEVICE = ccuda.cudaError_enum.CUDA_ERROR_NO_DEVICE{{endif}} - {{if 'CUDA_ERROR_INVALID_DEVICE' in found_values}} - - #: This indicates that the device ordinal supplied by the user does not - #: correspond to a valid CUDA device or that the action requested is - #: invalid for the specified device. - CUDA_ERROR_INVALID_DEVICE = ccuda.cudaError_enum.CUDA_ERROR_INVALID_DEVICE{{endif}} - {{if 'CUDA_ERROR_DEVICE_NOT_LICENSED' in found_values}} - - #: This error indicates that the Grid license is not applied. - CUDA_ERROR_DEVICE_NOT_LICENSED = ccuda.cudaError_enum.CUDA_ERROR_DEVICE_NOT_LICENSED{{endif}} - {{if 'CUDA_ERROR_INVALID_IMAGE' in found_values}} - - #: This indicates that the device kernel image is invalid. This can - #: also indicate an invalid CUDA module. - CUDA_ERROR_INVALID_IMAGE = ccuda.cudaError_enum.CUDA_ERROR_INVALID_IMAGE{{endif}} - {{if 'CUDA_ERROR_INVALID_CONTEXT' in found_values}} - - #: This most frequently indicates that there is no context bound to the - #: current thread. This can also be returned if the context passed to - #: an API call is not a valid handle (such as a context that has had - #: :py:obj:`~.cuCtxDestroy()` invoked on it). This can also be returned - #: if a user mixes different API versions (i.e. 3010 context with 3020 - #: API calls). See :py:obj:`~.cuCtxGetApiVersion()` for more details. - #: This can also be returned if the green context passed to an API call - #: was not converted to a :py:obj:`~.CUcontext` using - #: :py:obj:`~.cuCtxFromGreenCtx` API. - CUDA_ERROR_INVALID_CONTEXT = ccuda.cudaError_enum.CUDA_ERROR_INVALID_CONTEXT{{endif}} - {{if 'CUDA_ERROR_CONTEXT_ALREADY_CURRENT' in found_values}} - - #: This indicated that the context being supplied as a parameter to the - #: API call was already the active context. [Deprecated] - CUDA_ERROR_CONTEXT_ALREADY_CURRENT = ccuda.cudaError_enum.CUDA_ERROR_CONTEXT_ALREADY_CURRENT{{endif}} - {{if 'CUDA_ERROR_MAP_FAILED' in found_values}} - - #: This indicates that a map or register operation has failed. - CUDA_ERROR_MAP_FAILED = ccuda.cudaError_enum.CUDA_ERROR_MAP_FAILED{{endif}} - {{if 'CUDA_ERROR_UNMAP_FAILED' in found_values}} - - #: This indicates that an unmap or unregister operation has failed. - CUDA_ERROR_UNMAP_FAILED = ccuda.cudaError_enum.CUDA_ERROR_UNMAP_FAILED{{endif}} - {{if 'CUDA_ERROR_ARRAY_IS_MAPPED' in found_values}} - - #: This indicates that the specified array is currently mapped and thus - #: cannot be destroyed. - CUDA_ERROR_ARRAY_IS_MAPPED = ccuda.cudaError_enum.CUDA_ERROR_ARRAY_IS_MAPPED{{endif}} - {{if 'CUDA_ERROR_ALREADY_MAPPED' in found_values}} - - #: This indicates that the resource is already mapped. - CUDA_ERROR_ALREADY_MAPPED = ccuda.cudaError_enum.CUDA_ERROR_ALREADY_MAPPED{{endif}} - {{if 'CUDA_ERROR_NO_BINARY_FOR_GPU' in found_values}} - - #: This indicates that there is no kernel image available that is - #: suitable for the device. This can occur when a user specifies code - #: generation options for a particular CUDA source file that do not - #: include the corresponding device configuration. - CUDA_ERROR_NO_BINARY_FOR_GPU = ccuda.cudaError_enum.CUDA_ERROR_NO_BINARY_FOR_GPU{{endif}} - {{if 'CUDA_ERROR_ALREADY_ACQUIRED' in found_values}} - - #: This indicates that a resource has already been acquired. - CUDA_ERROR_ALREADY_ACQUIRED = ccuda.cudaError_enum.CUDA_ERROR_ALREADY_ACQUIRED{{endif}} - {{if 'CUDA_ERROR_NOT_MAPPED' in found_values}} - - #: This indicates that a resource is not mapped. - CUDA_ERROR_NOT_MAPPED = ccuda.cudaError_enum.CUDA_ERROR_NOT_MAPPED{{endif}} - {{if 'CUDA_ERROR_NOT_MAPPED_AS_ARRAY' in found_values}} - - #: This indicates that a mapped resource is not available for access as - #: an array. - CUDA_ERROR_NOT_MAPPED_AS_ARRAY = ccuda.cudaError_enum.CUDA_ERROR_NOT_MAPPED_AS_ARRAY{{endif}} - {{if 'CUDA_ERROR_NOT_MAPPED_AS_POINTER' in found_values}} - - #: This indicates that a mapped resource is not available for access as - #: a pointer. - CUDA_ERROR_NOT_MAPPED_AS_POINTER = ccuda.cudaError_enum.CUDA_ERROR_NOT_MAPPED_AS_POINTER{{endif}} - {{if 'CUDA_ERROR_ECC_UNCORRECTABLE' in found_values}} - - #: This indicates that an uncorrectable ECC error was detected during - #: execution. - CUDA_ERROR_ECC_UNCORRECTABLE = ccuda.cudaError_enum.CUDA_ERROR_ECC_UNCORRECTABLE{{endif}} - {{if 'CUDA_ERROR_UNSUPPORTED_LIMIT' in found_values}} - - #: This indicates that the :py:obj:`~.CUlimit` passed to the API call - #: is not supported by the active device. - CUDA_ERROR_UNSUPPORTED_LIMIT = ccuda.cudaError_enum.CUDA_ERROR_UNSUPPORTED_LIMIT{{endif}} - {{if 'CUDA_ERROR_CONTEXT_ALREADY_IN_USE' in found_values}} - - #: This indicates that the :py:obj:`~.CUcontext` passed to the API call - #: can only be bound to a single CPU thread at a time but is already - #: bound to a CPU thread. - CUDA_ERROR_CONTEXT_ALREADY_IN_USE = ccuda.cudaError_enum.CUDA_ERROR_CONTEXT_ALREADY_IN_USE{{endif}} - {{if 'CUDA_ERROR_PEER_ACCESS_UNSUPPORTED' in found_values}} - - #: This indicates that peer access is not supported across the given - #: devices. - CUDA_ERROR_PEER_ACCESS_UNSUPPORTED = ccuda.cudaError_enum.CUDA_ERROR_PEER_ACCESS_UNSUPPORTED{{endif}} - {{if 'CUDA_ERROR_INVALID_PTX' in found_values}} - - #: This indicates that a PTX JIT compilation failed. - CUDA_ERROR_INVALID_PTX = ccuda.cudaError_enum.CUDA_ERROR_INVALID_PTX{{endif}} - {{if 'CUDA_ERROR_INVALID_GRAPHICS_CONTEXT' in found_values}} - - #: This indicates an error with OpenGL or DirectX context. - CUDA_ERROR_INVALID_GRAPHICS_CONTEXT = ccuda.cudaError_enum.CUDA_ERROR_INVALID_GRAPHICS_CONTEXT{{endif}} - {{if 'CUDA_ERROR_NVLINK_UNCORRECTABLE' in found_values}} - - #: This indicates that an uncorrectable NVLink error was detected - #: during the execution. - CUDA_ERROR_NVLINK_UNCORRECTABLE = ccuda.cudaError_enum.CUDA_ERROR_NVLINK_UNCORRECTABLE{{endif}} - {{if 'CUDA_ERROR_JIT_COMPILER_NOT_FOUND' in found_values}} - - #: This indicates that the PTX JIT compiler library was not found. - CUDA_ERROR_JIT_COMPILER_NOT_FOUND = ccuda.cudaError_enum.CUDA_ERROR_JIT_COMPILER_NOT_FOUND{{endif}} - {{if 'CUDA_ERROR_UNSUPPORTED_PTX_VERSION' in found_values}} - - #: This indicates that the provided PTX was compiled with an - #: unsupported toolchain. - CUDA_ERROR_UNSUPPORTED_PTX_VERSION = ccuda.cudaError_enum.CUDA_ERROR_UNSUPPORTED_PTX_VERSION{{endif}} - {{if 'CUDA_ERROR_JIT_COMPILATION_DISABLED' in found_values}} - - #: This indicates that the PTX JIT compilation was disabled. - CUDA_ERROR_JIT_COMPILATION_DISABLED = ccuda.cudaError_enum.CUDA_ERROR_JIT_COMPILATION_DISABLED{{endif}} - {{if 'CUDA_ERROR_UNSUPPORTED_EXEC_AFFINITY' in found_values}} - - #: This indicates that the :py:obj:`~.CUexecAffinityType` passed to the - #: API call is not supported by the active device. - CUDA_ERROR_UNSUPPORTED_EXEC_AFFINITY = ccuda.cudaError_enum.CUDA_ERROR_UNSUPPORTED_EXEC_AFFINITY{{endif}} - {{if 'CUDA_ERROR_UNSUPPORTED_DEVSIDE_SYNC' in found_values}} - - #: This indicates that the code to be compiled by the PTX JIT contains - #: unsupported call to cudaDeviceSynchronize. - CUDA_ERROR_UNSUPPORTED_DEVSIDE_SYNC = ccuda.cudaError_enum.CUDA_ERROR_UNSUPPORTED_DEVSIDE_SYNC{{endif}} - {{if 'CUDA_ERROR_INVALID_SOURCE' in found_values}} - - #: This indicates that the device kernel source is invalid. This - #: includes compilation/linker errors encountered in device code or - #: user error. - CUDA_ERROR_INVALID_SOURCE = ccuda.cudaError_enum.CUDA_ERROR_INVALID_SOURCE{{endif}} - {{if 'CUDA_ERROR_FILE_NOT_FOUND' in found_values}} - - #: This indicates that the file specified was not found. - CUDA_ERROR_FILE_NOT_FOUND = ccuda.cudaError_enum.CUDA_ERROR_FILE_NOT_FOUND{{endif}} - {{if 'CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND' in found_values}} - - #: This indicates that a link to a shared object failed to resolve. - CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND = ccuda.cudaError_enum.CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND{{endif}} - {{if 'CUDA_ERROR_SHARED_OBJECT_INIT_FAILED' in found_values}} - - #: This indicates that initialization of a shared object failed. - CUDA_ERROR_SHARED_OBJECT_INIT_FAILED = ccuda.cudaError_enum.CUDA_ERROR_SHARED_OBJECT_INIT_FAILED{{endif}} - {{if 'CUDA_ERROR_OPERATING_SYSTEM' in found_values}} - - #: This indicates that an OS call failed. - CUDA_ERROR_OPERATING_SYSTEM = ccuda.cudaError_enum.CUDA_ERROR_OPERATING_SYSTEM{{endif}} - {{if 'CUDA_ERROR_INVALID_HANDLE' in found_values}} - - #: This indicates that a resource handle passed to the API call was not - #: valid. Resource handles are opaque types like :py:obj:`~.CUstream` - #: and :py:obj:`~.CUevent`. - CUDA_ERROR_INVALID_HANDLE = ccuda.cudaError_enum.CUDA_ERROR_INVALID_HANDLE{{endif}} - {{if 'CUDA_ERROR_ILLEGAL_STATE' in found_values}} - - #: This indicates that a resource required by the API call is not in a - #: valid state to perform the requested operation. - CUDA_ERROR_ILLEGAL_STATE = ccuda.cudaError_enum.CUDA_ERROR_ILLEGAL_STATE{{endif}} - {{if 'CUDA_ERROR_LOSSY_QUERY' in found_values}} - - #: This indicates an attempt was made to introspect an object in a way - #: that would discard semantically important information. This is - #: either due to the object using funtionality newer than the API - #: version used to introspect it or omission of optional return - #: arguments. - CUDA_ERROR_LOSSY_QUERY = ccuda.cudaError_enum.CUDA_ERROR_LOSSY_QUERY{{endif}} - {{if 'CUDA_ERROR_NOT_FOUND' in found_values}} - - #: This indicates that a named symbol was not found. Examples of - #: symbols are global/constant variable names, driver function names, - #: texture names, and surface names. - CUDA_ERROR_NOT_FOUND = ccuda.cudaError_enum.CUDA_ERROR_NOT_FOUND{{endif}} - {{if 'CUDA_ERROR_NOT_READY' in found_values}} - - #: This indicates that asynchronous operations issued previously have - #: not completed yet. This result is not actually an error, but must be - #: indicated differently than :py:obj:`~.CUDA_SUCCESS` (which indicates - #: completion). Calls that may return this value include - #: :py:obj:`~.cuEventQuery()` and :py:obj:`~.cuStreamQuery()`. - CUDA_ERROR_NOT_READY = ccuda.cudaError_enum.CUDA_ERROR_NOT_READY{{endif}} - {{if 'CUDA_ERROR_ILLEGAL_ADDRESS' in found_values}} - - #: While executing a kernel, the device encountered a load or store - #: instruction on an invalid memory address. This leaves the process in - #: an inconsistent state and any further CUDA work will return the same - #: error. To continue using CUDA, the process must be terminated and - #: relaunched. - CUDA_ERROR_ILLEGAL_ADDRESS = ccuda.cudaError_enum.CUDA_ERROR_ILLEGAL_ADDRESS{{endif}} - {{if 'CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES' in found_values}} - - #: This indicates that a launch did not occur because it did not have - #: appropriate resources. This error usually indicates that the user - #: has attempted to pass too many arguments to the device kernel, or - #: the kernel launch specifies too many threads for the kernel's - #: register count. Passing arguments of the wrong size (i.e. a 64-bit - #: pointer when a 32-bit int is expected) is equivalent to passing too - #: many arguments and can also result in this error. - CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES = ccuda.cudaError_enum.CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES{{endif}} - {{if 'CUDA_ERROR_LAUNCH_TIMEOUT' in found_values}} - - #: This indicates that the device kernel took too long to execute. This - #: can only occur if timeouts are enabled - see the device attribute - #: :py:obj:`~.CU_DEVICE_ATTRIBUTE_KERNEL_EXEC_TIMEOUT` for more - #: information. This leaves the process in an inconsistent state and - #: any further CUDA work will return the same error. To continue using - #: CUDA, the process must be terminated and relaunched. - CUDA_ERROR_LAUNCH_TIMEOUT = ccuda.cudaError_enum.CUDA_ERROR_LAUNCH_TIMEOUT{{endif}} - {{if 'CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING' in found_values}} - - #: This error indicates a kernel launch that uses an incompatible - #: texturing mode. - CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING = ccuda.cudaError_enum.CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING{{endif}} - {{if 'CUDA_ERROR_PEER_ACCESS_ALREADY_ENABLED' in found_values}} - - #: This error indicates that a call to - #: :py:obj:`~.cuCtxEnablePeerAccess()` is trying to re-enable peer - #: access to a context which has already had peer access to it enabled. - CUDA_ERROR_PEER_ACCESS_ALREADY_ENABLED = ccuda.cudaError_enum.CUDA_ERROR_PEER_ACCESS_ALREADY_ENABLED{{endif}} - {{if 'CUDA_ERROR_PEER_ACCESS_NOT_ENABLED' in found_values}} - - #: This error indicates that :py:obj:`~.cuCtxDisablePeerAccess()` is - #: trying to disable peer access which has not been enabled yet via - #: :py:obj:`~.cuCtxEnablePeerAccess()`. - CUDA_ERROR_PEER_ACCESS_NOT_ENABLED = ccuda.cudaError_enum.CUDA_ERROR_PEER_ACCESS_NOT_ENABLED{{endif}} - {{if 'CUDA_ERROR_PRIMARY_CONTEXT_ACTIVE' in found_values}} - - #: This error indicates that the primary context for the specified - #: device has already been initialized. - CUDA_ERROR_PRIMARY_CONTEXT_ACTIVE = ccuda.cudaError_enum.CUDA_ERROR_PRIMARY_CONTEXT_ACTIVE{{endif}} - {{if 'CUDA_ERROR_CONTEXT_IS_DESTROYED' in found_values}} - - #: This error indicates that the context current to the calling thread - #: has been destroyed using :py:obj:`~.cuCtxDestroy`, or is a primary - #: context which has not yet been initialized. - CUDA_ERROR_CONTEXT_IS_DESTROYED = ccuda.cudaError_enum.CUDA_ERROR_CONTEXT_IS_DESTROYED{{endif}} - {{if 'CUDA_ERROR_ASSERT' in found_values}} - - #: A device-side assert triggered during kernel execution. The context - #: cannot be used anymore, and must be destroyed. All existing device - #: memory allocations from this context are invalid and must be - #: reconstructed if the program is to continue using CUDA. - CUDA_ERROR_ASSERT = ccuda.cudaError_enum.CUDA_ERROR_ASSERT{{endif}} - {{if 'CUDA_ERROR_TOO_MANY_PEERS' in found_values}} - - #: This error indicates that the hardware resources required to enable - #: peer access have been exhausted for one or more of the devices - #: passed to :py:obj:`~.cuCtxEnablePeerAccess()`. - CUDA_ERROR_TOO_MANY_PEERS = ccuda.cudaError_enum.CUDA_ERROR_TOO_MANY_PEERS{{endif}} - {{if 'CUDA_ERROR_HOST_MEMORY_ALREADY_REGISTERED' in found_values}} - - #: This error indicates that the memory range passed to - #: :py:obj:`~.cuMemHostRegister()` has already been registered. - CUDA_ERROR_HOST_MEMORY_ALREADY_REGISTERED = ccuda.cudaError_enum.CUDA_ERROR_HOST_MEMORY_ALREADY_REGISTERED{{endif}} - {{if 'CUDA_ERROR_HOST_MEMORY_NOT_REGISTERED' in found_values}} - - #: This error indicates that the pointer passed to - #: :py:obj:`~.cuMemHostUnregister()` does not correspond to any - #: currently registered memory region. - CUDA_ERROR_HOST_MEMORY_NOT_REGISTERED = ccuda.cudaError_enum.CUDA_ERROR_HOST_MEMORY_NOT_REGISTERED{{endif}} - {{if 'CUDA_ERROR_HARDWARE_STACK_ERROR' in found_values}} - - #: While executing a kernel, the device encountered a stack error. This - #: can be due to stack corruption or exceeding the stack size limit. - #: This leaves the process in an inconsistent state and any further - #: CUDA work will return the same error. To continue using CUDA, the - #: process must be terminated and relaunched. - CUDA_ERROR_HARDWARE_STACK_ERROR = ccuda.cudaError_enum.CUDA_ERROR_HARDWARE_STACK_ERROR{{endif}} - {{if 'CUDA_ERROR_ILLEGAL_INSTRUCTION' in found_values}} - - #: While executing a kernel, the device encountered an illegal - #: instruction. This leaves the process in an inconsistent state and - #: any further CUDA work will return the same error. To continue using - #: CUDA, the process must be terminated and relaunched. - CUDA_ERROR_ILLEGAL_INSTRUCTION = ccuda.cudaError_enum.CUDA_ERROR_ILLEGAL_INSTRUCTION{{endif}} - {{if 'CUDA_ERROR_MISALIGNED_ADDRESS' in found_values}} - - #: While executing a kernel, the device encountered a load or store - #: instruction on a memory address which is not aligned. This leaves - #: the process in an inconsistent state and any further CUDA work will - #: return the same error. To continue using CUDA, the process must be - #: terminated and relaunched. - CUDA_ERROR_MISALIGNED_ADDRESS = ccuda.cudaError_enum.CUDA_ERROR_MISALIGNED_ADDRESS{{endif}} - {{if 'CUDA_ERROR_INVALID_ADDRESS_SPACE' in found_values}} - - #: While executing a kernel, the device encountered an instruction - #: which can only operate on memory locations in certain address spaces - #: (global, shared, or local), but was supplied a memory address not - #: belonging to an allowed address space. This leaves the process in an - #: inconsistent state and any further CUDA work will return the same - #: error. To continue using CUDA, the process must be terminated and - #: relaunched. - CUDA_ERROR_INVALID_ADDRESS_SPACE = ccuda.cudaError_enum.CUDA_ERROR_INVALID_ADDRESS_SPACE{{endif}} - {{if 'CUDA_ERROR_INVALID_PC' in found_values}} - - #: While executing a kernel, the device program counter wrapped its - #: address space. This leaves the process in an inconsistent state and - #: any further CUDA work will return the same error. To continue using - #: CUDA, the process must be terminated and relaunched. - CUDA_ERROR_INVALID_PC = ccuda.cudaError_enum.CUDA_ERROR_INVALID_PC{{endif}} - {{if 'CUDA_ERROR_LAUNCH_FAILED' in found_values}} - - #: An exception occurred on the device while executing a kernel. Common - #: causes include dereferencing an invalid device pointer and accessing - #: out of bounds shared memory. Less common cases can be system - #: specific - more information about these cases can be found in the - #: system specific user guide. This leaves the process in an - #: inconsistent state and any further CUDA work will return the same - #: error. To continue using CUDA, the process must be terminated and - #: relaunched. - CUDA_ERROR_LAUNCH_FAILED = ccuda.cudaError_enum.CUDA_ERROR_LAUNCH_FAILED{{endif}} - {{if 'CUDA_ERROR_COOPERATIVE_LAUNCH_TOO_LARGE' in found_values}} - - #: This error indicates that the number of blocks launched per grid for - #: a kernel that was launched via either - #: :py:obj:`~.cuLaunchCooperativeKernel` or - #: :py:obj:`~.cuLaunchCooperativeKernelMultiDevice` exceeds the maximum - #: number of blocks as allowed by - #: :py:obj:`~.cuOccupancyMaxActiveBlocksPerMultiprocessor` or - #: :py:obj:`~.cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags` - #: times the number of multiprocessors as specified by the device - #: attribute :py:obj:`~.CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT`. - CUDA_ERROR_COOPERATIVE_LAUNCH_TOO_LARGE = ccuda.cudaError_enum.CUDA_ERROR_COOPERATIVE_LAUNCH_TOO_LARGE{{endif}} - {{if 'CUDA_ERROR_NOT_PERMITTED' in found_values}} - - #: This error indicates that the attempted operation is not permitted. - CUDA_ERROR_NOT_PERMITTED = ccuda.cudaError_enum.CUDA_ERROR_NOT_PERMITTED{{endif}} - {{if 'CUDA_ERROR_NOT_SUPPORTED' in found_values}} - - #: This error indicates that the attempted operation is not supported - #: on the current system or device. - CUDA_ERROR_NOT_SUPPORTED = ccuda.cudaError_enum.CUDA_ERROR_NOT_SUPPORTED{{endif}} - {{if 'CUDA_ERROR_SYSTEM_NOT_READY' in found_values}} - - #: This error indicates that the system is not yet ready to start any - #: CUDA work. To continue using CUDA, verify the system configuration - #: is in a valid state and all required driver daemons are actively - #: running. More information about this error can be found in the - #: system specific user guide. - CUDA_ERROR_SYSTEM_NOT_READY = ccuda.cudaError_enum.CUDA_ERROR_SYSTEM_NOT_READY{{endif}} - {{if 'CUDA_ERROR_SYSTEM_DRIVER_MISMATCH' in found_values}} - - #: This error indicates that there is a mismatch between the versions - #: of the display driver and the CUDA driver. Refer to the - #: compatibility documentation for supported versions. - CUDA_ERROR_SYSTEM_DRIVER_MISMATCH = ccuda.cudaError_enum.CUDA_ERROR_SYSTEM_DRIVER_MISMATCH{{endif}} - {{if 'CUDA_ERROR_COMPAT_NOT_SUPPORTED_ON_DEVICE' in found_values}} - - #: This error indicates that the system was upgraded to run with - #: forward compatibility but the visible hardware detected by CUDA does - #: not support this configuration. Refer to the compatibility - #: documentation for the supported hardware matrix or ensure that only - #: supported hardware is visible during initialization via the - #: CUDA_VISIBLE_DEVICES environment variable. - CUDA_ERROR_COMPAT_NOT_SUPPORTED_ON_DEVICE = ccuda.cudaError_enum.CUDA_ERROR_COMPAT_NOT_SUPPORTED_ON_DEVICE{{endif}} - {{if 'CUDA_ERROR_MPS_CONNECTION_FAILED' in found_values}} - - #: This error indicates that the MPS client failed to connect to the - #: MPS control daemon or the MPS server. - CUDA_ERROR_MPS_CONNECTION_FAILED = ccuda.cudaError_enum.CUDA_ERROR_MPS_CONNECTION_FAILED{{endif}} - {{if 'CUDA_ERROR_MPS_RPC_FAILURE' in found_values}} - - #: This error indicates that the remote procedural call between the MPS - #: server and the MPS client failed. - CUDA_ERROR_MPS_RPC_FAILURE = ccuda.cudaError_enum.CUDA_ERROR_MPS_RPC_FAILURE{{endif}} - {{if 'CUDA_ERROR_MPS_SERVER_NOT_READY' in found_values}} - - #: This error indicates that the MPS server is not ready to accept new - #: MPS client requests. This error can be returned when the MPS server - #: is in the process of recovering from a fatal failure. - CUDA_ERROR_MPS_SERVER_NOT_READY = ccuda.cudaError_enum.CUDA_ERROR_MPS_SERVER_NOT_READY{{endif}} - {{if 'CUDA_ERROR_MPS_MAX_CLIENTS_REACHED' in found_values}} - - #: This error indicates that the hardware resources required to create - #: MPS client have been exhausted. - CUDA_ERROR_MPS_MAX_CLIENTS_REACHED = ccuda.cudaError_enum.CUDA_ERROR_MPS_MAX_CLIENTS_REACHED{{endif}} - {{if 'CUDA_ERROR_MPS_MAX_CONNECTIONS_REACHED' in found_values}} - - #: This error indicates the the hardware resources required to support - #: device connections have been exhausted. - CUDA_ERROR_MPS_MAX_CONNECTIONS_REACHED = ccuda.cudaError_enum.CUDA_ERROR_MPS_MAX_CONNECTIONS_REACHED{{endif}} - {{if 'CUDA_ERROR_MPS_CLIENT_TERMINATED' in found_values}} - - #: This error indicates that the MPS client has been terminated by the - #: server. To continue using CUDA, the process must be terminated and - #: relaunched. - CUDA_ERROR_MPS_CLIENT_TERMINATED = ccuda.cudaError_enum.CUDA_ERROR_MPS_CLIENT_TERMINATED{{endif}} - {{if 'CUDA_ERROR_CDP_NOT_SUPPORTED' in found_values}} - - #: This error indicates that the module is using CUDA Dynamic - #: Parallelism, but the current configuration, like MPS, does not - #: support it. - CUDA_ERROR_CDP_NOT_SUPPORTED = ccuda.cudaError_enum.CUDA_ERROR_CDP_NOT_SUPPORTED{{endif}} - {{if 'CUDA_ERROR_CDP_VERSION_MISMATCH' in found_values}} - - #: This error indicates that a module contains an unsupported - #: interaction between different versions of CUDA Dynamic Parallelism. - CUDA_ERROR_CDP_VERSION_MISMATCH = ccuda.cudaError_enum.CUDA_ERROR_CDP_VERSION_MISMATCH{{endif}} - {{if 'CUDA_ERROR_STREAM_CAPTURE_UNSUPPORTED' in found_values}} - - #: This error indicates that the operation is not permitted when the - #: stream is capturing. - CUDA_ERROR_STREAM_CAPTURE_UNSUPPORTED = ccuda.cudaError_enum.CUDA_ERROR_STREAM_CAPTURE_UNSUPPORTED{{endif}} - {{if 'CUDA_ERROR_STREAM_CAPTURE_INVALIDATED' in found_values}} - - #: This error indicates that the current capture sequence on the stream - #: has been invalidated due to a previous error. - CUDA_ERROR_STREAM_CAPTURE_INVALIDATED = ccuda.cudaError_enum.CUDA_ERROR_STREAM_CAPTURE_INVALIDATED{{endif}} - {{if 'CUDA_ERROR_STREAM_CAPTURE_MERGE' in found_values}} - - #: This error indicates that the operation would have resulted in a - #: merge of two independent capture sequences. - CUDA_ERROR_STREAM_CAPTURE_MERGE = ccuda.cudaError_enum.CUDA_ERROR_STREAM_CAPTURE_MERGE{{endif}} - {{if 'CUDA_ERROR_STREAM_CAPTURE_UNMATCHED' in found_values}} - - #: This error indicates that the capture was not initiated in this - #: stream. - CUDA_ERROR_STREAM_CAPTURE_UNMATCHED = ccuda.cudaError_enum.CUDA_ERROR_STREAM_CAPTURE_UNMATCHED{{endif}} - {{if 'CUDA_ERROR_STREAM_CAPTURE_UNJOINED' in found_values}} - - #: This error indicates that the capture sequence contains a fork that - #: was not joined to the primary stream. - CUDA_ERROR_STREAM_CAPTURE_UNJOINED = ccuda.cudaError_enum.CUDA_ERROR_STREAM_CAPTURE_UNJOINED{{endif}} - {{if 'CUDA_ERROR_STREAM_CAPTURE_ISOLATION' in found_values}} - - #: This error indicates that a dependency would have been created which - #: crosses the capture sequence boundary. Only implicit in-stream - #: ordering dependencies are allowed to cross the boundary. - CUDA_ERROR_STREAM_CAPTURE_ISOLATION = ccuda.cudaError_enum.CUDA_ERROR_STREAM_CAPTURE_ISOLATION{{endif}} - {{if 'CUDA_ERROR_STREAM_CAPTURE_IMPLICIT' in found_values}} - - #: This error indicates a disallowed implicit dependency on a current - #: capture sequence from cudaStreamLegacy. - CUDA_ERROR_STREAM_CAPTURE_IMPLICIT = ccuda.cudaError_enum.CUDA_ERROR_STREAM_CAPTURE_IMPLICIT{{endif}} - {{if 'CUDA_ERROR_CAPTURED_EVENT' in found_values}} - - #: This error indicates that the operation is not permitted on an event - #: which was last recorded in a capturing stream. - CUDA_ERROR_CAPTURED_EVENT = ccuda.cudaError_enum.CUDA_ERROR_CAPTURED_EVENT{{endif}} - {{if 'CUDA_ERROR_STREAM_CAPTURE_WRONG_THREAD' in found_values}} - - #: A stream capture sequence not initiated with the - #: :py:obj:`~.CU_STREAM_CAPTURE_MODE_RELAXED` argument to - #: :py:obj:`~.cuStreamBeginCapture` was passed to - #: :py:obj:`~.cuStreamEndCapture` in a different thread. - CUDA_ERROR_STREAM_CAPTURE_WRONG_THREAD = ccuda.cudaError_enum.CUDA_ERROR_STREAM_CAPTURE_WRONG_THREAD{{endif}} - {{if 'CUDA_ERROR_TIMEOUT' in found_values}} - - #: This error indicates that the timeout specified for the wait - #: operation has lapsed. - CUDA_ERROR_TIMEOUT = ccuda.cudaError_enum.CUDA_ERROR_TIMEOUT{{endif}} - {{if 'CUDA_ERROR_GRAPH_EXEC_UPDATE_FAILURE' in found_values}} - - #: This error indicates that the graph update was not performed because - #: it included changes which violated constraints specific to - #: instantiated graph update. - CUDA_ERROR_GRAPH_EXEC_UPDATE_FAILURE = ccuda.cudaError_enum.CUDA_ERROR_GRAPH_EXEC_UPDATE_FAILURE{{endif}} - {{if 'CUDA_ERROR_EXTERNAL_DEVICE' in found_values}} - - #: This indicates that an async error has occurred in a device outside - #: of CUDA. If CUDA was waiting for an external device's signal before - #: consuming shared data, the external device signaled an error - #: indicating that the data is not valid for consumption. This leaves - #: the process in an inconsistent state and any further CUDA work will - #: return the same error. To continue using CUDA, the process must be - #: terminated and relaunched. - CUDA_ERROR_EXTERNAL_DEVICE = ccuda.cudaError_enum.CUDA_ERROR_EXTERNAL_DEVICE{{endif}} - {{if 'CUDA_ERROR_INVALID_CLUSTER_SIZE' in found_values}} - - #: Indicates a kernel launch error due to cluster misconfiguration. - CUDA_ERROR_INVALID_CLUSTER_SIZE = ccuda.cudaError_enum.CUDA_ERROR_INVALID_CLUSTER_SIZE{{endif}} - {{if 'CUDA_ERROR_FUNCTION_NOT_LOADED' in found_values}} - - #: Indiciates a function handle is not loaded when calling an API that - #: requires a loaded function. - CUDA_ERROR_FUNCTION_NOT_LOADED = ccuda.cudaError_enum.CUDA_ERROR_FUNCTION_NOT_LOADED{{endif}} - {{if 'CUDA_ERROR_INVALID_RESOURCE_TYPE' in found_values}} - - #: This error indicates one or more resources passed in are not valid - #: resource types for the operation. - CUDA_ERROR_INVALID_RESOURCE_TYPE = ccuda.cudaError_enum.CUDA_ERROR_INVALID_RESOURCE_TYPE{{endif}} - {{if 'CUDA_ERROR_INVALID_RESOURCE_CONFIGURATION' in found_values}} - - #: This error indicates one or more resources are insufficient or non- - #: applicable for the operation. - CUDA_ERROR_INVALID_RESOURCE_CONFIGURATION = ccuda.cudaError_enum.CUDA_ERROR_INVALID_RESOURCE_CONFIGURATION{{endif}} - {{if 'CUDA_ERROR_UNKNOWN' in found_values}} - - #: This indicates that an unknown internal error has occurred. - CUDA_ERROR_UNKNOWN = ccuda.cudaError_enum.CUDA_ERROR_UNKNOWN{{endif}} -{{endif}} -{{if 'CUdevice_P2PAttribute_enum' in found_types}} - -class CUdevice_P2PAttribute(IntEnum): - """ - P2P Attributes - """ - {{if 'CU_DEVICE_P2P_ATTRIBUTE_PERFORMANCE_RANK' in found_values}} + CU_DEVICE_ATTRIBUTE_TEXTURE_ALIGNMENT = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_TEXTURE_ALIGNMENT, + 'Alignment requirement for textures\n' + ) - #: A relative value indicating the performance of the link between two - #: devices - CU_DEVICE_P2P_ATTRIBUTE_PERFORMANCE_RANK = ccuda.CUdevice_P2PAttribute_enum.CU_DEVICE_P2P_ATTRIBUTE_PERFORMANCE_RANK{{endif}} - {{if 'CU_DEVICE_P2P_ATTRIBUTE_ACCESS_SUPPORTED' in found_values}} - #: P2P Access is enable - CU_DEVICE_P2P_ATTRIBUTE_ACCESS_SUPPORTED = ccuda.CUdevice_P2PAttribute_enum.CU_DEVICE_P2P_ATTRIBUTE_ACCESS_SUPPORTED{{endif}} - {{if 'CU_DEVICE_P2P_ATTRIBUTE_NATIVE_ATOMIC_SUPPORTED' in found_values}} + CU_DEVICE_ATTRIBUTE_GPU_OVERLAP = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_GPU_OVERLAP, + 'Device can possibly copy memory and execute a kernel concurrently.\n' + 'Deprecated. Use instead CU_DEVICE_ATTRIBUTE_ASYNC_ENGINE_COUNT.\n' + ) - #: Atomic operation over the link supported - CU_DEVICE_P2P_ATTRIBUTE_NATIVE_ATOMIC_SUPPORTED = ccuda.CUdevice_P2PAttribute_enum.CU_DEVICE_P2P_ATTRIBUTE_NATIVE_ATOMIC_SUPPORTED{{endif}} - {{if 'CU_DEVICE_P2P_ATTRIBUTE_ACCESS_ACCESS_SUPPORTED' in found_values}} - #: [Deprecated] - CU_DEVICE_P2P_ATTRIBUTE_ACCESS_ACCESS_SUPPORTED = ccuda.CUdevice_P2PAttribute_enum.CU_DEVICE_P2P_ATTRIBUTE_ACCESS_ACCESS_SUPPORTED{{endif}} - {{if 'CU_DEVICE_P2P_ATTRIBUTE_CUDA_ARRAY_ACCESS_SUPPORTED' in found_values}} + CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT, + 'Number of multiprocessors on device\n' + ) - #: Accessing CUDA arrays over the link supported - CU_DEVICE_P2P_ATTRIBUTE_CUDA_ARRAY_ACCESS_SUPPORTED = ccuda.CUdevice_P2PAttribute_enum.CU_DEVICE_P2P_ATTRIBUTE_CUDA_ARRAY_ACCESS_SUPPORTED{{endif}} -{{endif}} -{{if 'CUresourceViewFormat_enum' in found_types}} -class CUresourceViewFormat(IntEnum): - """ - Resource view format - """ - {{if 'CU_RES_VIEW_FORMAT_NONE' in found_values}} + CU_DEVICE_ATTRIBUTE_KERNEL_EXEC_TIMEOUT = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_KERNEL_EXEC_TIMEOUT, + 'Specifies whether there is a run time limit on kernels\n' + ) - #: No resource view format (use underlying resource format) - CU_RES_VIEW_FORMAT_NONE = ccuda.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_NONE{{endif}} - {{if 'CU_RES_VIEW_FORMAT_UINT_1X8' in found_values}} - #: 1 channel unsigned 8-bit integers - CU_RES_VIEW_FORMAT_UINT_1X8 = ccuda.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_UINT_1X8{{endif}} - {{if 'CU_RES_VIEW_FORMAT_UINT_2X8' in found_values}} + CU_DEVICE_ATTRIBUTE_INTEGRATED = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_INTEGRATED, + 'Device is integrated with host memory\n' + ) - #: 2 channel unsigned 8-bit integers - CU_RES_VIEW_FORMAT_UINT_2X8 = ccuda.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_UINT_2X8{{endif}} - {{if 'CU_RES_VIEW_FORMAT_UINT_4X8' in found_values}} - #: 4 channel unsigned 8-bit integers - CU_RES_VIEW_FORMAT_UINT_4X8 = ccuda.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_UINT_4X8{{endif}} - {{if 'CU_RES_VIEW_FORMAT_SINT_1X8' in found_values}} + CU_DEVICE_ATTRIBUTE_CAN_MAP_HOST_MEMORY = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_CAN_MAP_HOST_MEMORY, + 'Device can map host memory into CUDA address space\n' + ) - #: 1 channel signed 8-bit integers - CU_RES_VIEW_FORMAT_SINT_1X8 = ccuda.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_SINT_1X8{{endif}} - {{if 'CU_RES_VIEW_FORMAT_SINT_2X8' in found_values}} - #: 2 channel signed 8-bit integers - CU_RES_VIEW_FORMAT_SINT_2X8 = ccuda.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_SINT_2X8{{endif}} - {{if 'CU_RES_VIEW_FORMAT_SINT_4X8' in found_values}} + CU_DEVICE_ATTRIBUTE_COMPUTE_MODE = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_COMPUTE_MODE, + 'Compute mode (See :py:obj:`~.CUcomputemode` for details)\n' + ) - #: 4 channel signed 8-bit integers - CU_RES_VIEW_FORMAT_SINT_4X8 = ccuda.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_SINT_4X8{{endif}} - {{if 'CU_RES_VIEW_FORMAT_UINT_1X16' in found_values}} - #: 1 channel unsigned 16-bit integers - CU_RES_VIEW_FORMAT_UINT_1X16 = ccuda.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_UINT_1X16{{endif}} - {{if 'CU_RES_VIEW_FORMAT_UINT_2X16' in found_values}} + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_WIDTH = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_WIDTH, + 'Maximum 1D texture width\n' + ) - #: 2 channel unsigned 16-bit integers - CU_RES_VIEW_FORMAT_UINT_2X16 = ccuda.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_UINT_2X16{{endif}} - {{if 'CU_RES_VIEW_FORMAT_UINT_4X16' in found_values}} - #: 4 channel unsigned 16-bit integers - CU_RES_VIEW_FORMAT_UINT_4X16 = ccuda.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_UINT_4X16{{endif}} - {{if 'CU_RES_VIEW_FORMAT_SINT_1X16' in found_values}} + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_WIDTH = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_WIDTH, + 'Maximum 2D texture width\n' + ) - #: 1 channel signed 16-bit integers - CU_RES_VIEW_FORMAT_SINT_1X16 = ccuda.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_SINT_1X16{{endif}} - {{if 'CU_RES_VIEW_FORMAT_SINT_2X16' in found_values}} - #: 2 channel signed 16-bit integers - CU_RES_VIEW_FORMAT_SINT_2X16 = ccuda.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_SINT_2X16{{endif}} - {{if 'CU_RES_VIEW_FORMAT_SINT_4X16' in found_values}} + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_HEIGHT = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_HEIGHT, + 'Maximum 2D texture height\n' + ) - #: 4 channel signed 16-bit integers - CU_RES_VIEW_FORMAT_SINT_4X16 = ccuda.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_SINT_4X16{{endif}} - {{if 'CU_RES_VIEW_FORMAT_UINT_1X32' in found_values}} - #: 1 channel unsigned 32-bit integers - CU_RES_VIEW_FORMAT_UINT_1X32 = ccuda.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_UINT_1X32{{endif}} - {{if 'CU_RES_VIEW_FORMAT_UINT_2X32' in found_values}} + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_WIDTH = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_WIDTH, + 'Maximum 3D texture width\n' + ) - #: 2 channel unsigned 32-bit integers - CU_RES_VIEW_FORMAT_UINT_2X32 = ccuda.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_UINT_2X32{{endif}} - {{if 'CU_RES_VIEW_FORMAT_UINT_4X32' in found_values}} - #: 4 channel unsigned 32-bit integers - CU_RES_VIEW_FORMAT_UINT_4X32 = ccuda.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_UINT_4X32{{endif}} - {{if 'CU_RES_VIEW_FORMAT_SINT_1X32' in found_values}} + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_HEIGHT = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_HEIGHT, + 'Maximum 3D texture height\n' + ) - #: 1 channel signed 32-bit integers - CU_RES_VIEW_FORMAT_SINT_1X32 = ccuda.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_SINT_1X32{{endif}} - {{if 'CU_RES_VIEW_FORMAT_SINT_2X32' in found_values}} - #: 2 channel signed 32-bit integers - CU_RES_VIEW_FORMAT_SINT_2X32 = ccuda.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_SINT_2X32{{endif}} - {{if 'CU_RES_VIEW_FORMAT_SINT_4X32' in found_values}} + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_DEPTH = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_DEPTH, + 'Maximum 3D texture depth\n' + ) - #: 4 channel signed 32-bit integers - CU_RES_VIEW_FORMAT_SINT_4X32 = ccuda.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_SINT_4X32{{endif}} - {{if 'CU_RES_VIEW_FORMAT_FLOAT_1X16' in found_values}} - #: 1 channel 16-bit floating point - CU_RES_VIEW_FORMAT_FLOAT_1X16 = ccuda.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_FLOAT_1X16{{endif}} - {{if 'CU_RES_VIEW_FORMAT_FLOAT_2X16' in found_values}} + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_WIDTH = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_WIDTH, + 'Maximum 2D layered texture width\n' + ) - #: 2 channel 16-bit floating point - CU_RES_VIEW_FORMAT_FLOAT_2X16 = ccuda.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_FLOAT_2X16{{endif}} - {{if 'CU_RES_VIEW_FORMAT_FLOAT_4X16' in found_values}} - #: 4 channel 16-bit floating point - CU_RES_VIEW_FORMAT_FLOAT_4X16 = ccuda.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_FLOAT_4X16{{endif}} - {{if 'CU_RES_VIEW_FORMAT_FLOAT_1X32' in found_values}} + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_WIDTH = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_WIDTH, + 'Deprecated, use CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_WIDTH\n' + ) - #: 1 channel 32-bit floating point - CU_RES_VIEW_FORMAT_FLOAT_1X32 = ccuda.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_FLOAT_1X32{{endif}} - {{if 'CU_RES_VIEW_FORMAT_FLOAT_2X32' in found_values}} - #: 2 channel 32-bit floating point - CU_RES_VIEW_FORMAT_FLOAT_2X32 = ccuda.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_FLOAT_2X32{{endif}} - {{if 'CU_RES_VIEW_FORMAT_FLOAT_4X32' in found_values}} + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_HEIGHT = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_HEIGHT, + 'Maximum 2D layered texture height\n' + ) - #: 4 channel 32-bit floating point - CU_RES_VIEW_FORMAT_FLOAT_4X32 = ccuda.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_FLOAT_4X32{{endif}} - {{if 'CU_RES_VIEW_FORMAT_UNSIGNED_BC1' in found_values}} - #: Block compressed 1 - CU_RES_VIEW_FORMAT_UNSIGNED_BC1 = ccuda.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_UNSIGNED_BC1{{endif}} - {{if 'CU_RES_VIEW_FORMAT_UNSIGNED_BC2' in found_values}} + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_HEIGHT = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_HEIGHT, + 'Deprecated, use CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_HEIGHT\n' + ) - #: Block compressed 2 - CU_RES_VIEW_FORMAT_UNSIGNED_BC2 = ccuda.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_UNSIGNED_BC2{{endif}} - {{if 'CU_RES_VIEW_FORMAT_UNSIGNED_BC3' in found_values}} - #: Block compressed 3 - CU_RES_VIEW_FORMAT_UNSIGNED_BC3 = ccuda.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_UNSIGNED_BC3{{endif}} - {{if 'CU_RES_VIEW_FORMAT_UNSIGNED_BC4' in found_values}} + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_LAYERS = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_LAYERS, + 'Maximum layers in a 2D layered texture\n' + ) - #: Block compressed 4 unsigned - CU_RES_VIEW_FORMAT_UNSIGNED_BC4 = ccuda.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_UNSIGNED_BC4{{endif}} - {{if 'CU_RES_VIEW_FORMAT_SIGNED_BC4' in found_values}} - #: Block compressed 4 signed - CU_RES_VIEW_FORMAT_SIGNED_BC4 = ccuda.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_SIGNED_BC4{{endif}} - {{if 'CU_RES_VIEW_FORMAT_UNSIGNED_BC5' in found_values}} + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_NUMSLICES = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_NUMSLICES, + 'Deprecated, use CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_LAYERS\n' + ) - #: Block compressed 5 unsigned - CU_RES_VIEW_FORMAT_UNSIGNED_BC5 = ccuda.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_UNSIGNED_BC5{{endif}} - {{if 'CU_RES_VIEW_FORMAT_SIGNED_BC5' in found_values}} - #: Block compressed 5 signed - CU_RES_VIEW_FORMAT_SIGNED_BC5 = ccuda.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_SIGNED_BC5{{endif}} - {{if 'CU_RES_VIEW_FORMAT_UNSIGNED_BC6H' in found_values}} + CU_DEVICE_ATTRIBUTE_SURFACE_ALIGNMENT = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_SURFACE_ALIGNMENT, + 'Alignment requirement for surfaces\n' + ) - #: Block compressed 6 unsigned half-float - CU_RES_VIEW_FORMAT_UNSIGNED_BC6H = ccuda.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_UNSIGNED_BC6H{{endif}} - {{if 'CU_RES_VIEW_FORMAT_SIGNED_BC6H' in found_values}} - #: Block compressed 6 signed half-float - CU_RES_VIEW_FORMAT_SIGNED_BC6H = ccuda.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_SIGNED_BC6H{{endif}} - {{if 'CU_RES_VIEW_FORMAT_UNSIGNED_BC7' in found_values}} + CU_DEVICE_ATTRIBUTE_CONCURRENT_KERNELS = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_CONCURRENT_KERNELS, + 'Device can possibly execute multiple kernels concurrently\n' + ) - #: Block compressed 7 - CU_RES_VIEW_FORMAT_UNSIGNED_BC7 = ccuda.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_UNSIGNED_BC7{{endif}} -{{endif}} -{{if 'CUtensorMapDataType_enum' in found_types}} -class CUtensorMapDataType(IntEnum): - """ - Tensor map data type - """ - {{if 'CU_TENSOR_MAP_DATA_TYPE_UINT8' in found_values}} - CU_TENSOR_MAP_DATA_TYPE_UINT8 = ccuda.CUtensorMapDataType_enum.CU_TENSOR_MAP_DATA_TYPE_UINT8{{endif}} - {{if 'CU_TENSOR_MAP_DATA_TYPE_UINT16' in found_values}} - CU_TENSOR_MAP_DATA_TYPE_UINT16 = ccuda.CUtensorMapDataType_enum.CU_TENSOR_MAP_DATA_TYPE_UINT16{{endif}} - {{if 'CU_TENSOR_MAP_DATA_TYPE_UINT32' in found_values}} - CU_TENSOR_MAP_DATA_TYPE_UINT32 = ccuda.CUtensorMapDataType_enum.CU_TENSOR_MAP_DATA_TYPE_UINT32{{endif}} - {{if 'CU_TENSOR_MAP_DATA_TYPE_INT32' in found_values}} - CU_TENSOR_MAP_DATA_TYPE_INT32 = ccuda.CUtensorMapDataType_enum.CU_TENSOR_MAP_DATA_TYPE_INT32{{endif}} - {{if 'CU_TENSOR_MAP_DATA_TYPE_UINT64' in found_values}} - CU_TENSOR_MAP_DATA_TYPE_UINT64 = ccuda.CUtensorMapDataType_enum.CU_TENSOR_MAP_DATA_TYPE_UINT64{{endif}} - {{if 'CU_TENSOR_MAP_DATA_TYPE_INT64' in found_values}} - CU_TENSOR_MAP_DATA_TYPE_INT64 = ccuda.CUtensorMapDataType_enum.CU_TENSOR_MAP_DATA_TYPE_INT64{{endif}} - {{if 'CU_TENSOR_MAP_DATA_TYPE_FLOAT16' in found_values}} - CU_TENSOR_MAP_DATA_TYPE_FLOAT16 = ccuda.CUtensorMapDataType_enum.CU_TENSOR_MAP_DATA_TYPE_FLOAT16{{endif}} - {{if 'CU_TENSOR_MAP_DATA_TYPE_FLOAT32' in found_values}} - CU_TENSOR_MAP_DATA_TYPE_FLOAT32 = ccuda.CUtensorMapDataType_enum.CU_TENSOR_MAP_DATA_TYPE_FLOAT32{{endif}} - {{if 'CU_TENSOR_MAP_DATA_TYPE_FLOAT64' in found_values}} - CU_TENSOR_MAP_DATA_TYPE_FLOAT64 = ccuda.CUtensorMapDataType_enum.CU_TENSOR_MAP_DATA_TYPE_FLOAT64{{endif}} - {{if 'CU_TENSOR_MAP_DATA_TYPE_BFLOAT16' in found_values}} - CU_TENSOR_MAP_DATA_TYPE_BFLOAT16 = ccuda.CUtensorMapDataType_enum.CU_TENSOR_MAP_DATA_TYPE_BFLOAT16{{endif}} - {{if 'CU_TENSOR_MAP_DATA_TYPE_FLOAT32_FTZ' in found_values}} - CU_TENSOR_MAP_DATA_TYPE_FLOAT32_FTZ = ccuda.CUtensorMapDataType_enum.CU_TENSOR_MAP_DATA_TYPE_FLOAT32_FTZ{{endif}} - {{if 'CU_TENSOR_MAP_DATA_TYPE_TFLOAT32' in found_values}} - CU_TENSOR_MAP_DATA_TYPE_TFLOAT32 = ccuda.CUtensorMapDataType_enum.CU_TENSOR_MAP_DATA_TYPE_TFLOAT32{{endif}} - {{if 'CU_TENSOR_MAP_DATA_TYPE_TFLOAT32_FTZ' in found_values}} - CU_TENSOR_MAP_DATA_TYPE_TFLOAT32_FTZ = ccuda.CUtensorMapDataType_enum.CU_TENSOR_MAP_DATA_TYPE_TFLOAT32_FTZ{{endif}} -{{endif}} -{{if 'CUtensorMapInterleave_enum' in found_types}} - -class CUtensorMapInterleave(IntEnum): - """ - Tensor map interleave layout type - """ - {{if 'CU_TENSOR_MAP_INTERLEAVE_NONE' in found_values}} - CU_TENSOR_MAP_INTERLEAVE_NONE = ccuda.CUtensorMapInterleave_enum.CU_TENSOR_MAP_INTERLEAVE_NONE{{endif}} - {{if 'CU_TENSOR_MAP_INTERLEAVE_16B' in found_values}} - CU_TENSOR_MAP_INTERLEAVE_16B = ccuda.CUtensorMapInterleave_enum.CU_TENSOR_MAP_INTERLEAVE_16B{{endif}} - {{if 'CU_TENSOR_MAP_INTERLEAVE_32B' in found_values}} - CU_TENSOR_MAP_INTERLEAVE_32B = ccuda.CUtensorMapInterleave_enum.CU_TENSOR_MAP_INTERLEAVE_32B{{endif}} -{{endif}} -{{if 'CUtensorMapSwizzle_enum' in found_types}} + CU_DEVICE_ATTRIBUTE_ECC_ENABLED = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_ECC_ENABLED, + 'Device has ECC support enabled\n' + ) -class CUtensorMapSwizzle(IntEnum): - """ - Tensor map swizzling mode of shared memory banks - """ - {{if 'CU_TENSOR_MAP_SWIZZLE_NONE' in found_values}} - CU_TENSOR_MAP_SWIZZLE_NONE = ccuda.CUtensorMapSwizzle_enum.CU_TENSOR_MAP_SWIZZLE_NONE{{endif}} - {{if 'CU_TENSOR_MAP_SWIZZLE_32B' in found_values}} - CU_TENSOR_MAP_SWIZZLE_32B = ccuda.CUtensorMapSwizzle_enum.CU_TENSOR_MAP_SWIZZLE_32B{{endif}} - {{if 'CU_TENSOR_MAP_SWIZZLE_64B' in found_values}} - CU_TENSOR_MAP_SWIZZLE_64B = ccuda.CUtensorMapSwizzle_enum.CU_TENSOR_MAP_SWIZZLE_64B{{endif}} - {{if 'CU_TENSOR_MAP_SWIZZLE_128B' in found_values}} - CU_TENSOR_MAP_SWIZZLE_128B = ccuda.CUtensorMapSwizzle_enum.CU_TENSOR_MAP_SWIZZLE_128B{{endif}} -{{endif}} -{{if 'CUtensorMapL2promotion_enum' in found_types}} -class CUtensorMapL2promotion(IntEnum): - """ - Tensor map L2 promotion type - """ - {{if 'CU_TENSOR_MAP_L2_PROMOTION_NONE' in found_values}} - CU_TENSOR_MAP_L2_PROMOTION_NONE = ccuda.CUtensorMapL2promotion_enum.CU_TENSOR_MAP_L2_PROMOTION_NONE{{endif}} - {{if 'CU_TENSOR_MAP_L2_PROMOTION_L2_64B' in found_values}} - CU_TENSOR_MAP_L2_PROMOTION_L2_64B = ccuda.CUtensorMapL2promotion_enum.CU_TENSOR_MAP_L2_PROMOTION_L2_64B{{endif}} - {{if 'CU_TENSOR_MAP_L2_PROMOTION_L2_128B' in found_values}} - CU_TENSOR_MAP_L2_PROMOTION_L2_128B = ccuda.CUtensorMapL2promotion_enum.CU_TENSOR_MAP_L2_PROMOTION_L2_128B{{endif}} - {{if 'CU_TENSOR_MAP_L2_PROMOTION_L2_256B' in found_values}} - CU_TENSOR_MAP_L2_PROMOTION_L2_256B = ccuda.CUtensorMapL2promotion_enum.CU_TENSOR_MAP_L2_PROMOTION_L2_256B{{endif}} -{{endif}} -{{if 'CUtensorMapFloatOOBfill_enum' in found_types}} + CU_DEVICE_ATTRIBUTE_PCI_BUS_ID = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_PCI_BUS_ID, + 'PCI bus ID of the device\n' + ) -class CUtensorMapFloatOOBfill(IntEnum): - """ - Tensor map out-of-bounds fill type - """ - {{if 'CU_TENSOR_MAP_FLOAT_OOB_FILL_NONE' in found_values}} - CU_TENSOR_MAP_FLOAT_OOB_FILL_NONE = ccuda.CUtensorMapFloatOOBfill_enum.CU_TENSOR_MAP_FLOAT_OOB_FILL_NONE{{endif}} - {{if 'CU_TENSOR_MAP_FLOAT_OOB_FILL_NAN_REQUEST_ZERO_FMA' in found_values}} - CU_TENSOR_MAP_FLOAT_OOB_FILL_NAN_REQUEST_ZERO_FMA = ccuda.CUtensorMapFloatOOBfill_enum.CU_TENSOR_MAP_FLOAT_OOB_FILL_NAN_REQUEST_ZERO_FMA{{endif}} -{{endif}} -{{if 'CUDA_POINTER_ATTRIBUTE_ACCESS_FLAGS_enum' in found_types}} -class CUDA_POINTER_ATTRIBUTE_ACCESS_FLAGS(IntEnum): - """ - Access flags that specify the level of access the current context's - device has on the memory referenced. - """ - {{if 'CU_POINTER_ATTRIBUTE_ACCESS_FLAG_NONE' in found_values}} + CU_DEVICE_ATTRIBUTE_PCI_DEVICE_ID = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_PCI_DEVICE_ID, + 'PCI device ID of the device\n' + ) - #: No access, meaning the device cannot access this memory at all, thus - #: must be staged through accessible memory in order to complete - #: certain operations - CU_POINTER_ATTRIBUTE_ACCESS_FLAG_NONE = ccuda.CUDA_POINTER_ATTRIBUTE_ACCESS_FLAGS_enum.CU_POINTER_ATTRIBUTE_ACCESS_FLAG_NONE{{endif}} - {{if 'CU_POINTER_ATTRIBUTE_ACCESS_FLAG_READ' in found_values}} - #: Read-only access, meaning writes to this memory are considered - #: invalid accesses and thus return error in that case. - CU_POINTER_ATTRIBUTE_ACCESS_FLAG_READ = ccuda.CUDA_POINTER_ATTRIBUTE_ACCESS_FLAGS_enum.CU_POINTER_ATTRIBUTE_ACCESS_FLAG_READ{{endif}} - {{if 'CU_POINTER_ATTRIBUTE_ACCESS_FLAG_READWRITE' in found_values}} + CU_DEVICE_ATTRIBUTE_TCC_DRIVER = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_TCC_DRIVER, + 'Device is using TCC driver model\n' + ) - #: Read-write access, the device has full read-write access to the - #: memory - CU_POINTER_ATTRIBUTE_ACCESS_FLAG_READWRITE = ccuda.CUDA_POINTER_ATTRIBUTE_ACCESS_FLAGS_enum.CU_POINTER_ATTRIBUTE_ACCESS_FLAG_READWRITE{{endif}} -{{endif}} -{{if 'CUexternalMemoryHandleType_enum' in found_types}} -class CUexternalMemoryHandleType(IntEnum): - """ - External memory handle types - """ - {{if 'CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD' in found_values}} + CU_DEVICE_ATTRIBUTE_MEMORY_CLOCK_RATE = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MEMORY_CLOCK_RATE, + 'Peak memory clock frequency in kilohertz\n' + ) - #: Handle is an opaque file descriptor - CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD = ccuda.CUexternalMemoryHandleType_enum.CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD{{endif}} - {{if 'CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32' in found_values}} - #: Handle is an opaque shared NT handle - CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32 = ccuda.CUexternalMemoryHandleType_enum.CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32{{endif}} - {{if 'CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT' in found_values}} + CU_DEVICE_ATTRIBUTE_GLOBAL_MEMORY_BUS_WIDTH = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_GLOBAL_MEMORY_BUS_WIDTH, + 'Global memory bus width in bits\n' + ) - #: Handle is an opaque, globally shared handle - CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT = ccuda.CUexternalMemoryHandleType_enum.CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT{{endif}} - {{if 'CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP' in found_values}} - #: Handle is a D3D12 heap object - CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP = ccuda.CUexternalMemoryHandleType_enum.CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP{{endif}} - {{if 'CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE' in found_values}} + CU_DEVICE_ATTRIBUTE_L2_CACHE_SIZE = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_L2_CACHE_SIZE, + 'Size of L2 cache in bytes\n' + ) - #: Handle is a D3D12 committed resource - CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE = ccuda.CUexternalMemoryHandleType_enum.CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE{{endif}} - {{if 'CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE' in found_values}} - #: Handle is a shared NT handle to a D3D11 resource - CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE = ccuda.CUexternalMemoryHandleType_enum.CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE{{endif}} - {{if 'CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE_KMT' in found_values}} + CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_MULTIPROCESSOR = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_MULTIPROCESSOR, + 'Maximum resident threads per multiprocessor\n' + ) - #: Handle is a globally shared handle to a D3D11 resource - CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE_KMT = ccuda.CUexternalMemoryHandleType_enum.CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE_KMT{{endif}} - {{if 'CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF' in found_values}} - #: Handle is an NvSciBuf object - CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF = ccuda.CUexternalMemoryHandleType_enum.CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF{{endif}} -{{endif}} -{{if 'CUexternalSemaphoreHandleType_enum' in found_types}} + CU_DEVICE_ATTRIBUTE_ASYNC_ENGINE_COUNT = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_ASYNC_ENGINE_COUNT, + 'Number of asynchronous engines\n' + ) -class CUexternalSemaphoreHandleType(IntEnum): - """ - External semaphore handle types - """ - {{if 'CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD' in found_values}} - #: Handle is an opaque file descriptor - CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD = ccuda.CUexternalSemaphoreHandleType_enum.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD{{endif}} - {{if 'CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32' in found_values}} + CU_DEVICE_ATTRIBUTE_UNIFIED_ADDRESSING = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_UNIFIED_ADDRESSING, + 'Device shares a unified address space with the host\n' + ) - #: Handle is an opaque shared NT handle - CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32 = ccuda.CUexternalSemaphoreHandleType_enum.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32{{endif}} - {{if 'CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT' in found_values}} - #: Handle is an opaque, globally shared handle - CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT = ccuda.CUexternalSemaphoreHandleType_enum.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT{{endif}} - {{if 'CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE' in found_values}} + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LAYERED_WIDTH = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LAYERED_WIDTH, + 'Maximum 1D layered texture width\n' + ) - #: Handle is a shared NT handle referencing a D3D12 fence object - CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE = ccuda.CUexternalSemaphoreHandleType_enum.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE{{endif}} - {{if 'CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_FENCE' in found_values}} - #: Handle is a shared NT handle referencing a D3D11 fence object - CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_FENCE = ccuda.CUexternalSemaphoreHandleType_enum.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_FENCE{{endif}} - {{if 'CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC' in found_values}} + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LAYERED_LAYERS = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LAYERED_LAYERS, + 'Maximum layers in a 1D layered texture\n' + ) - #: Opaque handle to NvSciSync Object - CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC = ccuda.CUexternalSemaphoreHandleType_enum.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC{{endif}} - {{if 'CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX' in found_values}} - #: Handle is a shared NT handle referencing a D3D11 keyed mutex object - CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX = ccuda.CUexternalSemaphoreHandleType_enum.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX{{endif}} - {{if 'CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX_KMT' in found_values}} + CU_DEVICE_ATTRIBUTE_CAN_TEX2D_GATHER = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_CAN_TEX2D_GATHER, + 'Deprecated, do not use.\n' + ) - #: Handle is a globally shared handle referencing a D3D11 keyed mutex - #: object - CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX_KMT = ccuda.CUexternalSemaphoreHandleType_enum.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX_KMT{{endif}} - {{if 'CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_FD' in found_values}} - #: Handle is an opaque file descriptor referencing a timeline semaphore - CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_FD = ccuda.CUexternalSemaphoreHandleType_enum.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_FD{{endif}} - {{if 'CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_WIN32' in found_values}} + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_GATHER_WIDTH = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_GATHER_WIDTH, + 'Maximum 2D texture width if CUDA_ARRAY3D_TEXTURE_GATHER is set\n' + ) - #: Handle is an opaque shared NT handle referencing a timeline - #: semaphore - CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_WIN32 = ccuda.CUexternalSemaphoreHandleType_enum.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_WIN32{{endif}} -{{endif}} -{{if 'CUmemAllocationHandleType_enum' in found_types}} -class CUmemAllocationHandleType(IntEnum): - """ - Flags for specifying particular handle types - """ - {{if 'CU_MEM_HANDLE_TYPE_NONE' in found_values}} + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_GATHER_HEIGHT = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_GATHER_HEIGHT, + 'Maximum 2D texture height if CUDA_ARRAY3D_TEXTURE_GATHER is set\n' + ) - #: Does not allow any export mechanism. > - CU_MEM_HANDLE_TYPE_NONE = ccuda.CUmemAllocationHandleType_enum.CU_MEM_HANDLE_TYPE_NONE{{endif}} - {{if 'CU_MEM_HANDLE_TYPE_POSIX_FILE_DESCRIPTOR' in found_values}} - #: Allows a file descriptor to be used for exporting. Permitted only on - #: POSIX systems. (int) - CU_MEM_HANDLE_TYPE_POSIX_FILE_DESCRIPTOR = ccuda.CUmemAllocationHandleType_enum.CU_MEM_HANDLE_TYPE_POSIX_FILE_DESCRIPTOR{{endif}} - {{if 'CU_MEM_HANDLE_TYPE_WIN32' in found_values}} + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_WIDTH_ALTERNATE = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_WIDTH_ALTERNATE, + 'Alternate maximum 3D texture width\n' + ) - #: Allows a Win32 NT handle to be used for exporting. (HANDLE) - CU_MEM_HANDLE_TYPE_WIN32 = ccuda.CUmemAllocationHandleType_enum.CU_MEM_HANDLE_TYPE_WIN32{{endif}} - {{if 'CU_MEM_HANDLE_TYPE_WIN32_KMT' in found_values}} - #: Allows a Win32 KMT handle to be used for exporting. (D3DKMT_HANDLE) - CU_MEM_HANDLE_TYPE_WIN32_KMT = ccuda.CUmemAllocationHandleType_enum.CU_MEM_HANDLE_TYPE_WIN32_KMT{{endif}} - {{if 'CU_MEM_HANDLE_TYPE_FABRIC' in found_values}} + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_HEIGHT_ALTERNATE = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_HEIGHT_ALTERNATE, + 'Alternate maximum 3D texture height\n' + ) - #: Allows a fabric handle to be used for exporting. (CUmemFabricHandle) - CU_MEM_HANDLE_TYPE_FABRIC = ccuda.CUmemAllocationHandleType_enum.CU_MEM_HANDLE_TYPE_FABRIC{{endif}} - {{if 'CU_MEM_HANDLE_TYPE_MAX' in found_values}} - CU_MEM_HANDLE_TYPE_MAX = ccuda.CUmemAllocationHandleType_enum.CU_MEM_HANDLE_TYPE_MAX{{endif}} -{{endif}} -{{if 'CUmemAccess_flags_enum' in found_types}} -class CUmemAccess_flags(IntEnum): - """ - Specifies the memory protection flags for mapping. - """ - {{if 'CU_MEM_ACCESS_FLAGS_PROT_NONE' in found_values}} + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_DEPTH_ALTERNATE = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_DEPTH_ALTERNATE, + 'Alternate maximum 3D texture depth\n' + ) - #: Default, make the address range not accessible - CU_MEM_ACCESS_FLAGS_PROT_NONE = ccuda.CUmemAccess_flags_enum.CU_MEM_ACCESS_FLAGS_PROT_NONE{{endif}} - {{if 'CU_MEM_ACCESS_FLAGS_PROT_READ' in found_values}} - #: Make the address range read accessible - CU_MEM_ACCESS_FLAGS_PROT_READ = ccuda.CUmemAccess_flags_enum.CU_MEM_ACCESS_FLAGS_PROT_READ{{endif}} - {{if 'CU_MEM_ACCESS_FLAGS_PROT_READWRITE' in found_values}} + CU_DEVICE_ATTRIBUTE_PCI_DOMAIN_ID = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_PCI_DOMAIN_ID, + 'PCI domain ID of the device\n' + ) - #: Make the address range read-write accessible - CU_MEM_ACCESS_FLAGS_PROT_READWRITE = ccuda.CUmemAccess_flags_enum.CU_MEM_ACCESS_FLAGS_PROT_READWRITE{{endif}} - {{if 'CU_MEM_ACCESS_FLAGS_PROT_MAX' in found_values}} - CU_MEM_ACCESS_FLAGS_PROT_MAX = ccuda.CUmemAccess_flags_enum.CU_MEM_ACCESS_FLAGS_PROT_MAX{{endif}} -{{endif}} -{{if 'CUmemLocationType_enum' in found_types}} -class CUmemLocationType(IntEnum): - """ - Specifies the type of location - """ - {{if 'CU_MEM_LOCATION_TYPE_INVALID' in found_values}} - CU_MEM_LOCATION_TYPE_INVALID = ccuda.CUmemLocationType_enum.CU_MEM_LOCATION_TYPE_INVALID{{endif}} - {{if 'CU_MEM_LOCATION_TYPE_DEVICE' in found_values}} + CU_DEVICE_ATTRIBUTE_TEXTURE_PITCH_ALIGNMENT = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_TEXTURE_PITCH_ALIGNMENT, + 'Pitch alignment requirement for textures\n' + ) - #: Location is a device location, thus id is a device ordinal - CU_MEM_LOCATION_TYPE_DEVICE = ccuda.CUmemLocationType_enum.CU_MEM_LOCATION_TYPE_DEVICE{{endif}} - {{if 'CU_MEM_LOCATION_TYPE_HOST' in found_values}} - #: Location is host, id is ignored - CU_MEM_LOCATION_TYPE_HOST = ccuda.CUmemLocationType_enum.CU_MEM_LOCATION_TYPE_HOST{{endif}} - {{if 'CU_MEM_LOCATION_TYPE_HOST_NUMA' in found_values}} + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_WIDTH = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_WIDTH, + 'Maximum cubemap texture width/height\n' + ) - #: Location is a host NUMA node, thus id is a host NUMA node id - CU_MEM_LOCATION_TYPE_HOST_NUMA = ccuda.CUmemLocationType_enum.CU_MEM_LOCATION_TYPE_HOST_NUMA{{endif}} - {{if 'CU_MEM_LOCATION_TYPE_HOST_NUMA_CURRENT' in found_values}} - #: Location is a host NUMA node of the current thread, id is ignored - CU_MEM_LOCATION_TYPE_HOST_NUMA_CURRENT = ccuda.CUmemLocationType_enum.CU_MEM_LOCATION_TYPE_HOST_NUMA_CURRENT{{endif}} - {{if 'CU_MEM_LOCATION_TYPE_MAX' in found_values}} - CU_MEM_LOCATION_TYPE_MAX = ccuda.CUmemLocationType_enum.CU_MEM_LOCATION_TYPE_MAX{{endif}} -{{endif}} -{{if 'CUmemAllocationType_enum' in found_types}} + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_LAYERED_WIDTH = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_LAYERED_WIDTH, + 'Maximum cubemap layered texture width/height\n' + ) -class CUmemAllocationType(IntEnum): - """ - Defines the allocation types available - """ - {{if 'CU_MEM_ALLOCATION_TYPE_INVALID' in found_values}} - CU_MEM_ALLOCATION_TYPE_INVALID = ccuda.CUmemAllocationType_enum.CU_MEM_ALLOCATION_TYPE_INVALID{{endif}} - {{if 'CU_MEM_ALLOCATION_TYPE_PINNED' in found_values}} - #: This allocation type is 'pinned', i.e. cannot migrate from its - #: current location while the application is actively using it - CU_MEM_ALLOCATION_TYPE_PINNED = ccuda.CUmemAllocationType_enum.CU_MEM_ALLOCATION_TYPE_PINNED{{endif}} - {{if 'CU_MEM_ALLOCATION_TYPE_MAX' in found_values}} - CU_MEM_ALLOCATION_TYPE_MAX = ccuda.CUmemAllocationType_enum.CU_MEM_ALLOCATION_TYPE_MAX{{endif}} -{{endif}} -{{if 'CUmemAllocationGranularity_flags_enum' in found_types}} + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_LAYERED_LAYERS = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_LAYERED_LAYERS, + 'Maximum layers in a cubemap layered texture\n' + ) -class CUmemAllocationGranularity_flags(IntEnum): - """ - Flag for requesting different optimal and required granularities - for an allocation. - """ - {{if 'CU_MEM_ALLOC_GRANULARITY_MINIMUM' in found_values}} - #: Minimum required granularity for allocation - CU_MEM_ALLOC_GRANULARITY_MINIMUM = ccuda.CUmemAllocationGranularity_flags_enum.CU_MEM_ALLOC_GRANULARITY_MINIMUM{{endif}} - {{if 'CU_MEM_ALLOC_GRANULARITY_RECOMMENDED' in found_values}} + CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_WIDTH = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_WIDTH, + 'Maximum 1D surface width\n' + ) - #: Recommended granularity for allocation for best performance - CU_MEM_ALLOC_GRANULARITY_RECOMMENDED = ccuda.CUmemAllocationGranularity_flags_enum.CU_MEM_ALLOC_GRANULARITY_RECOMMENDED{{endif}} -{{endif}} -{{if 'CUmemRangeHandleType_enum' in found_types}} -class CUmemRangeHandleType(IntEnum): - """ - Specifies the handle type for address range - """ - {{if 'CU_MEM_RANGE_HANDLE_TYPE_DMA_BUF_FD' in found_values}} - CU_MEM_RANGE_HANDLE_TYPE_DMA_BUF_FD = ccuda.CUmemRangeHandleType_enum.CU_MEM_RANGE_HANDLE_TYPE_DMA_BUF_FD{{endif}} - {{if 'CU_MEM_RANGE_HANDLE_TYPE_MAX' in found_values}} - CU_MEM_RANGE_HANDLE_TYPE_MAX = ccuda.CUmemRangeHandleType_enum.CU_MEM_RANGE_HANDLE_TYPE_MAX{{endif}} -{{endif}} -{{if 'CUarraySparseSubresourceType_enum' in found_types}} + CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_WIDTH = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_WIDTH, + 'Maximum 2D surface width\n' + ) -class CUarraySparseSubresourceType(IntEnum): - """ - Sparse subresource types - """ - {{if 'CU_ARRAY_SPARSE_SUBRESOURCE_TYPE_SPARSE_LEVEL' in found_values}} - CU_ARRAY_SPARSE_SUBRESOURCE_TYPE_SPARSE_LEVEL = ccuda.CUarraySparseSubresourceType_enum.CU_ARRAY_SPARSE_SUBRESOURCE_TYPE_SPARSE_LEVEL{{endif}} - {{if 'CU_ARRAY_SPARSE_SUBRESOURCE_TYPE_MIPTAIL' in found_values}} - CU_ARRAY_SPARSE_SUBRESOURCE_TYPE_MIPTAIL = ccuda.CUarraySparseSubresourceType_enum.CU_ARRAY_SPARSE_SUBRESOURCE_TYPE_MIPTAIL{{endif}} -{{endif}} -{{if 'CUmemOperationType_enum' in found_types}} -class CUmemOperationType(IntEnum): - """ - Memory operation types - """ - {{if 'CU_MEM_OPERATION_TYPE_MAP' in found_values}} - CU_MEM_OPERATION_TYPE_MAP = ccuda.CUmemOperationType_enum.CU_MEM_OPERATION_TYPE_MAP{{endif}} - {{if 'CU_MEM_OPERATION_TYPE_UNMAP' in found_values}} - CU_MEM_OPERATION_TYPE_UNMAP = ccuda.CUmemOperationType_enum.CU_MEM_OPERATION_TYPE_UNMAP{{endif}} -{{endif}} -{{if 'CUmemHandleType_enum' in found_types}} + CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_HEIGHT = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_HEIGHT, + 'Maximum 2D surface height\n' + ) -class CUmemHandleType(IntEnum): - """ - Memory handle types - """ - {{if 'CU_MEM_HANDLE_TYPE_GENERIC' in found_values}} - CU_MEM_HANDLE_TYPE_GENERIC = ccuda.CUmemHandleType_enum.CU_MEM_HANDLE_TYPE_GENERIC{{endif}} -{{endif}} -{{if 'CUmemAllocationCompType_enum' in found_types}} -class CUmemAllocationCompType(IntEnum): - """ - Specifies compression attribute for an allocation. - """ - {{if 'CU_MEM_ALLOCATION_COMP_NONE' in found_values}} + CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_WIDTH = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_WIDTH, + 'Maximum 3D surface width\n' + ) - #: Allocating non-compressible memory - CU_MEM_ALLOCATION_COMP_NONE = ccuda.CUmemAllocationCompType_enum.CU_MEM_ALLOCATION_COMP_NONE{{endif}} - {{if 'CU_MEM_ALLOCATION_COMP_GENERIC' in found_values}} - #: Allocating compressible memory - CU_MEM_ALLOCATION_COMP_GENERIC = ccuda.CUmemAllocationCompType_enum.CU_MEM_ALLOCATION_COMP_GENERIC{{endif}} -{{endif}} -{{if 'CUmulticastGranularity_flags_enum' in found_types}} + CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_HEIGHT = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_HEIGHT, + 'Maximum 3D surface height\n' + ) -class CUmulticastGranularity_flags(IntEnum): - """ - Flags for querying different granularities for a multicast object - """ - {{if 'CU_MULTICAST_GRANULARITY_MINIMUM' in found_values}} - #: Minimum required granularity - CU_MULTICAST_GRANULARITY_MINIMUM = ccuda.CUmulticastGranularity_flags_enum.CU_MULTICAST_GRANULARITY_MINIMUM{{endif}} - {{if 'CU_MULTICAST_GRANULARITY_RECOMMENDED' in found_values}} + CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_DEPTH = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_DEPTH, + 'Maximum 3D surface depth\n' + ) - #: Recommended granularity for best performance - CU_MULTICAST_GRANULARITY_RECOMMENDED = ccuda.CUmulticastGranularity_flags_enum.CU_MULTICAST_GRANULARITY_RECOMMENDED{{endif}} -{{endif}} -{{if 'CUgraphExecUpdateResult_enum' in found_types}} -class CUgraphExecUpdateResult(IntEnum): - """ - CUDA Graph Update error types - """ - {{if 'CU_GRAPH_EXEC_UPDATE_SUCCESS' in found_values}} + CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_LAYERED_WIDTH = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_LAYERED_WIDTH, + 'Maximum 1D layered surface width\n' + ) - #: The update succeeded - CU_GRAPH_EXEC_UPDATE_SUCCESS = ccuda.CUgraphExecUpdateResult_enum.CU_GRAPH_EXEC_UPDATE_SUCCESS{{endif}} - {{if 'CU_GRAPH_EXEC_UPDATE_ERROR' in found_values}} - #: The update failed for an unexpected reason which is described in the - #: return value of the function - CU_GRAPH_EXEC_UPDATE_ERROR = ccuda.CUgraphExecUpdateResult_enum.CU_GRAPH_EXEC_UPDATE_ERROR{{endif}} - {{if 'CU_GRAPH_EXEC_UPDATE_ERROR_TOPOLOGY_CHANGED' in found_values}} + CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_LAYERED_LAYERS = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_LAYERED_LAYERS, + 'Maximum layers in a 1D layered surface\n' + ) - #: The update failed because the topology changed - CU_GRAPH_EXEC_UPDATE_ERROR_TOPOLOGY_CHANGED = ccuda.CUgraphExecUpdateResult_enum.CU_GRAPH_EXEC_UPDATE_ERROR_TOPOLOGY_CHANGED{{endif}} - {{if 'CU_GRAPH_EXEC_UPDATE_ERROR_NODE_TYPE_CHANGED' in found_values}} - #: The update failed because a node type changed - CU_GRAPH_EXEC_UPDATE_ERROR_NODE_TYPE_CHANGED = ccuda.CUgraphExecUpdateResult_enum.CU_GRAPH_EXEC_UPDATE_ERROR_NODE_TYPE_CHANGED{{endif}} - {{if 'CU_GRAPH_EXEC_UPDATE_ERROR_FUNCTION_CHANGED' in found_values}} + CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_WIDTH = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_WIDTH, + 'Maximum 2D layered surface width\n' + ) - #: The update failed because the function of a kernel node changed - #: (CUDA driver < 11.2) - CU_GRAPH_EXEC_UPDATE_ERROR_FUNCTION_CHANGED = ccuda.CUgraphExecUpdateResult_enum.CU_GRAPH_EXEC_UPDATE_ERROR_FUNCTION_CHANGED{{endif}} - {{if 'CU_GRAPH_EXEC_UPDATE_ERROR_PARAMETERS_CHANGED' in found_values}} - #: The update failed because the parameters changed in a way that is - #: not supported - CU_GRAPH_EXEC_UPDATE_ERROR_PARAMETERS_CHANGED = ccuda.CUgraphExecUpdateResult_enum.CU_GRAPH_EXEC_UPDATE_ERROR_PARAMETERS_CHANGED{{endif}} - {{if 'CU_GRAPH_EXEC_UPDATE_ERROR_NOT_SUPPORTED' in found_values}} + CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_HEIGHT = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_HEIGHT, + 'Maximum 2D layered surface height\n' + ) - #: The update failed because something about the node is not supported - CU_GRAPH_EXEC_UPDATE_ERROR_NOT_SUPPORTED = ccuda.CUgraphExecUpdateResult_enum.CU_GRAPH_EXEC_UPDATE_ERROR_NOT_SUPPORTED{{endif}} - {{if 'CU_GRAPH_EXEC_UPDATE_ERROR_UNSUPPORTED_FUNCTION_CHANGE' in found_values}} - #: The update failed because the function of a kernel node changed in - #: an unsupported way - CU_GRAPH_EXEC_UPDATE_ERROR_UNSUPPORTED_FUNCTION_CHANGE = ccuda.CUgraphExecUpdateResult_enum.CU_GRAPH_EXEC_UPDATE_ERROR_UNSUPPORTED_FUNCTION_CHANGE{{endif}} - {{if 'CU_GRAPH_EXEC_UPDATE_ERROR_ATTRIBUTES_CHANGED' in found_values}} + CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_LAYERS = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_LAYERS, + 'Maximum layers in a 2D layered surface\n' + ) - #: The update failed because the node attributes changed in a way that - #: is not supported - CU_GRAPH_EXEC_UPDATE_ERROR_ATTRIBUTES_CHANGED = ccuda.CUgraphExecUpdateResult_enum.CU_GRAPH_EXEC_UPDATE_ERROR_ATTRIBUTES_CHANGED{{endif}} -{{endif}} -{{if 'CUmemPool_attribute_enum' in found_types}} -class CUmemPool_attribute(IntEnum): - """ - CUDA memory pool attributes - """ - {{if 'CU_MEMPOOL_ATTR_REUSE_FOLLOW_EVENT_DEPENDENCIES' in found_values}} - - #: (value type = int) Allow cuMemAllocAsync to use memory - #: asynchronously freed in another streams as long as a stream ordering - #: dependency of the allocating stream on the free action exists. Cuda - #: events and null stream interactions can create the required stream - #: ordered dependencies. (default enabled) - CU_MEMPOOL_ATTR_REUSE_FOLLOW_EVENT_DEPENDENCIES = ccuda.CUmemPool_attribute_enum.CU_MEMPOOL_ATTR_REUSE_FOLLOW_EVENT_DEPENDENCIES{{endif}} - {{if 'CU_MEMPOOL_ATTR_REUSE_ALLOW_OPPORTUNISTIC' in found_values}} - - #: (value type = int) Allow reuse of already completed frees when there - #: is no dependency between the free and allocation. (default enabled) - CU_MEMPOOL_ATTR_REUSE_ALLOW_OPPORTUNISTIC = ccuda.CUmemPool_attribute_enum.CU_MEMPOOL_ATTR_REUSE_ALLOW_OPPORTUNISTIC{{endif}} - {{if 'CU_MEMPOOL_ATTR_REUSE_ALLOW_INTERNAL_DEPENDENCIES' in found_values}} - - #: (value type = int) Allow cuMemAllocAsync to insert new stream - #: dependencies in order to establish the stream ordering required to - #: reuse a piece of memory released by cuFreeAsync (default enabled). - CU_MEMPOOL_ATTR_REUSE_ALLOW_INTERNAL_DEPENDENCIES = ccuda.CUmemPool_attribute_enum.CU_MEMPOOL_ATTR_REUSE_ALLOW_INTERNAL_DEPENDENCIES{{endif}} - {{if 'CU_MEMPOOL_ATTR_RELEASE_THRESHOLD' in found_values}} - - #: (value type = cuuint64_t) Amount of reserved memory in bytes to hold - #: onto before trying to release memory back to the OS. When more than - #: the release threshold bytes of memory are held by the memory pool, - #: the allocator will try to release memory back to the OS on the next - #: call to stream, event or context synchronize. (default 0) - CU_MEMPOOL_ATTR_RELEASE_THRESHOLD = ccuda.CUmemPool_attribute_enum.CU_MEMPOOL_ATTR_RELEASE_THRESHOLD{{endif}} - {{if 'CU_MEMPOOL_ATTR_RESERVED_MEM_CURRENT' in found_values}} - - #: (value type = cuuint64_t) Amount of backing memory currently - #: allocated for the mempool. - CU_MEMPOOL_ATTR_RESERVED_MEM_CURRENT = ccuda.CUmemPool_attribute_enum.CU_MEMPOOL_ATTR_RESERVED_MEM_CURRENT{{endif}} - {{if 'CU_MEMPOOL_ATTR_RESERVED_MEM_HIGH' in found_values}} - - #: (value type = cuuint64_t) High watermark of backing memory allocated - #: for the mempool since the last time it was reset. High watermark can - #: only be reset to zero. - CU_MEMPOOL_ATTR_RESERVED_MEM_HIGH = ccuda.CUmemPool_attribute_enum.CU_MEMPOOL_ATTR_RESERVED_MEM_HIGH{{endif}} - {{if 'CU_MEMPOOL_ATTR_USED_MEM_CURRENT' in found_values}} - - #: (value type = cuuint64_t) Amount of memory from the pool that is - #: currently in use by the application. - CU_MEMPOOL_ATTR_USED_MEM_CURRENT = ccuda.CUmemPool_attribute_enum.CU_MEMPOOL_ATTR_USED_MEM_CURRENT{{endif}} - {{if 'CU_MEMPOOL_ATTR_USED_MEM_HIGH' in found_values}} - - #: (value type = cuuint64_t) High watermark of the amount of memory - #: from the pool that was in use by the application since the last time - #: it was reset. High watermark can only be reset to zero. - CU_MEMPOOL_ATTR_USED_MEM_HIGH = ccuda.CUmemPool_attribute_enum.CU_MEMPOOL_ATTR_USED_MEM_HIGH{{endif}} -{{endif}} -{{if 'CUgraphMem_attribute_enum' in found_types}} - -class CUgraphMem_attribute(IntEnum): - """ - - """ - {{if 'CU_GRAPH_MEM_ATTR_USED_MEM_CURRENT' in found_values}} - - #: (value type = cuuint64_t) Amount of memory, in bytes, currently - #: associated with graphs - CU_GRAPH_MEM_ATTR_USED_MEM_CURRENT = ccuda.CUgraphMem_attribute_enum.CU_GRAPH_MEM_ATTR_USED_MEM_CURRENT{{endif}} - {{if 'CU_GRAPH_MEM_ATTR_USED_MEM_HIGH' in found_values}} - - #: (value type = cuuint64_t) High watermark of memory, in bytes, - #: associated with graphs since the last time it was reset. High - #: watermark can only be reset to zero. - CU_GRAPH_MEM_ATTR_USED_MEM_HIGH = ccuda.CUgraphMem_attribute_enum.CU_GRAPH_MEM_ATTR_USED_MEM_HIGH{{endif}} - {{if 'CU_GRAPH_MEM_ATTR_RESERVED_MEM_CURRENT' in found_values}} - - #: (value type = cuuint64_t) Amount of memory, in bytes, currently - #: allocated for use by the CUDA graphs asynchronous allocator. - CU_GRAPH_MEM_ATTR_RESERVED_MEM_CURRENT = ccuda.CUgraphMem_attribute_enum.CU_GRAPH_MEM_ATTR_RESERVED_MEM_CURRENT{{endif}} - {{if 'CU_GRAPH_MEM_ATTR_RESERVED_MEM_HIGH' in found_values}} - - #: (value type = cuuint64_t) High watermark of memory, in bytes, - #: currently allocated for use by the CUDA graphs asynchronous - #: allocator. - CU_GRAPH_MEM_ATTR_RESERVED_MEM_HIGH = ccuda.CUgraphMem_attribute_enum.CU_GRAPH_MEM_ATTR_RESERVED_MEM_HIGH{{endif}} -{{endif}} -{{if 'CUflushGPUDirectRDMAWritesOptions_enum' in found_types}} - -class CUflushGPUDirectRDMAWritesOptions(IntEnum): - """ - Bitmasks for - :py:obj:`~.CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_FLUSH_WRITES_OPTIONS` - """ - {{if 'CU_FLUSH_GPU_DIRECT_RDMA_WRITES_OPTION_HOST' in found_values}} + CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_WIDTH = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_WIDTH, + 'Maximum cubemap surface width\n' + ) - #: :py:obj:`~.cuFlushGPUDirectRDMAWrites()` and its CUDA Runtime API - #: counterpart are supported on the device. - CU_FLUSH_GPU_DIRECT_RDMA_WRITES_OPTION_HOST = ccuda.CUflushGPUDirectRDMAWritesOptions_enum.CU_FLUSH_GPU_DIRECT_RDMA_WRITES_OPTION_HOST{{endif}} - {{if 'CU_FLUSH_GPU_DIRECT_RDMA_WRITES_OPTION_MEMOPS' in found_values}} - #: The :py:obj:`~.CU_STREAM_WAIT_VALUE_FLUSH` flag and the - #: :py:obj:`~.CU_STREAM_MEM_OP_FLUSH_REMOTE_WRITES` MemOp are supported - #: on the device. - CU_FLUSH_GPU_DIRECT_RDMA_WRITES_OPTION_MEMOPS = ccuda.CUflushGPUDirectRDMAWritesOptions_enum.CU_FLUSH_GPU_DIRECT_RDMA_WRITES_OPTION_MEMOPS{{endif}} -{{endif}} -{{if 'CUGPUDirectRDMAWritesOrdering_enum' in found_types}} + CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_LAYERED_WIDTH = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_LAYERED_WIDTH, + 'Maximum cubemap layered surface width\n' + ) -class CUGPUDirectRDMAWritesOrdering(IntEnum): - """ - Platform native ordering for GPUDirect RDMA writes - """ - {{if 'CU_GPU_DIRECT_RDMA_WRITES_ORDERING_NONE' in found_values}} - #: The device does not natively support ordering of remote writes. - #: :py:obj:`~.cuFlushGPUDirectRDMAWrites()` can be leveraged if - #: supported. - CU_GPU_DIRECT_RDMA_WRITES_ORDERING_NONE = ccuda.CUGPUDirectRDMAWritesOrdering_enum.CU_GPU_DIRECT_RDMA_WRITES_ORDERING_NONE{{endif}} - {{if 'CU_GPU_DIRECT_RDMA_WRITES_ORDERING_OWNER' in found_values}} + CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_LAYERED_LAYERS = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_LAYERED_LAYERS, + 'Maximum layers in a cubemap layered surface\n' + ) - #: Natively, the device can consistently consume remote writes, - #: although other CUDA devices may not. - CU_GPU_DIRECT_RDMA_WRITES_ORDERING_OWNER = ccuda.CUGPUDirectRDMAWritesOrdering_enum.CU_GPU_DIRECT_RDMA_WRITES_ORDERING_OWNER{{endif}} - {{if 'CU_GPU_DIRECT_RDMA_WRITES_ORDERING_ALL_DEVICES' in found_values}} - #: Any CUDA device in the system can consistently consume remote writes - #: to this device. - CU_GPU_DIRECT_RDMA_WRITES_ORDERING_ALL_DEVICES = ccuda.CUGPUDirectRDMAWritesOrdering_enum.CU_GPU_DIRECT_RDMA_WRITES_ORDERING_ALL_DEVICES{{endif}} -{{endif}} -{{if 'CUflushGPUDirectRDMAWritesScope_enum' in found_types}} + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LINEAR_WIDTH = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LINEAR_WIDTH, + 'Deprecated, do not use. Use cudaDeviceGetTexture1DLinearMaxWidth() or\n' + ':py:obj:`~.cuDeviceGetTexture1DLinearMaxWidth()` instead.\n' + ) -class CUflushGPUDirectRDMAWritesScope(IntEnum): - """ - The scopes for :py:obj:`~.cuFlushGPUDirectRDMAWrites` - """ - {{if 'CU_FLUSH_GPU_DIRECT_RDMA_WRITES_TO_OWNER' in found_values}} - #: Blocks until remote writes are visible to the CUDA device context - #: owning the data. - CU_FLUSH_GPU_DIRECT_RDMA_WRITES_TO_OWNER = ccuda.CUflushGPUDirectRDMAWritesScope_enum.CU_FLUSH_GPU_DIRECT_RDMA_WRITES_TO_OWNER{{endif}} - {{if 'CU_FLUSH_GPU_DIRECT_RDMA_WRITES_TO_ALL_DEVICES' in found_values}} + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_WIDTH = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_WIDTH, + 'Maximum 2D linear texture width\n' + ) - #: Blocks until remote writes are visible to all CUDA device contexts. - CU_FLUSH_GPU_DIRECT_RDMA_WRITES_TO_ALL_DEVICES = ccuda.CUflushGPUDirectRDMAWritesScope_enum.CU_FLUSH_GPU_DIRECT_RDMA_WRITES_TO_ALL_DEVICES{{endif}} -{{endif}} -{{if 'CUflushGPUDirectRDMAWritesTarget_enum' in found_types}} -class CUflushGPUDirectRDMAWritesTarget(IntEnum): - """ - The targets for :py:obj:`~.cuFlushGPUDirectRDMAWrites` - """ - {{if 'CU_FLUSH_GPU_DIRECT_RDMA_WRITES_TARGET_CURRENT_CTX' in found_values}} + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_HEIGHT = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_HEIGHT, + 'Maximum 2D linear texture height\n' + ) - #: Sets the target for :py:obj:`~.cuFlushGPUDirectRDMAWrites()` to the - #: currently active CUDA device context. - CU_FLUSH_GPU_DIRECT_RDMA_WRITES_TARGET_CURRENT_CTX = ccuda.CUflushGPUDirectRDMAWritesTarget_enum.CU_FLUSH_GPU_DIRECT_RDMA_WRITES_TARGET_CURRENT_CTX{{endif}} -{{endif}} -{{if 'CUgraphDebugDot_flags_enum' in found_types}} -class CUgraphDebugDot_flags(IntEnum): - """ - The additional write options for :py:obj:`~.cuGraphDebugDotPrint` - """ - {{if 'CU_GRAPH_DEBUG_DOT_FLAGS_VERBOSE' in found_values}} + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_PITCH = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_PITCH, + 'Maximum 2D linear texture pitch in bytes\n' + ) - #: Output all debug data as if every debug flag is enabled - CU_GRAPH_DEBUG_DOT_FLAGS_VERBOSE = ccuda.CUgraphDebugDot_flags_enum.CU_GRAPH_DEBUG_DOT_FLAGS_VERBOSE{{endif}} - {{if 'CU_GRAPH_DEBUG_DOT_FLAGS_RUNTIME_TYPES' in found_values}} - #: Use CUDA Runtime structures for output - CU_GRAPH_DEBUG_DOT_FLAGS_RUNTIME_TYPES = ccuda.CUgraphDebugDot_flags_enum.CU_GRAPH_DEBUG_DOT_FLAGS_RUNTIME_TYPES{{endif}} - {{if 'CU_GRAPH_DEBUG_DOT_FLAGS_KERNEL_NODE_PARAMS' in found_values}} + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_MIPMAPPED_WIDTH = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_MIPMAPPED_WIDTH, + 'Maximum mipmapped 2D texture width\n' + ) - #: Adds CUDA_KERNEL_NODE_PARAMS values to output - CU_GRAPH_DEBUG_DOT_FLAGS_KERNEL_NODE_PARAMS = ccuda.CUgraphDebugDot_flags_enum.CU_GRAPH_DEBUG_DOT_FLAGS_KERNEL_NODE_PARAMS{{endif}} - {{if 'CU_GRAPH_DEBUG_DOT_FLAGS_MEMCPY_NODE_PARAMS' in found_values}} - #: Adds CUDA_MEMCPY3D values to output - CU_GRAPH_DEBUG_DOT_FLAGS_MEMCPY_NODE_PARAMS = ccuda.CUgraphDebugDot_flags_enum.CU_GRAPH_DEBUG_DOT_FLAGS_MEMCPY_NODE_PARAMS{{endif}} - {{if 'CU_GRAPH_DEBUG_DOT_FLAGS_MEMSET_NODE_PARAMS' in found_values}} + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_MIPMAPPED_HEIGHT = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_MIPMAPPED_HEIGHT, + 'Maximum mipmapped 2D texture height\n' + ) - #: Adds CUDA_MEMSET_NODE_PARAMS values to output - CU_GRAPH_DEBUG_DOT_FLAGS_MEMSET_NODE_PARAMS = ccuda.CUgraphDebugDot_flags_enum.CU_GRAPH_DEBUG_DOT_FLAGS_MEMSET_NODE_PARAMS{{endif}} - {{if 'CU_GRAPH_DEBUG_DOT_FLAGS_HOST_NODE_PARAMS' in found_values}} - #: Adds CUDA_HOST_NODE_PARAMS values to output - CU_GRAPH_DEBUG_DOT_FLAGS_HOST_NODE_PARAMS = ccuda.CUgraphDebugDot_flags_enum.CU_GRAPH_DEBUG_DOT_FLAGS_HOST_NODE_PARAMS{{endif}} - {{if 'CU_GRAPH_DEBUG_DOT_FLAGS_EVENT_NODE_PARAMS' in found_values}} + CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR, + 'Major compute capability version number\n' + ) - #: Adds CUevent handle from record and wait nodes to output - CU_GRAPH_DEBUG_DOT_FLAGS_EVENT_NODE_PARAMS = ccuda.CUgraphDebugDot_flags_enum.CU_GRAPH_DEBUG_DOT_FLAGS_EVENT_NODE_PARAMS{{endif}} - {{if 'CU_GRAPH_DEBUG_DOT_FLAGS_EXT_SEMAS_SIGNAL_NODE_PARAMS' in found_values}} - #: Adds CUDA_EXT_SEM_SIGNAL_NODE_PARAMS values to output - CU_GRAPH_DEBUG_DOT_FLAGS_EXT_SEMAS_SIGNAL_NODE_PARAMS = ccuda.CUgraphDebugDot_flags_enum.CU_GRAPH_DEBUG_DOT_FLAGS_EXT_SEMAS_SIGNAL_NODE_PARAMS{{endif}} - {{if 'CU_GRAPH_DEBUG_DOT_FLAGS_EXT_SEMAS_WAIT_NODE_PARAMS' in found_values}} + CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR, + 'Minor compute capability version number\n' + ) - #: Adds CUDA_EXT_SEM_WAIT_NODE_PARAMS values to output - CU_GRAPH_DEBUG_DOT_FLAGS_EXT_SEMAS_WAIT_NODE_PARAMS = ccuda.CUgraphDebugDot_flags_enum.CU_GRAPH_DEBUG_DOT_FLAGS_EXT_SEMAS_WAIT_NODE_PARAMS{{endif}} - {{if 'CU_GRAPH_DEBUG_DOT_FLAGS_KERNEL_NODE_ATTRIBUTES' in found_values}} - #: Adds CUkernelNodeAttrValue values to output - CU_GRAPH_DEBUG_DOT_FLAGS_KERNEL_NODE_ATTRIBUTES = ccuda.CUgraphDebugDot_flags_enum.CU_GRAPH_DEBUG_DOT_FLAGS_KERNEL_NODE_ATTRIBUTES{{endif}} - {{if 'CU_GRAPH_DEBUG_DOT_FLAGS_HANDLES' in found_values}} + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_MIPMAPPED_WIDTH = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_MIPMAPPED_WIDTH, + 'Maximum mipmapped 1D texture width\n' + ) - #: Adds node handles and every kernel function handle to output - CU_GRAPH_DEBUG_DOT_FLAGS_HANDLES = ccuda.CUgraphDebugDot_flags_enum.CU_GRAPH_DEBUG_DOT_FLAGS_HANDLES{{endif}} - {{if 'CU_GRAPH_DEBUG_DOT_FLAGS_MEM_ALLOC_NODE_PARAMS' in found_values}} - #: Adds memory alloc node parameters to output - CU_GRAPH_DEBUG_DOT_FLAGS_MEM_ALLOC_NODE_PARAMS = ccuda.CUgraphDebugDot_flags_enum.CU_GRAPH_DEBUG_DOT_FLAGS_MEM_ALLOC_NODE_PARAMS{{endif}} - {{if 'CU_GRAPH_DEBUG_DOT_FLAGS_MEM_FREE_NODE_PARAMS' in found_values}} + CU_DEVICE_ATTRIBUTE_STREAM_PRIORITIES_SUPPORTED = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_STREAM_PRIORITIES_SUPPORTED, + 'Device supports stream priorities\n' + ) - #: Adds memory free node parameters to output - CU_GRAPH_DEBUG_DOT_FLAGS_MEM_FREE_NODE_PARAMS = ccuda.CUgraphDebugDot_flags_enum.CU_GRAPH_DEBUG_DOT_FLAGS_MEM_FREE_NODE_PARAMS{{endif}} - {{if 'CU_GRAPH_DEBUG_DOT_FLAGS_BATCH_MEM_OP_NODE_PARAMS' in found_values}} - #: Adds batch mem op node parameters to output - CU_GRAPH_DEBUG_DOT_FLAGS_BATCH_MEM_OP_NODE_PARAMS = ccuda.CUgraphDebugDot_flags_enum.CU_GRAPH_DEBUG_DOT_FLAGS_BATCH_MEM_OP_NODE_PARAMS{{endif}} - {{if 'CU_GRAPH_DEBUG_DOT_FLAGS_EXTRA_TOPO_INFO' in found_values}} + CU_DEVICE_ATTRIBUTE_GLOBAL_L1_CACHE_SUPPORTED = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_GLOBAL_L1_CACHE_SUPPORTED, + 'Device supports caching globals in L1\n' + ) - #: Adds edge numbering information - CU_GRAPH_DEBUG_DOT_FLAGS_EXTRA_TOPO_INFO = ccuda.CUgraphDebugDot_flags_enum.CU_GRAPH_DEBUG_DOT_FLAGS_EXTRA_TOPO_INFO{{endif}} - {{if 'CU_GRAPH_DEBUG_DOT_FLAGS_CONDITIONAL_NODE_PARAMS' in found_values}} - #: Adds conditional node parameters to output - CU_GRAPH_DEBUG_DOT_FLAGS_CONDITIONAL_NODE_PARAMS = ccuda.CUgraphDebugDot_flags_enum.CU_GRAPH_DEBUG_DOT_FLAGS_CONDITIONAL_NODE_PARAMS{{endif}} -{{endif}} -{{if 'CUuserObject_flags_enum' in found_types}} + CU_DEVICE_ATTRIBUTE_LOCAL_L1_CACHE_SUPPORTED = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_LOCAL_L1_CACHE_SUPPORTED, + 'Device supports caching locals in L1\n' + ) -class CUuserObject_flags(IntEnum): - """ - Flags for user objects for graphs - """ - {{if 'CU_USER_OBJECT_NO_DESTRUCTOR_SYNC' in found_values}} - #: Indicates the destructor execution is not synchronized by any CUDA - #: handle. - CU_USER_OBJECT_NO_DESTRUCTOR_SYNC = ccuda.CUuserObject_flags_enum.CU_USER_OBJECT_NO_DESTRUCTOR_SYNC{{endif}} -{{endif}} -{{if 'CUuserObjectRetain_flags_enum' in found_types}} + CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_MULTIPROCESSOR = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_MULTIPROCESSOR, + 'Maximum shared memory available per multiprocessor in bytes\n' + ) -class CUuserObjectRetain_flags(IntEnum): - """ - Flags for retaining user object references for graphs - """ - {{if 'CU_GRAPH_USER_OBJECT_MOVE' in found_values}} - #: Transfer references from the caller rather than creating new - #: references. - CU_GRAPH_USER_OBJECT_MOVE = ccuda.CUuserObjectRetain_flags_enum.CU_GRAPH_USER_OBJECT_MOVE{{endif}} -{{endif}} -{{if 'CUgraphInstantiate_flags_enum' in found_types}} + CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_MULTIPROCESSOR = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_MULTIPROCESSOR, + 'Maximum number of 32-bit registers available per multiprocessor\n' + ) -class CUgraphInstantiate_flags(IntEnum): - """ - Flags for instantiating a graph - """ - {{if 'CUDA_GRAPH_INSTANTIATE_FLAG_AUTO_FREE_ON_LAUNCH' in found_values}} - #: Automatically free memory allocated in a graph before relaunching. - CUDA_GRAPH_INSTANTIATE_FLAG_AUTO_FREE_ON_LAUNCH = ccuda.CUgraphInstantiate_flags_enum.CUDA_GRAPH_INSTANTIATE_FLAG_AUTO_FREE_ON_LAUNCH{{endif}} - {{if 'CUDA_GRAPH_INSTANTIATE_FLAG_UPLOAD' in found_values}} + CU_DEVICE_ATTRIBUTE_MANAGED_MEMORY = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MANAGED_MEMORY, + 'Device can allocate managed memory on this system\n' + ) - #: Automatically upload the graph after instantiation. Only supported - #: by :py:obj:`~.cuGraphInstantiateWithParams`. The upload will be - #: performed using the stream provided in `instantiateParams`. - CUDA_GRAPH_INSTANTIATE_FLAG_UPLOAD = ccuda.CUgraphInstantiate_flags_enum.CUDA_GRAPH_INSTANTIATE_FLAG_UPLOAD{{endif}} - {{if 'CUDA_GRAPH_INSTANTIATE_FLAG_DEVICE_LAUNCH' in found_values}} - #: Instantiate the graph to be launchable from the device. This flag - #: can only be used on platforms which support unified addressing. This - #: flag cannot be used in conjunction with - #: CUDA_GRAPH_INSTANTIATE_FLAG_AUTO_FREE_ON_LAUNCH. - CUDA_GRAPH_INSTANTIATE_FLAG_DEVICE_LAUNCH = ccuda.CUgraphInstantiate_flags_enum.CUDA_GRAPH_INSTANTIATE_FLAG_DEVICE_LAUNCH{{endif}} - {{if 'CUDA_GRAPH_INSTANTIATE_FLAG_USE_NODE_PRIORITY' in found_values}} + CU_DEVICE_ATTRIBUTE_MULTI_GPU_BOARD = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MULTI_GPU_BOARD, + 'Device is on a multi-GPU board\n' + ) - #: Run the graph using the per-node priority attributes rather than the - #: priority of the stream it is launched into. - CUDA_GRAPH_INSTANTIATE_FLAG_USE_NODE_PRIORITY = ccuda.CUgraphInstantiate_flags_enum.CUDA_GRAPH_INSTANTIATE_FLAG_USE_NODE_PRIORITY{{endif}} -{{endif}} -{{if 'CUdeviceNumaConfig_enum' in found_types}} -class CUdeviceNumaConfig(IntEnum): - """ - CUDA device NUMA configuration - """ - {{if 'CU_DEVICE_NUMA_CONFIG_NONE' in found_values}} + CU_DEVICE_ATTRIBUTE_MULTI_GPU_BOARD_GROUP_ID = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MULTI_GPU_BOARD_GROUP_ID, + 'Unique id for a group of devices on the same multi-GPU board\n' + ) - #: The GPU is not a NUMA node - CU_DEVICE_NUMA_CONFIG_NONE = ccuda.CUdeviceNumaConfig_enum.CU_DEVICE_NUMA_CONFIG_NONE{{endif}} - {{if 'CU_DEVICE_NUMA_CONFIG_NUMA_NODE' in found_values}} - #: The GPU is a NUMA node, CU_DEVICE_ATTRIBUTE_NUMA_ID contains its - #: NUMA ID - CU_DEVICE_NUMA_CONFIG_NUMA_NODE = ccuda.CUdeviceNumaConfig_enum.CU_DEVICE_NUMA_CONFIG_NUMA_NODE{{endif}} -{{endif}} -{{if 'CUmoduleLoadingMode_enum' in found_types}} + CU_DEVICE_ATTRIBUTE_HOST_NATIVE_ATOMIC_SUPPORTED = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_HOST_NATIVE_ATOMIC_SUPPORTED, + 'Link between the device and the host supports all native atomic operations\n' + ) -class CUmoduleLoadingMode(IntEnum): - """ - CUDA Lazy Loading status - """ - {{if 'CU_MODULE_EAGER_LOADING' in found_values}} - #: Lazy Kernel Loading is not enabled - CU_MODULE_EAGER_LOADING = ccuda.CUmoduleLoadingMode_enum.CU_MODULE_EAGER_LOADING{{endif}} - {{if 'CU_MODULE_LAZY_LOADING' in found_values}} + CU_DEVICE_ATTRIBUTE_SINGLE_TO_DOUBLE_PRECISION_PERF_RATIO = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_SINGLE_TO_DOUBLE_PRECISION_PERF_RATIO, + 'Ratio of single precision performance (in floating-point operations per\n' + 'second) to double precision performance\n' + ) - #: Lazy Kernel Loading is enabled - CU_MODULE_LAZY_LOADING = ccuda.CUmoduleLoadingMode_enum.CU_MODULE_LAZY_LOADING{{endif}} -{{endif}} -{{if 'CUfunctionLoadingState_enum' in found_types}} -class CUfunctionLoadingState(IntEnum): - """ + CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS, + 'Device supports coherently accessing pageable memory without calling\n' + 'cudaHostRegister on it\n' + ) - """ - {{if 'CU_FUNCTION_LOADING_STATE_UNLOADED' in found_values}} - CU_FUNCTION_LOADING_STATE_UNLOADED = ccuda.CUfunctionLoadingState_enum.CU_FUNCTION_LOADING_STATE_UNLOADED{{endif}} - {{if 'CU_FUNCTION_LOADING_STATE_LOADED' in found_values}} - CU_FUNCTION_LOADING_STATE_LOADED = ccuda.CUfunctionLoadingState_enum.CU_FUNCTION_LOADING_STATE_LOADED{{endif}} - {{if 'CU_FUNCTION_LOADING_STATE_MAX' in found_values}} - CU_FUNCTION_LOADING_STATE_MAX = ccuda.CUfunctionLoadingState_enum.CU_FUNCTION_LOADING_STATE_MAX{{endif}} -{{endif}} -{{if 'CUcoredumpSettings_enum' in found_types}} -class CUcoredumpSettings(IntEnum): - """ - Flags for choosing a coredump attribute to get/set - """ - {{if 'CU_COREDUMP_ENABLE_ON_EXCEPTION' in found_values}} - CU_COREDUMP_ENABLE_ON_EXCEPTION = ccuda.CUcoredumpSettings_enum.CU_COREDUMP_ENABLE_ON_EXCEPTION{{endif}} - {{if 'CU_COREDUMP_TRIGGER_HOST' in found_values}} - CU_COREDUMP_TRIGGER_HOST = ccuda.CUcoredumpSettings_enum.CU_COREDUMP_TRIGGER_HOST{{endif}} - {{if 'CU_COREDUMP_LIGHTWEIGHT' in found_values}} - CU_COREDUMP_LIGHTWEIGHT = ccuda.CUcoredumpSettings_enum.CU_COREDUMP_LIGHTWEIGHT{{endif}} - {{if 'CU_COREDUMP_ENABLE_USER_TRIGGER' in found_values}} - CU_COREDUMP_ENABLE_USER_TRIGGER = ccuda.CUcoredumpSettings_enum.CU_COREDUMP_ENABLE_USER_TRIGGER{{endif}} - {{if 'CU_COREDUMP_FILE' in found_values}} - CU_COREDUMP_FILE = ccuda.CUcoredumpSettings_enum.CU_COREDUMP_FILE{{endif}} - {{if 'CU_COREDUMP_PIPE' in found_values}} - CU_COREDUMP_PIPE = ccuda.CUcoredumpSettings_enum.CU_COREDUMP_PIPE{{endif}} - {{if 'CU_COREDUMP_GENERATION_FLAGS' in found_values}} - CU_COREDUMP_GENERATION_FLAGS = ccuda.CUcoredumpSettings_enum.CU_COREDUMP_GENERATION_FLAGS{{endif}} - {{if 'CU_COREDUMP_MAX' in found_values}} - CU_COREDUMP_MAX = ccuda.CUcoredumpSettings_enum.CU_COREDUMP_MAX{{endif}} -{{endif}} -{{if 'CUCoredumpGenerationFlags' in found_types}} - -class CUCoredumpGenerationFlags(IntEnum): - """ - Flags for controlling coredump contents - """ - {{if 'CU_COREDUMP_DEFAULT_FLAGS' in found_values}} - CU_COREDUMP_DEFAULT_FLAGS = ccuda.CUCoredumpGenerationFlags.CU_COREDUMP_DEFAULT_FLAGS{{endif}} - {{if 'CU_COREDUMP_SKIP_NONRELOCATED_ELF_IMAGES' in found_values}} - CU_COREDUMP_SKIP_NONRELOCATED_ELF_IMAGES = ccuda.CUCoredumpGenerationFlags.CU_COREDUMP_SKIP_NONRELOCATED_ELF_IMAGES{{endif}} - {{if 'CU_COREDUMP_SKIP_GLOBAL_MEMORY' in found_values}} - CU_COREDUMP_SKIP_GLOBAL_MEMORY = ccuda.CUCoredumpGenerationFlags.CU_COREDUMP_SKIP_GLOBAL_MEMORY{{endif}} - {{if 'CU_COREDUMP_SKIP_SHARED_MEMORY' in found_values}} - CU_COREDUMP_SKIP_SHARED_MEMORY = ccuda.CUCoredumpGenerationFlags.CU_COREDUMP_SKIP_SHARED_MEMORY{{endif}} - {{if 'CU_COREDUMP_SKIP_LOCAL_MEMORY' in found_values}} - CU_COREDUMP_SKIP_LOCAL_MEMORY = ccuda.CUCoredumpGenerationFlags.CU_COREDUMP_SKIP_LOCAL_MEMORY{{endif}} - {{if 'CU_COREDUMP_LIGHTWEIGHT_FLAGS' in found_values}} - CU_COREDUMP_LIGHTWEIGHT_FLAGS = ccuda.CUCoredumpGenerationFlags.CU_COREDUMP_LIGHTWEIGHT_FLAGS{{endif}} - {{if 'CU_COREDUMP_SKIP_ABORT' in found_values}} - CU_COREDUMP_SKIP_ABORT = ccuda.CUCoredumpGenerationFlags.CU_COREDUMP_SKIP_ABORT{{endif}} -{{endif}} -{{if 'CUgreenCtxCreate_flags' in found_types}} + CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS, + 'Device can coherently access managed memory concurrently with the CPU\n' + ) -class CUgreenCtxCreate_flags(IntEnum): - """ - """ - {{if 'CU_GREEN_CTX_DEFAULT_STREAM' in found_values}} + CU_DEVICE_ATTRIBUTE_COMPUTE_PREEMPTION_SUPPORTED = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_COMPUTE_PREEMPTION_SUPPORTED, + 'Device supports compute preemption.\n' + ) - #: Required. Creates a default stream to use inside the green context - CU_GREEN_CTX_DEFAULT_STREAM = ccuda.CUgreenCtxCreate_flags.CU_GREEN_CTX_DEFAULT_STREAM{{endif}} -{{endif}} -{{if 'CUdevSmResourceSplit_flags' in found_types}} -class CUdevSmResourceSplit_flags(IntEnum): - """ + CU_DEVICE_ATTRIBUTE_CAN_USE_HOST_POINTER_FOR_REGISTERED_MEM = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_CAN_USE_HOST_POINTER_FOR_REGISTERED_MEM, + 'Device can access host registered memory at the same virtual address as the\n' + 'CPU\n' + ) - """ - {{if 'CU_DEV_SM_RESOURCE_SPLIT_IGNORE_SM_COSCHEDULING' in found_values}} - CU_DEV_SM_RESOURCE_SPLIT_IGNORE_SM_COSCHEDULING = ccuda.CUdevSmResourceSplit_flags.CU_DEV_SM_RESOURCE_SPLIT_IGNORE_SM_COSCHEDULING{{endif}} - {{if 'CU_DEV_SM_RESOURCE_SPLIT_MAX_POTENTIAL_CLUSTER_SIZE' in found_values}} - CU_DEV_SM_RESOURCE_SPLIT_MAX_POTENTIAL_CLUSTER_SIZE = ccuda.CUdevSmResourceSplit_flags.CU_DEV_SM_RESOURCE_SPLIT_MAX_POTENTIAL_CLUSTER_SIZE{{endif}} -{{endif}} -{{if 'CUdevResourceType' in found_types}} -class CUdevResourceType(IntEnum): - """ - Type of resource - """ - {{if 'CU_DEV_RESOURCE_TYPE_INVALID' in found_values}} - CU_DEV_RESOURCE_TYPE_INVALID = ccuda.CUdevResourceType.CU_DEV_RESOURCE_TYPE_INVALID{{endif}} - {{if 'CU_DEV_RESOURCE_TYPE_SM' in found_values}} + CU_DEVICE_ATTRIBUTE_CAN_USE_STREAM_MEM_OPS_V1 = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_CAN_USE_STREAM_MEM_OPS_V1, + 'Deprecated, along with v1 MemOps API, :py:obj:`~.cuStreamBatchMemOp` and\n' + 'related APIs are supported.\n' + ) - #: Streaming multiprocessors related information - CU_DEV_RESOURCE_TYPE_SM = ccuda.CUdevResourceType.CU_DEV_RESOURCE_TYPE_SM{{endif}} -{{endif}} -{{if 'CUoutput_mode_enum' in found_types}} -class CUoutput_mode(IntEnum): - """ - Profiler Output Modes - """ - {{if 'CU_OUT_KEY_VALUE_PAIR' in found_values}} + CU_DEVICE_ATTRIBUTE_CAN_USE_64_BIT_STREAM_MEM_OPS_V1 = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_CAN_USE_64_BIT_STREAM_MEM_OPS_V1, + 'Deprecated, along with v1 MemOps API, 64-bit operations are supported in\n' + ':py:obj:`~.cuStreamBatchMemOp` and related APIs.\n' + ) - #: Output mode Key-Value pair format. - CU_OUT_KEY_VALUE_PAIR = ccuda.CUoutput_mode_enum.CU_OUT_KEY_VALUE_PAIR{{endif}} - {{if 'CU_OUT_CSV' in found_values}} - #: Output mode Comma separated values format. - CU_OUT_CSV = ccuda.CUoutput_mode_enum.CU_OUT_CSV{{endif}} -{{endif}} -{{if True}} + CU_DEVICE_ATTRIBUTE_CAN_USE_STREAM_WAIT_VALUE_NOR_V1 = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_CAN_USE_STREAM_WAIT_VALUE_NOR_V1, + 'Deprecated, along with v1 MemOps API, :py:obj:`~.CU_STREAM_WAIT_VALUE_NOR`\n' + 'is supported.\n' + ) -class CUeglFrameType(IntEnum): - """ - CUDA EglFrame type - array or pointer - """ - {{if True}} - #: Frame type CUDA array - CU_EGL_FRAME_TYPE_ARRAY = ccuda.CUeglFrameType_enum.CU_EGL_FRAME_TYPE_ARRAY{{endif}} - {{if True}} + CU_DEVICE_ATTRIBUTE_COOPERATIVE_LAUNCH = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_COOPERATIVE_LAUNCH, + 'Device supports launching cooperative kernels via\n' + ':py:obj:`~.cuLaunchCooperativeKernel`\n' + ) - #: Frame type pointer - CU_EGL_FRAME_TYPE_PITCH = ccuda.CUeglFrameType_enum.CU_EGL_FRAME_TYPE_PITCH{{endif}} -{{endif}} -{{if True}} -class CUeglResourceLocationFlags(IntEnum): - """ - Resource location flags- sysmem or vidmem For CUDA context on - iGPU, since video and system memory are equivalent - these flags - will not have an effect on the execution. For CUDA context on - dGPU, applications can use the flag - :py:obj:`~.CUeglResourceLocationFlags` to give a hint about the - desired location. :py:obj:`~.CU_EGL_RESOURCE_LOCATION_SYSMEM` - - the frame data is made resident on the system memory to be accessed - by CUDA. :py:obj:`~.CU_EGL_RESOURCE_LOCATION_VIDMEM` - the frame - data is made resident on the dedicated video memory to be accessed - by CUDA. There may be an additional latency due to new allocation - and data migration, if the frame is produced on a different memory. - """ - {{if True}} + CU_DEVICE_ATTRIBUTE_COOPERATIVE_MULTI_DEVICE_LAUNCH = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_COOPERATIVE_MULTI_DEVICE_LAUNCH, + 'Deprecated, :py:obj:`~.cuLaunchCooperativeKernelMultiDevice` is deprecated.\n' + ) - #: Resource location sysmem - CU_EGL_RESOURCE_LOCATION_SYSMEM = ccuda.CUeglResourceLocationFlags_enum.CU_EGL_RESOURCE_LOCATION_SYSMEM{{endif}} - {{if True}} - #: Resource location vidmem - CU_EGL_RESOURCE_LOCATION_VIDMEM = ccuda.CUeglResourceLocationFlags_enum.CU_EGL_RESOURCE_LOCATION_VIDMEM{{endif}} -{{endif}} -{{if True}} + CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK_OPTIN = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK_OPTIN, + 'Maximum optin shared memory per block. That is shared memory that is\n' + 'available for dynamic allocation or static allocation (including\n' + 'architecture specific static shared memory) on this device but is not\n' + 'guaranteed to be portable.\n' + ) -class CUeglColorFormat(IntEnum): - """ - CUDA EGL Color Format - The different planar and multiplanar - formats currently supported for CUDA_EGL interops. Three channel - formats are currently not supported for - :py:obj:`~.CU_EGL_FRAME_TYPE_ARRAY` - """ - {{if True}} - - #: Y, U, V in three surfaces, each in a separate surface, U/V width = - #: 1/2 Y width, U/V height = 1/2 Y height. - CU_EGL_COLOR_FORMAT_YUV420_PLANAR = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_PLANAR{{endif}} - {{if True}} - - #: Y, UV in two surfaces (UV as one surface) with VU byte ordering, - #: width, height ratio same as YUV420Planar. - CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR{{endif}} - {{if True}} - - #: Y, U, V each in a separate surface, U/V width = 1/2 Y width, U/V - #: height = Y height. - CU_EGL_COLOR_FORMAT_YUV422_PLANAR = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV422_PLANAR{{endif}} - {{if True}} - - #: Y, UV in two surfaces with VU byte ordering, width, height ratio - #: same as YUV422Planar. - CU_EGL_COLOR_FORMAT_YUV422_SEMIPLANAR = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV422_SEMIPLANAR{{endif}} - {{if True}} - - #: R/G/B three channels in one surface with BGR byte ordering. Only - #: pitch linear format supported. - CU_EGL_COLOR_FORMAT_RGB = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_RGB{{endif}} - {{if True}} - - #: R/G/B three channels in one surface with RGB byte ordering. Only - #: pitch linear format supported. - CU_EGL_COLOR_FORMAT_BGR = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BGR{{endif}} - {{if True}} - - #: R/G/B/A four channels in one surface with BGRA byte ordering. - CU_EGL_COLOR_FORMAT_ARGB = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_ARGB{{endif}} - {{if True}} - - #: R/G/B/A four channels in one surface with ABGR byte ordering. - CU_EGL_COLOR_FORMAT_RGBA = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_RGBA{{endif}} - {{if True}} - - #: single luminance channel in one surface. - CU_EGL_COLOR_FORMAT_L = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_L{{endif}} - {{if True}} - - #: single color channel in one surface. - CU_EGL_COLOR_FORMAT_R = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_R{{endif}} - {{if True}} - - #: Y, U, V in three surfaces, each in a separate surface, U/V width = Y - #: width, U/V height = Y height. - CU_EGL_COLOR_FORMAT_YUV444_PLANAR = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV444_PLANAR{{endif}} - {{if True}} - - #: Y, UV in two surfaces (UV as one surface) with VU byte ordering, - #: width, height ratio same as YUV444Planar. - CU_EGL_COLOR_FORMAT_YUV444_SEMIPLANAR = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV444_SEMIPLANAR{{endif}} - {{if True}} - - #: Y, U, V in one surface, interleaved as UYVY in one channel. - CU_EGL_COLOR_FORMAT_YUYV_422 = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUYV_422{{endif}} - {{if True}} - - #: Y, U, V in one surface, interleaved as YUYV in one channel. - CU_EGL_COLOR_FORMAT_UYVY_422 = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_UYVY_422{{endif}} - {{if True}} - - #: R/G/B/A four channels in one surface with RGBA byte ordering. - CU_EGL_COLOR_FORMAT_ABGR = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_ABGR{{endif}} - {{if True}} - - #: R/G/B/A four channels in one surface with ARGB byte ordering. - CU_EGL_COLOR_FORMAT_BGRA = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BGRA{{endif}} - {{if True}} - - #: Alpha color format - one channel in one surface. - CU_EGL_COLOR_FORMAT_A = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_A{{endif}} - {{if True}} - - #: R/G color format - two channels in one surface with GR byte ordering - CU_EGL_COLOR_FORMAT_RG = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_RG{{endif}} - {{if True}} - - #: Y, U, V, A four channels in one surface, interleaved as VUYA. - CU_EGL_COLOR_FORMAT_AYUV = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_AYUV{{endif}} - {{if True}} - - #: Y, VU in two surfaces (VU as one surface) with UV byte ordering, U/V - #: width = Y width, U/V height = Y height. - CU_EGL_COLOR_FORMAT_YVU444_SEMIPLANAR = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU444_SEMIPLANAR{{endif}} - {{if True}} - - #: Y, VU in two surfaces (VU as one surface) with UV byte ordering, U/V - #: width = 1/2 Y width, U/V height = Y height. - CU_EGL_COLOR_FORMAT_YVU422_SEMIPLANAR = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU422_SEMIPLANAR{{endif}} - {{if True}} - - #: Y, VU in two surfaces (VU as one surface) with UV byte ordering, U/V - #: width = 1/2 Y width, U/V height = 1/2 Y height. - CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR{{endif}} - {{if True}} - - #: Y10, V10U10 in two surfaces (VU as one surface) with UV byte - #: ordering, U/V width = Y width, U/V height = Y height. - CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR{{endif}} - {{if True}} - - #: Y10, V10U10 in two surfaces (VU as one surface) with UV byte - #: ordering, U/V width = 1/2 Y width, U/V height = 1/2 Y height. - CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR{{endif}} - {{if True}} - - #: Y12, V12U12 in two surfaces (VU as one surface) with UV byte - #: ordering, U/V width = Y width, U/V height = Y height. - CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR{{endif}} - {{if True}} - - #: Y12, V12U12 in two surfaces (VU as one surface) with UV byte - #: ordering, U/V width = 1/2 Y width, U/V height = 1/2 Y height. - CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR{{endif}} - {{if True}} - - #: Extended Range Y, U, V in one surface, interleaved as YVYU in one - #: channel. - CU_EGL_COLOR_FORMAT_VYUY_ER = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_VYUY_ER{{endif}} - {{if True}} - - #: Extended Range Y, U, V in one surface, interleaved as YUYV in one - #: channel. - CU_EGL_COLOR_FORMAT_UYVY_ER = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_UYVY_ER{{endif}} - {{if True}} - - #: Extended Range Y, U, V in one surface, interleaved as UYVY in one - #: channel. - CU_EGL_COLOR_FORMAT_YUYV_ER = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUYV_ER{{endif}} - {{if True}} - - #: Extended Range Y, U, V in one surface, interleaved as VYUY in one - #: channel. - CU_EGL_COLOR_FORMAT_YVYU_ER = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVYU_ER{{endif}} - {{if True}} - - #: Extended Range Y, U, V three channels in one surface, interleaved as - #: VUY. Only pitch linear format supported. - CU_EGL_COLOR_FORMAT_YUV_ER = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV_ER{{endif}} - {{if True}} - - #: Extended Range Y, U, V, A four channels in one surface, interleaved - #: as AVUY. - CU_EGL_COLOR_FORMAT_YUVA_ER = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUVA_ER{{endif}} - {{if True}} - - #: Extended Range Y, U, V, A four channels in one surface, interleaved - #: as VUYA. - CU_EGL_COLOR_FORMAT_AYUV_ER = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_AYUV_ER{{endif}} - {{if True}} - - #: Extended Range Y, U, V in three surfaces, U/V width = Y width, U/V - #: height = Y height. - CU_EGL_COLOR_FORMAT_YUV444_PLANAR_ER = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV444_PLANAR_ER{{endif}} - {{if True}} - - #: Extended Range Y, U, V in three surfaces, U/V width = 1/2 Y width, - #: U/V height = Y height. - CU_EGL_COLOR_FORMAT_YUV422_PLANAR_ER = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV422_PLANAR_ER{{endif}} - {{if True}} - - #: Extended Range Y, U, V in three surfaces, U/V width = 1/2 Y width, - #: U/V height = 1/2 Y height. - CU_EGL_COLOR_FORMAT_YUV420_PLANAR_ER = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_PLANAR_ER{{endif}} - {{if True}} - - #: Extended Range Y, UV in two surfaces (UV as one surface) with VU - #: byte ordering, U/V width = Y width, U/V height = Y height. - CU_EGL_COLOR_FORMAT_YUV444_SEMIPLANAR_ER = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV444_SEMIPLANAR_ER{{endif}} - {{if True}} - - #: Extended Range Y, UV in two surfaces (UV as one surface) with VU - #: byte ordering, U/V width = 1/2 Y width, U/V height = Y height. - CU_EGL_COLOR_FORMAT_YUV422_SEMIPLANAR_ER = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV422_SEMIPLANAR_ER{{endif}} - {{if True}} - - #: Extended Range Y, UV in two surfaces (UV as one surface) with VU - #: byte ordering, U/V width = 1/2 Y width, U/V height = 1/2 Y height. - CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR_ER = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR_ER{{endif}} - {{if True}} - - #: Extended Range Y, V, U in three surfaces, U/V width = Y width, U/V - #: height = Y height. - CU_EGL_COLOR_FORMAT_YVU444_PLANAR_ER = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU444_PLANAR_ER{{endif}} - {{if True}} - - #: Extended Range Y, V, U in three surfaces, U/V width = 1/2 Y width, - #: U/V height = Y height. - CU_EGL_COLOR_FORMAT_YVU422_PLANAR_ER = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU422_PLANAR_ER{{endif}} - {{if True}} - - #: Extended Range Y, V, U in three surfaces, U/V width = 1/2 Y width, - #: U/V height = 1/2 Y height. - CU_EGL_COLOR_FORMAT_YVU420_PLANAR_ER = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_PLANAR_ER{{endif}} - {{if True}} - - #: Extended Range Y, VU in two surfaces (VU as one surface) with UV - #: byte ordering, U/V width = Y width, U/V height = Y height. - CU_EGL_COLOR_FORMAT_YVU444_SEMIPLANAR_ER = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU444_SEMIPLANAR_ER{{endif}} - {{if True}} - - #: Extended Range Y, VU in two surfaces (VU as one surface) with UV - #: byte ordering, U/V width = 1/2 Y width, U/V height = Y height. - CU_EGL_COLOR_FORMAT_YVU422_SEMIPLANAR_ER = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU422_SEMIPLANAR_ER{{endif}} - {{if True}} - - #: Extended Range Y, VU in two surfaces (VU as one surface) with UV - #: byte ordering, U/V width = 1/2 Y width, U/V height = 1/2 Y height. - CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR_ER = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR_ER{{endif}} - {{if True}} - - #: Bayer format - one channel in one surface with interleaved RGGB - #: ordering. - CU_EGL_COLOR_FORMAT_BAYER_RGGB = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_RGGB{{endif}} - {{if True}} - - #: Bayer format - one channel in one surface with interleaved BGGR - #: ordering. - CU_EGL_COLOR_FORMAT_BAYER_BGGR = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_BGGR{{endif}} - {{if True}} - - #: Bayer format - one channel in one surface with interleaved GRBG - #: ordering. - CU_EGL_COLOR_FORMAT_BAYER_GRBG = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_GRBG{{endif}} - {{if True}} - - #: Bayer format - one channel in one surface with interleaved GBRG - #: ordering. - CU_EGL_COLOR_FORMAT_BAYER_GBRG = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_GBRG{{endif}} - {{if True}} - - #: Bayer10 format - one channel in one surface with interleaved RGGB - #: ordering. Out of 16 bits, 10 bits used 6 bits No-op. - CU_EGL_COLOR_FORMAT_BAYER10_RGGB = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER10_RGGB{{endif}} - {{if True}} - - #: Bayer10 format - one channel in one surface with interleaved BGGR - #: ordering. Out of 16 bits, 10 bits used 6 bits No-op. - CU_EGL_COLOR_FORMAT_BAYER10_BGGR = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER10_BGGR{{endif}} - {{if True}} - - #: Bayer10 format - one channel in one surface with interleaved GRBG - #: ordering. Out of 16 bits, 10 bits used 6 bits No-op. - CU_EGL_COLOR_FORMAT_BAYER10_GRBG = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER10_GRBG{{endif}} - {{if True}} - - #: Bayer10 format - one channel in one surface with interleaved GBRG - #: ordering. Out of 16 bits, 10 bits used 6 bits No-op. - CU_EGL_COLOR_FORMAT_BAYER10_GBRG = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER10_GBRG{{endif}} - {{if True}} - - #: Bayer12 format - one channel in one surface with interleaved RGGB - #: ordering. Out of 16 bits, 12 bits used 4 bits No-op. - CU_EGL_COLOR_FORMAT_BAYER12_RGGB = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_RGGB{{endif}} - {{if True}} - - #: Bayer12 format - one channel in one surface with interleaved BGGR - #: ordering. Out of 16 bits, 12 bits used 4 bits No-op. - CU_EGL_COLOR_FORMAT_BAYER12_BGGR = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_BGGR{{endif}} - {{if True}} - - #: Bayer12 format - one channel in one surface with interleaved GRBG - #: ordering. Out of 16 bits, 12 bits used 4 bits No-op. - CU_EGL_COLOR_FORMAT_BAYER12_GRBG = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_GRBG{{endif}} - {{if True}} - - #: Bayer12 format - one channel in one surface with interleaved GBRG - #: ordering. Out of 16 bits, 12 bits used 4 bits No-op. - CU_EGL_COLOR_FORMAT_BAYER12_GBRG = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_GBRG{{endif}} - {{if True}} - - #: Bayer14 format - one channel in one surface with interleaved RGGB - #: ordering. Out of 16 bits, 14 bits used 2 bits No-op. - CU_EGL_COLOR_FORMAT_BAYER14_RGGB = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER14_RGGB{{endif}} - {{if True}} - - #: Bayer14 format - one channel in one surface with interleaved BGGR - #: ordering. Out of 16 bits, 14 bits used 2 bits No-op. - CU_EGL_COLOR_FORMAT_BAYER14_BGGR = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER14_BGGR{{endif}} - {{if True}} - - #: Bayer14 format - one channel in one surface with interleaved GRBG - #: ordering. Out of 16 bits, 14 bits used 2 bits No-op. - CU_EGL_COLOR_FORMAT_BAYER14_GRBG = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER14_GRBG{{endif}} - {{if True}} - - #: Bayer14 format - one channel in one surface with interleaved GBRG - #: ordering. Out of 16 bits, 14 bits used 2 bits No-op. - CU_EGL_COLOR_FORMAT_BAYER14_GBRG = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER14_GBRG{{endif}} - {{if True}} - - #: Bayer20 format - one channel in one surface with interleaved RGGB - #: ordering. Out of 32 bits, 20 bits used 12 bits No-op. - CU_EGL_COLOR_FORMAT_BAYER20_RGGB = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER20_RGGB{{endif}} - {{if True}} - - #: Bayer20 format - one channel in one surface with interleaved BGGR - #: ordering. Out of 32 bits, 20 bits used 12 bits No-op. - CU_EGL_COLOR_FORMAT_BAYER20_BGGR = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER20_BGGR{{endif}} - {{if True}} - - #: Bayer20 format - one channel in one surface with interleaved GRBG - #: ordering. Out of 32 bits, 20 bits used 12 bits No-op. - CU_EGL_COLOR_FORMAT_BAYER20_GRBG = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER20_GRBG{{endif}} - {{if True}} - - #: Bayer20 format - one channel in one surface with interleaved GBRG - #: ordering. Out of 32 bits, 20 bits used 12 bits No-op. - CU_EGL_COLOR_FORMAT_BAYER20_GBRG = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER20_GBRG{{endif}} - {{if True}} - - #: Y, V, U in three surfaces, each in a separate surface, U/V width = Y - #: width, U/V height = Y height. - CU_EGL_COLOR_FORMAT_YVU444_PLANAR = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU444_PLANAR{{endif}} - {{if True}} - - #: Y, V, U in three surfaces, each in a separate surface, U/V width = - #: 1/2 Y width, U/V height = Y height. - CU_EGL_COLOR_FORMAT_YVU422_PLANAR = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU422_PLANAR{{endif}} - {{if True}} - - #: Y, V, U in three surfaces, each in a separate surface, U/V width = - #: 1/2 Y width, U/V height = 1/2 Y height. - CU_EGL_COLOR_FORMAT_YVU420_PLANAR = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_PLANAR{{endif}} - {{if True}} - - #: Nvidia proprietary Bayer ISP format - one channel in one surface - #: with interleaved RGGB ordering and mapped to opaque integer - #: datatype. - CU_EGL_COLOR_FORMAT_BAYER_ISP_RGGB = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_ISP_RGGB{{endif}} - {{if True}} - - #: Nvidia proprietary Bayer ISP format - one channel in one surface - #: with interleaved BGGR ordering and mapped to opaque integer - #: datatype. - CU_EGL_COLOR_FORMAT_BAYER_ISP_BGGR = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_ISP_BGGR{{endif}} - {{if True}} - - #: Nvidia proprietary Bayer ISP format - one channel in one surface - #: with interleaved GRBG ordering and mapped to opaque integer - #: datatype. - CU_EGL_COLOR_FORMAT_BAYER_ISP_GRBG = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_ISP_GRBG{{endif}} - {{if True}} - - #: Nvidia proprietary Bayer ISP format - one channel in one surface - #: with interleaved GBRG ordering and mapped to opaque integer - #: datatype. - CU_EGL_COLOR_FORMAT_BAYER_ISP_GBRG = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_ISP_GBRG{{endif}} - {{if True}} - - #: Bayer format - one channel in one surface with interleaved BCCR - #: ordering. - CU_EGL_COLOR_FORMAT_BAYER_BCCR = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_BCCR{{endif}} - {{if True}} - - #: Bayer format - one channel in one surface with interleaved RCCB - #: ordering. - CU_EGL_COLOR_FORMAT_BAYER_RCCB = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_RCCB{{endif}} - {{if True}} - - #: Bayer format - one channel in one surface with interleaved CRBC - #: ordering. - CU_EGL_COLOR_FORMAT_BAYER_CRBC = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_CRBC{{endif}} - {{if True}} - - #: Bayer format - one channel in one surface with interleaved CBRC - #: ordering. - CU_EGL_COLOR_FORMAT_BAYER_CBRC = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_CBRC{{endif}} - {{if True}} - - #: Bayer10 format - one channel in one surface with interleaved CCCC - #: ordering. Out of 16 bits, 10 bits used 6 bits No-op. - CU_EGL_COLOR_FORMAT_BAYER10_CCCC = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER10_CCCC{{endif}} - {{if True}} - - #: Bayer12 format - one channel in one surface with interleaved BCCR - #: ordering. Out of 16 bits, 12 bits used 4 bits No-op. - CU_EGL_COLOR_FORMAT_BAYER12_BCCR = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_BCCR{{endif}} - {{if True}} - - #: Bayer12 format - one channel in one surface with interleaved RCCB - #: ordering. Out of 16 bits, 12 bits used 4 bits No-op. - CU_EGL_COLOR_FORMAT_BAYER12_RCCB = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_RCCB{{endif}} - {{if True}} - - #: Bayer12 format - one channel in one surface with interleaved CRBC - #: ordering. Out of 16 bits, 12 bits used 4 bits No-op. - CU_EGL_COLOR_FORMAT_BAYER12_CRBC = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_CRBC{{endif}} - {{if True}} - - #: Bayer12 format - one channel in one surface with interleaved CBRC - #: ordering. Out of 16 bits, 12 bits used 4 bits No-op. - CU_EGL_COLOR_FORMAT_BAYER12_CBRC = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_CBRC{{endif}} - {{if True}} - - #: Bayer12 format - one channel in one surface with interleaved CCCC - #: ordering. Out of 16 bits, 12 bits used 4 bits No-op. - CU_EGL_COLOR_FORMAT_BAYER12_CCCC = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_CCCC{{endif}} - {{if True}} - - #: Color format for single Y plane. - CU_EGL_COLOR_FORMAT_Y = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y{{endif}} - {{if True}} - - #: Y, UV in two surfaces (UV as one surface) U/V width = 1/2 Y width, - #: U/V height = 1/2 Y height. - CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR_2020 = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR_2020{{endif}} - {{if True}} - - #: Y, VU in two surfaces (VU as one surface) U/V width = 1/2 Y width, - #: U/V height = 1/2 Y height. - CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR_2020 = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR_2020{{endif}} - {{if True}} - - #: Y, U, V each in a separate surface, U/V width = 1/2 Y width, U/V - #: height= 1/2 Y height. - CU_EGL_COLOR_FORMAT_YUV420_PLANAR_2020 = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_PLANAR_2020{{endif}} - {{if True}} - - #: Y, V, U each in a separate surface, U/V width = 1/2 Y width, U/V - #: height = 1/2 Y height. - CU_EGL_COLOR_FORMAT_YVU420_PLANAR_2020 = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_PLANAR_2020{{endif}} - {{if True}} - - #: Y, UV in two surfaces (UV as one surface) U/V width = 1/2 Y width, - #: U/V height = 1/2 Y height. - CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR_709 = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR_709{{endif}} - {{if True}} - - #: Y, VU in two surfaces (VU as one surface) U/V width = 1/2 Y width, - #: U/V height = 1/2 Y height. - CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR_709 = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR_709{{endif}} - {{if True}} - - #: Y, U, V each in a separate surface, U/V width = 1/2 Y width, U/V - #: height = 1/2 Y height. - CU_EGL_COLOR_FORMAT_YUV420_PLANAR_709 = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_PLANAR_709{{endif}} - {{if True}} - - #: Y, V, U each in a separate surface, U/V width = 1/2 Y width, U/V - #: height = 1/2 Y height. - CU_EGL_COLOR_FORMAT_YVU420_PLANAR_709 = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_PLANAR_709{{endif}} - {{if True}} - - #: Y10, V10U10 in two surfaces (VU as one surface), U/V width = 1/2 Y - #: width, U/V height = 1/2 Y height. - CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_709 = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_709{{endif}} - {{if True}} - - #: Y10, V10U10 in two surfaces (VU as one surface), U/V width = 1/2 Y - #: width, U/V height = 1/2 Y height. - CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_2020 = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_2020{{endif}} - {{if True}} - - #: Y10, V10U10 in two surfaces(VU as one surface) U/V width = 1/2 Y - #: width, U/V height = Y height. - CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR_2020 = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR_2020{{endif}} - {{if True}} - - #: Y10, V10U10 in two surfaces(VU as one surface) U/V width = 1/2 Y - #: width, U/V height = Y height. - CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR{{endif}} - {{if True}} - - #: Y10, V10U10 in two surfaces(VU as one surface) U/V width = 1/2 Y - #: width, U/V height = Y height. - CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR_709 = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR_709{{endif}} - {{if True}} - - #: Extended Range Color format for single Y plane. - CU_EGL_COLOR_FORMAT_Y_ER = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y_ER{{endif}} - {{if True}} - - #: Extended Range Color format for single Y plane. - CU_EGL_COLOR_FORMAT_Y_709_ER = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y_709_ER{{endif}} - {{if True}} - - #: Extended Range Color format for single Y10 plane. - CU_EGL_COLOR_FORMAT_Y10_ER = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10_ER{{endif}} - {{if True}} - - #: Extended Range Color format for single Y10 plane. - CU_EGL_COLOR_FORMAT_Y10_709_ER = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10_709_ER{{endif}} - {{if True}} - - #: Extended Range Color format for single Y12 plane. - CU_EGL_COLOR_FORMAT_Y12_ER = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12_ER{{endif}} - {{if True}} - - #: Extended Range Color format for single Y12 plane. - CU_EGL_COLOR_FORMAT_Y12_709_ER = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12_709_ER{{endif}} - {{if True}} - - #: Y, U, V, A four channels in one surface, interleaved as AVUY. - CU_EGL_COLOR_FORMAT_YUVA = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUVA{{endif}} - {{if True}} - - #: Y, U, V three channels in one surface, interleaved as VUY. Only - #: pitch linear format supported. - CU_EGL_COLOR_FORMAT_YUV = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV{{endif}} - {{if True}} - - #: Y, U, V in one surface, interleaved as YVYU in one channel. - CU_EGL_COLOR_FORMAT_YVYU = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVYU{{endif}} - {{if True}} - - #: Y, U, V in one surface, interleaved as VYUY in one channel. - CU_EGL_COLOR_FORMAT_VYUY = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_VYUY{{endif}} - {{if True}} - - #: Extended Range Y10, V10U10 in two surfaces(VU as one surface) U/V - #: width = 1/2 Y width, U/V height = 1/2 Y height. - CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_ER = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_ER{{endif}} - {{if True}} - - #: Extended Range Y10, V10U10 in two surfaces(VU as one surface) U/V - #: width = 1/2 Y width, U/V height = 1/2 Y height. - CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_709_ER = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_709_ER{{endif}} - {{if True}} - - #: Extended Range Y10, V10U10 in two surfaces (VU as one surface) U/V - #: width = Y width, U/V height = Y height. - CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR_ER = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR_ER{{endif}} - {{if True}} - - #: Extended Range Y10, V10U10 in two surfaces (VU as one surface) U/V - #: width = Y width, U/V height = Y height. - CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR_709_ER = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR_709_ER{{endif}} - {{if True}} - - #: Extended Range Y12, V12U12 in two surfaces (VU as one surface) U/V - #: width = 1/2 Y width, U/V height = 1/2 Y height. - CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR_ER = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR_ER{{endif}} - {{if True}} - - #: Extended Range Y12, V12U12 in two surfaces (VU as one surface) U/V - #: width = 1/2 Y width, U/V height = 1/2 Y height. - CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR_709_ER = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR_709_ER{{endif}} - {{if True}} - - #: Extended Range Y12, V12U12 in two surfaces (VU as one surface) U/V - #: width = Y width, U/V height = Y height. - CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR_ER = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR_ER{{endif}} - {{if True}} - - #: Extended Range Y12, V12U12 in two surfaces (VU as one surface) U/V - #: width = Y width, U/V height = Y height. - CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR_709_ER = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR_709_ER{{endif}} - {{if True}} - CU_EGL_COLOR_FORMAT_MAX = ccuda.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_MAX{{endif}} -{{endif}} -{{if True}} - -class CUGLDeviceList(IntEnum): - """ - CUDA devices corresponding to an OpenGL device - """ - {{if True}} - #: The CUDA devices for all GPUs used by the current OpenGL context - CU_GL_DEVICE_LIST_ALL = ccuda.CUGLDeviceList_enum.CU_GL_DEVICE_LIST_ALL{{endif}} - {{if True}} + CU_DEVICE_ATTRIBUTE_CAN_FLUSH_REMOTE_WRITES = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_CAN_FLUSH_REMOTE_WRITES, + 'The :py:obj:`~.CU_STREAM_WAIT_VALUE_FLUSH` flag and the\n' + ':py:obj:`~.CU_STREAM_MEM_OP_FLUSH_REMOTE_WRITES` MemOp are supported on the\n' + 'device. See :py:obj:`~.Stream Memory Operations` for additional details.\n' + ) - #: The CUDA devices for the GPUs used by the current OpenGL context in - #: its currently rendering frame - CU_GL_DEVICE_LIST_CURRENT_FRAME = ccuda.CUGLDeviceList_enum.CU_GL_DEVICE_LIST_CURRENT_FRAME{{endif}} - {{if True}} - #: The CUDA devices for the GPUs to be used by the current OpenGL - #: context in the next frame - CU_GL_DEVICE_LIST_NEXT_FRAME = ccuda.CUGLDeviceList_enum.CU_GL_DEVICE_LIST_NEXT_FRAME{{endif}} -{{endif}} -{{if True}} + CU_DEVICE_ATTRIBUTE_HOST_REGISTER_SUPPORTED = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_HOST_REGISTER_SUPPORTED, + 'Device supports host memory registration via :py:obj:`~.cudaHostRegister`.\n' + ) -class CUGLmap_flags(IntEnum): - """ - Flags to map or unmap a resource - """ - {{if True}} - CU_GL_MAP_RESOURCE_FLAGS_NONE = ccuda.CUGLmap_flags_enum.CU_GL_MAP_RESOURCE_FLAGS_NONE{{endif}} - {{if True}} - CU_GL_MAP_RESOURCE_FLAGS_READ_ONLY = ccuda.CUGLmap_flags_enum.CU_GL_MAP_RESOURCE_FLAGS_READ_ONLY{{endif}} - {{if True}} - CU_GL_MAP_RESOURCE_FLAGS_WRITE_DISCARD = ccuda.CUGLmap_flags_enum.CU_GL_MAP_RESOURCE_FLAGS_WRITE_DISCARD{{endif}} -{{endif}} -{{if 'CUdeviceptr' in found_types}} -cdef class CUdeviceptr: - """ + CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS_USES_HOST_PAGE_TABLES = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS_USES_HOST_PAGE_TABLES, + "Device accesses pageable memory via the host's page tables.\n" + ) - CUDA device pointer CUdeviceptr is defined as an unsigned integer type whose size matches the size of a pointer on the target platform. - Methods - ------- - getPtr() - Get memory address of class instance + CU_DEVICE_ATTRIBUTE_DIRECT_MANAGED_MEM_ACCESS_FROM_HOST = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_DIRECT_MANAGED_MEM_ACCESS_FROM_HOST, + 'The host can directly access managed memory on the device without\n' + 'migration.\n' + ) - """ - def __cinit__(self, unsigned long long init_value = 0, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - else: - self._ptr = _ptr - if init_value: - self._ptr[0] = init_value - def __dealloc__(self): - pass - def __repr__(self): - return '' - def __int__(self): - return self._ptr[0] - def getPtr(self): - return self._ptr -{{endif}} -{{if 'CUdevice' in found_types}} + CU_DEVICE_ATTRIBUTE_VIRTUAL_ADDRESS_MANAGEMENT_SUPPORTED = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_VIRTUAL_ADDRESS_MANAGEMENT_SUPPORTED, + 'Deprecated, Use CU_DEVICE_ATTRIBUTE_VIRTUAL_MEMORY_MANAGEMENT_SUPPORTED\n' + ) -cdef class CUdevice: - """ - CUDA device + CU_DEVICE_ATTRIBUTE_VIRTUAL_MEMORY_MANAGEMENT_SUPPORTED = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_VIRTUAL_MEMORY_MANAGEMENT_SUPPORTED, + 'Device supports virtual memory management APIs like\n' + ':py:obj:`~.cuMemAddressReserve`, :py:obj:`~.cuMemCreate`,\n' + ':py:obj:`~.cuMemMap` and related APIs\n' + ) - Methods - ------- - getPtr() - Get memory address of class instance - """ - def __cinit__(self, int init_value = 0, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - else: - self._ptr = _ptr - if init_value: - self._ptr[0] = init_value - def __dealloc__(self): - pass - def __repr__(self): - return '' - def __int__(self): - return self._ptr[0] - def getPtr(self): - return self._ptr -{{endif}} + CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_POSIX_FILE_DESCRIPTOR_SUPPORTED = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_POSIX_FILE_DESCRIPTOR_SUPPORTED, + 'Device supports exporting memory to a posix file descriptor with\n' + ':py:obj:`~.cuMemExportToShareableHandle`, if requested via\n' + ':py:obj:`~.cuMemCreate`\n' + ) -{{if 'CUtexObject' in found_types}} -cdef class CUtexObject: - """ + CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_WIN32_HANDLE_SUPPORTED = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_WIN32_HANDLE_SUPPORTED, + 'Device supports exporting memory to a Win32 NT handle with\n' + ':py:obj:`~.cuMemExportToShareableHandle`, if requested via\n' + ':py:obj:`~.cuMemCreate`\n' + ) - An opaque value that represents a CUDA texture object - Methods - ------- - getPtr() - Get memory address of class instance + CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_WIN32_KMT_HANDLE_SUPPORTED = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_WIN32_KMT_HANDLE_SUPPORTED, + 'Device supports exporting memory to a Win32 KMT handle with\n' + ':py:obj:`~.cuMemExportToShareableHandle`, if requested via\n' + ':py:obj:`~.cuMemCreate`\n' + ) - """ - def __cinit__(self, unsigned long long init_value = 0, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - else: - self._ptr = _ptr - if init_value: - self._ptr[0] = init_value - def __dealloc__(self): - pass - def __repr__(self): - return '' - def __int__(self): - return self._ptr[0] - def getPtr(self): - return self._ptr -{{endif}} -{{if 'CUsurfObject' in found_types}} + CU_DEVICE_ATTRIBUTE_MAX_BLOCKS_PER_MULTIPROCESSOR = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAX_BLOCKS_PER_MULTIPROCESSOR, + 'Maximum number of blocks per multiprocessor\n' + ) -cdef class CUsurfObject: - """ - An opaque value that represents a CUDA surface object + CU_DEVICE_ATTRIBUTE_GENERIC_COMPRESSION_SUPPORTED = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_GENERIC_COMPRESSION_SUPPORTED, + 'Device supports compression of memory\n' + ) - Methods - ------- - getPtr() - Get memory address of class instance - """ - def __cinit__(self, unsigned long long init_value = 0, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - else: - self._ptr = _ptr - if init_value: - self._ptr[0] = init_value - def __dealloc__(self): - pass - def __repr__(self): - return '' - def __int__(self): - return self._ptr[0] - def getPtr(self): - return self._ptr -{{endif}} + CU_DEVICE_ATTRIBUTE_MAX_PERSISTING_L2_CACHE_SIZE = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAX_PERSISTING_L2_CACHE_SIZE, + 'Maximum L2 persisting lines capacity setting in bytes.\n' + ) -{{if 'CUgraphConditionalHandle' in found_types}} -cdef class CUgraphConditionalHandle: - """ + CU_DEVICE_ATTRIBUTE_MAX_ACCESS_POLICY_WINDOW_SIZE = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAX_ACCESS_POLICY_WINDOW_SIZE, + 'Maximum value of :py:obj:`~.CUaccessPolicyWindow.num_bytes`.\n' + ) - Methods - ------- - getPtr() - Get memory address of class instance - """ - def __cinit__(self, uint64_t init_value = 0, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - else: - self._ptr = _ptr - if init_value: - self._ptr[0] = init_value - def __dealloc__(self): - pass - def __repr__(self): - return '' - def __int__(self): - return self._ptr[0] - def getPtr(self): - return self._ptr -{{endif}} + CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_WITH_CUDA_VMM_SUPPORTED = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_WITH_CUDA_VMM_SUPPORTED, + 'Device supports specifying the GPUDirect RDMA flag with\n' + ':py:obj:`~.cuMemCreate`\n' + ) -{{if 'CUlaunchAttributeID_enum' in found_types}} -class CUkernelNodeAttrID(IntEnum): - """ - Launch attributes enum; used as id field of - :py:obj:`~.CUlaunchAttribute` - """ - {{if 'CU_LAUNCH_ATTRIBUTE_IGNORE' in found_values}} - - #: Ignored entry, for convenient composition - CU_LAUNCH_ATTRIBUTE_IGNORE = ccuda.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_IGNORE{{endif}} - {{if 'CU_LAUNCH_ATTRIBUTE_ACCESS_POLICY_WINDOW' in found_values}} - - #: Valid for streams, graph nodes, launches. See - #: :py:obj:`~.CUlaunchAttributeValue.accessPolicyWindow`. - CU_LAUNCH_ATTRIBUTE_ACCESS_POLICY_WINDOW = ccuda.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_ACCESS_POLICY_WINDOW{{endif}} - {{if 'CU_LAUNCH_ATTRIBUTE_COOPERATIVE' in found_values}} - - #: Valid for graph nodes, launches. See - #: :py:obj:`~.CUlaunchAttributeValue.cooperative`. - CU_LAUNCH_ATTRIBUTE_COOPERATIVE = ccuda.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_COOPERATIVE{{endif}} - {{if 'CU_LAUNCH_ATTRIBUTE_SYNCHRONIZATION_POLICY' in found_values}} - - #: Valid for streams. See - #: :py:obj:`~.CUlaunchAttributeValue.syncPolicy`. - CU_LAUNCH_ATTRIBUTE_SYNCHRONIZATION_POLICY = ccuda.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_SYNCHRONIZATION_POLICY{{endif}} - {{if 'CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION' in found_values}} - - #: Valid for graph nodes, launches. See - #: :py:obj:`~.CUlaunchAttributeValue.clusterDim`. - CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION = ccuda.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION{{endif}} - {{if 'CU_LAUNCH_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE' in found_values}} - - #: Valid for graph nodes, launches. See - #: :py:obj:`~.CUlaunchAttributeValue.clusterSchedulingPolicyPreference`. - CU_LAUNCH_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE = ccuda.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE{{endif}} - {{if 'CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_STREAM_SERIALIZATION' in found_values}} - - #: Valid for launches. Setting - #: :py:obj:`~.CUlaunchAttributeValue.programmaticStreamSerializationAllowed` - #: to non-0 signals that the kernel will use programmatic means to - #: resolve its stream dependency, so that the CUDA runtime should - #: opportunistically allow the grid's execution to overlap with the - #: previous kernel in the stream, if that kernel requests the overlap. - #: The dependent launches can choose to wait on the dependency using - #: the programmatic sync (cudaGridDependencySynchronize() or equivalent - #: PTX instructions). - CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_STREAM_SERIALIZATION = ccuda.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_STREAM_SERIALIZATION{{endif}} - {{if 'CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_EVENT' in found_values}} - - #: Valid for launches. Set - #: :py:obj:`~.CUlaunchAttributeValue.programmaticEvent` to record the - #: event. Event recorded through this launch attribute is guaranteed to - #: only trigger after all block in the associated kernel trigger the - #: event. A block can trigger the event through PTX launchdep.release - #: or CUDA builtin function cudaTriggerProgrammaticLaunchCompletion(). - #: A trigger can also be inserted at the beginning of each block's - #: execution if triggerAtBlockStart is set to non-0. The dependent - #: launches can choose to wait on the dependency using the programmatic - #: sync (cudaGridDependencySynchronize() or equivalent PTX - #: instructions). Note that dependents (including the CPU thread - #: calling :py:obj:`~.cuEventSynchronize()`) are not guaranteed to - #: observe the release precisely when it is released. For example, - #: :py:obj:`~.cuEventSynchronize()` may only observe the event trigger - #: long after the associated kernel has completed. This recording type - #: is primarily meant for establishing programmatic dependency between - #: device tasks. Note also this type of dependency allows, but does not - #: guarantee, concurrent execution of tasks. - #: The event supplied must not be an interprocess or interop event. - #: The event must disable timing (i.e. must be created with the - #: :py:obj:`~.CU_EVENT_DISABLE_TIMING` flag set). - CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_EVENT = ccuda.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_EVENT{{endif}} - {{if 'CU_LAUNCH_ATTRIBUTE_PRIORITY' in found_values}} - - #: Valid for streams, graph nodes, launches. See - #: :py:obj:`~.CUlaunchAttributeValue.priority`. - CU_LAUNCH_ATTRIBUTE_PRIORITY = ccuda.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_PRIORITY{{endif}} - {{if 'CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP' in found_values}} - - #: Valid for streams, graph nodes, launches. See - #: :py:obj:`~.CUlaunchAttributeValue.memSyncDomainMap`. - CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP = ccuda.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP{{endif}} - {{if 'CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN' in found_values}} - - #: Valid for streams, graph nodes, launches. See - #: :py:obj:`~.CUlaunchAttributeValue.memSyncDomain`. - CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN = ccuda.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN{{endif}} - {{if 'CU_LAUNCH_ATTRIBUTE_LAUNCH_COMPLETION_EVENT' in found_values}} - - #: Valid for launches. Set - #: :py:obj:`~.CUlaunchAttributeValue.launchCompletionEvent` to record - #: the event. - #: Nominally, the event is triggered once all blocks of the kernel - #: have begun execution. Currently this is a best effort. If a kernel B - #: has a launch completion dependency on a kernel A, B may wait until A - #: is complete. Alternatively, blocks of B may begin before all blocks - #: of A have begun, for example if B can claim execution resources - #: unavailable to A (e.g. they run on different GPUs) or if B is a - #: higher priority than A. Exercise caution if such an ordering - #: inversion could lead to deadlock. - #: A launch completion event is nominally similar to a programmatic - #: event with `triggerAtBlockStart` set except that it is not visible - #: to `cudaGridDependencySynchronize()` and can be used with compute - #: capability less than 9.0. - #: The event supplied must not be an interprocess or interop event. - #: The event must disable timing (i.e. must be created with the - #: :py:obj:`~.CU_EVENT_DISABLE_TIMING` flag set). - CU_LAUNCH_ATTRIBUTE_LAUNCH_COMPLETION_EVENT = ccuda.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_LAUNCH_COMPLETION_EVENT{{endif}} - {{if 'CU_LAUNCH_ATTRIBUTE_DEVICE_UPDATABLE_KERNEL_NODE' in found_values}} - - #: Valid for graph nodes, launches. This attribute is graphs-only, and - #: passing it to a launch in a non-capturing stream will result in an - #: error. - #: :py:obj:`~.CUlaunchAttributeValue`::deviceUpdatableKernelNode::deviceUpdatable - #: can only be set to 0 or 1. Setting the field to 1 indicates that the - #: corresponding kernel node should be device-updatable. On success, a - #: handle will be returned via - #: :py:obj:`~.CUlaunchAttributeValue`::deviceUpdatableKernelNode::devNode - #: which can be passed to the various device-side update functions to - #: update the node's kernel parameters from within another kernel. For - #: more information on the types of device updates that can be made, as - #: well as the relevant limitations thereof, see - #: :py:obj:`~.cudaGraphKernelNodeUpdatesApply`. - #: Nodes which are device-updatable have additional restrictions - #: compared to regular kernel nodes. Firstly, device-updatable nodes - #: cannot be removed from their graph via - #: :py:obj:`~.cuGraphDestroyNode`. Additionally, once opted-in to this - #: functionality, a node cannot opt out, and any attempt to set the - #: deviceUpdatable attribute to 0 will result in an error. Device- - #: updatable kernel nodes also cannot have their attributes copied - #: to/from another kernel node via - #: :py:obj:`~.cuGraphKernelNodeCopyAttributes`. Graphs containing one - #: or more device-updatable nodes also do not allow multiple - #: instantiation, and neither the graph nor its instantiated version - #: can be passed to :py:obj:`~.cuGraphExecUpdate`. - #: If a graph contains device-updatable nodes and updates those nodes - #: from the device from within the graph, the graph must be uploaded - #: with :py:obj:`~.cuGraphUpload` before it is launched. For such a - #: graph, if host-side executable graph updates are made to the device- - #: updatable nodes, the graph must be uploaded before it is launched - #: again. - CU_LAUNCH_ATTRIBUTE_DEVICE_UPDATABLE_KERNEL_NODE = ccuda.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_DEVICE_UPDATABLE_KERNEL_NODE{{endif}} - {{if 'CU_LAUNCH_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT' in found_values}} - - #: Valid for launches. On devices where the L1 cache and shared memory - #: use the same hardware resources, setting - #: :py:obj:`~.CUlaunchAttributeValue.sharedMemCarveout` to a percentage - #: between 0-100 signals the CUDA driver to set the shared memory - #: carveout preference, in percent of the total shared memory for that - #: kernel launch. This attribute takes precedence over - #: :py:obj:`~.CU_FUNC_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT`. This - #: is only a hint, and the CUDA driver can choose a different - #: configuration if required for the launch. - CU_LAUNCH_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT = ccuda.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT{{endif}} -{{endif}} -{{if 'CUlaunchAttributeID_enum' in found_types}} - -class CUstreamAttrID(IntEnum): - """ - Launch attributes enum; used as id field of - :py:obj:`~.CUlaunchAttribute` - """ - {{if 'CU_LAUNCH_ATTRIBUTE_IGNORE' in found_values}} - - #: Ignored entry, for convenient composition - CU_LAUNCH_ATTRIBUTE_IGNORE = ccuda.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_IGNORE{{endif}} - {{if 'CU_LAUNCH_ATTRIBUTE_ACCESS_POLICY_WINDOW' in found_values}} - - #: Valid for streams, graph nodes, launches. See - #: :py:obj:`~.CUlaunchAttributeValue.accessPolicyWindow`. - CU_LAUNCH_ATTRIBUTE_ACCESS_POLICY_WINDOW = ccuda.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_ACCESS_POLICY_WINDOW{{endif}} - {{if 'CU_LAUNCH_ATTRIBUTE_COOPERATIVE' in found_values}} - - #: Valid for graph nodes, launches. See - #: :py:obj:`~.CUlaunchAttributeValue.cooperative`. - CU_LAUNCH_ATTRIBUTE_COOPERATIVE = ccuda.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_COOPERATIVE{{endif}} - {{if 'CU_LAUNCH_ATTRIBUTE_SYNCHRONIZATION_POLICY' in found_values}} - - #: Valid for streams. See - #: :py:obj:`~.CUlaunchAttributeValue.syncPolicy`. - CU_LAUNCH_ATTRIBUTE_SYNCHRONIZATION_POLICY = ccuda.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_SYNCHRONIZATION_POLICY{{endif}} - {{if 'CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION' in found_values}} - - #: Valid for graph nodes, launches. See - #: :py:obj:`~.CUlaunchAttributeValue.clusterDim`. - CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION = ccuda.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION{{endif}} - {{if 'CU_LAUNCH_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE' in found_values}} - - #: Valid for graph nodes, launches. See - #: :py:obj:`~.CUlaunchAttributeValue.clusterSchedulingPolicyPreference`. - CU_LAUNCH_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE = ccuda.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE{{endif}} - {{if 'CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_STREAM_SERIALIZATION' in found_values}} - - #: Valid for launches. Setting - #: :py:obj:`~.CUlaunchAttributeValue.programmaticStreamSerializationAllowed` - #: to non-0 signals that the kernel will use programmatic means to - #: resolve its stream dependency, so that the CUDA runtime should - #: opportunistically allow the grid's execution to overlap with the - #: previous kernel in the stream, if that kernel requests the overlap. - #: The dependent launches can choose to wait on the dependency using - #: the programmatic sync (cudaGridDependencySynchronize() or equivalent - #: PTX instructions). - CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_STREAM_SERIALIZATION = ccuda.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_STREAM_SERIALIZATION{{endif}} - {{if 'CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_EVENT' in found_values}} - - #: Valid for launches. Set - #: :py:obj:`~.CUlaunchAttributeValue.programmaticEvent` to record the - #: event. Event recorded through this launch attribute is guaranteed to - #: only trigger after all block in the associated kernel trigger the - #: event. A block can trigger the event through PTX launchdep.release - #: or CUDA builtin function cudaTriggerProgrammaticLaunchCompletion(). - #: A trigger can also be inserted at the beginning of each block's - #: execution if triggerAtBlockStart is set to non-0. The dependent - #: launches can choose to wait on the dependency using the programmatic - #: sync (cudaGridDependencySynchronize() or equivalent PTX - #: instructions). Note that dependents (including the CPU thread - #: calling :py:obj:`~.cuEventSynchronize()`) are not guaranteed to - #: observe the release precisely when it is released. For example, - #: :py:obj:`~.cuEventSynchronize()` may only observe the event trigger - #: long after the associated kernel has completed. This recording type - #: is primarily meant for establishing programmatic dependency between - #: device tasks. Note also this type of dependency allows, but does not - #: guarantee, concurrent execution of tasks. - #: The event supplied must not be an interprocess or interop event. - #: The event must disable timing (i.e. must be created with the - #: :py:obj:`~.CU_EVENT_DISABLE_TIMING` flag set). - CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_EVENT = ccuda.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_EVENT{{endif}} - {{if 'CU_LAUNCH_ATTRIBUTE_PRIORITY' in found_values}} - - #: Valid for streams, graph nodes, launches. See - #: :py:obj:`~.CUlaunchAttributeValue.priority`. - CU_LAUNCH_ATTRIBUTE_PRIORITY = ccuda.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_PRIORITY{{endif}} - {{if 'CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP' in found_values}} - - #: Valid for streams, graph nodes, launches. See - #: :py:obj:`~.CUlaunchAttributeValue.memSyncDomainMap`. - CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP = ccuda.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP{{endif}} - {{if 'CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN' in found_values}} - - #: Valid for streams, graph nodes, launches. See - #: :py:obj:`~.CUlaunchAttributeValue.memSyncDomain`. - CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN = ccuda.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN{{endif}} - {{if 'CU_LAUNCH_ATTRIBUTE_LAUNCH_COMPLETION_EVENT' in found_values}} - - #: Valid for launches. Set - #: :py:obj:`~.CUlaunchAttributeValue.launchCompletionEvent` to record - #: the event. - #: Nominally, the event is triggered once all blocks of the kernel - #: have begun execution. Currently this is a best effort. If a kernel B - #: has a launch completion dependency on a kernel A, B may wait until A - #: is complete. Alternatively, blocks of B may begin before all blocks - #: of A have begun, for example if B can claim execution resources - #: unavailable to A (e.g. they run on different GPUs) or if B is a - #: higher priority than A. Exercise caution if such an ordering - #: inversion could lead to deadlock. - #: A launch completion event is nominally similar to a programmatic - #: event with `triggerAtBlockStart` set except that it is not visible - #: to `cudaGridDependencySynchronize()` and can be used with compute - #: capability less than 9.0. - #: The event supplied must not be an interprocess or interop event. - #: The event must disable timing (i.e. must be created with the - #: :py:obj:`~.CU_EVENT_DISABLE_TIMING` flag set). - CU_LAUNCH_ATTRIBUTE_LAUNCH_COMPLETION_EVENT = ccuda.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_LAUNCH_COMPLETION_EVENT{{endif}} - {{if 'CU_LAUNCH_ATTRIBUTE_DEVICE_UPDATABLE_KERNEL_NODE' in found_values}} - - #: Valid for graph nodes, launches. This attribute is graphs-only, and - #: passing it to a launch in a non-capturing stream will result in an - #: error. - #: :py:obj:`~.CUlaunchAttributeValue`::deviceUpdatableKernelNode::deviceUpdatable - #: can only be set to 0 or 1. Setting the field to 1 indicates that the - #: corresponding kernel node should be device-updatable. On success, a - #: handle will be returned via - #: :py:obj:`~.CUlaunchAttributeValue`::deviceUpdatableKernelNode::devNode - #: which can be passed to the various device-side update functions to - #: update the node's kernel parameters from within another kernel. For - #: more information on the types of device updates that can be made, as - #: well as the relevant limitations thereof, see - #: :py:obj:`~.cudaGraphKernelNodeUpdatesApply`. - #: Nodes which are device-updatable have additional restrictions - #: compared to regular kernel nodes. Firstly, device-updatable nodes - #: cannot be removed from their graph via - #: :py:obj:`~.cuGraphDestroyNode`. Additionally, once opted-in to this - #: functionality, a node cannot opt out, and any attempt to set the - #: deviceUpdatable attribute to 0 will result in an error. Device- - #: updatable kernel nodes also cannot have their attributes copied - #: to/from another kernel node via - #: :py:obj:`~.cuGraphKernelNodeCopyAttributes`. Graphs containing one - #: or more device-updatable nodes also do not allow multiple - #: instantiation, and neither the graph nor its instantiated version - #: can be passed to :py:obj:`~.cuGraphExecUpdate`. - #: If a graph contains device-updatable nodes and updates those nodes - #: from the device from within the graph, the graph must be uploaded - #: with :py:obj:`~.cuGraphUpload` before it is launched. For such a - #: graph, if host-side executable graph updates are made to the device- - #: updatable nodes, the graph must be uploaded before it is launched - #: again. - CU_LAUNCH_ATTRIBUTE_DEVICE_UPDATABLE_KERNEL_NODE = ccuda.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_DEVICE_UPDATABLE_KERNEL_NODE{{endif}} - {{if 'CU_LAUNCH_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT' in found_values}} - - #: Valid for launches. On devices where the L1 cache and shared memory - #: use the same hardware resources, setting - #: :py:obj:`~.CUlaunchAttributeValue.sharedMemCarveout` to a percentage - #: between 0-100 signals the CUDA driver to set the shared memory - #: carveout preference, in percent of the total shared memory for that - #: kernel launch. This attribute takes precedence over - #: :py:obj:`~.CU_FUNC_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT`. This - #: is only a hint, and the CUDA driver can choose a different - #: configuration if required for the launch. - CU_LAUNCH_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT = ccuda.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT{{endif}} -{{endif}} -{{if 'CUmemGenericAllocationHandle' in found_types}} + CU_DEVICE_ATTRIBUTE_RESERVED_SHARED_MEMORY_PER_BLOCK = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_RESERVED_SHARED_MEMORY_PER_BLOCK, + 'Shared memory reserved by CUDA driver per block in bytes\n' + ) -cdef class CUmemGenericAllocationHandle: - """ - Methods - ------- - getPtr() - Get memory address of class instance + CU_DEVICE_ATTRIBUTE_SPARSE_CUDA_ARRAY_SUPPORTED = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_SPARSE_CUDA_ARRAY_SUPPORTED, + 'Device supports sparse CUDA arrays and sparse CUDA mipmapped arrays\n' + ) - """ - def __cinit__(self, unsigned long long init_value = 0, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - else: - self._ptr = _ptr - if init_value: - self._ptr[0] = init_value - def __dealloc__(self): - pass - def __repr__(self): - return '' - def __int__(self): - return self._ptr[0] - def getPtr(self): - return self._ptr -{{endif}} -{{if 'CUcontext' in found_types}} + CU_DEVICE_ATTRIBUTE_READ_ONLY_HOST_REGISTER_SUPPORTED = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_READ_ONLY_HOST_REGISTER_SUPPORTED, + 'Device supports using the :py:obj:`~.cuMemHostRegister` flag\n' + ':py:obj:`~.CU_MEMHOSTERGISTER_READ_ONLY` to register memory that must be\n' + 'mapped as read-only to the GPU\n' + ) -cdef class CUcontext: - """ - A regular context handle + CU_DEVICE_ATTRIBUTE_TIMELINE_SEMAPHORE_INTEROP_SUPPORTED = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_TIMELINE_SEMAPHORE_INTEROP_SUPPORTED, + 'External timeline semaphore interop is supported on the device\n' + ) - Methods - ------- - getPtr() - Get memory address of class instance - """ - def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - self._ptr[0] = init_value - else: - self._ptr = _ptr - def __init__(self, *args, **kwargs): - pass - def __repr__(self): - return '' - def __index__(self): - return self.__int__() - def __int__(self): - return self._ptr[0] - def getPtr(self): - return self._ptr -{{endif}} + CU_DEVICE_ATTRIBUTE_MEMORY_POOLS_SUPPORTED = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MEMORY_POOLS_SUPPORTED, + 'Device supports using the :py:obj:`~.cuMemAllocAsync` and\n' + ':py:obj:`~.cuMemPool` family of APIs\n' + ) -{{if 'CUmodule' in found_types}} -cdef class CUmodule: - """ + CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_SUPPORTED = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_SUPPORTED, + 'Device supports GPUDirect RDMA APIs, like nvidia_p2p_get_pages (see\n' + 'https://docs.nvidia.com/cuda/gpudirect-rdma for more information)\n' + ) - CUDA module - Methods - ------- - getPtr() - Get memory address of class instance + CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_FLUSH_WRITES_OPTIONS = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_FLUSH_WRITES_OPTIONS, + 'The returned attribute shall be interpreted as a bitmask, where the\n' + 'individual bits are described by the\n' + ':py:obj:`~.CUflushGPUDirectRDMAWritesOptions` enum\n' + ) - """ - def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - self._ptr[0] = init_value - else: - self._ptr = _ptr - def __init__(self, *args, **kwargs): - pass - def __repr__(self): - return '' - def __index__(self): - return self.__int__() - def __int__(self): - return self._ptr[0] - def getPtr(self): - return self._ptr -{{endif}} -{{if 'CUfunction' in found_types}} + CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_WRITES_ORDERING = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_WRITES_ORDERING, + 'GPUDirect RDMA writes to the device do not need to be flushed for consumers\n' + 'within the scope indicated by the returned attribute. See\n' + ':py:obj:`~.CUGPUDirectRDMAWritesOrdering` for the numerical values returned\n' + 'here.\n' + ) -cdef class CUfunction: - """ - CUDA function + CU_DEVICE_ATTRIBUTE_MEMPOOL_SUPPORTED_HANDLE_TYPES = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MEMPOOL_SUPPORTED_HANDLE_TYPES, + 'Handle types supported with mempool based IPC\n' + ) - Methods - ------- - getPtr() - Get memory address of class instance - """ - def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - self._ptr[0] = init_value - else: - self._ptr = _ptr - def __init__(self, *args, **kwargs): - pass - def __repr__(self): - return '' - def __index__(self): - return self.__int__() - def __int__(self): - return self._ptr[0] - def getPtr(self): - return self._ptr -{{endif}} + CU_DEVICE_ATTRIBUTE_CLUSTER_LAUNCH = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_CLUSTER_LAUNCH, + 'Indicates device supports cluster launch\n' + ) -{{if 'CUlibrary' in found_types}} -cdef class CUlibrary: - """ + CU_DEVICE_ATTRIBUTE_DEFERRED_MAPPING_CUDA_ARRAY_SUPPORTED = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_DEFERRED_MAPPING_CUDA_ARRAY_SUPPORTED, + 'Device supports deferred mapping CUDA arrays and CUDA mipmapped arrays\n' + ) - CUDA library - Methods - ------- - getPtr() - Get memory address of class instance + CU_DEVICE_ATTRIBUTE_CAN_USE_64_BIT_STREAM_MEM_OPS = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_CAN_USE_64_BIT_STREAM_MEM_OPS, + '64-bit operations are supported in :py:obj:`~.cuStreamBatchMemOp` and\n' + 'related MemOp APIs.\n' + ) - """ - def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - self._ptr[0] = init_value - else: - self._ptr = _ptr - def __init__(self, *args, **kwargs): - pass - def __repr__(self): - return '' - def __index__(self): - return self.__int__() - def __int__(self): - return self._ptr[0] - def getPtr(self): - return self._ptr -{{endif}} -{{if 'CUkernel' in found_types}} + CU_DEVICE_ATTRIBUTE_CAN_USE_STREAM_WAIT_VALUE_NOR = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_CAN_USE_STREAM_WAIT_VALUE_NOR, + ':py:obj:`~.CU_STREAM_WAIT_VALUE_NOR` is supported by MemOp APIs.\n' + ) -cdef class CUkernel: - """ - CUDA kernel + CU_DEVICE_ATTRIBUTE_DMA_BUF_SUPPORTED = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_DMA_BUF_SUPPORTED, + 'Device supports buffer sharing with dma_buf mechanism.\n' + ) - Methods - ------- - getPtr() - Get memory address of class instance - """ - def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - self._ptr[0] = init_value - else: - self._ptr = _ptr - def __init__(self, *args, **kwargs): - pass - def __repr__(self): - return '' - def __index__(self): - return self.__int__() - def __int__(self): - return self._ptr[0] - def getPtr(self): - return self._ptr -{{endif}} + CU_DEVICE_ATTRIBUTE_IPC_EVENT_SUPPORTED = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_IPC_EVENT_SUPPORTED, + 'Device supports IPC Events.\n' + ) -{{if 'CUarray' in found_types}} -cdef class CUarray: - """ + CU_DEVICE_ATTRIBUTE_MEM_SYNC_DOMAIN_COUNT = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MEM_SYNC_DOMAIN_COUNT, + 'Number of memory domains the device supports.\n' + ) - CUDA array - Methods - ------- - getPtr() - Get memory address of class instance + CU_DEVICE_ATTRIBUTE_TENSOR_MAP_ACCESS_SUPPORTED = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_TENSOR_MAP_ACCESS_SUPPORTED, + 'Device supports accessing memory using Tensor Map.\n' + ) - """ - def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - self._ptr[0] = init_value - else: - self._ptr = _ptr - def __init__(self, *args, **kwargs): - pass - def __repr__(self): - return '' - def __index__(self): - return self.__int__() - def __int__(self): - return self._ptr[0] - def getPtr(self): - return self._ptr -{{endif}} -{{if 'CUmipmappedArray' in found_types}} + CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_FABRIC_SUPPORTED = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_FABRIC_SUPPORTED, + 'Device supports exporting memory to a fabric handle with\n' + ':py:obj:`~.cuMemExportToShareableHandle()` or requested with\n' + ':py:obj:`~.cuMemCreate()`\n' + ) -cdef class CUmipmappedArray: - """ - CUDA mipmapped array + CU_DEVICE_ATTRIBUTE_UNIFIED_FUNCTION_POINTERS = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_UNIFIED_FUNCTION_POINTERS, + 'Device supports unified function pointers.\n' + ) - Methods - ------- - getPtr() - Get memory address of class instance - """ - def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - self._ptr[0] = init_value - else: - self._ptr = _ptr - def __init__(self, *args, **kwargs): - pass - def __repr__(self): - return '' - def __index__(self): - return self.__int__() - def __int__(self): - return self._ptr[0] - def getPtr(self): - return self._ptr -{{endif}} + CU_DEVICE_ATTRIBUTE_NUMA_CONFIG = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_NUMA_CONFIG, + 'NUMA configuration of a device: value is of type\n' + ':py:obj:`~.CUdeviceNumaConfig` enum\n' + ) -{{if 'CUtexref' in found_types}} -cdef class CUtexref: - """ + CU_DEVICE_ATTRIBUTE_NUMA_ID = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_NUMA_ID, + 'NUMA node ID of the GPU memory\n' + ) - CUDA texture reference - Methods - ------- - getPtr() - Get memory address of class instance + CU_DEVICE_ATTRIBUTE_MULTICAST_SUPPORTED = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MULTICAST_SUPPORTED, + 'Device supports switch multicast and reduction operations.\n' + ) - """ - def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - self._ptr[0] = init_value - else: - self._ptr = _ptr - def __init__(self, *args, **kwargs): - pass - def __repr__(self): - return '' - def __index__(self): - return self.__int__() - def __int__(self): - return self._ptr[0] - def getPtr(self): - return self._ptr -{{endif}} -{{if 'CUsurfref' in found_types}} + CU_DEVICE_ATTRIBUTE_MPS_ENABLED = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MPS_ENABLED, + 'Indicates if contexts created on this device will be shared via MPS\n' + ) -cdef class CUsurfref: - """ - CUDA surface reference + CU_DEVICE_ATTRIBUTE_HOST_NUMA_ID = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_HOST_NUMA_ID, + 'NUMA ID of the host node closest to the device. Returns -1 when system does\n' + 'not support NUMA.\n' + ) - Methods - ------- - getPtr() - Get memory address of class instance - """ - def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - self._ptr[0] = init_value - else: - self._ptr = _ptr - def __init__(self, *args, **kwargs): - pass - def __repr__(self): - return '' - def __index__(self): - return self.__int__() - def __int__(self): - return self._ptr[0] - def getPtr(self): - return self._ptr -{{endif}} + CU_DEVICE_ATTRIBUTE_D3D12_CIG_SUPPORTED = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_D3D12_CIG_SUPPORTED, + 'Device supports CIG with D3D12.\n' + ) -{{if 'CUevent' in found_types}} -cdef class CUevent: - """ + CU_DEVICE_ATTRIBUTE_MEM_DECOMPRESS_ALGORITHM_MASK = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MEM_DECOMPRESS_ALGORITHM_MASK, + 'The returned valued shall be interpreted as a bitmask, where the individual\n' + 'bits are described by the :py:obj:`~.CUmemDecompressAlgorithm` enum.\n' + ) - CUDA event - Methods - ------- - getPtr() - Get memory address of class instance + CU_DEVICE_ATTRIBUTE_MEM_DECOMPRESS_MAXIMUM_LENGTH = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MEM_DECOMPRESS_MAXIMUM_LENGTH, + 'The returned valued is the maximum length in bytes of a single decompress\n' + 'operation that is allowed.\n' + ) - """ - def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - self._ptr[0] = init_value - else: - self._ptr = _ptr - def __init__(self, *args, **kwargs): - pass - def __repr__(self): - return '' - def __index__(self): - return self.__int__() - def __int__(self): - return self._ptr[0] - def getPtr(self): - return self._ptr -{{endif}} -{{if 'CUstream' in found_types}} + CU_DEVICE_ATTRIBUTE_VULKAN_CIG_SUPPORTED = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_VULKAN_CIG_SUPPORTED, + 'Device supports CIG with Vulkan.\n' + ) -cdef class CUstream: - """ - CUDA stream + CU_DEVICE_ATTRIBUTE_GPU_PCI_DEVICE_ID = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_GPU_PCI_DEVICE_ID, + 'The combined 16-bit PCI device ID and 16-bit PCI vendor ID.\n' + ) - Methods - ------- - getPtr() - Get memory address of class instance - """ - def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - self._ptr[0] = init_value - else: - self._ptr = _ptr - def __init__(self, *args, **kwargs): - pass - def __repr__(self): - return '' - def __index__(self): - return self.__int__() - def __int__(self): - return self._ptr[0] - def getPtr(self): - return self._ptr -{{endif}} + CU_DEVICE_ATTRIBUTE_GPU_PCI_SUBSYSTEM_ID = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_GPU_PCI_SUBSYSTEM_ID, + 'The combined 16-bit PCI subsystem ID and 16-bit PCI subsystem vendor ID.\n' + ) -{{if 'CUgraphicsResource' in found_types}} -cdef class CUgraphicsResource: - """ + CU_DEVICE_ATTRIBUTE_HOST_NUMA_VIRTUAL_MEMORY_MANAGEMENT_SUPPORTED = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_HOST_NUMA_VIRTUAL_MEMORY_MANAGEMENT_SUPPORTED, + 'Device supports HOST_NUMA location with the virtual memory management APIs\n' + 'like :py:obj:`~.cuMemCreate`, :py:obj:`~.cuMemMap` and related APIs\n' + ) - CUDA graphics interop resource - Methods - ------- - getPtr() - Get memory address of class instance + CU_DEVICE_ATTRIBUTE_HOST_NUMA_MEMORY_POOLS_SUPPORTED = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_HOST_NUMA_MEMORY_POOLS_SUPPORTED, + 'Device supports HOST_NUMA location with the :py:obj:`~.cuMemAllocAsync` and\n' + ':py:obj:`~.cuMemPool` family of APIs\n' + ) - """ - def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - self._ptr[0] = init_value - else: - self._ptr = _ptr - def __init__(self, *args, **kwargs): - pass - def __repr__(self): - return '' - def __index__(self): - return self.__int__() - def __int__(self): - return self._ptr[0] - def getPtr(self): - return self._ptr -{{endif}} -{{if 'CUexternalMemory' in found_types}} + CU_DEVICE_ATTRIBUTE_HOST_NUMA_MULTINODE_IPC_SUPPORTED = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_HOST_NUMA_MULTINODE_IPC_SUPPORTED, + 'Device supports HOST_NUMA location IPC between nodes in a multi-node\n' + 'system.\n' + ) -cdef class CUexternalMemory: - """ - CUDA external memory + CU_DEVICE_ATTRIBUTE_HOST_MEMORY_POOLS_SUPPORTED = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_HOST_MEMORY_POOLS_SUPPORTED, + 'Device suports HOST location with the :py:obj:`~.cuMemAllocAsync` and\n' + ':py:obj:`~.cuMemPool` family of APIs\n' + ) - Methods - ------- - getPtr() - Get memory address of class instance - """ - def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - self._ptr[0] = init_value - else: - self._ptr = _ptr - def __init__(self, *args, **kwargs): - pass - def __repr__(self): - return '' - def __index__(self): - return self.__int__() - def __int__(self): - return self._ptr[0] - def getPtr(self): - return self._ptr -{{endif}} + CU_DEVICE_ATTRIBUTE_HOST_VIRTUAL_MEMORY_MANAGEMENT_SUPPORTED = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_HOST_VIRTUAL_MEMORY_MANAGEMENT_SUPPORTED, + 'Device supports HOST location with the virtual memory management APIs like\n' + ':py:obj:`~.cuMemCreate`, :py:obj:`~.cuMemMap` and related APIs\n' + ) -{{if 'CUexternalSemaphore' in found_types}} -cdef class CUexternalSemaphore: - """ + CU_DEVICE_ATTRIBUTE_HOST_ALLOC_DMA_BUF_SUPPORTED = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_HOST_ALLOC_DMA_BUF_SUPPORTED, + 'Device supports page-locked host memory buffer sharing with dma_buf\n' + 'mechanism.\n' + ) - CUDA external semaphore - Methods - ------- - getPtr() - Get memory address of class instance + CU_DEVICE_ATTRIBUTE_ONLY_PARTIAL_HOST_NATIVE_ATOMIC_SUPPORTED = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_ONLY_PARTIAL_HOST_NATIVE_ATOMIC_SUPPORTED, + 'Link between the device and the host supports only some native atomic\n' + 'operations\n' + ) - """ - def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - self._ptr[0] = init_value - else: - self._ptr = _ptr - def __init__(self, *args, **kwargs): - pass - def __repr__(self): - return '' - def __index__(self): - return self.__int__() - def __int__(self): - return self._ptr[0] - def getPtr(self): - return self._ptr -{{endif}} -{{if 'CUgraph' in found_types}} + CU_DEVICE_ATTRIBUTE_ATOMIC_REDUCTION_SUPPORTED = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_ATOMIC_REDUCTION_SUPPORTED, + 'Device supports atomic reduction operations in stream batch memory\n' + 'operations\n' + ) -cdef class CUgraph: - """ - CUDA graph + CU_DEVICE_ATTRIBUTE_D3D12_CIG_STREAMS_SUPPORTED = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_D3D12_CIG_STREAMS_SUPPORTED, + 'Device supports CIG streams with D3D12\n' + ) - Methods - ------- - getPtr() - Get memory address of class instance - """ - def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - self._ptr[0] = init_value - else: - self._ptr = _ptr - def __init__(self, *args, **kwargs): - pass - def __repr__(self): - return '' - def __index__(self): - return self.__int__() - def __int__(self): - return self._ptr[0] - def getPtr(self): - return self._ptr -{{endif}} + CU_DEVICE_ATTRIBUTE_DMA_BUF_MMAP_SUPPORTED = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_DMA_BUF_MMAP_SUPPORTED, + 'Device supports mmap() of dmabuf file descriptors for CUDA device memory\n' + 'allocations\n' + ) -{{if 'CUgraphNode' in found_types}} -cdef class CUgraphNode: - """ + CU_DEVICE_ATTRIBUTE_LOGICAL_ENDPOINT_UNICAST_SUPPORTED = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_LOGICAL_ENDPOINT_UNICAST_SUPPORTED, + 'Device supports unicast logical endpoints\n' + ) - CUDA graph node - Methods - ------- - getPtr() - Get memory address of class instance + CU_DEVICE_ATTRIBUTE_LOGICAL_ENDPOINT_MULTICAST_SUPPORTED = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_LOGICAL_ENDPOINT_MULTICAST_SUPPORTED, + 'Device supports multicast logical endpoints\n' + ) - """ - def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - self._ptr[0] = init_value - else: - self._ptr = _ptr - def __init__(self, *args, **kwargs): - pass - def __repr__(self): - return '' - def __index__(self): - return self.__int__() - def __int__(self): - return self._ptr[0] - def getPtr(self): - return self._ptr -{{endif}} -{{if 'CUgraphExec' in found_types}} + CU_DEVICE_ATTRIBUTE_LOGICAL_ENDPOINT_COUNTED_OPS_SUPPORTED = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_LOGICAL_ENDPOINT_COUNTED_OPS_SUPPORTED, + 'Device supports counted operations via logical endpoints\n' + ) -cdef class CUgraphExec: - """ - CUDA executable graph + CU_DEVICE_ATTRIBUTE_LOGICAL_ENDPOINT_UNICAST_ACCESS_ON_OWNER_DEVICE_SUPPORTED = ( + cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_LOGICAL_ENDPOINT_UNICAST_ACCESS_ON_OWNER_DEVICE_SUPPORTED, + 'Device supports unicast logical endpoint access on the owner device\n' + ) - Methods - ------- - getPtr() - Get memory address of class instance + CU_DEVICE_ATTRIBUTE_MAX = cydriver.CUdevice_attribute_enum.CU_DEVICE_ATTRIBUTE_MAX +class CUpointer_attribute(_FastEnum): + """ + Pointer information """ - def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - self._ptr[0] = init_value - else: - self._ptr = _ptr - def __init__(self, *args, **kwargs): - pass - def __repr__(self): - return '' - def __index__(self): - return self.__int__() - def __int__(self): - return self._ptr[0] - def getPtr(self): - return self._ptr -{{endif}} -{{if 'CUmemoryPool' in found_types}} -cdef class CUmemoryPool: - """ + CU_POINTER_ATTRIBUTE_CONTEXT = ( + cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_CONTEXT, + 'The :py:obj:`~.CUcontext` on which a pointer was allocated or registered\n' + ) - CUDA memory pool - Methods - ------- - getPtr() - Get memory address of class instance + CU_POINTER_ATTRIBUTE_MEMORY_TYPE = ( + cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_MEMORY_TYPE, + 'The :py:obj:`~.CUmemorytype` describing the physical location of a pointer\n' + ) - """ - def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - self._ptr[0] = init_value - else: - self._ptr = _ptr - def __init__(self, *args, **kwargs): - pass - def __repr__(self): - return '' - def __index__(self): - return self.__int__() - def __int__(self): - return self._ptr[0] - def getPtr(self): - return self._ptr -{{endif}} -{{if 'CUuserObject' in found_types}} + CU_POINTER_ATTRIBUTE_DEVICE_POINTER = ( + cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_DEVICE_POINTER, + "The address at which a pointer's memory may be accessed on the device\n" + ) -cdef class CUuserObject: - """ - CUDA user object for graphs + CU_POINTER_ATTRIBUTE_HOST_POINTER = ( + cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_HOST_POINTER, + "The address at which a pointer's memory may be accessed on the host\n" + ) - Methods - ------- - getPtr() - Get memory address of class instance - """ - def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - self._ptr[0] = init_value - else: - self._ptr = _ptr - def __init__(self, *args, **kwargs): - pass - def __repr__(self): - return '' - def __index__(self): - return self.__int__() - def __int__(self): - return self._ptr[0] - def getPtr(self): - return self._ptr -{{endif}} + CU_POINTER_ATTRIBUTE_P2P_TOKENS = ( + cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_P2P_TOKENS, + 'A pair of tokens for use with the nv-p2p.h Linux kernel interface\n' + ) -{{if 'CUgraphDeviceNode' in found_types}} -cdef class CUgraphDeviceNode: - """ + CU_POINTER_ATTRIBUTE_SYNC_MEMOPS = ( + cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_SYNC_MEMOPS, + 'Synchronize every synchronous memory operation initiated on this region\n' + ) - CUDA graph device node handle - Methods - ------- - getPtr() - Get memory address of class instance + CU_POINTER_ATTRIBUTE_BUFFER_ID = ( + cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_BUFFER_ID, + 'A process-wide unique ID for an allocated memory region\n' + ) - """ - def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - self._ptr[0] = init_value - else: - self._ptr = _ptr - def __init__(self, *args, **kwargs): - pass - def __repr__(self): - return '' - def __index__(self): - return self.__int__() - def __int__(self): - return self._ptr[0] - def getPtr(self): - return self._ptr -{{endif}} -{{if 'CUasyncCallbackHandle' in found_types}} + CU_POINTER_ATTRIBUTE_IS_MANAGED = ( + cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_IS_MANAGED, + 'Indicates if the pointer points to managed memory\n' + ) -cdef class CUasyncCallbackHandle: - """ - CUDA async notification callback handle + CU_POINTER_ATTRIBUTE_DEVICE_ORDINAL = ( + cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_DEVICE_ORDINAL, + 'A device ordinal of a device on which a pointer was allocated or registered\n' + ) - Methods - ------- - getPtr() - Get memory address of class instance - """ - def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - self._ptr[0] = init_value - else: - self._ptr = _ptr - def __init__(self, *args, **kwargs): - pass - def __repr__(self): - return '' - def __index__(self): - return self.__int__() - def __int__(self): - return self._ptr[0] - def getPtr(self): - return self._ptr -{{endif}} + CU_POINTER_ATTRIBUTE_IS_LEGACY_CUDA_IPC_CAPABLE = ( + cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_IS_LEGACY_CUDA_IPC_CAPABLE, + '1 if this pointer maps to an allocation that is suitable for\n' + ':py:obj:`~.cudaIpcGetMemHandle`, 0 otherwise\n' + ) -{{if 'CUgreenCtx' in found_types}} -cdef class CUgreenCtx: - """ + CU_POINTER_ATTRIBUTE_RANGE_START_ADDR = ( + cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_RANGE_START_ADDR, + 'Starting address for this requested pointer\n' + ) - A green context handle. This handle can be used safely from only one CPU thread at a time. Created via cuGreenCtxCreate - Methods - ------- - getPtr() - Get memory address of class instance + CU_POINTER_ATTRIBUTE_RANGE_SIZE = ( + cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_RANGE_SIZE, + 'Size of the address range for this requested pointer\n' + ) - """ - def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - self._ptr[0] = init_value - else: - self._ptr = _ptr - def __init__(self, *args, **kwargs): - pass - def __repr__(self): - return '' - def __index__(self): - return self.__int__() - def __int__(self): - return self._ptr[0] - def getPtr(self): - return self._ptr -{{endif}} -{{if 'CUlinkState' in found_types}} + CU_POINTER_ATTRIBUTE_MAPPED = ( + cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_MAPPED, + '1 if this pointer is in a valid address range that is mapped to a backing\n' + 'allocation, 0 otherwise\n' + ) -cdef class CUlinkState: - """ - Methods - ------- - getPtr() - Get memory address of class instance + CU_POINTER_ATTRIBUTE_ALLOWED_HANDLE_TYPES = ( + cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_ALLOWED_HANDLE_TYPES, + 'Bitmask of allowed :py:obj:`~.CUmemAllocationHandleType` for this\n' + 'allocation\n' + ) - """ - def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - self._ptr[0] = init_value - else: - self._ptr = _ptr - def __init__(self, *args, **kwargs): - self._keepalive = [] - def __repr__(self): - return '' - def __index__(self): - return self.__int__() - def __int__(self): - return self._ptr[0] - def getPtr(self): - return self._ptr -{{endif}} -{{if 'CUdevResourceDesc' in found_types}} + CU_POINTER_ATTRIBUTE_IS_GPU_DIRECT_RDMA_CAPABLE = ( + cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_IS_GPU_DIRECT_RDMA_CAPABLE, + '1 if the memory this pointer is referencing can be used with the GPUDirect\n' + 'RDMA API\n' + ) -cdef class CUdevResourceDesc: - """ - An opaque descriptor handle. The descriptor encapsulates multiple created and configured resources. Created via cuDevResourceGenerateDesc + CU_POINTER_ATTRIBUTE_ACCESS_FLAGS = ( + cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_ACCESS_FLAGS, + 'Returns the access flags the device associated with the current context has\n' + 'on the corresponding memory referenced by the pointer given\n' + ) - Methods - ------- - getPtr() - Get memory address of class instance - """ - def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - self._ptr[0] = init_value - else: - self._ptr = _ptr - def __init__(self, *args, **kwargs): - pass - def __repr__(self): - return '' - def __index__(self): - return self.__int__() - def __int__(self): - return self._ptr[0] - def getPtr(self): - return self._ptr -{{endif}} + CU_POINTER_ATTRIBUTE_MEMPOOL_HANDLE = ( + cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_MEMPOOL_HANDLE, + 'Returns the mempool handle for the allocation if it was allocated from a\n' + 'mempool. Otherwise returns NULL.\n' + ) -{{if True}} -cdef class CUeglStreamConnection: - """ + CU_POINTER_ATTRIBUTE_MAPPING_SIZE = ( + cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_MAPPING_SIZE, + 'Size of the actual underlying mapping that the pointer belongs to\n' + ) - CUDA EGLSream Connection - Methods - ------- - getPtr() - Get memory address of class instance + CU_POINTER_ATTRIBUTE_MAPPING_BASE_ADDR = ( + cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_MAPPING_BASE_ADDR, + 'The start address of the mapping that the pointer belongs to\n' + ) - """ - def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - self._ptr[0] = init_value - else: - self._ptr = _ptr - def __init__(self, *args, **kwargs): - pass - def __repr__(self): - return '' - def __index__(self): - return self.__int__() - def __int__(self): - return self._ptr[0] - def getPtr(self): - return self._ptr -{{endif}} -{{if True}} + CU_POINTER_ATTRIBUTE_MEMORY_BLOCK_ID = ( + cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_MEMORY_BLOCK_ID, + 'A process-wide unique id corresponding to the physical allocation the\n' + 'pointer belongs to\n' + ) -cdef class EGLImageKHR: - """ - Methods - ------- - getPtr() - Get memory address of class instance + CU_POINTER_ATTRIBUTE_IS_HW_DECOMPRESS_CAPABLE = ( + cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_IS_HW_DECOMPRESS_CAPABLE, + 'Returns in `*data` a boolean that indicates whether the pointer points to\n' + 'memory that is capable to be used for hardware accelerated decompression.\n' + ) +class CUfunction_attribute(_FastEnum): + """ + Function properties """ - def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - self._ptr[0] = init_value - else: - self._ptr = _ptr - def __init__(self, *args, **kwargs): - pass - def __repr__(self): - return '' - def __index__(self): - return self.__int__() - def __int__(self): - return self._ptr[0] - def getPtr(self): - return self._ptr -{{endif}} -{{if True}} -cdef class EGLStreamKHR: + CU_FUNC_ATTRIBUTE_MAX_THREADS_PER_BLOCK = ( + cydriver.CUfunction_attribute_enum.CU_FUNC_ATTRIBUTE_MAX_THREADS_PER_BLOCK, + 'The maximum number of threads per block, beyond which a launch of the\n' + 'function would fail. This number depends on both the function and the\n' + 'device on which the function is currently loaded.\n' + ) + + + CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES = ( + cydriver.CUfunction_attribute_enum.CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES, + 'The size in bytes of statically-allocated shared memory required by this\n' + 'function. This does not include dynamically-allocated shared memory\n' + 'requested by the user at runtime.\n' + ) + + + CU_FUNC_ATTRIBUTE_CONST_SIZE_BYTES = ( + cydriver.CUfunction_attribute_enum.CU_FUNC_ATTRIBUTE_CONST_SIZE_BYTES, + 'The size in bytes of user-allocated constant memory required by this\n' + 'function.\n' + ) + + + CU_FUNC_ATTRIBUTE_LOCAL_SIZE_BYTES = ( + cydriver.CUfunction_attribute_enum.CU_FUNC_ATTRIBUTE_LOCAL_SIZE_BYTES, + 'The size in bytes of local memory used by each thread of this function.\n' + ) + + + CU_FUNC_ATTRIBUTE_NUM_REGS = ( + cydriver.CUfunction_attribute_enum.CU_FUNC_ATTRIBUTE_NUM_REGS, + 'The number of registers used by each thread of this function.\n' + ) + + + CU_FUNC_ATTRIBUTE_PTX_VERSION = ( + cydriver.CUfunction_attribute_enum.CU_FUNC_ATTRIBUTE_PTX_VERSION, + 'The PTX virtual architecture version for which the function was compiled.\n' + 'This value is the major PTX version * 10 + the minor PTX version, so a PTX\n' + 'version 1.3 function would return the value 13. Note that this may return\n' + 'the undefined value of 0 for cubins compiled prior to CUDA 3.0.\n' + ) + + + CU_FUNC_ATTRIBUTE_BINARY_VERSION = ( + cydriver.CUfunction_attribute_enum.CU_FUNC_ATTRIBUTE_BINARY_VERSION, + 'The binary architecture version for which the function was compiled. This\n' + 'value is the major binary version * 10 + the minor binary version, so a\n' + 'binary version 1.3 function would return the value 13. Note that this will\n' + 'return a value of 10 for legacy cubins that do not have a properly-encoded\n' + 'binary architecture version.\n' + ) + + + CU_FUNC_ATTRIBUTE_CACHE_MODE_CA = ( + cydriver.CUfunction_attribute_enum.CU_FUNC_ATTRIBUTE_CACHE_MODE_CA, + 'The attribute to indicate whether the function has been compiled with user\n' + 'specified option "-Xptxas --dlcm=ca" set .\n' + ) + + + CU_FUNC_ATTRIBUTE_MAX_DYNAMIC_SHARED_SIZE_BYTES = ( + cydriver.CUfunction_attribute_enum.CU_FUNC_ATTRIBUTE_MAX_DYNAMIC_SHARED_SIZE_BYTES, + 'The maximum size in bytes of dynamically-allocated shared memory that can\n' + 'be used by this function. If the user-specified dynamic shared memory size\n' + 'is larger than this value, the launch will fail. The default value of this\n' + 'attribute is :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK` -\n' + ':py:obj:`~.CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES`, except when\n' + ':py:obj:`~.CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES` is greater than\n' + ':py:obj:`~.CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK`, then the\n' + 'default value of this attribute is 0. The value can be increased to\n' + ':py:obj:`~.CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK_OPTIN` -\n' + ':py:obj:`~.CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES`. See\n' + ':py:obj:`~.cuFuncSetAttribute`, :py:obj:`~.cuKernelSetAttribute`\n' + ) + + + CU_FUNC_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT = ( + cydriver.CUfunction_attribute_enum.CU_FUNC_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT, + 'On devices where the L1 cache and shared memory use the same hardware\n' + 'resources, this sets the shared memory carveout preference, in percent of\n' + 'the total shared memory. Refer to\n' + ':py:obj:`~.CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_MULTIPROCESSOR`. This\n' + 'is only a hint, and the driver can choose a different ratio if required to\n' + 'execute the function. See :py:obj:`~.cuFuncSetAttribute`,\n' + ':py:obj:`~.cuKernelSetAttribute`\n' + ) + + + CU_FUNC_ATTRIBUTE_CLUSTER_SIZE_MUST_BE_SET = ( + cydriver.CUfunction_attribute_enum.CU_FUNC_ATTRIBUTE_CLUSTER_SIZE_MUST_BE_SET, + 'If this attribute is set, the kernel must launch with a valid cluster size\n' + 'specified. See :py:obj:`~.cuFuncSetAttribute`,\n' + ':py:obj:`~.cuKernelSetAttribute`\n' + ) + + + CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_WIDTH = ( + cydriver.CUfunction_attribute_enum.CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_WIDTH, + 'The required cluster width in blocks. The values must either all be 0 or\n' + 'all be positive. The validity of the cluster dimensions is otherwise\n' + 'checked at launch time.\n' + 'If the value is set during compile time, it cannot be set at runtime.\n' + 'Setting it at runtime will return CUDA_ERROR_NOT_PERMITTED. See\n' + ':py:obj:`~.cuFuncSetAttribute`, :py:obj:`~.cuKernelSetAttribute`\n' + ) + + + CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_HEIGHT = ( + cydriver.CUfunction_attribute_enum.CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_HEIGHT, + 'The required cluster height in blocks. The values must either all be 0 or\n' + 'all be positive. The validity of the cluster dimensions is otherwise\n' + 'checked at launch time.\n' + 'If the value is set during compile time, it cannot be set at runtime.\n' + 'Setting it at runtime should return CUDA_ERROR_NOT_PERMITTED. See\n' + ':py:obj:`~.cuFuncSetAttribute`, :py:obj:`~.cuKernelSetAttribute`\n' + ) + + + CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_DEPTH = ( + cydriver.CUfunction_attribute_enum.CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_DEPTH, + 'The required cluster depth in blocks. The values must either all be 0 or\n' + 'all be positive. The validity of the cluster dimensions is otherwise\n' + 'checked at launch time.\n' + 'If the value is set during compile time, it cannot be set at runtime.\n' + 'Setting it at runtime should return CUDA_ERROR_NOT_PERMITTED. See\n' + ':py:obj:`~.cuFuncSetAttribute`, :py:obj:`~.cuKernelSetAttribute`\n' + ) + + + CU_FUNC_ATTRIBUTE_NON_PORTABLE_CLUSTER_SIZE_ALLOWED = ( + cydriver.CUfunction_attribute_enum.CU_FUNC_ATTRIBUTE_NON_PORTABLE_CLUSTER_SIZE_ALLOWED, + 'Whether the function can be launched with non-portable cluster size. 1 is\n' + 'allowed, 0 is disallowed. A non-portable cluster size may only function on\n' + 'the specific SKUs the program is tested on. The launch might fail if the\n' + 'program is run on a different hardware platform.\n' + 'CUDA API provides cudaOccupancyMaxActiveClusters to assist with checking\n' + 'whether the desired size can be launched on the current device.\n' + 'Portable Cluster Size\n' + 'A portable cluster size is guaranteed to be functional on all compute\n' + 'capabilities higher than the target compute capability. The portable\n' + 'cluster size for sm_90 is 8 blocks per cluster. This value may increase for\n' + 'future compute capabilities.\n' + 'The specific hardware unit may support higher cluster sizes that’s not\n' + 'guaranteed to be portable. See :py:obj:`~.cuFuncSetAttribute`,\n' + ':py:obj:`~.cuKernelSetAttribute`\n' + ) + + + CU_FUNC_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE = ( + cydriver.CUfunction_attribute_enum.CU_FUNC_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE, + 'The block scheduling policy of a function. The value type is\n' + ':py:obj:`~.CUclusterSchedulingPolicy` / cudaClusterSchedulingPolicy. See\n' + ':py:obj:`~.cuFuncSetAttribute`, :py:obj:`~.cuKernelSetAttribute`\n' + ) + + + CU_FUNC_ATTRIBUTE_DEVICE_NODE_UPDATE_SUPPORTED = ( + cydriver.CUfunction_attribute_enum.CU_FUNC_ATTRIBUTE_DEVICE_NODE_UPDATE_SUPPORTED, + 'Whether the function can be updated on device. 1 means device node update\n' + 'is supported, 0 is unsupported. See :py:obj:`~.cuFuncGetAttribute`.\n' + ) + + CU_FUNC_ATTRIBUTE_MAX = cydriver.CUfunction_attribute_enum.CU_FUNC_ATTRIBUTE_MAX + +class CUfunc_cache(_FastEnum): + """ + Function cache configurations """ - Methods - ------- - getPtr() - Get memory address of class instance - """ - def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - self._ptr[0] = init_value - else: - self._ptr = _ptr - def __init__(self, *args, **kwargs): - pass - def __repr__(self): - return '' - def __index__(self): - return self.__int__() - def __int__(self): - return self._ptr[0] - def getPtr(self): - return self._ptr -{{endif}} + CU_FUNC_CACHE_PREFER_NONE = ( + cydriver.CUfunc_cache_enum.CU_FUNC_CACHE_PREFER_NONE, + 'no preference for shared memory or L1 (default)\n' + ) -{{if True}} -cdef class EGLSyncKHR: - """ + CU_FUNC_CACHE_PREFER_SHARED = ( + cydriver.CUfunc_cache_enum.CU_FUNC_CACHE_PREFER_SHARED, + 'prefer larger shared memory and smaller L1 cache\n' + ) - Methods - ------- - getPtr() - Get memory address of class instance - """ - def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - self._ptr[0] = init_value - else: - self._ptr = _ptr - def __init__(self, *args, **kwargs): - pass - def __repr__(self): - return '' - def __index__(self): - return self.__int__() - def __int__(self): - return self._ptr[0] - def getPtr(self): - return self._ptr -{{endif}} + CU_FUNC_CACHE_PREFER_L1 = ( + cydriver.CUfunc_cache_enum.CU_FUNC_CACHE_PREFER_L1, + 'prefer larger L1 cache and smaller shared memory\n' + ) -{{if 'CUasyncCallback' in found_types}} -cdef class CUasyncCallback: + CU_FUNC_CACHE_PREFER_EQUAL = ( + cydriver.CUfunc_cache_enum.CU_FUNC_CACHE_PREFER_EQUAL, + 'prefer equal sized L1 cache and shared memory\n' + ) + +class CUsharedconfig(_FastEnum): + """ + [Deprecated] Shared memory configurations """ - Methods - ------- - getPtr() - Get memory address of class instance - """ - def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - self._ptr[0] = init_value - else: - self._ptr = _ptr - def __init__(self, *args, **kwargs): - pass - def __repr__(self): - return '' - def __index__(self): - return self.__int__() - def __int__(self): - return self._ptr[0] - def getPtr(self): - return self._ptr -{{endif}} + CU_SHARED_MEM_CONFIG_DEFAULT_BANK_SIZE = ( + cydriver.CUsharedconfig_enum.CU_SHARED_MEM_CONFIG_DEFAULT_BANK_SIZE, + 'set default shared memory bank size\n' + ) -{{if 'CUhostFn' in found_types}} -cdef class CUhostFn: - """ + CU_SHARED_MEM_CONFIG_FOUR_BYTE_BANK_SIZE = ( + cydriver.CUsharedconfig_enum.CU_SHARED_MEM_CONFIG_FOUR_BYTE_BANK_SIZE, + 'set shared memory bank width to four bytes\n' + ) - Methods - ------- - getPtr() - Get memory address of class instance + CU_SHARED_MEM_CONFIG_EIGHT_BYTE_BANK_SIZE = ( + cydriver.CUsharedconfig_enum.CU_SHARED_MEM_CONFIG_EIGHT_BYTE_BANK_SIZE, + 'set shared memory bank width to eight bytes\n' + ) + +class CUshared_carveout(_FastEnum): + """ + Shared memory carveout configurations. These may be passed to + :py:obj:`~.cuFuncSetAttribute` or :py:obj:`~.cuKernelSetAttribute` """ - def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - self._ptr[0] = init_value - else: - self._ptr = _ptr - def __init__(self, *args, **kwargs): - pass - def __repr__(self): - return '' - def __index__(self): - return self.__int__() - def __int__(self): - return self._ptr[0] - def getPtr(self): - return self._ptr -{{endif}} -{{if 'CUstreamCallback' in found_types}} -cdef class CUstreamCallback: - """ + CU_SHAREDMEM_CARVEOUT_DEFAULT = ( + cydriver.CUshared_carveout_enum.CU_SHAREDMEM_CARVEOUT_DEFAULT, + 'No preference for shared memory or L1 (default)\n' + ) - Methods - ------- - getPtr() - Get memory address of class instance - """ - def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - self._ptr[0] = init_value - else: - self._ptr = _ptr - def __init__(self, *args, **kwargs): - pass - def __repr__(self): - return '' - def __index__(self): - return self.__int__() - def __int__(self): - return self._ptr[0] - def getPtr(self): - return self._ptr -{{endif}} + CU_SHAREDMEM_CARVEOUT_MAX_L1 = ( + cydriver.CUshared_carveout_enum.CU_SHAREDMEM_CARVEOUT_MAX_L1, + 'Prefer maximum available L1 cache, minimum shared memory\n' + ) -{{if 'CUoccupancyB2DSize' in found_types}} -cdef class CUoccupancyB2DSize: + CU_SHAREDMEM_CARVEOUT_MAX_SHARED = ( + cydriver.CUshared_carveout_enum.CU_SHAREDMEM_CARVEOUT_MAX_SHARED, + 'Prefer maximum available shared memory, minimum L1 cache\n' + ) + +class CUmemorytype(_FastEnum): + """ + Memory types """ - Methods - ------- - getPtr() - Get memory address of class instance - """ - def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - self._ptr[0] = init_value - else: - self._ptr = _ptr - def __init__(self, *args, **kwargs): - pass - def __repr__(self): - return '' - def __index__(self): - return self.__int__() - def __int__(self): - return self._ptr[0] - def getPtr(self): - return self._ptr -{{endif}} + CU_MEMORYTYPE_HOST = ( + cydriver.CUmemorytype_enum.CU_MEMORYTYPE_HOST, + 'Host memory\n' + ) -{{if 'struct CUuuid_st' in found_types}} -cdef class CUuuid_st: - """ - Attributes - ---------- - bytes : bytes - < CUDA definition of UUID + CU_MEMORYTYPE_DEVICE = ( + cydriver.CUmemorytype_enum.CU_MEMORYTYPE_DEVICE, + 'Device memory\n' + ) - Methods - ------- - getPtr() - Get memory address of class instance + CU_MEMORYTYPE_ARRAY = ( + cydriver.CUmemorytype_enum.CU_MEMORYTYPE_ARRAY, + 'Array memory\n' + ) + + + CU_MEMORYTYPE_UNIFIED = ( + cydriver.CUmemorytype_enum.CU_MEMORYTYPE_UNIFIED, + 'Unified device or host memory\n' + ) + +class CUcomputemode(_FastEnum): + """ + Compute Modes """ - def __cinit__(self, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - else: - self._ptr = _ptr - def __init__(self, void_ptr _ptr = 0): - pass - def __dealloc__(self): - pass - def getPtr(self): - return self._ptr - def __repr__(self): - if self._ptr is not NULL: - str_list = [] - try: - str_list += ['bytes : ' + str(self.bytes.hex())] - except ValueError: - str_list += ['bytes : '] - return '\n'.join(str_list) - else: - return '' - @property - def bytes(self): - return PyBytes_FromStringAndSize(self._ptr[0].bytes, 16) -{{endif}} -{{if 'struct CUmemFabricHandle_st' in found_types}} -cdef class CUmemFabricHandle_st: + CU_COMPUTEMODE_DEFAULT = ( + cydriver.CUcomputemode_enum.CU_COMPUTEMODE_DEFAULT, + 'Default compute mode (Multiple contexts allowed per device)\n' + ) + + + CU_COMPUTEMODE_PROHIBITED = ( + cydriver.CUcomputemode_enum.CU_COMPUTEMODE_PROHIBITED, + 'Compute-prohibited mode (No contexts can be created on this device at this\n' + 'time)\n' + ) + + + CU_COMPUTEMODE_EXCLUSIVE_PROCESS = ( + cydriver.CUcomputemode_enum.CU_COMPUTEMODE_EXCLUSIVE_PROCESS, + 'Compute-exclusive-process mode (Only one context used by a single process\n' + 'can be present on this device at a time)\n' + ) + +class CUmem_advise(_FastEnum): + """ + Memory advise values """ - Fabric handle - An opaque handle representing a memory allocation - that can be exported to processes in same or different nodes. For - IPC between processes on different nodes they must be connected via - the NVSwitch fabric. - Attributes - ---------- - data : bytes + CU_MEM_ADVISE_SET_READ_MOSTLY = ( + cydriver.CUmem_advise_enum.CU_MEM_ADVISE_SET_READ_MOSTLY, + 'Data will mostly be read and only occasionally be written to\n' + ) + + + CU_MEM_ADVISE_UNSET_READ_MOSTLY = ( + cydriver.CUmem_advise_enum.CU_MEM_ADVISE_UNSET_READ_MOSTLY, + 'Undo the effect of :py:obj:`~.CU_MEM_ADVISE_SET_READ_MOSTLY`\n' + ) + + + CU_MEM_ADVISE_SET_PREFERRED_LOCATION = ( + cydriver.CUmem_advise_enum.CU_MEM_ADVISE_SET_PREFERRED_LOCATION, + 'Set the preferred location for the data as the specified device\n' + ) + + + CU_MEM_ADVISE_UNSET_PREFERRED_LOCATION = ( + cydriver.CUmem_advise_enum.CU_MEM_ADVISE_UNSET_PREFERRED_LOCATION, + 'Clear the preferred location for the data\n' + ) + + + CU_MEM_ADVISE_SET_ACCESSED_BY = ( + cydriver.CUmem_advise_enum.CU_MEM_ADVISE_SET_ACCESSED_BY, + 'Data will be accessed by the specified device, so prevent page faults as\n' + 'much as possible\n' + ) - Methods - ------- - getPtr() - Get memory address of class instance + CU_MEM_ADVISE_UNSET_ACCESSED_BY = ( + cydriver.CUmem_advise_enum.CU_MEM_ADVISE_UNSET_ACCESSED_BY, + 'Let the Unified Memory subsystem decide on the page faulting policy for the\n' + 'specified device\n' + ) + +class CUmem_range_attribute(_FastEnum): """ - def __cinit__(self, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - else: - self._ptr = _ptr - def __init__(self, void_ptr _ptr = 0): - pass - def __dealloc__(self): - pass - def getPtr(self): - return self._ptr - def __repr__(self): - if self._ptr is not NULL: - str_list = [] - try: - str_list += ['data : ' + str(self.data)] - except ValueError: - str_list += ['data : '] - return '\n'.join(str_list) - else: - return '' - @property - def data(self): - return PyBytes_FromStringAndSize(self._ptr[0].data, 64) - @data.setter - def data(self, data): - if len(data) != 64: - raise ValueError("data length must be 64, is " + str(len(data))) - for i, b in enumerate(data): - self._ptr[0].data[i] = b -{{endif}} -{{if 'struct CUipcEventHandle_st' in found_types}} -cdef class CUipcEventHandle_st: """ - CUDA IPC event handle - Attributes - ---------- - reserved : bytes + CU_MEM_RANGE_ATTRIBUTE_READ_MOSTLY = ( + cydriver.CUmem_range_attribute_enum.CU_MEM_RANGE_ATTRIBUTE_READ_MOSTLY, + 'Whether the range will mostly be read and only occasionally be written to\n' + ) - Methods - ------- - getPtr() - Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - else: - self._ptr = _ptr - def __init__(self, void_ptr _ptr = 0): - pass - def __dealloc__(self): - pass - def getPtr(self): - return self._ptr - def __repr__(self): - if self._ptr is not NULL: - str_list = [] - try: - str_list += ['reserved : ' + str(self.reserved)] - except ValueError: - str_list += ['reserved : '] - return '\n'.join(str_list) - else: - return '' - @property - def reserved(self): - return PyBytes_FromStringAndSize(self._ptr[0].reserved, 64) - @reserved.setter - def reserved(self, reserved): - if len(reserved) != 64: - raise ValueError("reserved length must be 64, is " + str(len(reserved))) - if CHAR_MIN == 0: - for i, b in enumerate(reserved): - if b < 0 and b > -129: - b = b + 256 - self._ptr[0].reserved[i] = b - else: - for i, b in enumerate(reserved): - if b > 127 and b < 256: - b = b - 256 - self._ptr[0].reserved[i] = b -{{endif}} -{{if 'struct CUipcMemHandle_st' in found_types}} + CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION = ( + cydriver.CUmem_range_attribute_enum.CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION, + 'The preferred location of the range\n' + ) -cdef class CUipcMemHandle_st: + + CU_MEM_RANGE_ATTRIBUTE_ACCESSED_BY = ( + cydriver.CUmem_range_attribute_enum.CU_MEM_RANGE_ATTRIBUTE_ACCESSED_BY, + 'Memory range has :py:obj:`~.CU_MEM_ADVISE_SET_ACCESSED_BY` set for\n' + 'specified device\n' + ) + + + CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION = ( + cydriver.CUmem_range_attribute_enum.CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION, + 'The last location to which the range was prefetched\n' + ) + + + CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION_TYPE = ( + cydriver.CUmem_range_attribute_enum.CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION_TYPE, + 'The preferred location type of the range\n' + ) + + + CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION_ID = ( + cydriver.CUmem_range_attribute_enum.CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION_ID, + 'The preferred location id of the range\n' + ) + + + CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION_TYPE = ( + cydriver.CUmem_range_attribute_enum.CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION_TYPE, + 'The last location type to which the range was prefetched\n' + ) + + + CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION_ID = ( + cydriver.CUmem_range_attribute_enum.CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION_ID, + 'The last location id to which the range was prefetched\n' + ) + +class CUjit_option(_FastEnum): + """ + Online compiler and linker options """ - CUDA IPC mem handle - Attributes - ---------- - reserved : bytes + CU_JIT_MAX_REGISTERS = ( + cydriver.CUjit_option_enum.CU_JIT_MAX_REGISTERS, + 'Max number of registers that a thread may use.\n' + 'Option type: unsigned int\n' + 'Applies to: compiler only\n' + ) + + + CU_JIT_THREADS_PER_BLOCK = ( + cydriver.CUjit_option_enum.CU_JIT_THREADS_PER_BLOCK, + 'IN: Specifies minimum number of threads per block to target compilation for\n' + 'OUT: Returns the number of threads the compiler actually targeted. This\n' + 'restricts the resource utilization of the compiler (e.g. max registers)\n' + 'such that a block with the given number of threads should be able to launch\n' + 'based on register limitations. Note, this option does not currently take\n' + 'into account any other resource limitations, such as shared memory\n' + 'utilization.\n' + 'Cannot be combined with :py:obj:`~.CU_JIT_TARGET`.\n' + 'Option type: unsigned int\n' + 'Applies to: compiler only\n' + ) + + + CU_JIT_WALL_TIME = ( + cydriver.CUjit_option_enum.CU_JIT_WALL_TIME, + 'Overwrites the option value with the total wall clock time, in\n' + 'milliseconds, spent in the compiler and linker\n' + 'Option type: float\n' + 'Applies to: compiler and linker\n' + ) + + + CU_JIT_INFO_LOG_BUFFER = ( + cydriver.CUjit_option_enum.CU_JIT_INFO_LOG_BUFFER, + 'Pointer to a buffer in which to print any log messages that are\n' + 'informational in nature (the buffer size is specified via option\n' + ':py:obj:`~.CU_JIT_INFO_LOG_BUFFER_SIZE_BYTES`)\n' + 'Option type: char *\n' + 'Applies to: compiler and linker\n' + ) + + + CU_JIT_INFO_LOG_BUFFER_SIZE_BYTES = ( + cydriver.CUjit_option_enum.CU_JIT_INFO_LOG_BUFFER_SIZE_BYTES, + 'IN: Log buffer size in bytes. Log messages will be capped at this size\n' + '(including null terminator)\n' + 'OUT: Amount of log buffer filled with messages\n' + 'Option type: unsigned int\n' + 'Applies to: compiler and linker\n' + ) + + + CU_JIT_ERROR_LOG_BUFFER = ( + cydriver.CUjit_option_enum.CU_JIT_ERROR_LOG_BUFFER, + 'Pointer to a buffer in which to print any log messages that reflect errors\n' + '(the buffer size is specified via option\n' + ':py:obj:`~.CU_JIT_ERROR_LOG_BUFFER_SIZE_BYTES`)\n' + 'Option type: char *\n' + 'Applies to: compiler and linker\n' + ) + + + CU_JIT_ERROR_LOG_BUFFER_SIZE_BYTES = ( + cydriver.CUjit_option_enum.CU_JIT_ERROR_LOG_BUFFER_SIZE_BYTES, + 'IN: Log buffer size in bytes. Log messages will be capped at this size\n' + '(including null terminator)\n' + 'OUT: Amount of log buffer filled with messages\n' + 'Option type: unsigned int\n' + 'Applies to: compiler and linker\n' + ) + + + CU_JIT_OPTIMIZATION_LEVEL = ( + cydriver.CUjit_option_enum.CU_JIT_OPTIMIZATION_LEVEL, + 'Level of optimizations to apply to generated code (0 - 4), with 4 being the\n' + 'default and highest level of optimizations.\n' + 'Option type: unsigned int\n' + 'Applies to: compiler only\n' + ) + + + CU_JIT_TARGET_FROM_CUCONTEXT = ( + cydriver.CUjit_option_enum.CU_JIT_TARGET_FROM_CUCONTEXT, + 'No option value required. Determines the target based on the current\n' + 'attached context (default)\n' + 'Option type: No option value needed\n' + 'Applies to: compiler and linker\n' + ) + + + CU_JIT_TARGET = ( + cydriver.CUjit_option_enum.CU_JIT_TARGET, + 'Target is chosen based on supplied :py:obj:`~.CUjit_target`. Cannot be\n' + 'combined with :py:obj:`~.CU_JIT_THREADS_PER_BLOCK`.\n' + 'Option type: unsigned int for enumerated type :py:obj:`~.CUjit_target`\n' + 'Applies to: compiler and linker\n' + ) + + + CU_JIT_FALLBACK_STRATEGY = ( + cydriver.CUjit_option_enum.CU_JIT_FALLBACK_STRATEGY, + 'Specifies choice of fallback strategy if matching cubin is not found.\n' + 'Choice is based on supplied :py:obj:`~.CUjit_fallback`. This option cannot\n' + 'be used with cuLink* APIs as the linker requires exact matches.\n' + 'Option type: unsigned int for enumerated type :py:obj:`~.CUjit_fallback`\n' + 'Applies to: compiler only\n' + ) + + + CU_JIT_GENERATE_DEBUG_INFO = ( + cydriver.CUjit_option_enum.CU_JIT_GENERATE_DEBUG_INFO, + 'Specifies whether to create debug information in output (-g) (0: false,\n' + 'default)\n' + 'Option type: int\n' + 'Applies to: compiler and linker\n' + ) + + + CU_JIT_LOG_VERBOSE = ( + cydriver.CUjit_option_enum.CU_JIT_LOG_VERBOSE, + 'Generate verbose log messages (0: false, default)\n' + 'Option type: int\n' + 'Applies to: compiler and linker\n' + ) + + + CU_JIT_GENERATE_LINE_INFO = ( + cydriver.CUjit_option_enum.CU_JIT_GENERATE_LINE_INFO, + 'Generate line number information (-lineinfo) (0: false, default)\n' + 'Option type: int\n' + 'Applies to: compiler only\n' + ) + + + CU_JIT_CACHE_MODE = ( + cydriver.CUjit_option_enum.CU_JIT_CACHE_MODE, + 'Specifies whether to enable caching explicitly (-dlcm)\n' + 'Choice is based on supplied :py:obj:`~.CUjit_cacheMode_enum`.\n' + 'Option type: unsigned int for enumerated type\n' + ':py:obj:`~.CUjit_cacheMode_enum`\n' + 'Applies to: compiler only\n' + ) + + + CU_JIT_NEW_SM3X_OPT = ( + cydriver.CUjit_option_enum.CU_JIT_NEW_SM3X_OPT, + '[Deprecated]\n' + ) + + + CU_JIT_FAST_COMPILE = ( + cydriver.CUjit_option_enum.CU_JIT_FAST_COMPILE, + 'This jit option is used for internal purpose only.\n' + ) + + + CU_JIT_GLOBAL_SYMBOL_NAMES = ( + cydriver.CUjit_option_enum.CU_JIT_GLOBAL_SYMBOL_NAMES, + 'Array of device symbol names that will be relocated to the corresponding\n' + 'host addresses stored in :py:obj:`~.CU_JIT_GLOBAL_SYMBOL_ADDRESSES`.\n' + 'Must contain :py:obj:`~.CU_JIT_GLOBAL_SYMBOL_COUNT` entries.\n' + 'When loading a device module, driver will relocate all encountered\n' + 'unresolved symbols to the host addresses.\n' + 'It is only allowed to register symbols that correspond to unresolved global\n' + 'variables.\n' + 'It is illegal to register the same device symbol at multiple addresses.\n' + 'Option type: const char **\n' + 'Applies to: dynamic linker only\n' + ) - Methods - ------- - getPtr() - Get memory address of class instance + CU_JIT_GLOBAL_SYMBOL_ADDRESSES = ( + cydriver.CUjit_option_enum.CU_JIT_GLOBAL_SYMBOL_ADDRESSES, + 'Array of host addresses that will be used to relocate corresponding device\n' + 'symbols stored in :py:obj:`~.CU_JIT_GLOBAL_SYMBOL_NAMES`.\n' + 'Must contain :py:obj:`~.CU_JIT_GLOBAL_SYMBOL_COUNT` entries.\n' + 'Option type: void **\n' + 'Applies to: dynamic linker only\n' + ) + + + CU_JIT_GLOBAL_SYMBOL_COUNT = ( + cydriver.CUjit_option_enum.CU_JIT_GLOBAL_SYMBOL_COUNT, + 'Number of entries in :py:obj:`~.CU_JIT_GLOBAL_SYMBOL_NAMES` and\n' + ':py:obj:`~.CU_JIT_GLOBAL_SYMBOL_ADDRESSES` arrays.\n' + 'Option type: unsigned int\n' + 'Applies to: dynamic linker only\n' + ) + + + CU_JIT_LTO = ( + cydriver.CUjit_option_enum.CU_JIT_LTO, + '[Deprecated]\n' + 'Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0\n' + ) + + + CU_JIT_FTZ = ( + cydriver.CUjit_option_enum.CU_JIT_FTZ, + '[Deprecated]\n' + 'Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0\n' + ) + + + CU_JIT_PREC_DIV = ( + cydriver.CUjit_option_enum.CU_JIT_PREC_DIV, + '[Deprecated]\n' + 'Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0\n' + ) + + + CU_JIT_PREC_SQRT = ( + cydriver.CUjit_option_enum.CU_JIT_PREC_SQRT, + '[Deprecated]\n' + 'Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0\n' + ) + + + CU_JIT_FMA = ( + cydriver.CUjit_option_enum.CU_JIT_FMA, + '[Deprecated]\n' + 'Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0\n' + ) + + + CU_JIT_REFERENCED_KERNEL_NAMES = ( + cydriver.CUjit_option_enum.CU_JIT_REFERENCED_KERNEL_NAMES, + '[Deprecated]\n' + 'Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0\n' + ) + + + CU_JIT_REFERENCED_KERNEL_COUNT = ( + cydriver.CUjit_option_enum.CU_JIT_REFERENCED_KERNEL_COUNT, + '[Deprecated]\n' + 'Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0\n' + ) + + + CU_JIT_REFERENCED_VARIABLE_NAMES = ( + cydriver.CUjit_option_enum.CU_JIT_REFERENCED_VARIABLE_NAMES, + '[Deprecated]\n' + 'Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0\n' + ) + + + CU_JIT_REFERENCED_VARIABLE_COUNT = ( + cydriver.CUjit_option_enum.CU_JIT_REFERENCED_VARIABLE_COUNT, + '[Deprecated]\n' + 'Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0\n' + ) + + + CU_JIT_OPTIMIZE_UNUSED_DEVICE_VARIABLES = ( + cydriver.CUjit_option_enum.CU_JIT_OPTIMIZE_UNUSED_DEVICE_VARIABLES, + '[Deprecated]\n' + 'Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0\n' + ) + + + CU_JIT_POSITION_INDEPENDENT_CODE = ( + cydriver.CUjit_option_enum.CU_JIT_POSITION_INDEPENDENT_CODE, + 'Generate position independent code (0: false)\n' + 'Option type: int\n' + 'Applies to: compiler only\n' + ) + + + CU_JIT_MIN_CTA_PER_SM = ( + cydriver.CUjit_option_enum.CU_JIT_MIN_CTA_PER_SM, + 'This option hints to the JIT compiler the minimum number of CTAs from the\n' + 'kernel’s grid to be mapped to a SM. This option is ignored when used\n' + 'together with :py:obj:`~.CU_JIT_MAX_REGISTERS` or\n' + ':py:obj:`~.CU_JIT_THREADS_PER_BLOCK`. Optimizations based on this option\n' + 'need :py:obj:`~.CU_JIT_MAX_THREADS_PER_BLOCK` to be specified as well. For\n' + 'kernels already using PTX directive .minnctapersm, this option will be\n' + 'ignored by default. Use :py:obj:`~.CU_JIT_OVERRIDE_DIRECTIVE_VALUES` to let\n' + 'this option take precedence over the PTX directive. Option type: unsigned\n' + 'int\n' + 'Applies to: compiler only\n' + ) + + + CU_JIT_MAX_THREADS_PER_BLOCK = ( + cydriver.CUjit_option_enum.CU_JIT_MAX_THREADS_PER_BLOCK, + 'Maximum number threads in a thread block, computed as the product of the\n' + 'maximum extent specifed for each dimension of the block. This limit is\n' + 'guaranteed not to be exeeded in any invocation of the kernel. Exceeding the\n' + 'the maximum number of threads results in runtime error or kernel launch\n' + 'failure. For kernels already using PTX directive .maxntid, this option will\n' + 'be ignored by default. Use :py:obj:`~.CU_JIT_OVERRIDE_DIRECTIVE_VALUES` to\n' + 'let this option take precedence over the PTX directive. Option type: int\n' + 'Applies to: compiler only\n' + ) + + + CU_JIT_OVERRIDE_DIRECTIVE_VALUES = ( + cydriver.CUjit_option_enum.CU_JIT_OVERRIDE_DIRECTIVE_VALUES, + 'This option lets the values specified using\n' + ':py:obj:`~.CU_JIT_MAX_REGISTERS`, :py:obj:`~.CU_JIT_THREADS_PER_BLOCK`,\n' + ':py:obj:`~.CU_JIT_MAX_THREADS_PER_BLOCK` and\n' + ':py:obj:`~.CU_JIT_MIN_CTA_PER_SM` take precedence over any PTX directives.\n' + '(0: Disable, default; 1: Enable) Option type: int\n' + 'Applies to: compiler only\n' + ) + + + CU_JIT_SPLIT_COMPILE = ( + cydriver.CUjit_option_enum.CU_JIT_SPLIT_COMPILE, + 'This option specifies the maximum number of concurrent threads to use when\n' + 'running compiler optimizations. If the specified value is 1, the option\n' + 'will be ignored. If the specified value is 0, the number of threads will\n' + 'match the number of CPUs on the underlying machine. Otherwise, if the\n' + 'option is N, then up to N threads will be used. Option type: unsigned int\n' + 'Applies to: compiler only\n' + ) + + + CU_JIT_BINARY_LOADER_THREAD_COUNT = ( + cydriver.CUjit_option_enum.CU_JIT_BINARY_LOADER_THREAD_COUNT, + 'This option specifies the maximum number of concurrent threads to use when\n' + 'compiling device code. If the specified value is 1, the option will be\n' + 'ignored. If the specified value is 0, the number of threads will match the\n' + 'number of CPUs on the underlying machine. Otherwise, if the option is N,\n' + 'then up to N threads will be used. This option is ignored if the env var\n' + 'CUDA_BINARY_LOADER_THREAD_COUNT is set. Option type: unsigned int\n' + 'Applies to: compiler and linker\n' + ) + + CU_JIT_NUM_OPTIONS = cydriver.CUjit_option_enum.CU_JIT_NUM_OPTIONS + +class CUjit_target(_FastEnum): """ - def __cinit__(self, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - else: - self._ptr = _ptr - def __init__(self, void_ptr _ptr = 0): - pass - def __dealloc__(self): - pass - def getPtr(self): - return self._ptr - def __repr__(self): - if self._ptr is not NULL: - str_list = [] - try: - str_list += ['reserved : ' + str(self.reserved)] - except ValueError: - str_list += ['reserved : '] - return '\n'.join(str_list) - else: - return '' - @property - def reserved(self): - return PyBytes_FromStringAndSize(self._ptr[0].reserved, 64) - @reserved.setter - def reserved(self, reserved): - if len(reserved) != 64: - raise ValueError("reserved length must be 64, is " + str(len(reserved))) - if CHAR_MIN == 0: - for i, b in enumerate(reserved): - if b < 0 and b > -129: - b = b + 256 - self._ptr[0].reserved[i] = b - else: - for i, b in enumerate(reserved): - if b > 127 and b < 256: - b = b - 256 - self._ptr[0].reserved[i] = b -{{endif}} -{{if 'union CUstreamBatchMemOpParams_union' in found_types}} - -cdef class CUstreamMemOpWaitValueParams_st: + Online compilation targets """ - Attributes - ---------- - operation : CUstreamBatchMemOpType - address : CUdeviceptr - value : cuuint32_t + CU_TARGET_COMPUTE_30 = ( + cydriver.CUjit_target_enum.CU_TARGET_COMPUTE_30, + 'Compute device class 3.0\n' + ) - value64 : cuuint64_t - flags : unsigned int + CU_TARGET_COMPUTE_32 = ( + cydriver.CUjit_target_enum.CU_TARGET_COMPUTE_32, + 'Compute device class 3.2\n' + ) - alias : CUdeviceptr - For driver internal use. Initial value is unimportant. - Methods - ------- - getPtr() - Get memory address of class instance + CU_TARGET_COMPUTE_35 = ( + cydriver.CUjit_target_enum.CU_TARGET_COMPUTE_35, + 'Compute device class 3.5\n' + ) - """ - def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr - def __init__(self, void_ptr _ptr): - self._address = CUdeviceptr(_ptr=&self._ptr[0].waitValue.address) - self._value = cuuint32_t(_ptr=&self._ptr[0].waitValue.value) - self._value64 = cuuint64_t(_ptr=&self._ptr[0].waitValue.value64) - self._alias = CUdeviceptr(_ptr=&self._ptr[0].waitValue.alias) - def __dealloc__(self): - pass - def getPtr(self): - return &self._ptr[0].waitValue - def __repr__(self): - if self._ptr is not NULL: - str_list = [] - try: - str_list += ['operation : ' + str(self.operation)] - except ValueError: - str_list += ['operation : '] - try: - str_list += ['address : ' + str(self.address)] - except ValueError: - str_list += ['address : '] - try: - str_list += ['value : ' + str(self.value)] - except ValueError: - str_list += ['value : '] - try: - str_list += ['value64 : ' + str(self.value64)] - except ValueError: - str_list += ['value64 : '] - try: - str_list += ['flags : ' + str(self.flags)] - except ValueError: - str_list += ['flags : '] - try: - str_list += ['alias : ' + str(self.alias)] - except ValueError: - str_list += ['alias : '] - return '\n'.join(str_list) - else: - return '' - @property - def operation(self): - return CUstreamBatchMemOpType(self._ptr[0].waitValue.operation) - @operation.setter - def operation(self, operation not None : CUstreamBatchMemOpType): - self._ptr[0].waitValue.operation = operation.value - @property - def address(self): - return self._address - @address.setter - def address(self, address): - cdef ccuda.CUdeviceptr caddress - if address is None: - caddress = 0 - elif isinstance(address, (CUdeviceptr)): - paddress = int(address) - caddress = paddress - else: - paddress = int(CUdeviceptr(address)) - caddress = paddress - self._address._ptr[0] = caddress + CU_TARGET_COMPUTE_37 = ( + cydriver.CUjit_target_enum.CU_TARGET_COMPUTE_37, + 'Compute device class 3.7\n' + ) - @property - def value(self): - return self._value - @value.setter - def value(self, value): - cdef ccuda.cuuint32_t cvalue - if value is None: - cvalue = 0 - elif isinstance(value, (cuuint32_t)): - pvalue = int(value) - cvalue = pvalue - else: - pvalue = int(cuuint32_t(value)) - cvalue = pvalue - self._value._ptr[0] = cvalue - @property - def value64(self): - return self._value64 - @value64.setter - def value64(self, value64): - cdef ccuda.cuuint64_t cvalue64 - if value64 is None: - cvalue64 = 0 - elif isinstance(value64, (cuuint64_t)): - pvalue64 = int(value64) - cvalue64 = pvalue64 - else: - pvalue64 = int(cuuint64_t(value64)) - cvalue64 = pvalue64 - self._value64._ptr[0] = cvalue64 + CU_TARGET_COMPUTE_50 = ( + cydriver.CUjit_target_enum.CU_TARGET_COMPUTE_50, + 'Compute device class 5.0\n' + ) - @property - def flags(self): - return self._ptr[0].waitValue.flags - @flags.setter - def flags(self, unsigned int flags): - self._ptr[0].waitValue.flags = flags - @property - def alias(self): - return self._alias - @alias.setter - def alias(self, alias): - cdef ccuda.CUdeviceptr calias - if alias is None: - calias = 0 - elif isinstance(alias, (CUdeviceptr)): - palias = int(alias) - calias = palias - else: - palias = int(CUdeviceptr(alias)) - calias = palias - self._alias._ptr[0] = calias -{{endif}} -{{if 'union CUstreamBatchMemOpParams_union' in found_types}} + CU_TARGET_COMPUTE_52 = ( + cydriver.CUjit_target_enum.CU_TARGET_COMPUTE_52, + 'Compute device class 5.2\n' + ) -cdef class CUstreamMemOpWriteValueParams_st: + + CU_TARGET_COMPUTE_53 = ( + cydriver.CUjit_target_enum.CU_TARGET_COMPUTE_53, + 'Compute device class 5.3\n' + ) + + + CU_TARGET_COMPUTE_60 = ( + cydriver.CUjit_target_enum.CU_TARGET_COMPUTE_60, + 'Compute device class 6.0.\n' + ) + + + CU_TARGET_COMPUTE_61 = ( + cydriver.CUjit_target_enum.CU_TARGET_COMPUTE_61, + 'Compute device class 6.1.\n' + ) + + + CU_TARGET_COMPUTE_62 = ( + cydriver.CUjit_target_enum.CU_TARGET_COMPUTE_62, + 'Compute device class 6.2.\n' + ) + + + CU_TARGET_COMPUTE_70 = ( + cydriver.CUjit_target_enum.CU_TARGET_COMPUTE_70, + 'Compute device class 7.0.\n' + ) + + + CU_TARGET_COMPUTE_72 = ( + cydriver.CUjit_target_enum.CU_TARGET_COMPUTE_72, + 'Compute device class 7.2.\n' + ) + + + CU_TARGET_COMPUTE_75 = ( + cydriver.CUjit_target_enum.CU_TARGET_COMPUTE_75, + 'Compute device class 7.5.\n' + ) + + + CU_TARGET_COMPUTE_80 = ( + cydriver.CUjit_target_enum.CU_TARGET_COMPUTE_80, + 'Compute device class 8.0.\n' + ) + + + CU_TARGET_COMPUTE_86 = ( + cydriver.CUjit_target_enum.CU_TARGET_COMPUTE_86, + 'Compute device class 8.6.\n' + ) + + + CU_TARGET_COMPUTE_87 = ( + cydriver.CUjit_target_enum.CU_TARGET_COMPUTE_87, + 'Compute device class 8.7.\n' + ) + + + CU_TARGET_COMPUTE_89 = ( + cydriver.CUjit_target_enum.CU_TARGET_COMPUTE_89, + 'Compute device class 8.9.\n' + ) + + + CU_TARGET_COMPUTE_90 = ( + cydriver.CUjit_target_enum.CU_TARGET_COMPUTE_90, + 'Compute device class 9.0.\n' + ) + + + CU_TARGET_COMPUTE_100 = ( + cydriver.CUjit_target_enum.CU_TARGET_COMPUTE_100, + 'Compute device class 10.0.\n' + ) + + + CU_TARGET_COMPUTE_103 = ( + cydriver.CUjit_target_enum.CU_TARGET_COMPUTE_103, + 'Compute device class 10.3.\n' + ) + + + CU_TARGET_COMPUTE_110 = ( + cydriver.CUjit_target_enum.CU_TARGET_COMPUTE_110, + 'Compute device class 11.0.\n' + ) + + + CU_TARGET_COMPUTE_120 = ( + cydriver.CUjit_target_enum.CU_TARGET_COMPUTE_120, + 'Compute device class 12.0.\n' + ) + + + CU_TARGET_COMPUTE_121 = ( + cydriver.CUjit_target_enum.CU_TARGET_COMPUTE_121, + 'Compute device class 12.1. Compute device class 9.0. with accelerated\n' + 'features.\n' + ) + + + CU_TARGET_COMPUTE_90A = ( + cydriver.CUjit_target_enum.CU_TARGET_COMPUTE_90A, + 'Compute device class 10.0. with accelerated features.\n' + ) + + + CU_TARGET_COMPUTE_100A = ( + cydriver.CUjit_target_enum.CU_TARGET_COMPUTE_100A, + 'Compute device class 11.0 with accelerated features.\n' + ) + + + CU_TARGET_COMPUTE_103A = ( + cydriver.CUjit_target_enum.CU_TARGET_COMPUTE_103A, + 'Compute device class 12.0. with accelerated features.\n' + ) + + + CU_TARGET_COMPUTE_110A = ( + cydriver.CUjit_target_enum.CU_TARGET_COMPUTE_110A, + 'Compute device class 10.3. with accelerated features.\n' + ) + + + CU_TARGET_COMPUTE_120A = ( + cydriver.CUjit_target_enum.CU_TARGET_COMPUTE_120A, + 'Compute device class 12.1. with accelerated features.\n' + ) + + + CU_TARGET_COMPUTE_121A = ( + cydriver.CUjit_target_enum.CU_TARGET_COMPUTE_121A, + 'Compute device class 10.x with family features.\n' + ) + + + CU_TARGET_COMPUTE_100F = ( + cydriver.CUjit_target_enum.CU_TARGET_COMPUTE_100F, + 'Compute device class 11.0 with family features.\n' + ) + + + CU_TARGET_COMPUTE_103F = ( + cydriver.CUjit_target_enum.CU_TARGET_COMPUTE_103F, + 'Compute device class 12.0. with family features.\n' + ) + + + CU_TARGET_COMPUTE_110F = ( + cydriver.CUjit_target_enum.CU_TARGET_COMPUTE_110F, + 'Compute device class 10.3. with family features.\n' + ) + + + CU_TARGET_COMPUTE_120F = ( + cydriver.CUjit_target_enum.CU_TARGET_COMPUTE_120F, + 'Compute device class 12.1. with family features.\n' + ) + + CU_TARGET_COMPUTE_121F = cydriver.CUjit_target_enum.CU_TARGET_COMPUTE_121F + +class CUjit_fallback(_FastEnum): + """ + Cubin matching fallback strategies """ - Attributes - ---------- - operation : CUstreamBatchMemOpType - address : CUdeviceptr - value : cuuint32_t + CU_PREFER_PTX = ( + cydriver.CUjit_fallback_enum.CU_PREFER_PTX, + 'Prefer to compile ptx if exact binary match not found\n' + ) - value64 : cuuint64_t - flags : unsigned int + CU_PREFER_BINARY = ( + cydriver.CUjit_fallback_enum.CU_PREFER_BINARY, + 'Prefer to fall back to compatible binary code if exact match not found\n' + ) - alias : CUdeviceptr - For driver internal use. Initial value is unimportant. +class CUjit_cacheMode(_FastEnum): + """ + Caching modes for dlcm + """ - Methods - ------- - getPtr() - Get memory address of class instance + CU_JIT_CACHE_OPTION_NONE = ( + cydriver.CUjit_cacheMode_enum.CU_JIT_CACHE_OPTION_NONE, + 'Compile with no -dlcm flag specified\n' + ) + + + CU_JIT_CACHE_OPTION_CG = ( + cydriver.CUjit_cacheMode_enum.CU_JIT_CACHE_OPTION_CG, + 'Compile with L1 cache disabled\n' + ) + + + CU_JIT_CACHE_OPTION_CA = ( + cydriver.CUjit_cacheMode_enum.CU_JIT_CACHE_OPTION_CA, + 'Compile with L1 cache enabled\n' + ) + +class CUjitInputType(_FastEnum): + """ + Device code formats """ - def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr - def __init__(self, void_ptr _ptr): - self._address = CUdeviceptr(_ptr=&self._ptr[0].writeValue.address) - self._value = cuuint32_t(_ptr=&self._ptr[0].writeValue.value) - self._value64 = cuuint64_t(_ptr=&self._ptr[0].writeValue.value64) - self._alias = CUdeviceptr(_ptr=&self._ptr[0].writeValue.alias) - def __dealloc__(self): - pass - def getPtr(self): - return &self._ptr[0].writeValue - def __repr__(self): - if self._ptr is not NULL: - str_list = [] - try: - str_list += ['operation : ' + str(self.operation)] - except ValueError: - str_list += ['operation : '] - try: - str_list += ['address : ' + str(self.address)] - except ValueError: - str_list += ['address : '] - try: - str_list += ['value : ' + str(self.value)] - except ValueError: - str_list += ['value : '] - try: - str_list += ['value64 : ' + str(self.value64)] - except ValueError: - str_list += ['value64 : '] - try: - str_list += ['flags : ' + str(self.flags)] - except ValueError: - str_list += ['flags : '] - try: - str_list += ['alias : ' + str(self.alias)] - except ValueError: - str_list += ['alias : '] - return '\n'.join(str_list) - else: - return '' - @property - def operation(self): - return CUstreamBatchMemOpType(self._ptr[0].writeValue.operation) - @operation.setter - def operation(self, operation not None : CUstreamBatchMemOpType): - self._ptr[0].writeValue.operation = operation.value - @property - def address(self): - return self._address - @address.setter - def address(self, address): - cdef ccuda.CUdeviceptr caddress - if address is None: - caddress = 0 - elif isinstance(address, (CUdeviceptr)): - paddress = int(address) - caddress = paddress - else: - paddress = int(CUdeviceptr(address)) - caddress = paddress - self._address._ptr[0] = caddress - @property - def value(self): - return self._value - @value.setter - def value(self, value): - cdef ccuda.cuuint32_t cvalue - if value is None: - cvalue = 0 - elif isinstance(value, (cuuint32_t)): - pvalue = int(value) - cvalue = pvalue - else: - pvalue = int(cuuint32_t(value)) - cvalue = pvalue - self._value._ptr[0] = cvalue + CU_JIT_INPUT_CUBIN = ( + cydriver.CUjitInputType_enum.CU_JIT_INPUT_CUBIN, + 'Compiled device-class-specific device code\n' + 'Applicable options: none\n' + ) - @property - def value64(self): - return self._value64 - @value64.setter - def value64(self, value64): - cdef ccuda.cuuint64_t cvalue64 - if value64 is None: - cvalue64 = 0 - elif isinstance(value64, (cuuint64_t)): - pvalue64 = int(value64) - cvalue64 = pvalue64 - else: - pvalue64 = int(cuuint64_t(value64)) - cvalue64 = pvalue64 - self._value64._ptr[0] = cvalue64 - @property - def flags(self): - return self._ptr[0].writeValue.flags - @flags.setter - def flags(self, unsigned int flags): - self._ptr[0].writeValue.flags = flags - @property - def alias(self): - return self._alias - @alias.setter - def alias(self, alias): - cdef ccuda.CUdeviceptr calias - if alias is None: - calias = 0 - elif isinstance(alias, (CUdeviceptr)): - palias = int(alias) - calias = palias - else: - palias = int(CUdeviceptr(alias)) - calias = palias - self._alias._ptr[0] = calias + CU_JIT_INPUT_PTX = ( + cydriver.CUjitInputType_enum.CU_JIT_INPUT_PTX, + 'PTX source code\n' + 'Applicable options: PTX compiler options\n' + ) -{{endif}} -{{if 'union CUstreamBatchMemOpParams_union' in found_types}} -cdef class CUstreamMemOpFlushRemoteWritesParams_st: + CU_JIT_INPUT_FATBINARY = ( + cydriver.CUjitInputType_enum.CU_JIT_INPUT_FATBINARY, + 'Bundle of multiple cubins and/or PTX of some device code\n' + 'Applicable options: PTX compiler options,\n' + ':py:obj:`~.CU_JIT_FALLBACK_STRATEGY`\n' + ) + + + CU_JIT_INPUT_OBJECT = ( + cydriver.CUjitInputType_enum.CU_JIT_INPUT_OBJECT, + 'Host object with embedded device code\n' + 'Applicable options: PTX compiler options,\n' + ':py:obj:`~.CU_JIT_FALLBACK_STRATEGY`\n' + ) + + + CU_JIT_INPUT_LIBRARY = ( + cydriver.CUjitInputType_enum.CU_JIT_INPUT_LIBRARY, + 'Archive of host objects with embedded device code\n' + 'Applicable options: PTX compiler options,\n' + ':py:obj:`~.CU_JIT_FALLBACK_STRATEGY`\n' + ) + + + CU_JIT_INPUT_NVVM = ( + cydriver.CUjitInputType_enum.CU_JIT_INPUT_NVVM, + '[Deprecated]\n' + 'Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0\n' + ) + + CU_JIT_NUM_INPUT_TYPES = cydriver.CUjitInputType_enum.CU_JIT_NUM_INPUT_TYPES + +class CUgraphicsRegisterFlags(_FastEnum): + """ + Flags to register a graphics resource """ - Attributes - ---------- - operation : CUstreamBatchMemOpType - flags : unsigned int + CU_GRAPHICS_REGISTER_FLAGS_NONE = cydriver.CUgraphicsRegisterFlags_enum.CU_GRAPHICS_REGISTER_FLAGS_NONE + CU_GRAPHICS_REGISTER_FLAGS_READ_ONLY = cydriver.CUgraphicsRegisterFlags_enum.CU_GRAPHICS_REGISTER_FLAGS_READ_ONLY - Methods - ------- - getPtr() - Get memory address of class instance + CU_GRAPHICS_REGISTER_FLAGS_WRITE_DISCARD = cydriver.CUgraphicsRegisterFlags_enum.CU_GRAPHICS_REGISTER_FLAGS_WRITE_DISCARD + + CU_GRAPHICS_REGISTER_FLAGS_SURFACE_LDST = cydriver.CUgraphicsRegisterFlags_enum.CU_GRAPHICS_REGISTER_FLAGS_SURFACE_LDST + CU_GRAPHICS_REGISTER_FLAGS_TEXTURE_GATHER = cydriver.CUgraphicsRegisterFlags_enum.CU_GRAPHICS_REGISTER_FLAGS_TEXTURE_GATHER + +class CUgraphicsMapResourceFlags(_FastEnum): + """ + Flags for mapping and unmapping interop resources """ - def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr - def __init__(self, void_ptr _ptr): - pass - def __dealloc__(self): - pass - def getPtr(self): - return &self._ptr[0].flushRemoteWrites - def __repr__(self): - if self._ptr is not NULL: - str_list = [] - try: - str_list += ['operation : ' + str(self.operation)] - except ValueError: - str_list += ['operation : '] - try: - str_list += ['flags : ' + str(self.flags)] - except ValueError: - str_list += ['flags : '] - return '\n'.join(str_list) - else: - return '' - @property - def operation(self): - return CUstreamBatchMemOpType(self._ptr[0].flushRemoteWrites.operation) - @operation.setter - def operation(self, operation not None : CUstreamBatchMemOpType): - self._ptr[0].flushRemoteWrites.operation = operation.value - @property - def flags(self): - return self._ptr[0].flushRemoteWrites.flags - @flags.setter - def flags(self, unsigned int flags): - self._ptr[0].flushRemoteWrites.flags = flags -{{endif}} -{{if 'union CUstreamBatchMemOpParams_union' in found_types}} + CU_GRAPHICS_MAP_RESOURCE_FLAGS_NONE = cydriver.CUgraphicsMapResourceFlags_enum.CU_GRAPHICS_MAP_RESOURCE_FLAGS_NONE -cdef class CUstreamMemOpMemoryBarrierParams_st: + CU_GRAPHICS_MAP_RESOURCE_FLAGS_READ_ONLY = cydriver.CUgraphicsMapResourceFlags_enum.CU_GRAPHICS_MAP_RESOURCE_FLAGS_READ_ONLY + + CU_GRAPHICS_MAP_RESOURCE_FLAGS_WRITE_DISCARD = cydriver.CUgraphicsMapResourceFlags_enum.CU_GRAPHICS_MAP_RESOURCE_FLAGS_WRITE_DISCARD + +class CUarray_cubemap_face(_FastEnum): + """ + Array indices for cube faces """ - Attributes - ---------- - operation : CUstreamBatchMemOpType - < Only supported in the _v2 API - flags : unsigned int - Methods - ------- - getPtr() - Get memory address of class instance + CU_CUBEMAP_FACE_POSITIVE_X = ( + cydriver.CUarray_cubemap_face_enum.CU_CUBEMAP_FACE_POSITIVE_X, + 'Positive X face of cubemap\n' + ) + + + CU_CUBEMAP_FACE_NEGATIVE_X = ( + cydriver.CUarray_cubemap_face_enum.CU_CUBEMAP_FACE_NEGATIVE_X, + 'Negative X face of cubemap\n' + ) + + CU_CUBEMAP_FACE_POSITIVE_Y = ( + cydriver.CUarray_cubemap_face_enum.CU_CUBEMAP_FACE_POSITIVE_Y, + 'Positive Y face of cubemap\n' + ) + + + CU_CUBEMAP_FACE_NEGATIVE_Y = ( + cydriver.CUarray_cubemap_face_enum.CU_CUBEMAP_FACE_NEGATIVE_Y, + 'Negative Y face of cubemap\n' + ) + + + CU_CUBEMAP_FACE_POSITIVE_Z = ( + cydriver.CUarray_cubemap_face_enum.CU_CUBEMAP_FACE_POSITIVE_Z, + 'Positive Z face of cubemap\n' + ) + + + CU_CUBEMAP_FACE_NEGATIVE_Z = ( + cydriver.CUarray_cubemap_face_enum.CU_CUBEMAP_FACE_NEGATIVE_Z, + 'Negative Z face of cubemap\n' + ) + +class CUlimit(_FastEnum): + """ + Limits """ - def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr - def __init__(self, void_ptr _ptr): - pass - def __dealloc__(self): - pass - def getPtr(self): - return &self._ptr[0].memoryBarrier - def __repr__(self): - if self._ptr is not NULL: - str_list = [] - try: - str_list += ['operation : ' + str(self.operation)] - except ValueError: - str_list += ['operation : '] - try: - str_list += ['flags : ' + str(self.flags)] - except ValueError: - str_list += ['flags : '] - return '\n'.join(str_list) - else: - return '' - @property - def operation(self): - return CUstreamBatchMemOpType(self._ptr[0].memoryBarrier.operation) - @operation.setter - def operation(self, operation not None : CUstreamBatchMemOpType): - self._ptr[0].memoryBarrier.operation = operation.value - @property - def flags(self): - return self._ptr[0].memoryBarrier.flags - @flags.setter - def flags(self, unsigned int flags): - self._ptr[0].memoryBarrier.flags = flags -{{endif}} -{{if 'union CUstreamBatchMemOpParams_union' in found_types}} -cdef class CUstreamBatchMemOpParams_union: + CU_LIMIT_STACK_SIZE = ( + cydriver.CUlimit_enum.CU_LIMIT_STACK_SIZE, + 'GPU thread stack size\n' + ) + + + CU_LIMIT_PRINTF_FIFO_SIZE = ( + cydriver.CUlimit_enum.CU_LIMIT_PRINTF_FIFO_SIZE, + 'GPU printf FIFO size\n' + ) + + + CU_LIMIT_MALLOC_HEAP_SIZE = ( + cydriver.CUlimit_enum.CU_LIMIT_MALLOC_HEAP_SIZE, + 'GPU malloc heap size\n' + ) + + + CU_LIMIT_DEV_RUNTIME_SYNC_DEPTH = ( + cydriver.CUlimit_enum.CU_LIMIT_DEV_RUNTIME_SYNC_DEPTH, + 'GPU device runtime launch synchronize depth\n' + ) + + + CU_LIMIT_DEV_RUNTIME_PENDING_LAUNCH_COUNT = ( + cydriver.CUlimit_enum.CU_LIMIT_DEV_RUNTIME_PENDING_LAUNCH_COUNT, + 'GPU device runtime pending launch count\n' + ) + + + CU_LIMIT_MAX_L2_FETCH_GRANULARITY = ( + cydriver.CUlimit_enum.CU_LIMIT_MAX_L2_FETCH_GRANULARITY, + 'A value between 0 and 128 that indicates the maximum fetch granularity of\n' + 'L2 (in Bytes). This is a hint\n' + ) + + + CU_LIMIT_PERSISTING_L2_CACHE_SIZE = ( + cydriver.CUlimit_enum.CU_LIMIT_PERSISTING_L2_CACHE_SIZE, + 'A size in bytes for L2 persisting lines cache size\n' + ) + + + CU_LIMIT_SHMEM_SIZE = ( + cydriver.CUlimit_enum.CU_LIMIT_SHMEM_SIZE, + 'A maximum size in bytes of shared memory available to CUDA kernels on a CIG\n' + 'context. Can only be queried, cannot be set\n' + ) + + + CU_LIMIT_CIG_ENABLED = ( + cydriver.CUlimit_enum.CU_LIMIT_CIG_ENABLED, + 'A non-zero value indicates this CUDA context is a CIG-enabled context. Can\n' + 'only be queried, cannot be set\n' + ) + + + CU_LIMIT_CIG_SHMEM_FALLBACK_ENABLED = ( + cydriver.CUlimit_enum.CU_LIMIT_CIG_SHMEM_FALLBACK_ENABLED, + 'When set to zero, CUDA will fail to launch a kernel on a CIG context,\n' + 'instead of using the fallback path, if the kernel uses more shared memory\n' + 'than available\n' + ) + + CU_LIMIT_MAX = cydriver.CUlimit_enum.CU_LIMIT_MAX + +class CUresourcetype(_FastEnum): + """ + Resource types """ - Per-operation parameters for cuStreamBatchMemOp - Attributes - ---------- - operation : CUstreamBatchMemOpType - waitValue : CUstreamMemOpWaitValueParams_st + CU_RESOURCE_TYPE_ARRAY = ( + cydriver.CUresourcetype_enum.CU_RESOURCE_TYPE_ARRAY, + 'Array resource\n' + ) - writeValue : CUstreamMemOpWriteValueParams_st - flushRemoteWrites : CUstreamMemOpFlushRemoteWritesParams_st + CU_RESOURCE_TYPE_MIPMAPPED_ARRAY = ( + cydriver.CUresourcetype_enum.CU_RESOURCE_TYPE_MIPMAPPED_ARRAY, + 'Mipmapped array resource\n' + ) - memoryBarrier : CUstreamMemOpMemoryBarrierParams_st - pad : List[cuuint64_t] + CU_RESOURCE_TYPE_LINEAR = ( + cydriver.CUresourcetype_enum.CU_RESOURCE_TYPE_LINEAR, + 'Linear resource\n' + ) - Methods - ------- - getPtr() - Get memory address of class instance + CU_RESOURCE_TYPE_PITCH2D = ( + cydriver.CUresourcetype_enum.CU_RESOURCE_TYPE_PITCH2D, + 'Pitch 2D resource\n' + ) +class CUaccessProperty(_FastEnum): + """ + Specifies performance hint with :py:obj:`~.CUaccessPolicyWindow` + for hitProp and missProp members. """ - def __cinit__(self, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - else: - self._ptr = _ptr - def __init__(self, void_ptr _ptr = 0): - self._waitValue = CUstreamMemOpWaitValueParams_st(_ptr=self._ptr) - self._writeValue = CUstreamMemOpWriteValueParams_st(_ptr=self._ptr) - self._flushRemoteWrites = CUstreamMemOpFlushRemoteWritesParams_st(_ptr=self._ptr) - self._memoryBarrier = CUstreamMemOpMemoryBarrierParams_st(_ptr=self._ptr) - def __dealloc__(self): - pass - def getPtr(self): - return self._ptr - def __repr__(self): - if self._ptr is not NULL: - str_list = [] - try: - str_list += ['operation : ' + str(self.operation)] - except ValueError: - str_list += ['operation : '] - try: - str_list += ['waitValue :\n' + '\n'.join([' ' + line for line in str(self.waitValue).splitlines()])] - except ValueError: - str_list += ['waitValue : '] - try: - str_list += ['writeValue :\n' + '\n'.join([' ' + line for line in str(self.writeValue).splitlines()])] - except ValueError: - str_list += ['writeValue : '] - try: - str_list += ['flushRemoteWrites :\n' + '\n'.join([' ' + line for line in str(self.flushRemoteWrites).splitlines()])] - except ValueError: - str_list += ['flushRemoteWrites : '] - try: - str_list += ['memoryBarrier :\n' + '\n'.join([' ' + line for line in str(self.memoryBarrier).splitlines()])] - except ValueError: - str_list += ['memoryBarrier : '] - try: - str_list += ['pad : ' + str(self.pad)] - except ValueError: - str_list += ['pad : '] - return '\n'.join(str_list) - else: - return '' - @property - def operation(self): - return CUstreamBatchMemOpType(self._ptr[0].operation) - @operation.setter - def operation(self, operation not None : CUstreamBatchMemOpType): - self._ptr[0].operation = operation.value - @property - def waitValue(self): - return self._waitValue - @waitValue.setter - def waitValue(self, waitValue not None : CUstreamMemOpWaitValueParams_st): - string.memcpy(&self._ptr[0].waitValue, waitValue.getPtr(), sizeof(self._ptr[0].waitValue)) - @property - def writeValue(self): - return self._writeValue - @writeValue.setter - def writeValue(self, writeValue not None : CUstreamMemOpWriteValueParams_st): - string.memcpy(&self._ptr[0].writeValue, writeValue.getPtr(), sizeof(self._ptr[0].writeValue)) - @property - def flushRemoteWrites(self): - return self._flushRemoteWrites - @flushRemoteWrites.setter - def flushRemoteWrites(self, flushRemoteWrites not None : CUstreamMemOpFlushRemoteWritesParams_st): - string.memcpy(&self._ptr[0].flushRemoteWrites, flushRemoteWrites.getPtr(), sizeof(self._ptr[0].flushRemoteWrites)) - @property - def memoryBarrier(self): - return self._memoryBarrier - @memoryBarrier.setter - def memoryBarrier(self, memoryBarrier not None : CUstreamMemOpMemoryBarrierParams_st): - string.memcpy(&self._ptr[0].memoryBarrier, memoryBarrier.getPtr(), sizeof(self._ptr[0].memoryBarrier)) - @property - def pad(self): - return [cuuint64_t(init_value=_pad) for _pad in self._ptr[0].pad] - @pad.setter - def pad(self, pad): - self._ptr[0].pad = pad -{{endif}} -{{if 'struct CUDA_BATCH_MEM_OP_NODE_PARAMS_v1_st' in found_types}} -cdef class CUDA_BATCH_MEM_OP_NODE_PARAMS_v1_st: + CU_ACCESS_PROPERTY_NORMAL = ( + cydriver.CUaccessProperty_enum.CU_ACCESS_PROPERTY_NORMAL, + 'Normal cache persistence.\n' + ) + + + CU_ACCESS_PROPERTY_STREAMING = ( + cydriver.CUaccessProperty_enum.CU_ACCESS_PROPERTY_STREAMING, + 'Streaming access is less likely to persit from cache.\n' + ) + + + CU_ACCESS_PROPERTY_PERSISTING = ( + cydriver.CUaccessProperty_enum.CU_ACCESS_PROPERTY_PERSISTING, + 'Persisting access is more likely to persist in cache.\n' + ) + +class CUgraphConditionalNodeType(_FastEnum): + """ + Conditional node types """ - Attributes - ---------- - ctx : CUcontext - count : unsigned int - paramArray : CUstreamBatchMemOpParams + CU_GRAPH_COND_TYPE_IF = ( + cydriver.CUgraphConditionalNodeType_enum.CU_GRAPH_COND_TYPE_IF, + "Conditional 'if/else' Node. Body[0] executed if condition is non-zero. If\n" + '`size` == 2, an optional ELSE graph is created and this is executed if the\n' + 'condition is zero.\n' + ) - flags : unsigned int + CU_GRAPH_COND_TYPE_WHILE = ( + cydriver.CUgraphConditionalNodeType_enum.CU_GRAPH_COND_TYPE_WHILE, + "Conditional 'while' Node. Body executed repeatedly while condition value is\n" + 'non-zero.\n' + ) - Methods - ------- - getPtr() - Get memory address of class instance + CU_GRAPH_COND_TYPE_SWITCH = ( + cydriver.CUgraphConditionalNodeType_enum.CU_GRAPH_COND_TYPE_SWITCH, + "Conditional 'switch' Node. Body[n] is executed once, where 'n' is the value\n" + 'of the condition. If the condition does not match a body index, no body is\n' + 'launched.\n' + ) + +class CUgraphNodeType(_FastEnum): """ - def __cinit__(self, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val + Graph node types + """ + + + CU_GRAPH_NODE_TYPE_KERNEL = ( + cydriver.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_KERNEL, + 'GPU kernel node\n' + ) + + + CU_GRAPH_NODE_TYPE_MEMCPY = ( + cydriver.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_MEMCPY, + 'Memcpy node\n' + ) + + + CU_GRAPH_NODE_TYPE_MEMSET = ( + cydriver.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_MEMSET, + 'Memset node\n' + ) + + + CU_GRAPH_NODE_TYPE_HOST = ( + cydriver.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_HOST, + 'Host (executable) node\n' + ) + + + CU_GRAPH_NODE_TYPE_GRAPH = ( + cydriver.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_GRAPH, + 'Node which executes an embedded graph\n' + ) + + + CU_GRAPH_NODE_TYPE_EMPTY = ( + cydriver.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_EMPTY, + 'Empty (no-op) node\n' + ) + + + CU_GRAPH_NODE_TYPE_WAIT_EVENT = ( + cydriver.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_WAIT_EVENT, + 'External event wait node\n' + ) + + + CU_GRAPH_NODE_TYPE_EVENT_RECORD = ( + cydriver.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_EVENT_RECORD, + 'External event record node\n' + ) + + + CU_GRAPH_NODE_TYPE_EXT_SEMAS_SIGNAL = ( + cydriver.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_EXT_SEMAS_SIGNAL, + 'External semaphore signal node\n' + ) + + + CU_GRAPH_NODE_TYPE_EXT_SEMAS_WAIT = ( + cydriver.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_EXT_SEMAS_WAIT, + 'External semaphore wait node\n' + ) + + + CU_GRAPH_NODE_TYPE_MEM_ALLOC = ( + cydriver.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_MEM_ALLOC, + 'Memory Allocation Node\n' + ) + + + CU_GRAPH_NODE_TYPE_MEM_FREE = ( + cydriver.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_MEM_FREE, + 'Memory Free Node\n' + ) + + + CU_GRAPH_NODE_TYPE_BATCH_MEM_OP = ( + cydriver.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_BATCH_MEM_OP, + 'Batch MemOp Node See :py:obj:`~.cuStreamBatchMemOp` and\n' + ':py:obj:`~.CUstreamBatchMemOpType` for what these nodes can do.\n' + ) + + + CU_GRAPH_NODE_TYPE_CONDITIONAL = ( + cydriver.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_CONDITIONAL, + 'Conditional Node May be used to\n' + 'implement a conditional execution path or loop\n' + ' inside of a graph. The graph(s)\n' + 'contained within the body of the conditional node\n' + ' can be selectively executed or\n' + 'iterated upon based on the value of a conditional\n' + ' variable.\n' + ' Handles must be created in advance\n' + 'of creating the node\n' + ' using\n' + ':py:obj:`~.cuGraphConditionalHandleCreate`.\n' + ' The following restrictions apply to\n' + 'graphs which contain conditional nodes:\n' + ' The graph cannot be used in a\n' + 'child node.\n' + ' Only one instantiation of the\n' + 'graph may exist at any point in time.\n' + ' The graph cannot be cloned.\n' + ' To set the control value, supply a\n' + 'default value when creating the handle and/or\n' + ' call\n' + ':py:obj:`~.cudaGraphSetConditional` from device code.\n' + ) + + + CU_GRAPH_NODE_TYPE_RESERVED_16 = ( + cydriver.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_RESERVED_16, + 'Reserved\n' + ) + +class CUgraphDependencyType(_FastEnum): + """ + Type annotations that can be applied to graph edges as part of + :py:obj:`~.CUgraphEdgeData`. + """ + + + CU_GRAPH_DEPENDENCY_TYPE_DEFAULT = ( + cydriver.CUgraphDependencyType_enum.CU_GRAPH_DEPENDENCY_TYPE_DEFAULT, + 'This is an ordinary dependency.\n' + ) + + + CU_GRAPH_DEPENDENCY_TYPE_PROGRAMMATIC = ( + cydriver.CUgraphDependencyType_enum.CU_GRAPH_DEPENDENCY_TYPE_PROGRAMMATIC, + 'This dependency type allows the downstream node to use\n' + '`cudaGridDependencySynchronize()`. It may only be used between kernel\n' + 'nodes, and must be used with either the\n' + ':py:obj:`~.CU_GRAPH_KERNEL_NODE_PORT_PROGRAMMATIC` or\n' + ':py:obj:`~.CU_GRAPH_KERNEL_NODE_PORT_LAUNCH_ORDER` outgoing port.\n' + ) + +class CUgraphInstantiateResult(_FastEnum): + """ + Graph instantiation results + """ + + + CUDA_GRAPH_INSTANTIATE_SUCCESS = ( + cydriver.CUgraphInstantiateResult_enum.CUDA_GRAPH_INSTANTIATE_SUCCESS, + 'Instantiation succeeded\n' + ) + + + CUDA_GRAPH_INSTANTIATE_ERROR = ( + cydriver.CUgraphInstantiateResult_enum.CUDA_GRAPH_INSTANTIATE_ERROR, + 'Instantiation failed for an unexpected reason which is described in the\n' + 'return value of the function\n' + ) + + + CUDA_GRAPH_INSTANTIATE_INVALID_STRUCTURE = ( + cydriver.CUgraphInstantiateResult_enum.CUDA_GRAPH_INSTANTIATE_INVALID_STRUCTURE, + 'Instantiation failed due to invalid structure, such as cycles\n' + ) + + + CUDA_GRAPH_INSTANTIATE_NODE_OPERATION_NOT_SUPPORTED = ( + cydriver.CUgraphInstantiateResult_enum.CUDA_GRAPH_INSTANTIATE_NODE_OPERATION_NOT_SUPPORTED, + 'Instantiation for device launch failed because the graph contained an\n' + 'unsupported operation\n' + ) + + + CUDA_GRAPH_INSTANTIATE_MULTIPLE_CTXS_NOT_SUPPORTED = ( + cydriver.CUgraphInstantiateResult_enum.CUDA_GRAPH_INSTANTIATE_MULTIPLE_CTXS_NOT_SUPPORTED, + 'Instantiation for device launch failed due to the nodes belonging to\n' + 'different contexts\n' + ) + + + CUDA_GRAPH_INSTANTIATE_CONDITIONAL_HANDLE_UNUSED = ( + cydriver.CUgraphInstantiateResult_enum.CUDA_GRAPH_INSTANTIATE_CONDITIONAL_HANDLE_UNUSED, + 'One or more conditional handles are not associated with conditional nodes\n' + ) + +class CUsynchronizationPolicy(_FastEnum): + """ + + """ + + CU_SYNC_POLICY_AUTO = cydriver.CUsynchronizationPolicy_enum.CU_SYNC_POLICY_AUTO + + CU_SYNC_POLICY_SPIN = cydriver.CUsynchronizationPolicy_enum.CU_SYNC_POLICY_SPIN + + CU_SYNC_POLICY_YIELD = cydriver.CUsynchronizationPolicy_enum.CU_SYNC_POLICY_YIELD + + CU_SYNC_POLICY_BLOCKING_SYNC = cydriver.CUsynchronizationPolicy_enum.CU_SYNC_POLICY_BLOCKING_SYNC + +class CUclusterSchedulingPolicy(_FastEnum): + """ + Cluster scheduling policies. These may be passed to + :py:obj:`~.cuFuncSetAttribute` or :py:obj:`~.cuKernelSetAttribute` + """ + + + CU_CLUSTER_SCHEDULING_POLICY_DEFAULT = ( + cydriver.CUclusterSchedulingPolicy_enum.CU_CLUSTER_SCHEDULING_POLICY_DEFAULT, + 'the default policy\n' + ) + + + CU_CLUSTER_SCHEDULING_POLICY_SPREAD = ( + cydriver.CUclusterSchedulingPolicy_enum.CU_CLUSTER_SCHEDULING_POLICY_SPREAD, + 'spread the blocks within a cluster to the SMs\n' + ) + + + CU_CLUSTER_SCHEDULING_POLICY_LOAD_BALANCING = ( + cydriver.CUclusterSchedulingPolicy_enum.CU_CLUSTER_SCHEDULING_POLICY_LOAD_BALANCING, + 'allow the hardware to load-balance the blocks in a cluster to the SMs\n' + ) + +class CUlaunchMemSyncDomain(_FastEnum): + """ + Memory Synchronization Domain A kernel can be launched in a + specified memory synchronization domain that affects all memory + operations issued by that kernel. A memory barrier issued in one + domain will only order memory operations in that domain, thus + eliminating latency increase from memory barriers ordering + unrelated traffic. By default, kernels are launched in domain 0. + Kernel launched with :py:obj:`~.CU_LAUNCH_MEM_SYNC_DOMAIN_REMOTE` + will have a different domain ID. User may also alter the domain ID + with :py:obj:`~.CUlaunchMemSyncDomainMap` for a specific stream / + graph node / kernel launch. See + :py:obj:`~.CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN`, + :py:obj:`~.cuStreamSetAttribute`, :py:obj:`~.cuLaunchKernelEx`, + :py:obj:`~.cuGraphKernelNodeSetAttribute`. Memory operations done + in kernels launched in different domains are considered system- + scope distanced. In other words, a GPU scoped memory + synchronization is not sufficient for memory order to be observed + by kernels in another memory synchronization domain even if they + are on the same GPU. + """ + + + CU_LAUNCH_MEM_SYNC_DOMAIN_DEFAULT = ( + cydriver.CUlaunchMemSyncDomain_enum.CU_LAUNCH_MEM_SYNC_DOMAIN_DEFAULT, + 'Launch kernels in the default domain\n' + ) + + + CU_LAUNCH_MEM_SYNC_DOMAIN_REMOTE = ( + cydriver.CUlaunchMemSyncDomain_enum.CU_LAUNCH_MEM_SYNC_DOMAIN_REMOTE, + 'Launch kernels in the remote domain\n' + ) + +class CUlaunchAttributePortableClusterMode(_FastEnum): + """ + Enum for defining applicability of portable cluster size, used with + :py:obj:`~.cuLaunchKernelEx` + """ + + + CU_LAUNCH_PORTABLE_CLUSTER_MODE_DEFAULT = ( + cydriver.CUlaunchAttributePortableClusterMode_enum.CU_LAUNCH_PORTABLE_CLUSTER_MODE_DEFAULT, + 'The default to use for allowing non-portable cluster size on launch - uses\n' + 'current function attribute for\n' + ':py:obj:`~.CU_FUNC_ATTRIBUTE_NON_PORTABLE_CLUSTER_SIZE_ALLOWED`\n' + ) + + + CU_LAUNCH_PORTABLE_CLUSTER_MODE_REQUIRE_PORTABLE = ( + cydriver.CUlaunchAttributePortableClusterMode_enum.CU_LAUNCH_PORTABLE_CLUSTER_MODE_REQUIRE_PORTABLE, + 'Specifies that the cluster size requested must be a portable size\n' + ) + + + CU_LAUNCH_PORTABLE_CLUSTER_MODE_ALLOW_NON_PORTABLE = ( + cydriver.CUlaunchAttributePortableClusterMode_enum.CU_LAUNCH_PORTABLE_CLUSTER_MODE_ALLOW_NON_PORTABLE, + 'Specifies that the cluster size requested may be a non-portable size\n' + ) + +class CUsharedMemoryMode(_FastEnum): + """ + Shared memory related attributes for use with + :py:obj:`~.cuLaunchKernelEx` + """ + + + CU_SHARED_MEMORY_MODE_DEFAULT = ( + cydriver.CUsharedMemoryMode_enum.CU_SHARED_MEMORY_MODE_DEFAULT, + 'The default to use for shared memory on launch - uses current function\n' + 'attribute for :py:obj:`~.CU_FUNC_ATTRIBUTE_MAX_DYNAMIC_SHARED_SIZE_BYTES`\n' + ) + + + CU_SHARED_MEMORY_MODE_REQUIRE_PORTABLE = ( + cydriver.CUsharedMemoryMode_enum.CU_SHARED_MEMORY_MODE_REQUIRE_PORTABLE, + 'Specifies that the dynamic shared size bytes requested must be a portable\n' + 'size within the bounds of\n' + ':py:obj:`~.CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK`\n' + ) + + + CU_SHARED_MEMORY_MODE_ALLOW_NON_PORTABLE = ( + cydriver.CUsharedMemoryMode_enum.CU_SHARED_MEMORY_MODE_ALLOW_NON_PORTABLE, + 'Specifies that the dynamic shared size bytes requested may be a non-\n' + 'portable size but still within the bounds of\n' + ':py:obj:`~.CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK_OPTIN`\n' + ) + +class CUlaunchAttributeID(_FastEnum): + """ + Launch attributes enum; used as id field of + :py:obj:`~.CUlaunchAttribute` + """ + + + CU_LAUNCH_ATTRIBUTE_IGNORE = ( + cydriver.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_IGNORE, + 'Ignored entry, for convenient composition\n' + ) + + + CU_LAUNCH_ATTRIBUTE_ACCESS_POLICY_WINDOW = ( + cydriver.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_ACCESS_POLICY_WINDOW, + 'Valid for streams, graph nodes, launches. See\n' + ':py:obj:`~.CUlaunchAttributeValue.accessPolicyWindow`.\n' + ) + + + CU_LAUNCH_ATTRIBUTE_COOPERATIVE = ( + cydriver.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_COOPERATIVE, + 'Valid for graph nodes, launches. See\n' + ':py:obj:`~.CUlaunchAttributeValue.cooperative`.\n' + ) + + + CU_LAUNCH_ATTRIBUTE_SYNCHRONIZATION_POLICY = ( + cydriver.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_SYNCHRONIZATION_POLICY, + 'Valid for streams. See :py:obj:`~.CUlaunchAttributeValue.syncPolicy`.\n' + ) + + + CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION = ( + cydriver.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION, + 'Valid for graph nodes, launches. See\n' + ':py:obj:`~.CUlaunchAttributeValue.clusterDim`.\n' + ) + + + CU_LAUNCH_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE = ( + cydriver.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE, + 'Valid for graph nodes, launches. See\n' + ':py:obj:`~.CUlaunchAttributeValue.clusterSchedulingPolicyPreference`.\n' + ) + + + CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_STREAM_SERIALIZATION = ( + cydriver.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_STREAM_SERIALIZATION, + 'Valid for launches. Setting\n' + ':py:obj:`~.CUlaunchAttributeValue.programmaticStreamSerializationAllowed`\n' + 'to non-0 signals that the kernel will use programmatic means to resolve its\n' + 'stream dependency, so that the CUDA runtime should opportunistically allow\n' + "the grid's execution to overlap with the previous kernel in the stream, if\n" + 'that kernel requests the overlap. The dependent launches can choose to wait\n' + 'on the dependency using the programmatic sync\n' + '(cudaGridDependencySynchronize() or equivalent PTX instructions).\n' + ) + + + CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_EVENT = ( + cydriver.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_EVENT, + 'Valid for launches. Set\n' + ':py:obj:`~.CUlaunchAttributeValue.programmaticEvent` to record the event.\n' + 'Event recorded through this launch attribute is guaranteed to only trigger\n' + 'after all block in the associated kernel trigger the event. A block can\n' + 'trigger the event through PTX launchdep.release or CUDA builtin function\n' + 'cudaTriggerProgrammaticLaunchCompletion(). A trigger can also be inserted\n' + "at the beginning of each block's execution if triggerAtBlockStart is set to\n" + 'non-0. The dependent launches can choose to wait on the dependency using\n' + 'the programmatic sync (cudaGridDependencySynchronize() or equivalent PTX\n' + 'instructions). Note that dependents (including the CPU thread calling\n' + ':py:obj:`~.cuEventSynchronize()`) are not guaranteed to observe the release\n' + 'precisely when it is released. For example,\n' + ':py:obj:`~.cuEventSynchronize()` may only observe the event trigger long\n' + 'after the associated kernel has completed. This recording type is primarily\n' + 'meant for establishing programmatic dependency between device tasks. Note\n' + 'also this type of dependency allows, but does not guarantee, concurrent\n' + 'execution of tasks.\n' + ' The event supplied must not be an interprocess or interop event. The event\n' + 'must disable timing (i.e. must be created with the\n' + ':py:obj:`~.CU_EVENT_DISABLE_TIMING` flag set).\n' + ) + + + CU_LAUNCH_ATTRIBUTE_PRIORITY = ( + cydriver.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_PRIORITY, + 'Valid for streams, graph nodes, launches. See\n' + ':py:obj:`~.CUlaunchAttributeValue.priority`.\n' + ) + + + CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP = ( + cydriver.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP, + 'Valid for streams, graph nodes, launches. See\n' + ':py:obj:`~.CUlaunchAttributeValue.memSyncDomainMap`.\n' + ) + + + CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN = ( + cydriver.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN, + 'Valid for streams, graph nodes, launches. See\n' + ':py:obj:`~.CUlaunchAttributeValue.memSyncDomain`.\n' + ) + + + CU_LAUNCH_ATTRIBUTE_PREFERRED_CLUSTER_DIMENSION = ( + cydriver.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_PREFERRED_CLUSTER_DIMENSION, + 'Valid for graph nodes, launches. Set\n' + ':py:obj:`~.CUlaunchAttributeValue.preferredClusterDim` to allow the kernel\n' + 'launch to specify a preferred substitute cluster dimension. Blocks may be\n' + 'grouped according to either the dimensions specified with this attribute\n' + '(grouped into a "preferred substitute cluster"), or the one specified with\n' + ':py:obj:`~.CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION` attribute (grouped into a\n' + '"regular cluster"). The cluster dimensions of a "preferred substitute\n' + 'cluster" shall be an integer multiple greater than zero of the regular\n' + 'cluster dimensions. The device will attempt - on a best-effort basis - to\n' + 'group thread blocks into preferred clusters over grouping them into regular\n' + 'clusters. When it deems necessary (primarily when the device temporarily\n' + 'runs out of physical resources to launch the larger preferred clusters),\n' + 'the device may switch to launch the regular clusters instead to attempt to\n' + 'utilize as much of the physical device resources as possible.\n' + ' Each type of cluster will have its enumeration / coordinate setup as if\n' + 'the grid consists solely of its type of cluster. For example, if the\n' + 'preferred substitute cluster dimensions double the regular cluster\n' + 'dimensions, there might be simultaneously a regular cluster indexed at\n' + '(1,0,0), and a preferred cluster indexed at (1,0,0). In this example, the\n' + 'preferred substitute cluster (1,0,0) replaces regular clusters (2,0,0) and\n' + '(3,0,0) and groups their blocks.\n' + ' This attribute will only take effect when a regular cluster dimension has\n' + 'been specified. The preferred substitute cluster dimension must be an\n' + 'integer multiple greater than zero of the regular cluster dimension and\n' + 'must divide the grid. It must also be no more than `maxBlocksPerCluster`,\n' + "if it is set in the kernel's `__launch_bounds__`. Otherwise it must be less\n" + 'than the maximum value the driver can support. Otherwise, setting this\n' + 'attribute to a value physically unable to fit on any particular device is\n' + 'permitted.\n' + ) + + + CU_LAUNCH_ATTRIBUTE_LAUNCH_COMPLETION_EVENT = ( + cydriver.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_LAUNCH_COMPLETION_EVENT, + 'Valid for launches. Set\n' + ':py:obj:`~.CUlaunchAttributeValue.launchCompletionEvent` to record the\n' + 'event.\n' + ' Nominally, the event is triggered once all blocks of the kernel have begun\n' + 'execution. Currently this is a best effort. If a kernel B has a launch\n' + 'completion dependency on a kernel A, B may wait until A is complete.\n' + 'Alternatively, blocks of B may begin before all blocks of A have begun, for\n' + 'example if B can claim execution resources unavailable to A (e.g. they run\n' + 'on different GPUs) or if B is a higher priority than A. Exercise caution if\n' + 'such an ordering inversion could lead to deadlock.\n' + ' A launch completion event is nominally similar to a programmatic event\n' + 'with `triggerAtBlockStart` set except that it is not visible to\n' + '`cudaGridDependencySynchronize()` and can be used with compute capability\n' + 'less than 9.0.\n' + ' The event supplied must not be an interprocess or interop event. The event\n' + 'must disable timing (i.e. must be created with the\n' + ':py:obj:`~.CU_EVENT_DISABLE_TIMING` flag set).\n' + ) + + + CU_LAUNCH_ATTRIBUTE_DEVICE_UPDATABLE_KERNEL_NODE = ( + cydriver.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_DEVICE_UPDATABLE_KERNEL_NODE, + 'Valid for graph nodes, launches. This attribute is graphs-only, and passing\n' + 'it to a launch in a non-capturing stream will result in an error.\n' + ':py:obj:`~.CUlaunchAttributeValue.deviceUpdatableKernelNode.deviceUpdatable`\n' + 'can only be set to 0 or 1. Setting the field to 1 indicates that the\n' + 'corresponding kernel node should be device-updatable. On success, a handle\n' + 'will be returned via\n' + ':py:obj:`~.CUlaunchAttributeValue.deviceUpdatableKernelNode.devNode` which\n' + 'can be passed to the various device-side update functions to update the\n' + "node's kernel parameters from within another kernel. For more information\n" + 'on the types of device updates that can be made, as well as the relevant\n' + 'limitations thereof, see :py:obj:`~.cudaGraphKernelNodeUpdatesApply`.\n' + ' Nodes which are device-updatable have additional restrictions compared to\n' + 'regular kernel nodes. Firstly, device-updatable nodes cannot be removed\n' + 'from their graph via :py:obj:`~.cuGraphDestroyNode`. Additionally, once\n' + 'opted-in to this functionality, a node cannot opt out, and any attempt to\n' + 'set the deviceUpdatable attribute to 0 will result in an error. Device-\n' + 'updatable kernel nodes also cannot have their attributes copied to/from\n' + 'another kernel node via :py:obj:`~.cuGraphKernelNodeCopyAttributes`. Graphs\n' + 'containing one or more device-updatable nodes also do not allow multiple\n' + 'instantiation, and neither the graph nor its instantiated version can be\n' + 'passed to :py:obj:`~.cuGraphExecUpdate`.\n' + ' If a graph contains device-updatable nodes and updates those nodes from\n' + 'the device from within the graph, the graph must be uploaded with\n' + ':py:obj:`~.cuGraphUpload` before it is launched. For such a graph, if host-\n' + 'side executable graph updates are made to the device-updatable nodes, the\n' + 'graph must be uploaded before it is launched again.\n' + ) + + + CU_LAUNCH_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT = ( + cydriver.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT, + 'Valid for launches. On devices where the L1 cache and shared memory use the\n' + 'same hardware resources, setting\n' + ':py:obj:`~.CUlaunchAttributeValue.sharedMemCarveout` to a percentage\n' + 'between 0-100 signals the CUDA driver to set the shared memory carveout\n' + 'preference, in percent of the total shared memory for that kernel launch.\n' + 'This attribute takes precedence over\n' + ':py:obj:`~.CU_FUNC_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT`. This is\n' + 'only a hint, and the CUDA driver can choose a different configuration if\n' + 'required for the launch.\n' + ) + + + CU_LAUNCH_ATTRIBUTE_NVLINK_UTIL_CENTRIC_SCHEDULING = ( + cydriver.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_NVLINK_UTIL_CENTRIC_SCHEDULING, + 'Valid for streams, graph nodes, launches. This attribute is a hint to the\n' + 'CUDA runtime that the launch should attempt to make the kernel maximize its\n' + 'NVLINK utilization.\n' + ' When possible to honor this hint, CUDA will assume each block in the grid\n' + 'launch will carry out an even amount of NVLINK traffic, and make a best-\n' + 'effort attempt to adjust the kernel launch based on that assumption.\n' + ' This attribute is a hint only. CUDA makes no functional or performance\n' + 'guarantee. Its applicability can be affected by many different factors,\n' + "including driver version (i.e. CUDA doesn't guarantee the performance\n" + 'characteristics will be maintained between driver versions or a driver\n' + 'update could alter or regress previously observed perf characteristics.) It\n' + "also doesn't guarantee a successful result, i.e. applying the attribute may\n" + 'not improve the performance of either the targeted kernel or the\n' + 'encapsulating application.\n' + ' Valid values for\n' + ':py:obj:`~.CUlaunchAttributeValue.nvlinkUtilCentricScheduling` are 0\n' + '(disabled) and 1 (enabled).\n' + ) + + + CU_LAUNCH_ATTRIBUTE_PORTABLE_CLUSTER_SIZE_MODE = ( + cydriver.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_PORTABLE_CLUSTER_SIZE_MODE, + 'Valid for graph nodes, launches. This controls whether the kernel launch is\n' + 'allowed to use a non-portable cluster size. Valid values for\n' + ':py:obj:`~.CUlaunchAttributeValue.portableClusterSizeMode` are described in\n' + ':py:obj:`~.CUlaunchAttributePortableClusterMode`. Any other value will\n' + 'return :py:obj:`~.CUDA_ERROR_INVALID_VALUE`\n' + ) + + + CU_LAUNCH_ATTRIBUTE_SHARED_MEMORY_MODE = ( + cydriver.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_SHARED_MEMORY_MODE, + 'Valid for graph nodes, launches. This indicates if the kernel is allowed to\n' + 'use a non-portable dynamic shared memory mode.\n' + ) + +class CUstreamCaptureStatus(_FastEnum): + """ + Possible stream capture statuses returned by + :py:obj:`~.cuStreamIsCapturing` + """ + + + CU_STREAM_CAPTURE_STATUS_NONE = ( + cydriver.CUstreamCaptureStatus_enum.CU_STREAM_CAPTURE_STATUS_NONE, + 'Stream is not capturing\n' + ) + + + CU_STREAM_CAPTURE_STATUS_ACTIVE = ( + cydriver.CUstreamCaptureStatus_enum.CU_STREAM_CAPTURE_STATUS_ACTIVE, + 'Stream is actively capturing\n' + ) + + + CU_STREAM_CAPTURE_STATUS_INVALIDATED = ( + cydriver.CUstreamCaptureStatus_enum.CU_STREAM_CAPTURE_STATUS_INVALIDATED, + 'Stream is part of a capture sequence that has been invalidated, but not\n' + 'terminated\n' + ) + +class CUstreamCaptureMode(_FastEnum): + """ + Possible modes for stream capture thread interactions. For more + details see :py:obj:`~.cuStreamBeginCapture` and + :py:obj:`~.cuThreadExchangeStreamCaptureMode` + """ + + CU_STREAM_CAPTURE_MODE_GLOBAL = cydriver.CUstreamCaptureMode_enum.CU_STREAM_CAPTURE_MODE_GLOBAL + + CU_STREAM_CAPTURE_MODE_THREAD_LOCAL = cydriver.CUstreamCaptureMode_enum.CU_STREAM_CAPTURE_MODE_THREAD_LOCAL + + CU_STREAM_CAPTURE_MODE_RELAXED = cydriver.CUstreamCaptureMode_enum.CU_STREAM_CAPTURE_MODE_RELAXED + +class CUdriverProcAddress_flags(_FastEnum): + """ + Flags to specify search options. For more details see + :py:obj:`~.cuGetProcAddress` + """ + + + CU_GET_PROC_ADDRESS_DEFAULT = ( + cydriver.CUdriverProcAddress_flags_enum.CU_GET_PROC_ADDRESS_DEFAULT, + 'Default search mode for driver symbols.\n' + ) + + + CU_GET_PROC_ADDRESS_LEGACY_STREAM = ( + cydriver.CUdriverProcAddress_flags_enum.CU_GET_PROC_ADDRESS_LEGACY_STREAM, + 'Search for legacy versions of driver symbols.\n' + ) + + + CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM = ( + cydriver.CUdriverProcAddress_flags_enum.CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM, + 'Search for per-thread versions of driver symbols.\n' + ) + +class CUdriverProcAddressQueryResult(_FastEnum): + """ + Flags to indicate search status. For more details see + :py:obj:`~.cuGetProcAddress` + """ + + + CU_GET_PROC_ADDRESS_SUCCESS = ( + cydriver.CUdriverProcAddressQueryResult_enum.CU_GET_PROC_ADDRESS_SUCCESS, + 'Symbol was succesfully found\n' + ) + + + CU_GET_PROC_ADDRESS_SYMBOL_NOT_FOUND = ( + cydriver.CUdriverProcAddressQueryResult_enum.CU_GET_PROC_ADDRESS_SYMBOL_NOT_FOUND, + 'Symbol was not found in search\n' + ) + + + CU_GET_PROC_ADDRESS_VERSION_NOT_SUFFICIENT = ( + cydriver.CUdriverProcAddressQueryResult_enum.CU_GET_PROC_ADDRESS_VERSION_NOT_SUFFICIENT, + 'Symbol was found but version supplied was not sufficient\n' + ) + +class CUexecAffinityType(_FastEnum): + """ + Execution Affinity Types + """ + + + CU_EXEC_AFFINITY_TYPE_SM_COUNT = ( + cydriver.CUexecAffinityType_enum.CU_EXEC_AFFINITY_TYPE_SM_COUNT, + 'Create a context with limited SMs.\n' + ) + + CU_EXEC_AFFINITY_TYPE_MAX = cydriver.CUexecAffinityType_enum.CU_EXEC_AFFINITY_TYPE_MAX + +class CUcigDataType(_FastEnum): + """ + + """ + + + CIG_DATA_TYPE_D3D12_COMMAND_QUEUE = ( + cydriver.CUcigDataType_enum.CIG_DATA_TYPE_D3D12_COMMAND_QUEUE, + 'D3D12 Command Queue Handle\n' + ) + + + CIG_DATA_TYPE_NV_BLOB = ( + cydriver.CUcigDataType_enum.CIG_DATA_TYPE_NV_BLOB, + 'Nvidia specific data blob used for Vulkan and other NV clients\n' + ) + +class CUstreamCigDataType(_FastEnum): + """ + + """ + + + STREAM_CIG_DATA_TYPE_D3D12_COMMAND_LIST = ( + cydriver.CUstreamCigDataType_enum.STREAM_CIG_DATA_TYPE_D3D12_COMMAND_LIST, + 'D3D12 Command List Handle\n' + ) + +class CUlibraryOption(_FastEnum): + """ + Library options to be specified with + :py:obj:`~.cuLibraryLoadData()` or + :py:obj:`~.cuLibraryLoadFromFile()` + """ + + CU_LIBRARY_HOST_UNIVERSAL_FUNCTION_AND_DATA_TABLE = cydriver.CUlibraryOption_enum.CU_LIBRARY_HOST_UNIVERSAL_FUNCTION_AND_DATA_TABLE + + + CU_LIBRARY_BINARY_IS_PRESERVED = ( + cydriver.CUlibraryOption_enum.CU_LIBRARY_BINARY_IS_PRESERVED, + 'Specifes that the argument `code` passed to :py:obj:`~.cuLibraryLoadData()`\n' + 'will be preserved. Specifying this option will let the driver know that\n' + '`code` can be accessed at any point until :py:obj:`~.cuLibraryUnload()`.\n' + 'The default behavior is for the driver to allocate and maintain its own\n' + 'copy of `code`. Note that this is only a memory usage optimization hint and\n' + 'the driver can choose to ignore it if required. Specifying this option with\n' + ':py:obj:`~.cuLibraryLoadFromFile()` is invalid and will return\n' + ':py:obj:`~.CUDA_ERROR_INVALID_VALUE`.\n' + ) + + CU_LIBRARY_NUM_OPTIONS = cydriver.CUlibraryOption_enum.CU_LIBRARY_NUM_OPTIONS + +class CUresult(_FastEnum): + """ + Error codes + """ + + + CUDA_SUCCESS = ( + cydriver.cudaError_enum.CUDA_SUCCESS, + 'The API call returned with no errors. In the case of query calls, this also\n' + 'means that the operation being queried is complete (see\n' + ':py:obj:`~.cuEventQuery()` and :py:obj:`~.cuStreamQuery()`).\n' + ) + + + CUDA_ERROR_INVALID_VALUE = ( + cydriver.cudaError_enum.CUDA_ERROR_INVALID_VALUE, + 'This indicates that one or more of the parameters passed to the API call is\n' + 'not within an acceptable range of values.\n' + ) + + + CUDA_ERROR_OUT_OF_MEMORY = ( + cydriver.cudaError_enum.CUDA_ERROR_OUT_OF_MEMORY, + 'The API call failed because it was unable to allocate enough memory or\n' + 'other resources to perform the requested operation.\n' + ) + + + CUDA_ERROR_NOT_INITIALIZED = ( + cydriver.cudaError_enum.CUDA_ERROR_NOT_INITIALIZED, + 'This indicates that the CUDA driver has not been initialized with\n' + ':py:obj:`~.cuInit()` or that initialization has failed.\n' + ) + + + CUDA_ERROR_DEINITIALIZED = ( + cydriver.cudaError_enum.CUDA_ERROR_DEINITIALIZED, + 'This indicates that the CUDA driver is in the process of shutting down.\n' + ) + + + CUDA_ERROR_PROFILER_DISABLED = ( + cydriver.cudaError_enum.CUDA_ERROR_PROFILER_DISABLED, + 'This indicates profiler is not initialized for this run. This can happen\n' + 'when the application is running with external profiling tools like visual\n' + 'profiler.\n' + ) + + + CUDA_ERROR_PROFILER_NOT_INITIALIZED = ( + cydriver.cudaError_enum.CUDA_ERROR_PROFILER_NOT_INITIALIZED, + '[Deprecated]\n' + ) + + + CUDA_ERROR_PROFILER_ALREADY_STARTED = ( + cydriver.cudaError_enum.CUDA_ERROR_PROFILER_ALREADY_STARTED, + '[Deprecated]\n' + ) + + + CUDA_ERROR_PROFILER_ALREADY_STOPPED = ( + cydriver.cudaError_enum.CUDA_ERROR_PROFILER_ALREADY_STOPPED, + '[Deprecated]\n' + ) + + + CUDA_ERROR_STUB_LIBRARY = ( + cydriver.cudaError_enum.CUDA_ERROR_STUB_LIBRARY, + 'This indicates that the CUDA driver that the application has loaded is a\n' + 'stub library. Applications that run with the stub rather than a real driver\n' + 'loaded will result in CUDA API returning this error.\n' + ) + + + CUDA_ERROR_CALL_REQUIRES_NEWER_DRIVER = ( + cydriver.cudaError_enum.CUDA_ERROR_CALL_REQUIRES_NEWER_DRIVER, + 'This indicates that the API call requires a newer CUDA driver than the one\n' + 'currently installed. Users should install an updated NVIDIA CUDA driver to\n' + 'allow the API call to succeed.\n' + ) + + + CUDA_ERROR_DEVICE_UNAVAILABLE = ( + cydriver.cudaError_enum.CUDA_ERROR_DEVICE_UNAVAILABLE, + 'This indicates that requested CUDA device is unavailable at the current\n' + 'time. Devices are often unavailable due to use of\n' + ':py:obj:`~.CU_COMPUTEMODE_EXCLUSIVE_PROCESS` or\n' + ':py:obj:`~.CU_COMPUTEMODE_PROHIBITED`.\n' + ) + + + CUDA_ERROR_NO_DEVICE = ( + cydriver.cudaError_enum.CUDA_ERROR_NO_DEVICE, + 'This indicates that no CUDA-capable devices were detected by the installed\n' + 'CUDA driver.\n' + ) + + + CUDA_ERROR_INVALID_DEVICE = ( + cydriver.cudaError_enum.CUDA_ERROR_INVALID_DEVICE, + 'This indicates that the device ordinal supplied by the user does not\n' + 'correspond to a valid CUDA device or that the action requested is invalid\n' + 'for the specified device.\n' + ) + + + CUDA_ERROR_DEVICE_NOT_LICENSED = ( + cydriver.cudaError_enum.CUDA_ERROR_DEVICE_NOT_LICENSED, + 'This error indicates that the Grid license is not applied.\n' + ) + + + CUDA_ERROR_INVALID_IMAGE = ( + cydriver.cudaError_enum.CUDA_ERROR_INVALID_IMAGE, + 'This indicates that the device kernel image is invalid. This can also\n' + 'indicate an invalid CUDA module.\n' + ) + + + CUDA_ERROR_INVALID_CONTEXT = ( + cydriver.cudaError_enum.CUDA_ERROR_INVALID_CONTEXT, + 'This most frequently indicates that there is no context bound to the\n' + 'current thread. This can also be returned if the context passed to an API\n' + 'call is not a valid handle (such as a context that has had\n' + ':py:obj:`~.cuCtxDestroy()` invoked on it). This can also be returned if a\n' + 'user mixes different API versions (i.e. 3010 context with 3020 API calls).\n' + 'See :py:obj:`~.cuCtxGetApiVersion()` for more details. This can also be\n' + 'returned if the green context passed to an API call was not converted to a\n' + ':py:obj:`~.CUcontext` using :py:obj:`~.cuCtxFromGreenCtx` API.\n' + ) + + + CUDA_ERROR_CONTEXT_ALREADY_CURRENT = ( + cydriver.cudaError_enum.CUDA_ERROR_CONTEXT_ALREADY_CURRENT, + 'This indicated that the context being supplied as a parameter to the API\n' + 'call was already the active context.\n' + '[Deprecated]\n' + ) + + + CUDA_ERROR_MAP_FAILED = ( + cydriver.cudaError_enum.CUDA_ERROR_MAP_FAILED, + 'This indicates that a map or register operation has failed.\n' + ) + + + CUDA_ERROR_UNMAP_FAILED = ( + cydriver.cudaError_enum.CUDA_ERROR_UNMAP_FAILED, + 'This indicates that an unmap or unregister operation has failed.\n' + ) + + + CUDA_ERROR_ARRAY_IS_MAPPED = ( + cydriver.cudaError_enum.CUDA_ERROR_ARRAY_IS_MAPPED, + 'This indicates that the specified array is currently mapped and thus cannot\n' + 'be destroyed.\n' + ) + + + CUDA_ERROR_ALREADY_MAPPED = ( + cydriver.cudaError_enum.CUDA_ERROR_ALREADY_MAPPED, + 'This indicates that the resource is already mapped.\n' + ) + + + CUDA_ERROR_NO_BINARY_FOR_GPU = ( + cydriver.cudaError_enum.CUDA_ERROR_NO_BINARY_FOR_GPU, + 'This indicates that there is no kernel image available that is suitable for\n' + 'the device. This can occur when a user specifies code generation options\n' + 'for a particular CUDA source file that do not include the corresponding\n' + 'device configuration.\n' + ) + + + CUDA_ERROR_ALREADY_ACQUIRED = ( + cydriver.cudaError_enum.CUDA_ERROR_ALREADY_ACQUIRED, + 'This indicates that a resource has already been acquired.\n' + ) + + + CUDA_ERROR_NOT_MAPPED = ( + cydriver.cudaError_enum.CUDA_ERROR_NOT_MAPPED, + 'This indicates that a resource is not mapped.\n' + ) + + + CUDA_ERROR_NOT_MAPPED_AS_ARRAY = ( + cydriver.cudaError_enum.CUDA_ERROR_NOT_MAPPED_AS_ARRAY, + 'This indicates that a mapped resource is not available for access as an\n' + 'array.\n' + ) + + + CUDA_ERROR_NOT_MAPPED_AS_POINTER = ( + cydriver.cudaError_enum.CUDA_ERROR_NOT_MAPPED_AS_POINTER, + 'This indicates that a mapped resource is not available for access as a\n' + 'pointer.\n' + ) + + + CUDA_ERROR_ECC_UNCORRECTABLE = ( + cydriver.cudaError_enum.CUDA_ERROR_ECC_UNCORRECTABLE, + 'This indicates that an uncorrectable ECC error was detected during\n' + 'execution.\n' + ) + + + CUDA_ERROR_UNSUPPORTED_LIMIT = ( + cydriver.cudaError_enum.CUDA_ERROR_UNSUPPORTED_LIMIT, + 'This indicates that the :py:obj:`~.CUlimit` passed to the API call is not\n' + 'supported by the active device.\n' + ) + + + CUDA_ERROR_CONTEXT_ALREADY_IN_USE = ( + cydriver.cudaError_enum.CUDA_ERROR_CONTEXT_ALREADY_IN_USE, + 'This indicates that the :py:obj:`~.CUcontext` passed to the API call can\n' + 'only be bound to a single CPU thread at a time but is already bound to a\n' + 'CPU thread.\n' + ) + + + CUDA_ERROR_PEER_ACCESS_UNSUPPORTED = ( + cydriver.cudaError_enum.CUDA_ERROR_PEER_ACCESS_UNSUPPORTED, + 'This indicates that peer access is not supported across the given devices.\n' + ) + + + CUDA_ERROR_INVALID_PTX = ( + cydriver.cudaError_enum.CUDA_ERROR_INVALID_PTX, + 'This indicates that a PTX JIT compilation failed.\n' + ) + + + CUDA_ERROR_INVALID_GRAPHICS_CONTEXT = ( + cydriver.cudaError_enum.CUDA_ERROR_INVALID_GRAPHICS_CONTEXT, + 'This indicates an error with OpenGL or DirectX context.\n' + ) + + + CUDA_ERROR_NVLINK_UNCORRECTABLE = ( + cydriver.cudaError_enum.CUDA_ERROR_NVLINK_UNCORRECTABLE, + 'This indicates that an uncorrectable NVLink error was detected during the\n' + 'execution.\n' + ) + + + CUDA_ERROR_JIT_COMPILER_NOT_FOUND = ( + cydriver.cudaError_enum.CUDA_ERROR_JIT_COMPILER_NOT_FOUND, + 'This indicates that the PTX JIT compiler library was not found.\n' + ) + + + CUDA_ERROR_UNSUPPORTED_PTX_VERSION = ( + cydriver.cudaError_enum.CUDA_ERROR_UNSUPPORTED_PTX_VERSION, + 'This indicates that the provided PTX was compiled with an unsupported\n' + 'toolchain.\n' + ) + + + CUDA_ERROR_JIT_COMPILATION_DISABLED = ( + cydriver.cudaError_enum.CUDA_ERROR_JIT_COMPILATION_DISABLED, + 'This indicates that the PTX JIT compilation was disabled.\n' + ) + + + CUDA_ERROR_UNSUPPORTED_EXEC_AFFINITY = ( + cydriver.cudaError_enum.CUDA_ERROR_UNSUPPORTED_EXEC_AFFINITY, + 'This indicates that the :py:obj:`~.CUexecAffinityType` passed to the API\n' + 'call is not supported by the active device.\n' + ) + + + CUDA_ERROR_UNSUPPORTED_DEVSIDE_SYNC = ( + cydriver.cudaError_enum.CUDA_ERROR_UNSUPPORTED_DEVSIDE_SYNC, + 'This indicates that the code to be compiled by the PTX JIT contains\n' + 'unsupported call to cudaDeviceSynchronize.\n' + ) + + + CUDA_ERROR_CONTAINED = ( + cydriver.cudaError_enum.CUDA_ERROR_CONTAINED, + 'This indicates that an exception occurred on the device that is now\n' + "contained by the GPU's error containment capability. Common causes are - a.\n" + 'Certain types of invalid accesses of peer GPU memory over nvlink b. Certain\n' + 'classes of hardware errors This leaves the process in an inconsistent state\n' + 'and any further CUDA work will return the same error. To continue using\n' + 'CUDA, the process must be terminated and relaunched.\n' + ) + + + CUDA_ERROR_INVALID_SOURCE = ( + cydriver.cudaError_enum.CUDA_ERROR_INVALID_SOURCE, + 'This indicates that the device kernel source is invalid. This includes\n' + 'compilation/linker errors encountered in device code or user error.\n' + ) + + + CUDA_ERROR_FILE_NOT_FOUND = ( + cydriver.cudaError_enum.CUDA_ERROR_FILE_NOT_FOUND, + 'This indicates that the file specified was not found.\n' + ) + + + CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND = ( + cydriver.cudaError_enum.CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND, + 'This indicates that a link to a shared object failed to resolve.\n' + ) + + + CUDA_ERROR_SHARED_OBJECT_INIT_FAILED = ( + cydriver.cudaError_enum.CUDA_ERROR_SHARED_OBJECT_INIT_FAILED, + 'This indicates that initialization of a shared object failed.\n' + ) + + + CUDA_ERROR_OPERATING_SYSTEM = ( + cydriver.cudaError_enum.CUDA_ERROR_OPERATING_SYSTEM, + 'This indicates that an OS call failed.\n' + ) + + + CUDA_ERROR_INVALID_HANDLE = ( + cydriver.cudaError_enum.CUDA_ERROR_INVALID_HANDLE, + 'This indicates that a resource handle passed to the API call was not valid.\n' + 'Resource handles are opaque types like :py:obj:`~.CUstream` and\n' + ':py:obj:`~.CUevent`.\n' + ) + + + CUDA_ERROR_ILLEGAL_STATE = ( + cydriver.cudaError_enum.CUDA_ERROR_ILLEGAL_STATE, + 'This indicates that a resource required by the API call is not in a valid\n' + 'state to perform the requested operation.\n' + ) + + + CUDA_ERROR_LOSSY_QUERY = ( + cydriver.cudaError_enum.CUDA_ERROR_LOSSY_QUERY, + 'This indicates an attempt was made to introspect an object in a way that\n' + 'would discard semantically important information. This is either due to the\n' + 'object using funtionality newer than the API version used to introspect it\n' + 'or omission of optional return arguments.\n' + ) + + + CUDA_ERROR_NOT_FOUND = ( + cydriver.cudaError_enum.CUDA_ERROR_NOT_FOUND, + 'This indicates that a named symbol was not found. Examples of symbols are\n' + 'global/constant variable names, driver function names, texture names, and\n' + 'surface names.\n' + ) + + + CUDA_ERROR_NOT_READY = ( + cydriver.cudaError_enum.CUDA_ERROR_NOT_READY, + 'This indicates that asynchronous operations issued previously have not\n' + 'completed yet. This result is not actually an error, but must be indicated\n' + 'differently than :py:obj:`~.CUDA_SUCCESS` (which indicates completion).\n' + 'Calls that may return this value include :py:obj:`~.cuEventQuery()` and\n' + ':py:obj:`~.cuStreamQuery()`.\n' + ) + + + CUDA_ERROR_ILLEGAL_ADDRESS = ( + cydriver.cudaError_enum.CUDA_ERROR_ILLEGAL_ADDRESS, + 'While executing a kernel, the device encountered a load or store\n' + 'instruction on an invalid memory address. This leaves the process in an\n' + 'inconsistent state and any further CUDA work will return the same error. To\n' + 'continue using CUDA, the process must be terminated and relaunched.\n' + ) + + + CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES = ( + cydriver.cudaError_enum.CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES, + 'This indicates that a launch did not occur because it did not have\n' + 'appropriate resources. This error usually indicates that the user has\n' + 'attempted to pass too many arguments to the device kernel, or the kernel\n' + "launch specifies too many threads for the kernel's register count. Passing\n" + 'arguments of the wrong size (i.e. a 64-bit pointer when a 32-bit int is\n' + 'expected) is equivalent to passing too many arguments and can also result\n' + 'in this error.\n' + ) + + + CUDA_ERROR_LAUNCH_TIMEOUT = ( + cydriver.cudaError_enum.CUDA_ERROR_LAUNCH_TIMEOUT, + 'This indicates that the device kernel took too long to execute. This can\n' + 'only occur if timeouts are enabled - see the device attribute\n' + ':py:obj:`~.CU_DEVICE_ATTRIBUTE_KERNEL_EXEC_TIMEOUT` for more information.\n' + 'This leaves the process in an inconsistent state and any further CUDA work\n' + 'will return the same error. To continue using CUDA, the process must be\n' + 'terminated and relaunched.\n' + ) + + + CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING = ( + cydriver.cudaError_enum.CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING, + 'This error indicates a kernel launch that uses an incompatible texturing\n' + 'mode.\n' + ) + + + CUDA_ERROR_PEER_ACCESS_ALREADY_ENABLED = ( + cydriver.cudaError_enum.CUDA_ERROR_PEER_ACCESS_ALREADY_ENABLED, + 'This error indicates that a call to :py:obj:`~.cuCtxEnablePeerAccess()` is\n' + 'trying to re-enable peer access to a context which has already had peer\n' + 'access to it enabled.\n' + ) + + + CUDA_ERROR_PEER_ACCESS_NOT_ENABLED = ( + cydriver.cudaError_enum.CUDA_ERROR_PEER_ACCESS_NOT_ENABLED, + 'This error indicates that :py:obj:`~.cuCtxDisablePeerAccess()` is trying to\n' + 'disable peer access which has not been enabled yet via\n' + ':py:obj:`~.cuCtxEnablePeerAccess()`.\n' + ) + + + CUDA_ERROR_PRIMARY_CONTEXT_ACTIVE = ( + cydriver.cudaError_enum.CUDA_ERROR_PRIMARY_CONTEXT_ACTIVE, + 'This error indicates that the primary context for the specified device has\n' + 'already been initialized.\n' + ) + + + CUDA_ERROR_CONTEXT_IS_DESTROYED = ( + cydriver.cudaError_enum.CUDA_ERROR_CONTEXT_IS_DESTROYED, + 'This error indicates that the context current to the calling thread has\n' + 'been destroyed using :py:obj:`~.cuCtxDestroy`, or is a primary context\n' + 'which has not yet been initialized.\n' + ) + + + CUDA_ERROR_ASSERT = ( + cydriver.cudaError_enum.CUDA_ERROR_ASSERT, + 'A device-side assert triggered during kernel execution. The context cannot\n' + 'be used anymore, and must be destroyed. All existing device memory\n' + 'allocations from this context are invalid and must be reconstructed if the\n' + 'program is to continue using CUDA.\n' + ) + + + CUDA_ERROR_TOO_MANY_PEERS = ( + cydriver.cudaError_enum.CUDA_ERROR_TOO_MANY_PEERS, + 'This error indicates that the hardware resources required to enable peer\n' + 'access have been exhausted for one or more of the devices passed to\n' + ':py:obj:`~.cuCtxEnablePeerAccess()`.\n' + ) + + + CUDA_ERROR_HOST_MEMORY_ALREADY_REGISTERED = ( + cydriver.cudaError_enum.CUDA_ERROR_HOST_MEMORY_ALREADY_REGISTERED, + 'This error indicates that the memory range passed to\n' + ':py:obj:`~.cuMemHostRegister()` has already been registered.\n' + ) + + + CUDA_ERROR_HOST_MEMORY_NOT_REGISTERED = ( + cydriver.cudaError_enum.CUDA_ERROR_HOST_MEMORY_NOT_REGISTERED, + 'This error indicates that the pointer passed to\n' + ':py:obj:`~.cuMemHostUnregister()` does not correspond to any currently\n' + 'registered memory region.\n' + ) + + + CUDA_ERROR_HARDWARE_STACK_ERROR = ( + cydriver.cudaError_enum.CUDA_ERROR_HARDWARE_STACK_ERROR, + 'While executing a kernel, the device encountered a stack error. This can be\n' + 'due to stack corruption or exceeding the stack size limit. This leaves the\n' + 'process in an inconsistent state and any further CUDA work will return the\n' + 'same error. To continue using CUDA, the process must be terminated and\n' + 'relaunched.\n' + ) + + + CUDA_ERROR_ILLEGAL_INSTRUCTION = ( + cydriver.cudaError_enum.CUDA_ERROR_ILLEGAL_INSTRUCTION, + 'While executing a kernel, the device encountered an illegal instruction.\n' + 'This leaves the process in an inconsistent state and any further CUDA work\n' + 'will return the same error. To continue using CUDA, the process must be\n' + 'terminated and relaunched.\n' + ) + + + CUDA_ERROR_MISALIGNED_ADDRESS = ( + cydriver.cudaError_enum.CUDA_ERROR_MISALIGNED_ADDRESS, + 'While executing a kernel, the device encountered a load or store\n' + 'instruction on a memory address which is not aligned. This leaves the\n' + 'process in an inconsistent state and any further CUDA work will return the\n' + 'same error. To continue using CUDA, the process must be terminated and\n' + 'relaunched.\n' + ) + + + CUDA_ERROR_INVALID_ADDRESS_SPACE = ( + cydriver.cudaError_enum.CUDA_ERROR_INVALID_ADDRESS_SPACE, + 'While executing a kernel, the device encountered an instruction which can\n' + 'only operate on memory locations in certain address spaces (global, shared,\n' + 'or local), but was supplied a memory address not belonging to an allowed\n' + 'address space. This leaves the process in an inconsistent state and any\n' + 'further CUDA work will return the same error. To continue using CUDA, the\n' + 'process must be terminated and relaunched.\n' + ) + + + CUDA_ERROR_INVALID_PC = ( + cydriver.cudaError_enum.CUDA_ERROR_INVALID_PC, + 'While executing a kernel, the device program counter wrapped its address\n' + 'space. This leaves the process in an inconsistent state and any further\n' + 'CUDA work will return the same error. To continue using CUDA, the process\n' + 'must be terminated and relaunched.\n' + ) + + + CUDA_ERROR_LAUNCH_FAILED = ( + cydriver.cudaError_enum.CUDA_ERROR_LAUNCH_FAILED, + 'An exception occurred on the device while executing a kernel. Common causes\n' + 'include dereferencing an invalid device pointer and accessing out of bounds\n' + 'shared memory. Less common cases can be system specific - more information\n' + 'about these cases can be found in the system specific user guide. This\n' + 'leaves the process in an inconsistent state and any further CUDA work will\n' + 'return the same error. To continue using CUDA, the process must be\n' + 'terminated and relaunched.\n' + ) + + + CUDA_ERROR_COOPERATIVE_LAUNCH_TOO_LARGE = ( + cydriver.cudaError_enum.CUDA_ERROR_COOPERATIVE_LAUNCH_TOO_LARGE, + 'This error indicates that the number of blocks launched per grid for a\n' + 'kernel that was launched via either :py:obj:`~.cuLaunchCooperativeKernel`\n' + 'or :py:obj:`~.cuLaunchCooperativeKernelMultiDevice` exceeds the maximum\n' + 'number of blocks as allowed by\n' + ':py:obj:`~.cuOccupancyMaxActiveBlocksPerMultiprocessor` or\n' + ':py:obj:`~.cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags` times the\n' + 'number of multiprocessors as specified by the device attribute\n' + ':py:obj:`~.CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT`.\n' + ) + + + CUDA_ERROR_TENSOR_MEMORY_LEAK = ( + cydriver.cudaError_enum.CUDA_ERROR_TENSOR_MEMORY_LEAK, + 'An exception occurred on the device while exiting a kernel using tensor\n' + 'memory: the tensor memory was not completely deallocated. This leaves the\n' + 'process in an inconsistent state and any further CUDA work will return the\n' + 'same error. To continue using CUDA, the process must be terminated and\n' + 'relaunched.\n' + ) + + + CUDA_ERROR_NOT_PERMITTED = ( + cydriver.cudaError_enum.CUDA_ERROR_NOT_PERMITTED, + 'This error indicates that the attempted operation is not permitted.\n' + ) + + + CUDA_ERROR_NOT_SUPPORTED = ( + cydriver.cudaError_enum.CUDA_ERROR_NOT_SUPPORTED, + 'This error indicates that the attempted operation is not supported on the\n' + 'current system or device.\n' + ) + + + CUDA_ERROR_SYSTEM_NOT_READY = ( + cydriver.cudaError_enum.CUDA_ERROR_SYSTEM_NOT_READY, + 'This error indicates that the system is not yet ready to start any CUDA\n' + 'work. To continue using CUDA, verify the system configuration is in a valid\n' + 'state and all required driver daemons are actively running. More\n' + 'information about this error can be found in the system specific user\n' + 'guide.\n' + ) + + + CUDA_ERROR_SYSTEM_DRIVER_MISMATCH = ( + cydriver.cudaError_enum.CUDA_ERROR_SYSTEM_DRIVER_MISMATCH, + 'This error indicates that there is a mismatch between the versions of the\n' + 'display driver and the CUDA driver. Refer to the compatibility\n' + 'documentation for supported versions.\n' + ) + + + CUDA_ERROR_COMPAT_NOT_SUPPORTED_ON_DEVICE = ( + cydriver.cudaError_enum.CUDA_ERROR_COMPAT_NOT_SUPPORTED_ON_DEVICE, + 'This error indicates that the system was upgraded to run with forward\n' + 'compatibility but the visible hardware detected by CUDA does not support\n' + 'this configuration. Refer to the compatibility documentation for the\n' + 'supported hardware matrix or ensure that only supported hardware is visible\n' + 'during initialization via the CUDA_VISIBLE_DEVICES environment variable.\n' + ) + + + CUDA_ERROR_MPS_CONNECTION_FAILED = ( + cydriver.cudaError_enum.CUDA_ERROR_MPS_CONNECTION_FAILED, + 'This error indicates that the MPS client failed to connect to the MPS\n' + 'control daemon or the MPS server.\n' + ) + + + CUDA_ERROR_MPS_RPC_FAILURE = ( + cydriver.cudaError_enum.CUDA_ERROR_MPS_RPC_FAILURE, + 'This error indicates that the remote procedural call between the MPS server\n' + 'and the MPS client failed.\n' + ) + + + CUDA_ERROR_MPS_SERVER_NOT_READY = ( + cydriver.cudaError_enum.CUDA_ERROR_MPS_SERVER_NOT_READY, + 'This error indicates that the MPS server is not ready to accept new MPS\n' + 'client requests. This error can be returned when the MPS server is in the\n' + 'process of recovering from a fatal failure.\n' + ) + + + CUDA_ERROR_MPS_MAX_CLIENTS_REACHED = ( + cydriver.cudaError_enum.CUDA_ERROR_MPS_MAX_CLIENTS_REACHED, + 'This error indicates that the hardware resources required to create MPS\n' + 'client have been exhausted.\n' + ) + + + CUDA_ERROR_MPS_MAX_CONNECTIONS_REACHED = ( + cydriver.cudaError_enum.CUDA_ERROR_MPS_MAX_CONNECTIONS_REACHED, + 'This error indicates the the hardware resources required to support device\n' + 'connections have been exhausted.\n' + ) + + + CUDA_ERROR_MPS_CLIENT_TERMINATED = ( + cydriver.cudaError_enum.CUDA_ERROR_MPS_CLIENT_TERMINATED, + 'This error indicates that the MPS client has been terminated by the server.\n' + 'To continue using CUDA, the process must be terminated and relaunched.\n' + ) + + + CUDA_ERROR_CDP_NOT_SUPPORTED = ( + cydriver.cudaError_enum.CUDA_ERROR_CDP_NOT_SUPPORTED, + 'This error indicates that the module is using CUDA Dynamic Parallelism, but\n' + 'the current configuration, like MPS, does not support it.\n' + ) + + + CUDA_ERROR_CDP_VERSION_MISMATCH = ( + cydriver.cudaError_enum.CUDA_ERROR_CDP_VERSION_MISMATCH, + 'This error indicates that a module contains an unsupported interaction\n' + 'between different versions of CUDA Dynamic Parallelism.\n' + ) + + + CUDA_ERROR_STREAM_CAPTURE_UNSUPPORTED = ( + cydriver.cudaError_enum.CUDA_ERROR_STREAM_CAPTURE_UNSUPPORTED, + 'This error indicates that the operation is not permitted when the stream is\n' + 'capturing.\n' + ) + + + CUDA_ERROR_STREAM_CAPTURE_INVALIDATED = ( + cydriver.cudaError_enum.CUDA_ERROR_STREAM_CAPTURE_INVALIDATED, + 'This error indicates that the current capture sequence on the stream has\n' + 'been invalidated due to a previous error.\n' + ) + + + CUDA_ERROR_STREAM_CAPTURE_MERGE = ( + cydriver.cudaError_enum.CUDA_ERROR_STREAM_CAPTURE_MERGE, + 'This error indicates that the operation would have resulted in a merge of\n' + 'two independent capture sequences.\n' + ) + + + CUDA_ERROR_STREAM_CAPTURE_UNMATCHED = ( + cydriver.cudaError_enum.CUDA_ERROR_STREAM_CAPTURE_UNMATCHED, + 'This error indicates that the capture was not initiated in this stream.\n' + ) + + + CUDA_ERROR_STREAM_CAPTURE_UNJOINED = ( + cydriver.cudaError_enum.CUDA_ERROR_STREAM_CAPTURE_UNJOINED, + 'This error indicates that the capture sequence contains a fork that was not\n' + 'joined to the primary stream.\n' + ) + + + CUDA_ERROR_STREAM_CAPTURE_ISOLATION = ( + cydriver.cudaError_enum.CUDA_ERROR_STREAM_CAPTURE_ISOLATION, + 'This error indicates that a dependency would have been created which\n' + 'crosses the capture sequence boundary. Only implicit in-stream ordering\n' + 'dependencies are allowed to cross the boundary.\n' + ) + + + CUDA_ERROR_STREAM_CAPTURE_IMPLICIT = ( + cydriver.cudaError_enum.CUDA_ERROR_STREAM_CAPTURE_IMPLICIT, + 'This error indicates a disallowed implicit dependency on a current capture\n' + 'sequence from cudaStreamLegacy.\n' + ) + + + CUDA_ERROR_CAPTURED_EVENT = ( + cydriver.cudaError_enum.CUDA_ERROR_CAPTURED_EVENT, + 'This error indicates that the operation is not permitted on an event which\n' + 'was last recorded in a capturing stream.\n' + ) + + + CUDA_ERROR_STREAM_CAPTURE_WRONG_THREAD = ( + cydriver.cudaError_enum.CUDA_ERROR_STREAM_CAPTURE_WRONG_THREAD, + 'A stream capture sequence not initiated with the\n' + ':py:obj:`~.CU_STREAM_CAPTURE_MODE_RELAXED` argument to\n' + ':py:obj:`~.cuStreamBeginCapture` was passed to\n' + ':py:obj:`~.cuStreamEndCapture` in a different thread.\n' + ) + + + CUDA_ERROR_TIMEOUT = ( + cydriver.cudaError_enum.CUDA_ERROR_TIMEOUT, + 'This error indicates that the timeout specified for the wait operation has\n' + 'lapsed.\n' + ) + + + CUDA_ERROR_GRAPH_EXEC_UPDATE_FAILURE = ( + cydriver.cudaError_enum.CUDA_ERROR_GRAPH_EXEC_UPDATE_FAILURE, + 'This error indicates that the graph update was not performed because it\n' + 'included changes which violated constraints specific to instantiated graph\n' + 'update.\n' + ) + + + CUDA_ERROR_EXTERNAL_DEVICE = ( + cydriver.cudaError_enum.CUDA_ERROR_EXTERNAL_DEVICE, + 'This indicates that an error has occurred in a device outside of GPU. It\n' + 'can be a synchronous error w.r.t. CUDA API or an asynchronous error from\n' + 'the external device. In case of asynchronous error, it means that if cuda\n' + "was waiting for an external device's signal before consuming shared data,\n" + 'the external device signaled an error indicating that the data is not valid\n' + 'for consumption. This leaves the process in an inconsistent state and any\n' + 'further CUDA work will return the same error. To continue using CUDA, the\n' + 'process must be terminated and relaunched. In case of synchronous error, it\n' + 'means that one or more external devices have encountered an error and\n' + 'cannot complete the operation.\n' + ) + + + CUDA_ERROR_INVALID_CLUSTER_SIZE = ( + cydriver.cudaError_enum.CUDA_ERROR_INVALID_CLUSTER_SIZE, + 'Indicates a kernel launch error due to cluster misconfiguration.\n' + ) + + + CUDA_ERROR_FUNCTION_NOT_LOADED = ( + cydriver.cudaError_enum.CUDA_ERROR_FUNCTION_NOT_LOADED, + 'Indiciates a function handle is not loaded when calling an API that\n' + 'requires a loaded function.\n' + ) + + + CUDA_ERROR_INVALID_RESOURCE_TYPE = ( + cydriver.cudaError_enum.CUDA_ERROR_INVALID_RESOURCE_TYPE, + 'This error indicates one or more resources passed in are not valid resource\n' + 'types for the operation.\n' + ) + + + CUDA_ERROR_INVALID_RESOURCE_CONFIGURATION = ( + cydriver.cudaError_enum.CUDA_ERROR_INVALID_RESOURCE_CONFIGURATION, + 'This error indicates one or more resources are insufficient or non-\n' + 'applicable for the operation.\n' + ) + + + CUDA_ERROR_KEY_ROTATION = ( + cydriver.cudaError_enum.CUDA_ERROR_KEY_ROTATION, + 'This error indicates that an error happened during the key rotation\n' + 'sequence.\n' + ) + + + CUDA_ERROR_STREAM_DETACHED = ( + cydriver.cudaError_enum.CUDA_ERROR_STREAM_DETACHED, + 'This error indicates that the requested operation is not permitted because\n' + 'the stream is in a detached state. This can occur if the green context\n' + "associated with the stream has been destroyed, limiting the stream's\n" + 'operational capabilities.\n' + ) + + + CUDA_ERROR_GRAPH_RECAPTURE_FAILURE = ( + cydriver.cudaError_enum.CUDA_ERROR_GRAPH_RECAPTURE_FAILURE, + 'This error indicates that a graph recapture failed and had to be\n' + 'terminated.\n' + ) + + + CUDA_ERROR_UNKNOWN = ( + cydriver.cudaError_enum.CUDA_ERROR_UNKNOWN, + 'This indicates that an unknown internal error has occurred.\n' + ) + +class CUdevice_P2PAttribute(_FastEnum): + """ + P2P Attributes + """ + + + CU_DEVICE_P2P_ATTRIBUTE_PERFORMANCE_RANK = ( + cydriver.CUdevice_P2PAttribute_enum.CU_DEVICE_P2P_ATTRIBUTE_PERFORMANCE_RANK, + 'A relative value indicating the performance of the link between two devices\n' + ) + + + CU_DEVICE_P2P_ATTRIBUTE_ACCESS_SUPPORTED = ( + cydriver.CUdevice_P2PAttribute_enum.CU_DEVICE_P2P_ATTRIBUTE_ACCESS_SUPPORTED, + 'P2P Access is enable\n' + ) + + + CU_DEVICE_P2P_ATTRIBUTE_NATIVE_ATOMIC_SUPPORTED = ( + cydriver.CUdevice_P2PAttribute_enum.CU_DEVICE_P2P_ATTRIBUTE_NATIVE_ATOMIC_SUPPORTED, + 'All CUDA-valid atomic operation over the link are supported\n' + ) + + + CU_DEVICE_P2P_ATTRIBUTE_ACCESS_ACCESS_SUPPORTED = ( + cydriver.CUdevice_P2PAttribute_enum.CU_DEVICE_P2P_ATTRIBUTE_ACCESS_ACCESS_SUPPORTED, + '[Deprecated]\n' + ) + + + CU_DEVICE_P2P_ATTRIBUTE_CUDA_ARRAY_ACCESS_SUPPORTED = ( + cydriver.CUdevice_P2PAttribute_enum.CU_DEVICE_P2P_ATTRIBUTE_CUDA_ARRAY_ACCESS_SUPPORTED, + 'Accessing CUDA arrays over the link supported\n' + ) + + + CU_DEVICE_P2P_ATTRIBUTE_ONLY_PARTIAL_NATIVE_ATOMIC_SUPPORTED = ( + cydriver.CUdevice_P2PAttribute_enum.CU_DEVICE_P2P_ATTRIBUTE_ONLY_PARTIAL_NATIVE_ATOMIC_SUPPORTED, + 'Only some CUDA-valid atomic operations over the link are supported.\n' + ) + +class CUresourceViewFormat(_FastEnum): + """ + Resource view format + """ + + + CU_RES_VIEW_FORMAT_NONE = ( + cydriver.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_NONE, + 'No resource view format (use underlying resource format)\n' + ) + + + CU_RES_VIEW_FORMAT_UINT_1X8 = ( + cydriver.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_UINT_1X8, + '1 channel unsigned 8-bit integers\n' + ) + + + CU_RES_VIEW_FORMAT_UINT_2X8 = ( + cydriver.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_UINT_2X8, + '2 channel unsigned 8-bit integers\n' + ) + + + CU_RES_VIEW_FORMAT_UINT_4X8 = ( + cydriver.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_UINT_4X8, + '4 channel unsigned 8-bit integers\n' + ) + + + CU_RES_VIEW_FORMAT_SINT_1X8 = ( + cydriver.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_SINT_1X8, + '1 channel signed 8-bit integers\n' + ) + + + CU_RES_VIEW_FORMAT_SINT_2X8 = ( + cydriver.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_SINT_2X8, + '2 channel signed 8-bit integers\n' + ) + + + CU_RES_VIEW_FORMAT_SINT_4X8 = ( + cydriver.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_SINT_4X8, + '4 channel signed 8-bit integers\n' + ) + + + CU_RES_VIEW_FORMAT_UINT_1X16 = ( + cydriver.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_UINT_1X16, + '1 channel unsigned 16-bit integers\n' + ) + + + CU_RES_VIEW_FORMAT_UINT_2X16 = ( + cydriver.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_UINT_2X16, + '2 channel unsigned 16-bit integers\n' + ) + + + CU_RES_VIEW_FORMAT_UINT_4X16 = ( + cydriver.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_UINT_4X16, + '4 channel unsigned 16-bit integers\n' + ) + + + CU_RES_VIEW_FORMAT_SINT_1X16 = ( + cydriver.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_SINT_1X16, + '1 channel signed 16-bit integers\n' + ) + + + CU_RES_VIEW_FORMAT_SINT_2X16 = ( + cydriver.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_SINT_2X16, + '2 channel signed 16-bit integers\n' + ) + + + CU_RES_VIEW_FORMAT_SINT_4X16 = ( + cydriver.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_SINT_4X16, + '4 channel signed 16-bit integers\n' + ) + + + CU_RES_VIEW_FORMAT_UINT_1X32 = ( + cydriver.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_UINT_1X32, + '1 channel unsigned 32-bit integers\n' + ) + + + CU_RES_VIEW_FORMAT_UINT_2X32 = ( + cydriver.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_UINT_2X32, + '2 channel unsigned 32-bit integers\n' + ) + + + CU_RES_VIEW_FORMAT_UINT_4X32 = ( + cydriver.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_UINT_4X32, + '4 channel unsigned 32-bit integers\n' + ) + + + CU_RES_VIEW_FORMAT_SINT_1X32 = ( + cydriver.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_SINT_1X32, + '1 channel signed 32-bit integers\n' + ) + + + CU_RES_VIEW_FORMAT_SINT_2X32 = ( + cydriver.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_SINT_2X32, + '2 channel signed 32-bit integers\n' + ) + + + CU_RES_VIEW_FORMAT_SINT_4X32 = ( + cydriver.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_SINT_4X32, + '4 channel signed 32-bit integers\n' + ) + + + CU_RES_VIEW_FORMAT_FLOAT_1X16 = ( + cydriver.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_FLOAT_1X16, + '1 channel 16-bit floating point\n' + ) + + + CU_RES_VIEW_FORMAT_FLOAT_2X16 = ( + cydriver.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_FLOAT_2X16, + '2 channel 16-bit floating point\n' + ) + + + CU_RES_VIEW_FORMAT_FLOAT_4X16 = ( + cydriver.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_FLOAT_4X16, + '4 channel 16-bit floating point\n' + ) + + + CU_RES_VIEW_FORMAT_FLOAT_1X32 = ( + cydriver.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_FLOAT_1X32, + '1 channel 32-bit floating point\n' + ) + + + CU_RES_VIEW_FORMAT_FLOAT_2X32 = ( + cydriver.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_FLOAT_2X32, + '2 channel 32-bit floating point\n' + ) + + + CU_RES_VIEW_FORMAT_FLOAT_4X32 = ( + cydriver.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_FLOAT_4X32, + '4 channel 32-bit floating point\n' + ) + + + CU_RES_VIEW_FORMAT_UNSIGNED_BC1 = ( + cydriver.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_UNSIGNED_BC1, + 'Block compressed 1\n' + ) + + + CU_RES_VIEW_FORMAT_UNSIGNED_BC2 = ( + cydriver.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_UNSIGNED_BC2, + 'Block compressed 2\n' + ) + + + CU_RES_VIEW_FORMAT_UNSIGNED_BC3 = ( + cydriver.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_UNSIGNED_BC3, + 'Block compressed 3\n' + ) + + + CU_RES_VIEW_FORMAT_UNSIGNED_BC4 = ( + cydriver.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_UNSIGNED_BC4, + 'Block compressed 4 unsigned\n' + ) + + + CU_RES_VIEW_FORMAT_SIGNED_BC4 = ( + cydriver.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_SIGNED_BC4, + 'Block compressed 4 signed\n' + ) + + + CU_RES_VIEW_FORMAT_UNSIGNED_BC5 = ( + cydriver.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_UNSIGNED_BC5, + 'Block compressed 5 unsigned\n' + ) + + + CU_RES_VIEW_FORMAT_SIGNED_BC5 = ( + cydriver.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_SIGNED_BC5, + 'Block compressed 5 signed\n' + ) + + + CU_RES_VIEW_FORMAT_UNSIGNED_BC6H = ( + cydriver.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_UNSIGNED_BC6H, + 'Block compressed 6 unsigned half-float\n' + ) + + + CU_RES_VIEW_FORMAT_SIGNED_BC6H = ( + cydriver.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_SIGNED_BC6H, + 'Block compressed 6 signed half-float\n' + ) + + + CU_RES_VIEW_FORMAT_UNSIGNED_BC7 = ( + cydriver.CUresourceViewFormat_enum.CU_RES_VIEW_FORMAT_UNSIGNED_BC7, + 'Block compressed 7\n' + ) + +class CUtensorMapDataType(_FastEnum): + """ + Tensor map data type + """ + + CU_TENSOR_MAP_DATA_TYPE_UINT8 = cydriver.CUtensorMapDataType_enum.CU_TENSOR_MAP_DATA_TYPE_UINT8 + + CU_TENSOR_MAP_DATA_TYPE_UINT16 = cydriver.CUtensorMapDataType_enum.CU_TENSOR_MAP_DATA_TYPE_UINT16 + + CU_TENSOR_MAP_DATA_TYPE_UINT32 = cydriver.CUtensorMapDataType_enum.CU_TENSOR_MAP_DATA_TYPE_UINT32 + + CU_TENSOR_MAP_DATA_TYPE_INT32 = cydriver.CUtensorMapDataType_enum.CU_TENSOR_MAP_DATA_TYPE_INT32 + + CU_TENSOR_MAP_DATA_TYPE_UINT64 = cydriver.CUtensorMapDataType_enum.CU_TENSOR_MAP_DATA_TYPE_UINT64 + + CU_TENSOR_MAP_DATA_TYPE_INT64 = cydriver.CUtensorMapDataType_enum.CU_TENSOR_MAP_DATA_TYPE_INT64 + + CU_TENSOR_MAP_DATA_TYPE_FLOAT16 = cydriver.CUtensorMapDataType_enum.CU_TENSOR_MAP_DATA_TYPE_FLOAT16 + + CU_TENSOR_MAP_DATA_TYPE_FLOAT32 = cydriver.CUtensorMapDataType_enum.CU_TENSOR_MAP_DATA_TYPE_FLOAT32 + + CU_TENSOR_MAP_DATA_TYPE_FLOAT64 = cydriver.CUtensorMapDataType_enum.CU_TENSOR_MAP_DATA_TYPE_FLOAT64 + + CU_TENSOR_MAP_DATA_TYPE_BFLOAT16 = cydriver.CUtensorMapDataType_enum.CU_TENSOR_MAP_DATA_TYPE_BFLOAT16 + + CU_TENSOR_MAP_DATA_TYPE_FLOAT32_FTZ = cydriver.CUtensorMapDataType_enum.CU_TENSOR_MAP_DATA_TYPE_FLOAT32_FTZ + + CU_TENSOR_MAP_DATA_TYPE_TFLOAT32 = cydriver.CUtensorMapDataType_enum.CU_TENSOR_MAP_DATA_TYPE_TFLOAT32 + + CU_TENSOR_MAP_DATA_TYPE_TFLOAT32_FTZ = cydriver.CUtensorMapDataType_enum.CU_TENSOR_MAP_DATA_TYPE_TFLOAT32_FTZ + + CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN8B = cydriver.CUtensorMapDataType_enum.CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN8B + + CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN16B = cydriver.CUtensorMapDataType_enum.CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN16B + + CU_TENSOR_MAP_DATA_TYPE_16U6_ALIGN16B = cydriver.CUtensorMapDataType_enum.CU_TENSOR_MAP_DATA_TYPE_16U6_ALIGN16B + +class CUtensorMapInterleave(_FastEnum): + """ + Tensor map interleave layout type + """ + + CU_TENSOR_MAP_INTERLEAVE_NONE = cydriver.CUtensorMapInterleave_enum.CU_TENSOR_MAP_INTERLEAVE_NONE + + CU_TENSOR_MAP_INTERLEAVE_16B = cydriver.CUtensorMapInterleave_enum.CU_TENSOR_MAP_INTERLEAVE_16B + + CU_TENSOR_MAP_INTERLEAVE_32B = cydriver.CUtensorMapInterleave_enum.CU_TENSOR_MAP_INTERLEAVE_32B + +class CUtensorMapSwizzle(_FastEnum): + """ + Tensor map swizzling mode of shared memory banks + """ + + CU_TENSOR_MAP_SWIZZLE_NONE = cydriver.CUtensorMapSwizzle_enum.CU_TENSOR_MAP_SWIZZLE_NONE + + CU_TENSOR_MAP_SWIZZLE_32B = cydriver.CUtensorMapSwizzle_enum.CU_TENSOR_MAP_SWIZZLE_32B + + CU_TENSOR_MAP_SWIZZLE_64B = cydriver.CUtensorMapSwizzle_enum.CU_TENSOR_MAP_SWIZZLE_64B + + CU_TENSOR_MAP_SWIZZLE_128B = cydriver.CUtensorMapSwizzle_enum.CU_TENSOR_MAP_SWIZZLE_128B + + CU_TENSOR_MAP_SWIZZLE_128B_ATOM_32B = cydriver.CUtensorMapSwizzle_enum.CU_TENSOR_MAP_SWIZZLE_128B_ATOM_32B + + CU_TENSOR_MAP_SWIZZLE_128B_ATOM_32B_FLIP_8B = cydriver.CUtensorMapSwizzle_enum.CU_TENSOR_MAP_SWIZZLE_128B_ATOM_32B_FLIP_8B + + CU_TENSOR_MAP_SWIZZLE_128B_ATOM_64B = cydriver.CUtensorMapSwizzle_enum.CU_TENSOR_MAP_SWIZZLE_128B_ATOM_64B + +class CUtensorMapL2promotion(_FastEnum): + """ + Tensor map L2 promotion type + """ + + CU_TENSOR_MAP_L2_PROMOTION_NONE = cydriver.CUtensorMapL2promotion_enum.CU_TENSOR_MAP_L2_PROMOTION_NONE + + CU_TENSOR_MAP_L2_PROMOTION_L2_64B = cydriver.CUtensorMapL2promotion_enum.CU_TENSOR_MAP_L2_PROMOTION_L2_64B + + CU_TENSOR_MAP_L2_PROMOTION_L2_128B = cydriver.CUtensorMapL2promotion_enum.CU_TENSOR_MAP_L2_PROMOTION_L2_128B + + CU_TENSOR_MAP_L2_PROMOTION_L2_256B = cydriver.CUtensorMapL2promotion_enum.CU_TENSOR_MAP_L2_PROMOTION_L2_256B + +class CUtensorMapFloatOOBfill(_FastEnum): + """ + Tensor map out-of-bounds fill type + """ + + CU_TENSOR_MAP_FLOAT_OOB_FILL_NONE = cydriver.CUtensorMapFloatOOBfill_enum.CU_TENSOR_MAP_FLOAT_OOB_FILL_NONE + + CU_TENSOR_MAP_FLOAT_OOB_FILL_NAN_REQUEST_ZERO_FMA = cydriver.CUtensorMapFloatOOBfill_enum.CU_TENSOR_MAP_FLOAT_OOB_FILL_NAN_REQUEST_ZERO_FMA + +class CUtensorMapIm2ColWideMode(_FastEnum): + """ + Tensor map Im2Col wide mode + """ + + CU_TENSOR_MAP_IM2COL_WIDE_MODE_W = cydriver.CUtensorMapIm2ColWideMode_enum.CU_TENSOR_MAP_IM2COL_WIDE_MODE_W + + CU_TENSOR_MAP_IM2COL_WIDE_MODE_W128 = cydriver.CUtensorMapIm2ColWideMode_enum.CU_TENSOR_MAP_IM2COL_WIDE_MODE_W128 + +class CUDA_POINTER_ATTRIBUTE_ACCESS_FLAGS(_FastEnum): + """ + Access flags that specify the level of access the current context's + device has on the memory referenced. + """ + + + CU_POINTER_ATTRIBUTE_ACCESS_FLAG_NONE = ( + cydriver.CUDA_POINTER_ATTRIBUTE_ACCESS_FLAGS_enum.CU_POINTER_ATTRIBUTE_ACCESS_FLAG_NONE, + 'No access, meaning the device cannot access this memory at all, thus must\n' + 'be staged through accessible memory in order to complete certain operations\n' + ) + + + CU_POINTER_ATTRIBUTE_ACCESS_FLAG_READ = ( + cydriver.CUDA_POINTER_ATTRIBUTE_ACCESS_FLAGS_enum.CU_POINTER_ATTRIBUTE_ACCESS_FLAG_READ, + 'Read-only access, meaning writes to this memory are considered invalid\n' + 'accesses and thus return error in that case.\n' + ) + + + CU_POINTER_ATTRIBUTE_ACCESS_FLAG_READWRITE = ( + cydriver.CUDA_POINTER_ATTRIBUTE_ACCESS_FLAGS_enum.CU_POINTER_ATTRIBUTE_ACCESS_FLAG_READWRITE, + 'Read-write access, the device has full read-write access to the memory\n' + ) + +class CUexternalMemoryHandleType(_FastEnum): + """ + External memory handle types + """ + + + CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD = ( + cydriver.CUexternalMemoryHandleType_enum.CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD, + 'Handle is an opaque file descriptor\n' + ) + + + CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32 = ( + cydriver.CUexternalMemoryHandleType_enum.CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32, + 'Handle is an opaque shared NT handle\n' + ) + + + CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT = ( + cydriver.CUexternalMemoryHandleType_enum.CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT, + 'Handle is an opaque, globally shared handle\n' + ) + + + CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP = ( + cydriver.CUexternalMemoryHandleType_enum.CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP, + 'Handle is a D3D12 heap object\n' + ) + + + CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE = ( + cydriver.CUexternalMemoryHandleType_enum.CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE, + 'Handle is a D3D12 committed resource\n' + ) + + + CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE = ( + cydriver.CUexternalMemoryHandleType_enum.CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE, + 'Handle is a shared NT handle to a D3D11 resource\n' + ) + + + CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE_KMT = ( + cydriver.CUexternalMemoryHandleType_enum.CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE_KMT, + 'Handle is a globally shared handle to a D3D11 resource\n' + ) + + + CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF = ( + cydriver.CUexternalMemoryHandleType_enum.CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF, + 'Handle is an NvSciBuf object\n' + ) + + + CU_EXTERNAL_MEMORY_HANDLE_TYPE_DMABUF_FD = ( + cydriver.CUexternalMemoryHandleType_enum.CU_EXTERNAL_MEMORY_HANDLE_TYPE_DMABUF_FD, + 'Handle is a dma_buf file descriptor\n' + ) + +class CUexternalSemaphoreHandleType(_FastEnum): + """ + External semaphore handle types + """ + + + CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD = ( + cydriver.CUexternalSemaphoreHandleType_enum.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD, + 'Handle is an opaque file descriptor\n' + ) + + + CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32 = ( + cydriver.CUexternalSemaphoreHandleType_enum.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32, + 'Handle is an opaque shared NT handle\n' + ) + + + CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT = ( + cydriver.CUexternalSemaphoreHandleType_enum.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT, + 'Handle is an opaque, globally shared handle\n' + ) + + + CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE = ( + cydriver.CUexternalSemaphoreHandleType_enum.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE, + 'Handle is a shared NT handle referencing a D3D12 fence object\n' + ) + + + CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_FENCE = ( + cydriver.CUexternalSemaphoreHandleType_enum.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_FENCE, + 'Handle is a shared NT handle referencing a D3D11 fence object\n' + ) + + + CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC = ( + cydriver.CUexternalSemaphoreHandleType_enum.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC, + 'Opaque handle to NvSciSync Object\n' + ) + + + CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX = ( + cydriver.CUexternalSemaphoreHandleType_enum.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX, + 'Handle is a shared NT handle referencing a D3D11 keyed mutex object\n' + ) + + + CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX_KMT = ( + cydriver.CUexternalSemaphoreHandleType_enum.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX_KMT, + 'Handle is a globally shared handle referencing a D3D11 keyed mutex object\n' + ) + + + CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_FD = ( + cydriver.CUexternalSemaphoreHandleType_enum.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_FD, + 'Handle is an opaque file descriptor referencing a timeline semaphore\n' + ) + + + CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_WIN32 = ( + cydriver.CUexternalSemaphoreHandleType_enum.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_WIN32, + 'Handle is an opaque shared NT handle referencing a timeline semaphore\n' + ) + +class CUmemAllocationHandleType(_FastEnum): + """ + Flags for specifying particular handle types + """ + + + CU_MEM_HANDLE_TYPE_NONE = ( + cydriver.CUmemAllocationHandleType_enum.CU_MEM_HANDLE_TYPE_NONE, + 'Does not allow any export mechanism. >\n' + ) + + + CU_MEM_HANDLE_TYPE_POSIX_FILE_DESCRIPTOR = ( + cydriver.CUmemAllocationHandleType_enum.CU_MEM_HANDLE_TYPE_POSIX_FILE_DESCRIPTOR, + 'Allows a file descriptor to be used for exporting. Permitted only on POSIX\n' + 'systems. (int)\n' + ) + + + CU_MEM_HANDLE_TYPE_WIN32 = ( + cydriver.CUmemAllocationHandleType_enum.CU_MEM_HANDLE_TYPE_WIN32, + 'Allows a Win32 NT handle to be used for exporting. (HANDLE)\n' + ) + + + CU_MEM_HANDLE_TYPE_WIN32_KMT = ( + cydriver.CUmemAllocationHandleType_enum.CU_MEM_HANDLE_TYPE_WIN32_KMT, + 'Allows a Win32 KMT handle to be used for exporting. (D3DKMT_HANDLE)\n' + ) + + + CU_MEM_HANDLE_TYPE_FABRIC = ( + cydriver.CUmemAllocationHandleType_enum.CU_MEM_HANDLE_TYPE_FABRIC, + 'Allows a fabric handle to be used for exporting.\n' + '(:py:obj:`~.CUmemFabricHandle`)\n' + ) + + CU_MEM_HANDLE_TYPE_MAX = cydriver.CUmemAllocationHandleType_enum.CU_MEM_HANDLE_TYPE_MAX + +class CUmemAccess_flags(_FastEnum): + """ + Specifies the memory protection flags for mapping. + """ + + + CU_MEM_ACCESS_FLAGS_PROT_NONE = ( + cydriver.CUmemAccess_flags_enum.CU_MEM_ACCESS_FLAGS_PROT_NONE, + 'Default, make the address range not accessible\n' + ) + + + CU_MEM_ACCESS_FLAGS_PROT_READ = ( + cydriver.CUmemAccess_flags_enum.CU_MEM_ACCESS_FLAGS_PROT_READ, + 'Make the address range read accessible\n' + ) + + + CU_MEM_ACCESS_FLAGS_PROT_READWRITE = ( + cydriver.CUmemAccess_flags_enum.CU_MEM_ACCESS_FLAGS_PROT_READWRITE, + 'Make the address range read-write accessible\n' + ) + + CU_MEM_ACCESS_FLAGS_PROT_MAX = cydriver.CUmemAccess_flags_enum.CU_MEM_ACCESS_FLAGS_PROT_MAX + +class CUmemLocationType(_FastEnum): + """ + Specifies the type of location + """ + + CU_MEM_LOCATION_TYPE_INVALID = cydriver.CUmemLocationType_enum.CU_MEM_LOCATION_TYPE_INVALID + + + CU_MEM_LOCATION_TYPE_NONE = ( + cydriver.CUmemLocationType_enum.CU_MEM_LOCATION_TYPE_NONE, + 'Location is unspecified. This is used when creating a managed memory pool\n' + 'to indicate no preferred location for the pool\n' + ) + + + CU_MEM_LOCATION_TYPE_DEVICE = ( + cydriver.CUmemLocationType_enum.CU_MEM_LOCATION_TYPE_DEVICE, + 'Location is a device location, thus id is a device ordinal\n' + ) + + + CU_MEM_LOCATION_TYPE_HOST = ( + cydriver.CUmemLocationType_enum.CU_MEM_LOCATION_TYPE_HOST, + 'Location is host, id is ignored\n' + ) + + + CU_MEM_LOCATION_TYPE_HOST_NUMA = ( + cydriver.CUmemLocationType_enum.CU_MEM_LOCATION_TYPE_HOST_NUMA, + 'Location is a host NUMA node, thus id is a host NUMA node id\n' + ) + + + CU_MEM_LOCATION_TYPE_HOST_NUMA_CURRENT = ( + cydriver.CUmemLocationType_enum.CU_MEM_LOCATION_TYPE_HOST_NUMA_CURRENT, + 'Location is a host NUMA node of the current thread, id is ignored\n' + ) + + + CU_MEM_LOCATION_TYPE_INVISIBLE = ( + cydriver.CUmemLocationType_enum.CU_MEM_LOCATION_TYPE_INVISIBLE, + 'Location is not visible but device is accessible, id is always\n' + 'CU_DEVICE_INVALID\n' + ) + + CU_MEM_LOCATION_TYPE_MAX = cydriver.CUmemLocationType_enum.CU_MEM_LOCATION_TYPE_MAX + +class CUmemAllocationType(_FastEnum): + """ + Defines the allocation types available + """ + + CU_MEM_ALLOCATION_TYPE_INVALID = cydriver.CUmemAllocationType_enum.CU_MEM_ALLOCATION_TYPE_INVALID + + + CU_MEM_ALLOCATION_TYPE_PINNED = ( + cydriver.CUmemAllocationType_enum.CU_MEM_ALLOCATION_TYPE_PINNED, + "This allocation type is 'pinned', i.e. cannot migrate from its current\n" + 'location while the application is actively using it\n' + ) + + + CU_MEM_ALLOCATION_TYPE_MANAGED = ( + cydriver.CUmemAllocationType_enum.CU_MEM_ALLOCATION_TYPE_MANAGED, + 'This allocation type is managed memory\n' + ) + + CU_MEM_ALLOCATION_TYPE_MAX = cydriver.CUmemAllocationType_enum.CU_MEM_ALLOCATION_TYPE_MAX + +class CUmemAllocationGranularity_flags(_FastEnum): + """ + Flag for requesting different optimal and required granularities + for an allocation. + """ + + + CU_MEM_ALLOC_GRANULARITY_MINIMUM = ( + cydriver.CUmemAllocationGranularity_flags_enum.CU_MEM_ALLOC_GRANULARITY_MINIMUM, + 'Minimum required granularity for allocation\n' + ) + + + CU_MEM_ALLOC_GRANULARITY_RECOMMENDED = ( + cydriver.CUmemAllocationGranularity_flags_enum.CU_MEM_ALLOC_GRANULARITY_RECOMMENDED, + 'Recommended granularity for allocation for best performance\n' + ) + +class CUmemRangeHandleType(_FastEnum): + """ + Specifies the handle type for address range + """ + + CU_MEM_RANGE_HANDLE_TYPE_DMA_BUF_FD = cydriver.CUmemRangeHandleType_enum.CU_MEM_RANGE_HANDLE_TYPE_DMA_BUF_FD + + CU_MEM_RANGE_HANDLE_TYPE_MAX = cydriver.CUmemRangeHandleType_enum.CU_MEM_RANGE_HANDLE_TYPE_MAX + +class CUmemRangeFlags(_FastEnum): + """ + Flag for requesting handle type for address range. + """ + + + CU_MEM_RANGE_FLAG_DMA_BUF_MAPPING_TYPE_PCIE = ( + cydriver.CUmemRangeFlags_enum.CU_MEM_RANGE_FLAG_DMA_BUF_MAPPING_TYPE_PCIE, + 'Indicates that DMA_BUF handle should be mapped via PCIe BAR1\n' + ) + +class CUarraySparseSubresourceType(_FastEnum): + """ + Sparse subresource types + """ + + CU_ARRAY_SPARSE_SUBRESOURCE_TYPE_SPARSE_LEVEL = cydriver.CUarraySparseSubresourceType_enum.CU_ARRAY_SPARSE_SUBRESOURCE_TYPE_SPARSE_LEVEL + + CU_ARRAY_SPARSE_SUBRESOURCE_TYPE_MIPTAIL = cydriver.CUarraySparseSubresourceType_enum.CU_ARRAY_SPARSE_SUBRESOURCE_TYPE_MIPTAIL + +class CUmemOperationType(_FastEnum): + """ + Memory operation types + """ + + CU_MEM_OPERATION_TYPE_MAP = cydriver.CUmemOperationType_enum.CU_MEM_OPERATION_TYPE_MAP + + CU_MEM_OPERATION_TYPE_UNMAP = cydriver.CUmemOperationType_enum.CU_MEM_OPERATION_TYPE_UNMAP + +class CUmemHandleType(_FastEnum): + """ + Memory handle types + """ + + CU_MEM_HANDLE_TYPE_GENERIC = cydriver.CUmemHandleType_enum.CU_MEM_HANDLE_TYPE_GENERIC + +class CUmemAllocationCompType(_FastEnum): + """ + Specifies compression attribute for an allocation. + """ + + + CU_MEM_ALLOCATION_COMP_NONE = ( + cydriver.CUmemAllocationCompType_enum.CU_MEM_ALLOCATION_COMP_NONE, + 'Allocating non-compressible memory\n' + ) + + + CU_MEM_ALLOCATION_COMP_GENERIC = ( + cydriver.CUmemAllocationCompType_enum.CU_MEM_ALLOCATION_COMP_GENERIC, + 'Allocating compressible memory\n' + ) + +class CUmulticastGranularity_flags(_FastEnum): + """ + Flags for querying different granularities for a multicast object + """ + + + CU_MULTICAST_GRANULARITY_MINIMUM = ( + cydriver.CUmulticastGranularity_flags_enum.CU_MULTICAST_GRANULARITY_MINIMUM, + 'Minimum required granularity\n' + ) + + + CU_MULTICAST_GRANULARITY_RECOMMENDED = ( + cydriver.CUmulticastGranularity_flags_enum.CU_MULTICAST_GRANULARITY_RECOMMENDED, + 'Recommended granularity for best performance\n' + ) + +class CUgraphExecUpdateResult(_FastEnum): + """ + CUDA Graph Update error types + """ + + + CU_GRAPH_EXEC_UPDATE_SUCCESS = ( + cydriver.CUgraphExecUpdateResult_enum.CU_GRAPH_EXEC_UPDATE_SUCCESS, + 'The update succeeded\n' + ) + + + CU_GRAPH_EXEC_UPDATE_ERROR = ( + cydriver.CUgraphExecUpdateResult_enum.CU_GRAPH_EXEC_UPDATE_ERROR, + 'The update failed for an unexpected reason which is described in the return\n' + 'value of the function\n' + ) + + + CU_GRAPH_EXEC_UPDATE_ERROR_TOPOLOGY_CHANGED = ( + cydriver.CUgraphExecUpdateResult_enum.CU_GRAPH_EXEC_UPDATE_ERROR_TOPOLOGY_CHANGED, + 'The update failed because the topology changed\n' + ) + + + CU_GRAPH_EXEC_UPDATE_ERROR_NODE_TYPE_CHANGED = ( + cydriver.CUgraphExecUpdateResult_enum.CU_GRAPH_EXEC_UPDATE_ERROR_NODE_TYPE_CHANGED, + 'The update failed because a node type changed\n' + ) + + + CU_GRAPH_EXEC_UPDATE_ERROR_FUNCTION_CHANGED = ( + cydriver.CUgraphExecUpdateResult_enum.CU_GRAPH_EXEC_UPDATE_ERROR_FUNCTION_CHANGED, + 'The update failed because the function of a kernel node changed (CUDA\n' + 'driver < 11.2)\n' + ) + + + CU_GRAPH_EXEC_UPDATE_ERROR_PARAMETERS_CHANGED = ( + cydriver.CUgraphExecUpdateResult_enum.CU_GRAPH_EXEC_UPDATE_ERROR_PARAMETERS_CHANGED, + 'The update failed because the parameters changed in a way that is not\n' + 'supported\n' + ) + + + CU_GRAPH_EXEC_UPDATE_ERROR_NOT_SUPPORTED = ( + cydriver.CUgraphExecUpdateResult_enum.CU_GRAPH_EXEC_UPDATE_ERROR_NOT_SUPPORTED, + 'The update failed because something about the node is not supported\n' + ) + + + CU_GRAPH_EXEC_UPDATE_ERROR_UNSUPPORTED_FUNCTION_CHANGE = ( + cydriver.CUgraphExecUpdateResult_enum.CU_GRAPH_EXEC_UPDATE_ERROR_UNSUPPORTED_FUNCTION_CHANGE, + 'The update failed because the function of a kernel node changed in an\n' + 'unsupported way\n' + ) + + + CU_GRAPH_EXEC_UPDATE_ERROR_ATTRIBUTES_CHANGED = ( + cydriver.CUgraphExecUpdateResult_enum.CU_GRAPH_EXEC_UPDATE_ERROR_ATTRIBUTES_CHANGED, + 'The update failed because the node attributes changed in a way that is not\n' + 'supported\n' + ) + +class CUmemPool_attribute(_FastEnum): + """ + CUDA memory pool attributes + """ + + + CU_MEMPOOL_ATTR_REUSE_FOLLOW_EVENT_DEPENDENCIES = ( + cydriver.CUmemPool_attribute_enum.CU_MEMPOOL_ATTR_REUSE_FOLLOW_EVENT_DEPENDENCIES, + '(value type = int) Allow cuMemAllocAsync to use memory asynchronously freed\n' + 'in another streams as long as a stream ordering dependency of the\n' + 'allocating stream on the free action exists. Cuda events and null stream\n' + 'interactions can create the required stream ordered dependencies. (default\n' + 'enabled)\n' + ) + + + CU_MEMPOOL_ATTR_REUSE_ALLOW_OPPORTUNISTIC = ( + cydriver.CUmemPool_attribute_enum.CU_MEMPOOL_ATTR_REUSE_ALLOW_OPPORTUNISTIC, + '(value type = int) Allow reuse of already completed frees when there is no\n' + 'dependency between the free and allocation. (default enabled)\n' + ) + + + CU_MEMPOOL_ATTR_REUSE_ALLOW_INTERNAL_DEPENDENCIES = ( + cydriver.CUmemPool_attribute_enum.CU_MEMPOOL_ATTR_REUSE_ALLOW_INTERNAL_DEPENDENCIES, + '(value type = int) Allow cuMemAllocAsync to insert new stream dependencies\n' + 'in order to establish the stream ordering required to reuse a piece of\n' + 'memory released by cuMemFreeAsync (default enabled).\n' + ) + + + CU_MEMPOOL_ATTR_RELEASE_THRESHOLD = ( + cydriver.CUmemPool_attribute_enum.CU_MEMPOOL_ATTR_RELEASE_THRESHOLD, + '(value type = :py:obj:`~.cuuint64_t`) Amount of reserved memory in bytes to\n' + 'hold onto before trying to release memory back to the OS. When more than\n' + 'the release threshold bytes of memory are held by the memory pool, the\n' + 'allocator will try to release memory back to the OS on the next call to\n' + 'stream, event or context synchronize. (default 0)\n' + ) + + + CU_MEMPOOL_ATTR_RESERVED_MEM_CURRENT = ( + cydriver.CUmemPool_attribute_enum.CU_MEMPOOL_ATTR_RESERVED_MEM_CURRENT, + '(value type = :py:obj:`~.cuuint64_t`) Amount of backing memory currently\n' + 'allocated for the mempool.\n' + ) + + + CU_MEMPOOL_ATTR_RESERVED_MEM_HIGH = ( + cydriver.CUmemPool_attribute_enum.CU_MEMPOOL_ATTR_RESERVED_MEM_HIGH, + '(value type = :py:obj:`~.cuuint64_t`) High watermark of backing memory\n' + 'allocated for the mempool since the last time it was reset. High watermark\n' + 'can only be reset to zero.\n' + ) + + + CU_MEMPOOL_ATTR_USED_MEM_CURRENT = ( + cydriver.CUmemPool_attribute_enum.CU_MEMPOOL_ATTR_USED_MEM_CURRENT, + '(value type = :py:obj:`~.cuuint64_t`) Amount of memory from the pool that\n' + 'is currently in use by the application.\n' + ) + + + CU_MEMPOOL_ATTR_USED_MEM_HIGH = ( + cydriver.CUmemPool_attribute_enum.CU_MEMPOOL_ATTR_USED_MEM_HIGH, + '(value type = :py:obj:`~.cuuint64_t`) High watermark of the amount of\n' + 'memory from the pool that was in use by the application since the last time\n' + 'it was reset. High watermark can only be reset to zero.\n' + ) + + + CU_MEMPOOL_ATTR_ALLOCATION_TYPE = ( + cydriver.CUmemPool_attribute_enum.CU_MEMPOOL_ATTR_ALLOCATION_TYPE, + '(value type = :py:obj:`~.CUmemAllocationType`) The allocation type of the\n' + 'mempool\n' + ) + + + CU_MEMPOOL_ATTR_EXPORT_HANDLE_TYPES = ( + cydriver.CUmemPool_attribute_enum.CU_MEMPOOL_ATTR_EXPORT_HANDLE_TYPES, + '(value type = :py:obj:`~.CUmemAllocationHandleType`) Available export\n' + 'handle types for the mempool. For imported pools this value is always\n' + 'CU_MEM_HANDLE_TYPE_NONE as an imported pool cannot be re-exported\n' + ) + + + CU_MEMPOOL_ATTR_LOCATION_ID = ( + cydriver.CUmemPool_attribute_enum.CU_MEMPOOL_ATTR_LOCATION_ID, + '(value type = int) The location id for the mempool. If the location type\n' + 'for this pool is CU_MEM_LOCATION_TYPE_INVISIBLE then ID will be\n' + 'CU_DEVICE_INVALID.\n' + ) + + + CU_MEMPOOL_ATTR_LOCATION_TYPE = ( + cydriver.CUmemPool_attribute_enum.CU_MEMPOOL_ATTR_LOCATION_TYPE, + '(value type = :py:obj:`~.CUmemLocationType`) The location type for the\n' + 'mempool. For imported memory pools where the device is not directly visible\n' + 'to the importing process or pools imported via fabric handles across nodes\n' + 'this will be CU_MEM_LOCATION_TYPE_INVISIBLE.\n' + ) + + + CU_MEMPOOL_ATTR_MAX_POOL_SIZE = ( + cydriver.CUmemPool_attribute_enum.CU_MEMPOOL_ATTR_MAX_POOL_SIZE, + '(value type = :py:obj:`~.cuuint64_t`) Maximum size of the pool in bytes,\n' + 'this value may be higher than what was initially passed to cuMemPoolCreate\n' + 'due to alignment requirements. A value of 0 indicates no maximum size. For\n' + 'CU_MEM_ALLOCATION_TYPE_MANAGED and IPC imported pools this value will be\n' + 'system dependent.\n' + ) + + + CU_MEMPOOL_ATTR_HW_DECOMPRESS_ENABLED = ( + cydriver.CUmemPool_attribute_enum.CU_MEMPOOL_ATTR_HW_DECOMPRESS_ENABLED, + '(value type = int) Indicates whether the pool has hardware compresssion\n' + 'enabled\n' + ) + +class CUmemcpyFlags(_FastEnum): + """ + Flags to specify for copies within a batch. For more details see + :py:obj:`~.cuMemcpyBatchAsync`. + """ + + CU_MEMCPY_FLAG_DEFAULT = cydriver.CUmemcpyFlags_enum.CU_MEMCPY_FLAG_DEFAULT + + + CU_MEMCPY_FLAG_PREFER_OVERLAP_WITH_COMPUTE = ( + cydriver.CUmemcpyFlags_enum.CU_MEMCPY_FLAG_PREFER_OVERLAP_WITH_COMPUTE, + 'Hint to the driver to try and overlap the copy with compute work on the\n' + 'SMs.\n' + ) + +class CUmemcpySrcAccessOrder(_FastEnum): + """ + These flags allow applications to convey the source access ordering + CUDA must maintain. The destination will always be accessed in + stream order. + """ + + + CU_MEMCPY_SRC_ACCESS_ORDER_INVALID = ( + cydriver.CUmemcpySrcAccessOrder_enum.CU_MEMCPY_SRC_ACCESS_ORDER_INVALID, + 'Default invalid.\n' + ) + + + CU_MEMCPY_SRC_ACCESS_ORDER_STREAM = ( + cydriver.CUmemcpySrcAccessOrder_enum.CU_MEMCPY_SRC_ACCESS_ORDER_STREAM, + 'Indicates that access to the source pointer must be in stream order.\n' + ) + + + CU_MEMCPY_SRC_ACCESS_ORDER_DURING_API_CALL = ( + cydriver.CUmemcpySrcAccessOrder_enum.CU_MEMCPY_SRC_ACCESS_ORDER_DURING_API_CALL, + 'Indicates that access to the source pointer can be out of stream order and\n' + 'all accesses must be complete before the API call returns. This flag is\n' + "suited for ephemeral sources (ex., stack variables) when it's known that no\n" + 'prior operations in the stream can be accessing the memory and also that\n' + 'the lifetime of the memory is limited to the scope that the source variable\n' + 'was declared in. Specifying this flag allows the driver to optimize the\n' + 'copy and removes the need for the user to synchronize the stream after the\n' + 'API call.\n' + ) + + + CU_MEMCPY_SRC_ACCESS_ORDER_ANY = ( + cydriver.CUmemcpySrcAccessOrder_enum.CU_MEMCPY_SRC_ACCESS_ORDER_ANY, + 'Indicates that access to the source pointer can be out of stream order and\n' + 'the accesses can happen even after the API call returns. This flag is\n' + "suited for host pointers allocated outside CUDA (ex., via malloc) when it's\n" + 'known that no prior operations in the stream can be accessing the memory.\n' + 'Specifying this flag allows the driver to optimize the copy on certain\n' + 'platforms.\n' + ) + + CU_MEMCPY_SRC_ACCESS_ORDER_MAX = cydriver.CUmemcpySrcAccessOrder_enum.CU_MEMCPY_SRC_ACCESS_ORDER_MAX + +class CUmemcpy3DOperandType(_FastEnum): + """ + These flags allow applications to convey the operand type for + individual copies specified in :py:obj:`~.cuMemcpy3DBatchAsync`. + """ + + + CU_MEMCPY_OPERAND_TYPE_POINTER = ( + cydriver.CUmemcpy3DOperandType_enum.CU_MEMCPY_OPERAND_TYPE_POINTER, + 'Memcpy operand is a valid pointer.\n' + ) + + + CU_MEMCPY_OPERAND_TYPE_ARRAY = ( + cydriver.CUmemcpy3DOperandType_enum.CU_MEMCPY_OPERAND_TYPE_ARRAY, + 'Memcpy operand is a :py:obj:`~.CUarray`.\n' + ) + + CU_MEMCPY_OPERAND_TYPE_MAX = cydriver.CUmemcpy3DOperandType_enum.CU_MEMCPY_OPERAND_TYPE_MAX + +class CUgraphMem_attribute(_FastEnum): + """ + + """ + + + CU_GRAPH_MEM_ATTR_USED_MEM_CURRENT = ( + cydriver.CUgraphMem_attribute_enum.CU_GRAPH_MEM_ATTR_USED_MEM_CURRENT, + '(value type = :py:obj:`~.cuuint64_t`) Amount of memory, in bytes, currently\n' + 'associated with graphs\n' + ) + + + CU_GRAPH_MEM_ATTR_USED_MEM_HIGH = ( + cydriver.CUgraphMem_attribute_enum.CU_GRAPH_MEM_ATTR_USED_MEM_HIGH, + '(value type = :py:obj:`~.cuuint64_t`) High watermark of memory, in bytes,\n' + 'associated with graphs since the last time it was reset. High watermark can\n' + 'only be reset to zero.\n' + ) + + + CU_GRAPH_MEM_ATTR_RESERVED_MEM_CURRENT = ( + cydriver.CUgraphMem_attribute_enum.CU_GRAPH_MEM_ATTR_RESERVED_MEM_CURRENT, + '(value type = :py:obj:`~.cuuint64_t`) Amount of memory, in bytes, currently\n' + 'allocated for use by the CUDA graphs asynchronous allocator.\n' + ) + + + CU_GRAPH_MEM_ATTR_RESERVED_MEM_HIGH = ( + cydriver.CUgraphMem_attribute_enum.CU_GRAPH_MEM_ATTR_RESERVED_MEM_HIGH, + '(value type = :py:obj:`~.cuuint64_t`) High watermark of memory, in bytes,\n' + 'currently allocated for use by the CUDA graphs asynchronous allocator.\n' + ) + +class CUgraphChildGraphNodeOwnership(_FastEnum): + """ + Child graph node ownership + """ + + + CU_GRAPH_CHILD_GRAPH_OWNERSHIP_INVALID = ( + cydriver.CUgraphChildGraphNodeOwnership_enum.CU_GRAPH_CHILD_GRAPH_OWNERSHIP_INVALID, + 'Invalid ownership flag. Set when params are queried to prevent accidentally\n' + 'reusing the driver-owned graph object\n' + ) + + + CU_GRAPH_CHILD_GRAPH_OWNERSHIP_CLONE = ( + cydriver.CUgraphChildGraphNodeOwnership_enum.CU_GRAPH_CHILD_GRAPH_OWNERSHIP_CLONE, + 'Default behavior for a child graph node. Child graph is cloned into the\n' + "parent and memory allocation/free nodes can't be present in the child\n" + 'graph.\n' + ) + + + CU_GRAPH_CHILD_GRAPH_OWNERSHIP_MOVE = ( + cydriver.CUgraphChildGraphNodeOwnership_enum.CU_GRAPH_CHILD_GRAPH_OWNERSHIP_MOVE, + 'The child graph is moved to the parent. The handle to the child graph is\n' + 'owned by the parent and will be destroyed when the parent is destroyed.\n' + 'The following restrictions apply to child graphs after they have been\n' + 'moved: Cannot be independently instantiated or destroyed; Cannot be added\n' + 'as a child graph of a separate parent graph; Cannot be used as an argument\n' + 'to cuGraphExecUpdate; Cannot have additional memory allocation or free\n' + 'nodes added.\n' + ) + +class CUflushGPUDirectRDMAWritesOptions(_FastEnum): + """ + Bitmasks for + :py:obj:`~.CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_FLUSH_WRITES_OPTIONS` + """ + + + CU_FLUSH_GPU_DIRECT_RDMA_WRITES_OPTION_HOST = ( + cydriver.CUflushGPUDirectRDMAWritesOptions_enum.CU_FLUSH_GPU_DIRECT_RDMA_WRITES_OPTION_HOST, + ':py:obj:`~.cuFlushGPUDirectRDMAWrites()` and its CUDA Runtime API\n' + 'counterpart are supported on the device.\n' + ) + + + CU_FLUSH_GPU_DIRECT_RDMA_WRITES_OPTION_MEMOPS = ( + cydriver.CUflushGPUDirectRDMAWritesOptions_enum.CU_FLUSH_GPU_DIRECT_RDMA_WRITES_OPTION_MEMOPS, + 'The :py:obj:`~.CU_STREAM_WAIT_VALUE_FLUSH` flag and the\n' + ':py:obj:`~.CU_STREAM_MEM_OP_FLUSH_REMOTE_WRITES` MemOp are supported on the\n' + 'device.\n' + ) + +class CUGPUDirectRDMAWritesOrdering(_FastEnum): + """ + Platform native ordering for GPUDirect RDMA writes + """ + + + CU_GPU_DIRECT_RDMA_WRITES_ORDERING_NONE = ( + cydriver.CUGPUDirectRDMAWritesOrdering_enum.CU_GPU_DIRECT_RDMA_WRITES_ORDERING_NONE, + 'The device does not natively support ordering of remote writes.\n' + ':py:obj:`~.cuFlushGPUDirectRDMAWrites()` can be leveraged if supported.\n' + ) + + + CU_GPU_DIRECT_RDMA_WRITES_ORDERING_OWNER = ( + cydriver.CUGPUDirectRDMAWritesOrdering_enum.CU_GPU_DIRECT_RDMA_WRITES_ORDERING_OWNER, + 'Natively, the device can consistently consume remote writes, although other\n' + 'CUDA devices may not.\n' + ) + + + CU_GPU_DIRECT_RDMA_WRITES_ORDERING_ALL_DEVICES = ( + cydriver.CUGPUDirectRDMAWritesOrdering_enum.CU_GPU_DIRECT_RDMA_WRITES_ORDERING_ALL_DEVICES, + 'Any CUDA device in the system can consistently consume remote writes to\n' + 'this device.\n' + ) + +class CUflushGPUDirectRDMAWritesScope(_FastEnum): + """ + The scopes for :py:obj:`~.cuFlushGPUDirectRDMAWrites` + """ + + + CU_FLUSH_GPU_DIRECT_RDMA_WRITES_TO_OWNER = ( + cydriver.CUflushGPUDirectRDMAWritesScope_enum.CU_FLUSH_GPU_DIRECT_RDMA_WRITES_TO_OWNER, + 'Blocks until remote writes are visible to the CUDA device context owning\n' + 'the data.\n' + ) + + + CU_FLUSH_GPU_DIRECT_RDMA_WRITES_TO_ALL_DEVICES = ( + cydriver.CUflushGPUDirectRDMAWritesScope_enum.CU_FLUSH_GPU_DIRECT_RDMA_WRITES_TO_ALL_DEVICES, + 'Blocks until remote writes are visible to all CUDA device contexts.\n' + ) + +class CUflushGPUDirectRDMAWritesTarget(_FastEnum): + """ + The targets for :py:obj:`~.cuFlushGPUDirectRDMAWrites` + """ + + + CU_FLUSH_GPU_DIRECT_RDMA_WRITES_TARGET_CURRENT_CTX = ( + cydriver.CUflushGPUDirectRDMAWritesTarget_enum.CU_FLUSH_GPU_DIRECT_RDMA_WRITES_TARGET_CURRENT_CTX, + 'Sets the target for :py:obj:`~.cuFlushGPUDirectRDMAWrites()` to the\n' + 'currently active CUDA device context.\n' + ) + +class CUgraphDebugDot_flags(_FastEnum): + """ + The additional write options for :py:obj:`~.cuGraphDebugDotPrint` + """ + + + CU_GRAPH_DEBUG_DOT_FLAGS_VERBOSE = ( + cydriver.CUgraphDebugDot_flags_enum.CU_GRAPH_DEBUG_DOT_FLAGS_VERBOSE, + 'Output all debug data as if every debug flag is enabled\n' + ) + + + CU_GRAPH_DEBUG_DOT_FLAGS_RUNTIME_TYPES = ( + cydriver.CUgraphDebugDot_flags_enum.CU_GRAPH_DEBUG_DOT_FLAGS_RUNTIME_TYPES, + 'Use CUDA Runtime structures for output\n' + ) + + + CU_GRAPH_DEBUG_DOT_FLAGS_KERNEL_NODE_PARAMS = ( + cydriver.CUgraphDebugDot_flags_enum.CU_GRAPH_DEBUG_DOT_FLAGS_KERNEL_NODE_PARAMS, + 'Adds :py:obj:`~.CUDA_KERNEL_NODE_PARAMS` values to output\n' + ) + + + CU_GRAPH_DEBUG_DOT_FLAGS_MEMCPY_NODE_PARAMS = ( + cydriver.CUgraphDebugDot_flags_enum.CU_GRAPH_DEBUG_DOT_FLAGS_MEMCPY_NODE_PARAMS, + 'Adds :py:obj:`~.CUDA_MEMCPY3D` values to output\n' + ) + + + CU_GRAPH_DEBUG_DOT_FLAGS_MEMSET_NODE_PARAMS = ( + cydriver.CUgraphDebugDot_flags_enum.CU_GRAPH_DEBUG_DOT_FLAGS_MEMSET_NODE_PARAMS, + 'Adds :py:obj:`~.CUDA_MEMSET_NODE_PARAMS` values to output\n' + ) + + + CU_GRAPH_DEBUG_DOT_FLAGS_HOST_NODE_PARAMS = ( + cydriver.CUgraphDebugDot_flags_enum.CU_GRAPH_DEBUG_DOT_FLAGS_HOST_NODE_PARAMS, + 'Adds :py:obj:`~.CUDA_HOST_NODE_PARAMS` values to output\n' + ) + + + CU_GRAPH_DEBUG_DOT_FLAGS_EVENT_NODE_PARAMS = ( + cydriver.CUgraphDebugDot_flags_enum.CU_GRAPH_DEBUG_DOT_FLAGS_EVENT_NODE_PARAMS, + 'Adds :py:obj:`~.CUevent` handle from record and wait nodes to output\n' + ) + + + CU_GRAPH_DEBUG_DOT_FLAGS_EXT_SEMAS_SIGNAL_NODE_PARAMS = ( + cydriver.CUgraphDebugDot_flags_enum.CU_GRAPH_DEBUG_DOT_FLAGS_EXT_SEMAS_SIGNAL_NODE_PARAMS, + 'Adds :py:obj:`~.CUDA_EXT_SEM_SIGNAL_NODE_PARAMS` values to output\n' + ) + + + CU_GRAPH_DEBUG_DOT_FLAGS_EXT_SEMAS_WAIT_NODE_PARAMS = ( + cydriver.CUgraphDebugDot_flags_enum.CU_GRAPH_DEBUG_DOT_FLAGS_EXT_SEMAS_WAIT_NODE_PARAMS, + 'Adds :py:obj:`~.CUDA_EXT_SEM_WAIT_NODE_PARAMS` values to output\n' + ) + + + CU_GRAPH_DEBUG_DOT_FLAGS_KERNEL_NODE_ATTRIBUTES = ( + cydriver.CUgraphDebugDot_flags_enum.CU_GRAPH_DEBUG_DOT_FLAGS_KERNEL_NODE_ATTRIBUTES, + 'Adds :py:obj:`~.CUkernelNodeAttrValue` values to output\n' + ) + + + CU_GRAPH_DEBUG_DOT_FLAGS_HANDLES = ( + cydriver.CUgraphDebugDot_flags_enum.CU_GRAPH_DEBUG_DOT_FLAGS_HANDLES, + 'Adds node handles and every kernel function handle to output\n' + ) + + + CU_GRAPH_DEBUG_DOT_FLAGS_MEM_ALLOC_NODE_PARAMS = ( + cydriver.CUgraphDebugDot_flags_enum.CU_GRAPH_DEBUG_DOT_FLAGS_MEM_ALLOC_NODE_PARAMS, + 'Adds memory alloc node parameters to output\n' + ) + + + CU_GRAPH_DEBUG_DOT_FLAGS_MEM_FREE_NODE_PARAMS = ( + cydriver.CUgraphDebugDot_flags_enum.CU_GRAPH_DEBUG_DOT_FLAGS_MEM_FREE_NODE_PARAMS, + 'Adds memory free node parameters to output\n' + ) + + + CU_GRAPH_DEBUG_DOT_FLAGS_BATCH_MEM_OP_NODE_PARAMS = ( + cydriver.CUgraphDebugDot_flags_enum.CU_GRAPH_DEBUG_DOT_FLAGS_BATCH_MEM_OP_NODE_PARAMS, + 'Adds batch mem op node parameters to output\n' + ) + + + CU_GRAPH_DEBUG_DOT_FLAGS_EXTRA_TOPO_INFO = ( + cydriver.CUgraphDebugDot_flags_enum.CU_GRAPH_DEBUG_DOT_FLAGS_EXTRA_TOPO_INFO, + 'Adds edge numbering information\n' + ) + + + CU_GRAPH_DEBUG_DOT_FLAGS_CONDITIONAL_NODE_PARAMS = ( + cydriver.CUgraphDebugDot_flags_enum.CU_GRAPH_DEBUG_DOT_FLAGS_CONDITIONAL_NODE_PARAMS, + 'Adds conditional node parameters to output\n' + ) + +class CUuserObject_flags(_FastEnum): + """ + Flags for user objects for graphs + """ + + + CU_USER_OBJECT_NO_DESTRUCTOR_SYNC = ( + cydriver.CUuserObject_flags_enum.CU_USER_OBJECT_NO_DESTRUCTOR_SYNC, + 'Indicates the destructor execution is not synchronized by any CUDA handle.\n' + ) + +class CUuserObjectRetain_flags(_FastEnum): + """ + Flags for retaining user object references for graphs + """ + + + CU_GRAPH_USER_OBJECT_MOVE = ( + cydriver.CUuserObjectRetain_flags_enum.CU_GRAPH_USER_OBJECT_MOVE, + 'Transfer references from the caller rather than creating new references.\n' + ) + +class CUgraphInstantiate_flags(_FastEnum): + """ + Flags for instantiating a graph + """ + + + CUDA_GRAPH_INSTANTIATE_FLAG_AUTO_FREE_ON_LAUNCH = ( + cydriver.CUgraphInstantiate_flags_enum.CUDA_GRAPH_INSTANTIATE_FLAG_AUTO_FREE_ON_LAUNCH, + 'Automatically free memory allocated in a graph before relaunching.\n' + ) + + + CUDA_GRAPH_INSTANTIATE_FLAG_UPLOAD = ( + cydriver.CUgraphInstantiate_flags_enum.CUDA_GRAPH_INSTANTIATE_FLAG_UPLOAD, + 'Automatically upload the graph after instantiation. Only supported by\n' + ':py:obj:`~.cuGraphInstantiateWithParams`. The upload will be performed\n' + 'using the stream provided in `instantiateParams`.\n' + ) + + + CUDA_GRAPH_INSTANTIATE_FLAG_DEVICE_LAUNCH = ( + cydriver.CUgraphInstantiate_flags_enum.CUDA_GRAPH_INSTANTIATE_FLAG_DEVICE_LAUNCH, + 'Instantiate the graph to be launchable from the device. This flag can only\n' + 'be used on platforms which support unified addressing. This flag cannot be\n' + 'used in conjunction with CUDA_GRAPH_INSTANTIATE_FLAG_AUTO_FREE_ON_LAUNCH.\n' + ) + + + CUDA_GRAPH_INSTANTIATE_FLAG_USE_NODE_PRIORITY = ( + cydriver.CUgraphInstantiate_flags_enum.CUDA_GRAPH_INSTANTIATE_FLAG_USE_NODE_PRIORITY, + 'Run the graph using the per-node priority attributes rather than the\n' + 'priority of the stream it is launched into.\n' + ) + +class CUdeviceNumaConfig(_FastEnum): + """ + CUDA device NUMA configuration + """ + + + CU_DEVICE_NUMA_CONFIG_NONE = ( + cydriver.CUdeviceNumaConfig_enum.CU_DEVICE_NUMA_CONFIG_NONE, + 'The GPU is not a NUMA node\n' + ) + + + CU_DEVICE_NUMA_CONFIG_NUMA_NODE = ( + cydriver.CUdeviceNumaConfig_enum.CU_DEVICE_NUMA_CONFIG_NUMA_NODE, + 'The GPU is a NUMA node, CU_DEVICE_ATTRIBUTE_NUMA_ID contains its NUMA ID\n' + ) + +class CUprocessState(_FastEnum): + """ + CUDA Process States + """ + + + CU_PROCESS_STATE_RUNNING = ( + cydriver.CUprocessState_enum.CU_PROCESS_STATE_RUNNING, + 'Default process state\n' + ) + + + CU_PROCESS_STATE_LOCKED = ( + cydriver.CUprocessState_enum.CU_PROCESS_STATE_LOCKED, + 'CUDA API locks are taken so further CUDA API calls will block\n' + ) + + + CU_PROCESS_STATE_CHECKPOINTED = ( + cydriver.CUprocessState_enum.CU_PROCESS_STATE_CHECKPOINTED, + 'Application memory contents have been checkpointed and underlying\n' + 'allocations and device handles have been released\n' + ) + + + CU_PROCESS_STATE_FAILED = ( + cydriver.CUprocessState_enum.CU_PROCESS_STATE_FAILED, + 'Application entered an uncorrectable error during the checkpoint/restore\n' + 'process\n' + ) + +class CUmoduleLoadingMode(_FastEnum): + """ + CUDA Lazy Loading status + """ + + + CU_MODULE_EAGER_LOADING = ( + cydriver.CUmoduleLoadingMode_enum.CU_MODULE_EAGER_LOADING, + 'Lazy Kernel Loading is not enabled\n' + ) + + + CU_MODULE_LAZY_LOADING = ( + cydriver.CUmoduleLoadingMode_enum.CU_MODULE_LAZY_LOADING, + 'Lazy Kernel Loading is enabled\n' + ) + +class CUmemDecompressAlgorithm(_FastEnum): + """ + Bitmasks for CU_DEVICE_ATTRIBUTE_MEM_DECOMPRESS_ALGORITHM_MASK. + """ + + + CU_MEM_DECOMPRESS_UNSUPPORTED = ( + cydriver.CUmemDecompressAlgorithm_enum.CU_MEM_DECOMPRESS_UNSUPPORTED, + 'Decompression is unsupported.\n' + ) + + + CU_MEM_DECOMPRESS_ALGORITHM_DEFLATE = ( + cydriver.CUmemDecompressAlgorithm_enum.CU_MEM_DECOMPRESS_ALGORITHM_DEFLATE, + 'Deflate is supported.\n' + ) + + + CU_MEM_DECOMPRESS_ALGORITHM_SNAPPY = ( + cydriver.CUmemDecompressAlgorithm_enum.CU_MEM_DECOMPRESS_ALGORITHM_SNAPPY, + 'Snappy is supported.\n' + ) + + + CU_MEM_DECOMPRESS_ALGORITHM_LZ4 = ( + cydriver.CUmemDecompressAlgorithm_enum.CU_MEM_DECOMPRESS_ALGORITHM_LZ4, + 'LZ4 is supported.\n' + ) + +class CUlogicalEndpointIpcHandleType(_FastEnum): + """ + IPC handle types that can be requested/queried for a given logical + endpoint + """ + + CU_LOGICAL_ENDPOINT_IPC_HANDLE_TYPE_NONE = cydriver.CUlogicalEndpointIpcHandleType_enum.CU_LOGICAL_ENDPOINT_IPC_HANDLE_TYPE_NONE + + CU_LOGICAL_ENDPOINT_IPC_HANDLE_TYPE_FABRIC = cydriver.CUlogicalEndpointIpcHandleType_enum.CU_LOGICAL_ENDPOINT_IPC_HANDLE_TYPE_FABRIC + +class CUlogicalEndpointType(_FastEnum): + """ + Logical endpoint type + """ + + CU_LOGICAL_ENDPOINT_TYPE_INVALID = cydriver.CUlogicalEndpointType_enum.CU_LOGICAL_ENDPOINT_TYPE_INVALID + + CU_LOGICAL_ENDPOINT_TYPE_UNICAST = cydriver.CUlogicalEndpointType_enum.CU_LOGICAL_ENDPOINT_TYPE_UNICAST + + CU_LOGICAL_ENDPOINT_TYPE_MULTICAST = cydriver.CUlogicalEndpointType_enum.CU_LOGICAL_ENDPOINT_TYPE_MULTICAST + +class CUlogicalEndpointFlag(_FastEnum): + """ + Flags for :py:obj:`~.CUlogicalEndpointProp` + """ + + + CU_LOGICAL_ENDPOINT_FLAG_NONE = ( + cydriver.CUlogicalEndpointFlag_enum.CU_LOGICAL_ENDPOINT_FLAG_NONE, + 'Default flag for logical endpoint construction\n' + ) + + + CU_LOGICAL_ENDPOINT_FLAG_COUNTED_OPS = ( + cydriver.CUlogicalEndpointFlag_enum.CU_LOGICAL_ENDPOINT_FLAG_COUNTED_OPS, + "Indicate the programmer's intention to use counted operations with the\n" + 'logical endpoint\n' + ) + +class CUgraphRecaptureStatus(_FastEnum): + """ + + """ + + + CU_GRAPH_RECAPTURE_ELIGIBLE_FOR_UPDATE = ( + cydriver.CUgraphRecaptureStatus_enum.CU_GRAPH_RECAPTURE_ELIGIBLE_FOR_UPDATE, + 'Node is eligible for update in an instantiated graph.\n' + ) + + + CU_GRAPH_RECAPTURE_INELIGIBLE_FOR_UPDATE = ( + cydriver.CUgraphRecaptureStatus_enum.CU_GRAPH_RECAPTURE_INELIGIBLE_FOR_UPDATE, + 'Parameter changes in the node cannot be applied to an instantiated graph.\n' + ) + + + CU_GRAPH_RECAPTURE_ERROR = ( + cydriver.CUgraphRecaptureStatus_enum.CU_GRAPH_RECAPTURE_ERROR, + 'Error while attempting to recapture the node. The recapture will be ended\n' + 'regardless of the return value from the callback.\n' + ) + +class CUfunctionLoadingState(_FastEnum): + """ + + """ + + CU_FUNCTION_LOADING_STATE_UNLOADED = cydriver.CUfunctionLoadingState_enum.CU_FUNCTION_LOADING_STATE_UNLOADED + + CU_FUNCTION_LOADING_STATE_LOADED = cydriver.CUfunctionLoadingState_enum.CU_FUNCTION_LOADING_STATE_LOADED + + CU_FUNCTION_LOADING_STATE_MAX = cydriver.CUfunctionLoadingState_enum.CU_FUNCTION_LOADING_STATE_MAX + +class CUcoredumpSettings(_FastEnum): + """ + Flags for choosing a coredump attribute to get/set + """ + + CU_COREDUMP_ENABLE_ON_EXCEPTION = cydriver.CUcoredumpSettings_enum.CU_COREDUMP_ENABLE_ON_EXCEPTION + + CU_COREDUMP_TRIGGER_HOST = cydriver.CUcoredumpSettings_enum.CU_COREDUMP_TRIGGER_HOST + + CU_COREDUMP_LIGHTWEIGHT = cydriver.CUcoredumpSettings_enum.CU_COREDUMP_LIGHTWEIGHT + + CU_COREDUMP_ENABLE_USER_TRIGGER = cydriver.CUcoredumpSettings_enum.CU_COREDUMP_ENABLE_USER_TRIGGER + + CU_COREDUMP_FILE = cydriver.CUcoredumpSettings_enum.CU_COREDUMP_FILE + + CU_COREDUMP_PIPE = cydriver.CUcoredumpSettings_enum.CU_COREDUMP_PIPE + + CU_COREDUMP_GENERATION_FLAGS = cydriver.CUcoredumpSettings_enum.CU_COREDUMP_GENERATION_FLAGS + + CU_COREDUMP_MAX = cydriver.CUcoredumpSettings_enum.CU_COREDUMP_MAX + +class CUCoredumpGenerationFlags(_FastEnum): + """ + Flags for controlling coredump contents + """ + + CU_COREDUMP_DEFAULT_FLAGS = cydriver.CUCoredumpGenerationFlags.CU_COREDUMP_DEFAULT_FLAGS + + CU_COREDUMP_SKIP_NONRELOCATED_ELF_IMAGES = cydriver.CUCoredumpGenerationFlags.CU_COREDUMP_SKIP_NONRELOCATED_ELF_IMAGES + + CU_COREDUMP_SKIP_GLOBAL_MEMORY = cydriver.CUCoredumpGenerationFlags.CU_COREDUMP_SKIP_GLOBAL_MEMORY + + CU_COREDUMP_SKIP_SHARED_MEMORY = cydriver.CUCoredumpGenerationFlags.CU_COREDUMP_SKIP_SHARED_MEMORY + + CU_COREDUMP_SKIP_LOCAL_MEMORY = cydriver.CUCoredumpGenerationFlags.CU_COREDUMP_SKIP_LOCAL_MEMORY + + CU_COREDUMP_SKIP_ABORT = cydriver.CUCoredumpGenerationFlags.CU_COREDUMP_SKIP_ABORT + + CU_COREDUMP_SKIP_CONSTBANK_MEMORY = cydriver.CUCoredumpGenerationFlags.CU_COREDUMP_SKIP_CONSTBANK_MEMORY + + CU_COREDUMP_LIGHTWEIGHT_FLAGS = cydriver.CUCoredumpGenerationFlags.CU_COREDUMP_LIGHTWEIGHT_FLAGS + + CU_COREDUMP_GZIP_COMPRESS = cydriver.CUCoredumpGenerationFlags.CU_COREDUMP_GZIP_COMPRESS + + CU_COREDUMP_FAULTED_CONTEXTS_ONLY = cydriver.CUCoredumpGenerationFlags.CU_COREDUMP_FAULTED_CONTEXTS_ONLY + + CU_COREDUMP_NO_ERRBAR_AT_EXIT = cydriver.CUCoredumpGenerationFlags.CU_COREDUMP_NO_ERRBAR_AT_EXIT + + CU_COREDUMP_LOG_ONLY = cydriver.CUCoredumpGenerationFlags.CU_COREDUMP_LOG_ONLY + +class CUgreenCtxCreate_flags(_FastEnum): + """ + Flags for green context creation + """ + + CU_GREEN_CTX_NONE = cydriver.CUgreenCtxCreate_flags.CU_GREEN_CTX_NONE + + + CU_GREEN_CTX_DEFAULT_STREAM = ( + cydriver.CUgreenCtxCreate_flags.CU_GREEN_CTX_DEFAULT_STREAM, + 'Creates a default stream to use inside the green context\n' + ) + +class CUdevSmResourceGroup_flags(_FastEnum): + """ + Flags for a :py:obj:`~.CUdevSmResource` group + """ + + CU_DEV_SM_RESOURCE_GROUP_DEFAULT = cydriver.CUdevSmResourceGroup_flags.CU_DEV_SM_RESOURCE_GROUP_DEFAULT + + CU_DEV_SM_RESOURCE_GROUP_BACKFILL = cydriver.CUdevSmResourceGroup_flags.CU_DEV_SM_RESOURCE_GROUP_BACKFILL + +class CUdevSmResourceSplitByCount_flags(_FastEnum): + """ + + """ + + CU_DEV_SM_RESOURCE_SPLIT_IGNORE_SM_COSCHEDULING = cydriver.CUdevSmResourceSplitByCount_flags.CU_DEV_SM_RESOURCE_SPLIT_IGNORE_SM_COSCHEDULING + + CU_DEV_SM_RESOURCE_SPLIT_MAX_POTENTIAL_CLUSTER_SIZE = cydriver.CUdevSmResourceSplitByCount_flags.CU_DEV_SM_RESOURCE_SPLIT_MAX_POTENTIAL_CLUSTER_SIZE + +class CUdevResourceType(_FastEnum): + """ + Type of resource + """ + + CU_DEV_RESOURCE_TYPE_INVALID = cydriver.CUdevResourceType.CU_DEV_RESOURCE_TYPE_INVALID + + + CU_DEV_RESOURCE_TYPE_SM = ( + cydriver.CUdevResourceType.CU_DEV_RESOURCE_TYPE_SM, + 'Streaming multiprocessors related information\n' + ) + + + CU_DEV_RESOURCE_TYPE_WORKQUEUE_CONFIG = ( + cydriver.CUdevResourceType.CU_DEV_RESOURCE_TYPE_WORKQUEUE_CONFIG, + 'Workqueue configuration related information\n' + ) + + + CU_DEV_RESOURCE_TYPE_WORKQUEUE = ( + cydriver.CUdevResourceType.CU_DEV_RESOURCE_TYPE_WORKQUEUE, + 'Pre-existing workqueue related information\n' + ) + +class CUdevWorkqueueConfigScope(_FastEnum): + """ + Sharing scope for workqueues + """ + + + CU_WORKQUEUE_SCOPE_DEVICE_CTX = ( + cydriver.CUdevWorkqueueConfigScope.CU_WORKQUEUE_SCOPE_DEVICE_CTX, + 'Use all shared workqueue resources across all contexts. Default driver\n' + 'behaviour.\n' + ) + + + CU_WORKQUEUE_SCOPE_GREEN_CTX_BALANCED = ( + cydriver.CUdevWorkqueueConfigScope.CU_WORKQUEUE_SCOPE_GREEN_CTX_BALANCED, + 'When possible, use non-overlapping workqueue resources with other balanced\n' + 'green contexts.\n' + ) + +class CUlogLevel(_FastEnum): + """ + + """ + + CU_LOG_LEVEL_ERROR = cydriver.CUlogLevel_enum.CU_LOG_LEVEL_ERROR + + CU_LOG_LEVEL_WARNING = cydriver.CUlogLevel_enum.CU_LOG_LEVEL_WARNING + +class CUoutput_mode(_FastEnum): + """ + Profiler Output Modes + """ + + + CU_OUT_KEY_VALUE_PAIR = ( + cydriver.CUoutput_mode_enum.CU_OUT_KEY_VALUE_PAIR, + 'Output mode Key-Value pair format.\n' + ) + + + CU_OUT_CSV = ( + cydriver.CUoutput_mode_enum.CU_OUT_CSV, + 'Output mode Comma separated values format.\n' + ) + +class CUeglFrameType(_FastEnum): + """ + CUDA EglFrame type - array or pointer + """ + + + CU_EGL_FRAME_TYPE_ARRAY = ( + cydriver.CUeglFrameType_enum.CU_EGL_FRAME_TYPE_ARRAY, + 'Frame type CUDA array\n' + ) + + + CU_EGL_FRAME_TYPE_PITCH = ( + cydriver.CUeglFrameType_enum.CU_EGL_FRAME_TYPE_PITCH, + 'Frame type pointer\n' + ) + +class CUeglResourceLocationFlags(_FastEnum): + """ + Resource location flags- sysmem or vidmem For CUDA context on + iGPU, since video and system memory are equivalent - these flags + will not have an effect on the execution. For CUDA context on + dGPU, applications can use the flag + :py:obj:`~.CUeglResourceLocationFlags` to give a hint about the + desired location. :py:obj:`~.CU_EGL_RESOURCE_LOCATION_SYSMEM` - + the frame data is made resident on the system memory to be accessed + by CUDA. :py:obj:`~.CU_EGL_RESOURCE_LOCATION_VIDMEM` - the frame + data is made resident on the dedicated video memory to be accessed + by CUDA. There may be an additional latency due to new allocation + and data migration, if the frame is produced on a different memory. + """ + + + CU_EGL_RESOURCE_LOCATION_SYSMEM = ( + cydriver.CUeglResourceLocationFlags_enum.CU_EGL_RESOURCE_LOCATION_SYSMEM, + 'Resource location sysmem\n' + ) + + + CU_EGL_RESOURCE_LOCATION_VIDMEM = ( + cydriver.CUeglResourceLocationFlags_enum.CU_EGL_RESOURCE_LOCATION_VIDMEM, + 'Resource location vidmem\n' + ) + +class CUeglColorFormat(_FastEnum): + """ + CUDA EGL Color Format - The different planar and multiplanar + formats currently supported for CUDA_EGL interops. Three channel + formats are currently not supported for + :py:obj:`~.CU_EGL_FRAME_TYPE_ARRAY` + """ + + + CU_EGL_COLOR_FORMAT_YUV420_PLANAR = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_PLANAR, + 'Y, U, V in three surfaces, each in a separate surface, U/V width = 1/2 Y\n' + 'width, U/V height = 1/2 Y height.\n' + ) + + + CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR, + 'Y, UV in two surfaces (UV as one surface) with VU byte ordering, width,\n' + 'height ratio same as YUV420Planar.\n' + ) + + + CU_EGL_COLOR_FORMAT_YUV422_PLANAR = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV422_PLANAR, + 'Y, U, V each in a separate surface, U/V width = 1/2 Y width, U/V height = Y\n' + 'height.\n' + ) + + + CU_EGL_COLOR_FORMAT_YUV422_SEMIPLANAR = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV422_SEMIPLANAR, + 'Y, UV in two surfaces with VU byte ordering, width, height ratio same as\n' + 'YUV422Planar.\n' + ) + + + CU_EGL_COLOR_FORMAT_RGB = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_RGB, + 'R/G/B three channels in one surface with BGR byte ordering. Only pitch\n' + 'linear format supported.\n' + ) + + + CU_EGL_COLOR_FORMAT_BGR = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BGR, + 'R/G/B three channels in one surface with RGB byte ordering. Only pitch\n' + 'linear format supported.\n' + ) + + + CU_EGL_COLOR_FORMAT_ARGB = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_ARGB, + 'R/G/B/A four channels in one surface with BGRA byte ordering.\n' + ) + + + CU_EGL_COLOR_FORMAT_RGBA = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_RGBA, + 'R/G/B/A four channels in one surface with ABGR byte ordering.\n' + ) + + + CU_EGL_COLOR_FORMAT_L = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_L, + 'single luminance channel in one surface.\n' + ) + + + CU_EGL_COLOR_FORMAT_R = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_R, + 'single color channel in one surface.\n' + ) + + + CU_EGL_COLOR_FORMAT_YUV444_PLANAR = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV444_PLANAR, + 'Y, U, V in three surfaces, each in a separate surface, U/V width = Y width,\n' + 'U/V height = Y height.\n' + ) + + + CU_EGL_COLOR_FORMAT_YUV444_SEMIPLANAR = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV444_SEMIPLANAR, + 'Y, UV in two surfaces (UV as one surface) with VU byte ordering, width,\n' + 'height ratio same as YUV444Planar.\n' + ) + + + CU_EGL_COLOR_FORMAT_YUYV_422 = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUYV_422, + 'Y, U, V in one surface, interleaved as UYVY in one channel.\n' + ) + + + CU_EGL_COLOR_FORMAT_UYVY_422 = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_UYVY_422, + 'Y, U, V in one surface, interleaved as YUYV in one channel.\n' + ) + + + CU_EGL_COLOR_FORMAT_ABGR = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_ABGR, + 'R/G/B/A four channels in one surface with RGBA byte ordering.\n' + ) + + + CU_EGL_COLOR_FORMAT_BGRA = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BGRA, + 'R/G/B/A four channels in one surface with ARGB byte ordering.\n' + ) + + + CU_EGL_COLOR_FORMAT_A = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_A, + 'Alpha color format - one channel in one surface.\n' + ) + + + CU_EGL_COLOR_FORMAT_RG = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_RG, + 'R/G color format - two channels in one surface with GR byte ordering\n' + ) + + + CU_EGL_COLOR_FORMAT_AYUV = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_AYUV, + 'Y, U, V, A four channels in one surface, interleaved as VUYA.\n' + ) + + + CU_EGL_COLOR_FORMAT_YVU444_SEMIPLANAR = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU444_SEMIPLANAR, + 'Y, VU in two surfaces (VU as one surface) with UV byte ordering, U/V width\n' + '= Y width, U/V height = Y height.\n' + ) + + + CU_EGL_COLOR_FORMAT_YVU422_SEMIPLANAR = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU422_SEMIPLANAR, + 'Y, VU in two surfaces (VU as one surface) with UV byte ordering, U/V width\n' + '= 1/2 Y width, U/V height = Y height.\n' + ) + + + CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR, + 'Y, VU in two surfaces (VU as one surface) with UV byte ordering, U/V width\n' + '= 1/2 Y width, U/V height = 1/2 Y height.\n' + ) + + + CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR, + 'Y10, V10U10 in two surfaces (VU as one surface) with UV byte ordering, U/V\n' + 'width = Y width, U/V height = Y height.\n' + ) + + + CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR, + 'Y10, V10U10 in two surfaces (VU as one surface) with UV byte ordering, U/V\n' + 'width = 1/2 Y width, U/V height = 1/2 Y height.\n' + ) + + + CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR, + 'Y12, V12U12 in two surfaces (VU as one surface) with UV byte ordering, U/V\n' + 'width = Y width, U/V height = Y height.\n' + ) + + + CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR, + 'Y12, V12U12 in two surfaces (VU as one surface) with UV byte ordering, U/V\n' + 'width = 1/2 Y width, U/V height = 1/2 Y height.\n' + ) + + + CU_EGL_COLOR_FORMAT_VYUY_ER = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_VYUY_ER, + 'Extended Range Y, U, V in one surface, interleaved as YVYU in one channel.\n' + ) + + + CU_EGL_COLOR_FORMAT_UYVY_ER = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_UYVY_ER, + 'Extended Range Y, U, V in one surface, interleaved as YUYV in one channel.\n' + ) + + + CU_EGL_COLOR_FORMAT_YUYV_ER = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUYV_ER, + 'Extended Range Y, U, V in one surface, interleaved as UYVY in one channel.\n' + ) + + + CU_EGL_COLOR_FORMAT_YVYU_ER = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVYU_ER, + 'Extended Range Y, U, V in one surface, interleaved as VYUY in one channel.\n' + ) + + + CU_EGL_COLOR_FORMAT_YUV_ER = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV_ER, + 'Extended Range Y, U, V three channels in one surface, interleaved as VUY.\n' + 'Only pitch linear format supported.\n' + ) + + + CU_EGL_COLOR_FORMAT_YUVA_ER = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUVA_ER, + 'Extended Range Y, U, V, A four channels in one surface, interleaved as\n' + 'AVUY.\n' + ) + + + CU_EGL_COLOR_FORMAT_AYUV_ER = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_AYUV_ER, + 'Extended Range Y, U, V, A four channels in one surface, interleaved as\n' + 'VUYA.\n' + ) + + + CU_EGL_COLOR_FORMAT_YUV444_PLANAR_ER = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV444_PLANAR_ER, + 'Extended Range Y, U, V in three surfaces, U/V width = Y width, U/V height =\n' + 'Y height.\n' + ) + + + CU_EGL_COLOR_FORMAT_YUV422_PLANAR_ER = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV422_PLANAR_ER, + 'Extended Range Y, U, V in three surfaces, U/V width = 1/2 Y width, U/V\n' + 'height = Y height.\n' + ) + + + CU_EGL_COLOR_FORMAT_YUV420_PLANAR_ER = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_PLANAR_ER, + 'Extended Range Y, U, V in three surfaces, U/V width = 1/2 Y width, U/V\n' + 'height = 1/2 Y height.\n' + ) + + + CU_EGL_COLOR_FORMAT_YUV444_SEMIPLANAR_ER = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV444_SEMIPLANAR_ER, + 'Extended Range Y, UV in two surfaces (UV as one surface) with VU byte\n' + 'ordering, U/V width = Y width, U/V height = Y height.\n' + ) + + + CU_EGL_COLOR_FORMAT_YUV422_SEMIPLANAR_ER = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV422_SEMIPLANAR_ER, + 'Extended Range Y, UV in two surfaces (UV as one surface) with VU byte\n' + 'ordering, U/V width = 1/2 Y width, U/V height = Y height.\n' + ) + + + CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR_ER = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR_ER, + 'Extended Range Y, UV in two surfaces (UV as one surface) with VU byte\n' + 'ordering, U/V width = 1/2 Y width, U/V height = 1/2 Y height.\n' + ) + + + CU_EGL_COLOR_FORMAT_YVU444_PLANAR_ER = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU444_PLANAR_ER, + 'Extended Range Y, V, U in three surfaces, U/V width = Y width, U/V height =\n' + 'Y height.\n' + ) + + + CU_EGL_COLOR_FORMAT_YVU422_PLANAR_ER = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU422_PLANAR_ER, + 'Extended Range Y, V, U in three surfaces, U/V width = 1/2 Y width, U/V\n' + 'height = Y height.\n' + ) + + + CU_EGL_COLOR_FORMAT_YVU420_PLANAR_ER = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_PLANAR_ER, + 'Extended Range Y, V, U in three surfaces, U/V width = 1/2 Y width, U/V\n' + 'height = 1/2 Y height.\n' + ) + + + CU_EGL_COLOR_FORMAT_YVU444_SEMIPLANAR_ER = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU444_SEMIPLANAR_ER, + 'Extended Range Y, VU in two surfaces (VU as one surface) with UV byte\n' + 'ordering, U/V width = Y width, U/V height = Y height.\n' + ) + + + CU_EGL_COLOR_FORMAT_YVU422_SEMIPLANAR_ER = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU422_SEMIPLANAR_ER, + 'Extended Range Y, VU in two surfaces (VU as one surface) with UV byte\n' + 'ordering, U/V width = 1/2 Y width, U/V height = Y height.\n' + ) + + + CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR_ER = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR_ER, + 'Extended Range Y, VU in two surfaces (VU as one surface) with UV byte\n' + 'ordering, U/V width = 1/2 Y width, U/V height = 1/2 Y height.\n' + ) + + + CU_EGL_COLOR_FORMAT_BAYER_RGGB = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_RGGB, + 'Bayer format - one channel in one surface with interleaved RGGB ordering.\n' + ) + + + CU_EGL_COLOR_FORMAT_BAYER_BGGR = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_BGGR, + 'Bayer format - one channel in one surface with interleaved BGGR ordering.\n' + ) + + + CU_EGL_COLOR_FORMAT_BAYER_GRBG = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_GRBG, + 'Bayer format - one channel in one surface with interleaved GRBG ordering.\n' + ) + + + CU_EGL_COLOR_FORMAT_BAYER_GBRG = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_GBRG, + 'Bayer format - one channel in one surface with interleaved GBRG ordering.\n' + ) + + + CU_EGL_COLOR_FORMAT_BAYER10_RGGB = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER10_RGGB, + 'Bayer10 format - one channel in one surface with interleaved RGGB ordering.\n' + 'Out of 16 bits, 10 bits used 6 bits No-op.\n' + ) + + + CU_EGL_COLOR_FORMAT_BAYER10_BGGR = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER10_BGGR, + 'Bayer10 format - one channel in one surface with interleaved BGGR ordering.\n' + 'Out of 16 bits, 10 bits used 6 bits No-op.\n' + ) + + + CU_EGL_COLOR_FORMAT_BAYER10_GRBG = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER10_GRBG, + 'Bayer10 format - one channel in one surface with interleaved GRBG ordering.\n' + 'Out of 16 bits, 10 bits used 6 bits No-op.\n' + ) + + + CU_EGL_COLOR_FORMAT_BAYER10_GBRG = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER10_GBRG, + 'Bayer10 format - one channel in one surface with interleaved GBRG ordering.\n' + 'Out of 16 bits, 10 bits used 6 bits No-op.\n' + ) + + + CU_EGL_COLOR_FORMAT_BAYER12_RGGB = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_RGGB, + 'Bayer12 format - one channel in one surface with interleaved RGGB ordering.\n' + 'Out of 16 bits, 12 bits used 4 bits No-op.\n' + ) + + + CU_EGL_COLOR_FORMAT_BAYER12_BGGR = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_BGGR, + 'Bayer12 format - one channel in one surface with interleaved BGGR ordering.\n' + 'Out of 16 bits, 12 bits used 4 bits No-op.\n' + ) + + + CU_EGL_COLOR_FORMAT_BAYER12_GRBG = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_GRBG, + 'Bayer12 format - one channel in one surface with interleaved GRBG ordering.\n' + 'Out of 16 bits, 12 bits used 4 bits No-op.\n' + ) + + + CU_EGL_COLOR_FORMAT_BAYER12_GBRG = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_GBRG, + 'Bayer12 format - one channel in one surface with interleaved GBRG ordering.\n' + 'Out of 16 bits, 12 bits used 4 bits No-op.\n' + ) + + + CU_EGL_COLOR_FORMAT_BAYER14_RGGB = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER14_RGGB, + 'Bayer14 format - one channel in one surface with interleaved RGGB ordering.\n' + 'Out of 16 bits, 14 bits used 2 bits No-op.\n' + ) + + + CU_EGL_COLOR_FORMAT_BAYER14_BGGR = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER14_BGGR, + 'Bayer14 format - one channel in one surface with interleaved BGGR ordering.\n' + 'Out of 16 bits, 14 bits used 2 bits No-op.\n' + ) + + + CU_EGL_COLOR_FORMAT_BAYER14_GRBG = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER14_GRBG, + 'Bayer14 format - one channel in one surface with interleaved GRBG ordering.\n' + 'Out of 16 bits, 14 bits used 2 bits No-op.\n' + ) + + + CU_EGL_COLOR_FORMAT_BAYER14_GBRG = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER14_GBRG, + 'Bayer14 format - one channel in one surface with interleaved GBRG ordering.\n' + 'Out of 16 bits, 14 bits used 2 bits No-op.\n' + ) + + + CU_EGL_COLOR_FORMAT_BAYER20_RGGB = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER20_RGGB, + 'Bayer20 format - one channel in one surface with interleaved RGGB ordering.\n' + 'Out of 32 bits, 20 bits used 12 bits No-op.\n' + ) + + + CU_EGL_COLOR_FORMAT_BAYER20_BGGR = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER20_BGGR, + 'Bayer20 format - one channel in one surface with interleaved BGGR ordering.\n' + 'Out of 32 bits, 20 bits used 12 bits No-op.\n' + ) + + + CU_EGL_COLOR_FORMAT_BAYER20_GRBG = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER20_GRBG, + 'Bayer20 format - one channel in one surface with interleaved GRBG ordering.\n' + 'Out of 32 bits, 20 bits used 12 bits No-op.\n' + ) + + + CU_EGL_COLOR_FORMAT_BAYER20_GBRG = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER20_GBRG, + 'Bayer20 format - one channel in one surface with interleaved GBRG ordering.\n' + 'Out of 32 bits, 20 bits used 12 bits No-op.\n' + ) + + + CU_EGL_COLOR_FORMAT_YVU444_PLANAR = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU444_PLANAR, + 'Y, V, U in three surfaces, each in a separate surface, U/V width = Y width,\n' + 'U/V height = Y height.\n' + ) + + + CU_EGL_COLOR_FORMAT_YVU422_PLANAR = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU422_PLANAR, + 'Y, V, U in three surfaces, each in a separate surface, U/V width = 1/2 Y\n' + 'width, U/V height = Y height.\n' + ) + + + CU_EGL_COLOR_FORMAT_YVU420_PLANAR = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_PLANAR, + 'Y, V, U in three surfaces, each in a separate surface, U/V width = 1/2 Y\n' + 'width, U/V height = 1/2 Y height.\n' + ) + + + CU_EGL_COLOR_FORMAT_BAYER_ISP_RGGB = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_ISP_RGGB, + 'Nvidia proprietary Bayer ISP format - one channel in one surface with\n' + 'interleaved RGGB ordering and mapped to opaque integer datatype.\n' + ) + + + CU_EGL_COLOR_FORMAT_BAYER_ISP_BGGR = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_ISP_BGGR, + 'Nvidia proprietary Bayer ISP format - one channel in one surface with\n' + 'interleaved BGGR ordering and mapped to opaque integer datatype.\n' + ) + + + CU_EGL_COLOR_FORMAT_BAYER_ISP_GRBG = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_ISP_GRBG, + 'Nvidia proprietary Bayer ISP format - one channel in one surface with\n' + 'interleaved GRBG ordering and mapped to opaque integer datatype.\n' + ) + + + CU_EGL_COLOR_FORMAT_BAYER_ISP_GBRG = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_ISP_GBRG, + 'Nvidia proprietary Bayer ISP format - one channel in one surface with\n' + 'interleaved GBRG ordering and mapped to opaque integer datatype.\n' + ) + + + CU_EGL_COLOR_FORMAT_BAYER_BCCR = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_BCCR, + 'Bayer format - one channel in one surface with interleaved BCCR ordering.\n' + ) + + + CU_EGL_COLOR_FORMAT_BAYER_RCCB = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_RCCB, + 'Bayer format - one channel in one surface with interleaved RCCB ordering.\n' + ) + + + CU_EGL_COLOR_FORMAT_BAYER_CRBC = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_CRBC, + 'Bayer format - one channel in one surface with interleaved CRBC ordering.\n' + ) + + + CU_EGL_COLOR_FORMAT_BAYER_CBRC = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_CBRC, + 'Bayer format - one channel in one surface with interleaved CBRC ordering.\n' + ) + + + CU_EGL_COLOR_FORMAT_BAYER10_CCCC = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER10_CCCC, + 'Bayer10 format - one channel in one surface with interleaved CCCC ordering.\n' + 'Out of 16 bits, 10 bits used 6 bits No-op.\n' + ) + + + CU_EGL_COLOR_FORMAT_BAYER12_BCCR = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_BCCR, + 'Bayer12 format - one channel in one surface with interleaved BCCR ordering.\n' + 'Out of 16 bits, 12 bits used 4 bits No-op.\n' + ) + + + CU_EGL_COLOR_FORMAT_BAYER12_RCCB = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_RCCB, + 'Bayer12 format - one channel in one surface with interleaved RCCB ordering.\n' + 'Out of 16 bits, 12 bits used 4 bits No-op.\n' + ) + + + CU_EGL_COLOR_FORMAT_BAYER12_CRBC = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_CRBC, + 'Bayer12 format - one channel in one surface with interleaved CRBC ordering.\n' + 'Out of 16 bits, 12 bits used 4 bits No-op.\n' + ) + + + CU_EGL_COLOR_FORMAT_BAYER12_CBRC = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_CBRC, + 'Bayer12 format - one channel in one surface with interleaved CBRC ordering.\n' + 'Out of 16 bits, 12 bits used 4 bits No-op.\n' + ) + + + CU_EGL_COLOR_FORMAT_BAYER12_CCCC = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_CCCC, + 'Bayer12 format - one channel in one surface with interleaved CCCC ordering.\n' + 'Out of 16 bits, 12 bits used 4 bits No-op.\n' + ) + + + CU_EGL_COLOR_FORMAT_Y = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y, + 'Color format for single Y plane.\n' + ) + + + CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR_2020 = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR_2020, + 'Y, UV in two surfaces (UV as one surface) U/V width = 1/2 Y width, U/V\n' + 'height = 1/2 Y height.\n' + ) + + + CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR_2020 = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR_2020, + 'Y, VU in two surfaces (VU as one surface) U/V width = 1/2 Y width, U/V\n' + 'height = 1/2 Y height.\n' + ) + + + CU_EGL_COLOR_FORMAT_YUV420_PLANAR_2020 = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_PLANAR_2020, + 'Y, U, V each in a separate surface, U/V width = 1/2 Y width, U/V height=\n' + '1/2 Y height.\n' + ) + + + CU_EGL_COLOR_FORMAT_YVU420_PLANAR_2020 = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_PLANAR_2020, + 'Y, V, U each in a separate surface, U/V width = 1/2 Y width, U/V height =\n' + '1/2 Y height.\n' + ) + + + CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR_709 = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR_709, + 'Y, UV in two surfaces (UV as one surface) U/V width = 1/2 Y width, U/V\n' + 'height = 1/2 Y height.\n' + ) + + + CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR_709 = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR_709, + 'Y, VU in two surfaces (VU as one surface) U/V width = 1/2 Y width, U/V\n' + 'height = 1/2 Y height.\n' + ) + + + CU_EGL_COLOR_FORMAT_YUV420_PLANAR_709 = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_PLANAR_709, + 'Y, U, V each in a separate surface, U/V width = 1/2 Y width, U/V height =\n' + '1/2 Y height.\n' + ) + + + CU_EGL_COLOR_FORMAT_YVU420_PLANAR_709 = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_PLANAR_709, + 'Y, V, U each in a separate surface, U/V width = 1/2 Y width, U/V height =\n' + '1/2 Y height.\n' + ) + + + CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_709 = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_709, + 'Y10, V10U10 in two surfaces (VU as one surface), U/V width = 1/2 Y width,\n' + 'U/V height = 1/2 Y height.\n' + ) + + + CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_2020 = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_2020, + 'Y10, V10U10 in two surfaces (VU as one surface), U/V width = 1/2 Y width,\n' + 'U/V height = 1/2 Y height.\n' + ) + + + CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR_2020 = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR_2020, + 'Y10, V10U10 in two surfaces(VU as one surface) U/V width = 1/2 Y width, U/V\n' + 'height = Y height.\n' + ) + + + CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR, + 'Y10, V10U10 in two surfaces(VU as one surface) U/V width = 1/2 Y width, U/V\n' + 'height = Y height.\n' + ) + + + CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR_709 = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR_709, + 'Y10, V10U10 in two surfaces(VU as one surface) U/V width = 1/2 Y width, U/V\n' + 'height = Y height.\n' + ) + + + CU_EGL_COLOR_FORMAT_Y_ER = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y_ER, + 'Extended Range Color format for single Y plane.\n' + ) + + + CU_EGL_COLOR_FORMAT_Y_709_ER = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y_709_ER, + 'Extended Range Color format for single Y plane.\n' + ) + + + CU_EGL_COLOR_FORMAT_Y10_ER = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10_ER, + 'Extended Range Color format for single Y10 plane.\n' + ) + + + CU_EGL_COLOR_FORMAT_Y10_709_ER = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10_709_ER, + 'Extended Range Color format for single Y10 plane.\n' + ) + + + CU_EGL_COLOR_FORMAT_Y12_ER = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12_ER, + 'Extended Range Color format for single Y12 plane.\n' + ) + + + CU_EGL_COLOR_FORMAT_Y12_709_ER = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12_709_ER, + 'Extended Range Color format for single Y12 plane.\n' + ) + + + CU_EGL_COLOR_FORMAT_YUVA = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUVA, + 'Y, U, V, A four channels in one surface, interleaved as AVUY.\n' + ) + + + CU_EGL_COLOR_FORMAT_YUV = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV, + 'Y, U, V three channels in one surface, interleaved as VUY. Only pitch\n' + 'linear format supported.\n' + ) + + + CU_EGL_COLOR_FORMAT_YVYU = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVYU, + 'Y, U, V in one surface, interleaved as YVYU in one channel.\n' + ) + + + CU_EGL_COLOR_FORMAT_VYUY = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_VYUY, + 'Y, U, V in one surface, interleaved as VYUY in one channel.\n' + ) + + + CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_ER = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_ER, + 'Extended Range Y10, V10U10 in two surfaces(VU as one surface) U/V width =\n' + '1/2 Y width, U/V height = 1/2 Y height.\n' + ) + + + CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_709_ER = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_709_ER, + 'Extended Range Y10, V10U10 in two surfaces(VU as one surface) U/V width =\n' + '1/2 Y width, U/V height = 1/2 Y height.\n' + ) + + + CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR_ER = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR_ER, + 'Extended Range Y10, V10U10 in two surfaces (VU as one surface) U/V width =\n' + 'Y width, U/V height = Y height.\n' + ) + + + CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR_709_ER = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR_709_ER, + 'Extended Range Y10, V10U10 in two surfaces (VU as one surface) U/V width =\n' + 'Y width, U/V height = Y height.\n' + ) + + + CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR_ER = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR_ER, + 'Extended Range Y12, V12U12 in two surfaces (VU as one surface) U/V width =\n' + '1/2 Y width, U/V height = 1/2 Y height.\n' + ) + + + CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR_709_ER = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR_709_ER, + 'Extended Range Y12, V12U12 in two surfaces (VU as one surface) U/V width =\n' + '1/2 Y width, U/V height = 1/2 Y height.\n' + ) + + + CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR_ER = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR_ER, + 'Extended Range Y12, V12U12 in two surfaces (VU as one surface) U/V width =\n' + 'Y width, U/V height = Y height.\n' + ) + + + CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR_709_ER = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR_709_ER, + 'Extended Range Y12, V12U12 in two surfaces (VU as one surface) U/V width =\n' + 'Y width, U/V height = Y height.\n' + ) + + + CU_EGL_COLOR_FORMAT_UYVY_709 = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_UYVY_709, + 'Y, U, V in one surface, interleaved as UYVY in one channel.\n' + ) + + + CU_EGL_COLOR_FORMAT_UYVY_709_ER = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_UYVY_709_ER, + 'Extended Range Y, U, V in one surface, interleaved as UYVY in one channel.\n' + ) + + + CU_EGL_COLOR_FORMAT_UYVY_2020 = ( + cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_UYVY_2020, + 'Y, U, V in one surface, interleaved as UYVY in one channel.\n' + ) + + CU_EGL_COLOR_FORMAT_MAX = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_MAX + +class CUGLDeviceList(_FastEnum): + """ + CUDA devices corresponding to an OpenGL device + """ + + + CU_GL_DEVICE_LIST_ALL = ( + cydriver.CUGLDeviceList_enum.CU_GL_DEVICE_LIST_ALL, + 'The CUDA devices for all GPUs used by the current OpenGL context\n' + ) + + + CU_GL_DEVICE_LIST_CURRENT_FRAME = ( + cydriver.CUGLDeviceList_enum.CU_GL_DEVICE_LIST_CURRENT_FRAME, + 'The CUDA devices for the GPUs used by the current OpenGL context in its\n' + 'currently rendering frame\n' + ) + + + CU_GL_DEVICE_LIST_NEXT_FRAME = ( + cydriver.CUGLDeviceList_enum.CU_GL_DEVICE_LIST_NEXT_FRAME, + 'The CUDA devices for the GPUs to be used by the current OpenGL context in\n' + 'the next frame\n' + ) + +class CUGLmap_flags(_FastEnum): + """ + Flags to map or unmap a resource + """ + + CU_GL_MAP_RESOURCE_FLAGS_NONE = cydriver.CUGLmap_flags_enum.CU_GL_MAP_RESOURCE_FLAGS_NONE + + CU_GL_MAP_RESOURCE_FLAGS_READ_ONLY = cydriver.CUGLmap_flags_enum.CU_GL_MAP_RESOURCE_FLAGS_READ_ONLY + + CU_GL_MAP_RESOURCE_FLAGS_WRITE_DISCARD = cydriver.CUGLmap_flags_enum.CU_GL_MAP_RESOURCE_FLAGS_WRITE_DISCARD + +cdef object _CUresult = CUresult +cdef object _CUresult_SUCCESS = CUresult.CUDA_SUCCESS + +cdef class CUdeviceptr: + """ + + CUDA device pointer CUdeviceptr is defined as an unsigned integer type whose size matches the size of a pointer on the target platform. + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, unsigned long long init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + if init_value: + self._pvt_ptr[0] = init_value + def __dealloc__(self): + pass + def __repr__(self): + return '' + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class CUdevice: + """ + + CUDA device + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, int init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + if init_value: + self._pvt_ptr[0] = init_value + def __dealloc__(self): + pass + def __repr__(self): + return '' + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class CUtexObject: + """ + + An opaque value that represents a CUDA texture object + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, unsigned long long init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + if init_value: + self._pvt_ptr[0] = init_value + def __dealloc__(self): + pass + def __repr__(self): + return '' + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class CUsurfObject: + """ + + An opaque value that represents a CUDA surface object + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, unsigned long long init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + if init_value: + self._pvt_ptr[0] = init_value + def __dealloc__(self): + pass + def __repr__(self): + return '' + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class CUgraphConditionalHandle: + """ + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, uint64_t init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + if init_value: + self._pvt_ptr[0] = init_value + def __dealloc__(self): + pass + def __repr__(self): + return '' + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +class CUkernelNodeAttrID(_FastEnum): + """ + Launch attributes enum; used as id field of + :py:obj:`~.CUlaunchAttribute` + """ + + + CU_LAUNCH_ATTRIBUTE_IGNORE = ( + cydriver.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_IGNORE, + 'Ignored entry, for convenient composition\n' + ) + + + CU_LAUNCH_ATTRIBUTE_ACCESS_POLICY_WINDOW = ( + cydriver.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_ACCESS_POLICY_WINDOW, + 'Valid for streams, graph nodes, launches. See\n' + ':py:obj:`~.CUlaunchAttributeValue.accessPolicyWindow`.\n' + ) + + + CU_LAUNCH_ATTRIBUTE_COOPERATIVE = ( + cydriver.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_COOPERATIVE, + 'Valid for graph nodes, launches. See\n' + ':py:obj:`~.CUlaunchAttributeValue.cooperative`.\n' + ) + + + CU_LAUNCH_ATTRIBUTE_SYNCHRONIZATION_POLICY = ( + cydriver.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_SYNCHRONIZATION_POLICY, + 'Valid for streams. See :py:obj:`~.CUlaunchAttributeValue.syncPolicy`.\n' + ) + + + CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION = ( + cydriver.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION, + 'Valid for graph nodes, launches. See\n' + ':py:obj:`~.CUlaunchAttributeValue.clusterDim`.\n' + ) + + + CU_LAUNCH_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE = ( + cydriver.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE, + 'Valid for graph nodes, launches. See\n' + ':py:obj:`~.CUlaunchAttributeValue.clusterSchedulingPolicyPreference`.\n' + ) + + + CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_STREAM_SERIALIZATION = ( + cydriver.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_STREAM_SERIALIZATION, + 'Valid for launches. Setting\n' + ':py:obj:`~.CUlaunchAttributeValue.programmaticStreamSerializationAllowed`\n' + 'to non-0 signals that the kernel will use programmatic means to resolve its\n' + 'stream dependency, so that the CUDA runtime should opportunistically allow\n' + "the grid's execution to overlap with the previous kernel in the stream, if\n" + 'that kernel requests the overlap. The dependent launches can choose to wait\n' + 'on the dependency using the programmatic sync\n' + '(cudaGridDependencySynchronize() or equivalent PTX instructions).\n' + ) + + + CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_EVENT = ( + cydriver.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_EVENT, + 'Valid for launches. Set\n' + ':py:obj:`~.CUlaunchAttributeValue.programmaticEvent` to record the event.\n' + 'Event recorded through this launch attribute is guaranteed to only trigger\n' + 'after all block in the associated kernel trigger the event. A block can\n' + 'trigger the event through PTX launchdep.release or CUDA builtin function\n' + 'cudaTriggerProgrammaticLaunchCompletion(). A trigger can also be inserted\n' + "at the beginning of each block's execution if triggerAtBlockStart is set to\n" + 'non-0. The dependent launches can choose to wait on the dependency using\n' + 'the programmatic sync (cudaGridDependencySynchronize() or equivalent PTX\n' + 'instructions). Note that dependents (including the CPU thread calling\n' + ':py:obj:`~.cuEventSynchronize()`) are not guaranteed to observe the release\n' + 'precisely when it is released. For example,\n' + ':py:obj:`~.cuEventSynchronize()` may only observe the event trigger long\n' + 'after the associated kernel has completed. This recording type is primarily\n' + 'meant for establishing programmatic dependency between device tasks. Note\n' + 'also this type of dependency allows, but does not guarantee, concurrent\n' + 'execution of tasks.\n' + ' The event supplied must not be an interprocess or interop event. The event\n' + 'must disable timing (i.e. must be created with the\n' + ':py:obj:`~.CU_EVENT_DISABLE_TIMING` flag set).\n' + ) + + + CU_LAUNCH_ATTRIBUTE_PRIORITY = ( + cydriver.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_PRIORITY, + 'Valid for streams, graph nodes, launches. See\n' + ':py:obj:`~.CUlaunchAttributeValue.priority`.\n' + ) + + + CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP = ( + cydriver.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP, + 'Valid for streams, graph nodes, launches. See\n' + ':py:obj:`~.CUlaunchAttributeValue.memSyncDomainMap`.\n' + ) + + + CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN = ( + cydriver.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN, + 'Valid for streams, graph nodes, launches. See\n' + ':py:obj:`~.CUlaunchAttributeValue.memSyncDomain`.\n' + ) + + + CU_LAUNCH_ATTRIBUTE_PREFERRED_CLUSTER_DIMENSION = ( + cydriver.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_PREFERRED_CLUSTER_DIMENSION, + 'Valid for graph nodes, launches. Set\n' + ':py:obj:`~.CUlaunchAttributeValue.preferredClusterDim` to allow the kernel\n' + 'launch to specify a preferred substitute cluster dimension. Blocks may be\n' + 'grouped according to either the dimensions specified with this attribute\n' + '(grouped into a "preferred substitute cluster"), or the one specified with\n' + ':py:obj:`~.CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION` attribute (grouped into a\n' + '"regular cluster"). The cluster dimensions of a "preferred substitute\n' + 'cluster" shall be an integer multiple greater than zero of the regular\n' + 'cluster dimensions. The device will attempt - on a best-effort basis - to\n' + 'group thread blocks into preferred clusters over grouping them into regular\n' + 'clusters. When it deems necessary (primarily when the device temporarily\n' + 'runs out of physical resources to launch the larger preferred clusters),\n' + 'the device may switch to launch the regular clusters instead to attempt to\n' + 'utilize as much of the physical device resources as possible.\n' + ' Each type of cluster will have its enumeration / coordinate setup as if\n' + 'the grid consists solely of its type of cluster. For example, if the\n' + 'preferred substitute cluster dimensions double the regular cluster\n' + 'dimensions, there might be simultaneously a regular cluster indexed at\n' + '(1,0,0), and a preferred cluster indexed at (1,0,0). In this example, the\n' + 'preferred substitute cluster (1,0,0) replaces regular clusters (2,0,0) and\n' + '(3,0,0) and groups their blocks.\n' + ' This attribute will only take effect when a regular cluster dimension has\n' + 'been specified. The preferred substitute cluster dimension must be an\n' + 'integer multiple greater than zero of the regular cluster dimension and\n' + 'must divide the grid. It must also be no more than `maxBlocksPerCluster`,\n' + "if it is set in the kernel's `__launch_bounds__`. Otherwise it must be less\n" + 'than the maximum value the driver can support. Otherwise, setting this\n' + 'attribute to a value physically unable to fit on any particular device is\n' + 'permitted.\n' + ) + + + CU_LAUNCH_ATTRIBUTE_LAUNCH_COMPLETION_EVENT = ( + cydriver.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_LAUNCH_COMPLETION_EVENT, + 'Valid for launches. Set\n' + ':py:obj:`~.CUlaunchAttributeValue.launchCompletionEvent` to record the\n' + 'event.\n' + ' Nominally, the event is triggered once all blocks of the kernel have begun\n' + 'execution. Currently this is a best effort. If a kernel B has a launch\n' + 'completion dependency on a kernel A, B may wait until A is complete.\n' + 'Alternatively, blocks of B may begin before all blocks of A have begun, for\n' + 'example if B can claim execution resources unavailable to A (e.g. they run\n' + 'on different GPUs) or if B is a higher priority than A. Exercise caution if\n' + 'such an ordering inversion could lead to deadlock.\n' + ' A launch completion event is nominally similar to a programmatic event\n' + 'with `triggerAtBlockStart` set except that it is not visible to\n' + '`cudaGridDependencySynchronize()` and can be used with compute capability\n' + 'less than 9.0.\n' + ' The event supplied must not be an interprocess or interop event. The event\n' + 'must disable timing (i.e. must be created with the\n' + ':py:obj:`~.CU_EVENT_DISABLE_TIMING` flag set).\n' + ) + + + CU_LAUNCH_ATTRIBUTE_DEVICE_UPDATABLE_KERNEL_NODE = ( + cydriver.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_DEVICE_UPDATABLE_KERNEL_NODE, + 'Valid for graph nodes, launches. This attribute is graphs-only, and passing\n' + 'it to a launch in a non-capturing stream will result in an error.\n' + ':py:obj:`~.CUlaunchAttributeValue.deviceUpdatableKernelNode.deviceUpdatable`\n' + 'can only be set to 0 or 1. Setting the field to 1 indicates that the\n' + 'corresponding kernel node should be device-updatable. On success, a handle\n' + 'will be returned via\n' + ':py:obj:`~.CUlaunchAttributeValue.deviceUpdatableKernelNode.devNode` which\n' + 'can be passed to the various device-side update functions to update the\n' + "node's kernel parameters from within another kernel. For more information\n" + 'on the types of device updates that can be made, as well as the relevant\n' + 'limitations thereof, see :py:obj:`~.cudaGraphKernelNodeUpdatesApply`.\n' + ' Nodes which are device-updatable have additional restrictions compared to\n' + 'regular kernel nodes. Firstly, device-updatable nodes cannot be removed\n' + 'from their graph via :py:obj:`~.cuGraphDestroyNode`. Additionally, once\n' + 'opted-in to this functionality, a node cannot opt out, and any attempt to\n' + 'set the deviceUpdatable attribute to 0 will result in an error. Device-\n' + 'updatable kernel nodes also cannot have their attributes copied to/from\n' + 'another kernel node via :py:obj:`~.cuGraphKernelNodeCopyAttributes`. Graphs\n' + 'containing one or more device-updatable nodes also do not allow multiple\n' + 'instantiation, and neither the graph nor its instantiated version can be\n' + 'passed to :py:obj:`~.cuGraphExecUpdate`.\n' + ' If a graph contains device-updatable nodes and updates those nodes from\n' + 'the device from within the graph, the graph must be uploaded with\n' + ':py:obj:`~.cuGraphUpload` before it is launched. For such a graph, if host-\n' + 'side executable graph updates are made to the device-updatable nodes, the\n' + 'graph must be uploaded before it is launched again.\n' + ) + + + CU_LAUNCH_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT = ( + cydriver.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT, + 'Valid for launches. On devices where the L1 cache and shared memory use the\n' + 'same hardware resources, setting\n' + ':py:obj:`~.CUlaunchAttributeValue.sharedMemCarveout` to a percentage\n' + 'between 0-100 signals the CUDA driver to set the shared memory carveout\n' + 'preference, in percent of the total shared memory for that kernel launch.\n' + 'This attribute takes precedence over\n' + ':py:obj:`~.CU_FUNC_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT`. This is\n' + 'only a hint, and the CUDA driver can choose a different configuration if\n' + 'required for the launch.\n' + ) + + + CU_LAUNCH_ATTRIBUTE_NVLINK_UTIL_CENTRIC_SCHEDULING = ( + cydriver.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_NVLINK_UTIL_CENTRIC_SCHEDULING, + 'Valid for streams, graph nodes, launches. This attribute is a hint to the\n' + 'CUDA runtime that the launch should attempt to make the kernel maximize its\n' + 'NVLINK utilization.\n' + ' When possible to honor this hint, CUDA will assume each block in the grid\n' + 'launch will carry out an even amount of NVLINK traffic, and make a best-\n' + 'effort attempt to adjust the kernel launch based on that assumption.\n' + ' This attribute is a hint only. CUDA makes no functional or performance\n' + 'guarantee. Its applicability can be affected by many different factors,\n' + "including driver version (i.e. CUDA doesn't guarantee the performance\n" + 'characteristics will be maintained between driver versions or a driver\n' + 'update could alter or regress previously observed perf characteristics.) It\n' + "also doesn't guarantee a successful result, i.e. applying the attribute may\n" + 'not improve the performance of either the targeted kernel or the\n' + 'encapsulating application.\n' + ' Valid values for\n' + ':py:obj:`~.CUlaunchAttributeValue.nvlinkUtilCentricScheduling` are 0\n' + '(disabled) and 1 (enabled).\n' + ) + + + CU_LAUNCH_ATTRIBUTE_PORTABLE_CLUSTER_SIZE_MODE = ( + cydriver.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_PORTABLE_CLUSTER_SIZE_MODE, + 'Valid for graph nodes, launches. This controls whether the kernel launch is\n' + 'allowed to use a non-portable cluster size. Valid values for\n' + ':py:obj:`~.CUlaunchAttributeValue.portableClusterSizeMode` are described in\n' + ':py:obj:`~.CUlaunchAttributePortableClusterMode`. Any other value will\n' + 'return :py:obj:`~.CUDA_ERROR_INVALID_VALUE`\n' + ) + + + CU_LAUNCH_ATTRIBUTE_SHARED_MEMORY_MODE = ( + cydriver.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_SHARED_MEMORY_MODE, + 'Valid for graph nodes, launches. This indicates if the kernel is allowed to\n' + 'use a non-portable dynamic shared memory mode.\n' + ) + +class CUstreamAttrID(_FastEnum): + """ + Launch attributes enum; used as id field of + :py:obj:`~.CUlaunchAttribute` + """ + + + CU_LAUNCH_ATTRIBUTE_IGNORE = ( + cydriver.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_IGNORE, + 'Ignored entry, for convenient composition\n' + ) + + + CU_LAUNCH_ATTRIBUTE_ACCESS_POLICY_WINDOW = ( + cydriver.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_ACCESS_POLICY_WINDOW, + 'Valid for streams, graph nodes, launches. See\n' + ':py:obj:`~.CUlaunchAttributeValue.accessPolicyWindow`.\n' + ) + + + CU_LAUNCH_ATTRIBUTE_COOPERATIVE = ( + cydriver.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_COOPERATIVE, + 'Valid for graph nodes, launches. See\n' + ':py:obj:`~.CUlaunchAttributeValue.cooperative`.\n' + ) + + + CU_LAUNCH_ATTRIBUTE_SYNCHRONIZATION_POLICY = ( + cydriver.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_SYNCHRONIZATION_POLICY, + 'Valid for streams. See :py:obj:`~.CUlaunchAttributeValue.syncPolicy`.\n' + ) + + + CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION = ( + cydriver.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION, + 'Valid for graph nodes, launches. See\n' + ':py:obj:`~.CUlaunchAttributeValue.clusterDim`.\n' + ) + + + CU_LAUNCH_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE = ( + cydriver.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE, + 'Valid for graph nodes, launches. See\n' + ':py:obj:`~.CUlaunchAttributeValue.clusterSchedulingPolicyPreference`.\n' + ) + + + CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_STREAM_SERIALIZATION = ( + cydriver.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_STREAM_SERIALIZATION, + 'Valid for launches. Setting\n' + ':py:obj:`~.CUlaunchAttributeValue.programmaticStreamSerializationAllowed`\n' + 'to non-0 signals that the kernel will use programmatic means to resolve its\n' + 'stream dependency, so that the CUDA runtime should opportunistically allow\n' + "the grid's execution to overlap with the previous kernel in the stream, if\n" + 'that kernel requests the overlap. The dependent launches can choose to wait\n' + 'on the dependency using the programmatic sync\n' + '(cudaGridDependencySynchronize() or equivalent PTX instructions).\n' + ) + + + CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_EVENT = ( + cydriver.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_EVENT, + 'Valid for launches. Set\n' + ':py:obj:`~.CUlaunchAttributeValue.programmaticEvent` to record the event.\n' + 'Event recorded through this launch attribute is guaranteed to only trigger\n' + 'after all block in the associated kernel trigger the event. A block can\n' + 'trigger the event through PTX launchdep.release or CUDA builtin function\n' + 'cudaTriggerProgrammaticLaunchCompletion(). A trigger can also be inserted\n' + "at the beginning of each block's execution if triggerAtBlockStart is set to\n" + 'non-0. The dependent launches can choose to wait on the dependency using\n' + 'the programmatic sync (cudaGridDependencySynchronize() or equivalent PTX\n' + 'instructions). Note that dependents (including the CPU thread calling\n' + ':py:obj:`~.cuEventSynchronize()`) are not guaranteed to observe the release\n' + 'precisely when it is released. For example,\n' + ':py:obj:`~.cuEventSynchronize()` may only observe the event trigger long\n' + 'after the associated kernel has completed. This recording type is primarily\n' + 'meant for establishing programmatic dependency between device tasks. Note\n' + 'also this type of dependency allows, but does not guarantee, concurrent\n' + 'execution of tasks.\n' + ' The event supplied must not be an interprocess or interop event. The event\n' + 'must disable timing (i.e. must be created with the\n' + ':py:obj:`~.CU_EVENT_DISABLE_TIMING` flag set).\n' + ) + + + CU_LAUNCH_ATTRIBUTE_PRIORITY = ( + cydriver.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_PRIORITY, + 'Valid for streams, graph nodes, launches. See\n' + ':py:obj:`~.CUlaunchAttributeValue.priority`.\n' + ) + + + CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP = ( + cydriver.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP, + 'Valid for streams, graph nodes, launches. See\n' + ':py:obj:`~.CUlaunchAttributeValue.memSyncDomainMap`.\n' + ) + + + CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN = ( + cydriver.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN, + 'Valid for streams, graph nodes, launches. See\n' + ':py:obj:`~.CUlaunchAttributeValue.memSyncDomain`.\n' + ) + + + CU_LAUNCH_ATTRIBUTE_PREFERRED_CLUSTER_DIMENSION = ( + cydriver.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_PREFERRED_CLUSTER_DIMENSION, + 'Valid for graph nodes, launches. Set\n' + ':py:obj:`~.CUlaunchAttributeValue.preferredClusterDim` to allow the kernel\n' + 'launch to specify a preferred substitute cluster dimension. Blocks may be\n' + 'grouped according to either the dimensions specified with this attribute\n' + '(grouped into a "preferred substitute cluster"), or the one specified with\n' + ':py:obj:`~.CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION` attribute (grouped into a\n' + '"regular cluster"). The cluster dimensions of a "preferred substitute\n' + 'cluster" shall be an integer multiple greater than zero of the regular\n' + 'cluster dimensions. The device will attempt - on a best-effort basis - to\n' + 'group thread blocks into preferred clusters over grouping them into regular\n' + 'clusters. When it deems necessary (primarily when the device temporarily\n' + 'runs out of physical resources to launch the larger preferred clusters),\n' + 'the device may switch to launch the regular clusters instead to attempt to\n' + 'utilize as much of the physical device resources as possible.\n' + ' Each type of cluster will have its enumeration / coordinate setup as if\n' + 'the grid consists solely of its type of cluster. For example, if the\n' + 'preferred substitute cluster dimensions double the regular cluster\n' + 'dimensions, there might be simultaneously a regular cluster indexed at\n' + '(1,0,0), and a preferred cluster indexed at (1,0,0). In this example, the\n' + 'preferred substitute cluster (1,0,0) replaces regular clusters (2,0,0) and\n' + '(3,0,0) and groups their blocks.\n' + ' This attribute will only take effect when a regular cluster dimension has\n' + 'been specified. The preferred substitute cluster dimension must be an\n' + 'integer multiple greater than zero of the regular cluster dimension and\n' + 'must divide the grid. It must also be no more than `maxBlocksPerCluster`,\n' + "if it is set in the kernel's `__launch_bounds__`. Otherwise it must be less\n" + 'than the maximum value the driver can support. Otherwise, setting this\n' + 'attribute to a value physically unable to fit on any particular device is\n' + 'permitted.\n' + ) + + + CU_LAUNCH_ATTRIBUTE_LAUNCH_COMPLETION_EVENT = ( + cydriver.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_LAUNCH_COMPLETION_EVENT, + 'Valid for launches. Set\n' + ':py:obj:`~.CUlaunchAttributeValue.launchCompletionEvent` to record the\n' + 'event.\n' + ' Nominally, the event is triggered once all blocks of the kernel have begun\n' + 'execution. Currently this is a best effort. If a kernel B has a launch\n' + 'completion dependency on a kernel A, B may wait until A is complete.\n' + 'Alternatively, blocks of B may begin before all blocks of A have begun, for\n' + 'example if B can claim execution resources unavailable to A (e.g. they run\n' + 'on different GPUs) or if B is a higher priority than A. Exercise caution if\n' + 'such an ordering inversion could lead to deadlock.\n' + ' A launch completion event is nominally similar to a programmatic event\n' + 'with `triggerAtBlockStart` set except that it is not visible to\n' + '`cudaGridDependencySynchronize()` and can be used with compute capability\n' + 'less than 9.0.\n' + ' The event supplied must not be an interprocess or interop event. The event\n' + 'must disable timing (i.e. must be created with the\n' + ':py:obj:`~.CU_EVENT_DISABLE_TIMING` flag set).\n' + ) + + + CU_LAUNCH_ATTRIBUTE_DEVICE_UPDATABLE_KERNEL_NODE = ( + cydriver.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_DEVICE_UPDATABLE_KERNEL_NODE, + 'Valid for graph nodes, launches. This attribute is graphs-only, and passing\n' + 'it to a launch in a non-capturing stream will result in an error.\n' + ':py:obj:`~.CUlaunchAttributeValue.deviceUpdatableKernelNode.deviceUpdatable`\n' + 'can only be set to 0 or 1. Setting the field to 1 indicates that the\n' + 'corresponding kernel node should be device-updatable. On success, a handle\n' + 'will be returned via\n' + ':py:obj:`~.CUlaunchAttributeValue.deviceUpdatableKernelNode.devNode` which\n' + 'can be passed to the various device-side update functions to update the\n' + "node's kernel parameters from within another kernel. For more information\n" + 'on the types of device updates that can be made, as well as the relevant\n' + 'limitations thereof, see :py:obj:`~.cudaGraphKernelNodeUpdatesApply`.\n' + ' Nodes which are device-updatable have additional restrictions compared to\n' + 'regular kernel nodes. Firstly, device-updatable nodes cannot be removed\n' + 'from their graph via :py:obj:`~.cuGraphDestroyNode`. Additionally, once\n' + 'opted-in to this functionality, a node cannot opt out, and any attempt to\n' + 'set the deviceUpdatable attribute to 0 will result in an error. Device-\n' + 'updatable kernel nodes also cannot have their attributes copied to/from\n' + 'another kernel node via :py:obj:`~.cuGraphKernelNodeCopyAttributes`. Graphs\n' + 'containing one or more device-updatable nodes also do not allow multiple\n' + 'instantiation, and neither the graph nor its instantiated version can be\n' + 'passed to :py:obj:`~.cuGraphExecUpdate`.\n' + ' If a graph contains device-updatable nodes and updates those nodes from\n' + 'the device from within the graph, the graph must be uploaded with\n' + ':py:obj:`~.cuGraphUpload` before it is launched. For such a graph, if host-\n' + 'side executable graph updates are made to the device-updatable nodes, the\n' + 'graph must be uploaded before it is launched again.\n' + ) + + + CU_LAUNCH_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT = ( + cydriver.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT, + 'Valid for launches. On devices where the L1 cache and shared memory use the\n' + 'same hardware resources, setting\n' + ':py:obj:`~.CUlaunchAttributeValue.sharedMemCarveout` to a percentage\n' + 'between 0-100 signals the CUDA driver to set the shared memory carveout\n' + 'preference, in percent of the total shared memory for that kernel launch.\n' + 'This attribute takes precedence over\n' + ':py:obj:`~.CU_FUNC_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT`. This is\n' + 'only a hint, and the CUDA driver can choose a different configuration if\n' + 'required for the launch.\n' + ) + + + CU_LAUNCH_ATTRIBUTE_NVLINK_UTIL_CENTRIC_SCHEDULING = ( + cydriver.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_NVLINK_UTIL_CENTRIC_SCHEDULING, + 'Valid for streams, graph nodes, launches. This attribute is a hint to the\n' + 'CUDA runtime that the launch should attempt to make the kernel maximize its\n' + 'NVLINK utilization.\n' + ' When possible to honor this hint, CUDA will assume each block in the grid\n' + 'launch will carry out an even amount of NVLINK traffic, and make a best-\n' + 'effort attempt to adjust the kernel launch based on that assumption.\n' + ' This attribute is a hint only. CUDA makes no functional or performance\n' + 'guarantee. Its applicability can be affected by many different factors,\n' + "including driver version (i.e. CUDA doesn't guarantee the performance\n" + 'characteristics will be maintained between driver versions or a driver\n' + 'update could alter or regress previously observed perf characteristics.) It\n' + "also doesn't guarantee a successful result, i.e. applying the attribute may\n" + 'not improve the performance of either the targeted kernel or the\n' + 'encapsulating application.\n' + ' Valid values for\n' + ':py:obj:`~.CUlaunchAttributeValue.nvlinkUtilCentricScheduling` are 0\n' + '(disabled) and 1 (enabled).\n' + ) + + + CU_LAUNCH_ATTRIBUTE_PORTABLE_CLUSTER_SIZE_MODE = ( + cydriver.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_PORTABLE_CLUSTER_SIZE_MODE, + 'Valid for graph nodes, launches. This controls whether the kernel launch is\n' + 'allowed to use a non-portable cluster size. Valid values for\n' + ':py:obj:`~.CUlaunchAttributeValue.portableClusterSizeMode` are described in\n' + ':py:obj:`~.CUlaunchAttributePortableClusterMode`. Any other value will\n' + 'return :py:obj:`~.CUDA_ERROR_INVALID_VALUE`\n' + ) + + + CU_LAUNCH_ATTRIBUTE_SHARED_MEMORY_MODE = ( + cydriver.CUlaunchAttributeID_enum.CU_LAUNCH_ATTRIBUTE_SHARED_MEMORY_MODE, + 'Valid for graph nodes, launches. This indicates if the kernel is allowed to\n' + 'use a non-portable dynamic shared memory mode.\n' + ) + +cdef class CUmemGenericAllocationHandle: + """ + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, unsigned long long init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + if init_value: + self._pvt_ptr[0] = init_value + def __dealloc__(self): + pass + def __repr__(self): + return '' + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class CUlogicalEndpointId: + """ + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, uint32_t init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + if init_value: + self._pvt_ptr[0] = init_value + def __dealloc__(self): + pass + def __repr__(self): + return '' + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class CUcontext: + """ + + A regular context handle + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __eq__(self, other): + if not isinstance(other, CUcontext): + return False + return self._pvt_ptr[0] == (other)._pvt_ptr[0] + def __hash__(self): + return hash((self._pvt_ptr[0])) + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class CUmodule: + """ + + CUDA module + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __eq__(self, other): + if not isinstance(other, CUmodule): + return False + return self._pvt_ptr[0] == (other)._pvt_ptr[0] + def __hash__(self): + return hash((self._pvt_ptr[0])) + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class CUfunction: + """ + + CUDA function + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __eq__(self, other): + if not isinstance(other, CUfunction): + return False + return self._pvt_ptr[0] == (other)._pvt_ptr[0] + def __hash__(self): + return hash((self._pvt_ptr[0])) + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class CUlibrary: + """ + + CUDA library + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __eq__(self, other): + if not isinstance(other, CUlibrary): + return False + return self._pvt_ptr[0] == (other)._pvt_ptr[0] + def __hash__(self): + return hash((self._pvt_ptr[0])) + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class CUkernel: + """ + + CUDA kernel + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __eq__(self, other): + if not isinstance(other, CUkernel): + return False + return self._pvt_ptr[0] == (other)._pvt_ptr[0] + def __hash__(self): + return hash((self._pvt_ptr[0])) + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class CUarray: + """ + + CUDA array + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __eq__(self, other): + if not isinstance(other, CUarray): + return False + return self._pvt_ptr[0] == (other)._pvt_ptr[0] + def __hash__(self): + return hash((self._pvt_ptr[0])) + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class CUmipmappedArray: + """ + + CUDA mipmapped array + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __eq__(self, other): + if not isinstance(other, CUmipmappedArray): + return False + return self._pvt_ptr[0] == (other)._pvt_ptr[0] + def __hash__(self): + return hash((self._pvt_ptr[0])) + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class CUtexref: + """ + + CUDA texture reference + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __eq__(self, other): + if not isinstance(other, CUtexref): + return False + return self._pvt_ptr[0] == (other)._pvt_ptr[0] + def __hash__(self): + return hash((self._pvt_ptr[0])) + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class CUsurfref: + """ + + CUDA surface reference + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __eq__(self, other): + if not isinstance(other, CUsurfref): + return False + return self._pvt_ptr[0] == (other)._pvt_ptr[0] + def __hash__(self): + return hash((self._pvt_ptr[0])) + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class CUevent: + """ + + CUDA event + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __eq__(self, other): + if not isinstance(other, CUevent): + return False + return self._pvt_ptr[0] == (other)._pvt_ptr[0] + def __hash__(self): + return hash((self._pvt_ptr[0])) + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class CUstream: + """ + + CUDA stream + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __eq__(self, other): + if not isinstance(other, CUstream): + return False + return self._pvt_ptr[0] == (other)._pvt_ptr[0] + def __hash__(self): + return hash((self._pvt_ptr[0])) + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + def __cuda_stream__(self): + return (0, (self._pvt_ptr[0])) + +cdef class CUgraphicsResource: + """ + + CUDA graphics interop resource + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __eq__(self, other): + if not isinstance(other, CUgraphicsResource): + return False + return self._pvt_ptr[0] == (other)._pvt_ptr[0] + def __hash__(self): + return hash((self._pvt_ptr[0])) + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class CUexternalMemory: + """ + + CUDA external memory + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __eq__(self, other): + if not isinstance(other, CUexternalMemory): + return False + return self._pvt_ptr[0] == (other)._pvt_ptr[0] + def __hash__(self): + return hash((self._pvt_ptr[0])) + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class CUexternalSemaphore: + """ + + CUDA external semaphore + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __eq__(self, other): + if not isinstance(other, CUexternalSemaphore): + return False + return self._pvt_ptr[0] == (other)._pvt_ptr[0] + def __hash__(self): + return hash((self._pvt_ptr[0])) + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class CUgraph: + """ + + CUDA graph + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __eq__(self, other): + if not isinstance(other, CUgraph): + return False + return self._pvt_ptr[0] == (other)._pvt_ptr[0] + def __hash__(self): + return hash((self._pvt_ptr[0])) + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class CUgraphNode: + """ + + CUDA graph node + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __eq__(self, other): + if not isinstance(other, CUgraphNode): + return False + return self._pvt_ptr[0] == (other)._pvt_ptr[0] + def __hash__(self): + return hash((self._pvt_ptr[0])) + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class CUgraphExec: + """ + + CUDA executable graph + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __eq__(self, other): + if not isinstance(other, CUgraphExec): + return False + return self._pvt_ptr[0] == (other)._pvt_ptr[0] + def __hash__(self): + return hash((self._pvt_ptr[0])) + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class CUmemoryPool: + """ + + CUDA memory pool + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __eq__(self, other): + if not isinstance(other, CUmemoryPool): + return False + return self._pvt_ptr[0] == (other)._pvt_ptr[0] + def __hash__(self): + return hash((self._pvt_ptr[0])) + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class CUuserObject: + """ + + CUDA user object for graphs + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __eq__(self, other): + if not isinstance(other, CUuserObject): + return False + return self._pvt_ptr[0] == (other)._pvt_ptr[0] + def __hash__(self): + return hash((self._pvt_ptr[0])) + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class CUgraphDeviceNode: + """ + + CUDA graph device node handle + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __eq__(self, other): + if not isinstance(other, CUgraphDeviceNode): + return False + return self._pvt_ptr[0] == (other)._pvt_ptr[0] + def __hash__(self): + return hash((self._pvt_ptr[0])) + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class CUasyncCallbackHandle: + """ + + CUDA async notification callback handle + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __eq__(self, other): + if not isinstance(other, CUasyncCallbackHandle): + return False + return self._pvt_ptr[0] == (other)._pvt_ptr[0] + def __hash__(self): + return hash((self._pvt_ptr[0])) + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class CUgreenCtx: + """ + + A green context handle. This handle can be used safely from only one CPU thread at a time. Created via cuGreenCtxCreate + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __eq__(self, other): + if not isinstance(other, CUgreenCtx): + return False + return self._pvt_ptr[0] == (other)._pvt_ptr[0] + def __hash__(self): + return hash((self._pvt_ptr[0])) + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class CUlinkState: + """ + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + self._keepalive = [] + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __eq__(self, other): + if not isinstance(other, CUlinkState): + return False + return self._pvt_ptr[0] == (other)._pvt_ptr[0] + def __hash__(self): + return hash((self._pvt_ptr[0])) + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class CUcoredumpCallbackHandle: + """ Opaque handle representing a registered coredump status callback. + + This handle is returned when registering a callback and must be provided when deregistering the callback. + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __eq__(self, other): + if not isinstance(other, CUcoredumpCallbackHandle): + return False + return self._pvt_ptr[0] == (other)._pvt_ptr[0] + def __hash__(self): + return hash((self._pvt_ptr[0])) + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class CUdevResourceDesc: + """ + + An opaque descriptor handle. The descriptor encapsulates multiple created and configured resources. Created via cuDevResourceGenerateDesc + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __eq__(self, other): + if not isinstance(other, CUdevResourceDesc): + return False + return self._pvt_ptr[0] == (other)._pvt_ptr[0] + def __hash__(self): + return hash((self._pvt_ptr[0])) + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class CUlogsCallbackHandle: + """ + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __eq__(self, other): + if not isinstance(other, CUlogsCallbackHandle): + return False + return self._pvt_ptr[0] == (other)._pvt_ptr[0] + def __hash__(self): + return hash((self._pvt_ptr[0])) + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class CUeglStreamConnection: + """ + + CUDA EGLSream Connection + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __eq__(self, other): + if not isinstance(other, CUeglStreamConnection): + return False + return self._pvt_ptr[0] == (other)._pvt_ptr[0] + def __hash__(self): + return hash((self._pvt_ptr[0])) + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class EGLImageKHR: + """ + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __eq__(self, other): + if not isinstance(other, EGLImageKHR): + return False + return self._pvt_ptr[0] == (other)._pvt_ptr[0] + def __hash__(self): + return hash((self._pvt_ptr[0])) + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class EGLStreamKHR: + """ + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __eq__(self, other): + if not isinstance(other, EGLStreamKHR): + return False + return self._pvt_ptr[0] == (other)._pvt_ptr[0] + def __hash__(self): + return hash((self._pvt_ptr[0])) + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class EGLSyncKHR: + """ + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __eq__(self, other): + if not isinstance(other, EGLSyncKHR): + return False + return self._pvt_ptr[0] == (other)._pvt_ptr[0] + def __hash__(self): + return hash((self._pvt_ptr[0])) + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class CUasyncCallback: + """ + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class CUhostFn: + """ + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class CUstreamCallback: + """ + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class CUoccupancyB2DSize: + """ + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class CUgraphRecaptureCallback: + """ + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class CUcoredumpStatusCallback: + """ + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class CUlogsCallback: + """ + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class CUuuid_st: + """ + Attributes + ---------- + + bytes : bytes + < CUDA definition of UUID + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass + def __dealloc__(self): + pass + def getPtr(self): + return self._pvt_ptr + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['bytes : ' + str(self.bytes.hex())] + except ValueError: + str_list += ['bytes : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def bytes(self): + return PyBytes_FromStringAndSize(self._pvt_ptr[0].bytes, 16) + + +cdef class CUmemFabricHandle_st: + """ + Fabric handle - An opaque handle representing a memory allocation + that can be exported to processes in same or different nodes. For + IPC between processes on different nodes they must be connected via + the NVSwitch fabric. + + Attributes + ---------- + + data : bytes + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass + def __dealloc__(self): + pass + def getPtr(self): + return self._pvt_ptr + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['data : ' + str(self.data)] + except ValueError: + str_list += ['data : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def data(self): + return PyBytes_FromStringAndSize(self._pvt_ptr[0].data, 64) + @data.setter + def data(self, data): + if len(data) != 64: + raise ValueError("data length must be 64, is " + str(len(data))) + for i, b in enumerate(data): + self._pvt_ptr[0].data[i] = b + + +cdef class CUipcEventHandle_st: + """ + CUDA IPC event handle + + Attributes + ---------- + + reserved : bytes + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass + def __dealloc__(self): + pass + def getPtr(self): + return self._pvt_ptr + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['reserved : ' + str(self.reserved)] + except ValueError: + str_list += ['reserved : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def reserved(self): + return PyBytes_FromStringAndSize(self._pvt_ptr[0].reserved, 64) + @reserved.setter + def reserved(self, reserved): + if len(reserved) != 64: + raise ValueError("reserved length must be 64, is " + str(len(reserved))) + if CHAR_MIN == 0: + for i, b in enumerate(reserved): + if b < 0 and b > -129: + b = b + 256 + self._pvt_ptr[0].reserved[i] = b + else: + for i, b in enumerate(reserved): + if b > 127 and b < 256: + b = b - 256 + self._pvt_ptr[0].reserved[i] = b + + +cdef class CUipcMemHandle_st: + """ + CUDA IPC mem handle + + Attributes + ---------- + + reserved : bytes + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass + def __dealloc__(self): + pass + def getPtr(self): + return self._pvt_ptr + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['reserved : ' + str(self.reserved)] + except ValueError: + str_list += ['reserved : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def reserved(self): + return PyBytes_FromStringAndSize(self._pvt_ptr[0].reserved, 64) + @reserved.setter + def reserved(self, reserved): + if len(reserved) != 64: + raise ValueError("reserved length must be 64, is " + str(len(reserved))) + if CHAR_MIN == 0: + for i, b in enumerate(reserved): + if b < 0 and b > -129: + b = b + 256 + self._pvt_ptr[0].reserved[i] = b + else: + for i, b in enumerate(reserved): + if b > 127 and b < 256: + b = b - 256 + self._pvt_ptr[0].reserved[i] = b + + +cdef class CUstreamMemOpWaitValueParams_st: + """ + Attributes + ---------- + + operation : CUstreamBatchMemOpType + + + + address : CUdeviceptr + + + + value : cuuint32_t + + + + value64 : cuuint64_t + + + + flags : unsigned int + See CUstreamWaitValue_flags. + + + alias : CUdeviceptr + For driver internal use. Initial value is unimportant. + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr): + self._pvt_ptr = _ptr + + def __init__(self, void_ptr _ptr): + pass + + self._address = CUdeviceptr(_ptr=&self._pvt_ptr[0].waitValue.address) + + + self._value = cuuint32_t(_ptr=&self._pvt_ptr[0].waitValue.value) + + + self._value64 = cuuint64_t(_ptr=&self._pvt_ptr[0].waitValue.value64) + + + self._alias = CUdeviceptr(_ptr=&self._pvt_ptr[0].waitValue.alias) + + def __dealloc__(self): + pass + def getPtr(self): + return &self._pvt_ptr[0].waitValue + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['operation : ' + str(self.operation)] + except ValueError: + str_list += ['operation : '] + + + try: + str_list += ['address : ' + str(self.address)] + except ValueError: + str_list += ['address : '] + + + try: + str_list += ['value : ' + str(self.value)] + except ValueError: + str_list += ['value : '] + + + try: + str_list += ['value64 : ' + str(self.value64)] + except ValueError: + str_list += ['value64 : '] + + + try: + str_list += ['flags : ' + str(self.flags)] + except ValueError: + str_list += ['flags : '] + + + try: + str_list += ['alias : ' + str(self.alias)] + except ValueError: + str_list += ['alias : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def operation(self): + return CUstreamBatchMemOpType(self._pvt_ptr[0].waitValue.operation) + @operation.setter + def operation(self, operation not None : CUstreamBatchMemOpType): + self._pvt_ptr[0].waitValue.operation = int(operation) + + + @property + def address(self): + return self._address + @address.setter + def address(self, address): + cdef cydriver.CUdeviceptr cyaddress + if address is None: + cyaddress = 0 + elif isinstance(address, (CUdeviceptr)): + paddress = int(address) + cyaddress = paddress + else: + paddress = int(CUdeviceptr(address)) + cyaddress = paddress + self._address._pvt_ptr[0] = cyaddress + + + + @property + def value(self): + return self._value + @value.setter + def value(self, value): + cdef cydriver.cuuint32_t cyvalue + if value is None: + cyvalue = 0 + elif isinstance(value, (cuuint32_t)): + pvalue = int(value) + cyvalue = pvalue + else: + pvalue = int(cuuint32_t(value)) + cyvalue = pvalue + self._value._pvt_ptr[0] = cyvalue + + + + @property + def value64(self): + return self._value64 + @value64.setter + def value64(self, value64): + cdef cydriver.cuuint64_t cyvalue64 + if value64 is None: + cyvalue64 = 0 + elif isinstance(value64, (cuuint64_t)): + pvalue64 = int(value64) + cyvalue64 = pvalue64 + else: + pvalue64 = int(cuuint64_t(value64)) + cyvalue64 = pvalue64 + self._value64._pvt_ptr[0] = cyvalue64 + + + + @property + def flags(self): + return self._pvt_ptr[0].waitValue.flags + @flags.setter + def flags(self, unsigned int flags): + self._pvt_ptr[0].waitValue.flags = flags + + + @property + def alias(self): + return self._alias + @alias.setter + def alias(self, alias): + cdef cydriver.CUdeviceptr cyalias + if alias is None: + cyalias = 0 + elif isinstance(alias, (CUdeviceptr)): + palias = int(alias) + cyalias = palias + else: + palias = int(CUdeviceptr(alias)) + cyalias = palias + self._alias._pvt_ptr[0] = cyalias + + + +cdef class CUstreamMemOpWriteValueParams_st: + """ + Attributes + ---------- + + operation : CUstreamBatchMemOpType + + + + address : CUdeviceptr + + + + value : cuuint32_t + + + + value64 : cuuint64_t + + + + flags : unsigned int + See CUstreamWriteValue_flags. + + + alias : CUdeviceptr + For driver internal use. Initial value is unimportant. + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr): + self._pvt_ptr = _ptr + + def __init__(self, void_ptr _ptr): + pass + + self._address = CUdeviceptr(_ptr=&self._pvt_ptr[0].writeValue.address) + + + self._value = cuuint32_t(_ptr=&self._pvt_ptr[0].writeValue.value) + + + self._value64 = cuuint64_t(_ptr=&self._pvt_ptr[0].writeValue.value64) + + + self._alias = CUdeviceptr(_ptr=&self._pvt_ptr[0].writeValue.alias) + + def __dealloc__(self): + pass + def getPtr(self): + return &self._pvt_ptr[0].writeValue + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['operation : ' + str(self.operation)] + except ValueError: + str_list += ['operation : '] + + + try: + str_list += ['address : ' + str(self.address)] + except ValueError: + str_list += ['address : '] + + + try: + str_list += ['value : ' + str(self.value)] + except ValueError: + str_list += ['value : '] + + + try: + str_list += ['value64 : ' + str(self.value64)] + except ValueError: + str_list += ['value64 : '] + + + try: + str_list += ['flags : ' + str(self.flags)] + except ValueError: + str_list += ['flags : '] + + + try: + str_list += ['alias : ' + str(self.alias)] + except ValueError: + str_list += ['alias : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def operation(self): + return CUstreamBatchMemOpType(self._pvt_ptr[0].writeValue.operation) + @operation.setter + def operation(self, operation not None : CUstreamBatchMemOpType): + self._pvt_ptr[0].writeValue.operation = int(operation) + + + @property + def address(self): + return self._address + @address.setter + def address(self, address): + cdef cydriver.CUdeviceptr cyaddress + if address is None: + cyaddress = 0 + elif isinstance(address, (CUdeviceptr)): + paddress = int(address) + cyaddress = paddress + else: + paddress = int(CUdeviceptr(address)) + cyaddress = paddress + self._address._pvt_ptr[0] = cyaddress + + + + @property + def value(self): + return self._value + @value.setter + def value(self, value): + cdef cydriver.cuuint32_t cyvalue + if value is None: + cyvalue = 0 + elif isinstance(value, (cuuint32_t)): + pvalue = int(value) + cyvalue = pvalue + else: + pvalue = int(cuuint32_t(value)) + cyvalue = pvalue + self._value._pvt_ptr[0] = cyvalue + + + + @property + def value64(self): + return self._value64 + @value64.setter + def value64(self, value64): + cdef cydriver.cuuint64_t cyvalue64 + if value64 is None: + cyvalue64 = 0 + elif isinstance(value64, (cuuint64_t)): + pvalue64 = int(value64) + cyvalue64 = pvalue64 + else: + pvalue64 = int(cuuint64_t(value64)) + cyvalue64 = pvalue64 + self._value64._pvt_ptr[0] = cyvalue64 + + + + @property + def flags(self): + return self._pvt_ptr[0].writeValue.flags + @flags.setter + def flags(self, unsigned int flags): + self._pvt_ptr[0].writeValue.flags = flags + + + @property + def alias(self): + return self._alias + @alias.setter + def alias(self, alias): + cdef cydriver.CUdeviceptr cyalias + if alias is None: + cyalias = 0 + elif isinstance(alias, (CUdeviceptr)): + palias = int(alias) + cyalias = palias + else: + palias = int(CUdeviceptr(alias)) + cyalias = palias + self._alias._pvt_ptr[0] = cyalias + + + +cdef class CUstreamMemOpFlushRemoteWritesParams_st: + """ + Attributes + ---------- + + operation : CUstreamBatchMemOpType + + + + flags : unsigned int + Must be 0. + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr): + self._pvt_ptr = _ptr + + def __init__(self, void_ptr _ptr): + pass + def __dealloc__(self): + pass + def getPtr(self): + return &self._pvt_ptr[0].flushRemoteWrites + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['operation : ' + str(self.operation)] + except ValueError: + str_list += ['operation : '] + + + try: + str_list += ['flags : ' + str(self.flags)] + except ValueError: + str_list += ['flags : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def operation(self): + return CUstreamBatchMemOpType(self._pvt_ptr[0].flushRemoteWrites.operation) + @operation.setter + def operation(self, operation not None : CUstreamBatchMemOpType): + self._pvt_ptr[0].flushRemoteWrites.operation = int(operation) + + + @property + def flags(self): + return self._pvt_ptr[0].flushRemoteWrites.flags + @flags.setter + def flags(self, unsigned int flags): + self._pvt_ptr[0].flushRemoteWrites.flags = flags + + +cdef class CUstreamMemOpMemoryBarrierParams_st: + """ + Attributes + ---------- + + operation : CUstreamBatchMemOpType + < Only supported in the _v2 API + + + flags : unsigned int + See CUstreamMemoryBarrier_flags + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr): + self._pvt_ptr = _ptr + + def __init__(self, void_ptr _ptr): + pass + def __dealloc__(self): + pass + def getPtr(self): + return &self._pvt_ptr[0].memoryBarrier + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['operation : ' + str(self.operation)] + except ValueError: + str_list += ['operation : '] + + + try: + str_list += ['flags : ' + str(self.flags)] + except ValueError: + str_list += ['flags : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def operation(self): + return CUstreamBatchMemOpType(self._pvt_ptr[0].memoryBarrier.operation) + @operation.setter + def operation(self, operation not None : CUstreamBatchMemOpType): + self._pvt_ptr[0].memoryBarrier.operation = int(operation) + + + @property + def flags(self): + return self._pvt_ptr[0].memoryBarrier.flags + @flags.setter + def flags(self, unsigned int flags): + self._pvt_ptr[0].memoryBarrier.flags = flags + + +cdef class CUstreamMemOpAtomicReductionParams_st: + """ + Attributes + ---------- + + operation : CUstreamBatchMemOpType + + + + flags : unsigned int + Must be 0 + + + reductionOp : CUstreamAtomicReductionOpType + See CUstreamAtomicReductionOpType + + + dataType : CUstreamAtomicReductionDataType + See CUstreamAtomicReductionDataType + + + address : CUdeviceptr + The address the atomic operation will be operated on + + + value : cuuint64_t + The operand value the atomic operation will operate with + + + alias : CUdeviceptr + For driver internal use. Initial value is unimportant. + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr): + self._pvt_ptr = _ptr + + def __init__(self, void_ptr _ptr): + pass + + self._address = CUdeviceptr(_ptr=&self._pvt_ptr[0].atomicReduction.address) + + + self._value = cuuint64_t(_ptr=&self._pvt_ptr[0].atomicReduction.value) + + + self._alias = CUdeviceptr(_ptr=&self._pvt_ptr[0].atomicReduction.alias) + + def __dealloc__(self): + pass + def getPtr(self): + return &self._pvt_ptr[0].atomicReduction + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['operation : ' + str(self.operation)] + except ValueError: + str_list += ['operation : '] + + + try: + str_list += ['flags : ' + str(self.flags)] + except ValueError: + str_list += ['flags : '] + + + try: + str_list += ['reductionOp : ' + str(self.reductionOp)] + except ValueError: + str_list += ['reductionOp : '] + + + try: + str_list += ['dataType : ' + str(self.dataType)] + except ValueError: + str_list += ['dataType : '] + + + try: + str_list += ['address : ' + str(self.address)] + except ValueError: + str_list += ['address : '] + + + try: + str_list += ['value : ' + str(self.value)] + except ValueError: + str_list += ['value : '] + + + try: + str_list += ['alias : ' + str(self.alias)] + except ValueError: + str_list += ['alias : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def operation(self): + return CUstreamBatchMemOpType(self._pvt_ptr[0].atomicReduction.operation) + @operation.setter + def operation(self, operation not None : CUstreamBatchMemOpType): + self._pvt_ptr[0].atomicReduction.operation = int(operation) + + + @property + def flags(self): + return self._pvt_ptr[0].atomicReduction.flags + @flags.setter + def flags(self, unsigned int flags): + self._pvt_ptr[0].atomicReduction.flags = flags + + + @property + def reductionOp(self): + return CUstreamAtomicReductionOpType(self._pvt_ptr[0].atomicReduction.reductionOp) + @reductionOp.setter + def reductionOp(self, reductionOp not None : CUstreamAtomicReductionOpType): + self._pvt_ptr[0].atomicReduction.reductionOp = int(reductionOp) + + + @property + def dataType(self): + return CUstreamAtomicReductionDataType(self._pvt_ptr[0].atomicReduction.dataType) + @dataType.setter + def dataType(self, dataType not None : CUstreamAtomicReductionDataType): + self._pvt_ptr[0].atomicReduction.dataType = int(dataType) + + + @property + def address(self): + return self._address + @address.setter + def address(self, address): + cdef cydriver.CUdeviceptr cyaddress + if address is None: + cyaddress = 0 + elif isinstance(address, (CUdeviceptr)): + paddress = int(address) + cyaddress = paddress + else: + paddress = int(CUdeviceptr(address)) + cyaddress = paddress + self._address._pvt_ptr[0] = cyaddress + + + + @property + def value(self): + return self._value + @value.setter + def value(self, value): + cdef cydriver.cuuint64_t cyvalue + if value is None: + cyvalue = 0 + elif isinstance(value, (cuuint64_t)): + pvalue = int(value) + cyvalue = pvalue + else: + pvalue = int(cuuint64_t(value)) + cyvalue = pvalue + self._value._pvt_ptr[0] = cyvalue + + + + @property + def alias(self): + return self._alias + @alias.setter + def alias(self, alias): + cdef cydriver.CUdeviceptr cyalias + if alias is None: + cyalias = 0 + elif isinstance(alias, (CUdeviceptr)): + palias = int(alias) + cyalias = palias + else: + palias = int(CUdeviceptr(alias)) + cyalias = palias + self._alias._pvt_ptr[0] = cyalias + + + +cdef class CUstreamBatchMemOpParams_union: + """ + Per-operation parameters for cuStreamBatchMemOp + + Attributes + ---------- + + operation : CUstreamBatchMemOpType + Operation. This is the first field of all the union elemets and + acts as a TAG to determine which union member is valid. + + + waitValue : CUstreamMemOpWaitValueParams_st + Params for CU_STREAM_MEM_OP_WAIT_VALUE_32 and + CU_STREAM_MEM_OP_WAIT_VALUE_64 operations. + + + writeValue : CUstreamMemOpWriteValueParams_st + Params for CU_STREAM_MEM_OP_WRITE_VALUE_32 and + CU_STREAM_MEM_OP_WRITE_VALUE_64 operations. + + + flushRemoteWrites : CUstreamMemOpFlushRemoteWritesParams_st + Params for CU_STREAM_MEM_OP_FLUSH_REMOTE_WRITES operations. + + + memoryBarrier : CUstreamMemOpMemoryBarrierParams_st + Params for CU_STREAM_MEM_OP_BARRIER operations. + + + atomicReduction : CUstreamMemOpAtomicReductionParams_st + + + + pad : list[cuuint64_t] + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass + + self._waitValue = CUstreamMemOpWaitValueParams_st(_ptr=self._pvt_ptr) + + + self._writeValue = CUstreamMemOpWriteValueParams_st(_ptr=self._pvt_ptr) + + + self._flushRemoteWrites = CUstreamMemOpFlushRemoteWritesParams_st(_ptr=self._pvt_ptr) + + + self._memoryBarrier = CUstreamMemOpMemoryBarrierParams_st(_ptr=self._pvt_ptr) + + + self._atomicReduction = CUstreamMemOpAtomicReductionParams_st(_ptr=self._pvt_ptr) + + def __dealloc__(self): + pass + def getPtr(self): + return self._pvt_ptr + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['operation : ' + str(self.operation)] + except ValueError: + str_list += ['operation : '] + + + try: + str_list += ['waitValue :\n' + '\n'.join([' ' + line for line in str(self.waitValue).splitlines()])] + except ValueError: + str_list += ['waitValue : '] + + + try: + str_list += ['writeValue :\n' + '\n'.join([' ' + line for line in str(self.writeValue).splitlines()])] + except ValueError: + str_list += ['writeValue : '] + + + try: + str_list += ['flushRemoteWrites :\n' + '\n'.join([' ' + line for line in str(self.flushRemoteWrites).splitlines()])] + except ValueError: + str_list += ['flushRemoteWrites : '] + + + try: + str_list += ['memoryBarrier :\n' + '\n'.join([' ' + line for line in str(self.memoryBarrier).splitlines()])] + except ValueError: + str_list += ['memoryBarrier : '] + + + try: + str_list += ['atomicReduction :\n' + '\n'.join([' ' + line for line in str(self.atomicReduction).splitlines()])] + except ValueError: + str_list += ['atomicReduction : '] + + + try: + str_list += ['pad : ' + str(self.pad)] + except ValueError: + str_list += ['pad : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def operation(self): + return CUstreamBatchMemOpType(self._pvt_ptr[0].operation) + @operation.setter + def operation(self, operation not None : CUstreamBatchMemOpType): + self._pvt_ptr[0].operation = int(operation) + + + @property + def waitValue(self): + return self._waitValue + @waitValue.setter + def waitValue(self, waitValue not None : CUstreamMemOpWaitValueParams_st): + string.memcpy(&self._pvt_ptr[0].waitValue, waitValue.getPtr(), sizeof(self._pvt_ptr[0].waitValue)) + + + @property + def writeValue(self): + return self._writeValue + @writeValue.setter + def writeValue(self, writeValue not None : CUstreamMemOpWriteValueParams_st): + string.memcpy(&self._pvt_ptr[0].writeValue, writeValue.getPtr(), sizeof(self._pvt_ptr[0].writeValue)) + + + @property + def flushRemoteWrites(self): + return self._flushRemoteWrites + @flushRemoteWrites.setter + def flushRemoteWrites(self, flushRemoteWrites not None : CUstreamMemOpFlushRemoteWritesParams_st): + string.memcpy(&self._pvt_ptr[0].flushRemoteWrites, flushRemoteWrites.getPtr(), sizeof(self._pvt_ptr[0].flushRemoteWrites)) + + + @property + def memoryBarrier(self): + return self._memoryBarrier + @memoryBarrier.setter + def memoryBarrier(self, memoryBarrier not None : CUstreamMemOpMemoryBarrierParams_st): + string.memcpy(&self._pvt_ptr[0].memoryBarrier, memoryBarrier.getPtr(), sizeof(self._pvt_ptr[0].memoryBarrier)) + + + @property + def atomicReduction(self): + return self._atomicReduction + @atomicReduction.setter + def atomicReduction(self, atomicReduction not None : CUstreamMemOpAtomicReductionParams_st): + string.memcpy(&self._pvt_ptr[0].atomicReduction, atomicReduction.getPtr(), sizeof(self._pvt_ptr[0].atomicReduction)) + + + @property + def pad(self): + return [cuuint64_t(init_value=_pad) for _pad in self._pvt_ptr[0].pad] + @pad.setter + def pad(self, pad): + self._pvt_ptr[0].pad = pad + + + +cdef class CUDA_BATCH_MEM_OP_NODE_PARAMS_v1_st: + """ + Batch memory operation node parameters Used in the legacy + cuGraphAddBatchMemOpNode api. New code should use cuGraphAddNode() + + Attributes + ---------- + + ctx : CUcontext + + + + count : unsigned int + + + + paramArray : CUstreamBatchMemOpParams + + + + flags : unsigned int + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass + + self._ctx = CUcontext(_ptr=&self._pvt_ptr[0].ctx) + + def __dealloc__(self): + pass + + if self._paramArray is not NULL: + free(self._paramArray) + self._pvt_ptr[0].paramArray = NULL + + def getPtr(self): + return self._pvt_ptr + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['ctx : ' + str(self.ctx)] + except ValueError: + str_list += ['ctx : '] + + + try: + str_list += ['count : ' + str(self.count)] + except ValueError: + str_list += ['count : '] + + + try: + str_list += ['paramArray : ' + str(self.paramArray)] + except ValueError: + str_list += ['paramArray : '] + + + try: + str_list += ['flags : ' + str(self.flags)] + except ValueError: + str_list += ['flags : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def ctx(self): + return self._ctx + @ctx.setter + def ctx(self, ctx): + cdef cydriver.CUcontext cyctx + if ctx is None: + cyctx = 0 + elif isinstance(ctx, (CUcontext,)): + pctx = int(ctx) + cyctx = pctx + else: + pctx = int(CUcontext(ctx)) + cyctx = pctx + self._ctx._pvt_ptr[0] = cyctx + + + @property + def count(self): + return self._pvt_ptr[0].count + @count.setter + def count(self, unsigned int count): + self._pvt_ptr[0].count = count + + + @property + def paramArray(self): + arrs = [self._pvt_ptr[0].paramArray + x*sizeof(cydriver.CUstreamBatchMemOpParams) for x in range(self._paramArray_length)] + return [CUstreamBatchMemOpParams(_ptr=arr) for arr in arrs] + @paramArray.setter + def paramArray(self, val): + if len(val) == 0: + free(self._paramArray) + self._paramArray = NULL + self._paramArray_length = 0 + self._pvt_ptr[0].paramArray = NULL + else: + if self._paramArray_length != len(val): + free(self._paramArray) + self._paramArray = calloc(len(val), sizeof(cydriver.CUstreamBatchMemOpParams)) + if self._paramArray is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(cydriver.CUstreamBatchMemOpParams))) + self._paramArray_length = len(val) + self._pvt_ptr[0].paramArray = self._paramArray + for idx in range(len(val)): + string.memcpy(&self._paramArray[idx], (val[idx])._pvt_ptr, sizeof(cydriver.CUstreamBatchMemOpParams)) + + + + @property + def flags(self): + return self._pvt_ptr[0].flags + @flags.setter + def flags(self, unsigned int flags): + self._pvt_ptr[0].flags = flags + + +cdef class CUDA_BATCH_MEM_OP_NODE_PARAMS_v2_st: + """ + Batch memory operation node parameters + + Attributes + ---------- + + ctx : CUcontext + Context to use for the operations. + + + count : unsigned int + Number of operations in paramArray. + + + paramArray : CUstreamBatchMemOpParams + Array of batch memory operations. + + + flags : unsigned int + Flags to control the node. + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass + + self._ctx = CUcontext(_ptr=&self._pvt_ptr[0].ctx) + + def __dealloc__(self): + pass + + if self._paramArray is not NULL: + free(self._paramArray) + self._pvt_ptr[0].paramArray = NULL + + def getPtr(self): + return self._pvt_ptr + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['ctx : ' + str(self.ctx)] + except ValueError: + str_list += ['ctx : '] + + + try: + str_list += ['count : ' + str(self.count)] + except ValueError: + str_list += ['count : '] + + + try: + str_list += ['paramArray : ' + str(self.paramArray)] + except ValueError: + str_list += ['paramArray : '] + + + try: + str_list += ['flags : ' + str(self.flags)] + except ValueError: + str_list += ['flags : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def ctx(self): + return self._ctx + @ctx.setter + def ctx(self, ctx): + cdef cydriver.CUcontext cyctx + if ctx is None: + cyctx = 0 + elif isinstance(ctx, (CUcontext,)): + pctx = int(ctx) + cyctx = pctx + else: + pctx = int(CUcontext(ctx)) + cyctx = pctx + self._ctx._pvt_ptr[0] = cyctx + + + @property + def count(self): + return self._pvt_ptr[0].count + @count.setter + def count(self, unsigned int count): + self._pvt_ptr[0].count = count + + + @property + def paramArray(self): + arrs = [self._pvt_ptr[0].paramArray + x*sizeof(cydriver.CUstreamBatchMemOpParams) for x in range(self._paramArray_length)] + return [CUstreamBatchMemOpParams(_ptr=arr) for arr in arrs] + @paramArray.setter + def paramArray(self, val): + if len(val) == 0: + free(self._paramArray) + self._paramArray = NULL + self._paramArray_length = 0 + self._pvt_ptr[0].paramArray = NULL + else: + if self._paramArray_length != len(val): + free(self._paramArray) + self._paramArray = calloc(len(val), sizeof(cydriver.CUstreamBatchMemOpParams)) + if self._paramArray is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(cydriver.CUstreamBatchMemOpParams))) + self._paramArray_length = len(val) + self._pvt_ptr[0].paramArray = self._paramArray + for idx in range(len(val)): + string.memcpy(&self._paramArray[idx], (val[idx])._pvt_ptr, sizeof(cydriver.CUstreamBatchMemOpParams)) + + + + @property + def flags(self): + return self._pvt_ptr[0].flags + @flags.setter + def flags(self, unsigned int flags): + self._pvt_ptr[0].flags = flags + + +cdef class anon_struct0: + """ + Attributes + ---------- + + bytesOverBudget : unsigned long long + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr): + self._pvt_ptr = _ptr + + def __init__(self, void_ptr _ptr): + pass + def __dealloc__(self): + pass + def getPtr(self): + return &self._pvt_ptr[0].info.overBudget + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['bytesOverBudget : ' + str(self.bytesOverBudget)] + except ValueError: + str_list += ['bytesOverBudget : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def bytesOverBudget(self): + return self._pvt_ptr[0].info.overBudget.bytesOverBudget + @bytesOverBudget.setter + def bytesOverBudget(self, unsigned long long bytesOverBudget): + self._pvt_ptr[0].info.overBudget.bytesOverBudget = bytesOverBudget + + +cdef class anon_union2: + """ + Attributes + ---------- + + overBudget : anon_struct0 + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr): + self._pvt_ptr = _ptr + + def __init__(self, void_ptr _ptr): + pass + + self._overBudget = anon_struct0(_ptr=self._pvt_ptr) + + def __dealloc__(self): + pass + def getPtr(self): + return &self._pvt_ptr[0].info + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['overBudget :\n' + '\n'.join([' ' + line for line in str(self.overBudget).splitlines()])] + except ValueError: + str_list += ['overBudget : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def overBudget(self): + return self._overBudget + @overBudget.setter + def overBudget(self, overBudget not None : anon_struct0): + string.memcpy(&self._pvt_ptr[0].info.overBudget, overBudget.getPtr(), sizeof(self._pvt_ptr[0].info.overBudget)) + + +cdef class CUasyncNotificationInfo_st: + """ + Information passed to the user via the async notification callback + + Attributes + ---------- + + type : CUasyncNotificationType + The type of notification being sent + + + info : anon_union2 + Information about the notification. `typename` must be checked in + order to interpret this field. + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._val_ptr = calloc(1, sizeof(cydriver.CUasyncNotificationInfo_st)) + self._pvt_ptr = self._val_ptr + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass + + self._info = anon_union2(_ptr=self._pvt_ptr) + + def __dealloc__(self): + if self._val_ptr is not NULL: + free(self._val_ptr) + def getPtr(self): + return self._pvt_ptr + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['type : ' + str(self.type)] + except ValueError: + str_list += ['type : '] + + + try: + str_list += ['info :\n' + '\n'.join([' ' + line for line in str(self.info).splitlines()])] + except ValueError: + str_list += ['info : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def type(self): + return CUasyncNotificationType(self._pvt_ptr[0].type) + @type.setter + def type(self, type not None : CUasyncNotificationType): + self._pvt_ptr[0].type = int(type) + + + @property + def info(self): + return self._info + @info.setter + def info(self, info not None : anon_union2): + string.memcpy(&self._pvt_ptr[0].info, info.getPtr(), sizeof(self._pvt_ptr[0].info)) + + +cdef class CUdevprop_st: + """ + Legacy device properties + + Attributes + ---------- + + maxThreadsPerBlock : int + Maximum number of threads per block + + + maxThreadsDim : list[int] + Maximum size of each dimension of a block + + + maxGridSize : list[int] + Maximum size of each dimension of a grid + + + sharedMemPerBlock : int + Shared memory available per block in bytes + + + totalConstantMemory : int + Constant memory available on device in bytes + + + SIMDWidth : int + Warp size in threads + + + memPitch : int + Maximum pitch in bytes allowed by memory copies + + + regsPerBlock : int + 32-bit registers available per block + + + clockRate : int + Clock frequency in kilohertz + + + textureAlign : int + Alignment requirement for textures + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass + def __dealloc__(self): + pass + def getPtr(self): + return self._pvt_ptr + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['maxThreadsPerBlock : ' + str(self.maxThreadsPerBlock)] + except ValueError: + str_list += ['maxThreadsPerBlock : '] + + + try: + str_list += ['maxThreadsDim : ' + str(self.maxThreadsDim)] + except ValueError: + str_list += ['maxThreadsDim : '] + + + try: + str_list += ['maxGridSize : ' + str(self.maxGridSize)] + except ValueError: + str_list += ['maxGridSize : '] + + + try: + str_list += ['sharedMemPerBlock : ' + str(self.sharedMemPerBlock)] + except ValueError: + str_list += ['sharedMemPerBlock : '] + + + try: + str_list += ['totalConstantMemory : ' + str(self.totalConstantMemory)] + except ValueError: + str_list += ['totalConstantMemory : '] + + + try: + str_list += ['SIMDWidth : ' + str(self.SIMDWidth)] + except ValueError: + str_list += ['SIMDWidth : '] + + + try: + str_list += ['memPitch : ' + str(self.memPitch)] + except ValueError: + str_list += ['memPitch : '] + + + try: + str_list += ['regsPerBlock : ' + str(self.regsPerBlock)] + except ValueError: + str_list += ['regsPerBlock : '] + + + try: + str_list += ['clockRate : ' + str(self.clockRate)] + except ValueError: + str_list += ['clockRate : '] + + + try: + str_list += ['textureAlign : ' + str(self.textureAlign)] + except ValueError: + str_list += ['textureAlign : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def maxThreadsPerBlock(self): + return self._pvt_ptr[0].maxThreadsPerBlock + @maxThreadsPerBlock.setter + def maxThreadsPerBlock(self, int maxThreadsPerBlock): + self._pvt_ptr[0].maxThreadsPerBlock = maxThreadsPerBlock + + + @property + def maxThreadsDim(self): + return self._pvt_ptr[0].maxThreadsDim + @maxThreadsDim.setter + def maxThreadsDim(self, maxThreadsDim): + self._pvt_ptr[0].maxThreadsDim = maxThreadsDim + + + @property + def maxGridSize(self): + return self._pvt_ptr[0].maxGridSize + @maxGridSize.setter + def maxGridSize(self, maxGridSize): + self._pvt_ptr[0].maxGridSize = maxGridSize + + + @property + def sharedMemPerBlock(self): + return self._pvt_ptr[0].sharedMemPerBlock + @sharedMemPerBlock.setter + def sharedMemPerBlock(self, int sharedMemPerBlock): + self._pvt_ptr[0].sharedMemPerBlock = sharedMemPerBlock + + + @property + def totalConstantMemory(self): + return self._pvt_ptr[0].totalConstantMemory + @totalConstantMemory.setter + def totalConstantMemory(self, int totalConstantMemory): + self._pvt_ptr[0].totalConstantMemory = totalConstantMemory + + + @property + def SIMDWidth(self): + return self._pvt_ptr[0].SIMDWidth + @SIMDWidth.setter + def SIMDWidth(self, int SIMDWidth): + self._pvt_ptr[0].SIMDWidth = SIMDWidth + + + @property + def memPitch(self): + return self._pvt_ptr[0].memPitch + @memPitch.setter + def memPitch(self, int memPitch): + self._pvt_ptr[0].memPitch = memPitch + + + @property + def regsPerBlock(self): + return self._pvt_ptr[0].regsPerBlock + @regsPerBlock.setter + def regsPerBlock(self, int regsPerBlock): + self._pvt_ptr[0].regsPerBlock = regsPerBlock + + + @property + def clockRate(self): + return self._pvt_ptr[0].clockRate + @clockRate.setter + def clockRate(self, int clockRate): + self._pvt_ptr[0].clockRate = clockRate + + + @property + def textureAlign(self): + return self._pvt_ptr[0].textureAlign + @textureAlign.setter + def textureAlign(self, int textureAlign): + self._pvt_ptr[0].textureAlign = textureAlign + + +cdef class CUaccessPolicyWindow_st: + """ + Specifies an access policy for a window, a contiguous extent of + memory beginning at base_ptr and ending at base_ptr + num_bytes. + num_bytes is limited by + CU_DEVICE_ATTRIBUTE_MAX_ACCESS_POLICY_WINDOW_SIZE. Partition into + many segments and assign segments such that: sum of "hit segments" + / window == approx. ratio. sum of "miss segments" / window == + approx 1-ratio. Segments and ratio specifications are fitted to the + capabilities of the architecture. Accesses in a hit segment apply + the hitProp access policy. Accesses in a miss segment apply the + missProp access policy. + + Attributes + ---------- + + base_ptr : Any + Starting address of the access policy window. CUDA driver may align + it. + + + num_bytes : size_t + Size in bytes of the window policy. CUDA driver may restrict the + maximum size and alignment. + + + hitRatio : float + hitRatio specifies percentage of lines assigned hitProp, rest are + assigned missProp. + + + hitProp : CUaccessProperty + CUaccessProperty set for hit. + + + missProp : CUaccessProperty + CUaccessProperty set for miss. Must be either NORMAL or STREAMING + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass + def __dealloc__(self): + pass + def getPtr(self): + return self._pvt_ptr + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['base_ptr : ' + hex(self.base_ptr)] + except ValueError: + str_list += ['base_ptr : '] + + + try: + str_list += ['num_bytes : ' + str(self.num_bytes)] + except ValueError: + str_list += ['num_bytes : '] + + + try: + str_list += ['hitRatio : ' + str(self.hitRatio)] + except ValueError: + str_list += ['hitRatio : '] + + + try: + str_list += ['hitProp : ' + str(self.hitProp)] + except ValueError: + str_list += ['hitProp : '] + + + try: + str_list += ['missProp : ' + str(self.missProp)] + except ValueError: + str_list += ['missProp : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def base_ptr(self): + return self._pvt_ptr[0].base_ptr + @base_ptr.setter + def base_ptr(self, base_ptr): + self._cybase_ptr = _HelperInputVoidPtr(base_ptr) + self._pvt_ptr[0].base_ptr = self._cybase_ptr.cptr + + + @property + def num_bytes(self): + return self._pvt_ptr[0].num_bytes + @num_bytes.setter + def num_bytes(self, size_t num_bytes): + self._pvt_ptr[0].num_bytes = num_bytes + + + @property + def hitRatio(self): + return self._pvt_ptr[0].hitRatio + @hitRatio.setter + def hitRatio(self, float hitRatio): + self._pvt_ptr[0].hitRatio = hitRatio + + + @property + def hitProp(self): + return CUaccessProperty(self._pvt_ptr[0].hitProp) + @hitProp.setter + def hitProp(self, hitProp not None : CUaccessProperty): + self._pvt_ptr[0].hitProp = int(hitProp) + + + @property + def missProp(self): + return CUaccessProperty(self._pvt_ptr[0].missProp) + @missProp.setter + def missProp(self, missProp not None : CUaccessProperty): + self._pvt_ptr[0].missProp = int(missProp) + + +cdef class CUDA_KERNEL_NODE_PARAMS_st: + """ + GPU kernel node parameters + + Attributes + ---------- + + func : CUfunction + Kernel to launch + + + gridDimX : unsigned int + Width of grid in blocks + + + gridDimY : unsigned int + Height of grid in blocks + + + gridDimZ : unsigned int + Depth of grid in blocks + + + blockDimX : unsigned int + X dimension of each thread block + + + blockDimY : unsigned int + Y dimension of each thread block + + + blockDimZ : unsigned int + Z dimension of each thread block + + + sharedMemBytes : unsigned int + Dynamic shared-memory size per thread block in bytes + + + kernelParams : Any + Array of pointers to kernel parameters + + + extra : Any + Extra options + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass + + self._func = CUfunction(_ptr=&self._pvt_ptr[0].func) + + def __dealloc__(self): + pass + def getPtr(self): + return self._pvt_ptr + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['func : ' + str(self.func)] + except ValueError: + str_list += ['func : '] + + + try: + str_list += ['gridDimX : ' + str(self.gridDimX)] + except ValueError: + str_list += ['gridDimX : '] + + + try: + str_list += ['gridDimY : ' + str(self.gridDimY)] + except ValueError: + str_list += ['gridDimY : '] + + + try: + str_list += ['gridDimZ : ' + str(self.gridDimZ)] + except ValueError: + str_list += ['gridDimZ : '] + + + try: + str_list += ['blockDimX : ' + str(self.blockDimX)] + except ValueError: + str_list += ['blockDimX : '] + + + try: + str_list += ['blockDimY : ' + str(self.blockDimY)] + except ValueError: + str_list += ['blockDimY : '] + + + try: + str_list += ['blockDimZ : ' + str(self.blockDimZ)] + except ValueError: + str_list += ['blockDimZ : '] + + + try: + str_list += ['sharedMemBytes : ' + str(self.sharedMemBytes)] + except ValueError: + str_list += ['sharedMemBytes : '] + + + try: + str_list += ['kernelParams : ' + str(self.kernelParams)] + except ValueError: + str_list += ['kernelParams : '] + + + try: + str_list += ['extra : ' + str(self.extra)] + except ValueError: + str_list += ['extra : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def func(self): + return self._func + @func.setter + def func(self, func): + cdef cydriver.CUfunction cyfunc + if func is None: + cyfunc = 0 + elif isinstance(func, (CUfunction,)): + pfunc = int(func) + cyfunc = pfunc + else: + pfunc = int(CUfunction(func)) + cyfunc = pfunc + self._func._pvt_ptr[0] = cyfunc + + + @property + def gridDimX(self): + return self._pvt_ptr[0].gridDimX + @gridDimX.setter + def gridDimX(self, unsigned int gridDimX): + self._pvt_ptr[0].gridDimX = gridDimX + + + @property + def gridDimY(self): + return self._pvt_ptr[0].gridDimY + @gridDimY.setter + def gridDimY(self, unsigned int gridDimY): + self._pvt_ptr[0].gridDimY = gridDimY + + + @property + def gridDimZ(self): + return self._pvt_ptr[0].gridDimZ + @gridDimZ.setter + def gridDimZ(self, unsigned int gridDimZ): + self._pvt_ptr[0].gridDimZ = gridDimZ + + + @property + def blockDimX(self): + return self._pvt_ptr[0].blockDimX + @blockDimX.setter + def blockDimX(self, unsigned int blockDimX): + self._pvt_ptr[0].blockDimX = blockDimX + + + @property + def blockDimY(self): + return self._pvt_ptr[0].blockDimY + @blockDimY.setter + def blockDimY(self, unsigned int blockDimY): + self._pvt_ptr[0].blockDimY = blockDimY + + + @property + def blockDimZ(self): + return self._pvt_ptr[0].blockDimZ + @blockDimZ.setter + def blockDimZ(self, unsigned int blockDimZ): + self._pvt_ptr[0].blockDimZ = blockDimZ + + + @property + def sharedMemBytes(self): + return self._pvt_ptr[0].sharedMemBytes + @sharedMemBytes.setter + def sharedMemBytes(self, unsigned int sharedMemBytes): + self._pvt_ptr[0].sharedMemBytes = sharedMemBytes + + + @property + def kernelParams(self): + return self._pvt_ptr[0].kernelParams + @kernelParams.setter + def kernelParams(self, kernelParams): + self._cykernelParams = _HelperKernelParams(kernelParams) + self._pvt_ptr[0].kernelParams = self._cykernelParams.ckernelParams + + + @property + def extra(self): + return self._pvt_ptr[0].extra + @extra.setter + def extra(self, void_ptr extra): + self._pvt_ptr[0].extra = extra + + +cdef class CUDA_KERNEL_NODE_PARAMS_v2_st: + """ + GPU kernel node parameters + + Attributes + ---------- + + func : CUfunction + Kernel to launch + + + gridDimX : unsigned int + Width of grid in blocks + + + gridDimY : unsigned int + Height of grid in blocks + + + gridDimZ : unsigned int + Depth of grid in blocks + + + blockDimX : unsigned int + X dimension of each thread block + + + blockDimY : unsigned int + Y dimension of each thread block + + + blockDimZ : unsigned int + Z dimension of each thread block + + + sharedMemBytes : unsigned int + Dynamic shared-memory size per thread block in bytes + + + kernelParams : Any + Array of pointers to kernel parameters + + + extra : Any + Extra options + + + kern : CUkernel + Kernel to launch, will only be referenced if func is NULL + + + ctx : CUcontext + Context for the kernel task to run in. The value NULL will indicate + the current context should be used by the api. This field is + ignored if func is set. + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass + + self._func = CUfunction(_ptr=&self._pvt_ptr[0].func) + + + self._kern = CUkernel(_ptr=&self._pvt_ptr[0].kern) + + + self._ctx = CUcontext(_ptr=&self._pvt_ptr[0].ctx) + + def __dealloc__(self): + pass + def getPtr(self): + return self._pvt_ptr + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['func : ' + str(self.func)] + except ValueError: + str_list += ['func : '] + + + try: + str_list += ['gridDimX : ' + str(self.gridDimX)] + except ValueError: + str_list += ['gridDimX : '] + + + try: + str_list += ['gridDimY : ' + str(self.gridDimY)] + except ValueError: + str_list += ['gridDimY : '] + + + try: + str_list += ['gridDimZ : ' + str(self.gridDimZ)] + except ValueError: + str_list += ['gridDimZ : '] + + + try: + str_list += ['blockDimX : ' + str(self.blockDimX)] + except ValueError: + str_list += ['blockDimX : '] + + + try: + str_list += ['blockDimY : ' + str(self.blockDimY)] + except ValueError: + str_list += ['blockDimY : '] + + + try: + str_list += ['blockDimZ : ' + str(self.blockDimZ)] + except ValueError: + str_list += ['blockDimZ : '] + + + try: + str_list += ['sharedMemBytes : ' + str(self.sharedMemBytes)] + except ValueError: + str_list += ['sharedMemBytes : '] + + + try: + str_list += ['kernelParams : ' + str(self.kernelParams)] + except ValueError: + str_list += ['kernelParams : '] + + + try: + str_list += ['extra : ' + str(self.extra)] + except ValueError: + str_list += ['extra : '] + + + try: + str_list += ['kern : ' + str(self.kern)] + except ValueError: + str_list += ['kern : '] + + + try: + str_list += ['ctx : ' + str(self.ctx)] + except ValueError: + str_list += ['ctx : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def func(self): + return self._func + @func.setter + def func(self, func): + cdef cydriver.CUfunction cyfunc + if func is None: + cyfunc = 0 + elif isinstance(func, (CUfunction,)): + pfunc = int(func) + cyfunc = pfunc + else: + pfunc = int(CUfunction(func)) + cyfunc = pfunc + self._func._pvt_ptr[0] = cyfunc + + + @property + def gridDimX(self): + return self._pvt_ptr[0].gridDimX + @gridDimX.setter + def gridDimX(self, unsigned int gridDimX): + self._pvt_ptr[0].gridDimX = gridDimX + + + @property + def gridDimY(self): + return self._pvt_ptr[0].gridDimY + @gridDimY.setter + def gridDimY(self, unsigned int gridDimY): + self._pvt_ptr[0].gridDimY = gridDimY + + + @property + def gridDimZ(self): + return self._pvt_ptr[0].gridDimZ + @gridDimZ.setter + def gridDimZ(self, unsigned int gridDimZ): + self._pvt_ptr[0].gridDimZ = gridDimZ + + + @property + def blockDimX(self): + return self._pvt_ptr[0].blockDimX + @blockDimX.setter + def blockDimX(self, unsigned int blockDimX): + self._pvt_ptr[0].blockDimX = blockDimX + + + @property + def blockDimY(self): + return self._pvt_ptr[0].blockDimY + @blockDimY.setter + def blockDimY(self, unsigned int blockDimY): + self._pvt_ptr[0].blockDimY = blockDimY + + + @property + def blockDimZ(self): + return self._pvt_ptr[0].blockDimZ + @blockDimZ.setter + def blockDimZ(self, unsigned int blockDimZ): + self._pvt_ptr[0].blockDimZ = blockDimZ + + + @property + def sharedMemBytes(self): + return self._pvt_ptr[0].sharedMemBytes + @sharedMemBytes.setter + def sharedMemBytes(self, unsigned int sharedMemBytes): + self._pvt_ptr[0].sharedMemBytes = sharedMemBytes + + + @property + def kernelParams(self): + return self._pvt_ptr[0].kernelParams + @kernelParams.setter + def kernelParams(self, kernelParams): + self._cykernelParams = _HelperKernelParams(kernelParams) + self._pvt_ptr[0].kernelParams = self._cykernelParams.ckernelParams + + + @property + def extra(self): + return self._pvt_ptr[0].extra + @extra.setter + def extra(self, void_ptr extra): + self._pvt_ptr[0].extra = extra + + + @property + def kern(self): + return self._kern + @kern.setter + def kern(self, kern): + cdef cydriver.CUkernel cykern + if kern is None: + cykern = 0 + elif isinstance(kern, (CUkernel,)): + pkern = int(kern) + cykern = pkern + else: + pkern = int(CUkernel(kern)) + cykern = pkern + self._kern._pvt_ptr[0] = cykern + + + @property + def ctx(self): + return self._ctx + @ctx.setter + def ctx(self, ctx): + cdef cydriver.CUcontext cyctx + if ctx is None: + cyctx = 0 + elif isinstance(ctx, (CUcontext,)): + pctx = int(ctx) + cyctx = pctx + else: + pctx = int(CUcontext(ctx)) + cyctx = pctx + self._ctx._pvt_ptr[0] = cyctx + + +cdef class CUDA_KERNEL_NODE_PARAMS_v3_st: + """ + GPU kernel node parameters + + Attributes + ---------- + + func : CUfunction + Kernel to launch + + + gridDimX : unsigned int + Width of grid in blocks + + + gridDimY : unsigned int + Height of grid in blocks + + + gridDimZ : unsigned int + Depth of grid in blocks + + + blockDimX : unsigned int + X dimension of each thread block + + + blockDimY : unsigned int + Y dimension of each thread block + + + blockDimZ : unsigned int + Z dimension of each thread block + + + sharedMemBytes : unsigned int + Dynamic shared-memory size per thread block in bytes + + + kernelParams : Any + Array of pointers to kernel parameters + + + extra : Any + Extra options + + + kern : CUkernel + Kernel to launch, will only be referenced if func is NULL + + + ctx : CUcontext + Context for the kernel task to run in. The value NULL will indicate + the current context should be used by the api. This field is + ignored if func is set. + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass + + self._func = CUfunction(_ptr=&self._pvt_ptr[0].func) + + + self._kern = CUkernel(_ptr=&self._pvt_ptr[0].kern) + + + self._ctx = CUcontext(_ptr=&self._pvt_ptr[0].ctx) + + def __dealloc__(self): + pass + def getPtr(self): + return self._pvt_ptr + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['func : ' + str(self.func)] + except ValueError: + str_list += ['func : '] + + + try: + str_list += ['gridDimX : ' + str(self.gridDimX)] + except ValueError: + str_list += ['gridDimX : '] + + + try: + str_list += ['gridDimY : ' + str(self.gridDimY)] + except ValueError: + str_list += ['gridDimY : '] + + + try: + str_list += ['gridDimZ : ' + str(self.gridDimZ)] + except ValueError: + str_list += ['gridDimZ : '] + + + try: + str_list += ['blockDimX : ' + str(self.blockDimX)] + except ValueError: + str_list += ['blockDimX : '] + + + try: + str_list += ['blockDimY : ' + str(self.blockDimY)] + except ValueError: + str_list += ['blockDimY : '] + + + try: + str_list += ['blockDimZ : ' + str(self.blockDimZ)] + except ValueError: + str_list += ['blockDimZ : '] + + + try: + str_list += ['sharedMemBytes : ' + str(self.sharedMemBytes)] + except ValueError: + str_list += ['sharedMemBytes : '] + + + try: + str_list += ['kernelParams : ' + str(self.kernelParams)] + except ValueError: + str_list += ['kernelParams : '] + + + try: + str_list += ['extra : ' + str(self.extra)] + except ValueError: + str_list += ['extra : '] + + + try: + str_list += ['kern : ' + str(self.kern)] + except ValueError: + str_list += ['kern : '] + + + try: + str_list += ['ctx : ' + str(self.ctx)] + except ValueError: + str_list += ['ctx : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def func(self): + return self._func + @func.setter + def func(self, func): + cdef cydriver.CUfunction cyfunc + if func is None: + cyfunc = 0 + elif isinstance(func, (CUfunction,)): + pfunc = int(func) + cyfunc = pfunc + else: + pfunc = int(CUfunction(func)) + cyfunc = pfunc + self._func._pvt_ptr[0] = cyfunc + + + @property + def gridDimX(self): + return self._pvt_ptr[0].gridDimX + @gridDimX.setter + def gridDimX(self, unsigned int gridDimX): + self._pvt_ptr[0].gridDimX = gridDimX + + + @property + def gridDimY(self): + return self._pvt_ptr[0].gridDimY + @gridDimY.setter + def gridDimY(self, unsigned int gridDimY): + self._pvt_ptr[0].gridDimY = gridDimY + + + @property + def gridDimZ(self): + return self._pvt_ptr[0].gridDimZ + @gridDimZ.setter + def gridDimZ(self, unsigned int gridDimZ): + self._pvt_ptr[0].gridDimZ = gridDimZ + + + @property + def blockDimX(self): + return self._pvt_ptr[0].blockDimX + @blockDimX.setter + def blockDimX(self, unsigned int blockDimX): + self._pvt_ptr[0].blockDimX = blockDimX + + + @property + def blockDimY(self): + return self._pvt_ptr[0].blockDimY + @blockDimY.setter + def blockDimY(self, unsigned int blockDimY): + self._pvt_ptr[0].blockDimY = blockDimY + + + @property + def blockDimZ(self): + return self._pvt_ptr[0].blockDimZ + @blockDimZ.setter + def blockDimZ(self, unsigned int blockDimZ): + self._pvt_ptr[0].blockDimZ = blockDimZ + + + @property + def sharedMemBytes(self): + return self._pvt_ptr[0].sharedMemBytes + @sharedMemBytes.setter + def sharedMemBytes(self, unsigned int sharedMemBytes): + self._pvt_ptr[0].sharedMemBytes = sharedMemBytes + + + @property + def kernelParams(self): + return self._pvt_ptr[0].kernelParams + @kernelParams.setter + def kernelParams(self, kernelParams): + self._cykernelParams = _HelperKernelParams(kernelParams) + self._pvt_ptr[0].kernelParams = self._cykernelParams.ckernelParams + + + @property + def extra(self): + return self._pvt_ptr[0].extra + @extra.setter + def extra(self, void_ptr extra): + self._pvt_ptr[0].extra = extra + + + @property + def kern(self): + return self._kern + @kern.setter + def kern(self, kern): + cdef cydriver.CUkernel cykern + if kern is None: + cykern = 0 + elif isinstance(kern, (CUkernel,)): + pkern = int(kern) + cykern = pkern + else: + pkern = int(CUkernel(kern)) + cykern = pkern + self._kern._pvt_ptr[0] = cykern + + + @property + def ctx(self): + return self._ctx + @ctx.setter + def ctx(self, ctx): + cdef cydriver.CUcontext cyctx + if ctx is None: + cyctx = 0 + elif isinstance(ctx, (CUcontext,)): + pctx = int(ctx) + cyctx = pctx + else: + pctx = int(CUcontext(ctx)) + cyctx = pctx + self._ctx._pvt_ptr[0] = cyctx + + +cdef class CUDA_MEMSET_NODE_PARAMS_st: + """ + Memset node parameters + + Attributes + ---------- + + dst : CUdeviceptr + Destination device pointer + + + pitch : size_t + Pitch of destination device pointer. Unused if height is 1 + + + value : unsigned int + Value to be set + + + elementSize : unsigned int + Size of each element in bytes. Must be 1, 2, or 4. + + + width : size_t + Width of the row in elements + + + height : size_t + Number of rows + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass + + self._dst = CUdeviceptr(_ptr=&self._pvt_ptr[0].dst) + + def __dealloc__(self): + pass + def getPtr(self): + return self._pvt_ptr + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['dst : ' + str(self.dst)] + except ValueError: + str_list += ['dst : '] + + + try: + str_list += ['pitch : ' + str(self.pitch)] + except ValueError: + str_list += ['pitch : '] + + + try: + str_list += ['value : ' + str(self.value)] + except ValueError: + str_list += ['value : '] + + + try: + str_list += ['elementSize : ' + str(self.elementSize)] + except ValueError: + str_list += ['elementSize : '] + + + try: + str_list += ['width : ' + str(self.width)] + except ValueError: + str_list += ['width : '] + + + try: + str_list += ['height : ' + str(self.height)] + except ValueError: + str_list += ['height : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def dst(self): + return self._dst + @dst.setter + def dst(self, dst): + cdef cydriver.CUdeviceptr cydst + if dst is None: + cydst = 0 + elif isinstance(dst, (CUdeviceptr)): + pdst = int(dst) + cydst = pdst + else: + pdst = int(CUdeviceptr(dst)) + cydst = pdst + self._dst._pvt_ptr[0] = cydst + + + + @property + def pitch(self): + return self._pvt_ptr[0].pitch + @pitch.setter + def pitch(self, size_t pitch): + self._pvt_ptr[0].pitch = pitch + + + @property + def value(self): + return self._pvt_ptr[0].value + @value.setter + def value(self, unsigned int value): + self._pvt_ptr[0].value = value + + + @property + def elementSize(self): + return self._pvt_ptr[0].elementSize + @elementSize.setter + def elementSize(self, unsigned int elementSize): + self._pvt_ptr[0].elementSize = elementSize + + + @property + def width(self): + return self._pvt_ptr[0].width + @width.setter + def width(self, size_t width): + self._pvt_ptr[0].width = width + + + @property + def height(self): + return self._pvt_ptr[0].height + @height.setter + def height(self, size_t height): + self._pvt_ptr[0].height = height + + +cdef class CUDA_MEMSET_NODE_PARAMS_v2_st: + """ + Memset node parameters + + Attributes + ---------- + + dst : CUdeviceptr + Destination device pointer + + + pitch : size_t + Pitch of destination device pointer. Unused if height is 1 + + + value : unsigned int + Value to be set + + + elementSize : unsigned int + Size of each element in bytes. Must be 1, 2, or 4. + + + width : size_t + Width of the row in elements + + + height : size_t + Number of rows + + + ctx : CUcontext + Context on which to run the node + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass + + self._dst = CUdeviceptr(_ptr=&self._pvt_ptr[0].dst) + + + self._ctx = CUcontext(_ptr=&self._pvt_ptr[0].ctx) + + def __dealloc__(self): + pass + def getPtr(self): + return self._pvt_ptr + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['dst : ' + str(self.dst)] + except ValueError: + str_list += ['dst : '] + + + try: + str_list += ['pitch : ' + str(self.pitch)] + except ValueError: + str_list += ['pitch : '] + + + try: + str_list += ['value : ' + str(self.value)] + except ValueError: + str_list += ['value : '] + + + try: + str_list += ['elementSize : ' + str(self.elementSize)] + except ValueError: + str_list += ['elementSize : '] + + + try: + str_list += ['width : ' + str(self.width)] + except ValueError: + str_list += ['width : '] + + + try: + str_list += ['height : ' + str(self.height)] + except ValueError: + str_list += ['height : '] + + + try: + str_list += ['ctx : ' + str(self.ctx)] + except ValueError: + str_list += ['ctx : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def dst(self): + return self._dst + @dst.setter + def dst(self, dst): + cdef cydriver.CUdeviceptr cydst + if dst is None: + cydst = 0 + elif isinstance(dst, (CUdeviceptr)): + pdst = int(dst) + cydst = pdst + else: + pdst = int(CUdeviceptr(dst)) + cydst = pdst + self._dst._pvt_ptr[0] = cydst + + + + @property + def pitch(self): + return self._pvt_ptr[0].pitch + @pitch.setter + def pitch(self, size_t pitch): + self._pvt_ptr[0].pitch = pitch + + + @property + def value(self): + return self._pvt_ptr[0].value + @value.setter + def value(self, unsigned int value): + self._pvt_ptr[0].value = value + + + @property + def elementSize(self): + return self._pvt_ptr[0].elementSize + @elementSize.setter + def elementSize(self, unsigned int elementSize): + self._pvt_ptr[0].elementSize = elementSize + + + @property + def width(self): + return self._pvt_ptr[0].width + @width.setter + def width(self, size_t width): + self._pvt_ptr[0].width = width + + + @property + def height(self): + return self._pvt_ptr[0].height + @height.setter + def height(self, size_t height): + self._pvt_ptr[0].height = height + + + @property + def ctx(self): + return self._ctx + @ctx.setter + def ctx(self, ctx): + cdef cydriver.CUcontext cyctx + if ctx is None: + cyctx = 0 + elif isinstance(ctx, (CUcontext,)): + pctx = int(ctx) + cyctx = pctx + else: + pctx = int(CUcontext(ctx)) + cyctx = pctx + self._ctx._pvt_ptr[0] = cyctx + + +cdef class CUDA_HOST_NODE_PARAMS_st: + """ + Host node parameters + + Attributes + ---------- + + fn : CUhostFn + The function to call when the node executes + + + userData : Any + Argument to pass to the function + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass + + self._fn = CUhostFn(_ptr=&self._pvt_ptr[0].fn) + + def __dealloc__(self): + pass + def getPtr(self): + return self._pvt_ptr + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['fn : ' + str(self.fn)] + except ValueError: + str_list += ['fn : '] + + + try: + str_list += ['userData : ' + hex(self.userData)] + except ValueError: + str_list += ['userData : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def fn(self): + return self._fn + @fn.setter + def fn(self, fn): + cdef cydriver.CUhostFn cyfn + if fn is None: + cyfn = 0 + elif isinstance(fn, (CUhostFn)): + pfn = int(fn) + cyfn = pfn + else: + pfn = int(CUhostFn(fn)) + cyfn = pfn + self._fn._pvt_ptr[0] = cyfn + + + @property + def userData(self): + return self._pvt_ptr[0].userData + @userData.setter + def userData(self, userData): + self._cyuserData = _HelperInputVoidPtr(userData) + self._pvt_ptr[0].userData = self._cyuserData.cptr + + +cdef class CUDA_HOST_NODE_PARAMS_v2_st: + """ + Host node parameters + + Attributes + ---------- + + fn : CUhostFn + The function to call when the node executes + + + userData : Any + Argument to pass to the function + + + syncMode : unsigned int + The sync mode to use for the host task + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass + + self._fn = CUhostFn(_ptr=&self._pvt_ptr[0].fn) + + def __dealloc__(self): + pass + def getPtr(self): + return self._pvt_ptr + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['fn : ' + str(self.fn)] + except ValueError: + str_list += ['fn : '] + + + try: + str_list += ['userData : ' + hex(self.userData)] + except ValueError: + str_list += ['userData : '] + + + try: + str_list += ['syncMode : ' + str(self.syncMode)] + except ValueError: + str_list += ['syncMode : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def fn(self): + return self._fn + @fn.setter + def fn(self, fn): + cdef cydriver.CUhostFn cyfn + if fn is None: + cyfn = 0 + elif isinstance(fn, (CUhostFn)): + pfn = int(fn) + cyfn = pfn + else: + pfn = int(CUhostFn(fn)) + cyfn = pfn + self._fn._pvt_ptr[0] = cyfn + + + @property + def userData(self): + return self._pvt_ptr[0].userData + @userData.setter + def userData(self, userData): + self._cyuserData = _HelperInputVoidPtr(userData) + self._pvt_ptr[0].userData = self._cyuserData.cptr + + + @property + def syncMode(self): + return self._pvt_ptr[0].syncMode + @syncMode.setter + def syncMode(self, unsigned int syncMode): + self._pvt_ptr[0].syncMode = syncMode + + +cdef class CUDA_CONDITIONAL_NODE_PARAMS: + """ + Conditional node parameters + + Attributes + ---------- + + handle : CUgraphConditionalHandle + Conditional node handle. Handles must be created in advance of + creating the node using cuGraphConditionalHandleCreate. + + + type : CUgraphConditionalNodeType + Type of conditional node. + + + size : unsigned int + Size of graph output array. Allowed values are 1 for + CU_GRAPH_COND_TYPE_WHILE, 1 or 2 for CU_GRAPH_COND_TYPE_IF, or any + value greater than zero for CU_GRAPH_COND_TYPE_SWITCH. + + + phGraph_out : CUgraph + CUDA-owned array populated with conditional node child graphs + during creation of the node. Valid for the lifetime of the + conditional node. The contents of the graph(s) are subject to the + following constraints: - Allowed node types are kernel nodes, + empty nodes, child graphs, memsets, memcopies, and conditionals. + This applies recursively to child graphs and conditional bodies. + - All kernels, including kernels in nested conditionals or child + graphs at any level, must belong to the same CUDA context. + These graphs may be populated using graph node creation APIs or + cuStreamBeginCaptureToGraph. CU_GRAPH_COND_TYPE_IF: phGraph_out[0] + is executed when the condition is non-zero. If `size` == 2, + phGraph_out[1] will be executed when the condition is zero. + CU_GRAPH_COND_TYPE_WHILE: phGraph_out[0] is executed as long as the + condition is non-zero. CU_GRAPH_COND_TYPE_SWITCH: phGraph_out[n] is + executed when the condition is equal to n. If the condition >= + `size`, no body graph is executed. + + + ctx : CUcontext + Context on which to run the node. Must match context used to create + the handle and all body nodes. + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass + + self._handle = CUgraphConditionalHandle(_ptr=&self._pvt_ptr[0].handle) + + + self._ctx = CUcontext(_ptr=&self._pvt_ptr[0].ctx) + + def __dealloc__(self): + pass + def getPtr(self): + return self._pvt_ptr + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['handle : ' + str(self.handle)] + except ValueError: + str_list += ['handle : '] + + + try: + str_list += ['type : ' + str(self.type)] + except ValueError: + str_list += ['type : '] + + + try: + str_list += ['size : ' + str(self.size)] + except ValueError: + str_list += ['size : '] + + + try: + str_list += ['phGraph_out : ' + str(self.phGraph_out)] + except ValueError: + str_list += ['phGraph_out : '] + + + try: + str_list += ['ctx : ' + str(self.ctx)] + except ValueError: + str_list += ['ctx : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def handle(self): + return self._handle + @handle.setter + def handle(self, handle): + cdef cydriver.CUgraphConditionalHandle cyhandle + if handle is None: + cyhandle = 0 + elif isinstance(handle, (CUgraphConditionalHandle)): + phandle = int(handle) + cyhandle = phandle + else: + phandle = int(CUgraphConditionalHandle(handle)) + cyhandle = phandle + self._handle._pvt_ptr[0] = cyhandle + + + + @property + def type(self): + return CUgraphConditionalNodeType(self._pvt_ptr[0].type) + @type.setter + def type(self, type not None : CUgraphConditionalNodeType): + self._pvt_ptr[0].type = int(type) + + + @property + def size(self): + return self._pvt_ptr[0].size + @size.setter + def size(self, unsigned int size): + self._pvt_ptr[0].size = size + + + @property + def phGraph_out(self): + arrs = [self._pvt_ptr[0].phGraph_out + x*sizeof(cydriver.CUgraph) for x in range(self.size)] + return [CUgraph(_ptr=arr) for arr in arrs] + + + @property + def ctx(self): + return self._ctx + @ctx.setter + def ctx(self, ctx): + cdef cydriver.CUcontext cyctx + if ctx is None: + cyctx = 0 + elif isinstance(ctx, (CUcontext,)): + pctx = int(ctx) + cyctx = pctx + else: + pctx = int(CUcontext(ctx)) + cyctx = pctx + self._ctx._pvt_ptr[0] = cyctx + + +cdef class CUgraphEdgeData_st: + """ + Optional annotation for edges in a CUDA graph. Note, all edges + implicitly have annotations and default to a zero-initialized value + if not specified. A zero-initialized struct indicates a standard + full serialization of two nodes with memory visibility. + + Attributes + ---------- + + from_port : bytes + This indicates when the dependency is triggered from the upstream + node on the edge. The meaning is specfic to the node type. A value + of 0 in all cases means full completion of the upstream node, with + memory visibility to the downstream node or portion thereof + (indicated by `to_port`). Only kernel nodes define non-zero + ports. A kernel node can use the following output port types: + CU_GRAPH_KERNEL_NODE_PORT_DEFAULT, + CU_GRAPH_KERNEL_NODE_PORT_PROGRAMMATIC, or + CU_GRAPH_KERNEL_NODE_PORT_LAUNCH_ORDER. + + + to_port : bytes + This indicates what portion of the downstream node is dependent on + the upstream node or portion thereof (indicated by `from_port`). + The meaning is specific to the node type. A value of 0 in all cases + means the entirety of the downstream node is dependent on the + upstream work. Currently no node types define non-zero ports. + Accordingly, this field must be set to zero. + + + type : bytes + This should be populated with a value from CUgraphDependencyType. + (It is typed as char due to compiler-specific layout of bitfields.) + See CUgraphDependencyType. + + + reserved : bytes + These bytes are unused and must be zeroed. This ensures + compatibility if additional fields are added in the future. + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass + def __dealloc__(self): + pass + def getPtr(self): + return self._pvt_ptr + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['from_port : ' + str(self.from_port)] + except ValueError: + str_list += ['from_port : '] + + + try: + str_list += ['to_port : ' + str(self.to_port)] + except ValueError: + str_list += ['to_port : '] + + + try: + str_list += ['type : ' + str(self.type)] + except ValueError: + str_list += ['type : '] + + + try: + str_list += ['reserved : ' + str(self.reserved)] + except ValueError: + str_list += ['reserved : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def from_port(self): + return self._pvt_ptr[0].from_port + @from_port.setter + def from_port(self, unsigned char from_port): + self._pvt_ptr[0].from_port = from_port + + + @property + def to_port(self): + return self._pvt_ptr[0].to_port + @to_port.setter + def to_port(self, unsigned char to_port): + self._pvt_ptr[0].to_port = to_port + + + @property + def type(self): + return self._pvt_ptr[0].type + @type.setter + def type(self, unsigned char type): + self._pvt_ptr[0].type = type + + + @property + def reserved(self): + return PyBytes_FromStringAndSize(self._pvt_ptr[0].reserved, 5) + @reserved.setter + def reserved(self, reserved): + if len(reserved) != 5: + raise ValueError("reserved length must be 5, is " + str(len(reserved))) + for i, b in enumerate(reserved): + self._pvt_ptr[0].reserved[i] = b + + +cdef class CUDA_GRAPH_INSTANTIATE_PARAMS_st: + """ + Graph instantiation parameters + + Attributes + ---------- + + flags : cuuint64_t + Instantiation flags + + + hUploadStream : CUstream + Upload stream + + + hErrNode_out : CUgraphNode + The node which caused instantiation to fail, if any + + + result_out : CUgraphInstantiateResult + Whether instantiation was successful. If it failed, the reason why + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass + + self._flags = cuuint64_t(_ptr=&self._pvt_ptr[0].flags) + + + self._hUploadStream = CUstream(_ptr=&self._pvt_ptr[0].hUploadStream) + + + self._hErrNode_out = CUgraphNode(_ptr=&self._pvt_ptr[0].hErrNode_out) + + def __dealloc__(self): + pass + def getPtr(self): + return self._pvt_ptr + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['flags : ' + str(self.flags)] + except ValueError: + str_list += ['flags : '] + + + try: + str_list += ['hUploadStream : ' + str(self.hUploadStream)] + except ValueError: + str_list += ['hUploadStream : '] + + + try: + str_list += ['hErrNode_out : ' + str(self.hErrNode_out)] + except ValueError: + str_list += ['hErrNode_out : '] + + + try: + str_list += ['result_out : ' + str(self.result_out)] + except ValueError: + str_list += ['result_out : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def flags(self): + return self._flags + @flags.setter + def flags(self, flags): + cdef cydriver.cuuint64_t cyflags + if flags is None: + cyflags = 0 + elif isinstance(flags, (cuuint64_t)): + pflags = int(flags) + cyflags = pflags + else: + pflags = int(cuuint64_t(flags)) + cyflags = pflags + self._flags._pvt_ptr[0] = cyflags + + + + @property + def hUploadStream(self): + return self._hUploadStream + @hUploadStream.setter + def hUploadStream(self, hUploadStream): + cdef cydriver.CUstream cyhUploadStream + if hUploadStream is None: + cyhUploadStream = 0 + elif isinstance(hUploadStream, (CUstream,)): + phUploadStream = int(hUploadStream) + cyhUploadStream = phUploadStream + else: + phUploadStream = int(CUstream(hUploadStream)) + cyhUploadStream = phUploadStream + self._hUploadStream._pvt_ptr[0] = cyhUploadStream + + + @property + def hErrNode_out(self): + return self._hErrNode_out + @hErrNode_out.setter + def hErrNode_out(self, hErrNode_out): + cdef cydriver.CUgraphNode cyhErrNode_out + if hErrNode_out is None: + cyhErrNode_out = 0 + elif isinstance(hErrNode_out, (CUgraphNode,)): + phErrNode_out = int(hErrNode_out) + cyhErrNode_out = phErrNode_out + else: + phErrNode_out = int(CUgraphNode(hErrNode_out)) + cyhErrNode_out = phErrNode_out + self._hErrNode_out._pvt_ptr[0] = cyhErrNode_out + + + @property + def result_out(self): + return CUgraphInstantiateResult(self._pvt_ptr[0].result_out) + @result_out.setter + def result_out(self, result_out not None : CUgraphInstantiateResult): + self._pvt_ptr[0].result_out = int(result_out) + + +cdef class CUlaunchMemSyncDomainMap_st: + """ + Memory Synchronization Domain map See ::cudaLaunchMemSyncDomain. + By default, kernels are launched in domain 0. Kernel launched with + CU_LAUNCH_MEM_SYNC_DOMAIN_REMOTE will have a different domain ID. + User may also alter the domain ID with CUlaunchMemSyncDomainMap for + a specific stream / graph node / kernel launch. See + CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP. Domain ID range is + available through CU_DEVICE_ATTRIBUTE_MEM_SYNC_DOMAIN_COUNT. + + Attributes + ---------- + + default_ : bytes + The default domain ID to use for designated kernels + + + remote : bytes + The remote domain ID to use for designated kernels + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass + def __dealloc__(self): + pass + def getPtr(self): + return self._pvt_ptr + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['default_ : ' + str(self.default_)] + except ValueError: + str_list += ['default_ : '] + + + try: + str_list += ['remote : ' + str(self.remote)] + except ValueError: + str_list += ['remote : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def default_(self): + return self._pvt_ptr[0].default_ + @default_.setter + def default_(self, unsigned char default_): + self._pvt_ptr[0].default_ = default_ + + + @property + def remote(self): + return self._pvt_ptr[0].remote + @remote.setter + def remote(self, unsigned char remote): + self._pvt_ptr[0].remote = remote + + +cdef class anon_struct1: + """ + Attributes + ---------- + + x : unsigned int + + + + y : unsigned int + + + + z : unsigned int + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr): + self._pvt_ptr = _ptr + + def __init__(self, void_ptr _ptr): + pass + def __dealloc__(self): + pass + def getPtr(self): + return &self._pvt_ptr[0].clusterDim + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['x : ' + str(self.x)] + except ValueError: + str_list += ['x : '] + + + try: + str_list += ['y : ' + str(self.y)] + except ValueError: + str_list += ['y : '] + + + try: + str_list += ['z : ' + str(self.z)] + except ValueError: + str_list += ['z : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def x(self): + return self._pvt_ptr[0].clusterDim.x + @x.setter + def x(self, unsigned int x): + self._pvt_ptr[0].clusterDim.x = x + + + @property + def y(self): + return self._pvt_ptr[0].clusterDim.y + @y.setter + def y(self, unsigned int y): + self._pvt_ptr[0].clusterDim.y = y + + + @property + def z(self): + return self._pvt_ptr[0].clusterDim.z + @z.setter + def z(self, unsigned int z): + self._pvt_ptr[0].clusterDim.z = z + + +cdef class anon_struct2: + """ + Attributes + ---------- + + event : CUevent + + + + flags : int + + + + triggerAtBlockStart : int + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr): + self._pvt_ptr = _ptr + + def __init__(self, void_ptr _ptr): + pass + + self._event = CUevent(_ptr=&self._pvt_ptr[0].programmaticEvent.event) + + def __dealloc__(self): + pass + def getPtr(self): + return &self._pvt_ptr[0].programmaticEvent + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['event : ' + str(self.event)] + except ValueError: + str_list += ['event : '] + + + try: + str_list += ['flags : ' + str(self.flags)] + except ValueError: + str_list += ['flags : '] + + + try: + str_list += ['triggerAtBlockStart : ' + str(self.triggerAtBlockStart)] + except ValueError: + str_list += ['triggerAtBlockStart : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def event(self): + return self._event + @event.setter + def event(self, event): + cdef cydriver.CUevent cyevent + if event is None: + cyevent = 0 + elif isinstance(event, (CUevent,)): + pevent = int(event) + cyevent = pevent + else: + pevent = int(CUevent(event)) + cyevent = pevent + self._event._pvt_ptr[0] = cyevent + + + @property + def flags(self): + return self._pvt_ptr[0].programmaticEvent.flags + @flags.setter + def flags(self, int flags): + self._pvt_ptr[0].programmaticEvent.flags = flags + + + @property + def triggerAtBlockStart(self): + return self._pvt_ptr[0].programmaticEvent.triggerAtBlockStart + @triggerAtBlockStart.setter + def triggerAtBlockStart(self, int triggerAtBlockStart): + self._pvt_ptr[0].programmaticEvent.triggerAtBlockStart = triggerAtBlockStart + + +cdef class anon_struct3: + """ + Attributes + ---------- + + event : CUevent + + + + flags : int + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr): + self._pvt_ptr = _ptr + + def __init__(self, void_ptr _ptr): + pass + + self._event = CUevent(_ptr=&self._pvt_ptr[0].launchCompletionEvent.event) + + def __dealloc__(self): + pass + def getPtr(self): + return &self._pvt_ptr[0].launchCompletionEvent + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['event : ' + str(self.event)] + except ValueError: + str_list += ['event : '] + + + try: + str_list += ['flags : ' + str(self.flags)] + except ValueError: + str_list += ['flags : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def event(self): + return self._event + @event.setter + def event(self, event): + cdef cydriver.CUevent cyevent + if event is None: + cyevent = 0 + elif isinstance(event, (CUevent,)): + pevent = int(event) + cyevent = pevent + else: + pevent = int(CUevent(event)) + cyevent = pevent + self._event._pvt_ptr[0] = cyevent + + + @property + def flags(self): + return self._pvt_ptr[0].launchCompletionEvent.flags + @flags.setter + def flags(self, int flags): + self._pvt_ptr[0].launchCompletionEvent.flags = flags + + +cdef class anon_struct4: + """ + Attributes + ---------- + + x : unsigned int + + + + y : unsigned int + + + + z : unsigned int + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr): + self._pvt_ptr = _ptr + + def __init__(self, void_ptr _ptr): + pass + def __dealloc__(self): + pass + def getPtr(self): + return &self._pvt_ptr[0].preferredClusterDim + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['x : ' + str(self.x)] + except ValueError: + str_list += ['x : '] + + + try: + str_list += ['y : ' + str(self.y)] + except ValueError: + str_list += ['y : '] + + + try: + str_list += ['z : ' + str(self.z)] + except ValueError: + str_list += ['z : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def x(self): + return self._pvt_ptr[0].preferredClusterDim.x + @x.setter + def x(self, unsigned int x): + self._pvt_ptr[0].preferredClusterDim.x = x + + + @property + def y(self): + return self._pvt_ptr[0].preferredClusterDim.y + @y.setter + def y(self, unsigned int y): + self._pvt_ptr[0].preferredClusterDim.y = y + + + @property + def z(self): + return self._pvt_ptr[0].preferredClusterDim.z + @z.setter + def z(self, unsigned int z): + self._pvt_ptr[0].preferredClusterDim.z = z + + +cdef class anon_struct5: + """ + Attributes + ---------- + + deviceUpdatable : int + + + + devNode : CUgraphDeviceNode + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr): + self._pvt_ptr = _ptr + + def __init__(self, void_ptr _ptr): + pass + + self._devNode = CUgraphDeviceNode(_ptr=&self._pvt_ptr[0].deviceUpdatableKernelNode.devNode) + + def __dealloc__(self): + pass + def getPtr(self): + return &self._pvt_ptr[0].deviceUpdatableKernelNode + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['deviceUpdatable : ' + str(self.deviceUpdatable)] + except ValueError: + str_list += ['deviceUpdatable : '] + + + try: + str_list += ['devNode : ' + str(self.devNode)] + except ValueError: + str_list += ['devNode : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def deviceUpdatable(self): + return self._pvt_ptr[0].deviceUpdatableKernelNode.deviceUpdatable + @deviceUpdatable.setter + def deviceUpdatable(self, int deviceUpdatable): + self._pvt_ptr[0].deviceUpdatableKernelNode.deviceUpdatable = deviceUpdatable + + + @property + def devNode(self): + return self._devNode + @devNode.setter + def devNode(self, devNode): + cdef cydriver.CUgraphDeviceNode cydevNode + if devNode is None: + cydevNode = 0 + elif isinstance(devNode, (CUgraphDeviceNode,)): + pdevNode = int(devNode) + cydevNode = pdevNode + else: + pdevNode = int(CUgraphDeviceNode(devNode)) + cydevNode = pdevNode + self._devNode._pvt_ptr[0] = cydevNode + + +cdef class CUlaunchAttributeValue_union: + """ + Launch attributes union; used as value field of CUlaunchAttribute + + Attributes + ---------- + + pad : bytes + + + + accessPolicyWindow : CUaccessPolicyWindow + Value of launch attribute CU_LAUNCH_ATTRIBUTE_ACCESS_POLICY_WINDOW. + + + cooperative : int + Value of launch attribute CU_LAUNCH_ATTRIBUTE_COOPERATIVE. Nonzero + indicates a cooperative kernel (see cuLaunchCooperativeKernel). + + + syncPolicy : CUsynchronizationPolicy + Value of launch attribute + CU_LAUNCH_ATTRIBUTE_SYNCHRONIZATION_POLICY. CUsynchronizationPolicy + for work queued up in this stream + + + clusterDim : anon_struct1 + Value of launch attribute CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION + that represents the desired cluster dimensions for the kernel. + Opaque type with the following fields: - `x` - The X dimension of + the cluster, in blocks. Must be a divisor of the grid X dimension. + - `y` - The Y dimension of the cluster, in blocks. Must be a + divisor of the grid Y dimension. - `z` - The Z dimension of the + cluster, in blocks. Must be a divisor of the grid Z dimension. + + + clusterSchedulingPolicyPreference : CUclusterSchedulingPolicy + Value of launch attribute + CU_LAUNCH_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE. Cluster + scheduling policy preference for the kernel. + + + programmaticStreamSerializationAllowed : int + Value of launch attribute + CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_STREAM_SERIALIZATION. + + + programmaticEvent : anon_struct2 + Value of launch attribute CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_EVENT + with the following fields: - `CUevent` event - Event to fire when + all blocks trigger it. - `Event` record flags, see + cuEventRecordWithFlags. Does not accept :CU_EVENT_RECORD_EXTERNAL. + - `triggerAtBlockStart` - If this is set to non-0, each block + launch will automatically trigger the event. + + + launchCompletionEvent : anon_struct3 + Value of launch attribute + CU_LAUNCH_ATTRIBUTE_LAUNCH_COMPLETION_EVENT with the following + fields: - `CUevent` event - Event to fire when the last block + launches - `int` flags; - Event record flags, see + cuEventRecordWithFlags. Does not accept CU_EVENT_RECORD_EXTERNAL. + + + priority : int + Value of launch attribute CU_LAUNCH_ATTRIBUTE_PRIORITY. Execution + priority of the kernel. + + + memSyncDomainMap : CUlaunchMemSyncDomainMap + Value of launch attribute CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP. + See CUlaunchMemSyncDomainMap. + + + memSyncDomain : CUlaunchMemSyncDomain + Value of launch attribute CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN. + See::CUlaunchMemSyncDomain + + + preferredClusterDim : anon_struct4 + Value of launch attribute + CU_LAUNCH_ATTRIBUTE_PREFERRED_CLUSTER_DIMENSION that represents the + desired preferred cluster dimensions for the kernel. Opaque type + with the following fields: - `x` - The X dimension of the preferred + cluster, in blocks. Must be a divisor of the grid X dimension, and + must be a multiple of the `x` field of + CUlaunchAttributeValue::clusterDim. - `y` - The Y dimension of + the preferred cluster, in blocks. Must be a divisor of the grid Y + dimension, and must be a multiple of the `y` field of + CUlaunchAttributeValue::clusterDim. - `z` - The Z dimension of + the preferred cluster, in blocks. Must be equal to the `z` field of + CUlaunchAttributeValue::clusterDim. + + + deviceUpdatableKernelNode : anon_struct5 + Value of launch attribute + CU_LAUNCH_ATTRIBUTE_DEVICE_UPDATABLE_KERNEL_NODE. with the + following fields: - `int` deviceUpdatable - Whether or not the + resulting kernel node should be device-updatable. - + `CUgraphDeviceNode` devNode - Returns a handle to pass to the + various device-side update functions. + + + sharedMemCarveout : unsigned int + Value of launch attribute + CU_LAUNCH_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT. + + + nvlinkUtilCentricScheduling : unsigned int + + + + portableClusterSizeMode : CUlaunchAttributePortableClusterMode + Value of launch attribute + CU_LAUNCH_ATTRIBUTE_PORTABLE_CLUSTER_SIZE_MODE. + + + sharedMemoryMode : CUsharedMemoryMode + Value of launch attribute CU_LAUNCH_ATTRIBUTE_SHARED_MEMORY_MODE. + See CUsharedMemoryMode for acceptable values. + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass + + self._accessPolicyWindow = CUaccessPolicyWindow(_ptr=&self._pvt_ptr[0].accessPolicyWindow) + + + self._clusterDim = anon_struct1(_ptr=self._pvt_ptr) + + + self._programmaticEvent = anon_struct2(_ptr=self._pvt_ptr) + + + self._launchCompletionEvent = anon_struct3(_ptr=self._pvt_ptr) + + + self._memSyncDomainMap = CUlaunchMemSyncDomainMap(_ptr=&self._pvt_ptr[0].memSyncDomainMap) + + + self._preferredClusterDim = anon_struct4(_ptr=self._pvt_ptr) + + + self._deviceUpdatableKernelNode = anon_struct5(_ptr=self._pvt_ptr) + + def __dealloc__(self): + pass + def getPtr(self): + return self._pvt_ptr + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['pad : ' + str(self.pad)] + except ValueError: + str_list += ['pad : '] + + + try: + str_list += ['accessPolicyWindow :\n' + '\n'.join([' ' + line for line in str(self.accessPolicyWindow).splitlines()])] + except ValueError: + str_list += ['accessPolicyWindow : '] + + + try: + str_list += ['cooperative : ' + str(self.cooperative)] + except ValueError: + str_list += ['cooperative : '] + + + try: + str_list += ['syncPolicy : ' + str(self.syncPolicy)] + except ValueError: + str_list += ['syncPolicy : '] + + + try: + str_list += ['clusterDim :\n' + '\n'.join([' ' + line for line in str(self.clusterDim).splitlines()])] + except ValueError: + str_list += ['clusterDim : '] + + + try: + str_list += ['clusterSchedulingPolicyPreference : ' + str(self.clusterSchedulingPolicyPreference)] + except ValueError: + str_list += ['clusterSchedulingPolicyPreference : '] + + + try: + str_list += ['programmaticStreamSerializationAllowed : ' + str(self.programmaticStreamSerializationAllowed)] + except ValueError: + str_list += ['programmaticStreamSerializationAllowed : '] + + + try: + str_list += ['programmaticEvent :\n' + '\n'.join([' ' + line for line in str(self.programmaticEvent).splitlines()])] + except ValueError: + str_list += ['programmaticEvent : '] + + + try: + str_list += ['launchCompletionEvent :\n' + '\n'.join([' ' + line for line in str(self.launchCompletionEvent).splitlines()])] + except ValueError: + str_list += ['launchCompletionEvent : '] + + + try: + str_list += ['priority : ' + str(self.priority)] + except ValueError: + str_list += ['priority : '] + + + try: + str_list += ['memSyncDomainMap :\n' + '\n'.join([' ' + line for line in str(self.memSyncDomainMap).splitlines()])] + except ValueError: + str_list += ['memSyncDomainMap : '] + + + try: + str_list += ['memSyncDomain : ' + str(self.memSyncDomain)] + except ValueError: + str_list += ['memSyncDomain : '] + + + try: + str_list += ['preferredClusterDim :\n' + '\n'.join([' ' + line for line in str(self.preferredClusterDim).splitlines()])] + except ValueError: + str_list += ['preferredClusterDim : '] + + + try: + str_list += ['deviceUpdatableKernelNode :\n' + '\n'.join([' ' + line for line in str(self.deviceUpdatableKernelNode).splitlines()])] + except ValueError: + str_list += ['deviceUpdatableKernelNode : '] + + + try: + str_list += ['sharedMemCarveout : ' + str(self.sharedMemCarveout)] + except ValueError: + str_list += ['sharedMemCarveout : '] + + + try: + str_list += ['nvlinkUtilCentricScheduling : ' + str(self.nvlinkUtilCentricScheduling)] + except ValueError: + str_list += ['nvlinkUtilCentricScheduling : '] + + + try: + str_list += ['portableClusterSizeMode : ' + str(self.portableClusterSizeMode)] + except ValueError: + str_list += ['portableClusterSizeMode : '] + + + try: + str_list += ['sharedMemoryMode : ' + str(self.sharedMemoryMode)] + except ValueError: + str_list += ['sharedMemoryMode : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def pad(self): + return PyBytes_FromStringAndSize(self._pvt_ptr[0].pad, 64) + @pad.setter + def pad(self, pad): + if len(pad) != 64: + raise ValueError("pad length must be 64, is " + str(len(pad))) + if CHAR_MIN == 0: + for i, b in enumerate(pad): + if b < 0 and b > -129: + b = b + 256 + self._pvt_ptr[0].pad[i] = b + else: + for i, b in enumerate(pad): + if b > 127 and b < 256: + b = b - 256 + self._pvt_ptr[0].pad[i] = b + + + @property + def accessPolicyWindow(self): + return self._accessPolicyWindow + @accessPolicyWindow.setter + def accessPolicyWindow(self, accessPolicyWindow not None : CUaccessPolicyWindow): + string.memcpy(&self._pvt_ptr[0].accessPolicyWindow, accessPolicyWindow.getPtr(), sizeof(self._pvt_ptr[0].accessPolicyWindow)) + + + @property + def cooperative(self): + return self._pvt_ptr[0].cooperative + @cooperative.setter + def cooperative(self, int cooperative): + self._pvt_ptr[0].cooperative = cooperative + + + @property + def syncPolicy(self): + return CUsynchronizationPolicy(self._pvt_ptr[0].syncPolicy) + @syncPolicy.setter + def syncPolicy(self, syncPolicy not None : CUsynchronizationPolicy): + self._pvt_ptr[0].syncPolicy = int(syncPolicy) + + + @property + def clusterDim(self): + return self._clusterDim + @clusterDim.setter + def clusterDim(self, clusterDim not None : anon_struct1): + string.memcpy(&self._pvt_ptr[0].clusterDim, clusterDim.getPtr(), sizeof(self._pvt_ptr[0].clusterDim)) + + + @property + def clusterSchedulingPolicyPreference(self): + return CUclusterSchedulingPolicy(self._pvt_ptr[0].clusterSchedulingPolicyPreference) + @clusterSchedulingPolicyPreference.setter + def clusterSchedulingPolicyPreference(self, clusterSchedulingPolicyPreference not None : CUclusterSchedulingPolicy): + self._pvt_ptr[0].clusterSchedulingPolicyPreference = int(clusterSchedulingPolicyPreference) + + + @property + def programmaticStreamSerializationAllowed(self): + return self._pvt_ptr[0].programmaticStreamSerializationAllowed + @programmaticStreamSerializationAllowed.setter + def programmaticStreamSerializationAllowed(self, int programmaticStreamSerializationAllowed): + self._pvt_ptr[0].programmaticStreamSerializationAllowed = programmaticStreamSerializationAllowed + + + @property + def programmaticEvent(self): + return self._programmaticEvent + @programmaticEvent.setter + def programmaticEvent(self, programmaticEvent not None : anon_struct2): + string.memcpy(&self._pvt_ptr[0].programmaticEvent, programmaticEvent.getPtr(), sizeof(self._pvt_ptr[0].programmaticEvent)) + + + @property + def launchCompletionEvent(self): + return self._launchCompletionEvent + @launchCompletionEvent.setter + def launchCompletionEvent(self, launchCompletionEvent not None : anon_struct3): + string.memcpy(&self._pvt_ptr[0].launchCompletionEvent, launchCompletionEvent.getPtr(), sizeof(self._pvt_ptr[0].launchCompletionEvent)) + + + @property + def priority(self): + return self._pvt_ptr[0].priority + @priority.setter + def priority(self, int priority): + self._pvt_ptr[0].priority = priority + + + @property + def memSyncDomainMap(self): + return self._memSyncDomainMap + @memSyncDomainMap.setter + def memSyncDomainMap(self, memSyncDomainMap not None : CUlaunchMemSyncDomainMap): + string.memcpy(&self._pvt_ptr[0].memSyncDomainMap, memSyncDomainMap.getPtr(), sizeof(self._pvt_ptr[0].memSyncDomainMap)) + + + @property + def memSyncDomain(self): + return CUlaunchMemSyncDomain(self._pvt_ptr[0].memSyncDomain) + @memSyncDomain.setter + def memSyncDomain(self, memSyncDomain not None : CUlaunchMemSyncDomain): + self._pvt_ptr[0].memSyncDomain = int(memSyncDomain) + + + @property + def preferredClusterDim(self): + return self._preferredClusterDim + @preferredClusterDim.setter + def preferredClusterDim(self, preferredClusterDim not None : anon_struct4): + string.memcpy(&self._pvt_ptr[0].preferredClusterDim, preferredClusterDim.getPtr(), sizeof(self._pvt_ptr[0].preferredClusterDim)) + + + @property + def deviceUpdatableKernelNode(self): + return self._deviceUpdatableKernelNode + @deviceUpdatableKernelNode.setter + def deviceUpdatableKernelNode(self, deviceUpdatableKernelNode not None : anon_struct5): + string.memcpy(&self._pvt_ptr[0].deviceUpdatableKernelNode, deviceUpdatableKernelNode.getPtr(), sizeof(self._pvt_ptr[0].deviceUpdatableKernelNode)) + + + @property + def sharedMemCarveout(self): + return self._pvt_ptr[0].sharedMemCarveout + @sharedMemCarveout.setter + def sharedMemCarveout(self, unsigned int sharedMemCarveout): + self._pvt_ptr[0].sharedMemCarveout = sharedMemCarveout + + + @property + def nvlinkUtilCentricScheduling(self): + return self._pvt_ptr[0].nvlinkUtilCentricScheduling + @nvlinkUtilCentricScheduling.setter + def nvlinkUtilCentricScheduling(self, unsigned int nvlinkUtilCentricScheduling): + self._pvt_ptr[0].nvlinkUtilCentricScheduling = nvlinkUtilCentricScheduling + + + @property + def portableClusterSizeMode(self): + return CUlaunchAttributePortableClusterMode(self._pvt_ptr[0].portableClusterSizeMode) + @portableClusterSizeMode.setter + def portableClusterSizeMode(self, portableClusterSizeMode not None : CUlaunchAttributePortableClusterMode): + self._pvt_ptr[0].portableClusterSizeMode = int(portableClusterSizeMode) + + + @property + def sharedMemoryMode(self): + return CUsharedMemoryMode(self._pvt_ptr[0].sharedMemoryMode) + @sharedMemoryMode.setter + def sharedMemoryMode(self, sharedMemoryMode not None : CUsharedMemoryMode): + self._pvt_ptr[0].sharedMemoryMode = int(sharedMemoryMode) + + +cdef class CUlaunchAttribute_st: + """ + Launch attribute + + Attributes + ---------- + + id : CUlaunchAttributeID + Attribute to set + + + value : CUlaunchAttributeValue + Value of the attribute + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - self._ctx = CUcontext(_ptr=&self._ptr[0].ctx) + pass + + self._value = CUlaunchAttributeValue(_ptr=&self._pvt_ptr[0].value) + def __dealloc__(self): - if self._paramArray is not NULL: - free(self._paramArray) + pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['ctx : ' + str(self.ctx)] + str_list += ['id : ' + str(self.id)] except ValueError: - str_list += ['ctx : '] + str_list += ['id : '] + + try: - str_list += ['count : ' + str(self.count)] + str_list += ['value :\n' + '\n'.join([' ' + line for line in str(self.value).splitlines()])] except ValueError: - str_list += ['count : '] + str_list += ['value : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def id(self): + return CUlaunchAttributeID(self._pvt_ptr[0].id) + @id.setter + def id(self, id not None : CUlaunchAttributeID): + self._pvt_ptr[0].id = int(id) + + + @property + def value(self): + return self._value + @value.setter + def value(self, value not None : CUlaunchAttributeValue): + string.memcpy(&self._pvt_ptr[0].value, value.getPtr(), sizeof(self._pvt_ptr[0].value)) + + +cdef class CUlaunchConfig_st: + """ + CUDA extensible launch configuration + + Attributes + ---------- + + gridDimX : unsigned int + Width of grid in blocks + + + gridDimY : unsigned int + Height of grid in blocks + + + gridDimZ : unsigned int + Depth of grid in blocks + + + blockDimX : unsigned int + X dimension of each thread block + + + blockDimY : unsigned int + Y dimension of each thread block + + + blockDimZ : unsigned int + Z dimension of each thread block + + + sharedMemBytes : unsigned int + Dynamic shared-memory size per thread block in bytes + + + hStream : CUstream + Stream identifier + + + attrs : CUlaunchAttribute + List of attributes; nullable if CUlaunchConfig::numAttrs == 0 + + + numAttrs : unsigned int + Number of attributes populated in CUlaunchConfig::attrs + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass + + self._hStream = CUstream(_ptr=&self._pvt_ptr[0].hStream) + + def __dealloc__(self): + pass + + if self._attrs is not NULL: + free(self._attrs) + self._pvt_ptr[0].attrs = NULL + + def getPtr(self): + return self._pvt_ptr + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + try: - str_list += ['paramArray : ' + str(self.paramArray)] + str_list += ['gridDimX : ' + str(self.gridDimX)] + except ValueError: + str_list += ['gridDimX : '] + + + try: + str_list += ['gridDimY : ' + str(self.gridDimY)] + except ValueError: + str_list += ['gridDimY : '] + + + try: + str_list += ['gridDimZ : ' + str(self.gridDimZ)] + except ValueError: + str_list += ['gridDimZ : '] + + + try: + str_list += ['blockDimX : ' + str(self.blockDimX)] + except ValueError: + str_list += ['blockDimX : '] + + + try: + str_list += ['blockDimY : ' + str(self.blockDimY)] + except ValueError: + str_list += ['blockDimY : '] + + + try: + str_list += ['blockDimZ : ' + str(self.blockDimZ)] + except ValueError: + str_list += ['blockDimZ : '] + + + try: + str_list += ['sharedMemBytes : ' + str(self.sharedMemBytes)] + except ValueError: + str_list += ['sharedMemBytes : '] + + + try: + str_list += ['hStream : ' + str(self.hStream)] + except ValueError: + str_list += ['hStream : '] + + + try: + str_list += ['attrs : ' + str(self.attrs)] + except ValueError: + str_list += ['attrs : '] + + + try: + str_list += ['numAttrs : ' + str(self.numAttrs)] + except ValueError: + str_list += ['numAttrs : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def gridDimX(self): + return self._pvt_ptr[0].gridDimX + @gridDimX.setter + def gridDimX(self, unsigned int gridDimX): + self._pvt_ptr[0].gridDimX = gridDimX + + + @property + def gridDimY(self): + return self._pvt_ptr[0].gridDimY + @gridDimY.setter + def gridDimY(self, unsigned int gridDimY): + self._pvt_ptr[0].gridDimY = gridDimY + + + @property + def gridDimZ(self): + return self._pvt_ptr[0].gridDimZ + @gridDimZ.setter + def gridDimZ(self, unsigned int gridDimZ): + self._pvt_ptr[0].gridDimZ = gridDimZ + + + @property + def blockDimX(self): + return self._pvt_ptr[0].blockDimX + @blockDimX.setter + def blockDimX(self, unsigned int blockDimX): + self._pvt_ptr[0].blockDimX = blockDimX + + + @property + def blockDimY(self): + return self._pvt_ptr[0].blockDimY + @blockDimY.setter + def blockDimY(self, unsigned int blockDimY): + self._pvt_ptr[0].blockDimY = blockDimY + + + @property + def blockDimZ(self): + return self._pvt_ptr[0].blockDimZ + @blockDimZ.setter + def blockDimZ(self, unsigned int blockDimZ): + self._pvt_ptr[0].blockDimZ = blockDimZ + + + @property + def sharedMemBytes(self): + return self._pvt_ptr[0].sharedMemBytes + @sharedMemBytes.setter + def sharedMemBytes(self, unsigned int sharedMemBytes): + self._pvt_ptr[0].sharedMemBytes = sharedMemBytes + + + @property + def hStream(self): + return self._hStream + @hStream.setter + def hStream(self, hStream): + cdef cydriver.CUstream cyhStream + if hStream is None: + cyhStream = 0 + elif isinstance(hStream, (CUstream,)): + phStream = int(hStream) + cyhStream = phStream + else: + phStream = int(CUstream(hStream)) + cyhStream = phStream + self._hStream._pvt_ptr[0] = cyhStream + + + @property + def attrs(self): + arrs = [self._pvt_ptr[0].attrs + x*sizeof(cydriver.CUlaunchAttribute) for x in range(self._attrs_length)] + return [CUlaunchAttribute(_ptr=arr) for arr in arrs] + @attrs.setter + def attrs(self, val): + if len(val) == 0: + free(self._attrs) + self._attrs = NULL + self._attrs_length = 0 + self._pvt_ptr[0].attrs = NULL + else: + if self._attrs_length != len(val): + free(self._attrs) + self._attrs = calloc(len(val), sizeof(cydriver.CUlaunchAttribute)) + if self._attrs is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(cydriver.CUlaunchAttribute))) + self._attrs_length = len(val) + self._pvt_ptr[0].attrs = self._attrs + for idx in range(len(val)): + string.memcpy(&self._attrs[idx], (val[idx])._pvt_ptr, sizeof(cydriver.CUlaunchAttribute)) + + + + @property + def numAttrs(self): + return self._pvt_ptr[0].numAttrs + @numAttrs.setter + def numAttrs(self, unsigned int numAttrs): + self._pvt_ptr[0].numAttrs = numAttrs + + +cdef class CUexecAffinitySmCount_st: + """ + Value for CU_EXEC_AFFINITY_TYPE_SM_COUNT + + Attributes + ---------- + + val : unsigned int + The number of SMs the context is limited to use. + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass + def __dealloc__(self): + pass + def getPtr(self): + return self._pvt_ptr + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['val : ' + str(self.val)] + except ValueError: + str_list += ['val : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def val(self): + return self._pvt_ptr[0].val + @val.setter + def val(self, unsigned int val): + self._pvt_ptr[0].val = val + + +cdef class anon_union3: + """ + Attributes + ---------- + + smCount : CUexecAffinitySmCount + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr): + self._pvt_ptr = _ptr + + def __init__(self, void_ptr _ptr): + pass + + self._smCount = CUexecAffinitySmCount(_ptr=&self._pvt_ptr[0].param.smCount) + + def __dealloc__(self): + pass + def getPtr(self): + return &self._pvt_ptr[0].param + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['smCount :\n' + '\n'.join([' ' + line for line in str(self.smCount).splitlines()])] + except ValueError: + str_list += ['smCount : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def smCount(self): + return self._smCount + @smCount.setter + def smCount(self, smCount not None : CUexecAffinitySmCount): + string.memcpy(&self._pvt_ptr[0].param.smCount, smCount.getPtr(), sizeof(self._pvt_ptr[0].param.smCount)) + + +cdef class CUexecAffinityParam_st: + """ + Execution Affinity Parameters + + Attributes + ---------- + + type : CUexecAffinityType + Type of execution affinity. + + + param : anon_union3 + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._val_ptr = calloc(1, sizeof(cydriver.CUexecAffinityParam_st)) + self._pvt_ptr = self._val_ptr + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass + + self._param = anon_union3(_ptr=self._pvt_ptr) + + def __dealloc__(self): + if self._val_ptr is not NULL: + free(self._val_ptr) + def getPtr(self): + return self._pvt_ptr + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['type : ' + str(self.type)] except ValueError: - str_list += ['paramArray : '] + str_list += ['type : '] + + try: - str_list += ['flags : ' + str(self.flags)] + str_list += ['param :\n' + '\n'.join([' ' + line for line in str(self.param).splitlines()])] except ValueError: - str_list += ['flags : '] + str_list += ['param : '] + return '\n'.join(str_list) else: return '' + @property - def ctx(self): - return self._ctx - @ctx.setter - def ctx(self, ctx): - cdef ccuda.CUcontext cctx - if ctx is None: - cctx = 0 - elif isinstance(ctx, (CUcontext,)): - pctx = int(ctx) - cctx = pctx - else: - pctx = int(CUcontext(ctx)) - cctx = pctx - self._ctx._ptr[0] = cctx - @property - def count(self): - return self._ptr[0].count - @count.setter - def count(self, unsigned int count): - self._ptr[0].count = count - @property - def paramArray(self): - arrs = [self._ptr[0].paramArray + x*sizeof(ccuda.CUstreamBatchMemOpParams) for x in range(self._paramArray_length)] - return [CUstreamBatchMemOpParams(_ptr=arr) for arr in arrs] - @paramArray.setter - def paramArray(self, val): - if len(val) == 0: - free(self._paramArray) - self._paramArray_length = 0 - self._ptr[0].paramArray = NULL - else: - if self._paramArray_length != len(val): - free(self._paramArray) - self._paramArray = calloc(len(val), sizeof(ccuda.CUstreamBatchMemOpParams)) - if self._paramArray is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(ccuda.CUstreamBatchMemOpParams))) - self._paramArray_length = len(val) - self._ptr[0].paramArray = self._paramArray - for idx in range(len(val)): - string.memcpy(&self._paramArray[idx], (val[idx])._ptr, sizeof(ccuda.CUstreamBatchMemOpParams)) + def type(self): + return CUexecAffinityType(self._pvt_ptr[0].type) + @type.setter + def type(self, type not None : CUexecAffinityType): + self._pvt_ptr[0].type = int(type) + @property - def flags(self): - return self._ptr[0].flags - @flags.setter - def flags(self, unsigned int flags): - self._ptr[0].flags = flags -{{endif}} -{{if 'struct CUDA_BATCH_MEM_OP_NODE_PARAMS_v2_st' in found_types}} + def param(self): + return self._param + @param.setter + def param(self, param not None : anon_union3): + string.memcpy(&self._pvt_ptr[0].param, param.getPtr(), sizeof(self._pvt_ptr[0].param)) -cdef class CUDA_BATCH_MEM_OP_NODE_PARAMS_v2_st: + +cdef class CUctxCigParam_st: """ - Batch memory operation node parameters + CIG Context Create Params Attributes ---------- - ctx : CUcontext - Context to use for the operations. - count : unsigned int - Number of operations in paramArray. - paramArray : CUstreamBatchMemOpParams - Array of batch memory operations. - flags : unsigned int - Flags to control the node. + + sharedDataType : CUcigDataType + Type of shared data from graphics client (D3D12 or Vulkan). + + + sharedData : Any + Graphics client data handle (ID3D12CommandQueue or Nvidia specific + data blob). + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - self._ctx = CUcontext(_ptr=&self._ptr[0].ctx) + pass def __dealloc__(self): - if self._paramArray is not NULL: - free(self._paramArray) + pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['ctx : ' + str(self.ctx)] - except ValueError: - str_list += ['ctx : '] - try: - str_list += ['count : ' + str(self.count)] - except ValueError: - str_list += ['count : '] - try: - str_list += ['paramArray : ' + str(self.paramArray)] + str_list += ['sharedDataType : ' + str(self.sharedDataType)] except ValueError: - str_list += ['paramArray : '] + str_list += ['sharedDataType : '] + + try: - str_list += ['flags : ' + str(self.flags)] + str_list += ['sharedData : ' + hex(self.sharedData)] except ValueError: - str_list += ['flags : '] + str_list += ['sharedData : '] + return '\n'.join(str_list) else: return '' + @property - def ctx(self): - return self._ctx - @ctx.setter - def ctx(self, ctx): - cdef ccuda.CUcontext cctx - if ctx is None: - cctx = 0 - elif isinstance(ctx, (CUcontext,)): - pctx = int(ctx) - cctx = pctx - else: - pctx = int(CUcontext(ctx)) - cctx = pctx - self._ctx._ptr[0] = cctx - @property - def count(self): - return self._ptr[0].count - @count.setter - def count(self, unsigned int count): - self._ptr[0].count = count - @property - def paramArray(self): - arrs = [self._ptr[0].paramArray + x*sizeof(ccuda.CUstreamBatchMemOpParams) for x in range(self._paramArray_length)] - return [CUstreamBatchMemOpParams(_ptr=arr) for arr in arrs] - @paramArray.setter - def paramArray(self, val): - if len(val) == 0: - free(self._paramArray) - self._paramArray_length = 0 - self._ptr[0].paramArray = NULL - else: - if self._paramArray_length != len(val): - free(self._paramArray) - self._paramArray = calloc(len(val), sizeof(ccuda.CUstreamBatchMemOpParams)) - if self._paramArray is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(ccuda.CUstreamBatchMemOpParams))) - self._paramArray_length = len(val) - self._ptr[0].paramArray = self._paramArray - for idx in range(len(val)): - string.memcpy(&self._paramArray[idx], (val[idx])._ptr, sizeof(ccuda.CUstreamBatchMemOpParams)) + def sharedDataType(self): + return CUcigDataType(self._pvt_ptr[0].sharedDataType) + @sharedDataType.setter + def sharedDataType(self, sharedDataType not None : CUcigDataType): + self._pvt_ptr[0].sharedDataType = int(sharedDataType) + @property - def flags(self): - return self._ptr[0].flags - @flags.setter - def flags(self, unsigned int flags): - self._ptr[0].flags = flags -{{endif}} -{{if 'struct CUasyncNotificationInfo_st' in found_types}} + def sharedData(self): + return self._pvt_ptr[0].sharedData + @sharedData.setter + def sharedData(self, sharedData): + self._cysharedData = _HelperInputVoidPtr(sharedData) + self._pvt_ptr[0].sharedData = self._cysharedData.cptr -cdef class anon_struct0: + +cdef class CUctxCreateParams_st: """ + Params for creating CUDA context. Both execAffinityParams and + cigParams cannot be non-NULL at the same time. If both are NULL, + the context will be created as a regular CUDA context. + Attributes ---------- - bytesOverBudget : unsigned long long + + execAffinityParams : CUexecAffinityParam + Array of execution affinity parameters to limit context resources + (e.g., SM count). Only supported Volta+ MPS. Mutually exclusive + with cigParams. + + + numExecAffinityParams : int + Number of elements in execAffinityParams array. Must be 0 if + execAffinityParams is NULL. + + + cigParams : CUctxCigParam + CIG (CUDA in Graphics) parameters for sharing data from + D3D12/Vulkan graphics clients. Mutually exclusive with + execAffinityParams. Methods ------- getPtr() Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr - - def __init__(self, void_ptr _ptr): + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): pass def __dealloc__(self): pass + + if self._execAffinityParams is not NULL: + free(self._execAffinityParams) + self._pvt_ptr[0].execAffinityParams = NULL + + + if self._cigParams is not NULL: + free(self._cigParams) + self._pvt_ptr[0].cigParams = NULL + def getPtr(self): - return &self._ptr[0].info.overBudget + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['bytesOverBudget : ' + str(self.bytesOverBudget)] + str_list += ['execAffinityParams : ' + str(self.execAffinityParams)] except ValueError: - str_list += ['bytesOverBudget : '] + str_list += ['execAffinityParams : '] + + + try: + str_list += ['numExecAffinityParams : ' + str(self.numExecAffinityParams)] + except ValueError: + str_list += ['numExecAffinityParams : '] + + + try: + str_list += ['cigParams : ' + str(self.cigParams)] + except ValueError: + str_list += ['cigParams : '] + return '\n'.join(str_list) else: return '' + @property - def bytesOverBudget(self): - return self._ptr[0].info.overBudget.bytesOverBudget - @bytesOverBudget.setter - def bytesOverBudget(self, unsigned long long bytesOverBudget): - self._ptr[0].info.overBudget.bytesOverBudget = bytesOverBudget -{{endif}} -{{if 'struct CUasyncNotificationInfo_st' in found_types}} + def execAffinityParams(self): + arrs = [self._pvt_ptr[0].execAffinityParams + x*sizeof(cydriver.CUexecAffinityParam) for x in range(self._execAffinityParams_length)] + return [CUexecAffinityParam(_ptr=arr) for arr in arrs] + @execAffinityParams.setter + def execAffinityParams(self, val): + if len(val) == 0: + free(self._execAffinityParams) + self._execAffinityParams = NULL + self._execAffinityParams_length = 0 + self._pvt_ptr[0].execAffinityParams = NULL + else: + if self._execAffinityParams_length != len(val): + free(self._execAffinityParams) + self._execAffinityParams = calloc(len(val), sizeof(cydriver.CUexecAffinityParam)) + if self._execAffinityParams is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(cydriver.CUexecAffinityParam))) + self._execAffinityParams_length = len(val) + self._pvt_ptr[0].execAffinityParams = self._execAffinityParams + for idx in range(len(val)): + string.memcpy(&self._execAffinityParams[idx], (val[idx])._pvt_ptr, sizeof(cydriver.CUexecAffinityParam)) -cdef class anon_union2: + + + @property + def numExecAffinityParams(self): + return self._pvt_ptr[0].numExecAffinityParams + @numExecAffinityParams.setter + def numExecAffinityParams(self, int numExecAffinityParams): + self._pvt_ptr[0].numExecAffinityParams = numExecAffinityParams + + + @property + def cigParams(self): + arrs = [self._pvt_ptr[0].cigParams + x*sizeof(cydriver.CUctxCigParam) for x in range(self._cigParams_length)] + return [CUctxCigParam(_ptr=arr) for arr in arrs] + @cigParams.setter + def cigParams(self, val): + if len(val) == 0: + free(self._cigParams) + self._cigParams = NULL + self._cigParams_length = 0 + self._pvt_ptr[0].cigParams = NULL + else: + if self._cigParams_length != len(val): + free(self._cigParams) + self._cigParams = calloc(len(val), sizeof(cydriver.CUctxCigParam)) + if self._cigParams is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(cydriver.CUctxCigParam))) + self._cigParams_length = len(val) + self._pvt_ptr[0].cigParams = self._cigParams + for idx in range(len(val)): + string.memcpy(&self._cigParams[idx], (val[idx])._pvt_ptr, sizeof(cydriver.CUctxCigParam)) + + + +cdef class CUstreamCigParam_st: """ + CIG Stream Capture Params + Attributes ---------- - overBudget : anon_struct0 + + streamSharedDataType : CUstreamCigDataType + Type of shared data from graphics client (D3D12). + + + streamSharedData : Any + Graphics client data handle + (ID3D12CommandList/ID3D12GraphicsCommandList). Methods ------- getPtr() Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr - - def __init__(self, void_ptr _ptr): - self._overBudget = anon_struct0(_ptr=self._ptr) + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass def __dealloc__(self): pass def getPtr(self): - return &self._ptr[0].info + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['overBudget :\n' + '\n'.join([' ' + line for line in str(self.overBudget).splitlines()])] + str_list += ['streamSharedDataType : ' + str(self.streamSharedDataType)] except ValueError: - str_list += ['overBudget : '] + str_list += ['streamSharedDataType : '] + + + try: + str_list += ['streamSharedData : ' + hex(self.streamSharedData)] + except ValueError: + str_list += ['streamSharedData : '] + return '\n'.join(str_list) else: return '' + @property - def overBudget(self): - return self._overBudget - @overBudget.setter - def overBudget(self, overBudget not None : anon_struct0): - string.memcpy(&self._ptr[0].info.overBudget, overBudget.getPtr(), sizeof(self._ptr[0].info.overBudget)) -{{endif}} -{{if 'struct CUasyncNotificationInfo_st' in found_types}} + def streamSharedDataType(self): + return CUstreamCigDataType(self._pvt_ptr[0].streamSharedDataType) + @streamSharedDataType.setter + def streamSharedDataType(self, streamSharedDataType not None : CUstreamCigDataType): + self._pvt_ptr[0].streamSharedDataType = int(streamSharedDataType) -cdef class CUasyncNotificationInfo_st: + + @property + def streamSharedData(self): + return self._pvt_ptr[0].streamSharedData + @streamSharedData.setter + def streamSharedData(self, streamSharedData): + self._cystreamSharedData = _HelperInputVoidPtr(streamSharedData) + self._pvt_ptr[0].streamSharedData = self._cystreamSharedData.cptr + + +cdef class CUstreamCigCaptureParams_st: """ - Information passed to the user via the async notification callback + Params for capturing CUDA stream to CIG streamCigParams must be + non-NULL. Attributes ---------- - type : CUasyncNotificationType - info : anon_union2 + streamCigParams : CUstreamCigParam + CIG (CUDA in Graphics) parameters for sharing command list data + from D3D12 graphics clients. Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._val_ptr = calloc(1, sizeof(ccuda.CUasyncNotificationInfo_st)) - self._ptr = self._val_ptr + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - self._info = anon_union2(_ptr=self._ptr) + pass def __dealloc__(self): - if self._val_ptr is not NULL: - free(self._val_ptr) + pass + + if self._streamCigParams is not NULL: + free(self._streamCigParams) + self._pvt_ptr[0].streamCigParams = NULL + def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['type : ' + str(self.type)] - except ValueError: - str_list += ['type : '] - try: - str_list += ['info :\n' + '\n'.join([' ' + line for line in str(self.info).splitlines()])] + str_list += ['streamCigParams : ' + str(self.streamCigParams)] except ValueError: - str_list += ['info : '] + str_list += ['streamCigParams : '] + return '\n'.join(str_list) else: return '' + @property - def type(self): - return CUasyncNotificationType(self._ptr[0].type) - @type.setter - def type(self, type not None : CUasyncNotificationType): - self._ptr[0].type = type.value - @property - def info(self): - return self._info - @info.setter - def info(self, info not None : anon_union2): - string.memcpy(&self._ptr[0].info, info.getPtr(), sizeof(self._ptr[0].info)) -{{endif}} -{{if 'struct CUdevprop_st' in found_types}} + def streamCigParams(self): + arrs = [self._pvt_ptr[0].streamCigParams + x*sizeof(cydriver.CUstreamCigParam) for x in range(self._streamCigParams_length)] + return [CUstreamCigParam(_ptr=arr) for arr in arrs] + @streamCigParams.setter + def streamCigParams(self, val): + if len(val) == 0: + free(self._streamCigParams) + self._streamCigParams = NULL + self._streamCigParams_length = 0 + self._pvt_ptr[0].streamCigParams = NULL + else: + if self._streamCigParams_length != len(val): + free(self._streamCigParams) + self._streamCigParams = calloc(len(val), sizeof(cydriver.CUstreamCigParam)) + if self._streamCigParams is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(cydriver.CUstreamCigParam))) + self._streamCigParams_length = len(val) + self._pvt_ptr[0].streamCigParams = self._streamCigParams + for idx in range(len(val)): + string.memcpy(&self._streamCigParams[idx], (val[idx])._pvt_ptr, sizeof(cydriver.CUstreamCigParam)) + -cdef class CUdevprop_st: - """ - Legacy device properties +cdef class CUlibraryHostUniversalFunctionAndDataTable_st: + """ Attributes ---------- - maxThreadsPerBlock : int - Maximum number of threads per block - maxThreadsDim : List[int] - Maximum size of each dimension of a block - maxGridSize : List[int] - Maximum size of each dimension of a grid - sharedMemPerBlock : int - Shared memory available per block in bytes - totalConstantMemory : int - Constant memory available on device in bytes - SIMDWidth : int - Warp size in threads - memPitch : int - Maximum pitch in bytes allowed by memory copies - regsPerBlock : int - 32-bit registers available per block - clockRate : int - Clock frequency in kilohertz - textureAlign : int - Alignment requirement for textures + + functionTable : Any + + + + functionWindowSize : size_t + + + + dataTable : Any + + + + dataWindowSize : size_t + + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): pass def __dealloc__(self): pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['maxThreadsPerBlock : ' + str(self.maxThreadsPerBlock)] - except ValueError: - str_list += ['maxThreadsPerBlock : '] - try: - str_list += ['maxThreadsDim : ' + str(self.maxThreadsDim)] - except ValueError: - str_list += ['maxThreadsDim : '] - try: - str_list += ['maxGridSize : ' + str(self.maxGridSize)] - except ValueError: - str_list += ['maxGridSize : '] - try: - str_list += ['sharedMemPerBlock : ' + str(self.sharedMemPerBlock)] - except ValueError: - str_list += ['sharedMemPerBlock : '] - try: - str_list += ['totalConstantMemory : ' + str(self.totalConstantMemory)] - except ValueError: - str_list += ['totalConstantMemory : '] - try: - str_list += ['SIMDWidth : ' + str(self.SIMDWidth)] - except ValueError: - str_list += ['SIMDWidth : '] - try: - str_list += ['memPitch : ' + str(self.memPitch)] + str_list += ['functionTable : ' + hex(self.functionTable)] except ValueError: - str_list += ['memPitch : '] + str_list += ['functionTable : '] + + try: - str_list += ['regsPerBlock : ' + str(self.regsPerBlock)] + str_list += ['functionWindowSize : ' + str(self.functionWindowSize)] except ValueError: - str_list += ['regsPerBlock : '] + str_list += ['functionWindowSize : '] + + try: - str_list += ['clockRate : ' + str(self.clockRate)] + str_list += ['dataTable : ' + hex(self.dataTable)] except ValueError: - str_list += ['clockRate : '] + str_list += ['dataTable : '] + + try: - str_list += ['textureAlign : ' + str(self.textureAlign)] + str_list += ['dataWindowSize : ' + str(self.dataWindowSize)] except ValueError: - str_list += ['textureAlign : '] + str_list += ['dataWindowSize : '] + return '\n'.join(str_list) else: return '' + @property - def maxThreadsPerBlock(self): - return self._ptr[0].maxThreadsPerBlock - @maxThreadsPerBlock.setter - def maxThreadsPerBlock(self, int maxThreadsPerBlock): - self._ptr[0].maxThreadsPerBlock = maxThreadsPerBlock - @property - def maxThreadsDim(self): - return self._ptr[0].maxThreadsDim - @maxThreadsDim.setter - def maxThreadsDim(self, maxThreadsDim): - self._ptr[0].maxThreadsDim = maxThreadsDim - @property - def maxGridSize(self): - return self._ptr[0].maxGridSize - @maxGridSize.setter - def maxGridSize(self, maxGridSize): - self._ptr[0].maxGridSize = maxGridSize - @property - def sharedMemPerBlock(self): - return self._ptr[0].sharedMemPerBlock - @sharedMemPerBlock.setter - def sharedMemPerBlock(self, int sharedMemPerBlock): - self._ptr[0].sharedMemPerBlock = sharedMemPerBlock - @property - def totalConstantMemory(self): - return self._ptr[0].totalConstantMemory - @totalConstantMemory.setter - def totalConstantMemory(self, int totalConstantMemory): - self._ptr[0].totalConstantMemory = totalConstantMemory - @property - def SIMDWidth(self): - return self._ptr[0].SIMDWidth - @SIMDWidth.setter - def SIMDWidth(self, int SIMDWidth): - self._ptr[0].SIMDWidth = SIMDWidth - @property - def memPitch(self): - return self._ptr[0].memPitch - @memPitch.setter - def memPitch(self, int memPitch): - self._ptr[0].memPitch = memPitch + def functionTable(self): + return self._pvt_ptr[0].functionTable + @functionTable.setter + def functionTable(self, functionTable): + self._cyfunctionTable = _HelperInputVoidPtr(functionTable) + self._pvt_ptr[0].functionTable = self._cyfunctionTable.cptr + + @property - def regsPerBlock(self): - return self._ptr[0].regsPerBlock - @regsPerBlock.setter - def regsPerBlock(self, int regsPerBlock): - self._ptr[0].regsPerBlock = regsPerBlock + def functionWindowSize(self): + return self._pvt_ptr[0].functionWindowSize + @functionWindowSize.setter + def functionWindowSize(self, size_t functionWindowSize): + self._pvt_ptr[0].functionWindowSize = functionWindowSize + + @property - def clockRate(self): - return self._ptr[0].clockRate - @clockRate.setter - def clockRate(self, int clockRate): - self._ptr[0].clockRate = clockRate + def dataTable(self): + return self._pvt_ptr[0].dataTable + @dataTable.setter + def dataTable(self, dataTable): + self._cydataTable = _HelperInputVoidPtr(dataTable) + self._pvt_ptr[0].dataTable = self._cydataTable.cptr + + @property - def textureAlign(self): - return self._ptr[0].textureAlign - @textureAlign.setter - def textureAlign(self, int textureAlign): - self._ptr[0].textureAlign = textureAlign -{{endif}} -{{if 'struct CUaccessPolicyWindow_st' in found_types}} + def dataWindowSize(self): + return self._pvt_ptr[0].dataWindowSize + @dataWindowSize.setter + def dataWindowSize(self, size_t dataWindowSize): + self._pvt_ptr[0].dataWindowSize = dataWindowSize -cdef class CUaccessPolicyWindow_st: + +cdef class CUDA_MEMCPY2D_st: """ - Specifies an access policy for a window, a contiguous extent of - memory beginning at base_ptr and ending at base_ptr + num_bytes. - num_bytes is limited by - CU_DEVICE_ATTRIBUTE_MAX_ACCESS_POLICY_WINDOW_SIZE. Partition into - many segments and assign segments such that: sum of "hit segments" - / window == approx. ratio. sum of "miss segments" / window == - approx 1-ratio. Segments and ratio specifications are fitted to the - capabilities of the architecture. Accesses in a hit segment apply - the hitProp access policy. Accesses in a miss segment apply the - missProp access policy. + 2D memory copy parameters Attributes ---------- - base_ptr : Any - Starting address of the access policy window. CUDA driver may align - it. - num_bytes : size_t - Size in bytes of the window policy. CUDA driver may restrict the - maximum size and alignment. - hitRatio : float - hitRatio specifies percentage of lines assigned hitProp, rest are - assigned missProp. - hitProp : CUaccessProperty - CUaccessProperty set for hit. - missProp : CUaccessProperty - CUaccessProperty set for miss. Must be either NORMAL or STREAMING + + srcXInBytes : size_t + Source X in bytes + + + srcY : size_t + Source Y + + + srcMemoryType : CUmemorytype + Source memory type (host, device, array) + + + srcHost : Any + Source host pointer + + + srcDevice : CUdeviceptr + Source device pointer + + + srcArray : CUarray + Source array reference + + + srcPitch : size_t + Source pitch (ignored when src is array) + + + dstXInBytes : size_t + Destination X in bytes + + + dstY : size_t + Destination Y + + + dstMemoryType : CUmemorytype + Destination memory type (host, device, array) + + + dstHost : Any + Destination host pointer + + + dstDevice : CUdeviceptr + Destination device pointer + + + dstArray : CUarray + Destination array reference + + + dstPitch : size_t + Destination pitch (ignored when dst is array) + + + WidthInBytes : size_t + Width of 2D memory copy in bytes + + + Height : size_t + Height of 2D memory copy + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): pass + + self._srcDevice = CUdeviceptr(_ptr=&self._pvt_ptr[0].srcDevice) + + + self._srcArray = CUarray(_ptr=&self._pvt_ptr[0].srcArray) + + + self._dstDevice = CUdeviceptr(_ptr=&self._pvt_ptr[0].dstDevice) + + + self._dstArray = CUarray(_ptr=&self._pvt_ptr[0].dstArray) + def __dealloc__(self): pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['base_ptr : ' + hex(self.base_ptr)] + str_list += ['srcXInBytes : ' + str(self.srcXInBytes)] except ValueError: - str_list += ['base_ptr : '] + str_list += ['srcXInBytes : '] + + try: - str_list += ['num_bytes : ' + str(self.num_bytes)] + str_list += ['srcY : ' + str(self.srcY)] except ValueError: - str_list += ['num_bytes : '] + str_list += ['srcY : '] + + try: - str_list += ['hitRatio : ' + str(self.hitRatio)] + str_list += ['srcMemoryType : ' + str(self.srcMemoryType)] except ValueError: - str_list += ['hitRatio : '] + str_list += ['srcMemoryType : '] + + try: - str_list += ['hitProp : ' + str(self.hitProp)] + str_list += ['srcHost : ' + hex(self.srcHost)] except ValueError: - str_list += ['hitProp : '] + str_list += ['srcHost : '] + + try: - str_list += ['missProp : ' + str(self.missProp)] + str_list += ['srcDevice : ' + str(self.srcDevice)] except ValueError: - str_list += ['missProp : '] + str_list += ['srcDevice : '] + + + try: + str_list += ['srcArray : ' + str(self.srcArray)] + except ValueError: + str_list += ['srcArray : '] + + + try: + str_list += ['srcPitch : ' + str(self.srcPitch)] + except ValueError: + str_list += ['srcPitch : '] + + + try: + str_list += ['dstXInBytes : ' + str(self.dstXInBytes)] + except ValueError: + str_list += ['dstXInBytes : '] + + + try: + str_list += ['dstY : ' + str(self.dstY)] + except ValueError: + str_list += ['dstY : '] + + + try: + str_list += ['dstMemoryType : ' + str(self.dstMemoryType)] + except ValueError: + str_list += ['dstMemoryType : '] + + + try: + str_list += ['dstHost : ' + hex(self.dstHost)] + except ValueError: + str_list += ['dstHost : '] + + + try: + str_list += ['dstDevice : ' + str(self.dstDevice)] + except ValueError: + str_list += ['dstDevice : '] + + + try: + str_list += ['dstArray : ' + str(self.dstArray)] + except ValueError: + str_list += ['dstArray : '] + + + try: + str_list += ['dstPitch : ' + str(self.dstPitch)] + except ValueError: + str_list += ['dstPitch : '] + + + try: + str_list += ['WidthInBytes : ' + str(self.WidthInBytes)] + except ValueError: + str_list += ['WidthInBytes : '] + + + try: + str_list += ['Height : ' + str(self.Height)] + except ValueError: + str_list += ['Height : '] + return '\n'.join(str_list) else: return '' + @property - def base_ptr(self): - return self._ptr[0].base_ptr - @base_ptr.setter - def base_ptr(self, base_ptr): - _cbase_ptr = utils.HelperInputVoidPtr(base_ptr) - self._ptr[0].base_ptr = _cbase_ptr.cptr + def srcXInBytes(self): + return self._pvt_ptr[0].srcXInBytes + @srcXInBytes.setter + def srcXInBytes(self, size_t srcXInBytes): + self._pvt_ptr[0].srcXInBytes = srcXInBytes + + @property - def num_bytes(self): - return self._ptr[0].num_bytes - @num_bytes.setter - def num_bytes(self, size_t num_bytes): - self._ptr[0].num_bytes = num_bytes + def srcY(self): + return self._pvt_ptr[0].srcY + @srcY.setter + def srcY(self, size_t srcY): + self._pvt_ptr[0].srcY = srcY + + @property - def hitRatio(self): - return self._ptr[0].hitRatio - @hitRatio.setter - def hitRatio(self, float hitRatio): - self._ptr[0].hitRatio = hitRatio + def srcMemoryType(self): + return CUmemorytype(self._pvt_ptr[0].srcMemoryType) + @srcMemoryType.setter + def srcMemoryType(self, srcMemoryType not None : CUmemorytype): + self._pvt_ptr[0].srcMemoryType = int(srcMemoryType) + + @property - def hitProp(self): - return CUaccessProperty(self._ptr[0].hitProp) - @hitProp.setter - def hitProp(self, hitProp not None : CUaccessProperty): - self._ptr[0].hitProp = hitProp.value + def srcHost(self): + return self._pvt_ptr[0].srcHost + @srcHost.setter + def srcHost(self, srcHost): + self._cysrcHost = _HelperInputVoidPtr(srcHost) + self._pvt_ptr[0].srcHost = self._cysrcHost.cptr + + @property - def missProp(self): - return CUaccessProperty(self._ptr[0].missProp) - @missProp.setter - def missProp(self, missProp not None : CUaccessProperty): - self._ptr[0].missProp = missProp.value -{{endif}} -{{if 'struct CUDA_KERNEL_NODE_PARAMS_st' in found_types}} + def srcDevice(self): + return self._srcDevice + @srcDevice.setter + def srcDevice(self, srcDevice): + cdef cydriver.CUdeviceptr cysrcDevice + if srcDevice is None: + cysrcDevice = 0 + elif isinstance(srcDevice, (CUdeviceptr)): + psrcDevice = int(srcDevice) + cysrcDevice = psrcDevice + else: + psrcDevice = int(CUdeviceptr(srcDevice)) + cysrcDevice = psrcDevice + self._srcDevice._pvt_ptr[0] = cysrcDevice -cdef class CUDA_KERNEL_NODE_PARAMS_st: + + + @property + def srcArray(self): + return self._srcArray + @srcArray.setter + def srcArray(self, srcArray): + cdef cydriver.CUarray cysrcArray + if srcArray is None: + cysrcArray = 0 + elif isinstance(srcArray, (CUarray,)): + psrcArray = int(srcArray) + cysrcArray = psrcArray + else: + psrcArray = int(CUarray(srcArray)) + cysrcArray = psrcArray + self._srcArray._pvt_ptr[0] = cysrcArray + + + @property + def srcPitch(self): + return self._pvt_ptr[0].srcPitch + @srcPitch.setter + def srcPitch(self, size_t srcPitch): + self._pvt_ptr[0].srcPitch = srcPitch + + + @property + def dstXInBytes(self): + return self._pvt_ptr[0].dstXInBytes + @dstXInBytes.setter + def dstXInBytes(self, size_t dstXInBytes): + self._pvt_ptr[0].dstXInBytes = dstXInBytes + + + @property + def dstY(self): + return self._pvt_ptr[0].dstY + @dstY.setter + def dstY(self, size_t dstY): + self._pvt_ptr[0].dstY = dstY + + + @property + def dstMemoryType(self): + return CUmemorytype(self._pvt_ptr[0].dstMemoryType) + @dstMemoryType.setter + def dstMemoryType(self, dstMemoryType not None : CUmemorytype): + self._pvt_ptr[0].dstMemoryType = int(dstMemoryType) + + + @property + def dstHost(self): + return self._pvt_ptr[0].dstHost + @dstHost.setter + def dstHost(self, dstHost): + self._cydstHost = _HelperInputVoidPtr(dstHost) + self._pvt_ptr[0].dstHost = self._cydstHost.cptr + + + @property + def dstDevice(self): + return self._dstDevice + @dstDevice.setter + def dstDevice(self, dstDevice): + cdef cydriver.CUdeviceptr cydstDevice + if dstDevice is None: + cydstDevice = 0 + elif isinstance(dstDevice, (CUdeviceptr)): + pdstDevice = int(dstDevice) + cydstDevice = pdstDevice + else: + pdstDevice = int(CUdeviceptr(dstDevice)) + cydstDevice = pdstDevice + self._dstDevice._pvt_ptr[0] = cydstDevice + + + + @property + def dstArray(self): + return self._dstArray + @dstArray.setter + def dstArray(self, dstArray): + cdef cydriver.CUarray cydstArray + if dstArray is None: + cydstArray = 0 + elif isinstance(dstArray, (CUarray,)): + pdstArray = int(dstArray) + cydstArray = pdstArray + else: + pdstArray = int(CUarray(dstArray)) + cydstArray = pdstArray + self._dstArray._pvt_ptr[0] = cydstArray + + + @property + def dstPitch(self): + return self._pvt_ptr[0].dstPitch + @dstPitch.setter + def dstPitch(self, size_t dstPitch): + self._pvt_ptr[0].dstPitch = dstPitch + + + @property + def WidthInBytes(self): + return self._pvt_ptr[0].WidthInBytes + @WidthInBytes.setter + def WidthInBytes(self, size_t WidthInBytes): + self._pvt_ptr[0].WidthInBytes = WidthInBytes + + + @property + def Height(self): + return self._pvt_ptr[0].Height + @Height.setter + def Height(self, size_t Height): + self._pvt_ptr[0].Height = Height + + +cdef class CUDA_MEMCPY3D_st: """ - GPU kernel node parameters + 3D memory copy parameters Attributes ---------- - func : CUfunction - Kernel to launch - gridDimX : unsigned int - Width of grid in blocks - gridDimY : unsigned int - Height of grid in blocks - gridDimZ : unsigned int - Depth of grid in blocks - blockDimX : unsigned int - X dimension of each thread block - blockDimY : unsigned int - Y dimension of each thread block - blockDimZ : unsigned int - Z dimension of each thread block - sharedMemBytes : unsigned int - Dynamic shared-memory size per thread block in bytes - kernelParams : Any - Array of pointers to kernel parameters - extra : Any - Extra options + + srcXInBytes : size_t + Source X in bytes + + + srcY : size_t + Source Y + + + srcZ : size_t + Source Z + + + srcLOD : size_t + Source LOD + + + srcMemoryType : CUmemorytype + Source memory type (host, device, array) + + + srcHost : Any + Source host pointer + + + srcDevice : CUdeviceptr + Source device pointer + + + srcArray : CUarray + Source array reference + + + reserved0 : Any + Must be NULL + + + srcPitch : size_t + Source pitch (ignored when src is array) + + + srcHeight : size_t + Source height (ignored when src is array; may be 0 if Depth==1) + + + dstXInBytes : size_t + Destination X in bytes + + + dstY : size_t + Destination Y + + + dstZ : size_t + Destination Z + + + dstLOD : size_t + Destination LOD + + + dstMemoryType : CUmemorytype + Destination memory type (host, device, array) + + + dstHost : Any + Destination host pointer + + + dstDevice : CUdeviceptr + Destination device pointer + + + dstArray : CUarray + Destination array reference + + + reserved1 : Any + Must be NULL + + + dstPitch : size_t + Destination pitch (ignored when dst is array) + + + dstHeight : size_t + Destination height (ignored when dst is array; may be 0 if + Depth==1) + + + WidthInBytes : size_t + Width of 3D memory copy in bytes + + + Height : size_t + Height of 3D memory copy + + + Depth : size_t + Depth of 3D memory copy + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - self._func = CUfunction(_ptr=&self._ptr[0].func) + pass + + self._srcDevice = CUdeviceptr(_ptr=&self._pvt_ptr[0].srcDevice) + + + self._srcArray = CUarray(_ptr=&self._pvt_ptr[0].srcArray) + + + self._dstDevice = CUdeviceptr(_ptr=&self._pvt_ptr[0].dstDevice) + + + self._dstArray = CUarray(_ptr=&self._pvt_ptr[0].dstArray) + def __dealloc__(self): pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['func : ' + str(self.func)] - except ValueError: - str_list += ['func : '] - try: - str_list += ['gridDimX : ' + str(self.gridDimX)] - except ValueError: - str_list += ['gridDimX : '] - try: - str_list += ['gridDimY : ' + str(self.gridDimY)] + str_list += ['srcXInBytes : ' + str(self.srcXInBytes)] except ValueError: - str_list += ['gridDimY : '] + str_list += ['srcXInBytes : '] + + try: - str_list += ['gridDimZ : ' + str(self.gridDimZ)] + str_list += ['srcY : ' + str(self.srcY)] except ValueError: - str_list += ['gridDimZ : '] + str_list += ['srcY : '] + + try: - str_list += ['blockDimX : ' + str(self.blockDimX)] + str_list += ['srcZ : ' + str(self.srcZ)] except ValueError: - str_list += ['blockDimX : '] + str_list += ['srcZ : '] + + try: - str_list += ['blockDimY : ' + str(self.blockDimY)] + str_list += ['srcLOD : ' + str(self.srcLOD)] except ValueError: - str_list += ['blockDimY : '] + str_list += ['srcLOD : '] + + try: - str_list += ['blockDimZ : ' + str(self.blockDimZ)] + str_list += ['srcMemoryType : ' + str(self.srcMemoryType)] except ValueError: - str_list += ['blockDimZ : '] + str_list += ['srcMemoryType : '] + + try: - str_list += ['sharedMemBytes : ' + str(self.sharedMemBytes)] + str_list += ['srcHost : ' + hex(self.srcHost)] except ValueError: - str_list += ['sharedMemBytes : '] + str_list += ['srcHost : '] + + try: - str_list += ['kernelParams : ' + str(self.kernelParams)] + str_list += ['srcDevice : ' + str(self.srcDevice)] except ValueError: - str_list += ['kernelParams : '] + str_list += ['srcDevice : '] + + try: - str_list += ['extra : ' + str(self.extra)] + str_list += ['srcArray : ' + str(self.srcArray)] except ValueError: - str_list += ['extra : '] - return '\n'.join(str_list) - else: - return '' - @property - def func(self): - return self._func - @func.setter - def func(self, func): - cdef ccuda.CUfunction cfunc - if func is None: - cfunc = 0 - elif isinstance(func, (CUfunction,)): - pfunc = int(func) - cfunc = pfunc - else: - pfunc = int(CUfunction(func)) - cfunc = pfunc - self._func._ptr[0] = cfunc - @property - def gridDimX(self): - return self._ptr[0].gridDimX - @gridDimX.setter - def gridDimX(self, unsigned int gridDimX): - self._ptr[0].gridDimX = gridDimX - @property - def gridDimY(self): - return self._ptr[0].gridDimY - @gridDimY.setter - def gridDimY(self, unsigned int gridDimY): - self._ptr[0].gridDimY = gridDimY - @property - def gridDimZ(self): - return self._ptr[0].gridDimZ - @gridDimZ.setter - def gridDimZ(self, unsigned int gridDimZ): - self._ptr[0].gridDimZ = gridDimZ - @property - def blockDimX(self): - return self._ptr[0].blockDimX - @blockDimX.setter - def blockDimX(self, unsigned int blockDimX): - self._ptr[0].blockDimX = blockDimX - @property - def blockDimY(self): - return self._ptr[0].blockDimY - @blockDimY.setter - def blockDimY(self, unsigned int blockDimY): - self._ptr[0].blockDimY = blockDimY - @property - def blockDimZ(self): - return self._ptr[0].blockDimZ - @blockDimZ.setter - def blockDimZ(self, unsigned int blockDimZ): - self._ptr[0].blockDimZ = blockDimZ - @property - def sharedMemBytes(self): - return self._ptr[0].sharedMemBytes - @sharedMemBytes.setter - def sharedMemBytes(self, unsigned int sharedMemBytes): - self._ptr[0].sharedMemBytes = sharedMemBytes - @property - def kernelParams(self): - return self._ptr[0].kernelParams - @kernelParams.setter - def kernelParams(self, kernelParams): - self._ckernelParams = utils.HelperKernelParams(kernelParams) - self._ptr[0].kernelParams = self._ckernelParams.ckernelParams - @property - def extra(self): - return self._ptr[0].extra - @extra.setter - def extra(self, void_ptr extra): - self._ptr[0].extra = extra -{{endif}} -{{if 'struct CUDA_KERNEL_NODE_PARAMS_v2_st' in found_types}} + str_list += ['srcArray : '] -cdef class CUDA_KERNEL_NODE_PARAMS_v2_st: - """ - GPU kernel node parameters - Attributes - ---------- - func : CUfunction - Kernel to launch - gridDimX : unsigned int - Width of grid in blocks - gridDimY : unsigned int - Height of grid in blocks - gridDimZ : unsigned int - Depth of grid in blocks - blockDimX : unsigned int - X dimension of each thread block - blockDimY : unsigned int - Y dimension of each thread block - blockDimZ : unsigned int - Z dimension of each thread block - sharedMemBytes : unsigned int - Dynamic shared-memory size per thread block in bytes - kernelParams : Any - Array of pointers to kernel parameters - extra : Any - Extra options - kern : CUkernel - Kernel to launch, will only be referenced if func is NULL - ctx : CUcontext - Context for the kernel task to run in. The value NULL will indicate - the current context should be used by the api. This field is - ignored if func is set. + try: + str_list += ['reserved0 : ' + hex(self.reserved0)] + except ValueError: + str_list += ['reserved0 : '] - Methods - ------- - getPtr() - Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - else: - self._ptr = _ptr - def __init__(self, void_ptr _ptr = 0): - self._func = CUfunction(_ptr=&self._ptr[0].func) - self._kern = CUkernel(_ptr=&self._ptr[0].kern) - self._ctx = CUcontext(_ptr=&self._ptr[0].ctx) - def __dealloc__(self): - pass - def getPtr(self): - return self._ptr - def __repr__(self): - if self._ptr is not NULL: - str_list = [] try: - str_list += ['func : ' + str(self.func)] + str_list += ['srcPitch : ' + str(self.srcPitch)] except ValueError: - str_list += ['func : '] + str_list += ['srcPitch : '] + + try: - str_list += ['gridDimX : ' + str(self.gridDimX)] + str_list += ['srcHeight : ' + str(self.srcHeight)] except ValueError: - str_list += ['gridDimX : '] + str_list += ['srcHeight : '] + + try: - str_list += ['gridDimY : ' + str(self.gridDimY)] + str_list += ['dstXInBytes : ' + str(self.dstXInBytes)] except ValueError: - str_list += ['gridDimY : '] + str_list += ['dstXInBytes : '] + + try: - str_list += ['gridDimZ : ' + str(self.gridDimZ)] + str_list += ['dstY : ' + str(self.dstY)] except ValueError: - str_list += ['gridDimZ : '] + str_list += ['dstY : '] + + try: - str_list += ['blockDimX : ' + str(self.blockDimX)] + str_list += ['dstZ : ' + str(self.dstZ)] except ValueError: - str_list += ['blockDimX : '] + str_list += ['dstZ : '] + + try: - str_list += ['blockDimY : ' + str(self.blockDimY)] + str_list += ['dstLOD : ' + str(self.dstLOD)] except ValueError: - str_list += ['blockDimY : '] + str_list += ['dstLOD : '] + + try: - str_list += ['blockDimZ : ' + str(self.blockDimZ)] + str_list += ['dstMemoryType : ' + str(self.dstMemoryType)] except ValueError: - str_list += ['blockDimZ : '] + str_list += ['dstMemoryType : '] + + try: - str_list += ['sharedMemBytes : ' + str(self.sharedMemBytes)] + str_list += ['dstHost : ' + hex(self.dstHost)] except ValueError: - str_list += ['sharedMemBytes : '] + str_list += ['dstHost : '] + + try: - str_list += ['kernelParams : ' + str(self.kernelParams)] + str_list += ['dstDevice : ' + str(self.dstDevice)] except ValueError: - str_list += ['kernelParams : '] + str_list += ['dstDevice : '] + + try: - str_list += ['extra : ' + str(self.extra)] + str_list += ['dstArray : ' + str(self.dstArray)] except ValueError: - str_list += ['extra : '] + str_list += ['dstArray : '] + + try: - str_list += ['kern : ' + str(self.kern)] + str_list += ['reserved1 : ' + hex(self.reserved1)] except ValueError: - str_list += ['kern : '] + str_list += ['reserved1 : '] + + try: - str_list += ['ctx : ' + str(self.ctx)] + str_list += ['dstPitch : ' + str(self.dstPitch)] except ValueError: - str_list += ['ctx : '] + str_list += ['dstPitch : '] + + + try: + str_list += ['dstHeight : ' + str(self.dstHeight)] + except ValueError: + str_list += ['dstHeight : '] + + + try: + str_list += ['WidthInBytes : ' + str(self.WidthInBytes)] + except ValueError: + str_list += ['WidthInBytes : '] + + + try: + str_list += ['Height : ' + str(self.Height)] + except ValueError: + str_list += ['Height : '] + + + try: + str_list += ['Depth : ' + str(self.Depth)] + except ValueError: + str_list += ['Depth : '] + return '\n'.join(str_list) else: return '' + @property - def func(self): - return self._func - @func.setter - def func(self, func): - cdef ccuda.CUfunction cfunc - if func is None: - cfunc = 0 - elif isinstance(func, (CUfunction,)): - pfunc = int(func) - cfunc = pfunc + def srcXInBytes(self): + return self._pvt_ptr[0].srcXInBytes + @srcXInBytes.setter + def srcXInBytes(self, size_t srcXInBytes): + self._pvt_ptr[0].srcXInBytes = srcXInBytes + + + @property + def srcY(self): + return self._pvt_ptr[0].srcY + @srcY.setter + def srcY(self, size_t srcY): + self._pvt_ptr[0].srcY = srcY + + + @property + def srcZ(self): + return self._pvt_ptr[0].srcZ + @srcZ.setter + def srcZ(self, size_t srcZ): + self._pvt_ptr[0].srcZ = srcZ + + + @property + def srcLOD(self): + return self._pvt_ptr[0].srcLOD + @srcLOD.setter + def srcLOD(self, size_t srcLOD): + self._pvt_ptr[0].srcLOD = srcLOD + + + @property + def srcMemoryType(self): + return CUmemorytype(self._pvt_ptr[0].srcMemoryType) + @srcMemoryType.setter + def srcMemoryType(self, srcMemoryType not None : CUmemorytype): + self._pvt_ptr[0].srcMemoryType = int(srcMemoryType) + + + @property + def srcHost(self): + return self._pvt_ptr[0].srcHost + @srcHost.setter + def srcHost(self, srcHost): + self._cysrcHost = _HelperInputVoidPtr(srcHost) + self._pvt_ptr[0].srcHost = self._cysrcHost.cptr + + + @property + def srcDevice(self): + return self._srcDevice + @srcDevice.setter + def srcDevice(self, srcDevice): + cdef cydriver.CUdeviceptr cysrcDevice + if srcDevice is None: + cysrcDevice = 0 + elif isinstance(srcDevice, (CUdeviceptr)): + psrcDevice = int(srcDevice) + cysrcDevice = psrcDevice else: - pfunc = int(CUfunction(func)) - cfunc = pfunc - self._func._ptr[0] = cfunc + psrcDevice = int(CUdeviceptr(srcDevice)) + cysrcDevice = psrcDevice + self._srcDevice._pvt_ptr[0] = cysrcDevice + + + @property - def gridDimX(self): - return self._ptr[0].gridDimX - @gridDimX.setter - def gridDimX(self, unsigned int gridDimX): - self._ptr[0].gridDimX = gridDimX + def srcArray(self): + return self._srcArray + @srcArray.setter + def srcArray(self, srcArray): + cdef cydriver.CUarray cysrcArray + if srcArray is None: + cysrcArray = 0 + elif isinstance(srcArray, (CUarray,)): + psrcArray = int(srcArray) + cysrcArray = psrcArray + else: + psrcArray = int(CUarray(srcArray)) + cysrcArray = psrcArray + self._srcArray._pvt_ptr[0] = cysrcArray + + @property - def gridDimY(self): - return self._ptr[0].gridDimY - @gridDimY.setter - def gridDimY(self, unsigned int gridDimY): - self._ptr[0].gridDimY = gridDimY + def reserved0(self): + return self._pvt_ptr[0].reserved0 + @reserved0.setter + def reserved0(self, reserved0): + self._cyreserved0 = _HelperInputVoidPtr(reserved0) + self._pvt_ptr[0].reserved0 = self._cyreserved0.cptr + + @property - def gridDimZ(self): - return self._ptr[0].gridDimZ - @gridDimZ.setter - def gridDimZ(self, unsigned int gridDimZ): - self._ptr[0].gridDimZ = gridDimZ + def srcPitch(self): + return self._pvt_ptr[0].srcPitch + @srcPitch.setter + def srcPitch(self, size_t srcPitch): + self._pvt_ptr[0].srcPitch = srcPitch + + @property - def blockDimX(self): - return self._ptr[0].blockDimX - @blockDimX.setter - def blockDimX(self, unsigned int blockDimX): - self._ptr[0].blockDimX = blockDimX + def srcHeight(self): + return self._pvt_ptr[0].srcHeight + @srcHeight.setter + def srcHeight(self, size_t srcHeight): + self._pvt_ptr[0].srcHeight = srcHeight + + @property - def blockDimY(self): - return self._ptr[0].blockDimY - @blockDimY.setter - def blockDimY(self, unsigned int blockDimY): - self._ptr[0].blockDimY = blockDimY + def dstXInBytes(self): + return self._pvt_ptr[0].dstXInBytes + @dstXInBytes.setter + def dstXInBytes(self, size_t dstXInBytes): + self._pvt_ptr[0].dstXInBytes = dstXInBytes + + @property - def blockDimZ(self): - return self._ptr[0].blockDimZ - @blockDimZ.setter - def blockDimZ(self, unsigned int blockDimZ): - self._ptr[0].blockDimZ = blockDimZ + def dstY(self): + return self._pvt_ptr[0].dstY + @dstY.setter + def dstY(self, size_t dstY): + self._pvt_ptr[0].dstY = dstY + + @property - def sharedMemBytes(self): - return self._ptr[0].sharedMemBytes - @sharedMemBytes.setter - def sharedMemBytes(self, unsigned int sharedMemBytes): - self._ptr[0].sharedMemBytes = sharedMemBytes + def dstZ(self): + return self._pvt_ptr[0].dstZ + @dstZ.setter + def dstZ(self, size_t dstZ): + self._pvt_ptr[0].dstZ = dstZ + + @property - def kernelParams(self): - return self._ptr[0].kernelParams - @kernelParams.setter - def kernelParams(self, kernelParams): - self._ckernelParams = utils.HelperKernelParams(kernelParams) - self._ptr[0].kernelParams = self._ckernelParams.ckernelParams + def dstLOD(self): + return self._pvt_ptr[0].dstLOD + @dstLOD.setter + def dstLOD(self, size_t dstLOD): + self._pvt_ptr[0].dstLOD = dstLOD + + @property - def extra(self): - return self._ptr[0].extra - @extra.setter - def extra(self, void_ptr extra): - self._ptr[0].extra = extra + def dstMemoryType(self): + return CUmemorytype(self._pvt_ptr[0].dstMemoryType) + @dstMemoryType.setter + def dstMemoryType(self, dstMemoryType not None : CUmemorytype): + self._pvt_ptr[0].dstMemoryType = int(dstMemoryType) + + @property - def kern(self): - return self._kern - @kern.setter - def kern(self, kern): - cdef ccuda.CUkernel ckern - if kern is None: - ckern = 0 - elif isinstance(kern, (CUkernel,)): - pkern = int(kern) - ckern = pkern + def dstHost(self): + return self._pvt_ptr[0].dstHost + @dstHost.setter + def dstHost(self, dstHost): + self._cydstHost = _HelperInputVoidPtr(dstHost) + self._pvt_ptr[0].dstHost = self._cydstHost.cptr + + + @property + def dstDevice(self): + return self._dstDevice + @dstDevice.setter + def dstDevice(self, dstDevice): + cdef cydriver.CUdeviceptr cydstDevice + if dstDevice is None: + cydstDevice = 0 + elif isinstance(dstDevice, (CUdeviceptr)): + pdstDevice = int(dstDevice) + cydstDevice = pdstDevice else: - pkern = int(CUkernel(kern)) - ckern = pkern - self._kern._ptr[0] = ckern + pdstDevice = int(CUdeviceptr(dstDevice)) + cydstDevice = pdstDevice + self._dstDevice._pvt_ptr[0] = cydstDevice + + + @property - def ctx(self): - return self._ctx - @ctx.setter - def ctx(self, ctx): - cdef ccuda.CUcontext cctx - if ctx is None: - cctx = 0 - elif isinstance(ctx, (CUcontext,)): - pctx = int(ctx) - cctx = pctx + def dstArray(self): + return self._dstArray + @dstArray.setter + def dstArray(self, dstArray): + cdef cydriver.CUarray cydstArray + if dstArray is None: + cydstArray = 0 + elif isinstance(dstArray, (CUarray,)): + pdstArray = int(dstArray) + cydstArray = pdstArray else: - pctx = int(CUcontext(ctx)) - cctx = pctx - self._ctx._ptr[0] = cctx -{{endif}} -{{if 'struct CUDA_KERNEL_NODE_PARAMS_v3_st' in found_types}} + pdstArray = int(CUarray(dstArray)) + cydstArray = pdstArray + self._dstArray._pvt_ptr[0] = cydstArray -cdef class CUDA_KERNEL_NODE_PARAMS_v3_st: + + @property + def reserved1(self): + return self._pvt_ptr[0].reserved1 + @reserved1.setter + def reserved1(self, reserved1): + self._cyreserved1 = _HelperInputVoidPtr(reserved1) + self._pvt_ptr[0].reserved1 = self._cyreserved1.cptr + + + @property + def dstPitch(self): + return self._pvt_ptr[0].dstPitch + @dstPitch.setter + def dstPitch(self, size_t dstPitch): + self._pvt_ptr[0].dstPitch = dstPitch + + + @property + def dstHeight(self): + return self._pvt_ptr[0].dstHeight + @dstHeight.setter + def dstHeight(self, size_t dstHeight): + self._pvt_ptr[0].dstHeight = dstHeight + + + @property + def WidthInBytes(self): + return self._pvt_ptr[0].WidthInBytes + @WidthInBytes.setter + def WidthInBytes(self, size_t WidthInBytes): + self._pvt_ptr[0].WidthInBytes = WidthInBytes + + + @property + def Height(self): + return self._pvt_ptr[0].Height + @Height.setter + def Height(self, size_t Height): + self._pvt_ptr[0].Height = Height + + + @property + def Depth(self): + return self._pvt_ptr[0].Depth + @Depth.setter + def Depth(self, size_t Depth): + self._pvt_ptr[0].Depth = Depth + + +cdef class CUDA_MEMCPY3D_PEER_st: """ - GPU kernel node parameters + 3D memory cross-context copy parameters Attributes ---------- - func : CUfunction - Kernel to launch - gridDimX : unsigned int - Width of grid in blocks - gridDimY : unsigned int - Height of grid in blocks - gridDimZ : unsigned int - Depth of grid in blocks - blockDimX : unsigned int - X dimension of each thread block - blockDimY : unsigned int - Y dimension of each thread block - blockDimZ : unsigned int - Z dimension of each thread block - sharedMemBytes : unsigned int - Dynamic shared-memory size per thread block in bytes - kernelParams : Any - Array of pointers to kernel parameters - extra : Any - Extra options - kern : CUkernel - Kernel to launch, will only be referenced if func is NULL - ctx : CUcontext - Context for the kernel task to run in. The value NULL will indicate - the current context should be used by the api. This field is - ignored if func is set. + + srcXInBytes : size_t + Source X in bytes + + + srcY : size_t + Source Y + + + srcZ : size_t + Source Z + + + srcLOD : size_t + Source LOD + + + srcMemoryType : CUmemorytype + Source memory type (host, device, array) + + + srcHost : Any + Source host pointer + + + srcDevice : CUdeviceptr + Source device pointer + + + srcArray : CUarray + Source array reference + + + srcContext : CUcontext + Source context (ignored with srcMemoryType is CU_MEMORYTYPE_ARRAY) + + + srcPitch : size_t + Source pitch (ignored when src is array) + + + srcHeight : size_t + Source height (ignored when src is array; may be 0 if Depth==1) + + + dstXInBytes : size_t + Destination X in bytes + + + dstY : size_t + Destination Y + + + dstZ : size_t + Destination Z + + + dstLOD : size_t + Destination LOD + + + dstMemoryType : CUmemorytype + Destination memory type (host, device, array) + + + dstHost : Any + Destination host pointer + + + dstDevice : CUdeviceptr + Destination device pointer + + + dstArray : CUarray + Destination array reference + + + dstContext : CUcontext + Destination context (ignored with dstMemoryType is + CU_MEMORYTYPE_ARRAY) + + + dstPitch : size_t + Destination pitch (ignored when dst is array) + + + dstHeight : size_t + Destination height (ignored when dst is array; may be 0 if + Depth==1) + + + WidthInBytes : size_t + Width of 3D memory copy in bytes + + + Height : size_t + Height of 3D memory copy + + + Depth : size_t + Depth of 3D memory copy + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - self._func = CUfunction(_ptr=&self._ptr[0].func) - self._kern = CUkernel(_ptr=&self._ptr[0].kern) - self._ctx = CUcontext(_ptr=&self._ptr[0].ctx) + pass + + self._srcDevice = CUdeviceptr(_ptr=&self._pvt_ptr[0].srcDevice) + + + self._srcArray = CUarray(_ptr=&self._pvt_ptr[0].srcArray) + + + self._srcContext = CUcontext(_ptr=&self._pvt_ptr[0].srcContext) + + + self._dstDevice = CUdeviceptr(_ptr=&self._pvt_ptr[0].dstDevice) + + + self._dstArray = CUarray(_ptr=&self._pvt_ptr[0].dstArray) + + + self._dstContext = CUcontext(_ptr=&self._pvt_ptr[0].dstContext) + def __dealloc__(self): pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['func : ' + str(self.func)] + str_list += ['srcXInBytes : ' + str(self.srcXInBytes)] except ValueError: - str_list += ['func : '] + str_list += ['srcXInBytes : '] + + + try: + str_list += ['srcY : ' + str(self.srcY)] + except ValueError: + str_list += ['srcY : '] + + + try: + str_list += ['srcZ : ' + str(self.srcZ)] + except ValueError: + str_list += ['srcZ : '] + + + try: + str_list += ['srcLOD : ' + str(self.srcLOD)] + except ValueError: + str_list += ['srcLOD : '] + + + try: + str_list += ['srcMemoryType : ' + str(self.srcMemoryType)] + except ValueError: + str_list += ['srcMemoryType : '] + + + try: + str_list += ['srcHost : ' + hex(self.srcHost)] + except ValueError: + str_list += ['srcHost : '] + + + try: + str_list += ['srcDevice : ' + str(self.srcDevice)] + except ValueError: + str_list += ['srcDevice : '] + + try: - str_list += ['gridDimX : ' + str(self.gridDimX)] + str_list += ['srcArray : ' + str(self.srcArray)] except ValueError: - str_list += ['gridDimX : '] + str_list += ['srcArray : '] + + try: - str_list += ['gridDimY : ' + str(self.gridDimY)] + str_list += ['srcContext : ' + str(self.srcContext)] except ValueError: - str_list += ['gridDimY : '] + str_list += ['srcContext : '] + + try: - str_list += ['gridDimZ : ' + str(self.gridDimZ)] + str_list += ['srcPitch : ' + str(self.srcPitch)] except ValueError: - str_list += ['gridDimZ : '] + str_list += ['srcPitch : '] + + try: - str_list += ['blockDimX : ' + str(self.blockDimX)] + str_list += ['srcHeight : ' + str(self.srcHeight)] except ValueError: - str_list += ['blockDimX : '] + str_list += ['srcHeight : '] + + try: - str_list += ['blockDimY : ' + str(self.blockDimY)] + str_list += ['dstXInBytes : ' + str(self.dstXInBytes)] except ValueError: - str_list += ['blockDimY : '] + str_list += ['dstXInBytes : '] + + try: - str_list += ['blockDimZ : ' + str(self.blockDimZ)] + str_list += ['dstY : ' + str(self.dstY)] except ValueError: - str_list += ['blockDimZ : '] + str_list += ['dstY : '] + + try: - str_list += ['sharedMemBytes : ' + str(self.sharedMemBytes)] + str_list += ['dstZ : ' + str(self.dstZ)] except ValueError: - str_list += ['sharedMemBytes : '] + str_list += ['dstZ : '] + + try: - str_list += ['kernelParams : ' + str(self.kernelParams)] + str_list += ['dstLOD : ' + str(self.dstLOD)] except ValueError: - str_list += ['kernelParams : '] + str_list += ['dstLOD : '] + + try: - str_list += ['extra : ' + str(self.extra)] + str_list += ['dstMemoryType : ' + str(self.dstMemoryType)] except ValueError: - str_list += ['extra : '] + str_list += ['dstMemoryType : '] + + try: - str_list += ['kern : ' + str(self.kern)] + str_list += ['dstHost : ' + hex(self.dstHost)] except ValueError: - str_list += ['kern : '] + str_list += ['dstHost : '] + + try: - str_list += ['ctx : ' + str(self.ctx)] + str_list += ['dstDevice : ' + str(self.dstDevice)] except ValueError: - str_list += ['ctx : '] - return '\n'.join(str_list) - else: - return '' - @property - def func(self): - return self._func - @func.setter - def func(self, func): - cdef ccuda.CUfunction cfunc - if func is None: - cfunc = 0 - elif isinstance(func, (CUfunction,)): - pfunc = int(func) - cfunc = pfunc - else: - pfunc = int(CUfunction(func)) - cfunc = pfunc - self._func._ptr[0] = cfunc - @property - def gridDimX(self): - return self._ptr[0].gridDimX - @gridDimX.setter - def gridDimX(self, unsigned int gridDimX): - self._ptr[0].gridDimX = gridDimX - @property - def gridDimY(self): - return self._ptr[0].gridDimY - @gridDimY.setter - def gridDimY(self, unsigned int gridDimY): - self._ptr[0].gridDimY = gridDimY - @property - def gridDimZ(self): - return self._ptr[0].gridDimZ - @gridDimZ.setter - def gridDimZ(self, unsigned int gridDimZ): - self._ptr[0].gridDimZ = gridDimZ - @property - def blockDimX(self): - return self._ptr[0].blockDimX - @blockDimX.setter - def blockDimX(self, unsigned int blockDimX): - self._ptr[0].blockDimX = blockDimX - @property - def blockDimY(self): - return self._ptr[0].blockDimY - @blockDimY.setter - def blockDimY(self, unsigned int blockDimY): - self._ptr[0].blockDimY = blockDimY - @property - def blockDimZ(self): - return self._ptr[0].blockDimZ - @blockDimZ.setter - def blockDimZ(self, unsigned int blockDimZ): - self._ptr[0].blockDimZ = blockDimZ - @property - def sharedMemBytes(self): - return self._ptr[0].sharedMemBytes - @sharedMemBytes.setter - def sharedMemBytes(self, unsigned int sharedMemBytes): - self._ptr[0].sharedMemBytes = sharedMemBytes - @property - def kernelParams(self): - return self._ptr[0].kernelParams - @kernelParams.setter - def kernelParams(self, kernelParams): - self._ckernelParams = utils.HelperKernelParams(kernelParams) - self._ptr[0].kernelParams = self._ckernelParams.ckernelParams - @property - def extra(self): - return self._ptr[0].extra - @extra.setter - def extra(self, void_ptr extra): - self._ptr[0].extra = extra - @property - def kern(self): - return self._kern - @kern.setter - def kern(self, kern): - cdef ccuda.CUkernel ckern - if kern is None: - ckern = 0 - elif isinstance(kern, (CUkernel,)): - pkern = int(kern) - ckern = pkern - else: - pkern = int(CUkernel(kern)) - ckern = pkern - self._kern._ptr[0] = ckern - @property - def ctx(self): - return self._ctx - @ctx.setter - def ctx(self, ctx): - cdef ccuda.CUcontext cctx - if ctx is None: - cctx = 0 - elif isinstance(ctx, (CUcontext,)): - pctx = int(ctx) - cctx = pctx - else: - pctx = int(CUcontext(ctx)) - cctx = pctx - self._ctx._ptr[0] = cctx -{{endif}} -{{if 'struct CUDA_MEMSET_NODE_PARAMS_st' in found_types}} + str_list += ['dstDevice : '] -cdef class CUDA_MEMSET_NODE_PARAMS_st: - """ - Memset node parameters - Attributes - ---------- - dst : CUdeviceptr - Destination device pointer - pitch : size_t - Pitch of destination device pointer. Unused if height is 1 - value : unsigned int - Value to be set - elementSize : unsigned int - Size of each element in bytes. Must be 1, 2, or 4. - width : size_t - Width of the row in elements - height : size_t - Number of rows + try: + str_list += ['dstArray : ' + str(self.dstArray)] + except ValueError: + str_list += ['dstArray : '] - Methods - ------- - getPtr() - Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - else: - self._ptr = _ptr - def __init__(self, void_ptr _ptr = 0): - self._dst = CUdeviceptr(_ptr=&self._ptr[0].dst) - def __dealloc__(self): - pass - def getPtr(self): - return self._ptr - def __repr__(self): - if self._ptr is not NULL: - str_list = [] try: - str_list += ['dst : ' + str(self.dst)] + str_list += ['dstContext : ' + str(self.dstContext)] except ValueError: - str_list += ['dst : '] + str_list += ['dstContext : '] + + try: - str_list += ['pitch : ' + str(self.pitch)] + str_list += ['dstPitch : ' + str(self.dstPitch)] except ValueError: - str_list += ['pitch : '] + str_list += ['dstPitch : '] + + try: - str_list += ['value : ' + str(self.value)] + str_list += ['dstHeight : ' + str(self.dstHeight)] except ValueError: - str_list += ['value : '] + str_list += ['dstHeight : '] + + try: - str_list += ['elementSize : ' + str(self.elementSize)] + str_list += ['WidthInBytes : ' + str(self.WidthInBytes)] except ValueError: - str_list += ['elementSize : '] + str_list += ['WidthInBytes : '] + + try: - str_list += ['width : ' + str(self.width)] + str_list += ['Height : ' + str(self.Height)] except ValueError: - str_list += ['width : '] + str_list += ['Height : '] + + try: - str_list += ['height : ' + str(self.height)] + str_list += ['Depth : ' + str(self.Depth)] except ValueError: - str_list += ['height : '] + str_list += ['Depth : '] + return '\n'.join(str_list) else: return '' - @property - def dst(self): - return self._dst - @dst.setter - def dst(self, dst): - cdef ccuda.CUdeviceptr cdst - if dst is None: - cdst = 0 - elif isinstance(dst, (CUdeviceptr)): - pdst = int(dst) - cdst = pdst - else: - pdst = int(CUdeviceptr(dst)) - cdst = pdst - self._dst._ptr[0] = cdst @property - def pitch(self): - return self._ptr[0].pitch - @pitch.setter - def pitch(self, size_t pitch): - self._ptr[0].pitch = pitch + def srcXInBytes(self): + return self._pvt_ptr[0].srcXInBytes + @srcXInBytes.setter + def srcXInBytes(self, size_t srcXInBytes): + self._pvt_ptr[0].srcXInBytes = srcXInBytes + + @property - def value(self): - return self._ptr[0].value - @value.setter - def value(self, unsigned int value): - self._ptr[0].value = value + def srcY(self): + return self._pvt_ptr[0].srcY + @srcY.setter + def srcY(self, size_t srcY): + self._pvt_ptr[0].srcY = srcY + + @property - def elementSize(self): - return self._ptr[0].elementSize - @elementSize.setter - def elementSize(self, unsigned int elementSize): - self._ptr[0].elementSize = elementSize + def srcZ(self): + return self._pvt_ptr[0].srcZ + @srcZ.setter + def srcZ(self, size_t srcZ): + self._pvt_ptr[0].srcZ = srcZ + + @property - def width(self): - return self._ptr[0].width - @width.setter - def width(self, size_t width): - self._ptr[0].width = width + def srcLOD(self): + return self._pvt_ptr[0].srcLOD + @srcLOD.setter + def srcLOD(self, size_t srcLOD): + self._pvt_ptr[0].srcLOD = srcLOD + + @property - def height(self): - return self._ptr[0].height - @height.setter - def height(self, size_t height): - self._ptr[0].height = height -{{endif}} -{{if 'struct CUDA_MEMSET_NODE_PARAMS_v2_st' in found_types}} + def srcMemoryType(self): + return CUmemorytype(self._pvt_ptr[0].srcMemoryType) + @srcMemoryType.setter + def srcMemoryType(self, srcMemoryType not None : CUmemorytype): + self._pvt_ptr[0].srcMemoryType = int(srcMemoryType) -cdef class CUDA_MEMSET_NODE_PARAMS_v2_st: - """ - Memset node parameters - Attributes - ---------- - dst : CUdeviceptr - Destination device pointer - pitch : size_t - Pitch of destination device pointer. Unused if height is 1 - value : unsigned int - Value to be set - elementSize : unsigned int - Size of each element in bytes. Must be 1, 2, or 4. - width : size_t - Width of the row in elements - height : size_t - Number of rows - ctx : CUcontext - Context on which to run the node + @property + def srcHost(self): + return self._pvt_ptr[0].srcHost + @srcHost.setter + def srcHost(self, srcHost): + self._cysrcHost = _HelperInputVoidPtr(srcHost) + self._pvt_ptr[0].srcHost = self._cysrcHost.cptr - Methods - ------- - getPtr() - Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val + @property + def srcDevice(self): + return self._srcDevice + @srcDevice.setter + def srcDevice(self, srcDevice): + cdef cydriver.CUdeviceptr cysrcDevice + if srcDevice is None: + cysrcDevice = 0 + elif isinstance(srcDevice, (CUdeviceptr)): + psrcDevice = int(srcDevice) + cysrcDevice = psrcDevice else: - self._ptr = _ptr - def __init__(self, void_ptr _ptr = 0): - self._dst = CUdeviceptr(_ptr=&self._ptr[0].dst) - self._ctx = CUcontext(_ptr=&self._ptr[0].ctx) - def __dealloc__(self): - pass - def getPtr(self): - return self._ptr - def __repr__(self): - if self._ptr is not NULL: - str_list = [] - try: - str_list += ['dst : ' + str(self.dst)] - except ValueError: - str_list += ['dst : '] - try: - str_list += ['pitch : ' + str(self.pitch)] - except ValueError: - str_list += ['pitch : '] - try: - str_list += ['value : ' + str(self.value)] - except ValueError: - str_list += ['value : '] - try: - str_list += ['elementSize : ' + str(self.elementSize)] - except ValueError: - str_list += ['elementSize : '] - try: - str_list += ['width : ' + str(self.width)] - except ValueError: - str_list += ['width : '] - try: - str_list += ['height : ' + str(self.height)] - except ValueError: - str_list += ['height : '] - try: - str_list += ['ctx : ' + str(self.ctx)] - except ValueError: - str_list += ['ctx : '] - return '\n'.join(str_list) + psrcDevice = int(CUdeviceptr(srcDevice)) + cysrcDevice = psrcDevice + self._srcDevice._pvt_ptr[0] = cysrcDevice + + + + @property + def srcArray(self): + return self._srcArray + @srcArray.setter + def srcArray(self, srcArray): + cdef cydriver.CUarray cysrcArray + if srcArray is None: + cysrcArray = 0 + elif isinstance(srcArray, (CUarray,)): + psrcArray = int(srcArray) + cysrcArray = psrcArray else: - return '' + psrcArray = int(CUarray(srcArray)) + cysrcArray = psrcArray + self._srcArray._pvt_ptr[0] = cysrcArray + + @property - def dst(self): - return self._dst - @dst.setter - def dst(self, dst): - cdef ccuda.CUdeviceptr cdst - if dst is None: - cdst = 0 - elif isinstance(dst, (CUdeviceptr)): - pdst = int(dst) - cdst = pdst + def srcContext(self): + return self._srcContext + @srcContext.setter + def srcContext(self, srcContext): + cdef cydriver.CUcontext cysrcContext + if srcContext is None: + cysrcContext = 0 + elif isinstance(srcContext, (CUcontext,)): + psrcContext = int(srcContext) + cysrcContext = psrcContext else: - pdst = int(CUdeviceptr(dst)) - cdst = pdst - self._dst._ptr[0] = cdst + psrcContext = int(CUcontext(srcContext)) + cysrcContext = psrcContext + self._srcContext._pvt_ptr[0] = cysrcContext + @property - def pitch(self): - return self._ptr[0].pitch - @pitch.setter - def pitch(self, size_t pitch): - self._ptr[0].pitch = pitch + def srcPitch(self): + return self._pvt_ptr[0].srcPitch + @srcPitch.setter + def srcPitch(self, size_t srcPitch): + self._pvt_ptr[0].srcPitch = srcPitch + + @property - def value(self): - return self._ptr[0].value - @value.setter - def value(self, unsigned int value): - self._ptr[0].value = value + def srcHeight(self): + return self._pvt_ptr[0].srcHeight + @srcHeight.setter + def srcHeight(self, size_t srcHeight): + self._pvt_ptr[0].srcHeight = srcHeight + + @property - def elementSize(self): - return self._ptr[0].elementSize - @elementSize.setter - def elementSize(self, unsigned int elementSize): - self._ptr[0].elementSize = elementSize + def dstXInBytes(self): + return self._pvt_ptr[0].dstXInBytes + @dstXInBytes.setter + def dstXInBytes(self, size_t dstXInBytes): + self._pvt_ptr[0].dstXInBytes = dstXInBytes + + @property - def width(self): - return self._ptr[0].width - @width.setter - def width(self, size_t width): - self._ptr[0].width = width + def dstY(self): + return self._pvt_ptr[0].dstY + @dstY.setter + def dstY(self, size_t dstY): + self._pvt_ptr[0].dstY = dstY + + @property - def height(self): - return self._ptr[0].height - @height.setter - def height(self, size_t height): - self._ptr[0].height = height + def dstZ(self): + return self._pvt_ptr[0].dstZ + @dstZ.setter + def dstZ(self, size_t dstZ): + self._pvt_ptr[0].dstZ = dstZ + + @property - def ctx(self): - return self._ctx - @ctx.setter - def ctx(self, ctx): - cdef ccuda.CUcontext cctx - if ctx is None: - cctx = 0 - elif isinstance(ctx, (CUcontext,)): - pctx = int(ctx) - cctx = pctx - else: - pctx = int(CUcontext(ctx)) - cctx = pctx - self._ctx._ptr[0] = cctx -{{endif}} -{{if 'struct CUDA_HOST_NODE_PARAMS_st' in found_types}} + def dstLOD(self): + return self._pvt_ptr[0].dstLOD + @dstLOD.setter + def dstLOD(self, size_t dstLOD): + self._pvt_ptr[0].dstLOD = dstLOD -cdef class CUDA_HOST_NODE_PARAMS_st: - """ - Host node parameters - Attributes - ---------- - fn : CUhostFn - The function to call when the node executes - userData : Any - Argument to pass to the function + @property + def dstMemoryType(self): + return CUmemorytype(self._pvt_ptr[0].dstMemoryType) + @dstMemoryType.setter + def dstMemoryType(self, dstMemoryType not None : CUmemorytype): + self._pvt_ptr[0].dstMemoryType = int(dstMemoryType) - Methods - ------- - getPtr() - Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val + @property + def dstHost(self): + return self._pvt_ptr[0].dstHost + @dstHost.setter + def dstHost(self, dstHost): + self._cydstHost = _HelperInputVoidPtr(dstHost) + self._pvt_ptr[0].dstHost = self._cydstHost.cptr + + + @property + def dstDevice(self): + return self._dstDevice + @dstDevice.setter + def dstDevice(self, dstDevice): + cdef cydriver.CUdeviceptr cydstDevice + if dstDevice is None: + cydstDevice = 0 + elif isinstance(dstDevice, (CUdeviceptr)): + pdstDevice = int(dstDevice) + cydstDevice = pdstDevice else: - self._ptr = _ptr - def __init__(self, void_ptr _ptr = 0): - self._fn = CUhostFn(_ptr=&self._ptr[0].fn) - def __dealloc__(self): - pass - def getPtr(self): - return self._ptr - def __repr__(self): - if self._ptr is not NULL: - str_list = [] - try: - str_list += ['fn : ' + str(self.fn)] - except ValueError: - str_list += ['fn : '] - try: - str_list += ['userData : ' + hex(self.userData)] - except ValueError: - str_list += ['userData : '] - return '\n'.join(str_list) + pdstDevice = int(CUdeviceptr(dstDevice)) + cydstDevice = pdstDevice + self._dstDevice._pvt_ptr[0] = cydstDevice + + + + @property + def dstArray(self): + return self._dstArray + @dstArray.setter + def dstArray(self, dstArray): + cdef cydriver.CUarray cydstArray + if dstArray is None: + cydstArray = 0 + elif isinstance(dstArray, (CUarray,)): + pdstArray = int(dstArray) + cydstArray = pdstArray else: - return '' + pdstArray = int(CUarray(dstArray)) + cydstArray = pdstArray + self._dstArray._pvt_ptr[0] = cydstArray + + @property - def fn(self): - return self._fn - @fn.setter - def fn(self, fn): - cdef ccuda.CUhostFn cfn - if fn is None: - cfn = 0 - elif isinstance(fn, (CUhostFn)): - pfn = int(fn) - cfn = pfn + def dstContext(self): + return self._dstContext + @dstContext.setter + def dstContext(self, dstContext): + cdef cydriver.CUcontext cydstContext + if dstContext is None: + cydstContext = 0 + elif isinstance(dstContext, (CUcontext,)): + pdstContext = int(dstContext) + cydstContext = pdstContext else: - pfn = int(CUhostFn(fn)) - cfn = pfn - self._fn._ptr[0] = cfn + pdstContext = int(CUcontext(dstContext)) + cydstContext = pdstContext + self._dstContext._pvt_ptr[0] = cydstContext + + + @property + def dstPitch(self): + return self._pvt_ptr[0].dstPitch + @dstPitch.setter + def dstPitch(self, size_t dstPitch): + self._pvt_ptr[0].dstPitch = dstPitch + + + @property + def dstHeight(self): + return self._pvt_ptr[0].dstHeight + @dstHeight.setter + def dstHeight(self, size_t dstHeight): + self._pvt_ptr[0].dstHeight = dstHeight + + + @property + def WidthInBytes(self): + return self._pvt_ptr[0].WidthInBytes + @WidthInBytes.setter + def WidthInBytes(self, size_t WidthInBytes): + self._pvt_ptr[0].WidthInBytes = WidthInBytes + + @property - def userData(self): - return self._ptr[0].userData - @userData.setter - def userData(self, userData): - _cuserData = utils.HelperInputVoidPtr(userData) - self._ptr[0].userData = _cuserData.cptr -{{endif}} -{{if 'struct CUDA_HOST_NODE_PARAMS_v2_st' in found_types}} + def Height(self): + return self._pvt_ptr[0].Height + @Height.setter + def Height(self, size_t Height): + self._pvt_ptr[0].Height = Height -cdef class CUDA_HOST_NODE_PARAMS_v2_st: + + @property + def Depth(self): + return self._pvt_ptr[0].Depth + @Depth.setter + def Depth(self, size_t Depth): + self._pvt_ptr[0].Depth = Depth + + +cdef class CUDA_MEMCPY_NODE_PARAMS_st: """ - Host node parameters + Memcpy node parameters Attributes ---------- - fn : CUhostFn - The function to call when the node executes - userData : Any - Argument to pass to the function + + flags : int + Must be zero + + + reserved : int + Must be zero + + + copyCtx : CUcontext + Context on which to run the node + + + copyParams : CUDA_MEMCPY3D + Parameters for the memory copy + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - self._fn = CUhostFn(_ptr=&self._ptr[0].fn) + pass + + self._copyCtx = CUcontext(_ptr=&self._pvt_ptr[0].copyCtx) + + + self._copyParams = CUDA_MEMCPY3D(_ptr=&self._pvt_ptr[0].copyParams) + def __dealloc__(self): pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['fn : ' + str(self.fn)] + str_list += ['flags : ' + str(self.flags)] except ValueError: - str_list += ['fn : '] + str_list += ['flags : '] + + try: - str_list += ['userData : ' + hex(self.userData)] + str_list += ['reserved : ' + str(self.reserved)] except ValueError: - str_list += ['userData : '] + str_list += ['reserved : '] + + + try: + str_list += ['copyCtx : ' + str(self.copyCtx)] + except ValueError: + str_list += ['copyCtx : '] + + + try: + str_list += ['copyParams :\n' + '\n'.join([' ' + line for line in str(self.copyParams).splitlines()])] + except ValueError: + str_list += ['copyParams : '] + return '\n'.join(str_list) else: return '' + @property - def fn(self): - return self._fn - @fn.setter - def fn(self, fn): - cdef ccuda.CUhostFn cfn - if fn is None: - cfn = 0 - elif isinstance(fn, (CUhostFn)): - pfn = int(fn) - cfn = pfn + def flags(self): + return self._pvt_ptr[0].flags + @flags.setter + def flags(self, int flags): + self._pvt_ptr[0].flags = flags + + + @property + def reserved(self): + return self._pvt_ptr[0].reserved + @reserved.setter + def reserved(self, int reserved): + self._pvt_ptr[0].reserved = reserved + + + @property + def copyCtx(self): + return self._copyCtx + @copyCtx.setter + def copyCtx(self, copyCtx): + cdef cydriver.CUcontext cycopyCtx + if copyCtx is None: + cycopyCtx = 0 + elif isinstance(copyCtx, (CUcontext,)): + pcopyCtx = int(copyCtx) + cycopyCtx = pcopyCtx else: - pfn = int(CUhostFn(fn)) - cfn = pfn - self._fn._ptr[0] = cfn + pcopyCtx = int(CUcontext(copyCtx)) + cycopyCtx = pcopyCtx + self._copyCtx._pvt_ptr[0] = cycopyCtx + + @property - def userData(self): - return self._ptr[0].userData - @userData.setter - def userData(self, userData): - _cuserData = utils.HelperInputVoidPtr(userData) - self._ptr[0].userData = _cuserData.cptr -{{endif}} -{{if 'struct CUDA_CONDITIONAL_NODE_PARAMS' in found_types}} + def copyParams(self): + return self._copyParams + @copyParams.setter + def copyParams(self, copyParams not None : CUDA_MEMCPY3D): + string.memcpy(&self._pvt_ptr[0].copyParams, copyParams.getPtr(), sizeof(self._pvt_ptr[0].copyParams)) -cdef class CUDA_CONDITIONAL_NODE_PARAMS: + +cdef class CUDA_ARRAY_DESCRIPTOR_st: """ - Conditional node parameters + Array descriptor Attributes ---------- - handle : CUgraphConditionalHandle - Conditional node handle. Handles must be created in advance of - creating the node using cuGraphConditionalHandleCreate. - type : CUgraphConditionalNodeType - Type of conditional node. - size : unsigned int - Size of graph output array. Must be 1. - phGraph_out : CUgraph - CUDA-owned array populated with conditional node child graphs - during creation of the node. Valid for the lifetime of the - conditional node. The contents of the graph(s) are subject to the - following constraints: - Allowed node types are kernel nodes, - empty nodes, child graphs, memsets, memcopies, and conditionals. - This applies recursively to child graphs and conditional bodies. - - All kernels, including kernels in nested conditionals or child - graphs at any level, must belong to the same CUDA context. - These graphs may be populated using graph node creation APIs or - cuStreamBeginCaptureToGraph. - ctx : CUcontext - Context on which to run the node. Must match context used to create - the handle and all body nodes. + + Width : size_t + Width of array + + + Height : size_t + Height of array + + + Format : CUarray_format + Array format + + + NumChannels : unsigned int + Channels per array element + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - self._handle = CUgraphConditionalHandle(_ptr=&self._ptr[0].handle) - self._ctx = CUcontext(_ptr=&self._ptr[0].ctx) + pass def __dealloc__(self): pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['handle : ' + str(self.handle)] - except ValueError: - str_list += ['handle : '] - try: - str_list += ['type : ' + str(self.type)] + str_list += ['Width : ' + str(self.Width)] except ValueError: - str_list += ['type : '] + str_list += ['Width : '] + + try: - str_list += ['size : ' + str(self.size)] + str_list += ['Height : ' + str(self.Height)] except ValueError: - str_list += ['size : '] + str_list += ['Height : '] + + try: - str_list += ['phGraph_out : ' + str(self.phGraph_out)] + str_list += ['Format : ' + str(self.Format)] except ValueError: - str_list += ['phGraph_out : '] + str_list += ['Format : '] + + try: - str_list += ['ctx : ' + str(self.ctx)] + str_list += ['NumChannels : ' + str(self.NumChannels)] except ValueError: - str_list += ['ctx : '] + str_list += ['NumChannels : '] + return '\n'.join(str_list) else: return '' - @property - def handle(self): - return self._handle - @handle.setter - def handle(self, handle): - cdef ccuda.CUgraphConditionalHandle chandle - if handle is None: - chandle = 0 - elif isinstance(handle, (CUgraphConditionalHandle)): - phandle = int(handle) - chandle = phandle - else: - phandle = int(CUgraphConditionalHandle(handle)) - chandle = phandle - self._handle._ptr[0] = chandle @property - def type(self): - return CUgraphConditionalNodeType(self._ptr[0].type) - @type.setter - def type(self, type not None : CUgraphConditionalNodeType): - self._ptr[0].type = type.value + def Width(self): + return self._pvt_ptr[0].Width + @Width.setter + def Width(self, size_t Width): + self._pvt_ptr[0].Width = Width + + @property - def size(self): - return self._ptr[0].size - @size.setter - def size(self, unsigned int size): - self._ptr[0].size = size + def Height(self): + return self._pvt_ptr[0].Height + @Height.setter + def Height(self, size_t Height): + self._pvt_ptr[0].Height = Height + + @property - def phGraph_out(self): - arrs = [self._ptr[0].phGraph_out + x*sizeof(ccuda.CUgraph) for x in range(self.size)] - return [CUgraph(_ptr=arr) for arr in arrs] + def Format(self): + return CUarray_format(self._pvt_ptr[0].Format) + @Format.setter + def Format(self, Format not None : CUarray_format): + self._pvt_ptr[0].Format = int(Format) + + @property - def ctx(self): - return self._ctx - @ctx.setter - def ctx(self, ctx): - cdef ccuda.CUcontext cctx - if ctx is None: - cctx = 0 - elif isinstance(ctx, (CUcontext,)): - pctx = int(ctx) - cctx = pctx - else: - pctx = int(CUcontext(ctx)) - cctx = pctx - self._ctx._ptr[0] = cctx -{{endif}} -{{if 'struct CUgraphEdgeData_st' in found_types}} + def NumChannels(self): + return self._pvt_ptr[0].NumChannels + @NumChannels.setter + def NumChannels(self, unsigned int NumChannels): + self._pvt_ptr[0].NumChannels = NumChannels -cdef class CUgraphEdgeData_st: + +cdef class CUDA_ARRAY3D_DESCRIPTOR_st: """ - Optional annotation for edges in a CUDA graph. Note, all edges - implicitly have annotations and default to a zero-initialized value - if not specified. A zero-initialized struct indicates a standard - full serialization of two nodes with memory visibility. + 3D array descriptor Attributes ---------- - from_port : bytes - This indicates when the dependency is triggered from the upstream - node on the edge. The meaning is specfic to the node type. A value - of 0 in all cases means full completion of the upstream node, with - memory visibility to the downstream node or portion thereof - (indicated by `to_port`). Only kernel nodes define non-zero - ports. A kernel node can use the following output port types: - CU_GRAPH_KERNEL_NODE_PORT_DEFAULT, - CU_GRAPH_KERNEL_NODE_PORT_PROGRAMMATIC, or - CU_GRAPH_KERNEL_NODE_PORT_LAUNCH_ORDER. - to_port : bytes - This indicates what portion of the downstream node is dependent on - the upstream node or portion thereof (indicated by `from_port`). - The meaning is specific to the node type. A value of 0 in all cases - means the entirety of the downstream node is dependent on the - upstream work. Currently no node types define non-zero ports. - Accordingly, this field must be set to zero. - type : bytes - This should be populated with a value from CUgraphDependencyType. - (It is typed as char due to compiler-specific layout of bitfields.) - See CUgraphDependencyType. - reserved : bytes - These bytes are unused and must be zeroed. This ensures - compatibility if additional fields are added in the future. + + Width : size_t + Width of 3D array + + + Height : size_t + Height of 3D array + + + Depth : size_t + Depth of 3D array + + + Format : CUarray_format + Array format + + + NumChannels : unsigned int + Channels per array element + + + Flags : unsigned int + Flags + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): pass def __dealloc__(self): pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['from_port : ' + str(self.from_port)] + str_list += ['Width : ' + str(self.Width)] except ValueError: - str_list += ['from_port : '] + str_list += ['Width : '] + + try: - str_list += ['to_port : ' + str(self.to_port)] + str_list += ['Height : ' + str(self.Height)] except ValueError: - str_list += ['to_port : '] + str_list += ['Height : '] + + try: - str_list += ['type : ' + str(self.type)] + str_list += ['Depth : ' + str(self.Depth)] except ValueError: - str_list += ['type : '] + str_list += ['Depth : '] + + try: - str_list += ['reserved : ' + str(self.reserved)] + str_list += ['Format : ' + str(self.Format)] except ValueError: - str_list += ['reserved : '] + str_list += ['Format : '] + + + try: + str_list += ['NumChannels : ' + str(self.NumChannels)] + except ValueError: + str_list += ['NumChannels : '] + + + try: + str_list += ['Flags : ' + str(self.Flags)] + except ValueError: + str_list += ['Flags : '] + return '\n'.join(str_list) else: return '' + @property - def from_port(self): - return self._ptr[0].from_port - @from_port.setter - def from_port(self, unsigned char from_port): - self._ptr[0].from_port = from_port + def Width(self): + return self._pvt_ptr[0].Width + @Width.setter + def Width(self, size_t Width): + self._pvt_ptr[0].Width = Width + + @property - def to_port(self): - return self._ptr[0].to_port - @to_port.setter - def to_port(self, unsigned char to_port): - self._ptr[0].to_port = to_port + def Height(self): + return self._pvt_ptr[0].Height + @Height.setter + def Height(self, size_t Height): + self._pvt_ptr[0].Height = Height + + @property - def type(self): - return self._ptr[0].type - @type.setter - def type(self, unsigned char type): - self._ptr[0].type = type + def Depth(self): + return self._pvt_ptr[0].Depth + @Depth.setter + def Depth(self, size_t Depth): + self._pvt_ptr[0].Depth = Depth + + @property - def reserved(self): - return PyBytes_FromStringAndSize(self._ptr[0].reserved, 5) - @reserved.setter - def reserved(self, reserved): - if len(reserved) != 5: - raise ValueError("reserved length must be 5, is " + str(len(reserved))) - for i, b in enumerate(reserved): - self._ptr[0].reserved[i] = b -{{endif}} -{{if 'struct CUDA_GRAPH_INSTANTIATE_PARAMS_st' in found_types}} + def Format(self): + return CUarray_format(self._pvt_ptr[0].Format) + @Format.setter + def Format(self, Format not None : CUarray_format): + self._pvt_ptr[0].Format = int(Format) + + + @property + def NumChannels(self): + return self._pvt_ptr[0].NumChannels + @NumChannels.setter + def NumChannels(self, unsigned int NumChannels): + self._pvt_ptr[0].NumChannels = NumChannels + + + @property + def Flags(self): + return self._pvt_ptr[0].Flags + @Flags.setter + def Flags(self, unsigned int Flags): + self._pvt_ptr[0].Flags = Flags -cdef class CUDA_GRAPH_INSTANTIATE_PARAMS_st: - """ - Graph instantiation parameters +cdef class anon_struct6: + """ Attributes ---------- - flags : cuuint64_t - Instantiation flags - hUploadStream : CUstream - Upload stream - hErrNode_out : CUgraphNode - The node which caused instantiation to fail, if any - result_out : CUgraphInstantiateResult - Whether instantiation was successful. If it failed, the reason why + + width : unsigned int + + + + height : unsigned int + + + + depth : unsigned int + + Methods ------- getPtr() Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - else: - self._ptr = _ptr - def __init__(self, void_ptr _ptr = 0): - self._flags = cuuint64_t(_ptr=&self._ptr[0].flags) - self._hUploadStream = CUstream(_ptr=&self._ptr[0].hUploadStream) - self._hErrNode_out = CUgraphNode(_ptr=&self._ptr[0].hErrNode_out) + def __cinit__(self, void_ptr _ptr): + self._pvt_ptr = _ptr + + def __init__(self, void_ptr _ptr): + pass def __dealloc__(self): pass def getPtr(self): - return self._ptr + return &self._pvt_ptr[0].tileExtent def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['flags : ' + str(self.flags)] - except ValueError: - str_list += ['flags : '] - try: - str_list += ['hUploadStream : ' + str(self.hUploadStream)] + str_list += ['width : ' + str(self.width)] except ValueError: - str_list += ['hUploadStream : '] + str_list += ['width : '] + + try: - str_list += ['hErrNode_out : ' + str(self.hErrNode_out)] + str_list += ['height : ' + str(self.height)] except ValueError: - str_list += ['hErrNode_out : '] + str_list += ['height : '] + + try: - str_list += ['result_out : ' + str(self.result_out)] + str_list += ['depth : ' + str(self.depth)] except ValueError: - str_list += ['result_out : '] + str_list += ['depth : '] + return '\n'.join(str_list) else: return '' - @property - def flags(self): - return self._flags - @flags.setter - def flags(self, flags): - cdef ccuda.cuuint64_t cflags - if flags is None: - cflags = 0 - elif isinstance(flags, (cuuint64_t)): - pflags = int(flags) - cflags = pflags - else: - pflags = int(cuuint64_t(flags)) - cflags = pflags - self._flags._ptr[0] = cflags @property - def hUploadStream(self): - return self._hUploadStream - @hUploadStream.setter - def hUploadStream(self, hUploadStream): - cdef ccuda.CUstream chUploadStream - if hUploadStream is None: - chUploadStream = 0 - elif isinstance(hUploadStream, (CUstream,)): - phUploadStream = int(hUploadStream) - chUploadStream = phUploadStream - else: - phUploadStream = int(CUstream(hUploadStream)) - chUploadStream = phUploadStream - self._hUploadStream._ptr[0] = chUploadStream + def width(self): + return self._pvt_ptr[0].tileExtent.width + @width.setter + def width(self, unsigned int width): + self._pvt_ptr[0].tileExtent.width = width + + @property - def hErrNode_out(self): - return self._hErrNode_out - @hErrNode_out.setter - def hErrNode_out(self, hErrNode_out): - cdef ccuda.CUgraphNode chErrNode_out - if hErrNode_out is None: - chErrNode_out = 0 - elif isinstance(hErrNode_out, (CUgraphNode,)): - phErrNode_out = int(hErrNode_out) - chErrNode_out = phErrNode_out - else: - phErrNode_out = int(CUgraphNode(hErrNode_out)) - chErrNode_out = phErrNode_out - self._hErrNode_out._ptr[0] = chErrNode_out + def height(self): + return self._pvt_ptr[0].tileExtent.height + @height.setter + def height(self, unsigned int height): + self._pvt_ptr[0].tileExtent.height = height + + @property - def result_out(self): - return CUgraphInstantiateResult(self._ptr[0].result_out) - @result_out.setter - def result_out(self, result_out not None : CUgraphInstantiateResult): - self._ptr[0].result_out = result_out.value -{{endif}} -{{if 'struct CUlaunchMemSyncDomainMap_st' in found_types}} + def depth(self): + return self._pvt_ptr[0].tileExtent.depth + @depth.setter + def depth(self, unsigned int depth): + self._pvt_ptr[0].tileExtent.depth = depth -cdef class CUlaunchMemSyncDomainMap_st: + +cdef class CUDA_ARRAY_SPARSE_PROPERTIES_st: """ - Memory Synchronization Domain map See ::cudaLaunchMemSyncDomain. - By default, kernels are launched in domain 0. Kernel launched with - CU_LAUNCH_MEM_SYNC_DOMAIN_REMOTE will have a different domain ID. - User may also alter the domain ID with CUlaunchMemSyncDomainMap for - a specific stream / graph node / kernel launch. See - CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP. Domain ID range is - available through CU_DEVICE_ATTRIBUTE_MEM_SYNC_DOMAIN_COUNT. + CUDA array sparse properties Attributes ---------- - default_ : bytes - The default domain ID to use for designated kernels - remote : bytes - The remote domain ID to use for designated kernels + + tileExtent : anon_struct6 + + + + miptailFirstLevel : unsigned int + First mip level at which the mip tail begins. + + + miptailSize : unsigned long long + Total size of the mip tail. + + + flags : unsigned int + Flags will either be zero or + CU_ARRAY_SPARSE_PROPERTIES_SINGLE_MIPTAIL + + + reserved : list[unsigned int] + + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): pass + + self._tileExtent = anon_struct6(_ptr=self._pvt_ptr) + def __dealloc__(self): pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + + try: + str_list += ['tileExtent :\n' + '\n'.join([' ' + line for line in str(self.tileExtent).splitlines()])] + except ValueError: + str_list += ['tileExtent : '] + + + try: + str_list += ['miptailFirstLevel : ' + str(self.miptailFirstLevel)] + except ValueError: + str_list += ['miptailFirstLevel : '] + + + try: + str_list += ['miptailSize : ' + str(self.miptailSize)] + except ValueError: + str_list += ['miptailSize : '] + + try: - str_list += ['default_ : ' + str(self.default_)] + str_list += ['flags : ' + str(self.flags)] except ValueError: - str_list += ['default_ : '] + str_list += ['flags : '] + + try: - str_list += ['remote : ' + str(self.remote)] + str_list += ['reserved : ' + str(self.reserved)] except ValueError: - str_list += ['remote : '] + str_list += ['reserved : '] + return '\n'.join(str_list) else: return '' + @property - def default_(self): - return self._ptr[0].default_ - @default_.setter - def default_(self, unsigned char default_): - self._ptr[0].default_ = default_ + def tileExtent(self): + return self._tileExtent + @tileExtent.setter + def tileExtent(self, tileExtent not None : anon_struct6): + string.memcpy(&self._pvt_ptr[0].tileExtent, tileExtent.getPtr(), sizeof(self._pvt_ptr[0].tileExtent)) + + @property - def remote(self): - return self._ptr[0].remote - @remote.setter - def remote(self, unsigned char remote): - self._ptr[0].remote = remote -{{endif}} -{{if 'union CUlaunchAttributeValue_union' in found_types}} + def miptailFirstLevel(self): + return self._pvt_ptr[0].miptailFirstLevel + @miptailFirstLevel.setter + def miptailFirstLevel(self, unsigned int miptailFirstLevel): + self._pvt_ptr[0].miptailFirstLevel = miptailFirstLevel -cdef class anon_struct1: + + @property + def miptailSize(self): + return self._pvt_ptr[0].miptailSize + @miptailSize.setter + def miptailSize(self, unsigned long long miptailSize): + self._pvt_ptr[0].miptailSize = miptailSize + + + @property + def flags(self): + return self._pvt_ptr[0].flags + @flags.setter + def flags(self, unsigned int flags): + self._pvt_ptr[0].flags = flags + + + @property + def reserved(self): + return self._pvt_ptr[0].reserved + @reserved.setter + def reserved(self, reserved): + self._pvt_ptr[0].reserved = reserved + + +cdef class CUDA_ARRAY_MEMORY_REQUIREMENTS_st: """ + CUDA array memory requirements + Attributes ---------- - x : unsigned int - y : unsigned int + size : size_t + Total required memory size + + + alignment : size_t + alignment requirement + + + reserved : list[unsigned int] - z : unsigned int Methods ------- getPtr() Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr - - def __init__(self, void_ptr _ptr): + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): pass def __dealloc__(self): pass def getPtr(self): - return &self._ptr[0].clusterDim + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['x : ' + str(self.x)] + str_list += ['size : ' + str(self.size)] except ValueError: - str_list += ['x : '] + str_list += ['size : '] + + try: - str_list += ['y : ' + str(self.y)] + str_list += ['alignment : ' + str(self.alignment)] except ValueError: - str_list += ['y : '] + str_list += ['alignment : '] + + try: - str_list += ['z : ' + str(self.z)] + str_list += ['reserved : ' + str(self.reserved)] except ValueError: - str_list += ['z : '] + str_list += ['reserved : '] + return '\n'.join(str_list) else: return '' + @property - def x(self): - return self._ptr[0].clusterDim.x - @x.setter - def x(self, unsigned int x): - self._ptr[0].clusterDim.x = x + def size(self): + return self._pvt_ptr[0].size + @size.setter + def size(self, size_t size): + self._pvt_ptr[0].size = size + + @property - def y(self): - return self._ptr[0].clusterDim.y - @y.setter - def y(self, unsigned int y): - self._ptr[0].clusterDim.y = y + def alignment(self): + return self._pvt_ptr[0].alignment + @alignment.setter + def alignment(self, size_t alignment): + self._pvt_ptr[0].alignment = alignment + + @property - def z(self): - return self._ptr[0].clusterDim.z - @z.setter - def z(self, unsigned int z): - self._ptr[0].clusterDim.z = z -{{endif}} -{{if 'union CUlaunchAttributeValue_union' in found_types}} + def reserved(self): + return self._pvt_ptr[0].reserved + @reserved.setter + def reserved(self, reserved): + self._pvt_ptr[0].reserved = reserved -cdef class anon_struct2: + +cdef class anon_struct7: """ Attributes ---------- - event : CUevent - flags : int + hArray : CUarray - triggerAtBlockStart : int Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - self._event = CUevent(_ptr=&self._ptr[0].programmaticEvent.event) + pass + + self._hArray = CUarray(_ptr=&self._pvt_ptr[0].res.array.hArray) + def __dealloc__(self): pass def getPtr(self): - return &self._ptr[0].programmaticEvent + return &self._pvt_ptr[0].res.array def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['event : ' + str(self.event)] - except ValueError: - str_list += ['event : '] - try: - str_list += ['flags : ' + str(self.flags)] - except ValueError: - str_list += ['flags : '] - try: - str_list += ['triggerAtBlockStart : ' + str(self.triggerAtBlockStart)] + str_list += ['hArray : ' + str(self.hArray)] except ValueError: - str_list += ['triggerAtBlockStart : '] + str_list += ['hArray : '] + return '\n'.join(str_list) else: return '' + @property - def event(self): - return self._event - @event.setter - def event(self, event): - cdef ccuda.CUevent cevent - if event is None: - cevent = 0 - elif isinstance(event, (CUevent,)): - pevent = int(event) - cevent = pevent + def hArray(self): + return self._hArray + @hArray.setter + def hArray(self, hArray): + cdef cydriver.CUarray cyhArray + if hArray is None: + cyhArray = 0 + elif isinstance(hArray, (CUarray,)): + phArray = int(hArray) + cyhArray = phArray else: - pevent = int(CUevent(event)) - cevent = pevent - self._event._ptr[0] = cevent - @property - def flags(self): - return self._ptr[0].programmaticEvent.flags - @flags.setter - def flags(self, int flags): - self._ptr[0].programmaticEvent.flags = flags - @property - def triggerAtBlockStart(self): - return self._ptr[0].programmaticEvent.triggerAtBlockStart - @triggerAtBlockStart.setter - def triggerAtBlockStart(self, int triggerAtBlockStart): - self._ptr[0].programmaticEvent.triggerAtBlockStart = triggerAtBlockStart -{{endif}} -{{if 'union CUlaunchAttributeValue_union' in found_types}} + phArray = int(CUarray(hArray)) + cyhArray = phArray + self._hArray._pvt_ptr[0] = cyhArray -cdef class anon_struct3: + +cdef class anon_struct8: """ Attributes ---------- - event : CUevent - flags : int + hMipmappedArray : CUmipmappedArray + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - self._event = CUevent(_ptr=&self._ptr[0].launchCompletionEvent.event) + pass + + self._hMipmappedArray = CUmipmappedArray(_ptr=&self._pvt_ptr[0].res.mipmap.hMipmappedArray) + def __dealloc__(self): pass def getPtr(self): - return &self._ptr[0].launchCompletionEvent + return &self._pvt_ptr[0].res.mipmap def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['event : ' + str(self.event)] - except ValueError: - str_list += ['event : '] - try: - str_list += ['flags : ' + str(self.flags)] + str_list += ['hMipmappedArray : ' + str(self.hMipmappedArray)] except ValueError: - str_list += ['flags : '] + str_list += ['hMipmappedArray : '] + return '\n'.join(str_list) else: return '' + @property - def event(self): - return self._event - @event.setter - def event(self, event): - cdef ccuda.CUevent cevent - if event is None: - cevent = 0 - elif isinstance(event, (CUevent,)): - pevent = int(event) - cevent = pevent + def hMipmappedArray(self): + return self._hMipmappedArray + @hMipmappedArray.setter + def hMipmappedArray(self, hMipmappedArray): + cdef cydriver.CUmipmappedArray cyhMipmappedArray + if hMipmappedArray is None: + cyhMipmappedArray = 0 + elif isinstance(hMipmappedArray, (CUmipmappedArray,)): + phMipmappedArray = int(hMipmappedArray) + cyhMipmappedArray = phMipmappedArray else: - pevent = int(CUevent(event)) - cevent = pevent - self._event._ptr[0] = cevent - @property - def flags(self): - return self._ptr[0].launchCompletionEvent.flags - @flags.setter - def flags(self, int flags): - self._ptr[0].launchCompletionEvent.flags = flags -{{endif}} -{{if 'union CUlaunchAttributeValue_union' in found_types}} + phMipmappedArray = int(CUmipmappedArray(hMipmappedArray)) + cyhMipmappedArray = phMipmappedArray + self._hMipmappedArray._pvt_ptr[0] = cyhMipmappedArray -cdef class anon_struct4: + +cdef class anon_struct9: """ Attributes ---------- - deviceUpdatable : int - devNode : CUgraphDeviceNode + devPtr : CUdeviceptr + + + + format : CUarray_format + + + + numChannels : unsigned int + + + + sizeInBytes : size_t + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - self._devNode = CUgraphDeviceNode(_ptr=&self._ptr[0].deviceUpdatableKernelNode.devNode) + pass + + self._devPtr = CUdeviceptr(_ptr=&self._pvt_ptr[0].res.linear.devPtr) + def __dealloc__(self): pass def getPtr(self): - return &self._ptr[0].deviceUpdatableKernelNode + return &self._pvt_ptr[0].res.linear def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['deviceUpdatable : ' + str(self.deviceUpdatable)] + str_list += ['devPtr : ' + str(self.devPtr)] except ValueError: - str_list += ['deviceUpdatable : '] + str_list += ['devPtr : '] + + try: - str_list += ['devNode : ' + str(self.devNode)] + str_list += ['format : ' + str(self.format)] except ValueError: - str_list += ['devNode : '] + str_list += ['format : '] + + + try: + str_list += ['numChannels : ' + str(self.numChannels)] + except ValueError: + str_list += ['numChannels : '] + + + try: + str_list += ['sizeInBytes : ' + str(self.sizeInBytes)] + except ValueError: + str_list += ['sizeInBytes : '] + return '\n'.join(str_list) else: return '' + @property - def deviceUpdatable(self): - return self._ptr[0].deviceUpdatableKernelNode.deviceUpdatable - @deviceUpdatable.setter - def deviceUpdatable(self, int deviceUpdatable): - self._ptr[0].deviceUpdatableKernelNode.deviceUpdatable = deviceUpdatable - @property - def devNode(self): - return self._devNode - @devNode.setter - def devNode(self, devNode): - cdef ccuda.CUgraphDeviceNode cdevNode - if devNode is None: - cdevNode = 0 - elif isinstance(devNode, (CUgraphDeviceNode,)): - pdevNode = int(devNode) - cdevNode = pdevNode + def devPtr(self): + return self._devPtr + @devPtr.setter + def devPtr(self, devPtr): + cdef cydriver.CUdeviceptr cydevPtr + if devPtr is None: + cydevPtr = 0 + elif isinstance(devPtr, (CUdeviceptr)): + pdevPtr = int(devPtr) + cydevPtr = pdevPtr else: - pdevNode = int(CUgraphDeviceNode(devNode)) - cdevNode = pdevNode - self._devNode._ptr[0] = cdevNode -{{endif}} -{{if 'union CUlaunchAttributeValue_union' in found_types}} + pdevPtr = int(CUdeviceptr(devPtr)) + cydevPtr = pdevPtr + self._devPtr._pvt_ptr[0] = cydevPtr + + + + @property + def format(self): + return CUarray_format(self._pvt_ptr[0].res.linear.format) + @format.setter + def format(self, format not None : CUarray_format): + self._pvt_ptr[0].res.linear.format = int(format) + + + @property + def numChannels(self): + return self._pvt_ptr[0].res.linear.numChannels + @numChannels.setter + def numChannels(self, unsigned int numChannels): + self._pvt_ptr[0].res.linear.numChannels = numChannels -cdef class CUlaunchAttributeValue_union: - """ - Launch attributes union; used as value field of CUlaunchAttribute + @property + def sizeInBytes(self): + return self._pvt_ptr[0].res.linear.sizeInBytes + @sizeInBytes.setter + def sizeInBytes(self, size_t sizeInBytes): + self._pvt_ptr[0].res.linear.sizeInBytes = sizeInBytes + + +cdef class anon_struct10: + """ Attributes ---------- - pad : bytes - accessPolicyWindow : CUaccessPolicyWindow - Value of launch attribute CU_LAUNCH_ATTRIBUTE_ACCESS_POLICY_WINDOW. - cooperative : int - Value of launch attribute CU_LAUNCH_ATTRIBUTE_COOPERATIVE. Nonzero - indicates a cooperative kernel (see cuLaunchCooperativeKernel). - syncPolicy : CUsynchronizationPolicy - Value of launch attribute - CU_LAUNCH_ATTRIBUTE_SYNCHRONIZATION_POLICY. - ::CUsynchronizationPolicy for work queued up in this stream - clusterDim : anon_struct1 - Value of launch attribute CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION - that represents the desired cluster dimensions for the kernel. - Opaque type with the following fields: - `x` - The X dimension of - the cluster, in blocks. Must be a divisor of the grid X dimension. - - `y` - The Y dimension of the cluster, in blocks. Must be a - divisor of the grid Y dimension. - `z` - The Z dimension of the - cluster, in blocks. Must be a divisor of the grid Z dimension. - clusterSchedulingPolicyPreference : CUclusterSchedulingPolicy - Value of launch attribute - CU_LAUNCH_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE. Cluster - scheduling policy preference for the kernel. - programmaticStreamSerializationAllowed : int - Value of launch attribute - CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_STREAM_SERIALIZATION. - programmaticEvent : anon_struct2 - Value of launch attribute CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_EVENT. - launchCompletionEvent : anon_struct3 - Value of launch attribute - CU_LAUNCH_ATTRIBUTE_LAUNCH_COMPLETION_EVENT. - priority : int - Value of launch attribute CU_LAUNCH_ATTRIBUTE_PRIORITY. Execution - priority of the kernel. - memSyncDomainMap : CUlaunchMemSyncDomainMap - Value of launch attribute CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP. - See CUlaunchMemSyncDomainMap. - memSyncDomain : CUlaunchMemSyncDomain - Value of launch attribute CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN. - See::CUlaunchMemSyncDomain - deviceUpdatableKernelNode : anon_struct4 - Value of launch attribute - CU_LAUNCH_ATTRIBUTE_DEVICE_UPDATABLE_KERNEL_NODE. - sharedMemCarveout : unsigned int - Value of launch attribute - CU_LAUNCH_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT. + devPtr : CUdeviceptr + + + + format : CUarray_format + + + + numChannels : unsigned int + + + + width : size_t + + + + height : size_t + + + + pitchInBytes : size_t + + Methods ------- getPtr() Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - else: - self._ptr = _ptr - def __init__(self, void_ptr _ptr = 0): - self._accessPolicyWindow = CUaccessPolicyWindow(_ptr=&self._ptr[0].accessPolicyWindow) - self._clusterDim = anon_struct1(_ptr=self._ptr) - self._programmaticEvent = anon_struct2(_ptr=self._ptr) - self._launchCompletionEvent = anon_struct3(_ptr=self._ptr) - self._memSyncDomainMap = CUlaunchMemSyncDomainMap(_ptr=&self._ptr[0].memSyncDomainMap) - self._deviceUpdatableKernelNode = anon_struct4(_ptr=self._ptr) + def __cinit__(self, void_ptr _ptr): + self._pvt_ptr = _ptr + + def __init__(self, void_ptr _ptr): + pass + + self._devPtr = CUdeviceptr(_ptr=&self._pvt_ptr[0].res.pitch2D.devPtr) + def __dealloc__(self): pass def getPtr(self): - return self._ptr + return &self._pvt_ptr[0].res.pitch2D def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['pad : ' + str(self.pad)] - except ValueError: - str_list += ['pad : '] - try: - str_list += ['accessPolicyWindow :\n' + '\n'.join([' ' + line for line in str(self.accessPolicyWindow).splitlines()])] - except ValueError: - str_list += ['accessPolicyWindow : '] - try: - str_list += ['cooperative : ' + str(self.cooperative)] - except ValueError: - str_list += ['cooperative : '] - try: - str_list += ['syncPolicy : ' + str(self.syncPolicy)] - except ValueError: - str_list += ['syncPolicy : '] - try: - str_list += ['clusterDim :\n' + '\n'.join([' ' + line for line in str(self.clusterDim).splitlines()])] - except ValueError: - str_list += ['clusterDim : '] - try: - str_list += ['clusterSchedulingPolicyPreference : ' + str(self.clusterSchedulingPolicyPreference)] - except ValueError: - str_list += ['clusterSchedulingPolicyPreference : '] - try: - str_list += ['programmaticStreamSerializationAllowed : ' + str(self.programmaticStreamSerializationAllowed)] - except ValueError: - str_list += ['programmaticStreamSerializationAllowed : '] - try: - str_list += ['programmaticEvent :\n' + '\n'.join([' ' + line for line in str(self.programmaticEvent).splitlines()])] - except ValueError: - str_list += ['programmaticEvent : '] - try: - str_list += ['launchCompletionEvent :\n' + '\n'.join([' ' + line for line in str(self.launchCompletionEvent).splitlines()])] + str_list += ['devPtr : ' + str(self.devPtr)] except ValueError: - str_list += ['launchCompletionEvent : '] + str_list += ['devPtr : '] + + try: - str_list += ['priority : ' + str(self.priority)] + str_list += ['format : ' + str(self.format)] except ValueError: - str_list += ['priority : '] + str_list += ['format : '] + + try: - str_list += ['memSyncDomainMap :\n' + '\n'.join([' ' + line for line in str(self.memSyncDomainMap).splitlines()])] + str_list += ['numChannels : ' + str(self.numChannels)] except ValueError: - str_list += ['memSyncDomainMap : '] + str_list += ['numChannels : '] + + try: - str_list += ['memSyncDomain : ' + str(self.memSyncDomain)] + str_list += ['width : ' + str(self.width)] except ValueError: - str_list += ['memSyncDomain : '] + str_list += ['width : '] + + try: - str_list += ['deviceUpdatableKernelNode :\n' + '\n'.join([' ' + line for line in str(self.deviceUpdatableKernelNode).splitlines()])] + str_list += ['height : ' + str(self.height)] except ValueError: - str_list += ['deviceUpdatableKernelNode : '] + str_list += ['height : '] + + try: - str_list += ['sharedMemCarveout : ' + str(self.sharedMemCarveout)] + str_list += ['pitchInBytes : ' + str(self.pitchInBytes)] except ValueError: - str_list += ['sharedMemCarveout : '] + str_list += ['pitchInBytes : '] + return '\n'.join(str_list) else: return '' + @property - def pad(self): - return PyBytes_FromStringAndSize(self._ptr[0].pad, 64) - @pad.setter - def pad(self, pad): - if len(pad) != 64: - raise ValueError("pad length must be 64, is " + str(len(pad))) - if CHAR_MIN == 0: - for i, b in enumerate(pad): - if b < 0 and b > -129: - b = b + 256 - self._ptr[0].pad[i] = b + def devPtr(self): + return self._devPtr + @devPtr.setter + def devPtr(self, devPtr): + cdef cydriver.CUdeviceptr cydevPtr + if devPtr is None: + cydevPtr = 0 + elif isinstance(devPtr, (CUdeviceptr)): + pdevPtr = int(devPtr) + cydevPtr = pdevPtr else: - for i, b in enumerate(pad): - if b > 127 and b < 256: - b = b - 256 - self._ptr[0].pad[i] = b - @property - def accessPolicyWindow(self): - return self._accessPolicyWindow - @accessPolicyWindow.setter - def accessPolicyWindow(self, accessPolicyWindow not None : CUaccessPolicyWindow): - string.memcpy(&self._ptr[0].accessPolicyWindow, accessPolicyWindow.getPtr(), sizeof(self._ptr[0].accessPolicyWindow)) - @property - def cooperative(self): - return self._ptr[0].cooperative - @cooperative.setter - def cooperative(self, int cooperative): - self._ptr[0].cooperative = cooperative - @property - def syncPolicy(self): - return CUsynchronizationPolicy(self._ptr[0].syncPolicy) - @syncPolicy.setter - def syncPolicy(self, syncPolicy not None : CUsynchronizationPolicy): - self._ptr[0].syncPolicy = syncPolicy.value - @property - def clusterDim(self): - return self._clusterDim - @clusterDim.setter - def clusterDim(self, clusterDim not None : anon_struct1): - string.memcpy(&self._ptr[0].clusterDim, clusterDim.getPtr(), sizeof(self._ptr[0].clusterDim)) - @property - def clusterSchedulingPolicyPreference(self): - return CUclusterSchedulingPolicy(self._ptr[0].clusterSchedulingPolicyPreference) - @clusterSchedulingPolicyPreference.setter - def clusterSchedulingPolicyPreference(self, clusterSchedulingPolicyPreference not None : CUclusterSchedulingPolicy): - self._ptr[0].clusterSchedulingPolicyPreference = clusterSchedulingPolicyPreference.value - @property - def programmaticStreamSerializationAllowed(self): - return self._ptr[0].programmaticStreamSerializationAllowed - @programmaticStreamSerializationAllowed.setter - def programmaticStreamSerializationAllowed(self, int programmaticStreamSerializationAllowed): - self._ptr[0].programmaticStreamSerializationAllowed = programmaticStreamSerializationAllowed - @property - def programmaticEvent(self): - return self._programmaticEvent - @programmaticEvent.setter - def programmaticEvent(self, programmaticEvent not None : anon_struct2): - string.memcpy(&self._ptr[0].programmaticEvent, programmaticEvent.getPtr(), sizeof(self._ptr[0].programmaticEvent)) - @property - def launchCompletionEvent(self): - return self._launchCompletionEvent - @launchCompletionEvent.setter - def launchCompletionEvent(self, launchCompletionEvent not None : anon_struct3): - string.memcpy(&self._ptr[0].launchCompletionEvent, launchCompletionEvent.getPtr(), sizeof(self._ptr[0].launchCompletionEvent)) + pdevPtr = int(CUdeviceptr(devPtr)) + cydevPtr = pdevPtr + self._devPtr._pvt_ptr[0] = cydevPtr + + + @property - def priority(self): - return self._ptr[0].priority - @priority.setter - def priority(self, int priority): - self._ptr[0].priority = priority + def format(self): + return CUarray_format(self._pvt_ptr[0].res.pitch2D.format) + @format.setter + def format(self, format not None : CUarray_format): + self._pvt_ptr[0].res.pitch2D.format = int(format) + + @property - def memSyncDomainMap(self): - return self._memSyncDomainMap - @memSyncDomainMap.setter - def memSyncDomainMap(self, memSyncDomainMap not None : CUlaunchMemSyncDomainMap): - string.memcpy(&self._ptr[0].memSyncDomainMap, memSyncDomainMap.getPtr(), sizeof(self._ptr[0].memSyncDomainMap)) + def numChannels(self): + return self._pvt_ptr[0].res.pitch2D.numChannels + @numChannels.setter + def numChannels(self, unsigned int numChannels): + self._pvt_ptr[0].res.pitch2D.numChannels = numChannels + + @property - def memSyncDomain(self): - return CUlaunchMemSyncDomain(self._ptr[0].memSyncDomain) - @memSyncDomain.setter - def memSyncDomain(self, memSyncDomain not None : CUlaunchMemSyncDomain): - self._ptr[0].memSyncDomain = memSyncDomain.value + def width(self): + return self._pvt_ptr[0].res.pitch2D.width + @width.setter + def width(self, size_t width): + self._pvt_ptr[0].res.pitch2D.width = width + + @property - def deviceUpdatableKernelNode(self): - return self._deviceUpdatableKernelNode - @deviceUpdatableKernelNode.setter - def deviceUpdatableKernelNode(self, deviceUpdatableKernelNode not None : anon_struct4): - string.memcpy(&self._ptr[0].deviceUpdatableKernelNode, deviceUpdatableKernelNode.getPtr(), sizeof(self._ptr[0].deviceUpdatableKernelNode)) + def height(self): + return self._pvt_ptr[0].res.pitch2D.height + @height.setter + def height(self, size_t height): + self._pvt_ptr[0].res.pitch2D.height = height + + @property - def sharedMemCarveout(self): - return self._ptr[0].sharedMemCarveout - @sharedMemCarveout.setter - def sharedMemCarveout(self, unsigned int sharedMemCarveout): - self._ptr[0].sharedMemCarveout = sharedMemCarveout -{{endif}} -{{if 'struct CUlaunchAttribute_st' in found_types}} + def pitchInBytes(self): + return self._pvt_ptr[0].res.pitch2D.pitchInBytes + @pitchInBytes.setter + def pitchInBytes(self, size_t pitchInBytes): + self._pvt_ptr[0].res.pitch2D.pitchInBytes = pitchInBytes -cdef class CUlaunchAttribute_st: - """ - Launch attribute +cdef class anon_struct11: + """ Attributes ---------- - id : CUlaunchAttributeID - Attribute to set - value : CUlaunchAttributeValue - Value of the attribute + + reserved : list[int] + + Methods ------- getPtr() Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - else: - self._ptr = _ptr - def __init__(self, void_ptr _ptr = 0): - self._value = CUlaunchAttributeValue(_ptr=&self._ptr[0].value) + def __cinit__(self, void_ptr _ptr): + self._pvt_ptr = _ptr + + def __init__(self, void_ptr _ptr): + pass def __dealloc__(self): pass def getPtr(self): - return self._ptr + return &self._pvt_ptr[0].res.reserved def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['id : ' + str(self.id)] - except ValueError: - str_list += ['id : '] - try: - str_list += ['value :\n' + '\n'.join([' ' + line for line in str(self.value).splitlines()])] + str_list += ['reserved : ' + str(self.reserved)] except ValueError: - str_list += ['value : '] + str_list += ['reserved : '] + return '\n'.join(str_list) else: return '' + @property - def id(self): - return CUlaunchAttributeID(self._ptr[0].id) - @id.setter - def id(self, id not None : CUlaunchAttributeID): - self._ptr[0].id = id.value - @property - def value(self): - return self._value - @value.setter - def value(self, value not None : CUlaunchAttributeValue): - string.memcpy(&self._ptr[0].value, value.getPtr(), sizeof(self._ptr[0].value)) -{{endif}} -{{if 'struct CUlaunchConfig_st' in found_types}} + def reserved(self): + return self._pvt_ptr[0].res.reserved.reserved + @reserved.setter + def reserved(self, reserved): + self._pvt_ptr[0].res.reserved.reserved = reserved -cdef class CUlaunchConfig_st: - """ - CUDA extensible launch configuration +cdef class anon_union4: + """ Attributes ---------- - gridDimX : unsigned int - Width of grid in blocks - gridDimY : unsigned int - Height of grid in blocks - gridDimZ : unsigned int - Depth of grid in blocks - blockDimX : unsigned int - X dimension of each thread block - blockDimY : unsigned int - Y dimension of each thread block - blockDimZ : unsigned int - Z dimension of each thread block - sharedMemBytes : unsigned int - Dynamic shared-memory size per thread block in bytes - hStream : CUstream - Stream identifier - attrs : CUlaunchAttribute - List of attributes; nullable if CUlaunchConfig::numAttrs == 0 - numAttrs : unsigned int - Number of attributes populated in CUlaunchConfig::attrs + + array : anon_struct7 + + + + mipmap : anon_struct8 + + + + linear : anon_struct9 + + + + pitch2D : anon_struct10 + + + + reserved : anon_struct11 + + Methods ------- getPtr() Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - else: - self._ptr = _ptr - def __init__(self, void_ptr _ptr = 0): - self._hStream = CUstream(_ptr=&self._ptr[0].hStream) + def __cinit__(self, void_ptr _ptr): + self._pvt_ptr = _ptr + + def __init__(self, void_ptr _ptr): + pass + + self._array = anon_struct7(_ptr=self._pvt_ptr) + + + self._mipmap = anon_struct8(_ptr=self._pvt_ptr) + + + self._linear = anon_struct9(_ptr=self._pvt_ptr) + + + self._pitch2D = anon_struct10(_ptr=self._pvt_ptr) + + + self._reserved = anon_struct11(_ptr=self._pvt_ptr) + def __dealloc__(self): - if self._attrs is not NULL: - free(self._attrs) + pass def getPtr(self): - return self._ptr + return &self._pvt_ptr[0].res def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['gridDimX : ' + str(self.gridDimX)] - except ValueError: - str_list += ['gridDimX : '] - try: - str_list += ['gridDimY : ' + str(self.gridDimY)] - except ValueError: - str_list += ['gridDimY : '] - try: - str_list += ['gridDimZ : ' + str(self.gridDimZ)] - except ValueError: - str_list += ['gridDimZ : '] - try: - str_list += ['blockDimX : ' + str(self.blockDimX)] - except ValueError: - str_list += ['blockDimX : '] - try: - str_list += ['blockDimY : ' + str(self.blockDimY)] - except ValueError: - str_list += ['blockDimY : '] - try: - str_list += ['blockDimZ : ' + str(self.blockDimZ)] + str_list += ['array :\n' + '\n'.join([' ' + line for line in str(self.array).splitlines()])] except ValueError: - str_list += ['blockDimZ : '] + str_list += ['array : '] + + try: - str_list += ['sharedMemBytes : ' + str(self.sharedMemBytes)] + str_list += ['mipmap :\n' + '\n'.join([' ' + line for line in str(self.mipmap).splitlines()])] except ValueError: - str_list += ['sharedMemBytes : '] + str_list += ['mipmap : '] + + try: - str_list += ['hStream : ' + str(self.hStream)] + str_list += ['linear :\n' + '\n'.join([' ' + line for line in str(self.linear).splitlines()])] except ValueError: - str_list += ['hStream : '] + str_list += ['linear : '] + + try: - str_list += ['attrs : ' + str(self.attrs)] + str_list += ['pitch2D :\n' + '\n'.join([' ' + line for line in str(self.pitch2D).splitlines()])] except ValueError: - str_list += ['attrs : '] + str_list += ['pitch2D : '] + + try: - str_list += ['numAttrs : ' + str(self.numAttrs)] + str_list += ['reserved :\n' + '\n'.join([' ' + line for line in str(self.reserved).splitlines()])] except ValueError: - str_list += ['numAttrs : '] + str_list += ['reserved : '] + return '\n'.join(str_list) else: return '' + @property - def gridDimX(self): - return self._ptr[0].gridDimX - @gridDimX.setter - def gridDimX(self, unsigned int gridDimX): - self._ptr[0].gridDimX = gridDimX - @property - def gridDimY(self): - return self._ptr[0].gridDimY - @gridDimY.setter - def gridDimY(self, unsigned int gridDimY): - self._ptr[0].gridDimY = gridDimY - @property - def gridDimZ(self): - return self._ptr[0].gridDimZ - @gridDimZ.setter - def gridDimZ(self, unsigned int gridDimZ): - self._ptr[0].gridDimZ = gridDimZ - @property - def blockDimX(self): - return self._ptr[0].blockDimX - @blockDimX.setter - def blockDimX(self, unsigned int blockDimX): - self._ptr[0].blockDimX = blockDimX - @property - def blockDimY(self): - return self._ptr[0].blockDimY - @blockDimY.setter - def blockDimY(self, unsigned int blockDimY): - self._ptr[0].blockDimY = blockDimY - @property - def blockDimZ(self): - return self._ptr[0].blockDimZ - @blockDimZ.setter - def blockDimZ(self, unsigned int blockDimZ): - self._ptr[0].blockDimZ = blockDimZ + def array(self): + return self._array + @array.setter + def array(self, array not None : anon_struct7): + string.memcpy(&self._pvt_ptr[0].res.array, array.getPtr(), sizeof(self._pvt_ptr[0].res.array)) + + @property - def sharedMemBytes(self): - return self._ptr[0].sharedMemBytes - @sharedMemBytes.setter - def sharedMemBytes(self, unsigned int sharedMemBytes): - self._ptr[0].sharedMemBytes = sharedMemBytes + def mipmap(self): + return self._mipmap + @mipmap.setter + def mipmap(self, mipmap not None : anon_struct8): + string.memcpy(&self._pvt_ptr[0].res.mipmap, mipmap.getPtr(), sizeof(self._pvt_ptr[0].res.mipmap)) + + @property - def hStream(self): - return self._hStream - @hStream.setter - def hStream(self, hStream): - cdef ccuda.CUstream chStream - if hStream is None: - chStream = 0 - elif isinstance(hStream, (CUstream,)): - phStream = int(hStream) - chStream = phStream - else: - phStream = int(CUstream(hStream)) - chStream = phStream - self._hStream._ptr[0] = chStream + def linear(self): + return self._linear + @linear.setter + def linear(self, linear not None : anon_struct9): + string.memcpy(&self._pvt_ptr[0].res.linear, linear.getPtr(), sizeof(self._pvt_ptr[0].res.linear)) + + @property - def attrs(self): - arrs = [self._ptr[0].attrs + x*sizeof(ccuda.CUlaunchAttribute) for x in range(self._attrs_length)] - return [CUlaunchAttribute(_ptr=arr) for arr in arrs] - @attrs.setter - def attrs(self, val): - if len(val) == 0: - free(self._attrs) - self._attrs_length = 0 - self._ptr[0].attrs = NULL - else: - if self._attrs_length != len(val): - free(self._attrs) - self._attrs = calloc(len(val), sizeof(ccuda.CUlaunchAttribute)) - if self._attrs is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(ccuda.CUlaunchAttribute))) - self._attrs_length = len(val) - self._ptr[0].attrs = self._attrs - for idx in range(len(val)): - string.memcpy(&self._attrs[idx], (val[idx])._ptr, sizeof(ccuda.CUlaunchAttribute)) + def pitch2D(self): + return self._pitch2D + @pitch2D.setter + def pitch2D(self, pitch2D not None : anon_struct10): + string.memcpy(&self._pvt_ptr[0].res.pitch2D, pitch2D.getPtr(), sizeof(self._pvt_ptr[0].res.pitch2D)) + @property - def numAttrs(self): - return self._ptr[0].numAttrs - @numAttrs.setter - def numAttrs(self, unsigned int numAttrs): - self._ptr[0].numAttrs = numAttrs -{{endif}} -{{if 'struct CUexecAffinitySmCount_st' in found_types}} + def reserved(self): + return self._reserved + @reserved.setter + def reserved(self, reserved not None : anon_struct11): + string.memcpy(&self._pvt_ptr[0].res.reserved, reserved.getPtr(), sizeof(self._pvt_ptr[0].res.reserved)) -cdef class CUexecAffinitySmCount_st: + +cdef class CUDA_RESOURCE_DESC_st: """ - Value for CU_EXEC_AFFINITY_TYPE_SM_COUNT + CUDA Resource descriptor Attributes ---------- - val : unsigned int - The number of SMs the context is limited to use. + + resType : CUresourcetype + Resource type + + + res : anon_union4 + + + + flags : unsigned int + Flags (must be zero) + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._val_ptr = calloc(1, sizeof(cydriver.CUDA_RESOURCE_DESC_st)) + self._pvt_ptr = self._val_ptr else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): pass + + self._res = anon_union4(_ptr=self._pvt_ptr) + def __dealloc__(self): - pass + if self._val_ptr is not NULL: + free(self._val_ptr) def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['val : ' + str(self.val)] + str_list += ['resType : ' + str(self.resType)] except ValueError: - str_list += ['val : '] - return '\n'.join(str_list) - else: - return '' - @property - def val(self): - return self._ptr[0].val - @val.setter - def val(self, unsigned int val): - self._ptr[0].val = val -{{endif}} -{{if 'struct CUexecAffinityParam_st' in found_types}} - -cdef class anon_union3: - """ - Attributes - ---------- - smCount : CUexecAffinitySmCount + str_list += ['resType : '] - Methods - ------- - getPtr() - Get memory address of class instance + try: + str_list += ['res :\n' + '\n'.join([' ' + line for line in str(self.res).splitlines()])] + except ValueError: + str_list += ['res : '] - """ - def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr - def __init__(self, void_ptr _ptr): - self._smCount = CUexecAffinitySmCount(_ptr=&self._ptr[0].param.smCount) - def __dealloc__(self): - pass - def getPtr(self): - return &self._ptr[0].param - def __repr__(self): - if self._ptr is not NULL: - str_list = [] try: - str_list += ['smCount :\n' + '\n'.join([' ' + line for line in str(self.smCount).splitlines()])] + str_list += ['flags : ' + str(self.flags)] except ValueError: - str_list += ['smCount : '] + str_list += ['flags : '] + return '\n'.join(str_list) else: return '' + @property - def smCount(self): - return self._smCount - @smCount.setter - def smCount(self, smCount not None : CUexecAffinitySmCount): - string.memcpy(&self._ptr[0].param.smCount, smCount.getPtr(), sizeof(self._ptr[0].param.smCount)) -{{endif}} -{{if 'struct CUexecAffinityParam_st' in found_types}} + def resType(self): + return CUresourcetype(self._pvt_ptr[0].resType) + @resType.setter + def resType(self, resType not None : CUresourcetype): + self._pvt_ptr[0].resType = int(resType) -cdef class CUexecAffinityParam_st: + + @property + def res(self): + return self._res + @res.setter + def res(self, res not None : anon_union4): + string.memcpy(&self._pvt_ptr[0].res, res.getPtr(), sizeof(self._pvt_ptr[0].res)) + + + @property + def flags(self): + return self._pvt_ptr[0].flags + @flags.setter + def flags(self, unsigned int flags): + self._pvt_ptr[0].flags = flags + + +cdef class CUDA_TEXTURE_DESC_st: """ - Execution Affinity Parameters + Texture descriptor Attributes ---------- - type : CUexecAffinityType - param : anon_union3 + addressMode : list[CUaddress_mode] + Address modes + + + filterMode : CUfilter_mode + Filter mode + + + flags : unsigned int + Flags + + + maxAnisotropy : unsigned int + Maximum anisotropy ratio + + + mipmapFilterMode : CUfilter_mode + Mipmap filter mode + + + mipmapLevelBias : float + Mipmap level bias + + + minMipmapLevelClamp : float + Mipmap minimum level clamp + + + maxMipmapLevelClamp : float + Mipmap maximum level clamp + + + borderColor : list[float] + Border Color + + + reserved : list[int] + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._val_ptr = calloc(1, sizeof(ccuda.CUexecAffinityParam_st)) - self._ptr = self._val_ptr + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - self._param = anon_union3(_ptr=self._ptr) + pass def __dealloc__(self): - if self._val_ptr is not NULL: - free(self._val_ptr) + pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['type : ' + str(self.type)] + str_list += ['addressMode : ' + str(self.addressMode)] except ValueError: - str_list += ['type : '] + str_list += ['addressMode : '] + + try: - str_list += ['param :\n' + '\n'.join([' ' + line for line in str(self.param).splitlines()])] + str_list += ['filterMode : ' + str(self.filterMode)] except ValueError: - str_list += ['param : '] + str_list += ['filterMode : '] + + + try: + str_list += ['flags : ' + str(self.flags)] + except ValueError: + str_list += ['flags : '] + + + try: + str_list += ['maxAnisotropy : ' + str(self.maxAnisotropy)] + except ValueError: + str_list += ['maxAnisotropy : '] + + + try: + str_list += ['mipmapFilterMode : ' + str(self.mipmapFilterMode)] + except ValueError: + str_list += ['mipmapFilterMode : '] + + + try: + str_list += ['mipmapLevelBias : ' + str(self.mipmapLevelBias)] + except ValueError: + str_list += ['mipmapLevelBias : '] + + + try: + str_list += ['minMipmapLevelClamp : ' + str(self.minMipmapLevelClamp)] + except ValueError: + str_list += ['minMipmapLevelClamp : '] + + + try: + str_list += ['maxMipmapLevelClamp : ' + str(self.maxMipmapLevelClamp)] + except ValueError: + str_list += ['maxMipmapLevelClamp : '] + + + try: + str_list += ['borderColor : ' + str(self.borderColor)] + except ValueError: + str_list += ['borderColor : '] + + + try: + str_list += ['reserved : ' + str(self.reserved)] + except ValueError: + str_list += ['reserved : '] + return '\n'.join(str_list) else: return '' + @property - def type(self): - return CUexecAffinityType(self._ptr[0].type) - @type.setter - def type(self, type not None : CUexecAffinityType): - self._ptr[0].type = type.value + def addressMode(self): + return [CUaddress_mode(_x) for _x in list(self._pvt_ptr[0].addressMode)] + @addressMode.setter + def addressMode(self, addressMode): + self._pvt_ptr[0].addressMode = [int(_x) for _x in addressMode] + + @property - def param(self): - return self._param - @param.setter - def param(self, param not None : anon_union3): - string.memcpy(&self._ptr[0].param, param.getPtr(), sizeof(self._ptr[0].param)) -{{endif}} -{{if 'struct CUctxCigParam_st' in found_types}} + def filterMode(self): + return CUfilter_mode(self._pvt_ptr[0].filterMode) + @filterMode.setter + def filterMode(self, filterMode not None : CUfilter_mode): + self._pvt_ptr[0].filterMode = int(filterMode) -cdef class CUctxCigParam_st: + + @property + def flags(self): + return self._pvt_ptr[0].flags + @flags.setter + def flags(self, unsigned int flags): + self._pvt_ptr[0].flags = flags + + + @property + def maxAnisotropy(self): + return self._pvt_ptr[0].maxAnisotropy + @maxAnisotropy.setter + def maxAnisotropy(self, unsigned int maxAnisotropy): + self._pvt_ptr[0].maxAnisotropy = maxAnisotropy + + + @property + def mipmapFilterMode(self): + return CUfilter_mode(self._pvt_ptr[0].mipmapFilterMode) + @mipmapFilterMode.setter + def mipmapFilterMode(self, mipmapFilterMode not None : CUfilter_mode): + self._pvt_ptr[0].mipmapFilterMode = int(mipmapFilterMode) + + + @property + def mipmapLevelBias(self): + return self._pvt_ptr[0].mipmapLevelBias + @mipmapLevelBias.setter + def mipmapLevelBias(self, float mipmapLevelBias): + self._pvt_ptr[0].mipmapLevelBias = mipmapLevelBias + + + @property + def minMipmapLevelClamp(self): + return self._pvt_ptr[0].minMipmapLevelClamp + @minMipmapLevelClamp.setter + def minMipmapLevelClamp(self, float minMipmapLevelClamp): + self._pvt_ptr[0].minMipmapLevelClamp = minMipmapLevelClamp + + + @property + def maxMipmapLevelClamp(self): + return self._pvt_ptr[0].maxMipmapLevelClamp + @maxMipmapLevelClamp.setter + def maxMipmapLevelClamp(self, float maxMipmapLevelClamp): + self._pvt_ptr[0].maxMipmapLevelClamp = maxMipmapLevelClamp + + + @property + def borderColor(self): + return self._pvt_ptr[0].borderColor + @borderColor.setter + def borderColor(self, borderColor): + self._pvt_ptr[0].borderColor = borderColor + + + @property + def reserved(self): + return self._pvt_ptr[0].reserved + @reserved.setter + def reserved(self, reserved): + self._pvt_ptr[0].reserved = reserved + + +cdef class CUDA_RESOURCE_VIEW_DESC_st: """ - CIG Context Create Params + Resource view descriptor Attributes ---------- - sharedDataType : CUcigDataType - sharedData : Any + format : CUresourceViewFormat + Resource view format + + + width : size_t + Width of the resource view + + + height : size_t + Height of the resource view + + + depth : size_t + Depth of the resource view + + + firstMipmapLevel : unsigned int + First defined mipmap level + + + lastMipmapLevel : unsigned int + Last defined mipmap level + + + firstLayer : unsigned int + First layer index + + + lastLayer : unsigned int + Last layer index + + + reserved : list[unsigned int] + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): pass def __dealloc__(self): pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['sharedDataType : ' + str(self.sharedDataType)] + str_list += ['format : ' + str(self.format)] except ValueError: - str_list += ['sharedDataType : '] + str_list += ['format : '] + + try: - str_list += ['sharedData : ' + hex(self.sharedData)] + str_list += ['width : ' + str(self.width)] except ValueError: - str_list += ['sharedData : '] - return '\n'.join(str_list) - else: - return '' - @property - def sharedDataType(self): - return CUcigDataType(self._ptr[0].sharedDataType) - @sharedDataType.setter - def sharedDataType(self, sharedDataType not None : CUcigDataType): - self._ptr[0].sharedDataType = sharedDataType.value - @property - def sharedData(self): - return self._ptr[0].sharedData - @sharedData.setter - def sharedData(self, sharedData): - _csharedData = utils.HelperInputVoidPtr(sharedData) - self._ptr[0].sharedData = _csharedData.cptr -{{endif}} -{{if 'struct CUctxCreateParams_st' in found_types}} + str_list += ['width : '] -cdef class CUctxCreateParams_st: - """ - Params for creating CUDA context Exactly one of execAffinityParams - and cigParams must be non-NULL. - Attributes - ---------- - execAffinityParams : CUexecAffinityParam + try: + str_list += ['height : ' + str(self.height)] + except ValueError: + str_list += ['height : '] - numExecAffinityParams : int - cigParams : CUctxCigParam + try: + str_list += ['depth : ' + str(self.depth)] + except ValueError: + str_list += ['depth : '] - Methods - ------- - getPtr() - Get memory address of class instance + try: + str_list += ['firstMipmapLevel : ' + str(self.firstMipmapLevel)] + except ValueError: + str_list += ['firstMipmapLevel : '] + - """ - def __cinit__(self, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - else: - self._ptr = _ptr - def __init__(self, void_ptr _ptr = 0): - pass - def __dealloc__(self): - if self._execAffinityParams is not NULL: - free(self._execAffinityParams) - if self._cigParams is not NULL: - free(self._cigParams) - def getPtr(self): - return self._ptr - def __repr__(self): - if self._ptr is not NULL: - str_list = [] try: - str_list += ['execAffinityParams : ' + str(self.execAffinityParams)] + str_list += ['lastMipmapLevel : ' + str(self.lastMipmapLevel)] except ValueError: - str_list += ['execAffinityParams : '] + str_list += ['lastMipmapLevel : '] + + try: - str_list += ['numExecAffinityParams : ' + str(self.numExecAffinityParams)] + str_list += ['firstLayer : ' + str(self.firstLayer)] except ValueError: - str_list += ['numExecAffinityParams : '] + str_list += ['firstLayer : '] + + try: - str_list += ['cigParams : ' + str(self.cigParams)] + str_list += ['lastLayer : ' + str(self.lastLayer)] except ValueError: - str_list += ['cigParams : '] + str_list += ['lastLayer : '] + + + try: + str_list += ['reserved : ' + str(self.reserved)] + except ValueError: + str_list += ['reserved : '] + return '\n'.join(str_list) else: return '' + @property - def execAffinityParams(self): - arrs = [self._ptr[0].execAffinityParams + x*sizeof(ccuda.CUexecAffinityParam) for x in range(self._execAffinityParams_length)] - return [CUexecAffinityParam(_ptr=arr) for arr in arrs] - @execAffinityParams.setter - def execAffinityParams(self, val): - if len(val) == 0: - free(self._execAffinityParams) - self._execAffinityParams_length = 0 - self._ptr[0].execAffinityParams = NULL - else: - if self._execAffinityParams_length != len(val): - free(self._execAffinityParams) - self._execAffinityParams = calloc(len(val), sizeof(ccuda.CUexecAffinityParam)) - if self._execAffinityParams is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(ccuda.CUexecAffinityParam))) - self._execAffinityParams_length = len(val) - self._ptr[0].execAffinityParams = self._execAffinityParams - for idx in range(len(val)): - string.memcpy(&self._execAffinityParams[idx], (val[idx])._ptr, sizeof(ccuda.CUexecAffinityParam)) + def format(self): + return CUresourceViewFormat(self._pvt_ptr[0].format) + @format.setter + def format(self, format not None : CUresourceViewFormat): + self._pvt_ptr[0].format = int(format) + @property - def numExecAffinityParams(self): - return self._ptr[0].numExecAffinityParams - @numExecAffinityParams.setter - def numExecAffinityParams(self, int numExecAffinityParams): - self._ptr[0].numExecAffinityParams = numExecAffinityParams + def width(self): + return self._pvt_ptr[0].width + @width.setter + def width(self, size_t width): + self._pvt_ptr[0].width = width + + @property - def cigParams(self): - arrs = [self._ptr[0].cigParams + x*sizeof(ccuda.CUctxCigParam) for x in range(self._cigParams_length)] - return [CUctxCigParam(_ptr=arr) for arr in arrs] - @cigParams.setter - def cigParams(self, val): - if len(val) == 0: - free(self._cigParams) - self._cigParams_length = 0 - self._ptr[0].cigParams = NULL - else: - if self._cigParams_length != len(val): - free(self._cigParams) - self._cigParams = calloc(len(val), sizeof(ccuda.CUctxCigParam)) - if self._cigParams is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(ccuda.CUctxCigParam))) - self._cigParams_length = len(val) - self._ptr[0].cigParams = self._cigParams - for idx in range(len(val)): - string.memcpy(&self._cigParams[idx], (val[idx])._ptr, sizeof(ccuda.CUctxCigParam)) + def height(self): + return self._pvt_ptr[0].height + @height.setter + def height(self, size_t height): + self._pvt_ptr[0].height = height -{{endif}} -{{if 'struct CUlibraryHostUniversalFunctionAndDataTable_st' in found_types}} -cdef class CUlibraryHostUniversalFunctionAndDataTable_st: + @property + def depth(self): + return self._pvt_ptr[0].depth + @depth.setter + def depth(self, size_t depth): + self._pvt_ptr[0].depth = depth + + + @property + def firstMipmapLevel(self): + return self._pvt_ptr[0].firstMipmapLevel + @firstMipmapLevel.setter + def firstMipmapLevel(self, unsigned int firstMipmapLevel): + self._pvt_ptr[0].firstMipmapLevel = firstMipmapLevel + + + @property + def lastMipmapLevel(self): + return self._pvt_ptr[0].lastMipmapLevel + @lastMipmapLevel.setter + def lastMipmapLevel(self, unsigned int lastMipmapLevel): + self._pvt_ptr[0].lastMipmapLevel = lastMipmapLevel + + + @property + def firstLayer(self): + return self._pvt_ptr[0].firstLayer + @firstLayer.setter + def firstLayer(self, unsigned int firstLayer): + self._pvt_ptr[0].firstLayer = firstLayer + + + @property + def lastLayer(self): + return self._pvt_ptr[0].lastLayer + @lastLayer.setter + def lastLayer(self, unsigned int lastLayer): + self._pvt_ptr[0].lastLayer = lastLayer + + + @property + def reserved(self): + return self._pvt_ptr[0].reserved + @reserved.setter + def reserved(self, reserved): + self._pvt_ptr[0].reserved = reserved + + +cdef class CUtensorMap_st: """ + Tensor map descriptor. Requires compiler support for aligning to + 128 bytes. + Attributes ---------- - functionTable : Any - - functionWindowSize : size_t - dataTable : Any + opaque : list[cuuint64_t] - dataWindowSize : size_t Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): pass def __dealloc__(self): pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['functionTable : ' + hex(self.functionTable)] - except ValueError: - str_list += ['functionTable : '] - try: - str_list += ['functionWindowSize : ' + str(self.functionWindowSize)] - except ValueError: - str_list += ['functionWindowSize : '] - try: - str_list += ['dataTable : ' + hex(self.dataTable)] - except ValueError: - str_list += ['dataTable : '] - try: - str_list += ['dataWindowSize : ' + str(self.dataWindowSize)] + str_list += ['opaque : ' + str(self.opaque)] except ValueError: - str_list += ['dataWindowSize : '] + str_list += ['opaque : '] + return '\n'.join(str_list) else: return '' + @property - def functionTable(self): - return self._ptr[0].functionTable - @functionTable.setter - def functionTable(self, functionTable): - _cfunctionTable = utils.HelperInputVoidPtr(functionTable) - self._ptr[0].functionTable = _cfunctionTable.cptr - @property - def functionWindowSize(self): - return self._ptr[0].functionWindowSize - @functionWindowSize.setter - def functionWindowSize(self, size_t functionWindowSize): - self._ptr[0].functionWindowSize = functionWindowSize - @property - def dataTable(self): - return self._ptr[0].dataTable - @dataTable.setter - def dataTable(self, dataTable): - _cdataTable = utils.HelperInputVoidPtr(dataTable) - self._ptr[0].dataTable = _cdataTable.cptr - @property - def dataWindowSize(self): - return self._ptr[0].dataWindowSize - @dataWindowSize.setter - def dataWindowSize(self, size_t dataWindowSize): - self._ptr[0].dataWindowSize = dataWindowSize -{{endif}} -{{if 'struct CUDA_MEMCPY2D_st' in found_types}} + def opaque(self): + return [cuuint64_t(init_value=_opaque) for _opaque in self._pvt_ptr[0].opaque] + @opaque.setter + def opaque(self, opaque): + self._pvt_ptr[0].opaque = opaque -cdef class CUDA_MEMCPY2D_st: + + +cdef class CUDA_POINTER_ATTRIBUTE_P2P_TOKENS_st: """ - 2D memory copy parameters + GPU Direct v3 tokens Attributes ---------- - srcXInBytes : size_t - Source X in bytes - srcY : size_t - Source Y - srcMemoryType : CUmemorytype - Source memory type (host, device, array) - srcHost : Any - Source host pointer - srcDevice : CUdeviceptr - Source device pointer - srcArray : CUarray - Source array reference - srcPitch : size_t - Source pitch (ignored when src is array) - dstXInBytes : size_t - Destination X in bytes - dstY : size_t - Destination Y - dstMemoryType : CUmemorytype - Destination memory type (host, device, array) - dstHost : Any - Destination host pointer - dstDevice : CUdeviceptr - Destination device pointer - dstArray : CUarray - Destination array reference - dstPitch : size_t - Destination pitch (ignored when dst is array) - WidthInBytes : size_t - Width of 2D memory copy in bytes - Height : size_t - Height of 2D memory copy + + p2pToken : unsigned long long + + + + vaSpaceToken : unsigned int + + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - self._srcDevice = CUdeviceptr(_ptr=&self._ptr[0].srcDevice) - self._srcArray = CUarray(_ptr=&self._ptr[0].srcArray) - self._dstDevice = CUdeviceptr(_ptr=&self._ptr[0].dstDevice) - self._dstArray = CUarray(_ptr=&self._ptr[0].dstArray) + pass def __dealloc__(self): pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['srcXInBytes : ' + str(self.srcXInBytes)] - except ValueError: - str_list += ['srcXInBytes : '] - try: - str_list += ['srcY : ' + str(self.srcY)] - except ValueError: - str_list += ['srcY : '] - try: - str_list += ['srcMemoryType : ' + str(self.srcMemoryType)] - except ValueError: - str_list += ['srcMemoryType : '] - try: - str_list += ['srcHost : ' + hex(self.srcHost)] - except ValueError: - str_list += ['srcHost : '] - try: - str_list += ['srcDevice : ' + str(self.srcDevice)] - except ValueError: - str_list += ['srcDevice : '] - try: - str_list += ['srcArray : ' + str(self.srcArray)] - except ValueError: - str_list += ['srcArray : '] - try: - str_list += ['srcPitch : ' + str(self.srcPitch)] - except ValueError: - str_list += ['srcPitch : '] - try: - str_list += ['dstXInBytes : ' + str(self.dstXInBytes)] - except ValueError: - str_list += ['dstXInBytes : '] - try: - str_list += ['dstY : ' + str(self.dstY)] - except ValueError: - str_list += ['dstY : '] - try: - str_list += ['dstMemoryType : ' + str(self.dstMemoryType)] - except ValueError: - str_list += ['dstMemoryType : '] - try: - str_list += ['dstHost : ' + hex(self.dstHost)] - except ValueError: - str_list += ['dstHost : '] - try: - str_list += ['dstDevice : ' + str(self.dstDevice)] - except ValueError: - str_list += ['dstDevice : '] - try: - str_list += ['dstArray : ' + str(self.dstArray)] - except ValueError: - str_list += ['dstArray : '] - try: - str_list += ['dstPitch : ' + str(self.dstPitch)] - except ValueError: - str_list += ['dstPitch : '] - try: - str_list += ['WidthInBytes : ' + str(self.WidthInBytes)] + str_list += ['p2pToken : ' + str(self.p2pToken)] except ValueError: - str_list += ['WidthInBytes : '] + str_list += ['p2pToken : '] + + try: - str_list += ['Height : ' + str(self.Height)] + str_list += ['vaSpaceToken : ' + str(self.vaSpaceToken)] except ValueError: - str_list += ['Height : '] + str_list += ['vaSpaceToken : '] + return '\n'.join(str_list) else: return '' - @property - def srcXInBytes(self): - return self._ptr[0].srcXInBytes - @srcXInBytes.setter - def srcXInBytes(self, size_t srcXInBytes): - self._ptr[0].srcXInBytes = srcXInBytes - @property - def srcY(self): - return self._ptr[0].srcY - @srcY.setter - def srcY(self, size_t srcY): - self._ptr[0].srcY = srcY - @property - def srcMemoryType(self): - return CUmemorytype(self._ptr[0].srcMemoryType) - @srcMemoryType.setter - def srcMemoryType(self, srcMemoryType not None : CUmemorytype): - self._ptr[0].srcMemoryType = srcMemoryType.value - @property - def srcHost(self): - return self._ptr[0].srcHost - @srcHost.setter - def srcHost(self, srcHost): - _csrcHost = utils.HelperInputVoidPtr(srcHost) - self._ptr[0].srcHost = _csrcHost.cptr - @property - def srcDevice(self): - return self._srcDevice - @srcDevice.setter - def srcDevice(self, srcDevice): - cdef ccuda.CUdeviceptr csrcDevice - if srcDevice is None: - csrcDevice = 0 - elif isinstance(srcDevice, (CUdeviceptr)): - psrcDevice = int(srcDevice) - csrcDevice = psrcDevice - else: - psrcDevice = int(CUdeviceptr(srcDevice)) - csrcDevice = psrcDevice - self._srcDevice._ptr[0] = csrcDevice @property - def srcArray(self): - return self._srcArray - @srcArray.setter - def srcArray(self, srcArray): - cdef ccuda.CUarray csrcArray - if srcArray is None: - csrcArray = 0 - elif isinstance(srcArray, (CUarray,)): - psrcArray = int(srcArray) - csrcArray = psrcArray - else: - psrcArray = int(CUarray(srcArray)) - csrcArray = psrcArray - self._srcArray._ptr[0] = csrcArray - @property - def srcPitch(self): - return self._ptr[0].srcPitch - @srcPitch.setter - def srcPitch(self, size_t srcPitch): - self._ptr[0].srcPitch = srcPitch - @property - def dstXInBytes(self): - return self._ptr[0].dstXInBytes - @dstXInBytes.setter - def dstXInBytes(self, size_t dstXInBytes): - self._ptr[0].dstXInBytes = dstXInBytes - @property - def dstY(self): - return self._ptr[0].dstY - @dstY.setter - def dstY(self, size_t dstY): - self._ptr[0].dstY = dstY - @property - def dstMemoryType(self): - return CUmemorytype(self._ptr[0].dstMemoryType) - @dstMemoryType.setter - def dstMemoryType(self, dstMemoryType not None : CUmemorytype): - self._ptr[0].dstMemoryType = dstMemoryType.value - @property - def dstHost(self): - return self._ptr[0].dstHost - @dstHost.setter - def dstHost(self, dstHost): - _cdstHost = utils.HelperInputVoidPtr(dstHost) - self._ptr[0].dstHost = _cdstHost.cptr - @property - def dstDevice(self): - return self._dstDevice - @dstDevice.setter - def dstDevice(self, dstDevice): - cdef ccuda.CUdeviceptr cdstDevice - if dstDevice is None: - cdstDevice = 0 - elif isinstance(dstDevice, (CUdeviceptr)): - pdstDevice = int(dstDevice) - cdstDevice = pdstDevice - else: - pdstDevice = int(CUdeviceptr(dstDevice)) - cdstDevice = pdstDevice - self._dstDevice._ptr[0] = cdstDevice + def p2pToken(self): + return self._pvt_ptr[0].p2pToken + @p2pToken.setter + def p2pToken(self, unsigned long long p2pToken): + self._pvt_ptr[0].p2pToken = p2pToken + @property - def dstArray(self): - return self._dstArray - @dstArray.setter - def dstArray(self, dstArray): - cdef ccuda.CUarray cdstArray - if dstArray is None: - cdstArray = 0 - elif isinstance(dstArray, (CUarray,)): - pdstArray = int(dstArray) - cdstArray = pdstArray - else: - pdstArray = int(CUarray(dstArray)) - cdstArray = pdstArray - self._dstArray._ptr[0] = cdstArray - @property - def dstPitch(self): - return self._ptr[0].dstPitch - @dstPitch.setter - def dstPitch(self, size_t dstPitch): - self._ptr[0].dstPitch = dstPitch - @property - def WidthInBytes(self): - return self._ptr[0].WidthInBytes - @WidthInBytes.setter - def WidthInBytes(self, size_t WidthInBytes): - self._ptr[0].WidthInBytes = WidthInBytes - @property - def Height(self): - return self._ptr[0].Height - @Height.setter - def Height(self, size_t Height): - self._ptr[0].Height = Height -{{endif}} -{{if 'struct CUDA_MEMCPY3D_st' in found_types}} + def vaSpaceToken(self): + return self._pvt_ptr[0].vaSpaceToken + @vaSpaceToken.setter + def vaSpaceToken(self, unsigned int vaSpaceToken): + self._pvt_ptr[0].vaSpaceToken = vaSpaceToken -cdef class CUDA_MEMCPY3D_st: + +cdef class CUDA_LAUNCH_PARAMS_st: """ - 3D memory copy parameters + Kernel launch parameters + + Attributes + ---------- + + function : CUfunction + Kernel to launch + + + gridDimX : unsigned int + Width of grid in blocks + + + gridDimY : unsigned int + Height of grid in blocks + + + gridDimZ : unsigned int + Depth of grid in blocks + + + blockDimX : unsigned int + X dimension of each thread block + + + blockDimY : unsigned int + Y dimension of each thread block + + + blockDimZ : unsigned int + Z dimension of each thread block + + + sharedMemBytes : unsigned int + Dynamic shared-memory size per thread block in bytes + + + hStream : CUstream + Stream identifier + + + kernelParams : Any + Array of pointers to kernel parameters - Attributes - ---------- - srcXInBytes : size_t - Source X in bytes - srcY : size_t - Source Y - srcZ : size_t - Source Z - srcLOD : size_t - Source LOD - srcMemoryType : CUmemorytype - Source memory type (host, device, array) - srcHost : Any - Source host pointer - srcDevice : CUdeviceptr - Source device pointer - srcArray : CUarray - Source array reference - reserved0 : Any - Must be NULL - srcPitch : size_t - Source pitch (ignored when src is array) - srcHeight : size_t - Source height (ignored when src is array; may be 0 if Depth==1) - dstXInBytes : size_t - Destination X in bytes - dstY : size_t - Destination Y - dstZ : size_t - Destination Z - dstLOD : size_t - Destination LOD - dstMemoryType : CUmemorytype - Destination memory type (host, device, array) - dstHost : Any - Destination host pointer - dstDevice : CUdeviceptr - Destination device pointer - dstArray : CUarray - Destination array reference - reserved1 : Any - Must be NULL - dstPitch : size_t - Destination pitch (ignored when dst is array) - dstHeight : size_t - Destination height (ignored when dst is array; may be 0 if - Depth==1) - WidthInBytes : size_t - Width of 3D memory copy in bytes - Height : size_t - Height of 3D memory copy - Depth : size_t - Depth of 3D memory copy Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - self._srcDevice = CUdeviceptr(_ptr=&self._ptr[0].srcDevice) - self._srcArray = CUarray(_ptr=&self._ptr[0].srcArray) - self._dstDevice = CUdeviceptr(_ptr=&self._ptr[0].dstDevice) - self._dstArray = CUarray(_ptr=&self._ptr[0].dstArray) + pass + + self._function = CUfunction(_ptr=&self._pvt_ptr[0].function) + + + self._hStream = CUstream(_ptr=&self._pvt_ptr[0].hStream) + def __dealloc__(self): pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['srcXInBytes : ' + str(self.srcXInBytes)] - except ValueError: - str_list += ['srcXInBytes : '] - try: - str_list += ['srcY : ' + str(self.srcY)] - except ValueError: - str_list += ['srcY : '] - try: - str_list += ['srcZ : ' + str(self.srcZ)] - except ValueError: - str_list += ['srcZ : '] - try: - str_list += ['srcLOD : ' + str(self.srcLOD)] - except ValueError: - str_list += ['srcLOD : '] - try: - str_list += ['srcMemoryType : ' + str(self.srcMemoryType)] - except ValueError: - str_list += ['srcMemoryType : '] - try: - str_list += ['srcHost : ' + hex(self.srcHost)] - except ValueError: - str_list += ['srcHost : '] - try: - str_list += ['srcDevice : ' + str(self.srcDevice)] - except ValueError: - str_list += ['srcDevice : '] - try: - str_list += ['srcArray : ' + str(self.srcArray)] - except ValueError: - str_list += ['srcArray : '] - try: - str_list += ['reserved0 : ' + hex(self.reserved0)] - except ValueError: - str_list += ['reserved0 : '] - try: - str_list += ['srcPitch : ' + str(self.srcPitch)] - except ValueError: - str_list += ['srcPitch : '] - try: - str_list += ['srcHeight : ' + str(self.srcHeight)] - except ValueError: - str_list += ['srcHeight : '] - try: - str_list += ['dstXInBytes : ' + str(self.dstXInBytes)] - except ValueError: - str_list += ['dstXInBytes : '] - try: - str_list += ['dstY : ' + str(self.dstY)] - except ValueError: - str_list += ['dstY : '] - try: - str_list += ['dstZ : ' + str(self.dstZ)] - except ValueError: - str_list += ['dstZ : '] - try: - str_list += ['dstLOD : ' + str(self.dstLOD)] - except ValueError: - str_list += ['dstLOD : '] - try: - str_list += ['dstMemoryType : ' + str(self.dstMemoryType)] + str_list += ['function : ' + str(self.function)] except ValueError: - str_list += ['dstMemoryType : '] + str_list += ['function : '] + + try: - str_list += ['dstHost : ' + hex(self.dstHost)] + str_list += ['gridDimX : ' + str(self.gridDimX)] except ValueError: - str_list += ['dstHost : '] + str_list += ['gridDimX : '] + + try: - str_list += ['dstDevice : ' + str(self.dstDevice)] + str_list += ['gridDimY : ' + str(self.gridDimY)] except ValueError: - str_list += ['dstDevice : '] + str_list += ['gridDimY : '] + + try: - str_list += ['dstArray : ' + str(self.dstArray)] + str_list += ['gridDimZ : ' + str(self.gridDimZ)] except ValueError: - str_list += ['dstArray : '] + str_list += ['gridDimZ : '] + + try: - str_list += ['reserved1 : ' + hex(self.reserved1)] + str_list += ['blockDimX : ' + str(self.blockDimX)] except ValueError: - str_list += ['reserved1 : '] + str_list += ['blockDimX : '] + + try: - str_list += ['dstPitch : ' + str(self.dstPitch)] + str_list += ['blockDimY : ' + str(self.blockDimY)] except ValueError: - str_list += ['dstPitch : '] + str_list += ['blockDimY : '] + + try: - str_list += ['dstHeight : ' + str(self.dstHeight)] + str_list += ['blockDimZ : ' + str(self.blockDimZ)] except ValueError: - str_list += ['dstHeight : '] + str_list += ['blockDimZ : '] + + try: - str_list += ['WidthInBytes : ' + str(self.WidthInBytes)] + str_list += ['sharedMemBytes : ' + str(self.sharedMemBytes)] except ValueError: - str_list += ['WidthInBytes : '] + str_list += ['sharedMemBytes : '] + + try: - str_list += ['Height : ' + str(self.Height)] + str_list += ['hStream : ' + str(self.hStream)] except ValueError: - str_list += ['Height : '] + str_list += ['hStream : '] + + try: - str_list += ['Depth : ' + str(self.Depth)] + str_list += ['kernelParams : ' + str(self.kernelParams)] except ValueError: - str_list += ['Depth : '] + str_list += ['kernelParams : '] + return '\n'.join(str_list) else: return '' + @property - def srcXInBytes(self): - return self._ptr[0].srcXInBytes - @srcXInBytes.setter - def srcXInBytes(self, size_t srcXInBytes): - self._ptr[0].srcXInBytes = srcXInBytes - @property - def srcY(self): - return self._ptr[0].srcY - @srcY.setter - def srcY(self, size_t srcY): - self._ptr[0].srcY = srcY - @property - def srcZ(self): - return self._ptr[0].srcZ - @srcZ.setter - def srcZ(self, size_t srcZ): - self._ptr[0].srcZ = srcZ - @property - def srcLOD(self): - return self._ptr[0].srcLOD - @srcLOD.setter - def srcLOD(self, size_t srcLOD): - self._ptr[0].srcLOD = srcLOD - @property - def srcMemoryType(self): - return CUmemorytype(self._ptr[0].srcMemoryType) - @srcMemoryType.setter - def srcMemoryType(self, srcMemoryType not None : CUmemorytype): - self._ptr[0].srcMemoryType = srcMemoryType.value - @property - def srcHost(self): - return self._ptr[0].srcHost - @srcHost.setter - def srcHost(self, srcHost): - _csrcHost = utils.HelperInputVoidPtr(srcHost) - self._ptr[0].srcHost = _csrcHost.cptr - @property - def srcDevice(self): - return self._srcDevice - @srcDevice.setter - def srcDevice(self, srcDevice): - cdef ccuda.CUdeviceptr csrcDevice - if srcDevice is None: - csrcDevice = 0 - elif isinstance(srcDevice, (CUdeviceptr)): - psrcDevice = int(srcDevice) - csrcDevice = psrcDevice + def function(self): + return self._function + @function.setter + def function(self, function): + cdef cydriver.CUfunction cyfunction + if function is None: + cyfunction = 0 + elif isinstance(function, (CUfunction,)): + pfunction = int(function) + cyfunction = pfunction else: - psrcDevice = int(CUdeviceptr(srcDevice)) - csrcDevice = psrcDevice - self._srcDevice._ptr[0] = csrcDevice + pfunction = int(CUfunction(function)) + cyfunction = pfunction + self._function._pvt_ptr[0] = cyfunction + @property - def srcArray(self): - return self._srcArray - @srcArray.setter - def srcArray(self, srcArray): - cdef ccuda.CUarray csrcArray - if srcArray is None: - csrcArray = 0 - elif isinstance(srcArray, (CUarray,)): - psrcArray = int(srcArray) - csrcArray = psrcArray - else: - psrcArray = int(CUarray(srcArray)) - csrcArray = psrcArray - self._srcArray._ptr[0] = csrcArray + def gridDimX(self): + return self._pvt_ptr[0].gridDimX + @gridDimX.setter + def gridDimX(self, unsigned int gridDimX): + self._pvt_ptr[0].gridDimX = gridDimX + + @property - def reserved0(self): - return self._ptr[0].reserved0 - @reserved0.setter - def reserved0(self, reserved0): - _creserved0 = utils.HelperInputVoidPtr(reserved0) - self._ptr[0].reserved0 = _creserved0.cptr + def gridDimY(self): + return self._pvt_ptr[0].gridDimY + @gridDimY.setter + def gridDimY(self, unsigned int gridDimY): + self._pvt_ptr[0].gridDimY = gridDimY + + @property - def srcPitch(self): - return self._ptr[0].srcPitch - @srcPitch.setter - def srcPitch(self, size_t srcPitch): - self._ptr[0].srcPitch = srcPitch + def gridDimZ(self): + return self._pvt_ptr[0].gridDimZ + @gridDimZ.setter + def gridDimZ(self, unsigned int gridDimZ): + self._pvt_ptr[0].gridDimZ = gridDimZ + + @property - def srcHeight(self): - return self._ptr[0].srcHeight - @srcHeight.setter - def srcHeight(self, size_t srcHeight): - self._ptr[0].srcHeight = srcHeight + def blockDimX(self): + return self._pvt_ptr[0].blockDimX + @blockDimX.setter + def blockDimX(self, unsigned int blockDimX): + self._pvt_ptr[0].blockDimX = blockDimX + + @property - def dstXInBytes(self): - return self._ptr[0].dstXInBytes - @dstXInBytes.setter - def dstXInBytes(self, size_t dstXInBytes): - self._ptr[0].dstXInBytes = dstXInBytes + def blockDimY(self): + return self._pvt_ptr[0].blockDimY + @blockDimY.setter + def blockDimY(self, unsigned int blockDimY): + self._pvt_ptr[0].blockDimY = blockDimY + + @property - def dstY(self): - return self._ptr[0].dstY - @dstY.setter - def dstY(self, size_t dstY): - self._ptr[0].dstY = dstY + def blockDimZ(self): + return self._pvt_ptr[0].blockDimZ + @blockDimZ.setter + def blockDimZ(self, unsigned int blockDimZ): + self._pvt_ptr[0].blockDimZ = blockDimZ + + @property - def dstZ(self): - return self._ptr[0].dstZ - @dstZ.setter - def dstZ(self, size_t dstZ): - self._ptr[0].dstZ = dstZ + def sharedMemBytes(self): + return self._pvt_ptr[0].sharedMemBytes + @sharedMemBytes.setter + def sharedMemBytes(self, unsigned int sharedMemBytes): + self._pvt_ptr[0].sharedMemBytes = sharedMemBytes + + @property - def dstLOD(self): - return self._ptr[0].dstLOD - @dstLOD.setter - def dstLOD(self, size_t dstLOD): - self._ptr[0].dstLOD = dstLOD + def hStream(self): + return self._hStream + @hStream.setter + def hStream(self, hStream): + cdef cydriver.CUstream cyhStream + if hStream is None: + cyhStream = 0 + elif isinstance(hStream, (CUstream,)): + phStream = int(hStream) + cyhStream = phStream + else: + phStream = int(CUstream(hStream)) + cyhStream = phStream + self._hStream._pvt_ptr[0] = cyhStream + + @property - def dstMemoryType(self): - return CUmemorytype(self._ptr[0].dstMemoryType) - @dstMemoryType.setter - def dstMemoryType(self, dstMemoryType not None : CUmemorytype): - self._ptr[0].dstMemoryType = dstMemoryType.value + def kernelParams(self): + return self._pvt_ptr[0].kernelParams + @kernelParams.setter + def kernelParams(self, kernelParams): + self._cykernelParams = _HelperKernelParams(kernelParams) + self._pvt_ptr[0].kernelParams = self._cykernelParams.ckernelParams + + +cdef class anon_struct12: + """ + Attributes + ---------- + + handle : Any + + + + name : Any + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr): + self._pvt_ptr = _ptr + + def __init__(self, void_ptr _ptr): + pass + def __dealloc__(self): + pass + def getPtr(self): + return &self._pvt_ptr[0].handle.win32 + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['handle : ' + hex(self.handle)] + except ValueError: + str_list += ['handle : '] + + + try: + str_list += ['name : ' + hex(self.name)] + except ValueError: + str_list += ['name : '] + + return '\n'.join(str_list) + else: + return '' + @property - def dstHost(self): - return self._ptr[0].dstHost - @dstHost.setter - def dstHost(self, dstHost): - _cdstHost = utils.HelperInputVoidPtr(dstHost) - self._ptr[0].dstHost = _cdstHost.cptr + def handle(self): + return self._pvt_ptr[0].handle.win32.handle + @handle.setter + def handle(self, handle): + self._cyhandle = _HelperInputVoidPtr(handle) + self._pvt_ptr[0].handle.win32.handle = self._cyhandle.cptr + + @property - def dstDevice(self): - return self._dstDevice - @dstDevice.setter - def dstDevice(self, dstDevice): - cdef ccuda.CUdeviceptr cdstDevice - if dstDevice is None: - cdstDevice = 0 - elif isinstance(dstDevice, (CUdeviceptr)): - pdstDevice = int(dstDevice) - cdstDevice = pdstDevice + def name(self): + return self._pvt_ptr[0].handle.win32.name + @name.setter + def name(self, name): + self._cyname = _HelperInputVoidPtr(name) + self._pvt_ptr[0].handle.win32.name = self._cyname.cptr + + +cdef class anon_union5: + """ + Attributes + ---------- + + fd : int + + + + win32 : anon_struct12 + + + + nvSciBufObject : Any + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr): + self._pvt_ptr = _ptr + + def __init__(self, void_ptr _ptr): + pass + + self._win32 = anon_struct12(_ptr=self._pvt_ptr) + + def __dealloc__(self): + pass + def getPtr(self): + return &self._pvt_ptr[0].handle + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['fd : ' + str(self.fd)] + except ValueError: + str_list += ['fd : '] + + + try: + str_list += ['win32 :\n' + '\n'.join([' ' + line for line in str(self.win32).splitlines()])] + except ValueError: + str_list += ['win32 : '] + + + try: + str_list += ['nvSciBufObject : ' + hex(self.nvSciBufObject)] + except ValueError: + str_list += ['nvSciBufObject : '] + + return '\n'.join(str_list) else: - pdstDevice = int(CUdeviceptr(dstDevice)) - cdstDevice = pdstDevice - self._dstDevice._ptr[0] = cdstDevice + return '' @property - def dstArray(self): - return self._dstArray - @dstArray.setter - def dstArray(self, dstArray): - cdef ccuda.CUarray cdstArray - if dstArray is None: - cdstArray = 0 - elif isinstance(dstArray, (CUarray,)): - pdstArray = int(dstArray) - cdstArray = pdstArray - else: - pdstArray = int(CUarray(dstArray)) - cdstArray = pdstArray - self._dstArray._ptr[0] = cdstArray + def fd(self): + return self._pvt_ptr[0].handle.fd + @fd.setter + def fd(self, int fd): + self._pvt_ptr[0].handle.fd = fd + + @property - def reserved1(self): - return self._ptr[0].reserved1 - @reserved1.setter - def reserved1(self, reserved1): - _creserved1 = utils.HelperInputVoidPtr(reserved1) - self._ptr[0].reserved1 = _creserved1.cptr + def win32(self): + return self._win32 + @win32.setter + def win32(self, win32 not None : anon_struct12): + string.memcpy(&self._pvt_ptr[0].handle.win32, win32.getPtr(), sizeof(self._pvt_ptr[0].handle.win32)) + + + @property + def nvSciBufObject(self): + return self._pvt_ptr[0].handle.nvSciBufObject + @nvSciBufObject.setter + def nvSciBufObject(self, nvSciBufObject): + self._cynvSciBufObject = _HelperInputVoidPtr(nvSciBufObject) + self._pvt_ptr[0].handle.nvSciBufObject = self._cynvSciBufObject.cptr + + +cdef class CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st: + """ + External memory handle descriptor + + Attributes + ---------- + + type : CUexternalMemoryHandleType + Type of the handle + + + handle : anon_union5 + + + + size : unsigned long long + Size of the memory allocation + + + flags : unsigned int + Flags must either be zero or CUDA_EXTERNAL_MEMORY_DEDICATED + + + reserved : list[unsigned int] + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._val_ptr = calloc(1, sizeof(cydriver.CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st)) + self._pvt_ptr = self._val_ptr + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass + + self._handle = anon_union5(_ptr=self._pvt_ptr) + + def __dealloc__(self): + if self._val_ptr is not NULL: + free(self._val_ptr) + def getPtr(self): + return self._pvt_ptr + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['type : ' + str(self.type)] + except ValueError: + str_list += ['type : '] + + + try: + str_list += ['handle :\n' + '\n'.join([' ' + line for line in str(self.handle).splitlines()])] + except ValueError: + str_list += ['handle : '] + + + try: + str_list += ['size : ' + str(self.size)] + except ValueError: + str_list += ['size : '] + + + try: + str_list += ['flags : ' + str(self.flags)] + except ValueError: + str_list += ['flags : '] + + + try: + str_list += ['reserved : ' + str(self.reserved)] + except ValueError: + str_list += ['reserved : '] + + return '\n'.join(str_list) + else: + return '' + @property - def dstPitch(self): - return self._ptr[0].dstPitch - @dstPitch.setter - def dstPitch(self, size_t dstPitch): - self._ptr[0].dstPitch = dstPitch + def type(self): + return CUexternalMemoryHandleType(self._pvt_ptr[0].type) + @type.setter + def type(self, type not None : CUexternalMemoryHandleType): + self._pvt_ptr[0].type = int(type) + + @property - def dstHeight(self): - return self._ptr[0].dstHeight - @dstHeight.setter - def dstHeight(self, size_t dstHeight): - self._ptr[0].dstHeight = dstHeight + def handle(self): + return self._handle + @handle.setter + def handle(self, handle not None : anon_union5): + string.memcpy(&self._pvt_ptr[0].handle, handle.getPtr(), sizeof(self._pvt_ptr[0].handle)) + + @property - def WidthInBytes(self): - return self._ptr[0].WidthInBytes - @WidthInBytes.setter - def WidthInBytes(self, size_t WidthInBytes): - self._ptr[0].WidthInBytes = WidthInBytes + def size(self): + return self._pvt_ptr[0].size + @size.setter + def size(self, unsigned long long size): + self._pvt_ptr[0].size = size + + @property - def Height(self): - return self._ptr[0].Height - @Height.setter - def Height(self, size_t Height): - self._ptr[0].Height = Height + def flags(self): + return self._pvt_ptr[0].flags + @flags.setter + def flags(self, unsigned int flags): + self._pvt_ptr[0].flags = flags + + @property - def Depth(self): - return self._ptr[0].Depth - @Depth.setter - def Depth(self, size_t Depth): - self._ptr[0].Depth = Depth -{{endif}} -{{if 'struct CUDA_MEMCPY3D_PEER_st' in found_types}} + def reserved(self): + return self._pvt_ptr[0].reserved + @reserved.setter + def reserved(self, reserved): + self._pvt_ptr[0].reserved = reserved -cdef class CUDA_MEMCPY3D_PEER_st: + +cdef class CUDA_EXTERNAL_MEMORY_BUFFER_DESC_st: """ - 3D memory cross-context copy parameters + External memory buffer descriptor Attributes ---------- - srcXInBytes : size_t - Source X in bytes - srcY : size_t - Source Y - srcZ : size_t - Source Z - srcLOD : size_t - Source LOD - srcMemoryType : CUmemorytype - Source memory type (host, device, array) - srcHost : Any - Source host pointer - srcDevice : CUdeviceptr - Source device pointer - srcArray : CUarray - Source array reference - srcContext : CUcontext - Source context (ignored with srcMemoryType is CU_MEMORYTYPE_ARRAY) - srcPitch : size_t - Source pitch (ignored when src is array) - srcHeight : size_t - Source height (ignored when src is array; may be 0 if Depth==1) - dstXInBytes : size_t - Destination X in bytes - dstY : size_t - Destination Y - dstZ : size_t - Destination Z - dstLOD : size_t - Destination LOD - dstMemoryType : CUmemorytype - Destination memory type (host, device, array) - dstHost : Any - Destination host pointer - dstDevice : CUdeviceptr - Destination device pointer - dstArray : CUarray - Destination array reference - dstContext : CUcontext - Destination context (ignored with dstMemoryType is - CU_MEMORYTYPE_ARRAY) - dstPitch : size_t - Destination pitch (ignored when dst is array) - dstHeight : size_t - Destination height (ignored when dst is array; may be 0 if - Depth==1) - WidthInBytes : size_t - Width of 3D memory copy in bytes - Height : size_t - Height of 3D memory copy - Depth : size_t - Depth of 3D memory copy + + offset : unsigned long long + Offset into the memory object where the buffer's base is + + + size : unsigned long long + Size of the buffer + + + flags : unsigned int + Flags reserved for future use. Must be zero. + + + reserved : list[unsigned int] + + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - self._srcDevice = CUdeviceptr(_ptr=&self._ptr[0].srcDevice) - self._srcArray = CUarray(_ptr=&self._ptr[0].srcArray) - self._srcContext = CUcontext(_ptr=&self._ptr[0].srcContext) - self._dstDevice = CUdeviceptr(_ptr=&self._ptr[0].dstDevice) - self._dstArray = CUarray(_ptr=&self._ptr[0].dstArray) - self._dstContext = CUcontext(_ptr=&self._ptr[0].dstContext) + pass def __dealloc__(self): pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['srcXInBytes : ' + str(self.srcXInBytes)] - except ValueError: - str_list += ['srcXInBytes : '] - try: - str_list += ['srcY : ' + str(self.srcY)] - except ValueError: - str_list += ['srcY : '] - try: - str_list += ['srcZ : ' + str(self.srcZ)] - except ValueError: - str_list += ['srcZ : '] - try: - str_list += ['srcLOD : ' + str(self.srcLOD)] - except ValueError: - str_list += ['srcLOD : '] - try: - str_list += ['srcMemoryType : ' + str(self.srcMemoryType)] - except ValueError: - str_list += ['srcMemoryType : '] - try: - str_list += ['srcHost : ' + hex(self.srcHost)] - except ValueError: - str_list += ['srcHost : '] - try: - str_list += ['srcDevice : ' + str(self.srcDevice)] - except ValueError: - str_list += ['srcDevice : '] - try: - str_list += ['srcArray : ' + str(self.srcArray)] - except ValueError: - str_list += ['srcArray : '] - try: - str_list += ['srcContext : ' + str(self.srcContext)] - except ValueError: - str_list += ['srcContext : '] - try: - str_list += ['srcPitch : ' + str(self.srcPitch)] - except ValueError: - str_list += ['srcPitch : '] - try: - str_list += ['srcHeight : ' + str(self.srcHeight)] - except ValueError: - str_list += ['srcHeight : '] - try: - str_list += ['dstXInBytes : ' + str(self.dstXInBytes)] - except ValueError: - str_list += ['dstXInBytes : '] - try: - str_list += ['dstY : ' + str(self.dstY)] - except ValueError: - str_list += ['dstY : '] - try: - str_list += ['dstZ : ' + str(self.dstZ)] - except ValueError: - str_list += ['dstZ : '] - try: - str_list += ['dstLOD : ' + str(self.dstLOD)] - except ValueError: - str_list += ['dstLOD : '] - try: - str_list += ['dstMemoryType : ' + str(self.dstMemoryType)] - except ValueError: - str_list += ['dstMemoryType : '] - try: - str_list += ['dstHost : ' + hex(self.dstHost)] - except ValueError: - str_list += ['dstHost : '] - try: - str_list += ['dstDevice : ' + str(self.dstDevice)] + str_list += ['offset : ' + str(self.offset)] except ValueError: - str_list += ['dstDevice : '] + str_list += ['offset : '] + + try: - str_list += ['dstArray : ' + str(self.dstArray)] + str_list += ['size : ' + str(self.size)] except ValueError: - str_list += ['dstArray : '] + str_list += ['size : '] + + try: - str_list += ['dstContext : ' + str(self.dstContext)] + str_list += ['flags : ' + str(self.flags)] except ValueError: - str_list += ['dstContext : '] + str_list += ['flags : '] + + try: - str_list += ['dstPitch : ' + str(self.dstPitch)] + str_list += ['reserved : ' + str(self.reserved)] except ValueError: - str_list += ['dstPitch : '] + str_list += ['reserved : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def offset(self): + return self._pvt_ptr[0].offset + @offset.setter + def offset(self, unsigned long long offset): + self._pvt_ptr[0].offset = offset + + + @property + def size(self): + return self._pvt_ptr[0].size + @size.setter + def size(self, unsigned long long size): + self._pvt_ptr[0].size = size + + + @property + def flags(self): + return self._pvt_ptr[0].flags + @flags.setter + def flags(self, unsigned int flags): + self._pvt_ptr[0].flags = flags + + + @property + def reserved(self): + return self._pvt_ptr[0].reserved + @reserved.setter + def reserved(self, reserved): + self._pvt_ptr[0].reserved = reserved + + +cdef class CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_st: + """ + External memory mipmap descriptor + + Attributes + ---------- + + offset : unsigned long long + Offset into the memory object where the base level of the mipmap + chain is. + + + arrayDesc : CUDA_ARRAY3D_DESCRIPTOR + Format, dimension and type of base level of the mipmap chain + + + numLevels : unsigned int + Total number of levels in the mipmap chain + + + reserved : list[unsigned int] + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass + + self._arrayDesc = CUDA_ARRAY3D_DESCRIPTOR(_ptr=&self._pvt_ptr[0].arrayDesc) + + def __dealloc__(self): + pass + def getPtr(self): + return self._pvt_ptr + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + try: - str_list += ['dstHeight : ' + str(self.dstHeight)] + str_list += ['offset : ' + str(self.offset)] except ValueError: - str_list += ['dstHeight : '] + str_list += ['offset : '] + + try: - str_list += ['WidthInBytes : ' + str(self.WidthInBytes)] + str_list += ['arrayDesc :\n' + '\n'.join([' ' + line for line in str(self.arrayDesc).splitlines()])] except ValueError: - str_list += ['WidthInBytes : '] + str_list += ['arrayDesc : '] + + try: - str_list += ['Height : ' + str(self.Height)] + str_list += ['numLevels : ' + str(self.numLevels)] except ValueError: - str_list += ['Height : '] + str_list += ['numLevels : '] + + try: - str_list += ['Depth : ' + str(self.Depth)] + str_list += ['reserved : ' + str(self.reserved)] except ValueError: - str_list += ['Depth : '] + str_list += ['reserved : '] + return '\n'.join(str_list) else: return '' + @property - def srcXInBytes(self): - return self._ptr[0].srcXInBytes - @srcXInBytes.setter - def srcXInBytes(self, size_t srcXInBytes): - self._ptr[0].srcXInBytes = srcXInBytes - @property - def srcY(self): - return self._ptr[0].srcY - @srcY.setter - def srcY(self, size_t srcY): - self._ptr[0].srcY = srcY - @property - def srcZ(self): - return self._ptr[0].srcZ - @srcZ.setter - def srcZ(self, size_t srcZ): - self._ptr[0].srcZ = srcZ - @property - def srcLOD(self): - return self._ptr[0].srcLOD - @srcLOD.setter - def srcLOD(self, size_t srcLOD): - self._ptr[0].srcLOD = srcLOD - @property - def srcMemoryType(self): - return CUmemorytype(self._ptr[0].srcMemoryType) - @srcMemoryType.setter - def srcMemoryType(self, srcMemoryType not None : CUmemorytype): - self._ptr[0].srcMemoryType = srcMemoryType.value - @property - def srcHost(self): - return self._ptr[0].srcHost - @srcHost.setter - def srcHost(self, srcHost): - _csrcHost = utils.HelperInputVoidPtr(srcHost) - self._ptr[0].srcHost = _csrcHost.cptr + def offset(self): + return self._pvt_ptr[0].offset + @offset.setter + def offset(self, unsigned long long offset): + self._pvt_ptr[0].offset = offset + + @property - def srcDevice(self): - return self._srcDevice - @srcDevice.setter - def srcDevice(self, srcDevice): - cdef ccuda.CUdeviceptr csrcDevice - if srcDevice is None: - csrcDevice = 0 - elif isinstance(srcDevice, (CUdeviceptr)): - psrcDevice = int(srcDevice) - csrcDevice = psrcDevice - else: - psrcDevice = int(CUdeviceptr(srcDevice)) - csrcDevice = psrcDevice - self._srcDevice._ptr[0] = csrcDevice + def arrayDesc(self): + return self._arrayDesc + @arrayDesc.setter + def arrayDesc(self, arrayDesc not None : CUDA_ARRAY3D_DESCRIPTOR): + string.memcpy(&self._pvt_ptr[0].arrayDesc, arrayDesc.getPtr(), sizeof(self._pvt_ptr[0].arrayDesc)) + @property - def srcArray(self): - return self._srcArray - @srcArray.setter - def srcArray(self, srcArray): - cdef ccuda.CUarray csrcArray - if srcArray is None: - csrcArray = 0 - elif isinstance(srcArray, (CUarray,)): - psrcArray = int(srcArray) - csrcArray = psrcArray - else: - psrcArray = int(CUarray(srcArray)) - csrcArray = psrcArray - self._srcArray._ptr[0] = csrcArray + def numLevels(self): + return self._pvt_ptr[0].numLevels + @numLevels.setter + def numLevels(self, unsigned int numLevels): + self._pvt_ptr[0].numLevels = numLevels + + @property - def srcContext(self): - return self._srcContext - @srcContext.setter - def srcContext(self, srcContext): - cdef ccuda.CUcontext csrcContext - if srcContext is None: - csrcContext = 0 - elif isinstance(srcContext, (CUcontext,)): - psrcContext = int(srcContext) - csrcContext = psrcContext + def reserved(self): + return self._pvt_ptr[0].reserved + @reserved.setter + def reserved(self, reserved): + self._pvt_ptr[0].reserved = reserved + + +cdef class anon_struct13: + """ + Attributes + ---------- + + handle : Any + + + + name : Any + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr): + self._pvt_ptr = _ptr + + def __init__(self, void_ptr _ptr): + pass + def __dealloc__(self): + pass + def getPtr(self): + return &self._pvt_ptr[0].handle.win32 + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['handle : ' + hex(self.handle)] + except ValueError: + str_list += ['handle : '] + + + try: + str_list += ['name : ' + hex(self.name)] + except ValueError: + str_list += ['name : '] + + return '\n'.join(str_list) else: - psrcContext = int(CUcontext(srcContext)) - csrcContext = psrcContext - self._srcContext._ptr[0] = csrcContext - @property - def srcPitch(self): - return self._ptr[0].srcPitch - @srcPitch.setter - def srcPitch(self, size_t srcPitch): - self._ptr[0].srcPitch = srcPitch - @property - def srcHeight(self): - return self._ptr[0].srcHeight - @srcHeight.setter - def srcHeight(self, size_t srcHeight): - self._ptr[0].srcHeight = srcHeight - @property - def dstXInBytes(self): - return self._ptr[0].dstXInBytes - @dstXInBytes.setter - def dstXInBytes(self, size_t dstXInBytes): - self._ptr[0].dstXInBytes = dstXInBytes - @property - def dstY(self): - return self._ptr[0].dstY - @dstY.setter - def dstY(self, size_t dstY): - self._ptr[0].dstY = dstY - @property - def dstZ(self): - return self._ptr[0].dstZ - @dstZ.setter - def dstZ(self, size_t dstZ): - self._ptr[0].dstZ = dstZ - @property - def dstLOD(self): - return self._ptr[0].dstLOD - @dstLOD.setter - def dstLOD(self, size_t dstLOD): - self._ptr[0].dstLOD = dstLOD - @property - def dstMemoryType(self): - return CUmemorytype(self._ptr[0].dstMemoryType) - @dstMemoryType.setter - def dstMemoryType(self, dstMemoryType not None : CUmemorytype): - self._ptr[0].dstMemoryType = dstMemoryType.value + return '' + @property - def dstHost(self): - return self._ptr[0].dstHost - @dstHost.setter - def dstHost(self, dstHost): - _cdstHost = utils.HelperInputVoidPtr(dstHost) - self._ptr[0].dstHost = _cdstHost.cptr + def handle(self): + return self._pvt_ptr[0].handle.win32.handle + @handle.setter + def handle(self, handle): + self._cyhandle = _HelperInputVoidPtr(handle) + self._pvt_ptr[0].handle.win32.handle = self._cyhandle.cptr + + @property - def dstDevice(self): - return self._dstDevice - @dstDevice.setter - def dstDevice(self, dstDevice): - cdef ccuda.CUdeviceptr cdstDevice - if dstDevice is None: - cdstDevice = 0 - elif isinstance(dstDevice, (CUdeviceptr)): - pdstDevice = int(dstDevice) - cdstDevice = pdstDevice - else: - pdstDevice = int(CUdeviceptr(dstDevice)) - cdstDevice = pdstDevice - self._dstDevice._ptr[0] = cdstDevice + def name(self): + return self._pvt_ptr[0].handle.win32.name + @name.setter + def name(self, name): + self._cyname = _HelperInputVoidPtr(name) + self._pvt_ptr[0].handle.win32.name = self._cyname.cptr + + +cdef class anon_union6: + """ + Attributes + ---------- + + fd : int + + + + win32 : anon_struct13 + + + + nvSciSyncObj : Any + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr): + self._pvt_ptr = _ptr + + def __init__(self, void_ptr _ptr): + pass + + self._win32 = anon_struct13(_ptr=self._pvt_ptr) + + def __dealloc__(self): + pass + def getPtr(self): + return &self._pvt_ptr[0].handle + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['fd : ' + str(self.fd)] + except ValueError: + str_list += ['fd : '] + + + try: + str_list += ['win32 :\n' + '\n'.join([' ' + line for line in str(self.win32).splitlines()])] + except ValueError: + str_list += ['win32 : '] + + + try: + str_list += ['nvSciSyncObj : ' + hex(self.nvSciSyncObj)] + except ValueError: + str_list += ['nvSciSyncObj : '] - @property - def dstArray(self): - return self._dstArray - @dstArray.setter - def dstArray(self, dstArray): - cdef ccuda.CUarray cdstArray - if dstArray is None: - cdstArray = 0 - elif isinstance(dstArray, (CUarray,)): - pdstArray = int(dstArray) - cdstArray = pdstArray - else: - pdstArray = int(CUarray(dstArray)) - cdstArray = pdstArray - self._dstArray._ptr[0] = cdstArray - @property - def dstContext(self): - return self._dstContext - @dstContext.setter - def dstContext(self, dstContext): - cdef ccuda.CUcontext cdstContext - if dstContext is None: - cdstContext = 0 - elif isinstance(dstContext, (CUcontext,)): - pdstContext = int(dstContext) - cdstContext = pdstContext + return '\n'.join(str_list) else: - pdstContext = int(CUcontext(dstContext)) - cdstContext = pdstContext - self._dstContext._ptr[0] = cdstContext - @property - def dstPitch(self): - return self._ptr[0].dstPitch - @dstPitch.setter - def dstPitch(self, size_t dstPitch): - self._ptr[0].dstPitch = dstPitch - @property - def dstHeight(self): - return self._ptr[0].dstHeight - @dstHeight.setter - def dstHeight(self, size_t dstHeight): - self._ptr[0].dstHeight = dstHeight + return '' + @property - def WidthInBytes(self): - return self._ptr[0].WidthInBytes - @WidthInBytes.setter - def WidthInBytes(self, size_t WidthInBytes): - self._ptr[0].WidthInBytes = WidthInBytes + def fd(self): + return self._pvt_ptr[0].handle.fd + @fd.setter + def fd(self, int fd): + self._pvt_ptr[0].handle.fd = fd + + @property - def Height(self): - return self._ptr[0].Height - @Height.setter - def Height(self, size_t Height): - self._ptr[0].Height = Height + def win32(self): + return self._win32 + @win32.setter + def win32(self, win32 not None : anon_struct13): + string.memcpy(&self._pvt_ptr[0].handle.win32, win32.getPtr(), sizeof(self._pvt_ptr[0].handle.win32)) + + @property - def Depth(self): - return self._ptr[0].Depth - @Depth.setter - def Depth(self, size_t Depth): - self._ptr[0].Depth = Depth -{{endif}} -{{if 'struct CUDA_MEMCPY_NODE_PARAMS_st' in found_types}} + def nvSciSyncObj(self): + return self._pvt_ptr[0].handle.nvSciSyncObj + @nvSciSyncObj.setter + def nvSciSyncObj(self, nvSciSyncObj): + self._cynvSciSyncObj = _HelperInputVoidPtr(nvSciSyncObj) + self._pvt_ptr[0].handle.nvSciSyncObj = self._cynvSciSyncObj.cptr -cdef class CUDA_MEMCPY_NODE_PARAMS_st: + +cdef class CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st: """ - Memcpy node parameters + External semaphore handle descriptor Attributes ---------- - flags : int - Must be zero - reserved : int - Must be zero - copyCtx : CUcontext - Context on which to run the node - copyParams : CUDA_MEMCPY3D - Parameters for the memory copy + + type : CUexternalSemaphoreHandleType + Type of the handle + + + handle : anon_union6 + + + + flags : unsigned int + Flags reserved for the future. Must be zero. + + + reserved : list[unsigned int] + + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._val_ptr = calloc(1, sizeof(cydriver.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st)) + self._pvt_ptr = self._val_ptr else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - self._copyCtx = CUcontext(_ptr=&self._ptr[0].copyCtx) - self._copyParams = CUDA_MEMCPY3D(_ptr=&self._ptr[0].copyParams) - def __dealloc__(self): pass + + self._handle = anon_union6(_ptr=self._pvt_ptr) + + def __dealloc__(self): + if self._val_ptr is not NULL: + free(self._val_ptr) def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['flags : ' + str(self.flags)] + str_list += ['type : ' + str(self.type)] except ValueError: - str_list += ['flags : '] + str_list += ['type : '] + + try: - str_list += ['reserved : ' + str(self.reserved)] + str_list += ['handle :\n' + '\n'.join([' ' + line for line in str(self.handle).splitlines()])] except ValueError: - str_list += ['reserved : '] + str_list += ['handle : '] + + try: - str_list += ['copyCtx : ' + str(self.copyCtx)] + str_list += ['flags : ' + str(self.flags)] except ValueError: - str_list += ['copyCtx : '] + str_list += ['flags : '] + + try: - str_list += ['copyParams :\n' + '\n'.join([' ' + line for line in str(self.copyParams).splitlines()])] + str_list += ['reserved : ' + str(self.reserved)] except ValueError: - str_list += ['copyParams : '] + str_list += ['reserved : '] + return '\n'.join(str_list) else: return '' + + @property + def type(self): + return CUexternalSemaphoreHandleType(self._pvt_ptr[0].type) + @type.setter + def type(self, type not None : CUexternalSemaphoreHandleType): + self._pvt_ptr[0].type = int(type) + + + @property + def handle(self): + return self._handle + @handle.setter + def handle(self, handle not None : anon_union6): + string.memcpy(&self._pvt_ptr[0].handle, handle.getPtr(), sizeof(self._pvt_ptr[0].handle)) + + @property def flags(self): - return self._ptr[0].flags + return self._pvt_ptr[0].flags @flags.setter - def flags(self, int flags): - self._ptr[0].flags = flags + def flags(self, unsigned int flags): + self._pvt_ptr[0].flags = flags + + @property def reserved(self): - return self._ptr[0].reserved + return self._pvt_ptr[0].reserved @reserved.setter - def reserved(self, int reserved): - self._ptr[0].reserved = reserved - @property - def copyCtx(self): - return self._copyCtx - @copyCtx.setter - def copyCtx(self, copyCtx): - cdef ccuda.CUcontext ccopyCtx - if copyCtx is None: - ccopyCtx = 0 - elif isinstance(copyCtx, (CUcontext,)): - pcopyCtx = int(copyCtx) - ccopyCtx = pcopyCtx - else: - pcopyCtx = int(CUcontext(copyCtx)) - ccopyCtx = pcopyCtx - self._copyCtx._ptr[0] = ccopyCtx - @property - def copyParams(self): - return self._copyParams - @copyParams.setter - def copyParams(self, copyParams not None : CUDA_MEMCPY3D): - string.memcpy(&self._ptr[0].copyParams, copyParams.getPtr(), sizeof(self._ptr[0].copyParams)) -{{endif}} -{{if 'struct CUDA_ARRAY_DESCRIPTOR_st' in found_types}} + def reserved(self, reserved): + self._pvt_ptr[0].reserved = reserved -cdef class CUDA_ARRAY_DESCRIPTOR_st: - """ - Array descriptor +cdef class anon_struct14: + """ Attributes ---------- - Width : size_t - Width of array - Height : size_t - Height of array - Format : CUarray_format - Array format - NumChannels : unsigned int - Channels per array element + + value : unsigned long long + + Methods ------- getPtr() Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - else: - self._ptr = _ptr - def __init__(self, void_ptr _ptr = 0): + def __cinit__(self, void_ptr _ptr): + self._pvt_ptr = _ptr + + def __init__(self, void_ptr _ptr): pass def __dealloc__(self): pass def getPtr(self): - return self._ptr + return &self._pvt_ptr[0].params.fence def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['Width : ' + str(self.Width)] - except ValueError: - str_list += ['Width : '] - try: - str_list += ['Height : ' + str(self.Height)] - except ValueError: - str_list += ['Height : '] - try: - str_list += ['Format : ' + str(self.Format)] - except ValueError: - str_list += ['Format : '] - try: - str_list += ['NumChannels : ' + str(self.NumChannels)] + str_list += ['value : ' + str(self.value)] except ValueError: - str_list += ['NumChannels : '] + str_list += ['value : '] + return '\n'.join(str_list) else: return '' + @property - def Width(self): - return self._ptr[0].Width - @Width.setter - def Width(self, size_t Width): - self._ptr[0].Width = Width - @property - def Height(self): - return self._ptr[0].Height - @Height.setter - def Height(self, size_t Height): - self._ptr[0].Height = Height - @property - def Format(self): - return CUarray_format(self._ptr[0].Format) - @Format.setter - def Format(self, Format not None : CUarray_format): - self._ptr[0].Format = Format.value - @property - def NumChannels(self): - return self._ptr[0].NumChannels - @NumChannels.setter - def NumChannels(self, unsigned int NumChannels): - self._ptr[0].NumChannels = NumChannels -{{endif}} -{{if 'struct CUDA_ARRAY3D_DESCRIPTOR_st' in found_types}} + def value(self): + return self._pvt_ptr[0].params.fence.value + @value.setter + def value(self, unsigned long long value): + self._pvt_ptr[0].params.fence.value = value -cdef class CUDA_ARRAY3D_DESCRIPTOR_st: - """ - 3D array descriptor +cdef class anon_union7: + """ Attributes ---------- - Width : size_t - Width of 3D array - Height : size_t - Height of 3D array - Depth : size_t - Depth of 3D array - Format : CUarray_format - Array format - NumChannels : unsigned int - Channels per array element - Flags : unsigned int - Flags + + fence : Any + + + + reserved : unsigned long long + + Methods ------- getPtr() Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - else: - self._ptr = _ptr - def __init__(self, void_ptr _ptr = 0): + def __cinit__(self, void_ptr _ptr): + self._pvt_ptr = _ptr + + def __init__(self, void_ptr _ptr): pass def __dealloc__(self): pass def getPtr(self): - return self._ptr + return &self._pvt_ptr[0].params.nvSciSync def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['Width : ' + str(self.Width)] - except ValueError: - str_list += ['Width : '] - try: - str_list += ['Height : ' + str(self.Height)] - except ValueError: - str_list += ['Height : '] - try: - str_list += ['Depth : ' + str(self.Depth)] - except ValueError: - str_list += ['Depth : '] - try: - str_list += ['Format : ' + str(self.Format)] - except ValueError: - str_list += ['Format : '] - try: - str_list += ['NumChannels : ' + str(self.NumChannels)] + str_list += ['fence : ' + hex(self.fence)] except ValueError: - str_list += ['NumChannels : '] + str_list += ['fence : '] + + try: - str_list += ['Flags : ' + str(self.Flags)] + str_list += ['reserved : ' + str(self.reserved)] except ValueError: - str_list += ['Flags : '] + str_list += ['reserved : '] + return '\n'.join(str_list) else: return '' + @property - def Width(self): - return self._ptr[0].Width - @Width.setter - def Width(self, size_t Width): - self._ptr[0].Width = Width - @property - def Height(self): - return self._ptr[0].Height - @Height.setter - def Height(self, size_t Height): - self._ptr[0].Height = Height - @property - def Depth(self): - return self._ptr[0].Depth - @Depth.setter - def Depth(self, size_t Depth): - self._ptr[0].Depth = Depth - @property - def Format(self): - return CUarray_format(self._ptr[0].Format) - @Format.setter - def Format(self, Format not None : CUarray_format): - self._ptr[0].Format = Format.value - @property - def NumChannels(self): - return self._ptr[0].NumChannels - @NumChannels.setter - def NumChannels(self, unsigned int NumChannels): - self._ptr[0].NumChannels = NumChannels + def fence(self): + return self._pvt_ptr[0].params.nvSciSync.fence + @fence.setter + def fence(self, fence): + self._cyfence = _HelperInputVoidPtr(fence) + self._pvt_ptr[0].params.nvSciSync.fence = self._cyfence.cptr + + @property - def Flags(self): - return self._ptr[0].Flags - @Flags.setter - def Flags(self, unsigned int Flags): - self._ptr[0].Flags = Flags -{{endif}} -{{if 'struct CUDA_ARRAY_SPARSE_PROPERTIES_st' in found_types}} + def reserved(self): + return self._pvt_ptr[0].params.nvSciSync.reserved + @reserved.setter + def reserved(self, unsigned long long reserved): + self._pvt_ptr[0].params.nvSciSync.reserved = reserved -cdef class anon_struct5: + +cdef class anon_struct15: """ Attributes ---------- - width : unsigned int - height : unsigned int + key : unsigned long long - depth : unsigned int Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): pass def __dealloc__(self): pass def getPtr(self): - return &self._ptr[0].tileExtent + return &self._pvt_ptr[0].params.keyedMutex def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['width : ' + str(self.width)] - except ValueError: - str_list += ['width : '] - try: - str_list += ['height : ' + str(self.height)] - except ValueError: - str_list += ['height : '] - try: - str_list += ['depth : ' + str(self.depth)] + str_list += ['key : ' + str(self.key)] except ValueError: - str_list += ['depth : '] + str_list += ['key : '] + return '\n'.join(str_list) else: return '' + @property - def width(self): - return self._ptr[0].tileExtent.width - @width.setter - def width(self, unsigned int width): - self._ptr[0].tileExtent.width = width - @property - def height(self): - return self._ptr[0].tileExtent.height - @height.setter - def height(self, unsigned int height): - self._ptr[0].tileExtent.height = height - @property - def depth(self): - return self._ptr[0].tileExtent.depth - @depth.setter - def depth(self, unsigned int depth): - self._ptr[0].tileExtent.depth = depth -{{endif}} -{{if 'struct CUDA_ARRAY_SPARSE_PROPERTIES_st' in found_types}} + def key(self): + return self._pvt_ptr[0].params.keyedMutex.key + @key.setter + def key(self, unsigned long long key): + self._pvt_ptr[0].params.keyedMutex.key = key -cdef class CUDA_ARRAY_SPARSE_PROPERTIES_st: - """ - CUDA array sparse properties +cdef class anon_struct16: + """ Attributes ---------- - tileExtent : anon_struct5 - miptailFirstLevel : unsigned int - First mip level at which the mip tail begins. - miptailSize : unsigned long long - Total size of the mip tail. - flags : unsigned int - Flags will either be zero or - CU_ARRAY_SPARSE_PROPERTIES_SINGLE_MIPTAIL - reserved : List[unsigned int] + fence : anon_struct14 + + + + nvSciSync : anon_union7 + + + + keyedMutex : anon_struct15 + + + + reserved : list[unsigned int] + Methods ------- getPtr() Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - else: - self._ptr = _ptr - def __init__(self, void_ptr _ptr = 0): - self._tileExtent = anon_struct5(_ptr=self._ptr) + def __cinit__(self, void_ptr _ptr): + self._pvt_ptr = _ptr + + def __init__(self, void_ptr _ptr): + pass + + self._fence = anon_struct14(_ptr=self._pvt_ptr) + + + self._nvSciSync = anon_union7(_ptr=self._pvt_ptr) + + + self._keyedMutex = anon_struct15(_ptr=self._pvt_ptr) + def __dealloc__(self): pass def getPtr(self): - return self._ptr + return &self._pvt_ptr[0].params def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['tileExtent :\n' + '\n'.join([' ' + line for line in str(self.tileExtent).splitlines()])] - except ValueError: - str_list += ['tileExtent : '] - try: - str_list += ['miptailFirstLevel : ' + str(self.miptailFirstLevel)] + str_list += ['fence :\n' + '\n'.join([' ' + line for line in str(self.fence).splitlines()])] except ValueError: - str_list += ['miptailFirstLevel : '] + str_list += ['fence : '] + + try: - str_list += ['miptailSize : ' + str(self.miptailSize)] + str_list += ['nvSciSync :\n' + '\n'.join([' ' + line for line in str(self.nvSciSync).splitlines()])] except ValueError: - str_list += ['miptailSize : '] + str_list += ['nvSciSync : '] + + try: - str_list += ['flags : ' + str(self.flags)] + str_list += ['keyedMutex :\n' + '\n'.join([' ' + line for line in str(self.keyedMutex).splitlines()])] except ValueError: - str_list += ['flags : '] + str_list += ['keyedMutex : '] + + try: str_list += ['reserved : ' + str(self.reserved)] except ValueError: str_list += ['reserved : '] + return '\n'.join(str_list) else: return '' + @property - def tileExtent(self): - return self._tileExtent - @tileExtent.setter - def tileExtent(self, tileExtent not None : anon_struct5): - string.memcpy(&self._ptr[0].tileExtent, tileExtent.getPtr(), sizeof(self._ptr[0].tileExtent)) - @property - def miptailFirstLevel(self): - return self._ptr[0].miptailFirstLevel - @miptailFirstLevel.setter - def miptailFirstLevel(self, unsigned int miptailFirstLevel): - self._ptr[0].miptailFirstLevel = miptailFirstLevel + def fence(self): + return self._fence + @fence.setter + def fence(self, fence not None : anon_struct14): + string.memcpy(&self._pvt_ptr[0].params.fence, fence.getPtr(), sizeof(self._pvt_ptr[0].params.fence)) + + @property - def miptailSize(self): - return self._ptr[0].miptailSize - @miptailSize.setter - def miptailSize(self, unsigned long long miptailSize): - self._ptr[0].miptailSize = miptailSize + def nvSciSync(self): + return self._nvSciSync + @nvSciSync.setter + def nvSciSync(self, nvSciSync not None : anon_union7): + string.memcpy(&self._pvt_ptr[0].params.nvSciSync, nvSciSync.getPtr(), sizeof(self._pvt_ptr[0].params.nvSciSync)) + + @property - def flags(self): - return self._ptr[0].flags - @flags.setter - def flags(self, unsigned int flags): - self._ptr[0].flags = flags + def keyedMutex(self): + return self._keyedMutex + @keyedMutex.setter + def keyedMutex(self, keyedMutex not None : anon_struct15): + string.memcpy(&self._pvt_ptr[0].params.keyedMutex, keyedMutex.getPtr(), sizeof(self._pvt_ptr[0].params.keyedMutex)) + + @property def reserved(self): - return self._ptr[0].reserved + return self._pvt_ptr[0].params.reserved @reserved.setter def reserved(self, reserved): - self._ptr[0].reserved = reserved -{{endif}} -{{if 'struct CUDA_ARRAY_MEMORY_REQUIREMENTS_st' in found_types}} + self._pvt_ptr[0].params.reserved = reserved -cdef class CUDA_ARRAY_MEMORY_REQUIREMENTS_st: + +cdef class CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st: """ - CUDA array memory requirements + External semaphore signal parameters Attributes ---------- - size : size_t - Total required memory size - alignment : size_t - alignment requirement - reserved : List[unsigned int] + + params : anon_struct16 + + + + flags : unsigned int + Only when CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS is used to signal a + CUexternalSemaphore of type + CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC, the valid flag is + CUDA_EXTERNAL_SEMAPHORE_SIGNAL_SKIP_NVSCIBUF_MEMSYNC which + indicates that while signaling the CUexternalSemaphore, no memory + synchronization operations should be performed for any external + memory object imported as CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF. + For all other types of CUexternalSemaphore, flags must be zero. + + + reserved : list[unsigned int] + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): pass + + self._params = anon_struct16(_ptr=self._pvt_ptr) + def __dealloc__(self): pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['size : ' + str(self.size)] + str_list += ['params :\n' + '\n'.join([' ' + line for line in str(self.params).splitlines()])] except ValueError: - str_list += ['size : '] + str_list += ['params : '] + + try: - str_list += ['alignment : ' + str(self.alignment)] + str_list += ['flags : ' + str(self.flags)] except ValueError: - str_list += ['alignment : '] + str_list += ['flags : '] + + try: str_list += ['reserved : ' + str(self.reserved)] except ValueError: str_list += ['reserved : '] + return '\n'.join(str_list) else: return '' + @property - def size(self): - return self._ptr[0].size - @size.setter - def size(self, size_t size): - self._ptr[0].size = size + def params(self): + return self._params + @params.setter + def params(self, params not None : anon_struct16): + string.memcpy(&self._pvt_ptr[0].params, params.getPtr(), sizeof(self._pvt_ptr[0].params)) + + @property - def alignment(self): - return self._ptr[0].alignment - @alignment.setter - def alignment(self, size_t alignment): - self._ptr[0].alignment = alignment + def flags(self): + return self._pvt_ptr[0].flags + @flags.setter + def flags(self, unsigned int flags): + self._pvt_ptr[0].flags = flags + + @property def reserved(self): - return self._ptr[0].reserved + return self._pvt_ptr[0].reserved @reserved.setter def reserved(self, reserved): - self._ptr[0].reserved = reserved -{{endif}} -{{if 'struct CUDA_RESOURCE_DESC_st' in found_types}} + self._pvt_ptr[0].reserved = reserved -cdef class anon_struct6: + +cdef class anon_struct17: """ Attributes ---------- - hArray : CUarray + + value : unsigned long long + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - self._hArray = CUarray(_ptr=&self._ptr[0].res.array.hArray) + pass def __dealloc__(self): pass def getPtr(self): - return &self._ptr[0].res.array + return &self._pvt_ptr[0].params.fence def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['hArray : ' + str(self.hArray)] + str_list += ['value : ' + str(self.value)] except ValueError: - str_list += ['hArray : '] - return '\n'.join(str_list) - else: - return '' - @property - def hArray(self): - return self._hArray - @hArray.setter - def hArray(self, hArray): - cdef ccuda.CUarray chArray - if hArray is None: - chArray = 0 - elif isinstance(hArray, (CUarray,)): - phArray = int(hArray) - chArray = phArray + str_list += ['value : '] + + return '\n'.join(str_list) else: - phArray = int(CUarray(hArray)) - chArray = phArray - self._hArray._ptr[0] = chArray -{{endif}} -{{if 'struct CUDA_RESOURCE_DESC_st' in found_types}} + return '' -cdef class anon_struct7: + @property + def value(self): + return self._pvt_ptr[0].params.fence.value + @value.setter + def value(self, unsigned long long value): + self._pvt_ptr[0].params.fence.value = value + + +cdef class anon_union8: """ Attributes ---------- - hMipmappedArray : CUmipmappedArray + + fence : Any + + + + reserved : unsigned long long + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - self._hMipmappedArray = CUmipmappedArray(_ptr=&self._ptr[0].res.mipmap.hMipmappedArray) + pass def __dealloc__(self): pass def getPtr(self): - return &self._ptr[0].res.mipmap + return &self._pvt_ptr[0].params.nvSciSync def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['hMipmappedArray : ' + str(self.hMipmappedArray)] + str_list += ['fence : ' + hex(self.fence)] except ValueError: - str_list += ['hMipmappedArray : '] + str_list += ['fence : '] + + + try: + str_list += ['reserved : ' + str(self.reserved)] + except ValueError: + str_list += ['reserved : '] + return '\n'.join(str_list) else: return '' + @property - def hMipmappedArray(self): - return self._hMipmappedArray - @hMipmappedArray.setter - def hMipmappedArray(self, hMipmappedArray): - cdef ccuda.CUmipmappedArray chMipmappedArray - if hMipmappedArray is None: - chMipmappedArray = 0 - elif isinstance(hMipmappedArray, (CUmipmappedArray,)): - phMipmappedArray = int(hMipmappedArray) - chMipmappedArray = phMipmappedArray - else: - phMipmappedArray = int(CUmipmappedArray(hMipmappedArray)) - chMipmappedArray = phMipmappedArray - self._hMipmappedArray._ptr[0] = chMipmappedArray -{{endif}} -{{if 'struct CUDA_RESOURCE_DESC_st' in found_types}} + def fence(self): + return self._pvt_ptr[0].params.nvSciSync.fence + @fence.setter + def fence(self, fence): + self._cyfence = _HelperInputVoidPtr(fence) + self._pvt_ptr[0].params.nvSciSync.fence = self._cyfence.cptr -cdef class anon_struct8: + + @property + def reserved(self): + return self._pvt_ptr[0].params.nvSciSync.reserved + @reserved.setter + def reserved(self, unsigned long long reserved): + self._pvt_ptr[0].params.nvSciSync.reserved = reserved + + +cdef class anon_struct18: """ Attributes ---------- - devPtr : CUdeviceptr - format : CUarray_format + key : unsigned long long - numChannels : unsigned int - sizeInBytes : size_t + + timeoutMs : unsigned int + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - self._devPtr = CUdeviceptr(_ptr=&self._ptr[0].res.linear.devPtr) + pass def __dealloc__(self): pass def getPtr(self): - return &self._ptr[0].res.linear + return &self._pvt_ptr[0].params.keyedMutex def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['devPtr : ' + str(self.devPtr)] - except ValueError: - str_list += ['devPtr : '] - try: - str_list += ['format : ' + str(self.format)] - except ValueError: - str_list += ['format : '] - try: - str_list += ['numChannels : ' + str(self.numChannels)] + str_list += ['key : ' + str(self.key)] except ValueError: - str_list += ['numChannels : '] + str_list += ['key : '] + + try: - str_list += ['sizeInBytes : ' + str(self.sizeInBytes)] + str_list += ['timeoutMs : ' + str(self.timeoutMs)] except ValueError: - str_list += ['sizeInBytes : '] + str_list += ['timeoutMs : '] + return '\n'.join(str_list) else: return '' - @property - def devPtr(self): - return self._devPtr - @devPtr.setter - def devPtr(self, devPtr): - cdef ccuda.CUdeviceptr cdevPtr - if devPtr is None: - cdevPtr = 0 - elif isinstance(devPtr, (CUdeviceptr)): - pdevPtr = int(devPtr) - cdevPtr = pdevPtr - else: - pdevPtr = int(CUdeviceptr(devPtr)) - cdevPtr = pdevPtr - self._devPtr._ptr[0] = cdevPtr @property - def format(self): - return CUarray_format(self._ptr[0].res.linear.format) - @format.setter - def format(self, format not None : CUarray_format): - self._ptr[0].res.linear.format = format.value - @property - def numChannels(self): - return self._ptr[0].res.linear.numChannels - @numChannels.setter - def numChannels(self, unsigned int numChannels): - self._ptr[0].res.linear.numChannels = numChannels + def key(self): + return self._pvt_ptr[0].params.keyedMutex.key + @key.setter + def key(self, unsigned long long key): + self._pvt_ptr[0].params.keyedMutex.key = key + + @property - def sizeInBytes(self): - return self._ptr[0].res.linear.sizeInBytes - @sizeInBytes.setter - def sizeInBytes(self, size_t sizeInBytes): - self._ptr[0].res.linear.sizeInBytes = sizeInBytes -{{endif}} -{{if 'struct CUDA_RESOURCE_DESC_st' in found_types}} + def timeoutMs(self): + return self._pvt_ptr[0].params.keyedMutex.timeoutMs + @timeoutMs.setter + def timeoutMs(self, unsigned int timeoutMs): + self._pvt_ptr[0].params.keyedMutex.timeoutMs = timeoutMs -cdef class anon_struct9: + +cdef class anon_struct19: """ Attributes ---------- - devPtr : CUdeviceptr - format : CUarray_format + fence : anon_struct17 - numChannels : unsigned int - width : size_t - height : size_t + nvSciSync : anon_union8 + + + + keyedMutex : anon_struct18 + + + + reserved : list[unsigned int] - pitchInBytes : size_t Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - self._devPtr = CUdeviceptr(_ptr=&self._ptr[0].res.pitch2D.devPtr) + pass + + self._fence = anon_struct17(_ptr=self._pvt_ptr) + + + self._nvSciSync = anon_union8(_ptr=self._pvt_ptr) + + + self._keyedMutex = anon_struct18(_ptr=self._pvt_ptr) + def __dealloc__(self): pass def getPtr(self): - return &self._ptr[0].res.pitch2D + return &self._pvt_ptr[0].params def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['devPtr : ' + str(self.devPtr)] - except ValueError: - str_list += ['devPtr : '] - try: - str_list += ['format : ' + str(self.format)] - except ValueError: - str_list += ['format : '] - try: - str_list += ['numChannels : ' + str(self.numChannels)] + str_list += ['fence :\n' + '\n'.join([' ' + line for line in str(self.fence).splitlines()])] except ValueError: - str_list += ['numChannels : '] + str_list += ['fence : '] + + try: - str_list += ['width : ' + str(self.width)] + str_list += ['nvSciSync :\n' + '\n'.join([' ' + line for line in str(self.nvSciSync).splitlines()])] except ValueError: - str_list += ['width : '] + str_list += ['nvSciSync : '] + + try: - str_list += ['height : ' + str(self.height)] + str_list += ['keyedMutex :\n' + '\n'.join([' ' + line for line in str(self.keyedMutex).splitlines()])] except ValueError: - str_list += ['height : '] + str_list += ['keyedMutex : '] + + try: - str_list += ['pitchInBytes : ' + str(self.pitchInBytes)] + str_list += ['reserved : ' + str(self.reserved)] except ValueError: - str_list += ['pitchInBytes : '] + str_list += ['reserved : '] + return '\n'.join(str_list) else: return '' - @property - def devPtr(self): - return self._devPtr - @devPtr.setter - def devPtr(self, devPtr): - cdef ccuda.CUdeviceptr cdevPtr - if devPtr is None: - cdevPtr = 0 - elif isinstance(devPtr, (CUdeviceptr)): - pdevPtr = int(devPtr) - cdevPtr = pdevPtr - else: - pdevPtr = int(CUdeviceptr(devPtr)) - cdevPtr = pdevPtr - self._devPtr._ptr[0] = cdevPtr @property - def format(self): - return CUarray_format(self._ptr[0].res.pitch2D.format) - @format.setter - def format(self, format not None : CUarray_format): - self._ptr[0].res.pitch2D.format = format.value - @property - def numChannels(self): - return self._ptr[0].res.pitch2D.numChannels - @numChannels.setter - def numChannels(self, unsigned int numChannels): - self._ptr[0].res.pitch2D.numChannels = numChannels + def fence(self): + return self._fence + @fence.setter + def fence(self, fence not None : anon_struct17): + string.memcpy(&self._pvt_ptr[0].params.fence, fence.getPtr(), sizeof(self._pvt_ptr[0].params.fence)) + + @property - def width(self): - return self._ptr[0].res.pitch2D.width - @width.setter - def width(self, size_t width): - self._ptr[0].res.pitch2D.width = width + def nvSciSync(self): + return self._nvSciSync + @nvSciSync.setter + def nvSciSync(self, nvSciSync not None : anon_union8): + string.memcpy(&self._pvt_ptr[0].params.nvSciSync, nvSciSync.getPtr(), sizeof(self._pvt_ptr[0].params.nvSciSync)) + + @property - def height(self): - return self._ptr[0].res.pitch2D.height - @height.setter - def height(self, size_t height): - self._ptr[0].res.pitch2D.height = height + def keyedMutex(self): + return self._keyedMutex + @keyedMutex.setter + def keyedMutex(self, keyedMutex not None : anon_struct18): + string.memcpy(&self._pvt_ptr[0].params.keyedMutex, keyedMutex.getPtr(), sizeof(self._pvt_ptr[0].params.keyedMutex)) + + @property - def pitchInBytes(self): - return self._ptr[0].res.pitch2D.pitchInBytes - @pitchInBytes.setter - def pitchInBytes(self, size_t pitchInBytes): - self._ptr[0].res.pitch2D.pitchInBytes = pitchInBytes -{{endif}} -{{if 'struct CUDA_RESOURCE_DESC_st' in found_types}} + def reserved(self): + return self._pvt_ptr[0].params.reserved + @reserved.setter + def reserved(self, reserved): + self._pvt_ptr[0].params.reserved = reserved -cdef class anon_struct10: + +cdef class CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st: """ + External semaphore wait parameters + Attributes ---------- - reserved : List[int] + + params : anon_struct19 + + + + flags : unsigned int + Only when CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS is used to wait on a + CUexternalSemaphore of type + CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC, the valid flag is + CUDA_EXTERNAL_SEMAPHORE_WAIT_SKIP_NVSCIBUF_MEMSYNC which indicates + that while waiting for the CUexternalSemaphore, no memory + synchronization operations should be performed for any external + memory object imported as CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF. + For all other types of CUexternalSemaphore, flags must be zero. + + + reserved : list[unsigned int] + Methods ------- getPtr() Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr - - def __init__(self, void_ptr _ptr): + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): pass + + self._params = anon_struct19(_ptr=self._pvt_ptr) + def __dealloc__(self): pass def getPtr(self): - return &self._ptr[0].res.reserved + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + + try: + str_list += ['params :\n' + '\n'.join([' ' + line for line in str(self.params).splitlines()])] + except ValueError: + str_list += ['params : '] + + + try: + str_list += ['flags : ' + str(self.flags)] + except ValueError: + str_list += ['flags : '] + + try: str_list += ['reserved : ' + str(self.reserved)] except ValueError: str_list += ['reserved : '] + return '\n'.join(str_list) else: return '' + + @property + def params(self): + return self._params + @params.setter + def params(self, params not None : anon_struct19): + string.memcpy(&self._pvt_ptr[0].params, params.getPtr(), sizeof(self._pvt_ptr[0].params)) + + + @property + def flags(self): + return self._pvt_ptr[0].flags + @flags.setter + def flags(self, unsigned int flags): + self._pvt_ptr[0].flags = flags + + @property def reserved(self): - return self._ptr[0].res.reserved.reserved + return self._pvt_ptr[0].reserved @reserved.setter def reserved(self, reserved): - self._ptr[0].res.reserved.reserved = reserved -{{endif}} -{{if 'struct CUDA_RESOURCE_DESC_st' in found_types}} + self._pvt_ptr[0].reserved = reserved -cdef class anon_union4: + +cdef class CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_st: """ + Semaphore signal node parameters + Attributes ---------- - array : anon_struct6 - mipmap : anon_struct7 + extSemArray : CUexternalSemaphore + Array of external semaphore handles. + - linear : anon_struct8 + paramsArray : CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS + Array of external semaphore signal parameters. - pitch2D : anon_struct9 - reserved : anon_struct10 + numExtSems : unsigned int + Number of handles and parameters supplied in extSemArray and + paramsArray. Methods ------- getPtr() Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr - - def __init__(self, void_ptr _ptr): - self._array = anon_struct6(_ptr=self._ptr) - self._mipmap = anon_struct7(_ptr=self._ptr) - self._linear = anon_struct8(_ptr=self._ptr) - self._pitch2D = anon_struct9(_ptr=self._ptr) - self._reserved = anon_struct10(_ptr=self._ptr) + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass def __dealloc__(self): pass + + if self._extSemArray is not NULL: + free(self._extSemArray) + self._pvt_ptr[0].extSemArray = NULL + + + if self._paramsArray is not NULL: + free(self._paramsArray) + self._pvt_ptr[0].paramsArray = NULL + def getPtr(self): - return &self._ptr[0].res + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['array :\n' + '\n'.join([' ' + line for line in str(self.array).splitlines()])] - except ValueError: - str_list += ['array : '] - try: - str_list += ['mipmap :\n' + '\n'.join([' ' + line for line in str(self.mipmap).splitlines()])] - except ValueError: - str_list += ['mipmap : '] - try: - str_list += ['linear :\n' + '\n'.join([' ' + line for line in str(self.linear).splitlines()])] + str_list += ['extSemArray : ' + str(self.extSemArray)] except ValueError: - str_list += ['linear : '] + str_list += ['extSemArray : '] + + try: - str_list += ['pitch2D :\n' + '\n'.join([' ' + line for line in str(self.pitch2D).splitlines()])] + str_list += ['paramsArray : ' + str(self.paramsArray)] except ValueError: - str_list += ['pitch2D : '] + str_list += ['paramsArray : '] + + try: - str_list += ['reserved :\n' + '\n'.join([' ' + line for line in str(self.reserved).splitlines()])] + str_list += ['numExtSems : ' + str(self.numExtSems)] except ValueError: - str_list += ['reserved : '] + str_list += ['numExtSems : '] + return '\n'.join(str_list) else: return '' + @property - def array(self): - return self._array - @array.setter - def array(self, array not None : anon_struct6): - string.memcpy(&self._ptr[0].res.array, array.getPtr(), sizeof(self._ptr[0].res.array)) - @property - def mipmap(self): - return self._mipmap - @mipmap.setter - def mipmap(self, mipmap not None : anon_struct7): - string.memcpy(&self._ptr[0].res.mipmap, mipmap.getPtr(), sizeof(self._ptr[0].res.mipmap)) - @property - def linear(self): - return self._linear - @linear.setter - def linear(self, linear not None : anon_struct8): - string.memcpy(&self._ptr[0].res.linear, linear.getPtr(), sizeof(self._ptr[0].res.linear)) + def extSemArray(self): + arrs = [self._pvt_ptr[0].extSemArray + x*sizeof(cydriver.CUexternalSemaphore) for x in range(self._extSemArray_length)] + return [CUexternalSemaphore(_ptr=arr) for arr in arrs] + @extSemArray.setter + def extSemArray(self, val): + if len(val) == 0: + free(self._extSemArray) + self._extSemArray = NULL + self._extSemArray_length = 0 + self._pvt_ptr[0].extSemArray = NULL + else: + if self._extSemArray_length != len(val): + free(self._extSemArray) + self._extSemArray = calloc(len(val), sizeof(cydriver.CUexternalSemaphore)) + if self._extSemArray is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(cydriver.CUexternalSemaphore))) + self._extSemArray_length = len(val) + self._pvt_ptr[0].extSemArray = self._extSemArray + for idx in range(len(val)): + self._extSemArray[idx] = (val[idx])._pvt_ptr[0] + + + @property - def pitch2D(self): - return self._pitch2D - @pitch2D.setter - def pitch2D(self, pitch2D not None : anon_struct9): - string.memcpy(&self._ptr[0].res.pitch2D, pitch2D.getPtr(), sizeof(self._ptr[0].res.pitch2D)) + def paramsArray(self): + arrs = [self._pvt_ptr[0].paramsArray + x*sizeof(cydriver.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS) for x in range(self._paramsArray_length)] + return [CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS(_ptr=arr) for arr in arrs] + @paramsArray.setter + def paramsArray(self, val): + if len(val) == 0: + free(self._paramsArray) + self._paramsArray = NULL + self._paramsArray_length = 0 + self._pvt_ptr[0].paramsArray = NULL + else: + if self._paramsArray_length != len(val): + free(self._paramsArray) + self._paramsArray = calloc(len(val), sizeof(cydriver.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS)) + if self._paramsArray is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(cydriver.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS))) + self._paramsArray_length = len(val) + self._pvt_ptr[0].paramsArray = self._paramsArray + for idx in range(len(val)): + string.memcpy(&self._paramsArray[idx], (val[idx])._pvt_ptr, sizeof(cydriver.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS)) + + + @property - def reserved(self): - return self._reserved - @reserved.setter - def reserved(self, reserved not None : anon_struct10): - string.memcpy(&self._ptr[0].res.reserved, reserved.getPtr(), sizeof(self._ptr[0].res.reserved)) -{{endif}} -{{if 'struct CUDA_RESOURCE_DESC_st' in found_types}} + def numExtSems(self): + return self._pvt_ptr[0].numExtSems + @numExtSems.setter + def numExtSems(self, unsigned int numExtSems): + self._pvt_ptr[0].numExtSems = numExtSems -cdef class CUDA_RESOURCE_DESC_st: + +cdef class CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2_st: """ - CUDA Resource descriptor + Semaphore signal node parameters Attributes ---------- - resType : CUresourcetype - Resource type - res : anon_union4 - flags : unsigned int - Flags (must be zero) + extSemArray : CUexternalSemaphore + Array of external semaphore handles. + + + paramsArray : CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS + Array of external semaphore signal parameters. + + + numExtSems : unsigned int + Number of handles and parameters supplied in extSemArray and + paramsArray. + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._val_ptr = calloc(1, sizeof(ccuda.CUDA_RESOURCE_DESC_st)) - self._ptr = self._val_ptr + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - self._res = anon_union4(_ptr=self._ptr) + pass def __dealloc__(self): - if self._val_ptr is not NULL: - free(self._val_ptr) + pass + + if self._extSemArray is not NULL: + free(self._extSemArray) + self._pvt_ptr[0].extSemArray = NULL + + + if self._paramsArray is not NULL: + free(self._paramsArray) + self._pvt_ptr[0].paramsArray = NULL + def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['resType : ' + str(self.resType)] + str_list += ['extSemArray : ' + str(self.extSemArray)] except ValueError: - str_list += ['resType : '] + str_list += ['extSemArray : '] + + try: - str_list += ['res :\n' + '\n'.join([' ' + line for line in str(self.res).splitlines()])] + str_list += ['paramsArray : ' + str(self.paramsArray)] except ValueError: - str_list += ['res : '] + str_list += ['paramsArray : '] + + try: - str_list += ['flags : ' + str(self.flags)] + str_list += ['numExtSems : ' + str(self.numExtSems)] except ValueError: - str_list += ['flags : '] + str_list += ['numExtSems : '] + return '\n'.join(str_list) else: return '' + @property - def resType(self): - return CUresourcetype(self._ptr[0].resType) - @resType.setter - def resType(self, resType not None : CUresourcetype): - self._ptr[0].resType = resType.value + def extSemArray(self): + arrs = [self._pvt_ptr[0].extSemArray + x*sizeof(cydriver.CUexternalSemaphore) for x in range(self._extSemArray_length)] + return [CUexternalSemaphore(_ptr=arr) for arr in arrs] + @extSemArray.setter + def extSemArray(self, val): + if len(val) == 0: + free(self._extSemArray) + self._extSemArray = NULL + self._extSemArray_length = 0 + self._pvt_ptr[0].extSemArray = NULL + else: + if self._extSemArray_length != len(val): + free(self._extSemArray) + self._extSemArray = calloc(len(val), sizeof(cydriver.CUexternalSemaphore)) + if self._extSemArray is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(cydriver.CUexternalSemaphore))) + self._extSemArray_length = len(val) + self._pvt_ptr[0].extSemArray = self._extSemArray + for idx in range(len(val)): + self._extSemArray[idx] = (val[idx])._pvt_ptr[0] + + + @property - def res(self): - return self._res - @res.setter - def res(self, res not None : anon_union4): - string.memcpy(&self._ptr[0].res, res.getPtr(), sizeof(self._ptr[0].res)) + def paramsArray(self): + arrs = [self._pvt_ptr[0].paramsArray + x*sizeof(cydriver.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS) for x in range(self._paramsArray_length)] + return [CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS(_ptr=arr) for arr in arrs] + @paramsArray.setter + def paramsArray(self, val): + if len(val) == 0: + free(self._paramsArray) + self._paramsArray = NULL + self._paramsArray_length = 0 + self._pvt_ptr[0].paramsArray = NULL + else: + if self._paramsArray_length != len(val): + free(self._paramsArray) + self._paramsArray = calloc(len(val), sizeof(cydriver.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS)) + if self._paramsArray is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(cydriver.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS))) + self._paramsArray_length = len(val) + self._pvt_ptr[0].paramsArray = self._paramsArray + for idx in range(len(val)): + string.memcpy(&self._paramsArray[idx], (val[idx])._pvt_ptr, sizeof(cydriver.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS)) + + + @property - def flags(self): - return self._ptr[0].flags - @flags.setter - def flags(self, unsigned int flags): - self._ptr[0].flags = flags -{{endif}} -{{if 'struct CUDA_TEXTURE_DESC_st' in found_types}} + def numExtSems(self): + return self._pvt_ptr[0].numExtSems + @numExtSems.setter + def numExtSems(self, unsigned int numExtSems): + self._pvt_ptr[0].numExtSems = numExtSems -cdef class CUDA_TEXTURE_DESC_st: + +cdef class CUDA_EXT_SEM_WAIT_NODE_PARAMS_st: """ - Texture descriptor + Semaphore wait node parameters Attributes ---------- - addressMode : List[CUaddress_mode] - Address modes - filterMode : CUfilter_mode - Filter mode - flags : unsigned int - Flags - maxAnisotropy : unsigned int - Maximum anisotropy ratio - mipmapFilterMode : CUfilter_mode - Mipmap filter mode - mipmapLevelBias : float - Mipmap level bias - minMipmapLevelClamp : float - Mipmap minimum level clamp - maxMipmapLevelClamp : float - Mipmap maximum level clamp - borderColor : List[float] - Border Color - reserved : List[int] + + extSemArray : CUexternalSemaphore + Array of external semaphore handles. + + + paramsArray : CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS + Array of external semaphore wait parameters. + + + numExtSems : unsigned int + Number of handles and parameters supplied in extSemArray and + paramsArray. Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): pass def __dealloc__(self): pass + + if self._extSemArray is not NULL: + free(self._extSemArray) + self._pvt_ptr[0].extSemArray = NULL + + + if self._paramsArray is not NULL: + free(self._paramsArray) + self._pvt_ptr[0].paramsArray = NULL + def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['addressMode : ' + str(self.addressMode)] - except ValueError: - str_list += ['addressMode : '] - try: - str_list += ['filterMode : ' + str(self.filterMode)] - except ValueError: - str_list += ['filterMode : '] - try: - str_list += ['flags : ' + str(self.flags)] - except ValueError: - str_list += ['flags : '] - try: - str_list += ['maxAnisotropy : ' + str(self.maxAnisotropy)] - except ValueError: - str_list += ['maxAnisotropy : '] - try: - str_list += ['mipmapFilterMode : ' + str(self.mipmapFilterMode)] - except ValueError: - str_list += ['mipmapFilterMode : '] - try: - str_list += ['mipmapLevelBias : ' + str(self.mipmapLevelBias)] - except ValueError: - str_list += ['mipmapLevelBias : '] - try: - str_list += ['minMipmapLevelClamp : ' + str(self.minMipmapLevelClamp)] - except ValueError: - str_list += ['minMipmapLevelClamp : '] - try: - str_list += ['maxMipmapLevelClamp : ' + str(self.maxMipmapLevelClamp)] + str_list += ['extSemArray : ' + str(self.extSemArray)] except ValueError: - str_list += ['maxMipmapLevelClamp : '] + str_list += ['extSemArray : '] + + try: - str_list += ['borderColor : ' + str(self.borderColor)] + str_list += ['paramsArray : ' + str(self.paramsArray)] except ValueError: - str_list += ['borderColor : '] + str_list += ['paramsArray : '] + + try: - str_list += ['reserved : ' + str(self.reserved)] + str_list += ['numExtSems : ' + str(self.numExtSems)] except ValueError: - str_list += ['reserved : '] + str_list += ['numExtSems : '] + return '\n'.join(str_list) else: return '' + @property - def addressMode(self): - return [CUaddress_mode(_x) for _x in list(self._ptr[0].addressMode)] - @addressMode.setter - def addressMode(self, addressMode): - self._ptr[0].addressMode = [_x.value for _x in addressMode] - @property - def filterMode(self): - return CUfilter_mode(self._ptr[0].filterMode) - @filterMode.setter - def filterMode(self, filterMode not None : CUfilter_mode): - self._ptr[0].filterMode = filterMode.value - @property - def flags(self): - return self._ptr[0].flags - @flags.setter - def flags(self, unsigned int flags): - self._ptr[0].flags = flags - @property - def maxAnisotropy(self): - return self._ptr[0].maxAnisotropy - @maxAnisotropy.setter - def maxAnisotropy(self, unsigned int maxAnisotropy): - self._ptr[0].maxAnisotropy = maxAnisotropy - @property - def mipmapFilterMode(self): - return CUfilter_mode(self._ptr[0].mipmapFilterMode) - @mipmapFilterMode.setter - def mipmapFilterMode(self, mipmapFilterMode not None : CUfilter_mode): - self._ptr[0].mipmapFilterMode = mipmapFilterMode.value - @property - def mipmapLevelBias(self): - return self._ptr[0].mipmapLevelBias - @mipmapLevelBias.setter - def mipmapLevelBias(self, float mipmapLevelBias): - self._ptr[0].mipmapLevelBias = mipmapLevelBias - @property - def minMipmapLevelClamp(self): - return self._ptr[0].minMipmapLevelClamp - @minMipmapLevelClamp.setter - def minMipmapLevelClamp(self, float minMipmapLevelClamp): - self._ptr[0].minMipmapLevelClamp = minMipmapLevelClamp - @property - def maxMipmapLevelClamp(self): - return self._ptr[0].maxMipmapLevelClamp - @maxMipmapLevelClamp.setter - def maxMipmapLevelClamp(self, float maxMipmapLevelClamp): - self._ptr[0].maxMipmapLevelClamp = maxMipmapLevelClamp + def extSemArray(self): + arrs = [self._pvt_ptr[0].extSemArray + x*sizeof(cydriver.CUexternalSemaphore) for x in range(self._extSemArray_length)] + return [CUexternalSemaphore(_ptr=arr) for arr in arrs] + @extSemArray.setter + def extSemArray(self, val): + if len(val) == 0: + free(self._extSemArray) + self._extSemArray = NULL + self._extSemArray_length = 0 + self._pvt_ptr[0].extSemArray = NULL + else: + if self._extSemArray_length != len(val): + free(self._extSemArray) + self._extSemArray = calloc(len(val), sizeof(cydriver.CUexternalSemaphore)) + if self._extSemArray is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(cydriver.CUexternalSemaphore))) + self._extSemArray_length = len(val) + self._pvt_ptr[0].extSemArray = self._extSemArray + for idx in range(len(val)): + self._extSemArray[idx] = (val[idx])._pvt_ptr[0] + + + @property - def borderColor(self): - return self._ptr[0].borderColor - @borderColor.setter - def borderColor(self, borderColor): - self._ptr[0].borderColor = borderColor + def paramsArray(self): + arrs = [self._pvt_ptr[0].paramsArray + x*sizeof(cydriver.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS) for x in range(self._paramsArray_length)] + return [CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS(_ptr=arr) for arr in arrs] + @paramsArray.setter + def paramsArray(self, val): + if len(val) == 0: + free(self._paramsArray) + self._paramsArray = NULL + self._paramsArray_length = 0 + self._pvt_ptr[0].paramsArray = NULL + else: + if self._paramsArray_length != len(val): + free(self._paramsArray) + self._paramsArray = calloc(len(val), sizeof(cydriver.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS)) + if self._paramsArray is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(cydriver.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS))) + self._paramsArray_length = len(val) + self._pvt_ptr[0].paramsArray = self._paramsArray + for idx in range(len(val)): + string.memcpy(&self._paramsArray[idx], (val[idx])._pvt_ptr, sizeof(cydriver.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS)) + + + @property - def reserved(self): - return self._ptr[0].reserved - @reserved.setter - def reserved(self, reserved): - self._ptr[0].reserved = reserved -{{endif}} -{{if 'struct CUDA_RESOURCE_VIEW_DESC_st' in found_types}} + def numExtSems(self): + return self._pvt_ptr[0].numExtSems + @numExtSems.setter + def numExtSems(self, unsigned int numExtSems): + self._pvt_ptr[0].numExtSems = numExtSems -cdef class CUDA_RESOURCE_VIEW_DESC_st: + +cdef class CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2_st: """ - Resource view descriptor + Semaphore wait node parameters Attributes ---------- - format : CUresourceViewFormat - Resource view format - width : size_t - Width of the resource view - height : size_t - Height of the resource view - depth : size_t - Depth of the resource view - firstMipmapLevel : unsigned int - First defined mipmap level - lastMipmapLevel : unsigned int - Last defined mipmap level - firstLayer : unsigned int - First layer index - lastLayer : unsigned int - Last layer index - reserved : List[unsigned int] + + extSemArray : CUexternalSemaphore + Array of external semaphore handles. + + + paramsArray : CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS + Array of external semaphore wait parameters. + + + numExtSems : unsigned int + Number of handles and parameters supplied in extSemArray and + paramsArray. Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): pass def __dealloc__(self): pass + + if self._extSemArray is not NULL: + free(self._extSemArray) + self._pvt_ptr[0].extSemArray = NULL + + + if self._paramsArray is not NULL: + free(self._paramsArray) + self._pvt_ptr[0].paramsArray = NULL + def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['format : ' + str(self.format)] - except ValueError: - str_list += ['format : '] - try: - str_list += ['width : ' + str(self.width)] - except ValueError: - str_list += ['width : '] - try: - str_list += ['height : ' + str(self.height)] - except ValueError: - str_list += ['height : '] - try: - str_list += ['depth : ' + str(self.depth)] - except ValueError: - str_list += ['depth : '] - try: - str_list += ['firstMipmapLevel : ' + str(self.firstMipmapLevel)] - except ValueError: - str_list += ['firstMipmapLevel : '] - try: - str_list += ['lastMipmapLevel : ' + str(self.lastMipmapLevel)] - except ValueError: - str_list += ['lastMipmapLevel : '] - try: - str_list += ['firstLayer : ' + str(self.firstLayer)] + str_list += ['extSemArray : ' + str(self.extSemArray)] except ValueError: - str_list += ['firstLayer : '] + str_list += ['extSemArray : '] + + try: - str_list += ['lastLayer : ' + str(self.lastLayer)] + str_list += ['paramsArray : ' + str(self.paramsArray)] except ValueError: - str_list += ['lastLayer : '] + str_list += ['paramsArray : '] + + try: - str_list += ['reserved : ' + str(self.reserved)] + str_list += ['numExtSems : ' + str(self.numExtSems)] except ValueError: - str_list += ['reserved : '] + str_list += ['numExtSems : '] + return '\n'.join(str_list) else: return '' + @property - def format(self): - return CUresourceViewFormat(self._ptr[0].format) - @format.setter - def format(self, format not None : CUresourceViewFormat): - self._ptr[0].format = format.value - @property - def width(self): - return self._ptr[0].width - @width.setter - def width(self, size_t width): - self._ptr[0].width = width - @property - def height(self): - return self._ptr[0].height - @height.setter - def height(self, size_t height): - self._ptr[0].height = height - @property - def depth(self): - return self._ptr[0].depth - @depth.setter - def depth(self, size_t depth): - self._ptr[0].depth = depth - @property - def firstMipmapLevel(self): - return self._ptr[0].firstMipmapLevel - @firstMipmapLevel.setter - def firstMipmapLevel(self, unsigned int firstMipmapLevel): - self._ptr[0].firstMipmapLevel = firstMipmapLevel - @property - def lastMipmapLevel(self): - return self._ptr[0].lastMipmapLevel - @lastMipmapLevel.setter - def lastMipmapLevel(self, unsigned int lastMipmapLevel): - self._ptr[0].lastMipmapLevel = lastMipmapLevel - @property - def firstLayer(self): - return self._ptr[0].firstLayer - @firstLayer.setter - def firstLayer(self, unsigned int firstLayer): - self._ptr[0].firstLayer = firstLayer - @property - def lastLayer(self): - return self._ptr[0].lastLayer - @lastLayer.setter - def lastLayer(self, unsigned int lastLayer): - self._ptr[0].lastLayer = lastLayer - @property - def reserved(self): - return self._ptr[0].reserved - @reserved.setter - def reserved(self, reserved): - self._ptr[0].reserved = reserved -{{endif}} -{{if 'struct CUtensorMap_st' in found_types}} + def extSemArray(self): + arrs = [self._pvt_ptr[0].extSemArray + x*sizeof(cydriver.CUexternalSemaphore) for x in range(self._extSemArray_length)] + return [CUexternalSemaphore(_ptr=arr) for arr in arrs] + @extSemArray.setter + def extSemArray(self, val): + if len(val) == 0: + free(self._extSemArray) + self._extSemArray = NULL + self._extSemArray_length = 0 + self._pvt_ptr[0].extSemArray = NULL + else: + if self._extSemArray_length != len(val): + free(self._extSemArray) + self._extSemArray = calloc(len(val), sizeof(cydriver.CUexternalSemaphore)) + if self._extSemArray is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(cydriver.CUexternalSemaphore))) + self._extSemArray_length = len(val) + self._pvt_ptr[0].extSemArray = self._extSemArray + for idx in range(len(val)): + self._extSemArray[idx] = (val[idx])._pvt_ptr[0] -cdef class CUtensorMap_st: - """ - Tensor map descriptor. Requires compiler support for aligning to 64 - bytes. - Attributes - ---------- - opaque : List[cuuint64_t] + + @property + def paramsArray(self): + arrs = [self._pvt_ptr[0].paramsArray + x*sizeof(cydriver.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS) for x in range(self._paramsArray_length)] + return [CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS(_ptr=arr) for arr in arrs] + @paramsArray.setter + def paramsArray(self, val): + if len(val) == 0: + free(self._paramsArray) + self._paramsArray = NULL + self._paramsArray_length = 0 + self._pvt_ptr[0].paramsArray = NULL + else: + if self._paramsArray_length != len(val): + free(self._paramsArray) + self._paramsArray = calloc(len(val), sizeof(cydriver.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS)) + if self._paramsArray is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(cydriver.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS))) + self._paramsArray_length = len(val) + self._pvt_ptr[0].paramsArray = self._paramsArray + for idx in range(len(val)): + string.memcpy(&self._paramsArray[idx], (val[idx])._pvt_ptr, sizeof(cydriver.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS)) - Methods - ------- - getPtr() - Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - else: - self._ptr = _ptr - def __init__(self, void_ptr _ptr = 0): - pass - def __dealloc__(self): - pass - def getPtr(self): - return self._ptr - def __repr__(self): - if self._ptr is not NULL: - str_list = [] - try: - str_list += ['opaque : ' + str(self.opaque)] - except ValueError: - str_list += ['opaque : '] - return '\n'.join(str_list) - else: - return '' @property - def opaque(self): - return [cuuint64_t(init_value=_opaque) for _opaque in self._ptr[0].opaque] - @opaque.setter - def opaque(self, opaque): - self._ptr[0].opaque = opaque + def numExtSems(self): + return self._pvt_ptr[0].numExtSems + @numExtSems.setter + def numExtSems(self, unsigned int numExtSems): + self._pvt_ptr[0].numExtSems = numExtSems -{{endif}} -{{if 'struct CUDA_POINTER_ATTRIBUTE_P2P_TOKENS_st' in found_types}} -cdef class CUDA_POINTER_ATTRIBUTE_P2P_TOKENS_st: +cdef class anon_union9: """ - GPU Direct v3 tokens - Attributes ---------- - p2pToken : unsigned long long - vaSpaceToken : unsigned int + mipmap : CUmipmappedArray + + + + array : CUarray + Methods ------- getPtr() Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - else: - self._ptr = _ptr - def __init__(self, void_ptr _ptr = 0): + def __cinit__(self, void_ptr _ptr): + self._pvt_ptr = _ptr + + def __init__(self, void_ptr _ptr): pass + + self._mipmap = CUmipmappedArray(_ptr=&self._pvt_ptr[0].resource.mipmap) + + + self._array = CUarray(_ptr=&self._pvt_ptr[0].resource.array) + def __dealloc__(self): pass def getPtr(self): - return self._ptr + return &self._pvt_ptr[0].resource def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['p2pToken : ' + str(self.p2pToken)] + str_list += ['mipmap : ' + str(self.mipmap)] except ValueError: - str_list += ['p2pToken : '] + str_list += ['mipmap : '] + + try: - str_list += ['vaSpaceToken : ' + str(self.vaSpaceToken)] + str_list += ['array : ' + str(self.array)] except ValueError: - str_list += ['vaSpaceToken : '] + str_list += ['array : '] + return '\n'.join(str_list) else: return '' + @property - def p2pToken(self): - return self._ptr[0].p2pToken - @p2pToken.setter - def p2pToken(self, unsigned long long p2pToken): - self._ptr[0].p2pToken = p2pToken + def mipmap(self): + return self._mipmap + @mipmap.setter + def mipmap(self, mipmap): + cdef cydriver.CUmipmappedArray cymipmap + if mipmap is None: + cymipmap = 0 + elif isinstance(mipmap, (CUmipmappedArray,)): + pmipmap = int(mipmap) + cymipmap = pmipmap + else: + pmipmap = int(CUmipmappedArray(mipmap)) + cymipmap = pmipmap + self._mipmap._pvt_ptr[0] = cymipmap + + @property - def vaSpaceToken(self): - return self._ptr[0].vaSpaceToken - @vaSpaceToken.setter - def vaSpaceToken(self, unsigned int vaSpaceToken): - self._ptr[0].vaSpaceToken = vaSpaceToken -{{endif}} -{{if 'struct CUDA_LAUNCH_PARAMS_st' in found_types}} + def array(self): + return self._array + @array.setter + def array(self, array): + cdef cydriver.CUarray cyarray + if array is None: + cyarray = 0 + elif isinstance(array, (CUarray,)): + parray = int(array) + cyarray = parray + else: + parray = int(CUarray(array)) + cyarray = parray + self._array._pvt_ptr[0] = cyarray -cdef class CUDA_LAUNCH_PARAMS_st: - """ - Kernel launch parameters +cdef class anon_struct20: + """ Attributes ---------- - function : CUfunction - Kernel to launch - gridDimX : unsigned int - Width of grid in blocks - gridDimY : unsigned int - Height of grid in blocks - gridDimZ : unsigned int - Depth of grid in blocks - blockDimX : unsigned int - X dimension of each thread block - blockDimY : unsigned int - Y dimension of each thread block - blockDimZ : unsigned int - Z dimension of each thread block - sharedMemBytes : unsigned int - Dynamic shared-memory size per thread block in bytes - hStream : CUstream - Stream identifier - kernelParams : Any - Array of pointers to kernel parameters + + level : unsigned int + + + + layer : unsigned int + + + + offsetX : unsigned int + + + + offsetY : unsigned int + + + + offsetZ : unsigned int + + + + extentWidth : unsigned int + + + + extentHeight : unsigned int + + + + extentDepth : unsigned int + + Methods ------- getPtr() Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - else: - self._ptr = _ptr - def __init__(self, void_ptr _ptr = 0): - self._function = CUfunction(_ptr=&self._ptr[0].function) - self._hStream = CUstream(_ptr=&self._ptr[0].hStream) + def __cinit__(self, void_ptr _ptr): + self._pvt_ptr = _ptr + + def __init__(self, void_ptr _ptr): + pass def __dealloc__(self): pass def getPtr(self): - return self._ptr + return &self._pvt_ptr[0].subresource.sparseLevel def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['function : ' + str(self.function)] - except ValueError: - str_list += ['function : '] - try: - str_list += ['gridDimX : ' + str(self.gridDimX)] - except ValueError: - str_list += ['gridDimX : '] - try: - str_list += ['gridDimY : ' + str(self.gridDimY)] + str_list += ['level : ' + str(self.level)] except ValueError: - str_list += ['gridDimY : '] + str_list += ['level : '] + + try: - str_list += ['gridDimZ : ' + str(self.gridDimZ)] + str_list += ['layer : ' + str(self.layer)] except ValueError: - str_list += ['gridDimZ : '] + str_list += ['layer : '] + + try: - str_list += ['blockDimX : ' + str(self.blockDimX)] + str_list += ['offsetX : ' + str(self.offsetX)] except ValueError: - str_list += ['blockDimX : '] + str_list += ['offsetX : '] + + try: - str_list += ['blockDimY : ' + str(self.blockDimY)] + str_list += ['offsetY : ' + str(self.offsetY)] except ValueError: - str_list += ['blockDimY : '] + str_list += ['offsetY : '] + + try: - str_list += ['blockDimZ : ' + str(self.blockDimZ)] + str_list += ['offsetZ : ' + str(self.offsetZ)] except ValueError: - str_list += ['blockDimZ : '] + str_list += ['offsetZ : '] + + try: - str_list += ['sharedMemBytes : ' + str(self.sharedMemBytes)] + str_list += ['extentWidth : ' + str(self.extentWidth)] except ValueError: - str_list += ['sharedMemBytes : '] + str_list += ['extentWidth : '] + + try: - str_list += ['hStream : ' + str(self.hStream)] + str_list += ['extentHeight : ' + str(self.extentHeight)] except ValueError: - str_list += ['hStream : '] + str_list += ['extentHeight : '] + + try: - str_list += ['kernelParams : ' + str(self.kernelParams)] + str_list += ['extentDepth : ' + str(self.extentDepth)] except ValueError: - str_list += ['kernelParams : '] + str_list += ['extentDepth : '] + return '\n'.join(str_list) else: return '' + @property - def function(self): - return self._function - @function.setter - def function(self, function): - cdef ccuda.CUfunction cfunction - if function is None: - cfunction = 0 - elif isinstance(function, (CUfunction,)): - pfunction = int(function) - cfunction = pfunction - else: - pfunction = int(CUfunction(function)) - cfunction = pfunction - self._function._ptr[0] = cfunction - @property - def gridDimX(self): - return self._ptr[0].gridDimX - @gridDimX.setter - def gridDimX(self, unsigned int gridDimX): - self._ptr[0].gridDimX = gridDimX - @property - def gridDimY(self): - return self._ptr[0].gridDimY - @gridDimY.setter - def gridDimY(self, unsigned int gridDimY): - self._ptr[0].gridDimY = gridDimY - @property - def gridDimZ(self): - return self._ptr[0].gridDimZ - @gridDimZ.setter - def gridDimZ(self, unsigned int gridDimZ): - self._ptr[0].gridDimZ = gridDimZ + def level(self): + return self._pvt_ptr[0].subresource.sparseLevel.level + @level.setter + def level(self, unsigned int level): + self._pvt_ptr[0].subresource.sparseLevel.level = level + + @property - def blockDimX(self): - return self._ptr[0].blockDimX - @blockDimX.setter - def blockDimX(self, unsigned int blockDimX): - self._ptr[0].blockDimX = blockDimX + def layer(self): + return self._pvt_ptr[0].subresource.sparseLevel.layer + @layer.setter + def layer(self, unsigned int layer): + self._pvt_ptr[0].subresource.sparseLevel.layer = layer + + @property - def blockDimY(self): - return self._ptr[0].blockDimY - @blockDimY.setter - def blockDimY(self, unsigned int blockDimY): - self._ptr[0].blockDimY = blockDimY + def offsetX(self): + return self._pvt_ptr[0].subresource.sparseLevel.offsetX + @offsetX.setter + def offsetX(self, unsigned int offsetX): + self._pvt_ptr[0].subresource.sparseLevel.offsetX = offsetX + + @property - def blockDimZ(self): - return self._ptr[0].blockDimZ - @blockDimZ.setter - def blockDimZ(self, unsigned int blockDimZ): - self._ptr[0].blockDimZ = blockDimZ + def offsetY(self): + return self._pvt_ptr[0].subresource.sparseLevel.offsetY + @offsetY.setter + def offsetY(self, unsigned int offsetY): + self._pvt_ptr[0].subresource.sparseLevel.offsetY = offsetY + + @property - def sharedMemBytes(self): - return self._ptr[0].sharedMemBytes - @sharedMemBytes.setter - def sharedMemBytes(self, unsigned int sharedMemBytes): - self._ptr[0].sharedMemBytes = sharedMemBytes + def offsetZ(self): + return self._pvt_ptr[0].subresource.sparseLevel.offsetZ + @offsetZ.setter + def offsetZ(self, unsigned int offsetZ): + self._pvt_ptr[0].subresource.sparseLevel.offsetZ = offsetZ + + @property - def hStream(self): - return self._hStream - @hStream.setter - def hStream(self, hStream): - cdef ccuda.CUstream chStream - if hStream is None: - chStream = 0 - elif isinstance(hStream, (CUstream,)): - phStream = int(hStream) - chStream = phStream - else: - phStream = int(CUstream(hStream)) - chStream = phStream - self._hStream._ptr[0] = chStream + def extentWidth(self): + return self._pvt_ptr[0].subresource.sparseLevel.extentWidth + @extentWidth.setter + def extentWidth(self, unsigned int extentWidth): + self._pvt_ptr[0].subresource.sparseLevel.extentWidth = extentWidth + + @property - def kernelParams(self): - return self._ptr[0].kernelParams - @kernelParams.setter - def kernelParams(self, kernelParams): - self._ckernelParams = utils.HelperKernelParams(kernelParams) - self._ptr[0].kernelParams = self._ckernelParams.ckernelParams -{{endif}} -{{if 'struct CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st' in found_types}} + def extentHeight(self): + return self._pvt_ptr[0].subresource.sparseLevel.extentHeight + @extentHeight.setter + def extentHeight(self, unsigned int extentHeight): + self._pvt_ptr[0].subresource.sparseLevel.extentHeight = extentHeight -cdef class anon_struct11: + + @property + def extentDepth(self): + return self._pvt_ptr[0].subresource.sparseLevel.extentDepth + @extentDepth.setter + def extentDepth(self, unsigned int extentDepth): + self._pvt_ptr[0].subresource.sparseLevel.extentDepth = extentDepth + + +cdef class anon_struct21: """ Attributes ---------- - handle : Any - name : Any + layer : unsigned int + + + + offset : unsigned long long + + + + size : unsigned long long + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): pass def __dealloc__(self): pass def getPtr(self): - return &self._ptr[0].handle.win32 + return &self._pvt_ptr[0].subresource.miptail def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['handle : ' + hex(self.handle)] + str_list += ['layer : ' + str(self.layer)] except ValueError: - str_list += ['handle : '] + str_list += ['layer : '] + + try: - str_list += ['name : ' + hex(self.name)] + str_list += ['offset : ' + str(self.offset)] except ValueError: - str_list += ['name : '] + str_list += ['offset : '] + + + try: + str_list += ['size : ' + str(self.size)] + except ValueError: + str_list += ['size : '] + return '\n'.join(str_list) else: return '' + @property - def handle(self): - return self._ptr[0].handle.win32.handle - @handle.setter - def handle(self, handle): - _chandle = utils.HelperInputVoidPtr(handle) - self._ptr[0].handle.win32.handle = _chandle.cptr + def layer(self): + return self._pvt_ptr[0].subresource.miptail.layer + @layer.setter + def layer(self, unsigned int layer): + self._pvt_ptr[0].subresource.miptail.layer = layer + + @property - def name(self): - return self._ptr[0].handle.win32.name - @name.setter - def name(self, name): - _cname = utils.HelperInputVoidPtr(name) - self._ptr[0].handle.win32.name = _cname.cptr -{{endif}} -{{if 'struct CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st' in found_types}} + def offset(self): + return self._pvt_ptr[0].subresource.miptail.offset + @offset.setter + def offset(self, unsigned long long offset): + self._pvt_ptr[0].subresource.miptail.offset = offset -cdef class anon_union5: + + @property + def size(self): + return self._pvt_ptr[0].subresource.miptail.size + @size.setter + def size(self, unsigned long long size): + self._pvt_ptr[0].subresource.miptail.size = size + + +cdef class anon_union10: """ Attributes ---------- - fd : int - win32 : anon_struct11 + sparseLevel : anon_struct20 + + + + miptail : anon_struct21 - nvSciBufObject : Any Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - self._win32 = anon_struct11(_ptr=self._ptr) + pass + + self._sparseLevel = anon_struct20(_ptr=self._pvt_ptr) + + + self._miptail = anon_struct21(_ptr=self._pvt_ptr) + def __dealloc__(self): pass def getPtr(self): - return &self._ptr[0].handle + return &self._pvt_ptr[0].subresource def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['fd : ' + str(self.fd)] - except ValueError: - str_list += ['fd : '] - try: - str_list += ['win32 :\n' + '\n'.join([' ' + line for line in str(self.win32).splitlines()])] + str_list += ['sparseLevel :\n' + '\n'.join([' ' + line for line in str(self.sparseLevel).splitlines()])] except ValueError: - str_list += ['win32 : '] + str_list += ['sparseLevel : '] + + try: - str_list += ['nvSciBufObject : ' + hex(self.nvSciBufObject)] + str_list += ['miptail :\n' + '\n'.join([' ' + line for line in str(self.miptail).splitlines()])] except ValueError: - str_list += ['nvSciBufObject : '] + str_list += ['miptail : '] + return '\n'.join(str_list) else: return '' + @property - def fd(self): - return self._ptr[0].handle.fd - @fd.setter - def fd(self, int fd): - self._ptr[0].handle.fd = fd - @property - def win32(self): - return self._win32 - @win32.setter - def win32(self, win32 not None : anon_struct11): - string.memcpy(&self._ptr[0].handle.win32, win32.getPtr(), sizeof(self._ptr[0].handle.win32)) + def sparseLevel(self): + return self._sparseLevel + @sparseLevel.setter + def sparseLevel(self, sparseLevel not None : anon_struct20): + string.memcpy(&self._pvt_ptr[0].subresource.sparseLevel, sparseLevel.getPtr(), sizeof(self._pvt_ptr[0].subresource.sparseLevel)) + + @property - def nvSciBufObject(self): - return self._ptr[0].handle.nvSciBufObject - @nvSciBufObject.setter - def nvSciBufObject(self, nvSciBufObject): - _cnvSciBufObject = utils.HelperInputVoidPtr(nvSciBufObject) - self._ptr[0].handle.nvSciBufObject = _cnvSciBufObject.cptr -{{endif}} -{{if 'struct CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st' in found_types}} + def miptail(self): + return self._miptail + @miptail.setter + def miptail(self, miptail not None : anon_struct21): + string.memcpy(&self._pvt_ptr[0].subresource.miptail, miptail.getPtr(), sizeof(self._pvt_ptr[0].subresource.miptail)) -cdef class CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st: - """ - External memory handle descriptor +cdef class anon_union11: + """ Attributes ---------- - type : CUexternalMemoryHandleType - Type of the handle - handle : anon_union5 - size : unsigned long long - Size of the memory allocation - flags : unsigned int - Flags must either be zero or CUDA_EXTERNAL_MEMORY_DEDICATED - reserved : List[unsigned int] + memHandle : CUmemGenericAllocationHandle + Methods ------- getPtr() Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr = 0): - if _ptr == 0: - self._val_ptr = calloc(1, sizeof(ccuda.CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st)) - self._ptr = self._val_ptr - else: - self._ptr = _ptr - def __init__(self, void_ptr _ptr = 0): - self._handle = anon_union5(_ptr=self._ptr) + def __cinit__(self, void_ptr _ptr): + self._pvt_ptr = _ptr + + def __init__(self, void_ptr _ptr): + pass + + self._memHandle = CUmemGenericAllocationHandle(_ptr=&self._pvt_ptr[0].memHandle.memHandle) + def __dealloc__(self): - if self._val_ptr is not NULL: - free(self._val_ptr) + pass def getPtr(self): - return self._ptr + return &self._pvt_ptr[0].memHandle def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['type : ' + str(self.type)] - except ValueError: - str_list += ['type : '] - try: - str_list += ['handle :\n' + '\n'.join([' ' + line for line in str(self.handle).splitlines()])] - except ValueError: - str_list += ['handle : '] - try: - str_list += ['size : ' + str(self.size)] - except ValueError: - str_list += ['size : '] - try: - str_list += ['flags : ' + str(self.flags)] - except ValueError: - str_list += ['flags : '] - try: - str_list += ['reserved : ' + str(self.reserved)] + str_list += ['memHandle : ' + str(self.memHandle)] except ValueError: - str_list += ['reserved : '] + str_list += ['memHandle : '] + return '\n'.join(str_list) else: return '' + @property - def type(self): - return CUexternalMemoryHandleType(self._ptr[0].type) - @type.setter - def type(self, type not None : CUexternalMemoryHandleType): - self._ptr[0].type = type.value - @property - def handle(self): - return self._handle - @handle.setter - def handle(self, handle not None : anon_union5): - string.memcpy(&self._ptr[0].handle, handle.getPtr(), sizeof(self._ptr[0].handle)) - @property - def size(self): - return self._ptr[0].size - @size.setter - def size(self, unsigned long long size): - self._ptr[0].size = size - @property - def flags(self): - return self._ptr[0].flags - @flags.setter - def flags(self, unsigned int flags): - self._ptr[0].flags = flags - @property - def reserved(self): - return self._ptr[0].reserved - @reserved.setter - def reserved(self, reserved): - self._ptr[0].reserved = reserved -{{endif}} -{{if 'struct CUDA_EXTERNAL_MEMORY_BUFFER_DESC_st' in found_types}} + def memHandle(self): + return self._memHandle + @memHandle.setter + def memHandle(self, memHandle): + cdef cydriver.CUmemGenericAllocationHandle cymemHandle + if memHandle is None: + cymemHandle = 0 + elif isinstance(memHandle, (CUmemGenericAllocationHandle)): + pmemHandle = int(memHandle) + cymemHandle = pmemHandle + else: + pmemHandle = int(CUmemGenericAllocationHandle(memHandle)) + cymemHandle = pmemHandle + self._memHandle._pvt_ptr[0] = cymemHandle -cdef class CUDA_EXTERNAL_MEMORY_BUFFER_DESC_st: + + +cdef class CUarrayMapInfo_st: """ - External memory buffer descriptor + Specifies the CUDA array or CUDA mipmapped array memory mapping + information Attributes ---------- + + resourceType : CUresourcetype + Resource type + + + resource : anon_union9 + + + + subresourceType : CUarraySparseSubresourceType + Sparse subresource type + + + subresource : anon_union10 + + + + memOperationType : CUmemOperationType + Memory operation type + + + memHandleType : CUmemHandleType + Memory handle type + + + memHandle : anon_union11 + + + offset : unsigned long long - Offset into the memory object where the buffer's base is - size : unsigned long long - Size of the buffer + Offset within mip tail Offset within the memory + + + deviceBitMask : unsigned int + Device ordinal bit mask + + flags : unsigned int - Flags reserved for future use. Must be zero. - reserved : List[unsigned int] + flags for future use, must be zero now. + + + reserved : list[unsigned int] + Reserved for future use, must be zero now. Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._val_ptr = calloc(1, sizeof(cydriver.CUarrayMapInfo_st)) + self._pvt_ptr = self._val_ptr else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): pass + + self._resource = anon_union9(_ptr=self._pvt_ptr) + + + self._subresource = anon_union10(_ptr=self._pvt_ptr) + + + self._memHandle = anon_union11(_ptr=self._pvt_ptr) + def __dealloc__(self): - pass + if self._val_ptr is not NULL: + free(self._val_ptr) def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['offset : ' + str(self.offset)] + str_list += ['resourceType : ' + str(self.resourceType)] except ValueError: - str_list += ['offset : '] + str_list += ['resourceType : '] + + try: - str_list += ['size : ' + str(self.size)] + str_list += ['resource :\n' + '\n'.join([' ' + line for line in str(self.resource).splitlines()])] except ValueError: - str_list += ['size : '] + str_list += ['resource : '] + + try: - str_list += ['flags : ' + str(self.flags)] + str_list += ['subresourceType : ' + str(self.subresourceType)] except ValueError: - str_list += ['flags : '] + str_list += ['subresourceType : '] + + try: - str_list += ['reserved : ' + str(self.reserved)] + str_list += ['subresource :\n' + '\n'.join([' ' + line for line in str(self.subresource).splitlines()])] except ValueError: - str_list += ['reserved : '] - return '\n'.join(str_list) - else: - return '' - @property - def offset(self): - return self._ptr[0].offset - @offset.setter - def offset(self, unsigned long long offset): - self._ptr[0].offset = offset - @property - def size(self): - return self._ptr[0].size - @size.setter - def size(self, unsigned long long size): - self._ptr[0].size = size - @property - def flags(self): - return self._ptr[0].flags - @flags.setter - def flags(self, unsigned int flags): - self._ptr[0].flags = flags - @property - def reserved(self): - return self._ptr[0].reserved - @reserved.setter - def reserved(self, reserved): - self._ptr[0].reserved = reserved -{{endif}} -{{if 'struct CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_st' in found_types}} + str_list += ['subresource : '] -cdef class CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_st: - """ - External memory mipmap descriptor - Attributes - ---------- - offset : unsigned long long - Offset into the memory object where the base level of the mipmap - chain is. - arrayDesc : CUDA_ARRAY3D_DESCRIPTOR - Format, dimension and type of base level of the mipmap chain - numLevels : unsigned int - Total number of levels in the mipmap chain - reserved : List[unsigned int] + try: + str_list += ['memOperationType : ' + str(self.memOperationType)] + except ValueError: + str_list += ['memOperationType : '] - Methods - ------- - getPtr() - Get memory address of class instance + try: + str_list += ['memHandleType : ' + str(self.memHandleType)] + except ValueError: + str_list += ['memHandleType : '] + + + try: + str_list += ['memHandle :\n' + '\n'.join([' ' + line for line in str(self.memHandle).splitlines()])] + except ValueError: + str_list += ['memHandle : '] + - """ - def __cinit__(self, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - else: - self._ptr = _ptr - def __init__(self, void_ptr _ptr = 0): - self._arrayDesc = CUDA_ARRAY3D_DESCRIPTOR(_ptr=&self._ptr[0].arrayDesc) - def __dealloc__(self): - pass - def getPtr(self): - return self._ptr - def __repr__(self): - if self._ptr is not NULL: - str_list = [] try: str_list += ['offset : ' + str(self.offset)] except ValueError: str_list += ['offset : '] + + try: - str_list += ['arrayDesc :\n' + '\n'.join([' ' + line for line in str(self.arrayDesc).splitlines()])] + str_list += ['deviceBitMask : ' + str(self.deviceBitMask)] except ValueError: - str_list += ['arrayDesc : '] + str_list += ['deviceBitMask : '] + + try: - str_list += ['numLevels : ' + str(self.numLevels)] + str_list += ['flags : ' + str(self.flags)] except ValueError: - str_list += ['numLevels : '] + str_list += ['flags : '] + + try: str_list += ['reserved : ' + str(self.reserved)] except ValueError: str_list += ['reserved : '] + return '\n'.join(str_list) else: return '' + @property - def offset(self): - return self._ptr[0].offset - @offset.setter - def offset(self, unsigned long long offset): - self._ptr[0].offset = offset - @property - def arrayDesc(self): - return self._arrayDesc - @arrayDesc.setter - def arrayDesc(self, arrayDesc not None : CUDA_ARRAY3D_DESCRIPTOR): - string.memcpy(&self._ptr[0].arrayDesc, arrayDesc.getPtr(), sizeof(self._ptr[0].arrayDesc)) - @property - def numLevels(self): - return self._ptr[0].numLevels - @numLevels.setter - def numLevels(self, unsigned int numLevels): - self._ptr[0].numLevels = numLevels + def resourceType(self): + return CUresourcetype(self._pvt_ptr[0].resourceType) + @resourceType.setter + def resourceType(self, resourceType not None : CUresourcetype): + self._pvt_ptr[0].resourceType = int(resourceType) + + @property - def reserved(self): - return self._ptr[0].reserved - @reserved.setter - def reserved(self, reserved): - self._ptr[0].reserved = reserved -{{endif}} -{{if 'struct CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st' in found_types}} + def resource(self): + return self._resource + @resource.setter + def resource(self, resource not None : anon_union9): + string.memcpy(&self._pvt_ptr[0].resource, resource.getPtr(), sizeof(self._pvt_ptr[0].resource)) -cdef class anon_struct12: - """ - Attributes - ---------- - handle : Any - name : Any + @property + def subresourceType(self): + return CUarraySparseSubresourceType(self._pvt_ptr[0].subresourceType) + @subresourceType.setter + def subresourceType(self, subresourceType not None : CUarraySparseSubresourceType): + self._pvt_ptr[0].subresourceType = int(subresourceType) - Methods - ------- - getPtr() - Get memory address of class instance + @property + def subresource(self): + return self._subresource + @subresource.setter + def subresource(self, subresource not None : anon_union10): + string.memcpy(&self._pvt_ptr[0].subresource, subresource.getPtr(), sizeof(self._pvt_ptr[0].subresource)) - """ - def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr - def __init__(self, void_ptr _ptr): - pass - def __dealloc__(self): - pass - def getPtr(self): - return &self._ptr[0].handle.win32 - def __repr__(self): - if self._ptr is not NULL: - str_list = [] - try: - str_list += ['handle : ' + hex(self.handle)] - except ValueError: - str_list += ['handle : '] - try: - str_list += ['name : ' + hex(self.name)] - except ValueError: - str_list += ['name : '] - return '\n'.join(str_list) - else: - return '' @property - def handle(self): - return self._ptr[0].handle.win32.handle - @handle.setter - def handle(self, handle): - _chandle = utils.HelperInputVoidPtr(handle) - self._ptr[0].handle.win32.handle = _chandle.cptr + def memOperationType(self): + return CUmemOperationType(self._pvt_ptr[0].memOperationType) + @memOperationType.setter + def memOperationType(self, memOperationType not None : CUmemOperationType): + self._pvt_ptr[0].memOperationType = int(memOperationType) + + @property - def name(self): - return self._ptr[0].handle.win32.name - @name.setter - def name(self, name): - _cname = utils.HelperInputVoidPtr(name) - self._ptr[0].handle.win32.name = _cname.cptr -{{endif}} -{{if 'struct CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st' in found_types}} + def memHandleType(self): + return CUmemHandleType(self._pvt_ptr[0].memHandleType) + @memHandleType.setter + def memHandleType(self, memHandleType not None : CUmemHandleType): + self._pvt_ptr[0].memHandleType = int(memHandleType) -cdef class anon_union6: - """ - Attributes - ---------- - fd : int - win32 : anon_struct12 + @property + def memHandle(self): + return self._memHandle + @memHandle.setter + def memHandle(self, memHandle not None : anon_union11): + string.memcpy(&self._pvt_ptr[0].memHandle, memHandle.getPtr(), sizeof(self._pvt_ptr[0].memHandle)) - nvSciSyncObj : Any + + @property + def offset(self): + return self._pvt_ptr[0].offset + @offset.setter + def offset(self, unsigned long long offset): + self._pvt_ptr[0].offset = offset - Methods - ------- - getPtr() - Get memory address of class instance + @property + def deviceBitMask(self): + return self._pvt_ptr[0].deviceBitMask + @deviceBitMask.setter + def deviceBitMask(self, unsigned int deviceBitMask): + self._pvt_ptr[0].deviceBitMask = deviceBitMask - """ - def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr - def __init__(self, void_ptr _ptr): - self._win32 = anon_struct12(_ptr=self._ptr) - def __dealloc__(self): - pass - def getPtr(self): - return &self._ptr[0].handle - def __repr__(self): - if self._ptr is not NULL: - str_list = [] - try: - str_list += ['fd : ' + str(self.fd)] - except ValueError: - str_list += ['fd : '] - try: - str_list += ['win32 :\n' + '\n'.join([' ' + line for line in str(self.win32).splitlines()])] - except ValueError: - str_list += ['win32 : '] - try: - str_list += ['nvSciSyncObj : ' + hex(self.nvSciSyncObj)] - except ValueError: - str_list += ['nvSciSyncObj : '] - return '\n'.join(str_list) - else: - return '' @property - def fd(self): - return self._ptr[0].handle.fd - @fd.setter - def fd(self, int fd): - self._ptr[0].handle.fd = fd - @property - def win32(self): - return self._win32 - @win32.setter - def win32(self, win32 not None : anon_struct12): - string.memcpy(&self._ptr[0].handle.win32, win32.getPtr(), sizeof(self._ptr[0].handle.win32)) + def flags(self): + return self._pvt_ptr[0].flags + @flags.setter + def flags(self, unsigned int flags): + self._pvt_ptr[0].flags = flags + + @property - def nvSciSyncObj(self): - return self._ptr[0].handle.nvSciSyncObj - @nvSciSyncObj.setter - def nvSciSyncObj(self, nvSciSyncObj): - _cnvSciSyncObj = utils.HelperInputVoidPtr(nvSciSyncObj) - self._ptr[0].handle.nvSciSyncObj = _cnvSciSyncObj.cptr -{{endif}} -{{if 'struct CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st' in found_types}} + def reserved(self): + return self._pvt_ptr[0].reserved + @reserved.setter + def reserved(self, reserved): + self._pvt_ptr[0].reserved = reserved -cdef class CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st: + +cdef class CUmemLocation_st: """ - External semaphore handle descriptor + Specifies a memory location. Attributes ---------- - type : CUexternalSemaphoreHandleType - Type of the handle - handle : anon_union6 - flags : unsigned int - Flags reserved for the future. Must be zero. - reserved : List[unsigned int] + type : CUmemLocationType + Specifies the location type, which modifies the meaning of id. + + + id : int + Identifier for CUmemLocationType::CU_MEM_LOCATION_TYPE_DEVICE, + CUmemLocationType::CU_MEM_LOCATION_TYPE_HOST, + CUmemLocationType::CU_MEM_LOCATION_TYPE_HOST_NUMA. Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._val_ptr = calloc(1, sizeof(ccuda.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st)) - self._ptr = self._val_ptr + self._val_ptr = calloc(1, sizeof(cydriver.CUmemLocation_st)) + self._pvt_ptr = self._val_ptr else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - self._handle = anon_union6(_ptr=self._ptr) + pass def __dealloc__(self): if self._val_ptr is not NULL: free(self._val_ptr) def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: str_list += ['type : ' + str(self.type)] except ValueError: str_list += ['type : '] + + try: - str_list += ['handle :\n' + '\n'.join([' ' + line for line in str(self.handle).splitlines()])] - except ValueError: - str_list += ['handle : '] - try: - str_list += ['flags : ' + str(self.flags)] - except ValueError: - str_list += ['flags : '] - try: - str_list += ['reserved : ' + str(self.reserved)] + str_list += ['id : ' + str(self.id)] except ValueError: - str_list += ['reserved : '] + str_list += ['id : '] + return '\n'.join(str_list) else: return '' + @property def type(self): - return CUexternalSemaphoreHandleType(self._ptr[0].type) + return CUmemLocationType(self._pvt_ptr[0].type) @type.setter - def type(self, type not None : CUexternalSemaphoreHandleType): - self._ptr[0].type = type.value - @property - def handle(self): - return self._handle - @handle.setter - def handle(self, handle not None : anon_union6): - string.memcpy(&self._ptr[0].handle, handle.getPtr(), sizeof(self._ptr[0].handle)) - @property - def flags(self): - return self._ptr[0].flags - @flags.setter - def flags(self, unsigned int flags): - self._ptr[0].flags = flags + def type(self, type not None : CUmemLocationType): + self._pvt_ptr[0].type = int(type) + + @property - def reserved(self): - return self._ptr[0].reserved - @reserved.setter - def reserved(self, reserved): - self._ptr[0].reserved = reserved -{{endif}} -{{if 'struct CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st' in found_types}} + def id(self): + return self._pvt_ptr[0].id + @id.setter + def id(self, int id): + self._pvt_ptr[0].id = id -cdef class anon_struct13: + +cdef class anon_struct22: """ Attributes ---------- - value : unsigned long long + compressionType : bytes - Methods - ------- - getPtr() - Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr - def __init__(self, void_ptr _ptr): - pass - def __dealloc__(self): - pass - def getPtr(self): - return &self._ptr[0].params.fence - def __repr__(self): - if self._ptr is not NULL: - str_list = [] - try: - str_list += ['value : ' + str(self.value)] - except ValueError: - str_list += ['value : '] - return '\n'.join(str_list) - else: - return '' - @property - def value(self): - return self._ptr[0].params.fence.value - @value.setter - def value(self, unsigned long long value): - self._ptr[0].params.fence.value = value -{{endif}} -{{if 'struct CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st' in found_types}} + gpuDirectRDMACapable : bytes -cdef class anon_union7: - """ - Attributes - ---------- - fence : Any - reserved : unsigned long long + + usage : unsigned short + + + + reserved : bytes + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): pass def __dealloc__(self): pass def getPtr(self): - return &self._ptr[0].params.nvSciSync + return &self._pvt_ptr[0].allocFlags def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['fence : ' + hex(self.fence)] + str_list += ['compressionType : ' + str(self.compressionType)] except ValueError: - str_list += ['fence : '] + str_list += ['compressionType : '] + + + try: + str_list += ['gpuDirectRDMACapable : ' + str(self.gpuDirectRDMACapable)] + except ValueError: + str_list += ['gpuDirectRDMACapable : '] + + + try: + str_list += ['usage : ' + str(self.usage)] + except ValueError: + str_list += ['usage : '] + + try: str_list += ['reserved : ' + str(self.reserved)] except ValueError: str_list += ['reserved : '] + return '\n'.join(str_list) else: return '' + @property - def fence(self): - return self._ptr[0].params.nvSciSync.fence - @fence.setter - def fence(self, fence): - _cfence = utils.HelperInputVoidPtr(fence) - self._ptr[0].params.nvSciSync.fence = _cfence.cptr + def compressionType(self): + return self._pvt_ptr[0].allocFlags.compressionType + @compressionType.setter + def compressionType(self, unsigned char compressionType): + self._pvt_ptr[0].allocFlags.compressionType = compressionType + + + @property + def gpuDirectRDMACapable(self): + return self._pvt_ptr[0].allocFlags.gpuDirectRDMACapable + @gpuDirectRDMACapable.setter + def gpuDirectRDMACapable(self, unsigned char gpuDirectRDMACapable): + self._pvt_ptr[0].allocFlags.gpuDirectRDMACapable = gpuDirectRDMACapable + + + @property + def usage(self): + return self._pvt_ptr[0].allocFlags.usage + @usage.setter + def usage(self, unsigned short usage): + self._pvt_ptr[0].allocFlags.usage = usage + + @property def reserved(self): - return self._ptr[0].params.nvSciSync.reserved + return PyBytes_FromStringAndSize(self._pvt_ptr[0].allocFlags.reserved, 4) @reserved.setter - def reserved(self, unsigned long long reserved): - self._ptr[0].params.nvSciSync.reserved = reserved -{{endif}} -{{if 'struct CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st' in found_types}} + def reserved(self, reserved): + if len(reserved) != 4: + raise ValueError("reserved length must be 4, is " + str(len(reserved))) + for i, b in enumerate(reserved): + self._pvt_ptr[0].allocFlags.reserved[i] = b -cdef class anon_struct14: + +cdef class CUmemAllocationProp_st: """ + Specifies the allocation properties for a allocation. + Attributes ---------- - key : unsigned long long + + type : CUmemAllocationType + Allocation type - Methods - ------- - getPtr() - Get memory address of class instance + requestedHandleTypes : CUmemAllocationHandleType + requested CUmemAllocationHandleType - """ - def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr - def __init__(self, void_ptr _ptr): - pass - def __dealloc__(self): - pass - def getPtr(self): - return &self._ptr[0].params.keyedMutex - def __repr__(self): - if self._ptr is not NULL: - str_list = [] - try: - str_list += ['key : ' + str(self.key)] - except ValueError: - str_list += ['key : '] - return '\n'.join(str_list) - else: - return '' - @property - def key(self): - return self._ptr[0].params.keyedMutex.key - @key.setter - def key(self, unsigned long long key): - self._ptr[0].params.keyedMutex.key = key -{{endif}} -{{if 'struct CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st' in found_types}} + location : CUmemLocation + Location of allocation -cdef class anon_struct15: - """ - Attributes - ---------- - fence : anon_struct13 - nvSciSync : anon_union7 + win32HandleMetaData : Any + Windows-specific POBJECT_ATTRIBUTES required when + CU_MEM_HANDLE_TYPE_WIN32 is specified. This object attributes + structure includes security attributes that define the scope of + which exported allocations may be transferred to other processes. + In all other cases, this field is required to be zero. + - keyedMutex : anon_struct14 + allocFlags : anon_struct22 - reserved : List[unsigned int] Methods ------- getPtr() Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass + + self._location = CUmemLocation(_ptr=&self._pvt_ptr[0].location) + + + self._allocFlags = anon_struct22(_ptr=self._pvt_ptr) - def __init__(self, void_ptr _ptr): - self._fence = anon_struct13(_ptr=self._ptr) - self._nvSciSync = anon_union7(_ptr=self._ptr) - self._keyedMutex = anon_struct14(_ptr=self._ptr) def __dealloc__(self): pass def getPtr(self): - return &self._ptr[0].params + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['fence :\n' + '\n'.join([' ' + line for line in str(self.fence).splitlines()])] + str_list += ['type : ' + str(self.type)] except ValueError: - str_list += ['fence : '] + str_list += ['type : '] + + try: - str_list += ['nvSciSync :\n' + '\n'.join([' ' + line for line in str(self.nvSciSync).splitlines()])] + str_list += ['requestedHandleTypes : ' + str(self.requestedHandleTypes)] except ValueError: - str_list += ['nvSciSync : '] + str_list += ['requestedHandleTypes : '] + + try: - str_list += ['keyedMutex :\n' + '\n'.join([' ' + line for line in str(self.keyedMutex).splitlines()])] + str_list += ['location :\n' + '\n'.join([' ' + line for line in str(self.location).splitlines()])] except ValueError: - str_list += ['keyedMutex : '] + str_list += ['location : '] + + try: - str_list += ['reserved : ' + str(self.reserved)] + str_list += ['win32HandleMetaData : ' + hex(self.win32HandleMetaData)] except ValueError: - str_list += ['reserved : '] + str_list += ['win32HandleMetaData : '] + + + try: + str_list += ['allocFlags :\n' + '\n'.join([' ' + line for line in str(self.allocFlags).splitlines()])] + except ValueError: + str_list += ['allocFlags : '] + return '\n'.join(str_list) else: return '' + @property - def fence(self): - return self._fence - @fence.setter - def fence(self, fence not None : anon_struct13): - string.memcpy(&self._ptr[0].params.fence, fence.getPtr(), sizeof(self._ptr[0].params.fence)) + def type(self): + return CUmemAllocationType(self._pvt_ptr[0].type) + @type.setter + def type(self, type not None : CUmemAllocationType): + self._pvt_ptr[0].type = int(type) + + @property - def nvSciSync(self): - return self._nvSciSync - @nvSciSync.setter - def nvSciSync(self, nvSciSync not None : anon_union7): - string.memcpy(&self._ptr[0].params.nvSciSync, nvSciSync.getPtr(), sizeof(self._ptr[0].params.nvSciSync)) + def requestedHandleTypes(self): + return CUmemAllocationHandleType(self._pvt_ptr[0].requestedHandleTypes) + @requestedHandleTypes.setter + def requestedHandleTypes(self, requestedHandleTypes not None : CUmemAllocationHandleType): + self._pvt_ptr[0].requestedHandleTypes = int(requestedHandleTypes) + + @property - def keyedMutex(self): - return self._keyedMutex - @keyedMutex.setter - def keyedMutex(self, keyedMutex not None : anon_struct14): - string.memcpy(&self._ptr[0].params.keyedMutex, keyedMutex.getPtr(), sizeof(self._ptr[0].params.keyedMutex)) + def location(self): + return self._location + @location.setter + def location(self, location not None : CUmemLocation): + string.memcpy(&self._pvt_ptr[0].location, location.getPtr(), sizeof(self._pvt_ptr[0].location)) + + @property - def reserved(self): - return self._ptr[0].params.reserved - @reserved.setter - def reserved(self, reserved): - self._ptr[0].params.reserved = reserved -{{endif}} -{{if 'struct CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st' in found_types}} + def win32HandleMetaData(self): + return self._pvt_ptr[0].win32HandleMetaData + @win32HandleMetaData.setter + def win32HandleMetaData(self, win32HandleMetaData): + self._cywin32HandleMetaData = _HelperInputVoidPtr(win32HandleMetaData) + self._pvt_ptr[0].win32HandleMetaData = self._cywin32HandleMetaData.cptr -cdef class CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st: + + @property + def allocFlags(self): + return self._allocFlags + @allocFlags.setter + def allocFlags(self, allocFlags not None : anon_struct22): + string.memcpy(&self._pvt_ptr[0].allocFlags, allocFlags.getPtr(), sizeof(self._pvt_ptr[0].allocFlags)) + + +cdef class CUmulticastObjectProp_st: """ - External semaphore signal parameters + Specifies the properties for a multicast object. Attributes ---------- - params : anon_struct15 - flags : unsigned int - Only when ::CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS is used to signal - a CUexternalSemaphore of type - CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC, the valid flag is - CUDA_EXTERNAL_SEMAPHORE_SIGNAL_SKIP_NVSCIBUF_MEMSYNC which - indicates that while signaling the CUexternalSemaphore, no memory - synchronization operations should be performed for any external - memory object imported as CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF. - For all other types of CUexternalSemaphore, flags must be zero. - reserved : List[unsigned int] + numDevices : unsigned int + The number of devices in the multicast team that will bind memory + to this object + + + size : size_t + The maximum amount of memory that can be bound to this multicast + object per device + + + handleTypes : unsigned long long + Bitmask of exportable handle types (see CUmemAllocationHandleType) + for this object + + + flags : unsigned long long + Flags for future use, must be zero now Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - self._params = anon_struct15(_ptr=self._ptr) + pass def __dealloc__(self): pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['params :\n' + '\n'.join([' ' + line for line in str(self.params).splitlines()])] + str_list += ['numDevices : ' + str(self.numDevices)] except ValueError: - str_list += ['params : '] + str_list += ['numDevices : '] + + try: - str_list += ['flags : ' + str(self.flags)] + str_list += ['size : ' + str(self.size)] except ValueError: - str_list += ['flags : '] + str_list += ['size : '] + + try: - str_list += ['reserved : ' + str(self.reserved)] + str_list += ['handleTypes : ' + str(self.handleTypes)] except ValueError: - str_list += ['reserved : '] + str_list += ['handleTypes : '] + + + try: + str_list += ['flags : ' + str(self.flags)] + except ValueError: + str_list += ['flags : '] + return '\n'.join(str_list) else: return '' + @property - def params(self): - return self._params - @params.setter - def params(self, params not None : anon_struct15): - string.memcpy(&self._ptr[0].params, params.getPtr(), sizeof(self._ptr[0].params)) - @property - def flags(self): - return self._ptr[0].flags - @flags.setter - def flags(self, unsigned int flags): - self._ptr[0].flags = flags - @property - def reserved(self): - return self._ptr[0].reserved - @reserved.setter - def reserved(self, reserved): - self._ptr[0].reserved = reserved -{{endif}} -{{if 'struct CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st' in found_types}} + def numDevices(self): + return self._pvt_ptr[0].numDevices + @numDevices.setter + def numDevices(self, unsigned int numDevices): + self._pvt_ptr[0].numDevices = numDevices -cdef class anon_struct16: - """ - Attributes - ---------- - value : unsigned long long + @property + def size(self): + return self._pvt_ptr[0].size + @size.setter + def size(self, size_t size): + self._pvt_ptr[0].size = size - Methods - ------- - getPtr() - Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr + @property + def handleTypes(self): + return self._pvt_ptr[0].handleTypes + @handleTypes.setter + def handleTypes(self, unsigned long long handleTypes): + self._pvt_ptr[0].handleTypes = handleTypes + - def __init__(self, void_ptr _ptr): - pass - def __dealloc__(self): - pass - def getPtr(self): - return &self._ptr[0].params.fence - def __repr__(self): - if self._ptr is not NULL: - str_list = [] - try: - str_list += ['value : ' + str(self.value)] - except ValueError: - str_list += ['value : '] - return '\n'.join(str_list) - else: - return '' @property - def value(self): - return self._ptr[0].params.fence.value - @value.setter - def value(self, unsigned long long value): - self._ptr[0].params.fence.value = value -{{endif}} -{{if 'struct CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st' in found_types}} + def flags(self): + return self._pvt_ptr[0].flags + @flags.setter + def flags(self, unsigned long long flags): + self._pvt_ptr[0].flags = flags -cdef class anon_union8: + +cdef class CUmemAccessDesc_st: """ + Memory access descriptor + Attributes ---------- - fence : Any - reserved : unsigned long long + location : CUmemLocation + Location on which the request is to change it's accessibility + + + flags : CUmemAccess_flags + ::CUmemProt accessibility flags to set on the request Methods ------- getPtr() Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr - - def __init__(self, void_ptr _ptr): + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): pass + + self._location = CUmemLocation(_ptr=&self._pvt_ptr[0].location) + def __dealloc__(self): pass def getPtr(self): - return &self._ptr[0].params.nvSciSync + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['fence : ' + hex(self.fence)] + str_list += ['location :\n' + '\n'.join([' ' + line for line in str(self.location).splitlines()])] except ValueError: - str_list += ['fence : '] + str_list += ['location : '] + + try: - str_list += ['reserved : ' + str(self.reserved)] + str_list += ['flags : ' + str(self.flags)] except ValueError: - str_list += ['reserved : '] + str_list += ['flags : '] + return '\n'.join(str_list) else: return '' + @property - def fence(self): - return self._ptr[0].params.nvSciSync.fence - @fence.setter - def fence(self, fence): - _cfence = utils.HelperInputVoidPtr(fence) - self._ptr[0].params.nvSciSync.fence = _cfence.cptr + def location(self): + return self._location + @location.setter + def location(self, location not None : CUmemLocation): + string.memcpy(&self._pvt_ptr[0].location, location.getPtr(), sizeof(self._pvt_ptr[0].location)) + + @property - def reserved(self): - return self._ptr[0].params.nvSciSync.reserved - @reserved.setter - def reserved(self, unsigned long long reserved): - self._ptr[0].params.nvSciSync.reserved = reserved -{{endif}} -{{if 'struct CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st' in found_types}} + def flags(self): + return CUmemAccess_flags(self._pvt_ptr[0].flags) + @flags.setter + def flags(self, flags not None : CUmemAccess_flags): + self._pvt_ptr[0].flags = int(flags) -cdef class anon_struct17: + +cdef class CUgraphExecUpdateResultInfo_st: """ + Result information returned by cuGraphExecUpdate + Attributes ---------- - key : unsigned long long - timeoutMs : unsigned int + result : CUgraphExecUpdateResult + Gives more specific detail when a cuda graph update fails. + + + errorNode : CUgraphNode + The "to node" of the error edge when the topologies do not match. + The error node when the error is associated with a specific node. + NULL when the error is generic. + + + errorFromNode : CUgraphNode + The from node of error edge when the topologies do not match. + Otherwise NULL. Methods ------- getPtr() Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr - - def __init__(self, void_ptr _ptr): + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): pass + + self._errorNode = CUgraphNode(_ptr=&self._pvt_ptr[0].errorNode) + + + self._errorFromNode = CUgraphNode(_ptr=&self._pvt_ptr[0].errorFromNode) + def __dealloc__(self): pass def getPtr(self): - return &self._ptr[0].params.keyedMutex + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + + try: + str_list += ['result : ' + str(self.result)] + except ValueError: + str_list += ['result : '] + + try: - str_list += ['key : ' + str(self.key)] + str_list += ['errorNode : ' + str(self.errorNode)] except ValueError: - str_list += ['key : '] + str_list += ['errorNode : '] + + try: - str_list += ['timeoutMs : ' + str(self.timeoutMs)] + str_list += ['errorFromNode : ' + str(self.errorFromNode)] except ValueError: - str_list += ['timeoutMs : '] + str_list += ['errorFromNode : '] + return '\n'.join(str_list) else: return '' + @property - def key(self): - return self._ptr[0].params.keyedMutex.key - @key.setter - def key(self, unsigned long long key): - self._ptr[0].params.keyedMutex.key = key + def result(self): + return CUgraphExecUpdateResult(self._pvt_ptr[0].result) + @result.setter + def result(self, result not None : CUgraphExecUpdateResult): + self._pvt_ptr[0].result = int(result) + + @property - def timeoutMs(self): - return self._ptr[0].params.keyedMutex.timeoutMs - @timeoutMs.setter - def timeoutMs(self, unsigned int timeoutMs): - self._ptr[0].params.keyedMutex.timeoutMs = timeoutMs -{{endif}} -{{if 'struct CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st' in found_types}} + def errorNode(self): + return self._errorNode + @errorNode.setter + def errorNode(self, errorNode): + cdef cydriver.CUgraphNode cyerrorNode + if errorNode is None: + cyerrorNode = 0 + elif isinstance(errorNode, (CUgraphNode,)): + perrorNode = int(errorNode) + cyerrorNode = perrorNode + else: + perrorNode = int(CUgraphNode(errorNode)) + cyerrorNode = perrorNode + self._errorNode._pvt_ptr[0] = cyerrorNode -cdef class anon_struct18: + + @property + def errorFromNode(self): + return self._errorFromNode + @errorFromNode.setter + def errorFromNode(self, errorFromNode): + cdef cydriver.CUgraphNode cyerrorFromNode + if errorFromNode is None: + cyerrorFromNode = 0 + elif isinstance(errorFromNode, (CUgraphNode,)): + perrorFromNode = int(errorFromNode) + cyerrorFromNode = perrorFromNode + else: + perrorFromNode = int(CUgraphNode(errorFromNode)) + cyerrorFromNode = perrorFromNode + self._errorFromNode._pvt_ptr[0] = cyerrorFromNode + + +cdef class CUmemPoolProps_st: """ + Specifies the properties of allocations made from the pool. + Attributes ---------- - fence : anon_struct16 - nvSciSync : anon_union8 + allocType : CUmemAllocationType + Allocation type. Currently must be specified as + CU_MEM_ALLOCATION_TYPE_PINNED + + + handleTypes : CUmemAllocationHandleType + Handle types that will be supported by allocations from the pool. + + + location : CUmemLocation + Location where allocations should reside. + + + win32SecurityAttributes : Any + Windows-specific LPSECURITYATTRIBUTES required when + CU_MEM_HANDLE_TYPE_WIN32 is specified. This security attribute + defines the scope of which exported allocations may be transferred + to other processes. In all other cases, this field is required to + be zero. + + + maxSize : size_t + Maximum pool size. When set to 0, defaults to a system dependent + value. - keyedMutex : anon_struct17 - reserved : List[unsigned int] + usage : unsigned short + Bitmask indicating intended usage for the pool. + + + reserved : bytes + reserved for future use, must be 0 Methods ------- getPtr() Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass + + self._location = CUmemLocation(_ptr=&self._pvt_ptr[0].location) - def __init__(self, void_ptr _ptr): - self._fence = anon_struct16(_ptr=self._ptr) - self._nvSciSync = anon_union8(_ptr=self._ptr) - self._keyedMutex = anon_struct17(_ptr=self._ptr) def __dealloc__(self): pass def getPtr(self): - return &self._ptr[0].params + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['fence :\n' + '\n'.join([' ' + line for line in str(self.fence).splitlines()])] + str_list += ['allocType : ' + str(self.allocType)] except ValueError: - str_list += ['fence : '] + str_list += ['allocType : '] + + try: - str_list += ['nvSciSync :\n' + '\n'.join([' ' + line for line in str(self.nvSciSync).splitlines()])] + str_list += ['handleTypes : ' + str(self.handleTypes)] except ValueError: - str_list += ['nvSciSync : '] + str_list += ['handleTypes : '] + + try: - str_list += ['keyedMutex :\n' + '\n'.join([' ' + line for line in str(self.keyedMutex).splitlines()])] + str_list += ['location :\n' + '\n'.join([' ' + line for line in str(self.location).splitlines()])] except ValueError: - str_list += ['keyedMutex : '] + str_list += ['location : '] + + + try: + str_list += ['win32SecurityAttributes : ' + hex(self.win32SecurityAttributes)] + except ValueError: + str_list += ['win32SecurityAttributes : '] + + + try: + str_list += ['maxSize : ' + str(self.maxSize)] + except ValueError: + str_list += ['maxSize : '] + + + try: + str_list += ['usage : ' + str(self.usage)] + except ValueError: + str_list += ['usage : '] + + try: str_list += ['reserved : ' + str(self.reserved)] except ValueError: str_list += ['reserved : '] + return '\n'.join(str_list) else: return '' + @property - def fence(self): - return self._fence - @fence.setter - def fence(self, fence not None : anon_struct16): - string.memcpy(&self._ptr[0].params.fence, fence.getPtr(), sizeof(self._ptr[0].params.fence)) + def allocType(self): + return CUmemAllocationType(self._pvt_ptr[0].allocType) + @allocType.setter + def allocType(self, allocType not None : CUmemAllocationType): + self._pvt_ptr[0].allocType = int(allocType) + + @property - def nvSciSync(self): - return self._nvSciSync - @nvSciSync.setter - def nvSciSync(self, nvSciSync not None : anon_union8): - string.memcpy(&self._ptr[0].params.nvSciSync, nvSciSync.getPtr(), sizeof(self._ptr[0].params.nvSciSync)) + def handleTypes(self): + return CUmemAllocationHandleType(self._pvt_ptr[0].handleTypes) + @handleTypes.setter + def handleTypes(self, handleTypes not None : CUmemAllocationHandleType): + self._pvt_ptr[0].handleTypes = int(handleTypes) + + @property - def keyedMutex(self): - return self._keyedMutex - @keyedMutex.setter - def keyedMutex(self, keyedMutex not None : anon_struct17): - string.memcpy(&self._ptr[0].params.keyedMutex, keyedMutex.getPtr(), sizeof(self._ptr[0].params.keyedMutex)) + def location(self): + return self._location + @location.setter + def location(self, location not None : CUmemLocation): + string.memcpy(&self._pvt_ptr[0].location, location.getPtr(), sizeof(self._pvt_ptr[0].location)) + + + @property + def win32SecurityAttributes(self): + return self._pvt_ptr[0].win32SecurityAttributes + @win32SecurityAttributes.setter + def win32SecurityAttributes(self, win32SecurityAttributes): + self._cywin32SecurityAttributes = _HelperInputVoidPtr(win32SecurityAttributes) + self._pvt_ptr[0].win32SecurityAttributes = self._cywin32SecurityAttributes.cptr + + + @property + def maxSize(self): + return self._pvt_ptr[0].maxSize + @maxSize.setter + def maxSize(self, size_t maxSize): + self._pvt_ptr[0].maxSize = maxSize + + + @property + def usage(self): + return self._pvt_ptr[0].usage + @usage.setter + def usage(self, unsigned short usage): + self._pvt_ptr[0].usage = usage + + @property def reserved(self): - return self._ptr[0].params.reserved + return PyBytes_FromStringAndSize(self._pvt_ptr[0].reserved, 54) @reserved.setter def reserved(self, reserved): - self._ptr[0].params.reserved = reserved -{{endif}} -{{if 'struct CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st' in found_types}} + if len(reserved) != 54: + raise ValueError("reserved length must be 54, is " + str(len(reserved))) + for i, b in enumerate(reserved): + self._pvt_ptr[0].reserved[i] = b -cdef class CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st: + +cdef class CUmemPoolPtrExportData_st: """ - External semaphore wait parameters + Opaque data for exporting a pool allocation Attributes ---------- - params : anon_struct18 - flags : unsigned int - Only when ::CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS is used to wait on - a CUexternalSemaphore of type - CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC, the valid flag is - CUDA_EXTERNAL_SEMAPHORE_WAIT_SKIP_NVSCIBUF_MEMSYNC which indicates - that while waiting for the CUexternalSemaphore, no memory - synchronization operations should be performed for any external - memory object imported as CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF. - For all other types of CUexternalSemaphore, flags must be zero. - reserved : List[unsigned int] + reserved : bytes + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - self._params = anon_struct18(_ptr=self._ptr) + pass def __dealloc__(self): pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] - try: - str_list += ['params :\n' + '\n'.join([' ' + line for line in str(self.params).splitlines()])] - except ValueError: - str_list += ['params : '] - try: - str_list += ['flags : ' + str(self.flags)] - except ValueError: - str_list += ['flags : '] + try: str_list += ['reserved : ' + str(self.reserved)] except ValueError: str_list += ['reserved : '] + return '\n'.join(str_list) else: return '' - @property - def params(self): - return self._params - @params.setter - def params(self, params not None : anon_struct18): - string.memcpy(&self._ptr[0].params, params.getPtr(), sizeof(self._ptr[0].params)) - @property - def flags(self): - return self._ptr[0].flags - @flags.setter - def flags(self, unsigned int flags): - self._ptr[0].flags = flags + @property def reserved(self): - return self._ptr[0].reserved + return PyBytes_FromStringAndSize(self._pvt_ptr[0].reserved, 64) @reserved.setter def reserved(self, reserved): - self._ptr[0].reserved = reserved -{{endif}} -{{if 'struct CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_st' in found_types}} + if len(reserved) != 64: + raise ValueError("reserved length must be 64, is " + str(len(reserved))) + for i, b in enumerate(reserved): + self._pvt_ptr[0].reserved[i] = b -cdef class CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_st: + +cdef class CUmemcpyAttributes_st: """ - Semaphore signal node parameters + Attributes specific to copies within a batch. For more details on + usage see cuMemcpyBatchAsync. Attributes ---------- - extSemArray : CUexternalSemaphore - Array of external semaphore handles. - paramsArray : CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS - Array of external semaphore signal parameters. - numExtSems : unsigned int - Number of handles and parameters supplied in extSemArray and - paramsArray. + + srcAccessOrder : CUmemcpySrcAccessOrder + Source access ordering to be observed for copies with this + attribute. + + + srcLocHint : CUmemLocation + Hint location for the source operand. Ignored when the pointers are + not managed memory or memory allocated outside CUDA. + + + dstLocHint : CUmemLocation + Hint location for the destination operand. Ignored when the + pointers are not managed memory or memory allocated outside CUDA. + + + flags : unsigned int + Additional flags for copies with this attribute. See CUmemcpyFlags + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): pass + + self._srcLocHint = CUmemLocation(_ptr=&self._pvt_ptr[0].srcLocHint) + + + self._dstLocHint = CUmemLocation(_ptr=&self._pvt_ptr[0].dstLocHint) + def __dealloc__(self): - if self._extSemArray is not NULL: - free(self._extSemArray) - if self._paramsArray is not NULL: - free(self._paramsArray) + pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['extSemArray : ' + str(self.extSemArray)] + str_list += ['srcAccessOrder : ' + str(self.srcAccessOrder)] except ValueError: - str_list += ['extSemArray : '] + str_list += ['srcAccessOrder : '] + + try: - str_list += ['paramsArray : ' + str(self.paramsArray)] + str_list += ['srcLocHint :\n' + '\n'.join([' ' + line for line in str(self.srcLocHint).splitlines()])] except ValueError: - str_list += ['paramsArray : '] + str_list += ['srcLocHint : '] + + try: - str_list += ['numExtSems : ' + str(self.numExtSems)] + str_list += ['dstLocHint :\n' + '\n'.join([' ' + line for line in str(self.dstLocHint).splitlines()])] except ValueError: - str_list += ['numExtSems : '] + str_list += ['dstLocHint : '] + + + try: + str_list += ['flags : ' + str(self.flags)] + except ValueError: + str_list += ['flags : '] + return '\n'.join(str_list) else: return '' + @property - def extSemArray(self): - arrs = [self._ptr[0].extSemArray + x*sizeof(ccuda.CUexternalSemaphore) for x in range(self._extSemArray_length)] - return [CUexternalSemaphore(_ptr=arr) for arr in arrs] - @extSemArray.setter - def extSemArray(self, val): - if len(val) == 0: - free(self._extSemArray) - self._extSemArray_length = 0 - self._ptr[0].extSemArray = NULL - else: - if self._extSemArray_length != len(val): - free(self._extSemArray) - self._extSemArray = calloc(len(val), sizeof(ccuda.CUexternalSemaphore)) - if self._extSemArray is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(ccuda.CUexternalSemaphore))) - self._extSemArray_length = len(val) - self._ptr[0].extSemArray = self._extSemArray - for idx in range(len(val)): - self._extSemArray[idx] = (val[idx])._ptr[0] + def srcAccessOrder(self): + return CUmemcpySrcAccessOrder(self._pvt_ptr[0].srcAccessOrder) + @srcAccessOrder.setter + def srcAccessOrder(self, srcAccessOrder not None : CUmemcpySrcAccessOrder): + self._pvt_ptr[0].srcAccessOrder = int(srcAccessOrder) + @property - def paramsArray(self): - arrs = [self._ptr[0].paramsArray + x*sizeof(ccuda.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS) for x in range(self._paramsArray_length)] - return [CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS(_ptr=arr) for arr in arrs] - @paramsArray.setter - def paramsArray(self, val): - if len(val) == 0: - free(self._paramsArray) - self._paramsArray_length = 0 - self._ptr[0].paramsArray = NULL - else: - if self._paramsArray_length != len(val): - free(self._paramsArray) - self._paramsArray = calloc(len(val), sizeof(ccuda.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS)) - if self._paramsArray is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(ccuda.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS))) - self._paramsArray_length = len(val) - self._ptr[0].paramsArray = self._paramsArray - for idx in range(len(val)): - string.memcpy(&self._paramsArray[idx], (val[idx])._ptr, sizeof(ccuda.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS)) + def srcLocHint(self): + return self._srcLocHint + @srcLocHint.setter + def srcLocHint(self, srcLocHint not None : CUmemLocation): + string.memcpy(&self._pvt_ptr[0].srcLocHint, srcLocHint.getPtr(), sizeof(self._pvt_ptr[0].srcLocHint)) + @property - def numExtSems(self): - return self._ptr[0].numExtSems - @numExtSems.setter - def numExtSems(self, unsigned int numExtSems): - self._ptr[0].numExtSems = numExtSems -{{endif}} -{{if 'struct CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2_st' in found_types}} + def dstLocHint(self): + return self._dstLocHint + @dstLocHint.setter + def dstLocHint(self, dstLocHint not None : CUmemLocation): + string.memcpy(&self._pvt_ptr[0].dstLocHint, dstLocHint.getPtr(), sizeof(self._pvt_ptr[0].dstLocHint)) -cdef class CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2_st: + + @property + def flags(self): + return self._pvt_ptr[0].flags + @flags.setter + def flags(self, unsigned int flags): + self._pvt_ptr[0].flags = flags + + +cdef class CUoffset3D_st: """ - Semaphore signal node parameters + Struct representing a 3D offset Attributes ---------- - extSemArray : CUexternalSemaphore - Array of external semaphore handles. - paramsArray : CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS - Array of external semaphore signal parameters. - numExtSems : unsigned int - Number of handles and parameters supplied in extSemArray and - paramsArray. + + x : size_t + + + + y : size_t + + + + z : size_t + + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): pass def __dealloc__(self): - if self._extSemArray is not NULL: - free(self._extSemArray) - if self._paramsArray is not NULL: - free(self._paramsArray) + pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['extSemArray : ' + str(self.extSemArray)] + str_list += ['x : ' + str(self.x)] except ValueError: - str_list += ['extSemArray : '] + str_list += ['x : '] + + try: - str_list += ['paramsArray : ' + str(self.paramsArray)] + str_list += ['y : ' + str(self.y)] except ValueError: - str_list += ['paramsArray : '] + str_list += ['y : '] + + try: - str_list += ['numExtSems : ' + str(self.numExtSems)] + str_list += ['z : ' + str(self.z)] except ValueError: - str_list += ['numExtSems : '] + str_list += ['z : '] + return '\n'.join(str_list) else: return '' + @property - def extSemArray(self): - arrs = [self._ptr[0].extSemArray + x*sizeof(ccuda.CUexternalSemaphore) for x in range(self._extSemArray_length)] - return [CUexternalSemaphore(_ptr=arr) for arr in arrs] - @extSemArray.setter - def extSemArray(self, val): - if len(val) == 0: - free(self._extSemArray) - self._extSemArray_length = 0 - self._ptr[0].extSemArray = NULL - else: - if self._extSemArray_length != len(val): - free(self._extSemArray) - self._extSemArray = calloc(len(val), sizeof(ccuda.CUexternalSemaphore)) - if self._extSemArray is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(ccuda.CUexternalSemaphore))) - self._extSemArray_length = len(val) - self._ptr[0].extSemArray = self._extSemArray - for idx in range(len(val)): - self._extSemArray[idx] = (val[idx])._ptr[0] + def x(self): + return self._pvt_ptr[0].x + @x.setter + def x(self, size_t x): + self._pvt_ptr[0].x = x + @property - def paramsArray(self): - arrs = [self._ptr[0].paramsArray + x*sizeof(ccuda.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS) for x in range(self._paramsArray_length)] - return [CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS(_ptr=arr) for arr in arrs] - @paramsArray.setter - def paramsArray(self, val): - if len(val) == 0: - free(self._paramsArray) - self._paramsArray_length = 0 - self._ptr[0].paramsArray = NULL - else: - if self._paramsArray_length != len(val): - free(self._paramsArray) - self._paramsArray = calloc(len(val), sizeof(ccuda.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS)) - if self._paramsArray is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(ccuda.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS))) - self._paramsArray_length = len(val) - self._ptr[0].paramsArray = self._paramsArray - for idx in range(len(val)): - string.memcpy(&self._paramsArray[idx], (val[idx])._ptr, sizeof(ccuda.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS)) + def y(self): + return self._pvt_ptr[0].y + @y.setter + def y(self, size_t y): + self._pvt_ptr[0].y = y + @property - def numExtSems(self): - return self._ptr[0].numExtSems - @numExtSems.setter - def numExtSems(self, unsigned int numExtSems): - self._ptr[0].numExtSems = numExtSems -{{endif}} -{{if 'struct CUDA_EXT_SEM_WAIT_NODE_PARAMS_st' in found_types}} + def z(self): + return self._pvt_ptr[0].z + @z.setter + def z(self, size_t z): + self._pvt_ptr[0].z = z -cdef class CUDA_EXT_SEM_WAIT_NODE_PARAMS_st: + +cdef class CUextent3D_st: """ - Semaphore wait node parameters + Struct representing width/height/depth of a CUarray in elements Attributes ---------- - extSemArray : CUexternalSemaphore - Array of external semaphore handles. - paramsArray : CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS - Array of external semaphore wait parameters. - numExtSems : unsigned int - Number of handles and parameters supplied in extSemArray and - paramsArray. + + width : size_t + + + + height : size_t + + + + depth : size_t + + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): pass def __dealloc__(self): - if self._extSemArray is not NULL: - free(self._extSemArray) - if self._paramsArray is not NULL: - free(self._paramsArray) + pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['extSemArray : ' + str(self.extSemArray)] + str_list += ['width : ' + str(self.width)] except ValueError: - str_list += ['extSemArray : '] + str_list += ['width : '] + + try: - str_list += ['paramsArray : ' + str(self.paramsArray)] + str_list += ['height : ' + str(self.height)] except ValueError: - str_list += ['paramsArray : '] + str_list += ['height : '] + + try: - str_list += ['numExtSems : ' + str(self.numExtSems)] + str_list += ['depth : ' + str(self.depth)] except ValueError: - str_list += ['numExtSems : '] + str_list += ['depth : '] + return '\n'.join(str_list) else: return '' + @property - def extSemArray(self): - arrs = [self._ptr[0].extSemArray + x*sizeof(ccuda.CUexternalSemaphore) for x in range(self._extSemArray_length)] - return [CUexternalSemaphore(_ptr=arr) for arr in arrs] - @extSemArray.setter - def extSemArray(self, val): - if len(val) == 0: - free(self._extSemArray) - self._extSemArray_length = 0 - self._ptr[0].extSemArray = NULL - else: - if self._extSemArray_length != len(val): - free(self._extSemArray) - self._extSemArray = calloc(len(val), sizeof(ccuda.CUexternalSemaphore)) - if self._extSemArray is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(ccuda.CUexternalSemaphore))) - self._extSemArray_length = len(val) - self._ptr[0].extSemArray = self._extSemArray - for idx in range(len(val)): - self._extSemArray[idx] = (val[idx])._ptr[0] + def width(self): + return self._pvt_ptr[0].width + @width.setter + def width(self, size_t width): + self._pvt_ptr[0].width = width + @property - def paramsArray(self): - arrs = [self._ptr[0].paramsArray + x*sizeof(ccuda.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS) for x in range(self._paramsArray_length)] - return [CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS(_ptr=arr) for arr in arrs] - @paramsArray.setter - def paramsArray(self, val): - if len(val) == 0: - free(self._paramsArray) - self._paramsArray_length = 0 - self._ptr[0].paramsArray = NULL - else: - if self._paramsArray_length != len(val): - free(self._paramsArray) - self._paramsArray = calloc(len(val), sizeof(ccuda.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS)) - if self._paramsArray is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(ccuda.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS))) - self._paramsArray_length = len(val) - self._ptr[0].paramsArray = self._paramsArray - for idx in range(len(val)): - string.memcpy(&self._paramsArray[idx], (val[idx])._ptr, sizeof(ccuda.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS)) + def height(self): + return self._pvt_ptr[0].height + @height.setter + def height(self, size_t height): + self._pvt_ptr[0].height = height + @property - def numExtSems(self): - return self._ptr[0].numExtSems - @numExtSems.setter - def numExtSems(self, unsigned int numExtSems): - self._ptr[0].numExtSems = numExtSems -{{endif}} -{{if 'struct CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2_st' in found_types}} + def depth(self): + return self._pvt_ptr[0].depth + @depth.setter + def depth(self, size_t depth): + self._pvt_ptr[0].depth = depth -cdef class CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2_st: - """ - Semaphore wait node parameters +cdef class anon_struct23: + """ Attributes ---------- - extSemArray : CUexternalSemaphore - Array of external semaphore handles. - paramsArray : CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS - Array of external semaphore wait parameters. - numExtSems : unsigned int - Number of handles and parameters supplied in extSemArray and - paramsArray. + + ptr : CUdeviceptr + + + + rowLength : size_t + + + + layerHeight : size_t + + + + locHint : CUmemLocation + + Methods ------- getPtr() Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - else: - self._ptr = _ptr - def __init__(self, void_ptr _ptr = 0): + def __cinit__(self, void_ptr _ptr): + self._pvt_ptr = _ptr + + def __init__(self, void_ptr _ptr): pass + + self._ptr = CUdeviceptr(_ptr=&self._pvt_ptr[0].op.ptr.ptr) + + + self._locHint = CUmemLocation(_ptr=&self._pvt_ptr[0].op.ptr.locHint) + def __dealloc__(self): - if self._extSemArray is not NULL: - free(self._extSemArray) - if self._paramsArray is not NULL: - free(self._paramsArray) + pass def getPtr(self): - return self._ptr + return &self._pvt_ptr[0].op.ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['extSemArray : ' + str(self.extSemArray)] + str_list += ['ptr : ' + str(self.ptr)] except ValueError: - str_list += ['extSemArray : '] + str_list += ['ptr : '] + + + try: + str_list += ['rowLength : ' + str(self.rowLength)] + except ValueError: + str_list += ['rowLength : '] + + try: - str_list += ['paramsArray : ' + str(self.paramsArray)] + str_list += ['layerHeight : ' + str(self.layerHeight)] except ValueError: - str_list += ['paramsArray : '] + str_list += ['layerHeight : '] + + try: - str_list += ['numExtSems : ' + str(self.numExtSems)] + str_list += ['locHint :\n' + '\n'.join([' ' + line for line in str(self.locHint).splitlines()])] except ValueError: - str_list += ['numExtSems : '] + str_list += ['locHint : '] + return '\n'.join(str_list) else: return '' + @property - def extSemArray(self): - arrs = [self._ptr[0].extSemArray + x*sizeof(ccuda.CUexternalSemaphore) for x in range(self._extSemArray_length)] - return [CUexternalSemaphore(_ptr=arr) for arr in arrs] - @extSemArray.setter - def extSemArray(self, val): - if len(val) == 0: - free(self._extSemArray) - self._extSemArray_length = 0 - self._ptr[0].extSemArray = NULL + def ptr(self): + return self._ptr + @ptr.setter + def ptr(self, ptr): + cdef cydriver.CUdeviceptr cyptr + if ptr is None: + cyptr = 0 + elif isinstance(ptr, (CUdeviceptr)): + pptr = int(ptr) + cyptr = pptr else: - if self._extSemArray_length != len(val): - free(self._extSemArray) - self._extSemArray = calloc(len(val), sizeof(ccuda.CUexternalSemaphore)) - if self._extSemArray is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(ccuda.CUexternalSemaphore))) - self._extSemArray_length = len(val) - self._ptr[0].extSemArray = self._extSemArray - for idx in range(len(val)): - self._extSemArray[idx] = (val[idx])._ptr[0] + pptr = int(CUdeviceptr(ptr)) + cyptr = pptr + self._ptr._pvt_ptr[0] = cyptr + + @property - def paramsArray(self): - arrs = [self._ptr[0].paramsArray + x*sizeof(ccuda.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS) for x in range(self._paramsArray_length)] - return [CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS(_ptr=arr) for arr in arrs] - @paramsArray.setter - def paramsArray(self, val): - if len(val) == 0: - free(self._paramsArray) - self._paramsArray_length = 0 - self._ptr[0].paramsArray = NULL - else: - if self._paramsArray_length != len(val): - free(self._paramsArray) - self._paramsArray = calloc(len(val), sizeof(ccuda.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS)) - if self._paramsArray is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(ccuda.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS))) - self._paramsArray_length = len(val) - self._ptr[0].paramsArray = self._paramsArray - for idx in range(len(val)): - string.memcpy(&self._paramsArray[idx], (val[idx])._ptr, sizeof(ccuda.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS)) + def rowLength(self): + return self._pvt_ptr[0].op.ptr.rowLength + @rowLength.setter + def rowLength(self, size_t rowLength): + self._pvt_ptr[0].op.ptr.rowLength = rowLength + @property - def numExtSems(self): - return self._ptr[0].numExtSems - @numExtSems.setter - def numExtSems(self, unsigned int numExtSems): - self._ptr[0].numExtSems = numExtSems -{{endif}} -{{if 'struct CUarrayMapInfo_st' in found_types}} + def layerHeight(self): + return self._pvt_ptr[0].op.ptr.layerHeight + @layerHeight.setter + def layerHeight(self, size_t layerHeight): + self._pvt_ptr[0].op.ptr.layerHeight = layerHeight -cdef class anon_union9: + + @property + def locHint(self): + return self._locHint + @locHint.setter + def locHint(self, locHint not None : CUmemLocation): + string.memcpy(&self._pvt_ptr[0].op.ptr.locHint, locHint.getPtr(), sizeof(self._pvt_ptr[0].op.ptr.locHint)) + + +cdef class anon_struct24: """ Attributes ---------- - mipmap : CUmipmappedArray array : CUarray + + offset : CUoffset3D + + + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - self._mipmap = CUmipmappedArray(_ptr=&self._ptr[0].resource.mipmap) - self._array = CUarray(_ptr=&self._ptr[0].resource.array) + pass + + self._array = CUarray(_ptr=&self._pvt_ptr[0].op.array.array) + + + self._offset = CUoffset3D(_ptr=&self._pvt_ptr[0].op.array.offset) + def __dealloc__(self): pass def getPtr(self): - return &self._ptr[0].resource + return &self._pvt_ptr[0].op.array def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] - try: - str_list += ['mipmap : ' + str(self.mipmap)] - except ValueError: - str_list += ['mipmap : '] + try: str_list += ['array : ' + str(self.array)] except ValueError: str_list += ['array : '] + + + try: + str_list += ['offset :\n' + '\n'.join([' ' + line for line in str(self.offset).splitlines()])] + except ValueError: + str_list += ['offset : '] + return '\n'.join(str_list) else: return '' - @property - def mipmap(self): - return self._mipmap - @mipmap.setter - def mipmap(self, mipmap): - cdef ccuda.CUmipmappedArray cmipmap - if mipmap is None: - cmipmap = 0 - elif isinstance(mipmap, (CUmipmappedArray,)): - pmipmap = int(mipmap) - cmipmap = pmipmap - else: - pmipmap = int(CUmipmappedArray(mipmap)) - cmipmap = pmipmap - self._mipmap._ptr[0] = cmipmap + @property def array(self): return self._array @array.setter def array(self, array): - cdef ccuda.CUarray carray + cdef cydriver.CUarray cyarray if array is None: - carray = 0 + cyarray = 0 elif isinstance(array, (CUarray,)): parray = int(array) - carray = parray + cyarray = parray else: parray = int(CUarray(array)) - carray = parray - self._array._ptr[0] = carray -{{endif}} -{{if 'struct CUarrayMapInfo_st' in found_types}} + cyarray = parray + self._array._pvt_ptr[0] = cyarray -cdef class anon_struct19: + + @property + def offset(self): + return self._offset + @offset.setter + def offset(self, offset not None : CUoffset3D): + string.memcpy(&self._pvt_ptr[0].op.array.offset, offset.getPtr(), sizeof(self._pvt_ptr[0].op.array.offset)) + + +cdef class anon_union13: """ Attributes ---------- - level : unsigned int - - layer : unsigned int - - offsetX : unsigned int - offsetY : unsigned int + ptr : anon_struct23 - offsetZ : unsigned int - extentWidth : unsigned int - extentHeight : unsigned int + array : anon_struct24 - extentDepth : unsigned int Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): pass + + self._ptr = anon_struct23(_ptr=self._pvt_ptr) + + + self._array = anon_struct24(_ptr=self._pvt_ptr) + def __dealloc__(self): pass def getPtr(self): - return &self._ptr[0].subresource.sparseLevel + return &self._pvt_ptr[0].op def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['level : ' + str(self.level)] + str_list += ['ptr :\n' + '\n'.join([' ' + line for line in str(self.ptr).splitlines()])] except ValueError: - str_list += ['level : '] + str_list += ['ptr : '] + + try: - str_list += ['layer : ' + str(self.layer)] + str_list += ['array :\n' + '\n'.join([' ' + line for line in str(self.array).splitlines()])] except ValueError: - str_list += ['layer : '] + str_list += ['array : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def ptr(self): + return self._ptr + @ptr.setter + def ptr(self, ptr not None : anon_struct23): + string.memcpy(&self._pvt_ptr[0].op.ptr, ptr.getPtr(), sizeof(self._pvt_ptr[0].op.ptr)) + + + @property + def array(self): + return self._array + @array.setter + def array(self, array not None : anon_struct24): + string.memcpy(&self._pvt_ptr[0].op.array, array.getPtr(), sizeof(self._pvt_ptr[0].op.array)) + + +cdef class CUmemcpy3DOperand_st: + """ + Struct representing an operand for copy with cuMemcpy3DBatchAsync + + Attributes + ---------- + + type : CUmemcpy3DOperandType + + + + op : anon_union13 + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._val_ptr = calloc(1, sizeof(cydriver.CUmemcpy3DOperand_st)) + self._pvt_ptr = self._val_ptr + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass + + self._op = anon_union13(_ptr=self._pvt_ptr) + + def __dealloc__(self): + if self._val_ptr is not NULL: + free(self._val_ptr) + def getPtr(self): + return self._pvt_ptr + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + try: - str_list += ['offsetX : ' + str(self.offsetX)] + str_list += ['type : ' + str(self.type)] except ValueError: - str_list += ['offsetX : '] + str_list += ['type : '] + + try: - str_list += ['offsetY : ' + str(self.offsetY)] + str_list += ['op :\n' + '\n'.join([' ' + line for line in str(self.op).splitlines()])] except ValueError: - str_list += ['offsetY : '] + str_list += ['op : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def type(self): + return CUmemcpy3DOperandType(self._pvt_ptr[0].type) + @type.setter + def type(self, type not None : CUmemcpy3DOperandType): + self._pvt_ptr[0].type = int(type) + + + @property + def op(self): + return self._op + @op.setter + def op(self, op not None : anon_union13): + string.memcpy(&self._pvt_ptr[0].op, op.getPtr(), sizeof(self._pvt_ptr[0].op)) + + +cdef class CUDA_MEMCPY3D_BATCH_OP_st: + """ + Attributes + ---------- + + src : CUmemcpy3DOperand + Source memcpy operand. + + + dst : CUmemcpy3DOperand + Destination memcpy operand. + + + extent : CUextent3D + Extents of the memcpy between src and dst. The width, height and + depth components must not be 0. + + + srcAccessOrder : CUmemcpySrcAccessOrder + Source access ordering to be observed for copy from src to dst. + + + flags : unsigned int + Additional flags for copies with this attribute. See CUmemcpyFlags + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass + + self._src = CUmemcpy3DOperand(_ptr=&self._pvt_ptr[0].src) + + + self._dst = CUmemcpy3DOperand(_ptr=&self._pvt_ptr[0].dst) + + + self._extent = CUextent3D(_ptr=&self._pvt_ptr[0].extent) + + def __dealloc__(self): + pass + def getPtr(self): + return self._pvt_ptr + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + try: - str_list += ['offsetZ : ' + str(self.offsetZ)] + str_list += ['src :\n' + '\n'.join([' ' + line for line in str(self.src).splitlines()])] except ValueError: - str_list += ['offsetZ : '] + str_list += ['src : '] + + try: - str_list += ['extentWidth : ' + str(self.extentWidth)] + str_list += ['dst :\n' + '\n'.join([' ' + line for line in str(self.dst).splitlines()])] except ValueError: - str_list += ['extentWidth : '] + str_list += ['dst : '] + + try: - str_list += ['extentHeight : ' + str(self.extentHeight)] + str_list += ['extent :\n' + '\n'.join([' ' + line for line in str(self.extent).splitlines()])] except ValueError: - str_list += ['extentHeight : '] + str_list += ['extent : '] + + try: - str_list += ['extentDepth : ' + str(self.extentDepth)] + str_list += ['srcAccessOrder : ' + str(self.srcAccessOrder)] except ValueError: - str_list += ['extentDepth : '] + str_list += ['srcAccessOrder : '] + + + try: + str_list += ['flags : ' + str(self.flags)] + except ValueError: + str_list += ['flags : '] + return '\n'.join(str_list) else: return '' + @property - def level(self): - return self._ptr[0].subresource.sparseLevel.level - @level.setter - def level(self, unsigned int level): - self._ptr[0].subresource.sparseLevel.level = level - @property - def layer(self): - return self._ptr[0].subresource.sparseLevel.layer - @layer.setter - def layer(self, unsigned int layer): - self._ptr[0].subresource.sparseLevel.layer = layer - @property - def offsetX(self): - return self._ptr[0].subresource.sparseLevel.offsetX - @offsetX.setter - def offsetX(self, unsigned int offsetX): - self._ptr[0].subresource.sparseLevel.offsetX = offsetX - @property - def offsetY(self): - return self._ptr[0].subresource.sparseLevel.offsetY - @offsetY.setter - def offsetY(self, unsigned int offsetY): - self._ptr[0].subresource.sparseLevel.offsetY = offsetY + def src(self): + return self._src + @src.setter + def src(self, src not None : CUmemcpy3DOperand): + string.memcpy(&self._pvt_ptr[0].src, src.getPtr(), sizeof(self._pvt_ptr[0].src)) + + @property - def offsetZ(self): - return self._ptr[0].subresource.sparseLevel.offsetZ - @offsetZ.setter - def offsetZ(self, unsigned int offsetZ): - self._ptr[0].subresource.sparseLevel.offsetZ = offsetZ + def dst(self): + return self._dst + @dst.setter + def dst(self, dst not None : CUmemcpy3DOperand): + string.memcpy(&self._pvt_ptr[0].dst, dst.getPtr(), sizeof(self._pvt_ptr[0].dst)) + + @property - def extentWidth(self): - return self._ptr[0].subresource.sparseLevel.extentWidth - @extentWidth.setter - def extentWidth(self, unsigned int extentWidth): - self._ptr[0].subresource.sparseLevel.extentWidth = extentWidth + def extent(self): + return self._extent + @extent.setter + def extent(self, extent not None : CUextent3D): + string.memcpy(&self._pvt_ptr[0].extent, extent.getPtr(), sizeof(self._pvt_ptr[0].extent)) + + @property - def extentHeight(self): - return self._ptr[0].subresource.sparseLevel.extentHeight - @extentHeight.setter - def extentHeight(self, unsigned int extentHeight): - self._ptr[0].subresource.sparseLevel.extentHeight = extentHeight + def srcAccessOrder(self): + return CUmemcpySrcAccessOrder(self._pvt_ptr[0].srcAccessOrder) + @srcAccessOrder.setter + def srcAccessOrder(self, srcAccessOrder not None : CUmemcpySrcAccessOrder): + self._pvt_ptr[0].srcAccessOrder = int(srcAccessOrder) + + @property - def extentDepth(self): - return self._ptr[0].subresource.sparseLevel.extentDepth - @extentDepth.setter - def extentDepth(self, unsigned int extentDepth): - self._ptr[0].subresource.sparseLevel.extentDepth = extentDepth -{{endif}} -{{if 'struct CUarrayMapInfo_st' in found_types}} + def flags(self): + return self._pvt_ptr[0].flags + @flags.setter + def flags(self, unsigned int flags): + self._pvt_ptr[0].flags = flags -cdef class anon_struct20: + +cdef class CUDA_MEM_ALLOC_NODE_PARAMS_v1_st: """ + Memory allocation node parameters + Attributes ---------- - layer : unsigned int - offset : unsigned long long + poolProps : CUmemPoolProps + in: location where the allocation should reside (specified in + ::location). ::handleTypes must be CU_MEM_HANDLE_TYPE_NONE. IPC is + not supported. - size : unsigned long long + + accessDescs : CUmemAccessDesc + in: array of memory access descriptors. Used to describe peer GPU + access + + + accessDescCount : size_t + in: number of memory access descriptors. Must not exceed the number + of GPUs. + + + bytesize : size_t + in: size in bytes of the requested allocation + + + dptr : CUdeviceptr + out: address of the allocation returned by CUDA Methods ------- getPtr() Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr - - def __init__(self, void_ptr _ptr): + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): pass + + self._poolProps = CUmemPoolProps(_ptr=&self._pvt_ptr[0].poolProps) + + + self._dptr = CUdeviceptr(_ptr=&self._pvt_ptr[0].dptr) + def __dealloc__(self): pass + + if self._accessDescs is not NULL: + free(self._accessDescs) + self._pvt_ptr[0].accessDescs = NULL + def getPtr(self): - return &self._ptr[0].subresource.miptail + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['layer : ' + str(self.layer)] + str_list += ['poolProps :\n' + '\n'.join([' ' + line for line in str(self.poolProps).splitlines()])] except ValueError: - str_list += ['layer : '] + str_list += ['poolProps : '] + + try: - str_list += ['offset : ' + str(self.offset)] + str_list += ['accessDescs : ' + str(self.accessDescs)] except ValueError: - str_list += ['offset : '] + str_list += ['accessDescs : '] + + try: - str_list += ['size : ' + str(self.size)] + str_list += ['accessDescCount : ' + str(self.accessDescCount)] except ValueError: - str_list += ['size : '] + str_list += ['accessDescCount : '] + + + try: + str_list += ['bytesize : ' + str(self.bytesize)] + except ValueError: + str_list += ['bytesize : '] + + + try: + str_list += ['dptr : ' + str(self.dptr)] + except ValueError: + str_list += ['dptr : '] + return '\n'.join(str_list) else: return '' + @property - def layer(self): - return self._ptr[0].subresource.miptail.layer - @layer.setter - def layer(self, unsigned int layer): - self._ptr[0].subresource.miptail.layer = layer + def poolProps(self): + return self._poolProps + @poolProps.setter + def poolProps(self, poolProps not None : CUmemPoolProps): + string.memcpy(&self._pvt_ptr[0].poolProps, poolProps.getPtr(), sizeof(self._pvt_ptr[0].poolProps)) + + @property - def offset(self): - return self._ptr[0].subresource.miptail.offset - @offset.setter - def offset(self, unsigned long long offset): - self._ptr[0].subresource.miptail.offset = offset + def accessDescs(self): + arrs = [self._pvt_ptr[0].accessDescs + x*sizeof(cydriver.CUmemAccessDesc) for x in range(self._accessDescs_length)] + return [CUmemAccessDesc(_ptr=arr) for arr in arrs] + @accessDescs.setter + def accessDescs(self, val): + if len(val) == 0: + free(self._accessDescs) + self._accessDescs = NULL + self._accessDescs_length = 0 + self._pvt_ptr[0].accessDescs = NULL + else: + if self._accessDescs_length != len(val): + free(self._accessDescs) + self._accessDescs = calloc(len(val), sizeof(cydriver.CUmemAccessDesc)) + if self._accessDescs is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(cydriver.CUmemAccessDesc))) + self._accessDescs_length = len(val) + self._pvt_ptr[0].accessDescs = self._accessDescs + for idx in range(len(val)): + string.memcpy(&self._accessDescs[idx], (val[idx])._pvt_ptr, sizeof(cydriver.CUmemAccessDesc)) + + + @property - def size(self): - return self._ptr[0].subresource.miptail.size - @size.setter - def size(self, unsigned long long size): - self._ptr[0].subresource.miptail.size = size -{{endif}} -{{if 'struct CUarrayMapInfo_st' in found_types}} + def accessDescCount(self): + return self._pvt_ptr[0].accessDescCount + @accessDescCount.setter + def accessDescCount(self, size_t accessDescCount): + self._pvt_ptr[0].accessDescCount = accessDescCount -cdef class anon_union10: + + @property + def bytesize(self): + return self._pvt_ptr[0].bytesize + @bytesize.setter + def bytesize(self, size_t bytesize): + self._pvt_ptr[0].bytesize = bytesize + + + @property + def dptr(self): + return self._dptr + @dptr.setter + def dptr(self, dptr): + cdef cydriver.CUdeviceptr cydptr + if dptr is None: + cydptr = 0 + elif isinstance(dptr, (CUdeviceptr)): + pdptr = int(dptr) + cydptr = pdptr + else: + pdptr = int(CUdeviceptr(dptr)) + cydptr = pdptr + self._dptr._pvt_ptr[0] = cydptr + + + +cdef class CUDA_MEM_ALLOC_NODE_PARAMS_v2_st: """ + Memory allocation node parameters + Attributes ---------- - sparseLevel : anon_struct19 - miptail : anon_struct20 + poolProps : CUmemPoolProps + in: location where the allocation should reside (specified in + ::location). ::handleTypes must be CU_MEM_HANDLE_TYPE_NONE. IPC is + not supported. + + + accessDescs : CUmemAccessDesc + in: array of memory access descriptors. Used to describe peer GPU + access + + + accessDescCount : size_t + in: number of memory access descriptors. Must not exceed the number + of GPUs. + + + bytesize : size_t + in: size in bytes of the requested allocation + + + dptr : CUdeviceptr + out: address of the allocation returned by CUDA Methods ------- getPtr() Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass + + self._poolProps = CUmemPoolProps(_ptr=&self._pvt_ptr[0].poolProps) + + + self._dptr = CUdeviceptr(_ptr=&self._pvt_ptr[0].dptr) - def __init__(self, void_ptr _ptr): - self._sparseLevel = anon_struct19(_ptr=self._ptr) - self._miptail = anon_struct20(_ptr=self._ptr) def __dealloc__(self): pass + + if self._accessDescs is not NULL: + free(self._accessDescs) + self._pvt_ptr[0].accessDescs = NULL + def getPtr(self): - return &self._ptr[0].subresource + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['sparseLevel :\n' + '\n'.join([' ' + line for line in str(self.sparseLevel).splitlines()])] + str_list += ['poolProps :\n' + '\n'.join([' ' + line for line in str(self.poolProps).splitlines()])] except ValueError: - str_list += ['sparseLevel : '] + str_list += ['poolProps : '] + + try: - str_list += ['miptail :\n' + '\n'.join([' ' + line for line in str(self.miptail).splitlines()])] + str_list += ['accessDescs : ' + str(self.accessDescs)] except ValueError: - str_list += ['miptail : '] + str_list += ['accessDescs : '] + + + try: + str_list += ['accessDescCount : ' + str(self.accessDescCount)] + except ValueError: + str_list += ['accessDescCount : '] + + + try: + str_list += ['bytesize : ' + str(self.bytesize)] + except ValueError: + str_list += ['bytesize : '] + + + try: + str_list += ['dptr : ' + str(self.dptr)] + except ValueError: + str_list += ['dptr : '] + return '\n'.join(str_list) else: return '' + @property - def sparseLevel(self): - return self._sparseLevel - @sparseLevel.setter - def sparseLevel(self, sparseLevel not None : anon_struct19): - string.memcpy(&self._ptr[0].subresource.sparseLevel, sparseLevel.getPtr(), sizeof(self._ptr[0].subresource.sparseLevel)) + def poolProps(self): + return self._poolProps + @poolProps.setter + def poolProps(self, poolProps not None : CUmemPoolProps): + string.memcpy(&self._pvt_ptr[0].poolProps, poolProps.getPtr(), sizeof(self._pvt_ptr[0].poolProps)) + + + @property + def accessDescs(self): + arrs = [self._pvt_ptr[0].accessDescs + x*sizeof(cydriver.CUmemAccessDesc) for x in range(self._accessDescs_length)] + return [CUmemAccessDesc(_ptr=arr) for arr in arrs] + @accessDescs.setter + def accessDescs(self, val): + if len(val) == 0: + free(self._accessDescs) + self._accessDescs = NULL + self._accessDescs_length = 0 + self._pvt_ptr[0].accessDescs = NULL + else: + if self._accessDescs_length != len(val): + free(self._accessDescs) + self._accessDescs = calloc(len(val), sizeof(cydriver.CUmemAccessDesc)) + if self._accessDescs is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(cydriver.CUmemAccessDesc))) + self._accessDescs_length = len(val) + self._pvt_ptr[0].accessDescs = self._accessDescs + for idx in range(len(val)): + string.memcpy(&self._accessDescs[idx], (val[idx])._pvt_ptr, sizeof(cydriver.CUmemAccessDesc)) + + + + @property + def accessDescCount(self): + return self._pvt_ptr[0].accessDescCount + @accessDescCount.setter + def accessDescCount(self, size_t accessDescCount): + self._pvt_ptr[0].accessDescCount = accessDescCount + + + @property + def bytesize(self): + return self._pvt_ptr[0].bytesize + @bytesize.setter + def bytesize(self, size_t bytesize): + self._pvt_ptr[0].bytesize = bytesize + + @property - def miptail(self): - return self._miptail - @miptail.setter - def miptail(self, miptail not None : anon_struct20): - string.memcpy(&self._ptr[0].subresource.miptail, miptail.getPtr(), sizeof(self._ptr[0].subresource.miptail)) -{{endif}} -{{if 'struct CUarrayMapInfo_st' in found_types}} + def dptr(self): + return self._dptr + @dptr.setter + def dptr(self, dptr): + cdef cydriver.CUdeviceptr cydptr + if dptr is None: + cydptr = 0 + elif isinstance(dptr, (CUdeviceptr)): + pdptr = int(dptr) + cydptr = pdptr + else: + pdptr = int(CUdeviceptr(dptr)) + cydptr = pdptr + self._dptr._pvt_ptr[0] = cydptr -cdef class anon_union11: + + +cdef class CUDA_MEM_FREE_NODE_PARAMS_st: """ + Memory free node parameters + Attributes ---------- - memHandle : CUmemGenericAllocationHandle + + dptr : CUdeviceptr + in: the pointer to free Methods ------- getPtr() Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass + + self._dptr = CUdeviceptr(_ptr=&self._pvt_ptr[0].dptr) - def __init__(self, void_ptr _ptr): - self._memHandle = CUmemGenericAllocationHandle(_ptr=&self._ptr[0].memHandle.memHandle) def __dealloc__(self): pass def getPtr(self): - return &self._ptr[0].memHandle + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['memHandle : ' + str(self.memHandle)] + str_list += ['dptr : ' + str(self.dptr)] except ValueError: - str_list += ['memHandle : '] + str_list += ['dptr : '] + return '\n'.join(str_list) else: return '' + @property - def memHandle(self): - return self._memHandle - @memHandle.setter - def memHandle(self, memHandle): - cdef ccuda.CUmemGenericAllocationHandle cmemHandle - if memHandle is None: - cmemHandle = 0 - elif isinstance(memHandle, (CUmemGenericAllocationHandle)): - pmemHandle = int(memHandle) - cmemHandle = pmemHandle + def dptr(self): + return self._dptr + @dptr.setter + def dptr(self, dptr): + cdef cydriver.CUdeviceptr cydptr + if dptr is None: + cydptr = 0 + elif isinstance(dptr, (CUdeviceptr)): + pdptr = int(dptr) + cydptr = pdptr else: - pmemHandle = int(CUmemGenericAllocationHandle(memHandle)) - cmemHandle = pmemHandle - self._memHandle._ptr[0] = cmemHandle + pdptr = int(CUdeviceptr(dptr)) + cydptr = pdptr + self._dptr._pvt_ptr[0] = cydptr -{{endif}} -{{if 'struct CUarrayMapInfo_st' in found_types}} -cdef class CUarrayMapInfo_st: + +cdef class CUDA_CHILD_GRAPH_NODE_PARAMS_st: """ - Specifies the CUDA array or CUDA mipmapped array memory mapping - information + Child graph node parameters Attributes ---------- - resourceType : CUresourcetype - Resource type - resource : anon_union9 - subresourceType : CUarraySparseSubresourceType - Sparse subresource type - subresource : anon_union10 + graph : CUgraph + The child graph to clone into the node for node creation, or a + handle to the graph owned by the node for node query. The graph + must not contain conditional nodes. Graphs containing memory + allocation or memory free nodes must set the ownership to be moved + to the parent. - memOperationType : CUmemOperationType - Memory operation type - memHandleType : CUmemHandleType - Memory handle type - memHandle : anon_union11 - offset : unsigned long long - Offset within mip tail Offset within the memory - deviceBitMask : unsigned int - Device ordinal bit mask - flags : unsigned int - flags for future use, must be zero now. - reserved : List[unsigned int] - Reserved for future use, must be zero now. + ownership : CUgraphChildGraphNodeOwnership + The ownership relationship of the child graph node. + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._val_ptr = calloc(1, sizeof(ccuda.CUarrayMapInfo_st)) - self._ptr = self._val_ptr + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - self._resource = anon_union9(_ptr=self._ptr) - self._subresource = anon_union10(_ptr=self._ptr) - self._memHandle = anon_union11(_ptr=self._ptr) + pass + + self._graph = CUgraph(_ptr=&self._pvt_ptr[0].graph) + def __dealloc__(self): - if self._val_ptr is not NULL: - free(self._val_ptr) + pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['resourceType : ' + str(self.resourceType)] - except ValueError: - str_list += ['resourceType : '] - try: - str_list += ['resource :\n' + '\n'.join([' ' + line for line in str(self.resource).splitlines()])] - except ValueError: - str_list += ['resource : '] - try: - str_list += ['subresourceType : ' + str(self.subresourceType)] - except ValueError: - str_list += ['subresourceType : '] - try: - str_list += ['subresource :\n' + '\n'.join([' ' + line for line in str(self.subresource).splitlines()])] - except ValueError: - str_list += ['subresource : '] - try: - str_list += ['memOperationType : ' + str(self.memOperationType)] - except ValueError: - str_list += ['memOperationType : '] - try: - str_list += ['memHandleType : ' + str(self.memHandleType)] - except ValueError: - str_list += ['memHandleType : '] - try: - str_list += ['memHandle :\n' + '\n'.join([' ' + line for line in str(self.memHandle).splitlines()])] - except ValueError: - str_list += ['memHandle : '] - try: - str_list += ['offset : ' + str(self.offset)] - except ValueError: - str_list += ['offset : '] - try: - str_list += ['deviceBitMask : ' + str(self.deviceBitMask)] - except ValueError: - str_list += ['deviceBitMask : '] - try: - str_list += ['flags : ' + str(self.flags)] + str_list += ['graph : ' + str(self.graph)] except ValueError: - str_list += ['flags : '] + str_list += ['graph : '] + + try: - str_list += ['reserved : ' + str(self.reserved)] + str_list += ['ownership : ' + str(self.ownership)] except ValueError: - str_list += ['reserved : '] + str_list += ['ownership : '] + return '\n'.join(str_list) else: return '' + @property - def resourceType(self): - return CUresourcetype(self._ptr[0].resourceType) - @resourceType.setter - def resourceType(self, resourceType not None : CUresourcetype): - self._ptr[0].resourceType = resourceType.value - @property - def resource(self): - return self._resource - @resource.setter - def resource(self, resource not None : anon_union9): - string.memcpy(&self._ptr[0].resource, resource.getPtr(), sizeof(self._ptr[0].resource)) - @property - def subresourceType(self): - return CUarraySparseSubresourceType(self._ptr[0].subresourceType) - @subresourceType.setter - def subresourceType(self, subresourceType not None : CUarraySparseSubresourceType): - self._ptr[0].subresourceType = subresourceType.value - @property - def subresource(self): - return self._subresource - @subresource.setter - def subresource(self, subresource not None : anon_union10): - string.memcpy(&self._ptr[0].subresource, subresource.getPtr(), sizeof(self._ptr[0].subresource)) - @property - def memOperationType(self): - return CUmemOperationType(self._ptr[0].memOperationType) - @memOperationType.setter - def memOperationType(self, memOperationType not None : CUmemOperationType): - self._ptr[0].memOperationType = memOperationType.value - @property - def memHandleType(self): - return CUmemHandleType(self._ptr[0].memHandleType) - @memHandleType.setter - def memHandleType(self, memHandleType not None : CUmemHandleType): - self._ptr[0].memHandleType = memHandleType.value - @property - def memHandle(self): - return self._memHandle - @memHandle.setter - def memHandle(self, memHandle not None : anon_union11): - string.memcpy(&self._ptr[0].memHandle, memHandle.getPtr(), sizeof(self._ptr[0].memHandle)) - @property - def offset(self): - return self._ptr[0].offset - @offset.setter - def offset(self, unsigned long long offset): - self._ptr[0].offset = offset - @property - def deviceBitMask(self): - return self._ptr[0].deviceBitMask - @deviceBitMask.setter - def deviceBitMask(self, unsigned int deviceBitMask): - self._ptr[0].deviceBitMask = deviceBitMask - @property - def flags(self): - return self._ptr[0].flags - @flags.setter - def flags(self, unsigned int flags): - self._ptr[0].flags = flags + def graph(self): + return self._graph + @graph.setter + def graph(self, graph): + cdef cydriver.CUgraph cygraph + if graph is None: + cygraph = 0 + elif isinstance(graph, (CUgraph,)): + pgraph = int(graph) + cygraph = pgraph + else: + pgraph = int(CUgraph(graph)) + cygraph = pgraph + self._graph._pvt_ptr[0] = cygraph + + @property - def reserved(self): - return self._ptr[0].reserved - @reserved.setter - def reserved(self, reserved): - self._ptr[0].reserved = reserved -{{endif}} -{{if 'struct CUmemLocation_st' in found_types}} + def ownership(self): + return CUgraphChildGraphNodeOwnership(self._pvt_ptr[0].ownership) + @ownership.setter + def ownership(self, ownership not None : CUgraphChildGraphNodeOwnership): + self._pvt_ptr[0].ownership = int(ownership) -cdef class CUmemLocation_st: + +cdef class CUDA_EVENT_RECORD_NODE_PARAMS_st: """ - Specifies a memory location. + Event record node parameters Attributes ---------- - type : CUmemLocationType - Specifies the location type, which modifies the meaning of id. - id : int - identifier for a given this location's CUmemLocationType. + + event : CUevent + The event to record when the node executes + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): pass + + self._event = CUevent(_ptr=&self._pvt_ptr[0].event) + def __dealloc__(self): pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['type : ' + str(self.type)] - except ValueError: - str_list += ['type : '] - try: - str_list += ['id : ' + str(self.id)] + str_list += ['event : ' + str(self.event)] except ValueError: - str_list += ['id : '] + str_list += ['event : '] + return '\n'.join(str_list) else: return '' + @property - def type(self): - return CUmemLocationType(self._ptr[0].type) - @type.setter - def type(self, type not None : CUmemLocationType): - self._ptr[0].type = type.value - @property - def id(self): - return self._ptr[0].id - @id.setter - def id(self, int id): - self._ptr[0].id = id -{{endif}} -{{if 'struct CUmemAllocationProp_st' in found_types}} + def event(self): + return self._event + @event.setter + def event(self, event): + cdef cydriver.CUevent cyevent + if event is None: + cyevent = 0 + elif isinstance(event, (CUevent,)): + pevent = int(event) + cyevent = pevent + else: + pevent = int(CUevent(event)) + cyevent = pevent + self._event._pvt_ptr[0] = cyevent -cdef class anon_struct21: + +cdef class CUDA_EVENT_WAIT_NODE_PARAMS_st: """ + Event wait node parameters + Attributes ---------- - compressionType : bytes - - gpuDirectRDMACapable : bytes - - usage : unsigned short - reserved : bytes + event : CUevent + The event to wait on from the node Methods ------- getPtr() Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr - - def __init__(self, void_ptr _ptr): + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): pass + + self._event = CUevent(_ptr=&self._pvt_ptr[0].event) + def __dealloc__(self): pass def getPtr(self): - return &self._ptr[0].allocFlags + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['compressionType : ' + str(self.compressionType)] - except ValueError: - str_list += ['compressionType : '] - try: - str_list += ['gpuDirectRDMACapable : ' + str(self.gpuDirectRDMACapable)] - except ValueError: - str_list += ['gpuDirectRDMACapable : '] - try: - str_list += ['usage : ' + str(self.usage)] - except ValueError: - str_list += ['usage : '] - try: - str_list += ['reserved : ' + str(self.reserved)] + str_list += ['event : ' + str(self.event)] except ValueError: - str_list += ['reserved : '] + str_list += ['event : '] + return '\n'.join(str_list) else: return '' + @property - def compressionType(self): - return self._ptr[0].allocFlags.compressionType - @compressionType.setter - def compressionType(self, unsigned char compressionType): - self._ptr[0].allocFlags.compressionType = compressionType - @property - def gpuDirectRDMACapable(self): - return self._ptr[0].allocFlags.gpuDirectRDMACapable - @gpuDirectRDMACapable.setter - def gpuDirectRDMACapable(self, unsigned char gpuDirectRDMACapable): - self._ptr[0].allocFlags.gpuDirectRDMACapable = gpuDirectRDMACapable - @property - def usage(self): - return self._ptr[0].allocFlags.usage - @usage.setter - def usage(self, unsigned short usage): - self._ptr[0].allocFlags.usage = usage - @property - def reserved(self): - return PyBytes_FromStringAndSize(self._ptr[0].allocFlags.reserved, 4) - @reserved.setter - def reserved(self, reserved): - if len(reserved) != 4: - raise ValueError("reserved length must be 4, is " + str(len(reserved))) - for i, b in enumerate(reserved): - self._ptr[0].allocFlags.reserved[i] = b -{{endif}} -{{if 'struct CUmemAllocationProp_st' in found_types}} + def event(self): + return self._event + @event.setter + def event(self, event): + cdef cydriver.CUevent cyevent + if event is None: + cyevent = 0 + elif isinstance(event, (CUevent,)): + pevent = int(event) + cyevent = pevent + else: + pevent = int(CUevent(event)) + cyevent = pevent + self._event._pvt_ptr[0] = cyevent -cdef class CUmemAllocationProp_st: + +cdef class CUgraphNodeParams_st: """ - Specifies the allocation properties for a allocation. + Graph node parameters. See cuGraphAddNode. Attributes ---------- - type : CUmemAllocationType - Allocation type - requestedHandleTypes : CUmemAllocationHandleType - requested CUmemAllocationHandleType - location : CUmemLocation - Location of allocation - win32HandleMetaData : Any - Windows-specific POBJECT_ATTRIBUTES required when - CU_MEM_HANDLE_TYPE_WIN32 is specified. This object attributes - structure includes security attributes that define the scope of - which exported allocations may be transferred to other processes. - In all other cases, this field is required to be zero. - allocFlags : anon_struct21 + + type : CUgraphNodeType + Type of the node + + + reserved0 : list[int] + Reserved. Must be zero. + + + reserved1 : list[long long] + Padding. Unused bytes must be zero. + + + kernel : CUDA_KERNEL_NODE_PARAMS_v3 + Kernel node parameters. + + + memcpy : CUDA_MEMCPY_NODE_PARAMS + Memcpy node parameters. + + + memset : CUDA_MEMSET_NODE_PARAMS_v2 + Memset node parameters. + + + host : CUDA_HOST_NODE_PARAMS_v2 + Host node parameters. + + + graph : CUDA_CHILD_GRAPH_NODE_PARAMS + Child graph node parameters. + + + eventWait : CUDA_EVENT_WAIT_NODE_PARAMS + Event wait node parameters. + + + eventRecord : CUDA_EVENT_RECORD_NODE_PARAMS + Event record node parameters. + + + extSemSignal : CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2 + External semaphore signal node parameters. + + + extSemWait : CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2 + External semaphore wait node parameters. + + + alloc : CUDA_MEM_ALLOC_NODE_PARAMS_v2 + Memory allocation node parameters. + + + free : CUDA_MEM_FREE_NODE_PARAMS + Memory free node parameters. + + + memOp : CUDA_BATCH_MEM_OP_NODE_PARAMS_v2 + MemOp node parameters. + + + conditional : CUDA_CONDITIONAL_NODE_PARAMS + Conditional node parameters. + + + asBytes : bytes + Padding as bytes + + + reserved2 : long long + Reserved bytes. Must be zero. Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._val_ptr = calloc(1, sizeof(cydriver.CUgraphNodeParams_st)) + self._pvt_ptr = self._val_ptr else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - self._location = CUmemLocation(_ptr=&self._ptr[0].location) - self._allocFlags = anon_struct21(_ptr=self._ptr) - def __dealloc__(self): pass + + self._kernel = CUDA_KERNEL_NODE_PARAMS_v3(_ptr=&self._pvt_ptr[0].kernel) + + + self._memcpy = CUDA_MEMCPY_NODE_PARAMS(_ptr=&self._pvt_ptr[0].memcpy) + + + self._memset = CUDA_MEMSET_NODE_PARAMS_v2(_ptr=&self._pvt_ptr[0].memset) + + + self._host = CUDA_HOST_NODE_PARAMS_v2(_ptr=&self._pvt_ptr[0].host) + + + self._graph = CUDA_CHILD_GRAPH_NODE_PARAMS(_ptr=&self._pvt_ptr[0].graph) + + + self._eventWait = CUDA_EVENT_WAIT_NODE_PARAMS(_ptr=&self._pvt_ptr[0].eventWait) + + + self._eventRecord = CUDA_EVENT_RECORD_NODE_PARAMS(_ptr=&self._pvt_ptr[0].eventRecord) + + + self._extSemSignal = CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2(_ptr=&self._pvt_ptr[0].extSemSignal) + + + self._extSemWait = CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2(_ptr=&self._pvt_ptr[0].extSemWait) + + + self._alloc = CUDA_MEM_ALLOC_NODE_PARAMS_v2(_ptr=&self._pvt_ptr[0].alloc) + + + self._free = CUDA_MEM_FREE_NODE_PARAMS(_ptr=&self._pvt_ptr[0].free) + + + self._memOp = CUDA_BATCH_MEM_OP_NODE_PARAMS_v2(_ptr=&self._pvt_ptr[0].memOp) + + + self._conditional = CUDA_CONDITIONAL_NODE_PARAMS(_ptr=&self._pvt_ptr[0].conditional) + + def __dealloc__(self): + if self._val_ptr is not NULL: + free(self._val_ptr) def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: str_list += ['type : ' + str(self.type)] except ValueError: str_list += ['type : '] + + try: - str_list += ['requestedHandleTypes : ' + str(self.requestedHandleTypes)] + str_list += ['reserved0 : ' + str(self.reserved0)] except ValueError: - str_list += ['requestedHandleTypes : '] + str_list += ['reserved0 : '] + + try: - str_list += ['location :\n' + '\n'.join([' ' + line for line in str(self.location).splitlines()])] + str_list += ['reserved1 : ' + str(self.reserved1)] except ValueError: - str_list += ['location : '] + str_list += ['reserved1 : '] + + + try: + str_list += ['kernel :\n' + '\n'.join([' ' + line for line in str(self.kernel).splitlines()])] + except ValueError: + str_list += ['kernel : '] + + + try: + str_list += ['memcpy :\n' + '\n'.join([' ' + line for line in str(self.memcpy).splitlines()])] + except ValueError: + str_list += ['memcpy : '] + + + try: + str_list += ['memset :\n' + '\n'.join([' ' + line for line in str(self.memset).splitlines()])] + except ValueError: + str_list += ['memset : '] + + + try: + str_list += ['host :\n' + '\n'.join([' ' + line for line in str(self.host).splitlines()])] + except ValueError: + str_list += ['host : '] + + + try: + str_list += ['graph :\n' + '\n'.join([' ' + line for line in str(self.graph).splitlines()])] + except ValueError: + str_list += ['graph : '] + + + try: + str_list += ['eventWait :\n' + '\n'.join([' ' + line for line in str(self.eventWait).splitlines()])] + except ValueError: + str_list += ['eventWait : '] + + + try: + str_list += ['eventRecord :\n' + '\n'.join([' ' + line for line in str(self.eventRecord).splitlines()])] + except ValueError: + str_list += ['eventRecord : '] + + + try: + str_list += ['extSemSignal :\n' + '\n'.join([' ' + line for line in str(self.extSemSignal).splitlines()])] + except ValueError: + str_list += ['extSemSignal : '] + + + try: + str_list += ['extSemWait :\n' + '\n'.join([' ' + line for line in str(self.extSemWait).splitlines()])] + except ValueError: + str_list += ['extSemWait : '] + + + try: + str_list += ['alloc :\n' + '\n'.join([' ' + line for line in str(self.alloc).splitlines()])] + except ValueError: + str_list += ['alloc : '] + + + try: + str_list += ['free :\n' + '\n'.join([' ' + line for line in str(self.free).splitlines()])] + except ValueError: + str_list += ['free : '] + + + try: + str_list += ['memOp :\n' + '\n'.join([' ' + line for line in str(self.memOp).splitlines()])] + except ValueError: + str_list += ['memOp : '] + + + try: + str_list += ['conditional :\n' + '\n'.join([' ' + line for line in str(self.conditional).splitlines()])] + except ValueError: + str_list += ['conditional : '] + + try: - str_list += ['win32HandleMetaData : ' + hex(self.win32HandleMetaData)] + str_list += ['asBytes : ' + str(self.asBytes)] except ValueError: - str_list += ['win32HandleMetaData : '] + str_list += ['asBytes : '] + + try: - str_list += ['allocFlags :\n' + '\n'.join([' ' + line for line in str(self.allocFlags).splitlines()])] + str_list += ['reserved2 : ' + str(self.reserved2)] except ValueError: - str_list += ['allocFlags : '] + str_list += ['reserved2 : '] + return '\n'.join(str_list) else: return '' + @property def type(self): - return CUmemAllocationType(self._ptr[0].type) + return CUgraphNodeType(self._pvt_ptr[0].type) @type.setter - def type(self, type not None : CUmemAllocationType): - self._ptr[0].type = type.value + def type(self, type not None : CUgraphNodeType): + self._pvt_ptr[0].type = int(type) + + @property - def requestedHandleTypes(self): - return CUmemAllocationHandleType(self._ptr[0].requestedHandleTypes) - @requestedHandleTypes.setter - def requestedHandleTypes(self, requestedHandleTypes not None : CUmemAllocationHandleType): - self._ptr[0].requestedHandleTypes = requestedHandleTypes.value + def reserved0(self): + return self._pvt_ptr[0].reserved0 + @reserved0.setter + def reserved0(self, reserved0): + self._pvt_ptr[0].reserved0 = reserved0 + + @property - def location(self): - return self._location - @location.setter - def location(self, location not None : CUmemLocation): - string.memcpy(&self._ptr[0].location, location.getPtr(), sizeof(self._ptr[0].location)) + def reserved1(self): + return self._pvt_ptr[0].reserved1 + @reserved1.setter + def reserved1(self, reserved1): + self._pvt_ptr[0].reserved1 = reserved1 + + @property - def win32HandleMetaData(self): - return self._ptr[0].win32HandleMetaData - @win32HandleMetaData.setter - def win32HandleMetaData(self, win32HandleMetaData): - _cwin32HandleMetaData = utils.HelperInputVoidPtr(win32HandleMetaData) - self._ptr[0].win32HandleMetaData = _cwin32HandleMetaData.cptr + def kernel(self): + return self._kernel + @kernel.setter + def kernel(self, kernel not None : CUDA_KERNEL_NODE_PARAMS_v3): + string.memcpy(&self._pvt_ptr[0].kernel, kernel.getPtr(), sizeof(self._pvt_ptr[0].kernel)) + + @property - def allocFlags(self): - return self._allocFlags - @allocFlags.setter - def allocFlags(self, allocFlags not None : anon_struct21): - string.memcpy(&self._ptr[0].allocFlags, allocFlags.getPtr(), sizeof(self._ptr[0].allocFlags)) -{{endif}} -{{if 'struct CUmulticastObjectProp_st' in found_types}} + def memcpy(self): + return self._memcpy + @memcpy.setter + def memcpy(self, memcpy not None : CUDA_MEMCPY_NODE_PARAMS): + string.memcpy(&self._pvt_ptr[0].memcpy, memcpy.getPtr(), sizeof(self._pvt_ptr[0].memcpy)) -cdef class CUmulticastObjectProp_st: + + @property + def memset(self): + return self._memset + @memset.setter + def memset(self, memset not None : CUDA_MEMSET_NODE_PARAMS_v2): + string.memcpy(&self._pvt_ptr[0].memset, memset.getPtr(), sizeof(self._pvt_ptr[0].memset)) + + + @property + def host(self): + return self._host + @host.setter + def host(self, host not None : CUDA_HOST_NODE_PARAMS_v2): + string.memcpy(&self._pvt_ptr[0].host, host.getPtr(), sizeof(self._pvt_ptr[0].host)) + + + @property + def graph(self): + return self._graph + @graph.setter + def graph(self, graph not None : CUDA_CHILD_GRAPH_NODE_PARAMS): + string.memcpy(&self._pvt_ptr[0].graph, graph.getPtr(), sizeof(self._pvt_ptr[0].graph)) + + + @property + def eventWait(self): + return self._eventWait + @eventWait.setter + def eventWait(self, eventWait not None : CUDA_EVENT_WAIT_NODE_PARAMS): + string.memcpy(&self._pvt_ptr[0].eventWait, eventWait.getPtr(), sizeof(self._pvt_ptr[0].eventWait)) + + + @property + def eventRecord(self): + return self._eventRecord + @eventRecord.setter + def eventRecord(self, eventRecord not None : CUDA_EVENT_RECORD_NODE_PARAMS): + string.memcpy(&self._pvt_ptr[0].eventRecord, eventRecord.getPtr(), sizeof(self._pvt_ptr[0].eventRecord)) + + + @property + def extSemSignal(self): + return self._extSemSignal + @extSemSignal.setter + def extSemSignal(self, extSemSignal not None : CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2): + string.memcpy(&self._pvt_ptr[0].extSemSignal, extSemSignal.getPtr(), sizeof(self._pvt_ptr[0].extSemSignal)) + + + @property + def extSemWait(self): + return self._extSemWait + @extSemWait.setter + def extSemWait(self, extSemWait not None : CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2): + string.memcpy(&self._pvt_ptr[0].extSemWait, extSemWait.getPtr(), sizeof(self._pvt_ptr[0].extSemWait)) + + + @property + def alloc(self): + return self._alloc + @alloc.setter + def alloc(self, alloc not None : CUDA_MEM_ALLOC_NODE_PARAMS_v2): + string.memcpy(&self._pvt_ptr[0].alloc, alloc.getPtr(), sizeof(self._pvt_ptr[0].alloc)) + + + @property + def free(self): + return self._free + @free.setter + def free(self, free not None : CUDA_MEM_FREE_NODE_PARAMS): + string.memcpy(&self._pvt_ptr[0].free, free.getPtr(), sizeof(self._pvt_ptr[0].free)) + + + @property + def memOp(self): + return self._memOp + @memOp.setter + def memOp(self, memOp not None : CUDA_BATCH_MEM_OP_NODE_PARAMS_v2): + string.memcpy(&self._pvt_ptr[0].memOp, memOp.getPtr(), sizeof(self._pvt_ptr[0].memOp)) + + + @property + def conditional(self): + return self._conditional + @conditional.setter + def conditional(self, conditional not None : CUDA_CONDITIONAL_NODE_PARAMS): + string.memcpy(&self._pvt_ptr[0].conditional, conditional.getPtr(), sizeof(self._pvt_ptr[0].conditional)) + + + @property + def asBytes(self): + return PyBytes_FromStringAndSize(self._pvt_ptr[0].asBytes, 232) + @asBytes.setter + def asBytes(self, asBytes): + if len(asBytes) != 232: + raise ValueError("asBytes length must be 232, is " + str(len(asBytes))) + if CHAR_MIN == 0: + for i, b in enumerate(asBytes): + if b < 0 and b > -129: + b = b + 256 + self._pvt_ptr[0].asBytes[i] = b + else: + for i, b in enumerate(asBytes): + if b > 127 and b < 256: + b = b - 256 + self._pvt_ptr[0].asBytes[i] = b + + + @property + def reserved2(self): + return self._pvt_ptr[0].reserved2 + @reserved2.setter + def reserved2(self, long long reserved2): + self._pvt_ptr[0].reserved2 = reserved2 + + +cdef class CUcheckpointLockArgs_st: """ - Specifies the properties for a multicast object. + CUDA checkpoint optional lock arguments Attributes ---------- - numDevices : unsigned int - The number of devices in the multicast team that will bind memory - to this object - size : size_t - The maximum amount of memory that can be bound to this multicast - object per device - handleTypes : unsigned long long - Bitmask of exportable handle types (see CUmemAllocationHandleType) - for this object - flags : unsigned long long - Flags for future use, must be zero now + + timeoutMs : unsigned int + Timeout in milliseconds to attempt to lock the process, 0 indicates + no timeout + + + reserved0 : unsigned int + Reserved for future use, must be zero + + + reserved1 : list[cuuint64_t] + Reserved for future use, must be zeroed + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): pass def __dealloc__(self): pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['numDevices : ' + str(self.numDevices)] - except ValueError: - str_list += ['numDevices : '] - try: - str_list += ['size : ' + str(self.size)] + str_list += ['timeoutMs : ' + str(self.timeoutMs)] except ValueError: - str_list += ['size : '] + str_list += ['timeoutMs : '] + + try: - str_list += ['handleTypes : ' + str(self.handleTypes)] + str_list += ['reserved0 : ' + str(self.reserved0)] except ValueError: - str_list += ['handleTypes : '] + str_list += ['reserved0 : '] + + try: - str_list += ['flags : ' + str(self.flags)] + str_list += ['reserved1 : ' + str(self.reserved1)] except ValueError: - str_list += ['flags : '] + str_list += ['reserved1 : '] + return '\n'.join(str_list) else: return '' + @property - def numDevices(self): - return self._ptr[0].numDevices - @numDevices.setter - def numDevices(self, unsigned int numDevices): - self._ptr[0].numDevices = numDevices - @property - def size(self): - return self._ptr[0].size - @size.setter - def size(self, size_t size): - self._ptr[0].size = size + def timeoutMs(self): + return self._pvt_ptr[0].timeoutMs + @timeoutMs.setter + def timeoutMs(self, unsigned int timeoutMs): + self._pvt_ptr[0].timeoutMs = timeoutMs + + @property - def handleTypes(self): - return self._ptr[0].handleTypes - @handleTypes.setter - def handleTypes(self, unsigned long long handleTypes): - self._ptr[0].handleTypes = handleTypes + def reserved0(self): + return self._pvt_ptr[0].reserved0 + @reserved0.setter + def reserved0(self, unsigned int reserved0): + self._pvt_ptr[0].reserved0 = reserved0 + + @property - def flags(self): - return self._ptr[0].flags - @flags.setter - def flags(self, unsigned long long flags): - self._ptr[0].flags = flags -{{endif}} -{{if 'struct CUmemAccessDesc_st' in found_types}} + def reserved1(self): + return [cuuint64_t(init_value=_reserved1) for _reserved1 in self._pvt_ptr[0].reserved1] + @reserved1.setter + def reserved1(self, reserved1): + self._pvt_ptr[0].reserved1 = reserved1 -cdef class CUmemAccessDesc_st: + + +cdef class CUcheckpointCheckpointArgs_st: """ - Memory access descriptor + CUDA checkpoint optional checkpoint arguments Attributes ---------- - location : CUmemLocation - Location on which the request is to change it's accessibility - flags : CUmemAccess_flags - ::CUmemProt accessibility flags to set on the request + + reserved : list[cuuint64_t] + Reserved for future use, must be zeroed + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - self._location = CUmemLocation(_ptr=&self._ptr[0].location) + pass def __dealloc__(self): pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['location :\n' + '\n'.join([' ' + line for line in str(self.location).splitlines()])] - except ValueError: - str_list += ['location : '] - try: - str_list += ['flags : ' + str(self.flags)] + str_list += ['reserved : ' + str(self.reserved)] except ValueError: - str_list += ['flags : '] + str_list += ['reserved : '] + return '\n'.join(str_list) else: return '' + @property - def location(self): - return self._location - @location.setter - def location(self, location not None : CUmemLocation): - string.memcpy(&self._ptr[0].location, location.getPtr(), sizeof(self._ptr[0].location)) - @property - def flags(self): - return CUmemAccess_flags(self._ptr[0].flags) - @flags.setter - def flags(self, flags not None : CUmemAccess_flags): - self._ptr[0].flags = flags.value -{{endif}} -{{if 'struct CUgraphExecUpdateResultInfo_st' in found_types}} + def reserved(self): + return [cuuint64_t(init_value=_reserved) for _reserved in self._pvt_ptr[0].reserved] + @reserved.setter + def reserved(self, reserved): + self._pvt_ptr[0].reserved = reserved -cdef class CUgraphExecUpdateResultInfo_st: + + +cdef class CUcheckpointGpuPair_st: """ - Result information returned by cuGraphExecUpdate + CUDA checkpoint GPU UUID pairs for device remapping during restore Attributes ---------- - result : CUgraphExecUpdateResult - Gives more specific detail when a cuda graph update fails. - errorNode : CUgraphNode - The "to node" of the error edge when the topologies do not match. - The error node when the error is associated with a specific node. - NULL when the error is generic. - errorFromNode : CUgraphNode - The from node of error edge when the topologies do not match. - Otherwise NULL. + + oldUuid : CUuuid + UUID of the GPU that was checkpointed + + + newUuid : CUuuid + UUID of the GPU to restore onto + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - self._errorNode = CUgraphNode(_ptr=&self._ptr[0].errorNode) - self._errorFromNode = CUgraphNode(_ptr=&self._ptr[0].errorFromNode) + pass + + self._oldUuid = CUuuid(_ptr=&self._pvt_ptr[0].oldUuid) + + + self._newUuid = CUuuid(_ptr=&self._pvt_ptr[0].newUuid) + def __dealloc__(self): pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['result : ' + str(self.result)] - except ValueError: - str_list += ['result : '] - try: - str_list += ['errorNode : ' + str(self.errorNode)] + str_list += ['oldUuid :\n' + '\n'.join([' ' + line for line in str(self.oldUuid).splitlines()])] except ValueError: - str_list += ['errorNode : '] + str_list += ['oldUuid : '] + + try: - str_list += ['errorFromNode : ' + str(self.errorFromNode)] + str_list += ['newUuid :\n' + '\n'.join([' ' + line for line in str(self.newUuid).splitlines()])] except ValueError: - str_list += ['errorFromNode : '] + str_list += ['newUuid : '] + return '\n'.join(str_list) else: return '' + @property - def result(self): - return CUgraphExecUpdateResult(self._ptr[0].result) - @result.setter - def result(self, result not None : CUgraphExecUpdateResult): - self._ptr[0].result = result.value - @property - def errorNode(self): - return self._errorNode - @errorNode.setter - def errorNode(self, errorNode): - cdef ccuda.CUgraphNode cerrorNode - if errorNode is None: - cerrorNode = 0 - elif isinstance(errorNode, (CUgraphNode,)): - perrorNode = int(errorNode) - cerrorNode = perrorNode - else: - perrorNode = int(CUgraphNode(errorNode)) - cerrorNode = perrorNode - self._errorNode._ptr[0] = cerrorNode + def oldUuid(self): + return self._oldUuid + @oldUuid.setter + def oldUuid(self, oldUuid not None : CUuuid): + string.memcpy(&self._pvt_ptr[0].oldUuid, oldUuid.getPtr(), sizeof(self._pvt_ptr[0].oldUuid)) + + @property - def errorFromNode(self): - return self._errorFromNode - @errorFromNode.setter - def errorFromNode(self, errorFromNode): - cdef ccuda.CUgraphNode cerrorFromNode - if errorFromNode is None: - cerrorFromNode = 0 - elif isinstance(errorFromNode, (CUgraphNode,)): - perrorFromNode = int(errorFromNode) - cerrorFromNode = perrorFromNode - else: - perrorFromNode = int(CUgraphNode(errorFromNode)) - cerrorFromNode = perrorFromNode - self._errorFromNode._ptr[0] = cerrorFromNode -{{endif}} -{{if 'struct CUmemPoolProps_st' in found_types}} + def newUuid(self): + return self._newUuid + @newUuid.setter + def newUuid(self, newUuid not None : CUuuid): + string.memcpy(&self._pvt_ptr[0].newUuid, newUuid.getPtr(), sizeof(self._pvt_ptr[0].newUuid)) -cdef class CUmemPoolProps_st: + +cdef class CUcheckpointRestoreArgs_st: """ - Specifies the properties of allocations made from the pool. + CUDA checkpoint optional restore arguments Attributes ---------- - allocType : CUmemAllocationType - Allocation type. Currently must be specified as - CU_MEM_ALLOCATION_TYPE_PINNED - handleTypes : CUmemAllocationHandleType - Handle types that will be supported by allocations from the pool. - location : CUmemLocation - Location where allocations should reside. - win32SecurityAttributes : Any - Windows-specific LPSECURITYATTRIBUTES required when - CU_MEM_HANDLE_TYPE_WIN32 is specified. This security attribute - defines the scope of which exported allocations may be transferred - to other processes. In all other cases, this field is required to - be zero. - maxSize : size_t - Maximum pool size. When set to 0, defaults to a system dependent - value. + + gpuPairs : CUcheckpointGpuPair + Pointer to array of gpu pairs that indicate how to remap GPUs + during restore + + + gpuPairsCount : unsigned int + Number of gpu pairs to remap + + reserved : bytes - reserved for future use, must be 0 + Reserved for future use, must be zeroed + + + reserved : list[cuuint64_t] + Reserved for future use, must be zeroed + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - self._location = CUmemLocation(_ptr=&self._ptr[0].location) + pass def __dealloc__(self): pass + + if self._gpuPairs is not NULL: + free(self._gpuPairs) + self._pvt_ptr[0].gpuPairs = NULL + def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['allocType : ' + str(self.allocType)] - except ValueError: - str_list += ['allocType : '] - try: - str_list += ['handleTypes : ' + str(self.handleTypes)] - except ValueError: - str_list += ['handleTypes : '] - try: - str_list += ['location :\n' + '\n'.join([' ' + line for line in str(self.location).splitlines()])] - except ValueError: - str_list += ['location : '] - try: - str_list += ['win32SecurityAttributes : ' + hex(self.win32SecurityAttributes)] + str_list += ['gpuPairs : ' + str(self.gpuPairs)] except ValueError: - str_list += ['win32SecurityAttributes : '] + str_list += ['gpuPairs : '] + + try: - str_list += ['maxSize : ' + str(self.maxSize)] + str_list += ['gpuPairsCount : ' + str(self.gpuPairsCount)] except ValueError: - str_list += ['maxSize : '] + str_list += ['gpuPairsCount : '] + + try: str_list += ['reserved : ' + str(self.reserved)] except ValueError: str_list += ['reserved : '] + return '\n'.join(str_list) else: return '' + @property - def allocType(self): - return CUmemAllocationType(self._ptr[0].allocType) - @allocType.setter - def allocType(self, allocType not None : CUmemAllocationType): - self._ptr[0].allocType = allocType.value - @property - def handleTypes(self): - return CUmemAllocationHandleType(self._ptr[0].handleTypes) - @handleTypes.setter - def handleTypes(self, handleTypes not None : CUmemAllocationHandleType): - self._ptr[0].handleTypes = handleTypes.value - @property - def location(self): - return self._location - @location.setter - def location(self, location not None : CUmemLocation): - string.memcpy(&self._ptr[0].location, location.getPtr(), sizeof(self._ptr[0].location)) + def gpuPairs(self): + arrs = [self._pvt_ptr[0].gpuPairs + x*sizeof(cydriver.CUcheckpointGpuPair) for x in range(self._gpuPairs_length)] + return [CUcheckpointGpuPair(_ptr=arr) for arr in arrs] + @gpuPairs.setter + def gpuPairs(self, val): + if len(val) == 0: + free(self._gpuPairs) + self._gpuPairs = NULL + self._gpuPairs_length = 0 + self._pvt_ptr[0].gpuPairs = NULL + else: + if self._gpuPairs_length != len(val): + free(self._gpuPairs) + self._gpuPairs = calloc(len(val), sizeof(cydriver.CUcheckpointGpuPair)) + if self._gpuPairs is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(cydriver.CUcheckpointGpuPair))) + self._gpuPairs_length = len(val) + self._pvt_ptr[0].gpuPairs = self._gpuPairs + for idx in range(len(val)): + string.memcpy(&self._gpuPairs[idx], (val[idx])._pvt_ptr, sizeof(cydriver.CUcheckpointGpuPair)) + + + @property - def win32SecurityAttributes(self): - return self._ptr[0].win32SecurityAttributes - @win32SecurityAttributes.setter - def win32SecurityAttributes(self, win32SecurityAttributes): - _cwin32SecurityAttributes = utils.HelperInputVoidPtr(win32SecurityAttributes) - self._ptr[0].win32SecurityAttributes = _cwin32SecurityAttributes.cptr + def gpuPairsCount(self): + return self._pvt_ptr[0].gpuPairsCount + @gpuPairsCount.setter + def gpuPairsCount(self, unsigned int gpuPairsCount): + self._pvt_ptr[0].gpuPairsCount = gpuPairsCount + + @property - def maxSize(self): - return self._ptr[0].maxSize - @maxSize.setter - def maxSize(self, size_t maxSize): - self._ptr[0].maxSize = maxSize + def reserved(self): + return PyBytes_FromStringAndSize(self._pvt_ptr[0].reserved, {{struct_field_array_lengths['CUcheckpointRestoreArgs_st.reserved']}}) + @reserved.setter + def reserved(self, reserved): + if len(reserved) != {{struct_field_array_lengths['CUcheckpointRestoreArgs_st.reserved']}}: + raise ValueError("reserved length must be {{struct_field_array_lengths['CUcheckpointRestoreArgs_st.reserved']}}, is " + str(len(reserved))) + if CHAR_MIN == 0: + for i, b in enumerate(reserved): + if b < 0 and b > -129: + b = b + 256 + self._pvt_ptr[0].reserved[i] = b + else: + for i, b in enumerate(reserved): + if b > 127 and b < 256: + b = b - 256 + self._pvt_ptr[0].reserved[i] = b + + @property def reserved(self): - return PyBytes_FromStringAndSize(self._ptr[0].reserved, 56) + return [cuuint64_t(init_value=_reserved) for _reserved in self._pvt_ptr[0].reserved] @reserved.setter def reserved(self, reserved): - if len(reserved) != 56: - raise ValueError("reserved length must be 56, is " + str(len(reserved))) - for i, b in enumerate(reserved): - self._ptr[0].reserved[i] = b -{{endif}} -{{if 'struct CUmemPoolPtrExportData_st' in found_types}} + self._pvt_ptr[0].reserved = reserved -cdef class CUmemPoolPtrExportData_st: + + +cdef class CUcheckpointUnlockArgs_st: """ - Opaque data for exporting a pool allocation + CUDA checkpoint optional unlock arguments Attributes ---------- - reserved : bytes + + reserved : list[cuuint64_t] + Reserved for future use, must be zeroed Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): pass def __dealloc__(self): pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: str_list += ['reserved : ' + str(self.reserved)] except ValueError: str_list += ['reserved : '] + return '\n'.join(str_list) else: return '' + @property def reserved(self): - return PyBytes_FromStringAndSize(self._ptr[0].reserved, 64) + return [cuuint64_t(init_value=_reserved) for _reserved in self._pvt_ptr[0].reserved] @reserved.setter def reserved(self, reserved): - if len(reserved) != 64: - raise ValueError("reserved length must be 64, is " + str(len(reserved))) - for i, b in enumerate(reserved): - self._ptr[0].reserved[i] = b -{{endif}} -{{if 'struct CUDA_MEM_ALLOC_NODE_PARAMS_v1_st' in found_types}} - -cdef class CUDA_MEM_ALLOC_NODE_PARAMS_v1_st: - """ - Memory allocation node parameters - - Attributes - ---------- - poolProps : CUmemPoolProps - in: location where the allocation should reside (specified in - ::location). ::handleTypes must be CU_MEM_HANDLE_TYPE_NONE. IPC is - not supported. - accessDescs : CUmemAccessDesc - in: array of memory access descriptors. Used to describe peer GPU - access - accessDescCount : size_t - in: number of memory access descriptors. Must not exceed the number - of GPUs. - bytesize : size_t - in: size in bytes of the requested allocation - dptr : CUdeviceptr - out: address of the allocation returned by CUDA - - Methods - ------- - getPtr() - Get memory address of class instance - - """ - def __cinit__(self, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - else: - self._ptr = _ptr - def __init__(self, void_ptr _ptr = 0): - self._poolProps = CUmemPoolProps(_ptr=&self._ptr[0].poolProps) - self._dptr = CUdeviceptr(_ptr=&self._ptr[0].dptr) - def __dealloc__(self): - if self._accessDescs is not NULL: - free(self._accessDescs) - def getPtr(self): - return self._ptr - def __repr__(self): - if self._ptr is not NULL: - str_list = [] - try: - str_list += ['poolProps :\n' + '\n'.join([' ' + line for line in str(self.poolProps).splitlines()])] - except ValueError: - str_list += ['poolProps : '] - try: - str_list += ['accessDescs : ' + str(self.accessDescs)] - except ValueError: - str_list += ['accessDescs : '] - try: - str_list += ['accessDescCount : ' + str(self.accessDescCount)] - except ValueError: - str_list += ['accessDescCount : '] - try: - str_list += ['bytesize : ' + str(self.bytesize)] - except ValueError: - str_list += ['bytesize : '] - try: - str_list += ['dptr : ' + str(self.dptr)] - except ValueError: - str_list += ['dptr : '] - return '\n'.join(str_list) - else: - return '' - @property - def poolProps(self): - return self._poolProps - @poolProps.setter - def poolProps(self, poolProps not None : CUmemPoolProps): - string.memcpy(&self._ptr[0].poolProps, poolProps.getPtr(), sizeof(self._ptr[0].poolProps)) - @property - def accessDescs(self): - arrs = [self._ptr[0].accessDescs + x*sizeof(ccuda.CUmemAccessDesc) for x in range(self._accessDescs_length)] - return [CUmemAccessDesc(_ptr=arr) for arr in arrs] - @accessDescs.setter - def accessDescs(self, val): - if len(val) == 0: - free(self._accessDescs) - self._accessDescs_length = 0 - self._ptr[0].accessDescs = NULL - else: - if self._accessDescs_length != len(val): - free(self._accessDescs) - self._accessDescs = calloc(len(val), sizeof(ccuda.CUmemAccessDesc)) - if self._accessDescs is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(ccuda.CUmemAccessDesc))) - self._accessDescs_length = len(val) - self._ptr[0].accessDescs = self._accessDescs - for idx in range(len(val)): - string.memcpy(&self._accessDescs[idx], (val[idx])._ptr, sizeof(ccuda.CUmemAccessDesc)) + self._pvt_ptr[0].reserved = reserved - @property - def accessDescCount(self): - return self._ptr[0].accessDescCount - @accessDescCount.setter - def accessDescCount(self, size_t accessDescCount): - self._ptr[0].accessDescCount = accessDescCount - @property - def bytesize(self): - return self._ptr[0].bytesize - @bytesize.setter - def bytesize(self, size_t bytesize): - self._ptr[0].bytesize = bytesize - @property - def dptr(self): - return self._dptr - @dptr.setter - def dptr(self, dptr): - cdef ccuda.CUdeviceptr cdptr - if dptr is None: - cdptr = 0 - elif isinstance(dptr, (CUdeviceptr)): - pdptr = int(dptr) - cdptr = pdptr - else: - pdptr = int(CUdeviceptr(dptr)) - cdptr = pdptr - self._dptr._ptr[0] = cdptr -{{endif}} -{{if 'struct CUDA_MEM_ALLOC_NODE_PARAMS_v2_st' in found_types}} -cdef class CUDA_MEM_ALLOC_NODE_PARAMS_v2_st: +cdef class CUmemDecompressParams_st: """ - Memory allocation node parameters + Structure describing the parameters that compose a single + decompression operation. Attributes ---------- - poolProps : CUmemPoolProps - in: location where the allocation should reside (specified in - ::location). ::handleTypes must be CU_MEM_HANDLE_TYPE_NONE. IPC is - not supported. - accessDescs : CUmemAccessDesc - in: array of memory access descriptors. Used to describe peer GPU - access - accessDescCount : size_t - in: number of memory access descriptors. Must not exceed the number - of GPUs. - bytesize : size_t - in: size in bytes of the requested allocation - dptr : CUdeviceptr - out: address of the allocation returned by CUDA + + srcNumBytes : size_t + The number of bytes to be read and decompressed from + CUmemDecompressParams_st.src. + + + dstNumBytes : size_t + The number of bytes that the decompression operation will be + expected to write to CUmemDecompressParams_st.dst. This value is + optional; if present, it may be used by the CUDA driver as a + heuristic for scheduling the individual decompression operations. + + + dstActBytes : cuuint32_t + After the decompression operation has completed, the actual number + of bytes written to CUmemDecompressParams.dst will be recorded as a + 32-bit unsigned integer in the memory at this address. + + + src : Any + Pointer to a buffer of at least + CUmemDecompressParams_st.srcNumBytes compressed bytes. + + + dst : Any + Pointer to a buffer where the decompressed data will be written. + The number of bytes written to this location will be recorded in + the memory pointed to by CUmemDecompressParams_st.dstActBytes + + + algo : CUmemDecompressAlgorithm + The decompression algorithm to use. + + + padding : bytes + + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - self._poolProps = CUmemPoolProps(_ptr=&self._ptr[0].poolProps) - self._dptr = CUdeviceptr(_ptr=&self._ptr[0].dptr) + pass def __dealloc__(self): - if self._accessDescs is not NULL: - free(self._accessDescs) + pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['poolProps :\n' + '\n'.join([' ' + line for line in str(self.poolProps).splitlines()])] + str_list += ['srcNumBytes : ' + str(self.srcNumBytes)] except ValueError: - str_list += ['poolProps : '] + str_list += ['srcNumBytes : '] + + try: - str_list += ['accessDescs : ' + str(self.accessDescs)] + str_list += ['dstNumBytes : ' + str(self.dstNumBytes)] except ValueError: - str_list += ['accessDescs : '] + str_list += ['dstNumBytes : '] + + try: - str_list += ['accessDescCount : ' + str(self.accessDescCount)] + str_list += ['dstActBytes : ' + str(self.dstActBytes)] except ValueError: - str_list += ['accessDescCount : '] + str_list += ['dstActBytes : '] + + try: - str_list += ['bytesize : ' + str(self.bytesize)] + str_list += ['src : ' + hex(self.src)] except ValueError: - str_list += ['bytesize : '] + str_list += ['src : '] + + try: - str_list += ['dptr : ' + str(self.dptr)] + str_list += ['dst : ' + hex(self.dst)] except ValueError: - str_list += ['dptr : '] + str_list += ['dst : '] + + + try: + str_list += ['algo : ' + str(self.algo)] + except ValueError: + str_list += ['algo : '] + + + try: + str_list += ['padding : ' + str(self.padding)] + except ValueError: + str_list += ['padding : '] + return '\n'.join(str_list) else: return '' + @property - def poolProps(self): - return self._poolProps - @poolProps.setter - def poolProps(self, poolProps not None : CUmemPoolProps): - string.memcpy(&self._ptr[0].poolProps, poolProps.getPtr(), sizeof(self._ptr[0].poolProps)) + def srcNumBytes(self): + return self._pvt_ptr[0].srcNumBytes + @srcNumBytes.setter + def srcNumBytes(self, size_t srcNumBytes): + self._pvt_ptr[0].srcNumBytes = srcNumBytes + + @property - def accessDescs(self): - arrs = [self._ptr[0].accessDescs + x*sizeof(ccuda.CUmemAccessDesc) for x in range(self._accessDescs_length)] - return [CUmemAccessDesc(_ptr=arr) for arr in arrs] - @accessDescs.setter - def accessDescs(self, val): - if len(val) == 0: - free(self._accessDescs) - self._accessDescs_length = 0 - self._ptr[0].accessDescs = NULL - else: - if self._accessDescs_length != len(val): - free(self._accessDescs) - self._accessDescs = calloc(len(val), sizeof(ccuda.CUmemAccessDesc)) - if self._accessDescs is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(ccuda.CUmemAccessDesc))) - self._accessDescs_length = len(val) - self._ptr[0].accessDescs = self._accessDescs - for idx in range(len(val)): - string.memcpy(&self._accessDescs[idx], (val[idx])._ptr, sizeof(ccuda.CUmemAccessDesc)) + def dstNumBytes(self): + return self._pvt_ptr[0].dstNumBytes + @dstNumBytes.setter + def dstNumBytes(self, size_t dstNumBytes): + self._pvt_ptr[0].dstNumBytes = dstNumBytes + @property - def accessDescCount(self): - return self._ptr[0].accessDescCount - @accessDescCount.setter - def accessDescCount(self, size_t accessDescCount): - self._ptr[0].accessDescCount = accessDescCount + def dstActBytes(self): + return cuuint32_t(_ptr=self._pvt_ptr[0].dstActBytes) + + @property - def bytesize(self): - return self._ptr[0].bytesize - @bytesize.setter - def bytesize(self, size_t bytesize): - self._ptr[0].bytesize = bytesize + def src(self): + return self._pvt_ptr[0].src + @src.setter + def src(self, src): + self._cysrc = _HelperInputVoidPtr(src) + self._pvt_ptr[0].src = self._cysrc.cptr + + @property - def dptr(self): - return self._dptr - @dptr.setter - def dptr(self, dptr): - cdef ccuda.CUdeviceptr cdptr - if dptr is None: - cdptr = 0 - elif isinstance(dptr, (CUdeviceptr)): - pdptr = int(dptr) - cdptr = pdptr - else: - pdptr = int(CUdeviceptr(dptr)) - cdptr = pdptr - self._dptr._ptr[0] = cdptr + def dst(self): + return self._pvt_ptr[0].dst + @dst.setter + def dst(self, dst): + self._cydst = _HelperInputVoidPtr(dst) + self._pvt_ptr[0].dst = self._cydst.cptr -{{endif}} -{{if 'struct CUDA_MEM_FREE_NODE_PARAMS_st' in found_types}} -cdef class CUDA_MEM_FREE_NODE_PARAMS_st: + @property + def algo(self): + return CUmemDecompressAlgorithm(self._pvt_ptr[0].algo) + @algo.setter + def algo(self, algo not None : CUmemDecompressAlgorithm): + self._pvt_ptr[0].algo = int(algo) + + + @property + def padding(self): + return PyBytes_FromStringAndSize(self._pvt_ptr[0].padding, 20) + @padding.setter + def padding(self, padding): + if len(padding) != 20: + raise ValueError("padding length must be 20, is " + str(len(padding))) + for i, b in enumerate(padding): + self._pvt_ptr[0].padding[i] = b + + +cdef class CUlogicalEndpointFabricHandle_st: """ - Memory free node parameters + Fabric handle for a logical endpoint Attributes ---------- - dptr : CUdeviceptr - in: the pointer to free + + data : bytes + + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - self._dptr = CUdeviceptr(_ptr=&self._ptr[0].dptr) + pass def __dealloc__(self): pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['dptr : ' + str(self.dptr)] + str_list += ['data : ' + str(self.data)] except ValueError: - str_list += ['dptr : '] + str_list += ['data : '] + return '\n'.join(str_list) else: return '' + @property - def dptr(self): - return self._dptr - @dptr.setter - def dptr(self, dptr): - cdef ccuda.CUdeviceptr cdptr - if dptr is None: - cdptr = 0 - elif isinstance(dptr, (CUdeviceptr)): - pdptr = int(dptr) - cdptr = pdptr - else: - pdptr = int(CUdeviceptr(dptr)) - cdptr = pdptr - self._dptr._ptr[0] = cdptr + def data(self): + return PyBytes_FromStringAndSize(self._pvt_ptr[0].data, 64) + @data.setter + def data(self, data): + if len(data) != 64: + raise ValueError("data length must be 64, is " + str(len(data))) + for i, b in enumerate(data): + self._pvt_ptr[0].data[i] = b -{{endif}} -{{if 'struct CUDA_CHILD_GRAPH_NODE_PARAMS_st' in found_types}} -cdef class CUDA_CHILD_GRAPH_NODE_PARAMS_st: +cdef class anon_struct25: """ - Child graph node parameters - Attributes ---------- - graph : CUgraph - The child graph to clone into the node for node creation, or a - handle to the graph owned by the node for node query + + device : CUdevice + + Methods ------- getPtr() Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - else: - self._ptr = _ptr - def __init__(self, void_ptr _ptr = 0): - self._graph = CUgraph(_ptr=&self._ptr[0].graph) + def __cinit__(self, void_ptr _ptr): + self._pvt_ptr = _ptr + + def __init__(self, void_ptr _ptr): + pass + + self._device = CUdevice(_ptr=&self._pvt_ptr[0].unicast.device) + def __dealloc__(self): pass def getPtr(self): - return self._ptr + return &self._pvt_ptr[0].unicast def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['graph : ' + str(self.graph)] + str_list += ['device : ' + str(self.device)] except ValueError: - str_list += ['graph : '] + str_list += ['device : '] + return '\n'.join(str_list) else: return '' + @property - def graph(self): - return self._graph - @graph.setter - def graph(self, graph): - cdef ccuda.CUgraph cgraph - if graph is None: - cgraph = 0 - elif isinstance(graph, (CUgraph,)): - pgraph = int(graph) - cgraph = pgraph + def device(self): + return self._device + @device.setter + def device(self, device): + cdef cydriver.CUdevice cydevice + if device is None: + cydevice = 0 + elif isinstance(device, (CUdevice)): + pdevice = int(device) + cydevice = pdevice else: - pgraph = int(CUgraph(graph)) - cgraph = pgraph - self._graph._ptr[0] = cgraph -{{endif}} -{{if 'struct CUDA_EVENT_RECORD_NODE_PARAMS_st' in found_types}} + pdevice = int(CUdevice(device)) + cydevice = pdevice + self._device._pvt_ptr[0] = cydevice + -cdef class CUDA_EVENT_RECORD_NODE_PARAMS_st: - """ - Event record node parameters +cdef class anon_struct26: + """ Attributes ---------- - event : CUevent - The event to record when the node executes + + numDevices : unsigned int + + Methods ------- getPtr() Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - else: - self._ptr = _ptr - def __init__(self, void_ptr _ptr = 0): - self._event = CUevent(_ptr=&self._ptr[0].event) + def __cinit__(self, void_ptr _ptr): + self._pvt_ptr = _ptr + + def __init__(self, void_ptr _ptr): + pass def __dealloc__(self): pass def getPtr(self): - return self._ptr + return &self._pvt_ptr[0].multicast def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['event : ' + str(self.event)] + str_list += ['numDevices : ' + str(self.numDevices)] except ValueError: - str_list += ['event : '] + str_list += ['numDevices : '] + return '\n'.join(str_list) else: return '' + @property - def event(self): - return self._event - @event.setter - def event(self, event): - cdef ccuda.CUevent cevent - if event is None: - cevent = 0 - elif isinstance(event, (CUevent,)): - pevent = int(event) - cevent = pevent - else: - pevent = int(CUevent(event)) - cevent = pevent - self._event._ptr[0] = cevent -{{endif}} -{{if 'struct CUDA_EVENT_WAIT_NODE_PARAMS_st' in found_types}} + def numDevices(self): + return self._pvt_ptr[0].multicast.numDevices + @numDevices.setter + def numDevices(self, unsigned int numDevices): + self._pvt_ptr[0].multicast.numDevices = numDevices -cdef class CUDA_EVENT_WAIT_NODE_PARAMS_st: + +cdef class CUlogicalEndpointProp_struct: """ - Event wait node parameters + Properties of a logical endpoint construction Attributes ---------- - event : CUevent - The event to wait on from the node + + type : CUlogicalEndpointType + Type of the logical endpoint defined in CUlogicalEndpointType + + + unicast : anon_struct25 + + + + multicast : anon_struct26 + + + + size : unsigned long long + Size of the logical endpoint + + + ipcHandleTypes : unsigned int + A bitmask of IPC handle types defined in + CUlogicalEndpointIpcHandleType + + + flags : unsigned int + A bitmask of flags defined in CUlogicalEndpointFlag + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._val_ptr = calloc(1, sizeof(cydriver.CUlogicalEndpointProp_struct)) + self._pvt_ptr = self._val_ptr else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - self._event = CUevent(_ptr=&self._ptr[0].event) - def __dealloc__(self): pass + + self._unicast = anon_struct25(_ptr=self._pvt_ptr) + + + self._multicast = anon_struct26(_ptr=self._pvt_ptr) + + def __dealloc__(self): + if self._val_ptr is not NULL: + free(self._val_ptr) def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['event : ' + str(self.event)] + str_list += ['type : ' + str(self.type)] except ValueError: - str_list += ['event : '] + str_list += ['type : '] + + + try: + str_list += ['unicast :\n' + '\n'.join([' ' + line for line in str(self.unicast).splitlines()])] + except ValueError: + str_list += ['unicast : '] + + + try: + str_list += ['multicast :\n' + '\n'.join([' ' + line for line in str(self.multicast).splitlines()])] + except ValueError: + str_list += ['multicast : '] + + + try: + str_list += ['size : ' + str(self.size)] + except ValueError: + str_list += ['size : '] + + + try: + str_list += ['ipcHandleTypes : ' + str(self.ipcHandleTypes)] + except ValueError: + str_list += ['ipcHandleTypes : '] + + + try: + str_list += ['flags : ' + str(self.flags)] + except ValueError: + str_list += ['flags : '] + return '\n'.join(str_list) else: return '' + @property - def event(self): - return self._event - @event.setter - def event(self, event): - cdef ccuda.CUevent cevent - if event is None: - cevent = 0 - elif isinstance(event, (CUevent,)): - pevent = int(event) - cevent = pevent - else: - pevent = int(CUevent(event)) - cevent = pevent - self._event._ptr[0] = cevent -{{endif}} -{{if 'struct CUgraphNodeParams_st' in found_types}} + def type(self): + return CUlogicalEndpointType(self._pvt_ptr[0].type) + @type.setter + def type(self, type not None : CUlogicalEndpointType): + self._pvt_ptr[0].type = int(type) -cdef class CUgraphNodeParams_st: - """ - Graph node parameters. See cuGraphAddNode. + @property + def unicast(self): + return self._unicast + @unicast.setter + def unicast(self, unicast not None : anon_struct25): + string.memcpy(&self._pvt_ptr[0].unicast, unicast.getPtr(), sizeof(self._pvt_ptr[0].unicast)) + + + @property + def multicast(self): + return self._multicast + @multicast.setter + def multicast(self, multicast not None : anon_struct26): + string.memcpy(&self._pvt_ptr[0].multicast, multicast.getPtr(), sizeof(self._pvt_ptr[0].multicast)) + + + @property + def size(self): + return self._pvt_ptr[0].size + @size.setter + def size(self, unsigned long long size): + self._pvt_ptr[0].size = size + + + @property + def ipcHandleTypes(self): + return self._pvt_ptr[0].ipcHandleTypes + @ipcHandleTypes.setter + def ipcHandleTypes(self, unsigned int ipcHandleTypes): + self._pvt_ptr[0].ipcHandleTypes = ipcHandleTypes + + + @property + def flags(self): + return self._pvt_ptr[0].flags + @flags.setter + def flags(self, unsigned int flags): + self._pvt_ptr[0].flags = flags + + +cdef class CUdevSmResource_st: + """ Attributes ---------- - type : CUgraphNodeType - Type of the node - reserved0 : List[int] - Reserved. Must be zero. - reserved1 : List[long long] - Padding. Unused bytes must be zero. - kernel : CUDA_KERNEL_NODE_PARAMS_v3 - Kernel node parameters. - memcpy : CUDA_MEMCPY_NODE_PARAMS - Memcpy node parameters. - memset : CUDA_MEMSET_NODE_PARAMS_v2 - Memset node parameters. - host : CUDA_HOST_NODE_PARAMS_v2 - Host node parameters. - graph : CUDA_CHILD_GRAPH_NODE_PARAMS - Child graph node parameters. - eventWait : CUDA_EVENT_WAIT_NODE_PARAMS - Event wait node parameters. - eventRecord : CUDA_EVENT_RECORD_NODE_PARAMS - Event record node parameters. - extSemSignal : CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2 - External semaphore signal node parameters. - extSemWait : CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2 - External semaphore wait node parameters. - alloc : CUDA_MEM_ALLOC_NODE_PARAMS_v2 - Memory allocation node parameters. - free : CUDA_MEM_FREE_NODE_PARAMS - Memory free node parameters. - memOp : CUDA_BATCH_MEM_OP_NODE_PARAMS_v2 - MemOp node parameters. - conditional : CUDA_CONDITIONAL_NODE_PARAMS - Conditional node parameters. - reserved2 : long long - Reserved bytes. Must be zero. + + smCount : unsigned int + The amount of streaming multiprocessors available in this resource. + + + minSmPartitionSize : unsigned int + The minimum number of streaming multiprocessors required to + partition this resource. + + + smCoscheduledAlignment : unsigned int + The number of streaming multiprocessors in this resource that are + guaranteed to be co-scheduled on the same GPU processing cluster. + smCount will be a multiple of this value, unless the backfill flag + is set. + + + flags : unsigned int + The flags set on this SM resource. For possible values see + CUdevSmResourceGroup_flags. + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._val_ptr = calloc(1, sizeof(ccuda.CUgraphNodeParams_st)) - self._ptr = self._val_ptr + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - self._kernel = CUDA_KERNEL_NODE_PARAMS_v3(_ptr=&self._ptr[0].kernel) - self._memcpy = CUDA_MEMCPY_NODE_PARAMS(_ptr=&self._ptr[0].memcpy) - self._memset = CUDA_MEMSET_NODE_PARAMS_v2(_ptr=&self._ptr[0].memset) - self._host = CUDA_HOST_NODE_PARAMS_v2(_ptr=&self._ptr[0].host) - self._graph = CUDA_CHILD_GRAPH_NODE_PARAMS(_ptr=&self._ptr[0].graph) - self._eventWait = CUDA_EVENT_WAIT_NODE_PARAMS(_ptr=&self._ptr[0].eventWait) - self._eventRecord = CUDA_EVENT_RECORD_NODE_PARAMS(_ptr=&self._ptr[0].eventRecord) - self._extSemSignal = CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2(_ptr=&self._ptr[0].extSemSignal) - self._extSemWait = CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2(_ptr=&self._ptr[0].extSemWait) - self._alloc = CUDA_MEM_ALLOC_NODE_PARAMS_v2(_ptr=&self._ptr[0].alloc) - self._free = CUDA_MEM_FREE_NODE_PARAMS(_ptr=&self._ptr[0].free) - self._memOp = CUDA_BATCH_MEM_OP_NODE_PARAMS_v2(_ptr=&self._ptr[0].memOp) - self._conditional = CUDA_CONDITIONAL_NODE_PARAMS(_ptr=&self._ptr[0].conditional) + pass def __dealloc__(self): - if self._val_ptr is not NULL: - free(self._val_ptr) + pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['type : ' + str(self.type)] - except ValueError: - str_list += ['type : '] - try: - str_list += ['reserved0 : ' + str(self.reserved0)] - except ValueError: - str_list += ['reserved0 : '] - try: - str_list += ['reserved1 : ' + str(self.reserved1)] - except ValueError: - str_list += ['reserved1 : '] - try: - str_list += ['kernel :\n' + '\n'.join([' ' + line for line in str(self.kernel).splitlines()])] - except ValueError: - str_list += ['kernel : '] - try: - str_list += ['memcpy :\n' + '\n'.join([' ' + line for line in str(self.memcpy).splitlines()])] - except ValueError: - str_list += ['memcpy : '] - try: - str_list += ['memset :\n' + '\n'.join([' ' + line for line in str(self.memset).splitlines()])] - except ValueError: - str_list += ['memset : '] - try: - str_list += ['host :\n' + '\n'.join([' ' + line for line in str(self.host).splitlines()])] - except ValueError: - str_list += ['host : '] - try: - str_list += ['graph :\n' + '\n'.join([' ' + line for line in str(self.graph).splitlines()])] - except ValueError: - str_list += ['graph : '] - try: - str_list += ['eventWait :\n' + '\n'.join([' ' + line for line in str(self.eventWait).splitlines()])] - except ValueError: - str_list += ['eventWait : '] - try: - str_list += ['eventRecord :\n' + '\n'.join([' ' + line for line in str(self.eventRecord).splitlines()])] + str_list += ['smCount : ' + str(self.smCount)] except ValueError: - str_list += ['eventRecord : '] + str_list += ['smCount : '] + + try: - str_list += ['extSemSignal :\n' + '\n'.join([' ' + line for line in str(self.extSemSignal).splitlines()])] + str_list += ['minSmPartitionSize : ' + str(self.minSmPartitionSize)] except ValueError: - str_list += ['extSemSignal : '] + str_list += ['minSmPartitionSize : '] + + try: - str_list += ['extSemWait :\n' + '\n'.join([' ' + line for line in str(self.extSemWait).splitlines()])] + str_list += ['smCoscheduledAlignment : ' + str(self.smCoscheduledAlignment)] except ValueError: - str_list += ['extSemWait : '] + str_list += ['smCoscheduledAlignment : '] + + try: - str_list += ['alloc :\n' + '\n'.join([' ' + line for line in str(self.alloc).splitlines()])] + str_list += ['flags : ' + str(self.flags)] except ValueError: - str_list += ['alloc : '] + str_list += ['flags : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def smCount(self): + return self._pvt_ptr[0].smCount + @smCount.setter + def smCount(self, unsigned int smCount): + self._pvt_ptr[0].smCount = smCount + + + @property + def minSmPartitionSize(self): + return self._pvt_ptr[0].minSmPartitionSize + @minSmPartitionSize.setter + def minSmPartitionSize(self, unsigned int minSmPartitionSize): + self._pvt_ptr[0].minSmPartitionSize = minSmPartitionSize + + + @property + def smCoscheduledAlignment(self): + return self._pvt_ptr[0].smCoscheduledAlignment + @smCoscheduledAlignment.setter + def smCoscheduledAlignment(self, unsigned int smCoscheduledAlignment): + self._pvt_ptr[0].smCoscheduledAlignment = smCoscheduledAlignment + + + @property + def flags(self): + return self._pvt_ptr[0].flags + @flags.setter + def flags(self, unsigned int flags): + self._pvt_ptr[0].flags = flags + + +cdef class CUdevWorkqueueConfigResource_st: + """ + Attributes + ---------- + + device : CUdevice + The device on which the workqueue resources are available + + + wqConcurrencyLimit : unsigned int + The expected maximum number of concurrent stream-ordered workloads + + + sharingScope : CUdevWorkqueueConfigScope + The sharing scope for the workqueue resources + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass + + self._device = CUdevice(_ptr=&self._pvt_ptr[0].device) + + def __dealloc__(self): + pass + def getPtr(self): + return self._pvt_ptr + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + try: - str_list += ['free :\n' + '\n'.join([' ' + line for line in str(self.free).splitlines()])] + str_list += ['device : ' + str(self.device)] except ValueError: - str_list += ['free : '] + str_list += ['device : '] + + try: - str_list += ['memOp :\n' + '\n'.join([' ' + line for line in str(self.memOp).splitlines()])] + str_list += ['wqConcurrencyLimit : ' + str(self.wqConcurrencyLimit)] except ValueError: - str_list += ['memOp : '] + str_list += ['wqConcurrencyLimit : '] + + try: - str_list += ['conditional :\n' + '\n'.join([' ' + line for line in str(self.conditional).splitlines()])] + str_list += ['sharingScope : ' + str(self.sharingScope)] except ValueError: - str_list += ['conditional : '] + str_list += ['sharingScope : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def device(self): + return self._device + @device.setter + def device(self, device): + cdef cydriver.CUdevice cydevice + if device is None: + cydevice = 0 + elif isinstance(device, (CUdevice)): + pdevice = int(device) + cydevice = pdevice + else: + pdevice = int(CUdevice(device)) + cydevice = pdevice + self._device._pvt_ptr[0] = cydevice + + + + @property + def wqConcurrencyLimit(self): + return self._pvt_ptr[0].wqConcurrencyLimit + @wqConcurrencyLimit.setter + def wqConcurrencyLimit(self, unsigned int wqConcurrencyLimit): + self._pvt_ptr[0].wqConcurrencyLimit = wqConcurrencyLimit + + + @property + def sharingScope(self): + return CUdevWorkqueueConfigScope(self._pvt_ptr[0].sharingScope) + @sharingScope.setter + def sharingScope(self, sharingScope not None : CUdevWorkqueueConfigScope): + self._pvt_ptr[0].sharingScope = int(sharingScope) + + +cdef class CUdevWorkqueueResource_st: + """ + Attributes + ---------- + + reserved : bytes + Reserved for future use + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass + def __dealloc__(self): + pass + def getPtr(self): + return self._pvt_ptr + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + try: - str_list += ['reserved2 : ' + str(self.reserved2)] + str_list += ['reserved : ' + str(self.reserved)] except ValueError: - str_list += ['reserved2 : '] + str_list += ['reserved : '] + return '\n'.join(str_list) else: return '' + @property - def type(self): - return CUgraphNodeType(self._ptr[0].type) - @type.setter - def type(self, type not None : CUgraphNodeType): - self._ptr[0].type = type.value - @property - def reserved0(self): - return self._ptr[0].reserved0 - @reserved0.setter - def reserved0(self, reserved0): - self._ptr[0].reserved0 = reserved0 - @property - def reserved1(self): - return self._ptr[0].reserved1 - @reserved1.setter - def reserved1(self, reserved1): - self._ptr[0].reserved1 = reserved1 - @property - def kernel(self): - return self._kernel - @kernel.setter - def kernel(self, kernel not None : CUDA_KERNEL_NODE_PARAMS_v3): - string.memcpy(&self._ptr[0].kernel, kernel.getPtr(), sizeof(self._ptr[0].kernel)) - @property - def memcpy(self): - return self._memcpy - @memcpy.setter - def memcpy(self, memcpy not None : CUDA_MEMCPY_NODE_PARAMS): - string.memcpy(&self._ptr[0].memcpy, memcpy.getPtr(), sizeof(self._ptr[0].memcpy)) - @property - def memset(self): - return self._memset - @memset.setter - def memset(self, memset not None : CUDA_MEMSET_NODE_PARAMS_v2): - string.memcpy(&self._ptr[0].memset, memset.getPtr(), sizeof(self._ptr[0].memset)) - @property - def host(self): - return self._host - @host.setter - def host(self, host not None : CUDA_HOST_NODE_PARAMS_v2): - string.memcpy(&self._ptr[0].host, host.getPtr(), sizeof(self._ptr[0].host)) - @property - def graph(self): - return self._graph - @graph.setter - def graph(self, graph not None : CUDA_CHILD_GRAPH_NODE_PARAMS): - string.memcpy(&self._ptr[0].graph, graph.getPtr(), sizeof(self._ptr[0].graph)) - @property - def eventWait(self): - return self._eventWait - @eventWait.setter - def eventWait(self, eventWait not None : CUDA_EVENT_WAIT_NODE_PARAMS): - string.memcpy(&self._ptr[0].eventWait, eventWait.getPtr(), sizeof(self._ptr[0].eventWait)) - @property - def eventRecord(self): - return self._eventRecord - @eventRecord.setter - def eventRecord(self, eventRecord not None : CUDA_EVENT_RECORD_NODE_PARAMS): - string.memcpy(&self._ptr[0].eventRecord, eventRecord.getPtr(), sizeof(self._ptr[0].eventRecord)) - @property - def extSemSignal(self): - return self._extSemSignal - @extSemSignal.setter - def extSemSignal(self, extSemSignal not None : CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2): - string.memcpy(&self._ptr[0].extSemSignal, extSemSignal.getPtr(), sizeof(self._ptr[0].extSemSignal)) - @property - def extSemWait(self): - return self._extSemWait - @extSemWait.setter - def extSemWait(self, extSemWait not None : CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2): - string.memcpy(&self._ptr[0].extSemWait, extSemWait.getPtr(), sizeof(self._ptr[0].extSemWait)) - @property - def alloc(self): - return self._alloc - @alloc.setter - def alloc(self, alloc not None : CUDA_MEM_ALLOC_NODE_PARAMS_v2): - string.memcpy(&self._ptr[0].alloc, alloc.getPtr(), sizeof(self._ptr[0].alloc)) - @property - def free(self): - return self._free - @free.setter - def free(self, free not None : CUDA_MEM_FREE_NODE_PARAMS): - string.memcpy(&self._ptr[0].free, free.getPtr(), sizeof(self._ptr[0].free)) - @property - def memOp(self): - return self._memOp - @memOp.setter - def memOp(self, memOp not None : CUDA_BATCH_MEM_OP_NODE_PARAMS_v2): - string.memcpy(&self._ptr[0].memOp, memOp.getPtr(), sizeof(self._ptr[0].memOp)) - @property - def conditional(self): - return self._conditional - @conditional.setter - def conditional(self, conditional not None : CUDA_CONDITIONAL_NODE_PARAMS): - string.memcpy(&self._ptr[0].conditional, conditional.getPtr(), sizeof(self._ptr[0].conditional)) - @property - def reserved2(self): - return self._ptr[0].reserved2 - @reserved2.setter - def reserved2(self, long long reserved2): - self._ptr[0].reserved2 = reserved2 -{{endif}} -{{if 'struct CUdevSmResource_st' in found_types}} + def reserved(self): + return PyBytes_FromStringAndSize(self._pvt_ptr[0].reserved, 40) + @reserved.setter + def reserved(self, reserved): + if len(reserved) != 40: + raise ValueError("reserved length must be 40, is " + str(len(reserved))) + for i, b in enumerate(reserved): + self._pvt_ptr[0].reserved[i] = b -cdef class CUdevSmResource_st: + +cdef class CU_DEV_SM_RESOURCE_GROUP_PARAMS_st: """ Attributes ---------- + smCount : unsigned int - The amount of streaming multiprocessors available in this resource. - This is an output parameter only, do not write to this field. + The amount of SMs available in this resource. + + + coscheduledSmCount : unsigned int + The amount of co-scheduled SMs grouped together for locality + purposes. + + + preferredCoscheduledSmCount : unsigned int + When possible, combine co-scheduled groups together into larger + groups of this size. + + + flags : unsigned int + The flags set on this SM resource group. For possible values see + CUdevSmResourceGroup_flags. + + + reserved : list[unsigned int] + + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): pass def __dealloc__(self): pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: str_list += ['smCount : ' + str(self.smCount)] except ValueError: str_list += ['smCount : '] + + + try: + str_list += ['coscheduledSmCount : ' + str(self.coscheduledSmCount)] + except ValueError: + str_list += ['coscheduledSmCount : '] + + + try: + str_list += ['preferredCoscheduledSmCount : ' + str(self.preferredCoscheduledSmCount)] + except ValueError: + str_list += ['preferredCoscheduledSmCount : '] + + + try: + str_list += ['flags : ' + str(self.flags)] + except ValueError: + str_list += ['flags : '] + + + try: + str_list += ['reserved : ' + str(self.reserved)] + except ValueError: + str_list += ['reserved : '] + return '\n'.join(str_list) else: return '' + @property def smCount(self): - return self._ptr[0].smCount + return self._pvt_ptr[0].smCount @smCount.setter def smCount(self, unsigned int smCount): - self._ptr[0].smCount = smCount -{{endif}} -{{if 'struct CUdevResource_st' in found_types}} + self._pvt_ptr[0].smCount = smCount + + + @property + def coscheduledSmCount(self): + return self._pvt_ptr[0].coscheduledSmCount + @coscheduledSmCount.setter + def coscheduledSmCount(self, unsigned int coscheduledSmCount): + self._pvt_ptr[0].coscheduledSmCount = coscheduledSmCount + + + @property + def preferredCoscheduledSmCount(self): + return self._pvt_ptr[0].preferredCoscheduledSmCount + @preferredCoscheduledSmCount.setter + def preferredCoscheduledSmCount(self, unsigned int preferredCoscheduledSmCount): + self._pvt_ptr[0].preferredCoscheduledSmCount = preferredCoscheduledSmCount + + + @property + def flags(self): + return self._pvt_ptr[0].flags + @flags.setter + def flags(self, unsigned int flags): + self._pvt_ptr[0].flags = flags + + + @property + def reserved(self): + return self._pvt_ptr[0].reserved + @reserved.setter + def reserved(self, reserved): + self._pvt_ptr[0].reserved = reserved + cdef class CUdevResource_st: """ Attributes ---------- + type : CUdevResourceType Type of resource, dictates which union field was last set + + _internal_padding : bytes + + sm : CUdevSmResource - Resource corresponding to CU_DEV_RESOURCE_TYPE_SM ``. type. + Resource corresponding to CU_DEV_RESOURCE_TYPE_SM `typename`. + + + wqConfig : CUdevWorkqueueConfigResource + Resource corresponding to CU_DEV_RESOURCE_TYPE_WORKQUEUE_CONFIG + `typename`. + + + wq : CUdevWorkqueueResource + Resource corresponding to CU_DEV_RESOURCE_TYPE_WORKQUEUE + `typename`. + + _oversize : bytes + + nextResource : CUdevResource_st + + + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._val_ptr = calloc(1, sizeof(ccuda.CUdevResource_st)) - self._ptr = self._val_ptr + self._val_ptr = calloc(1, sizeof(cydriver.CUdevResource_st)) + self._pvt_ptr = self._val_ptr else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - self._sm = CUdevSmResource(_ptr=&self._ptr[0].sm) + pass + + self._sm = CUdevSmResource(_ptr=&self._pvt_ptr[0].sm) + + + self._wqConfig = CUdevWorkqueueConfigResource(_ptr=&self._pvt_ptr[0].wqConfig) + + + self._wq = CUdevWorkqueueResource(_ptr=&self._pvt_ptr[0].wq) + def __dealloc__(self): if self._val_ptr is not NULL: free(self._val_ptr) + + if self._nextResource is not NULL: + free(self._nextResource) + self._pvt_ptr[0].nextResource = NULL + def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: str_list += ['type : ' + str(self.type)] except ValueError: str_list += ['type : '] + + try: str_list += ['_internal_padding : ' + str(self._internal_padding)] except ValueError: str_list += ['_internal_padding : '] + + try: str_list += ['sm :\n' + '\n'.join([' ' + line for line in str(self.sm).splitlines()])] except ValueError: str_list += ['sm : '] + + + try: + str_list += ['wqConfig :\n' + '\n'.join([' ' + line for line in str(self.wqConfig).splitlines()])] + except ValueError: + str_list += ['wqConfig : '] + + + try: + str_list += ['wq :\n' + '\n'.join([' ' + line for line in str(self.wq).splitlines()])] + except ValueError: + str_list += ['wq : '] + + try: str_list += ['_oversize : ' + str(self._oversize)] except ValueError: str_list += ['_oversize : '] + + + try: + str_list += ['nextResource : ' + str(self.nextResource)] + except ValueError: + str_list += ['nextResource : '] + return '\n'.join(str_list) else: return '' + @property def type(self): - return CUdevResourceType(self._ptr[0].type) + return CUdevResourceType(self._pvt_ptr[0].type) @type.setter def type(self, type not None : CUdevResourceType): - self._ptr[0].type = type.value + self._pvt_ptr[0].type = int(type) + + @property def _internal_padding(self): - return PyBytes_FromStringAndSize(self._ptr[0]._internal_padding, 92) + return PyBytes_FromStringAndSize(self._pvt_ptr[0]._internal_padding, 92) @_internal_padding.setter def _internal_padding(self, _internal_padding): if len(_internal_padding) != 92: raise ValueError("_internal_padding length must be 92, is " + str(len(_internal_padding))) for i, b in enumerate(_internal_padding): - self._ptr[0]._internal_padding[i] = b + self._pvt_ptr[0]._internal_padding[i] = b + + @property def sm(self): return self._sm @sm.setter def sm(self, sm not None : CUdevSmResource): - string.memcpy(&self._ptr[0].sm, sm.getPtr(), sizeof(self._ptr[0].sm)) + string.memcpy(&self._pvt_ptr[0].sm, sm.getPtr(), sizeof(self._pvt_ptr[0].sm)) + + + @property + def wqConfig(self): + return self._wqConfig + @wqConfig.setter + def wqConfig(self, wqConfig not None : CUdevWorkqueueConfigResource): + string.memcpy(&self._pvt_ptr[0].wqConfig, wqConfig.getPtr(), sizeof(self._pvt_ptr[0].wqConfig)) + + + @property + def wq(self): + return self._wq + @wq.setter + def wq(self, wq not None : CUdevWorkqueueResource): + string.memcpy(&self._pvt_ptr[0].wq, wq.getPtr(), sizeof(self._pvt_ptr[0].wq)) + + @property def _oversize(self): - return PyBytes_FromStringAndSize(self._ptr[0]._oversize, 48) + return PyBytes_FromStringAndSize(self._pvt_ptr[0]._oversize, 40) @_oversize.setter def _oversize(self, _oversize): - if len(_oversize) != 48: - raise ValueError("_oversize length must be 48, is " + str(len(_oversize))) + if len(_oversize) != 40: + raise ValueError("_oversize length must be 40, is " + str(len(_oversize))) for i, b in enumerate(_oversize): - self._ptr[0]._oversize[i] = b -{{endif}} -{{if True}} + self._pvt_ptr[0]._oversize[i] = b + + + @property + def nextResource(self): + arrs = [self._pvt_ptr[0].nextResource + x*sizeof(cydriver.CUdevResource_st) for x in range(self._nextResource_length)] + return [CUdevResource_st(_ptr=arr) for arr in arrs] + @nextResource.setter + def nextResource(self, val): + if len(val) == 0: + free(self._nextResource) + self._nextResource = NULL + self._nextResource_length = 0 + self._pvt_ptr[0].nextResource = NULL + else: + if self._nextResource_length != len(val): + free(self._nextResource) + self._nextResource = calloc(len(val), sizeof(cydriver.CUdevResource_st)) + if self._nextResource is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(cydriver.CUdevResource_st))) + self._nextResource_length = len(val) + self._pvt_ptr[0].nextResource = self._nextResource + for idx in range(len(val)): + string.memcpy(&self._nextResource[idx], (val[idx])._pvt_ptr, sizeof(cydriver.CUdevResource_st)) + -cdef class anon_union14: + +cdef class anon_union17: """ Attributes ---------- - pArray : List[CUarray] - pPitch : List[Any] + pArray : list[CUarray] + + + + pPitch : list[Any] + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): pass def __dealloc__(self): pass def getPtr(self): - return &self._ptr[0].frame + return &self._pvt_ptr[0].frame def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: str_list += ['pArray : ' + str(self.pArray)] except ValueError: str_list += ['pArray : '] + + try: str_list += ['pPitch : ' + hex(self.pPitch)] except ValueError: str_list += ['pPitch : '] + return '\n'.join(str_list) else: return '' + @property def pArray(self): - return [CUarray(init_value=_pArray) for _pArray in self._ptr[0].frame.pArray] + return [CUarray(init_value=_pArray) for _pArray in self._pvt_ptr[0].frame.pArray] @pArray.setter - def pArray(self, pArray : List[CUarray]): + def pArray(self, pArray : list[CUarray]): if len(pArray) != 3: raise IndexError('not enough values found during array assignment, expected 3, got', len(pArray)) pArray = [int(_pArray) for _pArray in pArray] for _idx, _pArray in enumerate(pArray): - self._ptr[0].frame.pArray[_idx] = _pArray + self._pvt_ptr[0].frame.pArray[_idx] = _pArray + + @property def pPitch(self): - return [_pPitch for _pPitch in self._ptr[0].frame.pPitch] + return [_pPitch for _pPitch in self._pvt_ptr[0].frame.pPitch] @pPitch.setter - def pPitch(self, pPitch : List[int]): + def pPitch(self, pPitch : list[int]): if len(pPitch) != 3: raise IndexError('not enough values found during array assignment, expected 3, got', len(pPitch)) pPitch = [_pPitch for _pPitch in pPitch] for _idx, _pPitch in enumerate(pPitch): - self._ptr[0].frame.pPitch[_idx] = _pPitch -{{endif}} -{{if True}} + self._pvt_ptr[0].frame.pPitch[_idx] = _pPitch + cdef class CUeglFrame_st: """ @@ -16868,154 +25218,214 @@ cdef class CUeglFrame_st: Attributes ---------- - frame : anon_union14 + + frame : anon_union17 + + width : unsigned int Width of first plane + + height : unsigned int Height of first plane + + depth : unsigned int Depth of first plane + + pitch : unsigned int Pitch of first plane + + planeCount : unsigned int Number of planes + + numChannels : unsigned int Number of channels for the plane + + frameType : CUeglFrameType Array or Pitch + + eglColorFormat : CUeglColorFormat CUDA EGL Color Format + + cuFormat : CUarray_format CUDA Array Format + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._val_ptr = calloc(1, sizeof(ccuda.CUeglFrame_st)) - self._ptr = self._val_ptr + self._val_ptr = calloc(1, sizeof(cydriver.CUeglFrame_st)) + self._pvt_ptr = self._val_ptr else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - self._frame = anon_union14(_ptr=self._ptr) + pass + + self._frame = anon_union17(_ptr=self._pvt_ptr) + def __dealloc__(self): if self._val_ptr is not NULL: free(self._val_ptr) def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: str_list += ['frame :\n' + '\n'.join([' ' + line for line in str(self.frame).splitlines()])] except ValueError: str_list += ['frame : '] + + try: str_list += ['width : ' + str(self.width)] except ValueError: str_list += ['width : '] + + try: str_list += ['height : ' + str(self.height)] except ValueError: str_list += ['height : '] + + try: str_list += ['depth : ' + str(self.depth)] except ValueError: str_list += ['depth : '] + + try: str_list += ['pitch : ' + str(self.pitch)] except ValueError: str_list += ['pitch : '] + + try: str_list += ['planeCount : ' + str(self.planeCount)] except ValueError: str_list += ['planeCount : '] + + try: str_list += ['numChannels : ' + str(self.numChannels)] except ValueError: str_list += ['numChannels : '] + + try: str_list += ['frameType : ' + str(self.frameType)] except ValueError: str_list += ['frameType : '] + + try: str_list += ['eglColorFormat : ' + str(self.eglColorFormat)] except ValueError: str_list += ['eglColorFormat : '] + + try: str_list += ['cuFormat : ' + str(self.cuFormat)] except ValueError: str_list += ['cuFormat : '] + return '\n'.join(str_list) else: return '' + @property def frame(self): return self._frame @frame.setter - def frame(self, frame not None : anon_union14): - string.memcpy(&self._ptr[0].frame, frame.getPtr(), sizeof(self._ptr[0].frame)) + def frame(self, frame not None : anon_union17): + string.memcpy(&self._pvt_ptr[0].frame, frame.getPtr(), sizeof(self._pvt_ptr[0].frame)) + + @property def width(self): - return self._ptr[0].width + return self._pvt_ptr[0].width @width.setter def width(self, unsigned int width): - self._ptr[0].width = width + self._pvt_ptr[0].width = width + + @property def height(self): - return self._ptr[0].height + return self._pvt_ptr[0].height @height.setter def height(self, unsigned int height): - self._ptr[0].height = height + self._pvt_ptr[0].height = height + + @property def depth(self): - return self._ptr[0].depth + return self._pvt_ptr[0].depth @depth.setter def depth(self, unsigned int depth): - self._ptr[0].depth = depth + self._pvt_ptr[0].depth = depth + + @property def pitch(self): - return self._ptr[0].pitch + return self._pvt_ptr[0].pitch @pitch.setter def pitch(self, unsigned int pitch): - self._ptr[0].pitch = pitch + self._pvt_ptr[0].pitch = pitch + + @property def planeCount(self): - return self._ptr[0].planeCount + return self._pvt_ptr[0].planeCount @planeCount.setter def planeCount(self, unsigned int planeCount): - self._ptr[0].planeCount = planeCount + self._pvt_ptr[0].planeCount = planeCount + + @property def numChannels(self): - return self._ptr[0].numChannels + return self._pvt_ptr[0].numChannels @numChannels.setter def numChannels(self, unsigned int numChannels): - self._ptr[0].numChannels = numChannels + self._pvt_ptr[0].numChannels = numChannels + + @property def frameType(self): - return CUeglFrameType(self._ptr[0].frameType) + return CUeglFrameType(self._pvt_ptr[0].frameType) @frameType.setter def frameType(self, frameType not None : CUeglFrameType): - self._ptr[0].frameType = frameType.value + self._pvt_ptr[0].frameType = int(frameType) + + @property def eglColorFormat(self): - return CUeglColorFormat(self._ptr[0].eglColorFormat) + return CUeglColorFormat(self._pvt_ptr[0].eglColorFormat) @eglColorFormat.setter def eglColorFormat(self, eglColorFormat not None : CUeglColorFormat): - self._ptr[0].eglColorFormat = eglColorFormat.value + self._pvt_ptr[0].eglColorFormat = int(eglColorFormat) + + @property def cuFormat(self): - return CUarray_format(self._ptr[0].cuFormat) + return CUarray_format(self._pvt_ptr[0].cuFormat) @cuFormat.setter def cuFormat(self, cuFormat not None : CUarray_format): - self._ptr[0].cuFormat = cuFormat.value -{{endif}} -{{if 'cuuint32_t' in found_types}} + self._pvt_ptr[0].cuFormat = int(cuFormat) + cdef class cuuint32_t: """ @@ -17028,22 +25438,19 @@ cdef class cuuint32_t: """ def __cinit__(self, uint32_t init_value = 0, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr if init_value: - self._ptr[0] = init_value + self._pvt_ptr[0] = init_value def __dealloc__(self): pass def __repr__(self): return '' def __int__(self): - return self._ptr[0] + return self._pvt_ptr[0] def getPtr(self): - return self._ptr -{{endif}} - -{{if 'cuuint64_t' in found_types}} + return self._pvt_ptr cdef class cuuint64_t: """ @@ -17056,22 +25463,19 @@ cdef class cuuint64_t: """ def __cinit__(self, uint64_t init_value = 0, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr if init_value: - self._ptr[0] = init_value + self._pvt_ptr[0] = init_value def __dealloc__(self): pass def __repr__(self): return '' def __int__(self): - return self._ptr[0] + return self._pvt_ptr[0] def getPtr(self): - return self._ptr -{{endif}} - -{{if 'CUdeviceptr_v2' in found_types}} + return self._pvt_ptr cdef class CUdeviceptr_v2: """ @@ -17086,22 +25490,19 @@ cdef class CUdeviceptr_v2: """ def __cinit__(self, unsigned long long init_value = 0, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr if init_value: - self._ptr[0] = init_value + self._pvt_ptr[0] = init_value def __dealloc__(self): pass def __repr__(self): return '' def __int__(self): - return self._ptr[0] + return self._pvt_ptr[0] def getPtr(self): - return self._ptr -{{endif}} - -{{if 'CUdevice_v1' in found_types}} + return self._pvt_ptr cdef class CUdevice_v1: """ @@ -17116,22 +25517,19 @@ cdef class CUdevice_v1: """ def __cinit__(self, int init_value = 0, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr if init_value: - self._ptr[0] = init_value + self._pvt_ptr[0] = init_value def __dealloc__(self): pass def __repr__(self): return '' def __int__(self): - return self._ptr[0] + return self._pvt_ptr[0] def getPtr(self): - return self._ptr -{{endif}} - -{{if 'CUtexObject_v1' in found_types}} + return self._pvt_ptr cdef class CUtexObject_v1: """ @@ -17146,22 +25544,19 @@ cdef class CUtexObject_v1: """ def __cinit__(self, unsigned long long init_value = 0, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr if init_value: - self._ptr[0] = init_value + self._pvt_ptr[0] = init_value def __dealloc__(self): pass def __repr__(self): return '' def __int__(self): - return self._ptr[0] + return self._pvt_ptr[0] def getPtr(self): - return self._ptr -{{endif}} - -{{if 'CUsurfObject_v1' in found_types}} + return self._pvt_ptr cdef class CUsurfObject_v1: """ @@ -17176,22 +25571,19 @@ cdef class CUsurfObject_v1: """ def __cinit__(self, unsigned long long init_value = 0, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr if init_value: - self._ptr[0] = init_value + self._pvt_ptr[0] = init_value def __dealloc__(self): pass def __repr__(self): return '' def __int__(self): - return self._ptr[0] + return self._pvt_ptr[0] def getPtr(self): - return self._ptr -{{endif}} - -{{if 'CUmemGenericAllocationHandle_v1' in found_types}} + return self._pvt_ptr cdef class CUmemGenericAllocationHandle_v1: """ @@ -17204,22 +25596,44 @@ cdef class CUmemGenericAllocationHandle_v1: """ def __cinit__(self, unsigned long long init_value = 0, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr if init_value: - self._ptr[0] = init_value + self._pvt_ptr[0] = init_value def __dealloc__(self): pass def __repr__(self): return '' def __int__(self): - return self._ptr[0] + return self._pvt_ptr[0] def getPtr(self): - return self._ptr -{{endif}} + return self._pvt_ptr + +cdef class CUlogIterator: + """ + + Methods + ------- + getPtr() + Get memory address of class instance -{{if True}} + """ + def __cinit__(self, unsigned int init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + if init_value: + self._pvt_ptr[0] = init_value + def __dealloc__(self): + pass + def __repr__(self): + return '' + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr cdef class GLenum: """ @@ -17232,22 +25646,19 @@ cdef class GLenum: """ def __cinit__(self, unsigned int init_value = 0, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr if init_value: - self._ptr[0] = init_value + self._pvt_ptr[0] = init_value def __dealloc__(self): pass def __repr__(self): return '' def __int__(self): - return self._ptr[0] + return self._pvt_ptr[0] def getPtr(self): - return self._ptr -{{endif}} - -{{if True}} + return self._pvt_ptr cdef class GLuint: """ @@ -17260,22 +25671,19 @@ cdef class GLuint: """ def __cinit__(self, unsigned int init_value = 0, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr if init_value: - self._ptr[0] = init_value + self._pvt_ptr[0] = init_value def __dealloc__(self): pass def __repr__(self): return '' def __int__(self): - return self._ptr[0] + return self._pvt_ptr[0] def getPtr(self): - return self._ptr -{{endif}} - -{{if True}} + return self._pvt_ptr cdef class EGLint: """ @@ -17288,22 +25696,19 @@ cdef class EGLint: """ def __cinit__(self, unsigned int init_value = 0, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr if init_value: - self._ptr[0] = init_value + self._pvt_ptr[0] = init_value def __dealloc__(self): pass def __repr__(self): return '' def __int__(self): - return self._ptr[0] + return self._pvt_ptr[0] def getPtr(self): - return self._ptr -{{endif}} - -{{if True}} + return self._pvt_ptr cdef class VdpDevice: """ @@ -17316,22 +25721,19 @@ cdef class VdpDevice: """ def __cinit__(self, uint32_t init_value = 0, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr if init_value: - self._ptr[0] = init_value + self._pvt_ptr[0] = init_value def __dealloc__(self): pass def __repr__(self): return '' def __int__(self): - return self._ptr[0] + return self._pvt_ptr[0] def getPtr(self): - return self._ptr -{{endif}} - -{{if True}} + return self._pvt_ptr cdef class VdpGetProcAddress: """ @@ -17344,22 +25746,19 @@ cdef class VdpGetProcAddress: """ def __cinit__(self, unsigned long long init_value = 0, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr if init_value: - self._ptr[0] = init_value + self._pvt_ptr[0] = init_value def __dealloc__(self): pass def __repr__(self): return '' def __int__(self): - return self._ptr[0] + return self._pvt_ptr[0] def getPtr(self): - return self._ptr -{{endif}} - -{{if True}} + return self._pvt_ptr cdef class VdpVideoSurface: """ @@ -17372,22 +25771,19 @@ cdef class VdpVideoSurface: """ def __cinit__(self, uint32_t init_value = 0, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr if init_value: - self._ptr[0] = init_value + self._pvt_ptr[0] = init_value def __dealloc__(self): pass def __repr__(self): return '' def __int__(self): - return self._ptr[0] + return self._pvt_ptr[0] def getPtr(self): - return self._ptr -{{endif}} - -{{if True}} + return self._pvt_ptr cdef class VdpOutputSurface: """ @@ -17400,22 +25796,19 @@ cdef class VdpOutputSurface: """ def __cinit__(self, uint32_t init_value = 0, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr if init_value: - self._ptr[0] = init_value + self._pvt_ptr[0] = init_value def __dealloc__(self): pass def __repr__(self): return '' def __int__(self): - return self._ptr[0] + return self._pvt_ptr[0] def getPtr(self): - return self._ptr -{{endif}} - -{{if 'cuGetErrorString' in found_functions}} + return self._pvt_ptr @cython.embedsignature(True) def cuGetErrorString(error not None : CUresult): @@ -17442,13 +25835,13 @@ def cuGetErrorString(error not None : CUresult): -------- :py:obj:`~.CUresult`, :py:obj:`~.cudaGetErrorString` """ - cdef ccuda.CUresult cerror = error.value + cdef cydriver.CUresult cyerror = int(error) cdef const char* pStr = NULL - err = ccuda.cuGetErrorString(cerror, &pStr) - return (CUresult(err), pStr) -{{endif}} - -{{if 'cuGetErrorName' in found_functions}} + with nogil: + err = cydriver.cuGetErrorString(cyerror, &pStr) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pStr if pStr != NULL else None) @cython.embedsignature(True) def cuGetErrorName(error not None : CUresult): @@ -17475,18 +25868,24 @@ def cuGetErrorName(error not None : CUresult): -------- :py:obj:`~.CUresult`, :py:obj:`~.cudaGetErrorName` """ - cdef ccuda.CUresult cerror = error.value + cdef cydriver.CUresult cyerror = int(error) cdef const char* pStr = NULL - err = ccuda.cuGetErrorName(cerror, &pStr) - return (CUresult(err), pStr) -{{endif}} - -{{if 'cuInit' in found_functions}} + with nogil: + err = cydriver.cuGetErrorName(cyerror, &pStr) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pStr if pStr != NULL else None) @cython.embedsignature(True) def cuInit(unsigned int Flags): """ Initialize the CUDA driver API Initializes the driver API and must be called before any other function from the driver API in the current process. Currently, the `Flags` parameter must be 0. If :py:obj:`~.cuInit()` has not been called, any function from the driver API will return :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`. + Note: cuInit preloads various libraries needed for JIT compilation. To + opt-out of this behavior, set the environment variable + CUDA_FORCE_PRELOAD_LIBRARIES=0. CUDA will lazily load JIT libraries as + needed. To disable JIT entirely, set the environment variable + CUDA_DISABLE_JIT=1. + Parameters ---------- Flags : unsigned int @@ -17497,11 +25896,9 @@ def cuInit(unsigned int Flags): CUresult :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_INVALID_DEVICE`, :py:obj:`~.CUDA_ERROR_SYSTEM_DRIVER_MISMATCH`, :py:obj:`~.CUDA_ERROR_COMPAT_NOT_SUPPORTED_ON_DEVICE` """ - err = ccuda.cuInit(Flags) - return (CUresult(err),) -{{endif}} - -{{if 'cuDriverGetVersion' in found_functions}} + with nogil: + err = cydriver.cuInit(Flags) + return (_CUresult(err),) @cython.embedsignature(True) def cuDriverGetVersion(): @@ -17526,11 +25923,11 @@ def cuDriverGetVersion(): :py:obj:`~.cudaDriverGetVersion`, :py:obj:`~.cudaRuntimeGetVersion` """ cdef int driverVersion = 0 - err = ccuda.cuDriverGetVersion(&driverVersion) - return (CUresult(err), driverVersion) -{{endif}} - -{{if 'cuDeviceGet' in found_functions}} + with nogil: + err = cydriver.cuDriverGetVersion(&driverVersion) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, driverVersion) @cython.embedsignature(True) def cuDeviceGet(int ordinal): @@ -17556,11 +25953,11 @@ def cuDeviceGet(int ordinal): :py:obj:`~.cuDeviceGetAttribute`, :py:obj:`~.cuDeviceGetCount`, :py:obj:`~.cuDeviceGetName`, :py:obj:`~.cuDeviceGetUuid`, :py:obj:`~.cuDeviceGetLuid`, :py:obj:`~.cuDeviceTotalMem`, :py:obj:`~.cuDeviceGetExecAffinitySupport` """ cdef CUdevice device = CUdevice() - err = ccuda.cuDeviceGet(device._ptr, ordinal) - return (CUresult(err), device) -{{endif}} - -{{if 'cuDeviceGetCount' in found_functions}} + with nogil: + err = cydriver.cuDeviceGet(device._pvt_ptr, ordinal) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, device) @cython.embedsignature(True) def cuDeviceGetCount(): @@ -17582,11 +25979,11 @@ def cuDeviceGetCount(): :py:obj:`~.cuDeviceGetAttribute`, :py:obj:`~.cuDeviceGetName`, :py:obj:`~.cuDeviceGetUuid`, :py:obj:`~.cuDeviceGetLuid`, :py:obj:`~.cuDeviceGet`, :py:obj:`~.cuDeviceTotalMem`, :py:obj:`~.cuDeviceGetExecAffinitySupport`, :py:obj:`~.cudaGetDeviceCount` """ cdef int count = 0 - err = ccuda.cuDeviceGetCount(&count) - return (CUresult(err), count) -{{endif}} - -{{if 'cuDeviceGetName' in found_functions}} + with nogil: + err = cydriver.cuDeviceGetCount(&count) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, count) @cython.embedsignature(True) def cuDeviceGetName(int length, dev): @@ -17594,7 +25991,8 @@ def cuDeviceGetName(int length, dev): Returns an ASCII string identifying the device `dev` in the NULL- terminated string pointed to by `name`. `length` specifies the maximum - length of the string that may be returned. + length of the string that may be returned. `name` is shortened to the + specified `length`, if `length` is less than the device name Parameters ---------- @@ -17614,70 +26012,26 @@ def cuDeviceGetName(int length, dev): -------- :py:obj:`~.cuDeviceGetAttribute`, :py:obj:`~.cuDeviceGetUuid`, :py:obj:`~.cuDeviceGetLuid`, :py:obj:`~.cuDeviceGetCount`, :py:obj:`~.cuDeviceGet`, :py:obj:`~.cuDeviceTotalMem`, :py:obj:`~.cuDeviceGetExecAffinitySupport`, :py:obj:`~.cudaGetDeviceProperties` """ - cdef ccuda.CUdevice cdev + cdef cydriver.CUdevice cydev if dev is None: - cdev = 0 + pdev = 0 elif isinstance(dev, (CUdevice,)): pdev = int(dev) - cdev = pdev else: pdev = int(CUdevice(dev)) - cdev = pdev + cydev = pdev pyname = b" " * length cdef char* name = pyname - err = ccuda.cuDeviceGetName(name, length, cdev) - return (CUresult(err), pyname) -{{endif}} - -{{if 'cuDeviceGetUuid' in found_functions}} + with nogil: + err = cydriver.cuDeviceGetName(name, length, cydev) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pyname) @cython.embedsignature(True) def cuDeviceGetUuid(dev): """ Return an UUID for the device. - Note there is a later version of this API, - :py:obj:`~.cuDeviceGetUuid_v2`. It will supplant this version in 12.0, - which is retained for minor version compatibility. - - Returns 16-octets identifying the device `dev` in the structure pointed - by the `uuid`. - - Parameters - ---------- - dev : :py:obj:`~.CUdevice` - Device to get identifier string for - - Returns - ------- - CUresult - :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_INVALID_DEVICE` - uuid : :py:obj:`~.CUuuid` - Returned UUID - - See Also - -------- - :py:obj:`~.cuDeviceGetUuid_v2` :py:obj:`~.cuDeviceGetAttribute`, :py:obj:`~.cuDeviceGetCount`, :py:obj:`~.cuDeviceGetName`, :py:obj:`~.cuDeviceGetLuid`, :py:obj:`~.cuDeviceGet`, :py:obj:`~.cuDeviceTotalMem`, :py:obj:`~.cuDeviceGetExecAffinitySupport`, :py:obj:`~.cudaGetDeviceProperties` - """ - cdef ccuda.CUdevice cdev - if dev is None: - cdev = 0 - elif isinstance(dev, (CUdevice,)): - pdev = int(dev) - cdev = pdev - else: - pdev = int(CUdevice(dev)) - cdev = pdev - cdef CUuuid uuid = CUuuid() - err = ccuda.cuDeviceGetUuid(uuid._ptr, cdev) - return (CUresult(err), uuid) -{{endif}} - -{{if 'cuDeviceGetUuid_v2' in found_functions}} - -@cython.embedsignature(True) -def cuDeviceGetUuid_v2(dev): - """ Return an UUID for the device (11.4+) - Returns 16-octets identifying the device `dev` in the structure pointed by the `uuid`. If the device is in MIG mode, returns its MIG UUID which uniquely identifies the subscribed MIG compute instance. @@ -17698,21 +26052,20 @@ def cuDeviceGetUuid_v2(dev): -------- :py:obj:`~.cuDeviceGetAttribute`, :py:obj:`~.cuDeviceGetCount`, :py:obj:`~.cuDeviceGetName`, :py:obj:`~.cuDeviceGetLuid`, :py:obj:`~.cuDeviceGet`, :py:obj:`~.cuDeviceTotalMem`, :py:obj:`~.cudaGetDeviceProperties` """ - cdef ccuda.CUdevice cdev + cdef cydriver.CUdevice cydev if dev is None: - cdev = 0 + pdev = 0 elif isinstance(dev, (CUdevice,)): pdev = int(dev) - cdev = pdev else: pdev = int(CUdevice(dev)) - cdev = pdev + cydev = pdev cdef CUuuid uuid = CUuuid() - err = ccuda.cuDeviceGetUuid_v2(uuid._ptr, cdev) - return (CUresult(err), uuid) -{{endif}} - -{{if 'cuDeviceGetLuid' in found_functions}} + with nogil: + err = cydriver.cuDeviceGetUuid(uuid._pvt_ptr, cydev) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, uuid) @cython.embedsignature(True) def cuDeviceGetLuid(dev): @@ -17739,22 +26092,21 @@ def cuDeviceGetLuid(dev): -------- :py:obj:`~.cuDeviceGetAttribute`, :py:obj:`~.cuDeviceGetCount`, :py:obj:`~.cuDeviceGetName`, :py:obj:`~.cuDeviceGet`, :py:obj:`~.cuDeviceTotalMem`, :py:obj:`~.cuDeviceGetExecAffinitySupport`, :py:obj:`~.cudaGetDeviceProperties` """ - cdef ccuda.CUdevice cdev + cdef cydriver.CUdevice cydev if dev is None: - cdev = 0 + pdev = 0 elif isinstance(dev, (CUdevice,)): pdev = int(dev) - cdev = pdev else: pdev = int(CUdevice(dev)) - cdev = pdev + cydev = pdev cdef char luid[8] cdef unsigned int deviceNodeMask = 0 - err = ccuda.cuDeviceGetLuid(luid, &deviceNodeMask, cdev) - return (CUresult(err), luid, deviceNodeMask) -{{endif}} - -{{if 'cuDeviceTotalMem_v2' in found_functions}} + with nogil: + err = cydriver.cuDeviceGetLuid(luid, &deviceNodeMask, cydev) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None, None) + return (_CUresult_SUCCESS, luid, deviceNodeMask) @cython.embedsignature(True) def cuDeviceTotalMem(dev): @@ -17779,21 +26131,20 @@ def cuDeviceTotalMem(dev): -------- :py:obj:`~.cuDeviceGetAttribute`, :py:obj:`~.cuDeviceGetCount`, :py:obj:`~.cuDeviceGetName`, :py:obj:`~.cuDeviceGetUuid`, :py:obj:`~.cuDeviceGet`, :py:obj:`~.cuDeviceGetExecAffinitySupport`, :py:obj:`~.cudaMemGetInfo` """ - cdef ccuda.CUdevice cdev + cdef cydriver.CUdevice cydev if dev is None: - cdev = 0 + pdev = 0 elif isinstance(dev, (CUdevice,)): pdev = int(dev) - cdev = pdev else: pdev = int(CUdevice(dev)) - cdev = pdev + cydev = pdev cdef size_t numbytes = 0 - err = ccuda.cuDeviceTotalMem(&numbytes, cdev) - return (CUresult(err), numbytes) -{{endif}} - -{{if 'cuDeviceGetTexture1DLinearMaxWidth' in found_functions}} + with nogil: + err = cydriver.cuDeviceTotalMem(&numbytes, cydev) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, numbytes) @cython.embedsignature(True) def cuDeviceGetTexture1DLinearMaxWidth(pformat not None : CUarray_format, unsigned numChannels, dev): @@ -17824,416 +26175,28 @@ def cuDeviceGetTexture1DLinearMaxWidth(pformat not None : CUarray_format, unsign -------- :py:obj:`~.cuDeviceGetAttribute`, :py:obj:`~.cuDeviceGetCount`, :py:obj:`~.cuDeviceGetName`, :py:obj:`~.cuDeviceGetUuid`, :py:obj:`~.cuDeviceGet`, :py:obj:`~.cudaMemGetInfo`, :py:obj:`~.cuDeviceTotalMem` """ - cdef ccuda.CUdevice cdev + cdef cydriver.CUdevice cydev if dev is None: - cdev = 0 + pdev = 0 elif isinstance(dev, (CUdevice,)): pdev = int(dev) - cdev = pdev else: pdev = int(CUdevice(dev)) - cdev = pdev + cydev = pdev cdef size_t maxWidthInElements = 0 - cdef ccuda.CUarray_format cpformat = pformat.value - err = ccuda.cuDeviceGetTexture1DLinearMaxWidth(&maxWidthInElements, cpformat, numChannels, cdev) - return (CUresult(err), maxWidthInElements) -{{endif}} - -{{if 'cuDeviceGetAttribute' in found_functions}} + cdef cydriver.CUarray_format cypformat = int(pformat) + with nogil: + err = cydriver.cuDeviceGetTexture1DLinearMaxWidth(&maxWidthInElements, cypformat, numChannels, cydev) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, maxWidthInElements) @cython.embedsignature(True) def cuDeviceGetAttribute(attrib not None : CUdevice_attribute, dev): """ Returns information about the device. Returns in `*pi` the integer value of the attribute `attrib` on device - `dev`. The supported attributes are: - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_BLOCK`: Maximum number - of threads per block; - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_X`: Maximum x-dimension - of a block - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Y`: Maximum y-dimension - of a block - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Z`: Maximum z-dimension - of a block - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_X`: Maximum x-dimension - of a grid - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Y`: Maximum y-dimension - of a grid - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Z`: Maximum z-dimension - of a grid - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK`: Maximum - amount of shared memory available to a thread block in bytes - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_TOTAL_CONSTANT_MEMORY`: Memory - available on device for constant variables in a CUDA C kernel in - bytes - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_WARP_SIZE`: Warp size in threads - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAX_PITCH`: Maximum pitch in bytes - allowed by the memory copy functions that involve memory regions - allocated through :py:obj:`~.cuMemAllocPitch()` - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_WIDTH`: Maximum 1D - texture width - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LINEAR_WIDTH`: - Maximum width for a 1D texture bound to linear memory - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_MIPMAPPED_WIDTH`: - Maximum mipmapped 1D texture width - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_WIDTH`: Maximum 2D - texture width - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_HEIGHT`: Maximum 2D - texture height - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_WIDTH`: - Maximum width for a 2D texture bound to linear memory - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_HEIGHT`: - Maximum height for a 2D texture bound to linear memory - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_PITCH`: - Maximum pitch in bytes for a 2D texture bound to linear memory - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_MIPMAPPED_WIDTH`: - Maximum mipmapped 2D texture width - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_MIPMAPPED_HEIGHT`: - Maximum mipmapped 2D texture height - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_WIDTH`: Maximum 3D - texture width - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_HEIGHT`: Maximum 3D - texture height - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_DEPTH`: Maximum 3D - texture depth - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_WIDTH_ALTERNATE`: - Alternate maximum 3D texture width, 0 if no alternate maximum 3D - texture size is supported - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_HEIGHT_ALTERNATE`: - Alternate maximum 3D texture height, 0 if no alternate maximum 3D - texture size is supported - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_DEPTH_ALTERNATE`: - Alternate maximum 3D texture depth, 0 if no alternate maximum 3D - texture size is supported - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_WIDTH`: Maximum - cubemap texture width or height - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LAYERED_WIDTH`: - Maximum 1D layered texture width - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LAYERED_LAYERS`: - Maximum layers in a 1D layered texture - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_WIDTH`: - Maximum 2D layered texture width - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_HEIGHT`: - Maximum 2D layered texture height - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_LAYERS`: - Maximum layers in a 2D layered texture - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_LAYERED_WIDTH`: - Maximum cubemap layered texture width or height - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_LAYERED_LAYERS`: - Maximum layers in a cubemap layered texture - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_WIDTH`: Maximum 1D - surface width - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_WIDTH`: Maximum 2D - surface width - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_HEIGHT`: Maximum 2D - surface height - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_WIDTH`: Maximum 3D - surface width - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_HEIGHT`: Maximum 3D - surface height - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_DEPTH`: Maximum 3D - surface depth - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_LAYERED_WIDTH`: - Maximum 1D layered surface width - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_LAYERED_LAYERS`: - Maximum layers in a 1D layered surface - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_WIDTH`: - Maximum 2D layered surface width - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_HEIGHT`: - Maximum 2D layered surface height - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_LAYERS`: - Maximum layers in a 2D layered surface - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_WIDTH`: Maximum - cubemap surface width - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_LAYERED_WIDTH`: - Maximum cubemap layered surface width - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_LAYERED_LAYERS`: - Maximum layers in a cubemap layered surface - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_BLOCK`: Maximum - number of 32-bit registers available to a thread block - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_CLOCK_RATE`: The typical clock - frequency in kilohertz - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_TEXTURE_ALIGNMENT`: Alignment - requirement; texture base addresses aligned to - :py:obj:`~.textureAlign` bytes do not need an offset applied to - texture fetches - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_TEXTURE_PITCH_ALIGNMENT`: Pitch - alignment requirement for 2D texture references bound to pitched - memory - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_GPU_OVERLAP`: 1 if the device can - concurrently copy memory between host and device while executing a - kernel, or 0 if not - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT`: Number of - multiprocessors on the device - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_KERNEL_EXEC_TIMEOUT`: 1 if there is a - run time limit for kernels executed on the device, or 0 if not - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_INTEGRATED`: 1 if the device is - integrated with the memory subsystem, or 0 if not - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_CAN_MAP_HOST_MEMORY`: 1 if the device - can map host memory into the CUDA address space, or 0 if not - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_COMPUTE_MODE`: Compute mode that - device is currently in. Available modes are as follows: - - - :py:obj:`~.CU_COMPUTEMODE_DEFAULT`: Default mode - Device is not - restricted and can have multiple CUDA contexts present at a single - time. - - - :py:obj:`~.CU_COMPUTEMODE_PROHIBITED`: Compute-prohibited mode - - Device is prohibited from creating new CUDA contexts. - - - :py:obj:`~.CU_COMPUTEMODE_EXCLUSIVE_PROCESS`: Compute-exclusive- - process mode - Device can have only one context used by a single - process at a time. - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_CONCURRENT_KERNELS`: 1 if the device - supports executing multiple kernels within the same context - simultaneously, or 0 if not. It is not guaranteed that multiple - kernels will be resident on the device concurrently so this feature - should not be relied upon for correctness. - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_ECC_ENABLED`: 1 if error correction is - enabled on the device, 0 if error correction is disabled or not - supported by the device - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_PCI_BUS_ID`: PCI bus identifier of the - device - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_PCI_DEVICE_ID`: PCI device (also known - as slot) identifier of the device - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_PCI_DOMAIN_ID`: PCI domain identifier - of the device - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_TCC_DRIVER`: 1 if the device is using - a TCC driver. TCC is only available on Tesla hardware running Windows - Vista or later - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MEMORY_CLOCK_RATE`: Peak memory clock - frequency in kilohertz - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_GLOBAL_MEMORY_BUS_WIDTH`: Global - memory bus width in bits - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_L2_CACHE_SIZE`: Size of L2 cache in - bytes. 0 if the device doesn't have L2 cache - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_MULTIPROCESSOR`: - Maximum resident threads per multiprocessor - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_UNIFIED_ADDRESSING`: 1 if the device - shares a unified address space with the host, or 0 if not - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR`: Major - compute capability version number - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR`: Minor - compute capability version number - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_GLOBAL_L1_CACHE_SUPPORTED`: 1 if - device supports caching globals in L1 cache, 0 if caching globals in - L1 cache is not supported by the device - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_LOCAL_L1_CACHE_SUPPORTED`: 1 if device - supports caching locals in L1 cache, 0 if caching locals in L1 cache - is not supported by the device - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_MULTIPROCESSOR`: - Maximum amount of shared memory available to a multiprocessor in - bytes; this amount is shared by all thread blocks simultaneously - resident on a multiprocessor - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_MULTIPROCESSOR`: - Maximum number of 32-bit registers available to a multiprocessor; - this number is shared by all thread blocks simultaneously resident on - a multiprocessor - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MANAGED_MEMORY`: 1 if device supports - allocating managed memory on this system, 0 if allocating managed - memory is not supported by the device on this system. - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MULTI_GPU_BOARD`: 1 if device is on a - multi-GPU board, 0 if not. - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MULTI_GPU_BOARD_GROUP_ID`: Unique - identifier for a group of devices associated with the same board. - Devices on the same multi-GPU board will share the same identifier. - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_HOST_NATIVE_ATOMIC_SUPPORTED`: 1 if - Link between the device and the host supports native atomic - operations. - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_SINGLE_TO_DOUBLE_PRECISION_PERF_RATIO`: - Ratio of single precision performance (in floating-point operations - per second) to double precision performance. - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS`: Device - supports coherently accessing pageable memory without calling - cudaHostRegister on it. - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS`: Device can - coherently access managed memory concurrently with the CPU. - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_COMPUTE_PREEMPTION_SUPPORTED`: Device - supports Compute Preemption. - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_CAN_USE_HOST_POINTER_FOR_REGISTERED_MEM`: - Device can access host registered memory at the same virtual address - as the CPU. - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK_OPTIN`: - The maximum per block shared memory size supported on this device. - This is the maximum value that can be opted into when using the - :py:obj:`~.cuFuncSetAttribute()` or - :py:obj:`~.cuKernelSetAttribute()` call. For more details see - :py:obj:`~.CU_FUNC_ATTRIBUTE_MAX_DYNAMIC_SHARED_SIZE_BYTES` - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS_USES_HOST_PAGE_TABLES`: - Device accesses pageable memory via the host's page tables. - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_DIRECT_MANAGED_MEM_ACCESS_FROM_HOST`: - The host can directly access managed memory on the device without - migration. - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_VIRTUAL_MEMORY_MANAGEMENT_SUPPORTED`: - Device supports virtual memory management APIs like - :py:obj:`~.cuMemAddressReserve`, :py:obj:`~.cuMemCreate`, - :py:obj:`~.cuMemMap` and related APIs - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_POSIX_FILE_DESCRIPTOR_SUPPORTED`: - Device supports exporting memory to a posix file descriptor with - :py:obj:`~.cuMemExportToShareableHandle`, if requested via - :py:obj:`~.cuMemCreate` - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_WIN32_HANDLE_SUPPORTED`: - Device supports exporting memory to a Win32 NT handle with - :py:obj:`~.cuMemExportToShareableHandle`, if requested via - :py:obj:`~.cuMemCreate` - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_WIN32_KMT_HANDLE_SUPPORTED`: - Device supports exporting memory to a Win32 KMT handle with - :py:obj:`~.cuMemExportToShareableHandle`, if requested via - :py:obj:`~.cuMemCreate` - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAX_BLOCKS_PER_MULTIPROCESSOR`: - Maximum number of thread blocks that can reside on a multiprocessor - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_GENERIC_COMPRESSION_SUPPORTED`: Device - supports compressible memory allocation via :py:obj:`~.cuMemCreate` - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAX_PERSISTING_L2_CACHE_SIZE`: Maximum - L2 persisting lines capacity setting in bytes - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAX_ACCESS_POLICY_WINDOW_SIZE`: - Maximum value of :py:obj:`~.CUaccessPolicyWindow.num_bytes` - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_WITH_CUDA_VMM_SUPPORTED`: - Device supports specifying the GPUDirect RDMA flag with - :py:obj:`~.cuMemCreate`. - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_RESERVED_SHARED_MEMORY_PER_BLOCK`: - Amount of shared memory per block reserved by CUDA driver in bytes - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_SPARSE_CUDA_ARRAY_SUPPORTED`: Device - supports sparse CUDA arrays and sparse CUDA mipmapped arrays. - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_READ_ONLY_HOST_REGISTER_SUPPORTED`: - Device supports using the :py:obj:`~.cuMemHostRegister` flag - :py:obj:`~.CU_MEMHOSTERGISTER_READ_ONLY` to register memory that must - be mapped as read-only to the GPU - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MEMORY_POOLS_SUPPORTED`: Device - supports using the :py:obj:`~.cuMemAllocAsync` and - :py:obj:`~.cuMemPool` family of APIs - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_SUPPORTED`: Device - supports GPUDirect RDMA APIs, like nvidia_p2p_get_pages (see - https://docs.nvidia.com/cuda/gpudirect-rdma for more information) - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_FLUSH_WRITES_OPTIONS`: - The returned attribute shall be interpreted as a bitmask, where the - individual bits are described by the - :py:obj:`~.CUflushGPUDirectRDMAWritesOptions` enum - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_WRITES_ORDERING`: - GPUDirect RDMA writes to the device do not need to be flushed for - consumers within the scope indicated by the returned attribute. See - :py:obj:`~.CUGPUDirectRDMAWritesOrdering` for the numerical values - returned here. - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MEMPOOL_SUPPORTED_HANDLE_TYPES`: - Bitmask of handle types supported with mempool based IPC - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_DEFERRED_MAPPING_CUDA_ARRAY_SUPPORTED`: - Device supports deferred mapping CUDA arrays and CUDA mipmapped - arrays. - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_NUMA_CONFIG`: NUMA configuration of a - device: value is of type :py:obj:`~.CUdeviceNumaConfig` enum - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_NUMA_ID`: NUMA node ID of the GPU - memory - - - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MULTICAST_SUPPORTED`: Device supports - switch multicast and reduction operations. + `dev`. Parameters ---------- @@ -18253,22 +26216,89 @@ def cuDeviceGetAttribute(attrib not None : CUdevice_attribute, dev): -------- :py:obj:`~.cuDeviceGetCount`, :py:obj:`~.cuDeviceGetName`, :py:obj:`~.cuDeviceGetUuid`, :py:obj:`~.cuDeviceGet`, :py:obj:`~.cuDeviceTotalMem`, :py:obj:`~.cuDeviceGetExecAffinitySupport`, :py:obj:`~.cudaDeviceGetAttribute`, :py:obj:`~.cudaGetDeviceProperties` """ - cdef ccuda.CUdevice cdev + cdef cydriver.CUdevice cydev if dev is None: - cdev = 0 + pdev = 0 elif isinstance(dev, (CUdevice,)): pdev = int(dev) - cdev = pdev else: pdev = int(CUdevice(dev)) - cdev = pdev + cydev = pdev cdef int pi = 0 - cdef ccuda.CUdevice_attribute cattrib = attrib.value - err = ccuda.cuDeviceGetAttribute(&pi, cattrib, cdev) - return (CUresult(err), pi) -{{endif}} + cdef cydriver.CUdevice_attribute cyattrib = int(attrib) + with nogil: + err = cydriver.cuDeviceGetAttribute(&pi, cyattrib, cydev) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pi) + +@cython.embedsignature(True) +def cuDeviceGetHostAtomicCapabilities(operations : Optional[tuple[CUatomicOperation] | list[CUatomicOperation]], unsigned int count, dev): + """ Queries details about atomic operations supported between the device and host. + + Returns in `*capabilities` the details about requested atomic + `*operations` over the the link between `dev` and the host. The + allocated size of `*operations` and `*capabilities` must be `count`. + + For each :py:obj:`~.CUatomicOperation` in `*operations`, the + corresponding result in `*capabilities` will be a bitmask indicating + which of :py:obj:`~.CUatomicOperationCapability` the link supports + natively. -{{if 'cuDeviceGetNvSciSyncAttributes' in found_functions}} + Returns :py:obj:`~.CUDA_ERROR_INVALID_DEVICE` if `dev` is not valid. + + Returns :py:obj:`~.CUDA_ERROR_INVALID_VALUE` if `*capabilities` or + `*operations` is NULL, if `count` is 0, or if any of `*operations` is + not valid. + + Parameters + ---------- + operations : list[:py:obj:`~.CUatomicOperation`] + Requested operations + count : unsigned int + Count of requested operations and size of capabilities + dev : :py:obj:`~.CUdevice` + Device handle + + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_INVALID_DEVICE`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE` + capabilities : list[unsigned int] + Returned capability details of each requested operation + + See Also + -------- + :py:obj:`~.cuDeviceGetAttribute`, :py:obj:`~.cuDeviceGetP2PAtomicCapabilities`, :py:obj:`~.cudaDeviceGeHostAtomicCapabilities` + """ + cdef cydriver.CUdevice cydev + if dev is None: + pdev = 0 + elif isinstance(dev, (CUdevice,)): + pdev = int(dev) + else: + pdev = int(CUdevice(dev)) + cydev = pdev + operations = [] if operations is None else operations + if not all(isinstance(_x, (CUatomicOperation)) for _x in operations): + raise TypeError("Argument 'operations' is not instance of type (expected tuple[cydriver.CUatomicOperation] or list[cydriver.CUatomicOperation]") + cdef unsigned int* cycapabilities = NULL + pycapabilities = [] + if count != 0: + cycapabilities = calloc(count, sizeof(unsigned int)) + if cycapabilities is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(count) + 'x' + str(sizeof(unsigned int))) + cdef vector[cydriver.CUatomicOperation] cyoperations = operations + if count > len(operations): raise RuntimeError("List is too small: " + str(len(operations)) + " < " + str(count)) + with nogil: + err = cydriver.cuDeviceGetHostAtomicCapabilities(cycapabilities, cyoperations.data(), count, cydev) + if CUresult(err) == CUresult(0): + pycapabilities = [cycapabilities[idx] for idx in range(count)] + if cycapabilities is not NULL: + free(cycapabilities) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pycapabilities) @cython.embedsignature(True) def cuDeviceGetNvSciSyncAttributes(nvSciSyncAttrList, dev, int flags): @@ -18346,27 +26376,24 @@ def cuDeviceGetNvSciSyncAttributes(nvSciSyncAttrList, dev, int flags): ------- CUresult - See Also -------- :py:obj:`~.cuImportExternalSemaphore`, :py:obj:`~.cuDestroyExternalSemaphore`, :py:obj:`~.cuSignalExternalSemaphoresAsync`, :py:obj:`~.cuWaitExternalSemaphoresAsync` """ - cdef ccuda.CUdevice cdev + cdef cydriver.CUdevice cydev if dev is None: - cdev = 0 + pdev = 0 elif isinstance(dev, (CUdevice,)): pdev = int(dev) - cdev = pdev else: pdev = int(CUdevice(dev)) - cdev = pdev - cnvSciSyncAttrList = utils.HelperInputVoidPtr(nvSciSyncAttrList) - cdef void* cnvSciSyncAttrList_ptr = cnvSciSyncAttrList.cptr - err = ccuda.cuDeviceGetNvSciSyncAttributes(cnvSciSyncAttrList_ptr, cdev, flags) - return (CUresult(err),) -{{endif}} - -{{if 'cuDeviceSetMemPool' in found_functions}} + cydev = pdev + cdef _HelperInputVoidPtrStruct cynvSciSyncAttrListHelper + cdef void* cynvSciSyncAttrList = _helper_input_void_ptr(nvSciSyncAttrList, &cynvSciSyncAttrListHelper) + with nogil: + err = cydriver.cuDeviceGetNvSciSyncAttributes(cynvSciSyncAttrList, cydev, flags) + _helper_input_void_ptr_free(&cynvSciSyncAttrListHelper) + return (_CUresult(err),) @cython.embedsignature(True) def cuDeviceSetMemPool(dev, pool): @@ -18397,29 +26424,25 @@ def cuDeviceSetMemPool(dev, pool): ----- Use :py:obj:`~.cuMemAllocFromPoolAsync` to specify asynchronous allocations from a device different than the one the stream runs on. """ - cdef ccuda.CUmemoryPool cpool + cdef cydriver.CUmemoryPool cypool if pool is None: - cpool = 0 + ppool = 0 elif isinstance(pool, (CUmemoryPool,)): ppool = int(pool) - cpool = ppool else: ppool = int(CUmemoryPool(pool)) - cpool = ppool - cdef ccuda.CUdevice cdev + cypool = ppool + cdef cydriver.CUdevice cydev if dev is None: - cdev = 0 + pdev = 0 elif isinstance(dev, (CUdevice,)): pdev = int(dev) - cdev = pdev else: pdev = int(CUdevice(dev)) - cdev = pdev - err = ccuda.cuDeviceSetMemPool(cdev, cpool) - return (CUresult(err),) -{{endif}} - -{{if 'cuDeviceGetMemPool' in found_functions}} + cydev = pdev + with nogil: + err = cydriver.cuDeviceSetMemPool(cydev, cypool) + return (_CUresult(err),) @cython.embedsignature(True) def cuDeviceGetMemPool(dev): @@ -18447,21 +26470,20 @@ def cuDeviceGetMemPool(dev): -------- :py:obj:`~.cuDeviceGetDefaultMemPool`, :py:obj:`~.cuMemPoolCreate`, :py:obj:`~.cuDeviceSetMemPool` """ - cdef ccuda.CUdevice cdev + cdef cydriver.CUdevice cydev if dev is None: - cdev = 0 + pdev = 0 elif isinstance(dev, (CUdevice,)): pdev = int(dev) - cdev = pdev else: pdev = int(CUdevice(dev)) - cdev = pdev + cydev = pdev cdef CUmemoryPool pool = CUmemoryPool() - err = ccuda.cuDeviceGetMemPool(pool._ptr, cdev) - return (CUresult(err), pool) -{{endif}} - -{{if 'cuDeviceGetDefaultMemPool' in found_functions}} + with nogil: + err = cydriver.cuDeviceGetMemPool(pool._pvt_ptr, cydev) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pool) @cython.embedsignature(True) def cuDeviceGetDefaultMemPool(dev): @@ -18486,21 +26508,20 @@ def cuDeviceGetDefaultMemPool(dev): -------- :py:obj:`~.cuMemAllocAsync`, :py:obj:`~.cuMemPoolTrimTo`, :py:obj:`~.cuMemPoolGetAttribute`, :py:obj:`~.cuMemPoolSetAttribute`, :py:obj:`~.cuMemPoolSetAccess`, :py:obj:`~.cuDeviceGetMemPool`, :py:obj:`~.cuMemPoolCreate` """ - cdef ccuda.CUdevice cdev + cdef cydriver.CUdevice cydev if dev is None: - cdev = 0 + pdev = 0 elif isinstance(dev, (CUdevice,)): pdev = int(dev) - cdev = pdev else: pdev = int(CUdevice(dev)) - cdev = pdev + cydev = pdev cdef CUmemoryPool pool_out = CUmemoryPool() - err = ccuda.cuDeviceGetDefaultMemPool(pool_out._ptr, cdev) - return (CUresult(err), pool_out) -{{endif}} - -{{if 'cuDeviceGetExecAffinitySupport' in found_functions}} + with nogil: + err = cydriver.cuDeviceGetDefaultMemPool(pool_out._pvt_ptr, cydev) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pool_out) @cython.embedsignature(True) def cuDeviceGetExecAffinitySupport(typename not None : CUexecAffinityType, dev): @@ -18531,22 +26552,21 @@ def cuDeviceGetExecAffinitySupport(typename not None : CUexecAffinityType, dev): -------- :py:obj:`~.cuDeviceGetAttribute`, :py:obj:`~.cuDeviceGetCount`, :py:obj:`~.cuDeviceGetName`, :py:obj:`~.cuDeviceGetUuid`, :py:obj:`~.cuDeviceGet`, :py:obj:`~.cuDeviceTotalMem` """ - cdef ccuda.CUdevice cdev + cdef cydriver.CUdevice cydev if dev is None: - cdev = 0 + pdev = 0 elif isinstance(dev, (CUdevice,)): pdev = int(dev) - cdev = pdev else: pdev = int(CUdevice(dev)) - cdev = pdev + cydev = pdev cdef int pi = 0 - cdef ccuda.CUexecAffinityType ctypename = typename.value - err = ccuda.cuDeviceGetExecAffinitySupport(&pi, ctypename, cdev) - return (CUresult(err), pi) -{{endif}} - -{{if 'cuFlushGPUDirectRDMAWrites' in found_functions}} + cdef cydriver.CUexecAffinityType cytypename = int(typename) + with nogil: + err = cydriver.cuDeviceGetExecAffinitySupport(&pi, cytypename, cydev) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pi) @cython.embedsignature(True) def cuFlushGPUDirectRDMAWrites(target not None : CUflushGPUDirectRDMAWritesTarget, scope not None : CUflushGPUDirectRDMAWritesScope): @@ -18563,6 +26583,16 @@ def cuFlushGPUDirectRDMAWrites(target not None : CUflushGPUDirectRDMAWritesTarge can be determined by comparing the numerical values between the two enums, with smaller scopes having smaller values. + On platforms that support GPUDirect RDMA writes via more than one path + in hardware (see + :py:obj:`~.CU_MEM_RANGE_FLAG_DMA_BUF_MAPPING_TYPE_PCIE`), the user + should consider those paths as belonging to separate ordering domains. + Note that in such cases CUDA driver will report both RDMA writes + ordering and RDMA write scope as ALL_DEVICES and a call to + cuFlushGPUDirectRDMA will be a no-op, but when these multiple paths are + used simultaneously, it is the user's responsibility to ensure ordering + by using mechanisms outside the scope of CUDA. + Users may query support for this API via :py:obj:`~.CU_DEVICE_ATTRIBUTE_FLUSH_FLUSH_GPU_DIRECT_RDMA_OPTIONS`. @@ -18580,13 +26610,11 @@ def cuFlushGPUDirectRDMAWrites(target not None : CUflushGPUDirectRDMAWritesTarge CUresult :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_CONTEXT`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, """ - cdef ccuda.CUflushGPUDirectRDMAWritesTarget ctarget = target.value - cdef ccuda.CUflushGPUDirectRDMAWritesScope cscope = scope.value - err = ccuda.cuFlushGPUDirectRDMAWrites(ctarget, cscope) - return (CUresult(err),) -{{endif}} - -{{if 'cuDeviceGetProperties' in found_functions}} + cdef cydriver.CUflushGPUDirectRDMAWritesTarget cytarget = int(target) + cdef cydriver.CUflushGPUDirectRDMAWritesScope cyscope = int(scope) + with nogil: + err = cydriver.cuFlushGPUDirectRDMAWrites(cytarget, cyscope) + return (_CUresult(err),) @cython.embedsignature(True) def cuDeviceGetProperties(dev): @@ -18650,21 +26678,20 @@ def cuDeviceGetProperties(dev): -------- :py:obj:`~.cuDeviceGetAttribute`, :py:obj:`~.cuDeviceGetCount`, :py:obj:`~.cuDeviceGetName`, :py:obj:`~.cuDeviceGetUuid`, :py:obj:`~.cuDeviceGet`, :py:obj:`~.cuDeviceTotalMem` """ - cdef ccuda.CUdevice cdev + cdef cydriver.CUdevice cydev if dev is None: - cdev = 0 + pdev = 0 elif isinstance(dev, (CUdevice,)): pdev = int(dev) - cdev = pdev else: pdev = int(CUdevice(dev)) - cdev = pdev + cydev = pdev cdef CUdevprop prop = CUdevprop() - err = ccuda.cuDeviceGetProperties(prop._ptr, cdev) - return (CUresult(err), prop) -{{endif}} - -{{if 'cuDeviceComputeCapability' in found_functions}} + with nogil: + err = cydriver.cuDeviceGetProperties(prop._pvt_ptr, cydev) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, prop) @cython.embedsignature(True) def cuDeviceComputeCapability(dev): @@ -18696,22 +26723,21 @@ def cuDeviceComputeCapability(dev): -------- :py:obj:`~.cuDeviceGetAttribute`, :py:obj:`~.cuDeviceGetCount`, :py:obj:`~.cuDeviceGetName`, :py:obj:`~.cuDeviceGetUuid`, :py:obj:`~.cuDeviceGet`, :py:obj:`~.cuDeviceTotalMem` """ - cdef ccuda.CUdevice cdev + cdef cydriver.CUdevice cydev if dev is None: - cdev = 0 + pdev = 0 elif isinstance(dev, (CUdevice,)): pdev = int(dev) - cdev = pdev else: pdev = int(CUdevice(dev)) - cdev = pdev + cydev = pdev cdef int major = 0 cdef int minor = 0 - err = ccuda.cuDeviceComputeCapability(&major, &minor, cdev) - return (CUresult(err), major, minor) -{{endif}} - -{{if 'cuDevicePrimaryCtxRetain' in found_functions}} + with nogil: + err = cydriver.cuDeviceComputeCapability(&major, &minor, cydev) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None, None) + return (_CUresult_SUCCESS, major, minor) @cython.embedsignature(True) def cuDevicePrimaryCtxRetain(dev): @@ -18753,21 +26779,20 @@ def cuDevicePrimaryCtxRetain(dev): -------- :py:obj:`~.cuDevicePrimaryCtxRelease`, :py:obj:`~.cuDevicePrimaryCtxSetFlags`, :py:obj:`~.cuCtxCreate`, :py:obj:`~.cuCtxGetApiVersion`, :py:obj:`~.cuCtxGetCacheConfig`, :py:obj:`~.cuCtxGetDevice`, :py:obj:`~.cuCtxGetFlags`, :py:obj:`~.cuCtxGetLimit`, :py:obj:`~.cuCtxPopCurrent`, :py:obj:`~.cuCtxPushCurrent`, :py:obj:`~.cuCtxSetCacheConfig`, :py:obj:`~.cuCtxSetLimit`, :py:obj:`~.cuCtxSynchronize` """ - cdef ccuda.CUdevice cdev + cdef cydriver.CUdevice cydev if dev is None: - cdev = 0 + pdev = 0 elif isinstance(dev, (CUdevice,)): pdev = int(dev) - cdev = pdev else: pdev = int(CUdevice(dev)) - cdev = pdev + cydev = pdev cdef CUcontext pctx = CUcontext() - err = ccuda.cuDevicePrimaryCtxRetain(pctx._ptr, cdev) - return (CUresult(err), pctx) -{{endif}} - -{{if 'cuDevicePrimaryCtxRelease_v2' in found_functions}} + with nogil: + err = cydriver.cuDevicePrimaryCtxRetain(pctx._pvt_ptr, cydev) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pctx) @cython.embedsignature(True) def cuDevicePrimaryCtxRelease(dev): @@ -18800,20 +26825,17 @@ def cuDevicePrimaryCtxRelease(dev): -------- :py:obj:`~.cuDevicePrimaryCtxRetain`, :py:obj:`~.cuCtxDestroy`, :py:obj:`~.cuCtxGetApiVersion`, :py:obj:`~.cuCtxGetCacheConfig`, :py:obj:`~.cuCtxGetDevice`, :py:obj:`~.cuCtxGetFlags`, :py:obj:`~.cuCtxGetLimit`, :py:obj:`~.cuCtxPopCurrent`, :py:obj:`~.cuCtxPushCurrent`, :py:obj:`~.cuCtxSetCacheConfig`, :py:obj:`~.cuCtxSetLimit`, :py:obj:`~.cuCtxSynchronize` """ - cdef ccuda.CUdevice cdev + cdef cydriver.CUdevice cydev if dev is None: - cdev = 0 + pdev = 0 elif isinstance(dev, (CUdevice,)): pdev = int(dev) - cdev = pdev else: pdev = int(CUdevice(dev)) - cdev = pdev - err = ccuda.cuDevicePrimaryCtxRelease(cdev) - return (CUresult(err),) -{{endif}} - -{{if 'cuDevicePrimaryCtxSetFlags_v2' in found_functions}} + cydev = pdev + with nogil: + err = cydriver.cuDevicePrimaryCtxRelease(cydev) + return (_CUresult(err),) @cython.embedsignature(True) def cuDevicePrimaryCtxSetFlags(dev, unsigned int flags): @@ -18914,20 +26936,17 @@ def cuDevicePrimaryCtxSetFlags(dev, unsigned int flags): -------- :py:obj:`~.cuDevicePrimaryCtxRetain`, :py:obj:`~.cuDevicePrimaryCtxGetState`, :py:obj:`~.cuCtxCreate`, :py:obj:`~.cuCtxGetFlags`, :py:obj:`~.cuCtxSetFlags`, :py:obj:`~.cudaSetDeviceFlags` """ - cdef ccuda.CUdevice cdev + cdef cydriver.CUdevice cydev if dev is None: - cdev = 0 + pdev = 0 elif isinstance(dev, (CUdevice,)): pdev = int(dev) - cdev = pdev else: pdev = int(CUdevice(dev)) - cdev = pdev - err = ccuda.cuDevicePrimaryCtxSetFlags(cdev, flags) - return (CUresult(err),) -{{endif}} - -{{if 'cuDevicePrimaryCtxGetState' in found_functions}} + cydev = pdev + with nogil: + err = cydriver.cuDevicePrimaryCtxSetFlags(cydev, flags) + return (_CUresult(err),) @cython.embedsignature(True) def cuDevicePrimaryCtxGetState(dev): @@ -18955,22 +26974,21 @@ def cuDevicePrimaryCtxGetState(dev): -------- :py:obj:`~.cuDevicePrimaryCtxSetFlags`, :py:obj:`~.cuCtxGetFlags`, :py:obj:`~.cuCtxSetFlags`, :py:obj:`~.cudaGetDeviceFlags` """ - cdef ccuda.CUdevice cdev + cdef cydriver.CUdevice cydev if dev is None: - cdev = 0 + pdev = 0 elif isinstance(dev, (CUdevice,)): pdev = int(dev) - cdev = pdev else: pdev = int(CUdevice(dev)) - cdev = pdev + cydev = pdev cdef unsigned int flags = 0 cdef int active = 0 - err = ccuda.cuDevicePrimaryCtxGetState(cdev, &flags, &active) - return (CUresult(err), flags, active) -{{endif}} - -{{if 'cuDevicePrimaryCtxReset_v2' in found_functions}} + with nogil: + err = cydriver.cuDevicePrimaryCtxGetState(cydev, &flags, &active) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None, None) + return (_CUresult_SUCCESS, flags, active) @cython.embedsignature(True) def cuDevicePrimaryCtxReset(dev): @@ -19002,23 +27020,20 @@ def cuDevicePrimaryCtxReset(dev): -------- :py:obj:`~.cuDevicePrimaryCtxRetain`, :py:obj:`~.cuDevicePrimaryCtxRelease`, :py:obj:`~.cuCtxGetApiVersion`, :py:obj:`~.cuCtxGetCacheConfig`, :py:obj:`~.cuCtxGetDevice`, :py:obj:`~.cuCtxGetFlags`, :py:obj:`~.cuCtxGetLimit`, :py:obj:`~.cuCtxPopCurrent`, :py:obj:`~.cuCtxPushCurrent`, :py:obj:`~.cuCtxSetCacheConfig`, :py:obj:`~.cuCtxSetLimit`, :py:obj:`~.cuCtxSynchronize`, :py:obj:`~.cudaDeviceReset` """ - cdef ccuda.CUdevice cdev + cdef cydriver.CUdevice cydev if dev is None: - cdev = 0 + pdev = 0 elif isinstance(dev, (CUdevice,)): pdev = int(dev) - cdev = pdev else: pdev = int(CUdevice(dev)) - cdev = pdev - err = ccuda.cuDevicePrimaryCtxReset(cdev) - return (CUresult(err),) -{{endif}} - -{{if 'cuCtxCreate_v2' in found_functions}} + cydev = pdev + with nogil: + err = cydriver.cuDevicePrimaryCtxReset(cydev) + return (_CUresult(err),) @cython.embedsignature(True) -def cuCtxCreate(unsigned int flags, dev): +def cuCtxCreate(ctxCreateParams : Optional[CUctxCreateParams], unsigned int flags, dev): """ Create a CUDA context. Creates a new CUDA context and associates it with the calling thread. @@ -19029,315 +27044,10 @@ def cuCtxCreate(unsigned int flags, dev): context and may be restored by a subsequent call to :py:obj:`~.cuCtxPopCurrent()`. - The three LSBs of the `flags` parameter can be used to control how the - OS thread, which owns the CUDA context at the time of an API call, - interacts with the OS scheduler when waiting for results from the GPU. - Only one of the scheduling flags can be set when creating a context. - - - :py:obj:`~.CU_CTX_SCHED_SPIN`: Instruct CUDA to actively spin when - waiting for results from the GPU. This can decrease latency when - waiting for the GPU, but may lower the performance of CPU threads if - they are performing work in parallel with the CUDA thread. - - - :py:obj:`~.CU_CTX_SCHED_YIELD`: Instruct CUDA to yield its thread - when waiting for results from the GPU. This can increase latency when - waiting for the GPU, but can increase the performance of CPU threads - performing work in parallel with the GPU. - - - :py:obj:`~.CU_CTX_SCHED_BLOCKING_SYNC`: Instruct CUDA to block the - CPU thread on a synchronization primitive when waiting for the GPU to - finish work. - - - :py:obj:`~.CU_CTX_BLOCKING_SYNC`: Instruct CUDA to block the CPU - thread on a synchronization primitive when waiting for the GPU to - finish work. Deprecated: This flag was deprecated as of CUDA 4.0 - and was replaced with :py:obj:`~.CU_CTX_SCHED_BLOCKING_SYNC`. - - - :py:obj:`~.CU_CTX_SCHED_AUTO`: The default value if the `flags` - parameter is zero, uses a heuristic based on the number of active - CUDA contexts in the process `C` and the number of logical processors - in the system `P`. If `C` > `P`, then CUDA will yield to other OS - threads when waiting for the GPU (:py:obj:`~.CU_CTX_SCHED_YIELD`), - otherwise CUDA will not yield while waiting for results and actively - spin on the processor (:py:obj:`~.CU_CTX_SCHED_SPIN`). Additionally, - on Tegra devices, :py:obj:`~.CU_CTX_SCHED_AUTO` uses a heuristic - based on the power profile of the platform and may choose - :py:obj:`~.CU_CTX_SCHED_BLOCKING_SYNC` for low-powered devices. - - - :py:obj:`~.CU_CTX_MAP_HOST`: Instruct CUDA to support mapped pinned - allocations. This flag must be set in order to allocate pinned host - memory that is accessible to the GPU. - - - :py:obj:`~.CU_CTX_LMEM_RESIZE_TO_MAX`: Instruct CUDA to not reduce - local memory after resizing local memory for a kernel. This can - prevent thrashing by local memory allocations when launching many - kernels with high local memory usage at the cost of potentially - increased memory usage. Deprecated: This flag is deprecated and the - behavior enabled by this flag is now the default and cannot be - disabled. Instead, the per-thread stack size can be controlled with - :py:obj:`~.cuCtxSetLimit()`. - - - :py:obj:`~.CU_CTX_COREDUMP_ENABLE`: If GPU coredumps have not been - enabled globally with :py:obj:`~.cuCoredumpSetAttributeGlobal` or - environment variables, this flag can be set during context creation - to instruct CUDA to create a coredump if this context raises an - exception during execution. These environment variables are described - in the CUDA-GDB user guide under the "GPU core dump support" section. - The initial attributes will be taken from the global attributes at - the time of context creation. The other attributes that control - coredump output can be modified by calling - :py:obj:`~.cuCoredumpSetAttribute` from the created context after it - becomes current. - - - :py:obj:`~.CU_CTX_USER_COREDUMP_ENABLE`: If user-triggered GPU - coredumps have not been enabled globally with - :py:obj:`~.cuCoredumpSetAttributeGlobal` or environment variables, - this flag can be set during context creation to instruct CUDA to - create a coredump if data is written to a certain pipe that is - present in the OS space. These environment variables are described in - the CUDA-GDB user guide under the "GPU core dump support" section. It - is important to note that the pipe name `must` be set with - :py:obj:`~.cuCoredumpSetAttributeGlobal` before creating the context - if this flag is used. Setting this flag implies that - :py:obj:`~.CU_CTX_COREDUMP_ENABLE` is set. The initial attributes - will be taken from the global attributes at the time of context - creation. The other attributes that control coredump output can be - modified by calling :py:obj:`~.cuCoredumpSetAttribute` from the - created context after it becomes current. Setting this flag on any - context creation is equivalent to setting the - :py:obj:`~.CU_COREDUMP_ENABLE_USER_TRIGGER` attribute to `true` - globally. - - - :py:obj:`~.CU_CTX_SYNC_MEMOPS`: Ensures that synchronous memory - operations initiated on this context will always synchronize. See - further documentation in the section titled "API Synchronization - behavior" to learn more about cases when synchronous memory - operations can exhibit asynchronous behavior. - - Context creation will fail with :py:obj:`~.CUDA_ERROR_UNKNOWN` if the - compute mode of the device is :py:obj:`~.CU_COMPUTEMODE_PROHIBITED`. - The function :py:obj:`~.cuDeviceGetAttribute()` can be used with - :py:obj:`~.CU_DEVICE_ATTRIBUTE_COMPUTE_MODE` to determine the compute - mode of the device. The `nvidia-smi` tool can be used to set the - compute mode for * devices. Documentation for `nvidia-smi` can be - obtained by passing a -h option to it. - - Parameters - ---------- - flags : unsigned int - Context creation flags - dev : :py:obj:`~.CUdevice` - Device to create context on - - Returns - ------- - CUresult - :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_CONTEXT`, :py:obj:`~.CUDA_ERROR_INVALID_DEVICE`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_OUT_OF_MEMORY`, :py:obj:`~.CUDA_ERROR_UNKNOWN` - pctx : :py:obj:`~.CUcontext` - Returned context handle of the new context - - See Also - -------- - :py:obj:`~.cuCtxDestroy`, :py:obj:`~.cuCtxGetApiVersion`, :py:obj:`~.cuCtxGetCacheConfig`, :py:obj:`~.cuCtxGetDevice`, :py:obj:`~.cuCtxGetFlags`, :py:obj:`~.cuCtxGetLimit`, :py:obj:`~.cuCtxPopCurrent`, :py:obj:`~.cuCtxPushCurrent`, :py:obj:`~.cuCtxSetCacheConfig`, :py:obj:`~.cuCtxSetLimit`, :py:obj:`~.cuCoredumpSetAttributeGlobal`, :py:obj:`~.cuCoredumpSetAttribute`, :py:obj:`~.cuCtxSynchronize` - - Notes - ----- - In most cases it is recommended to use :py:obj:`~.cuDevicePrimaryCtxRetain`. - """ - cdef ccuda.CUdevice cdev - if dev is None: - cdev = 0 - elif isinstance(dev, (CUdevice,)): - pdev = int(dev) - cdev = pdev - else: - pdev = int(CUdevice(dev)) - cdev = pdev - cdef CUcontext pctx = CUcontext() - err = ccuda.cuCtxCreate(pctx._ptr, flags, cdev) - return (CUresult(err), pctx) -{{endif}} - -{{if 'cuCtxCreate_v3' in found_functions}} - -@cython.embedsignature(True) -def cuCtxCreate_v3(paramsArray : Optional[List[CUexecAffinityParam]], int numParams, unsigned int flags, dev): - """ Create a CUDA context with execution affinity. - - Creates a new CUDA context with execution affinity and associates it - with the calling thread. The `paramsArray` and `flags` parameter are - described below. The context is created with a usage count of 1 and the - caller of :py:obj:`~.cuCtxCreate()` must call - :py:obj:`~.cuCtxDestroy()` when done using the context. If a context is - already current to the thread, it is supplanted by the newly created - context and may be restored by a subsequent call to - :py:obj:`~.cuCtxPopCurrent()`. - - The type and the amount of execution resource the context can use is - limited by `paramsArray` and `numParams`. The `paramsArray` is an array - of `CUexecAffinityParam` and the `numParams` describes the size of the - array. If two `CUexecAffinityParam` in the array have the same type, - the latter execution affinity parameter overrides the former execution - affinity parameter. The supported execution affinity types are: - - - :py:obj:`~.CU_EXEC_AFFINITY_TYPE_SM_COUNT` limits the portion of SMs - that the context can use. The portion of SMs is specified as the - number of SMs via `CUexecAffinitySmCount`. This limit will be - internally rounded up to the next hardware-supported amount. Hence, - it is imperative to query the actual execution affinity of the - context via `cuCtxGetExecAffinity` after context creation. Currently, - this attribute is only supported under Volta+ MPS. - - The three LSBs of the `flags` parameter can be used to control how the - OS thread, which owns the CUDA context at the time of an API call, - interacts with the OS scheduler when waiting for results from the GPU. - Only one of the scheduling flags can be set when creating a context. - - - :py:obj:`~.CU_CTX_SCHED_SPIN`: Instruct CUDA to actively spin when - waiting for results from the GPU. This can decrease latency when - waiting for the GPU, but may lower the performance of CPU threads if - they are performing work in parallel with the CUDA thread. - - - :py:obj:`~.CU_CTX_SCHED_YIELD`: Instruct CUDA to yield its thread - when waiting for results from the GPU. This can increase latency when - waiting for the GPU, but can increase the performance of CPU threads - performing work in parallel with the GPU. - - - :py:obj:`~.CU_CTX_SCHED_BLOCKING_SYNC`: Instruct CUDA to block the - CPU thread on a synchronization primitive when waiting for the GPU to - finish work. + A regular CUDA context can be created by setting `ctxCreateParams` to + NULL. - - :py:obj:`~.CU_CTX_BLOCKING_SYNC`: Instruct CUDA to block the CPU - thread on a synchronization primitive when waiting for the GPU to - finish work. Deprecated: This flag was deprecated as of CUDA 4.0 - and was replaced with :py:obj:`~.CU_CTX_SCHED_BLOCKING_SYNC`. - - - :py:obj:`~.CU_CTX_SCHED_AUTO`: The default value if the `flags` - parameter is zero, uses a heuristic based on the number of active - CUDA contexts in the process `C` and the number of logical processors - in the system `P`. If `C` > `P`, then CUDA will yield to other OS - threads when waiting for the GPU (:py:obj:`~.CU_CTX_SCHED_YIELD`), - otherwise CUDA will not yield while waiting for results and actively - spin on the processor (:py:obj:`~.CU_CTX_SCHED_SPIN`). Additionally, - on Tegra devices, :py:obj:`~.CU_CTX_SCHED_AUTO` uses a heuristic - based on the power profile of the platform and may choose - :py:obj:`~.CU_CTX_SCHED_BLOCKING_SYNC` for low-powered devices. - - - :py:obj:`~.CU_CTX_MAP_HOST`: Instruct CUDA to support mapped pinned - allocations. This flag must be set in order to allocate pinned host - memory that is accessible to the GPU. - - - :py:obj:`~.CU_CTX_LMEM_RESIZE_TO_MAX`: Instruct CUDA to not reduce - local memory after resizing local memory for a kernel. This can - prevent thrashing by local memory allocations when launching many - kernels with high local memory usage at the cost of potentially - increased memory usage. Deprecated: This flag is deprecated and the - behavior enabled by this flag is now the default and cannot be - disabled. Instead, the per-thread stack size can be controlled with - :py:obj:`~.cuCtxSetLimit()`. - - - :py:obj:`~.CU_CTX_COREDUMP_ENABLE`: If GPU coredumps have not been - enabled globally with :py:obj:`~.cuCoredumpSetAttributeGlobal` or - environment variables, this flag can be set during context creation - to instruct CUDA to create a coredump if this context raises an - exception during execution. These environment variables are described - in the CUDA-GDB user guide under the "GPU core dump support" section. - The initial attributes will be taken from the global attributes at - the time of context creation. The other attributes that control - coredump output can be modified by calling - :py:obj:`~.cuCoredumpSetAttribute` from the created context after it - becomes current. - - - :py:obj:`~.CU_CTX_USER_COREDUMP_ENABLE`: If user-triggered GPU - coredumps have not been enabled globally with - :py:obj:`~.cuCoredumpSetAttributeGlobal` or environment variables, - this flag can be set during context creation to instruct CUDA to - create a coredump if data is written to a certain pipe that is - present in the OS space. These environment variables are described in - the CUDA-GDB user guide under the "GPU core dump support" section. It - is important to note that the pipe name `must` be set with - :py:obj:`~.cuCoredumpSetAttributeGlobal` before creating the context - if this flag is used. Setting this flag implies that - :py:obj:`~.CU_CTX_COREDUMP_ENABLE` is set. The initial attributes - will be taken from the global attributes at the time of context - creation. The other attributes that control coredump output can be - modified by calling :py:obj:`~.cuCoredumpSetAttribute` from the - created context after it becomes current. Setting this flag on any - context creation is equivalent to setting the - :py:obj:`~.CU_COREDUMP_ENABLE_USER_TRIGGER` attribute to `true` - globally. - - Context creation will fail with :py:obj:`~.CUDA_ERROR_UNKNOWN` if the - compute mode of the device is :py:obj:`~.CU_COMPUTEMODE_PROHIBITED`. - The function :py:obj:`~.cuDeviceGetAttribute()` can be used with - :py:obj:`~.CU_DEVICE_ATTRIBUTE_COMPUTE_MODE` to determine the compute - mode of the device. The `nvidia-smi` tool can be used to set the - compute mode for * devices. Documentation for `nvidia-smi` can be - obtained by passing a -h option to it. - - Parameters - ---------- - paramsArray : List[:py:obj:`~.CUexecAffinityParam`] - Execution affinity parameters - numParams : int - Number of execution affinity parameters - flags : unsigned int - Context creation flags - dev : :py:obj:`~.CUdevice` - Device to create context on - - Returns - ------- - CUresult - :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_CONTEXT`, :py:obj:`~.CUDA_ERROR_INVALID_DEVICE`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_OUT_OF_MEMORY`, :py:obj:`~.CUDA_ERROR_UNSUPPORTED_EXEC_AFFINITY`, :py:obj:`~.CUDA_ERROR_UNKNOWN` - pctx : :py:obj:`~.CUcontext` - Returned context handle of the new context - - See Also - -------- - :py:obj:`~.cuCtxDestroy`, :py:obj:`~.cuCtxGetApiVersion`, :py:obj:`~.cuCtxGetCacheConfig`, :py:obj:`~.cuCtxGetDevice`, :py:obj:`~.cuCtxGetFlags`, :py:obj:`~.cuCtxGetLimit`, :py:obj:`~.cuCtxPopCurrent`, :py:obj:`~.cuCtxPushCurrent`, :py:obj:`~.cuCtxSetCacheConfig`, :py:obj:`~.cuCtxSetLimit`, :py:obj:`~.cuCtxSynchronize`, :py:obj:`~.cuCoredumpSetAttributeGlobal`, :py:obj:`~.cuCoredumpSetAttribute`, :py:obj:`~.CUexecAffinityParam` - """ - cdef ccuda.CUdevice cdev - if dev is None: - cdev = 0 - elif isinstance(dev, (CUdevice,)): - pdev = int(dev) - cdev = pdev - else: - pdev = int(CUdevice(dev)) - cdev = pdev - paramsArray = [] if paramsArray is None else paramsArray - if not all(isinstance(_x, (CUexecAffinityParam,)) for _x in paramsArray): - raise TypeError("Argument 'paramsArray' is not instance of type (expected List[ccuda.CUexecAffinityParam,]") - cdef CUcontext pctx = CUcontext() - cdef ccuda.CUexecAffinityParam* cparamsArray = NULL - if len(paramsArray) > 0: - cparamsArray = calloc(len(paramsArray), sizeof(ccuda.CUexecAffinityParam)) - if cparamsArray is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(paramsArray)) + 'x' + str(sizeof(ccuda.CUexecAffinityParam))) - for idx in range(len(paramsArray)): - string.memcpy(&cparamsArray[idx], (paramsArray[idx])._ptr, sizeof(ccuda.CUexecAffinityParam)) - err = ccuda.cuCtxCreate_v3(pctx._ptr, (paramsArray[0])._ptr if len(paramsArray) == 1 else cparamsArray, numParams, flags, cdev) - if cparamsArray is not NULL: - free(cparamsArray) - return (CUresult(err), pctx) -{{endif}} - -{{if 'cuCtxCreate_v4' in found_functions}} - -@cython.embedsignature(True) -def cuCtxCreate_v4(ctxCreateParams : Optional[CUctxCreateParams], unsigned int flags, dev): - """ Create a CUDA context. - - Creates a new CUDA context and associates it with the calling thread. - The `flags` parameter is described below. The context is created with a - usage count of 1 and the caller of :py:obj:`~.cuCtxCreate()` must call - :py:obj:`~.cuCtxDestroy()` when done using the context. If a context is - already current to the thread, it is supplanted by the newly created - context and may be restored by a subsequent call to - :py:obj:`~.cuCtxPopCurrent()`. - - CUDA context can be created with execution affinity. The type and the + A CUDA context can be created with execution affinity. The type and the amount of execution resource the context can use is limited by `paramsArray` and `numExecAffinityParams` in `execAffinity`. The `paramsArray` is an array of `CUexecAffinityParam` and the @@ -19351,19 +27061,23 @@ def cuCtxCreate_v4(ctxCreateParams : Optional[CUctxCreateParams], unsigned int f number of SMs via `CUexecAffinitySmCount`. This limit will be internally rounded up to the next hardware-supported amount. Hence, it is imperative to query the actual execution affinity of the - context via `cuCtxGetExecAffinity` after context creation. Currently, - this attribute is only supported under Volta+ MPS. - - CUDA context can be created in CIG(CUDA in Graphics) mode by setting /p - cigParams. Hardware support and software support for graphics clients - can be determined using :py:obj:`~.cuDeviceGetAttribute()` with - :py:obj:`~.CU_DEVICE_ATTRIBUTE_D3D12_CIG_SUPPORTED`. Data from graphics - client is shared with CUDA via the /p sharedData in /pcigParams. For - D3D12, /p sharedData is a ID3D12CommandQueue handle. - - Either /p execAffinityParams or /p cigParams can be set to a non-null - value. Setting both to a non-null value will result in an undefined - behavior. + context via :py:obj:`~.cuCtxGetExecAffinity` after context creation. + Currently, this attribute is only supported under Volta+ MPS. + + A CUDA context can be created in CIG(CUDA in Graphics) mode by setting + `cigParams`. Data from graphics client is shared with CUDA via the + `sharedData` in `cigParams`. Support for D3D12 graphics client can be + determined using :py:obj:`~.cuDeviceGetAttribute()` with + :py:obj:`~.CU_DEVICE_ATTRIBUTE_D3D12_CIG_SUPPORTED`. `sharedData` is a + ID3D12CommandQueue handle. Support for Vulkan graphics client can be + determined using :py:obj:`~.cuDeviceGetAttribute()` with + :py:obj:`~.CU_DEVICE_ATTRIBUTE_VULKAN_CIG_SUPPORTED`. `sharedData` is a + Nvidia specific data blob populated by calling + vkGetExternalComputeQueueDataNV(). `execAffinityParams` and `cigParams` + are mutually exclusive and cannot both be non-NULL. Setting both to + non-NULL values will result in undefined behavior. If both + `execAffinityParams` and `cigParams` are NULL, the context will be + created as a regular CUDA context. The three LSBs of the `flags` parameter can be used to control how the OS thread, which owns the CUDA context at the time of an API call, @@ -19460,20 +27174,18 @@ def cuCtxCreate_v4(ctxCreateParams : Optional[CUctxCreateParams], unsigned int f compute mode for * devices. Documentation for `nvidia-smi` can be obtained by passing a -h option to it. - Context creation will fail with :: CUDA_ERROR_INVALID_VALUE if invalid - parameter was passed by client to create the CUDA context. + Context creation will fail with :py:obj:`~.CUDA_ERROR_INVALID_VALUE` if + invalid parameter was passed by client to create the CUDA context. Context creation in CIG mode will fail with :py:obj:`~.CUDA_ERROR_NOT_SUPPORTED` if CIG is not supported by the - device or the driver. Hardware support is available starting Volta. - Software support for graphics clients can be determined using - :py:obj:`~.cuDeviceGetAttribute()` with - :py:obj:`~.CU_DEVICE_ATTRIBUTE_D3D12_CIG_SUPPORTED`. + device or the driver. Parameters ---------- ctxCreateParams : :py:obj:`~.CUctxCreateParams` - Context creation parameters + Context creation parameters. Can be NULL to create a regular CUDA + context. See :py:obj:`~.CUctxCreateParams` for details. flags : unsigned int Context creation flags dev : :py:obj:`~.CUdevice` @@ -19488,24 +27200,23 @@ def cuCtxCreate_v4(ctxCreateParams : Optional[CUctxCreateParams], unsigned int f See Also -------- - :py:obj:`~.cuCtxDestroy`, :py:obj:`~.cuCtxGetApiVersion`, :py:obj:`~.cuCtxGetCacheConfig`, :py:obj:`~.cuCtxGetDevice`, :py:obj:`~.cuCtxGetFlags`, :py:obj:`~.cuCtxGetLimit`, :py:obj:`~.cuCtxPopCurrent`, :py:obj:`~.cuCtxPushCurrent`, :py:obj:`~.cuCtxSetCacheConfig`, :py:obj:`~.cuCtxSetLimit`, :py:obj:`~.cuCoredumpSetAttributeGlobal`, :py:obj:`~.cuCoredumpSetAttribute`, :py:obj:`~.cuCtxSynchronize` + :py:obj:`~.cuCtxDestroy`, :py:obj:`~.cuCtxGetApiVersion`, :py:obj:`~.cuCtxGetCacheConfig`, :py:obj:`~.cuCtxGetDevice`, :py:obj:`~.cuCtxGetFlags`, :py:obj:`~.cuCtxGetLimit`, :py:obj:`~.cuCtxPopCurrent`, :py:obj:`~.cuCtxPushCurrent`, :py:obj:`~.cuCtxSetCacheConfig`, :py:obj:`~.cuCtxSetLimit`, :py:obj:`~.cuCoredumpSetAttributeGlobal`, :py:obj:`~.cuCoredumpSetAttribute`, :py:obj:`~.cuCtxSynchronize` :py:obj:`~.cuCtxGetExecAffinity`, """ - cdef ccuda.CUdevice cdev + cdef cydriver.CUdevice cydev if dev is None: - cdev = 0 + pdev = 0 elif isinstance(dev, (CUdevice,)): pdev = int(dev) - cdev = pdev else: pdev = int(CUdevice(dev)) - cdev = pdev + cydev = pdev cdef CUcontext pctx = CUcontext() - cdef ccuda.CUctxCreateParams* cctxCreateParams_ptr = ctxCreateParams._ptr if ctxCreateParams != None else NULL - err = ccuda.cuCtxCreate_v4(pctx._ptr, cctxCreateParams_ptr, flags, cdev) - return (CUresult(err), pctx) -{{endif}} - -{{if 'cuCtxDestroy_v2' in found_functions}} + cdef cydriver.CUctxCreateParams* cyctxCreateParams_ptr = ctxCreateParams._pvt_ptr if ctxCreateParams is not None else NULL + with nogil: + err = cydriver.cuCtxCreate(pctx._pvt_ptr, cyctxCreateParams_ptr, flags, cydev) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pctx) @cython.embedsignature(True) def cuCtxDestroy(ctx): @@ -19555,20 +27266,17 @@ def cuCtxDestroy(ctx): ----- :py:obj:`~.cuCtxDestroy()` will not destroy memory allocations by :py:obj:`~.cuMemCreate()`, :py:obj:`~.cuMemAllocAsync()` and :py:obj:`~.cuMemAllocFromPoolAsync()`. These memory allocations are not associated with any CUDA context and need to be destroyed explicitly. """ - cdef ccuda.CUcontext cctx + cdef cydriver.CUcontext cyctx if ctx is None: - cctx = 0 + pctx = 0 elif isinstance(ctx, (CUcontext,)): pctx = int(ctx) - cctx = pctx else: pctx = int(CUcontext(ctx)) - cctx = pctx - err = ccuda.cuCtxDestroy(cctx) - return (CUresult(err),) -{{endif}} - -{{if 'cuCtxPushCurrent_v2' in found_functions}} + cyctx = pctx + with nogil: + err = cydriver.cuCtxDestroy(cyctx) + return (_CUresult(err),) @cython.embedsignature(True) def cuCtxPushCurrent(ctx): @@ -19596,20 +27304,17 @@ def cuCtxPushCurrent(ctx): -------- :py:obj:`~.cuCtxCreate`, :py:obj:`~.cuCtxDestroy`, :py:obj:`~.cuCtxGetApiVersion`, :py:obj:`~.cuCtxGetCacheConfig`, :py:obj:`~.cuCtxGetDevice`, :py:obj:`~.cuCtxGetFlags`, :py:obj:`~.cuCtxGetLimit`, :py:obj:`~.cuCtxPopCurrent`, :py:obj:`~.cuCtxSetCacheConfig`, :py:obj:`~.cuCtxSetLimit`, :py:obj:`~.cuCtxSynchronize` """ - cdef ccuda.CUcontext cctx + cdef cydriver.CUcontext cyctx if ctx is None: - cctx = 0 + pctx = 0 elif isinstance(ctx, (CUcontext,)): pctx = int(ctx) - cctx = pctx else: pctx = int(CUcontext(ctx)) - cctx = pctx - err = ccuda.cuCtxPushCurrent(cctx) - return (CUresult(err),) -{{endif}} - -{{if 'cuCtxPopCurrent_v2' in found_functions}} + cyctx = pctx + with nogil: + err = cydriver.cuCtxPushCurrent(cyctx) + return (_CUresult(err),) @cython.embedsignature(True) def cuCtxPopCurrent(): @@ -19635,11 +27340,11 @@ def cuCtxPopCurrent(): :py:obj:`~.cuCtxCreate`, :py:obj:`~.cuCtxDestroy`, :py:obj:`~.cuCtxGetApiVersion`, :py:obj:`~.cuCtxGetCacheConfig`, :py:obj:`~.cuCtxGetDevice`, :py:obj:`~.cuCtxGetFlags`, :py:obj:`~.cuCtxGetLimit`, :py:obj:`~.cuCtxPushCurrent`, :py:obj:`~.cuCtxSetCacheConfig`, :py:obj:`~.cuCtxSetLimit`, :py:obj:`~.cuCtxSynchronize` """ cdef CUcontext pctx = CUcontext() - err = ccuda.cuCtxPopCurrent(pctx._ptr) - return (CUresult(err), pctx) -{{endif}} - -{{if 'cuCtxSetCurrent' in found_functions}} + with nogil: + err = cydriver.cuCtxPopCurrent(pctx._pvt_ptr) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pctx) @cython.embedsignature(True) def cuCtxSetCurrent(ctx): @@ -19669,20 +27374,17 @@ def cuCtxSetCurrent(ctx): -------- :py:obj:`~.cuCtxGetCurrent`, :py:obj:`~.cuCtxCreate`, :py:obj:`~.cuCtxDestroy`, :py:obj:`~.cudaSetDevice` """ - cdef ccuda.CUcontext cctx + cdef cydriver.CUcontext cyctx if ctx is None: - cctx = 0 + pctx = 0 elif isinstance(ctx, (CUcontext,)): pctx = int(ctx) - cctx = pctx else: pctx = int(CUcontext(ctx)) - cctx = pctx - err = ccuda.cuCtxSetCurrent(cctx) - return (CUresult(err),) -{{endif}} - -{{if 'cuCtxGetCurrent' in found_functions}} + cyctx = pctx + with nogil: + err = cydriver.cuCtxSetCurrent(cyctx) + return (_CUresult(err),) @cython.embedsignature(True) def cuCtxGetCurrent(): @@ -19704,35 +27406,74 @@ def cuCtxGetCurrent(): :py:obj:`~.cuCtxSetCurrent`, :py:obj:`~.cuCtxCreate`, :py:obj:`~.cuCtxDestroy`, :py:obj:`~.cudaGetDevice` """ cdef CUcontext pctx = CUcontext() - err = ccuda.cuCtxGetCurrent(pctx._ptr) - return (CUresult(err), pctx) -{{endif}} - -{{if 'cuCtxGetDevice' in found_functions}} + with nogil: + err = cydriver.cuCtxGetCurrent(pctx._pvt_ptr) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pctx) @cython.embedsignature(True) def cuCtxGetDevice(): - """ Returns the device ID for the current context. + """ Returns the device handle for the current context. - Returns in `*device` the ordinal of the current context's device. + Returns in `*device` the handle of the current context's device. Returns ------- CUresult :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_CONTEXT`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, device : :py:obj:`~.CUdevice` - Returned device ID for the current context + Returned device handle for the current context See Also -------- :py:obj:`~.cuCtxCreate`, :py:obj:`~.cuCtxDestroy`, :py:obj:`~.cuCtxGetApiVersion`, :py:obj:`~.cuCtxGetCacheConfig`, :py:obj:`~.cuCtxGetFlags`, :py:obj:`~.cuCtxGetLimit`, :py:obj:`~.cuCtxPopCurrent`, :py:obj:`~.cuCtxPushCurrent`, :py:obj:`~.cuCtxSetCacheConfig`, :py:obj:`~.cuCtxSetLimit`, :py:obj:`~.cuCtxSynchronize`, :py:obj:`~.cudaGetDevice` """ cdef CUdevice device = CUdevice() - err = ccuda.cuCtxGetDevice(device._ptr) - return (CUresult(err), device) -{{endif}} + with nogil: + err = cydriver.cuCtxGetDevice(device._pvt_ptr) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, device) + +@cython.embedsignature(True) +def cuCtxGetDevice_v2(ctx): + """ Returns the device handle for the specified context. + + Returns in `*device` the handle of the specified context's device. If + the specified context is NULL, the API will return the current + context's device. + + Parameters + ---------- + ctx : :py:obj:`~.CUcontext` + Context for which to obtain the device -{{if 'cuCtxGetFlags' in found_functions}} + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_CONTEXT`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE` + device : :py:obj:`~.CUdevice` + Returned device handle for the specified context + + See Also + -------- + :py:obj:`~.cuCtxGetCurrent`, :py:obj:`~.cuCtxPopCurrent`, :py:obj:`~.cuCtxPushCurrent` + """ + cdef cydriver.CUcontext cyctx + if ctx is None: + pctx = 0 + elif isinstance(ctx, (CUcontext,)): + pctx = int(ctx) + else: + pctx = int(CUcontext(ctx)) + cyctx = pctx + cdef CUdevice device = CUdevice() + with nogil: + err = cydriver.cuCtxGetDevice_v2(device._pvt_ptr, cyctx) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, device) @cython.embedsignature(True) def cuCtxGetFlags(): @@ -19753,11 +27494,11 @@ def cuCtxGetFlags(): :py:obj:`~.cuCtxCreate`, :py:obj:`~.cuCtxGetApiVersion`, :py:obj:`~.cuCtxGetCacheConfig`, :py:obj:`~.cuCtxGetCurrent`, :py:obj:`~.cuCtxGetDevice`, :py:obj:`~.cuCtxGetLimit`, :py:obj:`~.cuCtxGetSharedMemConfig`, :py:obj:`~.cuCtxGetStreamPriorityRange`, :py:obj:`~.cuCtxSetFlags`, :py:obj:`~.cudaGetDeviceFlags` """ cdef unsigned int flags = 0 - err = ccuda.cuCtxGetFlags(&flags) - return (CUresult(err), flags) -{{endif}} - -{{if 'cuCtxSetFlags' in found_functions}} + with nogil: + err = cydriver.cuCtxGetFlags(&flags) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, flags) @cython.embedsignature(True) def cuCtxSetFlags(unsigned int flags): @@ -19780,11 +27521,9 @@ def cuCtxSetFlags(unsigned int flags): -------- :py:obj:`~.cuCtxCreate`, :py:obj:`~.cuCtxGetApiVersion`, :py:obj:`~.cuCtxGetCacheConfig`, :py:obj:`~.cuCtxGetCurrent`, :py:obj:`~.cuCtxGetDevice`, :py:obj:`~.cuCtxGetLimit`, :py:obj:`~.cuCtxGetSharedMemConfig`, :py:obj:`~.cuCtxGetStreamPriorityRange`, :py:obj:`~.cuCtxGetFlags`, :py:obj:`~.cudaGetDeviceFlags`, :py:obj:`~.cuDevicePrimaryCtxSetFlags`, """ - err = ccuda.cuCtxSetFlags(flags) - return (CUresult(err),) -{{endif}} - -{{if 'cuCtxGetId' in found_functions}} + with nogil: + err = cydriver.cuCtxSetFlags(flags) + return (_CUresult(err),) @cython.embedsignature(True) def cuCtxGetId(ctx): @@ -19811,21 +27550,20 @@ def cuCtxGetId(ctx): -------- :py:obj:`~.cuCtxCreate`, :py:obj:`~.cuCtxDestroy`, :py:obj:`~.cuCtxGetApiVersion`, :py:obj:`~.cuCtxGetCacheConfig`, :py:obj:`~.cuCtxGetDevice`, :py:obj:`~.cuCtxGetFlags`, :py:obj:`~.cuCtxGetLimit`, :py:obj:`~.cuCtxPushCurrent` """ - cdef ccuda.CUcontext cctx + cdef cydriver.CUcontext cyctx if ctx is None: - cctx = 0 + pctx = 0 elif isinstance(ctx, (CUcontext,)): pctx = int(ctx) - cctx = pctx else: pctx = int(CUcontext(ctx)) - cctx = pctx + cyctx = pctx cdef unsigned long long ctxId = 0 - err = ccuda.cuCtxGetId(cctx, &ctxId) - return (CUresult(err), ctxId) -{{endif}} - -{{if 'cuCtxSynchronize' in found_functions}} + with nogil: + err = cydriver.cuCtxGetId(cyctx, &ctxId) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, ctxId) @cython.embedsignature(True) def cuCtxSynchronize(): @@ -19842,17 +27580,57 @@ def cuCtxSynchronize(): Returns ------- CUresult - :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_CONTEXT` + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_CONTEXT`, :py:obj:`~.CUDA_ERROR_STREAM_CAPTURE_UNSUPPORTED` See Also -------- :py:obj:`~.cuCtxCreate`, :py:obj:`~.cuCtxDestroy`, :py:obj:`~.cuCtxGetApiVersion`, :py:obj:`~.cuCtxGetCacheConfig`, :py:obj:`~.cuCtxGetDevice`, :py:obj:`~.cuCtxGetFlags`, :py:obj:`~.cuCtxGetLimit`, :py:obj:`~.cuCtxPopCurrent`, :py:obj:`~.cuCtxPushCurrent`, :py:obj:`~.cuCtxSetCacheConfig`, :py:obj:`~.cuCtxSetLimit`, :py:obj:`~.cudaDeviceSynchronize` """ - err = ccuda.cuCtxSynchronize() - return (CUresult(err),) -{{endif}} + with nogil: + err = cydriver.cuCtxSynchronize() + return (_CUresult(err),) + +@cython.embedsignature(True) +def cuCtxSynchronize_v2(ctx): + """ Block for the specified context's tasks to complete. + + Blocks until the specified context has completed all preceding + requested tasks. If the specified context is the primary context, green + contexts that have been created will also be synchronized. The API + returns an error if one of the preceding tasks failed. + + If the context was created with the + :py:obj:`~.CU_CTX_SCHED_BLOCKING_SYNC` flag, the CPU thread will block + until the GPU context has finished its work. + + If the specified context is NULL, the API will operate on the current + context. -{{if 'cuCtxSetLimit' in found_functions}} + Parameters + ---------- + ctx : :py:obj:`~.CUcontext` + Context to synchronize + + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_CONTEXT`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_STREAM_CAPTURE_UNSUPPORTED` + + See Also + -------- + :py:obj:`~.cuCtxGetCurrent`, :py:obj:`~.cuCtxPopCurrent`, :py:obj:`~.cuCtxPushCurrent`, :py:obj:`~.cuGreenCtxCreate`, :py:obj:`~.cuCtxFromGreenCtx`, :py:obj:`~.cudaDeviceSynchronize` + """ + cdef cydriver.CUcontext cyctx + if ctx is None: + pctx = 0 + elif isinstance(ctx, (CUcontext,)): + pctx = int(ctx) + else: + pctx = int(CUcontext(ctx)) + cyctx = pctx + with nogil: + err = cydriver.cuCtxSynchronize_v2(cyctx) + return (_CUresult(err),) @cython.embedsignature(True) def cuCtxSetLimit(limit not None : CUlimit, size_t value): @@ -19953,12 +27731,10 @@ def cuCtxSetLimit(limit not None : CUlimit, size_t value): -------- :py:obj:`~.cuCtxCreate`, :py:obj:`~.cuCtxDestroy`, :py:obj:`~.cuCtxGetApiVersion`, :py:obj:`~.cuCtxGetCacheConfig`, :py:obj:`~.cuCtxGetDevice`, :py:obj:`~.cuCtxGetFlags`, :py:obj:`~.cuCtxGetLimit`, :py:obj:`~.cuCtxPopCurrent`, :py:obj:`~.cuCtxPushCurrent`, :py:obj:`~.cuCtxSetCacheConfig`, :py:obj:`~.cuCtxSynchronize`, :py:obj:`~.cudaDeviceSetLimit` """ - cdef ccuda.CUlimit climit = limit.value - err = ccuda.cuCtxSetLimit(climit, value) - return (CUresult(err),) -{{endif}} - -{{if 'cuCtxGetLimit' in found_functions}} + cdef cydriver.CUlimit cylimit = int(limit) + with nogil: + err = cydriver.cuCtxSetLimit(cylimit, value) + return (_CUresult(err),) @cython.embedsignature(True) def cuCtxGetLimit(limit not None : CUlimit): @@ -19995,26 +27771,22 @@ def cuCtxGetLimit(limit not None : CUlimit): Parameters ---------- limit : :py:obj:`~.CUlimit` - Limit to query + None Returns ------- CUresult - :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_UNSUPPORTED_LIMIT` - pvalue : int - Returned size of limit - See Also - -------- - :py:obj:`~.cuCtxCreate`, :py:obj:`~.cuCtxDestroy`, :py:obj:`~.cuCtxGetApiVersion`, :py:obj:`~.cuCtxGetCacheConfig`, :py:obj:`~.cuCtxGetDevice`, :py:obj:`~.cuCtxGetFlags`, :py:obj:`~.cuCtxPopCurrent`, :py:obj:`~.cuCtxPushCurrent`, :py:obj:`~.cuCtxSetCacheConfig`, :py:obj:`~.cuCtxSetLimit`, :py:obj:`~.cuCtxSynchronize`, :py:obj:`~.cudaDeviceGetLimit` + pvalue : int + None """ cdef size_t pvalue = 0 - cdef ccuda.CUlimit climit = limit.value - err = ccuda.cuCtxGetLimit(&pvalue, climit) - return (CUresult(err), pvalue) -{{endif}} - -{{if 'cuCtxGetCacheConfig' in found_functions}} + cdef cydriver.CUlimit cylimit = int(limit) + with nogil: + err = cydriver.cuCtxGetLimit(&pvalue, cylimit) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pvalue) @cython.embedsignature(True) def cuCtxGetCacheConfig(): @@ -20054,12 +27826,12 @@ def cuCtxGetCacheConfig(): -------- :py:obj:`~.cuCtxCreate`, :py:obj:`~.cuCtxDestroy`, :py:obj:`~.cuCtxGetApiVersion`, :py:obj:`~.cuCtxGetDevice`, :py:obj:`~.cuCtxGetFlags`, :py:obj:`~.cuCtxGetLimit`, :py:obj:`~.cuCtxPopCurrent`, :py:obj:`~.cuCtxPushCurrent`, :py:obj:`~.cuCtxSetCacheConfig`, :py:obj:`~.cuCtxSetLimit`, :py:obj:`~.cuCtxSynchronize`, :py:obj:`~.cuFuncSetCacheConfig`, :py:obj:`~.cudaDeviceGetCacheConfig` """ - cdef ccuda.CUfunc_cache pconfig - err = ccuda.cuCtxGetCacheConfig(&pconfig) - return (CUresult(err), CUfunc_cache(pconfig)) -{{endif}} - -{{if 'cuCtxSetCacheConfig' in found_functions}} + cdef cydriver.CUfunc_cache pconfig + with nogil: + err = cydriver.cuCtxGetCacheConfig(&pconfig) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, CUfunc_cache(pconfig)) @cython.embedsignature(True) def cuCtxSetCacheConfig(config not None : CUfunc_cache): @@ -20111,12 +27883,10 @@ def cuCtxSetCacheConfig(config not None : CUfunc_cache): -------- :py:obj:`~.cuCtxCreate`, :py:obj:`~.cuCtxDestroy`, :py:obj:`~.cuCtxGetApiVersion`, :py:obj:`~.cuCtxGetCacheConfig`, :py:obj:`~.cuCtxGetDevice`, :py:obj:`~.cuCtxGetFlags`, :py:obj:`~.cuCtxGetLimit`, :py:obj:`~.cuCtxPopCurrent`, :py:obj:`~.cuCtxPushCurrent`, :py:obj:`~.cuCtxSetLimit`, :py:obj:`~.cuCtxSynchronize`, :py:obj:`~.cuFuncSetCacheConfig`, :py:obj:`~.cudaDeviceSetCacheConfig`, :py:obj:`~.cuKernelSetCacheConfig` """ - cdef ccuda.CUfunc_cache cconfig = config.value - err = ccuda.cuCtxSetCacheConfig(cconfig) - return (CUresult(err),) -{{endif}} - -{{if 'cuCtxGetApiVersion' in found_functions}} + cdef cydriver.CUfunc_cache cyconfig = int(config) + with nogil: + err = cydriver.cuCtxSetCacheConfig(cyconfig) + return (_CUresult(err),) @cython.embedsignature(True) def cuCtxGetApiVersion(ctx): @@ -20148,21 +27918,20 @@ def cuCtxGetApiVersion(ctx): -------- :py:obj:`~.cuCtxCreate`, :py:obj:`~.cuCtxDestroy`, :py:obj:`~.cuCtxGetDevice`, :py:obj:`~.cuCtxGetFlags`, :py:obj:`~.cuCtxGetLimit`, :py:obj:`~.cuCtxPopCurrent`, :py:obj:`~.cuCtxPushCurrent`, :py:obj:`~.cuCtxSetCacheConfig`, :py:obj:`~.cuCtxSetLimit`, :py:obj:`~.cuCtxSynchronize` """ - cdef ccuda.CUcontext cctx + cdef cydriver.CUcontext cyctx if ctx is None: - cctx = 0 + pctx = 0 elif isinstance(ctx, (CUcontext,)): pctx = int(ctx) - cctx = pctx else: pctx = int(CUcontext(ctx)) - cctx = pctx + cyctx = pctx cdef unsigned int version = 0 - err = ccuda.cuCtxGetApiVersion(cctx, &version) - return (CUresult(err), version) -{{endif}} - -{{if 'cuCtxGetStreamPriorityRange' in found_functions}} + with nogil: + err = cydriver.cuCtxGetApiVersion(cyctx, &version) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, version) @cython.embedsignature(True) def cuCtxGetStreamPriorityRange(): @@ -20201,11 +27970,11 @@ def cuCtxGetStreamPriorityRange(): """ cdef int leastPriority = 0 cdef int greatestPriority = 0 - err = ccuda.cuCtxGetStreamPriorityRange(&leastPriority, &greatestPriority) - return (CUresult(err), leastPriority, greatestPriority) -{{endif}} - -{{if 'cuCtxResetPersistingL2Cache' in found_functions}} + with nogil: + err = cydriver.cuCtxGetStreamPriorityRange(&leastPriority, &greatestPriority) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None, None) + return (_CUresult_SUCCESS, leastPriority, greatestPriority) @cython.embedsignature(True) def cuCtxResetPersistingL2Cache(): @@ -20223,11 +27992,9 @@ def cuCtxResetPersistingL2Cache(): -------- :py:obj:`~.CUaccessPolicyWindow` """ - err = ccuda.cuCtxResetPersistingL2Cache() - return (CUresult(err),) -{{endif}} - -{{if 'cuCtxGetExecAffinity' in found_functions}} + with nogil: + err = cydriver.cuCtxResetPersistingL2Cache() + return (_CUresult(err),) @cython.embedsignature(True) def cuCtxGetExecAffinity(typename not None : CUexecAffinityType): @@ -20256,12 +28023,12 @@ def cuCtxGetExecAffinity(typename not None : CUexecAffinityType): :py:obj:`~.CUexecAffinityParam` """ cdef CUexecAffinityParam pExecAffinity = CUexecAffinityParam() - cdef ccuda.CUexecAffinityType ctypename = typename.value - err = ccuda.cuCtxGetExecAffinity(pExecAffinity._ptr, ctypename) - return (CUresult(err), pExecAffinity) -{{endif}} - -{{if 'cuCtxRecordEvent' in found_functions}} + cdef cydriver.CUexecAffinityType cytypename = int(typename) + with nogil: + err = cydriver.cuCtxGetExecAffinity(pExecAffinity._pvt_ptr, cytypename) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pExecAffinity) @cython.embedsignature(True) def cuCtxRecordEvent(hCtx, hEvent): @@ -20290,7 +28057,7 @@ def cuCtxRecordEvent(hCtx, hEvent): Returns ------- CUresult - :py:obj:`~.CUDA_SUCCESS` :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_CONTEXT`, :py:obj:`~.CUDA_ERROR_INVALID_HANDLE`, :py:obj:`~.CUDA_ERROR_STREAM_CAPTURE_UNSUPPORTED` + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_CONTEXT`, :py:obj:`~.CUDA_ERROR_INVALID_HANDLE`, :py:obj:`~.CUDA_ERROR_STREAM_CAPTURE_UNSUPPORTED` See Also -------- @@ -20300,29 +28067,25 @@ def cuCtxRecordEvent(hCtx, hEvent): ----- The API will return :py:obj:`~.CUDA_ERROR_STREAM_CAPTURE_UNSUPPORTED` if the specified context `hCtx` has a stream in the capture mode. In such a case, the call will invalidate all the conflicting captures. """ - cdef ccuda.CUevent chEvent + cdef cydriver.CUevent cyhEvent if hEvent is None: - chEvent = 0 + phEvent = 0 elif isinstance(hEvent, (CUevent,)): phEvent = int(hEvent) - chEvent = phEvent else: phEvent = int(CUevent(hEvent)) - chEvent = phEvent - cdef ccuda.CUcontext chCtx + cyhEvent = phEvent + cdef cydriver.CUcontext cyhCtx if hCtx is None: - chCtx = 0 + phCtx = 0 elif isinstance(hCtx, (CUcontext,)): phCtx = int(hCtx) - chCtx = phCtx else: phCtx = int(CUcontext(hCtx)) - chCtx = phCtx - err = ccuda.cuCtxRecordEvent(chCtx, chEvent) - return (CUresult(err),) -{{endif}} - -{{if 'cuCtxWaitEvent' in found_functions}} + cyhCtx = phCtx + with nogil: + err = cydriver.cuCtxRecordEvent(cyhCtx, cyhEvent) + return (_CUresult(err),) @cython.embedsignature(True) def cuCtxWaitEvent(hCtx, hEvent): @@ -20360,29 +28123,25 @@ def cuCtxWaitEvent(hCtx, hEvent): The API will return :py:obj:`~.CUDA_ERROR_STREAM_CAPTURE_UNSUPPORTED` and invalidate the capture if the specified event `hEvent` is part of an ongoing capture sequence or if the specified context `hCtx` has a stream in the capture mode. """ - cdef ccuda.CUevent chEvent + cdef cydriver.CUevent cyhEvent if hEvent is None: - chEvent = 0 + phEvent = 0 elif isinstance(hEvent, (CUevent,)): phEvent = int(hEvent) - chEvent = phEvent else: phEvent = int(CUevent(hEvent)) - chEvent = phEvent - cdef ccuda.CUcontext chCtx + cyhEvent = phEvent + cdef cydriver.CUcontext cyhCtx if hCtx is None: - chCtx = 0 + phCtx = 0 elif isinstance(hCtx, (CUcontext,)): phCtx = int(hCtx) - chCtx = phCtx else: phCtx = int(CUcontext(hCtx)) - chCtx = phCtx - err = ccuda.cuCtxWaitEvent(chCtx, chEvent) - return (CUresult(err),) -{{endif}} - -{{if 'cuCtxAttach' in found_functions}} + cyhCtx = phCtx + with nogil: + err = cydriver.cuCtxWaitEvent(cyhCtx, cyhEvent) + return (_CUresult(err),) @cython.embedsignature(True) def cuCtxAttach(unsigned int flags): @@ -20416,11 +28175,11 @@ def cuCtxAttach(unsigned int flags): :py:obj:`~.cuCtxCreate`, :py:obj:`~.cuCtxDestroy`, :py:obj:`~.cuCtxDetach`, :py:obj:`~.cuCtxGetApiVersion`, :py:obj:`~.cuCtxGetCacheConfig`, :py:obj:`~.cuCtxGetDevice`, :py:obj:`~.cuCtxGetFlags`, :py:obj:`~.cuCtxGetLimit`, :py:obj:`~.cuCtxPopCurrent`, :py:obj:`~.cuCtxPushCurrent`, :py:obj:`~.cuCtxSetCacheConfig`, :py:obj:`~.cuCtxSetLimit`, :py:obj:`~.cuCtxSynchronize` """ cdef CUcontext pctx = CUcontext() - err = ccuda.cuCtxAttach(pctx._ptr, flags) - return (CUresult(err), pctx) -{{endif}} - -{{if 'cuCtxDetach' in found_functions}} + with nogil: + err = cydriver.cuCtxAttach(pctx._pvt_ptr, flags) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pctx) @cython.embedsignature(True) def cuCtxDetach(ctx): @@ -20449,20 +28208,17 @@ def cuCtxDetach(ctx): -------- :py:obj:`~.cuCtxCreate`, :py:obj:`~.cuCtxDestroy`, :py:obj:`~.cuCtxGetApiVersion`, :py:obj:`~.cuCtxGetCacheConfig`, :py:obj:`~.cuCtxGetDevice`, :py:obj:`~.cuCtxGetFlags`, :py:obj:`~.cuCtxGetLimit`, :py:obj:`~.cuCtxPopCurrent`, :py:obj:`~.cuCtxPushCurrent`, :py:obj:`~.cuCtxSetCacheConfig`, :py:obj:`~.cuCtxSetLimit`, :py:obj:`~.cuCtxSynchronize` """ - cdef ccuda.CUcontext cctx + cdef cydriver.CUcontext cyctx if ctx is None: - cctx = 0 + pctx = 0 elif isinstance(ctx, (CUcontext,)): pctx = int(ctx) - cctx = pctx else: pctx = int(CUcontext(ctx)) - cctx = pctx - err = ccuda.cuCtxDetach(cctx) - return (CUresult(err),) -{{endif}} - -{{if 'cuCtxGetSharedMemConfig' in found_functions}} + cyctx = pctx + with nogil: + err = cydriver.cuCtxDetach(cyctx) + return (_CUresult(err),) @cython.embedsignature(True) def cuCtxGetSharedMemConfig(): @@ -20497,12 +28253,12 @@ def cuCtxGetSharedMemConfig(): -------- :py:obj:`~.cuCtxCreate`, :py:obj:`~.cuCtxDestroy`, :py:obj:`~.cuCtxGetApiVersion`, :py:obj:`~.cuCtxGetCacheConfig`, :py:obj:`~.cuCtxGetDevice`, :py:obj:`~.cuCtxGetFlags`, :py:obj:`~.cuCtxGetLimit`, :py:obj:`~.cuCtxPopCurrent`, :py:obj:`~.cuCtxPushCurrent`, :py:obj:`~.cuCtxSetLimit`, :py:obj:`~.cuCtxSynchronize`, :py:obj:`~.cuCtxGetSharedMemConfig`, :py:obj:`~.cuFuncSetCacheConfig`, :py:obj:`~.cudaDeviceGetSharedMemConfig` """ - cdef ccuda.CUsharedconfig pConfig - err = ccuda.cuCtxGetSharedMemConfig(&pConfig) - return (CUresult(err), CUsharedconfig(pConfig)) -{{endif}} - -{{if 'cuCtxSetSharedMemConfig' in found_functions}} + cdef cydriver.CUsharedconfig pConfig + with nogil: + err = cydriver.cuCtxGetSharedMemConfig(&pConfig) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, CUsharedconfig(pConfig)) @cython.embedsignature(True) def cuCtxSetSharedMemConfig(config not None : CUsharedconfig): @@ -20551,12 +28307,10 @@ def cuCtxSetSharedMemConfig(config not None : CUsharedconfig): -------- :py:obj:`~.cuCtxCreate`, :py:obj:`~.cuCtxDestroy`, :py:obj:`~.cuCtxGetApiVersion`, :py:obj:`~.cuCtxGetCacheConfig`, :py:obj:`~.cuCtxGetDevice`, :py:obj:`~.cuCtxGetFlags`, :py:obj:`~.cuCtxGetLimit`, :py:obj:`~.cuCtxPopCurrent`, :py:obj:`~.cuCtxPushCurrent`, :py:obj:`~.cuCtxSetLimit`, :py:obj:`~.cuCtxSynchronize`, :py:obj:`~.cuCtxGetSharedMemConfig`, :py:obj:`~.cuFuncSetCacheConfig`, :py:obj:`~.cudaDeviceSetSharedMemConfig` """ - cdef ccuda.CUsharedconfig cconfig = config.value - err = ccuda.cuCtxSetSharedMemConfig(cconfig) - return (CUresult(err),) -{{endif}} - -{{if 'cuModuleLoad' in found_functions}} + cdef cydriver.CUsharedconfig cyconfig = int(config) + with nogil: + err = cydriver.cuCtxSetSharedMemConfig(cyconfig) + return (_CUresult(err),) @cython.embedsignature(True) def cuModuleLoad(char* fname): @@ -20569,7 +28323,7 @@ def cuModuleLoad(char* fname): allocated, :py:obj:`~.cuModuleLoad()` fails. The file should be a `cubin` file as output by nvcc, or a `PTX` file either as output by nvcc or handwritten, or a `fatbin` file as output by nvcc from - toolchain 4.0 or later. + toolchain 4.0 or later, or a `Tile` IR file. Parameters ---------- @@ -20588,11 +28342,11 @@ def cuModuleLoad(char* fname): :py:obj:`~.cuModuleGetFunction`, :py:obj:`~.cuModuleGetGlobal`, :py:obj:`~.cuModuleGetTexRef`, :py:obj:`~.cuModuleLoadData`, :py:obj:`~.cuModuleLoadDataEx`, :py:obj:`~.cuModuleLoadFatBinary`, :py:obj:`~.cuModuleUnload` """ cdef CUmodule module = CUmodule() - err = ccuda.cuModuleLoad(module._ptr, fname) - return (CUresult(err), module) -{{endif}} - -{{if 'cuModuleLoadData' in found_functions}} + with nogil: + err = cydriver.cuModuleLoad(module._pvt_ptr, fname) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, module) @cython.embedsignature(True) def cuModuleLoadData(image): @@ -20601,7 +28355,7 @@ def cuModuleLoadData(image): Takes a pointer `image` and loads the corresponding module `module` into the current context. The `image` may be a `cubin` or `fatbin` as output by nvcc, or a NULL-terminated `PTX`, either as output by nvcc or - hand-written. + hand-written, or `Tile` IR data. Parameters ---------- @@ -20620,22 +28374,23 @@ def cuModuleLoadData(image): :py:obj:`~.cuModuleGetFunction`, :py:obj:`~.cuModuleGetGlobal`, :py:obj:`~.cuModuleGetTexRef`, :py:obj:`~.cuModuleLoad`, :py:obj:`~.cuModuleLoadDataEx`, :py:obj:`~.cuModuleLoadFatBinary`, :py:obj:`~.cuModuleUnload` """ cdef CUmodule module = CUmodule() - cimage = utils.HelperInputVoidPtr(image) - cdef void* cimage_ptr = cimage.cptr - err = ccuda.cuModuleLoadData(module._ptr, cimage_ptr) - return (CUresult(err), module) -{{endif}} - -{{if 'cuModuleLoadDataEx' in found_functions}} + cdef _HelperInputVoidPtrStruct cyimageHelper + cdef void* cyimage = _helper_input_void_ptr(image, &cyimageHelper) + with nogil: + err = cydriver.cuModuleLoadData(module._pvt_ptr, cyimage) + _helper_input_void_ptr_free(&cyimageHelper) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, module) @cython.embedsignature(True) -def cuModuleLoadDataEx(image, unsigned int numOptions, options : Optional[List[CUjit_option]], optionValues : Optional[List[Any]]): +def cuModuleLoadDataEx(image, unsigned int numOptions, options : Optional[tuple[CUjit_option] | list[CUjit_option]], optionValues : Optional[tuple[Any] | list[Any]]): """ Load a module's data with options. Takes a pointer `image` and loads the corresponding module `module` into the current context. The `image` may be a `cubin` or `fatbin` as output by nvcc, or a NULL-terminated `PTX`, either as output by nvcc or - hand-written. + hand-written, or `Tile` IR data. Parameters ---------- @@ -20643,9 +28398,9 @@ def cuModuleLoadDataEx(image, unsigned int numOptions, options : Optional[List[C Module data to load numOptions : unsigned int Number of options - options : List[:py:obj:`~.CUjit_option`] + options : list[:py:obj:`~.CUjit_option`] Options for JIT - optionValues : List[Any] + optionValues : list[Any] Option values for JIT Returns @@ -20662,20 +28417,22 @@ def cuModuleLoadDataEx(image, unsigned int numOptions, options : Optional[List[C optionValues = [] if optionValues is None else optionValues options = [] if options is None else options if not all(isinstance(_x, (CUjit_option)) for _x in options): - raise TypeError("Argument 'options' is not instance of type (expected List[ccuda.CUjit_option]") + raise TypeError("Argument 'options' is not instance of type (expected tuple[cydriver.CUjit_option] or list[cydriver.CUjit_option]") cdef CUmodule module = CUmodule() - cimage = utils.HelperInputVoidPtr(image) - cdef void* cimage_ptr = cimage.cptr + cdef _HelperInputVoidPtrStruct cyimageHelper + cdef void* cyimage = _helper_input_void_ptr(image, &cyimageHelper) if numOptions > len(options): raise RuntimeError("List is too small: " + str(len(options)) + " < " + str(numOptions)) if numOptions > len(optionValues): raise RuntimeError("List is too small: " + str(len(optionValues)) + " < " + str(numOptions)) - cdef vector[ccuda.CUjit_option] coptions = [pyoptions.value for pyoptions in (options)] - pylist = [utils.HelperCUjit_option(pyoptions, pyoptionValues) for pyoptions, pyoptionValues in zip(options, optionValues)] - cdef utils.InputVoidPtrPtrHelper voidStarHelperoptionValues = utils.InputVoidPtrPtrHelper(pylist) - err = ccuda.cuModuleLoadDataEx(module._ptr, cimage_ptr, numOptions, coptions.data(), voidStarHelperoptionValues.cptr) - return (CUresult(err), module) -{{endif}} - -{{if 'cuModuleLoadFatBinary' in found_functions}} + cdef vector[cydriver.CUjit_option] cyoptions = options + pylist = [_HelperCUjit_option(pyoptions, pyoptionValues) for pyoptions, pyoptionValues in zip(options, optionValues)] + cdef _InputVoidPtrPtrHelper voidStarHelperoptionValues = _InputVoidPtrPtrHelper(pylist) + cdef void** cyoptionValues_ptr = voidStarHelperoptionValues.cptr + with nogil: + err = cydriver.cuModuleLoadDataEx(module._pvt_ptr, cyimage, numOptions, cyoptions.data(), cyoptionValues_ptr) + _helper_input_void_ptr_free(&cyimageHelper) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, module) @cython.embedsignature(True) def cuModuleLoadFatBinary(fatCubin): @@ -20709,13 +28466,14 @@ def cuModuleLoadFatBinary(fatCubin): :py:obj:`~.cuModuleGetFunction`, :py:obj:`~.cuModuleGetGlobal`, :py:obj:`~.cuModuleGetTexRef`, :py:obj:`~.cuModuleLoad`, :py:obj:`~.cuModuleLoadData`, :py:obj:`~.cuModuleLoadDataEx`, :py:obj:`~.cuModuleUnload` """ cdef CUmodule module = CUmodule() - cfatCubin = utils.HelperInputVoidPtr(fatCubin) - cdef void* cfatCubin_ptr = cfatCubin.cptr - err = ccuda.cuModuleLoadFatBinary(module._ptr, cfatCubin_ptr) - return (CUresult(err), module) -{{endif}} - -{{if 'cuModuleUnload' in found_functions}} + cdef _HelperInputVoidPtrStruct cyfatCubinHelper + cdef void* cyfatCubin = _helper_input_void_ptr(fatCubin, &cyfatCubinHelper) + with nogil: + err = cydriver.cuModuleLoadFatBinary(module._pvt_ptr, cyfatCubin) + _helper_input_void_ptr_free(&cyfatCubinHelper) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, module) @cython.embedsignature(True) def cuModuleUnload(hmod): @@ -20740,20 +28498,17 @@ def cuModuleUnload(hmod): -------- :py:obj:`~.cuModuleGetFunction`, :py:obj:`~.cuModuleGetGlobal`, :py:obj:`~.cuModuleGetTexRef`, :py:obj:`~.cuModuleLoad`, :py:obj:`~.cuModuleLoadData`, :py:obj:`~.cuModuleLoadDataEx`, :py:obj:`~.cuModuleLoadFatBinary` """ - cdef ccuda.CUmodule chmod + cdef cydriver.CUmodule cyhmod if hmod is None: - chmod = 0 + phmod = 0 elif isinstance(hmod, (CUmodule,)): phmod = int(hmod) - chmod = phmod else: phmod = int(CUmodule(hmod)) - chmod = phmod - err = ccuda.cuModuleUnload(chmod) - return (CUresult(err),) -{{endif}} - -{{if 'cuModuleGetLoadingMode' in found_functions}} + cyhmod = phmod + with nogil: + err = cydriver.cuModuleUnload(cyhmod) + return (_CUresult(err),) @cython.embedsignature(True) def cuModuleGetLoadingMode(): @@ -20773,12 +28528,12 @@ def cuModuleGetLoadingMode(): -------- :py:obj:`~.cuModuleLoad`, """ - cdef ccuda.CUmoduleLoadingMode mode - err = ccuda.cuModuleGetLoadingMode(&mode) - return (CUresult(err), CUmoduleLoadingMode(mode)) -{{endif}} - -{{if 'cuModuleGetFunction' in found_functions}} + cdef cydriver.CUmoduleLoadingMode mode + with nogil: + err = cydriver.cuModuleGetLoadingMode(&mode) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, CUmoduleLoadingMode(mode)) @cython.embedsignature(True) def cuModuleGetFunction(hmod, char* name): @@ -20807,21 +28562,20 @@ def cuModuleGetFunction(hmod, char* name): -------- :py:obj:`~.cuModuleGetGlobal`, :py:obj:`~.cuModuleGetTexRef`, :py:obj:`~.cuModuleLoad`, :py:obj:`~.cuModuleLoadData`, :py:obj:`~.cuModuleLoadDataEx`, :py:obj:`~.cuModuleLoadFatBinary`, :py:obj:`~.cuModuleUnload` """ - cdef ccuda.CUmodule chmod + cdef cydriver.CUmodule cyhmod if hmod is None: - chmod = 0 + phmod = 0 elif isinstance(hmod, (CUmodule,)): phmod = int(hmod) - chmod = phmod else: phmod = int(CUmodule(hmod)) - chmod = phmod + cyhmod = phmod cdef CUfunction hfunc = CUfunction() - err = ccuda.cuModuleGetFunction(hfunc._ptr, chmod, name) - return (CUresult(err), hfunc) -{{endif}} - -{{if 'cuModuleGetFunctionCount' in found_functions}} + with nogil: + err = cydriver.cuModuleGetFunction(hfunc._pvt_ptr, cyhmod, name) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, hfunc) @cython.embedsignature(True) def cuModuleGetFunctionCount(mod): @@ -20841,21 +28595,20 @@ def cuModuleGetFunctionCount(mod): count : unsigned int Number of functions found within the module """ - cdef ccuda.CUmodule cmod + cdef cydriver.CUmodule cymod if mod is None: - cmod = 0 + pmod = 0 elif isinstance(mod, (CUmodule,)): pmod = int(mod) - cmod = pmod else: pmod = int(CUmodule(mod)) - cmod = pmod + cymod = pmod cdef unsigned int count = 0 - err = ccuda.cuModuleGetFunctionCount(&count, cmod) - return (CUresult(err), count) -{{endif}} - -{{if 'cuModuleEnumerateFunctions' in found_functions}} + with nogil: + err = cydriver.cuModuleGetFunctionCount(&count, cymod) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, count) @cython.embedsignature(True) def cuModuleEnumerateFunctions(unsigned int numFunctions, mod): @@ -20882,37 +28635,36 @@ def cuModuleEnumerateFunctions(unsigned int numFunctions, mod): ------- CUresult :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_INVALID_CONTEXT`, :py:obj:`~.CUDA_ERROR_INVALID_HANDLE`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE` - functions : List[:py:obj:`~.CUfunction`] + functions : list[:py:obj:`~.CUfunction`] Buffer where the function handles are returned to See Also -------- :py:obj:`~.cuModuleGetFunction`, :py:obj:`~.cuModuleGetFunctionCount`, :py:obj:`~.cuFuncIsLoaded`, :py:obj:`~.cuFuncLoad` """ - cdef ccuda.CUmodule cmod + cdef cydriver.CUmodule cymod if mod is None: - cmod = 0 + pmod = 0 elif isinstance(mod, (CUmodule,)): pmod = int(mod) - cmod = pmod else: pmod = int(CUmodule(mod)) - cmod = pmod - cdef ccuda.CUfunction* cfunctions = NULL + cymod = pmod + cdef cydriver.CUfunction* cyfunctions = NULL pyfunctions = [] if numFunctions != 0: - cfunctions = calloc(numFunctions, sizeof(ccuda.CUfunction)) - if cfunctions is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(numFunctions) + 'x' + str(sizeof(ccuda.CUfunction))) - err = ccuda.cuModuleEnumerateFunctions(cfunctions, numFunctions, cmod) + cyfunctions = calloc(numFunctions, sizeof(cydriver.CUfunction)) + if cyfunctions is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(numFunctions) + 'x' + str(sizeof(cydriver.CUfunction))) + with nogil: + err = cydriver.cuModuleEnumerateFunctions(cyfunctions, numFunctions, cymod) if CUresult(err) == CUresult(0): - pyfunctions = [CUfunction(init_value=cfunctions[idx]) for idx in range(numFunctions)] - if cfunctions is not NULL: - free(cfunctions) - return (CUresult(err), pyfunctions) -{{endif}} - -{{if 'cuModuleGetGlobal_v2' in found_functions}} + pyfunctions = [CUfunction(init_value=cyfunctions[idx]) for idx in range(numFunctions)] + if cyfunctions is not NULL: + free(cyfunctions) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pyfunctions) @cython.embedsignature(True) def cuModuleGetGlobal(hmod, char* name): @@ -20944,50 +28696,55 @@ def cuModuleGetGlobal(hmod, char* name): -------- :py:obj:`~.cuModuleGetFunction`, :py:obj:`~.cuModuleGetTexRef`, :py:obj:`~.cuModuleLoad`, :py:obj:`~.cuModuleLoadData`, :py:obj:`~.cuModuleLoadDataEx`, :py:obj:`~.cuModuleLoadFatBinary`, :py:obj:`~.cuModuleUnload`, :py:obj:`~.cudaGetSymbolAddress`, :py:obj:`~.cudaGetSymbolSize` """ - cdef ccuda.CUmodule chmod + cdef cydriver.CUmodule cyhmod if hmod is None: - chmod = 0 + phmod = 0 elif isinstance(hmod, (CUmodule,)): phmod = int(hmod) - chmod = phmod else: phmod = int(CUmodule(hmod)) - chmod = phmod + cyhmod = phmod cdef CUdeviceptr dptr = CUdeviceptr() cdef size_t numbytes = 0 - err = ccuda.cuModuleGetGlobal(dptr._ptr, &numbytes, chmod, name) - return (CUresult(err), dptr, numbytes) -{{endif}} - -{{if 'cuLinkCreate_v2' in found_functions}} + with nogil: + err = cydriver.cuModuleGetGlobal(dptr._pvt_ptr, &numbytes, cyhmod, name) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None, None) + return (_CUresult_SUCCESS, dptr, numbytes) @cython.embedsignature(True) -def cuLinkCreate(unsigned int numOptions, options : Optional[List[CUjit_option]], optionValues : Optional[List[Any]]): +def cuLinkCreate(unsigned int numOptions, options : Optional[tuple[CUjit_option] | list[CUjit_option]], optionValues : Optional[tuple[Any] | list[Any]]): """ Creates a pending JIT linker invocation. - If the call is successful, the caller owns the returned CUlinkState, - which should eventually be destroyed with :py:obj:`~.cuLinkDestroy`. - The device code machine size (32 or 64 bit) will match the calling - application. + If the call is successful, the caller owns the returned + :py:obj:`~.CUlinkState`, which should eventually be destroyed with + :py:obj:`~.cuLinkDestroy`. The device code machine size (32 or 64 bit) + will match the calling application. Both linker and compiler options may be specified. Compiler options will be applied to inputs to this linker action which must be compiled from PTX. The options :py:obj:`~.CU_JIT_WALL_TIME`, :py:obj:`~.CU_JIT_INFO_LOG_BUFFER_SIZE_BYTES`, and :py:obj:`~.CU_JIT_ERROR_LOG_BUFFER_SIZE_BYTES` will accumulate data - until the CUlinkState is destroyed. + until the :py:obj:`~.CUlinkState` is destroyed. + + The data passed in via :py:obj:`~.cuLinkAddData` and + :py:obj:`~.cuLinkAddFile` will be treated as relocatable (-rdc=true to + nvcc) when linking the final cubin during :py:obj:`~.cuLinkComplete` + and will have similar consequences as offline relocatable device code + linking. - `optionValues` must remain valid for the life of the CUlinkState if - output options are used. No other references to inputs are maintained - after this call returns. + `optionValues` must remain valid for the life of the + :py:obj:`~.CUlinkState` if output options are used. No other references + to inputs are maintained after this call returns. Parameters ---------- numOptions : unsigned int Size of options arrays - options : List[:py:obj:`~.CUjit_option`] + options : list[:py:obj:`~.CUjit_option`] Array of linker and compiler options - optionValues : List[Any] + optionValues : list[Any] Array of option values, each cast to void * Returns @@ -20995,8 +28752,8 @@ def cuLinkCreate(unsigned int numOptions, options : Optional[List[CUjit_option]] CUresult :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_CONTEXT`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_OUT_OF_MEMORY`, :py:obj:`~.CUDA_ERROR_JIT_COMPILER_NOT_FOUND` stateOut : :py:obj:`~.CUlinkState` - On success, this will contain a CUlinkState to specify and complete - this action + On success, this will contain a :py:obj:`~.CUlinkState` to specify + and complete this action See Also -------- @@ -21009,24 +28766,25 @@ def cuLinkCreate(unsigned int numOptions, options : Optional[List[CUjit_option]] optionValues = [] if optionValues is None else optionValues options = [] if options is None else options if not all(isinstance(_x, (CUjit_option)) for _x in options): - raise TypeError("Argument 'options' is not instance of type (expected List[ccuda.CUjit_option]") + raise TypeError("Argument 'options' is not instance of type (expected tuple[cydriver.CUjit_option] or list[cydriver.CUjit_option]") if numOptions > len(options): raise RuntimeError("List is too small: " + str(len(options)) + " < " + str(numOptions)) if numOptions > len(optionValues): raise RuntimeError("List is too small: " + str(len(optionValues)) + " < " + str(numOptions)) - cdef vector[ccuda.CUjit_option] coptions = [pyoptions.value for pyoptions in (options)] - pylist = [utils.HelperCUjit_option(pyoptions, pyoptionValues) for pyoptions, pyoptionValues in zip(options, optionValues)] - cdef utils.InputVoidPtrPtrHelper voidStarHelperoptionValues = utils.InputVoidPtrPtrHelper(pylist) + cdef vector[cydriver.CUjit_option] cyoptions = options + pylist = [_HelperCUjit_option(pyoptions, pyoptionValues) for pyoptions, pyoptionValues in zip(options, optionValues)] + cdef _InputVoidPtrPtrHelper voidStarHelperoptionValues = _InputVoidPtrPtrHelper(pylist) + cdef void** cyoptionValues_ptr = voidStarHelperoptionValues.cptr cdef CUlinkState stateOut = CUlinkState() - err = ccuda.cuLinkCreate(numOptions, coptions.data(), voidStarHelperoptionValues.cptr, stateOut._ptr) + with nogil: + err = cydriver.cuLinkCreate(numOptions, cyoptions.data(), cyoptionValues_ptr, stateOut._pvt_ptr) stateOut._keepalive.append(voidStarHelperoptionValues) for option in pylist: stateOut._keepalive.append(option) - return (CUresult(err), stateOut) -{{endif}} - -{{if 'cuLinkAddData_v2' in found_functions}} + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, stateOut) @cython.embedsignature(True) -def cuLinkAddData(state, typename not None : CUjitInputType, data, size_t size, char* name, unsigned int numOptions, options : Optional[List[CUjit_option]], optionValues : Optional[List[Any]]): +def cuLinkAddData(state, typename not None : CUjitInputType, data, size_t size, char* name, unsigned int numOptions, options : Optional[tuple[CUjit_option] | list[CUjit_option]], optionValues : Optional[tuple[Any] | list[Any]]): """ Add an input to a pending linker invocation. Ownership of `data` is retained by the caller. No reference is retained @@ -21052,10 +28810,10 @@ def cuLinkAddData(state, typename not None : CUjitInputType, data, size_t size, An optional name for this input in log messages. numOptions : unsigned int Size of options. - options : List[:py:obj:`~.CUjit_option`] + options : list[:py:obj:`~.CUjit_option`] Options to be applied only for this input (overrides options from :py:obj:`~.cuLinkCreate`). - optionValues : List[Any] + optionValues : list[Any] Array of option values, each cast to void *. Returns @@ -21074,32 +28832,31 @@ def cuLinkAddData(state, typename not None : CUjitInputType, data, size_t size, optionValues = [] if optionValues is None else optionValues options = [] if options is None else options if not all(isinstance(_x, (CUjit_option)) for _x in options): - raise TypeError("Argument 'options' is not instance of type (expected List[ccuda.CUjit_option]") - cdef ccuda.CUlinkState cstate + raise TypeError("Argument 'options' is not instance of type (expected tuple[cydriver.CUjit_option] or list[cydriver.CUjit_option]") + cdef cydriver.CUlinkState cystate if state is None: - cstate = 0 + pstate = 0 elif isinstance(state, (CUlinkState,)): pstate = int(state) - cstate = pstate else: pstate = int(CUlinkState(state)) - cstate = pstate - cdef ccuda.CUjitInputType ctypename = typename.value - cdata = utils.HelperInputVoidPtr(data) - cdef void* cdata_ptr = cdata.cptr + cystate = pstate + cdef cydriver.CUjitInputType cytypename = int(typename) + cdef _HelperInputVoidPtrStruct cydataHelper + cdef void* cydata = _helper_input_void_ptr(data, &cydataHelper) if numOptions > len(options): raise RuntimeError("List is too small: " + str(len(options)) + " < " + str(numOptions)) if numOptions > len(optionValues): raise RuntimeError("List is too small: " + str(len(optionValues)) + " < " + str(numOptions)) - cdef vector[ccuda.CUjit_option] coptions = [pyoptions.value for pyoptions in (options)] - pylist = [utils.HelperCUjit_option(pyoptions, pyoptionValues) for pyoptions, pyoptionValues in zip(options, optionValues)] - cdef utils.InputVoidPtrPtrHelper voidStarHelperoptionValues = utils.InputVoidPtrPtrHelper(pylist) - err = ccuda.cuLinkAddData(cstate, ctypename, cdata_ptr, size, name, numOptions, coptions.data(), voidStarHelperoptionValues.cptr) - return (CUresult(err),) -{{endif}} - -{{if 'cuLinkAddFile_v2' in found_functions}} + cdef vector[cydriver.CUjit_option] cyoptions = options + pylist = [_HelperCUjit_option(pyoptions, pyoptionValues) for pyoptions, pyoptionValues in zip(options, optionValues)] + cdef _InputVoidPtrPtrHelper voidStarHelperoptionValues = _InputVoidPtrPtrHelper(pylist) + cdef void** cyoptionValues_ptr = voidStarHelperoptionValues.cptr + with nogil: + err = cydriver.cuLinkAddData(cystate, cytypename, cydata, size, name, numOptions, cyoptions.data(), cyoptionValues_ptr) + _helper_input_void_ptr_free(&cydataHelper) + return (_CUresult(err),) @cython.embedsignature(True) -def cuLinkAddFile(state, typename not None : CUjitInputType, char* path, unsigned int numOptions, options : Optional[List[CUjit_option]], optionValues : Optional[List[Any]]): +def cuLinkAddFile(state, typename not None : CUjitInputType, char* path, unsigned int numOptions, options : Optional[tuple[CUjit_option] | list[CUjit_option]], optionValues : Optional[tuple[Any] | list[Any]]): """ Add a file input to a pending linker invocation. No reference is retained to any inputs after this call returns. @@ -21123,10 +28880,10 @@ def cuLinkAddFile(state, typename not None : CUjitInputType, char* path, unsigne Path to the input file numOptions : unsigned int Size of options - options : List[:py:obj:`~.CUjit_option`] + options : list[:py:obj:`~.CUjit_option`] Options to be applied only for this input (overrides options from :py:obj:`~.cuLinkCreate`) - optionValues : List[Any] + optionValues : list[Any] Array of option values, each cast to void * Returns @@ -21145,27 +28902,25 @@ def cuLinkAddFile(state, typename not None : CUjitInputType, char* path, unsigne optionValues = [] if optionValues is None else optionValues options = [] if options is None else options if not all(isinstance(_x, (CUjit_option)) for _x in options): - raise TypeError("Argument 'options' is not instance of type (expected List[ccuda.CUjit_option]") - cdef ccuda.CUlinkState cstate + raise TypeError("Argument 'options' is not instance of type (expected tuple[cydriver.CUjit_option] or list[cydriver.CUjit_option]") + cdef cydriver.CUlinkState cystate if state is None: - cstate = 0 + pstate = 0 elif isinstance(state, (CUlinkState,)): pstate = int(state) - cstate = pstate else: pstate = int(CUlinkState(state)) - cstate = pstate - cdef ccuda.CUjitInputType ctypename = typename.value + cystate = pstate + cdef cydriver.CUjitInputType cytypename = int(typename) if numOptions > len(options): raise RuntimeError("List is too small: " + str(len(options)) + " < " + str(numOptions)) if numOptions > len(optionValues): raise RuntimeError("List is too small: " + str(len(optionValues)) + " < " + str(numOptions)) - cdef vector[ccuda.CUjit_option] coptions = [pyoptions.value for pyoptions in (options)] - pylist = [utils.HelperCUjit_option(pyoptions, pyoptionValues) for pyoptions, pyoptionValues in zip(options, optionValues)] - cdef utils.InputVoidPtrPtrHelper voidStarHelperoptionValues = utils.InputVoidPtrPtrHelper(pylist) - err = ccuda.cuLinkAddFile(cstate, ctypename, path, numOptions, coptions.data(), voidStarHelperoptionValues.cptr) - return (CUresult(err),) -{{endif}} - -{{if 'cuLinkComplete' in found_functions}} + cdef vector[cydriver.CUjit_option] cyoptions = options + pylist = [_HelperCUjit_option(pyoptions, pyoptionValues) for pyoptions, pyoptionValues in zip(options, optionValues)] + cdef _InputVoidPtrPtrHelper voidStarHelperoptionValues = _InputVoidPtrPtrHelper(pylist) + cdef void** cyoptionValues_ptr = voidStarHelperoptionValues.cptr + with nogil: + err = cydriver.cuLinkAddFile(cystate, cytypename, path, numOptions, cyoptions.data(), cyoptionValues_ptr) + return (_CUresult(err),) @cython.embedsignature(True) def cuLinkComplete(state): @@ -21195,22 +28950,21 @@ def cuLinkComplete(state): -------- :py:obj:`~.cuLinkCreate`, :py:obj:`~.cuLinkAddData`, :py:obj:`~.cuLinkAddFile`, :py:obj:`~.cuLinkDestroy`, :py:obj:`~.cuModuleLoadData` """ - cdef ccuda.CUlinkState cstate + cdef cydriver.CUlinkState cystate if state is None: - cstate = 0 + pstate = 0 elif isinstance(state, (CUlinkState,)): pstate = int(state) - cstate = pstate else: pstate = int(CUlinkState(state)) - cstate = pstate + cystate = pstate cdef void_ptr cubinOut = 0 cdef size_t sizeOut = 0 - err = ccuda.cuLinkComplete(cstate, &cubinOut, &sizeOut) - return (CUresult(err), cubinOut, sizeOut) -{{endif}} - -{{if 'cuLinkDestroy' in found_functions}} + with nogil: + err = cydriver.cuLinkComplete(cystate, &cubinOut, &sizeOut) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None, None) + return (_CUresult_SUCCESS, cubinOut, sizeOut) @cython.embedsignature(True) def cuLinkDestroy(state): @@ -21230,20 +28984,17 @@ def cuLinkDestroy(state): -------- :py:obj:`~.cuLinkCreate` """ - cdef ccuda.CUlinkState cstate + cdef cydriver.CUlinkState cystate if state is None: - cstate = 0 + pstate = 0 elif isinstance(state, (CUlinkState,)): pstate = int(state) - cstate = pstate else: pstate = int(CUlinkState(state)) - cstate = pstate - err = ccuda.cuLinkDestroy(cstate) - return (CUresult(err),) -{{endif}} - -{{if 'cuModuleGetTexRef' in found_functions}} + cystate = pstate + with nogil: + err = cydriver.cuLinkDestroy(cystate) + return (_CUresult(err),) @cython.embedsignature(True) def cuModuleGetTexRef(hmod, char* name): @@ -21276,21 +29027,20 @@ def cuModuleGetTexRef(hmod, char* name): -------- :py:obj:`~.cuModuleGetFunction`, :py:obj:`~.cuModuleGetGlobal`, :py:obj:`~.cuModuleGetSurfRef`, :py:obj:`~.cuModuleLoad`, :py:obj:`~.cuModuleLoadData`, :py:obj:`~.cuModuleLoadDataEx`, :py:obj:`~.cuModuleLoadFatBinary`, :py:obj:`~.cuModuleUnload` """ - cdef ccuda.CUmodule chmod + cdef cydriver.CUmodule cyhmod if hmod is None: - chmod = 0 + phmod = 0 elif isinstance(hmod, (CUmodule,)): phmod = int(hmod) - chmod = phmod else: phmod = int(CUmodule(hmod)) - chmod = phmod + cyhmod = phmod cdef CUtexref pTexRef = CUtexref() - err = ccuda.cuModuleGetTexRef(pTexRef._ptr, chmod, name) - return (CUresult(err), pTexRef) -{{endif}} - -{{if 'cuModuleGetSurfRef' in found_functions}} + with nogil: + err = cydriver.cuModuleGetTexRef(pTexRef._pvt_ptr, cyhmod, name) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pTexRef) @cython.embedsignature(True) def cuModuleGetSurfRef(hmod, char* name): @@ -21321,24 +29071,23 @@ def cuModuleGetSurfRef(hmod, char* name): -------- :py:obj:`~.cuModuleGetFunction`, :py:obj:`~.cuModuleGetGlobal`, :py:obj:`~.cuModuleGetTexRef`, :py:obj:`~.cuModuleLoad`, :py:obj:`~.cuModuleLoadData`, :py:obj:`~.cuModuleLoadDataEx`, :py:obj:`~.cuModuleLoadFatBinary`, :py:obj:`~.cuModuleUnload` """ - cdef ccuda.CUmodule chmod + cdef cydriver.CUmodule cyhmod if hmod is None: - chmod = 0 + phmod = 0 elif isinstance(hmod, (CUmodule,)): phmod = int(hmod) - chmod = phmod else: phmod = int(CUmodule(hmod)) - chmod = phmod + cyhmod = phmod cdef CUsurfref pSurfRef = CUsurfref() - err = ccuda.cuModuleGetSurfRef(pSurfRef._ptr, chmod, name) - return (CUresult(err), pSurfRef) -{{endif}} - -{{if 'cuLibraryLoadData' in found_functions}} + with nogil: + err = cydriver.cuModuleGetSurfRef(pSurfRef._pvt_ptr, cyhmod, name) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pSurfRef) @cython.embedsignature(True) -def cuLibraryLoadData(code, jitOptions : Optional[List[CUjit_option]], jitOptionsValues : Optional[List[Any]], unsigned int numJitOptions, libraryOptions : Optional[List[CUlibraryOption]], libraryOptionValues : Optional[List[Any]], unsigned int numLibraryOptions): +def cuLibraryLoadData(code, jitOptions : Optional[tuple[CUjit_option] | list[CUjit_option]], jitOptionsValues : Optional[tuple[Any] | list[Any]], unsigned int numJitOptions, libraryOptions : Optional[tuple[CUlibraryOption] | list[CUlibraryOption]], libraryOptionValues : Optional[tuple[Any] | list[Any]], unsigned int numLibraryOptions): """ Load a library with specified code and options. Takes a pointer `code` and loads the corresponding library `library` @@ -21358,7 +29107,9 @@ def cuLibraryLoadData(code, jitOptions : Optional[List[CUjit_option]], jitOption under the "CUDA environment variables" section. The `code` may be a `cubin` or `fatbin` as output by nvcc, or a NULL- - terminated `PTX`, either as output by nvcc or hand-written. + terminated `PTX`, either as output by nvcc or hand-written, or `Tile` + IR data. A fatbin should also contain relocatable code when doing + separate compilation. Options are passed as an array via `jitOptions` and any corresponding parameters are passed in `jitOptionsValues`. The number of total JIT @@ -21374,15 +29125,15 @@ def cuLibraryLoadData(code, jitOptions : Optional[List[CUjit_option]], jitOption ---------- code : Any Code to load - jitOptions : List[:py:obj:`~.CUjit_option`] + jitOptions : list[:py:obj:`~.CUjit_option`] Options for JIT - jitOptionsValues : List[Any] + jitOptionsValues : list[Any] Option values for JIT numJitOptions : unsigned int Number of options - libraryOptions : List[:py:obj:`~.CUlibraryOption`] + libraryOptions : list[:py:obj:`~.CUlibraryOption`] Options for loading - libraryOptionValues : List[Any] + libraryOptionValues : list[Any] Option values for loading numLibraryOptions : unsigned int Number of options for loading @@ -21405,32 +29156,35 @@ def cuLibraryLoadData(code, jitOptions : Optional[List[CUjit_option]], jitOption libraryOptionValues = [] if libraryOptionValues is None else libraryOptionValues libraryOptions = [] if libraryOptions is None else libraryOptions if not all(isinstance(_x, (CUlibraryOption)) for _x in libraryOptions): - raise TypeError("Argument 'libraryOptions' is not instance of type (expected List[ccuda.CUlibraryOption]") + raise TypeError("Argument 'libraryOptions' is not instance of type (expected tuple[cydriver.CUlibraryOption] or list[cydriver.CUlibraryOption]") jitOptionsValues = [] if jitOptionsValues is None else jitOptionsValues jitOptions = [] if jitOptions is None else jitOptions if not all(isinstance(_x, (CUjit_option)) for _x in jitOptions): - raise TypeError("Argument 'jitOptions' is not instance of type (expected List[ccuda.CUjit_option]") + raise TypeError("Argument 'jitOptions' is not instance of type (expected tuple[cydriver.CUjit_option] or list[cydriver.CUjit_option]") cdef CUlibrary library = CUlibrary() - ccode = utils.HelperInputVoidPtr(code) - cdef void* ccode_ptr = ccode.cptr - cdef vector[ccuda.CUjit_option] cjitOptions = [pyjitOptions.value for pyjitOptions in (jitOptions)] - pylist = [utils.HelperCUjit_option(pyoptions, pyoptionValues) for pyoptions, pyoptionValues in zip(numJitOptions, jitOptionsValues)] - cdef utils.InputVoidPtrPtrHelper voidStarHelperjitOptionsValues = utils.InputVoidPtrPtrHelper(pylist) + cdef _HelperInputVoidPtrStruct cycodeHelper + cdef void* cycode = _helper_input_void_ptr(code, &cycodeHelper) + cdef vector[cydriver.CUjit_option] cyjitOptions = jitOptions + pylist = [_HelperCUjit_option(pyoptions, pyoptionValues) for pyoptions, pyoptionValues in zip(jitOptions, jitOptionsValues)] + cdef _InputVoidPtrPtrHelper voidStarHelperjitOptionsValues = _InputVoidPtrPtrHelper(pylist) + cdef void** cyjitOptionsValues_ptr = voidStarHelperjitOptionsValues.cptr if numJitOptions > len(jitOptions): raise RuntimeError("List is too small: " + str(len(jitOptions)) + " < " + str(numJitOptions)) if numJitOptions > len(jitOptionsValues): raise RuntimeError("List is too small: " + str(len(jitOptionsValues)) + " < " + str(numJitOptions)) - cdef vector[ccuda.CUlibraryOption] clibraryOptions = [pylibraryOptions.value for pylibraryOptions in (libraryOptions)] - pylist = [utils.HelperCUlibraryOption(pyoptions, pyoptionValues) for pyoptions, pyoptionValues in zip(numLibraryOptions, libraryOptionValues)] - cdef utils.InputVoidPtrPtrHelper voidStarHelperlibraryOptionValues = utils.InputVoidPtrPtrHelper(pylist) + cdef vector[cydriver.CUlibraryOption] cylibraryOptions = libraryOptions + pylist = [_HelperCUlibraryOption(pyoptions, pyoptionValues) for pyoptions, pyoptionValues in zip(libraryOptions, libraryOptionValues)] + cdef _InputVoidPtrPtrHelper voidStarHelperlibraryOptionValues = _InputVoidPtrPtrHelper(pylist) + cdef void** cylibraryOptionValues_ptr = voidStarHelperlibraryOptionValues.cptr if numLibraryOptions > len(libraryOptions): raise RuntimeError("List is too small: " + str(len(libraryOptions)) + " < " + str(numLibraryOptions)) if numLibraryOptions > len(libraryOptionValues): raise RuntimeError("List is too small: " + str(len(libraryOptionValues)) + " < " + str(numLibraryOptions)) - err = ccuda.cuLibraryLoadData(library._ptr, ccode_ptr, cjitOptions.data(), voidStarHelperjitOptionsValues.cptr, numJitOptions, clibraryOptions.data(), voidStarHelperlibraryOptionValues.cptr, numLibraryOptions) - return (CUresult(err), library) -{{endif}} - -{{if 'cuLibraryLoadFromFile' in found_functions}} + with nogil: + err = cydriver.cuLibraryLoadData(library._pvt_ptr, cycode, cyjitOptions.data(), cyjitOptionsValues_ptr, numJitOptions, cylibraryOptions.data(), cylibraryOptionValues_ptr, numLibraryOptions) + _helper_input_void_ptr_free(&cycodeHelper) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, library) @cython.embedsignature(True) -def cuLibraryLoadFromFile(char* fileName, jitOptions : Optional[List[CUjit_option]], jitOptionsValues : Optional[List[Any]], unsigned int numJitOptions, libraryOptions : Optional[List[CUlibraryOption]], libraryOptionValues : Optional[List[Any]], unsigned int numLibraryOptions): +def cuLibraryLoadFromFile(char* fileName, jitOptions : Optional[tuple[CUjit_option] | list[CUjit_option]], jitOptionsValues : Optional[tuple[Any] | list[Any]], unsigned int numJitOptions, libraryOptions : Optional[tuple[CUlibraryOption] | list[CUlibraryOption]], libraryOptionValues : Optional[tuple[Any] | list[Any]], unsigned int numLibraryOptions): """ Load a library with specified file and options. Takes a pointer `code` and loads the corresponding library `library` @@ -21451,7 +29205,8 @@ def cuLibraryLoadFromFile(char* fileName, jitOptions : Optional[List[CUjit_optio The file should be a `cubin` file as output by nvcc, or a `PTX` file either as output by nvcc or handwritten, or a `fatbin` file as output - by nvcc. + by nvcc or hand-written, or `Tile` IR file. A fatbin should also + contain relocatable code when doing separate compilation. Options are passed as an array via `jitOptions` and any corresponding parameters are passed in `jitOptionsValues`. The number of total @@ -21467,15 +29222,15 @@ def cuLibraryLoadFromFile(char* fileName, jitOptions : Optional[List[CUjit_optio ---------- fileName : bytes File to load from - jitOptions : List[:py:obj:`~.CUjit_option`] + jitOptions : list[:py:obj:`~.CUjit_option`] Options for JIT - jitOptionsValues : List[Any] + jitOptionsValues : list[Any] Option values for JIT numJitOptions : unsigned int Number of options - libraryOptions : List[:py:obj:`~.CUlibraryOption`] + libraryOptions : list[:py:obj:`~.CUlibraryOption`] Options for loading - libraryOptionValues : List[Any] + libraryOptionValues : list[Any] Option values for loading numLibraryOptions : unsigned int Number of options for loading @@ -21498,27 +29253,29 @@ def cuLibraryLoadFromFile(char* fileName, jitOptions : Optional[List[CUjit_optio libraryOptionValues = [] if libraryOptionValues is None else libraryOptionValues libraryOptions = [] if libraryOptions is None else libraryOptions if not all(isinstance(_x, (CUlibraryOption)) for _x in libraryOptions): - raise TypeError("Argument 'libraryOptions' is not instance of type (expected List[ccuda.CUlibraryOption]") + raise TypeError("Argument 'libraryOptions' is not instance of type (expected tuple[cydriver.CUlibraryOption] or list[cydriver.CUlibraryOption]") jitOptionsValues = [] if jitOptionsValues is None else jitOptionsValues jitOptions = [] if jitOptions is None else jitOptions if not all(isinstance(_x, (CUjit_option)) for _x in jitOptions): - raise TypeError("Argument 'jitOptions' is not instance of type (expected List[ccuda.CUjit_option]") + raise TypeError("Argument 'jitOptions' is not instance of type (expected tuple[cydriver.CUjit_option] or list[cydriver.CUjit_option]") cdef CUlibrary library = CUlibrary() - cdef vector[ccuda.CUjit_option] cjitOptions = [pyjitOptions.value for pyjitOptions in (jitOptions)] - pylist = [utils.HelperCUjit_option(pyoptions, pyoptionValues) for pyoptions, pyoptionValues in zip(numJitOptions, jitOptionsValues)] - cdef utils.InputVoidPtrPtrHelper voidStarHelperjitOptionsValues = utils.InputVoidPtrPtrHelper(pylist) + cdef vector[cydriver.CUjit_option] cyjitOptions = jitOptions + pylist = [_HelperCUjit_option(pyoptions, pyoptionValues) for pyoptions, pyoptionValues in zip(jitOptions, jitOptionsValues)] + cdef _InputVoidPtrPtrHelper voidStarHelperjitOptionsValues = _InputVoidPtrPtrHelper(pylist) + cdef void** cyjitOptionsValues_ptr = voidStarHelperjitOptionsValues.cptr if numJitOptions > len(jitOptions): raise RuntimeError("List is too small: " + str(len(jitOptions)) + " < " + str(numJitOptions)) if numJitOptions > len(jitOptionsValues): raise RuntimeError("List is too small: " + str(len(jitOptionsValues)) + " < " + str(numJitOptions)) - cdef vector[ccuda.CUlibraryOption] clibraryOptions = [pylibraryOptions.value for pylibraryOptions in (libraryOptions)] - pylist = [utils.HelperCUlibraryOption(pyoptions, pyoptionValues) for pyoptions, pyoptionValues in zip(numLibraryOptions, libraryOptionValues)] - cdef utils.InputVoidPtrPtrHelper voidStarHelperlibraryOptionValues = utils.InputVoidPtrPtrHelper(pylist) + cdef vector[cydriver.CUlibraryOption] cylibraryOptions = libraryOptions + pylist = [_HelperCUlibraryOption(pyoptions, pyoptionValues) for pyoptions, pyoptionValues in zip(libraryOptions, libraryOptionValues)] + cdef _InputVoidPtrPtrHelper voidStarHelperlibraryOptionValues = _InputVoidPtrPtrHelper(pylist) + cdef void** cylibraryOptionValues_ptr = voidStarHelperlibraryOptionValues.cptr if numLibraryOptions > len(libraryOptions): raise RuntimeError("List is too small: " + str(len(libraryOptions)) + " < " + str(numLibraryOptions)) if numLibraryOptions > len(libraryOptionValues): raise RuntimeError("List is too small: " + str(len(libraryOptionValues)) + " < " + str(numLibraryOptions)) - err = ccuda.cuLibraryLoadFromFile(library._ptr, fileName, cjitOptions.data(), voidStarHelperjitOptionsValues.cptr, numJitOptions, clibraryOptions.data(), voidStarHelperlibraryOptionValues.cptr, numLibraryOptions) - return (CUresult(err), library) -{{endif}} - -{{if 'cuLibraryUnload' in found_functions}} + with nogil: + err = cydriver.cuLibraryLoadFromFile(library._pvt_ptr, fileName, cyjitOptions.data(), cyjitOptionsValues_ptr, numJitOptions, cylibraryOptions.data(), cylibraryOptionValues_ptr, numLibraryOptions) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, library) @cython.embedsignature(True) def cuLibraryUnload(library): @@ -21540,20 +29297,17 @@ def cuLibraryUnload(library): -------- :py:obj:`~.cuLibraryLoadData`, :py:obj:`~.cuLibraryLoadFromFile`, :py:obj:`~.cuModuleUnload` """ - cdef ccuda.CUlibrary clibrary + cdef cydriver.CUlibrary cylibrary if library is None: - clibrary = 0 + plibrary = 0 elif isinstance(library, (CUlibrary,)): plibrary = int(library) - clibrary = plibrary else: plibrary = int(CUlibrary(library)) - clibrary = plibrary - err = ccuda.cuLibraryUnload(clibrary) - return (CUresult(err),) -{{endif}} - -{{if 'cuLibraryGetKernel' in found_functions}} + cylibrary = plibrary + with nogil: + err = cydriver.cuLibraryUnload(cylibrary) + return (_CUresult(err),) @cython.embedsignature(True) def cuLibraryGetKernel(library, char* name): @@ -21581,21 +29335,20 @@ def cuLibraryGetKernel(library, char* name): -------- :py:obj:`~.cuLibraryLoadData`, :py:obj:`~.cuLibraryLoadFromFile`, :py:obj:`~.cuLibraryUnload`, :py:obj:`~.cuKernelGetFunction`, :py:obj:`~.cuLibraryGetModule`, :py:obj:`~.cuModuleGetFunction` """ - cdef ccuda.CUlibrary clibrary + cdef cydriver.CUlibrary cylibrary if library is None: - clibrary = 0 + plibrary = 0 elif isinstance(library, (CUlibrary,)): plibrary = int(library) - clibrary = plibrary else: plibrary = int(CUlibrary(library)) - clibrary = plibrary + cylibrary = plibrary cdef CUkernel pKernel = CUkernel() - err = ccuda.cuLibraryGetKernel(pKernel._ptr, clibrary, name) - return (CUresult(err), pKernel) -{{endif}} - -{{if 'cuLibraryGetKernelCount' in found_functions}} + with nogil: + err = cydriver.cuLibraryGetKernel(pKernel._pvt_ptr, cylibrary, name) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pKernel) @cython.embedsignature(True) def cuLibraryGetKernelCount(lib): @@ -21615,21 +29368,20 @@ def cuLibraryGetKernelCount(lib): count : unsigned int Number of kernels found within the library """ - cdef ccuda.CUlibrary clib + cdef cydriver.CUlibrary cylib if lib is None: - clib = 0 + plib = 0 elif isinstance(lib, (CUlibrary,)): plib = int(lib) - clib = plib else: plib = int(CUlibrary(lib)) - clib = plib + cylib = plib cdef unsigned int count = 0 - err = ccuda.cuLibraryGetKernelCount(&count, clib) - return (CUresult(err), count) -{{endif}} - -{{if 'cuLibraryEnumerateKernels' in found_functions}} + with nogil: + err = cydriver.cuLibraryGetKernelCount(&count, cylib) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, count) @cython.embedsignature(True) def cuLibraryEnumerateKernels(unsigned int numKernels, lib): @@ -21650,37 +29402,36 @@ def cuLibraryEnumerateKernels(unsigned int numKernels, lib): ------- CUresult :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_INVALID_HANDLE`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE` - kernels : List[:py:obj:`~.CUkernel`] + kernels : list[:py:obj:`~.CUkernel`] Buffer where the kernel handles are returned to See Also -------- :py:obj:`~.cuLibraryGetKernelCount` """ - cdef ccuda.CUlibrary clib + cdef cydriver.CUlibrary cylib if lib is None: - clib = 0 + plib = 0 elif isinstance(lib, (CUlibrary,)): plib = int(lib) - clib = plib else: plib = int(CUlibrary(lib)) - clib = plib - cdef ccuda.CUkernel* ckernels = NULL + cylib = plib + cdef cydriver.CUkernel* cykernels = NULL pykernels = [] if numKernels != 0: - ckernels = calloc(numKernels, sizeof(ccuda.CUkernel)) - if ckernels is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(numKernels) + 'x' + str(sizeof(ccuda.CUkernel))) - err = ccuda.cuLibraryEnumerateKernels(ckernels, numKernels, clib) + cykernels = calloc(numKernels, sizeof(cydriver.CUkernel)) + if cykernels is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(numKernels) + 'x' + str(sizeof(cydriver.CUkernel))) + with nogil: + err = cydriver.cuLibraryEnumerateKernels(cykernels, numKernels, cylib) if CUresult(err) == CUresult(0): - pykernels = [CUkernel(init_value=ckernels[idx]) for idx in range(numKernels)] - if ckernels is not NULL: - free(ckernels) - return (CUresult(err), pykernels) -{{endif}} - -{{if 'cuLibraryGetModule' in found_functions}} + pykernels = [CUkernel(init_value=cykernels[idx]) for idx in range(numKernels)] + if cykernels is not NULL: + free(cykernels) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pykernels) @cython.embedsignature(True) def cuLibraryGetModule(library): @@ -21706,21 +29457,20 @@ def cuLibraryGetModule(library): -------- :py:obj:`~.cuLibraryLoadData`, :py:obj:`~.cuLibraryLoadFromFile`, :py:obj:`~.cuLibraryUnload`, :py:obj:`~.cuModuleGetFunction` """ - cdef ccuda.CUlibrary clibrary + cdef cydriver.CUlibrary cylibrary if library is None: - clibrary = 0 + plibrary = 0 elif isinstance(library, (CUlibrary,)): plibrary = int(library) - clibrary = plibrary else: plibrary = int(CUlibrary(library)) - clibrary = plibrary + cylibrary = plibrary cdef CUmodule pMod = CUmodule() - err = ccuda.cuLibraryGetModule(pMod._ptr, clibrary) - return (CUresult(err), pMod) -{{endif}} - -{{if 'cuKernelGetFunction' in found_functions}} + with nogil: + err = cydriver.cuLibraryGetModule(pMod._pvt_ptr, cylibrary) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pMod) @cython.embedsignature(True) def cuKernelGetFunction(kernel): @@ -21746,21 +29496,20 @@ def cuKernelGetFunction(kernel): -------- :py:obj:`~.cuLibraryLoadData`, :py:obj:`~.cuLibraryLoadFromFile`, :py:obj:`~.cuLibraryUnload`, :py:obj:`~.cuLibraryGetKernel`, :py:obj:`~.cuLibraryGetModule`, :py:obj:`~.cuModuleGetFunction` """ - cdef ccuda.CUkernel ckernel + cdef cydriver.CUkernel cykernel if kernel is None: - ckernel = 0 + pkernel = 0 elif isinstance(kernel, (CUkernel,)): pkernel = int(kernel) - ckernel = pkernel else: pkernel = int(CUkernel(kernel)) - ckernel = pkernel + cykernel = pkernel cdef CUfunction pFunc = CUfunction() - err = ccuda.cuKernelGetFunction(pFunc._ptr, ckernel) - return (CUresult(err), pFunc) -{{endif}} - -{{if 'cuKernelGetLibrary' in found_functions}} + with nogil: + err = cydriver.cuKernelGetFunction(pFunc._pvt_ptr, cykernel) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pFunc) @cython.embedsignature(True) def cuKernelGetLibrary(kernel): @@ -21785,21 +29534,20 @@ def cuKernelGetLibrary(kernel): -------- :py:obj:`~.cuLibraryLoadData`, :py:obj:`~.cuLibraryLoadFromFile`, :py:obj:`~.cuLibraryUnload`, :py:obj:`~.cuLibraryGetKernel` """ - cdef ccuda.CUkernel ckernel + cdef cydriver.CUkernel cykernel if kernel is None: - ckernel = 0 + pkernel = 0 elif isinstance(kernel, (CUkernel,)): pkernel = int(kernel) - ckernel = pkernel else: pkernel = int(CUkernel(kernel)) - ckernel = pkernel + cykernel = pkernel cdef CUlibrary pLib = CUlibrary() - err = ccuda.cuKernelGetLibrary(pLib._ptr, ckernel) - return (CUresult(err), pLib) -{{endif}} - -{{if 'cuLibraryGetGlobal' in found_functions}} + with nogil: + err = cydriver.cuKernelGetLibrary(pLib._pvt_ptr, cykernel) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pLib) @cython.embedsignature(True) def cuLibraryGetGlobal(library, char* name): @@ -21831,22 +29579,21 @@ def cuLibraryGetGlobal(library, char* name): -------- :py:obj:`~.cuLibraryLoadData`, :py:obj:`~.cuLibraryLoadFromFile`, :py:obj:`~.cuLibraryUnload`, :py:obj:`~.cuLibraryGetModule`, :py:obj:`~.cuModuleGetGlobal` """ - cdef ccuda.CUlibrary clibrary + cdef cydriver.CUlibrary cylibrary if library is None: - clibrary = 0 + plibrary = 0 elif isinstance(library, (CUlibrary,)): plibrary = int(library) - clibrary = plibrary else: plibrary = int(CUlibrary(library)) - clibrary = plibrary + cylibrary = plibrary cdef CUdeviceptr dptr = CUdeviceptr() cdef size_t numbytes = 0 - err = ccuda.cuLibraryGetGlobal(dptr._ptr, &numbytes, clibrary, name) - return (CUresult(err), dptr, numbytes) -{{endif}} - -{{if 'cuLibraryGetManaged' in found_functions}} + with nogil: + err = cydriver.cuLibraryGetGlobal(dptr._pvt_ptr, &numbytes, cylibrary, name) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None, None) + return (_CUresult_SUCCESS, dptr, numbytes) @cython.embedsignature(True) def cuLibraryGetManaged(library, char* name): @@ -21880,22 +29627,21 @@ def cuLibraryGetManaged(library, char* name): -------- :py:obj:`~.cuLibraryLoadData`, :py:obj:`~.cuLibraryLoadFromFile`, :py:obj:`~.cuLibraryUnload` """ - cdef ccuda.CUlibrary clibrary + cdef cydriver.CUlibrary cylibrary if library is None: - clibrary = 0 + plibrary = 0 elif isinstance(library, (CUlibrary,)): plibrary = int(library) - clibrary = plibrary else: plibrary = int(CUlibrary(library)) - clibrary = plibrary + cylibrary = plibrary cdef CUdeviceptr dptr = CUdeviceptr() cdef size_t numbytes = 0 - err = ccuda.cuLibraryGetManaged(dptr._ptr, &numbytes, clibrary, name) - return (CUresult(err), dptr, numbytes) -{{endif}} - -{{if 'cuLibraryGetUnifiedFunction' in found_functions}} + with nogil: + err = cydriver.cuLibraryGetManaged(dptr._pvt_ptr, &numbytes, cylibrary, name) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None, None) + return (_CUresult_SUCCESS, dptr, numbytes) @cython.embedsignature(True) def cuLibraryGetUnifiedFunction(library, char* symbol): @@ -21926,21 +29672,20 @@ def cuLibraryGetUnifiedFunction(library, char* symbol): -------- :py:obj:`~.cuLibraryLoadData`, :py:obj:`~.cuLibraryLoadFromFile`, :py:obj:`~.cuLibraryUnload` """ - cdef ccuda.CUlibrary clibrary + cdef cydriver.CUlibrary cylibrary if library is None: - clibrary = 0 + plibrary = 0 elif isinstance(library, (CUlibrary,)): plibrary = int(library) - clibrary = plibrary else: plibrary = int(CUlibrary(library)) - clibrary = plibrary + cylibrary = plibrary cdef void_ptr fptr = 0 - err = ccuda.cuLibraryGetUnifiedFunction(&fptr, clibrary, symbol) - return (CUresult(err), fptr) -{{endif}} - -{{if 'cuKernelGetAttribute' in found_functions}} + with nogil: + err = cydriver.cuLibraryGetUnifiedFunction(&fptr, cylibrary, symbol) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, fptr) @cython.embedsignature(True) def cuKernelGetAttribute(attrib not None : CUfunction_attribute, kernel, dev): @@ -22024,7 +29769,7 @@ def cuKernelGetAttribute(attrib not None : CUfunction_attribute, kernel, dev): - :py:obj:`~.CU_FUNC_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE`: The block scheduling policy of a function. The value type is - CUclusterSchedulingPolicy. + :py:obj:`~.CUclusterSchedulingPolicy`. Parameters ---------- @@ -22050,31 +29795,29 @@ def cuKernelGetAttribute(attrib not None : CUfunction_attribute, kernel, dev): ----- If another thread is trying to set the same attribute on the same device using :py:obj:`~.cuKernelSetAttribute()` simultaneously, the attribute query will give the old or new value depending on the interleavings chosen by the OS scheduler and memory consistency. """ - cdef ccuda.CUdevice cdev + cdef cydriver.CUdevice cydev if dev is None: - cdev = 0 + pdev = 0 elif isinstance(dev, (CUdevice,)): pdev = int(dev) - cdev = pdev else: pdev = int(CUdevice(dev)) - cdev = pdev - cdef ccuda.CUkernel ckernel + cydev = pdev + cdef cydriver.CUkernel cykernel if kernel is None: - ckernel = 0 + pkernel = 0 elif isinstance(kernel, (CUkernel,)): pkernel = int(kernel) - ckernel = pkernel else: pkernel = int(CUkernel(kernel)) - ckernel = pkernel + cykernel = pkernel cdef int pi = 0 - cdef ccuda.CUfunction_attribute cattrib = attrib.value - err = ccuda.cuKernelGetAttribute(&pi, cattrib, ckernel, cdev) - return (CUresult(err), pi) -{{endif}} - -{{if 'cuKernelSetAttribute' in found_functions}} + cdef cydriver.CUfunction_attribute cyattrib = int(attrib) + with nogil: + err = cydriver.cuKernelGetAttribute(&pi, cyattrib, cykernel, cydev) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pi) @cython.embedsignature(True) def cuKernelSetAttribute(attrib not None : CUfunction_attribute, int val, kernel, dev): @@ -22141,7 +29884,7 @@ def cuKernelSetAttribute(attrib not None : CUfunction_attribute, int val, kernel - :py:obj:`~.CU_FUNC_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE`: The block scheduling policy of a function. The value type is - CUclusterSchedulingPolicy. + :py:obj:`~.CUclusterSchedulingPolicy`. Parameters ---------- @@ -22167,30 +29910,26 @@ def cuKernelSetAttribute(attrib not None : CUfunction_attribute, int val, kernel ----- The API has stricter locking requirements in comparison to its legacy counterpart :py:obj:`~.cuFuncSetAttribute()` due to device-wide semantics. If multiple threads are trying to set the same attribute on the same device simultaneously, the attribute setting will depend on the interleavings chosen by the OS scheduler and memory consistency. """ - cdef ccuda.CUdevice cdev + cdef cydriver.CUdevice cydev if dev is None: - cdev = 0 + pdev = 0 elif isinstance(dev, (CUdevice,)): pdev = int(dev) - cdev = pdev else: pdev = int(CUdevice(dev)) - cdev = pdev - cdef ccuda.CUkernel ckernel + cydev = pdev + cdef cydriver.CUkernel cykernel if kernel is None: - ckernel = 0 + pkernel = 0 elif isinstance(kernel, (CUkernel,)): pkernel = int(kernel) - ckernel = pkernel else: pkernel = int(CUkernel(kernel)) - ckernel = pkernel - cdef ccuda.CUfunction_attribute cattrib = attrib.value - err = ccuda.cuKernelSetAttribute(cattrib, val, ckernel, cdev) - return (CUresult(err),) -{{endif}} - -{{if 'cuKernelSetCacheConfig' in found_functions}} + cykernel = pkernel + cdef cydriver.CUfunction_attribute cyattrib = int(attrib) + with nogil: + err = cydriver.cuKernelSetAttribute(cyattrib, val, cykernel, cydev) + return (_CUresult(err),) @cython.embedsignature(True) def cuKernelSetCacheConfig(kernel, config not None : CUfunc_cache, dev): @@ -22252,30 +29991,26 @@ def cuKernelSetCacheConfig(kernel, config not None : CUfunc_cache, dev): ----- The API has stricter locking requirements in comparison to its legacy counterpart :py:obj:`~.cuFuncSetCacheConfig()` due to device-wide semantics. If multiple threads are trying to set a config on the same device simultaneously, the cache config setting will depend on the interleavings chosen by the OS scheduler and memory consistency. """ - cdef ccuda.CUdevice cdev + cdef cydriver.CUdevice cydev if dev is None: - cdev = 0 + pdev = 0 elif isinstance(dev, (CUdevice,)): pdev = int(dev) - cdev = pdev else: pdev = int(CUdevice(dev)) - cdev = pdev - cdef ccuda.CUkernel ckernel + cydev = pdev + cdef cydriver.CUkernel cykernel if kernel is None: - ckernel = 0 + pkernel = 0 elif isinstance(kernel, (CUkernel,)): pkernel = int(kernel) - ckernel = pkernel else: pkernel = int(CUkernel(kernel)) - ckernel = pkernel - cdef ccuda.CUfunc_cache cconfig = config.value - err = ccuda.cuKernelSetCacheConfig(ckernel, cconfig, cdev) - return (CUresult(err),) -{{endif}} - -{{if 'cuKernelGetName' in found_functions}} + cykernel = pkernel + cdef cydriver.CUfunc_cache cyconfig = int(config) + with nogil: + err = cydriver.cuKernelSetCacheConfig(cykernel, cyconfig, cydev) + return (_CUresult(err),) @cython.embedsignature(True) def cuKernelGetName(hfunc): @@ -22301,21 +30036,20 @@ def cuKernelGetName(hfunc): name : bytes The returned name of the function """ - cdef ccuda.CUkernel chfunc + cdef cydriver.CUkernel cyhfunc if hfunc is None: - chfunc = 0 + phfunc = 0 elif isinstance(hfunc, (CUkernel,)): phfunc = int(hfunc) - chfunc = phfunc else: phfunc = int(CUkernel(hfunc)) - chfunc = phfunc + cyhfunc = phfunc cdef const char* name = NULL - err = ccuda.cuKernelGetName(&name, chfunc) - return (CUresult(err), name) -{{endif}} - -{{if 'cuKernelGetParamInfo' in found_functions}} + with nogil: + err = cydriver.cuKernelGetName(&name, cyhfunc) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, name if name != NULL else None) @cython.embedsignature(True) def cuKernelGetParamInfo(kernel, size_t paramIndex): @@ -22353,22 +30087,59 @@ def cuKernelGetParamInfo(kernel, size_t paramIndex): -------- :py:obj:`~.cuFuncGetParamInfo` """ - cdef ccuda.CUkernel ckernel + cdef cydriver.CUkernel cykernel if kernel is None: - ckernel = 0 + pkernel = 0 elif isinstance(kernel, (CUkernel,)): pkernel = int(kernel) - ckernel = pkernel else: pkernel = int(CUkernel(kernel)) - ckernel = pkernel + cykernel = pkernel cdef size_t paramOffset = 0 cdef size_t paramSize = 0 - err = ccuda.cuKernelGetParamInfo(ckernel, paramIndex, ¶mOffset, ¶mSize) - return (CUresult(err), paramOffset, paramSize) -{{endif}} + with nogil: + err = cydriver.cuKernelGetParamInfo(cykernel, paramIndex, ¶mOffset, ¶mSize) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None, None) + return (_CUresult_SUCCESS, paramOffset, paramSize) + +@cython.embedsignature(True) +def cuKernelGetParamCount(kernel): + """ Returns the number of parameters used by the kernel. + + Queries the number of kernel parameters used by `kernel` and returns it + in `paramCount`. -{{if 'cuMemGetInfo_v2' in found_functions}} + Parameters + ---------- + kernel : :py:obj:`~.CUkernel` + The kernel to query + + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE` + paramCount : int + Returns the number of parameters used by the function + + See Also + -------- + :py:obj:`~.cuKernelGetParamInfo` + """ + cdef cydriver.CUkernel cykernel + if kernel is None: + pkernel = 0 + elif isinstance(kernel, (CUkernel,)): + pkernel = int(kernel) + else: + pkernel = int(CUkernel(kernel)) + cykernel = pkernel + cdef size_t paramCount = 0 + with nogil: + err = cydriver.cuKernelGetParamCount(cykernel, ¶mCount) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, paramCount) @cython.embedsignature(True) def cuMemGetInfo(): @@ -22406,11 +30177,11 @@ def cuMemGetInfo(): """ cdef size_t free = 0 cdef size_t total = 0 - err = ccuda.cuMemGetInfo(&free, &total) - return (CUresult(err), free, total) -{{endif}} - -{{if 'cuMemAlloc_v2' in found_functions}} + with nogil: + err = cydriver.cuMemGetInfo(&free, &total) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None, None) + return (_CUresult_SUCCESS, free, total) @cython.embedsignature(True) def cuMemAlloc(size_t bytesize): @@ -22430,7 +30201,7 @@ def cuMemAlloc(size_t bytesize): Returns ------- CUresult - :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_CONTEXT`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_OUT_OF_MEMORY` + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_CONTEXT`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_OUT_OF_MEMORY` :py:obj:`~.CUDA_ERROR_EXTERNAL_DEVICE` dptr : :py:obj:`~.CUdeviceptr` Returned device pointer @@ -22439,11 +30210,11 @@ def cuMemAlloc(size_t bytesize): :py:obj:`~.cuArray3DCreate`, :py:obj:`~.cuArray3DGetDescriptor`, :py:obj:`~.cuArrayCreate`, :py:obj:`~.cuArrayDestroy`, :py:obj:`~.cuArrayGetDescriptor`, :py:obj:`~.cuMemAllocHost`, :py:obj:`~.cuMemAllocPitch`, :py:obj:`~.cuMemcpy2D`, :py:obj:`~.cuMemcpy2DAsync`, :py:obj:`~.cuMemcpy2DUnaligned`, :py:obj:`~.cuMemcpy3D`, :py:obj:`~.cuMemcpy3DAsync`, :py:obj:`~.cuMemcpyAtoA`, :py:obj:`~.cuMemcpyAtoD`, :py:obj:`~.cuMemcpyAtoH`, :py:obj:`~.cuMemcpyAtoHAsync`, :py:obj:`~.cuMemcpyDtoA`, :py:obj:`~.cuMemcpyDtoD`, :py:obj:`~.cuMemcpyDtoDAsync`, :py:obj:`~.cuMemcpyDtoH`, :py:obj:`~.cuMemcpyDtoHAsync`, :py:obj:`~.cuMemcpyHtoA`, :py:obj:`~.cuMemcpyHtoAAsync`, :py:obj:`~.cuMemcpyHtoD`, :py:obj:`~.cuMemcpyHtoDAsync`, :py:obj:`~.cuMemFree`, :py:obj:`~.cuMemFreeHost`, :py:obj:`~.cuMemGetAddressRange`, :py:obj:`~.cuMemGetInfo`, :py:obj:`~.cuMemHostAlloc`, :py:obj:`~.cuMemHostGetDevicePointer`, :py:obj:`~.cuMemsetD2D8`, :py:obj:`~.cuMemsetD2D16`, :py:obj:`~.cuMemsetD2D32`, :py:obj:`~.cuMemsetD8`, :py:obj:`~.cuMemsetD16`, :py:obj:`~.cuMemsetD32`, :py:obj:`~.cudaMalloc` """ cdef CUdeviceptr dptr = CUdeviceptr() - err = ccuda.cuMemAlloc(dptr._ptr, bytesize) - return (CUresult(err), dptr) -{{endif}} - -{{if 'cuMemAllocPitch_v2' in found_functions}} + with nogil: + err = cydriver.cuMemAlloc(dptr._pvt_ptr, bytesize) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, dptr) @cython.embedsignature(True) def cuMemAllocPitch(size_t WidthInBytes, size_t Height, unsigned int ElementSizeBytes): @@ -22505,11 +30276,11 @@ def cuMemAllocPitch(size_t WidthInBytes, size_t Height, unsigned int ElementSize """ cdef CUdeviceptr dptr = CUdeviceptr() cdef size_t pPitch = 0 - err = ccuda.cuMemAllocPitch(dptr._ptr, &pPitch, WidthInBytes, Height, ElementSizeBytes) - return (CUresult(err), dptr, pPitch) -{{endif}} - -{{if 'cuMemFree_v2' in found_functions}} + with nogil: + err = cydriver.cuMemAllocPitch(dptr._pvt_ptr, &pPitch, WidthInBytes, Height, ElementSizeBytes) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None, None) + return (_CUresult_SUCCESS, dptr, pPitch) @cython.embedsignature(True) def cuMemFree(dptr): @@ -22524,10 +30295,11 @@ def cuMemFree(dptr): Note - This API will not perform any implict synchronization when the pointer was allocated with :py:obj:`~.cuMemAllocAsync` or :py:obj:`~.cuMemAllocFromPoolAsync`. Callers must ensure that all - accesses to the pointer have completed before invoking + accesses to these pointer have completed before invoking :py:obj:`~.cuMemFree`. For best performance and memory reuse, users should use :py:obj:`~.cuMemFreeAsync` to free memory allocated via the - stream ordered memory allocator. + stream ordered memory allocator. For all other pointers, this API may + perform implicit synchronization. Parameters ---------- @@ -22543,29 +30315,26 @@ def cuMemFree(dptr): -------- :py:obj:`~.cuArray3DCreate`, :py:obj:`~.cuArray3DGetDescriptor`, :py:obj:`~.cuArrayCreate`, :py:obj:`~.cuArrayDestroy`, :py:obj:`~.cuArrayGetDescriptor`, :py:obj:`~.cuMemAlloc`, :py:obj:`~.cuMemAllocHost`, :py:obj:`~.cuMemAllocPitch`, :py:obj:`~.cuMemAllocManaged`, :py:obj:`~.cuMemAllocAsync`, :py:obj:`~.cuMemAllocFromPoolAsync`, :py:obj:`~.cuMemcpy2D`, :py:obj:`~.cuMemcpy2DAsync`, :py:obj:`~.cuMemcpy2DUnaligned`, :py:obj:`~.cuMemcpy3D`, :py:obj:`~.cuMemcpy3DAsync`, :py:obj:`~.cuMemcpyAtoA`, :py:obj:`~.cuMemcpyAtoD`, :py:obj:`~.cuMemcpyAtoH`, :py:obj:`~.cuMemcpyAtoHAsync`, :py:obj:`~.cuMemcpyDtoA`, :py:obj:`~.cuMemcpyDtoD`, :py:obj:`~.cuMemcpyDtoDAsync`, :py:obj:`~.cuMemcpyDtoH`, :py:obj:`~.cuMemcpyDtoHAsync`, :py:obj:`~.cuMemcpyHtoA`, :py:obj:`~.cuMemcpyHtoAAsync`, :py:obj:`~.cuMemcpyHtoD`, :py:obj:`~.cuMemcpyHtoDAsync`, :py:obj:`~.cuMemFreeHost`, :py:obj:`~.cuMemGetAddressRange`, :py:obj:`~.cuMemGetInfo`, :py:obj:`~.cuMemHostAlloc`, :py:obj:`~.cuMemFreeAsync`, :py:obj:`~.cuMemHostGetDevicePointer`, :py:obj:`~.cuMemsetD2D8`, :py:obj:`~.cuMemsetD2D16`, :py:obj:`~.cuMemsetD2D32`, :py:obj:`~.cuMemsetD8`, :py:obj:`~.cuMemsetD16`, :py:obj:`~.cuMemsetD32`, :py:obj:`~.cudaFree` """ - cdef ccuda.CUdeviceptr cdptr + cdef cydriver.CUdeviceptr cydptr if dptr is None: - cdptr = 0 + pdptr = 0 elif isinstance(dptr, (CUdeviceptr,)): pdptr = int(dptr) - cdptr = pdptr else: pdptr = int(CUdeviceptr(dptr)) - cdptr = pdptr - err = ccuda.cuMemFree(cdptr) - return (CUresult(err),) -{{endif}} - -{{if 'cuMemGetAddressRange_v2' in found_functions}} + cydptr = pdptr + with nogil: + err = cydriver.cuMemFree(cydptr) + return (_CUresult(err),) @cython.embedsignature(True) def cuMemGetAddressRange(dptr): """ Get information on memory allocations. Returns the base address in `*pbase` and size in `*psize` of the - allocation by :py:obj:`~.cuMemAlloc()` or :py:obj:`~.cuMemAllocPitch()` - that contains the input pointer `dptr`. Both parameters `pbase` and - `psize` are optional. If one of them is NULL, it is ignored. + allocation that contains the input pointer `dptr`. Both parameters + `pbase` and `psize` are optional. If one of them is NULL, it is + ignored. Parameters ---------- @@ -22585,22 +30354,21 @@ def cuMemGetAddressRange(dptr): -------- :py:obj:`~.cuArray3DCreate`, :py:obj:`~.cuArray3DGetDescriptor`, :py:obj:`~.cuArrayCreate`, :py:obj:`~.cuArrayDestroy`, :py:obj:`~.cuArrayGetDescriptor`, :py:obj:`~.cuMemAlloc`, :py:obj:`~.cuMemAllocHost`, :py:obj:`~.cuMemAllocPitch`, :py:obj:`~.cuMemcpy2D`, :py:obj:`~.cuMemcpy2DAsync`, :py:obj:`~.cuMemcpy2DUnaligned`, :py:obj:`~.cuMemcpy3D`, :py:obj:`~.cuMemcpy3DAsync`, :py:obj:`~.cuMemcpyAtoA`, :py:obj:`~.cuMemcpyAtoD`, :py:obj:`~.cuMemcpyAtoH`, :py:obj:`~.cuMemcpyAtoHAsync`, :py:obj:`~.cuMemcpyDtoA`, :py:obj:`~.cuMemcpyDtoD`, :py:obj:`~.cuMemcpyDtoDAsync`, :py:obj:`~.cuMemcpyDtoH`, :py:obj:`~.cuMemcpyDtoHAsync`, :py:obj:`~.cuMemcpyHtoA`, :py:obj:`~.cuMemcpyHtoAAsync`, :py:obj:`~.cuMemcpyHtoD`, :py:obj:`~.cuMemcpyHtoDAsync`, :py:obj:`~.cuMemFree`, :py:obj:`~.cuMemFreeHost`, :py:obj:`~.cuMemGetInfo`, :py:obj:`~.cuMemHostAlloc`, :py:obj:`~.cuMemHostGetDevicePointer`, :py:obj:`~.cuMemsetD2D8`, :py:obj:`~.cuMemsetD2D16`, :py:obj:`~.cuMemsetD2D32`, :py:obj:`~.cuMemsetD8`, :py:obj:`~.cuMemsetD16`, :py:obj:`~.cuMemsetD32` """ - cdef ccuda.CUdeviceptr cdptr + cdef cydriver.CUdeviceptr cydptr if dptr is None: - cdptr = 0 + pdptr = 0 elif isinstance(dptr, (CUdeviceptr,)): pdptr = int(dptr) - cdptr = pdptr else: pdptr = int(CUdeviceptr(dptr)) - cdptr = pdptr + cydptr = pdptr cdef CUdeviceptr pbase = CUdeviceptr() cdef size_t psize = 0 - err = ccuda.cuMemGetAddressRange(pbase._ptr, &psize, cdptr) - return (CUresult(err), pbase, psize) -{{endif}} - -{{if 'cuMemAllocHost_v2' in found_functions}} + with nogil: + err = cydriver.cuMemGetAddressRange(pbase._pvt_ptr, &psize, cydptr) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None, None) + return (_CUresult_SUCCESS, pbase, psize) @cython.embedsignature(True) def cuMemAllocHost(size_t bytesize): @@ -22641,7 +30409,7 @@ def cuMemAllocHost(size_t bytesize): Returns ------- CUresult - :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_CONTEXT`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_OUT_OF_MEMORY` + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_CONTEXT`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_OUT_OF_MEMORY` :py:obj:`~.CUDA_ERROR_EXTERNAL_DEVICE` pp : Any Returned pointer to host memory @@ -22650,11 +30418,11 @@ def cuMemAllocHost(size_t bytesize): :py:obj:`~.cuArray3DCreate`, :py:obj:`~.cuArray3DGetDescriptor`, :py:obj:`~.cuArrayCreate`, :py:obj:`~.cuArrayDestroy`, :py:obj:`~.cuArrayGetDescriptor`, :py:obj:`~.cuMemAlloc`, :py:obj:`~.cuMemAllocPitch`, :py:obj:`~.cuMemcpy2D`, :py:obj:`~.cuMemcpy2DAsync`, :py:obj:`~.cuMemcpy2DUnaligned`, :py:obj:`~.cuMemcpy3D`, :py:obj:`~.cuMemcpy3DAsync`, :py:obj:`~.cuMemcpyAtoA`, :py:obj:`~.cuMemcpyAtoD`, :py:obj:`~.cuMemcpyAtoH`, :py:obj:`~.cuMemcpyAtoHAsync`, :py:obj:`~.cuMemcpyDtoA`, :py:obj:`~.cuMemcpyDtoD`, :py:obj:`~.cuMemcpyDtoDAsync`, :py:obj:`~.cuMemcpyDtoH`, :py:obj:`~.cuMemcpyDtoHAsync`, :py:obj:`~.cuMemcpyHtoA`, :py:obj:`~.cuMemcpyHtoAAsync`, :py:obj:`~.cuMemcpyHtoD`, :py:obj:`~.cuMemcpyHtoDAsync`, :py:obj:`~.cuMemFree`, :py:obj:`~.cuMemFreeHost`, :py:obj:`~.cuMemGetAddressRange`, :py:obj:`~.cuMemGetInfo`, :py:obj:`~.cuMemHostAlloc`, :py:obj:`~.cuMemHostGetDevicePointer`, :py:obj:`~.cuMemsetD2D8`, :py:obj:`~.cuMemsetD2D16`, :py:obj:`~.cuMemsetD2D32`, :py:obj:`~.cuMemsetD8`, :py:obj:`~.cuMemsetD16`, :py:obj:`~.cuMemsetD32`, :py:obj:`~.cudaMallocHost` """ cdef void_ptr pp = 0 - err = ccuda.cuMemAllocHost(&pp, bytesize) - return (CUresult(err), pp) -{{endif}} - -{{if 'cuMemFreeHost' in found_functions}} + with nogil: + err = cydriver.cuMemAllocHost(&pp, bytesize) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pp) @cython.embedsignature(True) def cuMemFreeHost(p): @@ -22677,13 +30445,12 @@ def cuMemFreeHost(p): -------- :py:obj:`~.cuArray3DCreate`, :py:obj:`~.cuArray3DGetDescriptor`, :py:obj:`~.cuArrayCreate`, :py:obj:`~.cuArrayDestroy`, :py:obj:`~.cuArrayGetDescriptor`, :py:obj:`~.cuMemAlloc`, :py:obj:`~.cuMemAllocHost`, :py:obj:`~.cuMemAllocPitch`, :py:obj:`~.cuMemcpy2D`, :py:obj:`~.cuMemcpy2DAsync`, :py:obj:`~.cuMemcpy2DUnaligned`, :py:obj:`~.cuMemcpy3D`, :py:obj:`~.cuMemcpy3DAsync`, :py:obj:`~.cuMemcpyAtoA`, :py:obj:`~.cuMemcpyAtoD`, :py:obj:`~.cuMemcpyAtoH`, :py:obj:`~.cuMemcpyAtoHAsync`, :py:obj:`~.cuMemcpyDtoA`, :py:obj:`~.cuMemcpyDtoD`, :py:obj:`~.cuMemcpyDtoDAsync`, :py:obj:`~.cuMemcpyDtoH`, :py:obj:`~.cuMemcpyDtoHAsync`, :py:obj:`~.cuMemcpyHtoA`, :py:obj:`~.cuMemcpyHtoAAsync`, :py:obj:`~.cuMemcpyHtoD`, :py:obj:`~.cuMemcpyHtoDAsync`, :py:obj:`~.cuMemFree`, :py:obj:`~.cuMemGetAddressRange`, :py:obj:`~.cuMemGetInfo`, :py:obj:`~.cuMemHostAlloc`, :py:obj:`~.cuMemHostGetDevicePointer`, :py:obj:`~.cuMemsetD2D8`, :py:obj:`~.cuMemsetD2D16`, :py:obj:`~.cuMemsetD2D32`, :py:obj:`~.cuMemsetD8`, :py:obj:`~.cuMemsetD16`, :py:obj:`~.cuMemsetD32`, :py:obj:`~.cudaFreeHost` """ - cp = utils.HelperInputVoidPtr(p) - cdef void* cp_ptr = cp.cptr - err = ccuda.cuMemFreeHost(cp_ptr) - return (CUresult(err),) -{{endif}} - -{{if 'cuMemHostAlloc' in found_functions}} + cdef _HelperInputVoidPtrStruct cypHelper + cdef void* cyp = _helper_input_void_ptr(p, &cypHelper) + with nogil: + err = cydriver.cuMemFreeHost(cyp) + _helper_input_void_ptr_free(&cypHelper) + return (_CUresult(err),) @cython.embedsignature(True) def cuMemHostAlloc(size_t bytesize, unsigned int Flags): @@ -22760,7 +30527,7 @@ def cuMemHostAlloc(size_t bytesize, unsigned int Flags): Returns ------- CUresult - :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_CONTEXT`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_OUT_OF_MEMORY` + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_CONTEXT`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_OUT_OF_MEMORY` :py:obj:`~.CUDA_ERROR_EXTERNAL_DEVICE` pp : Any Returned pointer to host memory @@ -22769,11 +30536,11 @@ def cuMemHostAlloc(size_t bytesize, unsigned int Flags): :py:obj:`~.cuArray3DCreate`, :py:obj:`~.cuArray3DGetDescriptor`, :py:obj:`~.cuArrayCreate`, :py:obj:`~.cuArrayDestroy`, :py:obj:`~.cuArrayGetDescriptor`, :py:obj:`~.cuMemAlloc`, :py:obj:`~.cuMemAllocHost`, :py:obj:`~.cuMemAllocPitch`, :py:obj:`~.cuMemcpy2D`, :py:obj:`~.cuMemcpy2DAsync`, :py:obj:`~.cuMemcpy2DUnaligned`, :py:obj:`~.cuMemcpy3D`, :py:obj:`~.cuMemcpy3DAsync`, :py:obj:`~.cuMemcpyAtoA`, :py:obj:`~.cuMemcpyAtoD`, :py:obj:`~.cuMemcpyAtoH`, :py:obj:`~.cuMemcpyAtoHAsync`, :py:obj:`~.cuMemcpyDtoA`, :py:obj:`~.cuMemcpyDtoD`, :py:obj:`~.cuMemcpyDtoDAsync`, :py:obj:`~.cuMemcpyDtoH`, :py:obj:`~.cuMemcpyDtoHAsync`, :py:obj:`~.cuMemcpyHtoA`, :py:obj:`~.cuMemcpyHtoAAsync`, :py:obj:`~.cuMemcpyHtoD`, :py:obj:`~.cuMemcpyHtoDAsync`, :py:obj:`~.cuMemFree`, :py:obj:`~.cuMemFreeHost`, :py:obj:`~.cuMemGetAddressRange`, :py:obj:`~.cuMemGetInfo`, :py:obj:`~.cuMemHostGetDevicePointer`, :py:obj:`~.cuMemsetD2D8`, :py:obj:`~.cuMemsetD2D16`, :py:obj:`~.cuMemsetD2D32`, :py:obj:`~.cuMemsetD8`, :py:obj:`~.cuMemsetD16`, :py:obj:`~.cuMemsetD32`, :py:obj:`~.cudaHostAlloc` """ cdef void_ptr pp = 0 - err = ccuda.cuMemHostAlloc(&pp, bytesize, Flags) - return (CUresult(err), pp) -{{endif}} - -{{if 'cuMemHostGetDevicePointer_v2' in found_functions}} + with nogil: + err = cydriver.cuMemHostAlloc(&pp, bytesize, Flags) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pp) @cython.embedsignature(True) def cuMemHostGetDevicePointer(p, unsigned int Flags): @@ -22827,13 +30594,14 @@ def cuMemHostGetDevicePointer(p, unsigned int Flags): :py:obj:`~.cuArray3DCreate`, :py:obj:`~.cuArray3DGetDescriptor`, :py:obj:`~.cuArrayCreate`, :py:obj:`~.cuArrayDestroy`, :py:obj:`~.cuArrayGetDescriptor`, :py:obj:`~.cuMemAlloc`, :py:obj:`~.cuMemAllocHost`, :py:obj:`~.cuMemAllocPitch`, :py:obj:`~.cuMemcpy2D`, :py:obj:`~.cuMemcpy2DAsync`, :py:obj:`~.cuMemcpy2DUnaligned`, :py:obj:`~.cuMemcpy3D`, :py:obj:`~.cuMemcpy3DAsync`, :py:obj:`~.cuMemcpyAtoA`, :py:obj:`~.cuMemcpyAtoD`, :py:obj:`~.cuMemcpyAtoH`, :py:obj:`~.cuMemcpyAtoHAsync`, :py:obj:`~.cuMemcpyDtoA`, :py:obj:`~.cuMemcpyDtoD`, :py:obj:`~.cuMemcpyDtoDAsync`, :py:obj:`~.cuMemcpyDtoH`, :py:obj:`~.cuMemcpyDtoHAsync`, :py:obj:`~.cuMemcpyHtoA`, :py:obj:`~.cuMemcpyHtoAAsync`, :py:obj:`~.cuMemcpyHtoD`, :py:obj:`~.cuMemcpyHtoDAsync`, :py:obj:`~.cuMemFree`, :py:obj:`~.cuMemFreeHost`, :py:obj:`~.cuMemGetAddressRange`, :py:obj:`~.cuMemGetInfo`, :py:obj:`~.cuMemHostAlloc`, :py:obj:`~.cuMemsetD2D8`, :py:obj:`~.cuMemsetD2D16`, :py:obj:`~.cuMemsetD2D32`, :py:obj:`~.cuMemsetD8`, :py:obj:`~.cuMemsetD16`, :py:obj:`~.cuMemsetD32`, :py:obj:`~.cudaHostGetDevicePointer` """ cdef CUdeviceptr pdptr = CUdeviceptr() - cp = utils.HelperInputVoidPtr(p) - cdef void* cp_ptr = cp.cptr - err = ccuda.cuMemHostGetDevicePointer(pdptr._ptr, cp_ptr, Flags) - return (CUresult(err), pdptr) -{{endif}} - -{{if 'cuMemHostGetFlags' in found_functions}} + cdef _HelperInputVoidPtrStruct cypHelper + cdef void* cyp = _helper_input_void_ptr(p, &cypHelper) + with nogil: + err = cydriver.cuMemHostGetDevicePointer(pdptr._pvt_ptr, cyp, Flags) + _helper_input_void_ptr_free(&cypHelper) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pdptr) @cython.embedsignature(True) def cuMemHostGetFlags(p): @@ -22863,13 +30631,14 @@ def cuMemHostGetFlags(p): :py:obj:`~.cuMemAllocHost`, :py:obj:`~.cuMemHostAlloc`, :py:obj:`~.cudaHostGetFlags` """ cdef unsigned int pFlags = 0 - cp = utils.HelperInputVoidPtr(p) - cdef void* cp_ptr = cp.cptr - err = ccuda.cuMemHostGetFlags(&pFlags, cp_ptr) - return (CUresult(err), pFlags) -{{endif}} - -{{if 'cuMemAllocManaged' in found_functions}} + cdef _HelperInputVoidPtrStruct cypHelper + cdef void* cyp = _helper_input_void_ptr(p, &cypHelper) + with nogil: + err = cydriver.cuMemHostGetFlags(&pFlags, cyp) + _helper_input_void_ptr_free(&cypHelper) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pFlags) @cython.embedsignature(True) def cuMemAllocManaged(size_t bytesize, unsigned int flags): @@ -22999,11 +30768,23 @@ def cuMemAllocManaged(size_t bytesize, unsigned int flags): :py:obj:`~.cuArray3DCreate`, :py:obj:`~.cuArray3DGetDescriptor`, :py:obj:`~.cuArrayCreate`, :py:obj:`~.cuArrayDestroy`, :py:obj:`~.cuArrayGetDescriptor`, :py:obj:`~.cuMemAllocHost`, :py:obj:`~.cuMemAllocPitch`, :py:obj:`~.cuMemcpy2D`, :py:obj:`~.cuMemcpy2DAsync`, :py:obj:`~.cuMemcpy2DUnaligned`, :py:obj:`~.cuMemcpy3D`, :py:obj:`~.cuMemcpy3DAsync`, :py:obj:`~.cuMemcpyAtoA`, :py:obj:`~.cuMemcpyAtoD`, :py:obj:`~.cuMemcpyAtoH`, :py:obj:`~.cuMemcpyAtoHAsync`, :py:obj:`~.cuMemcpyDtoA`, :py:obj:`~.cuMemcpyDtoD`, :py:obj:`~.cuMemcpyDtoDAsync`, :py:obj:`~.cuMemcpyDtoH`, :py:obj:`~.cuMemcpyDtoHAsync`, :py:obj:`~.cuMemcpyHtoA`, :py:obj:`~.cuMemcpyHtoAAsync`, :py:obj:`~.cuMemcpyHtoD`, :py:obj:`~.cuMemcpyHtoDAsync`, :py:obj:`~.cuMemFree`, :py:obj:`~.cuMemFreeHost`, :py:obj:`~.cuMemGetAddressRange`, :py:obj:`~.cuMemGetInfo`, :py:obj:`~.cuMemHostAlloc`, :py:obj:`~.cuMemHostGetDevicePointer`, :py:obj:`~.cuMemsetD2D8`, :py:obj:`~.cuMemsetD2D16`, :py:obj:`~.cuMemsetD2D32`, :py:obj:`~.cuMemsetD8`, :py:obj:`~.cuMemsetD16`, :py:obj:`~.cuMemsetD32`, :py:obj:`~.cuDeviceGetAttribute`, :py:obj:`~.cuStreamAttachMemAsync`, :py:obj:`~.cudaMallocManaged` """ cdef CUdeviceptr dptr = CUdeviceptr() - err = ccuda.cuMemAllocManaged(dptr._ptr, bytesize, flags) - return (CUresult(err), dptr) -{{endif}} + with nogil: + err = cydriver.cuMemAllocManaged(dptr._pvt_ptr, bytesize, flags) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, dptr) + +ctypedef struct cuAsyncCallbackData_st: + cydriver.CUasyncCallback callback + void *userData + +ctypedef cuAsyncCallbackData_st cuAsyncCallbackData -{{if 'cuDeviceRegisterAsyncNotification' in found_functions}} +@cython.show_performance_hints(False) +cdef void cuAsyncNotificationCallbackWrapper(cydriver.CUasyncNotificationInfo *info, void *data, cydriver.CUasyncCallbackHandle handle) nogil: + cdef cuAsyncCallbackData *cbData = data + with gil: + cbData.callback(info, cbData.userData, handle) @cython.embedsignature(True) def cuDeviceRegisterAsyncNotification(device, callbackFunc, userData): @@ -23040,7 +30821,7 @@ def cuDeviceRegisterAsyncNotification(device, callbackFunc, userData): Returns ------- CUresult - :py:obj:`~.CUDA_SUCCESS` :py:obj:`~.CUDA_ERROR_NOT_SUPPORTED` :py:obj:`~.CUDA_ERROR_INVALID_DEVICE` :py:obj:`~.CUDA_ERROR_INVALID_VALUE` :py:obj:`~.CUDA_ERROR_NOT_PERMITTED` :py:obj:`~.CUDA_ERROR_UNKNOWN` + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_NOT_SUPPORTED`, :py:obj:`~.CUDA_ERROR_INVALID_DEVICE`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_NOT_PERMITTED`, :py:obj:`~.CUDA_ERROR_UNKNOWN` callback : :py:obj:`~.CUasyncCallbackHandle` A handle representing the registered callback instance @@ -23048,32 +30829,43 @@ def cuDeviceRegisterAsyncNotification(device, callbackFunc, userData): -------- :py:obj:`~.cuDeviceUnregisterAsyncNotification` """ - cdef ccuda.CUasyncCallback ccallbackFunc + cdef cydriver.CUasyncCallback cycallbackFunc if callbackFunc is None: - ccallbackFunc = 0 + pcallbackFunc = 0 elif isinstance(callbackFunc, (CUasyncCallback,)): pcallbackFunc = int(callbackFunc) - ccallbackFunc = pcallbackFunc else: pcallbackFunc = int(CUasyncCallback(callbackFunc)) - ccallbackFunc = pcallbackFunc - cdef ccuda.CUdevice cdevice + cycallbackFunc = pcallbackFunc + cdef cydriver.CUdevice cydevice if device is None: - cdevice = 0 + pdevice = 0 elif isinstance(device, (CUdevice,)): pdevice = int(device) - cdevice = pdevice else: pdevice = int(CUdevice(device)) - cdevice = pdevice - cuserData = utils.HelperInputVoidPtr(userData) - cdef void* cuserData_ptr = cuserData.cptr - cdef CUasyncCallbackHandle callback = CUasyncCallbackHandle() - err = ccuda.cuDeviceRegisterAsyncNotification(cdevice, ccallbackFunc, cuserData_ptr, callback._ptr) - return (CUresult(err), callback) -{{endif}} + cydevice = pdevice + cdef _HelperInputVoidPtrStruct cyuserDataHelper + cdef void* cyuserData = _helper_input_void_ptr(userData, &cyuserDataHelper) + + cdef cuAsyncCallbackData *cbData = NULL + cbData = malloc(sizeof(cbData[0])) + if cbData == NULL: + return (CUresult.CUDA_ERROR_OUT_OF_MEMORY, None) + cbData.callback = cycallbackFunc + cbData.userData = cyuserData -{{if 'cuDeviceUnregisterAsyncNotification' in found_functions}} + cdef CUasyncCallbackHandle callback = CUasyncCallbackHandle() + with nogil: + err = cydriver.cuDeviceRegisterAsyncNotification(cydevice, cuAsyncNotificationCallbackWrapper, cbData, callback._pvt_ptr) + if err != cydriver.CUDA_SUCCESS: + free(cbData) + else: + m_global._allocated[int(callback)] = cbData + _helper_input_void_ptr_free(&cyuserDataHelper) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, callback) @cython.embedsignature(True) def cuDeviceUnregisterAsyncNotification(device, callback): @@ -23093,35 +30885,34 @@ def cuDeviceUnregisterAsyncNotification(device, callback): Returns ------- CUresult - :py:obj:`~.CUDA_SUCCESS` :py:obj:`~.CUDA_ERROR_NOT_SUPPORTED` :py:obj:`~.CUDA_ERROR_INVALID_DEVICE` :py:obj:`~.CUDA_ERROR_INVALID_VALUE` :py:obj:`~.CUDA_ERROR_NOT_PERMITTED` :py:obj:`~.CUDA_ERROR_UNKNOWN` + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_NOT_SUPPORTED`, :py:obj:`~.CUDA_ERROR_INVALID_DEVICE`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_NOT_PERMITTED`, :py:obj:`~.CUDA_ERROR_UNKNOWN` See Also -------- :py:obj:`~.cuDeviceRegisterAsyncNotification` """ - cdef ccuda.CUasyncCallbackHandle ccallback + cdef cydriver.CUasyncCallbackHandle cycallback if callback is None: - ccallback = 0 + pcallback = 0 elif isinstance(callback, (CUasyncCallbackHandle,)): pcallback = int(callback) - ccallback = pcallback else: pcallback = int(CUasyncCallbackHandle(callback)) - ccallback = pcallback - cdef ccuda.CUdevice cdevice + cycallback = pcallback + cdef cydriver.CUdevice cydevice if device is None: - cdevice = 0 + pdevice = 0 elif isinstance(device, (CUdevice,)): pdevice = int(device) - cdevice = pdevice else: pdevice = int(CUdevice(device)) - cdevice = pdevice - err = ccuda.cuDeviceUnregisterAsyncNotification(cdevice, ccallback) - return (CUresult(err),) -{{endif}} - -{{if 'cuDeviceGetByPCIBusId' in found_functions}} + cydevice = pdevice + with nogil: + err = cydriver.cuDeviceUnregisterAsyncNotification(cydevice, cycallback) + if err == cydriver.CUDA_SUCCESS: + free(m_global._allocated[pcallback]) + m_global._allocated.erase(pcallback) + return (_CUresult(err),) @cython.embedsignature(True) def cuDeviceGetByPCIBusId(char* pciBusId): @@ -23149,11 +30940,11 @@ def cuDeviceGetByPCIBusId(char* pciBusId): :py:obj:`~.cuDeviceGet`, :py:obj:`~.cuDeviceGetAttribute`, :py:obj:`~.cuDeviceGetPCIBusId`, :py:obj:`~.cudaDeviceGetByPCIBusId` """ cdef CUdevice dev = CUdevice() - err = ccuda.cuDeviceGetByPCIBusId(dev._ptr, pciBusId) - return (CUresult(err), dev) -{{endif}} - -{{if 'cuDeviceGetPCIBusId' in found_functions}} + with nogil: + err = cydriver.cuDeviceGetByPCIBusId(dev._pvt_ptr, pciBusId) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, dev) @cython.embedsignature(True) def cuDeviceGetPCIBusId(int length, dev): @@ -23185,22 +30976,21 @@ def cuDeviceGetPCIBusId(int length, dev): -------- :py:obj:`~.cuDeviceGet`, :py:obj:`~.cuDeviceGetAttribute`, :py:obj:`~.cuDeviceGetByPCIBusId`, :py:obj:`~.cudaDeviceGetPCIBusId` """ - cdef ccuda.CUdevice cdev + cdef cydriver.CUdevice cydev if dev is None: - cdev = 0 + pdev = 0 elif isinstance(dev, (CUdevice,)): pdev = int(dev) - cdev = pdev else: pdev = int(CUdevice(dev)) - cdev = pdev + cydev = pdev pypciBusId = b" " * length cdef char* pciBusId = pypciBusId - err = ccuda.cuDeviceGetPCIBusId(pciBusId, length, cdev) - return (CUresult(err), pypciBusId) -{{endif}} - -{{if 'cuIpcGetEventHandle' in found_functions}} + with nogil: + err = cydriver.cuDeviceGetPCIBusId(pciBusId, length, cydev) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pypciBusId) @cython.embedsignature(True) def cuIpcGetEventHandle(event): @@ -23224,7 +31014,7 @@ def cuIpcGetEventHandle(event): addressing on Linux and Windows operating systems. IPC functionality on Windows is supported for compatibility purposes but not recommended as it comes with performance cost. Users can test their device for IPC - functionality by calling :py:obj:`~.cuapiDeviceGetAttribute` with + functionality by calling :py:obj:`~.cuDeviceGetAttribute` with :py:obj:`~.CU_DEVICE_ATTRIBUTE_IPC_EVENT_SUPPORTED` Parameters @@ -23238,28 +31028,27 @@ def cuIpcGetEventHandle(event): CUresult :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_INVALID_HANDLE`, :py:obj:`~.CUDA_ERROR_OUT_OF_MEMORY`, :py:obj:`~.CUDA_ERROR_MAP_FAILED`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE` pHandle : :py:obj:`~.CUipcEventHandle` - Pointer to a user allocated CUipcEventHandle in which to return the - opaque event handle + Pointer to a user allocated :py:obj:`~.CUipcEventHandle` in which + to return the opaque event handle See Also -------- :py:obj:`~.cuEventCreate`, :py:obj:`~.cuEventDestroy`, :py:obj:`~.cuEventSynchronize`, :py:obj:`~.cuEventQuery`, :py:obj:`~.cuStreamWaitEvent`, :py:obj:`~.cuIpcOpenEventHandle`, :py:obj:`~.cuIpcGetMemHandle`, :py:obj:`~.cuIpcOpenMemHandle`, :py:obj:`~.cuIpcCloseMemHandle`, :py:obj:`~.cudaIpcGetEventHandle` """ - cdef ccuda.CUevent cevent + cdef cydriver.CUevent cyevent if event is None: - cevent = 0 + pevent = 0 elif isinstance(event, (CUevent,)): pevent = int(event) - cevent = pevent else: pevent = int(CUevent(event)) - cevent = pevent + cyevent = pevent cdef CUipcEventHandle pHandle = CUipcEventHandle() - err = ccuda.cuIpcGetEventHandle(pHandle._ptr, cevent) - return (CUresult(err), pHandle) -{{endif}} - -{{if 'cuIpcOpenEventHandle' in found_functions}} + with nogil: + err = cydriver.cuIpcGetEventHandle(pHandle._pvt_ptr, cyevent) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pHandle) @cython.embedsignature(True) def cuIpcOpenEventHandle(handle not None : CUipcEventHandle): @@ -23299,11 +31088,11 @@ def cuIpcOpenEventHandle(handle not None : CUipcEventHandle): :py:obj:`~.cuEventCreate`, :py:obj:`~.cuEventDestroy`, :py:obj:`~.cuEventSynchronize`, :py:obj:`~.cuEventQuery`, :py:obj:`~.cuStreamWaitEvent`, :py:obj:`~.cuIpcGetEventHandle`, :py:obj:`~.cuIpcGetMemHandle`, :py:obj:`~.cuIpcOpenMemHandle`, :py:obj:`~.cuIpcCloseMemHandle`, :py:obj:`~.cudaIpcOpenEventHandle` """ cdef CUevent phEvent = CUevent() - err = ccuda.cuIpcOpenEventHandle(phEvent._ptr, handle._ptr[0]) - return (CUresult(err), phEvent) -{{endif}} - -{{if 'cuIpcGetMemHandle' in found_functions}} + with nogil: + err = cydriver.cuIpcOpenEventHandle(phEvent._pvt_ptr, handle._pvt_ptr[0]) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, phEvent) @cython.embedsignature(True) def cuIpcGetMemHandle(dptr): @@ -23343,21 +31132,20 @@ def cuIpcGetMemHandle(dptr): -------- :py:obj:`~.cuMemAlloc`, :py:obj:`~.cuMemFree`, :py:obj:`~.cuIpcGetEventHandle`, :py:obj:`~.cuIpcOpenEventHandle`, :py:obj:`~.cuIpcOpenMemHandle`, :py:obj:`~.cuIpcCloseMemHandle`, :py:obj:`~.cudaIpcGetMemHandle` """ - cdef ccuda.CUdeviceptr cdptr + cdef cydriver.CUdeviceptr cydptr if dptr is None: - cdptr = 0 + pdptr = 0 elif isinstance(dptr, (CUdeviceptr,)): pdptr = int(dptr) - cdptr = pdptr else: pdptr = int(CUdeviceptr(dptr)) - cdptr = pdptr + cydptr = pdptr cdef CUipcMemHandle pHandle = CUipcMemHandle() - err = ccuda.cuIpcGetMemHandle(pHandle._ptr, cdptr) - return (CUresult(err), pHandle) -{{endif}} - -{{if 'cuIpcOpenMemHandle_v2' in found_functions}} + with nogil: + err = cydriver.cuIpcGetMemHandle(pHandle._pvt_ptr, cydptr) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pHandle) @cython.embedsignature(True) def cuIpcOpenMemHandle(handle not None : CUipcMemHandle, unsigned int Flags): @@ -23419,11 +31207,11 @@ def cuIpcOpenMemHandle(handle not None : CUipcMemHandle, unsigned int Flags): No guarantees are made about the address returned in `*pdptr`. In particular, multiple processes may not receive the same address for the same `handle`. """ cdef CUdeviceptr pdptr = CUdeviceptr() - err = ccuda.cuIpcOpenMemHandle(pdptr._ptr, handle._ptr[0], Flags) - return (CUresult(err), pdptr) -{{endif}} - -{{if 'cuIpcCloseMemHandle' in found_functions}} + with nogil: + err = cydriver.cuIpcOpenMemHandle(pdptr._pvt_ptr, handle._pvt_ptr[0], Flags) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pdptr) @cython.embedsignature(True) def cuIpcCloseMemHandle(dptr): @@ -23459,20 +31247,17 @@ def cuIpcCloseMemHandle(dptr): -------- :py:obj:`~.cuMemAlloc`, :py:obj:`~.cuMemFree`, :py:obj:`~.cuIpcGetEventHandle`, :py:obj:`~.cuIpcOpenEventHandle`, :py:obj:`~.cuIpcGetMemHandle`, :py:obj:`~.cuIpcOpenMemHandle`, :py:obj:`~.cudaIpcCloseMemHandle` """ - cdef ccuda.CUdeviceptr cdptr + cdef cydriver.CUdeviceptr cydptr if dptr is None: - cdptr = 0 + pdptr = 0 elif isinstance(dptr, (CUdeviceptr,)): pdptr = int(dptr) - cdptr = pdptr else: pdptr = int(CUdeviceptr(dptr)) - cdptr = pdptr - err = ccuda.cuIpcCloseMemHandle(cdptr) - return (CUresult(err),) -{{endif}} - -{{if 'cuMemHostRegister_v2' in found_functions}} + cydptr = pdptr + with nogil: + err = cydriver.cuIpcCloseMemHandle(cydptr) + return (_CUresult(err),) @cython.embedsignature(True) def cuMemHostRegister(p, size_t bytesize, unsigned int Flags): @@ -23564,19 +31349,18 @@ def cuMemHostRegister(p, size_t bytesize, unsigned int Flags): Returns ------- CUresult - :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_CONTEXT`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_OUT_OF_MEMORY`, :py:obj:`~.CUDA_ERROR_HOST_MEMORY_ALREADY_REGISTERED`, :py:obj:`~.CUDA_ERROR_NOT_PERMITTED`, :py:obj:`~.CUDA_ERROR_NOT_SUPPORTED` + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_CONTEXT`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_OUT_OF_MEMORY`, :py:obj:`~.CUDA_ERROR_HOST_MEMORY_ALREADY_REGISTERED`, :py:obj:`~.CUDA_ERROR_NOT_PERMITTED`, :py:obj:`~.CUDA_ERROR_NOT_SUPPORTED` :py:obj:`~.CUDA_ERROR_EXTERNAL_DEVICE` See Also -------- :py:obj:`~.cuMemHostUnregister`, :py:obj:`~.cuMemHostGetFlags`, :py:obj:`~.cuMemHostGetDevicePointer`, :py:obj:`~.cudaHostRegister` """ - cp = utils.HelperInputVoidPtr(p) - cdef void* cp_ptr = cp.cptr - err = ccuda.cuMemHostRegister(cp_ptr, bytesize, Flags) - return (CUresult(err),) -{{endif}} - -{{if 'cuMemHostUnregister' in found_functions}} + cdef _HelperInputVoidPtrStruct cypHelper + cdef void* cyp = _helper_input_void_ptr(p, &cypHelper) + with nogil: + err = cydriver.cuMemHostRegister(cyp, bytesize, Flags) + _helper_input_void_ptr_free(&cypHelper) + return (_CUresult(err),) @cython.embedsignature(True) def cuMemHostUnregister(p): @@ -23602,13 +31386,12 @@ def cuMemHostUnregister(p): -------- :py:obj:`~.cuMemHostRegister`, :py:obj:`~.cudaHostUnregister` """ - cp = utils.HelperInputVoidPtr(p) - cdef void* cp_ptr = cp.cptr - err = ccuda.cuMemHostUnregister(cp_ptr) - return (CUresult(err),) -{{endif}} - -{{if 'cuMemcpy' in found_functions}} + cdef _HelperInputVoidPtrStruct cypHelper + cdef void* cyp = _helper_input_void_ptr(p, &cypHelper) + with nogil: + err = cydriver.cuMemHostUnregister(cyp) + _helper_input_void_ptr_free(&cypHelper) + return (_CUresult(err),) @cython.embedsignature(True) def cuMemcpy(dst, src, size_t ByteCount): @@ -23639,29 +31422,25 @@ def cuMemcpy(dst, src, size_t ByteCount): -------- :py:obj:`~.cuArray3DCreate`, :py:obj:`~.cuArray3DGetDescriptor`, :py:obj:`~.cuArrayCreate`, :py:obj:`~.cuArrayDestroy`, :py:obj:`~.cuArrayGetDescriptor`, :py:obj:`~.cuMemAlloc`, :py:obj:`~.cuMemAllocHost`, :py:obj:`~.cuMemAllocPitch`, :py:obj:`~.cuMemcpy2D`, :py:obj:`~.cuMemcpy2DAsync`, :py:obj:`~.cuMemcpy2DUnaligned`, :py:obj:`~.cuMemcpy3D`, :py:obj:`~.cuMemcpy3DAsync`, :py:obj:`~.cuMemcpyAtoA`, :py:obj:`~.cuMemcpyAtoD`, :py:obj:`~.cuMemcpyAtoH`, :py:obj:`~.cuMemcpyAtoHAsync`, :py:obj:`~.cuMemcpyDtoA`, :py:obj:`~.cuMemcpyDtoH`, :py:obj:`~.cuMemcpyDtoHAsync`, :py:obj:`~.cuMemcpyHtoA`, :py:obj:`~.cuMemcpyHtoAAsync`, :py:obj:`~.cuMemcpyHtoD`, :py:obj:`~.cuMemcpyHtoDAsync`, :py:obj:`~.cuMemFree`, :py:obj:`~.cuMemFreeHost`, :py:obj:`~.cuMemGetAddressRange`, :py:obj:`~.cuMemGetInfo`, :py:obj:`~.cuMemHostAlloc`, :py:obj:`~.cuMemHostGetDevicePointer`, :py:obj:`~.cuMemsetD2D8`, :py:obj:`~.cuMemsetD2D16`, :py:obj:`~.cuMemsetD2D32`, :py:obj:`~.cuMemsetD8`, :py:obj:`~.cuMemsetD16`, :py:obj:`~.cuMemsetD32`, :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpyToSymbol`, :py:obj:`~.cudaMemcpyFromSymbol` """ - cdef ccuda.CUdeviceptr csrc + cdef cydriver.CUdeviceptr cysrc if src is None: - csrc = 0 + psrc = 0 elif isinstance(src, (CUdeviceptr,)): psrc = int(src) - csrc = psrc else: psrc = int(CUdeviceptr(src)) - csrc = psrc - cdef ccuda.CUdeviceptr cdst + cysrc = psrc + cdef cydriver.CUdeviceptr cydst if dst is None: - cdst = 0 + pdst = 0 elif isinstance(dst, (CUdeviceptr,)): pdst = int(dst) - cdst = pdst else: pdst = int(CUdeviceptr(dst)) - cdst = pdst - err = ccuda.cuMemcpy(cdst, csrc, ByteCount) - return (CUresult(err),) -{{endif}} - -{{if 'cuMemcpyPeer' in found_functions}} + cydst = pdst + with nogil: + err = cydriver.cuMemcpy(cydst, cysrc, ByteCount) + return (_CUresult(err),) @cython.embedsignature(True) def cuMemcpyPeer(dstDevice, dstContext, srcDevice, srcContext, size_t ByteCount): @@ -23695,47 +31474,41 @@ def cuMemcpyPeer(dstDevice, dstContext, srcDevice, srcContext, size_t ByteCount) -------- :py:obj:`~.cuMemcpyDtoD`, :py:obj:`~.cuMemcpy3DPeer`, :py:obj:`~.cuMemcpyDtoDAsync`, :py:obj:`~.cuMemcpyPeerAsync`, :py:obj:`~.cuMemcpy3DPeerAsync`, :py:obj:`~.cudaMemcpyPeer` """ - cdef ccuda.CUcontext csrcContext + cdef cydriver.CUcontext cysrcContext if srcContext is None: - csrcContext = 0 + psrcContext = 0 elif isinstance(srcContext, (CUcontext,)): psrcContext = int(srcContext) - csrcContext = psrcContext else: psrcContext = int(CUcontext(srcContext)) - csrcContext = psrcContext - cdef ccuda.CUdeviceptr csrcDevice + cysrcContext = psrcContext + cdef cydriver.CUdeviceptr cysrcDevice if srcDevice is None: - csrcDevice = 0 + psrcDevice = 0 elif isinstance(srcDevice, (CUdeviceptr,)): psrcDevice = int(srcDevice) - csrcDevice = psrcDevice else: psrcDevice = int(CUdeviceptr(srcDevice)) - csrcDevice = psrcDevice - cdef ccuda.CUcontext cdstContext + cysrcDevice = psrcDevice + cdef cydriver.CUcontext cydstContext if dstContext is None: - cdstContext = 0 + pdstContext = 0 elif isinstance(dstContext, (CUcontext,)): pdstContext = int(dstContext) - cdstContext = pdstContext else: pdstContext = int(CUcontext(dstContext)) - cdstContext = pdstContext - cdef ccuda.CUdeviceptr cdstDevice + cydstContext = pdstContext + cdef cydriver.CUdeviceptr cydstDevice if dstDevice is None: - cdstDevice = 0 + pdstDevice = 0 elif isinstance(dstDevice, (CUdeviceptr,)): pdstDevice = int(dstDevice) - cdstDevice = pdstDevice else: pdstDevice = int(CUdeviceptr(dstDevice)) - cdstDevice = pdstDevice - err = ccuda.cuMemcpyPeer(cdstDevice, cdstContext, csrcDevice, csrcContext, ByteCount) - return (CUresult(err),) -{{endif}} - -{{if 'cuMemcpyHtoD_v2' in found_functions}} + cydstDevice = pdstDevice + with nogil: + err = cydriver.cuMemcpyPeer(cydstDevice, cydstContext, cysrcDevice, cysrcContext, ByteCount) + return (_CUresult(err),) @cython.embedsignature(True) def cuMemcpyHtoD(dstDevice, srcHost, size_t ByteCount): @@ -23763,22 +31536,20 @@ def cuMemcpyHtoD(dstDevice, srcHost, size_t ByteCount): -------- :py:obj:`~.cuArray3DCreate`, :py:obj:`~.cuArray3DGetDescriptor`, :py:obj:`~.cuArrayCreate`, :py:obj:`~.cuArrayDestroy`, :py:obj:`~.cuArrayGetDescriptor`, :py:obj:`~.cuMemAlloc`, :py:obj:`~.cuMemAllocHost`, :py:obj:`~.cuMemAllocPitch`, :py:obj:`~.cuMemcpy2D`, :py:obj:`~.cuMemcpy2DAsync`, :py:obj:`~.cuMemcpy2DUnaligned`, :py:obj:`~.cuMemcpy3D`, :py:obj:`~.cuMemcpy3DAsync`, :py:obj:`~.cuMemcpyAtoA`, :py:obj:`~.cuMemcpyAtoD`, :py:obj:`~.cuMemcpyAtoH`, :py:obj:`~.cuMemcpyAtoHAsync`, :py:obj:`~.cuMemcpyDtoA`, :py:obj:`~.cuMemcpyDtoD`, :py:obj:`~.cuMemcpyDtoDAsync`, :py:obj:`~.cuMemcpyDtoH`, :py:obj:`~.cuMemcpyDtoHAsync`, :py:obj:`~.cuMemcpyHtoA`, :py:obj:`~.cuMemcpyHtoAAsync`, :py:obj:`~.cuMemcpyHtoDAsync`, :py:obj:`~.cuMemFree`, :py:obj:`~.cuMemFreeHost`, :py:obj:`~.cuMemGetAddressRange`, :py:obj:`~.cuMemGetInfo`, :py:obj:`~.cuMemHostAlloc`, :py:obj:`~.cuMemHostGetDevicePointer`, :py:obj:`~.cuMemsetD2D8`, :py:obj:`~.cuMemsetD2D16`, :py:obj:`~.cuMemsetD2D32`, :py:obj:`~.cuMemsetD8`, :py:obj:`~.cuMemsetD16`, :py:obj:`~.cuMemsetD32`, :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpyToSymbol` """ - cdef ccuda.CUdeviceptr cdstDevice + cdef cydriver.CUdeviceptr cydstDevice if dstDevice is None: - cdstDevice = 0 + pdstDevice = 0 elif isinstance(dstDevice, (CUdeviceptr,)): pdstDevice = int(dstDevice) - cdstDevice = pdstDevice else: pdstDevice = int(CUdeviceptr(dstDevice)) - cdstDevice = pdstDevice - csrcHost = utils.HelperInputVoidPtr(srcHost) - cdef void* csrcHost_ptr = csrcHost.cptr - err = ccuda.cuMemcpyHtoD(cdstDevice, csrcHost_ptr, ByteCount) - return (CUresult(err),) -{{endif}} - -{{if 'cuMemcpyDtoH_v2' in found_functions}} + cydstDevice = pdstDevice + cdef _HelperInputVoidPtrStruct cysrcHostHelper + cdef void* cysrcHost = _helper_input_void_ptr(srcHost, &cysrcHostHelper) + with nogil: + err = cydriver.cuMemcpyHtoD(cydstDevice, cysrcHost, ByteCount) + _helper_input_void_ptr_free(&cysrcHostHelper) + return (_CUresult(err),) @cython.embedsignature(True) def cuMemcpyDtoH(dstHost, srcDevice, size_t ByteCount): @@ -23806,22 +31577,20 @@ def cuMemcpyDtoH(dstHost, srcDevice, size_t ByteCount): -------- :py:obj:`~.cuArray3DCreate`, :py:obj:`~.cuArray3DGetDescriptor`, :py:obj:`~.cuArrayCreate`, :py:obj:`~.cuArrayDestroy`, :py:obj:`~.cuArrayGetDescriptor`, :py:obj:`~.cuMemAlloc`, :py:obj:`~.cuMemAllocHost`, :py:obj:`~.cuMemAllocPitch`, :py:obj:`~.cuMemcpy2D`, :py:obj:`~.cuMemcpy2DAsync`, :py:obj:`~.cuMemcpy2DUnaligned`, :py:obj:`~.cuMemcpy3D`, :py:obj:`~.cuMemcpy3DAsync`, :py:obj:`~.cuMemcpyAtoA`, :py:obj:`~.cuMemcpyAtoD`, :py:obj:`~.cuMemcpyAtoH`, :py:obj:`~.cuMemcpyAtoHAsync`, :py:obj:`~.cuMemcpyDtoA`, :py:obj:`~.cuMemcpyDtoD`, :py:obj:`~.cuMemcpyDtoDAsync`, :py:obj:`~.cuMemcpyDtoHAsync`, :py:obj:`~.cuMemcpyHtoA`, :py:obj:`~.cuMemcpyHtoAAsync`, :py:obj:`~.cuMemcpyHtoD`, :py:obj:`~.cuMemcpyHtoDAsync`, :py:obj:`~.cuMemFree`, :py:obj:`~.cuMemFreeHost`, :py:obj:`~.cuMemGetAddressRange`, :py:obj:`~.cuMemGetInfo`, :py:obj:`~.cuMemHostAlloc`, :py:obj:`~.cuMemHostGetDevicePointer`, :py:obj:`~.cuMemsetD2D8`, :py:obj:`~.cuMemsetD2D16`, :py:obj:`~.cuMemsetD2D32`, :py:obj:`~.cuMemsetD8`, :py:obj:`~.cuMemsetD16`, :py:obj:`~.cuMemsetD32`, :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpyFromSymbol` """ - cdef ccuda.CUdeviceptr csrcDevice + cdef cydriver.CUdeviceptr cysrcDevice if srcDevice is None: - csrcDevice = 0 + psrcDevice = 0 elif isinstance(srcDevice, (CUdeviceptr,)): psrcDevice = int(srcDevice) - csrcDevice = psrcDevice else: psrcDevice = int(CUdeviceptr(srcDevice)) - csrcDevice = psrcDevice - cdstHost = utils.HelperInputVoidPtr(dstHost) - cdef void* cdstHost_ptr = cdstHost.cptr - err = ccuda.cuMemcpyDtoH(cdstHost_ptr, csrcDevice, ByteCount) - return (CUresult(err),) -{{endif}} - -{{if 'cuMemcpyDtoD_v2' in found_functions}} + cysrcDevice = psrcDevice + cdef _HelperInputVoidPtrStruct cydstHostHelper + cdef void* cydstHost = _helper_input_void_ptr(dstHost, &cydstHostHelper) + with nogil: + err = cydriver.cuMemcpyDtoH(cydstHost, cysrcDevice, ByteCount) + _helper_input_void_ptr_free(&cydstHostHelper) + return (_CUresult(err),) @cython.embedsignature(True) def cuMemcpyDtoD(dstDevice, srcDevice, size_t ByteCount): @@ -23849,29 +31618,25 @@ def cuMemcpyDtoD(dstDevice, srcDevice, size_t ByteCount): -------- :py:obj:`~.cuArray3DCreate`, :py:obj:`~.cuArray3DGetDescriptor`, :py:obj:`~.cuArrayCreate`, :py:obj:`~.cuArrayDestroy`, :py:obj:`~.cuArrayGetDescriptor`, :py:obj:`~.cuMemAlloc`, :py:obj:`~.cuMemAllocHost`, :py:obj:`~.cuMemAllocPitch`, :py:obj:`~.cuMemcpy2D`, :py:obj:`~.cuMemcpy2DAsync`, :py:obj:`~.cuMemcpy2DUnaligned`, :py:obj:`~.cuMemcpy3D`, :py:obj:`~.cuMemcpy3DAsync`, :py:obj:`~.cuMemcpyAtoA`, :py:obj:`~.cuMemcpyAtoD`, :py:obj:`~.cuMemcpyAtoH`, :py:obj:`~.cuMemcpyAtoHAsync`, :py:obj:`~.cuMemcpyDtoA`, :py:obj:`~.cuMemcpyDtoH`, :py:obj:`~.cuMemcpyDtoHAsync`, :py:obj:`~.cuMemcpyHtoA`, :py:obj:`~.cuMemcpyHtoAAsync`, :py:obj:`~.cuMemcpyHtoD`, :py:obj:`~.cuMemcpyHtoDAsync`, :py:obj:`~.cuMemFree`, :py:obj:`~.cuMemFreeHost`, :py:obj:`~.cuMemGetAddressRange`, :py:obj:`~.cuMemGetInfo`, :py:obj:`~.cuMemHostAlloc`, :py:obj:`~.cuMemHostGetDevicePointer`, :py:obj:`~.cuMemsetD2D8`, :py:obj:`~.cuMemsetD2D16`, :py:obj:`~.cuMemsetD2D32`, :py:obj:`~.cuMemsetD8`, :py:obj:`~.cuMemsetD16`, :py:obj:`~.cuMemsetD32`, :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpyToSymbol`, :py:obj:`~.cudaMemcpyFromSymbol` """ - cdef ccuda.CUdeviceptr csrcDevice + cdef cydriver.CUdeviceptr cysrcDevice if srcDevice is None: - csrcDevice = 0 + psrcDevice = 0 elif isinstance(srcDevice, (CUdeviceptr,)): psrcDevice = int(srcDevice) - csrcDevice = psrcDevice else: psrcDevice = int(CUdeviceptr(srcDevice)) - csrcDevice = psrcDevice - cdef ccuda.CUdeviceptr cdstDevice + cysrcDevice = psrcDevice + cdef cydriver.CUdeviceptr cydstDevice if dstDevice is None: - cdstDevice = 0 + pdstDevice = 0 elif isinstance(dstDevice, (CUdeviceptr,)): pdstDevice = int(dstDevice) - cdstDevice = pdstDevice else: pdstDevice = int(CUdeviceptr(dstDevice)) - cdstDevice = pdstDevice - err = ccuda.cuMemcpyDtoD(cdstDevice, csrcDevice, ByteCount) - return (CUresult(err),) -{{endif}} - -{{if 'cuMemcpyDtoA_v2' in found_functions}} + cydstDevice = pdstDevice + with nogil: + err = cydriver.cuMemcpyDtoD(cydstDevice, cysrcDevice, ByteCount) + return (_CUresult(err),) @cython.embedsignature(True) def cuMemcpyDtoA(dstArray, size_t dstOffset, srcDevice, size_t ByteCount): @@ -23902,29 +31667,25 @@ def cuMemcpyDtoA(dstArray, size_t dstOffset, srcDevice, size_t ByteCount): -------- :py:obj:`~.cuArray3DCreate`, :py:obj:`~.cuArray3DGetDescriptor`, :py:obj:`~.cuArrayCreate`, :py:obj:`~.cuArrayDestroy`, :py:obj:`~.cuArrayGetDescriptor`, :py:obj:`~.cuMemAlloc`, :py:obj:`~.cuMemAllocHost`, :py:obj:`~.cuMemAllocPitch`, :py:obj:`~.cuMemcpy2D`, :py:obj:`~.cuMemcpy2DAsync`, :py:obj:`~.cuMemcpy2DUnaligned`, :py:obj:`~.cuMemcpy3D`, :py:obj:`~.cuMemcpy3DAsync`, :py:obj:`~.cuMemcpyAtoA`, :py:obj:`~.cuMemcpyAtoD`, :py:obj:`~.cuMemcpyAtoH`, :py:obj:`~.cuMemcpyAtoHAsync`, :py:obj:`~.cuMemcpyDtoD`, :py:obj:`~.cuMemcpyDtoDAsync`, :py:obj:`~.cuMemcpyDtoH`, :py:obj:`~.cuMemcpyDtoHAsync`, :py:obj:`~.cuMemcpyHtoA`, :py:obj:`~.cuMemcpyHtoAAsync`, :py:obj:`~.cuMemcpyHtoD`, :py:obj:`~.cuMemcpyHtoDAsync`, :py:obj:`~.cuMemFree`, :py:obj:`~.cuMemFreeHost`, :py:obj:`~.cuMemGetAddressRange`, :py:obj:`~.cuMemGetInfo`, :py:obj:`~.cuMemHostAlloc`, :py:obj:`~.cuMemHostGetDevicePointer`, :py:obj:`~.cuMemsetD2D8`, :py:obj:`~.cuMemsetD2D16`, :py:obj:`~.cuMemsetD2D32`, :py:obj:`~.cuMemsetD8`, :py:obj:`~.cuMemsetD16`, :py:obj:`~.cuMemsetD32`, :py:obj:`~.cudaMemcpyToArray` """ - cdef ccuda.CUdeviceptr csrcDevice + cdef cydriver.CUdeviceptr cysrcDevice if srcDevice is None: - csrcDevice = 0 + psrcDevice = 0 elif isinstance(srcDevice, (CUdeviceptr,)): psrcDevice = int(srcDevice) - csrcDevice = psrcDevice else: psrcDevice = int(CUdeviceptr(srcDevice)) - csrcDevice = psrcDevice - cdef ccuda.CUarray cdstArray + cysrcDevice = psrcDevice + cdef cydriver.CUarray cydstArray if dstArray is None: - cdstArray = 0 + pdstArray = 0 elif isinstance(dstArray, (CUarray,)): pdstArray = int(dstArray) - cdstArray = pdstArray else: pdstArray = int(CUarray(dstArray)) - cdstArray = pdstArray - err = ccuda.cuMemcpyDtoA(cdstArray, dstOffset, csrcDevice, ByteCount) - return (CUresult(err),) -{{endif}} - -{{if 'cuMemcpyAtoD_v2' in found_functions}} + cydstArray = pdstArray + with nogil: + err = cydriver.cuMemcpyDtoA(cydstArray, dstOffset, cysrcDevice, ByteCount) + return (_CUresult(err),) @cython.embedsignature(True) def cuMemcpyAtoD(dstDevice, srcArray, size_t srcOffset, size_t ByteCount): @@ -23957,29 +31718,25 @@ def cuMemcpyAtoD(dstDevice, srcArray, size_t srcOffset, size_t ByteCount): -------- :py:obj:`~.cuArray3DCreate`, :py:obj:`~.cuArray3DGetDescriptor`, :py:obj:`~.cuArrayCreate`, :py:obj:`~.cuArrayDestroy`, :py:obj:`~.cuArrayGetDescriptor`, :py:obj:`~.cuMemAlloc`, :py:obj:`~.cuMemAllocHost`, :py:obj:`~.cuMemAllocPitch`, :py:obj:`~.cuMemcpy2D`, :py:obj:`~.cuMemcpy2DAsync`, :py:obj:`~.cuMemcpy2DUnaligned`, :py:obj:`~.cuMemcpy3D`, :py:obj:`~.cuMemcpy3DAsync`, :py:obj:`~.cuMemcpyAtoA`, :py:obj:`~.cuMemcpyAtoH`, :py:obj:`~.cuMemcpyAtoHAsync`, :py:obj:`~.cuMemcpyDtoA`, :py:obj:`~.cuMemcpyDtoD`, :py:obj:`~.cuMemcpyDtoDAsync`, :py:obj:`~.cuMemcpyDtoH`, :py:obj:`~.cuMemcpyDtoHAsync`, :py:obj:`~.cuMemcpyHtoA`, :py:obj:`~.cuMemcpyHtoAAsync`, :py:obj:`~.cuMemcpyHtoD`, :py:obj:`~.cuMemcpyHtoDAsync`, :py:obj:`~.cuMemFree`, :py:obj:`~.cuMemFreeHost`, :py:obj:`~.cuMemGetAddressRange`, :py:obj:`~.cuMemGetInfo`, :py:obj:`~.cuMemHostAlloc`, :py:obj:`~.cuMemHostGetDevicePointer`, :py:obj:`~.cuMemsetD2D8`, :py:obj:`~.cuMemsetD2D16`, :py:obj:`~.cuMemsetD2D32`, :py:obj:`~.cuMemsetD8`, :py:obj:`~.cuMemsetD16`, :py:obj:`~.cuMemsetD32`, :py:obj:`~.cudaMemcpyFromArray` """ - cdef ccuda.CUarray csrcArray + cdef cydriver.CUarray cysrcArray if srcArray is None: - csrcArray = 0 + psrcArray = 0 elif isinstance(srcArray, (CUarray,)): psrcArray = int(srcArray) - csrcArray = psrcArray else: psrcArray = int(CUarray(srcArray)) - csrcArray = psrcArray - cdef ccuda.CUdeviceptr cdstDevice + cysrcArray = psrcArray + cdef cydriver.CUdeviceptr cydstDevice if dstDevice is None: - cdstDevice = 0 + pdstDevice = 0 elif isinstance(dstDevice, (CUdeviceptr,)): pdstDevice = int(dstDevice) - cdstDevice = pdstDevice else: pdstDevice = int(CUdeviceptr(dstDevice)) - cdstDevice = pdstDevice - err = ccuda.cuMemcpyAtoD(cdstDevice, csrcArray, srcOffset, ByteCount) - return (CUresult(err),) -{{endif}} - -{{if 'cuMemcpyHtoA_v2' in found_functions}} + cydstDevice = pdstDevice + with nogil: + err = cydriver.cuMemcpyAtoD(cydstDevice, cysrcArray, srcOffset, ByteCount) + return (_CUresult(err),) @cython.embedsignature(True) def cuMemcpyHtoA(dstArray, size_t dstOffset, srcHost, size_t ByteCount): @@ -24010,22 +31767,20 @@ def cuMemcpyHtoA(dstArray, size_t dstOffset, srcHost, size_t ByteCount): -------- :py:obj:`~.cuArray3DCreate`, :py:obj:`~.cuArray3DGetDescriptor`, :py:obj:`~.cuArrayCreate`, :py:obj:`~.cuArrayDestroy`, :py:obj:`~.cuArrayGetDescriptor`, :py:obj:`~.cuMemAlloc`, :py:obj:`~.cuMemAllocHost`, :py:obj:`~.cuMemAllocPitch`, :py:obj:`~.cuMemcpy2D`, :py:obj:`~.cuMemcpy2DAsync`, :py:obj:`~.cuMemcpy2DUnaligned`, :py:obj:`~.cuMemcpy3D`, :py:obj:`~.cuMemcpy3DAsync`, :py:obj:`~.cuMemcpyAtoA`, :py:obj:`~.cuMemcpyAtoD`, :py:obj:`~.cuMemcpyAtoH`, :py:obj:`~.cuMemcpyAtoHAsync`, :py:obj:`~.cuMemcpyDtoA`, :py:obj:`~.cuMemcpyDtoD`, :py:obj:`~.cuMemcpyDtoDAsync`, :py:obj:`~.cuMemcpyDtoH`, :py:obj:`~.cuMemcpyDtoHAsync`, :py:obj:`~.cuMemcpyHtoAAsync`, :py:obj:`~.cuMemcpyHtoD`, :py:obj:`~.cuMemcpyHtoDAsync`, :py:obj:`~.cuMemFree`, :py:obj:`~.cuMemFreeHost`, :py:obj:`~.cuMemGetAddressRange`, :py:obj:`~.cuMemGetInfo`, :py:obj:`~.cuMemHostAlloc`, :py:obj:`~.cuMemHostGetDevicePointer`, :py:obj:`~.cuMemsetD2D8`, :py:obj:`~.cuMemsetD2D16`, :py:obj:`~.cuMemsetD2D32`, :py:obj:`~.cuMemsetD8`, :py:obj:`~.cuMemsetD16`, :py:obj:`~.cuMemsetD32`, :py:obj:`~.cudaMemcpyToArray` """ - cdef ccuda.CUarray cdstArray + cdef cydriver.CUarray cydstArray if dstArray is None: - cdstArray = 0 + pdstArray = 0 elif isinstance(dstArray, (CUarray,)): pdstArray = int(dstArray) - cdstArray = pdstArray else: pdstArray = int(CUarray(dstArray)) - cdstArray = pdstArray - csrcHost = utils.HelperInputVoidPtr(srcHost) - cdef void* csrcHost_ptr = csrcHost.cptr - err = ccuda.cuMemcpyHtoA(cdstArray, dstOffset, csrcHost_ptr, ByteCount) - return (CUresult(err),) -{{endif}} - -{{if 'cuMemcpyAtoH_v2' in found_functions}} + cydstArray = pdstArray + cdef _HelperInputVoidPtrStruct cysrcHostHelper + cdef void* cysrcHost = _helper_input_void_ptr(srcHost, &cysrcHostHelper) + with nogil: + err = cydriver.cuMemcpyHtoA(cydstArray, dstOffset, cysrcHost, ByteCount) + _helper_input_void_ptr_free(&cysrcHostHelper) + return (_CUresult(err),) @cython.embedsignature(True) def cuMemcpyAtoH(dstHost, srcArray, size_t srcOffset, size_t ByteCount): @@ -24056,22 +31811,20 @@ def cuMemcpyAtoH(dstHost, srcArray, size_t srcOffset, size_t ByteCount): -------- :py:obj:`~.cuArray3DCreate`, :py:obj:`~.cuArray3DGetDescriptor`, :py:obj:`~.cuArrayCreate`, :py:obj:`~.cuArrayDestroy`, :py:obj:`~.cuArrayGetDescriptor`, :py:obj:`~.cuMemAlloc`, :py:obj:`~.cuMemAllocHost`, :py:obj:`~.cuMemAllocPitch`, :py:obj:`~.cuMemcpy2D`, :py:obj:`~.cuMemcpy2DAsync`, :py:obj:`~.cuMemcpy2DUnaligned`, :py:obj:`~.cuMemcpy3D`, :py:obj:`~.cuMemcpy3DAsync`, :py:obj:`~.cuMemcpyAtoA`, :py:obj:`~.cuMemcpyAtoD`, :py:obj:`~.cuMemcpyAtoHAsync`, :py:obj:`~.cuMemcpyDtoA`, :py:obj:`~.cuMemcpyDtoD`, :py:obj:`~.cuMemcpyDtoDAsync`, :py:obj:`~.cuMemcpyDtoH`, :py:obj:`~.cuMemcpyDtoHAsync`, :py:obj:`~.cuMemcpyHtoA`, :py:obj:`~.cuMemcpyHtoAAsync`, :py:obj:`~.cuMemcpyHtoD`, :py:obj:`~.cuMemcpyHtoDAsync`, :py:obj:`~.cuMemFree`, :py:obj:`~.cuMemFreeHost`, :py:obj:`~.cuMemGetAddressRange`, :py:obj:`~.cuMemGetInfo`, :py:obj:`~.cuMemHostAlloc`, :py:obj:`~.cuMemHostGetDevicePointer`, :py:obj:`~.cuMemsetD2D8`, :py:obj:`~.cuMemsetD2D16`, :py:obj:`~.cuMemsetD2D32`, :py:obj:`~.cuMemsetD8`, :py:obj:`~.cuMemsetD16`, :py:obj:`~.cuMemsetD32`, :py:obj:`~.cudaMemcpyFromArray` """ - cdef ccuda.CUarray csrcArray + cdef cydriver.CUarray cysrcArray if srcArray is None: - csrcArray = 0 + psrcArray = 0 elif isinstance(srcArray, (CUarray,)): psrcArray = int(srcArray) - csrcArray = psrcArray else: psrcArray = int(CUarray(srcArray)) - csrcArray = psrcArray - cdstHost = utils.HelperInputVoidPtr(dstHost) - cdef void* cdstHost_ptr = cdstHost.cptr - err = ccuda.cuMemcpyAtoH(cdstHost_ptr, csrcArray, srcOffset, ByteCount) - return (CUresult(err),) -{{endif}} - -{{if 'cuMemcpyAtoA_v2' in found_functions}} + cysrcArray = psrcArray + cdef _HelperInputVoidPtrStruct cydstHostHelper + cdef void* cydstHost = _helper_input_void_ptr(dstHost, &cydstHostHelper) + with nogil: + err = cydriver.cuMemcpyAtoH(cydstHost, cysrcArray, srcOffset, ByteCount) + _helper_input_void_ptr_free(&cydstHostHelper) + return (_CUresult(err),) @cython.embedsignature(True) def cuMemcpyAtoA(dstArray, size_t dstOffset, srcArray, size_t srcOffset, size_t ByteCount): @@ -24107,29 +31860,25 @@ def cuMemcpyAtoA(dstArray, size_t dstOffset, srcArray, size_t srcOffset, size_t -------- :py:obj:`~.cuArray3DCreate`, :py:obj:`~.cuArray3DGetDescriptor`, :py:obj:`~.cuArrayCreate`, :py:obj:`~.cuArrayDestroy`, :py:obj:`~.cuArrayGetDescriptor`, :py:obj:`~.cuMemAlloc`, :py:obj:`~.cuMemAllocHost`, :py:obj:`~.cuMemAllocPitch`, :py:obj:`~.cuMemcpy2D`, :py:obj:`~.cuMemcpy2DAsync`, :py:obj:`~.cuMemcpy2DUnaligned`, :py:obj:`~.cuMemcpy3D`, :py:obj:`~.cuMemcpy3DAsync`, :py:obj:`~.cuMemcpyAtoD`, :py:obj:`~.cuMemcpyAtoH`, :py:obj:`~.cuMemcpyAtoHAsync`, :py:obj:`~.cuMemcpyDtoA`, :py:obj:`~.cuMemcpyDtoD`, :py:obj:`~.cuMemcpyDtoDAsync`, :py:obj:`~.cuMemcpyDtoH`, :py:obj:`~.cuMemcpyDtoHAsync`, :py:obj:`~.cuMemcpyHtoA`, :py:obj:`~.cuMemcpyHtoAAsync`, :py:obj:`~.cuMemcpyHtoD`, :py:obj:`~.cuMemcpyHtoDAsync`, :py:obj:`~.cuMemFree`, :py:obj:`~.cuMemFreeHost`, :py:obj:`~.cuMemGetAddressRange`, :py:obj:`~.cuMemGetInfo`, :py:obj:`~.cuMemHostAlloc`, :py:obj:`~.cuMemHostGetDevicePointer`, :py:obj:`~.cuMemsetD2D8`, :py:obj:`~.cuMemsetD2D16`, :py:obj:`~.cuMemsetD2D32`, :py:obj:`~.cuMemsetD8`, :py:obj:`~.cuMemsetD16`, :py:obj:`~.cuMemsetD32`, :py:obj:`~.cudaMemcpyArrayToArray` """ - cdef ccuda.CUarray csrcArray + cdef cydriver.CUarray cysrcArray if srcArray is None: - csrcArray = 0 + psrcArray = 0 elif isinstance(srcArray, (CUarray,)): psrcArray = int(srcArray) - csrcArray = psrcArray else: psrcArray = int(CUarray(srcArray)) - csrcArray = psrcArray - cdef ccuda.CUarray cdstArray + cysrcArray = psrcArray + cdef cydriver.CUarray cydstArray if dstArray is None: - cdstArray = 0 + pdstArray = 0 elif isinstance(dstArray, (CUarray,)): pdstArray = int(dstArray) - cdstArray = pdstArray else: pdstArray = int(CUarray(dstArray)) - cdstArray = pdstArray - err = ccuda.cuMemcpyAtoA(cdstArray, dstOffset, csrcArray, srcOffset, ByteCount) - return (CUresult(err),) -{{endif}} - -{{if 'cuMemcpy2D_v2' in found_functions}} + cydstArray = pdstArray + with nogil: + err = cydriver.cuMemcpyAtoA(cydstArray, dstOffset, cysrcArray, srcOffset, ByteCount) + return (_CUresult(err),) @cython.embedsignature(True) def cuMemcpy2D(pCopy : Optional[CUDA_MEMCPY2D]): @@ -24250,12 +31999,10 @@ def cuMemcpy2D(pCopy : Optional[CUDA_MEMCPY2D]): -------- :py:obj:`~.cuArray3DCreate`, :py:obj:`~.cuArray3DGetDescriptor`, :py:obj:`~.cuArrayCreate`, :py:obj:`~.cuArrayDestroy`, :py:obj:`~.cuArrayGetDescriptor`, :py:obj:`~.cuMemAlloc`, :py:obj:`~.cuMemAllocHost`, :py:obj:`~.cuMemAllocPitch`, :py:obj:`~.cuMemcpy2DAsync`, :py:obj:`~.cuMemcpy2DUnaligned`, :py:obj:`~.cuMemcpy3D`, :py:obj:`~.cuMemcpy3DAsync`, :py:obj:`~.cuMemcpyAtoA`, :py:obj:`~.cuMemcpyAtoD`, :py:obj:`~.cuMemcpyAtoH`, :py:obj:`~.cuMemcpyAtoHAsync`, :py:obj:`~.cuMemcpyDtoA`, :py:obj:`~.cuMemcpyDtoD`, :py:obj:`~.cuMemcpyDtoDAsync`, :py:obj:`~.cuMemcpyDtoH`, :py:obj:`~.cuMemcpyDtoHAsync`, :py:obj:`~.cuMemcpyHtoA`, :py:obj:`~.cuMemcpyHtoAAsync`, :py:obj:`~.cuMemcpyHtoD`, :py:obj:`~.cuMemcpyHtoDAsync`, :py:obj:`~.cuMemFree`, :py:obj:`~.cuMemFreeHost`, :py:obj:`~.cuMemGetAddressRange`, :py:obj:`~.cuMemGetInfo`, :py:obj:`~.cuMemHostAlloc`, :py:obj:`~.cuMemHostGetDevicePointer`, :py:obj:`~.cuMemsetD2D8`, :py:obj:`~.cuMemsetD2D16`, :py:obj:`~.cuMemsetD2D32`, :py:obj:`~.cuMemsetD8`, :py:obj:`~.cuMemsetD16`, :py:obj:`~.cuMemsetD32`, :py:obj:`~.cudaMemcpy2D`, :py:obj:`~.cudaMemcpy2DToArray`, :py:obj:`~.cudaMemcpy2DFromArray` """ - cdef ccuda.CUDA_MEMCPY2D* cpCopy_ptr = pCopy._ptr if pCopy != None else NULL - err = ccuda.cuMemcpy2D(cpCopy_ptr) - return (CUresult(err),) -{{endif}} - -{{if 'cuMemcpy2DUnaligned_v2' in found_functions}} + cdef cydriver.CUDA_MEMCPY2D* cypCopy_ptr = pCopy._pvt_ptr if pCopy is not None else NULL + with nogil: + err = cydriver.cuMemcpy2D(cypCopy_ptr) + return (_CUresult(err),) @cython.embedsignature(True) def cuMemcpy2DUnaligned(pCopy : Optional[CUDA_MEMCPY2D]): @@ -24376,12 +32123,10 @@ def cuMemcpy2DUnaligned(pCopy : Optional[CUDA_MEMCPY2D]): -------- :py:obj:`~.cuArray3DCreate`, :py:obj:`~.cuArray3DGetDescriptor`, :py:obj:`~.cuArrayCreate`, :py:obj:`~.cuArrayDestroy`, :py:obj:`~.cuArrayGetDescriptor`, :py:obj:`~.cuMemAlloc`, :py:obj:`~.cuMemAllocHost`, :py:obj:`~.cuMemAllocPitch`, :py:obj:`~.cuMemcpy2D`, :py:obj:`~.cuMemcpy2DAsync`, :py:obj:`~.cuMemcpy3D`, :py:obj:`~.cuMemcpy3DAsync`, :py:obj:`~.cuMemcpyAtoA`, :py:obj:`~.cuMemcpyAtoD`, :py:obj:`~.cuMemcpyAtoH`, :py:obj:`~.cuMemcpyAtoHAsync`, :py:obj:`~.cuMemcpyDtoA`, :py:obj:`~.cuMemcpyDtoD`, :py:obj:`~.cuMemcpyDtoDAsync`, :py:obj:`~.cuMemcpyDtoH`, :py:obj:`~.cuMemcpyDtoHAsync`, :py:obj:`~.cuMemcpyHtoA`, :py:obj:`~.cuMemcpyHtoAAsync`, :py:obj:`~.cuMemcpyHtoD`, :py:obj:`~.cuMemcpyHtoDAsync`, :py:obj:`~.cuMemFree`, :py:obj:`~.cuMemFreeHost`, :py:obj:`~.cuMemGetAddressRange`, :py:obj:`~.cuMemGetInfo`, :py:obj:`~.cuMemHostAlloc`, :py:obj:`~.cuMemHostGetDevicePointer`, :py:obj:`~.cuMemsetD2D8`, :py:obj:`~.cuMemsetD2D16`, :py:obj:`~.cuMemsetD2D32`, :py:obj:`~.cuMemsetD8`, :py:obj:`~.cuMemsetD16`, :py:obj:`~.cuMemsetD32`, :py:obj:`~.cudaMemcpy2D`, :py:obj:`~.cudaMemcpy2DToArray`, :py:obj:`~.cudaMemcpy2DFromArray` """ - cdef ccuda.CUDA_MEMCPY2D* cpCopy_ptr = pCopy._ptr if pCopy != None else NULL - err = ccuda.cuMemcpy2DUnaligned(cpCopy_ptr) - return (CUresult(err),) -{{endif}} - -{{if 'cuMemcpy3D_v2' in found_functions}} + cdef cydriver.CUDA_MEMCPY2D* cypCopy_ptr = pCopy._pvt_ptr if pCopy is not None else NULL + with nogil: + err = cydriver.cuMemcpy2DUnaligned(cypCopy_ptr) + return (_CUresult(err),) @cython.embedsignature(True) def cuMemcpy3D(pCopy : Optional[CUDA_MEMCPY3D]): @@ -24505,12 +32250,10 @@ def cuMemcpy3D(pCopy : Optional[CUDA_MEMCPY3D]): -------- :py:obj:`~.cuArray3DCreate`, :py:obj:`~.cuArray3DGetDescriptor`, :py:obj:`~.cuArrayCreate`, :py:obj:`~.cuArrayDestroy`, :py:obj:`~.cuArrayGetDescriptor`, :py:obj:`~.cuMemAlloc`, :py:obj:`~.cuMemAllocHost`, :py:obj:`~.cuMemAllocPitch`, :py:obj:`~.cuMemcpy2D`, :py:obj:`~.cuMemcpy2DAsync`, :py:obj:`~.cuMemcpy2DUnaligned`, :py:obj:`~.cuMemcpy3DAsync`, :py:obj:`~.cuMemcpyAtoA`, :py:obj:`~.cuMemcpyAtoD`, :py:obj:`~.cuMemcpyAtoH`, :py:obj:`~.cuMemcpyAtoHAsync`, :py:obj:`~.cuMemcpyDtoA`, :py:obj:`~.cuMemcpyDtoD`, :py:obj:`~.cuMemcpyDtoDAsync`, :py:obj:`~.cuMemcpyDtoH`, :py:obj:`~.cuMemcpyDtoHAsync`, :py:obj:`~.cuMemcpyHtoA`, :py:obj:`~.cuMemcpyHtoAAsync`, :py:obj:`~.cuMemcpyHtoD`, :py:obj:`~.cuMemcpyHtoDAsync`, :py:obj:`~.cuMemFree`, :py:obj:`~.cuMemFreeHost`, :py:obj:`~.cuMemGetAddressRange`, :py:obj:`~.cuMemGetInfo`, :py:obj:`~.cuMemHostAlloc`, :py:obj:`~.cuMemHostGetDevicePointer`, :py:obj:`~.cuMemsetD2D8`, :py:obj:`~.cuMemsetD2D16`, :py:obj:`~.cuMemsetD2D32`, :py:obj:`~.cuMemsetD8`, :py:obj:`~.cuMemsetD16`, :py:obj:`~.cuMemsetD32`, :py:obj:`~.cudaMemcpy3D` """ - cdef ccuda.CUDA_MEMCPY3D* cpCopy_ptr = pCopy._ptr if pCopy != None else NULL - err = ccuda.cuMemcpy3D(cpCopy_ptr) - return (CUresult(err),) -{{endif}} - -{{if 'cuMemcpy3DPeer' in found_functions}} + cdef cydriver.CUDA_MEMCPY3D* cypCopy_ptr = pCopy._pvt_ptr if pCopy is not None else NULL + with nogil: + err = cydriver.cuMemcpy3D(cypCopy_ptr) + return (_CUresult(err),) @cython.embedsignature(True) def cuMemcpy3DPeer(pCopy : Optional[CUDA_MEMCPY3D_PEER]): @@ -24534,12 +32277,10 @@ def cuMemcpy3DPeer(pCopy : Optional[CUDA_MEMCPY3D_PEER]): -------- :py:obj:`~.cuMemcpyDtoD`, :py:obj:`~.cuMemcpyPeer`, :py:obj:`~.cuMemcpyDtoDAsync`, :py:obj:`~.cuMemcpyPeerAsync`, :py:obj:`~.cuMemcpy3DPeerAsync`, :py:obj:`~.cudaMemcpy3DPeer` """ - cdef ccuda.CUDA_MEMCPY3D_PEER* cpCopy_ptr = pCopy._ptr if pCopy != None else NULL - err = ccuda.cuMemcpy3DPeer(cpCopy_ptr) - return (CUresult(err),) -{{endif}} - -{{if 'cuMemcpyAsync' in found_functions}} + cdef cydriver.CUDA_MEMCPY3D_PEER* cypCopy_ptr = pCopy._pvt_ptr if pCopy is not None else NULL + with nogil: + err = cydriver.cuMemcpy3DPeer(cypCopy_ptr) + return (_CUresult(err),) @cython.embedsignature(True) def cuMemcpyAsync(dst, src, size_t ByteCount, hStream): @@ -24572,38 +32313,33 @@ def cuMemcpyAsync(dst, src, size_t ByteCount, hStream): -------- :py:obj:`~.cuArray3DCreate`, :py:obj:`~.cuArray3DGetDescriptor`, :py:obj:`~.cuArrayCreate`, :py:obj:`~.cuArrayDestroy`, :py:obj:`~.cuArrayGetDescriptor`, :py:obj:`~.cuMemAlloc`, :py:obj:`~.cuMemAllocHost`, :py:obj:`~.cuMemAllocPitch`, :py:obj:`~.cuMemcpy2D`, :py:obj:`~.cuMemcpy2DAsync`, :py:obj:`~.cuMemcpy2DUnaligned`, :py:obj:`~.cuMemcpy3D`, :py:obj:`~.cuMemcpy3DAsync`, :py:obj:`~.cuMemcpyAtoA`, :py:obj:`~.cuMemcpyAtoD`, :py:obj:`~.cuMemcpyAtoH`, :py:obj:`~.cuMemcpyAtoHAsync`, :py:obj:`~.cuMemcpyDtoA`, :py:obj:`~.cuMemcpyDtoD`, :py:obj:`~.cuMemcpyDtoH`, :py:obj:`~.cuMemcpyDtoHAsync`, :py:obj:`~.cuMemcpyHtoA`, :py:obj:`~.cuMemcpyHtoAAsync`, :py:obj:`~.cuMemcpyHtoD`, :py:obj:`~.cuMemcpyHtoDAsync`, :py:obj:`~.cuMemFree`, :py:obj:`~.cuMemFreeHost`, :py:obj:`~.cuMemGetAddressRange`, :py:obj:`~.cuMemGetInfo`, :py:obj:`~.cuMemHostAlloc`, :py:obj:`~.cuMemHostGetDevicePointer`, :py:obj:`~.cuMemsetD2D8`, :py:obj:`~.cuMemsetD2D8Async`, :py:obj:`~.cuMemsetD2D16`, :py:obj:`~.cuMemsetD2D16Async`, :py:obj:`~.cuMemsetD2D32`, :py:obj:`~.cuMemsetD2D32Async`, :py:obj:`~.cuMemsetD8`, :py:obj:`~.cuMemsetD8Async`, :py:obj:`~.cuMemsetD16`, :py:obj:`~.cuMemsetD16Async`, :py:obj:`~.cuMemsetD32`, :py:obj:`~.cuMemsetD32Async`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpyToSymbolAsync`, :py:obj:`~.cudaMemcpyFromSymbolAsync` """ - cdef ccuda.CUstream chStream + cdef cydriver.CUstream cyhStream if hStream is None: - chStream = 0 + phStream = 0 elif isinstance(hStream, (CUstream,)): phStream = int(hStream) - chStream = phStream else: phStream = int(CUstream(hStream)) - chStream = phStream - cdef ccuda.CUdeviceptr csrc + cyhStream = phStream + cdef cydriver.CUdeviceptr cysrc if src is None: - csrc = 0 + psrc = 0 elif isinstance(src, (CUdeviceptr,)): psrc = int(src) - csrc = psrc else: psrc = int(CUdeviceptr(src)) - csrc = psrc - cdef ccuda.CUdeviceptr cdst + cysrc = psrc + cdef cydriver.CUdeviceptr cydst if dst is None: - cdst = 0 + pdst = 0 elif isinstance(dst, (CUdeviceptr,)): pdst = int(dst) - cdst = pdst else: pdst = int(CUdeviceptr(dst)) - cdst = pdst - err = ccuda.cuMemcpyAsync(cdst, csrc, ByteCount, chStream) - return (CUresult(err),) -{{endif}} - -{{if 'cuMemcpyPeerAsync' in found_functions}} + cydst = pdst + with nogil: + err = cydriver.cuMemcpyAsync(cydst, cysrc, ByteCount, cyhStream) + return (_CUresult(err),) @cython.embedsignature(True) def cuMemcpyPeerAsync(dstDevice, dstContext, srcDevice, srcContext, size_t ByteCount, hStream): @@ -24639,56 +32375,49 @@ def cuMemcpyPeerAsync(dstDevice, dstContext, srcDevice, srcContext, size_t ByteC -------- :py:obj:`~.cuMemcpyDtoD`, :py:obj:`~.cuMemcpyPeer`, :py:obj:`~.cuMemcpy3DPeer`, :py:obj:`~.cuMemcpyDtoDAsync`, :py:obj:`~.cuMemcpy3DPeerAsync`, :py:obj:`~.cudaMemcpyPeerAsync` """ - cdef ccuda.CUstream chStream + cdef cydriver.CUstream cyhStream if hStream is None: - chStream = 0 + phStream = 0 elif isinstance(hStream, (CUstream,)): phStream = int(hStream) - chStream = phStream else: phStream = int(CUstream(hStream)) - chStream = phStream - cdef ccuda.CUcontext csrcContext + cyhStream = phStream + cdef cydriver.CUcontext cysrcContext if srcContext is None: - csrcContext = 0 + psrcContext = 0 elif isinstance(srcContext, (CUcontext,)): psrcContext = int(srcContext) - csrcContext = psrcContext else: psrcContext = int(CUcontext(srcContext)) - csrcContext = psrcContext - cdef ccuda.CUdeviceptr csrcDevice + cysrcContext = psrcContext + cdef cydriver.CUdeviceptr cysrcDevice if srcDevice is None: - csrcDevice = 0 + psrcDevice = 0 elif isinstance(srcDevice, (CUdeviceptr,)): psrcDevice = int(srcDevice) - csrcDevice = psrcDevice else: psrcDevice = int(CUdeviceptr(srcDevice)) - csrcDevice = psrcDevice - cdef ccuda.CUcontext cdstContext + cysrcDevice = psrcDevice + cdef cydriver.CUcontext cydstContext if dstContext is None: - cdstContext = 0 + pdstContext = 0 elif isinstance(dstContext, (CUcontext,)): pdstContext = int(dstContext) - cdstContext = pdstContext else: pdstContext = int(CUcontext(dstContext)) - cdstContext = pdstContext - cdef ccuda.CUdeviceptr cdstDevice + cydstContext = pdstContext + cdef cydriver.CUdeviceptr cydstDevice if dstDevice is None: - cdstDevice = 0 + pdstDevice = 0 elif isinstance(dstDevice, (CUdeviceptr,)): pdstDevice = int(dstDevice) - cdstDevice = pdstDevice else: pdstDevice = int(CUdeviceptr(dstDevice)) - cdstDevice = pdstDevice - err = ccuda.cuMemcpyPeerAsync(cdstDevice, cdstContext, csrcDevice, csrcContext, ByteCount, chStream) - return (CUresult(err),) -{{endif}} - -{{if 'cuMemcpyHtoDAsync_v2' in found_functions}} + cydstDevice = pdstDevice + with nogil: + err = cydriver.cuMemcpyPeerAsync(cydstDevice, cydstContext, cysrcDevice, cysrcContext, ByteCount, cyhStream) + return (_CUresult(err),) @cython.embedsignature(True) def cuMemcpyHtoDAsync(dstDevice, srcHost, size_t ByteCount, hStream): @@ -24718,31 +32447,28 @@ def cuMemcpyHtoDAsync(dstDevice, srcHost, size_t ByteCount, hStream): -------- :py:obj:`~.cuArray3DCreate`, :py:obj:`~.cuArray3DGetDescriptor`, :py:obj:`~.cuArrayCreate`, :py:obj:`~.cuArrayDestroy`, :py:obj:`~.cuArrayGetDescriptor`, :py:obj:`~.cuMemAlloc`, :py:obj:`~.cuMemAllocHost`, :py:obj:`~.cuMemAllocPitch`, :py:obj:`~.cuMemcpy2D`, :py:obj:`~.cuMemcpy2DAsync`, :py:obj:`~.cuMemcpy2DUnaligned`, :py:obj:`~.cuMemcpy3D`, :py:obj:`~.cuMemcpy3DAsync`, :py:obj:`~.cuMemcpyAtoA`, :py:obj:`~.cuMemcpyAtoD`, :py:obj:`~.cuMemcpyAtoH`, :py:obj:`~.cuMemcpyAtoHAsync`, :py:obj:`~.cuMemcpyDtoA`, :py:obj:`~.cuMemcpyDtoD`, :py:obj:`~.cuMemcpyDtoDAsync`, :py:obj:`~.cuMemcpyDtoH`, :py:obj:`~.cuMemcpyDtoHAsync`, :py:obj:`~.cuMemcpyHtoA`, :py:obj:`~.cuMemcpyHtoAAsync`, :py:obj:`~.cuMemcpyHtoD`, :py:obj:`~.cuMemFree`, :py:obj:`~.cuMemFreeHost`, :py:obj:`~.cuMemGetAddressRange`, :py:obj:`~.cuMemGetInfo`, :py:obj:`~.cuMemHostAlloc`, :py:obj:`~.cuMemHostGetDevicePointer`, :py:obj:`~.cuMemsetD2D8`, :py:obj:`~.cuMemsetD2D8Async`, :py:obj:`~.cuMemsetD2D16`, :py:obj:`~.cuMemsetD2D16Async`, :py:obj:`~.cuMemsetD2D32`, :py:obj:`~.cuMemsetD2D32Async`, :py:obj:`~.cuMemsetD8`, :py:obj:`~.cuMemsetD8Async`, :py:obj:`~.cuMemsetD16`, :py:obj:`~.cuMemsetD16Async`, :py:obj:`~.cuMemsetD32`, :py:obj:`~.cuMemsetD32Async`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpyToSymbolAsync` """ - cdef ccuda.CUstream chStream + cdef cydriver.CUstream cyhStream if hStream is None: - chStream = 0 + phStream = 0 elif isinstance(hStream, (CUstream,)): phStream = int(hStream) - chStream = phStream else: phStream = int(CUstream(hStream)) - chStream = phStream - cdef ccuda.CUdeviceptr cdstDevice + cyhStream = phStream + cdef cydriver.CUdeviceptr cydstDevice if dstDevice is None: - cdstDevice = 0 + pdstDevice = 0 elif isinstance(dstDevice, (CUdeviceptr,)): pdstDevice = int(dstDevice) - cdstDevice = pdstDevice else: pdstDevice = int(CUdeviceptr(dstDevice)) - cdstDevice = pdstDevice - csrcHost = utils.HelperInputVoidPtr(srcHost) - cdef void* csrcHost_ptr = csrcHost.cptr - err = ccuda.cuMemcpyHtoDAsync(cdstDevice, csrcHost_ptr, ByteCount, chStream) - return (CUresult(err),) -{{endif}} - -{{if 'cuMemcpyDtoHAsync_v2' in found_functions}} + cydstDevice = pdstDevice + cdef _HelperInputVoidPtrStruct cysrcHostHelper + cdef void* cysrcHost = _helper_input_void_ptr(srcHost, &cysrcHostHelper) + with nogil: + err = cydriver.cuMemcpyHtoDAsync(cydstDevice, cysrcHost, ByteCount, cyhStream) + _helper_input_void_ptr_free(&cysrcHostHelper) + return (_CUresult(err),) @cython.embedsignature(True) def cuMemcpyDtoHAsync(dstHost, srcDevice, size_t ByteCount, hStream): @@ -24772,31 +32498,28 @@ def cuMemcpyDtoHAsync(dstHost, srcDevice, size_t ByteCount, hStream): -------- :py:obj:`~.cuArray3DCreate`, :py:obj:`~.cuArray3DGetDescriptor`, :py:obj:`~.cuArrayCreate`, :py:obj:`~.cuArrayDestroy`, :py:obj:`~.cuArrayGetDescriptor`, :py:obj:`~.cuMemAlloc`, :py:obj:`~.cuMemAllocHost`, :py:obj:`~.cuMemAllocPitch`, :py:obj:`~.cuMemcpy2D`, :py:obj:`~.cuMemcpy2DAsync`, :py:obj:`~.cuMemcpy2DUnaligned`, :py:obj:`~.cuMemcpy3D`, :py:obj:`~.cuMemcpy3DAsync`, :py:obj:`~.cuMemcpyAtoA`, :py:obj:`~.cuMemcpyAtoD`, :py:obj:`~.cuMemcpyAtoH`, :py:obj:`~.cuMemcpyAtoHAsync`, :py:obj:`~.cuMemcpyDtoA`, :py:obj:`~.cuMemcpyDtoD`, :py:obj:`~.cuMemcpyDtoDAsync`, :py:obj:`~.cuMemcpyDtoH`, :py:obj:`~.cuMemcpyHtoA`, :py:obj:`~.cuMemcpyHtoAAsync`, :py:obj:`~.cuMemcpyHtoD`, :py:obj:`~.cuMemcpyHtoDAsync`, :py:obj:`~.cuMemFree`, :py:obj:`~.cuMemFreeHost`, :py:obj:`~.cuMemGetAddressRange`, :py:obj:`~.cuMemGetInfo`, :py:obj:`~.cuMemHostAlloc`, :py:obj:`~.cuMemHostGetDevicePointer`, :py:obj:`~.cuMemsetD2D8`, :py:obj:`~.cuMemsetD2D8Async`, :py:obj:`~.cuMemsetD2D16`, :py:obj:`~.cuMemsetD2D16Async`, :py:obj:`~.cuMemsetD2D32`, :py:obj:`~.cuMemsetD2D32Async`, :py:obj:`~.cuMemsetD8`, :py:obj:`~.cuMemsetD8Async`, :py:obj:`~.cuMemsetD16`, :py:obj:`~.cuMemsetD16Async`, :py:obj:`~.cuMemsetD32`, :py:obj:`~.cuMemsetD32Async`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpyFromSymbolAsync` """ - cdef ccuda.CUstream chStream + cdef cydriver.CUstream cyhStream if hStream is None: - chStream = 0 + phStream = 0 elif isinstance(hStream, (CUstream,)): phStream = int(hStream) - chStream = phStream else: phStream = int(CUstream(hStream)) - chStream = phStream - cdef ccuda.CUdeviceptr csrcDevice + cyhStream = phStream + cdef cydriver.CUdeviceptr cysrcDevice if srcDevice is None: - csrcDevice = 0 + psrcDevice = 0 elif isinstance(srcDevice, (CUdeviceptr,)): psrcDevice = int(srcDevice) - csrcDevice = psrcDevice else: psrcDevice = int(CUdeviceptr(srcDevice)) - csrcDevice = psrcDevice - cdstHost = utils.HelperInputVoidPtr(dstHost) - cdef void* cdstHost_ptr = cdstHost.cptr - err = ccuda.cuMemcpyDtoHAsync(cdstHost_ptr, csrcDevice, ByteCount, chStream) - return (CUresult(err),) -{{endif}} - -{{if 'cuMemcpyDtoDAsync_v2' in found_functions}} + cysrcDevice = psrcDevice + cdef _HelperInputVoidPtrStruct cydstHostHelper + cdef void* cydstHost = _helper_input_void_ptr(dstHost, &cydstHostHelper) + with nogil: + err = cydriver.cuMemcpyDtoHAsync(cydstHost, cysrcDevice, ByteCount, cyhStream) + _helper_input_void_ptr_free(&cydstHostHelper) + return (_CUresult(err),) @cython.embedsignature(True) def cuMemcpyDtoDAsync(dstDevice, srcDevice, size_t ByteCount, hStream): @@ -24826,38 +32549,33 @@ def cuMemcpyDtoDAsync(dstDevice, srcDevice, size_t ByteCount, hStream): -------- :py:obj:`~.cuArray3DCreate`, :py:obj:`~.cuArray3DGetDescriptor`, :py:obj:`~.cuArrayCreate`, :py:obj:`~.cuArrayDestroy`, :py:obj:`~.cuArrayGetDescriptor`, :py:obj:`~.cuMemAlloc`, :py:obj:`~.cuMemAllocHost`, :py:obj:`~.cuMemAllocPitch`, :py:obj:`~.cuMemcpy2D`, :py:obj:`~.cuMemcpy2DAsync`, :py:obj:`~.cuMemcpy2DUnaligned`, :py:obj:`~.cuMemcpy3D`, :py:obj:`~.cuMemcpy3DAsync`, :py:obj:`~.cuMemcpyAtoA`, :py:obj:`~.cuMemcpyAtoD`, :py:obj:`~.cuMemcpyAtoH`, :py:obj:`~.cuMemcpyAtoHAsync`, :py:obj:`~.cuMemcpyDtoA`, :py:obj:`~.cuMemcpyDtoD`, :py:obj:`~.cuMemcpyDtoH`, :py:obj:`~.cuMemcpyDtoHAsync`, :py:obj:`~.cuMemcpyHtoA`, :py:obj:`~.cuMemcpyHtoAAsync`, :py:obj:`~.cuMemcpyHtoD`, :py:obj:`~.cuMemcpyHtoDAsync`, :py:obj:`~.cuMemFree`, :py:obj:`~.cuMemFreeHost`, :py:obj:`~.cuMemGetAddressRange`, :py:obj:`~.cuMemGetInfo`, :py:obj:`~.cuMemHostAlloc`, :py:obj:`~.cuMemHostGetDevicePointer`, :py:obj:`~.cuMemsetD2D8`, :py:obj:`~.cuMemsetD2D8Async`, :py:obj:`~.cuMemsetD2D16`, :py:obj:`~.cuMemsetD2D16Async`, :py:obj:`~.cuMemsetD2D32`, :py:obj:`~.cuMemsetD2D32Async`, :py:obj:`~.cuMemsetD8`, :py:obj:`~.cuMemsetD8Async`, :py:obj:`~.cuMemsetD16`, :py:obj:`~.cuMemsetD16Async`, :py:obj:`~.cuMemsetD32`, :py:obj:`~.cuMemsetD32Async`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpyToSymbolAsync`, :py:obj:`~.cudaMemcpyFromSymbolAsync` """ - cdef ccuda.CUstream chStream + cdef cydriver.CUstream cyhStream if hStream is None: - chStream = 0 + phStream = 0 elif isinstance(hStream, (CUstream,)): phStream = int(hStream) - chStream = phStream else: phStream = int(CUstream(hStream)) - chStream = phStream - cdef ccuda.CUdeviceptr csrcDevice + cyhStream = phStream + cdef cydriver.CUdeviceptr cysrcDevice if srcDevice is None: - csrcDevice = 0 + psrcDevice = 0 elif isinstance(srcDevice, (CUdeviceptr,)): psrcDevice = int(srcDevice) - csrcDevice = psrcDevice else: psrcDevice = int(CUdeviceptr(srcDevice)) - csrcDevice = psrcDevice - cdef ccuda.CUdeviceptr cdstDevice + cysrcDevice = psrcDevice + cdef cydriver.CUdeviceptr cydstDevice if dstDevice is None: - cdstDevice = 0 + pdstDevice = 0 elif isinstance(dstDevice, (CUdeviceptr,)): pdstDevice = int(dstDevice) - cdstDevice = pdstDevice else: pdstDevice = int(CUdeviceptr(dstDevice)) - cdstDevice = pdstDevice - err = ccuda.cuMemcpyDtoDAsync(cdstDevice, csrcDevice, ByteCount, chStream) - return (CUresult(err),) -{{endif}} - -{{if 'cuMemcpyHtoAAsync_v2' in found_functions}} + cydstDevice = pdstDevice + with nogil: + err = cydriver.cuMemcpyDtoDAsync(cydstDevice, cysrcDevice, ByteCount, cyhStream) + return (_CUresult(err),) @cython.embedsignature(True) def cuMemcpyHtoAAsync(dstArray, size_t dstOffset, srcHost, size_t ByteCount, hStream): @@ -24890,31 +32608,28 @@ def cuMemcpyHtoAAsync(dstArray, size_t dstOffset, srcHost, size_t ByteCount, hSt -------- :py:obj:`~.cuArray3DCreate`, :py:obj:`~.cuArray3DGetDescriptor`, :py:obj:`~.cuArrayCreate`, :py:obj:`~.cuArrayDestroy`, :py:obj:`~.cuArrayGetDescriptor`, :py:obj:`~.cuMemAlloc`, :py:obj:`~.cuMemAllocHost`, :py:obj:`~.cuMemAllocPitch`, :py:obj:`~.cuMemcpy2D`, :py:obj:`~.cuMemcpy2DAsync`, :py:obj:`~.cuMemcpy2DUnaligned`, :py:obj:`~.cuMemcpy3D`, :py:obj:`~.cuMemcpy3DAsync`, :py:obj:`~.cuMemcpyAtoA`, :py:obj:`~.cuMemcpyAtoD`, :py:obj:`~.cuMemcpyAtoH`, :py:obj:`~.cuMemcpyAtoHAsync`, :py:obj:`~.cuMemcpyDtoA`, :py:obj:`~.cuMemcpyDtoD`, :py:obj:`~.cuMemcpyDtoDAsync`, :py:obj:`~.cuMemcpyDtoH`, :py:obj:`~.cuMemcpyDtoHAsync`, :py:obj:`~.cuMemcpyHtoA`, :py:obj:`~.cuMemcpyHtoD`, :py:obj:`~.cuMemcpyHtoDAsync`, :py:obj:`~.cuMemFree`, :py:obj:`~.cuMemFreeHost`, :py:obj:`~.cuMemGetAddressRange`, :py:obj:`~.cuMemGetInfo`, :py:obj:`~.cuMemHostAlloc`, :py:obj:`~.cuMemHostGetDevicePointer`, :py:obj:`~.cuMemsetD2D8`, :py:obj:`~.cuMemsetD2D8Async`, :py:obj:`~.cuMemsetD2D16`, :py:obj:`~.cuMemsetD2D16Async`, :py:obj:`~.cuMemsetD2D32`, :py:obj:`~.cuMemsetD2D32Async`, :py:obj:`~.cuMemsetD8`, :py:obj:`~.cuMemsetD8Async`, :py:obj:`~.cuMemsetD16`, :py:obj:`~.cuMemsetD16Async`, :py:obj:`~.cuMemsetD32`, :py:obj:`~.cuMemsetD32Async`, :py:obj:`~.cudaMemcpyToArrayAsync` """ - cdef ccuda.CUstream chStream + cdef cydriver.CUstream cyhStream if hStream is None: - chStream = 0 + phStream = 0 elif isinstance(hStream, (CUstream,)): phStream = int(hStream) - chStream = phStream else: phStream = int(CUstream(hStream)) - chStream = phStream - cdef ccuda.CUarray cdstArray + cyhStream = phStream + cdef cydriver.CUarray cydstArray if dstArray is None: - cdstArray = 0 + pdstArray = 0 elif isinstance(dstArray, (CUarray,)): pdstArray = int(dstArray) - cdstArray = pdstArray else: pdstArray = int(CUarray(dstArray)) - cdstArray = pdstArray - csrcHost = utils.HelperInputVoidPtr(srcHost) - cdef void* csrcHost_ptr = csrcHost.cptr - err = ccuda.cuMemcpyHtoAAsync(cdstArray, dstOffset, csrcHost_ptr, ByteCount, chStream) - return (CUresult(err),) -{{endif}} - -{{if 'cuMemcpyAtoHAsync_v2' in found_functions}} + cydstArray = pdstArray + cdef _HelperInputVoidPtrStruct cysrcHostHelper + cdef void* cysrcHost = _helper_input_void_ptr(srcHost, &cysrcHostHelper) + with nogil: + err = cydriver.cuMemcpyHtoAAsync(cydstArray, dstOffset, cysrcHost, ByteCount, cyhStream) + _helper_input_void_ptr_free(&cysrcHostHelper) + return (_CUresult(err),) @cython.embedsignature(True) def cuMemcpyAtoHAsync(dstHost, srcArray, size_t srcOffset, size_t ByteCount, hStream): @@ -24947,31 +32662,28 @@ def cuMemcpyAtoHAsync(dstHost, srcArray, size_t srcOffset, size_t ByteCount, hSt -------- :py:obj:`~.cuArray3DCreate`, :py:obj:`~.cuArray3DGetDescriptor`, :py:obj:`~.cuArrayCreate`, :py:obj:`~.cuArrayDestroy`, :py:obj:`~.cuArrayGetDescriptor`, :py:obj:`~.cuMemAlloc`, :py:obj:`~.cuMemAllocHost`, :py:obj:`~.cuMemAllocPitch`, :py:obj:`~.cuMemcpy2D`, :py:obj:`~.cuMemcpy2DAsync`, :py:obj:`~.cuMemcpy2DUnaligned`, :py:obj:`~.cuMemcpy3D`, :py:obj:`~.cuMemcpy3DAsync`, :py:obj:`~.cuMemcpyAtoA`, :py:obj:`~.cuMemcpyAtoD`, :py:obj:`~.cuMemcpyAtoH`, :py:obj:`~.cuMemcpyDtoA`, :py:obj:`~.cuMemcpyDtoD`, :py:obj:`~.cuMemcpyDtoDAsync`, :py:obj:`~.cuMemcpyDtoH`, :py:obj:`~.cuMemcpyDtoHAsync`, :py:obj:`~.cuMemcpyHtoA`, :py:obj:`~.cuMemcpyHtoAAsync`, :py:obj:`~.cuMemcpyHtoD`, :py:obj:`~.cuMemcpyHtoDAsync`, :py:obj:`~.cuMemFree`, :py:obj:`~.cuMemFreeHost`, :py:obj:`~.cuMemGetAddressRange`, :py:obj:`~.cuMemGetInfo`, :py:obj:`~.cuMemHostAlloc`, :py:obj:`~.cuMemHostGetDevicePointer`, :py:obj:`~.cuMemsetD2D8`, :py:obj:`~.cuMemsetD2D8Async`, :py:obj:`~.cuMemsetD2D16`, :py:obj:`~.cuMemsetD2D16Async`, :py:obj:`~.cuMemsetD2D32`, :py:obj:`~.cuMemsetD2D32Async`, :py:obj:`~.cuMemsetD8`, :py:obj:`~.cuMemsetD8Async`, :py:obj:`~.cuMemsetD16`, :py:obj:`~.cuMemsetD16Async`, :py:obj:`~.cuMemsetD32`, :py:obj:`~.cuMemsetD32Async`, :py:obj:`~.cudaMemcpyFromArrayAsync` """ - cdef ccuda.CUstream chStream + cdef cydriver.CUstream cyhStream if hStream is None: - chStream = 0 + phStream = 0 elif isinstance(hStream, (CUstream,)): phStream = int(hStream) - chStream = phStream else: phStream = int(CUstream(hStream)) - chStream = phStream - cdef ccuda.CUarray csrcArray + cyhStream = phStream + cdef cydriver.CUarray cysrcArray if srcArray is None: - csrcArray = 0 + psrcArray = 0 elif isinstance(srcArray, (CUarray,)): psrcArray = int(srcArray) - csrcArray = psrcArray else: psrcArray = int(CUarray(srcArray)) - csrcArray = psrcArray - cdstHost = utils.HelperInputVoidPtr(dstHost) - cdef void* cdstHost_ptr = cdstHost.cptr - err = ccuda.cuMemcpyAtoHAsync(cdstHost_ptr, csrcArray, srcOffset, ByteCount, chStream) - return (CUresult(err),) -{{endif}} - -{{if 'cuMemcpy2DAsync_v2' in found_functions}} + cysrcArray = psrcArray + cdef _HelperInputVoidPtrStruct cydstHostHelper + cdef void* cydstHost = _helper_input_void_ptr(dstHost, &cydstHostHelper) + with nogil: + err = cydriver.cuMemcpyAtoHAsync(cydstHost, cysrcArray, srcOffset, ByteCount, cyhStream) + _helper_input_void_ptr_free(&cydstHostHelper) + return (_CUresult(err),) @cython.embedsignature(True) def cuMemcpy2DAsync(pCopy : Optional[CUDA_MEMCPY2D], hStream): @@ -25101,21 +32813,18 @@ def cuMemcpy2DAsync(pCopy : Optional[CUDA_MEMCPY2D], hStream): -------- :py:obj:`~.cuArray3DCreate`, :py:obj:`~.cuArray3DGetDescriptor`, :py:obj:`~.cuArrayCreate`, :py:obj:`~.cuArrayDestroy`, :py:obj:`~.cuArrayGetDescriptor`, :py:obj:`~.cuMemAlloc`, :py:obj:`~.cuMemAllocHost`, :py:obj:`~.cuMemAllocPitch`, :py:obj:`~.cuMemcpy2D`, :py:obj:`~.cuMemcpy2DUnaligned`, :py:obj:`~.cuMemcpy3D`, :py:obj:`~.cuMemcpy3DAsync`, :py:obj:`~.cuMemcpyAtoA`, :py:obj:`~.cuMemcpyAtoD`, :py:obj:`~.cuMemcpyAtoH`, :py:obj:`~.cuMemcpyAtoHAsync`, :py:obj:`~.cuMemcpyDtoA`, :py:obj:`~.cuMemcpyDtoD`, :py:obj:`~.cuMemcpyDtoDAsync`, :py:obj:`~.cuMemcpyDtoH`, :py:obj:`~.cuMemcpyDtoHAsync`, :py:obj:`~.cuMemcpyHtoA`, :py:obj:`~.cuMemcpyHtoAAsync`, :py:obj:`~.cuMemcpyHtoD`, :py:obj:`~.cuMemcpyHtoDAsync`, :py:obj:`~.cuMemFree`, :py:obj:`~.cuMemFreeHost`, :py:obj:`~.cuMemGetAddressRange`, :py:obj:`~.cuMemGetInfo`, :py:obj:`~.cuMemHostAlloc`, :py:obj:`~.cuMemHostGetDevicePointer`, :py:obj:`~.cuMemsetD2D8`, :py:obj:`~.cuMemsetD2D8Async`, :py:obj:`~.cuMemsetD2D16`, :py:obj:`~.cuMemsetD2D16Async`, :py:obj:`~.cuMemsetD2D32`, :py:obj:`~.cuMemsetD2D32Async`, :py:obj:`~.cuMemsetD8`, :py:obj:`~.cuMemsetD8Async`, :py:obj:`~.cuMemsetD16`, :py:obj:`~.cuMemsetD16Async`, :py:obj:`~.cuMemsetD32`, :py:obj:`~.cuMemsetD32Async`, :py:obj:`~.cudaMemcpy2DAsync`, :py:obj:`~.cudaMemcpy2DToArrayAsync`, :py:obj:`~.cudaMemcpy2DFromArrayAsync` """ - cdef ccuda.CUstream chStream + cdef cydriver.CUstream cyhStream if hStream is None: - chStream = 0 + phStream = 0 elif isinstance(hStream, (CUstream,)): phStream = int(hStream) - chStream = phStream else: phStream = int(CUstream(hStream)) - chStream = phStream - cdef ccuda.CUDA_MEMCPY2D* cpCopy_ptr = pCopy._ptr if pCopy != None else NULL - err = ccuda.cuMemcpy2DAsync(cpCopy_ptr, chStream) - return (CUresult(err),) -{{endif}} - -{{if 'cuMemcpy3DAsync_v2' in found_functions}} + cyhStream = phStream + cdef cydriver.CUDA_MEMCPY2D* cypCopy_ptr = pCopy._pvt_ptr if pCopy is not None else NULL + with nogil: + err = cydriver.cuMemcpy2DAsync(cypCopy_ptr, cyhStream) + return (_CUresult(err),) @cython.embedsignature(True) def cuMemcpy3DAsync(pCopy : Optional[CUDA_MEMCPY3D], hStream): @@ -25241,21 +32950,18 @@ def cuMemcpy3DAsync(pCopy : Optional[CUDA_MEMCPY3D], hStream): -------- :py:obj:`~.cuArray3DCreate`, :py:obj:`~.cuArray3DGetDescriptor`, :py:obj:`~.cuArrayCreate`, :py:obj:`~.cuArrayDestroy`, :py:obj:`~.cuArrayGetDescriptor`, :py:obj:`~.cuMemAlloc`, :py:obj:`~.cuMemAllocHost`, :py:obj:`~.cuMemAllocPitch`, :py:obj:`~.cuMemcpy2D`, :py:obj:`~.cuMemcpy2DAsync`, :py:obj:`~.cuMemcpy2DUnaligned`, :py:obj:`~.cuMemcpy3D`, :py:obj:`~.cuMemcpyAtoA`, :py:obj:`~.cuMemcpyAtoD`, :py:obj:`~.cuMemcpyAtoH`, :py:obj:`~.cuMemcpyAtoHAsync`, :py:obj:`~.cuMemcpyDtoA`, :py:obj:`~.cuMemcpyDtoD`, :py:obj:`~.cuMemcpyDtoDAsync`, :py:obj:`~.cuMemcpyDtoH`, :py:obj:`~.cuMemcpyDtoHAsync`, :py:obj:`~.cuMemcpyHtoA`, :py:obj:`~.cuMemcpyHtoAAsync`, :py:obj:`~.cuMemcpyHtoD`, :py:obj:`~.cuMemcpyHtoDAsync`, :py:obj:`~.cuMemFree`, :py:obj:`~.cuMemFreeHost`, :py:obj:`~.cuMemGetAddressRange`, :py:obj:`~.cuMemGetInfo`, :py:obj:`~.cuMemHostAlloc`, :py:obj:`~.cuMemHostGetDevicePointer`, :py:obj:`~.cuMemsetD2D8`, :py:obj:`~.cuMemsetD2D8Async`, :py:obj:`~.cuMemsetD2D16`, :py:obj:`~.cuMemsetD2D16Async`, :py:obj:`~.cuMemsetD2D32`, :py:obj:`~.cuMemsetD2D32Async`, :py:obj:`~.cuMemsetD8`, :py:obj:`~.cuMemsetD8Async`, :py:obj:`~.cuMemsetD16`, :py:obj:`~.cuMemsetD16Async`, :py:obj:`~.cuMemsetD32`, :py:obj:`~.cuMemsetD32Async`, :py:obj:`~.cudaMemcpy3DAsync` """ - cdef ccuda.CUstream chStream + cdef cydriver.CUstream cyhStream if hStream is None: - chStream = 0 + phStream = 0 elif isinstance(hStream, (CUstream,)): phStream = int(hStream) - chStream = phStream else: phStream = int(CUstream(hStream)) - chStream = phStream - cdef ccuda.CUDA_MEMCPY3D* cpCopy_ptr = pCopy._ptr if pCopy != None else NULL - err = ccuda.cuMemcpy3DAsync(cpCopy_ptr, chStream) - return (CUresult(err),) -{{endif}} - -{{if 'cuMemcpy3DPeerAsync' in found_functions}} + cyhStream = phStream + cdef cydriver.CUDA_MEMCPY3D* cypCopy_ptr = pCopy._pvt_ptr if pCopy is not None else NULL + with nogil: + err = cydriver.cuMemcpy3DAsync(cypCopy_ptr, cyhStream) + return (_CUresult(err),) @cython.embedsignature(True) def cuMemcpy3DPeerAsync(pCopy : Optional[CUDA_MEMCPY3D_PEER], hStream): @@ -25281,21 +32987,426 @@ def cuMemcpy3DPeerAsync(pCopy : Optional[CUDA_MEMCPY3D_PEER], hStream): -------- :py:obj:`~.cuMemcpyDtoD`, :py:obj:`~.cuMemcpyPeer`, :py:obj:`~.cuMemcpyDtoDAsync`, :py:obj:`~.cuMemcpyPeerAsync`, :py:obj:`~.cuMemcpy3DPeerAsync`, :py:obj:`~.cudaMemcpy3DPeerAsync` """ - cdef ccuda.CUstream chStream + cdef cydriver.CUstream cyhStream + if hStream is None: + phStream = 0 + elif isinstance(hStream, (CUstream,)): + phStream = int(hStream) + else: + phStream = int(CUstream(hStream)) + cyhStream = phStream + cdef cydriver.CUDA_MEMCPY3D_PEER* cypCopy_ptr = pCopy._pvt_ptr if pCopy is not None else NULL + with nogil: + err = cydriver.cuMemcpy3DPeerAsync(cypCopy_ptr, cyhStream) + return (_CUresult(err),) + +@cython.embedsignature(True) +def cuMemcpyBatchAsync(dsts : Optional[tuple[CUdeviceptr] | list[CUdeviceptr]], srcs : Optional[tuple[CUdeviceptr] | list[CUdeviceptr]], sizes : tuple[int] | list[int], size_t count, attrs : Optional[tuple[CUmemcpyAttributes] | list[CUmemcpyAttributes]], attrsIdxs : tuple[int] | list[int], size_t numAttrs, hStream): + """ Performs a batch of memory copies asynchronously. + + Performs a batch of memory copies. The batch as a whole executes in + stream order but copies within a batch are not guaranteed to execute in + any specific order. This API only supports pointer-to-pointer copies. + For copies involving CUDA arrays, please see + :py:obj:`~.cuMemcpy3DBatchAsync`. + + Performs memory copies from source buffers specified in `srcs` to + destination buffers specified in `dsts`. The size of each copy is + specified in `sizes`. All three arrays must be of the same length as + specified by `count`. Since there are no ordering guarantees for copies + within a batch, specifying any dependent copies within a batch will + result in undefined behavior. + + Every copy in the batch has to be associated with a set of attributes + specified in the `attrs` array. Each entry in this array can apply to + more than one copy. This can be done by specifying in the `attrsIdxs` + array, the index of the first copy that the corresponding entry in the + `attrs` array applies to. Both `attrs` and `attrsIdxs` must be of the + same length as specified by `numAttrs`. For example, if a batch has 10 + copies listed in dst/src/sizes, the first 6 of which have one set of + attributes and the remaining 4 another, then `numAttrs` will be 2, + `attrsIdxs` will be {0, 6} and `attrs` will contains the two sets of + attributes. Note that the first entry in `attrsIdxs` must always be 0. + Also, each entry must be greater than the previous entry and the last + entry should be less than `count`. Furthermore, `numAttrs` must be + lesser than or equal to `count`. + + The :py:obj:`~.CUmemcpyAttributes.srcAccessOrder` indicates the source + access ordering to be observed for copies associated with the + attribute. If the source access order is set to + :py:obj:`~.CU_MEMCPY_SRC_ACCESS_ORDER_STREAM`, then the source will be + accessed in stream order. If the source access order is set to + :py:obj:`~.CU_MEMCPY_SRC_ACCESS_ORDER_DURING_API_CALL` then it + indicates that access to the source pointer can be out of stream order + and all accesses must be complete before the API call returns. This + flag is suited for ephemeral sources (ex., stack variables) when it's + known that no prior operations in the stream can be accessing the + memory and also that the lifetime of the memory is limited to the scope + that the source variable was declared in. Specifying this flag allows + the driver to optimize the copy and removes the need for the user to + synchronize the stream after the API call. If the source access order + is set to :py:obj:`~.CU_MEMCPY_SRC_ACCESS_ORDER_ANY` then it indicates + that access to the source pointer can be out of stream order and the + accesses can happen even after the API call returns. This flag is + suited for host pointers allocated outside CUDA (ex., via malloc) when + it's known that no prior operations in the stream can be accessing the + memory. Specifying this flag allows the driver to optimize the copy on + certain platforms. Each memcpy operation in the batch must have a valid + :py:obj:`~.CUmemcpyAttributes` corresponding to it including the + appropriate srcAccessOrder setting, otherwise the API will return + :py:obj:`~.CUDA_ERROR_INVALID_VALUE`. + + The :py:obj:`~.CUmemcpyAttributes.srcLocHint` and + :py:obj:`~.CUmemcpyAttributes.dstLocHint` allows applications to + specify hint locations for operands of a copy when the operand doesn't + have a fixed location. That is, these hints are only applicable for + managed memory pointers on devices where + :py:obj:`~.CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS` is true or + system-allocated pageable memory on devices where + :py:obj:`~.CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS` is true. For + other cases, these hints are ignored. + + The :py:obj:`~.CUmemcpyAttributes.flags` field can be used to specify + certain flags for copies. Setting the + :py:obj:`~.CU_MEMCPY_FLAG_PREFER_OVERLAP_WITH_COMPUTE` flag indicates + that the associated copies should preferably overlap with any compute + work. Note that this flag is a hint and can be ignored depending on the + platform and other parameters of the copy. + + Parameters + ---------- + dsts : list[:py:obj:`~.CUdeviceptr`] + Array of destination pointers. + srcs : list[:py:obj:`~.CUdeviceptr`] + Array of memcpy source pointers. + sizes : list[int] + Array of sizes for memcpy operations. + count : size_t + Size of `dsts`, `srcs` and `sizes` arrays + attrs : list[:py:obj:`~.CUmemcpyAttributes`] + Array of memcpy attributes. + attrsIdxs : list[int] + Array of indices to specify which copies each entry in the `attrs` + array applies to. The attributes specified in attrs[k] will be + applied to copies starting from attrsIdxs[k] through attrsIdxs[k+1] + - 1. Also attrs[numAttrs-1] will apply to copies starting from + attrsIdxs[numAttrs-1] through count - 1. + numAttrs : size_t + Size of `attrs` and `attrsIdxs` arrays. + hStream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + The stream to enqueue the operations in. Must not be legacy NULL + stream. + + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE` + """ + cdef cydriver.CUstream cyhStream + if hStream is None: + phStream = 0 + elif isinstance(hStream, (CUstream,)): + phStream = int(hStream) + else: + phStream = int(CUstream(hStream)) + cyhStream = phStream + if not all(isinstance(_x, (int)) for _x in attrsIdxs): + raise TypeError("Argument 'attrsIdxs' is not instance of type (expected tuple[int] or list[int]") + attrs = [] if attrs is None else attrs + if not all(isinstance(_x, (CUmemcpyAttributes,)) for _x in attrs): + raise TypeError("Argument 'attrs' is not instance of type (expected tuple[cydriver.CUmemcpyAttributes,] or list[cydriver.CUmemcpyAttributes,]") + if not all(isinstance(_x, (int)) for _x in sizes): + raise TypeError("Argument 'sizes' is not instance of type (expected tuple[int] or list[int]") + srcs = [] if srcs is None else srcs + if not all(isinstance(_x, (CUdeviceptr,)) for _x in srcs): + raise TypeError("Argument 'srcs' is not instance of type (expected tuple[cydriver.CUdeviceptr,] or list[cydriver.CUdeviceptr,]") + dsts = [] if dsts is None else dsts + if not all(isinstance(_x, (CUdeviceptr,)) for _x in dsts): + raise TypeError("Argument 'dsts' is not instance of type (expected tuple[cydriver.CUdeviceptr,] or list[cydriver.CUdeviceptr,]") + cdef cydriver.CUdeviceptr* cydsts = NULL + if len(dsts) > 1: + cydsts = calloc(len(dsts), sizeof(cydriver.CUdeviceptr)) + if cydsts is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(dsts)) + 'x' + str(sizeof(cydriver.CUdeviceptr))) + else: + for idx in range(len(dsts)): + cydsts[idx] = (dsts[idx])._pvt_ptr[0] + elif len(dsts) == 1: + cydsts = (dsts[0])._pvt_ptr + cdef cydriver.CUdeviceptr* cysrcs = NULL + if len(srcs) > 1: + cysrcs = calloc(len(srcs), sizeof(cydriver.CUdeviceptr)) + if cysrcs is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(srcs)) + 'x' + str(sizeof(cydriver.CUdeviceptr))) + else: + for idx in range(len(srcs)): + cysrcs[idx] = (srcs[idx])._pvt_ptr[0] + elif len(srcs) == 1: + cysrcs = (srcs[0])._pvt_ptr + cdef vector[size_t] cysizes = sizes + if count > len(dsts): raise RuntimeError("List is too small: " + str(len(dsts)) + " < " + str(count)) + if count > len(srcs): raise RuntimeError("List is too small: " + str(len(srcs)) + " < " + str(count)) + if count > len(sizes): raise RuntimeError("List is too small: " + str(len(sizes)) + " < " + str(count)) + cdef cydriver.CUmemcpyAttributes* cyattrs = NULL + if len(attrs) > 1: + cyattrs = calloc(len(attrs), sizeof(cydriver.CUmemcpyAttributes)) + if cyattrs is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(attrs)) + 'x' + str(sizeof(cydriver.CUmemcpyAttributes))) + for idx in range(len(attrs)): + string.memcpy(&cyattrs[idx], (attrs[idx])._pvt_ptr, sizeof(cydriver.CUmemcpyAttributes)) + elif len(attrs) == 1: + cyattrs = (attrs[0])._pvt_ptr + cdef vector[size_t] cyattrsIdxs = attrsIdxs + if numAttrs > len(attrs): raise RuntimeError("List is too small: " + str(len(attrs)) + " < " + str(numAttrs)) + if numAttrs > len(attrsIdxs): raise RuntimeError("List is too small: " + str(len(attrsIdxs)) + " < " + str(numAttrs)) + with nogil: + err = cydriver.cuMemcpyBatchAsync(cydsts, cysrcs, cysizes.data(), count, cyattrs, cyattrsIdxs.data(), numAttrs, cyhStream) + if len(dsts) > 1 and cydsts is not NULL: + free(cydsts) + if len(srcs) > 1 and cysrcs is not NULL: + free(cysrcs) + if len(attrs) > 1 and cyattrs is not NULL: + free(cyattrs) + return (_CUresult(err),) + +@cython.embedsignature(True) +def cuMemcpy3DBatchAsync(size_t numOps, opList : Optional[tuple[CUDA_MEMCPY3D_BATCH_OP] | list[CUDA_MEMCPY3D_BATCH_OP]], unsigned long long flags, hStream): + """ Performs a batch of 3D memory copies asynchronously. + + Performs a batch of memory copies. The batch as a whole executes in + stream order but copies within a batch are not guaranteed to execute in + any specific order. Note that this means specifying any dependent + copies within a batch will result in undefined behavior. + + Performs memory copies as specified in the `opList` array. The length + of this array is specified in `numOps`. Each entry in this array + describes a copy operation. This includes among other things, the + source and destination operands for the copy as specified in + :py:obj:`~.CUDA_MEMCPY3D_BATCH_OP.src` and + :py:obj:`~.CUDA_MEMCPY3D_BATCH_OP.dst` respectively. The source and + destination operands of a copy can either be a pointer or a CUDA array. + The width, height and depth of a copy is specified in + :py:obj:`~.CUDA_MEMCPY3D_BATCH_OP.extent`. The width, height and depth + of a copy are specified in elements and must not be zero. For pointer- + to-pointer copies, the element size is considered to be 1. For pointer + to CUDA array or vice versa copies, the element size is determined by + the CUDA array. For CUDA array to CUDA array copies, the element size + of the two CUDA arrays must match. + + For a given operand, if :py:obj:`~.CUmemcpy3DOperand.type` is specified + as :py:obj:`~.CU_MEMCPY_OPERAND_TYPE_POINTER`, then + :py:obj:`~.CUmemcpy3DOperand.op.ptr` will be used. The + :py:obj:`~.CUmemcpy3DOperand.op.ptr.ptr` field must contain the pointer + where the copy should begin. The + :py:obj:`~.CUmemcpy3DOperand.op.ptr.rowLength` field specifies the + length of each row in elements and must either be zero or be greater + than or equal to the width of the copy specified in + :py:obj:`~.CUDA_MEMCPY3D_BATCH_OP.extent.width`. The + :py:obj:`~.CUmemcpy3DOperand.op.ptr.layerHeight` field specifies the + height of each layer and must either be zero or be greater than or + equal to the height of the copy specified in + :py:obj:`~.CUDA_MEMCPY3D_BATCH_OP.extent.height`. When either of these + values is zero, that aspect of the operand is considered to be tightly + packed according to the copy extent. For managed memory pointers on + devices where :py:obj:`~.CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS` + is true or system-allocated pageable memory on devices where + :py:obj:`~.CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS` is true, the + :py:obj:`~.CUmemcpy3DOperand.op.ptr.locHint` field can be used to hint + the location of the operand. + + If an operand's type is specified as + :py:obj:`~.CU_MEMCPY_OPERAND_TYPE_ARRAY`, then + :py:obj:`~.CUmemcpy3DOperand.op.array` will be used. The + :py:obj:`~.CUmemcpy3DOperand.op.array.array` field specifies the CUDA + array and :py:obj:`~.CUmemcpy3DOperand.op.array.offset` specifies the + 3D offset into that array where the copy begins. + + The :py:obj:`~.CUmemcpyAttributes.srcAccessOrder` indicates the source + access ordering to be observed for copies associated with the + attribute. If the source access order is set to + :py:obj:`~.CU_MEMCPY_SRC_ACCESS_ORDER_STREAM`, then the source will be + accessed in stream order. If the source access order is set to + :py:obj:`~.CU_MEMCPY_SRC_ACCESS_ORDER_DURING_API_CALL` then it + indicates that access to the source pointer can be out of stream order + and all accesses must be complete before the API call returns. This + flag is suited for ephemeral sources (ex., stack variables) when it's + known that no prior operations in the stream can be accessing the + memory and also that the lifetime of the memory is limited to the scope + that the source variable was declared in. Specifying this flag allows + the driver to optimize the copy and removes the need for the user to + synchronize the stream after the API call. If the source access order + is set to :py:obj:`~.CU_MEMCPY_SRC_ACCESS_ORDER_ANY` then it indicates + that access to the source pointer can be out of stream order and the + accesses can happen even after the API call returns. This flag is + suited for host pointers allocated outside CUDA (ex., via malloc) when + it's known that no prior operations in the stream can be accessing the + memory. Specifying this flag allows the driver to optimize the copy on + certain platforms. Each memcopy operation in `opList` must have a valid + srcAccessOrder setting, otherwise this API will return + :py:obj:`~.CUDA_ERROR_INVALID_VALUE`. + + The :py:obj:`~.CUmemcpyAttributes.flags` field can be used to specify + certain flags for copies. Setting the + :py:obj:`~.CU_MEMCPY_FLAG_PREFER_OVERLAP_WITH_COMPUTE` flag indicates + that the associated copies should preferably overlap with any compute + work. Note that this flag is a hint and can be ignored depending on the + platform and other parameters of the copy. + + Parameters + ---------- + numOps : size_t + Total number of memcpy operations. + opList : list[:py:obj:`~.CUDA_MEMCPY3D_BATCH_OP`] + Array of size `numOps` containing the actual memcpy operations. + flags : unsigned long long + Flags for future use, must be zero now. + hStream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + The stream to enqueue the operations in. Must not be default NULL + stream. + + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE` + """ + cdef cydriver.CUstream cyhStream + if hStream is None: + phStream = 0 + elif isinstance(hStream, (CUstream,)): + phStream = int(hStream) + else: + phStream = int(CUstream(hStream)) + cyhStream = phStream + opList = [] if opList is None else opList + if not all(isinstance(_x, (CUDA_MEMCPY3D_BATCH_OP,)) for _x in opList): + raise TypeError("Argument 'opList' is not instance of type (expected tuple[cydriver.CUDA_MEMCPY3D_BATCH_OP,] or list[cydriver.CUDA_MEMCPY3D_BATCH_OP,]") + if numOps > len(opList): raise RuntimeError("List is too small: " + str(len(opList)) + " < " + str(numOps)) + cdef cydriver.CUDA_MEMCPY3D_BATCH_OP* cyopList = NULL + if len(opList) > 1: + cyopList = calloc(len(opList), sizeof(cydriver.CUDA_MEMCPY3D_BATCH_OP)) + if cyopList is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(opList)) + 'x' + str(sizeof(cydriver.CUDA_MEMCPY3D_BATCH_OP))) + for idx in range(len(opList)): + string.memcpy(&cyopList[idx], (opList[idx])._pvt_ptr, sizeof(cydriver.CUDA_MEMCPY3D_BATCH_OP)) + elif len(opList) == 1: + cyopList = (opList[0])._pvt_ptr + with nogil: + err = cydriver.cuMemcpy3DBatchAsync(numOps, cyopList, flags, cyhStream) + if len(opList) > 1 and cyopList is not NULL: + free(cyopList) + return (_CUresult(err),) + +@cython.embedsignature(True) +def cuMemcpyWithAttributesAsync(dst, src, size_t size, attr : Optional[CUmemcpyAttributes], hStream): + """ + + Performs asynchronous memory copy operation with the specified + attributes. + + Performs asynchronous memory copy operation where `dst` and `src` are + the destination and source pointers respectively. `size` specifies the + number of bytes to copy. `attr` specifies the attributes for the copy + and `hStream` specifies the stream to enqueue the operation in. + + For more information regarding the attributes, please refer to + :py:obj:`~.CUmemcpyAttributes` and it's usage desciption + in::cuMemcpyBatchAsync + + Parameters + ---------- + dst : :py:obj:`~.CUdeviceptr` + Destination device pointer + src : :py:obj:`~.CUdeviceptr` + Source device pointer + size : size_t + Number of bytes to copy + attr : :py:obj:`~.CUmemcpyAttributes` + Attributes for the copy + hStream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + Stream to enqueue the operation in + + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE` + + See Also + -------- + :py:obj:`~.cuMemcpyBatchAsync` + """ + cdef cydriver.CUstream cyhStream if hStream is None: - chStream = 0 + phStream = 0 elif isinstance(hStream, (CUstream,)): phStream = int(hStream) - chStream = phStream else: phStream = int(CUstream(hStream)) - chStream = phStream - cdef ccuda.CUDA_MEMCPY3D_PEER* cpCopy_ptr = pCopy._ptr if pCopy != None else NULL - err = ccuda.cuMemcpy3DPeerAsync(cpCopy_ptr, chStream) - return (CUresult(err),) -{{endif}} + cyhStream = phStream + cdef cydriver.CUdeviceptr cysrc + if src is None: + psrc = 0 + elif isinstance(src, (CUdeviceptr,)): + psrc = int(src) + else: + psrc = int(CUdeviceptr(src)) + cysrc = psrc + cdef cydriver.CUdeviceptr cydst + if dst is None: + pdst = 0 + elif isinstance(dst, (CUdeviceptr,)): + pdst = int(dst) + else: + pdst = int(CUdeviceptr(dst)) + cydst = pdst + cdef cydriver.CUmemcpyAttributes* cyattr_ptr = attr._pvt_ptr if attr is not None else NULL + with nogil: + err = cydriver.cuMemcpyWithAttributesAsync(cydst, cysrc, size, cyattr_ptr, cyhStream) + return (_CUresult(err),) + +@cython.embedsignature(True) +def cuMemcpy3DWithAttributesAsync(op : Optional[CUDA_MEMCPY3D_BATCH_OP], unsigned long long flags, hStream): + """ + + Performs 3D memory copy with attributes asynchronously + + Performs the copy operation specified in `op`. `flags` specifies the + flags for the copy and `hStream` specifies the stream to enqueue the + operation in. + + For more information regarding the operation, please refer to + :py:obj:`~.CUDA_MEMCPY3D_BATCH_OP` and it's usage desciption + in::cuMemcpy3DBatchAsync + + Parameters + ---------- + op : :py:obj:`~.CUDA_MEMCPY3D_BATCH_OP` + Operation to perform + flags : unsigned long long + Flags for the copy, must be zero now. + hStream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + Stream to enqueue the operation in + + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE` -{{if 'cuMemsetD8_v2' in found_functions}} + See Also + -------- + :py:obj:`~.cuMemcpy3DBatchAsync` + """ + cdef cydriver.CUstream cyhStream + if hStream is None: + phStream = 0 + elif isinstance(hStream, (CUstream,)): + phStream = int(hStream) + else: + phStream = int(CUstream(hStream)) + cyhStream = phStream + cdef cydriver.CUDA_MEMCPY3D_BATCH_OP* cyop_ptr = op._pvt_ptr if op is not None else NULL + with nogil: + err = cydriver.cuMemcpy3DWithAttributesAsync(cyop_ptr, flags, cyhStream) + return (_CUresult(err),) @cython.embedsignature(True) def cuMemsetD8(dstDevice, unsigned char uc, size_t N): @@ -25321,20 +33432,17 @@ def cuMemsetD8(dstDevice, unsigned char uc, size_t N): -------- :py:obj:`~.cuArray3DCreate`, :py:obj:`~.cuArray3DGetDescriptor`, :py:obj:`~.cuArrayCreate`, :py:obj:`~.cuArrayDestroy`, :py:obj:`~.cuArrayGetDescriptor`, :py:obj:`~.cuMemAlloc`, :py:obj:`~.cuMemAllocHost`, :py:obj:`~.cuMemAllocPitch`, :py:obj:`~.cuMemcpy2D`, :py:obj:`~.cuMemcpy2DAsync`, :py:obj:`~.cuMemcpy2DUnaligned`, :py:obj:`~.cuMemcpy3D`, :py:obj:`~.cuMemcpy3DAsync`, :py:obj:`~.cuMemcpyAtoA`, :py:obj:`~.cuMemcpyAtoD`, :py:obj:`~.cuMemcpyAtoH`, :py:obj:`~.cuMemcpyAtoHAsync`, :py:obj:`~.cuMemcpyDtoA`, :py:obj:`~.cuMemcpyDtoD`, :py:obj:`~.cuMemcpyDtoDAsync`, :py:obj:`~.cuMemcpyDtoH`, :py:obj:`~.cuMemcpyDtoHAsync`, :py:obj:`~.cuMemcpyHtoA`, :py:obj:`~.cuMemcpyHtoAAsync`, :py:obj:`~.cuMemcpyHtoD`, :py:obj:`~.cuMemcpyHtoDAsync`, :py:obj:`~.cuMemFree`, :py:obj:`~.cuMemFreeHost`, :py:obj:`~.cuMemGetAddressRange`, :py:obj:`~.cuMemGetInfo`, :py:obj:`~.cuMemHostAlloc`, :py:obj:`~.cuMemHostGetDevicePointer`, :py:obj:`~.cuMemsetD2D8`, :py:obj:`~.cuMemsetD2D8Async`, :py:obj:`~.cuMemsetD2D16`, :py:obj:`~.cuMemsetD2D16Async`, :py:obj:`~.cuMemsetD2D32`, :py:obj:`~.cuMemsetD2D32Async`, :py:obj:`~.cuMemsetD8Async`, :py:obj:`~.cuMemsetD16`, :py:obj:`~.cuMemsetD16Async`, :py:obj:`~.cuMemsetD32`, :py:obj:`~.cuMemsetD32Async`, :py:obj:`~.cudaMemset` """ - cdef ccuda.CUdeviceptr cdstDevice + cdef cydriver.CUdeviceptr cydstDevice if dstDevice is None: - cdstDevice = 0 + pdstDevice = 0 elif isinstance(dstDevice, (CUdeviceptr,)): pdstDevice = int(dstDevice) - cdstDevice = pdstDevice else: pdstDevice = int(CUdeviceptr(dstDevice)) - cdstDevice = pdstDevice - err = ccuda.cuMemsetD8(cdstDevice, uc, N) - return (CUresult(err),) -{{endif}} - -{{if 'cuMemsetD16_v2' in found_functions}} + cydstDevice = pdstDevice + with nogil: + err = cydriver.cuMemsetD8(cydstDevice, uc, N) + return (_CUresult(err),) @cython.embedsignature(True) def cuMemsetD16(dstDevice, unsigned short us, size_t N): @@ -25361,20 +33469,17 @@ def cuMemsetD16(dstDevice, unsigned short us, size_t N): -------- :py:obj:`~.cuArray3DCreate`, :py:obj:`~.cuArray3DGetDescriptor`, :py:obj:`~.cuArrayCreate`, :py:obj:`~.cuArrayDestroy`, :py:obj:`~.cuArrayGetDescriptor`, :py:obj:`~.cuMemAlloc`, :py:obj:`~.cuMemAllocHost`, :py:obj:`~.cuMemAllocPitch`, :py:obj:`~.cuMemcpy2D`, :py:obj:`~.cuMemcpy2DAsync`, :py:obj:`~.cuMemcpy2DUnaligned`, :py:obj:`~.cuMemcpy3D`, :py:obj:`~.cuMemcpy3DAsync`, :py:obj:`~.cuMemcpyAtoA`, :py:obj:`~.cuMemcpyAtoD`, :py:obj:`~.cuMemcpyAtoH`, :py:obj:`~.cuMemcpyAtoHAsync`, :py:obj:`~.cuMemcpyDtoA`, :py:obj:`~.cuMemcpyDtoD`, :py:obj:`~.cuMemcpyDtoDAsync`, :py:obj:`~.cuMemcpyDtoH`, :py:obj:`~.cuMemcpyDtoHAsync`, :py:obj:`~.cuMemcpyHtoA`, :py:obj:`~.cuMemcpyHtoAAsync`, :py:obj:`~.cuMemcpyHtoD`, :py:obj:`~.cuMemcpyHtoDAsync`, :py:obj:`~.cuMemFree`, :py:obj:`~.cuMemFreeHost`, :py:obj:`~.cuMemGetAddressRange`, :py:obj:`~.cuMemGetInfo`, :py:obj:`~.cuMemHostAlloc`, :py:obj:`~.cuMemHostGetDevicePointer`, :py:obj:`~.cuMemsetD2D8`, :py:obj:`~.cuMemsetD2D8Async`, :py:obj:`~.cuMemsetD2D16`, :py:obj:`~.cuMemsetD2D16Async`, :py:obj:`~.cuMemsetD2D32`, :py:obj:`~.cuMemsetD2D32Async`, :py:obj:`~.cuMemsetD8`, :py:obj:`~.cuMemsetD8Async`, :py:obj:`~.cuMemsetD16Async`, :py:obj:`~.cuMemsetD32`, :py:obj:`~.cuMemsetD32Async`, :py:obj:`~.cudaMemset` """ - cdef ccuda.CUdeviceptr cdstDevice + cdef cydriver.CUdeviceptr cydstDevice if dstDevice is None: - cdstDevice = 0 + pdstDevice = 0 elif isinstance(dstDevice, (CUdeviceptr,)): pdstDevice = int(dstDevice) - cdstDevice = pdstDevice else: pdstDevice = int(CUdeviceptr(dstDevice)) - cdstDevice = pdstDevice - err = ccuda.cuMemsetD16(cdstDevice, us, N) - return (CUresult(err),) -{{endif}} - -{{if 'cuMemsetD32_v2' in found_functions}} + cydstDevice = pdstDevice + with nogil: + err = cydriver.cuMemsetD16(cydstDevice, us, N) + return (_CUresult(err),) @cython.embedsignature(True) def cuMemsetD32(dstDevice, unsigned int ui, size_t N): @@ -25401,20 +33506,17 @@ def cuMemsetD32(dstDevice, unsigned int ui, size_t N): -------- :py:obj:`~.cuArray3DCreate`, :py:obj:`~.cuArray3DGetDescriptor`, :py:obj:`~.cuArrayCreate`, :py:obj:`~.cuArrayDestroy`, :py:obj:`~.cuArrayGetDescriptor`, :py:obj:`~.cuMemAlloc`, :py:obj:`~.cuMemAllocHost`, :py:obj:`~.cuMemAllocPitch`, :py:obj:`~.cuMemcpy2D`, :py:obj:`~.cuMemcpy2DAsync`, :py:obj:`~.cuMemcpy2DUnaligned`, :py:obj:`~.cuMemcpy3D`, :py:obj:`~.cuMemcpy3DAsync`, :py:obj:`~.cuMemcpyAtoA`, :py:obj:`~.cuMemcpyAtoD`, :py:obj:`~.cuMemcpyAtoH`, :py:obj:`~.cuMemcpyAtoHAsync`, :py:obj:`~.cuMemcpyDtoA`, :py:obj:`~.cuMemcpyDtoD`, :py:obj:`~.cuMemcpyDtoDAsync`, :py:obj:`~.cuMemcpyDtoH`, :py:obj:`~.cuMemcpyDtoHAsync`, :py:obj:`~.cuMemcpyHtoA`, :py:obj:`~.cuMemcpyHtoAAsync`, :py:obj:`~.cuMemcpyHtoD`, :py:obj:`~.cuMemcpyHtoDAsync`, :py:obj:`~.cuMemFree`, :py:obj:`~.cuMemFreeHost`, :py:obj:`~.cuMemGetAddressRange`, :py:obj:`~.cuMemGetInfo`, :py:obj:`~.cuMemHostAlloc`, :py:obj:`~.cuMemHostGetDevicePointer`, :py:obj:`~.cuMemsetD2D8`, :py:obj:`~.cuMemsetD2D8Async`, :py:obj:`~.cuMemsetD2D16`, :py:obj:`~.cuMemsetD2D16Async`, :py:obj:`~.cuMemsetD2D32`, :py:obj:`~.cuMemsetD2D32Async`, :py:obj:`~.cuMemsetD8`, :py:obj:`~.cuMemsetD8Async`, :py:obj:`~.cuMemsetD16`, :py:obj:`~.cuMemsetD16Async`, :py:obj:`~.cuMemsetD32Async`, :py:obj:`~.cudaMemset` """ - cdef ccuda.CUdeviceptr cdstDevice + cdef cydriver.CUdeviceptr cydstDevice if dstDevice is None: - cdstDevice = 0 + pdstDevice = 0 elif isinstance(dstDevice, (CUdeviceptr,)): pdstDevice = int(dstDevice) - cdstDevice = pdstDevice else: pdstDevice = int(CUdeviceptr(dstDevice)) - cdstDevice = pdstDevice - err = ccuda.cuMemsetD32(cdstDevice, ui, N) - return (CUresult(err),) -{{endif}} - -{{if 'cuMemsetD2D8_v2' in found_functions}} + cydstDevice = pdstDevice + with nogil: + err = cydriver.cuMemsetD32(cydstDevice, ui, N) + return (_CUresult(err),) @cython.embedsignature(True) def cuMemsetD2D8(dstDevice, size_t dstPitch, unsigned char uc, size_t Width, size_t Height): @@ -25448,20 +33550,17 @@ def cuMemsetD2D8(dstDevice, size_t dstPitch, unsigned char uc, size_t Width, siz -------- :py:obj:`~.cuArray3DCreate`, :py:obj:`~.cuArray3DGetDescriptor`, :py:obj:`~.cuArrayCreate`, :py:obj:`~.cuArrayDestroy`, :py:obj:`~.cuArrayGetDescriptor`, :py:obj:`~.cuMemAlloc`, :py:obj:`~.cuMemAllocHost`, :py:obj:`~.cuMemAllocPitch`, :py:obj:`~.cuMemcpy2D`, :py:obj:`~.cuMemcpy2DAsync`, :py:obj:`~.cuMemcpy2DUnaligned`, :py:obj:`~.cuMemcpy3D`, :py:obj:`~.cuMemcpy3DAsync`, :py:obj:`~.cuMemcpyAtoA`, :py:obj:`~.cuMemcpyAtoD`, :py:obj:`~.cuMemcpyAtoH`, :py:obj:`~.cuMemcpyAtoHAsync`, :py:obj:`~.cuMemcpyDtoA`, :py:obj:`~.cuMemcpyDtoD`, :py:obj:`~.cuMemcpyDtoDAsync`, :py:obj:`~.cuMemcpyDtoH`, :py:obj:`~.cuMemcpyDtoHAsync`, :py:obj:`~.cuMemcpyHtoA`, :py:obj:`~.cuMemcpyHtoAAsync`, :py:obj:`~.cuMemcpyHtoD`, :py:obj:`~.cuMemcpyHtoDAsync`, :py:obj:`~.cuMemFree`, :py:obj:`~.cuMemFreeHost`, :py:obj:`~.cuMemGetAddressRange`, :py:obj:`~.cuMemGetInfo`, :py:obj:`~.cuMemHostAlloc`, :py:obj:`~.cuMemHostGetDevicePointer`, :py:obj:`~.cuMemsetD2D8Async`, :py:obj:`~.cuMemsetD2D16`, :py:obj:`~.cuMemsetD2D16Async`, :py:obj:`~.cuMemsetD2D32`, :py:obj:`~.cuMemsetD2D32Async`, :py:obj:`~.cuMemsetD8`, :py:obj:`~.cuMemsetD8Async`, :py:obj:`~.cuMemsetD16`, :py:obj:`~.cuMemsetD16Async`, :py:obj:`~.cuMemsetD32`, :py:obj:`~.cuMemsetD32Async`, :py:obj:`~.cudaMemset2D` """ - cdef ccuda.CUdeviceptr cdstDevice + cdef cydriver.CUdeviceptr cydstDevice if dstDevice is None: - cdstDevice = 0 + pdstDevice = 0 elif isinstance(dstDevice, (CUdeviceptr,)): pdstDevice = int(dstDevice) - cdstDevice = pdstDevice else: pdstDevice = int(CUdeviceptr(dstDevice)) - cdstDevice = pdstDevice - err = ccuda.cuMemsetD2D8(cdstDevice, dstPitch, uc, Width, Height) - return (CUresult(err),) -{{endif}} - -{{if 'cuMemsetD2D16_v2' in found_functions}} + cydstDevice = pdstDevice + with nogil: + err = cydriver.cuMemsetD2D8(cydstDevice, dstPitch, uc, Width, Height) + return (_CUresult(err),) @cython.embedsignature(True) def cuMemsetD2D16(dstDevice, size_t dstPitch, unsigned short us, size_t Width, size_t Height): @@ -25496,20 +33595,17 @@ def cuMemsetD2D16(dstDevice, size_t dstPitch, unsigned short us, size_t Width, s -------- :py:obj:`~.cuArray3DCreate`, :py:obj:`~.cuArray3DGetDescriptor`, :py:obj:`~.cuArrayCreate`, :py:obj:`~.cuArrayDestroy`, :py:obj:`~.cuArrayGetDescriptor`, :py:obj:`~.cuMemAlloc`, :py:obj:`~.cuMemAllocHost`, :py:obj:`~.cuMemAllocPitch`, :py:obj:`~.cuMemcpy2D`, :py:obj:`~.cuMemcpy2DAsync`, :py:obj:`~.cuMemcpy2DUnaligned`, :py:obj:`~.cuMemcpy3D`, :py:obj:`~.cuMemcpy3DAsync`, :py:obj:`~.cuMemcpyAtoA`, :py:obj:`~.cuMemcpyAtoD`, :py:obj:`~.cuMemcpyAtoH`, :py:obj:`~.cuMemcpyAtoHAsync`, :py:obj:`~.cuMemcpyDtoA`, :py:obj:`~.cuMemcpyDtoD`, :py:obj:`~.cuMemcpyDtoDAsync`, :py:obj:`~.cuMemcpyDtoH`, :py:obj:`~.cuMemcpyDtoHAsync`, :py:obj:`~.cuMemcpyHtoA`, :py:obj:`~.cuMemcpyHtoAAsync`, :py:obj:`~.cuMemcpyHtoD`, :py:obj:`~.cuMemcpyHtoDAsync`, :py:obj:`~.cuMemFree`, :py:obj:`~.cuMemFreeHost`, :py:obj:`~.cuMemGetAddressRange`, :py:obj:`~.cuMemGetInfo`, :py:obj:`~.cuMemHostAlloc`, :py:obj:`~.cuMemHostGetDevicePointer`, :py:obj:`~.cuMemsetD2D8`, :py:obj:`~.cuMemsetD2D8Async`, :py:obj:`~.cuMemsetD2D16Async`, :py:obj:`~.cuMemsetD2D32`, :py:obj:`~.cuMemsetD2D32Async`, :py:obj:`~.cuMemsetD8`, :py:obj:`~.cuMemsetD8Async`, :py:obj:`~.cuMemsetD16`, :py:obj:`~.cuMemsetD16Async`, :py:obj:`~.cuMemsetD32`, :py:obj:`~.cuMemsetD32Async`, :py:obj:`~.cudaMemset2D` """ - cdef ccuda.CUdeviceptr cdstDevice + cdef cydriver.CUdeviceptr cydstDevice if dstDevice is None: - cdstDevice = 0 + pdstDevice = 0 elif isinstance(dstDevice, (CUdeviceptr,)): pdstDevice = int(dstDevice) - cdstDevice = pdstDevice else: pdstDevice = int(CUdeviceptr(dstDevice)) - cdstDevice = pdstDevice - err = ccuda.cuMemsetD2D16(cdstDevice, dstPitch, us, Width, Height) - return (CUresult(err),) -{{endif}} - -{{if 'cuMemsetD2D32_v2' in found_functions}} + cydstDevice = pdstDevice + with nogil: + err = cydriver.cuMemsetD2D16(cydstDevice, dstPitch, us, Width, Height) + return (_CUresult(err),) @cython.embedsignature(True) def cuMemsetD2D32(dstDevice, size_t dstPitch, unsigned int ui, size_t Width, size_t Height): @@ -25544,20 +33640,17 @@ def cuMemsetD2D32(dstDevice, size_t dstPitch, unsigned int ui, size_t Width, siz -------- :py:obj:`~.cuArray3DCreate`, :py:obj:`~.cuArray3DGetDescriptor`, :py:obj:`~.cuArrayCreate`, :py:obj:`~.cuArrayDestroy`, :py:obj:`~.cuArrayGetDescriptor`, :py:obj:`~.cuMemAlloc`, :py:obj:`~.cuMemAllocHost`, :py:obj:`~.cuMemAllocPitch`, :py:obj:`~.cuMemcpy2D`, :py:obj:`~.cuMemcpy2DAsync`, :py:obj:`~.cuMemcpy2DUnaligned`, :py:obj:`~.cuMemcpy3D`, :py:obj:`~.cuMemcpy3DAsync`, :py:obj:`~.cuMemcpyAtoA`, :py:obj:`~.cuMemcpyAtoD`, :py:obj:`~.cuMemcpyAtoH`, :py:obj:`~.cuMemcpyAtoHAsync`, :py:obj:`~.cuMemcpyDtoA`, :py:obj:`~.cuMemcpyDtoD`, :py:obj:`~.cuMemcpyDtoDAsync`, :py:obj:`~.cuMemcpyDtoH`, :py:obj:`~.cuMemcpyDtoHAsync`, :py:obj:`~.cuMemcpyHtoA`, :py:obj:`~.cuMemcpyHtoAAsync`, :py:obj:`~.cuMemcpyHtoD`, :py:obj:`~.cuMemcpyHtoDAsync`, :py:obj:`~.cuMemFree`, :py:obj:`~.cuMemFreeHost`, :py:obj:`~.cuMemGetAddressRange`, :py:obj:`~.cuMemGetInfo`, :py:obj:`~.cuMemHostAlloc`, :py:obj:`~.cuMemHostGetDevicePointer`, :py:obj:`~.cuMemsetD2D8`, :py:obj:`~.cuMemsetD2D8Async`, :py:obj:`~.cuMemsetD2D16`, :py:obj:`~.cuMemsetD2D16Async`, :py:obj:`~.cuMemsetD2D32Async`, :py:obj:`~.cuMemsetD8`, :py:obj:`~.cuMemsetD8Async`, :py:obj:`~.cuMemsetD16`, :py:obj:`~.cuMemsetD16Async`, :py:obj:`~.cuMemsetD32`, :py:obj:`~.cuMemsetD32Async`, :py:obj:`~.cudaMemset2D` """ - cdef ccuda.CUdeviceptr cdstDevice + cdef cydriver.CUdeviceptr cydstDevice if dstDevice is None: - cdstDevice = 0 + pdstDevice = 0 elif isinstance(dstDevice, (CUdeviceptr,)): pdstDevice = int(dstDevice) - cdstDevice = pdstDevice else: pdstDevice = int(CUdeviceptr(dstDevice)) - cdstDevice = pdstDevice - err = ccuda.cuMemsetD2D32(cdstDevice, dstPitch, ui, Width, Height) - return (CUresult(err),) -{{endif}} - -{{if 'cuMemsetD8Async' in found_functions}} + cydstDevice = pdstDevice + with nogil: + err = cydriver.cuMemsetD2D32(cydstDevice, dstPitch, ui, Width, Height) + return (_CUresult(err),) @cython.embedsignature(True) def cuMemsetD8Async(dstDevice, unsigned char uc, size_t N, hStream): @@ -25585,29 +33678,25 @@ def cuMemsetD8Async(dstDevice, unsigned char uc, size_t N, hStream): -------- :py:obj:`~.cuArray3DCreate`, :py:obj:`~.cuArray3DGetDescriptor`, :py:obj:`~.cuArrayCreate`, :py:obj:`~.cuArrayDestroy`, :py:obj:`~.cuArrayGetDescriptor`, :py:obj:`~.cuMemAlloc`, :py:obj:`~.cuMemAllocHost`, :py:obj:`~.cuMemAllocPitch`, :py:obj:`~.cuMemcpy2D`, :py:obj:`~.cuMemcpy2DAsync`, :py:obj:`~.cuMemcpy2DUnaligned`, :py:obj:`~.cuMemcpy3D`, :py:obj:`~.cuMemcpy3DAsync`, :py:obj:`~.cuMemcpyAtoA`, :py:obj:`~.cuMemcpyAtoD`, :py:obj:`~.cuMemcpyAtoH`, :py:obj:`~.cuMemcpyAtoHAsync`, :py:obj:`~.cuMemcpyDtoA`, :py:obj:`~.cuMemcpyDtoD`, :py:obj:`~.cuMemcpyDtoDAsync`, :py:obj:`~.cuMemcpyDtoH`, :py:obj:`~.cuMemcpyDtoHAsync`, :py:obj:`~.cuMemcpyHtoA`, :py:obj:`~.cuMemcpyHtoAAsync`, :py:obj:`~.cuMemcpyHtoD`, :py:obj:`~.cuMemcpyHtoDAsync`, :py:obj:`~.cuMemFree`, :py:obj:`~.cuMemFreeHost`, :py:obj:`~.cuMemGetAddressRange`, :py:obj:`~.cuMemGetInfo`, :py:obj:`~.cuMemHostAlloc`, :py:obj:`~.cuMemHostGetDevicePointer`, :py:obj:`~.cuMemsetD2D8`, :py:obj:`~.cuMemsetD2D8Async`, :py:obj:`~.cuMemsetD2D16`, :py:obj:`~.cuMemsetD2D16Async`, :py:obj:`~.cuMemsetD2D32`, :py:obj:`~.cuMemsetD2D32Async`, :py:obj:`~.cuMemsetD8`, :py:obj:`~.cuMemsetD16`, :py:obj:`~.cuMemsetD16Async`, :py:obj:`~.cuMemsetD32`, :py:obj:`~.cuMemsetD32Async`, :py:obj:`~.cudaMemsetAsync` """ - cdef ccuda.CUstream chStream + cdef cydriver.CUstream cyhStream if hStream is None: - chStream = 0 + phStream = 0 elif isinstance(hStream, (CUstream,)): phStream = int(hStream) - chStream = phStream else: phStream = int(CUstream(hStream)) - chStream = phStream - cdef ccuda.CUdeviceptr cdstDevice + cyhStream = phStream + cdef cydriver.CUdeviceptr cydstDevice if dstDevice is None: - cdstDevice = 0 + pdstDevice = 0 elif isinstance(dstDevice, (CUdeviceptr,)): pdstDevice = int(dstDevice) - cdstDevice = pdstDevice else: pdstDevice = int(CUdeviceptr(dstDevice)) - cdstDevice = pdstDevice - err = ccuda.cuMemsetD8Async(cdstDevice, uc, N, chStream) - return (CUresult(err),) -{{endif}} - -{{if 'cuMemsetD16Async' in found_functions}} + cydstDevice = pdstDevice + with nogil: + err = cydriver.cuMemsetD8Async(cydstDevice, uc, N, cyhStream) + return (_CUresult(err),) @cython.embedsignature(True) def cuMemsetD16Async(dstDevice, unsigned short us, size_t N, hStream): @@ -25636,29 +33725,25 @@ def cuMemsetD16Async(dstDevice, unsigned short us, size_t N, hStream): -------- :py:obj:`~.cuArray3DCreate`, :py:obj:`~.cuArray3DGetDescriptor`, :py:obj:`~.cuArrayCreate`, :py:obj:`~.cuArrayDestroy`, :py:obj:`~.cuArrayGetDescriptor`, :py:obj:`~.cuMemAlloc`, :py:obj:`~.cuMemAllocHost`, :py:obj:`~.cuMemAllocPitch`, :py:obj:`~.cuMemcpy2D`, :py:obj:`~.cuMemcpy2DAsync`, :py:obj:`~.cuMemcpy2DUnaligned`, :py:obj:`~.cuMemcpy3D`, :py:obj:`~.cuMemcpy3DAsync`, :py:obj:`~.cuMemcpyAtoA`, :py:obj:`~.cuMemcpyAtoD`, :py:obj:`~.cuMemcpyAtoH`, :py:obj:`~.cuMemcpyAtoHAsync`, :py:obj:`~.cuMemcpyDtoA`, :py:obj:`~.cuMemcpyDtoD`, :py:obj:`~.cuMemcpyDtoDAsync`, :py:obj:`~.cuMemcpyDtoH`, :py:obj:`~.cuMemcpyDtoHAsync`, :py:obj:`~.cuMemcpyHtoA`, :py:obj:`~.cuMemcpyHtoAAsync`, :py:obj:`~.cuMemcpyHtoD`, :py:obj:`~.cuMemcpyHtoDAsync`, :py:obj:`~.cuMemFree`, :py:obj:`~.cuMemFreeHost`, :py:obj:`~.cuMemGetAddressRange`, :py:obj:`~.cuMemGetInfo`, :py:obj:`~.cuMemHostAlloc`, :py:obj:`~.cuMemHostGetDevicePointer`, :py:obj:`~.cuMemsetD2D8`, :py:obj:`~.cuMemsetD2D8Async`, :py:obj:`~.cuMemsetD2D16`, :py:obj:`~.cuMemsetD2D16Async`, :py:obj:`~.cuMemsetD2D32`, :py:obj:`~.cuMemsetD2D32Async`, :py:obj:`~.cuMemsetD8`, :py:obj:`~.cuMemsetD8Async`, :py:obj:`~.cuMemsetD16`, :py:obj:`~.cuMemsetD32`, :py:obj:`~.cuMemsetD32Async`, :py:obj:`~.cudaMemsetAsync` """ - cdef ccuda.CUstream chStream + cdef cydriver.CUstream cyhStream if hStream is None: - chStream = 0 + phStream = 0 elif isinstance(hStream, (CUstream,)): phStream = int(hStream) - chStream = phStream else: phStream = int(CUstream(hStream)) - chStream = phStream - cdef ccuda.CUdeviceptr cdstDevice + cyhStream = phStream + cdef cydriver.CUdeviceptr cydstDevice if dstDevice is None: - cdstDevice = 0 + pdstDevice = 0 elif isinstance(dstDevice, (CUdeviceptr,)): pdstDevice = int(dstDevice) - cdstDevice = pdstDevice else: pdstDevice = int(CUdeviceptr(dstDevice)) - cdstDevice = pdstDevice - err = ccuda.cuMemsetD16Async(cdstDevice, us, N, chStream) - return (CUresult(err),) -{{endif}} - -{{if 'cuMemsetD32Async' in found_functions}} + cydstDevice = pdstDevice + with nogil: + err = cydriver.cuMemsetD16Async(cydstDevice, us, N, cyhStream) + return (_CUresult(err),) @cython.embedsignature(True) def cuMemsetD32Async(dstDevice, unsigned int ui, size_t N, hStream): @@ -25687,29 +33772,25 @@ def cuMemsetD32Async(dstDevice, unsigned int ui, size_t N, hStream): -------- :py:obj:`~.cuArray3DCreate`, :py:obj:`~.cuArray3DGetDescriptor`, :py:obj:`~.cuArrayCreate`, :py:obj:`~.cuArrayDestroy`, :py:obj:`~.cuArrayGetDescriptor`, :py:obj:`~.cuMemAlloc`, :py:obj:`~.cuMemAllocHost`, :py:obj:`~.cuMemAllocPitch`, :py:obj:`~.cuMemcpy2D`, :py:obj:`~.cuMemcpy2DAsync`, :py:obj:`~.cuMemcpy2DUnaligned`, :py:obj:`~.cuMemcpy3D`, :py:obj:`~.cuMemcpy3DAsync`, :py:obj:`~.cuMemcpyAtoA`, :py:obj:`~.cuMemcpyAtoD`, :py:obj:`~.cuMemcpyAtoH`, :py:obj:`~.cuMemcpyAtoHAsync`, :py:obj:`~.cuMemcpyDtoA`, :py:obj:`~.cuMemcpyDtoD`, :py:obj:`~.cuMemcpyDtoDAsync`, :py:obj:`~.cuMemcpyDtoH`, :py:obj:`~.cuMemcpyDtoHAsync`, :py:obj:`~.cuMemcpyHtoA`, :py:obj:`~.cuMemcpyHtoAAsync`, :py:obj:`~.cuMemcpyHtoD`, :py:obj:`~.cuMemcpyHtoDAsync`, :py:obj:`~.cuMemFree`, :py:obj:`~.cuMemFreeHost`, :py:obj:`~.cuMemGetAddressRange`, :py:obj:`~.cuMemGetInfo`, :py:obj:`~.cuMemHostAlloc`, :py:obj:`~.cuMemHostGetDevicePointer`, :py:obj:`~.cuMemsetD2D8`, :py:obj:`~.cuMemsetD2D8Async`, :py:obj:`~.cuMemsetD2D16`, :py:obj:`~.cuMemsetD2D16Async`, :py:obj:`~.cuMemsetD2D32`, :py:obj:`~.cuMemsetD2D32Async`, :py:obj:`~.cuMemsetD8`, :py:obj:`~.cuMemsetD8Async`, :py:obj:`~.cuMemsetD16`, :py:obj:`~.cuMemsetD16Async`, :py:obj:`~.cuMemsetD32`, :py:obj:`~.cudaMemsetAsync` """ - cdef ccuda.CUstream chStream + cdef cydriver.CUstream cyhStream if hStream is None: - chStream = 0 + phStream = 0 elif isinstance(hStream, (CUstream,)): phStream = int(hStream) - chStream = phStream else: phStream = int(CUstream(hStream)) - chStream = phStream - cdef ccuda.CUdeviceptr cdstDevice + cyhStream = phStream + cdef cydriver.CUdeviceptr cydstDevice if dstDevice is None: - cdstDevice = 0 + pdstDevice = 0 elif isinstance(dstDevice, (CUdeviceptr,)): pdstDevice = int(dstDevice) - cdstDevice = pdstDevice else: pdstDevice = int(CUdeviceptr(dstDevice)) - cdstDevice = pdstDevice - err = ccuda.cuMemsetD32Async(cdstDevice, ui, N, chStream) - return (CUresult(err),) -{{endif}} - -{{if 'cuMemsetD2D8Async' in found_functions}} + cydstDevice = pdstDevice + with nogil: + err = cydriver.cuMemsetD32Async(cydstDevice, ui, N, cyhStream) + return (_CUresult(err),) @cython.embedsignature(True) def cuMemsetD2D8Async(dstDevice, size_t dstPitch, unsigned char uc, size_t Width, size_t Height, hStream): @@ -25745,29 +33826,25 @@ def cuMemsetD2D8Async(dstDevice, size_t dstPitch, unsigned char uc, size_t Width -------- :py:obj:`~.cuArray3DCreate`, :py:obj:`~.cuArray3DGetDescriptor`, :py:obj:`~.cuArrayCreate`, :py:obj:`~.cuArrayDestroy`, :py:obj:`~.cuArrayGetDescriptor`, :py:obj:`~.cuMemAlloc`, :py:obj:`~.cuMemAllocHost`, :py:obj:`~.cuMemAllocPitch`, :py:obj:`~.cuMemcpy2D`, :py:obj:`~.cuMemcpy2DAsync`, :py:obj:`~.cuMemcpy2DUnaligned`, :py:obj:`~.cuMemcpy3D`, :py:obj:`~.cuMemcpy3DAsync`, :py:obj:`~.cuMemcpyAtoA`, :py:obj:`~.cuMemcpyAtoD`, :py:obj:`~.cuMemcpyAtoH`, :py:obj:`~.cuMemcpyAtoHAsync`, :py:obj:`~.cuMemcpyDtoA`, :py:obj:`~.cuMemcpyDtoD`, :py:obj:`~.cuMemcpyDtoDAsync`, :py:obj:`~.cuMemcpyDtoH`, :py:obj:`~.cuMemcpyDtoHAsync`, :py:obj:`~.cuMemcpyHtoA`, :py:obj:`~.cuMemcpyHtoAAsync`, :py:obj:`~.cuMemcpyHtoD`, :py:obj:`~.cuMemcpyHtoDAsync`, :py:obj:`~.cuMemFree`, :py:obj:`~.cuMemFreeHost`, :py:obj:`~.cuMemGetAddressRange`, :py:obj:`~.cuMemGetInfo`, :py:obj:`~.cuMemHostAlloc`, :py:obj:`~.cuMemHostGetDevicePointer`, :py:obj:`~.cuMemsetD2D8`, :py:obj:`~.cuMemsetD2D16`, :py:obj:`~.cuMemsetD2D16Async`, :py:obj:`~.cuMemsetD2D32`, :py:obj:`~.cuMemsetD2D32Async`, :py:obj:`~.cuMemsetD8`, :py:obj:`~.cuMemsetD8Async`, :py:obj:`~.cuMemsetD16`, :py:obj:`~.cuMemsetD16Async`, :py:obj:`~.cuMemsetD32`, :py:obj:`~.cuMemsetD32Async`, :py:obj:`~.cudaMemset2DAsync` """ - cdef ccuda.CUstream chStream + cdef cydriver.CUstream cyhStream if hStream is None: - chStream = 0 + phStream = 0 elif isinstance(hStream, (CUstream,)): phStream = int(hStream) - chStream = phStream else: phStream = int(CUstream(hStream)) - chStream = phStream - cdef ccuda.CUdeviceptr cdstDevice + cyhStream = phStream + cdef cydriver.CUdeviceptr cydstDevice if dstDevice is None: - cdstDevice = 0 + pdstDevice = 0 elif isinstance(dstDevice, (CUdeviceptr,)): pdstDevice = int(dstDevice) - cdstDevice = pdstDevice else: pdstDevice = int(CUdeviceptr(dstDevice)) - cdstDevice = pdstDevice - err = ccuda.cuMemsetD2D8Async(cdstDevice, dstPitch, uc, Width, Height, chStream) - return (CUresult(err),) -{{endif}} - -{{if 'cuMemsetD2D16Async' in found_functions}} + cydstDevice = pdstDevice + with nogil: + err = cydriver.cuMemsetD2D8Async(cydstDevice, dstPitch, uc, Width, Height, cyhStream) + return (_CUresult(err),) @cython.embedsignature(True) def cuMemsetD2D16Async(dstDevice, size_t dstPitch, unsigned short us, size_t Width, size_t Height, hStream): @@ -25804,29 +33881,25 @@ def cuMemsetD2D16Async(dstDevice, size_t dstPitch, unsigned short us, size_t Wid -------- :py:obj:`~.cuArray3DCreate`, :py:obj:`~.cuArray3DGetDescriptor`, :py:obj:`~.cuArrayCreate`, :py:obj:`~.cuArrayDestroy`, :py:obj:`~.cuArrayGetDescriptor`, :py:obj:`~.cuMemAlloc`, :py:obj:`~.cuMemAllocHost`, :py:obj:`~.cuMemAllocPitch`, :py:obj:`~.cuMemcpy2D`, :py:obj:`~.cuMemcpy2DAsync`, :py:obj:`~.cuMemcpy2DUnaligned`, :py:obj:`~.cuMemcpy3D`, :py:obj:`~.cuMemcpy3DAsync`, :py:obj:`~.cuMemcpyAtoA`, :py:obj:`~.cuMemcpyAtoD`, :py:obj:`~.cuMemcpyAtoH`, :py:obj:`~.cuMemcpyAtoHAsync`, :py:obj:`~.cuMemcpyDtoA`, :py:obj:`~.cuMemcpyDtoD`, :py:obj:`~.cuMemcpyDtoDAsync`, :py:obj:`~.cuMemcpyDtoH`, :py:obj:`~.cuMemcpyDtoHAsync`, :py:obj:`~.cuMemcpyHtoA`, :py:obj:`~.cuMemcpyHtoAAsync`, :py:obj:`~.cuMemcpyHtoD`, :py:obj:`~.cuMemcpyHtoDAsync`, :py:obj:`~.cuMemFree`, :py:obj:`~.cuMemFreeHost`, :py:obj:`~.cuMemGetAddressRange`, :py:obj:`~.cuMemGetInfo`, :py:obj:`~.cuMemHostAlloc`, :py:obj:`~.cuMemHostGetDevicePointer`, :py:obj:`~.cuMemsetD2D8`, :py:obj:`~.cuMemsetD2D8Async`, :py:obj:`~.cuMemsetD2D16`, :py:obj:`~.cuMemsetD2D32`, :py:obj:`~.cuMemsetD2D32Async`, :py:obj:`~.cuMemsetD8`, :py:obj:`~.cuMemsetD8Async`, :py:obj:`~.cuMemsetD16`, :py:obj:`~.cuMemsetD16Async`, :py:obj:`~.cuMemsetD32`, :py:obj:`~.cuMemsetD32Async`, :py:obj:`~.cudaMemset2DAsync` """ - cdef ccuda.CUstream chStream + cdef cydriver.CUstream cyhStream if hStream is None: - chStream = 0 + phStream = 0 elif isinstance(hStream, (CUstream,)): phStream = int(hStream) - chStream = phStream else: phStream = int(CUstream(hStream)) - chStream = phStream - cdef ccuda.CUdeviceptr cdstDevice + cyhStream = phStream + cdef cydriver.CUdeviceptr cydstDevice if dstDevice is None: - cdstDevice = 0 + pdstDevice = 0 elif isinstance(dstDevice, (CUdeviceptr,)): pdstDevice = int(dstDevice) - cdstDevice = pdstDevice else: pdstDevice = int(CUdeviceptr(dstDevice)) - cdstDevice = pdstDevice - err = ccuda.cuMemsetD2D16Async(cdstDevice, dstPitch, us, Width, Height, chStream) - return (CUresult(err),) -{{endif}} - -{{if 'cuMemsetD2D32Async' in found_functions}} + cydstDevice = pdstDevice + with nogil: + err = cydriver.cuMemsetD2D16Async(cydstDevice, dstPitch, us, Width, Height, cyhStream) + return (_CUresult(err),) @cython.embedsignature(True) def cuMemsetD2D32Async(dstDevice, size_t dstPitch, unsigned int ui, size_t Width, size_t Height, hStream): @@ -25863,29 +33936,25 @@ def cuMemsetD2D32Async(dstDevice, size_t dstPitch, unsigned int ui, size_t Width -------- :py:obj:`~.cuArray3DCreate`, :py:obj:`~.cuArray3DGetDescriptor`, :py:obj:`~.cuArrayCreate`, :py:obj:`~.cuArrayDestroy`, :py:obj:`~.cuArrayGetDescriptor`, :py:obj:`~.cuMemAlloc`, :py:obj:`~.cuMemAllocHost`, :py:obj:`~.cuMemAllocPitch`, :py:obj:`~.cuMemcpy2D`, :py:obj:`~.cuMemcpy2DAsync`, :py:obj:`~.cuMemcpy2DUnaligned`, :py:obj:`~.cuMemcpy3D`, :py:obj:`~.cuMemcpy3DAsync`, :py:obj:`~.cuMemcpyAtoA`, :py:obj:`~.cuMemcpyAtoD`, :py:obj:`~.cuMemcpyAtoH`, :py:obj:`~.cuMemcpyAtoHAsync`, :py:obj:`~.cuMemcpyDtoA`, :py:obj:`~.cuMemcpyDtoD`, :py:obj:`~.cuMemcpyDtoDAsync`, :py:obj:`~.cuMemcpyDtoH`, :py:obj:`~.cuMemcpyDtoHAsync`, :py:obj:`~.cuMemcpyHtoA`, :py:obj:`~.cuMemcpyHtoAAsync`, :py:obj:`~.cuMemcpyHtoD`, :py:obj:`~.cuMemcpyHtoDAsync`, :py:obj:`~.cuMemFree`, :py:obj:`~.cuMemFreeHost`, :py:obj:`~.cuMemGetAddressRange`, :py:obj:`~.cuMemGetInfo`, :py:obj:`~.cuMemHostAlloc`, :py:obj:`~.cuMemHostGetDevicePointer`, :py:obj:`~.cuMemsetD2D8`, :py:obj:`~.cuMemsetD2D8Async`, :py:obj:`~.cuMemsetD2D16`, :py:obj:`~.cuMemsetD2D16Async`, :py:obj:`~.cuMemsetD2D32`, :py:obj:`~.cuMemsetD8`, :py:obj:`~.cuMemsetD8Async`, :py:obj:`~.cuMemsetD16`, :py:obj:`~.cuMemsetD16Async`, :py:obj:`~.cuMemsetD32`, :py:obj:`~.cuMemsetD32Async`, :py:obj:`~.cudaMemset2DAsync` """ - cdef ccuda.CUstream chStream + cdef cydriver.CUstream cyhStream if hStream is None: - chStream = 0 + phStream = 0 elif isinstance(hStream, (CUstream,)): phStream = int(hStream) - chStream = phStream else: phStream = int(CUstream(hStream)) - chStream = phStream - cdef ccuda.CUdeviceptr cdstDevice + cyhStream = phStream + cdef cydriver.CUdeviceptr cydstDevice if dstDevice is None: - cdstDevice = 0 + pdstDevice = 0 elif isinstance(dstDevice, (CUdeviceptr,)): pdstDevice = int(dstDevice) - cdstDevice = pdstDevice else: pdstDevice = int(CUdeviceptr(dstDevice)) - cdstDevice = pdstDevice - err = ccuda.cuMemsetD2D32Async(cdstDevice, dstPitch, ui, Width, Height, chStream) - return (CUresult(err),) -{{endif}} - -{{if 'cuArrayCreate_v2' in found_functions}} + cydstDevice = pdstDevice + with nogil: + err = cydriver.cuMemsetD2D32Async(cydstDevice, dstPitch, ui, Width, Height, cyhStream) + return (_CUresult(err),) @cython.embedsignature(True) def cuArrayCreate(pAllocateArray : Optional[CUDA_ARRAY_DESCRIPTOR]): @@ -25948,12 +34017,12 @@ def cuArrayCreate(pAllocateArray : Optional[CUDA_ARRAY_DESCRIPTOR]): :py:obj:`~.cuArray3DCreate`, :py:obj:`~.cuArray3DGetDescriptor`, :py:obj:`~.cuArrayDestroy`, :py:obj:`~.cuArrayGetDescriptor`, :py:obj:`~.cuMemAlloc`, :py:obj:`~.cuMemAllocHost`, :py:obj:`~.cuMemAllocPitch`, :py:obj:`~.cuMemcpy2D`, :py:obj:`~.cuMemcpy2DAsync`, :py:obj:`~.cuMemcpy2DUnaligned`, :py:obj:`~.cuMemcpy3D`, :py:obj:`~.cuMemcpy3DAsync`, :py:obj:`~.cuMemcpyAtoA`, :py:obj:`~.cuMemcpyAtoD`, :py:obj:`~.cuMemcpyAtoH`, :py:obj:`~.cuMemcpyAtoHAsync`, :py:obj:`~.cuMemcpyDtoA`, :py:obj:`~.cuMemcpyDtoD`, :py:obj:`~.cuMemcpyDtoDAsync`, :py:obj:`~.cuMemcpyDtoH`, :py:obj:`~.cuMemcpyDtoHAsync`, :py:obj:`~.cuMemcpyHtoA`, :py:obj:`~.cuMemcpyHtoAAsync`, :py:obj:`~.cuMemcpyHtoD`, :py:obj:`~.cuMemcpyHtoDAsync`, :py:obj:`~.cuMemFree`, :py:obj:`~.cuMemFreeHost`, :py:obj:`~.cuMemGetAddressRange`, :py:obj:`~.cuMemGetInfo`, :py:obj:`~.cuMemHostAlloc`, :py:obj:`~.cuMemHostGetDevicePointer`, :py:obj:`~.cuMemsetD2D8`, :py:obj:`~.cuMemsetD2D16`, :py:obj:`~.cuMemsetD2D32`, :py:obj:`~.cuMemsetD8`, :py:obj:`~.cuMemsetD16`, :py:obj:`~.cuMemsetD32`, :py:obj:`~.cudaMallocArray` """ cdef CUarray pHandle = CUarray() - cdef ccuda.CUDA_ARRAY_DESCRIPTOR* cpAllocateArray_ptr = pAllocateArray._ptr if pAllocateArray != None else NULL - err = ccuda.cuArrayCreate(pHandle._ptr, cpAllocateArray_ptr) - return (CUresult(err), pHandle) -{{endif}} - -{{if 'cuArrayGetDescriptor_v2' in found_functions}} + cdef cydriver.CUDA_ARRAY_DESCRIPTOR* cypAllocateArray_ptr = pAllocateArray._pvt_ptr if pAllocateArray is not None else NULL + with nogil: + err = cydriver.cuArrayCreate(pHandle._pvt_ptr, cypAllocateArray_ptr) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pHandle) @cython.embedsignature(True) def cuArrayGetDescriptor(hArray): @@ -25980,21 +34049,20 @@ def cuArrayGetDescriptor(hArray): -------- :py:obj:`~.cuArray3DCreate`, :py:obj:`~.cuArray3DGetDescriptor`, :py:obj:`~.cuArrayCreate`, :py:obj:`~.cuArrayDestroy`, :py:obj:`~.cuMemAlloc`, :py:obj:`~.cuMemAllocHost`, :py:obj:`~.cuMemAllocPitch`, :py:obj:`~.cuMemcpy2D`, :py:obj:`~.cuMemcpy2DAsync`, :py:obj:`~.cuMemcpy2DUnaligned`, :py:obj:`~.cuMemcpy3D`, :py:obj:`~.cuMemcpy3DAsync`, :py:obj:`~.cuMemcpyAtoA`, :py:obj:`~.cuMemcpyAtoD`, :py:obj:`~.cuMemcpyAtoH`, :py:obj:`~.cuMemcpyAtoHAsync`, :py:obj:`~.cuMemcpyDtoA`, :py:obj:`~.cuMemcpyDtoD`, :py:obj:`~.cuMemcpyDtoDAsync`, :py:obj:`~.cuMemcpyDtoH`, :py:obj:`~.cuMemcpyDtoHAsync`, :py:obj:`~.cuMemcpyHtoA`, :py:obj:`~.cuMemcpyHtoAAsync`, :py:obj:`~.cuMemcpyHtoD`, :py:obj:`~.cuMemcpyHtoDAsync`, :py:obj:`~.cuMemFree`, :py:obj:`~.cuMemFreeHost`, :py:obj:`~.cuMemGetAddressRange`, :py:obj:`~.cuMemGetInfo`, :py:obj:`~.cuMemHostAlloc`, :py:obj:`~.cuMemHostGetDevicePointer`, :py:obj:`~.cuMemsetD2D8`, :py:obj:`~.cuMemsetD2D16`, :py:obj:`~.cuMemsetD2D32`, :py:obj:`~.cuMemsetD8`, :py:obj:`~.cuMemsetD16`, :py:obj:`~.cuMemsetD32`, :py:obj:`~.cudaArrayGetInfo` """ - cdef ccuda.CUarray chArray + cdef cydriver.CUarray cyhArray if hArray is None: - chArray = 0 + phArray = 0 elif isinstance(hArray, (CUarray,)): phArray = int(hArray) - chArray = phArray else: phArray = int(CUarray(hArray)) - chArray = phArray + cyhArray = phArray cdef CUDA_ARRAY_DESCRIPTOR pArrayDescriptor = CUDA_ARRAY_DESCRIPTOR() - err = ccuda.cuArrayGetDescriptor(pArrayDescriptor._ptr, chArray) - return (CUresult(err), pArrayDescriptor) -{{endif}} - -{{if 'cuArrayGetSparseProperties' in found_functions}} + with nogil: + err = cydriver.cuArrayGetDescriptor(pArrayDescriptor._pvt_ptr, cyhArray) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pArrayDescriptor) @cython.embedsignature(True) def cuArrayGetSparseProperties(array): @@ -26034,21 +34102,20 @@ def cuArrayGetSparseProperties(array): -------- :py:obj:`~.cuMipmappedArrayGetSparseProperties`, :py:obj:`~.cuMemMapArrayAsync` """ - cdef ccuda.CUarray carray + cdef cydriver.CUarray cyarray if array is None: - carray = 0 + parray = 0 elif isinstance(array, (CUarray,)): parray = int(array) - carray = parray else: parray = int(CUarray(array)) - carray = parray + cyarray = parray cdef CUDA_ARRAY_SPARSE_PROPERTIES sparseProperties = CUDA_ARRAY_SPARSE_PROPERTIES() - err = ccuda.cuArrayGetSparseProperties(sparseProperties._ptr, carray) - return (CUresult(err), sparseProperties) -{{endif}} - -{{if 'cuMipmappedArrayGetSparseProperties' in found_functions}} + with nogil: + err = cydriver.cuArrayGetSparseProperties(sparseProperties._pvt_ptr, cyarray) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, sparseProperties) @cython.embedsignature(True) def cuMipmappedArrayGetSparseProperties(mipmap): @@ -26090,21 +34157,20 @@ def cuMipmappedArrayGetSparseProperties(mipmap): -------- :py:obj:`~.cuArrayGetSparseProperties`, :py:obj:`~.cuMemMapArrayAsync` """ - cdef ccuda.CUmipmappedArray cmipmap + cdef cydriver.CUmipmappedArray cymipmap if mipmap is None: - cmipmap = 0 + pmipmap = 0 elif isinstance(mipmap, (CUmipmappedArray,)): pmipmap = int(mipmap) - cmipmap = pmipmap else: pmipmap = int(CUmipmappedArray(mipmap)) - cmipmap = pmipmap + cymipmap = pmipmap cdef CUDA_ARRAY_SPARSE_PROPERTIES sparseProperties = CUDA_ARRAY_SPARSE_PROPERTIES() - err = ccuda.cuMipmappedArrayGetSparseProperties(sparseProperties._ptr, cmipmap) - return (CUresult(err), sparseProperties) -{{endif}} - -{{if 'cuArrayGetMemoryRequirements' in found_functions}} + with nogil: + err = cydriver.cuMipmappedArrayGetSparseProperties(sparseProperties._pvt_ptr, cymipmap) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, sparseProperties) @cython.embedsignature(True) def cuArrayGetMemoryRequirements(array, device): @@ -26138,30 +34204,28 @@ def cuArrayGetMemoryRequirements(array, device): -------- :py:obj:`~.cuMipmappedArrayGetMemoryRequirements`, :py:obj:`~.cuMemMapArrayAsync` """ - cdef ccuda.CUdevice cdevice + cdef cydriver.CUdevice cydevice if device is None: - cdevice = 0 + pdevice = 0 elif isinstance(device, (CUdevice,)): pdevice = int(device) - cdevice = pdevice else: pdevice = int(CUdevice(device)) - cdevice = pdevice - cdef ccuda.CUarray carray + cydevice = pdevice + cdef cydriver.CUarray cyarray if array is None: - carray = 0 + parray = 0 elif isinstance(array, (CUarray,)): parray = int(array) - carray = parray else: parray = int(CUarray(array)) - carray = parray + cyarray = parray cdef CUDA_ARRAY_MEMORY_REQUIREMENTS memoryRequirements = CUDA_ARRAY_MEMORY_REQUIREMENTS() - err = ccuda.cuArrayGetMemoryRequirements(memoryRequirements._ptr, carray, cdevice) - return (CUresult(err), memoryRequirements) -{{endif}} - -{{if 'cuMipmappedArrayGetMemoryRequirements' in found_functions}} + with nogil: + err = cydriver.cuArrayGetMemoryRequirements(memoryRequirements._pvt_ptr, cyarray, cydevice) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, memoryRequirements) @cython.embedsignature(True) def cuMipmappedArrayGetMemoryRequirements(mipmap, device): @@ -26196,30 +34260,28 @@ def cuMipmappedArrayGetMemoryRequirements(mipmap, device): -------- :py:obj:`~.cuArrayGetMemoryRequirements`, :py:obj:`~.cuMemMapArrayAsync` """ - cdef ccuda.CUdevice cdevice + cdef cydriver.CUdevice cydevice if device is None: - cdevice = 0 + pdevice = 0 elif isinstance(device, (CUdevice,)): pdevice = int(device) - cdevice = pdevice else: pdevice = int(CUdevice(device)) - cdevice = pdevice - cdef ccuda.CUmipmappedArray cmipmap + cydevice = pdevice + cdef cydriver.CUmipmappedArray cymipmap if mipmap is None: - cmipmap = 0 + pmipmap = 0 elif isinstance(mipmap, (CUmipmappedArray,)): pmipmap = int(mipmap) - cmipmap = pmipmap else: pmipmap = int(CUmipmappedArray(mipmap)) - cmipmap = pmipmap + cymipmap = pmipmap cdef CUDA_ARRAY_MEMORY_REQUIREMENTS memoryRequirements = CUDA_ARRAY_MEMORY_REQUIREMENTS() - err = ccuda.cuMipmappedArrayGetMemoryRequirements(memoryRequirements._ptr, cmipmap, cdevice) - return (CUresult(err), memoryRequirements) -{{endif}} - -{{if 'cuArrayGetPlane' in found_functions}} + with nogil: + err = cydriver.cuMipmappedArrayGetMemoryRequirements(memoryRequirements._pvt_ptr, cymipmap, cydevice) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, memoryRequirements) @cython.embedsignature(True) def cuArrayGetPlane(hArray, unsigned int planeIdx): @@ -26259,21 +34321,20 @@ def cuArrayGetPlane(hArray, unsigned int planeIdx): -------- :py:obj:`~.cuArrayCreate`, :py:obj:`~.cudaArrayGetPlane` """ - cdef ccuda.CUarray chArray + cdef cydriver.CUarray cyhArray if hArray is None: - chArray = 0 + phArray = 0 elif isinstance(hArray, (CUarray,)): phArray = int(hArray) - chArray = phArray else: phArray = int(CUarray(hArray)) - chArray = phArray + cyhArray = phArray cdef CUarray pPlaneArray = CUarray() - err = ccuda.cuArrayGetPlane(pPlaneArray._ptr, chArray, planeIdx) - return (CUresult(err), pPlaneArray) -{{endif}} - -{{if 'cuArrayDestroy' in found_functions}} + with nogil: + err = cydriver.cuArrayGetPlane(pPlaneArray._pvt_ptr, cyhArray, planeIdx) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pPlaneArray) @cython.embedsignature(True) def cuArrayDestroy(hArray): @@ -26295,20 +34356,17 @@ def cuArrayDestroy(hArray): -------- :py:obj:`~.cuArray3DCreate`, :py:obj:`~.cuArray3DGetDescriptor`, :py:obj:`~.cuArrayCreate`, :py:obj:`~.cuArrayGetDescriptor`, :py:obj:`~.cuMemAlloc`, :py:obj:`~.cuMemAllocHost`, :py:obj:`~.cuMemAllocPitch`, :py:obj:`~.cuMemcpy2D`, :py:obj:`~.cuMemcpy2DAsync`, :py:obj:`~.cuMemcpy2DUnaligned`, :py:obj:`~.cuMemcpy3D`, :py:obj:`~.cuMemcpy3DAsync`, :py:obj:`~.cuMemcpyAtoA`, :py:obj:`~.cuMemcpyAtoD`, :py:obj:`~.cuMemcpyAtoH`, :py:obj:`~.cuMemcpyAtoHAsync`, :py:obj:`~.cuMemcpyDtoA`, :py:obj:`~.cuMemcpyDtoD`, :py:obj:`~.cuMemcpyDtoDAsync`, :py:obj:`~.cuMemcpyDtoH`, :py:obj:`~.cuMemcpyDtoHAsync`, :py:obj:`~.cuMemcpyHtoA`, :py:obj:`~.cuMemcpyHtoAAsync`, :py:obj:`~.cuMemcpyHtoD`, :py:obj:`~.cuMemcpyHtoDAsync`, :py:obj:`~.cuMemFree`, :py:obj:`~.cuMemFreeHost`, :py:obj:`~.cuMemGetAddressRange`, :py:obj:`~.cuMemGetInfo`, :py:obj:`~.cuMemHostAlloc`, :py:obj:`~.cuMemHostGetDevicePointer`, :py:obj:`~.cuMemsetD2D8`, :py:obj:`~.cuMemsetD2D16`, :py:obj:`~.cuMemsetD2D32`, :py:obj:`~.cuMemsetD8`, :py:obj:`~.cuMemsetD16`, :py:obj:`~.cuMemsetD32`, :py:obj:`~.cudaFreeArray` """ - cdef ccuda.CUarray chArray + cdef cydriver.CUarray cyhArray if hArray is None: - chArray = 0 + phArray = 0 elif isinstance(hArray, (CUarray,)): phArray = int(hArray) - chArray = phArray else: phArray = int(CUarray(hArray)) - chArray = phArray - err = ccuda.cuArrayDestroy(chArray) - return (CUresult(err),) -{{endif}} - -{{if 'cuArray3DCreate_v2' in found_functions}} + cyhArray = phArray + with nogil: + err = cydriver.cuArrayDestroy(cyhArray) + return (_CUresult(err),) @cython.embedsignature(True) def cuArray3DCreate(pAllocateArray : Optional[CUDA_ARRAY3D_DESCRIPTOR]): @@ -26435,12 +34493,12 @@ def cuArray3DCreate(pAllocateArray : Optional[CUDA_ARRAY3D_DESCRIPTOR]): :py:obj:`~.cuArray3DGetDescriptor`, :py:obj:`~.cuArrayCreate`, :py:obj:`~.cuArrayDestroy`, :py:obj:`~.cuArrayGetDescriptor`, :py:obj:`~.cuMemAlloc`, :py:obj:`~.cuMemAllocHost`, :py:obj:`~.cuMemAllocPitch`, :py:obj:`~.cuMemcpy2D`, :py:obj:`~.cuMemcpy2DAsync`, :py:obj:`~.cuMemcpy2DUnaligned`, :py:obj:`~.cuMemcpy3D`, :py:obj:`~.cuMemcpy3DAsync`, :py:obj:`~.cuMemcpyAtoA`, :py:obj:`~.cuMemcpyAtoD`, :py:obj:`~.cuMemcpyAtoH`, :py:obj:`~.cuMemcpyAtoHAsync`, :py:obj:`~.cuMemcpyDtoA`, :py:obj:`~.cuMemcpyDtoD`, :py:obj:`~.cuMemcpyDtoDAsync`, :py:obj:`~.cuMemcpyDtoH`, :py:obj:`~.cuMemcpyDtoHAsync`, :py:obj:`~.cuMemcpyHtoA`, :py:obj:`~.cuMemcpyHtoAAsync`, :py:obj:`~.cuMemcpyHtoD`, :py:obj:`~.cuMemcpyHtoDAsync`, :py:obj:`~.cuMemFree`, :py:obj:`~.cuMemFreeHost`, :py:obj:`~.cuMemGetAddressRange`, :py:obj:`~.cuMemGetInfo`, :py:obj:`~.cuMemHostAlloc`, :py:obj:`~.cuMemHostGetDevicePointer`, :py:obj:`~.cuMemsetD2D8`, :py:obj:`~.cuMemsetD2D16`, :py:obj:`~.cuMemsetD2D32`, :py:obj:`~.cuMemsetD8`, :py:obj:`~.cuMemsetD16`, :py:obj:`~.cuMemsetD32`, :py:obj:`~.cudaMalloc3DArray` """ cdef CUarray pHandle = CUarray() - cdef ccuda.CUDA_ARRAY3D_DESCRIPTOR* cpAllocateArray_ptr = pAllocateArray._ptr if pAllocateArray != None else NULL - err = ccuda.cuArray3DCreate(pHandle._ptr, cpAllocateArray_ptr) - return (CUresult(err), pHandle) -{{endif}} - -{{if 'cuArray3DGetDescriptor_v2' in found_functions}} + cdef cydriver.CUDA_ARRAY3D_DESCRIPTOR* cypAllocateArray_ptr = pAllocateArray._pvt_ptr if pAllocateArray is not None else NULL + with nogil: + err = cydriver.cuArray3DCreate(pHandle._pvt_ptr, cypAllocateArray_ptr) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pHandle) @cython.embedsignature(True) def cuArray3DGetDescriptor(hArray): @@ -26471,21 +34529,20 @@ def cuArray3DGetDescriptor(hArray): -------- :py:obj:`~.cuArray3DCreate`, :py:obj:`~.cuArrayCreate`, :py:obj:`~.cuArrayDestroy`, :py:obj:`~.cuArrayGetDescriptor`, :py:obj:`~.cuMemAlloc`, :py:obj:`~.cuMemAllocHost`, :py:obj:`~.cuMemAllocPitch`, :py:obj:`~.cuMemcpy2D`, :py:obj:`~.cuMemcpy2DAsync`, :py:obj:`~.cuMemcpy2DUnaligned`, :py:obj:`~.cuMemcpy3D`, :py:obj:`~.cuMemcpy3DAsync`, :py:obj:`~.cuMemcpyAtoA`, :py:obj:`~.cuMemcpyAtoD`, :py:obj:`~.cuMemcpyAtoH`, :py:obj:`~.cuMemcpyAtoHAsync`, :py:obj:`~.cuMemcpyDtoA`, :py:obj:`~.cuMemcpyDtoD`, :py:obj:`~.cuMemcpyDtoDAsync`, :py:obj:`~.cuMemcpyDtoH`, :py:obj:`~.cuMemcpyDtoHAsync`, :py:obj:`~.cuMemcpyHtoA`, :py:obj:`~.cuMemcpyHtoAAsync`, :py:obj:`~.cuMemcpyHtoD`, :py:obj:`~.cuMemcpyHtoDAsync`, :py:obj:`~.cuMemFree`, :py:obj:`~.cuMemFreeHost`, :py:obj:`~.cuMemGetAddressRange`, :py:obj:`~.cuMemGetInfo`, :py:obj:`~.cuMemHostAlloc`, :py:obj:`~.cuMemHostGetDevicePointer`, :py:obj:`~.cuMemsetD2D8`, :py:obj:`~.cuMemsetD2D16`, :py:obj:`~.cuMemsetD2D32`, :py:obj:`~.cuMemsetD8`, :py:obj:`~.cuMemsetD16`, :py:obj:`~.cuMemsetD32`, :py:obj:`~.cudaArrayGetInfo` """ - cdef ccuda.CUarray chArray + cdef cydriver.CUarray cyhArray if hArray is None: - chArray = 0 + phArray = 0 elif isinstance(hArray, (CUarray,)): phArray = int(hArray) - chArray = phArray else: phArray = int(CUarray(hArray)) - chArray = phArray + cyhArray = phArray cdef CUDA_ARRAY3D_DESCRIPTOR pArrayDescriptor = CUDA_ARRAY3D_DESCRIPTOR() - err = ccuda.cuArray3DGetDescriptor(pArrayDescriptor._ptr, chArray) - return (CUresult(err), pArrayDescriptor) -{{endif}} - -{{if 'cuMipmappedArrayCreate' in found_functions}} + with nogil: + err = cydriver.cuArray3DGetDescriptor(pArrayDescriptor._pvt_ptr, cyhArray) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pArrayDescriptor) @cython.embedsignature(True) def cuMipmappedArrayCreate(pMipmappedArrayDesc : Optional[CUDA_ARRAY3D_DESCRIPTOR], unsigned int numMipmapLevels): @@ -26600,12 +34657,12 @@ def cuMipmappedArrayCreate(pMipmappedArrayDesc : Optional[CUDA_ARRAY3D_DESCRIPTO :py:obj:`~.cuMipmappedArrayDestroy`, :py:obj:`~.cuMipmappedArrayGetLevel`, :py:obj:`~.cuArrayCreate`, :py:obj:`~.cudaMallocMipmappedArray` """ cdef CUmipmappedArray pHandle = CUmipmappedArray() - cdef ccuda.CUDA_ARRAY3D_DESCRIPTOR* cpMipmappedArrayDesc_ptr = pMipmappedArrayDesc._ptr if pMipmappedArrayDesc != None else NULL - err = ccuda.cuMipmappedArrayCreate(pHandle._ptr, cpMipmappedArrayDesc_ptr, numMipmapLevels) - return (CUresult(err), pHandle) -{{endif}} - -{{if 'cuMipmappedArrayGetLevel' in found_functions}} + cdef cydriver.CUDA_ARRAY3D_DESCRIPTOR* cypMipmappedArrayDesc_ptr = pMipmappedArrayDesc._pvt_ptr if pMipmappedArrayDesc is not None else NULL + with nogil: + err = cydriver.cuMipmappedArrayCreate(pHandle._pvt_ptr, cypMipmappedArrayDesc_ptr, numMipmapLevels) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pHandle) @cython.embedsignature(True) def cuMipmappedArrayGetLevel(hMipmappedArray, unsigned int level): @@ -26635,21 +34692,20 @@ def cuMipmappedArrayGetLevel(hMipmappedArray, unsigned int level): -------- :py:obj:`~.cuMipmappedArrayCreate`, :py:obj:`~.cuMipmappedArrayDestroy`, :py:obj:`~.cuArrayCreate`, :py:obj:`~.cudaGetMipmappedArrayLevel` """ - cdef ccuda.CUmipmappedArray chMipmappedArray + cdef cydriver.CUmipmappedArray cyhMipmappedArray if hMipmappedArray is None: - chMipmappedArray = 0 + phMipmappedArray = 0 elif isinstance(hMipmappedArray, (CUmipmappedArray,)): phMipmappedArray = int(hMipmappedArray) - chMipmappedArray = phMipmappedArray else: phMipmappedArray = int(CUmipmappedArray(hMipmappedArray)) - chMipmappedArray = phMipmappedArray + cyhMipmappedArray = phMipmappedArray cdef CUarray pLevelArray = CUarray() - err = ccuda.cuMipmappedArrayGetLevel(pLevelArray._ptr, chMipmappedArray, level) - return (CUresult(err), pLevelArray) -{{endif}} - -{{if 'cuMipmappedArrayDestroy' in found_functions}} + with nogil: + err = cydriver.cuMipmappedArrayGetLevel(pLevelArray._pvt_ptr, cyhMipmappedArray, level) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pLevelArray) @cython.embedsignature(True) def cuMipmappedArrayDestroy(hMipmappedArray): @@ -26671,49 +34727,66 @@ def cuMipmappedArrayDestroy(hMipmappedArray): -------- :py:obj:`~.cuMipmappedArrayCreate`, :py:obj:`~.cuMipmappedArrayGetLevel`, :py:obj:`~.cuArrayCreate`, :py:obj:`~.cudaFreeMipmappedArray` """ - cdef ccuda.CUmipmappedArray chMipmappedArray + cdef cydriver.CUmipmappedArray cyhMipmappedArray if hMipmappedArray is None: - chMipmappedArray = 0 + phMipmappedArray = 0 elif isinstance(hMipmappedArray, (CUmipmappedArray,)): phMipmappedArray = int(hMipmappedArray) - chMipmappedArray = phMipmappedArray else: phMipmappedArray = int(CUmipmappedArray(hMipmappedArray)) - chMipmappedArray = phMipmappedArray - err = ccuda.cuMipmappedArrayDestroy(chMipmappedArray) - return (CUresult(err),) -{{endif}} - -{{if 'cuMemGetHandleForAddressRange' in found_functions}} + cyhMipmappedArray = phMipmappedArray + with nogil: + err = cydriver.cuMipmappedArrayDestroy(cyhMipmappedArray) + return (_CUresult(err),) @cython.embedsignature(True) def cuMemGetHandleForAddressRange(dptr, size_t size, handleType not None : CUmemRangeHandleType, unsigned long long flags): """ Retrieve handle for an address range. - Get a handle of the specified type to an address range. The address - range must have been obtained by a prior call to either - :py:obj:`~.cuMemAlloc` or :py:obj:`~.cuMemAddressReserve`. If the - address range was obtained via :py:obj:`~.cuMemAddressReserve`, it must - also be fully mapped via :py:obj:`~.cuMemMap`. The address range must - have been obtained by a prior call to either :py:obj:`~.cuMemAllocHost` - or :py:obj:`~.cuMemHostAlloc` on Tegra. + Get a handle of the specified type to an address range. When requesting + CUmemRangeHandleType::CU_MEM_RANGE_HANDLE_TYPE_DMA_BUF_FD, address + range obtained by a prior call to either :py:obj:`~.cuMemAlloc` or + :py:obj:`~.cuMemAddressReserve` is supported if the + :py:obj:`~.CU_DEVICE_ATTRIBUTE_DMA_BUF_SUPPORTED` device attribute + returns true. If the address range was obtained via + :py:obj:`~.cuMemAddressReserve`, it must also be fully mapped via + :py:obj:`~.cuMemMap`. Address range obtained by a prior call to either + :py:obj:`~.cuMemAllocHost` or :py:obj:`~.cuMemHostAlloc` is supported + if the :py:obj:`~.CU_DEVICE_ATTRIBUTE_HOST_ALLOC_DMA_BUF_SUPPORTED` + device attribute returns true. + + As of CUDA 13.0, querying support for address range obtained by calling + :py:obj:`~.cuMemAllocHost` or :py:obj:`~.cuMemHostAlloc` using the + :py:obj:`~.CU_DEVICE_ATTRIBUTE_DMA_BUF_SUPPORTED` device attribute is + deprecated. Users must ensure the `dptr` and `size` are aligned to the host page size. - When requesting - CUmemRangeHandleType::CU_MEM_RANGE_HANDLE_TYPE_DMA_BUF_FD, users are - expected to query for dma_buf support for the platform by using - :py:obj:`~.CU_DEVICE_ATTRIBUTE_DMA_BUF_SUPPORTED` device attribute - before calling this API. The `handle` will be interpreted as a pointer - to an integer to store the dma_buf file descriptor. Users must ensure - the entire address range is backed and mapped when the address range is - allocated by :py:obj:`~.cuMemAddressReserve`. All the physical - allocations backing the address range must be resident on the same - device and have identical allocation properties. Users are also - expected to retrieve a new handle every time the underlying physical - allocation(s) corresponding to a previously queried VA range are - changed. + The `handle` will be interpreted as a pointer to an integer to store + the dma_buf file descriptor. Users must ensure the entire address range + is backed and mapped when the address range is allocated by + :py:obj:`~.cuMemAddressReserve`. All the physical allocations backing + the address range must be resident on the same device and have + identical allocation properties. Users are also expected to retrieve a + new handle every time the underlying physical allocation(s) + corresponding to a previously queried VA range are changed. + + For CUmemRangeHandleType::CU_MEM_RANGE_HANDLE_TYPE_DMA_BUF_FD, users + may set flags to + :py:obj:`~.CU_MEM_RANGE_FLAG_DMA_BUF_MAPPING_TYPE_PCIE`. Which when set + on a supported platform, will give a DMA_BUF handle mapped via PCIE + BAR1 or will return an error otherwise. + + If the device attribute + :py:obj:`~.CU_DEVICE_ATTRIBUTE_DMA_BUF_MMAP_SUPPORTED` is set and a + CUmemRangeHandleType::CU_MEM_RANGE_HANDLE_TYPE_DMA_BUF_FD is requested + for a device memory range then the returned dmabuf file descriptor may + be passed as the file descriptor argument to the mmap() system call. + + For device memory on x86 systems the mapping will be a write combined + mapping. On coherent ARM platforms these mappings will be regular + cached memory. On all other platforms these mappings will be uncached. Parameters ---------- @@ -26726,32 +34799,116 @@ def cuMemGetHandleForAddressRange(dptr, size_t size, handleType not None : CUmem Type of handle requested (defines type and size of the `handle` output parameter) flags : unsigned long long - Reserved, must be zero + When requesting + CUmemRangeHandleType::CU_MEM_RANGE_HANDLE_TYPE_DMA_BUF_FD the value + could be :py:obj:`~.CU_MEM_RANGE_FLAG_DMA_BUF_MAPPING_TYPE_PCIE`, + otherwise 0. Returns ------- CUresult - CUDA_SUCCESS CUDA_ERROR_INVALID_VALUE CUDA_ERROR_NOT_SUPPORTED + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_NOT_SUPPORTED` handle : Any Pointer to the location where the returned handle will be stored. """ - cdef ccuda.CUdeviceptr cdptr + cdef cydriver.CUdeviceptr cydptr if dptr is None: - cdptr = 0 + pdptr = 0 elif isinstance(dptr, (CUdeviceptr,)): pdptr = int(dptr) - cdptr = pdptr else: pdptr = int(CUdeviceptr(dptr)) - cdptr = pdptr + cydptr = pdptr cdef int handle = 0 - cdef void* chandle_ptr = &handle - cdef ccuda.CUmemRangeHandleType chandleType = handleType.value - err = ccuda.cuMemGetHandleForAddressRange(chandle_ptr, cdptr, size, chandleType, flags) - return (CUresult(err), handle) -{{endif}} + cdef void* cyhandle_ptr = &handle + cdef cydriver.CUmemRangeHandleType cyhandleType = int(handleType) + with nogil: + err = cydriver.cuMemGetHandleForAddressRange(cyhandle_ptr, cydptr, size, cyhandleType, flags) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, handle) + +@cython.embedsignature(True) +def cuMemBatchDecompressAsync(paramsArray : Optional[CUmemDecompressParams], size_t count, unsigned int flags, stream): + """ Submit a batch of `count` independent decompression operations. + + Each of the `count` decompression operations is described by a single + entry in the `paramsArray` array. Once the batch has been submitted, + the function will return, and decompression will happen asynchronously + w.r.t. the CPU. To the work completion tracking mechanisms in the CUDA + driver, the batch will be considered a single unit of work and + processed according to stream semantics, i.e., it is not possible to + query the completion of individual decompression operations within a + batch. + + The memory pointed to by each of :py:obj:`~.CUmemDecompressParams.src`, + :py:obj:`~.CUmemDecompressParams.dst`, and + :py:obj:`~.CUmemDecompressParams.dstActBytes`, must be capable of usage + with the hardware decompress feature. That is, for each of said + pointers, the pointer attribute + :py:obj:`~.CU_POINTER_ATTRIBUTE_IS_HW_DECOMPRESS_CAPABLE` should give a + non-zero value. To ensure this, the memory backing the pointers should + have been allocated using one of the following CUDA memory allocators: + + - :py:obj:`~.cuMemAlloc()` + + - :py:obj:`~.cuMemCreate()` with the usage flag + :py:obj:`~.CU_MEM_CREATE_USAGE_HW_DECOMPRESS` + + - :py:obj:`~.cuMemAllocFromPoolAsync()` from a pool that was created + with the usage flag + :py:obj:`~.CU_MEM_POOL_CREATE_USAGE_HW_DECOMPRESS` Additionally, + :py:obj:`~.CUmemDecompressParams.src`, + :py:obj:`~.CUmemDecompressParams.dst`, and + :py:obj:`~.CUmemDecompressParams.dstActBytes`, must all be accessible + from the device associated with the context where `stream` was + created. For information on how to ensure this, see the documentation + for the allocator of interest. + + Parameters + ---------- + paramsArray : :py:obj:`~.CUmemDecompressParams` + The array of structures describing the independent decompression + operations. + count : size_t + The number of entries in `paramsArray` array. + flags : unsigned int + Must be 0. + stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + The stream where the work will be enqueued. -{{if 'cuMemAddressReserve' in found_functions}} + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_CONTEXT`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_INVALID_HANDLE` + errorIndex : int + The index into `paramsArray` of the decompression operation for + which the error returned by this function pertains to. If `index` + is SIZE_MAX and the value returned is not :py:obj:`~.CUDA_SUCCESS`, + then the error returned by this function should be considered a + general error that does not pertain to a particular decompression + operation. May be `NULL`, in which case, no index will be recorded + in the event of error. + + See Also + -------- + :py:obj:`~.cuMemAlloc`, :py:obj:`~.cuMemPoolCreate`, :py:obj:`~.cuMemAllocFromPoolAsync` + """ + cdef cydriver.CUstream cystream + if stream is None: + pstream = 0 + elif isinstance(stream, (CUstream,)): + pstream = int(stream) + else: + pstream = int(CUstream(stream)) + cystream = pstream + cdef cydriver.CUmemDecompressParams* cyparamsArray_ptr = paramsArray._pvt_ptr if paramsArray is not None else NULL + cdef size_t errorIndex = 0 + with nogil: + err = cydriver.cuMemBatchDecompressAsync(cyparamsArray_ptr, count, flags, &errorIndex, cystream) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, errorIndex) @cython.embedsignature(True) def cuMemAddressReserve(size_t size, size_t alignment, addr, unsigned long long flags): @@ -26761,7 +34918,10 @@ def cuMemAddressReserve(size_t size, size_t alignment, addr, unsigned long long the starting address of the range in `ptr`. This API requires a system that supports UVA. The size and address parameters must be a multiple of the host page size and the alignment must be a power of two or zero - for default alignment. + for default alignment. If `addr` is 0, then the driver chooses the + address at which to place the start of the reservation whereas when it + is non-zero then the driver treats it as a hint about where to place + the reservation. Parameters ---------- @@ -26770,7 +34930,7 @@ def cuMemAddressReserve(size_t size, size_t alignment, addr, unsigned long long alignment : size_t Alignment of the reserved virtual address range requested addr : :py:obj:`~.CUdeviceptr` - Fixed starting address range requested + Hint address for the start of the address range flags : unsigned long long Currently unused, must be zero @@ -26785,21 +34945,20 @@ def cuMemAddressReserve(size_t size, size_t alignment, addr, unsigned long long -------- :py:obj:`~.cuMemAddressFree` """ - cdef ccuda.CUdeviceptr caddr + cdef cydriver.CUdeviceptr cyaddr if addr is None: - caddr = 0 + paddr = 0 elif isinstance(addr, (CUdeviceptr,)): paddr = int(addr) - caddr = paddr else: paddr = int(CUdeviceptr(addr)) - caddr = paddr + cyaddr = paddr cdef CUdeviceptr ptr = CUdeviceptr() - err = ccuda.cuMemAddressReserve(ptr._ptr, size, alignment, caddr, flags) - return (CUresult(err), ptr) -{{endif}} - -{{if 'cuMemAddressFree' in found_functions}} + with nogil: + err = cydriver.cuMemAddressReserve(ptr._pvt_ptr, size, alignment, cyaddr, flags) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, ptr) @cython.embedsignature(True) def cuMemAddressFree(ptr, size_t size): @@ -26825,20 +34984,17 @@ def cuMemAddressFree(ptr, size_t size): -------- :py:obj:`~.cuMemAddressReserve` """ - cdef ccuda.CUdeviceptr cptr + cdef cydriver.CUdeviceptr cyptr if ptr is None: - cptr = 0 + pptr = 0 elif isinstance(ptr, (CUdeviceptr,)): pptr = int(ptr) - cptr = pptr else: pptr = int(CUdeviceptr(ptr)) - cptr = pptr - err = ccuda.cuMemAddressFree(cptr, size) - return (CUresult(err),) -{{endif}} - -{{if 'cuMemCreate' in found_functions}} + cyptr = pptr + with nogil: + err = cydriver.cuMemAddressFree(cyptr, size) + return (_CUresult(err),) @cython.embedsignature(True) def cuMemCreate(size_t size, prop : Optional[CUmemAllocationProp], unsigned long long flags): @@ -26857,30 +35013,45 @@ def cuMemCreate(size_t size, prop : Optional[CUmemAllocationProp], unsigned long `size` of this allocation must be a multiple of the the value given via :py:obj:`~.cuMemGetAllocationGranularity` with the :py:obj:`~.CU_MEM_ALLOC_GRANULARITY_MINIMUM` flag. To create a CPU - allocation targeting a specific host NUMA node, applications must set - :py:obj:`~.CUmemAllocationProp`::CUmemLocation::type to + allocation that doesn't target any specific NUMA nodes, applications + must set :py:obj:`~.CUmemAllocationProp.CUmemLocation.type` to + :py:obj:`~.CU_MEM_LOCATION_TYPE_HOST`. + :py:obj:`~.CUmemAllocationProp.CUmemLocation.id` is ignored for HOST + allocations. HOST allocations are not IPC capable and + :py:obj:`~.CUmemAllocationProp.requestedHandleTypes` must be 0, any + other value will result in :py:obj:`~.CUDA_ERROR_INVALID_VALUE`. To + create a CPU allocation targeting a specific host NUMA node, + applications must set + :py:obj:`~.CUmemAllocationProp.CUmemLocation.type` to :py:obj:`~.CU_MEM_LOCATION_TYPE_HOST_NUMA` and - :py:obj:`~.CUmemAllocationProp`::CUmemLocation::id must specify the - NUMA ID of the CPU. On systems where NUMA is not available - :py:obj:`~.CUmemAllocationProp`::CUmemLocation::id must be set to 0. - - Applications can set - :py:obj:`~.CUmemAllocationProp.requestedHandleTypes` to - :py:obj:`~.CU_MEM_HANDLE_TYPE_FABRIC` in order to create allocations - suitable for sharing within an IMEX domain. An IMEX domain is either an - OS instance or a group of securely connected OS instances using the - NVIDIA IMEX daemon. An IMEX channel is a global resource within the - IMEX domain that represents a logical entity that aims to provide fine - grained accessibility control for the participating processes. When - exporter and importer CUDA processes have been granted access to the - same IMEX channel, they can securely share memory. If the allocating - process does not have access setup for an IMEX channel, attempting to - create a :py:obj:`~.CUmemGenericAllocationHandle` with - :py:obj:`~.CU_MEM_HANDLE_TYPE_FABRIC` will result in - :py:obj:`~.CUDA_ERROR_NOT_PERMITTED`. The nvidia-modprobe CLI provides - more information regarding setting up of IMEX channels. - - If :py:obj:`~.CUmemAllocationProp`::allocFlags::usage contains + :py:obj:`~.CUmemAllocationProp.CUmemLocation.id` must specify the NUMA + ID of the CPU. On systems where NUMA is not available + :py:obj:`~.CUmemAllocationProp.CUmemLocation.id` must be set to 0. + Specifying :py:obj:`~.CU_MEM_LOCATION_TYPE_HOST_NUMA_CURRENT` as the + :py:obj:`~.CUmemLocation.type` will result in + :py:obj:`~.CUDA_ERROR_INVALID_VALUE`. + + Applications that intend to use :py:obj:`~.CU_MEM_HANDLE_TYPE_FABRIC` + based memory sharing must ensure: (1) `nvidia-caps-imex-channels` + character device is created by the driver and is listed under + /proc/devices (2) have at least one IMEX channel file accessible by the + user launching the application. + + When exporter and importer CUDA processes have been granted access to + the same IMEX channel, they can securely share memory. + + The IMEX channel security model works on a per user basis. Which means + all processes under a user can share memory if the user has access to a + valid IMEX channel. When multi-user isolation is desired, a separate + IMEX channel is required for each user. + + These channel files exist in /dev/nvidia-caps-imex-channels/channel* + and can be created using standard OS native calls like mknod on Linux. + For example: To create channel0 with the major number from + /proc/devices users can execute the following command: `mknod + /dev/nvidia-caps-imex-channels/channel0 c 0` + + If :py:obj:`~.CUmemAllocationProp.allocFlags.usage` contains :py:obj:`~.CU_MEM_CREATE_USAGE_TILE_POOL` flag then the memory allocation is intended only to be used as backing tile pool for sparse CUDA arrays and sparse CUDA mipmapped arrays. (see @@ -26908,12 +35079,12 @@ def cuMemCreate(size_t size, prop : Optional[CUmemAllocationProp], unsigned long :py:obj:`~.cuMemRelease`, :py:obj:`~.cuMemExportToShareableHandle`, :py:obj:`~.cuMemImportFromShareableHandle` """ cdef CUmemGenericAllocationHandle handle = CUmemGenericAllocationHandle() - cdef ccuda.CUmemAllocationProp* cprop_ptr = prop._ptr if prop != None else NULL - err = ccuda.cuMemCreate(handle._ptr, size, cprop_ptr, flags) - return (CUresult(err), handle) -{{endif}} - -{{if 'cuMemRelease' in found_functions}} + cdef cydriver.CUmemAllocationProp* cyprop_ptr = prop._pvt_ptr if prop is not None else NULL + with nogil: + err = cydriver.cuMemCreate(handle._pvt_ptr, size, cyprop_ptr, flags) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, handle) @cython.embedsignature(True) def cuMemRelease(handle): @@ -26944,20 +35115,17 @@ def cuMemRelease(handle): -------- :py:obj:`~.cuMemCreate` """ - cdef ccuda.CUmemGenericAllocationHandle chandle + cdef cydriver.CUmemGenericAllocationHandle cyhandle if handle is None: - chandle = 0 + phandle = 0 elif isinstance(handle, (CUmemGenericAllocationHandle,)): phandle = int(handle) - chandle = phandle else: phandle = int(CUmemGenericAllocationHandle(handle)) - chandle = phandle - err = ccuda.cuMemRelease(chandle) - return (CUresult(err),) -{{endif}} - -{{if 'cuMemMap' in found_functions}} + cyhandle = phandle + with nogil: + err = cydriver.cuMemRelease(cyhandle) + return (_CUresult(err),) @cython.embedsignature(True) def cuMemMap(ptr, size_t size, size_t offset, handle, unsigned long long flags): @@ -26979,6 +35147,12 @@ def cuMemMap(ptr, size_t size, size_t offset, handle, unsigned long long flags): :py:obj:`~.cuMulticastGetGranularity` with the flag :py:obj:`~.CU_MULTICAST_RECOMMENDED_GRANULARITY`. + When `handle` represents a multicast object, this call may return + CUDA_ERROR_ILLEGAL_STATE if the system configuration is in an illegal + state. In such cases, to continue using multicast, verify that the + system configuration is in a valid state and all required driver + daemons are running properly. + Please note calling :py:obj:`~.cuMemMap` does not make the address accessible, the caller needs to update accessibility of a contiguous mapped VA range by calling :py:obj:`~.cuMemSetAccess`. @@ -27007,38 +35181,34 @@ def cuMemMap(ptr, size_t size, size_t offset, handle, unsigned long long flags): Returns ------- CUresult - :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_INVALID_DEVICE`, :py:obj:`~.CUDA_ERROR_OUT_OF_MEMORY`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_PERMITTED`, :py:obj:`~.CUDA_ERROR_NOT_SUPPORTED` + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_INVALID_DEVICE`, :py:obj:`~.CUDA_ERROR_OUT_OF_MEMORY`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_PERMITTED`, :py:obj:`~.CUDA_ERROR_NOT_SUPPORTED`, :py:obj:`~.CUDA_ERROR_ILLEGAL_STATE` See Also -------- :py:obj:`~.cuMemUnmap`, :py:obj:`~.cuMemSetAccess`, :py:obj:`~.cuMemCreate`, :py:obj:`~.cuMemAddressReserve`, :py:obj:`~.cuMemImportFromShareableHandle` """ - cdef ccuda.CUmemGenericAllocationHandle chandle + cdef cydriver.CUmemGenericAllocationHandle cyhandle if handle is None: - chandle = 0 + phandle = 0 elif isinstance(handle, (CUmemGenericAllocationHandle,)): phandle = int(handle) - chandle = phandle else: phandle = int(CUmemGenericAllocationHandle(handle)) - chandle = phandle - cdef ccuda.CUdeviceptr cptr + cyhandle = phandle + cdef cydriver.CUdeviceptr cyptr if ptr is None: - cptr = 0 + pptr = 0 elif isinstance(ptr, (CUdeviceptr,)): pptr = int(ptr) - cptr = pptr else: pptr = int(CUdeviceptr(ptr)) - cptr = pptr - err = ccuda.cuMemMap(cptr, size, offset, chandle, flags) - return (CUresult(err),) -{{endif}} - -{{if 'cuMemMapArrayAsync' in found_functions}} + cyptr = pptr + with nogil: + err = cydriver.cuMemMap(cyptr, size, offset, cyhandle, flags) + return (_CUresult(err),) @cython.embedsignature(True) -def cuMemMapArrayAsync(mapInfoList : Optional[List[CUarrayMapInfo]], unsigned int count, hStream): +def cuMemMapArrayAsync(mapInfoList : Optional[tuple[CUarrayMapInfo] | list[CUarrayMapInfo]], unsigned int count, hStream): """ Maps or unmaps subregions of sparse CUDA arrays and sparse CUDA mipmapped arrays. Performs map or unmap operations on subregions of sparse CUDA arrays @@ -27050,18 +35220,18 @@ def cuMemMapArrayAsync(mapInfoList : Optional[List[CUarrayMapInfo]], unsigned in where :py:obj:`~.CUarrayMapInfo.resourceType` specifies the type of resource to be operated on. If :py:obj:`~.CUarrayMapInfo.resourceType` - is set to :py:obj:`~.CUresourcetype`::CU_RESOURCE_TYPE_ARRAY then - :py:obj:`~.CUarrayMapInfo`::resource::array must be set to a valid - sparse CUDA array handle. The CUDA array must be either a 2D, 2D - layered or 3D CUDA array and must have been allocated using - :py:obj:`~.cuArrayCreate` or :py:obj:`~.cuArray3DCreate` with the flag + is set to :py:obj:`~.CUresourcetype.CU_RESOURCE_TYPE_ARRAY` then + :py:obj:`~.CUarrayMapInfo.resource.array` must be set to a valid sparse + CUDA array handle. The CUDA array must be either a 2D, 2D layered or 3D + CUDA array and must have been allocated using :py:obj:`~.cuArrayCreate` + or :py:obj:`~.cuArray3DCreate` with the flag :py:obj:`~.CUDA_ARRAY3D_SPARSE` or :py:obj:`~.CUDA_ARRAY3D_DEFERRED_MAPPING`. For CUDA arrays obtained using :py:obj:`~.cuMipmappedArrayGetLevel`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE` will be returned. If :py:obj:`~.CUarrayMapInfo.resourceType` is set to - :py:obj:`~.CUresourcetype`::CU_RESOURCE_TYPE_MIPMAPPED_ARRAY then - :py:obj:`~.CUarrayMapInfo`::resource::mipmap must be set to a valid + :py:obj:`~.CUresourcetype.CU_RESOURCE_TYPE_MIPMAPPED_ARRAY` then + :py:obj:`~.CUarrayMapInfo.resource.mipmap` must be set to a valid sparse CUDA mipmapped array handle. The CUDA mipmapped array must be either a 2D, 2D layered or 3D CUDA mipmapped array and must have been allocated using :py:obj:`~.cuMipmappedArrayCreate` with the flag @@ -27075,60 +35245,59 @@ def cuMemMapArrayAsync(mapInfoList : Optional[List[CUarrayMapInfo]], unsigned in **View CUDA Toolkit Documentation for a C++ code example** where - :py:obj:`~.CUarraySparseSubresourceType`::CU_ARRAY_SPARSE_SUBRESOURCE_TYPE_SPARSE_LEVEL + :py:obj:`~.CUarraySparseSubresourceType.CU_ARRAY_SPARSE_SUBRESOURCE_TYPE_SPARSE_LEVEL` indicates a sparse-miplevel which spans at least one tile in every dimension. The remaining miplevels which are too small to span at least one tile in any dimension constitute the mip tail region as indicated by - :py:obj:`~.CUarraySparseSubresourceType`::CU_ARRAY_SPARSE_SUBRESOURCE_TYPE_MIPTAIL + :py:obj:`~.CUarraySparseSubresourceType.CU_ARRAY_SPARSE_SUBRESOURCE_TYPE_MIPTAIL` subresource type. If :py:obj:`~.CUarrayMapInfo.subresourceType` is set to - :py:obj:`~.CUarraySparseSubresourceType`::CU_ARRAY_SPARSE_SUBRESOURCE_TYPE_SPARSE_LEVEL - then :py:obj:`~.CUarrayMapInfo`::subresource::sparseLevel struct must + :py:obj:`~.CUarraySparseSubresourceType.CU_ARRAY_SPARSE_SUBRESOURCE_TYPE_SPARSE_LEVEL` + then :py:obj:`~.CUarrayMapInfo.subresource.sparseLevel` struct must contain valid array subregion offsets and extents. The - :py:obj:`~.CUarrayMapInfo`::subresource::sparseLevel::offsetX, - :py:obj:`~.CUarrayMapInfo`::subresource::sparseLevel::offsetY and - :py:obj:`~.CUarrayMapInfo`::subresource::sparseLevel::offsetZ must - specify valid X, Y and Z offsets respectively. The - :py:obj:`~.CUarrayMapInfo`::subresource::sparseLevel::extentWidth, - :py:obj:`~.CUarrayMapInfo`::subresource::sparseLevel::extentHeight and - :py:obj:`~.CUarrayMapInfo`::subresource::sparseLevel::extentDepth must + :py:obj:`~.CUarrayMapInfo.subresource.sparseLevel.offsetX`, + :py:obj:`~.CUarrayMapInfo.subresource.sparseLevel.offsetY` and + :py:obj:`~.CUarrayMapInfo.subresource.sparseLevel.offsetZ` must specify + valid X, Y and Z offsets respectively. The + :py:obj:`~.CUarrayMapInfo.subresource.sparseLevel.extentWidth`, + :py:obj:`~.CUarrayMapInfo.subresource.sparseLevel.extentHeight` and + :py:obj:`~.CUarrayMapInfo.subresource.sparseLevel.extentDepth` must specify valid width, height and depth extents respectively. These offsets and extents must be aligned to the corresponding tile dimension. For CUDA mipmapped arrays - :py:obj:`~.CUarrayMapInfo`::subresource::sparseLevel::level must - specify a valid mip level index. Otherwise, must be zero. For layered - CUDA arrays and layered CUDA mipmapped arrays - :py:obj:`~.CUarrayMapInfo`::subresource::sparseLevel::layer must - specify a valid layer index. Otherwise, must be zero. - :py:obj:`~.CUarrayMapInfo`::subresource::sparseLevel::offsetZ must be - zero and - :py:obj:`~.CUarrayMapInfo`::subresource::sparseLevel::extentDepth must + :py:obj:`~.CUarrayMapInfo.subresource.sparseLevel.level` must specify a + valid mip level index. Otherwise, must be zero. For layered CUDA arrays + and layered CUDA mipmapped arrays + :py:obj:`~.CUarrayMapInfo.subresource.sparseLevel.layer` must specify a + valid layer index. Otherwise, must be zero. + :py:obj:`~.CUarrayMapInfo.subresource.sparseLevel.offsetZ` must be zero + and :py:obj:`~.CUarrayMapInfo.subresource.sparseLevel.extentDepth` must be set to 1 for 2D and 2D layered CUDA arrays and CUDA mipmapped arrays. Tile extents can be obtained by calling :py:obj:`~.cuArrayGetSparseProperties` and :py:obj:`~.cuMipmappedArrayGetSparseProperties` If :py:obj:`~.CUarrayMapInfo.subresourceType` is set to - :py:obj:`~.CUarraySparseSubresourceType`::CU_ARRAY_SPARSE_SUBRESOURCE_TYPE_MIPTAIL - then :py:obj:`~.CUarrayMapInfo`::subresource::miptail struct must - contain valid mip tail offset in - :py:obj:`~.CUarrayMapInfo`::subresource::miptail::offset and size in - :py:obj:`~.CUarrayMapInfo`::subresource::miptail::size. Both, mip tail + :py:obj:`~.CUarraySparseSubresourceType.CU_ARRAY_SPARSE_SUBRESOURCE_TYPE_MIPTAIL` + then :py:obj:`~.CUarrayMapInfo.subresource.miptail` struct must contain + valid mip tail offset in + :py:obj:`~.CUarrayMapInfo.subresource.miptail.offset` and size in + :py:obj:`~.CUarrayMapInfo.subresource.miptail.size`. Both, mip tail offset and mip tail size must be aligned to the tile size. For layered CUDA mipmapped arrays which don't have the flag :py:obj:`~.CU_ARRAY_SPARSE_PROPERTIES_SINGLE_MIPTAIL` set in :py:obj:`~.CUDA_ARRAY_SPARSE_PROPERTIES.flags` as returned by :py:obj:`~.cuMipmappedArrayGetSparseProperties`, - :py:obj:`~.CUarrayMapInfo`::subresource::miptail::layer must specify a + :py:obj:`~.CUarrayMapInfo.subresource.miptail.layer` must specify a valid layer index. Otherwise, must be zero. - If :py:obj:`~.CUarrayMapInfo`::resource::array or - :py:obj:`~.CUarrayMapInfo`::resource::mipmap was created with + If :py:obj:`~.CUarrayMapInfo.resource.array` or + :py:obj:`~.CUarrayMapInfo.resource.mipmap` was created with :py:obj:`~.CUDA_ARRAY3D_DEFERRED_MAPPING` flag set the :py:obj:`~.CUarrayMapInfo.subresourceType` and the contents of - :py:obj:`~.CUarrayMapInfo`::subresource will be ignored. + :py:obj:`~.CUarrayMapInfo.subresource` will be ignored. :py:obj:`~.CUarrayMapInfo.memOperationType` specifies the type of operation. :py:obj:`~.CUmemOperationType` is defined as: @@ -27136,18 +35305,18 @@ def cuMemMapArrayAsync(mapInfoList : Optional[List[CUarrayMapInfo]], unsigned in **View CUDA Toolkit Documentation for a C++ code example** If :py:obj:`~.CUarrayMapInfo.memOperationType` is set to - :py:obj:`~.CUmemOperationType`::CU_MEM_OPERATION_TYPE_MAP then the + :py:obj:`~.CUmemOperationType.CU_MEM_OPERATION_TYPE_MAP` then the subresource will be mapped onto the tile pool memory specified by - :py:obj:`~.CUarrayMapInfo`::memHandle at offset + :py:obj:`~.CUarrayMapInfo.memHandle` at offset :py:obj:`~.CUarrayMapInfo.offset`. The tile pool allocation has to be created by specifying the :py:obj:`~.CU_MEM_CREATE_USAGE_TILE_POOL` flag when calling :py:obj:`~.cuMemCreate`. Also, :py:obj:`~.CUarrayMapInfo.memHandleType` must be set to - :py:obj:`~.CUmemHandleType`::CU_MEM_HANDLE_TYPE_GENERIC. + :py:obj:`~.CUmemHandleType.CU_MEM_HANDLE_TYPE_GENERIC`. If :py:obj:`~.CUarrayMapInfo.memOperationType` is set to - :py:obj:`~.CUmemOperationType`::CU_MEM_OPERATION_TYPE_UNMAP then an - unmapping operation is performed. :py:obj:`~.CUarrayMapInfo`::memHandle + :py:obj:`~.CUmemOperationType.CU_MEM_OPERATION_TYPE_UNMAP` then an + unmapping operation is performed. :py:obj:`~.CUarrayMapInfo.memHandle` must be NULL. :py:obj:`~.CUarrayMapInfo.deviceBitMask` specifies the list of devices @@ -27155,9 +35324,9 @@ def cuMemMapArrayAsync(mapInfoList : Optional[List[CUarrayMapInfo]], unsigned in exactly one bit set, and the corresponding device must match the device associated with the stream. If :py:obj:`~.CUarrayMapInfo.memOperationType` is set to - :py:obj:`~.CUmemOperationType`::CU_MEM_OPERATION_TYPE_MAP, the device + :py:obj:`~.CUmemOperationType.CU_MEM_OPERATION_TYPE_MAP`, the device must also match the device associated with the tile pool memory - allocation as specified by :py:obj:`~.CUarrayMapInfo`::memHandle. + allocation as specified by :py:obj:`~.CUarrayMapInfo.memHandle`. :py:obj:`~.CUarrayMapInfo.flags` and :py:obj:`~.CUarrayMapInfo.reserved`[] are unused and must be set to @@ -27165,7 +35334,7 @@ def cuMemMapArrayAsync(mapInfoList : Optional[List[CUarrayMapInfo]], unsigned in Parameters ---------- - mapInfoList : List[:py:obj:`~.CUarrayMapInfo`] + mapInfoList : list[:py:obj:`~.CUarrayMapInfo`] List of :py:obj:`~.CUarrayMapInfo` count : unsigned int Count of :py:obj:`~.CUarrayMapInfo` in `mapInfoList` @@ -27181,33 +35350,32 @@ def cuMemMapArrayAsync(mapInfoList : Optional[List[CUarrayMapInfo]], unsigned in -------- :py:obj:`~.cuMipmappedArrayCreate`, :py:obj:`~.cuArrayCreate`, :py:obj:`~.cuArray3DCreate`, :py:obj:`~.cuMemCreate`, :py:obj:`~.cuArrayGetSparseProperties`, :py:obj:`~.cuMipmappedArrayGetSparseProperties` """ - cdef ccuda.CUstream chStream + cdef cydriver.CUstream cyhStream if hStream is None: - chStream = 0 + phStream = 0 elif isinstance(hStream, (CUstream,)): phStream = int(hStream) - chStream = phStream else: phStream = int(CUstream(hStream)) - chStream = phStream + cyhStream = phStream mapInfoList = [] if mapInfoList is None else mapInfoList if not all(isinstance(_x, (CUarrayMapInfo,)) for _x in mapInfoList): - raise TypeError("Argument 'mapInfoList' is not instance of type (expected List[ccuda.CUarrayMapInfo,]") - cdef ccuda.CUarrayMapInfo* cmapInfoList = NULL - if len(mapInfoList) > 0: - cmapInfoList = calloc(len(mapInfoList), sizeof(ccuda.CUarrayMapInfo)) - if cmapInfoList is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(mapInfoList)) + 'x' + str(sizeof(ccuda.CUarrayMapInfo))) + raise TypeError("Argument 'mapInfoList' is not instance of type (expected tuple[cydriver.CUarrayMapInfo,] or list[cydriver.CUarrayMapInfo,]") + cdef cydriver.CUarrayMapInfo* cymapInfoList = NULL + if len(mapInfoList) > 1: + cymapInfoList = calloc(len(mapInfoList), sizeof(cydriver.CUarrayMapInfo)) + if cymapInfoList is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(mapInfoList)) + 'x' + str(sizeof(cydriver.CUarrayMapInfo))) for idx in range(len(mapInfoList)): - string.memcpy(&cmapInfoList[idx], (mapInfoList[idx])._ptr, sizeof(ccuda.CUarrayMapInfo)) + string.memcpy(&cymapInfoList[idx], (mapInfoList[idx])._pvt_ptr, sizeof(cydriver.CUarrayMapInfo)) + elif len(mapInfoList) == 1: + cymapInfoList = (mapInfoList[0])._pvt_ptr if count > len(mapInfoList): raise RuntimeError("List is too small: " + str(len(mapInfoList)) + " < " + str(count)) - err = ccuda.cuMemMapArrayAsync((mapInfoList[0])._ptr if len(mapInfoList) == 1 else cmapInfoList, count, chStream) - if cmapInfoList is not NULL: - free(cmapInfoList) - return (CUresult(err),) -{{endif}} - -{{if 'cuMemUnmap' in found_functions}} + with nogil: + err = cydriver.cuMemMapArrayAsync(cymapInfoList, count, cyhStream) + if len(mapInfoList) > 1 and cymapInfoList is not NULL: + free(cymapInfoList) + return (_CUresult(err),) @cython.embedsignature(True) def cuMemUnmap(ptr, size_t size): @@ -27242,23 +35410,20 @@ def cuMemUnmap(ptr, size_t size): -------- :py:obj:`~.cuMemCreate`, :py:obj:`~.cuMemAddressReserve` """ - cdef ccuda.CUdeviceptr cptr + cdef cydriver.CUdeviceptr cyptr if ptr is None: - cptr = 0 + pptr = 0 elif isinstance(ptr, (CUdeviceptr,)): pptr = int(ptr) - cptr = pptr else: pptr = int(CUdeviceptr(ptr)) - cptr = pptr - err = ccuda.cuMemUnmap(cptr, size) - return (CUresult(err),) -{{endif}} - -{{if 'cuMemSetAccess' in found_functions}} + cyptr = pptr + with nogil: + err = cydriver.cuMemUnmap(cyptr, size) + return (_CUresult(err),) @cython.embedsignature(True) -def cuMemSetAccess(ptr, size_t size, desc : Optional[List[CUmemAccessDesc]], size_t count): +def cuMemSetAccess(ptr, size_t size, desc : Optional[tuple[CUmemAccessDesc] | list[CUmemAccessDesc]], size_t count): """ Set the access flags for each location specified in `desc` for the given virtual address range. Given the virtual address range via `ptr` and `size`, and the locations @@ -27268,9 +35433,9 @@ def cuMemSetAccess(ptr, size_t size, desc : Optional[List[CUmemAccessDesc]], siz :py:obj:`~.cuMemCreate`. Users cannot specify :py:obj:`~.CU_MEM_LOCATION_TYPE_HOST_NUMA` accessibility for allocations created on with other location types. Note: When - :py:obj:`~.CUmemAccessDesc`::CUmemLocation::type is + :py:obj:`~.CUmemAccessDesc.CUmemLocation.type` is :py:obj:`~.CU_MEM_LOCATION_TYPE_HOST_NUMA`, - :py:obj:`~.CUmemAccessDesc`::CUmemLocation::id is ignored. When setting + :py:obj:`~.CUmemAccessDesc.CUmemLocation.id` is ignored. When setting the access flags for a virtual address range mapping a multicast object, `ptr` and `size` must be aligned to the value returned by :py:obj:`~.cuMulticastGetGranularity` with the flag @@ -27285,7 +35450,7 @@ def cuMemSetAccess(ptr, size_t size, desc : Optional[List[CUmemAccessDesc]], siz Starting address for the virtual address range size : size_t Length of the virtual address range - desc : List[:py:obj:`~.CUmemAccessDesc`] + desc : list[:py:obj:`~.CUmemAccessDesc`] Array of :py:obj:`~.CUmemAccessDesc` that describe how to change the count : size_t @@ -27302,31 +35467,30 @@ def cuMemSetAccess(ptr, size_t size, desc : Optional[List[CUmemAccessDesc]], siz """ desc = [] if desc is None else desc if not all(isinstance(_x, (CUmemAccessDesc,)) for _x in desc): - raise TypeError("Argument 'desc' is not instance of type (expected List[ccuda.CUmemAccessDesc,]") - cdef ccuda.CUdeviceptr cptr + raise TypeError("Argument 'desc' is not instance of type (expected tuple[cydriver.CUmemAccessDesc,] or list[cydriver.CUmemAccessDesc,]") + cdef cydriver.CUdeviceptr cyptr if ptr is None: - cptr = 0 + pptr = 0 elif isinstance(ptr, (CUdeviceptr,)): pptr = int(ptr) - cptr = pptr else: pptr = int(CUdeviceptr(ptr)) - cptr = pptr - cdef ccuda.CUmemAccessDesc* cdesc = NULL - if len(desc) > 0: - cdesc = calloc(len(desc), sizeof(ccuda.CUmemAccessDesc)) - if cdesc is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(desc)) + 'x' + str(sizeof(ccuda.CUmemAccessDesc))) + cyptr = pptr + cdef cydriver.CUmemAccessDesc* cydesc = NULL + if len(desc) > 1: + cydesc = calloc(len(desc), sizeof(cydriver.CUmemAccessDesc)) + if cydesc is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(desc)) + 'x' + str(sizeof(cydriver.CUmemAccessDesc))) for idx in range(len(desc)): - string.memcpy(&cdesc[idx], (desc[idx])._ptr, sizeof(ccuda.CUmemAccessDesc)) + string.memcpy(&cydesc[idx], (desc[idx])._pvt_ptr, sizeof(cydriver.CUmemAccessDesc)) + elif len(desc) == 1: + cydesc = (desc[0])._pvt_ptr if count > len(desc): raise RuntimeError("List is too small: " + str(len(desc)) + " < " + str(count)) - err = ccuda.cuMemSetAccess(cptr, size, (desc[0])._ptr if len(desc) == 1 else cdesc, count) - if cdesc is not NULL: - free(cdesc) - return (CUresult(err),) -{{endif}} - -{{if 'cuMemGetAccess' in found_functions}} + with nogil: + err = cydriver.cuMemSetAccess(cyptr, size, cydesc, count) + if len(desc) > 1 and cydesc is not NULL: + free(cydesc) + return (_CUresult(err),) @cython.embedsignature(True) def cuMemGetAccess(location : Optional[CUmemLocation], ptr): @@ -27350,22 +35514,21 @@ def cuMemGetAccess(location : Optional[CUmemLocation], ptr): -------- :py:obj:`~.cuMemSetAccess` """ - cdef ccuda.CUdeviceptr cptr + cdef cydriver.CUdeviceptr cyptr if ptr is None: - cptr = 0 + pptr = 0 elif isinstance(ptr, (CUdeviceptr,)): pptr = int(ptr) - cptr = pptr else: pptr = int(CUdeviceptr(ptr)) - cptr = pptr + cyptr = pptr cdef unsigned long long flags = 0 - cdef ccuda.CUmemLocation* clocation_ptr = location._ptr if location != None else NULL - err = ccuda.cuMemGetAccess(&flags, clocation_ptr, cptr) - return (CUresult(err), flags) -{{endif}} - -{{if 'cuMemExportToShareableHandle' in found_functions}} + cdef cydriver.CUmemLocation* cylocation_ptr = location._pvt_ptr if location is not None else NULL + with nogil: + err = cydriver.cuMemGetAccess(&flags, cylocation_ptr, cyptr) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, flags) @cython.embedsignature(True) def cuMemExportToShareableHandle(handle, handleType not None : CUmemAllocationHandleType, unsigned long long flags): @@ -27407,23 +35570,22 @@ def cuMemExportToShareableHandle(handle, handleType not None : CUmemAllocationHa -------- :py:obj:`~.cuMemImportFromShareableHandle` """ - cdef ccuda.CUmemGenericAllocationHandle chandle + cdef cydriver.CUmemGenericAllocationHandle cyhandle if handle is None: - chandle = 0 + phandle = 0 elif isinstance(handle, (CUmemGenericAllocationHandle,)): phandle = int(handle) - chandle = phandle else: phandle = int(CUmemGenericAllocationHandle(handle)) - chandle = phandle - cdef utils.HelperCUmemAllocationHandleType cshareableHandle = utils.HelperCUmemAllocationHandleType(handleType) - cdef void* cshareableHandle_ptr = cshareableHandle.cptr - cdef ccuda.CUmemAllocationHandleType chandleType = handleType.value - err = ccuda.cuMemExportToShareableHandle(cshareableHandle_ptr, chandle, chandleType, flags) - return (CUresult(err), cshareableHandle.pyObj()) -{{endif}} - -{{if 'cuMemImportFromShareableHandle' in found_functions}} + cyhandle = phandle + cdef _HelperCUmemAllocationHandleType cyshareableHandle = _HelperCUmemAllocationHandleType(handleType) + cdef void* cyshareableHandle_ptr = cyshareableHandle.cptr + cdef cydriver.CUmemAllocationHandleType cyhandleType = int(handleType) + with nogil: + err = cydriver.cuMemExportToShareableHandle(cyshareableHandle_ptr, cyhandle, cyhandleType, flags) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, cyshareableHandle.pyObj()) @cython.embedsignature(True) def cuMemImportFromShareableHandle(osHandle, shHandleType not None : CUmemAllocationHandleType): @@ -27463,14 +35625,15 @@ def cuMemImportFromShareableHandle(osHandle, shHandleType not None : CUmemAlloca Importing shareable handles exported from some graphics APIs(VUlkan, OpenGL, etc) created on devices under an SLI group may not be supported, and thus this API will return CUDA_ERROR_NOT_SUPPORTED. There is no guarantee that the contents of `handle` will be the same CUDA memory handle for the same given OS shareable handle, or the same underlying allocation. """ cdef CUmemGenericAllocationHandle handle = CUmemGenericAllocationHandle() - cosHandle = utils.HelperInputVoidPtr(osHandle) - cdef void* cosHandle_ptr = cosHandle.cptr - cdef ccuda.CUmemAllocationHandleType cshHandleType = shHandleType.value - err = ccuda.cuMemImportFromShareableHandle(handle._ptr, cosHandle_ptr, cshHandleType) - return (CUresult(err), handle) -{{endif}} - -{{if 'cuMemGetAllocationGranularity' in found_functions}} + cdef _HelperInputVoidPtrStruct cyosHandleHelper + cdef void* cyosHandle = _helper_input_void_ptr(osHandle, &cyosHandleHelper) + cdef cydriver.CUmemAllocationHandleType cyshHandleType = int(shHandleType) + with nogil: + err = cydriver.cuMemImportFromShareableHandle(handle._pvt_ptr, cyosHandle, cyshHandleType) + _helper_input_void_ptr_free(&cyosHandleHelper) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, handle) @cython.embedsignature(True) def cuMemGetAllocationGranularity(prop : Optional[CUmemAllocationProp], option not None : CUmemAllocationGranularity_flags): @@ -27500,13 +35663,13 @@ def cuMemGetAllocationGranularity(prop : Optional[CUmemAllocationProp], option n :py:obj:`~.cuMemCreate`, :py:obj:`~.cuMemMap` """ cdef size_t granularity = 0 - cdef ccuda.CUmemAllocationProp* cprop_ptr = prop._ptr if prop != None else NULL - cdef ccuda.CUmemAllocationGranularity_flags coption = option.value - err = ccuda.cuMemGetAllocationGranularity(&granularity, cprop_ptr, coption) - return (CUresult(err), granularity) -{{endif}} - -{{if 'cuMemGetAllocationPropertiesFromHandle' in found_functions}} + cdef cydriver.CUmemAllocationProp* cyprop_ptr = prop._pvt_ptr if prop is not None else NULL + cdef cydriver.CUmemAllocationGranularity_flags cyoption = int(option) + with nogil: + err = cydriver.cuMemGetAllocationGranularity(&granularity, cyprop_ptr, cyoption) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, granularity) @cython.embedsignature(True) def cuMemGetAllocationPropertiesFromHandle(handle): @@ -27529,21 +35692,20 @@ def cuMemGetAllocationPropertiesFromHandle(handle): -------- :py:obj:`~.cuMemCreate`, :py:obj:`~.cuMemImportFromShareableHandle` """ - cdef ccuda.CUmemGenericAllocationHandle chandle + cdef cydriver.CUmemGenericAllocationHandle cyhandle if handle is None: - chandle = 0 + phandle = 0 elif isinstance(handle, (CUmemGenericAllocationHandle,)): phandle = int(handle) - chandle = phandle else: phandle = int(CUmemGenericAllocationHandle(handle)) - chandle = phandle + cyhandle = phandle cdef CUmemAllocationProp prop = CUmemAllocationProp() - err = ccuda.cuMemGetAllocationPropertiesFromHandle(prop._ptr, chandle) - return (CUresult(err), prop) -{{endif}} - -{{if 'cuMemRetainAllocationHandle' in found_functions}} + with nogil: + err = cydriver.cuMemGetAllocationPropertiesFromHandle(prop._pvt_ptr, cyhandle) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, prop) @cython.embedsignature(True) def cuMemRetainAllocationHandle(addr): @@ -27575,13 +35737,14 @@ def cuMemRetainAllocationHandle(addr): The address `addr`, can be any address in a range previously mapped by :py:obj:`~.cuMemMap`, and not necessarily the start address. """ cdef CUmemGenericAllocationHandle handle = CUmemGenericAllocationHandle() - caddr = utils.HelperInputVoidPtr(addr) - cdef void* caddr_ptr = caddr.cptr - err = ccuda.cuMemRetainAllocationHandle(handle._ptr, caddr_ptr) - return (CUresult(err), handle) -{{endif}} - -{{if 'cuMemFreeAsync' in found_functions}} + cdef _HelperInputVoidPtrStruct cyaddrHelper + cdef void* cyaddr = _helper_input_void_ptr(addr, &cyaddrHelper) + with nogil: + err = cydriver.cuMemRetainAllocationHandle(handle._pvt_ptr, cyaddr) + _helper_input_void_ptr_free(&cyaddrHelper) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, handle) @cython.embedsignature(True) def cuMemFreeAsync(dptr, hStream): @@ -27608,29 +35771,25 @@ def cuMemFreeAsync(dptr, hStream): ----- During stream capture, this function results in the creation of a free node and must therefore be passed the address of a graph allocation. """ - cdef ccuda.CUstream chStream + cdef cydriver.CUstream cyhStream if hStream is None: - chStream = 0 + phStream = 0 elif isinstance(hStream, (CUstream,)): phStream = int(hStream) - chStream = phStream else: phStream = int(CUstream(hStream)) - chStream = phStream - cdef ccuda.CUdeviceptr cdptr + cyhStream = phStream + cdef cydriver.CUdeviceptr cydptr if dptr is None: - cdptr = 0 + pdptr = 0 elif isinstance(dptr, (CUdeviceptr,)): pdptr = int(dptr) - cdptr = pdptr else: pdptr = int(CUdeviceptr(dptr)) - cdptr = pdptr - err = ccuda.cuMemFreeAsync(cdptr, chStream) - return (CUresult(err),) -{{endif}} - -{{if 'cuMemAllocAsync' in found_functions}} + cydptr = pdptr + with nogil: + err = cydriver.cuMemFreeAsync(cydptr, cyhStream) + return (_CUresult(err),) @cython.embedsignature(True) def cuMemAllocAsync(size_t bytesize, hStream): @@ -27668,21 +35827,20 @@ def cuMemAllocAsync(size_t bytesize, hStream): During stream capture, this function results in the creation of an allocation node. In this case, the allocation is owned by the graph instead of the memory pool. The memory pool's properties are used to set the node's creation parameters. """ - cdef ccuda.CUstream chStream + cdef cydriver.CUstream cyhStream if hStream is None: - chStream = 0 + phStream = 0 elif isinstance(hStream, (CUstream,)): phStream = int(hStream) - chStream = phStream else: phStream = int(CUstream(hStream)) - chStream = phStream + cyhStream = phStream cdef CUdeviceptr dptr = CUdeviceptr() - err = ccuda.cuMemAllocAsync(dptr._ptr, bytesize, chStream) - return (CUresult(err), dptr) -{{endif}} - -{{if 'cuMemPoolTrimTo' in found_functions}} + with nogil: + err = cydriver.cuMemAllocAsync(dptr._pvt_ptr, bytesize, cyhStream) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, dptr) @cython.embedsignature(True) def cuMemPoolTrimTo(pool, size_t minBytesToKeep): @@ -27719,20 +35877,17 @@ def cuMemPoolTrimTo(pool, size_t minBytesToKeep): : Allocations that have been asynchronously freed but whose completion has not been observed on the host (eg. by a synchronize) can count as outstanding. """ - cdef ccuda.CUmemoryPool cpool + cdef cydriver.CUmemoryPool cypool if pool is None: - cpool = 0 + ppool = 0 elif isinstance(pool, (CUmemoryPool,)): ppool = int(pool) - cpool = ppool else: ppool = int(CUmemoryPool(pool)) - cpool = ppool - err = ccuda.cuMemPoolTrimTo(cpool, minBytesToKeep) - return (CUresult(err),) -{{endif}} - -{{if 'cuMemPoolSetAttribute' in found_functions}} + cypool = ppool + with nogil: + err = cydriver.cuMemPoolTrimTo(cypool, minBytesToKeep) + return (_CUresult(err),) @cython.embedsignature(True) def cuMemPoolSetAttribute(pool, attr not None : CUmemPool_attribute, value): @@ -27741,11 +35896,11 @@ def cuMemPoolSetAttribute(pool, attr not None : CUmemPool_attribute, value): Supported attributes are: - :py:obj:`~.CU_MEMPOOL_ATTR_RELEASE_THRESHOLD`: (value type = - cuuint64_t) Amount of reserved memory in bytes to hold onto before - trying to release memory back to the OS. When more than the release - threshold bytes of memory are held by the memory pool, the allocator - will try to release memory back to the OS on the next call to stream, - event or context synchronize. (default 0) + :py:obj:`~.cuuint64_t`) Amount of reserved memory in bytes to hold + onto before trying to release memory back to the OS. When more than + the release threshold bytes of memory are held by the memory pool, + the allocator will try to release memory back to the OS on the next + call to stream, event or context synchronize. (default 0) - :py:obj:`~.CU_MEMPOOL_ATTR_REUSE_FOLLOW_EVENT_DEPENDENCIES`: (value type = int) Allow :py:obj:`~.cuMemAllocAsync` to use memory @@ -27765,13 +35920,13 @@ def cuMemPoolSetAttribute(pool, attr not None : CUmemPool_attribute, value): (default enabled). - :py:obj:`~.CU_MEMPOOL_ATTR_RESERVED_MEM_HIGH`: (value type = - cuuint64_t) Reset the high watermark that tracks the amount of - backing memory that was allocated for the memory pool. It is illegal - to set this attribute to a non-zero value. + :py:obj:`~.cuuint64_t`) Reset the high watermark that tracks the + amount of backing memory that was allocated for the memory pool. It + is illegal to set this attribute to a non-zero value. - - :py:obj:`~.CU_MEMPOOL_ATTR_USED_MEM_HIGH`: (value type = cuuint64_t) - Reset the high watermark that tracks the amount of used memory that - was allocated for the memory pool. + - :py:obj:`~.CU_MEMPOOL_ATTR_USED_MEM_HIGH`: (value type = + :py:obj:`~.cuuint64_t`) Reset the high watermark that tracks the + amount of used memory that was allocated for the memory pool. Parameters ---------- @@ -27791,23 +35946,20 @@ def cuMemPoolSetAttribute(pool, attr not None : CUmemPool_attribute, value): -------- :py:obj:`~.cuMemAllocAsync`, :py:obj:`~.cuMemFreeAsync`, :py:obj:`~.cuDeviceGetDefaultMemPool`, :py:obj:`~.cuDeviceGetMemPool`, :py:obj:`~.cuMemPoolCreate` """ - cdef ccuda.CUmemoryPool cpool + cdef cydriver.CUmemoryPool cypool if pool is None: - cpool = 0 + ppool = 0 elif isinstance(pool, (CUmemoryPool,)): ppool = int(pool) - cpool = ppool else: ppool = int(CUmemoryPool(pool)) - cpool = ppool - cdef ccuda.CUmemPool_attribute cattr = attr.value - cdef utils.HelperCUmemPool_attribute cvalue = utils.HelperCUmemPool_attribute(attr, value, is_getter=False) - cdef void* cvalue_ptr = cvalue.cptr - err = ccuda.cuMemPoolSetAttribute(cpool, cattr, cvalue_ptr) - return (CUresult(err),) -{{endif}} - -{{if 'cuMemPoolGetAttribute' in found_functions}} + cypool = ppool + cdef cydriver.CUmemPool_attribute cyattr = int(attr) + cdef _HelperCUmemPool_attribute cyvalue = _HelperCUmemPool_attribute(attr, value, is_getter=False) + cdef void* cyvalue_ptr = cyvalue.cptr + with nogil: + err = cydriver.cuMemPoolSetAttribute(cypool, cyattr, cyvalue_ptr) + return (_CUresult(err),) @cython.embedsignature(True) def cuMemPoolGetAttribute(pool, attr not None : CUmemPool_attribute): @@ -27816,11 +35968,11 @@ def cuMemPoolGetAttribute(pool, attr not None : CUmemPool_attribute): Supported attributes are: - :py:obj:`~.CU_MEMPOOL_ATTR_RELEASE_THRESHOLD`: (value type = - cuuint64_t) Amount of reserved memory in bytes to hold onto before - trying to release memory back to the OS. When more than the release - threshold bytes of memory are held by the memory pool, the allocator - will try to release memory back to the OS on the next call to stream, - event or context synchronize. (default 0) + :py:obj:`~.cuuint64_t`) Amount of reserved memory in bytes to hold + onto before trying to release memory back to the OS. When more than + the release threshold bytes of memory are held by the memory pool, + the allocator will try to release memory back to the OS on the next + call to stream, event or context synchronize. (default 0) - :py:obj:`~.CU_MEMPOOL_ATTR_REUSE_FOLLOW_EVENT_DEPENDENCIES`: (value type = int) Allow :py:obj:`~.cuMemAllocAsync` to use memory @@ -27840,66 +35992,92 @@ def cuMemPoolGetAttribute(pool, attr not None : CUmemPool_attribute): (default enabled). - :py:obj:`~.CU_MEMPOOL_ATTR_RESERVED_MEM_CURRENT`: (value type = - cuuint64_t) Amount of backing memory currently allocated for the - mempool + :py:obj:`~.cuuint64_t`) Amount of backing memory currently allocated + for the mempool - :py:obj:`~.CU_MEMPOOL_ATTR_RESERVED_MEM_HIGH`: (value type = - cuuint64_t) High watermark of backing memory allocated for the - mempool since the last time it was reset. + :py:obj:`~.cuuint64_t`) High watermark of backing memory allocated + for the mempool since the last time it was reset. - :py:obj:`~.CU_MEMPOOL_ATTR_USED_MEM_CURRENT`: (value type = - cuuint64_t) Amount of memory from the pool that is currently in use - by the application. + :py:obj:`~.cuuint64_t`) Amount of memory from the pool that is + currently in use by the application. + + - :py:obj:`~.CU_MEMPOOL_ATTR_USED_MEM_HIGH`: (value type = + :py:obj:`~.cuuint64_t`) High watermark of the amount of memory from + the pool that was in use by the application. + + The following properties can be also be queried on imported and default + pools: + + - :py:obj:`~.CU_MEMPOOL_ATTR_ALLOCATION_TYPE`: (value type = + :py:obj:`~.CUmemAllocationType`) The allocation type of the mempool + + - :py:obj:`~.CU_MEMPOOL_ATTR_EXPORT_HANDLE_TYPES`: (value type = + :py:obj:`~.CUmemAllocationHandleType`) Available export handle types + for the mempool. For imported pools this value is always + CU_MEM_HANDLE_TYPE_NONE as an imported pool cannot be re-exported + + - :py:obj:`~.CU_MEMPOOL_ATTR_LOCATION_ID`: (value type = int) The + location id for the mempool. If the location type for this pool is + CU_MEM_LOCATION_TYPE_INVISIBLE then ID will be CU_DEVICE_INVALID. + + - :py:obj:`~.CU_MEMPOOL_ATTR_LOCATION_TYPE`: (value type = + :py:obj:`~.CUmemLocationType`) The location type for the mempool. For + imported memory pools where the device is not directly visible to the + importing process or pools imported via fabric handles across nodes + this will be CU_MEM_LOCATION_TYPE_INVISIBLE. + + - :py:obj:`~.CU_MEMPOOL_ATTR_MAX_POOL_SIZE`: (value type = + :py:obj:`~.cuuint64_t`) Maximum size of the pool in bytes, this value + may be higher than what was initially passed to cuMemPoolCreate due + to alignment requirements. A value of 0 indicates no maximum size. + For CU__MEM_ALLOCATION_TYPE_MANAGED and IPC imported pools this value + will be system dependent. - - :py:obj:`~.CU_MEMPOOL_ATTR_USED_MEM_HIGH`: (value type = cuuint64_t) - High watermark of the amount of memory from the pool that was in use - by the application. + - :py:obj:`~.CU_MEMPOOL_ATTR_HW_DECOMPRESS_ENABLED`: (value type = int) + Indicates whether the pool has hardware compresssion enabled Parameters ---------- pool : :py:obj:`~.CUmemoryPool` or :py:obj:`~.cudaMemPool_t` - The memory pool to get attributes of + None attr : :py:obj:`~.CUmemPool_attribute` - The attribute to get + None Returns ------- CUresult - :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE` - value : Any - Retrieved value - See Also - -------- - :py:obj:`~.cuMemAllocAsync`, :py:obj:`~.cuMemFreeAsync`, :py:obj:`~.cuDeviceGetDefaultMemPool`, :py:obj:`~.cuDeviceGetMemPool`, :py:obj:`~.cuMemPoolCreate` + value : Any + None """ - cdef ccuda.CUmemoryPool cpool + cdef cydriver.CUmemoryPool cypool if pool is None: - cpool = 0 + ppool = 0 elif isinstance(pool, (CUmemoryPool,)): ppool = int(pool) - cpool = ppool else: ppool = int(CUmemoryPool(pool)) - cpool = ppool - cdef ccuda.CUmemPool_attribute cattr = attr.value - cdef utils.HelperCUmemPool_attribute cvalue = utils.HelperCUmemPool_attribute(attr, 0, is_getter=True) - cdef void* cvalue_ptr = cvalue.cptr - err = ccuda.cuMemPoolGetAttribute(cpool, cattr, cvalue_ptr) - return (CUresult(err), cvalue.pyObj()) -{{endif}} - -{{if 'cuMemPoolSetAccess' in found_functions}} - -@cython.embedsignature(True) -def cuMemPoolSetAccess(pool, map : Optional[List[CUmemAccessDesc]], size_t count): + cypool = ppool + cdef cydriver.CUmemPool_attribute cyattr = int(attr) + cdef _HelperCUmemPool_attribute cyvalue = _HelperCUmemPool_attribute(attr, 0, is_getter=True) + cdef void* cyvalue_ptr = cyvalue.cptr + with nogil: + err = cydriver.cuMemPoolGetAttribute(cypool, cyattr, cyvalue_ptr) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, cyvalue.pyObj()) + +@cython.embedsignature(True) +def cuMemPoolSetAccess(pool, map : Optional[tuple[CUmemAccessDesc] | list[CUmemAccessDesc]], size_t count): """ Controls visibility of pools between devices. Parameters ---------- pool : :py:obj:`~.CUmemoryPool` or :py:obj:`~.cudaMemPool_t` The pool being modified - map : List[:py:obj:`~.CUmemAccessDesc`] + map : list[:py:obj:`~.CUmemAccessDesc`] Array of access descriptors. Each descriptor instructs the access to enable for a single gpu. count : size_t @@ -27916,31 +36094,30 @@ def cuMemPoolSetAccess(pool, map : Optional[List[CUmemAccessDesc]], size_t count """ map = [] if map is None else map if not all(isinstance(_x, (CUmemAccessDesc,)) for _x in map): - raise TypeError("Argument 'map' is not instance of type (expected List[ccuda.CUmemAccessDesc,]") - cdef ccuda.CUmemoryPool cpool + raise TypeError("Argument 'map' is not instance of type (expected tuple[cydriver.CUmemAccessDesc,] or list[cydriver.CUmemAccessDesc,]") + cdef cydriver.CUmemoryPool cypool if pool is None: - cpool = 0 + ppool = 0 elif isinstance(pool, (CUmemoryPool,)): ppool = int(pool) - cpool = ppool else: ppool = int(CUmemoryPool(pool)) - cpool = ppool - cdef ccuda.CUmemAccessDesc* cmap = NULL - if len(map) > 0: - cmap = calloc(len(map), sizeof(ccuda.CUmemAccessDesc)) - if cmap is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(map)) + 'x' + str(sizeof(ccuda.CUmemAccessDesc))) + cypool = ppool + cdef cydriver.CUmemAccessDesc* cymap = NULL + if len(map) > 1: + cymap = calloc(len(map), sizeof(cydriver.CUmemAccessDesc)) + if cymap is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(map)) + 'x' + str(sizeof(cydriver.CUmemAccessDesc))) for idx in range(len(map)): - string.memcpy(&cmap[idx], (map[idx])._ptr, sizeof(ccuda.CUmemAccessDesc)) + string.memcpy(&cymap[idx], (map[idx])._pvt_ptr, sizeof(cydriver.CUmemAccessDesc)) + elif len(map) == 1: + cymap = (map[0])._pvt_ptr if count > len(map): raise RuntimeError("List is too small: " + str(len(map)) + " < " + str(count)) - err = ccuda.cuMemPoolSetAccess(cpool, (map[0])._ptr if len(map) == 1 else cmap, count) - if cmap is not NULL: - free(cmap) - return (CUresult(err),) -{{endif}} - -{{if 'cuMemPoolGetAccess' in found_functions}} + with nogil: + err = cydriver.cuMemPoolSetAccess(cypool, cymap, count) + if len(map) > 1 and cymap is not NULL: + free(cymap) + return (_CUresult(err),) @cython.embedsignature(True) def cuMemPoolGetAccess(memPool, location : Optional[CUmemLocation]): @@ -27967,22 +36144,21 @@ def cuMemPoolGetAccess(memPool, location : Optional[CUmemLocation]): -------- :py:obj:`~.cuMemAllocAsync`, :py:obj:`~.cuMemFreeAsync`, :py:obj:`~.cuDeviceGetDefaultMemPool`, :py:obj:`~.cuDeviceGetMemPool`, :py:obj:`~.cuMemPoolCreate` """ - cdef ccuda.CUmemoryPool cmemPool + cdef cydriver.CUmemoryPool cymemPool if memPool is None: - cmemPool = 0 + pmemPool = 0 elif isinstance(memPool, (CUmemoryPool,)): pmemPool = int(memPool) - cmemPool = pmemPool else: pmemPool = int(CUmemoryPool(memPool)) - cmemPool = pmemPool - cdef ccuda.CUmemAccess_flags flags - cdef ccuda.CUmemLocation* clocation_ptr = location._ptr if location != None else NULL - err = ccuda.cuMemPoolGetAccess(&flags, cmemPool, clocation_ptr) - return (CUresult(err), CUmemAccess_flags(flags)) -{{endif}} - -{{if 'cuMemPoolCreate' in found_functions}} + cymemPool = pmemPool + cdef cydriver.CUmemAccess_flags flags + cdef cydriver.CUmemLocation* cylocation_ptr = location._pvt_ptr if location is not None else NULL + with nogil: + err = cydriver.cuMemPoolGetAccess(&flags, cymemPool, cylocation_ptr) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, CUmemAccess_flags(flags)) @cython.embedsignature(True) def cuMemPoolCreate(poolProps : Optional[CUmemPoolProps]): @@ -27992,32 +36168,66 @@ def cuMemPoolCreate(poolProps : Optional[CUmemPoolProps]): `poolProps` determines the properties of the pool such as the backing device and IPC capabilities. + To create a memory pool for HOST memory not targeting a specific NUMA + node, applications must set set + :py:obj:`~.CUmemPoolProps.CUmemLocation.type` to + :py:obj:`~.CU_MEM_LOCATION_TYPE_HOST`. + :py:obj:`~.CUmemPoolProps.CUmemLocation.id` is ignored for such pools. + Pools created with the type :py:obj:`~.CU_MEM_LOCATION_TYPE_HOST` are + not IPC capable and :py:obj:`~.CUmemPoolProps.handleTypes` must be 0, + any other values will result in :py:obj:`~.CUDA_ERROR_INVALID_VALUE`. To create a memory pool targeting a specific host NUMA node, - applications must set :py:obj:`~.CUmemPoolProps`::CUmemLocation::type - to :py:obj:`~.CU_MEM_LOCATION_TYPE_HOST_NUMA` and - :py:obj:`~.CUmemPoolProps`::CUmemLocation::id must specify the NUMA ID - of the host memory node. By default, the pool's memory will be - accessible from the device it is allocated on. In the case of pools - created with :py:obj:`~.CU_MEM_LOCATION_TYPE_HOST_NUMA`, their default - accessibility will be from the host CPU. Applications can control the - maximum size of the pool by specifying a non-zero value for + applications must set :py:obj:`~.CUmemPoolProps.CUmemLocation.type` to + :py:obj:`~.CU_MEM_LOCATION_TYPE_HOST_NUMA` and + :py:obj:`~.CUmemPoolProps.CUmemLocation.id` must specify the NUMA ID of + the host memory node. Specifying + :py:obj:`~.CU_MEM_LOCATION_TYPE_HOST_NUMA_CURRENT` as the + :py:obj:`~.CUmemPoolProps.CUmemLocation.type` will result in + :py:obj:`~.CUDA_ERROR_INVALID_VALUE`. + + By default, the pool's memory will be accessible from the device it is + allocated on. In the case of pools created with + :py:obj:`~.CU_MEM_LOCATION_TYPE_HOST_NUMA` or + :py:obj:`~.CU_MEM_LOCATION_TYPE_HOST`, their default accessibility will + be from the host CPU. Applications can control the maximum size of the + pool by specifying a non-zero value for :py:obj:`~.CUmemPoolProps.maxSize`. If set to 0, the maximum size of the pool will default to a system dependent value. - Applications can set :py:obj:`~.CUmemPoolProps.handleTypes` to - :py:obj:`~.CU_MEM_HANDLE_TYPE_FABRIC` in order to create - :py:obj:`~.CUmemoryPool` suitable for sharing within an IMEX domain. An - IMEX domain is either an OS instance or a group of securely connected - OS instances using the NVIDIA IMEX daemon. An IMEX channel is a global - resource within the IMEX domain that represents a logical entity that - aims to provide fine grained accessibility control for the - participating processes. When exporter and importer CUDA processes have - been granted access to the same IMEX channel, they can securely share - memory. If the allocating process does not have access setup for an - IMEX channel, attempting to export a :py:obj:`~.CUmemoryPool` with - :py:obj:`~.CU_MEM_HANDLE_TYPE_FABRIC` will result in - :py:obj:`~.CUDA_ERROR_NOT_PERMITTED`. The nvidia-modprobe CLI provides - more information regarding setting up of IMEX channels. + Applications that intend to use :py:obj:`~.CU_MEM_HANDLE_TYPE_FABRIC` + based memory sharing must ensure: (1) `nvidia-caps-imex-channels` + character device is created by the driver and is listed under + /proc/devices (2) have at least one IMEX channel file accessible by the + user launching the application. + + When exporter and importer CUDA processes have been granted access to + the same IMEX channel, they can securely share memory. + + The IMEX channel security model works on a per user basis. Which means + all processes under a user can share memory if the user has access to a + valid IMEX channel. When multi-user isolation is desired, a separate + IMEX channel is required for each user. + + These channel files exist in /dev/nvidia-caps-imex-channels/channel* + and can be created using standard OS native calls like mknod on Linux. + For example: To create channel0 with the major number from + /proc/devices users can execute the following command: `mknod + /dev/nvidia-caps-imex-channels/channel0 c 0` + + To create a managed memory pool, applications must set + :py:obj:`~.CUmemPoolProps.CUmemAllocationType` to + CU_MEM_ALLOCATION_TYPE_MANAGED. + :py:obj:`~.CUmemPoolProps.CUmemAllocationHandleType` must also be set + to CU_MEM_HANDLE_TYPE_NONE since IPC is not supported. For managed + memory pools, :py:obj:`~.CUmemPoolProps.CUmemLocation` will be treated + as the preferred location for all allocations created from the pool. An + application can also set CU_MEM_LOCATION_TYPE_NONE to indicate no + preferred location. :py:obj:`~.CUmemPoolProps.maxSize` must be set to + zero for managed memory pools. :py:obj:`~.CUmemPoolProps.usage` should + be zero as decompress for managed memory is not supported. For managed + memory pools, all devices on the system must have non-zero + :py:obj:`~.concurrentManagedAccess`. If not, this call returns + CUDA_ERROR_NOT_SUPPORTED Parameters ---------- @@ -28027,7 +36237,7 @@ def cuMemPoolCreate(poolProps : Optional[CUmemPoolProps]): Returns ------- CUresult - :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_OUT_OF_MEMORY`, :py:obj:`~.CUDA_ERROR_NOT_PERMITTED` :py:obj:`~.CUDA_ERROR_NOT_SUPPORTED` + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_OUT_OF_MEMORY`, :py:obj:`~.CUDA_ERROR_NOT_PERMITTED`, :py:obj:`~.CUDA_ERROR_NOT_SUPPORTED` pool : :py:obj:`~.CUmemoryPool` None @@ -28040,12 +36250,12 @@ def cuMemPoolCreate(poolProps : Optional[CUmemPoolProps]): Specifying CU_MEM_HANDLE_TYPE_NONE creates a memory pool that will not support IPC. """ cdef CUmemoryPool pool = CUmemoryPool() - cdef ccuda.CUmemPoolProps* cpoolProps_ptr = poolProps._ptr if poolProps != None else NULL - err = ccuda.cuMemPoolCreate(pool._ptr, cpoolProps_ptr) - return (CUresult(err), pool) -{{endif}} - -{{if 'cuMemPoolDestroy' in found_functions}} + cdef cydriver.CUmemPoolProps* cypoolProps_ptr = poolProps._pvt_ptr if poolProps is not None else NULL + with nogil: + err = cydriver.cuMemPoolCreate(pool._pvt_ptr, cypoolProps_ptr) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pool) @cython.embedsignature(True) def cuMemPoolDestroy(pool): @@ -28078,20 +36288,174 @@ def cuMemPoolDestroy(pool): ----- A device's default memory pool cannot be destroyed. """ - cdef ccuda.CUmemoryPool cpool + cdef cydriver.CUmemoryPool cypool if pool is None: - cpool = 0 + ppool = 0 elif isinstance(pool, (CUmemoryPool,)): ppool = int(pool) - cpool = ppool else: ppool = int(CUmemoryPool(pool)) - cpool = ppool - err = ccuda.cuMemPoolDestroy(cpool) - return (CUresult(err),) -{{endif}} + cypool = ppool + with nogil: + err = cydriver.cuMemPoolDestroy(cypool) + return (_CUresult(err),) + +@cython.embedsignature(True) +def cuMemGetDefaultMemPool(location : Optional[CUmemLocation], typename not None : CUmemAllocationType): + """ Returns the default memory pool for a given location and allocation type. -{{if 'cuMemAllocFromPoolAsync' in found_functions}} + The memory location can be of one of + :py:obj:`~.CU_MEM_LOCATION_TYPE_DEVICE`, + :py:obj:`~.CU_MEM_LOCATION_TYPE_HOST`, or + :py:obj:`~.CU_MEM_LOCATION_TYPE_HOST_NUMA`. The allocation type can be + one of :py:obj:`~.CU_MEM_ALLOCATION_TYPE_PINNED` or + :py:obj:`~.CU_MEM_ALLOCATION_TYPE_MANAGED`. When the allocation type is + :py:obj:`~.CU_MEM_ALLOCATION_TYPE_MANAGED`, the location type can also + be :py:obj:`~.CU_MEM_LOCATION_TYPE_NONE` to indicate no preferred + location for the managed memory pool. + + Parameters + ---------- + location : :py:obj:`~.CUmemLocation` + None + typename : :py:obj:`~.CUmemAllocationType` + None + + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED` :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_INVALID_DEVICE`, :py:obj:`~.CUDA_ERROR_NOT_SUPPORTED` + pool_out : :py:obj:`~.CUmemoryPool` + None + + See Also + -------- + :py:obj:`~.cuMemAllocAsync`, :py:obj:`~.cuMemPoolTrimTo`, :py:obj:`~.cuMemPoolGetAttribute`, :py:obj:`~.cuMemPoolSetAttribute`, :py:obj:`~.cuMemPoolSetAccess`, :py:obj:`~.cuMemGetMemPool`, :py:obj:`~.cuMemPoolCreate` + """ + cdef CUmemoryPool pool_out = CUmemoryPool() + cdef cydriver.CUmemLocation* cylocation_ptr = location._pvt_ptr if location is not None else NULL + cdef cydriver.CUmemAllocationType cytypename = int(typename) + with nogil: + err = cydriver.cuMemGetDefaultMemPool(pool_out._pvt_ptr, cylocation_ptr, cytypename) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pool_out) + +@cython.embedsignature(True) +def cuMemGetMemPool(location : Optional[CUmemLocation], typename not None : CUmemAllocationType): + """ Gets the current memory pool for a memory location and of a particular allocation type. + + The memory location can be of one of + :py:obj:`~.CU_MEM_LOCATION_TYPE_DEVICE`, + :py:obj:`~.CU_MEM_LOCATION_TYPE_HOST` or + :py:obj:`~.CU_MEM_LOCATION_TYPE_HOST_NUMA`, or + :py:obj:`~.CU_MEM_LOCATION_TYPE_HOST_NUMA`. The allocation type can be + one of :py:obj:`~.CU_MEM_ALLOCATION_TYPE_PINNED` or + :py:obj:`~.CU_MEM_ALLOCATION_TYPE_MANAGED`. When the allocation type is + :py:obj:`~.CU_MEM_ALLOCATION_TYPE_MANAGED`, the location type can also + be :py:obj:`~.CU_MEM_LOCATION_TYPE_NONE` to indicate no preferred + location for the managed memory pool. In all other cases, the call + returns :py:obj:`~.CUDA_ERROR_INVALID_VALUE` + + Returns the last pool provided to :py:obj:`~.cuMemSetMemPool` or + :py:obj:`~.cuDeviceSetMemPool` for this location and allocation type or + the location's default memory pool if :py:obj:`~.cuMemSetMemPool` or + :py:obj:`~.cuDeviceSetMemPool` for that allocType and location has + never been called. By default the current mempool of a location is the + default mempool for a device. Otherwise the returned pool must have + been set with :py:obj:`~.cuDeviceSetMemPool`. + + Parameters + ---------- + location : :py:obj:`~.CUmemLocation` + None + typename : :py:obj:`~.CUmemAllocationType` + None + + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE` + pool : :py:obj:`~.CUmemoryPool` + None + + See Also + -------- + :py:obj:`~.cuDeviceGetDefaultMemPool`, :py:obj:`~.cuMemPoolCreate`, :py:obj:`~.cuDeviceSetMemPool`, :py:obj:`~.cuMemSetMemPool` + """ + cdef CUmemoryPool pool = CUmemoryPool() + cdef cydriver.CUmemLocation* cylocation_ptr = location._pvt_ptr if location is not None else NULL + cdef cydriver.CUmemAllocationType cytypename = int(typename) + with nogil: + err = cydriver.cuMemGetMemPool(pool._pvt_ptr, cylocation_ptr, cytypename) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pool) + +@cython.embedsignature(True) +def cuMemSetMemPool(location : Optional[CUmemLocation], typename not None : CUmemAllocationType, pool): + """ Sets the current memory pool for a memory location and allocation type. + + The memory location can be of one of + :py:obj:`~.CU_MEM_LOCATION_TYPE_DEVICE`, + :py:obj:`~.CU_MEM_LOCATION_TYPE_HOST` or or + :py:obj:`~.CU_MEM_LOCATION_TYPE_HOST_NUMA`. The allocation type can be + one of :py:obj:`~.CU_MEM_ALLOCATION_TYPE_PINNED` or + :py:obj:`~.CU_MEM_ALLOCATION_TYPE_MANAGED`. When the allocation type is + :py:obj:`~.CU_MEM_ALLOCATION_TYPE_MANAGED`, the location type can also + be :py:obj:`~.CU_MEM_LOCATION_TYPE_NONE` to indicate no preferred + location for the managed memory pool. + :py:obj:`~.CU_MEM_ALLOCATION_TYPE_MANAGED` can not be used with + :py:obj:`~.CU_MEM_LOCATION_TYPE_DEVICE_MEMORY_NODE`. In all other + cases, the call returns :py:obj:`~.CUDA_ERROR_INVALID_VALUE`. + + When a memory pool is set as the current memory pool, the location + parameter should be the same as the location of the pool. The location + and allocation type specified must match those of the pool otherwise + :py:obj:`~.CUDA_ERROR_INVALID_VALUE` is returned. By default, a memory + location's current memory pool is its default memory pool that can be + obtained via :py:obj:`~.cuMemGetDefaultMemPool`. If the location type + is :py:obj:`~.CU_MEM_LOCATION_TYPE_DEVICE` and the allocation type is + :py:obj:`~.CU_MEM_ALLOCATION_TYPE_PINNED`, then this API is the + equivalent of calling :py:obj:`~.cuDeviceSetMemPool` with the location + id as the device. For further details on the implications, please refer + to the documentation for :py:obj:`~.cuDeviceSetMemPool`. + + Parameters + ---------- + location : :py:obj:`~.CUmemLocation` + None + typename : :py:obj:`~.CUmemAllocationType` + None + pool : :py:obj:`~.CUmemoryPool` or :py:obj:`~.cudaMemPool_t` + None + + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE` + + See Also + -------- + :py:obj:`~.cuDeviceGetDefaultMemPool`, :py:obj:`~.cuDeviceGetMemPool`, :py:obj:`~.cuMemGetMemPool`, :py:obj:`~.cuMemPoolCreate`, :py:obj:`~.cuMemPoolDestroy`, :py:obj:`~.cuMemAllocFromPoolAsync` + + Notes + ----- + Use :py:obj:`~.cuMemAllocFromPoolAsync` to specify asynchronous allocations from a device different than the one the stream runs on. + """ + cdef cydriver.CUmemoryPool cypool + if pool is None: + ppool = 0 + elif isinstance(pool, (CUmemoryPool,)): + ppool = int(pool) + else: + ppool = int(CUmemoryPool(pool)) + cypool = ppool + cdef cydriver.CUmemLocation* cylocation_ptr = location._pvt_ptr if location is not None else NULL + cdef cydriver.CUmemAllocationType cytypename = int(typename) + with nogil: + err = cydriver.cuMemSetMemPool(cylocation_ptr, cytypename, cypool) + return (_CUresult(err),) @cython.embedsignature(True) def cuMemAllocFromPoolAsync(size_t bytesize, pool, hStream): @@ -28126,30 +36490,28 @@ def cuMemAllocFromPoolAsync(size_t bytesize, pool, hStream): ----- During stream capture, this function results in the creation of an allocation node. In this case, the allocation is owned by the graph instead of the memory pool. The memory pool's properties are used to set the node's creation parameters. """ - cdef ccuda.CUstream chStream + cdef cydriver.CUstream cyhStream if hStream is None: - chStream = 0 + phStream = 0 elif isinstance(hStream, (CUstream,)): phStream = int(hStream) - chStream = phStream else: phStream = int(CUstream(hStream)) - chStream = phStream - cdef ccuda.CUmemoryPool cpool + cyhStream = phStream + cdef cydriver.CUmemoryPool cypool if pool is None: - cpool = 0 + ppool = 0 elif isinstance(pool, (CUmemoryPool,)): ppool = int(pool) - cpool = ppool else: ppool = int(CUmemoryPool(pool)) - cpool = ppool + cypool = ppool cdef CUdeviceptr dptr = CUdeviceptr() - err = ccuda.cuMemAllocFromPoolAsync(dptr._ptr, bytesize, cpool, chStream) - return (CUresult(err), dptr) -{{endif}} - -{{if 'cuMemPoolExportToShareableHandle' in found_functions}} + with nogil: + err = cydriver.cuMemAllocFromPoolAsync(dptr._pvt_ptr, bytesize, cypool, cyhStream) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, dptr) @cython.embedsignature(True) def cuMemPoolExportToShareableHandle(pool, handleType not None : CUmemAllocationHandleType, unsigned long long flags): @@ -28186,25 +36548,24 @@ def cuMemPoolExportToShareableHandle(pool, handleType not None : CUmemAllocation Notes ----- - : To create an IPC capable mempool, create a mempool with a CUmemAllocationHandleType other than CU_MEM_HANDLE_TYPE_NONE. + : To create an IPC capable mempool, create a mempool with a :py:obj:`~.CUmemAllocationHandleType` other than CU_MEM_HANDLE_TYPE_NONE. """ - cdef ccuda.CUmemoryPool cpool + cdef cydriver.CUmemoryPool cypool if pool is None: - cpool = 0 + ppool = 0 elif isinstance(pool, (CUmemoryPool,)): ppool = int(pool) - cpool = ppool else: ppool = int(CUmemoryPool(pool)) - cpool = ppool - cdef utils.HelperCUmemAllocationHandleType chandle_out = utils.HelperCUmemAllocationHandleType(handleType) - cdef void* chandle_out_ptr = chandle_out.cptr - cdef ccuda.CUmemAllocationHandleType chandleType = handleType.value - err = ccuda.cuMemPoolExportToShareableHandle(chandle_out_ptr, cpool, chandleType, flags) - return (CUresult(err), chandle_out.pyObj()) -{{endif}} - -{{if 'cuMemPoolImportFromShareableHandle' in found_functions}} + cypool = ppool + cdef _HelperCUmemAllocationHandleType cyhandle_out = _HelperCUmemAllocationHandleType(handleType) + cdef void* cyhandle_out_ptr = cyhandle_out.cptr + cdef cydriver.CUmemAllocationHandleType cyhandleType = int(handleType) + with nogil: + err = cydriver.cuMemPoolExportToShareableHandle(cyhandle_out_ptr, cypool, cyhandleType, flags) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, cyhandle_out.pyObj()) @cython.embedsignature(True) def cuMemPoolImportFromShareableHandle(handle, handleType not None : CUmemAllocationHandleType, unsigned long long flags): @@ -28243,14 +36604,15 @@ def cuMemPoolImportFromShareableHandle(handle, handleType not None : CUmemAlloca Imported memory pools do not support creating new allocations. As such imported memory pools may not be used in cuDeviceSetMemPool or :py:obj:`~.cuMemAllocFromPoolAsync` calls. """ cdef CUmemoryPool pool_out = CUmemoryPool() - chandle = utils.HelperInputVoidPtr(handle) - cdef void* chandle_ptr = chandle.cptr - cdef ccuda.CUmemAllocationHandleType chandleType = handleType.value - err = ccuda.cuMemPoolImportFromShareableHandle(pool_out._ptr, chandle_ptr, chandleType, flags) - return (CUresult(err), pool_out) -{{endif}} - -{{if 'cuMemPoolExportPointer' in found_functions}} + cdef _HelperInputVoidPtrStruct cyhandleHelper + cdef void* cyhandle = _helper_input_void_ptr(handle, &cyhandleHelper) + cdef cydriver.CUmemAllocationHandleType cyhandleType = int(handleType) + with nogil: + err = cydriver.cuMemPoolImportFromShareableHandle(pool_out._pvt_ptr, cyhandle, cyhandleType, flags) + _helper_input_void_ptr_free(&cyhandleHelper) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pool_out) @cython.embedsignature(True) def cuMemPoolExportPointer(ptr): @@ -28277,21 +36639,20 @@ def cuMemPoolExportPointer(ptr): -------- :py:obj:`~.cuMemPoolExportToShareableHandle`, :py:obj:`~.cuMemPoolImportFromShareableHandle`, :py:obj:`~.cuMemPoolImportPointer` """ - cdef ccuda.CUdeviceptr cptr + cdef cydriver.CUdeviceptr cyptr if ptr is None: - cptr = 0 + pptr = 0 elif isinstance(ptr, (CUdeviceptr,)): pptr = int(ptr) - cptr = pptr else: pptr = int(CUdeviceptr(ptr)) - cptr = pptr + cyptr = pptr cdef CUmemPoolPtrExportData shareData_out = CUmemPoolPtrExportData() - err = ccuda.cuMemPoolExportPointer(shareData_out._ptr, cptr) - return (CUresult(err), shareData_out) -{{endif}} - -{{if 'cuMemPoolImportPointer' in found_functions}} + with nogil: + err = cydriver.cuMemPoolExportPointer(shareData_out._pvt_ptr, cyptr) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, shareData_out) @cython.embedsignature(True) def cuMemPoolImportPointer(pool, shareData : Optional[CUmemPoolPtrExportData]): @@ -28327,22 +36688,21 @@ def cuMemPoolImportPointer(pool, shareData : Optional[CUmemPoolPtrExportData]): ----- The cuMemFreeAsync api may be used in the exporting process before the cuMemFreeAsync operation completes in its stream as long as the cuMemFreeAsync in the exporting process specifies a stream with a stream dependency on the importing process's cuMemFreeAsync. """ - cdef ccuda.CUmemoryPool cpool + cdef cydriver.CUmemoryPool cypool if pool is None: - cpool = 0 + ppool = 0 elif isinstance(pool, (CUmemoryPool,)): ppool = int(pool) - cpool = ppool else: ppool = int(CUmemoryPool(pool)) - cpool = ppool + cypool = ppool cdef CUdeviceptr ptr_out = CUdeviceptr() - cdef ccuda.CUmemPoolPtrExportData* cshareData_ptr = shareData._ptr if shareData != None else NULL - err = ccuda.cuMemPoolImportPointer(ptr_out._ptr, cpool, cshareData_ptr) - return (CUresult(err), ptr_out) -{{endif}} - -{{if 'cuMulticastCreate' in found_functions}} + cdef cydriver.CUmemPoolPtrExportData* cyshareData_ptr = shareData._pvt_ptr if shareData is not None else NULL + with nogil: + err = cydriver.cuMemPoolImportPointer(ptr_out._pvt_ptr, cypool, cyshareData_ptr) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, ptr_out) @cython.embedsignature(True) def cuMulticastCreate(prop : Optional[CUmulticastObjectProp]): @@ -28354,10 +36714,10 @@ def cuMulticastCreate(prop : Optional[CUmulticastObjectProp]): the multicast object via :py:obj:`~.cuMulticastAddDevice`. All participating devices must be added to the multicast object before memory can be bound to it. Memory is bound to the multicast object via - either :py:obj:`~.cuMulticastBindMem` or - :py:obj:`~.cuMulticastBindAddr`, and can be unbound via - :py:obj:`~.cuMulticastUnbind`. The total amount of memory that can be - bound per device is specified by + :py:obj:`~.cuMulticastBindMem`, :py:obj:`~.cuMulticastBindMem_v2`, + :py:obj:`~.cuMulticastBindAddr`, or :py:obj:`~.cuMulticastBindAddr_v2`. + and can be unbound via :py:obj:`~.cuMulticastUnbind`. The total amount + of memory that can be bound per device is specified by :py:obj:`~.py`:obj:`~.CUmulticastObjectProp.size`. This size must be a multiple of the value returned by :py:obj:`~.cuMulticastGetGranularity` with the flag :py:obj:`~.CU_MULTICAST_GRANULARITY_MINIMUM`. For best @@ -28393,14 +36753,16 @@ def cuMulticastCreate(prop : Optional[CUmulticastObjectProp]): :py:obj:`~.cuMulticastAddDevice`, :py:obj:`~.cuMulticastBindMem`, :py:obj:`~.cuMulticastBindAddr`, :py:obj:`~.cuMulticastUnbind` :py:obj:`~.cuMemCreate`, :py:obj:`~.cuMemRelease`, :py:obj:`~.cuMemExportToShareableHandle`, :py:obj:`~.cuMemImportFromShareableHandle` + + :py:obj:`~.cuMulticastBindAddr_v2`, :py:obj:`~.cuMulticastBindMem_v2` """ cdef CUmemGenericAllocationHandle mcHandle = CUmemGenericAllocationHandle() - cdef ccuda.CUmulticastObjectProp* cprop_ptr = prop._ptr if prop != None else NULL - err = ccuda.cuMulticastCreate(mcHandle._ptr, cprop_ptr) - return (CUresult(err), mcHandle) -{{endif}} - -{{if 'cuMulticastAddDevice' in found_functions}} + cdef cydriver.CUmulticastObjectProp* cyprop_ptr = prop._pvt_ptr if prop is not None else NULL + with nogil: + err = cydriver.cuMulticastCreate(mcHandle._pvt_ptr, cyprop_ptr) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, mcHandle) @cython.embedsignature(True) def cuMulticastAddDevice(mcHandle, dev): @@ -28413,10 +36775,11 @@ def cuMulticastAddDevice(mcHandle, dev): multicast object is permanent during the life time of the multicast object. All devices must be added to the multicast team before any memory can be bound to any device in the team. Any calls to - :py:obj:`~.cuMulticastBindMem` or :py:obj:`~.cuMulticastBindAddr` will - block until all devices have been added. Similarly all devices must be - added to the multicast team before a virtual address range can be - mapped to the multicast object. A call to :py:obj:`~.cuMemMap` will + :py:obj:`~.cuMulticastBindMem`, :py:obj:`~.cuMulticastBindMem_v2`, + :py:obj:`~.cuMulticastBindAddr`, or :py:obj:`~.cuMulticastBindAddr_v2` + will block until all devices have been added. Similarly all devices + must be added to the multicast team before a virtual address range can + be mapped to the multicast object. A call to :py:obj:`~.cuMemMap` will block until all devices have been added. Parameters @@ -28435,29 +36798,25 @@ def cuMulticastAddDevice(mcHandle, dev): -------- :py:obj:`~.cuMulticastCreate`, :py:obj:`~.cuMulticastBindMem`, :py:obj:`~.cuMulticastBindAddr` """ - cdef ccuda.CUdevice cdev + cdef cydriver.CUdevice cydev if dev is None: - cdev = 0 + pdev = 0 elif isinstance(dev, (CUdevice,)): pdev = int(dev) - cdev = pdev else: pdev = int(CUdevice(dev)) - cdev = pdev - cdef ccuda.CUmemGenericAllocationHandle cmcHandle + cydev = pdev + cdef cydriver.CUmemGenericAllocationHandle cymcHandle if mcHandle is None: - cmcHandle = 0 + pmcHandle = 0 elif isinstance(mcHandle, (CUmemGenericAllocationHandle,)): pmcHandle = int(mcHandle) - cmcHandle = pmcHandle else: pmcHandle = int(CUmemGenericAllocationHandle(mcHandle)) - cmcHandle = pmcHandle - err = ccuda.cuMulticastAddDevice(cmcHandle, cdev) - return (CUresult(err),) -{{endif}} - -{{if 'cuMulticastBindMem' in found_functions}} + cymcHandle = pmcHandle + with nogil: + err = cydriver.cuMulticastAddDevice(cymcHandle, cydev) + return (_CUresult(err),) @cython.embedsignature(True) def cuMulticastBindMem(mcHandle, size_t mcOffset, memHandle, size_t memOffset, size_t size, unsigned long long flags): @@ -28476,73 +36835,256 @@ def cuMulticastBindMem(mcHandle, size_t mcOffset, memHandle, size_t memOffset, s :py:obj:`~.cuMulticastGetGranularity` with the flag :py:obj:`~.CU_MULTICAST_GRANULARITY_RECOMMENDED`. - The `size` + `memOffset` cannot be larger than the size of the - allocated memory. Similarly the `size` + `mcOffset` cannot be larger - than the size of the multicast object. The memory allocation must have - beeen created on one of the devices that was added to the multicast - team via :py:obj:`~.cuMulticastAddDevice`. Externally shareable as well - as imported multicast objects can be bound only to externally shareable + The `size` + `memOffset` cannot be larger than the size of the + allocated memory. Similarly the `size` + `mcOffset` cannot be larger + than the size of the multicast object. + + The memory allocation must have beeen created on one of the devices + that was added to the multicast team via + :py:obj:`~.cuMulticastAddDevice`. Externally shareable as well as + imported multicast objects can be bound only to externally shareable + memory. Note that this call will return CUDA_ERROR_OUT_OF_MEMORY if + there are insufficient resources required to perform the bind. This + call may also return CUDA_ERROR_SYSTEM_NOT_READY if the necessary + system software is not initialized or running. + + This call may return CUDA_ERROR_ILLEGAL_STATE if the system + configuration is in an illegal state. In such cases, to continue using + multicast, verify that the system configuration is in a valid state and + all required driver daemons are running properly. + + Parameters + ---------- + mcHandle : :py:obj:`~.CUmemGenericAllocationHandle` + Handle representing a multicast object. + mcOffset : size_t + Offset into the multicast object for attachment. + memHandle : :py:obj:`~.CUmemGenericAllocationHandle` + Handle representing a memory allocation. + memOffset : size_t + Offset into the memory for attachment. + size : size_t + Size of the memory that will be bound to the multicast object. + flags : unsigned long long + Flags for future use, must be zero for now. + + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_INVALID_DEVICE`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_PERMITTED`, :py:obj:`~.CUDA_ERROR_NOT_SUPPORTED`, :py:obj:`~.CUDA_ERROR_OUT_OF_MEMORY`, :py:obj:`~.CUDA_ERROR_SYSTEM_NOT_READY`, :py:obj:`~.CUDA_ERROR_ILLEGAL_STATE`, + + See Also + -------- + :py:obj:`~.cuMulticastCreate`, :py:obj:`~.cuMulticastAddDevice`, :py:obj:`~.cuMemCreate` + + :py:obj:`~.cuMulticastBindMem_v2` + """ + cdef cydriver.CUmemGenericAllocationHandle cymemHandle + if memHandle is None: + pmemHandle = 0 + elif isinstance(memHandle, (CUmemGenericAllocationHandle,)): + pmemHandle = int(memHandle) + else: + pmemHandle = int(CUmemGenericAllocationHandle(memHandle)) + cymemHandle = pmemHandle + cdef cydriver.CUmemGenericAllocationHandle cymcHandle + if mcHandle is None: + pmcHandle = 0 + elif isinstance(mcHandle, (CUmemGenericAllocationHandle,)): + pmcHandle = int(mcHandle) + else: + pmcHandle = int(CUmemGenericAllocationHandle(mcHandle)) + cymcHandle = pmcHandle + with nogil: + err = cydriver.cuMulticastBindMem(cymcHandle, mcOffset, cymemHandle, memOffset, size, flags) + return (_CUresult(err),) + +@cython.embedsignature(True) +def cuMulticastBindMem_v2(mcHandle, dev, size_t mcOffset, memHandle, size_t memOffset, size_t size, unsigned long long flags): + """ Bind a memory allocation represented by a handle to a multicast object. + + Binds a memory allocation specified by `memHandle` and created via + :py:obj:`~.cuMemCreate` to a multicast object represented by `mcHandle` + and created via :py:obj:`~.cuMulticastCreate`. The binding will be + applicable for the device `dev`. The intended `size` of the bind, the + offset in the multicast range `mcOffset` as well as the offset in the + memory `memOffset` must be a multiple of the value returned by + :py:obj:`~.cuMulticastGetGranularity` with the flag + :py:obj:`~.CU_MULTICAST_GRANULARITY_MINIMUM`. For best performance + however, `size`, `mcOffset` and `memOffset` should be aligned to the + granularity of the memory allocation(see + :py:obj:`~.cuMemGetAllocationGranularity`) or to the value returned by + :py:obj:`~.cuMulticastGetGranularity` with the flag + :py:obj:`~.CU_MULTICAST_GRANULARITY_RECOMMENDED`. + + The `size` + `memOffset` cannot be larger than the size of the + allocated memory. Similarly the `size` + `mcOffset` cannot be larger + than the size of the multicast object. + + The memory allocation must have beeen created on one of the devices + that was added to the multicast team via + :py:obj:`~.cuMulticastAddDevice`. For device memory, i.e., type + :py:obj:`~.CU_MEM_LOCATION_TYPE_DEVICE`, the memory allocation must + have been created on the device specified by `dev`. For host NUMA + memory, i.e., type :py:obj:`~.CU_MEM_LOCATION_TYPE_HOST_NUMA`, the + memory allocation must have been created on the CPU NUMA node closest + to `dev`. That is, the value returned when querying + :py:obj:`~.CU_DEVICE_ATTRIBUTE_HOST_NUMA_ID` for `dev`, must be the CPU + NUMA node where the memory was allocated. In both cases, the device + named by `dev` must have been added to the multicast team via + :py:obj:`~.cuMulticastAddDevice`. Externally shareable as well as + imported multicast objects can be bound only to externally shareable + memory. Note that this call will return CUDA_ERROR_OUT_OF_MEMORY if + there are insufficient resources required to perform the bind. This + call may also return CUDA_ERROR_SYSTEM_NOT_READY if the necessary + system software is not initialized or running. + + This call may return CUDA_ERROR_ILLEGAL_STATE if the system + configuration is in an illegal state. In such cases, to continue using + multicast, verify that the system configuration is in a valid state and + all required driver daemons are running properly. + + Parameters + ---------- + mcHandle : :py:obj:`~.CUmemGenericAllocationHandle` + Handle representing a multicast object. + dev : :py:obj:`~.CUdevice` + The device that for which the multicast memory binding will be + applicable. + mcOffset : size_t + Offset into the multicast object for attachment. + memHandle : :py:obj:`~.CUmemGenericAllocationHandle` + Handle representing a memory allocation. + memOffset : size_t + Offset into the memory for attachment. + size : size_t + Size of the memory that will be bound to the multicast object. + flags : unsigned long long + Flags for future use, must be zero for now. + + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_INVALID_DEVICE`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_PERMITTED`, :py:obj:`~.CUDA_ERROR_NOT_SUPPORTED`, :py:obj:`~.CUDA_ERROR_OUT_OF_MEMORY`, :py:obj:`~.CUDA_ERROR_SYSTEM_NOT_READY`, :py:obj:`~.CUDA_ERROR_ILLEGAL_STATE`, + + See Also + -------- + :py:obj:`~.cuMulticastCreate`, :py:obj:`~.cuMulticastAddDevice`, :py:obj:`~.cuMemCreate` + """ + cdef cydriver.CUmemGenericAllocationHandle cymemHandle + if memHandle is None: + pmemHandle = 0 + elif isinstance(memHandle, (CUmemGenericAllocationHandle,)): + pmemHandle = int(memHandle) + else: + pmemHandle = int(CUmemGenericAllocationHandle(memHandle)) + cymemHandle = pmemHandle + cdef cydriver.CUdevice cydev + if dev is None: + pdev = 0 + elif isinstance(dev, (CUdevice,)): + pdev = int(dev) + else: + pdev = int(CUdevice(dev)) + cydev = pdev + cdef cydriver.CUmemGenericAllocationHandle cymcHandle + if mcHandle is None: + pmcHandle = 0 + elif isinstance(mcHandle, (CUmemGenericAllocationHandle,)): + pmcHandle = int(mcHandle) + else: + pmcHandle = int(CUmemGenericAllocationHandle(mcHandle)) + cymcHandle = pmcHandle + with nogil: + err = cydriver.cuMulticastBindMem_v2(cymcHandle, cydev, mcOffset, cymemHandle, memOffset, size, flags) + return (_CUresult(err),) + +@cython.embedsignature(True) +def cuMulticastBindAddr(mcHandle, size_t mcOffset, memptr, size_t size, unsigned long long flags): + """ Bind a memory allocation represented by a virtual address to a multicast object. + + Binds a memory allocation specified by its mapped address `memptr` to a + multicast object represented by `mcHandle`. The memory must have been + allocated via :py:obj:`~.cuMemCreate` or :py:obj:`~.cudaMallocAsync`. + The intended `size` of the bind, the offset in the multicast range + `mcOffset` and `memptr` must be a multiple of the value returned by + :py:obj:`~.cuMulticastGetGranularity` with the flag + :py:obj:`~.CU_MULTICAST_GRANULARITY_MINIMUM`. For best performance + however, `size`, `mcOffset` and `memptr` should be aligned to the value + returned by :py:obj:`~.cuMulticastGetGranularity` with the flag + :py:obj:`~.CU_MULTICAST_GRANULARITY_RECOMMENDED`. + + The `size` cannot be larger than the size of the allocated memory. + Similarly the `size` + `mcOffset` cannot be larger than the total size + of the multicast object. + + The memory allocation must have beeen created on one of the devices + that was added to the multicast team via + :py:obj:`~.cuMulticastAddDevice`. Externally shareable as well as + imported multicast objects can be bound only to externally shareable memory. Note that this call will return CUDA_ERROR_OUT_OF_MEMORY if there are insufficient resources required to perform the bind. This call may also return CUDA_ERROR_SYSTEM_NOT_READY if the necessary system software is not initialized or running. + This call may return CUDA_ERROR_ILLEGAL_STATE if the system + configuration is in an illegal state. In such cases, to continue using + multicast, verify that the system configuration is in a valid state and + all required driver daemons are running properly. + Parameters ---------- mcHandle : :py:obj:`~.CUmemGenericAllocationHandle` Handle representing a multicast object. mcOffset : size_t - Offset into the multicast object for attachment. - memHandle : :py:obj:`~.CUmemGenericAllocationHandle` - Handle representing a memory allocation. - memOffset : size_t - Offset into the memory for attachment. + Offset into multicast va range for attachment. + memptr : :py:obj:`~.CUdeviceptr` + Virtual address of the memory allocation. size : size_t - Size of the memory that will be bound to the multicast object. + Size of memory that will be bound to the multicast object. flags : unsigned long long - Flags for future use, must be zero for now. + Flags for future use, must be zero now. Returns ------- CUresult - :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_INVALID_DEVICE`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_PERMITTED`, :py:obj:`~.CUDA_ERROR_NOT_SUPPORTED`, :py:obj:`~.CUDA_ERROR_OUT_OF_MEMORY`, :py:obj:`~.CUDA_ERROR_SYSTEM_NOT_READY` + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_INVALID_DEVICE`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_PERMITTED`, :py:obj:`~.CUDA_ERROR_NOT_SUPPORTED`, :py:obj:`~.CUDA_ERROR_OUT_OF_MEMORY`, :py:obj:`~.CUDA_ERROR_SYSTEM_NOT_READY`, :py:obj:`~.CUDA_ERROR_ILLEGAL_STATE`, See Also -------- :py:obj:`~.cuMulticastCreate`, :py:obj:`~.cuMulticastAddDevice`, :py:obj:`~.cuMemCreate` + + :py:obj:`~.cuMulticastBindAddr_v2` """ - cdef ccuda.CUmemGenericAllocationHandle cmemHandle - if memHandle is None: - cmemHandle = 0 - elif isinstance(memHandle, (CUmemGenericAllocationHandle,)): - pmemHandle = int(memHandle) - cmemHandle = pmemHandle + cdef cydriver.CUdeviceptr cymemptr + if memptr is None: + pmemptr = 0 + elif isinstance(memptr, (CUdeviceptr,)): + pmemptr = int(memptr) else: - pmemHandle = int(CUmemGenericAllocationHandle(memHandle)) - cmemHandle = pmemHandle - cdef ccuda.CUmemGenericAllocationHandle cmcHandle + pmemptr = int(CUdeviceptr(memptr)) + cymemptr = pmemptr + cdef cydriver.CUmemGenericAllocationHandle cymcHandle if mcHandle is None: - cmcHandle = 0 + pmcHandle = 0 elif isinstance(mcHandle, (CUmemGenericAllocationHandle,)): pmcHandle = int(mcHandle) - cmcHandle = pmcHandle else: pmcHandle = int(CUmemGenericAllocationHandle(mcHandle)) - cmcHandle = pmcHandle - err = ccuda.cuMulticastBindMem(cmcHandle, mcOffset, cmemHandle, memOffset, size, flags) - return (CUresult(err),) -{{endif}} - -{{if 'cuMulticastBindAddr' in found_functions}} + cymcHandle = pmcHandle + with nogil: + err = cydriver.cuMulticastBindAddr(cymcHandle, mcOffset, cymemptr, size, flags) + return (_CUresult(err),) @cython.embedsignature(True) -def cuMulticastBindAddr(mcHandle, size_t mcOffset, memptr, size_t size, unsigned long long flags): +def cuMulticastBindAddr_v2(mcHandle, dev, size_t mcOffset, memptr, size_t size, unsigned long long flags): """ Bind a memory allocation represented by a virtual address to a multicast object. Binds a memory allocation specified by its mapped address `memptr` to a - multicast object represented by `mcHandle`. The memory must have been - allocated via :py:obj:`~.cuMemCreate` or :py:obj:`~.cudaMallocAsync`. - The intended `size` of the bind, the offset in the multicast range + multicast object represented by `mcHandle`. The binding will be + applicable for the device `dev`. The memory must have been allocated + via :py:obj:`~.cuMemCreate` or :py:obj:`~.cudaMallocAsync`. The + intended `size` of the bind, the offset in the multicast range `mcOffset` and `memptr` must be a multiple of the value returned by :py:obj:`~.cuMulticastGetGranularity` with the flag :py:obj:`~.CU_MULTICAST_GRANULARITY_MINIMUM`. For best performance @@ -28552,8 +37094,17 @@ def cuMulticastBindAddr(mcHandle, size_t mcOffset, memptr, size_t size, unsigned The `size` cannot be larger than the size of the allocated memory. Similarly the `size` + `mcOffset` cannot be larger than the total size - of the multicast object. The memory allocation must have beeen created - on one of the devices that was added to the multicast team via + of the multicast object. + + For device memory, i.e., type :py:obj:`~.CU_MEM_LOCATION_TYPE_DEVICE`, + the memory allocation must have been created on the device specified by + `dev`. For host NUMA memory, i.e., type + :py:obj:`~.CU_MEM_LOCATION_TYPE_HOST_NUMA`, the memory allocation must + have been created on the CPU NUMA node closest to `dev`. That is, the + value returned when querying + :py:obj:`~.CU_DEVICE_ATTRIBUTE_HOST_NUMA_ID` for `dev`, must be the CPU + NUMA node where the memory was allocated. In both cases, the device + named by `dev` must have been added to the multicast team via :py:obj:`~.cuMulticastAddDevice`. Externally shareable as well as imported multicast objects can be bound only to externally shareable memory. Note that this call will return CUDA_ERROR_OUT_OF_MEMORY if @@ -28561,10 +37112,18 @@ def cuMulticastBindAddr(mcHandle, size_t mcOffset, memptr, size_t size, unsigned call may also return CUDA_ERROR_SYSTEM_NOT_READY if the necessary system software is not initialized or running. + This call may return CUDA_ERROR_ILLEGAL_STATE if the system + configuration is in an illegal state. In such cases, to continue using + multicast, verify that the system configuration is in a valid state and + all required driver daemons are running properly. + Parameters ---------- mcHandle : :py:obj:`~.CUmemGenericAllocationHandle` Handle representing a multicast object. + dev : :py:obj:`~.CUdevice` + The device that for which the multicast memory binding will be + applicable. mcOffset : size_t Offset into multicast va range for attachment. memptr : :py:obj:`~.CUdeviceptr` @@ -28577,35 +37136,39 @@ def cuMulticastBindAddr(mcHandle, size_t mcOffset, memptr, size_t size, unsigned Returns ------- CUresult - :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_INVALID_DEVICE`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_PERMITTED`, :py:obj:`~.CUDA_ERROR_NOT_SUPPORTED`, :py:obj:`~.CUDA_ERROR_OUT_OF_MEMORY`, :py:obj:`~.CUDA_ERROR_SYSTEM_NOT_READY` + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_INVALID_DEVICE`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_PERMITTED`, :py:obj:`~.CUDA_ERROR_NOT_SUPPORTED`, :py:obj:`~.CUDA_ERROR_OUT_OF_MEMORY`, :py:obj:`~.CUDA_ERROR_SYSTEM_NOT_READY`, :py:obj:`~.CUDA_ERROR_ILLEGAL_STATE`, See Also -------- :py:obj:`~.cuMulticastCreate`, :py:obj:`~.cuMulticastAddDevice`, :py:obj:`~.cuMemCreate` """ - cdef ccuda.CUdeviceptr cmemptr + cdef cydriver.CUdeviceptr cymemptr if memptr is None: - cmemptr = 0 + pmemptr = 0 elif isinstance(memptr, (CUdeviceptr,)): pmemptr = int(memptr) - cmemptr = pmemptr else: pmemptr = int(CUdeviceptr(memptr)) - cmemptr = pmemptr - cdef ccuda.CUmemGenericAllocationHandle cmcHandle + cymemptr = pmemptr + cdef cydriver.CUdevice cydev + if dev is None: + pdev = 0 + elif isinstance(dev, (CUdevice,)): + pdev = int(dev) + else: + pdev = int(CUdevice(dev)) + cydev = pdev + cdef cydriver.CUmemGenericAllocationHandle cymcHandle if mcHandle is None: - cmcHandle = 0 + pmcHandle = 0 elif isinstance(mcHandle, (CUmemGenericAllocationHandle,)): pmcHandle = int(mcHandle) - cmcHandle = pmcHandle else: pmcHandle = int(CUmemGenericAllocationHandle(mcHandle)) - cmcHandle = pmcHandle - err = ccuda.cuMulticastBindAddr(cmcHandle, mcOffset, cmemptr, size, flags) - return (CUresult(err),) -{{endif}} - -{{if 'cuMulticastUnbind' in found_functions}} + cymcHandle = pmcHandle + with nogil: + err = cydriver.cuMulticastBindAddr_v2(cymcHandle, cydev, mcOffset, cymemptr, size, flags) + return (_CUresult(err),) @cython.embedsignature(True) def cuMulticastUnbind(mcHandle, dev, size_t mcOffset, size_t size): @@ -28639,33 +37202,31 @@ def cuMulticastUnbind(mcHandle, dev, size_t mcOffset, size_t size): -------- :py:obj:`~.cuMulticastBindMem`, :py:obj:`~.cuMulticastBindAddr` + :py:obj:`~.cuMulticastBindMem_v2`, :py:obj:`~.cuMulticastBindAddr_v2` + Notes ----- Warning: The `mcOffset` and the `size` must match the corresponding values specified during the bind call. Any other values may result in undefined behavior. """ - cdef ccuda.CUdevice cdev + cdef cydriver.CUdevice cydev if dev is None: - cdev = 0 + pdev = 0 elif isinstance(dev, (CUdevice,)): pdev = int(dev) - cdev = pdev else: pdev = int(CUdevice(dev)) - cdev = pdev - cdef ccuda.CUmemGenericAllocationHandle cmcHandle + cydev = pdev + cdef cydriver.CUmemGenericAllocationHandle cymcHandle if mcHandle is None: - cmcHandle = 0 + pmcHandle = 0 elif isinstance(mcHandle, (CUmemGenericAllocationHandle,)): pmcHandle = int(mcHandle) - cmcHandle = pmcHandle else: pmcHandle = int(CUmemGenericAllocationHandle(mcHandle)) - cmcHandle = pmcHandle - err = ccuda.cuMulticastUnbind(cmcHandle, cdev, mcOffset, size) - return (CUresult(err),) -{{endif}} - -{{if 'cuMulticastGetGranularity' in found_functions}} + cymcHandle = pmcHandle + with nogil: + err = cydriver.cuMulticastUnbind(cymcHandle, cydev, mcOffset, size) + return (_CUresult(err),) @cython.embedsignature(True) def cuMulticastGetGranularity(prop : Optional[CUmulticastObjectProp], option not None : CUmulticastGranularity_flags): @@ -28693,15 +37254,760 @@ def cuMulticastGetGranularity(prop : Optional[CUmulticastObjectProp], option not See Also -------- :py:obj:`~.cuMulticastCreate`, :py:obj:`~.cuMulticastBindMem`, :py:obj:`~.cuMulticastBindAddr`, :py:obj:`~.cuMulticastUnbind` + + :py:obj:`~.cuMulticastBindMem_v2`, :py:obj:`~.cuMulticastBindAddr_v2` """ cdef size_t granularity = 0 - cdef ccuda.CUmulticastObjectProp* cprop_ptr = prop._ptr if prop != None else NULL - cdef ccuda.CUmulticastGranularity_flags coption = option.value - err = ccuda.cuMulticastGetGranularity(&granularity, cprop_ptr, coption) - return (CUresult(err), granularity) -{{endif}} + cdef cydriver.CUmulticastObjectProp* cyprop_ptr = prop._pvt_ptr if prop is not None else NULL + cdef cydriver.CUmulticastGranularity_flags cyoption = int(option) + with nogil: + err = cydriver.cuMulticastGetGranularity(&granularity, cyprop_ptr, cyoption) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, granularity) + +@cython.embedsignature(True) +def cuLogicalEndpointIdReserve(count): + """ Reserves a range of logical endpoint ids. + + Reserves a range of logical endpoint ids starting at `*baseLeId` and + extending for `count`. The reserved ids can be used to create or import + logical endpoints via :py:obj:`~.cuLogicalEndpointCreate` or + :py:obj:`~.cuLogicalEndpointImport` respectively. + + Parameters + ---------- + count : Any + The number of logical endpoint ids to reserve. + + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_PERMITTED`, :py:obj:`~.CUDA_ERROR_NOT_SUPPORTED`, :py:obj:`~.CUDA_ERROR_OUT_OF_MEMORY`, + baseLeId : :py:obj:`~.CUlogicalEndpointId` + If :py:obj:`~.cuLogicalEndpointIdReserve` returns CUDA_SUCCESS, + *baseLeId contains the base logical endpoint id of the reserved + logical endpoint id range. + + See Also + -------- + :py:obj:`~.cuLogicalEndpointCreate`, :py:obj:`~.cuLogicalEndpointAddDevice`, :py:obj:`~.cuLogicalEndpointDestroy`, :py:obj:`~.cuLogicalEndpointBindAddr`, :py:obj:`~.cuLogicalEndpointBindMem`, :py:obj:`~.cuLogicalEndpointUnbind`, :py:obj:`~.cuLogicalEndpointExport`, :py:obj:`~.cuLogicalEndpointImport`, :py:obj:`~.cuLogicalEndpointGetLimits`, :py:obj:`~.cuLogicalEndpointQuery` + """ + cdef cydriver.cuuint32_t cycount + if count is None: + pcount = 0 + elif isinstance(count, (cuuint32_t,)): + pcount = int(count) + else: + pcount = int(cuuint32_t(count)) + cycount = pcount + cdef CUlogicalEndpointId baseLeId = CUlogicalEndpointId() + with nogil: + err = cydriver.cuLogicalEndpointIdReserve(baseLeId._pvt_ptr, cycount) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, baseLeId) + +@cython.embedsignature(True) +def cuLogicalEndpointIdRelease(baseLeId, count): + """ Releases a range of logical endpoint ids. + + Releases up to `count` logical endpoint ids starting at `baseLeId`. The + range of ids represented by [`baseLeId`, `baseLeId` + `count`) must all + be previously reserved. All logical endpoints in the range must be + destroyed before they can be released. + + Parameters + ---------- + baseLeId : :py:obj:`~.CUlogicalEndpointId` + First logical endpoint id to be released back to the system. + count : Any + Number of logical endpoint ids to release back to the system. + + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_PERMITTED`, :py:obj:`~.CUDA_ERROR_NOT_SUPPORTED`, :py:obj:`~.CUDA_ERROR_OUT_OF_MEMORY`, + + See Also + -------- + :py:obj:`~.cuLogicalEndpointCreate`, :py:obj:`~.cuLogicalEndpointAddDevice`, :py:obj:`~.cuLogicalEndpointDestroy`, :py:obj:`~.cuLogicalEndpointBindAddr`, :py:obj:`~.cuLogicalEndpointBindMem`, :py:obj:`~.cuLogicalEndpointUnbind`, :py:obj:`~.cuLogicalEndpointExport`, :py:obj:`~.cuLogicalEndpointImport`, :py:obj:`~.cuLogicalEndpointGetLimits`, :py:obj:`~.cuLogicalEndpointQuery` + """ + cdef cydriver.cuuint32_t cycount + if count is None: + pcount = 0 + elif isinstance(count, (cuuint32_t,)): + pcount = int(count) + else: + pcount = int(cuuint32_t(count)) + cycount = pcount + cdef cydriver.CUlogicalEndpointId cybaseLeId + if baseLeId is None: + pbaseLeId = 0 + elif isinstance(baseLeId, (CUlogicalEndpointId,)): + pbaseLeId = int(baseLeId) + else: + pbaseLeId = int(CUlogicalEndpointId(baseLeId)) + cybaseLeId = pbaseLeId + with nogil: + err = cydriver.cuLogicalEndpointIdRelease(cybaseLeId, cycount) + return (_CUresult(err),) + +@cython.embedsignature(True) +def cuLogicalEndpointCreate(leId, prop : Optional[CUlogicalEndpointProp]): + """ Creates a logical endpoint with the requested properties and associates it with the logical endpoint id. + + This creates a logical endpoint as described by `prop`. The number of + participating devices is determined by the + :py:obj:`~.CUlogicalEndpointProp.type`. If the type is + :py:obj:`~.CU_LOGICAL_ENDPOINT_TYPE_UNICAST` then + :py:obj:`~.CUlogicalEndpointProp.unicast.device` specifies the owner + device of the unicast logical endpoint. If the type is + :py:obj:`~.CU_LOGICAL_ENDPOINT_TYPE_MULTICAST` then + :py:obj:`~.CUlogicalEndpointProp.multicast.numDevices` specifies the + number of devices in the multicast logical endpoint team. + + Devices can be added to a multicast logical endpoint via + :py:obj:`~.cuLogicalEndpointAddDevice`. After all the participating + devices have been added, a call to :py:obj:`~.cuLogicalEndpointQuery` + must be made to ensure that the logical endpoint is ready for memory + binding and access. + + A unicast logical endpoint does not have a notion of adding devices via + :py:obj:`~.cuLogicalEndpointAddDevice`. However, a call to + :py:obj:`~.cuLogicalEndpointQuery` must still be made to ensure that + the logical endpoint is ready for memory binding and access. + + Memory is bound to the logical endpoint via either + :py:obj:`~.cuLogicalEndpointBindAddr` or + :py:obj:`~.cuLogicalEndpointBindMem`, and can be unbound via + :py:obj:`~.cuLogicalEndpointUnbind`. The total amount of memory that + can be bound per device is specified by + :py:obj:`~.CUlogicalEndpointProp.size`. This size must be a multiple of + the value for `bindAlignment` as returned by + :py:obj:`~.cuLogicalEndpointGetLimits`. The maximum size for the + logical endpoint cannot exceed the value for `maxSize` as returned by + :py:obj:`~.cuLogicalEndpointGetLimits`. The bind alignment and maximum + size depend on the properties of the logical endpoint. + + Parameters + ---------- + leId : :py:obj:`~.CUlogicalEndpointId` + Logical endpoint id that will be associated with the newly created + logical endpoint. + prop : :py:obj:`~.CUlogicalEndpointProp` + Properties of the logical endpoint to create. + + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_PERMITTED`, :py:obj:`~.CUDA_ERROR_NOT_SUPPORTED`, :py:obj:`~.CUDA_ERROR_OUT_OF_MEMORY`, + + See Also + -------- + :py:obj:`~.cuLogicalEndpointIdReserve`, :py:obj:`~.cuLogicalEndpointIdRelease`, :py:obj:`~.cuLogicalEndpointAddDevice`, :py:obj:`~.cuLogicalEndpointDestroy`, :py:obj:`~.cuLogicalEndpointBindAddr`, :py:obj:`~.cuLogicalEndpointBindMem`, :py:obj:`~.cuLogicalEndpointUnbind`, :py:obj:`~.cuLogicalEndpointExport`, :py:obj:`~.cuLogicalEndpointImport`, :py:obj:`~.cuLogicalEndpointGetLimits`, :py:obj:`~.cuLogicalEndpointQuery` + """ + cdef cydriver.CUlogicalEndpointId cyleId + if leId is None: + pleId = 0 + elif isinstance(leId, (CUlogicalEndpointId,)): + pleId = int(leId) + else: + pleId = int(CUlogicalEndpointId(leId)) + cyleId = pleId + cdef cydriver.CUlogicalEndpointProp* cyprop_ptr = prop._pvt_ptr if prop is not None else NULL + with nogil: + err = cydriver.cuLogicalEndpointCreate(cyleId, cyprop_ptr) + return (_CUresult(err),) + +@cython.embedsignature(True) +def cuLogicalEndpointAddDevice(leId, dev): + """ Associates a device to a multicast logical endpoint. + + Associates a device to a logical endpoint. The type of the logical + endpoint must be :py:obj:`~.CU_LOGICAL_ENDPOINT_TYPE_MULTICAST`. The + added device will be a part of the multicast team of size specified by + :py:obj:`~.CUlogicalEndpointProp.multicast.numDevices` during + :py:obj:`~.cuLogicalEndpointCreate`. The association of the device to + the multicast logical endpoint is permanent during the life time of the + multicast logical endpoint. All devices must be added to the multicast + logical endpoint before any memory can be bound to any device in the + team. A multicast logical endpoint will not be ready for use until all + devices have been added. User can query whether the logical endpoint is + ready for use via :py:obj:`~.cuLogicalEndpointQuery`. + + Parameters + ---------- + leId : :py:obj:`~.CUlogicalEndpointId` + Logical endpoint id representing a multicast logical endpoint. + dev : :py:obj:`~.CUdevice` + Device that will be associated with the multicast logical endpoint. + + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_PERMITTED`, :py:obj:`~.CUDA_ERROR_NOT_SUPPORTED`, + + See Also + -------- + :py:obj:`~.cuLogicalEndpointCreate`, :py:obj:`~.cuLogicalEndpointIdReserve`, :py:obj:`~.cuLogicalEndpointIdRelease`, :py:obj:`~.cuLogicalEndpointDestroy`, :py:obj:`~.cuLogicalEndpointBindAddr`, :py:obj:`~.cuLogicalEndpointBindMem`, :py:obj:`~.cuLogicalEndpointUnbind`, :py:obj:`~.cuLogicalEndpointExport`, :py:obj:`~.cuLogicalEndpointImport`, :py:obj:`~.cuLogicalEndpointGetLimits`, :py:obj:`~.cuLogicalEndpointQuery` + """ + cdef cydriver.CUdevice cydev + if dev is None: + pdev = 0 + elif isinstance(dev, (CUdevice,)): + pdev = int(dev) + else: + pdev = int(CUdevice(dev)) + cydev = pdev + cdef cydriver.CUlogicalEndpointId cyleId + if leId is None: + pleId = 0 + elif isinstance(leId, (CUlogicalEndpointId,)): + pleId = int(leId) + else: + pleId = int(CUlogicalEndpointId(leId)) + cyleId = pleId + with nogil: + err = cydriver.cuLogicalEndpointAddDevice(cyleId, cydev) + return (_CUresult(err),) + +@cython.embedsignature(True) +def cuLogicalEndpointDestroy(leId): + """ Removes the association of the logical endpoint from the logical endpoint id. + + Removes the association between the logical endpoint id and the logical + endpoint resources. Any memory bound by this process to any device + associated with the logical endpoint will be unbound. If this was the + last reference to the logical endpoint, all associated resources will + be destroyed. + + Parameters + ---------- + leId : :py:obj:`~.CUlogicalEndpointId` + Logical endpoint id of the logical endpoint to be destroyed. + + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_PERMITTED`, :py:obj:`~.CUDA_ERROR_NOT_SUPPORTED`, + + See Also + -------- + :py:obj:`~.cuLogicalEndpointCreate`, :py:obj:`~.cuLogicalEndpointIdReserve`, :py:obj:`~.cuLogicalEndpointIdRelease`, :py:obj:`~.cuLogicalEndpointAddDevice`, :py:obj:`~.cuLogicalEndpointBindAddr`, :py:obj:`~.cuLogicalEndpointBindMem`, :py:obj:`~.cuLogicalEndpointUnbind`, :py:obj:`~.cuLogicalEndpointExport`, :py:obj:`~.cuLogicalEndpointImport`, :py:obj:`~.cuLogicalEndpointGetLimits`, :py:obj:`~.cuLogicalEndpointQuery` + """ + cdef cydriver.CUlogicalEndpointId cyleId + if leId is None: + pleId = 0 + elif isinstance(leId, (CUlogicalEndpointId,)): + pleId = int(leId) + else: + pleId = int(CUlogicalEndpointId(leId)) + cyleId = pleId + with nogil: + err = cydriver.cuLogicalEndpointDestroy(cyleId) + return (_CUresult(err),) + +@cython.embedsignature(True) +def cuLogicalEndpointBindAddr(leId, dev, offset, ptr, size, unsigned long long flags): + """ Bind a memory allocation represented by a virtual address to a logical endpoint. + + Binds the memory allocation specified by its mapped address `ptr` to a + logical endpoint represented by `leId` at the offset `offset`. The + memory must have been allocated via :py:obj:`~.cuMemCreate` or + :py:obj:`~.cudaMallocAsync`. The intended `size` of the bind, the + `offset` in the logical endpoint range and `ptr` must be multiples of + the value for `bindAlignment` as returned by + :py:obj:`~.cuLogicalEndpointGetLimits`. + + The `size` cannot be larger than the size of the allocated memory. + Similarly the `size` + `offset` cannot be larger than the total size of + the logical endpoint. + + For device memory, i.e., type :py:obj:`~.CU_MEM_LOCATION_TYPE_DEVICE`, + the memory allocation must have been created on the device specified by + `dev`. For host NUMA memory, i.e., type + :py:obj:`~.CU_MEM_LOCATION_TYPE_HOST_NUMA`, the memory allocation must + have been created on the CPU NUMA node closest to `dev`. That is, the + value returned when querying + :py:obj:`~.CU_DEVICE_ATTRIBUTE_HOST_NUMA_ID` for `dev`, must be the CPU + NUMA node where the memory was allocated. + + For multicast endpoints, the device named by `dev` must have been added + to the multicast team via :py:obj:`~.cuLogicalEndpointAddDevice`. + + For unicast endpoints the device named by `dev` must be the owner + device specified during :py:obj:`~.cuLogicalEndpointCreate` via + :py:obj:`~.CUlogicalEndpointProp.unicast.device`. + + Externally shareable as well as imported multicast endpoints can be + bound only to externally shareable memory. Imported unicast endpoints + cannot be bound to any memory. + + This call will return :py:obj:`~.CUDA_ERROR_INVALID_VALUE` if + :py:obj:`~.cuLogicalEndpointQuery` has not been called for the logical + endpoint to ensure that the endpoint is ready for memory binding. + + Note that this call will return :py:obj:`~.CUDA_ERROR_OUT_OF_MEMORY` if + there are insufficient resources required to perform the bind. This + call may also return :py:obj:`~.CUDA_ERROR_SYSTEM_NOT_READY` if the + necessary system software is not initialized or running. This call may + return :py:obj:`~.CUDA_ERROR_ILLEGAL_STATE` if the system configuration + is in an illegal state. In such cases, to continue using logical + endpoints, verify that the system configuration is in a valid state and + all required driver daemons are running properly. + + Parameters + ---------- + leId : :py:obj:`~.CUlogicalEndpointId` + Logical endpoint to which memory will be associated. + dev : :py:obj:`~.CUdevice` + Device on which the memory will be bound to the logical endpoint + offset : Any + Offset into the logical endpoint space. + ptr : Any + Virtual address of the memory allocation. + size : Any + Size of memory that will be bound to the logical endpoint. + flags : unsigned long long + Flags for future use, must be zero for now. + + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_PERMITTED`, :py:obj:`~.CUDA_ERROR_NOT_SUPPORTED`, :py:obj:`~.CUDA_ERROR_OUT_OF_MEMORY`, :py:obj:`~.CUDA_ERROR_SYSTEM_NOT_READY`, :py:obj:`~.CUDA_ERROR_ILLEGAL_STATE` + + See Also + -------- + :py:obj:`~.cuLogicalEndpointCreate`, :py:obj:`~.cuLogicalEndpointIdReserve`, :py:obj:`~.cuLogicalEndpointIdRelease`, :py:obj:`~.cuLogicalEndpointAddDevice`, :py:obj:`~.cuLogicalEndpointDestroy`, :py:obj:`~.cuLogicalEndpointBindMem`, :py:obj:`~.cuLogicalEndpointUnbind`, :py:obj:`~.cuLogicalEndpointExport`, :py:obj:`~.cuLogicalEndpointImport`, :py:obj:`~.cuLogicalEndpointGetLimits`, :py:obj:`~.cuLogicalEndpointQuery` + """ + cdef cydriver.cuuint64_t cysize + if size is None: + psize = 0 + elif isinstance(size, (cuuint64_t,)): + psize = int(size) + else: + psize = int(cuuint64_t(size)) + cysize = psize + cdef cydriver.cuuint64_t cyoffset + if offset is None: + poffset = 0 + elif isinstance(offset, (cuuint64_t,)): + poffset = int(offset) + else: + poffset = int(cuuint64_t(offset)) + cyoffset = poffset + cdef cydriver.CUdevice cydev + if dev is None: + pdev = 0 + elif isinstance(dev, (CUdevice,)): + pdev = int(dev) + else: + pdev = int(CUdevice(dev)) + cydev = pdev + cdef cydriver.CUlogicalEndpointId cyleId + if leId is None: + pleId = 0 + elif isinstance(leId, (CUlogicalEndpointId,)): + pleId = int(leId) + else: + pleId = int(CUlogicalEndpointId(leId)) + cyleId = pleId + cdef _HelperInputVoidPtrStruct cyptrHelper + cdef void* cyptr = _helper_input_void_ptr(ptr, &cyptrHelper) + with nogil: + err = cydriver.cuLogicalEndpointBindAddr(cyleId, cydev, cyoffset, cyptr, cysize, flags) + _helper_input_void_ptr_free(&cyptrHelper) + return (_CUresult(err),) + +@cython.embedsignature(True) +def cuLogicalEndpointBindMem(leId, dev, offset, memHandle, memOffset, size, unsigned long long flags): + """ Binds memory object represented by a handle to the logical endpoint. + + Binds the memory allocation specified by `memHandle` to a logical + endpoint represented by `leId` at the offset `offset`. The memory must + have been allocated via :py:obj:`~.cuMemCreate`. The intended `size` of + the bind, the offset in the logical endpoint range `offset` and the + offset in the memory handle `memOffset` must be multiples of the value + for `bindAlignment` as returned by + :py:obj:`~.cuLogicalEndpointGetLimits`. + + The `size` + `memOffset` cannot be larger than the size of the + allocated memory. Similarly the `size` + `offset` cannot be larger than + the total size of the logical endpoint. + + For device memory, i.e., type :py:obj:`~.CU_MEM_LOCATION_TYPE_DEVICE`, + the memory allocation must have been created on the device specified by + `dev`. For host NUMA memory, i.e., type + :py:obj:`~.CU_MEM_LOCATION_TYPE_HOST_NUMA`, the memory allocation must + have been created on the CPU NUMA node closest to `dev`. That is, the + value returned when querying + :py:obj:`~.CU_DEVICE_ATTRIBUTE_HOST_NUMA_ID` for `dev`, must be the CPU + NUMA node where the memory was allocated. + + For multicast endpoints, the device named by `dev` must have been added + to the multicast team via :py:obj:`~.cuLogicalEndpointAddDevice`. + + For unicast endpoints the device named by `dev` must be the owner + device specified during :py:obj:`~.cuLogicalEndpointCreate` via + :py:obj:`~.CUlogicalEndpointProp.unicast.device`. + + Externally shareable as well as imported multicast endpoints can be + bound only to externally shareable memory. Imported unicast endpoints + cannot be bound to any memory. + + This call will return :py:obj:`~.CUDA_ERROR_INVALID_VALUE` if + :py:obj:`~.cuLogicalEndpointQuery` has not been called for the logical + endpoint to ensure that the endpoint is ready for memory binding. + + Note that this call will return :py:obj:`~.CUDA_ERROR_OUT_OF_MEMORY` if + there are insufficient resources required to perform the bind. This + call may also return :py:obj:`~.CUDA_ERROR_SYSTEM_NOT_READY` if the + necessary system software is not initialized or running. This call may + return :py:obj:`~.CUDA_ERROR_ILLEGAL_STATE` if the system configuration + is in an illegal state. In such cases, to continue using logical + endpoints, verify that the system configuration is in a valid state and + all required driver daemons are running properly. + + Parameters + ---------- + leId : :py:obj:`~.CUlogicalEndpointId` + Logical endpoint to which memory will be associated. + dev : :py:obj:`~.CUdevice` + Device on which the memory will be bound to the logical endpoint + offset : Any + Offset into the logical endpoint space. + memHandle : :py:obj:`~.CUmemGenericAllocationHandle` + Handle representing a memory allocation. + memOffset : Any + Offset into the memory for the attachment + size : Any + Size of memory that will be bound to the logical endpoint. + flags : unsigned long long + Flags for future use, must be zero for now. + + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_PERMITTED`, :py:obj:`~.CUDA_ERROR_NOT_SUPPORTED`, :py:obj:`~.CUDA_ERROR_OUT_OF_MEMORY`, :py:obj:`~.CUDA_ERROR_SYSTEM_NOT_READY`, :py:obj:`~.CUDA_ERROR_ILLEGAL_STATE` + + See Also + -------- + :py:obj:`~.cuLogicalEndpointCreate`, :py:obj:`~.cuLogicalEndpointIdReserve`, :py:obj:`~.cuLogicalEndpointIdRelease`, :py:obj:`~.cuLogicalEndpointAddDevice`, :py:obj:`~.cuLogicalEndpointDestroy`, :py:obj:`~.cuLogicalEndpointBindAddr`, :py:obj:`~.cuLogicalEndpointUnbind`, :py:obj:`~.cuLogicalEndpointExport`, :py:obj:`~.cuLogicalEndpointImport`, :py:obj:`~.cuLogicalEndpointGetLimits`, :py:obj:`~.cuLogicalEndpointQuery` + """ + cdef cydriver.cuuint64_t cysize + if size is None: + psize = 0 + elif isinstance(size, (cuuint64_t,)): + psize = int(size) + else: + psize = int(cuuint64_t(size)) + cysize = psize + cdef cydriver.cuuint64_t cymemOffset + if memOffset is None: + pmemOffset = 0 + elif isinstance(memOffset, (cuuint64_t,)): + pmemOffset = int(memOffset) + else: + pmemOffset = int(cuuint64_t(memOffset)) + cymemOffset = pmemOffset + cdef cydriver.CUmemGenericAllocationHandle cymemHandle + if memHandle is None: + pmemHandle = 0 + elif isinstance(memHandle, (CUmemGenericAllocationHandle,)): + pmemHandle = int(memHandle) + else: + pmemHandle = int(CUmemGenericAllocationHandle(memHandle)) + cymemHandle = pmemHandle + cdef cydriver.cuuint64_t cyoffset + if offset is None: + poffset = 0 + elif isinstance(offset, (cuuint64_t,)): + poffset = int(offset) + else: + poffset = int(cuuint64_t(offset)) + cyoffset = poffset + cdef cydriver.CUdevice cydev + if dev is None: + pdev = 0 + elif isinstance(dev, (CUdevice,)): + pdev = int(dev) + else: + pdev = int(CUdevice(dev)) + cydev = pdev + cdef cydriver.CUlogicalEndpointId cyleId + if leId is None: + pleId = 0 + elif isinstance(leId, (CUlogicalEndpointId,)): + pleId = int(leId) + else: + pleId = int(CUlogicalEndpointId(leId)) + cyleId = pleId + with nogil: + err = cydriver.cuLogicalEndpointBindMem(cyleId, cydev, cyoffset, cymemHandle, cymemOffset, cysize, flags) + return (_CUresult(err),) + +@cython.embedsignature(True) +def cuLogicalEndpointUnbind(leId, dev, offset, size): + """ Unbinds any binding at offset from the logical endpoint. + + Unbinds any memory allocations bound to the logical endpoint on `dev` + at `offset` and up to the given `size`. The intended `size` of the + unbind and the offset in the logical endpoint range `offset` must be + multiples of the value for `bindAlignment` as returned by + :py:obj:`~.cuLogicalEndpointGetLimits`. + + Parameters + ---------- + leId : :py:obj:`~.CUlogicalEndpointId` + Logical endpoint id representing a logical endpoint. + dev : :py:obj:`~.CUdevice` + Device on which the memory is bound to the logical endpoint + offset : Any + Offset into the logical endpoint. + size : Any + Desired size to unbind. + + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_PERMITTED`, :py:obj:`~.CUDA_ERROR_NOT_SUPPORTED`, :py:obj:`~.CUDA_ERROR_OUT_OF_MEMORY`, :py:obj:`~.CUDA_ERROR_SYSTEM_NOT_READY`, :py:obj:`~.CUDA_ERROR_ILLEGAL_STATE` + + See Also + -------- + :py:obj:`~.cuLogicalEndpointCreate`, :py:obj:`~.cuLogicalEndpointIdReserve`, :py:obj:`~.cuLogicalEndpointIdRelease`, :py:obj:`~.cuLogicalEndpointAddDevice`, :py:obj:`~.cuLogicalEndpointDestroy`, :py:obj:`~.cuLogicalEndpointBindAddr`, :py:obj:`~.cuLogicalEndpointBindMem`, :py:obj:`~.cuLogicalEndpointExport`, :py:obj:`~.cuLogicalEndpointImport`, :py:obj:`~.cuLogicalEndpointGetLimits`, :py:obj:`~.cuLogicalEndpointQuery` + + Notes + ----- + The `offset` must correspond to a value specified during a bind call. The `size` must either match the bind call of the offset or be the combined `size` of multiple bind calls. The `size` + `offset` must fully enclose all bindings that are covered. + """ + cdef cydriver.cuuint64_t cysize + if size is None: + psize = 0 + elif isinstance(size, (cuuint64_t,)): + psize = int(size) + else: + psize = int(cuuint64_t(size)) + cysize = psize + cdef cydriver.cuuint64_t cyoffset + if offset is None: + poffset = 0 + elif isinstance(offset, (cuuint64_t,)): + poffset = int(offset) + else: + poffset = int(cuuint64_t(offset)) + cyoffset = poffset + cdef cydriver.CUdevice cydev + if dev is None: + pdev = 0 + elif isinstance(dev, (CUdevice,)): + pdev = int(dev) + else: + pdev = int(CUdevice(dev)) + cydev = pdev + cdef cydriver.CUlogicalEndpointId cyleId + if leId is None: + pleId = 0 + elif isinstance(leId, (CUlogicalEndpointId,)): + pleId = int(leId) + else: + pleId = int(CUlogicalEndpointId(leId)) + cyleId = pleId + with nogil: + err = cydriver.cuLogicalEndpointUnbind(cyleId, cydev, cyoffset, cysize) + return (_CUresult(err),) + +@cython.embedsignature(True) +def cuLogicalEndpointExport(leId, handleType not None : CUlogicalEndpointIpcHandleType): + """ Exports a logical endpoint associated with leId to an IPC handle. + + Given a logical endpoint id `leId`, create a shareable handle `handle` + that can be used to share the logical endpoint with other processes. + The recipient process can convert the shareable handle back into a + logical endpoint id using :py:obj:`~.cuLogicalEndpointImport`. The + implementation of what this `handle` is and how it can be transfered is + defined by the requested handle type in `handletype`. + + Parameters + ---------- + leId : :py:obj:`~.CUlogicalEndpointId` + Logical endpoint id of logical endpoint. + handleType : :py:obj:`~.CUlogicalEndpointIpcHandleType` + Type of shareable handle requested. Defines type and size of the + handle output parameter. + + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_PERMITTED`, :py:obj:`~.CUDA_ERROR_NOT_SUPPORTED`, :py:obj:`~.CUDA_ERROR_OUT_OF_MEMORY`, + handle : Any + Pointer to the location in which to store the requested handle + type. + + See Also + -------- + :py:obj:`~.cuLogicalEndpointCreate`, :py:obj:`~.cuLogicalEndpointIdReserve`, :py:obj:`~.cuLogicalEndpointIdRelease`, :py:obj:`~.cuLogicalEndpointAddDevice`, :py:obj:`~.cuLogicalEndpointDestroy`, :py:obj:`~.cuLogicalEndpointBindAddr`, :py:obj:`~.cuLogicalEndpointBindMem`, :py:obj:`~.cuLogicalEndpointUnbind`, :py:obj:`~.cuLogicalEndpointImport`, :py:obj:`~.cuLogicalEndpointGetLimits`, :py:obj:`~.cuLogicalEndpointQuery` + """ + cdef cydriver.CUlogicalEndpointId cyleId + if leId is None: + pleId = 0 + elif isinstance(leId, (CUlogicalEndpointId,)): + pleId = int(leId) + else: + pleId = int(CUlogicalEndpointId(leId)) + cyleId = pleId + cdef CUlogicalEndpointFabricHandle handle = CUlogicalEndpointFabricHandle() + cdef cydriver.CUlogicalEndpointIpcHandleType cyhandleType = int(handleType) + with nogil: + err = cydriver.cuLogicalEndpointExport(handle._pvt_ptr, cyleId, cyhandleType) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, handle) + +@cython.embedsignature(True) +def cuLogicalEndpointImport(leId, handle, handleType not None : CUlogicalEndpointIpcHandleType): + """ Imports a logical endpoint from the given IPC handle and associates it with a logical endpoint id. + + Imports a logical endpoint from the given IPC `handle` and associates + it with the logical endpoint id specified by `leId`. + + If the current process cannot support the logical endpoint described by + the shareable handle, this API will error as + :py:obj:`~.CUDA_ERROR_NOT_SUPPORTED`. If `handle` is of type + :py:obj:`~.CU_LOGICAL_ENDPOINT_IPC_HANDLE_TYPE_FABRIC` and the importer + process does not have access permissions, then + :py:obj:`~.CUDA_ERROR_NOT_PERMITTED` will be returned + + Parameters + ---------- + leId : :py:obj:`~.CUlogicalEndpointId` + Logical endpoint id that will be used to access the exported + logical endpoint. + handle : Any + Shareable handle representing the logical endpoint that is to be + imported. + handleType : :py:obj:`~.CUlogicalEndpointIpcHandleType` + Handle type of the exported handle + + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_PERMITTED`, :py:obj:`~.CUDA_ERROR_NOT_SUPPORTED`, :py:obj:`~.CUDA_ERROR_OUT_OF_MEMORY`, -{{if 'cuPointerGetAttribute' in found_functions}} + See Also + -------- + :py:obj:`~.cuLogicalEndpointCreate`, :py:obj:`~.cuLogicalEndpointIdReserve`, :py:obj:`~.cuLogicalEndpointIdRelease`, :py:obj:`~.cuLogicalEndpointAddDevice`, :py:obj:`~.cuLogicalEndpointDestroy`, :py:obj:`~.cuLogicalEndpointBindAddr`, :py:obj:`~.cuLogicalEndpointBindMem`, :py:obj:`~.cuLogicalEndpointUnbind`, :py:obj:`~.cuLogicalEndpointExport`, :py:obj:`~.cuLogicalEndpointGetLimits`, :py:obj:`~.cuLogicalEndpointQuery` + """ + cdef cydriver.CUlogicalEndpointId cyleId + if leId is None: + pleId = 0 + elif isinstance(leId, (CUlogicalEndpointId,)): + pleId = int(leId) + else: + pleId = int(CUlogicalEndpointId(leId)) + cyleId = pleId + cdef _HelperInputVoidPtrStruct cyhandleHelper + cdef void* cyhandle = _helper_input_void_ptr(handle, &cyhandleHelper) + cdef cydriver.CUlogicalEndpointIpcHandleType cyhandleType = int(handleType) + with nogil: + err = cydriver.cuLogicalEndpointImport(cyleId, cyhandle, cyhandleType) + _helper_input_void_ptr_free(&cyhandleHelper) + return (_CUresult(err),) + +@cython.embedsignature(True) +def cuLogicalEndpointGetLimits(prop : Optional[CUlogicalEndpointProp]): + """ Calculates the minimum alignment and the maximum size for the given logical endpoint properties. + + The `bindAlignment` can be used as a multiple for size and bind offset + values. The `maxSize` is the maximum size of the logical endpoint. If + `maxSize` is less than :py:obj:`~.CUlogicalEndpointProp`:size the user + must adjust the request to the smaller value. + + Parameters + ---------- + prop : :py:obj:`~.CUlogicalEndpointProp` + Properties of the logical endpoint. + + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_PERMITTED`, :py:obj:`~.CUDA_ERROR_NOT_SUPPORTED`, :py:obj:`~.CUDA_ERROR_OUT_OF_MEMORY`, :py:obj:`~.CUDA_ERROR_SYSTEM_NOT_READY`, :py:obj:`~.CUDA_ERROR_ILLEGAL_STATE` + bindAlignment : :py:obj:`~.cuuint64_t` + Minimum alignment granularity of the proposed logical endpoint. + maxSize : :py:obj:`~.cuuint64_t` + Maximum size of the logical endpoint. + + See Also + -------- + :py:obj:`~.cuLogicalEndpointCreate`, :py:obj:`~.cuLogicalEndpointIdReserve`, :py:obj:`~.cuLogicalEndpointIdRelease`, :py:obj:`~.cuLogicalEndpointAddDevice`, :py:obj:`~.cuLogicalEndpointDestroy`, :py:obj:`~.cuLogicalEndpointBindAddr`, :py:obj:`~.cuLogicalEndpointBindMem`, :py:obj:`~.cuLogicalEndpointUnbind`, :py:obj:`~.cuLogicalEndpointExport`, :py:obj:`~.cuLogicalEndpointImport`, :py:obj:`~.cuLogicalEndpointQuery` + """ + cdef cuuint64_t bindAlignment = cuuint64_t() + cdef cuuint64_t maxSize = cuuint64_t() + cdef cydriver.CUlogicalEndpointProp* cyprop_ptr = prop._pvt_ptr if prop is not None else NULL + with nogil: + err = cydriver.cuLogicalEndpointGetLimits(bindAlignment._pvt_ptr, maxSize._pvt_ptr, cyprop_ptr) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None, None) + return (_CUresult_SUCCESS, bindAlignment, maxSize) + +@cython.embedsignature(True) +def cuLogicalEndpointQuery(leId, count): + """ Determines if all logical endpoints in the range have been successfully constructed. + + Queries the driver to determine if all logical endpoints in the given + range starting at `leId` and extending for `count` have been + successfully constructed. + + Provides a mechanism to ensure that it is safe to begin using a logical + endpoint ID. Using a logical endpoint ID before verifying that it is + fully constructed can result in undefined behavior. + + This is not a blocking API, it returns immediately with a `queryStatus` + of 0 if any logical endpoint ID in the given range is not fully + constructed, and a non-zero value otherwise. + + Parameters + ---------- + leId : :py:obj:`~.CUlogicalEndpointId` + First logical endpoint ID to be queried. + count : Any + Number of logical endpoints IDs to be queried. + + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_PERMITTED`, :py:obj:`~.CUDA_ERROR_NOT_SUPPORTED`, :py:obj:`~.CUDA_ERROR_OUT_OF_MEMORY`, :py:obj:`~.CUDA_ERROR_SYSTEM_NOT_READY`, :py:obj:`~.CUDA_ERROR_ILLEGAL_STATE` + queryStatus : int + Status of the logical endpoints. Returns 0 if any logical endpoint + in the given range is not fully constructed, and non-zero if all + logical endpoints in the given range are fully constructed. + + See Also + -------- + :py:obj:`~.cuLogicalEndpointCreate`, :py:obj:`~.cuLogicalEndpointIdReserve`, :py:obj:`~.cuLogicalEndpointIdRelease`, :py:obj:`~.cuLogicalEndpointAddDevice`, :py:obj:`~.cuLogicalEndpointDestroy`, :py:obj:`~.cuLogicalEndpointBindAddr`, :py:obj:`~.cuLogicalEndpointBindMem`, :py:obj:`~.cuLogicalEndpointUnbind`, :py:obj:`~.cuLogicalEndpointExport`, :py:obj:`~.cuLogicalEndpointImport`, :py:obj:`~.cuLogicalEndpointGetLimits` + """ + cdef cydriver.cuuint32_t cycount + if count is None: + pcount = 0 + elif isinstance(count, (cuuint32_t,)): + pcount = int(count) + else: + pcount = int(cuuint32_t(count)) + cycount = pcount + cdef cydriver.CUlogicalEndpointId cyleId + if leId is None: + pleId = 0 + elif isinstance(leId, (CUlogicalEndpointId,)): + pleId = int(leId) + else: + pleId = int(CUlogicalEndpointId(leId)) + cyleId = pleId + cdef int queryStatus = 0 + with nogil: + err = cydriver.cuLogicalEndpointQuery(cyleId, cycount, &queryStatus) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, queryStatus) @cython.embedsignature(True) def cuPointerGetAttribute(attribute not None : CUpointer_attribute, ptr): @@ -28745,7 +38051,7 @@ def cuPointerGetAttribute(attribute not None : CUpointer_attribute, ptr): - Returns in `*data` the device pointer value through which `ptr` may be accessed by kernels running in the current :py:obj:`~.CUcontext`. - The type of `data` must be CUdeviceptr *. + The type of `data` must be :py:obj:`~.CUdeviceptr` *. - If there exists no device pointer value through which kernels running in the current :py:obj:`~.CUcontext` may access `ptr` then @@ -28772,7 +38078,7 @@ def cuPointerGetAttribute(attribute not None : CUpointer_attribute, ptr): - Returns in `*data` two tokens for use with the nv-p2p.h Linux kernel interface. `data` must be a struct of type - CUDA_POINTER_ATTRIBUTE_P2P_TOKENS. + :py:obj:`~.CUDA_POINTER_ATTRIBUTE_P2P_TOKENS`. - `ptr` must be a pointer to memory obtained from :py:obj:`~.py`:obj:`~.cuMemAlloc()`. Note that p2pToken and @@ -28850,6 +38156,12 @@ def cuPointerGetAttribute(attribute not None : CUpointer_attribute, ptr): - Returns in `*data` the handle to the mempool that the allocation was obtained from. + - :py:obj:`~.CU_POINTER_ATTRIBUTE_IS_HW_DECOMPRESS_CAPABLE`: + + - Returns in `*data` a boolean that indicates whether the pointer + points to memory that is capable to be used for hardware accelerated + decompression. + Note that for most allocations in the unified virtual address space the host and device pointer for accessing the allocation will be the same. The exceptions to this are @@ -28890,143 +38202,25 @@ def cuPointerGetAttribute(attribute not None : CUpointer_attribute, ptr): -------- :py:obj:`~.cuPointerSetAttribute`, :py:obj:`~.cuMemAlloc`, :py:obj:`~.cuMemFree`, :py:obj:`~.cuMemAllocHost`, :py:obj:`~.cuMemFreeHost`, :py:obj:`~.cuMemHostAlloc`, :py:obj:`~.cuMemHostRegister`, :py:obj:`~.cuMemHostUnregister`, :py:obj:`~.cudaPointerGetAttributes` """ - cdef ccuda.CUdeviceptr cptr + cdef cydriver.CUdeviceptr cyptr if ptr is None: - cptr = 0 + pptr = 0 elif isinstance(ptr, (CUdeviceptr,)): pptr = int(ptr) - cptr = pptr else: pptr = int(CUdeviceptr(ptr)) - cptr = pptr - cdef utils.HelperCUpointer_attribute cdata = utils.HelperCUpointer_attribute(attribute, 0, is_getter=True) - cdef void* cdata_ptr = cdata.cptr - cdef ccuda.CUpointer_attribute cattribute = attribute.value - err = ccuda.cuPointerGetAttribute(cdata_ptr, cattribute, cptr) - return (CUresult(err), cdata.pyObj()) -{{endif}} - -{{if 'cuMemPrefetchAsync' in found_functions}} - -@cython.embedsignature(True) -def cuMemPrefetchAsync(devPtr, size_t count, dstDevice, hStream): - """ Prefetches memory to the specified destination device. - - Note there is a later version of this API, - :py:obj:`~.cuMemPrefetchAsync_v2`. It will supplant this version in - 13.0, which is retained for minor version compatibility. - - Prefetches memory to the specified destination device. `devPtr` is the - base device pointer of the memory to be prefetched and `dstDevice` is - the destination device. `count` specifies the number of bytes to copy. - `hStream` is the stream in which the operation is enqueued. The memory - range must refer to managed memory allocated via - :py:obj:`~.cuMemAllocManaged` or declared via managed variables. - - Passing in CU_DEVICE_CPU for `dstDevice` will prefetch the data to host - memory. If `dstDevice` is a GPU, then the device attribute - :py:obj:`~.CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS` must be non- - zero. Additionally, `hStream` must be associated with a device that has - a non-zero value for the device attribute - :py:obj:`~.CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS`. - - The start address and end address of the memory range will be rounded - down and rounded up respectively to be aligned to CPU page size before - the prefetch operation is enqueued in the stream. - - If no physical memory has been allocated for this region, then this - memory region will be populated and mapped on the destination device. - If there's insufficient memory to prefetch the desired region, the - Unified Memory driver may evict pages from other - :py:obj:`~.cuMemAllocManaged` allocations to host memory in order to - make room. Device memory allocated using :py:obj:`~.cuMemAlloc` or - :py:obj:`~.cuArrayCreate` will not be evicted. - - By default, any mappings to the previous location of the migrated pages - are removed and mappings for the new location are only setup on - `dstDevice`. The exact behavior however also depends on the settings - applied to this memory range via :py:obj:`~.cuMemAdvise` as described - below: - - If :py:obj:`~.CU_MEM_ADVISE_SET_READ_MOSTLY` was set on any subset of - this memory range, then that subset will create a read-only copy of the - pages on `dstDevice`. - - If :py:obj:`~.CU_MEM_ADVISE_SET_PREFERRED_LOCATION` was called on any - subset of this memory range, then the pages will be migrated to - `dstDevice` even if `dstDevice` is not the preferred location of any - pages in the memory range. - - If :py:obj:`~.CU_MEM_ADVISE_SET_ACCESSED_BY` was called on any subset - of this memory range, then mappings to those pages from all the - appropriate processors are updated to refer to the new location if - establishing such a mapping is possible. Otherwise, those mappings are - cleared. - - Note that this API is not required for functionality and only serves to - improve performance by allowing the application to migrate data to a - suitable location before it is accessed. Memory accesses to this range - are always coherent and are allowed even when the data is actively - being migrated. - - Note that this function is asynchronous with respect to the host and - all work on other devices. - - Parameters - ---------- - devPtr : :py:obj:`~.CUdeviceptr` - Pointer to be prefetched - count : size_t - Size in bytes - dstDevice : :py:obj:`~.CUdevice` - Destination device to prefetch to - hStream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` - Stream to enqueue prefetch operation - - Returns - ------- - CUresult - :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_INVALID_DEVICE` - - See Also - -------- - :py:obj:`~.cuMemcpy`, :py:obj:`~.cuMemcpyPeer`, :py:obj:`~.cuMemcpyAsync`, :py:obj:`~.cuMemcpy3DPeerAsync`, :py:obj:`~.cuMemAdvise`, :py:obj:`~.cuMemPrefetchAsync` :py:obj:`~.cudaMemPrefetchAsync_v2` - """ - cdef ccuda.CUstream chStream - if hStream is None: - chStream = 0 - elif isinstance(hStream, (CUstream,)): - phStream = int(hStream) - chStream = phStream - else: - phStream = int(CUstream(hStream)) - chStream = phStream - cdef ccuda.CUdevice cdstDevice - if dstDevice is None: - cdstDevice = 0 - elif isinstance(dstDevice, (CUdevice,)): - pdstDevice = int(dstDevice) - cdstDevice = pdstDevice - else: - pdstDevice = int(CUdevice(dstDevice)) - cdstDevice = pdstDevice - cdef ccuda.CUdeviceptr cdevPtr - if devPtr is None: - cdevPtr = 0 - elif isinstance(devPtr, (CUdeviceptr,)): - pdevPtr = int(devPtr) - cdevPtr = pdevPtr - else: - pdevPtr = int(CUdeviceptr(devPtr)) - cdevPtr = pdevPtr - err = ccuda.cuMemPrefetchAsync(cdevPtr, count, cdstDevice, chStream) - return (CUresult(err),) -{{endif}} - -{{if 'cuMemPrefetchAsync_v2' in found_functions}} - -@cython.embedsignature(True) -def cuMemPrefetchAsync_v2(devPtr, size_t count, location not None : CUmemLocation, unsigned int flags, hStream): + cyptr = pptr + cdef _HelperCUpointer_attribute cydata = _HelperCUpointer_attribute(attribute, 0, is_getter=True) + cdef void* cydata_ptr = cydata.cptr + cdef cydriver.CUpointer_attribute cyattribute = int(attribute) + with nogil: + err = cydriver.cuPointerGetAttribute(cydata_ptr, cyattribute, cyptr) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, cydata.pyObj()) + +@cython.embedsignature(True) +def cuMemPrefetchAsync(devPtr, size_t count, location not None : CUmemLocation, unsigned int flags, hStream): """ Prefetches memory to the specified destination location. Prefetches memory to the specified destination location. `devPtr` is @@ -29034,7 +38228,8 @@ def cuMemPrefetchAsync_v2(devPtr, size_t count, location not None : CUmemLocatio specifies the destination location. `count` specifies the number of bytes to copy. `hStream` is the stream in which the operation is enqueued. The memory range must refer to managed memory allocated via - :py:obj:`~.cuMemAllocManaged` or declared via managed variables. + :py:obj:`~.cuMemAllocManaged`, via :py:obj:`~.cuMemAllocFromPool` from + a managed memory pool or declared via managed variables. Specifying :py:obj:`~.CU_MEM_LOCATION_TYPE_DEVICE` for :py:obj:`~.CUmemLocation.type` will prefetch memory to GPU specified by @@ -29108,8 +38303,8 @@ def cuMemPrefetchAsync_v2(devPtr, size_t count, location not None : CUmemLocatio Pointer to be prefetched count : size_t Size in bytes - dstDevice : :py:obj:`~.CUmemLocation` - Destination device to prefetch to + location : :py:obj:`~.CUmemLocation` + Location to prefetch to flags : unsigned int flags for future use, must be zero now. hStream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` @@ -29122,40 +38317,32 @@ def cuMemPrefetchAsync_v2(devPtr, size_t count, location not None : CUmemLocatio See Also -------- - :py:obj:`~.cuMemcpy`, :py:obj:`~.cuMemcpyPeer`, :py:obj:`~.cuMemcpyAsync`, :py:obj:`~.cuMemcpy3DPeerAsync`, :py:obj:`~.cuMemAdvise`, :py:obj:`~.cuMemPrefetchAsync` :py:obj:`~.cudaMemPrefetchAsync_v2` + :py:obj:`~.cuMemcpy`, :py:obj:`~.cuMemcpyPeer`, :py:obj:`~.cuMemcpyAsync`, :py:obj:`~.cuMemcpy3DPeerAsync`, :py:obj:`~.cuMemAdvise`, :py:obj:`~.cudaMemPrefetchAsync` """ - cdef ccuda.CUstream chStream + cdef cydriver.CUstream cyhStream if hStream is None: - chStream = 0 + phStream = 0 elif isinstance(hStream, (CUstream,)): phStream = int(hStream) - chStream = phStream else: phStream = int(CUstream(hStream)) - chStream = phStream - cdef ccuda.CUdeviceptr cdevPtr + cyhStream = phStream + cdef cydriver.CUdeviceptr cydevPtr if devPtr is None: - cdevPtr = 0 + pdevPtr = 0 elif isinstance(devPtr, (CUdeviceptr,)): pdevPtr = int(devPtr) - cdevPtr = pdevPtr else: pdevPtr = int(CUdeviceptr(devPtr)) - cdevPtr = pdevPtr - err = ccuda.cuMemPrefetchAsync_v2(cdevPtr, count, location._ptr[0], flags, chStream) - return (CUresult(err),) -{{endif}} - -{{if 'cuMemAdvise' in found_functions}} + cydevPtr = pdevPtr + with nogil: + err = cydriver.cuMemPrefetchAsync(cydevPtr, count, location._pvt_ptr[0], flags, cyhStream) + return (_CUresult(err),) @cython.embedsignature(True) -def cuMemAdvise(devPtr, size_t count, advice not None : CUmem_advise, device): +def cuMemAdvise(devPtr, size_t count, advice not None : CUmem_advise, location not None : CUmemLocation): """ Advise about the usage of a given memory range. - Note there is a later version of this API, :py:obj:`~.cuMemAdvise_v2`. - It will supplant this version in 13.0, which is retained for minor - version compatibility. - Advise the Unified Memory subsystem about the usage pattern for the memory range starting at `devPtr` with a size of `count` bytes. The start address and end address of the memory range will be rounded down @@ -29176,200 +38363,17 @@ def cuMemAdvise(devPtr, size_t count, advice not None : CUmem_advise, device): only copy of at least the accessed pages in that processor's memory. Additionally, if :py:obj:`~.cuMemPrefetchAsync` is called on this region, it will create a read-only copy of the data on the - destination processor. If any processor writes to this region, all - copies of the corresponding page will be invalidated except for the - one where the write occurred. The `device` argument is ignored for - this advice. Note that for a page to be read-duplicated, the - accessing processor must either be the CPU or a GPU that has a non- - zero value for the device attribute - :py:obj:`~.CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS`. Also, if a - context is created on a device that does not have the device - attribute :py:obj:`~.CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS` - set, then read-duplication will not occur until all such contexts are - destroyed. If the memory region refers to valid system-allocated - pageable memory, then the accessing device must have a non-zero value - for the device attribute - :py:obj:`~.CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS` for a read- - only copy to be created on that device. Note however that if the - accessing device also has a non-zero value for the device attribute - :py:obj:`~.CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS_USES_HOST_PAGE_TABLES`, - then setting this advice will not create a read-only copy when that - device accesses this memory region. - - - :py:obj:`~.CU_MEM_ADVISE_UNSET_READ_MOSTLY`: Undoes the effect of - :py:obj:`~.CU_MEM_ADVISE_SET_READ_MOSTLY` and also prevents the - Unified Memory driver from attempting heuristic read-duplication on - the memory range. Any read-duplicated copies of the data will be - collapsed into a single copy. The location for the collapsed copy - will be the preferred location if the page has a preferred location - and one of the read-duplicated copies was resident at that location. - Otherwise, the location chosen is arbitrary. - - - :py:obj:`~.CU_MEM_ADVISE_SET_PREFERRED_LOCATION`: This advice sets - the preferred location for the data to be the memory belonging to - `device`. Passing in CU_DEVICE_CPU for `device` sets the preferred - location as host memory. If `device` is a GPU, then it must have a - non-zero value for the device attribute - :py:obj:`~.CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS`. Setting - the preferred location does not cause data to migrate to that - location immediately. Instead, it guides the migration policy when a - fault occurs on that memory region. If the data is already in its - preferred location and the faulting processor can establish a mapping - without requiring the data to be migrated, then data migration will - be avoided. On the other hand, if the data is not in its preferred - location or if a direct mapping cannot be established, then it will - be migrated to the processor accessing it. It is important to note - that setting the preferred location does not prevent data prefetching - done using :py:obj:`~.cuMemPrefetchAsync`. Having a preferred - location can override the page thrash detection and resolution logic - in the Unified Memory driver. Normally, if a page is detected to be - constantly thrashing between for example host and device memory, the - page may eventually be pinned to host memory by the Unified Memory - driver. But if the preferred location is set as device memory, then - the page will continue to thrash indefinitely. If - :py:obj:`~.CU_MEM_ADVISE_SET_READ_MOSTLY` is also set on this memory - region or any subset of it, then the policies associated with that - advice will override the policies of this advice, unless read - accesses from `device` will not result in a read-only copy being - created on that device as outlined in description for the advice - :py:obj:`~.CU_MEM_ADVISE_SET_READ_MOSTLY`. If the memory region - refers to valid system-allocated pageable memory, then `device` must - have a non-zero value for the device attribute - :py:obj:`~.CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS`. - - - :py:obj:`~.CU_MEM_ADVISE_UNSET_PREFERRED_LOCATION`: Undoes the effect - of :py:obj:`~.CU_MEM_ADVISE_SET_PREFERRED_LOCATION` and changes the - preferred location to none. - - - :py:obj:`~.CU_MEM_ADVISE_SET_ACCESSED_BY`: This advice implies that - the data will be accessed by `device`. Passing in - :py:obj:`~.CU_DEVICE_CPU` for `device` will set the advice for the - CPU. If `device` is a GPU, then the device attribute - :py:obj:`~.CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS` must be - non-zero. This advice does not cause data migration and has no impact - on the location of the data per se. Instead, it causes the data to - always be mapped in the specified processor's page tables, as long as - the location of the data permits a mapping to be established. If the - data gets migrated for any reason, the mappings are updated - accordingly. This advice is recommended in scenarios where data - locality is not important, but avoiding faults is. Consider for - example a system containing multiple GPUs with peer-to-peer access - enabled, where the data located on one GPU is occasionally accessed - by peer GPUs. In such scenarios, migrating data over to the other - GPUs is not as important because the accesses are infrequent and the - overhead of migration may be too high. But preventing faults can - still help improve performance, and so having a mapping set up in - advance is useful. Note that on CPU access of this data, the data may - be migrated to host memory because the CPU typically cannot access - device memory directly. Any GPU that had the - :py:obj:`~.CU_MEM_ADVISE_SET_ACCESSED_BY` flag set for this data will - now have its mapping updated to point to the page in host memory. If - :py:obj:`~.CU_MEM_ADVISE_SET_READ_MOSTLY` is also set on this memory - region or any subset of it, then the policies associated with that - advice will override the policies of this advice. Additionally, if - the preferred location of this memory region or any subset of it is - also `device`, then the policies associated with - :py:obj:`~.CU_MEM_ADVISE_SET_PREFERRED_LOCATION` will override the - policies of this advice. If the memory region refers to valid system- - allocated pageable memory, then `device` must have a non-zero value - for the device attribute - :py:obj:`~.CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS`. Additionally, - if `device` has a non-zero value for the device attribute - :py:obj:`~.CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS_USES_HOST_PAGE_TABLES`, - then this call has no effect. - - - :py:obj:`~.CU_MEM_ADVISE_UNSET_ACCESSED_BY`: Undoes the effect of - :py:obj:`~.CU_MEM_ADVISE_SET_ACCESSED_BY`. Any mappings to the data - from `device` may be removed at any time causing accesses to result - in non-fatal page faults. If the memory region refers to valid - system-allocated pageable memory, then `device` must have a non-zero - value for the device attribute - :py:obj:`~.CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS`. Additionally, - if `device` has a non-zero value for the device attribute - :py:obj:`~.CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS_USES_HOST_PAGE_TABLES`, - then this call has no effect. - - Parameters - ---------- - devPtr : :py:obj:`~.CUdeviceptr` - Pointer to memory to set the advice for - count : size_t - Size in bytes of the memory range - advice : :py:obj:`~.CUmem_advise` - Advice to be applied for the specified memory range - device : :py:obj:`~.CUdevice` - Device to apply the advice for - - Returns - ------- - CUresult - :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_INVALID_DEVICE` - - See Also - -------- - :py:obj:`~.cuMemcpy`, :py:obj:`~.cuMemcpyPeer`, :py:obj:`~.cuMemcpyAsync`, :py:obj:`~.cuMemcpy3DPeerAsync`, :py:obj:`~.cuMemPrefetchAsync`, :py:obj:`~.cuMemAdvise_v2` :py:obj:`~.cudaMemAdvise` - """ - cdef ccuda.CUdevice cdevice - if device is None: - cdevice = 0 - elif isinstance(device, (CUdevice,)): - pdevice = int(device) - cdevice = pdevice - else: - pdevice = int(CUdevice(device)) - cdevice = pdevice - cdef ccuda.CUdeviceptr cdevPtr - if devPtr is None: - cdevPtr = 0 - elif isinstance(devPtr, (CUdeviceptr,)): - pdevPtr = int(devPtr) - cdevPtr = pdevPtr - else: - pdevPtr = int(CUdeviceptr(devPtr)) - cdevPtr = pdevPtr - cdef ccuda.CUmem_advise cadvice = advice.value - err = ccuda.cuMemAdvise(cdevPtr, count, cadvice, cdevice) - return (CUresult(err),) -{{endif}} - -{{if 'cuMemAdvise_v2' in found_functions}} - -@cython.embedsignature(True) -def cuMemAdvise_v2(devPtr, size_t count, advice not None : CUmem_advise, location not None : CUmemLocation): - """ Advise about the usage of a given memory range. - - Advise the Unified Memory subsystem about the usage pattern for the - memory range starting at `devPtr` with a size of `count` bytes. The - start address and end address of the memory range will be rounded down - and rounded up respectively to be aligned to CPU page size before the - advice is applied. The memory range must refer to managed memory - allocated via :py:obj:`~.cuMemAllocManaged` or declared via managed - variables. The memory range could also refer to system-allocated - pageable memory provided it represents a valid, host-accessible region - of memory and all additional constraints imposed by `advice` as - outlined below are also satisfied. Specifying an invalid system- - allocated pageable memory range results in an error being returned. - - The `advice` parameter can take the following values: - - - :py:obj:`~.CU_MEM_ADVISE_SET_READ_MOSTLY`: This implies that the data - is mostly going to be read from and only occasionally written to. Any - read accesses from any processor to this region will create a read- - only copy of at least the accessed pages in that processor's memory. - Additionally, if :py:obj:`~.cuMemPrefetchAsync` or - :py:obj:`~.cuMemPrefetchAsync_v2` is called on this region, it will - create a read-only copy of the data on the destination processor. If - the target location for :py:obj:`~.cuMemPrefetchAsync_v2` is a host - NUMA node and a read-only copy already exists on another host NUMA - node, that copy will be migrated to the targeted host NUMA node. If - any processor writes to this region, all copies of the corresponding - page will be invalidated except for the one where the write occurred. - If the writing processor is the CPU and the preferred location of the - page is a host NUMA node, then the page will also be migrated to that - host NUMA node. The `location` argument is ignored for this advice. - Note that for a page to be read-duplicated, the accessing processor - must either be the CPU or a GPU that has a non-zero value for the - device attribute + destination processor. If the target location for + :py:obj:`~.cuMemPrefetchAsync` is a host NUMA node and a read-only + copy already exists on another host NUMA node, that copy will be + migrated to the targeted host NUMA node. If any processor writes to + this region, all copies of the corresponding page will be invalidated + except for the one where the write occurred. If the writing processor + is the CPU and the preferred location of the page is a host NUMA + node, then the page will also be migrated to that host NUMA node. The + `location` argument is ignored for this advice. Note that for a page + to be read-duplicated, the accessing processor must either be the CPU + or a GPU that has a non-zero value for the device attribute :py:obj:`~.CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS`. Also, if a context is created on a device that does not have the device attribute :py:obj:`~.CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS` @@ -29522,23 +38526,344 @@ def cuMemAdvise_v2(devPtr, size_t count, advice not None : CUmem_advise, locatio See Also -------- - :py:obj:`~.cuMemcpy`, :py:obj:`~.cuMemcpyPeer`, :py:obj:`~.cuMemcpyAsync`, :py:obj:`~.cuMemcpy3DPeerAsync`, :py:obj:`~.cuMemPrefetchAsync`, :py:obj:`~.cuMemAdvise` :py:obj:`~.cudaMemAdvise` + :py:obj:`~.cuMemcpy`, :py:obj:`~.cuMemcpyPeer`, :py:obj:`~.cuMemcpyAsync`, :py:obj:`~.cuMemcpy3DPeerAsync`, :py:obj:`~.cuMemPrefetchAsync`, :py:obj:`~.cudaMemAdvise` """ - cdef ccuda.CUdeviceptr cdevPtr + cdef cydriver.CUdeviceptr cydevPtr if devPtr is None: - cdevPtr = 0 + pdevPtr = 0 elif isinstance(devPtr, (CUdeviceptr,)): pdevPtr = int(devPtr) - cdevPtr = pdevPtr else: pdevPtr = int(CUdeviceptr(devPtr)) - cdevPtr = pdevPtr - cdef ccuda.CUmem_advise cadvice = advice.value - err = ccuda.cuMemAdvise_v2(cdevPtr, count, cadvice, location._ptr[0]) - return (CUresult(err),) -{{endif}} + cydevPtr = pdevPtr + cdef cydriver.CUmem_advise cyadvice = int(advice) + with nogil: + err = cydriver.cuMemAdvise(cydevPtr, count, cyadvice, location._pvt_ptr[0]) + return (_CUresult(err),) -{{if 'cuMemRangeGetAttribute' in found_functions}} +@cython.embedsignature(True) +def cuMemPrefetchBatchAsync(dptrs : Optional[tuple[CUdeviceptr] | list[CUdeviceptr]], sizes : tuple[int] | list[int], size_t count, prefetchLocs : Optional[tuple[CUmemLocation] | list[CUmemLocation]], prefetchLocIdxs : tuple[int] | list[int], size_t numPrefetchLocs, unsigned long long flags, hStream): + """ Performs a batch of memory prefetches asynchronously. + + Performs a batch of memory prefetches. The batch as a whole executes in + stream order but operations within a batch are not guaranteed to + execute in any specific order. All devices in the system must have a + non-zero value for the device attribute + :py:obj:`~.CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS` otherwise the + API will return an error. + + The semantics of the individual prefetch operations are as described in + :py:obj:`~.cuMemPrefetchAsync`. + + Performs memory prefetch on address ranges specified in `dptrs` and + `sizes`. Both arrays must be of the same length as specified by + `count`. Each memory range specified must refer to managed memory + allocated via :py:obj:`~.cuMemAllocManaged` or declared via managed + variables or it may also refer to system-allocated memory when all + devices have a non-zero value for + :py:obj:`~.CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS`. The prefetch + location for every operation in the batch is specified in the + `prefetchLocs` array. Each entry in this array can apply to more than + one operation. This can be done by specifying in the `prefetchLocIdxs` + array, the index of the first prefetch operation that the corresponding + entry in the `prefetchLocs` array applies to. Both `prefetchLocs` and + `prefetchLocIdxs` must be of the same length as specified by + `numPrefetchLocs`. For example, if a batch has 10 prefetches listed in + dptrs/sizes, the first 4 of which are to be prefetched to one location + and the remaining 6 are to be prefetched to another, then + `numPrefetchLocs` will be 2, `prefetchLocIdxs` will be {0, 4} and + `prefetchLocs` will contain the two locations. Note the first entry in + `prefetchLocIdxs` must always be 0. Also, each entry must be greater + than the previous entry and the last entry should be less than `count`. + Furthermore, `numPrefetchLocs` must be lesser than or equal to `count`. + + Parameters + ---------- + dptrs : list[:py:obj:`~.CUdeviceptr`] + Array of pointers to be prefetched + sizes : list[int] + Array of sizes for memory prefetch operations. + count : size_t + Size of `dptrs` and `sizes` arrays. + prefetchLocs : list[:py:obj:`~.CUmemLocation`] + Array of locations to prefetch to. + prefetchLocIdxs : list[int] + Array of indices to specify which operands each entry in the + `prefetchLocs` array applies to. The locations specified in + prefetchLocs[k] will be applied to copies starting from + prefetchLocIdxs[k] through prefetchLocIdxs[k+1] - 1. Also + prefetchLocs[numPrefetchLocs - 1] will apply to prefetches starting + from prefetchLocIdxs[numPrefetchLocs - 1] through count - 1. + numPrefetchLocs : size_t + Size of `prefetchLocs` and `prefetchLocIdxs` arrays. + flags : unsigned long long + Flags reserved for future use. Must be zero. + hStream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + The stream to enqueue the operations in. Must not be legacy NULL + stream. + + Returns + ------- + CUresult + + """ + cdef cydriver.CUstream cyhStream + if hStream is None: + phStream = 0 + elif isinstance(hStream, (CUstream,)): + phStream = int(hStream) + else: + phStream = int(CUstream(hStream)) + cyhStream = phStream + if not all(isinstance(_x, (int)) for _x in prefetchLocIdxs): + raise TypeError("Argument 'prefetchLocIdxs' is not instance of type (expected tuple[int] or list[int]") + prefetchLocs = [] if prefetchLocs is None else prefetchLocs + if not all(isinstance(_x, (CUmemLocation,)) for _x in prefetchLocs): + raise TypeError("Argument 'prefetchLocs' is not instance of type (expected tuple[cydriver.CUmemLocation,] or list[cydriver.CUmemLocation,]") + if not all(isinstance(_x, (int)) for _x in sizes): + raise TypeError("Argument 'sizes' is not instance of type (expected tuple[int] or list[int]") + dptrs = [] if dptrs is None else dptrs + if not all(isinstance(_x, (CUdeviceptr,)) for _x in dptrs): + raise TypeError("Argument 'dptrs' is not instance of type (expected tuple[cydriver.CUdeviceptr,] or list[cydriver.CUdeviceptr,]") + cdef cydriver.CUdeviceptr* cydptrs = NULL + if len(dptrs) > 1: + cydptrs = calloc(len(dptrs), sizeof(cydriver.CUdeviceptr)) + if cydptrs is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(dptrs)) + 'x' + str(sizeof(cydriver.CUdeviceptr))) + else: + for idx in range(len(dptrs)): + cydptrs[idx] = (dptrs[idx])._pvt_ptr[0] + elif len(dptrs) == 1: + cydptrs = (dptrs[0])._pvt_ptr + cdef vector[size_t] cysizes = sizes + if count > len(dptrs): raise RuntimeError("List is too small: " + str(len(dptrs)) + " < " + str(count)) + if count > len(sizes): raise RuntimeError("List is too small: " + str(len(sizes)) + " < " + str(count)) + cdef cydriver.CUmemLocation* cyprefetchLocs = NULL + if len(prefetchLocs) > 1: + cyprefetchLocs = calloc(len(prefetchLocs), sizeof(cydriver.CUmemLocation)) + if cyprefetchLocs is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(prefetchLocs)) + 'x' + str(sizeof(cydriver.CUmemLocation))) + for idx in range(len(prefetchLocs)): + string.memcpy(&cyprefetchLocs[idx], (prefetchLocs[idx])._pvt_ptr, sizeof(cydriver.CUmemLocation)) + elif len(prefetchLocs) == 1: + cyprefetchLocs = (prefetchLocs[0])._pvt_ptr + cdef vector[size_t] cyprefetchLocIdxs = prefetchLocIdxs + if numPrefetchLocs > len(prefetchLocs): raise RuntimeError("List is too small: " + str(len(prefetchLocs)) + " < " + str(numPrefetchLocs)) + if numPrefetchLocs > len(prefetchLocIdxs): raise RuntimeError("List is too small: " + str(len(prefetchLocIdxs)) + " < " + str(numPrefetchLocs)) + with nogil: + err = cydriver.cuMemPrefetchBatchAsync(cydptrs, cysizes.data(), count, cyprefetchLocs, cyprefetchLocIdxs.data(), numPrefetchLocs, flags, cyhStream) + if len(dptrs) > 1 and cydptrs is not NULL: + free(cydptrs) + if len(prefetchLocs) > 1 and cyprefetchLocs is not NULL: + free(cyprefetchLocs) + return (_CUresult(err),) + +@cython.embedsignature(True) +def cuMemDiscardBatchAsync(dptrs : Optional[tuple[CUdeviceptr] | list[CUdeviceptr]], sizes : tuple[int] | list[int], size_t count, unsigned long long flags, hStream): + """ Performs a batch of memory discards asynchronously. + + Performs a batch of memory discards. The batch as a whole executes in + stream order but operations within a batch are not guaranteed to + execute in any specific order. All devices in the system must have a + non-zero value for the device attribute + :py:obj:`~.CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS` otherwise the + API will return an error. + + Discarding a memory range informs the driver that the contents of that + range are no longer useful. Discarding memory ranges allows the driver + to optimize certain data migrations and can also help reduce memory + pressure. This operation can be undone on any part of the range by + either writing to it or prefetching it via + :py:obj:`~.cuMemPrefetchAsync` or :py:obj:`~.cuMemPrefetchBatchAsync`. + Reading from a discarded range, without a subsequent write or prefetch + to that part of the range, will return an indeterminate value. Note + that any reads, writes or prefetches to any part of the memory range + that occur simultaneously with the discard operation result in + undefined behavior. + + Performs memory discard on address ranges specified in `dptrs` and + `sizes`. Both arrays must be of the same length as specified by + `count`. Each memory range specified must refer to managed memory + allocated via :py:obj:`~.cuMemAllocManaged` or declared via managed + variables or it may also refer to system-allocated memory when all + devices have a non-zero value for + :py:obj:`~.CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS`. + + Parameters + ---------- + dptrs : list[:py:obj:`~.CUdeviceptr`] + Array of pointers to be discarded + sizes : list[int] + Array of sizes for memory discard operations. + count : size_t + Size of `dptrs` and `sizes` arrays. + flags : unsigned long long + Flags reserved for future use. Must be zero. + hStream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + The stream to enqueue the operations in. Must not be legacy NULL + stream. + + Returns + ------- + CUresult + + """ + cdef cydriver.CUstream cyhStream + if hStream is None: + phStream = 0 + elif isinstance(hStream, (CUstream,)): + phStream = int(hStream) + else: + phStream = int(CUstream(hStream)) + cyhStream = phStream + if not all(isinstance(_x, (int)) for _x in sizes): + raise TypeError("Argument 'sizes' is not instance of type (expected tuple[int] or list[int]") + dptrs = [] if dptrs is None else dptrs + if not all(isinstance(_x, (CUdeviceptr,)) for _x in dptrs): + raise TypeError("Argument 'dptrs' is not instance of type (expected tuple[cydriver.CUdeviceptr,] or list[cydriver.CUdeviceptr,]") + cdef cydriver.CUdeviceptr* cydptrs = NULL + if len(dptrs) > 1: + cydptrs = calloc(len(dptrs), sizeof(cydriver.CUdeviceptr)) + if cydptrs is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(dptrs)) + 'x' + str(sizeof(cydriver.CUdeviceptr))) + else: + for idx in range(len(dptrs)): + cydptrs[idx] = (dptrs[idx])._pvt_ptr[0] + elif len(dptrs) == 1: + cydptrs = (dptrs[0])._pvt_ptr + cdef vector[size_t] cysizes = sizes + if count > len(dptrs): raise RuntimeError("List is too small: " + str(len(dptrs)) + " < " + str(count)) + if count > len(sizes): raise RuntimeError("List is too small: " + str(len(sizes)) + " < " + str(count)) + with nogil: + err = cydriver.cuMemDiscardBatchAsync(cydptrs, cysizes.data(), count, flags, cyhStream) + if len(dptrs) > 1 and cydptrs is not NULL: + free(cydptrs) + return (_CUresult(err),) + +@cython.embedsignature(True) +def cuMemDiscardAndPrefetchBatchAsync(dptrs : Optional[tuple[CUdeviceptr] | list[CUdeviceptr]], sizes : tuple[int] | list[int], size_t count, prefetchLocs : Optional[tuple[CUmemLocation] | list[CUmemLocation]], prefetchLocIdxs : tuple[int] | list[int], size_t numPrefetchLocs, unsigned long long flags, hStream): + """ Performs a batch of memory discards and prefetches asynchronously. + + Performs a batch of memory discards followed by prefetches. The batch + as a whole executes in stream order but operations within a batch are + not guaranteed to execute in any specific order. All devices in the + system must have a non-zero value for the device attribute + :py:obj:`~.CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS` otherwise the + API will return an error. + + Calling :py:obj:`~.cuMemDiscardAndPrefetchBatchAsync` is semantically + equivalent to calling :py:obj:`~.cuMemDiscardBatchAsync` followed by + :py:obj:`~.cuMemPrefetchBatchAsync`, but is more optimal. For more + details on what discarding and prefetching imply, please refer to + :py:obj:`~.cuMemDiscardBatchAsync` and + :py:obj:`~.cuMemPrefetchBatchAsync` respectively. Note that any reads, + writes or prefetches to any part of the memory range that occur + simultaneously with this combined discard+prefetch operation result in + undefined behavior. + + Performs memory discard and prefetch on address ranges specified in + `dptrs` and `sizes`. Both arrays must be of the same length as + specified by `count`. Each memory range specified must refer to managed + memory allocated via :py:obj:`~.cuMemAllocManaged` or declared via + managed variables or it may also refer to system-allocated memory when + all devices have a non-zero value for + :py:obj:`~.CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS`. Every operation + in the batch has to be associated with a valid location to prefetch the + address range to and specified in the `prefetchLocs` array. Each entry + in this array can apply to more than one operation. This can be done by + specifying in the `prefetchLocIdxs` array, the index of the first + operation that the corresponding entry in the `prefetchLocs` array + applies to. Both `prefetchLocs` and `prefetchLocIdxs` must be of the + same length as specified by `numPrefetchLocs`. For example, if a batch + has 10 operations listed in dptrs/sizes, the first 6 of which are to be + prefetched to one location and the remaining 4 are to be prefetched to + another, then `numPrefetchLocs` will be 2, `prefetchLocIdxs` will be + {0, 6} and `prefetchLocs` will contain the two set of locations. Note + the first entry in `prefetchLocIdxs` must always be 0. Also, each entry + must be greater than the previous entry and the last entry should be + less than `count`. Furthermore, `numPrefetchLocs` must be lesser than + or equal to `count`. + + Parameters + ---------- + dptrs : list[:py:obj:`~.CUdeviceptr`] + Array of pointers to be discarded + sizes : list[int] + Array of sizes for memory discard operations. + count : size_t + Size of `dptrs` and `sizes` arrays. + prefetchLocs : list[:py:obj:`~.CUmemLocation`] + Array of locations to prefetch to. + prefetchLocIdxs : list[int] + Array of indices to specify which operands each entry in the + `prefetchLocs` array applies to. The locations specified in + prefetchLocs[k] will be applied to operations starting from + prefetchLocIdxs[k] through prefetchLocIdxs[k+1] - 1. Also + prefetchLocs[numPrefetchLocs - 1] will apply to copies starting + from prefetchLocIdxs[numPrefetchLocs - 1] through count - 1. + numPrefetchLocs : size_t + Size of `prefetchLocs` and `prefetchLocIdxs` arrays. + flags : unsigned long long + Flags reserved for future use. Must be zero. + hStream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + The stream to enqueue the operations in. Must not be legacy NULL + stream. + + Returns + ------- + CUresult + + """ + cdef cydriver.CUstream cyhStream + if hStream is None: + phStream = 0 + elif isinstance(hStream, (CUstream,)): + phStream = int(hStream) + else: + phStream = int(CUstream(hStream)) + cyhStream = phStream + if not all(isinstance(_x, (int)) for _x in prefetchLocIdxs): + raise TypeError("Argument 'prefetchLocIdxs' is not instance of type (expected tuple[int] or list[int]") + prefetchLocs = [] if prefetchLocs is None else prefetchLocs + if not all(isinstance(_x, (CUmemLocation,)) for _x in prefetchLocs): + raise TypeError("Argument 'prefetchLocs' is not instance of type (expected tuple[cydriver.CUmemLocation,] or list[cydriver.CUmemLocation,]") + if not all(isinstance(_x, (int)) for _x in sizes): + raise TypeError("Argument 'sizes' is not instance of type (expected tuple[int] or list[int]") + dptrs = [] if dptrs is None else dptrs + if not all(isinstance(_x, (CUdeviceptr,)) for _x in dptrs): + raise TypeError("Argument 'dptrs' is not instance of type (expected tuple[cydriver.CUdeviceptr,] or list[cydriver.CUdeviceptr,]") + cdef cydriver.CUdeviceptr* cydptrs = NULL + if len(dptrs) > 1: + cydptrs = calloc(len(dptrs), sizeof(cydriver.CUdeviceptr)) + if cydptrs is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(dptrs)) + 'x' + str(sizeof(cydriver.CUdeviceptr))) + else: + for idx in range(len(dptrs)): + cydptrs[idx] = (dptrs[idx])._pvt_ptr[0] + elif len(dptrs) == 1: + cydptrs = (dptrs[0])._pvt_ptr + cdef vector[size_t] cysizes = sizes + if count > len(dptrs): raise RuntimeError("List is too small: " + str(len(dptrs)) + " < " + str(count)) + if count > len(sizes): raise RuntimeError("List is too small: " + str(len(sizes)) + " < " + str(count)) + cdef cydriver.CUmemLocation* cyprefetchLocs = NULL + if len(prefetchLocs) > 1: + cyprefetchLocs = calloc(len(prefetchLocs), sizeof(cydriver.CUmemLocation)) + if cyprefetchLocs is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(prefetchLocs)) + 'x' + str(sizeof(cydriver.CUmemLocation))) + for idx in range(len(prefetchLocs)): + string.memcpy(&cyprefetchLocs[idx], (prefetchLocs[idx])._pvt_ptr, sizeof(cydriver.CUmemLocation)) + elif len(prefetchLocs) == 1: + cyprefetchLocs = (prefetchLocs[0])._pvt_ptr + cdef vector[size_t] cyprefetchLocIdxs = prefetchLocIdxs + if numPrefetchLocs > len(prefetchLocs): raise RuntimeError("List is too small: " + str(len(prefetchLocs)) + " < " + str(numPrefetchLocs)) + if numPrefetchLocs > len(prefetchLocIdxs): raise RuntimeError("List is too small: " + str(len(prefetchLocIdxs)) + " < " + str(numPrefetchLocs)) + with nogil: + err = cydriver.cuMemDiscardAndPrefetchBatchAsync(cydptrs, cysizes.data(), count, cyprefetchLocs, cyprefetchLocIdxs.data(), numPrefetchLocs, flags, cyhStream) + if len(dptrs) > 1 and cydptrs is not NULL: + free(cydptrs) + if len(prefetchLocs) > 1 and cyprefetchLocs is not NULL: + free(cyprefetchLocs) + return (_CUresult(err),) @cython.embedsignature(True) def cuMemRangeGetAttribute(size_t dataSize, attribute not None : CUmem_range_attribute, devPtr, size_t count): @@ -29678,26 +39003,25 @@ def cuMemRangeGetAttribute(size_t dataSize, attribute not None : CUmem_range_att -------- :py:obj:`~.cuMemRangeGetAttributes`, :py:obj:`~.cuMemPrefetchAsync`, :py:obj:`~.cuMemAdvise`, :py:obj:`~.cudaMemRangeGetAttribute` """ - cdef ccuda.CUdeviceptr cdevPtr + cdef cydriver.CUdeviceptr cydevPtr if devPtr is None: - cdevPtr = 0 + pdevPtr = 0 elif isinstance(devPtr, (CUdeviceptr,)): pdevPtr = int(devPtr) - cdevPtr = pdevPtr else: pdevPtr = int(CUdeviceptr(devPtr)) - cdevPtr = pdevPtr - cdef utils.HelperCUmem_range_attribute cdata = utils.HelperCUmem_range_attribute(attribute, dataSize) - cdef void* cdata_ptr = cdata.cptr - cdef ccuda.CUmem_range_attribute cattribute = attribute.value - err = ccuda.cuMemRangeGetAttribute(cdata_ptr, dataSize, cattribute, cdevPtr, count) - return (CUresult(err), cdata.pyObj()) -{{endif}} - -{{if 'cuMemRangeGetAttributes' in found_functions}} - -@cython.embedsignature(True) -def cuMemRangeGetAttributes(dataSizes : List[int], attributes : Optional[List[CUmem_range_attribute]], size_t numAttributes, devPtr, size_t count): + cydevPtr = pdevPtr + cdef _HelperCUmem_range_attribute cydata = _HelperCUmem_range_attribute(attribute, dataSize) + cdef void* cydata_ptr = cydata.cptr + cdef cydriver.CUmem_range_attribute cyattribute = int(attribute) + with nogil: + err = cydriver.cuMemRangeGetAttribute(cydata_ptr, dataSize, cyattribute, cydevPtr, count) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, cydata.pyObj()) + +@cython.embedsignature(True) +def cuMemRangeGetAttributes(dataSizes : tuple[int] | list[int], attributes : Optional[tuple[CUmem_range_attribute] | list[CUmem_range_attribute]], size_t numAttributes, devPtr, size_t count): """ Query attributes of a given memory range. Query attributes of the memory range starting at `devPtr` with a size @@ -29730,9 +39054,9 @@ def cuMemRangeGetAttributes(dataSizes : List[int], attributes : Optional[List[CU Parameters ---------- - dataSizes : List[int] + dataSizes : list[int] Array containing the sizes of each result - attributes : List[:py:obj:`~.CUmem_range_attribute`] + attributes : list[:py:obj:`~.CUmem_range_attribute`] An array of attributes to query (numAttributes and the number of attributes in this array should match) numAttributes : size_t @@ -29746,7 +39070,7 @@ def cuMemRangeGetAttributes(dataSizes : List[int], attributes : Optional[List[CU ------- CUresult :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_CONTEXT`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_INVALID_DEVICE` - data : List[Any] + data : list[Any] A two-dimensional array containing pointers to memory locations where the result of each attribute query will be written to. @@ -29754,32 +39078,31 @@ def cuMemRangeGetAttributes(dataSizes : List[int], attributes : Optional[List[CU -------- :py:obj:`~.cuMemRangeGetAttribute`, :py:obj:`~.cuMemAdvise`, :py:obj:`~.cuMemPrefetchAsync`, :py:obj:`~.cudaMemRangeGetAttributes` """ - cdef ccuda.CUdeviceptr cdevPtr + cdef cydriver.CUdeviceptr cydevPtr if devPtr is None: - cdevPtr = 0 + pdevPtr = 0 elif isinstance(devPtr, (CUdeviceptr,)): pdevPtr = int(devPtr) - cdevPtr = pdevPtr else: pdevPtr = int(CUdeviceptr(devPtr)) - cdevPtr = pdevPtr + cydevPtr = pdevPtr attributes = [] if attributes is None else attributes if not all(isinstance(_x, (CUmem_range_attribute)) for _x in attributes): - raise TypeError("Argument 'attributes' is not instance of type (expected List[ccuda.CUmem_range_attribute]") + raise TypeError("Argument 'attributes' is not instance of type (expected tuple[cydriver.CUmem_range_attribute] or list[cydriver.CUmem_range_attribute]") if not all(isinstance(_x, (int)) for _x in dataSizes): - raise TypeError("Argument 'dataSizes' is not instance of type (expected List[int]") - pylist = [utils.HelperCUmem_range_attribute(pyattributes, pydataSizes) for (pyattributes, pydataSizes) in zip(attributes, dataSizes)] - cdef utils.InputVoidPtrPtrHelper voidStarHelperdata = utils.InputVoidPtrPtrHelper(pylist) - cdef void** cvoidStarHelper_ptr = voidStarHelperdata.cptr - cdef vector[size_t] cdataSizes = dataSizes - cdef vector[ccuda.CUmem_range_attribute] cattributes = [pyattributes.value for pyattributes in (attributes)] + raise TypeError("Argument 'dataSizes' is not instance of type (expected tuple[int] or list[int]") + pylist = [_HelperCUmem_range_attribute(pyattributes, pydataSizes) for (pyattributes, pydataSizes) in zip(attributes, dataSizes)] + cdef _InputVoidPtrPtrHelper voidStarHelperdata = _InputVoidPtrPtrHelper(pylist) + cdef void** cyvoidStarHelper_ptr = voidStarHelperdata.cptr + cdef vector[size_t] cydataSizes = dataSizes + cdef vector[cydriver.CUmem_range_attribute] cyattributes = attributes if numAttributes > len(dataSizes): raise RuntimeError("List is too small: " + str(len(dataSizes)) + " < " + str(numAttributes)) if numAttributes > len(attributes): raise RuntimeError("List is too small: " + str(len(attributes)) + " < " + str(numAttributes)) - err = ccuda.cuMemRangeGetAttributes(cvoidStarHelper_ptr, cdataSizes.data(), cattributes.data(), numAttributes, cdevPtr, count) - return (CUresult(err), [obj.pyObj() for obj in pylist]) -{{endif}} - -{{if 'cuPointerSetAttribute' in found_functions}} + with nogil: + err = cydriver.cuMemRangeGetAttributes(cyvoidStarHelper_ptr, cydataSizes.data(), cyattributes.data(), numAttributes, cydevPtr, count) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, [obj.pyObj() for obj in pylist]) @cython.embedsignature(True) def cuPointerSetAttribute(value, attribute not None : CUpointer_attribute, ptr): @@ -29819,26 +39142,23 @@ def cuPointerSetAttribute(value, attribute not None : CUpointer_attribute, ptr): -------- :py:obj:`~.cuPointerGetAttribute`, :py:obj:`~.cuPointerGetAttributes`, :py:obj:`~.cuMemAlloc`, :py:obj:`~.cuMemFree`, :py:obj:`~.cuMemAllocHost`, :py:obj:`~.cuMemFreeHost`, :py:obj:`~.cuMemHostAlloc`, :py:obj:`~.cuMemHostRegister`, :py:obj:`~.cuMemHostUnregister` """ - cdef ccuda.CUdeviceptr cptr + cdef cydriver.CUdeviceptr cyptr if ptr is None: - cptr = 0 + pptr = 0 elif isinstance(ptr, (CUdeviceptr,)): pptr = int(ptr) - cptr = pptr else: pptr = int(CUdeviceptr(ptr)) - cptr = pptr - cdef utils.HelperCUpointer_attribute cvalue = utils.HelperCUpointer_attribute(attribute, value, is_getter=False) - cdef void* cvalue_ptr = cvalue.cptr - cdef ccuda.CUpointer_attribute cattribute = attribute.value - err = ccuda.cuPointerSetAttribute(cvalue_ptr, cattribute, cptr) - return (CUresult(err),) -{{endif}} - -{{if 'cuPointerGetAttributes' in found_functions}} + cyptr = pptr + cdef _HelperCUpointer_attribute cyvalue = _HelperCUpointer_attribute(attribute, value, is_getter=False) + cdef void* cyvalue_ptr = cyvalue.cptr + cdef cydriver.CUpointer_attribute cyattribute = int(attribute) + with nogil: + err = cydriver.cuPointerSetAttribute(cyvalue_ptr, cyattribute, cyptr) + return (_CUresult(err),) @cython.embedsignature(True) -def cuPointerGetAttributes(unsigned int numAttributes, attributes : Optional[List[CUpointer_attribute]], ptr): +def cuPointerGetAttributes(unsigned int numAttributes, attributes : Optional[tuple[CUpointer_attribute] | list[CUpointer_attribute]], ptr): """ Returns information about a pointer. The supported attributes are (refer to @@ -29873,6 +39193,8 @@ def cuPointerGetAttributes(unsigned int numAttributes, attributes : Optional[Lis - :py:obj:`~.CU_POINTER_ATTRIBUTE_MEMPOOL_HANDLE` + - :py:obj:`~.CU_POINTER_ATTRIBUTE_IS_HW_DECOMPRESS_CAPABLE` + Unlike :py:obj:`~.cuPointerGetAttribute`, this function will not return an error when the `ptr` encountered is not a valid CUDA pointer. Instead, the attributes are assigned default NULL values and @@ -29886,7 +39208,7 @@ def cuPointerGetAttributes(unsigned int numAttributes, attributes : Optional[Lis ---------- numAttributes : unsigned int Number of attributes to query - attributes : List[:py:obj:`~.CUpointer_attribute`] + attributes : list[:py:obj:`~.CUpointer_attribute`] An array of attributes to query (numAttributes and the number of attributes in this array should match) ptr : :py:obj:`~.CUdeviceptr` @@ -29896,7 +39218,7 @@ def cuPointerGetAttributes(unsigned int numAttributes, attributes : Optional[Lis ------- CUresult :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_CONTEXT`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_INVALID_DEVICE` - data : List[Any] + data : list[Any] A two-dimensional array containing pointers to memory locations where the result of each attribute query will be written to. @@ -29904,28 +39226,27 @@ def cuPointerGetAttributes(unsigned int numAttributes, attributes : Optional[Lis -------- :py:obj:`~.cuPointerGetAttribute`, :py:obj:`~.cuPointerSetAttribute`, :py:obj:`~.cudaPointerGetAttributes` """ - cdef ccuda.CUdeviceptr cptr + cdef cydriver.CUdeviceptr cyptr if ptr is None: - cptr = 0 + pptr = 0 elif isinstance(ptr, (CUdeviceptr,)): pptr = int(ptr) - cptr = pptr else: pptr = int(CUdeviceptr(ptr)) - cptr = pptr + cyptr = pptr attributes = [] if attributes is None else attributes if not all(isinstance(_x, (CUpointer_attribute)) for _x in attributes): - raise TypeError("Argument 'attributes' is not instance of type (expected List[ccuda.CUpointer_attribute]") + raise TypeError("Argument 'attributes' is not instance of type (expected tuple[cydriver.CUpointer_attribute] or list[cydriver.CUpointer_attribute]") if numAttributes > len(attributes): raise RuntimeError("List is too small: " + str(len(attributes)) + " < " + str(numAttributes)) - cdef vector[ccuda.CUpointer_attribute] cattributes = [pyattributes.value for pyattributes in (attributes)] - pylist = [utils.HelperCUpointer_attribute(pyattributes, 0, is_getter=True) for pyattributes in attributes] - cdef utils.InputVoidPtrPtrHelper voidStarHelperdata = utils.InputVoidPtrPtrHelper(pylist) - cdef void** cvoidStarHelper_ptr = voidStarHelperdata.cptr - err = ccuda.cuPointerGetAttributes(numAttributes, cattributes.data(), cvoidStarHelper_ptr, cptr) - return (CUresult(err), [obj.pyObj() for obj in pylist]) -{{endif}} - -{{if 'cuStreamCreate' in found_functions}} + cdef vector[cydriver.CUpointer_attribute] cyattributes = attributes + pylist = [_HelperCUpointer_attribute(pyattributes, 0, is_getter=True) for pyattributes in attributes] + cdef _InputVoidPtrPtrHelper voidStarHelperdata = _InputVoidPtrPtrHelper(pylist) + cdef void** cyvoidStarHelper_ptr = voidStarHelperdata.cptr + with nogil: + err = cydriver.cuPointerGetAttributes(numAttributes, cyattributes.data(), cyvoidStarHelper_ptr, cyptr) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, [obj.pyObj() for obj in pylist]) @cython.embedsignature(True) def cuStreamCreate(unsigned int Flags): @@ -29951,20 +39272,20 @@ def cuStreamCreate(unsigned int Flags): Returns ------- CUresult - :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_CONTEXT`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_OUT_OF_MEMORY` + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_CONTEXT`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_OUT_OF_MEMORY` :py:obj:`~.CUDA_ERROR_EXTERNAL_DEVICE` phStream : :py:obj:`~.CUstream` Returned newly created stream See Also -------- - :py:obj:`~.cuStreamDestroy`, :py:obj:`~.cuStreamCreateWithPriority`, :py:obj:`~.cuGreenCtxStreamCreate`, :py:obj:`~.cuStreamGetPriority`, :py:obj:`~.cuStreamGetFlags`, :py:obj:`~.cuStreamWaitEvent`, :py:obj:`~.cuStreamQuery`, :py:obj:`~.cuStreamSynchronize`, :py:obj:`~.cuStreamAddCallback`, :py:obj:`~.cudaStreamCreate`, :py:obj:`~.cudaStreamCreateWithFlags` + :py:obj:`~.cuStreamDestroy`, :py:obj:`~.cuStreamCreateWithPriority`, :py:obj:`~.cuGreenCtxStreamCreate`, :py:obj:`~.cuStreamGetPriority`, :py:obj:`~.cuStreamGetFlags`, :py:obj:`~.cuStreamGetDevice` :py:obj:`~.cuStreamWaitEvent`, :py:obj:`~.cuStreamQuery`, :py:obj:`~.cuStreamSynchronize`, :py:obj:`~.cuStreamAddCallback`, :py:obj:`~.cudaStreamCreate`, :py:obj:`~.cudaStreamCreateWithFlags` """ cdef CUstream phStream = CUstream() - err = ccuda.cuStreamCreate(phStream._ptr, Flags) - return (CUresult(err), phStream) -{{endif}} - -{{if 'cuStreamCreateWithPriority' in found_functions}} + with nogil: + err = cydriver.cuStreamCreate(phStream._pvt_ptr, Flags) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, phStream) @cython.embedsignature(True) def cuStreamCreateWithPriority(unsigned int flags, int priority): @@ -29997,13 +39318,13 @@ def cuStreamCreateWithPriority(unsigned int flags, int priority): Returns ------- CUresult - :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_CONTEXT`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_OUT_OF_MEMORY` + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_CONTEXT`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_OUT_OF_MEMORY` :py:obj:`~.CUDA_ERROR_EXTERNAL_DEVICE` phStream : :py:obj:`~.CUstream` Returned newly created stream See Also -------- - :py:obj:`~.cuStreamDestroy`, :py:obj:`~.cuStreamCreate`, :py:obj:`~.cuGreenCtxStreamCreate`, :py:obj:`~.cuStreamGetPriority`, :py:obj:`~.cuCtxGetStreamPriorityRange`, :py:obj:`~.cuStreamGetFlags`, :py:obj:`~.cuStreamWaitEvent`, :py:obj:`~.cuStreamQuery`, :py:obj:`~.cuStreamSynchronize`, :py:obj:`~.cuStreamAddCallback`, :py:obj:`~.cudaStreamCreateWithPriority` + :py:obj:`~.cuStreamDestroy`, :py:obj:`~.cuStreamCreate`, :py:obj:`~.cuGreenCtxStreamCreate`, :py:obj:`~.cuStreamGetPriority`, :py:obj:`~.cuCtxGetStreamPriorityRange`, :py:obj:`~.cuStreamGetFlags`, :py:obj:`~.cuStreamGetDevice`, :py:obj:`~.cuStreamWaitEvent`, :py:obj:`~.cuStreamQuery`, :py:obj:`~.cuStreamSynchronize`, :py:obj:`~.cuStreamAddCallback`, :py:obj:`~.cudaStreamCreateWithPriority` Notes ----- @@ -30012,11 +39333,142 @@ def cuStreamCreateWithPriority(unsigned int flags, int priority): In the current implementation, only compute kernels launched in priority streams are affected by the stream's priority. Stream priorities have no effect on host-to-device and device-to-host memory operations. """ cdef CUstream phStream = CUstream() - err = ccuda.cuStreamCreateWithPriority(phStream._ptr, flags, priority) - return (CUresult(err), phStream) -{{endif}} + with nogil: + err = cydriver.cuStreamCreateWithPriority(phStream._pvt_ptr, flags, priority) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, phStream) + +@cython.embedsignature(True) +def cuStreamBeginCaptureToCig(hStream, streamCigCaptureParams : Optional[CUstreamCigCaptureParams]): + """ Begins capture to CIG on a stream. + + Support for CIG streams with D3D12 can be determined using + :py:obj:`~.cuDeviceGetAttribute()` with + :py:obj:`~.CU_DEVICE_ATTRIBUTE_D3D12_CIG_STREAMS_SUPPORTED`. + + Begin CIG (CUDA in Graphics) capture on `hStream` for the graphics API + as provided in `streamCigCaptureParams`. When a stream is in CIG + capture mode, all operations pushed into the stream will not be + executed, but will instead be captured into a graphics API command + list/command buffer. All kernel launches and memory copy/memory set + operations on the CIG stream will be recorded. When the command list is + executed by the graphics API, all the stream's operations will execute + in order along with other graphics API commands in the command list. + + CIG stream capture may not be initiated if `stream` is + CU_STREAM_LEGACY. Capture must be ended on the same stream in which it + was initiated, and it may only be initiated if the stream is not + already in CIG capture mode. + + The context must be also created in CIG mode previously, otherwise this + operation will fail and :py:obj:`~.CUDA_ERROR_INVALID_CONTEXT` will be + returned. + + Data from the graphics client can be shared with CUDA via the + `streamSharedData` in `streamCigCaptureParams`. The format of + `streamSharedData` is dependent on the type of the graphics client. For + D3D12, `streamSharedData` is an ID3D12CommandList object pointer. The + command list must be in ready state for recording commands whenever + kernels are launched on the stream. The command list provided must + belong to the graphics API device that the CIG context was created + with, otherwise the behavior will be undefined. + + The stream object may not be destroyed until its associated command + list has finished executing on the GPU. The command list/command buffer + used for capture may not be submitted for execution before a call to + :py:obj:`~.cuStreamEndCaptureToCig` is made on the associated stream. + + Graphics resources to be accessed by work recorded on the CIG stream + must use UAV barriers on the command list prior to recording work that + accesses them on the stream. + + Resubmission of the same recorded command list is not allowed. Further + more, care must be taken for the order of execution of the recorded + CUDA work with regards to other CUDA work submitted under the same CIG + context. Out-of-order execution can lead to device hangs or exceptions. + + CIG capture mode operates similarly to `cuStreamBeginCapture` with the + `CU_STREAM_CAPTURE_MODE_RELAXED` option. There are additional + limitations to streams in CIG capture mode. The following functions are + not allowed for CIG streams whether directly or indirectly via a + recorded graph launch: :py:obj:`~.cuLaunchHostFunc` + :py:obj:`~.cuStreamAddCallback` :py:obj:`~.cuStreamSynchronize` + :py:obj:`~.cuStreamWaitValue32` :py:obj:`~.cuStreamWaitValue64` + :py:obj:`~.cuStreamBatchMemOp` :py:obj:`~.cuStreamBeginCapture` + :py:obj:`~.cuStreamBeginCaptureToGraph` :py:obj:`~.cuMemAllocAsync` + :py:obj:`~.cuMemFreeAsync` + + Parameters + ---------- + hStream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + Stream in which to initiate capture to CIG + streamCigCaptureParams : :py:obj:`~.CUstreamCigCaptureParams` + CIG capture parameters + + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_SUPPORTED`, :py:obj:`~.CUDA_ERROR_INVALID_CONTEXT`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, + + See Also + -------- + :py:obj:`~.cuStreamEndCaptureToCig`, :py:obj:`~.cuStreamBeginCapture`, :py:obj:`~.cuStreamWaitEvent`, :py:obj:`~.cuStreamQuery`, :py:obj:`~.cuStreamSynchronize`, :py:obj:`~.cuStreamAddCallback` + """ + cdef cydriver.CUstream cyhStream + if hStream is None: + phStream = 0 + elif isinstance(hStream, (CUstream,)): + phStream = int(hStream) + else: + phStream = int(CUstream(hStream)) + cyhStream = phStream + cdef cydriver.CUstreamCigCaptureParams* cystreamCigCaptureParams_ptr = streamCigCaptureParams._pvt_ptr if streamCigCaptureParams is not None else NULL + with nogil: + err = cydriver.cuStreamBeginCaptureToCig(cyhStream, cystreamCigCaptureParams_ptr) + return (_CUresult(err),) + +@cython.embedsignature(True) +def cuStreamEndCaptureToCig(hStream): + """ Ends CIG capture on a stream. + + End CIG capture on `hStream`. Capture must have been initiated on + `hStream` via a call to :py:obj:`~.cuStreamBeginCaptureToCig`. Once + this function is called, `hStream` will exit CIG capture mode and + return to its original state, thus removing all CIG stream + restrictions. Also, the command list/command buffer that was associated + with `hStream` in the previous call to + :py:obj:`~.cuStreamBeginCaptureToCig` is now allowed to be submitted + for execution on the graphics API. However, the stream may not be + destroyed until execution of the command list is fully done on the GPU. + This requirements extends also to all streams dependant on the CIG + stream (e.g. via event waits). + + Parameters + ---------- + hStream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + Stream to end CIG capture + + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_STREAM_CAPTURE_WRONG_THREAD` -{{if 'cuStreamGetPriority' in found_functions}} + See Also + -------- + :py:obj:`~.cuStreamBeginCaptureToCig` + """ + cdef cydriver.CUstream cyhStream + if hStream is None: + phStream = 0 + elif isinstance(hStream, (CUstream,)): + phStream = int(hStream) + else: + phStream = int(CUstream(hStream)) + cyhStream = phStream + with nogil: + err = cydriver.cuStreamEndCaptureToCig(cyhStream) + return (_CUresult(err),) @cython.embedsignature(True) def cuStreamGetPriority(hStream): @@ -30046,23 +39498,59 @@ def cuStreamGetPriority(hStream): See Also -------- - :py:obj:`~.cuStreamDestroy`, :py:obj:`~.cuStreamCreate`, :py:obj:`~.cuStreamCreateWithPriority`, :py:obj:`~.cuGreenCtxStreamCreate`, :py:obj:`~.cuCtxGetStreamPriorityRange`, :py:obj:`~.cuStreamGetFlags`, :py:obj:`~.cudaStreamGetPriority` + :py:obj:`~.cuStreamDestroy`, :py:obj:`~.cuStreamCreate`, :py:obj:`~.cuStreamCreateWithPriority`, :py:obj:`~.cuGreenCtxStreamCreate`, :py:obj:`~.cuCtxGetStreamPriorityRange`, :py:obj:`~.cuStreamGetFlags`, :py:obj:`~.cuStreamGetDevice`, :py:obj:`~.cudaStreamGetPriority` """ - cdef ccuda.CUstream chStream + cdef cydriver.CUstream cyhStream if hStream is None: - chStream = 0 + phStream = 0 elif isinstance(hStream, (CUstream,)): phStream = int(hStream) - chStream = phStream else: phStream = int(CUstream(hStream)) - chStream = phStream + cyhStream = phStream cdef int priority = 0 - err = ccuda.cuStreamGetPriority(chStream, &priority) - return (CUresult(err), priority) -{{endif}} + with nogil: + err = cydriver.cuStreamGetPriority(cyhStream, &priority) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, priority) -{{if 'cuStreamGetFlags' in found_functions}} +@cython.embedsignature(True) +def cuStreamGetDevice(hStream): + """ Returns the device handle of the stream. + + Returns in `*device` the device handle of the stream + + Parameters + ---------- + hStream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + Handle to the stream to be queried + + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_CONTEXT`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_INVALID_HANDLE`, :py:obj:`~.CUDA_ERROR_OUT_OF_MEMORY` + device : :py:obj:`~.CUdevice` + Returns the device to which a stream belongs + + See Also + -------- + :py:obj:`~.cuStreamDestroy`, :py:obj:`~.cuStreamCreate`, :py:obj:`~.cuGreenCtxStreamCreate`, :py:obj:`~.cuStreamGetFlags` + """ + cdef cydriver.CUstream cyhStream + if hStream is None: + phStream = 0 + elif isinstance(hStream, (CUstream,)): + phStream = int(hStream) + else: + phStream = int(CUstream(hStream)) + cyhStream = phStream + cdef CUdevice device = CUdevice() + with nogil: + err = cydriver.cuStreamGetDevice(cyhStream, device._pvt_ptr) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, device) @cython.embedsignature(True) def cuStreamGetFlags(hStream): @@ -30089,23 +39577,22 @@ def cuStreamGetFlags(hStream): See Also -------- - :py:obj:`~.cuStreamDestroy`, :py:obj:`~.cuStreamCreate`, :py:obj:`~.cuGreenCtxStreamCreate`, :py:obj:`~.cuStreamGetPriority`, :py:obj:`~.cudaStreamGetFlags` + :py:obj:`~.cuStreamDestroy`, :py:obj:`~.cuStreamCreate`, :py:obj:`~.cuGreenCtxStreamCreate`, :py:obj:`~.cuStreamGetPriority`, :py:obj:`~.cudaStreamGetFlags`, :py:obj:`~.cuStreamGetDevice` """ - cdef ccuda.CUstream chStream + cdef cydriver.CUstream cyhStream if hStream is None: - chStream = 0 + phStream = 0 elif isinstance(hStream, (CUstream,)): phStream = int(hStream) - chStream = phStream else: phStream = int(CUstream(hStream)) - chStream = phStream + cyhStream = phStream cdef unsigned int flags = 0 - err = ccuda.cuStreamGetFlags(chStream, &flags) - return (CUresult(err), flags) -{{endif}} - -{{if 'cuStreamGetId' in found_functions}} + with nogil: + err = cydriver.cuStreamGetFlags(cyhStream, &flags) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, flags) @cython.embedsignature(True) def cuStreamGetId(hStream): @@ -30146,21 +39633,20 @@ def cuStreamGetId(hStream): -------- :py:obj:`~.cuStreamDestroy`, :py:obj:`~.cuStreamCreate`, :py:obj:`~.cuStreamGetPriority`, :py:obj:`~.cudaStreamGetId` """ - cdef ccuda.CUstream chStream + cdef cydriver.CUstream cyhStream if hStream is None: - chStream = 0 + phStream = 0 elif isinstance(hStream, (CUstream,)): phStream = int(hStream) - chStream = phStream else: phStream = int(CUstream(hStream)) - chStream = phStream + cyhStream = phStream cdef unsigned long long streamId = 0 - err = ccuda.cuStreamGetId(chStream, &streamId) - return (CUresult(err), streamId) -{{endif}} - -{{if 'cuStreamGetCtx' in found_functions}} + with nogil: + err = cydriver.cuStreamGetId(cyhStream, &streamId) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, streamId) @cython.embedsignature(True) def cuStreamGetCtx(hStream): @@ -30168,11 +39654,10 @@ def cuStreamGetCtx(hStream): Returns the CUDA context that the stream is associated with. - Note there is a later version of this API, - :py:obj:`~.cuStreamGetCtx_v2`. It will supplant this version in CUDA - 13.0. It is recommended to use :py:obj:`~.cuStreamGetCtx_v2` till then - as this version will return :py:obj:`~.CUDA_ERROR_NOT_SUPPORTED` for - streams created via the API :py:obj:`~.cuGreenCtxStreamCreate`. + If the stream was created via the API + :py:obj:`~.cuGreenCtxStreamCreate`, the returned context is equivalent + to the one returned by :py:obj:`~.cuCtxFromGreenCtx()` on the green + context associated with the stream at creation time. The stream handle `hStream` can refer to any of the following: @@ -30208,23 +39693,22 @@ def cuStreamGetCtx(hStream): See Also -------- - :py:obj:`~.cuStreamDestroy`, :py:obj:`~.cuStreamCreateWithPriority`, :py:obj:`~.cuStreamGetPriority`, :py:obj:`~.cuStreamGetFlags`, :py:obj:`~.cuStreamWaitEvent`, :py:obj:`~.cuStreamQuery`, :py:obj:`~.cuStreamSynchronize`, :py:obj:`~.cuStreamAddCallback`, :py:obj:`~.cudaStreamCreate`, :py:obj:`~.cuStreamGetCtx_v2`, :py:obj:`~.cudaStreamCreateWithFlags` + :py:obj:`~.cuStreamDestroy`, :py:obj:`~.cuStreamCreateWithPriority`, :py:obj:`~.cuStreamGetPriority`, :py:obj:`~.cuStreamGetFlags`, :py:obj:`~.cuStreamGetDevice` :py:obj:`~.cuStreamWaitEvent`, :py:obj:`~.cuStreamQuery`, :py:obj:`~.cuStreamSynchronize`, :py:obj:`~.cuStreamAddCallback`, :py:obj:`~.cudaStreamCreate`, :py:obj:`~.cudaStreamCreateWithFlags` """ - cdef ccuda.CUstream chStream + cdef cydriver.CUstream cyhStream if hStream is None: - chStream = 0 + phStream = 0 elif isinstance(hStream, (CUstream,)): phStream = int(hStream) - chStream = phStream else: phStream = int(CUstream(hStream)) - chStream = phStream + cyhStream = phStream cdef CUcontext pctx = CUcontext() - err = ccuda.cuStreamGetCtx(chStream, pctx._ptr) - return (CUresult(err), pctx) -{{endif}} - -{{if 'cuStreamGetCtx_v2' in found_functions}} + with nogil: + err = cydriver.cuStreamGetCtx(cyhStream, pctx._pvt_ptr) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pctx) @cython.embedsignature(True) def cuStreamGetCtx_v2(hStream): @@ -30283,24 +39767,23 @@ def cuStreamGetCtx_v2(hStream): See Also -------- - :py:obj:`~.cuStreamDestroy`, :py:obj:`~.cuStreamCreate` :py:obj:`~.cuStreamCreateWithPriority`, :py:obj:`~.cuGreenCtxStreamCreate`, :py:obj:`~.cuStreamGetPriority`, :py:obj:`~.cuStreamGetFlags`, :py:obj:`~.cuStreamWaitEvent`, :py:obj:`~.cuStreamQuery`, :py:obj:`~.cuStreamSynchronize`, :py:obj:`~.cuStreamAddCallback`, :py:obj:`~.cudaStreamCreate`, :py:obj:`~.cudaStreamCreateWithFlags`, + :py:obj:`~.cuStreamDestroy`, :py:obj:`~.cuStreamCreate` :py:obj:`~.cuStreamCreateWithPriority`, :py:obj:`~.cuGreenCtxStreamCreate`, :py:obj:`~.cuStreamGetPriority`, :py:obj:`~.cuStreamGetFlags`, :py:obj:`~.cuStreamGetDevice`, :py:obj:`~.cuStreamWaitEvent`, :py:obj:`~.cuStreamQuery`, :py:obj:`~.cuStreamSynchronize`, :py:obj:`~.cuStreamAddCallback`, :py:obj:`~.cudaStreamCreate`, :py:obj:`~.cudaStreamCreateWithFlags`, """ - cdef ccuda.CUstream chStream + cdef cydriver.CUstream cyhStream if hStream is None: - chStream = 0 + phStream = 0 elif isinstance(hStream, (CUstream,)): phStream = int(hStream) - chStream = phStream else: phStream = int(CUstream(hStream)) - chStream = phStream + cyhStream = phStream cdef CUcontext pCtx = CUcontext() cdef CUgreenCtx pGreenCtx = CUgreenCtx() - err = ccuda.cuStreamGetCtx_v2(chStream, pCtx._ptr, pGreenCtx._ptr) - return (CUresult(err), pCtx, pGreenCtx) -{{endif}} - -{{if 'cuStreamWaitEvent' in found_functions}} + with nogil: + err = cydriver.cuStreamGetCtx_v2(cyhStream, pCtx._pvt_ptr, pGreenCtx._pvt_ptr) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None, None) + return (_CUresult_SUCCESS, pCtx, pGreenCtx) @cython.embedsignature(True) def cuStreamWaitEvent(hStream, hEvent, unsigned int Flags): @@ -30338,29 +39821,38 @@ def cuStreamWaitEvent(hStream, hEvent, unsigned int Flags): -------- :py:obj:`~.cuStreamCreate`, :py:obj:`~.cuEventRecord`, :py:obj:`~.cuStreamQuery`, :py:obj:`~.cuStreamSynchronize`, :py:obj:`~.cuStreamAddCallback`, :py:obj:`~.cuStreamDestroy`, :py:obj:`~.cudaStreamWaitEvent` """ - cdef ccuda.CUevent chEvent + cdef cydriver.CUevent cyhEvent if hEvent is None: - chEvent = 0 + phEvent = 0 elif isinstance(hEvent, (CUevent,)): phEvent = int(hEvent) - chEvent = phEvent else: phEvent = int(CUevent(hEvent)) - chEvent = phEvent - cdef ccuda.CUstream chStream + cyhEvent = phEvent + cdef cydriver.CUstream cyhStream if hStream is None: - chStream = 0 + phStream = 0 elif isinstance(hStream, (CUstream,)): phStream = int(hStream) - chStream = phStream else: phStream = int(CUstream(hStream)) - chStream = phStream - err = ccuda.cuStreamWaitEvent(chStream, chEvent, Flags) - return (CUresult(err),) -{{endif}} + cyhStream = phStream + with nogil: + err = cydriver.cuStreamWaitEvent(cyhStream, cyhEvent, Flags) + return (_CUresult(err),) + +ctypedef struct cuStreamCallbackData_st: + cydriver.CUstreamCallback callback + void *userData -{{if 'cuStreamAddCallback' in found_functions}} +ctypedef cuStreamCallbackData_st cuStreamCallbackData + +@cython.show_performance_hints(False) +cdef void cuStreamCallbackWrapper(cydriver.CUstream stream, cydriver.CUresult status, void *data) nogil: + cdef cuStreamCallbackData *cbData = data + with gil: + cbData.callback(stream, status, cbData.userData) + free(cbData) @cython.embedsignature(True) def cuStreamAddCallback(hStream, callback, userData, unsigned int flags): @@ -30431,31 +39923,38 @@ def cuStreamAddCallback(hStream, callback, userData, unsigned int flags): ----- This function is slated for eventual deprecation and removal. If you do not require the callback to execute in case of a device error, consider using :py:obj:`~.cuLaunchHostFunc`. Additionally, this function is not supported with :py:obj:`~.cuStreamBeginCapture` and :py:obj:`~.cuStreamEndCapture`, unlike :py:obj:`~.cuLaunchHostFunc`. """ - cdef ccuda.CUstreamCallback ccallback + cdef cydriver.CUstreamCallback cycallback if callback is None: - ccallback = 0 + pcallback = 0 elif isinstance(callback, (CUstreamCallback,)): pcallback = int(callback) - ccallback = pcallback else: pcallback = int(CUstreamCallback(callback)) - ccallback = pcallback - cdef ccuda.CUstream chStream + cycallback = pcallback + cdef cydriver.CUstream cyhStream if hStream is None: - chStream = 0 + phStream = 0 elif isinstance(hStream, (CUstream,)): phStream = int(hStream) - chStream = phStream else: phStream = int(CUstream(hStream)) - chStream = phStream - cuserData = utils.HelperInputVoidPtr(userData) - cdef void* cuserData_ptr = cuserData.cptr - err = ccuda.cuStreamAddCallback(chStream, ccallback, cuserData_ptr, flags) - return (CUresult(err),) -{{endif}} + cyhStream = phStream + cdef _HelperInputVoidPtrStruct cyuserDataHelper + cdef void* cyuserData = _helper_input_void_ptr(userData, &cyuserDataHelper) + + cdef cuStreamCallbackData *cbData = NULL + cbData = malloc(sizeof(cbData[0])) + if cbData == NULL: + return (CUresult.CUDA_ERROR_OUT_OF_MEMORY,) + cbData.callback = cycallback + cbData.userData = cyuserData -{{if 'cuStreamBeginCapture_v2' in found_functions}} + with nogil: + err = cydriver.cuStreamAddCallback(cyhStream, cuStreamCallbackWrapper, cbData, flags) + if err != cydriver.CUDA_SUCCESS: + free(cbData) + _helper_input_void_ptr_free(&cyuserDataHelper) + return (_CUresult(err),) @cython.embedsignature(True) def cuStreamBeginCapture(hStream, mode not None : CUstreamCaptureMode): @@ -30497,24 +39996,107 @@ def cuStreamBeginCapture(hStream, mode not None : CUstreamCaptureMode): ----- Kernels captured using this API must not use texture and surface references. Reading or writing through any texture or surface reference is undefined behavior. This restriction does not apply to texture and surface objects. """ - cdef ccuda.CUstream chStream + cdef cydriver.CUstream cyhStream if hStream is None: - chStream = 0 + phStream = 0 elif isinstance(hStream, (CUstream,)): phStream = int(hStream) - chStream = phStream else: phStream = int(CUstream(hStream)) - chStream = phStream - cdef ccuda.CUstreamCaptureMode cmode = mode.value - err = ccuda.cuStreamBeginCapture(chStream, cmode) - return (CUresult(err),) -{{endif}} + cyhStream = phStream + cdef cydriver.CUstreamCaptureMode cymode = int(mode) + with nogil: + err = cydriver.cuStreamBeginCapture(cyhStream, cymode) + return (_CUresult(err),) + +@cython.embedsignature(True) +def cuStreamBeginRecaptureToGraph(hStream, mode not None : CUstreamCaptureMode, hGraph, callbackFunc, userData): + """ Begin graph capture on a stream to an existing graph. + + Begin graph capture on `hStream` to the existing `hGraph`. The node + creation order while recapturing the graph must be identical to the + original graph. The recapture will fail immediately for: + + - Topology mismatches between the existing graph and the recaptured + graph + + - Parameter mismatches for memory allocation or free nodes + + Any other node parameter mismatches during recapture can be configured + to call the function provided in `callbackFunc`. The recapture will + fail immediately if the callback returns anything other than + CUDA_SUCCESS. + + If the recapture fails for any reason, the `graph` will be in an + undefined state and should be destroyed. + + See cuStreamBeginCapture for additional detail on beginning the + capture. + + Parameters + ---------- + hStream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + Stream in which to initiate capture + mode : :py:obj:`~.CUstreamCaptureMode` + Controls the interaction of this capture sequence with other API + calls that are potentially unsafe. For more details see + :py:obj:`~.cuThreadExchangeStreamCaptureMode`. + hGraph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` + Existing CUDA graph to be captured into + callbackFunc : :py:obj:`~.CUgraphRecaptureCallback` + Function that will be called for all parameter mismatches from the + original graph + userData : Any + A generic pointer to user data that is passed into the callback + function + + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, + + See Also + -------- + :py:obj:`~.cuStreamCreate`, :py:obj:`~.cuStreamBeginCapture`, :py:obj:`~.cuStreamIsCapturing`, :py:obj:`~.cuStreamEndCapture`, :py:obj:`~.cuThreadExchangeStreamCaptureMode` -{{if 'cuStreamBeginCaptureToGraph' in found_functions}} + Notes + ----- + Any user objects associated with `graph` will be released prior to the recapture. + """ + cdef cydriver.CUgraphRecaptureCallback cycallbackFunc + if callbackFunc is None: + pcallbackFunc = 0 + elif isinstance(callbackFunc, (CUgraphRecaptureCallback,)): + pcallbackFunc = int(callbackFunc) + else: + pcallbackFunc = int(CUgraphRecaptureCallback(callbackFunc)) + cycallbackFunc = pcallbackFunc + cdef cydriver.CUgraph cyhGraph + if hGraph is None: + phGraph = 0 + elif isinstance(hGraph, (CUgraph,)): + phGraph = int(hGraph) + else: + phGraph = int(CUgraph(hGraph)) + cyhGraph = phGraph + cdef cydriver.CUstream cyhStream + if hStream is None: + phStream = 0 + elif isinstance(hStream, (CUstream,)): + phStream = int(hStream) + else: + phStream = int(CUstream(hStream)) + cyhStream = phStream + cdef cydriver.CUstreamCaptureMode cymode = int(mode) + cdef _HelperInputVoidPtrStruct cyuserDataHelper + cdef void* cyuserData = _helper_input_void_ptr(userData, &cyuserDataHelper) + with nogil: + err = cydriver.cuStreamBeginRecaptureToGraph(cyhStream, cymode, cyhGraph, cycallbackFunc, cyuserData) + _helper_input_void_ptr_free(&cyuserDataHelper) + return (_CUresult(err),) @cython.embedsignature(True) -def cuStreamBeginCaptureToGraph(hStream, hGraph, dependencies : Optional[List[CUgraphNode]], dependencyData : Optional[List[CUgraphEdgeData]], size_t numDependencies, mode not None : CUstreamCaptureMode): +def cuStreamBeginCaptureToGraph(hStream, hGraph, dependencies : Optional[tuple[CUgraphNode] | list[CUgraphNode]], dependencyData : Optional[tuple[CUgraphEdgeData] | list[CUgraphEdgeData]], size_t numDependencies, mode not None : CUstreamCaptureMode): """ Begins graph capture on a stream to an existing graph. Begin graph capture on `hStream`, placing new nodes into an existing @@ -30540,10 +40122,10 @@ def cuStreamBeginCaptureToGraph(hStream, hGraph, dependencies : Optional[List[CU Stream in which to initiate capture. hGraph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` Graph to capture into. - dependencies : List[:py:obj:`~.CUgraphNode`] + dependencies : list[:py:obj:`~.CUgraphNode`] Dependencies of the first node captured in the stream. Can be NULL if numDependencies is 0. - dependencyData : List[:py:obj:`~.CUgraphEdgeData`] + dependencyData : list[:py:obj:`~.CUgraphEdgeData`] Optional array of data associated with each dependency. numDependencies : size_t Number of dependencies. @@ -30559,7 +40141,7 @@ def cuStreamBeginCaptureToGraph(hStream, hGraph, dependencies : Optional[List[CU See Also -------- - :py:obj:`~.cuStreamBeginCapture`, :py:obj:`~.cuStreamCreate`, :py:obj:`~.cuStreamIsCapturing`, :py:obj:`~.cuStreamEndCapture`, :py:obj:`~.cuThreadExchangeStreamCaptureMode`, :py:obj:`~.cuGraphAddNode`, + :py:obj:`~.cuStreamBeginCapture`, :py:obj:`~.cuStreamCreate`, :py:obj:`~.cuStreamIsCapturing`, :py:obj:`~.cuStreamEndCapture`, :py:obj:`~.cuThreadExchangeStreamCaptureMode`, :py:obj:`~.cuGraphAddNode` Notes ----- @@ -30567,55 +40149,54 @@ def cuStreamBeginCaptureToGraph(hStream, hGraph, dependencies : Optional[List[CU """ dependencyData = [] if dependencyData is None else dependencyData if not all(isinstance(_x, (CUgraphEdgeData,)) for _x in dependencyData): - raise TypeError("Argument 'dependencyData' is not instance of type (expected List[ccuda.CUgraphEdgeData,]") + raise TypeError("Argument 'dependencyData' is not instance of type (expected tuple[cydriver.CUgraphEdgeData,] or list[cydriver.CUgraphEdgeData,]") dependencies = [] if dependencies is None else dependencies if not all(isinstance(_x, (CUgraphNode,)) for _x in dependencies): - raise TypeError("Argument 'dependencies' is not instance of type (expected List[ccuda.CUgraphNode,]") - cdef ccuda.CUgraph chGraph + raise TypeError("Argument 'dependencies' is not instance of type (expected tuple[cydriver.CUgraphNode,] or list[cydriver.CUgraphNode,]") + cdef cydriver.CUgraph cyhGraph if hGraph is None: - chGraph = 0 + phGraph = 0 elif isinstance(hGraph, (CUgraph,)): phGraph = int(hGraph) - chGraph = phGraph else: phGraph = int(CUgraph(hGraph)) - chGraph = phGraph - cdef ccuda.CUstream chStream + cyhGraph = phGraph + cdef cydriver.CUstream cyhStream if hStream is None: - chStream = 0 + phStream = 0 elif isinstance(hStream, (CUstream,)): phStream = int(hStream) - chStream = phStream else: phStream = int(CUstream(hStream)) - chStream = phStream - cdef ccuda.CUgraphNode* cdependencies = NULL - if len(dependencies) > 0: - cdependencies = calloc(len(dependencies), sizeof(ccuda.CUgraphNode)) - if cdependencies is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(dependencies)) + 'x' + str(sizeof(ccuda.CUgraphNode))) + cyhStream = phStream + cdef cydriver.CUgraphNode* cydependencies = NULL + if len(dependencies) > 1: + cydependencies = calloc(len(dependencies), sizeof(cydriver.CUgraphNode)) + if cydependencies is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(dependencies)) + 'x' + str(sizeof(cydriver.CUgraphNode))) else: for idx in range(len(dependencies)): - cdependencies[idx] = (dependencies[idx])._ptr[0] - cdef ccuda.CUgraphEdgeData* cdependencyData = NULL - if len(dependencyData) > 0: - cdependencyData = calloc(len(dependencyData), sizeof(ccuda.CUgraphEdgeData)) - if cdependencyData is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(dependencyData)) + 'x' + str(sizeof(ccuda.CUgraphEdgeData))) + cydependencies[idx] = (dependencies[idx])._pvt_ptr[0] + elif len(dependencies) == 1: + cydependencies = (dependencies[0])._pvt_ptr + cdef cydriver.CUgraphEdgeData* cydependencyData = NULL + if len(dependencyData) > 1: + cydependencyData = calloc(len(dependencyData), sizeof(cydriver.CUgraphEdgeData)) + if cydependencyData is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(dependencyData)) + 'x' + str(sizeof(cydriver.CUgraphEdgeData))) for idx in range(len(dependencyData)): - string.memcpy(&cdependencyData[idx], (dependencyData[idx])._ptr, sizeof(ccuda.CUgraphEdgeData)) + string.memcpy(&cydependencyData[idx], (dependencyData[idx])._pvt_ptr, sizeof(cydriver.CUgraphEdgeData)) + elif len(dependencyData) == 1: + cydependencyData = (dependencyData[0])._pvt_ptr if numDependencies > len(dependencies): raise RuntimeError("List is too small: " + str(len(dependencies)) + " < " + str(numDependencies)) - if numDependencies > len(dependencyData): raise RuntimeError("List is too small: " + str(len(dependencyData)) + " < " + str(numDependencies)) - cdef ccuda.CUstreamCaptureMode cmode = mode.value - err = ccuda.cuStreamBeginCaptureToGraph(chStream, chGraph, (dependencies[0])._ptr if len(dependencies) == 1 else cdependencies, (dependencyData[0])._ptr if len(dependencyData) == 1 else cdependencyData, numDependencies, cmode) - if cdependencies is not NULL: - free(cdependencies) - if cdependencyData is not NULL: - free(cdependencyData) - return (CUresult(err),) -{{endif}} - -{{if 'cuThreadExchangeStreamCaptureMode' in found_functions}} + cdef cydriver.CUstreamCaptureMode cymode = int(mode) + with nogil: + err = cydriver.cuStreamBeginCaptureToGraph(cyhStream, cyhGraph, cydependencies, cydependencyData, numDependencies, cymode) + if len(dependencies) > 1 and cydependencies is not NULL: + free(cydependencies) + if len(dependencyData) > 1 and cydependencyData is not NULL: + free(cydependencyData) + return (_CUresult(err),) @cython.embedsignature(True) def cuThreadExchangeStreamCaptureMode(mode not None : CUstreamCaptureMode): @@ -30681,12 +40262,12 @@ def cuThreadExchangeStreamCaptureMode(mode not None : CUstreamCaptureMode): -------- :py:obj:`~.cuStreamBeginCapture` """ - cdef ccuda.CUstreamCaptureMode cmode = mode.value - err = ccuda.cuThreadExchangeStreamCaptureMode(&cmode) - return (CUresult(err), CUstreamCaptureMode(cmode)) -{{endif}} - -{{if 'cuStreamEndCapture' in found_functions}} + cdef cydriver.CUstreamCaptureMode cymode = int(mode) + with nogil: + err = cydriver.cuThreadExchangeStreamCaptureMode(&cymode) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, CUstreamCaptureMode(cymode)) @cython.embedsignature(True) def cuStreamEndCapture(hStream): @@ -30718,21 +40299,20 @@ def cuStreamEndCapture(hStream): -------- :py:obj:`~.cuStreamCreate`, :py:obj:`~.cuStreamBeginCapture`, :py:obj:`~.cuStreamIsCapturing`, :py:obj:`~.cuGraphDestroy` """ - cdef ccuda.CUstream chStream + cdef cydriver.CUstream cyhStream if hStream is None: - chStream = 0 + phStream = 0 elif isinstance(hStream, (CUstream,)): phStream = int(hStream) - chStream = phStream else: phStream = int(CUstream(hStream)) - chStream = phStream + cyhStream = phStream cdef CUgraph phGraph = CUgraph() - err = ccuda.cuStreamEndCapture(chStream, phGraph._ptr) - return (CUresult(err), phGraph) -{{endif}} - -{{if 'cuStreamIsCapturing' in found_functions}} + with nogil: + err = cydriver.cuStreamEndCapture(cyhStream, phGraph._pvt_ptr) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, phGraph) @cython.embedsignature(True) def cuStreamIsCapturing(hStream): @@ -30779,21 +40359,20 @@ def cuStreamIsCapturing(hStream): -------- :py:obj:`~.cuStreamCreate`, :py:obj:`~.cuStreamBeginCapture`, :py:obj:`~.cuStreamEndCapture` """ - cdef ccuda.CUstream chStream + cdef cydriver.CUstream cyhStream if hStream is None: - chStream = 0 + phStream = 0 elif isinstance(hStream, (CUstream,)): phStream = int(hStream) - chStream = phStream else: phStream = int(CUstream(hStream)) - chStream = phStream - cdef ccuda.CUstreamCaptureStatus captureStatus - err = ccuda.cuStreamIsCapturing(chStream, &captureStatus) - return (CUresult(err), CUstreamCaptureStatus(captureStatus)) -{{endif}} - -{{if 'cuStreamGetCaptureInfo_v2' in found_functions}} + cyhStream = phStream + cdef cydriver.CUstreamCaptureStatus captureStatus + with nogil: + err = cydriver.cuStreamIsCapturing(cyhStream, &captureStatus) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, CUstreamCaptureStatus(captureStatus)) @cython.embedsignature(True) def cuStreamGetCaptureInfo(hStream): @@ -30810,88 +40389,6 @@ def cuStreamGetCaptureInfo(hStream): - the call returns CUDA_SUCCESS - - the returned capture status is - :py:obj:`~.CU_STREAM_CAPTURE_STATUS_ACTIVE` - - Parameters - ---------- - hStream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` - The stream to query - - Returns - ------- - CUresult - :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_STREAM_CAPTURE_IMPLICIT` - captureStatus_out : :py:obj:`~.CUstreamCaptureStatus` - Location to return the capture status of the stream; required - id_out : :py:obj:`~.cuuint64_t` - Optional location to return an id for the capture sequence, which - is unique over the lifetime of the process - graph_out : :py:obj:`~.CUgraph` - Optional location to return the graph being captured into. All - operations other than destroy and node removal are permitted on the - graph while the capture sequence is in progress. This API does not - transfer ownership of the graph, which is transferred or destroyed - at :py:obj:`~.cuStreamEndCapture`. Note that the graph handle may - be invalidated before end of capture for certain errors. Nodes that - are or become unreachable from the original stream at - :py:obj:`~.cuStreamEndCapture` due to direct actions on the graph - do not trigger :py:obj:`~.CUDA_ERROR_STREAM_CAPTURE_UNJOINED`. - dependencies_out : List[:py:obj:`~.CUgraphNode`] - Optional location to store a pointer to an array of nodes. The next - node to be captured in the stream will depend on this set of nodes, - absent operations such as event wait which modify this set. The - array pointer is valid until the next API call which operates on - the stream or until the capture is terminated. The node handles may - be copied out and are valid until they or the graph is destroyed. - The driver-owned array may also be passed directly to APIs that - operate on the graph (not the stream) without copying. - numDependencies_out : int - Optional location to store the size of the array returned in - dependencies_out. - - See Also - -------- - :py:obj:`~.cuStreamGetCaptureInfo_v3` :py:obj:`~.cuStreamBeginCapture`, :py:obj:`~.cuStreamIsCapturing`, :py:obj:`~.cuStreamUpdateCaptureDependencies` - """ - cdef ccuda.CUstream chStream - if hStream is None: - chStream = 0 - elif isinstance(hStream, (CUstream,)): - phStream = int(hStream) - chStream = phStream - else: - phStream = int(CUstream(hStream)) - chStream = phStream - cdef ccuda.CUstreamCaptureStatus captureStatus_out - cdef cuuint64_t id_out = cuuint64_t() - cdef CUgraph graph_out = CUgraph() - cdef const ccuda.CUgraphNode* cdependencies_out = NULL - pydependencies_out = [] - cdef size_t numDependencies_out = 0 - err = ccuda.cuStreamGetCaptureInfo(chStream, &captureStatus_out, id_out._ptr, graph_out._ptr, &cdependencies_out, &numDependencies_out) - if CUresult(err) == CUresult(0): - pydependencies_out = [CUgraphNode(init_value=cdependencies_out[idx]) for idx in range(numDependencies_out)] - return (CUresult(err), CUstreamCaptureStatus(captureStatus_out), id_out, graph_out, pydependencies_out, numDependencies_out) -{{endif}} - -{{if 'cuStreamGetCaptureInfo_v3' in found_functions}} - -@cython.embedsignature(True) -def cuStreamGetCaptureInfo_v3(hStream): - """ Query a stream's capture state (12.3+) - - Query stream state related to stream capture. - - If called on :py:obj:`~.CU_STREAM_LEGACY` (the "null stream") while a - stream not created with :py:obj:`~.CU_STREAM_NON_BLOCKING` is - capturing, returns :py:obj:`~.CUDA_ERROR_STREAM_CAPTURE_IMPLICIT`. - - Valid data (other than capture status) is returned only if both of the - following are true: - - - the call returns CUDA_SUCCESS - - the returned capture status is :py:obj:`~.CU_STREAM_CAPTURE_STATUS_ACTIVE` @@ -30924,7 +40421,7 @@ def cuStreamGetCaptureInfo_v3(hStream): are or become unreachable from the original stream at :py:obj:`~.cuStreamEndCapture` due to direct actions on the graph do not trigger :py:obj:`~.CUDA_ERROR_STREAM_CAPTURE_UNJOINED`. - dependencies_out : List[:py:obj:`~.CUgraphNode`] + dependencies_out : list[:py:obj:`~.CUgraphNode`] Optional location to store a pointer to an array of nodes. The next node to be captured in the stream will depend on this set of nodes, absent operations such as event wait which modify this set. The @@ -30933,7 +40430,7 @@ def cuStreamGetCaptureInfo_v3(hStream): be copied out and are valid until they or the graph is destroyed. The driver-owned array may also be passed directly to APIs that operate on the graph (not the stream) without copying. - edgeData_out : List[:py:obj:`~.CUgraphEdgeData`] + edgeData_out : list[:py:obj:`~.CUgraphEdgeData`] Optional location to store a pointer to an array of graph edge data. This array parallels `dependencies_out`; the next node to be added has an edge to `dependencies_out`[i] with annotation @@ -30946,112 +40443,41 @@ def cuStreamGetCaptureInfo_v3(hStream): See Also -------- - :py:obj:`~.cuStreamGetCaptureInfo` :py:obj:`~.cuStreamBeginCapture`, :py:obj:`~.cuStreamIsCapturing`, :py:obj:`~.cuStreamUpdateCaptureDependencies` + :py:obj:`~.cuStreamBeginCapture`, :py:obj:`~.cuStreamIsCapturing`, :py:obj:`~.cuStreamUpdateCaptureDependencies` """ - cdef ccuda.CUstream chStream + cdef cydriver.CUstream cyhStream if hStream is None: - chStream = 0 + phStream = 0 elif isinstance(hStream, (CUstream,)): phStream = int(hStream) - chStream = phStream else: phStream = int(CUstream(hStream)) - chStream = phStream - cdef ccuda.CUstreamCaptureStatus captureStatus_out + cyhStream = phStream + cdef cydriver.CUstreamCaptureStatus captureStatus_out cdef cuuint64_t id_out = cuuint64_t() cdef CUgraph graph_out = CUgraph() - cdef const ccuda.CUgraphNode* cdependencies_out = NULL + cdef const cydriver.CUgraphNode* cydependencies_out = NULL pydependencies_out = [] - cdef const ccuda.CUgraphEdgeData* cedgeData_out = NULL + cdef const cydriver.CUgraphEdgeData* cyedgeData_out = NULL pyedgeData_out = [] cdef size_t numDependencies_out = 0 - err = ccuda.cuStreamGetCaptureInfo_v3(chStream, &captureStatus_out, id_out._ptr, graph_out._ptr, &cdependencies_out, &cedgeData_out, &numDependencies_out) + with nogil: + err = cydriver.cuStreamGetCaptureInfo(cyhStream, &captureStatus_out, id_out._pvt_ptr, graph_out._pvt_ptr, &cydependencies_out, &cyedgeData_out, &numDependencies_out) if CUresult(err) == CUresult(0): - pydependencies_out = [CUgraphNode(init_value=cdependencies_out[idx]) for idx in range(numDependencies_out)] + pydependencies_out = [CUgraphNode() for _ in range(numDependencies_out)] + for idx in range(numDependencies_out): + (pydependencies_out[idx])._pvt_ptr[0] = cydependencies_out[idx] if CUresult(err) == CUresult(0): - pyedgeData_out = [CUgraphEdgeData(_ptr=&cedgeData_out[idx]) for idx in range(numDependencies_out)] - return (CUresult(err), CUstreamCaptureStatus(captureStatus_out), id_out, graph_out, pydependencies_out, pyedgeData_out, numDependencies_out) -{{endif}} - -{{if 'cuStreamUpdateCaptureDependencies' in found_functions}} + pyedgeData_out = [CUgraphEdgeData() for _ in range(numDependencies_out)] + for idx in range(numDependencies_out): + (pyedgeData_out[idx])._pvt_ptr[0] = cyedgeData_out[idx] + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None, None, None, None, None, None) + return (_CUresult_SUCCESS, CUstreamCaptureStatus(captureStatus_out), id_out, graph_out, pydependencies_out, pyedgeData_out, numDependencies_out) @cython.embedsignature(True) -def cuStreamUpdateCaptureDependencies(hStream, dependencies : Optional[List[CUgraphNode]], size_t numDependencies, unsigned int flags): - """ Update the set of dependencies in a capturing stream (11.3+) - - Modifies the dependency set of a capturing stream. The dependency set - is the set of nodes that the next captured node in the stream will - depend on. - - Valid flags are :py:obj:`~.CU_STREAM_ADD_CAPTURE_DEPENDENCIES` and - :py:obj:`~.CU_STREAM_SET_CAPTURE_DEPENDENCIES`. These control whether - the set passed to the API is added to the existing set or replaces it. - A flags value of 0 defaults to - :py:obj:`~.CU_STREAM_ADD_CAPTURE_DEPENDENCIES`. - - Nodes that are removed from the dependency set via this API do not - result in :py:obj:`~.CUDA_ERROR_STREAM_CAPTURE_UNJOINED` if they are - unreachable from the stream at :py:obj:`~.cuStreamEndCapture`. - - Returns :py:obj:`~.CUDA_ERROR_ILLEGAL_STATE` if the stream is not - capturing. - - This API is new in CUDA 11.3. Developers requiring compatibility across - minor versions to CUDA 11.0 should not use this API or provide a - fallback. - - Parameters - ---------- - hStream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` - The stream to update - dependencies : List[:py:obj:`~.CUgraphNode`] - The set of dependencies to add - numDependencies : size_t - The size of the dependencies array - flags : unsigned int - See above - - Returns - ------- - CUresult - :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_ILLEGAL_STATE` - - See Also - -------- - :py:obj:`~.cuStreamBeginCapture`, :py:obj:`~.cuStreamGetCaptureInfo`, - """ - dependencies = [] if dependencies is None else dependencies - if not all(isinstance(_x, (CUgraphNode,)) for _x in dependencies): - raise TypeError("Argument 'dependencies' is not instance of type (expected List[ccuda.CUgraphNode,]") - cdef ccuda.CUstream chStream - if hStream is None: - chStream = 0 - elif isinstance(hStream, (CUstream,)): - phStream = int(hStream) - chStream = phStream - else: - phStream = int(CUstream(hStream)) - chStream = phStream - cdef ccuda.CUgraphNode* cdependencies = NULL - if len(dependencies) > 0: - cdependencies = calloc(len(dependencies), sizeof(ccuda.CUgraphNode)) - if cdependencies is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(dependencies)) + 'x' + str(sizeof(ccuda.CUgraphNode))) - else: - for idx in range(len(dependencies)): - cdependencies[idx] = (dependencies[idx])._ptr[0] - if numDependencies > len(dependencies): raise RuntimeError("List is too small: " + str(len(dependencies)) + " < " + str(numDependencies)) - err = ccuda.cuStreamUpdateCaptureDependencies(chStream, (dependencies[0])._ptr if len(dependencies) == 1 else cdependencies, numDependencies, flags) - if cdependencies is not NULL: - free(cdependencies) - return (CUresult(err),) -{{endif}} - -{{if 'cuStreamUpdateCaptureDependencies_v2' in found_functions}} - -@cython.embedsignature(True) -def cuStreamUpdateCaptureDependencies_v2(hStream, dependencies : Optional[List[CUgraphNode]], dependencyData : Optional[List[CUgraphEdgeData]], size_t numDependencies, unsigned int flags): - """ Update the set of dependencies in a capturing stream (12.3+) +def cuStreamUpdateCaptureDependencies(hStream, dependencies : Optional[tuple[CUgraphNode] | list[CUgraphNode]], dependencyData : Optional[tuple[CUgraphEdgeData] | list[CUgraphEdgeData]], size_t numDependencies, unsigned int flags): + """ Update the set of dependencies in a capturing stream. Modifies the dependency set of a capturing stream. The dependency set is the set of nodes that the next captured node in the stream will @@ -31074,9 +40500,9 @@ def cuStreamUpdateCaptureDependencies_v2(hStream, dependencies : Optional[List[C ---------- hStream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` The stream to update - dependencies : List[:py:obj:`~.CUgraphNode`] + dependencies : list[:py:obj:`~.CUgraphNode`] The set of dependencies to add - dependencyData : List[:py:obj:`~.CUgraphEdgeData`] + dependencyData : list[:py:obj:`~.CUgraphEdgeData`] Optional array of data associated with each dependency. numDependencies : size_t The size of the dependencies array @@ -31090,47 +40516,48 @@ def cuStreamUpdateCaptureDependencies_v2(hStream, dependencies : Optional[List[C See Also -------- - :py:obj:`~.cuStreamBeginCapture`, :py:obj:`~.cuStreamGetCaptureInfo`, + :py:obj:`~.cuStreamBeginCapture`, :py:obj:`~.cuStreamGetCaptureInfo` """ dependencyData = [] if dependencyData is None else dependencyData if not all(isinstance(_x, (CUgraphEdgeData,)) for _x in dependencyData): - raise TypeError("Argument 'dependencyData' is not instance of type (expected List[ccuda.CUgraphEdgeData,]") + raise TypeError("Argument 'dependencyData' is not instance of type (expected tuple[cydriver.CUgraphEdgeData,] or list[cydriver.CUgraphEdgeData,]") dependencies = [] if dependencies is None else dependencies if not all(isinstance(_x, (CUgraphNode,)) for _x in dependencies): - raise TypeError("Argument 'dependencies' is not instance of type (expected List[ccuda.CUgraphNode,]") - cdef ccuda.CUstream chStream + raise TypeError("Argument 'dependencies' is not instance of type (expected tuple[cydriver.CUgraphNode,] or list[cydriver.CUgraphNode,]") + cdef cydriver.CUstream cyhStream if hStream is None: - chStream = 0 + phStream = 0 elif isinstance(hStream, (CUstream,)): phStream = int(hStream) - chStream = phStream else: phStream = int(CUstream(hStream)) - chStream = phStream - cdef ccuda.CUgraphNode* cdependencies = NULL - if len(dependencies) > 0: - cdependencies = calloc(len(dependencies), sizeof(ccuda.CUgraphNode)) - if cdependencies is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(dependencies)) + 'x' + str(sizeof(ccuda.CUgraphNode))) + cyhStream = phStream + cdef cydriver.CUgraphNode* cydependencies = NULL + if len(dependencies) > 1: + cydependencies = calloc(len(dependencies), sizeof(cydriver.CUgraphNode)) + if cydependencies is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(dependencies)) + 'x' + str(sizeof(cydriver.CUgraphNode))) else: for idx in range(len(dependencies)): - cdependencies[idx] = (dependencies[idx])._ptr[0] - cdef ccuda.CUgraphEdgeData* cdependencyData = NULL - if len(dependencyData) > 0: - cdependencyData = calloc(len(dependencyData), sizeof(ccuda.CUgraphEdgeData)) - if cdependencyData is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(dependencyData)) + 'x' + str(sizeof(ccuda.CUgraphEdgeData))) + cydependencies[idx] = (dependencies[idx])._pvt_ptr[0] + elif len(dependencies) == 1: + cydependencies = (dependencies[0])._pvt_ptr + cdef cydriver.CUgraphEdgeData* cydependencyData = NULL + if len(dependencyData) > 1: + cydependencyData = calloc(len(dependencyData), sizeof(cydriver.CUgraphEdgeData)) + if cydependencyData is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(dependencyData)) + 'x' + str(sizeof(cydriver.CUgraphEdgeData))) for idx in range(len(dependencyData)): - string.memcpy(&cdependencyData[idx], (dependencyData[idx])._ptr, sizeof(ccuda.CUgraphEdgeData)) - err = ccuda.cuStreamUpdateCaptureDependencies_v2(chStream, (dependencies[0])._ptr if len(dependencies) == 1 else cdependencies, (dependencyData[0])._ptr if len(dependencyData) == 1 else cdependencyData, numDependencies, flags) - if cdependencies is not NULL: - free(cdependencies) - if cdependencyData is not NULL: - free(cdependencyData) - return (CUresult(err),) -{{endif}} - -{{if 'cuStreamAttachMemAsync' in found_functions}} + string.memcpy(&cydependencyData[idx], (dependencyData[idx])._pvt_ptr, sizeof(cydriver.CUgraphEdgeData)) + elif len(dependencyData) == 1: + cydependencyData = (dependencyData[0])._pvt_ptr + with nogil: + err = cydriver.cuStreamUpdateCaptureDependencies(cyhStream, cydependencies, cydependencyData, numDependencies, flags) + if len(dependencies) > 1 and cydependencies is not NULL: + free(cydependencies) + if len(dependencyData) > 1 and cydependencyData is not NULL: + free(cydependencyData) + return (_CUresult(err),) @cython.embedsignature(True) def cuStreamAttachMemAsync(hStream, dptr, size_t length, unsigned int flags): @@ -31222,29 +40649,25 @@ def cuStreamAttachMemAsync(hStream, dptr, size_t length, unsigned int flags): -------- :py:obj:`~.cuStreamCreate`, :py:obj:`~.cuStreamQuery`, :py:obj:`~.cuStreamSynchronize`, :py:obj:`~.cuStreamWaitEvent`, :py:obj:`~.cuStreamDestroy`, :py:obj:`~.cuMemAllocManaged`, :py:obj:`~.cudaStreamAttachMemAsync` """ - cdef ccuda.CUdeviceptr cdptr + cdef cydriver.CUdeviceptr cydptr if dptr is None: - cdptr = 0 + pdptr = 0 elif isinstance(dptr, (CUdeviceptr,)): pdptr = int(dptr) - cdptr = pdptr else: pdptr = int(CUdeviceptr(dptr)) - cdptr = pdptr - cdef ccuda.CUstream chStream + cydptr = pdptr + cdef cydriver.CUstream cyhStream if hStream is None: - chStream = 0 + phStream = 0 elif isinstance(hStream, (CUstream,)): phStream = int(hStream) - chStream = phStream else: phStream = int(CUstream(hStream)) - chStream = phStream - err = ccuda.cuStreamAttachMemAsync(chStream, cdptr, length, flags) - return (CUresult(err),) -{{endif}} - -{{if 'cuStreamQuery' in found_functions}} + cyhStream = phStream + with nogil: + err = cydriver.cuStreamAttachMemAsync(cyhStream, cydptr, length, flags) + return (_CUresult(err),) @cython.embedsignature(True) def cuStreamQuery(hStream): @@ -31272,20 +40695,17 @@ def cuStreamQuery(hStream): -------- :py:obj:`~.cuStreamCreate`, :py:obj:`~.cuStreamWaitEvent`, :py:obj:`~.cuStreamDestroy`, :py:obj:`~.cuStreamSynchronize`, :py:obj:`~.cuStreamAddCallback`, :py:obj:`~.cudaStreamQuery` """ - cdef ccuda.CUstream chStream + cdef cydriver.CUstream cyhStream if hStream is None: - chStream = 0 + phStream = 0 elif isinstance(hStream, (CUstream,)): phStream = int(hStream) - chStream = phStream else: phStream = int(CUstream(hStream)) - chStream = phStream - err = ccuda.cuStreamQuery(chStream) - return (CUresult(err),) -{{endif}} - -{{if 'cuStreamSynchronize' in found_functions}} + cyhStream = phStream + with nogil: + err = cydriver.cuStreamQuery(cyhStream) + return (_CUresult(err),) @cython.embedsignature(True) def cuStreamSynchronize(hStream): @@ -31312,20 +40732,17 @@ def cuStreamSynchronize(hStream): -------- :py:obj:`~.cuStreamCreate`, :py:obj:`~.cuStreamDestroy`, :py:obj:`~.cuStreamWaitEvent`, :py:obj:`~.cuStreamQuery`, :py:obj:`~.cuStreamAddCallback`, :py:obj:`~.cudaStreamSynchronize` """ - cdef ccuda.CUstream chStream + cdef cydriver.CUstream cyhStream if hStream is None: - chStream = 0 + phStream = 0 elif isinstance(hStream, (CUstream,)): phStream = int(hStream) - chStream = phStream else: phStream = int(CUstream(hStream)) - chStream = phStream - err = ccuda.cuStreamSynchronize(chStream) - return (CUresult(err),) -{{endif}} - -{{if 'cuStreamDestroy_v2' in found_functions}} + cyhStream = phStream + with nogil: + err = cydriver.cuStreamSynchronize(cyhStream) + return (_CUresult(err),) @cython.embedsignature(True) def cuStreamDestroy(hStream): @@ -31347,26 +40764,23 @@ def cuStreamDestroy(hStream): Returns ------- CUresult - :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_CONTEXT`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_INVALID_HANDLE` + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_CONTEXT`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_INVALID_HANDLE` :py:obj:`~.CUDA_ERROR_EXTERNAL_DEVICE` See Also -------- :py:obj:`~.cuStreamCreate`, :py:obj:`~.cuStreamWaitEvent`, :py:obj:`~.cuStreamQuery`, :py:obj:`~.cuStreamSynchronize`, :py:obj:`~.cuStreamAddCallback`, :py:obj:`~.cudaStreamDestroy` """ - cdef ccuda.CUstream chStream + cdef cydriver.CUstream cyhStream if hStream is None: - chStream = 0 + phStream = 0 elif isinstance(hStream, (CUstream,)): phStream = int(hStream) - chStream = phStream else: phStream = int(CUstream(hStream)) - chStream = phStream - err = ccuda.cuStreamDestroy(chStream) - return (CUresult(err),) -{{endif}} - -{{if 'cuStreamCopyAttributes' in found_functions}} + cyhStream = phStream + with nogil: + err = cydriver.cuStreamDestroy(cyhStream) + return (_CUresult(err),) @cython.embedsignature(True) def cuStreamCopyAttributes(dst, src): @@ -31391,29 +40805,25 @@ def cuStreamCopyAttributes(dst, src): -------- :py:obj:`~.CUaccessPolicyWindow` """ - cdef ccuda.CUstream csrc + cdef cydriver.CUstream cysrc if src is None: - csrc = 0 + psrc = 0 elif isinstance(src, (CUstream,)): psrc = int(src) - csrc = psrc else: psrc = int(CUstream(src)) - csrc = psrc - cdef ccuda.CUstream cdst + cysrc = psrc + cdef cydriver.CUstream cydst if dst is None: - cdst = 0 + pdst = 0 elif isinstance(dst, (CUstream,)): pdst = int(dst) - cdst = pdst else: pdst = int(CUstream(dst)) - cdst = pdst - err = ccuda.cuStreamCopyAttributes(cdst, csrc) - return (CUresult(err),) -{{endif}} - -{{if 'cuStreamGetAttribute' in found_functions}} + cydst = pdst + with nogil: + err = cydriver.cuStreamCopyAttributes(cydst, cysrc) + return (_CUresult(err),) @cython.embedsignature(True) def cuStreamGetAttribute(hStream, attr not None : CUstreamAttrID): @@ -31428,34 +40838,31 @@ def cuStreamGetAttribute(hStream, attr not None : CUstreamAttrID): attr : :py:obj:`~.CUstreamAttrID` - Returns ------- CUresult :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_INVALID_HANDLE` value_out : :py:obj:`~.CUstreamAttrValue` - See Also -------- :py:obj:`~.CUaccessPolicyWindow` """ - cdef ccuda.CUstream chStream + cdef cydriver.CUstream cyhStream if hStream is None: - chStream = 0 + phStream = 0 elif isinstance(hStream, (CUstream,)): phStream = int(hStream) - chStream = phStream else: phStream = int(CUstream(hStream)) - chStream = phStream - cdef ccuda.CUstreamAttrID cattr = attr.value + cyhStream = phStream + cdef cydriver.CUstreamAttrID cyattr = int(attr) cdef CUstreamAttrValue value_out = CUstreamAttrValue() - err = ccuda.cuStreamGetAttribute(chStream, cattr, value_out._ptr) - return (CUresult(err), value_out) -{{endif}} - -{{if 'cuStreamSetAttribute' in found_functions}} + with nogil: + err = cydriver.cuStreamGetAttribute(cyhStream, cyattr, value_out._pvt_ptr) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, value_out) @cython.embedsignature(True) def cuStreamSetAttribute(hStream, attr not None : CUstreamAttrID, value : Optional[CUstreamAttrValue]): @@ -31473,7 +40880,6 @@ def cuStreamSetAttribute(hStream, attr not None : CUstreamAttrID, value : Option value : :py:obj:`~.CUstreamAttrValue` - Returns ------- CUresult @@ -31483,22 +40889,19 @@ def cuStreamSetAttribute(hStream, attr not None : CUstreamAttrID, value : Option -------- :py:obj:`~.CUaccessPolicyWindow` """ - cdef ccuda.CUstream chStream + cdef cydriver.CUstream cyhStream if hStream is None: - chStream = 0 + phStream = 0 elif isinstance(hStream, (CUstream,)): phStream = int(hStream) - chStream = phStream else: phStream = int(CUstream(hStream)) - chStream = phStream - cdef ccuda.CUstreamAttrID cattr = attr.value - cdef ccuda.CUstreamAttrValue* cvalue_ptr = value._ptr if value != None else NULL - err = ccuda.cuStreamSetAttribute(chStream, cattr, cvalue_ptr) - return (CUresult(err),) -{{endif}} - -{{if 'cuEventCreate' in found_functions}} + cyhStream = phStream + cdef cydriver.CUstreamAttrID cyattr = int(attr) + cdef cydriver.CUstreamAttrValue* cyvalue_ptr = value._pvt_ptr if value is not None else NULL + with nogil: + err = cydriver.cuStreamSetAttribute(cyhStream, cyattr, cyvalue_ptr) + return (_CUresult(err),) @cython.embedsignature(True) def cuEventCreate(unsigned int Flags): @@ -31542,11 +40945,11 @@ def cuEventCreate(unsigned int Flags): :py:obj:`~.cuEventRecord`, :py:obj:`~.cuEventQuery`, :py:obj:`~.cuEventSynchronize`, :py:obj:`~.cuEventDestroy`, :py:obj:`~.cuEventElapsedTime`, :py:obj:`~.cudaEventCreate`, :py:obj:`~.cudaEventCreateWithFlags` """ cdef CUevent phEvent = CUevent() - err = ccuda.cuEventCreate(phEvent._ptr, Flags) - return (CUresult(err), phEvent) -{{endif}} - -{{if 'cuEventRecord' in found_functions}} + with nogil: + err = cydriver.cuEventCreate(phEvent._pvt_ptr, Flags) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, phEvent) @cython.embedsignature(True) def cuEventRecord(hEvent, hStream): @@ -31585,29 +40988,25 @@ def cuEventRecord(hEvent, hStream): -------- :py:obj:`~.cuEventCreate`, :py:obj:`~.cuEventQuery`, :py:obj:`~.cuEventSynchronize`, :py:obj:`~.cuStreamWaitEvent`, :py:obj:`~.cuEventDestroy`, :py:obj:`~.cuEventElapsedTime`, :py:obj:`~.cudaEventRecord`, :py:obj:`~.cuEventRecordWithFlags` """ - cdef ccuda.CUstream chStream + cdef cydriver.CUstream cyhStream if hStream is None: - chStream = 0 + phStream = 0 elif isinstance(hStream, (CUstream,)): phStream = int(hStream) - chStream = phStream else: phStream = int(CUstream(hStream)) - chStream = phStream - cdef ccuda.CUevent chEvent + cyhStream = phStream + cdef cydriver.CUevent cyhEvent if hEvent is None: - chEvent = 0 + phEvent = 0 elif isinstance(hEvent, (CUevent,)): phEvent = int(hEvent) - chEvent = phEvent else: phEvent = int(CUevent(hEvent)) - chEvent = phEvent - err = ccuda.cuEventRecord(chEvent, chStream) - return (CUresult(err),) -{{endif}} - -{{if 'cuEventRecordWithFlags' in found_functions}} + cyhEvent = phEvent + with nogil: + err = cydriver.cuEventRecord(cyhEvent, cyhStream) + return (_CUresult(err),) @cython.embedsignature(True) def cuEventRecordWithFlags(hEvent, hStream, unsigned int flags): @@ -31656,29 +41055,25 @@ def cuEventRecordWithFlags(hEvent, hStream, unsigned int flags): -------- :py:obj:`~.cuEventCreate`, :py:obj:`~.cuEventQuery`, :py:obj:`~.cuEventSynchronize`, :py:obj:`~.cuStreamWaitEvent`, :py:obj:`~.cuEventDestroy`, :py:obj:`~.cuEventElapsedTime`, :py:obj:`~.cuEventRecord`, :py:obj:`~.cudaEventRecord` """ - cdef ccuda.CUstream chStream + cdef cydriver.CUstream cyhStream if hStream is None: - chStream = 0 + phStream = 0 elif isinstance(hStream, (CUstream,)): phStream = int(hStream) - chStream = phStream else: phStream = int(CUstream(hStream)) - chStream = phStream - cdef ccuda.CUevent chEvent + cyhStream = phStream + cdef cydriver.CUevent cyhEvent if hEvent is None: - chEvent = 0 + phEvent = 0 elif isinstance(hEvent, (CUevent,)): phEvent = int(hEvent) - chEvent = phEvent else: phEvent = int(CUevent(hEvent)) - chEvent = phEvent - err = ccuda.cuEventRecordWithFlags(chEvent, chStream, flags) - return (CUresult(err),) -{{endif}} - -{{if 'cuEventQuery' in found_functions}} + cyhEvent = phEvent + with nogil: + err = cydriver.cuEventRecordWithFlags(cyhEvent, cyhStream, flags) + return (_CUresult(err),) @cython.embedsignature(True) def cuEventQuery(hEvent): @@ -31710,20 +41105,17 @@ def cuEventQuery(hEvent): -------- :py:obj:`~.cuEventCreate`, :py:obj:`~.cuEventRecord`, :py:obj:`~.cuEventSynchronize`, :py:obj:`~.cuEventDestroy`, :py:obj:`~.cuEventElapsedTime`, :py:obj:`~.cudaEventQuery` """ - cdef ccuda.CUevent chEvent + cdef cydriver.CUevent cyhEvent if hEvent is None: - chEvent = 0 + phEvent = 0 elif isinstance(hEvent, (CUevent,)): phEvent = int(hEvent) - chEvent = phEvent else: phEvent = int(CUevent(hEvent)) - chEvent = phEvent - err = ccuda.cuEventQuery(chEvent) - return (CUresult(err),) -{{endif}} - -{{if 'cuEventSynchronize' in found_functions}} + cyhEvent = phEvent + with nogil: + err = cydriver.cuEventQuery(cyhEvent) + return (_CUresult(err),) @cython.embedsignature(True) def cuEventSynchronize(hEvent): @@ -31754,20 +41146,17 @@ def cuEventSynchronize(hEvent): -------- :py:obj:`~.cuEventCreate`, :py:obj:`~.cuEventRecord`, :py:obj:`~.cuEventQuery`, :py:obj:`~.cuEventDestroy`, :py:obj:`~.cuEventElapsedTime`, :py:obj:`~.cudaEventSynchronize` """ - cdef ccuda.CUevent chEvent + cdef cydriver.CUevent cyhEvent if hEvent is None: - chEvent = 0 + phEvent = 0 elif isinstance(hEvent, (CUevent,)): phEvent = int(hEvent) - chEvent = phEvent else: phEvent = int(CUevent(hEvent)) - chEvent = phEvent - err = ccuda.cuEventSynchronize(chEvent) - return (CUresult(err),) -{{endif}} - -{{if 'cuEventDestroy_v2' in found_functions}} + cyhEvent = phEvent + with nogil: + err = cydriver.cuEventSynchronize(cyhEvent) + return (_CUresult(err),) @cython.embedsignature(True) def cuEventDestroy(hEvent): @@ -31795,27 +41184,28 @@ def cuEventDestroy(hEvent): -------- :py:obj:`~.cuEventCreate`, :py:obj:`~.cuEventRecord`, :py:obj:`~.cuEventQuery`, :py:obj:`~.cuEventSynchronize`, :py:obj:`~.cuEventElapsedTime`, :py:obj:`~.cudaEventDestroy` """ - cdef ccuda.CUevent chEvent + cdef cydriver.CUevent cyhEvent if hEvent is None: - chEvent = 0 + phEvent = 0 elif isinstance(hEvent, (CUevent,)): phEvent = int(hEvent) - chEvent = phEvent else: phEvent = int(CUevent(hEvent)) - chEvent = phEvent - err = ccuda.cuEventDestroy(chEvent) - return (CUresult(err),) -{{endif}} - -{{if 'cuEventElapsedTime' in found_functions}} + cyhEvent = phEvent + with nogil: + err = cydriver.cuEventDestroy(cyhEvent) + return (_CUresult(err),) @cython.embedsignature(True) def cuEventElapsedTime(hStart, hEnd): """ Computes the elapsed time between two events. Computes the elapsed time between two events (in milliseconds with a - resolution of around 0.5 microseconds). + resolution of around 0.5 microseconds). Note this API is not guaranteed + to return the latest errors for pending work. As such this API is + intended to serve as an elapsed time calculation only and any polling + for completion on the events to be compared should be done with + :py:obj:`~.cuEventQuery` instead. If either event was last recorded in a non-NULL stream, the resulting time may be greater than expected (even if both used the same stream @@ -31853,30 +41243,28 @@ def cuEventElapsedTime(hStart, hEnd): -------- :py:obj:`~.cuEventCreate`, :py:obj:`~.cuEventRecord`, :py:obj:`~.cuEventQuery`, :py:obj:`~.cuEventSynchronize`, :py:obj:`~.cuEventDestroy`, :py:obj:`~.cudaEventElapsedTime` """ - cdef ccuda.CUevent chEnd + cdef cydriver.CUevent cyhEnd if hEnd is None: - chEnd = 0 + phEnd = 0 elif isinstance(hEnd, (CUevent,)): phEnd = int(hEnd) - chEnd = phEnd else: phEnd = int(CUevent(hEnd)) - chEnd = phEnd - cdef ccuda.CUevent chStart + cyhEnd = phEnd + cdef cydriver.CUevent cyhStart if hStart is None: - chStart = 0 + phStart = 0 elif isinstance(hStart, (CUevent,)): phStart = int(hStart) - chStart = phStart else: phStart = int(CUevent(hStart)) - chStart = phStart + cyhStart = phStart cdef float pMilliseconds = 0 - err = ccuda.cuEventElapsedTime(&pMilliseconds, chStart, chEnd) - return (CUresult(err), pMilliseconds) -{{endif}} - -{{if 'cuImportExternalMemory' in found_functions}} + with nogil: + err = cydriver.cuEventElapsedTime(&pMilliseconds, cyhStart, cyhEnd) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pMilliseconds) @cython.embedsignature(True) def cuImportExternalMemory(memHandleDesc : Optional[CUDA_EXTERNAL_MEMORY_HANDLE_DESC]): @@ -31899,89 +41287,84 @@ def cuImportExternalMemory(memHandleDesc : Optional[CUDA_EXTERNAL_MEMORY_HANDLE_ If :py:obj:`~.CUDA_EXTERNAL_MEMORY_HANDLE_DESC.type` is :py:obj:`~.CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD`, then - :py:obj:`~.CUDA_EXTERNAL_MEMORY_HANDLE_DESC`::handle::fd must be a - valid file descriptor referencing a memory object. Ownership of the - file descriptor is transferred to the CUDA driver when the handle is + :py:obj:`~.CUDA_EXTERNAL_MEMORY_HANDLE_DESC.handle.fd` must be a valid + file descriptor referencing a memory object. Ownership of the file + descriptor is transferred to the CUDA driver when the handle is imported successfully. Performing any operations on the file descriptor after it is imported results in undefined behavior. If :py:obj:`~.CUDA_EXTERNAL_MEMORY_HANDLE_DESC.type` is :py:obj:`~.CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32`, then exactly - one of - :py:obj:`~.CUDA_EXTERNAL_MEMORY_HANDLE_DESC`::handle::win32::handle and - :py:obj:`~.CUDA_EXTERNAL_MEMORY_HANDLE_DESC`::handle::win32::name must + one of :py:obj:`~.CUDA_EXTERNAL_MEMORY_HANDLE_DESC.handle.win32.handle` + and :py:obj:`~.CUDA_EXTERNAL_MEMORY_HANDLE_DESC.handle.win32.name` must not be NULL. If - :py:obj:`~.CUDA_EXTERNAL_MEMORY_HANDLE_DESC`::handle::win32::handle is - not NULL, then it must represent a valid shared NT handle that - references a memory object. Ownership of this handle is not transferred - to CUDA after the import operation, so the application must release the - handle using the appropriate system call. If - :py:obj:`~.CUDA_EXTERNAL_MEMORY_HANDLE_DESC`::handle::win32::name is - not NULL, then it must point to a NULL-terminated array of UTF-16 + :py:obj:`~.CUDA_EXTERNAL_MEMORY_HANDLE_DESC.handle.win32.handle` is not + NULL, then it must represent a valid shared NT handle that references a + memory object. Ownership of this handle is not transferred to CUDA + after the import operation, so the application must release the handle + using the appropriate system call. If + :py:obj:`~.CUDA_EXTERNAL_MEMORY_HANDLE_DESC.handle.win32.name` is not + NULL, then it must point to a NULL-terminated array of UTF-16 characters that refers to a memory object. If :py:obj:`~.CUDA_EXTERNAL_MEMORY_HANDLE_DESC.type` is :py:obj:`~.CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT`, then - :py:obj:`~.CUDA_EXTERNAL_MEMORY_HANDLE_DESC`::handle::win32::handle - must be non-NULL and - :py:obj:`~.CUDA_EXTERNAL_MEMORY_HANDLE_DESC`::handle::win32::name must - be NULL. The handle specified must be a globally shared KMT handle. - This handle does not hold a reference to the underlying object, and - thus will be invalid when all references to the memory object are - destroyed. + :py:obj:`~.CUDA_EXTERNAL_MEMORY_HANDLE_DESC.handle.win32.handle` must + be non-NULL and + :py:obj:`~.CUDA_EXTERNAL_MEMORY_HANDLE_DESC.handle.win32.name` must be + NULL. The handle specified must be a globally shared KMT handle. This + handle does not hold a reference to the underlying object, and thus + will be invalid when all references to the memory object are destroyed. If :py:obj:`~.CUDA_EXTERNAL_MEMORY_HANDLE_DESC.type` is :py:obj:`~.CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP`, then exactly one - of :py:obj:`~.CUDA_EXTERNAL_MEMORY_HANDLE_DESC`::handle::win32::handle - and :py:obj:`~.CUDA_EXTERNAL_MEMORY_HANDLE_DESC`::handle::win32::name - must not be NULL. If - :py:obj:`~.CUDA_EXTERNAL_MEMORY_HANDLE_DESC`::handle::win32::handle is - not NULL, then it must represent a valid shared NT handle that is - returned by ID3D12Device::CreateSharedHandle when referring to a - ID3D12Heap object. This handle holds a reference to the underlying - object. If - :py:obj:`~.CUDA_EXTERNAL_MEMORY_HANDLE_DESC`::handle::win32::name is - not NULL, then it must point to a NULL-terminated array of UTF-16 + of :py:obj:`~.CUDA_EXTERNAL_MEMORY_HANDLE_DESC.handle.win32.handle` and + :py:obj:`~.CUDA_EXTERNAL_MEMORY_HANDLE_DESC.handle.win32.name` must not + be NULL. If + :py:obj:`~.CUDA_EXTERNAL_MEMORY_HANDLE_DESC.handle.win32.handle` is not + NULL, then it must represent a valid shared NT handle that is returned + by ID3D12Device::CreateSharedHandle when referring to a ID3D12Heap + object. This handle holds a reference to the underlying object. If + :py:obj:`~.CUDA_EXTERNAL_MEMORY_HANDLE_DESC.handle.win32.name` is not + NULL, then it must point to a NULL-terminated array of UTF-16 characters that refers to a ID3D12Heap object. If :py:obj:`~.CUDA_EXTERNAL_MEMORY_HANDLE_DESC.type` is :py:obj:`~.CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE`, then exactly - one of - :py:obj:`~.CUDA_EXTERNAL_MEMORY_HANDLE_DESC`::handle::win32::handle and - :py:obj:`~.CUDA_EXTERNAL_MEMORY_HANDLE_DESC`::handle::win32::name must + one of :py:obj:`~.CUDA_EXTERNAL_MEMORY_HANDLE_DESC.handle.win32.handle` + and :py:obj:`~.CUDA_EXTERNAL_MEMORY_HANDLE_DESC.handle.win32.name` must not be NULL. If - :py:obj:`~.CUDA_EXTERNAL_MEMORY_HANDLE_DESC`::handle::win32::handle is - not NULL, then it must represent a valid shared NT handle that is - returned by ID3D12Device::CreateSharedHandle when referring to a - ID3D12Resource object. This handle holds a reference to the underlying - object. If - :py:obj:`~.CUDA_EXTERNAL_MEMORY_HANDLE_DESC`::handle::win32::name is - not NULL, then it must point to a NULL-terminated array of UTF-16 + :py:obj:`~.CUDA_EXTERNAL_MEMORY_HANDLE_DESC.handle.win32.handle` is not + NULL, then it must represent a valid shared NT handle that is returned + by ID3D12Device::CreateSharedHandle when referring to a ID3D12Resource + object. This handle holds a reference to the underlying object. If + :py:obj:`~.CUDA_EXTERNAL_MEMORY_HANDLE_DESC.handle.win32.name` is not + NULL, then it must point to a NULL-terminated array of UTF-16 characters that refers to a ID3D12Resource object. If :py:obj:`~.CUDA_EXTERNAL_MEMORY_HANDLE_DESC.type` is :py:obj:`~.CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE`, then - :py:obj:`~.CUDA_EXTERNAL_MEMORY_HANDLE_DESC`::handle::win32::handle - must represent a valid shared NT handle that is returned by + :py:obj:`~.CUDA_EXTERNAL_MEMORY_HANDLE_DESC.handle.win32.handle` must + represent a valid shared NT handle that is returned by IDXGIResource1::CreateSharedHandle when referring to a ID3D11Resource object. If - :py:obj:`~.CUDA_EXTERNAL_MEMORY_HANDLE_DESC`::handle::win32::name is - not NULL, then it must point to a NULL-terminated array of UTF-16 + :py:obj:`~.CUDA_EXTERNAL_MEMORY_HANDLE_DESC.handle.win32.name` is not + NULL, then it must point to a NULL-terminated array of UTF-16 characters that refers to a ID3D11Resource object. If :py:obj:`~.CUDA_EXTERNAL_MEMORY_HANDLE_DESC.type` is :py:obj:`~.CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE_KMT`, then - :py:obj:`~.CUDA_EXTERNAL_MEMORY_HANDLE_DESC`::handle::win32::handle - must represent a valid shared KMT handle that is returned by + :py:obj:`~.CUDA_EXTERNAL_MEMORY_HANDLE_DESC.handle.win32.handle` must + represent a valid shared KMT handle that is returned by IDXGIResource::GetSharedHandle when referring to a ID3D11Resource object and - :py:obj:`~.CUDA_EXTERNAL_MEMORY_HANDLE_DESC`::handle::win32::name must - be NULL. + :py:obj:`~.CUDA_EXTERNAL_MEMORY_HANDLE_DESC.handle.win32.name` must be + NULL. If :py:obj:`~.CUDA_EXTERNAL_MEMORY_HANDLE_DESC.type` is :py:obj:`~.CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF`, then - :py:obj:`~.CUDA_EXTERNAL_MEMORY_HANDLE_DESC`::handle::nvSciBufObject - must be non-NULL and reference a valid NvSciBuf object. If the NvSciBuf + :py:obj:`~.CUDA_EXTERNAL_MEMORY_HANDLE_DESC.handle.nvSciBufObject` must + be non-NULL and reference a valid NvSciBuf object. If the NvSciBuf object imported into CUDA is also mapped by other drivers, then the application must use :py:obj:`~.cuWaitExternalSemaphoresAsync` or :py:obj:`~.cuSignalExternalSemaphoresAsync` as appropriate barriers to @@ -31990,6 +41373,16 @@ def cuImportExternalMemory(memHandleDesc : Optional[CUDA_EXTERNAL_MEMORY_HANDLE_ :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_WAIT_SKIP_NVSCIBUF_MEMSYNC` for memory synchronization. + If :py:obj:`~.CUDA_EXTERNAL_MEMORY_HANDLE_DESC.type` is + :py:obj:`~.CU_EXTERNAL_MEMORY_HANDLE_TYPE_DMABUF_FD`, then + :py:obj:`~.CUDA_EXTERNAL_MEMORY_HANDLE_DESC.handle.fd` must be a valid + file descriptor referencing a dma_buf object and + :py:obj:`~.CUDA_EXTERNAL_MEMORY_HANDLE_DESC.flags` must be zero. + Importing a dma_buf object is supported only on Tegra Jetson platform + starting with Thor series. Mapping an imported dma_buf object as CUDA + mipmapped array using + :py:obj:`~.cuExternalMemoryGetMappedMipmappedArray` is not supported. + The size of the memory object must be specified in :py:obj:`~.CUDA_EXTERNAL_MEMORY_HANDLE_DESC.size`. @@ -32024,12 +41417,12 @@ def cuImportExternalMemory(memHandleDesc : Optional[CUDA_EXTERNAL_MEMORY_HANDLE_ and Cache Control" chapter from Vulkan specification. """ cdef CUexternalMemory extMem_out = CUexternalMemory() - cdef ccuda.CUDA_EXTERNAL_MEMORY_HANDLE_DESC* cmemHandleDesc_ptr = memHandleDesc._ptr if memHandleDesc != None else NULL - err = ccuda.cuImportExternalMemory(extMem_out._ptr, cmemHandleDesc_ptr) - return (CUresult(err), extMem_out) -{{endif}} - -{{if 'cuExternalMemoryGetMappedBuffer' in found_functions}} + cdef cydriver.CUDA_EXTERNAL_MEMORY_HANDLE_DESC* cymemHandleDesc_ptr = memHandleDesc._pvt_ptr if memHandleDesc is not None else NULL + with nogil: + err = cydriver.cuImportExternalMemory(extMem_out._pvt_ptr, cymemHandleDesc_ptr) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, extMem_out) @cython.embedsignature(True) def cuExternalMemoryGetMappedBuffer(extMem, bufferDesc : Optional[CUDA_EXTERNAL_MEMORY_BUFFER_DESC]): @@ -32082,22 +41475,21 @@ def cuExternalMemoryGetMappedBuffer(extMem, bufferDesc : Optional[CUDA_EXTERNAL_ -------- :py:obj:`~.cuImportExternalMemory`, :py:obj:`~.cuDestroyExternalMemory`, :py:obj:`~.cuExternalMemoryGetMappedMipmappedArray` """ - cdef ccuda.CUexternalMemory cextMem + cdef cydriver.CUexternalMemory cyextMem if extMem is None: - cextMem = 0 + pextMem = 0 elif isinstance(extMem, (CUexternalMemory,)): pextMem = int(extMem) - cextMem = pextMem else: pextMem = int(CUexternalMemory(extMem)) - cextMem = pextMem + cyextMem = pextMem cdef CUdeviceptr devPtr = CUdeviceptr() - cdef ccuda.CUDA_EXTERNAL_MEMORY_BUFFER_DESC* cbufferDesc_ptr = bufferDesc._ptr if bufferDesc != None else NULL - err = ccuda.cuExternalMemoryGetMappedBuffer(devPtr._ptr, cextMem, cbufferDesc_ptr) - return (CUresult(err), devPtr) -{{endif}} - -{{if 'cuExternalMemoryGetMappedMipmappedArray' in found_functions}} + cdef cydriver.CUDA_EXTERNAL_MEMORY_BUFFER_DESC* cybufferDesc_ptr = bufferDesc._pvt_ptr if bufferDesc is not None else NULL + with nogil: + err = cydriver.cuExternalMemoryGetMappedBuffer(devPtr._pvt_ptr, cyextMem, cybufferDesc_ptr) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, devPtr) @cython.embedsignature(True) def cuExternalMemoryGetMappedMipmappedArray(extMem, mipmapDesc : Optional[CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC]): @@ -32123,7 +41515,7 @@ def cuExternalMemoryGetMappedMipmappedArray(extMem, mipmapDesc : Optional[CUDA_E the mipmapped array is bound as a color target in the graphics API, then the flag :py:obj:`~.CUDA_ARRAY3D_COLOR_ATTACHMENT` must be specified in - :py:obj:`~.CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC`::arrayDesc::Flags. + :py:obj:`~.CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC.arrayDesc.Flags`. :py:obj:`~.CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC.numLevels` specifies the total number of levels in the mipmap chain. @@ -32132,6 +41524,9 @@ def cuExternalMemoryGetMappedMipmappedArray(extMem, mipmapDesc : Optional[CUDA_E :py:obj:`~.CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC.numLevels` must be equal to 1. + Mapping `extMem` imported from a handle of type + :py:obj:`~.CU_EXTERNAL_MEMORY_HANDLE_TYPE_DMABUF_FD`, is not supported. + The returned CUDA mipmapped array must be freed using :py:obj:`~.cuMipmappedArrayDestroy`. @@ -32153,22 +41548,21 @@ def cuExternalMemoryGetMappedMipmappedArray(extMem, mipmapDesc : Optional[CUDA_E -------- :py:obj:`~.cuImportExternalMemory`, :py:obj:`~.cuDestroyExternalMemory`, :py:obj:`~.cuExternalMemoryGetMappedBuffer` """ - cdef ccuda.CUexternalMemory cextMem + cdef cydriver.CUexternalMemory cyextMem if extMem is None: - cextMem = 0 + pextMem = 0 elif isinstance(extMem, (CUexternalMemory,)): pextMem = int(extMem) - cextMem = pextMem else: pextMem = int(CUexternalMemory(extMem)) - cextMem = pextMem + cyextMem = pextMem cdef CUmipmappedArray mipmap = CUmipmappedArray() - cdef ccuda.CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC* cmipmapDesc_ptr = mipmapDesc._ptr if mipmapDesc != None else NULL - err = ccuda.cuExternalMemoryGetMappedMipmappedArray(mipmap._ptr, cextMem, cmipmapDesc_ptr) - return (CUresult(err), mipmap) -{{endif}} - -{{if 'cuDestroyExternalMemory' in found_functions}} + cdef cydriver.CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC* cymipmapDesc_ptr = mipmapDesc._pvt_ptr if mipmapDesc is not None else NULL + with nogil: + err = cydriver.cuExternalMemoryGetMappedMipmappedArray(mipmap._pvt_ptr, cyextMem, cymipmapDesc_ptr) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, mipmap) @cython.embedsignature(True) def cuDestroyExternalMemory(extMem): @@ -32193,20 +41587,17 @@ def cuDestroyExternalMemory(extMem): -------- :py:obj:`~.cuImportExternalMemory`, :py:obj:`~.cuExternalMemoryGetMappedBuffer`, :py:obj:`~.cuExternalMemoryGetMappedMipmappedArray` """ - cdef ccuda.CUexternalMemory cextMem + cdef cydriver.CUexternalMemory cyextMem if extMem is None: - cextMem = 0 + pextMem = 0 elif isinstance(extMem, (CUexternalMemory,)): pextMem = int(extMem) - cextMem = pextMem else: pextMem = int(CUexternalMemory(extMem)) - cextMem = pextMem - err = ccuda.cuDestroyExternalMemory(cextMem) - return (CUresult(err),) -{{endif}} - -{{if 'cuImportExternalSemaphore' in found_functions}} + cyextMem = pextMem + with nogil: + err = cydriver.cuDestroyExternalMemory(cyextMem) + return (_CUresult(err),) @cython.embedsignature(True) def cuImportExternalSemaphore(semHandleDesc : Optional[CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC]): @@ -32229,7 +41620,7 @@ def cuImportExternalSemaphore(semHandleDesc : Optional[CUDA_EXTERNAL_SEMAPHORE_H If :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.type` is :py:obj:`~.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD`, then - :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC`::handle::fd must be a + :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.handle.fd` must be a valid file descriptor referencing a synchronization object. Ownership of the file descriptor is transferred to the CUDA driver when the handle is imported successfully. Performing any operations on the file @@ -32238,98 +41629,95 @@ def cuImportExternalSemaphore(semHandleDesc : Optional[CUDA_EXTERNAL_SEMAPHORE_H If :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.type` is :py:obj:`~.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32`, then exactly one of - :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC`::handle::win32::handle - and - :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC`::handle::win32::name - must not be NULL. If - :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC`::handle::win32::handle - is not NULL, then it must represent a valid shared NT handle that + :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.handle.win32.handle` and + :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.handle.win32.name` must + not be NULL. If + :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.handle.win32.handle` is + not NULL, then it must represent a valid shared NT handle that references a synchronization object. Ownership of this handle is not transferred to CUDA after the import operation, so the application must release the handle using the appropriate system call. If - :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC`::handle::win32::name is + :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.handle.win32.name` is not NULL, then it must name a valid synchronization object. If :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.type` is :py:obj:`~.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT`, then - :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC`::handle::win32::handle + :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.handle.win32.handle` must be non-NULL and - :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC`::handle::win32::name - must be NULL. The handle specified must be a globally shared KMT - handle. This handle does not hold a reference to the underlying object, - and thus will be invalid when all references to the synchronization - object are destroyed. + :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.handle.win32.name` must + be NULL. The handle specified must be a globally shared KMT handle. + This handle does not hold a reference to the underlying object, and + thus will be invalid when all references to the synchronization object + are destroyed. If :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.type` is :py:obj:`~.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE`, then exactly one of - :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC`::handle::win32::handle - and - :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC`::handle::win32::name - must not be NULL. If - :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC`::handle::win32::handle - is not NULL, then it must represent a valid shared NT handle that is + :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.handle.win32.handle` and + :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.handle.win32.name` must + not be NULL. If + :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.handle.win32.handle` is + not NULL, then it must represent a valid shared NT handle that is returned by ID3D12Device::CreateSharedHandle when referring to a ID3D12Fence object. This handle holds a reference to the underlying object. If - :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC`::handle::win32::name is + :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.handle.win32.name` is not NULL, then it must name a valid synchronization object that refers to a valid ID3D12Fence object. If :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.type` is :py:obj:`~.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_FENCE`, then - :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC`::handle::win32::handle + :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.handle.win32.handle` represents a valid shared NT handle that is returned by ID3D11Fence::CreateSharedHandle. If - :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC`::handle::win32::name is + :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.handle.win32.name` is not NULL, then it must name a valid synchronization object that refers to a valid ID3D11Fence object. If :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.type` is :py:obj:`~.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC`, then - :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC`::handle::nvSciSyncObj + :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.handle.nvSciSyncObj` represents a valid NvSciSyncObj. :py:obj:`~.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX`, then - :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC`::handle::win32::handle + :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.handle.win32.handle` represents a valid shared NT handle that is returned by IDXGIResource1::CreateSharedHandle when referring to a IDXGIKeyedMutex object. If - :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC`::handle::win32::name is + :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.handle.win32.name` is not NULL, then it must name a valid synchronization object that refers to a valid IDXGIKeyedMutex object. If :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.type` is :py:obj:`~.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX_KMT`, then - :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC`::handle::win32::handle + :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.handle.win32.handle` represents a valid shared KMT handle that is returned by IDXGIResource::GetSharedHandle when referring to a IDXGIKeyedMutex object and - :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC`::handle::win32::name - must be NULL. + :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.handle.win32.name` must + be NULL. If :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.type` is :py:obj:`~.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_FD`, - then :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC`::handle::fd must - be a valid file descriptor referencing a synchronization object. - Ownership of the file descriptor is transferred to the CUDA driver when - the handle is imported successfully. Performing any operations on the - file descriptor after it is imported results in undefined behavior. + then :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.handle.fd` must be + a valid file descriptor referencing a synchronization object. Ownership + of the file descriptor is transferred to the CUDA driver when the + handle is imported successfully. Performing any operations on the file + descriptor after it is imported results in undefined behavior. If :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.type` is :py:obj:`~.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_WIN32`, then exactly one of - :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC`::handle::win32::handle - and - :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC`::handle::win32::name - must not be NULL. If - :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC`::handle::win32::handle - is not NULL, then it must represent a valid shared NT handle that + :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.handle.win32.handle` and + :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.handle.win32.name` must + not be NULL. If + :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.handle.win32.handle` is + not NULL, then it must represent a valid shared NT handle that references a synchronization object. Ownership of this handle is not transferred to CUDA after the import operation, so the application must release the handle using the appropriate system call. If - :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC`::handle::win32::name is + :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC.handle.win32.name` is not NULL, then it must name a valid synchronization object. Parameters @@ -32349,15 +41737,15 @@ def cuImportExternalSemaphore(semHandleDesc : Optional[CUDA_EXTERNAL_SEMAPHORE_H :py:obj:`~.cuDestroyExternalSemaphore`, :py:obj:`~.cuSignalExternalSemaphoresAsync`, :py:obj:`~.cuWaitExternalSemaphoresAsync` """ cdef CUexternalSemaphore extSem_out = CUexternalSemaphore() - cdef ccuda.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC* csemHandleDesc_ptr = semHandleDesc._ptr if semHandleDesc != None else NULL - err = ccuda.cuImportExternalSemaphore(extSem_out._ptr, csemHandleDesc_ptr) - return (CUresult(err), extSem_out) -{{endif}} - -{{if 'cuSignalExternalSemaphoresAsync' in found_functions}} + cdef cydriver.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC* cysemHandleDesc_ptr = semHandleDesc._pvt_ptr if semHandleDesc is not None else NULL + with nogil: + err = cydriver.cuImportExternalSemaphore(extSem_out._pvt_ptr, cysemHandleDesc_ptr) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, extSem_out) @cython.embedsignature(True) -def cuSignalExternalSemaphoresAsync(extSemArray : Optional[List[CUexternalSemaphore]], paramsArray : Optional[List[CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS]], unsigned int numExtSems, stream): +def cuSignalExternalSemaphoresAsync(extSemArray : Optional[tuple[CUexternalSemaphore] | list[CUexternalSemaphore]], paramsArray : Optional[tuple[CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS] | list[CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS]], unsigned int numExtSems, stream): """ Signals a set of external semaphore objects. Enqueues a signal operation on a set of externally allocated semaphore @@ -32379,15 +41767,15 @@ def cuSignalExternalSemaphoresAsync(extSemArray : Optional[List[CUexternalSemaph :py:obj:`~.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_FD`, :py:obj:`~.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_WIN32` then the semaphore will be set to the value specified in - :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS`::params::fence::value. + :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS.params.fence.value`. If the semaphore object is of the type :py:obj:`~.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC` this API sets - :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS`::params::nvSciSync::fence + :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS.params.nvSciSync.fence` to a value that can be used by subsequent waiters of the same NvSciSync object to order operations with those currently submitted in `stream`. Such an update will overwrite previous contents of - :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS`::params::nvSciSync::fence. + :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS.params.nvSciSync.fence`. By default, signaling such an external semaphore object causes appropriate memory synchronization operations to be performed over all external memory objects that are imported as @@ -32421,19 +41809,33 @@ def cuSignalExternalSemaphoresAsync(extSemArray : Optional[List[CUexternalSemaph handle such situations, either by not using the same semaphore object with deterministic fence support enabled in different streams or by adding explicit dependency amongst such streams so that the semaphore - is signaled in order. + is signaled in order. NvSciSyncFence associated with semaphore object + of the type :py:obj:`~.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC` can + be timestamp enabled. For this the NvSciSyncAttrList used to create the + object must have the value of NvSciSyncAttrKey_WaiterRequireTimestamps + key set to true. Timestamps are emitted asynchronously by the GPU and + CUDA saves the GPU timestamp in the corresponding NvSciSyncFence at the + time of signal on GPU. Users are expected to convert GPU clocks to CPU + clocks using appropriate scaling functions. Users are expected to wait + for the completion of the fence before extracting timestamp using + appropriate NvSciSync APIs. Users are expected to ensure that there is + only one outstanding timestamp enabled fence per Cuda-NvSciSync object + at any point of time, failing which leads to undefined behavior. + Extracting the timestamp before the corresponding fence is signalled + could lead to undefined behaviour. Timestamp extracted via appropriate + NvSciSync API would be in microseconds. If the semaphore object is any one of the following types: :py:obj:`~.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX`, :py:obj:`~.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX_KMT` then the keyed mutex will be released with the key specified in - :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_PARAMS`::params::keyedmutex::key. + :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_PARAMS.params.keyedmutex.key`. Parameters ---------- - extSemArray : List[:py:obj:`~.CUexternalSemaphore`] + extSemArray : list[:py:obj:`~.CUexternalSemaphore`] Set of external semaphores to be signaled - paramsArray : List[:py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS`] + paramsArray : list[:py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS`] Array of semaphore parameters numExtSems : unsigned int Number of semaphores to signal @@ -32449,50 +41851,51 @@ def cuSignalExternalSemaphoresAsync(extSemArray : Optional[List[CUexternalSemaph -------- :py:obj:`~.cuImportExternalSemaphore`, :py:obj:`~.cuDestroyExternalSemaphore`, :py:obj:`~.cuWaitExternalSemaphoresAsync` """ - cdef ccuda.CUstream cstream + cdef cydriver.CUstream cystream if stream is None: - cstream = 0 + pstream = 0 elif isinstance(stream, (CUstream,)): pstream = int(stream) - cstream = pstream else: pstream = int(CUstream(stream)) - cstream = pstream + cystream = pstream paramsArray = [] if paramsArray is None else paramsArray if not all(isinstance(_x, (CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS,)) for _x in paramsArray): - raise TypeError("Argument 'paramsArray' is not instance of type (expected List[ccuda.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS,]") + raise TypeError("Argument 'paramsArray' is not instance of type (expected tuple[cydriver.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS,] or list[cydriver.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS,]") extSemArray = [] if extSemArray is None else extSemArray if not all(isinstance(_x, (CUexternalSemaphore,)) for _x in extSemArray): - raise TypeError("Argument 'extSemArray' is not instance of type (expected List[ccuda.CUexternalSemaphore,]") - cdef ccuda.CUexternalSemaphore* cextSemArray = NULL - if len(extSemArray) > 0: - cextSemArray = calloc(len(extSemArray), sizeof(ccuda.CUexternalSemaphore)) - if cextSemArray is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(extSemArray)) + 'x' + str(sizeof(ccuda.CUexternalSemaphore))) + raise TypeError("Argument 'extSemArray' is not instance of type (expected tuple[cydriver.CUexternalSemaphore,] or list[cydriver.CUexternalSemaphore,]") + cdef cydriver.CUexternalSemaphore* cyextSemArray = NULL + if len(extSemArray) > 1: + cyextSemArray = calloc(len(extSemArray), sizeof(cydriver.CUexternalSemaphore)) + if cyextSemArray is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(extSemArray)) + 'x' + str(sizeof(cydriver.CUexternalSemaphore))) else: for idx in range(len(extSemArray)): - cextSemArray[idx] = (extSemArray[idx])._ptr[0] - cdef ccuda.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS* cparamsArray = NULL - if len(paramsArray) > 0: - cparamsArray = calloc(len(paramsArray), sizeof(ccuda.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS)) - if cparamsArray is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(paramsArray)) + 'x' + str(sizeof(ccuda.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS))) + cyextSemArray[idx] = (extSemArray[idx])._pvt_ptr[0] + elif len(extSemArray) == 1: + cyextSemArray = (extSemArray[0])._pvt_ptr + cdef cydriver.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS* cyparamsArray = NULL + if len(paramsArray) > 1: + cyparamsArray = calloc(len(paramsArray), sizeof(cydriver.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS)) + if cyparamsArray is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(paramsArray)) + 'x' + str(sizeof(cydriver.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS))) for idx in range(len(paramsArray)): - string.memcpy(&cparamsArray[idx], (paramsArray[idx])._ptr, sizeof(ccuda.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS)) + string.memcpy(&cyparamsArray[idx], (paramsArray[idx])._pvt_ptr, sizeof(cydriver.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS)) + elif len(paramsArray) == 1: + cyparamsArray = (paramsArray[0])._pvt_ptr if numExtSems > len(extSemArray): raise RuntimeError("List is too small: " + str(len(extSemArray)) + " < " + str(numExtSems)) if numExtSems > len(paramsArray): raise RuntimeError("List is too small: " + str(len(paramsArray)) + " < " + str(numExtSems)) - err = ccuda.cuSignalExternalSemaphoresAsync((extSemArray[0])._ptr if len(extSemArray) == 1 else cextSemArray, (paramsArray[0])._ptr if len(paramsArray) == 1 else cparamsArray, numExtSems, cstream) - if cextSemArray is not NULL: - free(cextSemArray) - if cparamsArray is not NULL: - free(cparamsArray) - return (CUresult(err),) -{{endif}} - -{{if 'cuWaitExternalSemaphoresAsync' in found_functions}} + with nogil: + err = cydriver.cuSignalExternalSemaphoresAsync(cyextSemArray, cyparamsArray, numExtSems, cystream) + if len(extSemArray) > 1 and cyextSemArray is not NULL: + free(cyextSemArray) + if len(paramsArray) > 1 and cyparamsArray is not NULL: + free(cyparamsArray) + return (_CUresult(err),) @cython.embedsignature(True) -def cuWaitExternalSemaphoresAsync(extSemArray : Optional[List[CUexternalSemaphore]], paramsArray : Optional[List[CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS]], unsigned int numExtSems, stream): +def cuWaitExternalSemaphoresAsync(extSemArray : Optional[tuple[CUexternalSemaphore] | list[CUexternalSemaphore]], paramsArray : Optional[tuple[CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS] | list[CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS]], unsigned int numExtSems, stream): """ Waits on a set of external semaphore objects. Enqueues a wait operation on a set of externally allocated semaphore @@ -32518,12 +41921,12 @@ def cuWaitExternalSemaphoresAsync(extSemArray : Optional[List[CUexternalSemaphor :py:obj:`~.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_WIN32` then waiting on the semaphore will wait until the value of the semaphore is greater than or equal to - :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS`::params::fence::value. + :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS.params.fence.value`. If the semaphore object is of the type :py:obj:`~.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC` then, waiting on the semaphore will wait until the - :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS`::params::nvSciSync::fence + :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS.params.nvSciSync.fence` is signaled by the signaler of the NvSciSyncObj that was associated with this semaphore object. By default, waiting on such an external semaphore object causes appropriate memory synchronization operations @@ -32547,9 +41950,9 @@ def cuWaitExternalSemaphoresAsync(extSemArray : Optional[List[CUexternalSemaphor :py:obj:`~.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX_KMT` then the keyed mutex will be acquired when it is released with the key specified in - :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS`::params::keyedmutex::key + :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS.params.keyedmutex.key` or until the timeout specified by - :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS`::params::keyedmutex::timeoutMs + :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS.params.keyedmutex.timeoutMs` has lapsed. The timeout interval can either be a finite value specified in milliseconds or an infinite value. In case an infinite value is specified the timeout never elapses. The windows INFINITE macro must be @@ -32557,9 +41960,9 @@ def cuWaitExternalSemaphoresAsync(extSemArray : Optional[List[CUexternalSemaphor Parameters ---------- - extSemArray : List[:py:obj:`~.CUexternalSemaphore`] + extSemArray : list[:py:obj:`~.CUexternalSemaphore`] External semaphores to be waited on - paramsArray : List[:py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS`] + paramsArray : list[:py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS`] Array of semaphore parameters numExtSems : unsigned int Number of semaphores to wait on @@ -32575,47 +41978,48 @@ def cuWaitExternalSemaphoresAsync(extSemArray : Optional[List[CUexternalSemaphor -------- :py:obj:`~.cuImportExternalSemaphore`, :py:obj:`~.cuDestroyExternalSemaphore`, :py:obj:`~.cuSignalExternalSemaphoresAsync` """ - cdef ccuda.CUstream cstream + cdef cydriver.CUstream cystream if stream is None: - cstream = 0 + pstream = 0 elif isinstance(stream, (CUstream,)): pstream = int(stream) - cstream = pstream else: pstream = int(CUstream(stream)) - cstream = pstream + cystream = pstream paramsArray = [] if paramsArray is None else paramsArray if not all(isinstance(_x, (CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS,)) for _x in paramsArray): - raise TypeError("Argument 'paramsArray' is not instance of type (expected List[ccuda.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS,]") + raise TypeError("Argument 'paramsArray' is not instance of type (expected tuple[cydriver.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS,] or list[cydriver.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS,]") extSemArray = [] if extSemArray is None else extSemArray if not all(isinstance(_x, (CUexternalSemaphore,)) for _x in extSemArray): - raise TypeError("Argument 'extSemArray' is not instance of type (expected List[ccuda.CUexternalSemaphore,]") - cdef ccuda.CUexternalSemaphore* cextSemArray = NULL - if len(extSemArray) > 0: - cextSemArray = calloc(len(extSemArray), sizeof(ccuda.CUexternalSemaphore)) - if cextSemArray is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(extSemArray)) + 'x' + str(sizeof(ccuda.CUexternalSemaphore))) + raise TypeError("Argument 'extSemArray' is not instance of type (expected tuple[cydriver.CUexternalSemaphore,] or list[cydriver.CUexternalSemaphore,]") + cdef cydriver.CUexternalSemaphore* cyextSemArray = NULL + if len(extSemArray) > 1: + cyextSemArray = calloc(len(extSemArray), sizeof(cydriver.CUexternalSemaphore)) + if cyextSemArray is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(extSemArray)) + 'x' + str(sizeof(cydriver.CUexternalSemaphore))) else: for idx in range(len(extSemArray)): - cextSemArray[idx] = (extSemArray[idx])._ptr[0] - cdef ccuda.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS* cparamsArray = NULL - if len(paramsArray) > 0: - cparamsArray = calloc(len(paramsArray), sizeof(ccuda.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS)) - if cparamsArray is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(paramsArray)) + 'x' + str(sizeof(ccuda.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS))) + cyextSemArray[idx] = (extSemArray[idx])._pvt_ptr[0] + elif len(extSemArray) == 1: + cyextSemArray = (extSemArray[0])._pvt_ptr + cdef cydriver.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS* cyparamsArray = NULL + if len(paramsArray) > 1: + cyparamsArray = calloc(len(paramsArray), sizeof(cydriver.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS)) + if cyparamsArray is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(paramsArray)) + 'x' + str(sizeof(cydriver.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS))) for idx in range(len(paramsArray)): - string.memcpy(&cparamsArray[idx], (paramsArray[idx])._ptr, sizeof(ccuda.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS)) + string.memcpy(&cyparamsArray[idx], (paramsArray[idx])._pvt_ptr, sizeof(cydriver.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS)) + elif len(paramsArray) == 1: + cyparamsArray = (paramsArray[0])._pvt_ptr if numExtSems > len(extSemArray): raise RuntimeError("List is too small: " + str(len(extSemArray)) + " < " + str(numExtSems)) if numExtSems > len(paramsArray): raise RuntimeError("List is too small: " + str(len(paramsArray)) + " < " + str(numExtSems)) - err = ccuda.cuWaitExternalSemaphoresAsync((extSemArray[0])._ptr if len(extSemArray) == 1 else cextSemArray, (paramsArray[0])._ptr if len(paramsArray) == 1 else cparamsArray, numExtSems, cstream) - if cextSemArray is not NULL: - free(cextSemArray) - if cparamsArray is not NULL: - free(cparamsArray) - return (CUresult(err),) -{{endif}} - -{{if 'cuDestroyExternalSemaphore' in found_functions}} + with nogil: + err = cydriver.cuWaitExternalSemaphoresAsync(cyextSemArray, cyparamsArray, numExtSems, cystream) + if len(extSemArray) > 1 and cyextSemArray is not NULL: + free(cyextSemArray) + if len(paramsArray) > 1 and cyparamsArray is not NULL: + free(cyparamsArray) + return (_CUresult(err),) @cython.embedsignature(True) def cuDestroyExternalSemaphore(extSem): @@ -32639,20 +42043,17 @@ def cuDestroyExternalSemaphore(extSem): -------- :py:obj:`~.cuImportExternalSemaphore`, :py:obj:`~.cuSignalExternalSemaphoresAsync`, :py:obj:`~.cuWaitExternalSemaphoresAsync` """ - cdef ccuda.CUexternalSemaphore cextSem + cdef cydriver.CUexternalSemaphore cyextSem if extSem is None: - cextSem = 0 + pextSem = 0 elif isinstance(extSem, (CUexternalSemaphore,)): pextSem = int(extSem) - cextSem = pextSem else: pextSem = int(CUexternalSemaphore(extSem)) - cextSem = pextSem - err = ccuda.cuDestroyExternalSemaphore(cextSem) - return (CUresult(err),) -{{endif}} - -{{if 'cuStreamWaitValue32_v2' in found_functions}} + cyextSem = pextSem + with nogil: + err = cydriver.cuDestroyExternalSemaphore(cyextSem) + return (_CUresult(err),) @cython.embedsignature(True) def cuStreamWaitValue32(stream, addr, value, unsigned int flags): @@ -32697,38 +42098,33 @@ def cuStreamWaitValue32(stream, addr, value, unsigned int flags): ----- Warning: Improper use of this API may deadlock the application. Synchronization ordering established through this API is not visible to CUDA. CUDA tasks that are (even indirectly) ordered by this API should also have that order expressed with CUDA-visible dependencies such as events. This ensures that the scheduler does not serialize them in an improper order. """ - cdef ccuda.cuuint32_t cvalue + cdef cydriver.cuuint32_t cyvalue if value is None: - cvalue = 0 + pvalue = 0 elif isinstance(value, (cuuint32_t,)): pvalue = int(value) - cvalue = pvalue else: pvalue = int(cuuint32_t(value)) - cvalue = pvalue - cdef ccuda.CUdeviceptr caddr + cyvalue = pvalue + cdef cydriver.CUdeviceptr cyaddr if addr is None: - caddr = 0 + paddr = 0 elif isinstance(addr, (CUdeviceptr,)): paddr = int(addr) - caddr = paddr else: paddr = int(CUdeviceptr(addr)) - caddr = paddr - cdef ccuda.CUstream cstream + cyaddr = paddr + cdef cydriver.CUstream cystream if stream is None: - cstream = 0 + pstream = 0 elif isinstance(stream, (CUstream,)): pstream = int(stream) - cstream = pstream else: pstream = int(CUstream(stream)) - cstream = pstream - err = ccuda.cuStreamWaitValue32(cstream, caddr, cvalue, flags) - return (CUresult(err),) -{{endif}} - -{{if 'cuStreamWaitValue64_v2' in found_functions}} + cystream = pstream + with nogil: + err = cydriver.cuStreamWaitValue32(cystream, cyaddr, cyvalue, flags) + return (_CUresult(err),) @cython.embedsignature(True) def cuStreamWaitValue64(stream, addr, value, unsigned int flags): @@ -32771,38 +42167,33 @@ def cuStreamWaitValue64(stream, addr, value, unsigned int flags): ----- Warning: Improper use of this API may deadlock the application. Synchronization ordering established through this API is not visible to CUDA. CUDA tasks that are (even indirectly) ordered by this API should also have that order expressed with CUDA-visible dependencies such as events. This ensures that the scheduler does not serialize them in an improper order. """ - cdef ccuda.cuuint64_t cvalue + cdef cydriver.cuuint64_t cyvalue if value is None: - cvalue = 0 + pvalue = 0 elif isinstance(value, (cuuint64_t,)): pvalue = int(value) - cvalue = pvalue else: pvalue = int(cuuint64_t(value)) - cvalue = pvalue - cdef ccuda.CUdeviceptr caddr + cyvalue = pvalue + cdef cydriver.CUdeviceptr cyaddr if addr is None: - caddr = 0 + paddr = 0 elif isinstance(addr, (CUdeviceptr,)): paddr = int(addr) - caddr = paddr else: paddr = int(CUdeviceptr(addr)) - caddr = paddr - cdef ccuda.CUstream cstream + cyaddr = paddr + cdef cydriver.CUstream cystream if stream is None: - cstream = 0 + pstream = 0 elif isinstance(stream, (CUstream,)): pstream = int(stream) - cstream = pstream else: pstream = int(CUstream(stream)) - cstream = pstream - err = ccuda.cuStreamWaitValue64(cstream, caddr, cvalue, flags) - return (CUresult(err),) -{{endif}} - -{{if 'cuStreamWriteValue32_v2' in found_functions}} + cystream = pstream + with nogil: + err = cydriver.cuStreamWaitValue64(cystream, cyaddr, cyvalue, flags) + return (_CUresult(err),) @cython.embedsignature(True) def cuStreamWriteValue32(stream, addr, value, unsigned int flags): @@ -32835,38 +42226,33 @@ def cuStreamWriteValue32(stream, addr, value, unsigned int flags): -------- :py:obj:`~.cuStreamWriteValue64`, :py:obj:`~.cuStreamWaitValue32`, :py:obj:`~.cuStreamWaitValue64`, :py:obj:`~.cuStreamBatchMemOp`, :py:obj:`~.cuMemHostRegister`, :py:obj:`~.cuEventRecord` """ - cdef ccuda.cuuint32_t cvalue + cdef cydriver.cuuint32_t cyvalue if value is None: - cvalue = 0 + pvalue = 0 elif isinstance(value, (cuuint32_t,)): pvalue = int(value) - cvalue = pvalue else: pvalue = int(cuuint32_t(value)) - cvalue = pvalue - cdef ccuda.CUdeviceptr caddr + cyvalue = pvalue + cdef cydriver.CUdeviceptr cyaddr if addr is None: - caddr = 0 + paddr = 0 elif isinstance(addr, (CUdeviceptr,)): paddr = int(addr) - caddr = paddr else: paddr = int(CUdeviceptr(addr)) - caddr = paddr - cdef ccuda.CUstream cstream + cyaddr = paddr + cdef cydriver.CUstream cystream if stream is None: - cstream = 0 + pstream = 0 elif isinstance(stream, (CUstream,)): pstream = int(stream) - cstream = pstream else: pstream = int(CUstream(stream)) - cstream = pstream - err = ccuda.cuStreamWriteValue32(cstream, caddr, cvalue, flags) - return (CUresult(err),) -{{endif}} - -{{if 'cuStreamWriteValue64_v2' in found_functions}} + cystream = pstream + with nogil: + err = cydriver.cuStreamWriteValue32(cystream, cyaddr, cyvalue, flags) + return (_CUresult(err),) @cython.embedsignature(True) def cuStreamWriteValue64(stream, addr, value, unsigned int flags): @@ -32901,41 +42287,36 @@ def cuStreamWriteValue64(stream, addr, value, unsigned int flags): -------- :py:obj:`~.cuStreamWriteValue32`, :py:obj:`~.cuStreamWaitValue32`, :py:obj:`~.cuStreamWaitValue64`, :py:obj:`~.cuStreamBatchMemOp`, :py:obj:`~.cuMemHostRegister`, :py:obj:`~.cuEventRecord` """ - cdef ccuda.cuuint64_t cvalue + cdef cydriver.cuuint64_t cyvalue if value is None: - cvalue = 0 + pvalue = 0 elif isinstance(value, (cuuint64_t,)): pvalue = int(value) - cvalue = pvalue else: pvalue = int(cuuint64_t(value)) - cvalue = pvalue - cdef ccuda.CUdeviceptr caddr + cyvalue = pvalue + cdef cydriver.CUdeviceptr cyaddr if addr is None: - caddr = 0 + paddr = 0 elif isinstance(addr, (CUdeviceptr,)): paddr = int(addr) - caddr = paddr else: paddr = int(CUdeviceptr(addr)) - caddr = paddr - cdef ccuda.CUstream cstream + cyaddr = paddr + cdef cydriver.CUstream cystream if stream is None: - cstream = 0 + pstream = 0 elif isinstance(stream, (CUstream,)): pstream = int(stream) - cstream = pstream else: pstream = int(CUstream(stream)) - cstream = pstream - err = ccuda.cuStreamWriteValue64(cstream, caddr, cvalue, flags) - return (CUresult(err),) -{{endif}} - -{{if 'cuStreamBatchMemOp_v2' in found_functions}} + cystream = pstream + with nogil: + err = cydriver.cuStreamWriteValue64(cystream, cyaddr, cyvalue, flags) + return (_CUresult(err),) @cython.embedsignature(True) -def cuStreamBatchMemOp(stream, unsigned int count, paramArray : Optional[List[CUstreamBatchMemOpParams]], unsigned int flags): +def cuStreamBatchMemOp(stream, unsigned int count, paramArray : Optional[tuple[CUstreamBatchMemOpParams] | list[CUstreamBatchMemOpParams]], unsigned int flags): """ Batch operations to synchronize the stream via memory operations. This is a batch version of :py:obj:`~.cuStreamWaitValue32()` and @@ -32959,7 +42340,7 @@ def cuStreamBatchMemOp(stream, unsigned int count, paramArray : Optional[List[CU The stream to enqueue the operations in. count : unsigned int The number of operations in the array. Must be less than 256. - paramArray : List[:py:obj:`~.CUstreamBatchMemOpParams`] + paramArray : list[:py:obj:`~.CUstreamBatchMemOpParams`] The types and parameters of the individual operations. flags : unsigned int Reserved for future expansion; must be 0. @@ -32975,35 +42356,34 @@ def cuStreamBatchMemOp(stream, unsigned int count, paramArray : Optional[List[CU Notes ----- - Warning: Improper use of this API may deadlock the application. Synchronization ordering established through this API is not visible to CUDA. CUDA tasks that are (even indirectly) ordered by this API should also have that order expressed with CUDA-visible dependencies such as events. This ensures that the scheduler does not serialize them in an improper order. For more information, see the Stream Memory Operations section in the programming guide(https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html). + Warning: Improper use of this API may deadlock the application. Synchronization ordering established through this API is not visible to CUDA. CUDA tasks that are (even indirectly) ordered by this API should also have that order expressed with CUDA-visible dependencies such as events. This ensures that the scheduler does not serialize them in an improper order. """ paramArray = [] if paramArray is None else paramArray if not all(isinstance(_x, (CUstreamBatchMemOpParams,)) for _x in paramArray): - raise TypeError("Argument 'paramArray' is not instance of type (expected List[ccuda.CUstreamBatchMemOpParams,]") - cdef ccuda.CUstream cstream + raise TypeError("Argument 'paramArray' is not instance of type (expected tuple[cydriver.CUstreamBatchMemOpParams,] or list[cydriver.CUstreamBatchMemOpParams,]") + cdef cydriver.CUstream cystream if stream is None: - cstream = 0 + pstream = 0 elif isinstance(stream, (CUstream,)): pstream = int(stream) - cstream = pstream else: pstream = int(CUstream(stream)) - cstream = pstream + cystream = pstream if count > len(paramArray): raise RuntimeError("List is too small: " + str(len(paramArray)) + " < " + str(count)) - cdef ccuda.CUstreamBatchMemOpParams* cparamArray = NULL - if len(paramArray) > 0: - cparamArray = calloc(len(paramArray), sizeof(ccuda.CUstreamBatchMemOpParams)) - if cparamArray is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(paramArray)) + 'x' + str(sizeof(ccuda.CUstreamBatchMemOpParams))) + cdef cydriver.CUstreamBatchMemOpParams* cyparamArray = NULL + if len(paramArray) > 1: + cyparamArray = calloc(len(paramArray), sizeof(cydriver.CUstreamBatchMemOpParams)) + if cyparamArray is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(paramArray)) + 'x' + str(sizeof(cydriver.CUstreamBatchMemOpParams))) for idx in range(len(paramArray)): - string.memcpy(&cparamArray[idx], (paramArray[idx])._ptr, sizeof(ccuda.CUstreamBatchMemOpParams)) - err = ccuda.cuStreamBatchMemOp(cstream, count, (paramArray[0])._ptr if len(paramArray) == 1 else cparamArray, flags) - if cparamArray is not NULL: - free(cparamArray) - return (CUresult(err),) -{{endif}} - -{{if 'cuFuncGetAttribute' in found_functions}} + string.memcpy(&cyparamArray[idx], (paramArray[idx])._pvt_ptr, sizeof(cydriver.CUstreamBatchMemOpParams)) + elif len(paramArray) == 1: + cyparamArray = (paramArray[0])._pvt_ptr + with nogil: + err = cydriver.cuStreamBatchMemOp(cystream, count, cyparamArray, flags) + if len(paramArray) > 1 and cyparamArray is not NULL: + free(cyparamArray) + return (_CUresult(err),) @cython.embedsignature(True) def cuFuncGetAttribute(attrib not None : CUfunction_attribute, hfunc): @@ -33086,7 +42466,7 @@ def cuFuncGetAttribute(attrib not None : CUfunction_attribute, hfunc): - :py:obj:`~.CU_FUNC_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE`: The block scheduling policy of a function. The value type is - CUclusterSchedulingPolicy. + :py:obj:`~.CUclusterSchedulingPolicy`. With a few execeptions, function attributes may also be queried on unloaded function handles returned from @@ -33122,22 +42502,21 @@ def cuFuncGetAttribute(attrib not None : CUfunction_attribute, hfunc): -------- :py:obj:`~.cuCtxGetCacheConfig`, :py:obj:`~.cuCtxSetCacheConfig`, :py:obj:`~.cuFuncSetCacheConfig`, :py:obj:`~.cuLaunchKernel`, :py:obj:`~.cudaFuncGetAttributes`, :py:obj:`~.cudaFuncSetAttribute`, :py:obj:`~.cuFuncIsLoaded`, :py:obj:`~.cuFuncLoad`, :py:obj:`~.cuKernelGetAttribute` """ - cdef ccuda.CUfunction chfunc + cdef cydriver.CUfunction cyhfunc if hfunc is None: - chfunc = 0 + phfunc = 0 elif isinstance(hfunc, (CUfunction,)): phfunc = int(hfunc) - chfunc = phfunc else: phfunc = int(CUfunction(hfunc)) - chfunc = phfunc + cyhfunc = phfunc cdef int pi = 0 - cdef ccuda.CUfunction_attribute cattrib = attrib.value - err = ccuda.cuFuncGetAttribute(&pi, cattrib, chfunc) - return (CUresult(err), pi) -{{endif}} - -{{if 'cuFuncSetAttribute' in found_functions}} + cdef cydriver.CUfunction_attribute cyattrib = int(attrib) + with nogil: + err = cydriver.cuFuncGetAttribute(&pi, cyattrib, cyhfunc) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pi) @cython.embedsignature(True) def cuFuncSetAttribute(hfunc, attrib not None : CUfunction_attribute, int value): @@ -33197,7 +42576,7 @@ def cuFuncSetAttribute(hfunc, attrib not None : CUfunction_attribute, int value) - :py:obj:`~.CU_FUNC_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE`: The block scheduling policy of a function. The value type is - CUclusterSchedulingPolicy. + :py:obj:`~.CUclusterSchedulingPolicy`. Parameters ---------- @@ -33217,21 +42596,18 @@ def cuFuncSetAttribute(hfunc, attrib not None : CUfunction_attribute, int value) -------- :py:obj:`~.cuCtxGetCacheConfig`, :py:obj:`~.cuCtxSetCacheConfig`, :py:obj:`~.cuFuncSetCacheConfig`, :py:obj:`~.cuLaunchKernel`, :py:obj:`~.cudaFuncGetAttributes`, :py:obj:`~.cudaFuncSetAttribute`, :py:obj:`~.cuKernelSetAttribute` """ - cdef ccuda.CUfunction chfunc + cdef cydriver.CUfunction cyhfunc if hfunc is None: - chfunc = 0 + phfunc = 0 elif isinstance(hfunc, (CUfunction,)): phfunc = int(hfunc) - chfunc = phfunc else: phfunc = int(CUfunction(hfunc)) - chfunc = phfunc - cdef ccuda.CUfunction_attribute cattrib = attrib.value - err = ccuda.cuFuncSetAttribute(chfunc, cattrib, value) - return (CUresult(err),) -{{endif}} - -{{if 'cuFuncSetCacheConfig' in found_functions}} + cyhfunc = phfunc + cdef cydriver.CUfunction_attribute cyattrib = int(attrib) + with nogil: + err = cydriver.cuFuncSetAttribute(cyhfunc, cyattrib, value) + return (_CUresult(err),) @cython.embedsignature(True) def cuFuncSetCacheConfig(hfunc, config not None : CUfunc_cache): @@ -33283,21 +42659,18 @@ def cuFuncSetCacheConfig(hfunc, config not None : CUfunc_cache): -------- :py:obj:`~.cuCtxGetCacheConfig`, :py:obj:`~.cuCtxSetCacheConfig`, :py:obj:`~.cuFuncGetAttribute`, :py:obj:`~.cuLaunchKernel`, :py:obj:`~.cudaFuncSetCacheConfig`, :py:obj:`~.cuKernelSetCacheConfig` """ - cdef ccuda.CUfunction chfunc + cdef cydriver.CUfunction cyhfunc if hfunc is None: - chfunc = 0 + phfunc = 0 elif isinstance(hfunc, (CUfunction,)): phfunc = int(hfunc) - chfunc = phfunc else: phfunc = int(CUfunction(hfunc)) - chfunc = phfunc - cdef ccuda.CUfunc_cache cconfig = config.value - err = ccuda.cuFuncSetCacheConfig(chfunc, cconfig) - return (CUresult(err),) -{{endif}} - -{{if 'cuFuncGetModule' in found_functions}} + cyhfunc = phfunc + cdef cydriver.CUfunc_cache cyconfig = int(config) + with nogil: + err = cydriver.cuFuncSetCacheConfig(cyhfunc, cyconfig) + return (_CUresult(err),) @cython.embedsignature(True) def cuFuncGetModule(hfunc): @@ -33325,21 +42698,20 @@ def cuFuncGetModule(hfunc): hmod : :py:obj:`~.CUmodule` Returned module handle """ - cdef ccuda.CUfunction chfunc + cdef cydriver.CUfunction cyhfunc if hfunc is None: - chfunc = 0 + phfunc = 0 elif isinstance(hfunc, (CUfunction,)): phfunc = int(hfunc) - chfunc = phfunc else: phfunc = int(CUfunction(hfunc)) - chfunc = phfunc + cyhfunc = phfunc cdef CUmodule hmod = CUmodule() - err = ccuda.cuFuncGetModule(hmod._ptr, chfunc) - return (CUresult(err), hmod) -{{endif}} - -{{if 'cuFuncGetName' in found_functions}} + with nogil: + err = cydriver.cuFuncGetModule(hmod._pvt_ptr, cyhfunc) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, hmod) @cython.embedsignature(True) def cuFuncGetName(hfunc): @@ -33365,21 +42737,20 @@ def cuFuncGetName(hfunc): name : bytes The returned name of the function """ - cdef ccuda.CUfunction chfunc + cdef cydriver.CUfunction cyhfunc if hfunc is None: - chfunc = 0 + phfunc = 0 elif isinstance(hfunc, (CUfunction,)): phfunc = int(hfunc) - chfunc = phfunc else: phfunc = int(CUfunction(hfunc)) - chfunc = phfunc + cyhfunc = phfunc cdef const char* name = NULL - err = ccuda.cuFuncGetName(&name, chfunc) - return (CUresult(err), name) -{{endif}} - -{{if 'cuFuncGetParamInfo' in found_functions}} + with nogil: + err = cydriver.cuFuncGetName(&name, cyhfunc) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, name if name != NULL else None) @cython.embedsignature(True) def cuFuncGetParamInfo(func, size_t paramIndex): @@ -33417,22 +42788,59 @@ def cuFuncGetParamInfo(func, size_t paramIndex): -------- :py:obj:`~.cuKernelGetParamInfo` """ - cdef ccuda.CUfunction cfunc + cdef cydriver.CUfunction cyfunc if func is None: - cfunc = 0 + pfunc = 0 elif isinstance(func, (CUfunction,)): pfunc = int(func) - cfunc = pfunc else: pfunc = int(CUfunction(func)) - cfunc = pfunc + cyfunc = pfunc cdef size_t paramOffset = 0 cdef size_t paramSize = 0 - err = ccuda.cuFuncGetParamInfo(cfunc, paramIndex, ¶mOffset, ¶mSize) - return (CUresult(err), paramOffset, paramSize) -{{endif}} + with nogil: + err = cydriver.cuFuncGetParamInfo(cyfunc, paramIndex, ¶mOffset, ¶mSize) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None, None) + return (_CUresult_SUCCESS, paramOffset, paramSize) -{{if 'cuFuncIsLoaded' in found_functions}} +@cython.embedsignature(True) +def cuFuncGetParamCount(func): + """ Returns the number of parameters used by the function. + + Queries the number of kernel parameters used by `func` and returns it + in `paramCount`. + + Parameters + ---------- + func : :py:obj:`~.CUfunction` + The function to query + + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE` + paramCount : int + Returns the number of parameters used by the function + + See Also + -------- + :py:obj:`~.cuFuncGetParamInfo` + """ + cdef cydriver.CUfunction cyfunc + if func is None: + pfunc = 0 + elif isinstance(func, (CUfunction,)): + pfunc = int(func) + else: + pfunc = int(CUfunction(func)) + cyfunc = pfunc + cdef size_t paramCount = 0 + with nogil: + err = cydriver.cuFuncGetParamCount(cyfunc, ¶mCount) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, paramCount) @cython.embedsignature(True) def cuFuncIsLoaded(function): @@ -33456,21 +42864,20 @@ def cuFuncIsLoaded(function): -------- :py:obj:`~.cuFuncLoad`, :py:obj:`~.cuModuleEnumerateFunctions` """ - cdef ccuda.CUfunction cfunction + cdef cydriver.CUfunction cyfunction if function is None: - cfunction = 0 + pfunction = 0 elif isinstance(function, (CUfunction,)): pfunction = int(function) - cfunction = pfunction else: pfunction = int(CUfunction(function)) - cfunction = pfunction - cdef ccuda.CUfunctionLoadingState state - err = ccuda.cuFuncIsLoaded(&state, cfunction) - return (CUresult(err), CUfunctionLoadingState(state)) -{{endif}} - -{{if 'cuFuncLoad' in found_functions}} + cyfunction = pfunction + cdef cydriver.CUfunctionLoadingState state + with nogil: + err = cydriver.cuFuncIsLoaded(&state, cyfunction) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, CUfunctionLoadingState(state)) @cython.embedsignature(True) def cuFuncLoad(function): @@ -33493,20 +42900,17 @@ def cuFuncLoad(function): -------- :py:obj:`~.cuModuleEnumerateFunctions`, :py:obj:`~.cuFuncIsLoaded` """ - cdef ccuda.CUfunction cfunction + cdef cydriver.CUfunction cyfunction if function is None: - cfunction = 0 + pfunction = 0 elif isinstance(function, (CUfunction,)): pfunction = int(function) - cfunction = pfunction else: pfunction = int(CUfunction(function)) - cfunction = pfunction - err = ccuda.cuFuncLoad(cfunction) - return (CUresult(err),) -{{endif}} - -{{if 'cuLaunchKernel' in found_functions}} + cyfunction = pfunction + with nogil: + err = cydriver.cuFuncLoad(cyfunction) + return (_CUresult(err),) @cython.embedsignature(True) def cuLaunchKernel(f, unsigned int gridDimX, unsigned int gridDimY, unsigned int gridDimZ, unsigned int blockDimX, unsigned int blockDimY, unsigned int blockDimZ, unsigned int sharedMemBytes, hStream, kernelParams, void_ptr extra): @@ -33604,7 +43008,7 @@ def cuLaunchKernel(f, unsigned int gridDimX, unsigned int gridDimY, unsigned int Stream identifier kernelParams : Any Array of pointers to kernel parameters - extra : List[Any] + extra : list[Any] Extra options Returns @@ -33616,30 +43020,27 @@ def cuLaunchKernel(f, unsigned int gridDimX, unsigned int gridDimY, unsigned int -------- :py:obj:`~.cuCtxGetCacheConfig`, :py:obj:`~.cuCtxSetCacheConfig`, :py:obj:`~.cuFuncSetCacheConfig`, :py:obj:`~.cuFuncGetAttribute`, :py:obj:`~.cudaLaunchKernel`, :py:obj:`~.cuLibraryGetKernel`, :py:obj:`~.cuKernelSetCacheConfig`, :py:obj:`~.cuKernelGetAttribute`, :py:obj:`~.cuKernelSetAttribute` """ - cdef ccuda.CUstream chStream + cdef cydriver.CUstream cyhStream if hStream is None: - chStream = 0 + phStream = 0 elif isinstance(hStream, (CUstream,)): phStream = int(hStream) - chStream = phStream else: phStream = int(CUstream(hStream)) - chStream = phStream - cdef ccuda.CUfunction cf + cyhStream = phStream + cdef cydriver.CUfunction cyf if f is None: - cf = 0 + pf = 0 elif isinstance(f, (CUfunction,)): pf = int(f) - cf = pf else: pf = int(CUfunction(f)) - cf = pf - ckernelParams = utils.HelperKernelParams(kernelParams) - err = ccuda.cuLaunchKernel(cf, gridDimX, gridDimY, gridDimZ, blockDimX, blockDimY, blockDimZ, sharedMemBytes, chStream, ckernelParams.ckernelParams, extra) - return (CUresult(err),) -{{endif}} - -{{if 'cuLaunchKernelEx' in found_functions}} + cyf = pf + cykernelParams = _HelperKernelParams(kernelParams) + cdef void** cykernelParams_ptr = cykernelParams.ckernelParams + with nogil: + err = cydriver.cuLaunchKernel(cyf, gridDimX, gridDimY, gridDimZ, blockDimX, blockDimY, blockDimZ, sharedMemBytes, cyhStream, cykernelParams_ptr, extra) + return (_CUresult(err),) @cython.embedsignature(True) def cuLaunchKernelEx(config : Optional[CUlaunchConfig], f, kernelParams, void_ptr extra): @@ -33753,7 +43154,7 @@ def cuLaunchKernelEx(config : Optional[CUlaunchConfig], f, kernelParams, void_pt kernel A, B may wait until A is complete. Alternatively, blocks of B may begin before all blocks of A have begun, for example: - - If B can claim execution resources unavaiable to A, for example if + - If B can claim execution resources unavailable to A, for example if they run on different GPUs. - If B is a higher priority than A. @@ -33770,7 +43171,7 @@ def cuLaunchKernelEx(config : Optional[CUlaunchConfig], f, kernelParams, void_pt other than 0 or 1 is not allowed. On success, a handle will be returned via - :py:obj:`~.CUlaunchAttributeValue`::deviceUpdatableKernelNode::devNode + :py:obj:`~.CUlaunchAttributeValue.deviceUpdatableKernelNode.devNode` which can be passed to the various device-side update functions to update the node's kernel parameters from within another kernel. For more information on the types of device updates that can be made, as @@ -33785,6 +43186,38 @@ def cuLaunchKernelEx(config : Optional[CUlaunchConfig], f, kernelParams, void_pt Graphs containing one or more device-updatable node also do not allow multiple instantiation. + :py:obj:`~.CU_LAUNCH_ATTRIBUTE_PREFERRED_CLUSTER_DIMENSION` allows the + kernel launch to specify a preferred substitute cluster dimension. + Blocks may be grouped according to either the dimensions specified with + this attribute (grouped into a "preferred substitute cluster"), or the + one specified with :py:obj:`~.CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION` + attribute (grouped into a "regular cluster"). The cluster dimensions of + a "preferred substitute cluster" shall be an integer multiple greater + than zero of the regular cluster dimensions. The device will attempt - + on a best-effort basis - to group thread blocks into preferred clusters + over grouping them into regular clusters. When it deems necessary + (primarily when the device temporarily runs out of physical resources + to launch the larger preferred clusters), the device may switch to + launch the regular clusters instead to attempt to utilize as much of + the physical device resources as possible. + + Each type of cluster will have its enumeration / coordinate setup as if + the grid consists solely of its type of cluster. For example, if the + preferred substitute cluster dimensions double the regular cluster + dimensions, there might be simultaneously a regular cluster indexed at + (1,0,0), and a preferred cluster indexed at (1,0,0). In this example, + the preferred substitute cluster (1,0,0) replaces regular clusters + (2,0,0) and (3,0,0) and groups their blocks. + + This attribute will only take effect when a regular cluster dimension + has been specified. The preferred substitute The preferred substitute + cluster dimension must be an integer multiple greater than zero of the + regular cluster dimension and must divide the grid. It must also be no + more than `maxBlocksPerCluster`, if it is set in the kernel's + `__launch_bounds__`. Otherwise it must be less than the maximum value + the driver can support. Otherwise, setting this attribute to a value + physically unable to fit on any particular device is permitted. + The effect of other attributes is consistent with their effect when set via persistent APIs. @@ -33820,7 +43253,7 @@ def cuLaunchKernelEx(config : Optional[CUlaunchConfig], f, kernelParams, void_pt launch kernelParams : Any Array of pointers to kernel parameters - extra : List[Any] + extra : list[Any] Extra options Returns @@ -33832,22 +43265,20 @@ def cuLaunchKernelEx(config : Optional[CUlaunchConfig], f, kernelParams, void_pt -------- :py:obj:`~.cuCtxGetCacheConfig`, :py:obj:`~.cuCtxSetCacheConfig`, :py:obj:`~.cuFuncSetCacheConfig`, :py:obj:`~.cuFuncGetAttribute`, :py:obj:`~.cudaLaunchKernel`, :py:obj:`~.cudaLaunchKernelEx`, :py:obj:`~.cuLibraryGetKernel`, :py:obj:`~.cuKernelSetCacheConfig`, :py:obj:`~.cuKernelGetAttribute`, :py:obj:`~.cuKernelSetAttribute` """ - cdef ccuda.CUfunction cf + cdef cydriver.CUfunction cyf if f is None: - cf = 0 + pf = 0 elif isinstance(f, (CUfunction,)): pf = int(f) - cf = pf else: pf = int(CUfunction(f)) - cf = pf - cdef ccuda.CUlaunchConfig* cconfig_ptr = config._ptr if config != None else NULL - ckernelParams = utils.HelperKernelParams(kernelParams) - err = ccuda.cuLaunchKernelEx(cconfig_ptr, cf, ckernelParams.ckernelParams, extra) - return (CUresult(err),) -{{endif}} - -{{if 'cuLaunchCooperativeKernel' in found_functions}} + cyf = pf + cdef cydriver.CUlaunchConfig* cyconfig_ptr = config._pvt_ptr if config is not None else NULL + cykernelParams = _HelperKernelParams(kernelParams) + cdef void** cykernelParams_ptr = cykernelParams.ckernelParams + with nogil: + err = cydriver.cuLaunchKernelEx(cyconfig_ptr, cyf, cykernelParams_ptr, extra) + return (_CUresult(err),) @cython.embedsignature(True) def cuLaunchCooperativeKernel(f, unsigned int gridDimX, unsigned int gridDimY, unsigned int gridDimZ, unsigned int blockDimX, unsigned int blockDimY, unsigned int blockDimZ, unsigned int sharedMemBytes, hStream, kernelParams): @@ -33937,201 +43368,40 @@ def cuLaunchCooperativeKernel(f, unsigned int gridDimX, unsigned int gridDimY, u -------- :py:obj:`~.cuCtxGetCacheConfig`, :py:obj:`~.cuCtxSetCacheConfig`, :py:obj:`~.cuFuncSetCacheConfig`, :py:obj:`~.cuFuncGetAttribute`, :py:obj:`~.cuLaunchCooperativeKernelMultiDevice`, :py:obj:`~.cudaLaunchCooperativeKernel`, :py:obj:`~.cuLibraryGetKernel`, :py:obj:`~.cuKernelSetCacheConfig`, :py:obj:`~.cuKernelGetAttribute`, :py:obj:`~.cuKernelSetAttribute` """ - cdef ccuda.CUstream chStream + cdef cydriver.CUstream cyhStream if hStream is None: - chStream = 0 + phStream = 0 elif isinstance(hStream, (CUstream,)): phStream = int(hStream) - chStream = phStream else: phStream = int(CUstream(hStream)) - chStream = phStream - cdef ccuda.CUfunction cf + cyhStream = phStream + cdef cydriver.CUfunction cyf if f is None: - cf = 0 + pf = 0 elif isinstance(f, (CUfunction,)): pf = int(f) - cf = pf else: pf = int(CUfunction(f)) - cf = pf - ckernelParams = utils.HelperKernelParams(kernelParams) - err = ccuda.cuLaunchCooperativeKernel(cf, gridDimX, gridDimY, gridDimZ, blockDimX, blockDimY, blockDimZ, sharedMemBytes, chStream, ckernelParams.ckernelParams) - return (CUresult(err),) -{{endif}} - -{{if 'cuLaunchCooperativeKernelMultiDevice' in found_functions}} - -@cython.embedsignature(True) -def cuLaunchCooperativeKernelMultiDevice(launchParamsList : Optional[List[CUDA_LAUNCH_PARAMS]], unsigned int numDevices, unsigned int flags): - """ Launches CUDA functions on multiple devices where thread blocks can cooperate and synchronize as they execute. - - [Deprecated] - - Invokes kernels as specified in the `launchParamsList` array where each - element of the array specifies all the parameters required to perform a - single kernel launch. These kernels can cooperate and synchronize as - they execute. The size of the array is specified by `numDevices`. - - No two kernels can be launched on the same device. All the devices - targeted by this multi-device launch must be identical. All devices - must have a non-zero value for the device attribute - :py:obj:`~.CU_DEVICE_ATTRIBUTE_COOPERATIVE_MULTI_DEVICE_LAUNCH`. - - All kernels launched must be identical with respect to the compiled - code. Note that any device, constant or managed variables present in - the module that owns the kernel launched on each device, are - independently instantiated on every device. It is the application's - responsibility to ensure these variables are initialized and used - appropriately. - - The size of the grids as specified in blocks, the size of the blocks - themselves and the amount of shared memory used by each thread block - must also match across all launched kernels. + cyf = pf + cykernelParams = _HelperKernelParams(kernelParams) + cdef void** cykernelParams_ptr = cykernelParams.ckernelParams + with nogil: + err = cydriver.cuLaunchCooperativeKernel(cyf, gridDimX, gridDimY, gridDimZ, blockDimX, blockDimY, blockDimZ, sharedMemBytes, cyhStream, cykernelParams_ptr) + return (_CUresult(err),) - The streams used to launch these kernels must have been created via - either :py:obj:`~.cuStreamCreate` or - :py:obj:`~.cuStreamCreateWithPriority`. The NULL stream or - :py:obj:`~.CU_STREAM_LEGACY` or :py:obj:`~.CU_STREAM_PER_THREAD` cannot - be used. +ctypedef struct cuHostCallbackData_st: + cydriver.CUhostFn callback + void *userData - The total number of blocks launched per kernel cannot exceed the - maximum number of blocks per multiprocessor as returned by - :py:obj:`~.cuOccupancyMaxActiveBlocksPerMultiprocessor` (or - :py:obj:`~.cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags`) times - the number of multiprocessors as specified by the device attribute - :py:obj:`~.CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT`. Since the total - number of blocks launched per device has to match across all devices, - the maximum number of blocks that can be launched per device will be - limited by the device with the least number of multiprocessors. - - The kernels cannot make use of CUDA dynamic parallelism. - - The :py:obj:`~.CUDA_LAUNCH_PARAMS` structure is defined as: - - **View CUDA Toolkit Documentation for a C++ code example** - - where: - - - :py:obj:`~.CUDA_LAUNCH_PARAMS.function` specifies the kernel to be - launched. All functions must be identical with respect to the - compiled code. Note that you can also specify context-less kernel - :py:obj:`~.CUkernel` by querying the handle using - :py:obj:`~.cuLibraryGetKernel()` and then casting to - :py:obj:`~.CUfunction`. In this case, the context to launch the - kernel on be taken from the specified stream - :py:obj:`~.CUDA_LAUNCH_PARAMS.hStream`. - - - :py:obj:`~.CUDA_LAUNCH_PARAMS.gridDimX` is the width of the grid in - blocks. This must match across all kernels launched. - - - :py:obj:`~.CUDA_LAUNCH_PARAMS.gridDimY` is the height of the grid in - blocks. This must match across all kernels launched. - - - :py:obj:`~.CUDA_LAUNCH_PARAMS.gridDimZ` is the depth of the grid in - blocks. This must match across all kernels launched. - - - :py:obj:`~.CUDA_LAUNCH_PARAMS.blockDimX` is the X dimension of each - thread block. This must match across all kernels launched. - - - :py:obj:`~.CUDA_LAUNCH_PARAMS.blockDimX` is the Y dimension of each - thread block. This must match across all kernels launched. - - - :py:obj:`~.CUDA_LAUNCH_PARAMS.blockDimZ` is the Z dimension of each - thread block. This must match across all kernels launched. - - - :py:obj:`~.CUDA_LAUNCH_PARAMS.sharedMemBytes` is the dynamic shared- - memory size per thread block in bytes. This must match across all - kernels launched. - - - :py:obj:`~.CUDA_LAUNCH_PARAMS.hStream` is the handle to the stream to - perform the launch in. This cannot be the NULL stream or - :py:obj:`~.CU_STREAM_LEGACY` or :py:obj:`~.CU_STREAM_PER_THREAD`. The - CUDA context associated with this stream must match that associated - with :py:obj:`~.CUDA_LAUNCH_PARAMS.function`. - - - :py:obj:`~.CUDA_LAUNCH_PARAMS.kernelParams` is an array of pointers - to kernel parameters. If :py:obj:`~.CUDA_LAUNCH_PARAMS.function` has - N parameters, then :py:obj:`~.CUDA_LAUNCH_PARAMS.kernelParams` needs - to be an array of N pointers. Each of - :py:obj:`~.CUDA_LAUNCH_PARAMS.kernelParams`[0] through - :py:obj:`~.CUDA_LAUNCH_PARAMS.kernelParams`[N-1] must point to a - region of memory from which the actual kernel parameter will be - copied. The number of kernel parameters and their offsets and sizes - do not need to be specified as that information is retrieved directly - from the kernel's image. - - By default, the kernel won't begin execution on any GPU until all prior - work in all the specified streams has completed. This behavior can be - overridden by specifying the flag - :py:obj:`~.CUDA_COOPERATIVE_LAUNCH_MULTI_DEVICE_NO_PRE_LAUNCH_SYNC`. - When this flag is specified, each kernel will only wait for prior work - in the stream corresponding to that GPU to complete before it begins - execution. - - Similarly, by default, any subsequent work pushed in any of the - specified streams will not begin execution until the kernels on all - GPUs have completed. This behavior can be overridden by specifying the - flag - :py:obj:`~.CUDA_COOPERATIVE_LAUNCH_MULTI_DEVICE_NO_POST_LAUNCH_SYNC`. - When this flag is specified, any subsequent work pushed in any of the - specified streams will only wait for the kernel launched on the GPU - corresponding to that stream to complete before it begins execution. - - Calling :py:obj:`~.cuLaunchCooperativeKernelMultiDevice()` sets - persistent function state that is the same as function state set - through :py:obj:`~.cuLaunchKernel` API when called individually for - each element in `launchParamsList`. - - When kernels are launched via - :py:obj:`~.cuLaunchCooperativeKernelMultiDevice()`, the previous block - shape, shared size and parameter info associated with each - :py:obj:`~.CUDA_LAUNCH_PARAMS.function` in `launchParamsList` is - overwritten. - - Note that to use :py:obj:`~.cuLaunchCooperativeKernelMultiDevice()`, - the kernels must either have been compiled with toolchain version 3.2 - or later so that it will contain kernel parameter information, or have - no kernel parameters. If either of these conditions is not met, then - :py:obj:`~.cuLaunchCooperativeKernelMultiDevice()` will return - :py:obj:`~.CUDA_ERROR_INVALID_IMAGE`. - - Parameters - ---------- - launchParamsList : List[:py:obj:`~.CUDA_LAUNCH_PARAMS`] - List of launch parameters, one per device - numDevices : unsigned int - Size of the `launchParamsList` array - flags : unsigned int - Flags to control launch behavior - - Returns - ------- - CUresult - :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_CONTEXT`, :py:obj:`~.CUDA_ERROR_INVALID_HANDLE`, :py:obj:`~.CUDA_ERROR_INVALID_IMAGE`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_LAUNCH_FAILED`, :py:obj:`~.CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES`, :py:obj:`~.CUDA_ERROR_LAUNCH_TIMEOUT`, :py:obj:`~.CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING`, :py:obj:`~.CUDA_ERROR_COOPERATIVE_LAUNCH_TOO_LARGE`, :py:obj:`~.CUDA_ERROR_SHARED_OBJECT_INIT_FAILED` - - See Also - -------- - :py:obj:`~.cuCtxGetCacheConfig`, :py:obj:`~.cuCtxSetCacheConfig`, :py:obj:`~.cuFuncSetCacheConfig`, :py:obj:`~.cuFuncGetAttribute`, :py:obj:`~.cuLaunchCooperativeKernel`, :py:obj:`~.cudaLaunchCooperativeKernelMultiDevice` - """ - launchParamsList = [] if launchParamsList is None else launchParamsList - if not all(isinstance(_x, (CUDA_LAUNCH_PARAMS,)) for _x in launchParamsList): - raise TypeError("Argument 'launchParamsList' is not instance of type (expected List[ccuda.CUDA_LAUNCH_PARAMS,]") - cdef ccuda.CUDA_LAUNCH_PARAMS* claunchParamsList = NULL - if len(launchParamsList) > 0: - claunchParamsList = calloc(len(launchParamsList), sizeof(ccuda.CUDA_LAUNCH_PARAMS)) - if claunchParamsList is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(launchParamsList)) + 'x' + str(sizeof(ccuda.CUDA_LAUNCH_PARAMS))) - for idx in range(len(launchParamsList)): - string.memcpy(&claunchParamsList[idx], (launchParamsList[idx])._ptr, sizeof(ccuda.CUDA_LAUNCH_PARAMS)) - if numDevices > len(launchParamsList): raise RuntimeError("List is too small: " + str(len(launchParamsList)) + " < " + str(numDevices)) - err = ccuda.cuLaunchCooperativeKernelMultiDevice((launchParamsList[0])._ptr if len(launchParamsList) == 1 else claunchParamsList, numDevices, flags) - if claunchParamsList is not NULL: - free(claunchParamsList) - return (CUresult(err),) -{{endif}} +ctypedef cuHostCallbackData_st cuHostCallbackData -{{if 'cuLaunchHostFunc' in found_functions}} +@cython.show_performance_hints(False) +cdef void cuHostCallbackWrapper(void *data) nogil: + cdef cuHostCallbackData *cbData = data + with gil: + cbData.callback(cbData.userData) + free(cbData) @cython.embedsignature(True) def cuLaunchHostFunc(hStream, fn, userData): @@ -34194,31 +43464,124 @@ def cuLaunchHostFunc(hStream, fn, userData): -------- :py:obj:`~.cuStreamCreate`, :py:obj:`~.cuStreamQuery`, :py:obj:`~.cuStreamSynchronize`, :py:obj:`~.cuStreamWaitEvent`, :py:obj:`~.cuStreamDestroy`, :py:obj:`~.cuMemAllocManaged`, :py:obj:`~.cuStreamAttachMemAsync`, :py:obj:`~.cuStreamAddCallback` """ - cdef ccuda.CUhostFn cfn + cdef cydriver.CUhostFn cyfn if fn is None: - cfn = 0 + pfn = 0 elif isinstance(fn, (CUhostFn,)): pfn = int(fn) - cfn = pfn else: pfn = int(CUhostFn(fn)) - cfn = pfn - cdef ccuda.CUstream chStream + cyfn = pfn + cdef cydriver.CUstream cyhStream if hStream is None: - chStream = 0 + phStream = 0 elif isinstance(hStream, (CUstream,)): phStream = int(hStream) - chStream = phStream else: phStream = int(CUstream(hStream)) - chStream = phStream - cuserData = utils.HelperInputVoidPtr(userData) - cdef void* cuserData_ptr = cuserData.cptr - err = ccuda.cuLaunchHostFunc(chStream, cfn, cuserData_ptr) - return (CUresult(err),) -{{endif}} + cyhStream = phStream + cdef _HelperInputVoidPtrStruct cyuserDataHelper + cdef void* cyuserData = _helper_input_void_ptr(userData, &cyuserDataHelper) + + cdef cuHostCallbackData *cbData = NULL + cbData = malloc(sizeof(cbData[0])) + if cbData == NULL: + return (CUresult.CUDA_ERROR_OUT_OF_MEMORY,) + cbData.callback = cyfn + cbData.userData = cyuserData + + with nogil: + err = cydriver.cuLaunchHostFunc(cyhStream, cuHostCallbackWrapper, cbData) + if err != cydriver.CUDA_SUCCESS: + free(cbData) + _helper_input_void_ptr_free(&cyuserDataHelper) + return (_CUresult(err),) + +@cython.embedsignature(True) +def cuLaunchHostFunc_v2(hStream, fn, userData, unsigned int syncMode): + """ Enqueues a host function call in a stream. + + Enqueues a host function to run in a stream. The function will be + called after currently enqueued work and will block work added after + it. + + The host function must not make any CUDA API calls. Attempting to use a + CUDA API may result in :py:obj:`~.CUDA_ERROR_NOT_PERMITTED`, but this + is not required. The host function must not perform any synchronization + that may depend on outstanding CUDA work not mandated to run earlier. + Host functions without a mandated order (such as in independent + streams) execute in undefined order and may be serialized. + + For the purposes of Unified Memory, execution makes a number of + guarantees: + + - The stream is considered idle for the duration of the function's + execution. Thus, for example, the function may always use memory + attached to the stream it was enqueued in. + + - The start of execution of the function has the same effect as + synchronizing an event recorded in the same stream immediately prior + to the function. It thus synchronizes streams which have been + "joined" prior to the function. + + - Adding device work to any stream does not have the effect of making + the stream active until all preceding host functions and stream + callbacks have executed. Thus, for example, a function might use + global attached memory even if work has been added to another stream, + if the work has been ordered behind the function call with an event. + + - Completion of the function does not cause a stream to become active + except as described above. The stream will remain idle if no device + work follows the function, and will remain idle across consecutive + host functions or stream callbacks without device work in between. + Thus, for example, stream synchronization can be done by signaling + from a host function at the end of the stream. + + Note that, in contrast to :py:obj:`~.cuStreamAddCallback`, the function + will not be called in the event of an error in the CUDA context. + + Parameters + ---------- + hStream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + Stream to enqueue function call in + fn : :py:obj:`~.CUhostFn` + The function to call once preceding stream operations are complete + userData : Any + User-specified data to be passed to the function + syncMode : unsigned int + Synchronization mode for the host function + + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_CONTEXT`, :py:obj:`~.CUDA_ERROR_INVALID_HANDLE`, :py:obj:`~.CUDA_ERROR_NOT_SUPPORTED` -{{if 'cuFuncSetBlockShape' in found_functions}} + See Also + -------- + :py:obj:`~.cuStreamCreate`, :py:obj:`~.cuStreamQuery`, :py:obj:`~.cuStreamSynchronize`, :py:obj:`~.cuStreamWaitEvent`, :py:obj:`~.cuStreamDestroy`, :py:obj:`~.cuMemAllocManaged`, :py:obj:`~.cuStreamAttachMemAsync`, :py:obj:`~.cuStreamAddCallback` + """ + cdef cydriver.CUhostFn cyfn + if fn is None: + pfn = 0 + elif isinstance(fn, (CUhostFn,)): + pfn = int(fn) + else: + pfn = int(CUhostFn(fn)) + cyfn = pfn + cdef cydriver.CUstream cyhStream + if hStream is None: + phStream = 0 + elif isinstance(hStream, (CUstream,)): + phStream = int(hStream) + else: + phStream = int(CUstream(hStream)) + cyhStream = phStream + cdef _HelperInputVoidPtrStruct cyuserDataHelper + cdef void* cyuserData = _helper_input_void_ptr(userData, &cyuserDataHelper) + with nogil: + err = cydriver.cuLaunchHostFunc_v2(cyhStream, cyfn, cyuserData, syncMode) + _helper_input_void_ptr_free(&cyuserDataHelper) + return (_CUresult(err),) @cython.embedsignature(True) def cuFuncSetBlockShape(hfunc, int x, int y, int z): @@ -34249,20 +43612,17 @@ def cuFuncSetBlockShape(hfunc, int x, int y, int z): -------- :py:obj:`~.cuFuncSetSharedSize`, :py:obj:`~.cuFuncSetCacheConfig`, :py:obj:`~.cuFuncGetAttribute`, :py:obj:`~.cuParamSetSize`, :py:obj:`~.cuParamSeti`, :py:obj:`~.cuParamSetf`, :py:obj:`~.cuParamSetv`, :py:obj:`~.cuLaunch`, :py:obj:`~.cuLaunchGrid`, :py:obj:`~.cuLaunchGridAsync`, :py:obj:`~.cuLaunchKernel` """ - cdef ccuda.CUfunction chfunc + cdef cydriver.CUfunction cyhfunc if hfunc is None: - chfunc = 0 + phfunc = 0 elif isinstance(hfunc, (CUfunction,)): phfunc = int(hfunc) - chfunc = phfunc else: phfunc = int(CUfunction(hfunc)) - chfunc = phfunc - err = ccuda.cuFuncSetBlockShape(chfunc, x, y, z) - return (CUresult(err),) -{{endif}} - -{{if 'cuFuncSetSharedSize' in found_functions}} + cyhfunc = phfunc + with nogil: + err = cydriver.cuFuncSetBlockShape(cyhfunc, x, y, z) + return (_CUresult(err),) @cython.embedsignature(True) def cuFuncSetSharedSize(hfunc, unsigned int numbytes): @@ -34290,20 +43650,17 @@ def cuFuncSetSharedSize(hfunc, unsigned int numbytes): -------- :py:obj:`~.cuFuncSetBlockShape`, :py:obj:`~.cuFuncSetCacheConfig`, :py:obj:`~.cuFuncGetAttribute`, :py:obj:`~.cuParamSetSize`, :py:obj:`~.cuParamSeti`, :py:obj:`~.cuParamSetf`, :py:obj:`~.cuParamSetv`, :py:obj:`~.cuLaunch`, :py:obj:`~.cuLaunchGrid`, :py:obj:`~.cuLaunchGridAsync`, :py:obj:`~.cuLaunchKernel` """ - cdef ccuda.CUfunction chfunc + cdef cydriver.CUfunction cyhfunc if hfunc is None: - chfunc = 0 + phfunc = 0 elif isinstance(hfunc, (CUfunction,)): phfunc = int(hfunc) - chfunc = phfunc else: phfunc = int(CUfunction(hfunc)) - chfunc = phfunc - err = ccuda.cuFuncSetSharedSize(chfunc, numbytes) - return (CUresult(err),) -{{endif}} - -{{if 'cuParamSetSize' in found_functions}} + cyhfunc = phfunc + with nogil: + err = cydriver.cuFuncSetSharedSize(cyhfunc, numbytes) + return (_CUresult(err),) @cython.embedsignature(True) def cuParamSetSize(hfunc, unsigned int numbytes): @@ -34330,20 +43687,17 @@ def cuParamSetSize(hfunc, unsigned int numbytes): -------- :py:obj:`~.cuFuncSetBlockShape`, :py:obj:`~.cuFuncSetSharedSize`, :py:obj:`~.cuFuncGetAttribute`, :py:obj:`~.cuParamSetf`, :py:obj:`~.cuParamSeti`, :py:obj:`~.cuParamSetv`, :py:obj:`~.cuLaunch`, :py:obj:`~.cuLaunchGrid`, :py:obj:`~.cuLaunchGridAsync`, :py:obj:`~.cuLaunchKernel` """ - cdef ccuda.CUfunction chfunc + cdef cydriver.CUfunction cyhfunc if hfunc is None: - chfunc = 0 + phfunc = 0 elif isinstance(hfunc, (CUfunction,)): phfunc = int(hfunc) - chfunc = phfunc else: phfunc = int(CUfunction(hfunc)) - chfunc = phfunc - err = ccuda.cuParamSetSize(chfunc, numbytes) - return (CUresult(err),) -{{endif}} - -{{if 'cuParamSeti' in found_functions}} + cyhfunc = phfunc + with nogil: + err = cydriver.cuParamSetSize(cyhfunc, numbytes) + return (_CUresult(err),) @cython.embedsignature(True) def cuParamSeti(hfunc, int offset, unsigned int value): @@ -34373,20 +43727,17 @@ def cuParamSeti(hfunc, int offset, unsigned int value): -------- :py:obj:`~.cuFuncSetBlockShape`, :py:obj:`~.cuFuncSetSharedSize`, :py:obj:`~.cuFuncGetAttribute`, :py:obj:`~.cuParamSetSize`, :py:obj:`~.cuParamSetf`, :py:obj:`~.cuParamSetv`, :py:obj:`~.cuLaunch`, :py:obj:`~.cuLaunchGrid`, :py:obj:`~.cuLaunchGridAsync`, :py:obj:`~.cuLaunchKernel` """ - cdef ccuda.CUfunction chfunc + cdef cydriver.CUfunction cyhfunc if hfunc is None: - chfunc = 0 + phfunc = 0 elif isinstance(hfunc, (CUfunction,)): phfunc = int(hfunc) - chfunc = phfunc else: phfunc = int(CUfunction(hfunc)) - chfunc = phfunc - err = ccuda.cuParamSeti(chfunc, offset, value) - return (CUresult(err),) -{{endif}} - -{{if 'cuParamSetf' in found_functions}} + cyhfunc = phfunc + with nogil: + err = cydriver.cuParamSeti(cyhfunc, offset, value) + return (_CUresult(err),) @cython.embedsignature(True) def cuParamSetf(hfunc, int offset, float value): @@ -34416,20 +43767,17 @@ def cuParamSetf(hfunc, int offset, float value): -------- :py:obj:`~.cuFuncSetBlockShape`, :py:obj:`~.cuFuncSetSharedSize`, :py:obj:`~.cuFuncGetAttribute`, :py:obj:`~.cuParamSetSize`, :py:obj:`~.cuParamSeti`, :py:obj:`~.cuParamSetv`, :py:obj:`~.cuLaunch`, :py:obj:`~.cuLaunchGrid`, :py:obj:`~.cuLaunchGridAsync`, :py:obj:`~.cuLaunchKernel` """ - cdef ccuda.CUfunction chfunc + cdef cydriver.CUfunction cyhfunc if hfunc is None: - chfunc = 0 + phfunc = 0 elif isinstance(hfunc, (CUfunction,)): phfunc = int(hfunc) - chfunc = phfunc else: phfunc = int(CUfunction(hfunc)) - chfunc = phfunc - err = ccuda.cuParamSetf(chfunc, offset, value) - return (CUresult(err),) -{{endif}} - -{{if 'cuParamSetv' in found_functions}} + cyhfunc = phfunc + with nogil: + err = cydriver.cuParamSetf(cyhfunc, offset, value) + return (_CUresult(err),) @cython.embedsignature(True) def cuParamSetv(hfunc, int offset, ptr, unsigned int numbytes): @@ -34461,22 +43809,20 @@ def cuParamSetv(hfunc, int offset, ptr, unsigned int numbytes): -------- :py:obj:`~.cuFuncSetBlockShape`, :py:obj:`~.cuFuncSetSharedSize`, :py:obj:`~.cuFuncGetAttribute`, :py:obj:`~.cuParamSetSize`, :py:obj:`~.cuParamSetf`, :py:obj:`~.cuParamSeti`, :py:obj:`~.cuLaunch`, :py:obj:`~.cuLaunchGrid`, :py:obj:`~.cuLaunchGridAsync`, :py:obj:`~.cuLaunchKernel` """ - cdef ccuda.CUfunction chfunc + cdef cydriver.CUfunction cyhfunc if hfunc is None: - chfunc = 0 + phfunc = 0 elif isinstance(hfunc, (CUfunction,)): phfunc = int(hfunc) - chfunc = phfunc else: phfunc = int(CUfunction(hfunc)) - chfunc = phfunc - cptr = utils.HelperInputVoidPtr(ptr) - cdef void* cptr_ptr = cptr.cptr - err = ccuda.cuParamSetv(chfunc, offset, cptr_ptr, numbytes) - return (CUresult(err),) -{{endif}} - -{{if 'cuLaunch' in found_functions}} + cyhfunc = phfunc + cdef _HelperInputVoidPtrStruct cyptrHelper + cdef void* cyptr = _helper_input_void_ptr(ptr, &cyptrHelper) + with nogil: + err = cydriver.cuParamSetv(cyhfunc, offset, cyptr, numbytes) + _helper_input_void_ptr_free(&cyptrHelper) + return (_CUresult(err),) @cython.embedsignature(True) def cuLaunch(f): @@ -34514,20 +43860,17 @@ def cuLaunch(f): -------- :py:obj:`~.cuFuncSetBlockShape`, :py:obj:`~.cuFuncSetSharedSize`, :py:obj:`~.cuFuncGetAttribute`, :py:obj:`~.cuParamSetSize`, :py:obj:`~.cuParamSetf`, :py:obj:`~.cuParamSeti`, :py:obj:`~.cuParamSetv`, :py:obj:`~.cuLaunchGrid`, :py:obj:`~.cuLaunchGridAsync`, :py:obj:`~.cuLaunchKernel` """ - cdef ccuda.CUfunction cf + cdef cydriver.CUfunction cyf if f is None: - cf = 0 + pf = 0 elif isinstance(f, (CUfunction,)): pf = int(f) - cf = pf else: pf = int(CUfunction(f)) - cf = pf - err = ccuda.cuLaunch(cf) - return (CUresult(err),) -{{endif}} - -{{if 'cuLaunchGrid' in found_functions}} + cyf = pf + with nogil: + err = cydriver.cuLaunch(cyf) + return (_CUresult(err),) @cython.embedsignature(True) def cuLaunchGrid(f, int grid_width, int grid_height): @@ -34569,20 +43912,17 @@ def cuLaunchGrid(f, int grid_width, int grid_height): -------- :py:obj:`~.cuFuncSetBlockShape`, :py:obj:`~.cuFuncSetSharedSize`, :py:obj:`~.cuFuncGetAttribute`, :py:obj:`~.cuParamSetSize`, :py:obj:`~.cuParamSetf`, :py:obj:`~.cuParamSeti`, :py:obj:`~.cuParamSetv`, :py:obj:`~.cuLaunch`, :py:obj:`~.cuLaunchGridAsync`, :py:obj:`~.cuLaunchKernel` """ - cdef ccuda.CUfunction cf + cdef cydriver.CUfunction cyf if f is None: - cf = 0 + pf = 0 elif isinstance(f, (CUfunction,)): pf = int(f) - cf = pf else: pf = int(CUfunction(f)) - cf = pf - err = ccuda.cuLaunchGrid(cf, grid_width, grid_height) - return (CUresult(err),) -{{endif}} - -{{if 'cuLaunchGridAsync' in found_functions}} + cyf = pf + with nogil: + err = cydriver.cuLaunchGrid(cyf, grid_width, grid_height) + return (_CUresult(err),) @cython.embedsignature(True) def cuLaunchGridAsync(f, int grid_width, int grid_height, hStream): @@ -34630,31 +43970,198 @@ def cuLaunchGridAsync(f, int grid_width, int grid_height, hStream): Notes ----- - In certain cases where cubins are created with no ABI (i.e., using `ptxas` `None` `no`), this function may serialize kernel launches. The CUDA driver retains asynchronous behavior by growing the per-thread stack as needed per launch and not shrinking it afterwards. + In certain cases where cubins are created with no ABI (i.e., using `ptxas` `--abi-compile` `no`), this function may serialize kernel launches. The CUDA driver retains asynchronous behavior by growing the per-thread stack as needed per launch and not shrinking it afterwards. """ - cdef ccuda.CUstream chStream + cdef cydriver.CUstream cyhStream if hStream is None: - chStream = 0 + phStream = 0 elif isinstance(hStream, (CUstream,)): phStream = int(hStream) - chStream = phStream else: phStream = int(CUstream(hStream)) - chStream = phStream - cdef ccuda.CUfunction cf + cyhStream = phStream + cdef cydriver.CUfunction cyf if f is None: - cf = 0 + pf = 0 elif isinstance(f, (CUfunction,)): pf = int(f) - cf = pf else: pf = int(CUfunction(f)) - cf = pf - err = ccuda.cuLaunchGridAsync(cf, grid_width, grid_height, chStream) - return (CUresult(err),) -{{endif}} + cyf = pf + with nogil: + err = cydriver.cuLaunchGridAsync(cyf, grid_width, grid_height, cyhStream) + return (_CUresult(err),) + +@cython.embedsignature(True) +def cuLaunchCooperativeKernelMultiDevice(launchParamsList : Optional[tuple[CUDA_LAUNCH_PARAMS] | list[CUDA_LAUNCH_PARAMS]], unsigned int numDevices, unsigned int flags): + """ Launches CUDA functions on multiple devices where thread blocks can cooperate and synchronize as they execute. + + [Deprecated] + + Invokes kernels as specified in the `launchParamsList` array where each + element of the array specifies all the parameters required to perform a + single kernel launch. These kernels can cooperate and synchronize as + they execute. The size of the array is specified by `numDevices`. -{{if 'cuParamSetTexRef' in found_functions}} + No two kernels can be launched on the same device. All the devices + targeted by this multi-device launch must be identical. All devices + must have a non-zero value for the device attribute + :py:obj:`~.CU_DEVICE_ATTRIBUTE_COOPERATIVE_MULTI_DEVICE_LAUNCH`. + + All kernels launched must be identical with respect to the compiled + code. Note that any device, constant or managed variables present in + the module that owns the kernel launched on each device, are + independently instantiated on every device. It is the application's + responsibility to ensure these variables are initialized and used + appropriately. + + The size of the grids as specified in blocks, the size of the blocks + themselves and the amount of shared memory used by each thread block + must also match across all launched kernels. + + The streams used to launch these kernels must have been created via + either :py:obj:`~.cuStreamCreate` or + :py:obj:`~.cuStreamCreateWithPriority`. The NULL stream or + :py:obj:`~.CU_STREAM_LEGACY` or :py:obj:`~.CU_STREAM_PER_THREAD` cannot + be used. + + The total number of blocks launched per kernel cannot exceed the + maximum number of blocks per multiprocessor as returned by + :py:obj:`~.cuOccupancyMaxActiveBlocksPerMultiprocessor` (or + :py:obj:`~.cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags`) times + the number of multiprocessors as specified by the device attribute + :py:obj:`~.CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT`. Since the total + number of blocks launched per device has to match across all devices, + the maximum number of blocks that can be launched per device will be + limited by the device with the least number of multiprocessors. + + The kernels cannot make use of CUDA dynamic parallelism. + + The :py:obj:`~.CUDA_LAUNCH_PARAMS` structure is defined as: + + **View CUDA Toolkit Documentation for a C++ code example** + + where: + + - :py:obj:`~.CUDA_LAUNCH_PARAMS.function` specifies the kernel to be + launched. All functions must be identical with respect to the + compiled code. Note that you can also specify context-less kernel + :py:obj:`~.CUkernel` by querying the handle using + :py:obj:`~.cuLibraryGetKernel()` and then casting to + :py:obj:`~.CUfunction`. In this case, the context to launch the + kernel on be taken from the specified stream + :py:obj:`~.CUDA_LAUNCH_PARAMS.hStream`. + + - :py:obj:`~.CUDA_LAUNCH_PARAMS.gridDimX` is the width of the grid in + blocks. This must match across all kernels launched. + + - :py:obj:`~.CUDA_LAUNCH_PARAMS.gridDimY` is the height of the grid in + blocks. This must match across all kernels launched. + + - :py:obj:`~.CUDA_LAUNCH_PARAMS.gridDimZ` is the depth of the grid in + blocks. This must match across all kernels launched. + + - :py:obj:`~.CUDA_LAUNCH_PARAMS.blockDimX` is the X dimension of each + thread block. This must match across all kernels launched. + + - :py:obj:`~.CUDA_LAUNCH_PARAMS.blockDimX` is the Y dimension of each + thread block. This must match across all kernels launched. + + - :py:obj:`~.CUDA_LAUNCH_PARAMS.blockDimZ` is the Z dimension of each + thread block. This must match across all kernels launched. + + - :py:obj:`~.CUDA_LAUNCH_PARAMS.sharedMemBytes` is the dynamic shared- + memory size per thread block in bytes. This must match across all + kernels launched. + + - :py:obj:`~.CUDA_LAUNCH_PARAMS.hStream` is the handle to the stream to + perform the launch in. This cannot be the NULL stream or + :py:obj:`~.CU_STREAM_LEGACY` or :py:obj:`~.CU_STREAM_PER_THREAD`. The + CUDA context associated with this stream must match that associated + with :py:obj:`~.CUDA_LAUNCH_PARAMS.function`. + + - :py:obj:`~.CUDA_LAUNCH_PARAMS.kernelParams` is an array of pointers + to kernel parameters. If :py:obj:`~.CUDA_LAUNCH_PARAMS.function` has + N parameters, then :py:obj:`~.CUDA_LAUNCH_PARAMS.kernelParams` needs + to be an array of N pointers. Each of + :py:obj:`~.CUDA_LAUNCH_PARAMS.kernelParams`[0] through + :py:obj:`~.CUDA_LAUNCH_PARAMS.kernelParams`[N-1] must point to a + region of memory from which the actual kernel parameter will be + copied. The number of kernel parameters and their offsets and sizes + do not need to be specified as that information is retrieved directly + from the kernel's image. + + By default, the kernel won't begin execution on any GPU until all prior + work in all the specified streams has completed. This behavior can be + overridden by specifying the flag + :py:obj:`~.CUDA_COOPERATIVE_LAUNCH_MULTI_DEVICE_NO_PRE_LAUNCH_SYNC`. + When this flag is specified, each kernel will only wait for prior work + in the stream corresponding to that GPU to complete before it begins + execution. + + Similarly, by default, any subsequent work pushed in any of the + specified streams will not begin execution until the kernels on all + GPUs have completed. This behavior can be overridden by specifying the + flag + :py:obj:`~.CUDA_COOPERATIVE_LAUNCH_MULTI_DEVICE_NO_POST_LAUNCH_SYNC`. + When this flag is specified, any subsequent work pushed in any of the + specified streams will only wait for the kernel launched on the GPU + corresponding to that stream to complete before it begins execution. + + Calling :py:obj:`~.cuLaunchCooperativeKernelMultiDevice()` sets + persistent function state that is the same as function state set + through :py:obj:`~.cuLaunchKernel` API when called individually for + each element in `launchParamsList`. + + When kernels are launched via + :py:obj:`~.cuLaunchCooperativeKernelMultiDevice()`, the previous block + shape, shared size and parameter info associated with each + :py:obj:`~.CUDA_LAUNCH_PARAMS.function` in `launchParamsList` is + overwritten. + + Note that to use :py:obj:`~.cuLaunchCooperativeKernelMultiDevice()`, + the kernels must either have been compiled with toolchain version 3.2 + or later so that it will contain kernel parameter information, or have + no kernel parameters. If either of these conditions is not met, then + :py:obj:`~.cuLaunchCooperativeKernelMultiDevice()` will return + :py:obj:`~.CUDA_ERROR_INVALID_IMAGE`. + + Parameters + ---------- + launchParamsList : list[:py:obj:`~.CUDA_LAUNCH_PARAMS`] + List of launch parameters, one per device + numDevices : unsigned int + Size of the `launchParamsList` array + flags : unsigned int + Flags to control launch behavior + + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_CONTEXT`, :py:obj:`~.CUDA_ERROR_INVALID_HANDLE`, :py:obj:`~.CUDA_ERROR_INVALID_IMAGE`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_LAUNCH_FAILED`, :py:obj:`~.CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES`, :py:obj:`~.CUDA_ERROR_LAUNCH_TIMEOUT`, :py:obj:`~.CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING`, :py:obj:`~.CUDA_ERROR_COOPERATIVE_LAUNCH_TOO_LARGE`, :py:obj:`~.CUDA_ERROR_SHARED_OBJECT_INIT_FAILED` + + See Also + -------- + :py:obj:`~.cuCtxGetCacheConfig`, :py:obj:`~.cuCtxSetCacheConfig`, :py:obj:`~.cuFuncSetCacheConfig`, :py:obj:`~.cuFuncGetAttribute`, :py:obj:`~.cuLaunchCooperativeKernel`, :py:obj:`~.cudaLaunchCooperativeKernelMultiDevice` + """ + launchParamsList = [] if launchParamsList is None else launchParamsList + if not all(isinstance(_x, (CUDA_LAUNCH_PARAMS,)) for _x in launchParamsList): + raise TypeError("Argument 'launchParamsList' is not instance of type (expected tuple[cydriver.CUDA_LAUNCH_PARAMS,] or list[cydriver.CUDA_LAUNCH_PARAMS,]") + cdef cydriver.CUDA_LAUNCH_PARAMS* cylaunchParamsList = NULL + if len(launchParamsList) > 1: + cylaunchParamsList = calloc(len(launchParamsList), sizeof(cydriver.CUDA_LAUNCH_PARAMS)) + if cylaunchParamsList is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(launchParamsList)) + 'x' + str(sizeof(cydriver.CUDA_LAUNCH_PARAMS))) + for idx in range(len(launchParamsList)): + string.memcpy(&cylaunchParamsList[idx], (launchParamsList[idx])._pvt_ptr, sizeof(cydriver.CUDA_LAUNCH_PARAMS)) + elif len(launchParamsList) == 1: + cylaunchParamsList = (launchParamsList[0])._pvt_ptr + if numDevices > len(launchParamsList): raise RuntimeError("List is too small: " + str(len(launchParamsList)) + " < " + str(numDevices)) + with nogil: + err = cydriver.cuLaunchCooperativeKernelMultiDevice(cylaunchParamsList, numDevices, flags) + if len(launchParamsList) > 1 and cylaunchParamsList is not NULL: + free(cylaunchParamsList) + return (_CUresult(err),) @cython.embedsignature(True) def cuParamSetTexRef(hfunc, int texunit, hTexRef): @@ -34682,29 +44189,25 @@ def cuParamSetTexRef(hfunc, int texunit, hTexRef): CUresult :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_CONTEXT`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE` """ - cdef ccuda.CUtexref chTexRef + cdef cydriver.CUtexref cyhTexRef if hTexRef is None: - chTexRef = 0 + phTexRef = 0 elif isinstance(hTexRef, (CUtexref,)): phTexRef = int(hTexRef) - chTexRef = phTexRef else: phTexRef = int(CUtexref(hTexRef)) - chTexRef = phTexRef - cdef ccuda.CUfunction chfunc + cyhTexRef = phTexRef + cdef cydriver.CUfunction cyhfunc if hfunc is None: - chfunc = 0 + phfunc = 0 elif isinstance(hfunc, (CUfunction,)): phfunc = int(hfunc) - chfunc = phfunc else: phfunc = int(CUfunction(hfunc)) - chfunc = phfunc - err = ccuda.cuParamSetTexRef(chfunc, texunit, chTexRef) - return (CUresult(err),) -{{endif}} - -{{if 'cuFuncSetSharedMemConfig' in found_functions}} + cyhfunc = phfunc + with nogil: + err = cydriver.cuParamSetTexRef(cyhfunc, texunit, cyhTexRef) + return (_CUresult(err),) @cython.embedsignature(True) def cuFuncSetSharedMemConfig(hfunc, config not None : CUsharedconfig): @@ -34763,21 +44266,18 @@ def cuFuncSetSharedMemConfig(hfunc, config not None : CUsharedconfig): -------- :py:obj:`~.cuCtxGetCacheConfig`, :py:obj:`~.cuCtxSetCacheConfig`, :py:obj:`~.cuCtxGetSharedMemConfig`, :py:obj:`~.cuCtxSetSharedMemConfig`, :py:obj:`~.cuFuncGetAttribute`, :py:obj:`~.cuLaunchKernel`, :py:obj:`~.cudaFuncSetSharedMemConfig` """ - cdef ccuda.CUfunction chfunc + cdef cydriver.CUfunction cyhfunc if hfunc is None: - chfunc = 0 + phfunc = 0 elif isinstance(hfunc, (CUfunction,)): phfunc = int(hfunc) - chfunc = phfunc else: phfunc = int(CUfunction(hfunc)) - chfunc = phfunc - cdef ccuda.CUsharedconfig cconfig = config.value - err = ccuda.cuFuncSetSharedMemConfig(chfunc, cconfig) - return (CUresult(err),) -{{endif}} - -{{if 'cuGraphCreate' in found_functions}} + cyhfunc = phfunc + cdef cydriver.CUsharedconfig cyconfig = int(config) + with nogil: + err = cydriver.cuFuncSetSharedMemConfig(cyhfunc, cyconfig) + return (_CUresult(err),) @cython.embedsignature(True) def cuGraphCreate(unsigned int flags): @@ -34802,14 +44302,14 @@ def cuGraphCreate(unsigned int flags): :py:obj:`~.cuGraphAddChildGraphNode`, :py:obj:`~.cuGraphAddEmptyNode`, :py:obj:`~.cuGraphAddKernelNode`, :py:obj:`~.cuGraphAddHostNode`, :py:obj:`~.cuGraphAddMemcpyNode`, :py:obj:`~.cuGraphAddMemsetNode`, :py:obj:`~.cuGraphInstantiate`, :py:obj:`~.cuGraphDestroy`, :py:obj:`~.cuGraphGetNodes`, :py:obj:`~.cuGraphGetRootNodes`, :py:obj:`~.cuGraphGetEdges`, :py:obj:`~.cuGraphClone` """ cdef CUgraph phGraph = CUgraph() - err = ccuda.cuGraphCreate(phGraph._ptr, flags) - return (CUresult(err), phGraph) -{{endif}} - -{{if 'cuGraphAddKernelNode_v2' in found_functions}} + with nogil: + err = cydriver.cuGraphCreate(phGraph._pvt_ptr, flags) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, phGraph) @cython.embedsignature(True) -def cuGraphAddKernelNode(hGraph, dependencies : Optional[List[CUgraphNode]], size_t numDependencies, nodeParams : Optional[CUDA_KERNEL_NODE_PARAMS]): +def cuGraphAddKernelNode(hGraph, dependencies : Optional[tuple[CUgraphNode] | list[CUgraphNode]], size_t numDependencies, nodeParams : Optional[CUDA_KERNEL_NODE_PARAMS]): """ Creates a kernel execution node and adds it to a graph. Creates a new kernel execution node and adds it to `hGraph` with @@ -34819,7 +44319,7 @@ def cuGraphAddKernelNode(hGraph, dependencies : Optional[List[CUgraphNode]], siz root of the graph. `dependencies` may not have any duplicate entries. A handle to the new node will be returned in `phGraphNode`. - The CUDA_KERNEL_NODE_PARAMS structure is defined as: + The :py:obj:`~.CUDA_KERNEL_NODE_PARAMS` structure is defined as: **View CUDA Toolkit Documentation for a C++ code example** @@ -34875,7 +44375,7 @@ def cuGraphAddKernelNode(hGraph, dependencies : Optional[List[CUgraphNode]], siz ---------- hGraph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` Graph to which to add the node - dependencies : List[:py:obj:`~.CUgraphNode`] + dependencies : list[:py:obj:`~.CUgraphNode`] Dependencies of the node numDependencies : size_t Number of dependencies @@ -34899,34 +44399,35 @@ def cuGraphAddKernelNode(hGraph, dependencies : Optional[List[CUgraphNode]], siz """ dependencies = [] if dependencies is None else dependencies if not all(isinstance(_x, (CUgraphNode,)) for _x in dependencies): - raise TypeError("Argument 'dependencies' is not instance of type (expected List[ccuda.CUgraphNode,]") - cdef ccuda.CUgraph chGraph + raise TypeError("Argument 'dependencies' is not instance of type (expected tuple[cydriver.CUgraphNode,] or list[cydriver.CUgraphNode,]") + cdef cydriver.CUgraph cyhGraph if hGraph is None: - chGraph = 0 + phGraph = 0 elif isinstance(hGraph, (CUgraph,)): phGraph = int(hGraph) - chGraph = phGraph else: phGraph = int(CUgraph(hGraph)) - chGraph = phGraph + cyhGraph = phGraph cdef CUgraphNode phGraphNode = CUgraphNode() - cdef ccuda.CUgraphNode* cdependencies = NULL - if len(dependencies) > 0: - cdependencies = calloc(len(dependencies), sizeof(ccuda.CUgraphNode)) - if cdependencies is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(dependencies)) + 'x' + str(sizeof(ccuda.CUgraphNode))) + cdef cydriver.CUgraphNode* cydependencies = NULL + if len(dependencies) > 1: + cydependencies = calloc(len(dependencies), sizeof(cydriver.CUgraphNode)) + if cydependencies is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(dependencies)) + 'x' + str(sizeof(cydriver.CUgraphNode))) else: for idx in range(len(dependencies)): - cdependencies[idx] = (dependencies[idx])._ptr[0] + cydependencies[idx] = (dependencies[idx])._pvt_ptr[0] + elif len(dependencies) == 1: + cydependencies = (dependencies[0])._pvt_ptr if numDependencies > len(dependencies): raise RuntimeError("List is too small: " + str(len(dependencies)) + " < " + str(numDependencies)) - cdef ccuda.CUDA_KERNEL_NODE_PARAMS* cnodeParams_ptr = nodeParams._ptr if nodeParams != None else NULL - err = ccuda.cuGraphAddKernelNode(phGraphNode._ptr, chGraph, (dependencies[0])._ptr if len(dependencies) == 1 else cdependencies, numDependencies, cnodeParams_ptr) - if cdependencies is not NULL: - free(cdependencies) - return (CUresult(err), phGraphNode) -{{endif}} - -{{if 'cuGraphKernelNodeGetParams_v2' in found_functions}} + cdef cydriver.CUDA_KERNEL_NODE_PARAMS* cynodeParams_ptr = nodeParams._pvt_ptr if nodeParams is not None else NULL + with nogil: + err = cydriver.cuGraphAddKernelNode(phGraphNode._pvt_ptr, cyhGraph, cydependencies, numDependencies, cynodeParams_ptr) + if len(dependencies) > 1 and cydependencies is not NULL: + free(cydependencies) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, phGraphNode) @cython.embedsignature(True) def cuGraphKernelNodeGetParams(hNode): @@ -34957,23 +44458,22 @@ def cuGraphKernelNodeGetParams(hNode): See Also -------- - :py:obj:`~.cuLaunchKernel`, :py:obj:`~.cuGraphAddKernelNode`, :py:obj:`~.cuGraphKernelNodeSetParams` + :py:obj:`~.cuGraphNodeGetParams`, :py:obj:`~.cuLaunchKernel`, :py:obj:`~.cuGraphAddKernelNode`, :py:obj:`~.cuGraphKernelNodeSetParams` """ - cdef ccuda.CUgraphNode chNode + cdef cydriver.CUgraphNode cyhNode if hNode is None: - chNode = 0 + phNode = 0 elif isinstance(hNode, (CUgraphNode,)): phNode = int(hNode) - chNode = phNode else: phNode = int(CUgraphNode(hNode)) - chNode = phNode + cyhNode = phNode cdef CUDA_KERNEL_NODE_PARAMS nodeParams = CUDA_KERNEL_NODE_PARAMS() - err = ccuda.cuGraphKernelNodeGetParams(chNode, nodeParams._ptr) - return (CUresult(err), nodeParams) -{{endif}} - -{{if 'cuGraphKernelNodeSetParams_v2' in found_functions}} + with nogil: + err = cydriver.cuGraphKernelNodeGetParams(cyhNode, nodeParams._pvt_ptr) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, nodeParams) @cython.embedsignature(True) def cuGraphKernelNodeSetParams(hNode, nodeParams : Optional[CUDA_KERNEL_NODE_PARAMS]): @@ -34997,24 +44497,21 @@ def cuGraphKernelNodeSetParams(hNode, nodeParams : Optional[CUDA_KERNEL_NODE_PAR -------- :py:obj:`~.cuGraphNodeSetParams`, :py:obj:`~.cuLaunchKernel`, :py:obj:`~.cuGraphAddKernelNode`, :py:obj:`~.cuGraphKernelNodeGetParams` """ - cdef ccuda.CUgraphNode chNode + cdef cydriver.CUgraphNode cyhNode if hNode is None: - chNode = 0 + phNode = 0 elif isinstance(hNode, (CUgraphNode,)): phNode = int(hNode) - chNode = phNode else: phNode = int(CUgraphNode(hNode)) - chNode = phNode - cdef ccuda.CUDA_KERNEL_NODE_PARAMS* cnodeParams_ptr = nodeParams._ptr if nodeParams != None else NULL - err = ccuda.cuGraphKernelNodeSetParams(chNode, cnodeParams_ptr) - return (CUresult(err),) -{{endif}} - -{{if 'cuGraphAddMemcpyNode' in found_functions}} + cyhNode = phNode + cdef cydriver.CUDA_KERNEL_NODE_PARAMS* cynodeParams_ptr = nodeParams._pvt_ptr if nodeParams is not None else NULL + with nogil: + err = cydriver.cuGraphKernelNodeSetParams(cyhNode, cynodeParams_ptr) + return (_CUresult(err),) @cython.embedsignature(True) -def cuGraphAddMemcpyNode(hGraph, dependencies : Optional[List[CUgraphNode]], size_t numDependencies, copyParams : Optional[CUDA_MEMCPY3D], ctx): +def cuGraphAddMemcpyNode(hGraph, dependencies : Optional[tuple[CUgraphNode] | list[CUgraphNode]], size_t numDependencies, copyParams : Optional[CUDA_MEMCPY3D], ctx): """ Creates a memcpy node and adds it to a graph. Creates a new memcpy node and adds it to `hGraph` with @@ -35041,7 +44538,7 @@ def cuGraphAddMemcpyNode(hGraph, dependencies : Optional[List[CUgraphNode]], siz ---------- hGraph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` Graph to which to add the node - dependencies : List[:py:obj:`~.CUgraphNode`] + dependencies : list[:py:obj:`~.CUgraphNode`] Dependencies of the node numDependencies : size_t Number of dependencies @@ -35061,45 +44558,45 @@ def cuGraphAddMemcpyNode(hGraph, dependencies : Optional[List[CUgraphNode]], siz -------- :py:obj:`~.cuGraphAddNode`, :py:obj:`~.cuMemcpy3D`, :py:obj:`~.cuGraphMemcpyNodeGetParams`, :py:obj:`~.cuGraphMemcpyNodeSetParams`, :py:obj:`~.cuGraphCreate`, :py:obj:`~.cuGraphDestroyNode`, :py:obj:`~.cuGraphAddChildGraphNode`, :py:obj:`~.cuGraphAddEmptyNode`, :py:obj:`~.cuGraphAddKernelNode`, :py:obj:`~.cuGraphAddHostNode`, :py:obj:`~.cuGraphAddMemsetNode` """ - cdef ccuda.CUcontext cctx + cdef cydriver.CUcontext cyctx if ctx is None: - cctx = 0 + pctx = 0 elif isinstance(ctx, (CUcontext,)): pctx = int(ctx) - cctx = pctx else: pctx = int(CUcontext(ctx)) - cctx = pctx + cyctx = pctx dependencies = [] if dependencies is None else dependencies if not all(isinstance(_x, (CUgraphNode,)) for _x in dependencies): - raise TypeError("Argument 'dependencies' is not instance of type (expected List[ccuda.CUgraphNode,]") - cdef ccuda.CUgraph chGraph + raise TypeError("Argument 'dependencies' is not instance of type (expected tuple[cydriver.CUgraphNode,] or list[cydriver.CUgraphNode,]") + cdef cydriver.CUgraph cyhGraph if hGraph is None: - chGraph = 0 + phGraph = 0 elif isinstance(hGraph, (CUgraph,)): phGraph = int(hGraph) - chGraph = phGraph else: phGraph = int(CUgraph(hGraph)) - chGraph = phGraph + cyhGraph = phGraph cdef CUgraphNode phGraphNode = CUgraphNode() - cdef ccuda.CUgraphNode* cdependencies = NULL - if len(dependencies) > 0: - cdependencies = calloc(len(dependencies), sizeof(ccuda.CUgraphNode)) - if cdependencies is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(dependencies)) + 'x' + str(sizeof(ccuda.CUgraphNode))) + cdef cydriver.CUgraphNode* cydependencies = NULL + if len(dependencies) > 1: + cydependencies = calloc(len(dependencies), sizeof(cydriver.CUgraphNode)) + if cydependencies is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(dependencies)) + 'x' + str(sizeof(cydriver.CUgraphNode))) else: for idx in range(len(dependencies)): - cdependencies[idx] = (dependencies[idx])._ptr[0] + cydependencies[idx] = (dependencies[idx])._pvt_ptr[0] + elif len(dependencies) == 1: + cydependencies = (dependencies[0])._pvt_ptr if numDependencies > len(dependencies): raise RuntimeError("List is too small: " + str(len(dependencies)) + " < " + str(numDependencies)) - cdef ccuda.CUDA_MEMCPY3D* ccopyParams_ptr = copyParams._ptr if copyParams != None else NULL - err = ccuda.cuGraphAddMemcpyNode(phGraphNode._ptr, chGraph, (dependencies[0])._ptr if len(dependencies) == 1 else cdependencies, numDependencies, ccopyParams_ptr, cctx) - if cdependencies is not NULL: - free(cdependencies) - return (CUresult(err), phGraphNode) -{{endif}} - -{{if 'cuGraphMemcpyNodeGetParams' in found_functions}} + cdef cydriver.CUDA_MEMCPY3D* cycopyParams_ptr = copyParams._pvt_ptr if copyParams is not None else NULL + with nogil: + err = cydriver.cuGraphAddMemcpyNode(phGraphNode._pvt_ptr, cyhGraph, cydependencies, numDependencies, cycopyParams_ptr, cyctx) + if len(dependencies) > 1 and cydependencies is not NULL: + free(cydependencies) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, phGraphNode) @cython.embedsignature(True) def cuGraphMemcpyNodeGetParams(hNode): @@ -35121,23 +44618,22 @@ def cuGraphMemcpyNodeGetParams(hNode): See Also -------- - :py:obj:`~.cuMemcpy3D`, :py:obj:`~.cuGraphAddMemcpyNode`, :py:obj:`~.cuGraphMemcpyNodeSetParams` + :py:obj:`~.cuGraphNodeGetParams`, :py:obj:`~.cuMemcpy3D`, :py:obj:`~.cuGraphAddMemcpyNode`, :py:obj:`~.cuGraphMemcpyNodeSetParams` """ - cdef ccuda.CUgraphNode chNode + cdef cydriver.CUgraphNode cyhNode if hNode is None: - chNode = 0 + phNode = 0 elif isinstance(hNode, (CUgraphNode,)): phNode = int(hNode) - chNode = phNode else: phNode = int(CUgraphNode(hNode)) - chNode = phNode + cyhNode = phNode cdef CUDA_MEMCPY3D nodeParams = CUDA_MEMCPY3D() - err = ccuda.cuGraphMemcpyNodeGetParams(chNode, nodeParams._ptr) - return (CUresult(err), nodeParams) -{{endif}} - -{{if 'cuGraphMemcpyNodeSetParams' in found_functions}} + with nogil: + err = cydriver.cuGraphMemcpyNodeGetParams(cyhNode, nodeParams._pvt_ptr) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, nodeParams) @cython.embedsignature(True) def cuGraphMemcpyNodeSetParams(hNode, nodeParams : Optional[CUDA_MEMCPY3D]): @@ -35161,24 +44657,21 @@ def cuGraphMemcpyNodeSetParams(hNode, nodeParams : Optional[CUDA_MEMCPY3D]): -------- :py:obj:`~.cuGraphNodeSetParams`, :py:obj:`~.cuMemcpy3D`, :py:obj:`~.cuGraphAddMemcpyNode`, :py:obj:`~.cuGraphMemcpyNodeGetParams` """ - cdef ccuda.CUgraphNode chNode + cdef cydriver.CUgraphNode cyhNode if hNode is None: - chNode = 0 + phNode = 0 elif isinstance(hNode, (CUgraphNode,)): phNode = int(hNode) - chNode = phNode else: phNode = int(CUgraphNode(hNode)) - chNode = phNode - cdef ccuda.CUDA_MEMCPY3D* cnodeParams_ptr = nodeParams._ptr if nodeParams != None else NULL - err = ccuda.cuGraphMemcpyNodeSetParams(chNode, cnodeParams_ptr) - return (CUresult(err),) -{{endif}} - -{{if 'cuGraphAddMemsetNode' in found_functions}} + cyhNode = phNode + cdef cydriver.CUDA_MEMCPY3D* cynodeParams_ptr = nodeParams._pvt_ptr if nodeParams is not None else NULL + with nogil: + err = cydriver.cuGraphMemcpyNodeSetParams(cyhNode, cynodeParams_ptr) + return (_CUresult(err),) @cython.embedsignature(True) -def cuGraphAddMemsetNode(hGraph, dependencies : Optional[List[CUgraphNode]], size_t numDependencies, memsetParams : Optional[CUDA_MEMSET_NODE_PARAMS], ctx): +def cuGraphAddMemsetNode(hGraph, dependencies : Optional[tuple[CUgraphNode] | list[CUgraphNode]], size_t numDependencies, memsetParams : Optional[CUDA_MEMSET_NODE_PARAMS], ctx): """ Creates a memset node and adds it to a graph. Creates a new memset node and adds it to `hGraph` with @@ -35195,7 +44688,7 @@ def cuGraphAddMemsetNode(hGraph, dependencies : Optional[List[CUgraphNode]], siz ---------- hGraph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` Graph to which to add the node - dependencies : List[:py:obj:`~.CUgraphNode`] + dependencies : list[:py:obj:`~.CUgraphNode`] Dependencies of the node numDependencies : size_t Number of dependencies @@ -35215,45 +44708,45 @@ def cuGraphAddMemsetNode(hGraph, dependencies : Optional[List[CUgraphNode]], siz -------- :py:obj:`~.cuGraphAddNode`, :py:obj:`~.cuMemsetD2D32`, :py:obj:`~.cuGraphMemsetNodeGetParams`, :py:obj:`~.cuGraphMemsetNodeSetParams`, :py:obj:`~.cuGraphCreate`, :py:obj:`~.cuGraphDestroyNode`, :py:obj:`~.cuGraphAddChildGraphNode`, :py:obj:`~.cuGraphAddEmptyNode`, :py:obj:`~.cuGraphAddKernelNode`, :py:obj:`~.cuGraphAddHostNode`, :py:obj:`~.cuGraphAddMemcpyNode` """ - cdef ccuda.CUcontext cctx + cdef cydriver.CUcontext cyctx if ctx is None: - cctx = 0 + pctx = 0 elif isinstance(ctx, (CUcontext,)): pctx = int(ctx) - cctx = pctx else: pctx = int(CUcontext(ctx)) - cctx = pctx + cyctx = pctx dependencies = [] if dependencies is None else dependencies if not all(isinstance(_x, (CUgraphNode,)) for _x in dependencies): - raise TypeError("Argument 'dependencies' is not instance of type (expected List[ccuda.CUgraphNode,]") - cdef ccuda.CUgraph chGraph + raise TypeError("Argument 'dependencies' is not instance of type (expected tuple[cydriver.CUgraphNode,] or list[cydriver.CUgraphNode,]") + cdef cydriver.CUgraph cyhGraph if hGraph is None: - chGraph = 0 + phGraph = 0 elif isinstance(hGraph, (CUgraph,)): phGraph = int(hGraph) - chGraph = phGraph else: phGraph = int(CUgraph(hGraph)) - chGraph = phGraph + cyhGraph = phGraph cdef CUgraphNode phGraphNode = CUgraphNode() - cdef ccuda.CUgraphNode* cdependencies = NULL - if len(dependencies) > 0: - cdependencies = calloc(len(dependencies), sizeof(ccuda.CUgraphNode)) - if cdependencies is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(dependencies)) + 'x' + str(sizeof(ccuda.CUgraphNode))) + cdef cydriver.CUgraphNode* cydependencies = NULL + if len(dependencies) > 1: + cydependencies = calloc(len(dependencies), sizeof(cydriver.CUgraphNode)) + if cydependencies is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(dependencies)) + 'x' + str(sizeof(cydriver.CUgraphNode))) else: for idx in range(len(dependencies)): - cdependencies[idx] = (dependencies[idx])._ptr[0] + cydependencies[idx] = (dependencies[idx])._pvt_ptr[0] + elif len(dependencies) == 1: + cydependencies = (dependencies[0])._pvt_ptr if numDependencies > len(dependencies): raise RuntimeError("List is too small: " + str(len(dependencies)) + " < " + str(numDependencies)) - cdef ccuda.CUDA_MEMSET_NODE_PARAMS* cmemsetParams_ptr = memsetParams._ptr if memsetParams != None else NULL - err = ccuda.cuGraphAddMemsetNode(phGraphNode._ptr, chGraph, (dependencies[0])._ptr if len(dependencies) == 1 else cdependencies, numDependencies, cmemsetParams_ptr, cctx) - if cdependencies is not NULL: - free(cdependencies) - return (CUresult(err), phGraphNode) -{{endif}} - -{{if 'cuGraphMemsetNodeGetParams' in found_functions}} + cdef cydriver.CUDA_MEMSET_NODE_PARAMS* cymemsetParams_ptr = memsetParams._pvt_ptr if memsetParams is not None else NULL + with nogil: + err = cydriver.cuGraphAddMemsetNode(phGraphNode._pvt_ptr, cyhGraph, cydependencies, numDependencies, cymemsetParams_ptr, cyctx) + if len(dependencies) > 1 and cydependencies is not NULL: + free(cydependencies) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, phGraphNode) @cython.embedsignature(True) def cuGraphMemsetNodeGetParams(hNode): @@ -35275,23 +44768,22 @@ def cuGraphMemsetNodeGetParams(hNode): See Also -------- - :py:obj:`~.cuMemsetD2D32`, :py:obj:`~.cuGraphAddMemsetNode`, :py:obj:`~.cuGraphMemsetNodeSetParams` + :py:obj:`~.cuGraphNodeGetParams`, :py:obj:`~.cuMemsetD2D32`, :py:obj:`~.cuGraphAddMemsetNode`, :py:obj:`~.cuGraphMemsetNodeSetParams` """ - cdef ccuda.CUgraphNode chNode + cdef cydriver.CUgraphNode cyhNode if hNode is None: - chNode = 0 + phNode = 0 elif isinstance(hNode, (CUgraphNode,)): phNode = int(hNode) - chNode = phNode else: phNode = int(CUgraphNode(hNode)) - chNode = phNode + cyhNode = phNode cdef CUDA_MEMSET_NODE_PARAMS nodeParams = CUDA_MEMSET_NODE_PARAMS() - err = ccuda.cuGraphMemsetNodeGetParams(chNode, nodeParams._ptr) - return (CUresult(err), nodeParams) -{{endif}} - -{{if 'cuGraphMemsetNodeSetParams' in found_functions}} + with nogil: + err = cydriver.cuGraphMemsetNodeGetParams(cyhNode, nodeParams._pvt_ptr) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, nodeParams) @cython.embedsignature(True) def cuGraphMemsetNodeSetParams(hNode, nodeParams : Optional[CUDA_MEMSET_NODE_PARAMS]): @@ -35315,24 +44807,21 @@ def cuGraphMemsetNodeSetParams(hNode, nodeParams : Optional[CUDA_MEMSET_NODE_PAR -------- :py:obj:`~.cuGraphNodeSetParams`, :py:obj:`~.cuMemsetD2D32`, :py:obj:`~.cuGraphAddMemsetNode`, :py:obj:`~.cuGraphMemsetNodeGetParams` """ - cdef ccuda.CUgraphNode chNode + cdef cydriver.CUgraphNode cyhNode if hNode is None: - chNode = 0 + phNode = 0 elif isinstance(hNode, (CUgraphNode,)): phNode = int(hNode) - chNode = phNode else: phNode = int(CUgraphNode(hNode)) - chNode = phNode - cdef ccuda.CUDA_MEMSET_NODE_PARAMS* cnodeParams_ptr = nodeParams._ptr if nodeParams != None else NULL - err = ccuda.cuGraphMemsetNodeSetParams(chNode, cnodeParams_ptr) - return (CUresult(err),) -{{endif}} - -{{if 'cuGraphAddHostNode' in found_functions}} + cyhNode = phNode + cdef cydriver.CUDA_MEMSET_NODE_PARAMS* cynodeParams_ptr = nodeParams._pvt_ptr if nodeParams is not None else NULL + with nogil: + err = cydriver.cuGraphMemsetNodeSetParams(cyhNode, cynodeParams_ptr) + return (_CUresult(err),) @cython.embedsignature(True) -def cuGraphAddHostNode(hGraph, dependencies : Optional[List[CUgraphNode]], size_t numDependencies, nodeParams : Optional[CUDA_HOST_NODE_PARAMS]): +def cuGraphAddHostNode(hGraph, dependencies : Optional[tuple[CUgraphNode] | list[CUgraphNode]], size_t numDependencies, nodeParams : Optional[CUDA_HOST_NODE_PARAMS]): """ Creates a host execution node and adds it to a graph. Creates a new CPU execution node and adds it to `hGraph` with @@ -35349,7 +44838,7 @@ def cuGraphAddHostNode(hGraph, dependencies : Optional[List[CUgraphNode]], size_ ---------- hGraph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` Graph to which to add the node - dependencies : List[:py:obj:`~.CUgraphNode`] + dependencies : list[:py:obj:`~.CUgraphNode`] Dependencies of the node numDependencies : size_t Number of dependencies @@ -35369,34 +44858,35 @@ def cuGraphAddHostNode(hGraph, dependencies : Optional[List[CUgraphNode]], size_ """ dependencies = [] if dependencies is None else dependencies if not all(isinstance(_x, (CUgraphNode,)) for _x in dependencies): - raise TypeError("Argument 'dependencies' is not instance of type (expected List[ccuda.CUgraphNode,]") - cdef ccuda.CUgraph chGraph + raise TypeError("Argument 'dependencies' is not instance of type (expected tuple[cydriver.CUgraphNode,] or list[cydriver.CUgraphNode,]") + cdef cydriver.CUgraph cyhGraph if hGraph is None: - chGraph = 0 + phGraph = 0 elif isinstance(hGraph, (CUgraph,)): phGraph = int(hGraph) - chGraph = phGraph else: phGraph = int(CUgraph(hGraph)) - chGraph = phGraph + cyhGraph = phGraph cdef CUgraphNode phGraphNode = CUgraphNode() - cdef ccuda.CUgraphNode* cdependencies = NULL - if len(dependencies) > 0: - cdependencies = calloc(len(dependencies), sizeof(ccuda.CUgraphNode)) - if cdependencies is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(dependencies)) + 'x' + str(sizeof(ccuda.CUgraphNode))) + cdef cydriver.CUgraphNode* cydependencies = NULL + if len(dependencies) > 1: + cydependencies = calloc(len(dependencies), sizeof(cydriver.CUgraphNode)) + if cydependencies is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(dependencies)) + 'x' + str(sizeof(cydriver.CUgraphNode))) else: for idx in range(len(dependencies)): - cdependencies[idx] = (dependencies[idx])._ptr[0] + cydependencies[idx] = (dependencies[idx])._pvt_ptr[0] + elif len(dependencies) == 1: + cydependencies = (dependencies[0])._pvt_ptr if numDependencies > len(dependencies): raise RuntimeError("List is too small: " + str(len(dependencies)) + " < " + str(numDependencies)) - cdef ccuda.CUDA_HOST_NODE_PARAMS* cnodeParams_ptr = nodeParams._ptr if nodeParams != None else NULL - err = ccuda.cuGraphAddHostNode(phGraphNode._ptr, chGraph, (dependencies[0])._ptr if len(dependencies) == 1 else cdependencies, numDependencies, cnodeParams_ptr) - if cdependencies is not NULL: - free(cdependencies) - return (CUresult(err), phGraphNode) -{{endif}} - -{{if 'cuGraphHostNodeGetParams' in found_functions}} + cdef cydriver.CUDA_HOST_NODE_PARAMS* cynodeParams_ptr = nodeParams._pvt_ptr if nodeParams is not None else NULL + with nogil: + err = cydriver.cuGraphAddHostNode(phGraphNode._pvt_ptr, cyhGraph, cydependencies, numDependencies, cynodeParams_ptr) + if len(dependencies) > 1 and cydependencies is not NULL: + free(cydependencies) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, phGraphNode) @cython.embedsignature(True) def cuGraphHostNodeGetParams(hNode): @@ -35418,23 +44908,22 @@ def cuGraphHostNodeGetParams(hNode): See Also -------- - :py:obj:`~.cuLaunchHostFunc`, :py:obj:`~.cuGraphAddHostNode`, :py:obj:`~.cuGraphHostNodeSetParams` + :py:obj:`~.cuGraphNodeGetParams`, :py:obj:`~.cuLaunchHostFunc`, :py:obj:`~.cuGraphAddHostNode`, :py:obj:`~.cuGraphHostNodeSetParams` """ - cdef ccuda.CUgraphNode chNode + cdef cydriver.CUgraphNode cyhNode if hNode is None: - chNode = 0 + phNode = 0 elif isinstance(hNode, (CUgraphNode,)): phNode = int(hNode) - chNode = phNode else: phNode = int(CUgraphNode(hNode)) - chNode = phNode + cyhNode = phNode cdef CUDA_HOST_NODE_PARAMS nodeParams = CUDA_HOST_NODE_PARAMS() - err = ccuda.cuGraphHostNodeGetParams(chNode, nodeParams._ptr) - return (CUresult(err), nodeParams) -{{endif}} - -{{if 'cuGraphHostNodeSetParams' in found_functions}} + with nogil: + err = cydriver.cuGraphHostNodeGetParams(cyhNode, nodeParams._pvt_ptr) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, nodeParams) @cython.embedsignature(True) def cuGraphHostNodeSetParams(hNode, nodeParams : Optional[CUDA_HOST_NODE_PARAMS]): @@ -35458,24 +44947,21 @@ def cuGraphHostNodeSetParams(hNode, nodeParams : Optional[CUDA_HOST_NODE_PARAMS] -------- :py:obj:`~.cuGraphNodeSetParams`, :py:obj:`~.cuLaunchHostFunc`, :py:obj:`~.cuGraphAddHostNode`, :py:obj:`~.cuGraphHostNodeGetParams` """ - cdef ccuda.CUgraphNode chNode + cdef cydriver.CUgraphNode cyhNode if hNode is None: - chNode = 0 + phNode = 0 elif isinstance(hNode, (CUgraphNode,)): phNode = int(hNode) - chNode = phNode else: phNode = int(CUgraphNode(hNode)) - chNode = phNode - cdef ccuda.CUDA_HOST_NODE_PARAMS* cnodeParams_ptr = nodeParams._ptr if nodeParams != None else NULL - err = ccuda.cuGraphHostNodeSetParams(chNode, cnodeParams_ptr) - return (CUresult(err),) -{{endif}} - -{{if 'cuGraphAddChildGraphNode' in found_functions}} + cyhNode = phNode + cdef cydriver.CUDA_HOST_NODE_PARAMS* cynodeParams_ptr = nodeParams._pvt_ptr if nodeParams is not None else NULL + with nogil: + err = cydriver.cuGraphHostNodeSetParams(cyhNode, cynodeParams_ptr) + return (_CUresult(err),) @cython.embedsignature(True) -def cuGraphAddChildGraphNode(hGraph, dependencies : Optional[List[CUgraphNode]], size_t numDependencies, childGraph): +def cuGraphAddChildGraphNode(hGraph, dependencies : Optional[tuple[CUgraphNode] | list[CUgraphNode]], size_t numDependencies, childGraph): """ Creates a child graph node and adds it to a graph. Creates a new node which executes an embedded graph, and adds it to @@ -35485,8 +44971,8 @@ def cuGraphAddChildGraphNode(hGraph, dependencies : Optional[List[CUgraphNode]], may not have any duplicate entries. A handle to the new node will be returned in `phGraphNode`. - If `hGraph` contains allocation or free nodes, this call will return an - error. + If `childGraph` contains allocation nodes, free nodes, or conditional + nodes, this call will return an error. The node executes an embedded child graph. The child graph is cloned in this call. @@ -35495,7 +44981,7 @@ def cuGraphAddChildGraphNode(hGraph, dependencies : Optional[List[CUgraphNode]], ---------- hGraph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` Graph to which to add the node - dependencies : List[:py:obj:`~.CUgraphNode`] + dependencies : list[:py:obj:`~.CUgraphNode`] Dependencies of the node numDependencies : size_t Number of dependencies @@ -35513,44 +44999,44 @@ def cuGraphAddChildGraphNode(hGraph, dependencies : Optional[List[CUgraphNode]], -------- :py:obj:`~.cuGraphAddNode`, :py:obj:`~.cuGraphChildGraphNodeGetGraph`, :py:obj:`~.cuGraphCreate`, :py:obj:`~.cuGraphDestroyNode`, :py:obj:`~.cuGraphAddEmptyNode`, :py:obj:`~.cuGraphAddKernelNode`, :py:obj:`~.cuGraphAddHostNode`, :py:obj:`~.cuGraphAddMemcpyNode`, :py:obj:`~.cuGraphAddMemsetNode`, :py:obj:`~.cuGraphClone` """ - cdef ccuda.CUgraph cchildGraph + cdef cydriver.CUgraph cychildGraph if childGraph is None: - cchildGraph = 0 + pchildGraph = 0 elif isinstance(childGraph, (CUgraph,)): pchildGraph = int(childGraph) - cchildGraph = pchildGraph else: pchildGraph = int(CUgraph(childGraph)) - cchildGraph = pchildGraph + cychildGraph = pchildGraph dependencies = [] if dependencies is None else dependencies if not all(isinstance(_x, (CUgraphNode,)) for _x in dependencies): - raise TypeError("Argument 'dependencies' is not instance of type (expected List[ccuda.CUgraphNode,]") - cdef ccuda.CUgraph chGraph + raise TypeError("Argument 'dependencies' is not instance of type (expected tuple[cydriver.CUgraphNode,] or list[cydriver.CUgraphNode,]") + cdef cydriver.CUgraph cyhGraph if hGraph is None: - chGraph = 0 + phGraph = 0 elif isinstance(hGraph, (CUgraph,)): phGraph = int(hGraph) - chGraph = phGraph else: phGraph = int(CUgraph(hGraph)) - chGraph = phGraph + cyhGraph = phGraph cdef CUgraphNode phGraphNode = CUgraphNode() - cdef ccuda.CUgraphNode* cdependencies = NULL - if len(dependencies) > 0: - cdependencies = calloc(len(dependencies), sizeof(ccuda.CUgraphNode)) - if cdependencies is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(dependencies)) + 'x' + str(sizeof(ccuda.CUgraphNode))) + cdef cydriver.CUgraphNode* cydependencies = NULL + if len(dependencies) > 1: + cydependencies = calloc(len(dependencies), sizeof(cydriver.CUgraphNode)) + if cydependencies is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(dependencies)) + 'x' + str(sizeof(cydriver.CUgraphNode))) else: for idx in range(len(dependencies)): - cdependencies[idx] = (dependencies[idx])._ptr[0] + cydependencies[idx] = (dependencies[idx])._pvt_ptr[0] + elif len(dependencies) == 1: + cydependencies = (dependencies[0])._pvt_ptr if numDependencies > len(dependencies): raise RuntimeError("List is too small: " + str(len(dependencies)) + " < " + str(numDependencies)) - err = ccuda.cuGraphAddChildGraphNode(phGraphNode._ptr, chGraph, (dependencies[0])._ptr if len(dependencies) == 1 else cdependencies, numDependencies, cchildGraph) - if cdependencies is not NULL: - free(cdependencies) - return (CUresult(err), phGraphNode) -{{endif}} - -{{if 'cuGraphChildGraphNodeGetGraph' in found_functions}} + with nogil: + err = cydriver.cuGraphAddChildGraphNode(phGraphNode._pvt_ptr, cyhGraph, cydependencies, numDependencies, cychildGraph) + if len(dependencies) > 1 and cydependencies is not NULL: + free(cydependencies) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, phGraphNode) @cython.embedsignature(True) def cuGraphChildGraphNodeGetGraph(hNode): @@ -35579,24 +45065,23 @@ def cuGraphChildGraphNodeGetGraph(hNode): -------- :py:obj:`~.cuGraphAddChildGraphNode`, :py:obj:`~.cuGraphNodeFindInClone` """ - cdef ccuda.CUgraphNode chNode + cdef cydriver.CUgraphNode cyhNode if hNode is None: - chNode = 0 + phNode = 0 elif isinstance(hNode, (CUgraphNode,)): phNode = int(hNode) - chNode = phNode else: phNode = int(CUgraphNode(hNode)) - chNode = phNode + cyhNode = phNode cdef CUgraph phGraph = CUgraph() - err = ccuda.cuGraphChildGraphNodeGetGraph(chNode, phGraph._ptr) - return (CUresult(err), phGraph) -{{endif}} - -{{if 'cuGraphAddEmptyNode' in found_functions}} + with nogil: + err = cydriver.cuGraphChildGraphNodeGetGraph(cyhNode, phGraph._pvt_ptr) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, phGraph) @cython.embedsignature(True) -def cuGraphAddEmptyNode(hGraph, dependencies : Optional[List[CUgraphNode]], size_t numDependencies): +def cuGraphAddEmptyNode(hGraph, dependencies : Optional[tuple[CUgraphNode] | list[CUgraphNode]], size_t numDependencies): """ Creates an empty node and adds it to a graph. Creates a new node which performs no operation, and adds it to `hGraph` @@ -35616,7 +45101,7 @@ def cuGraphAddEmptyNode(hGraph, dependencies : Optional[List[CUgraphNode]], size ---------- hGraph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` Graph to which to add the node - dependencies : List[:py:obj:`~.CUgraphNode`] + dependencies : list[:py:obj:`~.CUgraphNode`] Dependencies of the node numDependencies : size_t Number of dependencies @@ -35634,36 +45119,37 @@ def cuGraphAddEmptyNode(hGraph, dependencies : Optional[List[CUgraphNode]], size """ dependencies = [] if dependencies is None else dependencies if not all(isinstance(_x, (CUgraphNode,)) for _x in dependencies): - raise TypeError("Argument 'dependencies' is not instance of type (expected List[ccuda.CUgraphNode,]") - cdef ccuda.CUgraph chGraph + raise TypeError("Argument 'dependencies' is not instance of type (expected tuple[cydriver.CUgraphNode,] or list[cydriver.CUgraphNode,]") + cdef cydriver.CUgraph cyhGraph if hGraph is None: - chGraph = 0 + phGraph = 0 elif isinstance(hGraph, (CUgraph,)): phGraph = int(hGraph) - chGraph = phGraph else: phGraph = int(CUgraph(hGraph)) - chGraph = phGraph + cyhGraph = phGraph cdef CUgraphNode phGraphNode = CUgraphNode() - cdef ccuda.CUgraphNode* cdependencies = NULL - if len(dependencies) > 0: - cdependencies = calloc(len(dependencies), sizeof(ccuda.CUgraphNode)) - if cdependencies is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(dependencies)) + 'x' + str(sizeof(ccuda.CUgraphNode))) + cdef cydriver.CUgraphNode* cydependencies = NULL + if len(dependencies) > 1: + cydependencies = calloc(len(dependencies), sizeof(cydriver.CUgraphNode)) + if cydependencies is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(dependencies)) + 'x' + str(sizeof(cydriver.CUgraphNode))) else: for idx in range(len(dependencies)): - cdependencies[idx] = (dependencies[idx])._ptr[0] + cydependencies[idx] = (dependencies[idx])._pvt_ptr[0] + elif len(dependencies) == 1: + cydependencies = (dependencies[0])._pvt_ptr if numDependencies > len(dependencies): raise RuntimeError("List is too small: " + str(len(dependencies)) + " < " + str(numDependencies)) - err = ccuda.cuGraphAddEmptyNode(phGraphNode._ptr, chGraph, (dependencies[0])._ptr if len(dependencies) == 1 else cdependencies, numDependencies) - if cdependencies is not NULL: - free(cdependencies) - return (CUresult(err), phGraphNode) -{{endif}} - -{{if 'cuGraphAddEventRecordNode' in found_functions}} + with nogil: + err = cydriver.cuGraphAddEmptyNode(phGraphNode._pvt_ptr, cyhGraph, cydependencies, numDependencies) + if len(dependencies) > 1 and cydependencies is not NULL: + free(cydependencies) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, phGraphNode) @cython.embedsignature(True) -def cuGraphAddEventRecordNode(hGraph, dependencies : Optional[List[CUgraphNode]], size_t numDependencies, event): +def cuGraphAddEventRecordNode(hGraph, dependencies : Optional[tuple[CUgraphNode] | list[CUgraphNode]], size_t numDependencies, event): """ Creates an event record node and adds it to a graph. Creates a new event record node and adds it to `hGraph` with @@ -35680,7 +45166,7 @@ def cuGraphAddEventRecordNode(hGraph, dependencies : Optional[List[CUgraphNode]] ---------- hGraph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` Graph to which to add the node - dependencies : List[:py:obj:`~.CUgraphNode`] + dependencies : list[:py:obj:`~.CUgraphNode`] Dependencies of the node numDependencies : size_t Number of dependencies @@ -35698,44 +45184,44 @@ def cuGraphAddEventRecordNode(hGraph, dependencies : Optional[List[CUgraphNode]] -------- :py:obj:`~.cuGraphAddNode`, :py:obj:`~.cuGraphAddEventWaitNode`, :py:obj:`~.cuEventRecordWithFlags`, :py:obj:`~.cuStreamWaitEvent`, :py:obj:`~.cuGraphCreate`, :py:obj:`~.cuGraphDestroyNode`, :py:obj:`~.cuGraphAddChildGraphNode`, :py:obj:`~.cuGraphAddEmptyNode`, :py:obj:`~.cuGraphAddKernelNode`, :py:obj:`~.cuGraphAddMemcpyNode`, :py:obj:`~.cuGraphAddMemsetNode` """ - cdef ccuda.CUevent cevent + cdef cydriver.CUevent cyevent if event is None: - cevent = 0 + pevent = 0 elif isinstance(event, (CUevent,)): pevent = int(event) - cevent = pevent else: pevent = int(CUevent(event)) - cevent = pevent + cyevent = pevent dependencies = [] if dependencies is None else dependencies if not all(isinstance(_x, (CUgraphNode,)) for _x in dependencies): - raise TypeError("Argument 'dependencies' is not instance of type (expected List[ccuda.CUgraphNode,]") - cdef ccuda.CUgraph chGraph + raise TypeError("Argument 'dependencies' is not instance of type (expected tuple[cydriver.CUgraphNode,] or list[cydriver.CUgraphNode,]") + cdef cydriver.CUgraph cyhGraph if hGraph is None: - chGraph = 0 + phGraph = 0 elif isinstance(hGraph, (CUgraph,)): phGraph = int(hGraph) - chGraph = phGraph else: phGraph = int(CUgraph(hGraph)) - chGraph = phGraph + cyhGraph = phGraph cdef CUgraphNode phGraphNode = CUgraphNode() - cdef ccuda.CUgraphNode* cdependencies = NULL - if len(dependencies) > 0: - cdependencies = calloc(len(dependencies), sizeof(ccuda.CUgraphNode)) - if cdependencies is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(dependencies)) + 'x' + str(sizeof(ccuda.CUgraphNode))) + cdef cydriver.CUgraphNode* cydependencies = NULL + if len(dependencies) > 1: + cydependencies = calloc(len(dependencies), sizeof(cydriver.CUgraphNode)) + if cydependencies is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(dependencies)) + 'x' + str(sizeof(cydriver.CUgraphNode))) else: for idx in range(len(dependencies)): - cdependencies[idx] = (dependencies[idx])._ptr[0] + cydependencies[idx] = (dependencies[idx])._pvt_ptr[0] + elif len(dependencies) == 1: + cydependencies = (dependencies[0])._pvt_ptr if numDependencies > len(dependencies): raise RuntimeError("List is too small: " + str(len(dependencies)) + " < " + str(numDependencies)) - err = ccuda.cuGraphAddEventRecordNode(phGraphNode._ptr, chGraph, (dependencies[0])._ptr if len(dependencies) == 1 else cdependencies, numDependencies, cevent) - if cdependencies is not NULL: - free(cdependencies) - return (CUresult(err), phGraphNode) -{{endif}} - -{{if 'cuGraphEventRecordNodeGetEvent' in found_functions}} + with nogil: + err = cydriver.cuGraphAddEventRecordNode(phGraphNode._pvt_ptr, cyhGraph, cydependencies, numDependencies, cyevent) + if len(dependencies) > 1 and cydependencies is not NULL: + free(cydependencies) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, phGraphNode) @cython.embedsignature(True) def cuGraphEventRecordNodeGetEvent(hNode): @@ -35759,21 +45245,20 @@ def cuGraphEventRecordNodeGetEvent(hNode): -------- :py:obj:`~.cuGraphAddEventRecordNode`, :py:obj:`~.cuGraphEventRecordNodeSetEvent`, :py:obj:`~.cuGraphEventWaitNodeGetEvent`, :py:obj:`~.cuEventRecordWithFlags`, :py:obj:`~.cuStreamWaitEvent` """ - cdef ccuda.CUgraphNode chNode + cdef cydriver.CUgraphNode cyhNode if hNode is None: - chNode = 0 + phNode = 0 elif isinstance(hNode, (CUgraphNode,)): phNode = int(hNode) - chNode = phNode else: phNode = int(CUgraphNode(hNode)) - chNode = phNode + cyhNode = phNode cdef CUevent event_out = CUevent() - err = ccuda.cuGraphEventRecordNodeGetEvent(chNode, event_out._ptr) - return (CUresult(err), event_out) -{{endif}} - -{{if 'cuGraphEventRecordNodeSetEvent' in found_functions}} + with nogil: + err = cydriver.cuGraphEventRecordNodeGetEvent(cyhNode, event_out._pvt_ptr) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, event_out) @cython.embedsignature(True) def cuGraphEventRecordNodeSetEvent(hNode, event): @@ -35797,32 +45282,28 @@ def cuGraphEventRecordNodeSetEvent(hNode, event): -------- :py:obj:`~.cuGraphNodeSetParams`, :py:obj:`~.cuGraphAddEventRecordNode`, :py:obj:`~.cuGraphEventRecordNodeGetEvent`, :py:obj:`~.cuGraphEventWaitNodeSetEvent`, :py:obj:`~.cuEventRecordWithFlags`, :py:obj:`~.cuStreamWaitEvent` """ - cdef ccuda.CUevent cevent + cdef cydriver.CUevent cyevent if event is None: - cevent = 0 + pevent = 0 elif isinstance(event, (CUevent,)): pevent = int(event) - cevent = pevent else: pevent = int(CUevent(event)) - cevent = pevent - cdef ccuda.CUgraphNode chNode + cyevent = pevent + cdef cydriver.CUgraphNode cyhNode if hNode is None: - chNode = 0 + phNode = 0 elif isinstance(hNode, (CUgraphNode,)): phNode = int(hNode) - chNode = phNode else: phNode = int(CUgraphNode(hNode)) - chNode = phNode - err = ccuda.cuGraphEventRecordNodeSetEvent(chNode, cevent) - return (CUresult(err),) -{{endif}} - -{{if 'cuGraphAddEventWaitNode' in found_functions}} + cyhNode = phNode + with nogil: + err = cydriver.cuGraphEventRecordNodeSetEvent(cyhNode, cyevent) + return (_CUresult(err),) @cython.embedsignature(True) -def cuGraphAddEventWaitNode(hGraph, dependencies : Optional[List[CUgraphNode]], size_t numDependencies, event): +def cuGraphAddEventWaitNode(hGraph, dependencies : Optional[tuple[CUgraphNode] | list[CUgraphNode]], size_t numDependencies, event): """ Creates an event wait node and adds it to a graph. Creates a new event wait node and adds it to `hGraph` with @@ -35841,7 +45322,7 @@ def cuGraphAddEventWaitNode(hGraph, dependencies : Optional[List[CUgraphNode]], ---------- hGraph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` Graph to which to add the node - dependencies : List[:py:obj:`~.CUgraphNode`] + dependencies : list[:py:obj:`~.CUgraphNode`] Dependencies of the node numDependencies : size_t Number of dependencies @@ -35859,44 +45340,44 @@ def cuGraphAddEventWaitNode(hGraph, dependencies : Optional[List[CUgraphNode]], -------- :py:obj:`~.cuGraphAddNode`, :py:obj:`~.cuGraphAddEventRecordNode`, :py:obj:`~.cuEventRecordWithFlags`, :py:obj:`~.cuStreamWaitEvent`, :py:obj:`~.cuGraphCreate`, :py:obj:`~.cuGraphDestroyNode`, :py:obj:`~.cuGraphAddChildGraphNode`, :py:obj:`~.cuGraphAddEmptyNode`, :py:obj:`~.cuGraphAddKernelNode`, :py:obj:`~.cuGraphAddMemcpyNode`, :py:obj:`~.cuGraphAddMemsetNode` """ - cdef ccuda.CUevent cevent + cdef cydriver.CUevent cyevent if event is None: - cevent = 0 + pevent = 0 elif isinstance(event, (CUevent,)): pevent = int(event) - cevent = pevent else: pevent = int(CUevent(event)) - cevent = pevent + cyevent = pevent dependencies = [] if dependencies is None else dependencies if not all(isinstance(_x, (CUgraphNode,)) for _x in dependencies): - raise TypeError("Argument 'dependencies' is not instance of type (expected List[ccuda.CUgraphNode,]") - cdef ccuda.CUgraph chGraph + raise TypeError("Argument 'dependencies' is not instance of type (expected tuple[cydriver.CUgraphNode,] or list[cydriver.CUgraphNode,]") + cdef cydriver.CUgraph cyhGraph if hGraph is None: - chGraph = 0 + phGraph = 0 elif isinstance(hGraph, (CUgraph,)): phGraph = int(hGraph) - chGraph = phGraph else: phGraph = int(CUgraph(hGraph)) - chGraph = phGraph + cyhGraph = phGraph cdef CUgraphNode phGraphNode = CUgraphNode() - cdef ccuda.CUgraphNode* cdependencies = NULL - if len(dependencies) > 0: - cdependencies = calloc(len(dependencies), sizeof(ccuda.CUgraphNode)) - if cdependencies is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(dependencies)) + 'x' + str(sizeof(ccuda.CUgraphNode))) + cdef cydriver.CUgraphNode* cydependencies = NULL + if len(dependencies) > 1: + cydependencies = calloc(len(dependencies), sizeof(cydriver.CUgraphNode)) + if cydependencies is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(dependencies)) + 'x' + str(sizeof(cydriver.CUgraphNode))) else: for idx in range(len(dependencies)): - cdependencies[idx] = (dependencies[idx])._ptr[0] + cydependencies[idx] = (dependencies[idx])._pvt_ptr[0] + elif len(dependencies) == 1: + cydependencies = (dependencies[0])._pvt_ptr if numDependencies > len(dependencies): raise RuntimeError("List is too small: " + str(len(dependencies)) + " < " + str(numDependencies)) - err = ccuda.cuGraphAddEventWaitNode(phGraphNode._ptr, chGraph, (dependencies[0])._ptr if len(dependencies) == 1 else cdependencies, numDependencies, cevent) - if cdependencies is not NULL: - free(cdependencies) - return (CUresult(err), phGraphNode) -{{endif}} - -{{if 'cuGraphEventWaitNodeGetEvent' in found_functions}} + with nogil: + err = cydriver.cuGraphAddEventWaitNode(phGraphNode._pvt_ptr, cyhGraph, cydependencies, numDependencies, cyevent) + if len(dependencies) > 1 and cydependencies is not NULL: + free(cydependencies) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, phGraphNode) @cython.embedsignature(True) def cuGraphEventWaitNodeGetEvent(hNode): @@ -35920,21 +45401,20 @@ def cuGraphEventWaitNodeGetEvent(hNode): -------- :py:obj:`~.cuGraphAddEventWaitNode`, :py:obj:`~.cuGraphEventWaitNodeSetEvent`, :py:obj:`~.cuGraphEventRecordNodeGetEvent`, :py:obj:`~.cuEventRecordWithFlags`, :py:obj:`~.cuStreamWaitEvent` """ - cdef ccuda.CUgraphNode chNode + cdef cydriver.CUgraphNode cyhNode if hNode is None: - chNode = 0 + phNode = 0 elif isinstance(hNode, (CUgraphNode,)): phNode = int(hNode) - chNode = phNode else: phNode = int(CUgraphNode(hNode)) - chNode = phNode + cyhNode = phNode cdef CUevent event_out = CUevent() - err = ccuda.cuGraphEventWaitNodeGetEvent(chNode, event_out._ptr) - return (CUresult(err), event_out) -{{endif}} - -{{if 'cuGraphEventWaitNodeSetEvent' in found_functions}} + with nogil: + err = cydriver.cuGraphEventWaitNodeGetEvent(cyhNode, event_out._pvt_ptr) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, event_out) @cython.embedsignature(True) def cuGraphEventWaitNodeSetEvent(hNode, event): @@ -35958,32 +45438,28 @@ def cuGraphEventWaitNodeSetEvent(hNode, event): -------- :py:obj:`~.cuGraphNodeSetParams`, :py:obj:`~.cuGraphAddEventWaitNode`, :py:obj:`~.cuGraphEventWaitNodeGetEvent`, :py:obj:`~.cuGraphEventRecordNodeSetEvent`, :py:obj:`~.cuEventRecordWithFlags`, :py:obj:`~.cuStreamWaitEvent` """ - cdef ccuda.CUevent cevent + cdef cydriver.CUevent cyevent if event is None: - cevent = 0 + pevent = 0 elif isinstance(event, (CUevent,)): pevent = int(event) - cevent = pevent else: pevent = int(CUevent(event)) - cevent = pevent - cdef ccuda.CUgraphNode chNode + cyevent = pevent + cdef cydriver.CUgraphNode cyhNode if hNode is None: - chNode = 0 + phNode = 0 elif isinstance(hNode, (CUgraphNode,)): phNode = int(hNode) - chNode = phNode else: phNode = int(CUgraphNode(hNode)) - chNode = phNode - err = ccuda.cuGraphEventWaitNodeSetEvent(chNode, cevent) - return (CUresult(err),) -{{endif}} - -{{if 'cuGraphAddExternalSemaphoresSignalNode' in found_functions}} + cyhNode = phNode + with nogil: + err = cydriver.cuGraphEventWaitNodeSetEvent(cyhNode, cyevent) + return (_CUresult(err),) @cython.embedsignature(True) -def cuGraphAddExternalSemaphoresSignalNode(hGraph, dependencies : Optional[List[CUgraphNode]], size_t numDependencies, nodeParams : Optional[CUDA_EXT_SEM_SIGNAL_NODE_PARAMS]): +def cuGraphAddExternalSemaphoresSignalNode(hGraph, dependencies : Optional[tuple[CUgraphNode] | list[CUgraphNode]], size_t numDependencies, nodeParams : Optional[CUDA_EXT_SEM_SIGNAL_NODE_PARAMS]): """ Creates an external semaphore signal node and adds it to a graph. Creates a new external semaphore signal node and adds it to `hGraph` @@ -36001,7 +45477,7 @@ def cuGraphAddExternalSemaphoresSignalNode(hGraph, dependencies : Optional[List[ ---------- hGraph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` Graph to which to add the node - dependencies : List[:py:obj:`~.CUgraphNode`] + dependencies : list[:py:obj:`~.CUgraphNode`] Dependencies of the node numDependencies : size_t Number of dependencies @@ -36021,34 +45497,35 @@ def cuGraphAddExternalSemaphoresSignalNode(hGraph, dependencies : Optional[List[ """ dependencies = [] if dependencies is None else dependencies if not all(isinstance(_x, (CUgraphNode,)) for _x in dependencies): - raise TypeError("Argument 'dependencies' is not instance of type (expected List[ccuda.CUgraphNode,]") - cdef ccuda.CUgraph chGraph + raise TypeError("Argument 'dependencies' is not instance of type (expected tuple[cydriver.CUgraphNode,] or list[cydriver.CUgraphNode,]") + cdef cydriver.CUgraph cyhGraph if hGraph is None: - chGraph = 0 + phGraph = 0 elif isinstance(hGraph, (CUgraph,)): phGraph = int(hGraph) - chGraph = phGraph else: phGraph = int(CUgraph(hGraph)) - chGraph = phGraph + cyhGraph = phGraph cdef CUgraphNode phGraphNode = CUgraphNode() - cdef ccuda.CUgraphNode* cdependencies = NULL - if len(dependencies) > 0: - cdependencies = calloc(len(dependencies), sizeof(ccuda.CUgraphNode)) - if cdependencies is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(dependencies)) + 'x' + str(sizeof(ccuda.CUgraphNode))) + cdef cydriver.CUgraphNode* cydependencies = NULL + if len(dependencies) > 1: + cydependencies = calloc(len(dependencies), sizeof(cydriver.CUgraphNode)) + if cydependencies is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(dependencies)) + 'x' + str(sizeof(cydriver.CUgraphNode))) else: for idx in range(len(dependencies)): - cdependencies[idx] = (dependencies[idx])._ptr[0] + cydependencies[idx] = (dependencies[idx])._pvt_ptr[0] + elif len(dependencies) == 1: + cydependencies = (dependencies[0])._pvt_ptr if numDependencies > len(dependencies): raise RuntimeError("List is too small: " + str(len(dependencies)) + " < " + str(numDependencies)) - cdef ccuda.CUDA_EXT_SEM_SIGNAL_NODE_PARAMS* cnodeParams_ptr = nodeParams._ptr if nodeParams != None else NULL - err = ccuda.cuGraphAddExternalSemaphoresSignalNode(phGraphNode._ptr, chGraph, (dependencies[0])._ptr if len(dependencies) == 1 else cdependencies, numDependencies, cnodeParams_ptr) - if cdependencies is not NULL: - free(cdependencies) - return (CUresult(err), phGraphNode) -{{endif}} - -{{if 'cuGraphExternalSemaphoresSignalNodeGetParams' in found_functions}} + cdef cydriver.CUDA_EXT_SEM_SIGNAL_NODE_PARAMS* cynodeParams_ptr = nodeParams._pvt_ptr if nodeParams is not None else NULL + with nogil: + err = cydriver.cuGraphAddExternalSemaphoresSignalNode(phGraphNode._pvt_ptr, cyhGraph, cydependencies, numDependencies, cynodeParams_ptr) + if len(dependencies) > 1 and cydependencies is not NULL: + free(cydependencies) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, phGraphNode) @cython.embedsignature(True) def cuGraphExternalSemaphoresSignalNodeGetParams(hNode): @@ -36076,23 +45553,22 @@ def cuGraphExternalSemaphoresSignalNodeGetParams(hNode): See Also -------- - :py:obj:`~.cuLaunchKernel`, :py:obj:`~.cuGraphAddExternalSemaphoresSignalNode`, :py:obj:`~.cuGraphExternalSemaphoresSignalNodeSetParams`, :py:obj:`~.cuGraphAddExternalSemaphoresWaitNode`, :py:obj:`~.cuSignalExternalSemaphoresAsync`, :py:obj:`~.cuWaitExternalSemaphoresAsync` + :py:obj:`~.cuGraphNodeGetParams`, :py:obj:`~.cuLaunchKernel`, :py:obj:`~.cuGraphAddExternalSemaphoresSignalNode`, :py:obj:`~.cuGraphExternalSemaphoresSignalNodeSetParams`, :py:obj:`~.cuGraphAddExternalSemaphoresWaitNode`, :py:obj:`~.cuSignalExternalSemaphoresAsync`, :py:obj:`~.cuWaitExternalSemaphoresAsync` """ - cdef ccuda.CUgraphNode chNode + cdef cydriver.CUgraphNode cyhNode if hNode is None: - chNode = 0 + phNode = 0 elif isinstance(hNode, (CUgraphNode,)): phNode = int(hNode) - chNode = phNode else: phNode = int(CUgraphNode(hNode)) - chNode = phNode + cyhNode = phNode cdef CUDA_EXT_SEM_SIGNAL_NODE_PARAMS params_out = CUDA_EXT_SEM_SIGNAL_NODE_PARAMS() - err = ccuda.cuGraphExternalSemaphoresSignalNodeGetParams(chNode, params_out._ptr) - return (CUresult(err), params_out) -{{endif}} - -{{if 'cuGraphExternalSemaphoresSignalNodeSetParams' in found_functions}} + with nogil: + err = cydriver.cuGraphExternalSemaphoresSignalNodeGetParams(cyhNode, params_out._pvt_ptr) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, params_out) @cython.embedsignature(True) def cuGraphExternalSemaphoresSignalNodeSetParams(hNode, nodeParams : Optional[CUDA_EXT_SEM_SIGNAL_NODE_PARAMS]): @@ -36117,24 +45593,21 @@ def cuGraphExternalSemaphoresSignalNodeSetParams(hNode, nodeParams : Optional[CU -------- :py:obj:`~.cuGraphNodeSetParams`, :py:obj:`~.cuGraphAddExternalSemaphoresSignalNode`, :py:obj:`~.cuGraphExternalSemaphoresSignalNodeSetParams`, :py:obj:`~.cuGraphAddExternalSemaphoresWaitNode`, :py:obj:`~.cuSignalExternalSemaphoresAsync`, :py:obj:`~.cuWaitExternalSemaphoresAsync` """ - cdef ccuda.CUgraphNode chNode + cdef cydriver.CUgraphNode cyhNode if hNode is None: - chNode = 0 + phNode = 0 elif isinstance(hNode, (CUgraphNode,)): phNode = int(hNode) - chNode = phNode else: phNode = int(CUgraphNode(hNode)) - chNode = phNode - cdef ccuda.CUDA_EXT_SEM_SIGNAL_NODE_PARAMS* cnodeParams_ptr = nodeParams._ptr if nodeParams != None else NULL - err = ccuda.cuGraphExternalSemaphoresSignalNodeSetParams(chNode, cnodeParams_ptr) - return (CUresult(err),) -{{endif}} - -{{if 'cuGraphAddExternalSemaphoresWaitNode' in found_functions}} + cyhNode = phNode + cdef cydriver.CUDA_EXT_SEM_SIGNAL_NODE_PARAMS* cynodeParams_ptr = nodeParams._pvt_ptr if nodeParams is not None else NULL + with nogil: + err = cydriver.cuGraphExternalSemaphoresSignalNodeSetParams(cyhNode, cynodeParams_ptr) + return (_CUresult(err),) @cython.embedsignature(True) -def cuGraphAddExternalSemaphoresWaitNode(hGraph, dependencies : Optional[List[CUgraphNode]], size_t numDependencies, nodeParams : Optional[CUDA_EXT_SEM_WAIT_NODE_PARAMS]): +def cuGraphAddExternalSemaphoresWaitNode(hGraph, dependencies : Optional[tuple[CUgraphNode] | list[CUgraphNode]], size_t numDependencies, nodeParams : Optional[CUDA_EXT_SEM_WAIT_NODE_PARAMS]): """ Creates an external semaphore wait node and adds it to a graph. Creates a new external semaphore wait node and adds it to `hGraph` with @@ -36152,7 +45625,7 @@ def cuGraphAddExternalSemaphoresWaitNode(hGraph, dependencies : Optional[List[CU ---------- hGraph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` Graph to which to add the node - dependencies : List[:py:obj:`~.CUgraphNode`] + dependencies : list[:py:obj:`~.CUgraphNode`] Dependencies of the node numDependencies : size_t Number of dependencies @@ -36172,34 +45645,35 @@ def cuGraphAddExternalSemaphoresWaitNode(hGraph, dependencies : Optional[List[CU """ dependencies = [] if dependencies is None else dependencies if not all(isinstance(_x, (CUgraphNode,)) for _x in dependencies): - raise TypeError("Argument 'dependencies' is not instance of type (expected List[ccuda.CUgraphNode,]") - cdef ccuda.CUgraph chGraph + raise TypeError("Argument 'dependencies' is not instance of type (expected tuple[cydriver.CUgraphNode,] or list[cydriver.CUgraphNode,]") + cdef cydriver.CUgraph cyhGraph if hGraph is None: - chGraph = 0 + phGraph = 0 elif isinstance(hGraph, (CUgraph,)): phGraph = int(hGraph) - chGraph = phGraph else: phGraph = int(CUgraph(hGraph)) - chGraph = phGraph + cyhGraph = phGraph cdef CUgraphNode phGraphNode = CUgraphNode() - cdef ccuda.CUgraphNode* cdependencies = NULL - if len(dependencies) > 0: - cdependencies = calloc(len(dependencies), sizeof(ccuda.CUgraphNode)) - if cdependencies is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(dependencies)) + 'x' + str(sizeof(ccuda.CUgraphNode))) + cdef cydriver.CUgraphNode* cydependencies = NULL + if len(dependencies) > 1: + cydependencies = calloc(len(dependencies), sizeof(cydriver.CUgraphNode)) + if cydependencies is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(dependencies)) + 'x' + str(sizeof(cydriver.CUgraphNode))) else: for idx in range(len(dependencies)): - cdependencies[idx] = (dependencies[idx])._ptr[0] + cydependencies[idx] = (dependencies[idx])._pvt_ptr[0] + elif len(dependencies) == 1: + cydependencies = (dependencies[0])._pvt_ptr if numDependencies > len(dependencies): raise RuntimeError("List is too small: " + str(len(dependencies)) + " < " + str(numDependencies)) - cdef ccuda.CUDA_EXT_SEM_WAIT_NODE_PARAMS* cnodeParams_ptr = nodeParams._ptr if nodeParams != None else NULL - err = ccuda.cuGraphAddExternalSemaphoresWaitNode(phGraphNode._ptr, chGraph, (dependencies[0])._ptr if len(dependencies) == 1 else cdependencies, numDependencies, cnodeParams_ptr) - if cdependencies is not NULL: - free(cdependencies) - return (CUresult(err), phGraphNode) -{{endif}} - -{{if 'cuGraphExternalSemaphoresWaitNodeGetParams' in found_functions}} + cdef cydriver.CUDA_EXT_SEM_WAIT_NODE_PARAMS* cynodeParams_ptr = nodeParams._pvt_ptr if nodeParams is not None else NULL + with nogil: + err = cydriver.cuGraphAddExternalSemaphoresWaitNode(phGraphNode._pvt_ptr, cyhGraph, cydependencies, numDependencies, cynodeParams_ptr) + if len(dependencies) > 1 and cydependencies is not NULL: + free(cydependencies) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, phGraphNode) @cython.embedsignature(True) def cuGraphExternalSemaphoresWaitNodeGetParams(hNode): @@ -36227,23 +45701,22 @@ def cuGraphExternalSemaphoresWaitNodeGetParams(hNode): See Also -------- - :py:obj:`~.cuLaunchKernel`, :py:obj:`~.cuGraphAddExternalSemaphoresWaitNode`, :py:obj:`~.cuGraphExternalSemaphoresWaitNodeSetParams`, :py:obj:`~.cuGraphAddExternalSemaphoresWaitNode`, :py:obj:`~.cuSignalExternalSemaphoresAsync`, :py:obj:`~.cuWaitExternalSemaphoresAsync` + :py:obj:`~.cuGraphNodeGetParams`, :py:obj:`~.cuLaunchKernel`, :py:obj:`~.cuGraphAddExternalSemaphoresWaitNode`, :py:obj:`~.cuGraphExternalSemaphoresWaitNodeSetParams`, :py:obj:`~.cuGraphAddExternalSemaphoresWaitNode`, :py:obj:`~.cuSignalExternalSemaphoresAsync`, :py:obj:`~.cuWaitExternalSemaphoresAsync` """ - cdef ccuda.CUgraphNode chNode + cdef cydriver.CUgraphNode cyhNode if hNode is None: - chNode = 0 + phNode = 0 elif isinstance(hNode, (CUgraphNode,)): phNode = int(hNode) - chNode = phNode else: phNode = int(CUgraphNode(hNode)) - chNode = phNode + cyhNode = phNode cdef CUDA_EXT_SEM_WAIT_NODE_PARAMS params_out = CUDA_EXT_SEM_WAIT_NODE_PARAMS() - err = ccuda.cuGraphExternalSemaphoresWaitNodeGetParams(chNode, params_out._ptr) - return (CUresult(err), params_out) -{{endif}} - -{{if 'cuGraphExternalSemaphoresWaitNodeSetParams' in found_functions}} + with nogil: + err = cydriver.cuGraphExternalSemaphoresWaitNodeGetParams(cyhNode, params_out._pvt_ptr) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, params_out) @cython.embedsignature(True) def cuGraphExternalSemaphoresWaitNodeSetParams(hNode, nodeParams : Optional[CUDA_EXT_SEM_WAIT_NODE_PARAMS]): @@ -36268,24 +45741,21 @@ def cuGraphExternalSemaphoresWaitNodeSetParams(hNode, nodeParams : Optional[CUDA -------- :py:obj:`~.cuGraphNodeSetParams`, :py:obj:`~.cuGraphAddExternalSemaphoresWaitNode`, :py:obj:`~.cuGraphExternalSemaphoresWaitNodeSetParams`, :py:obj:`~.cuGraphAddExternalSemaphoresWaitNode`, :py:obj:`~.cuSignalExternalSemaphoresAsync`, :py:obj:`~.cuWaitExternalSemaphoresAsync` """ - cdef ccuda.CUgraphNode chNode + cdef cydriver.CUgraphNode cyhNode if hNode is None: - chNode = 0 + phNode = 0 elif isinstance(hNode, (CUgraphNode,)): phNode = int(hNode) - chNode = phNode else: phNode = int(CUgraphNode(hNode)) - chNode = phNode - cdef ccuda.CUDA_EXT_SEM_WAIT_NODE_PARAMS* cnodeParams_ptr = nodeParams._ptr if nodeParams != None else NULL - err = ccuda.cuGraphExternalSemaphoresWaitNodeSetParams(chNode, cnodeParams_ptr) - return (CUresult(err),) -{{endif}} - -{{if 'cuGraphAddBatchMemOpNode' in found_functions}} + cyhNode = phNode + cdef cydriver.CUDA_EXT_SEM_WAIT_NODE_PARAMS* cynodeParams_ptr = nodeParams._pvt_ptr if nodeParams is not None else NULL + with nogil: + err = cydriver.cuGraphExternalSemaphoresWaitNodeSetParams(cyhNode, cynodeParams_ptr) + return (_CUresult(err),) @cython.embedsignature(True) -def cuGraphAddBatchMemOpNode(hGraph, dependencies : Optional[List[CUgraphNode]], size_t numDependencies, nodeParams : Optional[CUDA_BATCH_MEM_OP_NODE_PARAMS]): +def cuGraphAddBatchMemOpNode(hGraph, dependencies : Optional[tuple[CUgraphNode] | list[CUgraphNode]], size_t numDependencies, nodeParams : Optional[CUDA_BATCH_MEM_OP_NODE_PARAMS]): """ Creates a batch memory operation node and adds it to a graph. Creates a new batch memory operation node and adds it to `hGraph` with @@ -36302,7 +45772,7 @@ def cuGraphAddBatchMemOpNode(hGraph, dependencies : Optional[List[CUgraphNode]], ---------- hGraph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` Graph to which to add the node - dependencies : List[:py:obj:`~.CUgraphNode`] + dependencies : list[:py:obj:`~.CUgraphNode`] Dependencies of the node numDependencies : size_t Number of dependencies @@ -36322,38 +45792,39 @@ def cuGraphAddBatchMemOpNode(hGraph, dependencies : Optional[List[CUgraphNode]], Notes ----- - Warning: Improper use of this API may deadlock the application. Synchronization ordering established through this API is not visible to CUDA. CUDA tasks that are (even indirectly) ordered by this API should also have that order expressed with CUDA-visible dependencies such as events. This ensures that the scheduler does not serialize them in an improper order. For more information, see the Stream Memory Operations section in the programming guide(https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html). + Warning: Improper use of this API may deadlock the application. Synchronization ordering established through this API is not visible to CUDA. CUDA tasks that are (even indirectly) ordered by this API should also have that order expressed with CUDA-visible dependencies such as events. This ensures that the scheduler does not serialize them in an improper order. """ dependencies = [] if dependencies is None else dependencies if not all(isinstance(_x, (CUgraphNode,)) for _x in dependencies): - raise TypeError("Argument 'dependencies' is not instance of type (expected List[ccuda.CUgraphNode,]") - cdef ccuda.CUgraph chGraph + raise TypeError("Argument 'dependencies' is not instance of type (expected tuple[cydriver.CUgraphNode,] or list[cydriver.CUgraphNode,]") + cdef cydriver.CUgraph cyhGraph if hGraph is None: - chGraph = 0 + phGraph = 0 elif isinstance(hGraph, (CUgraph,)): phGraph = int(hGraph) - chGraph = phGraph else: phGraph = int(CUgraph(hGraph)) - chGraph = phGraph + cyhGraph = phGraph cdef CUgraphNode phGraphNode = CUgraphNode() - cdef ccuda.CUgraphNode* cdependencies = NULL - if len(dependencies) > 0: - cdependencies = calloc(len(dependencies), sizeof(ccuda.CUgraphNode)) - if cdependencies is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(dependencies)) + 'x' + str(sizeof(ccuda.CUgraphNode))) + cdef cydriver.CUgraphNode* cydependencies = NULL + if len(dependencies) > 1: + cydependencies = calloc(len(dependencies), sizeof(cydriver.CUgraphNode)) + if cydependencies is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(dependencies)) + 'x' + str(sizeof(cydriver.CUgraphNode))) else: for idx in range(len(dependencies)): - cdependencies[idx] = (dependencies[idx])._ptr[0] + cydependencies[idx] = (dependencies[idx])._pvt_ptr[0] + elif len(dependencies) == 1: + cydependencies = (dependencies[0])._pvt_ptr if numDependencies > len(dependencies): raise RuntimeError("List is too small: " + str(len(dependencies)) + " < " + str(numDependencies)) - cdef ccuda.CUDA_BATCH_MEM_OP_NODE_PARAMS* cnodeParams_ptr = nodeParams._ptr if nodeParams != None else NULL - err = ccuda.cuGraphAddBatchMemOpNode(phGraphNode._ptr, chGraph, (dependencies[0])._ptr if len(dependencies) == 1 else cdependencies, numDependencies, cnodeParams_ptr) - if cdependencies is not NULL: - free(cdependencies) - return (CUresult(err), phGraphNode) -{{endif}} - -{{if 'cuGraphBatchMemOpNodeGetParams' in found_functions}} + cdef cydriver.CUDA_BATCH_MEM_OP_NODE_PARAMS* cynodeParams_ptr = nodeParams._pvt_ptr if nodeParams is not None else NULL + with nogil: + err = cydriver.cuGraphAddBatchMemOpNode(phGraphNode._pvt_ptr, cyhGraph, cydependencies, numDependencies, cynodeParams_ptr) + if len(dependencies) > 1 and cydependencies is not NULL: + free(cydependencies) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, phGraphNode) @cython.embedsignature(True) def cuGraphBatchMemOpNodeGetParams(hNode): @@ -36380,23 +45851,22 @@ def cuGraphBatchMemOpNodeGetParams(hNode): See Also -------- - :py:obj:`~.cuStreamBatchMemOp`, :py:obj:`~.cuGraphAddBatchMemOpNode`, :py:obj:`~.cuGraphBatchMemOpNodeSetParams` + :py:obj:`~.cuGraphNodeGetParams`, :py:obj:`~.cuStreamBatchMemOp`, :py:obj:`~.cuGraphAddBatchMemOpNode`, :py:obj:`~.cuGraphBatchMemOpNodeSetParams` """ - cdef ccuda.CUgraphNode chNode + cdef cydriver.CUgraphNode cyhNode if hNode is None: - chNode = 0 + phNode = 0 elif isinstance(hNode, (CUgraphNode,)): phNode = int(hNode) - chNode = phNode else: phNode = int(CUgraphNode(hNode)) - chNode = phNode + cyhNode = phNode cdef CUDA_BATCH_MEM_OP_NODE_PARAMS nodeParams_out = CUDA_BATCH_MEM_OP_NODE_PARAMS() - err = ccuda.cuGraphBatchMemOpNodeGetParams(chNode, nodeParams_out._ptr) - return (CUresult(err), nodeParams_out) -{{endif}} - -{{if 'cuGraphBatchMemOpNodeSetParams' in found_functions}} + with nogil: + err = cydriver.cuGraphBatchMemOpNodeGetParams(cyhNode, nodeParams_out._pvt_ptr) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, nodeParams_out) @cython.embedsignature(True) def cuGraphBatchMemOpNodeSetParams(hNode, nodeParams : Optional[CUDA_BATCH_MEM_OP_NODE_PARAMS]): @@ -36423,21 +45893,18 @@ def cuGraphBatchMemOpNodeSetParams(hNode, nodeParams : Optional[CUDA_BATCH_MEM_O -------- :py:obj:`~.cuGraphNodeSetParams`, :py:obj:`~.cuStreamBatchMemOp`, :py:obj:`~.cuGraphAddBatchMemOpNode`, :py:obj:`~.cuGraphBatchMemOpNodeGetParams` """ - cdef ccuda.CUgraphNode chNode + cdef cydriver.CUgraphNode cyhNode if hNode is None: - chNode = 0 + phNode = 0 elif isinstance(hNode, (CUgraphNode,)): phNode = int(hNode) - chNode = phNode else: phNode = int(CUgraphNode(hNode)) - chNode = phNode - cdef ccuda.CUDA_BATCH_MEM_OP_NODE_PARAMS* cnodeParams_ptr = nodeParams._ptr if nodeParams != None else NULL - err = ccuda.cuGraphBatchMemOpNodeSetParams(chNode, cnodeParams_ptr) - return (CUresult(err),) -{{endif}} - -{{if 'cuGraphExecBatchMemOpNodeSetParams' in found_functions}} + cyhNode = phNode + cdef cydriver.CUDA_BATCH_MEM_OP_NODE_PARAMS* cynodeParams_ptr = nodeParams._pvt_ptr if nodeParams is not None else NULL + with nogil: + err = cydriver.cuGraphBatchMemOpNodeSetParams(cyhNode, cynodeParams_ptr) + return (_CUresult(err),) @cython.embedsignature(True) def cuGraphExecBatchMemOpNodeSetParams(hGraphExec, hNode, nodeParams : Optional[CUDA_BATCH_MEM_OP_NODE_PARAMS]): @@ -36486,33 +45953,29 @@ def cuGraphExecBatchMemOpNodeSetParams(hGraphExec, hNode, nodeParams : Optional[ -------- :py:obj:`~.cuGraphExecNodeSetParams`, :py:obj:`~.cuStreamBatchMemOp`, :py:obj:`~.cuGraphAddBatchMemOpNode`, :py:obj:`~.cuGraphBatchMemOpNodeGetParams`, :py:obj:`~.cuGraphBatchMemOpNodeSetParams`, :py:obj:`~.cuGraphInstantiate` """ - cdef ccuda.CUgraphNode chNode + cdef cydriver.CUgraphNode cyhNode if hNode is None: - chNode = 0 + phNode = 0 elif isinstance(hNode, (CUgraphNode,)): phNode = int(hNode) - chNode = phNode else: phNode = int(CUgraphNode(hNode)) - chNode = phNode - cdef ccuda.CUgraphExec chGraphExec + cyhNode = phNode + cdef cydriver.CUgraphExec cyhGraphExec if hGraphExec is None: - chGraphExec = 0 + phGraphExec = 0 elif isinstance(hGraphExec, (CUgraphExec,)): phGraphExec = int(hGraphExec) - chGraphExec = phGraphExec else: phGraphExec = int(CUgraphExec(hGraphExec)) - chGraphExec = phGraphExec - cdef ccuda.CUDA_BATCH_MEM_OP_NODE_PARAMS* cnodeParams_ptr = nodeParams._ptr if nodeParams != None else NULL - err = ccuda.cuGraphExecBatchMemOpNodeSetParams(chGraphExec, chNode, cnodeParams_ptr) - return (CUresult(err),) -{{endif}} - -{{if 'cuGraphAddMemAllocNode' in found_functions}} + cyhGraphExec = phGraphExec + cdef cydriver.CUDA_BATCH_MEM_OP_NODE_PARAMS* cynodeParams_ptr = nodeParams._pvt_ptr if nodeParams is not None else NULL + with nogil: + err = cydriver.cuGraphExecBatchMemOpNodeSetParams(cyhGraphExec, cyhNode, cynodeParams_ptr) + return (_CUresult(err),) @cython.embedsignature(True) -def cuGraphAddMemAllocNode(hGraph, dependencies : Optional[List[CUgraphNode]], size_t numDependencies, nodeParams : Optional[CUDA_MEM_ALLOC_NODE_PARAMS]): +def cuGraphAddMemAllocNode(hGraph, dependencies : Optional[tuple[CUgraphNode] | list[CUgraphNode]], size_t numDependencies, nodeParams : Optional[CUDA_MEM_ALLOC_NODE_PARAMS]): """ Creates an allocation node and adds it to a graph. Creates a new allocation node and adds it to `hGraph` with @@ -36559,7 +46022,8 @@ def cuGraphAddMemAllocNode(hGraph, dependencies : Optional[List[CUgraphNode]], s - Nodes and edges of the graph cannot be deleted. - - The graph cannot be used in a child node. + - The graph can only be used in a child node if the ownership is moved + to the parent. - Only one instantiation of the graph may exist at any point in time. @@ -36569,7 +46033,7 @@ def cuGraphAddMemAllocNode(hGraph, dependencies : Optional[List[CUgraphNode]], s ---------- hGraph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` Graph to which to add the node - dependencies : List[:py:obj:`~.CUgraphNode`] + dependencies : list[:py:obj:`~.CUgraphNode`] Dependencies of the node numDependencies : size_t Number of dependencies @@ -36589,34 +46053,35 @@ def cuGraphAddMemAllocNode(hGraph, dependencies : Optional[List[CUgraphNode]], s """ dependencies = [] if dependencies is None else dependencies if not all(isinstance(_x, (CUgraphNode,)) for _x in dependencies): - raise TypeError("Argument 'dependencies' is not instance of type (expected List[ccuda.CUgraphNode,]") - cdef ccuda.CUgraph chGraph + raise TypeError("Argument 'dependencies' is not instance of type (expected tuple[cydriver.CUgraphNode,] or list[cydriver.CUgraphNode,]") + cdef cydriver.CUgraph cyhGraph if hGraph is None: - chGraph = 0 + phGraph = 0 elif isinstance(hGraph, (CUgraph,)): phGraph = int(hGraph) - chGraph = phGraph else: phGraph = int(CUgraph(hGraph)) - chGraph = phGraph + cyhGraph = phGraph cdef CUgraphNode phGraphNode = CUgraphNode() - cdef ccuda.CUgraphNode* cdependencies = NULL - if len(dependencies) > 0: - cdependencies = calloc(len(dependencies), sizeof(ccuda.CUgraphNode)) - if cdependencies is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(dependencies)) + 'x' + str(sizeof(ccuda.CUgraphNode))) + cdef cydriver.CUgraphNode* cydependencies = NULL + if len(dependencies) > 1: + cydependencies = calloc(len(dependencies), sizeof(cydriver.CUgraphNode)) + if cydependencies is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(dependencies)) + 'x' + str(sizeof(cydriver.CUgraphNode))) else: for idx in range(len(dependencies)): - cdependencies[idx] = (dependencies[idx])._ptr[0] + cydependencies[idx] = (dependencies[idx])._pvt_ptr[0] + elif len(dependencies) == 1: + cydependencies = (dependencies[0])._pvt_ptr if numDependencies > len(dependencies): raise RuntimeError("List is too small: " + str(len(dependencies)) + " < " + str(numDependencies)) - cdef ccuda.CUDA_MEM_ALLOC_NODE_PARAMS* cnodeParams_ptr = nodeParams._ptr if nodeParams != None else NULL - err = ccuda.cuGraphAddMemAllocNode(phGraphNode._ptr, chGraph, (dependencies[0])._ptr if len(dependencies) == 1 else cdependencies, numDependencies, cnodeParams_ptr) - if cdependencies is not NULL: - free(cdependencies) - return (CUresult(err), phGraphNode) -{{endif}} - -{{if 'cuGraphMemAllocNodeGetParams' in found_functions}} + cdef cydriver.CUDA_MEM_ALLOC_NODE_PARAMS* cynodeParams_ptr = nodeParams._pvt_ptr if nodeParams is not None else NULL + with nogil: + err = cydriver.cuGraphAddMemAllocNode(phGraphNode._pvt_ptr, cyhGraph, cydependencies, numDependencies, cynodeParams_ptr) + if len(dependencies) > 1 and cydependencies is not NULL: + free(cydependencies) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, phGraphNode) @cython.embedsignature(True) def cuGraphMemAllocNodeGetParams(hNode): @@ -36641,26 +46106,25 @@ def cuGraphMemAllocNodeGetParams(hNode): See Also -------- - :py:obj:`~.cuGraphAddMemAllocNode`, :py:obj:`~.cuGraphMemFreeNodeGetParams` + :py:obj:`~.cuGraphNodeGetParams`, :py:obj:`~.cuGraphAddMemAllocNode`, :py:obj:`~.cuGraphMemFreeNodeGetParams` """ - cdef ccuda.CUgraphNode chNode + cdef cydriver.CUgraphNode cyhNode if hNode is None: - chNode = 0 + phNode = 0 elif isinstance(hNode, (CUgraphNode,)): phNode = int(hNode) - chNode = phNode else: phNode = int(CUgraphNode(hNode)) - chNode = phNode + cyhNode = phNode cdef CUDA_MEM_ALLOC_NODE_PARAMS params_out = CUDA_MEM_ALLOC_NODE_PARAMS() - err = ccuda.cuGraphMemAllocNodeGetParams(chNode, params_out._ptr) - return (CUresult(err), params_out) -{{endif}} - -{{if 'cuGraphAddMemFreeNode' in found_functions}} + with nogil: + err = cydriver.cuGraphMemAllocNodeGetParams(cyhNode, params_out._pvt_ptr) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, params_out) @cython.embedsignature(True) -def cuGraphAddMemFreeNode(hGraph, dependencies : Optional[List[CUgraphNode]], size_t numDependencies, dptr): +def cuGraphAddMemFreeNode(hGraph, dependencies : Optional[tuple[CUgraphNode] | list[CUgraphNode]], size_t numDependencies, dptr): """ Creates a memory free node and adds it to a graph. Creates a new memory free node and adds it to `hGraph` with @@ -36684,7 +46148,8 @@ def cuGraphAddMemFreeNode(hGraph, dependencies : Optional[List[CUgraphNode]], si - Nodes and edges of the graph cannot be deleted. - - The graph cannot be used in a child node. + - The graph can only be used in a child node if the ownership is moved + to the parent. - Only one instantiation of the graph may exist at any point in time. @@ -36694,7 +46159,7 @@ def cuGraphAddMemFreeNode(hGraph, dependencies : Optional[List[CUgraphNode]], si ---------- hGraph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` Graph to which to add the node - dependencies : List[:py:obj:`~.CUgraphNode`] + dependencies : list[:py:obj:`~.CUgraphNode`] Dependencies of the node numDependencies : size_t Number of dependencies @@ -36712,44 +46177,44 @@ def cuGraphAddMemFreeNode(hGraph, dependencies : Optional[List[CUgraphNode]], si -------- :py:obj:`~.cuGraphAddNode`, :py:obj:`~.cuGraphAddMemAllocNode`, :py:obj:`~.cuGraphMemFreeNodeGetParams`, :py:obj:`~.cuDeviceGraphMemTrim`, :py:obj:`~.cuDeviceGetGraphMemAttribute`, :py:obj:`~.cuDeviceSetGraphMemAttribute`, :py:obj:`~.cuMemAllocAsync`, :py:obj:`~.cuMemFreeAsync`, :py:obj:`~.cuGraphCreate`, :py:obj:`~.cuGraphDestroyNode`, :py:obj:`~.cuGraphAddChildGraphNode`, :py:obj:`~.cuGraphAddEmptyNode`, :py:obj:`~.cuGraphAddEventRecordNode`, :py:obj:`~.cuGraphAddEventWaitNode`, :py:obj:`~.cuGraphAddExternalSemaphoresSignalNode`, :py:obj:`~.cuGraphAddExternalSemaphoresWaitNode`, :py:obj:`~.cuGraphAddKernelNode`, :py:obj:`~.cuGraphAddMemcpyNode`, :py:obj:`~.cuGraphAddMemsetNode` """ - cdef ccuda.CUdeviceptr cdptr + cdef cydriver.CUdeviceptr cydptr if dptr is None: - cdptr = 0 + pdptr = 0 elif isinstance(dptr, (CUdeviceptr,)): pdptr = int(dptr) - cdptr = pdptr else: pdptr = int(CUdeviceptr(dptr)) - cdptr = pdptr + cydptr = pdptr dependencies = [] if dependencies is None else dependencies if not all(isinstance(_x, (CUgraphNode,)) for _x in dependencies): - raise TypeError("Argument 'dependencies' is not instance of type (expected List[ccuda.CUgraphNode,]") - cdef ccuda.CUgraph chGraph + raise TypeError("Argument 'dependencies' is not instance of type (expected tuple[cydriver.CUgraphNode,] or list[cydriver.CUgraphNode,]") + cdef cydriver.CUgraph cyhGraph if hGraph is None: - chGraph = 0 + phGraph = 0 elif isinstance(hGraph, (CUgraph,)): phGraph = int(hGraph) - chGraph = phGraph else: phGraph = int(CUgraph(hGraph)) - chGraph = phGraph + cyhGraph = phGraph cdef CUgraphNode phGraphNode = CUgraphNode() - cdef ccuda.CUgraphNode* cdependencies = NULL - if len(dependencies) > 0: - cdependencies = calloc(len(dependencies), sizeof(ccuda.CUgraphNode)) - if cdependencies is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(dependencies)) + 'x' + str(sizeof(ccuda.CUgraphNode))) + cdef cydriver.CUgraphNode* cydependencies = NULL + if len(dependencies) > 1: + cydependencies = calloc(len(dependencies), sizeof(cydriver.CUgraphNode)) + if cydependencies is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(dependencies)) + 'x' + str(sizeof(cydriver.CUgraphNode))) else: for idx in range(len(dependencies)): - cdependencies[idx] = (dependencies[idx])._ptr[0] + cydependencies[idx] = (dependencies[idx])._pvt_ptr[0] + elif len(dependencies) == 1: + cydependencies = (dependencies[0])._pvt_ptr if numDependencies > len(dependencies): raise RuntimeError("List is too small: " + str(len(dependencies)) + " < " + str(numDependencies)) - err = ccuda.cuGraphAddMemFreeNode(phGraphNode._ptr, chGraph, (dependencies[0])._ptr if len(dependencies) == 1 else cdependencies, numDependencies, cdptr) - if cdependencies is not NULL: - free(cdependencies) - return (CUresult(err), phGraphNode) -{{endif}} - -{{if 'cuGraphMemFreeNodeGetParams' in found_functions}} + with nogil: + err = cydriver.cuGraphAddMemFreeNode(phGraphNode._pvt_ptr, cyhGraph, cydependencies, numDependencies, cydptr) + if len(dependencies) > 1 and cydependencies is not NULL: + free(cydependencies) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, phGraphNode) @cython.embedsignature(True) def cuGraphMemFreeNodeGetParams(hNode): @@ -36771,23 +46236,22 @@ def cuGraphMemFreeNodeGetParams(hNode): See Also -------- - :py:obj:`~.cuGraphAddMemFreeNode`, :py:obj:`~.cuGraphMemAllocNodeGetParams` + :py:obj:`~.cuGraphNodeGetParams`, :py:obj:`~.cuGraphAddMemFreeNode`, :py:obj:`~.cuGraphMemAllocNodeGetParams` """ - cdef ccuda.CUgraphNode chNode + cdef cydriver.CUgraphNode cyhNode if hNode is None: - chNode = 0 + phNode = 0 elif isinstance(hNode, (CUgraphNode,)): phNode = int(hNode) - chNode = phNode else: phNode = int(CUgraphNode(hNode)) - chNode = phNode + cyhNode = phNode cdef CUdeviceptr dptr_out = CUdeviceptr() - err = ccuda.cuGraphMemFreeNodeGetParams(chNode, dptr_out._ptr) - return (CUresult(err), dptr_out) -{{endif}} - -{{if 'cuDeviceGraphMemTrim' in found_functions}} + with nogil: + err = cydriver.cuGraphMemFreeNodeGetParams(cyhNode, dptr_out._pvt_ptr) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, dptr_out) @cython.embedsignature(True) def cuDeviceGraphMemTrim(device): @@ -36811,20 +46275,17 @@ def cuDeviceGraphMemTrim(device): -------- :py:obj:`~.cuGraphAddMemAllocNode`, :py:obj:`~.cuGraphAddMemFreeNode`, :py:obj:`~.cuDeviceSetGraphMemAttribute`, :py:obj:`~.cuDeviceGetGraphMemAttribute` """ - cdef ccuda.CUdevice cdevice + cdef cydriver.CUdevice cydevice if device is None: - cdevice = 0 + pdevice = 0 elif isinstance(device, (CUdevice,)): pdevice = int(device) - cdevice = pdevice else: pdevice = int(CUdevice(device)) - cdevice = pdevice - err = ccuda.cuDeviceGraphMemTrim(cdevice) - return (CUresult(err),) -{{endif}} - -{{if 'cuDeviceGetGraphMemAttribute' in found_functions}} + cydevice = pdevice + with nogil: + err = cydriver.cuDeviceGraphMemTrim(cydevice) + return (_CUresult(err),) @cython.embedsignature(True) def cuDeviceGetGraphMemAttribute(device, attr not None : CUgraphMem_attribute): @@ -36865,23 +46326,22 @@ def cuDeviceGetGraphMemAttribute(device, attr not None : CUgraphMem_attribute): -------- :py:obj:`~.cuDeviceSetGraphMemAttribute`, :py:obj:`~.cuGraphAddMemAllocNode`, :py:obj:`~.cuGraphAddMemFreeNode` """ - cdef ccuda.CUdevice cdevice + cdef cydriver.CUdevice cydevice if device is None: - cdevice = 0 + pdevice = 0 elif isinstance(device, (CUdevice,)): pdevice = int(device) - cdevice = pdevice else: pdevice = int(CUdevice(device)) - cdevice = pdevice - cdef ccuda.CUgraphMem_attribute cattr = attr.value - cdef utils.HelperCUgraphMem_attribute cvalue = utils.HelperCUgraphMem_attribute(attr, 0, is_getter=True) - cdef void* cvalue_ptr = cvalue.cptr - err = ccuda.cuDeviceGetGraphMemAttribute(cdevice, cattr, cvalue_ptr) - return (CUresult(err), cvalue.pyObj()) -{{endif}} - -{{if 'cuDeviceSetGraphMemAttribute' in found_functions}} + cydevice = pdevice + cdef cydriver.CUgraphMem_attribute cyattr = int(attr) + cdef _HelperCUgraphMem_attribute cyvalue = _HelperCUgraphMem_attribute(attr, 0, is_getter=True) + cdef void* cyvalue_ptr = cyvalue.cptr + with nogil: + err = cydriver.cuDeviceGetGraphMemAttribute(cydevice, cyattr, cyvalue_ptr) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, cyvalue.pyObj()) @cython.embedsignature(True) def cuDeviceSetGraphMemAttribute(device, attr not None : CUgraphMem_attribute, value): @@ -36915,23 +46375,20 @@ def cuDeviceSetGraphMemAttribute(device, attr not None : CUgraphMem_attribute, v -------- :py:obj:`~.cuDeviceGetGraphMemAttribute`, :py:obj:`~.cuGraphAddMemAllocNode`, :py:obj:`~.cuGraphAddMemFreeNode` """ - cdef ccuda.CUdevice cdevice + cdef cydriver.CUdevice cydevice if device is None: - cdevice = 0 + pdevice = 0 elif isinstance(device, (CUdevice,)): pdevice = int(device) - cdevice = pdevice else: pdevice = int(CUdevice(device)) - cdevice = pdevice - cdef ccuda.CUgraphMem_attribute cattr = attr.value - cdef utils.HelperCUgraphMem_attribute cvalue = utils.HelperCUgraphMem_attribute(attr, value, is_getter=False) - cdef void* cvalue_ptr = cvalue.cptr - err = ccuda.cuDeviceSetGraphMemAttribute(cdevice, cattr, cvalue_ptr) - return (CUresult(err),) -{{endif}} - -{{if 'cuGraphClone' in found_functions}} + cydevice = pdevice + cdef cydriver.CUgraphMem_attribute cyattr = int(attr) + cdef _HelperCUgraphMem_attribute cyvalue = _HelperCUgraphMem_attribute(attr, value, is_getter=False) + cdef void* cyvalue_ptr = cyvalue.cptr + with nogil: + err = cydriver.cuDeviceSetGraphMemAttribute(cydevice, cyattr, cyvalue_ptr) + return (_CUresult(err),) @cython.embedsignature(True) def cuGraphClone(originalGraph): @@ -36960,22 +46417,25 @@ def cuGraphClone(originalGraph): See Also -------- :py:obj:`~.cuGraphCreate`, :py:obj:`~.cuGraphNodeFindInClone` + + Notes + ----- + : Cloning is not supported for graphs which contain memory allocation nodes, memory free nodes, or conditional nodes. """ - cdef ccuda.CUgraph coriginalGraph + cdef cydriver.CUgraph cyoriginalGraph if originalGraph is None: - coriginalGraph = 0 + poriginalGraph = 0 elif isinstance(originalGraph, (CUgraph,)): poriginalGraph = int(originalGraph) - coriginalGraph = poriginalGraph else: poriginalGraph = int(CUgraph(originalGraph)) - coriginalGraph = poriginalGraph + cyoriginalGraph = poriginalGraph cdef CUgraph phGraphClone = CUgraph() - err = ccuda.cuGraphClone(phGraphClone._ptr, coriginalGraph) - return (CUresult(err), phGraphClone) -{{endif}} - -{{if 'cuGraphNodeFindInClone' in found_functions}} + with nogil: + err = cydriver.cuGraphClone(phGraphClone._pvt_ptr, cyoriginalGraph) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, phGraphClone) @cython.embedsignature(True) def cuGraphNodeFindInClone(hOriginalNode, hClonedGraph): @@ -37008,30 +46468,28 @@ def cuGraphNodeFindInClone(hOriginalNode, hClonedGraph): -------- :py:obj:`~.cuGraphClone` """ - cdef ccuda.CUgraph chClonedGraph + cdef cydriver.CUgraph cyhClonedGraph if hClonedGraph is None: - chClonedGraph = 0 + phClonedGraph = 0 elif isinstance(hClonedGraph, (CUgraph,)): phClonedGraph = int(hClonedGraph) - chClonedGraph = phClonedGraph else: phClonedGraph = int(CUgraph(hClonedGraph)) - chClonedGraph = phClonedGraph - cdef ccuda.CUgraphNode chOriginalNode + cyhClonedGraph = phClonedGraph + cdef cydriver.CUgraphNode cyhOriginalNode if hOriginalNode is None: - chOriginalNode = 0 + phOriginalNode = 0 elif isinstance(hOriginalNode, (CUgraphNode,)): phOriginalNode = int(hOriginalNode) - chOriginalNode = phOriginalNode else: phOriginalNode = int(CUgraphNode(hOriginalNode)) - chOriginalNode = phOriginalNode + cyhOriginalNode = phOriginalNode cdef CUgraphNode phNode = CUgraphNode() - err = ccuda.cuGraphNodeFindInClone(phNode._ptr, chOriginalNode, chClonedGraph) - return (CUresult(err), phNode) -{{endif}} - -{{if 'cuGraphNodeGetType' in found_functions}} + with nogil: + err = cydriver.cuGraphNodeFindInClone(phNode._pvt_ptr, cyhOriginalNode, cyhClonedGraph) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, phNode) @cython.embedsignature(True) def cuGraphNodeGetType(hNode): @@ -37055,21 +46513,208 @@ def cuGraphNodeGetType(hNode): -------- :py:obj:`~.cuGraphGetNodes`, :py:obj:`~.cuGraphGetRootNodes`, :py:obj:`~.cuGraphChildGraphNodeGetGraph`, :py:obj:`~.cuGraphKernelNodeGetParams`, :py:obj:`~.cuGraphKernelNodeSetParams`, :py:obj:`~.cuGraphHostNodeGetParams`, :py:obj:`~.cuGraphHostNodeSetParams`, :py:obj:`~.cuGraphMemcpyNodeGetParams`, :py:obj:`~.cuGraphMemcpyNodeSetParams`, :py:obj:`~.cuGraphMemsetNodeGetParams`, :py:obj:`~.cuGraphMemsetNodeSetParams` """ - cdef ccuda.CUgraphNode chNode + cdef cydriver.CUgraphNode cyhNode if hNode is None: - chNode = 0 + phNode = 0 elif isinstance(hNode, (CUgraphNode,)): phNode = int(hNode) - chNode = phNode else: phNode = int(CUgraphNode(hNode)) - chNode = phNode - cdef ccuda.CUgraphNodeType typename - err = ccuda.cuGraphNodeGetType(chNode, &typename) - return (CUresult(err), CUgraphNodeType(typename)) -{{endif}} + cyhNode = phNode + cdef cydriver.CUgraphNodeType typename + with nogil: + err = cydriver.cuGraphNodeGetType(cyhNode, &typename) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, CUgraphNodeType(typename)) + +@cython.embedsignature(True) +def cuGraphNodeGetContainingGraph(hNode): + """ Returns the graph that contains a given graph node. + + Returns the graph that contains `hNode` in `*phGraph`. If `hNode` is in + a child graph, the child graph it is in is returned. + + Parameters + ---------- + hNode : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` + Node to query + + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS` :py:obj:`~.CUDA_ERROR_INVALID_VALUE` + *phGraph : :py:obj:`~.CUgraph` + Pointer to return the containing graph -{{if 'cuGraphGetNodes' in found_functions}} + See Also + -------- + :py:obj:`~.cuGraphGetNodes`, :py:obj:`~.cuGraphDebugDotPrint` :py:obj:`~.cuGraphNodeGetLocalId` :py:obj:`~.cuGraphNodeGetToolsId` :py:obj:`~.cuGraphGetId` :py:obj:`~.cuGraphExecGetId` + """ + cdef cydriver.CUgraphNode cyhNode + if hNode is None: + phNode = 0 + elif isinstance(hNode, (CUgraphNode,)): + phNode = int(hNode) + else: + phNode = int(CUgraphNode(hNode)) + cyhNode = phNode + cdef CUgraph phGraph = CUgraph() + with nogil: + err = cydriver.cuGraphNodeGetContainingGraph(cyhNode, phGraph._pvt_ptr) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, phGraph) + +@cython.embedsignature(True) +def cuGraphNodeGetLocalId(hNode): + """ Returns the local node id of a given graph node. + + Returns the node id of `hNode` in `*nodeId`. The nodeId matches that + referenced by :py:obj:`~.cuGraphDebugDotPrint`. The local nodeId and + graphId together can uniquely identify the node. + + Parameters + ---------- + hNode : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` + Node to query + + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS` :py:obj:`~.CUDA_ERROR_INVALID_VALUE` + nodeId : unsigned int + Pointer to return the nodeId + + See Also + -------- + :py:obj:`~.cuGraphGetNodes`, :py:obj:`~.cuGraphDebugDotPrint` :py:obj:`~.cuGraphNodeGetContainingGraph` :py:obj:`~.cuGraphNodeGetToolsId` :py:obj:`~.cuGraphGetId` :py:obj:`~.cuGraphExecGetId` + """ + cdef cydriver.CUgraphNode cyhNode + if hNode is None: + phNode = 0 + elif isinstance(hNode, (CUgraphNode,)): + phNode = int(hNode) + else: + phNode = int(CUgraphNode(hNode)) + cyhNode = phNode + cdef unsigned int nodeId = 0 + with nogil: + err = cydriver.cuGraphNodeGetLocalId(cyhNode, &nodeId) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, nodeId) + +@cython.embedsignature(True) +def cuGraphNodeGetToolsId(hNode): + """ Returns an id used by tools to identify a given node. + + Parameters + ---------- + hNode : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` + Node to query + + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS` :py:obj:`~.CUDA_ERROR_INVALID_VALUE` + *toolsNodeId : unsigned long long + Pointer to return the id used by tools + + See Also + -------- + :py:obj:`~.cuGraphGetNodes`, :py:obj:`~.cuGraphDebugDotPrint` :py:obj:`~.cuGraphNodeGetContainingGraph` :py:obj:`~.cuGraphNodeGetLocalId` :py:obj:`~.cuGraphGetId` :py:obj:`~.cuGraphExecGetId` + """ + cdef cydriver.CUgraphNode cyhNode + if hNode is None: + phNode = 0 + elif isinstance(hNode, (CUgraphNode,)): + phNode = int(hNode) + else: + phNode = int(CUgraphNode(hNode)) + cyhNode = phNode + cdef unsigned long long toolsNodeId = 0 + with nogil: + err = cydriver.cuGraphNodeGetToolsId(cyhNode, &toolsNodeId) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, toolsNodeId) + +@cython.embedsignature(True) +def cuGraphGetId(hGraph): + """ Returns the id of a given graph. + + Returns the id of `hGraph` in `*graphId`. The value in `*graphId` will + match that referenced by :py:obj:`~.cuGraphDebugDotPrint`. + + Parameters + ---------- + hGraph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` + Graph to query + + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS` :py:obj:`~.CUDA_ERROR_INVALID_VALUE` + *graphId : unsigned int + Pointer to return the graphId + + See Also + -------- + :py:obj:`~.cuGraphGetNodes`, :py:obj:`~.cuGraphDebugDotPrint` :py:obj:`~.cuGraphNodeGetContainingGraph` :py:obj:`~.cuGraphNodeGetLocalId` :py:obj:`~.cuGraphNodeGetToolsId` :py:obj:`~.cuGraphExecGetId` + """ + cdef cydriver.CUgraph cyhGraph + if hGraph is None: + phGraph = 0 + elif isinstance(hGraph, (CUgraph,)): + phGraph = int(hGraph) + else: + phGraph = int(CUgraph(hGraph)) + cyhGraph = phGraph + cdef unsigned int graphId = 0 + with nogil: + err = cydriver.cuGraphGetId(cyhGraph, &graphId) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, graphId) + +@cython.embedsignature(True) +def cuGraphExecGetId(hGraphExec): + """ Returns the id of a given graph exec. + + Returns the id of `hGraphExec` in `*graphId`. The value in `*graphId` + will match that referenced by :py:obj:`~.cuGraphDebugDotPrint`. + + Parameters + ---------- + hGraphExec : :py:obj:`~.CUgraphExec` or :py:obj:`~.cudaGraphExec_t` + Graph to query + + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS` :py:obj:`~.CUDA_ERROR_INVALID_VALUE` + *graphId : unsigned int + Pointer to return the graphId + + See Also + -------- + :py:obj:`~.cuGraphGetNodes`, :py:obj:`~.cuGraphDebugDotPrint` :py:obj:`~.cuGraphNodeGetContainingGraph` :py:obj:`~.cuGraphNodeGetLocalId` :py:obj:`~.cuGraphNodeGetToolsId` :py:obj:`~.cuGraphGetId` + """ + cdef cydriver.CUgraphExec cyhGraphExec + if hGraphExec is None: + phGraphExec = 0 + elif isinstance(hGraphExec, (CUgraphExec,)): + phGraphExec = int(hGraphExec) + else: + phGraphExec = int(CUgraphExec(hGraphExec)) + cyhGraphExec = phGraphExec + cdef unsigned int graphId = 0 + with nogil: + err = cydriver.cuGraphExecGetId(cyhGraphExec, &graphId) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, graphId) @cython.embedsignature(True) def cuGraphGetNodes(hGraph, size_t numNodes = 0): @@ -37093,7 +46738,7 @@ def cuGraphGetNodes(hGraph, size_t numNodes = 0): ------- CUresult :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE` - nodes : List[:py:obj:`~.CUgraphNode`] + nodes : list[:py:obj:`~.CUgraphNode`] Pointer to return the nodes numNodes : int See description @@ -37103,30 +46748,31 @@ def cuGraphGetNodes(hGraph, size_t numNodes = 0): :py:obj:`~.cuGraphCreate`, :py:obj:`~.cuGraphGetRootNodes`, :py:obj:`~.cuGraphGetEdges`, :py:obj:`~.cuGraphNodeGetType`, :py:obj:`~.cuGraphNodeGetDependencies`, :py:obj:`~.cuGraphNodeGetDependentNodes` """ cdef size_t _graph_length = numNodes - cdef ccuda.CUgraph chGraph + cdef cydriver.CUgraph cyhGraph if hGraph is None: - chGraph = 0 + phGraph = 0 elif isinstance(hGraph, (CUgraph,)): phGraph = int(hGraph) - chGraph = phGraph else: phGraph = int(CUgraph(hGraph)) - chGraph = phGraph - cdef ccuda.CUgraphNode* cnodes = NULL + cyhGraph = phGraph + cdef cydriver.CUgraphNode* cynodes = NULL pynodes = [] if _graph_length != 0: - cnodes = calloc(_graph_length, sizeof(ccuda.CUgraphNode)) - if cnodes is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(_graph_length) + 'x' + str(sizeof(ccuda.CUgraphNode))) - err = ccuda.cuGraphGetNodes(chGraph, cnodes, &numNodes) + cynodes = calloc(_graph_length, sizeof(cydriver.CUgraphNode)) + if cynodes is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(_graph_length) + 'x' + str(sizeof(cydriver.CUgraphNode))) + with nogil: + err = cydriver.cuGraphGetNodes(cyhGraph, cynodes, &numNodes) if CUresult(err) == CUresult(0): - pynodes = [CUgraphNode(init_value=cnodes[idx]) for idx in range(_graph_length)] - if cnodes is not NULL: - free(cnodes) - return (CUresult(err), pynodes, numNodes) -{{endif}} - -{{if 'cuGraphGetRootNodes' in found_functions}} + pynodes = [CUgraphNode() for _ in range(_graph_length)] + for idx in range(_graph_length): + (pynodes[idx])._pvt_ptr[0] = cynodes[idx] + if cynodes is not NULL: + free(cynodes) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None, None) + return (_CUresult_SUCCESS, pynodes, numNodes) @cython.embedsignature(True) def cuGraphGetRootNodes(hGraph, size_t numRootNodes = 0): @@ -37150,7 +46796,7 @@ def cuGraphGetRootNodes(hGraph, size_t numRootNodes = 0): ------- CUresult :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE` - rootNodes : List[:py:obj:`~.CUgraphNode`] + rootNodes : list[:py:obj:`~.CUgraphNode`] Pointer to return the root nodes numRootNodes : int See description @@ -37160,106 +46806,36 @@ def cuGraphGetRootNodes(hGraph, size_t numRootNodes = 0): :py:obj:`~.cuGraphCreate`, :py:obj:`~.cuGraphGetNodes`, :py:obj:`~.cuGraphGetEdges`, :py:obj:`~.cuGraphNodeGetType`, :py:obj:`~.cuGraphNodeGetDependencies`, :py:obj:`~.cuGraphNodeGetDependentNodes` """ cdef size_t _graph_length = numRootNodes - cdef ccuda.CUgraph chGraph + cdef cydriver.CUgraph cyhGraph if hGraph is None: - chGraph = 0 + phGraph = 0 elif isinstance(hGraph, (CUgraph,)): phGraph = int(hGraph) - chGraph = phGraph else: phGraph = int(CUgraph(hGraph)) - chGraph = phGraph - cdef ccuda.CUgraphNode* crootNodes = NULL + cyhGraph = phGraph + cdef cydriver.CUgraphNode* cyrootNodes = NULL pyrootNodes = [] if _graph_length != 0: - crootNodes = calloc(_graph_length, sizeof(ccuda.CUgraphNode)) - if crootNodes is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(_graph_length) + 'x' + str(sizeof(ccuda.CUgraphNode))) - err = ccuda.cuGraphGetRootNodes(chGraph, crootNodes, &numRootNodes) + cyrootNodes = calloc(_graph_length, sizeof(cydriver.CUgraphNode)) + if cyrootNodes is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(_graph_length) + 'x' + str(sizeof(cydriver.CUgraphNode))) + with nogil: + err = cydriver.cuGraphGetRootNodes(cyhGraph, cyrootNodes, &numRootNodes) if CUresult(err) == CUresult(0): - pyrootNodes = [CUgraphNode(init_value=crootNodes[idx]) for idx in range(_graph_length)] - if crootNodes is not NULL: - free(crootNodes) - return (CUresult(err), pyrootNodes, numRootNodes) -{{endif}} - -{{if 'cuGraphGetEdges' in found_functions}} + pyrootNodes = [CUgraphNode() for _ in range(_graph_length)] + for idx in range(_graph_length): + (pyrootNodes[idx])._pvt_ptr[0] = cyrootNodes[idx] + if cyrootNodes is not NULL: + free(cyrootNodes) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None, None) + return (_CUresult_SUCCESS, pyrootNodes, numRootNodes) @cython.embedsignature(True) def cuGraphGetEdges(hGraph, size_t numEdges = 0): """ Returns a graph's dependency edges. - Returns a list of `hGraph's` dependency edges. Edges are returned via - corresponding indices in `from` and `to`; that is, the node in `to`[i] - has a dependency on the node in `from`[i]. `from` and `to` may both be - NULL, in which case this function only returns the number of edges in - `numEdges`. Otherwise, `numEdges` entries will be filled in. If - `numEdges` is higher than the actual number of edges, the remaining - entries in `from` and `to` will be set to NULL, and the number of edges - actually returned will be written to `numEdges`. - - Parameters - ---------- - hGraph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` - Graph to get the edges from - numEdges : int - See description - - Returns - ------- - CUresult - :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE` - from : List[:py:obj:`~.CUgraphNode`] - Location to return edge endpoints - to : List[:py:obj:`~.CUgraphNode`] - Location to return edge endpoints - numEdges : int - See description - - See Also - -------- - :py:obj:`~.cuGraphGetNodes`, :py:obj:`~.cuGraphGetRootNodes`, :py:obj:`~.cuGraphAddDependencies`, :py:obj:`~.cuGraphRemoveDependencies`, :py:obj:`~.cuGraphNodeGetDependencies`, :py:obj:`~.cuGraphNodeGetDependentNodes` - """ - cdef size_t _graph_length = numEdges - cdef ccuda.CUgraph chGraph - if hGraph is None: - chGraph = 0 - elif isinstance(hGraph, (CUgraph,)): - phGraph = int(hGraph) - chGraph = phGraph - else: - phGraph = int(CUgraph(hGraph)) - chGraph = phGraph - cdef ccuda.CUgraphNode* cfrom_ = NULL - pyfrom_ = [] - if _graph_length != 0: - cfrom_ = calloc(_graph_length, sizeof(ccuda.CUgraphNode)) - if cfrom_ is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(_graph_length) + 'x' + str(sizeof(ccuda.CUgraphNode))) - cdef ccuda.CUgraphNode* cto = NULL - pyto = [] - if _graph_length != 0: - cto = calloc(_graph_length, sizeof(ccuda.CUgraphNode)) - if cto is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(_graph_length) + 'x' + str(sizeof(ccuda.CUgraphNode))) - err = ccuda.cuGraphGetEdges(chGraph, cfrom_, cto, &numEdges) - if CUresult(err) == CUresult(0): - pyfrom_ = [CUgraphNode(init_value=cfrom_[idx]) for idx in range(_graph_length)] - if cfrom_ is not NULL: - free(cfrom_) - if CUresult(err) == CUresult(0): - pyto = [CUgraphNode(init_value=cto[idx]) for idx in range(_graph_length)] - if cto is not NULL: - free(cto) - return (CUresult(err), pyfrom_, pyto, numEdges) -{{endif}} - -{{if 'cuGraphGetEdges_v2' in found_functions}} - -@cython.embedsignature(True) -def cuGraphGetEdges_v2(hGraph, size_t numEdges = 0): - """ Returns a graph's dependency edges (12.3+) - Returns a list of `hGraph's` dependency edges. Edges are returned via corresponding indices in `from`, `to` and `edgeData`; that is, the node in `to`[i] has a dependency on the node in `from`[i] with data @@ -37285,11 +46861,11 @@ def cuGraphGetEdges_v2(hGraph, size_t numEdges = 0): ------- CUresult :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_LOSSY_QUERY`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE` - from : List[:py:obj:`~.CUgraphNode`] + from : list[:py:obj:`~.CUgraphNode`] Location to return edge endpoints - to : List[:py:obj:`~.CUgraphNode`] + to : list[:py:obj:`~.CUgraphNode`] Location to return edge endpoints - edgeData : List[:py:obj:`~.CUgraphEdgeData`] + edgeData : list[:py:obj:`~.CUgraphEdgeData`] Optional location to return edge data numEdges : int See description @@ -37299,50 +46875,55 @@ def cuGraphGetEdges_v2(hGraph, size_t numEdges = 0): :py:obj:`~.cuGraphGetNodes`, :py:obj:`~.cuGraphGetRootNodes`, :py:obj:`~.cuGraphAddDependencies`, :py:obj:`~.cuGraphRemoveDependencies`, :py:obj:`~.cuGraphNodeGetDependencies`, :py:obj:`~.cuGraphNodeGetDependentNodes` """ cdef size_t _graph_length = numEdges - cdef ccuda.CUgraph chGraph + cdef cydriver.CUgraph cyhGraph if hGraph is None: - chGraph = 0 + phGraph = 0 elif isinstance(hGraph, (CUgraph,)): phGraph = int(hGraph) - chGraph = phGraph else: phGraph = int(CUgraph(hGraph)) - chGraph = phGraph - cdef ccuda.CUgraphNode* cfrom_ = NULL + cyhGraph = phGraph + cdef cydriver.CUgraphNode* cyfrom_ = NULL pyfrom_ = [] if _graph_length != 0: - cfrom_ = calloc(_graph_length, sizeof(ccuda.CUgraphNode)) - if cfrom_ is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(_graph_length) + 'x' + str(sizeof(ccuda.CUgraphNode))) - cdef ccuda.CUgraphNode* cto = NULL + cyfrom_ = calloc(_graph_length, sizeof(cydriver.CUgraphNode)) + if cyfrom_ is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(_graph_length) + 'x' + str(sizeof(cydriver.CUgraphNode))) + cdef cydriver.CUgraphNode* cyto = NULL pyto = [] if _graph_length != 0: - cto = calloc(_graph_length, sizeof(ccuda.CUgraphNode)) - if cto is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(_graph_length) + 'x' + str(sizeof(ccuda.CUgraphNode))) - cdef ccuda.CUgraphEdgeData* cedgeData = NULL + cyto = calloc(_graph_length, sizeof(cydriver.CUgraphNode)) + if cyto is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(_graph_length) + 'x' + str(sizeof(cydriver.CUgraphNode))) + cdef cydriver.CUgraphEdgeData* cyedgeData = NULL pyedgeData = [] if _graph_length != 0: - cedgeData = calloc(_graph_length, sizeof(ccuda.CUgraphEdgeData)) - if cedgeData is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(_graph_length) + 'x' + str(sizeof(ccuda.CUgraphEdgeData))) - err = ccuda.cuGraphGetEdges_v2(chGraph, cfrom_, cto, cedgeData, &numEdges) + cyedgeData = calloc(_graph_length, sizeof(cydriver.CUgraphEdgeData)) + if cyedgeData is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(_graph_length) + 'x' + str(sizeof(cydriver.CUgraphEdgeData))) + with nogil: + err = cydriver.cuGraphGetEdges(cyhGraph, cyfrom_, cyto, cyedgeData, &numEdges) if CUresult(err) == CUresult(0): - pyfrom_ = [CUgraphNode(init_value=cfrom_[idx]) for idx in range(_graph_length)] - if cfrom_ is not NULL: - free(cfrom_) + pyfrom_ = [CUgraphNode() for _ in range(_graph_length)] + for idx in range(_graph_length): + (pyfrom_[idx])._pvt_ptr[0] = cyfrom_[idx] + if cyfrom_ is not NULL: + free(cyfrom_) if CUresult(err) == CUresult(0): - pyto = [CUgraphNode(init_value=cto[idx]) for idx in range(_graph_length)] - if cto is not NULL: - free(cto) + pyto = [CUgraphNode() for _ in range(_graph_length)] + for idx in range(_graph_length): + (pyto[idx])._pvt_ptr[0] = cyto[idx] + if cyto is not NULL: + free(cyto) if CUresult(err) == CUresult(0): - pyedgeData = [CUgraphEdgeData(_ptr=&cedgeData[idx]) for idx in range(_graph_length)] - if cedgeData is not NULL: - free(cedgeData) - return (CUresult(err), pyfrom_, pyto, pyedgeData, numEdges) -{{endif}} - -{{if 'cuGraphNodeGetDependencies' in found_functions}} + pyedgeData = [CUgraphEdgeData() for _ in range(_graph_length)] + for idx in range(_graph_length): + (pyedgeData[idx])._pvt_ptr[0] = cyedgeData[idx] + if cyedgeData is not NULL: + free(cyedgeData) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None, None, None, None) + return (_CUresult_SUCCESS, pyfrom_, pyto, pyedgeData, numEdges) @cython.embedsignature(True) def cuGraphNodeGetDependencies(hNode, size_t numDependencies = 0): @@ -37356,64 +46937,6 @@ def cuGraphNodeGetDependencies(hNode, size_t numDependencies = 0): NULL, and the number of nodes actually obtained will be returned in `numDependencies`. - Parameters - ---------- - hNode : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` - Node to query - numDependencies : int - See description - - Returns - ------- - CUresult - :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE` - dependencies : List[:py:obj:`~.CUgraphNode`] - Pointer to return the dependencies - numDependencies : int - See description - - See Also - -------- - :py:obj:`~.cuGraphNodeGetDependentNodes`, :py:obj:`~.cuGraphGetNodes`, :py:obj:`~.cuGraphGetRootNodes`, :py:obj:`~.cuGraphGetEdges`, :py:obj:`~.cuGraphAddDependencies`, :py:obj:`~.cuGraphRemoveDependencies` - """ - cdef size_t _graph_length = numDependencies - cdef ccuda.CUgraphNode chNode - if hNode is None: - chNode = 0 - elif isinstance(hNode, (CUgraphNode,)): - phNode = int(hNode) - chNode = phNode - else: - phNode = int(CUgraphNode(hNode)) - chNode = phNode - cdef ccuda.CUgraphNode* cdependencies = NULL - pydependencies = [] - if _graph_length != 0: - cdependencies = calloc(_graph_length, sizeof(ccuda.CUgraphNode)) - if cdependencies is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(_graph_length) + 'x' + str(sizeof(ccuda.CUgraphNode))) - err = ccuda.cuGraphNodeGetDependencies(chNode, cdependencies, &numDependencies) - if CUresult(err) == CUresult(0): - pydependencies = [CUgraphNode(init_value=cdependencies[idx]) for idx in range(_graph_length)] - if cdependencies is not NULL: - free(cdependencies) - return (CUresult(err), pydependencies, numDependencies) -{{endif}} - -{{if 'cuGraphNodeGetDependencies_v2' in found_functions}} - -@cython.embedsignature(True) -def cuGraphNodeGetDependencies_v2(hNode, size_t numDependencies = 0): - """ Returns a node's dependencies (12.3+) - - Returns a list of `node's` dependencies. `dependencies` may be NULL, in - which case this function will return the number of dependencies in - `numDependencies`. Otherwise, `numDependencies` entries will be filled - in. If `numDependencies` is higher than the actual number of - dependencies, the remaining entries in `dependencies` will be set to - NULL, and the number of nodes actually obtained will be returned in - `numDependencies`. - Note that if an edge has non-zero (non-default) edge data and `edgeData` is NULL, this API will return :py:obj:`~.CUDA_ERROR_LOSSY_QUERY`. If `edgeData` is non-NULL, then @@ -37430,9 +46953,9 @@ def cuGraphNodeGetDependencies_v2(hNode, size_t numDependencies = 0): ------- CUresult :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_LOSSY_QUERY`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE` - dependencies : List[:py:obj:`~.CUgraphNode`] + dependencies : list[:py:obj:`~.CUgraphNode`] Pointer to return the dependencies - edgeData : List[:py:obj:`~.CUgraphEdgeData`] + edgeData : list[:py:obj:`~.CUgraphEdgeData`] Optional array to return edge data for each dependency numDependencies : int See description @@ -37442,40 +46965,43 @@ def cuGraphNodeGetDependencies_v2(hNode, size_t numDependencies = 0): :py:obj:`~.cuGraphNodeGetDependentNodes`, :py:obj:`~.cuGraphGetNodes`, :py:obj:`~.cuGraphGetRootNodes`, :py:obj:`~.cuGraphGetEdges`, :py:obj:`~.cuGraphAddDependencies`, :py:obj:`~.cuGraphRemoveDependencies` """ cdef size_t _graph_length = numDependencies - cdef ccuda.CUgraphNode chNode + cdef cydriver.CUgraphNode cyhNode if hNode is None: - chNode = 0 + phNode = 0 elif isinstance(hNode, (CUgraphNode,)): phNode = int(hNode) - chNode = phNode else: phNode = int(CUgraphNode(hNode)) - chNode = phNode - cdef ccuda.CUgraphNode* cdependencies = NULL + cyhNode = phNode + cdef cydriver.CUgraphNode* cydependencies = NULL pydependencies = [] if _graph_length != 0: - cdependencies = calloc(_graph_length, sizeof(ccuda.CUgraphNode)) - if cdependencies is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(_graph_length) + 'x' + str(sizeof(ccuda.CUgraphNode))) - cdef ccuda.CUgraphEdgeData* cedgeData = NULL + cydependencies = calloc(_graph_length, sizeof(cydriver.CUgraphNode)) + if cydependencies is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(_graph_length) + 'x' + str(sizeof(cydriver.CUgraphNode))) + cdef cydriver.CUgraphEdgeData* cyedgeData = NULL pyedgeData = [] if _graph_length != 0: - cedgeData = calloc(_graph_length, sizeof(ccuda.CUgraphEdgeData)) - if cedgeData is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(_graph_length) + 'x' + str(sizeof(ccuda.CUgraphEdgeData))) - err = ccuda.cuGraphNodeGetDependencies_v2(chNode, cdependencies, cedgeData, &numDependencies) + cyedgeData = calloc(_graph_length, sizeof(cydriver.CUgraphEdgeData)) + if cyedgeData is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(_graph_length) + 'x' + str(sizeof(cydriver.CUgraphEdgeData))) + with nogil: + err = cydriver.cuGraphNodeGetDependencies(cyhNode, cydependencies, cyedgeData, &numDependencies) if CUresult(err) == CUresult(0): - pydependencies = [CUgraphNode(init_value=cdependencies[idx]) for idx in range(_graph_length)] - if cdependencies is not NULL: - free(cdependencies) + pydependencies = [CUgraphNode() for _ in range(_graph_length)] + for idx in range(_graph_length): + (pydependencies[idx])._pvt_ptr[0] = cydependencies[idx] + if cydependencies is not NULL: + free(cydependencies) if CUresult(err) == CUresult(0): - pyedgeData = [CUgraphEdgeData(_ptr=&cedgeData[idx]) for idx in range(_graph_length)] - if cedgeData is not NULL: - free(cedgeData) - return (CUresult(err), pydependencies, pyedgeData, numDependencies) -{{endif}} - -{{if 'cuGraphNodeGetDependentNodes' in found_functions}} + pyedgeData = [CUgraphEdgeData() for _ in range(_graph_length)] + for idx in range(_graph_length): + (pyedgeData[idx])._pvt_ptr[0] = cyedgeData[idx] + if cyedgeData is not NULL: + free(cyedgeData) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None, None, None) + return (_CUresult_SUCCESS, pydependencies, pyedgeData, numDependencies) @cython.embedsignature(True) def cuGraphNodeGetDependentNodes(hNode, size_t numDependentNodes = 0): @@ -37489,64 +47015,6 @@ def cuGraphNodeGetDependentNodes(hNode, size_t numDependentNodes = 0): will be set to NULL, and the number of nodes actually obtained will be returned in `numDependentNodes`. - Parameters - ---------- - hNode : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` - Node to query - numDependentNodes : int - See description - - Returns - ------- - CUresult - :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE` - dependentNodes : List[:py:obj:`~.CUgraphNode`] - Pointer to return the dependent nodes - numDependentNodes : int - See description - - See Also - -------- - :py:obj:`~.cuGraphNodeGetDependencies`, :py:obj:`~.cuGraphGetNodes`, :py:obj:`~.cuGraphGetRootNodes`, :py:obj:`~.cuGraphGetEdges`, :py:obj:`~.cuGraphAddDependencies`, :py:obj:`~.cuGraphRemoveDependencies` - """ - cdef size_t _graph_length = numDependentNodes - cdef ccuda.CUgraphNode chNode - if hNode is None: - chNode = 0 - elif isinstance(hNode, (CUgraphNode,)): - phNode = int(hNode) - chNode = phNode - else: - phNode = int(CUgraphNode(hNode)) - chNode = phNode - cdef ccuda.CUgraphNode* cdependentNodes = NULL - pydependentNodes = [] - if _graph_length != 0: - cdependentNodes = calloc(_graph_length, sizeof(ccuda.CUgraphNode)) - if cdependentNodes is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(_graph_length) + 'x' + str(sizeof(ccuda.CUgraphNode))) - err = ccuda.cuGraphNodeGetDependentNodes(chNode, cdependentNodes, &numDependentNodes) - if CUresult(err) == CUresult(0): - pydependentNodes = [CUgraphNode(init_value=cdependentNodes[idx]) for idx in range(_graph_length)] - if cdependentNodes is not NULL: - free(cdependentNodes) - return (CUresult(err), pydependentNodes, numDependentNodes) -{{endif}} - -{{if 'cuGraphNodeGetDependentNodes_v2' in found_functions}} - -@cython.embedsignature(True) -def cuGraphNodeGetDependentNodes_v2(hNode, size_t numDependentNodes = 0): - """ Returns a node's dependent nodes (12.3+) - - Returns a list of `node's` dependent nodes. `dependentNodes` may be - NULL, in which case this function will return the number of dependent - nodes in `numDependentNodes`. Otherwise, `numDependentNodes` entries - will be filled in. If `numDependentNodes` is higher than the actual - number of dependent nodes, the remaining entries in `dependentNodes` - will be set to NULL, and the number of nodes actually obtained will be - returned in `numDependentNodes`. - Note that if an edge has non-zero (non-default) edge data and `edgeData` is NULL, this API will return :py:obj:`~.CUDA_ERROR_LOSSY_QUERY`. If `edgeData` is non-NULL, then @@ -37563,9 +47031,9 @@ def cuGraphNodeGetDependentNodes_v2(hNode, size_t numDependentNodes = 0): ------- CUresult :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_LOSSY_QUERY`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE` - dependentNodes : List[:py:obj:`~.CUgraphNode`] + dependentNodes : list[:py:obj:`~.CUgraphNode`] Pointer to return the dependent nodes - edgeData : List[:py:obj:`~.CUgraphEdgeData`] + edgeData : list[:py:obj:`~.CUgraphEdgeData`] Optional pointer to return edge data for dependent nodes numDependentNodes : int See description @@ -37575,43 +47043,46 @@ def cuGraphNodeGetDependentNodes_v2(hNode, size_t numDependentNodes = 0): :py:obj:`~.cuGraphNodeGetDependencies`, :py:obj:`~.cuGraphGetNodes`, :py:obj:`~.cuGraphGetRootNodes`, :py:obj:`~.cuGraphGetEdges`, :py:obj:`~.cuGraphAddDependencies`, :py:obj:`~.cuGraphRemoveDependencies` """ cdef size_t _graph_length = numDependentNodes - cdef ccuda.CUgraphNode chNode + cdef cydriver.CUgraphNode cyhNode if hNode is None: - chNode = 0 + phNode = 0 elif isinstance(hNode, (CUgraphNode,)): phNode = int(hNode) - chNode = phNode else: phNode = int(CUgraphNode(hNode)) - chNode = phNode - cdef ccuda.CUgraphNode* cdependentNodes = NULL + cyhNode = phNode + cdef cydriver.CUgraphNode* cydependentNodes = NULL pydependentNodes = [] if _graph_length != 0: - cdependentNodes = calloc(_graph_length, sizeof(ccuda.CUgraphNode)) - if cdependentNodes is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(_graph_length) + 'x' + str(sizeof(ccuda.CUgraphNode))) - cdef ccuda.CUgraphEdgeData* cedgeData = NULL + cydependentNodes = calloc(_graph_length, sizeof(cydriver.CUgraphNode)) + if cydependentNodes is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(_graph_length) + 'x' + str(sizeof(cydriver.CUgraphNode))) + cdef cydriver.CUgraphEdgeData* cyedgeData = NULL pyedgeData = [] if _graph_length != 0: - cedgeData = calloc(_graph_length, sizeof(ccuda.CUgraphEdgeData)) - if cedgeData is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(_graph_length) + 'x' + str(sizeof(ccuda.CUgraphEdgeData))) - err = ccuda.cuGraphNodeGetDependentNodes_v2(chNode, cdependentNodes, cedgeData, &numDependentNodes) + cyedgeData = calloc(_graph_length, sizeof(cydriver.CUgraphEdgeData)) + if cyedgeData is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(_graph_length) + 'x' + str(sizeof(cydriver.CUgraphEdgeData))) + with nogil: + err = cydriver.cuGraphNodeGetDependentNodes(cyhNode, cydependentNodes, cyedgeData, &numDependentNodes) if CUresult(err) == CUresult(0): - pydependentNodes = [CUgraphNode(init_value=cdependentNodes[idx]) for idx in range(_graph_length)] - if cdependentNodes is not NULL: - free(cdependentNodes) + pydependentNodes = [CUgraphNode() for _ in range(_graph_length)] + for idx in range(_graph_length): + (pydependentNodes[idx])._pvt_ptr[0] = cydependentNodes[idx] + if cydependentNodes is not NULL: + free(cydependentNodes) if CUresult(err) == CUresult(0): - pyedgeData = [CUgraphEdgeData(_ptr=&cedgeData[idx]) for idx in range(_graph_length)] - if cedgeData is not NULL: - free(cedgeData) - return (CUresult(err), pydependentNodes, pyedgeData, numDependentNodes) -{{endif}} - -{{if 'cuGraphAddDependencies' in found_functions}} + pyedgeData = [CUgraphEdgeData() for _ in range(_graph_length)] + for idx in range(_graph_length): + (pyedgeData[idx])._pvt_ptr[0] = cyedgeData[idx] + if cyedgeData is not NULL: + free(cyedgeData) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None, None, None) + return (_CUresult_SUCCESS, pydependentNodes, pyedgeData, numDependentNodes) @cython.embedsignature(True) -def cuGraphAddDependencies(hGraph, from_ : Optional[List[CUgraphNode]], to : Optional[List[CUgraphNode]], size_t numDependencies): +def cuGraphAddDependencies(hGraph, from_ : Optional[tuple[CUgraphNode] | list[CUgraphNode]], to : Optional[tuple[CUgraphNode] | list[CUgraphNode]], edgeData : Optional[tuple[CUgraphEdgeData] | list[CUgraphEdgeData]], size_t numDependencies): """ Adds dependency edges to a graph. The number of dependencies to be added is defined by `numDependencies` @@ -37625,83 +47096,11 @@ def cuGraphAddDependencies(hGraph, from_ : Optional[List[CUgraphNode]], to : Opt ---------- hGraph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` Graph to which dependencies are added - from : List[:py:obj:`~.CUgraphNode`] - Array of nodes that provide the dependencies - to : List[:py:obj:`~.CUgraphNode`] - Array of dependent nodes - numDependencies : size_t - Number of dependencies to be added - - Returns - ------- - CUresult - :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE` - - See Also - -------- - :py:obj:`~.cuGraphRemoveDependencies`, :py:obj:`~.cuGraphGetEdges`, :py:obj:`~.cuGraphNodeGetDependencies`, :py:obj:`~.cuGraphNodeGetDependentNodes` - """ - to = [] if to is None else to - if not all(isinstance(_x, (CUgraphNode,)) for _x in to): - raise TypeError("Argument 'to' is not instance of type (expected List[ccuda.CUgraphNode,]") - from_ = [] if from_ is None else from_ - if not all(isinstance(_x, (CUgraphNode,)) for _x in from_): - raise TypeError("Argument 'from_' is not instance of type (expected List[ccuda.CUgraphNode,]") - cdef ccuda.CUgraph chGraph - if hGraph is None: - chGraph = 0 - elif isinstance(hGraph, (CUgraph,)): - phGraph = int(hGraph) - chGraph = phGraph - else: - phGraph = int(CUgraph(hGraph)) - chGraph = phGraph - cdef ccuda.CUgraphNode* cfrom_ = NULL - if len(from_) > 0: - cfrom_ = calloc(len(from_), sizeof(ccuda.CUgraphNode)) - if cfrom_ is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(from_)) + 'x' + str(sizeof(ccuda.CUgraphNode))) - else: - for idx in range(len(from_)): - cfrom_[idx] = (from_[idx])._ptr[0] - cdef ccuda.CUgraphNode* cto = NULL - if len(to) > 0: - cto = calloc(len(to), sizeof(ccuda.CUgraphNode)) - if cto is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(to)) + 'x' + str(sizeof(ccuda.CUgraphNode))) - else: - for idx in range(len(to)): - cto[idx] = (to[idx])._ptr[0] - err = ccuda.cuGraphAddDependencies(chGraph, (from_[0])._ptr if len(from_) == 1 else cfrom_, (to[0])._ptr if len(to) == 1 else cto, numDependencies) - if cfrom_ is not NULL: - free(cfrom_) - if cto is not NULL: - free(cto) - return (CUresult(err),) -{{endif}} - -{{if 'cuGraphAddDependencies_v2' in found_functions}} - -@cython.embedsignature(True) -def cuGraphAddDependencies_v2(hGraph, from_ : Optional[List[CUgraphNode]], to : Optional[List[CUgraphNode]], edgeData : Optional[List[CUgraphEdgeData]], size_t numDependencies): - """ Adds dependency edges to a graph (12.3+) - - The number of dependencies to be added is defined by `numDependencies` - Elements in `from` and `to` at corresponding indices define a - dependency. Each node in `from` and `to` must belong to `hGraph`. - - If `numDependencies` is 0, elements in `from` and `to` will be ignored. - Specifying an existing dependency will return an error. - - Parameters - ---------- - hGraph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` - Graph to which dependencies are added - from : List[:py:obj:`~.CUgraphNode`] + from : list[:py:obj:`~.CUgraphNode`] Array of nodes that provide the dependencies - to : List[:py:obj:`~.CUgraphNode`] + to : list[:py:obj:`~.CUgraphNode`] Array of dependent nodes - edgeData : List[:py:obj:`~.CUgraphEdgeData`] + edgeData : list[:py:obj:`~.CUgraphEdgeData`] Optional array of edge data. If NULL, default (zeroed) edge data is assumed. numDependencies : size_t @@ -37718,59 +47117,62 @@ def cuGraphAddDependencies_v2(hGraph, from_ : Optional[List[CUgraphNode]], to : """ edgeData = [] if edgeData is None else edgeData if not all(isinstance(_x, (CUgraphEdgeData,)) for _x in edgeData): - raise TypeError("Argument 'edgeData' is not instance of type (expected List[ccuda.CUgraphEdgeData,]") + raise TypeError("Argument 'edgeData' is not instance of type (expected tuple[cydriver.CUgraphEdgeData,] or list[cydriver.CUgraphEdgeData,]") to = [] if to is None else to if not all(isinstance(_x, (CUgraphNode,)) for _x in to): - raise TypeError("Argument 'to' is not instance of type (expected List[ccuda.CUgraphNode,]") + raise TypeError("Argument 'to' is not instance of type (expected tuple[cydriver.CUgraphNode,] or list[cydriver.CUgraphNode,]") from_ = [] if from_ is None else from_ if not all(isinstance(_x, (CUgraphNode,)) for _x in from_): - raise TypeError("Argument 'from_' is not instance of type (expected List[ccuda.CUgraphNode,]") - cdef ccuda.CUgraph chGraph + raise TypeError("Argument 'from_' is not instance of type (expected tuple[cydriver.CUgraphNode,] or list[cydriver.CUgraphNode,]") + cdef cydriver.CUgraph cyhGraph if hGraph is None: - chGraph = 0 + phGraph = 0 elif isinstance(hGraph, (CUgraph,)): phGraph = int(hGraph) - chGraph = phGraph else: phGraph = int(CUgraph(hGraph)) - chGraph = phGraph - cdef ccuda.CUgraphNode* cfrom_ = NULL - if len(from_) > 0: - cfrom_ = calloc(len(from_), sizeof(ccuda.CUgraphNode)) - if cfrom_ is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(from_)) + 'x' + str(sizeof(ccuda.CUgraphNode))) + cyhGraph = phGraph + cdef cydriver.CUgraphNode* cyfrom_ = NULL + if len(from_) > 1: + cyfrom_ = calloc(len(from_), sizeof(cydriver.CUgraphNode)) + if cyfrom_ is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(from_)) + 'x' + str(sizeof(cydriver.CUgraphNode))) else: for idx in range(len(from_)): - cfrom_[idx] = (from_[idx])._ptr[0] - cdef ccuda.CUgraphNode* cto = NULL - if len(to) > 0: - cto = calloc(len(to), sizeof(ccuda.CUgraphNode)) - if cto is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(to)) + 'x' + str(sizeof(ccuda.CUgraphNode))) + cyfrom_[idx] = (from_[idx])._pvt_ptr[0] + elif len(from_) == 1: + cyfrom_ = (from_[0])._pvt_ptr + cdef cydriver.CUgraphNode* cyto = NULL + if len(to) > 1: + cyto = calloc(len(to), sizeof(cydriver.CUgraphNode)) + if cyto is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(to)) + 'x' + str(sizeof(cydriver.CUgraphNode))) else: for idx in range(len(to)): - cto[idx] = (to[idx])._ptr[0] - cdef ccuda.CUgraphEdgeData* cedgeData = NULL - if len(edgeData) > 0: - cedgeData = calloc(len(edgeData), sizeof(ccuda.CUgraphEdgeData)) - if cedgeData is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(edgeData)) + 'x' + str(sizeof(ccuda.CUgraphEdgeData))) + cyto[idx] = (to[idx])._pvt_ptr[0] + elif len(to) == 1: + cyto = (to[0])._pvt_ptr + cdef cydriver.CUgraphEdgeData* cyedgeData = NULL + if len(edgeData) > 1: + cyedgeData = calloc(len(edgeData), sizeof(cydriver.CUgraphEdgeData)) + if cyedgeData is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(edgeData)) + 'x' + str(sizeof(cydriver.CUgraphEdgeData))) for idx in range(len(edgeData)): - string.memcpy(&cedgeData[idx], (edgeData[idx])._ptr, sizeof(ccuda.CUgraphEdgeData)) - err = ccuda.cuGraphAddDependencies_v2(chGraph, (from_[0])._ptr if len(from_) == 1 else cfrom_, (to[0])._ptr if len(to) == 1 else cto, (edgeData[0])._ptr if len(edgeData) == 1 else cedgeData, numDependencies) - if cfrom_ is not NULL: - free(cfrom_) - if cto is not NULL: - free(cto) - if cedgeData is not NULL: - free(cedgeData) - return (CUresult(err),) -{{endif}} - -{{if 'cuGraphRemoveDependencies' in found_functions}} - -@cython.embedsignature(True) -def cuGraphRemoveDependencies(hGraph, from_ : Optional[List[CUgraphNode]], to : Optional[List[CUgraphNode]], size_t numDependencies): + string.memcpy(&cyedgeData[idx], (edgeData[idx])._pvt_ptr, sizeof(cydriver.CUgraphEdgeData)) + elif len(edgeData) == 1: + cyedgeData = (edgeData[0])._pvt_ptr + with nogil: + err = cydriver.cuGraphAddDependencies(cyhGraph, cyfrom_, cyto, cyedgeData, numDependencies) + if len(from_) > 1 and cyfrom_ is not NULL: + free(cyfrom_) + if len(to) > 1 and cyto is not NULL: + free(cyto) + if len(edgeData) > 1 and cyedgeData is not NULL: + free(cyedgeData) + return (_CUresult(err),) + +@cython.embedsignature(True) +def cuGraphRemoveDependencies(hGraph, from_ : Optional[tuple[CUgraphNode] | list[CUgraphNode]], to : Optional[tuple[CUgraphNode] | list[CUgraphNode]], edgeData : Optional[tuple[CUgraphEdgeData] | list[CUgraphEdgeData]], size_t numDependencies): """ Removes dependency edges from a graph. The number of `dependencies` to be removed is defined by @@ -37778,82 +47180,6 @@ def cuGraphRemoveDependencies(hGraph, from_ : Optional[List[CUgraphNode]], to : define a dependency. Each node in `from` and `to` must belong to `hGraph`. - If `numDependencies` is 0, elements in `from` and `to` will be ignored. - Specifying a non-existing dependency will return an error. - - Dependencies cannot be removed from graphs which contain allocation or - free nodes. Any attempt to do so will return an error. - - Parameters - ---------- - hGraph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` - Graph from which to remove dependencies - from : List[:py:obj:`~.CUgraphNode`] - Array of nodes that provide the dependencies - to : List[:py:obj:`~.CUgraphNode`] - Array of dependent nodes - numDependencies : size_t - Number of dependencies to be removed - - Returns - ------- - CUresult - :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE` - - See Also - -------- - :py:obj:`~.cuGraphAddDependencies`, :py:obj:`~.cuGraphGetEdges`, :py:obj:`~.cuGraphNodeGetDependencies`, :py:obj:`~.cuGraphNodeGetDependentNodes` - """ - to = [] if to is None else to - if not all(isinstance(_x, (CUgraphNode,)) for _x in to): - raise TypeError("Argument 'to' is not instance of type (expected List[ccuda.CUgraphNode,]") - from_ = [] if from_ is None else from_ - if not all(isinstance(_x, (CUgraphNode,)) for _x in from_): - raise TypeError("Argument 'from_' is not instance of type (expected List[ccuda.CUgraphNode,]") - cdef ccuda.CUgraph chGraph - if hGraph is None: - chGraph = 0 - elif isinstance(hGraph, (CUgraph,)): - phGraph = int(hGraph) - chGraph = phGraph - else: - phGraph = int(CUgraph(hGraph)) - chGraph = phGraph - cdef ccuda.CUgraphNode* cfrom_ = NULL - if len(from_) > 0: - cfrom_ = calloc(len(from_), sizeof(ccuda.CUgraphNode)) - if cfrom_ is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(from_)) + 'x' + str(sizeof(ccuda.CUgraphNode))) - else: - for idx in range(len(from_)): - cfrom_[idx] = (from_[idx])._ptr[0] - cdef ccuda.CUgraphNode* cto = NULL - if len(to) > 0: - cto = calloc(len(to), sizeof(ccuda.CUgraphNode)) - if cto is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(to)) + 'x' + str(sizeof(ccuda.CUgraphNode))) - else: - for idx in range(len(to)): - cto[idx] = (to[idx])._ptr[0] - err = ccuda.cuGraphRemoveDependencies(chGraph, (from_[0])._ptr if len(from_) == 1 else cfrom_, (to[0])._ptr if len(to) == 1 else cto, numDependencies) - if cfrom_ is not NULL: - free(cfrom_) - if cto is not NULL: - free(cto) - return (CUresult(err),) -{{endif}} - -{{if 'cuGraphRemoveDependencies_v2' in found_functions}} - -@cython.embedsignature(True) -def cuGraphRemoveDependencies_v2(hGraph, from_ : Optional[List[CUgraphNode]], to : Optional[List[CUgraphNode]], edgeData : Optional[List[CUgraphEdgeData]], size_t numDependencies): - """ Removes dependency edges from a graph (12.3+) - - The number of `dependencies` to be removed is defined by - `numDependencies`. Elements in `from` and `to` at corresponding indices - define a dependency. Each node in `from` and `to` must belong to - `hGraph`. - If `numDependencies` is 0, elements in `from` and `to` will be ignored. Specifying an edge that does not exist in the graph, with data matching `edgeData`, results in an error. `edgeData` is nullable, which is @@ -37866,11 +47192,11 @@ def cuGraphRemoveDependencies_v2(hGraph, from_ : Optional[List[CUgraphNode]], to ---------- hGraph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` Graph from which to remove dependencies - from : List[:py:obj:`~.CUgraphNode`] + from : list[:py:obj:`~.CUgraphNode`] Array of nodes that provide the dependencies - to : List[:py:obj:`~.CUgraphNode`] + to : list[:py:obj:`~.CUgraphNode`] Array of dependent nodes - edgeData : List[:py:obj:`~.CUgraphEdgeData`] + edgeData : list[:py:obj:`~.CUgraphEdgeData`] Optional array of edge data. If NULL, edge data is assumed to be default (zeroed). numDependencies : size_t @@ -37887,56 +47213,59 @@ def cuGraphRemoveDependencies_v2(hGraph, from_ : Optional[List[CUgraphNode]], to """ edgeData = [] if edgeData is None else edgeData if not all(isinstance(_x, (CUgraphEdgeData,)) for _x in edgeData): - raise TypeError("Argument 'edgeData' is not instance of type (expected List[ccuda.CUgraphEdgeData,]") + raise TypeError("Argument 'edgeData' is not instance of type (expected tuple[cydriver.CUgraphEdgeData,] or list[cydriver.CUgraphEdgeData,]") to = [] if to is None else to if not all(isinstance(_x, (CUgraphNode,)) for _x in to): - raise TypeError("Argument 'to' is not instance of type (expected List[ccuda.CUgraphNode,]") + raise TypeError("Argument 'to' is not instance of type (expected tuple[cydriver.CUgraphNode,] or list[cydriver.CUgraphNode,]") from_ = [] if from_ is None else from_ if not all(isinstance(_x, (CUgraphNode,)) for _x in from_): - raise TypeError("Argument 'from_' is not instance of type (expected List[ccuda.CUgraphNode,]") - cdef ccuda.CUgraph chGraph + raise TypeError("Argument 'from_' is not instance of type (expected tuple[cydriver.CUgraphNode,] or list[cydriver.CUgraphNode,]") + cdef cydriver.CUgraph cyhGraph if hGraph is None: - chGraph = 0 + phGraph = 0 elif isinstance(hGraph, (CUgraph,)): phGraph = int(hGraph) - chGraph = phGraph else: phGraph = int(CUgraph(hGraph)) - chGraph = phGraph - cdef ccuda.CUgraphNode* cfrom_ = NULL - if len(from_) > 0: - cfrom_ = calloc(len(from_), sizeof(ccuda.CUgraphNode)) - if cfrom_ is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(from_)) + 'x' + str(sizeof(ccuda.CUgraphNode))) + cyhGraph = phGraph + cdef cydriver.CUgraphNode* cyfrom_ = NULL + if len(from_) > 1: + cyfrom_ = calloc(len(from_), sizeof(cydriver.CUgraphNode)) + if cyfrom_ is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(from_)) + 'x' + str(sizeof(cydriver.CUgraphNode))) else: for idx in range(len(from_)): - cfrom_[idx] = (from_[idx])._ptr[0] - cdef ccuda.CUgraphNode* cto = NULL - if len(to) > 0: - cto = calloc(len(to), sizeof(ccuda.CUgraphNode)) - if cto is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(to)) + 'x' + str(sizeof(ccuda.CUgraphNode))) + cyfrom_[idx] = (from_[idx])._pvt_ptr[0] + elif len(from_) == 1: + cyfrom_ = (from_[0])._pvt_ptr + cdef cydriver.CUgraphNode* cyto = NULL + if len(to) > 1: + cyto = calloc(len(to), sizeof(cydriver.CUgraphNode)) + if cyto is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(to)) + 'x' + str(sizeof(cydriver.CUgraphNode))) else: for idx in range(len(to)): - cto[idx] = (to[idx])._ptr[0] - cdef ccuda.CUgraphEdgeData* cedgeData = NULL - if len(edgeData) > 0: - cedgeData = calloc(len(edgeData), sizeof(ccuda.CUgraphEdgeData)) - if cedgeData is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(edgeData)) + 'x' + str(sizeof(ccuda.CUgraphEdgeData))) + cyto[idx] = (to[idx])._pvt_ptr[0] + elif len(to) == 1: + cyto = (to[0])._pvt_ptr + cdef cydriver.CUgraphEdgeData* cyedgeData = NULL + if len(edgeData) > 1: + cyedgeData = calloc(len(edgeData), sizeof(cydriver.CUgraphEdgeData)) + if cyedgeData is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(edgeData)) + 'x' + str(sizeof(cydriver.CUgraphEdgeData))) for idx in range(len(edgeData)): - string.memcpy(&cedgeData[idx], (edgeData[idx])._ptr, sizeof(ccuda.CUgraphEdgeData)) - err = ccuda.cuGraphRemoveDependencies_v2(chGraph, (from_[0])._ptr if len(from_) == 1 else cfrom_, (to[0])._ptr if len(to) == 1 else cto, (edgeData[0])._ptr if len(edgeData) == 1 else cedgeData, numDependencies) - if cfrom_ is not NULL: - free(cfrom_) - if cto is not NULL: - free(cto) - if cedgeData is not NULL: - free(cedgeData) - return (CUresult(err),) -{{endif}} - -{{if 'cuGraphDestroyNode' in found_functions}} + string.memcpy(&cyedgeData[idx], (edgeData[idx])._pvt_ptr, sizeof(cydriver.CUgraphEdgeData)) + elif len(edgeData) == 1: + cyedgeData = (edgeData[0])._pvt_ptr + with nogil: + err = cydriver.cuGraphRemoveDependencies(cyhGraph, cyfrom_, cyto, cyedgeData, numDependencies) + if len(from_) > 1 and cyfrom_ is not NULL: + free(cyfrom_) + if len(to) > 1 and cyto is not NULL: + free(cyto) + if len(edgeData) > 1 and cyedgeData is not NULL: + free(cyedgeData) + return (_CUresult(err),) @cython.embedsignature(True) def cuGraphDestroyNode(hNode): @@ -37962,20 +47291,17 @@ def cuGraphDestroyNode(hNode): -------- :py:obj:`~.cuGraphAddChildGraphNode`, :py:obj:`~.cuGraphAddEmptyNode`, :py:obj:`~.cuGraphAddKernelNode`, :py:obj:`~.cuGraphAddHostNode`, :py:obj:`~.cuGraphAddMemcpyNode`, :py:obj:`~.cuGraphAddMemsetNode` """ - cdef ccuda.CUgraphNode chNode + cdef cydriver.CUgraphNode cyhNode if hNode is None: - chNode = 0 + phNode = 0 elif isinstance(hNode, (CUgraphNode,)): phNode = int(hNode) - chNode = phNode else: phNode = int(CUgraphNode(hNode)) - chNode = phNode - err = ccuda.cuGraphDestroyNode(chNode) - return (CUresult(err),) -{{endif}} - -{{if 'cuGraphInstantiateWithFlags' in found_functions}} + cyhNode = phNode + with nogil: + err = cydriver.cuGraphDestroyNode(cyhNode) + return (_CUresult(err),) @cython.embedsignature(True) def cuGraphInstantiate(hGraph, unsigned long long flags): @@ -38064,21 +47390,20 @@ def cuGraphInstantiate(hGraph, unsigned long long flags): -------- :py:obj:`~.cuGraphInstantiate`, :py:obj:`~.cuGraphCreate`, :py:obj:`~.cuGraphUpload`, :py:obj:`~.cuGraphLaunch`, :py:obj:`~.cuGraphExecDestroy` """ - cdef ccuda.CUgraph chGraph + cdef cydriver.CUgraph cyhGraph if hGraph is None: - chGraph = 0 + phGraph = 0 elif isinstance(hGraph, (CUgraph,)): phGraph = int(hGraph) - chGraph = phGraph else: phGraph = int(CUgraph(hGraph)) - chGraph = phGraph + cyhGraph = phGraph cdef CUgraphExec phGraphExec = CUgraphExec() - err = ccuda.cuGraphInstantiate(phGraphExec._ptr, chGraph, flags) - return (CUresult(err), phGraphExec) -{{endif}} - -{{if 'cuGraphInstantiateWithParams' in found_functions}} + with nogil: + err = cydriver.cuGraphInstantiate(phGraphExec._pvt_ptr, cyhGraph, flags) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, phGraphExec) @cython.embedsignature(True) def cuGraphInstantiateWithParams(hGraph, instantiateParams : Optional[CUDA_GRAPH_INSTANTIATE_PARAMS]): @@ -38207,22 +47532,21 @@ def cuGraphInstantiateWithParams(hGraph, instantiateParams : Optional[CUDA_GRAPH -------- :py:obj:`~.cuGraphCreate`, :py:obj:`~.cuGraphInstantiate`, :py:obj:`~.cuGraphExecDestroy` """ - cdef ccuda.CUgraph chGraph + cdef cydriver.CUgraph cyhGraph if hGraph is None: - chGraph = 0 + phGraph = 0 elif isinstance(hGraph, (CUgraph,)): phGraph = int(hGraph) - chGraph = phGraph else: phGraph = int(CUgraph(hGraph)) - chGraph = phGraph + cyhGraph = phGraph cdef CUgraphExec phGraphExec = CUgraphExec() - cdef ccuda.CUDA_GRAPH_INSTANTIATE_PARAMS* cinstantiateParams_ptr = instantiateParams._ptr if instantiateParams != None else NULL - err = ccuda.cuGraphInstantiateWithParams(phGraphExec._ptr, chGraph, cinstantiateParams_ptr) - return (CUresult(err), phGraphExec) -{{endif}} - -{{if 'cuGraphExecGetFlags' in found_functions}} + cdef cydriver.CUDA_GRAPH_INSTANTIATE_PARAMS* cyinstantiateParams_ptr = instantiateParams._pvt_ptr if instantiateParams is not None else NULL + with nogil: + err = cydriver.cuGraphInstantiateWithParams(phGraphExec._pvt_ptr, cyhGraph, cyinstantiateParams_ptr) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, phGraphExec) @cython.embedsignature(True) def cuGraphExecGetFlags(hGraphExec): @@ -38249,21 +47573,20 @@ def cuGraphExecGetFlags(hGraphExec): -------- :py:obj:`~.cuGraphInstantiate`, :py:obj:`~.cuGraphInstantiateWithParams` """ - cdef ccuda.CUgraphExec chGraphExec + cdef cydriver.CUgraphExec cyhGraphExec if hGraphExec is None: - chGraphExec = 0 + phGraphExec = 0 elif isinstance(hGraphExec, (CUgraphExec,)): phGraphExec = int(hGraphExec) - chGraphExec = phGraphExec else: phGraphExec = int(CUgraphExec(hGraphExec)) - chGraphExec = phGraphExec + cyhGraphExec = phGraphExec cdef cuuint64_t flags = cuuint64_t() - err = ccuda.cuGraphExecGetFlags(chGraphExec, flags._ptr) - return (CUresult(err), flags) -{{endif}} - -{{if 'cuGraphExecKernelNodeSetParams_v2' in found_functions}} + with nogil: + err = cydriver.cuGraphExecGetFlags(cyhGraphExec, flags._pvt_ptr) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, flags) @cython.embedsignature(True) def cuGraphExecKernelNodeSetParams(hGraphExec, hNode, nodeParams : Optional[CUDA_KERNEL_NODE_PARAMS]): @@ -38322,30 +47645,26 @@ def cuGraphExecKernelNodeSetParams(hGraphExec, hNode, nodeParams : Optional[CUDA -------- :py:obj:`~.cuGraphExecNodeSetParams`, :py:obj:`~.cuGraphAddKernelNode`, :py:obj:`~.cuGraphKernelNodeSetParams`, :py:obj:`~.cuGraphExecMemcpyNodeSetParams`, :py:obj:`~.cuGraphExecMemsetNodeSetParams`, :py:obj:`~.cuGraphExecHostNodeSetParams`, :py:obj:`~.cuGraphExecChildGraphNodeSetParams`, :py:obj:`~.cuGraphExecEventRecordNodeSetEvent`, :py:obj:`~.cuGraphExecEventWaitNodeSetEvent`, :py:obj:`~.cuGraphExecExternalSemaphoresSignalNodeSetParams`, :py:obj:`~.cuGraphExecExternalSemaphoresWaitNodeSetParams`, :py:obj:`~.cuGraphExecUpdate`, :py:obj:`~.cuGraphInstantiate` """ - cdef ccuda.CUgraphNode chNode + cdef cydriver.CUgraphNode cyhNode if hNode is None: - chNode = 0 + phNode = 0 elif isinstance(hNode, (CUgraphNode,)): phNode = int(hNode) - chNode = phNode else: phNode = int(CUgraphNode(hNode)) - chNode = phNode - cdef ccuda.CUgraphExec chGraphExec + cyhNode = phNode + cdef cydriver.CUgraphExec cyhGraphExec if hGraphExec is None: - chGraphExec = 0 + phGraphExec = 0 elif isinstance(hGraphExec, (CUgraphExec,)): phGraphExec = int(hGraphExec) - chGraphExec = phGraphExec else: phGraphExec = int(CUgraphExec(hGraphExec)) - chGraphExec = phGraphExec - cdef ccuda.CUDA_KERNEL_NODE_PARAMS* cnodeParams_ptr = nodeParams._ptr if nodeParams != None else NULL - err = ccuda.cuGraphExecKernelNodeSetParams(chGraphExec, chNode, cnodeParams_ptr) - return (CUresult(err),) -{{endif}} - -{{if 'cuGraphExecMemcpyNodeSetParams' in found_functions}} + cyhGraphExec = phGraphExec + cdef cydriver.CUDA_KERNEL_NODE_PARAMS* cynodeParams_ptr = nodeParams._pvt_ptr if nodeParams is not None else NULL + with nogil: + err = cydriver.cuGraphExecKernelNodeSetParams(cyhGraphExec, cyhNode, cynodeParams_ptr) + return (_CUresult(err),) @cython.embedsignature(True) def cuGraphExecMemcpyNodeSetParams(hGraphExec, hNode, copyParams : Optional[CUDA_MEMCPY3D], ctx): @@ -38390,39 +47709,34 @@ def cuGraphExecMemcpyNodeSetParams(hGraphExec, hNode, copyParams : Optional[CUDA -------- :py:obj:`~.cuGraphExecNodeSetParams`, :py:obj:`~.cuGraphAddMemcpyNode`, :py:obj:`~.cuGraphMemcpyNodeSetParams`, :py:obj:`~.cuGraphExecKernelNodeSetParams`, :py:obj:`~.cuGraphExecMemsetNodeSetParams`, :py:obj:`~.cuGraphExecHostNodeSetParams`, :py:obj:`~.cuGraphExecChildGraphNodeSetParams`, :py:obj:`~.cuGraphExecEventRecordNodeSetEvent`, :py:obj:`~.cuGraphExecEventWaitNodeSetEvent`, :py:obj:`~.cuGraphExecExternalSemaphoresSignalNodeSetParams`, :py:obj:`~.cuGraphExecExternalSemaphoresWaitNodeSetParams`, :py:obj:`~.cuGraphExecUpdate`, :py:obj:`~.cuGraphInstantiate` """ - cdef ccuda.CUcontext cctx + cdef cydriver.CUcontext cyctx if ctx is None: - cctx = 0 + pctx = 0 elif isinstance(ctx, (CUcontext,)): pctx = int(ctx) - cctx = pctx else: pctx = int(CUcontext(ctx)) - cctx = pctx - cdef ccuda.CUgraphNode chNode + cyctx = pctx + cdef cydriver.CUgraphNode cyhNode if hNode is None: - chNode = 0 + phNode = 0 elif isinstance(hNode, (CUgraphNode,)): phNode = int(hNode) - chNode = phNode else: phNode = int(CUgraphNode(hNode)) - chNode = phNode - cdef ccuda.CUgraphExec chGraphExec + cyhNode = phNode + cdef cydriver.CUgraphExec cyhGraphExec if hGraphExec is None: - chGraphExec = 0 + phGraphExec = 0 elif isinstance(hGraphExec, (CUgraphExec,)): phGraphExec = int(hGraphExec) - chGraphExec = phGraphExec else: phGraphExec = int(CUgraphExec(hGraphExec)) - chGraphExec = phGraphExec - cdef ccuda.CUDA_MEMCPY3D* ccopyParams_ptr = copyParams._ptr if copyParams != None else NULL - err = ccuda.cuGraphExecMemcpyNodeSetParams(chGraphExec, chNode, ccopyParams_ptr, cctx) - return (CUresult(err),) -{{endif}} - -{{if 'cuGraphExecMemsetNodeSetParams' in found_functions}} + cyhGraphExec = phGraphExec + cdef cydriver.CUDA_MEMCPY3D* cycopyParams_ptr = copyParams._pvt_ptr if copyParams is not None else NULL + with nogil: + err = cydriver.cuGraphExecMemcpyNodeSetParams(cyhGraphExec, cyhNode, cycopyParams_ptr, cyctx) + return (_CUresult(err),) @cython.embedsignature(True) def cuGraphExecMemsetNodeSetParams(hGraphExec, hNode, memsetParams : Optional[CUDA_MEMSET_NODE_PARAMS], ctx): @@ -38433,20 +47747,25 @@ def cuGraphExecMemsetNodeSetParams(hGraphExec, hNode, memsetParams : Optional[CU remain in the graph which was used to instantiate `hGraphExec`. Changed edges to and from hNode are ignored. - The destination memory in `memsetParams` must be allocated from the - same contexts as the original destination memory. Both the - instantiation-time memory operand and the memory operand in - `memsetParams` must be 1-dimensional. Zero-length operations are not - supported. + Zero sized operations are not supported. + + The new destination pointer in memsetParams must be to the same kind of + allocation as the original destination pointer and have the same + context association and device mapping as the original destination + pointer. + + Both the value and pointer address may be updated. Changing other + aspects of the memset (width, height, element size or pitch) may cause + the update to be rejected. Specifically, for 2d memsets, all dimension + changes are rejected. For 1d memsets, changes in height are explicitly + rejected and other changes are opportunistically allowed if the + resulting work maps onto the work resources already allocated for the + node. The modifications only affect future launches of `hGraphExec`. Already enqueued or running launches of `hGraphExec` are not affected by this call. hNode is also not modified by this call. - Returns CUDA_ERROR_INVALID_VALUE if the memory operand's mappings - changed or either the original or new memory operand are - multidimensional. - Parameters ---------- hGraphExec : :py:obj:`~.CUgraphExec` or :py:obj:`~.cudaGraphExec_t` @@ -38467,39 +47786,34 @@ def cuGraphExecMemsetNodeSetParams(hGraphExec, hNode, memsetParams : Optional[CU -------- :py:obj:`~.cuGraphExecNodeSetParams`, :py:obj:`~.cuGraphAddMemsetNode`, :py:obj:`~.cuGraphMemsetNodeSetParams`, :py:obj:`~.cuGraphExecKernelNodeSetParams`, :py:obj:`~.cuGraphExecMemcpyNodeSetParams`, :py:obj:`~.cuGraphExecHostNodeSetParams`, :py:obj:`~.cuGraphExecChildGraphNodeSetParams`, :py:obj:`~.cuGraphExecEventRecordNodeSetEvent`, :py:obj:`~.cuGraphExecEventWaitNodeSetEvent`, :py:obj:`~.cuGraphExecExternalSemaphoresSignalNodeSetParams`, :py:obj:`~.cuGraphExecExternalSemaphoresWaitNodeSetParams`, :py:obj:`~.cuGraphExecUpdate`, :py:obj:`~.cuGraphInstantiate` """ - cdef ccuda.CUcontext cctx + cdef cydriver.CUcontext cyctx if ctx is None: - cctx = 0 + pctx = 0 elif isinstance(ctx, (CUcontext,)): pctx = int(ctx) - cctx = pctx else: pctx = int(CUcontext(ctx)) - cctx = pctx - cdef ccuda.CUgraphNode chNode + cyctx = pctx + cdef cydriver.CUgraphNode cyhNode if hNode is None: - chNode = 0 + phNode = 0 elif isinstance(hNode, (CUgraphNode,)): phNode = int(hNode) - chNode = phNode else: phNode = int(CUgraphNode(hNode)) - chNode = phNode - cdef ccuda.CUgraphExec chGraphExec + cyhNode = phNode + cdef cydriver.CUgraphExec cyhGraphExec if hGraphExec is None: - chGraphExec = 0 + phGraphExec = 0 elif isinstance(hGraphExec, (CUgraphExec,)): phGraphExec = int(hGraphExec) - chGraphExec = phGraphExec else: phGraphExec = int(CUgraphExec(hGraphExec)) - chGraphExec = phGraphExec - cdef ccuda.CUDA_MEMSET_NODE_PARAMS* cmemsetParams_ptr = memsetParams._ptr if memsetParams != None else NULL - err = ccuda.cuGraphExecMemsetNodeSetParams(chGraphExec, chNode, cmemsetParams_ptr, cctx) - return (CUresult(err),) -{{endif}} - -{{if 'cuGraphExecHostNodeSetParams' in found_functions}} + cyhGraphExec = phGraphExec + cdef cydriver.CUDA_MEMSET_NODE_PARAMS* cymemsetParams_ptr = memsetParams._pvt_ptr if memsetParams is not None else NULL + with nogil: + err = cydriver.cuGraphExecMemsetNodeSetParams(cyhGraphExec, cyhNode, cymemsetParams_ptr, cyctx) + return (_CUresult(err),) @cython.embedsignature(True) def cuGraphExecHostNodeSetParams(hGraphExec, hNode, nodeParams : Optional[CUDA_HOST_NODE_PARAMS]): @@ -38532,30 +47846,26 @@ def cuGraphExecHostNodeSetParams(hGraphExec, hNode, nodeParams : Optional[CUDA_H -------- :py:obj:`~.cuGraphExecNodeSetParams`, :py:obj:`~.cuGraphAddHostNode`, :py:obj:`~.cuGraphHostNodeSetParams`, :py:obj:`~.cuGraphExecKernelNodeSetParams`, :py:obj:`~.cuGraphExecMemcpyNodeSetParams`, :py:obj:`~.cuGraphExecMemsetNodeSetParams`, :py:obj:`~.cuGraphExecChildGraphNodeSetParams`, :py:obj:`~.cuGraphExecEventRecordNodeSetEvent`, :py:obj:`~.cuGraphExecEventWaitNodeSetEvent`, :py:obj:`~.cuGraphExecExternalSemaphoresSignalNodeSetParams`, :py:obj:`~.cuGraphExecExternalSemaphoresWaitNodeSetParams`, :py:obj:`~.cuGraphExecUpdate`, :py:obj:`~.cuGraphInstantiate` """ - cdef ccuda.CUgraphNode chNode + cdef cydriver.CUgraphNode cyhNode if hNode is None: - chNode = 0 + phNode = 0 elif isinstance(hNode, (CUgraphNode,)): phNode = int(hNode) - chNode = phNode else: phNode = int(CUgraphNode(hNode)) - chNode = phNode - cdef ccuda.CUgraphExec chGraphExec + cyhNode = phNode + cdef cydriver.CUgraphExec cyhGraphExec if hGraphExec is None: - chGraphExec = 0 + phGraphExec = 0 elif isinstance(hGraphExec, (CUgraphExec,)): phGraphExec = int(hGraphExec) - chGraphExec = phGraphExec else: phGraphExec = int(CUgraphExec(hGraphExec)) - chGraphExec = phGraphExec - cdef ccuda.CUDA_HOST_NODE_PARAMS* cnodeParams_ptr = nodeParams._ptr if nodeParams != None else NULL - err = ccuda.cuGraphExecHostNodeSetParams(chGraphExec, chNode, cnodeParams_ptr) - return (CUresult(err),) -{{endif}} - -{{if 'cuGraphExecChildGraphNodeSetParams' in found_functions}} + cyhGraphExec = phGraphExec + cdef cydriver.CUDA_HOST_NODE_PARAMS* cynodeParams_ptr = nodeParams._pvt_ptr if nodeParams is not None else NULL + with nogil: + err = cydriver.cuGraphExecHostNodeSetParams(cyhGraphExec, cyhNode, cynodeParams_ptr) + return (_CUresult(err),) @cython.embedsignature(True) def cuGraphExecChildGraphNodeSetParams(hGraphExec, hNode, childGraph): @@ -38596,38 +47906,33 @@ def cuGraphExecChildGraphNodeSetParams(hGraphExec, hNode, childGraph): -------- :py:obj:`~.cuGraphExecNodeSetParams`, :py:obj:`~.cuGraphAddChildGraphNode`, :py:obj:`~.cuGraphChildGraphNodeGetGraph`, :py:obj:`~.cuGraphExecKernelNodeSetParams`, :py:obj:`~.cuGraphExecMemcpyNodeSetParams`, :py:obj:`~.cuGraphExecMemsetNodeSetParams`, :py:obj:`~.cuGraphExecHostNodeSetParams`, :py:obj:`~.cuGraphExecEventRecordNodeSetEvent`, :py:obj:`~.cuGraphExecEventWaitNodeSetEvent`, :py:obj:`~.cuGraphExecExternalSemaphoresSignalNodeSetParams`, :py:obj:`~.cuGraphExecExternalSemaphoresWaitNodeSetParams`, :py:obj:`~.cuGraphExecUpdate`, :py:obj:`~.cuGraphInstantiate` """ - cdef ccuda.CUgraph cchildGraph + cdef cydriver.CUgraph cychildGraph if childGraph is None: - cchildGraph = 0 + pchildGraph = 0 elif isinstance(childGraph, (CUgraph,)): pchildGraph = int(childGraph) - cchildGraph = pchildGraph else: pchildGraph = int(CUgraph(childGraph)) - cchildGraph = pchildGraph - cdef ccuda.CUgraphNode chNode + cychildGraph = pchildGraph + cdef cydriver.CUgraphNode cyhNode if hNode is None: - chNode = 0 + phNode = 0 elif isinstance(hNode, (CUgraphNode,)): phNode = int(hNode) - chNode = phNode else: phNode = int(CUgraphNode(hNode)) - chNode = phNode - cdef ccuda.CUgraphExec chGraphExec + cyhNode = phNode + cdef cydriver.CUgraphExec cyhGraphExec if hGraphExec is None: - chGraphExec = 0 + phGraphExec = 0 elif isinstance(hGraphExec, (CUgraphExec,)): phGraphExec = int(hGraphExec) - chGraphExec = phGraphExec else: phGraphExec = int(CUgraphExec(hGraphExec)) - chGraphExec = phGraphExec - err = ccuda.cuGraphExecChildGraphNodeSetParams(chGraphExec, chNode, cchildGraph) - return (CUresult(err),) -{{endif}} - -{{if 'cuGraphExecEventRecordNodeSetEvent' in found_functions}} + cyhGraphExec = phGraphExec + with nogil: + err = cydriver.cuGraphExecChildGraphNodeSetParams(cyhGraphExec, cyhNode, cychildGraph) + return (_CUresult(err),) @cython.embedsignature(True) def cuGraphExecEventRecordNodeSetEvent(hGraphExec, hNode, event): @@ -38661,38 +47966,33 @@ def cuGraphExecEventRecordNodeSetEvent(hGraphExec, hNode, event): -------- :py:obj:`~.cuGraphExecNodeSetParams`, :py:obj:`~.cuGraphAddEventRecordNode`, :py:obj:`~.cuGraphEventRecordNodeGetEvent`, :py:obj:`~.cuGraphEventWaitNodeSetEvent`, :py:obj:`~.cuEventRecordWithFlags`, :py:obj:`~.cuStreamWaitEvent`, :py:obj:`~.cuGraphExecKernelNodeSetParams`, :py:obj:`~.cuGraphExecMemcpyNodeSetParams`, :py:obj:`~.cuGraphExecMemsetNodeSetParams`, :py:obj:`~.cuGraphExecHostNodeSetParams`, :py:obj:`~.cuGraphExecChildGraphNodeSetParams`, :py:obj:`~.cuGraphExecEventWaitNodeSetEvent`, :py:obj:`~.cuGraphExecExternalSemaphoresSignalNodeSetParams`, :py:obj:`~.cuGraphExecExternalSemaphoresWaitNodeSetParams`, :py:obj:`~.cuGraphExecUpdate`, :py:obj:`~.cuGraphInstantiate` """ - cdef ccuda.CUevent cevent + cdef cydriver.CUevent cyevent if event is None: - cevent = 0 + pevent = 0 elif isinstance(event, (CUevent,)): pevent = int(event) - cevent = pevent else: pevent = int(CUevent(event)) - cevent = pevent - cdef ccuda.CUgraphNode chNode + cyevent = pevent + cdef cydriver.CUgraphNode cyhNode if hNode is None: - chNode = 0 + phNode = 0 elif isinstance(hNode, (CUgraphNode,)): phNode = int(hNode) - chNode = phNode else: phNode = int(CUgraphNode(hNode)) - chNode = phNode - cdef ccuda.CUgraphExec chGraphExec + cyhNode = phNode + cdef cydriver.CUgraphExec cyhGraphExec if hGraphExec is None: - chGraphExec = 0 + phGraphExec = 0 elif isinstance(hGraphExec, (CUgraphExec,)): phGraphExec = int(hGraphExec) - chGraphExec = phGraphExec else: phGraphExec = int(CUgraphExec(hGraphExec)) - chGraphExec = phGraphExec - err = ccuda.cuGraphExecEventRecordNodeSetEvent(chGraphExec, chNode, cevent) - return (CUresult(err),) -{{endif}} - -{{if 'cuGraphExecEventWaitNodeSetEvent' in found_functions}} + cyhGraphExec = phGraphExec + with nogil: + err = cydriver.cuGraphExecEventRecordNodeSetEvent(cyhGraphExec, cyhNode, cyevent) + return (_CUresult(err),) @cython.embedsignature(True) def cuGraphExecEventWaitNodeSetEvent(hGraphExec, hNode, event): @@ -38726,38 +48026,33 @@ def cuGraphExecEventWaitNodeSetEvent(hGraphExec, hNode, event): -------- :py:obj:`~.cuGraphExecNodeSetParams`, :py:obj:`~.cuGraphAddEventWaitNode`, :py:obj:`~.cuGraphEventWaitNodeGetEvent`, :py:obj:`~.cuGraphEventRecordNodeSetEvent`, :py:obj:`~.cuEventRecordWithFlags`, :py:obj:`~.cuStreamWaitEvent`, :py:obj:`~.cuGraphExecKernelNodeSetParams`, :py:obj:`~.cuGraphExecMemcpyNodeSetParams`, :py:obj:`~.cuGraphExecMemsetNodeSetParams`, :py:obj:`~.cuGraphExecHostNodeSetParams`, :py:obj:`~.cuGraphExecChildGraphNodeSetParams`, :py:obj:`~.cuGraphExecEventRecordNodeSetEvent`, :py:obj:`~.cuGraphExecExternalSemaphoresSignalNodeSetParams`, :py:obj:`~.cuGraphExecExternalSemaphoresWaitNodeSetParams`, :py:obj:`~.cuGraphExecUpdate`, :py:obj:`~.cuGraphInstantiate` """ - cdef ccuda.CUevent cevent + cdef cydriver.CUevent cyevent if event is None: - cevent = 0 + pevent = 0 elif isinstance(event, (CUevent,)): pevent = int(event) - cevent = pevent else: pevent = int(CUevent(event)) - cevent = pevent - cdef ccuda.CUgraphNode chNode + cyevent = pevent + cdef cydriver.CUgraphNode cyhNode if hNode is None: - chNode = 0 + phNode = 0 elif isinstance(hNode, (CUgraphNode,)): phNode = int(hNode) - chNode = phNode else: phNode = int(CUgraphNode(hNode)) - chNode = phNode - cdef ccuda.CUgraphExec chGraphExec + cyhNode = phNode + cdef cydriver.CUgraphExec cyhGraphExec if hGraphExec is None: - chGraphExec = 0 + phGraphExec = 0 elif isinstance(hGraphExec, (CUgraphExec,)): phGraphExec = int(hGraphExec) - chGraphExec = phGraphExec else: phGraphExec = int(CUgraphExec(hGraphExec)) - chGraphExec = phGraphExec - err = ccuda.cuGraphExecEventWaitNodeSetEvent(chGraphExec, chNode, cevent) - return (CUresult(err),) -{{endif}} - -{{if 'cuGraphExecExternalSemaphoresSignalNodeSetParams' in found_functions}} + cyhGraphExec = phGraphExec + with nogil: + err = cydriver.cuGraphExecEventWaitNodeSetEvent(cyhGraphExec, cyhNode, cyevent) + return (_CUresult(err),) @cython.embedsignature(True) def cuGraphExecExternalSemaphoresSignalNodeSetParams(hGraphExec, hNode, nodeParams : Optional[CUDA_EXT_SEM_SIGNAL_NODE_PARAMS]): @@ -38795,30 +48090,26 @@ def cuGraphExecExternalSemaphoresSignalNodeSetParams(hGraphExec, hNode, nodePara -------- :py:obj:`~.cuGraphExecNodeSetParams`, :py:obj:`~.cuGraphAddExternalSemaphoresSignalNode`, :py:obj:`~.cuImportExternalSemaphore`, :py:obj:`~.cuSignalExternalSemaphoresAsync`, :py:obj:`~.cuWaitExternalSemaphoresAsync`, :py:obj:`~.cuGraphExecKernelNodeSetParams`, :py:obj:`~.cuGraphExecMemcpyNodeSetParams`, :py:obj:`~.cuGraphExecMemsetNodeSetParams`, :py:obj:`~.cuGraphExecHostNodeSetParams`, :py:obj:`~.cuGraphExecChildGraphNodeSetParams`, :py:obj:`~.cuGraphExecEventRecordNodeSetEvent`, :py:obj:`~.cuGraphExecEventWaitNodeSetEvent`, :py:obj:`~.cuGraphExecExternalSemaphoresWaitNodeSetParams`, :py:obj:`~.cuGraphExecUpdate`, :py:obj:`~.cuGraphInstantiate` """ - cdef ccuda.CUgraphNode chNode + cdef cydriver.CUgraphNode cyhNode if hNode is None: - chNode = 0 + phNode = 0 elif isinstance(hNode, (CUgraphNode,)): phNode = int(hNode) - chNode = phNode else: phNode = int(CUgraphNode(hNode)) - chNode = phNode - cdef ccuda.CUgraphExec chGraphExec + cyhNode = phNode + cdef cydriver.CUgraphExec cyhGraphExec if hGraphExec is None: - chGraphExec = 0 + phGraphExec = 0 elif isinstance(hGraphExec, (CUgraphExec,)): phGraphExec = int(hGraphExec) - chGraphExec = phGraphExec else: phGraphExec = int(CUgraphExec(hGraphExec)) - chGraphExec = phGraphExec - cdef ccuda.CUDA_EXT_SEM_SIGNAL_NODE_PARAMS* cnodeParams_ptr = nodeParams._ptr if nodeParams != None else NULL - err = ccuda.cuGraphExecExternalSemaphoresSignalNodeSetParams(chGraphExec, chNode, cnodeParams_ptr) - return (CUresult(err),) -{{endif}} - -{{if 'cuGraphExecExternalSemaphoresWaitNodeSetParams' in found_functions}} + cyhGraphExec = phGraphExec + cdef cydriver.CUDA_EXT_SEM_SIGNAL_NODE_PARAMS* cynodeParams_ptr = nodeParams._pvt_ptr if nodeParams is not None else NULL + with nogil: + err = cydriver.cuGraphExecExternalSemaphoresSignalNodeSetParams(cyhGraphExec, cyhNode, cynodeParams_ptr) + return (_CUresult(err),) @cython.embedsignature(True) def cuGraphExecExternalSemaphoresWaitNodeSetParams(hGraphExec, hNode, nodeParams : Optional[CUDA_EXT_SEM_WAIT_NODE_PARAMS]): @@ -38856,30 +48147,26 @@ def cuGraphExecExternalSemaphoresWaitNodeSetParams(hGraphExec, hNode, nodeParams -------- :py:obj:`~.cuGraphExecNodeSetParams`, :py:obj:`~.cuGraphAddExternalSemaphoresWaitNode`, :py:obj:`~.cuImportExternalSemaphore`, :py:obj:`~.cuSignalExternalSemaphoresAsync`, :py:obj:`~.cuWaitExternalSemaphoresAsync`, :py:obj:`~.cuGraphExecKernelNodeSetParams`, :py:obj:`~.cuGraphExecMemcpyNodeSetParams`, :py:obj:`~.cuGraphExecMemsetNodeSetParams`, :py:obj:`~.cuGraphExecHostNodeSetParams`, :py:obj:`~.cuGraphExecChildGraphNodeSetParams`, :py:obj:`~.cuGraphExecEventRecordNodeSetEvent`, :py:obj:`~.cuGraphExecEventWaitNodeSetEvent`, :py:obj:`~.cuGraphExecExternalSemaphoresSignalNodeSetParams`, :py:obj:`~.cuGraphExecUpdate`, :py:obj:`~.cuGraphInstantiate` """ - cdef ccuda.CUgraphNode chNode + cdef cydriver.CUgraphNode cyhNode if hNode is None: - chNode = 0 + phNode = 0 elif isinstance(hNode, (CUgraphNode,)): phNode = int(hNode) - chNode = phNode else: phNode = int(CUgraphNode(hNode)) - chNode = phNode - cdef ccuda.CUgraphExec chGraphExec + cyhNode = phNode + cdef cydriver.CUgraphExec cyhGraphExec if hGraphExec is None: - chGraphExec = 0 + phGraphExec = 0 elif isinstance(hGraphExec, (CUgraphExec,)): phGraphExec = int(hGraphExec) - chGraphExec = phGraphExec else: phGraphExec = int(CUgraphExec(hGraphExec)) - chGraphExec = phGraphExec - cdef ccuda.CUDA_EXT_SEM_WAIT_NODE_PARAMS* cnodeParams_ptr = nodeParams._ptr if nodeParams != None else NULL - err = ccuda.cuGraphExecExternalSemaphoresWaitNodeSetParams(chGraphExec, chNode, cnodeParams_ptr) - return (CUresult(err),) -{{endif}} - -{{if 'cuGraphNodeSetEnabled' in found_functions}} + cyhGraphExec = phGraphExec + cdef cydriver.CUDA_EXT_SEM_WAIT_NODE_PARAMS* cynodeParams_ptr = nodeParams._pvt_ptr if nodeParams is not None else NULL + with nogil: + err = cydriver.cuGraphExecExternalSemaphoresWaitNodeSetParams(cyhGraphExec, cyhNode, cynodeParams_ptr) + return (_CUresult(err),) @cython.embedsignature(True) def cuGraphNodeSetEnabled(hGraphExec, hNode, unsigned int isEnabled): @@ -38927,29 +48214,25 @@ def cuGraphNodeSetEnabled(hGraphExec, hNode, unsigned int isEnabled): ----- Currently only kernel, memset and memcpy nodes are supported. """ - cdef ccuda.CUgraphNode chNode + cdef cydriver.CUgraphNode cyhNode if hNode is None: - chNode = 0 + phNode = 0 elif isinstance(hNode, (CUgraphNode,)): phNode = int(hNode) - chNode = phNode else: phNode = int(CUgraphNode(hNode)) - chNode = phNode - cdef ccuda.CUgraphExec chGraphExec + cyhNode = phNode + cdef cydriver.CUgraphExec cyhGraphExec if hGraphExec is None: - chGraphExec = 0 + phGraphExec = 0 elif isinstance(hGraphExec, (CUgraphExec,)): phGraphExec = int(hGraphExec) - chGraphExec = phGraphExec else: phGraphExec = int(CUgraphExec(hGraphExec)) - chGraphExec = phGraphExec - err = ccuda.cuGraphNodeSetEnabled(chGraphExec, chNode, isEnabled) - return (CUresult(err),) -{{endif}} - -{{if 'cuGraphNodeGetEnabled' in found_functions}} + cyhGraphExec = phGraphExec + with nogil: + err = cydriver.cuGraphNodeSetEnabled(cyhGraphExec, cyhNode, isEnabled) + return (_CUresult(err),) @cython.embedsignature(True) def cuGraphNodeGetEnabled(hGraphExec, hNode): @@ -38986,30 +48269,28 @@ def cuGraphNodeGetEnabled(hGraphExec, hNode): This function will not reflect device-side updates for device-updatable kernel nodes. """ - cdef ccuda.CUgraphNode chNode + cdef cydriver.CUgraphNode cyhNode if hNode is None: - chNode = 0 + phNode = 0 elif isinstance(hNode, (CUgraphNode,)): phNode = int(hNode) - chNode = phNode else: phNode = int(CUgraphNode(hNode)) - chNode = phNode - cdef ccuda.CUgraphExec chGraphExec + cyhNode = phNode + cdef cydriver.CUgraphExec cyhGraphExec if hGraphExec is None: - chGraphExec = 0 + phGraphExec = 0 elif isinstance(hGraphExec, (CUgraphExec,)): phGraphExec = int(hGraphExec) - chGraphExec = phGraphExec else: phGraphExec = int(CUgraphExec(hGraphExec)) - chGraphExec = phGraphExec + cyhGraphExec = phGraphExec cdef unsigned int isEnabled = 0 - err = ccuda.cuGraphNodeGetEnabled(chGraphExec, chNode, &isEnabled) - return (CUresult(err), isEnabled) -{{endif}} - -{{if 'cuGraphUpload' in found_functions}} + with nogil: + err = cydriver.cuGraphNodeGetEnabled(cyhGraphExec, cyhNode, &isEnabled) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, isEnabled) @cython.embedsignature(True) def cuGraphUpload(hGraphExec, hStream): @@ -39037,29 +48318,25 @@ def cuGraphUpload(hGraphExec, hStream): -------- :py:obj:`~.cuGraphInstantiate`, :py:obj:`~.cuGraphLaunch`, :py:obj:`~.cuGraphExecDestroy` """ - cdef ccuda.CUstream chStream + cdef cydriver.CUstream cyhStream if hStream is None: - chStream = 0 + phStream = 0 elif isinstance(hStream, (CUstream,)): phStream = int(hStream) - chStream = phStream else: phStream = int(CUstream(hStream)) - chStream = phStream - cdef ccuda.CUgraphExec chGraphExec + cyhStream = phStream + cdef cydriver.CUgraphExec cyhGraphExec if hGraphExec is None: - chGraphExec = 0 + phGraphExec = 0 elif isinstance(hGraphExec, (CUgraphExec,)): phGraphExec = int(hGraphExec) - chGraphExec = phGraphExec else: phGraphExec = int(CUgraphExec(hGraphExec)) - chGraphExec = phGraphExec - err = ccuda.cuGraphUpload(chGraphExec, chStream) - return (CUresult(err),) -{{endif}} - -{{if 'cuGraphLaunch' in found_functions}} + cyhGraphExec = phGraphExec + with nogil: + err = cydriver.cuGraphUpload(cyhGraphExec, cyhStream) + return (_CUresult(err),) @cython.embedsignature(True) def cuGraphLaunch(hGraphExec, hStream): @@ -39092,29 +48369,25 @@ def cuGraphLaunch(hGraphExec, hStream): -------- :py:obj:`~.cuGraphInstantiate`, :py:obj:`~.cuGraphUpload`, :py:obj:`~.cuGraphExecDestroy` """ - cdef ccuda.CUstream chStream + cdef cydriver.CUstream cyhStream if hStream is None: - chStream = 0 + phStream = 0 elif isinstance(hStream, (CUstream,)): phStream = int(hStream) - chStream = phStream else: phStream = int(CUstream(hStream)) - chStream = phStream - cdef ccuda.CUgraphExec chGraphExec + cyhStream = phStream + cdef cydriver.CUgraphExec cyhGraphExec if hGraphExec is None: - chGraphExec = 0 + phGraphExec = 0 elif isinstance(hGraphExec, (CUgraphExec,)): phGraphExec = int(hGraphExec) - chGraphExec = phGraphExec else: phGraphExec = int(CUgraphExec(hGraphExec)) - chGraphExec = phGraphExec - err = ccuda.cuGraphLaunch(chGraphExec, chStream) - return (CUresult(err),) -{{endif}} - -{{if 'cuGraphExecDestroy' in found_functions}} + cyhGraphExec = phGraphExec + with nogil: + err = cydriver.cuGraphLaunch(cyhGraphExec, cyhStream) + return (_CUresult(err),) @cython.embedsignature(True) def cuGraphExecDestroy(hGraphExec): @@ -39138,20 +48411,17 @@ def cuGraphExecDestroy(hGraphExec): -------- :py:obj:`~.cuGraphInstantiate`, :py:obj:`~.cuGraphUpload`, :py:obj:`~.cuGraphLaunch` """ - cdef ccuda.CUgraphExec chGraphExec + cdef cydriver.CUgraphExec cyhGraphExec if hGraphExec is None: - chGraphExec = 0 + phGraphExec = 0 elif isinstance(hGraphExec, (CUgraphExec,)): phGraphExec = int(hGraphExec) - chGraphExec = phGraphExec else: phGraphExec = int(CUgraphExec(hGraphExec)) - chGraphExec = phGraphExec - err = ccuda.cuGraphExecDestroy(chGraphExec) - return (CUresult(err),) -{{endif}} - -{{if 'cuGraphDestroy' in found_functions}} + cyhGraphExec = phGraphExec + with nogil: + err = cydriver.cuGraphExecDestroy(cyhGraphExec) + return (_CUresult(err),) @cython.embedsignature(True) def cuGraphDestroy(hGraph): @@ -39173,20 +48443,17 @@ def cuGraphDestroy(hGraph): -------- :py:obj:`~.cuGraphCreate` """ - cdef ccuda.CUgraph chGraph + cdef cydriver.CUgraph cyhGraph if hGraph is None: - chGraph = 0 + phGraph = 0 elif isinstance(hGraph, (CUgraph,)): phGraph = int(hGraph) - chGraph = phGraph else: phGraph = int(CUgraph(hGraph)) - chGraph = phGraph - err = ccuda.cuGraphDestroy(chGraph) - return (CUresult(err),) -{{endif}} - -{{if 'cuGraphExecUpdate_v2' in found_functions}} + cyhGraph = phGraph + with nogil: + err = cydriver.cuGraphDestroy(cyhGraph) + return (_CUresult(err),) @cython.embedsignature(True) def cuGraphExecUpdate(hGraphExec, hGraph): @@ -39237,7 +48504,11 @@ def cuGraphExecUpdate(hGraphExec, hGraph): - The source/destination memory must be allocated from the same contexts as the original source/destination memory. - - Only 1D memsets can be changed. + - For 2d memsets, only address and assigned value may be updated. + + - For 1d memsets, updating dimensions is also allowed, but may fail + if the resulting operation doesn't map onto the work resources + already allocated for the node. - Additional memcpy node restrictions: @@ -39252,7 +48523,7 @@ def cuGraphExecUpdate(hGraphExec, hGraph): - Changing node parameters is not supported. - - Changeing parameters of nodes within the conditional body graph is + - Changing parameters of nodes within the conditional body graph is subject to the rules above. - Conditional handle flags and default values are updated as part of @@ -39338,30 +48609,28 @@ def cuGraphExecUpdate(hGraphExec, hGraph): -------- :py:obj:`~.cuGraphInstantiate` """ - cdef ccuda.CUgraph chGraph + cdef cydriver.CUgraph cyhGraph if hGraph is None: - chGraph = 0 + phGraph = 0 elif isinstance(hGraph, (CUgraph,)): phGraph = int(hGraph) - chGraph = phGraph else: phGraph = int(CUgraph(hGraph)) - chGraph = phGraph - cdef ccuda.CUgraphExec chGraphExec + cyhGraph = phGraph + cdef cydriver.CUgraphExec cyhGraphExec if hGraphExec is None: - chGraphExec = 0 + phGraphExec = 0 elif isinstance(hGraphExec, (CUgraphExec,)): phGraphExec = int(hGraphExec) - chGraphExec = phGraphExec else: phGraphExec = int(CUgraphExec(hGraphExec)) - chGraphExec = phGraphExec + cyhGraphExec = phGraphExec cdef CUgraphExecUpdateResultInfo resultInfo = CUgraphExecUpdateResultInfo() - err = ccuda.cuGraphExecUpdate(chGraphExec, chGraph, resultInfo._ptr) - return (CUresult(err), resultInfo) -{{endif}} - -{{if 'cuGraphKernelNodeCopyAttributes' in found_functions}} + with nogil: + err = cydriver.cuGraphExecUpdate(cyhGraphExec, cyhGraph, resultInfo._pvt_ptr) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, resultInfo) @cython.embedsignature(True) def cuGraphKernelNodeCopyAttributes(dst, src): @@ -39387,29 +48656,25 @@ def cuGraphKernelNodeCopyAttributes(dst, src): -------- :py:obj:`~.CUaccessPolicyWindow` """ - cdef ccuda.CUgraphNode csrc + cdef cydriver.CUgraphNode cysrc if src is None: - csrc = 0 + psrc = 0 elif isinstance(src, (CUgraphNode,)): psrc = int(src) - csrc = psrc else: psrc = int(CUgraphNode(src)) - csrc = psrc - cdef ccuda.CUgraphNode cdst + cysrc = psrc + cdef cydriver.CUgraphNode cydst if dst is None: - cdst = 0 + pdst = 0 elif isinstance(dst, (CUgraphNode,)): pdst = int(dst) - cdst = pdst else: pdst = int(CUgraphNode(dst)) - cdst = pdst - err = ccuda.cuGraphKernelNodeCopyAttributes(cdst, csrc) - return (CUresult(err),) -{{endif}} - -{{if 'cuGraphKernelNodeGetAttribute' in found_functions}} + cydst = pdst + with nogil: + err = cydriver.cuGraphKernelNodeCopyAttributes(cydst, cysrc) + return (_CUresult(err),) @cython.embedsignature(True) def cuGraphKernelNodeGetAttribute(hNode, attr not None : CUkernelNodeAttrID): @@ -39424,34 +48689,31 @@ def cuGraphKernelNodeGetAttribute(hNode, attr not None : CUkernelNodeAttrID): attr : :py:obj:`~.CUkernelNodeAttrID` - Returns ------- CUresult :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_INVALID_HANDLE` value_out : :py:obj:`~.CUkernelNodeAttrValue` - See Also -------- :py:obj:`~.CUaccessPolicyWindow` """ - cdef ccuda.CUgraphNode chNode + cdef cydriver.CUgraphNode cyhNode if hNode is None: - chNode = 0 + phNode = 0 elif isinstance(hNode, (CUgraphNode,)): phNode = int(hNode) - chNode = phNode else: phNode = int(CUgraphNode(hNode)) - chNode = phNode - cdef ccuda.CUkernelNodeAttrID cattr = attr.value + cyhNode = phNode + cdef cydriver.CUkernelNodeAttrID cyattr = int(attr) cdef CUkernelNodeAttrValue value_out = CUkernelNodeAttrValue() - err = ccuda.cuGraphKernelNodeGetAttribute(chNode, cattr, value_out._ptr) - return (CUresult(err), value_out) -{{endif}} - -{{if 'cuGraphKernelNodeSetAttribute' in found_functions}} + with nogil: + err = cydriver.cuGraphKernelNodeGetAttribute(cyhNode, cyattr, value_out._pvt_ptr) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, value_out) @cython.embedsignature(True) def cuGraphKernelNodeSetAttribute(hNode, attr not None : CUkernelNodeAttrID, value : Optional[CUkernelNodeAttrValue]): @@ -39468,7 +48730,6 @@ def cuGraphKernelNodeSetAttribute(hNode, attr not None : CUkernelNodeAttrID, val value : :py:obj:`~.CUkernelNodeAttrValue` - Returns ------- CUresult @@ -39478,22 +48739,19 @@ def cuGraphKernelNodeSetAttribute(hNode, attr not None : CUkernelNodeAttrID, val -------- :py:obj:`~.CUaccessPolicyWindow` """ - cdef ccuda.CUgraphNode chNode + cdef cydriver.CUgraphNode cyhNode if hNode is None: - chNode = 0 + phNode = 0 elif isinstance(hNode, (CUgraphNode,)): phNode = int(hNode) - chNode = phNode else: phNode = int(CUgraphNode(hNode)) - chNode = phNode - cdef ccuda.CUkernelNodeAttrID cattr = attr.value - cdef ccuda.CUkernelNodeAttrValue* cvalue_ptr = value._ptr if value != None else NULL - err = ccuda.cuGraphKernelNodeSetAttribute(chNode, cattr, cvalue_ptr) - return (CUresult(err),) -{{endif}} - -{{if 'cuGraphDebugDotPrint' in found_functions}} + cyhNode = phNode + cdef cydriver.CUkernelNodeAttrID cyattr = int(attr) + cdef cydriver.CUkernelNodeAttrValue* cyvalue_ptr = value._pvt_ptr if value is not None else NULL + with nogil: + err = cydriver.cuGraphKernelNodeSetAttribute(cyhNode, cyattr, cyvalue_ptr) + return (_CUresult(err),) @cython.embedsignature(True) def cuGraphDebugDotPrint(hGraph, char* path, unsigned int flags): @@ -39512,28 +48770,25 @@ def cuGraphDebugDotPrint(hGraph, char* path, unsigned int flags): path : bytes The path to write the DOT file to flags : unsigned int - Flags from CUgraphDebugDot_flags for specifying which additional - node information to write + Flags from :py:obj:`~.CUgraphDebugDot_flags` for specifying which + additional node information to write Returns ------- CUresult :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_OPERATING_SYSTEM` """ - cdef ccuda.CUgraph chGraph + cdef cydriver.CUgraph cyhGraph if hGraph is None: - chGraph = 0 + phGraph = 0 elif isinstance(hGraph, (CUgraph,)): phGraph = int(hGraph) - chGraph = phGraph else: phGraph = int(CUgraph(hGraph)) - chGraph = phGraph - err = ccuda.cuGraphDebugDotPrint(chGraph, path, flags) - return (CUresult(err),) -{{endif}} - -{{if 'cuUserObjectCreate' in found_functions}} + cyhGraph = phGraph + with nogil: + err = cydriver.cuGraphDebugDotPrint(cyhGraph, path, flags) + return (_CUresult(err),) @cython.embedsignature(True) def cuUserObjectCreate(ptr, destroy, unsigned int initialRefcount, unsigned int flags): @@ -39577,23 +48832,23 @@ def cuUserObjectCreate(ptr, destroy, unsigned int initialRefcount, unsigned int -------- :py:obj:`~.cuUserObjectRetain`, :py:obj:`~.cuUserObjectRelease`, :py:obj:`~.cuGraphRetainUserObject`, :py:obj:`~.cuGraphReleaseUserObject`, :py:obj:`~.cuGraphCreate` """ - cdef ccuda.CUhostFn cdestroy + cdef cydriver.CUhostFn cydestroy if destroy is None: - cdestroy = 0 + pdestroy = 0 elif isinstance(destroy, (CUhostFn,)): pdestroy = int(destroy) - cdestroy = pdestroy else: pdestroy = int(CUhostFn(destroy)) - cdestroy = pdestroy + cydestroy = pdestroy cdef CUuserObject object_out = CUuserObject() - cptr = utils.HelperInputVoidPtr(ptr) - cdef void* cptr_ptr = cptr.cptr - err = ccuda.cuUserObjectCreate(object_out._ptr, cptr_ptr, cdestroy, initialRefcount, flags) - return (CUresult(err), object_out) -{{endif}} - -{{if 'cuUserObjectRetain' in found_functions}} + cdef _HelperInputVoidPtrStruct cyptrHelper + cdef void* cyptr = _helper_input_void_ptr(ptr, &cyptrHelper) + with nogil: + err = cydriver.cuUserObjectCreate(object_out._pvt_ptr, cyptr, cydestroy, initialRefcount, flags) + _helper_input_void_ptr_free(&cyptrHelper) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, object_out) @cython.embedsignature(True) def cuUserObjectRetain(object, unsigned int count): @@ -39622,20 +48877,17 @@ def cuUserObjectRetain(object, unsigned int count): -------- :py:obj:`~.cuUserObjectCreate`, :py:obj:`~.cuUserObjectRelease`, :py:obj:`~.cuGraphRetainUserObject`, :py:obj:`~.cuGraphReleaseUserObject`, :py:obj:`~.cuGraphCreate` """ - cdef ccuda.CUuserObject cobject + cdef cydriver.CUuserObject cyobject if object is None: - cobject = 0 + pobject = 0 elif isinstance(object, (CUuserObject,)): pobject = int(object) - cobject = pobject else: pobject = int(CUuserObject(object)) - cobject = pobject - err = ccuda.cuUserObjectRetain(cobject, count) - return (CUresult(err),) -{{endif}} - -{{if 'cuUserObjectRelease' in found_functions}} + cyobject = pobject + with nogil: + err = cydriver.cuUserObjectRetain(cyobject, count) + return (_CUresult(err),) @cython.embedsignature(True) def cuUserObjectRelease(object, unsigned int count): @@ -39667,20 +48919,17 @@ def cuUserObjectRelease(object, unsigned int count): -------- :py:obj:`~.cuUserObjectCreate`, :py:obj:`~.cuUserObjectRetain`, :py:obj:`~.cuGraphRetainUserObject`, :py:obj:`~.cuGraphReleaseUserObject`, :py:obj:`~.cuGraphCreate` """ - cdef ccuda.CUuserObject cobject + cdef cydriver.CUuserObject cyobject if object is None: - cobject = 0 + pobject = 0 elif isinstance(object, (CUuserObject,)): pobject = int(object) - cobject = pobject else: pobject = int(CUuserObject(object)) - cobject = pobject - err = ccuda.cuUserObjectRelease(cobject, count) - return (CUresult(err),) -{{endif}} - -{{if 'cuGraphRetainUserObject' in found_functions}} + cyobject = pobject + with nogil: + err = cydriver.cuUserObjectRelease(cyobject, count) + return (_CUresult(err),) @cython.embedsignature(True) def cuGraphRetainUserObject(graph, object, unsigned int count, unsigned int flags): @@ -39715,29 +48964,25 @@ def cuGraphRetainUserObject(graph, object, unsigned int count, unsigned int flag -------- :py:obj:`~.cuUserObjectCreate`, :py:obj:`~.cuUserObjectRetain`, :py:obj:`~.cuUserObjectRelease`, :py:obj:`~.cuGraphReleaseUserObject`, :py:obj:`~.cuGraphCreate` """ - cdef ccuda.CUuserObject cobject + cdef cydriver.CUuserObject cyobject if object is None: - cobject = 0 + pobject = 0 elif isinstance(object, (CUuserObject,)): pobject = int(object) - cobject = pobject else: pobject = int(CUuserObject(object)) - cobject = pobject - cdef ccuda.CUgraph cgraph + cyobject = pobject + cdef cydriver.CUgraph cygraph if graph is None: - cgraph = 0 + pgraph = 0 elif isinstance(graph, (CUgraph,)): pgraph = int(graph) - cgraph = pgraph else: pgraph = int(CUgraph(graph)) - cgraph = pgraph - err = ccuda.cuGraphRetainUserObject(cgraph, cobject, count, flags) - return (CUresult(err),) -{{endif}} - -{{if 'cuGraphReleaseUserObject' in found_functions}} + cygraph = pgraph + with nogil: + err = cydriver.cuGraphRetainUserObject(cygraph, cyobject, count, flags) + return (_CUresult(err),) @cython.embedsignature(True) def cuGraphReleaseUserObject(graph, object, unsigned int count): @@ -39767,32 +49012,28 @@ def cuGraphReleaseUserObject(graph, object, unsigned int count): -------- :py:obj:`~.cuUserObjectCreate`, :py:obj:`~.cuUserObjectRetain`, :py:obj:`~.cuUserObjectRelease`, :py:obj:`~.cuGraphRetainUserObject`, :py:obj:`~.cuGraphCreate` """ - cdef ccuda.CUuserObject cobject + cdef cydriver.CUuserObject cyobject if object is None: - cobject = 0 + pobject = 0 elif isinstance(object, (CUuserObject,)): pobject = int(object) - cobject = pobject else: pobject = int(CUuserObject(object)) - cobject = pobject - cdef ccuda.CUgraph cgraph + cyobject = pobject + cdef cydriver.CUgraph cygraph if graph is None: - cgraph = 0 + pgraph = 0 elif isinstance(graph, (CUgraph,)): pgraph = int(graph) - cgraph = pgraph else: pgraph = int(CUgraph(graph)) - cgraph = pgraph - err = ccuda.cuGraphReleaseUserObject(cgraph, cobject, count) - return (CUresult(err),) -{{endif}} - -{{if 'cuGraphAddNode' in found_functions}} + cygraph = pgraph + with nogil: + err = cydriver.cuGraphReleaseUserObject(cygraph, cyobject, count) + return (_CUresult(err),) @cython.embedsignature(True) -def cuGraphAddNode(hGraph, dependencies : Optional[List[CUgraphNode]], size_t numDependencies, nodeParams : Optional[CUgraphNodeParams]): +def cuGraphAddNode(hGraph, dependencies : Optional[tuple[CUgraphNode] | list[CUgraphNode]], dependencyData : Optional[tuple[CUgraphEdgeData] | list[CUgraphEdgeData]], size_t numDependencies, nodeParams : Optional[CUgraphNodeParams]): """ Adds a node of arbitrary type to a graph. Creates a new node in `hGraph` described by `nodeParams` with @@ -39818,85 +49059,9 @@ def cuGraphAddNode(hGraph, dependencies : Optional[List[CUgraphNode]], size_t nu ---------- hGraph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` Graph to which to add the node - dependencies : List[:py:obj:`~.CUgraphNode`] + dependencies : list[:py:obj:`~.CUgraphNode`] Dependencies of the node - numDependencies : size_t - Number of dependencies - nodeParams : :py:obj:`~.CUgraphNodeParams` - Specification of the node - - Returns - ------- - CUresult - :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_INVALID_CONTEXT`, :py:obj:`~.CUDA_ERROR_NOT_SUPPORTED` - phGraphNode : :py:obj:`~.CUgraphNode` - Returns newly created node - - See Also - -------- - :py:obj:`~.cuGraphCreate`, :py:obj:`~.cuGraphNodeSetParams`, :py:obj:`~.cuGraphExecNodeSetParams` - """ - dependencies = [] if dependencies is None else dependencies - if not all(isinstance(_x, (CUgraphNode,)) for _x in dependencies): - raise TypeError("Argument 'dependencies' is not instance of type (expected List[ccuda.CUgraphNode,]") - cdef ccuda.CUgraph chGraph - if hGraph is None: - chGraph = 0 - elif isinstance(hGraph, (CUgraph,)): - phGraph = int(hGraph) - chGraph = phGraph - else: - phGraph = int(CUgraph(hGraph)) - chGraph = phGraph - cdef CUgraphNode phGraphNode = CUgraphNode() - cdef ccuda.CUgraphNode* cdependencies = NULL - if len(dependencies) > 0: - cdependencies = calloc(len(dependencies), sizeof(ccuda.CUgraphNode)) - if cdependencies is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(dependencies)) + 'x' + str(sizeof(ccuda.CUgraphNode))) - else: - for idx in range(len(dependencies)): - cdependencies[idx] = (dependencies[idx])._ptr[0] - if numDependencies > len(dependencies): raise RuntimeError("List is too small: " + str(len(dependencies)) + " < " + str(numDependencies)) - cdef ccuda.CUgraphNodeParams* cnodeParams_ptr = nodeParams._ptr if nodeParams != None else NULL - err = ccuda.cuGraphAddNode(phGraphNode._ptr, chGraph, (dependencies[0])._ptr if len(dependencies) == 1 else cdependencies, numDependencies, cnodeParams_ptr) - if cdependencies is not NULL: - free(cdependencies) - return (CUresult(err), phGraphNode) -{{endif}} - -{{if 'cuGraphAddNode_v2' in found_functions}} - -@cython.embedsignature(True) -def cuGraphAddNode_v2(hGraph, dependencies : Optional[List[CUgraphNode]], dependencyData : Optional[List[CUgraphEdgeData]], size_t numDependencies, nodeParams : Optional[CUgraphNodeParams]): - """ Adds a node of arbitrary type to a graph (12.3+) - - Creates a new node in `hGraph` described by `nodeParams` with - `numDependencies` dependencies specified via `dependencies`. - `numDependencies` may be 0. `dependencies` may be null if - `numDependencies` is 0. `dependencies` may not have any duplicate - entries. - - `nodeParams` is a tagged union. The node type should be specified in - the `typename` field, and type-specific parameters in the corresponding - union member. All unused bytes - that is, `reserved0` and all bytes - past the utilized union member - must be set to zero. It is recommended - to use brace initialization or memset to ensure all bytes are - initialized. - - Note that for some node types, `nodeParams` may contain "out - parameters" which are modified during the call, such as - `nodeParams->alloc.dptr`. - - A handle to the new node will be returned in `phGraphNode`. - - Parameters - ---------- - hGraph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` - Graph to which to add the node - dependencies : List[:py:obj:`~.CUgraphNode`] - Dependencies of the node - dependencyData : List[:py:obj:`~.CUgraphEdgeData`] + dependencyData : list[:py:obj:`~.CUgraphEdgeData`] Optional edge data for the dependencies. If NULL, the data is assumed to be default (zeroed) for all dependencies. numDependencies : size_t @@ -39917,51 +49082,52 @@ def cuGraphAddNode_v2(hGraph, dependencies : Optional[List[CUgraphNode]], depend """ dependencyData = [] if dependencyData is None else dependencyData if not all(isinstance(_x, (CUgraphEdgeData,)) for _x in dependencyData): - raise TypeError("Argument 'dependencyData' is not instance of type (expected List[ccuda.CUgraphEdgeData,]") + raise TypeError("Argument 'dependencyData' is not instance of type (expected tuple[cydriver.CUgraphEdgeData,] or list[cydriver.CUgraphEdgeData,]") dependencies = [] if dependencies is None else dependencies if not all(isinstance(_x, (CUgraphNode,)) for _x in dependencies): - raise TypeError("Argument 'dependencies' is not instance of type (expected List[ccuda.CUgraphNode,]") - cdef ccuda.CUgraph chGraph + raise TypeError("Argument 'dependencies' is not instance of type (expected tuple[cydriver.CUgraphNode,] or list[cydriver.CUgraphNode,]") + cdef cydriver.CUgraph cyhGraph if hGraph is None: - chGraph = 0 + phGraph = 0 elif isinstance(hGraph, (CUgraph,)): phGraph = int(hGraph) - chGraph = phGraph else: phGraph = int(CUgraph(hGraph)) - chGraph = phGraph + cyhGraph = phGraph cdef CUgraphNode phGraphNode = CUgraphNode() - cdef ccuda.CUgraphNode* cdependencies = NULL - if len(dependencies) > 0: - cdependencies = calloc(len(dependencies), sizeof(ccuda.CUgraphNode)) - if cdependencies is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(dependencies)) + 'x' + str(sizeof(ccuda.CUgraphNode))) + cdef cydriver.CUgraphNode* cydependencies = NULL + if len(dependencies) > 1: + cydependencies = calloc(len(dependencies), sizeof(cydriver.CUgraphNode)) + if cydependencies is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(dependencies)) + 'x' + str(sizeof(cydriver.CUgraphNode))) else: for idx in range(len(dependencies)): - cdependencies[idx] = (dependencies[idx])._ptr[0] - cdef ccuda.CUgraphEdgeData* cdependencyData = NULL - if len(dependencyData) > 0: - cdependencyData = calloc(len(dependencyData), sizeof(ccuda.CUgraphEdgeData)) - if cdependencyData is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(dependencyData)) + 'x' + str(sizeof(ccuda.CUgraphEdgeData))) + cydependencies[idx] = (dependencies[idx])._pvt_ptr[0] + elif len(dependencies) == 1: + cydependencies = (dependencies[0])._pvt_ptr + cdef cydriver.CUgraphEdgeData* cydependencyData = NULL + if len(dependencyData) > 1: + cydependencyData = calloc(len(dependencyData), sizeof(cydriver.CUgraphEdgeData)) + if cydependencyData is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(dependencyData)) + 'x' + str(sizeof(cydriver.CUgraphEdgeData))) for idx in range(len(dependencyData)): - string.memcpy(&cdependencyData[idx], (dependencyData[idx])._ptr, sizeof(ccuda.CUgraphEdgeData)) - if numDependencies > len(dependencies): raise RuntimeError("List is too small: " + str(len(dependencies)) + " < " + str(numDependencies)) - if numDependencies > len(dependencyData): raise RuntimeError("List is too small: " + str(len(dependencyData)) + " < " + str(numDependencies)) - cdef ccuda.CUgraphNodeParams* cnodeParams_ptr = nodeParams._ptr if nodeParams != None else NULL - err = ccuda.cuGraphAddNode_v2(phGraphNode._ptr, chGraph, (dependencies[0])._ptr if len(dependencies) == 1 else cdependencies, (dependencyData[0])._ptr if len(dependencyData) == 1 else cdependencyData, numDependencies, cnodeParams_ptr) - if cdependencies is not NULL: - free(cdependencies) - if cdependencyData is not NULL: - free(cdependencyData) - return (CUresult(err), phGraphNode) -{{endif}} - -{{if 'cuGraphNodeSetParams' in found_functions}} + string.memcpy(&cydependencyData[idx], (dependencyData[idx])._pvt_ptr, sizeof(cydriver.CUgraphEdgeData)) + elif len(dependencyData) == 1: + cydependencyData = (dependencyData[0])._pvt_ptr + cdef cydriver.CUgraphNodeParams* cynodeParams_ptr = nodeParams._pvt_ptr if nodeParams is not None else NULL + with nogil: + err = cydriver.cuGraphAddNode(phGraphNode._pvt_ptr, cyhGraph, cydependencies, cydependencyData, numDependencies, cynodeParams_ptr) + if len(dependencies) > 1 and cydependencies is not NULL: + free(cydependencies) + if len(dependencyData) > 1 and cydependencyData is not NULL: + free(cydependencyData) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, phGraphNode) @cython.embedsignature(True) def cuGraphNodeSetParams(hNode, nodeParams : Optional[CUgraphNodeParams]): - """ Update's a graph node's parameters. + """ Update a graph node's parameters. Sets the parameters of graph node `hNode` to `nodeParams`. The node type specified by `nodeParams->type` must match the type of `hNode`. @@ -39985,27 +49151,74 @@ def cuGraphNodeSetParams(hNode, nodeParams : Optional[CUgraphNodeParams]): See Also -------- - :py:obj:`~.cuGraphAddNode`, :py:obj:`~.cuGraphExecNodeSetParams` + :py:obj:`~.cuGraphAddNode`, :py:obj:`~.cuGraphNodeGetParams`, :py:obj:`~.cuGraphExecNodeSetParams` """ - cdef ccuda.CUgraphNode chNode + cdef cydriver.CUgraphNode cyhNode if hNode is None: - chNode = 0 + phNode = 0 elif isinstance(hNode, (CUgraphNode,)): phNode = int(hNode) - chNode = phNode else: phNode = int(CUgraphNode(hNode)) - chNode = phNode - cdef ccuda.CUgraphNodeParams* cnodeParams_ptr = nodeParams._ptr if nodeParams != None else NULL - err = ccuda.cuGraphNodeSetParams(chNode, cnodeParams_ptr) - return (CUresult(err),) -{{endif}} + cyhNode = phNode + cdef cydriver.CUgraphNodeParams* cynodeParams_ptr = nodeParams._pvt_ptr if nodeParams is not None else NULL + with nogil: + err = cydriver.cuGraphNodeSetParams(cyhNode, cynodeParams_ptr) + return (_CUresult(err),) + +@cython.embedsignature(True) +def cuGraphNodeGetParams(hNode): + """ Return a graph node's parameters. + + Returns the parameters of graph node `hNode` in `*nodeParams`. + + Any pointers returned in `*nodeParams` point to driver-owned memory + associated with the node. This memory remains valid until the node is + destroyed. Any memory pointed to from `*nodeParams` must not be + modified. + + The returned parameters are a description of the node, but may not be + identical to the struct provided at creation and may not be suitable + for direct creation of identical nodes. This is because parameters may + be partially unspecified and filled in by the driver at creation, may + reference non-copyable handles, or may describe ownership semantics or + other parameters that govern behavior of node creation but are not part + of the final functional descriptor. -{{if 'cuGraphExecNodeSetParams' in found_functions}} + Parameters + ---------- + hNode : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` + Node to get the parameters for + + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE` + nodeParams : :py:obj:`~.CUgraphNodeParams` + Pointer to return the parameters + + See Also + -------- + :py:obj:`~.cuGraphNodeSetParams`, :py:obj:`~.cuGraphAddNode`, :py:obj:`~.cuGraphExecNodeSetParams` + """ + cdef cydriver.CUgraphNode cyhNode + if hNode is None: + phNode = 0 + elif isinstance(hNode, (CUgraphNode,)): + phNode = int(hNode) + else: + phNode = int(CUgraphNode(hNode)) + cyhNode = phNode + cdef CUgraphNodeParams nodeParams = CUgraphNodeParams() + with nogil: + err = cydriver.cuGraphNodeGetParams(cyhNode, nodeParams._pvt_ptr) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, nodeParams) @cython.embedsignature(True) def cuGraphExecNodeSetParams(hGraphExec, hNode, nodeParams : Optional[CUgraphNodeParams]): - """ Update's a graph node's parameters in an instantiated graph. + """ Update a graph node's parameters in an instantiated graph. Sets the parameters of a node in an executable graph `hGraphExec`. The node is identified by the corresponding node `hNode` in the non- @@ -40039,30 +49252,26 @@ def cuGraphExecNodeSetParams(hGraphExec, hNode, nodeParams : Optional[CUgraphNod -------- :py:obj:`~.cuGraphAddNode`, :py:obj:`~.cuGraphNodeSetParams` :py:obj:`~.cuGraphExecUpdate`, :py:obj:`~.cuGraphInstantiate` """ - cdef ccuda.CUgraphNode chNode + cdef cydriver.CUgraphNode cyhNode if hNode is None: - chNode = 0 + phNode = 0 elif isinstance(hNode, (CUgraphNode,)): phNode = int(hNode) - chNode = phNode else: phNode = int(CUgraphNode(hNode)) - chNode = phNode - cdef ccuda.CUgraphExec chGraphExec + cyhNode = phNode + cdef cydriver.CUgraphExec cyhGraphExec if hGraphExec is None: - chGraphExec = 0 + phGraphExec = 0 elif isinstance(hGraphExec, (CUgraphExec,)): phGraphExec = int(hGraphExec) - chGraphExec = phGraphExec else: phGraphExec = int(CUgraphExec(hGraphExec)) - chGraphExec = phGraphExec - cdef ccuda.CUgraphNodeParams* cnodeParams_ptr = nodeParams._ptr if nodeParams != None else NULL - err = ccuda.cuGraphExecNodeSetParams(chGraphExec, chNode, cnodeParams_ptr) - return (CUresult(err),) -{{endif}} - -{{if 'cuGraphConditionalHandleCreate' in found_functions}} + cyhGraphExec = phGraphExec + cdef cydriver.CUgraphNodeParams* cynodeParams_ptr = nodeParams._pvt_ptr if nodeParams is not None else NULL + with nogil: + err = cydriver.cuGraphExecNodeSetParams(cyhGraphExec, cyhNode, cynodeParams_ptr) + return (_CUresult(err),) @cython.embedsignature(True) def cuGraphConditionalHandleCreate(hGraph, ctx, unsigned int defaultLaunchValue, unsigned int flags): @@ -40086,7 +49295,9 @@ def cuGraphConditionalHandleCreate(hGraph, ctx, unsigned int defaultLaunchValue, ctx : :py:obj:`~.CUcontext` Context for the handle and associated conditional node. defaultLaunchValue : unsigned int - Optional initial value for the conditional variable. + Optional initial value for the conditional variable. Applied at the + beginning of each graph execution if CU_GRAPH_COND_ASSIGN_DEFAULT + is set in `flags`. flags : unsigned int Currently must be CU_GRAPH_COND_ASSIGN_DEFAULT or 0. @@ -40101,30 +49312,28 @@ def cuGraphConditionalHandleCreate(hGraph, ctx, unsigned int defaultLaunchValue, -------- :py:obj:`~.cuGraphAddNode` """ - cdef ccuda.CUcontext cctx + cdef cydriver.CUcontext cyctx if ctx is None: - cctx = 0 + pctx = 0 elif isinstance(ctx, (CUcontext,)): pctx = int(ctx) - cctx = pctx else: pctx = int(CUcontext(ctx)) - cctx = pctx - cdef ccuda.CUgraph chGraph + cyctx = pctx + cdef cydriver.CUgraph cyhGraph if hGraph is None: - chGraph = 0 + phGraph = 0 elif isinstance(hGraph, (CUgraph,)): phGraph = int(hGraph) - chGraph = phGraph else: phGraph = int(CUgraph(hGraph)) - chGraph = phGraph + cyhGraph = phGraph cdef CUgraphConditionalHandle pHandle_out = CUgraphConditionalHandle() - err = ccuda.cuGraphConditionalHandleCreate(pHandle_out._ptr, chGraph, cctx, defaultLaunchValue, flags) - return (CUresult(err), pHandle_out) -{{endif}} - -{{if 'cuOccupancyMaxActiveBlocksPerMultiprocessor' in found_functions}} + with nogil: + err = cydriver.cuGraphConditionalHandleCreate(pHandle_out._pvt_ptr, cyhGraph, cyctx, defaultLaunchValue, flags) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pHandle_out) @cython.embedsignature(True) def cuOccupancyMaxActiveBlocksPerMultiprocessor(func, int blockSize, size_t dynamicSMemSize): @@ -40159,21 +49368,20 @@ def cuOccupancyMaxActiveBlocksPerMultiprocessor(func, int blockSize, size_t dyna -------- :py:obj:`~.cudaOccupancyMaxActiveBlocksPerMultiprocessor` """ - cdef ccuda.CUfunction cfunc + cdef cydriver.CUfunction cyfunc if func is None: - cfunc = 0 + pfunc = 0 elif isinstance(func, (CUfunction,)): pfunc = int(func) - cfunc = pfunc else: pfunc = int(CUfunction(func)) - cfunc = pfunc + cyfunc = pfunc cdef int numBlocks = 0 - err = ccuda.cuOccupancyMaxActiveBlocksPerMultiprocessor(&numBlocks, cfunc, blockSize, dynamicSMemSize) - return (CUresult(err), numBlocks) -{{endif}} - -{{if 'cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags' in found_functions}} + with nogil: + err = cydriver.cuOccupancyMaxActiveBlocksPerMultiprocessor(&numBlocks, cyfunc, blockSize, dynamicSMemSize) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, numBlocks) @cython.embedsignature(True) def cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(func, int blockSize, size_t dynamicSMemSize, unsigned int flags): @@ -40226,21 +49434,20 @@ def cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(func, int blockSize, si -------- :py:obj:`~.cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags` """ - cdef ccuda.CUfunction cfunc + cdef cydriver.CUfunction cyfunc if func is None: - cfunc = 0 + pfunc = 0 elif isinstance(func, (CUfunction,)): pfunc = int(func) - cfunc = pfunc else: pfunc = int(CUfunction(func)) - cfunc = pfunc + cyfunc = pfunc cdef int numBlocks = 0 - err = ccuda.cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(&numBlocks, cfunc, blockSize, dynamicSMemSize, flags) - return (CUresult(err), numBlocks) -{{endif}} - -{{if 'cuOccupancyMaxPotentialBlockSize' in found_functions}} + with nogil: + err = cydriver.cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(&numBlocks, cyfunc, blockSize, dynamicSMemSize, flags) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, numBlocks) @cython.embedsignature(True) def cuOccupancyMaxPotentialBlockSize(func, blockSizeToDynamicSMemSize, size_t dynamicSMemSize, int blockSizeLimit): @@ -40302,31 +49509,29 @@ def cuOccupancyMaxPotentialBlockSize(func, blockSizeToDynamicSMemSize, size_t dy -------- :py:obj:`~.cudaOccupancyMaxPotentialBlockSize` """ - cdef ccuda.CUoccupancyB2DSize cblockSizeToDynamicSMemSize + cdef cydriver.CUoccupancyB2DSize cyblockSizeToDynamicSMemSize if blockSizeToDynamicSMemSize is None: - cblockSizeToDynamicSMemSize = 0 + pblockSizeToDynamicSMemSize = 0 elif isinstance(blockSizeToDynamicSMemSize, (CUoccupancyB2DSize,)): pblockSizeToDynamicSMemSize = int(blockSizeToDynamicSMemSize) - cblockSizeToDynamicSMemSize = pblockSizeToDynamicSMemSize else: pblockSizeToDynamicSMemSize = int(CUoccupancyB2DSize(blockSizeToDynamicSMemSize)) - cblockSizeToDynamicSMemSize = pblockSizeToDynamicSMemSize - cdef ccuda.CUfunction cfunc + cyblockSizeToDynamicSMemSize = pblockSizeToDynamicSMemSize + cdef cydriver.CUfunction cyfunc if func is None: - cfunc = 0 + pfunc = 0 elif isinstance(func, (CUfunction,)): pfunc = int(func) - cfunc = pfunc else: pfunc = int(CUfunction(func)) - cfunc = pfunc + cyfunc = pfunc cdef int minGridSize = 0 cdef int blockSize = 0 - err = ccuda.cuOccupancyMaxPotentialBlockSize(&minGridSize, &blockSize, cfunc, cblockSizeToDynamicSMemSize, dynamicSMemSize, blockSizeLimit) - return (CUresult(err), minGridSize, blockSize) -{{endif}} - -{{if 'cuOccupancyMaxPotentialBlockSizeWithFlags' in found_functions}} + with nogil: + err = cydriver.cuOccupancyMaxPotentialBlockSize(&minGridSize, &blockSize, cyfunc, cyblockSizeToDynamicSMemSize, dynamicSMemSize, blockSizeLimit) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None, None) + return (_CUresult_SUCCESS, minGridSize, blockSize) @cython.embedsignature(True) def cuOccupancyMaxPotentialBlockSizeWithFlags(func, blockSizeToDynamicSMemSize, size_t dynamicSMemSize, int blockSizeLimit, unsigned int flags): @@ -40387,31 +49592,29 @@ def cuOccupancyMaxPotentialBlockSizeWithFlags(func, blockSizeToDynamicSMemSize, -------- :py:obj:`~.cudaOccupancyMaxPotentialBlockSizeWithFlags` """ - cdef ccuda.CUoccupancyB2DSize cblockSizeToDynamicSMemSize + cdef cydriver.CUoccupancyB2DSize cyblockSizeToDynamicSMemSize if blockSizeToDynamicSMemSize is None: - cblockSizeToDynamicSMemSize = 0 + pblockSizeToDynamicSMemSize = 0 elif isinstance(blockSizeToDynamicSMemSize, (CUoccupancyB2DSize,)): pblockSizeToDynamicSMemSize = int(blockSizeToDynamicSMemSize) - cblockSizeToDynamicSMemSize = pblockSizeToDynamicSMemSize else: pblockSizeToDynamicSMemSize = int(CUoccupancyB2DSize(blockSizeToDynamicSMemSize)) - cblockSizeToDynamicSMemSize = pblockSizeToDynamicSMemSize - cdef ccuda.CUfunction cfunc + cyblockSizeToDynamicSMemSize = pblockSizeToDynamicSMemSize + cdef cydriver.CUfunction cyfunc if func is None: - cfunc = 0 + pfunc = 0 elif isinstance(func, (CUfunction,)): pfunc = int(func) - cfunc = pfunc else: pfunc = int(CUfunction(func)) - cfunc = pfunc + cyfunc = pfunc cdef int minGridSize = 0 cdef int blockSize = 0 - err = ccuda.cuOccupancyMaxPotentialBlockSizeWithFlags(&minGridSize, &blockSize, cfunc, cblockSizeToDynamicSMemSize, dynamicSMemSize, blockSizeLimit, flags) - return (CUresult(err), minGridSize, blockSize) -{{endif}} - -{{if 'cuOccupancyAvailableDynamicSMemPerBlock' in found_functions}} + with nogil: + err = cydriver.cuOccupancyMaxPotentialBlockSizeWithFlags(&minGridSize, &blockSize, cyfunc, cyblockSizeToDynamicSMemSize, dynamicSMemSize, blockSizeLimit, flags) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None, None) + return (_CUresult_SUCCESS, minGridSize, blockSize) @cython.embedsignature(True) def cuOccupancyAvailableDynamicSMemPerBlock(func, int numBlocks, int blockSize): @@ -40442,21 +49645,20 @@ def cuOccupancyAvailableDynamicSMemPerBlock(func, int numBlocks, int blockSize): dynamicSmemSize : int Returned maximum dynamic shared memory """ - cdef ccuda.CUfunction cfunc + cdef cydriver.CUfunction cyfunc if func is None: - cfunc = 0 + pfunc = 0 elif isinstance(func, (CUfunction,)): pfunc = int(func) - cfunc = pfunc else: pfunc = int(CUfunction(func)) - cfunc = pfunc + cyfunc = pfunc cdef size_t dynamicSmemSize = 0 - err = ccuda.cuOccupancyAvailableDynamicSMemPerBlock(&dynamicSmemSize, cfunc, numBlocks, blockSize) - return (CUresult(err), dynamicSmemSize) -{{endif}} - -{{if 'cuOccupancyMaxPotentialClusterSize' in found_functions}} + with nogil: + err = cydriver.cuOccupancyAvailableDynamicSMemPerBlock(&dynamicSmemSize, cyfunc, numBlocks, blockSize) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, dynamicSmemSize) @cython.embedsignature(True) def cuOccupancyMaxPotentialClusterSize(func, config : Optional[CUlaunchConfig]): @@ -40499,22 +49701,21 @@ def cuOccupancyMaxPotentialClusterSize(func, config : Optional[CUlaunchConfig]): -------- :py:obj:`~.cudaFuncGetAttributes`, :py:obj:`~.cuFuncGetAttribute` """ - cdef ccuda.CUfunction cfunc + cdef cydriver.CUfunction cyfunc if func is None: - cfunc = 0 + pfunc = 0 elif isinstance(func, (CUfunction,)): pfunc = int(func) - cfunc = pfunc else: pfunc = int(CUfunction(func)) - cfunc = pfunc + cyfunc = pfunc cdef int clusterSize = 0 - cdef ccuda.CUlaunchConfig* cconfig_ptr = config._ptr if config != None else NULL - err = ccuda.cuOccupancyMaxPotentialClusterSize(&clusterSize, cfunc, cconfig_ptr) - return (CUresult(err), clusterSize) -{{endif}} - -{{if 'cuOccupancyMaxActiveClusters' in found_functions}} + cdef cydriver.CUlaunchConfig* cyconfig_ptr = config._pvt_ptr if config is not None else NULL + with nogil: + err = cydriver.cuOccupancyMaxPotentialClusterSize(&clusterSize, cyfunc, cyconfig_ptr) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, clusterSize) @cython.embedsignature(True) def cuOccupancyMaxActiveClusters(func, config : Optional[CUlaunchConfig]): @@ -40557,22 +49758,21 @@ def cuOccupancyMaxActiveClusters(func, config : Optional[CUlaunchConfig]): -------- :py:obj:`~.cudaFuncGetAttributes`, :py:obj:`~.cuFuncGetAttribute` """ - cdef ccuda.CUfunction cfunc + cdef cydriver.CUfunction cyfunc if func is None: - cfunc = 0 + pfunc = 0 elif isinstance(func, (CUfunction,)): pfunc = int(func) - cfunc = pfunc else: pfunc = int(CUfunction(func)) - cfunc = pfunc + cyfunc = pfunc cdef int numClusters = 0 - cdef ccuda.CUlaunchConfig* cconfig_ptr = config._ptr if config != None else NULL - err = ccuda.cuOccupancyMaxActiveClusters(&numClusters, cfunc, cconfig_ptr) - return (CUresult(err), numClusters) -{{endif}} - -{{if 'cuTexRefSetArray' in found_functions}} + cdef cydriver.CUlaunchConfig* cyconfig_ptr = config._pvt_ptr if config is not None else NULL + with nogil: + err = cydriver.cuOccupancyMaxActiveClusters(&numClusters, cyfunc, cyconfig_ptr) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, numClusters) @cython.embedsignature(True) def cuTexRefSetArray(hTexRef, hArray, unsigned int Flags): @@ -40604,29 +49804,25 @@ def cuTexRefSetArray(hTexRef, hArray, unsigned int Flags): -------- :py:obj:`~.cuTexRefSetAddress`, :py:obj:`~.cuTexRefSetAddress2D`, :py:obj:`~.cuTexRefSetAddressMode`, :py:obj:`~.cuTexRefSetFilterMode`, :py:obj:`~.cuTexRefSetFlags`, :py:obj:`~.cuTexRefSetFormat`, :py:obj:`~.cuTexRefGetAddress`, :py:obj:`~.cuTexRefGetAddressMode`, :py:obj:`~.cuTexRefGetArray`, :py:obj:`~.cuTexRefGetFilterMode`, :py:obj:`~.cuTexRefGetFlags`, :py:obj:`~.cuTexRefGetFormat` """ - cdef ccuda.CUarray chArray + cdef cydriver.CUarray cyhArray if hArray is None: - chArray = 0 + phArray = 0 elif isinstance(hArray, (CUarray,)): phArray = int(hArray) - chArray = phArray else: phArray = int(CUarray(hArray)) - chArray = phArray - cdef ccuda.CUtexref chTexRef + cyhArray = phArray + cdef cydriver.CUtexref cyhTexRef if hTexRef is None: - chTexRef = 0 + phTexRef = 0 elif isinstance(hTexRef, (CUtexref,)): phTexRef = int(hTexRef) - chTexRef = phTexRef else: phTexRef = int(CUtexref(hTexRef)) - chTexRef = phTexRef - err = ccuda.cuTexRefSetArray(chTexRef, chArray, Flags) - return (CUresult(err),) -{{endif}} - -{{if 'cuTexRefSetMipmappedArray' in found_functions}} + cyhTexRef = phTexRef + with nogil: + err = cydriver.cuTexRefSetArray(cyhTexRef, cyhArray, Flags) + return (_CUresult(err),) @cython.embedsignature(True) def cuTexRefSetMipmappedArray(hTexRef, hMipmappedArray, unsigned int Flags): @@ -40658,29 +49854,25 @@ def cuTexRefSetMipmappedArray(hTexRef, hMipmappedArray, unsigned int Flags): -------- :py:obj:`~.cuTexRefSetAddress`, :py:obj:`~.cuTexRefSetAddress2D`, :py:obj:`~.cuTexRefSetAddressMode`, :py:obj:`~.cuTexRefSetFilterMode`, :py:obj:`~.cuTexRefSetFlags`, :py:obj:`~.cuTexRefSetFormat`, :py:obj:`~.cuTexRefGetAddress`, :py:obj:`~.cuTexRefGetAddressMode`, :py:obj:`~.cuTexRefGetArray`, :py:obj:`~.cuTexRefGetFilterMode`, :py:obj:`~.cuTexRefGetFlags`, :py:obj:`~.cuTexRefGetFormat` """ - cdef ccuda.CUmipmappedArray chMipmappedArray + cdef cydriver.CUmipmappedArray cyhMipmappedArray if hMipmappedArray is None: - chMipmappedArray = 0 + phMipmappedArray = 0 elif isinstance(hMipmappedArray, (CUmipmappedArray,)): phMipmappedArray = int(hMipmappedArray) - chMipmappedArray = phMipmappedArray else: phMipmappedArray = int(CUmipmappedArray(hMipmappedArray)) - chMipmappedArray = phMipmappedArray - cdef ccuda.CUtexref chTexRef + cyhMipmappedArray = phMipmappedArray + cdef cydriver.CUtexref cyhTexRef if hTexRef is None: - chTexRef = 0 + phTexRef = 0 elif isinstance(hTexRef, (CUtexref,)): phTexRef = int(hTexRef) - chTexRef = phTexRef else: phTexRef = int(CUtexref(hTexRef)) - chTexRef = phTexRef - err = ccuda.cuTexRefSetMipmappedArray(chTexRef, chMipmappedArray, Flags) - return (CUresult(err),) -{{endif}} - -{{if 'cuTexRefSetAddress_v2' in found_functions}} + cyhTexRef = phTexRef + with nogil: + err = cydriver.cuTexRefSetMipmappedArray(cyhTexRef, cyhMipmappedArray, Flags) + return (_CUresult(err),) @cython.embedsignature(True) def cuTexRefSetAddress(hTexRef, dptr, size_t numbytes): @@ -40731,30 +49923,28 @@ def cuTexRefSetAddress(hTexRef, dptr, size_t numbytes): -------- :py:obj:`~.cuTexRefSetAddress2D`, :py:obj:`~.cuTexRefSetAddressMode`, :py:obj:`~.cuTexRefSetArray`, :py:obj:`~.cuTexRefSetFilterMode`, :py:obj:`~.cuTexRefSetFlags`, :py:obj:`~.cuTexRefSetFormat`, :py:obj:`~.cuTexRefGetAddress`, :py:obj:`~.cuTexRefGetAddressMode`, :py:obj:`~.cuTexRefGetArray`, :py:obj:`~.cuTexRefGetFilterMode`, :py:obj:`~.cuTexRefGetFlags`, :py:obj:`~.cuTexRefGetFormat` """ - cdef ccuda.CUdeviceptr cdptr + cdef cydriver.CUdeviceptr cydptr if dptr is None: - cdptr = 0 + pdptr = 0 elif isinstance(dptr, (CUdeviceptr,)): pdptr = int(dptr) - cdptr = pdptr else: pdptr = int(CUdeviceptr(dptr)) - cdptr = pdptr - cdef ccuda.CUtexref chTexRef + cydptr = pdptr + cdef cydriver.CUtexref cyhTexRef if hTexRef is None: - chTexRef = 0 + phTexRef = 0 elif isinstance(hTexRef, (CUtexref,)): phTexRef = int(hTexRef) - chTexRef = phTexRef else: phTexRef = int(CUtexref(hTexRef)) - chTexRef = phTexRef + cyhTexRef = phTexRef cdef size_t ByteOffset = 0 - err = ccuda.cuTexRefSetAddress(&ByteOffset, chTexRef, cdptr, numbytes) - return (CUresult(err), ByteOffset) -{{endif}} - -{{if 'cuTexRefSetAddress2D_v3' in found_functions}} + with nogil: + err = cydriver.cuTexRefSetAddress(&ByteOffset, cyhTexRef, cydptr, numbytes) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, ByteOffset) @cython.embedsignature(True) def cuTexRefSetAddress2D(hTexRef, desc : Optional[CUDA_ARRAY_DESCRIPTOR], dptr, size_t Pitch): @@ -40813,30 +50003,26 @@ def cuTexRefSetAddress2D(hTexRef, desc : Optional[CUDA_ARRAY_DESCRIPTOR], dptr, -------- :py:obj:`~.cuTexRefSetAddress`, :py:obj:`~.cuTexRefSetAddressMode`, :py:obj:`~.cuTexRefSetArray`, :py:obj:`~.cuTexRefSetFilterMode`, :py:obj:`~.cuTexRefSetFlags`, :py:obj:`~.cuTexRefSetFormat`, :py:obj:`~.cuTexRefGetAddress`, :py:obj:`~.cuTexRefGetAddressMode`, :py:obj:`~.cuTexRefGetArray`, :py:obj:`~.cuTexRefGetFilterMode`, :py:obj:`~.cuTexRefGetFlags`, :py:obj:`~.cuTexRefGetFormat` """ - cdef ccuda.CUdeviceptr cdptr + cdef cydriver.CUdeviceptr cydptr if dptr is None: - cdptr = 0 + pdptr = 0 elif isinstance(dptr, (CUdeviceptr,)): pdptr = int(dptr) - cdptr = pdptr else: pdptr = int(CUdeviceptr(dptr)) - cdptr = pdptr - cdef ccuda.CUtexref chTexRef + cydptr = pdptr + cdef cydriver.CUtexref cyhTexRef if hTexRef is None: - chTexRef = 0 + phTexRef = 0 elif isinstance(hTexRef, (CUtexref,)): phTexRef = int(hTexRef) - chTexRef = phTexRef else: phTexRef = int(CUtexref(hTexRef)) - chTexRef = phTexRef - cdef ccuda.CUDA_ARRAY_DESCRIPTOR* cdesc_ptr = desc._ptr if desc != None else NULL - err = ccuda.cuTexRefSetAddress2D(chTexRef, cdesc_ptr, cdptr, Pitch) - return (CUresult(err),) -{{endif}} - -{{if 'cuTexRefSetFormat' in found_functions}} + cyhTexRef = phTexRef + cdef cydriver.CUDA_ARRAY_DESCRIPTOR* cydesc_ptr = desc._pvt_ptr if desc is not None else NULL + with nogil: + err = cydriver.cuTexRefSetAddress2D(cyhTexRef, cydesc_ptr, cydptr, Pitch) + return (_CUresult(err),) @cython.embedsignature(True) def cuTexRefSetFormat(hTexRef, fmt not None : CUarray_format, int NumPackedComponents): @@ -40868,21 +50054,18 @@ def cuTexRefSetFormat(hTexRef, fmt not None : CUarray_format, int NumPackedCompo -------- :py:obj:`~.cuTexRefSetAddress`, :py:obj:`~.cuTexRefSetAddress2D`, :py:obj:`~.cuTexRefSetAddressMode`, :py:obj:`~.cuTexRefSetArray`, :py:obj:`~.cuTexRefSetFilterMode`, :py:obj:`~.cuTexRefSetFlags`, :py:obj:`~.cuTexRefGetAddress`, :py:obj:`~.cuTexRefGetAddressMode`, :py:obj:`~.cuTexRefGetArray`, :py:obj:`~.cuTexRefGetFilterMode`, :py:obj:`~.cuTexRefGetFlags`, :py:obj:`~.cuTexRefGetFormat`, :py:obj:`~.cudaCreateChannelDesc` """ - cdef ccuda.CUtexref chTexRef + cdef cydriver.CUtexref cyhTexRef if hTexRef is None: - chTexRef = 0 + phTexRef = 0 elif isinstance(hTexRef, (CUtexref,)): phTexRef = int(hTexRef) - chTexRef = phTexRef else: phTexRef = int(CUtexref(hTexRef)) - chTexRef = phTexRef - cdef ccuda.CUarray_format cfmt = fmt.value - err = ccuda.cuTexRefSetFormat(chTexRef, cfmt, NumPackedComponents) - return (CUresult(err),) -{{endif}} - -{{if 'cuTexRefSetAddressMode' in found_functions}} + cyhTexRef = phTexRef + cdef cydriver.CUarray_format cyfmt = int(fmt) + with nogil: + err = cydriver.cuTexRefSetFormat(cyhTexRef, cyfmt, NumPackedComponents) + return (_CUresult(err),) @cython.embedsignature(True) def cuTexRefSetAddressMode(hTexRef, int dim, am not None : CUaddress_mode): @@ -40921,21 +50104,18 @@ def cuTexRefSetAddressMode(hTexRef, int dim, am not None : CUaddress_mode): -------- :py:obj:`~.cuTexRefSetAddress`, :py:obj:`~.cuTexRefSetAddress2D`, :py:obj:`~.cuTexRefSetArray`, :py:obj:`~.cuTexRefSetFilterMode`, :py:obj:`~.cuTexRefSetFlags`, :py:obj:`~.cuTexRefSetFormat`, :py:obj:`~.cuTexRefGetAddress`, :py:obj:`~.cuTexRefGetAddressMode`, :py:obj:`~.cuTexRefGetArray`, :py:obj:`~.cuTexRefGetFilterMode`, :py:obj:`~.cuTexRefGetFlags`, :py:obj:`~.cuTexRefGetFormat` """ - cdef ccuda.CUtexref chTexRef + cdef cydriver.CUtexref cyhTexRef if hTexRef is None: - chTexRef = 0 + phTexRef = 0 elif isinstance(hTexRef, (CUtexref,)): phTexRef = int(hTexRef) - chTexRef = phTexRef else: phTexRef = int(CUtexref(hTexRef)) - chTexRef = phTexRef - cdef ccuda.CUaddress_mode cam = am.value - err = ccuda.cuTexRefSetAddressMode(chTexRef, dim, cam) - return (CUresult(err),) -{{endif}} - -{{if 'cuTexRefSetFilterMode' in found_functions}} + cyhTexRef = phTexRef + cdef cydriver.CUaddress_mode cyam = int(am) + with nogil: + err = cydriver.cuTexRefSetAddressMode(cyhTexRef, dim, cyam) + return (_CUresult(err),) @cython.embedsignature(True) def cuTexRefSetFilterMode(hTexRef, fm not None : CUfilter_mode): @@ -40968,21 +50148,18 @@ def cuTexRefSetFilterMode(hTexRef, fm not None : CUfilter_mode): -------- :py:obj:`~.cuTexRefSetAddress`, :py:obj:`~.cuTexRefSetAddress2D`, :py:obj:`~.cuTexRefSetAddressMode`, :py:obj:`~.cuTexRefSetArray`, :py:obj:`~.cuTexRefSetFlags`, :py:obj:`~.cuTexRefSetFormat`, :py:obj:`~.cuTexRefGetAddress`, :py:obj:`~.cuTexRefGetAddressMode`, :py:obj:`~.cuTexRefGetArray`, :py:obj:`~.cuTexRefGetFilterMode`, :py:obj:`~.cuTexRefGetFlags`, :py:obj:`~.cuTexRefGetFormat` """ - cdef ccuda.CUtexref chTexRef + cdef cydriver.CUtexref cyhTexRef if hTexRef is None: - chTexRef = 0 + phTexRef = 0 elif isinstance(hTexRef, (CUtexref,)): phTexRef = int(hTexRef) - chTexRef = phTexRef else: phTexRef = int(CUtexref(hTexRef)) - chTexRef = phTexRef - cdef ccuda.CUfilter_mode cfm = fm.value - err = ccuda.cuTexRefSetFilterMode(chTexRef, cfm) - return (CUresult(err),) -{{endif}} - -{{if 'cuTexRefSetMipmapFilterMode' in found_functions}} + cyhTexRef = phTexRef + cdef cydriver.CUfilter_mode cyfm = int(fm) + with nogil: + err = cydriver.cuTexRefSetFilterMode(cyhTexRef, cyfm) + return (_CUresult(err),) @cython.embedsignature(True) def cuTexRefSetMipmapFilterMode(hTexRef, fm not None : CUfilter_mode): @@ -41015,21 +50192,18 @@ def cuTexRefSetMipmapFilterMode(hTexRef, fm not None : CUfilter_mode): -------- :py:obj:`~.cuTexRefSetAddress`, :py:obj:`~.cuTexRefSetAddress2D`, :py:obj:`~.cuTexRefSetAddressMode`, :py:obj:`~.cuTexRefSetArray`, :py:obj:`~.cuTexRefSetFlags`, :py:obj:`~.cuTexRefSetFormat`, :py:obj:`~.cuTexRefGetAddress`, :py:obj:`~.cuTexRefGetAddressMode`, :py:obj:`~.cuTexRefGetArray`, :py:obj:`~.cuTexRefGetFilterMode`, :py:obj:`~.cuTexRefGetFlags`, :py:obj:`~.cuTexRefGetFormat` """ - cdef ccuda.CUtexref chTexRef + cdef cydriver.CUtexref cyhTexRef if hTexRef is None: - chTexRef = 0 + phTexRef = 0 elif isinstance(hTexRef, (CUtexref,)): phTexRef = int(hTexRef) - chTexRef = phTexRef else: phTexRef = int(CUtexref(hTexRef)) - chTexRef = phTexRef - cdef ccuda.CUfilter_mode cfm = fm.value - err = ccuda.cuTexRefSetMipmapFilterMode(chTexRef, cfm) - return (CUresult(err),) -{{endif}} - -{{if 'cuTexRefSetMipmapLevelBias' in found_functions}} + cyhTexRef = phTexRef + cdef cydriver.CUfilter_mode cyfm = int(fm) + with nogil: + err = cydriver.cuTexRefSetMipmapFilterMode(cyhTexRef, cyfm) + return (_CUresult(err),) @cython.embedsignature(True) def cuTexRefSetMipmapLevelBias(hTexRef, float bias): @@ -41060,20 +50234,17 @@ def cuTexRefSetMipmapLevelBias(hTexRef, float bias): -------- :py:obj:`~.cuTexRefSetAddress`, :py:obj:`~.cuTexRefSetAddress2D`, :py:obj:`~.cuTexRefSetAddressMode`, :py:obj:`~.cuTexRefSetArray`, :py:obj:`~.cuTexRefSetFlags`, :py:obj:`~.cuTexRefSetFormat`, :py:obj:`~.cuTexRefGetAddress`, :py:obj:`~.cuTexRefGetAddressMode`, :py:obj:`~.cuTexRefGetArray`, :py:obj:`~.cuTexRefGetFilterMode`, :py:obj:`~.cuTexRefGetFlags`, :py:obj:`~.cuTexRefGetFormat` """ - cdef ccuda.CUtexref chTexRef + cdef cydriver.CUtexref cyhTexRef if hTexRef is None: - chTexRef = 0 + phTexRef = 0 elif isinstance(hTexRef, (CUtexref,)): phTexRef = int(hTexRef) - chTexRef = phTexRef else: phTexRef = int(CUtexref(hTexRef)) - chTexRef = phTexRef - err = ccuda.cuTexRefSetMipmapLevelBias(chTexRef, bias) - return (CUresult(err),) -{{endif}} - -{{if 'cuTexRefSetMipmapLevelClamp' in found_functions}} + cyhTexRef = phTexRef + with nogil: + err = cydriver.cuTexRefSetMipmapLevelBias(cyhTexRef, bias) + return (_CUresult(err),) @cython.embedsignature(True) def cuTexRefSetMipmapLevelClamp(hTexRef, float minMipmapLevelClamp, float maxMipmapLevelClamp): @@ -41106,20 +50277,17 @@ def cuTexRefSetMipmapLevelClamp(hTexRef, float minMipmapLevelClamp, float maxMip -------- :py:obj:`~.cuTexRefSetAddress`, :py:obj:`~.cuTexRefSetAddress2D`, :py:obj:`~.cuTexRefSetAddressMode`, :py:obj:`~.cuTexRefSetArray`, :py:obj:`~.cuTexRefSetFlags`, :py:obj:`~.cuTexRefSetFormat`, :py:obj:`~.cuTexRefGetAddress`, :py:obj:`~.cuTexRefGetAddressMode`, :py:obj:`~.cuTexRefGetArray`, :py:obj:`~.cuTexRefGetFilterMode`, :py:obj:`~.cuTexRefGetFlags`, :py:obj:`~.cuTexRefGetFormat` """ - cdef ccuda.CUtexref chTexRef + cdef cydriver.CUtexref cyhTexRef if hTexRef is None: - chTexRef = 0 + phTexRef = 0 elif isinstance(hTexRef, (CUtexref,)): phTexRef = int(hTexRef) - chTexRef = phTexRef else: phTexRef = int(CUtexref(hTexRef)) - chTexRef = phTexRef - err = ccuda.cuTexRefSetMipmapLevelClamp(chTexRef, minMipmapLevelClamp, maxMipmapLevelClamp) - return (CUresult(err),) -{{endif}} - -{{if 'cuTexRefSetMaxAnisotropy' in found_functions}} + cyhTexRef = phTexRef + with nogil: + err = cydriver.cuTexRefSetMipmapLevelClamp(cyhTexRef, minMipmapLevelClamp, maxMipmapLevelClamp) + return (_CUresult(err),) @cython.embedsignature(True) def cuTexRefSetMaxAnisotropy(hTexRef, unsigned int maxAniso): @@ -41149,20 +50317,17 @@ def cuTexRefSetMaxAnisotropy(hTexRef, unsigned int maxAniso): -------- :py:obj:`~.cuTexRefSetAddress`, :py:obj:`~.cuTexRefSetAddress2D`, :py:obj:`~.cuTexRefSetAddressMode`, :py:obj:`~.cuTexRefSetArray`, :py:obj:`~.cuTexRefSetFlags`, :py:obj:`~.cuTexRefSetFormat`, :py:obj:`~.cuTexRefGetAddress`, :py:obj:`~.cuTexRefGetAddressMode`, :py:obj:`~.cuTexRefGetArray`, :py:obj:`~.cuTexRefGetFilterMode`, :py:obj:`~.cuTexRefGetFlags`, :py:obj:`~.cuTexRefGetFormat` """ - cdef ccuda.CUtexref chTexRef + cdef cydriver.CUtexref cyhTexRef if hTexRef is None: - chTexRef = 0 + phTexRef = 0 elif isinstance(hTexRef, (CUtexref,)): phTexRef = int(hTexRef) - chTexRef = phTexRef else: phTexRef = int(CUtexref(hTexRef)) - chTexRef = phTexRef - err = ccuda.cuTexRefSetMaxAnisotropy(chTexRef, maxAniso) - return (CUresult(err),) -{{endif}} - -{{if 'cuTexRefSetBorderColor' in found_functions}} + cyhTexRef = phTexRef + with nogil: + err = cydriver.cuTexRefSetMaxAnisotropy(cyhTexRef, maxAniso) + return (_CUresult(err),) @cython.embedsignature(True) def cuTexRefSetBorderColor(hTexRef, float pBorderColor): @@ -41197,20 +50362,17 @@ def cuTexRefSetBorderColor(hTexRef, float pBorderColor): -------- :py:obj:`~.cuTexRefSetAddressMode`, :py:obj:`~.cuTexRefGetAddressMode`, :py:obj:`~.cuTexRefGetBorderColor` """ - cdef ccuda.CUtexref chTexRef + cdef cydriver.CUtexref cyhTexRef if hTexRef is None: - chTexRef = 0 + phTexRef = 0 elif isinstance(hTexRef, (CUtexref,)): phTexRef = int(hTexRef) - chTexRef = phTexRef else: phTexRef = int(CUtexref(hTexRef)) - chTexRef = phTexRef - err = ccuda.cuTexRefSetBorderColor(chTexRef, &pBorderColor) - return (CUresult(err),) -{{endif}} - -{{if 'cuTexRefSetFlags' in found_functions}} + cyhTexRef = phTexRef + with nogil: + err = cydriver.cuTexRefSetBorderColor(cyhTexRef, &pBorderColor) + return (_CUresult(err),) @cython.embedsignature(True) def cuTexRefSetFlags(hTexRef, unsigned int Flags): @@ -41255,20 +50417,17 @@ def cuTexRefSetFlags(hTexRef, unsigned int Flags): -------- :py:obj:`~.cuTexRefSetAddress`, :py:obj:`~.cuTexRefSetAddress2D`, :py:obj:`~.cuTexRefSetAddressMode`, :py:obj:`~.cuTexRefSetArray`, :py:obj:`~.cuTexRefSetFilterMode`, :py:obj:`~.cuTexRefSetFormat`, :py:obj:`~.cuTexRefGetAddress`, :py:obj:`~.cuTexRefGetAddressMode`, :py:obj:`~.cuTexRefGetArray`, :py:obj:`~.cuTexRefGetFilterMode`, :py:obj:`~.cuTexRefGetFlags`, :py:obj:`~.cuTexRefGetFormat` """ - cdef ccuda.CUtexref chTexRef + cdef cydriver.CUtexref cyhTexRef if hTexRef is None: - chTexRef = 0 + phTexRef = 0 elif isinstance(hTexRef, (CUtexref,)): phTexRef = int(hTexRef) - chTexRef = phTexRef else: phTexRef = int(CUtexref(hTexRef)) - chTexRef = phTexRef - err = ccuda.cuTexRefSetFlags(chTexRef, Flags) - return (CUresult(err),) -{{endif}} - -{{if 'cuTexRefGetAddress_v2' in found_functions}} + cyhTexRef = phTexRef + with nogil: + err = cydriver.cuTexRefSetFlags(cyhTexRef, Flags) + return (_CUresult(err),) @cython.embedsignature(True) def cuTexRefGetAddress(hTexRef): @@ -41296,21 +50455,20 @@ def cuTexRefGetAddress(hTexRef): -------- :py:obj:`~.cuTexRefSetAddress`, :py:obj:`~.cuTexRefSetAddress2D`, :py:obj:`~.cuTexRefSetAddressMode`, :py:obj:`~.cuTexRefSetArray`, :py:obj:`~.cuTexRefSetFilterMode`, :py:obj:`~.cuTexRefSetFlags`, :py:obj:`~.cuTexRefSetFormat`, :py:obj:`~.cuTexRefGetAddressMode`, :py:obj:`~.cuTexRefGetArray`, :py:obj:`~.cuTexRefGetFilterMode`, :py:obj:`~.cuTexRefGetFlags`, :py:obj:`~.cuTexRefGetFormat` """ - cdef ccuda.CUtexref chTexRef + cdef cydriver.CUtexref cyhTexRef if hTexRef is None: - chTexRef = 0 + phTexRef = 0 elif isinstance(hTexRef, (CUtexref,)): phTexRef = int(hTexRef) - chTexRef = phTexRef else: phTexRef = int(CUtexref(hTexRef)) - chTexRef = phTexRef + cyhTexRef = phTexRef cdef CUdeviceptr pdptr = CUdeviceptr() - err = ccuda.cuTexRefGetAddress(pdptr._ptr, chTexRef) - return (CUresult(err), pdptr) -{{endif}} - -{{if 'cuTexRefGetArray' in found_functions}} + with nogil: + err = cydriver.cuTexRefGetAddress(pdptr._pvt_ptr, cyhTexRef) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pdptr) @cython.embedsignature(True) def cuTexRefGetArray(hTexRef): @@ -41338,21 +50496,20 @@ def cuTexRefGetArray(hTexRef): -------- :py:obj:`~.cuTexRefSetAddress`, :py:obj:`~.cuTexRefSetAddress2D`, :py:obj:`~.cuTexRefSetAddressMode`, :py:obj:`~.cuTexRefSetArray`, :py:obj:`~.cuTexRefSetFilterMode`, :py:obj:`~.cuTexRefSetFlags`, :py:obj:`~.cuTexRefSetFormat`, :py:obj:`~.cuTexRefGetAddress`, :py:obj:`~.cuTexRefGetAddressMode`, :py:obj:`~.cuTexRefGetFilterMode`, :py:obj:`~.cuTexRefGetFlags`, :py:obj:`~.cuTexRefGetFormat` """ - cdef ccuda.CUtexref chTexRef + cdef cydriver.CUtexref cyhTexRef if hTexRef is None: - chTexRef = 0 + phTexRef = 0 elif isinstance(hTexRef, (CUtexref,)): phTexRef = int(hTexRef) - chTexRef = phTexRef else: phTexRef = int(CUtexref(hTexRef)) - chTexRef = phTexRef + cyhTexRef = phTexRef cdef CUarray phArray = CUarray() - err = ccuda.cuTexRefGetArray(phArray._ptr, chTexRef) - return (CUresult(err), phArray) -{{endif}} - -{{if 'cuTexRefGetMipmappedArray' in found_functions}} + with nogil: + err = cydriver.cuTexRefGetArray(phArray._pvt_ptr, cyhTexRef) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, phArray) @cython.embedsignature(True) def cuTexRefGetMipmappedArray(hTexRef): @@ -41381,21 +50538,20 @@ def cuTexRefGetMipmappedArray(hTexRef): -------- :py:obj:`~.cuTexRefSetAddress`, :py:obj:`~.cuTexRefSetAddress2D`, :py:obj:`~.cuTexRefSetAddressMode`, :py:obj:`~.cuTexRefSetArray`, :py:obj:`~.cuTexRefSetFilterMode`, :py:obj:`~.cuTexRefSetFlags`, :py:obj:`~.cuTexRefSetFormat`, :py:obj:`~.cuTexRefGetAddress`, :py:obj:`~.cuTexRefGetAddressMode`, :py:obj:`~.cuTexRefGetFilterMode`, :py:obj:`~.cuTexRefGetFlags`, :py:obj:`~.cuTexRefGetFormat` """ - cdef ccuda.CUtexref chTexRef + cdef cydriver.CUtexref cyhTexRef if hTexRef is None: - chTexRef = 0 + phTexRef = 0 elif isinstance(hTexRef, (CUtexref,)): phTexRef = int(hTexRef) - chTexRef = phTexRef else: phTexRef = int(CUtexref(hTexRef)) - chTexRef = phTexRef + cyhTexRef = phTexRef cdef CUmipmappedArray phMipmappedArray = CUmipmappedArray() - err = ccuda.cuTexRefGetMipmappedArray(phMipmappedArray._ptr, chTexRef) - return (CUresult(err), phMipmappedArray) -{{endif}} - -{{if 'cuTexRefGetAddressMode' in found_functions}} + with nogil: + err = cydriver.cuTexRefGetMipmappedArray(phMipmappedArray._pvt_ptr, cyhTexRef) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, phMipmappedArray) @cython.embedsignature(True) def cuTexRefGetAddressMode(hTexRef, int dim): @@ -41425,21 +50581,20 @@ def cuTexRefGetAddressMode(hTexRef, int dim): -------- :py:obj:`~.cuTexRefSetAddress`, :py:obj:`~.cuTexRefSetAddress2D`, :py:obj:`~.cuTexRefSetAddressMode`, :py:obj:`~.cuTexRefSetArray`, :py:obj:`~.cuTexRefSetFilterMode`, :py:obj:`~.cuTexRefSetFlags`, :py:obj:`~.cuTexRefSetFormat`, :py:obj:`~.cuTexRefGetAddress`, :py:obj:`~.cuTexRefGetArray`, :py:obj:`~.cuTexRefGetFilterMode`, :py:obj:`~.cuTexRefGetFlags`, :py:obj:`~.cuTexRefGetFormat` """ - cdef ccuda.CUtexref chTexRef + cdef cydriver.CUtexref cyhTexRef if hTexRef is None: - chTexRef = 0 + phTexRef = 0 elif isinstance(hTexRef, (CUtexref,)): phTexRef = int(hTexRef) - chTexRef = phTexRef else: phTexRef = int(CUtexref(hTexRef)) - chTexRef = phTexRef - cdef ccuda.CUaddress_mode pam - err = ccuda.cuTexRefGetAddressMode(&pam, chTexRef, dim) - return (CUresult(err), CUaddress_mode(pam)) -{{endif}} - -{{if 'cuTexRefGetFilterMode' in found_functions}} + cyhTexRef = phTexRef + cdef cydriver.CUaddress_mode pam + with nogil: + err = cydriver.cuTexRefGetAddressMode(&pam, cyhTexRef, dim) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, CUaddress_mode(pam)) @cython.embedsignature(True) def cuTexRefGetFilterMode(hTexRef): @@ -41466,21 +50621,20 @@ def cuTexRefGetFilterMode(hTexRef): -------- :py:obj:`~.cuTexRefSetAddress`, :py:obj:`~.cuTexRefSetAddress2D`, :py:obj:`~.cuTexRefSetAddressMode`, :py:obj:`~.cuTexRefSetArray`, :py:obj:`~.cuTexRefSetFilterMode`, :py:obj:`~.cuTexRefSetFlags`, :py:obj:`~.cuTexRefSetFormat`, :py:obj:`~.cuTexRefGetAddress`, :py:obj:`~.cuTexRefGetAddressMode`, :py:obj:`~.cuTexRefGetArray`, :py:obj:`~.cuTexRefGetFlags`, :py:obj:`~.cuTexRefGetFormat` """ - cdef ccuda.CUtexref chTexRef + cdef cydriver.CUtexref cyhTexRef if hTexRef is None: - chTexRef = 0 + phTexRef = 0 elif isinstance(hTexRef, (CUtexref,)): phTexRef = int(hTexRef) - chTexRef = phTexRef else: phTexRef = int(CUtexref(hTexRef)) - chTexRef = phTexRef - cdef ccuda.CUfilter_mode pfm - err = ccuda.cuTexRefGetFilterMode(&pfm, chTexRef) - return (CUresult(err), CUfilter_mode(pfm)) -{{endif}} - -{{if 'cuTexRefGetFormat' in found_functions}} + cyhTexRef = phTexRef + cdef cydriver.CUfilter_mode pfm + with nogil: + err = cydriver.cuTexRefGetFilterMode(&pfm, cyhTexRef) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, CUfilter_mode(pfm)) @cython.embedsignature(True) def cuTexRefGetFormat(hTexRef): @@ -41510,22 +50664,21 @@ def cuTexRefGetFormat(hTexRef): -------- :py:obj:`~.cuTexRefSetAddress`, :py:obj:`~.cuTexRefSetAddress2D`, :py:obj:`~.cuTexRefSetAddressMode`, :py:obj:`~.cuTexRefSetArray`, :py:obj:`~.cuTexRefSetFilterMode`, :py:obj:`~.cuTexRefSetFlags`, :py:obj:`~.cuTexRefSetFormat`, :py:obj:`~.cuTexRefGetAddress`, :py:obj:`~.cuTexRefGetAddressMode`, :py:obj:`~.cuTexRefGetArray`, :py:obj:`~.cuTexRefGetFilterMode`, :py:obj:`~.cuTexRefGetFlags` """ - cdef ccuda.CUtexref chTexRef + cdef cydriver.CUtexref cyhTexRef if hTexRef is None: - chTexRef = 0 + phTexRef = 0 elif isinstance(hTexRef, (CUtexref,)): phTexRef = int(hTexRef) - chTexRef = phTexRef else: phTexRef = int(CUtexref(hTexRef)) - chTexRef = phTexRef - cdef ccuda.CUarray_format pFormat + cyhTexRef = phTexRef + cdef cydriver.CUarray_format pFormat cdef int pNumChannels = 0 - err = ccuda.cuTexRefGetFormat(&pFormat, &pNumChannels, chTexRef) - return (CUresult(err), CUarray_format(pFormat), pNumChannels) -{{endif}} - -{{if 'cuTexRefGetMipmapFilterMode' in found_functions}} + with nogil: + err = cydriver.cuTexRefGetFormat(&pFormat, &pNumChannels, cyhTexRef) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None, None) + return (_CUresult_SUCCESS, CUarray_format(pFormat), pNumChannels) @cython.embedsignature(True) def cuTexRefGetMipmapFilterMode(hTexRef): @@ -41552,21 +50705,20 @@ def cuTexRefGetMipmapFilterMode(hTexRef): -------- :py:obj:`~.cuTexRefSetAddress`, :py:obj:`~.cuTexRefSetAddress2D`, :py:obj:`~.cuTexRefSetAddressMode`, :py:obj:`~.cuTexRefSetArray`, :py:obj:`~.cuTexRefSetFlags`, :py:obj:`~.cuTexRefSetFormat`, :py:obj:`~.cuTexRefGetAddress`, :py:obj:`~.cuTexRefGetAddressMode`, :py:obj:`~.cuTexRefGetArray`, :py:obj:`~.cuTexRefGetFilterMode`, :py:obj:`~.cuTexRefGetFlags`, :py:obj:`~.cuTexRefGetFormat` """ - cdef ccuda.CUtexref chTexRef + cdef cydriver.CUtexref cyhTexRef if hTexRef is None: - chTexRef = 0 + phTexRef = 0 elif isinstance(hTexRef, (CUtexref,)): phTexRef = int(hTexRef) - chTexRef = phTexRef else: phTexRef = int(CUtexref(hTexRef)) - chTexRef = phTexRef - cdef ccuda.CUfilter_mode pfm - err = ccuda.cuTexRefGetMipmapFilterMode(&pfm, chTexRef) - return (CUresult(err), CUfilter_mode(pfm)) -{{endif}} - -{{if 'cuTexRefGetMipmapLevelBias' in found_functions}} + cyhTexRef = phTexRef + cdef cydriver.CUfilter_mode pfm + with nogil: + err = cydriver.cuTexRefGetMipmapFilterMode(&pfm, cyhTexRef) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, CUfilter_mode(pfm)) @cython.embedsignature(True) def cuTexRefGetMipmapLevelBias(hTexRef): @@ -41594,21 +50746,20 @@ def cuTexRefGetMipmapLevelBias(hTexRef): -------- :py:obj:`~.cuTexRefSetAddress`, :py:obj:`~.cuTexRefSetAddress2D`, :py:obj:`~.cuTexRefSetAddressMode`, :py:obj:`~.cuTexRefSetArray`, :py:obj:`~.cuTexRefSetFlags`, :py:obj:`~.cuTexRefSetFormat`, :py:obj:`~.cuTexRefGetAddress`, :py:obj:`~.cuTexRefGetAddressMode`, :py:obj:`~.cuTexRefGetArray`, :py:obj:`~.cuTexRefGetFilterMode`, :py:obj:`~.cuTexRefGetFlags`, :py:obj:`~.cuTexRefGetFormat` """ - cdef ccuda.CUtexref chTexRef + cdef cydriver.CUtexref cyhTexRef if hTexRef is None: - chTexRef = 0 + phTexRef = 0 elif isinstance(hTexRef, (CUtexref,)): phTexRef = int(hTexRef) - chTexRef = phTexRef else: phTexRef = int(CUtexref(hTexRef)) - chTexRef = phTexRef + cyhTexRef = phTexRef cdef float pbias = 0 - err = ccuda.cuTexRefGetMipmapLevelBias(&pbias, chTexRef) - return (CUresult(err), pbias) -{{endif}} - -{{if 'cuTexRefGetMipmapLevelClamp' in found_functions}} + with nogil: + err = cydriver.cuTexRefGetMipmapLevelBias(&pbias, cyhTexRef) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pbias) @cython.embedsignature(True) def cuTexRefGetMipmapLevelClamp(hTexRef): @@ -41638,22 +50789,21 @@ def cuTexRefGetMipmapLevelClamp(hTexRef): -------- :py:obj:`~.cuTexRefSetAddress`, :py:obj:`~.cuTexRefSetAddress2D`, :py:obj:`~.cuTexRefSetAddressMode`, :py:obj:`~.cuTexRefSetArray`, :py:obj:`~.cuTexRefSetFlags`, :py:obj:`~.cuTexRefSetFormat`, :py:obj:`~.cuTexRefGetAddress`, :py:obj:`~.cuTexRefGetAddressMode`, :py:obj:`~.cuTexRefGetArray`, :py:obj:`~.cuTexRefGetFilterMode`, :py:obj:`~.cuTexRefGetFlags`, :py:obj:`~.cuTexRefGetFormat` """ - cdef ccuda.CUtexref chTexRef + cdef cydriver.CUtexref cyhTexRef if hTexRef is None: - chTexRef = 0 + phTexRef = 0 elif isinstance(hTexRef, (CUtexref,)): phTexRef = int(hTexRef) - chTexRef = phTexRef else: phTexRef = int(CUtexref(hTexRef)) - chTexRef = phTexRef + cyhTexRef = phTexRef cdef float pminMipmapLevelClamp = 0 cdef float pmaxMipmapLevelClamp = 0 - err = ccuda.cuTexRefGetMipmapLevelClamp(&pminMipmapLevelClamp, &pmaxMipmapLevelClamp, chTexRef) - return (CUresult(err), pminMipmapLevelClamp, pmaxMipmapLevelClamp) -{{endif}} - -{{if 'cuTexRefGetMaxAnisotropy' in found_functions}} + with nogil: + err = cydriver.cuTexRefGetMipmapLevelClamp(&pminMipmapLevelClamp, &pmaxMipmapLevelClamp, cyhTexRef) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None, None) + return (_CUresult_SUCCESS, pminMipmapLevelClamp, pmaxMipmapLevelClamp) @cython.embedsignature(True) def cuTexRefGetMaxAnisotropy(hTexRef): @@ -41680,21 +50830,20 @@ def cuTexRefGetMaxAnisotropy(hTexRef): -------- :py:obj:`~.cuTexRefSetAddress`, :py:obj:`~.cuTexRefSetAddress2D`, :py:obj:`~.cuTexRefSetAddressMode`, :py:obj:`~.cuTexRefSetArray`, :py:obj:`~.cuTexRefSetFlags`, :py:obj:`~.cuTexRefSetFormat`, :py:obj:`~.cuTexRefGetAddress`, :py:obj:`~.cuTexRefGetAddressMode`, :py:obj:`~.cuTexRefGetArray`, :py:obj:`~.cuTexRefGetFilterMode`, :py:obj:`~.cuTexRefGetFlags`, :py:obj:`~.cuTexRefGetFormat` """ - cdef ccuda.CUtexref chTexRef + cdef cydriver.CUtexref cyhTexRef if hTexRef is None: - chTexRef = 0 + phTexRef = 0 elif isinstance(hTexRef, (CUtexref,)): phTexRef = int(hTexRef) - chTexRef = phTexRef else: phTexRef = int(CUtexref(hTexRef)) - chTexRef = phTexRef + cyhTexRef = phTexRef cdef int pmaxAniso = 0 - err = ccuda.cuTexRefGetMaxAnisotropy(&pmaxAniso, chTexRef) - return (CUresult(err), pmaxAniso) -{{endif}} - -{{if 'cuTexRefGetBorderColor' in found_functions}} + with nogil: + err = cydriver.cuTexRefGetMaxAnisotropy(&pmaxAniso, cyhTexRef) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pmaxAniso) @cython.embedsignature(True) def cuTexRefGetBorderColor(hTexRef): @@ -41724,21 +50873,20 @@ def cuTexRefGetBorderColor(hTexRef): -------- :py:obj:`~.cuTexRefSetAddressMode`, :py:obj:`~.cuTexRefSetAddressMode`, :py:obj:`~.cuTexRefSetBorderColor` """ - cdef ccuda.CUtexref chTexRef + cdef cydriver.CUtexref cyhTexRef if hTexRef is None: - chTexRef = 0 + phTexRef = 0 elif isinstance(hTexRef, (CUtexref,)): phTexRef = int(hTexRef) - chTexRef = phTexRef else: phTexRef = int(CUtexref(hTexRef)) - chTexRef = phTexRef + cyhTexRef = phTexRef cdef float pBorderColor = 0 - err = ccuda.cuTexRefGetBorderColor(&pBorderColor, chTexRef) - return (CUresult(err), pBorderColor) -{{endif}} - -{{if 'cuTexRefGetFlags' in found_functions}} + with nogil: + err = cydriver.cuTexRefGetBorderColor(&pBorderColor, cyhTexRef) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pBorderColor) @cython.embedsignature(True) def cuTexRefGetFlags(hTexRef): @@ -41764,21 +50912,20 @@ def cuTexRefGetFlags(hTexRef): -------- :py:obj:`~.cuTexRefSetAddress`, :py:obj:`~.cuTexRefSetAddress2D`, :py:obj:`~.cuTexRefSetAddressMode`, :py:obj:`~.cuTexRefSetArray`, :py:obj:`~.cuTexRefSetFilterMode`, :py:obj:`~.cuTexRefSetFlags`, :py:obj:`~.cuTexRefSetFormat`, :py:obj:`~.cuTexRefGetAddress`, :py:obj:`~.cuTexRefGetAddressMode`, :py:obj:`~.cuTexRefGetArray`, :py:obj:`~.cuTexRefGetFilterMode`, :py:obj:`~.cuTexRefGetFormat` """ - cdef ccuda.CUtexref chTexRef + cdef cydriver.CUtexref cyhTexRef if hTexRef is None: - chTexRef = 0 + phTexRef = 0 elif isinstance(hTexRef, (CUtexref,)): phTexRef = int(hTexRef) - chTexRef = phTexRef else: phTexRef = int(CUtexref(hTexRef)) - chTexRef = phTexRef + cyhTexRef = phTexRef cdef unsigned int pFlags = 0 - err = ccuda.cuTexRefGetFlags(&pFlags, chTexRef) - return (CUresult(err), pFlags) -{{endif}} - -{{if 'cuTexRefCreate' in found_functions}} + with nogil: + err = cydriver.cuTexRefGetFlags(&pFlags, cyhTexRef) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pFlags) @cython.embedsignature(True) def cuTexRefCreate(): @@ -41805,11 +50952,11 @@ def cuTexRefCreate(): :py:obj:`~.cuTexRefDestroy` """ cdef CUtexref pTexRef = CUtexref() - err = ccuda.cuTexRefCreate(pTexRef._ptr) - return (CUresult(err), pTexRef) -{{endif}} - -{{if 'cuTexRefDestroy' in found_functions}} + with nogil: + err = cydriver.cuTexRefCreate(pTexRef._pvt_ptr) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pTexRef) @cython.embedsignature(True) def cuTexRefDestroy(hTexRef): @@ -41833,20 +50980,17 @@ def cuTexRefDestroy(hTexRef): -------- :py:obj:`~.cuTexRefCreate` """ - cdef ccuda.CUtexref chTexRef + cdef cydriver.CUtexref cyhTexRef if hTexRef is None: - chTexRef = 0 + phTexRef = 0 elif isinstance(hTexRef, (CUtexref,)): phTexRef = int(hTexRef) - chTexRef = phTexRef else: phTexRef = int(CUtexref(hTexRef)) - chTexRef = phTexRef - err = ccuda.cuTexRefDestroy(chTexRef) - return (CUresult(err),) -{{endif}} - -{{if 'cuSurfRefSetArray' in found_functions}} + cyhTexRef = phTexRef + with nogil: + err = cydriver.cuTexRefDestroy(cyhTexRef) + return (_CUresult(err),) @cython.embedsignature(True) def cuSurfRefSetArray(hSurfRef, hArray, unsigned int Flags): @@ -41879,29 +51023,25 @@ def cuSurfRefSetArray(hSurfRef, hArray, unsigned int Flags): -------- :py:obj:`~.cuModuleGetSurfRef`, :py:obj:`~.cuSurfRefGetArray` """ - cdef ccuda.CUarray chArray + cdef cydriver.CUarray cyhArray if hArray is None: - chArray = 0 + phArray = 0 elif isinstance(hArray, (CUarray,)): phArray = int(hArray) - chArray = phArray else: phArray = int(CUarray(hArray)) - chArray = phArray - cdef ccuda.CUsurfref chSurfRef + cyhArray = phArray + cdef cydriver.CUsurfref cyhSurfRef if hSurfRef is None: - chSurfRef = 0 + phSurfRef = 0 elif isinstance(hSurfRef, (CUsurfref,)): phSurfRef = int(hSurfRef) - chSurfRef = phSurfRef else: phSurfRef = int(CUsurfref(hSurfRef)) - chSurfRef = phSurfRef - err = ccuda.cuSurfRefSetArray(chSurfRef, chArray, Flags) - return (CUresult(err),) -{{endif}} - -{{if 'cuSurfRefGetArray' in found_functions}} + cyhSurfRef = phSurfRef + with nogil: + err = cydriver.cuSurfRefSetArray(cyhSurfRef, cyhArray, Flags) + return (_CUresult(err),) @cython.embedsignature(True) def cuSurfRefGetArray(hSurfRef): @@ -41929,21 +51069,20 @@ def cuSurfRefGetArray(hSurfRef): -------- :py:obj:`~.cuModuleGetSurfRef`, :py:obj:`~.cuSurfRefSetArray` """ - cdef ccuda.CUsurfref chSurfRef + cdef cydriver.CUsurfref cyhSurfRef if hSurfRef is None: - chSurfRef = 0 + phSurfRef = 0 elif isinstance(hSurfRef, (CUsurfref,)): phSurfRef = int(hSurfRef) - chSurfRef = phSurfRef else: phSurfRef = int(CUsurfref(hSurfRef)) - chSurfRef = phSurfRef + cyhSurfRef = phSurfRef cdef CUarray phArray = CUarray() - err = ccuda.cuSurfRefGetArray(phArray._ptr, chSurfRef) - return (CUresult(err), phArray) -{{endif}} - -{{if 'cuTexObjectCreate' in found_functions}} + with nogil: + err = cydriver.cuSurfRefGetArray(phArray._pvt_ptr, cyhSurfRef) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, phArray) @cython.embedsignature(True) def cuTexObjectCreate(pResDesc : Optional[CUDA_RESOURCE_DESC], pTexDesc : Optional[CUDA_TEXTURE_DESC], pResViewDesc : Optional[CUDA_RESOURCE_VIEW_DESC]): @@ -41975,23 +51114,23 @@ def cuTexObjectCreate(pResDesc : Optional[CUDA_RESOURCE_DESC], pTexDesc : Option If :py:obj:`~.CUDA_RESOURCE_DESC.resType` is set to :py:obj:`~.CU_RESOURCE_TYPE_ARRAY`, - :py:obj:`~.CUDA_RESOURCE_DESC`::res::array::hArray must be set to a - valid CUDA array handle. + :py:obj:`~.CUDA_RESOURCE_DESC.res.array.hArray` must be set to a valid + CUDA array handle. If :py:obj:`~.CUDA_RESOURCE_DESC.resType` is set to :py:obj:`~.CU_RESOURCE_TYPE_MIPMAPPED_ARRAY`, - :py:obj:`~.CUDA_RESOURCE_DESC`::res::mipmap::hMipmappedArray must be - set to a valid CUDA mipmapped array handle. + :py:obj:`~.CUDA_RESOURCE_DESC.res.mipmap.hMipmappedArray` must be set + to a valid CUDA mipmapped array handle. If :py:obj:`~.CUDA_RESOURCE_DESC.resType` is set to :py:obj:`~.CU_RESOURCE_TYPE_LINEAR`, - :py:obj:`~.CUDA_RESOURCE_DESC`::res::linear::devPtr must be set to a - valid device pointer, that is aligned to + :py:obj:`~.CUDA_RESOURCE_DESC.res.linear.devPtr` must be set to a valid + device pointer, that is aligned to :py:obj:`~.CU_DEVICE_ATTRIBUTE_TEXTURE_ALIGNMENT`. - :py:obj:`~.CUDA_RESOURCE_DESC`::res::linear::format and - :py:obj:`~.CUDA_RESOURCE_DESC`::res::linear::numChannels describe the + :py:obj:`~.CUDA_RESOURCE_DESC.res.linear.format` and + :py:obj:`~.CUDA_RESOURCE_DESC.res.linear.numChannels` describe the format of each component and the number of components per array - element. :py:obj:`~.CUDA_RESOURCE_DESC`::res::linear::sizeInBytes + element. :py:obj:`~.CUDA_RESOURCE_DESC.res.linear.sizeInBytes` specifies the size of the array in bytes. The total number of elements in the linear address range cannot exceed :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LINEAR_WIDTH`. The @@ -42000,20 +51139,19 @@ def cuTexObjectCreate(pResDesc : Optional[CUDA_RESOURCE_DESC], pTexDesc : Option If :py:obj:`~.CUDA_RESOURCE_DESC.resType` is set to :py:obj:`~.CU_RESOURCE_TYPE_PITCH2D`, - :py:obj:`~.CUDA_RESOURCE_DESC`::res::pitch2D::devPtr must be set to a + :py:obj:`~.CUDA_RESOURCE_DESC.res.pitch2D.devPtr` must be set to a valid device pointer, that is aligned to :py:obj:`~.CU_DEVICE_ATTRIBUTE_TEXTURE_ALIGNMENT`. - :py:obj:`~.CUDA_RESOURCE_DESC`::res::pitch2D::format and - :py:obj:`~.CUDA_RESOURCE_DESC`::res::pitch2D::numChannels describe the + :py:obj:`~.CUDA_RESOURCE_DESC.res.pitch2D.format` and + :py:obj:`~.CUDA_RESOURCE_DESC.res.pitch2D.numChannels` describe the format of each component and the number of components per array - element. :py:obj:`~.CUDA_RESOURCE_DESC`::res::pitch2D::width and - :py:obj:`~.CUDA_RESOURCE_DESC`::res::pitch2D::height specify the width - and height of the array in elements, and cannot exceed + element. :py:obj:`~.CUDA_RESOURCE_DESC.res.pitch2D.width` and + :py:obj:`~.CUDA_RESOURCE_DESC.res.pitch2D.height` specify the width and + height of the array in elements, and cannot exceed :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_WIDTH` and :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_HEIGHT` - respectively. - :py:obj:`~.CUDA_RESOURCE_DESC`::res::pitch2D::pitchInBytes specifies - the pitch between two rows in bytes and has to be aligned to + respectively. :py:obj:`~.CUDA_RESOURCE_DESC.res.pitch2D.pitchInBytes` + specifies the pitch between two rows in bytes and has to be aligned to :py:obj:`~.CU_DEVICE_ATTRIBUTE_TEXTURE_PITCH_ALIGNMENT`. Pitch cannot exceed :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_PITCH`. @@ -42037,8 +51175,8 @@ def cuTexObjectCreate(pResDesc : Optional[CUDA_RESOURCE_DESC], pTexDesc : Option supported address mode is :py:obj:`~.CU_TR_ADDRESS_MODE_CLAMP`. - :py:obj:`~.CUDA_TEXTURE_DESC.filterMode` specifies the filtering mode - to be used when fetching from the texture. CUfilter_mode is defined - as: + to be used when fetching from the texture. :py:obj:`~.CUfilter_mode` + is defined as: - **View CUDA Toolkit Documentation for a C++ code example** @@ -42173,14 +51311,14 @@ def cuTexObjectCreate(pResDesc : Optional[CUDA_RESOURCE_DESC], pTexDesc : Option :py:obj:`~.cuTexObjectDestroy`, :py:obj:`~.cudaCreateTextureObject` """ cdef CUtexObject pTexObject = CUtexObject() - cdef ccuda.CUDA_RESOURCE_DESC* cpResDesc_ptr = pResDesc._ptr if pResDesc != None else NULL - cdef ccuda.CUDA_TEXTURE_DESC* cpTexDesc_ptr = pTexDesc._ptr if pTexDesc != None else NULL - cdef ccuda.CUDA_RESOURCE_VIEW_DESC* cpResViewDesc_ptr = pResViewDesc._ptr if pResViewDesc != None else NULL - err = ccuda.cuTexObjectCreate(pTexObject._ptr, cpResDesc_ptr, cpTexDesc_ptr, cpResViewDesc_ptr) - return (CUresult(err), pTexObject) -{{endif}} - -{{if 'cuTexObjectDestroy' in found_functions}} + cdef cydriver.CUDA_RESOURCE_DESC* cypResDesc_ptr = pResDesc._pvt_ptr if pResDesc is not None else NULL + cdef cydriver.CUDA_TEXTURE_DESC* cypTexDesc_ptr = pTexDesc._pvt_ptr if pTexDesc is not None else NULL + cdef cydriver.CUDA_RESOURCE_VIEW_DESC* cypResViewDesc_ptr = pResViewDesc._pvt_ptr if pResViewDesc is not None else NULL + with nogil: + err = cydriver.cuTexObjectCreate(pTexObject._pvt_ptr, cypResDesc_ptr, cypTexDesc_ptr, cypResViewDesc_ptr) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pTexObject) @cython.embedsignature(True) def cuTexObjectDestroy(texObject): @@ -42202,20 +51340,17 @@ def cuTexObjectDestroy(texObject): -------- :py:obj:`~.cuTexObjectCreate`, :py:obj:`~.cudaDestroyTextureObject` """ - cdef ccuda.CUtexObject ctexObject + cdef cydriver.CUtexObject cytexObject if texObject is None: - ctexObject = 0 + ptexObject = 0 elif isinstance(texObject, (CUtexObject,)): ptexObject = int(texObject) - ctexObject = ptexObject else: ptexObject = int(CUtexObject(texObject)) - ctexObject = ptexObject - err = ccuda.cuTexObjectDestroy(ctexObject) - return (CUresult(err),) -{{endif}} - -{{if 'cuTexObjectGetResourceDesc' in found_functions}} + cytexObject = ptexObject + with nogil: + err = cydriver.cuTexObjectDestroy(cytexObject) + return (_CUresult(err),) @cython.embedsignature(True) def cuTexObjectGetResourceDesc(texObject): @@ -42240,21 +51375,20 @@ def cuTexObjectGetResourceDesc(texObject): -------- :py:obj:`~.cuTexObjectCreate`, :py:obj:`~.cudaGetTextureObjectResourceDesc`, """ - cdef ccuda.CUtexObject ctexObject + cdef cydriver.CUtexObject cytexObject if texObject is None: - ctexObject = 0 + ptexObject = 0 elif isinstance(texObject, (CUtexObject,)): ptexObject = int(texObject) - ctexObject = ptexObject else: ptexObject = int(CUtexObject(texObject)) - ctexObject = ptexObject + cytexObject = ptexObject cdef CUDA_RESOURCE_DESC pResDesc = CUDA_RESOURCE_DESC() - err = ccuda.cuTexObjectGetResourceDesc(pResDesc._ptr, ctexObject) - return (CUresult(err), pResDesc) -{{endif}} - -{{if 'cuTexObjectGetTextureDesc' in found_functions}} + with nogil: + err = cydriver.cuTexObjectGetResourceDesc(pResDesc._pvt_ptr, cytexObject) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pResDesc) @cython.embedsignature(True) def cuTexObjectGetTextureDesc(texObject): @@ -42279,21 +51413,20 @@ def cuTexObjectGetTextureDesc(texObject): -------- :py:obj:`~.cuTexObjectCreate`, :py:obj:`~.cudaGetTextureObjectTextureDesc` """ - cdef ccuda.CUtexObject ctexObject + cdef cydriver.CUtexObject cytexObject if texObject is None: - ctexObject = 0 + ptexObject = 0 elif isinstance(texObject, (CUtexObject,)): ptexObject = int(texObject) - ctexObject = ptexObject else: ptexObject = int(CUtexObject(texObject)) - ctexObject = ptexObject + cytexObject = ptexObject cdef CUDA_TEXTURE_DESC pTexDesc = CUDA_TEXTURE_DESC() - err = ccuda.cuTexObjectGetTextureDesc(pTexDesc._ptr, ctexObject) - return (CUresult(err), pTexDesc) -{{endif}} - -{{if 'cuTexObjectGetResourceViewDesc' in found_functions}} + with nogil: + err = cydriver.cuTexObjectGetTextureDesc(pTexDesc._pvt_ptr, cytexObject) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pTexDesc) @cython.embedsignature(True) def cuTexObjectGetResourceViewDesc(texObject): @@ -42319,21 +51452,20 @@ def cuTexObjectGetResourceViewDesc(texObject): -------- :py:obj:`~.cuTexObjectCreate`, :py:obj:`~.cudaGetTextureObjectResourceViewDesc` """ - cdef ccuda.CUtexObject ctexObject + cdef cydriver.CUtexObject cytexObject if texObject is None: - ctexObject = 0 + ptexObject = 0 elif isinstance(texObject, (CUtexObject,)): ptexObject = int(texObject) - ctexObject = ptexObject else: ptexObject = int(CUtexObject(texObject)) - ctexObject = ptexObject + cytexObject = ptexObject cdef CUDA_RESOURCE_VIEW_DESC pResViewDesc = CUDA_RESOURCE_VIEW_DESC() - err = ccuda.cuTexObjectGetResourceViewDesc(pResViewDesc._ptr, ctexObject) - return (CUresult(err), pResViewDesc) -{{endif}} - -{{if 'cuSurfObjectCreate' in found_functions}} + with nogil: + err = cydriver.cuTexObjectGetResourceViewDesc(pResViewDesc._pvt_ptr, cytexObject) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pResViewDesc) @cython.embedsignature(True) def cuSurfObjectCreate(pResDesc : Optional[CUDA_RESOURCE_DESC]): @@ -42343,9 +51475,9 @@ def cuSurfObjectCreate(pResDesc : Optional[CUDA_RESOURCE_DESC]): describes the data to perform surface load/stores on. :py:obj:`~.CUDA_RESOURCE_DESC.resType` must be :py:obj:`~.CU_RESOURCE_TYPE_ARRAY` and - :py:obj:`~.CUDA_RESOURCE_DESC`::res::array::hArray must be set to a - valid CUDA array handle. :py:obj:`~.CUDA_RESOURCE_DESC.flags` must be - set to zero. + :py:obj:`~.CUDA_RESOURCE_DESC.res.array.hArray` must be set to a valid + CUDA array handle. :py:obj:`~.CUDA_RESOURCE_DESC.flags` must be set to + zero. Surface objects are only supported on devices of compute capability 3.0 or higher. Additionally, a surface object is an opaque value, and, as @@ -42368,12 +51500,12 @@ def cuSurfObjectCreate(pResDesc : Optional[CUDA_RESOURCE_DESC]): :py:obj:`~.cuSurfObjectDestroy`, :py:obj:`~.cudaCreateSurfaceObject` """ cdef CUsurfObject pSurfObject = CUsurfObject() - cdef ccuda.CUDA_RESOURCE_DESC* cpResDesc_ptr = pResDesc._ptr if pResDesc != None else NULL - err = ccuda.cuSurfObjectCreate(pSurfObject._ptr, cpResDesc_ptr) - return (CUresult(err), pSurfObject) -{{endif}} - -{{if 'cuSurfObjectDestroy' in found_functions}} + cdef cydriver.CUDA_RESOURCE_DESC* cypResDesc_ptr = pResDesc._pvt_ptr if pResDesc is not None else NULL + with nogil: + err = cydriver.cuSurfObjectCreate(pSurfObject._pvt_ptr, cypResDesc_ptr) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pSurfObject) @cython.embedsignature(True) def cuSurfObjectDestroy(surfObject): @@ -42395,20 +51527,17 @@ def cuSurfObjectDestroy(surfObject): -------- :py:obj:`~.cuSurfObjectCreate`, :py:obj:`~.cudaDestroySurfaceObject` """ - cdef ccuda.CUsurfObject csurfObject + cdef cydriver.CUsurfObject cysurfObject if surfObject is None: - csurfObject = 0 + psurfObject = 0 elif isinstance(surfObject, (CUsurfObject,)): psurfObject = int(surfObject) - csurfObject = psurfObject else: psurfObject = int(CUsurfObject(surfObject)) - csurfObject = psurfObject - err = ccuda.cuSurfObjectDestroy(csurfObject) - return (CUresult(err),) -{{endif}} - -{{if 'cuSurfObjectGetResourceDesc' in found_functions}} + cysurfObject = psurfObject + with nogil: + err = cydriver.cuSurfObjectDestroy(cysurfObject) + return (_CUresult(err),) @cython.embedsignature(True) def cuSurfObjectGetResourceDesc(surfObject): @@ -42433,24 +51562,23 @@ def cuSurfObjectGetResourceDesc(surfObject): -------- :py:obj:`~.cuSurfObjectCreate`, :py:obj:`~.cudaGetSurfaceObjectResourceDesc` """ - cdef ccuda.CUsurfObject csurfObject + cdef cydriver.CUsurfObject cysurfObject if surfObject is None: - csurfObject = 0 + psurfObject = 0 elif isinstance(surfObject, (CUsurfObject,)): psurfObject = int(surfObject) - csurfObject = psurfObject else: psurfObject = int(CUsurfObject(surfObject)) - csurfObject = psurfObject + cysurfObject = psurfObject cdef CUDA_RESOURCE_DESC pResDesc = CUDA_RESOURCE_DESC() - err = ccuda.cuSurfObjectGetResourceDesc(pResDesc._ptr, csurfObject) - return (CUresult(err), pResDesc) -{{endif}} - -{{if 'cuTensorMapEncodeTiled' in found_functions}} + with nogil: + err = cydriver.cuSurfObjectGetResourceDesc(pResDesc._pvt_ptr, cysurfObject) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pResDesc) @cython.embedsignature(True) -def cuTensorMapEncodeTiled(tensorDataType not None : CUtensorMapDataType, tensorRank, globalAddress, globalDim : Optional[List[cuuint64_t]], globalStrides : Optional[List[cuuint64_t]], boxDim : Optional[List[cuuint32_t]], elementStrides : Optional[List[cuuint32_t]], interleave not None : CUtensorMapInterleave, swizzle not None : CUtensorMapSwizzle, l2Promotion not None : CUtensorMapL2promotion, oobFill not None : CUtensorMapFloatOOBfill): +def cuTensorMapEncodeTiled(tensorDataType not None : CUtensorMapDataType, tensorRank, globalAddress, globalDim : Optional[tuple[cuuint64_t] | list[cuuint64_t]], globalStrides : Optional[tuple[cuuint64_t] | list[cuuint64_t]], boxDim : Optional[tuple[cuuint32_t] | list[cuuint32_t]], elementStrides : Optional[tuple[cuuint32_t] | list[cuuint32_t]], interleave not None : CUtensorMapInterleave, swizzle not None : CUtensorMapSwizzle, l2Promotion not None : CUtensorMapL2promotion, oobFill not None : CUtensorMapFloatOOBfill): """ Create a tensor map descriptor object representing tiled memory region. Creates a descriptor for Tensor Memory Access (TMA) object specified by @@ -42458,7 +51586,7 @@ def cuTensorMapEncodeTiled(tensorDataType not None : CUtensorMapDataType, tensor Tensor map objects are only supported on devices of compute capability 9.0 or higher. Additionally, a tensor map object is an opaque value, - and, as such, should only be accessed through CUDA API calls. + and, as such, should only be accessed through CUDA APIs and PTX. The parameters passed are bound to the following requirements: @@ -42469,46 +51597,90 @@ def cuTensorMapEncodeTiled(tensorDataType not None : CUtensorMapDataType, tensor - **View CUDA Toolkit Documentation for a C++ code example** + - :py:obj:`~.CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN8B` copies '16 x U4' + packed values to memory aligned as 8 bytes. There are no gaps between + packed values. :py:obj:`~.CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN16B` + copies '16 x U4' packed values to memory aligned as 16 bytes. There + are 8 byte gaps between every 8 byte chunk of packed values. + :py:obj:`~.CU_TENSOR_MAP_DATA_TYPE_16U6_ALIGN16B` copies '16 x U6' + packed values to memory aligned as 16 bytes. There are 4 byte gaps + between every 12 byte chunk of packed values. + - `tensorRank` must be non-zero and less than or equal to the maximum supported dimensionality of 5. If `interleave` is not :py:obj:`~.CU_TENSOR_MAP_INTERLEAVE_NONE`, then `tensorRank` must additionally be greater than or equal to 3. - `globalAddress`, which specifies the starting address of the memory - region described, must be 32 byte aligned when `interleave` is - :py:obj:`~.CU_TENSOR_MAP_INTERLEAVE_32B` and 16 byte aligned - otherwise. + region described, must be 16 byte aligned. The following requirements + need to also be met: - - `globalDim` array, which specifies tensor size of each of the - `tensorRank` dimensions, must be non-zero and less than or equal to - 2^32. + - When `interleave` is :py:obj:`~.CU_TENSOR_MAP_INTERLEAVE_32B`, + `globalAddress` must be 32 byte aligned. - - `globalStrides` array, which specifies tensor stride of each of the - lower `tensorRank` - 1 dimensions in bytes, must be a multiple of 16 - and less than 2^40. Additionally, the stride must be a multiple of 32 - when `interleave` is :py:obj:`~.CU_TENSOR_MAP_INTERLEAVE_32B`. Each - following dimension specified includes previous dimension stride: + - When `tensorDataType` is + :py:obj:`~.CU_TENSOR_MAP_DATA_TYPE_16U6_ALIGN16B` or + :py:obj:`~.CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN16B`, `globalAddress` + must be 32 byte aligned. - - **View CUDA Toolkit Documentation for a C++ code example** + `globalDim` array, which specifies tensor size of each of the + `tensorRank` dimensions, must be non-zero and less than or equal to + 2^32. Additionally, the following requirements need to be met for the + packed data types: - - `boxDim` array, which specifies number of elements to be traversed - along each of the `tensorRank` dimensions, must be non-zero and less - than or equal to 256. When `interleave` is - :py:obj:`~.CU_TENSOR_MAP_INTERLEAVE_NONE`, { `boxDim`[0] * - elementSizeInBytes( `tensorDataType` ) } must be a multiple of 16 - bytes. + - When `tensorDataType` is + :py:obj:`~.CU_TENSOR_MAP_DATA_TYPE_16U6_ALIGN16B` or + :py:obj:`~.CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN16B`, globalDim[0] must + be a multiple of 128. - - `elementStrides` array, which specifies the iteration step along each - of the `tensorRank` dimensions, must be non-zero and less than or - equal to 8. Note that when `interleave` is - :py:obj:`~.CU_TENSOR_MAP_INTERLEAVE_NONE`, the first element of this - array is ignored since TMA doesn’t support the stride for dimension - zero. When all elements of `elementStrides` array is one, `boxDim` - specifies the number of elements to load. However, if the - `elementStrides`[i] is not equal to one, then TMA loads ceil( - `boxDim`[i] / `elementStrides`[i]) number of elements along i-th - dimension. To load N elements along i-th dimension, `boxDim`[i] must - be set to N * `elementStrides`[i]. + - When `tensorDataType` is + :py:obj:`~.CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN8B`, `globalDim`[0] must + be a multiple of 2. + + - Dimension for the packed data types must reflect the number of + individual U# values. + + `globalStrides` array, which specifies tensor stride of each of the + lower `tensorRank` - 1 dimensions in bytes, must be a multiple of 16 + and less than 2^40. Additionally, the following requirements need to be + met: + + - When `interleave` is :py:obj:`~.CU_TENSOR_MAP_INTERLEAVE_32B`, the + strides must be a multiple of 32. + + - When `tensorDataType` is + :py:obj:`~.CU_TENSOR_MAP_DATA_TYPE_16U6_ALIGN16B` or + :py:obj:`~.CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN16B`, the strides must + be a multiple of 32. Each following dimension specified includes + previous dimension stride: + + - **View CUDA Toolkit Documentation for a C++ code example** + + `boxDim` array, which specifies number of elements to be traversed + along each of the `tensorRank` dimensions, must be non-zero and less + than or equal to 256. Additionally, the following requirements need to + be met: + + - When `interleave` is :py:obj:`~.CU_TENSOR_MAP_INTERLEAVE_NONE`, { + `boxDim`[0] * elementSizeInBytes( `tensorDataType` ) } must be a + multiple of 16 bytes. + + - When `tensorDataType` is + :py:obj:`~.CU_TENSOR_MAP_DATA_TYPE_16U6_ALIGN16B` or + :py:obj:`~.CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN16B`, boxDim[0] must be + 128. + + `elementStrides` array, which specifies the iteration step along each + of the `tensorRank` dimensions, must be non-zero and less than or equal + to 8. Note that when `interleave` is + :py:obj:`~.CU_TENSOR_MAP_INTERLEAVE_NONE`, the first element of this + array is ignored since TMA doesn’t support the stride for dimension + zero. When all elements of `elementStrides` array is one, `boxDim` + specifies the number of elements to load. However, if the + `elementStrides`[i] is not equal to one, then TMA loads ceil( + `boxDim`[i] / `elementStrides`[i]) number of elements along i-th + dimension. To load N elements along i-th dimension, `boxDim`[i] must be + set to N * `elementStrides`[i]. - `interleave` specifies the interleaved layout of type :py:obj:`~.CUtensorMapInterleave`, which is defined as: @@ -42524,14 +51696,16 @@ def cuTensorMapEncodeTiled(tensorDataType not None : CUtensorMapDataType, tensor from `tensorDataType`) must be less than or equal to the swizzle size. - - CU_TENSOR_MAP_SWIZZLE_32B implies the bounding box inner dimension - will be <= 32. + - CU_TENSOR_MAP_SWIZZLE_32B requires the bounding box inner dimension + to be <= 32. - - CU_TENSOR_MAP_SWIZZLE_64B implies the bounding box inner dimension - will be <= 64. + - CU_TENSOR_MAP_SWIZZLE_64B requires the bounding box inner dimension + to be <= 64. - - CU_TENSOR_MAP_SWIZZLE_128B implies the bounding box inner dimension - will be <= 128. + - CU_TENSOR_MAP_SWIZZLE_128B* require the bounding box inner + dimension to be <= 128. Additionally, `tensorDataType` of + :py:obj:`~.CU_TENSOR_MAP_DATA_TYPE_16U6_ALIGN16B` requires + `interleave` to be :py:obj:`~.CU_TENSOR_MAP_INTERLEAVE_NONE`. - `swizzle`, which specifies the shared memory bank swizzling pattern, has to be of type :py:obj:`~.CUtensorMapSwizzle` which is defined as: @@ -42546,7 +51720,26 @@ def cuTensorMapEncodeTiled(tensorDataType not None : CUtensorMapDataType, tensor shared memory banks. When `interleave` is :py:obj:`~.CU_TENSOR_MAP_INTERLEAVE_32B`, `swizzle` must be :py:obj:`~.CU_TENSOR_MAP_SWIZZLE_32B`. Other interleave modes can - have any swizzling pattern. + have any swizzling pattern. When the `tensorDataType` is + :py:obj:`~.CU_TENSOR_MAP_DATA_TYPE_16U6_ALIGN16B`, only the following + swizzle modes are supported: + + - CU_TENSOR_MAP_SWIZZLE_NONE (Load & Store) + + - CU_TENSOR_MAP_SWIZZLE_128B (Load & Store) + + - CU_TENSOR_MAP_SWIZZLE_128B_ATOM_32B (Load & Store) + + - CU_TENSOR_MAP_SWIZZLE_128B_ATOM_64B (Store only) When the + `tensorDataType` is + :py:obj:`~.CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN16B`, only the + following swizzle modes are supported: + + - CU_TENSOR_MAP_SWIZZLE_NONE (Load only) + + - CU_TENSOR_MAP_SWIZZLE_128B (Load only) + + - CU_TENSOR_MAP_SWIZZLE_128B_ATOM_32B (Load only) - `l2Promotion` specifies L2 fetch size which indicates the byte granurality at which L2 requests is filled from DRAM. It must be of @@ -42563,7 +51756,10 @@ def cuTensorMapEncodeTiled(tensorDataType not None : CUtensorMapDataType, tensor - Note that :py:obj:`~.CU_TENSOR_MAP_FLOAT_OOB_FILL_NAN_REQUEST_ZERO_FMA` can only be used when `tensorDataType` represents a floating-point data - type. + type, and when `tensorDataType` is not + :py:obj:`~.CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN8B`, + :py:obj:`~.CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN16B`, and + :py:obj:`~.CU_TENSOR_MAP_DATA_TYPE_16U6_ALIGN16B`. Parameters ---------- @@ -42573,17 +51769,17 @@ def cuTensorMapEncodeTiled(tensorDataType not None : CUtensorMapDataType, tensor Dimensionality of tensor globalAddress : Any Starting address of memory region described by tensor - globalDim : List[:py:obj:`~.cuuint64_t`] + globalDim : list[:py:obj:`~.cuuint64_t`] Array containing tensor size (number of elements) along each of the `tensorRank` dimensions - globalStrides : List[:py:obj:`~.cuuint64_t`] + globalStrides : list[:py:obj:`~.cuuint64_t`] Array containing stride size (in bytes) along each of the `tensorRank` - 1 dimensions - boxDim : List[:py:obj:`~.cuuint32_t`] + boxDim : list[:py:obj:`~.cuuint32_t`] Array containing traversal box size (number of elments) along each of the `tensorRank` dimensions. Specifies how many elements to be traversed along each tensor dimension. - elementStrides : List[:py:obj:`~.cuuint32_t`] + elementStrides : list[:py:obj:`~.cuuint32_t`] Array containing traversal stride in each of the `tensorRank` dimensions interleave : :py:obj:`~.CUtensorMapInterleave` @@ -42605,85 +51801,89 @@ def cuTensorMapEncodeTiled(tensorDataType not None : CUtensorMapDataType, tensor See Also -------- - :py:obj:`~.cuTensorMapEncodeIm2col`, :py:obj:`~.cuTensorMapReplaceAddress` - """ - elementStrides = [] if elementStrides is None else elementStrides - if not all(isinstance(_x, (cuuint32_t,)) for _x in elementStrides): - raise TypeError("Argument 'elementStrides' is not instance of type (expected List[ccuda.cuuint32_t,]") - boxDim = [] if boxDim is None else boxDim - if not all(isinstance(_x, (cuuint32_t,)) for _x in boxDim): - raise TypeError("Argument 'boxDim' is not instance of type (expected List[ccuda.cuuint32_t,]") - globalStrides = [] if globalStrides is None else globalStrides - if not all(isinstance(_x, (cuuint64_t,)) for _x in globalStrides): - raise TypeError("Argument 'globalStrides' is not instance of type (expected List[ccuda.cuuint64_t,]") - globalDim = [] if globalDim is None else globalDim - if not all(isinstance(_x, (cuuint64_t,)) for _x in globalDim): - raise TypeError("Argument 'globalDim' is not instance of type (expected List[ccuda.cuuint64_t,]") - cdef ccuda.cuuint32_t ctensorRank + :py:obj:`~.cuTensorMapEncodeIm2col`, :py:obj:`~.cuTensorMapEncodeIm2colWide`, :py:obj:`~.cuTensorMapReplaceAddress` + """ + cdef cydriver.cuuint32_t* cyelementStrides + cdef size_t elementStridesLen + cdef cydriver.cuuint32_t[5] elementStridesStatic + elementStridesLen = 0 if elementStrides is None else len(elementStrides) + if elementStridesLen == 0: + cyelementStrides = NULL + elif elementStridesLen == 1: + cyelementStrides = ( elementStrides[0])._pvt_ptr + elif elementStridesLen <= 5: + for idx in range(elementStridesLen): + elementStridesStatic[idx] = ( elementStrides[idx])._pvt_ptr[0] + cyelementStrides = elementStridesStatic + else: + raise ValueError("Argument 'elementStrides' too long, must be <= 5") + cdef cydriver.cuuint32_t* cyboxDim + cdef size_t boxDimLen + cdef cydriver.cuuint32_t[5] boxDimStatic + boxDimLen = 0 if boxDim is None else len(boxDim) + if boxDimLen == 0: + cyboxDim = NULL + elif boxDimLen == 1: + cyboxDim = ( boxDim[0])._pvt_ptr + elif boxDimLen <= 5: + for idx in range(boxDimLen): + boxDimStatic[idx] = ( boxDim[idx])._pvt_ptr[0] + cyboxDim = boxDimStatic + else: + raise ValueError("Argument 'boxDim' too long, must be <= 5") + cdef cydriver.cuuint64_t* cyglobalStrides + cdef size_t globalStridesLen + cdef cydriver.cuuint64_t[5] globalStridesStatic + globalStridesLen = 0 if globalStrides is None else len(globalStrides) + if globalStridesLen == 0: + cyglobalStrides = NULL + elif globalStridesLen == 1: + cyglobalStrides = ( globalStrides[0])._pvt_ptr + elif globalStridesLen <= 5: + for idx in range(globalStridesLen): + globalStridesStatic[idx] = ( globalStrides[idx])._pvt_ptr[0] + cyglobalStrides = globalStridesStatic + else: + raise ValueError("Argument 'globalStrides' too long, must be <= 5") + cdef cydriver.cuuint64_t* cyglobalDim + cdef size_t globalDimLen + cdef cydriver.cuuint64_t[5] globalDimStatic + globalDimLen = 0 if globalDim is None else len(globalDim) + if globalDimLen == 0: + cyglobalDim = NULL + elif globalDimLen == 1: + cyglobalDim = ( globalDim[0])._pvt_ptr + elif globalDimLen <= 5: + for idx in range(globalDimLen): + globalDimStatic[idx] = ( globalDim[idx])._pvt_ptr[0] + cyglobalDim = globalDimStatic + else: + raise ValueError("Argument 'globalDim' too long, must be <= 5") + cdef cydriver.cuuint32_t cytensorRank if tensorRank is None: - ctensorRank = 0 + ptensorRank = 0 elif isinstance(tensorRank, (cuuint32_t,)): ptensorRank = int(tensorRank) - ctensorRank = ptensorRank else: ptensorRank = int(cuuint32_t(tensorRank)) - ctensorRank = ptensorRank + cytensorRank = ptensorRank cdef CUtensorMap tensorMap = CUtensorMap() - cdef ccuda.CUtensorMapDataType ctensorDataType = tensorDataType.value - cglobalAddress = utils.HelperInputVoidPtr(globalAddress) - cdef void* cglobalAddress_ptr = cglobalAddress.cptr - cdef ccuda.cuuint64_t* cglobalDim = NULL - if len(globalDim) > 0: - cglobalDim = calloc(len(globalDim), sizeof(ccuda.cuuint64_t)) - if cglobalDim is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(globalDim)) + 'x' + str(sizeof(ccuda.cuuint64_t))) - else: - for idx in range(len(globalDim)): - cglobalDim[idx] = (globalDim[idx])._ptr[0] - cdef ccuda.cuuint64_t* cglobalStrides = NULL - if len(globalStrides) > 0: - cglobalStrides = calloc(len(globalStrides), sizeof(ccuda.cuuint64_t)) - if cglobalStrides is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(globalStrides)) + 'x' + str(sizeof(ccuda.cuuint64_t))) - else: - for idx in range(len(globalStrides)): - cglobalStrides[idx] = (globalStrides[idx])._ptr[0] - cdef ccuda.cuuint32_t* cboxDim = NULL - if len(boxDim) > 0: - cboxDim = calloc(len(boxDim), sizeof(ccuda.cuuint32_t)) - if cboxDim is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(boxDim)) + 'x' + str(sizeof(ccuda.cuuint32_t))) - else: - for idx in range(len(boxDim)): - cboxDim[idx] = (boxDim[idx])._ptr[0] - cdef ccuda.cuuint32_t* celementStrides = NULL - if len(elementStrides) > 0: - celementStrides = calloc(len(elementStrides), sizeof(ccuda.cuuint32_t)) - if celementStrides is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(elementStrides)) + 'x' + str(sizeof(ccuda.cuuint32_t))) - else: - for idx in range(len(elementStrides)): - celementStrides[idx] = (elementStrides[idx])._ptr[0] - cdef ccuda.CUtensorMapInterleave cinterleave = interleave.value - cdef ccuda.CUtensorMapSwizzle cswizzle = swizzle.value - cdef ccuda.CUtensorMapL2promotion cl2Promotion = l2Promotion.value - cdef ccuda.CUtensorMapFloatOOBfill coobFill = oobFill.value - err = ccuda.cuTensorMapEncodeTiled(tensorMap._ptr, ctensorDataType, ctensorRank, cglobalAddress_ptr, (globalDim[0])._ptr if len(globalDim) == 1 else cglobalDim, (globalStrides[0])._ptr if len(globalStrides) == 1 else cglobalStrides, (boxDim[0])._ptr if len(boxDim) == 1 else cboxDim, (elementStrides[0])._ptr if len(elementStrides) == 1 else celementStrides, cinterleave, cswizzle, cl2Promotion, coobFill) - if cglobalDim is not NULL: - free(cglobalDim) - if cglobalStrides is not NULL: - free(cglobalStrides) - if cboxDim is not NULL: - free(cboxDim) - if celementStrides is not NULL: - free(celementStrides) - return (CUresult(err), tensorMap) -{{endif}} - -{{if 'cuTensorMapEncodeIm2col' in found_functions}} - -@cython.embedsignature(True) -def cuTensorMapEncodeIm2col(tensorDataType not None : CUtensorMapDataType, tensorRank, globalAddress, globalDim : Optional[List[cuuint64_t]], globalStrides : Optional[List[cuuint64_t]], pixelBoxLowerCorner : Optional[List[int]], pixelBoxUpperCorner : Optional[List[int]], channelsPerPixel, pixelsPerColumn, elementStrides : Optional[List[cuuint32_t]], interleave not None : CUtensorMapInterleave, swizzle not None : CUtensorMapSwizzle, l2Promotion not None : CUtensorMapL2promotion, oobFill not None : CUtensorMapFloatOOBfill): + cdef cydriver.CUtensorMapDataType cytensorDataType = int(tensorDataType) + cdef _HelperInputVoidPtrStruct cyglobalAddressHelper + cdef void* cyglobalAddress = _helper_input_void_ptr(globalAddress, &cyglobalAddressHelper) + cdef cydriver.CUtensorMapInterleave cyinterleave = int(interleave) + cdef cydriver.CUtensorMapSwizzle cyswizzle = int(swizzle) + cdef cydriver.CUtensorMapL2promotion cyl2Promotion = int(l2Promotion) + cdef cydriver.CUtensorMapFloatOOBfill cyoobFill = int(oobFill) + with nogil: + err = cydriver.cuTensorMapEncodeTiled(tensorMap._pvt_ptr, cytensorDataType, cytensorRank, cyglobalAddress, cyglobalDim, cyglobalStrides, cyboxDim, cyelementStrides, cyinterleave, cyswizzle, cyl2Promotion, cyoobFill) + _helper_input_void_ptr_free(&cyglobalAddressHelper) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, tensorMap) + +@cython.embedsignature(True) +def cuTensorMapEncodeIm2col(tensorDataType not None : CUtensorMapDataType, tensorRank, globalAddress, globalDim : Optional[tuple[cuuint64_t] | list[cuuint64_t]], globalStrides : Optional[tuple[cuuint64_t] | list[cuuint64_t]], pixelBoxLowerCorner : Optional[tuple[int] | list[int]], pixelBoxUpperCorner : Optional[tuple[int] | list[int]], channelsPerPixel, pixelsPerColumn, elementStrides : Optional[tuple[cuuint32_t] | list[cuuint32_t]], interleave not None : CUtensorMapInterleave, swizzle not None : CUtensorMapSwizzle, l2Promotion not None : CUtensorMapL2promotion, oobFill not None : CUtensorMapFloatOOBfill): """ Create a tensor map descriptor object representing im2col memory region. Creates a descriptor for Tensor Memory Access (TMA) object specified by @@ -42692,7 +51892,7 @@ def cuTensorMapEncodeIm2col(tensorDataType not None : CUtensorMapDataType, tenso Tensor map objects are only supported on devices of compute capability 9.0 or higher. Additionally, a tensor map object is an opaque value, - and, as such, should only be accessed through CUDA API calls. + and, as such, should only be accessed through CUDA APIs and PTX. The parameters passed are bound to the following requirements: @@ -42703,25 +51903,62 @@ def cuTensorMapEncodeIm2col(tensorDataType not None : CUtensorMapDataType, tenso - **View CUDA Toolkit Documentation for a C++ code example** + - :py:obj:`~.CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN8B` copies '16 x U4' + packed values to memory aligned as 8 bytes. There are no gaps between + packed values. :py:obj:`~.CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN16B` + copies '16 x U4' packed values to memory aligned as 16 bytes. There + are 8 byte gaps between every 8 byte chunk of packed values. + :py:obj:`~.CU_TENSOR_MAP_DATA_TYPE_16U6_ALIGN16B` copies '16 x U6' + packed values to memory aligned as 16 bytes. There are 4 byte gaps + between every 12 byte chunk of packed values. + - `tensorRank`, which specifies the number of tensor dimensions, must be 3, 4, or 5. - `globalAddress`, which specifies the starting address of the memory - region described, must be 32 byte aligned when `interleave` is - :py:obj:`~.CU_TENSOR_MAP_INTERLEAVE_32B` and 16 byte aligned - otherwise. + region described, must be 16 byte aligned. The following requirements + need to also be met: + + - When `interleave` is :py:obj:`~.CU_TENSOR_MAP_INTERLEAVE_32B`, + `globalAddress` must be 32 byte aligned. + + - When `tensorDataType` is + :py:obj:`~.CU_TENSOR_MAP_DATA_TYPE_16U6_ALIGN16B` or + :py:obj:`~.CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN16B`, `globalAddress` + must be 32 byte aligned. - `globalDim` array, which specifies tensor size of each of the `tensorRank` dimensions, must be non-zero and less than or equal to - 2^32. + 2^32. Additionally, the following requirements need to be met for the + packed data types: + + - When `tensorDataType` is + :py:obj:`~.CU_TENSOR_MAP_DATA_TYPE_16U6_ALIGN16B` or + :py:obj:`~.CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN16B`, globalDim[0] + must be a multiple of 128. + + - When `tensorDataType` is + :py:obj:`~.CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN8B`, `globalDim`[0] + must be a multiple of 2. + + - Dimension for the packed data types must reflect the number of + individual U# values. - `globalStrides` array, which specifies tensor stride of each of the lower `tensorRank` - 1 dimensions in bytes, must be a multiple of 16 - and less than 2^40. Additionally, the stride must be a multiple of 32 - when `interleave` is :py:obj:`~.CU_TENSOR_MAP_INTERLEAVE_32B`. Each - following dimension specified includes previous dimension stride: + and less than 2^40. Additionally, the following requirements need to + be met: - - **View CUDA Toolkit Documentation for a C++ code example** + - When `interleave` is :py:obj:`~.CU_TENSOR_MAP_INTERLEAVE_32B`, the + strides must be a multiple of 32. + + - When `tensorDataType` is + :py:obj:`~.CU_TENSOR_MAP_DATA_TYPE_16U6_ALIGN16B` or + :py:obj:`~.CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN16B`, the strides must + be a multiple of 32. Each following dimension specified includes + previous dimension stride: + + - **View CUDA Toolkit Documentation for a C++ code example** - `pixelBoxLowerCorner` array specifies the coordinate offsets {D, H, W} of the bounding box from top/left/front corner. The number of @@ -42752,6 +51989,10 @@ def cuTensorMapEncodeIm2col(tensorDataType not None : CUtensorMapDataType, tenso - `channelsPerPixel`, which specifies the number of elements which must be accessed along C dimension, must be less than or equal to 256. + Additionally, when `tensorDataType` is + :py:obj:`~.CU_TENSOR_MAP_DATA_TYPE_16U6_ALIGN16B` or + :py:obj:`~.CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN16B`, `channelsPerPixel` + must be 128. - `pixelsPerColumn`, which specifies the number of elements that must be accessed along the {N, D, H, W} dimensions, must be less than or @@ -42779,18 +52020,20 @@ def cuTensorMapEncodeIm2col(tensorDataType not None : CUtensorMapDataType, tenso uses 32 bytes. When `interleave` is :py:obj:`~.CU_TENSOR_MAP_INTERLEAVE_NONE` and `swizzle` is not :py:obj:`~.CU_TENSOR_MAP_SWIZZLE_NONE`, the bounding box inner - dimension (computed as `boxDim`[0] multiplied by element size derived - from `tensorDataType`) must be less than or equal to the swizzle - size. + dimension (computed as `channelsPerPixel` multiplied by element size + in bytes derived from `tensorDataType`) must be less than or equal to + the swizzle size. - - CU_TENSOR_MAP_SWIZZLE_32B implies the bounding box inner dimension - will be <= 32. + - CU_TENSOR_MAP_SWIZZLE_32B requires the bounding box inner dimension + to be <= 32. - - CU_TENSOR_MAP_SWIZZLE_64B implies the bounding box inner dimension - will be <= 64. + - CU_TENSOR_MAP_SWIZZLE_64B requires the bounding box inner dimension + to be <= 64. - - CU_TENSOR_MAP_SWIZZLE_128B implies the bounding box inner dimension - will be <= 128. + - CU_TENSOR_MAP_SWIZZLE_128B* require the bounding box inner + dimension to be <= 128. Additionally, `tensorDataType` of + :py:obj:`~.CU_TENSOR_MAP_DATA_TYPE_16U6_ALIGN16B` requires + `interleave` to be :py:obj:`~.CU_TENSOR_MAP_INTERLEAVE_NONE`. - `swizzle`, which specifies the shared memory bank swizzling pattern, has to be of type :py:obj:`~.CUtensorMapSwizzle` which is defined as: @@ -42805,7 +52048,26 @@ def cuTensorMapEncodeIm2col(tensorDataType not None : CUtensorMapDataType, tenso shared memory banks. When `interleave` is :py:obj:`~.CU_TENSOR_MAP_INTERLEAVE_32B`, `swizzle` must be :py:obj:`~.CU_TENSOR_MAP_SWIZZLE_32B`. Other interleave modes can - have any swizzling pattern. + have any swizzling pattern. When the `tensorDataType` is + :py:obj:`~.CU_TENSOR_MAP_DATA_TYPE_16U6_ALIGN16B`, only the following + swizzle modes are supported: + + - CU_TENSOR_MAP_SWIZZLE_NONE (Load & Store) + + - CU_TENSOR_MAP_SWIZZLE_128B (Load & Store) + + - CU_TENSOR_MAP_SWIZZLE_128B_ATOM_32B (Load & Store) + + - CU_TENSOR_MAP_SWIZZLE_128B_ATOM_64B (Store only) When the + `tensorDataType` is + :py:obj:`~.CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN16B`, only the + following swizzle modes are supported: + + - CU_TENSOR_MAP_SWIZZLE_NONE (Load only) + + - CU_TENSOR_MAP_SWIZZLE_128B (Load only) + + - CU_TENSOR_MAP_SWIZZLE_128B_ATOM_32B (Load only) - `l2Promotion` specifies L2 fetch size which indicates the byte granularity at which L2 requests are filled from DRAM. It must be of @@ -42822,7 +52084,10 @@ def cuTensorMapEncodeIm2col(tensorDataType not None : CUtensorMapDataType, tenso - Note that :py:obj:`~.CU_TENSOR_MAP_FLOAT_OOB_FILL_NAN_REQUEST_ZERO_FMA` can only be used when `tensorDataType` represents a floating-point data - type. + type, and when `tensorDataType` is not + :py:obj:`~.CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN8B`, + :py:obj:`~.CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN16B`, and + :py:obj:`~.CU_TENSOR_MAP_DATA_TYPE_16U6_ALIGN16B`. Parameters ---------- @@ -42832,21 +52097,21 @@ def cuTensorMapEncodeIm2col(tensorDataType not None : CUtensorMapDataType, tenso Dimensionality of tensor; must be at least 3 globalAddress : Any Starting address of memory region described by tensor - globalDim : List[:py:obj:`~.cuuint64_t`] + globalDim : list[:py:obj:`~.cuuint64_t`] Array containing tensor size (number of elements) along each of the `tensorRank` dimensions - globalStrides : List[:py:obj:`~.cuuint64_t`] + globalStrides : list[:py:obj:`~.cuuint64_t`] Array containing stride size (in bytes) along each of the `tensorRank` - 1 dimensions - pixelBoxLowerCorner : List[int] + pixelBoxLowerCorner : list[int] Array containing DHW dimensions of lower box corner - pixelBoxUpperCorner : List[int] + pixelBoxUpperCorner : list[int] Array containing DHW dimensions of upper box corner channelsPerPixel : Any Number of channels per pixel pixelsPerColumn : Any Number of pixels per column - elementStrides : List[:py:obj:`~.cuuint32_t`] + elementStrides : list[:py:obj:`~.cuuint32_t`] Array containing traversal stride in each of the `tensorRank` dimensions interleave : :py:obj:`~.CUtensorMapInterleave` @@ -42868,95 +52133,423 @@ def cuTensorMapEncodeIm2col(tensorDataType not None : CUtensorMapDataType, tenso See Also -------- - :py:obj:`~.cuTensorMapEncodeTiled`, :py:obj:`~.cuTensorMapReplaceAddress` + :py:obj:`~.cuTensorMapEncodeTiled`, :py:obj:`~.cuTensorMapEncodeIm2colWide`, :py:obj:`~.cuTensorMapReplaceAddress` """ - elementStrides = [] if elementStrides is None else elementStrides - if not all(isinstance(_x, (cuuint32_t,)) for _x in elementStrides): - raise TypeError("Argument 'elementStrides' is not instance of type (expected List[ccuda.cuuint32_t,]") - cdef ccuda.cuuint32_t cpixelsPerColumn + cdef cydriver.cuuint32_t* cyelementStrides + cdef size_t elementStridesLen + cdef cydriver.cuuint32_t[5] elementStridesStatic + elementStridesLen = 0 if elementStrides is None else len(elementStrides) + if elementStridesLen == 0: + cyelementStrides = NULL + elif elementStridesLen == 1: + cyelementStrides = ( elementStrides[0])._pvt_ptr + elif elementStridesLen <= 5: + for idx in range(elementStridesLen): + elementStridesStatic[idx] = ( elementStrides[idx])._pvt_ptr[0] + cyelementStrides = elementStridesStatic + else: + raise ValueError("Argument 'elementStrides' too long, must be <= 5") + cdef cydriver.cuuint32_t cypixelsPerColumn if pixelsPerColumn is None: - cpixelsPerColumn = 0 + ppixelsPerColumn = 0 elif isinstance(pixelsPerColumn, (cuuint32_t,)): ppixelsPerColumn = int(pixelsPerColumn) - cpixelsPerColumn = ppixelsPerColumn else: ppixelsPerColumn = int(cuuint32_t(pixelsPerColumn)) - cpixelsPerColumn = ppixelsPerColumn - cdef ccuda.cuuint32_t cchannelsPerPixel + cypixelsPerColumn = ppixelsPerColumn + cdef cydriver.cuuint32_t cychannelsPerPixel if channelsPerPixel is None: - cchannelsPerPixel = 0 + pchannelsPerPixel = 0 elif isinstance(channelsPerPixel, (cuuint32_t,)): pchannelsPerPixel = int(channelsPerPixel) - cchannelsPerPixel = pchannelsPerPixel else: pchannelsPerPixel = int(cuuint32_t(channelsPerPixel)) - cchannelsPerPixel = pchannelsPerPixel + cychannelsPerPixel = pchannelsPerPixel pixelBoxUpperCorner = [] if pixelBoxUpperCorner is None else pixelBoxUpperCorner if not all(isinstance(_x, (int)) for _x in pixelBoxUpperCorner): - raise TypeError("Argument 'pixelBoxUpperCorner' is not instance of type (expected List[ccuda.int]") + raise TypeError("Argument 'pixelBoxUpperCorner' is not instance of type (expected tuple[int] or list[int]") pixelBoxLowerCorner = [] if pixelBoxLowerCorner is None else pixelBoxLowerCorner if not all(isinstance(_x, (int)) for _x in pixelBoxLowerCorner): - raise TypeError("Argument 'pixelBoxLowerCorner' is not instance of type (expected List[ccuda.int]") - globalStrides = [] if globalStrides is None else globalStrides - if not all(isinstance(_x, (cuuint64_t,)) for _x in globalStrides): - raise TypeError("Argument 'globalStrides' is not instance of type (expected List[ccuda.cuuint64_t,]") - globalDim = [] if globalDim is None else globalDim - if not all(isinstance(_x, (cuuint64_t,)) for _x in globalDim): - raise TypeError("Argument 'globalDim' is not instance of type (expected List[ccuda.cuuint64_t,]") - cdef ccuda.cuuint32_t ctensorRank + raise TypeError("Argument 'pixelBoxLowerCorner' is not instance of type (expected tuple[int] or list[int]") + cdef cydriver.cuuint64_t* cyglobalStrides + cdef size_t globalStridesLen + cdef cydriver.cuuint64_t[5] globalStridesStatic + globalStridesLen = 0 if globalStrides is None else len(globalStrides) + if globalStridesLen == 0: + cyglobalStrides = NULL + elif globalStridesLen == 1: + cyglobalStrides = ( globalStrides[0])._pvt_ptr + elif globalStridesLen <= 5: + for idx in range(globalStridesLen): + globalStridesStatic[idx] = ( globalStrides[idx])._pvt_ptr[0] + cyglobalStrides = globalStridesStatic + else: + raise ValueError("Argument 'globalStrides' too long, must be <= 5") + cdef cydriver.cuuint64_t* cyglobalDim + cdef size_t globalDimLen + cdef cydriver.cuuint64_t[5] globalDimStatic + globalDimLen = 0 if globalDim is None else len(globalDim) + if globalDimLen == 0: + cyglobalDim = NULL + elif globalDimLen == 1: + cyglobalDim = ( globalDim[0])._pvt_ptr + elif globalDimLen <= 5: + for idx in range(globalDimLen): + globalDimStatic[idx] = ( globalDim[idx])._pvt_ptr[0] + cyglobalDim = globalDimStatic + else: + raise ValueError("Argument 'globalDim' too long, must be <= 5") + cdef cydriver.cuuint32_t cytensorRank if tensorRank is None: - ctensorRank = 0 + ptensorRank = 0 elif isinstance(tensorRank, (cuuint32_t,)): ptensorRank = int(tensorRank) - ctensorRank = ptensorRank else: ptensorRank = int(cuuint32_t(tensorRank)) - ctensorRank = ptensorRank + cytensorRank = ptensorRank cdef CUtensorMap tensorMap = CUtensorMap() - cdef ccuda.CUtensorMapDataType ctensorDataType = tensorDataType.value - cglobalAddress = utils.HelperInputVoidPtr(globalAddress) - cdef void* cglobalAddress_ptr = cglobalAddress.cptr - cdef ccuda.cuuint64_t* cglobalDim = NULL - if len(globalDim) > 0: - cglobalDim = calloc(len(globalDim), sizeof(ccuda.cuuint64_t)) - if cglobalDim is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(globalDim)) + 'x' + str(sizeof(ccuda.cuuint64_t))) - else: - for idx in range(len(globalDim)): - cglobalDim[idx] = (globalDim[idx])._ptr[0] - cdef ccuda.cuuint64_t* cglobalStrides = NULL - if len(globalStrides) > 0: - cglobalStrides = calloc(len(globalStrides), sizeof(ccuda.cuuint64_t)) - if cglobalStrides is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(globalStrides)) + 'x' + str(sizeof(ccuda.cuuint64_t))) - else: - for idx in range(len(globalStrides)): - cglobalStrides[idx] = (globalStrides[idx])._ptr[0] - cdef vector[int] cpixelBoxLowerCorner = [pypixelBoxLowerCorner for pypixelBoxLowerCorner in (pixelBoxLowerCorner)] - cdef vector[int] cpixelBoxUpperCorner = [pypixelBoxUpperCorner for pypixelBoxUpperCorner in (pixelBoxUpperCorner)] - cdef ccuda.cuuint32_t* celementStrides = NULL - if len(elementStrides) > 0: - celementStrides = calloc(len(elementStrides), sizeof(ccuda.cuuint32_t)) - if celementStrides is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(elementStrides)) + 'x' + str(sizeof(ccuda.cuuint32_t))) - else: - for idx in range(len(elementStrides)): - celementStrides[idx] = (elementStrides[idx])._ptr[0] - cdef ccuda.CUtensorMapInterleave cinterleave = interleave.value - cdef ccuda.CUtensorMapSwizzle cswizzle = swizzle.value - cdef ccuda.CUtensorMapL2promotion cl2Promotion = l2Promotion.value - cdef ccuda.CUtensorMapFloatOOBfill coobFill = oobFill.value - err = ccuda.cuTensorMapEncodeIm2col(tensorMap._ptr, ctensorDataType, ctensorRank, cglobalAddress_ptr, (globalDim[0])._ptr if len(globalDim) == 1 else cglobalDim, (globalStrides[0])._ptr if len(globalStrides) == 1 else cglobalStrides, cpixelBoxLowerCorner.data(), cpixelBoxUpperCorner.data(), cchannelsPerPixel, cpixelsPerColumn, (elementStrides[0])._ptr if len(elementStrides) == 1 else celementStrides, cinterleave, cswizzle, cl2Promotion, coobFill) - if cglobalDim is not NULL: - free(cglobalDim) - if cglobalStrides is not NULL: - free(cglobalStrides) - if celementStrides is not NULL: - free(celementStrides) - return (CUresult(err), tensorMap) -{{endif}} - -{{if 'cuTensorMapReplaceAddress' in found_functions}} + cdef cydriver.CUtensorMapDataType cytensorDataType = int(tensorDataType) + cdef _HelperInputVoidPtrStruct cyglobalAddressHelper + cdef void* cyglobalAddress = _helper_input_void_ptr(globalAddress, &cyglobalAddressHelper) + cdef vector[int] cypixelBoxLowerCorner = pixelBoxLowerCorner + cdef vector[int] cypixelBoxUpperCorner = pixelBoxUpperCorner + cdef cydriver.CUtensorMapInterleave cyinterleave = int(interleave) + cdef cydriver.CUtensorMapSwizzle cyswizzle = int(swizzle) + cdef cydriver.CUtensorMapL2promotion cyl2Promotion = int(l2Promotion) + cdef cydriver.CUtensorMapFloatOOBfill cyoobFill = int(oobFill) + with nogil: + err = cydriver.cuTensorMapEncodeIm2col(tensorMap._pvt_ptr, cytensorDataType, cytensorRank, cyglobalAddress, cyglobalDim, cyglobalStrides, cypixelBoxLowerCorner.data(), cypixelBoxUpperCorner.data(), cychannelsPerPixel, cypixelsPerColumn, cyelementStrides, cyinterleave, cyswizzle, cyl2Promotion, cyoobFill) + _helper_input_void_ptr_free(&cyglobalAddressHelper) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, tensorMap) + +@cython.embedsignature(True) +def cuTensorMapEncodeIm2colWide(tensorDataType not None : CUtensorMapDataType, tensorRank, globalAddress, globalDim : Optional[tuple[cuuint64_t] | list[cuuint64_t]], globalStrides : Optional[tuple[cuuint64_t] | list[cuuint64_t]], int pixelBoxLowerCornerWidth, int pixelBoxUpperCornerWidth, channelsPerPixel, pixelsPerColumn, elementStrides : Optional[tuple[cuuint32_t] | list[cuuint32_t]], interleave not None : CUtensorMapInterleave, mode not None : CUtensorMapIm2ColWideMode, swizzle not None : CUtensorMapSwizzle, l2Promotion not None : CUtensorMapL2promotion, oobFill not None : CUtensorMapFloatOOBfill): + """ Create a tensor map descriptor object representing im2col memory region, but where the elements are exclusively loaded along the W dimension. + + Creates a descriptor for Tensor Memory Access (TMA) object specified by + the parameters describing a im2col memory layout and where the row is + always loaded along the W dimensuin and returns it in `tensorMap`. This + assumes the tensor layout in memory is either NDHWC, NHWC, or NWC. + + This API is only supported on devices of compute capability 10.0 or + higher. Additionally, a tensor map object is an opaque value, and, as + such, should only be accessed through CUDA APIs and PTX. + + The parameters passed are bound to the following requirements: + + - `tensorMap` address must be aligned to 64 bytes. + + - `tensorDataType` has to be an enum from + :py:obj:`~.CUtensorMapDataType` which is defined as: + + - **View CUDA Toolkit Documentation for a C++ code example** + + - :py:obj:`~.CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN8B` copies '16 x U4' + packed values to memory aligned as 8 bytes. There are no gaps between + packed values. :py:obj:`~.CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN16B` + copies '16 x U4' packed values to memory aligned as 16 bytes. There + are 8 byte gaps between every 8 byte chunk of packed values. + :py:obj:`~.CU_TENSOR_MAP_DATA_TYPE_16U6_ALIGN16B` copies '16 x U6' + packed values to memory aligned as 16 bytes. There are 4 byte gaps + between every 12 byte chunk of packed values. + + - `tensorRank`, which specifies the number of tensor dimensions, must + be 3, 4, or 5. + + - `globalAddress`, which specifies the starting address of the memory + region described, must be 16 byte aligned. The following requirements + need to also be met: + + - When `interleave` is :py:obj:`~.CU_TENSOR_MAP_INTERLEAVE_32B`, + `globalAddress` must be 32 byte aligned. + + - When `tensorDataType` is + :py:obj:`~.CU_TENSOR_MAP_DATA_TYPE_16U6_ALIGN16B` or + :py:obj:`~.CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN16B`, `globalAddress` + must be 32 byte aligned. + + `globalDim` array, which specifies tensor size of each of the + `tensorRank` dimensions, must be non-zero and less than or equal to + 2^32. Additionally, the following requirements need to be met for the + packed data types: + + - When `tensorDataType` is + :py:obj:`~.CU_TENSOR_MAP_DATA_TYPE_16U6_ALIGN16B` or + :py:obj:`~.CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN16B`, globalDim[0] must + be a multiple of 128. + + - When `tensorDataType` is + :py:obj:`~.CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN8B`, `globalDim`[0] must + be a multiple of 2. + + - Dimension for the packed data types must reflect the number of + individual U# values. + + `globalStrides` array, which specifies tensor stride of each of the + lower `tensorRank` - 1 dimensions in bytes, must be a multiple of 16 + and less than 2^40. Additionally, the following requirements need to be + met: + + - When `interleave` is :py:obj:`~.CU_TENSOR_MAP_INTERLEAVE_32B`, the + strides must be a multiple of 32. + + - When `tensorDataType` is + :py:obj:`~.CU_TENSOR_MAP_DATA_TYPE_16U6_ALIGN16B` or + :py:obj:`~.CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN16B`, the strides must + be a multiple of 32. Each following dimension specified includes + previous dimension stride: + + - **View CUDA Toolkit Documentation for a C++ code example** + + `pixelBoxLowerCornerWidth` specifies the coordinate offset W of the + bounding box from left corner. The offset must be within range [-32768, + 32767]. + + - `pixelBoxUpperCornerWidth` specifies the coordinate offset W of the + bounding box from right corner. The offset must be within range + [-32768, 32767]. + + The bounding box specified by `pixelBoxLowerCornerWidth` and + `pixelBoxUpperCornerWidth` must have non-zero area. Note that the size + of the box along D and H dimensions is always equal to one. + + - `channelsPerPixel`, which specifies the number of elements which must + be accessed along C dimension, must be less than or equal to 256. + Additionally, when `tensorDataType` is + :py:obj:`~.CU_TENSOR_MAP_DATA_TYPE_16U6_ALIGN16B` or + :py:obj:`~.CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN16B`, `channelsPerPixel` + must be 128. + + - `pixelsPerColumn`, which specifies the number of elements that must + be accessed along the W dimension, must be less than or equal to + 1024. This field is ignored when `mode` is + :py:obj:`~.CU_TENSOR_MAP_IM2COL_WIDE_MODE_W128`. + + - `elementStrides` array, which specifies the iteration step along each + of the `tensorRank` dimensions, must be non-zero and less than or + equal to 8. Note that when `interleave` is + :py:obj:`~.CU_TENSOR_MAP_INTERLEAVE_NONE`, the first element of this + array is ignored since TMA doesn’t support the stride for dimension + zero. When all elements of the `elementStrides` array are one, + `boxDim` specifies the number of elements to load. However, if + `elementStrides`[i] is not equal to one for some `i`, then TMA loads + ceil( `boxDim`[i] / `elementStrides`[i]) number of elements along + i-th dimension. To load N elements along i-th dimension, `boxDim`[i] + must be set to N * `elementStrides`[i]. + + - `interleave` specifies the interleaved layout of type + :py:obj:`~.CUtensorMapInterleave`, which is defined as: + + - **View CUDA Toolkit Documentation for a C++ code example** + + - TMA supports interleaved layouts like NC/8HWC8 where C8 utilizes 16 + bytes in memory assuming 2 byte per channel or NC/16HWC16 where C16 + uses 32 bytes. When `interleave` is + :py:obj:`~.CU_TENSOR_MAP_INTERLEAVE_NONE`, the bounding box inner + dimension (computed as `channelsPerPixel` multiplied by element size + in bytes derived from `tensorDataType`) must be less than or equal to + the swizzle size. + + - CU_TENSOR_MAP_SWIZZLE_64B requires the bounding box inner dimension + to be <= 64. + + - CU_TENSOR_MAP_SWIZZLE_128B* require the bounding box inner + dimension to be <= 128. Additionally, `tensorDataType` of + :py:obj:`~.CU_TENSOR_MAP_DATA_TYPE_16U6_ALIGN16B` requires + `interleave` to be :py:obj:`~.CU_TENSOR_MAP_INTERLEAVE_NONE`. + + - `mode`, which describes loading of elements loaded along the W + dimension, has to be one of the following + :py:obj:`~.CUtensorMapIm2ColWideMode` types: + + - **View CUDA Toolkit Documentation for a C++ code example** + + - :py:obj:`~.CU_TENSOR_MAP_IM2COL_WIDE_MODE_W` allows the number of + elements loaded along the W dimension to be specified via the + `pixelsPerColumn` field. + + - `swizzle`, which specifies the shared memory bank swizzling pattern, + must be one of the following :py:obj:`~.CUtensorMapSwizzle` modes + (other swizzle modes are not supported): + + - **View CUDA Toolkit Documentation for a C++ code example** + + - Data are organized in a specific order in global memory; however, + this may not match the order in which the application accesses data + in shared memory. This difference in data organization may cause bank + conflicts when shared memory is accessed. In order to avoid this + problem, data can be loaded to shared memory with shuffling across + shared memory banks. When the `tensorDataType` is + :py:obj:`~.CU_TENSOR_MAP_DATA_TYPE_16U6_ALIGN16B`, only the following + swizzle modes are supported: + + - CU_TENSOR_MAP_SWIZZLE_64B (Store only) + + - CU_TENSOR_MAP_SWIZZLE_128B (Load & Store) + + - CU_TENSOR_MAP_SWIZZLE_128B_ATOM_32B (Load & Store) When the + `tensorDataType` is + :py:obj:`~.CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN16B`, only the + following swizzle modes are supported: + + - CU_TENSOR_MAP_SWIZZLE_128B (Load only) + + - CU_TENSOR_MAP_SWIZZLE_128B_ATOM_32B (Load only) + + Additionally, :py:obj:`~.CU_TENSOR_MAP_SWIZZLE_96B` is supported only + when `mode` is :py:obj:`~.CU_TENSOR_MAP_IM2COL_WIDE_MODE_W`. + + - `l2Promotion` specifies L2 fetch size which indicates the byte + granularity at which L2 requests are filled from DRAM. It must be of + type :py:obj:`~.CUtensorMapL2promotion`, which is defined as: + + - **View CUDA Toolkit Documentation for a C++ code example** + + - `oobFill`, which indicates whether zero or a special NaN constant + should be used to fill out-of-bound elements, must be of type + :py:obj:`~.CUtensorMapFloatOOBfill` which is defined as: + + - **View CUDA Toolkit Documentation for a C++ code example** + + - Note that + :py:obj:`~.CU_TENSOR_MAP_FLOAT_OOB_FILL_NAN_REQUEST_ZERO_FMA` can + only be used when `tensorDataType` represents a floating-point data + type, and when `tensorDataType` is not + :py:obj:`~.CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN8B`, + :py:obj:`~.CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN16B`, and + :py:obj:`~.CU_TENSOR_MAP_DATA_TYPE_16U6_ALIGN16B`. + + Parameters + ---------- + tensorDataType : :py:obj:`~.CUtensorMapDataType` + Tensor data type + tensorRank : Any + Dimensionality of tensor; must be at least 3 + globalAddress : Any + Starting address of memory region described by tensor + globalDim : list[:py:obj:`~.cuuint64_t`] + Array containing tensor size (number of elements) along each of the + `tensorRank` dimensions + globalStrides : list[:py:obj:`~.cuuint64_t`] + Array containing stride size (in bytes) along each of the + `tensorRank` - 1 dimensions + pixelBoxLowerCornerWidth : int + Width offset of left box corner + pixelBoxUpperCornerWidth : int + Width offset of right box corner + channelsPerPixel : Any + Number of channels per pixel + pixelsPerColumn : Any + Number of pixels per column + elementStrides : list[:py:obj:`~.cuuint32_t`] + Array containing traversal stride in each of the `tensorRank` + dimensions + interleave : :py:obj:`~.CUtensorMapInterleave` + Type of interleaved layout the tensor addresses + mode : :py:obj:`~.CUtensorMapIm2ColWideMode` + W or W128 mode + swizzle : :py:obj:`~.CUtensorMapSwizzle` + Bank swizzling pattern inside shared memory + l2Promotion : :py:obj:`~.CUtensorMapL2promotion` + L2 promotion size + oobFill : :py:obj:`~.CUtensorMapFloatOOBfill` + Indicate whether zero or special NaN constant will be used to fill + out-of-bound elements + + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_CONTEXT`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE` + tensorMap : :py:obj:`~.CUtensorMap` + Tensor map object to create + + See Also + -------- + :py:obj:`~.cuTensorMapEncodeTiled`, :py:obj:`~.cuTensorMapEncodeIm2col`, :py:obj:`~.cuTensorMapReplaceAddress` + """ + cdef cydriver.cuuint32_t* cyelementStrides + cdef size_t elementStridesLen + cdef cydriver.cuuint32_t[5] elementStridesStatic + elementStridesLen = 0 if elementStrides is None else len(elementStrides) + if elementStridesLen == 0: + cyelementStrides = NULL + elif elementStridesLen == 1: + cyelementStrides = ( elementStrides[0])._pvt_ptr + elif elementStridesLen <= 5: + for idx in range(elementStridesLen): + elementStridesStatic[idx] = ( elementStrides[idx])._pvt_ptr[0] + cyelementStrides = elementStridesStatic + else: + raise ValueError("Argument 'elementStrides' too long, must be <= 5") + cdef cydriver.cuuint32_t cypixelsPerColumn + if pixelsPerColumn is None: + ppixelsPerColumn = 0 + elif isinstance(pixelsPerColumn, (cuuint32_t,)): + ppixelsPerColumn = int(pixelsPerColumn) + else: + ppixelsPerColumn = int(cuuint32_t(pixelsPerColumn)) + cypixelsPerColumn = ppixelsPerColumn + cdef cydriver.cuuint32_t cychannelsPerPixel + if channelsPerPixel is None: + pchannelsPerPixel = 0 + elif isinstance(channelsPerPixel, (cuuint32_t,)): + pchannelsPerPixel = int(channelsPerPixel) + else: + pchannelsPerPixel = int(cuuint32_t(channelsPerPixel)) + cychannelsPerPixel = pchannelsPerPixel + cdef cydriver.cuuint64_t* cyglobalStrides + cdef size_t globalStridesLen + cdef cydriver.cuuint64_t[5] globalStridesStatic + globalStridesLen = 0 if globalStrides is None else len(globalStrides) + if globalStridesLen == 0: + cyglobalStrides = NULL + elif globalStridesLen == 1: + cyglobalStrides = ( globalStrides[0])._pvt_ptr + elif globalStridesLen <= 5: + for idx in range(globalStridesLen): + globalStridesStatic[idx] = ( globalStrides[idx])._pvt_ptr[0] + cyglobalStrides = globalStridesStatic + else: + raise ValueError("Argument 'globalStrides' too long, must be <= 5") + cdef cydriver.cuuint64_t* cyglobalDim + cdef size_t globalDimLen + cdef cydriver.cuuint64_t[5] globalDimStatic + globalDimLen = 0 if globalDim is None else len(globalDim) + if globalDimLen == 0: + cyglobalDim = NULL + elif globalDimLen == 1: + cyglobalDim = ( globalDim[0])._pvt_ptr + elif globalDimLen <= 5: + for idx in range(globalDimLen): + globalDimStatic[idx] = ( globalDim[idx])._pvt_ptr[0] + cyglobalDim = globalDimStatic + else: + raise ValueError("Argument 'globalDim' too long, must be <= 5") + cdef cydriver.cuuint32_t cytensorRank + if tensorRank is None: + ptensorRank = 0 + elif isinstance(tensorRank, (cuuint32_t,)): + ptensorRank = int(tensorRank) + else: + ptensorRank = int(cuuint32_t(tensorRank)) + cytensorRank = ptensorRank + cdef CUtensorMap tensorMap = CUtensorMap() + cdef cydriver.CUtensorMapDataType cytensorDataType = int(tensorDataType) + cdef _HelperInputVoidPtrStruct cyglobalAddressHelper + cdef void* cyglobalAddress = _helper_input_void_ptr(globalAddress, &cyglobalAddressHelper) + cdef cydriver.CUtensorMapInterleave cyinterleave = int(interleave) + cdef cydriver.CUtensorMapIm2ColWideMode cymode = int(mode) + cdef cydriver.CUtensorMapSwizzle cyswizzle = int(swizzle) + cdef cydriver.CUtensorMapL2promotion cyl2Promotion = int(l2Promotion) + cdef cydriver.CUtensorMapFloatOOBfill cyoobFill = int(oobFill) + with nogil: + err = cydriver.cuTensorMapEncodeIm2colWide(tensorMap._pvt_ptr, cytensorDataType, cytensorRank, cyglobalAddress, cyglobalDim, cyglobalStrides, pixelBoxLowerCornerWidth, pixelBoxUpperCornerWidth, cychannelsPerPixel, cypixelsPerColumn, cyelementStrides, cyinterleave, cymode, cyswizzle, cyl2Promotion, cyoobFill) + _helper_input_void_ptr_free(&cyglobalAddressHelper) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, tensorMap) @cython.embedsignature(True) def cuTensorMapReplaceAddress(tensorMap : Optional[CUtensorMap], globalAddress): @@ -42984,16 +52577,15 @@ def cuTensorMapReplaceAddress(tensorMap : Optional[CUtensorMap], globalAddress): See Also -------- - :py:obj:`~.cuTensorMapEncodeTiled`, :py:obj:`~.cuTensorMapEncodeIm2col` + :py:obj:`~.cuTensorMapEncodeTiled`, :py:obj:`~.cuTensorMapEncodeIm2col`, :py:obj:`~.cuTensorMapEncodeIm2colWide` """ - cdef ccuda.CUtensorMap* ctensorMap_ptr = tensorMap._ptr if tensorMap != None else NULL - cglobalAddress = utils.HelperInputVoidPtr(globalAddress) - cdef void* cglobalAddress_ptr = cglobalAddress.cptr - err = ccuda.cuTensorMapReplaceAddress(ctensorMap_ptr, cglobalAddress_ptr) - return (CUresult(err),) -{{endif}} - -{{if 'cuDeviceCanAccessPeer' in found_functions}} + cdef cydriver.CUtensorMap* cytensorMap_ptr = tensorMap._pvt_ptr if tensorMap is not None else NULL + cdef _HelperInputVoidPtrStruct cyglobalAddressHelper + cdef void* cyglobalAddress = _helper_input_void_ptr(globalAddress, &cyglobalAddressHelper) + with nogil: + err = cydriver.cuTensorMapReplaceAddress(cytensorMap_ptr, cyglobalAddress) + _helper_input_void_ptr_free(&cyglobalAddressHelper) + return (_CUresult(err),) @cython.embedsignature(True) def cuDeviceCanAccessPeer(dev, peerDev): @@ -43025,30 +52617,28 @@ def cuDeviceCanAccessPeer(dev, peerDev): -------- :py:obj:`~.cuCtxEnablePeerAccess`, :py:obj:`~.cuCtxDisablePeerAccess`, :py:obj:`~.cudaDeviceCanAccessPeer` """ - cdef ccuda.CUdevice cpeerDev + cdef cydriver.CUdevice cypeerDev if peerDev is None: - cpeerDev = 0 + ppeerDev = 0 elif isinstance(peerDev, (CUdevice,)): ppeerDev = int(peerDev) - cpeerDev = ppeerDev else: ppeerDev = int(CUdevice(peerDev)) - cpeerDev = ppeerDev - cdef ccuda.CUdevice cdev + cypeerDev = ppeerDev + cdef cydriver.CUdevice cydev if dev is None: - cdev = 0 + pdev = 0 elif isinstance(dev, (CUdevice,)): pdev = int(dev) - cdev = pdev else: pdev = int(CUdevice(dev)) - cdev = pdev + cydev = pdev cdef int canAccessPeer = 0 - err = ccuda.cuDeviceCanAccessPeer(&canAccessPeer, cdev, cpeerDev) - return (CUresult(err), canAccessPeer) -{{endif}} - -{{if 'cuCtxEnablePeerAccess' in found_functions}} + with nogil: + err = cydriver.cuDeviceCanAccessPeer(&canAccessPeer, cydev, cypeerDev) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, canAccessPeer) @cython.embedsignature(True) def cuCtxEnablePeerAccess(peerContext, unsigned int Flags): @@ -43105,20 +52695,17 @@ def cuCtxEnablePeerAccess(peerContext, unsigned int Flags): -------- :py:obj:`~.cuDeviceCanAccessPeer`, :py:obj:`~.cuCtxDisablePeerAccess`, :py:obj:`~.cudaDeviceEnablePeerAccess` """ - cdef ccuda.CUcontext cpeerContext + cdef cydriver.CUcontext cypeerContext if peerContext is None: - cpeerContext = 0 + ppeerContext = 0 elif isinstance(peerContext, (CUcontext,)): ppeerContext = int(peerContext) - cpeerContext = ppeerContext else: ppeerContext = int(CUcontext(peerContext)) - cpeerContext = ppeerContext - err = ccuda.cuCtxEnablePeerAccess(cpeerContext, Flags) - return (CUresult(err),) -{{endif}} - -{{if 'cuCtxDisablePeerAccess' in found_functions}} + cypeerContext = ppeerContext + with nogil: + err = cydriver.cuCtxEnablePeerAccess(cypeerContext, Flags) + return (_CUresult(err),) @cython.embedsignature(True) def cuCtxDisablePeerAccess(peerContext): @@ -43145,20 +52732,17 @@ def cuCtxDisablePeerAccess(peerContext): -------- :py:obj:`~.cuDeviceCanAccessPeer`, :py:obj:`~.cuCtxEnablePeerAccess`, :py:obj:`~.cudaDeviceDisablePeerAccess` """ - cdef ccuda.CUcontext cpeerContext + cdef cydriver.CUcontext cypeerContext if peerContext is None: - cpeerContext = 0 + ppeerContext = 0 elif isinstance(peerContext, (CUcontext,)): ppeerContext = int(peerContext) - cpeerContext = ppeerContext else: ppeerContext = int(CUcontext(peerContext)) - cpeerContext = ppeerContext - err = ccuda.cuCtxDisablePeerAccess(cpeerContext) - return (CUresult(err),) -{{endif}} - -{{if 'cuDeviceGetP2PAttribute' in found_functions}} + cypeerContext = ppeerContext + with nogil: + err = cydriver.cuCtxDisablePeerAccess(cypeerContext) + return (_CUresult(err),) @cython.embedsignature(True) def cuDeviceGetP2PAttribute(attrib not None : CUdevice_P2PAttribute, srcDevice, dstDevice): @@ -43174,12 +52758,17 @@ def cuDeviceGetP2PAttribute(attrib not None : CUdevice_P2PAttribute, srcDevice, - :py:obj:`~.CU_DEVICE_P2P_ATTRIBUTE_ACCESS_SUPPORTED` P2P: 1 if P2P Access is enable. - - :py:obj:`~.CU_DEVICE_P2P_ATTRIBUTE_NATIVE_ATOMIC_SUPPORTED`: 1 if - Atomic operations over the link are supported. + - :py:obj:`~.CU_DEVICE_P2P_ATTRIBUTE_NATIVE_ATOMIC_SUPPORTED`: 1 if all + CUDA-valid atomic operations over the link are supported. - :py:obj:`~.CU_DEVICE_P2P_ATTRIBUTE_CUDA_ARRAY_ACCESS_SUPPORTED`: 1 if cudaArray can be accessed over the link. + - :py:obj:`~.CU_DEVICE_P2P_ATTRIBUTE_ONLY_PARTIAL_NATIVE_ATOMIC_SUPPORTED`: + 1 if some CUDA-valid atomic operations over the link are supported. + Information about specific operations can be retrieved with + :py:obj:`~.cuDeviceGetP2PAtomicCapabilities`. + Returns :py:obj:`~.CUDA_ERROR_INVALID_DEVICE` if `srcDevice` or `dstDevice` are not valid or if they represent the same device. @@ -43205,33 +52794,111 @@ def cuDeviceGetP2PAttribute(attrib not None : CUdevice_P2PAttribute, srcDevice, See Also -------- - :py:obj:`~.cuCtxEnablePeerAccess`, :py:obj:`~.cuCtxDisablePeerAccess`, :py:obj:`~.cuDeviceCanAccessPeer`, :py:obj:`~.cudaDeviceGetP2PAttribute` + :py:obj:`~.cuCtxEnablePeerAccess`, :py:obj:`~.cuCtxDisablePeerAccess`, :py:obj:`~.cuDeviceCanAccessPeer`, :py:obj:`~.cuDeviceGetP2PAtomicCapabilities`, :py:obj:`~.cudaDeviceGetP2PAttribute` """ - cdef ccuda.CUdevice cdstDevice + cdef cydriver.CUdevice cydstDevice if dstDevice is None: - cdstDevice = 0 + pdstDevice = 0 elif isinstance(dstDevice, (CUdevice,)): pdstDevice = int(dstDevice) - cdstDevice = pdstDevice else: pdstDevice = int(CUdevice(dstDevice)) - cdstDevice = pdstDevice - cdef ccuda.CUdevice csrcDevice + cydstDevice = pdstDevice + cdef cydriver.CUdevice cysrcDevice if srcDevice is None: - csrcDevice = 0 + psrcDevice = 0 elif isinstance(srcDevice, (CUdevice,)): psrcDevice = int(srcDevice) - csrcDevice = psrcDevice else: psrcDevice = int(CUdevice(srcDevice)) - csrcDevice = psrcDevice + cysrcDevice = psrcDevice cdef int value = 0 - cdef ccuda.CUdevice_P2PAttribute cattrib = attrib.value - err = ccuda.cuDeviceGetP2PAttribute(&value, cattrib, csrcDevice, cdstDevice) - return (CUresult(err), value) -{{endif}} + cdef cydriver.CUdevice_P2PAttribute cyattrib = int(attrib) + with nogil: + err = cydriver.cuDeviceGetP2PAttribute(&value, cyattrib, cysrcDevice, cydstDevice) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, value) + +@cython.embedsignature(True) +def cuDeviceGetP2PAtomicCapabilities(operations : Optional[tuple[CUatomicOperation] | list[CUatomicOperation]], unsigned int count, srcDevice, dstDevice): + """ Queries details about atomic operations supported between two devices. + + Returns in `*capabilities` the details about requested atomic + `*operations` over the the link between `srcDevice` and `dstDevice`. + The allocated size of `*operations` and `*capabilities` must be + `count`. + + For each :py:obj:`~.CUatomicOperation` in `*operations`, the + corresponding result in `*capabilities` will be a bitmask indicating + which of :py:obj:`~.CUatomicOperationCapability` the link supports + natively. + + Returns :py:obj:`~.CUDA_ERROR_INVALID_DEVICE` if `srcDevice` or + `dstDevice` are not valid or if they represent the same device. -{{if 'cuGraphicsUnregisterResource' in found_functions}} + Returns :py:obj:`~.CUDA_ERROR_INVALID_VALUE` if `*capabilities` or + `*operations` is NULL, if `count` is 0, or if any of `*operations` is + not valid. + + Parameters + ---------- + operations : list[:py:obj:`~.CUatomicOperation`] + Requested operations + count : unsigned int + Count of requested operations and size of capabilities + srcDevice : :py:obj:`~.CUdevice` + The source device of the target link + dstDevice : :py:obj:`~.CUdevice` + The destination device of the target link + + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_INVALID_DEVICE`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE` + capabilities : list[unsigned int] + Returned capability details of each requested operation + + See Also + -------- + :py:obj:`~.cuDeviceGetP2PAttribute`, :py:obj:`~.cudaDeviceGetP2PAttribute`, :py:obj:`~.cudaDeviceGetP2PAtomicCapabilities` + """ + cdef cydriver.CUdevice cydstDevice + if dstDevice is None: + pdstDevice = 0 + elif isinstance(dstDevice, (CUdevice,)): + pdstDevice = int(dstDevice) + else: + pdstDevice = int(CUdevice(dstDevice)) + cydstDevice = pdstDevice + cdef cydriver.CUdevice cysrcDevice + if srcDevice is None: + psrcDevice = 0 + elif isinstance(srcDevice, (CUdevice,)): + psrcDevice = int(srcDevice) + else: + psrcDevice = int(CUdevice(srcDevice)) + cysrcDevice = psrcDevice + operations = [] if operations is None else operations + if not all(isinstance(_x, (CUatomicOperation)) for _x in operations): + raise TypeError("Argument 'operations' is not instance of type (expected tuple[cydriver.CUatomicOperation] or list[cydriver.CUatomicOperation]") + cdef unsigned int* cycapabilities = NULL + pycapabilities = [] + if count != 0: + cycapabilities = calloc(count, sizeof(unsigned int)) + if cycapabilities is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(count) + 'x' + str(sizeof(unsigned int))) + cdef vector[cydriver.CUatomicOperation] cyoperations = operations + if count > len(operations): raise RuntimeError("List is too small: " + str(len(operations)) + " < " + str(count)) + with nogil: + err = cydriver.cuDeviceGetP2PAtomicCapabilities(cycapabilities, cyoperations.data(), count, cysrcDevice, cydstDevice) + if CUresult(err) == CUresult(0): + pycapabilities = [cycapabilities[idx] for idx in range(count)] + if cycapabilities is not NULL: + free(cycapabilities) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pycapabilities) @cython.embedsignature(True) def cuGraphicsUnregisterResource(resource): @@ -43257,20 +52924,17 @@ def cuGraphicsUnregisterResource(resource): -------- :py:obj:`~.cuGraphicsD3D9RegisterResource`, :py:obj:`~.cuGraphicsD3D10RegisterResource`, :py:obj:`~.cuGraphicsD3D11RegisterResource`, :py:obj:`~.cuGraphicsGLRegisterBuffer`, :py:obj:`~.cuGraphicsGLRegisterImage`, :py:obj:`~.cudaGraphicsUnregisterResource` """ - cdef ccuda.CUgraphicsResource cresource + cdef cydriver.CUgraphicsResource cyresource if resource is None: - cresource = 0 + presource = 0 elif isinstance(resource, (CUgraphicsResource,)): presource = int(resource) - cresource = presource else: presource = int(CUgraphicsResource(resource)) - cresource = presource - err = ccuda.cuGraphicsUnregisterResource(cresource) - return (CUresult(err),) -{{endif}} - -{{if 'cuGraphicsSubResourceGetMappedArray' in found_functions}} + cyresource = presource + with nogil: + err = cydriver.cuGraphicsUnregisterResource(cyresource) + return (_CUresult(err),) @cython.embedsignature(True) def cuGraphicsSubResourceGetMappedArray(resource, unsigned int arrayIndex, unsigned int mipLevel): @@ -43312,21 +52976,20 @@ def cuGraphicsSubResourceGetMappedArray(resource, unsigned int arrayIndex, unsig -------- :py:obj:`~.cuGraphicsResourceGetMappedPointer`, :py:obj:`~.cudaGraphicsSubResourceGetMappedArray` """ - cdef ccuda.CUgraphicsResource cresource + cdef cydriver.CUgraphicsResource cyresource if resource is None: - cresource = 0 + presource = 0 elif isinstance(resource, (CUgraphicsResource,)): presource = int(resource) - cresource = presource else: presource = int(CUgraphicsResource(resource)) - cresource = presource + cyresource = presource cdef CUarray pArray = CUarray() - err = ccuda.cuGraphicsSubResourceGetMappedArray(pArray._ptr, cresource, arrayIndex, mipLevel) - return (CUresult(err), pArray) -{{endif}} - -{{if 'cuGraphicsResourceGetMappedMipmappedArray' in found_functions}} + with nogil: + err = cydriver.cuGraphicsSubResourceGetMappedArray(pArray._pvt_ptr, cyresource, arrayIndex, mipLevel) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pArray) @cython.embedsignature(True) def cuGraphicsResourceGetMappedMipmappedArray(resource): @@ -43357,21 +53020,20 @@ def cuGraphicsResourceGetMappedMipmappedArray(resource): -------- :py:obj:`~.cuGraphicsResourceGetMappedPointer`, :py:obj:`~.cudaGraphicsResourceGetMappedMipmappedArray` """ - cdef ccuda.CUgraphicsResource cresource + cdef cydriver.CUgraphicsResource cyresource if resource is None: - cresource = 0 + presource = 0 elif isinstance(resource, (CUgraphicsResource,)): presource = int(resource) - cresource = presource else: presource = int(CUgraphicsResource(resource)) - cresource = presource + cyresource = presource cdef CUmipmappedArray pMipmappedArray = CUmipmappedArray() - err = ccuda.cuGraphicsResourceGetMappedMipmappedArray(pMipmappedArray._ptr, cresource) - return (CUresult(err), pMipmappedArray) -{{endif}} - -{{if 'cuGraphicsResourceGetMappedPointer_v2' in found_functions}} + with nogil: + err = cydriver.cuGraphicsResourceGetMappedMipmappedArray(pMipmappedArray._pvt_ptr, cyresource) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pMipmappedArray) @cython.embedsignature(True) def cuGraphicsResourceGetMappedPointer(resource): @@ -43401,22 +53063,21 @@ def cuGraphicsResourceGetMappedPointer(resource): pSize : int None """ - cdef ccuda.CUgraphicsResource cresource + cdef cydriver.CUgraphicsResource cyresource if resource is None: - cresource = 0 + presource = 0 elif isinstance(resource, (CUgraphicsResource,)): presource = int(resource) - cresource = presource else: presource = int(CUgraphicsResource(resource)) - cresource = presource + cyresource = presource cdef CUdeviceptr pDevPtr = CUdeviceptr() cdef size_t pSize = 0 - err = ccuda.cuGraphicsResourceGetMappedPointer(pDevPtr._ptr, &pSize, cresource) - return (CUresult(err), pDevPtr, pSize) -{{endif}} - -{{if 'cuGraphicsResourceSetMapFlags_v2' in found_functions}} + with nogil: + err = cydriver.cuGraphicsResourceGetMappedPointer(pDevPtr._pvt_ptr, &pSize, cyresource) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None, None) + return (_CUresult_SUCCESS, pDevPtr, pSize) @cython.embedsignature(True) def cuGraphicsResourceSetMapFlags(resource, unsigned int flags): @@ -43462,20 +53123,17 @@ def cuGraphicsResourceSetMapFlags(resource, unsigned int flags): -------- :py:obj:`~.cuGraphicsMapResources`, :py:obj:`~.cudaGraphicsResourceSetMapFlags` """ - cdef ccuda.CUgraphicsResource cresource + cdef cydriver.CUgraphicsResource cyresource if resource is None: - cresource = 0 + presource = 0 elif isinstance(resource, (CUgraphicsResource,)): presource = int(resource) - cresource = presource else: presource = int(CUgraphicsResource(resource)) - cresource = presource - err = ccuda.cuGraphicsResourceSetMapFlags(cresource, flags) - return (CUresult(err),) -{{endif}} - -{{if 'cuGraphicsMapResources' in found_functions}} + cyresource = presource + with nogil: + err = cydriver.cuGraphicsResourceSetMapFlags(cyresource, flags) + return (_CUresult(err),) @cython.embedsignature(True) def cuGraphicsMapResources(unsigned int count, resources, hStream): @@ -43515,30 +53173,27 @@ def cuGraphicsMapResources(unsigned int count, resources, hStream): -------- :py:obj:`~.cuGraphicsResourceGetMappedPointer`, :py:obj:`~.cuGraphicsSubResourceGetMappedArray`, :py:obj:`~.cuGraphicsUnmapResources`, :py:obj:`~.cudaGraphicsMapResources` """ - cdef ccuda.CUstream chStream + cdef cydriver.CUstream cyhStream if hStream is None: - chStream = 0 + phStream = 0 elif isinstance(hStream, (CUstream,)): phStream = int(hStream) - chStream = phStream else: phStream = int(CUstream(hStream)) - chStream = phStream - cdef ccuda.CUgraphicsResource *cresources + cyhStream = phStream + cdef cydriver.CUgraphicsResource *cyresources if resources is None: - cresources = NULL + cyresources = NULL elif isinstance(resources, (CUgraphicsResource,)): presources = resources.getPtr() - cresources = presources + cyresources = presources elif isinstance(resources, (int)): - cresources = resources + cyresources = resources else: - raise TypeError("Argument 'resources' is not instance of type (expected , found " + str(type(resources))) - err = ccuda.cuGraphicsMapResources(count, cresources, chStream) - return (CUresult(err),) -{{endif}} - -{{if 'cuGraphicsUnmapResources' in found_functions}} + raise TypeError("Argument 'resources' is not instance of type (expected , found " + str(type(resources))) + with nogil: + err = cydriver.cuGraphicsMapResources(count, cyresources, cyhStream) + return (_CUresult(err),) @cython.embedsignature(True) def cuGraphicsUnmapResources(unsigned int count, resources, hStream): @@ -43576,30 +53231,27 @@ def cuGraphicsUnmapResources(unsigned int count, resources, hStream): -------- :py:obj:`~.cuGraphicsMapResources`, :py:obj:`~.cudaGraphicsUnmapResources` """ - cdef ccuda.CUstream chStream + cdef cydriver.CUstream cyhStream if hStream is None: - chStream = 0 + phStream = 0 elif isinstance(hStream, (CUstream,)): phStream = int(hStream) - chStream = phStream else: phStream = int(CUstream(hStream)) - chStream = phStream - cdef ccuda.CUgraphicsResource *cresources + cyhStream = phStream + cdef cydriver.CUgraphicsResource *cyresources if resources is None: - cresources = NULL + cyresources = NULL elif isinstance(resources, (CUgraphicsResource,)): presources = resources.getPtr() - cresources = presources + cyresources = presources elif isinstance(resources, (int)): - cresources = resources + cyresources = resources else: - raise TypeError("Argument 'resources' is not instance of type (expected , found " + str(type(resources))) - err = ccuda.cuGraphicsUnmapResources(count, cresources, chStream) - return (CUresult(err),) -{{endif}} - -{{if 'cuGetProcAddress_v2' in found_functions}} + raise TypeError("Argument 'resources' is not instance of type (expected , found " + str(type(resources))) + with nogil: + err = cydriver.cuGraphicsUnmapResources(count, cyresources, cyhStream) + return (_CUresult(err),) @cython.embedsignature(True) def cuGetProcAddress(char* symbol, int cudaVersion, flags): @@ -43612,7 +53264,9 @@ def cuGetProcAddress(char* symbol, int cudaVersion, flags): 11.2 should be specified as 11020. For a requested driver symbol, if the specified CUDA version is greater than or equal to the CUDA version in which the driver symbol was introduced, this API will return the - function pointer to the corresponding versioned function. + function pointer to the corresponding versioned function. If the + specified CUDA version is greater than the driver version, the API will + return :py:obj:`~.CUDA_ERROR_INVALID_VALUE`. The pointer returned by the API should be cast to a function pointer matching the requested driver function's definition in the API header @@ -43684,24 +53338,23 @@ def cuGetProcAddress(char* symbol, int cudaVersion, flags): See Also -------- - :py:obj:`~.cudaGetDriverEntryPoint` + :py:obj:`~.cudaGetDriverEntryPointByVersion` """ - cdef ccuda.cuuint64_t cflags + cdef cydriver.cuuint64_t cyflags if flags is None: - cflags = 0 + pflags = 0 elif isinstance(flags, (cuuint64_t,)): pflags = int(flags) - cflags = pflags else: pflags = int(cuuint64_t(flags)) - cflags = pflags + cyflags = pflags cdef void_ptr pfn = 0 - cdef ccuda.CUdriverProcAddressQueryResult symbolStatus - err = ccuda.cuGetProcAddress(symbol, &pfn, cudaVersion, cflags, &symbolStatus) - return (CUresult(err), pfn, CUdriverProcAddressQueryResult(symbolStatus)) -{{endif}} - -{{if 'cuCoredumpGetAttribute' in found_functions}} + cdef cydriver.CUdriverProcAddressQueryResult symbolStatus + with nogil: + err = cydriver.cuGetProcAddress(symbol, &pfn, cudaVersion, cyflags, &symbolStatus) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None, None) + return (_CUresult_SUCCESS, pfn, CUdriverProcAddressQueryResult(symbolStatus)) @cython.embedsignature(True) def cuCoredumpGetAttribute(attrib not None : CUcoredumpSettings): @@ -43790,6 +53443,28 @@ def cuCoredumpGetAttribute(attrib not None : CUcoredumpSettings): as :py:obj:`~.CU_COREDUMP_TRIGGER_HOST` but better reflects the default behavior. + - :py:obj:`~.CU_COREDUMP_SKIP_CONSTBANK_MEMORY` - Coredump will not + include constbank memory. + + - :py:obj:`~.CU_COREDUMP_GZIP_COMPRESS` - The generated coredump will + be compressed with gzip, and .gz suffix will be appended to the + filename, if it's not a part of it already. + + - :py:obj:`~.CU_COREDUMP_FAULTED_CONTEXTS_ONLY` - The coredump will + only include contexts that have encountered an exception or a trap. + + - :py:obj:`~.CU_COREDUMP_NO_ERRBAR_AT_EXIT` - By default, when + coredumps are requested, the GPU will ensure memory faults and + other errors prevent warps from exiting, if possible. This can + potentially affect the performance of the application. Setting this + flag will disable this functionality, making it possible for + faulted warps to exit, but also avoiding the potential performance + hit. + + - :py:obj:`~.CU_COREDUMP_LOG_ONLY` - Setting this flag will disable + actual generation of the coredump file, but exception details will + still be logged. + Parameters ---------- attrib : :py:obj:`~.CUcoredumpSettings` @@ -43810,15 +53485,15 @@ def cuCoredumpGetAttribute(attrib not None : CUcoredumpSettings): -------- :py:obj:`~.cuCoredumpGetAttributeGlobal`, :py:obj:`~.cuCoredumpSetAttribute`, :py:obj:`~.cuCoredumpSetAttributeGlobal` """ - cdef ccuda.CUcoredumpSettings cattrib = attrib.value - cdef utils.HelperCUcoredumpSettings cvalue = utils.HelperCUcoredumpSettings(attrib, 0, is_getter=True) - cdef void* cvalue_ptr = cvalue.cptr - cdef size_t size = cvalue.size() - err = ccuda.cuCoredumpGetAttribute(cattrib, cvalue_ptr, &size) - return (CUresult(err), cvalue.pyObj()) -{{endif}} - -{{if 'cuCoredumpGetAttributeGlobal' in found_functions}} + cdef cydriver.CUcoredumpSettings cyattrib = int(attrib) + cdef _HelperCUcoredumpSettings cyvalue = _HelperCUcoredumpSettings(attrib, 0, is_getter=True) + cdef void* cyvalue_ptr = cyvalue.cptr + cdef size_t size = cyvalue.size() + with nogil: + err = cydriver.cuCoredumpGetAttribute(cyattrib, cyvalue_ptr, &size) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, cyvalue.pyObj()) @cython.embedsignature(True) def cuCoredumpGetAttributeGlobal(attrib not None : CUcoredumpSettings): @@ -43903,6 +53578,28 @@ def cuCoredumpGetAttributeGlobal(attrib not None : CUcoredumpSettings): as :py:obj:`~.CU_COREDUMP_TRIGGER_HOST` but better reflects the default behavior. + - :py:obj:`~.CU_COREDUMP_SKIP_CONSTBANK_MEMORY` - Coredump will not + include constbank memory. + + - :py:obj:`~.CU_COREDUMP_GZIP_COMPRESS` - The generated coredump will + be compressed with gzip, and .gz suffix will be appended to the + filename, if it's not a part of it already. + + - :py:obj:`~.CU_COREDUMP_FAULTED_CONTEXTS_ONLY` - The coredump will + only include contexts that have encountered an exception or a trap. + + - :py:obj:`~.CU_COREDUMP_NO_ERRBAR_AT_EXIT` - By default, when + coredumps are requested, the GPU will ensure memory faults and + other errors prevent warps from exiting, if possible. This can + potentially affect the performance of the application. Setting this + flag will disable this functionality, making it possible for + faulted warps to exit, but also avoiding the potential performance + hit. + + - :py:obj:`~.CU_COREDUMP_LOG_ONLY` - Setting this flag will disable + actual generation of the coredump file, but exception details will + still be logged. + Parameters ---------- attrib : :py:obj:`~.CUcoredumpSettings` @@ -43923,15 +53620,15 @@ def cuCoredumpGetAttributeGlobal(attrib not None : CUcoredumpSettings): -------- :py:obj:`~.cuCoredumpGetAttribute`, :py:obj:`~.cuCoredumpSetAttribute`, :py:obj:`~.cuCoredumpSetAttributeGlobal` """ - cdef ccuda.CUcoredumpSettings cattrib = attrib.value - cdef utils.HelperCUcoredumpSettings cvalue = utils.HelperCUcoredumpSettings(attrib, 0, is_getter=True) - cdef void* cvalue_ptr = cvalue.cptr - cdef size_t size = cvalue.size() - err = ccuda.cuCoredumpGetAttributeGlobal(cattrib, cvalue_ptr, &size) - return (CUresult(err), cvalue.pyObj()) -{{endif}} - -{{if 'cuCoredumpSetAttribute' in found_functions}} + cdef cydriver.CUcoredumpSettings cyattrib = int(attrib) + cdef _HelperCUcoredumpSettings cyvalue = _HelperCUcoredumpSettings(attrib, 0, is_getter=True) + cdef void* cyvalue_ptr = cyvalue.cptr + cdef size_t size = cyvalue.size() + with nogil: + err = cydriver.cuCoredumpGetAttributeGlobal(cyattrib, cyvalue_ptr, &size) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, cyvalue.pyObj()) @cython.embedsignature(True) def cuCoredumpSetAttribute(attrib not None : CUcoredumpSettings, value): @@ -44023,6 +53720,28 @@ def cuCoredumpSetAttribute(attrib not None : CUcoredumpSettings, value): as :py:obj:`~.CU_COREDUMP_TRIGGER_HOST` but better reflects the default behavior. + - :py:obj:`~.CU_COREDUMP_SKIP_CONSTBANK_MEMORY` - Coredump will not + include constbank memory. + + - :py:obj:`~.CU_COREDUMP_GZIP_COMPRESS` - The generated coredump will + be compressed with gzip, and .gz suffix will be appended to the + filename, if it's not a part of it already. + + - :py:obj:`~.CU_COREDUMP_FAULTED_CONTEXTS_ONLY` - The coredump will + only include contexts that have encountered an exception or a trap. + + - :py:obj:`~.CU_COREDUMP_NO_ERRBAR_AT_EXIT` - By default, when + coredumps are requested, the GPU will ensure memory faults and + other errors prevent warps from exiting, if possible. This can + potentially affect the performance of the application. Setting this + flag will disable this functionality, making it possible for + faulted warps to exit, but also avoiding the potential performance + hit. + + - :py:obj:`~.CU_COREDUMP_LOG_ONLY` - Setting this flag will disable + actual generation of the coredump file, but exception details will + still be logged. + Parameters ---------- attrib : :py:obj:`~.CUcoredumpSettings` @@ -44042,16 +53761,18 @@ def cuCoredumpSetAttribute(attrib not None : CUcoredumpSettings, value): See Also -------- :py:obj:`~.cuCoredumpGetAttributeGlobal`, :py:obj:`~.cuCoredumpGetAttribute`, :py:obj:`~.cuCoredumpSetAttributeGlobal` - """ - cdef ccuda.CUcoredumpSettings cattrib = attrib.value - cdef utils.HelperCUcoredumpSettings cvalue = utils.HelperCUcoredumpSettings(attrib, value, is_getter=False) - cdef void* cvalue_ptr = cvalue.cptr - cdef size_t size = cvalue.size() - err = ccuda.cuCoredumpSetAttribute(cattrib, cvalue_ptr, &size) - return (CUresult(err),) -{{endif}} -{{if 'cuCoredumpSetAttributeGlobal' in found_functions}} + Notes + ----- + :py:obj:`~.CU_COREDUMP_GENERATION_FLAGS` replaces all previously set coredump flags. Mixing :py:obj:`~.CU_COREDUMP_GENERATION_FLAGS` with the deprecated boolean attributes (:py:obj:`~.CU_COREDUMP_TRIGGER_HOST`, :py:obj:`~.CU_COREDUMP_LIGHTWEIGHT`) can result in undefined behavior. To avoid issues, either use only :py:obj:`~.CU_COREDUMP_GENERATION_FLAGS` or combine all desired flag bits (including :py:obj:`~.CU_COREDUMP_SKIP_ABORT`) in a single call. + """ + cdef cydriver.CUcoredumpSettings cyattrib = int(attrib) + cdef _HelperCUcoredumpSettings cyvalue = _HelperCUcoredumpSettings(attrib, value, is_getter=False) + cdef void* cyvalue_ptr = cyvalue.cptr + cdef size_t size = cyvalue.size() + with nogil: + err = cydriver.cuCoredumpSetAttribute(cyattrib, cyvalue_ptr, &size) + return (_CUresult(err),) @cython.embedsignature(True) def cuCoredumpSetAttributeGlobal(attrib not None : CUcoredumpSettings, value): @@ -44148,6 +53869,28 @@ def cuCoredumpSetAttributeGlobal(attrib not None : CUcoredumpSettings, value): as :py:obj:`~.CU_COREDUMP_TRIGGER_HOST` but better reflects the default behavior. + - :py:obj:`~.CU_COREDUMP_SKIP_CONSTBANK_MEMORY` - Coredump will not + include constbank memory. + + - :py:obj:`~.CU_COREDUMP_GZIP_COMPRESS` - The generated coredump will + be compressed with gzip, and .gz suffix will be appended to the + filename, if it's not a part of it already. + + - :py:obj:`~.CU_COREDUMP_FAULTED_CONTEXTS_ONLY` - The coredump will + only include contexts that have encountered an exception or a trap. + + - :py:obj:`~.CU_COREDUMP_NO_ERRBAR_AT_EXIT` - By default, when + coredumps are requested, the GPU will ensure memory faults and + other errors prevent warps from exiting, if possible. This can + potentially affect the performance of the application. Setting this + flag will disable this functionality, making it possible for + faulted warps to exit, but also avoiding the potential performance + hit. + + - :py:obj:`~.CU_COREDUMP_LOG_ONLY` - Setting this flag will disable + actual generation of the coredump file, but exception details will + still be logged. + Parameters ---------- attrib : :py:obj:`~.CUcoredumpSettings` @@ -44167,20 +53910,198 @@ def cuCoredumpSetAttributeGlobal(attrib not None : CUcoredumpSettings, value): See Also -------- :py:obj:`~.cuCoredumpGetAttribute`, :py:obj:`~.cuCoredumpGetAttributeGlobal`, :py:obj:`~.cuCoredumpSetAttribute` + + Notes + ----- + :py:obj:`~.CU_COREDUMP_GENERATION_FLAGS` replaces all previously set coredump flags. Mixing :py:obj:`~.CU_COREDUMP_GENERATION_FLAGS` with the deprecated boolean attributes (:py:obj:`~.CU_COREDUMP_TRIGGER_HOST`, :py:obj:`~.CU_COREDUMP_LIGHTWEIGHT`) can result in undefined behavior. To avoid issues, either use only :py:obj:`~.CU_COREDUMP_GENERATION_FLAGS` or combine all desired flag bits (including :py:obj:`~.CU_COREDUMP_SKIP_ABORT`) in a single call. + """ + cdef cydriver.CUcoredumpSettings cyattrib = int(attrib) + cdef _HelperCUcoredumpSettings cyvalue = _HelperCUcoredumpSettings(attrib, value, is_getter=False) + cdef void* cyvalue_ptr = cyvalue.cptr + cdef size_t size = cyvalue.size() + with nogil: + err = cydriver.cuCoredumpSetAttributeGlobal(cyattrib, cyvalue_ptr, &size) + return (_CUresult(err),) + +@cython.embedsignature(True) +def cuCoredumpRegisterStartCallback(callback, userData): + """ Register a callback to be invoked when a GPU coredump begins. + + This function registers a callback that will be called when a GPU + coredump is initiated, before any coredump data is collected. Callbacks + are executed in the order they were registered. The same callback + function can be registered multiple times with different userData, and + each registration will receive a unique handle. + + Parameters + ---------- + callback : :py:obj:`~.CUcoredumpStatusCallback` + The callback function to register + userData : Any + User data pointer to pass to the callback + + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_OUT_OF_MEMORY` + callbackOut : :py:obj:`~.CUcoredumpCallbackHandle` + Location to store the callback handle (optional, may be NULL) + + See Also + -------- + :py:obj:`~.cuCoredumpDeregisterStartCallback`, :py:obj:`~.cuCoredumpRegisterCompleteCallback` + + Notes + ----- + Callbacks execute synchronously during the coredump process and will block coredump progress while running. + """ + cdef cydriver.CUcoredumpStatusCallback cycallback + if callback is None: + pcallback = 0 + elif isinstance(callback, (CUcoredumpStatusCallback,)): + pcallback = int(callback) + else: + pcallback = int(CUcoredumpStatusCallback(callback)) + cycallback = pcallback + cdef _HelperInputVoidPtrStruct cyuserDataHelper + cdef void* cyuserData = _helper_input_void_ptr(userData, &cyuserDataHelper) + cdef CUcoredumpCallbackHandle callbackOut = CUcoredumpCallbackHandle() + with nogil: + err = cydriver.cuCoredumpRegisterStartCallback(cycallback, cyuserData, callbackOut._pvt_ptr) + _helper_input_void_ptr_free(&cyuserDataHelper) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, callbackOut) + +@cython.embedsignature(True) +def cuCoredumpRegisterCompleteCallback(callback, userData): + """ Register a callback to be invoked when a GPU coredump completes. + + This function registers a callback that will be called when a GPU + coredump has been fully collected and written to disk. Callbacks are + executed in the order they were registered. The same callback function + can be registered multiple times with different userData, and each + registration will receive a unique handle. + + Parameters + ---------- + callback : :py:obj:`~.CUcoredumpStatusCallback` + The callback function to register + userData : Any + User data pointer to pass to the callback + + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_OUT_OF_MEMORY` + callbackOut : :py:obj:`~.CUcoredumpCallbackHandle` + Location to store the callback handle (optional, may be NULL) + + See Also + -------- + :py:obj:`~.cuCoredumpDeregisterCompleteCallback`, :py:obj:`~.cuCoredumpRegisterStartCallback` + + Notes + ----- + Callbacks execute synchronously during the coredump process and will block coredump progress while running. + """ + cdef cydriver.CUcoredumpStatusCallback cycallback + if callback is None: + pcallback = 0 + elif isinstance(callback, (CUcoredumpStatusCallback,)): + pcallback = int(callback) + else: + pcallback = int(CUcoredumpStatusCallback(callback)) + cycallback = pcallback + cdef _HelperInputVoidPtrStruct cyuserDataHelper + cdef void* cyuserData = _helper_input_void_ptr(userData, &cyuserDataHelper) + cdef CUcoredumpCallbackHandle callbackOut = CUcoredumpCallbackHandle() + with nogil: + err = cydriver.cuCoredumpRegisterCompleteCallback(cycallback, cyuserData, callbackOut._pvt_ptr) + _helper_input_void_ptr_free(&cyuserDataHelper) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, callbackOut) + +@cython.embedsignature(True) +def cuCoredumpDeregisterStartCallback(callback): + """ Deregister a previously registered coredump start callback. + + This function removes a callback that was registered with + :py:obj:`~.cuCoredumpRegisterStartCallback`. The callback handle + becomes invalid after this call. + + Parameters + ---------- + callback : :py:obj:`~.CUcoredumpCallbackHandle` + The callback handle to deregister + + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE` + + See Also + -------- + :py:obj:`~.cuCoredumpRegisterStartCallback` + + Notes + ----- + It is the caller's responsibility to deregister callbacks before they go out of scope. """ - cdef ccuda.CUcoredumpSettings cattrib = attrib.value - cdef utils.HelperCUcoredumpSettings cvalue = utils.HelperCUcoredumpSettings(attrib, value, is_getter=False) - cdef void* cvalue_ptr = cvalue.cptr - cdef size_t size = cvalue.size() - err = ccuda.cuCoredumpSetAttributeGlobal(cattrib, cvalue_ptr, &size) - return (CUresult(err),) -{{endif}} + cdef cydriver.CUcoredumpCallbackHandle cycallback + if callback is None: + pcallback = 0 + elif isinstance(callback, (CUcoredumpCallbackHandle,)): + pcallback = int(callback) + else: + pcallback = int(CUcoredumpCallbackHandle(callback)) + cycallback = pcallback + with nogil: + err = cydriver.cuCoredumpDeregisterStartCallback(cycallback) + return (_CUresult(err),) + +@cython.embedsignature(True) +def cuCoredumpDeregisterCompleteCallback(callback): + """ Deregister a previously registered coredump complete callback. -{{if 'cuGetExportTable' in found_functions}} + This function removes a callback that was registered with + :py:obj:`~.cuCoredumpRegisterCompleteCallback`. The callback handle + becomes invalid after this call. + + Parameters + ---------- + callback : :py:obj:`~.CUcoredumpCallbackHandle` + The callback handle to deregister + + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE` + + See Also + -------- + :py:obj:`~.cuCoredumpRegisterCompleteCallback` + + Notes + ----- + It is the caller's responsibility to deregister callbacks before they go out of scope. + """ + cdef cydriver.CUcoredumpCallbackHandle cycallback + if callback is None: + pcallback = 0 + elif isinstance(callback, (CUcoredumpCallbackHandle,)): + pcallback = int(callback) + else: + pcallback = int(CUcoredumpCallbackHandle(callback)) + cycallback = pcallback + with nogil: + err = cydriver.cuCoredumpDeregisterCompleteCallback(cycallback) + return (_CUresult(err),) @cython.embedsignature(True) def cuGetExportTable(pExportTableId : Optional[CUuuid]): - """ + """ Parameters ---------- @@ -44195,12 +54116,12 @@ def cuGetExportTable(pExportTableId : Optional[CUuuid]): None """ cdef void_ptr ppExportTable = 0 - cdef ccuda.CUuuid* cpExportTableId_ptr = pExportTableId._ptr if pExportTableId != None else NULL - err = ccuda.cuGetExportTable(&ppExportTable, cpExportTableId_ptr) - return (CUresult(err), ppExportTable) -{{endif}} - -{{if 'cuGreenCtxCreate' in found_functions}} + cdef cydriver.CUuuid* cypExportTableId_ptr = pExportTableId._pvt_ptr if pExportTableId is not None else NULL + with nogil: + err = cydriver.cuGetExportTable(&ppExportTable, cypExportTableId_ptr) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, ppExportTable) @cython.embedsignature(True) def cuGreenCtxCreate(desc, dev, unsigned int flags): @@ -44216,19 +54137,21 @@ def cuGreenCtxCreate(desc, dev, unsigned int flags): The API does not set the green context current. In order to set it current, you need to explicitly set it current by first converting the - green context to a CUcontext using :py:obj:`~.cuCtxFromGreenCtx` and - subsequently calling :py:obj:`~.cuCtxSetCurrent` / - :py:obj:`~.cuCtxPushCurrent`. It should be noted that a green context - can be current to only one thread at a time. There is no internal - synchronization to make API calls accessing the same green context from - multiple threads work. + green context to a :py:obj:`~.CUcontext` using + :py:obj:`~.cuCtxFromGreenCtx` and subsequently calling + :py:obj:`~.cuCtxSetCurrent` / :py:obj:`~.cuCtxPushCurrent`. It should + be noted that a green context can be current to only one thread at a + time. There is no internal synchronization to make API calls accessing + the same green context from multiple threads work. Note: The API is not supported on 32-bit platforms. The supported flags are: + - `CU_GREEN_CTX_NONE` : Default behavior. + - `CU_GREEN_CTX_DEFAULT_STREAM` : Creates a default stream to use - inside the green context. Required. + inside the green context. Parameters ---------- @@ -44239,7 +54162,6 @@ def cuGreenCtxCreate(desc, dev, unsigned int flags): Device on which to create the green context. flags : unsigned int One of the supported green context creation flags. - `CU_GREEN_CTX_DEFAULT_STREAM` is required. Returns ------- @@ -44250,32 +54172,30 @@ def cuGreenCtxCreate(desc, dev, unsigned int flags): See Also -------- - :py:obj:`~.cuGreenCtxDestroy`, :py:obj:`~.cuCtxFromGreenCtx`, :py:obj:`~.cuCtxSetCurrent`, :py:obj:`~.cuCtxPushCurrent`, :py:obj:`~.cuDevResourceGenerateDesc`, :py:obj:`~.cuDevicePrimaryCtxRetain`, :py:obj:`~.cuCtxCreate`, :py:obj:`~.cuCtxCreate_v3` + :py:obj:`~.cuGreenCtxDestroy`, :py:obj:`~.cuCtxFromGreenCtx`, :py:obj:`~.cuCtxSetCurrent`, :py:obj:`~.cuCtxPushCurrent`, :py:obj:`~.cuDevResourceGenerateDesc`, :py:obj:`~.cuDevicePrimaryCtxRetain`, :py:obj:`~.cuCtxCreate` """ - cdef ccuda.CUdevice cdev + cdef cydriver.CUdevice cydev if dev is None: - cdev = 0 + pdev = 0 elif isinstance(dev, (CUdevice,)): pdev = int(dev) - cdev = pdev else: pdev = int(CUdevice(dev)) - cdev = pdev - cdef ccuda.CUdevResourceDesc cdesc + cydev = pdev + cdef cydriver.CUdevResourceDesc cydesc if desc is None: - cdesc = 0 + pdesc = 0 elif isinstance(desc, (CUdevResourceDesc,)): pdesc = int(desc) - cdesc = pdesc else: pdesc = int(CUdevResourceDesc(desc)) - cdesc = pdesc + cydesc = pdesc cdef CUgreenCtx phCtx = CUgreenCtx() - err = ccuda.cuGreenCtxCreate(phCtx._ptr, cdesc, cdev, flags) - return (CUresult(err), phCtx) -{{endif}} - -{{if 'cuGreenCtxDestroy' in found_functions}} + with nogil: + err = cydriver.cuGreenCtxCreate(phCtx._pvt_ptr, cydesc, cydev, flags) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, phCtx) @cython.embedsignature(True) def cuGreenCtxDestroy(hCtx): @@ -44284,7 +54204,19 @@ def cuGreenCtxDestroy(hCtx): Destroys the green context, releasing the primary context of the device that this green context was created for. Any resources provisioned for this green context (that were initially available via the resource - descriptor) are released as well. + descriptor) are released as well. The API does not destroy streams + created via :py:obj:`~.cuGreenCtxStreamCreate`, + :py:obj:`~.cuStreamCreate`, or :py:obj:`~.cuStreamCreateWithPriority`. + Users are expected to destroy these streams explicitly using + :py:obj:`~.cuStreamDestroy` to avoid resource leaks. Once the green + context is destroyed, any subsequent API calls involving these streams + will return :py:obj:`~.CUDA_ERROR_STREAM_DETACHED` with the exception + of the following APIs: + + - :py:obj:`~.cuStreamDestroy`. + + Additionally, the API will invalidate all active captures on these + streams. Parameters ---------- @@ -44300,35 +54232,51 @@ def cuGreenCtxDestroy(hCtx): -------- :py:obj:`~.cuGreenCtxCreate`, :py:obj:`~.cuCtxDestroy` """ - cdef ccuda.CUgreenCtx chCtx + cdef cydriver.CUgreenCtx cyhCtx if hCtx is None: - chCtx = 0 + phCtx = 0 elif isinstance(hCtx, (CUgreenCtx,)): phCtx = int(hCtx) - chCtx = phCtx else: phCtx = int(CUgreenCtx(hCtx)) - chCtx = phCtx - err = ccuda.cuGreenCtxDestroy(chCtx) - return (CUresult(err),) -{{endif}} - -{{if 'cuCtxFromGreenCtx' in found_functions}} + cyhCtx = phCtx + with nogil: + err = cydriver.cuGreenCtxDestroy(cyhCtx) + return (_CUresult(err),) @cython.embedsignature(True) def cuCtxFromGreenCtx(hCtx): - """ Converts a green context into the primary context. + """ Returns a :py:obj:`~.CUcontext` handle for a green context. + + This API returns in `pContext` a :py:obj:`~.CUcontext` handle that + represents the specified green context `hCtx`. The returned handle can + be passed to CUDA APIs that accept a :py:obj:`~.CUcontext` and will be + treated as if it were a primary context, while still honoring the + resources and configuration associated with `hCtx` as applicable. + + Applications that wish to use a green context with CUDA APIs that + require a :py:obj:`~.CUcontext` must use this API to obtain a handle to + a :py:obj:`~.CUcontext` representing the green context. Otherwise, + passing a green context to such APIs will fail with + :py:obj:`~.CUDA_ERROR_INVALID_CONTEXT`. - The API converts a green context into the primary context returned in - `pContext`. It is important to note that the converted context - `pContext` is a normal primary context but with the resources of the - specified green context `hCtx`. Once converted, it can then be used to - set the context current with :py:obj:`~.cuCtxSetCurrent` or with any of - the CUDA APIs that accept a CUcontext parameter. + The :py:obj:`~.CUcontext` returned by :py:obj:`~.cuCtxFromGreenCtx` may + be passed to CUDA Driver APIs that accept a :py:obj:`~.CUcontext`. - Users are expected to call this API before calling any CUDA APIs that - accept a CUcontext. Failing to do so will result in the APIs returning - :py:obj:`~.CUDA_ERROR_INVALID_CONTEXT`. + - For APIs whose semantics are independent of green context resources, + the operation is performed identically to how it would perform with a + primary context. + + - For APIs whose behavior depends on green context resources (for + example, kernel launch), the operation is performed using the + resources and configuration of the specified green context `hCtx`. + + This call does not create a new independent context and does not change + the underlying context lifetime. The validity of the returned + `pContext` is tied to `hCtx`, and no additional destruction or release + is required beyond correctly managing `hCtx` with the green context + APIs. Destroying `pContext` via :py:obj:`~.cuCtxDestroy` is undefined + behavior. Parameters ---------- @@ -44340,27 +54288,26 @@ def cuCtxFromGreenCtx(hCtx): CUresult :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_CONTEXT`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE` pContext : :py:obj:`~.CUcontext` - Returned primary context with green context resources + Returned :py:obj:`~.CUcontext` with green context resources See Also -------- :py:obj:`~.cuGreenCtxCreate` """ - cdef ccuda.CUgreenCtx chCtx + cdef cydriver.CUgreenCtx cyhCtx if hCtx is None: - chCtx = 0 + phCtx = 0 elif isinstance(hCtx, (CUgreenCtx,)): phCtx = int(hCtx) - chCtx = phCtx else: phCtx = int(CUgreenCtx(hCtx)) - chCtx = phCtx + cyhCtx = phCtx cdef CUcontext pContext = CUcontext() - err = ccuda.cuCtxFromGreenCtx(pContext._ptr, chCtx) - return (CUresult(err), pContext) -{{endif}} - -{{if 'cuDeviceGetDevResource' in found_functions}} + with nogil: + err = cydriver.cuCtxFromGreenCtx(pContext._pvt_ptr, cyhCtx) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pContext) @cython.embedsignature(True) def cuDeviceGetDevResource(device, typename not None : CUdevResourceType): @@ -44390,22 +54337,21 @@ def cuDeviceGetDevResource(device, typename not None : CUdevResourceType): -------- :py:obj:`~.cuDevResourceGenerateDesc` """ - cdef ccuda.CUdevice cdevice + cdef cydriver.CUdevice cydevice if device is None: - cdevice = 0 + pdevice = 0 elif isinstance(device, (CUdevice,)): pdevice = int(device) - cdevice = pdevice else: pdevice = int(CUdevice(device)) - cdevice = pdevice + cydevice = pdevice cdef CUdevResource resource = CUdevResource() - cdef ccuda.CUdevResourceType ctypename = typename.value - err = ccuda.cuDeviceGetDevResource(cdevice, resource._ptr, ctypename) - return (CUresult(err), resource) -{{endif}} - -{{if 'cuCtxGetDevResource' in found_functions}} + cdef cydriver.CUdevResourceType cytypename = int(typename) + with nogil: + err = cydriver.cuDeviceGetDevResource(cydevice, resource._pvt_ptr, cytypename) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, resource) @cython.embedsignature(True) def cuCtxGetDevResource(hCtx, typename not None : CUdevResourceType): @@ -44432,22 +54378,21 @@ def cuCtxGetDevResource(hCtx, typename not None : CUdevResourceType): -------- :py:obj:`~.cuDevResourceGenerateDesc` """ - cdef ccuda.CUcontext chCtx + cdef cydriver.CUcontext cyhCtx if hCtx is None: - chCtx = 0 + phCtx = 0 elif isinstance(hCtx, (CUcontext,)): phCtx = int(hCtx) - chCtx = phCtx else: phCtx = int(CUcontext(hCtx)) - chCtx = phCtx + cyhCtx = phCtx cdef CUdevResource resource = CUdevResource() - cdef ccuda.CUdevResourceType ctypename = typename.value - err = ccuda.cuCtxGetDevResource(chCtx, resource._ptr, ctypename) - return (CUresult(err), resource) -{{endif}} - -{{if 'cuGreenCtxGetDevResource' in found_functions}} + cdef cydriver.CUdevResourceType cytypename = int(typename) + with nogil: + err = cydriver.cuCtxGetDevResource(cyhCtx, resource._pvt_ptr, cytypename) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, resource) @cython.embedsignature(True) def cuGreenCtxGetDevResource(hCtx, typename not None : CUdevResourceType): @@ -44474,30 +54419,29 @@ def cuGreenCtxGetDevResource(hCtx, typename not None : CUdevResourceType): -------- :py:obj:`~.cuDevResourceGenerateDesc` """ - cdef ccuda.CUgreenCtx chCtx + cdef cydriver.CUgreenCtx cyhCtx if hCtx is None: - chCtx = 0 + phCtx = 0 elif isinstance(hCtx, (CUgreenCtx,)): phCtx = int(hCtx) - chCtx = phCtx else: phCtx = int(CUgreenCtx(hCtx)) - chCtx = phCtx + cyhCtx = phCtx cdef CUdevResource resource = CUdevResource() - cdef ccuda.CUdevResourceType ctypename = typename.value - err = ccuda.cuGreenCtxGetDevResource(chCtx, resource._ptr, ctypename) - return (CUresult(err), resource) -{{endif}} - -{{if 'cuDevSmResourceSplitByCount' in found_functions}} + cdef cydriver.CUdevResourceType cytypename = int(typename) + with nogil: + err = cydriver.cuGreenCtxGetDevResource(cyhCtx, resource._pvt_ptr, cytypename) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, resource) @cython.embedsignature(True) -def cuDevSmResourceSplitByCount(unsigned int nbGroups, input_ : Optional[CUdevResource], unsigned int useFlags, unsigned int minCount): +def cuDevSmResourceSplitByCount(unsigned int nbGroups, input_ : Optional[CUdevResource], unsigned int flags, unsigned int minCount): """ Splits `CU_DEV_RESOURCE_TYPE_SM` resources. Splits `CU_DEV_RESOURCE_TYPE_SM` resources into `nbGroups`, adhering to the minimum SM count specified in `minCount` and the usage flags in - `useFlags`. If `result` is NULL, the API simulates a split and provides + `flags`. If `result` is NULL, the API simulates a split and provides the amount of groups that would be created in `nbGroups`. Otherwise, `nbGroups` must point to the amount of elements in `result` and on return, the API will overwrite `nbGroups` with the amount actually @@ -44517,7 +54461,13 @@ def cuDevSmResourceSplitByCount(unsigned int nbGroups, input_ : Optional[CUdevRe guarantee a split that will create a disjoint set of symmetrical partitions. This may lead to fewer groups created than purely dividing the total SM count by the `minCount` due to cluster requirements or - alignment and granularity requirements for the minCount. + alignment and granularity requirements for the minCount. These + requirements can be queried with :py:obj:`~.cuDeviceGetDevResource`, + :py:obj:`~.cuCtxGetDevResource`, and + :py:obj:`~.cuGreenCtxGetDevResource` for + :py:obj:`~.CU_DEV_RESOURCE_TYPE_SM`, using the `minSmPartitionSize` and + `smCoscheduledAlignment` fields to determine minimum partition size and + alignment granularity, respectively. The `remainder` set does not have the same functional or performance guarantees as the groups in `result`. Its use should be carefully @@ -44541,13 +54491,13 @@ def cuDevSmResourceSplitByCount(unsigned int nbGroups, input_ : Optional[CUdevRe - A valid array of `result` pointers of size passed in `nbGroups`, with `input` of type `CU_DEV_RESOURCE_TYPE_SM`. Value of `minCount` must - be between 0 and the SM count specified in `input`. `remaining` may + be between 0 and the SM count specified in `input`. `remainder` may be NULL. - NULL passed in for `result`, with a valid integer pointer in `nbGroups` and `input` of type `CU_DEV_RESOURCE_TYPE_SM`. Value of `minCount` must be between 0 and the SM count specified in `input`. - `remaining` may be NULL. This queries the number of groups that would + `remainder` may be NULL. This queries the number of groups that would be created by the API. Note: The API is not supported on 32-bit platforms. @@ -44560,7 +54510,7 @@ def cuDevSmResourceSplitByCount(unsigned int nbGroups, input_ : Optional[CUdevRe input : :py:obj:`~.CUdevResource` Input SM resource to be split. Must be a valid `CU_DEV_RESOURCE_TYPE_SM` resource. - useFlags : unsigned int + flags : unsigned int Flags specifying how these partitions are used or which constraints to abide by when splitting the input. Zero is valid for default behavior. @@ -44571,43 +54521,214 @@ def cuDevSmResourceSplitByCount(unsigned int nbGroups, input_ : Optional[CUdevRe ------- CUresult :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_DEVICE`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_INVALID_RESOURCE_TYPE`, :py:obj:`~.CUDA_ERROR_INVALID_RESOURCE_CONFIGURATION` - result : List[:py:obj:`~.CUdevResource`] - Output array of `None` resources. Can be NULL to query the number - of groups. + result : list[:py:obj:`~.CUdevResource`] + Output array of `CUdevResource` resources. Can be NULL to query the + number of groups. nbGroups : unsigned int This is a pointer, specifying the number of groups that would be or should be created as described below. - remaining : :py:obj:`~.CUdevResource` + remainder : :py:obj:`~.CUdevResource` If the input resource cannot be cleanly split among `nbGroups`, the - remaining is placed in here. Can be ommitted (NULL) if the user + remainder is placed in here. Can be ommitted (NULL) if the user does not need the remaining set. See Also -------- :py:obj:`~.cuGreenCtxGetDevResource`, :py:obj:`~.cuCtxGetDevResource`, :py:obj:`~.cuDeviceGetDevResource` """ - cdef ccuda.CUdevResource* cresult = NULL + cdef cydriver.CUdevResource* cyresult = NULL pyresult = [CUdevResource() for idx in range(nbGroups)] if nbGroups != 0: - cresult = calloc(nbGroups, sizeof(ccuda.CUdevResource)) - if cresult is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(nbGroups) + 'x' + str(sizeof(ccuda.CUdevResource))) - cdef unsigned int cnbGroups = nbGroups - cdef ccuda.CUdevResource* cinput__ptr = input_._ptr if input_ != None else NULL - cdef CUdevResource remaining = CUdevResource() - err = ccuda.cuDevSmResourceSplitByCount(cresult, &cnbGroups, cinput__ptr, remaining._ptr, useFlags, minCount) + cyresult = calloc(nbGroups, sizeof(cydriver.CUdevResource)) + if cyresult is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(nbGroups) + 'x' + str(sizeof(cydriver.CUdevResource))) + cdef unsigned int cynbGroups = nbGroups + cdef cydriver.CUdevResource* cyinput__ptr = input_._pvt_ptr if input_ is not None else NULL + cdef CUdevResource remainder = CUdevResource() + with nogil: + err = cydriver.cuDevSmResourceSplitByCount(cyresult, &cynbGroups, cyinput__ptr, remainder._pvt_ptr, flags, minCount) if CUresult(err) == CUresult(0): for idx in range(nbGroups): - string.memcpy((pyresult[idx])._ptr, &cresult[idx], sizeof(ccuda.CUdevResource)) - if cresult is not NULL: - free(cresult) - return (CUresult(err), pyresult, cnbGroups, remaining) -{{endif}} + string.memcpy((pyresult[idx])._pvt_ptr, &cyresult[idx], sizeof(cydriver.CUdevResource)) + if cyresult is not NULL: + free(cyresult) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None, None, None) + return (_CUresult_SUCCESS, pyresult, cynbGroups, remainder) + +@cython.embedsignature(True) +def cuDevSmResourceSplit(unsigned int nbGroups, input_ : Optional[CUdevResource], unsigned int flags, groupParams : Optional[tuple[CU_DEV_SM_RESOURCE_GROUP_PARAMS] | list[CU_DEV_SM_RESOURCE_GROUP_PARAMS]]): + """ Splits a `CU_DEV_RESOURCE_TYPE_SM` resource into structured groups. + + This API will split a resource of :py:obj:`~.CU_DEV_RESOURCE_TYPE_SM` + into `nbGroups` structured device resource groups (the `result` array), + as well as an optional `remainder`, according to a set of requirements + specified in the `groupParams` array. The term “structured” is a trait + that specifies the `result` has SMs that are co-scheduled together. + This co-scheduling can be specified via the `coscheduledSmCount` field + of the `groupParams` structure, while the `smCount` will specify how + many SMs are required in total for that result. The remainder is always + “unstructured”, it does not have any set guarantees with respect to co- + scheduling and those properties will need to either be queried via the + occupancy set of APIs or further split into structured groups by this + API. + + The API has a discovery mode for use cases where it is difficult to + know ahead of time what the SM count should be. Discovery happens when + the `smCount` field of a given `groupParams` array entry is set to 0 - + the smCount will be filled in by the API with the derived SM count + according to the provided `groupParams` fields and constraints. + Discovery can be used with both a valid result array and with a NULL + `result` pointer value. The latter is useful in situations where the + smCount will end up being zero, which is an invalid value to create a + result entry with, but allowed for discovery purposes when the `result` + is NULL. + + The `groupParams` array is evaluated from index 0 to `nbGroups` - 1. + For each index in the `groupParams` array, the API will evaluate which + SMs may be a good fit based on constraints and assign those SMs to + `result`. This evaluation order is important to consider when using + discovery mode, as it helps discover the remaining SMs. + + For a valid call: + + - `result` should point to a `CUdevResource` array of size `nbGroups`, + or alternatively, may be NULL, if the developer wishes for only the + groupParams entries to be updated + + - `input` should be a valid :py:obj:`~.CU_DEV_RESOURCE_TYPE_SM` + resource that originates from querying the green context, device + context, or device. + + - The `remainder` group may be NULL. + + - There are no API `flags` at this time, so the value passed in should + be 0. + + - A :py:obj:`~.CU_DEV_SM_RESOURCE_GROUP_PARAMS` array of size + `nbGroups`. Each entry must be zero-initialized. + + - `smCount:` must be either 0 or in the range of [2,inputSmCount] + where inputSmCount is the amount of SMs the `input` resource has. + `smCount` must be a multiple of 2, as well as a multiple of + `coscheduledSmCount`. When assigning SMs to a group (and if results + are expected by having the `result` parameter set), `smCount` + cannot end up with 0 or a value less than `coscheduledSmCount` + otherwise CUDA_ERROR_INVALID_RESOURCE_CONFIGURATION will be + returned. + + - `coscheduledSmCount:` allows grouping SMs together in order to be + able to launch clusters on Compute Architecture 9.0+. The default + value may be queried from the device’s + :py:obj:`~.CU_DEV_RESOURCE_TYPE_SM` resource (8 on Compute + Architecture 9.0+ and 2 otherwise). The maximum is 32 on Compute + Architecture 9.0+ and 2 otherwise. + + - `preferredCoscheduledSmCount:` Attempts to merge + `coscheduledSmCount` groups into larger groups, in order to make + use of `preferredClusterDimensions` on Compute Architecture 10.0+. + The default value is set to `coscheduledSmCount`. + + - `flags:` + + - `CU_DEV_SM_RESOURCE_GROUP_BACKFILL:` lets `smCount` be a non-multiple + of `coscheduledSmCount`, filling the difference between SM count and + already assigned co-scheduled groupings with other SMs. This lets any + resulting group behave similar to the `remainder` group for example. + + Example params and their effect: + + A groupParams array element is defined in the following order: -{{if 'cuDevResourceGenerateDesc' in found_functions}} + **View CUDA Toolkit Documentation for a C++ code example** + + **View CUDA Toolkit Documentation for a C++ code example** + + **View CUDA Toolkit Documentation for a C++ code example** + + **View CUDA Toolkit Documentation for a C++ code example** + + The difference between a catch-all param group as the last entry and + the remainder is in two aspects: + + - The remainder may be NULL / _TYPE_INVALID (if there are no SMs + remaining), while a result group must always be valid. + + - The remainder does not have a structure, while the result group will + always need to adhere to a structure of coscheduledSmCount (even if + its just 2), and therefore must always have enough coscheduled SMs to + cover that requirement (even with the + `CU_DEV_SM_RESOURCE_GROUP_BACKFILL` flag enabled). + + Splitting an input into N groups, can be accomplished by repeatedly + splitting off 1 group and re-splitting the remainder (a bisect + operation). However, it's recommended to accomplish this with a single + call wherever possible. + + Parameters + ---------- + nbGroups : unsigned int + Specifies the number of groups in `result` and `groupParams` + input : :py:obj:`~.CUdevResource` + Input SM resource to be split. Must be a valid + `CU_DEV_RESOURCE_TYPE_SM` resource. + flags : unsigned int + Flags specifying how the API should behave. The value should be 0 + for now. + groupParams : list[:py:obj:`~.CU_DEV_SM_RESOURCE_GROUP_PARAMS`] + Description of how the SMs should be split and assigned to the + corresponding result entry. + + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_DEVICE`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_INVALID_RESOURCE_TYPE`, :py:obj:`~.CUDA_ERROR_INVALID_RESOURCE_CONFIGURATION` + result : list[:py:obj:`~.CUdevResource`] + Output array of `CUdevResource` resources. Can be NULL, alongside + an smCount of 0, for discovery purpose. + remainder : :py:obj:`~.CUdevResource` + If splitting the input resource leaves any SMs, the remainder is + placed in here. + + See Also + -------- + :py:obj:`~.cuGreenCtxGetDevResource`, :py:obj:`~.cuCtxGetDevResource`, :py:obj:`~.cuDeviceGetDevResource` + """ + groupParams = [] if groupParams is None else groupParams + if not all(isinstance(_x, (CU_DEV_SM_RESOURCE_GROUP_PARAMS,)) for _x in groupParams): + raise TypeError("Argument 'groupParams' is not instance of type (expected tuple[cydriver.CU_DEV_SM_RESOURCE_GROUP_PARAMS,] or list[cydriver.CU_DEV_SM_RESOURCE_GROUP_PARAMS,]") + cdef cydriver.CUdevResource* cyresult = NULL + pyresult = [CUdevResource() for idx in range(nbGroups)] + if nbGroups != 0: + cyresult = calloc(nbGroups, sizeof(cydriver.CUdevResource)) + if cyresult is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(nbGroups) + 'x' + str(sizeof(cydriver.CUdevResource))) + cdef cydriver.CUdevResource* cyinput__ptr = input_._pvt_ptr if input_ is not None else NULL + cdef CUdevResource remainder = CUdevResource() + cdef cydriver.CU_DEV_SM_RESOURCE_GROUP_PARAMS* cygroupParams = NULL + if len(groupParams) > 1: + cygroupParams = calloc(len(groupParams), sizeof(cydriver.CU_DEV_SM_RESOURCE_GROUP_PARAMS)) + if cygroupParams is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(groupParams)) + 'x' + str(sizeof(cydriver.CU_DEV_SM_RESOURCE_GROUP_PARAMS))) + for idx in range(len(groupParams)): + string.memcpy(&cygroupParams[idx], (groupParams[idx])._pvt_ptr, sizeof(cydriver.CU_DEV_SM_RESOURCE_GROUP_PARAMS)) + elif len(groupParams) == 1: + cygroupParams = (groupParams[0])._pvt_ptr + with nogil: + err = cydriver.cuDevSmResourceSplit(cyresult, nbGroups, cyinput__ptr, remainder._pvt_ptr, flags, cygroupParams) + if CUresult(err) == CUresult(0): + for idx in range(nbGroups): + string.memcpy((pyresult[idx])._pvt_ptr, &cyresult[idx], sizeof(cydriver.CUdevResource)) + if cyresult is not NULL: + free(cyresult) + if len(groupParams) > 1 and cygroupParams is not NULL: + free(cygroupParams) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None, None) + return (_CUresult_SUCCESS, pyresult, remainder) @cython.embedsignature(True) -def cuDevResourceGenerateDesc(resources : Optional[List[CUdevResource]], unsigned int nbResources): +def cuDevResourceGenerateDesc(resources : Optional[tuple[CUdevResource] | list[CUdevResource]], unsigned int nbResources): """ Generate a resource descriptor. Generates a single resource descriptor with the set of resources @@ -44625,14 +54746,15 @@ def cuDevResourceGenerateDesc(resources : Optional[List[CUdevResource]], unsigne CUDA_ERROR_INVALID_RESOURCE_CONFIGURATION is returned. If multiple resources are provided in `resources` and they are of type :py:obj:`~.CU_DEV_RESOURCE_TYPE_SM`, they must be outputs (whether - `result` or `remaining`) from the same split API instance, otherwise + `result` or `remaining`) from the same split API instance and have + the same smCoscheduledAlignment values, otherwise CUDA_ERROR_INVALID_RESOURCE_CONFIGURATION is returned. Note: The API is not supported on 32-bit platforms. Parameters ---------- - resources : List[:py:obj:`~.CUdevResource`] + resources : list[:py:obj:`~.CUdevResource`] Array of resources to be included in the descriptor nbResources : unsigned int Number of resources passed in `resources` @@ -44650,23 +54772,25 @@ def cuDevResourceGenerateDesc(resources : Optional[List[CUdevResource]], unsigne """ resources = [] if resources is None else resources if not all(isinstance(_x, (CUdevResource,)) for _x in resources): - raise TypeError("Argument 'resources' is not instance of type (expected List[ccuda.CUdevResource,]") + raise TypeError("Argument 'resources' is not instance of type (expected tuple[cydriver.CUdevResource,] or list[cydriver.CUdevResource,]") cdef CUdevResourceDesc phDesc = CUdevResourceDesc() - cdef ccuda.CUdevResource* cresources = NULL - if len(resources) > 0: - cresources = calloc(len(resources), sizeof(ccuda.CUdevResource)) - if cresources is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(resources)) + 'x' + str(sizeof(ccuda.CUdevResource))) + cdef cydriver.CUdevResource* cyresources = NULL + if len(resources) > 1: + cyresources = calloc(len(resources), sizeof(cydriver.CUdevResource)) + if cyresources is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(resources)) + 'x' + str(sizeof(cydriver.CUdevResource))) for idx in range(len(resources)): - string.memcpy(&cresources[idx], (resources[idx])._ptr, sizeof(ccuda.CUdevResource)) + string.memcpy(&cyresources[idx], (resources[idx])._pvt_ptr, sizeof(cydriver.CUdevResource)) + elif len(resources) == 1: + cyresources = (resources[0])._pvt_ptr if nbResources > len(resources): raise RuntimeError("List is too small: " + str(len(resources)) + " < " + str(nbResources)) - err = ccuda.cuDevResourceGenerateDesc(phDesc._ptr, (resources[0])._ptr if len(resources) == 1 else cresources, nbResources) - if cresources is not NULL: - free(cresources) - return (CUresult(err), phDesc) -{{endif}} - -{{if 'cuGreenCtxRecordEvent' in found_functions}} + with nogil: + err = cydriver.cuDevResourceGenerateDesc(phDesc._pvt_ptr, cyresources, nbResources) + if len(resources) > 1 and cyresources is not NULL: + free(cyresources) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, phDesc) @cython.embedsignature(True) def cuGreenCtxRecordEvent(hCtx, hEvent): @@ -44690,7 +54814,7 @@ def cuGreenCtxRecordEvent(hCtx, hEvent): Returns ------- CUresult - :py:obj:`~.CUDA_SUCCESS` :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_CONTEXT`, :py:obj:`~.CUDA_ERROR_INVALID_HANDLE`, :py:obj:`~.CUDA_ERROR_STREAM_CAPTURE_UNSUPPORTED` + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_CONTEXT`, :py:obj:`~.CUDA_ERROR_INVALID_HANDLE`, :py:obj:`~.CUDA_ERROR_STREAM_CAPTURE_UNSUPPORTED` See Also -------- @@ -44700,29 +54824,25 @@ def cuGreenCtxRecordEvent(hCtx, hEvent): ----- The API will return :py:obj:`~.CUDA_ERROR_STREAM_CAPTURE_UNSUPPORTED` if the specified green context `hCtx` has a stream in the capture mode. In such a case, the call will invalidate all the conflicting captures. """ - cdef ccuda.CUevent chEvent + cdef cydriver.CUevent cyhEvent if hEvent is None: - chEvent = 0 + phEvent = 0 elif isinstance(hEvent, (CUevent,)): phEvent = int(hEvent) - chEvent = phEvent else: phEvent = int(CUevent(hEvent)) - chEvent = phEvent - cdef ccuda.CUgreenCtx chCtx + cyhEvent = phEvent + cdef cydriver.CUgreenCtx cyhCtx if hCtx is None: - chCtx = 0 + phCtx = 0 elif isinstance(hCtx, (CUgreenCtx,)): phCtx = int(hCtx) - chCtx = phCtx else: phCtx = int(CUgreenCtx(hCtx)) - chCtx = phCtx - err = ccuda.cuGreenCtxRecordEvent(chCtx, chEvent) - return (CUresult(err),) -{{endif}} - -{{if 'cuGreenCtxWaitEvent' in found_functions}} + cyhCtx = phCtx + with nogil: + err = cydriver.cuGreenCtxRecordEvent(cyhCtx, cyhEvent) + return (_CUresult(err),) @cython.embedsignature(True) def cuGreenCtxWaitEvent(hCtx, hEvent): @@ -44748,7 +54868,7 @@ def cuGreenCtxWaitEvent(hCtx, hEvent): See Also -------- - :py:obj:`~.cuGreenCtxRecordEvent`, :py:obj:`~.cuStreamWaitEvent` :py:obj:`~.cuCtxRecordEvent`, :py:obj:`~.cuCtxWaitEvent` + :py:obj:`~.cuGreenCtxRecordEvent`, :py:obj:`~.cuStreamWaitEvent`, :py:obj:`~.cuCtxRecordEvent`, :py:obj:`~.cuCtxWaitEvent` Notes ----- @@ -44756,29 +54876,25 @@ def cuGreenCtxWaitEvent(hCtx, hEvent): The API will return :py:obj:`~.CUDA_ERROR_STREAM_CAPTURE_UNSUPPORTED` and invalidate the capture if the specified event `hEvent` is part of an ongoing capture sequence or if the specified green context `hCtx` has a stream in the capture mode. """ - cdef ccuda.CUevent chEvent + cdef cydriver.CUevent cyhEvent if hEvent is None: - chEvent = 0 + phEvent = 0 elif isinstance(hEvent, (CUevent,)): phEvent = int(hEvent) - chEvent = phEvent else: phEvent = int(CUevent(hEvent)) - chEvent = phEvent - cdef ccuda.CUgreenCtx chCtx + cyhEvent = phEvent + cdef cydriver.CUgreenCtx cyhCtx if hCtx is None: - chCtx = 0 + phCtx = 0 elif isinstance(hCtx, (CUgreenCtx,)): phCtx = int(hCtx) - chCtx = phCtx else: phCtx = int(CUgreenCtx(hCtx)) - chCtx = phCtx - err = ccuda.cuGreenCtxWaitEvent(chCtx, chEvent) - return (CUresult(err),) -{{endif}} - -{{if 'cuStreamGetGreenCtx' in found_functions}} + cyhCtx = phCtx + with nogil: + err = cydriver.cuGreenCtxWaitEvent(cyhCtx, cyhEvent) + return (_CUresult(err),) @cython.embedsignature(True) def cuStreamGetGreenCtx(hStream): @@ -44820,23 +54936,22 @@ def cuStreamGetGreenCtx(hStream): See Also -------- - :py:obj:`~.cuStreamDestroy`, :py:obj:`~.cuStreamCreate`, :py:obj:`~.cuStreamCreateWithPriority`, :py:obj:`~.cuStreamGetCtx_v2`, :py:obj:`~.cuGreenCtxStreamCreate`, :py:obj:`~.cuStreamGetPriority`, :py:obj:`~.cuStreamGetFlags`, :py:obj:`~.cuStreamWaitEvent`, :py:obj:`~.cuStreamQuery`, :py:obj:`~.cuStreamSynchronize`, :py:obj:`~.cuStreamAddCallback`, :py:obj:`~.cudaStreamCreate`, :py:obj:`~.cudaStreamCreateWithFlags` + :py:obj:`~.cuStreamDestroy`, :py:obj:`~.cuStreamCreate`, :py:obj:`~.cuStreamCreateWithPriority`, :py:obj:`~.cuStreamGetCtx`, :py:obj:`~.cuGreenCtxStreamCreate`, :py:obj:`~.cuStreamGetPriority`, :py:obj:`~.cuStreamGetFlags`, :py:obj:`~.cuStreamGetDevice`, :py:obj:`~.cuStreamWaitEvent`, :py:obj:`~.cuStreamQuery`, :py:obj:`~.cuStreamSynchronize`, :py:obj:`~.cuStreamAddCallback`, :py:obj:`~.cudaStreamCreate`, :py:obj:`~.cudaStreamCreateWithFlags` """ - cdef ccuda.CUstream chStream + cdef cydriver.CUstream cyhStream if hStream is None: - chStream = 0 + phStream = 0 elif isinstance(hStream, (CUstream,)): phStream = int(hStream) - chStream = phStream else: phStream = int(CUstream(hStream)) - chStream = phStream + cyhStream = phStream cdef CUgreenCtx phCtx = CUgreenCtx() - err = ccuda.cuStreamGetGreenCtx(chStream, phCtx._ptr) - return (CUresult(err), phCtx) -{{endif}} - -{{if 'cuGreenCtxStreamCreate' in found_functions}} + with nogil: + err = cydriver.cuStreamGetGreenCtx(cyhStream, phCtx._pvt_ptr) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, phCtx) @cython.embedsignature(True) def cuGreenCtxStreamCreate(greenCtx, unsigned int flags, int priority): @@ -44889,27 +55004,495 @@ def cuGreenCtxStreamCreate(greenCtx, unsigned int flags, int priority): See Also -------- - :py:obj:`~.cuStreamDestroy`, :py:obj:`~.cuGreenCtxCreate` :py:obj:`~.cuStreamCreate`, :py:obj:`~.cuStreamGetPriority`, :py:obj:`~.cuCtxGetStreamPriorityRange`, :py:obj:`~.cuStreamGetFlags`, :py:obj:`~.cuStreamWaitEvent`, :py:obj:`~.cuStreamQuery`, :py:obj:`~.cuStreamSynchronize`, :py:obj:`~.cuStreamAddCallback`, :py:obj:`~.cudaStreamCreateWithPriority` + :py:obj:`~.cuStreamDestroy`, :py:obj:`~.cuGreenCtxCreate` :py:obj:`~.cuStreamCreate`, :py:obj:`~.cuStreamGetPriority`, :py:obj:`~.cuCtxGetStreamPriorityRange`, :py:obj:`~.cuStreamGetFlags`, :py:obj:`~.cuStreamGetDevice`, :py:obj:`~.cuStreamWaitEvent`, :py:obj:`~.cuStreamQuery`, :py:obj:`~.cuStreamSynchronize`, :py:obj:`~.cuStreamAddCallback`, :py:obj:`~.cudaStreamCreateWithPriority` Notes ----- In the current implementation, only compute kernels launched in priority streams are affected by the stream's priority. Stream priorities have no effect on host-to-device and device-to-host memory operations. """ - cdef ccuda.CUgreenCtx cgreenCtx + cdef cydriver.CUgreenCtx cygreenCtx if greenCtx is None: - cgreenCtx = 0 + pgreenCtx = 0 elif isinstance(greenCtx, (CUgreenCtx,)): pgreenCtx = int(greenCtx) - cgreenCtx = pgreenCtx else: pgreenCtx = int(CUgreenCtx(greenCtx)) - cgreenCtx = pgreenCtx + cygreenCtx = pgreenCtx cdef CUstream phStream = CUstream() - err = ccuda.cuGreenCtxStreamCreate(phStream._ptr, cgreenCtx, flags, priority) - return (CUresult(err), phStream) -{{endif}} + with nogil: + err = cydriver.cuGreenCtxStreamCreate(phStream._pvt_ptr, cygreenCtx, flags, priority) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, phStream) + +@cython.embedsignature(True) +def cuGreenCtxGetId(greenCtx): + """ Returns the unique Id associated with the green context supplied. + + Returns in `greenCtxId` the unique Id which is associated with a given + green context. The Id is unique for the life of the program for this + instance of CUDA. If green context is supplied as NULL and the current + context is set to a green context, the Id of the current green context + is returned. + + Parameters + ---------- + greenCtx : :py:obj:`~.CUgreenCtx` + Green context for which to obtain the Id + + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_CONTEXT_IS_DESTROYED`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_CONTEXT`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE` + greenCtxId : unsigned long long + Pointer to store the Id of the green context + + See Also + -------- + :py:obj:`~.cuGreenCtxCreate`, :py:obj:`~.cuGreenCtxDestroy`, :py:obj:`~.cuCtxGetId` + """ + cdef cydriver.CUgreenCtx cygreenCtx + if greenCtx is None: + pgreenCtx = 0 + elif isinstance(greenCtx, (CUgreenCtx,)): + pgreenCtx = int(greenCtx) + else: + pgreenCtx = int(CUgreenCtx(greenCtx)) + cygreenCtx = pgreenCtx + cdef unsigned long long greenCtxId = 0 + with nogil: + err = cydriver.cuGreenCtxGetId(cygreenCtx, &greenCtxId) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, greenCtxId) + +@cython.embedsignature(True) +def cuStreamGetDevResource(hStream, typename not None : CUdevResourceType): + """ Get stream resources. + + Get the `typename` resources available to the `hStream` and store them + in `resource`. + + Note: The API will return :py:obj:`~.CUDA_ERROR_INVALID_RESOURCE_TYPE` + is `typename` is `CU_DEV_RESOURCE_TYPE_WORKQUEUE_CONFIG` or + `CU_DEV_RESOURCE_TYPE_WORKQUEUE`. + + Parameters + ---------- + hStream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + Stream to get resource for + typename : :py:obj:`~.CUdevResourceType` + Type of resource to retrieve + + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_RESOURCE_TYPE`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_INVALID_HANDLE` + resource : :py:obj:`~.CUdevResource` + Output pointer to a :py:obj:`~.CUdevResource` structure + + See Also + -------- + :py:obj:`~.cuGreenCtxCreate`, :py:obj:`~.cuGreenCtxStreamCreate`, :py:obj:`~.cuStreamCreate`, :py:obj:`~.cuDevSmResourceSplitByCount`, :py:obj:`~.cuDevResourceGenerateDesc`, :py:obj:`~.cudaStreamGetDevResource` + """ + cdef cydriver.CUstream cyhStream + if hStream is None: + phStream = 0 + elif isinstance(hStream, (CUstream,)): + phStream = int(hStream) + else: + phStream = int(CUstream(hStream)) + cyhStream = phStream + cdef CUdevResource resource = CUdevResource() + cdef cydriver.CUdevResourceType cytypename = int(typename) + with nogil: + err = cydriver.cuStreamGetDevResource(cyhStream, resource._pvt_ptr, cytypename) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, resource) + +ctypedef struct cuLogsCallbackData_st: + cydriver.CUlogsCallback callback + void *userData + +ctypedef cuLogsCallbackData_st cuLogsCallbackData + +@cython.show_performance_hints(False) +cdef void cuLogsCallbackWrapper(void *data, cydriver.CUlogLevel logLevel, char *message, size_t length) nogil: + cdef cuLogsCallbackData *cbData = data + with gil: + cbData.callback(cbData.userData, logLevel, message, length) + +@cython.embedsignature(True) +def cuLogsRegisterCallback(callbackFunc, userData): + """ Register a callback function to receive error log messages. + + Parameters + ---------- + callbackFunc : :py:obj:`~.CUlogsCallback` + The function to register as a callback + userData : Any + A generic pointer to user data. This is passed into the callback + function. + + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS` :py:obj:`~.CUDA_ERROR_INVALID_VALUE` + callback_out : :py:obj:`~.CUlogsCallbackHandle` + Optional location to store the callback handle after it is + registered + """ + cdef cydriver.CUlogsCallback cycallbackFunc + if callbackFunc is None: + pcallbackFunc = 0 + elif isinstance(callbackFunc, (CUlogsCallback,)): + pcallbackFunc = int(callbackFunc) + else: + pcallbackFunc = int(CUlogsCallback(callbackFunc)) + cycallbackFunc = pcallbackFunc + cdef _HelperInputVoidPtrStruct cyuserDataHelper + cdef void* cyuserData = _helper_input_void_ptr(userData, &cyuserDataHelper) + + cdef cuLogsCallbackData *cbData = NULL + cbData = malloc(sizeof(cbData[0])) + if cbData == NULL: + return (CUresult.CUDA_ERROR_OUT_OF_MEMORY, None) + cbData.callback = cycallbackFunc + cbData.userData = cyuserData + + cdef CUlogsCallbackHandle callback_out = CUlogsCallbackHandle() + with nogil: + err = cydriver.cuLogsRegisterCallback(cuLogsCallbackWrapper, cbData, callback_out._pvt_ptr) + if err != cydriver.CUDA_SUCCESS: + free(cbData) + else: + m_global._allocated[int(callback_out)] = cbData + _helper_input_void_ptr_free(&cyuserDataHelper) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, callback_out) + +@cython.embedsignature(True) +def cuLogsUnregisterCallback(callback): + """ Unregister a log message callback. + + Parameters + ---------- + callback : :py:obj:`~.CUlogsCallbackHandle` + The callback instance to unregister from receiving log messages + + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS` :py:obj:`~.CUDA_ERROR_INVALID_VALUE` + """ + cdef cydriver.CUlogsCallbackHandle cycallback + if callback is None: + pcallback = 0 + elif isinstance(callback, (CUlogsCallbackHandle,)): + pcallback = int(callback) + else: + pcallback = int(CUlogsCallbackHandle(callback)) + cycallback = pcallback + with nogil: + err = cydriver.cuLogsUnregisterCallback(cycallback) + if err == cydriver.CUDA_SUCCESS: + free(m_global._allocated[pcallback]) + m_global._allocated.erase(pcallback) + return (_CUresult(err),) + +@cython.embedsignature(True) +def cuLogsCurrent(unsigned int flags): + """ Sets log iterator to point to the end of log buffer, where the next message would be written. + + Parameters + ---------- + flags : unsigned int + Reserved for future use, must be 0 + + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS` :py:obj:`~.CUDA_ERROR_INVALID_VALUE` + iterator_out : :py:obj:`~.CUlogIterator` + Location to store an iterator to the current tail of the logs + """ + cdef CUlogIterator iterator_out = CUlogIterator() + with nogil: + err = cydriver.cuLogsCurrent(iterator_out._pvt_ptr, flags) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, iterator_out) + +@cython.embedsignature(True) +def cuLogsDumpToFile(iterator : Optional[CUlogIterator], char* pathToFile, unsigned int flags): + """ Dump accumulated driver logs into a file. + + Logs generated by the driver are stored in an internal buffer and can + be copied out using this API. This API dumps all driver logs starting + from `iterator` into `pathToFile` provided. + + Parameters + ---------- + iterator : :py:obj:`~.CUlogIterator` + Optional auto-advancing iterator specifying the starting log to + read. NULL value dumps all logs. + pathToFile : bytes + Path to output file for dumping logs + flags : unsigned int + Reserved for future use, must be 0 + + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS` :py:obj:`~.CUDA_ERROR_INVALID_VALUE` + iterator : :py:obj:`~.CUlogIterator` + Optional auto-advancing iterator specifying the starting log to + read. NULL value dumps all logs. + + Notes + ----- + `iterator` is auto-advancing. Dumping logs will update the value of `iterator` to receive the next generated log. + + The driver reserves limited memory for storing logs. The oldest logs may be overwritten and become unrecoverable. An indication will appear in the destination outupt if the logs have been truncated. Call dump after each failed API to mitigate this risk. + """ + cdef cydriver.CUlogIterator* cyiterator = NULL + if iterator is not None: + cyiterator = iterator._pvt_ptr + with nogil: + err = cydriver.cuLogsDumpToFile(cyiterator, pathToFile, flags) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, iterator) + +@cython.embedsignature(True) +def cuLogsDumpToMemory(iterator : Optional[CUlogIterator], char* buffer, size_t size, unsigned int flags): + """ Dump accumulated driver logs into a buffer. + + Logs generated by the driver are stored in an internal buffer and can + be copied out using this API. This API dumps driver logs from + `iterator` into `buffer` up to the size specified in `*size`. The + driver will always null terminate the buffer but there will not be a + null character between log entries, only a newline \n. The driver will + then return the actual number of bytes written in `*size`, excluding + the null terminator. If there are no messages to dump, `*size` will be + set to 0 and the function will return :py:obj:`~.CUDA_SUCCESS`. If the + provided `buffer` is not large enough to hold any messages, `*size` + will be set to 0 and the function will return + :py:obj:`~.CUDA_ERROR_INVALID_VALUE`. + + Parameters + ---------- + iterator : :py:obj:`~.CUlogIterator` + Optional auto-advancing iterator specifying the starting log to + read. NULL value dumps all logs. + buffer : bytes + Pointer to dump logs + size : int + See description + flags : unsigned int + Reserved for future use, must be 0 + + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE` + iterator : :py:obj:`~.CUlogIterator` + Optional auto-advancing iterator specifying the starting log to + read. NULL value dumps all logs. + size : int + See description + + Notes + ----- + `iterator` is auto-advancing. Dumping logs will update the value of `iterator` to receive the next generated log. + + The driver reserves limited memory for storing logs. The maximum size of the buffer is 25600 bytes. The oldest logs may be overwritten and become unrecoverable. An indication will appear in the destination outupt if the logs have been truncated. Call dump after each failed API to mitigate this risk. + + If the provided value in `*size` is not large enough to hold all buffered messages, a message will be added at the head of the buffer indicating this. The driver then computes the number of messages it is able to store in `buffer` and writes it out. The final message in `buffer` will always be the most recent log message as of when the API is called. + """ + cdef cydriver.CUlogIterator* cyiterator = NULL + if iterator is not None: + cyiterator = iterator._pvt_ptr + with nogil: + err = cydriver.cuLogsDumpToMemory(cyiterator, buffer, &size, flags) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None, None) + return (_CUresult_SUCCESS, iterator, size) + +@cython.embedsignature(True) +def cuCheckpointProcessGetRestoreThreadId(int pid): + """ Returns the restore thread ID for a CUDA process. + + Returns in `*tid` the thread ID of the CUDA restore thread for the + process specified by `pid`. + + Parameters + ---------- + pid : int + The process ID of the CUDA process + + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS` :py:obj:`~.CUDA_ERROR_INVALID_VALUE` :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED` :py:obj:`~.CUDA_ERROR_NOT_SUPPORTED` + tid : int + Returned restore thread ID + """ + cdef int tid = 0 + with nogil: + err = cydriver.cuCheckpointProcessGetRestoreThreadId(pid, &tid) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, tid) + +@cython.embedsignature(True) +def cuCheckpointProcessGetState(int pid): + """ Returns the process state of a CUDA process. + + Returns in `*state` the current state of the CUDA process specified by + `pid`. + + Parameters + ---------- + pid : int + The process ID of the CUDA process + + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS` :py:obj:`~.CUDA_ERROR_INVALID_VALUE` :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED` :py:obj:`~.CUDA_ERROR_NOT_SUPPORTED` + state : :py:obj:`~.CUprocessState` + Returned CUDA process state + """ + cdef cydriver.CUprocessState state + with nogil: + err = cydriver.cuCheckpointProcessGetState(pid, &state) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, CUprocessState(state)) + +@cython.embedsignature(True) +def cuCheckpointProcessLock(int pid, args : Optional[CUcheckpointLockArgs]): + """ Lock a running CUDA process. + + Lock the CUDA process specified by `pid` which will block further CUDA + API calls. Process must be in the RUNNING state in order to lock. + + Upon successful return the process will be in the LOCKED state. -{{if 'cuProfilerStart' in found_functions}} + If timeoutMs is specified and the timeout is reached the process will + be left in the RUNNING state upon return. + + Parameters + ---------- + pid : int + The process ID of the CUDA process + args : :py:obj:`~.CUcheckpointLockArgs` + Optional lock operation arguments + + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS` :py:obj:`~.CUDA_ERROR_INVALID_VALUE` :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED` :py:obj:`~.CUDA_ERROR_ILLEGAL_STATE` :py:obj:`~.CUDA_ERROR_NOT_SUPPORTED` :py:obj:`~.CUDA_ERROR_NOT_READY` + """ + cdef cydriver.CUcheckpointLockArgs* cyargs_ptr = args._pvt_ptr if args is not None else NULL + with nogil: + err = cydriver.cuCheckpointProcessLock(pid, cyargs_ptr) + return (_CUresult(err),) + +@cython.embedsignature(True) +def cuCheckpointProcessCheckpoint(int pid, args : Optional[CUcheckpointCheckpointArgs]): + """ Checkpoint a CUDA process's GPU memory contents. + + Checkpoints a CUDA process specified by `pid` that is in the LOCKED + state. The GPU memory contents will be brought into host memory and all + underlying references will be released. Process must be in the LOCKED + state to checkpoint. + + Upon successful return the process will be in the CHECKPOINTED state. + + Parameters + ---------- + pid : int + The process ID of the CUDA process + args : :py:obj:`~.CUcheckpointCheckpointArgs` + Optional checkpoint operation arguments + + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS` :py:obj:`~.CUDA_ERROR_INVALID_VALUE` :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED` :py:obj:`~.CUDA_ERROR_ILLEGAL_STATE` :py:obj:`~.CUDA_ERROR_NOT_SUPPORTED` + """ + cdef cydriver.CUcheckpointCheckpointArgs* cyargs_ptr = args._pvt_ptr if args is not None else NULL + with nogil: + err = cydriver.cuCheckpointProcessCheckpoint(pid, cyargs_ptr) + return (_CUresult(err),) + +@cython.embedsignature(True) +def cuCheckpointProcessRestore(int pid, args : Optional[CUcheckpointRestoreArgs]): + """ Restore a CUDA process's GPU memory contents from its last checkpoint. + + Restores a CUDA process specified by `pid` from its last checkpoint. + Process must be in the CHECKPOINTED state to restore. + + GPU UUID pairs can be specified in `args` to remap the process old GPUs + onto new GPUs. The GPU to restore onto needs to have enough memory and + be of the same chip type as the old GPU. If an array of GPU UUID pairs + is specified, it must contain every checkpointed GPU. + + Upon successful return the process will be in the LOCKED state. + + CUDA process restore requires persistence mode to be enabled or + :py:obj:`~.cuInit` to have been called before execution. + + Parameters + ---------- + pid : int + The process ID of the CUDA process + args : :py:obj:`~.CUcheckpointRestoreArgs` + Optional restore operation arguments + + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS` :py:obj:`~.CUDA_ERROR_INVALID_VALUE` :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED` :py:obj:`~.CUDA_ERROR_ILLEGAL_STATE` :py:obj:`~.CUDA_ERROR_NOT_SUPPORTED` + + See Also + -------- + :py:obj:`~.cuInit` + """ + cdef cydriver.CUcheckpointRestoreArgs* cyargs_ptr = args._pvt_ptr if args is not None else NULL + with nogil: + err = cydriver.cuCheckpointProcessRestore(pid, cyargs_ptr) + return (_CUresult(err),) + +@cython.embedsignature(True) +def cuCheckpointProcessUnlock(int pid, args : Optional[CUcheckpointUnlockArgs]): + """ Unlock a CUDA process to allow CUDA API calls. + + Unlocks a process specified by `pid` allowing it to resume making CUDA + API calls. Process must be in the LOCKED state. + + Upon successful return the process will be in the RUNNING state. + + Parameters + ---------- + pid : int + The process ID of the CUDA process + args : :py:obj:`~.CUcheckpointUnlockArgs` + Optional unlock operation arguments + + Returns + ------- + CUresult + :py:obj:`~.CUDA_SUCCESS` :py:obj:`~.CUDA_ERROR_INVALID_VALUE` :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED` :py:obj:`~.CUDA_ERROR_ILLEGAL_STATE` :py:obj:`~.CUDA_ERROR_NOT_SUPPORTED` + """ + cdef cydriver.CUcheckpointUnlockArgs* cyargs_ptr = args._pvt_ptr if args is not None else NULL + with nogil: + err = cydriver.cuCheckpointProcessUnlock(pid, cyargs_ptr) + return (_CUresult(err),) @cython.embedsignature(True) def cuProfilerStart(): @@ -44932,11 +55515,9 @@ def cuProfilerStart(): -------- :py:obj:`~.cuProfilerInitialize`, :py:obj:`~.cuProfilerStop`, :py:obj:`~.cudaProfilerStart` """ - err = ccuda.cuProfilerStart() - return (CUresult(err),) -{{endif}} - -{{if 'cuProfilerStop' in found_functions}} + with nogil: + err = cydriver.cuProfilerStart() + return (_CUresult(err),) @cython.embedsignature(True) def cuProfilerStop(): @@ -44959,21 +55540,19 @@ def cuProfilerStop(): -------- :py:obj:`~.cuProfilerInitialize`, :py:obj:`~.cuProfilerStart`, :py:obj:`~.cudaProfilerStop` """ - err = ccuda.cuProfilerStop() - return (CUresult(err),) -{{endif}} - -{{if True}} + with nogil: + err = cydriver.cuProfilerStop() + return (_CUresult(err),) @cython.embedsignature(True) def cuGraphicsEGLRegisterImage(image, unsigned int flags): """ Registers an EGL image. - Registers the EGLImageKHR specified by `image` for access by CUDA. A - handle to the registered object is returned as `pCudaResource`. - Additional Mapping/Unmapping is not required for the registered - resource and :py:obj:`~.cuGraphicsResourceGetMappedEglFrame` can be - directly called on the `pCudaResource`. + Registers the :py:obj:`~.EGLImageKHR` specified by `image` for access + by CUDA. A handle to the registered object is returned as + `pCudaResource`. Additional Mapping/Unmapping is not required for the + registered resource and :py:obj:`~.cuGraphicsResourceGetMappedEglFrame` + can be directly called on the `pCudaResource`. The application will be responsible for synchronizing access to shared objects. The application must ensure that any pending operation which @@ -45001,14 +55580,15 @@ def cuGraphicsEGLRegisterImage(image, unsigned int flags): entire contents of the resource, so none of the data previously stored in the resource will be preserved. - The EGLImageKHR is an object which can be used to create EGLImage - target resource. It is defined as a void pointer. typedef void* - EGLImageKHR + The :py:obj:`~.EGLImageKHR` is an object which can be used to create + EGLImage target resource. It is defined as a void pointer. typedef + void* :py:obj:`~.EGLImageKHR` Parameters ---------- image : :py:obj:`~.EGLImageKHR` - An EGLImageKHR image which can be used to create target resource. + An :py:obj:`~.EGLImageKHR` image which can be used to create target + resource. flags : unsigned int Map flags @@ -45023,35 +55603,35 @@ def cuGraphicsEGLRegisterImage(image, unsigned int flags): -------- :py:obj:`~.cuGraphicsEGLRegisterImage`, :py:obj:`~.cuGraphicsUnregisterResource`, :py:obj:`~.cuGraphicsResourceSetMapFlags`, :py:obj:`~.cuGraphicsMapResources`, :py:obj:`~.cuGraphicsUnmapResources`, :py:obj:`~.cudaGraphicsEGLRegisterImage` """ - cdef ccuda.EGLImageKHR cimage + cdef cydriver.EGLImageKHR cyimage if image is None: - cimage = 0 + pimage = 0 elif isinstance(image, (EGLImageKHR,)): pimage = int(image) - cimage = pimage else: pimage = int(EGLImageKHR(image)) - cimage = pimage + cyimage = pimage cdef CUgraphicsResource pCudaResource = CUgraphicsResource() - err = ccuda.cuGraphicsEGLRegisterImage(pCudaResource._ptr, cimage, flags) - return (CUresult(err), pCudaResource) -{{endif}} - -{{if True}} + with nogil: + err = cydriver.cuGraphicsEGLRegisterImage(pCudaResource._pvt_ptr, cyimage, flags) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pCudaResource) @cython.embedsignature(True) def cuEGLStreamConsumerConnect(stream): """ Connect CUDA to EGLStream as a consumer. - Connect CUDA as a consumer to EGLStreamKHR specified by `stream`. + Connect CUDA as a consumer to :py:obj:`~.EGLStreamKHR` specified by + `stream`. - The EGLStreamKHR is an EGL object that transfers a sequence of image - frames from one API to another. + The :py:obj:`~.EGLStreamKHR` is an EGL object that transfers a sequence + of image frames from one API to another. Parameters ---------- stream : :py:obj:`~.EGLStreamKHR` - EGLStreamKHR handle + :py:obj:`~.EGLStreamKHR` handle Returns ------- @@ -45064,28 +55644,28 @@ def cuEGLStreamConsumerConnect(stream): -------- :py:obj:`~.cuEGLStreamConsumerConnect`, :py:obj:`~.cuEGLStreamConsumerDisconnect`, :py:obj:`~.cuEGLStreamConsumerAcquireFrame`, :py:obj:`~.cuEGLStreamConsumerReleaseFrame`, :py:obj:`~.cudaEGLStreamConsumerConnect` """ - cdef ccuda.EGLStreamKHR cstream + cdef cydriver.EGLStreamKHR cystream if stream is None: - cstream = 0 + pstream = 0 elif isinstance(stream, (EGLStreamKHR,)): pstream = int(stream) - cstream = pstream else: pstream = int(EGLStreamKHR(stream)) - cstream = pstream + cystream = pstream cdef CUeglStreamConnection conn = CUeglStreamConnection() - err = ccuda.cuEGLStreamConsumerConnect(conn._ptr, cstream) - return (CUresult(err), conn) -{{endif}} - -{{if True}} + with nogil: + err = cydriver.cuEGLStreamConsumerConnect(conn._pvt_ptr, cystream) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, conn) @cython.embedsignature(True) def cuEGLStreamConsumerConnectWithFlags(stream, unsigned int flags): """ Connect CUDA to EGLStream as a consumer with given flags. - Connect CUDA as a consumer to EGLStreamKHR specified by `stream` with - specified `flags` defined by CUeglResourceLocationFlags. + Connect CUDA as a consumer to :py:obj:`~.EGLStreamKHR` specified by + `stream` with specified `flags` defined by + :py:obj:`~.CUeglResourceLocationFlags`. The flags specify whether the consumer wants to access frames from system memory or video memory. Default is @@ -45094,7 +55674,7 @@ def cuEGLStreamConsumerConnectWithFlags(stream, unsigned int flags): Parameters ---------- stream : :py:obj:`~.EGLStreamKHR` - EGLStreamKHR handle + :py:obj:`~.EGLStreamKHR` handle flags : unsigned int Flags denote intended location - system or video. @@ -45109,27 +55689,26 @@ def cuEGLStreamConsumerConnectWithFlags(stream, unsigned int flags): -------- :py:obj:`~.cuEGLStreamConsumerConnect`, :py:obj:`~.cuEGLStreamConsumerDisconnect`, :py:obj:`~.cuEGLStreamConsumerAcquireFrame`, :py:obj:`~.cuEGLStreamConsumerReleaseFrame`, :py:obj:`~.cudaEGLStreamConsumerConnectWithFlags` """ - cdef ccuda.EGLStreamKHR cstream + cdef cydriver.EGLStreamKHR cystream if stream is None: - cstream = 0 + pstream = 0 elif isinstance(stream, (EGLStreamKHR,)): pstream = int(stream) - cstream = pstream else: pstream = int(EGLStreamKHR(stream)) - cstream = pstream + cystream = pstream cdef CUeglStreamConnection conn = CUeglStreamConnection() - err = ccuda.cuEGLStreamConsumerConnectWithFlags(conn._ptr, cstream, flags) - return (CUresult(err), conn) -{{endif}} - -{{if True}} + with nogil: + err = cydriver.cuEGLStreamConsumerConnectWithFlags(conn._pvt_ptr, cystream, flags) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, conn) @cython.embedsignature(True) def cuEGLStreamConsumerDisconnect(conn): """ Disconnect CUDA as a consumer to EGLStream . - Disconnect CUDA as a consumer to EGLStreamKHR. + Disconnect CUDA as a consumer to :py:obj:`~.EGLStreamKHR`. Parameters ---------- @@ -45145,32 +55724,30 @@ def cuEGLStreamConsumerDisconnect(conn): -------- :py:obj:`~.cuEGLStreamConsumerConnect`, :py:obj:`~.cuEGLStreamConsumerDisconnect`, :py:obj:`~.cuEGLStreamConsumerAcquireFrame`, :py:obj:`~.cuEGLStreamConsumerReleaseFrame`, :py:obj:`~.cudaEGLStreamConsumerDisconnect` """ - cdef ccuda.CUeglStreamConnection *cconn + cdef cydriver.CUeglStreamConnection *cyconn if conn is None: - cconn = NULL + cyconn = NULL elif isinstance(conn, (CUeglStreamConnection,)): pconn = conn.getPtr() - cconn = pconn + cyconn = pconn elif isinstance(conn, (int)): - cconn = conn + cyconn = conn else: - raise TypeError("Argument 'conn' is not instance of type (expected , found " + str(type(conn))) - err = ccuda.cuEGLStreamConsumerDisconnect(cconn) - return (CUresult(err),) -{{endif}} - -{{if True}} + raise TypeError("Argument 'conn' is not instance of type (expected , found " + str(type(conn))) + with nogil: + err = cydriver.cuEGLStreamConsumerDisconnect(cyconn) + return (_CUresult(err),) @cython.embedsignature(True) def cuEGLStreamConsumerAcquireFrame(conn, pCudaResource, pStream, unsigned int timeout): """ Acquire an image frame from the EGLStream with CUDA as a consumer. - Acquire an image frame from EGLStreamKHR. This API can also acquire an - old frame presented by the producer unless explicitly disabled by - setting EGL_SUPPORT_REUSE_NV flag to EGL_FALSE during stream - initialization. By default, EGLStream is created with this flag set to - EGL_TRUE. :py:obj:`~.cuGraphicsResourceGetMappedEglFrame` can be called - on `pCudaResource` to get :py:obj:`~.CUeglFrame`. + Acquire an image frame from :py:obj:`~.EGLStreamKHR`. This API can also + acquire an old frame presented by the producer unless explicitly + disabled by setting EGL_SUPPORT_REUSE_NV flag to EGL_FALSE during + stream initialization. By default, EGLStream is created with this flag + set to EGL_TRUE. :py:obj:`~.cuGraphicsResourceGetMappedEglFrame` can be + called on `pCudaResource` to get :py:obj:`~.CUeglFrame`. Parameters ---------- @@ -45196,51 +55773,49 @@ def cuEGLStreamConsumerAcquireFrame(conn, pCudaResource, pStream, unsigned int t -------- :py:obj:`~.cuEGLStreamConsumerConnect`, :py:obj:`~.cuEGLStreamConsumerDisconnect`, :py:obj:`~.cuEGLStreamConsumerAcquireFrame`, :py:obj:`~.cuEGLStreamConsumerReleaseFrame`, :py:obj:`~.cudaEGLStreamConsumerAcquireFrame` """ - cdef ccuda.CUstream *cpStream + cdef cydriver.CUstream *cypStream if pStream is None: - cpStream = NULL + cypStream = NULL elif isinstance(pStream, (CUstream,)): ppStream = pStream.getPtr() - cpStream = ppStream + cypStream = ppStream elif isinstance(pStream, (int)): - cpStream = pStream + cypStream = pStream else: - raise TypeError("Argument 'pStream' is not instance of type (expected , found " + str(type(pStream))) - cdef ccuda.CUgraphicsResource *cpCudaResource + raise TypeError("Argument 'pStream' is not instance of type (expected , found " + str(type(pStream))) + cdef cydriver.CUgraphicsResource *cypCudaResource if pCudaResource is None: - cpCudaResource = NULL + cypCudaResource = NULL elif isinstance(pCudaResource, (CUgraphicsResource,)): ppCudaResource = pCudaResource.getPtr() - cpCudaResource = ppCudaResource + cypCudaResource = ppCudaResource elif isinstance(pCudaResource, (int)): - cpCudaResource = pCudaResource + cypCudaResource = pCudaResource else: - raise TypeError("Argument 'pCudaResource' is not instance of type (expected , found " + str(type(pCudaResource))) - cdef ccuda.CUeglStreamConnection *cconn + raise TypeError("Argument 'pCudaResource' is not instance of type (expected , found " + str(type(pCudaResource))) + cdef cydriver.CUeglStreamConnection *cyconn if conn is None: - cconn = NULL + cyconn = NULL elif isinstance(conn, (CUeglStreamConnection,)): pconn = conn.getPtr() - cconn = pconn + cyconn = pconn elif isinstance(conn, (int)): - cconn = conn + cyconn = conn else: - raise TypeError("Argument 'conn' is not instance of type (expected , found " + str(type(conn))) - err = ccuda.cuEGLStreamConsumerAcquireFrame(cconn, cpCudaResource, cpStream, timeout) - return (CUresult(err),) -{{endif}} - -{{if True}} + raise TypeError("Argument 'conn' is not instance of type (expected , found " + str(type(conn))) + with nogil: + err = cydriver.cuEGLStreamConsumerAcquireFrame(cyconn, cypCudaResource, cypStream, timeout) + return (_CUresult(err),) @cython.embedsignature(True) def cuEGLStreamConsumerReleaseFrame(conn, pCudaResource, pStream): """ Releases the last frame acquired from the EGLStream. Release the acquired image frame specified by `pCudaResource` to - EGLStreamKHR. If EGL_SUPPORT_REUSE_NV flag is set to EGL_TRUE, at the - time of EGL creation this API doesn't release the last frame acquired - on the EGLStream. By default, EGLStream is created with this flag set - to EGL_TRUE. + :py:obj:`~.EGLStreamKHR`. If EGL_SUPPORT_REUSE_NV flag is set to + EGL_TRUE, at the time of EGL creation this API doesn't release the last + frame acquired on the EGLStream. By default, EGLStream is created with + this flag set to EGL_TRUE. Parameters ---------- @@ -45260,54 +55835,52 @@ def cuEGLStreamConsumerReleaseFrame(conn, pCudaResource, pStream): -------- :py:obj:`~.cuEGLStreamConsumerConnect`, :py:obj:`~.cuEGLStreamConsumerDisconnect`, :py:obj:`~.cuEGLStreamConsumerAcquireFrame`, :py:obj:`~.cuEGLStreamConsumerReleaseFrame`, :py:obj:`~.cudaEGLStreamConsumerReleaseFrame` """ - cdef ccuda.CUstream *cpStream + cdef cydriver.CUstream *cypStream if pStream is None: - cpStream = NULL + cypStream = NULL elif isinstance(pStream, (CUstream,)): ppStream = pStream.getPtr() - cpStream = ppStream + cypStream = ppStream elif isinstance(pStream, (int)): - cpStream = pStream + cypStream = pStream else: - raise TypeError("Argument 'pStream' is not instance of type (expected , found " + str(type(pStream))) - cdef ccuda.CUgraphicsResource cpCudaResource + raise TypeError("Argument 'pStream' is not instance of type (expected , found " + str(type(pStream))) + cdef cydriver.CUgraphicsResource cypCudaResource if pCudaResource is None: - cpCudaResource = 0 + ppCudaResource = 0 elif isinstance(pCudaResource, (CUgraphicsResource,)): ppCudaResource = int(pCudaResource) - cpCudaResource = ppCudaResource else: ppCudaResource = int(CUgraphicsResource(pCudaResource)) - cpCudaResource = ppCudaResource - cdef ccuda.CUeglStreamConnection *cconn + cypCudaResource = ppCudaResource + cdef cydriver.CUeglStreamConnection *cyconn if conn is None: - cconn = NULL + cyconn = NULL elif isinstance(conn, (CUeglStreamConnection,)): pconn = conn.getPtr() - cconn = pconn + cyconn = pconn elif isinstance(conn, (int)): - cconn = conn + cyconn = conn else: - raise TypeError("Argument 'conn' is not instance of type (expected , found " + str(type(conn))) - err = ccuda.cuEGLStreamConsumerReleaseFrame(cconn, cpCudaResource, cpStream) - return (CUresult(err),) -{{endif}} - -{{if True}} + raise TypeError("Argument 'conn' is not instance of type (expected , found " + str(type(conn))) + with nogil: + err = cydriver.cuEGLStreamConsumerReleaseFrame(cyconn, cypCudaResource, cypStream) + return (_CUresult(err),) @cython.embedsignature(True) def cuEGLStreamProducerConnect(stream, width, height): """ Connect CUDA to EGLStream as a producer. - Connect CUDA as a producer to EGLStreamKHR specified by `stream`. + Connect CUDA as a producer to :py:obj:`~.EGLStreamKHR` specified by + `stream`. - The EGLStreamKHR is an EGL object that transfers a sequence of image - frames from one API to another. + The :py:obj:`~.EGLStreamKHR` is an EGL object that transfers a sequence + of image frames from one API to another. Parameters ---------- stream : :py:obj:`~.EGLStreamKHR` - EGLStreamKHR handle + :py:obj:`~.EGLStreamKHR` handle width : :py:obj:`~.EGLint` width of the image to be submitted to the stream height : :py:obj:`~.EGLint` @@ -45324,45 +55897,42 @@ def cuEGLStreamProducerConnect(stream, width, height): -------- :py:obj:`~.cuEGLStreamProducerConnect`, :py:obj:`~.cuEGLStreamProducerDisconnect`, :py:obj:`~.cuEGLStreamProducerPresentFrame`, :py:obj:`~.cudaEGLStreamProducerConnect` """ - cdef ccuda.EGLint cheight + cdef cydriver.EGLint cyheight if height is None: - cheight = 0 + pheight = 0 elif isinstance(height, (EGLint,)): pheight = int(height) - cheight = pheight else: pheight = int(EGLint(height)) - cheight = pheight - cdef ccuda.EGLint cwidth + cyheight = pheight + cdef cydriver.EGLint cywidth if width is None: - cwidth = 0 + pwidth = 0 elif isinstance(width, (EGLint,)): pwidth = int(width) - cwidth = pwidth else: pwidth = int(EGLint(width)) - cwidth = pwidth - cdef ccuda.EGLStreamKHR cstream + cywidth = pwidth + cdef cydriver.EGLStreamKHR cystream if stream is None: - cstream = 0 + pstream = 0 elif isinstance(stream, (EGLStreamKHR,)): pstream = int(stream) - cstream = pstream else: pstream = int(EGLStreamKHR(stream)) - cstream = pstream + cystream = pstream cdef CUeglStreamConnection conn = CUeglStreamConnection() - err = ccuda.cuEGLStreamProducerConnect(conn._ptr, cstream, cwidth, cheight) - return (CUresult(err), conn) -{{endif}} - -{{if True}} + with nogil: + err = cydriver.cuEGLStreamProducerConnect(conn._pvt_ptr, cystream, cywidth, cyheight) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, conn) @cython.embedsignature(True) def cuEGLStreamProducerDisconnect(conn): """ Disconnect CUDA as a producer to EGLStream . - Disconnect CUDA as a producer to EGLStreamKHR. + Disconnect CUDA as a producer to :py:obj:`~.EGLStreamKHR`. Parameters ---------- @@ -45378,21 +55948,19 @@ def cuEGLStreamProducerDisconnect(conn): -------- :py:obj:`~.cuEGLStreamProducerConnect`, :py:obj:`~.cuEGLStreamProducerDisconnect`, :py:obj:`~.cuEGLStreamProducerPresentFrame`, :py:obj:`~.cudaEGLStreamProducerDisconnect` """ - cdef ccuda.CUeglStreamConnection *cconn + cdef cydriver.CUeglStreamConnection *cyconn if conn is None: - cconn = NULL + cyconn = NULL elif isinstance(conn, (CUeglStreamConnection,)): pconn = conn.getPtr() - cconn = pconn + cyconn = pconn elif isinstance(conn, (int)): - cconn = conn + cyconn = conn else: - raise TypeError("Argument 'conn' is not instance of type (expected , found " + str(type(conn))) - err = ccuda.cuEGLStreamProducerDisconnect(cconn) - return (CUresult(err),) -{{endif}} - -{{if True}} + raise TypeError("Argument 'conn' is not instance of type (expected , found " + str(type(conn))) + with nogil: + err = cydriver.cuEGLStreamProducerDisconnect(cyconn) + return (_CUresult(err),) @cython.embedsignature(True) def cuEGLStreamProducerPresentFrame(conn, eglframe not None : CUeglFrame, pStream): @@ -45437,31 +56005,29 @@ def cuEGLStreamProducerPresentFrame(conn, eglframe not None : CUeglFrame, pStrea -------- :py:obj:`~.cuEGLStreamProducerConnect`, :py:obj:`~.cuEGLStreamProducerDisconnect`, :py:obj:`~.cuEGLStreamProducerReturnFrame`, :py:obj:`~.cudaEGLStreamProducerPresentFrame` """ - cdef ccuda.CUstream *cpStream + cdef cydriver.CUstream *cypStream if pStream is None: - cpStream = NULL + cypStream = NULL elif isinstance(pStream, (CUstream,)): ppStream = pStream.getPtr() - cpStream = ppStream + cypStream = ppStream elif isinstance(pStream, (int)): - cpStream = pStream + cypStream = pStream else: - raise TypeError("Argument 'pStream' is not instance of type (expected , found " + str(type(pStream))) - cdef ccuda.CUeglStreamConnection *cconn + raise TypeError("Argument 'pStream' is not instance of type (expected , found " + str(type(pStream))) + cdef cydriver.CUeglStreamConnection *cyconn if conn is None: - cconn = NULL + cyconn = NULL elif isinstance(conn, (CUeglStreamConnection,)): pconn = conn.getPtr() - cconn = pconn + cyconn = pconn elif isinstance(conn, (int)): - cconn = conn + cyconn = conn else: - raise TypeError("Argument 'conn' is not instance of type (expected , found " + str(type(conn))) - err = ccuda.cuEGLStreamProducerPresentFrame(cconn, eglframe._ptr[0], cpStream) - return (CUresult(err),) -{{endif}} - -{{if True}} + raise TypeError("Argument 'conn' is not instance of type (expected , found " + str(type(conn))) + with nogil: + err = cydriver.cuEGLStreamProducerPresentFrame(cyconn, eglframe._pvt_ptr[0], cypStream) + return (_CUresult(err),) @cython.embedsignature(True) def cuEGLStreamProducerReturnFrame(conn, eglframe : Optional[CUeglFrame], pStream): @@ -45490,32 +56056,30 @@ def cuEGLStreamProducerReturnFrame(conn, eglframe : Optional[CUeglFrame], pStrea -------- :py:obj:`~.cuEGLStreamProducerConnect`, :py:obj:`~.cuEGLStreamProducerDisconnect`, :py:obj:`~.cuEGLStreamProducerPresentFrame`, :py:obj:`~.cudaEGLStreamProducerReturnFrame` """ - cdef ccuda.CUstream *cpStream + cdef cydriver.CUstream *cypStream if pStream is None: - cpStream = NULL + cypStream = NULL elif isinstance(pStream, (CUstream,)): ppStream = pStream.getPtr() - cpStream = ppStream + cypStream = ppStream elif isinstance(pStream, (int)): - cpStream = pStream + cypStream = pStream else: - raise TypeError("Argument 'pStream' is not instance of type (expected , found " + str(type(pStream))) - cdef ccuda.CUeglStreamConnection *cconn + raise TypeError("Argument 'pStream' is not instance of type (expected , found " + str(type(pStream))) + cdef cydriver.CUeglStreamConnection *cyconn if conn is None: - cconn = NULL + cyconn = NULL elif isinstance(conn, (CUeglStreamConnection,)): pconn = conn.getPtr() - cconn = pconn + cyconn = pconn elif isinstance(conn, (int)): - cconn = conn + cyconn = conn else: - raise TypeError("Argument 'conn' is not instance of type (expected , found " + str(type(conn))) - cdef ccuda.CUeglFrame* ceglframe_ptr = eglframe._ptr if eglframe != None else NULL - err = ccuda.cuEGLStreamProducerReturnFrame(cconn, ceglframe_ptr, cpStream) - return (CUresult(err),) -{{endif}} - -{{if True}} + raise TypeError("Argument 'conn' is not instance of type (expected , found " + str(type(conn))) + cdef cydriver.CUeglFrame* cyeglframe_ptr = eglframe._pvt_ptr if eglframe is not None else NULL + with nogil: + err = cydriver.cuEGLStreamProducerReturnFrame(cyconn, cyeglframe_ptr, cypStream) + return (_CUresult(err),) @cython.embedsignature(True) def cuGraphicsResourceGetMappedEglFrame(resource, unsigned int index, unsigned int mipLevel): @@ -45548,28 +56112,27 @@ def cuGraphicsResourceGetMappedEglFrame(resource, unsigned int index, unsigned i eglFrame : :py:obj:`~.CUeglFrame` None """ - cdef ccuda.CUgraphicsResource cresource + cdef cydriver.CUgraphicsResource cyresource if resource is None: - cresource = 0 + presource = 0 elif isinstance(resource, (CUgraphicsResource,)): presource = int(resource) - cresource = presource else: presource = int(CUgraphicsResource(resource)) - cresource = presource + cyresource = presource cdef CUeglFrame eglFrame = CUeglFrame() - err = ccuda.cuGraphicsResourceGetMappedEglFrame(eglFrame._ptr, cresource, index, mipLevel) - return (CUresult(err), eglFrame) -{{endif}} - -{{if True}} + with nogil: + err = cydriver.cuGraphicsResourceGetMappedEglFrame(eglFrame._pvt_ptr, cyresource, index, mipLevel) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, eglFrame) @cython.embedsignature(True) def cuEventCreateFromEGLSync(eglSync, unsigned int flags): """ Creates an event from EGLSync object. - Creates an event *phEvent from an EGLSyncKHR eglSync with the flags - specified via `flags`. Valid flags include: + Creates an event *phEvent from an :py:obj:`~.EGLSyncKHR` eglSync with + the flags specified via `flags`. Valid flags include: - :py:obj:`~.CU_EVENT_DEFAULT`: Default event creation flag. @@ -45584,8 +56147,8 @@ def cuEventCreateFromEGLSync(eglSync, unsigned int flags): :py:obj:`~.cuEventRecord` and TimingData are not supported for events created from EGLSync. - The EGLSyncKHR is an opaque handle to an EGL sync object. typedef void* - EGLSyncKHR + The :py:obj:`~.EGLSyncKHR` is an opaque handle to an EGL sync object. + typedef void* :py:obj:`~.EGLSyncKHR` Parameters ---------- @@ -45605,21 +56168,20 @@ def cuEventCreateFromEGLSync(eglSync, unsigned int flags): -------- :py:obj:`~.cuEventQuery`, :py:obj:`~.cuEventSynchronize`, :py:obj:`~.cuEventDestroy` """ - cdef ccuda.EGLSyncKHR ceglSync + cdef cydriver.EGLSyncKHR cyeglSync if eglSync is None: - ceglSync = 0 + peglSync = 0 elif isinstance(eglSync, (EGLSyncKHR,)): peglSync = int(eglSync) - ceglSync = peglSync else: peglSync = int(EGLSyncKHR(eglSync)) - ceglSync = peglSync + cyeglSync = peglSync cdef CUevent phEvent = CUevent() - err = ccuda.cuEventCreateFromEGLSync(phEvent._ptr, ceglSync, flags) - return (CUresult(err), phEvent) -{{endif}} - -{{if True}} + with nogil: + err = cydriver.cuEventCreateFromEGLSync(phEvent._pvt_ptr, cyeglSync, flags) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, phEvent) @cython.embedsignature(True) def cuGraphicsGLRegisterBuffer(buffer, unsigned int Flags): @@ -45660,21 +56222,20 @@ def cuGraphicsGLRegisterBuffer(buffer, unsigned int Flags): -------- :py:obj:`~.cuGraphicsUnregisterResource`, :py:obj:`~.cuGraphicsMapResources`, :py:obj:`~.cuGraphicsResourceGetMappedPointer`, :py:obj:`~.cudaGraphicsGLRegisterBuffer` """ - cdef ccuda.GLuint cbuffer + cdef cydriver.GLuint cybuffer if buffer is None: - cbuffer = 0 + pbuffer = 0 elif isinstance(buffer, (GLuint,)): pbuffer = int(buffer) - cbuffer = pbuffer else: pbuffer = int(GLuint(buffer)) - cbuffer = pbuffer + cybuffer = pbuffer cdef CUgraphicsResource pCudaResource = CUgraphicsResource() - err = ccuda.cuGraphicsGLRegisterBuffer(pCudaResource._ptr, cbuffer, Flags) - return (CUresult(err), pCudaResource) -{{endif}} - -{{if True}} + with nogil: + err = cydriver.cuGraphicsGLRegisterBuffer(pCudaResource._pvt_ptr, cybuffer, Flags) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pCudaResource) @cython.embedsignature(True) def cuGraphicsGLRegisterImage(image, target, unsigned int Flags): @@ -45750,30 +56311,28 @@ def cuGraphicsGLRegisterImage(image, target, unsigned int Flags): -------- :py:obj:`~.cuGraphicsUnregisterResource`, :py:obj:`~.cuGraphicsMapResources`, :py:obj:`~.cuGraphicsSubResourceGetMappedArray`, :py:obj:`~.cudaGraphicsGLRegisterImage` """ - cdef ccuda.GLenum ctarget + cdef cydriver.GLenum cytarget if target is None: - ctarget = 0 + ptarget = 0 elif isinstance(target, (GLenum,)): ptarget = int(target) - ctarget = ptarget else: ptarget = int(GLenum(target)) - ctarget = ptarget - cdef ccuda.GLuint cimage + cytarget = ptarget + cdef cydriver.GLuint cyimage if image is None: - cimage = 0 + pimage = 0 elif isinstance(image, (GLuint,)): pimage = int(image) - cimage = pimage else: pimage = int(GLuint(image)) - cimage = pimage + cyimage = pimage cdef CUgraphicsResource pCudaResource = CUgraphicsResource() - err = ccuda.cuGraphicsGLRegisterImage(pCudaResource._ptr, cimage, ctarget, Flags) - return (CUresult(err), pCudaResource) -{{endif}} - -{{if True}} + with nogil: + err = cydriver.cuGraphicsGLRegisterImage(pCudaResource._pvt_ptr, cyimage, cytarget, Flags) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pCudaResource) @cython.embedsignature(True) def cuGLGetDevices(unsigned int cudaDeviceCount, deviceList not None : CUGLDeviceList): @@ -45811,7 +56370,7 @@ def cuGLGetDevices(unsigned int cudaDeviceCount, deviceList not None : CUGLDevic CUDA_ERROR_INVALID_GRAPHICS_CONTEXT pCudaDeviceCount : unsigned int Returned number of CUDA devices. - pCudaDevices : List[CUdevice] + pCudaDevices : list[CUdevice] Returned CUDA devices. See Also @@ -45824,22 +56383,22 @@ def cuGLGetDevices(unsigned int cudaDeviceCount, deviceList not None : CUGLDevic """ cdef unsigned int pCudaDeviceCount = 0 - cdef ccuda.CUdevice* cpCudaDevices = NULL + cdef cydriver.CUdevice* cypCudaDevices = NULL pypCudaDevices = [] if cudaDeviceCount != 0: - cpCudaDevices = calloc(cudaDeviceCount, sizeof(ccuda.CUdevice)) - if cpCudaDevices is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(cudaDeviceCount) + 'x' + str(sizeof(ccuda.CUdevice))) - cdef ccuda.CUGLDeviceList cdeviceList = deviceList.value - err = ccuda.cuGLGetDevices(&pCudaDeviceCount, cpCudaDevices, cudaDeviceCount, cdeviceList) + cypCudaDevices = calloc(cudaDeviceCount, sizeof(cydriver.CUdevice)) + if cypCudaDevices is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(cudaDeviceCount) + 'x' + str(sizeof(cydriver.CUdevice))) + cdef cydriver.CUGLDeviceList cydeviceList = int(deviceList) + with nogil: + err = cydriver.cuGLGetDevices(&pCudaDeviceCount, cypCudaDevices, cudaDeviceCount, cydeviceList) if CUresult(err) == CUresult(0): - pypCudaDevices = [CUdevice(init_value=cpCudaDevices[idx]) for idx in range(cudaDeviceCount)] - if cpCudaDevices is not NULL: - free(cpCudaDevices) - return (CUresult(err), pCudaDeviceCount, pypCudaDevices) -{{endif}} - -{{if True}} + pypCudaDevices = [CUdevice(init_value=cypCudaDevices[idx]) for idx in range(cudaDeviceCount)] + if cypCudaDevices is not NULL: + free(cypCudaDevices) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None, None) + return (_CUresult_SUCCESS, pCudaDeviceCount, pypCudaDevices) @cython.embedsignature(True) def cuVDPAUGetDevice(vdpDevice, vdpGetProcAddress): @@ -45851,9 +56410,9 @@ def cuVDPAUGetDevice(vdpDevice, vdpGetProcAddress): Parameters ---------- vdpDevice : :py:obj:`~.VdpDevice` - A VdpDevice handle + A :py:obj:`~.VdpDevice` handle vdpGetProcAddress : :py:obj:`~.VdpGetProcAddress` - VDPAU's VdpGetProcAddress function pointer + VDPAU's :py:obj:`~.VdpGetProcAddress` function pointer Returns ------- @@ -45866,31 +56425,30 @@ def cuVDPAUGetDevice(vdpDevice, vdpGetProcAddress): -------- :py:obj:`~.cuCtxCreate`, :py:obj:`~.cuVDPAUCtxCreate`, :py:obj:`~.cuGraphicsVDPAURegisterVideoSurface`, :py:obj:`~.cuGraphicsVDPAURegisterOutputSurface`, :py:obj:`~.cuGraphicsUnregisterResource`, :py:obj:`~.cuGraphicsResourceSetMapFlags`, :py:obj:`~.cuGraphicsMapResources`, :py:obj:`~.cuGraphicsUnmapResources`, :py:obj:`~.cuGraphicsSubResourceGetMappedArray`, :py:obj:`~.cudaVDPAUGetDevice` """ - cdef ccuda.VdpGetProcAddress *cvdpGetProcAddress + cdef cydriver.VdpGetProcAddress *cyvdpGetProcAddress if vdpGetProcAddress is None: - cvdpGetProcAddress = NULL + cyvdpGetProcAddress = NULL elif isinstance(vdpGetProcAddress, (VdpGetProcAddress,)): pvdpGetProcAddress = vdpGetProcAddress.getPtr() - cvdpGetProcAddress = pvdpGetProcAddress + cyvdpGetProcAddress = pvdpGetProcAddress elif isinstance(vdpGetProcAddress, (int)): - cvdpGetProcAddress = vdpGetProcAddress + cyvdpGetProcAddress = vdpGetProcAddress else: - raise TypeError("Argument 'vdpGetProcAddress' is not instance of type (expected , found " + str(type(vdpGetProcAddress))) - cdef ccuda.VdpDevice cvdpDevice + raise TypeError("Argument 'vdpGetProcAddress' is not instance of type (expected , found " + str(type(vdpGetProcAddress))) + cdef cydriver.VdpDevice cyvdpDevice if vdpDevice is None: - cvdpDevice = 0 + pvdpDevice = 0 elif isinstance(vdpDevice, (VdpDevice,)): pvdpDevice = int(vdpDevice) - cvdpDevice = pvdpDevice else: pvdpDevice = int(VdpDevice(vdpDevice)) - cvdpDevice = pvdpDevice + cyvdpDevice = pvdpDevice cdef CUdevice pDevice = CUdevice() - err = ccuda.cuVDPAUGetDevice(pDevice._ptr, cvdpDevice, cvdpGetProcAddress) - return (CUresult(err), pDevice) -{{endif}} - -{{if True}} + with nogil: + err = cydriver.cuVDPAUGetDevice(pDevice._pvt_ptr, cyvdpDevice, cyvdpGetProcAddress) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pDevice) @cython.embedsignature(True) def cuVDPAUCtxCreate(unsigned int flags, device, vdpDevice, vdpGetProcAddress): @@ -45909,9 +56467,9 @@ def cuVDPAUCtxCreate(unsigned int flags, device, vdpDevice, vdpGetProcAddress): device : :py:obj:`~.CUdevice` Device on which to create the context vdpDevice : :py:obj:`~.VdpDevice` - The VdpDevice to interop with + The :py:obj:`~.VdpDevice` to interop with vdpGetProcAddress : :py:obj:`~.VdpGetProcAddress` - VDPAU's VdpGetProcAddress function pointer + VDPAU's :py:obj:`~.VdpGetProcAddress` function pointer Returns ------- @@ -45924,48 +56482,47 @@ def cuVDPAUCtxCreate(unsigned int flags, device, vdpDevice, vdpGetProcAddress): -------- :py:obj:`~.cuCtxCreate`, :py:obj:`~.cuGraphicsVDPAURegisterVideoSurface`, :py:obj:`~.cuGraphicsVDPAURegisterOutputSurface`, :py:obj:`~.cuGraphicsUnregisterResource`, :py:obj:`~.cuGraphicsResourceSetMapFlags`, :py:obj:`~.cuGraphicsMapResources`, :py:obj:`~.cuGraphicsUnmapResources`, :py:obj:`~.cuGraphicsSubResourceGetMappedArray`, :py:obj:`~.cuVDPAUGetDevice` """ - cdef ccuda.VdpGetProcAddress *cvdpGetProcAddress + cdef cydriver.VdpGetProcAddress *cyvdpGetProcAddress if vdpGetProcAddress is None: - cvdpGetProcAddress = NULL + cyvdpGetProcAddress = NULL elif isinstance(vdpGetProcAddress, (VdpGetProcAddress,)): pvdpGetProcAddress = vdpGetProcAddress.getPtr() - cvdpGetProcAddress = pvdpGetProcAddress + cyvdpGetProcAddress = pvdpGetProcAddress elif isinstance(vdpGetProcAddress, (int)): - cvdpGetProcAddress = vdpGetProcAddress + cyvdpGetProcAddress = vdpGetProcAddress else: - raise TypeError("Argument 'vdpGetProcAddress' is not instance of type (expected , found " + str(type(vdpGetProcAddress))) - cdef ccuda.VdpDevice cvdpDevice + raise TypeError("Argument 'vdpGetProcAddress' is not instance of type (expected , found " + str(type(vdpGetProcAddress))) + cdef cydriver.VdpDevice cyvdpDevice if vdpDevice is None: - cvdpDevice = 0 + pvdpDevice = 0 elif isinstance(vdpDevice, (VdpDevice,)): pvdpDevice = int(vdpDevice) - cvdpDevice = pvdpDevice else: pvdpDevice = int(VdpDevice(vdpDevice)) - cvdpDevice = pvdpDevice - cdef ccuda.CUdevice cdevice + cyvdpDevice = pvdpDevice + cdef cydriver.CUdevice cydevice if device is None: - cdevice = 0 + pdevice = 0 elif isinstance(device, (CUdevice,)): pdevice = int(device) - cdevice = pdevice else: pdevice = int(CUdevice(device)) - cdevice = pdevice + cydevice = pdevice cdef CUcontext pCtx = CUcontext() - err = ccuda.cuVDPAUCtxCreate(pCtx._ptr, flags, cdevice, cvdpDevice, cvdpGetProcAddress) - return (CUresult(err), pCtx) -{{endif}} - -{{if True}} + with nogil: + err = cydriver.cuVDPAUCtxCreate(pCtx._pvt_ptr, flags, cydevice, cyvdpDevice, cyvdpGetProcAddress) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pCtx) @cython.embedsignature(True) def cuGraphicsVDPAURegisterVideoSurface(vdpSurface, unsigned int flags): - """ Registers a VDPAU VdpVideoSurface object. + """ Registers a VDPAU :py:obj:`~.VdpVideoSurface` object. - Registers the VdpVideoSurface specified by `vdpSurface` for access by - CUDA. A handle to the registered object is returned as `pCudaResource`. - The surface's intended usage is specified using `flags`, as follows: + Registers the :py:obj:`~.VdpVideoSurface` specified by `vdpSurface` for + access by CUDA. A handle to the registered object is returned as + `pCudaResource`. The surface's intended usage is specified using + `flags`, as follows: - :py:obj:`~.CU_GRAPHICS_MAP_RESOURCE_FLAGS_NONE`: Specifies no hints about how this resource will be used. It is therefore assumed that @@ -45980,8 +56537,8 @@ def cuGraphicsVDPAURegisterVideoSurface(vdpSurface, unsigned int flags): entire contents of the resource, so none of the data previously stored in the resource will be preserved. - The VdpVideoSurface is presented as an array of subresources that may - be accessed using pointers returned by + The :py:obj:`~.VdpVideoSurface` is presented as an array of + subresources that may be accessed using pointers returned by :py:obj:`~.cuGraphicsSubResourceGetMappedArray`. The exact number of valid `arrayIndex` values depends on the VDPAU surface format. The mapping is shown in the table below. `mipLevel` must be 0. @@ -45989,7 +56546,7 @@ def cuGraphicsVDPAURegisterVideoSurface(vdpSurface, unsigned int flags): Parameters ---------- vdpSurface : :py:obj:`~.VdpVideoSurface` - The VdpVideoSurface to be registered + The :py:obj:`~.VdpVideoSurface` to be registered flags : unsigned int Map flags @@ -46004,29 +56561,29 @@ def cuGraphicsVDPAURegisterVideoSurface(vdpSurface, unsigned int flags): -------- :py:obj:`~.cuCtxCreate`, :py:obj:`~.cuVDPAUCtxCreate`, :py:obj:`~.cuGraphicsVDPAURegisterOutputSurface`, :py:obj:`~.cuGraphicsUnregisterResource`, :py:obj:`~.cuGraphicsResourceSetMapFlags`, :py:obj:`~.cuGraphicsMapResources`, :py:obj:`~.cuGraphicsUnmapResources`, :py:obj:`~.cuGraphicsSubResourceGetMappedArray`, :py:obj:`~.cuVDPAUGetDevice`, :py:obj:`~.cudaGraphicsVDPAURegisterVideoSurface` """ - cdef ccuda.VdpVideoSurface cvdpSurface + cdef cydriver.VdpVideoSurface cyvdpSurface if vdpSurface is None: - cvdpSurface = 0 + pvdpSurface = 0 elif isinstance(vdpSurface, (VdpVideoSurface,)): pvdpSurface = int(vdpSurface) - cvdpSurface = pvdpSurface else: pvdpSurface = int(VdpVideoSurface(vdpSurface)) - cvdpSurface = pvdpSurface + cyvdpSurface = pvdpSurface cdef CUgraphicsResource pCudaResource = CUgraphicsResource() - err = ccuda.cuGraphicsVDPAURegisterVideoSurface(pCudaResource._ptr, cvdpSurface, flags) - return (CUresult(err), pCudaResource) -{{endif}} - -{{if True}} + with nogil: + err = cydriver.cuGraphicsVDPAURegisterVideoSurface(pCudaResource._pvt_ptr, cyvdpSurface, flags) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pCudaResource) @cython.embedsignature(True) def cuGraphicsVDPAURegisterOutputSurface(vdpSurface, unsigned int flags): - """ Registers a VDPAU VdpOutputSurface object. + """ Registers a VDPAU :py:obj:`~.VdpOutputSurface` object. - Registers the VdpOutputSurface specified by `vdpSurface` for access by - CUDA. A handle to the registered object is returned as `pCudaResource`. - The surface's intended usage is specified using `flags`, as follows: + Registers the :py:obj:`~.VdpOutputSurface` specified by `vdpSurface` + for access by CUDA. A handle to the registered object is returned as + `pCudaResource`. The surface's intended usage is specified using + `flags`, as follows: - :py:obj:`~.CU_GRAPHICS_MAP_RESOURCE_FLAGS_NONE`: Specifies no hints about how this resource will be used. It is therefore assumed that @@ -46041,8 +56598,8 @@ def cuGraphicsVDPAURegisterOutputSurface(vdpSurface, unsigned int flags): entire contents of the resource, so none of the data previously stored in the resource will be preserved. - The VdpOutputSurface is presented as an array of subresources that may - be accessed using pointers returned by + The :py:obj:`~.VdpOutputSurface` is presented as an array of + subresources that may be accessed using pointers returned by :py:obj:`~.cuGraphicsSubResourceGetMappedArray`. The exact number of valid `arrayIndex` values depends on the VDPAU surface format. The mapping is shown in the table below. `mipLevel` must be 0. @@ -46050,7 +56607,7 @@ def cuGraphicsVDPAURegisterOutputSurface(vdpSurface, unsigned int flags): Parameters ---------- vdpSurface : :py:obj:`~.VdpOutputSurface` - The VdpOutputSurface to be registered + The :py:obj:`~.VdpOutputSurface` to be registered flags : unsigned int Map flags @@ -46065,19 +56622,30 @@ def cuGraphicsVDPAURegisterOutputSurface(vdpSurface, unsigned int flags): -------- :py:obj:`~.cuCtxCreate`, :py:obj:`~.cuVDPAUCtxCreate`, :py:obj:`~.cuGraphicsVDPAURegisterVideoSurface`, :py:obj:`~.cuGraphicsUnregisterResource`, :py:obj:`~.cuGraphicsResourceSetMapFlags`, :py:obj:`~.cuGraphicsMapResources`, :py:obj:`~.cuGraphicsUnmapResources`, :py:obj:`~.cuGraphicsSubResourceGetMappedArray`, :py:obj:`~.cuVDPAUGetDevice`, :py:obj:`~.cudaGraphicsVDPAURegisterOutputSurface` """ - cdef ccuda.VdpOutputSurface cvdpSurface + cdef cydriver.VdpOutputSurface cyvdpSurface if vdpSurface is None: - cvdpSurface = 0 + pvdpSurface = 0 elif isinstance(vdpSurface, (VdpOutputSurface,)): pvdpSurface = int(vdpSurface) - cvdpSurface = pvdpSurface else: pvdpSurface = int(VdpOutputSurface(vdpSurface)) - cvdpSurface = pvdpSurface + cyvdpSurface = pvdpSurface cdef CUgraphicsResource pCudaResource = CUgraphicsResource() - err = ccuda.cuGraphicsVDPAURegisterOutputSurface(pCudaResource._ptr, cvdpSurface, flags) - return (CUresult(err), pCudaResource) -{{endif}} + with nogil: + err = cydriver.cuGraphicsVDPAURegisterOutputSurface(pCudaResource._pvt_ptr, cyvdpSurface, flags) + if err != cydriver.CUDA_SUCCESS: + return (_CUresult(err), None) + return (_CUresult_SUCCESS, pCudaResource) + +cdef class cudaBindingsDriverGlobal: + cdef map[void_ptr, void*] _allocated + + def __dealloc__(self): + for item in self._allocated: + free(item.second) + self._allocated.clear() + +cdef cudaBindingsDriverGlobal m_global = cudaBindingsDriverGlobal() @cython.embedsignature(True) def sizeof(objType): @@ -46093,724 +56661,993 @@ def sizeof(objType): lowered_name : int The size of `objType` in bytes """ - {{if 'cuuint32_t' in found_types}} + if objType == cuuint32_t: - return sizeof(ccuda.cuuint32_t){{endif}} - {{if 'cuuint64_t' in found_types}} + return sizeof(cydriver.cuuint32_t) + if objType == cuuint64_t: - return sizeof(ccuda.cuuint64_t){{endif}} - {{if 'CUdeviceptr_v2' in found_types}} + return sizeof(cydriver.cuuint64_t) + if objType == CUdeviceptr_v2: - return sizeof(ccuda.CUdeviceptr_v2){{endif}} - {{if 'CUdeviceptr' in found_types}} + return sizeof(cydriver.CUdeviceptr_v2) + if objType == CUdeviceptr: - return sizeof(ccuda.CUdeviceptr){{endif}} - {{if 'CUdevice_v1' in found_types}} + return sizeof(cydriver.CUdeviceptr) + if objType == CUdevice_v1: - return sizeof(ccuda.CUdevice_v1){{endif}} - {{if 'CUdevice' in found_types}} + return sizeof(cydriver.CUdevice_v1) + if objType == CUdevice: - return sizeof(ccuda.CUdevice){{endif}} - {{if 'CUcontext' in found_types}} + return sizeof(cydriver.CUdevice) + if objType == CUcontext: - return sizeof(ccuda.CUcontext){{endif}} - {{if 'CUmodule' in found_types}} + return sizeof(cydriver.CUcontext) + if objType == CUmodule: - return sizeof(ccuda.CUmodule){{endif}} - {{if 'CUfunction' in found_types}} + return sizeof(cydriver.CUmodule) + if objType == CUfunction: - return sizeof(ccuda.CUfunction){{endif}} - {{if 'CUlibrary' in found_types}} + return sizeof(cydriver.CUfunction) + if objType == CUlibrary: - return sizeof(ccuda.CUlibrary){{endif}} - {{if 'CUkernel' in found_types}} + return sizeof(cydriver.CUlibrary) + if objType == CUkernel: - return sizeof(ccuda.CUkernel){{endif}} - {{if 'CUarray' in found_types}} + return sizeof(cydriver.CUkernel) + if objType == CUarray: - return sizeof(ccuda.CUarray){{endif}} - {{if 'CUmipmappedArray' in found_types}} + return sizeof(cydriver.CUarray) + if objType == CUmipmappedArray: - return sizeof(ccuda.CUmipmappedArray){{endif}} - {{if 'CUtexref' in found_types}} + return sizeof(cydriver.CUmipmappedArray) + if objType == CUtexref: - return sizeof(ccuda.CUtexref){{endif}} - {{if 'CUsurfref' in found_types}} + return sizeof(cydriver.CUtexref) + if objType == CUsurfref: - return sizeof(ccuda.CUsurfref){{endif}} - {{if 'CUevent' in found_types}} + return sizeof(cydriver.CUsurfref) + if objType == CUevent: - return sizeof(ccuda.CUevent){{endif}} - {{if 'CUstream' in found_types}} + return sizeof(cydriver.CUevent) + if objType == CUstream: - return sizeof(ccuda.CUstream){{endif}} - {{if 'CUgraphicsResource' in found_types}} + return sizeof(cydriver.CUstream) + if objType == CUgraphicsResource: - return sizeof(ccuda.CUgraphicsResource){{endif}} - {{if 'CUtexObject_v1' in found_types}} + return sizeof(cydriver.CUgraphicsResource) + if objType == CUtexObject_v1: - return sizeof(ccuda.CUtexObject_v1){{endif}} - {{if 'CUtexObject' in found_types}} + return sizeof(cydriver.CUtexObject_v1) + if objType == CUtexObject: - return sizeof(ccuda.CUtexObject){{endif}} - {{if 'CUsurfObject_v1' in found_types}} + return sizeof(cydriver.CUtexObject) + if objType == CUsurfObject_v1: - return sizeof(ccuda.CUsurfObject_v1){{endif}} - {{if 'CUsurfObject' in found_types}} + return sizeof(cydriver.CUsurfObject_v1) + if objType == CUsurfObject: - return sizeof(ccuda.CUsurfObject){{endif}} - {{if 'CUexternalMemory' in found_types}} + return sizeof(cydriver.CUsurfObject) + if objType == CUexternalMemory: - return sizeof(ccuda.CUexternalMemory){{endif}} - {{if 'CUexternalSemaphore' in found_types}} + return sizeof(cydriver.CUexternalMemory) + if objType == CUexternalSemaphore: - return sizeof(ccuda.CUexternalSemaphore){{endif}} - {{if 'CUgraph' in found_types}} + return sizeof(cydriver.CUexternalSemaphore) + if objType == CUgraph: - return sizeof(ccuda.CUgraph){{endif}} - {{if 'CUgraphNode' in found_types}} + return sizeof(cydriver.CUgraph) + if objType == CUgraphNode: - return sizeof(ccuda.CUgraphNode){{endif}} - {{if 'CUgraphExec' in found_types}} + return sizeof(cydriver.CUgraphNode) + if objType == CUgraphExec: - return sizeof(ccuda.CUgraphExec){{endif}} - {{if 'CUmemoryPool' in found_types}} + return sizeof(cydriver.CUgraphExec) + if objType == CUmemoryPool: - return sizeof(ccuda.CUmemoryPool){{endif}} - {{if 'CUuserObject' in found_types}} + return sizeof(cydriver.CUmemoryPool) + if objType == CUuserObject: - return sizeof(ccuda.CUuserObject){{endif}} - {{if 'CUgraphConditionalHandle' in found_types}} + return sizeof(cydriver.CUuserObject) + if objType == CUgraphConditionalHandle: - return sizeof(ccuda.CUgraphConditionalHandle){{endif}} - {{if 'CUgraphDeviceNode' in found_types}} + return sizeof(cydriver.CUgraphConditionalHandle) + if objType == CUgraphDeviceNode: - return sizeof(ccuda.CUgraphDeviceNode){{endif}} - {{if 'CUasyncCallbackHandle' in found_types}} + return sizeof(cydriver.CUgraphDeviceNode) + if objType == CUasyncCallbackHandle: - return sizeof(ccuda.CUasyncCallbackHandle){{endif}} - {{if 'CUgreenCtx' in found_types}} + return sizeof(cydriver.CUasyncCallbackHandle) + if objType == CUgreenCtx: - return sizeof(ccuda.CUgreenCtx){{endif}} - {{if 'struct CUuuid_st' in found_types}} + return sizeof(cydriver.CUgreenCtx) + if objType == CUuuid_st: - return sizeof(ccuda.CUuuid_st){{endif}} - {{if 'CUuuid' in found_types}} + return sizeof(cydriver.CUuuid_st) + if objType == CUuuid: - return sizeof(ccuda.CUuuid){{endif}} - {{if 'struct CUmemFabricHandle_st' in found_types}} + return sizeof(cydriver.CUuuid) + if objType == CUmemFabricHandle_st: - return sizeof(ccuda.CUmemFabricHandle_st){{endif}} - {{if 'CUmemFabricHandle_v1' in found_types}} + return sizeof(cydriver.CUmemFabricHandle_st) + if objType == CUmemFabricHandle_v1: - return sizeof(ccuda.CUmemFabricHandle_v1){{endif}} - {{if 'CUmemFabricHandle' in found_types}} + return sizeof(cydriver.CUmemFabricHandle_v1) + if objType == CUmemFabricHandle: - return sizeof(ccuda.CUmemFabricHandle){{endif}} - {{if 'struct CUipcEventHandle_st' in found_types}} + return sizeof(cydriver.CUmemFabricHandle) + if objType == CUipcEventHandle_st: - return sizeof(ccuda.CUipcEventHandle_st){{endif}} - {{if 'CUipcEventHandle_v1' in found_types}} + return sizeof(cydriver.CUipcEventHandle_st) + if objType == CUipcEventHandle_v1: - return sizeof(ccuda.CUipcEventHandle_v1){{endif}} - {{if 'CUipcEventHandle' in found_types}} + return sizeof(cydriver.CUipcEventHandle_v1) + if objType == CUipcEventHandle: - return sizeof(ccuda.CUipcEventHandle){{endif}} - {{if 'struct CUipcMemHandle_st' in found_types}} + return sizeof(cydriver.CUipcEventHandle) + if objType == CUipcMemHandle_st: - return sizeof(ccuda.CUipcMemHandle_st){{endif}} - {{if 'CUipcMemHandle_v1' in found_types}} + return sizeof(cydriver.CUipcMemHandle_st) + if objType == CUipcMemHandle_v1: - return sizeof(ccuda.CUipcMemHandle_v1){{endif}} - {{if 'CUipcMemHandle' in found_types}} + return sizeof(cydriver.CUipcMemHandle_v1) + if objType == CUipcMemHandle: - return sizeof(ccuda.CUipcMemHandle){{endif}} - {{if 'union CUstreamBatchMemOpParams_union' in found_types}} + return sizeof(cydriver.CUipcMemHandle) + if objType == CUstreamBatchMemOpParams_union: - return sizeof(ccuda.CUstreamBatchMemOpParams_union){{endif}} - {{if 'CUstreamBatchMemOpParams_v1' in found_types}} + return sizeof(cydriver.CUstreamBatchMemOpParams_union) + if objType == CUstreamBatchMemOpParams_v1: - return sizeof(ccuda.CUstreamBatchMemOpParams_v1){{endif}} - {{if 'CUstreamBatchMemOpParams' in found_types}} + return sizeof(cydriver.CUstreamBatchMemOpParams_v1) + if objType == CUstreamBatchMemOpParams: - return sizeof(ccuda.CUstreamBatchMemOpParams){{endif}} - {{if 'struct CUDA_BATCH_MEM_OP_NODE_PARAMS_v1_st' in found_types}} + return sizeof(cydriver.CUstreamBatchMemOpParams) + if objType == CUDA_BATCH_MEM_OP_NODE_PARAMS_v1_st: - return sizeof(ccuda.CUDA_BATCH_MEM_OP_NODE_PARAMS_v1_st){{endif}} - {{if 'CUDA_BATCH_MEM_OP_NODE_PARAMS_v1' in found_types}} + return sizeof(cydriver.CUDA_BATCH_MEM_OP_NODE_PARAMS_v1_st) + if objType == CUDA_BATCH_MEM_OP_NODE_PARAMS_v1: - return sizeof(ccuda.CUDA_BATCH_MEM_OP_NODE_PARAMS_v1){{endif}} - {{if 'CUDA_BATCH_MEM_OP_NODE_PARAMS' in found_types}} + return sizeof(cydriver.CUDA_BATCH_MEM_OP_NODE_PARAMS_v1) + if objType == CUDA_BATCH_MEM_OP_NODE_PARAMS: - return sizeof(ccuda.CUDA_BATCH_MEM_OP_NODE_PARAMS){{endif}} - {{if 'struct CUDA_BATCH_MEM_OP_NODE_PARAMS_v2_st' in found_types}} + return sizeof(cydriver.CUDA_BATCH_MEM_OP_NODE_PARAMS) + if objType == CUDA_BATCH_MEM_OP_NODE_PARAMS_v2_st: - return sizeof(ccuda.CUDA_BATCH_MEM_OP_NODE_PARAMS_v2_st){{endif}} - {{if 'CUDA_BATCH_MEM_OP_NODE_PARAMS_v2' in found_types}} + return sizeof(cydriver.CUDA_BATCH_MEM_OP_NODE_PARAMS_v2_st) + if objType == CUDA_BATCH_MEM_OP_NODE_PARAMS_v2: - return sizeof(ccuda.CUDA_BATCH_MEM_OP_NODE_PARAMS_v2){{endif}} - {{if 'struct CUasyncNotificationInfo_st' in found_types}} + return sizeof(cydriver.CUDA_BATCH_MEM_OP_NODE_PARAMS_v2) + if objType == CUasyncNotificationInfo_st: - return sizeof(ccuda.CUasyncNotificationInfo_st){{endif}} - {{if 'CUasyncNotificationInfo' in found_types}} + return sizeof(cydriver.CUasyncNotificationInfo_st) + if objType == CUasyncNotificationInfo: - return sizeof(ccuda.CUasyncNotificationInfo){{endif}} - {{if 'CUasyncCallback' in found_types}} + return sizeof(cydriver.CUasyncNotificationInfo) + if objType == CUasyncCallback: - return sizeof(ccuda.CUasyncCallback){{endif}} - {{if 'struct CUdevprop_st' in found_types}} + return sizeof(cydriver.CUasyncCallback) + if objType == CUdevprop_st: - return sizeof(ccuda.CUdevprop_st){{endif}} - {{if 'CUdevprop_v1' in found_types}} + return sizeof(cydriver.CUdevprop_st) + if objType == CUdevprop_v1: - return sizeof(ccuda.CUdevprop_v1){{endif}} - {{if 'CUdevprop' in found_types}} + return sizeof(cydriver.CUdevprop_v1) + if objType == CUdevprop: - return sizeof(ccuda.CUdevprop){{endif}} - {{if 'CUlinkState' in found_types}} + return sizeof(cydriver.CUdevprop) + if objType == CUlinkState: - return sizeof(ccuda.CUlinkState){{endif}} - {{if 'CUhostFn' in found_types}} + return sizeof(cydriver.CUlinkState) + if objType == CUhostFn: - return sizeof(ccuda.CUhostFn){{endif}} - {{if 'struct CUaccessPolicyWindow_st' in found_types}} + return sizeof(cydriver.CUhostFn) + if objType == CUaccessPolicyWindow_st: - return sizeof(ccuda.CUaccessPolicyWindow_st){{endif}} - {{if 'CUaccessPolicyWindow_v1' in found_types}} + return sizeof(cydriver.CUaccessPolicyWindow_st) + if objType == CUaccessPolicyWindow_v1: - return sizeof(ccuda.CUaccessPolicyWindow_v1){{endif}} - {{if 'CUaccessPolicyWindow' in found_types}} + return sizeof(cydriver.CUaccessPolicyWindow_v1) + if objType == CUaccessPolicyWindow: - return sizeof(ccuda.CUaccessPolicyWindow){{endif}} - {{if 'struct CUDA_KERNEL_NODE_PARAMS_st' in found_types}} + return sizeof(cydriver.CUaccessPolicyWindow) + if objType == CUDA_KERNEL_NODE_PARAMS_st: - return sizeof(ccuda.CUDA_KERNEL_NODE_PARAMS_st){{endif}} - {{if 'CUDA_KERNEL_NODE_PARAMS_v1' in found_types}} + return sizeof(cydriver.CUDA_KERNEL_NODE_PARAMS_st) + if objType == CUDA_KERNEL_NODE_PARAMS_v1: - return sizeof(ccuda.CUDA_KERNEL_NODE_PARAMS_v1){{endif}} - {{if 'struct CUDA_KERNEL_NODE_PARAMS_v2_st' in found_types}} + return sizeof(cydriver.CUDA_KERNEL_NODE_PARAMS_v1) + if objType == CUDA_KERNEL_NODE_PARAMS_v2_st: - return sizeof(ccuda.CUDA_KERNEL_NODE_PARAMS_v2_st){{endif}} - {{if 'CUDA_KERNEL_NODE_PARAMS_v2' in found_types}} + return sizeof(cydriver.CUDA_KERNEL_NODE_PARAMS_v2_st) + if objType == CUDA_KERNEL_NODE_PARAMS_v2: - return sizeof(ccuda.CUDA_KERNEL_NODE_PARAMS_v2){{endif}} - {{if 'CUDA_KERNEL_NODE_PARAMS' in found_types}} + return sizeof(cydriver.CUDA_KERNEL_NODE_PARAMS_v2) + if objType == CUDA_KERNEL_NODE_PARAMS: - return sizeof(ccuda.CUDA_KERNEL_NODE_PARAMS){{endif}} - {{if 'struct CUDA_KERNEL_NODE_PARAMS_v3_st' in found_types}} + return sizeof(cydriver.CUDA_KERNEL_NODE_PARAMS) + if objType == CUDA_KERNEL_NODE_PARAMS_v3_st: - return sizeof(ccuda.CUDA_KERNEL_NODE_PARAMS_v3_st){{endif}} - {{if 'CUDA_KERNEL_NODE_PARAMS_v3' in found_types}} + return sizeof(cydriver.CUDA_KERNEL_NODE_PARAMS_v3_st) + if objType == CUDA_KERNEL_NODE_PARAMS_v3: - return sizeof(ccuda.CUDA_KERNEL_NODE_PARAMS_v3){{endif}} - {{if 'struct CUDA_MEMSET_NODE_PARAMS_st' in found_types}} + return sizeof(cydriver.CUDA_KERNEL_NODE_PARAMS_v3) + if objType == CUDA_MEMSET_NODE_PARAMS_st: - return sizeof(ccuda.CUDA_MEMSET_NODE_PARAMS_st){{endif}} - {{if 'CUDA_MEMSET_NODE_PARAMS_v1' in found_types}} + return sizeof(cydriver.CUDA_MEMSET_NODE_PARAMS_st) + if objType == CUDA_MEMSET_NODE_PARAMS_v1: - return sizeof(ccuda.CUDA_MEMSET_NODE_PARAMS_v1){{endif}} - {{if 'CUDA_MEMSET_NODE_PARAMS' in found_types}} + return sizeof(cydriver.CUDA_MEMSET_NODE_PARAMS_v1) + if objType == CUDA_MEMSET_NODE_PARAMS: - return sizeof(ccuda.CUDA_MEMSET_NODE_PARAMS){{endif}} - {{if 'struct CUDA_MEMSET_NODE_PARAMS_v2_st' in found_types}} + return sizeof(cydriver.CUDA_MEMSET_NODE_PARAMS) + if objType == CUDA_MEMSET_NODE_PARAMS_v2_st: - return sizeof(ccuda.CUDA_MEMSET_NODE_PARAMS_v2_st){{endif}} - {{if 'CUDA_MEMSET_NODE_PARAMS_v2' in found_types}} + return sizeof(cydriver.CUDA_MEMSET_NODE_PARAMS_v2_st) + if objType == CUDA_MEMSET_NODE_PARAMS_v2: - return sizeof(ccuda.CUDA_MEMSET_NODE_PARAMS_v2){{endif}} - {{if 'struct CUDA_HOST_NODE_PARAMS_st' in found_types}} + return sizeof(cydriver.CUDA_MEMSET_NODE_PARAMS_v2) + if objType == CUDA_HOST_NODE_PARAMS_st: - return sizeof(ccuda.CUDA_HOST_NODE_PARAMS_st){{endif}} - {{if 'CUDA_HOST_NODE_PARAMS_v1' in found_types}} + return sizeof(cydriver.CUDA_HOST_NODE_PARAMS_st) + if objType == CUDA_HOST_NODE_PARAMS_v1: - return sizeof(ccuda.CUDA_HOST_NODE_PARAMS_v1){{endif}} - {{if 'CUDA_HOST_NODE_PARAMS' in found_types}} + return sizeof(cydriver.CUDA_HOST_NODE_PARAMS_v1) + if objType == CUDA_HOST_NODE_PARAMS: - return sizeof(ccuda.CUDA_HOST_NODE_PARAMS){{endif}} - {{if 'struct CUDA_HOST_NODE_PARAMS_v2_st' in found_types}} + return sizeof(cydriver.CUDA_HOST_NODE_PARAMS) + if objType == CUDA_HOST_NODE_PARAMS_v2_st: - return sizeof(ccuda.CUDA_HOST_NODE_PARAMS_v2_st){{endif}} - {{if 'CUDA_HOST_NODE_PARAMS_v2' in found_types}} + return sizeof(cydriver.CUDA_HOST_NODE_PARAMS_v2_st) + if objType == CUDA_HOST_NODE_PARAMS_v2: - return sizeof(ccuda.CUDA_HOST_NODE_PARAMS_v2){{endif}} - {{if 'struct CUDA_CONDITIONAL_NODE_PARAMS' in found_types}} + return sizeof(cydriver.CUDA_HOST_NODE_PARAMS_v2) + if objType == CUDA_CONDITIONAL_NODE_PARAMS: - return sizeof(ccuda.CUDA_CONDITIONAL_NODE_PARAMS){{endif}} - {{if 'struct CUgraphEdgeData_st' in found_types}} + return sizeof(cydriver.CUDA_CONDITIONAL_NODE_PARAMS) + if objType == CUgraphEdgeData_st: - return sizeof(ccuda.CUgraphEdgeData_st){{endif}} - {{if 'CUgraphEdgeData' in found_types}} + return sizeof(cydriver.CUgraphEdgeData_st) + if objType == CUgraphEdgeData: - return sizeof(ccuda.CUgraphEdgeData){{endif}} - {{if 'struct CUDA_GRAPH_INSTANTIATE_PARAMS_st' in found_types}} + return sizeof(cydriver.CUgraphEdgeData) + if objType == CUDA_GRAPH_INSTANTIATE_PARAMS_st: - return sizeof(ccuda.CUDA_GRAPH_INSTANTIATE_PARAMS_st){{endif}} - {{if 'CUDA_GRAPH_INSTANTIATE_PARAMS' in found_types}} + return sizeof(cydriver.CUDA_GRAPH_INSTANTIATE_PARAMS_st) + if objType == CUDA_GRAPH_INSTANTIATE_PARAMS: - return sizeof(ccuda.CUDA_GRAPH_INSTANTIATE_PARAMS){{endif}} - {{if 'struct CUlaunchMemSyncDomainMap_st' in found_types}} + return sizeof(cydriver.CUDA_GRAPH_INSTANTIATE_PARAMS) + if objType == CUlaunchMemSyncDomainMap_st: - return sizeof(ccuda.CUlaunchMemSyncDomainMap_st){{endif}} - {{if 'CUlaunchMemSyncDomainMap' in found_types}} + return sizeof(cydriver.CUlaunchMemSyncDomainMap_st) + if objType == CUlaunchMemSyncDomainMap: - return sizeof(ccuda.CUlaunchMemSyncDomainMap){{endif}} - {{if 'union CUlaunchAttributeValue_union' in found_types}} + return sizeof(cydriver.CUlaunchMemSyncDomainMap) + if objType == CUlaunchAttributeValue_union: - return sizeof(ccuda.CUlaunchAttributeValue_union){{endif}} - {{if 'CUlaunchAttributeValue' in found_types}} + return sizeof(cydriver.CUlaunchAttributeValue_union) + if objType == CUlaunchAttributeValue: - return sizeof(ccuda.CUlaunchAttributeValue){{endif}} - {{if 'struct CUlaunchAttribute_st' in found_types}} + return sizeof(cydriver.CUlaunchAttributeValue) + if objType == CUlaunchAttribute_st: - return sizeof(ccuda.CUlaunchAttribute_st){{endif}} - {{if 'CUlaunchAttribute' in found_types}} + return sizeof(cydriver.CUlaunchAttribute_st) + if objType == CUlaunchAttribute: - return sizeof(ccuda.CUlaunchAttribute){{endif}} - {{if 'struct CUlaunchConfig_st' in found_types}} + return sizeof(cydriver.CUlaunchAttribute) + if objType == CUlaunchConfig_st: - return sizeof(ccuda.CUlaunchConfig_st){{endif}} - {{if 'CUlaunchConfig' in found_types}} + return sizeof(cydriver.CUlaunchConfig_st) + if objType == CUlaunchConfig: - return sizeof(ccuda.CUlaunchConfig){{endif}} - {{if 'CUkernelNodeAttrValue_v1' in found_types}} + return sizeof(cydriver.CUlaunchConfig) + if objType == CUkernelNodeAttrValue_v1: - return sizeof(ccuda.CUkernelNodeAttrValue_v1){{endif}} - {{if 'CUkernelNodeAttrValue' in found_types}} + return sizeof(cydriver.CUkernelNodeAttrValue_v1) + if objType == CUkernelNodeAttrValue: - return sizeof(ccuda.CUkernelNodeAttrValue){{endif}} - {{if 'CUstreamAttrValue_v1' in found_types}} + return sizeof(cydriver.CUkernelNodeAttrValue) + if objType == CUstreamAttrValue_v1: - return sizeof(ccuda.CUstreamAttrValue_v1){{endif}} - {{if 'CUstreamAttrValue' in found_types}} + return sizeof(cydriver.CUstreamAttrValue_v1) + if objType == CUstreamAttrValue: - return sizeof(ccuda.CUstreamAttrValue){{endif}} - {{if 'struct CUexecAffinitySmCount_st' in found_types}} + return sizeof(cydriver.CUstreamAttrValue) + if objType == CUexecAffinitySmCount_st: - return sizeof(ccuda.CUexecAffinitySmCount_st){{endif}} - {{if 'CUexecAffinitySmCount_v1' in found_types}} + return sizeof(cydriver.CUexecAffinitySmCount_st) + if objType == CUexecAffinitySmCount_v1: - return sizeof(ccuda.CUexecAffinitySmCount_v1){{endif}} - {{if 'CUexecAffinitySmCount' in found_types}} + return sizeof(cydriver.CUexecAffinitySmCount_v1) + if objType == CUexecAffinitySmCount: - return sizeof(ccuda.CUexecAffinitySmCount){{endif}} - {{if 'struct CUexecAffinityParam_st' in found_types}} + return sizeof(cydriver.CUexecAffinitySmCount) + if objType == CUexecAffinityParam_st: - return sizeof(ccuda.CUexecAffinityParam_st){{endif}} - {{if 'CUexecAffinityParam_v1' in found_types}} + return sizeof(cydriver.CUexecAffinityParam_st) + if objType == CUexecAffinityParam_v1: - return sizeof(ccuda.CUexecAffinityParam_v1){{endif}} - {{if 'CUexecAffinityParam' in found_types}} + return sizeof(cydriver.CUexecAffinityParam_v1) + if objType == CUexecAffinityParam: - return sizeof(ccuda.CUexecAffinityParam){{endif}} - {{if 'struct CUctxCigParam_st' in found_types}} + return sizeof(cydriver.CUexecAffinityParam) + if objType == CUctxCigParam_st: - return sizeof(ccuda.CUctxCigParam_st){{endif}} - {{if 'CUctxCigParam' in found_types}} + return sizeof(cydriver.CUctxCigParam_st) + if objType == CUctxCigParam: - return sizeof(ccuda.CUctxCigParam){{endif}} - {{if 'struct CUctxCreateParams_st' in found_types}} + return sizeof(cydriver.CUctxCigParam) + if objType == CUctxCreateParams_st: - return sizeof(ccuda.CUctxCreateParams_st){{endif}} - {{if 'CUctxCreateParams' in found_types}} + return sizeof(cydriver.CUctxCreateParams_st) + if objType == CUctxCreateParams: - return sizeof(ccuda.CUctxCreateParams){{endif}} - {{if 'struct CUlibraryHostUniversalFunctionAndDataTable_st' in found_types}} + return sizeof(cydriver.CUctxCreateParams) + + if objType == CUstreamCigParam_st: + return sizeof(cydriver.CUstreamCigParam_st) + + if objType == CUstreamCigParam: + return sizeof(cydriver.CUstreamCigParam) + + if objType == CUstreamCigCaptureParams_st: + return sizeof(cydriver.CUstreamCigCaptureParams_st) + + if objType == CUstreamCigCaptureParams: + return sizeof(cydriver.CUstreamCigCaptureParams) + if objType == CUlibraryHostUniversalFunctionAndDataTable_st: - return sizeof(ccuda.CUlibraryHostUniversalFunctionAndDataTable_st){{endif}} - {{if 'CUlibraryHostUniversalFunctionAndDataTable' in found_types}} + return sizeof(cydriver.CUlibraryHostUniversalFunctionAndDataTable_st) + if objType == CUlibraryHostUniversalFunctionAndDataTable: - return sizeof(ccuda.CUlibraryHostUniversalFunctionAndDataTable){{endif}} - {{if 'CUstreamCallback' in found_types}} + return sizeof(cydriver.CUlibraryHostUniversalFunctionAndDataTable) + if objType == CUstreamCallback: - return sizeof(ccuda.CUstreamCallback){{endif}} - {{if 'CUoccupancyB2DSize' in found_types}} + return sizeof(cydriver.CUstreamCallback) + if objType == CUoccupancyB2DSize: - return sizeof(ccuda.CUoccupancyB2DSize){{endif}} - {{if 'struct CUDA_MEMCPY2D_st' in found_types}} + return sizeof(cydriver.CUoccupancyB2DSize) + if objType == CUDA_MEMCPY2D_st: - return sizeof(ccuda.CUDA_MEMCPY2D_st){{endif}} - {{if 'CUDA_MEMCPY2D_v2' in found_types}} + return sizeof(cydriver.CUDA_MEMCPY2D_st) + if objType == CUDA_MEMCPY2D_v2: - return sizeof(ccuda.CUDA_MEMCPY2D_v2){{endif}} - {{if 'CUDA_MEMCPY2D' in found_types}} + return sizeof(cydriver.CUDA_MEMCPY2D_v2) + if objType == CUDA_MEMCPY2D: - return sizeof(ccuda.CUDA_MEMCPY2D){{endif}} - {{if 'struct CUDA_MEMCPY3D_st' in found_types}} + return sizeof(cydriver.CUDA_MEMCPY2D) + if objType == CUDA_MEMCPY3D_st: - return sizeof(ccuda.CUDA_MEMCPY3D_st){{endif}} - {{if 'CUDA_MEMCPY3D_v2' in found_types}} + return sizeof(cydriver.CUDA_MEMCPY3D_st) + if objType == CUDA_MEMCPY3D_v2: - return sizeof(ccuda.CUDA_MEMCPY3D_v2){{endif}} - {{if 'CUDA_MEMCPY3D' in found_types}} + return sizeof(cydriver.CUDA_MEMCPY3D_v2) + if objType == CUDA_MEMCPY3D: - return sizeof(ccuda.CUDA_MEMCPY3D){{endif}} - {{if 'struct CUDA_MEMCPY3D_PEER_st' in found_types}} + return sizeof(cydriver.CUDA_MEMCPY3D) + if objType == CUDA_MEMCPY3D_PEER_st: - return sizeof(ccuda.CUDA_MEMCPY3D_PEER_st){{endif}} - {{if 'CUDA_MEMCPY3D_PEER_v1' in found_types}} + return sizeof(cydriver.CUDA_MEMCPY3D_PEER_st) + if objType == CUDA_MEMCPY3D_PEER_v1: - return sizeof(ccuda.CUDA_MEMCPY3D_PEER_v1){{endif}} - {{if 'CUDA_MEMCPY3D_PEER' in found_types}} + return sizeof(cydriver.CUDA_MEMCPY3D_PEER_v1) + if objType == CUDA_MEMCPY3D_PEER: - return sizeof(ccuda.CUDA_MEMCPY3D_PEER){{endif}} - {{if 'struct CUDA_MEMCPY_NODE_PARAMS_st' in found_types}} + return sizeof(cydriver.CUDA_MEMCPY3D_PEER) + if objType == CUDA_MEMCPY_NODE_PARAMS_st: - return sizeof(ccuda.CUDA_MEMCPY_NODE_PARAMS_st){{endif}} - {{if 'CUDA_MEMCPY_NODE_PARAMS' in found_types}} + return sizeof(cydriver.CUDA_MEMCPY_NODE_PARAMS_st) + if objType == CUDA_MEMCPY_NODE_PARAMS: - return sizeof(ccuda.CUDA_MEMCPY_NODE_PARAMS){{endif}} - {{if 'struct CUDA_ARRAY_DESCRIPTOR_st' in found_types}} + return sizeof(cydriver.CUDA_MEMCPY_NODE_PARAMS) + if objType == CUDA_ARRAY_DESCRIPTOR_st: - return sizeof(ccuda.CUDA_ARRAY_DESCRIPTOR_st){{endif}} - {{if 'CUDA_ARRAY_DESCRIPTOR_v2' in found_types}} + return sizeof(cydriver.CUDA_ARRAY_DESCRIPTOR_st) + if objType == CUDA_ARRAY_DESCRIPTOR_v2: - return sizeof(ccuda.CUDA_ARRAY_DESCRIPTOR_v2){{endif}} - {{if 'CUDA_ARRAY_DESCRIPTOR' in found_types}} + return sizeof(cydriver.CUDA_ARRAY_DESCRIPTOR_v2) + if objType == CUDA_ARRAY_DESCRIPTOR: - return sizeof(ccuda.CUDA_ARRAY_DESCRIPTOR){{endif}} - {{if 'struct CUDA_ARRAY3D_DESCRIPTOR_st' in found_types}} + return sizeof(cydriver.CUDA_ARRAY_DESCRIPTOR) + if objType == CUDA_ARRAY3D_DESCRIPTOR_st: - return sizeof(ccuda.CUDA_ARRAY3D_DESCRIPTOR_st){{endif}} - {{if 'CUDA_ARRAY3D_DESCRIPTOR_v2' in found_types}} + return sizeof(cydriver.CUDA_ARRAY3D_DESCRIPTOR_st) + if objType == CUDA_ARRAY3D_DESCRIPTOR_v2: - return sizeof(ccuda.CUDA_ARRAY3D_DESCRIPTOR_v2){{endif}} - {{if 'CUDA_ARRAY3D_DESCRIPTOR' in found_types}} + return sizeof(cydriver.CUDA_ARRAY3D_DESCRIPTOR_v2) + if objType == CUDA_ARRAY3D_DESCRIPTOR: - return sizeof(ccuda.CUDA_ARRAY3D_DESCRIPTOR){{endif}} - {{if 'struct CUDA_ARRAY_SPARSE_PROPERTIES_st' in found_types}} + return sizeof(cydriver.CUDA_ARRAY3D_DESCRIPTOR) + if objType == CUDA_ARRAY_SPARSE_PROPERTIES_st: - return sizeof(ccuda.CUDA_ARRAY_SPARSE_PROPERTIES_st){{endif}} - {{if 'CUDA_ARRAY_SPARSE_PROPERTIES_v1' in found_types}} + return sizeof(cydriver.CUDA_ARRAY_SPARSE_PROPERTIES_st) + if objType == CUDA_ARRAY_SPARSE_PROPERTIES_v1: - return sizeof(ccuda.CUDA_ARRAY_SPARSE_PROPERTIES_v1){{endif}} - {{if 'CUDA_ARRAY_SPARSE_PROPERTIES' in found_types}} + return sizeof(cydriver.CUDA_ARRAY_SPARSE_PROPERTIES_v1) + if objType == CUDA_ARRAY_SPARSE_PROPERTIES: - return sizeof(ccuda.CUDA_ARRAY_SPARSE_PROPERTIES){{endif}} - {{if 'struct CUDA_ARRAY_MEMORY_REQUIREMENTS_st' in found_types}} + return sizeof(cydriver.CUDA_ARRAY_SPARSE_PROPERTIES) + if objType == CUDA_ARRAY_MEMORY_REQUIREMENTS_st: - return sizeof(ccuda.CUDA_ARRAY_MEMORY_REQUIREMENTS_st){{endif}} - {{if 'CUDA_ARRAY_MEMORY_REQUIREMENTS_v1' in found_types}} + return sizeof(cydriver.CUDA_ARRAY_MEMORY_REQUIREMENTS_st) + if objType == CUDA_ARRAY_MEMORY_REQUIREMENTS_v1: - return sizeof(ccuda.CUDA_ARRAY_MEMORY_REQUIREMENTS_v1){{endif}} - {{if 'CUDA_ARRAY_MEMORY_REQUIREMENTS' in found_types}} + return sizeof(cydriver.CUDA_ARRAY_MEMORY_REQUIREMENTS_v1) + if objType == CUDA_ARRAY_MEMORY_REQUIREMENTS: - return sizeof(ccuda.CUDA_ARRAY_MEMORY_REQUIREMENTS){{endif}} - {{if 'struct CUDA_RESOURCE_DESC_st' in found_types}} + return sizeof(cydriver.CUDA_ARRAY_MEMORY_REQUIREMENTS) + if objType == CUDA_RESOURCE_DESC_st: - return sizeof(ccuda.CUDA_RESOURCE_DESC_st){{endif}} - {{if 'CUDA_RESOURCE_DESC_v1' in found_types}} + return sizeof(cydriver.CUDA_RESOURCE_DESC_st) + if objType == CUDA_RESOURCE_DESC_v1: - return sizeof(ccuda.CUDA_RESOURCE_DESC_v1){{endif}} - {{if 'CUDA_RESOURCE_DESC' in found_types}} + return sizeof(cydriver.CUDA_RESOURCE_DESC_v1) + if objType == CUDA_RESOURCE_DESC: - return sizeof(ccuda.CUDA_RESOURCE_DESC){{endif}} - {{if 'struct CUDA_TEXTURE_DESC_st' in found_types}} + return sizeof(cydriver.CUDA_RESOURCE_DESC) + if objType == CUDA_TEXTURE_DESC_st: - return sizeof(ccuda.CUDA_TEXTURE_DESC_st){{endif}} - {{if 'CUDA_TEXTURE_DESC_v1' in found_types}} + return sizeof(cydriver.CUDA_TEXTURE_DESC_st) + if objType == CUDA_TEXTURE_DESC_v1: - return sizeof(ccuda.CUDA_TEXTURE_DESC_v1){{endif}} - {{if 'CUDA_TEXTURE_DESC' in found_types}} + return sizeof(cydriver.CUDA_TEXTURE_DESC_v1) + if objType == CUDA_TEXTURE_DESC: - return sizeof(ccuda.CUDA_TEXTURE_DESC){{endif}} - {{if 'struct CUDA_RESOURCE_VIEW_DESC_st' in found_types}} + return sizeof(cydriver.CUDA_TEXTURE_DESC) + if objType == CUDA_RESOURCE_VIEW_DESC_st: - return sizeof(ccuda.CUDA_RESOURCE_VIEW_DESC_st){{endif}} - {{if 'CUDA_RESOURCE_VIEW_DESC_v1' in found_types}} + return sizeof(cydriver.CUDA_RESOURCE_VIEW_DESC_st) + if objType == CUDA_RESOURCE_VIEW_DESC_v1: - return sizeof(ccuda.CUDA_RESOURCE_VIEW_DESC_v1){{endif}} - {{if 'CUDA_RESOURCE_VIEW_DESC' in found_types}} + return sizeof(cydriver.CUDA_RESOURCE_VIEW_DESC_v1) + if objType == CUDA_RESOURCE_VIEW_DESC: - return sizeof(ccuda.CUDA_RESOURCE_VIEW_DESC){{endif}} - {{if 'struct CUtensorMap_st' in found_types}} + return sizeof(cydriver.CUDA_RESOURCE_VIEW_DESC) + if objType == CUtensorMap_st: - return sizeof(ccuda.CUtensorMap_st){{endif}} - {{if 'CUtensorMap' in found_types}} + return sizeof(cydriver.CUtensorMap_st) + if objType == CUtensorMap: - return sizeof(ccuda.CUtensorMap){{endif}} - {{if 'struct CUDA_POINTER_ATTRIBUTE_P2P_TOKENS_st' in found_types}} + return sizeof(cydriver.CUtensorMap) + if objType == CUDA_POINTER_ATTRIBUTE_P2P_TOKENS_st: - return sizeof(ccuda.CUDA_POINTER_ATTRIBUTE_P2P_TOKENS_st){{endif}} - {{if 'CUDA_POINTER_ATTRIBUTE_P2P_TOKENS_v1' in found_types}} + return sizeof(cydriver.CUDA_POINTER_ATTRIBUTE_P2P_TOKENS_st) + if objType == CUDA_POINTER_ATTRIBUTE_P2P_TOKENS_v1: - return sizeof(ccuda.CUDA_POINTER_ATTRIBUTE_P2P_TOKENS_v1){{endif}} - {{if 'CUDA_POINTER_ATTRIBUTE_P2P_TOKENS' in found_types}} + return sizeof(cydriver.CUDA_POINTER_ATTRIBUTE_P2P_TOKENS_v1) + if objType == CUDA_POINTER_ATTRIBUTE_P2P_TOKENS: - return sizeof(ccuda.CUDA_POINTER_ATTRIBUTE_P2P_TOKENS){{endif}} - {{if 'struct CUDA_LAUNCH_PARAMS_st' in found_types}} + return sizeof(cydriver.CUDA_POINTER_ATTRIBUTE_P2P_TOKENS) + if objType == CUDA_LAUNCH_PARAMS_st: - return sizeof(ccuda.CUDA_LAUNCH_PARAMS_st){{endif}} - {{if 'CUDA_LAUNCH_PARAMS_v1' in found_types}} + return sizeof(cydriver.CUDA_LAUNCH_PARAMS_st) + if objType == CUDA_LAUNCH_PARAMS_v1: - return sizeof(ccuda.CUDA_LAUNCH_PARAMS_v1){{endif}} - {{if 'CUDA_LAUNCH_PARAMS' in found_types}} + return sizeof(cydriver.CUDA_LAUNCH_PARAMS_v1) + if objType == CUDA_LAUNCH_PARAMS: - return sizeof(ccuda.CUDA_LAUNCH_PARAMS){{endif}} - {{if 'struct CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st' in found_types}} + return sizeof(cydriver.CUDA_LAUNCH_PARAMS) + if objType == CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st: - return sizeof(ccuda.CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st){{endif}} - {{if 'CUDA_EXTERNAL_MEMORY_HANDLE_DESC_v1' in found_types}} + return sizeof(cydriver.CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st) + if objType == CUDA_EXTERNAL_MEMORY_HANDLE_DESC_v1: - return sizeof(ccuda.CUDA_EXTERNAL_MEMORY_HANDLE_DESC_v1){{endif}} - {{if 'CUDA_EXTERNAL_MEMORY_HANDLE_DESC' in found_types}} + return sizeof(cydriver.CUDA_EXTERNAL_MEMORY_HANDLE_DESC_v1) + if objType == CUDA_EXTERNAL_MEMORY_HANDLE_DESC: - return sizeof(ccuda.CUDA_EXTERNAL_MEMORY_HANDLE_DESC){{endif}} - {{if 'struct CUDA_EXTERNAL_MEMORY_BUFFER_DESC_st' in found_types}} + return sizeof(cydriver.CUDA_EXTERNAL_MEMORY_HANDLE_DESC) + if objType == CUDA_EXTERNAL_MEMORY_BUFFER_DESC_st: - return sizeof(ccuda.CUDA_EXTERNAL_MEMORY_BUFFER_DESC_st){{endif}} - {{if 'CUDA_EXTERNAL_MEMORY_BUFFER_DESC_v1' in found_types}} + return sizeof(cydriver.CUDA_EXTERNAL_MEMORY_BUFFER_DESC_st) + if objType == CUDA_EXTERNAL_MEMORY_BUFFER_DESC_v1: - return sizeof(ccuda.CUDA_EXTERNAL_MEMORY_BUFFER_DESC_v1){{endif}} - {{if 'CUDA_EXTERNAL_MEMORY_BUFFER_DESC' in found_types}} + return sizeof(cydriver.CUDA_EXTERNAL_MEMORY_BUFFER_DESC_v1) + if objType == CUDA_EXTERNAL_MEMORY_BUFFER_DESC: - return sizeof(ccuda.CUDA_EXTERNAL_MEMORY_BUFFER_DESC){{endif}} - {{if 'struct CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_st' in found_types}} + return sizeof(cydriver.CUDA_EXTERNAL_MEMORY_BUFFER_DESC) + if objType == CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_st: - return sizeof(ccuda.CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_st){{endif}} - {{if 'CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_v1' in found_types}} + return sizeof(cydriver.CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_st) + if objType == CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_v1: - return sizeof(ccuda.CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_v1){{endif}} - {{if 'CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC' in found_types}} + return sizeof(cydriver.CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_v1) + if objType == CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC: - return sizeof(ccuda.CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC){{endif}} - {{if 'struct CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st' in found_types}} + return sizeof(cydriver.CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC) + if objType == CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st: - return sizeof(ccuda.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st){{endif}} - {{if 'CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_v1' in found_types}} + return sizeof(cydriver.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st) + if objType == CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_v1: - return sizeof(ccuda.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_v1){{endif}} - {{if 'CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC' in found_types}} + return sizeof(cydriver.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_v1) + if objType == CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC: - return sizeof(ccuda.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC){{endif}} - {{if 'struct CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st' in found_types}} + return sizeof(cydriver.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC) + if objType == CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st: - return sizeof(ccuda.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st){{endif}} - {{if 'CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_v1' in found_types}} + return sizeof(cydriver.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st) + if objType == CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_v1: - return sizeof(ccuda.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_v1){{endif}} - {{if 'CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS' in found_types}} + return sizeof(cydriver.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_v1) + if objType == CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS: - return sizeof(ccuda.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS){{endif}} - {{if 'struct CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st' in found_types}} + return sizeof(cydriver.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS) + if objType == CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st: - return sizeof(ccuda.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st){{endif}} - {{if 'CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_v1' in found_types}} + return sizeof(cydriver.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st) + if objType == CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_v1: - return sizeof(ccuda.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_v1){{endif}} - {{if 'CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS' in found_types}} + return sizeof(cydriver.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_v1) + if objType == CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS: - return sizeof(ccuda.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS){{endif}} - {{if 'struct CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_st' in found_types}} + return sizeof(cydriver.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS) + if objType == CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_st: - return sizeof(ccuda.CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_st){{endif}} - {{if 'CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v1' in found_types}} + return sizeof(cydriver.CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_st) + if objType == CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v1: - return sizeof(ccuda.CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v1){{endif}} - {{if 'CUDA_EXT_SEM_SIGNAL_NODE_PARAMS' in found_types}} + return sizeof(cydriver.CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v1) + if objType == CUDA_EXT_SEM_SIGNAL_NODE_PARAMS: - return sizeof(ccuda.CUDA_EXT_SEM_SIGNAL_NODE_PARAMS){{endif}} - {{if 'struct CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2_st' in found_types}} + return sizeof(cydriver.CUDA_EXT_SEM_SIGNAL_NODE_PARAMS) + if objType == CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2_st: - return sizeof(ccuda.CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2_st){{endif}} - {{if 'CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2' in found_types}} + return sizeof(cydriver.CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2_st) + if objType == CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2: - return sizeof(ccuda.CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2){{endif}} - {{if 'struct CUDA_EXT_SEM_WAIT_NODE_PARAMS_st' in found_types}} + return sizeof(cydriver.CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2) + if objType == CUDA_EXT_SEM_WAIT_NODE_PARAMS_st: - return sizeof(ccuda.CUDA_EXT_SEM_WAIT_NODE_PARAMS_st){{endif}} - {{if 'CUDA_EXT_SEM_WAIT_NODE_PARAMS_v1' in found_types}} + return sizeof(cydriver.CUDA_EXT_SEM_WAIT_NODE_PARAMS_st) + if objType == CUDA_EXT_SEM_WAIT_NODE_PARAMS_v1: - return sizeof(ccuda.CUDA_EXT_SEM_WAIT_NODE_PARAMS_v1){{endif}} - {{if 'CUDA_EXT_SEM_WAIT_NODE_PARAMS' in found_types}} + return sizeof(cydriver.CUDA_EXT_SEM_WAIT_NODE_PARAMS_v1) + if objType == CUDA_EXT_SEM_WAIT_NODE_PARAMS: - return sizeof(ccuda.CUDA_EXT_SEM_WAIT_NODE_PARAMS){{endif}} - {{if 'struct CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2_st' in found_types}} + return sizeof(cydriver.CUDA_EXT_SEM_WAIT_NODE_PARAMS) + if objType == CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2_st: - return sizeof(ccuda.CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2_st){{endif}} - {{if 'CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2' in found_types}} + return sizeof(cydriver.CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2_st) + if objType == CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2: - return sizeof(ccuda.CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2){{endif}} - {{if 'CUmemGenericAllocationHandle_v1' in found_types}} + return sizeof(cydriver.CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2) + if objType == CUmemGenericAllocationHandle_v1: - return sizeof(ccuda.CUmemGenericAllocationHandle_v1){{endif}} - {{if 'CUmemGenericAllocationHandle' in found_types}} + return sizeof(cydriver.CUmemGenericAllocationHandle_v1) + if objType == CUmemGenericAllocationHandle: - return sizeof(ccuda.CUmemGenericAllocationHandle){{endif}} - {{if 'struct CUarrayMapInfo_st' in found_types}} + return sizeof(cydriver.CUmemGenericAllocationHandle) + if objType == CUarrayMapInfo_st: - return sizeof(ccuda.CUarrayMapInfo_st){{endif}} - {{if 'CUarrayMapInfo_v1' in found_types}} + return sizeof(cydriver.CUarrayMapInfo_st) + if objType == CUarrayMapInfo_v1: - return sizeof(ccuda.CUarrayMapInfo_v1){{endif}} - {{if 'CUarrayMapInfo' in found_types}} + return sizeof(cydriver.CUarrayMapInfo_v1) + if objType == CUarrayMapInfo: - return sizeof(ccuda.CUarrayMapInfo){{endif}} - {{if 'struct CUmemLocation_st' in found_types}} + return sizeof(cydriver.CUarrayMapInfo) + if objType == CUmemLocation_st: - return sizeof(ccuda.CUmemLocation_st){{endif}} - {{if 'CUmemLocation_v1' in found_types}} + return sizeof(cydriver.CUmemLocation_st) + if objType == CUmemLocation_v1: - return sizeof(ccuda.CUmemLocation_v1){{endif}} - {{if 'CUmemLocation' in found_types}} + return sizeof(cydriver.CUmemLocation_v1) + if objType == CUmemLocation: - return sizeof(ccuda.CUmemLocation){{endif}} - {{if 'struct CUmemAllocationProp_st' in found_types}} + return sizeof(cydriver.CUmemLocation) + if objType == CUmemAllocationProp_st: - return sizeof(ccuda.CUmemAllocationProp_st){{endif}} - {{if 'CUmemAllocationProp_v1' in found_types}} + return sizeof(cydriver.CUmemAllocationProp_st) + if objType == CUmemAllocationProp_v1: - return sizeof(ccuda.CUmemAllocationProp_v1){{endif}} - {{if 'CUmemAllocationProp' in found_types}} + return sizeof(cydriver.CUmemAllocationProp_v1) + if objType == CUmemAllocationProp: - return sizeof(ccuda.CUmemAllocationProp){{endif}} - {{if 'struct CUmulticastObjectProp_st' in found_types}} + return sizeof(cydriver.CUmemAllocationProp) + if objType == CUmulticastObjectProp_st: - return sizeof(ccuda.CUmulticastObjectProp_st){{endif}} - {{if 'CUmulticastObjectProp_v1' in found_types}} + return sizeof(cydriver.CUmulticastObjectProp_st) + if objType == CUmulticastObjectProp_v1: - return sizeof(ccuda.CUmulticastObjectProp_v1){{endif}} - {{if 'CUmulticastObjectProp' in found_types}} + return sizeof(cydriver.CUmulticastObjectProp_v1) + if objType == CUmulticastObjectProp: - return sizeof(ccuda.CUmulticastObjectProp){{endif}} - {{if 'struct CUmemAccessDesc_st' in found_types}} + return sizeof(cydriver.CUmulticastObjectProp) + if objType == CUmemAccessDesc_st: - return sizeof(ccuda.CUmemAccessDesc_st){{endif}} - {{if 'CUmemAccessDesc_v1' in found_types}} + return sizeof(cydriver.CUmemAccessDesc_st) + if objType == CUmemAccessDesc_v1: - return sizeof(ccuda.CUmemAccessDesc_v1){{endif}} - {{if 'CUmemAccessDesc' in found_types}} + return sizeof(cydriver.CUmemAccessDesc_v1) + if objType == CUmemAccessDesc: - return sizeof(ccuda.CUmemAccessDesc){{endif}} - {{if 'struct CUgraphExecUpdateResultInfo_st' in found_types}} + return sizeof(cydriver.CUmemAccessDesc) + if objType == CUgraphExecUpdateResultInfo_st: - return sizeof(ccuda.CUgraphExecUpdateResultInfo_st){{endif}} - {{if 'CUgraphExecUpdateResultInfo_v1' in found_types}} + return sizeof(cydriver.CUgraphExecUpdateResultInfo_st) + if objType == CUgraphExecUpdateResultInfo_v1: - return sizeof(ccuda.CUgraphExecUpdateResultInfo_v1){{endif}} - {{if 'CUgraphExecUpdateResultInfo' in found_types}} + return sizeof(cydriver.CUgraphExecUpdateResultInfo_v1) + if objType == CUgraphExecUpdateResultInfo: - return sizeof(ccuda.CUgraphExecUpdateResultInfo){{endif}} - {{if 'struct CUmemPoolProps_st' in found_types}} + return sizeof(cydriver.CUgraphExecUpdateResultInfo) + if objType == CUmemPoolProps_st: - return sizeof(ccuda.CUmemPoolProps_st){{endif}} - {{if 'CUmemPoolProps_v1' in found_types}} + return sizeof(cydriver.CUmemPoolProps_st) + if objType == CUmemPoolProps_v1: - return sizeof(ccuda.CUmemPoolProps_v1){{endif}} - {{if 'CUmemPoolProps' in found_types}} + return sizeof(cydriver.CUmemPoolProps_v1) + if objType == CUmemPoolProps: - return sizeof(ccuda.CUmemPoolProps){{endif}} - {{if 'struct CUmemPoolPtrExportData_st' in found_types}} + return sizeof(cydriver.CUmemPoolProps) + if objType == CUmemPoolPtrExportData_st: - return sizeof(ccuda.CUmemPoolPtrExportData_st){{endif}} - {{if 'CUmemPoolPtrExportData_v1' in found_types}} + return sizeof(cydriver.CUmemPoolPtrExportData_st) + if objType == CUmemPoolPtrExportData_v1: - return sizeof(ccuda.CUmemPoolPtrExportData_v1){{endif}} - {{if 'CUmemPoolPtrExportData' in found_types}} + return sizeof(cydriver.CUmemPoolPtrExportData_v1) + if objType == CUmemPoolPtrExportData: - return sizeof(ccuda.CUmemPoolPtrExportData){{endif}} - {{if 'struct CUDA_MEM_ALLOC_NODE_PARAMS_v1_st' in found_types}} + return sizeof(cydriver.CUmemPoolPtrExportData) + + if objType == CUmemcpyAttributes_st: + return sizeof(cydriver.CUmemcpyAttributes_st) + + if objType == CUmemcpyAttributes_v1: + return sizeof(cydriver.CUmemcpyAttributes_v1) + + if objType == CUmemcpyAttributes: + return sizeof(cydriver.CUmemcpyAttributes) + + if objType == CUoffset3D_st: + return sizeof(cydriver.CUoffset3D_st) + + if objType == CUoffset3D_v1: + return sizeof(cydriver.CUoffset3D_v1) + + if objType == CUoffset3D: + return sizeof(cydriver.CUoffset3D) + + if objType == CUextent3D_st: + return sizeof(cydriver.CUextent3D_st) + + if objType == CUextent3D_v1: + return sizeof(cydriver.CUextent3D_v1) + + if objType == CUextent3D: + return sizeof(cydriver.CUextent3D) + + if objType == CUmemcpy3DOperand_st: + return sizeof(cydriver.CUmemcpy3DOperand_st) + + if objType == CUmemcpy3DOperand_v1: + return sizeof(cydriver.CUmemcpy3DOperand_v1) + + if objType == CUmemcpy3DOperand: + return sizeof(cydriver.CUmemcpy3DOperand) + + if objType == CUDA_MEMCPY3D_BATCH_OP_st: + return sizeof(cydriver.CUDA_MEMCPY3D_BATCH_OP_st) + + if objType == CUDA_MEMCPY3D_BATCH_OP_v1: + return sizeof(cydriver.CUDA_MEMCPY3D_BATCH_OP_v1) + + if objType == CUDA_MEMCPY3D_BATCH_OP: + return sizeof(cydriver.CUDA_MEMCPY3D_BATCH_OP) + if objType == CUDA_MEM_ALLOC_NODE_PARAMS_v1_st: - return sizeof(ccuda.CUDA_MEM_ALLOC_NODE_PARAMS_v1_st){{endif}} - {{if 'CUDA_MEM_ALLOC_NODE_PARAMS_v1' in found_types}} + return sizeof(cydriver.CUDA_MEM_ALLOC_NODE_PARAMS_v1_st) + if objType == CUDA_MEM_ALLOC_NODE_PARAMS_v1: - return sizeof(ccuda.CUDA_MEM_ALLOC_NODE_PARAMS_v1){{endif}} - {{if 'CUDA_MEM_ALLOC_NODE_PARAMS' in found_types}} + return sizeof(cydriver.CUDA_MEM_ALLOC_NODE_PARAMS_v1) + if objType == CUDA_MEM_ALLOC_NODE_PARAMS: - return sizeof(ccuda.CUDA_MEM_ALLOC_NODE_PARAMS){{endif}} - {{if 'struct CUDA_MEM_ALLOC_NODE_PARAMS_v2_st' in found_types}} + return sizeof(cydriver.CUDA_MEM_ALLOC_NODE_PARAMS) + if objType == CUDA_MEM_ALLOC_NODE_PARAMS_v2_st: - return sizeof(ccuda.CUDA_MEM_ALLOC_NODE_PARAMS_v2_st){{endif}} - {{if 'CUDA_MEM_ALLOC_NODE_PARAMS_v2' in found_types}} + return sizeof(cydriver.CUDA_MEM_ALLOC_NODE_PARAMS_v2_st) + if objType == CUDA_MEM_ALLOC_NODE_PARAMS_v2: - return sizeof(ccuda.CUDA_MEM_ALLOC_NODE_PARAMS_v2){{endif}} - {{if 'struct CUDA_MEM_FREE_NODE_PARAMS_st' in found_types}} + return sizeof(cydriver.CUDA_MEM_ALLOC_NODE_PARAMS_v2) + if objType == CUDA_MEM_FREE_NODE_PARAMS_st: - return sizeof(ccuda.CUDA_MEM_FREE_NODE_PARAMS_st){{endif}} - {{if 'CUDA_MEM_FREE_NODE_PARAMS' in found_types}} + return sizeof(cydriver.CUDA_MEM_FREE_NODE_PARAMS_st) + if objType == CUDA_MEM_FREE_NODE_PARAMS: - return sizeof(ccuda.CUDA_MEM_FREE_NODE_PARAMS){{endif}} - {{if 'struct CUDA_CHILD_GRAPH_NODE_PARAMS_st' in found_types}} + return sizeof(cydriver.CUDA_MEM_FREE_NODE_PARAMS) + if objType == CUDA_CHILD_GRAPH_NODE_PARAMS_st: - return sizeof(ccuda.CUDA_CHILD_GRAPH_NODE_PARAMS_st){{endif}} - {{if 'CUDA_CHILD_GRAPH_NODE_PARAMS' in found_types}} + return sizeof(cydriver.CUDA_CHILD_GRAPH_NODE_PARAMS_st) + if objType == CUDA_CHILD_GRAPH_NODE_PARAMS: - return sizeof(ccuda.CUDA_CHILD_GRAPH_NODE_PARAMS){{endif}} - {{if 'struct CUDA_EVENT_RECORD_NODE_PARAMS_st' in found_types}} + return sizeof(cydriver.CUDA_CHILD_GRAPH_NODE_PARAMS) + if objType == CUDA_EVENT_RECORD_NODE_PARAMS_st: - return sizeof(ccuda.CUDA_EVENT_RECORD_NODE_PARAMS_st){{endif}} - {{if 'CUDA_EVENT_RECORD_NODE_PARAMS' in found_types}} + return sizeof(cydriver.CUDA_EVENT_RECORD_NODE_PARAMS_st) + if objType == CUDA_EVENT_RECORD_NODE_PARAMS: - return sizeof(ccuda.CUDA_EVENT_RECORD_NODE_PARAMS){{endif}} - {{if 'struct CUDA_EVENT_WAIT_NODE_PARAMS_st' in found_types}} + return sizeof(cydriver.CUDA_EVENT_RECORD_NODE_PARAMS) + if objType == CUDA_EVENT_WAIT_NODE_PARAMS_st: - return sizeof(ccuda.CUDA_EVENT_WAIT_NODE_PARAMS_st){{endif}} - {{if 'CUDA_EVENT_WAIT_NODE_PARAMS' in found_types}} + return sizeof(cydriver.CUDA_EVENT_WAIT_NODE_PARAMS_st) + if objType == CUDA_EVENT_WAIT_NODE_PARAMS: - return sizeof(ccuda.CUDA_EVENT_WAIT_NODE_PARAMS){{endif}} - {{if 'struct CUgraphNodeParams_st' in found_types}} + return sizeof(cydriver.CUDA_EVENT_WAIT_NODE_PARAMS) + if objType == CUgraphNodeParams_st: - return sizeof(ccuda.CUgraphNodeParams_st){{endif}} - {{if 'CUgraphNodeParams' in found_types}} + return sizeof(cydriver.CUgraphNodeParams_st) + if objType == CUgraphNodeParams: - return sizeof(ccuda.CUgraphNodeParams){{endif}} - {{if 'CUdevResourceDesc' in found_types}} + return sizeof(cydriver.CUgraphNodeParams) + + if objType == CUcheckpointLockArgs_st: + return sizeof(cydriver.CUcheckpointLockArgs_st) + + if objType == CUcheckpointLockArgs: + return sizeof(cydriver.CUcheckpointLockArgs) + + if objType == CUcheckpointCheckpointArgs_st: + return sizeof(cydriver.CUcheckpointCheckpointArgs_st) + + if objType == CUcheckpointCheckpointArgs: + return sizeof(cydriver.CUcheckpointCheckpointArgs) + + if objType == CUcheckpointGpuPair_st: + return sizeof(cydriver.CUcheckpointGpuPair_st) + + if objType == CUcheckpointGpuPair: + return sizeof(cydriver.CUcheckpointGpuPair) + + if objType == CUcheckpointRestoreArgs_st: + return sizeof(cydriver.CUcheckpointRestoreArgs_st) + + if objType == CUcheckpointRestoreArgs: + return sizeof(cydriver.CUcheckpointRestoreArgs) + + if objType == CUcheckpointUnlockArgs_st: + return sizeof(cydriver.CUcheckpointUnlockArgs_st) + + if objType == CUcheckpointUnlockArgs: + return sizeof(cydriver.CUcheckpointUnlockArgs) + + if objType == CUmemDecompressParams_st: + return sizeof(cydriver.CUmemDecompressParams_st) + + if objType == CUmemDecompressParams: + return sizeof(cydriver.CUmemDecompressParams) + + if objType == CUlogicalEndpointId: + return sizeof(cydriver.CUlogicalEndpointId) + + if objType == CUlogicalEndpointFabricHandle_st: + return sizeof(cydriver.CUlogicalEndpointFabricHandle_st) + + if objType == CUlogicalEndpointFabricHandle: + return sizeof(cydriver.CUlogicalEndpointFabricHandle) + + if objType == CUlogicalEndpointProp_struct: + return sizeof(cydriver.CUlogicalEndpointProp_struct) + + if objType == CUlogicalEndpointProp: + return sizeof(cydriver.CUlogicalEndpointProp) + + if objType == CUgraphRecaptureCallback: + return sizeof(cydriver.CUgraphRecaptureCallback) + + if objType == CUcoredumpCallbackHandle: + return sizeof(cydriver.CUcoredumpCallbackHandle) + + if objType == CUcoredumpStatusCallback: + return sizeof(cydriver.CUcoredumpStatusCallback) + if objType == CUdevResourceDesc: - return sizeof(ccuda.CUdevResourceDesc){{endif}} - {{if 'struct CUdevSmResource_st' in found_types}} + return sizeof(cydriver.CUdevResourceDesc) + if objType == CUdevSmResource_st: - return sizeof(ccuda.CUdevSmResource_st){{endif}} - {{if 'CUdevSmResource' in found_types}} + return sizeof(cydriver.CUdevSmResource_st) + if objType == CUdevSmResource: - return sizeof(ccuda.CUdevSmResource){{endif}} - {{if 'struct CUdevResource_st' in found_types}} + return sizeof(cydriver.CUdevSmResource) + + if objType == CUdevWorkqueueConfigResource_st: + return sizeof(cydriver.CUdevWorkqueueConfigResource_st) + + if objType == CUdevWorkqueueConfigResource: + return sizeof(cydriver.CUdevWorkqueueConfigResource) + + if objType == CUdevWorkqueueResource_st: + return sizeof(cydriver.CUdevWorkqueueResource_st) + + if objType == CUdevWorkqueueResource: + return sizeof(cydriver.CUdevWorkqueueResource) + + if objType == CU_DEV_SM_RESOURCE_GROUP_PARAMS_st: + return sizeof(cydriver.CU_DEV_SM_RESOURCE_GROUP_PARAMS_st) + + if objType == CU_DEV_SM_RESOURCE_GROUP_PARAMS: + return sizeof(cydriver.CU_DEV_SM_RESOURCE_GROUP_PARAMS) + if objType == CUdevResource_st: - return sizeof(ccuda.CUdevResource_st){{endif}} - {{if 'struct CUdevResource_st' in found_types}} + return sizeof(cydriver.CUdevResource_st) + if objType == CUdevResource_v1: - return sizeof(ccuda.CUdevResource_v1){{endif}} - {{if 'struct CUdevResource_st' in found_types}} + return sizeof(cydriver.CUdevResource_v1) + if objType == CUdevResource: - return sizeof(ccuda.CUdevResource){{endif}} - {{if True}} + return sizeof(cydriver.CUdevResource) + + if objType == CUlogsCallbackHandle: + return sizeof(cydriver.CUlogsCallbackHandle) + + if objType == CUlogsCallback: + return sizeof(cydriver.CUlogsCallback) + + if objType == CUlogIterator: + return sizeof(cydriver.CUlogIterator) + if objType == CUeglFrame_st: - return sizeof(ccuda.CUeglFrame_st){{endif}} - {{if True}} + return sizeof(cydriver.CUeglFrame_st) + if objType == CUeglFrame_v1: - return sizeof(ccuda.CUeglFrame_v1){{endif}} - {{if True}} + return sizeof(cydriver.CUeglFrame_v1) + if objType == CUeglFrame: - return sizeof(ccuda.CUeglFrame){{endif}} - {{if True}} + return sizeof(cydriver.CUeglFrame) + if objType == CUeglStreamConnection: - return sizeof(ccuda.CUeglStreamConnection){{endif}} - {{if True}} + return sizeof(cydriver.CUeglStreamConnection) + if objType == GLenum: - return sizeof(ccuda.GLenum){{endif}} - {{if True}} + return sizeof(cydriver.GLenum) + if objType == GLuint: - return sizeof(ccuda.GLuint){{endif}} - {{if True}} + return sizeof(cydriver.GLuint) + if objType == EGLImageKHR: - return sizeof(ccuda.EGLImageKHR){{endif}} - {{if True}} + return sizeof(cydriver.EGLImageKHR) + if objType == EGLStreamKHR: - return sizeof(ccuda.EGLStreamKHR){{endif}} - {{if True}} + return sizeof(cydriver.EGLStreamKHR) + if objType == EGLint: - return sizeof(ccuda.EGLint){{endif}} - {{if True}} + return sizeof(cydriver.EGLint) + if objType == EGLSyncKHR: - return sizeof(ccuda.EGLSyncKHR){{endif}} - {{if True}} + return sizeof(cydriver.EGLSyncKHR) + if objType == VdpDevice: - return sizeof(ccuda.VdpDevice){{endif}} - {{if True}} + return sizeof(cydriver.VdpDevice) + if objType == VdpGetProcAddress: - return sizeof(ccuda.VdpGetProcAddress){{endif}} - {{if True}} + return sizeof(cydriver.VdpGetProcAddress) + if objType == VdpVideoSurface: - return sizeof(ccuda.VdpVideoSurface){{endif}} - {{if True}} + return sizeof(cydriver.VdpVideoSurface) + if objType == VdpOutputSurface: - return sizeof(ccuda.VdpOutputSurface){{endif}} - raise TypeError("Unknown type: " + str(objType)) \ No newline at end of file + return sizeof(cydriver.VdpOutputSurface) + raise TypeError("Unknown type: " + str(objType)) + +cdef int _add_native_handle_getters() except?-1: + from cuda.bindings.utils import _add_cuda_native_handle_getter + + def CUcontext_getter(CUcontext x): return (x._pvt_ptr[0]) + _add_cuda_native_handle_getter(CUcontext, CUcontext_getter) + + + def CUmodule_getter(CUmodule x): return (x._pvt_ptr[0]) + _add_cuda_native_handle_getter(CUmodule, CUmodule_getter) + + + def CUfunction_getter(CUfunction x): return (x._pvt_ptr[0]) + _add_cuda_native_handle_getter(CUfunction, CUfunction_getter) + + + def CUlibrary_getter(CUlibrary x): return (x._pvt_ptr[0]) + _add_cuda_native_handle_getter(CUlibrary, CUlibrary_getter) + + + def CUkernel_getter(CUkernel x): return (x._pvt_ptr[0]) + _add_cuda_native_handle_getter(CUkernel, CUkernel_getter) + + + def CUarray_getter(CUarray x): return (x._pvt_ptr[0]) + _add_cuda_native_handle_getter(CUarray, CUarray_getter) + + + def CUmipmappedArray_getter(CUmipmappedArray x): return (x._pvt_ptr[0]) + _add_cuda_native_handle_getter(CUmipmappedArray, CUmipmappedArray_getter) + + + def CUtexref_getter(CUtexref x): return (x._pvt_ptr[0]) + _add_cuda_native_handle_getter(CUtexref, CUtexref_getter) + + + def CUsurfref_getter(CUsurfref x): return (x._pvt_ptr[0]) + _add_cuda_native_handle_getter(CUsurfref, CUsurfref_getter) + + + def CUevent_getter(CUevent x): return (x._pvt_ptr[0]) + _add_cuda_native_handle_getter(CUevent, CUevent_getter) + + + def CUstream_getter(CUstream x): return (x._pvt_ptr[0]) + _add_cuda_native_handle_getter(CUstream, CUstream_getter) + + + def CUgraphicsResource_getter(CUgraphicsResource x): return (x._pvt_ptr[0]) + _add_cuda_native_handle_getter(CUgraphicsResource, CUgraphicsResource_getter) + + + def CUexternalMemory_getter(CUexternalMemory x): return (x._pvt_ptr[0]) + _add_cuda_native_handle_getter(CUexternalMemory, CUexternalMemory_getter) + + + def CUexternalSemaphore_getter(CUexternalSemaphore x): return (x._pvt_ptr[0]) + _add_cuda_native_handle_getter(CUexternalSemaphore, CUexternalSemaphore_getter) + + + def CUgraph_getter(CUgraph x): return (x._pvt_ptr[0]) + _add_cuda_native_handle_getter(CUgraph, CUgraph_getter) + + + def CUgraphNode_getter(CUgraphNode x): return (x._pvt_ptr[0]) + _add_cuda_native_handle_getter(CUgraphNode, CUgraphNode_getter) + + + def CUgraphExec_getter(CUgraphExec x): return (x._pvt_ptr[0]) + _add_cuda_native_handle_getter(CUgraphExec, CUgraphExec_getter) + + + def CUmemoryPool_getter(CUmemoryPool x): return (x._pvt_ptr[0]) + _add_cuda_native_handle_getter(CUmemoryPool, CUmemoryPool_getter) + + + def CUuserObject_getter(CUuserObject x): return (x._pvt_ptr[0]) + _add_cuda_native_handle_getter(CUuserObject, CUuserObject_getter) + + + def CUgraphDeviceNode_getter(CUgraphDeviceNode x): return (x._pvt_ptr[0]) + _add_cuda_native_handle_getter(CUgraphDeviceNode, CUgraphDeviceNode_getter) + + + def CUasyncCallbackHandle_getter(CUasyncCallbackHandle x): return (x._pvt_ptr[0]) + _add_cuda_native_handle_getter(CUasyncCallbackHandle, CUasyncCallbackHandle_getter) + + + def CUgreenCtx_getter(CUgreenCtx x): return (x._pvt_ptr[0]) + _add_cuda_native_handle_getter(CUgreenCtx, CUgreenCtx_getter) + + + def CUlinkState_getter(CUlinkState x): return (x._pvt_ptr[0]) + _add_cuda_native_handle_getter(CUlinkState, CUlinkState_getter) + + + def CUcoredumpCallbackHandle_getter(CUcoredumpCallbackHandle x): return (x._pvt_ptr[0]) + _add_cuda_native_handle_getter(CUcoredumpCallbackHandle, CUcoredumpCallbackHandle_getter) + + + def CUdevResourceDesc_getter(CUdevResourceDesc x): return (x._pvt_ptr[0]) + _add_cuda_native_handle_getter(CUdevResourceDesc, CUdevResourceDesc_getter) + + + def CUlogsCallbackHandle_getter(CUlogsCallbackHandle x): return (x._pvt_ptr[0]) + _add_cuda_native_handle_getter(CUlogsCallbackHandle, CUlogsCallbackHandle_getter) + + + def CUeglStreamConnection_getter(CUeglStreamConnection x): return (x._pvt_ptr[0]) + _add_cuda_native_handle_getter(CUeglStreamConnection, CUeglStreamConnection_getter) + + + def EGLImageKHR_getter(EGLImageKHR x): return (x._pvt_ptr[0]) + _add_cuda_native_handle_getter(EGLImageKHR, EGLImageKHR_getter) + + + def EGLStreamKHR_getter(EGLStreamKHR x): return (x._pvt_ptr[0]) + _add_cuda_native_handle_getter(EGLStreamKHR, EGLStreamKHR_getter) + + + def EGLSyncKHR_getter(EGLSyncKHR x): return (x._pvt_ptr[0]) + _add_cuda_native_handle_getter(EGLSyncKHR, EGLSyncKHR_getter) + + return 0 +_add_native_handle_getters() diff --git a/cuda_bindings/cuda/bindings/nvfatbin.pxd b/cuda_bindings/cuda/bindings/nvfatbin.pxd new file mode 100644 index 00000000000..facc2dfeeb4 --- /dev/null +++ b/cuda_bindings/cuda/bindings/nvfatbin.pxd @@ -0,0 +1,40 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +# This code was automatically generated across versions from 12.4.1 to 13.3.0. Do not modify it directly. + +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=c9d5a4b06ca92f766674f286b75dfc83dff952b5987eb88cdb2773bb28f1ea6a +from libc.stdint cimport intptr_t, uint32_t + +from .cynvfatbin cimport * + + +############################################################################### +# Types +############################################################################### + +ctypedef nvFatbinHandle Handle + + +############################################################################### +# Enum +############################################################################### + +ctypedef nvFatbinResult _Result + + +############################################################################### +# Functions +############################################################################### + +cpdef intptr_t create(options, size_t options_count) except -1 +cpdef add_ptx(intptr_t handle, code, size_t size, arch, identifier, options_cmd_line) +cpdef add_cubin(intptr_t handle, code, size_t size, arch, identifier) +cpdef add_ltoir(intptr_t handle, code, size_t size, arch, identifier, options_cmd_line) +cpdef size_t size(intptr_t handle) except? 0 +cpdef get(intptr_t handle, buffer) +cpdef tuple version() +cpdef add_index(intptr_t handle, code, size_t size, identifier) +cpdef add_reloc(intptr_t handle, code, size_t size) +cpdef add_tile_ir(intptr_t handle, code, size_t size, identifier, options_cmd_line) diff --git a/cuda_bindings/cuda/bindings/nvfatbin.pyx b/cuda_bindings/cuda/bindings/nvfatbin.pyx new file mode 100644 index 00000000000..309d2d751df --- /dev/null +++ b/cuda_bindings/cuda/bindings/nvfatbin.pyx @@ -0,0 +1,334 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +# This code was automatically generated across versions from 12.4.1 to 13.3.0. Do not modify it directly. +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=22dd0937e8e243f48b06a24f0c1819e09360d102541b621dfe1cdeaa55c2154c + + +# <<<< PREAMBLE CONTENT >>>> + +from cuda.bindings._internal._fast_enum import FastEnum as _cyb_FastEnum + + +# <<<< END OF PREAMBLE CONTENT >>>> + +cimport cython # NOQA + +from ._internal.utils cimport (get_resource_ptr, get_nested_resource_ptr, nested_resource, nullable_unique_ptr, + get_buffer_pointer, get_resource_ptrs) + +from libcpp.vector cimport vector + + +############################################################################### +# Enum +############################################################################### + +class Result(_cyb_FastEnum): + """ + The enumerated type `nvFatbinResult` defines API call result codes. + nvFatbin APIs return `nvFatbinResult` codes to indicate the result. + + See `nvFatbinResult`. + """ + SUCCESS = NVFATBIN_SUCCESS + ERROR_INTERNAL = NVFATBIN_ERROR_INTERNAL + ERROR_ELF_ARCH_MISMATCH = NVFATBIN_ERROR_ELF_ARCH_MISMATCH + ERROR_ELF_SIZE_MISMATCH = NVFATBIN_ERROR_ELF_SIZE_MISMATCH + ERROR_MISSING_PTX_VERSION = NVFATBIN_ERROR_MISSING_PTX_VERSION + ERROR_NULL_POINTER = NVFATBIN_ERROR_NULL_POINTER + ERROR_COMPRESSION_FAILED = NVFATBIN_ERROR_COMPRESSION_FAILED + ERROR_COMPRESSED_SIZE_EXCEEDED = NVFATBIN_ERROR_COMPRESSED_SIZE_EXCEEDED + ERROR_UNRECOGNIZED_OPTION = NVFATBIN_ERROR_UNRECOGNIZED_OPTION + ERROR_INVALID_ARCH = NVFATBIN_ERROR_INVALID_ARCH + ERROR_INVALID_NVVM = NVFATBIN_ERROR_INVALID_NVVM + ERROR_EMPTY_INPUT = NVFATBIN_ERROR_EMPTY_INPUT + ERROR_MISSING_PTX_ARCH = NVFATBIN_ERROR_MISSING_PTX_ARCH + ERROR_PTX_ARCH_MISMATCH = NVFATBIN_ERROR_PTX_ARCH_MISMATCH + ERROR_MISSING_FATBIN = NVFATBIN_ERROR_MISSING_FATBIN + ERROR_INVALID_INDEX = NVFATBIN_ERROR_INVALID_INDEX + ERROR_IDENTIFIER_REUSE = NVFATBIN_ERROR_IDENTIFIER_REUSE + ERROR_INTERNAL_PTX_OPTION = NVFATBIN_ERROR_INTERNAL_PTX_OPTION + + +############################################################################### +# Error handling +############################################################################### + +class nvFatbinError(Exception): + + def __init__(self, status): + self.status = status + s = Result(status) + cdef str err = f"{s.name} ({s.value})" + super(nvFatbinError, self).__init__(err) + + def __reduce__(self): + return (type(self), (self.status,)) + + +@cython.profile(False) +cdef int check_status(int status) except 1 nogil: + if status != 0: + with gil: + raise nvFatbinError(status) + return status + + +############################################################################### +# Wrapper functions +############################################################################### + +cpdef destroy(intptr_t handle): + """nvFatbinDestroy frees the memory associated with the given handle. + + Args: + handle (intptr_t): nvFatbin handle. + + .. seealso:: `nvFatbinDestroy` + """ + cdef Handle h = handle + with nogil: + status = nvFatbinDestroy(&h) + check_status(status) + + +cpdef str get_error_string(int result): + """nvFatbinGetErrorString returns an error description string for each error code. + + Args: + result (Result): error code. + + .. seealso:: `nvFatbinGetErrorString` + """ + cdef const char* _output_ + cdef bytes _output_bytes_ + _output_ = nvFatbinGetErrorString(<_Result>result) + + if _output_ == NULL: + return "" + + _output_bytes_ = _output_ + return _output_bytes_.decode() + + +cpdef intptr_t create(options, size_t options_count) except -1: + """nvFatbinCreate creates a new handle. + + Args: + options (object): An array of strings, each containing a single option. It can be: + + - an :class:`int` as the pointer address to the nested sequence, or + - a Python sequence of :class:`int`\s, each of which is a pointer address + to a valid sequence of 'char', or + - a nested Python sequence of ``str``. + + options_count (size_t): Number of options. + + Returns: + intptr_t: Address of nvFatbin handle. + + .. seealso:: `nvFatbinCreate` + """ + cdef nested_resource[ char ] _options_ + get_nested_resource_ptr[char](_options_, options, NULL) + cdef Handle handle_indirect + with nogil: + __status__ = nvFatbinCreate(&handle_indirect, (_options_.ptrs.data()), options_count) + check_status(__status__) + return handle_indirect + + +cpdef add_ptx(intptr_t handle, code, size_t size, arch, identifier, options_cmd_line): + """nvFatbinAddPTX adds PTX to the fatbinary. + + Args: + handle (intptr_t): nvFatbin handle. + code (bytes): The PTX code. + size (size_t): The size of the PTX code. + arch (str): The numerical architecture that this PTX is for (the XX of any sm_XX, lto_XX, or compute_XX). + identifier (str): Name of the PTX, useful when extracting the fatbin with tools like cuobjdump. + options_cmd_line (str): Options used during JIT compilation. + + .. seealso:: `nvFatbinAddPTX` + """ + cdef void* _code_ = get_buffer_pointer(code, size, readonly=True) + if not isinstance(arch, str): + raise TypeError("arch must be a Python str") + cdef bytes _temp_arch_ = (arch).encode() + cdef char* _arch_ = _temp_arch_ + if not isinstance(identifier, str): + raise TypeError("identifier must be a Python str") + cdef bytes _temp_identifier_ = (identifier).encode() + cdef char* _identifier_ = _temp_identifier_ + if not isinstance(options_cmd_line, str): + raise TypeError("options_cmd_line must be a Python str") + cdef bytes _temp_options_cmd_line_ = (options_cmd_line).encode() + cdef char* _options_cmd_line_ = _temp_options_cmd_line_ + with nogil: + __status__ = nvFatbinAddPTX(handle, _code_, size, _arch_, _identifier_, _options_cmd_line_) + check_status(__status__) + + +cpdef add_cubin(intptr_t handle, code, size_t size, arch, identifier): + """nvFatbinAddCubin adds a CUDA binary to the fatbinary. + + Args: + handle (intptr_t): nvFatbin handle. + code (bytes): The cubin. + size (size_t): The size of the cubin. + arch (str): The numerical architecture that this cubin is for (the XX of any sm_XX, lto_XX, or compute_XX). + identifier (str): Name of the cubin, useful when extracting the fatbin with tools like cuobjdump. + + .. seealso:: `nvFatbinAddCubin` + """ + cdef void* _code_ = get_buffer_pointer(code, size, readonly=True) + if not isinstance(arch, str): + raise TypeError("arch must be a Python str") + cdef bytes _temp_arch_ = (arch).encode() + cdef char* _arch_ = _temp_arch_ + if not isinstance(identifier, str): + raise TypeError("identifier must be a Python str") + cdef bytes _temp_identifier_ = (identifier).encode() + cdef char* _identifier_ = _temp_identifier_ + with nogil: + __status__ = nvFatbinAddCubin(handle, _code_, size, _arch_, _identifier_) + check_status(__status__) + + +cpdef add_ltoir(intptr_t handle, code, size_t size, arch, identifier, options_cmd_line): + """nvFatbinAddLTOIR adds LTOIR to the fatbinary. + + Args: + handle (intptr_t): nvFatbin handle. + code (bytes): The LTOIR code. + size (size_t): The size of the LTOIR code. + arch (str): The numerical architecture that this LTOIR is for (the XX of any sm_XX, lto_XX, or compute_XX). + identifier (str): Name of the LTOIR, useful when extracting the fatbin with tools like cuobjdump. + options_cmd_line (str): Options used during JIT compilation. + + .. seealso:: `nvFatbinAddLTOIR` + """ + cdef void* _code_ = get_buffer_pointer(code, size, readonly=True) + if not isinstance(arch, str): + raise TypeError("arch must be a Python str") + cdef bytes _temp_arch_ = (arch).encode() + cdef char* _arch_ = _temp_arch_ + if not isinstance(identifier, str): + raise TypeError("identifier must be a Python str") + cdef bytes _temp_identifier_ = (identifier).encode() + cdef char* _identifier_ = _temp_identifier_ + if not isinstance(options_cmd_line, str): + raise TypeError("options_cmd_line must be a Python str") + cdef bytes _temp_options_cmd_line_ = (options_cmd_line).encode() + cdef char* _options_cmd_line_ = _temp_options_cmd_line_ + with nogil: + __status__ = nvFatbinAddLTOIR(handle, _code_, size, _arch_, _identifier_, _options_cmd_line_) + check_status(__status__) + + +cpdef size_t size(intptr_t handle) except? 0: + """nvFatbinSize returns the fatbinary's size. + + Args: + handle (intptr_t): nvFatbin handle. + + Returns: + size_t: The fatbinary's size. + + .. seealso:: `nvFatbinSize` + """ + cdef size_t size + with nogil: + __status__ = nvFatbinSize(handle, &size) + check_status(__status__) + return size + + +cpdef get(intptr_t handle, buffer): + """nvFatbinGet returns the completed fatbinary. + + Args: + handle (intptr_t): nvFatbin handle. + buffer (bytes): memory to store fatbinary. + + .. seealso:: `nvFatbinGet` + """ + cdef void* _buffer_ = get_buffer_pointer(buffer, -1, readonly=False) + with nogil: + __status__ = nvFatbinGet(handle, _buffer_) + check_status(__status__) + + +cpdef tuple version(): + """nvFatbinVersion returns the current version of nvFatbin. + + Returns: + A 2-tuple containing: + + - unsigned int: The major version. + - unsigned int: The minor version. + + .. seealso:: `nvFatbinVersion` + """ + cdef unsigned int major + cdef unsigned int minor + with nogil: + __status__ = nvFatbinVersion(&major, &minor) + check_status(__status__) + return (major, minor) + + +cpdef add_index(intptr_t handle, code, size_t size, identifier): + cdef void* _code_ = get_buffer_pointer(code, size, readonly=True) + if not isinstance(identifier, str): + raise TypeError("identifier must be a Python str") + cdef bytes _temp_identifier_ = (identifier).encode() + cdef char* _identifier_ = _temp_identifier_ + with nogil: + __status__ = nvFatbinAddIndex(handle, _code_, size, _identifier_) + check_status(__status__) + + +cpdef add_reloc(intptr_t handle, code, size_t size): + """nvFatbinAddReloc adds relocatable PTX entries from a host object to the fatbinary. + + Args: + handle (intptr_t): nvFatbin handle. + code (bytes): The host object image. + size (size_t): The size of the host object image code. + + .. seealso:: `nvFatbinAddReloc` + """ + cdef void* _code_ = get_buffer_pointer(code, size, readonly=True) + with nogil: + __status__ = nvFatbinAddReloc(handle, _code_, size) + check_status(__status__) + + +cpdef add_tile_ir(intptr_t handle, code, size_t size, identifier, options_cmd_line): + """nvFatbinAddTileIR adds Tile IR to the fatbinary. + + Args: + handle (intptr_t): nvFatbin handle. + code (bytes): The Tile IR. + size (size_t): The size of the Tile IR. + identifier (str): Name of the Tile IR, useful when extracting the fatbin with tools like cuobjdump. + options_cmd_line (str): Options used during JIT compilation. + + .. seealso:: `nvFatbinAddTileIR` + """ + cdef void* _code_ = get_buffer_pointer(code, size, readonly=True) + if not isinstance(identifier, str): + raise TypeError("identifier must be a Python str") + cdef bytes _temp_identifier_ = (identifier).encode() + cdef char* _identifier_ = _temp_identifier_ + if not isinstance(options_cmd_line, str): + raise TypeError("options_cmd_line must be a Python str") + cdef bytes _temp_options_cmd_line_ = (options_cmd_line).encode() + cdef char* _options_cmd_line_ = _temp_options_cmd_line_ + with nogil: + __status__ = nvFatbinAddTileIR(handle, _code_, size, _identifier_, _options_cmd_line_) + check_status(__status__) +del _cyb_FastEnum diff --git a/cuda_bindings/cuda/bindings/nvjitlink.pxd b/cuda_bindings/cuda/bindings/nvjitlink.pxd new file mode 100644 index 00000000000..ac697049088 --- /dev/null +++ b/cuda_bindings/cuda/bindings/nvjitlink.pxd @@ -0,0 +1,46 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +# This code was automatically generated across versions from 12.0.1 to 13.3.0. Do not modify it directly. + +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=b847666247321f33f1f6b4c5fa92d6ee5d1022389e32eceb03c7458c45ff44ed +from libc.stdint cimport intptr_t, uint32_t + +from .cynvjitlink cimport * + + +############################################################################### +# Types +############################################################################### + +ctypedef nvJitLinkHandle Handle + + +############################################################################### +# Enum +############################################################################### + +ctypedef nvJitLinkResult _Result +ctypedef nvJitLinkInputType _InputType + + +############################################################################### +# Functions +############################################################################### + +cpdef intptr_t create(uint32_t num_options, options) except -1 +cpdef add_data(intptr_t handle, int input_type, data, size_t size, name) +cpdef add_file(intptr_t handle, int input_type, file_name) +cpdef complete(intptr_t handle) +cpdef size_t get_linked_cubin_size(intptr_t handle) except? 0 +cpdef get_linked_cubin(intptr_t handle, cubin) +cpdef size_t get_linked_ptx_size(intptr_t handle) except? 0 +cpdef get_linked_ptx(intptr_t handle, ptx) +cpdef size_t get_error_log_size(intptr_t handle) except? 0 +cpdef get_error_log(intptr_t handle, log) +cpdef size_t get_info_log_size(intptr_t handle) except? 0 +cpdef get_info_log(intptr_t handle, log) +cpdef tuple version() +cpdef size_t get_linked_ltoir_size(intptr_t handle) except? 0 +cpdef get_linked_ltoir(intptr_t handle, ltoir) diff --git a/cuda_bindings/cuda/bindings/nvjitlink.pyx b/cuda_bindings/cuda/bindings/nvjitlink.pyx new file mode 100644 index 00000000000..eee6cc33923 --- /dev/null +++ b/cuda_bindings/cuda/bindings/nvjitlink.pyx @@ -0,0 +1,378 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +# This code was automatically generated across versions from 12.0.1 to 13.3.0. Do not modify it directly. +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=85275f1596953f034c156776f8fe4f6e518dbb89ffedda994d8e78bfd9284246 + + +# <<<< PREAMBLE CONTENT >>>> + +from cuda.bindings._internal._fast_enum import FastEnum as _cyb_FastEnum + + +# <<<< END OF PREAMBLE CONTENT >>>> + +cimport cython # NOQA + +from ._internal.utils cimport (get_resource_ptr, get_nested_resource_ptr, nested_resource, nullable_unique_ptr, + get_buffer_pointer, get_resource_ptrs) + +from libcpp.vector cimport vector + + +############################################################################### +# Enum +############################################################################### + +class Result(_cyb_FastEnum): + """ + The enumerated type `nvJitLinkResult` defines API call result codes. + nvJitLink APIs return `nvJitLinkResult` codes to indicate the result. + + See `nvJitLinkResult`. + """ + SUCCESS = NVJITLINK_SUCCESS + ERROR_UNRECOGNIZED_OPTION = (NVJITLINK_ERROR_UNRECOGNIZED_OPTION, 'Unrecognized Option') + ERROR_MISSING_ARCH = (NVJITLINK_ERROR_MISSING_ARCH, 'Option `-arch=sm_NN` not specified') + ERROR_INVALID_INPUT = (NVJITLINK_ERROR_INVALID_INPUT, 'Invalid Input') + ERROR_PTX_COMPILE = (NVJITLINK_ERROR_PTX_COMPILE, 'Issue during PTX Compilation') + ERROR_NVVM_COMPILE = (NVJITLINK_ERROR_NVVM_COMPILE, 'Issue during NVVM Compilation') + ERROR_INTERNAL = (NVJITLINK_ERROR_INTERNAL, 'Internal Error') + ERROR_THREADPOOL = (NVJITLINK_ERROR_THREADPOOL, 'Issue with Thread Pool') + ERROR_UNRECOGNIZED_INPUT = (NVJITLINK_ERROR_UNRECOGNIZED_INPUT, 'Unrecognized Input') + ERROR_FINALIZE = (NVJITLINK_ERROR_FINALIZE, 'Finalizer Error') + ERROR_NULL_INPUT = (NVJITLINK_ERROR_NULL_INPUT, 'Null Input') + ERROR_INCOMPATIBLE_OPTIONS = (NVJITLINK_ERROR_INCOMPATIBLE_OPTIONS, 'Incompatible Options') + ERROR_INCORRECT_INPUT_TYPE = (NVJITLINK_ERROR_INCORRECT_INPUT_TYPE, 'Incorrect Input Type') + ERROR_ARCH_MISMATCH = (NVJITLINK_ERROR_ARCH_MISMATCH, 'Arch Mismatch') + ERROR_OUTDATED_LIBRARY = (NVJITLINK_ERROR_OUTDATED_LIBRARY, 'Outdated Library') + ERROR_MISSING_FATBIN = (NVJITLINK_ERROR_MISSING_FATBIN, 'Missing Fatbin') + ERROR_UNRECOGNIZED_ARCH = (NVJITLINK_ERROR_UNRECOGNIZED_ARCH, 'Unrecognized -arch value') + ERROR_UNSUPPORTED_ARCH = (NVJITLINK_ERROR_UNSUPPORTED_ARCH, 'Unsupported -arch value') + ERROR_LTO_NOT_ENABLED = (NVJITLINK_ERROR_LTO_NOT_ENABLED, 'Requires -lto') + +class InputType(_cyb_FastEnum): + """ + The enumerated type `nvJitLinkInputType` defines the kind of inputs + that can be passed to nvJitLinkAdd* APIs. + + See `nvJitLinkInputType`. + """ + NONE = (NVJITLINK_INPUT_NONE, 'Error Type') + CUBIN = (NVJITLINK_INPUT_CUBIN, 'For CUDA Binaries') + PTX = (NVJITLINK_INPUT_PTX, 'For PTX') + LTOIR = (NVJITLINK_INPUT_LTOIR, 'For LTO-IR') + FATBIN = (NVJITLINK_INPUT_FATBIN, 'For Fatbin') + OBJECT = (NVJITLINK_INPUT_OBJECT, 'For Host Object') + LIBRARY = (NVJITLINK_INPUT_LIBRARY, 'For Host Library') + INDEX = (NVJITLINK_INPUT_INDEX, 'For Index File') + ANY = (NVJITLINK_INPUT_ANY, 'Dynamically chooses from the valid types') + + +############################################################################### +# Error handling +############################################################################### + +class nvJitLinkError(Exception): + + def __init__(self, status): + self.status = status + s = Result(status) + cdef str err = f"{s.name} ({s.value})" + super(nvJitLinkError, self).__init__(err) + + def __reduce__(self): + return (type(self), (self.status,)) + + +@cython.profile(False) +cdef int check_status(int status) except 1 nogil: + if status != 0: + with gil: + raise nvJitLinkError(status) + return status + + +############################################################################### +# Wrapper functions +############################################################################### + +cpdef destroy(intptr_t handle): + """nvJitLinkDestroy frees the memory associated with the given handle. + + Args: + handle (intptr_t): nvJitLink handle. + + .. seealso:: `nvJitLinkDestroy` + """ + cdef Handle h = handle + with nogil: + status = nvJitLinkDestroy(&h) + check_status(status) + + +cpdef intptr_t create(uint32_t num_options, options) except -1: + """nvJitLinkCreate creates an instance of ``nvJitLinkHandle`` with the given input options, and sets the output parameter ``handle``. + + Args: + num_options (uint32_t): Number of options passed. + options (object): Array of size ``num_options`` of option strings. It can be: + + - an :class:`int` as the pointer address to the nested sequence, or + - a Python sequence of :class:`int`\s, each of which is a pointer address + to a valid sequence of 'char', or + - a nested Python sequence of ``str``. + + + Returns: + intptr_t: Address of nvJitLink handle. + + .. seealso:: `nvJitLinkCreate` + """ + cdef nested_resource[ char ] _options_ + get_nested_resource_ptr[char](_options_, options, NULL) + cdef Handle handle + with nogil: + __status__ = nvJitLinkCreate(&handle, num_options, (_options_.ptrs.data())) + check_status(__status__) + return handle + + +cpdef add_data(intptr_t handle, int input_type, data, size_t size, name): + """nvJitLinkAddData adds data image to the link. + + Args: + handle (intptr_t): nvJitLink handle. + input_type (InputType): kind of input. + data (bytes): pointer to data image in memory. + size (size_t): size of the data. + name (str): name of input object. + + .. seealso:: `nvJitLinkAddData` + """ + cdef void* _data_ = get_buffer_pointer(data, size, readonly=True) + if not isinstance(name, str): + raise TypeError("name must be a Python str") + cdef bytes _temp_name_ = (name).encode() + cdef char* _name_ = _temp_name_ + with nogil: + __status__ = nvJitLinkAddData(handle, <_InputType>input_type, _data_, size, _name_) + check_status(__status__) + + +cpdef add_file(intptr_t handle, int input_type, file_name): + """nvJitLinkAddFile reads data from file and links it in. + + Args: + handle (intptr_t): nvJitLink handle. + input_type (InputType): kind of input. + file_name (str): name of file. + + .. seealso:: `nvJitLinkAddFile` + """ + if not isinstance(file_name, str): + raise TypeError("file_name must be a Python str") + cdef bytes _temp_file_name_ = (file_name).encode() + cdef char* _file_name_ = _temp_file_name_ + with nogil: + __status__ = nvJitLinkAddFile(handle, <_InputType>input_type, _file_name_) + check_status(__status__) + + +cpdef complete(intptr_t handle): + """nvJitLinkComplete does the actual link. + + Args: + handle (intptr_t): nvJitLink handle. + + .. seealso:: `nvJitLinkComplete` + """ + with nogil: + __status__ = nvJitLinkComplete(handle) + check_status(__status__) + + +cpdef size_t get_linked_cubin_size(intptr_t handle) except? 0: + """nvJitLinkGetLinkedCubinSize gets the size of the linked cubin. + + Args: + handle (intptr_t): nvJitLink handle. + + Returns: + size_t: Size of the linked cubin. + + .. seealso:: `nvJitLinkGetLinkedCubinSize` + """ + cdef size_t size + with nogil: + __status__ = nvJitLinkGetLinkedCubinSize(handle, &size) + check_status(__status__) + return size + + +cpdef get_linked_cubin(intptr_t handle, cubin): + """nvJitLinkGetLinkedCubin gets the linked cubin. + + Args: + handle (intptr_t): nvJitLink handle. + cubin (bytes): The linked cubin. + + .. seealso:: `nvJitLinkGetLinkedCubin` + """ + cdef void* _cubin_ = get_buffer_pointer(cubin, -1, readonly=False) + with nogil: + __status__ = nvJitLinkGetLinkedCubin(handle, _cubin_) + check_status(__status__) + + +cpdef size_t get_linked_ptx_size(intptr_t handle) except? 0: + """nvJitLinkGetLinkedPtxSize gets the size of the linked ptx. + + Args: + handle (intptr_t): nvJitLink handle. + + Returns: + size_t: Size of the linked PTX. + + .. seealso:: `nvJitLinkGetLinkedPtxSize` + """ + cdef size_t size + with nogil: + __status__ = nvJitLinkGetLinkedPtxSize(handle, &size) + check_status(__status__) + return size + + +cpdef get_linked_ptx(intptr_t handle, ptx): + """nvJitLinkGetLinkedPtx gets the linked ptx. + + Args: + handle (intptr_t): nvJitLink handle. + ptx (bytes): The linked PTX. + + .. seealso:: `nvJitLinkGetLinkedPtx` + """ + cdef void* _ptx_ = get_buffer_pointer(ptx, -1, readonly=False) + with nogil: + __status__ = nvJitLinkGetLinkedPtx(handle, _ptx_) + check_status(__status__) + + +cpdef size_t get_error_log_size(intptr_t handle) except? 0: + """nvJitLinkGetErrorLogSize gets the size of the error log. + + Args: + handle (intptr_t): nvJitLink handle. + + Returns: + size_t: Size of the error log. + + .. seealso:: `nvJitLinkGetErrorLogSize` + """ + cdef size_t size + with nogil: + __status__ = nvJitLinkGetErrorLogSize(handle, &size) + check_status(__status__) + return size + + +cpdef get_error_log(intptr_t handle, log): + """nvJitLinkGetErrorLog puts any error messages in the log. + + Args: + handle (intptr_t): nvJitLink handle. + log (bytes): The error log. + + .. seealso:: `nvJitLinkGetErrorLog` + """ + cdef void* _log_ = get_buffer_pointer(log, -1, readonly=False) + with nogil: + __status__ = nvJitLinkGetErrorLog(handle, _log_) + check_status(__status__) + + +cpdef size_t get_info_log_size(intptr_t handle) except? 0: + """nvJitLinkGetInfoLogSize gets the size of the info log. + + Args: + handle (intptr_t): nvJitLink handle. + + Returns: + size_t: Size of the info log. + + .. seealso:: `nvJitLinkGetInfoLogSize` + """ + cdef size_t size + with nogil: + __status__ = nvJitLinkGetInfoLogSize(handle, &size) + check_status(__status__) + return size + + +cpdef get_info_log(intptr_t handle, log): + """nvJitLinkGetInfoLog puts any info messages in the log. + + Args: + handle (intptr_t): nvJitLink handle. + log (bytes): The info log. + + .. seealso:: `nvJitLinkGetInfoLog` + """ + cdef void* _log_ = get_buffer_pointer(log, -1, readonly=False) + with nogil: + __status__ = nvJitLinkGetInfoLog(handle, _log_) + check_status(__status__) + + +cpdef tuple version(): + """nvJitLinkVersion returns the current version of nvJitLink. + + Returns: + A 2-tuple containing: + + - unsigned int: The major version. + - unsigned int: The minor version. + + .. seealso:: `nvJitLinkVersion` + """ + cdef unsigned int major + cdef unsigned int minor + with nogil: + __status__ = nvJitLinkVersion(&major, &minor) + check_status(__status__) + return (major, minor) + + +cpdef size_t get_linked_ltoir_size(intptr_t handle) except? 0: + """nvJitLinkGetLinkedLTOIRSize gets the size of the linked LTOIR. + + Args: + handle (intptr_t): nvJitLink handle. + + Returns: + size_t: Size of the linked LTOIR. + + .. seealso:: `nvJitLinkGetLinkedLTOIRSize` + """ + cdef size_t size + with nogil: + __status__ = nvJitLinkGetLinkedLTOIRSize(handle, &size) + check_status(__status__) + return size + + +cpdef get_linked_ltoir(intptr_t handle, ltoir): + """nvJitLinkGetLinkedLTOIR gets the linked LTOIR. + + Args: + handle (intptr_t): nvJitLink handle. + ltoir (bytes): The linked LTOIR in Container format. + + .. seealso:: `nvJitLinkGetLinkedLTOIR` + """ + cdef void* _ltoir_ = get_buffer_pointer(ltoir, -1, readonly=False) + with nogil: + __status__ = nvJitLinkGetLinkedLTOIR(handle, _ltoir_) + check_status(__status__) +del _cyb_FastEnum diff --git a/cuda_bindings/cuda/bindings/nvml.pxd b/cuda_bindings/cuda/bindings/nvml.pxd new file mode 100644 index 00000000000..acc9900f069 --- /dev/null +++ b/cuda_bindings/cuda/bindings/nvml.pxd @@ -0,0 +1,434 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +# This code was automatically generated across versions from 12.9.1 to 13.3.0. Do not modify it directly. + +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=eb901f46ca6b6930935726541c32b3ea04f7f46b6090c4c2ad9cb62386c2028b +from libc.stdint cimport intptr_t + +from .cynvml cimport * + + +############################################################################### +# Types +############################################################################### + +ctypedef nvmlDramEncryptionInfo_v1_t DramEncryptionInfo_v1 +ctypedef nvmlMarginTemperature_v1_t MarginTemperature_v1 +ctypedef nvmlFanSpeedInfo_v1_t FanSpeedInfo_v1 +ctypedef nvmlDevicePerfModes_v1_t DevicePerfModes_v1 +ctypedef nvmlDeviceCurrentClockFreqs_v1_t DeviceCurrentClockFreqs_v1 +ctypedef nvmlVgpuHeterogeneousMode_v1_t VgpuHeterogeneousMode_v1 +ctypedef nvmlVgpuPlacementId_v1_t VgpuPlacementId_v1 +ctypedef nvmlVgpuRuntimeState_v1_t VgpuRuntimeState_v1 +ctypedef nvmlConfComputeSetKeyRotationThresholdInfo_v1_t ConfComputeSetKeyRotationThresholdInfo_v1 +ctypedef nvmlConfComputeGetKeyRotationThresholdInfo_v1_t ConfComputeGetKeyRotationThresholdInfo_v1 +ctypedef nvmlSystemDriverBranchInfo_v1_t SystemDriverBranchInfo_v1 +ctypedef nvmlTemperature_v1_t Temperature_v1 +ctypedef nvmlDeviceCapabilities_v1_t DeviceCapabilities_v1 +ctypedef nvmlPowerSmoothingProfile_v1_t PowerSmoothingProfile_v1 +ctypedef nvmlPowerSmoothingState_v1_t PowerSmoothingState_v1 +ctypedef nvmlPdi_v1_t Pdi_v1 +ctypedef nvmlDevice_t Device +ctypedef nvmlGpuInstance_t GpuInstance +ctypedef nvmlUnit_t Unit +ctypedef nvmlEventSet_t EventSet +ctypedef nvmlSystemEventSet_t SystemEventSet +ctypedef nvmlComputeInstance_t ComputeInstance +ctypedef nvmlGpmSample_t GpmSample +ctypedef nvmlEccErrorCounts_t EccErrorCounts +ctypedef nvmlProcessInfo_v1_t ProcessInfo_v1 +ctypedef nvmlProcessInfo_v2_t ProcessInfo_v2 +ctypedef nvmlNvLinkUtilizationControl_t NvLinkUtilizationControl +ctypedef nvmlViolationTime_t ViolationTime +ctypedef nvmlUUIDValue_t UUIDValue +ctypedef nvmlVgpuPlacementList_v1_t VgpuPlacementList_v1 +ctypedef nvmlNvLinkPowerThres_t NvLinkPowerThres +ctypedef nvmlGpuInstanceProfileInfo_t GpuInstanceProfileInfo +ctypedef nvmlGpuInstanceProfileInfo_v2_t GpuInstanceProfileInfo_v2 +ctypedef nvmlComputeInstanceProfileInfo_t ComputeInstanceProfileInfo +ctypedef nvmlGpmSupport_t GpmSupport +ctypedef nvmlMask255_t Mask255 +ctypedef nvmlHostname_v1_t Hostname_v1 +ctypedef nvmlUnrepairableMemoryStatus_v1_t UnrepairableMemoryStatus_v1 +ctypedef nvmlRusdSettings_v1_t RusdSettings_v1 +ctypedef nvmlBBXTimeData_v1_t BBXTimeData_v1 +ctypedef nvmlRemappedRowsInfo_v2_t RemappedRowsInfo_v2 +ctypedef nvmlAccountingStats_v2_t AccountingStats_v2 +ctypedef nvmlPowerValue_v2_t PowerValue_v2 +ctypedef nvmlVgpuTypeMaxInstance_v1_t VgpuTypeMaxInstance_v1 +ctypedef nvmlVgpuProcessUtilizationSample_t VgpuProcessUtilizationSample +ctypedef nvmlGpuFabricInfo_t GpuFabricInfo +ctypedef nvmlCPERCursor_v1_t CPERCursor_v1 +ctypedef nvmlSystemEventSetCreateRequest_v1_t SystemEventSetCreateRequest_v1 +ctypedef nvmlSystemEventSetFreeRequest_v1_t SystemEventSetFreeRequest_v1 +ctypedef nvmlSystemRegisterEventRequest_v1_t SystemRegisterEventRequest_v1 +ctypedef nvmlUUID_v1_t UUID_v1 +ctypedef nvmlSystemEventSetWaitRequest_v1_t SystemEventSetWaitRequest_v1 +ctypedef nvmlGpmMetric_t GpmMetric +ctypedef nvmlWorkloadPowerProfileInfo_v1_t WorkloadPowerProfileInfo_v1 +ctypedef nvmlWorkloadPowerProfileCurrentProfiles_v1_t WorkloadPowerProfileCurrentProfiles_v1 +ctypedef nvmlWorkloadPowerProfileRequestedProfiles_v1_t WorkloadPowerProfileRequestedProfiles_v1 +ctypedef nvmlWorkloadPowerProfileUpdateProfiles_v1_t WorkloadPowerProfileUpdateProfiles_v1 +ctypedef nvmlPRMTLV_v1_t PRMTLV_v1 +ctypedef nvmlGetCPER_v1_t GetCPER_v1 +ctypedef nvmlVgpuSchedulerSetState_t VgpuSchedulerSetState +ctypedef nvmlGpmMetricsGet_t GpmMetricsGet +ctypedef nvmlPRMCounterList_v1_t PRMCounterList_v1 +ctypedef nvmlWorkloadPowerProfileProfilesInfo_v1_t WorkloadPowerProfileProfilesInfo_v1 + + +############################################################################### +# Enum +############################################################################### + +ctypedef nvmlBridgeChipType_t _BridgeChipType +ctypedef nvmlNvLinkUtilizationCountUnits_t _NvLinkUtilizationCountUnits +ctypedef nvmlNvLinkUtilizationCountPktTypes_t _NvLinkUtilizationCountPktTypes +ctypedef nvmlNvLinkCapability_t _NvLinkCapability +ctypedef nvmlNvLinkErrorCounter_t _NvLinkErrorCounter +ctypedef nvmlIntNvLinkDeviceType_t _IntNvLinkDeviceType +ctypedef nvmlGpuTopologyLevel_t _GpuTopologyLevel +ctypedef nvmlGpuP2PStatus_t _GpuP2PStatus +ctypedef nvmlGpuP2PCapsIndex_t _GpuP2PCapsIndex +ctypedef nvmlSamplingType_t _SamplingType +ctypedef nvmlPcieUtilCounter_t _PcieUtilCounter +ctypedef nvmlValueType_t _ValueType +ctypedef nvmlPerfPolicyType_t _PerfPolicyType +ctypedef nvmlThermalTarget_t _ThermalTarget +ctypedef nvmlThermalController_t _ThermalController +ctypedef nvmlCoolerControl_t _CoolerControl +ctypedef nvmlCoolerTarget_t _CoolerTarget +ctypedef nvmlUUIDType_t _UUIDType +ctypedef nvmlEnableState_t _EnableState +ctypedef nvmlBrandType_t _BrandType +ctypedef nvmlTemperatureThresholds_t _TemperatureThresholds +ctypedef nvmlTemperatureSensors_t _TemperatureSensors +ctypedef nvmlComputeMode_t _ComputeMode +ctypedef nvmlMemoryErrorType_t _MemoryErrorType +ctypedef nvmlNvlinkVersion_t _NvlinkVersion +ctypedef nvmlEccCounterType_t _EccCounterType +ctypedef nvmlClockType_t _ClockType +ctypedef nvmlClockId_t _ClockId +ctypedef nvmlDriverModel_t _DriverModel +ctypedef nvmlPstates_t _Pstates +ctypedef nvmlGpuOperationMode_t _GpuOperationMode +ctypedef nvmlInforomObject_t _InforomObject +ctypedef nvmlReturn_t _Return +ctypedef nvmlMemoryLocation_t _MemoryLocation +ctypedef nvmlPageRetirementCause_t _PageRetirementCause +ctypedef nvmlRestrictedAPI_t _RestrictedAPI +ctypedef nvmlGpuUtilizationDomainId_t _GpuUtilizationDomainId +ctypedef nvmlGpuVirtualizationMode_t _GpuVirtualizationMode +ctypedef nvmlHostVgpuMode_t _HostVgpuMode +ctypedef nvmlVgpuVmIdType_t _VgpuVmIdType +ctypedef nvmlVgpuGuestInfoState_t _VgpuGuestInfoState +ctypedef nvmlGridLicenseFeatureCode_t _GridLicenseFeatureCode +ctypedef nvmlVgpuCapability_t _VgpuCapability +ctypedef nvmlVgpuDriverCapability_t _VgpuDriverCapability +ctypedef nvmlDeviceVgpuCapability_t _DeviceVgpuCapability +ctypedef nvmlDeviceGpuRecoveryAction_t _DeviceGpuRecoveryAction +ctypedef nvmlFanState_t _FanState +ctypedef nvmlLedColor_t _LedColor +ctypedef nvmlEncoderType_t _EncoderType +ctypedef nvmlFBCSessionType_t _FBCSessionType +ctypedef nvmlDetachGpuState_t _DetachGpuState +ctypedef nvmlPcieLinkState_t _PcieLinkState +ctypedef nvmlClockLimitId_t _ClockLimitId +ctypedef nvmlVgpuVmCompatibility_t _VgpuVmCompatibility +ctypedef nvmlVgpuPgpuCompatibilityLimitCode_t _VgpuPgpuCompatibilityLimitCode +ctypedef nvmlGpmMetricId_t _GpmMetricId +ctypedef nvmlPowerProfileType_t _PowerProfileType +ctypedef nvmlDeviceAddressingModeType_t _DeviceAddressingModeType +ctypedef nvmlPRMCounterId_t _PRMCounterId +ctypedef nvmlPowerProfileOperation_t _PowerProfileOperation +ctypedef nvmlProcessMode_t _ProcessMode +ctypedef nvmlCPERType_t _CPERType + + +############################################################################### +# Functions +############################################################################### + +cpdef init_v2() +cpdef init_with_flags(unsigned int flags) +cpdef shutdown() +cpdef str error_string(int result) +cpdef str system_get_driver_version() +cpdef str system_get_nvml_version() +cpdef int system_get_cuda_driver_version() except * +cpdef int system_get_cuda_driver_version_v2() except 0 +cpdef str system_get_process_name(unsigned int pid) +cpdef object system_get_hic_version() +cpdef unsigned int unit_get_count() except? 0 +cpdef intptr_t unit_get_handle_by_index(unsigned int index) except? 0 +cpdef object unit_get_unit_info(intptr_t unit) +cpdef object unit_get_led_state(intptr_t unit) +cpdef object unit_get_psu_info(intptr_t unit) +cpdef unsigned int unit_get_temperature(intptr_t unit, unsigned int type) except? 0 +cpdef object unit_get_fan_speed_info(intptr_t unit) +cpdef unsigned int device_get_count_v2() except? 0 +cpdef object device_get_attributes_v2(intptr_t device) +cpdef intptr_t device_get_handle_by_index_v2(unsigned int index) except? 0 +cpdef intptr_t device_get_handle_by_serial(serial) except? 0 +cpdef intptr_t device_get_handle_by_uuid(uuid) except? 0 +cpdef intptr_t device_get_handle_by_pci_bus_id_v2(pci_bus_id) except? 0 +cpdef str device_get_name(intptr_t device) +cpdef int device_get_brand(intptr_t device) except? -1 +cpdef unsigned int device_get_index(intptr_t device) except? 0 +cpdef str device_get_serial(intptr_t device) +cpdef unsigned int device_get_module_id(intptr_t device) except? 0 +cpdef object device_get_c2c_mode_info_v(intptr_t device) +cpdef object device_get_memory_affinity(intptr_t device, unsigned int node_set_size, unsigned int scope) +cpdef object device_get_cpu_affinity_within_scope(intptr_t device, unsigned int cpu_set_size, unsigned int scope) +cpdef object device_get_cpu_affinity(intptr_t device, unsigned int cpu_set_size) +cpdef device_set_cpu_affinity(intptr_t device) +cpdef device_clear_cpu_affinity(intptr_t device) +cpdef unsigned int device_get_numa_node_id(intptr_t device) except? 0 +cpdef int device_get_topology_common_ancestor(intptr_t device1, intptr_t device2) except? -1 +cpdef int device_get_p2p_status(intptr_t device1, intptr_t device2, int p2p_index) except? -1 +cpdef str device_get_uuid(intptr_t device) +cpdef unsigned int device_get_minor_number(intptr_t device) except? 0 +cpdef str device_get_board_part_number(intptr_t device) +cpdef str device_get_inforom_version(intptr_t device, int object) +cpdef str device_get_inforom_image_version(intptr_t device) +cpdef unsigned int device_get_inforom_configuration_checksum(intptr_t device) except? 0 +cpdef device_validate_inforom(intptr_t device) +cpdef tuple device_get_last_bbx_flush_time(intptr_t device) +cpdef int device_get_display_mode(intptr_t device) except? -1 +cpdef int device_get_display_active(intptr_t device) except? -1 +cpdef int device_get_persistence_mode(intptr_t device) except? -1 +cpdef object device_get_pci_info_ext(intptr_t device) +cpdef object device_get_pci_info_v3(intptr_t device) +cpdef unsigned int device_get_max_pcie_link_generation(intptr_t device) except? 0 +cpdef unsigned int device_get_gpu_max_pcie_link_generation(intptr_t device) except? 0 +cpdef unsigned int device_get_max_pcie_link_width(intptr_t device) except? 0 +cpdef unsigned int device_get_curr_pcie_link_generation(intptr_t device) except? 0 +cpdef unsigned int device_get_curr_pcie_link_width(intptr_t device) except? 0 +cpdef unsigned int device_get_pcie_throughput(intptr_t device, int counter) except? 0 +cpdef unsigned int device_get_pcie_replay_counter(intptr_t device) except? 0 +cpdef unsigned int device_get_clock_info(intptr_t device, int type) except? 0 +cpdef unsigned int device_get_max_clock_info(intptr_t device, int type) except? 0 +cpdef int device_get_gpc_clk_vf_offset(intptr_t device) except? 0 +cpdef unsigned int device_get_clock(intptr_t device, int clock_type, int clock_id) except? 0 +cpdef unsigned int device_get_max_customer_boost_clock(intptr_t device, int clock_type) except? 0 +cpdef object device_get_supported_memory_clocks(intptr_t device) +cpdef object device_get_supported_graphics_clocks(intptr_t device, unsigned int memory_clock_m_hz) +cpdef tuple device_get_auto_boosted_clocks_enabled(intptr_t device) +cpdef unsigned int device_get_fan_speed(intptr_t device) except? 0 +cpdef unsigned int device_get_fan_speed_v2(intptr_t device, unsigned int fan) except? 0 +cpdef unsigned int device_get_target_fan_speed(intptr_t device, unsigned int fan) except? 0 +cpdef tuple device_get_min_max_fan_speed(intptr_t device) +cpdef unsigned int device_get_fan_control_policy_v2(intptr_t device, unsigned int fan) except * +cpdef unsigned int device_get_num_fans(intptr_t device) except? 0 +cpdef object device_get_cooler_info(intptr_t device) +cpdef unsigned int device_get_temperature_threshold(intptr_t device, int threshold_type) except? 0 +cpdef object device_get_thermal_settings(intptr_t device, unsigned int sensor_index) +cpdef int device_get_performance_state(intptr_t device) except? -1 +cpdef unsigned long long device_get_current_clocks_event_reasons(intptr_t device) except? 0 +cpdef unsigned long long device_get_supported_clocks_event_reasons(intptr_t device) except? 0 +cpdef int device_get_power_state(intptr_t device) except? -1 +cpdef object device_get_dynamic_pstates_info(intptr_t device) +cpdef int device_get_mem_clk_vf_offset(intptr_t device) except? 0 +cpdef tuple device_get_min_max_clock_of_p_state(intptr_t device, int type, int pstate) +cpdef tuple device_get_gpc_clk_min_max_vf_offset(intptr_t device) +cpdef tuple device_get_mem_clk_min_max_vf_offset(intptr_t device) +cpdef device_set_clock_offsets(intptr_t device, intptr_t info) +cpdef unsigned int device_get_power_management_limit(intptr_t device) except? 0 +cpdef tuple device_get_power_management_limit_constraints(intptr_t device) +cpdef unsigned int device_get_power_management_default_limit(intptr_t device) except? 0 +cpdef unsigned int device_get_power_usage(intptr_t device) except? 0 +cpdef unsigned long long device_get_total_energy_consumption(intptr_t device) except? 0 +cpdef unsigned int device_get_enforced_power_limit(intptr_t device) except? 0 +cpdef tuple device_get_gpu_operation_mode(intptr_t device) +cpdef object device_get_memory_info_v2(intptr_t device) +cpdef int device_get_compute_mode(intptr_t device) except? -1 +cpdef tuple device_get_cuda_compute_capability(intptr_t device) +cpdef tuple device_get_ecc_mode(intptr_t device) +cpdef int device_get_default_ecc_mode(intptr_t device) except? -1 +cpdef unsigned int device_get_board_id(intptr_t device) except? 0 +cpdef unsigned int device_get_multi_gpu_board(intptr_t device) except? 0 +cpdef unsigned long long device_get_total_ecc_errors(intptr_t device, int error_type, int counter_type) except? 0 +cpdef unsigned long long device_get_memory_error_counter(intptr_t device, int error_type, int counter_type, int location_type) except? 0 +cpdef object device_get_utilization_rates(intptr_t device) +cpdef tuple device_get_encoder_utilization(intptr_t device) +cpdef unsigned int device_get_encoder_capacity(intptr_t device, int encoder_query_type) except? 0 +cpdef tuple device_get_encoder_stats(intptr_t device) +cpdef object device_get_encoder_sessions(intptr_t device) +cpdef tuple device_get_decoder_utilization(intptr_t device) +cpdef tuple device_get_jpg_utilization(intptr_t device) +cpdef tuple device_get_ofa_utilization(intptr_t device) +cpdef object device_get_fbc_stats(intptr_t device) +cpdef object device_get_fbc_sessions(intptr_t device) +cpdef tuple device_get_driver_model_v2(intptr_t device) +cpdef str device_get_vbios_version(intptr_t device) +cpdef object device_get_bridge_chip_info(intptr_t device) +cpdef object device_get_compute_running_processes_v3(intptr_t device) +cpdef object device_get_graphics_running_processes_v3(intptr_t device) +cpdef object device_get_mps_compute_running_processes_v3(intptr_t device) +cpdef int device_on_same_board(intptr_t device1, intptr_t device2) except? 0 +cpdef int device_get_api_restriction(intptr_t device, int api_type) except? -1 +cpdef object device_get_bar1_memory_info(intptr_t device) +cpdef unsigned int device_get_irq_num(intptr_t device) except? 0 +cpdef unsigned int device_get_num_gpu_cores(intptr_t device) except? 0 +cpdef unsigned int device_get_power_source(intptr_t device) except * +cpdef unsigned int device_get_memory_bus_width(intptr_t device) except? 0 +cpdef unsigned int device_get_pcie_link_max_speed(intptr_t device) except? 0 +cpdef unsigned int device_get_pcie_speed(intptr_t device) except? 0 +cpdef unsigned int device_get_adaptive_clock_info_status(intptr_t device) except? 0 +cpdef unsigned int device_get_bus_type(intptr_t device) except? 0 +cpdef object system_get_conf_compute_capabilities() +cpdef object system_get_conf_compute_state() +cpdef object device_get_conf_compute_mem_size_info(intptr_t device) +cpdef unsigned int system_get_conf_compute_gpus_ready_state() except? 0 +cpdef object device_get_conf_compute_protected_memory_usage(intptr_t device) +cpdef object device_get_conf_compute_gpu_certificate(intptr_t device) +cpdef device_set_conf_compute_unprotected_mem_size(intptr_t device, unsigned long long size_ki_b) +cpdef system_set_conf_compute_gpus_ready_state(unsigned int is_accepting_work) +cpdef object system_get_conf_compute_settings() +cpdef char device_get_gsp_firmware_version(intptr_t device) except? 0 +cpdef tuple device_get_gsp_firmware_mode(intptr_t device) +cpdef object device_get_sram_ecc_error_status(intptr_t device) +cpdef int device_get_accounting_mode(intptr_t device) except? -1 +cpdef object device_get_accounting_stats(intptr_t device, unsigned int pid) +cpdef object device_get_accounting_pids(intptr_t device) +cpdef unsigned int device_get_accounting_buffer_size(intptr_t device) except? 0 +cpdef object device_get_retired_pages(intptr_t device, int cause) +cpdef int device_get_retired_pages_pending_status(intptr_t device) except? -1 +cpdef tuple device_get_remapped_rows(intptr_t device) +cpdef object device_get_row_remapper_histogram(intptr_t device) +cpdef unsigned int device_get_architecture(intptr_t device) except? 0 +cpdef object device_get_clk_mon_status(intptr_t device) +cpdef object device_get_process_utilization(intptr_t device, unsigned long long last_seen_time_stamp) +cpdef unit_set_led_state(intptr_t unit, int color) +cpdef device_set_persistence_mode(intptr_t device, int mode) +cpdef device_set_compute_mode(intptr_t device, int mode) +cpdef device_set_ecc_mode(intptr_t device, int ecc) +cpdef device_clear_ecc_error_counts(intptr_t device, int counter_type) +cpdef device_set_driver_model(intptr_t device, int driver_model, unsigned int flags) +cpdef device_set_gpu_locked_clocks(intptr_t device, unsigned int min_gpu_clock_m_hz, unsigned int max_gpu_clock_m_hz) +cpdef device_reset_gpu_locked_clocks(intptr_t device) +cpdef device_set_memory_locked_clocks(intptr_t device, unsigned int min_mem_clock_m_hz, unsigned int max_mem_clock_m_hz) +cpdef device_reset_memory_locked_clocks(intptr_t device) +cpdef device_set_auto_boosted_clocks_enabled(intptr_t device, int enabled) +cpdef device_set_default_auto_boosted_clocks_enabled(intptr_t device, int enabled, unsigned int flags) +cpdef device_set_default_fan_speed_v2(intptr_t device, unsigned int fan) +cpdef device_set_fan_control_policy(intptr_t device, unsigned int fan, unsigned int policy) +cpdef device_set_gpu_operation_mode(intptr_t device, int mode) +cpdef device_set_api_restriction(intptr_t device, int api_type, int is_restricted) +cpdef device_set_fan_speed_v2(intptr_t device, unsigned int fan, unsigned int speed) +cpdef device_set_accounting_mode(intptr_t device, int mode) +cpdef device_clear_accounting_pids(intptr_t device) +cpdef int device_get_nvlink_state(intptr_t device, unsigned int link) except? -1 +cpdef unsigned int device_get_nvlink_version(intptr_t device, unsigned int link) except? 0 +cpdef unsigned int device_get_nvlink_capability(intptr_t device, unsigned int link, int capability) except? 0 +cpdef object device_get_nvlink_remote_pci_info_v2(intptr_t device, unsigned int link) +cpdef unsigned long long device_get_nvlink_error_counter(intptr_t device, unsigned int link, int counter) except? 0 +cpdef device_reset_nvlink_error_counters(intptr_t device, unsigned int link) +cpdef int device_get_nvlink_remote_device_type(intptr_t device, unsigned int link) except? -1 +cpdef system_set_nvlink_bw_mode(unsigned int nvlink_bw_mode) +cpdef unsigned int system_get_nvlink_bw_mode() except? 0 +cpdef object device_get_nvlink_supported_bw_modes(intptr_t device) +cpdef object device_get_nvlink_bw_mode(intptr_t device) +cpdef device_set_nvlink_bw_mode(intptr_t device, intptr_t set_bw_mode) +cpdef intptr_t event_set_create() except? 0 +cpdef device_register_events(intptr_t device, unsigned long long event_types, intptr_t set) +cpdef unsigned long long device_get_supported_event_types(intptr_t device) except? 0 +cpdef object event_set_wait_v2(intptr_t set, unsigned int timeoutms) +cpdef event_set_free(intptr_t set) +cpdef device_modify_drain_state(intptr_t pci_info, int new_state) +cpdef int device_query_drain_state(intptr_t pci_info) except? -1 +cpdef device_remove_gpu_v2(intptr_t pci_info, int gpu_state, int link_state) +cpdef device_discover_gpus(intptr_t pci_info) +cpdef int device_get_virtualization_mode(intptr_t device) except? -1 +cpdef int device_get_host_vgpu_mode(intptr_t device) except? -1 +cpdef device_set_virtualization_mode(intptr_t device, int virtual_mode) +cpdef unsigned long long vgpu_type_get_gsp_heap_size(unsigned int vgpu_type_id) except? 0 +cpdef unsigned long long vgpu_type_get_fb_reservation(unsigned int vgpu_type_id) except? 0 +cpdef device_set_vgpu_capabilities(intptr_t device, int capability, int state) +cpdef object device_get_grid_licensable_features_v4(intptr_t device) +cpdef unsigned int get_vgpu_driver_capabilities(int capability) except? 0 +cpdef unsigned int device_get_vgpu_capabilities(intptr_t device, int capability) except? 0 +cpdef str vgpu_type_get_class(unsigned int vgpu_type_id) +cpdef unsigned int vgpu_type_get_gpu_instance_profile_id(unsigned int vgpu_type_id) except? 0 +cpdef tuple vgpu_type_get_device_id(unsigned int vgpu_type_id) +cpdef unsigned long long vgpu_type_get_framebuffer_size(unsigned int vgpu_type_id) except? 0 +cpdef unsigned int vgpu_type_get_num_display_heads(unsigned int vgpu_type_id) except? 0 +cpdef tuple vgpu_type_get_resolution(unsigned int vgpu_type_id, unsigned int display_index) +cpdef str vgpu_type_get_license(unsigned int vgpu_type_id) +cpdef unsigned int vgpu_type_get_frame_rate_limit(unsigned int vgpu_type_id) except? 0 +cpdef unsigned int vgpu_type_get_max_instances(intptr_t device, unsigned int vgpu_type_id) except? 0 +cpdef unsigned int vgpu_type_get_max_instances_per_vm(unsigned int vgpu_type_id) except? 0 +cpdef object vgpu_type_get_bar1_info(unsigned int vgpu_type_id) +cpdef str vgpu_instance_get_uuid(unsigned int vgpu_instance) +cpdef str vgpu_instance_get_vm_driver_version(unsigned int vgpu_instance) +cpdef unsigned long long vgpu_instance_get_fb_usage(unsigned int vgpu_instance) except? 0 +cpdef unsigned int vgpu_instance_get_license_status(unsigned int vgpu_instance) except? 0 +cpdef unsigned int vgpu_instance_get_type(unsigned int vgpu_instance) except? 0 +cpdef unsigned int vgpu_instance_get_frame_rate_limit(unsigned int vgpu_instance) except? 0 +cpdef int vgpu_instance_get_ecc_mode(unsigned int vgpu_instance) except? -1 +cpdef unsigned int vgpu_instance_get_encoder_capacity(unsigned int vgpu_instance) except? 0 +cpdef vgpu_instance_set_encoder_capacity(unsigned int vgpu_instance, unsigned int encoder_capacity) +cpdef tuple vgpu_instance_get_encoder_stats(unsigned int vgpu_instance) +cpdef object vgpu_instance_get_encoder_sessions(unsigned int vgpu_instance) +cpdef object vgpu_instance_get_fbc_stats(unsigned int vgpu_instance) +cpdef object vgpu_instance_get_fbc_sessions(unsigned int vgpu_instance) +cpdef unsigned int vgpu_instance_get_gpu_instance_id(unsigned int vgpu_instance) except? 0 +cpdef str vgpu_instance_get_gpu_pci_id(unsigned int vgpu_instance) +cpdef unsigned int vgpu_type_get_capabilities(unsigned int vgpu_type_id, int capability) except? 0 +cpdef str vgpu_instance_get_mdev_uuid(unsigned int vgpu_instance) +cpdef gpu_instance_set_vgpu_scheduler_state(intptr_t gpu_instance, intptr_t p_scheduler) +cpdef object gpu_instance_get_vgpu_scheduler_state(intptr_t gpu_instance) +cpdef object gpu_instance_get_vgpu_scheduler_log(intptr_t gpu_instance) +cpdef str device_get_pgpu_metadata_string(intptr_t device) +cpdef object device_get_vgpu_scheduler_log(intptr_t device) +cpdef object device_get_vgpu_scheduler_state(intptr_t device) +cpdef object device_get_vgpu_scheduler_capabilities(intptr_t device) +cpdef device_set_vgpu_scheduler_state(intptr_t device, intptr_t p_scheduler_state) +cpdef set_vgpu_version(intptr_t vgpu_version) +cpdef tuple device_get_vgpu_process_utilization(intptr_t device, unsigned long long last_seen_time_stamp) +cpdef int vgpu_instance_get_accounting_mode(unsigned int vgpu_instance) except? -1 +cpdef object vgpu_instance_get_accounting_pids(unsigned int vgpu_instance) +cpdef object vgpu_instance_get_accounting_stats(unsigned int vgpu_instance, unsigned int pid) +cpdef vgpu_instance_clear_accounting_pids(unsigned int vgpu_instance) +cpdef object vgpu_instance_get_license_info_v2(unsigned int vgpu_instance) +cpdef unsigned int get_excluded_device_count() except? 0 +cpdef object get_excluded_device_info_by_index(unsigned int index) +cpdef int device_set_mig_mode(intptr_t device, unsigned int mode) except? -1 +cpdef tuple device_get_mig_mode(intptr_t device) +cpdef object device_get_gpu_instance_possible_placements_v2(intptr_t device, unsigned int profile_id) +cpdef unsigned int device_get_gpu_instance_remaining_capacity(intptr_t device, unsigned int profile_id) except? 0 +cpdef intptr_t device_create_gpu_instance(intptr_t device, unsigned int profile_id) except? 0 +cpdef intptr_t device_create_gpu_instance_with_placement(intptr_t device, unsigned int profile_id, intptr_t placement) except? 0 +cpdef gpu_instance_destroy(intptr_t gpu_instance) +cpdef intptr_t device_get_gpu_instance_by_id(intptr_t device, unsigned int id) except? 0 +cpdef object gpu_instance_get_info(intptr_t gpu_instance) +cpdef object gpu_instance_get_compute_instance_profile_info_v(intptr_t gpu_instance, unsigned int profile, unsigned int eng_profile) +cpdef unsigned int gpu_instance_get_compute_instance_remaining_capacity(intptr_t gpu_instance, unsigned int profile_id) except? 0 +cpdef object gpu_instance_get_compute_instance_possible_placements(intptr_t gpu_instance, unsigned int profile_id) +cpdef intptr_t gpu_instance_create_compute_instance(intptr_t gpu_instance, unsigned int profile_id) except? 0 +cpdef intptr_t gpu_instance_create_compute_instance_with_placement(intptr_t gpu_instance, unsigned int profile_id, intptr_t placement) except? 0 +cpdef compute_instance_destroy(intptr_t compute_instance) +cpdef intptr_t gpu_instance_get_compute_instance_by_id(intptr_t gpu_instance, unsigned int id) except? 0 +cpdef object compute_instance_get_info_v2(intptr_t compute_instance) +cpdef unsigned int device_is_mig_device_handle(intptr_t device) except? 0 +cpdef unsigned int device_get_gpu_instance_id(intptr_t device) except? 0 +cpdef unsigned int device_get_compute_instance_id(intptr_t device) except? 0 +cpdef unsigned int device_get_max_mig_device_count(intptr_t device) except? 0 +cpdef intptr_t device_get_mig_device_handle_by_index(intptr_t device, unsigned int index) except? 0 +cpdef intptr_t device_get_device_handle_from_mig_device_handle(intptr_t mig_device) except? 0 +cpdef device_power_smoothing_activate_preset_profile(intptr_t device, intptr_t profile) +cpdef device_power_smoothing_update_preset_profile_param(intptr_t device, intptr_t profile) +cpdef device_power_smoothing_set_state(intptr_t device, intptr_t state) +cpdef object device_get_addressing_mode(intptr_t device) +cpdef object device_get_repair_status(intptr_t device) +cpdef object device_get_power_mizer_mode_v1(intptr_t device) +cpdef device_set_power_mizer_mode_v1(intptr_t device, intptr_t power_mizer_mode) +cpdef device_vgpu_force_gsp_unload(intptr_t device) +cpdef object device_get_vgpu_scheduler_state_v2(intptr_t device) +cpdef object gpu_instance_get_vgpu_scheduler_state_v2(intptr_t gpu_instance) +cpdef object device_get_vgpu_scheduler_log_v2(intptr_t device) +cpdef object gpu_instance_get_vgpu_scheduler_log_v2(intptr_t gpu_instance) +cpdef device_set_vgpu_scheduler_state_v2(intptr_t device, intptr_t p_scheduler_state) +cpdef gpu_instance_set_vgpu_scheduler_state_v2(intptr_t gpu_instance, intptr_t p_scheduler_state) diff --git a/cuda_bindings/cuda/bindings/nvml.pyx b/cuda_bindings/cuda/bindings/nvml.pyx new file mode 100644 index 00000000000..a51d4264363 --- /dev/null +++ b/cuda_bindings/cuda/bindings/nvml.pyx @@ -0,0 +1,28473 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +# This code was automatically generated across versions from 12.9.1 to 13.3.0. Do not modify it directly. +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=e47a16bd9956de14a991ded5d1aef667cdd26a141e27db5b2015b91be6918d3c + + +# <<<< PREAMBLE CONTENT >>>> + +cimport cpython as _cyb_cpython +cimport cpython.buffer as _cyb_cpython_buffer +cimport cpython.memoryview as _cyb_cpython_memoryview +from cython cimport view as _cyb_view +from libc.stdlib cimport ( + calloc as _cyb_calloc, + free as _cyb_free, + malloc as _cyb_malloc, +) +from libc.string cimport ( + memcmp as _cyb_memcmp, + memcpy as _cyb_memcpy, +) + +from cuda.bindings._internal._fast_enum import FastEnum as _cyb_FastEnum + +import numpy as _numpy + +cdef _cyb___getbuffer(object self, _cyb_cpython.Py_buffer *buffer, void *ptr, int size, bint readonly): + buffer.buf = ptr + buffer.format = 'b' + buffer.internal = NULL + buffer.itemsize = 1 + buffer.len = size + buffer.ndim = 1 + buffer.obj = self + buffer.readonly = readonly + buffer.shape = &buffer.len + buffer.strides = &buffer.itemsize + buffer.suboffsets = NULL + +cdef _cyb_from_buffer(buffer, size, lowpp_type): + cdef _cyb_cpython.Py_buffer view + if _cyb_cpython.PyObject_GetBuffer(buffer, &view, _cyb_cpython_buffer.PyBUF_SIMPLE) != 0: + raise TypeError("buffer argument does not support the buffer protocol") + try: + if view.itemsize != 1: + raise ValueError("buffer itemsize must be 1 byte") + if view.len != size: + raise ValueError(f"buffer length must be {size} bytes") + return lowpp_type.from_ptr(view.buf, not view.readonly, buffer) + finally: + _cyb_cpython.PyBuffer_Release(&view) + +cdef _cyb_from_data(data, dtype_name, expected_dtype, lowpp_type): + # _numpy.recarray is a subclass of _numpy.ndarray, so implicitly handled here. + if isinstance(data, lowpp_type): + return data + if not isinstance(data, _numpy.ndarray): + raise TypeError("data argument must be a NumPy ndarray") + if data.size != 1: + raise ValueError("data array must have a size of 1") + if data.dtype != expected_dtype: + raise ValueError(f"data array must be of dtype {dtype_name}") + return lowpp_type.from_ptr(data.ctypes.data, not data.flags.writeable, data) + + +# <<<< END OF PREAMBLE CONTENT >>>> + +cimport cython # NOQA +from cython cimport view +cimport cpython +from libc.string cimport memcpy + +from ._internal.utils cimport (get_buffer_pointer, get_nested_resource_ptr, + nested_resource) + +from cuda.bindings._internal._fast_enum import FastEnum as _FastEnum + +from cuda.bindings.cydriver cimport CUDA_VERSION + + +cdef inline unsigned int NVML_VERSION_STRUCT(const unsigned int size, const unsigned int ver) nogil: + return (size | (ver << 24)) + + +############################################################################### +# Enum +############################################################################### + +class BridgeChipType(_cyb_FastEnum): + """ + Enum to represent type of bridge chip + + See `nvmlBridgeChipType_t`. + """ + BRIDGE_CHIP_PLX = NVML_BRIDGE_CHIP_PLX + BRIDGE_CHIP_BRO4 = NVML_BRIDGE_CHIP_BRO4 + +class NvLinkUtilizationCountUnits(_cyb_FastEnum): + """ + Enum to represent the NvLink utilization counter packet units + + See `nvmlNvLinkUtilizationCountUnits_t`. + """ + NVLINK_COUNTER_UNIT_CYCLES = NVML_NVLINK_COUNTER_UNIT_CYCLES + NVLINK_COUNTER_UNIT_PACKETS = NVML_NVLINK_COUNTER_UNIT_PACKETS + NVLINK_COUNTER_UNIT_BYTES = NVML_NVLINK_COUNTER_UNIT_BYTES + NVLINK_COUNTER_UNIT_RESERVED = NVML_NVLINK_COUNTER_UNIT_RESERVED + NVLINK_COUNTER_UNIT_COUNT = NVML_NVLINK_COUNTER_UNIT_COUNT + +class NvLinkUtilizationCountPktTypes(_cyb_FastEnum): + """ + Enum to represent the NvLink utilization counter packet types to count + ** this is ONLY applicable with the units as packets or bytes ** as + specified in ``nvmlNvLinkUtilizationCountUnits_t`` ** all packet filter + descriptions are target GPU centric ** these can be "OR'd" together + + See `nvmlNvLinkUtilizationCountPktTypes_t`. + """ + NVLINK_COUNTER_PKTFILTER_NOP = NVML_NVLINK_COUNTER_PKTFILTER_NOP + NVLINK_COUNTER_PKTFILTER_READ = NVML_NVLINK_COUNTER_PKTFILTER_READ + NVLINK_COUNTER_PKTFILTER_WRITE = NVML_NVLINK_COUNTER_PKTFILTER_WRITE + NVLINK_COUNTER_PKTFILTER_RATOM = NVML_NVLINK_COUNTER_PKTFILTER_RATOM + NVLINK_COUNTER_PKTFILTER_NRATOM = NVML_NVLINK_COUNTER_PKTFILTER_NRATOM + NVLINK_COUNTER_PKTFILTER_FLUSH = NVML_NVLINK_COUNTER_PKTFILTER_FLUSH + NVLINK_COUNTER_PKTFILTER_RESPDATA = NVML_NVLINK_COUNTER_PKTFILTER_RESPDATA + NVLINK_COUNTER_PKTFILTER_RESPNODATA = NVML_NVLINK_COUNTER_PKTFILTER_RESPNODATA + NVLINK_COUNTER_PKTFILTER_ALL = NVML_NVLINK_COUNTER_PKTFILTER_ALL + +class NvLinkCapability(_cyb_FastEnum): + """ + Enum to represent NvLink queryable capabilities + + See `nvmlNvLinkCapability_t`. + """ + NVLINK_CAP_P2P_SUPPORTED = NVML_NVLINK_CAP_P2P_SUPPORTED + NVLINK_CAP_SYSMEM_ACCESS = NVML_NVLINK_CAP_SYSMEM_ACCESS + NVLINK_CAP_P2P_ATOMICS = NVML_NVLINK_CAP_P2P_ATOMICS + NVLINK_CAP_SYSMEM_ATOMICS = NVML_NVLINK_CAP_SYSMEM_ATOMICS + NVLINK_CAP_SLI_BRIDGE = NVML_NVLINK_CAP_SLI_BRIDGE + NVLINK_CAP_VALID = NVML_NVLINK_CAP_VALID + NVLINK_CAP_COUNT = NVML_NVLINK_CAP_COUNT + +class NvLinkErrorCounter(_cyb_FastEnum): + """ + Enum to represent NvLink queryable error counters + + See `nvmlNvLinkErrorCounter_t`. + """ + NVLINK_ERROR_DL_REPLAY = NVML_NVLINK_ERROR_DL_REPLAY + NVLINK_ERROR_DL_RECOVERY = NVML_NVLINK_ERROR_DL_RECOVERY + NVLINK_ERROR_DL_CRC_FLIT = NVML_NVLINK_ERROR_DL_CRC_FLIT + NVLINK_ERROR_DL_CRC_DATA = NVML_NVLINK_ERROR_DL_CRC_DATA + NVLINK_ERROR_DL_ECC_DATA = NVML_NVLINK_ERROR_DL_ECC_DATA + NVLINK_ERROR_COUNT = NVML_NVLINK_ERROR_COUNT + +class IntNvLinkDeviceType(_cyb_FastEnum): + """ + Enum to represent NvLink's remote device type + + See `nvmlIntNvLinkDeviceType_t`. + """ + NVLINK_DEVICE_TYPE_GPU = NVML_NVLINK_DEVICE_TYPE_GPU + NVLINK_DEVICE_TYPE_IBMNPU = NVML_NVLINK_DEVICE_TYPE_IBMNPU + NVLINK_DEVICE_TYPE_SWITCH = NVML_NVLINK_DEVICE_TYPE_SWITCH + NVLINK_DEVICE_TYPE_UNKNOWN = NVML_NVLINK_DEVICE_TYPE_UNKNOWN + +class GpuTopologyLevel(_cyb_FastEnum): + """ + Represents level relationships within a system between two GPUs The + enums are spaced to allow for future relationships + + See `nvmlGpuTopologyLevel_t`. + """ + TOPOLOGY_INTERNAL = NVML_TOPOLOGY_INTERNAL + TOPOLOGY_SINGLE = NVML_TOPOLOGY_SINGLE + TOPOLOGY_MULTIPLE = NVML_TOPOLOGY_MULTIPLE + TOPOLOGY_HOSTBRIDGE = NVML_TOPOLOGY_HOSTBRIDGE + TOPOLOGY_NODE = NVML_TOPOLOGY_NODE + TOPOLOGY_SYSTEM = NVML_TOPOLOGY_SYSTEM + +class GpuP2PStatus(_cyb_FastEnum): + """ + See `nvmlGpuP2PStatus_t`. + """ + P2P_STATUS_OK = NVML_P2P_STATUS_OK + P2P_STATUS_CHIPSET_NOT_SUPPORED = NVML_P2P_STATUS_CHIPSET_NOT_SUPPORED + P2P_STATUS_CHIPSET_NOT_SUPPORTED = NVML_P2P_STATUS_CHIPSET_NOT_SUPPORTED + P2P_STATUS_GPU_NOT_SUPPORTED = NVML_P2P_STATUS_GPU_NOT_SUPPORTED + P2P_STATUS_IOH_TOPOLOGY_NOT_SUPPORTED = NVML_P2P_STATUS_IOH_TOPOLOGY_NOT_SUPPORTED + P2P_STATUS_DISABLED_BY_REGKEY = NVML_P2P_STATUS_DISABLED_BY_REGKEY + P2P_STATUS_NOT_SUPPORTED = NVML_P2P_STATUS_NOT_SUPPORTED + P2P_STATUS_UNKNOWN = NVML_P2P_STATUS_UNKNOWN + +class GpuP2PCapsIndex(_cyb_FastEnum): + """ + See `nvmlGpuP2PCapsIndex_t`. + """ + P2P_CAPS_INDEX_READ = NVML_P2P_CAPS_INDEX_READ + P2P_CAPS_INDEX_WRITE = NVML_P2P_CAPS_INDEX_WRITE + P2P_CAPS_INDEX_NVLINK = NVML_P2P_CAPS_INDEX_NVLINK + P2P_CAPS_INDEX_ATOMICS = NVML_P2P_CAPS_INDEX_ATOMICS + P2P_CAPS_INDEX_PCI = NVML_P2P_CAPS_INDEX_PCI + P2P_CAPS_INDEX_PROP = NVML_P2P_CAPS_INDEX_PROP + P2P_CAPS_INDEX_UNKNOWN = NVML_P2P_CAPS_INDEX_UNKNOWN + +class SamplingType(_cyb_FastEnum): + """ + Represents Type of Sampling Event + + See `nvmlSamplingType_t`. + """ + TOTAL_POWER_SAMPLES = (NVML_TOTAL_POWER_SAMPLES, 'To represent total power drawn by GPU.') + GPU_UTILIZATION_SAMPLES = (NVML_GPU_UTILIZATION_SAMPLES, 'To represent percent of time during which one or more kernels was executing on the GPU.') + MEMORY_UTILIZATION_SAMPLES = (NVML_MEMORY_UTILIZATION_SAMPLES, 'To represent percent of time during which global (device) memory was being read or written.') + ENC_UTILIZATION_SAMPLES = (NVML_ENC_UTILIZATION_SAMPLES, 'To represent percent of time during which NVENC remains busy.') + DEC_UTILIZATION_SAMPLES = (NVML_DEC_UTILIZATION_SAMPLES, 'To represent percent of time during which NVDEC remains busy.') + PROCESSOR_CLK_SAMPLES = (NVML_PROCESSOR_CLK_SAMPLES, 'To represent processor clock samples.') + MEMORY_CLK_SAMPLES = (NVML_MEMORY_CLK_SAMPLES, 'To represent memory clock samples.') + MODULE_POWER_SAMPLES = (NVML_MODULE_POWER_SAMPLES, 'To represent module power samples for total module starting Grace Hopper.') + JPG_UTILIZATION_SAMPLES = (NVML_JPG_UTILIZATION_SAMPLES, 'To represent percent of time during which NVJPG remains busy.') + OFA_UTILIZATION_SAMPLES = (NVML_OFA_UTILIZATION_SAMPLES, 'To represent percent of time during which NVOFA remains busy.') + SAMPLINGTYPE_COUNT = NVML_SAMPLINGTYPE_COUNT + +class PcieUtilCounter(_cyb_FastEnum): + """ + Represents the queryable PCIe utilization counters + + See `nvmlPcieUtilCounter_t`. + """ + PCIE_UTIL_TX_BYTES = NVML_PCIE_UTIL_TX_BYTES + PCIE_UTIL_RX_BYTES = NVML_PCIE_UTIL_RX_BYTES + PCIE_UTIL_COUNT = NVML_PCIE_UTIL_COUNT + +class ValueType(_cyb_FastEnum): + """ + Represents the type for sample value returned + + See `nvmlValueType_t`. + """ + DOUBLE = NVML_VALUE_TYPE_DOUBLE + UNSIGNED_INT = NVML_VALUE_TYPE_UNSIGNED_INT + UNSIGNED_LONG = NVML_VALUE_TYPE_UNSIGNED_LONG + UNSIGNED_LONG_LONG = NVML_VALUE_TYPE_UNSIGNED_LONG_LONG + SIGNED_LONG_LONG = NVML_VALUE_TYPE_SIGNED_LONG_LONG + SIGNED_INT = NVML_VALUE_TYPE_SIGNED_INT + UNSIGNED_SHORT = NVML_VALUE_TYPE_UNSIGNED_SHORT + COUNT = NVML_VALUE_TYPE_COUNT + +class PerfPolicyType(_cyb_FastEnum): + """ + Represents type of perf policy for which violation times can be queried + + See `nvmlPerfPolicyType_t`. + """ + PERF_POLICY_POWER = (NVML_PERF_POLICY_POWER, 'How long did power violations cause the GPU to be below application clocks.') + PERF_POLICY_THERMAL = (NVML_PERF_POLICY_THERMAL, 'How long did thermal violations cause the GPU to be below application clocks.') + PERF_POLICY_SYNC_BOOST = (NVML_PERF_POLICY_SYNC_BOOST, 'How long did sync boost cause the GPU to be below application clocks.') + PERF_POLICY_BOARD_LIMIT = (NVML_PERF_POLICY_BOARD_LIMIT, 'How long did the board limit cause the GPU to be below application clocks.') + PERF_POLICY_LOW_UTILIZATION = (NVML_PERF_POLICY_LOW_UTILIZATION, 'How long did low utilization cause the GPU to be below application clocks.') + PERF_POLICY_RELIABILITY = (NVML_PERF_POLICY_RELIABILITY, 'How long did the board reliability limit cause the GPU to be below application clocks.') + PERF_POLICY_TOTAL_APP_CLOCKS = (NVML_PERF_POLICY_TOTAL_APP_CLOCKS, 'Total time the GPU was held below application clocks by any limiter (0 - 5 above).') + PERF_POLICY_TOTAL_BASE_CLOCKS = (NVML_PERF_POLICY_TOTAL_BASE_CLOCKS, 'Total time the GPU was held below base clocks.') + PERF_POLICY_COUNT = NVML_PERF_POLICY_COUNT + +class ThermalTarget(_cyb_FastEnum): + """ + Represents the thermal sensor targets + + See `nvmlThermalTarget_t`. + """ + NONE = NVML_THERMAL_TARGET_NONE + GPU = (NVML_THERMAL_TARGET_GPU, 'GPU core temperature requires NvPhysicalGpuHandle.') + MEMORY = (NVML_THERMAL_TARGET_MEMORY, 'GPU memory temperature requires NvPhysicalGpuHandle.') + POWER_SUPPLY = (NVML_THERMAL_TARGET_POWER_SUPPLY, 'GPU power supply temperature requires NvPhysicalGpuHandle.') + BOARD = (NVML_THERMAL_TARGET_BOARD, 'GPU board ambient temperature requires NvPhysicalGpuHandle.') + VCD_BOARD = (NVML_THERMAL_TARGET_VCD_BOARD, 'Visual Computing Device Board temperature requires NvVisualComputingDeviceHandle.') + VCD_INLET = (NVML_THERMAL_TARGET_VCD_INLET, 'Visual Computing Device Inlet temperature requires NvVisualComputingDeviceHandle.') + VCD_OUTLET = (NVML_THERMAL_TARGET_VCD_OUTLET, 'Visual Computing Device Outlet temperature requires NvVisualComputingDeviceHandle.') + ALL = NVML_THERMAL_TARGET_ALL + UNKNOWN = NVML_THERMAL_TARGET_UNKNOWN + +class ThermalController(_cyb_FastEnum): + """ + Represents the thermal sensor controllers + + See `nvmlThermalController_t`. + """ + NONE = NVML_THERMAL_CONTROLLER_NONE + GPU_INTERNAL = NVML_THERMAL_CONTROLLER_GPU_INTERNAL + ADM1032 = NVML_THERMAL_CONTROLLER_ADM1032 + ADT7461 = NVML_THERMAL_CONTROLLER_ADT7461 + MAX6649 = NVML_THERMAL_CONTROLLER_MAX6649 + MAX1617 = NVML_THERMAL_CONTROLLER_MAX1617 + LM99 = NVML_THERMAL_CONTROLLER_LM99 + LM89 = NVML_THERMAL_CONTROLLER_LM89 + LM64 = NVML_THERMAL_CONTROLLER_LM64 + G781 = NVML_THERMAL_CONTROLLER_G781 + ADT7473 = NVML_THERMAL_CONTROLLER_ADT7473 + SBMAX6649 = NVML_THERMAL_CONTROLLER_SBMAX6649 + VBIOSEVT = NVML_THERMAL_CONTROLLER_VBIOSEVT + OS = NVML_THERMAL_CONTROLLER_OS + NVSYSCON_CANOAS = NVML_THERMAL_CONTROLLER_NVSYSCON_CANOAS + NVSYSCON_E551 = NVML_THERMAL_CONTROLLER_NVSYSCON_E551 + MAX6649R = NVML_THERMAL_CONTROLLER_MAX6649R + ADT7473S = NVML_THERMAL_CONTROLLER_ADT7473S + UNKNOWN = NVML_THERMAL_CONTROLLER_UNKNOWN + +class CoolerControl(_cyb_FastEnum): + """ + Cooler control type + + See `nvmlCoolerControl_t`. + """ + THERMAL_COOLER_SIGNAL_NONE = (NVML_THERMAL_COOLER_SIGNAL_NONE, 'This cooler has no control signal.') + THERMAL_COOLER_SIGNAL_TOGGLE = (NVML_THERMAL_COOLER_SIGNAL_TOGGLE, 'This cooler can only be toggled either ON or OFF (eg a switch).') + THERMAL_COOLER_SIGNAL_VARIABLE = (NVML_THERMAL_COOLER_SIGNAL_VARIABLE, "This cooler's level can be adjusted from some minimum to some maximum (eg a knob).") + THERMAL_COOLER_SIGNAL_COUNT = NVML_THERMAL_COOLER_SIGNAL_COUNT + +class CoolerTarget(_cyb_FastEnum): + """ + Cooler's target + + See `nvmlCoolerTarget_t`. + """ + THERMAL_NONE = (NVML_THERMAL_COOLER_TARGET_NONE, 'This cooler cools nothing.') + THERMAL_GPU = (NVML_THERMAL_COOLER_TARGET_GPU, 'This cooler can cool the GPU.') + THERMAL_MEMORY = (NVML_THERMAL_COOLER_TARGET_MEMORY, 'This cooler can cool the memory.') + THERMAL_POWER_SUPPLY = (NVML_THERMAL_COOLER_TARGET_POWER_SUPPLY, 'This cooler can cool the power supply.') + THERMAL_GPU_RELATED = (NVML_THERMAL_COOLER_TARGET_GPU_RELATED, 'This cooler cools all of the components related to its target gpu. GPU_RELATED = GPU | MEMORY | POWER_SUPPLY.') + +class UUIDType(_cyb_FastEnum): + """ + Enum to represent different UUID types + + See `nvmlUUIDType_t`. + """ + NONE = (NVML_UUID_TYPE_NONE, 'Undefined type.') + ASCII = (NVML_UUID_TYPE_ASCII, 'ASCII format type.') + BINARY = (NVML_UUID_TYPE_BINARY, 'Binary format type.') + +class EnableState(_cyb_FastEnum): + """ + Generic enable/disable enum. + + See `nvmlEnableState_t`. + """ + FEATURE_DISABLED = (NVML_FEATURE_DISABLED, 'Feature disabled.') + FEATURE_ENABLED = (NVML_FEATURE_ENABLED, 'Feature enabled.') + +class BrandType(_cyb_FastEnum): + """ + - The Brand of the GPU + + See `nvmlBrandType_t`. + """ + BRAND_UNKNOWN = NVML_BRAND_UNKNOWN + BRAND_QUADRO = NVML_BRAND_QUADRO + BRAND_TESLA = NVML_BRAND_TESLA + BRAND_NVS = NVML_BRAND_NVS + BRAND_GRID = NVML_BRAND_GRID + BRAND_GEFORCE = NVML_BRAND_GEFORCE + BRAND_TITAN = NVML_BRAND_TITAN + BRAND_NVIDIA_VAPPS = NVML_BRAND_NVIDIA_VAPPS + BRAND_NVIDIA_VPC = NVML_BRAND_NVIDIA_VPC + BRAND_NVIDIA_VCS = NVML_BRAND_NVIDIA_VCS + BRAND_NVIDIA_VWS = NVML_BRAND_NVIDIA_VWS + BRAND_NVIDIA_CLOUD_GAMING = NVML_BRAND_NVIDIA_CLOUD_GAMING + BRAND_NVIDIA_VGAMING = NVML_BRAND_NVIDIA_VGAMING + BRAND_QUADRO_RTX = NVML_BRAND_QUADRO_RTX + BRAND_NVIDIA_RTX = NVML_BRAND_NVIDIA_RTX + BRAND_NVIDIA = NVML_BRAND_NVIDIA + BRAND_GEFORCE_RTX = NVML_BRAND_GEFORCE_RTX + BRAND_TITAN_RTX = NVML_BRAND_TITAN_RTX + BRAND_COUNT = NVML_BRAND_COUNT + +class TemperatureThresholds(_cyb_FastEnum): + """ + Temperature thresholds. + + See `nvmlTemperatureThresholds_t`. + """ + TEMPERATURE_THRESHOLD_SHUTDOWN = NVML_TEMPERATURE_THRESHOLD_SHUTDOWN + TEMPERATURE_THRESHOLD_SLOWDOWN = NVML_TEMPERATURE_THRESHOLD_SLOWDOWN + TEMPERATURE_THRESHOLD_MEM_MAX = NVML_TEMPERATURE_THRESHOLD_MEM_MAX + TEMPERATURE_THRESHOLD_GPU_MAX = NVML_TEMPERATURE_THRESHOLD_GPU_MAX + TEMPERATURE_THRESHOLD_ACOUSTIC_MIN = NVML_TEMPERATURE_THRESHOLD_ACOUSTIC_MIN + TEMPERATURE_THRESHOLD_ACOUSTIC_CURR = NVML_TEMPERATURE_THRESHOLD_ACOUSTIC_CURR + TEMPERATURE_THRESHOLD_ACOUSTIC_MAX = NVML_TEMPERATURE_THRESHOLD_ACOUSTIC_MAX + TEMPERATURE_THRESHOLD_GPS_CURR = NVML_TEMPERATURE_THRESHOLD_GPS_CURR + TEMPERATURE_THRESHOLD_COUNT = NVML_TEMPERATURE_THRESHOLD_COUNT + +class TemperatureSensors(_cyb_FastEnum): + """ + Temperature sensors. + + See `nvmlTemperatureSensors_t`. + """ + TEMPERATURE_GPU = (NVML_TEMPERATURE_GPU, 'Temperature sensor for the GPU die.') + TEMPERATURE_COUNT = NVML_TEMPERATURE_COUNT + +class ComputeMode(_cyb_FastEnum): + """ + Compute mode. NVML_COMPUTEMODE_EXCLUSIVE_PROCESS was added in CUDA + 4.0. Earlier CUDA versions supported a single exclusive mode, which is + equivalent to NVML_COMPUTEMODE_EXCLUSIVE_THREAD in CUDA 4.0 and beyond. + + See `nvmlComputeMode_t`. + """ + COMPUTEMODE_DEFAULT = (NVML_COMPUTEMODE_DEFAULT, 'Default compute mode -- multiple contexts per device.') + COMPUTEMODE_EXCLUSIVE_THREAD = (NVML_COMPUTEMODE_EXCLUSIVE_THREAD, 'Support Removed.') + COMPUTEMODE_PROHIBITED = (NVML_COMPUTEMODE_PROHIBITED, 'Compute-prohibited mode -- no contexts per device.') + COMPUTEMODE_EXCLUSIVE_PROCESS = (NVML_COMPUTEMODE_EXCLUSIVE_PROCESS, 'Compute-exclusive-process mode -- only one context per device, usable from multiple threads at a time.') + COMPUTEMODE_COUNT = NVML_COMPUTEMODE_COUNT + +class MemoryErrorType(_cyb_FastEnum): + """ + Memory error types + + See `nvmlMemoryErrorType_t`. + """ + CORRECTED = (NVML_MEMORY_ERROR_TYPE_CORRECTED, 'A memory error that was corrected For ECC errors, these are single bit errors For Texture memory, these are errors fixed by resend') + UNCORRECTED = (NVML_MEMORY_ERROR_TYPE_UNCORRECTED, 'A memory error that was not corrected For ECC errors, these are double bit errors For Texture memory, these are errors where the resend fails') + COUNT = (NVML_MEMORY_ERROR_TYPE_COUNT, 'Count of memory error types.') + +class NvlinkVersion(_cyb_FastEnum): + """ + Represents Nvlink Version + + See `nvmlNvlinkVersion_t`. + """ + VERSION_INVALID = (NVML_NVLINK_VERSION_INVALID, 'NVLink version is invalid.') + VERSION_1_0 = (NVML_NVLINK_VERSION_1_0, 'NVLink Version 1.0.') + VERSION_2_0 = (NVML_NVLINK_VERSION_2_0, 'NVLink Version 2.0.') + VERSION_2_2 = (NVML_NVLINK_VERSION_2_2, 'NVLink Version 2.2.') + VERSION_3_0 = (NVML_NVLINK_VERSION_3_0, 'NVLink Version 3.0.') + VERSION_3_1 = (NVML_NVLINK_VERSION_3_1, 'NVLink Version 3.1.') + VERSION_4_0 = (NVML_NVLINK_VERSION_4_0, 'NVLink Version 4.0.') + VERSION_5_0 = (NVML_NVLINK_VERSION_5_0, 'NVLink Version 5.0.') + VERSION_6_0 = (NVML_NVLINK_VERSION_6_0, 'NVLink Version 6.0.') + +class EccCounterType(_cyb_FastEnum): + """ + ECC counter types. Note: Volatile counts are reset each time the + driver loads. On Windows this is once per boot. On Linux this can be + more frequent. On Linux the driver unloads when no active clients + exist. If persistence mode is enabled or there is always a driver + client active (e.g. X11), then Linux also sees per-boot behavior. If + not, volatile counts are reset each time a compute app is run. + + See `nvmlEccCounterType_t`. + """ + VOLATILE_ECC = (NVML_VOLATILE_ECC, 'Volatile counts are reset each time the driver loads.') + AGGREGATE_ECC = (NVML_AGGREGATE_ECC, 'Aggregate counts persist across reboots (i.e. for the lifetime of the device).') + COUNT = (NVML_ECC_COUNTER_TYPE_COUNT, 'Count of memory counter types.') + +class ClockType(_cyb_FastEnum): + """ + Clock types. All speeds are in Mhz. + + See `nvmlClockType_t`. + """ + CLOCK_GRAPHICS = (NVML_CLOCK_GRAPHICS, 'Graphics clock domain.') + CLOCK_SM = (NVML_CLOCK_SM, 'SM clock domain.') + CLOCK_MEM = (NVML_CLOCK_MEM, 'Memory clock domain.') + CLOCK_VIDEO = (NVML_CLOCK_VIDEO, 'Video encoder/decoder clock domain.') + CLOCK_COUNT = (NVML_CLOCK_COUNT, 'Count of clock types.') + +class ClockId(_cyb_FastEnum): + """ + Clock Ids. These are used in combination with `nvmlClockType_t` to + specify a single clock value. + + See `nvmlClockId_t`. + """ + CURRENT = (NVML_CLOCK_ID_CURRENT, 'Current actual clock value.') + APP_CLOCK_TARGET = (NVML_CLOCK_ID_APP_CLOCK_TARGET, 'Target application clock. Deprecated, do not use.') + APP_CLOCK_DEFAULT = (NVML_CLOCK_ID_APP_CLOCK_DEFAULT, 'Default application clock target Deprecated, do not use.') + CUSTOMER_BOOST_MAX = (NVML_CLOCK_ID_CUSTOMER_BOOST_MAX, 'OEM-defined maximum clock rate.') + COUNT = (NVML_CLOCK_ID_COUNT, 'Count of Clock Ids.') + +class DriverModel(_cyb_FastEnum): + """ + Driver models. Windows only. + + See `nvmlDriverModel_t`. + """ + DRIVER_WDDM = (NVML_DRIVER_WDDM, 'WDDM driver model -- GPU treated as a display device.') + DRIVER_WDM = (NVML_DRIVER_WDM, 'WDM (TCC) model (deprecated) -- GPU treated as a generic compute device.') + DRIVER_MCDM = (NVML_DRIVER_MCDM, 'MCDM driver model -- GPU treated as a Microsoft compute device.') + +class Pstates(_cyb_FastEnum): + """ + Allowed PStates. + + See `nvmlPstates_t`. + """ + PSTATE_0 = (NVML_PSTATE_0, 'Performance state 0 -- Maximum Performance.') + PSTATE_1 = (NVML_PSTATE_1, 'Performance state 1.') + PSTATE_2 = (NVML_PSTATE_2, 'Performance state 2.') + PSTATE_3 = (NVML_PSTATE_3, 'Performance state 3.') + PSTATE_4 = (NVML_PSTATE_4, 'Performance state 4.') + PSTATE_5 = (NVML_PSTATE_5, 'Performance state 5.') + PSTATE_6 = (NVML_PSTATE_6, 'Performance state 6.') + PSTATE_7 = (NVML_PSTATE_7, 'Performance state 7.') + PSTATE_8 = (NVML_PSTATE_8, 'Performance state 8.') + PSTATE_9 = (NVML_PSTATE_9, 'Performance state 9.') + PSTATE_10 = (NVML_PSTATE_10, 'Performance state 10.') + PSTATE_11 = (NVML_PSTATE_11, 'Performance state 11.') + PSTATE_12 = (NVML_PSTATE_12, 'Performance state 12.') + PSTATE_13 = (NVML_PSTATE_13, 'Performance state 13.') + PSTATE_14 = (NVML_PSTATE_14, 'Performance state 14.') + PSTATE_15 = (NVML_PSTATE_15, 'Performance state 15 -- Minimum Performance.') + PSTATE_UNKNOWN = (NVML_PSTATE_UNKNOWN, 'Unknown performance state.') + +class GpuOperationMode(_cyb_FastEnum): + """ + GPU Operation Mode GOM allows to reduce power usage and optimize GPU + throughput by disabling GPU features. Each GOM is designed to meet + specific user needs. + + See `nvmlGpuOperationMode_t`. + """ + GOM_ALL_ON = (NVML_GOM_ALL_ON, 'Everything is enabled and running at full speed.') + GOM_COMPUTE = (NVML_GOM_COMPUTE, 'Designed for running only compute tasks. Graphics operations are not allowed') + GOM_LOW_DP = (NVML_GOM_LOW_DP, "Designed for running graphics applications that don't require high bandwidth double precision") + +class InforomObject(_cyb_FastEnum): + """ + Available infoROM objects. + + See `nvmlInforomObject_t`. + """ + INFOROM_OEM = (NVML_INFOROM_OEM, 'An object defined by OEM.') + INFOROM_ECC = (NVML_INFOROM_ECC, 'The ECC object determining the level of ECC support.') + INFOROM_POWER = (NVML_INFOROM_POWER, 'The power management object.') + INFOROM_DEN = (NVML_INFOROM_DEN, 'DRAM Encryption object.') + INFOROM_COUNT = (NVML_INFOROM_COUNT, 'This counts the number of infoROM objects the driver knows about.') + +class Return(_cyb_FastEnum): + """ + Return values for NVML API calls. + + See `nvmlReturn_t`. + """ + SUCCESS = (NVML_SUCCESS, 'The operation was successful.') + ERROR_UNINITIALIZED = (NVML_ERROR_UNINITIALIZED, 'NVML was not first initialized with `nvmlInit()`.') + ERROR_INVALID_ARGUMENT = (NVML_ERROR_INVALID_ARGUMENT, 'A supplied argument is invalid.') + ERROR_NOT_SUPPORTED = (NVML_ERROR_NOT_SUPPORTED, 'The requested operation is not available on target device.') + ERROR_NO_PERMISSION = (NVML_ERROR_NO_PERMISSION, 'The current user does not have permission for operation.') + ERROR_ALREADY_INITIALIZED = (NVML_ERROR_ALREADY_INITIALIZED, 'Deprecated: Multiple initializations are now allowed through ref counting.') + ERROR_NOT_FOUND = (NVML_ERROR_NOT_FOUND, 'A query to find an object was unsuccessful.') + ERROR_INSUFFICIENT_SIZE = (NVML_ERROR_INSUFFICIENT_SIZE, 'An input argument is not large enough.') + ERROR_INSUFFICIENT_POWER = (NVML_ERROR_INSUFFICIENT_POWER, "A device's external power cables are not properly attached.") + ERROR_DRIVER_NOT_LOADED = (NVML_ERROR_DRIVER_NOT_LOADED, 'NVIDIA driver is not loaded.') + ERROR_TIMEOUT = (NVML_ERROR_TIMEOUT, 'User provided timeout passed.') + ERROR_IRQ_ISSUE = (NVML_ERROR_IRQ_ISSUE, 'NVIDIA Kernel detected an interrupt issue with a GPU.') + ERROR_LIBRARY_NOT_FOUND = (NVML_ERROR_LIBRARY_NOT_FOUND, "NVML Shared Library couldn't be found or loaded.") + ERROR_FUNCTION_NOT_FOUND = (NVML_ERROR_FUNCTION_NOT_FOUND, "Local version of NVML doesn't implement this function.") + ERROR_CORRUPTED_INFOROM = (NVML_ERROR_CORRUPTED_INFOROM, 'infoROM is corrupted') + ERROR_GPU_IS_LOST = (NVML_ERROR_GPU_IS_LOST, 'The GPU has fallen off the bus or has otherwise become inaccessible.') + ERROR_RESET_REQUIRED = (NVML_ERROR_RESET_REQUIRED, 'The GPU requires a reset before it can be used again.') + ERROR_OPERATING_SYSTEM = (NVML_ERROR_OPERATING_SYSTEM, 'The GPU control device has been blocked by the operating system/cgroups.') + ERROR_LIB_RM_VERSION_MISMATCH = (NVML_ERROR_LIB_RM_VERSION_MISMATCH, 'RM detects a driver/library version mismatch.') + ERROR_IN_USE = (NVML_ERROR_IN_USE, 'An operation cannot be performed because the GPU is currently in use.') + ERROR_MEMORY = (NVML_ERROR_MEMORY, 'Insufficient memory.') + ERROR_NO_DATA = (NVML_ERROR_NO_DATA, 'No data.') + ERROR_VGPU_ECC_NOT_SUPPORTED = (NVML_ERROR_VGPU_ECC_NOT_SUPPORTED, 'The requested vgpu operation is not available on target device, becasue ECC is enabled.') + ERROR_INSUFFICIENT_RESOURCES = (NVML_ERROR_INSUFFICIENT_RESOURCES, 'Ran out of critical resources, other than memory.') + ERROR_FREQ_NOT_SUPPORTED = (NVML_ERROR_FREQ_NOT_SUPPORTED, 'Ran out of critical resources, other than memory.') + ERROR_ARGUMENT_VERSION_MISMATCH = (NVML_ERROR_ARGUMENT_VERSION_MISMATCH, 'The provided version is invalid/unsupported.') + ERROR_DEPRECATED = (NVML_ERROR_DEPRECATED, 'The requested functionality has been deprecated.') + ERROR_NOT_READY = (NVML_ERROR_NOT_READY, 'The system is not ready for the request.') + ERROR_GPU_NOT_FOUND = (NVML_ERROR_GPU_NOT_FOUND, 'No GPUs were found.') + ERROR_INVALID_STATE = (NVML_ERROR_INVALID_STATE, 'Resource not in correct state to perform requested operation.') + ERROR_RESET_TYPE_NOT_SUPPORTED = (NVML_ERROR_RESET_TYPE_NOT_SUPPORTED, 'Reset not supported for given device/parameters.') + ERROR_UNKNOWN = (NVML_ERROR_UNKNOWN, 'An internal driver error occurred.') + +class MemoryLocation(_cyb_FastEnum): + """ + See `nvmlDeviceGetMemoryErrorCounter` + + See `nvmlMemoryLocation_t`. + """ + L1_CACHE = (NVML_MEMORY_LOCATION_L1_CACHE, 'GPU L1 Cache.') + L2_CACHE = (NVML_MEMORY_LOCATION_L2_CACHE, 'GPU L2 Cache.') + DRAM = (NVML_MEMORY_LOCATION_DRAM, 'Turing+ DRAM.') + DEVICE_MEMORY = (NVML_MEMORY_LOCATION_DEVICE_MEMORY, 'GPU Device Memory.') + REGISTER_FILE = (NVML_MEMORY_LOCATION_REGISTER_FILE, 'GPU Register File.') + TEXTURE_MEMORY = (NVML_MEMORY_LOCATION_TEXTURE_MEMORY, 'GPU Texture Memory.') + TEXTURE_SHM = (NVML_MEMORY_LOCATION_TEXTURE_SHM, 'Shared memory.') + CBU = (NVML_MEMORY_LOCATION_CBU, 'CBU.') + SRAM = (NVML_MEMORY_LOCATION_SRAM, 'Turing+ SRAM.') + COUNT = (NVML_MEMORY_LOCATION_COUNT, 'This counts the number of memory locations the driver knows about.') + +class PageRetirementCause(_cyb_FastEnum): + """ + Causes for page retirement + + See `nvmlPageRetirementCause_t`. + """ + MULTIPLE_SINGLE_BIT_ECC_ERRORS = (NVML_PAGE_RETIREMENT_CAUSE_MULTIPLE_SINGLE_BIT_ECC_ERRORS, 'Page was retired due to multiple single bit ECC error.') + DOUBLE_BIT_ECC_ERROR = (NVML_PAGE_RETIREMENT_CAUSE_DOUBLE_BIT_ECC_ERROR, 'Page was retired due to double bit ECC error.') + COUNT = NVML_PAGE_RETIREMENT_CAUSE_COUNT + +class RestrictedAPI(_cyb_FastEnum): + """ + API types that allow changes to default permission restrictions + + See `nvmlRestrictedAPI_t`. + """ + SET_APPLICATION_CLOCKS = (NVML_RESTRICTED_API_SET_APPLICATION_CLOCKS, 'APIs that change application clocks, see nvmlDeviceSetApplicationsClocks and see nvmlDeviceResetApplicationsClocks. Deprecated, keeping definition for backward compatibility.') + SET_AUTO_BOOSTED_CLOCKS = (NVML_RESTRICTED_API_SET_AUTO_BOOSTED_CLOCKS, 'APIs that enable/disable Auto Boosted clocks see nvmlDeviceSetAutoBoostedClocksEnabled') + COUNT = NVML_RESTRICTED_API_COUNT + +class GpuUtilizationDomainId(_cyb_FastEnum): + """ + Represents the GPU utilization domains + + See `nvmlGpuUtilizationDomainId_t`. + """ + GPU_UTILIZATION_DOMAIN_GPU = (NVML_GPU_UTILIZATION_DOMAIN_GPU, 'Graphics engine domain.') + GPU_UTILIZATION_DOMAIN_FB = (NVML_GPU_UTILIZATION_DOMAIN_FB, 'Frame buffer domain.') + GPU_UTILIZATION_DOMAIN_VID = (NVML_GPU_UTILIZATION_DOMAIN_VID, 'Video engine domain.') + GPU_UTILIZATION_DOMAIN_BUS = (NVML_GPU_UTILIZATION_DOMAIN_BUS, 'Bus interface domain.') + +class GpuVirtualizationMode(_cyb_FastEnum): + """ + GPU virtualization mode types. + + See `nvmlGpuVirtualizationMode_t`. + """ + NONE = (NVML_GPU_VIRTUALIZATION_MODE_NONE, 'Represents Bare Metal GPU.') + PASSTHROUGH = (NVML_GPU_VIRTUALIZATION_MODE_PASSTHROUGH, 'Device is associated with GPU-Passthorugh.') + VGPU = (NVML_GPU_VIRTUALIZATION_MODE_VGPU, 'Device is associated with vGPU inside virtual machine.') + HOST_VGPU = (NVML_GPU_VIRTUALIZATION_MODE_HOST_VGPU, 'Device is associated with VGX hypervisor in vGPU mode.') + HOST_VSGA = (NVML_GPU_VIRTUALIZATION_MODE_HOST_VSGA, 'Device is associated with VGX hypervisor in vSGA mode.') + +class HostVgpuMode(_cyb_FastEnum): + """ + Host vGPU modes + + See `nvmlHostVgpuMode_t`. + """ + NON_SRIOV = (NVML_HOST_VGPU_MODE_NON_SRIOV, 'Non SR-IOV mode.') + SRIOV = (NVML_HOST_VGPU_MODE_SRIOV, 'SR-IOV mode.') + +class VgpuVmIdType(_cyb_FastEnum): + """ + Types of VM identifiers + + See `nvmlVgpuVmIdType_t`. + """ + VGPU_VM_ID_DOMAIN_ID = (NVML_VGPU_VM_ID_DOMAIN_ID, 'VM ID represents DOMAIN ID.') + VGPU_VM_ID_UUID = (NVML_VGPU_VM_ID_UUID, 'VM ID represents UUID.') + +class VgpuGuestInfoState(_cyb_FastEnum): + """ + vGPU GUEST info state + + See `nvmlVgpuGuestInfoState_t`. + """ + VGPU_INSTANCE_GUEST_INFO_STATE_UNINITIALIZED = (NVML_VGPU_INSTANCE_GUEST_INFO_STATE_UNINITIALIZED, 'Guest-dependent fields uninitialized.') + VGPU_INSTANCE_GUEST_INFO_STATE_INITIALIZED = (NVML_VGPU_INSTANCE_GUEST_INFO_STATE_INITIALIZED, 'Guest-dependent fields initialized.') + +class GridLicenseFeatureCode(_cyb_FastEnum): + """ + vGPU software licensable features + + See `nvmlGridLicenseFeatureCode_t`. + """ + UNKNOWN = (NVML_GRID_LICENSE_FEATURE_CODE_UNKNOWN, 'Unknown.') + VGPU = (NVML_GRID_LICENSE_FEATURE_CODE_VGPU, 'Virtual GPU.') + NVIDIA_RTX = (NVML_GRID_LICENSE_FEATURE_CODE_NVIDIA_RTX, 'Nvidia RTX.') + VWORKSTATION = (NVML_GRID_LICENSE_FEATURE_CODE_VWORKSTATION, 'Deprecated, do not use.') + GAMING = (NVML_GRID_LICENSE_FEATURE_CODE_GAMING, 'Gaming.') + COMPUTE = (NVML_GRID_LICENSE_FEATURE_CODE_COMPUTE, 'Compute.') + +class VgpuCapability(_cyb_FastEnum): + """ + vGPU queryable capabilities + + See `nvmlVgpuCapability_t`. + """ + VGPU_CAP_NVLINK_P2P = (NVML_VGPU_CAP_NVLINK_P2P, 'P2P over NVLink is supported.') + VGPU_CAP_GPUDIRECT = (NVML_VGPU_CAP_GPUDIRECT, 'GPUDirect capability is supported.') + VGPU_CAP_MULTI_VGPU_EXCLUSIVE = (NVML_VGPU_CAP_MULTI_VGPU_EXCLUSIVE, 'vGPU profile cannot be mixed with other vGPU profiles in same VM') + VGPU_CAP_EXCLUSIVE_TYPE = (NVML_VGPU_CAP_EXCLUSIVE_TYPE, 'vGPU profile cannot run on a GPU alongside other profiles of different type') + VGPU_CAP_EXCLUSIVE_SIZE = (NVML_VGPU_CAP_EXCLUSIVE_SIZE, 'vGPU profile cannot run on a GPU alongside other profiles of different size') + VGPU_CAP_COUNT = NVML_VGPU_CAP_COUNT + +class VgpuDriverCapability(_cyb_FastEnum): + """ + vGPU driver queryable capabilities + + See `nvmlVgpuDriverCapability_t`. + """ + VGPU_DRIVER_CAP_HETEROGENEOUS_MULTI_VGPU = (NVML_VGPU_DRIVER_CAP_HETEROGENEOUS_MULTI_VGPU, 'Supports mixing of different vGPU profiles within one guest VM.') + VGPU_DRIVER_CAP_WARM_UPDATE = (NVML_VGPU_DRIVER_CAP_WARM_UPDATE, 'Supports FSR and warm update of vGPU host driver without terminating the running guest VM.') + VGPU_DRIVER_CAP_COUNT = NVML_VGPU_DRIVER_CAP_COUNT + +class DeviceVgpuCapability(_cyb_FastEnum): + """ + Device vGPU queryable capabilities + + See `nvmlDeviceVgpuCapability_t`. + """ + DEVICE_VGPU_CAP_FRACTIONAL_MULTI_VGPU = (NVML_DEVICE_VGPU_CAP_FRACTIONAL_MULTI_VGPU, 'Query whether the fractional vGPU profiles on this GPU can be used in multi-vGPU configurations.') + DEVICE_VGPU_CAP_HETEROGENEOUS_TIMESLICE_PROFILES = (NVML_DEVICE_VGPU_CAP_HETEROGENEOUS_TIMESLICE_PROFILES, 'Query whether the GPU support concurrent execution of timesliced vGPU profiles of differing types.') + DEVICE_VGPU_CAP_HETEROGENEOUS_TIMESLICE_SIZES = (NVML_DEVICE_VGPU_CAP_HETEROGENEOUS_TIMESLICE_SIZES, 'Query whether the GPU support concurrent execution of timesliced vGPU profiles of differing framebuffer sizes.') + DEVICE_VGPU_CAP_READ_DEVICE_BUFFER_BW = (NVML_DEVICE_VGPU_CAP_READ_DEVICE_BUFFER_BW, "Query the GPU's read_device_buffer expected bandwidth capacity in megabytes per second.") + DEVICE_VGPU_CAP_WRITE_DEVICE_BUFFER_BW = (NVML_DEVICE_VGPU_CAP_WRITE_DEVICE_BUFFER_BW, "Query the GPU's write_device_buffer expected bandwidth capacity in megabytes per second.") + DEVICE_VGPU_CAP_DEVICE_STREAMING = (NVML_DEVICE_VGPU_CAP_DEVICE_STREAMING, 'Query whether the vGPU profiles on the GPU supports migration data streaming.') + DEVICE_VGPU_CAP_MINI_QUARTER_GPU = (NVML_DEVICE_VGPU_CAP_MINI_QUARTER_GPU, 'Set/Get support for mini-quarter vGPU profiles.') + DEVICE_VGPU_CAP_COMPUTE_MEDIA_ENGINE_GPU = (NVML_DEVICE_VGPU_CAP_COMPUTE_MEDIA_ENGINE_GPU, 'Set/Get support for compute media engine vGPU profiles.') + DEVICE_VGPU_CAP_WARM_UPDATE = (NVML_DEVICE_VGPU_CAP_WARM_UPDATE, 'Query whether the GPU supports FSR and warm update.') + DEVICE_VGPU_CAP_HOMOGENEOUS_PLACEMENTS = (NVML_DEVICE_VGPU_CAP_HOMOGENEOUS_PLACEMENTS, 'Query whether the GPU supports reporting of placements of timesliced vGPU profiles with identical framebuffer sizes.') + DEVICE_VGPU_CAP_MIG_TIMESLICING_SUPPORTED = (NVML_DEVICE_VGPU_CAP_MIG_TIMESLICING_SUPPORTED, 'Query whether the GPU supports timesliced vGPU on MIG.') + DEVICE_VGPU_CAP_MIG_TIMESLICING_ENABLED = (NVML_DEVICE_VGPU_CAP_MIG_TIMESLICING_ENABLED, 'Set/Get MIG timesliced mode reporting, without impacting the underlying functionality.') + DEVICE_VGPU_CAP_COUNT = NVML_DEVICE_VGPU_CAP_COUNT + +class DeviceGpuRecoveryAction(_cyb_FastEnum): + """ + Enum describing the GPU Recovery Action + + See `nvmlDeviceGpuRecoveryAction_t`. + """ + GPU_RECOVERY_ACTION_NONE = (NVML_GPU_RECOVERY_ACTION_NONE, 'No action needed.') + GPU_RECOVERY_ACTION_GPU_RESET = (NVML_GPU_RECOVERY_ACTION_GPU_RESET, 'Reset Gpu.') + GPU_RECOVERY_ACTION_NODE_REBOOT = (NVML_GPU_RECOVERY_ACTION_NODE_REBOOT, 'Reboot Node.') + GPU_RECOVERY_ACTION_DRAIN_P2P = (NVML_GPU_RECOVERY_ACTION_DRAIN_P2P, 'Drain P2P.') + GPU_RECOVERY_ACTION_DRAIN_AND_RESET = (NVML_GPU_RECOVERY_ACTION_DRAIN_AND_RESET, 'Drain P2P and Reset Gpu.') + GPU_RECOVERY_ACTION_RECOVER_IMEX_DOMAIN = (NVML_GPU_RECOVERY_ACTION_RECOVER_IMEX_DOMAIN, 'Recover IMEX Domain.') + +class FanState(_cyb_FastEnum): + """ + Fan state enum. + + See `nvmlFanState_t`. + """ + FAN_NORMAL = (NVML_FAN_NORMAL, 'Fan is working properly.') + FAN_FAILED = (NVML_FAN_FAILED, 'Fan has failed.') + +class LedColor(_cyb_FastEnum): + """ + Led color enum. + + See `nvmlLedColor_t`. + """ + GREEN = (NVML_LED_COLOR_GREEN, 'GREEN, indicates good health.') + AMBER = (NVML_LED_COLOR_AMBER, 'AMBER, indicates problem.') + +class EncoderType(_cyb_FastEnum): + """ + Represents type of encoder for capacity can be queried + + See `nvmlEncoderType_t`. + """ + ENCODER_QUERY_H264 = (NVML_ENCODER_QUERY_H264, 'H264 encoder.') + ENCODER_QUERY_HEVC = (NVML_ENCODER_QUERY_HEVC, 'HEVC encoder.') + ENCODER_QUERY_AV1 = (NVML_ENCODER_QUERY_AV1, 'AV1 encoder.') + ENCODER_QUERY_UNKNOWN = (NVML_ENCODER_QUERY_UNKNOWN, 'Unknown encoder.') + +class FBCSessionType(_cyb_FastEnum): + """ + Represents frame buffer capture session type + + See `nvmlFBCSessionType_t`. + """ + UNKNOWN = (NVML_FBC_SESSION_TYPE_UNKNOWN, 'Unknown.') + TOSYS = (NVML_FBC_SESSION_TYPE_TOSYS, 'ToSys.') + CUDA = (NVML_FBC_SESSION_TYPE_CUDA, 'Cuda.') + VID = (NVML_FBC_SESSION_TYPE_VID, 'Vid.') + HWENC = (NVML_FBC_SESSION_TYPE_HWENC, 'HEnc.') + +class DetachGpuState(_cyb_FastEnum): + """ + Is the GPU device to be removed from the kernel by + `nvmlDeviceRemoveGpu()` + + See `nvmlDetachGpuState_t`. + """ + DETACH_GPU_KEEP = NVML_DETACH_GPU_KEEP + DETACH_GPU_REMOVE = NVML_DETACH_GPU_REMOVE + +class PcieLinkState(_cyb_FastEnum): + """ + Parent bridge PCIe link state requested by `nvmlDeviceRemoveGpu()` + + See `nvmlPcieLinkState_t`. + """ + PCIE_LINK_KEEP = NVML_PCIE_LINK_KEEP + PCIE_LINK_SHUT_DOWN = NVML_PCIE_LINK_SHUT_DOWN + +class ClockLimitId(_cyb_FastEnum): + """ + See `nvmlClockLimitId_t`. + """ + RANGE_START = NVML_CLOCK_LIMIT_ID_RANGE_START + TDP = NVML_CLOCK_LIMIT_ID_TDP + UNLIMITED = NVML_CLOCK_LIMIT_ID_UNLIMITED + +class VgpuVmCompatibility(_cyb_FastEnum): + """ + vGPU VM compatibility codes + + See `nvmlVgpuVmCompatibility_t`. + """ + NONE = (NVML_VGPU_VM_COMPATIBILITY_NONE, 'vGPU is not runnable') + COLD = (NVML_VGPU_VM_COMPATIBILITY_COLD, 'vGPU is runnable from a cold / powered-off state (ACPI S5)') + HIBERNATE = (NVML_VGPU_VM_COMPATIBILITY_HIBERNATE, 'vGPU is runnable from a hibernated state (ACPI S4)') + SLEEP = (NVML_VGPU_VM_COMPATIBILITY_SLEEP, 'vGPU is runnable from a sleeped state (ACPI S3)') + LIVE = (NVML_VGPU_VM_COMPATIBILITY_LIVE, 'vGPU is runnable from a live/paused (ACPI S0)') + +class VgpuPgpuCompatibilityLimitCode(_cyb_FastEnum): + """ + vGPU-pGPU compatibility limit codes + + See `nvmlVgpuPgpuCompatibilityLimitCode_t`. + """ + VGPU_COMPATIBILITY_LIMIT_NONE = (NVML_VGPU_COMPATIBILITY_LIMIT_NONE, 'Compatibility is not limited.') + VGPU_COMPATIBILITY_LIMIT_HOST_DRIVER = (NVML_VGPU_COMPATIBILITY_LIMIT_HOST_DRIVER, 'ompatibility is limited by host driver version.') + VGPU_COMPATIBILITY_LIMIT_GUEST_DRIVER = (NVML_VGPU_COMPATIBILITY_LIMIT_GUEST_DRIVER, 'Compatibility is limited by guest driver version.') + VGPU_COMPATIBILITY_LIMIT_GPU = (NVML_VGPU_COMPATIBILITY_LIMIT_GPU, 'Compatibility is limited by GPU hardware.') + VGPU_COMPATIBILITY_LIMIT_OTHER = (NVML_VGPU_COMPATIBILITY_LIMIT_OTHER, 'Compatibility is limited by an undefined factor.') + +class GpmMetricId(_cyb_FastEnum): + """ + GPM Metric Identifiers + + See `nvmlGpmMetricId_t`. + """ + GPM_METRIC_GRAPHICS_UTIL = (NVML_GPM_METRIC_GRAPHICS_UTIL, 'Percentage of time any compute/graphics app was active on the GPU. 0.0 - 100.0.') + GPM_METRIC_SM_UTIL = (NVML_GPM_METRIC_SM_UTIL, 'Percentage of SMs that were busy. 0.0 - 100.0.') + GPM_METRIC_SM_OCCUPANCY = (NVML_GPM_METRIC_SM_OCCUPANCY, 'Percentage of warps that were active vs theoretical maximum. 0.0 - 100.0.') + GPM_METRIC_INTEGER_UTIL = (NVML_GPM_METRIC_INTEGER_UTIL, "Percentage of time the GPU's SMs were doing integer operations. 0.0 - 100.0.") + GPM_METRIC_ANY_TENSOR_UTIL = (NVML_GPM_METRIC_ANY_TENSOR_UTIL, "Percentage of time the GPU's SMs were doing ANY tensor operations. 0.0 - 100.0.") + GPM_METRIC_DFMA_TENSOR_UTIL = (NVML_GPM_METRIC_DFMA_TENSOR_UTIL, "Percentage of time the GPU's SMs were doing DFMA tensor operations. 0.0 - 100.0.") + GPM_METRIC_HMMA_TENSOR_UTIL = (NVML_GPM_METRIC_HMMA_TENSOR_UTIL, "Percentage of time the GPU's SMs were doing HMMA tensor operations. 0.0 - 100.0.") + GPM_METRIC_DMMA_TENSOR_UTIL = (NVML_GPM_METRIC_DMMA_TENSOR_UTIL, "Percentage of time the GPU's SMs were doing DMMA tensor operations. 0.0 - 100.0.") + GPM_METRIC_IMMA_TENSOR_UTIL = (NVML_GPM_METRIC_IMMA_TENSOR_UTIL, "Percentage of time the GPU's SMs were doing IMMA tensor operations. 0.0 - 100.0.") + GPM_METRIC_DRAM_BW_UTIL = (NVML_GPM_METRIC_DRAM_BW_UTIL, 'Percentage of DRAM bw used vs theoretical maximum. 0.0 - 100.0 *\u200d/.') + GPM_METRIC_FP64_UTIL = (NVML_GPM_METRIC_FP64_UTIL, "Percentage of time the GPU's SMs were doing non-tensor FP64 math. 0.0 - 100.0.") + GPM_METRIC_FP32_UTIL = (NVML_GPM_METRIC_FP32_UTIL, "Percentage of time the GPU's SMs were doing non-tensor FP32 math. 0.0 - 100.0.") + GPM_METRIC_FP16_UTIL = (NVML_GPM_METRIC_FP16_UTIL, "Percentage of time the GPU's SMs were doing non-tensor FP16 math. 0.0 - 100.0.") + GPM_METRIC_PCIE_TX_PER_SEC = (NVML_GPM_METRIC_PCIE_TX_PER_SEC, 'PCIe traffic from this GPU in MiB/sec.') + GPM_METRIC_PCIE_RX_PER_SEC = (NVML_GPM_METRIC_PCIE_RX_PER_SEC, 'PCIe traffic to this GPU in MiB/sec.') + GPM_METRIC_NVDEC_0_UTIL = (NVML_GPM_METRIC_NVDEC_0_UTIL, 'Percent utilization of NVDEC 0. 0.0 - 100.0.') + GPM_METRIC_NVDEC_1_UTIL = (NVML_GPM_METRIC_NVDEC_1_UTIL, 'Percent utilization of NVDEC 1. 0.0 - 100.0.') + GPM_METRIC_NVDEC_2_UTIL = (NVML_GPM_METRIC_NVDEC_2_UTIL, 'Percent utilization of NVDEC 2. 0.0 - 100.0.') + GPM_METRIC_NVDEC_3_UTIL = (NVML_GPM_METRIC_NVDEC_3_UTIL, 'Percent utilization of NVDEC 3. 0.0 - 100.0.') + GPM_METRIC_NVDEC_4_UTIL = (NVML_GPM_METRIC_NVDEC_4_UTIL, 'Percent utilization of NVDEC 4. 0.0 - 100.0.') + GPM_METRIC_NVDEC_5_UTIL = (NVML_GPM_METRIC_NVDEC_5_UTIL, 'Percent utilization of NVDEC 5. 0.0 - 100.0.') + GPM_METRIC_NVDEC_6_UTIL = (NVML_GPM_METRIC_NVDEC_6_UTIL, 'Percent utilization of NVDEC 6. 0.0 - 100.0.') + GPM_METRIC_NVDEC_7_UTIL = (NVML_GPM_METRIC_NVDEC_7_UTIL, 'Percent utilization of NVDEC 7. 0.0 - 100.0.') + GPM_METRIC_NVJPG_0_UTIL = (NVML_GPM_METRIC_NVJPG_0_UTIL, 'Percent utilization of NVJPG 0. 0.0 - 100.0.') + GPM_METRIC_NVJPG_1_UTIL = (NVML_GPM_METRIC_NVJPG_1_UTIL, 'Percent utilization of NVJPG 1. 0.0 - 100.0.') + GPM_METRIC_NVJPG_2_UTIL = (NVML_GPM_METRIC_NVJPG_2_UTIL, 'Percent utilization of NVJPG 2. 0.0 - 100.0.') + GPM_METRIC_NVJPG_3_UTIL = (NVML_GPM_METRIC_NVJPG_3_UTIL, 'Percent utilization of NVJPG 3. 0.0 - 100.0.') + GPM_METRIC_NVJPG_4_UTIL = (NVML_GPM_METRIC_NVJPG_4_UTIL, 'Percent utilization of NVJPG 4. 0.0 - 100.0.') + GPM_METRIC_NVJPG_5_UTIL = (NVML_GPM_METRIC_NVJPG_5_UTIL, 'Percent utilization of NVJPG 5. 0.0 - 100.0.') + GPM_METRIC_NVJPG_6_UTIL = (NVML_GPM_METRIC_NVJPG_6_UTIL, 'Percent utilization of NVJPG 6. 0.0 - 100.0.') + GPM_METRIC_NVJPG_7_UTIL = (NVML_GPM_METRIC_NVJPG_7_UTIL, 'Percent utilization of NVJPG 7. 0.0 - 100.0.') + GPM_METRIC_NVOFA_0_UTIL = (NVML_GPM_METRIC_NVOFA_0_UTIL, 'Percent utilization of NVOFA 0. 0.0 - 100.0.') + GPM_METRIC_NVOFA_1_UTIL = (NVML_GPM_METRIC_NVOFA_1_UTIL, 'Percent utilization of NVOFA 1. 0.0 - 100.0.') + GPM_METRIC_NVLINK_TOTAL_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_TOTAL_RX_PER_SEC, 'NvLink read bandwidth for all links in MiB/sec.') + GPM_METRIC_NVLINK_TOTAL_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_TOTAL_TX_PER_SEC, 'NvLink write bandwidth for all links in MiB/sec.') + GPM_METRIC_NVLINK_L0_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L0_RX_PER_SEC, 'NvLink read bandwidth for link 0 in MiB/sec.') + GPM_METRIC_NVLINK_L0_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L0_TX_PER_SEC, 'NvLink write bandwidth for link 0 in MiB/sec.') + GPM_METRIC_NVLINK_L1_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L1_RX_PER_SEC, 'NvLink read bandwidth for link 1 in MiB/sec.') + GPM_METRIC_NVLINK_L1_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L1_TX_PER_SEC, 'NvLink write bandwidth for link 1 in MiB/sec.') + GPM_METRIC_NVLINK_L2_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L2_RX_PER_SEC, 'NvLink read bandwidth for link 2 in MiB/sec.') + GPM_METRIC_NVLINK_L2_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L2_TX_PER_SEC, 'NvLink write bandwidth for link 2 in MiB/sec.') + GPM_METRIC_NVLINK_L3_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L3_RX_PER_SEC, 'NvLink read bandwidth for link 3 in MiB/sec.') + GPM_METRIC_NVLINK_L3_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L3_TX_PER_SEC, 'NvLink write bandwidth for link 3 in MiB/sec.') + GPM_METRIC_NVLINK_L4_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L4_RX_PER_SEC, 'NvLink read bandwidth for link 4 in MiB/sec.') + GPM_METRIC_NVLINK_L4_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L4_TX_PER_SEC, 'NvLink write bandwidth for link 4 in MiB/sec.') + GPM_METRIC_NVLINK_L5_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L5_RX_PER_SEC, 'NvLink read bandwidth for link 5 in MiB/sec.') + GPM_METRIC_NVLINK_L5_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L5_TX_PER_SEC, 'NvLink write bandwidth for link 5 in MiB/sec.') + GPM_METRIC_NVLINK_L6_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L6_RX_PER_SEC, 'NvLink read bandwidth for link 6 in MiB/sec.') + GPM_METRIC_NVLINK_L6_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L6_TX_PER_SEC, 'NvLink write bandwidth for link 6 in MiB/sec.') + GPM_METRIC_NVLINK_L7_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L7_RX_PER_SEC, 'NvLink read bandwidth for link 7 in MiB/sec.') + GPM_METRIC_NVLINK_L7_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L7_TX_PER_SEC, 'NvLink write bandwidth for link 7 in MiB/sec.') + GPM_METRIC_NVLINK_L8_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L8_RX_PER_SEC, 'NvLink read bandwidth for link 8 in MiB/sec.') + GPM_METRIC_NVLINK_L8_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L8_TX_PER_SEC, 'NvLink write bandwidth for link 8 in MiB/sec.') + GPM_METRIC_NVLINK_L9_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L9_RX_PER_SEC, 'NvLink read bandwidth for link 9 in MiB/sec.') + GPM_METRIC_NVLINK_L9_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L9_TX_PER_SEC, 'NvLink write bandwidth for link 9 in MiB/sec.') + GPM_METRIC_NVLINK_L10_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L10_RX_PER_SEC, 'NvLink read bandwidth for link 10 in MiB/sec.') + GPM_METRIC_NVLINK_L10_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L10_TX_PER_SEC, 'NvLink write bandwidth for link 10 in MiB/sec.') + GPM_METRIC_NVLINK_L11_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L11_RX_PER_SEC, 'NvLink read bandwidth for link 11 in MiB/sec.') + GPM_METRIC_NVLINK_L11_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L11_TX_PER_SEC, 'NvLink write bandwidth for link 11 in MiB/sec.') + GPM_METRIC_NVLINK_L12_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L12_RX_PER_SEC, 'NvLink read bandwidth for link 12 in MiB/sec.') + GPM_METRIC_NVLINK_L12_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L12_TX_PER_SEC, 'NvLink write bandwidth for link 12 in MiB/sec.') + GPM_METRIC_NVLINK_L13_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L13_RX_PER_SEC, 'NvLink read bandwidth for link 13 in MiB/sec.') + GPM_METRIC_NVLINK_L13_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L13_TX_PER_SEC, 'NvLink write bandwidth for link 13 in MiB/sec.') + GPM_METRIC_NVLINK_L14_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L14_RX_PER_SEC, 'NvLink read bandwidth for link 14 in MiB/sec.') + GPM_METRIC_NVLINK_L14_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L14_TX_PER_SEC, 'NvLink write bandwidth for link 14 in MiB/sec.') + GPM_METRIC_NVLINK_L15_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L15_RX_PER_SEC, 'NvLink read bandwidth for link 15 in MiB/sec.') + GPM_METRIC_NVLINK_L15_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L15_TX_PER_SEC, 'NvLink write bandwidth for link 15 in MiB/sec.') + GPM_METRIC_NVLINK_L16_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L16_RX_PER_SEC, 'NvLink read bandwidth for link 16 in MiB/sec.') + GPM_METRIC_NVLINK_L16_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L16_TX_PER_SEC, 'NvLink write bandwidth for link 16 in MiB/sec.') + GPM_METRIC_NVLINK_L17_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L17_RX_PER_SEC, 'NvLink read bandwidth for link 17 in MiB/sec.') + GPM_METRIC_NVLINK_L17_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L17_TX_PER_SEC, 'NvLink write bandwidth for link 17 in MiB/sec.') + GPM_METRIC_C2C_TOTAL_TX_PER_SEC = NVML_GPM_METRIC_C2C_TOTAL_TX_PER_SEC + GPM_METRIC_C2C_TOTAL_RX_PER_SEC = NVML_GPM_METRIC_C2C_TOTAL_RX_PER_SEC + GPM_METRIC_C2C_DATA_TX_PER_SEC = NVML_GPM_METRIC_C2C_DATA_TX_PER_SEC + GPM_METRIC_C2C_DATA_RX_PER_SEC = NVML_GPM_METRIC_C2C_DATA_RX_PER_SEC + GPM_METRIC_C2C_LINK0_TOTAL_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK0_TOTAL_TX_PER_SEC + GPM_METRIC_C2C_LINK0_TOTAL_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK0_TOTAL_RX_PER_SEC + GPM_METRIC_C2C_LINK0_DATA_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK0_DATA_TX_PER_SEC + GPM_METRIC_C2C_LINK0_DATA_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK0_DATA_RX_PER_SEC + GPM_METRIC_C2C_LINK1_TOTAL_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK1_TOTAL_TX_PER_SEC + GPM_METRIC_C2C_LINK1_TOTAL_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK1_TOTAL_RX_PER_SEC + GPM_METRIC_C2C_LINK1_DATA_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK1_DATA_TX_PER_SEC + GPM_METRIC_C2C_LINK1_DATA_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK1_DATA_RX_PER_SEC + GPM_METRIC_C2C_LINK2_TOTAL_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK2_TOTAL_TX_PER_SEC + GPM_METRIC_C2C_LINK2_TOTAL_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK2_TOTAL_RX_PER_SEC + GPM_METRIC_C2C_LINK2_DATA_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK2_DATA_TX_PER_SEC + GPM_METRIC_C2C_LINK2_DATA_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK2_DATA_RX_PER_SEC + GPM_METRIC_C2C_LINK3_TOTAL_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK3_TOTAL_TX_PER_SEC + GPM_METRIC_C2C_LINK3_TOTAL_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK3_TOTAL_RX_PER_SEC + GPM_METRIC_C2C_LINK3_DATA_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK3_DATA_TX_PER_SEC + GPM_METRIC_C2C_LINK3_DATA_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK3_DATA_RX_PER_SEC + GPM_METRIC_C2C_LINK4_TOTAL_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK4_TOTAL_TX_PER_SEC + GPM_METRIC_C2C_LINK4_TOTAL_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK4_TOTAL_RX_PER_SEC + GPM_METRIC_C2C_LINK4_DATA_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK4_DATA_TX_PER_SEC + GPM_METRIC_C2C_LINK4_DATA_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK4_DATA_RX_PER_SEC + GPM_METRIC_C2C_LINK5_TOTAL_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK5_TOTAL_TX_PER_SEC + GPM_METRIC_C2C_LINK5_TOTAL_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK5_TOTAL_RX_PER_SEC + GPM_METRIC_C2C_LINK5_DATA_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK5_DATA_TX_PER_SEC + GPM_METRIC_C2C_LINK5_DATA_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK5_DATA_RX_PER_SEC + GPM_METRIC_C2C_LINK6_TOTAL_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK6_TOTAL_TX_PER_SEC + GPM_METRIC_C2C_LINK6_TOTAL_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK6_TOTAL_RX_PER_SEC + GPM_METRIC_C2C_LINK6_DATA_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK6_DATA_TX_PER_SEC + GPM_METRIC_C2C_LINK6_DATA_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK6_DATA_RX_PER_SEC + GPM_METRIC_C2C_LINK7_TOTAL_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK7_TOTAL_TX_PER_SEC + GPM_METRIC_C2C_LINK7_TOTAL_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK7_TOTAL_RX_PER_SEC + GPM_METRIC_C2C_LINK7_DATA_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK7_DATA_TX_PER_SEC + GPM_METRIC_C2C_LINK7_DATA_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK7_DATA_RX_PER_SEC + GPM_METRIC_C2C_LINK8_TOTAL_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK8_TOTAL_TX_PER_SEC + GPM_METRIC_C2C_LINK8_TOTAL_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK8_TOTAL_RX_PER_SEC + GPM_METRIC_C2C_LINK8_DATA_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK8_DATA_TX_PER_SEC + GPM_METRIC_C2C_LINK8_DATA_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK8_DATA_RX_PER_SEC + GPM_METRIC_C2C_LINK9_TOTAL_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK9_TOTAL_TX_PER_SEC + GPM_METRIC_C2C_LINK9_TOTAL_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK9_TOTAL_RX_PER_SEC + GPM_METRIC_C2C_LINK9_DATA_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK9_DATA_TX_PER_SEC + GPM_METRIC_C2C_LINK9_DATA_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK9_DATA_RX_PER_SEC + GPM_METRIC_C2C_LINK10_TOTAL_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK10_TOTAL_TX_PER_SEC + GPM_METRIC_C2C_LINK10_TOTAL_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK10_TOTAL_RX_PER_SEC + GPM_METRIC_C2C_LINK10_DATA_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK10_DATA_TX_PER_SEC + GPM_METRIC_C2C_LINK10_DATA_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK10_DATA_RX_PER_SEC + GPM_METRIC_C2C_LINK11_TOTAL_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK11_TOTAL_TX_PER_SEC + GPM_METRIC_C2C_LINK11_TOTAL_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK11_TOTAL_RX_PER_SEC + GPM_METRIC_C2C_LINK11_DATA_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK11_DATA_TX_PER_SEC + GPM_METRIC_C2C_LINK11_DATA_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK11_DATA_RX_PER_SEC + GPM_METRIC_C2C_LINK12_TOTAL_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK12_TOTAL_TX_PER_SEC + GPM_METRIC_C2C_LINK12_TOTAL_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK12_TOTAL_RX_PER_SEC + GPM_METRIC_C2C_LINK12_DATA_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK12_DATA_TX_PER_SEC + GPM_METRIC_C2C_LINK12_DATA_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK12_DATA_RX_PER_SEC + GPM_METRIC_C2C_LINK13_TOTAL_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK13_TOTAL_TX_PER_SEC + GPM_METRIC_C2C_LINK13_TOTAL_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK13_TOTAL_RX_PER_SEC + GPM_METRIC_C2C_LINK13_DATA_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK13_DATA_TX_PER_SEC + GPM_METRIC_C2C_LINK13_DATA_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK13_DATA_RX_PER_SEC + GPM_METRIC_HOSTMEM_CACHE_HIT = NVML_GPM_METRIC_HOSTMEM_CACHE_HIT + GPM_METRIC_HOSTMEM_CACHE_MISS = NVML_GPM_METRIC_HOSTMEM_CACHE_MISS + GPM_METRIC_PEERMEM_CACHE_HIT = NVML_GPM_METRIC_PEERMEM_CACHE_HIT + GPM_METRIC_PEERMEM_CACHE_MISS = NVML_GPM_METRIC_PEERMEM_CACHE_MISS + GPM_METRIC_DRAM_CACHE_HIT = NVML_GPM_METRIC_DRAM_CACHE_HIT + GPM_METRIC_DRAM_CACHE_MISS = NVML_GPM_METRIC_DRAM_CACHE_MISS + GPM_METRIC_NVENC_0_UTIL = NVML_GPM_METRIC_NVENC_0_UTIL + GPM_METRIC_NVENC_1_UTIL = NVML_GPM_METRIC_NVENC_1_UTIL + GPM_METRIC_NVENC_2_UTIL = NVML_GPM_METRIC_NVENC_2_UTIL + GPM_METRIC_NVENC_3_UTIL = NVML_GPM_METRIC_NVENC_3_UTIL + GPM_METRIC_GR0_CTXSW_CYCLES_ELAPSED = NVML_GPM_METRIC_GR0_CTXSW_CYCLES_ELAPSED + GPM_METRIC_GR0_CTXSW_CYCLES_ACTIVE = NVML_GPM_METRIC_GR0_CTXSW_CYCLES_ACTIVE + GPM_METRIC_GR0_CTXSW_REQUESTS = NVML_GPM_METRIC_GR0_CTXSW_REQUESTS + GPM_METRIC_GR0_CTXSW_CYCLES_PER_REQ = NVML_GPM_METRIC_GR0_CTXSW_CYCLES_PER_REQ + GPM_METRIC_GR0_CTXSW_ACTIVE_PCT = NVML_GPM_METRIC_GR0_CTXSW_ACTIVE_PCT + GPM_METRIC_GR1_CTXSW_CYCLES_ELAPSED = NVML_GPM_METRIC_GR1_CTXSW_CYCLES_ELAPSED + GPM_METRIC_GR1_CTXSW_CYCLES_ACTIVE = NVML_GPM_METRIC_GR1_CTXSW_CYCLES_ACTIVE + GPM_METRIC_GR1_CTXSW_REQUESTS = NVML_GPM_METRIC_GR1_CTXSW_REQUESTS + GPM_METRIC_GR1_CTXSW_CYCLES_PER_REQ = NVML_GPM_METRIC_GR1_CTXSW_CYCLES_PER_REQ + GPM_METRIC_GR1_CTXSW_ACTIVE_PCT = NVML_GPM_METRIC_GR1_CTXSW_ACTIVE_PCT + GPM_METRIC_GR2_CTXSW_CYCLES_ELAPSED = NVML_GPM_METRIC_GR2_CTXSW_CYCLES_ELAPSED + GPM_METRIC_GR2_CTXSW_CYCLES_ACTIVE = NVML_GPM_METRIC_GR2_CTXSW_CYCLES_ACTIVE + GPM_METRIC_GR2_CTXSW_REQUESTS = NVML_GPM_METRIC_GR2_CTXSW_REQUESTS + GPM_METRIC_GR2_CTXSW_CYCLES_PER_REQ = NVML_GPM_METRIC_GR2_CTXSW_CYCLES_PER_REQ + GPM_METRIC_GR2_CTXSW_ACTIVE_PCT = NVML_GPM_METRIC_GR2_CTXSW_ACTIVE_PCT + GPM_METRIC_GR3_CTXSW_CYCLES_ELAPSED = NVML_GPM_METRIC_GR3_CTXSW_CYCLES_ELAPSED + GPM_METRIC_GR3_CTXSW_CYCLES_ACTIVE = NVML_GPM_METRIC_GR3_CTXSW_CYCLES_ACTIVE + GPM_METRIC_GR3_CTXSW_REQUESTS = NVML_GPM_METRIC_GR3_CTXSW_REQUESTS + GPM_METRIC_GR3_CTXSW_CYCLES_PER_REQ = NVML_GPM_METRIC_GR3_CTXSW_CYCLES_PER_REQ + GPM_METRIC_GR3_CTXSW_ACTIVE_PCT = NVML_GPM_METRIC_GR3_CTXSW_ACTIVE_PCT + GPM_METRIC_GR4_CTXSW_CYCLES_ELAPSED = NVML_GPM_METRIC_GR4_CTXSW_CYCLES_ELAPSED + GPM_METRIC_GR4_CTXSW_CYCLES_ACTIVE = NVML_GPM_METRIC_GR4_CTXSW_CYCLES_ACTIVE + GPM_METRIC_GR4_CTXSW_REQUESTS = NVML_GPM_METRIC_GR4_CTXSW_REQUESTS + GPM_METRIC_GR4_CTXSW_CYCLES_PER_REQ = NVML_GPM_METRIC_GR4_CTXSW_CYCLES_PER_REQ + GPM_METRIC_GR4_CTXSW_ACTIVE_PCT = NVML_GPM_METRIC_GR4_CTXSW_ACTIVE_PCT + GPM_METRIC_GR5_CTXSW_CYCLES_ELAPSED = NVML_GPM_METRIC_GR5_CTXSW_CYCLES_ELAPSED + GPM_METRIC_GR5_CTXSW_CYCLES_ACTIVE = NVML_GPM_METRIC_GR5_CTXSW_CYCLES_ACTIVE + GPM_METRIC_GR5_CTXSW_REQUESTS = NVML_GPM_METRIC_GR5_CTXSW_REQUESTS + GPM_METRIC_GR5_CTXSW_CYCLES_PER_REQ = NVML_GPM_METRIC_GR5_CTXSW_CYCLES_PER_REQ + GPM_METRIC_GR5_CTXSW_ACTIVE_PCT = NVML_GPM_METRIC_GR5_CTXSW_ACTIVE_PCT + GPM_METRIC_GR6_CTXSW_CYCLES_ELAPSED = NVML_GPM_METRIC_GR6_CTXSW_CYCLES_ELAPSED + GPM_METRIC_GR6_CTXSW_CYCLES_ACTIVE = NVML_GPM_METRIC_GR6_CTXSW_CYCLES_ACTIVE + GPM_METRIC_GR6_CTXSW_REQUESTS = NVML_GPM_METRIC_GR6_CTXSW_REQUESTS + GPM_METRIC_GR6_CTXSW_CYCLES_PER_REQ = NVML_GPM_METRIC_GR6_CTXSW_CYCLES_PER_REQ + GPM_METRIC_GR6_CTXSW_ACTIVE_PCT = NVML_GPM_METRIC_GR6_CTXSW_ACTIVE_PCT + GPM_METRIC_GR7_CTXSW_CYCLES_ELAPSED = NVML_GPM_METRIC_GR7_CTXSW_CYCLES_ELAPSED + GPM_METRIC_GR7_CTXSW_CYCLES_ACTIVE = NVML_GPM_METRIC_GR7_CTXSW_CYCLES_ACTIVE + GPM_METRIC_GR7_CTXSW_REQUESTS = NVML_GPM_METRIC_GR7_CTXSW_REQUESTS + GPM_METRIC_GR7_CTXSW_CYCLES_PER_REQ = NVML_GPM_METRIC_GR7_CTXSW_CYCLES_PER_REQ + GPM_METRIC_GR7_CTXSW_ACTIVE_PCT = NVML_GPM_METRIC_GR7_CTXSW_ACTIVE_PCT + GPM_METRIC_NVLINK_L18_RX_PER_SEC = NVML_GPM_METRIC_NVLINK_L18_RX_PER_SEC + GPM_METRIC_NVLINK_L18_TX_PER_SEC = NVML_GPM_METRIC_NVLINK_L18_TX_PER_SEC + GPM_METRIC_NVLINK_L19_RX_PER_SEC = NVML_GPM_METRIC_NVLINK_L19_RX_PER_SEC + GPM_METRIC_NVLINK_L19_TX_PER_SEC = NVML_GPM_METRIC_NVLINK_L19_TX_PER_SEC + GPM_METRIC_NVLINK_L20_RX_PER_SEC = NVML_GPM_METRIC_NVLINK_L20_RX_PER_SEC + GPM_METRIC_NVLINK_L20_TX_PER_SEC = NVML_GPM_METRIC_NVLINK_L20_TX_PER_SEC + GPM_METRIC_NVLINK_L21_RX_PER_SEC = NVML_GPM_METRIC_NVLINK_L21_RX_PER_SEC + GPM_METRIC_NVLINK_L21_TX_PER_SEC = NVML_GPM_METRIC_NVLINK_L21_TX_PER_SEC + GPM_METRIC_NVLINK_L22_RX_PER_SEC = NVML_GPM_METRIC_NVLINK_L22_RX_PER_SEC + GPM_METRIC_NVLINK_L22_TX_PER_SEC = NVML_GPM_METRIC_NVLINK_L22_TX_PER_SEC + GPM_METRIC_NVLINK_L23_RX_PER_SEC = NVML_GPM_METRIC_NVLINK_L23_RX_PER_SEC + GPM_METRIC_NVLINK_L23_TX_PER_SEC = NVML_GPM_METRIC_NVLINK_L23_TX_PER_SEC + GPM_METRIC_NVLINK_L24_RX_PER_SEC = NVML_GPM_METRIC_NVLINK_L24_RX_PER_SEC + GPM_METRIC_NVLINK_L24_TX_PER_SEC = NVML_GPM_METRIC_NVLINK_L24_TX_PER_SEC + GPM_METRIC_NVLINK_L25_RX_PER_SEC = NVML_GPM_METRIC_NVLINK_L25_RX_PER_SEC + GPM_METRIC_NVLINK_L25_TX_PER_SEC = NVML_GPM_METRIC_NVLINK_L25_TX_PER_SEC + GPM_METRIC_NVLINK_L26_RX_PER_SEC = NVML_GPM_METRIC_NVLINK_L26_RX_PER_SEC + GPM_METRIC_NVLINK_L26_TX_PER_SEC = NVML_GPM_METRIC_NVLINK_L26_TX_PER_SEC + GPM_METRIC_NVLINK_L27_RX_PER_SEC = NVML_GPM_METRIC_NVLINK_L27_RX_PER_SEC + GPM_METRIC_NVLINK_L27_TX_PER_SEC = NVML_GPM_METRIC_NVLINK_L27_TX_PER_SEC + GPM_METRIC_NVLINK_L28_RX_PER_SEC = NVML_GPM_METRIC_NVLINK_L28_RX_PER_SEC + GPM_METRIC_NVLINK_L28_TX_PER_SEC = NVML_GPM_METRIC_NVLINK_L28_TX_PER_SEC + GPM_METRIC_NVLINK_L29_RX_PER_SEC = NVML_GPM_METRIC_NVLINK_L29_RX_PER_SEC + GPM_METRIC_NVLINK_L29_TX_PER_SEC = NVML_GPM_METRIC_NVLINK_L29_TX_PER_SEC + GPM_METRIC_NVLINK_L30_RX_PER_SEC = NVML_GPM_METRIC_NVLINK_L30_RX_PER_SEC + GPM_METRIC_NVLINK_L30_TX_PER_SEC = NVML_GPM_METRIC_NVLINK_L30_TX_PER_SEC + GPM_METRIC_NVLINK_L31_RX_PER_SEC = NVML_GPM_METRIC_NVLINK_L31_RX_PER_SEC + GPM_METRIC_NVLINK_L31_TX_PER_SEC = NVML_GPM_METRIC_NVLINK_L31_TX_PER_SEC + GPM_METRIC_NVLINK_L32_RX_PER_SEC = NVML_GPM_METRIC_NVLINK_L32_RX_PER_SEC + GPM_METRIC_NVLINK_L32_TX_PER_SEC = NVML_GPM_METRIC_NVLINK_L32_TX_PER_SEC + GPM_METRIC_NVLINK_L33_RX_PER_SEC = NVML_GPM_METRIC_NVLINK_L33_RX_PER_SEC + GPM_METRIC_NVLINK_L33_TX_PER_SEC = NVML_GPM_METRIC_NVLINK_L33_TX_PER_SEC + GPM_METRIC_NVLINK_L34_RX_PER_SEC = NVML_GPM_METRIC_NVLINK_L34_RX_PER_SEC + GPM_METRIC_NVLINK_L34_TX_PER_SEC = NVML_GPM_METRIC_NVLINK_L34_TX_PER_SEC + GPM_METRIC_NVLINK_L35_RX_PER_SEC = NVML_GPM_METRIC_NVLINK_L35_RX_PER_SEC + GPM_METRIC_NVLINK_L35_TX_PER_SEC = NVML_GPM_METRIC_NVLINK_L35_TX_PER_SEC + GPM_METRIC_SM_CYCLES_ELAPSED = (NVML_GPM_METRIC_SM_CYCLES_ELAPSED, "The GPU's SM cycles elapsed since reboot.") + GPM_METRIC_SM_CYCLES_ACTIVE = (NVML_GPM_METRIC_SM_CYCLES_ACTIVE, "The GPU's SM activity since reboot.") + GPM_METRIC_MMA_CYCLES_ACTIVE = (NVML_GPM_METRIC_MMA_CYCLES_ACTIVE, "The GPU's SM MMA tensor activity since reboot.") + GPM_METRIC_DMMA_CYCLES_ACTIVE = (NVML_GPM_METRIC_DMMA_CYCLES_ACTIVE, "The GPU's SM DMMA tensor activity since reboot.") + GPM_METRIC_HMMA_CYCLES_ACTIVE = (NVML_GPM_METRIC_HMMA_CYCLES_ACTIVE, "The GPU's SM HMMA tensor activity since reboot.") + GPM_METRIC_IMMA_CYCLES_ACTIVE = (NVML_GPM_METRIC_IMMA_CYCLES_ACTIVE, "The GPU's SM IMMA tensor activity since reboot.") + GPM_METRIC_DFMA_CYCLES_ACTIVE = (NVML_GPM_METRIC_DFMA_CYCLES_ACTIVE, "The GPU's SM DFMA tensor activity since reboot.") + GPM_METRIC_PCIE_TX = (NVML_GPM_METRIC_PCIE_TX, 'The PCIe TX traffic since reboot.') + GPM_METRIC_PCIE_RX = (NVML_GPM_METRIC_PCIE_RX, 'The PCIe RX traffic since reboot.') + GPM_METRIC_INTEGER_CYCLES_ACTIVE = (NVML_GPM_METRIC_INTEGER_CYCLES_ACTIVE, "The GPU's SM integer activity since reboot.") + GPM_METRIC_FP64_CYCLES_ACTIVE = (NVML_GPM_METRIC_FP64_CYCLES_ACTIVE, "The GPU's SM FP64 activity since reboot.") + GPM_METRIC_FP32_CYCLES_ACTIVE = (NVML_GPM_METRIC_FP32_CYCLES_ACTIVE, "The GPU's SM FP64 activity since reboot.") + GPM_METRIC_FP16_CYCLES_ACTIVE = (NVML_GPM_METRIC_FP16_CYCLES_ACTIVE, "The GPU's SM FP64 activity since reboot.") + GPM_METRIC_NVLINK_L0_RX = (NVML_GPM_METRIC_NVLINK_L0_RX, 'NvLink read for link 0 in bytes since reboot.') + GPM_METRIC_NVLINK_L0_TX = (NVML_GPM_METRIC_NVLINK_L0_TX, 'NvLink write for link 0 in bytes since reboot.') + GPM_METRIC_NVLINK_L1_RX = (NVML_GPM_METRIC_NVLINK_L1_RX, 'NvLink read for link 1 in bytes since reboot.') + GPM_METRIC_NVLINK_L1_TX = (NVML_GPM_METRIC_NVLINK_L1_TX, 'NvLink write for link 1 in bytes since reboot.') + GPM_METRIC_NVLINK_L2_RX = (NVML_GPM_METRIC_NVLINK_L2_RX, 'NvLink read for link 2 in bytes since reboot.') + GPM_METRIC_NVLINK_L2_TX = (NVML_GPM_METRIC_NVLINK_L2_TX, 'NvLink write for link 2 in bytes since reboot.') + GPM_METRIC_NVLINK_L3_RX = (NVML_GPM_METRIC_NVLINK_L3_RX, 'NvLink read for link 3 in bytes since reboot.') + GPM_METRIC_NVLINK_L3_TX = (NVML_GPM_METRIC_NVLINK_L3_TX, 'NvLink write for link 3 in bytes since reboot.') + GPM_METRIC_NVLINK_L4_RX = (NVML_GPM_METRIC_NVLINK_L4_RX, 'NvLink read for link 4 in bytes since reboot.') + GPM_METRIC_NVLINK_L4_TX = (NVML_GPM_METRIC_NVLINK_L4_TX, 'NvLink write for link 4 in bytes since reboot.') + GPM_METRIC_NVLINK_L5_RX = (NVML_GPM_METRIC_NVLINK_L5_RX, 'NvLink read for link 5 in bytes since reboot.') + GPM_METRIC_NVLINK_L5_TX = (NVML_GPM_METRIC_NVLINK_L5_TX, 'NvLink write for link 5 in bytes since reboot.') + GPM_METRIC_NVLINK_L6_RX = (NVML_GPM_METRIC_NVLINK_L6_RX, 'NvLink read for link 6 in bytes since reboot.') + GPM_METRIC_NVLINK_L6_TX = (NVML_GPM_METRIC_NVLINK_L6_TX, 'NvLink write for link 6 in bytes since reboot.') + GPM_METRIC_NVLINK_L7_RX = (NVML_GPM_METRIC_NVLINK_L7_RX, 'NvLink read for link 7 in bytes since reboot.') + GPM_METRIC_NVLINK_L7_TX = (NVML_GPM_METRIC_NVLINK_L7_TX, 'NvLink write for link 7 in bytes since reboot.') + GPM_METRIC_NVLINK_L8_RX = (NVML_GPM_METRIC_NVLINK_L8_RX, 'NvLink read for link 8 in bytes since reboot.') + GPM_METRIC_NVLINK_L8_TX = (NVML_GPM_METRIC_NVLINK_L8_TX, 'NvLink write for link 8 in bytes since reboot.') + GPM_METRIC_NVLINK_L9_RX = (NVML_GPM_METRIC_NVLINK_L9_RX, 'NvLink read for link 9 in bytes since reboot.') + GPM_METRIC_NVLINK_L9_TX = (NVML_GPM_METRIC_NVLINK_L9_TX, 'NvLink write for link 9 in bytes since reboot.') + GPM_METRIC_NVLINK_L10_RX = (NVML_GPM_METRIC_NVLINK_L10_RX, 'NvLink read for link 10 in bytes since reboot.') + GPM_METRIC_NVLINK_L10_TX = (NVML_GPM_METRIC_NVLINK_L10_TX, 'NvLink write for link 10 in bytes since reboot.') + GPM_METRIC_NVLINK_L11_RX = (NVML_GPM_METRIC_NVLINK_L11_RX, 'NvLink read for link 11 in bytes since reboot.') + GPM_METRIC_NVLINK_L11_TX = (NVML_GPM_METRIC_NVLINK_L11_TX, 'NvLink write for link 11 in bytes since reboot.') + GPM_METRIC_NVLINK_L12_RX = (NVML_GPM_METRIC_NVLINK_L12_RX, 'NvLink read for link 12 in bytes since reboot.') + GPM_METRIC_NVLINK_L12_TX = (NVML_GPM_METRIC_NVLINK_L12_TX, 'NvLink write for link 12 in bytes since reboot.') + GPM_METRIC_NVLINK_L13_RX = (NVML_GPM_METRIC_NVLINK_L13_RX, 'NvLink read for link 13 in bytes since reboot.') + GPM_METRIC_NVLINK_L13_TX = (NVML_GPM_METRIC_NVLINK_L13_TX, 'NvLink write for link 13 in bytes since reboot.') + GPM_METRIC_NVLINK_L14_RX = (NVML_GPM_METRIC_NVLINK_L14_RX, 'NvLink read for link 14 in bytes since reboot.') + GPM_METRIC_NVLINK_L14_TX = (NVML_GPM_METRIC_NVLINK_L14_TX, 'NvLink write for link 14 in bytes since reboot.') + GPM_METRIC_NVLINK_L15_RX = (NVML_GPM_METRIC_NVLINK_L15_RX, 'NvLink read for link 15 in bytes since reboot.') + GPM_METRIC_NVLINK_L15_TX = (NVML_GPM_METRIC_NVLINK_L15_TX, 'NvLink write for link 15 in bytes since reboot.') + GPM_METRIC_NVLINK_L16_RX = (NVML_GPM_METRIC_NVLINK_L16_RX, 'NvLink read for link 16 in bytes since reboot.') + GPM_METRIC_NVLINK_L16_TX = (NVML_GPM_METRIC_NVLINK_L16_TX, 'NvLink write for link 16 in bytes since reboot.') + GPM_METRIC_NVLINK_L17_RX = (NVML_GPM_METRIC_NVLINK_L17_RX, 'NvLink read for link 17 in bytes since reboot.') + GPM_METRIC_NVLINK_L17_TX = (NVML_GPM_METRIC_NVLINK_L17_TX, 'NvLink write for link 17 in bytes since reboot.') + GPM_METRIC_NVLINK_L18_RX = (NVML_GPM_METRIC_NVLINK_L18_RX, 'NvLink read for link 18 in bytes since reboot.') + GPM_METRIC_NVLINK_L18_TX = (NVML_GPM_METRIC_NVLINK_L18_TX, 'NvLink write for link 18 in bytes since reboot.') + GPM_METRIC_NVLINK_L19_RX = (NVML_GPM_METRIC_NVLINK_L19_RX, 'NvLink read for link 19 in bytes since reboot.') + GPM_METRIC_NVLINK_L19_TX = (NVML_GPM_METRIC_NVLINK_L19_TX, 'NvLink write for link 19 in bytes since reboot.') + GPM_METRIC_NVLINK_L20_RX = (NVML_GPM_METRIC_NVLINK_L20_RX, 'NvLink read for link 20 in bytes since reboot.') + GPM_METRIC_NVLINK_L20_TX = (NVML_GPM_METRIC_NVLINK_L20_TX, 'NvLink write for link 20 in bytes since reboot.') + GPM_METRIC_NVLINK_L21_RX = (NVML_GPM_METRIC_NVLINK_L21_RX, 'NvLink read for link 21 in bytes since reboot.') + GPM_METRIC_NVLINK_L21_TX = (NVML_GPM_METRIC_NVLINK_L21_TX, 'NvLink write for link 21 in bytes since reboot.') + GPM_METRIC_NVLINK_L22_RX = (NVML_GPM_METRIC_NVLINK_L22_RX, 'NvLink read for link 22 in bytes since reboot.') + GPM_METRIC_NVLINK_L22_TX = (NVML_GPM_METRIC_NVLINK_L22_TX, 'NvLink write for link 22 in bytes since reboot.') + GPM_METRIC_NVLINK_L23_RX = (NVML_GPM_METRIC_NVLINK_L23_RX, 'NvLink read for link 23 in bytes since reboot.') + GPM_METRIC_NVLINK_L23_TX = (NVML_GPM_METRIC_NVLINK_L23_TX, 'NvLink write for link 23 in bytes since reboot.') + GPM_METRIC_NVLINK_L24_RX = (NVML_GPM_METRIC_NVLINK_L24_RX, 'NvLink read for link 24 in bytes since reboot.') + GPM_METRIC_NVLINK_L24_TX = (NVML_GPM_METRIC_NVLINK_L24_TX, 'NvLink write for link 24 in bytes since reboot.') + GPM_METRIC_NVLINK_L25_RX = (NVML_GPM_METRIC_NVLINK_L25_RX, 'NvLink read for link 25 in bytes since reboot.') + GPM_METRIC_NVLINK_L25_TX = (NVML_GPM_METRIC_NVLINK_L25_TX, 'NvLink write for link 25 in bytes since reboot.') + GPM_METRIC_NVLINK_L26_RX = (NVML_GPM_METRIC_NVLINK_L26_RX, 'NvLink read for link 26 in bytes since reboot.') + GPM_METRIC_NVLINK_L26_TX = (NVML_GPM_METRIC_NVLINK_L26_TX, 'NvLink write for link 26 in bytes since reboot.') + GPM_METRIC_NVLINK_L27_RX = (NVML_GPM_METRIC_NVLINK_L27_RX, 'NvLink read for link 27 in bytes since reboot.') + GPM_METRIC_NVLINK_L27_TX = (NVML_GPM_METRIC_NVLINK_L27_TX, 'NvLink write for link 27 in bytes since reboot.') + GPM_METRIC_NVLINK_L28_RX = (NVML_GPM_METRIC_NVLINK_L28_RX, 'NvLink read for link 28 in bytes since reboot.') + GPM_METRIC_NVLINK_L28_TX = (NVML_GPM_METRIC_NVLINK_L28_TX, 'NvLink write for link 28 in bytes since reboot.') + GPM_METRIC_NVLINK_L29_RX = (NVML_GPM_METRIC_NVLINK_L29_RX, 'NvLink read for link 29 in bytes since reboot.') + GPM_METRIC_NVLINK_L29_TX = (NVML_GPM_METRIC_NVLINK_L29_TX, 'NvLink write for link 29 in bytes since reboot.') + GPM_METRIC_NVLINK_L30_RX = (NVML_GPM_METRIC_NVLINK_L30_RX, 'NvLink read for link 30 in bytes since reboot.') + GPM_METRIC_NVLINK_L30_TX = (NVML_GPM_METRIC_NVLINK_L30_TX, 'NvLink write for link 30 in bytes since reboot.') + GPM_METRIC_NVLINK_L31_RX = (NVML_GPM_METRIC_NVLINK_L31_RX, 'NvLink read for link 31 in bytes since reboot.') + GPM_METRIC_NVLINK_L31_TX = (NVML_GPM_METRIC_NVLINK_L31_TX, 'NvLink write for link 31 in bytes since reboot.') + GPM_METRIC_NVLINK_L32_RX = (NVML_GPM_METRIC_NVLINK_L32_RX, 'NvLink read for link 32 in bytes since reboot.') + GPM_METRIC_NVLINK_L32_TX = (NVML_GPM_METRIC_NVLINK_L32_TX, 'NvLink write for link 32 in bytes since reboot.') + GPM_METRIC_NVLINK_L33_RX = (NVML_GPM_METRIC_NVLINK_L33_RX, 'NvLink read for link 33 in bytes since reboot.') + GPM_METRIC_NVLINK_L33_TX = (NVML_GPM_METRIC_NVLINK_L33_TX, 'NvLink write for link 33 in bytes since reboot.') + GPM_METRIC_NVLINK_L34_RX = (NVML_GPM_METRIC_NVLINK_L34_RX, 'NvLink read for link 34 in bytes since reboot.') + GPM_METRIC_NVLINK_L34_TX = (NVML_GPM_METRIC_NVLINK_L34_TX, 'NvLink write for link 34 in bytes since reboot.') + GPM_METRIC_NVLINK_L35_RX = (NVML_GPM_METRIC_NVLINK_L35_RX, 'NvLink read for link 35 in bytes since reboot.') + GPM_METRIC_NVLINK_L35_TX = (NVML_GPM_METRIC_NVLINK_L35_TX, 'NvLink write for link 35 in bytes since reboot.') + GPM_METRIC_MAX = (NVML_GPM_METRIC_MAX, 'Maximum value above +1.') + +class PowerProfileType(_cyb_FastEnum): + """ + See `nvmlPowerProfileType_t`. + """ + POWER_PROFILE_MAX_P = NVML_POWER_PROFILE_MAX_P + POWER_PROFILE_MAX_Q = NVML_POWER_PROFILE_MAX_Q + POWER_PROFILE_COMPUTE = NVML_POWER_PROFILE_COMPUTE + POWER_PROFILE_MEMORY_BOUND = NVML_POWER_PROFILE_MEMORY_BOUND + POWER_PROFILE_NETWORK = NVML_POWER_PROFILE_NETWORK + POWER_PROFILE_BALANCED = NVML_POWER_PROFILE_BALANCED + POWER_PROFILE_LLM_INFERENCE = NVML_POWER_PROFILE_LLM_INFERENCE + POWER_PROFILE_LLM_TRAINING = NVML_POWER_PROFILE_LLM_TRAINING + POWER_PROFILE_RBM = NVML_POWER_PROFILE_RBM + POWER_PROFILE_DCPCIE = NVML_POWER_PROFILE_DCPCIE + POWER_PROFILE_HMMA_SPARSE = NVML_POWER_PROFILE_HMMA_SPARSE + POWER_PROFILE_HMMA_DENSE = NVML_POWER_PROFILE_HMMA_DENSE + POWER_PROFILE_SYNC_BALANCED = NVML_POWER_PROFILE_SYNC_BALANCED + POWER_PROFILE_HPC = NVML_POWER_PROFILE_HPC + POWER_PROFILE_MIG = NVML_POWER_PROFILE_MIG + POWER_PROFILE_MAX = NVML_POWER_PROFILE_MAX + +class DeviceAddressingModeType(_cyb_FastEnum): + """ + Enum to represent device addressing mode values + + See `nvmlDeviceAddressingModeType_t`. + """ + DEVICE_ADDRESSING_MODE_NONE = (NVML_DEVICE_ADDRESSING_MODE_NONE, 'No active mode.') + DEVICE_ADDRESSING_MODE_HMM = (NVML_DEVICE_ADDRESSING_MODE_HMM, 'Heterogeneous Memory Management mode.') + DEVICE_ADDRESSING_MODE_ATS = (NVML_DEVICE_ADDRESSING_MODE_ATS, 'Address Translation Services mode.') + +class PRMCounterId(_cyb_FastEnum): + """ + PRM Counter IDs + + See `nvmlPRMCounterId_t`. + """ + NONE = NVML_PRM_COUNTER_ID_NONE + PPCNT_PHYSICAL_LAYER_CTRS_LINK_DOWN_EVENTS = NVML_PRM_COUNTER_ID_PPCNT_PHYSICAL_LAYER_CTRS_LINK_DOWN_EVENTS + PPCNT_PHYSICAL_LAYER_CTRS_SUCCESSFUL_RECOVERY_EVENTS = NVML_PRM_COUNTER_ID_PPCNT_PHYSICAL_LAYER_CTRS_SUCCESSFUL_RECOVERY_EVENTS + PPCNT_RECOVERY_CTRS_TOTAL_SUCCESSFUL_RECOVERY_EVENTS = NVML_PRM_COUNTER_ID_PPCNT_RECOVERY_CTRS_TOTAL_SUCCESSFUL_RECOVERY_EVENTS + PPCNT_RECOVERY_CTRS_TIME_SINCE_LAST_RECOVERY = NVML_PRM_COUNTER_ID_PPCNT_RECOVERY_CTRS_TIME_SINCE_LAST_RECOVERY + PPCNT_RECOVERY_CTRS_TIME_BETWEEN_LAST_TWO_RECOVERIES = NVML_PRM_COUNTER_ID_PPCNT_RECOVERY_CTRS_TIME_BETWEEN_LAST_TWO_RECOVERIES + PPCNT_PORTCOUNTERS_PORT_XMIT_WAIT = NVML_PRM_COUNTER_ID_PPCNT_PORTCOUNTERS_PORT_XMIT_WAIT + PPCNT_PLR_RCV_CODES = NVML_PRM_COUNTER_ID_PPCNT_PLR_RCV_CODES + PPCNT_PLR_RCV_CODE_ERR = NVML_PRM_COUNTER_ID_PPCNT_PLR_RCV_CODE_ERR + PPCNT_PLR_RCV_UNCORRECTABLE_CODE = NVML_PRM_COUNTER_ID_PPCNT_PLR_RCV_UNCORRECTABLE_CODE + PPCNT_PLR_XMIT_CODES = NVML_PRM_COUNTER_ID_PPCNT_PLR_XMIT_CODES + PPCNT_PLR_XMIT_RETRY_CODES = NVML_PRM_COUNTER_ID_PPCNT_PLR_XMIT_RETRY_CODES + PPCNT_PLR_XMIT_RETRY_EVENTS = NVML_PRM_COUNTER_ID_PPCNT_PLR_XMIT_RETRY_EVENTS + PPCNT_PLR_SYNC_EVENTS = NVML_PRM_COUNTER_ID_PPCNT_PLR_SYNC_EVENTS + PPRM_OPER_RECOVERY = NVML_PRM_COUNTER_ID_PPRM_OPER_RECOVERY + +class PowerProfileOperation(_cyb_FastEnum): + """ + Enum for operation to perform on the requested profiles + + See `nvmlPowerProfileOperation_t`. + """ + CLEAR = (NVML_POWER_PROFILE_OPERATION_CLEAR, 'Remove the requested profiles from the existing list of requested profiles.') + SET = (NVML_POWER_PROFILE_OPERATION_SET, 'Add the requested profiles to the existing list of requested profiles.') + SET_AND_OVERWRITE = (NVML_POWER_PROFILE_OPERATION_SET_AND_OVERWRITE, 'Overwrite the existing list of requested profiles with just the requested profiles.') + MAX = (NVML_POWER_PROFILE_OPERATION_MAX, 'Max value above +1.') + +class ProcessMode(_cyb_FastEnum): + """ + Enum to represent process mode. + + See `nvmlProcessMode_t`. + """ + COMPUTE = (NVML_PROCESS_MODE_COMPUTE, 'Processes with a compute context.') + GRAPHICS = (NVML_PROCESS_MODE_GRAPHICS, 'Processes with a graphics context.') + MPS = (NVML_PROCESS_MODE_MPS, 'Processes with a MPS (Multi-Process Service) compute context.') + ALL = (NVML_PROCESS_MODE_ALL, 'All processes running on the GPU (compute, graphics, MPS, and other types).') + MAX = (NVML_PROCESS_MODE_MAX, 'Maximum value for bounds checking.') + +class CPERType(_cyb_FastEnum): + """ + Bitmask of CPER record types. Multiple values may be combined to + request records from several sources in one call. + + See `nvmlCPERType_t`. + """ + CPER_ACCESS_TYPE_GPU = (NVML_CPER_ACCESS_TYPE_GPU, 'Access GPU CPER records.') + + +class AffinityScope(_FastEnum): + NODE = (0, "Scope of NUMA node for affinity queries") + SOCKET = (1, "Scope of processor socket for affinity queries") + + +class FieldId(_FastEnum): + DEV_ECC_CURRENT = (1, "Current ECC mode. 1=Active. 0=Inactive") + DEV_ECC_PENDING = (2, "Pending ECC mode. 1=Active. 0=Inactive") + # ECC Count Totals + DEV_ECC_SBE_VOL_TOTAL = (3, "Total single bit volatile ECC errors") + DEV_ECC_DBE_VOL_TOTAL = (4, "Total double bit volatile ECC errors") + DEV_ECC_SBE_AGG_TOTAL = (5, "Total single bit aggregate (persistent) ECC errors") + DEV_ECC_DBE_AGG_TOTAL = (6, "Total double bit aggregate (persistent) ECC errors") + # Individual ECC locations + DEV_ECC_SBE_VOL_L1 = (7, "L1 cache single bit volatile ECC errors") + DEV_ECC_DBE_VOL_L1 = (8, "L1 cache double bit volatile ECC errors") + DEV_ECC_SBE_VOL_L2 = (9, "L2 cache single bit volatile ECC errors") + DEV_ECC_DBE_VOL_L2 = (10, "L2 cache double bit volatile ECC errors") + DEV_ECC_SBE_VOL_DEV = (11, "Device memory single bit volatile ECC errors") + DEV_ECC_DBE_VOL_DEV = (12, "Device memory double bit volatile ECC errors") + DEV_ECC_SBE_VOL_REG = (13, "Register file single bit volatile ECC errors") + DEV_ECC_DBE_VOL_REG = (14, "Register file double bit volatile ECC errors") + DEV_ECC_SBE_VOL_TEX = (15, "Texture memory single bit volatile ECC errors") + DEV_ECC_DBE_VOL_TEX = (16, "Texture memory double bit volatile ECC errors") + DEV_ECC_DBE_VOL_CBU = (17, "CBU double bit volatile ECC errors") + DEV_ECC_SBE_AGG_L1 = (18, "L1 cache single bit aggregate (persistent) ECC errors") + DEV_ECC_DBE_AGG_L1 = (19, "L1 cache double bit aggregate (persistent) ECC errors") + DEV_ECC_SBE_AGG_L2 = (20, "L2 cache single bit aggregate (persistent) ECC errors") + DEV_ECC_DBE_AGG_L2 = (21, "L2 cache double bit aggregate (persistent) ECC errors") + DEV_ECC_SBE_AGG_DEV = (22, "Device memory single bit aggregate (persistent) ECC errors") + DEV_ECC_DBE_AGG_DEV = (23, "Device memory double bit aggregate (persistent) ECC errors") + DEV_ECC_SBE_AGG_REG = (24, "Register File single bit aggregate (persistent) ECC errors") + DEV_ECC_DBE_AGG_REG = (25, "Register File double bit aggregate (persistent) ECC errors") + DEV_ECC_SBE_AGG_TEX = (26, "Texture memory single bit aggregate (persistent) ECC errors") + DEV_ECC_DBE_AGG_TEX = (27, "Texture memory double bit aggregate (persistent) ECC errors") + DEV_ECC_DBE_AGG_CBU = (28, "CBU double bit aggregate ECC errors") + + # Page Retirement + DEV_RETIRED_SBE = (29, "Number of retired pages because of single bit errors") + DEV_RETIRED_DBE = (30, "Number of retired pages because of double bit errors") + DEV_RETIRED_PENDING = (31, "If any pages are pending retirement. 1=yes. 0=no.") + + # NVLink Flit Error Counters + DEV_NVLINK_CRC_FLIT_ERROR_COUNT_L0 = (32, "NVLink flow control CRC Error Counter for Lane 0") + DEV_NVLINK_CRC_FLIT_ERROR_COUNT_L1 = (33, "NVLink flow control CRC Error Counter for Lane 1") + DEV_NVLINK_CRC_FLIT_ERROR_COUNT_L2 = (34, "NVLink flow control CRC Error Counter for Lane 2") + DEV_NVLINK_CRC_FLIT_ERROR_COUNT_L3 = (35, "NVLink flow control CRC Error Counter for Lane 3") + DEV_NVLINK_CRC_FLIT_ERROR_COUNT_L4 = (36, "NVLink flow control CRC Error Counter for Lane 4") + DEV_NVLINK_CRC_FLIT_ERROR_COUNT_L5 = (37, "NVLink flow control CRC Error Counter for Lane 5") + DEV_NVLINK_CRC_FLIT_ERROR_COUNT_TOTAL = (38, "NVLink flow control CRC Error Counter total for all Lanes") + + # NVLink CRC Data Error Counters + DEV_NVLINK_CRC_DATA_ERROR_COUNT_L0 = (39, "NVLink data CRC Error Counter for Lane 0") + DEV_NVLINK_CRC_DATA_ERROR_COUNT_L1 = (40, "NVLink data CRC Error Counter for Lane 1") + DEV_NVLINK_CRC_DATA_ERROR_COUNT_L2 = (41, "NVLink data CRC Error Counter for Lane 2") + DEV_NVLINK_CRC_DATA_ERROR_COUNT_L3 = (42, "NVLink data CRC Error Counter for Lane 3") + DEV_NVLINK_CRC_DATA_ERROR_COUNT_L4 = (43, "NVLink data CRC Error Counter for Lane 4") + DEV_NVLINK_CRC_DATA_ERROR_COUNT_L5 = (44, "NVLink data CRC Error Counter for Lane 5") + DEV_NVLINK_CRC_DATA_ERROR_COUNT_TOTAL = (45, "NvLink data CRC Error Counter total for all Lanes") + + # NVLink Replay Error Counters + DEV_NVLINK_REPLAY_ERROR_COUNT_L0 = (46, "NVLink Replay Error Counter for Lane 0") + DEV_NVLINK_REPLAY_ERROR_COUNT_L1 = (47, "NVLink Replay Error Counter for Lane 1") + DEV_NVLINK_REPLAY_ERROR_COUNT_L2 = (48, "NVLink Replay Error Counter for Lane 2") + DEV_NVLINK_REPLAY_ERROR_COUNT_L3 = (49, "NVLink Replay Error Counter for Lane 3") + DEV_NVLINK_REPLAY_ERROR_COUNT_L4 = (50, "NVLink Replay Error Counter for Lane 4") + DEV_NVLINK_REPLAY_ERROR_COUNT_L5 = (51, "NVLink Replay Error Counter for Lane 5") + DEV_NVLINK_REPLAY_ERROR_COUNT_TOTAL = (52, "NVLink Replay Error Counter total for all Lanes") + + # NVLink Recovery Error Counters + DEV_NVLINK_RECOVERY_ERROR_COUNT_L0 = (53, "NVLink Recovery Error Counter for Lane 0") + DEV_NVLINK_RECOVERY_ERROR_COUNT_L1 = (54, "NVLink Recovery Error Counter for Lane 1") + DEV_NVLINK_RECOVERY_ERROR_COUNT_L2 = (55, "NVLink Recovery Error Counter for Lane 2") + DEV_NVLINK_RECOVERY_ERROR_COUNT_L3 = (56, "NVLink Recovery Error Counter for Lane 3") + DEV_NVLINK_RECOVERY_ERROR_COUNT_L4 = (57, "NVLink Recovery Error Counter for Lane 4") + DEV_NVLINK_RECOVERY_ERROR_COUNT_L5 = (58, "NVLink Recovery Error Counter for Lane 5") + DEV_NVLINK_RECOVERY_ERROR_COUNT_TOTAL = (59, "NVLink Recovery Error Counter total for all Lanes") + + # NvLink Bandwidth Counters + DEV_NVLINK_BANDWIDTH_C0_L0 = (60, "NVLink Bandwidth Counter for Counter Set 0, Lane 0") + DEV_NVLINK_BANDWIDTH_C0_L1 = (61, "NVLink Bandwidth Counter for Counter Set 0, Lane 1") + DEV_NVLINK_BANDWIDTH_C0_L2 = (62, "NVLink Bandwidth Counter for Counter Set 0, Lane 2") + DEV_NVLINK_BANDWIDTH_C0_L3 = (63, "NVLink Bandwidth Counter for Counter Set 0, Lane 3") + DEV_NVLINK_BANDWIDTH_C0_L4 = (64, "NVLink Bandwidth Counter for Counter Set 0, Lane 4") + DEV_NVLINK_BANDWIDTH_C0_L5 = (65, "NVLink Bandwidth Counter for Counter Set 0, Lane 5") + DEV_NVLINK_BANDWIDTH_C0_TOTAL = (66, "NVLink Bandwidth Counter Total for Counter Set 0, All Lanes") + + # NvLink Bandwidth Counters + DEV_NVLINK_BANDWIDTH_C1_L0 = (67, "NVLink Bandwidth Counter for Counter Set 1, Lane 0") + DEV_NVLINK_BANDWIDTH_C1_L1 = (68, "NVLink Bandwidth Counter for Counter Set 1, Lane 1") + DEV_NVLINK_BANDWIDTH_C1_L2 = (69, "NVLink Bandwidth Counter for Counter Set 1, Lane 2") + DEV_NVLINK_BANDWIDTH_C1_L3 = (70, "NVLink Bandwidth Counter for Counter Set 1, Lane 3") + DEV_NVLINK_BANDWIDTH_C1_L4 = (71, "NVLink Bandwidth Counter for Counter Set 1, Lane 4") + DEV_NVLINK_BANDWIDTH_C1_L5 = (72, "NVLink Bandwidth Counter for Counter Set 1, Lane 5") + DEV_NVLINK_BANDWIDTH_C1_TOTAL = (73, "NVLink Bandwidth Counter Total for Counter Set 1, All Lanes") + + # NVML Perf Policy Counters + DEV_PERF_POLICY_POWER = (74, "Perf Policy Counter for Power Policy") + DEV_PERF_POLICY_THERMAL = (75, "Perf Policy Counter for Thermal Policy") + DEV_PERF_POLICY_SYNC_BOOST = (76, "Perf Policy Counter for Sync boost Policy") + DEV_PERF_POLICY_BOARD_LIMIT = (77, "Perf Policy Counter for Board Limit") + DEV_PERF_POLICY_LOW_UTILIZATION = (78, "Perf Policy Counter for Low GPU Utilization Policy") + DEV_PERF_POLICY_RELIABILITY = (79, "Perf Policy Counter for Reliability Policy") + DEV_PERF_POLICY_TOTAL_APP_CLOCKS = (80, "Perf Policy Counter for Total App Clock Policy") + DEV_PERF_POLICY_TOTAL_BASE_CLOCKS = (81, "Perf Policy Counter for Total Base Clocks Policy") + + # Memory temperatures + DEV_MEMORY_TEMP = (82, "Memory temperature for the device") + + # Energy Counter + DEV_TOTAL_ENERGY_CONSUMPTION = (83, "Total energy consumption for the GPU in mJ since the driver was last reloaded") + + # NVLink Speed + DEV_NVLINK_SPEED_MBPS_L0 = (84, "NVLink Speed in MBps for Link 0") + DEV_NVLINK_SPEED_MBPS_L1 = (85, "NVLink Speed in MBps for Link 1") + DEV_NVLINK_SPEED_MBPS_L2 = (86, "NVLink Speed in MBps for Link 2") + DEV_NVLINK_SPEED_MBPS_L3 = (87, "NVLink Speed in MBps for Link 3") + DEV_NVLINK_SPEED_MBPS_L4 = (88, "NVLink Speed in MBps for Link 4") + DEV_NVLINK_SPEED_MBPS_L5 = (89, "NVLink Speed in MBps for Link 5") + DEV_NVLINK_SPEED_MBPS_COMMON = (90, "Common NVLink Speed in MBps for active links") + + DEV_NVLINK_LINK_COUNT = (91, "Number of NVLinks present on the device") + + DEV_RETIRED_PENDING_SBE = (92, "If any pages are pending retirement due to SBE. 1=yes. 0=no.") + DEV_RETIRED_PENDING_DBE = (93, "If any pages are pending retirement due to DBE. 1=yes. 0=no.") + + DEV_PCIE_REPLAY_COUNTER = (94, "PCIe replay counter") + DEV_PCIE_REPLAY_ROLLOVER_COUNTER = (95, "PCIe replay rollover counter") + + # NVLink Flit Error Counters + DEV_NVLINK_CRC_FLIT_ERROR_COUNT_L6 = (96, "NVLink flow control CRC Error Counter for Lane 6") + DEV_NVLINK_CRC_FLIT_ERROR_COUNT_L7 = (97, "NVLink flow control CRC Error Counter for Lane 7") + DEV_NVLINK_CRC_FLIT_ERROR_COUNT_L8 = (98, "NVLink flow control CRC Error Counter for Lane 8") + DEV_NVLINK_CRC_FLIT_ERROR_COUNT_L9 = (99, "NVLink flow control CRC Error Counter for Lane 9") + DEV_NVLINK_CRC_FLIT_ERROR_COUNT_L10 = (100, "NVLink flow control CRC Error Counter for Lane 10") + DEV_NVLINK_CRC_FLIT_ERROR_COUNT_L11 = (101, "NVLink flow control CRC Error Counter for Lane 11") + + # NVLink CRC Data Error Counters + DEV_NVLINK_CRC_DATA_ERROR_COUNT_L6 = (102, "NVLink data CRC Error Counter for Lane 6") + DEV_NVLINK_CRC_DATA_ERROR_COUNT_L7 = (103, "NVLink data CRC Error Counter for Lane 7") + DEV_NVLINK_CRC_DATA_ERROR_COUNT_L8 = (104, "NVLink data CRC Error Counter for Lane 8") + DEV_NVLINK_CRC_DATA_ERROR_COUNT_L9 = (105, "NVLink data CRC Error Counter for Lane 9") + DEV_NVLINK_CRC_DATA_ERROR_COUNT_L10 = (106, "NVLink data CRC Error Counter for Lane 10") + DEV_NVLINK_CRC_DATA_ERROR_COUNT_L11 = (107, "NVLink data CRC Error Counter for Lane 11") + + # NVLink Replay Error Counters + DEV_NVLINK_REPLAY_ERROR_COUNT_L6 = (108, "NVLink Replay Error Counter for Lane 6") + DEV_NVLINK_REPLAY_ERROR_COUNT_L7 = (109, "NVLink Replay Error Counter for Lane 7") + DEV_NVLINK_REPLAY_ERROR_COUNT_L8 = (110, "NVLink Replay Error Counter for Lane 8") + DEV_NVLINK_REPLAY_ERROR_COUNT_L9 = (111, "NVLink Replay Error Counter for Lane 9") + DEV_NVLINK_REPLAY_ERROR_COUNT_L10 = (112, "NVLink Replay Error Counter for Lane 10") + DEV_NVLINK_REPLAY_ERROR_COUNT_L11 = (113, "NVLink Replay Error Counter for Lane 11") + + # NVLink Recovery Error Counters + DEV_NVLINK_RECOVERY_ERROR_COUNT_L6 = (114, "NVLink Recovery Error Counter for Lane 6") + DEV_NVLINK_RECOVERY_ERROR_COUNT_L7 = (115, "NVLink Recovery Error Counter for Lane 7") + DEV_NVLINK_RECOVERY_ERROR_COUNT_L8 = (116, "NVLink Recovery Error Counter for Lane 8") + DEV_NVLINK_RECOVERY_ERROR_COUNT_L9 = (117, "NVLink Recovery Error Counter for Lane 9") + DEV_NVLINK_RECOVERY_ERROR_COUNT_L10 = (118, "NVLink Recovery Error Counter for Lane 10") + DEV_NVLINK_RECOVERY_ERROR_COUNT_L11 = (119, "NVLink Recovery Error Counter for Lane 11") + + # NvLink Bandwidth Counters */ + DEV_NVLINK_BANDWIDTH_C0_L6 = (120, "NVLink Bandwidth Counter for Counter Set 0, Lane 6") + DEV_NVLINK_BANDWIDTH_C0_L7 = (121, "NVLink Bandwidth Counter for Counter Set 0, Lane 7") + DEV_NVLINK_BANDWIDTH_C0_L8 = (122, "NVLink Bandwidth Counter for Counter Set 0, Lane 8") + DEV_NVLINK_BANDWIDTH_C0_L9 = (123, "NVLink Bandwidth Counter for Counter Set 0, Lane 9") + DEV_NVLINK_BANDWIDTH_C0_L10 = (124, "NVLink Bandwidth Counter for Counter Set 0, Lane 10") + DEV_NVLINK_BANDWIDTH_C0_L11 = (125, "NVLink Bandwidth Counter for Counter Set 0, Lane 11") + + # NvLink Bandwidth Counters + DEV_NVLINK_BANDWIDTH_C1_L6 = (126, "NVLink Bandwidth Counter for Counter Set 1, Lane 6") + DEV_NVLINK_BANDWIDTH_C1_L7 = (127, "NVLink Bandwidth Counter for Counter Set 1, Lane 7") + DEV_NVLINK_BANDWIDTH_C1_L8 = (128, "NVLink Bandwidth Counter for Counter Set 1, Lane 8") + DEV_NVLINK_BANDWIDTH_C1_L9 = (129, "NVLink Bandwidth Counter for Counter Set 1, Lane 9") + DEV_NVLINK_BANDWIDTH_C1_L10 = (130, "NVLink Bandwidth Counter for Counter Set 1, Lane 10") + DEV_NVLINK_BANDWIDTH_C1_L11 = (131, "NVLink Bandwidth Counter for Counter Set 1, Lane 11") + + # NVLink Speed + DEV_NVLINK_SPEED_MBPS_L6 = (132, "NVLink Speed in MBps for Link 6") + DEV_NVLINK_SPEED_MBPS_L7 = (133, "NVLink Speed in MBps for Link 7") + DEV_NVLINK_SPEED_MBPS_L8 = (134, "NVLink Speed in MBps for Link 8") + DEV_NVLINK_SPEED_MBPS_L9 = (135, "NVLink Speed in MBps for Link 9") + DEV_NVLINK_SPEED_MBPS_L10 = (136, "NVLink Speed in MBps for Link 10") + DEV_NVLINK_SPEED_MBPS_L11 = (137, "NVLink Speed in MBps for Link 11") + + # NVLink throughput counters field values + DEV_NVLINK_THROUGHPUT_DATA_TX = (138, "NVLink TX Data throughput in KiB") + DEV_NVLINK_THROUGHPUT_DATA_RX = (139, "NVLink RX Data throughput in KiB") + DEV_NVLINK_THROUGHPUT_RAW_TX = (140, "NVLink TX Data + protocol overhead in KiB") + DEV_NVLINK_THROUGHPUT_RAW_RX = (141, "NVLink RX Data + protocol overhead in KiB") + + # Row Remapper + DEV_REMAPPED_COR = (142, "Number of remapped rows due to correctable errors") + DEV_REMAPPED_UNC = (143, "Number of remapped rows due to uncorrectable errors") + DEV_REMAPPED_PENDING = (144, "If any rows are pending remapping. 1=yes 0=no") + DEV_REMAPPED_FAILURE = (145, "If any rows failed to be remapped 1=yes 0=no") + + # Remote device NVLink ID + DEV_NVLINK_REMOTE_NVLINK_ID = (146, "Remote device NVLink ID") + + # NVSwitch: connected NVLink count + DEV_NVSWITCH_CONNECTED_LINK_COUNT = (147, "Number of NVLinks connected to NVSwitch") + + # NvLink ECC Data Error Counters + DEV_NVLINK_ECC_DATA_ERROR_COUNT_L0 = (148, "NVLink data ECC Error Counter for Link 0") + DEV_NVLINK_ECC_DATA_ERROR_COUNT_L1 = (149, "NVLink data ECC Error Counter for Link 1") + DEV_NVLINK_ECC_DATA_ERROR_COUNT_L2 = (150, "NVLink data ECC Error Counter for Link 2") + DEV_NVLINK_ECC_DATA_ERROR_COUNT_L3 = (151, "NVLink data ECC Error Counter for Link 3") + DEV_NVLINK_ECC_DATA_ERROR_COUNT_L4 = (152, "NVLink data ECC Error Counter for Link 4") + DEV_NVLINK_ECC_DATA_ERROR_COUNT_L5 = (153, "NVLink data ECC Error Counter for Link 5") + DEV_NVLINK_ECC_DATA_ERROR_COUNT_L6 = (154, "NVLink data ECC Error Counter for Link 6") + DEV_NVLINK_ECC_DATA_ERROR_COUNT_L7 = (155, "NVLink data ECC Error Counter for Link 7") + DEV_NVLINK_ECC_DATA_ERROR_COUNT_L8 = (156, "NVLink data ECC Error Counter for Link 8") + DEV_NVLINK_ECC_DATA_ERROR_COUNT_L9 = (157, "NVLink data ECC Error Counter for Link 9") + DEV_NVLINK_ECC_DATA_ERROR_COUNT_L10 = (158, "NVLink data ECC Error Counter for Link 10") + DEV_NVLINK_ECC_DATA_ERROR_COUNT_L11 = (159, "NVLink data ECC Error Counter for Link 11") + DEV_NVLINK_ECC_DATA_ERROR_COUNT_TOTAL = (160, "NVLink data ECC Error Counter total for all Links") + + # NVLink Error Replay + DEV_NVLINK_ERROR_DL_REPLAY = (161, "NVLink Replay Error Counter") + + # NVLink Recovery Error Counter + DEV_NVLINK_ERROR_DL_RECOVERY = (162, "NVLink Recovery Error Counter") + + # NVLink Recovery Error CRC Counter + DEV_NVLINK_ERROR_DL_CRC = (163, "NVLink CRC Error Counter") + + + # NVLink Speed, State and Version field id 164, 165, and 166 + DEV_NVLINK_GET_SPEED = (164, "NVLink Speed in MBps") + DEV_NVLINK_GET_STATE = (165, "NVLink State - Active,Inactive") + DEV_NVLINK_GET_VERSION = (166, "NVLink Version") + + DEV_NVLINK_GET_POWER_STATE = (167, "NVLink Power state. 0=HIGH_SPEED 1=LOW_SPEED") + DEV_NVLINK_GET_POWER_THRESHOLD = (168, "NVLink length of idle period (units can be found from DEV_NVLINK_GET_POWER_THRESHOLD_UNITS) before transitioning links to sleep state") + + DEV_PCIE_L0_TO_RECOVERY_COUNTER = (169, "Device PEX error recovery counter") + + DEV_C2C_LINK_COUNT = (170, "Number of C2C Links present on the device") + DEV_C2C_LINK_GET_STATUS = (171, "C2C Link Status 0=INACTIVE 1=ACTIVE") + DEV_C2C_LINK_GET_MAX_BW = (172, "C2C Link Speed in MBps for active links") + + DEV_PCIE_COUNT_CORRECTABLE_ERRORS = (173, "PCIe Correctable Errors Counter") + DEV_PCIE_COUNT_NAKS_RECEIVED = (174, "PCIe NAK Receive Counter") + DEV_PCIE_COUNT_RECEIVER_ERROR = (175, "PCIe Receiver Error Counter") + DEV_PCIE_COUNT_BAD_TLP = (176, "PCIe Bad TLP Counter") + DEV_PCIE_COUNT_NAKS_SENT = (177, "PCIe NAK Send Counter") + DEV_PCIE_COUNT_BAD_DLLP = (178, "PCIe Bad DLLP Counter") + DEV_PCIE_COUNT_NON_FATAL_ERROR = (179, "PCIe Non Fatal Error Counter") + DEV_PCIE_COUNT_FATAL_ERROR = (180, "PCIe Fatal Error Counter") + DEV_PCIE_COUNT_UNSUPPORTED_REQ = (181, "PCIe Unsupported Request Counter") + DEV_PCIE_COUNT_LCRC_ERROR = (182, "PCIe LCRC Error Counter") + DEV_PCIE_COUNT_LANE_ERROR = (183, "PCIe Per Lane Error Counter.") + + DEV_IS_RESETLESS_MIG_SUPPORTED = (184, "Device's Restless MIG Capability") + + DEV_POWER_AVERAGE = (185, "GPU power averaged over 1 sec interval, supported on Ampere (except GA100) or newer architectures.") + DEV_POWER_INSTANT = (186, "Current GPU power, supported on all architectures.") + DEV_POWER_MIN_LIMIT = (187, "Minimum power limit in milliwatts.") + DEV_POWER_MAX_LIMIT = (188, "Maximum power limit in milliwatts.") + DEV_POWER_DEFAULT_LIMIT = (189, "Default power limit in milliwatts (limit which device boots with).") + DEV_POWER_CURRENT_LIMIT = (190, "Limit currently enforced in milliwatts (This includes other limits set elsewhere. E.g. Out-of-band).") + DEV_ENERGY = (191, "Total energy consumption (in mJ) since the driver was last reloaded. Same as \ref DEV_TOTAL_ENERGY_CONSUMPTION for the GPU.") + DEV_POWER_REQUESTED_LIMIT = (192, "Power limit requested by NVML or any other userspace client.") + + # GPU T.Limit temperature thresholds in degree Celsius + DEV_TEMPERATURE_SHUTDOWN_TLIMIT = (193, "T.Limit temperature after which GPU may shut down for HW protection") + DEV_TEMPERATURE_SLOWDOWN_TLIMIT = (194, "T.Limit temperature after which GPU may begin HW slowdown") + DEV_TEMPERATURE_MEM_MAX_TLIMIT = (195, "T.Limit temperature after which GPU may begin SW slowdown due to memory temperature") + DEV_TEMPERATURE_GPU_MAX_TLIMIT = (196, "T.Limit temperature after which GPU may be throttled below base clock") + + DEV_PCIE_COUNT_TX_BYTES = (197, "PCIe transmit bytes. Value can be wrapped.") + DEV_PCIE_COUNT_RX_BYTES = (198, "PCIe receive bytes. Value can be wrapped.") + + DEV_IS_MIG_MODE_INDEPENDENT_MIG_QUERY_CAPABLE = (199, "MIG mode independent, MIG query capable device. 1=yes. 0=no.") + + DEV_NVLINK_GET_POWER_THRESHOLD_MAX = (200, "Max Nvlink Power Threshold. See DEV_NVLINK_GET_POWER_THRESHOLD") + + + # NVLink counter field id 201-225 + DEV_NVLINK_COUNT_XMIT_PACKETS = (201, "Total Tx packets on the link in NVLink5") + DEV_NVLINK_COUNT_XMIT_BYTES = (202, "Total Tx bytes on the link in NVLink5") + DEV_NVLINK_COUNT_RCV_PACKETS = (203, "Total Rx packets on the link in NVLink5") + DEV_NVLINK_COUNT_RCV_BYTES = (204, "Total Rx bytes on the link in NVLink5") + DEV_NVLINK_COUNT_VL15_DROPPED = (205, "Deprecated, do not use") + DEV_NVLINK_COUNT_MALFORMED_PACKET_ERRORS = (206, "Number of packets Rx on a link where packets are malformed") + DEV_NVLINK_COUNT_BUFFER_OVERRUN_ERRORS = (207, "Number of packets that were discarded on Rx due to buffer overrun") + DEV_NVLINK_COUNT_RCV_ERRORS = (208, "Total number of packets with errors Rx on a link") + DEV_NVLINK_COUNT_RCV_REMOTE_ERRORS = (209, "Total number of packets Rx - stomp/EBP marker") + DEV_NVLINK_COUNT_RCV_GENERAL_ERRORS = (210, "Total number of packets Rx with header mismatch") + DEV_NVLINK_COUNT_LOCAL_LINK_INTEGRITY_ERRORS = (211, "Total number of times that the count of local errors exceeded a threshold") + DEV_NVLINK_COUNT_XMIT_DISCARDS = (212, "Total number of tx error packets that were discarded") + + DEV_NVLINK_COUNT_LINK_RECOVERY_SUCCESSFUL_EVENTS =(213, "Number of times link went from Up to recovery, succeeded and link came back up") + DEV_NVLINK_COUNT_LINK_RECOVERY_FAILED_EVENTS = (214, "Number of times link went from Up to recovery, failed and link was declared down") + DEV_NVLINK_COUNT_LINK_RECOVERY_EVENTS = (215, "Number of times link went from Up to recovery, irrespective of the result") + + DEV_NVLINK_COUNT_RAW_BER_LANE0 = (216, "Deprecated, do not use") + DEV_NVLINK_COUNT_RAW_BER_LANE1 = (217, "Deprecated, do not use") + DEV_NVLINK_COUNT_RAW_BER = (218, "Deprecated, do not use") + DEV_NVLINK_COUNT_EFFECTIVE_ERRORS = (219, "Sum of the number of errors in each Nvlink packet") + + # NVLink Effective BER + DEV_NVLINK_COUNT_EFFECTIVE_BER = (220, "Effective BER for effective errors") + DEV_NVLINK_COUNT_SYMBOL_ERRORS = (221, "Number of errors in rx symbols") + + # NVLink Symbol BER + DEV_NVLINK_COUNT_SYMBOL_BER = (222, "BER for symbol errors") + + DEV_NVLINK_GET_POWER_THRESHOLD_MIN = (223, "Min Nvlink Power Threshold. See DEV_NVLINK_GET_POWER_THRESHOLD") + DEV_NVLINK_GET_POWER_THRESHOLD_UNITS = (224, "Values are in the form NVML_NVLINK_LOW_POWER_THRESHOLD_UNIT_*") + DEV_NVLINK_GET_POWER_THRESHOLD_SUPPORTED = (225, "Determine if Nvlink Power Threshold feature is supported") + + DEV_RESET_STATUS = (226, "Depracated, do not use (use DEV_GET_GPU_RECOVERY_ACTION instead)") + DEV_DRAIN_AND_RESET_STATUS = (227, "Deprecated, do not use (use DEV_GET_GPU_RECOVERY_ACTION instead)") + DEV_PCIE_OUTBOUND_ATOMICS_MASK = 228 + DEV_PCIE_INBOUND_ATOMICS_MASK = 229 + DEV_GET_GPU_RECOVERY_ACTION = (230, "GPU Recovery action - None/Reset/Reboot/Drain P2P/Drain and Reset") + DEV_C2C_LINK_ERROR_INTR = (231, "C2C Link CRC Error Counter") + DEV_C2C_LINK_ERROR_REPLAY = (232, "C2C Link Replay Error Counter") + DEV_C2C_LINK_ERROR_REPLAY_B2B = (233, "C2C Link Back to Back Replay Error Counter") + DEV_C2C_LINK_POWER_STATE = (234, "C2C Link Power state. See NVML_C2C_POWER_STATE_*") + + # NVLink counter field id 235-250 + DEV_NVLINK_COUNT_FEC_HISTORY_0 = (235, "Count of symbol errors that are corrected - bin 0") + DEV_NVLINK_COUNT_FEC_HISTORY_1 = (236, "Count of symbol errors that are corrected - bin 1") + DEV_NVLINK_COUNT_FEC_HISTORY_2 = (237, "Count of symbol errors that are corrected - bin 2") + DEV_NVLINK_COUNT_FEC_HISTORY_3 = (238, "Count of symbol errors that are corrected - bin 3") + DEV_NVLINK_COUNT_FEC_HISTORY_4 = (239, "Count of symbol errors that are corrected - bin 4") + DEV_NVLINK_COUNT_FEC_HISTORY_5 = (240, "Count of symbol errors that are corrected - bin 5") + DEV_NVLINK_COUNT_FEC_HISTORY_6 = (241, "Count of symbol errors that are corrected - bin 6") + DEV_NVLINK_COUNT_FEC_HISTORY_7 = (242, "Count of symbol errors that are corrected - bin 7") + DEV_NVLINK_COUNT_FEC_HISTORY_8 = (243, "Count of symbol errors that are corrected - bin 8") + DEV_NVLINK_COUNT_FEC_HISTORY_9 = (244, "Count of symbol errors that are corrected - bin 9") + DEV_NVLINK_COUNT_FEC_HISTORY_10 = (245, "Count of symbol errors that are corrected - bin 10") + DEV_NVLINK_COUNT_FEC_HISTORY_11 = (246, "Count of symbol errors that are corrected - bin 11") + DEV_NVLINK_COUNT_FEC_HISTORY_12 = (247, "Count of symbol errors that are corrected - bin 12") + DEV_NVLINK_COUNT_FEC_HISTORY_13 = (248, "Count of symbol errors that are corrected - bin 13") + DEV_NVLINK_COUNT_FEC_HISTORY_14 = (249, "Count of symbol errors that are corrected - bin 14") + DEV_NVLINK_COUNT_FEC_HISTORY_15 = (250, "Count of symbol errors that are corrected - bin 15") + + # Power Smoothing + PWR_SMOOTHING_ENABLED = (251, "Enablement (0/DISABLED or 1/ENABLED)") + PWR_SMOOTHING_PRIV_LVL = (252, "Current privilege level") + PWR_SMOOTHING_IMM_RAMP_DOWN_ENABLED = (253, "Immediate ramp down enablement (0/DISABLED or 1/ENABLED)") + PWR_SMOOTHING_APPLIED_TMP_CEIL = (254, "Applied TMP ceiling value in Watts") + PWR_SMOOTHING_APPLIED_TMP_FLOOR = (255, "Applied TMP floor value in Watts") + PWR_SMOOTHING_MAX_PERCENT_TMP_FLOOR_SETTING = (256, "Max % TMP Floor value") + PWR_SMOOTHING_MIN_PERCENT_TMP_FLOOR_SETTING = (257, "Min % TMP Floor value") + PWR_SMOOTHING_HW_CIRCUITRY_PERCENT_LIFETIME_REMAINING = (258, "HW Circuitry % lifetime remaining") + PWR_SMOOTHING_MAX_NUM_PRESET_PROFILES = (259, "Max number of preset profiles") + PWR_SMOOTHING_PROFILE_PERCENT_TMP_FLOOR = (260, "% TMP floor for a given profile") + PWR_SMOOTHING_PROFILE_RAMP_UP_RATE = (261, "Ramp up rate in mW/s for a given profile") + PWR_SMOOTHING_PROFILE_RAMP_DOWN_RATE = (262, "Ramp down rate in mW/s for a given profile") + PWR_SMOOTHING_PROFILE_RAMP_DOWN_HYST_VAL = (263, "Ramp down hysteresis value in ms for a given profile") + PWR_SMOOTHING_ACTIVE_PRESET_PROFILE = (264, "Active preset profile number") + PWR_SMOOTHING_ADMIN_OVERRIDE_PERCENT_TMP_FLOOR = (265, "% TMP floor for a given profile") + PWR_SMOOTHING_ADMIN_OVERRIDE_RAMP_UP_RATE = (266, "Ramp up rate in mW/s for a given profile") + PWR_SMOOTHING_ADMIN_OVERRIDE_RAMP_DOWN_RATE = (267, "Ramp down rate in mW/s for a given profile") + PWR_SMOOTHING_ADMIN_OVERRIDE_RAMP_DOWN_HYST_VAL = (268, "Ramp down hysteresis value in ms for a given profile") + + # Field values for Clock Throttle Reason Counters + DEV_CLOCKS_EVENT_REASON_SW_POWER_CAP = (74, "Throttling to not exceed currently set power limits in ns") + DEV_CLOCKS_EVENT_REASON_SYNC_BOOST = (76, "Throttling to match minimum possible clock across Sync Boost Group in ns") + DEV_CLOCKS_EVENT_REASON_SW_THERM_SLOWDOWN = (269, "Throttling to ensure ((GPU temp < GPU Max Operating Temp) && (Memory Temp < Memory Max Operating Temp)) in ns") + DEV_CLOCKS_EVENT_REASON_HW_THERM_SLOWDOWN = (270, "Throttling due to temperature being too high (reducing core clocks by a factor of 2 or more) in ns") + DEV_CLOCKS_EVENT_REASON_HW_POWER_BRAKE_SLOWDOWN = (271, "Throttling due to external power brake assertion trigger (reducing core clocks by a factor of 2 or more) in ns") + DEV_POWER_SYNC_BALANCING_FREQ = (272, "Accumulated frequency of the GPU to be used for averaging") + DEV_POWER_SYNC_BALANCING_AF = (273, "Accumulated activity factor of the GPU to be used for averaging") + DEV_EDPP_MULTIPLIER = (274, "EDPp multiplier expressed as a percentage") + + PWR_SMOOTHING_PRIMARY_POWER_FLOOR = (275, "Current primary power floor value in Watts") + PWR_SMOOTHING_SECONDARY_POWER_FLOOR = (276, "Current secondary power floor value in Watts") + PWR_SMOOTHING_MIN_PRIMARY_FLOOR_ACT_OFFSET = (277, "Minimum primary floor activation offset value in Watts") + PWR_SMOOTHING_MIN_PRIMARY_FLOOR_ACT_POINT = (278, "Minimum primary floor activation point value in Watts") + PWR_SMOOTHING_WINDOW_MULTIPLIER = (279, "Window Multiplier value in ms") + PWR_SMOOTHING_DELAYED_PWR_SMOOTHING_SUPPORTED = (280, "Support (0/Not Supported or 1/Supported) for delayed power smoothing") + PWR_SMOOTHING_PROFILE_SECONDARY_POWER_FLOOR = (281, "Current secondary power floor value in Watts for a given profile") + PWR_SMOOTHING_PROFILE_PRIMARY_FLOOR_ACT_WIN_MULT = (282, "Current primary floor activation window multiplier value for a given profile") + PWR_SMOOTHING_PROFILE_PRIMARY_FLOOR_TAR_WIN_MULT = (283, "Current primary floor target window multiplier value for a given profile") + PWR_SMOOTHING_PROFILE_PRIMARY_FLOOR_ACT_OFFSET = (284, "Current primary floor activation offset value in Watts for a given profile") + PWR_SMOOTHING_ADMIN_OVERRIDE_SECONDARY_POWER_FLOOR = (285, "Current secondary power floor value in Watts for admin override") + PWR_SMOOTHING_ADMIN_OVERRIDE_PRIMARY_FLOOR_ACT_WIN_MULT = (286, "Current primary floor activation window multiplier value for admin override") + PWR_SMOOTHING_ADMIN_OVERRIDE_PRIMARY_FLOOR_TAR_WIN_MULT = (287, "Current primary floor target window multiplier value for admin override") + PWR_SMOOTHING_ADMIN_OVERRIDE_PRIMARY_FLOOR_ACT_OFFSET = (288, "Current primary floor activation offset value in Watts for admin override") + + MAX = 289 + +NVLINK_MAX_LINKS = 18 + + +class RUSD(_FastEnum): + POLL_NONE = (0x0, "Disable RUSD polling on all metric groups") + POLL_CLOCK = (0x1, "Enable RUSD polling on clock group") + POLL_PERF = (0x2, "Enable RUSD polling on performance group") + POLL_MEMORY = (0x4, "Enable RUSD polling on memory group") + POLL_POWER = (0x8, "Enable RUSD polling on power group") + POLL_THERMAL = (0x10, "Enable RUSD polling on thermal group") + POLL_PCI = (0x20, "Enable RUSD polling on pci group") + POLL_FAN = (0x40, "Enable RUSD polling on fan group") + POLL_PROC_UTIL = (0x80, "Enable RUSD polling on process utilization group") + POLL_ALL = (0xFFFFFFFFFFFFFFFF, "Enable RUSD polling on all groups") + + +class PowerMizerMode(_FastEnum): + ADAPTIVE = (0, "Adjust GPU clocks based on GPU utilization") + PREFER_MAXIMUM_PERFORMANCE = (1, "Raise GPU clocks to favor maximum performance, to the extent that thermal and other constraints allow") + AUTO = (2, "PowerMizer mode is driver controlled") + PREFER_CONSISTENT_PERFORMANCE = (3, "lock to GPU base clocks") + + +class DeviceArch(_FastEnum): + KEPLER = 2 + MAXWELL = 3 + PASCAL = 4 + VOLTA = 5 + TURING = 6 + AMPERE = 7 + ADA = 8 + HOPPER = 9 + BLACKWELL = 10 + UNKNOWN = 0xFFFFFFFF + + +class BusType(_FastEnum): + UNKNOWN = (0, "Unknown bus type") + PCI = (1, "PCI bus") + PCIE = (2, "PXI-Express bus") + FPCI = (3, "FPCI bus") + AGP = (4, "AGP bus") + + +class FanControlPolicy(_FastEnum): + TEMPERATURE_CONTINUOUS_SW = (0, "Temperature-controlled fan policy") + MANUAL = (1, "Manual fan control policy") + + +class PowerSource(_FastEnum): + AC = 0x00000000 + BATTERY = 0x00000001 + UNDERSIZED = 0x00000002 + + +class PcieLinkMaxSpeed(_FastEnum): + SPEED_INVALID = 0x00000000 + SPEED_2500MBPS = 0x00000001 + SPEED_5000MBPS = 0x00000002 + SPEED_8000MBPS = 0x00000003 + SPEED_16000MBPS = 0x00000004 + SPEED_32000MBPS = 0x00000005 + SPEED_64000MBPS = 0x00000006 + + +class AdaptiveClockingInfoStatus(_FastEnum): + DISABLED = 0x00000000 + ENABLED = 0x00000001 + + +MAX_GPU_UTILIZATIONS = 8 + + +class PcieAtomicsCap(_FastEnum): + FETCHADD32 = (0x01, "32-bit fetch and add") + FETCHADD64 = (0x02, "64-bit fetch and add") + SWAP32 = (0x04, "32-bit swap") + SWAP64 = (0x08, "64-bit swap") + CAS32 = (0x10, "32-bit compare and swap") + CAS64 = (0x20, "64-bit compare and swap") + CAS128 = (0x40, "128-bit compare and swap") + MAX = 7 + + +class PowerScope(_FastEnum): + GPU = (0, "Targets only GPU") + MODULE = (1, "Targets the whole module") + MEMORY = (2, "Targets the GPU memory") + + +# Need "Enum" suffix to disambiguate from nvmlGridLicenseExpiry_t +class GridLicenseExpiryEnum(_FastEnum): + NOT_AVAILABLE = (0, "Expiry information not available") + INVALID = (1, "Invalid expiry or error fetching expiry") + VALID = (2, "Valid expiry") + NOT_APPLICABLE = (3, "Expiry not applicable") + PERMANENT = (4, "Permanent expiry") + + +GRID_LICENSE_FEATURE_MAX_COUNT = 3 + + +class VgpuVirtualizationCapMigration(_FastEnum): + NO = 0x0 + YES = 0x1 + + +class VgpuPgpuVirtualizationCapMigration(_FastEnum): + NO = 0x0 + YES = 0x1 + + +class VgpuSchedulerPolicy(_FastEnum): + UNKNOWN = 0 + BEST_EFFORT = 1 + EQUAL_SHARE = 2 + FIXED_SHARE = 3 + + +class VgpuSchedulerArr(_FastEnum): + DEFAULT = 0 + DISABLE = 1 + ENABLE = 2 + + +class VgpuSchedulerEngineType(_FastEnum): + GRAPHICS = 1 + NVENC1 = 2 + + +class GridLicenseState(_FastEnum): + UNKNOWN = 0 + UNINITIALIZED = 1 + UNLICENSED_UNRESTRICTED = 2 + UNLICENSED_RESTRICTED = 3 + UNLICENSED = 4 + LICENSED = 5 + + +class NvlinkLowPowerThresholdUnit(_FastEnum): + UNIT_100US = 0x0 + UNIT_50US = 0x1 + + +class NvlinkPowerState(_FastEnum): + HIGH_SPEED = 0x0 + LOW_SPEED = 0x1 + + +class NvlinkLowPowerThreshold(_FastEnum): + MIN = 0x1 + MAX = 0x1FFF + RESET = 0xFFFFFFFF + DEFAULT = 0xFFFFFFFF + + +class C2CPowerState(_FastEnum): + FULL_POWER = 0 + LOW_POWER = 1 + + +class EventType(_FastEnum): + NONE = 0x0000000000000000 + SINGLE_BIT_ECC_ERROR = 0x0000000000000001 + DOUBLE_BIT_ECC_ERROR = 0x0000000000000002 + PSTATE = 0x0000000000000004 + XID_CRITICAL_ERROR = 0x0000000000000008 + CLOCK = 0x0000000000000010 + POWER_SOURCE_CHANGE = 0x0000000000000080 + MIG_CONFIG_CHANGE = 0x0000000000000100 + SINGLE_BIT_ECC_ERROR_STORM = 0x0000000000000200 + DRAM_RETIREMENT_EVENT = 0x0000000000000400 + DRAM_RETIREMENT_FAILURE = 0x0000000000000800 + NON_FATAL_POISON_ERROR = 0x0000000000001000 + FATAL_POISON_ERROR = 0x0000000000002000 + GPU_UNAVAILABLE_ERROR = 0x0000000000004000 + GPU_RECOVERY_ACTION = 0x0000000000008000 + + +class SystemEventType(_FastEnum): + GPU_DRIVER_UNBIND = 0x0000000000000001 + GPU_DRIVER_BIND = 0x0000000000000002 + + +class ClocksEventReasons(_FastEnum): + EVENT_REASON_GPU_IDLE = 0x0000000000000001 + EVENT_REASON_APPLICATIONS_CLOCKS_SETTING = 0x0000000000000002 + EVENT_REASON_SW_POWER_CAP = 0x0000000000000004 + THROTTLE_REASON_HW_SLOWDOWN = 0x0000000000000008 + EVENT_REASON_SYNC_BOOST = 0x0000000000000010 + EVENT_REASON_SW_THERMAL_SLOWDOWN = 0x0000000000000020 + THROTTLE_REASON_HW_THERMAL_SLOWDOWN = 0x0000000000000040 + THROTTLE_REASON_HW_POWER_BRAKE_SLOWDOWN = 0x0000000000000080 + EVENT_REASON_DISPLAY_CLOCK_SETTING = 0x0000000000000100 + EVENT_REASON_NONE = 0x0000000000000000 + + +class EncoderQuery(_FastEnum): + H264 = 0x00 + HEVC = 0x01 + AV1 = 0x02 + UNKNOWN = 0xFF + + +class NvFBCSessionFlag(_FastEnum): + DIFFMAP_ENABLED = 0x00000001 + CLASSIFICATIONMAP_ENABLED = 0x00000002 + CAPTURE_WITH_WAIT_NO_WAIT = 0x00000004 + CAPTURE_WITH_WAIT_INFINITE = 0x00000008 + CAPTURE_WITH_WAIT_TIMEOUT = 0x00000010 + + +class CCSystemCpuCaps(_FastEnum): + NONE = 0 + AMD_SEV = 1 + INTEL_TDX = 2 + AMD_SEV_SNP = 3 + AMD_SNP_VTOM = 4 + + +class CCSystemGpus(_FastEnum): + CC_NOT_CAPABLE = 0 + CC_CAPABLE = 1 + + +class CCSystemDevtoolsMode(_FastEnum): + OFF = 0 + ON = 1 + + +class CCSystemEnvironment(_FastEnum): + UNAVAILABLE = 0 + SIM = 1 + PROD = 2 + + +class CCSystemFeature(_FastEnum): + DISABLED = 0 + ENABLED = 1 + + +class CCSystemMultiGpu(_FastEnum): + NONE = 0 + PROTECTED_PCIE = 1 + NVLE = 2 + + +class CCAcceptingClientRequests(_FastEnum): + FALSE = 0 + TRUE = 1 + + +class GpuFabricState(_FastEnum): + NOT_SUPPORTED = 0 + NOT_STARTED = 1 + IN_PROGRESS = 2 + COMPLETED = 3 + + +class GpuFabricHealthMaskDegradedBw(_FastEnum): + NOT_SUPPORTED = 0 + TRUE = 1 + FALSE = 2 + + +class GpuFabricHealthMaskRouteRecovery(_FastEnum): + NOT_SUPPORTED = 0 + TRUE = 1 + FALSE = 2 + + +class GpuFabricHealthMaskRouteUnhealthy(_FastEnum): + NOT_SUPPORTED = 0 + TRUE = 1 + FALSE = 2 + + +class GpuFabricHealthMaskAccessTimeout(_FastEnum): + NOT_SUPPORTED = 0 + TRUE = 1 + FALSE = 2 + + +class GpuFabricHealthMaskIncorrectConfiguration(_FastEnum): + NOT_SUPPORTED = 0 + NONE = 1 + INCORRECT_SYSGUID = 2 + INCORRECT_CHASSIS_SN = 3 + NO_PARTITION = 4 + INSUFFICIENT_NVLINKS = 5 + INCOMPATIBLE_GPU_FW = 6 + INVALID_LOCATION = 7 + + +class GpuFabricHealthSummary(_FastEnum): + NOT_SUPPORTED = 0 + HEALTHY = 1 + UNHEALTHY = 2 + LIMITED_CAPACITY = 3 + + +class InitFlag(_FastEnum): + NO_GPUS = 1 + NO_ATTACH = 2 + + +class NvlinkState(_FastEnum): + INACTIVE = 0x0 + ACTIVE = 0x1 + SLEEP = 0x2 + + +class NvlinkFirmwareUcodeType(_FastEnum): + MSE = 0x1 + NETIR = 0x2 + NETIR_UPHY = 0x3 + NETIR_CLN = 0x4 + NETIR_DLN = 0x5 + + +class DeviceMig(_FastEnum): + DISABLE = 0 + ENABLE = 1 + + +class GpuInstanceProfile(_FastEnum): + PROFILE_1_SLICE = 0x0 + PROFILE_2_SLICE = 0x1 + PROFILE_3_SLICE = 0x2 + PROFILE_4_SLICE = 0x3 + PROFILE_7_SLICE = 0x4 + PROFILE_8_SLICE = 0x5 + PROFILE_6_SLICE = 0x6 + PROFILE_1_SLICE_REV1 = 0x7 + PROFILE_2_SLICE_REV1 = 0x8 + PROFILE_1_SLICE_REV2 = 0x9 + PROFILE_1_SLICE_GFX = 0x0A + PROFILE_2_SLICE_GFX = 0x0B + PROFILE_4_SLICE_GFX = 0x0C + PROFILE_1_SLICE_NO_ME = 0x0D + PROFILE_2_SLICE_NO_ME = 0x0E + PROFILE_1_SLICE_ALL_ME = 0x0F + PROFILE_2_SLICE_ALL_ME = 0x10 + PROFILE_COUNT = 0x11 + + +class GpuInstanceProfileCaps(_FastEnum): + P2P = 0x1 + GFX = 0x2 + + +class ComputeInstanceProfileCaps(_FastEnum): + GFX = 0x1 + + +class ComputeInstanceProfile(_FastEnum): + PROFILE_1_SLICE = 0x0 + PROFILE_2_SLICE = 0x1 + PROFILE_3_SLICE = 0x2 + PROFILE_4_SLICE = 0x3 + PROFILE_7_SLICE = 0x4 + PROFILE_8_SLICE = 0x5 + PROFILE_6_SLICE = 0x6 + PROFILE_1_SLICE_REV1 = 0x7 + PROFILE_COUNT = 0x8 + + +class ComputeInstanceEngineProfile(_FastEnum): + SHARED = 0x0 + COUNT = 0x1 + + +class PowerSmoothingProfileParam(_FastEnum): + PERCENT_TMP_FLOOR = 0 + RAMP_UP_RATE = 1 + RAMP_DOWN_RATE = 2 + RAMP_DOWN_HYSTERESIS = 3 + SECONDARY_POWER_FLOOR = 4 + PRIMARY_FLOOR_ACT_WIN_MULT = 5 + PRIMARY_FLOOR_TAR_WIN_MULT = 6 + PRIMARY_FLOOR_ACT_OFFSET = 7 + + +class VgpuPgpu(_FastEnum): + HETEROGENEOUS_MODE = 0 # Heterogeneous vGPU mode. + HOMOGENEOUS_MODE = 1 # Homogeneous vGPU mode. + + +############################################################################### +# Error handling +############################################################################### + + +class NvmlError(Exception): + def __init__(self, status): + self.status = status + s = error_string(status) + super(NvmlError, self).__init__(s) + + def __reduce__(self): + return (type(self), (self.status,)) + + +class UninitializedError(NvmlError): + pass +class InvalidArgumentError(NvmlError): + pass +class NotSupportedError(NvmlError): + pass +class NoPermissionError(NvmlError): + pass +class AlreadyInitializedError(NvmlError): + pass +class NotFoundError(NvmlError): + pass +class InsufficientSizeError(NvmlError): + pass +class InsufficientPowerError(NvmlError): + pass +class DriverNotLoadedError(NvmlError): + pass +class TimeoutError(NvmlError): + pass +class IrqIssueError(NvmlError): + pass +class LibraryNotFoundError(NvmlError): + pass +class FunctionNotFoundError(NvmlError): + pass +class CorruptedInforomError(NvmlError): + pass +class GpuIsLostError(NvmlError): + pass +class ResetRequiredError(NvmlError): + pass +class OperatingSystemError(NvmlError): + pass +class LibRmVersionMismatchError(NvmlError): + pass +class InUseError(NvmlError): + pass +class MemoryError(NvmlError): + pass +class NoDataError(NvmlError): + pass +class VgpuEccNotSupportedError(NvmlError): + pass +class InsufficientResourcesError(NvmlError): + pass +class FreqNotSupportedError(NvmlError): + pass +class ArgumentVersionMismatchError(NvmlError): + pass +class DeprecatedError(NvmlError): + pass +class NotReadyError(NvmlError): + pass +class GpuNotFoundError(NvmlError): + pass +class InvalidStateError(NvmlError): + pass +class ResetTypeNotSupportedError(NvmlError): + pass +class UnknownError(NvmlError): + pass +cdef object _nvml_error_factory(int status): + cdef object pystatus = status + if status == 1: + return UninitializedError(pystatus) + elif status == 2: + return InvalidArgumentError(pystatus) + elif status == 3: + return NotSupportedError(pystatus) + elif status == 4: + return NoPermissionError(pystatus) + elif status == 5: + return AlreadyInitializedError(pystatus) + elif status == 6: + return NotFoundError(pystatus) + elif status == 7: + return InsufficientSizeError(pystatus) + elif status == 8: + return InsufficientPowerError(pystatus) + elif status == 9: + return DriverNotLoadedError(pystatus) + elif status == 10: + return TimeoutError(pystatus) + elif status == 11: + return IrqIssueError(pystatus) + elif status == 12: + return LibraryNotFoundError(pystatus) + elif status == 13: + return FunctionNotFoundError(pystatus) + elif status == 14: + return CorruptedInforomError(pystatus) + elif status == 15: + return GpuIsLostError(pystatus) + elif status == 16: + return ResetRequiredError(pystatus) + elif status == 17: + return OperatingSystemError(pystatus) + elif status == 18: + return LibRmVersionMismatchError(pystatus) + elif status == 19: + return InUseError(pystatus) + elif status == 20: + return MemoryError(pystatus) + elif status == 21: + return NoDataError(pystatus) + elif status == 22: + return VgpuEccNotSupportedError(pystatus) + elif status == 23: + return InsufficientResourcesError(pystatus) + elif status == 24: + return FreqNotSupportedError(pystatus) + elif status == 25: + return ArgumentVersionMismatchError(pystatus) + elif status == 26: + return DeprecatedError(pystatus) + elif status == 27: + return NotReadyError(pystatus) + elif status == 28: + return GpuNotFoundError(pystatus) + elif status == 29: + return InvalidStateError(pystatus) + elif status == 30: + return ResetTypeNotSupportedError(pystatus) + elif status == 999: + return UnknownError(pystatus) + return NvmlError(status) + + +@cython.profile(False) +cpdef int check_status(int status) except 1 nogil: + if status != 0: + with gil: + raise _nvml_error_factory(status) + return status != 0 + + +@cython.profile(False) +cpdef int check_status_size(int status) except 1 nogil: + if status == nvmlReturn_t.NVML_ERROR_INSUFFICIENT_SIZE: + return 0 + return check_status(status) + + +############################################################################### +# Wrapper functions +############################################################################### + + +cdef _get_pci_info_ext_v1_dtype_offsets(): + cdef nvmlPciInfoExt_v1_t pod + return _numpy.dtype({ + 'names': ['version', 'domain', 'bus', 'device_', 'pci_device_id', 'pci_sub_system_id', 'base_class', 'sub_class', 'bus_id'], + 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, (_numpy.int8, 32)], + 'offsets': [ + (&(pod.version)) - (&pod), + (&(pod.domain)) - (&pod), + (&(pod.bus)) - (&pod), + (&(pod.device)) - (&pod), + (&(pod.pciDeviceId)) - (&pod), + (&(pod.pciSubSystemId)) - (&pod), + (&(pod.baseClass)) - (&pod), + (&(pod.subClass)) - (&pod), + (&(pod.busId)) - (&pod), + ], + 'itemsize': sizeof(nvmlPciInfoExt_v1_t), + }) + +pci_info_ext_v1_dtype = _get_pci_info_ext_v1_dtype_offsets() + +cdef class PciInfoExt_v1: + """Empty-initialize an instance of `nvmlPciInfoExt_v1_t`. + + + .. seealso:: `nvmlPciInfoExt_v1_t` + """ + cdef: + nvmlPciInfoExt_v1_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlPciInfoExt_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating PciInfoExt_v1") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlPciInfoExt_v1_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.PciInfoExt_v1 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef PciInfoExt_v1 other_ + if not isinstance(other, PciInfoExt_v1): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlPciInfoExt_v1_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlPciInfoExt_v1_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlPciInfoExt_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating PciInfoExt_v1") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlPciInfoExt_v1_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def version(self): + """int: The version number of this struct.""" + return self._ptr[0].version + + @version.setter + def version(self, val): + if self._readonly: + raise ValueError("This PciInfoExt_v1 instance is read-only") + self._ptr[0].version = val + + @property + def domain(self): + """int: The PCI domain on which the device's bus resides, 0 to 0xffffffff.""" + return self._ptr[0].domain + + @domain.setter + def domain(self, val): + if self._readonly: + raise ValueError("This PciInfoExt_v1 instance is read-only") + self._ptr[0].domain = val + + @property + def bus(self): + """int: The bus on which the device resides, 0 to 0xff.""" + return self._ptr[0].bus + + @bus.setter + def bus(self, val): + if self._readonly: + raise ValueError("This PciInfoExt_v1 instance is read-only") + self._ptr[0].bus = val + + @property + def device_(self): + """int: The device's id on the bus, 0 to 31.""" + return self._ptr[0].device + + @device_.setter + def device_(self, val): + if self._readonly: + raise ValueError("This PciInfoExt_v1 instance is read-only") + self._ptr[0].device = val + + @property + def pci_device_id(self): + """int: The combined 16-bit device id and 16-bit vendor id.""" + return self._ptr[0].pciDeviceId + + @pci_device_id.setter + def pci_device_id(self, val): + if self._readonly: + raise ValueError("This PciInfoExt_v1 instance is read-only") + self._ptr[0].pciDeviceId = val + + @property + def pci_sub_system_id(self): + """int: The 32-bit Sub System Device ID.""" + return self._ptr[0].pciSubSystemId + + @pci_sub_system_id.setter + def pci_sub_system_id(self, val): + if self._readonly: + raise ValueError("This PciInfoExt_v1 instance is read-only") + self._ptr[0].pciSubSystemId = val + + @property + def base_class(self): + """int: The 8-bit PCI base class code.""" + return self._ptr[0].baseClass + + @base_class.setter + def base_class(self, val): + if self._readonly: + raise ValueError("This PciInfoExt_v1 instance is read-only") + self._ptr[0].baseClass = val + + @property + def sub_class(self): + """int: The 8-bit PCI sub class code.""" + return self._ptr[0].subClass + + @sub_class.setter + def sub_class(self, val): + if self._readonly: + raise ValueError("This PciInfoExt_v1 instance is read-only") + self._ptr[0].subClass = val + + @property + def bus_id(self): + """~_numpy.int8: (array of length 32).The tuple domain:bus:device.function PCI identifier (& NULL terminator).""" + return _cyb_cpython.PyUnicode_FromString(self._ptr[0].busId) + + @bus_id.setter + def bus_id(self, val): + if self._readonly: + raise ValueError("This PciInfoExt_v1 instance is read-only") + cdef bytes buf = val.encode() + if len(buf) >= 32: + raise ValueError("String too long for field bus_id, max length is 31") + cdef char *ptr = buf + _cyb_memcpy((self._ptr[0].busId), ptr, 32) + + @staticmethod + def from_buffer(buffer): + """Create an PciInfoExt_v1 instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlPciInfoExt_v1_t), PciInfoExt_v1) + + @staticmethod + def from_data(data): + """Create an PciInfoExt_v1 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `pci_info_ext_v1_dtype` holding the data. + """ + return _cyb_from_data(data, "pci_info_ext_v1_dtype", pci_info_ext_v1_dtype, PciInfoExt_v1) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an PciInfoExt_v1 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef PciInfoExt_v1 obj = PciInfoExt_v1.__new__(PciInfoExt_v1) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlPciInfoExt_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating PciInfoExt_v1") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlPciInfoExt_v1_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_pci_info_dtype_offsets(): + cdef nvmlPciInfo_t pod + return _numpy.dtype({ + 'names': ['bus_id_legacy', 'domain', 'bus', 'device_', 'pci_device_id', 'pci_sub_system_id', 'bus_id'], + 'formats': [(_numpy.int8, 16), _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, (_numpy.int8, 32)], + 'offsets': [ + (&(pod.busIdLegacy)) - (&pod), + (&(pod.domain)) - (&pod), + (&(pod.bus)) - (&pod), + (&(pod.device)) - (&pod), + (&(pod.pciDeviceId)) - (&pod), + (&(pod.pciSubSystemId)) - (&pod), + (&(pod.busId)) - (&pod), + ], + 'itemsize': sizeof(nvmlPciInfo_t), + }) + +pci_info_dtype = _get_pci_info_dtype_offsets() + +cdef class PciInfo: + """Empty-initialize an instance of `nvmlPciInfo_t`. + + + .. seealso:: `nvmlPciInfo_t` + """ + cdef: + nvmlPciInfo_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlPciInfo_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating PciInfo") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlPciInfo_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.PciInfo object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef PciInfo other_ + if not isinstance(other, PciInfo): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlPciInfo_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlPciInfo_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlPciInfo_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating PciInfo") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlPciInfo_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def bus_id_legacy(self): + """~_numpy.int8: (array of length 16).""" + return _cyb_cpython.PyUnicode_FromString(self._ptr[0].busIdLegacy) + + @bus_id_legacy.setter + def bus_id_legacy(self, val): + if self._readonly: + raise ValueError("This PciInfo instance is read-only") + cdef bytes buf = val.encode() + if len(buf) >= 16: + raise ValueError("String too long for field bus_id_legacy, max length is 15") + cdef char *ptr = buf + _cyb_memcpy((self._ptr[0].busIdLegacy), ptr, 16) + + @property + def domain(self): + """int: """ + return self._ptr[0].domain + + @domain.setter + def domain(self, val): + if self._readonly: + raise ValueError("This PciInfo instance is read-only") + self._ptr[0].domain = val + + @property + def bus(self): + """int: """ + return self._ptr[0].bus + + @bus.setter + def bus(self, val): + if self._readonly: + raise ValueError("This PciInfo instance is read-only") + self._ptr[0].bus = val + + @property + def device_(self): + """int: """ + return self._ptr[0].device + + @device_.setter + def device_(self, val): + if self._readonly: + raise ValueError("This PciInfo instance is read-only") + self._ptr[0].device = val + + @property + def pci_device_id(self): + """int: """ + return self._ptr[0].pciDeviceId + + @pci_device_id.setter + def pci_device_id(self, val): + if self._readonly: + raise ValueError("This PciInfo instance is read-only") + self._ptr[0].pciDeviceId = val + + @property + def pci_sub_system_id(self): + """int: """ + return self._ptr[0].pciSubSystemId + + @pci_sub_system_id.setter + def pci_sub_system_id(self, val): + if self._readonly: + raise ValueError("This PciInfo instance is read-only") + self._ptr[0].pciSubSystemId = val + + @property + def bus_id(self): + """~_numpy.int8: (array of length 32).""" + return _cyb_cpython.PyUnicode_FromString(self._ptr[0].busId) + + @bus_id.setter + def bus_id(self, val): + if self._readonly: + raise ValueError("This PciInfo instance is read-only") + cdef bytes buf = val.encode() + if len(buf) >= 32: + raise ValueError("String too long for field bus_id, max length is 31") + cdef char *ptr = buf + _cyb_memcpy((self._ptr[0].busId), ptr, 32) + + @staticmethod + def from_buffer(buffer): + """Create an PciInfo instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlPciInfo_t), PciInfo) + + @staticmethod + def from_data(data): + """Create an PciInfo instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `pci_info_dtype` holding the data. + """ + return _cyb_from_data(data, "pci_info_dtype", pci_info_dtype, PciInfo) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an PciInfo instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef PciInfo obj = PciInfo.__new__(PciInfo) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlPciInfo_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating PciInfo") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlPciInfo_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_utilization_dtype_offsets(): + cdef nvmlUtilization_t pod + return _numpy.dtype({ + 'names': ['gpu', 'memory'], + 'formats': [_numpy.uint32, _numpy.uint32], + 'offsets': [ + (&(pod.gpu)) - (&pod), + (&(pod.memory)) - (&pod), + ], + 'itemsize': sizeof(nvmlUtilization_t), + }) + +utilization_dtype = _get_utilization_dtype_offsets() + +cdef class Utilization: + """Empty-initialize an instance of `nvmlUtilization_t`. + + + .. seealso:: `nvmlUtilization_t` + """ + cdef: + nvmlUtilization_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlUtilization_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating Utilization") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlUtilization_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.Utilization object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef Utilization other_ + if not isinstance(other, Utilization): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlUtilization_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlUtilization_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlUtilization_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating Utilization") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlUtilization_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def gpu(self): + """int: """ + return self._ptr[0].gpu + + @gpu.setter + def gpu(self, val): + if self._readonly: + raise ValueError("This Utilization instance is read-only") + self._ptr[0].gpu = val + + @property + def memory(self): + """int: """ + return self._ptr[0].memory + + @memory.setter + def memory(self, val): + if self._readonly: + raise ValueError("This Utilization instance is read-only") + self._ptr[0].memory = val + + @staticmethod + def from_buffer(buffer): + """Create an Utilization instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlUtilization_t), Utilization) + + @staticmethod + def from_data(data): + """Create an Utilization instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `utilization_dtype` holding the data. + """ + return _cyb_from_data(data, "utilization_dtype", utilization_dtype, Utilization) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an Utilization instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef Utilization obj = Utilization.__new__(Utilization) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlUtilization_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating Utilization") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlUtilization_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_memory_dtype_offsets(): + cdef nvmlMemory_t pod + return _numpy.dtype({ + 'names': ['total', 'free', 'used'], + 'formats': [_numpy.uint64, _numpy.uint64, _numpy.uint64], + 'offsets': [ + (&(pod.total)) - (&pod), + (&(pod.free)) - (&pod), + (&(pod.used)) - (&pod), + ], + 'itemsize': sizeof(nvmlMemory_t), + }) + +memory_dtype = _get_memory_dtype_offsets() + +cdef class Memory: + """Empty-initialize an instance of `nvmlMemory_t`. + + + .. seealso:: `nvmlMemory_t` + """ + cdef: + nvmlMemory_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlMemory_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating Memory") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlMemory_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.Memory object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef Memory other_ + if not isinstance(other, Memory): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlMemory_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlMemory_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlMemory_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating Memory") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlMemory_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def total(self): + """int: """ + return self._ptr[0].total + + @total.setter + def total(self, val): + if self._readonly: + raise ValueError("This Memory instance is read-only") + self._ptr[0].total = val + + @property + def free(self): + """int: """ + return self._ptr[0].free + + @free.setter + def free(self, val): + if self._readonly: + raise ValueError("This Memory instance is read-only") + self._ptr[0].free = val + + @property + def used(self): + """int: """ + return self._ptr[0].used + + @used.setter + def used(self, val): + if self._readonly: + raise ValueError("This Memory instance is read-only") + self._ptr[0].used = val + + @staticmethod + def from_buffer(buffer): + """Create an Memory instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlMemory_t), Memory) + + @staticmethod + def from_data(data): + """Create an Memory instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `memory_dtype` holding the data. + """ + return _cyb_from_data(data, "memory_dtype", memory_dtype, Memory) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an Memory instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef Memory obj = Memory.__new__(Memory) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlMemory_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating Memory") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlMemory_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_memory_v2_dtype_offsets(): + cdef nvmlMemory_v2_t pod + return _numpy.dtype({ + 'names': ['version', 'total', 'reserved', 'free', 'used'], + 'formats': [_numpy.uint32, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64], + 'offsets': [ + (&(pod.version)) - (&pod), + (&(pod.total)) - (&pod), + (&(pod.reserved)) - (&pod), + (&(pod.free)) - (&pod), + (&(pod.used)) - (&pod), + ], + 'itemsize': sizeof(nvmlMemory_v2_t), + }) + +memory_v2_dtype = _get_memory_v2_dtype_offsets() + +cdef class Memory_v2: + """Empty-initialize an instance of `nvmlMemory_v2_t`. + + + .. seealso:: `nvmlMemory_v2_t` + """ + cdef: + nvmlMemory_v2_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlMemory_v2_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating Memory_v2") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlMemory_v2_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.Memory_v2 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef Memory_v2 other_ + if not isinstance(other, Memory_v2): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlMemory_v2_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlMemory_v2_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlMemory_v2_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating Memory_v2") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlMemory_v2_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def version(self): + """int: """ + return self._ptr[0].version + + @version.setter + def version(self, val): + if self._readonly: + raise ValueError("This Memory_v2 instance is read-only") + self._ptr[0].version = val + + @property + def total(self): + """int: """ + return self._ptr[0].total + + @total.setter + def total(self, val): + if self._readonly: + raise ValueError("This Memory_v2 instance is read-only") + self._ptr[0].total = val + + @property + def reserved(self): + """int: """ + return self._ptr[0].reserved + + @reserved.setter + def reserved(self, val): + if self._readonly: + raise ValueError("This Memory_v2 instance is read-only") + self._ptr[0].reserved = val + + @property + def free(self): + """int: """ + return self._ptr[0].free + + @free.setter + def free(self, val): + if self._readonly: + raise ValueError("This Memory_v2 instance is read-only") + self._ptr[0].free = val + + @property + def used(self): + """int: """ + return self._ptr[0].used + + @used.setter + def used(self, val): + if self._readonly: + raise ValueError("This Memory_v2 instance is read-only") + self._ptr[0].used = val + + @staticmethod + def from_buffer(buffer): + """Create an Memory_v2 instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlMemory_v2_t), Memory_v2) + + @staticmethod + def from_data(data): + """Create an Memory_v2 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `memory_v2_dtype` holding the data. + """ + return _cyb_from_data(data, "memory_v2_dtype", memory_v2_dtype, Memory_v2) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an Memory_v2 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef Memory_v2 obj = Memory_v2.__new__(Memory_v2) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlMemory_v2_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating Memory_v2") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlMemory_v2_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_ba_r1memory_dtype_offsets(): + cdef nvmlBAR1Memory_t pod + return _numpy.dtype({ + 'names': ['bar1_total', 'bar1_free', 'bar1_used'], + 'formats': [_numpy.uint64, _numpy.uint64, _numpy.uint64], + 'offsets': [ + (&(pod.bar1Total)) - (&pod), + (&(pod.bar1Free)) - (&pod), + (&(pod.bar1Used)) - (&pod), + ], + 'itemsize': sizeof(nvmlBAR1Memory_t), + }) + +ba_r1memory_dtype = _get_ba_r1memory_dtype_offsets() + +cdef class BAR1Memory: + """Empty-initialize an instance of `nvmlBAR1Memory_t`. + + + .. seealso:: `nvmlBAR1Memory_t` + """ + cdef: + nvmlBAR1Memory_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlBAR1Memory_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating BAR1Memory") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlBAR1Memory_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.BAR1Memory object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef BAR1Memory other_ + if not isinstance(other, BAR1Memory): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlBAR1Memory_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlBAR1Memory_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlBAR1Memory_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating BAR1Memory") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlBAR1Memory_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def bar1_total(self): + """int: """ + return self._ptr[0].bar1Total + + @bar1_total.setter + def bar1_total(self, val): + if self._readonly: + raise ValueError("This BAR1Memory instance is read-only") + self._ptr[0].bar1Total = val + + @property + def bar1_free(self): + """int: """ + return self._ptr[0].bar1Free + + @bar1_free.setter + def bar1_free(self, val): + if self._readonly: + raise ValueError("This BAR1Memory instance is read-only") + self._ptr[0].bar1Free = val + + @property + def bar1_used(self): + """int: """ + return self._ptr[0].bar1Used + + @bar1_used.setter + def bar1_used(self, val): + if self._readonly: + raise ValueError("This BAR1Memory instance is read-only") + self._ptr[0].bar1Used = val + + @staticmethod + def from_buffer(buffer): + """Create an BAR1Memory instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlBAR1Memory_t), BAR1Memory) + + @staticmethod + def from_data(data): + """Create an BAR1Memory instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `ba_r1memory_dtype` holding the data. + """ + return _cyb_from_data(data, "ba_r1memory_dtype", ba_r1memory_dtype, BAR1Memory) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an BAR1Memory instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef BAR1Memory obj = BAR1Memory.__new__(BAR1Memory) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlBAR1Memory_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating BAR1Memory") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlBAR1Memory_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_process_info_dtype_offsets(): + cdef nvmlProcessInfo_t pod + return _numpy.dtype({ + 'names': ['pid', 'used_gpu_memory', 'gpu_instance_id', 'compute_instance_id'], + 'formats': [_numpy.uint32, _numpy.uint64, _numpy.uint32, _numpy.uint32], + 'offsets': [ + (&(pod.pid)) - (&pod), + (&(pod.usedGpuMemory)) - (&pod), + (&(pod.gpuInstanceId)) - (&pod), + (&(pod.computeInstanceId)) - (&pod), + ], + 'itemsize': sizeof(nvmlProcessInfo_t), + }) + +process_info_dtype = _get_process_info_dtype_offsets() + +cdef class ProcessInfo: + """Empty-initialize an array of `nvmlProcessInfo_t`. + The resulting object is of length `size` and of dtype `process_info_dtype`. + If default-constructed, the instance represents a single struct. + + Args: + size (int): number of structs, default=1. + + .. seealso:: `nvmlProcessInfo_t` + """ + cdef: + readonly object _data + + def __init__(self, size=1): + arr = _numpy.empty(size, dtype=process_info_dtype) + self._data = arr.view(_numpy.recarray) + assert self._data.itemsize == sizeof(nvmlProcessInfo_t), \ + f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlProcessInfo_t) }" + + def __repr__(self): + if self._data.size > 1: + return f"<{__name__}.ProcessInfo_Array_{self._data.size} object at {hex(id(self))}>" + else: + return f"<{__name__}.ProcessInfo object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return self._data.ctypes.data + + cdef intptr_t _get_ptr(self): + return self._data.ctypes.data + + def __int__(self): + if self._data.size > 1: + raise TypeError("int() argument must be a bytes-like object of size 1. " + "To get the pointer address of an array, use .ptr") + return self._data.ctypes.data + + def __len__(self): + return self._data.size + + def __eq__(self, other): + cdef object self_data = self._data + if (not isinstance(other, ProcessInfo)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype: + return False + return bool((self_data == other._data).all()) + + def __getbuffer__(self, Py_buffer *buffer, int flags): + _cyb_cpython.PyObject_GetBuffer(self._data, buffer, flags) + + def __releasebuffer__(self, Py_buffer *buffer): + _cyb_cpython.PyBuffer_Release(buffer) + + @property + def pid(self): + """Union[~_numpy.uint32, int]: """ + if self._data.size == 1: + return int(self._data.pid[0]) + return self._data.pid + + @pid.setter + def pid(self, val): + self._data.pid = val + + @property + def used_gpu_memory(self): + """Union[~_numpy.uint64, int]: """ + if self._data.size == 1: + return int(self._data.used_gpu_memory[0]) + return self._data.used_gpu_memory + + @used_gpu_memory.setter + def used_gpu_memory(self, val): + self._data.used_gpu_memory = val + + @property + def gpu_instance_id(self): + """Union[~_numpy.uint32, int]: """ + if self._data.size == 1: + return int(self._data.gpu_instance_id[0]) + return self._data.gpu_instance_id + + @gpu_instance_id.setter + def gpu_instance_id(self, val): + self._data.gpu_instance_id = val + + @property + def compute_instance_id(self): + """Union[~_numpy.uint32, int]: """ + if self._data.size == 1: + return int(self._data.compute_instance_id[0]) + return self._data.compute_instance_id + + @compute_instance_id.setter + def compute_instance_id(self, val): + self._data.compute_instance_id = val + + def __getitem__(self, key): + cdef ssize_t key_ + cdef ssize_t size + if isinstance(key, int): + key_ = key + size = self._data.size + if key_ >= size or key_ <= -(size+1): + raise IndexError("index is out of bounds") + if key_ < 0: + key_ += size + return ProcessInfo.from_data(self._data[key_:key_+1]) + out = self._data[key] + if isinstance(out, _numpy.recarray) and out.dtype == process_info_dtype: + return ProcessInfo.from_data(out) + return out + + def __setitem__(self, key, val): + self._data[key] = val + + @staticmethod + def from_buffer(buffer): + """Create an ProcessInfo instance with the memory from the given buffer.""" + return ProcessInfo.from_data(_numpy.frombuffer(buffer, dtype=process_info_dtype)) + + @staticmethod + def from_data(data): + """Create an ProcessInfo instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a 1D array of dtype `process_info_dtype` holding the data. + """ + cdef ProcessInfo obj = ProcessInfo.__new__(ProcessInfo) + if not isinstance(data, _numpy.ndarray): + raise TypeError("data argument must be a NumPy ndarray") + if data.ndim != 1: + raise ValueError("data array must be 1D") + if data.dtype != process_info_dtype: + raise ValueError("data array must be of dtype process_info_dtype") + obj._data = data.view(_numpy.recarray) + + return obj + + @staticmethod + def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False): + """Create an ProcessInfo instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + size (int): number of structs, default=1. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef ProcessInfo obj = ProcessInfo.__new__(ProcessInfo) + cdef flag = _cyb_cpython_buffer.PyBUF_READ if readonly else _cyb_cpython_buffer.PyBUF_WRITE + cdef object buf = _cyb_cpython_memoryview.PyMemoryView_FromMemory( + ptr, sizeof(nvmlProcessInfo_t) * size, flag) + data = _numpy.ndarray(size, buffer=buf, dtype=process_info_dtype) + obj._data = data.view(_numpy.recarray) + + return obj + + +cdef _get_process_detail_v1_dtype_offsets(): + cdef nvmlProcessDetail_v1_t pod + return _numpy.dtype({ + 'names': ['pid', 'used_gpu_memory', 'gpu_instance_id', 'compute_instance_id', 'used_gpu_cc_protected_memory'], + 'formats': [_numpy.uint32, _numpy.uint64, _numpy.uint32, _numpy.uint32, _numpy.uint64], + 'offsets': [ + (&(pod.pid)) - (&pod), + (&(pod.usedGpuMemory)) - (&pod), + (&(pod.gpuInstanceId)) - (&pod), + (&(pod.computeInstanceId)) - (&pod), + (&(pod.usedGpuCcProtectedMemory)) - (&pod), + ], + 'itemsize': sizeof(nvmlProcessDetail_v1_t), + }) + +process_detail_v1_dtype = _get_process_detail_v1_dtype_offsets() + +cdef class ProcessDetail_v1: + """Empty-initialize an array of `nvmlProcessDetail_v1_t`. + The resulting object is of length `size` and of dtype `process_detail_v1_dtype`. + If default-constructed, the instance represents a single struct. + + Args: + size (int): number of structs, default=1. + + .. seealso:: `nvmlProcessDetail_v1_t` + """ + cdef: + readonly object _data + + def __init__(self, size=1): + arr = _numpy.empty(size, dtype=process_detail_v1_dtype) + self._data = arr.view(_numpy.recarray) + assert self._data.itemsize == sizeof(nvmlProcessDetail_v1_t), \ + f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlProcessDetail_v1_t) }" + + def __repr__(self): + if self._data.size > 1: + return f"<{__name__}.ProcessDetail_v1_Array_{self._data.size} object at {hex(id(self))}>" + else: + return f"<{__name__}.ProcessDetail_v1 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return self._data.ctypes.data + + cdef intptr_t _get_ptr(self): + return self._data.ctypes.data + + def __int__(self): + if self._data.size > 1: + raise TypeError("int() argument must be a bytes-like object of size 1. " + "To get the pointer address of an array, use .ptr") + return self._data.ctypes.data + + def __len__(self): + return self._data.size + + def __eq__(self, other): + cdef object self_data = self._data + if (not isinstance(other, ProcessDetail_v1)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype: + return False + return bool((self_data == other._data).all()) + + def __getbuffer__(self, Py_buffer *buffer, int flags): + _cyb_cpython.PyObject_GetBuffer(self._data, buffer, flags) + + def __releasebuffer__(self, Py_buffer *buffer): + _cyb_cpython.PyBuffer_Release(buffer) + + @property + def pid(self): + """Union[~_numpy.uint32, int]: Process ID.""" + if self._data.size == 1: + return int(self._data.pid[0]) + return self._data.pid + + @pid.setter + def pid(self, val): + self._data.pid = val + + @property + def used_gpu_memory(self): + """Union[~_numpy.uint64, int]: Amount of used GPU memory in bytes. Under WDDM, NVML_VALUE_NOT_AVAILABLE is always reported because Windows KMD manages all the memory and not the NVIDIA driver""" + if self._data.size == 1: + return int(self._data.used_gpu_memory[0]) + return self._data.used_gpu_memory + + @used_gpu_memory.setter + def used_gpu_memory(self, val): + self._data.used_gpu_memory = val + + @property + def gpu_instance_id(self): + """Union[~_numpy.uint32, int]: If MIG is enabled, stores a valid GPU instance ID. gpuInstanceId is.""" + if self._data.size == 1: + return int(self._data.gpu_instance_id[0]) + return self._data.gpu_instance_id + + @gpu_instance_id.setter + def gpu_instance_id(self, val): + self._data.gpu_instance_id = val + + @property + def compute_instance_id(self): + """Union[~_numpy.uint32, int]: If MIG is enabled, stores a valid compute instance ID. computeInstanceId.""" + if self._data.size == 1: + return int(self._data.compute_instance_id[0]) + return self._data.compute_instance_id + + @compute_instance_id.setter + def compute_instance_id(self, val): + self._data.compute_instance_id = val + + @property + def used_gpu_cc_protected_memory(self): + """Union[~_numpy.uint64, int]: Amount of used GPU conf compute protected memory in bytes.""" + if self._data.size == 1: + return int(self._data.used_gpu_cc_protected_memory[0]) + return self._data.used_gpu_cc_protected_memory + + @used_gpu_cc_protected_memory.setter + def used_gpu_cc_protected_memory(self, val): + self._data.used_gpu_cc_protected_memory = val + + def __getitem__(self, key): + cdef ssize_t key_ + cdef ssize_t size + if isinstance(key, int): + key_ = key + size = self._data.size + if key_ >= size or key_ <= -(size+1): + raise IndexError("index is out of bounds") + if key_ < 0: + key_ += size + return ProcessDetail_v1.from_data(self._data[key_:key_+1]) + out = self._data[key] + if isinstance(out, _numpy.recarray) and out.dtype == process_detail_v1_dtype: + return ProcessDetail_v1.from_data(out) + return out + + def __setitem__(self, key, val): + self._data[key] = val + + @staticmethod + def from_buffer(buffer): + """Create an ProcessDetail_v1 instance with the memory from the given buffer.""" + return ProcessDetail_v1.from_data(_numpy.frombuffer(buffer, dtype=process_detail_v1_dtype)) + + @staticmethod + def from_data(data): + """Create an ProcessDetail_v1 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a 1D array of dtype `process_detail_v1_dtype` holding the data. + """ + cdef ProcessDetail_v1 obj = ProcessDetail_v1.__new__(ProcessDetail_v1) + if not isinstance(data, _numpy.ndarray): + raise TypeError("data argument must be a NumPy ndarray") + if data.ndim != 1: + raise ValueError("data array must be 1D") + if data.dtype != process_detail_v1_dtype: + raise ValueError("data array must be of dtype process_detail_v1_dtype") + obj._data = data.view(_numpy.recarray) + + return obj + + @staticmethod + def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False): + """Create an ProcessDetail_v1 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + size (int): number of structs, default=1. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef ProcessDetail_v1 obj = ProcessDetail_v1.__new__(ProcessDetail_v1) + cdef flag = _cyb_cpython_buffer.PyBUF_READ if readonly else _cyb_cpython_buffer.PyBUF_WRITE + cdef object buf = _cyb_cpython_memoryview.PyMemoryView_FromMemory( + ptr, sizeof(nvmlProcessDetail_v1_t) * size, flag) + data = _numpy.ndarray(size, buffer=buf, dtype=process_detail_v1_dtype) + obj._data = data.view(_numpy.recarray) + + return obj + + +cdef _get_device_attributes_dtype_offsets(): + cdef nvmlDeviceAttributes_t pod + return _numpy.dtype({ + 'names': ['multiprocessor_count', 'shared_copy_engine_count', 'shared_decoder_count', 'shared_encoder_count', 'shared_jpeg_count', 'shared_ofa_count', 'gpu_instance_slice_count', 'compute_instance_slice_count', 'memory_size_mb'], + 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint64], + 'offsets': [ + (&(pod.multiprocessorCount)) - (&pod), + (&(pod.sharedCopyEngineCount)) - (&pod), + (&(pod.sharedDecoderCount)) - (&pod), + (&(pod.sharedEncoderCount)) - (&pod), + (&(pod.sharedJpegCount)) - (&pod), + (&(pod.sharedOfaCount)) - (&pod), + (&(pod.gpuInstanceSliceCount)) - (&pod), + (&(pod.computeInstanceSliceCount)) - (&pod), + (&(pod.memorySizeMB)) - (&pod), + ], + 'itemsize': sizeof(nvmlDeviceAttributes_t), + }) + +device_attributes_dtype = _get_device_attributes_dtype_offsets() + +cdef class DeviceAttributes: + """Empty-initialize an instance of `nvmlDeviceAttributes_t`. + + + .. seealso:: `nvmlDeviceAttributes_t` + """ + cdef: + nvmlDeviceAttributes_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlDeviceAttributes_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating DeviceAttributes") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlDeviceAttributes_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.DeviceAttributes object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef DeviceAttributes other_ + if not isinstance(other, DeviceAttributes): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlDeviceAttributes_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlDeviceAttributes_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlDeviceAttributes_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating DeviceAttributes") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlDeviceAttributes_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def multiprocessor_count(self): + """int: """ + return self._ptr[0].multiprocessorCount + + @multiprocessor_count.setter + def multiprocessor_count(self, val): + if self._readonly: + raise ValueError("This DeviceAttributes instance is read-only") + self._ptr[0].multiprocessorCount = val + + @property + def shared_copy_engine_count(self): + """int: """ + return self._ptr[0].sharedCopyEngineCount + + @shared_copy_engine_count.setter + def shared_copy_engine_count(self, val): + if self._readonly: + raise ValueError("This DeviceAttributes instance is read-only") + self._ptr[0].sharedCopyEngineCount = val + + @property + def shared_decoder_count(self): + """int: """ + return self._ptr[0].sharedDecoderCount + + @shared_decoder_count.setter + def shared_decoder_count(self, val): + if self._readonly: + raise ValueError("This DeviceAttributes instance is read-only") + self._ptr[0].sharedDecoderCount = val + + @property + def shared_encoder_count(self): + """int: """ + return self._ptr[0].sharedEncoderCount + + @shared_encoder_count.setter + def shared_encoder_count(self, val): + if self._readonly: + raise ValueError("This DeviceAttributes instance is read-only") + self._ptr[0].sharedEncoderCount = val + + @property + def shared_jpeg_count(self): + """int: """ + return self._ptr[0].sharedJpegCount + + @shared_jpeg_count.setter + def shared_jpeg_count(self, val): + if self._readonly: + raise ValueError("This DeviceAttributes instance is read-only") + self._ptr[0].sharedJpegCount = val + + @property + def shared_ofa_count(self): + """int: """ + return self._ptr[0].sharedOfaCount + + @shared_ofa_count.setter + def shared_ofa_count(self, val): + if self._readonly: + raise ValueError("This DeviceAttributes instance is read-only") + self._ptr[0].sharedOfaCount = val + + @property + def gpu_instance_slice_count(self): + """int: """ + return self._ptr[0].gpuInstanceSliceCount + + @gpu_instance_slice_count.setter + def gpu_instance_slice_count(self, val): + if self._readonly: + raise ValueError("This DeviceAttributes instance is read-only") + self._ptr[0].gpuInstanceSliceCount = val + + @property + def compute_instance_slice_count(self): + """int: """ + return self._ptr[0].computeInstanceSliceCount + + @compute_instance_slice_count.setter + def compute_instance_slice_count(self, val): + if self._readonly: + raise ValueError("This DeviceAttributes instance is read-only") + self._ptr[0].computeInstanceSliceCount = val + + @property + def memory_size_mb(self): + """int: """ + return self._ptr[0].memorySizeMB + + @memory_size_mb.setter + def memory_size_mb(self, val): + if self._readonly: + raise ValueError("This DeviceAttributes instance is read-only") + self._ptr[0].memorySizeMB = val + + @staticmethod + def from_buffer(buffer): + """Create an DeviceAttributes instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlDeviceAttributes_t), DeviceAttributes) + + @staticmethod + def from_data(data): + """Create an DeviceAttributes instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `device_attributes_dtype` holding the data. + """ + return _cyb_from_data(data, "device_attributes_dtype", device_attributes_dtype, DeviceAttributes) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an DeviceAttributes instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef DeviceAttributes obj = DeviceAttributes.__new__(DeviceAttributes) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlDeviceAttributes_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating DeviceAttributes") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlDeviceAttributes_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_c2c_mode_info_v1_dtype_offsets(): + cdef nvmlC2cModeInfo_v1_t pod + return _numpy.dtype({ + 'names': ['is_c2c_enabled'], + 'formats': [_numpy.uint32], + 'offsets': [ + (&(pod.isC2cEnabled)) - (&pod), + ], + 'itemsize': sizeof(nvmlC2cModeInfo_v1_t), + }) + +c2c_mode_info_v1_dtype = _get_c2c_mode_info_v1_dtype_offsets() + +cdef class C2cModeInfo_v1: + """Empty-initialize an instance of `nvmlC2cModeInfo_v1_t`. + + + .. seealso:: `nvmlC2cModeInfo_v1_t` + """ + cdef: + nvmlC2cModeInfo_v1_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlC2cModeInfo_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating C2cModeInfo_v1") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlC2cModeInfo_v1_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.C2cModeInfo_v1 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef C2cModeInfo_v1 other_ + if not isinstance(other, C2cModeInfo_v1): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlC2cModeInfo_v1_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlC2cModeInfo_v1_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlC2cModeInfo_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating C2cModeInfo_v1") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlC2cModeInfo_v1_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def is_c2c_enabled(self): + """int: """ + return self._ptr[0].isC2cEnabled + + @is_c2c_enabled.setter + def is_c2c_enabled(self, val): + if self._readonly: + raise ValueError("This C2cModeInfo_v1 instance is read-only") + self._ptr[0].isC2cEnabled = val + + @staticmethod + def from_buffer(buffer): + """Create an C2cModeInfo_v1 instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlC2cModeInfo_v1_t), C2cModeInfo_v1) + + @staticmethod + def from_data(data): + """Create an C2cModeInfo_v1 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `c2c_mode_info_v1_dtype` holding the data. + """ + return _cyb_from_data(data, "c2c_mode_info_v1_dtype", c2c_mode_info_v1_dtype, C2cModeInfo_v1) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an C2cModeInfo_v1 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef C2cModeInfo_v1 obj = C2cModeInfo_v1.__new__(C2cModeInfo_v1) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlC2cModeInfo_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating C2cModeInfo_v1") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlC2cModeInfo_v1_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_row_remapper_histogram_values_dtype_offsets(): + cdef nvmlRowRemapperHistogramValues_t pod + return _numpy.dtype({ + 'names': ['max_', 'high', 'partial', 'low', 'none'], + 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32], + 'offsets': [ + (&(pod.max)) - (&pod), + (&(pod.high)) - (&pod), + (&(pod.partial)) - (&pod), + (&(pod.low)) - (&pod), + (&(pod.none)) - (&pod), + ], + 'itemsize': sizeof(nvmlRowRemapperHistogramValues_t), + }) + +row_remapper_histogram_values_dtype = _get_row_remapper_histogram_values_dtype_offsets() + +cdef class RowRemapperHistogramValues: + """Empty-initialize an instance of `nvmlRowRemapperHistogramValues_t`. + + + .. seealso:: `nvmlRowRemapperHistogramValues_t` + """ + cdef: + nvmlRowRemapperHistogramValues_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlRowRemapperHistogramValues_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating RowRemapperHistogramValues") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlRowRemapperHistogramValues_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.RowRemapperHistogramValues object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef RowRemapperHistogramValues other_ + if not isinstance(other, RowRemapperHistogramValues): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlRowRemapperHistogramValues_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlRowRemapperHistogramValues_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlRowRemapperHistogramValues_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating RowRemapperHistogramValues") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlRowRemapperHistogramValues_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def max_(self): + """int: """ + return self._ptr[0].max + + @max_.setter + def max_(self, val): + if self._readonly: + raise ValueError("This RowRemapperHistogramValues instance is read-only") + self._ptr[0].max = val + + @property + def high(self): + """int: """ + return self._ptr[0].high + + @high.setter + def high(self, val): + if self._readonly: + raise ValueError("This RowRemapperHistogramValues instance is read-only") + self._ptr[0].high = val + + @property + def partial(self): + """int: """ + return self._ptr[0].partial + + @partial.setter + def partial(self, val): + if self._readonly: + raise ValueError("This RowRemapperHistogramValues instance is read-only") + self._ptr[0].partial = val + + @property + def low(self): + """int: """ + return self._ptr[0].low + + @low.setter + def low(self, val): + if self._readonly: + raise ValueError("This RowRemapperHistogramValues instance is read-only") + self._ptr[0].low = val + + @property + def none(self): + """int: """ + return self._ptr[0].none + + @none.setter + def none(self, val): + if self._readonly: + raise ValueError("This RowRemapperHistogramValues instance is read-only") + self._ptr[0].none = val + + @staticmethod + def from_buffer(buffer): + """Create an RowRemapperHistogramValues instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlRowRemapperHistogramValues_t), RowRemapperHistogramValues) + + @staticmethod + def from_data(data): + """Create an RowRemapperHistogramValues instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `row_remapper_histogram_values_dtype` holding the data. + """ + return _cyb_from_data(data, "row_remapper_histogram_values_dtype", row_remapper_histogram_values_dtype, RowRemapperHistogramValues) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an RowRemapperHistogramValues instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef RowRemapperHistogramValues obj = RowRemapperHistogramValues.__new__(RowRemapperHistogramValues) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlRowRemapperHistogramValues_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating RowRemapperHistogramValues") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlRowRemapperHistogramValues_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_bridge_chip_info_dtype_offsets(): + cdef nvmlBridgeChipInfo_t pod + return _numpy.dtype({ + 'names': ['type', 'fw_version'], + 'formats': [_numpy.int32, _numpy.uint32], + 'offsets': [ + (&(pod.type)) - (&pod), + (&(pod.fwVersion)) - (&pod), + ], + 'itemsize': sizeof(nvmlBridgeChipInfo_t), + }) + +bridge_chip_info_dtype = _get_bridge_chip_info_dtype_offsets() + +cdef class BridgeChipInfo: + """Empty-initialize an array of `nvmlBridgeChipInfo_t`. + The resulting object is of length `size` and of dtype `bridge_chip_info_dtype`. + If default-constructed, the instance represents a single struct. + + Args: + size (int): number of structs, default=1. + + .. seealso:: `nvmlBridgeChipInfo_t` + """ + cdef: + readonly object _data + + def __init__(self, size=1): + arr = _numpy.empty(size, dtype=bridge_chip_info_dtype) + self._data = arr.view(_numpy.recarray) + assert self._data.itemsize == sizeof(nvmlBridgeChipInfo_t), \ + f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlBridgeChipInfo_t) }" + + def __repr__(self): + if self._data.size > 1: + return f"<{__name__}.BridgeChipInfo_Array_{self._data.size} object at {hex(id(self))}>" + else: + return f"<{__name__}.BridgeChipInfo object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return self._data.ctypes.data + + cdef intptr_t _get_ptr(self): + return self._data.ctypes.data + + def __int__(self): + if self._data.size > 1: + raise TypeError("int() argument must be a bytes-like object of size 1. " + "To get the pointer address of an array, use .ptr") + return self._data.ctypes.data + + def __len__(self): + return self._data.size + + def __eq__(self, other): + cdef object self_data = self._data + if (not isinstance(other, BridgeChipInfo)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype: + return False + return bool((self_data == other._data).all()) + + def __getbuffer__(self, Py_buffer *buffer, int flags): + _cyb_cpython.PyObject_GetBuffer(self._data, buffer, flags) + + def __releasebuffer__(self, Py_buffer *buffer): + _cyb_cpython.PyBuffer_Release(buffer) + + @property + def type(self): + """Union[~_numpy.int32, int]: """ + if self._data.size == 1: + return int(self._data.type[0]) + return self._data.type + + @type.setter + def type(self, val): + self._data.type = val + + @property + def fw_version(self): + """Union[~_numpy.uint32, int]: """ + if self._data.size == 1: + return int(self._data.fw_version[0]) + return self._data.fw_version + + @fw_version.setter + def fw_version(self, val): + self._data.fw_version = val + + def __getitem__(self, key): + cdef ssize_t key_ + cdef ssize_t size + if isinstance(key, int): + key_ = key + size = self._data.size + if key_ >= size or key_ <= -(size+1): + raise IndexError("index is out of bounds") + if key_ < 0: + key_ += size + return BridgeChipInfo.from_data(self._data[key_:key_+1]) + out = self._data[key] + if isinstance(out, _numpy.recarray) and out.dtype == bridge_chip_info_dtype: + return BridgeChipInfo.from_data(out) + return out + + def __setitem__(self, key, val): + self._data[key] = val + + @staticmethod + def from_buffer(buffer): + """Create an BridgeChipInfo instance with the memory from the given buffer.""" + return BridgeChipInfo.from_data(_numpy.frombuffer(buffer, dtype=bridge_chip_info_dtype)) + + @staticmethod + def from_data(data): + """Create an BridgeChipInfo instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a 1D array of dtype `bridge_chip_info_dtype` holding the data. + """ + cdef BridgeChipInfo obj = BridgeChipInfo.__new__(BridgeChipInfo) + if not isinstance(data, _numpy.ndarray): + raise TypeError("data argument must be a NumPy ndarray") + if data.ndim != 1: + raise ValueError("data array must be 1D") + if data.dtype != bridge_chip_info_dtype: + raise ValueError("data array must be of dtype bridge_chip_info_dtype") + obj._data = data.view(_numpy.recarray) + + return obj + + @staticmethod + def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False): + """Create an BridgeChipInfo instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + size (int): number of structs, default=1. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef BridgeChipInfo obj = BridgeChipInfo.__new__(BridgeChipInfo) + cdef flag = _cyb_cpython_buffer.PyBUF_READ if readonly else _cyb_cpython_buffer.PyBUF_WRITE + cdef object buf = _cyb_cpython_memoryview.PyMemoryView_FromMemory( + ptr, sizeof(nvmlBridgeChipInfo_t) * size, flag) + data = _numpy.ndarray(size, buffer=buf, dtype=bridge_chip_info_dtype) + obj._data = data.view(_numpy.recarray) + + return obj + + +value_dtype = _numpy.dtype(( + _numpy.dtype((_numpy.void, sizeof(nvmlValue_t))), + { + "d_val": (_numpy.float64, 0), + "si_val": (_numpy.int32, 0), + "ui_val": (_numpy.uint32, 0), + "ul_val": (_numpy.uint32, 0), + "ull_val": (_numpy.uint64, 0), + "sll_val": (_numpy.int64, 0), + "us_val": (_numpy.uint16, 0), + } + )) + +cdef class Value: + """Empty-initialize an instance of `nvmlValue_t`. + + + .. seealso:: `nvmlValue_t` + """ + cdef: + nvmlValue_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlValue_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating Value") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlValue_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.Value object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef Value other_ + if not isinstance(other, Value): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlValue_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlValue_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlValue_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating Value") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlValue_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def d_val(self): + """float: """ + return self._ptr[0].dVal + + @d_val.setter + def d_val(self, val): + if self._readonly: + raise ValueError("This Value instance is read-only") + self._ptr[0].dVal = val + + @property + def si_val(self): + """int: """ + return self._ptr[0].siVal + + @si_val.setter + def si_val(self, val): + if self._readonly: + raise ValueError("This Value instance is read-only") + self._ptr[0].siVal = val + + @property + def ui_val(self): + """int: """ + return self._ptr[0].uiVal + + @ui_val.setter + def ui_val(self, val): + if self._readonly: + raise ValueError("This Value instance is read-only") + self._ptr[0].uiVal = val + + @property + def ul_val(self): + """int: """ + return self._ptr[0].ulVal + + @ul_val.setter + def ul_val(self, val): + if self._readonly: + raise ValueError("This Value instance is read-only") + self._ptr[0].ulVal = val + + @property + def ull_val(self): + """int: """ + return self._ptr[0].ullVal + + @ull_val.setter + def ull_val(self, val): + if self._readonly: + raise ValueError("This Value instance is read-only") + self._ptr[0].ullVal = val + + @property + def sll_val(self): + """int: """ + return self._ptr[0].sllVal + + @sll_val.setter + def sll_val(self, val): + if self._readonly: + raise ValueError("This Value instance is read-only") + self._ptr[0].sllVal = val + + @property + def us_val(self): + """int: """ + return self._ptr[0].usVal + + @us_val.setter + def us_val(self, val): + if self._readonly: + raise ValueError("This Value instance is read-only") + self._ptr[0].usVal = val + + @staticmethod + def from_buffer(buffer): + """Create an Value instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlValue_t), Value) + + @staticmethod + def from_data(data): + """Create an Value instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `value_dtype` holding the data. + """ + return _cyb_from_data(data, "value_dtype", value_dtype, Value) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an Value instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef Value obj = Value.__new__(Value) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlValue_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating Value") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlValue_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get__py_anon_pod0_dtype_offsets(): + cdef cuda_bindings_nvml__anon_pod0 pod + return _numpy.dtype({ + 'names': ['controller', 'default_min_temp', 'default_max_temp', 'current_temp', 'target'], + 'formats': [_numpy.int32, _numpy.int32, _numpy.int32, _numpy.int32, _numpy.int32], + 'offsets': [ + (&(pod.controller)) - (&pod), + (&(pod.defaultMinTemp)) - (&pod), + (&(pod.defaultMaxTemp)) - (&pod), + (&(pod.currentTemp)) - (&pod), + (&(pod.target)) - (&pod), + ], + 'itemsize': sizeof(cuda_bindings_nvml__anon_pod0), + }) + +_py_anon_pod0_dtype = _get__py_anon_pod0_dtype_offsets() + +cdef class _py_anon_pod0: + """Empty-initialize an instance of `cuda_bindings_nvml__anon_pod0`. + + + .. seealso:: `cuda_bindings_nvml__anon_pod0` + """ + cdef: + cuda_bindings_nvml__anon_pod0 *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(cuda_bindings_nvml__anon_pod0)) + if self._ptr == NULL: + raise MemoryError("Error allocating _py_anon_pod0") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef cuda_bindings_nvml__anon_pod0 *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}._py_anon_pod0 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef _py_anon_pod0 other_ + if not isinstance(other, _py_anon_pod0): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(cuda_bindings_nvml__anon_pod0)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(cuda_bindings_nvml__anon_pod0), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(cuda_bindings_nvml__anon_pod0)) + if self._ptr == NULL: + raise MemoryError("Error allocating _py_anon_pod0") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(cuda_bindings_nvml__anon_pod0)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def controller(self): + """int: """ + return (self._ptr[0].controller) + + @controller.setter + def controller(self, val): + if self._readonly: + raise ValueError("This _py_anon_pod0 instance is read-only") + self._ptr[0].controller = val + + @property + def default_min_temp(self): + """int: """ + return self._ptr[0].defaultMinTemp + + @default_min_temp.setter + def default_min_temp(self, val): + if self._readonly: + raise ValueError("This _py_anon_pod0 instance is read-only") + self._ptr[0].defaultMinTemp = val + + @property + def default_max_temp(self): + """int: """ + return self._ptr[0].defaultMaxTemp + + @default_max_temp.setter + def default_max_temp(self, val): + if self._readonly: + raise ValueError("This _py_anon_pod0 instance is read-only") + self._ptr[0].defaultMaxTemp = val + + @property + def current_temp(self): + """int: """ + return self._ptr[0].currentTemp + + @current_temp.setter + def current_temp(self, val): + if self._readonly: + raise ValueError("This _py_anon_pod0 instance is read-only") + self._ptr[0].currentTemp = val + + @property + def target(self): + """int: """ + return (self._ptr[0].target) + + @target.setter + def target(self, val): + if self._readonly: + raise ValueError("This _py_anon_pod0 instance is read-only") + self._ptr[0].target = val + + @staticmethod + def from_buffer(buffer): + """Create an _py_anon_pod0 instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(cuda_bindings_nvml__anon_pod0), _py_anon_pod0) + + @staticmethod + def from_data(data): + """Create an _py_anon_pod0 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `_py_anon_pod0_dtype` holding the data. + """ + return _cyb_from_data(data, "_py_anon_pod0_dtype", _py_anon_pod0_dtype, _py_anon_pod0) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an _py_anon_pod0 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef _py_anon_pod0 obj = _py_anon_pod0.__new__(_py_anon_pod0) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(cuda_bindings_nvml__anon_pod0)) + if obj._ptr == NULL: + raise MemoryError("Error allocating _py_anon_pod0") + _cyb_memcpy((obj._ptr), ptr, sizeof(cuda_bindings_nvml__anon_pod0)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_cooler_info_v1_dtype_offsets(): + cdef nvmlCoolerInfo_v1_t pod + return _numpy.dtype({ + 'names': ['version', 'index', 'signal_type', 'target'], + 'formats': [_numpy.uint32, _numpy.uint32, _numpy.int32, _numpy.int32], + 'offsets': [ + (&(pod.version)) - (&pod), + (&(pod.index)) - (&pod), + (&(pod.signalType)) - (&pod), + (&(pod.target)) - (&pod), + ], + 'itemsize': sizeof(nvmlCoolerInfo_v1_t), + }) + +cooler_info_v1_dtype = _get_cooler_info_v1_dtype_offsets() + +cdef class CoolerInfo_v1: + """Empty-initialize an instance of `nvmlCoolerInfo_v1_t`. + + + .. seealso:: `nvmlCoolerInfo_v1_t` + """ + cdef: + nvmlCoolerInfo_v1_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlCoolerInfo_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating CoolerInfo_v1") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlCoolerInfo_v1_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.CoolerInfo_v1 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef CoolerInfo_v1 other_ + if not isinstance(other, CoolerInfo_v1): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlCoolerInfo_v1_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlCoolerInfo_v1_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlCoolerInfo_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating CoolerInfo_v1") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlCoolerInfo_v1_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def version(self): + """int: the API version number""" + return self._ptr[0].version + + @version.setter + def version(self, val): + if self._readonly: + raise ValueError("This CoolerInfo_v1 instance is read-only") + self._ptr[0].version = val + + @property + def index(self): + """int: the cooler index""" + return self._ptr[0].index + + @index.setter + def index(self, val): + if self._readonly: + raise ValueError("This CoolerInfo_v1 instance is read-only") + self._ptr[0].index = val + + @property + def signal_type(self): + """int: OUT: the cooler's control signal characteristics.""" + return (self._ptr[0].signalType) + + @signal_type.setter + def signal_type(self, val): + if self._readonly: + raise ValueError("This CoolerInfo_v1 instance is read-only") + self._ptr[0].signalType = val + + @property + def target(self): + """int: OUT: the target that cooler cools.""" + return (self._ptr[0].target) + + @target.setter + def target(self, val): + if self._readonly: + raise ValueError("This CoolerInfo_v1 instance is read-only") + self._ptr[0].target = val + + @staticmethod + def from_buffer(buffer): + """Create an CoolerInfo_v1 instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlCoolerInfo_v1_t), CoolerInfo_v1) + + @staticmethod + def from_data(data): + """Create an CoolerInfo_v1 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `cooler_info_v1_dtype` holding the data. + """ + return _cyb_from_data(data, "cooler_info_v1_dtype", cooler_info_v1_dtype, CoolerInfo_v1) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an CoolerInfo_v1 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef CoolerInfo_v1 obj = CoolerInfo_v1.__new__(CoolerInfo_v1) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlCoolerInfo_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating CoolerInfo_v1") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlCoolerInfo_v1_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_clk_mon_fault_info_dtype_offsets(): + cdef nvmlClkMonFaultInfo_t pod + return _numpy.dtype({ + 'names': ['clk_api_domain', 'clk_domain_fault_mask'], + 'formats': [_numpy.uint32, _numpy.uint32], + 'offsets': [ + (&(pod.clkApiDomain)) - (&pod), + (&(pod.clkDomainFaultMask)) - (&pod), + ], + 'itemsize': sizeof(nvmlClkMonFaultInfo_t), + }) + +clk_mon_fault_info_dtype = _get_clk_mon_fault_info_dtype_offsets() + +cdef class ClkMonFaultInfo: + """Empty-initialize an array of `nvmlClkMonFaultInfo_t`. + The resulting object is of length `size` and of dtype `clk_mon_fault_info_dtype`. + If default-constructed, the instance represents a single struct. + + Args: + size (int): number of structs, default=1. + + .. seealso:: `nvmlClkMonFaultInfo_t` + """ + cdef: + readonly object _data + + def __init__(self, size=1): + arr = _numpy.empty(size, dtype=clk_mon_fault_info_dtype) + self._data = arr.view(_numpy.recarray) + assert self._data.itemsize == sizeof(nvmlClkMonFaultInfo_t), \ + f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlClkMonFaultInfo_t) }" + + def __repr__(self): + if self._data.size > 1: + return f"<{__name__}.ClkMonFaultInfo_Array_{self._data.size} object at {hex(id(self))}>" + else: + return f"<{__name__}.ClkMonFaultInfo object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return self._data.ctypes.data + + cdef intptr_t _get_ptr(self): + return self._data.ctypes.data + + def __int__(self): + if self._data.size > 1: + raise TypeError("int() argument must be a bytes-like object of size 1. " + "To get the pointer address of an array, use .ptr") + return self._data.ctypes.data + + def __len__(self): + return self._data.size + + def __eq__(self, other): + cdef object self_data = self._data + if (not isinstance(other, ClkMonFaultInfo)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype: + return False + return bool((self_data == other._data).all()) + + def __getbuffer__(self, Py_buffer *buffer, int flags): + _cyb_cpython.PyObject_GetBuffer(self._data, buffer, flags) + + def __releasebuffer__(self, Py_buffer *buffer): + _cyb_cpython.PyBuffer_Release(buffer) + + @property + def clk_api_domain(self): + """Union[~_numpy.uint32, int]: """ + if self._data.size == 1: + return int(self._data.clk_api_domain[0]) + return self._data.clk_api_domain + + @clk_api_domain.setter + def clk_api_domain(self, val): + self._data.clk_api_domain = val + + @property + def clk_domain_fault_mask(self): + """Union[~_numpy.uint32, int]: """ + if self._data.size == 1: + return int(self._data.clk_domain_fault_mask[0]) + return self._data.clk_domain_fault_mask + + @clk_domain_fault_mask.setter + def clk_domain_fault_mask(self, val): + self._data.clk_domain_fault_mask = val + + def __getitem__(self, key): + cdef ssize_t key_ + cdef ssize_t size + if isinstance(key, int): + key_ = key + size = self._data.size + if key_ >= size or key_ <= -(size+1): + raise IndexError("index is out of bounds") + if key_ < 0: + key_ += size + return ClkMonFaultInfo.from_data(self._data[key_:key_+1]) + out = self._data[key] + if isinstance(out, _numpy.recarray) and out.dtype == clk_mon_fault_info_dtype: + return ClkMonFaultInfo.from_data(out) + return out + + def __setitem__(self, key, val): + self._data[key] = val + + @staticmethod + def from_buffer(buffer): + """Create an ClkMonFaultInfo instance with the memory from the given buffer.""" + return ClkMonFaultInfo.from_data(_numpy.frombuffer(buffer, dtype=clk_mon_fault_info_dtype)) + + @staticmethod + def from_data(data): + """Create an ClkMonFaultInfo instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a 1D array of dtype `clk_mon_fault_info_dtype` holding the data. + """ + cdef ClkMonFaultInfo obj = ClkMonFaultInfo.__new__(ClkMonFaultInfo) + if not isinstance(data, _numpy.ndarray): + raise TypeError("data argument must be a NumPy ndarray") + if data.ndim != 1: + raise ValueError("data array must be 1D") + if data.dtype != clk_mon_fault_info_dtype: + raise ValueError("data array must be of dtype clk_mon_fault_info_dtype") + obj._data = data.view(_numpy.recarray) + + return obj + + @staticmethod + def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False): + """Create an ClkMonFaultInfo instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + size (int): number of structs, default=1. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef ClkMonFaultInfo obj = ClkMonFaultInfo.__new__(ClkMonFaultInfo) + cdef flag = _cyb_cpython_buffer.PyBUF_READ if readonly else _cyb_cpython_buffer.PyBUF_WRITE + cdef object buf = _cyb_cpython_memoryview.PyMemoryView_FromMemory( + ptr, sizeof(nvmlClkMonFaultInfo_t) * size, flag) + data = _numpy.ndarray(size, buffer=buf, dtype=clk_mon_fault_info_dtype) + obj._data = data.view(_numpy.recarray) + + return obj + + +cdef _get_clock_offset_v1_dtype_offsets(): + cdef nvmlClockOffset_v1_t pod + return _numpy.dtype({ + 'names': ['version', 'type', 'pstate', 'clock_offset_m_hz', 'min_clock_offset_m_hz', 'max_clock_offset_m_hz'], + 'formats': [_numpy.uint32, _numpy.int32, _numpy.int32, _numpy.int32, _numpy.int32, _numpy.int32], + 'offsets': [ + (&(pod.version)) - (&pod), + (&(pod.type)) - (&pod), + (&(pod.pstate)) - (&pod), + (&(pod.clockOffsetMHz)) - (&pod), + (&(pod.minClockOffsetMHz)) - (&pod), + (&(pod.maxClockOffsetMHz)) - (&pod), + ], + 'itemsize': sizeof(nvmlClockOffset_v1_t), + }) + +clock_offset_v1_dtype = _get_clock_offset_v1_dtype_offsets() + +cdef class ClockOffset_v1: + """Empty-initialize an instance of `nvmlClockOffset_v1_t`. + + + .. seealso:: `nvmlClockOffset_v1_t` + """ + cdef: + nvmlClockOffset_v1_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlClockOffset_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ClockOffset_v1") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlClockOffset_v1_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.ClockOffset_v1 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef ClockOffset_v1 other_ + if not isinstance(other, ClockOffset_v1): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlClockOffset_v1_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlClockOffset_v1_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlClockOffset_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ClockOffset_v1") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlClockOffset_v1_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def version(self): + """int: The version number of this struct.""" + return self._ptr[0].version + + @version.setter + def version(self, val): + if self._readonly: + raise ValueError("This ClockOffset_v1 instance is read-only") + self._ptr[0].version = val + + @property + def type(self): + """int: """ + return (self._ptr[0].type) + + @type.setter + def type(self, val): + if self._readonly: + raise ValueError("This ClockOffset_v1 instance is read-only") + self._ptr[0].type = val + + @property + def pstate(self): + """int: """ + return (self._ptr[0].pstate) + + @pstate.setter + def pstate(self, val): + if self._readonly: + raise ValueError("This ClockOffset_v1 instance is read-only") + self._ptr[0].pstate = val + + @property + def clock_offset_m_hz(self): + """int: """ + return self._ptr[0].clockOffsetMHz + + @clock_offset_m_hz.setter + def clock_offset_m_hz(self, val): + if self._readonly: + raise ValueError("This ClockOffset_v1 instance is read-only") + self._ptr[0].clockOffsetMHz = val + + @property + def min_clock_offset_m_hz(self): + """int: """ + return self._ptr[0].minClockOffsetMHz + + @min_clock_offset_m_hz.setter + def min_clock_offset_m_hz(self, val): + if self._readonly: + raise ValueError("This ClockOffset_v1 instance is read-only") + self._ptr[0].minClockOffsetMHz = val + + @property + def max_clock_offset_m_hz(self): + """int: """ + return self._ptr[0].maxClockOffsetMHz + + @max_clock_offset_m_hz.setter + def max_clock_offset_m_hz(self, val): + if self._readonly: + raise ValueError("This ClockOffset_v1 instance is read-only") + self._ptr[0].maxClockOffsetMHz = val + + @staticmethod + def from_buffer(buffer): + """Create an ClockOffset_v1 instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlClockOffset_v1_t), ClockOffset_v1) + + @staticmethod + def from_data(data): + """Create an ClockOffset_v1 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `clock_offset_v1_dtype` holding the data. + """ + return _cyb_from_data(data, "clock_offset_v1_dtype", clock_offset_v1_dtype, ClockOffset_v1) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an ClockOffset_v1 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef ClockOffset_v1 obj = ClockOffset_v1.__new__(ClockOffset_v1) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlClockOffset_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating ClockOffset_v1") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlClockOffset_v1_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_process_utilization_sample_dtype_offsets(): + cdef nvmlProcessUtilizationSample_t pod + return _numpy.dtype({ + 'names': ['pid', 'time_stamp', 'sm_util', 'mem_util', 'enc_util', 'dec_util'], + 'formats': [_numpy.uint32, _numpy.uint64, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32], + 'offsets': [ + (&(pod.pid)) - (&pod), + (&(pod.timeStamp)) - (&pod), + (&(pod.smUtil)) - (&pod), + (&(pod.memUtil)) - (&pod), + (&(pod.encUtil)) - (&pod), + (&(pod.decUtil)) - (&pod), + ], + 'itemsize': sizeof(nvmlProcessUtilizationSample_t), + }) + +process_utilization_sample_dtype = _get_process_utilization_sample_dtype_offsets() + +cdef class ProcessUtilizationSample: + """Empty-initialize an array of `nvmlProcessUtilizationSample_t`. + The resulting object is of length `size` and of dtype `process_utilization_sample_dtype`. + If default-constructed, the instance represents a single struct. + + Args: + size (int): number of structs, default=1. + + .. seealso:: `nvmlProcessUtilizationSample_t` + """ + cdef: + readonly object _data + + def __init__(self, size=1): + arr = _numpy.empty(size, dtype=process_utilization_sample_dtype) + self._data = arr.view(_numpy.recarray) + assert self._data.itemsize == sizeof(nvmlProcessUtilizationSample_t), \ + f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlProcessUtilizationSample_t) }" + + def __repr__(self): + if self._data.size > 1: + return f"<{__name__}.ProcessUtilizationSample_Array_{self._data.size} object at {hex(id(self))}>" + else: + return f"<{__name__}.ProcessUtilizationSample object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return self._data.ctypes.data + + cdef intptr_t _get_ptr(self): + return self._data.ctypes.data + + def __int__(self): + if self._data.size > 1: + raise TypeError("int() argument must be a bytes-like object of size 1. " + "To get the pointer address of an array, use .ptr") + return self._data.ctypes.data + + def __len__(self): + return self._data.size + + def __eq__(self, other): + cdef object self_data = self._data + if (not isinstance(other, ProcessUtilizationSample)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype: + return False + return bool((self_data == other._data).all()) + + def __getbuffer__(self, Py_buffer *buffer, int flags): + _cyb_cpython.PyObject_GetBuffer(self._data, buffer, flags) + + def __releasebuffer__(self, Py_buffer *buffer): + _cyb_cpython.PyBuffer_Release(buffer) + + @property + def pid(self): + """Union[~_numpy.uint32, int]: """ + if self._data.size == 1: + return int(self._data.pid[0]) + return self._data.pid + + @pid.setter + def pid(self, val): + self._data.pid = val + + @property + def time_stamp(self): + """Union[~_numpy.uint64, int]: """ + if self._data.size == 1: + return int(self._data.time_stamp[0]) + return self._data.time_stamp + + @time_stamp.setter + def time_stamp(self, val): + self._data.time_stamp = val + + @property + def sm_util(self): + """Union[~_numpy.uint32, int]: """ + if self._data.size == 1: + return int(self._data.sm_util[0]) + return self._data.sm_util + + @sm_util.setter + def sm_util(self, val): + self._data.sm_util = val + + @property + def mem_util(self): + """Union[~_numpy.uint32, int]: """ + if self._data.size == 1: + return int(self._data.mem_util[0]) + return self._data.mem_util + + @mem_util.setter + def mem_util(self, val): + self._data.mem_util = val + + @property + def enc_util(self): + """Union[~_numpy.uint32, int]: """ + if self._data.size == 1: + return int(self._data.enc_util[0]) + return self._data.enc_util + + @enc_util.setter + def enc_util(self, val): + self._data.enc_util = val + + @property + def dec_util(self): + """Union[~_numpy.uint32, int]: """ + if self._data.size == 1: + return int(self._data.dec_util[0]) + return self._data.dec_util + + @dec_util.setter + def dec_util(self, val): + self._data.dec_util = val + + def __getitem__(self, key): + cdef ssize_t key_ + cdef ssize_t size + if isinstance(key, int): + key_ = key + size = self._data.size + if key_ >= size or key_ <= -(size+1): + raise IndexError("index is out of bounds") + if key_ < 0: + key_ += size + return ProcessUtilizationSample.from_data(self._data[key_:key_+1]) + out = self._data[key] + if isinstance(out, _numpy.recarray) and out.dtype == process_utilization_sample_dtype: + return ProcessUtilizationSample.from_data(out) + return out + + def __setitem__(self, key, val): + self._data[key] = val + + @staticmethod + def from_buffer(buffer): + """Create an ProcessUtilizationSample instance with the memory from the given buffer.""" + return ProcessUtilizationSample.from_data(_numpy.frombuffer(buffer, dtype=process_utilization_sample_dtype)) + + @staticmethod + def from_data(data): + """Create an ProcessUtilizationSample instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a 1D array of dtype `process_utilization_sample_dtype` holding the data. + """ + cdef ProcessUtilizationSample obj = ProcessUtilizationSample.__new__(ProcessUtilizationSample) + if not isinstance(data, _numpy.ndarray): + raise TypeError("data argument must be a NumPy ndarray") + if data.ndim != 1: + raise ValueError("data array must be 1D") + if data.dtype != process_utilization_sample_dtype: + raise ValueError("data array must be of dtype process_utilization_sample_dtype") + obj._data = data.view(_numpy.recarray) + + return obj + + @staticmethod + def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False): + """Create an ProcessUtilizationSample instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + size (int): number of structs, default=1. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef ProcessUtilizationSample obj = ProcessUtilizationSample.__new__(ProcessUtilizationSample) + cdef flag = _cyb_cpython_buffer.PyBUF_READ if readonly else _cyb_cpython_buffer.PyBUF_WRITE + cdef object buf = _cyb_cpython_memoryview.PyMemoryView_FromMemory( + ptr, sizeof(nvmlProcessUtilizationSample_t) * size, flag) + data = _numpy.ndarray(size, buffer=buf, dtype=process_utilization_sample_dtype) + obj._data = data.view(_numpy.recarray) + + return obj + + +cdef _get_process_utilization_info_v1_dtype_offsets(): + cdef nvmlProcessUtilizationInfo_v1_t pod + return _numpy.dtype({ + 'names': ['time_stamp', 'pid', 'sm_util', 'mem_util', 'enc_util', 'dec_util', 'jpg_util', 'ofa_util'], + 'formats': [_numpy.uint64, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32], + 'offsets': [ + (&(pod.timeStamp)) - (&pod), + (&(pod.pid)) - (&pod), + (&(pod.smUtil)) - (&pod), + (&(pod.memUtil)) - (&pod), + (&(pod.encUtil)) - (&pod), + (&(pod.decUtil)) - (&pod), + (&(pod.jpgUtil)) - (&pod), + (&(pod.ofaUtil)) - (&pod), + ], + 'itemsize': sizeof(nvmlProcessUtilizationInfo_v1_t), + }) + +process_utilization_info_v1_dtype = _get_process_utilization_info_v1_dtype_offsets() + +cdef class ProcessUtilizationInfo_v1: + """Empty-initialize an array of `nvmlProcessUtilizationInfo_v1_t`. + The resulting object is of length `size` and of dtype `process_utilization_info_v1_dtype`. + If default-constructed, the instance represents a single struct. + + Args: + size (int): number of structs, default=1. + + .. seealso:: `nvmlProcessUtilizationInfo_v1_t` + """ + cdef: + readonly object _data + + def __init__(self, size=1): + arr = _numpy.empty(size, dtype=process_utilization_info_v1_dtype) + self._data = arr.view(_numpy.recarray) + assert self._data.itemsize == sizeof(nvmlProcessUtilizationInfo_v1_t), \ + f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlProcessUtilizationInfo_v1_t) }" + + def __repr__(self): + if self._data.size > 1: + return f"<{__name__}.ProcessUtilizationInfo_v1_Array_{self._data.size} object at {hex(id(self))}>" + else: + return f"<{__name__}.ProcessUtilizationInfo_v1 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return self._data.ctypes.data + + cdef intptr_t _get_ptr(self): + return self._data.ctypes.data + + def __int__(self): + if self._data.size > 1: + raise TypeError("int() argument must be a bytes-like object of size 1. " + "To get the pointer address of an array, use .ptr") + return self._data.ctypes.data + + def __len__(self): + return self._data.size + + def __eq__(self, other): + cdef object self_data = self._data + if (not isinstance(other, ProcessUtilizationInfo_v1)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype: + return False + return bool((self_data == other._data).all()) + + def __getbuffer__(self, Py_buffer *buffer, int flags): + _cyb_cpython.PyObject_GetBuffer(self._data, buffer, flags) + + def __releasebuffer__(self, Py_buffer *buffer): + _cyb_cpython.PyBuffer_Release(buffer) + + @property + def time_stamp(self): + """Union[~_numpy.uint64, int]: CPU Timestamp in microseconds.""" + if self._data.size == 1: + return int(self._data.time_stamp[0]) + return self._data.time_stamp + + @time_stamp.setter + def time_stamp(self, val): + self._data.time_stamp = val + + @property + def pid(self): + """Union[~_numpy.uint32, int]: PID of process.""" + if self._data.size == 1: + return int(self._data.pid[0]) + return self._data.pid + + @pid.setter + def pid(self, val): + self._data.pid = val + + @property + def sm_util(self): + """Union[~_numpy.uint32, int]: SM (3D/Compute) Util Value.""" + if self._data.size == 1: + return int(self._data.sm_util[0]) + return self._data.sm_util + + @sm_util.setter + def sm_util(self, val): + self._data.sm_util = val + + @property + def mem_util(self): + """Union[~_numpy.uint32, int]: Frame Buffer Memory Util Value.""" + if self._data.size == 1: + return int(self._data.mem_util[0]) + return self._data.mem_util + + @mem_util.setter + def mem_util(self, val): + self._data.mem_util = val + + @property + def enc_util(self): + """Union[~_numpy.uint32, int]: Encoder Util Value.""" + if self._data.size == 1: + return int(self._data.enc_util[0]) + return self._data.enc_util + + @enc_util.setter + def enc_util(self, val): + self._data.enc_util = val + + @property + def dec_util(self): + """Union[~_numpy.uint32, int]: Decoder Util Value.""" + if self._data.size == 1: + return int(self._data.dec_util[0]) + return self._data.dec_util + + @dec_util.setter + def dec_util(self, val): + self._data.dec_util = val + + @property + def jpg_util(self): + """Union[~_numpy.uint32, int]: Jpeg Util Value.""" + if self._data.size == 1: + return int(self._data.jpg_util[0]) + return self._data.jpg_util + + @jpg_util.setter + def jpg_util(self, val): + self._data.jpg_util = val + + @property + def ofa_util(self): + """Union[~_numpy.uint32, int]: Ofa Util Value.""" + if self._data.size == 1: + return int(self._data.ofa_util[0]) + return self._data.ofa_util + + @ofa_util.setter + def ofa_util(self, val): + self._data.ofa_util = val + + def __getitem__(self, key): + cdef ssize_t key_ + cdef ssize_t size + if isinstance(key, int): + key_ = key + size = self._data.size + if key_ >= size or key_ <= -(size+1): + raise IndexError("index is out of bounds") + if key_ < 0: + key_ += size + return ProcessUtilizationInfo_v1.from_data(self._data[key_:key_+1]) + out = self._data[key] + if isinstance(out, _numpy.recarray) and out.dtype == process_utilization_info_v1_dtype: + return ProcessUtilizationInfo_v1.from_data(out) + return out + + def __setitem__(self, key, val): + self._data[key] = val + + @staticmethod + def from_buffer(buffer): + """Create an ProcessUtilizationInfo_v1 instance with the memory from the given buffer.""" + return ProcessUtilizationInfo_v1.from_data(_numpy.frombuffer(buffer, dtype=process_utilization_info_v1_dtype)) + + @staticmethod + def from_data(data): + """Create an ProcessUtilizationInfo_v1 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a 1D array of dtype `process_utilization_info_v1_dtype` holding the data. + """ + cdef ProcessUtilizationInfo_v1 obj = ProcessUtilizationInfo_v1.__new__(ProcessUtilizationInfo_v1) + if not isinstance(data, _numpy.ndarray): + raise TypeError("data argument must be a NumPy ndarray") + if data.ndim != 1: + raise ValueError("data array must be 1D") + if data.dtype != process_utilization_info_v1_dtype: + raise ValueError("data array must be of dtype process_utilization_info_v1_dtype") + obj._data = data.view(_numpy.recarray) + + return obj + + @staticmethod + def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False): + """Create an ProcessUtilizationInfo_v1 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + size (int): number of structs, default=1. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef ProcessUtilizationInfo_v1 obj = ProcessUtilizationInfo_v1.__new__(ProcessUtilizationInfo_v1) + cdef flag = _cyb_cpython_buffer.PyBUF_READ if readonly else _cyb_cpython_buffer.PyBUF_WRITE + cdef object buf = _cyb_cpython_memoryview.PyMemoryView_FromMemory( + ptr, sizeof(nvmlProcessUtilizationInfo_v1_t) * size, flag) + data = _numpy.ndarray(size, buffer=buf, dtype=process_utilization_info_v1_dtype) + obj._data = data.view(_numpy.recarray) + + return obj + + +cdef _get_ecc_sram_error_status_v1_dtype_offsets(): + cdef nvmlEccSramErrorStatus_v1_t pod + return _numpy.dtype({ + 'names': ['version', 'aggregate_unc_parity', 'aggregate_unc_sec_ded', 'aggregate_cor', 'volatile_unc_parity', 'volatile_unc_sec_ded', 'volatile_cor', 'aggregate_unc_bucket_l2', 'aggregate_unc_bucket_sm', 'aggregate_unc_bucket_pcie', 'aggregate_unc_bucket_mcu', 'aggregate_unc_bucket_other', 'b_threshold_exceeded'], + 'formats': [_numpy.uint32, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint32], + 'offsets': [ + (&(pod.version)) - (&pod), + (&(pod.aggregateUncParity)) - (&pod), + (&(pod.aggregateUncSecDed)) - (&pod), + (&(pod.aggregateCor)) - (&pod), + (&(pod.volatileUncParity)) - (&pod), + (&(pod.volatileUncSecDed)) - (&pod), + (&(pod.volatileCor)) - (&pod), + (&(pod.aggregateUncBucketL2)) - (&pod), + (&(pod.aggregateUncBucketSm)) - (&pod), + (&(pod.aggregateUncBucketPcie)) - (&pod), + (&(pod.aggregateUncBucketMcu)) - (&pod), + (&(pod.aggregateUncBucketOther)) - (&pod), + (&(pod.bThresholdExceeded)) - (&pod), + ], + 'itemsize': sizeof(nvmlEccSramErrorStatus_v1_t), + }) + +ecc_sram_error_status_v1_dtype = _get_ecc_sram_error_status_v1_dtype_offsets() + +cdef class EccSramErrorStatus_v1: + """Empty-initialize an instance of `nvmlEccSramErrorStatus_v1_t`. + + + .. seealso:: `nvmlEccSramErrorStatus_v1_t` + """ + cdef: + nvmlEccSramErrorStatus_v1_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlEccSramErrorStatus_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating EccSramErrorStatus_v1") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlEccSramErrorStatus_v1_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.EccSramErrorStatus_v1 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef EccSramErrorStatus_v1 other_ + if not isinstance(other, EccSramErrorStatus_v1): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlEccSramErrorStatus_v1_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlEccSramErrorStatus_v1_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlEccSramErrorStatus_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating EccSramErrorStatus_v1") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlEccSramErrorStatus_v1_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def version(self): + """int: the API version number""" + return self._ptr[0].version + + @version.setter + def version(self, val): + if self._readonly: + raise ValueError("This EccSramErrorStatus_v1 instance is read-only") + self._ptr[0].version = val + + @property + def aggregate_unc_parity(self): + """int: aggregate uncorrectable parity error count""" + return self._ptr[0].aggregateUncParity + + @aggregate_unc_parity.setter + def aggregate_unc_parity(self, val): + if self._readonly: + raise ValueError("This EccSramErrorStatus_v1 instance is read-only") + self._ptr[0].aggregateUncParity = val + + @property + def aggregate_unc_sec_ded(self): + """int: aggregate uncorrectable SEC-DED error count""" + return self._ptr[0].aggregateUncSecDed + + @aggregate_unc_sec_ded.setter + def aggregate_unc_sec_ded(self, val): + if self._readonly: + raise ValueError("This EccSramErrorStatus_v1 instance is read-only") + self._ptr[0].aggregateUncSecDed = val + + @property + def aggregate_cor(self): + """int: aggregate correctable error count""" + return self._ptr[0].aggregateCor + + @aggregate_cor.setter + def aggregate_cor(self, val): + if self._readonly: + raise ValueError("This EccSramErrorStatus_v1 instance is read-only") + self._ptr[0].aggregateCor = val + + @property + def volatile_unc_parity(self): + """int: volatile uncorrectable parity error count""" + return self._ptr[0].volatileUncParity + + @volatile_unc_parity.setter + def volatile_unc_parity(self, val): + if self._readonly: + raise ValueError("This EccSramErrorStatus_v1 instance is read-only") + self._ptr[0].volatileUncParity = val + + @property + def volatile_unc_sec_ded(self): + """int: volatile uncorrectable SEC-DED error count""" + return self._ptr[0].volatileUncSecDed + + @volatile_unc_sec_ded.setter + def volatile_unc_sec_ded(self, val): + if self._readonly: + raise ValueError("This EccSramErrorStatus_v1 instance is read-only") + self._ptr[0].volatileUncSecDed = val + + @property + def volatile_cor(self): + """int: volatile correctable error count""" + return self._ptr[0].volatileCor + + @volatile_cor.setter + def volatile_cor(self, val): + if self._readonly: + raise ValueError("This EccSramErrorStatus_v1 instance is read-only") + self._ptr[0].volatileCor = val + + @property + def aggregate_unc_bucket_l2(self): + """int: aggregate uncorrectable error count for L2 cache bucket""" + return self._ptr[0].aggregateUncBucketL2 + + @aggregate_unc_bucket_l2.setter + def aggregate_unc_bucket_l2(self, val): + if self._readonly: + raise ValueError("This EccSramErrorStatus_v1 instance is read-only") + self._ptr[0].aggregateUncBucketL2 = val + + @property + def aggregate_unc_bucket_sm(self): + """int: aggregate uncorrectable error count for SM bucket""" + return self._ptr[0].aggregateUncBucketSm + + @aggregate_unc_bucket_sm.setter + def aggregate_unc_bucket_sm(self, val): + if self._readonly: + raise ValueError("This EccSramErrorStatus_v1 instance is read-only") + self._ptr[0].aggregateUncBucketSm = val + + @property + def aggregate_unc_bucket_pcie(self): + """int: aggregate uncorrectable error count for PCIE bucket""" + return self._ptr[0].aggregateUncBucketPcie + + @aggregate_unc_bucket_pcie.setter + def aggregate_unc_bucket_pcie(self, val): + if self._readonly: + raise ValueError("This EccSramErrorStatus_v1 instance is read-only") + self._ptr[0].aggregateUncBucketPcie = val + + @property + def aggregate_unc_bucket_mcu(self): + """int: aggregate uncorrectable error count for Microcontroller bucket""" + return self._ptr[0].aggregateUncBucketMcu + + @aggregate_unc_bucket_mcu.setter + def aggregate_unc_bucket_mcu(self, val): + if self._readonly: + raise ValueError("This EccSramErrorStatus_v1 instance is read-only") + self._ptr[0].aggregateUncBucketMcu = val + + @property + def aggregate_unc_bucket_other(self): + """int: aggregate uncorrectable error count for Other bucket""" + return self._ptr[0].aggregateUncBucketOther + + @aggregate_unc_bucket_other.setter + def aggregate_unc_bucket_other(self, val): + if self._readonly: + raise ValueError("This EccSramErrorStatus_v1 instance is read-only") + self._ptr[0].aggregateUncBucketOther = val + + @property + def b_threshold_exceeded(self): + """int: if the error threshold of field diag is exceeded""" + return self._ptr[0].bThresholdExceeded + + @b_threshold_exceeded.setter + def b_threshold_exceeded(self, val): + if self._readonly: + raise ValueError("This EccSramErrorStatus_v1 instance is read-only") + self._ptr[0].bThresholdExceeded = val + + @staticmethod + def from_buffer(buffer): + """Create an EccSramErrorStatus_v1 instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlEccSramErrorStatus_v1_t), EccSramErrorStatus_v1) + + @staticmethod + def from_data(data): + """Create an EccSramErrorStatus_v1 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `ecc_sram_error_status_v1_dtype` holding the data. + """ + return _cyb_from_data(data, "ecc_sram_error_status_v1_dtype", ecc_sram_error_status_v1_dtype, EccSramErrorStatus_v1) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an EccSramErrorStatus_v1 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef EccSramErrorStatus_v1 obj = EccSramErrorStatus_v1.__new__(EccSramErrorStatus_v1) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlEccSramErrorStatus_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating EccSramErrorStatus_v1") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlEccSramErrorStatus_v1_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_platform_info_v1_dtype_offsets(): + cdef nvmlPlatformInfo_v1_t pod + return _numpy.dtype({ + 'names': ['version', 'ib_guid', 'rack_guid', 'chassis_physical_slot_number', 'compute_slot_index', 'node_index', 'peer_type', 'module_id'], + 'formats': [_numpy.uint32, (_numpy.uint8, 16), (_numpy.uint8, 16), _numpy.uint8, _numpy.uint8, _numpy.uint8, _numpy.uint8, _numpy.uint8], + 'offsets': [ + (&(pod.version)) - (&pod), + (&(pod.ibGuid)) - (&pod), + (&(pod.rackGuid)) - (&pod), + (&(pod.chassisPhysicalSlotNumber)) - (&pod), + (&(pod.computeSlotIndex)) - (&pod), + (&(pod.nodeIndex)) - (&pod), + (&(pod.peerType)) - (&pod), + (&(pod.moduleId)) - (&pod), + ], + 'itemsize': sizeof(nvmlPlatformInfo_v1_t), + }) + +platform_info_v1_dtype = _get_platform_info_v1_dtype_offsets() + +cdef class PlatformInfo_v1: + """Empty-initialize an instance of `nvmlPlatformInfo_v1_t`. + + + .. seealso:: `nvmlPlatformInfo_v1_t` + """ + cdef: + nvmlPlatformInfo_v1_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlPlatformInfo_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating PlatformInfo_v1") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlPlatformInfo_v1_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.PlatformInfo_v1 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef PlatformInfo_v1 other_ + if not isinstance(other, PlatformInfo_v1): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlPlatformInfo_v1_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlPlatformInfo_v1_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlPlatformInfo_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating PlatformInfo_v1") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlPlatformInfo_v1_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def version(self): + """int: the API version number""" + return self._ptr[0].version + + @version.setter + def version(self, val): + if self._readonly: + raise ValueError("This PlatformInfo_v1 instance is read-only") + self._ptr[0].version = val + + @property + def ib_guid(self): + """~_numpy.uint8: (array of length 16).Infiniband GUID reported by platform (for Blackwell, ibGuid is 8 bytes so indices 8-15 are zero).""" + cdef _cyb_view.array arr = _cyb_view.array(shape=(16,), itemsize=sizeof(unsigned char), format="B", mode="c", allocate_buffer=False) + arr.data = (&(self._ptr[0].ibGuid)) + return _numpy.asarray(arr) + + @ib_guid.setter + def ib_guid(self, val): + if self._readonly: + raise ValueError("This PlatformInfo_v1 instance is read-only") + if len(val) != 16: + raise ValueError(f"Expected length { 16 } for field ib_guid, got {len(val)}") + cdef _cyb_view.array arr = _cyb_view.array(shape=(16,), itemsize=sizeof(unsigned char), format="B", mode="c") + arr[:] = _numpy.asarray(val, dtype=_numpy.uint8) + _cyb_memcpy((&(self._ptr[0].ibGuid)), (arr.data), sizeof(unsigned char) * len(val)) + + @property + def rack_guid(self): + """~_numpy.uint8: (array of length 16).GUID of the rack containing this GPU (for Blackwell rackGuid is 13 bytes so indices 13-15 are zero).""" + cdef _cyb_view.array arr = _cyb_view.array(shape=(16,), itemsize=sizeof(unsigned char), format="B", mode="c", allocate_buffer=False) + arr.data = (&(self._ptr[0].rackGuid)) + return _numpy.asarray(arr) + + @rack_guid.setter + def rack_guid(self, val): + if self._readonly: + raise ValueError("This PlatformInfo_v1 instance is read-only") + if len(val) != 16: + raise ValueError(f"Expected length { 16 } for field rack_guid, got {len(val)}") + cdef _cyb_view.array arr = _cyb_view.array(shape=(16,), itemsize=sizeof(unsigned char), format="B", mode="c") + arr[:] = _numpy.asarray(val, dtype=_numpy.uint8) + _cyb_memcpy((&(self._ptr[0].rackGuid)), (arr.data), sizeof(unsigned char) * len(val)) + + @property + def chassis_physical_slot_number(self): + """int: The slot number in the rack containing this GPU (includes switches).""" + return self._ptr[0].chassisPhysicalSlotNumber + + @chassis_physical_slot_number.setter + def chassis_physical_slot_number(self, val): + if self._readonly: + raise ValueError("This PlatformInfo_v1 instance is read-only") + self._ptr[0].chassisPhysicalSlotNumber = val + + @property + def compute_slot_index(self): + """int: The index within the compute slots in the rack containing this GPU (does not include switches).""" + return self._ptr[0].computeSlotIndex + + @compute_slot_index.setter + def compute_slot_index(self, val): + if self._readonly: + raise ValueError("This PlatformInfo_v1 instance is read-only") + self._ptr[0].computeSlotIndex = val + + @property + def node_index(self): + """int: Index of the node within the slot containing this GPU.""" + return self._ptr[0].nodeIndex + + @node_index.setter + def node_index(self, val): + if self._readonly: + raise ValueError("This PlatformInfo_v1 instance is read-only") + self._ptr[0].nodeIndex = val + + @property + def peer_type(self): + """int: Platform indicated NVLink-peer type (e.g. switch present or not).""" + return self._ptr[0].peerType + + @peer_type.setter + def peer_type(self, val): + if self._readonly: + raise ValueError("This PlatformInfo_v1 instance is read-only") + self._ptr[0].peerType = val + + @property + def module_id(self): + """int: ID of this GPU within the node.""" + return self._ptr[0].moduleId + + @module_id.setter + def module_id(self, val): + if self._readonly: + raise ValueError("This PlatformInfo_v1 instance is read-only") + self._ptr[0].moduleId = val + + @staticmethod + def from_buffer(buffer): + """Create an PlatformInfo_v1 instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlPlatformInfo_v1_t), PlatformInfo_v1) + + @staticmethod + def from_data(data): + """Create an PlatformInfo_v1 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `platform_info_v1_dtype` holding the data. + """ + return _cyb_from_data(data, "platform_info_v1_dtype", platform_info_v1_dtype, PlatformInfo_v1) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an PlatformInfo_v1 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef PlatformInfo_v1 obj = PlatformInfo_v1.__new__(PlatformInfo_v1) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlPlatformInfo_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating PlatformInfo_v1") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlPlatformInfo_v1_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_platform_info_v2_dtype_offsets(): + cdef nvmlPlatformInfo_v2_t pod + return _numpy.dtype({ + 'names': ['version', 'ib_guid', 'chassis_serial_number', 'slot_number', 'tray_index', 'host_id', 'peer_type', 'module_id'], + 'formats': [_numpy.uint32, (_numpy.uint8, 16), (_numpy.uint8, 16), _numpy.uint8, _numpy.uint8, _numpy.uint8, _numpy.uint8, _numpy.uint8], + 'offsets': [ + (&(pod.version)) - (&pod), + (&(pod.ibGuid)) - (&pod), + (&(pod.chassisSerialNumber)) - (&pod), + (&(pod.slotNumber)) - (&pod), + (&(pod.trayIndex)) - (&pod), + (&(pod.hostId)) - (&pod), + (&(pod.peerType)) - (&pod), + (&(pod.moduleId)) - (&pod), + ], + 'itemsize': sizeof(nvmlPlatformInfo_v2_t), + }) + +platform_info_v2_dtype = _get_platform_info_v2_dtype_offsets() + +cdef class PlatformInfo_v2: + """Empty-initialize an instance of `nvmlPlatformInfo_v2_t`. + + + .. seealso:: `nvmlPlatformInfo_v2_t` + """ + cdef: + nvmlPlatformInfo_v2_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlPlatformInfo_v2_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating PlatformInfo_v2") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlPlatformInfo_v2_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.PlatformInfo_v2 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef PlatformInfo_v2 other_ + if not isinstance(other, PlatformInfo_v2): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlPlatformInfo_v2_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlPlatformInfo_v2_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlPlatformInfo_v2_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating PlatformInfo_v2") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlPlatformInfo_v2_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def version(self): + """int: the API version number""" + return self._ptr[0].version + + @version.setter + def version(self, val): + if self._readonly: + raise ValueError("This PlatformInfo_v2 instance is read-only") + self._ptr[0].version = val + + @property + def ib_guid(self): + """~_numpy.uint8: (array of length 16).Infiniband GUID reported by platform (for Blackwell, ibGuid is 8 bytes so indices 8-15 are zero).""" + cdef _cyb_view.array arr = _cyb_view.array(shape=(16,), itemsize=sizeof(unsigned char), format="B", mode="c", allocate_buffer=False) + arr.data = (&(self._ptr[0].ibGuid)) + return _numpy.asarray(arr) + + @ib_guid.setter + def ib_guid(self, val): + if self._readonly: + raise ValueError("This PlatformInfo_v2 instance is read-only") + if len(val) != 16: + raise ValueError(f"Expected length { 16 } for field ib_guid, got {len(val)}") + cdef _cyb_view.array arr = _cyb_view.array(shape=(16,), itemsize=sizeof(unsigned char), format="B", mode="c") + arr[:] = _numpy.asarray(val, dtype=_numpy.uint8) + _cyb_memcpy((&(self._ptr[0].ibGuid)), (arr.data), sizeof(unsigned char) * len(val)) + + @property + def chassis_serial_number(self): + """~_numpy.uint8: (array of length 16).Serial number of the chassis containing this GPU (for Blackwell it is 13 bytes so indices 13-15 are zero).""" + cdef _cyb_view.array arr = _cyb_view.array(shape=(16,), itemsize=sizeof(unsigned char), format="B", mode="c", allocate_buffer=False) + arr.data = (&(self._ptr[0].chassisSerialNumber)) + return _numpy.asarray(arr) + + @chassis_serial_number.setter + def chassis_serial_number(self, val): + if self._readonly: + raise ValueError("This PlatformInfo_v2 instance is read-only") + if len(val) != 16: + raise ValueError(f"Expected length { 16 } for field chassis_serial_number, got {len(val)}") + cdef _cyb_view.array arr = _cyb_view.array(shape=(16,), itemsize=sizeof(unsigned char), format="B", mode="c") + arr[:] = _numpy.asarray(val, dtype=_numpy.uint8) + _cyb_memcpy((&(self._ptr[0].chassisSerialNumber)), (arr.data), sizeof(unsigned char) * len(val)) + + @property + def slot_number(self): + """int: The slot number in the chassis containing this GPU (includes switches).""" + return self._ptr[0].slotNumber + + @slot_number.setter + def slot_number(self, val): + if self._readonly: + raise ValueError("This PlatformInfo_v2 instance is read-only") + self._ptr[0].slotNumber = val + + @property + def tray_index(self): + """int: The tray index within the compute slots in the chassis containing this GPU (does not include switches).""" + return self._ptr[0].trayIndex + + @tray_index.setter + def tray_index(self, val): + if self._readonly: + raise ValueError("This PlatformInfo_v2 instance is read-only") + self._ptr[0].trayIndex = val + + @property + def host_id(self): + """int: Index of the node within the slot containing this GPU.""" + return self._ptr[0].hostId + + @host_id.setter + def host_id(self, val): + if self._readonly: + raise ValueError("This PlatformInfo_v2 instance is read-only") + self._ptr[0].hostId = val + + @property + def peer_type(self): + """int: Platform indicated NVLink-peer type (e.g. switch present or not).""" + return self._ptr[0].peerType + + @peer_type.setter + def peer_type(self, val): + if self._readonly: + raise ValueError("This PlatformInfo_v2 instance is read-only") + self._ptr[0].peerType = val + + @property + def module_id(self): + """int: ID of this GPU within the node.""" + return self._ptr[0].moduleId + + @module_id.setter + def module_id(self, val): + if self._readonly: + raise ValueError("This PlatformInfo_v2 instance is read-only") + self._ptr[0].moduleId = val + + @staticmethod + def from_buffer(buffer): + """Create an PlatformInfo_v2 instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlPlatformInfo_v2_t), PlatformInfo_v2) + + @staticmethod + def from_data(data): + """Create an PlatformInfo_v2 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `platform_info_v2_dtype` holding the data. + """ + return _cyb_from_data(data, "platform_info_v2_dtype", platform_info_v2_dtype, PlatformInfo_v2) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an PlatformInfo_v2 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef PlatformInfo_v2 obj = PlatformInfo_v2.__new__(PlatformInfo_v2) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlPlatformInfo_v2_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating PlatformInfo_v2") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlPlatformInfo_v2_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get__py_anon_pod1_dtype_offsets(): + cdef cuda_bindings_nvml__anon_pod1 pod + return _numpy.dtype({ + 'names': ['b_is_present', 'percentage', 'inc_threshold', 'dec_threshold'], + 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32], + 'offsets': [ + (&(pod.bIsPresent)) - (&pod), + (&(pod.percentage)) - (&pod), + (&(pod.incThreshold)) - (&pod), + (&(pod.decThreshold)) - (&pod), + ], + 'itemsize': sizeof(cuda_bindings_nvml__anon_pod1), + }) + +_py_anon_pod1_dtype = _get__py_anon_pod1_dtype_offsets() + +cdef class _py_anon_pod1: + """Empty-initialize an instance of `cuda_bindings_nvml__anon_pod1`. + + + .. seealso:: `cuda_bindings_nvml__anon_pod1` + """ + cdef: + cuda_bindings_nvml__anon_pod1 *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(cuda_bindings_nvml__anon_pod1)) + if self._ptr == NULL: + raise MemoryError("Error allocating _py_anon_pod1") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef cuda_bindings_nvml__anon_pod1 *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}._py_anon_pod1 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef _py_anon_pod1 other_ + if not isinstance(other, _py_anon_pod1): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(cuda_bindings_nvml__anon_pod1)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(cuda_bindings_nvml__anon_pod1), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(cuda_bindings_nvml__anon_pod1)) + if self._ptr == NULL: + raise MemoryError("Error allocating _py_anon_pod1") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(cuda_bindings_nvml__anon_pod1)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def b_is_present(self): + """int: """ + return self._ptr[0].bIsPresent + + @b_is_present.setter + def b_is_present(self, val): + if self._readonly: + raise ValueError("This _py_anon_pod1 instance is read-only") + self._ptr[0].bIsPresent = val + + @property + def percentage(self): + """int: """ + return self._ptr[0].percentage + + @percentage.setter + def percentage(self, val): + if self._readonly: + raise ValueError("This _py_anon_pod1 instance is read-only") + self._ptr[0].percentage = val + + @property + def inc_threshold(self): + """int: """ + return self._ptr[0].incThreshold + + @inc_threshold.setter + def inc_threshold(self, val): + if self._readonly: + raise ValueError("This _py_anon_pod1 instance is read-only") + self._ptr[0].incThreshold = val + + @property + def dec_threshold(self): + """int: """ + return self._ptr[0].decThreshold + + @dec_threshold.setter + def dec_threshold(self, val): + if self._readonly: + raise ValueError("This _py_anon_pod1 instance is read-only") + self._ptr[0].decThreshold = val + + @staticmethod + def from_buffer(buffer): + """Create an _py_anon_pod1 instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(cuda_bindings_nvml__anon_pod1), _py_anon_pod1) + + @staticmethod + def from_data(data): + """Create an _py_anon_pod1 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `_py_anon_pod1_dtype` holding the data. + """ + return _cyb_from_data(data, "_py_anon_pod1_dtype", _py_anon_pod1_dtype, _py_anon_pod1) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an _py_anon_pod1 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef _py_anon_pod1 obj = _py_anon_pod1.__new__(_py_anon_pod1) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(cuda_bindings_nvml__anon_pod1)) + if obj._ptr == NULL: + raise MemoryError("Error allocating _py_anon_pod1") + _cyb_memcpy((obj._ptr), ptr, sizeof(cuda_bindings_nvml__anon_pod1)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_vgpu_placement_list_v2_dtype_offsets(): + cdef nvmlVgpuPlacementList_v2_t pod + return _numpy.dtype({ + 'names': ['version', 'placement_size', 'count', 'placement_ids', 'mode'], + 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.intp, _numpy.uint32], + 'offsets': [ + (&(pod.version)) - (&pod), + (&(pod.placementSize)) - (&pod), + (&(pod.count)) - (&pod), + (&(pod.placementIds)) - (&pod), + (&(pod.mode)) - (&pod), + ], + 'itemsize': sizeof(nvmlVgpuPlacementList_v2_t), + }) + +vgpu_placement_list_v2_dtype = _get_vgpu_placement_list_v2_dtype_offsets() + +cdef class VgpuPlacementList_v2: + """Empty-initialize an instance of `nvmlVgpuPlacementList_v2_t`. + + + .. seealso:: `nvmlVgpuPlacementList_v2_t` + """ + cdef: + nvmlVgpuPlacementList_v2_t *_ptr + object _owner + bint _owned + bint _readonly + dict _refs + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlVgpuPlacementList_v2_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuPlacementList_v2") + self._owner = None + self._owned = True + self._readonly = False + self._refs = {} + + def __dealloc__(self): + cdef nvmlVgpuPlacementList_v2_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.VgpuPlacementList_v2 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef VgpuPlacementList_v2 other_ + if not isinstance(other, VgpuPlacementList_v2): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuPlacementList_v2_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlVgpuPlacementList_v2_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlVgpuPlacementList_v2_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuPlacementList_v2") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuPlacementList_v2_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def version(self): + """int: IN: The version number of this struct.""" + return self._ptr[0].version + + @version.setter + def version(self, val): + if self._readonly: + raise ValueError("This VgpuPlacementList_v2 instance is read-only") + self._ptr[0].version = val + + @property + def placement_size(self): + """int: OUT: The number of slots occupied by the vGPU type.""" + return self._ptr[0].placementSize + + @placement_size.setter + def placement_size(self, val): + if self._readonly: + raise ValueError("This VgpuPlacementList_v2 instance is read-only") + self._ptr[0].placementSize = val + + @property + def placement_ids(self): + """int: IN/OUT: Placement IDs for the vGPU type.""" + if self._ptr[0].placementIds == NULL: + return [] + cdef _cyb_view.array arr = _cyb_view.array(shape=(self._ptr[0].count,), itemsize=sizeof(unsigned int), format="I", mode="c", allocate_buffer=False) + arr.data = (self._ptr[0].placementIds) + return _numpy.asarray(arr) + + @placement_ids.setter + def placement_ids(self, val): + if self._readonly: + raise ValueError("This VgpuPlacementList_v2 instance is read-only") + cdef _cyb_view.array arr = _cyb_view.array(shape=(len(val),), itemsize=sizeof(unsigned int), format="I", mode="c") + arr[:] = _numpy.asarray(val, dtype=_numpy.uint32) + self._ptr[0].placementIds = (arr.data) + self._ptr[0].count = len(val) + self._refs["placement_ids"] = arr + + @property + def mode(self): + """int: IN: The vGPU mode. Either NVML_VGPU_PGPU_HETEROGENEOUS_MODE or NVML_VGPU_PGPU_HOMOGENEOUS_MODE.""" + return self._ptr[0].mode + + @mode.setter + def mode(self, val): + if self._readonly: + raise ValueError("This VgpuPlacementList_v2 instance is read-only") + self._ptr[0].mode = val + + @staticmethod + def from_buffer(buffer): + """Create an VgpuPlacementList_v2 instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlVgpuPlacementList_v2_t), VgpuPlacementList_v2) + + @staticmethod + def from_data(data): + """Create an VgpuPlacementList_v2 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `vgpu_placement_list_v2_dtype` holding the data. + """ + return _cyb_from_data(data, "vgpu_placement_list_v2_dtype", vgpu_placement_list_v2_dtype, VgpuPlacementList_v2) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an VgpuPlacementList_v2 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef VgpuPlacementList_v2 obj = VgpuPlacementList_v2.__new__(VgpuPlacementList_v2) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlVgpuPlacementList_v2_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating VgpuPlacementList_v2") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlVgpuPlacementList_v2_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + obj._refs = {} + return obj + + +cdef _get_vgpu_type_bar1info_v1_dtype_offsets(): + cdef nvmlVgpuTypeBar1Info_v1_t pod + return _numpy.dtype({ + 'names': ['version', 'bar1size'], + 'formats': [_numpy.uint32, _numpy.uint64], + 'offsets': [ + (&(pod.version)) - (&pod), + (&(pod.bar1Size)) - (&pod), + ], + 'itemsize': sizeof(nvmlVgpuTypeBar1Info_v1_t), + }) + +vgpu_type_bar1info_v1_dtype = _get_vgpu_type_bar1info_v1_dtype_offsets() + +cdef class VgpuTypeBar1Info_v1: + """Empty-initialize an instance of `nvmlVgpuTypeBar1Info_v1_t`. + + + .. seealso:: `nvmlVgpuTypeBar1Info_v1_t` + """ + cdef: + nvmlVgpuTypeBar1Info_v1_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlVgpuTypeBar1Info_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuTypeBar1Info_v1") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlVgpuTypeBar1Info_v1_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.VgpuTypeBar1Info_v1 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef VgpuTypeBar1Info_v1 other_ + if not isinstance(other, VgpuTypeBar1Info_v1): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuTypeBar1Info_v1_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlVgpuTypeBar1Info_v1_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlVgpuTypeBar1Info_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuTypeBar1Info_v1") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuTypeBar1Info_v1_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def version(self): + """int: The version number of this struct.""" + return self._ptr[0].version + + @version.setter + def version(self, val): + if self._readonly: + raise ValueError("This VgpuTypeBar1Info_v1 instance is read-only") + self._ptr[0].version = val + + @property + def bar1size(self): + """int: BAR1 size in megabytes.""" + return self._ptr[0].bar1Size + + @bar1size.setter + def bar1size(self, val): + if self._readonly: + raise ValueError("This VgpuTypeBar1Info_v1 instance is read-only") + self._ptr[0].bar1Size = val + + @staticmethod + def from_buffer(buffer): + """Create an VgpuTypeBar1Info_v1 instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlVgpuTypeBar1Info_v1_t), VgpuTypeBar1Info_v1) + + @staticmethod + def from_data(data): + """Create an VgpuTypeBar1Info_v1 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `vgpu_type_bar1info_v1_dtype` holding the data. + """ + return _cyb_from_data(data, "vgpu_type_bar1info_v1_dtype", vgpu_type_bar1info_v1_dtype, VgpuTypeBar1Info_v1) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an VgpuTypeBar1Info_v1 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef VgpuTypeBar1Info_v1 obj = VgpuTypeBar1Info_v1.__new__(VgpuTypeBar1Info_v1) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlVgpuTypeBar1Info_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating VgpuTypeBar1Info_v1") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlVgpuTypeBar1Info_v1_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_vgpu_process_utilization_info_v1_dtype_offsets(): + cdef nvmlVgpuProcessUtilizationInfo_v1_t pod + return _numpy.dtype({ + 'names': ['process_name', 'time_stamp', 'vgpu_instance', 'pid', 'sm_util', 'mem_util', 'enc_util', 'dec_util', 'jpg_util', 'ofa_util'], + 'formats': [(_numpy.int8, 64), _numpy.uint64, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32], + 'offsets': [ + (&(pod.processName)) - (&pod), + (&(pod.timeStamp)) - (&pod), + (&(pod.vgpuInstance)) - (&pod), + (&(pod.pid)) - (&pod), + (&(pod.smUtil)) - (&pod), + (&(pod.memUtil)) - (&pod), + (&(pod.encUtil)) - (&pod), + (&(pod.decUtil)) - (&pod), + (&(pod.jpgUtil)) - (&pod), + (&(pod.ofaUtil)) - (&pod), + ], + 'itemsize': sizeof(nvmlVgpuProcessUtilizationInfo_v1_t), + }) + +vgpu_process_utilization_info_v1_dtype = _get_vgpu_process_utilization_info_v1_dtype_offsets() + +cdef class VgpuProcessUtilizationInfo_v1: + """Empty-initialize an array of `nvmlVgpuProcessUtilizationInfo_v1_t`. + The resulting object is of length `size` and of dtype `vgpu_process_utilization_info_v1_dtype`. + If default-constructed, the instance represents a single struct. + + Args: + size (int): number of structs, default=1. + + .. seealso:: `nvmlVgpuProcessUtilizationInfo_v1_t` + """ + cdef: + readonly object _data + + def __init__(self, size=1): + arr = _numpy.empty(size, dtype=vgpu_process_utilization_info_v1_dtype) + self._data = arr.view(_numpy.recarray) + assert self._data.itemsize == sizeof(nvmlVgpuProcessUtilizationInfo_v1_t), \ + f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlVgpuProcessUtilizationInfo_v1_t) }" + + def __repr__(self): + if self._data.size > 1: + return f"<{__name__}.VgpuProcessUtilizationInfo_v1_Array_{self._data.size} object at {hex(id(self))}>" + else: + return f"<{__name__}.VgpuProcessUtilizationInfo_v1 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return self._data.ctypes.data + + cdef intptr_t _get_ptr(self): + return self._data.ctypes.data + + def __int__(self): + if self._data.size > 1: + raise TypeError("int() argument must be a bytes-like object of size 1. " + "To get the pointer address of an array, use .ptr") + return self._data.ctypes.data + + def __len__(self): + return self._data.size + + def __eq__(self, other): + cdef object self_data = self._data + if (not isinstance(other, VgpuProcessUtilizationInfo_v1)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype: + return False + return bool((self_data == other._data).all()) + + def __getbuffer__(self, Py_buffer *buffer, int flags): + _cyb_cpython.PyObject_GetBuffer(self._data, buffer, flags) + + def __releasebuffer__(self, Py_buffer *buffer): + _cyb_cpython.PyBuffer_Release(buffer) + + @property + def process_name(self): + """~_numpy.int8: (array of length 64).Name of process running within the vGPU VM.""" + return self._data.process_name + + @process_name.setter + def process_name(self, val): + self._data.process_name = val + + @property + def time_stamp(self): + """Union[~_numpy.uint64, int]: CPU Timestamp in microseconds.""" + if self._data.size == 1: + return int(self._data.time_stamp[0]) + return self._data.time_stamp + + @time_stamp.setter + def time_stamp(self, val): + self._data.time_stamp = val + + @property + def vgpu_instance(self): + """Union[~_numpy.uint32, int]: vGPU Instance""" + if self._data.size == 1: + return int(self._data.vgpu_instance[0]) + return self._data.vgpu_instance + + @vgpu_instance.setter + def vgpu_instance(self, val): + self._data.vgpu_instance = val + + @property + def pid(self): + """Union[~_numpy.uint32, int]: PID of process running within the vGPU VM.""" + if self._data.size == 1: + return int(self._data.pid[0]) + return self._data.pid + + @pid.setter + def pid(self, val): + self._data.pid = val + + @property + def sm_util(self): + """Union[~_numpy.uint32, int]: SM (3D/Compute) Util Value.""" + if self._data.size == 1: + return int(self._data.sm_util[0]) + return self._data.sm_util + + @sm_util.setter + def sm_util(self, val): + self._data.sm_util = val + + @property + def mem_util(self): + """Union[~_numpy.uint32, int]: Frame Buffer Memory Util Value.""" + if self._data.size == 1: + return int(self._data.mem_util[0]) + return self._data.mem_util + + @mem_util.setter + def mem_util(self, val): + self._data.mem_util = val + + @property + def enc_util(self): + """Union[~_numpy.uint32, int]: Encoder Util Value.""" + if self._data.size == 1: + return int(self._data.enc_util[0]) + return self._data.enc_util + + @enc_util.setter + def enc_util(self, val): + self._data.enc_util = val + + @property + def dec_util(self): + """Union[~_numpy.uint32, int]: Decoder Util Value.""" + if self._data.size == 1: + return int(self._data.dec_util[0]) + return self._data.dec_util + + @dec_util.setter + def dec_util(self, val): + self._data.dec_util = val + + @property + def jpg_util(self): + """Union[~_numpy.uint32, int]: Jpeg Util Value.""" + if self._data.size == 1: + return int(self._data.jpg_util[0]) + return self._data.jpg_util + + @jpg_util.setter + def jpg_util(self, val): + self._data.jpg_util = val + + @property + def ofa_util(self): + """Union[~_numpy.uint32, int]: Ofa Util Value.""" + if self._data.size == 1: + return int(self._data.ofa_util[0]) + return self._data.ofa_util + + @ofa_util.setter + def ofa_util(self, val): + self._data.ofa_util = val + + def __getitem__(self, key): + cdef ssize_t key_ + cdef ssize_t size + if isinstance(key, int): + key_ = key + size = self._data.size + if key_ >= size or key_ <= -(size+1): + raise IndexError("index is out of bounds") + if key_ < 0: + key_ += size + return VgpuProcessUtilizationInfo_v1.from_data(self._data[key_:key_+1]) + out = self._data[key] + if isinstance(out, _numpy.recarray) and out.dtype == vgpu_process_utilization_info_v1_dtype: + return VgpuProcessUtilizationInfo_v1.from_data(out) + return out + + def __setitem__(self, key, val): + self._data[key] = val + + @staticmethod + def from_buffer(buffer): + """Create an VgpuProcessUtilizationInfo_v1 instance with the memory from the given buffer.""" + return VgpuProcessUtilizationInfo_v1.from_data(_numpy.frombuffer(buffer, dtype=vgpu_process_utilization_info_v1_dtype)) + + @staticmethod + def from_data(data): + """Create an VgpuProcessUtilizationInfo_v1 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a 1D array of dtype `vgpu_process_utilization_info_v1_dtype` holding the data. + """ + cdef VgpuProcessUtilizationInfo_v1 obj = VgpuProcessUtilizationInfo_v1.__new__(VgpuProcessUtilizationInfo_v1) + if not isinstance(data, _numpy.ndarray): + raise TypeError("data argument must be a NumPy ndarray") + if data.ndim != 1: + raise ValueError("data array must be 1D") + if data.dtype != vgpu_process_utilization_info_v1_dtype: + raise ValueError("data array must be of dtype vgpu_process_utilization_info_v1_dtype") + obj._data = data.view(_numpy.recarray) + + return obj + + @staticmethod + def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False): + """Create an VgpuProcessUtilizationInfo_v1 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + size (int): number of structs, default=1. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef VgpuProcessUtilizationInfo_v1 obj = VgpuProcessUtilizationInfo_v1.__new__(VgpuProcessUtilizationInfo_v1) + cdef flag = _cyb_cpython_buffer.PyBUF_READ if readonly else _cyb_cpython_buffer.PyBUF_WRITE + cdef object buf = _cyb_cpython_memoryview.PyMemoryView_FromMemory( + ptr, sizeof(nvmlVgpuProcessUtilizationInfo_v1_t) * size, flag) + data = _numpy.ndarray(size, buffer=buf, dtype=vgpu_process_utilization_info_v1_dtype) + obj._data = data.view(_numpy.recarray) + + return obj + + +cdef _get__py_anon_pod2_dtype_offsets(): + cdef cuda_bindings_nvml__anon_pod2 pod + return _numpy.dtype({ + 'names': ['avg_factor', 'timeslice'], + 'formats': [_numpy.uint32, _numpy.uint32], + 'offsets': [ + (&(pod.avgFactor)) - (&pod), + (&(pod.timeslice)) - (&pod), + ], + 'itemsize': sizeof(cuda_bindings_nvml__anon_pod2), + }) + +_py_anon_pod2_dtype = _get__py_anon_pod2_dtype_offsets() + +cdef class _py_anon_pod2: + """Empty-initialize an instance of `cuda_bindings_nvml__anon_pod2`. + + + .. seealso:: `cuda_bindings_nvml__anon_pod2` + """ + cdef: + cuda_bindings_nvml__anon_pod2 *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(cuda_bindings_nvml__anon_pod2)) + if self._ptr == NULL: + raise MemoryError("Error allocating _py_anon_pod2") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef cuda_bindings_nvml__anon_pod2 *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}._py_anon_pod2 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef _py_anon_pod2 other_ + if not isinstance(other, _py_anon_pod2): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(cuda_bindings_nvml__anon_pod2)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(cuda_bindings_nvml__anon_pod2), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(cuda_bindings_nvml__anon_pod2)) + if self._ptr == NULL: + raise MemoryError("Error allocating _py_anon_pod2") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(cuda_bindings_nvml__anon_pod2)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def avg_factor(self): + """int: """ + return self._ptr[0].avgFactor + + @avg_factor.setter + def avg_factor(self, val): + if self._readonly: + raise ValueError("This _py_anon_pod2 instance is read-only") + self._ptr[0].avgFactor = val + + @property + def timeslice(self): + """int: """ + return self._ptr[0].timeslice + + @timeslice.setter + def timeslice(self, val): + if self._readonly: + raise ValueError("This _py_anon_pod2 instance is read-only") + self._ptr[0].timeslice = val + + @staticmethod + def from_buffer(buffer): + """Create an _py_anon_pod2 instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(cuda_bindings_nvml__anon_pod2), _py_anon_pod2) + + @staticmethod + def from_data(data): + """Create an _py_anon_pod2 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `_py_anon_pod2_dtype` holding the data. + """ + return _cyb_from_data(data, "_py_anon_pod2_dtype", _py_anon_pod2_dtype, _py_anon_pod2) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an _py_anon_pod2 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef _py_anon_pod2 obj = _py_anon_pod2.__new__(_py_anon_pod2) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(cuda_bindings_nvml__anon_pod2)) + if obj._ptr == NULL: + raise MemoryError("Error allocating _py_anon_pod2") + _cyb_memcpy((obj._ptr), ptr, sizeof(cuda_bindings_nvml__anon_pod2)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get__py_anon_pod3_dtype_offsets(): + cdef cuda_bindings_nvml__anon_pod3 pod + return _numpy.dtype({ + 'names': ['timeslice'], + 'formats': [_numpy.uint32], + 'offsets': [ + (&(pod.timeslice)) - (&pod), + ], + 'itemsize': sizeof(cuda_bindings_nvml__anon_pod3), + }) + +_py_anon_pod3_dtype = _get__py_anon_pod3_dtype_offsets() + +cdef class _py_anon_pod3: + """Empty-initialize an instance of `cuda_bindings_nvml__anon_pod3`. + + + .. seealso:: `cuda_bindings_nvml__anon_pod3` + """ + cdef: + cuda_bindings_nvml__anon_pod3 *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(cuda_bindings_nvml__anon_pod3)) + if self._ptr == NULL: + raise MemoryError("Error allocating _py_anon_pod3") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef cuda_bindings_nvml__anon_pod3 *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}._py_anon_pod3 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef _py_anon_pod3 other_ + if not isinstance(other, _py_anon_pod3): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(cuda_bindings_nvml__anon_pod3)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(cuda_bindings_nvml__anon_pod3), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(cuda_bindings_nvml__anon_pod3)) + if self._ptr == NULL: + raise MemoryError("Error allocating _py_anon_pod3") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(cuda_bindings_nvml__anon_pod3)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def timeslice(self): + """int: """ + return self._ptr[0].timeslice + + @timeslice.setter + def timeslice(self, val): + if self._readonly: + raise ValueError("This _py_anon_pod3 instance is read-only") + self._ptr[0].timeslice = val + + @staticmethod + def from_buffer(buffer): + """Create an _py_anon_pod3 instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(cuda_bindings_nvml__anon_pod3), _py_anon_pod3) + + @staticmethod + def from_data(data): + """Create an _py_anon_pod3 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `_py_anon_pod3_dtype` holding the data. + """ + return _cyb_from_data(data, "_py_anon_pod3_dtype", _py_anon_pod3_dtype, _py_anon_pod3) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an _py_anon_pod3 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef _py_anon_pod3 obj = _py_anon_pod3.__new__(_py_anon_pod3) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(cuda_bindings_nvml__anon_pod3)) + if obj._ptr == NULL: + raise MemoryError("Error allocating _py_anon_pod3") + _cyb_memcpy((obj._ptr), ptr, sizeof(cuda_bindings_nvml__anon_pod3)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_vgpu_scheduler_log_entry_dtype_offsets(): + cdef nvmlVgpuSchedulerLogEntry_t pod + return _numpy.dtype({ + 'names': ['timestamp', 'time_run_total', 'time_run', 'sw_runlist_id', 'target_time_slice', 'cumulative_preemption_time'], + 'formats': [_numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint32, _numpy.uint64, _numpy.uint64], + 'offsets': [ + (&(pod.timestamp)) - (&pod), + (&(pod.timeRunTotal)) - (&pod), + (&(pod.timeRun)) - (&pod), + (&(pod.swRunlistId)) - (&pod), + (&(pod.targetTimeSlice)) - (&pod), + (&(pod.cumulativePreemptionTime)) - (&pod), + ], + 'itemsize': sizeof(nvmlVgpuSchedulerLogEntry_t), + }) + +vgpu_scheduler_log_entry_dtype = _get_vgpu_scheduler_log_entry_dtype_offsets() + +cdef class VgpuSchedulerLogEntry: + """Empty-initialize an array of `nvmlVgpuSchedulerLogEntry_t`. + The resulting object is of length `size` and of dtype `vgpu_scheduler_log_entry_dtype`. + If default-constructed, the instance represents a single struct. + + Args: + size (int): number of structs, default=1. + + .. seealso:: `nvmlVgpuSchedulerLogEntry_t` + """ + cdef: + readonly object _data + + def __init__(self, size=1): + arr = _numpy.empty(size, dtype=vgpu_scheduler_log_entry_dtype) + self._data = arr.view(_numpy.recarray) + assert self._data.itemsize == sizeof(nvmlVgpuSchedulerLogEntry_t), \ + f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlVgpuSchedulerLogEntry_t) }" + + def __repr__(self): + if self._data.size > 1: + return f"<{__name__}.VgpuSchedulerLogEntry_Array_{self._data.size} object at {hex(id(self))}>" + else: + return f"<{__name__}.VgpuSchedulerLogEntry object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return self._data.ctypes.data + + cdef intptr_t _get_ptr(self): + return self._data.ctypes.data + + def __int__(self): + if self._data.size > 1: + raise TypeError("int() argument must be a bytes-like object of size 1. " + "To get the pointer address of an array, use .ptr") + return self._data.ctypes.data + + def __len__(self): + return self._data.size + + def __eq__(self, other): + cdef object self_data = self._data + if (not isinstance(other, VgpuSchedulerLogEntry)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype: + return False + return bool((self_data == other._data).all()) + + def __getbuffer__(self, Py_buffer *buffer, int flags): + _cyb_cpython.PyObject_GetBuffer(self._data, buffer, flags) + + def __releasebuffer__(self, Py_buffer *buffer): + _cyb_cpython.PyBuffer_Release(buffer) + + @property + def timestamp(self): + """Union[~_numpy.uint64, int]: """ + if self._data.size == 1: + return int(self._data.timestamp[0]) + return self._data.timestamp + + @timestamp.setter + def timestamp(self, val): + self._data.timestamp = val + + @property + def time_run_total(self): + """Union[~_numpy.uint64, int]: """ + if self._data.size == 1: + return int(self._data.time_run_total[0]) + return self._data.time_run_total + + @time_run_total.setter + def time_run_total(self, val): + self._data.time_run_total = val + + @property + def time_run(self): + """Union[~_numpy.uint64, int]: """ + if self._data.size == 1: + return int(self._data.time_run[0]) + return self._data.time_run + + @time_run.setter + def time_run(self, val): + self._data.time_run = val + + @property + def sw_runlist_id(self): + """Union[~_numpy.uint32, int]: """ + if self._data.size == 1: + return int(self._data.sw_runlist_id[0]) + return self._data.sw_runlist_id + + @sw_runlist_id.setter + def sw_runlist_id(self, val): + self._data.sw_runlist_id = val + + @property + def target_time_slice(self): + """Union[~_numpy.uint64, int]: """ + if self._data.size == 1: + return int(self._data.target_time_slice[0]) + return self._data.target_time_slice + + @target_time_slice.setter + def target_time_slice(self, val): + self._data.target_time_slice = val + + @property + def cumulative_preemption_time(self): + """Union[~_numpy.uint64, int]: """ + if self._data.size == 1: + return int(self._data.cumulative_preemption_time[0]) + return self._data.cumulative_preemption_time + + @cumulative_preemption_time.setter + def cumulative_preemption_time(self, val): + self._data.cumulative_preemption_time = val + + def __getitem__(self, key): + cdef ssize_t key_ + cdef ssize_t size + if isinstance(key, int): + key_ = key + size = self._data.size + if key_ >= size or key_ <= -(size+1): + raise IndexError("index is out of bounds") + if key_ < 0: + key_ += size + return VgpuSchedulerLogEntry.from_data(self._data[key_:key_+1]) + out = self._data[key] + if isinstance(out, _numpy.recarray) and out.dtype == vgpu_scheduler_log_entry_dtype: + return VgpuSchedulerLogEntry.from_data(out) + return out + + def __setitem__(self, key, val): + self._data[key] = val + + @staticmethod + def from_buffer(buffer): + """Create an VgpuSchedulerLogEntry instance with the memory from the given buffer.""" + return VgpuSchedulerLogEntry.from_data(_numpy.frombuffer(buffer, dtype=vgpu_scheduler_log_entry_dtype)) + + @staticmethod + def from_data(data): + """Create an VgpuSchedulerLogEntry instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a 1D array of dtype `vgpu_scheduler_log_entry_dtype` holding the data. + """ + cdef VgpuSchedulerLogEntry obj = VgpuSchedulerLogEntry.__new__(VgpuSchedulerLogEntry) + if not isinstance(data, _numpy.ndarray): + raise TypeError("data argument must be a NumPy ndarray") + if data.ndim != 1: + raise ValueError("data array must be 1D") + if data.dtype != vgpu_scheduler_log_entry_dtype: + raise ValueError("data array must be of dtype vgpu_scheduler_log_entry_dtype") + obj._data = data.view(_numpy.recarray) + + return obj + + @staticmethod + def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False): + """Create an VgpuSchedulerLogEntry instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + size (int): number of structs, default=1. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef VgpuSchedulerLogEntry obj = VgpuSchedulerLogEntry.__new__(VgpuSchedulerLogEntry) + cdef flag = _cyb_cpython_buffer.PyBUF_READ if readonly else _cyb_cpython_buffer.PyBUF_WRITE + cdef object buf = _cyb_cpython_memoryview.PyMemoryView_FromMemory( + ptr, sizeof(nvmlVgpuSchedulerLogEntry_t) * size, flag) + data = _numpy.ndarray(size, buffer=buf, dtype=vgpu_scheduler_log_entry_dtype) + obj._data = data.view(_numpy.recarray) + + return obj + + +cdef _get__py_anon_pod4_dtype_offsets(): + cdef cuda_bindings_nvml__anon_pod4 pod + return _numpy.dtype({ + 'names': ['avg_factor', 'frequency'], + 'formats': [_numpy.uint32, _numpy.uint32], + 'offsets': [ + (&(pod.avgFactor)) - (&pod), + (&(pod.frequency)) - (&pod), + ], + 'itemsize': sizeof(cuda_bindings_nvml__anon_pod4), + }) + +_py_anon_pod4_dtype = _get__py_anon_pod4_dtype_offsets() + +cdef class _py_anon_pod4: + """Empty-initialize an instance of `cuda_bindings_nvml__anon_pod4`. + + + .. seealso:: `cuda_bindings_nvml__anon_pod4` + """ + cdef: + cuda_bindings_nvml__anon_pod4 *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(cuda_bindings_nvml__anon_pod4)) + if self._ptr == NULL: + raise MemoryError("Error allocating _py_anon_pod4") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef cuda_bindings_nvml__anon_pod4 *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}._py_anon_pod4 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef _py_anon_pod4 other_ + if not isinstance(other, _py_anon_pod4): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(cuda_bindings_nvml__anon_pod4)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(cuda_bindings_nvml__anon_pod4), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(cuda_bindings_nvml__anon_pod4)) + if self._ptr == NULL: + raise MemoryError("Error allocating _py_anon_pod4") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(cuda_bindings_nvml__anon_pod4)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def avg_factor(self): + """int: """ + return self._ptr[0].avgFactor + + @avg_factor.setter + def avg_factor(self, val): + if self._readonly: + raise ValueError("This _py_anon_pod4 instance is read-only") + self._ptr[0].avgFactor = val + + @property + def frequency(self): + """int: """ + return self._ptr[0].frequency + + @frequency.setter + def frequency(self, val): + if self._readonly: + raise ValueError("This _py_anon_pod4 instance is read-only") + self._ptr[0].frequency = val + + @staticmethod + def from_buffer(buffer): + """Create an _py_anon_pod4 instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(cuda_bindings_nvml__anon_pod4), _py_anon_pod4) + + @staticmethod + def from_data(data): + """Create an _py_anon_pod4 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `_py_anon_pod4_dtype` holding the data. + """ + return _cyb_from_data(data, "_py_anon_pod4_dtype", _py_anon_pod4_dtype, _py_anon_pod4) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an _py_anon_pod4 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef _py_anon_pod4 obj = _py_anon_pod4.__new__(_py_anon_pod4) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(cuda_bindings_nvml__anon_pod4)) + if obj._ptr == NULL: + raise MemoryError("Error allocating _py_anon_pod4") + _cyb_memcpy((obj._ptr), ptr, sizeof(cuda_bindings_nvml__anon_pod4)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get__py_anon_pod5_dtype_offsets(): + cdef cuda_bindings_nvml__anon_pod5 pod + return _numpy.dtype({ + 'names': ['timeslice'], + 'formats': [_numpy.uint32], + 'offsets': [ + (&(pod.timeslice)) - (&pod), + ], + 'itemsize': sizeof(cuda_bindings_nvml__anon_pod5), + }) + +_py_anon_pod5_dtype = _get__py_anon_pod5_dtype_offsets() + +cdef class _py_anon_pod5: + """Empty-initialize an instance of `cuda_bindings_nvml__anon_pod5`. + + + .. seealso:: `cuda_bindings_nvml__anon_pod5` + """ + cdef: + cuda_bindings_nvml__anon_pod5 *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(cuda_bindings_nvml__anon_pod5)) + if self._ptr == NULL: + raise MemoryError("Error allocating _py_anon_pod5") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef cuda_bindings_nvml__anon_pod5 *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}._py_anon_pod5 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef _py_anon_pod5 other_ + if not isinstance(other, _py_anon_pod5): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(cuda_bindings_nvml__anon_pod5)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(cuda_bindings_nvml__anon_pod5), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(cuda_bindings_nvml__anon_pod5)) + if self._ptr == NULL: + raise MemoryError("Error allocating _py_anon_pod5") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(cuda_bindings_nvml__anon_pod5)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def timeslice(self): + """int: """ + return self._ptr[0].timeslice + + @timeslice.setter + def timeslice(self, val): + if self._readonly: + raise ValueError("This _py_anon_pod5 instance is read-only") + self._ptr[0].timeslice = val + + @staticmethod + def from_buffer(buffer): + """Create an _py_anon_pod5 instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(cuda_bindings_nvml__anon_pod5), _py_anon_pod5) + + @staticmethod + def from_data(data): + """Create an _py_anon_pod5 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `_py_anon_pod5_dtype` holding the data. + """ + return _cyb_from_data(data, "_py_anon_pod5_dtype", _py_anon_pod5_dtype, _py_anon_pod5) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an _py_anon_pod5 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef _py_anon_pod5 obj = _py_anon_pod5.__new__(_py_anon_pod5) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(cuda_bindings_nvml__anon_pod5)) + if obj._ptr == NULL: + raise MemoryError("Error allocating _py_anon_pod5") + _cyb_memcpy((obj._ptr), ptr, sizeof(cuda_bindings_nvml__anon_pod5)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_vgpu_scheduler_capabilities_dtype_offsets(): + cdef nvmlVgpuSchedulerCapabilities_t pod + return _numpy.dtype({ + 'names': ['supported_schedulers', 'max_timeslice', 'min_timeslice', 'is_arr_mode_supported', 'max_frequency_for_arr', 'min_frequency_for_arr', 'max_avg_factor_for_arr', 'min_avg_factor_for_arr'], + 'formats': [(_numpy.uint32, 3), _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32], + 'offsets': [ + (&(pod.supportedSchedulers)) - (&pod), + (&(pod.maxTimeslice)) - (&pod), + (&(pod.minTimeslice)) - (&pod), + (&(pod.isArrModeSupported)) - (&pod), + (&(pod.maxFrequencyForARR)) - (&pod), + (&(pod.minFrequencyForARR)) - (&pod), + (&(pod.maxAvgFactorForARR)) - (&pod), + (&(pod.minAvgFactorForARR)) - (&pod), + ], + 'itemsize': sizeof(nvmlVgpuSchedulerCapabilities_t), + }) + +vgpu_scheduler_capabilities_dtype = _get_vgpu_scheduler_capabilities_dtype_offsets() + +cdef class VgpuSchedulerCapabilities: + """Empty-initialize an instance of `nvmlVgpuSchedulerCapabilities_t`. + + + .. seealso:: `nvmlVgpuSchedulerCapabilities_t` + """ + cdef: + nvmlVgpuSchedulerCapabilities_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlVgpuSchedulerCapabilities_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuSchedulerCapabilities") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlVgpuSchedulerCapabilities_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.VgpuSchedulerCapabilities object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef VgpuSchedulerCapabilities other_ + if not isinstance(other, VgpuSchedulerCapabilities): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuSchedulerCapabilities_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlVgpuSchedulerCapabilities_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlVgpuSchedulerCapabilities_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuSchedulerCapabilities") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuSchedulerCapabilities_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def supported_schedulers(self): + """~_numpy.uint32: (array of length 3).""" + cdef _cyb_view.array arr = _cyb_view.array(shape=(3,), itemsize=sizeof(unsigned int), format="I", mode="c", allocate_buffer=False) + arr.data = (&(self._ptr[0].supportedSchedulers)) + return _numpy.asarray(arr) + + @supported_schedulers.setter + def supported_schedulers(self, val): + if self._readonly: + raise ValueError("This VgpuSchedulerCapabilities instance is read-only") + if len(val) != 3: + raise ValueError(f"Expected length { 3 } for field supported_schedulers, got {len(val)}") + cdef _cyb_view.array arr = _cyb_view.array(shape=(3,), itemsize=sizeof(unsigned int), format="I", mode="c") + arr[:] = _numpy.asarray(val, dtype=_numpy.uint32) + _cyb_memcpy((&(self._ptr[0].supportedSchedulers)), (arr.data), sizeof(unsigned int) * len(val)) + + @property + def max_timeslice(self): + """int: """ + return self._ptr[0].maxTimeslice + + @max_timeslice.setter + def max_timeslice(self, val): + if self._readonly: + raise ValueError("This VgpuSchedulerCapabilities instance is read-only") + self._ptr[0].maxTimeslice = val + + @property + def min_timeslice(self): + """int: """ + return self._ptr[0].minTimeslice + + @min_timeslice.setter + def min_timeslice(self, val): + if self._readonly: + raise ValueError("This VgpuSchedulerCapabilities instance is read-only") + self._ptr[0].minTimeslice = val + + @property + def is_arr_mode_supported(self): + """int: """ + return self._ptr[0].isArrModeSupported + + @is_arr_mode_supported.setter + def is_arr_mode_supported(self, val): + if self._readonly: + raise ValueError("This VgpuSchedulerCapabilities instance is read-only") + self._ptr[0].isArrModeSupported = val + + @property + def max_frequency_for_arr(self): + """int: """ + return self._ptr[0].maxFrequencyForARR + + @max_frequency_for_arr.setter + def max_frequency_for_arr(self, val): + if self._readonly: + raise ValueError("This VgpuSchedulerCapabilities instance is read-only") + self._ptr[0].maxFrequencyForARR = val + + @property + def min_frequency_for_arr(self): + """int: """ + return self._ptr[0].minFrequencyForARR + + @min_frequency_for_arr.setter + def min_frequency_for_arr(self, val): + if self._readonly: + raise ValueError("This VgpuSchedulerCapabilities instance is read-only") + self._ptr[0].minFrequencyForARR = val + + @property + def max_avg_factor_for_arr(self): + """int: """ + return self._ptr[0].maxAvgFactorForARR + + @max_avg_factor_for_arr.setter + def max_avg_factor_for_arr(self, val): + if self._readonly: + raise ValueError("This VgpuSchedulerCapabilities instance is read-only") + self._ptr[0].maxAvgFactorForARR = val + + @property + def min_avg_factor_for_arr(self): + """int: """ + return self._ptr[0].minAvgFactorForARR + + @min_avg_factor_for_arr.setter + def min_avg_factor_for_arr(self, val): + if self._readonly: + raise ValueError("This VgpuSchedulerCapabilities instance is read-only") + self._ptr[0].minAvgFactorForARR = val + + @staticmethod + def from_buffer(buffer): + """Create an VgpuSchedulerCapabilities instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlVgpuSchedulerCapabilities_t), VgpuSchedulerCapabilities) + + @staticmethod + def from_data(data): + """Create an VgpuSchedulerCapabilities instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `vgpu_scheduler_capabilities_dtype` holding the data. + """ + return _cyb_from_data(data, "vgpu_scheduler_capabilities_dtype", vgpu_scheduler_capabilities_dtype, VgpuSchedulerCapabilities) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an VgpuSchedulerCapabilities instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef VgpuSchedulerCapabilities obj = VgpuSchedulerCapabilities.__new__(VgpuSchedulerCapabilities) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlVgpuSchedulerCapabilities_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating VgpuSchedulerCapabilities") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlVgpuSchedulerCapabilities_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_vgpu_license_expiry_dtype_offsets(): + cdef nvmlVgpuLicenseExpiry_t pod + return _numpy.dtype({ + 'names': ['year', 'month', 'day', 'hour', 'min_', 'sec', 'status'], + 'formats': [_numpy.uint32, _numpy.uint16, _numpy.uint16, _numpy.uint16, _numpy.uint16, _numpy.uint16, _numpy.uint8], + 'offsets': [ + (&(pod.year)) - (&pod), + (&(pod.month)) - (&pod), + (&(pod.day)) - (&pod), + (&(pod.hour)) - (&pod), + (&(pod.min)) - (&pod), + (&(pod.sec)) - (&pod), + (&(pod.status)) - (&pod), + ], + 'itemsize': sizeof(nvmlVgpuLicenseExpiry_t), + }) + +vgpu_license_expiry_dtype = _get_vgpu_license_expiry_dtype_offsets() + +cdef class VgpuLicenseExpiry: + """Empty-initialize an instance of `nvmlVgpuLicenseExpiry_t`. + + + .. seealso:: `nvmlVgpuLicenseExpiry_t` + """ + cdef: + nvmlVgpuLicenseExpiry_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlVgpuLicenseExpiry_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuLicenseExpiry") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlVgpuLicenseExpiry_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.VgpuLicenseExpiry object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef VgpuLicenseExpiry other_ + if not isinstance(other, VgpuLicenseExpiry): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuLicenseExpiry_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlVgpuLicenseExpiry_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlVgpuLicenseExpiry_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuLicenseExpiry") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuLicenseExpiry_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def year(self): + """int: """ + return self._ptr[0].year + + @year.setter + def year(self, val): + if self._readonly: + raise ValueError("This VgpuLicenseExpiry instance is read-only") + self._ptr[0].year = val + + @property + def month(self): + """int: """ + return self._ptr[0].month + + @month.setter + def month(self, val): + if self._readonly: + raise ValueError("This VgpuLicenseExpiry instance is read-only") + self._ptr[0].month = val + + @property + def day(self): + """int: """ + return self._ptr[0].day + + @day.setter + def day(self, val): + if self._readonly: + raise ValueError("This VgpuLicenseExpiry instance is read-only") + self._ptr[0].day = val + + @property + def hour(self): + """int: """ + return self._ptr[0].hour + + @hour.setter + def hour(self, val): + if self._readonly: + raise ValueError("This VgpuLicenseExpiry instance is read-only") + self._ptr[0].hour = val + + @property + def min_(self): + """int: """ + return self._ptr[0].min + + @min_.setter + def min_(self, val): + if self._readonly: + raise ValueError("This VgpuLicenseExpiry instance is read-only") + self._ptr[0].min = val + + @property + def sec(self): + """int: """ + return self._ptr[0].sec + + @sec.setter + def sec(self, val): + if self._readonly: + raise ValueError("This VgpuLicenseExpiry instance is read-only") + self._ptr[0].sec = val + + @property + def status(self): + """int: """ + return self._ptr[0].status + + @status.setter + def status(self, val): + if self._readonly: + raise ValueError("This VgpuLicenseExpiry instance is read-only") + self._ptr[0].status = val + + @staticmethod + def from_buffer(buffer): + """Create an VgpuLicenseExpiry instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlVgpuLicenseExpiry_t), VgpuLicenseExpiry) + + @staticmethod + def from_data(data): + """Create an VgpuLicenseExpiry instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `vgpu_license_expiry_dtype` holding the data. + """ + return _cyb_from_data(data, "vgpu_license_expiry_dtype", vgpu_license_expiry_dtype, VgpuLicenseExpiry) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an VgpuLicenseExpiry instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef VgpuLicenseExpiry obj = VgpuLicenseExpiry.__new__(VgpuLicenseExpiry) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlVgpuLicenseExpiry_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating VgpuLicenseExpiry") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlVgpuLicenseExpiry_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_grid_license_expiry_dtype_offsets(): + cdef nvmlGridLicenseExpiry_t pod + return _numpy.dtype({ + 'names': ['year', 'month', 'day', 'hour', 'min_', 'sec', 'status'], + 'formats': [_numpy.uint32, _numpy.uint16, _numpy.uint16, _numpy.uint16, _numpy.uint16, _numpy.uint16, _numpy.uint8], + 'offsets': [ + (&(pod.year)) - (&pod), + (&(pod.month)) - (&pod), + (&(pod.day)) - (&pod), + (&(pod.hour)) - (&pod), + (&(pod.min)) - (&pod), + (&(pod.sec)) - (&pod), + (&(pod.status)) - (&pod), + ], + 'itemsize': sizeof(nvmlGridLicenseExpiry_t), + }) + +grid_license_expiry_dtype = _get_grid_license_expiry_dtype_offsets() + +cdef class GridLicenseExpiry: + """Empty-initialize an instance of `nvmlGridLicenseExpiry_t`. + + + .. seealso:: `nvmlGridLicenseExpiry_t` + """ + cdef: + nvmlGridLicenseExpiry_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlGridLicenseExpiry_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating GridLicenseExpiry") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlGridLicenseExpiry_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.GridLicenseExpiry object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef GridLicenseExpiry other_ + if not isinstance(other, GridLicenseExpiry): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlGridLicenseExpiry_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlGridLicenseExpiry_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlGridLicenseExpiry_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating GridLicenseExpiry") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlGridLicenseExpiry_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def year(self): + """int: """ + return self._ptr[0].year + + @year.setter + def year(self, val): + if self._readonly: + raise ValueError("This GridLicenseExpiry instance is read-only") + self._ptr[0].year = val + + @property + def month(self): + """int: """ + return self._ptr[0].month + + @month.setter + def month(self, val): + if self._readonly: + raise ValueError("This GridLicenseExpiry instance is read-only") + self._ptr[0].month = val + + @property + def day(self): + """int: """ + return self._ptr[0].day + + @day.setter + def day(self, val): + if self._readonly: + raise ValueError("This GridLicenseExpiry instance is read-only") + self._ptr[0].day = val + + @property + def hour(self): + """int: """ + return self._ptr[0].hour + + @hour.setter + def hour(self, val): + if self._readonly: + raise ValueError("This GridLicenseExpiry instance is read-only") + self._ptr[0].hour = val + + @property + def min_(self): + """int: """ + return self._ptr[0].min + + @min_.setter + def min_(self, val): + if self._readonly: + raise ValueError("This GridLicenseExpiry instance is read-only") + self._ptr[0].min = val + + @property + def sec(self): + """int: """ + return self._ptr[0].sec + + @sec.setter + def sec(self, val): + if self._readonly: + raise ValueError("This GridLicenseExpiry instance is read-only") + self._ptr[0].sec = val + + @property + def status(self): + """int: """ + return self._ptr[0].status + + @status.setter + def status(self, val): + if self._readonly: + raise ValueError("This GridLicenseExpiry instance is read-only") + self._ptr[0].status = val + + @staticmethod + def from_buffer(buffer): + """Create an GridLicenseExpiry instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlGridLicenseExpiry_t), GridLicenseExpiry) + + @staticmethod + def from_data(data): + """Create an GridLicenseExpiry instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `grid_license_expiry_dtype` holding the data. + """ + return _cyb_from_data(data, "grid_license_expiry_dtype", grid_license_expiry_dtype, GridLicenseExpiry) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an GridLicenseExpiry instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef GridLicenseExpiry obj = GridLicenseExpiry.__new__(GridLicenseExpiry) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlGridLicenseExpiry_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating GridLicenseExpiry") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlGridLicenseExpiry_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_vgpu_type_id_info_v1_dtype_offsets(): + cdef nvmlVgpuTypeIdInfo_v1_t pod + return _numpy.dtype({ + 'names': ['version', 'vgpu_count', 'vgpu_type_ids'], + 'formats': [_numpy.uint32, _numpy.uint32, _numpy.intp], + 'offsets': [ + (&(pod.version)) - (&pod), + (&(pod.vgpuCount)) - (&pod), + (&(pod.vgpuTypeIds)) - (&pod), + ], + 'itemsize': sizeof(nvmlVgpuTypeIdInfo_v1_t), + }) + +vgpu_type_id_info_v1_dtype = _get_vgpu_type_id_info_v1_dtype_offsets() + +cdef class VgpuTypeIdInfo_v1: + """Empty-initialize an instance of `nvmlVgpuTypeIdInfo_v1_t`. + + + .. seealso:: `nvmlVgpuTypeIdInfo_v1_t` + """ + cdef: + nvmlVgpuTypeIdInfo_v1_t *_ptr + object _owner + bint _owned + bint _readonly + dict _refs + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlVgpuTypeIdInfo_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuTypeIdInfo_v1") + self._owner = None + self._owned = True + self._readonly = False + self._refs = {} + + def __dealloc__(self): + cdef nvmlVgpuTypeIdInfo_v1_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.VgpuTypeIdInfo_v1 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef VgpuTypeIdInfo_v1 other_ + if not isinstance(other, VgpuTypeIdInfo_v1): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuTypeIdInfo_v1_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlVgpuTypeIdInfo_v1_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlVgpuTypeIdInfo_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuTypeIdInfo_v1") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuTypeIdInfo_v1_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def version(self): + """int: IN: The version number of this struct.""" + return self._ptr[0].version + + @version.setter + def version(self, val): + if self._readonly: + raise ValueError("This VgpuTypeIdInfo_v1 instance is read-only") + self._ptr[0].version = val + + @property + def vgpu_type_ids(self): + """int: OUT: List of vGPU type IDs.""" + if self._ptr[0].vgpuTypeIds == NULL: + return [] + cdef _cyb_view.array arr = _cyb_view.array(shape=(self._ptr[0].vgpuCount,), itemsize=sizeof(unsigned int), format="I", mode="c", allocate_buffer=False) + arr.data = (self._ptr[0].vgpuTypeIds) + return _numpy.asarray(arr) + + @vgpu_type_ids.setter + def vgpu_type_ids(self, val): + if self._readonly: + raise ValueError("This VgpuTypeIdInfo_v1 instance is read-only") + cdef _cyb_view.array arr = _cyb_view.array(shape=(len(val),), itemsize=sizeof(unsigned int), format="I", mode="c") + arr[:] = _numpy.asarray(val, dtype=_numpy.uint32) + self._ptr[0].vgpuTypeIds = (arr.data) + self._ptr[0].vgpuCount = len(val) + self._refs["vgpu_type_ids"] = arr + + @staticmethod + def from_buffer(buffer): + """Create an VgpuTypeIdInfo_v1 instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlVgpuTypeIdInfo_v1_t), VgpuTypeIdInfo_v1) + + @staticmethod + def from_data(data): + """Create an VgpuTypeIdInfo_v1 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `vgpu_type_id_info_v1_dtype` holding the data. + """ + return _cyb_from_data(data, "vgpu_type_id_info_v1_dtype", vgpu_type_id_info_v1_dtype, VgpuTypeIdInfo_v1) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an VgpuTypeIdInfo_v1 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef VgpuTypeIdInfo_v1 obj = VgpuTypeIdInfo_v1.__new__(VgpuTypeIdInfo_v1) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlVgpuTypeIdInfo_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating VgpuTypeIdInfo_v1") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlVgpuTypeIdInfo_v1_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + obj._refs = {} + return obj + + +cdef _get_active_vgpu_instance_info_v1_dtype_offsets(): + cdef nvmlActiveVgpuInstanceInfo_v1_t pod + return _numpy.dtype({ + 'names': ['version', 'vgpu_count', 'vgpu_instances'], + 'formats': [_numpy.uint32, _numpy.uint32, _numpy.intp], + 'offsets': [ + (&(pod.version)) - (&pod), + (&(pod.vgpuCount)) - (&pod), + (&(pod.vgpuInstances)) - (&pod), + ], + 'itemsize': sizeof(nvmlActiveVgpuInstanceInfo_v1_t), + }) + +active_vgpu_instance_info_v1_dtype = _get_active_vgpu_instance_info_v1_dtype_offsets() + +cdef class ActiveVgpuInstanceInfo_v1: + """Empty-initialize an instance of `nvmlActiveVgpuInstanceInfo_v1_t`. + + + .. seealso:: `nvmlActiveVgpuInstanceInfo_v1_t` + """ + cdef: + nvmlActiveVgpuInstanceInfo_v1_t *_ptr + object _owner + bint _owned + bint _readonly + dict _refs + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlActiveVgpuInstanceInfo_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ActiveVgpuInstanceInfo_v1") + self._owner = None + self._owned = True + self._readonly = False + self._refs = {} + + def __dealloc__(self): + cdef nvmlActiveVgpuInstanceInfo_v1_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.ActiveVgpuInstanceInfo_v1 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef ActiveVgpuInstanceInfo_v1 other_ + if not isinstance(other, ActiveVgpuInstanceInfo_v1): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlActiveVgpuInstanceInfo_v1_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlActiveVgpuInstanceInfo_v1_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlActiveVgpuInstanceInfo_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ActiveVgpuInstanceInfo_v1") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlActiveVgpuInstanceInfo_v1_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def version(self): + """int: IN: The version number of this struct.""" + return self._ptr[0].version + + @version.setter + def version(self, val): + if self._readonly: + raise ValueError("This ActiveVgpuInstanceInfo_v1 instance is read-only") + self._ptr[0].version = val + + @property + def vgpu_instances(self): + """int: IN/OUT: list of active vGPU instances.""" + if self._ptr[0].vgpuInstances == NULL: + return [] + cdef _cyb_view.array arr = _cyb_view.array(shape=(self._ptr[0].vgpuCount,), itemsize=sizeof(unsigned int), format="I", mode="c", allocate_buffer=False) + arr.data = (self._ptr[0].vgpuInstances) + return _numpy.asarray(arr) + + @vgpu_instances.setter + def vgpu_instances(self, val): + if self._readonly: + raise ValueError("This ActiveVgpuInstanceInfo_v1 instance is read-only") + cdef _cyb_view.array arr = _cyb_view.array(shape=(len(val),), itemsize=sizeof(unsigned int), format="I", mode="c") + arr[:] = _numpy.asarray(val, dtype=_numpy.uint32) + self._ptr[0].vgpuInstances = (arr.data) + self._ptr[0].vgpuCount = len(val) + self._refs["vgpu_instances"] = arr + + @staticmethod + def from_buffer(buffer): + """Create an ActiveVgpuInstanceInfo_v1 instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlActiveVgpuInstanceInfo_v1_t), ActiveVgpuInstanceInfo_v1) + + @staticmethod + def from_data(data): + """Create an ActiveVgpuInstanceInfo_v1 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `active_vgpu_instance_info_v1_dtype` holding the data. + """ + return _cyb_from_data(data, "active_vgpu_instance_info_v1_dtype", active_vgpu_instance_info_v1_dtype, ActiveVgpuInstanceInfo_v1) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an ActiveVgpuInstanceInfo_v1 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef ActiveVgpuInstanceInfo_v1 obj = ActiveVgpuInstanceInfo_v1.__new__(ActiveVgpuInstanceInfo_v1) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlActiveVgpuInstanceInfo_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating ActiveVgpuInstanceInfo_v1") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlActiveVgpuInstanceInfo_v1_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + obj._refs = {} + return obj + + +cdef _get_vgpu_creatable_placement_info_v1_dtype_offsets(): + cdef nvmlVgpuCreatablePlacementInfo_v1_t pod + return _numpy.dtype({ + 'names': ['version', 'vgpu_type_id', 'count', 'placement_ids', 'placement_size'], + 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.intp, _numpy.uint32], + 'offsets': [ + (&(pod.version)) - (&pod), + (&(pod.vgpuTypeId)) - (&pod), + (&(pod.count)) - (&pod), + (&(pod.placementIds)) - (&pod), + (&(pod.placementSize)) - (&pod), + ], + 'itemsize': sizeof(nvmlVgpuCreatablePlacementInfo_v1_t), + }) + +vgpu_creatable_placement_info_v1_dtype = _get_vgpu_creatable_placement_info_v1_dtype_offsets() + +cdef class VgpuCreatablePlacementInfo_v1: + """Empty-initialize an instance of `nvmlVgpuCreatablePlacementInfo_v1_t`. + + + .. seealso:: `nvmlVgpuCreatablePlacementInfo_v1_t` + """ + cdef: + nvmlVgpuCreatablePlacementInfo_v1_t *_ptr + object _owner + bint _owned + bint _readonly + dict _refs + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlVgpuCreatablePlacementInfo_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuCreatablePlacementInfo_v1") + self._owner = None + self._owned = True + self._readonly = False + self._refs = {} + + def __dealloc__(self): + cdef nvmlVgpuCreatablePlacementInfo_v1_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.VgpuCreatablePlacementInfo_v1 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef VgpuCreatablePlacementInfo_v1 other_ + if not isinstance(other, VgpuCreatablePlacementInfo_v1): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuCreatablePlacementInfo_v1_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlVgpuCreatablePlacementInfo_v1_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlVgpuCreatablePlacementInfo_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuCreatablePlacementInfo_v1") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuCreatablePlacementInfo_v1_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def version(self): + """int: IN: The version number of this struct.""" + return self._ptr[0].version + + @version.setter + def version(self, val): + if self._readonly: + raise ValueError("This VgpuCreatablePlacementInfo_v1 instance is read-only") + self._ptr[0].version = val + + @property + def vgpu_type_id(self): + """int: IN: Handle to vGPU type.""" + return (self._ptr[0].vgpuTypeId) + + @vgpu_type_id.setter + def vgpu_type_id(self, val): + if self._readonly: + raise ValueError("This VgpuCreatablePlacementInfo_v1 instance is read-only") + self._ptr[0].vgpuTypeId = val + + @property + def count(self): + """int: IN/OUT: Count of the placement IDs.""" + return self._ptr[0].count + + @count.setter + def count(self, val): + if self._readonly: + raise ValueError("This VgpuCreatablePlacementInfo_v1 instance is read-only") + self._ptr[0].count = val + + @property + def placement_ids(self): + """int: IN/OUT: Placement IDs for the vGPU type.""" + if self._ptr[0].placementIds == NULL: + return [] + cdef _cyb_view.array arr = _cyb_view.array(shape=(self._ptr[0].placementSize,), itemsize=sizeof(unsigned int), format="I", mode="c", allocate_buffer=False) + arr.data = (self._ptr[0].placementIds) + return _numpy.asarray(arr) + + @placement_ids.setter + def placement_ids(self, val): + if self._readonly: + raise ValueError("This VgpuCreatablePlacementInfo_v1 instance is read-only") + cdef _cyb_view.array arr = _cyb_view.array(shape=(len(val),), itemsize=sizeof(unsigned int), format="I", mode="c") + arr[:] = _numpy.asarray(val, dtype=_numpy.uint32) + self._ptr[0].placementIds = (arr.data) + self._ptr[0].placementSize = len(val) + self._refs["placement_ids"] = arr + + @staticmethod + def from_buffer(buffer): + """Create an VgpuCreatablePlacementInfo_v1 instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlVgpuCreatablePlacementInfo_v1_t), VgpuCreatablePlacementInfo_v1) + + @staticmethod + def from_data(data): + """Create an VgpuCreatablePlacementInfo_v1 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `vgpu_creatable_placement_info_v1_dtype` holding the data. + """ + return _cyb_from_data(data, "vgpu_creatable_placement_info_v1_dtype", vgpu_creatable_placement_info_v1_dtype, VgpuCreatablePlacementInfo_v1) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an VgpuCreatablePlacementInfo_v1 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef VgpuCreatablePlacementInfo_v1 obj = VgpuCreatablePlacementInfo_v1.__new__(VgpuCreatablePlacementInfo_v1) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlVgpuCreatablePlacementInfo_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating VgpuCreatablePlacementInfo_v1") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlVgpuCreatablePlacementInfo_v1_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + obj._refs = {} + return obj + + +cdef _get_hwbc_entry_dtype_offsets(): + cdef nvmlHwbcEntry_t pod + return _numpy.dtype({ + 'names': ['hwbc_id', 'firmware_version'], + 'formats': [_numpy.uint32, (_numpy.int8, 32)], + 'offsets': [ + (&(pod.hwbcId)) - (&pod), + (&(pod.firmwareVersion)) - (&pod), + ], + 'itemsize': sizeof(nvmlHwbcEntry_t), + }) + +hwbc_entry_dtype = _get_hwbc_entry_dtype_offsets() + +cdef class HwbcEntry: + """Empty-initialize an array of `nvmlHwbcEntry_t`. + The resulting object is of length `size` and of dtype `hwbc_entry_dtype`. + If default-constructed, the instance represents a single struct. + + Args: + size (int): number of structs, default=1. + + .. seealso:: `nvmlHwbcEntry_t` + """ + cdef: + readonly object _data + + def __init__(self, size=1): + arr = _numpy.empty(size, dtype=hwbc_entry_dtype) + self._data = arr.view(_numpy.recarray) + assert self._data.itemsize == sizeof(nvmlHwbcEntry_t), \ + f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlHwbcEntry_t) }" + + def __repr__(self): + if self._data.size > 1: + return f"<{__name__}.HwbcEntry_Array_{self._data.size} object at {hex(id(self))}>" + else: + return f"<{__name__}.HwbcEntry object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return self._data.ctypes.data + + cdef intptr_t _get_ptr(self): + return self._data.ctypes.data + + def __int__(self): + if self._data.size > 1: + raise TypeError("int() argument must be a bytes-like object of size 1. " + "To get the pointer address of an array, use .ptr") + return self._data.ctypes.data + + def __len__(self): + return self._data.size + + def __eq__(self, other): + cdef object self_data = self._data + if (not isinstance(other, HwbcEntry)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype: + return False + return bool((self_data == other._data).all()) + + def __getbuffer__(self, Py_buffer *buffer, int flags): + _cyb_cpython.PyObject_GetBuffer(self._data, buffer, flags) + + def __releasebuffer__(self, Py_buffer *buffer): + _cyb_cpython.PyBuffer_Release(buffer) + + @property + def hwbc_id(self): + """Union[~_numpy.uint32, int]: """ + if self._data.size == 1: + return int(self._data.hwbc_id[0]) + return self._data.hwbc_id + + @hwbc_id.setter + def hwbc_id(self, val): + self._data.hwbc_id = val + + @property + def firmware_version(self): + """~_numpy.int8: (array of length 32).""" + return self._data.firmware_version + + @firmware_version.setter + def firmware_version(self, val): + self._data.firmware_version = val + + def __getitem__(self, key): + cdef ssize_t key_ + cdef ssize_t size + if isinstance(key, int): + key_ = key + size = self._data.size + if key_ >= size or key_ <= -(size+1): + raise IndexError("index is out of bounds") + if key_ < 0: + key_ += size + return HwbcEntry.from_data(self._data[key_:key_+1]) + out = self._data[key] + if isinstance(out, _numpy.recarray) and out.dtype == hwbc_entry_dtype: + return HwbcEntry.from_data(out) + return out + + def __setitem__(self, key, val): + self._data[key] = val + + @staticmethod + def from_buffer(buffer): + """Create an HwbcEntry instance with the memory from the given buffer.""" + return HwbcEntry.from_data(_numpy.frombuffer(buffer, dtype=hwbc_entry_dtype)) + + @staticmethod + def from_data(data): + """Create an HwbcEntry instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a 1D array of dtype `hwbc_entry_dtype` holding the data. + """ + cdef HwbcEntry obj = HwbcEntry.__new__(HwbcEntry) + if not isinstance(data, _numpy.ndarray): + raise TypeError("data argument must be a NumPy ndarray") + if data.ndim != 1: + raise ValueError("data array must be 1D") + if data.dtype != hwbc_entry_dtype: + raise ValueError("data array must be of dtype hwbc_entry_dtype") + obj._data = data.view(_numpy.recarray) + + return obj + + @staticmethod + def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False): + """Create an HwbcEntry instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + size (int): number of structs, default=1. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef HwbcEntry obj = HwbcEntry.__new__(HwbcEntry) + cdef flag = _cyb_cpython_buffer.PyBUF_READ if readonly else _cyb_cpython_buffer.PyBUF_WRITE + cdef object buf = _cyb_cpython_memoryview.PyMemoryView_FromMemory( + ptr, sizeof(nvmlHwbcEntry_t) * size, flag) + data = _numpy.ndarray(size, buffer=buf, dtype=hwbc_entry_dtype) + obj._data = data.view(_numpy.recarray) + + return obj + + +cdef _get_led_state_dtype_offsets(): + cdef nvmlLedState_t pod + return _numpy.dtype({ + 'names': ['cause', 'color'], + 'formats': [(_numpy.int8, 256), _numpy.int32], + 'offsets': [ + (&(pod.cause)) - (&pod), + (&(pod.color)) - (&pod), + ], + 'itemsize': sizeof(nvmlLedState_t), + }) + +led_state_dtype = _get_led_state_dtype_offsets() + +cdef class LedState: + """Empty-initialize an instance of `nvmlLedState_t`. + + + .. seealso:: `nvmlLedState_t` + """ + cdef: + nvmlLedState_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlLedState_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating LedState") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlLedState_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.LedState object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef LedState other_ + if not isinstance(other, LedState): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlLedState_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlLedState_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlLedState_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating LedState") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlLedState_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def cause(self): + """~_numpy.int8: (array of length 256).""" + return _cyb_cpython.PyUnicode_FromString(self._ptr[0].cause) + + @cause.setter + def cause(self, val): + if self._readonly: + raise ValueError("This LedState instance is read-only") + cdef bytes buf = val.encode() + if len(buf) >= 256: + raise ValueError("String too long for field cause, max length is 255") + cdef char *ptr = buf + _cyb_memcpy((self._ptr[0].cause), ptr, 256) + + @property + def color(self): + """int: """ + return (self._ptr[0].color) + + @color.setter + def color(self, val): + if self._readonly: + raise ValueError("This LedState instance is read-only") + self._ptr[0].color = val + + @staticmethod + def from_buffer(buffer): + """Create an LedState instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlLedState_t), LedState) + + @staticmethod + def from_data(data): + """Create an LedState instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `led_state_dtype` holding the data. + """ + return _cyb_from_data(data, "led_state_dtype", led_state_dtype, LedState) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an LedState instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef LedState obj = LedState.__new__(LedState) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlLedState_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating LedState") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlLedState_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_unit_info_dtype_offsets(): + cdef nvmlUnitInfo_t pod + return _numpy.dtype({ + 'names': ['name', 'id', 'serial', 'firmware_version'], + 'formats': [(_numpy.int8, 96), (_numpy.int8, 96), (_numpy.int8, 96), (_numpy.int8, 96)], + 'offsets': [ + (&(pod.name)) - (&pod), + (&(pod.id)) - (&pod), + (&(pod.serial)) - (&pod), + (&(pod.firmwareVersion)) - (&pod), + ], + 'itemsize': sizeof(nvmlUnitInfo_t), + }) + +unit_info_dtype = _get_unit_info_dtype_offsets() + +cdef class UnitInfo: + """Empty-initialize an instance of `nvmlUnitInfo_t`. + + + .. seealso:: `nvmlUnitInfo_t` + """ + cdef: + nvmlUnitInfo_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlUnitInfo_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating UnitInfo") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlUnitInfo_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.UnitInfo object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef UnitInfo other_ + if not isinstance(other, UnitInfo): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlUnitInfo_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlUnitInfo_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlUnitInfo_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating UnitInfo") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlUnitInfo_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def name(self): + """~_numpy.int8: (array of length 96).""" + return _cyb_cpython.PyUnicode_FromString(self._ptr[0].name) + + @name.setter + def name(self, val): + if self._readonly: + raise ValueError("This UnitInfo instance is read-only") + cdef bytes buf = val.encode() + if len(buf) >= 96: + raise ValueError("String too long for field name, max length is 95") + cdef char *ptr = buf + _cyb_memcpy((self._ptr[0].name), ptr, 96) + + @property + def id(self): + """~_numpy.int8: (array of length 96).""" + return _cyb_cpython.PyUnicode_FromString(self._ptr[0].id) + + @id.setter + def id(self, val): + if self._readonly: + raise ValueError("This UnitInfo instance is read-only") + cdef bytes buf = val.encode() + if len(buf) >= 96: + raise ValueError("String too long for field id, max length is 95") + cdef char *ptr = buf + _cyb_memcpy((self._ptr[0].id), ptr, 96) + + @property + def serial(self): + """~_numpy.int8: (array of length 96).""" + return _cyb_cpython.PyUnicode_FromString(self._ptr[0].serial) + + @serial.setter + def serial(self, val): + if self._readonly: + raise ValueError("This UnitInfo instance is read-only") + cdef bytes buf = val.encode() + if len(buf) >= 96: + raise ValueError("String too long for field serial, max length is 95") + cdef char *ptr = buf + _cyb_memcpy((self._ptr[0].serial), ptr, 96) + + @property + def firmware_version(self): + """~_numpy.int8: (array of length 96).""" + return _cyb_cpython.PyUnicode_FromString(self._ptr[0].firmwareVersion) + + @firmware_version.setter + def firmware_version(self, val): + if self._readonly: + raise ValueError("This UnitInfo instance is read-only") + cdef bytes buf = val.encode() + if len(buf) >= 96: + raise ValueError("String too long for field firmware_version, max length is 95") + cdef char *ptr = buf + _cyb_memcpy((self._ptr[0].firmwareVersion), ptr, 96) + + @staticmethod + def from_buffer(buffer): + """Create an UnitInfo instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlUnitInfo_t), UnitInfo) + + @staticmethod + def from_data(data): + """Create an UnitInfo instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `unit_info_dtype` holding the data. + """ + return _cyb_from_data(data, "unit_info_dtype", unit_info_dtype, UnitInfo) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an UnitInfo instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef UnitInfo obj = UnitInfo.__new__(UnitInfo) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlUnitInfo_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating UnitInfo") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlUnitInfo_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_psu_info_dtype_offsets(): + cdef nvmlPSUInfo_t pod + return _numpy.dtype({ + 'names': ['state', 'current', 'voltage', 'power'], + 'formats': [(_numpy.int8, 256), _numpy.uint32, _numpy.uint32, _numpy.uint32], + 'offsets': [ + (&(pod.state)) - (&pod), + (&(pod.current)) - (&pod), + (&(pod.voltage)) - (&pod), + (&(pod.power)) - (&pod), + ], + 'itemsize': sizeof(nvmlPSUInfo_t), + }) + +psu_info_dtype = _get_psu_info_dtype_offsets() + +cdef class PSUInfo: + """Empty-initialize an instance of `nvmlPSUInfo_t`. + + + .. seealso:: `nvmlPSUInfo_t` + """ + cdef: + nvmlPSUInfo_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlPSUInfo_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating PSUInfo") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlPSUInfo_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.PSUInfo object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef PSUInfo other_ + if not isinstance(other, PSUInfo): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlPSUInfo_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlPSUInfo_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlPSUInfo_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating PSUInfo") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlPSUInfo_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def state(self): + """~_numpy.int8: (array of length 256).""" + return _cyb_cpython.PyUnicode_FromString(self._ptr[0].state) + + @state.setter + def state(self, val): + if self._readonly: + raise ValueError("This PSUInfo instance is read-only") + cdef bytes buf = val.encode() + if len(buf) >= 256: + raise ValueError("String too long for field state, max length is 255") + cdef char *ptr = buf + _cyb_memcpy((self._ptr[0].state), ptr, 256) + + @property + def current(self): + """int: """ + return self._ptr[0].current + + @current.setter + def current(self, val): + if self._readonly: + raise ValueError("This PSUInfo instance is read-only") + self._ptr[0].current = val + + @property + def voltage(self): + """int: """ + return self._ptr[0].voltage + + @voltage.setter + def voltage(self, val): + if self._readonly: + raise ValueError("This PSUInfo instance is read-only") + self._ptr[0].voltage = val + + @property + def power(self): + """int: """ + return self._ptr[0].power + + @power.setter + def power(self, val): + if self._readonly: + raise ValueError("This PSUInfo instance is read-only") + self._ptr[0].power = val + + @staticmethod + def from_buffer(buffer): + """Create an PSUInfo instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlPSUInfo_t), PSUInfo) + + @staticmethod + def from_data(data): + """Create an PSUInfo instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `psu_info_dtype` holding the data. + """ + return _cyb_from_data(data, "psu_info_dtype", psu_info_dtype, PSUInfo) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an PSUInfo instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef PSUInfo obj = PSUInfo.__new__(PSUInfo) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlPSUInfo_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating PSUInfo") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlPSUInfo_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_unit_fan_info_dtype_offsets(): + cdef nvmlUnitFanInfo_t pod + return _numpy.dtype({ + 'names': ['speed', 'state'], + 'formats': [_numpy.uint32, _numpy.int32], + 'offsets': [ + (&(pod.speed)) - (&pod), + (&(pod.state)) - (&pod), + ], + 'itemsize': sizeof(nvmlUnitFanInfo_t), + }) + +unit_fan_info_dtype = _get_unit_fan_info_dtype_offsets() + +cdef class UnitFanInfo: + """Empty-initialize an array of `nvmlUnitFanInfo_t`. + The resulting object is of length `size` and of dtype `unit_fan_info_dtype`. + If default-constructed, the instance represents a single struct. + + Args: + size (int): number of structs, default=1. + + .. seealso:: `nvmlUnitFanInfo_t` + """ + cdef: + readonly object _data + + def __init__(self, size=1): + arr = _numpy.empty(size, dtype=unit_fan_info_dtype) + self._data = arr.view(_numpy.recarray) + assert self._data.itemsize == sizeof(nvmlUnitFanInfo_t), \ + f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlUnitFanInfo_t) }" + + def __repr__(self): + if self._data.size > 1: + return f"<{__name__}.UnitFanInfo_Array_{self._data.size} object at {hex(id(self))}>" + else: + return f"<{__name__}.UnitFanInfo object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return self._data.ctypes.data + + cdef intptr_t _get_ptr(self): + return self._data.ctypes.data + + def __int__(self): + if self._data.size > 1: + raise TypeError("int() argument must be a bytes-like object of size 1. " + "To get the pointer address of an array, use .ptr") + return self._data.ctypes.data + + def __len__(self): + return self._data.size + + def __eq__(self, other): + cdef object self_data = self._data + if (not isinstance(other, UnitFanInfo)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype: + return False + return bool((self_data == other._data).all()) + + def __getbuffer__(self, Py_buffer *buffer, int flags): + _cyb_cpython.PyObject_GetBuffer(self._data, buffer, flags) + + def __releasebuffer__(self, Py_buffer *buffer): + _cyb_cpython.PyBuffer_Release(buffer) + + @property + def speed(self): + """Union[~_numpy.uint32, int]: """ + if self._data.size == 1: + return int(self._data.speed[0]) + return self._data.speed + + @speed.setter + def speed(self, val): + self._data.speed = val + + @property + def state(self): + """Union[~_numpy.int32, int]: """ + if self._data.size == 1: + return int(self._data.state[0]) + return self._data.state + + @state.setter + def state(self, val): + self._data.state = val + + def __getitem__(self, key): + cdef ssize_t key_ + cdef ssize_t size + if isinstance(key, int): + key_ = key + size = self._data.size + if key_ >= size or key_ <= -(size+1): + raise IndexError("index is out of bounds") + if key_ < 0: + key_ += size + return UnitFanInfo.from_data(self._data[key_:key_+1]) + out = self._data[key] + if isinstance(out, _numpy.recarray) and out.dtype == unit_fan_info_dtype: + return UnitFanInfo.from_data(out) + return out + + def __setitem__(self, key, val): + self._data[key] = val + + @staticmethod + def from_buffer(buffer): + """Create an UnitFanInfo instance with the memory from the given buffer.""" + return UnitFanInfo.from_data(_numpy.frombuffer(buffer, dtype=unit_fan_info_dtype)) + + @staticmethod + def from_data(data): + """Create an UnitFanInfo instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a 1D array of dtype `unit_fan_info_dtype` holding the data. + """ + cdef UnitFanInfo obj = UnitFanInfo.__new__(UnitFanInfo) + if not isinstance(data, _numpy.ndarray): + raise TypeError("data argument must be a NumPy ndarray") + if data.ndim != 1: + raise ValueError("data array must be 1D") + if data.dtype != unit_fan_info_dtype: + raise ValueError("data array must be of dtype unit_fan_info_dtype") + obj._data = data.view(_numpy.recarray) + + return obj + + @staticmethod + def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False): + """Create an UnitFanInfo instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + size (int): number of structs, default=1. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef UnitFanInfo obj = UnitFanInfo.__new__(UnitFanInfo) + cdef flag = _cyb_cpython_buffer.PyBUF_READ if readonly else _cyb_cpython_buffer.PyBUF_WRITE + cdef object buf = _cyb_cpython_memoryview.PyMemoryView_FromMemory( + ptr, sizeof(nvmlUnitFanInfo_t) * size, flag) + data = _numpy.ndarray(size, buffer=buf, dtype=unit_fan_info_dtype) + obj._data = data.view(_numpy.recarray) + + return obj + + +cdef _get_event_data_dtype_offsets(): + cdef nvmlEventData_t pod + return _numpy.dtype({ + 'names': ['device_', 'event_type', 'event_data', 'gpu_instance_id', 'compute_instance_id'], + 'formats': [_numpy.intp, _numpy.uint64, _numpy.uint64, _numpy.uint32, _numpy.uint32], + 'offsets': [ + (&(pod.device)) - (&pod), + (&(pod.eventType)) - (&pod), + (&(pod.eventData)) - (&pod), + (&(pod.gpuInstanceId)) - (&pod), + (&(pod.computeInstanceId)) - (&pod), + ], + 'itemsize': sizeof(nvmlEventData_t), + }) + +event_data_dtype = _get_event_data_dtype_offsets() + +cdef class EventData: + """Empty-initialize an instance of `nvmlEventData_t`. + + + .. seealso:: `nvmlEventData_t` + """ + cdef: + nvmlEventData_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlEventData_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating EventData") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlEventData_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.EventData object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef EventData other_ + if not isinstance(other, EventData): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlEventData_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlEventData_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlEventData_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating EventData") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlEventData_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def device_(self): + """int: """ + return (self._ptr[0].device) + + @device_.setter + def device_(self, val): + if self._readonly: + raise ValueError("This EventData instance is read-only") + self._ptr[0].device = val + + @property + def event_type(self): + """int: """ + return self._ptr[0].eventType + + @event_type.setter + def event_type(self, val): + if self._readonly: + raise ValueError("This EventData instance is read-only") + self._ptr[0].eventType = val + + @property + def event_data(self): + """int: """ + return self._ptr[0].eventData + + @event_data.setter + def event_data(self, val): + if self._readonly: + raise ValueError("This EventData instance is read-only") + self._ptr[0].eventData = val + + @property + def gpu_instance_id(self): + """int: """ + return self._ptr[0].gpuInstanceId + + @gpu_instance_id.setter + def gpu_instance_id(self, val): + if self._readonly: + raise ValueError("This EventData instance is read-only") + self._ptr[0].gpuInstanceId = val + + @property + def compute_instance_id(self): + """int: """ + return self._ptr[0].computeInstanceId + + @compute_instance_id.setter + def compute_instance_id(self, val): + if self._readonly: + raise ValueError("This EventData instance is read-only") + self._ptr[0].computeInstanceId = val + + @staticmethod + def from_buffer(buffer): + """Create an EventData instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlEventData_t), EventData) + + @staticmethod + def from_data(data): + """Create an EventData instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `event_data_dtype` holding the data. + """ + return _cyb_from_data(data, "event_data_dtype", event_data_dtype, EventData) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an EventData instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef EventData obj = EventData.__new__(EventData) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlEventData_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating EventData") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlEventData_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_system_event_data_v1_dtype_offsets(): + cdef nvmlSystemEventData_v1_t pod + return _numpy.dtype({ + 'names': ['event_type', 'gpu_id'], + 'formats': [_numpy.uint64, _numpy.uint32], + 'offsets': [ + (&(pod.eventType)) - (&pod), + (&(pod.gpuId)) - (&pod), + ], + 'itemsize': sizeof(nvmlSystemEventData_v1_t), + }) + +system_event_data_v1_dtype = _get_system_event_data_v1_dtype_offsets() + +cdef class SystemEventData_v1: + """Empty-initialize an array of `nvmlSystemEventData_v1_t`. + The resulting object is of length `size` and of dtype `system_event_data_v1_dtype`. + If default-constructed, the instance represents a single struct. + + Args: + size (int): number of structs, default=1. + + .. seealso:: `nvmlSystemEventData_v1_t` + """ + cdef: + readonly object _data + + def __init__(self, size=1): + arr = _numpy.empty(size, dtype=system_event_data_v1_dtype) + self._data = arr.view(_numpy.recarray) + assert self._data.itemsize == sizeof(nvmlSystemEventData_v1_t), \ + f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlSystemEventData_v1_t) }" + + def __repr__(self): + if self._data.size > 1: + return f"<{__name__}.SystemEventData_v1_Array_{self._data.size} object at {hex(id(self))}>" + else: + return f"<{__name__}.SystemEventData_v1 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return self._data.ctypes.data + + cdef intptr_t _get_ptr(self): + return self._data.ctypes.data + + def __int__(self): + if self._data.size > 1: + raise TypeError("int() argument must be a bytes-like object of size 1. " + "To get the pointer address of an array, use .ptr") + return self._data.ctypes.data + + def __len__(self): + return self._data.size + + def __eq__(self, other): + cdef object self_data = self._data + if (not isinstance(other, SystemEventData_v1)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype: + return False + return bool((self_data == other._data).all()) + + def __getbuffer__(self, Py_buffer *buffer, int flags): + _cyb_cpython.PyObject_GetBuffer(self._data, buffer, flags) + + def __releasebuffer__(self, Py_buffer *buffer): + _cyb_cpython.PyBuffer_Release(buffer) + + @property + def event_type(self): + """Union[~_numpy.uint64, int]: Information about what specific system event occurred.""" + if self._data.size == 1: + return int(self._data.event_type[0]) + return self._data.event_type + + @event_type.setter + def event_type(self, val): + self._data.event_type = val + + @property + def gpu_id(self): + """Union[~_numpy.uint32, int]: gpuId in PCI format""" + if self._data.size == 1: + return int(self._data.gpu_id[0]) + return self._data.gpu_id + + @gpu_id.setter + def gpu_id(self, val): + self._data.gpu_id = val + + def __getitem__(self, key): + cdef ssize_t key_ + cdef ssize_t size + if isinstance(key, int): + key_ = key + size = self._data.size + if key_ >= size or key_ <= -(size+1): + raise IndexError("index is out of bounds") + if key_ < 0: + key_ += size + return SystemEventData_v1.from_data(self._data[key_:key_+1]) + out = self._data[key] + if isinstance(out, _numpy.recarray) and out.dtype == system_event_data_v1_dtype: + return SystemEventData_v1.from_data(out) + return out + + def __setitem__(self, key, val): + self._data[key] = val + + @staticmethod + def from_buffer(buffer): + """Create an SystemEventData_v1 instance with the memory from the given buffer.""" + return SystemEventData_v1.from_data(_numpy.frombuffer(buffer, dtype=system_event_data_v1_dtype)) + + @staticmethod + def from_data(data): + """Create an SystemEventData_v1 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a 1D array of dtype `system_event_data_v1_dtype` holding the data. + """ + cdef SystemEventData_v1 obj = SystemEventData_v1.__new__(SystemEventData_v1) + if not isinstance(data, _numpy.ndarray): + raise TypeError("data argument must be a NumPy ndarray") + if data.ndim != 1: + raise ValueError("data array must be 1D") + if data.dtype != system_event_data_v1_dtype: + raise ValueError("data array must be of dtype system_event_data_v1_dtype") + obj._data = data.view(_numpy.recarray) + + return obj + + @staticmethod + def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False): + """Create an SystemEventData_v1 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + size (int): number of structs, default=1. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef SystemEventData_v1 obj = SystemEventData_v1.__new__(SystemEventData_v1) + cdef flag = _cyb_cpython_buffer.PyBUF_READ if readonly else _cyb_cpython_buffer.PyBUF_WRITE + cdef object buf = _cyb_cpython_memoryview.PyMemoryView_FromMemory( + ptr, sizeof(nvmlSystemEventData_v1_t) * size, flag) + data = _numpy.ndarray(size, buffer=buf, dtype=system_event_data_v1_dtype) + obj._data = data.view(_numpy.recarray) + + return obj + + +cdef _get_accounting_stats_dtype_offsets(): + cdef nvmlAccountingStats_t pod + return _numpy.dtype({ + 'names': ['gpu_utilization', 'memory_utilization', 'max_memory_usage', 'time', 'start_time', 'is_running', 'reserved'], + 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint32, (_numpy.uint32, 5)], + 'offsets': [ + (&(pod.gpuUtilization)) - (&pod), + (&(pod.memoryUtilization)) - (&pod), + (&(pod.maxMemoryUsage)) - (&pod), + (&(pod.time)) - (&pod), + (&(pod.startTime)) - (&pod), + (&(pod.isRunning)) - (&pod), + (&(pod.reserved)) - (&pod), + ], + 'itemsize': sizeof(nvmlAccountingStats_t), + }) + +accounting_stats_dtype = _get_accounting_stats_dtype_offsets() + +cdef class AccountingStats: + """Empty-initialize an instance of `nvmlAccountingStats_t`. + + + .. seealso:: `nvmlAccountingStats_t` + """ + cdef: + nvmlAccountingStats_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlAccountingStats_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating AccountingStats") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlAccountingStats_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.AccountingStats object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef AccountingStats other_ + if not isinstance(other, AccountingStats): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlAccountingStats_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlAccountingStats_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlAccountingStats_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating AccountingStats") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlAccountingStats_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def gpu_utilization(self): + """int: """ + return self._ptr[0].gpuUtilization + + @gpu_utilization.setter + def gpu_utilization(self, val): + if self._readonly: + raise ValueError("This AccountingStats instance is read-only") + self._ptr[0].gpuUtilization = val + + @property + def memory_utilization(self): + """int: """ + return self._ptr[0].memoryUtilization + + @memory_utilization.setter + def memory_utilization(self, val): + if self._readonly: + raise ValueError("This AccountingStats instance is read-only") + self._ptr[0].memoryUtilization = val + + @property + def max_memory_usage(self): + """int: """ + return self._ptr[0].maxMemoryUsage + + @max_memory_usage.setter + def max_memory_usage(self, val): + if self._readonly: + raise ValueError("This AccountingStats instance is read-only") + self._ptr[0].maxMemoryUsage = val + + @property + def time(self): + """int: """ + return self._ptr[0].time + + @time.setter + def time(self, val): + if self._readonly: + raise ValueError("This AccountingStats instance is read-only") + self._ptr[0].time = val + + @property + def start_time(self): + """int: """ + return self._ptr[0].startTime + + @start_time.setter + def start_time(self, val): + if self._readonly: + raise ValueError("This AccountingStats instance is read-only") + self._ptr[0].startTime = val + + @property + def is_running(self): + """int: """ + return self._ptr[0].isRunning + + @is_running.setter + def is_running(self, val): + if self._readonly: + raise ValueError("This AccountingStats instance is read-only") + self._ptr[0].isRunning = val + + @staticmethod + def from_buffer(buffer): + """Create an AccountingStats instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlAccountingStats_t), AccountingStats) + + @staticmethod + def from_data(data): + """Create an AccountingStats instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `accounting_stats_dtype` holding the data. + """ + return _cyb_from_data(data, "accounting_stats_dtype", accounting_stats_dtype, AccountingStats) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an AccountingStats instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef AccountingStats obj = AccountingStats.__new__(AccountingStats) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlAccountingStats_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating AccountingStats") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlAccountingStats_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_encoder_session_info_dtype_offsets(): + cdef nvmlEncoderSessionInfo_t pod + return _numpy.dtype({ + 'names': ['session_id', 'pid', 'vgpu_instance', 'codec_type', 'h_resolution', 'v_resolution', 'average_fps', 'average_latency'], + 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.int32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32], + 'offsets': [ + (&(pod.sessionId)) - (&pod), + (&(pod.pid)) - (&pod), + (&(pod.vgpuInstance)) - (&pod), + (&(pod.codecType)) - (&pod), + (&(pod.hResolution)) - (&pod), + (&(pod.vResolution)) - (&pod), + (&(pod.averageFps)) - (&pod), + (&(pod.averageLatency)) - (&pod), + ], + 'itemsize': sizeof(nvmlEncoderSessionInfo_t), + }) + +encoder_session_info_dtype = _get_encoder_session_info_dtype_offsets() + +cdef class EncoderSessionInfo: + """Empty-initialize an array of `nvmlEncoderSessionInfo_t`. + The resulting object is of length `size` and of dtype `encoder_session_info_dtype`. + If default-constructed, the instance represents a single struct. + + Args: + size (int): number of structs, default=1. + + .. seealso:: `nvmlEncoderSessionInfo_t` + """ + cdef: + readonly object _data + + def __init__(self, size=1): + arr = _numpy.empty(size, dtype=encoder_session_info_dtype) + self._data = arr.view(_numpy.recarray) + assert self._data.itemsize == sizeof(nvmlEncoderSessionInfo_t), \ + f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlEncoderSessionInfo_t) }" + + def __repr__(self): + if self._data.size > 1: + return f"<{__name__}.EncoderSessionInfo_Array_{self._data.size} object at {hex(id(self))}>" + else: + return f"<{__name__}.EncoderSessionInfo object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return self._data.ctypes.data + + cdef intptr_t _get_ptr(self): + return self._data.ctypes.data + + def __int__(self): + if self._data.size > 1: + raise TypeError("int() argument must be a bytes-like object of size 1. " + "To get the pointer address of an array, use .ptr") + return self._data.ctypes.data + + def __len__(self): + return self._data.size + + def __eq__(self, other): + cdef object self_data = self._data + if (not isinstance(other, EncoderSessionInfo)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype: + return False + return bool((self_data == other._data).all()) + + def __getbuffer__(self, Py_buffer *buffer, int flags): + _cyb_cpython.PyObject_GetBuffer(self._data, buffer, flags) + + def __releasebuffer__(self, Py_buffer *buffer): + _cyb_cpython.PyBuffer_Release(buffer) + + @property + def session_id(self): + """Union[~_numpy.uint32, int]: """ + if self._data.size == 1: + return int(self._data.session_id[0]) + return self._data.session_id + + @session_id.setter + def session_id(self, val): + self._data.session_id = val + + @property + def pid(self): + """Union[~_numpy.uint32, int]: """ + if self._data.size == 1: + return int(self._data.pid[0]) + return self._data.pid + + @pid.setter + def pid(self, val): + self._data.pid = val + + @property + def vgpu_instance(self): + """Union[~_numpy.uint32, int]: """ + if self._data.size == 1: + return int(self._data.vgpu_instance[0]) + return self._data.vgpu_instance + + @vgpu_instance.setter + def vgpu_instance(self, val): + self._data.vgpu_instance = val + + @property + def codec_type(self): + """Union[~_numpy.int32, int]: """ + if self._data.size == 1: + return int(self._data.codec_type[0]) + return self._data.codec_type + + @codec_type.setter + def codec_type(self, val): + self._data.codec_type = val + + @property + def h_resolution(self): + """Union[~_numpy.uint32, int]: """ + if self._data.size == 1: + return int(self._data.h_resolution[0]) + return self._data.h_resolution + + @h_resolution.setter + def h_resolution(self, val): + self._data.h_resolution = val + + @property + def v_resolution(self): + """Union[~_numpy.uint32, int]: """ + if self._data.size == 1: + return int(self._data.v_resolution[0]) + return self._data.v_resolution + + @v_resolution.setter + def v_resolution(self, val): + self._data.v_resolution = val + + @property + def average_fps(self): + """Union[~_numpy.uint32, int]: """ + if self._data.size == 1: + return int(self._data.average_fps[0]) + return self._data.average_fps + + @average_fps.setter + def average_fps(self, val): + self._data.average_fps = val + + @property + def average_latency(self): + """Union[~_numpy.uint32, int]: """ + if self._data.size == 1: + return int(self._data.average_latency[0]) + return self._data.average_latency + + @average_latency.setter + def average_latency(self, val): + self._data.average_latency = val + + def __getitem__(self, key): + cdef ssize_t key_ + cdef ssize_t size + if isinstance(key, int): + key_ = key + size = self._data.size + if key_ >= size or key_ <= -(size+1): + raise IndexError("index is out of bounds") + if key_ < 0: + key_ += size + return EncoderSessionInfo.from_data(self._data[key_:key_+1]) + out = self._data[key] + if isinstance(out, _numpy.recarray) and out.dtype == encoder_session_info_dtype: + return EncoderSessionInfo.from_data(out) + return out + + def __setitem__(self, key, val): + self._data[key] = val + + @staticmethod + def from_buffer(buffer): + """Create an EncoderSessionInfo instance with the memory from the given buffer.""" + return EncoderSessionInfo.from_data(_numpy.frombuffer(buffer, dtype=encoder_session_info_dtype)) + + @staticmethod + def from_data(data): + """Create an EncoderSessionInfo instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a 1D array of dtype `encoder_session_info_dtype` holding the data. + """ + cdef EncoderSessionInfo obj = EncoderSessionInfo.__new__(EncoderSessionInfo) + if not isinstance(data, _numpy.ndarray): + raise TypeError("data argument must be a NumPy ndarray") + if data.ndim != 1: + raise ValueError("data array must be 1D") + if data.dtype != encoder_session_info_dtype: + raise ValueError("data array must be of dtype encoder_session_info_dtype") + obj._data = data.view(_numpy.recarray) + + return obj + + @staticmethod + def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False): + """Create an EncoderSessionInfo instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + size (int): number of structs, default=1. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef EncoderSessionInfo obj = EncoderSessionInfo.__new__(EncoderSessionInfo) + cdef flag = _cyb_cpython_buffer.PyBUF_READ if readonly else _cyb_cpython_buffer.PyBUF_WRITE + cdef object buf = _cyb_cpython_memoryview.PyMemoryView_FromMemory( + ptr, sizeof(nvmlEncoderSessionInfo_t) * size, flag) + data = _numpy.ndarray(size, buffer=buf, dtype=encoder_session_info_dtype) + obj._data = data.view(_numpy.recarray) + + return obj + + +cdef _get_fbc_stats_dtype_offsets(): + cdef nvmlFBCStats_t pod + return _numpy.dtype({ + 'names': ['sessions_count', 'average_fps', 'average_latency'], + 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32], + 'offsets': [ + (&(pod.sessionsCount)) - (&pod), + (&(pod.averageFPS)) - (&pod), + (&(pod.averageLatency)) - (&pod), + ], + 'itemsize': sizeof(nvmlFBCStats_t), + }) + +fbc_stats_dtype = _get_fbc_stats_dtype_offsets() + +cdef class FBCStats: + """Empty-initialize an instance of `nvmlFBCStats_t`. + + + .. seealso:: `nvmlFBCStats_t` + """ + cdef: + nvmlFBCStats_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlFBCStats_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating FBCStats") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlFBCStats_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.FBCStats object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef FBCStats other_ + if not isinstance(other, FBCStats): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlFBCStats_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlFBCStats_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlFBCStats_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating FBCStats") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlFBCStats_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def sessions_count(self): + """int: """ + return self._ptr[0].sessionsCount + + @sessions_count.setter + def sessions_count(self, val): + if self._readonly: + raise ValueError("This FBCStats instance is read-only") + self._ptr[0].sessionsCount = val + + @property + def average_fps(self): + """int: """ + return self._ptr[0].averageFPS + + @average_fps.setter + def average_fps(self, val): + if self._readonly: + raise ValueError("This FBCStats instance is read-only") + self._ptr[0].averageFPS = val + + @property + def average_latency(self): + """int: """ + return self._ptr[0].averageLatency + + @average_latency.setter + def average_latency(self, val): + if self._readonly: + raise ValueError("This FBCStats instance is read-only") + self._ptr[0].averageLatency = val + + @staticmethod + def from_buffer(buffer): + """Create an FBCStats instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlFBCStats_t), FBCStats) + + @staticmethod + def from_data(data): + """Create an FBCStats instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `fbc_stats_dtype` holding the data. + """ + return _cyb_from_data(data, "fbc_stats_dtype", fbc_stats_dtype, FBCStats) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an FBCStats instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef FBCStats obj = FBCStats.__new__(FBCStats) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlFBCStats_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating FBCStats") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlFBCStats_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_fbc_session_info_dtype_offsets(): + cdef nvmlFBCSessionInfo_t pod + return _numpy.dtype({ + 'names': ['session_id', 'pid', 'vgpu_instance', 'display_ordinal', 'session_type', 'session_flags', 'h_max_resolution', 'v_max_resolution', 'h_resolution', 'v_resolution', 'average_fps', 'average_latency'], + 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.int32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32], + 'offsets': [ + (&(pod.sessionId)) - (&pod), + (&(pod.pid)) - (&pod), + (&(pod.vgpuInstance)) - (&pod), + (&(pod.displayOrdinal)) - (&pod), + (&(pod.sessionType)) - (&pod), + (&(pod.sessionFlags)) - (&pod), + (&(pod.hMaxResolution)) - (&pod), + (&(pod.vMaxResolution)) - (&pod), + (&(pod.hResolution)) - (&pod), + (&(pod.vResolution)) - (&pod), + (&(pod.averageFPS)) - (&pod), + (&(pod.averageLatency)) - (&pod), + ], + 'itemsize': sizeof(nvmlFBCSessionInfo_t), + }) + +fbc_session_info_dtype = _get_fbc_session_info_dtype_offsets() + +cdef class FBCSessionInfo: + """Empty-initialize an array of `nvmlFBCSessionInfo_t`. + The resulting object is of length `size` and of dtype `fbc_session_info_dtype`. + If default-constructed, the instance represents a single struct. + + Args: + size (int): number of structs, default=1. + + .. seealso:: `nvmlFBCSessionInfo_t` + """ + cdef: + readonly object _data + + def __init__(self, size=1): + arr = _numpy.empty(size, dtype=fbc_session_info_dtype) + self._data = arr.view(_numpy.recarray) + assert self._data.itemsize == sizeof(nvmlFBCSessionInfo_t), \ + f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlFBCSessionInfo_t) }" + + def __repr__(self): + if self._data.size > 1: + return f"<{__name__}.FBCSessionInfo_Array_{self._data.size} object at {hex(id(self))}>" + else: + return f"<{__name__}.FBCSessionInfo object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return self._data.ctypes.data + + cdef intptr_t _get_ptr(self): + return self._data.ctypes.data + + def __int__(self): + if self._data.size > 1: + raise TypeError("int() argument must be a bytes-like object of size 1. " + "To get the pointer address of an array, use .ptr") + return self._data.ctypes.data + + def __len__(self): + return self._data.size + + def __eq__(self, other): + cdef object self_data = self._data + if (not isinstance(other, FBCSessionInfo)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype: + return False + return bool((self_data == other._data).all()) + + def __getbuffer__(self, Py_buffer *buffer, int flags): + _cyb_cpython.PyObject_GetBuffer(self._data, buffer, flags) + + def __releasebuffer__(self, Py_buffer *buffer): + _cyb_cpython.PyBuffer_Release(buffer) + + @property + def session_id(self): + """Union[~_numpy.uint32, int]: """ + if self._data.size == 1: + return int(self._data.session_id[0]) + return self._data.session_id + + @session_id.setter + def session_id(self, val): + self._data.session_id = val + + @property + def pid(self): + """Union[~_numpy.uint32, int]: """ + if self._data.size == 1: + return int(self._data.pid[0]) + return self._data.pid + + @pid.setter + def pid(self, val): + self._data.pid = val + + @property + def vgpu_instance(self): + """Union[~_numpy.uint32, int]: """ + if self._data.size == 1: + return int(self._data.vgpu_instance[0]) + return self._data.vgpu_instance + + @vgpu_instance.setter + def vgpu_instance(self, val): + self._data.vgpu_instance = val + + @property + def display_ordinal(self): + """Union[~_numpy.uint32, int]: """ + if self._data.size == 1: + return int(self._data.display_ordinal[0]) + return self._data.display_ordinal + + @display_ordinal.setter + def display_ordinal(self, val): + self._data.display_ordinal = val + + @property + def session_type(self): + """Union[~_numpy.int32, int]: """ + if self._data.size == 1: + return int(self._data.session_type[0]) + return self._data.session_type + + @session_type.setter + def session_type(self, val): + self._data.session_type = val + + @property + def session_flags(self): + """Union[~_numpy.uint32, int]: """ + if self._data.size == 1: + return int(self._data.session_flags[0]) + return self._data.session_flags + + @session_flags.setter + def session_flags(self, val): + self._data.session_flags = val + + @property + def h_max_resolution(self): + """Union[~_numpy.uint32, int]: """ + if self._data.size == 1: + return int(self._data.h_max_resolution[0]) + return self._data.h_max_resolution + + @h_max_resolution.setter + def h_max_resolution(self, val): + self._data.h_max_resolution = val + + @property + def v_max_resolution(self): + """Union[~_numpy.uint32, int]: """ + if self._data.size == 1: + return int(self._data.v_max_resolution[0]) + return self._data.v_max_resolution + + @v_max_resolution.setter + def v_max_resolution(self, val): + self._data.v_max_resolution = val + + @property + def h_resolution(self): + """Union[~_numpy.uint32, int]: """ + if self._data.size == 1: + return int(self._data.h_resolution[0]) + return self._data.h_resolution + + @h_resolution.setter + def h_resolution(self, val): + self._data.h_resolution = val + + @property + def v_resolution(self): + """Union[~_numpy.uint32, int]: """ + if self._data.size == 1: + return int(self._data.v_resolution[0]) + return self._data.v_resolution + + @v_resolution.setter + def v_resolution(self, val): + self._data.v_resolution = val + + @property + def average_fps(self): + """Union[~_numpy.uint32, int]: """ + if self._data.size == 1: + return int(self._data.average_fps[0]) + return self._data.average_fps + + @average_fps.setter + def average_fps(self, val): + self._data.average_fps = val + + @property + def average_latency(self): + """Union[~_numpy.uint32, int]: """ + if self._data.size == 1: + return int(self._data.average_latency[0]) + return self._data.average_latency + + @average_latency.setter + def average_latency(self, val): + self._data.average_latency = val + + def __getitem__(self, key): + cdef ssize_t key_ + cdef ssize_t size + if isinstance(key, int): + key_ = key + size = self._data.size + if key_ >= size or key_ <= -(size+1): + raise IndexError("index is out of bounds") + if key_ < 0: + key_ += size + return FBCSessionInfo.from_data(self._data[key_:key_+1]) + out = self._data[key] + if isinstance(out, _numpy.recarray) and out.dtype == fbc_session_info_dtype: + return FBCSessionInfo.from_data(out) + return out + + def __setitem__(self, key, val): + self._data[key] = val + + @staticmethod + def from_buffer(buffer): + """Create an FBCSessionInfo instance with the memory from the given buffer.""" + return FBCSessionInfo.from_data(_numpy.frombuffer(buffer, dtype=fbc_session_info_dtype)) + + @staticmethod + def from_data(data): + """Create an FBCSessionInfo instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a 1D array of dtype `fbc_session_info_dtype` holding the data. + """ + cdef FBCSessionInfo obj = FBCSessionInfo.__new__(FBCSessionInfo) + if not isinstance(data, _numpy.ndarray): + raise TypeError("data argument must be a NumPy ndarray") + if data.ndim != 1: + raise ValueError("data array must be 1D") + if data.dtype != fbc_session_info_dtype: + raise ValueError("data array must be of dtype fbc_session_info_dtype") + obj._data = data.view(_numpy.recarray) + + return obj + + @staticmethod + def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False): + """Create an FBCSessionInfo instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + size (int): number of structs, default=1. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef FBCSessionInfo obj = FBCSessionInfo.__new__(FBCSessionInfo) + cdef flag = _cyb_cpython_buffer.PyBUF_READ if readonly else _cyb_cpython_buffer.PyBUF_WRITE + cdef object buf = _cyb_cpython_memoryview.PyMemoryView_FromMemory( + ptr, sizeof(nvmlFBCSessionInfo_t) * size, flag) + data = _numpy.ndarray(size, buffer=buf, dtype=fbc_session_info_dtype) + obj._data = data.view(_numpy.recarray) + + return obj + + +cdef _get_conf_compute_system_caps_dtype_offsets(): + cdef nvmlConfComputeSystemCaps_t pod + return _numpy.dtype({ + 'names': ['cpu_caps', 'gpus_caps'], + 'formats': [_numpy.uint32, _numpy.uint32], + 'offsets': [ + (&(pod.cpuCaps)) - (&pod), + (&(pod.gpusCaps)) - (&pod), + ], + 'itemsize': sizeof(nvmlConfComputeSystemCaps_t), + }) + +conf_compute_system_caps_dtype = _get_conf_compute_system_caps_dtype_offsets() + +cdef class ConfComputeSystemCaps: + """Empty-initialize an instance of `nvmlConfComputeSystemCaps_t`. + + + .. seealso:: `nvmlConfComputeSystemCaps_t` + """ + cdef: + nvmlConfComputeSystemCaps_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlConfComputeSystemCaps_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ConfComputeSystemCaps") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlConfComputeSystemCaps_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.ConfComputeSystemCaps object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef ConfComputeSystemCaps other_ + if not isinstance(other, ConfComputeSystemCaps): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlConfComputeSystemCaps_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlConfComputeSystemCaps_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlConfComputeSystemCaps_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ConfComputeSystemCaps") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlConfComputeSystemCaps_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def cpu_caps(self): + """int: """ + return self._ptr[0].cpuCaps + + @cpu_caps.setter + def cpu_caps(self, val): + if self._readonly: + raise ValueError("This ConfComputeSystemCaps instance is read-only") + self._ptr[0].cpuCaps = val + + @property + def gpus_caps(self): + """int: """ + return self._ptr[0].gpusCaps + + @gpus_caps.setter + def gpus_caps(self, val): + if self._readonly: + raise ValueError("This ConfComputeSystemCaps instance is read-only") + self._ptr[0].gpusCaps = val + + @staticmethod + def from_buffer(buffer): + """Create an ConfComputeSystemCaps instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlConfComputeSystemCaps_t), ConfComputeSystemCaps) + + @staticmethod + def from_data(data): + """Create an ConfComputeSystemCaps instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `conf_compute_system_caps_dtype` holding the data. + """ + return _cyb_from_data(data, "conf_compute_system_caps_dtype", conf_compute_system_caps_dtype, ConfComputeSystemCaps) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an ConfComputeSystemCaps instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef ConfComputeSystemCaps obj = ConfComputeSystemCaps.__new__(ConfComputeSystemCaps) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlConfComputeSystemCaps_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating ConfComputeSystemCaps") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlConfComputeSystemCaps_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_conf_compute_system_state_dtype_offsets(): + cdef nvmlConfComputeSystemState_t pod + return _numpy.dtype({ + 'names': ['environment', 'cc_feature', 'dev_tools_mode'], + 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32], + 'offsets': [ + (&(pod.environment)) - (&pod), + (&(pod.ccFeature)) - (&pod), + (&(pod.devToolsMode)) - (&pod), + ], + 'itemsize': sizeof(nvmlConfComputeSystemState_t), + }) + +conf_compute_system_state_dtype = _get_conf_compute_system_state_dtype_offsets() + +cdef class ConfComputeSystemState: + """Empty-initialize an instance of `nvmlConfComputeSystemState_t`. + + + .. seealso:: `nvmlConfComputeSystemState_t` + """ + cdef: + nvmlConfComputeSystemState_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlConfComputeSystemState_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ConfComputeSystemState") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlConfComputeSystemState_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.ConfComputeSystemState object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef ConfComputeSystemState other_ + if not isinstance(other, ConfComputeSystemState): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlConfComputeSystemState_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlConfComputeSystemState_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlConfComputeSystemState_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ConfComputeSystemState") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlConfComputeSystemState_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def environment(self): + """int: """ + return self._ptr[0].environment + + @environment.setter + def environment(self, val): + if self._readonly: + raise ValueError("This ConfComputeSystemState instance is read-only") + self._ptr[0].environment = val + + @property + def cc_feature(self): + """int: """ + return self._ptr[0].ccFeature + + @cc_feature.setter + def cc_feature(self, val): + if self._readonly: + raise ValueError("This ConfComputeSystemState instance is read-only") + self._ptr[0].ccFeature = val + + @property + def dev_tools_mode(self): + """int: """ + return self._ptr[0].devToolsMode + + @dev_tools_mode.setter + def dev_tools_mode(self, val): + if self._readonly: + raise ValueError("This ConfComputeSystemState instance is read-only") + self._ptr[0].devToolsMode = val + + @staticmethod + def from_buffer(buffer): + """Create an ConfComputeSystemState instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlConfComputeSystemState_t), ConfComputeSystemState) + + @staticmethod + def from_data(data): + """Create an ConfComputeSystemState instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `conf_compute_system_state_dtype` holding the data. + """ + return _cyb_from_data(data, "conf_compute_system_state_dtype", conf_compute_system_state_dtype, ConfComputeSystemState) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an ConfComputeSystemState instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef ConfComputeSystemState obj = ConfComputeSystemState.__new__(ConfComputeSystemState) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlConfComputeSystemState_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating ConfComputeSystemState") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlConfComputeSystemState_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_system_conf_compute_settings_v1_dtype_offsets(): + cdef nvmlSystemConfComputeSettings_v1_t pod + return _numpy.dtype({ + 'names': ['version', 'environment', 'cc_feature', 'dev_tools_mode', 'multi_gpu_mode'], + 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32], + 'offsets': [ + (&(pod.version)) - (&pod), + (&(pod.environment)) - (&pod), + (&(pod.ccFeature)) - (&pod), + (&(pod.devToolsMode)) - (&pod), + (&(pod.multiGpuMode)) - (&pod), + ], + 'itemsize': sizeof(nvmlSystemConfComputeSettings_v1_t), + }) + +system_conf_compute_settings_v1_dtype = _get_system_conf_compute_settings_v1_dtype_offsets() + +cdef class SystemConfComputeSettings_v1: + """Empty-initialize an instance of `nvmlSystemConfComputeSettings_v1_t`. + + + .. seealso:: `nvmlSystemConfComputeSettings_v1_t` + """ + cdef: + nvmlSystemConfComputeSettings_v1_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlSystemConfComputeSettings_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating SystemConfComputeSettings_v1") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlSystemConfComputeSettings_v1_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.SystemConfComputeSettings_v1 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef SystemConfComputeSettings_v1 other_ + if not isinstance(other, SystemConfComputeSettings_v1): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlSystemConfComputeSettings_v1_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlSystemConfComputeSettings_v1_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlSystemConfComputeSettings_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating SystemConfComputeSettings_v1") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlSystemConfComputeSettings_v1_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def version(self): + """int: """ + return self._ptr[0].version + + @version.setter + def version(self, val): + if self._readonly: + raise ValueError("This SystemConfComputeSettings_v1 instance is read-only") + self._ptr[0].version = val + + @property + def environment(self): + """int: """ + return self._ptr[0].environment + + @environment.setter + def environment(self, val): + if self._readonly: + raise ValueError("This SystemConfComputeSettings_v1 instance is read-only") + self._ptr[0].environment = val + + @property + def cc_feature(self): + """int: """ + return self._ptr[0].ccFeature + + @cc_feature.setter + def cc_feature(self, val): + if self._readonly: + raise ValueError("This SystemConfComputeSettings_v1 instance is read-only") + self._ptr[0].ccFeature = val + + @property + def dev_tools_mode(self): + """int: """ + return self._ptr[0].devToolsMode + + @dev_tools_mode.setter + def dev_tools_mode(self, val): + if self._readonly: + raise ValueError("This SystemConfComputeSettings_v1 instance is read-only") + self._ptr[0].devToolsMode = val + + @property + def multi_gpu_mode(self): + """int: """ + return self._ptr[0].multiGpuMode + + @multi_gpu_mode.setter + def multi_gpu_mode(self, val): + if self._readonly: + raise ValueError("This SystemConfComputeSettings_v1 instance is read-only") + self._ptr[0].multiGpuMode = val + + @staticmethod + def from_buffer(buffer): + """Create an SystemConfComputeSettings_v1 instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlSystemConfComputeSettings_v1_t), SystemConfComputeSettings_v1) + + @staticmethod + def from_data(data): + """Create an SystemConfComputeSettings_v1 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `system_conf_compute_settings_v1_dtype` holding the data. + """ + return _cyb_from_data(data, "system_conf_compute_settings_v1_dtype", system_conf_compute_settings_v1_dtype, SystemConfComputeSettings_v1) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an SystemConfComputeSettings_v1 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef SystemConfComputeSettings_v1 obj = SystemConfComputeSettings_v1.__new__(SystemConfComputeSettings_v1) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlSystemConfComputeSettings_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating SystemConfComputeSettings_v1") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlSystemConfComputeSettings_v1_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_conf_compute_mem_size_info_dtype_offsets(): + cdef nvmlConfComputeMemSizeInfo_t pod + return _numpy.dtype({ + 'names': ['protected_mem_size_kib', 'unprotected_mem_size_kib'], + 'formats': [_numpy.uint64, _numpy.uint64], + 'offsets': [ + (&(pod.protectedMemSizeKib)) - (&pod), + (&(pod.unprotectedMemSizeKib)) - (&pod), + ], + 'itemsize': sizeof(nvmlConfComputeMemSizeInfo_t), + }) + +conf_compute_mem_size_info_dtype = _get_conf_compute_mem_size_info_dtype_offsets() + +cdef class ConfComputeMemSizeInfo: + """Empty-initialize an instance of `nvmlConfComputeMemSizeInfo_t`. + + + .. seealso:: `nvmlConfComputeMemSizeInfo_t` + """ + cdef: + nvmlConfComputeMemSizeInfo_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlConfComputeMemSizeInfo_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ConfComputeMemSizeInfo") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlConfComputeMemSizeInfo_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.ConfComputeMemSizeInfo object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef ConfComputeMemSizeInfo other_ + if not isinstance(other, ConfComputeMemSizeInfo): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlConfComputeMemSizeInfo_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlConfComputeMemSizeInfo_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlConfComputeMemSizeInfo_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ConfComputeMemSizeInfo") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlConfComputeMemSizeInfo_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def protected_mem_size_kib(self): + """int: """ + return self._ptr[0].protectedMemSizeKib + + @protected_mem_size_kib.setter + def protected_mem_size_kib(self, val): + if self._readonly: + raise ValueError("This ConfComputeMemSizeInfo instance is read-only") + self._ptr[0].protectedMemSizeKib = val + + @property + def unprotected_mem_size_kib(self): + """int: """ + return self._ptr[0].unprotectedMemSizeKib + + @unprotected_mem_size_kib.setter + def unprotected_mem_size_kib(self, val): + if self._readonly: + raise ValueError("This ConfComputeMemSizeInfo instance is read-only") + self._ptr[0].unprotectedMemSizeKib = val + + @staticmethod + def from_buffer(buffer): + """Create an ConfComputeMemSizeInfo instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlConfComputeMemSizeInfo_t), ConfComputeMemSizeInfo) + + @staticmethod + def from_data(data): + """Create an ConfComputeMemSizeInfo instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `conf_compute_mem_size_info_dtype` holding the data. + """ + return _cyb_from_data(data, "conf_compute_mem_size_info_dtype", conf_compute_mem_size_info_dtype, ConfComputeMemSizeInfo) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an ConfComputeMemSizeInfo instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef ConfComputeMemSizeInfo obj = ConfComputeMemSizeInfo.__new__(ConfComputeMemSizeInfo) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlConfComputeMemSizeInfo_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating ConfComputeMemSizeInfo") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlConfComputeMemSizeInfo_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_conf_compute_gpu_certificate_dtype_offsets(): + cdef nvmlConfComputeGpuCertificate_t pod + return _numpy.dtype({ + 'names': ['cert_chain_size', 'attestation_cert_chain_size', 'cert_chain', 'attestation_cert_chain'], + 'formats': [_numpy.uint32, _numpy.uint32, (_numpy.uint8, 4096), (_numpy.uint8, 5120)], + 'offsets': [ + (&(pod.certChainSize)) - (&pod), + (&(pod.attestationCertChainSize)) - (&pod), + (&(pod.certChain)) - (&pod), + (&(pod.attestationCertChain)) - (&pod), + ], + 'itemsize': sizeof(nvmlConfComputeGpuCertificate_t), + }) + +conf_compute_gpu_certificate_dtype = _get_conf_compute_gpu_certificate_dtype_offsets() + +cdef class ConfComputeGpuCertificate: + """Empty-initialize an instance of `nvmlConfComputeGpuCertificate_t`. + + + .. seealso:: `nvmlConfComputeGpuCertificate_t` + """ + cdef: + nvmlConfComputeGpuCertificate_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlConfComputeGpuCertificate_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ConfComputeGpuCertificate") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlConfComputeGpuCertificate_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.ConfComputeGpuCertificate object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef ConfComputeGpuCertificate other_ + if not isinstance(other, ConfComputeGpuCertificate): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlConfComputeGpuCertificate_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlConfComputeGpuCertificate_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlConfComputeGpuCertificate_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ConfComputeGpuCertificate") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlConfComputeGpuCertificate_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def cert_chain(self): + """~_numpy.uint8: (array of length 4096).""" + if self._ptr[0].certChainSize == 0: + return _numpy.array([]) + cdef _cyb_view.array arr = _cyb_view.array(shape=(self._ptr[0].certChainSize,), itemsize=sizeof(unsigned char), format="B", mode="c", allocate_buffer=False) + arr.data = (&(self._ptr[0].certChain)) + return _numpy.asarray(arr) + + @cert_chain.setter + def cert_chain(self, val): + if self._readonly: + raise ValueError("This ConfComputeGpuCertificate instance is read-only") + if len(val) > 4096: + raise ValueError(f"Too many elements for field cert_chain, max is 4096, got {len(val)}") + self._ptr[0].certChainSize = len(val) + if len(val) == 0: + return + cdef _cyb_view.array arr = _cyb_view.array(shape=(self._ptr[0].certChainSize,), itemsize=sizeof(unsigned char), format="B", mode="c") + arr[:] = _numpy.asarray(val, dtype=_numpy.uint8) + _cyb_memcpy((&(self._ptr[0].certChain)), (arr.data), sizeof(unsigned char) * len(val)) + + @property + def attestation_cert_chain(self): + """~_numpy.uint8: (array of length 5120).""" + if self._ptr[0].attestationCertChainSize == 0: + return _numpy.array([]) + cdef _cyb_view.array arr = _cyb_view.array(shape=(self._ptr[0].attestationCertChainSize,), itemsize=sizeof(unsigned char), format="B", mode="c", allocate_buffer=False) + arr.data = (&(self._ptr[0].attestationCertChain)) + return _numpy.asarray(arr) + + @attestation_cert_chain.setter + def attestation_cert_chain(self, val): + if self._readonly: + raise ValueError("This ConfComputeGpuCertificate instance is read-only") + if len(val) > 5120: + raise ValueError(f"Too many elements for field attestation_cert_chain, max is 5120, got {len(val)}") + self._ptr[0].attestationCertChainSize = len(val) + if len(val) == 0: + return + cdef _cyb_view.array arr = _cyb_view.array(shape=(self._ptr[0].attestationCertChainSize,), itemsize=sizeof(unsigned char), format="B", mode="c") + arr[:] = _numpy.asarray(val, dtype=_numpy.uint8) + _cyb_memcpy((&(self._ptr[0].attestationCertChain)), (arr.data), sizeof(unsigned char) * len(val)) + + @staticmethod + def from_buffer(buffer): + """Create an ConfComputeGpuCertificate instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlConfComputeGpuCertificate_t), ConfComputeGpuCertificate) + + @staticmethod + def from_data(data): + """Create an ConfComputeGpuCertificate instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `conf_compute_gpu_certificate_dtype` holding the data. + """ + return _cyb_from_data(data, "conf_compute_gpu_certificate_dtype", conf_compute_gpu_certificate_dtype, ConfComputeGpuCertificate) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an ConfComputeGpuCertificate instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef ConfComputeGpuCertificate obj = ConfComputeGpuCertificate.__new__(ConfComputeGpuCertificate) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlConfComputeGpuCertificate_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating ConfComputeGpuCertificate") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlConfComputeGpuCertificate_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_conf_compute_gpu_attestation_report_dtype_offsets(): + cdef nvmlConfComputeGpuAttestationReport_t pod + return _numpy.dtype({ + 'names': ['is_cec_attestation_report_present', 'attestation_report_size', 'cec_attestation_report_size', 'nonce', 'attestation_report', 'cec_attestation_report'], + 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, (_numpy.uint8, 32), (_numpy.uint8, 8192), (_numpy.uint8, 4096)], + 'offsets': [ + (&(pod.isCecAttestationReportPresent)) - (&pod), + (&(pod.attestationReportSize)) - (&pod), + (&(pod.cecAttestationReportSize)) - (&pod), + (&(pod.nonce)) - (&pod), + (&(pod.attestationReport)) - (&pod), + (&(pod.cecAttestationReport)) - (&pod), + ], + 'itemsize': sizeof(nvmlConfComputeGpuAttestationReport_t), + }) + +conf_compute_gpu_attestation_report_dtype = _get_conf_compute_gpu_attestation_report_dtype_offsets() + +cdef class ConfComputeGpuAttestationReport: + """Empty-initialize an instance of `nvmlConfComputeGpuAttestationReport_t`. + + + .. seealso:: `nvmlConfComputeGpuAttestationReport_t` + """ + cdef: + nvmlConfComputeGpuAttestationReport_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlConfComputeGpuAttestationReport_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ConfComputeGpuAttestationReport") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlConfComputeGpuAttestationReport_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.ConfComputeGpuAttestationReport object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef ConfComputeGpuAttestationReport other_ + if not isinstance(other, ConfComputeGpuAttestationReport): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlConfComputeGpuAttestationReport_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlConfComputeGpuAttestationReport_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlConfComputeGpuAttestationReport_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ConfComputeGpuAttestationReport") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlConfComputeGpuAttestationReport_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def is_cec_attestation_report_present(self): + """int: """ + return self._ptr[0].isCecAttestationReportPresent + + @is_cec_attestation_report_present.setter + def is_cec_attestation_report_present(self, val): + if self._readonly: + raise ValueError("This ConfComputeGpuAttestationReport instance is read-only") + self._ptr[0].isCecAttestationReportPresent = val + + @property + def nonce(self): + """~_numpy.uint8: (array of length 32).""" + cdef _cyb_view.array arr = _cyb_view.array(shape=(32,), itemsize=sizeof(unsigned char), format="B", mode="c", allocate_buffer=False) + arr.data = (&(self._ptr[0].nonce)) + return _numpy.asarray(arr) + + @nonce.setter + def nonce(self, val): + if self._readonly: + raise ValueError("This ConfComputeGpuAttestationReport instance is read-only") + if len(val) != 32: + raise ValueError(f"Expected length { 32 } for field nonce, got {len(val)}") + cdef _cyb_view.array arr = _cyb_view.array(shape=(32,), itemsize=sizeof(unsigned char), format="B", mode="c") + arr[:] = _numpy.asarray(val, dtype=_numpy.uint8) + _cyb_memcpy((&(self._ptr[0].nonce)), (arr.data), sizeof(unsigned char) * len(val)) + + @property + def attestation_report(self): + """~_numpy.uint8: (array of length 8192).""" + if self._ptr[0].attestationReportSize == 0: + return _numpy.array([]) + cdef _cyb_view.array arr = _cyb_view.array(shape=(self._ptr[0].attestationReportSize,), itemsize=sizeof(unsigned char), format="B", mode="c", allocate_buffer=False) + arr.data = (&(self._ptr[0].attestationReport)) + return _numpy.asarray(arr) + + @attestation_report.setter + def attestation_report(self, val): + if self._readonly: + raise ValueError("This ConfComputeGpuAttestationReport instance is read-only") + if len(val) > 8192: + raise ValueError(f"Too many elements for field attestation_report, max is 8192, got {len(val)}") + self._ptr[0].attestationReportSize = len(val) + if len(val) == 0: + return + cdef _cyb_view.array arr = _cyb_view.array(shape=(self._ptr[0].attestationReportSize,), itemsize=sizeof(unsigned char), format="B", mode="c") + arr[:] = _numpy.asarray(val, dtype=_numpy.uint8) + _cyb_memcpy((&(self._ptr[0].attestationReport)), (arr.data), sizeof(unsigned char) * len(val)) + + @property + def cec_attestation_report(self): + """~_numpy.uint8: (array of length 4096).""" + if self._ptr[0].cecAttestationReportSize == 0: + return _numpy.array([]) + cdef _cyb_view.array arr = _cyb_view.array(shape=(self._ptr[0].cecAttestationReportSize,), itemsize=sizeof(unsigned char), format="B", mode="c", allocate_buffer=False) + arr.data = (&(self._ptr[0].cecAttestationReport)) + return _numpy.asarray(arr) + + @cec_attestation_report.setter + def cec_attestation_report(self, val): + if self._readonly: + raise ValueError("This ConfComputeGpuAttestationReport instance is read-only") + if len(val) > 4096: + raise ValueError(f"Too many elements for field cec_attestation_report, max is 4096, got {len(val)}") + self._ptr[0].cecAttestationReportSize = len(val) + if len(val) == 0: + return + cdef _cyb_view.array arr = _cyb_view.array(shape=(self._ptr[0].cecAttestationReportSize,), itemsize=sizeof(unsigned char), format="B", mode="c") + arr[:] = _numpy.asarray(val, dtype=_numpy.uint8) + _cyb_memcpy((&(self._ptr[0].cecAttestationReport)), (arr.data), sizeof(unsigned char) * len(val)) + + @staticmethod + def from_buffer(buffer): + """Create an ConfComputeGpuAttestationReport instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlConfComputeGpuAttestationReport_t), ConfComputeGpuAttestationReport) + + @staticmethod + def from_data(data): + """Create an ConfComputeGpuAttestationReport instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `conf_compute_gpu_attestation_report_dtype` holding the data. + """ + return _cyb_from_data(data, "conf_compute_gpu_attestation_report_dtype", conf_compute_gpu_attestation_report_dtype, ConfComputeGpuAttestationReport) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an ConfComputeGpuAttestationReport instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef ConfComputeGpuAttestationReport obj = ConfComputeGpuAttestationReport.__new__(ConfComputeGpuAttestationReport) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlConfComputeGpuAttestationReport_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating ConfComputeGpuAttestationReport") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlConfComputeGpuAttestationReport_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_gpu_fabric_info_v2_dtype_offsets(): + cdef nvmlGpuFabricInfo_v2_t pod + return _numpy.dtype({ + 'names': ['version', 'cluster_uuid', 'status', 'clique_id', 'state', 'health_mask'], + 'formats': [_numpy.uint32, (_numpy.uint8, 16), _numpy.int32, _numpy.uint32, _numpy.uint8, _numpy.uint32], + 'offsets': [ + (&(pod.version)) - (&pod), + (&(pod.clusterUuid)) - (&pod), + (&(pod.status)) - (&pod), + (&(pod.cliqueId)) - (&pod), + (&(pod.state)) - (&pod), + (&(pod.healthMask)) - (&pod), + ], + 'itemsize': sizeof(nvmlGpuFabricInfo_v2_t), + }) + +gpu_fabric_info_v2_dtype = _get_gpu_fabric_info_v2_dtype_offsets() + +cdef class GpuFabricInfo_v2: + """Empty-initialize an instance of `nvmlGpuFabricInfo_v2_t`. + + + .. seealso:: `nvmlGpuFabricInfo_v2_t` + """ + cdef: + nvmlGpuFabricInfo_v2_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlGpuFabricInfo_v2_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating GpuFabricInfo_v2") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlGpuFabricInfo_v2_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.GpuFabricInfo_v2 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef GpuFabricInfo_v2 other_ + if not isinstance(other, GpuFabricInfo_v2): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlGpuFabricInfo_v2_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlGpuFabricInfo_v2_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlGpuFabricInfo_v2_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating GpuFabricInfo_v2") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlGpuFabricInfo_v2_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def version(self): + """int: Structure version identifier (set to nvmlGpuFabricInfo_v2).""" + return self._ptr[0].version + + @version.setter + def version(self, val): + if self._readonly: + raise ValueError("This GpuFabricInfo_v2 instance is read-only") + self._ptr[0].version = val + + @property + def cluster_uuid(self): + """~_numpy.uint8: (array of length 16).Uuid of the cluster to which this GPU belongs.""" + cdef _cyb_view.array arr = _cyb_view.array(shape=(16,), itemsize=sizeof(unsigned char), format="B", mode="c", allocate_buffer=False) + arr.data = (&(self._ptr[0].clusterUuid)) + return _numpy.asarray(arr) + + @cluster_uuid.setter + def cluster_uuid(self, val): + if self._readonly: + raise ValueError("This GpuFabricInfo_v2 instance is read-only") + if len(val) != 16: + raise ValueError(f"Expected length { 16 } for field cluster_uuid, got {len(val)}") + cdef _cyb_view.array arr = _cyb_view.array(shape=(16,), itemsize=sizeof(unsigned char), format="B", mode="c") + arr[:] = _numpy.asarray(val, dtype=_numpy.uint8) + _cyb_memcpy((&(self._ptr[0].clusterUuid)), (arr.data), sizeof(unsigned char) * len(val)) + + @property + def status(self): + """int: Probe Error status, if any. Must be checked only if Probe state returns "complete".""" + return (self._ptr[0].status) + + @status.setter + def status(self, val): + if self._readonly: + raise ValueError("This GpuFabricInfo_v2 instance is read-only") + self._ptr[0].status = val + + @property + def clique_id(self): + """int: ID of the fabric clique to which this GPU belongs.""" + return self._ptr[0].cliqueId + + @clique_id.setter + def clique_id(self, val): + if self._readonly: + raise ValueError("This GpuFabricInfo_v2 instance is read-only") + self._ptr[0].cliqueId = val + + @property + def state(self): + """int: Current Probe State of GPU registration process. See NVML_GPU_FABRIC_STATE_*.""" + return (self._ptr[0].state) + + @state.setter + def state(self, val): + if self._readonly: + raise ValueError("This GpuFabricInfo_v2 instance is read-only") + self._ptr[0].state = val + + @property + def health_mask(self): + """int: GPU Fabric health Status Mask. See NVML_GPU_FABRIC_HEALTH_MASK_*.""" + return self._ptr[0].healthMask + + @health_mask.setter + def health_mask(self, val): + if self._readonly: + raise ValueError("This GpuFabricInfo_v2 instance is read-only") + self._ptr[0].healthMask = val + + @staticmethod + def from_buffer(buffer): + """Create an GpuFabricInfo_v2 instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlGpuFabricInfo_v2_t), GpuFabricInfo_v2) + + @staticmethod + def from_data(data): + """Create an GpuFabricInfo_v2 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `gpu_fabric_info_v2_dtype` holding the data. + """ + return _cyb_from_data(data, "gpu_fabric_info_v2_dtype", gpu_fabric_info_v2_dtype, GpuFabricInfo_v2) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an GpuFabricInfo_v2 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef GpuFabricInfo_v2 obj = GpuFabricInfo_v2.__new__(GpuFabricInfo_v2) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlGpuFabricInfo_v2_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating GpuFabricInfo_v2") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlGpuFabricInfo_v2_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_nvlink_supported_bw_modes_v1_dtype_offsets(): + cdef nvmlNvlinkSupportedBwModes_v1_t pod + return _numpy.dtype({ + 'names': ['version', 'bw_modes', 'total_bw_modes'], + 'formats': [_numpy.uint32, (_numpy.uint8, 23), _numpy.uint8], + 'offsets': [ + (&(pod.version)) - (&pod), + (&(pod.bwModes)) - (&pod), + (&(pod.totalBwModes)) - (&pod), + ], + 'itemsize': sizeof(nvmlNvlinkSupportedBwModes_v1_t), + }) + +nvlink_supported_bw_modes_v1_dtype = _get_nvlink_supported_bw_modes_v1_dtype_offsets() + +cdef class NvlinkSupportedBwModes_v1: + """Empty-initialize an instance of `nvmlNvlinkSupportedBwModes_v1_t`. + + + .. seealso:: `nvmlNvlinkSupportedBwModes_v1_t` + """ + cdef: + nvmlNvlinkSupportedBwModes_v1_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlNvlinkSupportedBwModes_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating NvlinkSupportedBwModes_v1") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlNvlinkSupportedBwModes_v1_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.NvlinkSupportedBwModes_v1 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef NvlinkSupportedBwModes_v1 other_ + if not isinstance(other, NvlinkSupportedBwModes_v1): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlNvlinkSupportedBwModes_v1_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlNvlinkSupportedBwModes_v1_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlNvlinkSupportedBwModes_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating NvlinkSupportedBwModes_v1") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlNvlinkSupportedBwModes_v1_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def version(self): + """int: """ + return self._ptr[0].version + + @version.setter + def version(self, val): + if self._readonly: + raise ValueError("This NvlinkSupportedBwModes_v1 instance is read-only") + self._ptr[0].version = val + + @property + def bw_modes(self): + """~_numpy.uint8: (array of length 23).""" + if self._ptr[0].totalBwModes == 0: + return _numpy.array([]) + cdef _cyb_view.array arr = _cyb_view.array(shape=(self._ptr[0].totalBwModes,), itemsize=sizeof(unsigned char), format="B", mode="c", allocate_buffer=False) + arr.data = (&(self._ptr[0].bwModes)) + return _numpy.asarray(arr) + + @bw_modes.setter + def bw_modes(self, val): + if self._readonly: + raise ValueError("This NvlinkSupportedBwModes_v1 instance is read-only") + if len(val) > 23: + raise ValueError(f"Too many elements for field bw_modes, max is 23, got {len(val)}") + self._ptr[0].totalBwModes = len(val) + if len(val) == 0: + return + cdef _cyb_view.array arr = _cyb_view.array(shape=(self._ptr[0].totalBwModes,), itemsize=sizeof(unsigned char), format="B", mode="c") + arr[:] = _numpy.asarray(val, dtype=_numpy.uint8) + _cyb_memcpy((&(self._ptr[0].bwModes)), (arr.data), sizeof(unsigned char) * len(val)) + + @staticmethod + def from_buffer(buffer): + """Create an NvlinkSupportedBwModes_v1 instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlNvlinkSupportedBwModes_v1_t), NvlinkSupportedBwModes_v1) + + @staticmethod + def from_data(data): + """Create an NvlinkSupportedBwModes_v1 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `nvlink_supported_bw_modes_v1_dtype` holding the data. + """ + return _cyb_from_data(data, "nvlink_supported_bw_modes_v1_dtype", nvlink_supported_bw_modes_v1_dtype, NvlinkSupportedBwModes_v1) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an NvlinkSupportedBwModes_v1 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef NvlinkSupportedBwModes_v1 obj = NvlinkSupportedBwModes_v1.__new__(NvlinkSupportedBwModes_v1) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlNvlinkSupportedBwModes_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating NvlinkSupportedBwModes_v1") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlNvlinkSupportedBwModes_v1_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_nvlink_get_bw_mode_v1_dtype_offsets(): + cdef nvmlNvlinkGetBwMode_v1_t pod + return _numpy.dtype({ + 'names': ['version', 'b_is_best', 'bw_mode'], + 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint8], + 'offsets': [ + (&(pod.version)) - (&pod), + (&(pod.bIsBest)) - (&pod), + (&(pod.bwMode)) - (&pod), + ], + 'itemsize': sizeof(nvmlNvlinkGetBwMode_v1_t), + }) + +nvlink_get_bw_mode_v1_dtype = _get_nvlink_get_bw_mode_v1_dtype_offsets() + +cdef class NvlinkGetBwMode_v1: + """Empty-initialize an instance of `nvmlNvlinkGetBwMode_v1_t`. + + + .. seealso:: `nvmlNvlinkGetBwMode_v1_t` + """ + cdef: + nvmlNvlinkGetBwMode_v1_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlNvlinkGetBwMode_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating NvlinkGetBwMode_v1") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlNvlinkGetBwMode_v1_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.NvlinkGetBwMode_v1 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef NvlinkGetBwMode_v1 other_ + if not isinstance(other, NvlinkGetBwMode_v1): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlNvlinkGetBwMode_v1_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlNvlinkGetBwMode_v1_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlNvlinkGetBwMode_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating NvlinkGetBwMode_v1") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlNvlinkGetBwMode_v1_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def version(self): + """int: """ + return self._ptr[0].version + + @version.setter + def version(self, val): + if self._readonly: + raise ValueError("This NvlinkGetBwMode_v1 instance is read-only") + self._ptr[0].version = val + + @property + def b_is_best(self): + """int: """ + return self._ptr[0].bIsBest + + @b_is_best.setter + def b_is_best(self, val): + if self._readonly: + raise ValueError("This NvlinkGetBwMode_v1 instance is read-only") + self._ptr[0].bIsBest = val + + @property + def bw_mode(self): + """int: """ + return self._ptr[0].bwMode + + @bw_mode.setter + def bw_mode(self, val): + if self._readonly: + raise ValueError("This NvlinkGetBwMode_v1 instance is read-only") + self._ptr[0].bwMode = val + + @staticmethod + def from_buffer(buffer): + """Create an NvlinkGetBwMode_v1 instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlNvlinkGetBwMode_v1_t), NvlinkGetBwMode_v1) + + @staticmethod + def from_data(data): + """Create an NvlinkGetBwMode_v1 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `nvlink_get_bw_mode_v1_dtype` holding the data. + """ + return _cyb_from_data(data, "nvlink_get_bw_mode_v1_dtype", nvlink_get_bw_mode_v1_dtype, NvlinkGetBwMode_v1) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an NvlinkGetBwMode_v1 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef NvlinkGetBwMode_v1 obj = NvlinkGetBwMode_v1.__new__(NvlinkGetBwMode_v1) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlNvlinkGetBwMode_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating NvlinkGetBwMode_v1") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlNvlinkGetBwMode_v1_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_nvlink_set_bw_mode_v1_dtype_offsets(): + cdef nvmlNvlinkSetBwMode_v1_t pod + return _numpy.dtype({ + 'names': ['version', 'b_set_best', 'bw_mode'], + 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint8], + 'offsets': [ + (&(pod.version)) - (&pod), + (&(pod.bSetBest)) - (&pod), + (&(pod.bwMode)) - (&pod), + ], + 'itemsize': sizeof(nvmlNvlinkSetBwMode_v1_t), + }) + +nvlink_set_bw_mode_v1_dtype = _get_nvlink_set_bw_mode_v1_dtype_offsets() + +cdef class NvlinkSetBwMode_v1: + """Empty-initialize an instance of `nvmlNvlinkSetBwMode_v1_t`. + + + .. seealso:: `nvmlNvlinkSetBwMode_v1_t` + """ + cdef: + nvmlNvlinkSetBwMode_v1_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlNvlinkSetBwMode_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating NvlinkSetBwMode_v1") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlNvlinkSetBwMode_v1_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.NvlinkSetBwMode_v1 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef NvlinkSetBwMode_v1 other_ + if not isinstance(other, NvlinkSetBwMode_v1): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlNvlinkSetBwMode_v1_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlNvlinkSetBwMode_v1_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlNvlinkSetBwMode_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating NvlinkSetBwMode_v1") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlNvlinkSetBwMode_v1_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def version(self): + """int: """ + return self._ptr[0].version + + @version.setter + def version(self, val): + if self._readonly: + raise ValueError("This NvlinkSetBwMode_v1 instance is read-only") + self._ptr[0].version = val + + @property + def b_set_best(self): + """int: """ + return self._ptr[0].bSetBest + + @b_set_best.setter + def b_set_best(self, val): + if self._readonly: + raise ValueError("This NvlinkSetBwMode_v1 instance is read-only") + self._ptr[0].bSetBest = val + + @property + def bw_mode(self): + """int: """ + return self._ptr[0].bwMode + + @bw_mode.setter + def bw_mode(self, val): + if self._readonly: + raise ValueError("This NvlinkSetBwMode_v1 instance is read-only") + self._ptr[0].bwMode = val + + @staticmethod + def from_buffer(buffer): + """Create an NvlinkSetBwMode_v1 instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlNvlinkSetBwMode_v1_t), NvlinkSetBwMode_v1) + + @staticmethod + def from_data(data): + """Create an NvlinkSetBwMode_v1 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `nvlink_set_bw_mode_v1_dtype` holding the data. + """ + return _cyb_from_data(data, "nvlink_set_bw_mode_v1_dtype", nvlink_set_bw_mode_v1_dtype, NvlinkSetBwMode_v1) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an NvlinkSetBwMode_v1 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef NvlinkSetBwMode_v1 obj = NvlinkSetBwMode_v1.__new__(NvlinkSetBwMode_v1) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlNvlinkSetBwMode_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating NvlinkSetBwMode_v1") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlNvlinkSetBwMode_v1_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_vgpu_version_dtype_offsets(): + cdef nvmlVgpuVersion_t pod + return _numpy.dtype({ + 'names': ['min_version', 'max_version'], + 'formats': [_numpy.uint32, _numpy.uint32], + 'offsets': [ + (&(pod.minVersion)) - (&pod), + (&(pod.maxVersion)) - (&pod), + ], + 'itemsize': sizeof(nvmlVgpuVersion_t), + }) + +vgpu_version_dtype = _get_vgpu_version_dtype_offsets() + +cdef class VgpuVersion: + """Empty-initialize an instance of `nvmlVgpuVersion_t`. + + + .. seealso:: `nvmlVgpuVersion_t` + """ + cdef: + nvmlVgpuVersion_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlVgpuVersion_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuVersion") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlVgpuVersion_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.VgpuVersion object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef VgpuVersion other_ + if not isinstance(other, VgpuVersion): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuVersion_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlVgpuVersion_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlVgpuVersion_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuVersion") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuVersion_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def min_version(self): + """int: """ + return self._ptr[0].minVersion + + @min_version.setter + def min_version(self, val): + if self._readonly: + raise ValueError("This VgpuVersion instance is read-only") + self._ptr[0].minVersion = val + + @property + def max_version(self): + """int: """ + return self._ptr[0].maxVersion + + @max_version.setter + def max_version(self, val): + if self._readonly: + raise ValueError("This VgpuVersion instance is read-only") + self._ptr[0].maxVersion = val + + @staticmethod + def from_buffer(buffer): + """Create an VgpuVersion instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlVgpuVersion_t), VgpuVersion) + + @staticmethod + def from_data(data): + """Create an VgpuVersion instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `vgpu_version_dtype` holding the data. + """ + return _cyb_from_data(data, "vgpu_version_dtype", vgpu_version_dtype, VgpuVersion) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an VgpuVersion instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef VgpuVersion obj = VgpuVersion.__new__(VgpuVersion) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlVgpuVersion_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating VgpuVersion") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlVgpuVersion_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_vgpu_metadata_dtype_offsets(): + cdef nvmlVgpuMetadata_t pod + return _numpy.dtype({ + 'names': ['version', 'revision', 'guest_info_state', 'guest_driver_version', 'host_driver_version', 'reserved', 'vgpu_virtualization_caps', 'guest_vgpu_version', 'opaque_data_size', 'opaque_data'], + 'formats': [_numpy.uint32, _numpy.uint32, _numpy.int32, (_numpy.int8, 80), (_numpy.int8, 80), (_numpy.uint32, 6), _numpy.uint32, _numpy.uint32, _numpy.uint32, (_numpy.int8, 4)], + 'offsets': [ + (&(pod.version)) - (&pod), + (&(pod.revision)) - (&pod), + (&(pod.guestInfoState)) - (&pod), + (&(pod.guestDriverVersion)) - (&pod), + (&(pod.hostDriverVersion)) - (&pod), + (&(pod.reserved)) - (&pod), + (&(pod.vgpuVirtualizationCaps)) - (&pod), + (&(pod.guestVgpuVersion)) - (&pod), + (&(pod.opaqueDataSize)) - (&pod), + (&(pod.opaqueData)) - (&pod), + ], + 'itemsize': sizeof(nvmlVgpuMetadata_t), + }) + +vgpu_metadata_dtype = _get_vgpu_metadata_dtype_offsets() + +cdef class VgpuMetadata: + """Empty-initialize an instance of `nvmlVgpuMetadata_t`. + + + .. seealso:: `nvmlVgpuMetadata_t` + """ + cdef: + nvmlVgpuMetadata_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlVgpuMetadata_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuMetadata") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlVgpuMetadata_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.VgpuMetadata object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef VgpuMetadata other_ + if not isinstance(other, VgpuMetadata): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuMetadata_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlVgpuMetadata_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlVgpuMetadata_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuMetadata") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuMetadata_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def version(self): + """int: """ + return self._ptr[0].version + + @version.setter + def version(self, val): + if self._readonly: + raise ValueError("This VgpuMetadata instance is read-only") + self._ptr[0].version = val + + @property + def revision(self): + """int: """ + return self._ptr[0].revision + + @revision.setter + def revision(self, val): + if self._readonly: + raise ValueError("This VgpuMetadata instance is read-only") + self._ptr[0].revision = val + + @property + def guest_info_state(self): + """int: """ + return (self._ptr[0].guestInfoState) + + @guest_info_state.setter + def guest_info_state(self, val): + if self._readonly: + raise ValueError("This VgpuMetadata instance is read-only") + self._ptr[0].guestInfoState = val + + @property + def guest_driver_version(self): + """~_numpy.int8: (array of length 80).""" + return _cyb_cpython.PyUnicode_FromString(self._ptr[0].guestDriverVersion) + + @guest_driver_version.setter + def guest_driver_version(self, val): + if self._readonly: + raise ValueError("This VgpuMetadata instance is read-only") + cdef bytes buf = val.encode() + if len(buf) >= 80: + raise ValueError("String too long for field guest_driver_version, max length is 79") + cdef char *ptr = buf + _cyb_memcpy((self._ptr[0].guestDriverVersion), ptr, 80) + + @property + def host_driver_version(self): + """~_numpy.int8: (array of length 80).""" + return _cyb_cpython.PyUnicode_FromString(self._ptr[0].hostDriverVersion) + + @host_driver_version.setter + def host_driver_version(self, val): + if self._readonly: + raise ValueError("This VgpuMetadata instance is read-only") + cdef bytes buf = val.encode() + if len(buf) >= 80: + raise ValueError("String too long for field host_driver_version, max length is 79") + cdef char *ptr = buf + _cyb_memcpy((self._ptr[0].hostDriverVersion), ptr, 80) + + @property + def vgpu_virtualization_caps(self): + """int: """ + return self._ptr[0].vgpuVirtualizationCaps + + @vgpu_virtualization_caps.setter + def vgpu_virtualization_caps(self, val): + if self._readonly: + raise ValueError("This VgpuMetadata instance is read-only") + self._ptr[0].vgpuVirtualizationCaps = val + + @property + def guest_vgpu_version(self): + """int: """ + return self._ptr[0].guestVgpuVersion + + @guest_vgpu_version.setter + def guest_vgpu_version(self, val): + if self._readonly: + raise ValueError("This VgpuMetadata instance is read-only") + self._ptr[0].guestVgpuVersion = val + + @property + def opaque_data_size(self): + """int: """ + return self._ptr[0].opaqueDataSize + + @opaque_data_size.setter + def opaque_data_size(self, val): + if self._readonly: + raise ValueError("This VgpuMetadata instance is read-only") + self._ptr[0].opaqueDataSize = val + + @property + def opaque_data(self): + """~_numpy.int8: (array of length 4).""" + return _cyb_cpython.PyUnicode_FromString(self._ptr[0].opaqueData) + + @opaque_data.setter + def opaque_data(self, val): + if self._readonly: + raise ValueError("This VgpuMetadata instance is read-only") + cdef bytes buf = val.encode() + if len(buf) >= 4: + raise ValueError("String too long for field opaque_data, max length is 3") + cdef char *ptr = buf + _cyb_memcpy((self._ptr[0].opaqueData), ptr, 4) + + @staticmethod + def from_buffer(buffer): + """Create an VgpuMetadata instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlVgpuMetadata_t), VgpuMetadata) + + @staticmethod + def from_data(data): + """Create an VgpuMetadata instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `vgpu_metadata_dtype` holding the data. + """ + return _cyb_from_data(data, "vgpu_metadata_dtype", vgpu_metadata_dtype, VgpuMetadata) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an VgpuMetadata instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef VgpuMetadata obj = VgpuMetadata.__new__(VgpuMetadata) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlVgpuMetadata_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating VgpuMetadata") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlVgpuMetadata_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_vgpu_pgpu_compatibility_dtype_offsets(): + cdef nvmlVgpuPgpuCompatibility_t pod + return _numpy.dtype({ + 'names': ['vgpu_vm_compatibility', 'compatibility_limit_code'], + 'formats': [_numpy.int32, _numpy.int32], + 'offsets': [ + (&(pod.vgpuVmCompatibility)) - (&pod), + (&(pod.compatibilityLimitCode)) - (&pod), + ], + 'itemsize': sizeof(nvmlVgpuPgpuCompatibility_t), + }) + +vgpu_pgpu_compatibility_dtype = _get_vgpu_pgpu_compatibility_dtype_offsets() + +cdef class VgpuPgpuCompatibility: + """Empty-initialize an instance of `nvmlVgpuPgpuCompatibility_t`. + + + .. seealso:: `nvmlVgpuPgpuCompatibility_t` + """ + cdef: + nvmlVgpuPgpuCompatibility_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlVgpuPgpuCompatibility_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuPgpuCompatibility") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlVgpuPgpuCompatibility_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.VgpuPgpuCompatibility object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef VgpuPgpuCompatibility other_ + if not isinstance(other, VgpuPgpuCompatibility): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuPgpuCompatibility_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlVgpuPgpuCompatibility_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlVgpuPgpuCompatibility_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuPgpuCompatibility") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuPgpuCompatibility_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def vgpu_vm_compatibility(self): + """int: """ + return (self._ptr[0].vgpuVmCompatibility) + + @vgpu_vm_compatibility.setter + def vgpu_vm_compatibility(self, val): + if self._readonly: + raise ValueError("This VgpuPgpuCompatibility instance is read-only") + self._ptr[0].vgpuVmCompatibility = val + + @property + def compatibility_limit_code(self): + """int: """ + return (self._ptr[0].compatibilityLimitCode) + + @compatibility_limit_code.setter + def compatibility_limit_code(self, val): + if self._readonly: + raise ValueError("This VgpuPgpuCompatibility instance is read-only") + self._ptr[0].compatibilityLimitCode = val + + @staticmethod + def from_buffer(buffer): + """Create an VgpuPgpuCompatibility instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlVgpuPgpuCompatibility_t), VgpuPgpuCompatibility) + + @staticmethod + def from_data(data): + """Create an VgpuPgpuCompatibility instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `vgpu_pgpu_compatibility_dtype` holding the data. + """ + return _cyb_from_data(data, "vgpu_pgpu_compatibility_dtype", vgpu_pgpu_compatibility_dtype, VgpuPgpuCompatibility) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an VgpuPgpuCompatibility instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef VgpuPgpuCompatibility obj = VgpuPgpuCompatibility.__new__(VgpuPgpuCompatibility) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlVgpuPgpuCompatibility_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating VgpuPgpuCompatibility") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlVgpuPgpuCompatibility_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_gpu_instance_placement_dtype_offsets(): + cdef nvmlGpuInstancePlacement_t pod + return _numpy.dtype({ + 'names': ['start', 'size_'], + 'formats': [_numpy.uint32, _numpy.uint32], + 'offsets': [ + (&(pod.start)) - (&pod), + (&(pod.size)) - (&pod), + ], + 'itemsize': sizeof(nvmlGpuInstancePlacement_t), + }) + +gpu_instance_placement_dtype = _get_gpu_instance_placement_dtype_offsets() + +cdef class GpuInstancePlacement: + """Empty-initialize an array of `nvmlGpuInstancePlacement_t`. + The resulting object is of length `size` and of dtype `gpu_instance_placement_dtype`. + If default-constructed, the instance represents a single struct. + + Args: + size (int): number of structs, default=1. + + .. seealso:: `nvmlGpuInstancePlacement_t` + """ + cdef: + readonly object _data + + def __init__(self, size=1): + arr = _numpy.empty(size, dtype=gpu_instance_placement_dtype) + self._data = arr.view(_numpy.recarray) + assert self._data.itemsize == sizeof(nvmlGpuInstancePlacement_t), \ + f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlGpuInstancePlacement_t) }" + + def __repr__(self): + if self._data.size > 1: + return f"<{__name__}.GpuInstancePlacement_Array_{self._data.size} object at {hex(id(self))}>" + else: + return f"<{__name__}.GpuInstancePlacement object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return self._data.ctypes.data + + cdef intptr_t _get_ptr(self): + return self._data.ctypes.data + + def __int__(self): + if self._data.size > 1: + raise TypeError("int() argument must be a bytes-like object of size 1. " + "To get the pointer address of an array, use .ptr") + return self._data.ctypes.data + + def __len__(self): + return self._data.size + + def __eq__(self, other): + cdef object self_data = self._data + if (not isinstance(other, GpuInstancePlacement)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype: + return False + return bool((self_data == other._data).all()) + + def __getbuffer__(self, Py_buffer *buffer, int flags): + _cyb_cpython.PyObject_GetBuffer(self._data, buffer, flags) + + def __releasebuffer__(self, Py_buffer *buffer): + _cyb_cpython.PyBuffer_Release(buffer) + + @property + def start(self): + """Union[~_numpy.uint32, int]: """ + if self._data.size == 1: + return int(self._data.start[0]) + return self._data.start + + @start.setter + def start(self, val): + self._data.start = val + + @property + def size_(self): + """Union[~_numpy.uint32, int]: """ + if self._data.size == 1: + return int(self._data.size_[0]) + return self._data.size_ + + @size_.setter + def size_(self, val): + self._data.size_ = val + + def __getitem__(self, key): + cdef ssize_t key_ + cdef ssize_t size + if isinstance(key, int): + key_ = key + size = self._data.size + if key_ >= size or key_ <= -(size+1): + raise IndexError("index is out of bounds") + if key_ < 0: + key_ += size + return GpuInstancePlacement.from_data(self._data[key_:key_+1]) + out = self._data[key] + if isinstance(out, _numpy.recarray) and out.dtype == gpu_instance_placement_dtype: + return GpuInstancePlacement.from_data(out) + return out + + def __setitem__(self, key, val): + self._data[key] = val + + @staticmethod + def from_buffer(buffer): + """Create an GpuInstancePlacement instance with the memory from the given buffer.""" + return GpuInstancePlacement.from_data(_numpy.frombuffer(buffer, dtype=gpu_instance_placement_dtype)) + + @staticmethod + def from_data(data): + """Create an GpuInstancePlacement instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a 1D array of dtype `gpu_instance_placement_dtype` holding the data. + """ + cdef GpuInstancePlacement obj = GpuInstancePlacement.__new__(GpuInstancePlacement) + if not isinstance(data, _numpy.ndarray): + raise TypeError("data argument must be a NumPy ndarray") + if data.ndim != 1: + raise ValueError("data array must be 1D") + if data.dtype != gpu_instance_placement_dtype: + raise ValueError("data array must be of dtype gpu_instance_placement_dtype") + obj._data = data.view(_numpy.recarray) + + return obj + + @staticmethod + def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False): + """Create an GpuInstancePlacement instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + size (int): number of structs, default=1. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef GpuInstancePlacement obj = GpuInstancePlacement.__new__(GpuInstancePlacement) + cdef flag = _cyb_cpython_buffer.PyBUF_READ if readonly else _cyb_cpython_buffer.PyBUF_WRITE + cdef object buf = _cyb_cpython_memoryview.PyMemoryView_FromMemory( + ptr, sizeof(nvmlGpuInstancePlacement_t) * size, flag) + data = _numpy.ndarray(size, buffer=buf, dtype=gpu_instance_placement_dtype) + obj._data = data.view(_numpy.recarray) + + return obj + + +cdef _get_gpu_instance_profile_info_v3_dtype_offsets(): + cdef nvmlGpuInstanceProfileInfo_v3_t pod + return _numpy.dtype({ + 'names': ['version', 'id', 'slice_count', 'instance_count', 'multiprocessor_count', 'copy_engine_count', 'decoder_count', 'encoder_count', 'jpeg_count', 'ofa_count', 'memory_size_mb', 'name', 'capabilities'], + 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint64, (_numpy.int8, 96), _numpy.uint32], + 'offsets': [ + (&(pod.version)) - (&pod), + (&(pod.id)) - (&pod), + (&(pod.sliceCount)) - (&pod), + (&(pod.instanceCount)) - (&pod), + (&(pod.multiprocessorCount)) - (&pod), + (&(pod.copyEngineCount)) - (&pod), + (&(pod.decoderCount)) - (&pod), + (&(pod.encoderCount)) - (&pod), + (&(pod.jpegCount)) - (&pod), + (&(pod.ofaCount)) - (&pod), + (&(pod.memorySizeMB)) - (&pod), + (&(pod.name)) - (&pod), + (&(pod.capabilities)) - (&pod), + ], + 'itemsize': sizeof(nvmlGpuInstanceProfileInfo_v3_t), + }) + +gpu_instance_profile_info_v3_dtype = _get_gpu_instance_profile_info_v3_dtype_offsets() + +cdef class GpuInstanceProfileInfo_v3: + """Empty-initialize an instance of `nvmlGpuInstanceProfileInfo_v3_t`. + + + .. seealso:: `nvmlGpuInstanceProfileInfo_v3_t` + """ + cdef: + nvmlGpuInstanceProfileInfo_v3_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlGpuInstanceProfileInfo_v3_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating GpuInstanceProfileInfo_v3") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlGpuInstanceProfileInfo_v3_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.GpuInstanceProfileInfo_v3 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef GpuInstanceProfileInfo_v3 other_ + if not isinstance(other, GpuInstanceProfileInfo_v3): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlGpuInstanceProfileInfo_v3_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlGpuInstanceProfileInfo_v3_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlGpuInstanceProfileInfo_v3_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating GpuInstanceProfileInfo_v3") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlGpuInstanceProfileInfo_v3_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def version(self): + """int: """ + return self._ptr[0].version + + @version.setter + def version(self, val): + if self._readonly: + raise ValueError("This GpuInstanceProfileInfo_v3 instance is read-only") + self._ptr[0].version = val + + @property + def id(self): + """int: """ + return self._ptr[0].id + + @id.setter + def id(self, val): + if self._readonly: + raise ValueError("This GpuInstanceProfileInfo_v3 instance is read-only") + self._ptr[0].id = val + + @property + def slice_count(self): + """int: """ + return self._ptr[0].sliceCount + + @slice_count.setter + def slice_count(self, val): + if self._readonly: + raise ValueError("This GpuInstanceProfileInfo_v3 instance is read-only") + self._ptr[0].sliceCount = val + + @property + def instance_count(self): + """int: """ + return self._ptr[0].instanceCount + + @instance_count.setter + def instance_count(self, val): + if self._readonly: + raise ValueError("This GpuInstanceProfileInfo_v3 instance is read-only") + self._ptr[0].instanceCount = val + + @property + def multiprocessor_count(self): + """int: """ + return self._ptr[0].multiprocessorCount + + @multiprocessor_count.setter + def multiprocessor_count(self, val): + if self._readonly: + raise ValueError("This GpuInstanceProfileInfo_v3 instance is read-only") + self._ptr[0].multiprocessorCount = val + + @property + def copy_engine_count(self): + """int: """ + return self._ptr[0].copyEngineCount + + @copy_engine_count.setter + def copy_engine_count(self, val): + if self._readonly: + raise ValueError("This GpuInstanceProfileInfo_v3 instance is read-only") + self._ptr[0].copyEngineCount = val + + @property + def decoder_count(self): + """int: """ + return self._ptr[0].decoderCount + + @decoder_count.setter + def decoder_count(self, val): + if self._readonly: + raise ValueError("This GpuInstanceProfileInfo_v3 instance is read-only") + self._ptr[0].decoderCount = val + + @property + def encoder_count(self): + """int: """ + return self._ptr[0].encoderCount + + @encoder_count.setter + def encoder_count(self, val): + if self._readonly: + raise ValueError("This GpuInstanceProfileInfo_v3 instance is read-only") + self._ptr[0].encoderCount = val + + @property + def jpeg_count(self): + """int: """ + return self._ptr[0].jpegCount + + @jpeg_count.setter + def jpeg_count(self, val): + if self._readonly: + raise ValueError("This GpuInstanceProfileInfo_v3 instance is read-only") + self._ptr[0].jpegCount = val + + @property + def ofa_count(self): + """int: """ + return self._ptr[0].ofaCount + + @ofa_count.setter + def ofa_count(self, val): + if self._readonly: + raise ValueError("This GpuInstanceProfileInfo_v3 instance is read-only") + self._ptr[0].ofaCount = val + + @property + def memory_size_mb(self): + """int: """ + return self._ptr[0].memorySizeMB + + @memory_size_mb.setter + def memory_size_mb(self, val): + if self._readonly: + raise ValueError("This GpuInstanceProfileInfo_v3 instance is read-only") + self._ptr[0].memorySizeMB = val + + @property + def name(self): + """~_numpy.int8: (array of length 96).""" + return _cyb_cpython.PyUnicode_FromString(self._ptr[0].name) + + @name.setter + def name(self, val): + if self._readonly: + raise ValueError("This GpuInstanceProfileInfo_v3 instance is read-only") + cdef bytes buf = val.encode() + if len(buf) >= 96: + raise ValueError("String too long for field name, max length is 95") + cdef char *ptr = buf + _cyb_memcpy((self._ptr[0].name), ptr, 96) + + @property + def capabilities(self): + """int: """ + return self._ptr[0].capabilities + + @capabilities.setter + def capabilities(self, val): + if self._readonly: + raise ValueError("This GpuInstanceProfileInfo_v3 instance is read-only") + self._ptr[0].capabilities = val + + @staticmethod + def from_buffer(buffer): + """Create an GpuInstanceProfileInfo_v3 instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlGpuInstanceProfileInfo_v3_t), GpuInstanceProfileInfo_v3) + + @staticmethod + def from_data(data): + """Create an GpuInstanceProfileInfo_v3 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `gpu_instance_profile_info_v3_dtype` holding the data. + """ + return _cyb_from_data(data, "gpu_instance_profile_info_v3_dtype", gpu_instance_profile_info_v3_dtype, GpuInstanceProfileInfo_v3) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an GpuInstanceProfileInfo_v3 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef GpuInstanceProfileInfo_v3 obj = GpuInstanceProfileInfo_v3.__new__(GpuInstanceProfileInfo_v3) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlGpuInstanceProfileInfo_v3_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating GpuInstanceProfileInfo_v3") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlGpuInstanceProfileInfo_v3_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_compute_instance_placement_dtype_offsets(): + cdef nvmlComputeInstancePlacement_t pod + return _numpy.dtype({ + 'names': ['start', 'size_'], + 'formats': [_numpy.uint32, _numpy.uint32], + 'offsets': [ + (&(pod.start)) - (&pod), + (&(pod.size)) - (&pod), + ], + 'itemsize': sizeof(nvmlComputeInstancePlacement_t), + }) + +compute_instance_placement_dtype = _get_compute_instance_placement_dtype_offsets() + +cdef class ComputeInstancePlacement: + """Empty-initialize an array of `nvmlComputeInstancePlacement_t`. + The resulting object is of length `size` and of dtype `compute_instance_placement_dtype`. + If default-constructed, the instance represents a single struct. + + Args: + size (int): number of structs, default=1. + + .. seealso:: `nvmlComputeInstancePlacement_t` + """ + cdef: + readonly object _data + + def __init__(self, size=1): + arr = _numpy.empty(size, dtype=compute_instance_placement_dtype) + self._data = arr.view(_numpy.recarray) + assert self._data.itemsize == sizeof(nvmlComputeInstancePlacement_t), \ + f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlComputeInstancePlacement_t) }" + + def __repr__(self): + if self._data.size > 1: + return f"<{__name__}.ComputeInstancePlacement_Array_{self._data.size} object at {hex(id(self))}>" + else: + return f"<{__name__}.ComputeInstancePlacement object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return self._data.ctypes.data + + cdef intptr_t _get_ptr(self): + return self._data.ctypes.data + + def __int__(self): + if self._data.size > 1: + raise TypeError("int() argument must be a bytes-like object of size 1. " + "To get the pointer address of an array, use .ptr") + return self._data.ctypes.data + + def __len__(self): + return self._data.size + + def __eq__(self, other): + cdef object self_data = self._data + if (not isinstance(other, ComputeInstancePlacement)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype: + return False + return bool((self_data == other._data).all()) + + def __getbuffer__(self, Py_buffer *buffer, int flags): + _cyb_cpython.PyObject_GetBuffer(self._data, buffer, flags) + + def __releasebuffer__(self, Py_buffer *buffer): + _cyb_cpython.PyBuffer_Release(buffer) + + @property + def start(self): + """Union[~_numpy.uint32, int]: """ + if self._data.size == 1: + return int(self._data.start[0]) + return self._data.start + + @start.setter + def start(self, val): + self._data.start = val + + @property + def size_(self): + """Union[~_numpy.uint32, int]: """ + if self._data.size == 1: + return int(self._data.size_[0]) + return self._data.size_ + + @size_.setter + def size_(self, val): + self._data.size_ = val + + def __getitem__(self, key): + cdef ssize_t key_ + cdef ssize_t size + if isinstance(key, int): + key_ = key + size = self._data.size + if key_ >= size or key_ <= -(size+1): + raise IndexError("index is out of bounds") + if key_ < 0: + key_ += size + return ComputeInstancePlacement.from_data(self._data[key_:key_+1]) + out = self._data[key] + if isinstance(out, _numpy.recarray) and out.dtype == compute_instance_placement_dtype: + return ComputeInstancePlacement.from_data(out) + return out + + def __setitem__(self, key, val): + self._data[key] = val + + @staticmethod + def from_buffer(buffer): + """Create an ComputeInstancePlacement instance with the memory from the given buffer.""" + return ComputeInstancePlacement.from_data(_numpy.frombuffer(buffer, dtype=compute_instance_placement_dtype)) + + @staticmethod + def from_data(data): + """Create an ComputeInstancePlacement instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a 1D array of dtype `compute_instance_placement_dtype` holding the data. + """ + cdef ComputeInstancePlacement obj = ComputeInstancePlacement.__new__(ComputeInstancePlacement) + if not isinstance(data, _numpy.ndarray): + raise TypeError("data argument must be a NumPy ndarray") + if data.ndim != 1: + raise ValueError("data array must be 1D") + if data.dtype != compute_instance_placement_dtype: + raise ValueError("data array must be of dtype compute_instance_placement_dtype") + obj._data = data.view(_numpy.recarray) + + return obj + + @staticmethod + def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False): + """Create an ComputeInstancePlacement instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + size (int): number of structs, default=1. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef ComputeInstancePlacement obj = ComputeInstancePlacement.__new__(ComputeInstancePlacement) + cdef flag = _cyb_cpython_buffer.PyBUF_READ if readonly else _cyb_cpython_buffer.PyBUF_WRITE + cdef object buf = _cyb_cpython_memoryview.PyMemoryView_FromMemory( + ptr, sizeof(nvmlComputeInstancePlacement_t) * size, flag) + data = _numpy.ndarray(size, buffer=buf, dtype=compute_instance_placement_dtype) + obj._data = data.view(_numpy.recarray) + + return obj + + +cdef _get_compute_instance_profile_info_v2_dtype_offsets(): + cdef nvmlComputeInstanceProfileInfo_v2_t pod + return _numpy.dtype({ + 'names': ['version', 'id', 'slice_count', 'instance_count', 'multiprocessor_count', 'shared_copy_engine_count', 'shared_decoder_count', 'shared_encoder_count', 'shared_jpeg_count', 'shared_ofa_count', 'name'], + 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, (_numpy.int8, 96)], + 'offsets': [ + (&(pod.version)) - (&pod), + (&(pod.id)) - (&pod), + (&(pod.sliceCount)) - (&pod), + (&(pod.instanceCount)) - (&pod), + (&(pod.multiprocessorCount)) - (&pod), + (&(pod.sharedCopyEngineCount)) - (&pod), + (&(pod.sharedDecoderCount)) - (&pod), + (&(pod.sharedEncoderCount)) - (&pod), + (&(pod.sharedJpegCount)) - (&pod), + (&(pod.sharedOfaCount)) - (&pod), + (&(pod.name)) - (&pod), + ], + 'itemsize': sizeof(nvmlComputeInstanceProfileInfo_v2_t), + }) + +compute_instance_profile_info_v2_dtype = _get_compute_instance_profile_info_v2_dtype_offsets() + +cdef class ComputeInstanceProfileInfo_v2: + """Empty-initialize an instance of `nvmlComputeInstanceProfileInfo_v2_t`. + + + .. seealso:: `nvmlComputeInstanceProfileInfo_v2_t` + """ + cdef: + nvmlComputeInstanceProfileInfo_v2_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlComputeInstanceProfileInfo_v2_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ComputeInstanceProfileInfo_v2") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlComputeInstanceProfileInfo_v2_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.ComputeInstanceProfileInfo_v2 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef ComputeInstanceProfileInfo_v2 other_ + if not isinstance(other, ComputeInstanceProfileInfo_v2): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlComputeInstanceProfileInfo_v2_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlComputeInstanceProfileInfo_v2_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlComputeInstanceProfileInfo_v2_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ComputeInstanceProfileInfo_v2") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlComputeInstanceProfileInfo_v2_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def version(self): + """int: """ + return self._ptr[0].version + + @version.setter + def version(self, val): + if self._readonly: + raise ValueError("This ComputeInstanceProfileInfo_v2 instance is read-only") + self._ptr[0].version = val + + @property + def id(self): + """int: """ + return self._ptr[0].id + + @id.setter + def id(self, val): + if self._readonly: + raise ValueError("This ComputeInstanceProfileInfo_v2 instance is read-only") + self._ptr[0].id = val + + @property + def slice_count(self): + """int: """ + return self._ptr[0].sliceCount + + @slice_count.setter + def slice_count(self, val): + if self._readonly: + raise ValueError("This ComputeInstanceProfileInfo_v2 instance is read-only") + self._ptr[0].sliceCount = val + + @property + def instance_count(self): + """int: """ + return self._ptr[0].instanceCount + + @instance_count.setter + def instance_count(self, val): + if self._readonly: + raise ValueError("This ComputeInstanceProfileInfo_v2 instance is read-only") + self._ptr[0].instanceCount = val + + @property + def multiprocessor_count(self): + """int: """ + return self._ptr[0].multiprocessorCount + + @multiprocessor_count.setter + def multiprocessor_count(self, val): + if self._readonly: + raise ValueError("This ComputeInstanceProfileInfo_v2 instance is read-only") + self._ptr[0].multiprocessorCount = val + + @property + def shared_copy_engine_count(self): + """int: """ + return self._ptr[0].sharedCopyEngineCount + + @shared_copy_engine_count.setter + def shared_copy_engine_count(self, val): + if self._readonly: + raise ValueError("This ComputeInstanceProfileInfo_v2 instance is read-only") + self._ptr[0].sharedCopyEngineCount = val + + @property + def shared_decoder_count(self): + """int: """ + return self._ptr[0].sharedDecoderCount + + @shared_decoder_count.setter + def shared_decoder_count(self, val): + if self._readonly: + raise ValueError("This ComputeInstanceProfileInfo_v2 instance is read-only") + self._ptr[0].sharedDecoderCount = val + + @property + def shared_encoder_count(self): + """int: """ + return self._ptr[0].sharedEncoderCount + + @shared_encoder_count.setter + def shared_encoder_count(self, val): + if self._readonly: + raise ValueError("This ComputeInstanceProfileInfo_v2 instance is read-only") + self._ptr[0].sharedEncoderCount = val + + @property + def shared_jpeg_count(self): + """int: """ + return self._ptr[0].sharedJpegCount + + @shared_jpeg_count.setter + def shared_jpeg_count(self, val): + if self._readonly: + raise ValueError("This ComputeInstanceProfileInfo_v2 instance is read-only") + self._ptr[0].sharedJpegCount = val + + @property + def shared_ofa_count(self): + """int: """ + return self._ptr[0].sharedOfaCount + + @shared_ofa_count.setter + def shared_ofa_count(self, val): + if self._readonly: + raise ValueError("This ComputeInstanceProfileInfo_v2 instance is read-only") + self._ptr[0].sharedOfaCount = val + + @property + def name(self): + """~_numpy.int8: (array of length 96).""" + return _cyb_cpython.PyUnicode_FromString(self._ptr[0].name) + + @name.setter + def name(self, val): + if self._readonly: + raise ValueError("This ComputeInstanceProfileInfo_v2 instance is read-only") + cdef bytes buf = val.encode() + if len(buf) >= 96: + raise ValueError("String too long for field name, max length is 95") + cdef char *ptr = buf + _cyb_memcpy((self._ptr[0].name), ptr, 96) + + @staticmethod + def from_buffer(buffer): + """Create an ComputeInstanceProfileInfo_v2 instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlComputeInstanceProfileInfo_v2_t), ComputeInstanceProfileInfo_v2) + + @staticmethod + def from_data(data): + """Create an ComputeInstanceProfileInfo_v2 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `compute_instance_profile_info_v2_dtype` holding the data. + """ + return _cyb_from_data(data, "compute_instance_profile_info_v2_dtype", compute_instance_profile_info_v2_dtype, ComputeInstanceProfileInfo_v2) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an ComputeInstanceProfileInfo_v2 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef ComputeInstanceProfileInfo_v2 obj = ComputeInstanceProfileInfo_v2.__new__(ComputeInstanceProfileInfo_v2) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlComputeInstanceProfileInfo_v2_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating ComputeInstanceProfileInfo_v2") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlComputeInstanceProfileInfo_v2_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_compute_instance_profile_info_v3_dtype_offsets(): + cdef nvmlComputeInstanceProfileInfo_v3_t pod + return _numpy.dtype({ + 'names': ['version', 'id', 'slice_count', 'instance_count', 'multiprocessor_count', 'shared_copy_engine_count', 'shared_decoder_count', 'shared_encoder_count', 'shared_jpeg_count', 'shared_ofa_count', 'name', 'capabilities'], + 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, (_numpy.int8, 96), _numpy.uint32], + 'offsets': [ + (&(pod.version)) - (&pod), + (&(pod.id)) - (&pod), + (&(pod.sliceCount)) - (&pod), + (&(pod.instanceCount)) - (&pod), + (&(pod.multiprocessorCount)) - (&pod), + (&(pod.sharedCopyEngineCount)) - (&pod), + (&(pod.sharedDecoderCount)) - (&pod), + (&(pod.sharedEncoderCount)) - (&pod), + (&(pod.sharedJpegCount)) - (&pod), + (&(pod.sharedOfaCount)) - (&pod), + (&(pod.name)) - (&pod), + (&(pod.capabilities)) - (&pod), + ], + 'itemsize': sizeof(nvmlComputeInstanceProfileInfo_v3_t), + }) + +compute_instance_profile_info_v3_dtype = _get_compute_instance_profile_info_v3_dtype_offsets() + +cdef class ComputeInstanceProfileInfo_v3: + """Empty-initialize an instance of `nvmlComputeInstanceProfileInfo_v3_t`. + + + .. seealso:: `nvmlComputeInstanceProfileInfo_v3_t` + """ + cdef: + nvmlComputeInstanceProfileInfo_v3_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlComputeInstanceProfileInfo_v3_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ComputeInstanceProfileInfo_v3") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlComputeInstanceProfileInfo_v3_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.ComputeInstanceProfileInfo_v3 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef ComputeInstanceProfileInfo_v3 other_ + if not isinstance(other, ComputeInstanceProfileInfo_v3): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlComputeInstanceProfileInfo_v3_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlComputeInstanceProfileInfo_v3_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlComputeInstanceProfileInfo_v3_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ComputeInstanceProfileInfo_v3") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlComputeInstanceProfileInfo_v3_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def version(self): + """int: """ + return self._ptr[0].version + + @version.setter + def version(self, val): + if self._readonly: + raise ValueError("This ComputeInstanceProfileInfo_v3 instance is read-only") + self._ptr[0].version = val + + @property + def id(self): + """int: """ + return self._ptr[0].id + + @id.setter + def id(self, val): + if self._readonly: + raise ValueError("This ComputeInstanceProfileInfo_v3 instance is read-only") + self._ptr[0].id = val + + @property + def slice_count(self): + """int: """ + return self._ptr[0].sliceCount + + @slice_count.setter + def slice_count(self, val): + if self._readonly: + raise ValueError("This ComputeInstanceProfileInfo_v3 instance is read-only") + self._ptr[0].sliceCount = val + + @property + def instance_count(self): + """int: """ + return self._ptr[0].instanceCount + + @instance_count.setter + def instance_count(self, val): + if self._readonly: + raise ValueError("This ComputeInstanceProfileInfo_v3 instance is read-only") + self._ptr[0].instanceCount = val + + @property + def multiprocessor_count(self): + """int: """ + return self._ptr[0].multiprocessorCount + + @multiprocessor_count.setter + def multiprocessor_count(self, val): + if self._readonly: + raise ValueError("This ComputeInstanceProfileInfo_v3 instance is read-only") + self._ptr[0].multiprocessorCount = val + + @property + def shared_copy_engine_count(self): + """int: """ + return self._ptr[0].sharedCopyEngineCount + + @shared_copy_engine_count.setter + def shared_copy_engine_count(self, val): + if self._readonly: + raise ValueError("This ComputeInstanceProfileInfo_v3 instance is read-only") + self._ptr[0].sharedCopyEngineCount = val + + @property + def shared_decoder_count(self): + """int: """ + return self._ptr[0].sharedDecoderCount + + @shared_decoder_count.setter + def shared_decoder_count(self, val): + if self._readonly: + raise ValueError("This ComputeInstanceProfileInfo_v3 instance is read-only") + self._ptr[0].sharedDecoderCount = val + + @property + def shared_encoder_count(self): + """int: """ + return self._ptr[0].sharedEncoderCount + + @shared_encoder_count.setter + def shared_encoder_count(self, val): + if self._readonly: + raise ValueError("This ComputeInstanceProfileInfo_v3 instance is read-only") + self._ptr[0].sharedEncoderCount = val + + @property + def shared_jpeg_count(self): + """int: """ + return self._ptr[0].sharedJpegCount + + @shared_jpeg_count.setter + def shared_jpeg_count(self, val): + if self._readonly: + raise ValueError("This ComputeInstanceProfileInfo_v3 instance is read-only") + self._ptr[0].sharedJpegCount = val + + @property + def shared_ofa_count(self): + """int: """ + return self._ptr[0].sharedOfaCount + + @shared_ofa_count.setter + def shared_ofa_count(self, val): + if self._readonly: + raise ValueError("This ComputeInstanceProfileInfo_v3 instance is read-only") + self._ptr[0].sharedOfaCount = val + + @property + def name(self): + """~_numpy.int8: (array of length 96).""" + return _cyb_cpython.PyUnicode_FromString(self._ptr[0].name) + + @name.setter + def name(self, val): + if self._readonly: + raise ValueError("This ComputeInstanceProfileInfo_v3 instance is read-only") + cdef bytes buf = val.encode() + if len(buf) >= 96: + raise ValueError("String too long for field name, max length is 95") + cdef char *ptr = buf + _cyb_memcpy((self._ptr[0].name), ptr, 96) + + @property + def capabilities(self): + """int: """ + return self._ptr[0].capabilities + + @capabilities.setter + def capabilities(self, val): + if self._readonly: + raise ValueError("This ComputeInstanceProfileInfo_v3 instance is read-only") + self._ptr[0].capabilities = val + + @staticmethod + def from_buffer(buffer): + """Create an ComputeInstanceProfileInfo_v3 instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlComputeInstanceProfileInfo_v3_t), ComputeInstanceProfileInfo_v3) + + @staticmethod + def from_data(data): + """Create an ComputeInstanceProfileInfo_v3 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `compute_instance_profile_info_v3_dtype` holding the data. + """ + return _cyb_from_data(data, "compute_instance_profile_info_v3_dtype", compute_instance_profile_info_v3_dtype, ComputeInstanceProfileInfo_v3) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an ComputeInstanceProfileInfo_v3 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef ComputeInstanceProfileInfo_v3 obj = ComputeInstanceProfileInfo_v3.__new__(ComputeInstanceProfileInfo_v3) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlComputeInstanceProfileInfo_v3_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating ComputeInstanceProfileInfo_v3") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlComputeInstanceProfileInfo_v3_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_device_addressing_mode_v1_dtype_offsets(): + cdef nvmlDeviceAddressingMode_v1_t pod + return _numpy.dtype({ + 'names': ['version', 'value'], + 'formats': [_numpy.uint32, _numpy.uint32], + 'offsets': [ + (&(pod.version)) - (&pod), + (&(pod.value)) - (&pod), + ], + 'itemsize': sizeof(nvmlDeviceAddressingMode_v1_t), + }) + +device_addressing_mode_v1_dtype = _get_device_addressing_mode_v1_dtype_offsets() + +cdef class DeviceAddressingMode_v1: + """Empty-initialize an instance of `nvmlDeviceAddressingMode_v1_t`. + + + .. seealso:: `nvmlDeviceAddressingMode_v1_t` + """ + cdef: + nvmlDeviceAddressingMode_v1_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlDeviceAddressingMode_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating DeviceAddressingMode_v1") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlDeviceAddressingMode_v1_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.DeviceAddressingMode_v1 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef DeviceAddressingMode_v1 other_ + if not isinstance(other, DeviceAddressingMode_v1): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlDeviceAddressingMode_v1_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlDeviceAddressingMode_v1_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlDeviceAddressingMode_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating DeviceAddressingMode_v1") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlDeviceAddressingMode_v1_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def version(self): + """int: API version.""" + return self._ptr[0].version + + @version.setter + def version(self, val): + if self._readonly: + raise ValueError("This DeviceAddressingMode_v1 instance is read-only") + self._ptr[0].version = val + + @property + def value(self): + """int: One of `nvmlDeviceAddressingModeType_t`.""" + return self._ptr[0].value + + @value.setter + def value(self, val): + if self._readonly: + raise ValueError("This DeviceAddressingMode_v1 instance is read-only") + self._ptr[0].value = val + + @staticmethod + def from_buffer(buffer): + """Create an DeviceAddressingMode_v1 instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlDeviceAddressingMode_v1_t), DeviceAddressingMode_v1) + + @staticmethod + def from_data(data): + """Create an DeviceAddressingMode_v1 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `device_addressing_mode_v1_dtype` holding the data. + """ + return _cyb_from_data(data, "device_addressing_mode_v1_dtype", device_addressing_mode_v1_dtype, DeviceAddressingMode_v1) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an DeviceAddressingMode_v1 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef DeviceAddressingMode_v1 obj = DeviceAddressingMode_v1.__new__(DeviceAddressingMode_v1) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlDeviceAddressingMode_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating DeviceAddressingMode_v1") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlDeviceAddressingMode_v1_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_repair_status_v1_dtype_offsets(): + cdef nvmlRepairStatus_v1_t pod + return _numpy.dtype({ + 'names': ['version', 'b_channel_repair_pending', 'b_tpc_repair_pending'], + 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32], + 'offsets': [ + (&(pod.version)) - (&pod), + (&(pod.bChannelRepairPending)) - (&pod), + (&(pod.bTpcRepairPending)) - (&pod), + ], + 'itemsize': sizeof(nvmlRepairStatus_v1_t), + }) + +repair_status_v1_dtype = _get_repair_status_v1_dtype_offsets() + +cdef class RepairStatus_v1: + """Empty-initialize an instance of `nvmlRepairStatus_v1_t`. + + + .. seealso:: `nvmlRepairStatus_v1_t` + """ + cdef: + nvmlRepairStatus_v1_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlRepairStatus_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating RepairStatus_v1") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlRepairStatus_v1_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.RepairStatus_v1 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef RepairStatus_v1 other_ + if not isinstance(other, RepairStatus_v1): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlRepairStatus_v1_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlRepairStatus_v1_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlRepairStatus_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating RepairStatus_v1") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlRepairStatus_v1_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def version(self): + """int: API version number.""" + return self._ptr[0].version + + @version.setter + def version(self, val): + if self._readonly: + raise ValueError("This RepairStatus_v1 instance is read-only") + self._ptr[0].version = val + + @property + def b_channel_repair_pending(self): + """int: Reference to `unsigned` int.""" + return self._ptr[0].bChannelRepairPending + + @b_channel_repair_pending.setter + def b_channel_repair_pending(self, val): + if self._readonly: + raise ValueError("This RepairStatus_v1 instance is read-only") + self._ptr[0].bChannelRepairPending = val + + @property + def b_tpc_repair_pending(self): + """int: Reference to `unsigned` int.""" + return self._ptr[0].bTpcRepairPending + + @b_tpc_repair_pending.setter + def b_tpc_repair_pending(self, val): + if self._readonly: + raise ValueError("This RepairStatus_v1 instance is read-only") + self._ptr[0].bTpcRepairPending = val + + @staticmethod + def from_buffer(buffer): + """Create an RepairStatus_v1 instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlRepairStatus_v1_t), RepairStatus_v1) + + @staticmethod + def from_data(data): + """Create an RepairStatus_v1 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `repair_status_v1_dtype` holding the data. + """ + return _cyb_from_data(data, "repair_status_v1_dtype", repair_status_v1_dtype, RepairStatus_v1) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an RepairStatus_v1 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef RepairStatus_v1 obj = RepairStatus_v1.__new__(RepairStatus_v1) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlRepairStatus_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating RepairStatus_v1") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlRepairStatus_v1_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_device_power_mizer_modes_v1_dtype_offsets(): + cdef nvmlDevicePowerMizerModes_v1_t pod + return _numpy.dtype({ + 'names': ['current_mode', 'mode', 'supported_power_mizer_modes'], + 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32], + 'offsets': [ + (&(pod.currentMode)) - (&pod), + (&(pod.mode)) - (&pod), + (&(pod.supportedPowerMizerModes)) - (&pod), + ], + 'itemsize': sizeof(nvmlDevicePowerMizerModes_v1_t), + }) + +device_power_mizer_modes_v1_dtype = _get_device_power_mizer_modes_v1_dtype_offsets() + +cdef class DevicePowerMizerModes_v1: + """Empty-initialize an instance of `nvmlDevicePowerMizerModes_v1_t`. + + + .. seealso:: `nvmlDevicePowerMizerModes_v1_t` + """ + cdef: + nvmlDevicePowerMizerModes_v1_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlDevicePowerMizerModes_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating DevicePowerMizerModes_v1") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlDevicePowerMizerModes_v1_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.DevicePowerMizerModes_v1 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef DevicePowerMizerModes_v1 other_ + if not isinstance(other, DevicePowerMizerModes_v1): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlDevicePowerMizerModes_v1_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlDevicePowerMizerModes_v1_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlDevicePowerMizerModes_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating DevicePowerMizerModes_v1") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlDevicePowerMizerModes_v1_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def current_mode(self): + """int: OUT: the current powermizer mode.""" + return self._ptr[0].currentMode + + @current_mode.setter + def current_mode(self, val): + if self._readonly: + raise ValueError("This DevicePowerMizerModes_v1 instance is read-only") + self._ptr[0].currentMode = val + + @property + def mode(self): + """int: IN: the powermizer mode to set.""" + return self._ptr[0].mode + + @mode.setter + def mode(self, val): + if self._readonly: + raise ValueError("This DevicePowerMizerModes_v1 instance is read-only") + self._ptr[0].mode = val + + @property + def supported_power_mizer_modes(self): + """int: OUT: Bitmask of supported powermizer modes. The bitmask of supported power mizer modes on this device. The supported modes can be combined using the bitwise OR operator '|'. For example, if a device supports all PowerMizer modes, the bitmask would be: supportedPowerMizerModes = ((1 << NVML_POWER_MIZER_MODE_ADAPTIVE) | (1 << NVML_POWER_MIZER_MODE_PREFER_MAXIMUM_PERFORMANCE) | (1 << NVML_POWER_MIZER_MODE_AUTO) | (1 << NVML_POWER_MIZER_MODE_PREFER_CONSISTENT_PERFORMANCE)); This bitmask can be used to check which power mizer modes are available on the device by performing a bitwise AND operation with the specific mode you want to check.""" + return self._ptr[0].supportedPowerMizerModes + + @supported_power_mizer_modes.setter + def supported_power_mizer_modes(self, val): + if self._readonly: + raise ValueError("This DevicePowerMizerModes_v1 instance is read-only") + self._ptr[0].supportedPowerMizerModes = val + + @staticmethod + def from_buffer(buffer): + """Create an DevicePowerMizerModes_v1 instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlDevicePowerMizerModes_v1_t), DevicePowerMizerModes_v1) + + @staticmethod + def from_data(data): + """Create an DevicePowerMizerModes_v1 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `device_power_mizer_modes_v1_dtype` holding the data. + """ + return _cyb_from_data(data, "device_power_mizer_modes_v1_dtype", device_power_mizer_modes_v1_dtype, DevicePowerMizerModes_v1) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an DevicePowerMizerModes_v1 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef DevicePowerMizerModes_v1 obj = DevicePowerMizerModes_v1.__new__(DevicePowerMizerModes_v1) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlDevicePowerMizerModes_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating DevicePowerMizerModes_v1") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlDevicePowerMizerModes_v1_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_ecc_sram_unique_uncorrected_error_entry_v1_dtype_offsets(): + cdef nvmlEccSramUniqueUncorrectedErrorEntry_v1_t pod + return _numpy.dtype({ + 'names': ['unit', 'location', 'sublocation', 'extlocation', 'address', 'is_parity', 'count'], + 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32], + 'offsets': [ + (&(pod.unit)) - (&pod), + (&(pod.location)) - (&pod), + (&(pod.sublocation)) - (&pod), + (&(pod.extlocation)) - (&pod), + (&(pod.address)) - (&pod), + (&(pod.isParity)) - (&pod), + (&(pod.count)) - (&pod), + ], + 'itemsize': sizeof(nvmlEccSramUniqueUncorrectedErrorEntry_v1_t), + }) + +ecc_sram_unique_uncorrected_error_entry_v1_dtype = _get_ecc_sram_unique_uncorrected_error_entry_v1_dtype_offsets() + +cdef class EccSramUniqueUncorrectedErrorEntry_v1: + """Empty-initialize an array of `nvmlEccSramUniqueUncorrectedErrorEntry_v1_t`. + The resulting object is of length `size` and of dtype `ecc_sram_unique_uncorrected_error_entry_v1_dtype`. + If default-constructed, the instance represents a single struct. + + Args: + size (int): number of structs, default=1. + + .. seealso:: `nvmlEccSramUniqueUncorrectedErrorEntry_v1_t` + """ + cdef: + readonly object _data + + def __init__(self, size=1): + arr = _numpy.empty(size, dtype=ecc_sram_unique_uncorrected_error_entry_v1_dtype) + self._data = arr.view(_numpy.recarray) + assert self._data.itemsize == sizeof(nvmlEccSramUniqueUncorrectedErrorEntry_v1_t), \ + f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlEccSramUniqueUncorrectedErrorEntry_v1_t) }" + + def __repr__(self): + if self._data.size > 1: + return f"<{__name__}.EccSramUniqueUncorrectedErrorEntry_v1_Array_{self._data.size} object at {hex(id(self))}>" + else: + return f"<{__name__}.EccSramUniqueUncorrectedErrorEntry_v1 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return self._data.ctypes.data + + cdef intptr_t _get_ptr(self): + return self._data.ctypes.data + + def __int__(self): + if self._data.size > 1: + raise TypeError("int() argument must be a bytes-like object of size 1. " + "To get the pointer address of an array, use .ptr") + return self._data.ctypes.data + + def __len__(self): + return self._data.size + + def __eq__(self, other): + cdef object self_data = self._data + if (not isinstance(other, EccSramUniqueUncorrectedErrorEntry_v1)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype: + return False + return bool((self_data == other._data).all()) + + def __getbuffer__(self, Py_buffer *buffer, int flags): + _cyb_cpython.PyObject_GetBuffer(self._data, buffer, flags) + + def __releasebuffer__(self, Py_buffer *buffer): + _cyb_cpython.PyBuffer_Release(buffer) + + @property + def unit(self): + """Union[~_numpy.uint32, int]: the SRAM unit index""" + if self._data.size == 1: + return int(self._data.unit[0]) + return self._data.unit + + @unit.setter + def unit(self, val): + self._data.unit = val + + @property + def location(self): + """Union[~_numpy.uint32, int]: the error location within the SRAM unit""" + if self._data.size == 1: + return int(self._data.location[0]) + return self._data.location + + @location.setter + def location(self, val): + self._data.location = val + + @property + def sublocation(self): + """Union[~_numpy.uint32, int]: the error sublocation within the SRAM unit""" + if self._data.size == 1: + return int(self._data.sublocation[0]) + return self._data.sublocation + + @sublocation.setter + def sublocation(self, val): + self._data.sublocation = val + + @property + def extlocation(self): + """Union[~_numpy.uint32, int]: the error extlocation within the SRAM unit""" + if self._data.size == 1: + return int(self._data.extlocation[0]) + return self._data.extlocation + + @extlocation.setter + def extlocation(self, val): + self._data.extlocation = val + + @property + def address(self): + """Union[~_numpy.uint32, int]: the error address within the SRAM unit""" + if self._data.size == 1: + return int(self._data.address[0]) + return self._data.address + + @address.setter + def address(self, val): + self._data.address = val + + @property + def is_parity(self): + """Union[~_numpy.uint32, int]: if the SRAM error is parity or not""" + if self._data.size == 1: + return int(self._data.is_parity[0]) + return self._data.is_parity + + @is_parity.setter + def is_parity(self, val): + self._data.is_parity = val + + @property + def count(self): + """Union[~_numpy.uint32, int]: the error count at the same SRAM address""" + if self._data.size == 1: + return int(self._data.count[0]) + return self._data.count + + @count.setter + def count(self, val): + self._data.count = val + + def __getitem__(self, key): + cdef ssize_t key_ + cdef ssize_t size + if isinstance(key, int): + key_ = key + size = self._data.size + if key_ >= size or key_ <= -(size+1): + raise IndexError("index is out of bounds") + if key_ < 0: + key_ += size + return EccSramUniqueUncorrectedErrorEntry_v1.from_data(self._data[key_:key_+1]) + out = self._data[key] + if isinstance(out, _numpy.recarray) and out.dtype == ecc_sram_unique_uncorrected_error_entry_v1_dtype: + return EccSramUniqueUncorrectedErrorEntry_v1.from_data(out) + return out + + def __setitem__(self, key, val): + self._data[key] = val + + @staticmethod + def from_buffer(buffer): + """Create an EccSramUniqueUncorrectedErrorEntry_v1 instance with the memory from the given buffer.""" + return EccSramUniqueUncorrectedErrorEntry_v1.from_data(_numpy.frombuffer(buffer, dtype=ecc_sram_unique_uncorrected_error_entry_v1_dtype)) + + @staticmethod + def from_data(data): + """Create an EccSramUniqueUncorrectedErrorEntry_v1 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a 1D array of dtype `ecc_sram_unique_uncorrected_error_entry_v1_dtype` holding the data. + """ + cdef EccSramUniqueUncorrectedErrorEntry_v1 obj = EccSramUniqueUncorrectedErrorEntry_v1.__new__(EccSramUniqueUncorrectedErrorEntry_v1) + if not isinstance(data, _numpy.ndarray): + raise TypeError("data argument must be a NumPy ndarray") + if data.ndim != 1: + raise ValueError("data array must be 1D") + if data.dtype != ecc_sram_unique_uncorrected_error_entry_v1_dtype: + raise ValueError("data array must be of dtype ecc_sram_unique_uncorrected_error_entry_v1_dtype") + obj._data = data.view(_numpy.recarray) + + return obj + + @staticmethod + def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False): + """Create an EccSramUniqueUncorrectedErrorEntry_v1 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + size (int): number of structs, default=1. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef EccSramUniqueUncorrectedErrorEntry_v1 obj = EccSramUniqueUncorrectedErrorEntry_v1.__new__(EccSramUniqueUncorrectedErrorEntry_v1) + cdef flag = _cyb_cpython_buffer.PyBUF_READ if readonly else _cyb_cpython_buffer.PyBUF_WRITE + cdef object buf = _cyb_cpython_memoryview.PyMemoryView_FromMemory( + ptr, sizeof(nvmlEccSramUniqueUncorrectedErrorEntry_v1_t) * size, flag) + data = _numpy.ndarray(size, buffer=buf, dtype=ecc_sram_unique_uncorrected_error_entry_v1_dtype) + obj._data = data.view(_numpy.recarray) + + return obj + + +cdef _get_gpu_fabric_info_v3_dtype_offsets(): + cdef nvmlGpuFabricInfo_v3_t pod + return _numpy.dtype({ + 'names': ['version', 'cluster_uuid', 'status', 'clique_id', 'state', 'health_mask', 'health_summary'], + 'formats': [_numpy.uint32, (_numpy.uint8, 16), _numpy.int32, _numpy.uint32, _numpy.uint8, _numpy.uint32, _numpy.uint8], + 'offsets': [ + (&(pod.version)) - (&pod), + (&(pod.clusterUuid)) - (&pod), + (&(pod.status)) - (&pod), + (&(pod.cliqueId)) - (&pod), + (&(pod.state)) - (&pod), + (&(pod.healthMask)) - (&pod), + (&(pod.healthSummary)) - (&pod), + ], + 'itemsize': sizeof(nvmlGpuFabricInfo_v3_t), + }) + +gpu_fabric_info_v3_dtype = _get_gpu_fabric_info_v3_dtype_offsets() + +cdef class GpuFabricInfo_v3: + """Empty-initialize an instance of `nvmlGpuFabricInfo_v3_t`. + + + .. seealso:: `nvmlGpuFabricInfo_v3_t` + """ + cdef: + nvmlGpuFabricInfo_v3_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlGpuFabricInfo_v3_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating GpuFabricInfo_v3") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlGpuFabricInfo_v3_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.GpuFabricInfo_v3 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef GpuFabricInfo_v3 other_ + if not isinstance(other, GpuFabricInfo_v3): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlGpuFabricInfo_v3_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlGpuFabricInfo_v3_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlGpuFabricInfo_v3_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating GpuFabricInfo_v3") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlGpuFabricInfo_v3_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def version(self): + """int: Structure version identifier (set to nvmlGpuFabricInfo_v2).""" + return self._ptr[0].version + + @version.setter + def version(self, val): + if self._readonly: + raise ValueError("This GpuFabricInfo_v3 instance is read-only") + self._ptr[0].version = val + + @property + def cluster_uuid(self): + """~_numpy.uint8: (array of length 16).Uuid of the cluster to which this GPU belongs.""" + cdef _cyb_view.array arr = _cyb_view.array(shape=(16,), itemsize=sizeof(unsigned char), format="B", mode="c", allocate_buffer=False) + arr.data = (&(self._ptr[0].clusterUuid)) + return _numpy.asarray(arr) + + @cluster_uuid.setter + def cluster_uuid(self, val): + if self._readonly: + raise ValueError("This GpuFabricInfo_v3 instance is read-only") + if len(val) != 16: + raise ValueError(f"Expected length { 16 } for field cluster_uuid, got {len(val)}") + cdef _cyb_view.array arr = _cyb_view.array(shape=(16,), itemsize=sizeof(unsigned char), format="B", mode="c") + arr[:] = _numpy.asarray(val, dtype=_numpy.uint8) + _cyb_memcpy((&(self._ptr[0].clusterUuid)), (arr.data), sizeof(unsigned char) * len(val)) + + @property + def status(self): + """int: Probe Error status, if any. Must be checked only if Probe state returns "complete".""" + return (self._ptr[0].status) + + @status.setter + def status(self, val): + if self._readonly: + raise ValueError("This GpuFabricInfo_v3 instance is read-only") + self._ptr[0].status = val + + @property + def clique_id(self): + """int: ID of the fabric clique to which this GPU belongs.""" + return self._ptr[0].cliqueId + + @clique_id.setter + def clique_id(self, val): + if self._readonly: + raise ValueError("This GpuFabricInfo_v3 instance is read-only") + self._ptr[0].cliqueId = val + + @property + def state(self): + """int: Current Probe State of GPU registration process. See NVML_GPU_FABRIC_STATE_*.""" + return (self._ptr[0].state) + + @state.setter + def state(self, val): + if self._readonly: + raise ValueError("This GpuFabricInfo_v3 instance is read-only") + self._ptr[0].state = val + + @property + def health_mask(self): + """int: GPU Fabric health Status Mask. See NVML_GPU_FABRIC_HEALTH_MASK_*.""" + return self._ptr[0].healthMask + + @health_mask.setter + def health_mask(self, val): + if self._readonly: + raise ValueError("This GpuFabricInfo_v3 instance is read-only") + self._ptr[0].healthMask = val + + @property + def health_summary(self): + """int: GPU Fabric health summary. See NVML_GPU_FABRIC_HEALTH_SUMMARY_*.""" + return self._ptr[0].healthSummary + + @health_summary.setter + def health_summary(self, val): + if self._readonly: + raise ValueError("This GpuFabricInfo_v3 instance is read-only") + self._ptr[0].healthSummary = val + + @staticmethod + def from_buffer(buffer): + """Create an GpuFabricInfo_v3 instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlGpuFabricInfo_v3_t), GpuFabricInfo_v3) + + @staticmethod + def from_data(data): + """Create an GpuFabricInfo_v3 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `gpu_fabric_info_v3_dtype` holding the data. + """ + return _cyb_from_data(data, "gpu_fabric_info_v3_dtype", gpu_fabric_info_v3_dtype, GpuFabricInfo_v3) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an GpuFabricInfo_v3 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef GpuFabricInfo_v3 obj = GpuFabricInfo_v3.__new__(GpuFabricInfo_v3) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlGpuFabricInfo_v3_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating GpuFabricInfo_v3") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlGpuFabricInfo_v3_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_nv_link_info_v1_dtype_offsets(): + cdef nvmlNvLinkInfo_v1_t pod + return _numpy.dtype({ + 'names': ['version', 'is_nvle_enabled'], + 'formats': [_numpy.uint32, _numpy.uint32], + 'offsets': [ + (&(pod.version)) - (&pod), + (&(pod.isNvleEnabled)) - (&pod), + ], + 'itemsize': sizeof(nvmlNvLinkInfo_v1_t), + }) + +nv_link_info_v1_dtype = _get_nv_link_info_v1_dtype_offsets() + +cdef class NvLinkInfo_v1: + """Empty-initialize an instance of `nvmlNvLinkInfo_v1_t`. + + + .. seealso:: `nvmlNvLinkInfo_v1_t` + """ + cdef: + nvmlNvLinkInfo_v1_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlNvLinkInfo_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating NvLinkInfo_v1") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlNvLinkInfo_v1_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.NvLinkInfo_v1 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef NvLinkInfo_v1 other_ + if not isinstance(other, NvLinkInfo_v1): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlNvLinkInfo_v1_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlNvLinkInfo_v1_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlNvLinkInfo_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating NvLinkInfo_v1") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlNvLinkInfo_v1_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def version(self): + """int: IN - the API version number.""" + return self._ptr[0].version + + @version.setter + def version(self, val): + if self._readonly: + raise ValueError("This NvLinkInfo_v1 instance is read-only") + self._ptr[0].version = val + + @property + def is_nvle_enabled(self): + """int: OUT - NVLINK encryption enablement.""" + return self._ptr[0].isNvleEnabled + + @is_nvle_enabled.setter + def is_nvle_enabled(self, val): + if self._readonly: + raise ValueError("This NvLinkInfo_v1 instance is read-only") + self._ptr[0].isNvleEnabled = val + + @staticmethod + def from_buffer(buffer): + """Create an NvLinkInfo_v1 instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlNvLinkInfo_v1_t), NvLinkInfo_v1) + + @staticmethod + def from_data(data): + """Create an NvLinkInfo_v1 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `nv_link_info_v1_dtype` holding the data. + """ + return _cyb_from_data(data, "nv_link_info_v1_dtype", nv_link_info_v1_dtype, NvLinkInfo_v1) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an NvLinkInfo_v1 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef NvLinkInfo_v1 obj = NvLinkInfo_v1.__new__(NvLinkInfo_v1) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlNvLinkInfo_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating NvLinkInfo_v1") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlNvLinkInfo_v1_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_nvlink_firmware_version_dtype_offsets(): + cdef nvmlNvlinkFirmwareVersion_t pod + return _numpy.dtype({ + 'names': ['ucode_type', 'major', 'minor', 'sub_minor'], + 'formats': [_numpy.uint8, _numpy.uint32, _numpy.uint32, _numpy.uint32], + 'offsets': [ + (&(pod.ucodeType)) - (&pod), + (&(pod.major)) - (&pod), + (&(pod.minor)) - (&pod), + (&(pod.subMinor)) - (&pod), + ], + 'itemsize': sizeof(nvmlNvlinkFirmwareVersion_t), + }) + +nvlink_firmware_version_dtype = _get_nvlink_firmware_version_dtype_offsets() + +cdef class NvlinkFirmwareVersion: + """Empty-initialize an instance of `nvmlNvlinkFirmwareVersion_t`. + + + .. seealso:: `nvmlNvlinkFirmwareVersion_t` + """ + cdef: + nvmlNvlinkFirmwareVersion_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlNvlinkFirmwareVersion_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating NvlinkFirmwareVersion") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlNvlinkFirmwareVersion_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.NvlinkFirmwareVersion object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef NvlinkFirmwareVersion other_ + if not isinstance(other, NvlinkFirmwareVersion): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlNvlinkFirmwareVersion_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlNvlinkFirmwareVersion_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlNvlinkFirmwareVersion_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating NvlinkFirmwareVersion") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlNvlinkFirmwareVersion_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def ucode_type(self): + """int: """ + return self._ptr[0].ucodeType + + @ucode_type.setter + def ucode_type(self, val): + if self._readonly: + raise ValueError("This NvlinkFirmwareVersion instance is read-only") + self._ptr[0].ucodeType = val + + @property + def major(self): + """int: """ + return self._ptr[0].major + + @major.setter + def major(self, val): + if self._readonly: + raise ValueError("This NvlinkFirmwareVersion instance is read-only") + self._ptr[0].major = val + + @property + def minor(self): + """int: """ + return self._ptr[0].minor + + @minor.setter + def minor(self, val): + if self._readonly: + raise ValueError("This NvlinkFirmwareVersion instance is read-only") + self._ptr[0].minor = val + + @property + def sub_minor(self): + """int: """ + return self._ptr[0].subMinor + + @sub_minor.setter + def sub_minor(self, val): + if self._readonly: + raise ValueError("This NvlinkFirmwareVersion instance is read-only") + self._ptr[0].subMinor = val + + @staticmethod + def from_buffer(buffer): + """Create an NvlinkFirmwareVersion instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlNvlinkFirmwareVersion_t), NvlinkFirmwareVersion) + + @staticmethod + def from_data(data): + """Create an NvlinkFirmwareVersion instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `nvlink_firmware_version_dtype` holding the data. + """ + return _cyb_from_data(data, "nvlink_firmware_version_dtype", nvlink_firmware_version_dtype, NvlinkFirmwareVersion) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an NvlinkFirmwareVersion instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef NvlinkFirmwareVersion obj = NvlinkFirmwareVersion.__new__(NvlinkFirmwareVersion) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlNvlinkFirmwareVersion_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating NvlinkFirmwareVersion") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlNvlinkFirmwareVersion_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_prm_counter_input_v1_dtype_offsets(): + cdef nvmlPRMCounterInput_v1_t pod + return _numpy.dtype({ + 'names': ['local_port'], + 'formats': [_numpy.uint32], + 'offsets': [ + (&(pod.localPort)) - (&pod), + ], + 'itemsize': sizeof(nvmlPRMCounterInput_v1_t), + }) + +prm_counter_input_v1_dtype = _get_prm_counter_input_v1_dtype_offsets() + +cdef class PRMCounterInput_v1: + """Empty-initialize an instance of `nvmlPRMCounterInput_v1_t`. + + + .. seealso:: `nvmlPRMCounterInput_v1_t` + """ + cdef: + nvmlPRMCounterInput_v1_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlPRMCounterInput_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating PRMCounterInput_v1") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlPRMCounterInput_v1_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.PRMCounterInput_v1 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef PRMCounterInput_v1 other_ + if not isinstance(other, PRMCounterInput_v1): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlPRMCounterInput_v1_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlPRMCounterInput_v1_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlPRMCounterInput_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating PRMCounterInput_v1") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlPRMCounterInput_v1_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def local_port(self): + """int: Local port number.""" + return self._ptr[0].localPort + + @local_port.setter + def local_port(self, val): + if self._readonly: + raise ValueError("This PRMCounterInput_v1 instance is read-only") + self._ptr[0].localPort = val + + @staticmethod + def from_buffer(buffer): + """Create an PRMCounterInput_v1 instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlPRMCounterInput_v1_t), PRMCounterInput_v1) + + @staticmethod + def from_data(data): + """Create an PRMCounterInput_v1 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `prm_counter_input_v1_dtype` holding the data. + """ + return _cyb_from_data(data, "prm_counter_input_v1_dtype", prm_counter_input_v1_dtype, PRMCounterInput_v1) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an PRMCounterInput_v1 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef PRMCounterInput_v1 obj = PRMCounterInput_v1.__new__(PRMCounterInput_v1) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlPRMCounterInput_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating PRMCounterInput_v1") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlPRMCounterInput_v1_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_vgpu_scheduler_state_info_v2_dtype_offsets(): + cdef nvmlVgpuSchedulerStateInfo_v2_t pod + return _numpy.dtype({ + 'names': ['engine_id', 'scheduler_policy', 'avg_factor', 'timeslice'], + 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32], + 'offsets': [ + (&(pod.engineId)) - (&pod), + (&(pod.schedulerPolicy)) - (&pod), + (&(pod.avgFactor)) - (&pod), + (&(pod.timeslice)) - (&pod), + ], + 'itemsize': sizeof(nvmlVgpuSchedulerStateInfo_v2_t), + }) + +vgpu_scheduler_state_info_v2_dtype = _get_vgpu_scheduler_state_info_v2_dtype_offsets() + +cdef class VgpuSchedulerStateInfo_v2: + """Empty-initialize an instance of `nvmlVgpuSchedulerStateInfo_v2_t`. + + + .. seealso:: `nvmlVgpuSchedulerStateInfo_v2_t` + """ + cdef: + nvmlVgpuSchedulerStateInfo_v2_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlVgpuSchedulerStateInfo_v2_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuSchedulerStateInfo_v2") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlVgpuSchedulerStateInfo_v2_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.VgpuSchedulerStateInfo_v2 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef VgpuSchedulerStateInfo_v2 other_ + if not isinstance(other, VgpuSchedulerStateInfo_v2): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuSchedulerStateInfo_v2_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlVgpuSchedulerStateInfo_v2_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlVgpuSchedulerStateInfo_v2_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuSchedulerStateInfo_v2") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuSchedulerStateInfo_v2_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def engine_id(self): + """int: IN: Engine whose software scheduler state info is fetched. One of NVML_VGPU_SCHEDULER_ENGINE_TYPE_*.""" + return self._ptr[0].engineId + + @engine_id.setter + def engine_id(self, val): + if self._readonly: + raise ValueError("This VgpuSchedulerStateInfo_v2 instance is read-only") + self._ptr[0].engineId = val + + @property + def scheduler_policy(self): + """int: OUT: Scheduler policy.""" + return self._ptr[0].schedulerPolicy + + @scheduler_policy.setter + def scheduler_policy(self, val): + if self._readonly: + raise ValueError("This VgpuSchedulerStateInfo_v2 instance is read-only") + self._ptr[0].schedulerPolicy = val + + @property + def avg_factor(self): + """int: OUT: Average factor in compensating the timeslice for Adaptive Round Robin mode. 0 when there is no active scheduling.""" + return self._ptr[0].avgFactor + + @avg_factor.setter + def avg_factor(self, val): + if self._readonly: + raise ValueError("This VgpuSchedulerStateInfo_v2 instance is read-only") + self._ptr[0].avgFactor = val + + @property + def timeslice(self): + """int: OUT: The timeslice in ns for each software run list as configured, or the default value otherwise. 0 when there is no active scheduling.""" + return self._ptr[0].timeslice + + @timeslice.setter + def timeslice(self, val): + if self._readonly: + raise ValueError("This VgpuSchedulerStateInfo_v2 instance is read-only") + self._ptr[0].timeslice = val + + @staticmethod + def from_buffer(buffer): + """Create an VgpuSchedulerStateInfo_v2 instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlVgpuSchedulerStateInfo_v2_t), VgpuSchedulerStateInfo_v2) + + @staticmethod + def from_data(data): + """Create an VgpuSchedulerStateInfo_v2 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `vgpu_scheduler_state_info_v2_dtype` holding the data. + """ + return _cyb_from_data(data, "vgpu_scheduler_state_info_v2_dtype", vgpu_scheduler_state_info_v2_dtype, VgpuSchedulerStateInfo_v2) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an VgpuSchedulerStateInfo_v2 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef VgpuSchedulerStateInfo_v2 obj = VgpuSchedulerStateInfo_v2.__new__(VgpuSchedulerStateInfo_v2) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlVgpuSchedulerStateInfo_v2_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating VgpuSchedulerStateInfo_v2") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlVgpuSchedulerStateInfo_v2_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_vgpu_scheduler_log_entry_v2_dtype_offsets(): + cdef nvmlVgpuSchedulerLogEntry_v2_t pod + return _numpy.dtype({ + 'names': ['timestamp', 'time_run_total', 'time_run', 'sw_runlist_id', 'target_time_slice', 'cumulative_preemption_time', 'weight'], + 'formats': [_numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint32, _numpy.uint64, _numpy.uint64, _numpy.uint32], + 'offsets': [ + (&(pod.timestamp)) - (&pod), + (&(pod.timeRunTotal)) - (&pod), + (&(pod.timeRun)) - (&pod), + (&(pod.swRunlistId)) - (&pod), + (&(pod.targetTimeSlice)) - (&pod), + (&(pod.cumulativePreemptionTime)) - (&pod), + (&(pod.weight)) - (&pod), + ], + 'itemsize': sizeof(nvmlVgpuSchedulerLogEntry_v2_t), + }) + +vgpu_scheduler_log_entry_v2_dtype = _get_vgpu_scheduler_log_entry_v2_dtype_offsets() + +cdef class VgpuSchedulerLogEntry_v2: + """Empty-initialize an array of `nvmlVgpuSchedulerLogEntry_v2_t`. + The resulting object is of length `size` and of dtype `vgpu_scheduler_log_entry_v2_dtype`. + If default-constructed, the instance represents a single struct. + + Args: + size (int): number of structs, default=1. + + .. seealso:: `nvmlVgpuSchedulerLogEntry_v2_t` + """ + cdef: + readonly object _data + + def __init__(self, size=1): + arr = _numpy.empty(size, dtype=vgpu_scheduler_log_entry_v2_dtype) + self._data = arr.view(_numpy.recarray) + assert self._data.itemsize == sizeof(nvmlVgpuSchedulerLogEntry_v2_t), \ + f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlVgpuSchedulerLogEntry_v2_t) }" + + def __repr__(self): + if self._data.size > 1: + return f"<{__name__}.VgpuSchedulerLogEntry_v2_Array_{self._data.size} object at {hex(id(self))}>" + else: + return f"<{__name__}.VgpuSchedulerLogEntry_v2 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return self._data.ctypes.data + + cdef intptr_t _get_ptr(self): + return self._data.ctypes.data + + def __int__(self): + if self._data.size > 1: + raise TypeError("int() argument must be a bytes-like object of size 1. " + "To get the pointer address of an array, use .ptr") + return self._data.ctypes.data + + def __len__(self): + return self._data.size + + def __eq__(self, other): + cdef object self_data = self._data + if (not isinstance(other, VgpuSchedulerLogEntry_v2)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype: + return False + return bool((self_data == other._data).all()) + + def __getbuffer__(self, Py_buffer *buffer, int flags): + _cyb_cpython.PyObject_GetBuffer(self._data, buffer, flags) + + def __releasebuffer__(self, Py_buffer *buffer): + _cyb_cpython.PyBuffer_Release(buffer) + + @property + def timestamp(self): + """Union[~_numpy.uint64, int]: OUT: Timestamp in ns when this software runlist was preeempted.""" + if self._data.size == 1: + return int(self._data.timestamp[0]) + return self._data.timestamp + + @timestamp.setter + def timestamp(self, val): + self._data.timestamp = val + + @property + def time_run_total(self): + """Union[~_numpy.uint64, int]: OUT: Total time in ns this software runlist has run.""" + if self._data.size == 1: + return int(self._data.time_run_total[0]) + return self._data.time_run_total + + @time_run_total.setter + def time_run_total(self, val): + self._data.time_run_total = val + + @property + def time_run(self): + """Union[~_numpy.uint64, int]: OUT: Time in ns this software runlist ran before preemption.""" + if self._data.size == 1: + return int(self._data.time_run[0]) + return self._data.time_run + + @time_run.setter + def time_run(self, val): + self._data.time_run = val + + @property + def sw_runlist_id(self): + """Union[~_numpy.uint32, int]: OUT: Software runlist Id.""" + if self._data.size == 1: + return int(self._data.sw_runlist_id[0]) + return self._data.sw_runlist_id + + @sw_runlist_id.setter + def sw_runlist_id(self, val): + self._data.sw_runlist_id = val + + @property + def target_time_slice(self): + """Union[~_numpy.uint64, int]: OUT: The actual timeslice after deduction.""" + if self._data.size == 1: + return int(self._data.target_time_slice[0]) + return self._data.target_time_slice + + @target_time_slice.setter + def target_time_slice(self, val): + self._data.target_time_slice = val + + @property + def cumulative_preemption_time(self): + """Union[~_numpy.uint64, int]: OUT: Preemption time in ns for this SW runlist.""" + if self._data.size == 1: + return int(self._data.cumulative_preemption_time[0]) + return self._data.cumulative_preemption_time + + @cumulative_preemption_time.setter + def cumulative_preemption_time(self, val): + self._data.cumulative_preemption_time = val + + @property + def weight(self): + """Union[~_numpy.uint32, int]: OUT: Current weight of this SW runlist.""" + if self._data.size == 1: + return int(self._data.weight[0]) + return self._data.weight + + @weight.setter + def weight(self, val): + self._data.weight = val + + def __getitem__(self, key): + cdef ssize_t key_ + cdef ssize_t size + if isinstance(key, int): + key_ = key + size = self._data.size + if key_ >= size or key_ <= -(size+1): + raise IndexError("index is out of bounds") + if key_ < 0: + key_ += size + return VgpuSchedulerLogEntry_v2.from_data(self._data[key_:key_+1]) + out = self._data[key] + if isinstance(out, _numpy.recarray) and out.dtype == vgpu_scheduler_log_entry_v2_dtype: + return VgpuSchedulerLogEntry_v2.from_data(out) + return out + + def __setitem__(self, key, val): + self._data[key] = val + + @staticmethod + def from_buffer(buffer): + """Create an VgpuSchedulerLogEntry_v2 instance with the memory from the given buffer.""" + return VgpuSchedulerLogEntry_v2.from_data(_numpy.frombuffer(buffer, dtype=vgpu_scheduler_log_entry_v2_dtype)) + + @staticmethod + def from_data(data): + """Create an VgpuSchedulerLogEntry_v2 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a 1D array of dtype `vgpu_scheduler_log_entry_v2_dtype` holding the data. + """ + cdef VgpuSchedulerLogEntry_v2 obj = VgpuSchedulerLogEntry_v2.__new__(VgpuSchedulerLogEntry_v2) + if not isinstance(data, _numpy.ndarray): + raise TypeError("data argument must be a NumPy ndarray") + if data.ndim != 1: + raise ValueError("data array must be 1D") + if data.dtype != vgpu_scheduler_log_entry_v2_dtype: + raise ValueError("data array must be of dtype vgpu_scheduler_log_entry_v2_dtype") + obj._data = data.view(_numpy.recarray) + + return obj + + @staticmethod + def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False): + """Create an VgpuSchedulerLogEntry_v2 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + size (int): number of structs, default=1. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef VgpuSchedulerLogEntry_v2 obj = VgpuSchedulerLogEntry_v2.__new__(VgpuSchedulerLogEntry_v2) + cdef flag = _cyb_cpython_buffer.PyBUF_READ if readonly else _cyb_cpython_buffer.PyBUF_WRITE + cdef object buf = _cyb_cpython_memoryview.PyMemoryView_FromMemory( + ptr, sizeof(nvmlVgpuSchedulerLogEntry_v2_t) * size, flag) + data = _numpy.ndarray(size, buffer=buf, dtype=vgpu_scheduler_log_entry_v2_dtype) + obj._data = data.view(_numpy.recarray) + + return obj + + +cdef _get_vgpu_scheduler_state_v2_dtype_offsets(): + cdef nvmlVgpuSchedulerState_v2_t pod + return _numpy.dtype({ + 'names': ['engine_id', 'scheduler_policy', 'avg_factor', 'frequency'], + 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32], + 'offsets': [ + (&(pod.engineId)) - (&pod), + (&(pod.schedulerPolicy)) - (&pod), + (&(pod.avgFactor)) - (&pod), + (&(pod.frequency)) - (&pod), + ], + 'itemsize': sizeof(nvmlVgpuSchedulerState_v2_t), + }) + +vgpu_scheduler_state_v2_dtype = _get_vgpu_scheduler_state_v2_dtype_offsets() + +cdef class VgpuSchedulerState_v2: + """Empty-initialize an instance of `nvmlVgpuSchedulerState_v2_t`. + + + .. seealso:: `nvmlVgpuSchedulerState_v2_t` + """ + cdef: + nvmlVgpuSchedulerState_v2_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlVgpuSchedulerState_v2_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuSchedulerState_v2") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlVgpuSchedulerState_v2_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.VgpuSchedulerState_v2 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef VgpuSchedulerState_v2 other_ + if not isinstance(other, VgpuSchedulerState_v2): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuSchedulerState_v2_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlVgpuSchedulerState_v2_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlVgpuSchedulerState_v2_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuSchedulerState_v2") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuSchedulerState_v2_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def engine_id(self): + """int: IN: One of NVML_VGPU_SCHEDULER_ENGINE_TYPE_*.""" + return self._ptr[0].engineId + + @engine_id.setter + def engine_id(self, val): + if self._readonly: + raise ValueError("This VgpuSchedulerState_v2 instance is read-only") + self._ptr[0].engineId = val + + @property + def scheduler_policy(self): + """int: IN: Scheduler policy.""" + return self._ptr[0].schedulerPolicy + + @scheduler_policy.setter + def scheduler_policy(self, val): + if self._readonly: + raise ValueError("This VgpuSchedulerState_v2 instance is read-only") + self._ptr[0].schedulerPolicy = val + + @property + def avg_factor(self): + """int: IN: Average factor in compensating the timeslice for Adaptive Round Robin mode. 0 or unspecified uses default.""" + return self._ptr[0].avgFactor + + @avg_factor.setter + def avg_factor(self, val): + if self._readonly: + raise ValueError("This VgpuSchedulerState_v2 instance is read-only") + self._ptr[0].avgFactor = val + + @property + def frequency(self): + """int: IN: Frequency for Adaptive Round Robin mode. 0 or unspecified uses default.""" + return self._ptr[0].frequency + + @frequency.setter + def frequency(self, val): + if self._readonly: + raise ValueError("This VgpuSchedulerState_v2 instance is read-only") + self._ptr[0].frequency = val + + @staticmethod + def from_buffer(buffer): + """Create an VgpuSchedulerState_v2 instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlVgpuSchedulerState_v2_t), VgpuSchedulerState_v2) + + @staticmethod + def from_data(data): + """Create an VgpuSchedulerState_v2 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `vgpu_scheduler_state_v2_dtype` holding the data. + """ + return _cyb_from_data(data, "vgpu_scheduler_state_v2_dtype", vgpu_scheduler_state_v2_dtype, VgpuSchedulerState_v2) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an VgpuSchedulerState_v2 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef VgpuSchedulerState_v2 obj = VgpuSchedulerState_v2.__new__(VgpuSchedulerState_v2) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlVgpuSchedulerState_v2_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating VgpuSchedulerState_v2") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlVgpuSchedulerState_v2_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_excluded_device_info_dtype_offsets(): + cdef nvmlExcludedDeviceInfo_t pod + return _numpy.dtype({ + 'names': ['pci_info', 'uuid'], + 'formats': [pci_info_dtype, (_numpy.int8, 80)], + 'offsets': [ + (&(pod.pciInfo)) - (&pod), + (&(pod.uuid)) - (&pod), + ], + 'itemsize': sizeof(nvmlExcludedDeviceInfo_t), + }) + +excluded_device_info_dtype = _get_excluded_device_info_dtype_offsets() + +cdef class ExcludedDeviceInfo: + """Empty-initialize an instance of `nvmlExcludedDeviceInfo_t`. + + + .. seealso:: `nvmlExcludedDeviceInfo_t` + """ + cdef: + nvmlExcludedDeviceInfo_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlExcludedDeviceInfo_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ExcludedDeviceInfo") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlExcludedDeviceInfo_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.ExcludedDeviceInfo object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef ExcludedDeviceInfo other_ + if not isinstance(other, ExcludedDeviceInfo): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlExcludedDeviceInfo_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlExcludedDeviceInfo_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlExcludedDeviceInfo_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ExcludedDeviceInfo") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlExcludedDeviceInfo_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def pci_info(self): + """PciInfo: """ + return PciInfo.from_ptr(&(self._ptr[0].pciInfo), self._readonly, self) + + @pci_info.setter + def pci_info(self, val): + if self._readonly: + raise ValueError("This ExcludedDeviceInfo instance is read-only") + cdef PciInfo val_ = val + _cyb_memcpy(&(self._ptr[0].pciInfo), (val_._get_ptr()), sizeof(nvmlPciInfo_t) * 1) + + @property + def uuid(self): + """~_numpy.int8: (array of length 80).""" + return _cyb_cpython.PyUnicode_FromString(self._ptr[0].uuid) + + @uuid.setter + def uuid(self, val): + if self._readonly: + raise ValueError("This ExcludedDeviceInfo instance is read-only") + cdef bytes buf = val.encode() + if len(buf) >= 80: + raise ValueError("String too long for field uuid, max length is 79") + cdef char *ptr = buf + _cyb_memcpy((self._ptr[0].uuid), ptr, 80) + + @staticmethod + def from_buffer(buffer): + """Create an ExcludedDeviceInfo instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlExcludedDeviceInfo_t), ExcludedDeviceInfo) + + @staticmethod + def from_data(data): + """Create an ExcludedDeviceInfo instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `excluded_device_info_dtype` holding the data. + """ + return _cyb_from_data(data, "excluded_device_info_dtype", excluded_device_info_dtype, ExcludedDeviceInfo) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an ExcludedDeviceInfo instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef ExcludedDeviceInfo obj = ExcludedDeviceInfo.__new__(ExcludedDeviceInfo) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlExcludedDeviceInfo_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating ExcludedDeviceInfo") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlExcludedDeviceInfo_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_process_detail_list_v1_dtype_offsets(): + cdef nvmlProcessDetailList_v1_t pod + return _numpy.dtype({ + 'names': ['version', 'mode', 'num_proc_array_entries', 'proc_array'], + 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.intp], + 'offsets': [ + (&(pod.version)) - (&pod), + (&(pod.mode)) - (&pod), + (&(pod.numProcArrayEntries)) - (&pod), + (&(pod.procArray)) - (&pod), + ], + 'itemsize': sizeof(nvmlProcessDetailList_v1_t), + }) + +process_detail_list_v1_dtype = _get_process_detail_list_v1_dtype_offsets() + +cdef class ProcessDetailList_v1: + """Empty-initialize an instance of `nvmlProcessDetailList_v1_t`. + + + .. seealso:: `nvmlProcessDetailList_v1_t` + """ + cdef: + nvmlProcessDetailList_v1_t *_ptr + object _owner + bint _owned + bint _readonly + dict _refs + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlProcessDetailList_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ProcessDetailList_v1") + self._owner = None + self._owned = True + self._readonly = False + self._refs = {} + + def __dealloc__(self): + cdef nvmlProcessDetailList_v1_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.ProcessDetailList_v1 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef ProcessDetailList_v1 other_ + if not isinstance(other, ProcessDetailList_v1): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlProcessDetailList_v1_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlProcessDetailList_v1_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlProcessDetailList_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ProcessDetailList_v1") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlProcessDetailList_v1_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def version(self): + """int: Struct version, MUST be nvmlProcessDetailList_v1.""" + return self._ptr[0].version + + @version.setter + def version(self, val): + if self._readonly: + raise ValueError("This ProcessDetailList_v1 instance is read-only") + self._ptr[0].version = val + + @property + def mode(self): + """int: Process mode, One of `nvmlProcessMode_t`.""" + return self._ptr[0].mode + + @mode.setter + def mode(self, val): + if self._readonly: + raise ValueError("This ProcessDetailList_v1 instance is read-only") + self._ptr[0].mode = val + + @property + def proc_array(self): + """int: Process array.""" + if self._ptr[0].procArray == NULL or self._ptr[0].numProcArrayEntries == 0: + return [] + return ProcessDetail_v1.from_ptr((self._ptr[0].procArray), self._ptr[0].numProcArrayEntries) + + @proc_array.setter + def proc_array(self, val): + if self._readonly: + raise ValueError("This ProcessDetailList_v1 instance is read-only") + cdef ProcessDetail_v1 arr = val + self._ptr[0].procArray = (arr._get_ptr()) + self._ptr[0].numProcArrayEntries = len(arr) + self._refs["proc_array"] = arr + + @staticmethod + def from_buffer(buffer): + """Create an ProcessDetailList_v1 instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlProcessDetailList_v1_t), ProcessDetailList_v1) + + @staticmethod + def from_data(data): + """Create an ProcessDetailList_v1 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `process_detail_list_v1_dtype` holding the data. + """ + return _cyb_from_data(data, "process_detail_list_v1_dtype", process_detail_list_v1_dtype, ProcessDetailList_v1) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an ProcessDetailList_v1 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef ProcessDetailList_v1 obj = ProcessDetailList_v1.__new__(ProcessDetailList_v1) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlProcessDetailList_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating ProcessDetailList_v1") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlProcessDetailList_v1_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + obj._refs = {} + return obj + + +cdef _get_bridge_chip_hierarchy_dtype_offsets(): + cdef nvmlBridgeChipHierarchy_t pod + return _numpy.dtype({ + 'names': ['bridge_count', 'bridge_chip_info'], + 'formats': [_numpy.uint8, (bridge_chip_info_dtype, 128)], + 'offsets': [ + (&(pod.bridgeCount)) - (&pod), + (&(pod.bridgeChipInfo)) - (&pod), + ], + 'itemsize': sizeof(nvmlBridgeChipHierarchy_t), + }) + +bridge_chip_hierarchy_dtype = _get_bridge_chip_hierarchy_dtype_offsets() + +cdef class BridgeChipHierarchy: + """Empty-initialize an instance of `nvmlBridgeChipHierarchy_t`. + + + .. seealso:: `nvmlBridgeChipHierarchy_t` + """ + cdef: + nvmlBridgeChipHierarchy_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlBridgeChipHierarchy_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating BridgeChipHierarchy") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlBridgeChipHierarchy_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.BridgeChipHierarchy object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef BridgeChipHierarchy other_ + if not isinstance(other, BridgeChipHierarchy): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlBridgeChipHierarchy_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlBridgeChipHierarchy_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlBridgeChipHierarchy_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating BridgeChipHierarchy") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlBridgeChipHierarchy_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def bridge_chip_info(self): + """BridgeChipInfo: """ + return BridgeChipInfo.from_ptr(&(self._ptr[0].bridgeChipInfo), self._ptr[0].bridgeCount, self._readonly) + + @bridge_chip_info.setter + def bridge_chip_info(self, val): + if self._readonly: + raise ValueError("This BridgeChipHierarchy instance is read-only") + cdef BridgeChipInfo val_ = val + if len(val) > 128: + raise ValueError(f"Expected length < 128 for field bridge_chip_info, got {len(val)}") + self._ptr[0].bridgeCount = len(val) + if len(val) == 0: + return + _cyb_memcpy(&(self._ptr[0].bridgeChipInfo), (val_._get_ptr()), sizeof(nvmlBridgeChipInfo_t) * self._ptr[0].bridgeCount) + + @staticmethod + def from_buffer(buffer): + """Create an BridgeChipHierarchy instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlBridgeChipHierarchy_t), BridgeChipHierarchy) + + @staticmethod + def from_data(data): + """Create an BridgeChipHierarchy instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `bridge_chip_hierarchy_dtype` holding the data. + """ + return _cyb_from_data(data, "bridge_chip_hierarchy_dtype", bridge_chip_hierarchy_dtype, BridgeChipHierarchy) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an BridgeChipHierarchy instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef BridgeChipHierarchy obj = BridgeChipHierarchy.__new__(BridgeChipHierarchy) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlBridgeChipHierarchy_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating BridgeChipHierarchy") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlBridgeChipHierarchy_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_sample_dtype_offsets(): + cdef nvmlSample_t pod + return _numpy.dtype({ + 'names': ['time_stamp', 'sample_value'], + 'formats': [_numpy.uint64, value_dtype], + 'offsets': [ + (&(pod.timeStamp)) - (&pod), + (&(pod.sampleValue)) - (&pod), + ], + 'itemsize': sizeof(nvmlSample_t), + }) + +sample_dtype = _get_sample_dtype_offsets() + +cdef class Sample: + """Empty-initialize an array of `nvmlSample_t`. + The resulting object is of length `size` and of dtype `sample_dtype`. + If default-constructed, the instance represents a single struct. + + Args: + size (int): number of structs, default=1. + + .. seealso:: `nvmlSample_t` + """ + cdef: + readonly object _data + + def __init__(self, size=1): + arr = _numpy.empty(size, dtype=sample_dtype) + self._data = arr.view(_numpy.recarray) + assert self._data.itemsize == sizeof(nvmlSample_t), \ + f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlSample_t) }" + + def __repr__(self): + if self._data.size > 1: + return f"<{__name__}.Sample_Array_{self._data.size} object at {hex(id(self))}>" + else: + return f"<{__name__}.Sample object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return self._data.ctypes.data + + cdef intptr_t _get_ptr(self): + return self._data.ctypes.data + + def __int__(self): + if self._data.size > 1: + raise TypeError("int() argument must be a bytes-like object of size 1. " + "To get the pointer address of an array, use .ptr") + return self._data.ctypes.data + + def __len__(self): + return self._data.size + + def __eq__(self, other): + cdef object self_data = self._data + if (not isinstance(other, Sample)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype: + return False + return bool((self_data == other._data).all()) + + def __getbuffer__(self, Py_buffer *buffer, int flags): + _cyb_cpython.PyObject_GetBuffer(self._data, buffer, flags) + + def __releasebuffer__(self, Py_buffer *buffer): + _cyb_cpython.PyBuffer_Release(buffer) + + @property + def time_stamp(self): + """Union[~_numpy.uint64, int]: """ + if self._data.size == 1: + return int(self._data.time_stamp[0]) + return self._data.time_stamp + + @time_stamp.setter + def time_stamp(self, val): + self._data.time_stamp = val + + @property + def sample_value(self): + """value_dtype: """ + return self._data.sample_value + + @sample_value.setter + def sample_value(self, val): + self._data.sample_value = val + + def __getitem__(self, key): + cdef ssize_t key_ + cdef ssize_t size + if isinstance(key, int): + key_ = key + size = self._data.size + if key_ >= size or key_ <= -(size+1): + raise IndexError("index is out of bounds") + if key_ < 0: + key_ += size + return Sample.from_data(self._data[key_:key_+1]) + out = self._data[key] + if isinstance(out, _numpy.recarray) and out.dtype == sample_dtype: + return Sample.from_data(out) + return out + + def __setitem__(self, key, val): + self._data[key] = val + + @staticmethod + def from_buffer(buffer): + """Create an Sample instance with the memory from the given buffer.""" + return Sample.from_data(_numpy.frombuffer(buffer, dtype=sample_dtype)) + + @staticmethod + def from_data(data): + """Create an Sample instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a 1D array of dtype `sample_dtype` holding the data. + """ + cdef Sample obj = Sample.__new__(Sample) + if not isinstance(data, _numpy.ndarray): + raise TypeError("data argument must be a NumPy ndarray") + if data.ndim != 1: + raise ValueError("data array must be 1D") + if data.dtype != sample_dtype: + raise ValueError("data array must be of dtype sample_dtype") + obj._data = data.view(_numpy.recarray) + + return obj + + @staticmethod + def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False): + """Create an Sample instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + size (int): number of structs, default=1. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef Sample obj = Sample.__new__(Sample) + cdef flag = _cyb_cpython_buffer.PyBUF_READ if readonly else _cyb_cpython_buffer.PyBUF_WRITE + cdef object buf = _cyb_cpython_memoryview.PyMemoryView_FromMemory( + ptr, sizeof(nvmlSample_t) * size, flag) + data = _numpy.ndarray(size, buffer=buf, dtype=sample_dtype) + obj._data = data.view(_numpy.recarray) + + return obj + + +cdef _get_vgpu_instance_utilization_sample_dtype_offsets(): + cdef nvmlVgpuInstanceUtilizationSample_t pod + return _numpy.dtype({ + 'names': ['vgpu_instance', 'time_stamp', 'sm_util', 'mem_util', 'enc_util', 'dec_util'], + 'formats': [_numpy.uint32, _numpy.uint64, value_dtype, value_dtype, value_dtype, value_dtype], + 'offsets': [ + (&(pod.vgpuInstance)) - (&pod), + (&(pod.timeStamp)) - (&pod), + (&(pod.smUtil)) - (&pod), + (&(pod.memUtil)) - (&pod), + (&(pod.encUtil)) - (&pod), + (&(pod.decUtil)) - (&pod), + ], + 'itemsize': sizeof(nvmlVgpuInstanceUtilizationSample_t), + }) + +vgpu_instance_utilization_sample_dtype = _get_vgpu_instance_utilization_sample_dtype_offsets() + +cdef class VgpuInstanceUtilizationSample: + """Empty-initialize an array of `nvmlVgpuInstanceUtilizationSample_t`. + The resulting object is of length `size` and of dtype `vgpu_instance_utilization_sample_dtype`. + If default-constructed, the instance represents a single struct. + + Args: + size (int): number of structs, default=1. + + .. seealso:: `nvmlVgpuInstanceUtilizationSample_t` + """ + cdef: + readonly object _data + + def __init__(self, size=1): + arr = _numpy.empty(size, dtype=vgpu_instance_utilization_sample_dtype) + self._data = arr.view(_numpy.recarray) + assert self._data.itemsize == sizeof(nvmlVgpuInstanceUtilizationSample_t), \ + f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlVgpuInstanceUtilizationSample_t) }" + + def __repr__(self): + if self._data.size > 1: + return f"<{__name__}.VgpuInstanceUtilizationSample_Array_{self._data.size} object at {hex(id(self))}>" + else: + return f"<{__name__}.VgpuInstanceUtilizationSample object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return self._data.ctypes.data + + cdef intptr_t _get_ptr(self): + return self._data.ctypes.data + + def __int__(self): + if self._data.size > 1: + raise TypeError("int() argument must be a bytes-like object of size 1. " + "To get the pointer address of an array, use .ptr") + return self._data.ctypes.data + + def __len__(self): + return self._data.size + + def __eq__(self, other): + cdef object self_data = self._data + if (not isinstance(other, VgpuInstanceUtilizationSample)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype: + return False + return bool((self_data == other._data).all()) + + def __getbuffer__(self, Py_buffer *buffer, int flags): + _cyb_cpython.PyObject_GetBuffer(self._data, buffer, flags) + + def __releasebuffer__(self, Py_buffer *buffer): + _cyb_cpython.PyBuffer_Release(buffer) + + @property + def vgpu_instance(self): + """Union[~_numpy.uint32, int]: """ + if self._data.size == 1: + return int(self._data.vgpu_instance[0]) + return self._data.vgpu_instance + + @vgpu_instance.setter + def vgpu_instance(self, val): + self._data.vgpu_instance = val + + @property + def time_stamp(self): + """Union[~_numpy.uint64, int]: """ + if self._data.size == 1: + return int(self._data.time_stamp[0]) + return self._data.time_stamp + + @time_stamp.setter + def time_stamp(self, val): + self._data.time_stamp = val + + @property + def sm_util(self): + """value_dtype: """ + return self._data.sm_util + + @sm_util.setter + def sm_util(self, val): + self._data.sm_util = val + + @property + def mem_util(self): + """value_dtype: """ + return self._data.mem_util + + @mem_util.setter + def mem_util(self, val): + self._data.mem_util = val + + @property + def enc_util(self): + """value_dtype: """ + return self._data.enc_util + + @enc_util.setter + def enc_util(self, val): + self._data.enc_util = val + + @property + def dec_util(self): + """value_dtype: """ + return self._data.dec_util + + @dec_util.setter + def dec_util(self, val): + self._data.dec_util = val + + def __getitem__(self, key): + cdef ssize_t key_ + cdef ssize_t size + if isinstance(key, int): + key_ = key + size = self._data.size + if key_ >= size or key_ <= -(size+1): + raise IndexError("index is out of bounds") + if key_ < 0: + key_ += size + return VgpuInstanceUtilizationSample.from_data(self._data[key_:key_+1]) + out = self._data[key] + if isinstance(out, _numpy.recarray) and out.dtype == vgpu_instance_utilization_sample_dtype: + return VgpuInstanceUtilizationSample.from_data(out) + return out + + def __setitem__(self, key, val): + self._data[key] = val + + @staticmethod + def from_buffer(buffer): + """Create an VgpuInstanceUtilizationSample instance with the memory from the given buffer.""" + return VgpuInstanceUtilizationSample.from_data(_numpy.frombuffer(buffer, dtype=vgpu_instance_utilization_sample_dtype)) + + @staticmethod + def from_data(data): + """Create an VgpuInstanceUtilizationSample instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a 1D array of dtype `vgpu_instance_utilization_sample_dtype` holding the data. + """ + cdef VgpuInstanceUtilizationSample obj = VgpuInstanceUtilizationSample.__new__(VgpuInstanceUtilizationSample) + if not isinstance(data, _numpy.ndarray): + raise TypeError("data argument must be a NumPy ndarray") + if data.ndim != 1: + raise ValueError("data array must be 1D") + if data.dtype != vgpu_instance_utilization_sample_dtype: + raise ValueError("data array must be of dtype vgpu_instance_utilization_sample_dtype") + obj._data = data.view(_numpy.recarray) + + return obj + + @staticmethod + def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False): + """Create an VgpuInstanceUtilizationSample instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + size (int): number of structs, default=1. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef VgpuInstanceUtilizationSample obj = VgpuInstanceUtilizationSample.__new__(VgpuInstanceUtilizationSample) + cdef flag = _cyb_cpython_buffer.PyBUF_READ if readonly else _cyb_cpython_buffer.PyBUF_WRITE + cdef object buf = _cyb_cpython_memoryview.PyMemoryView_FromMemory( + ptr, sizeof(nvmlVgpuInstanceUtilizationSample_t) * size, flag) + data = _numpy.ndarray(size, buffer=buf, dtype=vgpu_instance_utilization_sample_dtype) + obj._data = data.view(_numpy.recarray) + + return obj + + +cdef _get_vgpu_instance_utilization_info_v1_dtype_offsets(): + cdef nvmlVgpuInstanceUtilizationInfo_v1_t pod + return _numpy.dtype({ + 'names': ['time_stamp', 'vgpu_instance', 'sm_util', 'mem_util', 'enc_util', 'dec_util', 'jpg_util', 'ofa_util'], + 'formats': [_numpy.uint64, _numpy.uint32, value_dtype, value_dtype, value_dtype, value_dtype, value_dtype, value_dtype], + 'offsets': [ + (&(pod.timeStamp)) - (&pod), + (&(pod.vgpuInstance)) - (&pod), + (&(pod.smUtil)) - (&pod), + (&(pod.memUtil)) - (&pod), + (&(pod.encUtil)) - (&pod), + (&(pod.decUtil)) - (&pod), + (&(pod.jpgUtil)) - (&pod), + (&(pod.ofaUtil)) - (&pod), + ], + 'itemsize': sizeof(nvmlVgpuInstanceUtilizationInfo_v1_t), + }) + +vgpu_instance_utilization_info_v1_dtype = _get_vgpu_instance_utilization_info_v1_dtype_offsets() + +cdef class VgpuInstanceUtilizationInfo_v1: + """Empty-initialize an array of `nvmlVgpuInstanceUtilizationInfo_v1_t`. + The resulting object is of length `size` and of dtype `vgpu_instance_utilization_info_v1_dtype`. + If default-constructed, the instance represents a single struct. + + Args: + size (int): number of structs, default=1. + + .. seealso:: `nvmlVgpuInstanceUtilizationInfo_v1_t` + """ + cdef: + readonly object _data + + def __init__(self, size=1): + arr = _numpy.empty(size, dtype=vgpu_instance_utilization_info_v1_dtype) + self._data = arr.view(_numpy.recarray) + assert self._data.itemsize == sizeof(nvmlVgpuInstanceUtilizationInfo_v1_t), \ + f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlVgpuInstanceUtilizationInfo_v1_t) }" + + def __repr__(self): + if self._data.size > 1: + return f"<{__name__}.VgpuInstanceUtilizationInfo_v1_Array_{self._data.size} object at {hex(id(self))}>" + else: + return f"<{__name__}.VgpuInstanceUtilizationInfo_v1 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return self._data.ctypes.data + + cdef intptr_t _get_ptr(self): + return self._data.ctypes.data + + def __int__(self): + if self._data.size > 1: + raise TypeError("int() argument must be a bytes-like object of size 1. " + "To get the pointer address of an array, use .ptr") + return self._data.ctypes.data + + def __len__(self): + return self._data.size + + def __eq__(self, other): + cdef object self_data = self._data + if (not isinstance(other, VgpuInstanceUtilizationInfo_v1)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype: + return False + return bool((self_data == other._data).all()) + + def __getbuffer__(self, Py_buffer *buffer, int flags): + _cyb_cpython.PyObject_GetBuffer(self._data, buffer, flags) + + def __releasebuffer__(self, Py_buffer *buffer): + _cyb_cpython.PyBuffer_Release(buffer) + + @property + def time_stamp(self): + """Union[~_numpy.uint64, int]: CPU Timestamp in microseconds.""" + if self._data.size == 1: + return int(self._data.time_stamp[0]) + return self._data.time_stamp + + @time_stamp.setter + def time_stamp(self, val): + self._data.time_stamp = val + + @property + def vgpu_instance(self): + """Union[~_numpy.uint32, int]: vGPU Instance""" + if self._data.size == 1: + return int(self._data.vgpu_instance[0]) + return self._data.vgpu_instance + + @vgpu_instance.setter + def vgpu_instance(self, val): + self._data.vgpu_instance = val + + @property + def sm_util(self): + """value_dtype: SM (3D/Compute) Util Value.""" + return self._data.sm_util + + @sm_util.setter + def sm_util(self, val): + self._data.sm_util = val + + @property + def mem_util(self): + """value_dtype: Frame Buffer Memory Util Value.""" + return self._data.mem_util + + @mem_util.setter + def mem_util(self, val): + self._data.mem_util = val + + @property + def enc_util(self): + """value_dtype: Encoder Util Value.""" + return self._data.enc_util + + @enc_util.setter + def enc_util(self, val): + self._data.enc_util = val + + @property + def dec_util(self): + """value_dtype: Decoder Util Value.""" + return self._data.dec_util + + @dec_util.setter + def dec_util(self, val): + self._data.dec_util = val + + @property + def jpg_util(self): + """value_dtype: Jpeg Util Value.""" + return self._data.jpg_util + + @jpg_util.setter + def jpg_util(self, val): + self._data.jpg_util = val + + @property + def ofa_util(self): + """value_dtype: Ofa Util Value.""" + return self._data.ofa_util + + @ofa_util.setter + def ofa_util(self, val): + self._data.ofa_util = val + + def __getitem__(self, key): + cdef ssize_t key_ + cdef ssize_t size + if isinstance(key, int): + key_ = key + size = self._data.size + if key_ >= size or key_ <= -(size+1): + raise IndexError("index is out of bounds") + if key_ < 0: + key_ += size + return VgpuInstanceUtilizationInfo_v1.from_data(self._data[key_:key_+1]) + out = self._data[key] + if isinstance(out, _numpy.recarray) and out.dtype == vgpu_instance_utilization_info_v1_dtype: + return VgpuInstanceUtilizationInfo_v1.from_data(out) + return out + + def __setitem__(self, key, val): + self._data[key] = val + + @staticmethod + def from_buffer(buffer): + """Create an VgpuInstanceUtilizationInfo_v1 instance with the memory from the given buffer.""" + return VgpuInstanceUtilizationInfo_v1.from_data(_numpy.frombuffer(buffer, dtype=vgpu_instance_utilization_info_v1_dtype)) + + @staticmethod + def from_data(data): + """Create an VgpuInstanceUtilizationInfo_v1 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a 1D array of dtype `vgpu_instance_utilization_info_v1_dtype` holding the data. + """ + cdef VgpuInstanceUtilizationInfo_v1 obj = VgpuInstanceUtilizationInfo_v1.__new__(VgpuInstanceUtilizationInfo_v1) + if not isinstance(data, _numpy.ndarray): + raise TypeError("data argument must be a NumPy ndarray") + if data.ndim != 1: + raise ValueError("data array must be 1D") + if data.dtype != vgpu_instance_utilization_info_v1_dtype: + raise ValueError("data array must be of dtype vgpu_instance_utilization_info_v1_dtype") + obj._data = data.view(_numpy.recarray) + + return obj + + @staticmethod + def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False): + """Create an VgpuInstanceUtilizationInfo_v1 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + size (int): number of structs, default=1. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef VgpuInstanceUtilizationInfo_v1 obj = VgpuInstanceUtilizationInfo_v1.__new__(VgpuInstanceUtilizationInfo_v1) + cdef flag = _cyb_cpython_buffer.PyBUF_READ if readonly else _cyb_cpython_buffer.PyBUF_WRITE + cdef object buf = _cyb_cpython_memoryview.PyMemoryView_FromMemory( + ptr, sizeof(nvmlVgpuInstanceUtilizationInfo_v1_t) * size, flag) + data = _numpy.ndarray(size, buffer=buf, dtype=vgpu_instance_utilization_info_v1_dtype) + obj._data = data.view(_numpy.recarray) + + return obj + + +cdef _get_field_value_dtype_offsets(): + cdef nvmlFieldValue_t pod + return _numpy.dtype({ + 'names': ['field_id', 'scope_id', 'timestamp', 'latency_usec', 'value_type', 'nvml_return', 'value'], + 'formats': [_numpy.uint32, _numpy.uint32, _numpy.int64, _numpy.int64, _numpy.int32, _numpy.int32, value_dtype], + 'offsets': [ + (&(pod.fieldId)) - (&pod), + (&(pod.scopeId)) - (&pod), + (&(pod.timestamp)) - (&pod), + (&(pod.latencyUsec)) - (&pod), + (&(pod.valueType)) - (&pod), + (&(pod.nvmlReturn)) - (&pod), + (&(pod.value)) - (&pod), + ], + 'itemsize': sizeof(nvmlFieldValue_t), + }) + +field_value_dtype = _get_field_value_dtype_offsets() + +cdef class FieldValue: + """Empty-initialize an array of `nvmlFieldValue_t`. + The resulting object is of length `size` and of dtype `field_value_dtype`. + If default-constructed, the instance represents a single struct. + + Args: + size (int): number of structs, default=1. + + .. seealso:: `nvmlFieldValue_t` + """ + cdef: + readonly object _data + + def __init__(self, size=1): + arr = _numpy.empty(size, dtype=field_value_dtype) + self._data = arr.view(_numpy.recarray) + assert self._data.itemsize == sizeof(nvmlFieldValue_t), \ + f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlFieldValue_t) }" + + def __repr__(self): + if self._data.size > 1: + return f"<{__name__}.FieldValue_Array_{self._data.size} object at {hex(id(self))}>" + else: + return f"<{__name__}.FieldValue object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return self._data.ctypes.data + + cdef intptr_t _get_ptr(self): + return self._data.ctypes.data + + def __int__(self): + if self._data.size > 1: + raise TypeError("int() argument must be a bytes-like object of size 1. " + "To get the pointer address of an array, use .ptr") + return self._data.ctypes.data + + def __len__(self): + return self._data.size + + def __eq__(self, other): + cdef object self_data = self._data + if (not isinstance(other, FieldValue)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype: + return False + return bool((self_data == other._data).all()) + + def __getbuffer__(self, Py_buffer *buffer, int flags): + _cyb_cpython.PyObject_GetBuffer(self._data, buffer, flags) + + def __releasebuffer__(self, Py_buffer *buffer): + _cyb_cpython.PyBuffer_Release(buffer) + + @property + def field_id(self): + """Union[~_numpy.uint32, int]: """ + if self._data.size == 1: + return int(self._data.field_id[0]) + return self._data.field_id + + @field_id.setter + def field_id(self, val): + self._data.field_id = val + + @property + def scope_id(self): + """Union[~_numpy.uint32, int]: """ + if self._data.size == 1: + return int(self._data.scope_id[0]) + return self._data.scope_id + + @scope_id.setter + def scope_id(self, val): + self._data.scope_id = val + + @property + def timestamp(self): + """Union[~_numpy.int64, int]: """ + if self._data.size == 1: + return int(self._data.timestamp[0]) + return self._data.timestamp + + @timestamp.setter + def timestamp(self, val): + self._data.timestamp = val + + @property + def latency_usec(self): + """Union[~_numpy.int64, int]: """ + if self._data.size == 1: + return int(self._data.latency_usec[0]) + return self._data.latency_usec + + @latency_usec.setter + def latency_usec(self, val): + self._data.latency_usec = val + + @property + def value_type(self): + """Union[~_numpy.int32, int]: """ + if self._data.size == 1: + return int(self._data.value_type[0]) + return self._data.value_type + + @value_type.setter + def value_type(self, val): + self._data.value_type = val + + @property + def nvml_return(self): + """Union[~_numpy.int32, int]: """ + if self._data.size == 1: + return int(self._data.nvml_return[0]) + return self._data.nvml_return + + @nvml_return.setter + def nvml_return(self, val): + self._data.nvml_return = val + + @property + def value(self): + """value_dtype: """ + return self._data.value + + @value.setter + def value(self, val): + self._data.value = val + + def __getitem__(self, key): + cdef ssize_t key_ + cdef ssize_t size + if isinstance(key, int): + key_ = key + size = self._data.size + if key_ >= size or key_ <= -(size+1): + raise IndexError("index is out of bounds") + if key_ < 0: + key_ += size + return FieldValue.from_data(self._data[key_:key_+1]) + out = self._data[key] + if isinstance(out, _numpy.recarray) and out.dtype == field_value_dtype: + return FieldValue.from_data(out) + return out + + def __setitem__(self, key, val): + self._data[key] = val + + @staticmethod + def from_buffer(buffer): + """Create an FieldValue instance with the memory from the given buffer.""" + return FieldValue.from_data(_numpy.frombuffer(buffer, dtype=field_value_dtype)) + + @staticmethod + def from_data(data): + """Create an FieldValue instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a 1D array of dtype `field_value_dtype` holding the data. + """ + cdef FieldValue obj = FieldValue.__new__(FieldValue) + if not isinstance(data, _numpy.ndarray): + raise TypeError("data argument must be a NumPy ndarray") + if data.ndim != 1: + raise ValueError("data array must be 1D") + if data.dtype != field_value_dtype: + raise ValueError("data array must be of dtype field_value_dtype") + obj._data = data.view(_numpy.recarray) + + return obj + + @staticmethod + def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False): + """Create an FieldValue instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + size (int): number of structs, default=1. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef FieldValue obj = FieldValue.__new__(FieldValue) + cdef flag = _cyb_cpython_buffer.PyBUF_READ if readonly else _cyb_cpython_buffer.PyBUF_WRITE + cdef object buf = _cyb_cpython_memoryview.PyMemoryView_FromMemory( + ptr, sizeof(nvmlFieldValue_t) * size, flag) + data = _numpy.ndarray(size, buffer=buf, dtype=field_value_dtype) + obj._data = data.view(_numpy.recarray) + + return obj + + +cdef _get_prm_counter_value_v1_dtype_offsets(): + cdef nvmlPRMCounterValue_v1_t pod + return _numpy.dtype({ + 'names': ['status', 'output_type', 'output_value'], + 'formats': [_numpy.int32, _numpy.int32, value_dtype], + 'offsets': [ + (&(pod.status)) - (&pod), + (&(pod.outputType)) - (&pod), + (&(pod.outputValue)) - (&pod), + ], + 'itemsize': sizeof(nvmlPRMCounterValue_v1_t), + }) + +prm_counter_value_v1_dtype = _get_prm_counter_value_v1_dtype_offsets() + +cdef class PRMCounterValue_v1: + """Empty-initialize an instance of `nvmlPRMCounterValue_v1_t`. + + + .. seealso:: `nvmlPRMCounterValue_v1_t` + """ + cdef: + nvmlPRMCounterValue_v1_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlPRMCounterValue_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating PRMCounterValue_v1") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlPRMCounterValue_v1_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.PRMCounterValue_v1 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef PRMCounterValue_v1 other_ + if not isinstance(other, PRMCounterValue_v1): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlPRMCounterValue_v1_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlPRMCounterValue_v1_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlPRMCounterValue_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating PRMCounterValue_v1") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlPRMCounterValue_v1_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def output_value(self): + """Value: Output value.""" + return Value.from_ptr(&(self._ptr[0].outputValue), self._readonly, self) + + @output_value.setter + def output_value(self, val): + if self._readonly: + raise ValueError("This PRMCounterValue_v1 instance is read-only") + cdef Value val_ = val + _cyb_memcpy(&(self._ptr[0].outputValue), (val_._get_ptr()), sizeof(nvmlValue_t) * 1) + + @property + def status(self): + """int: Status of the PRM counter read.""" + return (self._ptr[0].status) + + @status.setter + def status(self, val): + if self._readonly: + raise ValueError("This PRMCounterValue_v1 instance is read-only") + self._ptr[0].status = val + + @property + def output_type(self): + """int: Output value type.""" + return (self._ptr[0].outputType) + + @output_type.setter + def output_type(self, val): + if self._readonly: + raise ValueError("This PRMCounterValue_v1 instance is read-only") + self._ptr[0].outputType = val + + @staticmethod + def from_buffer(buffer): + """Create an PRMCounterValue_v1 instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlPRMCounterValue_v1_t), PRMCounterValue_v1) + + @staticmethod + def from_data(data): + """Create an PRMCounterValue_v1 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `prm_counter_value_v1_dtype` holding the data. + """ + return _cyb_from_data(data, "prm_counter_value_v1_dtype", prm_counter_value_v1_dtype, PRMCounterValue_v1) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an PRMCounterValue_v1 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef PRMCounterValue_v1 obj = PRMCounterValue_v1.__new__(PRMCounterValue_v1) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlPRMCounterValue_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating PRMCounterValue_v1") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlPRMCounterValue_v1_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_gpu_thermal_settings_dtype_offsets(): + cdef nvmlGpuThermalSettings_t pod + return _numpy.dtype({ + 'names': ['count', 'sensor'], + 'formats': [_numpy.uint32, (_py_anon_pod0_dtype, 3)], + 'offsets': [ + (&(pod.count)) - (&pod), + (&(pod.sensor)) - (&pod), + ], + 'itemsize': sizeof(nvmlGpuThermalSettings_t), + }) + +gpu_thermal_settings_dtype = _get_gpu_thermal_settings_dtype_offsets() + +cdef class GpuThermalSettings: + """Empty-initialize an instance of `nvmlGpuThermalSettings_t`. + + + .. seealso:: `nvmlGpuThermalSettings_t` + """ + cdef: + nvmlGpuThermalSettings_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlGpuThermalSettings_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating GpuThermalSettings") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlGpuThermalSettings_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.GpuThermalSettings object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef GpuThermalSettings other_ + if not isinstance(other, GpuThermalSettings): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlGpuThermalSettings_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlGpuThermalSettings_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlGpuThermalSettings_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating GpuThermalSettings") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlGpuThermalSettings_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def sensor(self): + """_py_anon_pod0: """ + return _py_anon_pod0.from_ptr(&(self._ptr[0].sensor), 3, self._readonly) + + @sensor.setter + def sensor(self, val): + if self._readonly: + raise ValueError("This GpuThermalSettings instance is read-only") + cdef _py_anon_pod0 val_ = val + if len(val) != 3: + raise ValueError(f"Expected length { 3 } for field sensor, got {len(val)}") + _cyb_memcpy(&(self._ptr[0].sensor), (val_._get_ptr()), sizeof(cuda_bindings_nvml__anon_pod0) * 3) + + @property + def count(self): + """int: """ + return self._ptr[0].count + + @count.setter + def count(self, val): + if self._readonly: + raise ValueError("This GpuThermalSettings instance is read-only") + self._ptr[0].count = val + + @staticmethod + def from_buffer(buffer): + """Create an GpuThermalSettings instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlGpuThermalSettings_t), GpuThermalSettings) + + @staticmethod + def from_data(data): + """Create an GpuThermalSettings instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `gpu_thermal_settings_dtype` holding the data. + """ + return _cyb_from_data(data, "gpu_thermal_settings_dtype", gpu_thermal_settings_dtype, GpuThermalSettings) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an GpuThermalSettings instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef GpuThermalSettings obj = GpuThermalSettings.__new__(GpuThermalSettings) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlGpuThermalSettings_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating GpuThermalSettings") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlGpuThermalSettings_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_clk_mon_status_dtype_offsets(): + cdef nvmlClkMonStatus_t pod + return _numpy.dtype({ + 'names': ['b_global_status', 'clk_mon_list_size', 'clk_mon_list'], + 'formats': [_numpy.uint32, _numpy.uint32, (clk_mon_fault_info_dtype, 32)], + 'offsets': [ + (&(pod.bGlobalStatus)) - (&pod), + (&(pod.clkMonListSize)) - (&pod), + (&(pod.clkMonList)) - (&pod), + ], + 'itemsize': sizeof(nvmlClkMonStatus_t), + }) + +clk_mon_status_dtype = _get_clk_mon_status_dtype_offsets() + +cdef class ClkMonStatus: + """Empty-initialize an instance of `nvmlClkMonStatus_t`. + + + .. seealso:: `nvmlClkMonStatus_t` + """ + cdef: + nvmlClkMonStatus_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlClkMonStatus_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ClkMonStatus") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlClkMonStatus_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.ClkMonStatus object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef ClkMonStatus other_ + if not isinstance(other, ClkMonStatus): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlClkMonStatus_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlClkMonStatus_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlClkMonStatus_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ClkMonStatus") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlClkMonStatus_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def clk_mon_list(self): + """ClkMonFaultInfo: """ + return ClkMonFaultInfo.from_ptr(&(self._ptr[0].clkMonList), self._ptr[0].clkMonListSize, self._readonly) + + @clk_mon_list.setter + def clk_mon_list(self, val): + if self._readonly: + raise ValueError("This ClkMonStatus instance is read-only") + cdef ClkMonFaultInfo val_ = val + if len(val) > 32: + raise ValueError(f"Expected length < 32 for field clk_mon_list, got {len(val)}") + self._ptr[0].clkMonListSize = len(val) + if len(val) == 0: + return + _cyb_memcpy(&(self._ptr[0].clkMonList), (val_._get_ptr()), sizeof(nvmlClkMonFaultInfo_t) * self._ptr[0].clkMonListSize) + + @property + def b_global_status(self): + """int: """ + return self._ptr[0].bGlobalStatus + + @b_global_status.setter + def b_global_status(self, val): + if self._readonly: + raise ValueError("This ClkMonStatus instance is read-only") + self._ptr[0].bGlobalStatus = val + + @staticmethod + def from_buffer(buffer): + """Create an ClkMonStatus instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlClkMonStatus_t), ClkMonStatus) + + @staticmethod + def from_data(data): + """Create an ClkMonStatus instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `clk_mon_status_dtype` holding the data. + """ + return _cyb_from_data(data, "clk_mon_status_dtype", clk_mon_status_dtype, ClkMonStatus) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an ClkMonStatus instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef ClkMonStatus obj = ClkMonStatus.__new__(ClkMonStatus) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlClkMonStatus_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating ClkMonStatus") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlClkMonStatus_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_processes_utilization_info_v1_dtype_offsets(): + cdef nvmlProcessesUtilizationInfo_v1_t pod + return _numpy.dtype({ + 'names': ['version', 'process_samples_count', 'last_seen_time_stamp', 'proc_util_array'], + 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint64, _numpy.intp], + 'offsets': [ + (&(pod.version)) - (&pod), + (&(pod.processSamplesCount)) - (&pod), + (&(pod.lastSeenTimeStamp)) - (&pod), + (&(pod.procUtilArray)) - (&pod), + ], + 'itemsize': sizeof(nvmlProcessesUtilizationInfo_v1_t), + }) + +processes_utilization_info_v1_dtype = _get_processes_utilization_info_v1_dtype_offsets() + +cdef class ProcessesUtilizationInfo_v1: + """Empty-initialize an instance of `nvmlProcessesUtilizationInfo_v1_t`. + + + .. seealso:: `nvmlProcessesUtilizationInfo_v1_t` + """ + cdef: + nvmlProcessesUtilizationInfo_v1_t *_ptr + object _owner + bint _owned + bint _readonly + dict _refs + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlProcessesUtilizationInfo_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ProcessesUtilizationInfo_v1") + self._owner = None + self._owned = True + self._readonly = False + self._refs = {} + + def __dealloc__(self): + cdef nvmlProcessesUtilizationInfo_v1_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.ProcessesUtilizationInfo_v1 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef ProcessesUtilizationInfo_v1 other_ + if not isinstance(other, ProcessesUtilizationInfo_v1): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlProcessesUtilizationInfo_v1_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlProcessesUtilizationInfo_v1_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlProcessesUtilizationInfo_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ProcessesUtilizationInfo_v1") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlProcessesUtilizationInfo_v1_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def version(self): + """int: The version number of this struct.""" + return self._ptr[0].version + + @version.setter + def version(self, val): + if self._readonly: + raise ValueError("This ProcessesUtilizationInfo_v1 instance is read-only") + self._ptr[0].version = val + + @property + def last_seen_time_stamp(self): + """int: Return only samples with timestamp greater than lastSeenTimeStamp.""" + return self._ptr[0].lastSeenTimeStamp + + @last_seen_time_stamp.setter + def last_seen_time_stamp(self, val): + if self._readonly: + raise ValueError("This ProcessesUtilizationInfo_v1 instance is read-only") + self._ptr[0].lastSeenTimeStamp = val + + @property + def proc_util_array(self): + """int: The array (allocated by caller) of the utilization of GPU SM, framebuffer, video encoder, video decoder, JPEG, and OFA.""" + if self._ptr[0].procUtilArray == NULL or self._ptr[0].processSamplesCount == 0: + return [] + return ProcessUtilizationInfo_v1.from_ptr((self._ptr[0].procUtilArray), self._ptr[0].processSamplesCount) + + @proc_util_array.setter + def proc_util_array(self, val): + if self._readonly: + raise ValueError("This ProcessesUtilizationInfo_v1 instance is read-only") + cdef ProcessUtilizationInfo_v1 arr = val + self._ptr[0].procUtilArray = (arr._get_ptr()) + self._ptr[0].processSamplesCount = len(arr) + self._refs["proc_util_array"] = arr + + @staticmethod + def from_buffer(buffer): + """Create an ProcessesUtilizationInfo_v1 instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlProcessesUtilizationInfo_v1_t), ProcessesUtilizationInfo_v1) + + @staticmethod + def from_data(data): + """Create an ProcessesUtilizationInfo_v1 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `processes_utilization_info_v1_dtype` holding the data. + """ + return _cyb_from_data(data, "processes_utilization_info_v1_dtype", processes_utilization_info_v1_dtype, ProcessesUtilizationInfo_v1) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an ProcessesUtilizationInfo_v1 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef ProcessesUtilizationInfo_v1 obj = ProcessesUtilizationInfo_v1.__new__(ProcessesUtilizationInfo_v1) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlProcessesUtilizationInfo_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating ProcessesUtilizationInfo_v1") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlProcessesUtilizationInfo_v1_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + obj._refs = {} + return obj + + +cdef _get_gpu_dynamic_pstates_info_dtype_offsets(): + cdef nvmlGpuDynamicPstatesInfo_t pod + return _numpy.dtype({ + 'names': ['flags_', 'utilization'], + 'formats': [_numpy.uint32, (_py_anon_pod1_dtype, 8)], + 'offsets': [ + (&(pod.flags)) - (&pod), + (&(pod.utilization)) - (&pod), + ], + 'itemsize': sizeof(nvmlGpuDynamicPstatesInfo_t), + }) + +gpu_dynamic_pstates_info_dtype = _get_gpu_dynamic_pstates_info_dtype_offsets() + +cdef class GpuDynamicPstatesInfo: + """Empty-initialize an instance of `nvmlGpuDynamicPstatesInfo_t`. + + + .. seealso:: `nvmlGpuDynamicPstatesInfo_t` + """ + cdef: + nvmlGpuDynamicPstatesInfo_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlGpuDynamicPstatesInfo_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating GpuDynamicPstatesInfo") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlGpuDynamicPstatesInfo_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.GpuDynamicPstatesInfo object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef GpuDynamicPstatesInfo other_ + if not isinstance(other, GpuDynamicPstatesInfo): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlGpuDynamicPstatesInfo_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlGpuDynamicPstatesInfo_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlGpuDynamicPstatesInfo_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating GpuDynamicPstatesInfo") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlGpuDynamicPstatesInfo_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def utilization(self): + """_py_anon_pod1: """ + return _py_anon_pod1.from_ptr(&(self._ptr[0].utilization), 8, self._readonly) + + @utilization.setter + def utilization(self, val): + if self._readonly: + raise ValueError("This GpuDynamicPstatesInfo instance is read-only") + cdef _py_anon_pod1 val_ = val + if len(val) != 8: + raise ValueError(f"Expected length { 8 } for field utilization, got {len(val)}") + _cyb_memcpy(&(self._ptr[0].utilization), (val_._get_ptr()), sizeof(cuda_bindings_nvml__anon_pod1) * 8) + + @property + def flags_(self): + """int: """ + return self._ptr[0].flags + + @flags_.setter + def flags_(self, val): + if self._readonly: + raise ValueError("This GpuDynamicPstatesInfo instance is read-only") + self._ptr[0].flags = val + + @staticmethod + def from_buffer(buffer): + """Create an GpuDynamicPstatesInfo instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlGpuDynamicPstatesInfo_t), GpuDynamicPstatesInfo) + + @staticmethod + def from_data(data): + """Create an GpuDynamicPstatesInfo instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `gpu_dynamic_pstates_info_dtype` holding the data. + """ + return _cyb_from_data(data, "gpu_dynamic_pstates_info_dtype", gpu_dynamic_pstates_info_dtype, GpuDynamicPstatesInfo) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an GpuDynamicPstatesInfo instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef GpuDynamicPstatesInfo obj = GpuDynamicPstatesInfo.__new__(GpuDynamicPstatesInfo) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlGpuDynamicPstatesInfo_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating GpuDynamicPstatesInfo") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlGpuDynamicPstatesInfo_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_vgpu_processes_utilization_info_v1_dtype_offsets(): + cdef nvmlVgpuProcessesUtilizationInfo_v1_t pod + return _numpy.dtype({ + 'names': ['version', 'vgpu_process_count', 'last_seen_time_stamp', 'vgpu_proc_util_array'], + 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint64, _numpy.intp], + 'offsets': [ + (&(pod.version)) - (&pod), + (&(pod.vgpuProcessCount)) - (&pod), + (&(pod.lastSeenTimeStamp)) - (&pod), + (&(pod.vgpuProcUtilArray)) - (&pod), + ], + 'itemsize': sizeof(nvmlVgpuProcessesUtilizationInfo_v1_t), + }) + +vgpu_processes_utilization_info_v1_dtype = _get_vgpu_processes_utilization_info_v1_dtype_offsets() + +cdef class VgpuProcessesUtilizationInfo_v1: + """Empty-initialize an instance of `nvmlVgpuProcessesUtilizationInfo_v1_t`. + + + .. seealso:: `nvmlVgpuProcessesUtilizationInfo_v1_t` + """ + cdef: + nvmlVgpuProcessesUtilizationInfo_v1_t *_ptr + object _owner + bint _owned + bint _readonly + dict _refs + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlVgpuProcessesUtilizationInfo_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuProcessesUtilizationInfo_v1") + self._owner = None + self._owned = True + self._readonly = False + self._refs = {} + + def __dealloc__(self): + cdef nvmlVgpuProcessesUtilizationInfo_v1_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.VgpuProcessesUtilizationInfo_v1 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef VgpuProcessesUtilizationInfo_v1 other_ + if not isinstance(other, VgpuProcessesUtilizationInfo_v1): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuProcessesUtilizationInfo_v1_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlVgpuProcessesUtilizationInfo_v1_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlVgpuProcessesUtilizationInfo_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuProcessesUtilizationInfo_v1") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuProcessesUtilizationInfo_v1_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def version(self): + """int: The version number of this struct.""" + return self._ptr[0].version + + @version.setter + def version(self, val): + if self._readonly: + raise ValueError("This VgpuProcessesUtilizationInfo_v1 instance is read-only") + self._ptr[0].version = val + + @property + def last_seen_time_stamp(self): + """int: Return only samples with timestamp greater than lastSeenTimeStamp.""" + return self._ptr[0].lastSeenTimeStamp + + @last_seen_time_stamp.setter + def last_seen_time_stamp(self, val): + if self._readonly: + raise ValueError("This VgpuProcessesUtilizationInfo_v1 instance is read-only") + self._ptr[0].lastSeenTimeStamp = val + + @property + def vgpu_proc_util_array(self): + """int: The array (allocated by caller) in which utilization of processes running on vGPU instances are returned.""" + if self._ptr[0].vgpuProcUtilArray == NULL or self._ptr[0].vgpuProcessCount == 0: + return [] + return VgpuProcessUtilizationInfo_v1.from_ptr((self._ptr[0].vgpuProcUtilArray), self._ptr[0].vgpuProcessCount) + + @vgpu_proc_util_array.setter + def vgpu_proc_util_array(self, val): + if self._readonly: + raise ValueError("This VgpuProcessesUtilizationInfo_v1 instance is read-only") + cdef VgpuProcessUtilizationInfo_v1 arr = val + self._ptr[0].vgpuProcUtilArray = (arr._get_ptr()) + self._ptr[0].vgpuProcessCount = len(arr) + self._refs["vgpu_proc_util_array"] = arr + + @staticmethod + def from_buffer(buffer): + """Create an VgpuProcessesUtilizationInfo_v1 instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlVgpuProcessesUtilizationInfo_v1_t), VgpuProcessesUtilizationInfo_v1) + + @staticmethod + def from_data(data): + """Create an VgpuProcessesUtilizationInfo_v1 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `vgpu_processes_utilization_info_v1_dtype` holding the data. + """ + return _cyb_from_data(data, "vgpu_processes_utilization_info_v1_dtype", vgpu_processes_utilization_info_v1_dtype, VgpuProcessesUtilizationInfo_v1) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an VgpuProcessesUtilizationInfo_v1 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef VgpuProcessesUtilizationInfo_v1 obj = VgpuProcessesUtilizationInfo_v1.__new__(VgpuProcessesUtilizationInfo_v1) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlVgpuProcessesUtilizationInfo_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating VgpuProcessesUtilizationInfo_v1") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlVgpuProcessesUtilizationInfo_v1_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + obj._refs = {} + return obj + + +vgpu_scheduler_params_dtype = _numpy.dtype(( + _numpy.dtype((_numpy.void, sizeof(nvmlVgpuSchedulerParams_t))), + { + "vgpu_sched_data_with_arr": (_py_anon_pod2_dtype, 0), + "vgpu_sched_data": (_py_anon_pod3_dtype, 0), + } + )) + +cdef class VgpuSchedulerParams: + """Empty-initialize an instance of `nvmlVgpuSchedulerParams_t`. + + + .. seealso:: `nvmlVgpuSchedulerParams_t` + """ + cdef: + nvmlVgpuSchedulerParams_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlVgpuSchedulerParams_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuSchedulerParams") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlVgpuSchedulerParams_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.VgpuSchedulerParams object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef VgpuSchedulerParams other_ + if not isinstance(other, VgpuSchedulerParams): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuSchedulerParams_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlVgpuSchedulerParams_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlVgpuSchedulerParams_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuSchedulerParams") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuSchedulerParams_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def vgpu_sched_data_with_arr(self): + """_py_anon_pod2: """ + return _py_anon_pod2.from_ptr(&(self._ptr[0].vgpuSchedDataWithARR), self._readonly, self) + + @vgpu_sched_data_with_arr.setter + def vgpu_sched_data_with_arr(self, val): + if self._readonly: + raise ValueError("This VgpuSchedulerParams instance is read-only") + cdef _py_anon_pod2 val_ = val + _cyb_memcpy(&(self._ptr[0].vgpuSchedDataWithARR), (val_._get_ptr()), sizeof(cuda_bindings_nvml__anon_pod2) * 1) + + @property + def vgpu_sched_data(self): + """_py_anon_pod3: """ + return _py_anon_pod3.from_ptr(&(self._ptr[0].vgpuSchedData), self._readonly, self) + + @vgpu_sched_data.setter + def vgpu_sched_data(self, val): + if self._readonly: + raise ValueError("This VgpuSchedulerParams instance is read-only") + cdef _py_anon_pod3 val_ = val + _cyb_memcpy(&(self._ptr[0].vgpuSchedData), (val_._get_ptr()), sizeof(cuda_bindings_nvml__anon_pod3) * 1) + + @staticmethod + def from_buffer(buffer): + """Create an VgpuSchedulerParams instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlVgpuSchedulerParams_t), VgpuSchedulerParams) + + @staticmethod + def from_data(data): + """Create an VgpuSchedulerParams instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `vgpu_scheduler_params_dtype` holding the data. + """ + return _cyb_from_data(data, "vgpu_scheduler_params_dtype", vgpu_scheduler_params_dtype, VgpuSchedulerParams) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an VgpuSchedulerParams instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef VgpuSchedulerParams obj = VgpuSchedulerParams.__new__(VgpuSchedulerParams) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlVgpuSchedulerParams_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating VgpuSchedulerParams") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlVgpuSchedulerParams_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +vgpu_scheduler_set_params_dtype = _numpy.dtype(( + _numpy.dtype((_numpy.void, sizeof(nvmlVgpuSchedulerSetParams_t))), + { + "vgpu_sched_data_with_arr": (_py_anon_pod4_dtype, 0), + "vgpu_sched_data": (_py_anon_pod5_dtype, 0), + } + )) + +cdef class VgpuSchedulerSetParams: + """Empty-initialize an instance of `nvmlVgpuSchedulerSetParams_t`. + + + .. seealso:: `nvmlVgpuSchedulerSetParams_t` + """ + cdef: + nvmlVgpuSchedulerSetParams_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlVgpuSchedulerSetParams_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuSchedulerSetParams") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlVgpuSchedulerSetParams_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.VgpuSchedulerSetParams object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef VgpuSchedulerSetParams other_ + if not isinstance(other, VgpuSchedulerSetParams): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuSchedulerSetParams_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlVgpuSchedulerSetParams_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlVgpuSchedulerSetParams_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuSchedulerSetParams") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuSchedulerSetParams_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def vgpu_sched_data_with_arr(self): + """_py_anon_pod4: """ + return _py_anon_pod4.from_ptr(&(self._ptr[0].vgpuSchedDataWithARR), self._readonly, self) + + @vgpu_sched_data_with_arr.setter + def vgpu_sched_data_with_arr(self, val): + if self._readonly: + raise ValueError("This VgpuSchedulerSetParams instance is read-only") + cdef _py_anon_pod4 val_ = val + _cyb_memcpy(&(self._ptr[0].vgpuSchedDataWithARR), (val_._get_ptr()), sizeof(cuda_bindings_nvml__anon_pod4) * 1) + + @property + def vgpu_sched_data(self): + """_py_anon_pod5: """ + return _py_anon_pod5.from_ptr(&(self._ptr[0].vgpuSchedData), self._readonly, self) + + @vgpu_sched_data.setter + def vgpu_sched_data(self, val): + if self._readonly: + raise ValueError("This VgpuSchedulerSetParams instance is read-only") + cdef _py_anon_pod5 val_ = val + _cyb_memcpy(&(self._ptr[0].vgpuSchedData), (val_._get_ptr()), sizeof(cuda_bindings_nvml__anon_pod5) * 1) + + @staticmethod + def from_buffer(buffer): + """Create an VgpuSchedulerSetParams instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlVgpuSchedulerSetParams_t), VgpuSchedulerSetParams) + + @staticmethod + def from_data(data): + """Create an VgpuSchedulerSetParams instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `vgpu_scheduler_set_params_dtype` holding the data. + """ + return _cyb_from_data(data, "vgpu_scheduler_set_params_dtype", vgpu_scheduler_set_params_dtype, VgpuSchedulerSetParams) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an VgpuSchedulerSetParams instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef VgpuSchedulerSetParams obj = VgpuSchedulerSetParams.__new__(VgpuSchedulerSetParams) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlVgpuSchedulerSetParams_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating VgpuSchedulerSetParams") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlVgpuSchedulerSetParams_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_vgpu_license_info_dtype_offsets(): + cdef nvmlVgpuLicenseInfo_t pod + return _numpy.dtype({ + 'names': ['is_licensed', 'license_expiry', 'current_state'], + 'formats': [_numpy.uint8, vgpu_license_expiry_dtype, _numpy.uint32], + 'offsets': [ + (&(pod.isLicensed)) - (&pod), + (&(pod.licenseExpiry)) - (&pod), + (&(pod.currentState)) - (&pod), + ], + 'itemsize': sizeof(nvmlVgpuLicenseInfo_t), + }) + +vgpu_license_info_dtype = _get_vgpu_license_info_dtype_offsets() + +cdef class VgpuLicenseInfo: + """Empty-initialize an instance of `nvmlVgpuLicenseInfo_t`. + + + .. seealso:: `nvmlVgpuLicenseInfo_t` + """ + cdef: + nvmlVgpuLicenseInfo_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlVgpuLicenseInfo_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuLicenseInfo") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlVgpuLicenseInfo_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.VgpuLicenseInfo object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef VgpuLicenseInfo other_ + if not isinstance(other, VgpuLicenseInfo): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuLicenseInfo_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlVgpuLicenseInfo_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlVgpuLicenseInfo_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuLicenseInfo") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuLicenseInfo_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def license_expiry(self): + """VgpuLicenseExpiry: """ + return VgpuLicenseExpiry.from_ptr(&(self._ptr[0].licenseExpiry), self._readonly, self) + + @license_expiry.setter + def license_expiry(self, val): + if self._readonly: + raise ValueError("This VgpuLicenseInfo instance is read-only") + cdef VgpuLicenseExpiry val_ = val + _cyb_memcpy(&(self._ptr[0].licenseExpiry), (val_._get_ptr()), sizeof(nvmlVgpuLicenseExpiry_t) * 1) + + @property + def is_licensed(self): + """int: """ + return self._ptr[0].isLicensed + + @is_licensed.setter + def is_licensed(self, val): + if self._readonly: + raise ValueError("This VgpuLicenseInfo instance is read-only") + self._ptr[0].isLicensed = val + + @property + def current_state(self): + """int: """ + return self._ptr[0].currentState + + @current_state.setter + def current_state(self, val): + if self._readonly: + raise ValueError("This VgpuLicenseInfo instance is read-only") + self._ptr[0].currentState = val + + @staticmethod + def from_buffer(buffer): + """Create an VgpuLicenseInfo instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlVgpuLicenseInfo_t), VgpuLicenseInfo) + + @staticmethod + def from_data(data): + """Create an VgpuLicenseInfo instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `vgpu_license_info_dtype` holding the data. + """ + return _cyb_from_data(data, "vgpu_license_info_dtype", vgpu_license_info_dtype, VgpuLicenseInfo) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an VgpuLicenseInfo instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef VgpuLicenseInfo obj = VgpuLicenseInfo.__new__(VgpuLicenseInfo) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlVgpuLicenseInfo_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating VgpuLicenseInfo") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlVgpuLicenseInfo_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_grid_licensable_feature_dtype_offsets(): + cdef nvmlGridLicensableFeature_t pod + return _numpy.dtype({ + 'names': ['feature_code', 'feature_state', 'license_info', 'product_name', 'feature_enabled', 'license_expiry'], + 'formats': [_numpy.int32, _numpy.uint32, (_numpy.int8, 128), (_numpy.int8, 128), _numpy.uint32, grid_license_expiry_dtype], + 'offsets': [ + (&(pod.featureCode)) - (&pod), + (&(pod.featureState)) - (&pod), + (&(pod.licenseInfo)) - (&pod), + (&(pod.productName)) - (&pod), + (&(pod.featureEnabled)) - (&pod), + (&(pod.licenseExpiry)) - (&pod), + ], + 'itemsize': sizeof(nvmlGridLicensableFeature_t), + }) + +grid_licensable_feature_dtype = _get_grid_licensable_feature_dtype_offsets() + +cdef class GridLicensableFeature: + """Empty-initialize an array of `nvmlGridLicensableFeature_t`. + The resulting object is of length `size` and of dtype `grid_licensable_feature_dtype`. + If default-constructed, the instance represents a single struct. + + Args: + size (int): number of structs, default=1. + + .. seealso:: `nvmlGridLicensableFeature_t` + """ + cdef: + readonly object _data + + def __init__(self, size=1): + arr = _numpy.empty(size, dtype=grid_licensable_feature_dtype) + self._data = arr.view(_numpy.recarray) + assert self._data.itemsize == sizeof(nvmlGridLicensableFeature_t), \ + f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlGridLicensableFeature_t) }" + + def __repr__(self): + if self._data.size > 1: + return f"<{__name__}.GridLicensableFeature_Array_{self._data.size} object at {hex(id(self))}>" + else: + return f"<{__name__}.GridLicensableFeature object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return self._data.ctypes.data + + cdef intptr_t _get_ptr(self): + return self._data.ctypes.data + + def __int__(self): + if self._data.size > 1: + raise TypeError("int() argument must be a bytes-like object of size 1. " + "To get the pointer address of an array, use .ptr") + return self._data.ctypes.data + + def __len__(self): + return self._data.size + + def __eq__(self, other): + cdef object self_data = self._data + if (not isinstance(other, GridLicensableFeature)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype: + return False + return bool((self_data == other._data).all()) + + def __getbuffer__(self, Py_buffer *buffer, int flags): + _cyb_cpython.PyObject_GetBuffer(self._data, buffer, flags) + + def __releasebuffer__(self, Py_buffer *buffer): + _cyb_cpython.PyBuffer_Release(buffer) + + @property + def feature_code(self): + """Union[~_numpy.int32, int]: """ + if self._data.size == 1: + return int(self._data.feature_code[0]) + return self._data.feature_code + + @feature_code.setter + def feature_code(self, val): + self._data.feature_code = val + + @property + def feature_state(self): + """Union[~_numpy.uint32, int]: """ + if self._data.size == 1: + return int(self._data.feature_state[0]) + return self._data.feature_state + + @feature_state.setter + def feature_state(self, val): + self._data.feature_state = val + + @property + def license_info(self): + """~_numpy.int8: (array of length 128).""" + return self._data.license_info + + @license_info.setter + def license_info(self, val): + self._data.license_info = val + + @property + def product_name(self): + """~_numpy.int8: (array of length 128).""" + return self._data.product_name + + @product_name.setter + def product_name(self, val): + self._data.product_name = val + + @property + def feature_enabled(self): + """Union[~_numpy.uint32, int]: """ + if self._data.size == 1: + return int(self._data.feature_enabled[0]) + return self._data.feature_enabled + + @feature_enabled.setter + def feature_enabled(self, val): + self._data.feature_enabled = val + + @property + def license_expiry(self): + """grid_license_expiry_dtype: """ + return self._data.license_expiry + + @license_expiry.setter + def license_expiry(self, val): + self._data.license_expiry = val + + def __getitem__(self, key): + cdef ssize_t key_ + cdef ssize_t size + if isinstance(key, int): + key_ = key + size = self._data.size + if key_ >= size or key_ <= -(size+1): + raise IndexError("index is out of bounds") + if key_ < 0: + key_ += size + return GridLicensableFeature.from_data(self._data[key_:key_+1]) + out = self._data[key] + if isinstance(out, _numpy.recarray) and out.dtype == grid_licensable_feature_dtype: + return GridLicensableFeature.from_data(out) + return out + + def __setitem__(self, key, val): + self._data[key] = val + + @staticmethod + def from_buffer(buffer): + """Create an GridLicensableFeature instance with the memory from the given buffer.""" + return GridLicensableFeature.from_data(_numpy.frombuffer(buffer, dtype=grid_licensable_feature_dtype)) + + @staticmethod + def from_data(data): + """Create an GridLicensableFeature instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a 1D array of dtype `grid_licensable_feature_dtype` holding the data. + """ + cdef GridLicensableFeature obj = GridLicensableFeature.__new__(GridLicensableFeature) + if not isinstance(data, _numpy.ndarray): + raise TypeError("data argument must be a NumPy ndarray") + if data.ndim != 1: + raise ValueError("data array must be 1D") + if data.dtype != grid_licensable_feature_dtype: + raise ValueError("data array must be of dtype grid_licensable_feature_dtype") + obj._data = data.view(_numpy.recarray) + + return obj + + @staticmethod + def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False): + """Create an GridLicensableFeature instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + size (int): number of structs, default=1. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef GridLicensableFeature obj = GridLicensableFeature.__new__(GridLicensableFeature) + cdef flag = _cyb_cpython_buffer.PyBUF_READ if readonly else _cyb_cpython_buffer.PyBUF_WRITE + cdef object buf = _cyb_cpython_memoryview.PyMemoryView_FromMemory( + ptr, sizeof(nvmlGridLicensableFeature_t) * size, flag) + data = _numpy.ndarray(size, buffer=buf, dtype=grid_licensable_feature_dtype) + obj._data = data.view(_numpy.recarray) + + return obj + + +cdef _get_unit_fan_speeds_dtype_offsets(): + cdef nvmlUnitFanSpeeds_t pod + return _numpy.dtype({ + 'names': ['fans', 'count'], + 'formats': [(unit_fan_info_dtype, 24), _numpy.uint32], + 'offsets': [ + (&(pod.fans)) - (&pod), + (&(pod.count)) - (&pod), + ], + 'itemsize': sizeof(nvmlUnitFanSpeeds_t), + }) + +unit_fan_speeds_dtype = _get_unit_fan_speeds_dtype_offsets() + +cdef class UnitFanSpeeds: + """Empty-initialize an instance of `nvmlUnitFanSpeeds_t`. + + + .. seealso:: `nvmlUnitFanSpeeds_t` + """ + cdef: + nvmlUnitFanSpeeds_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlUnitFanSpeeds_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating UnitFanSpeeds") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlUnitFanSpeeds_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.UnitFanSpeeds object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef UnitFanSpeeds other_ + if not isinstance(other, UnitFanSpeeds): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlUnitFanSpeeds_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlUnitFanSpeeds_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlUnitFanSpeeds_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating UnitFanSpeeds") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlUnitFanSpeeds_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def fans(self): + """UnitFanInfo: """ + return UnitFanInfo.from_ptr(&(self._ptr[0].fans), 24, self._readonly) + + @fans.setter + def fans(self, val): + if self._readonly: + raise ValueError("This UnitFanSpeeds instance is read-only") + cdef UnitFanInfo val_ = val + if len(val) != 24: + raise ValueError(f"Expected length { 24 } for field fans, got {len(val)}") + _cyb_memcpy(&(self._ptr[0].fans), (val_._get_ptr()), sizeof(nvmlUnitFanInfo_t) * 24) + + @property + def count(self): + """int: """ + return self._ptr[0].count + + @count.setter + def count(self, val): + if self._readonly: + raise ValueError("This UnitFanSpeeds instance is read-only") + self._ptr[0].count = val + + @staticmethod + def from_buffer(buffer): + """Create an UnitFanSpeeds instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlUnitFanSpeeds_t), UnitFanSpeeds) + + @staticmethod + def from_data(data): + """Create an UnitFanSpeeds instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `unit_fan_speeds_dtype` holding the data. + """ + return _cyb_from_data(data, "unit_fan_speeds_dtype", unit_fan_speeds_dtype, UnitFanSpeeds) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an UnitFanSpeeds instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef UnitFanSpeeds obj = UnitFanSpeeds.__new__(UnitFanSpeeds) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlUnitFanSpeeds_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating UnitFanSpeeds") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlUnitFanSpeeds_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_vgpu_pgpu_metadata_dtype_offsets(): + cdef nvmlVgpuPgpuMetadata_t pod + return _numpy.dtype({ + 'names': ['version', 'revision', 'host_driver_version', 'pgpu_virtualization_caps', 'reserved', 'host_supported_vgpu_range', 'opaque_data_size', 'opaque_data'], + 'formats': [_numpy.uint32, _numpy.uint32, (_numpy.int8, 80), _numpy.uint32, (_numpy.uint32, 5), vgpu_version_dtype, _numpy.uint32, (_numpy.int8, 4)], + 'offsets': [ + (&(pod.version)) - (&pod), + (&(pod.revision)) - (&pod), + (&(pod.hostDriverVersion)) - (&pod), + (&(pod.pgpuVirtualizationCaps)) - (&pod), + (&(pod.reserved)) - (&pod), + (&(pod.hostSupportedVgpuRange)) - (&pod), + (&(pod.opaqueDataSize)) - (&pod), + (&(pod.opaqueData)) - (&pod), + ], + 'itemsize': sizeof(nvmlVgpuPgpuMetadata_t), + }) + +vgpu_pgpu_metadata_dtype = _get_vgpu_pgpu_metadata_dtype_offsets() + +cdef class VgpuPgpuMetadata: + """Empty-initialize an instance of `nvmlVgpuPgpuMetadata_t`. + + + .. seealso:: `nvmlVgpuPgpuMetadata_t` + """ + cdef: + nvmlVgpuPgpuMetadata_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlVgpuPgpuMetadata_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuPgpuMetadata") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlVgpuPgpuMetadata_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.VgpuPgpuMetadata object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef VgpuPgpuMetadata other_ + if not isinstance(other, VgpuPgpuMetadata): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuPgpuMetadata_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlVgpuPgpuMetadata_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlVgpuPgpuMetadata_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuPgpuMetadata") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuPgpuMetadata_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def host_supported_vgpu_range(self): + """VgpuVersion: """ + return VgpuVersion.from_ptr(&(self._ptr[0].hostSupportedVgpuRange), self._readonly, self) + + @host_supported_vgpu_range.setter + def host_supported_vgpu_range(self, val): + if self._readonly: + raise ValueError("This VgpuPgpuMetadata instance is read-only") + cdef VgpuVersion val_ = val + _cyb_memcpy(&(self._ptr[0].hostSupportedVgpuRange), (val_._get_ptr()), sizeof(nvmlVgpuVersion_t) * 1) + + @property + def version(self): + """int: """ + return self._ptr[0].version + + @version.setter + def version(self, val): + if self._readonly: + raise ValueError("This VgpuPgpuMetadata instance is read-only") + self._ptr[0].version = val + + @property + def revision(self): + """int: """ + return self._ptr[0].revision + + @revision.setter + def revision(self, val): + if self._readonly: + raise ValueError("This VgpuPgpuMetadata instance is read-only") + self._ptr[0].revision = val + + @property + def host_driver_version(self): + """~_numpy.int8: (array of length 80).""" + return _cyb_cpython.PyUnicode_FromString(self._ptr[0].hostDriverVersion) + + @host_driver_version.setter + def host_driver_version(self, val): + if self._readonly: + raise ValueError("This VgpuPgpuMetadata instance is read-only") + cdef bytes buf = val.encode() + if len(buf) >= 80: + raise ValueError("String too long for field host_driver_version, max length is 79") + cdef char *ptr = buf + _cyb_memcpy((self._ptr[0].hostDriverVersion), ptr, 80) + + @property + def pgpu_virtualization_caps(self): + """int: """ + return self._ptr[0].pgpuVirtualizationCaps + + @pgpu_virtualization_caps.setter + def pgpu_virtualization_caps(self, val): + if self._readonly: + raise ValueError("This VgpuPgpuMetadata instance is read-only") + self._ptr[0].pgpuVirtualizationCaps = val + + @property + def opaque_data_size(self): + """int: """ + return self._ptr[0].opaqueDataSize + + @opaque_data_size.setter + def opaque_data_size(self, val): + if self._readonly: + raise ValueError("This VgpuPgpuMetadata instance is read-only") + self._ptr[0].opaqueDataSize = val + + @property + def opaque_data(self): + """~_numpy.int8: (array of length 4).""" + return _cyb_cpython.PyUnicode_FromString(self._ptr[0].opaqueData) + + @opaque_data.setter + def opaque_data(self, val): + if self._readonly: + raise ValueError("This VgpuPgpuMetadata instance is read-only") + cdef bytes buf = val.encode() + if len(buf) >= 4: + raise ValueError("String too long for field opaque_data, max length is 3") + cdef char *ptr = buf + _cyb_memcpy((self._ptr[0].opaqueData), ptr, 4) + + @staticmethod + def from_buffer(buffer): + """Create an VgpuPgpuMetadata instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlVgpuPgpuMetadata_t), VgpuPgpuMetadata) + + @staticmethod + def from_data(data): + """Create an VgpuPgpuMetadata instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `vgpu_pgpu_metadata_dtype` holding the data. + """ + return _cyb_from_data(data, "vgpu_pgpu_metadata_dtype", vgpu_pgpu_metadata_dtype, VgpuPgpuMetadata) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an VgpuPgpuMetadata instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef VgpuPgpuMetadata obj = VgpuPgpuMetadata.__new__(VgpuPgpuMetadata) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlVgpuPgpuMetadata_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating VgpuPgpuMetadata") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlVgpuPgpuMetadata_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_gpu_instance_info_dtype_offsets(): + cdef nvmlGpuInstanceInfo_t pod + return _numpy.dtype({ + 'names': ['device_', 'id', 'profile_id', 'placement'], + 'formats': [_numpy.intp, _numpy.uint32, _numpy.uint32, gpu_instance_placement_dtype], + 'offsets': [ + (&(pod.device)) - (&pod), + (&(pod.id)) - (&pod), + (&(pod.profileId)) - (&pod), + (&(pod.placement)) - (&pod), + ], + 'itemsize': sizeof(nvmlGpuInstanceInfo_t), + }) + +gpu_instance_info_dtype = _get_gpu_instance_info_dtype_offsets() + +cdef class GpuInstanceInfo: + """Empty-initialize an instance of `nvmlGpuInstanceInfo_t`. + + + .. seealso:: `nvmlGpuInstanceInfo_t` + """ + cdef: + nvmlGpuInstanceInfo_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlGpuInstanceInfo_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating GpuInstanceInfo") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlGpuInstanceInfo_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.GpuInstanceInfo object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef GpuInstanceInfo other_ + if not isinstance(other, GpuInstanceInfo): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlGpuInstanceInfo_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlGpuInstanceInfo_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlGpuInstanceInfo_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating GpuInstanceInfo") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlGpuInstanceInfo_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def placement(self): + """GpuInstancePlacement: """ + return GpuInstancePlacement.from_ptr(&(self._ptr[0].placement), self._readonly, self) + + @placement.setter + def placement(self, val): + if self._readonly: + raise ValueError("This GpuInstanceInfo instance is read-only") + cdef GpuInstancePlacement val_ = val + _cyb_memcpy(&(self._ptr[0].placement), (val_._get_ptr()), sizeof(nvmlGpuInstancePlacement_t) * 1) + + @property + def device_(self): + """int: """ + return (self._ptr[0].device) + + @device_.setter + def device_(self, val): + if self._readonly: + raise ValueError("This GpuInstanceInfo instance is read-only") + self._ptr[0].device = val + + @property + def id(self): + """int: """ + return self._ptr[0].id + + @id.setter + def id(self, val): + if self._readonly: + raise ValueError("This GpuInstanceInfo instance is read-only") + self._ptr[0].id = val + + @property + def profile_id(self): + """int: """ + return self._ptr[0].profileId + + @profile_id.setter + def profile_id(self, val): + if self._readonly: + raise ValueError("This GpuInstanceInfo instance is read-only") + self._ptr[0].profileId = val + + @staticmethod + def from_buffer(buffer): + """Create an GpuInstanceInfo instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlGpuInstanceInfo_t), GpuInstanceInfo) + + @staticmethod + def from_data(data): + """Create an GpuInstanceInfo instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `gpu_instance_info_dtype` holding the data. + """ + return _cyb_from_data(data, "gpu_instance_info_dtype", gpu_instance_info_dtype, GpuInstanceInfo) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an GpuInstanceInfo instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef GpuInstanceInfo obj = GpuInstanceInfo.__new__(GpuInstanceInfo) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlGpuInstanceInfo_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating GpuInstanceInfo") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlGpuInstanceInfo_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_compute_instance_info_dtype_offsets(): + cdef nvmlComputeInstanceInfo_t pod + return _numpy.dtype({ + 'names': ['device_', 'gpu_instance', 'id', 'profile_id', 'placement'], + 'formats': [_numpy.intp, _numpy.intp, _numpy.uint32, _numpy.uint32, compute_instance_placement_dtype], + 'offsets': [ + (&(pod.device)) - (&pod), + (&(pod.gpuInstance)) - (&pod), + (&(pod.id)) - (&pod), + (&(pod.profileId)) - (&pod), + (&(pod.placement)) - (&pod), + ], + 'itemsize': sizeof(nvmlComputeInstanceInfo_t), + }) + +compute_instance_info_dtype = _get_compute_instance_info_dtype_offsets() + +cdef class ComputeInstanceInfo: + """Empty-initialize an instance of `nvmlComputeInstanceInfo_t`. + + + .. seealso:: `nvmlComputeInstanceInfo_t` + """ + cdef: + nvmlComputeInstanceInfo_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlComputeInstanceInfo_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ComputeInstanceInfo") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlComputeInstanceInfo_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.ComputeInstanceInfo object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef ComputeInstanceInfo other_ + if not isinstance(other, ComputeInstanceInfo): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlComputeInstanceInfo_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlComputeInstanceInfo_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlComputeInstanceInfo_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating ComputeInstanceInfo") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlComputeInstanceInfo_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def placement(self): + """ComputeInstancePlacement: """ + return ComputeInstancePlacement.from_ptr(&(self._ptr[0].placement), self._readonly, self) + + @placement.setter + def placement(self, val): + if self._readonly: + raise ValueError("This ComputeInstanceInfo instance is read-only") + cdef ComputeInstancePlacement val_ = val + _cyb_memcpy(&(self._ptr[0].placement), (val_._get_ptr()), sizeof(nvmlComputeInstancePlacement_t) * 1) + + @property + def device_(self): + """int: """ + return (self._ptr[0].device) + + @device_.setter + def device_(self, val): + if self._readonly: + raise ValueError("This ComputeInstanceInfo instance is read-only") + self._ptr[0].device = val + + @property + def gpu_instance(self): + """int: """ + return (self._ptr[0].gpuInstance) + + @gpu_instance.setter + def gpu_instance(self, val): + if self._readonly: + raise ValueError("This ComputeInstanceInfo instance is read-only") + self._ptr[0].gpuInstance = val + + @property + def id(self): + """int: """ + return self._ptr[0].id + + @id.setter + def id(self, val): + if self._readonly: + raise ValueError("This ComputeInstanceInfo instance is read-only") + self._ptr[0].id = val + + @property + def profile_id(self): + """int: """ + return self._ptr[0].profileId + + @profile_id.setter + def profile_id(self, val): + if self._readonly: + raise ValueError("This ComputeInstanceInfo instance is read-only") + self._ptr[0].profileId = val + + @staticmethod + def from_buffer(buffer): + """Create an ComputeInstanceInfo instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlComputeInstanceInfo_t), ComputeInstanceInfo) + + @staticmethod + def from_data(data): + """Create an ComputeInstanceInfo instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `compute_instance_info_dtype` holding the data. + """ + return _cyb_from_data(data, "compute_instance_info_dtype", compute_instance_info_dtype, ComputeInstanceInfo) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an ComputeInstanceInfo instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef ComputeInstanceInfo obj = ComputeInstanceInfo.__new__(ComputeInstanceInfo) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlComputeInstanceInfo_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating ComputeInstanceInfo") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlComputeInstanceInfo_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_ecc_sram_unique_uncorrected_error_counts_v1_dtype_offsets(): + cdef nvmlEccSramUniqueUncorrectedErrorCounts_v1_t pod + return _numpy.dtype({ + 'names': ['version', 'entry_count', 'entries'], + 'formats': [_numpy.uint32, _numpy.uint32, _numpy.intp], + 'offsets': [ + (&(pod.version)) - (&pod), + (&(pod.entryCount)) - (&pod), + (&(pod.entries)) - (&pod), + ], + 'itemsize': sizeof(nvmlEccSramUniqueUncorrectedErrorCounts_v1_t), + }) + +ecc_sram_unique_uncorrected_error_counts_v1_dtype = _get_ecc_sram_unique_uncorrected_error_counts_v1_dtype_offsets() + +cdef class EccSramUniqueUncorrectedErrorCounts_v1: + """Empty-initialize an instance of `nvmlEccSramUniqueUncorrectedErrorCounts_v1_t`. + + + .. seealso:: `nvmlEccSramUniqueUncorrectedErrorCounts_v1_t` + """ + cdef: + nvmlEccSramUniqueUncorrectedErrorCounts_v1_t *_ptr + object _owner + bint _owned + bint _readonly + dict _refs + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlEccSramUniqueUncorrectedErrorCounts_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating EccSramUniqueUncorrectedErrorCounts_v1") + self._owner = None + self._owned = True + self._readonly = False + self._refs = {} + + def __dealloc__(self): + cdef nvmlEccSramUniqueUncorrectedErrorCounts_v1_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.EccSramUniqueUncorrectedErrorCounts_v1 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef EccSramUniqueUncorrectedErrorCounts_v1 other_ + if not isinstance(other, EccSramUniqueUncorrectedErrorCounts_v1): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlEccSramUniqueUncorrectedErrorCounts_v1_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlEccSramUniqueUncorrectedErrorCounts_v1_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlEccSramUniqueUncorrectedErrorCounts_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating EccSramUniqueUncorrectedErrorCounts_v1") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlEccSramUniqueUncorrectedErrorCounts_v1_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def version(self): + """int: the API version number""" + return self._ptr[0].version + + @version.setter + def version(self, val): + if self._readonly: + raise ValueError("This EccSramUniqueUncorrectedErrorCounts_v1 instance is read-only") + self._ptr[0].version = val + + @property + def entries(self): + """int: pointer to caller-supplied buffer to return the SRAM unique uncorrected ECC error count entries""" + if self._ptr[0].entries == NULL or self._ptr[0].entryCount == 0: + return [] + return EccSramUniqueUncorrectedErrorEntry_v1.from_ptr((self._ptr[0].entries), self._ptr[0].entryCount) + + @entries.setter + def entries(self, val): + if self._readonly: + raise ValueError("This EccSramUniqueUncorrectedErrorCounts_v1 instance is read-only") + cdef EccSramUniqueUncorrectedErrorEntry_v1 arr = val + self._ptr[0].entries = (arr._get_ptr()) + self._ptr[0].entryCount = len(arr) + self._refs["entries"] = arr + + @staticmethod + def from_buffer(buffer): + """Create an EccSramUniqueUncorrectedErrorCounts_v1 instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlEccSramUniqueUncorrectedErrorCounts_v1_t), EccSramUniqueUncorrectedErrorCounts_v1) + + @staticmethod + def from_data(data): + """Create an EccSramUniqueUncorrectedErrorCounts_v1 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `ecc_sram_unique_uncorrected_error_counts_v1_dtype` holding the data. + """ + return _cyb_from_data(data, "ecc_sram_unique_uncorrected_error_counts_v1_dtype", ecc_sram_unique_uncorrected_error_counts_v1_dtype, EccSramUniqueUncorrectedErrorCounts_v1) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an EccSramUniqueUncorrectedErrorCounts_v1 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef EccSramUniqueUncorrectedErrorCounts_v1 obj = EccSramUniqueUncorrectedErrorCounts_v1.__new__(EccSramUniqueUncorrectedErrorCounts_v1) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlEccSramUniqueUncorrectedErrorCounts_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating EccSramUniqueUncorrectedErrorCounts_v1") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlEccSramUniqueUncorrectedErrorCounts_v1_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + obj._refs = {} + return obj + + +cdef _get_nvlink_firmware_info_dtype_offsets(): + cdef nvmlNvlinkFirmwareInfo_t pod + return _numpy.dtype({ + 'names': ['firmware_version', 'num_valid_entries'], + 'formats': [(nvlink_firmware_version_dtype, 100), _numpy.uint32], + 'offsets': [ + (&(pod.firmwareVersion)) - (&pod), + (&(pod.numValidEntries)) - (&pod), + ], + 'itemsize': sizeof(nvmlNvlinkFirmwareInfo_t), + }) + +nvlink_firmware_info_dtype = _get_nvlink_firmware_info_dtype_offsets() + +cdef class NvlinkFirmwareInfo: + """Empty-initialize an instance of `nvmlNvlinkFirmwareInfo_t`. + + + .. seealso:: `nvmlNvlinkFirmwareInfo_t` + """ + cdef: + nvmlNvlinkFirmwareInfo_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlNvlinkFirmwareInfo_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating NvlinkFirmwareInfo") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlNvlinkFirmwareInfo_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.NvlinkFirmwareInfo object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef NvlinkFirmwareInfo other_ + if not isinstance(other, NvlinkFirmwareInfo): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlNvlinkFirmwareInfo_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlNvlinkFirmwareInfo_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlNvlinkFirmwareInfo_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating NvlinkFirmwareInfo") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlNvlinkFirmwareInfo_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def firmware_version(self): + """NvlinkFirmwareVersion: OUT - NVLINK firmware version.""" + return NvlinkFirmwareVersion.from_ptr(&(self._ptr[0].firmwareVersion), 100, self._readonly) + + @firmware_version.setter + def firmware_version(self, val): + if self._readonly: + raise ValueError("This NvlinkFirmwareInfo instance is read-only") + cdef NvlinkFirmwareVersion val_ = val + if len(val) != 100: + raise ValueError(f"Expected length { 100 } for field firmware_version, got {len(val)}") + _cyb_memcpy(&(self._ptr[0].firmwareVersion), (val_._get_ptr()), sizeof(nvmlNvlinkFirmwareVersion_t) * 100) + + @property + def num_valid_entries(self): + """int: OUT - Number of valid firmware entries.""" + return self._ptr[0].numValidEntries + + @num_valid_entries.setter + def num_valid_entries(self, val): + if self._readonly: + raise ValueError("This NvlinkFirmwareInfo instance is read-only") + self._ptr[0].numValidEntries = val + + @staticmethod + def from_buffer(buffer): + """Create an NvlinkFirmwareInfo instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlNvlinkFirmwareInfo_t), NvlinkFirmwareInfo) + + @staticmethod + def from_data(data): + """Create an NvlinkFirmwareInfo instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `nvlink_firmware_info_dtype` holding the data. + """ + return _cyb_from_data(data, "nvlink_firmware_info_dtype", nvlink_firmware_info_dtype, NvlinkFirmwareInfo) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an NvlinkFirmwareInfo instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef NvlinkFirmwareInfo obj = NvlinkFirmwareInfo.__new__(NvlinkFirmwareInfo) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlNvlinkFirmwareInfo_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating NvlinkFirmwareInfo") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlNvlinkFirmwareInfo_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_vgpu_scheduler_log_info_v2_dtype_offsets(): + cdef nvmlVgpuSchedulerLogInfo_v2_t pod + return _numpy.dtype({ + 'names': ['engine_id', 'scheduler_policy', 'avg_factor', 'timeslice', 'entries_count', 'log_entries'], + 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, (vgpu_scheduler_log_entry_v2_dtype, 200)], + 'offsets': [ + (&(pod.engineId)) - (&pod), + (&(pod.schedulerPolicy)) - (&pod), + (&(pod.avgFactor)) - (&pod), + (&(pod.timeslice)) - (&pod), + (&(pod.entriesCount)) - (&pod), + (&(pod.logEntries)) - (&pod), + ], + 'itemsize': sizeof(nvmlVgpuSchedulerLogInfo_v2_t), + }) + +vgpu_scheduler_log_info_v2_dtype = _get_vgpu_scheduler_log_info_v2_dtype_offsets() + +cdef class VgpuSchedulerLogInfo_v2: + """Empty-initialize an instance of `nvmlVgpuSchedulerLogInfo_v2_t`. + + + .. seealso:: `nvmlVgpuSchedulerLogInfo_v2_t` + """ + cdef: + nvmlVgpuSchedulerLogInfo_v2_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlVgpuSchedulerLogInfo_v2_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuSchedulerLogInfo_v2") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlVgpuSchedulerLogInfo_v2_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.VgpuSchedulerLogInfo_v2 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef VgpuSchedulerLogInfo_v2 other_ + if not isinstance(other, VgpuSchedulerLogInfo_v2): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuSchedulerLogInfo_v2_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlVgpuSchedulerLogInfo_v2_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlVgpuSchedulerLogInfo_v2_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuSchedulerLogInfo_v2") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuSchedulerLogInfo_v2_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def log_entries(self): + """VgpuSchedulerLogEntry_v2: OUT: Structure to store the state and logs of a software runlist.""" + return VgpuSchedulerLogEntry_v2.from_ptr(&(self._ptr[0].logEntries), 200, self._readonly) + + @log_entries.setter + def log_entries(self, val): + if self._readonly: + raise ValueError("This VgpuSchedulerLogInfo_v2 instance is read-only") + cdef VgpuSchedulerLogEntry_v2 val_ = val + if len(val) != 200: + raise ValueError(f"Expected length { 200 } for field log_entries, got {len(val)}") + _cyb_memcpy(&(self._ptr[0].logEntries), (val_._get_ptr()), sizeof(nvmlVgpuSchedulerLogEntry_v2_t) * 200) + + @property + def engine_id(self): + """int: IN: Engine whose software runlist log entries are fetched. One of One of NVML_VGPU_SCHEDULER_ENGINE_TYPE_*.""" + return self._ptr[0].engineId + + @engine_id.setter + def engine_id(self, val): + if self._readonly: + raise ValueError("This VgpuSchedulerLogInfo_v2 instance is read-only") + self._ptr[0].engineId = val + + @property + def scheduler_policy(self): + """int: OUT: Scheduler policy.""" + return self._ptr[0].schedulerPolicy + + @scheduler_policy.setter + def scheduler_policy(self, val): + if self._readonly: + raise ValueError("This VgpuSchedulerLogInfo_v2 instance is read-only") + self._ptr[0].schedulerPolicy = val + + @property + def avg_factor(self): + """int: OUT: Average factor in compensating the timeslice for Adaptive Round Robin mode. 0 when there is no active scheduling.""" + return self._ptr[0].avgFactor + + @avg_factor.setter + def avg_factor(self, val): + if self._readonly: + raise ValueError("This VgpuSchedulerLogInfo_v2 instance is read-only") + self._ptr[0].avgFactor = val + + @property + def timeslice(self): + """int: OUT: The timeslice in ns for each software run list as configured, or the default value otherwise. 0 when there is no active scheduling.""" + return self._ptr[0].timeslice + + @timeslice.setter + def timeslice(self, val): + if self._readonly: + raise ValueError("This VgpuSchedulerLogInfo_v2 instance is read-only") + self._ptr[0].timeslice = val + + @property + def entries_count(self): + """int: OUT: Count of log entries fetched.""" + return self._ptr[0].entriesCount + + @entries_count.setter + def entries_count(self, val): + if self._readonly: + raise ValueError("This VgpuSchedulerLogInfo_v2 instance is read-only") + self._ptr[0].entriesCount = val + + @staticmethod + def from_buffer(buffer): + """Create an VgpuSchedulerLogInfo_v2 instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlVgpuSchedulerLogInfo_v2_t), VgpuSchedulerLogInfo_v2) + + @staticmethod + def from_data(data): + """Create an VgpuSchedulerLogInfo_v2 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `vgpu_scheduler_log_info_v2_dtype` holding the data. + """ + return _cyb_from_data(data, "vgpu_scheduler_log_info_v2_dtype", vgpu_scheduler_log_info_v2_dtype, VgpuSchedulerLogInfo_v2) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an VgpuSchedulerLogInfo_v2 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef VgpuSchedulerLogInfo_v2 obj = VgpuSchedulerLogInfo_v2.__new__(VgpuSchedulerLogInfo_v2) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlVgpuSchedulerLogInfo_v2_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating VgpuSchedulerLogInfo_v2") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlVgpuSchedulerLogInfo_v2_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_vgpu_instances_utilization_info_v1_dtype_offsets(): + cdef nvmlVgpuInstancesUtilizationInfo_v1_t pod + return _numpy.dtype({ + 'names': ['version', 'sample_val_type', 'vgpu_instance_count', 'last_seen_time_stamp', 'vgpu_util_array'], + 'formats': [_numpy.uint32, _numpy.int32, _numpy.uint32, _numpy.uint64, _numpy.intp], + 'offsets': [ + (&(pod.version)) - (&pod), + (&(pod.sampleValType)) - (&pod), + (&(pod.vgpuInstanceCount)) - (&pod), + (&(pod.lastSeenTimeStamp)) - (&pod), + (&(pod.vgpuUtilArray)) - (&pod), + ], + 'itemsize': sizeof(nvmlVgpuInstancesUtilizationInfo_v1_t), + }) + +vgpu_instances_utilization_info_v1_dtype = _get_vgpu_instances_utilization_info_v1_dtype_offsets() + +cdef class VgpuInstancesUtilizationInfo_v1: + """Empty-initialize an instance of `nvmlVgpuInstancesUtilizationInfo_v1_t`. + + + .. seealso:: `nvmlVgpuInstancesUtilizationInfo_v1_t` + """ + cdef: + nvmlVgpuInstancesUtilizationInfo_v1_t *_ptr + object _owner + bint _owned + bint _readonly + dict _refs + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlVgpuInstancesUtilizationInfo_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuInstancesUtilizationInfo_v1") + self._owner = None + self._owned = True + self._readonly = False + self._refs = {} + + def __dealloc__(self): + cdef nvmlVgpuInstancesUtilizationInfo_v1_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.VgpuInstancesUtilizationInfo_v1 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef VgpuInstancesUtilizationInfo_v1 other_ + if not isinstance(other, VgpuInstancesUtilizationInfo_v1): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuInstancesUtilizationInfo_v1_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlVgpuInstancesUtilizationInfo_v1_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlVgpuInstancesUtilizationInfo_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuInstancesUtilizationInfo_v1") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuInstancesUtilizationInfo_v1_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def version(self): + """int: The version number of this struct.""" + return self._ptr[0].version + + @version.setter + def version(self, val): + if self._readonly: + raise ValueError("This VgpuInstancesUtilizationInfo_v1 instance is read-only") + self._ptr[0].version = val + + @property + def sample_val_type(self): + """int: Hold the type of returned sample values.""" + return (self._ptr[0].sampleValType) + + @sample_val_type.setter + def sample_val_type(self, val): + if self._readonly: + raise ValueError("This VgpuInstancesUtilizationInfo_v1 instance is read-only") + self._ptr[0].sampleValType = val + + @property + def last_seen_time_stamp(self): + """int: Return only samples with timestamp greater than lastSeenTimeStamp.""" + return self._ptr[0].lastSeenTimeStamp + + @last_seen_time_stamp.setter + def last_seen_time_stamp(self, val): + if self._readonly: + raise ValueError("This VgpuInstancesUtilizationInfo_v1 instance is read-only") + self._ptr[0].lastSeenTimeStamp = val + + @property + def vgpu_util_array(self): + """int: The array (allocated by caller) in which vGPU utilization are returned.""" + if self._ptr[0].vgpuUtilArray == NULL or self._ptr[0].vgpuInstanceCount == 0: + return [] + return VgpuInstanceUtilizationInfo_v1.from_ptr((self._ptr[0].vgpuUtilArray), self._ptr[0].vgpuInstanceCount) + + @vgpu_util_array.setter + def vgpu_util_array(self, val): + if self._readonly: + raise ValueError("This VgpuInstancesUtilizationInfo_v1 instance is read-only") + cdef VgpuInstanceUtilizationInfo_v1 arr = val + self._ptr[0].vgpuUtilArray = (arr._get_ptr()) + self._ptr[0].vgpuInstanceCount = len(arr) + self._refs["vgpu_util_array"] = arr + + @staticmethod + def from_buffer(buffer): + """Create an VgpuInstancesUtilizationInfo_v1 instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlVgpuInstancesUtilizationInfo_v1_t), VgpuInstancesUtilizationInfo_v1) + + @staticmethod + def from_data(data): + """Create an VgpuInstancesUtilizationInfo_v1 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `vgpu_instances_utilization_info_v1_dtype` holding the data. + """ + return _cyb_from_data(data, "vgpu_instances_utilization_info_v1_dtype", vgpu_instances_utilization_info_v1_dtype, VgpuInstancesUtilizationInfo_v1) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an VgpuInstancesUtilizationInfo_v1 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef VgpuInstancesUtilizationInfo_v1 obj = VgpuInstancesUtilizationInfo_v1.__new__(VgpuInstancesUtilizationInfo_v1) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlVgpuInstancesUtilizationInfo_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating VgpuInstancesUtilizationInfo_v1") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlVgpuInstancesUtilizationInfo_v1_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + obj._refs = {} + return obj + + +cdef _get_prm_counter_v1_dtype_offsets(): + cdef nvmlPRMCounter_v1_t pod + return _numpy.dtype({ + 'names': ['counter_id', 'in_data', 'counter_value'], + 'formats': [_numpy.uint32, prm_counter_input_v1_dtype, prm_counter_value_v1_dtype], + 'offsets': [ + (&(pod.counterId)) - (&pod), + (&(pod.inData)) - (&pod), + (&(pod.counterValue)) - (&pod), + ], + 'itemsize': sizeof(nvmlPRMCounter_v1_t), + }) + +prm_counter_v1_dtype = _get_prm_counter_v1_dtype_offsets() + +cdef class PRMCounter_v1: + """Empty-initialize an array of `nvmlPRMCounter_v1_t`. + The resulting object is of length `size` and of dtype `prm_counter_v1_dtype`. + If default-constructed, the instance represents a single struct. + + Args: + size (int): number of structs, default=1. + + .. seealso:: `nvmlPRMCounter_v1_t` + """ + cdef: + readonly object _data + + def __init__(self, size=1): + arr = _numpy.empty(size, dtype=prm_counter_v1_dtype) + self._data = arr.view(_numpy.recarray) + assert self._data.itemsize == sizeof(nvmlPRMCounter_v1_t), \ + f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlPRMCounter_v1_t) }" + + def __repr__(self): + if self._data.size > 1: + return f"<{__name__}.PRMCounter_v1_Array_{self._data.size} object at {hex(id(self))}>" + else: + return f"<{__name__}.PRMCounter_v1 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return self._data.ctypes.data + + cdef intptr_t _get_ptr(self): + return self._data.ctypes.data + + def __int__(self): + if self._data.size > 1: + raise TypeError("int() argument must be a bytes-like object of size 1. " + "To get the pointer address of an array, use .ptr") + return self._data.ctypes.data + + def __len__(self): + return self._data.size + + def __eq__(self, other): + cdef object self_data = self._data + if (not isinstance(other, PRMCounter_v1)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype: + return False + return bool((self_data == other._data).all()) + + def __getbuffer__(self, Py_buffer *buffer, int flags): + _cyb_cpython.PyObject_GetBuffer(self._data, buffer, flags) + + def __releasebuffer__(self, Py_buffer *buffer): + _cyb_cpython.PyBuffer_Release(buffer) + + @property + def counter_id(self): + """Union[~_numpy.uint32, int]: Counter ID, one of `nvmlPRMCounterId_t`.""" + if self._data.size == 1: + return int(self._data.counter_id[0]) + return self._data.counter_id + + @counter_id.setter + def counter_id(self, val): + self._data.counter_id = val + + @property + def in_data(self): + """prm_counter_input_v1_dtype: PRM input values.""" + return self._data.in_data + + @in_data.setter + def in_data(self, val): + self._data.in_data = val + + @property + def counter_value(self): + """prm_counter_value_v1_dtype: Counter value.""" + return self._data.counter_value + + @counter_value.setter + def counter_value(self, val): + self._data.counter_value = val + + def __getitem__(self, key): + cdef ssize_t key_ + cdef ssize_t size + if isinstance(key, int): + key_ = key + size = self._data.size + if key_ >= size or key_ <= -(size+1): + raise IndexError("index is out of bounds") + if key_ < 0: + key_ += size + return PRMCounter_v1.from_data(self._data[key_:key_+1]) + out = self._data[key] + if isinstance(out, _numpy.recarray) and out.dtype == prm_counter_v1_dtype: + return PRMCounter_v1.from_data(out) + return out + + def __setitem__(self, key, val): + self._data[key] = val + + @staticmethod + def from_buffer(buffer): + """Create an PRMCounter_v1 instance with the memory from the given buffer.""" + return PRMCounter_v1.from_data(_numpy.frombuffer(buffer, dtype=prm_counter_v1_dtype)) + + @staticmethod + def from_data(data): + """Create an PRMCounter_v1 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a 1D array of dtype `prm_counter_v1_dtype` holding the data. + """ + cdef PRMCounter_v1 obj = PRMCounter_v1.__new__(PRMCounter_v1) + if not isinstance(data, _numpy.ndarray): + raise TypeError("data argument must be a NumPy ndarray") + if data.ndim != 1: + raise ValueError("data array must be 1D") + if data.dtype != prm_counter_v1_dtype: + raise ValueError("data array must be of dtype prm_counter_v1_dtype") + obj._data = data.view(_numpy.recarray) + + return obj + + @staticmethod + def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False): + """Create an PRMCounter_v1 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + size (int): number of structs, default=1. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef PRMCounter_v1 obj = PRMCounter_v1.__new__(PRMCounter_v1) + cdef flag = _cyb_cpython_buffer.PyBUF_READ if readonly else _cyb_cpython_buffer.PyBUF_WRITE + cdef object buf = _cyb_cpython_memoryview.PyMemoryView_FromMemory( + ptr, sizeof(nvmlPRMCounter_v1_t) * size, flag) + data = _numpy.ndarray(size, buffer=buf, dtype=prm_counter_v1_dtype) + obj._data = data.view(_numpy.recarray) + + return obj + + +cdef _get_vgpu_scheduler_log_dtype_offsets(): + cdef nvmlVgpuSchedulerLog_t pod + return _numpy.dtype({ + 'names': ['engine_id', 'scheduler_policy', 'arr_mode', 'scheduler_params', 'entries_count', 'log_entries'], + 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, vgpu_scheduler_params_dtype, _numpy.uint32, (vgpu_scheduler_log_entry_dtype, 200)], + 'offsets': [ + (&(pod.engineId)) - (&pod), + (&(pod.schedulerPolicy)) - (&pod), + (&(pod.arrMode)) - (&pod), + (&(pod.schedulerParams)) - (&pod), + (&(pod.entriesCount)) - (&pod), + (&(pod.logEntries)) - (&pod), + ], + 'itemsize': sizeof(nvmlVgpuSchedulerLog_t), + }) + +vgpu_scheduler_log_dtype = _get_vgpu_scheduler_log_dtype_offsets() + +cdef class VgpuSchedulerLog: + """Empty-initialize an instance of `nvmlVgpuSchedulerLog_t`. + + + .. seealso:: `nvmlVgpuSchedulerLog_t` + """ + cdef: + nvmlVgpuSchedulerLog_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlVgpuSchedulerLog_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuSchedulerLog") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlVgpuSchedulerLog_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.VgpuSchedulerLog object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef VgpuSchedulerLog other_ + if not isinstance(other, VgpuSchedulerLog): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuSchedulerLog_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlVgpuSchedulerLog_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlVgpuSchedulerLog_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuSchedulerLog") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuSchedulerLog_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def scheduler_params(self): + """VgpuSchedulerParams: """ + return VgpuSchedulerParams.from_ptr(&(self._ptr[0].schedulerParams), self._readonly, self) + + @scheduler_params.setter + def scheduler_params(self, val): + if self._readonly: + raise ValueError("This VgpuSchedulerLog instance is read-only") + cdef VgpuSchedulerParams val_ = val + _cyb_memcpy(&(self._ptr[0].schedulerParams), (val_._get_ptr()), sizeof(nvmlVgpuSchedulerParams_t) * 1) + + @property + def log_entries(self): + """VgpuSchedulerLogEntry: """ + return VgpuSchedulerLogEntry.from_ptr(&(self._ptr[0].logEntries), 200, self._readonly) + + @log_entries.setter + def log_entries(self, val): + if self._readonly: + raise ValueError("This VgpuSchedulerLog instance is read-only") + cdef VgpuSchedulerLogEntry val_ = val + if len(val) != 200: + raise ValueError(f"Expected length { 200 } for field log_entries, got {len(val)}") + _cyb_memcpy(&(self._ptr[0].logEntries), (val_._get_ptr()), sizeof(nvmlVgpuSchedulerLogEntry_t) * 200) + + @property + def engine_id(self): + """int: """ + return self._ptr[0].engineId + + @engine_id.setter + def engine_id(self, val): + if self._readonly: + raise ValueError("This VgpuSchedulerLog instance is read-only") + self._ptr[0].engineId = val + + @property + def scheduler_policy(self): + """int: """ + return self._ptr[0].schedulerPolicy + + @scheduler_policy.setter + def scheduler_policy(self, val): + if self._readonly: + raise ValueError("This VgpuSchedulerLog instance is read-only") + self._ptr[0].schedulerPolicy = val + + @property + def arr_mode(self): + """int: """ + return self._ptr[0].arrMode + + @arr_mode.setter + def arr_mode(self, val): + if self._readonly: + raise ValueError("This VgpuSchedulerLog instance is read-only") + self._ptr[0].arrMode = val + + @property + def entries_count(self): + """int: """ + return self._ptr[0].entriesCount + + @entries_count.setter + def entries_count(self, val): + if self._readonly: + raise ValueError("This VgpuSchedulerLog instance is read-only") + self._ptr[0].entriesCount = val + + @staticmethod + def from_buffer(buffer): + """Create an VgpuSchedulerLog instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlVgpuSchedulerLog_t), VgpuSchedulerLog) + + @staticmethod + def from_data(data): + """Create an VgpuSchedulerLog instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `vgpu_scheduler_log_dtype` holding the data. + """ + return _cyb_from_data(data, "vgpu_scheduler_log_dtype", vgpu_scheduler_log_dtype, VgpuSchedulerLog) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an VgpuSchedulerLog instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef VgpuSchedulerLog obj = VgpuSchedulerLog.__new__(VgpuSchedulerLog) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlVgpuSchedulerLog_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating VgpuSchedulerLog") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlVgpuSchedulerLog_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_vgpu_scheduler_get_state_dtype_offsets(): + cdef nvmlVgpuSchedulerGetState_t pod + return _numpy.dtype({ + 'names': ['scheduler_policy', 'arr_mode', 'scheduler_params'], + 'formats': [_numpy.uint32, _numpy.uint32, vgpu_scheduler_params_dtype], + 'offsets': [ + (&(pod.schedulerPolicy)) - (&pod), + (&(pod.arrMode)) - (&pod), + (&(pod.schedulerParams)) - (&pod), + ], + 'itemsize': sizeof(nvmlVgpuSchedulerGetState_t), + }) + +vgpu_scheduler_get_state_dtype = _get_vgpu_scheduler_get_state_dtype_offsets() + +cdef class VgpuSchedulerGetState: + """Empty-initialize an instance of `nvmlVgpuSchedulerGetState_t`. + + + .. seealso:: `nvmlVgpuSchedulerGetState_t` + """ + cdef: + nvmlVgpuSchedulerGetState_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlVgpuSchedulerGetState_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuSchedulerGetState") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlVgpuSchedulerGetState_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.VgpuSchedulerGetState object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef VgpuSchedulerGetState other_ + if not isinstance(other, VgpuSchedulerGetState): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuSchedulerGetState_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlVgpuSchedulerGetState_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlVgpuSchedulerGetState_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuSchedulerGetState") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuSchedulerGetState_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def scheduler_params(self): + """VgpuSchedulerParams: """ + return VgpuSchedulerParams.from_ptr(&(self._ptr[0].schedulerParams), self._readonly, self) + + @scheduler_params.setter + def scheduler_params(self, val): + if self._readonly: + raise ValueError("This VgpuSchedulerGetState instance is read-only") + cdef VgpuSchedulerParams val_ = val + _cyb_memcpy(&(self._ptr[0].schedulerParams), (val_._get_ptr()), sizeof(nvmlVgpuSchedulerParams_t) * 1) + + @property + def scheduler_policy(self): + """int: """ + return self._ptr[0].schedulerPolicy + + @scheduler_policy.setter + def scheduler_policy(self, val): + if self._readonly: + raise ValueError("This VgpuSchedulerGetState instance is read-only") + self._ptr[0].schedulerPolicy = val + + @property + def arr_mode(self): + """int: """ + return self._ptr[0].arrMode + + @arr_mode.setter + def arr_mode(self, val): + if self._readonly: + raise ValueError("This VgpuSchedulerGetState instance is read-only") + self._ptr[0].arrMode = val + + @staticmethod + def from_buffer(buffer): + """Create an VgpuSchedulerGetState instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlVgpuSchedulerGetState_t), VgpuSchedulerGetState) + + @staticmethod + def from_data(data): + """Create an VgpuSchedulerGetState instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `vgpu_scheduler_get_state_dtype` holding the data. + """ + return _cyb_from_data(data, "vgpu_scheduler_get_state_dtype", vgpu_scheduler_get_state_dtype, VgpuSchedulerGetState) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an VgpuSchedulerGetState instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef VgpuSchedulerGetState obj = VgpuSchedulerGetState.__new__(VgpuSchedulerGetState) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlVgpuSchedulerGetState_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating VgpuSchedulerGetState") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlVgpuSchedulerGetState_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_vgpu_scheduler_state_info_v1_dtype_offsets(): + cdef nvmlVgpuSchedulerStateInfo_v1_t pod + return _numpy.dtype({ + 'names': ['version', 'engine_id', 'scheduler_policy', 'arr_mode', 'scheduler_params'], + 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, vgpu_scheduler_params_dtype], + 'offsets': [ + (&(pod.version)) - (&pod), + (&(pod.engineId)) - (&pod), + (&(pod.schedulerPolicy)) - (&pod), + (&(pod.arrMode)) - (&pod), + (&(pod.schedulerParams)) - (&pod), + ], + 'itemsize': sizeof(nvmlVgpuSchedulerStateInfo_v1_t), + }) + +vgpu_scheduler_state_info_v1_dtype = _get_vgpu_scheduler_state_info_v1_dtype_offsets() + +cdef class VgpuSchedulerStateInfo_v1: + """Empty-initialize an instance of `nvmlVgpuSchedulerStateInfo_v1_t`. + + + .. seealso:: `nvmlVgpuSchedulerStateInfo_v1_t` + """ + cdef: + nvmlVgpuSchedulerStateInfo_v1_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlVgpuSchedulerStateInfo_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuSchedulerStateInfo_v1") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlVgpuSchedulerStateInfo_v1_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.VgpuSchedulerStateInfo_v1 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef VgpuSchedulerStateInfo_v1 other_ + if not isinstance(other, VgpuSchedulerStateInfo_v1): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuSchedulerStateInfo_v1_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlVgpuSchedulerStateInfo_v1_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlVgpuSchedulerStateInfo_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuSchedulerStateInfo_v1") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuSchedulerStateInfo_v1_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def scheduler_params(self): + """VgpuSchedulerParams: OUT: vGPU Scheduler Parameters.""" + return VgpuSchedulerParams.from_ptr(&(self._ptr[0].schedulerParams), self._readonly, self) + + @scheduler_params.setter + def scheduler_params(self, val): + if self._readonly: + raise ValueError("This VgpuSchedulerStateInfo_v1 instance is read-only") + cdef VgpuSchedulerParams val_ = val + _cyb_memcpy(&(self._ptr[0].schedulerParams), (val_._get_ptr()), sizeof(nvmlVgpuSchedulerParams_t) * 1) + + @property + def version(self): + """int: IN: The version number of this struct.""" + return self._ptr[0].version + + @version.setter + def version(self, val): + if self._readonly: + raise ValueError("This VgpuSchedulerStateInfo_v1 instance is read-only") + self._ptr[0].version = val + + @property + def engine_id(self): + """int: IN: Engine whose software scheduler state info is fetched. One of NVML_VGPU_SCHEDULER_ENGINE_TYPE_*.""" + return self._ptr[0].engineId + + @engine_id.setter + def engine_id(self, val): + if self._readonly: + raise ValueError("This VgpuSchedulerStateInfo_v1 instance is read-only") + self._ptr[0].engineId = val + + @property + def scheduler_policy(self): + """int: OUT: Scheduler policy.""" + return self._ptr[0].schedulerPolicy + + @scheduler_policy.setter + def scheduler_policy(self, val): + if self._readonly: + raise ValueError("This VgpuSchedulerStateInfo_v1 instance is read-only") + self._ptr[0].schedulerPolicy = val + + @property + def arr_mode(self): + """int: OUT: Adaptive Round Robin scheduler mode. One of the NVML_VGPU_SCHEDULER_ARR_*.""" + return self._ptr[0].arrMode + + @arr_mode.setter + def arr_mode(self, val): + if self._readonly: + raise ValueError("This VgpuSchedulerStateInfo_v1 instance is read-only") + self._ptr[0].arrMode = val + + @staticmethod + def from_buffer(buffer): + """Create an VgpuSchedulerStateInfo_v1 instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlVgpuSchedulerStateInfo_v1_t), VgpuSchedulerStateInfo_v1) + + @staticmethod + def from_data(data): + """Create an VgpuSchedulerStateInfo_v1 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `vgpu_scheduler_state_info_v1_dtype` holding the data. + """ + return _cyb_from_data(data, "vgpu_scheduler_state_info_v1_dtype", vgpu_scheduler_state_info_v1_dtype, VgpuSchedulerStateInfo_v1) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an VgpuSchedulerStateInfo_v1 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef VgpuSchedulerStateInfo_v1 obj = VgpuSchedulerStateInfo_v1.__new__(VgpuSchedulerStateInfo_v1) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlVgpuSchedulerStateInfo_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating VgpuSchedulerStateInfo_v1") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlVgpuSchedulerStateInfo_v1_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_vgpu_scheduler_log_info_v1_dtype_offsets(): + cdef nvmlVgpuSchedulerLogInfo_v1_t pod + return _numpy.dtype({ + 'names': ['version', 'engine_id', 'scheduler_policy', 'arr_mode', 'scheduler_params', 'entries_count', 'log_entries'], + 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, vgpu_scheduler_params_dtype, _numpy.uint32, (vgpu_scheduler_log_entry_dtype, 200)], + 'offsets': [ + (&(pod.version)) - (&pod), + (&(pod.engineId)) - (&pod), + (&(pod.schedulerPolicy)) - (&pod), + (&(pod.arrMode)) - (&pod), + (&(pod.schedulerParams)) - (&pod), + (&(pod.entriesCount)) - (&pod), + (&(pod.logEntries)) - (&pod), + ], + 'itemsize': sizeof(nvmlVgpuSchedulerLogInfo_v1_t), + }) + +vgpu_scheduler_log_info_v1_dtype = _get_vgpu_scheduler_log_info_v1_dtype_offsets() + +cdef class VgpuSchedulerLogInfo_v1: + """Empty-initialize an instance of `nvmlVgpuSchedulerLogInfo_v1_t`. + + + .. seealso:: `nvmlVgpuSchedulerLogInfo_v1_t` + """ + cdef: + nvmlVgpuSchedulerLogInfo_v1_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlVgpuSchedulerLogInfo_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuSchedulerLogInfo_v1") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlVgpuSchedulerLogInfo_v1_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.VgpuSchedulerLogInfo_v1 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef VgpuSchedulerLogInfo_v1 other_ + if not isinstance(other, VgpuSchedulerLogInfo_v1): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuSchedulerLogInfo_v1_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlVgpuSchedulerLogInfo_v1_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlVgpuSchedulerLogInfo_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuSchedulerLogInfo_v1") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuSchedulerLogInfo_v1_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def scheduler_params(self): + """VgpuSchedulerParams: OUT: vGPU Scheduler Parameters.""" + return VgpuSchedulerParams.from_ptr(&(self._ptr[0].schedulerParams), self._readonly, self) + + @scheduler_params.setter + def scheduler_params(self, val): + if self._readonly: + raise ValueError("This VgpuSchedulerLogInfo_v1 instance is read-only") + cdef VgpuSchedulerParams val_ = val + _cyb_memcpy(&(self._ptr[0].schedulerParams), (val_._get_ptr()), sizeof(nvmlVgpuSchedulerParams_t) * 1) + + @property + def log_entries(self): + """VgpuSchedulerLogEntry: OUT: Structure to store the state and logs of a software runlist.""" + return VgpuSchedulerLogEntry.from_ptr(&(self._ptr[0].logEntries), 200, self._readonly) + + @log_entries.setter + def log_entries(self, val): + if self._readonly: + raise ValueError("This VgpuSchedulerLogInfo_v1 instance is read-only") + cdef VgpuSchedulerLogEntry val_ = val + if len(val) != 200: + raise ValueError(f"Expected length { 200 } for field log_entries, got {len(val)}") + _cyb_memcpy(&(self._ptr[0].logEntries), (val_._get_ptr()), sizeof(nvmlVgpuSchedulerLogEntry_t) * 200) + + @property + def version(self): + """int: IN: The version number of this struct.""" + return self._ptr[0].version + + @version.setter + def version(self, val): + if self._readonly: + raise ValueError("This VgpuSchedulerLogInfo_v1 instance is read-only") + self._ptr[0].version = val + + @property + def engine_id(self): + """int: IN: Engine whose software runlist log entries are fetched. One of One of NVML_VGPU_SCHEDULER_ENGINE_TYPE_*.""" + return self._ptr[0].engineId + + @engine_id.setter + def engine_id(self, val): + if self._readonly: + raise ValueError("This VgpuSchedulerLogInfo_v1 instance is read-only") + self._ptr[0].engineId = val + + @property + def scheduler_policy(self): + """int: OUT: Scheduler policy.""" + return self._ptr[0].schedulerPolicy + + @scheduler_policy.setter + def scheduler_policy(self, val): + if self._readonly: + raise ValueError("This VgpuSchedulerLogInfo_v1 instance is read-only") + self._ptr[0].schedulerPolicy = val + + @property + def arr_mode(self): + """int: OUT: Adaptive Round Robin scheduler mode. One of the NVML_VGPU_SCHEDULER_ARR_*.""" + return self._ptr[0].arrMode + + @arr_mode.setter + def arr_mode(self, val): + if self._readonly: + raise ValueError("This VgpuSchedulerLogInfo_v1 instance is read-only") + self._ptr[0].arrMode = val + + @property + def entries_count(self): + """int: OUT: Count of log entries fetched.""" + return self._ptr[0].entriesCount + + @entries_count.setter + def entries_count(self, val): + if self._readonly: + raise ValueError("This VgpuSchedulerLogInfo_v1 instance is read-only") + self._ptr[0].entriesCount = val + + @staticmethod + def from_buffer(buffer): + """Create an VgpuSchedulerLogInfo_v1 instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlVgpuSchedulerLogInfo_v1_t), VgpuSchedulerLogInfo_v1) + + @staticmethod + def from_data(data): + """Create an VgpuSchedulerLogInfo_v1 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `vgpu_scheduler_log_info_v1_dtype` holding the data. + """ + return _cyb_from_data(data, "vgpu_scheduler_log_info_v1_dtype", vgpu_scheduler_log_info_v1_dtype, VgpuSchedulerLogInfo_v1) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an VgpuSchedulerLogInfo_v1 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef VgpuSchedulerLogInfo_v1 obj = VgpuSchedulerLogInfo_v1.__new__(VgpuSchedulerLogInfo_v1) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlVgpuSchedulerLogInfo_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating VgpuSchedulerLogInfo_v1") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlVgpuSchedulerLogInfo_v1_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_vgpu_scheduler_state_v1_dtype_offsets(): + cdef nvmlVgpuSchedulerState_v1_t pod + return _numpy.dtype({ + 'names': ['version', 'engine_id', 'scheduler_policy', 'enable_arr_mode', 'scheduler_params'], + 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, vgpu_scheduler_set_params_dtype], + 'offsets': [ + (&(pod.version)) - (&pod), + (&(pod.engineId)) - (&pod), + (&(pod.schedulerPolicy)) - (&pod), + (&(pod.enableARRMode)) - (&pod), + (&(pod.schedulerParams)) - (&pod), + ], + 'itemsize': sizeof(nvmlVgpuSchedulerState_v1_t), + }) + +vgpu_scheduler_state_v1_dtype = _get_vgpu_scheduler_state_v1_dtype_offsets() + +cdef class VgpuSchedulerState_v1: + """Empty-initialize an instance of `nvmlVgpuSchedulerState_v1_t`. + + + .. seealso:: `nvmlVgpuSchedulerState_v1_t` + """ + cdef: + nvmlVgpuSchedulerState_v1_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlVgpuSchedulerState_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuSchedulerState_v1") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlVgpuSchedulerState_v1_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.VgpuSchedulerState_v1 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef VgpuSchedulerState_v1 other_ + if not isinstance(other, VgpuSchedulerState_v1): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuSchedulerState_v1_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlVgpuSchedulerState_v1_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlVgpuSchedulerState_v1_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating VgpuSchedulerState_v1") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuSchedulerState_v1_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def scheduler_params(self): + """VgpuSchedulerSetParams: IN: vGPU Scheduler Parameters.""" + return VgpuSchedulerSetParams.from_ptr(&(self._ptr[0].schedulerParams), self._readonly, self) + + @scheduler_params.setter + def scheduler_params(self, val): + if self._readonly: + raise ValueError("This VgpuSchedulerState_v1 instance is read-only") + cdef VgpuSchedulerSetParams val_ = val + _cyb_memcpy(&(self._ptr[0].schedulerParams), (val_._get_ptr()), sizeof(nvmlVgpuSchedulerSetParams_t) * 1) + + @property + def version(self): + """int: IN: The version number of this struct.""" + return self._ptr[0].version + + @version.setter + def version(self, val): + if self._readonly: + raise ValueError("This VgpuSchedulerState_v1 instance is read-only") + self._ptr[0].version = val + + @property + def engine_id(self): + """int: IN: One of NVML_VGPU_SCHEDULER_ENGINE_TYPE_*.""" + return self._ptr[0].engineId + + @engine_id.setter + def engine_id(self, val): + if self._readonly: + raise ValueError("This VgpuSchedulerState_v1 instance is read-only") + self._ptr[0].engineId = val + + @property + def scheduler_policy(self): + """int: IN: Scheduler policy.""" + return self._ptr[0].schedulerPolicy + + @scheduler_policy.setter + def scheduler_policy(self, val): + if self._readonly: + raise ValueError("This VgpuSchedulerState_v1 instance is read-only") + self._ptr[0].schedulerPolicy = val + + @property + def enable_arr_mode(self): + """int: IN: Adaptive Round Robin scheduler.""" + return self._ptr[0].enableARRMode + + @enable_arr_mode.setter + def enable_arr_mode(self, val): + if self._readonly: + raise ValueError("This VgpuSchedulerState_v1 instance is read-only") + self._ptr[0].enableARRMode = val + + @staticmethod + def from_buffer(buffer): + """Create an VgpuSchedulerState_v1 instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlVgpuSchedulerState_v1_t), VgpuSchedulerState_v1) + + @staticmethod + def from_data(data): + """Create an VgpuSchedulerState_v1 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `vgpu_scheduler_state_v1_dtype` holding the data. + """ + return _cyb_from_data(data, "vgpu_scheduler_state_v1_dtype", vgpu_scheduler_state_v1_dtype, VgpuSchedulerState_v1) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an VgpuSchedulerState_v1 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef VgpuSchedulerState_v1 obj = VgpuSchedulerState_v1.__new__(VgpuSchedulerState_v1) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlVgpuSchedulerState_v1_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating VgpuSchedulerState_v1") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlVgpuSchedulerState_v1_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_grid_licensable_features_dtype_offsets(): + cdef nvmlGridLicensableFeatures_t pod + return _numpy.dtype({ + 'names': ['is_grid_license_supported', 'licensable_features_count', 'grid_licensable_features'], + 'formats': [_numpy.int32, _numpy.uint32, (grid_licensable_feature_dtype, 3)], + 'offsets': [ + (&(pod.isGridLicenseSupported)) - (&pod), + (&(pod.licensableFeaturesCount)) - (&pod), + (&(pod.gridLicensableFeatures)) - (&pod), + ], + 'itemsize': sizeof(nvmlGridLicensableFeatures_t), + }) + +grid_licensable_features_dtype = _get_grid_licensable_features_dtype_offsets() + +cdef class GridLicensableFeatures: + """Empty-initialize an instance of `nvmlGridLicensableFeatures_t`. + + + .. seealso:: `nvmlGridLicensableFeatures_t` + """ + cdef: + nvmlGridLicensableFeatures_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlGridLicensableFeatures_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating GridLicensableFeatures") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlGridLicensableFeatures_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.GridLicensableFeatures object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef GridLicensableFeatures other_ + if not isinstance(other, GridLicensableFeatures): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlGridLicensableFeatures_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlGridLicensableFeatures_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlGridLicensableFeatures_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating GridLicensableFeatures") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlGridLicensableFeatures_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def grid_licensable_features(self): + """GridLicensableFeature: """ + return GridLicensableFeature.from_ptr(&(self._ptr[0].gridLicensableFeatures), self._ptr[0].licensableFeaturesCount, self._readonly) + + @grid_licensable_features.setter + def grid_licensable_features(self, val): + if self._readonly: + raise ValueError("This GridLicensableFeatures instance is read-only") + cdef GridLicensableFeature val_ = val + if len(val) > 3: + raise ValueError(f"Expected length < 3 for field grid_licensable_features, got {len(val)}") + self._ptr[0].licensableFeaturesCount = len(val) + if len(val) == 0: + return + _cyb_memcpy(&(self._ptr[0].gridLicensableFeatures), (val_._get_ptr()), sizeof(nvmlGridLicensableFeature_t) * self._ptr[0].licensableFeaturesCount) + + @property + def is_grid_license_supported(self): + """int: """ + return self._ptr[0].isGridLicenseSupported + + @is_grid_license_supported.setter + def is_grid_license_supported(self, val): + if self._readonly: + raise ValueError("This GridLicensableFeatures instance is read-only") + self._ptr[0].isGridLicenseSupported = val + + @staticmethod + def from_buffer(buffer): + """Create an GridLicensableFeatures instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlGridLicensableFeatures_t), GridLicensableFeatures) + + @staticmethod + def from_data(data): + """Create an GridLicensableFeatures instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `grid_licensable_features_dtype` holding the data. + """ + return _cyb_from_data(data, "grid_licensable_features_dtype", grid_licensable_features_dtype, GridLicensableFeatures) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an GridLicensableFeatures instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef GridLicensableFeatures obj = GridLicensableFeatures.__new__(GridLicensableFeatures) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlGridLicensableFeatures_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating GridLicensableFeatures") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlGridLicensableFeatures_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cdef _get_nv_link_info_v2_dtype_offsets(): + cdef nvmlNvLinkInfo_v2_t pod + return _numpy.dtype({ + 'names': ['version', 'is_nvle_enabled', 'firmware_info'], + 'formats': [_numpy.uint32, _numpy.uint32, nvlink_firmware_info_dtype], + 'offsets': [ + (&(pod.version)) - (&pod), + (&(pod.isNvleEnabled)) - (&pod), + (&(pod.firmwareInfo)) - (&pod), + ], + 'itemsize': sizeof(nvmlNvLinkInfo_v2_t), + }) + +nv_link_info_v2_dtype = _get_nv_link_info_v2_dtype_offsets() + +cdef class NvLinkInfo_v2: + """Empty-initialize an instance of `nvmlNvLinkInfo_v2_t`. + + + .. seealso:: `nvmlNvLinkInfo_v2_t` + """ + cdef: + nvmlNvLinkInfo_v2_t *_ptr + object _owner + bint _owned + bint _readonly + + def __init__(self): + self._ptr = _cyb_calloc(1, sizeof(nvmlNvLinkInfo_v2_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating NvLinkInfo_v2") + self._owner = None + self._owned = True + self._readonly = False + + def __dealloc__(self): + cdef nvmlNvLinkInfo_v2_t *ptr + if self._owned and self._ptr != NULL: + ptr = self._ptr + self._ptr = NULL + _cyb_free(ptr) + + def __repr__(self): + return f"<{__name__}.NvLinkInfo_v2 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return (self._ptr) + + cdef intptr_t _get_ptr(self): + return (self._ptr) + + def __int__(self): + return (self._ptr) + + def __eq__(self, other): + cdef NvLinkInfo_v2 other_ + if not isinstance(other, NvLinkInfo_v2): + return False + other_ = other + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlNvLinkInfo_v2_t)) == 0) + + def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): + _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlNvLinkInfo_v2_t), self._readonly) + + def __releasebuffer__(self, Py_buffer *buffer): + pass + + def __setitem__(self, key, val): + if key == 0 and isinstance(val, _numpy.ndarray): + self._ptr = _cyb_malloc(sizeof(nvmlNvLinkInfo_v2_t)) + if self._ptr == NULL: + raise MemoryError("Error allocating NvLinkInfo_v2") + _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlNvLinkInfo_v2_t)) + self._owner = None + self._owned = True + self._readonly = not val.flags.writeable + else: + setattr(self, key, val) + + @property + def firmware_info(self): + """NvlinkFirmwareInfo: OUT - NVLINK Firmware info.""" + return NvlinkFirmwareInfo.from_ptr(&(self._ptr[0].firmwareInfo), self._readonly, self) + + @firmware_info.setter + def firmware_info(self, val): + if self._readonly: + raise ValueError("This NvLinkInfo_v2 instance is read-only") + cdef NvlinkFirmwareInfo val_ = val + _cyb_memcpy(&(self._ptr[0].firmwareInfo), (val_._get_ptr()), sizeof(nvmlNvlinkFirmwareInfo_t) * 1) + + @property + def version(self): + """int: IN - the API version number.""" + return self._ptr[0].version + + @version.setter + def version(self, val): + if self._readonly: + raise ValueError("This NvLinkInfo_v2 instance is read-only") + self._ptr[0].version = val + + @property + def is_nvle_enabled(self): + """int: OUT - NVLINK encryption enablement.""" + return self._ptr[0].isNvleEnabled + + @is_nvle_enabled.setter + def is_nvle_enabled(self, val): + if self._readonly: + raise ValueError("This NvLinkInfo_v2 instance is read-only") + self._ptr[0].isNvleEnabled = val + + @staticmethod + def from_buffer(buffer): + """Create an NvLinkInfo_v2 instance with the memory from the given buffer.""" + return _cyb_from_buffer(buffer, sizeof(nvmlNvLinkInfo_v2_t), NvLinkInfo_v2) + + @staticmethod + def from_data(data): + """Create an NvLinkInfo_v2 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a single-element array of dtype `nv_link_info_v2_dtype` holding the data. + """ + return _cyb_from_data(data, "nv_link_info_v2_dtype", nv_link_info_v2_dtype, NvLinkInfo_v2) + + @staticmethod + def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): + """Create an NvLinkInfo_v2 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + owner (object): The Python object that owns the pointer. If not provided, data will be copied. + readonly (bool): whether the data is read-only (to the user). default is `False`. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef NvLinkInfo_v2 obj = NvLinkInfo_v2.__new__(NvLinkInfo_v2) + if owner is None: + obj._ptr = _cyb_malloc(sizeof(nvmlNvLinkInfo_v2_t)) + if obj._ptr == NULL: + raise MemoryError("Error allocating NvLinkInfo_v2") + _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlNvLinkInfo_v2_t)) + obj._owner = None + obj._owned = True + else: + obj._ptr = ptr + obj._owner = owner + obj._owned = False + obj._readonly = readonly + return obj + + +cpdef init_v2(): + """Initialize NVML, but don't initialize any GPUs yet. + + .. seealso:: `nvmlInit_v2` + """ + with nogil: + __status__ = nvmlInit_v2() + check_status(__status__) + + +cpdef init_with_flags(unsigned int flags): + """nvmlInitWithFlags is a variant of ``nvmlInit()``, that allows passing a set of boolean values modifying the behaviour of ``nvmlInit()``. Other than the "flags" parameter it is completely similar to ``nvmlInit_v2``. + + Args: + flags (unsigned int): behaviour modifier flags. + + .. seealso:: `nvmlInitWithFlags` + """ + with nogil: + __status__ = nvmlInitWithFlags(flags) + check_status(__status__) + + +cpdef shutdown(): + """Shut down NVML by releasing all GPU resources previously allocated with :func:`init_v2`. + + .. seealso:: `nvmlShutdown` + """ + with nogil: + __status__ = nvmlShutdown() + check_status(__status__) + + +cpdef str error_string(int result): + """Helper method for converting NVML error codes into readable strings. + + Args: + result (Return): NVML error code to convert. + + .. seealso:: `nvmlErrorString` + """ + cdef const char *_output_cstr_ + cdef bytes _output_ + with nogil: + _output_cstr_ = nvmlErrorString(<_Return>result) + _output_ = _output_cstr_ + return _output_.decode() + + +cpdef str system_get_driver_version(): + """Retrieves the version of the system's graphics driver. + + Returns: + char: Reference in which to return the version identifier. + + .. seealso:: `nvmlSystemGetDriverVersion` + """ + cdef unsigned int length = 80 + cdef char[80] version + with nogil: + __status__ = nvmlSystemGetDriverVersion(version, length) + check_status(__status__) + return _cyb_cpython.PyUnicode_FromString(version) + + +cpdef str system_get_nvml_version(): + """Retrieves the version of the NVML library. + + Returns: + char: Reference in which to return the version identifier. + + .. seealso:: `nvmlSystemGetNVMLVersion` + """ + cdef unsigned int length = 80 + cdef char[80] version + with nogil: + __status__ = nvmlSystemGetNVMLVersion(version, length) + check_status(__status__) + return _cyb_cpython.PyUnicode_FromString(version) + + +cpdef int system_get_cuda_driver_version() except *: + """Retrieves the version of the CUDA driver. + + Returns: + int: Reference in which to return the version identifier. + + .. seealso:: `nvmlSystemGetCudaDriverVersion` + """ + cdef int cuda_driver_version + with nogil: + __status__ = nvmlSystemGetCudaDriverVersion(&cuda_driver_version) + check_status(__status__) + return cuda_driver_version + + +cpdef int system_get_cuda_driver_version_v2() except 0: + """Retrieves the version of the CUDA driver from the shared library. + + Returns: + int: Reference in which to return the version identifier. + + .. seealso:: `nvmlSystemGetCudaDriverVersion_v2` + """ + cdef int cuda_driver_version + with nogil: + __status__ = nvmlSystemGetCudaDriverVersion_v2(&cuda_driver_version) + check_status(__status__) + return cuda_driver_version + + +cpdef str system_get_process_name(unsigned int pid): + """Gets name of the process with provided process id. + + Args: + pid (unsigned int): The identifier of the process. + + Returns: + char: Reference in which to return the process name. + + .. seealso:: `nvmlSystemGetProcessName` + """ + cdef unsigned int length = 1024 + cdef char[1024] name + with nogil: + __status__ = nvmlSystemGetProcessName(pid, name, length) + check_status(__status__) + return _cyb_cpython.PyUnicode_FromString(name) + + +cpdef object system_get_hic_version(): + """Retrieves the IDs and firmware versions for any Host Interface Cards (HICs) in the system. + + Returns: + nvmlHwbcEntry_t: Array holding information about hwbc. + + .. seealso:: `nvmlSystemGetHicVersion` + """ + cdef unsigned int[1] hwbc_count = [0] + with nogil: + __status__ = nvmlSystemGetHicVersion(hwbc_count, NULL) + check_status_size(__status__) + cdef HwbcEntry hwbc_entries = HwbcEntry(hwbc_count[0]) + cdef nvmlHwbcEntry_t *hwbc_entries_ptr = (hwbc_entries._get_ptr()) + if hwbc_count[0] == 0: + return hwbc_entries + with nogil: + __status__ = nvmlSystemGetHicVersion(hwbc_count, hwbc_entries_ptr) + check_status(__status__) + return hwbc_entries + + +cpdef unsigned int unit_get_count() except? 0: + """Retrieves the number of units in the system. + + Returns: + unsigned int: Reference in which to return the number of units. + + .. seealso:: `nvmlUnitGetCount` + """ + cdef unsigned int unit_count + with nogil: + __status__ = nvmlUnitGetCount(&unit_count) + check_status(__status__) + return unit_count + + +cpdef intptr_t unit_get_handle_by_index(unsigned int index) except? 0: + """Acquire the handle for a particular unit, based on its index. + + Args: + index (unsigned int): The index of the target unit, >= 0 and < ``unitCount``. + + Returns: + intptr_t: Reference in which to return the unit handle. + + .. seealso:: `nvmlUnitGetHandleByIndex` + """ + cdef Unit unit + with nogil: + __status__ = nvmlUnitGetHandleByIndex(index, &unit) + check_status(__status__) + return unit + + +cpdef object unit_get_unit_info(intptr_t unit): + """Retrieves the static information associated with a unit. + + Args: + unit (intptr_t): The identifier of the target unit. + + Returns: + nvmlUnitInfo_t: Reference in which to return the unit information. + + .. seealso:: `nvmlUnitGetUnitInfo` + """ + cdef UnitInfo info_py = UnitInfo() + cdef nvmlUnitInfo_t *info = (info_py._get_ptr()) + with nogil: + __status__ = nvmlUnitGetUnitInfo(unit, info) + check_status(__status__) + return info_py + + +cpdef object unit_get_led_state(intptr_t unit): + """Retrieves the LED state associated with this unit. + + Args: + unit (intptr_t): The identifier of the target unit. + + Returns: + nvmlLedState_t: Reference in which to return the current LED state. + + .. seealso:: `nvmlUnitGetLedState` + """ + cdef LedState state_py = LedState() + cdef nvmlLedState_t *state = (state_py._get_ptr()) + with nogil: + __status__ = nvmlUnitGetLedState(unit, state) + check_status(__status__) + return state_py + + +cpdef object unit_get_psu_info(intptr_t unit): + """Retrieves the PSU stats for the unit. + + Args: + unit (intptr_t): The identifier of the target unit. + + Returns: + nvmlPSUInfo_t: Reference in which to return the PSU information. + + .. seealso:: `nvmlUnitGetPsuInfo` + """ + cdef PSUInfo psu_py = PSUInfo() + cdef nvmlPSUInfo_t *psu = (psu_py._get_ptr()) + with nogil: + __status__ = nvmlUnitGetPsuInfo(unit, psu) + check_status(__status__) + return psu_py + + +cpdef unsigned int unit_get_temperature(intptr_t unit, unsigned int type) except? 0: + """Retrieves the temperature readings for the unit, in degrees C. + + Args: + unit (intptr_t): The identifier of the target unit. + type (unsigned int): The type of reading to take. + + Returns: + unsigned int: Reference in which to return the intake temperature. + + .. seealso:: `nvmlUnitGetTemperature` + """ + cdef unsigned int temp + with nogil: + __status__ = nvmlUnitGetTemperature(unit, type, &temp) + check_status(__status__) + return temp + + +cpdef object unit_get_fan_speed_info(intptr_t unit): + """Retrieves the fan speed readings for the unit. + + Args: + unit (intptr_t): The identifier of the target unit. + + Returns: + nvmlUnitFanSpeeds_t: Reference in which to return the fan speed information. + + .. seealso:: `nvmlUnitGetFanSpeedInfo` + """ + cdef UnitFanSpeeds fan_speeds_py = UnitFanSpeeds() + cdef nvmlUnitFanSpeeds_t *fan_speeds = (fan_speeds_py._get_ptr()) + with nogil: + __status__ = nvmlUnitGetFanSpeedInfo(unit, fan_speeds) + check_status(__status__) + return fan_speeds_py + + +cpdef unsigned int device_get_count_v2() except? 0: + """Retrieves the number of compute devices in the system. A compute device is a single GPU. + + Returns: + unsigned int: Reference in which to return the number of accessible devices. + + .. seealso:: `nvmlDeviceGetCount_v2` + """ + cdef unsigned int device_count + with nogil: + __status__ = nvmlDeviceGetCount_v2(&device_count) + check_status(__status__) + return device_count + + +cpdef object device_get_attributes_v2(intptr_t device): + """Get attributes (engine counts etc.) for the given NVML device handle. + + Args: + device (intptr_t): NVML device handle. + + Returns: + nvmlDeviceAttributes_t: Device attributes. + + .. seealso:: `nvmlDeviceGetAttributes_v2` + """ + cdef DeviceAttributes attributes_py = DeviceAttributes() + cdef nvmlDeviceAttributes_t *attributes = (attributes_py._get_ptr()) + with nogil: + __status__ = nvmlDeviceGetAttributes_v2(device, attributes) + check_status(__status__) + return attributes_py + + +cpdef intptr_t device_get_handle_by_index_v2(unsigned int index) except? 0: + """Acquire the handle for a particular device, based on its index. + + Args: + index (unsigned int): The index of the target GPU, >= 0 and < ``accessibleDevices``. + + Returns: + intptr_t: Reference in which to return the device handle. + + .. seealso:: `nvmlDeviceGetHandleByIndex_v2` + """ + cdef Device device + with nogil: + __status__ = nvmlDeviceGetHandleByIndex_v2(index, &device) + check_status(__status__) + return device + + +cpdef intptr_t device_get_handle_by_serial(serial) except? 0: + """Acquire the handle for a particular device, based on its board serial number. + + Args: + serial (str): The board serial number of the target GPU. + + Returns: + intptr_t: Reference in which to return the device handle. + + .. seealso:: `nvmlDeviceGetHandleBySerial` + """ + if not isinstance(serial, str): + raise TypeError("serial must be a Python str") + cdef bytes _temp_serial_ = (serial).encode() + cdef char* _serial_ = _temp_serial_ + cdef Device device + with nogil: + __status__ = nvmlDeviceGetHandleBySerial(_serial_, &device) + check_status(__status__) + return device + + +cpdef intptr_t device_get_handle_by_uuid(uuid) except? 0: + """Acquire the handle for a particular device, based on its globally unique immutable UUID (in ASCII format) associated with each device. + + Args: + uuid (str): The UUID of the target GPU or MIG instance. + + Returns: + intptr_t: Reference in which to return the device handle or MIG device handle. + + .. seealso:: `nvmlDeviceGetHandleByUUID` + """ + if not isinstance(uuid, str): + raise TypeError("uuid must be a Python str") + cdef bytes _temp_uuid_ = (uuid).encode() + cdef char* _uuid_ = _temp_uuid_ + cdef Device device + with nogil: + __status__ = nvmlDeviceGetHandleByUUID(_uuid_, &device) + check_status(__status__) + return device + + +cpdef intptr_t device_get_handle_by_pci_bus_id_v2(pci_bus_id) except? 0: + """Acquire the handle for a particular device, based on its PCI bus id. + + Args: + pci_bus_id (str): The PCI bus id of the target GPU Accept the following formats (all numbers in hexadecimal): domain:bus:device.function in format x:x:x.x domain:bus:device in format x:x:x bus:device.function in format x:x.x. + + Returns: + intptr_t: Reference in which to return the device handle. + + .. seealso:: `nvmlDeviceGetHandleByPciBusId_v2` + """ + if not isinstance(pci_bus_id, str): + raise TypeError("pci_bus_id must be a Python str") + cdef bytes _temp_pci_bus_id_ = (pci_bus_id).encode() + cdef char* _pci_bus_id_ = _temp_pci_bus_id_ + cdef Device device + with nogil: + __status__ = nvmlDeviceGetHandleByPciBusId_v2(_pci_bus_id_, &device) + check_status(__status__) + return device + + +cpdef str device_get_name(intptr_t device): + """Retrieves the name of this device. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + char: Reference in which to return the product name. + + .. seealso:: `nvmlDeviceGetName` + """ + cdef unsigned int length = 96 + cdef char[96] name + with nogil: + __status__ = nvmlDeviceGetName(device, name, length) + check_status(__status__) + return _cyb_cpython.PyUnicode_FromString(name) + + +cpdef int device_get_brand(intptr_t device) except? -1: + """Retrieves the brand of this device. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + int: Reference in which to return the product brand type. + + .. seealso:: `nvmlDeviceGetBrand` + """ + cdef _BrandType type + with nogil: + __status__ = nvmlDeviceGetBrand(device, &type) + check_status(__status__) + return type + + +cpdef unsigned int device_get_index(intptr_t device) except? 0: + """Retrieves the NVML index of this device. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + unsigned int: Reference in which to return the NVML index of the device. + + .. seealso:: `nvmlDeviceGetIndex` + """ + cdef unsigned int index + with nogil: + __status__ = nvmlDeviceGetIndex(device, &index) + check_status(__status__) + return index + + +cpdef str device_get_serial(intptr_t device): + """Retrieves the globally unique board serial number associated with this device's board. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + char: Reference in which to return the board/module serial number. + + .. seealso:: `nvmlDeviceGetSerial` + """ + cdef unsigned int length = 30 + cdef char[30] serial + with nogil: + __status__ = nvmlDeviceGetSerial(device, serial, length) + check_status(__status__) + return _cyb_cpython.PyUnicode_FromString(serial) + + +cpdef unsigned int device_get_module_id(intptr_t device) except? 0: + """Get a unique identifier for the device module on the baseboard. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + unsigned int: Unique identifier for the GPU module. + + .. seealso:: `nvmlDeviceGetModuleId` + """ + cdef unsigned int module_id + with nogil: + __status__ = nvmlDeviceGetModuleId(device, &module_id) + check_status(__status__) + return module_id + + +cpdef object device_get_c2c_mode_info_v(intptr_t device): + """Retrieves the Device's C2C Mode information. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + nvmlC2cModeInfo_v1_t: Output struct containing the device's C2C Mode info. + + .. seealso:: `nvmlDeviceGetC2cModeInfoV` + """ + cdef C2cModeInfo_v1 c2c_mode_info_py = C2cModeInfo_v1() + cdef nvmlC2cModeInfo_v1_t *c2c_mode_info = (c2c_mode_info_py._get_ptr()) + with nogil: + __status__ = nvmlDeviceGetC2cModeInfoV(device, c2c_mode_info) + check_status(__status__) + return c2c_mode_info_py + + +cpdef object device_get_memory_affinity(intptr_t device, unsigned int node_set_size, unsigned int scope): + """Retrieves an array of unsigned ints (sized to node_set_size) of bitmasks with the ideal memory affinity within node or socket for the device. For example, if NUMA node 0, 1 are ideal within the socket for the device and node_set_size == 1, result[0] = 0x3. + + Args: + device (intptr_t): The identifier of the target device. + node_set_size (unsigned int): The size of the node_set array that is safe to access. + scope (unsigned int): Scope that change the default behavior. + + Returns: + unsigned long: Array reference in which to return a bitmask of NODEs, 64 NODEs per unsigned long on 64-bit machines, 32 on 32-bit machines. + + .. seealso:: `nvmlDeviceGetMemoryAffinity` + """ + if node_set_size == 0: + return _cyb_view.array(shape=(1,), itemsize=sizeof(unsigned long), format="L", mode="c")[:0] + cdef _cyb_view.array node_set = _cyb_view.array(shape=(node_set_size,), itemsize=sizeof(unsigned long), format="L", mode="c") + cdef unsigned long *node_set_ptr = (node_set.data) + with nogil: + __status__ = nvmlDeviceGetMemoryAffinity(device, node_set_size, node_set_ptr, scope) + check_status(__status__) + return node_set + + +cpdef object device_get_cpu_affinity_within_scope(intptr_t device, unsigned int cpu_set_size, unsigned int scope): + """Retrieves an array of unsigned ints (sized to cpu_set_size) of bitmasks with the ideal CPU affinity within node or socket for the device. For example, if processors 0, 1, 32, and 33 are ideal for the device and cpu_set_size == 2, result[0] = 0x3, result[1] = 0x3. + + Args: + device (intptr_t): The identifier of the target device. + cpu_set_size (unsigned int): The size of the cpu_set array that is safe to access. + scope (unsigned int): Scope that change the default behavior. + + Returns: + unsigned long: Array reference in which to return a bitmask of CPUs, 64 CPUs per unsigned long on 64-bit machines, 32 on 32-bit machines. + + .. seealso:: `nvmlDeviceGetCpuAffinityWithinScope` + """ + if cpu_set_size == 0: + return _cyb_view.array(shape=(1,), itemsize=sizeof(unsigned long), format="L", mode="c")[:0] + cdef _cyb_view.array cpu_set = _cyb_view.array(shape=(cpu_set_size,), itemsize=sizeof(unsigned long), format="L", mode="c") + cdef unsigned long *cpu_set_ptr = (cpu_set.data) + with nogil: + __status__ = nvmlDeviceGetCpuAffinityWithinScope(device, cpu_set_size, cpu_set_ptr, scope) + check_status(__status__) + return cpu_set + + +cpdef object device_get_cpu_affinity(intptr_t device, unsigned int cpu_set_size): + """Retrieves an array of unsigned ints (sized to cpu_set_size) of bitmasks with the ideal CPU affinity for the device For example, if processors 0, 1, 32, and 33 are ideal for the device and cpu_set_size == 2, result[0] = 0x3, result[1] = 0x3 This is equivalent to calling ``nvmlDeviceGetCpuAffinityWithinScope`` with ``NVML_AFFINITY_SCOPE_NODE``. + + Args: + device (intptr_t): The identifier of the target device. + cpu_set_size (unsigned int): The size of the cpu_set array that is safe to access. + + Returns: + unsigned long: Array reference in which to return a bitmask of CPUs, 64 CPUs per unsigned long on 64-bit machines, 32 on 32-bit machines. + + .. seealso:: `nvmlDeviceGetCpuAffinity` + """ + if cpu_set_size == 0: + return _cyb_view.array(shape=(1,), itemsize=sizeof(unsigned long), format="L", mode="c")[:0] + cdef _cyb_view.array cpu_set = _cyb_view.array(shape=(cpu_set_size,), itemsize=sizeof(unsigned long), format="L", mode="c") + cdef unsigned long *cpu_set_ptr = (cpu_set.data) + with nogil: + __status__ = nvmlDeviceGetCpuAffinity(device, cpu_set_size, cpu_set_ptr) + check_status(__status__) + return cpu_set + + +cpdef device_set_cpu_affinity(intptr_t device): + """Sets the ideal affinity for the calling thread and device using the guidelines given in :func:`device_get_cpu_affinity`. Note, this is a change as of version 8.0. Older versions set the affinity for a calling process and all children. Currently supports up to 1024 processors. + + Args: + device (intptr_t): The identifier of the target device. + + .. seealso:: `nvmlDeviceSetCpuAffinity` + """ + with nogil: + __status__ = nvmlDeviceSetCpuAffinity(device) + check_status(__status__) + + +cpdef device_clear_cpu_affinity(intptr_t device): + """Clear all affinity bindings for the calling thread. Note, this is a change as of version 8.0 as older versions cleared the affinity for a calling process and all children. + + Args: + device (intptr_t): The identifier of the target device. + + .. seealso:: `nvmlDeviceClearCpuAffinity` + """ + with nogil: + __status__ = nvmlDeviceClearCpuAffinity(device) + check_status(__status__) + + +cpdef unsigned int device_get_numa_node_id(intptr_t device) except? 0: + """Get the NUMA node of the given GPU device. This only applies to platforms where the GPUs are NUMA nodes. + + Args: + device (intptr_t): The device handle. + + Returns: + unsigned int: NUMA node ID of the device. + + .. seealso:: `nvmlDeviceGetNumaNodeId` + """ + cdef unsigned int node + with nogil: + __status__ = nvmlDeviceGetNumaNodeId(device, &node) + check_status(__status__) + return node + + +cpdef int device_get_topology_common_ancestor(intptr_t device1, intptr_t device2) except? -1: + """Retrieve the common ancestor for two devices For all products. Supported on Linux only. + + Args: + device1 (intptr_t): The identifier of the first device. + device2 (intptr_t): The identifier of the second device. + + Returns: + int: A ``nvmlGpuTopologyLevel_t`` that gives the path type. + + .. seealso:: `nvmlDeviceGetTopologyCommonAncestor` + """ + cdef _GpuTopologyLevel path_info + with nogil: + __status__ = nvmlDeviceGetTopologyCommonAncestor(device1, device2, &path_info) + check_status(__status__) + return path_info + + +cpdef int device_get_p2p_status(intptr_t device1, intptr_t device2, int p2p_index) except? -1: + """Retrieve the status for a given p2p capability index between a given pair of GPU. + + Args: + device1 (intptr_t): The first device. + device2 (intptr_t): The second device. + p2p_index (GpuP2PCapsIndex): p2p Capability Index being looked for between ``device1`` and ``device2``. + + Returns: + int: Reference in which to return the status of the ``p2p_index`` between ``device1`` and ``device2``. + + .. seealso:: `nvmlDeviceGetP2PStatus` + """ + cdef _GpuP2PStatus p2p_status + with nogil: + __status__ = nvmlDeviceGetP2PStatus(device1, device2, <_GpuP2PCapsIndex>p2p_index, &p2p_status) + check_status(__status__) + return p2p_status + + +cpdef str device_get_uuid(intptr_t device): + """Retrieves the globally unique immutable UUID associated with this device, as a 5 part hexadecimal string, that augments the immutable, board serial identifier. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + char: Reference in which to return the GPU UUID. + + .. seealso:: `nvmlDeviceGetUUID` + """ + cdef unsigned int length = 96 + cdef char[96] uuid + with nogil: + __status__ = nvmlDeviceGetUUID(device, uuid, length) + check_status(__status__) + return _cyb_cpython.PyUnicode_FromString(uuid) + + +cpdef unsigned int device_get_minor_number(intptr_t device) except? 0: + """Retrieves minor number for the device. The minor number for the device is such that the Nvidia device node file for each GPU will have the form /dev/nvidia[minor number]. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + unsigned int: Reference in which to return the minor number for the device. + + .. seealso:: `nvmlDeviceGetMinorNumber` + """ + cdef unsigned int minor_number + with nogil: + __status__ = nvmlDeviceGetMinorNumber(device, &minor_number) + check_status(__status__) + return minor_number + + +cpdef str device_get_board_part_number(intptr_t device): + """Retrieves the the device board part number which is programmed into the board's InfoROM. + + Args: + device (intptr_t): Identifier of the target device. + + Returns: + char: Reference to the buffer to return. + + .. seealso:: `nvmlDeviceGetBoardPartNumber` + """ + cdef unsigned int length = 80 + cdef char[80] part_number + with nogil: + __status__ = nvmlDeviceGetBoardPartNumber(device, part_number, length) + check_status(__status__) + return _cyb_cpython.PyUnicode_FromString(part_number) + + +cpdef str device_get_inforom_version(intptr_t device, int object): + """Retrieves the version information for the device's infoROM object. + + Args: + device (intptr_t): The identifier of the target device. + object (InforomObject): The target infoROM object. + + Returns: + char: Reference in which to return the infoROM version. + + .. seealso:: `nvmlDeviceGetInforomVersion` + """ + cdef unsigned int length = 16 + cdef char[16] version + with nogil: + __status__ = nvmlDeviceGetInforomVersion(device, <_InforomObject>object, version, length) + check_status(__status__) + return _cyb_cpython.PyUnicode_FromString(version) + + +cpdef str device_get_inforom_image_version(intptr_t device): + """Retrieves the global infoROM image version. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + char: Reference in which to return the infoROM image version. + + .. seealso:: `nvmlDeviceGetInforomImageVersion` + """ + cdef unsigned int length = 16 + cdef char[16] version + with nogil: + __status__ = nvmlDeviceGetInforomImageVersion(device, version, length) + check_status(__status__) + return _cyb_cpython.PyUnicode_FromString(version) + + +cpdef unsigned int device_get_inforom_configuration_checksum(intptr_t device) except? 0: + """Retrieves the checksum of the configuration stored in the device's infoROM. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + unsigned int: Reference in which to return the infoROM configuration checksum. + + .. seealso:: `nvmlDeviceGetInforomConfigurationChecksum` + """ + cdef unsigned int checksum + with nogil: + __status__ = nvmlDeviceGetInforomConfigurationChecksum(device, &checksum) + check_status(__status__) + return checksum + + +cpdef device_validate_inforom(intptr_t device): + """Reads the infoROM from the flash and verifies the checksums. + + Args: + device (intptr_t): The identifier of the target device. + + .. seealso:: `nvmlDeviceValidateInforom` + """ + with nogil: + __status__ = nvmlDeviceValidateInforom(device) + check_status(__status__) + + +cpdef tuple device_get_last_bbx_flush_time(intptr_t device): + """Retrieves the timestamp and the duration of the last flush of the BBX (blackbox) infoROM object during the current run. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + A 2-tuple containing: + + - unsigned long long: The start timestamp of the last BBX Flush. + - unsigned long: The duration (us) of the last BBX Flush. + + .. seealso:: `nvmlDeviceGetLastBBXFlushTime` + """ + cdef unsigned long long timestamp + cdef unsigned long duration_us + with nogil: + __status__ = nvmlDeviceGetLastBBXFlushTime(device, ×tamp, &duration_us) + check_status(__status__) + return (timestamp, duration_us) + + +cpdef int device_get_display_mode(intptr_t device) except? -1: + """Retrieves the display mode for the device. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + int: Reference in which to return the display mode. + + .. seealso:: `nvmlDeviceGetDisplayMode` + """ + cdef _EnableState display + with nogil: + __status__ = nvmlDeviceGetDisplayMode(device, &display) + check_status(__status__) + return display + + +cpdef int device_get_display_active(intptr_t device) except? -1: + """Retrieves the display active state for the device. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + int: Reference in which to return the display active state. + + .. seealso:: `nvmlDeviceGetDisplayActive` + """ + cdef _EnableState is_active + with nogil: + __status__ = nvmlDeviceGetDisplayActive(device, &is_active) + check_status(__status__) + return is_active + + +cpdef int device_get_persistence_mode(intptr_t device) except? -1: + """Retrieves the persistence mode associated with this device. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + int: Reference in which to return the current driver persistence mode. + + .. seealso:: `nvmlDeviceGetPersistenceMode` + """ + cdef _EnableState mode + with nogil: + __status__ = nvmlDeviceGetPersistenceMode(device, &mode) + check_status(__status__) + return mode + + +cpdef object device_get_pci_info_ext(intptr_t device): + """Retrieves PCI attributes of this device. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + nvmlPciInfoExt_v1_t: Reference in which to return the PCI info. + + .. seealso:: `nvmlDeviceGetPciInfoExt` + """ + cdef PciInfoExt_v1 pci_py = PciInfoExt_v1() + cdef nvmlPciInfoExt_t *pci = (pci_py._get_ptr()) + pci.version = NVML_VERSION_STRUCT(sizeof(nvmlPciInfoExt_v1_t), 1) + with nogil: + __status__ = nvmlDeviceGetPciInfoExt(device, pci) + check_status(__status__) + return pci_py + + +cpdef object device_get_pci_info_v3(intptr_t device): + """Retrieves the PCI attributes of this device. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + nvmlPciInfo_t: Reference in which to return the PCI info. + + .. seealso:: `nvmlDeviceGetPciInfo_v3` + """ + cdef PciInfo pci_py = PciInfo() + cdef nvmlPciInfo_t *pci = (pci_py._get_ptr()) + with nogil: + __status__ = nvmlDeviceGetPciInfo_v3(device, pci) + check_status(__status__) + return pci_py + + +cpdef unsigned int device_get_max_pcie_link_generation(intptr_t device) except? 0: + """Retrieves the maximum PCIe link generation possible with this device and system. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + unsigned int: Reference in which to return the max PCIe link generation. + + .. seealso:: `nvmlDeviceGetMaxPcieLinkGeneration` + """ + cdef unsigned int max_link_gen + with nogil: + __status__ = nvmlDeviceGetMaxPcieLinkGeneration(device, &max_link_gen) + check_status(__status__) + return max_link_gen + + +cpdef unsigned int device_get_gpu_max_pcie_link_generation(intptr_t device) except? 0: + """Retrieves the maximum PCIe link generation supported by this device. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + unsigned int: Reference in which to return the max PCIe link generation. + + .. seealso:: `nvmlDeviceGetGpuMaxPcieLinkGeneration` + """ + cdef unsigned int max_link_gen_device + with nogil: + __status__ = nvmlDeviceGetGpuMaxPcieLinkGeneration(device, &max_link_gen_device) + check_status(__status__) + return max_link_gen_device + + +cpdef unsigned int device_get_max_pcie_link_width(intptr_t device) except? 0: + """Retrieves the maximum PCIe link width possible with this device and system. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + unsigned int: Reference in which to return the max PCIe link generation. + + .. seealso:: `nvmlDeviceGetMaxPcieLinkWidth` + """ + cdef unsigned int max_link_width + with nogil: + __status__ = nvmlDeviceGetMaxPcieLinkWidth(device, &max_link_width) + check_status(__status__) + return max_link_width + + +cpdef unsigned int device_get_curr_pcie_link_generation(intptr_t device) except? 0: + """Retrieves the current PCIe link generation. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + unsigned int: Reference in which to return the current PCIe link generation. + + .. seealso:: `nvmlDeviceGetCurrPcieLinkGeneration` + """ + cdef unsigned int curr_link_gen + with nogil: + __status__ = nvmlDeviceGetCurrPcieLinkGeneration(device, &curr_link_gen) + check_status(__status__) + return curr_link_gen + + +cpdef unsigned int device_get_curr_pcie_link_width(intptr_t device) except? 0: + """Retrieves the current PCIe link width. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + unsigned int: Reference in which to return the current PCIe link generation. + + .. seealso:: `nvmlDeviceGetCurrPcieLinkWidth` + """ + cdef unsigned int curr_link_width + with nogil: + __status__ = nvmlDeviceGetCurrPcieLinkWidth(device, &curr_link_width) + check_status(__status__) + return curr_link_width + + +cpdef unsigned int device_get_pcie_throughput(intptr_t device, int counter) except? 0: + """Retrieve PCIe utilization information. This function is querying a byte counter over a 20ms interval and thus is the PCIe throughput over that interval. + + Args: + device (intptr_t): The identifier of the target device. + counter (PcieUtilCounter): The specific counter that should be queried ``nvmlPcieUtilCounter_t``. + + Returns: + unsigned int: Reference in which to return throughput in KB/s. + + .. seealso:: `nvmlDeviceGetPcieThroughput` + """ + cdef unsigned int value + with nogil: + __status__ = nvmlDeviceGetPcieThroughput(device, <_PcieUtilCounter>counter, &value) + check_status(__status__) + return value + + +cpdef unsigned int device_get_pcie_replay_counter(intptr_t device) except? 0: + """Retrieve the PCIe replay counter. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + unsigned int: Reference in which to return the counter's value. + + .. seealso:: `nvmlDeviceGetPcieReplayCounter` + """ + cdef unsigned int value + with nogil: + __status__ = nvmlDeviceGetPcieReplayCounter(device, &value) + check_status(__status__) + return value + + +cpdef unsigned int device_get_clock_info(intptr_t device, int type) except? 0: + """Retrieves the current clock speeds for the device. + + Args: + device (intptr_t): The identifier of the target device. + type (ClockType): Identify which clock domain to query. + + Returns: + unsigned int: Reference in which to return the clock speed in MHz. + + .. seealso:: `nvmlDeviceGetClockInfo` + """ + cdef unsigned int clock + with nogil: + __status__ = nvmlDeviceGetClockInfo(device, <_ClockType>type, &clock) + check_status(__status__) + return clock + + +cpdef unsigned int device_get_max_clock_info(intptr_t device, int type) except? 0: + """Retrieves the maximum clock speeds for the device. + + Args: + device (intptr_t): The identifier of the target device. + type (ClockType): Identify which clock domain to query. + + Returns: + unsigned int: Reference in which to return the clock speed in MHz. + + .. seealso:: `nvmlDeviceGetMaxClockInfo` + """ + cdef unsigned int clock + with nogil: + __status__ = nvmlDeviceGetMaxClockInfo(device, <_ClockType>type, &clock) + check_status(__status__) + return clock + + +cpdef int device_get_gpc_clk_vf_offset(intptr_t device) except? 0: + """Retrieve the GPCCLK VF offset value. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + int: The retrieved GPCCLK VF offset value. + + .. seealso:: `nvmlDeviceGetGpcClkVfOffset` + """ + cdef int offset + with nogil: + __status__ = nvmlDeviceGetGpcClkVfOffset(device, &offset) + check_status(__status__) + return offset + + +cpdef unsigned int device_get_clock(intptr_t device, int clock_type, int clock_id) except? 0: + """Retrieves the clock speed for the clock specified by the clock type and clock ID. + + Args: + device (intptr_t): The identifier of the target device. + clock_type (ClockType): Identify which clock domain to query. + clock_id (ClockId): Identify which clock in the domain to query. + + Returns: + unsigned int: Reference in which to return the clock in MHz. + + .. seealso:: `nvmlDeviceGetClock` + """ + cdef unsigned int clock_m_hz + with nogil: + __status__ = nvmlDeviceGetClock(device, <_ClockType>clock_type, <_ClockId>clock_id, &clock_m_hz) + check_status(__status__) + return clock_m_hz + + +cpdef unsigned int device_get_max_customer_boost_clock(intptr_t device, int clock_type) except? 0: + """Retrieves the customer defined maximum boost clock speed specified by the given clock type. + + Args: + device (intptr_t): The identifier of the target device. + clock_type (ClockType): Identify which clock domain to query. + + Returns: + unsigned int: Reference in which to return the clock in MHz. + + .. seealso:: `nvmlDeviceGetMaxCustomerBoostClock` + """ + cdef unsigned int clock_m_hz + with nogil: + __status__ = nvmlDeviceGetMaxCustomerBoostClock(device, <_ClockType>clock_type, &clock_m_hz) + check_status(__status__) + return clock_m_hz + + +cpdef object device_get_supported_memory_clocks(intptr_t device): + """Retrieves the list of possible memory clocks that can be used as an argument for ``nvmlDeviceSetMemoryLockedClocks``. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + unsigned int: Reference in which to return the clock in MHz. + + .. seealso:: `nvmlDeviceGetSupportedMemoryClocks` + """ + cdef unsigned int[1] count = [0] + with nogil: + __status__ = nvmlDeviceGetSupportedMemoryClocks(device, count, NULL) + check_status_size(__status__) + if count[0] == 0: + return _cyb_view.array(shape=(1,), itemsize=sizeof(unsigned int), format="I", mode="c")[:0] + cdef _cyb_view.array clocks_m_hz = _cyb_view.array(shape=(count[0],), itemsize=sizeof(unsigned int), format="I", mode="c") + cdef unsigned int *clocks_m_hz_ptr = (clocks_m_hz.data) + with nogil: + __status__ = nvmlDeviceGetSupportedMemoryClocks(device, count, clocks_m_hz_ptr) + check_status(__status__) + return clocks_m_hz + + +cpdef object device_get_supported_graphics_clocks(intptr_t device, unsigned int memory_clock_m_hz): + """Retrieves the list of possible graphics clocks that can be used as an argument for ``nvmlDeviceSetGpuLockedClocks``. + + Args: + device (intptr_t): The identifier of the target device. + memory_clock_m_hz (unsigned int): Memory clock for which to return possible graphics clocks. + + Returns: + unsigned int: Reference in which to return the clocks in MHz. + + .. seealso:: `nvmlDeviceGetSupportedGraphicsClocks` + """ + cdef unsigned int[1] count = [0] + with nogil: + __status__ = nvmlDeviceGetSupportedGraphicsClocks(device, memory_clock_m_hz, count, NULL) + check_status_size(__status__) + if count[0] == 0: + return _cyb_view.array(shape=(1,), itemsize=sizeof(unsigned int), format="I", mode="c")[:0] + cdef _cyb_view.array clocks_m_hz = _cyb_view.array(shape=(count[0],), itemsize=sizeof(unsigned int), format="I", mode="c") + cdef unsigned int *clocks_m_hz_ptr = (clocks_m_hz.data) + with nogil: + __status__ = nvmlDeviceGetSupportedGraphicsClocks(device, memory_clock_m_hz, count, clocks_m_hz_ptr) + check_status(__status__) + return clocks_m_hz + + +cpdef tuple device_get_auto_boosted_clocks_enabled(intptr_t device): + """Retrieve the current state of Auto Boosted clocks on a device and store it in ``is_enabled``. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + A 2-tuple containing: + + - int: Where to store the current state of Auto Boosted clocks of the target device. + - int: Where to store the default Auto Boosted clocks behavior of the target device that the device will revert to when no applications are using the GPU. + + .. seealso:: `nvmlDeviceGetAutoBoostedClocksEnabled` + """ + cdef _EnableState is_enabled + cdef _EnableState default_is_enabled + with nogil: + __status__ = nvmlDeviceGetAutoBoostedClocksEnabled(device, &is_enabled, &default_is_enabled) + check_status(__status__) + return (is_enabled, default_is_enabled) + + +cpdef unsigned int device_get_fan_speed(intptr_t device) except? 0: + """Retrieves the intended operating speed of the device's fan. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + unsigned int: Reference in which to return the fan speed percentage. + + .. seealso:: `nvmlDeviceGetFanSpeed` + """ + cdef unsigned int speed + with nogil: + __status__ = nvmlDeviceGetFanSpeed(device, &speed) + check_status(__status__) + return speed + + +cpdef unsigned int device_get_fan_speed_v2(intptr_t device, unsigned int fan) except? 0: + """Retrieves the intended operating speed of the device's specified fan. + + Args: + device (intptr_t): The identifier of the target device. + fan (unsigned int): The index of the target fan, zero indexed. + + Returns: + unsigned int: Reference in which to return the fan speed percentage. + + .. seealso:: `nvmlDeviceGetFanSpeed_v2` + """ + cdef unsigned int speed + with nogil: + __status__ = nvmlDeviceGetFanSpeed_v2(device, fan, &speed) + check_status(__status__) + return speed + + +cpdef unsigned int device_get_target_fan_speed(intptr_t device, unsigned int fan) except? 0: + """Retrieves the intended target speed of the device's specified fan. + + Args: + device (intptr_t): The identifier of the target device. + fan (unsigned int): The index of the target fan, zero indexed. + + Returns: + unsigned int: Reference in which to return the fan speed percentage. + + .. seealso:: `nvmlDeviceGetTargetFanSpeed` + """ + cdef unsigned int target_speed + with nogil: + __status__ = nvmlDeviceGetTargetFanSpeed(device, fan, &target_speed) + check_status(__status__) + return target_speed + + +cpdef tuple device_get_min_max_fan_speed(intptr_t device): + """Retrieves the min and max fan speed that user can set for the GPU fan. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + A 2-tuple containing: + + - unsigned int: The minimum speed allowed to set. + - unsigned int: The maximum speed allowed to set. + + .. seealso:: `nvmlDeviceGetMinMaxFanSpeed` + """ + cdef unsigned int min_speed + cdef unsigned int max_speed + with nogil: + __status__ = nvmlDeviceGetMinMaxFanSpeed(device, &min_speed, &max_speed) + check_status(__status__) + return (min_speed, max_speed) + + +cpdef unsigned int device_get_fan_control_policy_v2(intptr_t device, unsigned int fan) except *: + """Gets current fan control policy. + + Args: + device (intptr_t): The identifier of the target ``device``. + fan (unsigned int): The index of the target fan, zero indexed. + + Returns: + unsigned int: Reference in which to return the fan control ``policy``. + + .. seealso:: `nvmlDeviceGetFanControlPolicy_v2` + """ + cdef nvmlFanControlPolicy_t policy + with nogil: + __status__ = nvmlDeviceGetFanControlPolicy_v2(device, fan, &policy) + check_status(__status__) + return policy + + +cpdef unsigned int device_get_num_fans(intptr_t device) except? 0: + """Retrieves the number of fans on the device. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + unsigned int: The number of fans. + + .. seealso:: `nvmlDeviceGetNumFans` + """ + cdef unsigned int num_fans + with nogil: + __status__ = nvmlDeviceGetNumFans(device, &num_fans) + check_status(__status__) + return num_fans + + +cpdef object device_get_cooler_info(intptr_t device): + """Retrieves the cooler's information. Returns a cooler's control signal characteristics. The possible types are restricted, Variable and Toggle. See ``nvmlCoolerControl_t`` for details on available signal types. Returns objects that cooler cools. Targets may be GPU, Memory, Power Supply or All of these. See ``nvmlCoolerTarget_t`` for details on available targets. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + nvmlCoolerInfo_v1_t: Structure specifying the cooler's control signal characteristics (out) and the target that cooler cools (out). + + .. seealso:: `nvmlDeviceGetCoolerInfo` + """ + cdef CoolerInfo_v1 cooler_info_py = CoolerInfo_v1() + cdef nvmlCoolerInfo_t *cooler_info = (cooler_info_py._get_ptr()) + cooler_info.version = NVML_VERSION_STRUCT(sizeof(nvmlCoolerInfo_v1_t), 1) + with nogil: + __status__ = nvmlDeviceGetCoolerInfo(device, cooler_info) + check_status(__status__) + return cooler_info_py + + +cpdef unsigned int device_get_temperature_threshold(intptr_t device, int threshold_type) except? 0: + """Retrieves the temperature threshold for the GPU with the specified threshold type in degrees C. + + Args: + device (intptr_t): The identifier of the target device. + threshold_type (TemperatureThresholds): The type of threshold value queried. + + Returns: + unsigned int: Reference in which to return the temperature reading. + + .. seealso:: `nvmlDeviceGetTemperatureThreshold` + """ + cdef unsigned int temp + with nogil: + __status__ = nvmlDeviceGetTemperatureThreshold(device, <_TemperatureThresholds>threshold_type, &temp) + check_status(__status__) + return temp + + +cpdef object device_get_thermal_settings(intptr_t device, unsigned int sensor_index): + """Used to execute a list of thermal system instructions. + + Args: + device (intptr_t): The identifier of the target device. + sensor_index (unsigned int): The index of the thermal sensor. + + Returns: + nvmlGpuThermalSettings_t: Reference in which to return the thermal sensor information. + + .. seealso:: `nvmlDeviceGetThermalSettings` + """ + cdef GpuThermalSettings p_thermal_settings_py = GpuThermalSettings() + cdef nvmlGpuThermalSettings_t *p_thermal_settings = (p_thermal_settings_py._get_ptr()) + with nogil: + __status__ = nvmlDeviceGetThermalSettings(device, sensor_index, p_thermal_settings) + check_status(__status__) + return p_thermal_settings_py + + +cpdef int device_get_performance_state(intptr_t device) except? -1: + """Retrieves the current performance state for the device. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + int: Reference in which to return the performance state reading. + + .. seealso:: `nvmlDeviceGetPerformanceState` + """ + cdef _Pstates p_state + with nogil: + __status__ = nvmlDeviceGetPerformanceState(device, &p_state) + check_status(__status__) + return p_state + + +cpdef unsigned long long device_get_current_clocks_event_reasons(intptr_t device) except? 0: + """Retrieves current clocks event reasons. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + unsigned long long: Reference in which to return bitmask of active clocks event reasons. + + .. seealso:: `nvmlDeviceGetCurrentClocksEventReasons` + """ + cdef unsigned long long clocks_event_reasons + with nogil: + __status__ = nvmlDeviceGetCurrentClocksEventReasons(device, &clocks_event_reasons) + check_status(__status__) + return clocks_event_reasons + + +cpdef unsigned long long device_get_supported_clocks_event_reasons(intptr_t device) except? 0: + """Retrieves bitmask of supported clocks event reasons that can be returned by ``nvmlDeviceGetCurrentClocksEventReasons``. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + unsigned long long: Reference in which to return bitmask of supported clocks event reasons. + + .. seealso:: `nvmlDeviceGetSupportedClocksEventReasons` + """ + cdef unsigned long long supported_clocks_event_reasons + with nogil: + __status__ = nvmlDeviceGetSupportedClocksEventReasons(device, &supported_clocks_event_reasons) + check_status(__status__) + return supported_clocks_event_reasons + + +cpdef int device_get_power_state(intptr_t device) except? -1: + """Deprecated: Use ``nvmlDeviceGetPerformanceState``. This function exposes an incorrect generalization. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + int: Reference in which to return the performance state reading. + + .. seealso:: `nvmlDeviceGetPowerState` + """ + cdef _Pstates p_state + with nogil: + __status__ = nvmlDeviceGetPowerState(device, &p_state) + check_status(__status__) + return p_state + + +cpdef object device_get_dynamic_pstates_info(intptr_t device): + """Retrieve performance monitor samples from the associated subdevice. + + Args: + device (intptr_t): . + + Returns: + nvmlGpuDynamicPstatesInfo_t: . + + .. seealso:: `nvmlDeviceGetDynamicPstatesInfo` + """ + cdef GpuDynamicPstatesInfo p_dynamic_pstates_info_py = GpuDynamicPstatesInfo() + cdef nvmlGpuDynamicPstatesInfo_t *p_dynamic_pstates_info = (p_dynamic_pstates_info_py._get_ptr()) + with nogil: + __status__ = nvmlDeviceGetDynamicPstatesInfo(device, p_dynamic_pstates_info) + check_status(__status__) + return p_dynamic_pstates_info_py + + +cpdef int device_get_mem_clk_vf_offset(intptr_t device) except? 0: + """Retrieve the MemClk (Memory Clock) VF offset value. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + int: The retrieved MemClk VF offset value. + + .. seealso:: `nvmlDeviceGetMemClkVfOffset` + """ + cdef int offset + with nogil: + __status__ = nvmlDeviceGetMemClkVfOffset(device, &offset) + check_status(__status__) + return offset + + +cpdef tuple device_get_min_max_clock_of_p_state(intptr_t device, int type, int pstate): + """Retrieve min and max clocks of some clock domain for a given PState. + + Args: + device (intptr_t): The identifier of the target device. + type (ClockType): Clock domain. + pstate (Pstates): PState to query. + + Returns: + A 2-tuple containing: + + - unsigned int: Reference in which to return min clock frequency. + - unsigned int: Reference in which to return max clock frequency. + + .. seealso:: `nvmlDeviceGetMinMaxClockOfPState` + """ + cdef unsigned int min_clock_m_hz + cdef unsigned int max_clock_m_hz + with nogil: + __status__ = nvmlDeviceGetMinMaxClockOfPState(device, <_ClockType>type, <_Pstates>pstate, &min_clock_m_hz, &max_clock_m_hz) + check_status(__status__) + return (min_clock_m_hz, max_clock_m_hz) + + +cpdef tuple device_get_gpc_clk_min_max_vf_offset(intptr_t device): + """Retrieve the GPCCLK min max VF offset value. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + A 2-tuple containing: + + - int: The retrieved GPCCLK VF min offset value. + - int: The retrieved GPCCLK VF max offset value. + + .. seealso:: `nvmlDeviceGetGpcClkMinMaxVfOffset` + """ + cdef int min_offset + cdef int max_offset + with nogil: + __status__ = nvmlDeviceGetGpcClkMinMaxVfOffset(device, &min_offset, &max_offset) + check_status(__status__) + return (min_offset, max_offset) + + +cpdef tuple device_get_mem_clk_min_max_vf_offset(intptr_t device): + """Retrieve the MemClk (Memory Clock) min max VF offset value. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + A 2-tuple containing: + + - int: The retrieved MemClk VF min offset value. + - int: The retrieved MemClk VF max offset value. + + .. seealso:: `nvmlDeviceGetMemClkMinMaxVfOffset` + """ + cdef int min_offset + cdef int max_offset + with nogil: + __status__ = nvmlDeviceGetMemClkMinMaxVfOffset(device, &min_offset, &max_offset) + check_status(__status__) + return (min_offset, max_offset) + + +cpdef device_set_clock_offsets(intptr_t device, intptr_t info): + """Control current clock offset of some clock domain for a given PState. + + Args: + device (intptr_t): The identifier of the target device. + info (intptr_t): Structure specifying the clock type (input), the pstate (input) and clock offset value (input). + + .. seealso:: `nvmlDeviceSetClockOffsets` + """ + with nogil: + __status__ = nvmlDeviceSetClockOffsets(device, info) + check_status(__status__) + + +cpdef unsigned int device_get_power_management_limit(intptr_t device) except? 0: + """Retrieves the power management limit associated with this device. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + unsigned int: Reference in which to return the power management limit in milliwatts. + + .. seealso:: `nvmlDeviceGetPowerManagementLimit` + """ + cdef unsigned int limit + with nogil: + __status__ = nvmlDeviceGetPowerManagementLimit(device, &limit) + check_status(__status__) + return limit + + +cpdef tuple device_get_power_management_limit_constraints(intptr_t device): + """Retrieves information about possible values of power management limits on this device. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + A 2-tuple containing: + + - unsigned int: Reference in which to return the minimum power management limit in milliwatts. + - unsigned int: Reference in which to return the maximum power management limit in milliwatts. + + .. seealso:: `nvmlDeviceGetPowerManagementLimitConstraints` + """ + cdef unsigned int min_limit + cdef unsigned int max_limit + with nogil: + __status__ = nvmlDeviceGetPowerManagementLimitConstraints(device, &min_limit, &max_limit) + check_status(__status__) + return (min_limit, max_limit) + + +cpdef unsigned int device_get_power_management_default_limit(intptr_t device) except? 0: + """Retrieves default power management limit on this device, in milliwatts. Default power management limit is a power management limit that the device boots with. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + unsigned int: Reference in which to return the default power management limit in milliwatts. + + .. seealso:: `nvmlDeviceGetPowerManagementDefaultLimit` + """ + cdef unsigned int default_limit + with nogil: + __status__ = nvmlDeviceGetPowerManagementDefaultLimit(device, &default_limit) + check_status(__status__) + return default_limit + + +cpdef unsigned int device_get_power_usage(intptr_t device) except? 0: + """Retrieves power usage for this GPU in milliwatts and its associated circuitry (e.g. memory). + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + unsigned int: Reference in which to return the power usage information. + + .. seealso:: `nvmlDeviceGetPowerUsage` + """ + cdef unsigned int power + with nogil: + __status__ = nvmlDeviceGetPowerUsage(device, &power) + check_status(__status__) + return power + + +cpdef unsigned long long device_get_total_energy_consumption(intptr_t device) except? 0: + """Retrieves total energy consumption for this GPU in millijoules (mJ) since the driver was last reloaded. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + unsigned long long: Reference in which to return the energy consumption information. + + .. seealso:: `nvmlDeviceGetTotalEnergyConsumption` + """ + cdef unsigned long long energy + with nogil: + __status__ = nvmlDeviceGetTotalEnergyConsumption(device, &energy) + check_status(__status__) + return energy + + +cpdef unsigned int device_get_enforced_power_limit(intptr_t device) except? 0: + """Get the effective power limit that the driver enforces after taking into account all limiters. + + Args: + device (intptr_t): The device to communicate with. + + Returns: + unsigned int: Reference in which to return the power management limit in milliwatts. + + .. seealso:: `nvmlDeviceGetEnforcedPowerLimit` + """ + cdef unsigned int limit + with nogil: + __status__ = nvmlDeviceGetEnforcedPowerLimit(device, &limit) + check_status(__status__) + return limit + + +cpdef tuple device_get_gpu_operation_mode(intptr_t device): + """Retrieves the current GOM and pending GOM (the one that GPU will switch to after reboot). + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + A 2-tuple containing: + + - int: Reference in which to return the current GOM. + - int: Reference in which to return the pending GOM. + + .. seealso:: `nvmlDeviceGetGpuOperationMode` + """ + cdef _GpuOperationMode current + cdef _GpuOperationMode pending + with nogil: + __status__ = nvmlDeviceGetGpuOperationMode(device, ¤t, &pending) + check_status(__status__) + return (current, pending) + + +cpdef object device_get_memory_info_v2(intptr_t device): + """Retrieves the amount of used, free, reserved and total memory available on the device, in bytes. nvmlDeviceGetMemoryInfo_v2 accounts separately for reserved memory and includes it in the used memory amount. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + nvmlMemory_v2_t: Reference in which to return the memory information. + + .. seealso:: `nvmlDeviceGetMemoryInfo_v2` + """ + cdef Memory_v2 memory_py = Memory_v2() + cdef nvmlMemory_v2_t *memory = (memory_py._get_ptr()) + memory.version = NVML_VERSION_STRUCT(sizeof(nvmlMemory_v2_t), 2) + with nogil: + __status__ = nvmlDeviceGetMemoryInfo_v2(device, memory) + check_status(__status__) + return memory_py + + +cpdef int device_get_compute_mode(intptr_t device) except? -1: + """Retrieves the current compute mode for the device or MIG device. + + Args: + device (intptr_t): The identifier of the target device handle or MIG device handle. + + Returns: + int: Reference in which to return the current compute mode. + + .. seealso:: `nvmlDeviceGetComputeMode` + """ + cdef _ComputeMode mode + with nogil: + __status__ = nvmlDeviceGetComputeMode(device, &mode) + check_status(__status__) + return mode + + +cpdef tuple device_get_cuda_compute_capability(intptr_t device): + """Retrieves the CUDA compute capability of the device. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + A 2-tuple containing: + + - int: Reference in which to return the major CUDA compute capability. + - int: Reference in which to return the minor CUDA compute capability. + + .. seealso:: `nvmlDeviceGetCudaComputeCapability` + """ + cdef int major + cdef int minor + with nogil: + __status__ = nvmlDeviceGetCudaComputeCapability(device, &major, &minor) + check_status(__status__) + return (major, minor) + + +cpdef tuple device_get_ecc_mode(intptr_t device): + """Retrieves the current and pending ECC modes for the device. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + A 2-tuple containing: + + - int: Reference in which to return the current ECC mode. + - int: Reference in which to return the pending ECC mode. + + .. seealso:: `nvmlDeviceGetEccMode` + """ + cdef _EnableState current + cdef _EnableState pending + with nogil: + __status__ = nvmlDeviceGetEccMode(device, ¤t, &pending) + check_status(__status__) + return (current, pending) + + +cpdef int device_get_default_ecc_mode(intptr_t device) except? -1: + """Retrieves the default ECC modes for the device. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + int: Reference in which to return the default ECC mode. + + .. seealso:: `nvmlDeviceGetDefaultEccMode` + """ + cdef _EnableState default_mode + with nogil: + __status__ = nvmlDeviceGetDefaultEccMode(device, &default_mode) + check_status(__status__) + return default_mode + + +cpdef unsigned int device_get_board_id(intptr_t device) except? 0: + """Retrieves the device board_id from 0-N. Devices with the same board_id indicate GPUs connected to the same PLX. Use in conjunction with :func:`device_get_multi_gpu_board` to decide if they are on the same board as well. The board_id returned is a unique ID for the current configuration. Uniqueness and ordering across reboots and system configurations is not guaranteed (i.e. if a Tesla K40c returns 0x100 and the two GPUs on a Tesla K10 in the same system returns 0x200 it is not guaranteed they will always return those values but they will always be different from each other). + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + unsigned int: Reference in which to return the device's board ID. + + .. seealso:: `nvmlDeviceGetBoardId` + """ + cdef unsigned int board_id + with nogil: + __status__ = nvmlDeviceGetBoardId(device, &board_id) + check_status(__status__) + return board_id + + +cpdef unsigned int device_get_multi_gpu_board(intptr_t device) except? 0: + """Retrieves whether the device is on a Multi-GPU Board Devices that are on multi-GPU boards will set ``multi_gpu_bool`` to a non-zero value. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + unsigned int: Reference in which to return a zero or non-zero value to indicate whether the device is on a multi GPU board. + + .. seealso:: `nvmlDeviceGetMultiGpuBoard` + """ + cdef unsigned int multi_gpu_bool + with nogil: + __status__ = nvmlDeviceGetMultiGpuBoard(device, &multi_gpu_bool) + check_status(__status__) + return multi_gpu_bool + + +cpdef unsigned long long device_get_total_ecc_errors(intptr_t device, int error_type, int counter_type) except? 0: + """Retrieves the total ECC error counts for the device. + + Args: + device (intptr_t): The identifier of the target device. + error_type (MemoryErrorType): Flag that specifies the type of the errors. + counter_type (EccCounterType): Flag that specifies the counter-type of the errors. + + Returns: + unsigned long long: Reference in which to return the specified ECC errors. + + .. seealso:: `nvmlDeviceGetTotalEccErrors` + """ + cdef unsigned long long ecc_counts + with nogil: + __status__ = nvmlDeviceGetTotalEccErrors(device, <_MemoryErrorType>error_type, <_EccCounterType>counter_type, &ecc_counts) + check_status(__status__) + return ecc_counts + + +cpdef unsigned long long device_get_memory_error_counter(intptr_t device, int error_type, int counter_type, int location_type) except? 0: + """Retrieves the requested memory error counter for the device. + + Args: + device (intptr_t): The identifier of the target device. + error_type (MemoryErrorType): Flag that specifies the type of error. + counter_type (EccCounterType): Flag that specifies the counter-type of the errors. + location_type (MemoryLocation): Specifies the location of the counter. + + Returns: + unsigned long long: Reference in which to return the ECC counter. + + .. seealso:: `nvmlDeviceGetMemoryErrorCounter` + """ + cdef unsigned long long count + with nogil: + __status__ = nvmlDeviceGetMemoryErrorCounter(device, <_MemoryErrorType>error_type, <_EccCounterType>counter_type, <_MemoryLocation>location_type, &count) + check_status(__status__) + return count + + +cpdef object device_get_utilization_rates(intptr_t device): + """Retrieves the current utilization rates for the device's major subsystems. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + nvmlUtilization_t: Reference in which to return the utilization information. + + .. seealso:: `nvmlDeviceGetUtilizationRates` + """ + cdef Utilization utilization_py = Utilization() + cdef nvmlUtilization_t *utilization = (utilization_py._get_ptr()) + with nogil: + __status__ = nvmlDeviceGetUtilizationRates(device, utilization) + check_status(__status__) + return utilization_py + + +cpdef tuple device_get_encoder_utilization(intptr_t device): + """Retrieves the current utilization and sampling size in microseconds for the Encoder. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + A 2-tuple containing: + + - unsigned int: Reference to an unsigned int for encoder utilization info. + - unsigned int: Reference to an unsigned int for the sampling period in US. + + .. seealso:: `nvmlDeviceGetEncoderUtilization` + """ + cdef unsigned int utilization + cdef unsigned int sampling_period_us + with nogil: + __status__ = nvmlDeviceGetEncoderUtilization(device, &utilization, &sampling_period_us) + check_status(__status__) + return (utilization, sampling_period_us) + + +cpdef unsigned int device_get_encoder_capacity(intptr_t device, int encoder_query_type) except? 0: + """Retrieves the current capacity of the device's encoder, as a percentage of maximum encoder capacity with valid values in the range 0-100. + + Args: + device (intptr_t): The identifier of the target device. + encoder_query_type (EncoderType): Type of encoder to query. + + Returns: + unsigned int: Reference to an unsigned int for the encoder capacity. + + .. seealso:: `nvmlDeviceGetEncoderCapacity` + """ + cdef unsigned int encoder_capacity + with nogil: + __status__ = nvmlDeviceGetEncoderCapacity(device, <_EncoderType>encoder_query_type, &encoder_capacity) + check_status(__status__) + return encoder_capacity + + +cpdef tuple device_get_encoder_stats(intptr_t device): + """Retrieves the current encoder statistics for a given device. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + A 3-tuple containing: + + - unsigned int: Reference to an unsigned int for count of active encoder sessions. + - unsigned int: Reference to an unsigned int for trailing average FPS of all active sessions. + - unsigned int: Reference to an unsigned int for encode latency in microseconds. + + .. seealso:: `nvmlDeviceGetEncoderStats` + """ + cdef unsigned int session_count + cdef unsigned int average_fps + cdef unsigned int average_latency + with nogil: + __status__ = nvmlDeviceGetEncoderStats(device, &session_count, &average_fps, &average_latency) + check_status(__status__) + return (session_count, average_fps, average_latency) + + +cpdef object device_get_encoder_sessions(intptr_t device): + """Retrieves information about active encoder sessions on a target device. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + nvmlEncoderSessionInfo_t: Reference in which to return the session information. + + .. seealso:: `nvmlDeviceGetEncoderSessions` + """ + cdef unsigned int[1] session_count = [0] + with nogil: + __status__ = nvmlDeviceGetEncoderSessions(device, session_count, NULL) + check_status_size(__status__) + cdef EncoderSessionInfo session_infos = EncoderSessionInfo(session_count[0]) + cdef nvmlEncoderSessionInfo_t *session_infos_ptr = (session_infos._get_ptr()) + if session_count[0] == 0: + return session_infos + with nogil: + __status__ = nvmlDeviceGetEncoderSessions(device, session_count, session_infos_ptr) + check_status(__status__) + return session_infos + + +cpdef tuple device_get_decoder_utilization(intptr_t device): + """Retrieves the current utilization and sampling size in microseconds for the Decoder. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + A 2-tuple containing: + + - unsigned int: Reference to an unsigned int for decoder utilization info. + - unsigned int: Reference to an unsigned int for the sampling period in US. + + .. seealso:: `nvmlDeviceGetDecoderUtilization` + """ + cdef unsigned int utilization + cdef unsigned int sampling_period_us + with nogil: + __status__ = nvmlDeviceGetDecoderUtilization(device, &utilization, &sampling_period_us) + check_status(__status__) + return (utilization, sampling_period_us) + + +cpdef tuple device_get_jpg_utilization(intptr_t device): + """Retrieves the current utilization and sampling size in microseconds for the JPG. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + A 2-tuple containing: + + - unsigned int: Reference to an unsigned int for jpg utilization info. + - unsigned int: Reference to an unsigned int for the sampling period in US. + + .. seealso:: `nvmlDeviceGetJpgUtilization` + """ + cdef unsigned int utilization + cdef unsigned int sampling_period_us + with nogil: + __status__ = nvmlDeviceGetJpgUtilization(device, &utilization, &sampling_period_us) + check_status(__status__) + return (utilization, sampling_period_us) + + +cpdef tuple device_get_ofa_utilization(intptr_t device): + """Retrieves the current utilization and sampling size in microseconds for the OFA (Optical Flow Accelerator). + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + A 2-tuple containing: + + - unsigned int: Reference to an unsigned int for ofa utilization info. + - unsigned int: Reference to an unsigned int for the sampling period in US. + + .. seealso:: `nvmlDeviceGetOfaUtilization` + """ + cdef unsigned int utilization + cdef unsigned int sampling_period_us + with nogil: + __status__ = nvmlDeviceGetOfaUtilization(device, &utilization, &sampling_period_us) + check_status(__status__) + return (utilization, sampling_period_us) + + +cpdef object device_get_fbc_stats(intptr_t device): + """Retrieves the active frame buffer capture sessions statistics for a given device. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + nvmlFBCStats_t: Reference to ``nvmlFBCStats_t`` structure containing NvFBC stats. + + .. seealso:: `nvmlDeviceGetFBCStats` + """ + cdef FBCStats fbc_stats_py = FBCStats() + cdef nvmlFBCStats_t *fbc_stats = (fbc_stats_py._get_ptr()) + with nogil: + __status__ = nvmlDeviceGetFBCStats(device, fbc_stats) + check_status(__status__) + return fbc_stats_py + + +cpdef object device_get_fbc_sessions(intptr_t device): + """Retrieves information about active frame buffer capture sessions on a target device. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + nvmlFBCSessionInfo_t: Reference in which to return the session information. + + .. seealso:: `nvmlDeviceGetFBCSessions` + """ + cdef unsigned int[1] session_count = [0] + with nogil: + __status__ = nvmlDeviceGetFBCSessions(device, session_count, NULL) + check_status_size(__status__) + cdef FBCSessionInfo session_info = FBCSessionInfo(session_count[0]) + cdef nvmlFBCSessionInfo_t *session_info_ptr = (session_info._get_ptr()) + if session_count[0] == 0: + return session_info + with nogil: + __status__ = nvmlDeviceGetFBCSessions(device, session_count, session_info_ptr) + check_status(__status__) + return session_info + + +cpdef tuple device_get_driver_model_v2(intptr_t device): + """Retrieves the current and pending driver model for the device. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + A 2-tuple containing: + + - int: Reference in which to return the current driver model. + - int: Reference in which to return the pending driver model. + + .. seealso:: `nvmlDeviceGetDriverModel_v2` + """ + cdef _DriverModel current + cdef _DriverModel pending + with nogil: + __status__ = nvmlDeviceGetDriverModel_v2(device, ¤t, &pending) + check_status(__status__) + return (current, pending) + + +cpdef str device_get_vbios_version(intptr_t device): + """Get VBIOS version of the device. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + char: Reference to which to return the VBIOS version. + + .. seealso:: `nvmlDeviceGetVbiosVersion` + """ + cdef unsigned int length = 32 + cdef char[32] version + with nogil: + __status__ = nvmlDeviceGetVbiosVersion(device, version, length) + check_status(__status__) + return _cyb_cpython.PyUnicode_FromString(version) + + +cpdef object device_get_bridge_chip_info(intptr_t device): + """Get Bridge Chip Information for all the bridge chips on the board. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + nvmlBridgeChipHierarchy_t: Reference to the returned bridge chip Hierarchy. + + .. seealso:: `nvmlDeviceGetBridgeChipInfo` + """ + cdef BridgeChipHierarchy bridge_hierarchy_py = BridgeChipHierarchy() + cdef nvmlBridgeChipHierarchy_t *bridge_hierarchy = (bridge_hierarchy_py._get_ptr()) + with nogil: + __status__ = nvmlDeviceGetBridgeChipInfo(device, bridge_hierarchy) + check_status(__status__) + return bridge_hierarchy_py + + +cpdef object device_get_compute_running_processes_v3(intptr_t device): + """Get information about processes with a compute context on a device. + + Args: + device (intptr_t): The device handle or MIG device handle. + + Returns: + nvmlProcessInfo_t: Reference in which to return the process information. + + .. seealso:: `nvmlDeviceGetComputeRunningProcesses_v3` + """ + cdef unsigned int[1] info_count = [0] + with nogil: + __status__ = nvmlDeviceGetComputeRunningProcesses_v3(device, info_count, NULL) + check_status_size(__status__) + cdef ProcessInfo infos = ProcessInfo(info_count[0]) + cdef nvmlProcessInfo_t *infos_ptr = (infos._get_ptr()) + if info_count[0] == 0: + return infos + with nogil: + __status__ = nvmlDeviceGetComputeRunningProcesses_v3(device, info_count, infos_ptr) + check_status(__status__) + return infos + + +cpdef object device_get_graphics_running_processes_v3(intptr_t device): + """Get information about processes with a graphics context on a device. + + Args: + device (intptr_t): The device handle or MIG device handle. + + Returns: + nvmlProcessInfo_t: Reference in which to return the process information. + + .. seealso:: `nvmlDeviceGetGraphicsRunningProcesses_v3` + """ + cdef unsigned int[1] info_count = [0] + with nogil: + __status__ = nvmlDeviceGetGraphicsRunningProcesses_v3(device, info_count, NULL) + check_status_size(__status__) + cdef ProcessInfo infos = ProcessInfo(info_count[0]) + cdef nvmlProcessInfo_t *infos_ptr = (infos._get_ptr()) + if info_count[0] == 0: + return infos + with nogil: + __status__ = nvmlDeviceGetGraphicsRunningProcesses_v3(device, info_count, infos_ptr) + check_status(__status__) + return infos + + +cpdef object device_get_mps_compute_running_processes_v3(intptr_t device): + """Get information about processes with a Multi-Process Service (MPS) compute context on a device. + + Args: + device (intptr_t): The device handle or MIG device handle. + + Returns: + nvmlProcessInfo_t: Reference in which to return the process information. + + .. seealso:: `nvmlDeviceGetMPSComputeRunningProcesses_v3` + """ + cdef unsigned int[1] info_count = [0] + with nogil: + __status__ = nvmlDeviceGetMPSComputeRunningProcesses_v3(device, info_count, NULL) + check_status_size(__status__) + cdef ProcessInfo infos = ProcessInfo(info_count[0]) + cdef nvmlProcessInfo_t *infos_ptr = (infos._get_ptr()) + if info_count[0] == 0: + return infos + with nogil: + __status__ = nvmlDeviceGetMPSComputeRunningProcesses_v3(device, info_count, infos_ptr) + check_status(__status__) + return infos + + +cpdef int device_on_same_board(intptr_t device1, intptr_t device2) except? 0: + """Check if the GPU devices are on the same physical board. + + Args: + device1 (intptr_t): The first GPU device. + device2 (intptr_t): The second GPU device. + + Returns: + int: Reference in which to return the status. Non-zero indicates that the GPUs are on the same board. + + .. seealso:: `nvmlDeviceOnSameBoard` + """ + cdef int on_same_board + with nogil: + __status__ = nvmlDeviceOnSameBoard(device1, device2, &on_same_board) + check_status(__status__) + return on_same_board + + +cpdef int device_get_api_restriction(intptr_t device, int api_type) except? -1: + """Retrieves the root/admin permissions on the target API. See ``nvmlRestrictedAPI_t`` for the list of supported APIs. If an API is restricted only root users can call that API. See ``nvmlDeviceSetAPIRestriction`` to change current permissions. + + Args: + device (intptr_t): The identifier of the target device. + api_type (RestrictedAPI): Target API type for this operation. + + Returns: + int: Reference in which to return the current restriction NVML_FEATURE_ENABLED indicates that the API is root-only NVML_FEATURE_DISABLED indicates that the API is accessible to all users. + + .. seealso:: `nvmlDeviceGetAPIRestriction` + """ + cdef _EnableState is_restricted + with nogil: + __status__ = nvmlDeviceGetAPIRestriction(device, <_RestrictedAPI>api_type, &is_restricted) + check_status(__status__) + return is_restricted + + +cpdef object device_get_bar1_memory_info(intptr_t device): + """Gets Total, Available and Used size of BAR1 memory. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + nvmlBAR1Memory_t: Reference in which BAR1 memory information is returned. + + .. seealso:: `nvmlDeviceGetBAR1MemoryInfo` + """ + cdef BAR1Memory bar1memory_py = BAR1Memory() + cdef nvmlBAR1Memory_t *bar1memory = (bar1memory_py._get_ptr()) + with nogil: + __status__ = nvmlDeviceGetBAR1MemoryInfo(device, bar1memory) + check_status(__status__) + return bar1memory_py + + +cpdef unsigned int device_get_irq_num(intptr_t device) except? 0: + """Gets the device's interrupt number. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + unsigned int: The interrupt number associated with the specified device. + + .. seealso:: `nvmlDeviceGetIrqNum` + """ + cdef unsigned int irq_num + with nogil: + __status__ = nvmlDeviceGetIrqNum(device, &irq_num) + check_status(__status__) + return irq_num + + +cpdef unsigned int device_get_num_gpu_cores(intptr_t device) except? 0: + """Gets the device's core count. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + unsigned int: The number of cores for the specified device. + + .. seealso:: `nvmlDeviceGetNumGpuCores` + """ + cdef unsigned int num_cores + with nogil: + __status__ = nvmlDeviceGetNumGpuCores(device, &num_cores) + check_status(__status__) + return num_cores + + +cpdef unsigned int device_get_power_source(intptr_t device) except *: + """Gets the devices power source. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + unsigned int: The power source of the device. + + .. seealso:: `nvmlDeviceGetPowerSource` + """ + cdef nvmlPowerSource_t power_source + with nogil: + __status__ = nvmlDeviceGetPowerSource(device, &power_source) + check_status(__status__) + return power_source + + +cpdef unsigned int device_get_memory_bus_width(intptr_t device) except? 0: + """Gets the device's memory bus width. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + unsigned int: The devices's memory bus width. + + .. seealso:: `nvmlDeviceGetMemoryBusWidth` + """ + cdef unsigned int bus_width + with nogil: + __status__ = nvmlDeviceGetMemoryBusWidth(device, &bus_width) + check_status(__status__) + return bus_width + + +cpdef unsigned int device_get_pcie_link_max_speed(intptr_t device) except? 0: + """Gets the device's PCIE Max Link speed in MBPS. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + unsigned int: The devices's PCIE Max Link speed in MBPS. + + .. seealso:: `nvmlDeviceGetPcieLinkMaxSpeed` + """ + cdef unsigned int max_speed + with nogil: + __status__ = nvmlDeviceGetPcieLinkMaxSpeed(device, &max_speed) + check_status(__status__) + return max_speed + + +cpdef unsigned int device_get_pcie_speed(intptr_t device) except? 0: + """Gets the device's PCIe Link speed in Mbps. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + unsigned int: The devices's PCIe Max Link speed in Mbps. + + .. seealso:: `nvmlDeviceGetPcieSpeed` + """ + cdef unsigned int pcie_speed + with nogil: + __status__ = nvmlDeviceGetPcieSpeed(device, &pcie_speed) + check_status(__status__) + return pcie_speed + + +cpdef unsigned int device_get_adaptive_clock_info_status(intptr_t device) except? 0: + """Gets the device's Adaptive Clock status. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + unsigned int: The current adaptive clocking status, either NVML_ADAPTIVE_CLOCKING_INFO_STATUS_DISABLED or NVML_ADAPTIVE_CLOCKING_INFO_STATUS_ENABLED. + + .. seealso:: `nvmlDeviceGetAdaptiveClockInfoStatus` + """ + cdef unsigned int adaptive_clock_status + with nogil: + __status__ = nvmlDeviceGetAdaptiveClockInfoStatus(device, &adaptive_clock_status) + check_status(__status__) + return adaptive_clock_status + + +cpdef unsigned int device_get_bus_type(intptr_t device) except? 0: + """Get the type of the GPU Bus (PCIe, PCI, ...). + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + unsigned int: The PCI Bus type. + + .. seealso:: `nvmlDeviceGetBusType` + """ + cdef nvmlBusType_t type + with nogil: + __status__ = nvmlDeviceGetBusType(device, &type) + check_status(__status__) + return type + + +cpdef object system_get_conf_compute_capabilities(): + """Get Conf Computing System capabilities. + + Returns: + nvmlConfComputeSystemCaps_t: System CC capabilities. + + .. seealso:: `nvmlSystemGetConfComputeCapabilities` + """ + cdef ConfComputeSystemCaps capabilities_py = ConfComputeSystemCaps() + cdef nvmlConfComputeSystemCaps_t *capabilities = (capabilities_py._get_ptr()) + with nogil: + __status__ = nvmlSystemGetConfComputeCapabilities(capabilities) + check_status(__status__) + return capabilities_py + + +cpdef object system_get_conf_compute_state(): + """Get Conf Computing System State. + + Returns: + nvmlConfComputeSystemState_t: System CC State. + + .. seealso:: `nvmlSystemGetConfComputeState` + """ + cdef ConfComputeSystemState state_py = ConfComputeSystemState() + cdef nvmlConfComputeSystemState_t *state = (state_py._get_ptr()) + with nogil: + __status__ = nvmlSystemGetConfComputeState(state) + check_status(__status__) + return state_py + + +cpdef object device_get_conf_compute_mem_size_info(intptr_t device): + """Get Conf Computing Protected and Unprotected Memory Sizes. + + Args: + device (intptr_t): Device handle. + + Returns: + nvmlConfComputeMemSizeInfo_t: Protected/Unprotected Memory sizes. + + .. seealso:: `nvmlDeviceGetConfComputeMemSizeInfo` + """ + cdef ConfComputeMemSizeInfo mem_info_py = ConfComputeMemSizeInfo() + cdef nvmlConfComputeMemSizeInfo_t *mem_info = (mem_info_py._get_ptr()) + with nogil: + __status__ = nvmlDeviceGetConfComputeMemSizeInfo(device, mem_info) + check_status(__status__) + return mem_info_py + + +cpdef unsigned int system_get_conf_compute_gpus_ready_state() except? 0: + """Get Conf Computing GPUs ready state. + + Returns: + unsigned int: Returns GPU current work accepting state, NVML_CC_ACCEPTING_CLIENT_REQUESTS_TRUE or NVML_CC_ACCEPTING_CLIENT_REQUESTS_FALSE. + + .. seealso:: `nvmlSystemGetConfComputeGpusReadyState` + """ + cdef unsigned int is_accepting_work + with nogil: + __status__ = nvmlSystemGetConfComputeGpusReadyState(&is_accepting_work) + check_status(__status__) + return is_accepting_work + + +cpdef object device_get_conf_compute_protected_memory_usage(intptr_t device): + """Get Conf Computing protected memory usage. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + nvmlMemory_t: Reference in which to return the memory information. + + .. seealso:: `nvmlDeviceGetConfComputeProtectedMemoryUsage` + """ + cdef Memory memory_py = Memory() + cdef nvmlMemory_t *memory = (memory_py._get_ptr()) + with nogil: + __status__ = nvmlDeviceGetConfComputeProtectedMemoryUsage(device, memory) + check_status(__status__) + return memory_py + + +cpdef object device_get_conf_compute_gpu_certificate(intptr_t device): + """Get Conf Computing GPU certificate details. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + nvmlConfComputeGpuCertificate_t: Reference in which to return the gpu certificate information. + + .. seealso:: `nvmlDeviceGetConfComputeGpuCertificate` + """ + cdef ConfComputeGpuCertificate gpu_cert_py = ConfComputeGpuCertificate() + cdef nvmlConfComputeGpuCertificate_t *gpu_cert = (gpu_cert_py._get_ptr()) + with nogil: + __status__ = nvmlDeviceGetConfComputeGpuCertificate(device, gpu_cert) + check_status(__status__) + return gpu_cert_py + + +cpdef device_set_conf_compute_unprotected_mem_size(intptr_t device, unsigned long long size_ki_b): + """Set Conf Computing Unprotected Memory Size. + + Args: + device (intptr_t): Device Handle. + size_ki_b (unsigned long long): Unprotected Memory size to be set in KiB. + + .. seealso:: `nvmlDeviceSetConfComputeUnprotectedMemSize` + """ + with nogil: + __status__ = nvmlDeviceSetConfComputeUnprotectedMemSize(device, size_ki_b) + check_status(__status__) + + +cpdef system_set_conf_compute_gpus_ready_state(unsigned int is_accepting_work): + """Set Conf Computing GPUs ready state. + + Args: + is_accepting_work (unsigned int): GPU accepting new work, NVML_CC_ACCEPTING_CLIENT_REQUESTS_TRUE or NVML_CC_ACCEPTING_CLIENT_REQUESTS_FALSE. + + .. seealso:: `nvmlSystemSetConfComputeGpusReadyState` + """ + with nogil: + __status__ = nvmlSystemSetConfComputeGpusReadyState(is_accepting_work) + check_status(__status__) + + +cpdef object system_get_conf_compute_settings(): + """Get Conf Computing System Settings. + + Returns: + nvmlSystemConfComputeSettings_v1_t: System CC settings. + + .. seealso:: `nvmlSystemGetConfComputeSettings` + """ + cdef SystemConfComputeSettings_v1 settings_py = SystemConfComputeSettings_v1() + cdef nvmlSystemConfComputeSettings_t *settings = (settings_py._get_ptr()) + settings.version = NVML_VERSION_STRUCT(sizeof(nvmlSystemConfComputeSettings_v1_t), 1) + with nogil: + __status__ = nvmlSystemGetConfComputeSettings(settings) + check_status(__status__) + return settings_py + + +cpdef char device_get_gsp_firmware_version(intptr_t device) except? 0: + """Retrieve GSP firmware version. + + Args: + device (intptr_t): Device handle. + + Returns: + char: The retrieved GSP firmware version. + + .. seealso:: `nvmlDeviceGetGspFirmwareVersion` + """ + cdef char version + with nogil: + __status__ = nvmlDeviceGetGspFirmwareVersion(device, &version) + check_status(__status__) + return version + + +cpdef tuple device_get_gsp_firmware_mode(intptr_t device): + """Retrieve GSP firmware mode. + + Args: + device (intptr_t): Device handle. + + Returns: + A 2-tuple containing: + + - unsigned int: Pointer to specify if GSP firmware is enabled. + - unsigned int: Pointer to specify if GSP firmware is supported by default on ``device``. + + .. seealso:: `nvmlDeviceGetGspFirmwareMode` + """ + cdef unsigned int is_enabled + cdef unsigned int default_mode + with nogil: + __status__ = nvmlDeviceGetGspFirmwareMode(device, &is_enabled, &default_mode) + check_status(__status__) + return (is_enabled, default_mode) + + +cpdef object device_get_sram_ecc_error_status(intptr_t device): + """Get SRAM ECC error status of this device. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + nvmlEccSramErrorStatus_v1_t: Returns SRAM ECC error status. + + .. seealso:: `nvmlDeviceGetSramEccErrorStatus` + """ + cdef EccSramErrorStatus_v1 status_py = EccSramErrorStatus_v1() + cdef nvmlEccSramErrorStatus_t *status = (status_py._get_ptr()) + status.version = NVML_VERSION_STRUCT(sizeof(nvmlEccSramErrorStatus_v1_t), 1) + with nogil: + __status__ = nvmlDeviceGetSramEccErrorStatus(device, status) + check_status(__status__) + return status_py + + +cpdef int device_get_accounting_mode(intptr_t device) except? -1: + """Queries the state of per process accounting mode. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + int: Reference in which to return the current accounting mode. + + .. seealso:: `nvmlDeviceGetAccountingMode` + """ + cdef _EnableState mode + with nogil: + __status__ = nvmlDeviceGetAccountingMode(device, &mode) + check_status(__status__) + return mode + + +cpdef object device_get_accounting_stats(intptr_t device, unsigned int pid): + """Queries process's accounting stats. + + Args: + device (intptr_t): The identifier of the target device. + pid (unsigned int): Process Id of the target process to query stats for. + + Returns: + nvmlAccountingStats_t: Reference in which to return the process's accounting stats. + + .. seealso:: `nvmlDeviceGetAccountingStats` + """ + cdef AccountingStats stats_py = AccountingStats() + cdef nvmlAccountingStats_t *stats = (stats_py._get_ptr()) + with nogil: + __status__ = nvmlDeviceGetAccountingStats(device, pid, stats) + check_status(__status__) + return stats_py + + +cpdef object device_get_accounting_pids(intptr_t device): + """Queries list of processes that can be queried for accounting stats. The list of processes returned can be in running or terminated state. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + unsigned int: Reference in which to return list of process ids. + + .. seealso:: `nvmlDeviceGetAccountingPids` + """ + cdef unsigned int[1] count = [0] + with nogil: + __status__ = nvmlDeviceGetAccountingPids(device, count, NULL) + check_status_size(__status__) + if count[0] == 0: + return _cyb_view.array(shape=(1,), itemsize=sizeof(unsigned int), format="I", mode="c")[:0] + cdef _cyb_view.array pids = _cyb_view.array(shape=(count[0],), itemsize=sizeof(unsigned int), format="I", mode="c") + cdef unsigned int *pids_ptr = (pids.data) + with nogil: + __status__ = nvmlDeviceGetAccountingPids(device, count, pids_ptr) + check_status(__status__) + return pids + + +cpdef unsigned int device_get_accounting_buffer_size(intptr_t device) except? 0: + """Returns the number of processes that the circular buffer with accounting pids can hold. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + unsigned int: Reference in which to provide the size (in number of elements) of the circular buffer for accounting stats. + + .. seealso:: `nvmlDeviceGetAccountingBufferSize` + """ + cdef unsigned int buffer_size + with nogil: + __status__ = nvmlDeviceGetAccountingBufferSize(device, &buffer_size) + check_status(__status__) + return buffer_size + + +cpdef object device_get_retired_pages(intptr_t device, int cause): + """Returns the list of retired pages by source, including pages that are pending retirement The address information provided from this API is the hardware address of the page that was retired. Note that this does not match the virtual address used in CUDA, but will match the address information in Xid 63. + + Args: + device (intptr_t): The identifier of the target device. + cause (PageRetirementCause): Filter page addresses by cause of retirement. + + Returns: + unsigned long long: Buffer to write the page addresses into. + + .. seealso:: `nvmlDeviceGetRetiredPages` + """ + cdef unsigned int[1] page_count = [0] + with nogil: + __status__ = nvmlDeviceGetRetiredPages(device, <_PageRetirementCause>cause, page_count, NULL) + check_status_size(__status__) + if page_count[0] == 0: + return _cyb_view.array(shape=(1,), itemsize=sizeof(unsigned long long), format="Q", mode="c")[:0] + cdef _cyb_view.array addresses = _cyb_view.array(shape=(page_count[0],), itemsize=sizeof(unsigned long long), format="Q", mode="c") + cdef unsigned long long *addresses_ptr = (addresses.data) + with nogil: + __status__ = nvmlDeviceGetRetiredPages(device, <_PageRetirementCause>cause, page_count, addresses_ptr) + check_status(__status__) + return addresses + + +cpdef int device_get_retired_pages_pending_status(intptr_t device) except? -1: + """Check if any pages are pending retirement and need a reboot to fully retire. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + int: Reference in which to return the pending status. + + .. seealso:: `nvmlDeviceGetRetiredPagesPendingStatus` + """ + cdef _EnableState is_pending + with nogil: + __status__ = nvmlDeviceGetRetiredPagesPendingStatus(device, &is_pending) + check_status(__status__) + return is_pending + + +cpdef tuple device_get_remapped_rows(intptr_t device): + """Get number of remapped rows. The number of rows reported will be based on the cause of the remapping. is_pending indicates whether or not there are pending remappings. A reset will be required to actually remap the row. failure_occurred will be set if a row remapping ever failed in the past. A pending remapping won't affect future work on the GPU since error-containment and dynamic page blacklisting will take care of that. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + A 4-tuple containing: + + - unsigned int: Reference for number of rows remapped due to correctable errors. + - unsigned int: Reference for number of rows remapped due to uncorrectable errors. + - unsigned int: Reference for whether or not remappings are pending. + - unsigned int: Reference that is set when a remapping has failed in the past. + + .. seealso:: `nvmlDeviceGetRemappedRows` + """ + cdef unsigned int corr_rows + cdef unsigned int unc_rows + cdef unsigned int is_pending + cdef unsigned int failure_occurred + with nogil: + __status__ = nvmlDeviceGetRemappedRows(device, &corr_rows, &unc_rows, &is_pending, &failure_occurred) + check_status(__status__) + return (corr_rows, unc_rows, is_pending, failure_occurred) + + +cpdef object device_get_row_remapper_histogram(intptr_t device): + """Get the row remapper histogram. Returns the remap availability for each bank on the GPU. + + Args: + device (intptr_t): Device handle. + + Returns: + nvmlRowRemapperHistogramValues_t: Histogram values. + + .. seealso:: `nvmlDeviceGetRowRemapperHistogram` + """ + cdef RowRemapperHistogramValues values_py = RowRemapperHistogramValues() + cdef nvmlRowRemapperHistogramValues_t *values = (values_py._get_ptr()) + with nogil: + __status__ = nvmlDeviceGetRowRemapperHistogram(device, values) + check_status(__status__) + return values_py + + +cpdef unsigned int device_get_architecture(intptr_t device) except? 0: + """Get architecture for device. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + unsigned int: Reference where architecture is returned, if call successful. Set to NVML_DEVICE_ARCH_* upon success. + + .. seealso:: `nvmlDeviceGetArchitecture` + """ + cdef nvmlDeviceArchitecture_t arch + with nogil: + __status__ = nvmlDeviceGetArchitecture(device, &arch) + check_status(__status__) + return arch + + +cpdef object device_get_clk_mon_status(intptr_t device): + """Retrieves the frequency monitor fault status for the device. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + nvmlClkMonStatus_t: Reference in which to return the clkmon fault status. + + .. seealso:: `nvmlDeviceGetClkMonStatus` + """ + cdef ClkMonStatus status_py = ClkMonStatus() + cdef nvmlClkMonStatus_t *status = (status_py._get_ptr()) + with nogil: + __status__ = nvmlDeviceGetClkMonStatus(device, status) + check_status(__status__) + return status_py + + +cpdef object device_get_process_utilization(intptr_t device, unsigned long long last_seen_time_stamp): + """Retrieves the current utilization and process ID. + + Args: + device (intptr_t): The identifier of the target device. + last_seen_time_stamp (unsigned long long): Return only samples with timestamp greater than last_seen_time_stamp. + + Returns: + nvmlProcessUtilizationSample_t: Pointer to caller-supplied buffer in which guest process utilization samples are returned. + + .. seealso:: `nvmlDeviceGetProcessUtilization` + """ + cdef unsigned int[1] process_samples_count = [0] + with nogil: + __status__ = nvmlDeviceGetProcessUtilization(device, NULL, process_samples_count, last_seen_time_stamp) + check_status_size(__status__) + cdef ProcessUtilizationSample utilization = ProcessUtilizationSample(process_samples_count[0]) + cdef nvmlProcessUtilizationSample_t *utilization_ptr = (utilization._get_ptr()) + if process_samples_count[0] == 0: + return utilization + with nogil: + __status__ = nvmlDeviceGetProcessUtilization(device, utilization_ptr, process_samples_count, last_seen_time_stamp) + check_status(__status__) + return utilization + + +cpdef unit_set_led_state(intptr_t unit, int color): + """Set the LED state for the unit. The LED can be either green (0) or amber (1). + + Args: + unit (intptr_t): The identifier of the target unit. + color (LedColor): The target LED color. + + .. seealso:: `nvmlUnitSetLedState` + """ + with nogil: + __status__ = nvmlUnitSetLedState(unit, <_LedColor>color) + check_status(__status__) + + +cpdef device_set_persistence_mode(intptr_t device, int mode): + """Set the persistence mode for the device. + + Args: + device (intptr_t): The identifier of the target device. + mode (EnableState): The target persistence mode. + + .. seealso:: `nvmlDeviceSetPersistenceMode` + """ + with nogil: + __status__ = nvmlDeviceSetPersistenceMode(device, <_EnableState>mode) + check_status(__status__) + + +cpdef device_set_compute_mode(intptr_t device, int mode): + """Set the compute mode for the device or MIG device. + + Args: + device (intptr_t): The identifier of the target device handle or MIG device handle. + mode (ComputeMode): The target compute mode. + + .. seealso:: `nvmlDeviceSetComputeMode` + """ + with nogil: + __status__ = nvmlDeviceSetComputeMode(device, <_ComputeMode>mode) + check_status(__status__) + + +cpdef device_set_ecc_mode(intptr_t device, int ecc): + """Set the ECC mode for the device. + + Args: + device (intptr_t): The identifier of the target device. + ecc (EnableState): The target ECC mode. + + .. seealso:: `nvmlDeviceSetEccMode` + """ + with nogil: + __status__ = nvmlDeviceSetEccMode(device, <_EnableState>ecc) + check_status(__status__) + + +cpdef device_clear_ecc_error_counts(intptr_t device, int counter_type): + """Clear the ECC error and other memory error counts for the device. + + Args: + device (intptr_t): The identifier of the target device. + counter_type (EccCounterType): Flag that indicates which type of errors should be cleared. + + .. seealso:: `nvmlDeviceClearEccErrorCounts` + """ + with nogil: + __status__ = nvmlDeviceClearEccErrorCounts(device, <_EccCounterType>counter_type) + check_status(__status__) + + +cpdef device_set_driver_model(intptr_t device, int driver_model, unsigned int flags): + """Set the driver model for the device. + + Args: + device (intptr_t): The identifier of the target device. + driver_model (DriverModel): The target driver model. + flags (unsigned int): Flags that change the default behavior. + + .. seealso:: `nvmlDeviceSetDriverModel` + """ + with nogil: + __status__ = nvmlDeviceSetDriverModel(device, <_DriverModel>driver_model, flags) + check_status(__status__) + + +cpdef device_set_gpu_locked_clocks(intptr_t device, unsigned int min_gpu_clock_m_hz, unsigned int max_gpu_clock_m_hz): + """Set clocks that device will lock to. + + Args: + device (intptr_t): The identifier of the target device. + min_gpu_clock_m_hz (unsigned int): Requested minimum gpu clock in MHz. + max_gpu_clock_m_hz (unsigned int): Requested maximum gpu clock in MHz. + + .. seealso:: `nvmlDeviceSetGpuLockedClocks` + """ + with nogil: + __status__ = nvmlDeviceSetGpuLockedClocks(device, min_gpu_clock_m_hz, max_gpu_clock_m_hz) + check_status(__status__) + + +cpdef device_reset_gpu_locked_clocks(intptr_t device): + """Resets the gpu clock to the default value. + + Args: + device (intptr_t): The identifier of the target device. + + .. seealso:: `nvmlDeviceResetGpuLockedClocks` + """ + with nogil: + __status__ = nvmlDeviceResetGpuLockedClocks(device) + check_status(__status__) + + +cpdef device_set_memory_locked_clocks(intptr_t device, unsigned int min_mem_clock_m_hz, unsigned int max_mem_clock_m_hz): + """Set memory clocks that device will lock to. + + Args: + device (intptr_t): The identifier of the target device. + min_mem_clock_m_hz (unsigned int): Requested minimum memory clock in MHz. + max_mem_clock_m_hz (unsigned int): Requested maximum memory clock in MHz. + + .. seealso:: `nvmlDeviceSetMemoryLockedClocks` + """ + with nogil: + __status__ = nvmlDeviceSetMemoryLockedClocks(device, min_mem_clock_m_hz, max_mem_clock_m_hz) + check_status(__status__) + + +cpdef device_reset_memory_locked_clocks(intptr_t device): + """Resets the memory clock to the default value. + + Args: + device (intptr_t): The identifier of the target device. + + .. seealso:: `nvmlDeviceResetMemoryLockedClocks` + """ + with nogil: + __status__ = nvmlDeviceResetMemoryLockedClocks(device) + check_status(__status__) + + +cpdef device_set_auto_boosted_clocks_enabled(intptr_t device, int enabled): + """Try to set the current state of Auto Boosted clocks on a device. + + Args: + device (intptr_t): The identifier of the target device. + enabled (EnableState): What state to try to set Auto Boosted clocks of the target device to. + + .. seealso:: `nvmlDeviceSetAutoBoostedClocksEnabled` + """ + with nogil: + __status__ = nvmlDeviceSetAutoBoostedClocksEnabled(device, <_EnableState>enabled) + check_status(__status__) + + +cpdef device_set_default_auto_boosted_clocks_enabled(intptr_t device, int enabled, unsigned int flags): + """Try to set the default state of Auto Boosted clocks on a device. This is the default state that Auto Boosted clocks will return to when no compute running processes (e.g. CUDA application which have an active context) are running. + + Args: + device (intptr_t): The identifier of the target device. + enabled (EnableState): What state to try to set default Auto Boosted clocks of the target device to. + flags (unsigned int): Flags that change the default behavior. Currently Unused. + + .. seealso:: `nvmlDeviceSetDefaultAutoBoostedClocksEnabled` + """ + with nogil: + __status__ = nvmlDeviceSetDefaultAutoBoostedClocksEnabled(device, <_EnableState>enabled, flags) + check_status(__status__) + + +cpdef device_set_default_fan_speed_v2(intptr_t device, unsigned int fan): + """Sets the speed of the fan control policy to default. + + Args: + device (intptr_t): The identifier of the target device. + fan (unsigned int): The index of the fan, starting at zero. + + .. seealso:: `nvmlDeviceSetDefaultFanSpeed_v2` + """ + with nogil: + __status__ = nvmlDeviceSetDefaultFanSpeed_v2(device, fan) + check_status(__status__) + + +cpdef device_set_fan_control_policy(intptr_t device, unsigned int fan, unsigned int policy): + """Sets current fan control policy. + + Args: + device (intptr_t): The identifier of the target ``device``. + fan (unsigned int): The index of the fan, starting at zero. + policy (unsigned int): The fan control ``policy`` to set. + + .. seealso:: `nvmlDeviceSetFanControlPolicy` + """ + with nogil: + __status__ = nvmlDeviceSetFanControlPolicy(device, fan, policy) + check_status(__status__) + + +cpdef device_set_gpu_operation_mode(intptr_t device, int mode): + """Sets new GOM. See ``nvmlGpuOperationMode_t`` for details. + + Args: + device (intptr_t): The identifier of the target device. + mode (GpuOperationMode): Target GOM. + + .. seealso:: `nvmlDeviceSetGpuOperationMode` + """ + with nogil: + __status__ = nvmlDeviceSetGpuOperationMode(device, <_GpuOperationMode>mode) + check_status(__status__) + + +cpdef device_set_api_restriction(intptr_t device, int api_type, int is_restricted): + """Changes the root/admin restructions on certain APIs. See ``nvmlRestrictedAPI_t`` for the list of supported APIs. This method can be used by a root/admin user to give non-root/admin access to certain otherwise-restricted APIs. The new setting lasts for the lifetime of the NVIDIA driver; it is not persistent. See ``nvmlDeviceGetAPIRestriction`` to query the current restriction settings. + + Args: + device (intptr_t): The identifier of the target device. + api_type (RestrictedAPI): Target API type for this operation. + is_restricted (EnableState): The target restriction. + + .. seealso:: `nvmlDeviceSetAPIRestriction` + """ + with nogil: + __status__ = nvmlDeviceSetAPIRestriction(device, <_RestrictedAPI>api_type, <_EnableState>is_restricted) + check_status(__status__) + + +cpdef device_set_fan_speed_v2(intptr_t device, unsigned int fan, unsigned int speed): + """Sets the speed of a specified fan. + + Args: + device (intptr_t): The identifier of the target device. + fan (unsigned int): The index of the fan, starting at zero. + speed (unsigned int): The target speed of the fan [0-100] in % of max speed. + + .. seealso:: `nvmlDeviceSetFanSpeed_v2` + """ + with nogil: + __status__ = nvmlDeviceSetFanSpeed_v2(device, fan, speed) + check_status(__status__) + + +cpdef device_set_accounting_mode(intptr_t device, int mode): + """Enables or disables per process accounting. + + Args: + device (intptr_t): The identifier of the target device. + mode (EnableState): The target accounting mode. + + .. seealso:: `nvmlDeviceSetAccountingMode` + """ + with nogil: + __status__ = nvmlDeviceSetAccountingMode(device, <_EnableState>mode) + check_status(__status__) + + +cpdef device_clear_accounting_pids(intptr_t device): + """Clears accounting information about all processes that have already terminated. + + Args: + device (intptr_t): The identifier of the target device. + + .. seealso:: `nvmlDeviceClearAccountingPids` + """ + with nogil: + __status__ = nvmlDeviceClearAccountingPids(device) + check_status(__status__) + + +cpdef int device_get_nvlink_state(intptr_t device, unsigned int link) except? -1: + """Retrieves the state of the device's NvLink for the link specified. + + Args: + device (intptr_t): The identifier of the target device. + link (unsigned int): Specifies the NvLink link to be queried. + + Returns: + int: ``nvmlEnableState_t`` where NVML_FEATURE_ENABLED indicates that the link is active and NVML_FEATURE_DISABLED indicates it is inactive. + + .. seealso:: `nvmlDeviceGetNvLinkState` + """ + cdef _EnableState is_active + with nogil: + __status__ = nvmlDeviceGetNvLinkState(device, link, &is_active) + check_status(__status__) + return is_active + + +cpdef unsigned int device_get_nvlink_version(intptr_t device, unsigned int link) except? 0: + """Retrieves the version of the device's NvLink for the link specified. + + Args: + device (intptr_t): The identifier of the target device. + link (unsigned int): Specifies the NvLink link to be queried. + + Returns: + unsigned int: Requested NvLink version from ``nvmlNvlinkVersion_t``. + + .. seealso:: `nvmlDeviceGetNvLinkVersion` + """ + cdef unsigned int version + with nogil: + __status__ = nvmlDeviceGetNvLinkVersion(device, link, &version) + check_status(__status__) + return version + + +cpdef unsigned int device_get_nvlink_capability(intptr_t device, unsigned int link, int capability) except? 0: + """Retrieves the requested capability from the device's NvLink for the link specified Please refer to the ``nvmlNvLinkCapability_t`` structure for the specific caps that can be queried The return value should be treated as a boolean. + + Args: + device (intptr_t): The identifier of the target device. + link (unsigned int): Specifies the NvLink link to be queried. + capability (NvLinkCapability): Specifies the ``nvmlNvLinkCapability_t`` to be queried. + + Returns: + unsigned int: A boolean for the queried capability indicating that feature is available. + + .. seealso:: `nvmlDeviceGetNvLinkCapability` + """ + cdef unsigned int cap_result + with nogil: + __status__ = nvmlDeviceGetNvLinkCapability(device, link, <_NvLinkCapability>capability, &cap_result) + check_status(__status__) + return cap_result + + +cpdef object device_get_nvlink_remote_pci_info_v2(intptr_t device, unsigned int link): + """Retrieves the PCI information for the remote node on a NvLink link Note: pciSubSystemId is not filled in this function and is indeterminate. + + Args: + device (intptr_t): The identifier of the target device. + link (unsigned int): Specifies the NvLink link to be queried. + + Returns: + nvmlPciInfo_t: ``nvmlPciInfo_t`` of the remote node for the specified link. + + .. seealso:: `nvmlDeviceGetNvLinkRemotePciInfo_v2` + """ + cdef PciInfo pci_py = PciInfo() + cdef nvmlPciInfo_t *pci = (pci_py._get_ptr()) + with nogil: + __status__ = nvmlDeviceGetNvLinkRemotePciInfo_v2(device, link, pci) + check_status(__status__) + return pci_py + + +cpdef unsigned long long device_get_nvlink_error_counter(intptr_t device, unsigned int link, int counter) except? 0: + """Retrieves the specified error counter value Please refer to ``nvmlNvLinkErrorCounter_t`` for error counters that are available. + + Args: + device (intptr_t): The identifier of the target device. + link (unsigned int): Specifies the NvLink link to be queried. + counter (NvLinkErrorCounter): Specifies the NvLink counter to be queried. + + Returns: + unsigned long long: Returned counter value. + + .. seealso:: `nvmlDeviceGetNvLinkErrorCounter` + """ + cdef unsigned long long counter_value + with nogil: + __status__ = nvmlDeviceGetNvLinkErrorCounter(device, link, <_NvLinkErrorCounter>counter, &counter_value) + check_status(__status__) + return counter_value + + +cpdef device_reset_nvlink_error_counters(intptr_t device, unsigned int link): + """Resets all error counters to zero Please refer to ``nvmlNvLinkErrorCounter_t`` for the list of error counters that are reset. + + Args: + device (intptr_t): The identifier of the target device. + link (unsigned int): Specifies the NvLink link to be queried. + + .. seealso:: `nvmlDeviceResetNvLinkErrorCounters` + """ + with nogil: + __status__ = nvmlDeviceResetNvLinkErrorCounters(device, link) + check_status(__status__) + + +cpdef int device_get_nvlink_remote_device_type(intptr_t device, unsigned int link) except? -1: + """Get the NVLink device type of the remote device connected over the given link. + + Args: + device (intptr_t): The device handle of the target GPU. + link (unsigned int): The NVLink link index on the target GPU. + + Returns: + int: Pointer in which the output remote device type is returned. + + .. seealso:: `nvmlDeviceGetNvLinkRemoteDeviceType` + """ + cdef _IntNvLinkDeviceType p_nv_link_device_type + with nogil: + __status__ = nvmlDeviceGetNvLinkRemoteDeviceType(device, link, &p_nv_link_device_type) + check_status(__status__) + return p_nv_link_device_type + + +cpdef system_set_nvlink_bw_mode(unsigned int nvlink_bw_mode): + """Set the global nvlink bandwith mode. + + Args: + nvlink_bw_mode (unsigned int): nvlink bandwidth mode. + + .. seealso:: `nvmlSystemSetNvlinkBwMode` + """ + with nogil: + __status__ = nvmlSystemSetNvlinkBwMode(nvlink_bw_mode) + check_status(__status__) + + +cpdef unsigned int system_get_nvlink_bw_mode() except? 0: + """Get the global nvlink bandwith mode. + + Returns: + unsigned int: reference of nvlink bandwidth mode. + + .. seealso:: `nvmlSystemGetNvlinkBwMode` + """ + cdef unsigned int nvlink_bw_mode + with nogil: + __status__ = nvmlSystemGetNvlinkBwMode(&nvlink_bw_mode) + check_status(__status__) + return nvlink_bw_mode + + +cpdef object device_get_nvlink_supported_bw_modes(intptr_t device): + """Get the supported NvLink Reduced Bandwidth Modes of the device. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + nvmlNvlinkSupportedBwModes_v1_t: Reference to ``nvmlNvlinkSupportedBwModes_t``. + + .. seealso:: `nvmlDeviceGetNvlinkSupportedBwModes` + """ + cdef NvlinkSupportedBwModes_v1 supported_bw_mode_py = NvlinkSupportedBwModes_v1() + cdef nvmlNvlinkSupportedBwModes_t *supported_bw_mode = (supported_bw_mode_py._get_ptr()) + supported_bw_mode.version = NVML_VERSION_STRUCT(sizeof(nvmlNvlinkSupportedBwModes_v1_t), 1) + with nogil: + __status__ = nvmlDeviceGetNvlinkSupportedBwModes(device, supported_bw_mode) + check_status(__status__) + return supported_bw_mode_py + + +cpdef object device_get_nvlink_bw_mode(intptr_t device): + """Get the NvLink Reduced Bandwidth Mode for the device. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + nvmlNvlinkGetBwMode_v1_t: Reference to ``nvmlNvlinkGetBwMode_t``. + + .. seealso:: `nvmlDeviceGetNvlinkBwMode` + """ + cdef NvlinkGetBwMode_v1 get_bw_mode_py = NvlinkGetBwMode_v1() + cdef nvmlNvlinkGetBwMode_t *get_bw_mode = (get_bw_mode_py._get_ptr()) + get_bw_mode.version = NVML_VERSION_STRUCT(sizeof(nvmlNvlinkGetBwMode_v1_t), 1) + with nogil: + __status__ = nvmlDeviceGetNvlinkBwMode(device, get_bw_mode) + check_status(__status__) + return get_bw_mode_py + + +cpdef device_set_nvlink_bw_mode(intptr_t device, intptr_t set_bw_mode): + """Set the NvLink Reduced Bandwidth Mode for the device. + + Args: + device (intptr_t): The identifier of the target device. + set_bw_mode (intptr_t): Reference to ``nvmlNvlinkSetBwMode_t``. + + .. seealso:: `nvmlDeviceSetNvlinkBwMode` + """ + set_bw_mode.version = NVML_VERSION_STRUCT(sizeof(nvmlNvlinkSetBwMode_v1_t), 1) + with nogil: + __status__ = nvmlDeviceSetNvlinkBwMode(device, set_bw_mode) + check_status(__status__) + + +cpdef intptr_t event_set_create() except? 0: + """Create an empty set of events. Event set should be freed by ``nvmlEventSetFree``. + + Returns: + intptr_t: Reference in which to return the event handle. + + .. seealso:: `nvmlEventSetCreate` + """ + cdef EventSet set + with nogil: + __status__ = nvmlEventSetCreate(&set) + check_status(__status__) + return set + + +cpdef device_register_events(intptr_t device, unsigned long long event_types, intptr_t set): + """Starts recording of events on a specified devices and add the events to specified ``nvmlEventSet_t``. + + Args: + device (intptr_t): The identifier of the target device. + event_types (unsigned long long): Bitmask of ``Event Types`` to record. + set (intptr_t): Set to which add new event types. + + .. seealso:: `nvmlDeviceRegisterEvents` + """ + with nogil: + __status__ = nvmlDeviceRegisterEvents(device, event_types, set) + check_status(__status__) + + +cpdef unsigned long long device_get_supported_event_types(intptr_t device) except? 0: + """Returns information about events supported on device. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + unsigned long long: Reference in which to return bitmask of supported events. + + .. seealso:: `nvmlDeviceGetSupportedEventTypes` + """ + cdef unsigned long long event_types + with nogil: + __status__ = nvmlDeviceGetSupportedEventTypes(device, &event_types) + check_status(__status__) + return event_types + + +cpdef object event_set_wait_v2(intptr_t set, unsigned int timeoutms): + """Waits on events and delivers events. + + Args: + set (intptr_t): Reference to set of events to wait on. + timeoutms (unsigned int): Maximum amount of wait time in milliseconds for registered event. + + Returns: + nvmlEventData_t: Reference in which to return event data. + + .. seealso:: `nvmlEventSetWait_v2` + """ + cdef EventData data_py = EventData() + cdef nvmlEventData_t *data = (data_py._get_ptr()) + with nogil: + __status__ = nvmlEventSetWait_v2(set, data, timeoutms) + check_status(__status__) + return data_py + + +cpdef event_set_free(intptr_t set): + """Releases events in the set. + + Args: + set (intptr_t): Reference to events to be released. + + .. seealso:: `nvmlEventSetFree` + """ + with nogil: + __status__ = nvmlEventSetFree(set) + check_status(__status__) + + +cpdef device_modify_drain_state(intptr_t pci_info, int new_state): + """Modify the drain state of a GPU. This method forces a GPU to no longer accept new incoming requests. Any new NVML process will no longer see this GPU. Persistence mode for this GPU must be turned off before this call is made. Must be called as administrator. For Linux only. + + Args: + pci_info (intptr_t): The PCI address of the GPU drain state to be modified. + new_state (EnableState): The drain state that should be entered, see ``nvmlEnableState_t``. + + .. seealso:: `nvmlDeviceModifyDrainState` + """ + with nogil: + __status__ = nvmlDeviceModifyDrainState(pci_info, <_EnableState>new_state) + check_status(__status__) + + +cpdef int device_query_drain_state(intptr_t pci_info) except? -1: + """Query the drain state of a GPU. This method is used to check if a GPU is in a currently draining state. For Linux only. + + Args: + pci_info (intptr_t): The PCI address of the GPU drain state to be queried. + + Returns: + int: The current drain state for this GPU, see ``nvmlEnableState_t``. + + .. seealso:: `nvmlDeviceQueryDrainState` + """ + cdef _EnableState current_state + with nogil: + __status__ = nvmlDeviceQueryDrainState(pci_info, ¤t_state) + check_status(__status__) + return current_state + + +cpdef device_remove_gpu_v2(intptr_t pci_info, int gpu_state, int link_state): + """This method will remove the specified GPU from the view of both NVML and the NVIDIA kernel driver as long as no other processes are attached. If other processes are attached, this call will return NVML_ERROR_IN_USE and the GPU will be returned to its original "draining" state. Note: the only situation where a process can still be attached after :func:`device_modify_drain_state` is called to initiate the draining state is if that process was using, and is still using, a GPU before the call was made. Also note, persistence mode counts as an attachment to the GPU thus it must be disabled prior to this call. + + Args: + pci_info (intptr_t): The PCI address of the GPU to be removed. + gpu_state (DetachGpuState): Whether the GPU is to be removed, from the OS see ``nvmlDetachGpuState_t``. + link_state (PcieLinkState): Requested upstream PCIe link state, see ``nvmlPcieLinkState_t``. + + .. seealso:: `nvmlDeviceRemoveGpu_v2` + """ + with nogil: + __status__ = nvmlDeviceRemoveGpu_v2(pci_info, <_DetachGpuState>gpu_state, <_PcieLinkState>link_state) + check_status(__status__) + + +cpdef device_discover_gpus(intptr_t pci_info): + """Request the OS and the NVIDIA kernel driver to rediscover a portion of the PCI subsystem looking for GPUs that were previously removed. The portion of the PCI tree can be narrowed by specifying a domain, bus, and device. If all are zeroes then the entire PCI tree will be searched. Please note that for long-running NVML processes the enumeration will change based on how many GPUs are discovered and where they are inserted in bus order. + + Args: + pci_info (intptr_t): The PCI tree to be searched. Only the domain, bus, and device fields are used in this call. + + .. seealso:: `nvmlDeviceDiscoverGpus` + """ + with nogil: + __status__ = nvmlDeviceDiscoverGpus(pci_info) + check_status(__status__) + + +cpdef int device_get_virtualization_mode(intptr_t device) except? -1: + """This method is used to get the virtualization mode corresponding to the GPU. + + Args: + device (intptr_t): Identifier of the target device. + + Returns: + int: Reference to virtualization mode. One of NVML_GPU_VIRTUALIZATION_?. + + .. seealso:: `nvmlDeviceGetVirtualizationMode` + """ + cdef _GpuVirtualizationMode p_virtual_mode + with nogil: + __status__ = nvmlDeviceGetVirtualizationMode(device, &p_virtual_mode) + check_status(__status__) + return p_virtual_mode + + +cpdef int device_get_host_vgpu_mode(intptr_t device) except? -1: + """Queries if SR-IOV host operation is supported on a vGPU supported device. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + int: Reference in which to return the current vGPU mode. + + .. seealso:: `nvmlDeviceGetHostVgpuMode` + """ + cdef _HostVgpuMode p_host_vgpu_mode + with nogil: + __status__ = nvmlDeviceGetHostVgpuMode(device, &p_host_vgpu_mode) + check_status(__status__) + return p_host_vgpu_mode + + +cpdef device_set_virtualization_mode(intptr_t device, int virtual_mode): + """This method is used to set the virtualization mode corresponding to the GPU. + + Args: + device (intptr_t): Identifier of the target device. + virtual_mode (GpuVirtualizationMode): virtualization mode. One of NVML_GPU_VIRTUALIZATION_?. + + .. seealso:: `nvmlDeviceSetVirtualizationMode` + """ + with nogil: + __status__ = nvmlDeviceSetVirtualizationMode(device, <_GpuVirtualizationMode>virtual_mode) + check_status(__status__) + + +cpdef unsigned long long vgpu_type_get_gsp_heap_size(unsigned int vgpu_type_id) except? 0: + """Retrieve the static GSP heap size of the vGPU type in bytes. + + Args: + vgpu_type_id (unsigned int): Handle to vGPU type. + + Returns: + unsigned long long: Reference to return the GSP heap size value. + + .. seealso:: `nvmlVgpuTypeGetGspHeapSize` + """ + cdef unsigned long long gsp_heap_size + with nogil: + __status__ = nvmlVgpuTypeGetGspHeapSize(vgpu_type_id, &gsp_heap_size) + check_status(__status__) + return gsp_heap_size + + +cpdef unsigned long long vgpu_type_get_fb_reservation(unsigned int vgpu_type_id) except? 0: + """Retrieve the static framebuffer reservation of the vGPU type in bytes. + + Args: + vgpu_type_id (unsigned int): Handle to vGPU type. + + Returns: + unsigned long long: Reference to return the framebuffer reservation. + + .. seealso:: `nvmlVgpuTypeGetFbReservation` + """ + cdef unsigned long long fb_reservation + with nogil: + __status__ = nvmlVgpuTypeGetFbReservation(vgpu_type_id, &fb_reservation) + check_status(__status__) + return fb_reservation + + +cpdef device_set_vgpu_capabilities(intptr_t device, int capability, int state): + """Set the desirable vGPU capability of a device. + + Args: + device (intptr_t): The identifier of the target device. + capability (DeviceVgpuCapability): Specifies the ``nvmlDeviceVgpuCapability_t`` to be set. + state (EnableState): The target capability mode. + + .. seealso:: `nvmlDeviceSetVgpuCapabilities` + """ + with nogil: + __status__ = nvmlDeviceSetVgpuCapabilities(device, <_DeviceVgpuCapability>capability, <_EnableState>state) + check_status(__status__) + + +cpdef object device_get_grid_licensable_features_v4(intptr_t device): + """Retrieve the vGPU Software licensable features. + + Args: + device (intptr_t): Identifier of the target device. + + Returns: + nvmlGridLicensableFeatures_t: Pointer to structure in which vGPU software licensable features are returned. + + .. seealso:: `nvmlDeviceGetGridLicensableFeatures_v4` + """ + cdef GridLicensableFeatures p_grid_licensable_features_py = GridLicensableFeatures() + cdef nvmlGridLicensableFeatures_t *p_grid_licensable_features = (p_grid_licensable_features_py._get_ptr()) + with nogil: + __status__ = nvmlDeviceGetGridLicensableFeatures_v4(device, p_grid_licensable_features) + check_status(__status__) + return p_grid_licensable_features_py + + +cpdef unsigned int get_vgpu_driver_capabilities(int capability) except? 0: + """Retrieve the requested vGPU driver capability. + + Args: + capability (VgpuDriverCapability): Specifies the ``nvmlVgpuDriverCapability_t`` to be queried. + + Returns: + unsigned int: A boolean for the queried capability indicating that feature is supported. + + .. seealso:: `nvmlGetVgpuDriverCapabilities` + """ + cdef unsigned int cap_result + with nogil: + __status__ = nvmlGetVgpuDriverCapabilities(<_VgpuDriverCapability>capability, &cap_result) + check_status(__status__) + return cap_result + + +cpdef unsigned int device_get_vgpu_capabilities(intptr_t device, int capability) except? 0: + """Retrieve the requested vGPU capability for GPU. + + Args: + device (intptr_t): The identifier of the target device. + capability (DeviceVgpuCapability): Specifies the ``nvmlDeviceVgpuCapability_t`` to be queried. + + Returns: + unsigned int: Specifies that the queried capability is supported, and also returns capability's data. + + .. seealso:: `nvmlDeviceGetVgpuCapabilities` + """ + cdef unsigned int cap_result + with nogil: + __status__ = nvmlDeviceGetVgpuCapabilities(device, <_DeviceVgpuCapability>capability, &cap_result) + check_status(__status__) + return cap_result + + +cpdef str vgpu_type_get_class(unsigned int vgpu_type_id): + """Retrieve the class of a vGPU type. It will not exceed 64 characters in length (including the NUL terminator). See nvmlConstants::NVML_DEVICE_NAME_BUFFER_SIZE. + + Args: + vgpu_type_id (unsigned int): Handle to vGPU type. + + Returns: + char: Pointer to string array to return class in. + + .. seealso:: `nvmlVgpuTypeGetClass` + """ + cdef unsigned int[1] size = [0] + with nogil: + __status__ = nvmlVgpuTypeGetClass(vgpu_type_id, NULL, size) + check_status_size(__status__) + if size[0] == 0: + return "" + cdef bytes _vgpu_type_class_ = bytes(size[0]) + cdef char* vgpu_type_class = _vgpu_type_class_ + with nogil: + __status__ = nvmlVgpuTypeGetClass(vgpu_type_id, vgpu_type_class, size) + check_status(__status__) + return _cyb_cpython.PyUnicode_FromString(vgpu_type_class) + + +cpdef unsigned int vgpu_type_get_gpu_instance_profile_id(unsigned int vgpu_type_id) except? 0: + """Retrieve the GPU Instance Profile ID for the given vGPU type ID. The API will return a valid GPU Instance Profile ID for the MIG capable vGPU types, else INVALID_GPU_INSTANCE_PROFILE_ID is returned. + + Args: + vgpu_type_id (unsigned int): Handle to vGPU type. + + Returns: + unsigned int: GPU Instance Profile ID. + + .. seealso:: `nvmlVgpuTypeGetGpuInstanceProfileId` + """ + cdef unsigned int gpu_instance_profile_id + with nogil: + __status__ = nvmlVgpuTypeGetGpuInstanceProfileId(vgpu_type_id, &gpu_instance_profile_id) + check_status(__status__) + return gpu_instance_profile_id + + +cpdef tuple vgpu_type_get_device_id(unsigned int vgpu_type_id): + """Retrieve the device ID of a vGPU type. + + Args: + vgpu_type_id (unsigned int): Handle to vGPU type. + + Returns: + A 2-tuple containing: + + - unsigned long long: Device ID and vendor ID of the device contained in single 32 bit value. + - unsigned long long: Subsystem ID and subsystem vendor ID of the device contained in single 32 bit value. + + .. seealso:: `nvmlVgpuTypeGetDeviceID` + """ + cdef unsigned long long device_id + cdef unsigned long long subsystem_id + with nogil: + __status__ = nvmlVgpuTypeGetDeviceID(vgpu_type_id, &device_id, &subsystem_id) + check_status(__status__) + return (device_id, subsystem_id) + + +cpdef unsigned long long vgpu_type_get_framebuffer_size(unsigned int vgpu_type_id) except? 0: + """Retrieve the vGPU framebuffer size in bytes. + + Args: + vgpu_type_id (unsigned int): Handle to vGPU type. + + Returns: + unsigned long long: Pointer to framebuffer size in bytes. + + .. seealso:: `nvmlVgpuTypeGetFramebufferSize` + """ + cdef unsigned long long fb_size + with nogil: + __status__ = nvmlVgpuTypeGetFramebufferSize(vgpu_type_id, &fb_size) + check_status(__status__) + return fb_size + + +cpdef unsigned int vgpu_type_get_num_display_heads(unsigned int vgpu_type_id) except? 0: + """Retrieve count of vGPU's supported display heads. + + Args: + vgpu_type_id (unsigned int): Handle to vGPU type. + + Returns: + unsigned int: Pointer to number of display heads. + + .. seealso:: `nvmlVgpuTypeGetNumDisplayHeads` + """ + cdef unsigned int num_display_heads + with nogil: + __status__ = nvmlVgpuTypeGetNumDisplayHeads(vgpu_type_id, &num_display_heads) + check_status(__status__) + return num_display_heads + + +cpdef tuple vgpu_type_get_resolution(unsigned int vgpu_type_id, unsigned int display_index): + """Retrieve vGPU display head's maximum supported resolution. + + Args: + vgpu_type_id (unsigned int): Handle to vGPU type. + display_index (unsigned int): Zero-based index of display head. + + Returns: + A 2-tuple containing: + + - unsigned int: Pointer to maximum number of pixels in X dimension. + - unsigned int: Pointer to maximum number of pixels in Y dimension. + + .. seealso:: `nvmlVgpuTypeGetResolution` + """ + cdef unsigned int xdim + cdef unsigned int ydim + with nogil: + __status__ = nvmlVgpuTypeGetResolution(vgpu_type_id, display_index, &xdim, &ydim) + check_status(__status__) + return (xdim, ydim) + + +cpdef str vgpu_type_get_license(unsigned int vgpu_type_id): + """Retrieve license requirements for a vGPU type. + + Args: + vgpu_type_id (unsigned int): Handle to vGPU type. + + Returns: + char: Pointer to buffer to return license info. + + .. seealso:: `nvmlVgpuTypeGetLicense` + """ + cdef unsigned int size = 128 + cdef char[128] vgpu_type_license_string + with nogil: + __status__ = nvmlVgpuTypeGetLicense(vgpu_type_id, vgpu_type_license_string, size) + check_status(__status__) + return _cyb_cpython.PyUnicode_FromString(vgpu_type_license_string) + + +cpdef unsigned int vgpu_type_get_frame_rate_limit(unsigned int vgpu_type_id) except? 0: + """Retrieve the static frame rate limit value of the vGPU type. + + Args: + vgpu_type_id (unsigned int): Handle to vGPU type. + + Returns: + unsigned int: Reference to return the frame rate limit value. + + .. seealso:: `nvmlVgpuTypeGetFrameRateLimit` + """ + cdef unsigned int frame_rate_limit + with nogil: + __status__ = nvmlVgpuTypeGetFrameRateLimit(vgpu_type_id, &frame_rate_limit) + check_status(__status__) + return frame_rate_limit + + +cpdef unsigned int vgpu_type_get_max_instances(intptr_t device, unsigned int vgpu_type_id) except? 0: + """Retrieve the maximum number of vGPU instances creatable on a device for given vGPU type. + + Args: + device (intptr_t): The identifier of the target device. + vgpu_type_id (unsigned int): Handle to vGPU type. + + Returns: + unsigned int: Pointer to get the max number of vGPU instances that can be created on a deicve for given vgpu_type_id. + + .. seealso:: `nvmlVgpuTypeGetMaxInstances` + """ + cdef unsigned int vgpu_instance_count + with nogil: + __status__ = nvmlVgpuTypeGetMaxInstances(device, vgpu_type_id, &vgpu_instance_count) + check_status(__status__) + return vgpu_instance_count + + +cpdef unsigned int vgpu_type_get_max_instances_per_vm(unsigned int vgpu_type_id) except? 0: + """Retrieve the maximum number of vGPU instances supported per VM for given vGPU type. + + Args: + vgpu_type_id (unsigned int): Handle to vGPU type. + + Returns: + unsigned int: Pointer to get the max number of vGPU instances supported per VM for given ``vgpu_type_id``. + + .. seealso:: `nvmlVgpuTypeGetMaxInstancesPerVm` + """ + cdef unsigned int vgpu_instance_count_per_vm + with nogil: + __status__ = nvmlVgpuTypeGetMaxInstancesPerVm(vgpu_type_id, &vgpu_instance_count_per_vm) + check_status(__status__) + return vgpu_instance_count_per_vm + + +cpdef object vgpu_type_get_bar1_info(unsigned int vgpu_type_id): + """Retrieve the BAR1 info for given vGPU type. + + Args: + vgpu_type_id (unsigned int): Handle to vGPU type. + + Returns: + nvmlVgpuTypeBar1Info_v1_t: Pointer to the vGPU type BAR1 information structure ``nvmlVgpuTypeBar1Info_t``. + + .. seealso:: `nvmlVgpuTypeGetBAR1Info` + """ + cdef VgpuTypeBar1Info_v1 bar1info_py = VgpuTypeBar1Info_v1() + cdef nvmlVgpuTypeBar1Info_t *bar1info = (bar1info_py._get_ptr()) + bar1info.version = NVML_VERSION_STRUCT(sizeof(nvmlVgpuTypeBar1Info_v1_t), 1) + with nogil: + __status__ = nvmlVgpuTypeGetBAR1Info(vgpu_type_id, bar1info) + check_status(__status__) + return bar1info_py + + +cpdef str vgpu_instance_get_uuid(unsigned int vgpu_instance): + """Retrieve the UUID of a vGPU instance. + + Args: + vgpu_instance (unsigned int): Identifier of the target vGPU instance. + + Returns: + char: Pointer to caller-supplied buffer to hold vGPU UUID. + + .. seealso:: `nvmlVgpuInstanceGetUUID` + """ + cdef unsigned int size = 80 + cdef char[80] uuid + with nogil: + __status__ = nvmlVgpuInstanceGetUUID(vgpu_instance, uuid, size) + check_status(__status__) + return _cyb_cpython.PyUnicode_FromString(uuid) + + +cpdef str vgpu_instance_get_vm_driver_version(unsigned int vgpu_instance): + """Retrieve the NVIDIA driver version installed in the VM associated with a vGPU. + + Args: + vgpu_instance (unsigned int): Identifier of the target vGPU instance. + + Returns: + char: Caller-supplied buffer to return driver version string. + + .. seealso:: `nvmlVgpuInstanceGetVmDriverVersion` + """ + cdef unsigned int length = 80 + cdef char[80] version + with nogil: + __status__ = nvmlVgpuInstanceGetVmDriverVersion(vgpu_instance, version, length) + check_status(__status__) + return _cyb_cpython.PyUnicode_FromString(version) + + +cpdef unsigned long long vgpu_instance_get_fb_usage(unsigned int vgpu_instance) except? 0: + """Retrieve the framebuffer usage in bytes. + + Args: + vgpu_instance (unsigned int): The identifier of the target instance. + + Returns: + unsigned long long: Pointer to framebuffer usage in bytes. + + .. seealso:: `nvmlVgpuInstanceGetFbUsage` + """ + cdef unsigned long long fb_usage + with nogil: + __status__ = nvmlVgpuInstanceGetFbUsage(vgpu_instance, &fb_usage) + check_status(__status__) + return fb_usage + + +cpdef unsigned int vgpu_instance_get_license_status(unsigned int vgpu_instance) except? 0: + """[Deprecated]. + + Args: + vgpu_instance (unsigned int): Identifier of the target vGPU instance. + + Returns: + unsigned int: Reference to return the licensing status. + + .. seealso:: `nvmlVgpuInstanceGetLicenseStatus` + """ + cdef unsigned int licensed + with nogil: + __status__ = nvmlVgpuInstanceGetLicenseStatus(vgpu_instance, &licensed) + check_status(__status__) + return licensed + + +cpdef unsigned int vgpu_instance_get_type(unsigned int vgpu_instance) except? 0: + """Retrieve the vGPU type of a vGPU instance. + + Args: + vgpu_instance (unsigned int): Identifier of the target vGPU instance. + + Returns: + unsigned int: Reference to return the vgpu_type_id. + + .. seealso:: `nvmlVgpuInstanceGetType` + """ + cdef nvmlVgpuTypeId_t vgpu_type_id + with nogil: + __status__ = nvmlVgpuInstanceGetType(vgpu_instance, &vgpu_type_id) + check_status(__status__) + return vgpu_type_id + + +cpdef unsigned int vgpu_instance_get_frame_rate_limit(unsigned int vgpu_instance) except? 0: + """Retrieve the frame rate limit set for the vGPU instance. + + Args: + vgpu_instance (unsigned int): Identifier of the target vGPU instance. + + Returns: + unsigned int: Reference to return the frame rate limit. + + .. seealso:: `nvmlVgpuInstanceGetFrameRateLimit` + """ + cdef unsigned int frame_rate_limit + with nogil: + __status__ = nvmlVgpuInstanceGetFrameRateLimit(vgpu_instance, &frame_rate_limit) + check_status(__status__) + return frame_rate_limit + + +cpdef int vgpu_instance_get_ecc_mode(unsigned int vgpu_instance) except? -1: + """Retrieve the current ECC mode of vGPU instance. + + Args: + vgpu_instance (unsigned int): The identifier of the target vGPU instance. + + Returns: + int: Reference in which to return the current ECC mode. + + .. seealso:: `nvmlVgpuInstanceGetEccMode` + """ + cdef _EnableState ecc_mode + with nogil: + __status__ = nvmlVgpuInstanceGetEccMode(vgpu_instance, &ecc_mode) + check_status(__status__) + return ecc_mode + + +cpdef unsigned int vgpu_instance_get_encoder_capacity(unsigned int vgpu_instance) except? 0: + """Retrieve the encoder capacity of a vGPU instance, as a percentage of maximum encoder capacity with valid values in the range 0-100. + + Args: + vgpu_instance (unsigned int): Identifier of the target vGPU instance. + + Returns: + unsigned int: Reference to an unsigned int for the encoder capacity. + + .. seealso:: `nvmlVgpuInstanceGetEncoderCapacity` + """ + cdef unsigned int encoder_capacity + with nogil: + __status__ = nvmlVgpuInstanceGetEncoderCapacity(vgpu_instance, &encoder_capacity) + check_status(__status__) + return encoder_capacity + + +cpdef vgpu_instance_set_encoder_capacity(unsigned int vgpu_instance, unsigned int encoder_capacity): + """Set the encoder capacity of a vGPU instance, as a percentage of maximum encoder capacity with valid values in the range 0-100. + + Args: + vgpu_instance (unsigned int): Identifier of the target vGPU instance. + encoder_capacity (unsigned int): Unsigned int for the encoder capacity value. + + .. seealso:: `nvmlVgpuInstanceSetEncoderCapacity` + """ + with nogil: + __status__ = nvmlVgpuInstanceSetEncoderCapacity(vgpu_instance, encoder_capacity) + check_status(__status__) + + +cpdef tuple vgpu_instance_get_encoder_stats(unsigned int vgpu_instance): + """Retrieves the current encoder statistics of a vGPU Instance. + + Args: + vgpu_instance (unsigned int): Identifier of the target vGPU instance. + + Returns: + A 3-tuple containing: + + - unsigned int: Reference to an unsigned int for count of active encoder sessions. + - unsigned int: Reference to an unsigned int for trailing average FPS of all active sessions. + - unsigned int: Reference to an unsigned int for encode latency in microseconds. + + .. seealso:: `nvmlVgpuInstanceGetEncoderStats` + """ + cdef unsigned int session_count + cdef unsigned int average_fps + cdef unsigned int average_latency + with nogil: + __status__ = nvmlVgpuInstanceGetEncoderStats(vgpu_instance, &session_count, &average_fps, &average_latency) + check_status(__status__) + return (session_count, average_fps, average_latency) + + +cpdef object vgpu_instance_get_encoder_sessions(unsigned int vgpu_instance): + """Retrieves information about all active encoder sessions on a vGPU Instance. + + Args: + vgpu_instance (unsigned int): Identifier of the target vGPU instance. + + Returns: + nvmlEncoderSessionInfo_t: Reference to caller supplied array in which the list of session information us returned. + + .. seealso:: `nvmlVgpuInstanceGetEncoderSessions` + """ + cdef unsigned int[1] session_count = [0] + with nogil: + __status__ = nvmlVgpuInstanceGetEncoderSessions(vgpu_instance, session_count, NULL) + check_status_size(__status__) + cdef EncoderSessionInfo session_info = EncoderSessionInfo(session_count[0]) + cdef nvmlEncoderSessionInfo_t *session_info_ptr = (session_info._get_ptr()) + if session_count[0] == 0: + return session_info + with nogil: + __status__ = nvmlVgpuInstanceGetEncoderSessions(vgpu_instance, session_count, session_info_ptr) + check_status(__status__) + return session_info + + +cpdef object vgpu_instance_get_fbc_stats(unsigned int vgpu_instance): + """Retrieves the active frame buffer capture sessions statistics of a vGPU Instance. + + Args: + vgpu_instance (unsigned int): Identifier of the target vGPU instance. + + Returns: + nvmlFBCStats_t: Reference to ``nvmlFBCStats_t`` structure containing NvFBC stats. + + .. seealso:: `nvmlVgpuInstanceGetFBCStats` + """ + cdef FBCStats fbc_stats_py = FBCStats() + cdef nvmlFBCStats_t *fbc_stats = (fbc_stats_py._get_ptr()) + with nogil: + __status__ = nvmlVgpuInstanceGetFBCStats(vgpu_instance, fbc_stats) + check_status(__status__) + return fbc_stats_py + + +cpdef object vgpu_instance_get_fbc_sessions(unsigned int vgpu_instance): + """Retrieves information about active frame buffer capture sessions on a vGPU Instance. + + Args: + vgpu_instance (unsigned int): Identifier of the target vGPU instance. + + Returns: + nvmlFBCSessionInfo_t: Reference in which to return the session information. + + .. seealso:: `nvmlVgpuInstanceGetFBCSessions` + """ + cdef unsigned int[1] session_count = [0] + with nogil: + __status__ = nvmlVgpuInstanceGetFBCSessions(vgpu_instance, session_count, NULL) + check_status_size(__status__) + cdef FBCSessionInfo session_info = FBCSessionInfo(session_count[0]) + cdef nvmlFBCSessionInfo_t *session_info_ptr = (session_info._get_ptr()) + if session_count[0] == 0: + return session_info + with nogil: + __status__ = nvmlVgpuInstanceGetFBCSessions(vgpu_instance, session_count, session_info_ptr) + check_status(__status__) + return session_info + + +cpdef unsigned int vgpu_instance_get_gpu_instance_id(unsigned int vgpu_instance) except? 0: + """Retrieve the GPU Instance ID for the given vGPU Instance. The API will return a valid GPU Instance ID for MIG backed vGPU Instance, else INVALID_GPU_INSTANCE_ID is returned. + + Args: + vgpu_instance (unsigned int): Identifier of the target vGPU instance. + + Returns: + unsigned int: GPU Instance ID. + + .. seealso:: `nvmlVgpuInstanceGetGpuInstanceId` + """ + cdef unsigned int gpu_instance_id + with nogil: + __status__ = nvmlVgpuInstanceGetGpuInstanceId(vgpu_instance, &gpu_instance_id) + check_status(__status__) + return gpu_instance_id + + +cpdef str vgpu_instance_get_gpu_pci_id(unsigned int vgpu_instance): + """Retrieves the PCI Id of the given vGPU Instance i.e. the PCI Id of the GPU as seen inside the VM. + + Args: + vgpu_instance (unsigned int): Identifier of the target vGPU instance. + + Returns: + char: Caller-supplied buffer to return vGPU PCI Id string. + + .. seealso:: `nvmlVgpuInstanceGetGpuPciId` + """ + cdef unsigned int[1] length = [0] + with nogil: + __status__ = nvmlVgpuInstanceGetGpuPciId(vgpu_instance, NULL, length) + check_status_size(__status__) + if length[0] == 0: + return "" + cdef bytes _vgpu_pci_id_ = bytes(length[0]) + cdef char* vgpu_pci_id = _vgpu_pci_id_ + with nogil: + __status__ = nvmlVgpuInstanceGetGpuPciId(vgpu_instance, vgpu_pci_id, length) + check_status(__status__) + return _cyb_cpython.PyUnicode_FromString(vgpu_pci_id) + + +cpdef unsigned int vgpu_type_get_capabilities(unsigned int vgpu_type_id, int capability) except? 0: + """Retrieve the requested capability for a given vGPU type. Refer to the ``nvmlVgpuCapability_t`` structure for the specific capabilities that can be queried. The return value in ``cap_result`` should be treated as a boolean, with a non-zero value indicating that the capability is supported. + + Args: + vgpu_type_id (unsigned int): Handle to vGPU type. + capability (VgpuCapability): Specifies the ``nvmlVgpuCapability_t`` to be queried. + + Returns: + unsigned int: A boolean for the queried capability indicating that feature is supported. + + .. seealso:: `nvmlVgpuTypeGetCapabilities` + """ + cdef unsigned int cap_result + with nogil: + __status__ = nvmlVgpuTypeGetCapabilities(vgpu_type_id, <_VgpuCapability>capability, &cap_result) + check_status(__status__) + return cap_result + + +cpdef str vgpu_instance_get_mdev_uuid(unsigned int vgpu_instance): + """Retrieve the MDEV UUID of a vGPU instance. + + Args: + vgpu_instance (unsigned int): Identifier of the target vGPU instance. + + Returns: + char: Pointer to caller-supplied buffer to hold MDEV UUID. + + .. seealso:: `nvmlVgpuInstanceGetMdevUUID` + """ + cdef unsigned int size = 80 + cdef char[80] mdev_uuid + with nogil: + __status__ = nvmlVgpuInstanceGetMdevUUID(vgpu_instance, mdev_uuid, size) + check_status(__status__) + return _cyb_cpython.PyUnicode_FromString(mdev_uuid) + + +cpdef gpu_instance_set_vgpu_scheduler_state(intptr_t gpu_instance, intptr_t p_scheduler): + """Set vGPU scheduler state for the given GPU instance. + + Args: + gpu_instance (intptr_t): The GPU instance handle. + p_scheduler (intptr_t): Pointer to the caller-provided structure of ``nvmlVgpuSchedulerState_t``. + + .. seealso:: `nvmlGpuInstanceSetVgpuSchedulerState` + """ + (p_scheduler).version = NVML_VERSION_STRUCT(sizeof(nvmlVgpuSchedulerState_v1_t), 1) + with nogil: + __status__ = nvmlGpuInstanceSetVgpuSchedulerState(gpu_instance, p_scheduler) + check_status(__status__) + + +cpdef object gpu_instance_get_vgpu_scheduler_state(intptr_t gpu_instance): + """Returns the vGPU scheduler state for the given GPU instance. The information returned in ``nvmlVgpuSchedulerStateInfo_t`` is not relevant if the BEST EFFORT policy is set. + + Args: + gpu_instance (intptr_t): The GPU instance handle. + + Returns: + nvmlVgpuSchedulerStateInfo_v1_t: Reference in which ``p_scheduler_state_info`` is returned. + + .. seealso:: `nvmlGpuInstanceGetVgpuSchedulerState` + """ + cdef VgpuSchedulerStateInfo_v1 p_scheduler_state_info_py = VgpuSchedulerStateInfo_v1() + cdef nvmlVgpuSchedulerStateInfo_t *p_scheduler_state_info = (p_scheduler_state_info_py._get_ptr()) + p_scheduler_state_info.version = NVML_VERSION_STRUCT(sizeof(nvmlVgpuSchedulerState_v1_t), 1) + with nogil: + __status__ = nvmlGpuInstanceGetVgpuSchedulerState(gpu_instance, p_scheduler_state_info) + check_status(__status__) + return p_scheduler_state_info_py + + +cpdef object gpu_instance_get_vgpu_scheduler_log(intptr_t gpu_instance): + """Returns the vGPU scheduler logs for the given GPU instance. ``p_scheduler_log_info`` points to a caller-allocated structure to contain the logs. The number of elements returned will never exceed ``NVML_SCHEDULER_SW_MAX_LOG_ENTRIES``. + + Args: + gpu_instance (intptr_t): The GPU instance handle. + + Returns: + nvmlVgpuSchedulerLogInfo_v1_t: Reference in which ``p_scheduler_log_info`` is written. + + .. seealso:: `nvmlGpuInstanceGetVgpuSchedulerLog` + """ + cdef VgpuSchedulerLogInfo_v1 p_scheduler_log_info_py = VgpuSchedulerLogInfo_v1() + cdef nvmlVgpuSchedulerLogInfo_t *p_scheduler_log_info = (p_scheduler_log_info_py._get_ptr()) + p_scheduler_log_info.version = NVML_VERSION_STRUCT(sizeof(nvmlVgpuSchedulerLogInfo_v1_t), 1) + with nogil: + __status__ = nvmlGpuInstanceGetVgpuSchedulerLog(gpu_instance, p_scheduler_log_info) + check_status(__status__) + return p_scheduler_log_info_py + + +cpdef str device_get_pgpu_metadata_string(intptr_t device): + """Returns the properties of the physical GPU indicated by the device in an ascii-encoded string format. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + char: Pointer to caller-supplied buffer into which ``pgpu_metadata`` is written. + + .. seealso:: `nvmlDeviceGetPgpuMetadataString` + """ + cdef unsigned int[1] buffer_size = [0] + with nogil: + __status__ = nvmlDeviceGetPgpuMetadataString(device, NULL, buffer_size) + check_status_size(__status__) + if buffer_size[0] == 0: + return "" + cdef bytes _pgpu_metadata_ = bytes(buffer_size[0]) + cdef char* pgpu_metadata = _pgpu_metadata_ + with nogil: + __status__ = nvmlDeviceGetPgpuMetadataString(device, pgpu_metadata, buffer_size) + check_status(__status__) + return _cyb_cpython.PyUnicode_FromString(pgpu_metadata) + + +cpdef object device_get_vgpu_scheduler_log(intptr_t device): + """Returns the vGPU Software scheduler logs. ``p_scheduler_log`` points to a caller-allocated structure to contain the logs. The number of elements returned will never exceed ``NVML_SCHEDULER_SW_MAX_LOG_ENTRIES``. + + Args: + device (intptr_t): The identifier of the target ``device``. + + Returns: + nvmlVgpuSchedulerLog_t: Reference in which ``p_scheduler_log`` is written. + + .. seealso:: `nvmlDeviceGetVgpuSchedulerLog` + """ + cdef VgpuSchedulerLog p_scheduler_log_py = VgpuSchedulerLog() + cdef nvmlVgpuSchedulerLog_t *p_scheduler_log = (p_scheduler_log_py._get_ptr()) + with nogil: + __status__ = nvmlDeviceGetVgpuSchedulerLog(device, p_scheduler_log) + check_status(__status__) + return p_scheduler_log_py + + +cpdef object device_get_vgpu_scheduler_state(intptr_t device): + """Returns the vGPU scheduler state. The information returned in ``nvmlVgpuSchedulerGetState_t`` is not relevant if the BEST EFFORT policy is set. + + Args: + device (intptr_t): The identifier of the target ``device``. + + Returns: + nvmlVgpuSchedulerGetState_t: Reference in which ``p_scheduler_state`` is returned. + + .. seealso:: `nvmlDeviceGetVgpuSchedulerState` + """ + cdef VgpuSchedulerGetState p_scheduler_state_py = VgpuSchedulerGetState() + cdef nvmlVgpuSchedulerGetState_t *p_scheduler_state = (p_scheduler_state_py._get_ptr()) + with nogil: + __status__ = nvmlDeviceGetVgpuSchedulerState(device, p_scheduler_state) + check_status(__status__) + return p_scheduler_state_py + + +cpdef object device_get_vgpu_scheduler_capabilities(intptr_t device): + """Returns the vGPU scheduler capabilities. The list of supported vGPU schedulers returned in ``nvmlVgpuSchedulerCapabilities_t`` is from the NVML_VGPU_SCHEDULER_POLICY_*. This list enumerates the supported scheduler policies if the engine is Graphics type. The other values in ``nvmlVgpuSchedulerCapabilities_t`` are also applicable if the engine is Graphics type. For other engine types, it is BEST EFFORT policy. If ARR is supported and enabled, scheduling frequency and averaging factor are applicable else timeSlice is applicable. + + Args: + device (intptr_t): The identifier of the target ``device``. + + Returns: + nvmlVgpuSchedulerCapabilities_t: Reference in which ``p_capabilities`` is written. + + .. seealso:: `nvmlDeviceGetVgpuSchedulerCapabilities` + """ + cdef VgpuSchedulerCapabilities p_capabilities_py = VgpuSchedulerCapabilities() + cdef nvmlVgpuSchedulerCapabilities_t *p_capabilities = (p_capabilities_py._get_ptr()) + with nogil: + __status__ = nvmlDeviceGetVgpuSchedulerCapabilities(device, p_capabilities) + check_status(__status__) + return p_capabilities_py + + +cpdef device_set_vgpu_scheduler_state(intptr_t device, intptr_t p_scheduler_state): + """Sets the vGPU scheduler state. + + Args: + device (intptr_t): The identifier of the target ``device``. + p_scheduler_state (intptr_t): vGPU ``p_scheduler_state`` to set. + + .. seealso:: `nvmlDeviceSetVgpuSchedulerState` + """ + with nogil: + __status__ = nvmlDeviceSetVgpuSchedulerState(device, p_scheduler_state) + check_status(__status__) + + +cpdef set_vgpu_version(intptr_t vgpu_version): + """Override the preset range of vGPU versions supported by the NVIDIA vGPU Manager with a range set by an administrator. + + Args: + vgpu_version (intptr_t): Pointer to a caller-supplied range of supported vGPU versions. + + .. seealso:: `nvmlSetVgpuVersion` + """ + with nogil: + __status__ = nvmlSetVgpuVersion(vgpu_version) + check_status(__status__) + + +cpdef tuple device_get_vgpu_process_utilization(intptr_t device, unsigned long long last_seen_time_stamp): + """Retrieves current utilization for processes running on vGPUs on a physical GPU (device). + + Args: + device (intptr_t): The identifier for the target device. + last_seen_time_stamp (unsigned long long): Return only samples with timestamp greater than last_seen_time_stamp. + + Returns: + A 2-tuple containing: + + - unsigned int: Pointer to caller-supplied array size, and returns number of processes running on vGPU instances. + - nvmlVgpuProcessUtilizationSample_t: Pointer to caller-supplied buffer in which vGPU sub process utilization samples are returned. + + .. seealso:: `nvmlDeviceGetVgpuProcessUtilization` + """ + cdef unsigned int vgpu_process_samples_count + cdef nvmlVgpuProcessUtilizationSample_t utilization_samples + with nogil: + __status__ = nvmlDeviceGetVgpuProcessUtilization(device, last_seen_time_stamp, &vgpu_process_samples_count, &utilization_samples) + check_status(__status__) + return (vgpu_process_samples_count, utilization_samples) + + +cpdef int vgpu_instance_get_accounting_mode(unsigned int vgpu_instance) except? -1: + """Queries the state of per process accounting mode on vGPU. + + Args: + vgpu_instance (unsigned int): The identifier of the target vGPU instance. + + Returns: + int: Reference in which to return the current accounting mode. + + .. seealso:: `nvmlVgpuInstanceGetAccountingMode` + """ + cdef _EnableState mode + with nogil: + __status__ = nvmlVgpuInstanceGetAccountingMode(vgpu_instance, &mode) + check_status(__status__) + return mode + + +cpdef object vgpu_instance_get_accounting_pids(unsigned int vgpu_instance): + """Queries list of processes running on vGPU that can be queried for accounting stats. The list of processes returned can be in running or terminated state. + + Args: + vgpu_instance (unsigned int): The identifier of the target vGPU instance. + + Returns: + unsigned int: Reference in which to return list of process ids. + + .. seealso:: `nvmlVgpuInstanceGetAccountingPids` + """ + cdef unsigned int[1] count = [0] + with nogil: + __status__ = nvmlVgpuInstanceGetAccountingPids(vgpu_instance, count, NULL) + check_status_size(__status__) + if count[0] == 0: + return _cyb_view.array(shape=(1,), itemsize=sizeof(unsigned int), format="I", mode="c")[:0] + cdef _cyb_view.array pids = _cyb_view.array(shape=(count[0],), itemsize=sizeof(unsigned int), format="I", mode="c") + cdef unsigned int *pids_ptr = (pids.data) + with nogil: + __status__ = nvmlVgpuInstanceGetAccountingPids(vgpu_instance, count, pids_ptr) + check_status(__status__) + return pids + + +cpdef object vgpu_instance_get_accounting_stats(unsigned int vgpu_instance, unsigned int pid): + """Queries process's accounting stats. + + Args: + vgpu_instance (unsigned int): The identifier of the target vGPU instance. + pid (unsigned int): Process Id of the target process to query stats for. + + Returns: + nvmlAccountingStats_t: Reference in which to return the process's accounting stats. + + .. seealso:: `nvmlVgpuInstanceGetAccountingStats` + """ + cdef AccountingStats stats_py = AccountingStats() + cdef nvmlAccountingStats_t *stats = (stats_py._get_ptr()) + with nogil: + __status__ = nvmlVgpuInstanceGetAccountingStats(vgpu_instance, pid, stats) + check_status(__status__) + return stats_py + + +cpdef vgpu_instance_clear_accounting_pids(unsigned int vgpu_instance): + """Clears accounting information of the vGPU instance that have already terminated. + + Args: + vgpu_instance (unsigned int): The identifier of the target vGPU instance. + + .. seealso:: `nvmlVgpuInstanceClearAccountingPids` + """ + with nogil: + __status__ = nvmlVgpuInstanceClearAccountingPids(vgpu_instance) + check_status(__status__) + + +cpdef object vgpu_instance_get_license_info_v2(unsigned int vgpu_instance): + """Query the license information of the vGPU instance. + + Args: + vgpu_instance (unsigned int): Identifier of the target vGPU instance. + + Returns: + nvmlVgpuLicenseInfo_t: Pointer to vGPU license information structure. + + .. seealso:: `nvmlVgpuInstanceGetLicenseInfo_v2` + """ + cdef VgpuLicenseInfo license_info_py = VgpuLicenseInfo() + cdef nvmlVgpuLicenseInfo_t *license_info = (license_info_py._get_ptr()) + with nogil: + __status__ = nvmlVgpuInstanceGetLicenseInfo_v2(vgpu_instance, license_info) + check_status(__status__) + return license_info_py + + +cpdef unsigned int get_excluded_device_count() except? 0: + """Retrieves the number of excluded GPU devices in the system. + + Returns: + unsigned int: Reference in which to return the number of excluded devices. + + .. seealso:: `nvmlGetExcludedDeviceCount` + """ + cdef unsigned int device_count + with nogil: + __status__ = nvmlGetExcludedDeviceCount(&device_count) + check_status(__status__) + return device_count + + +cpdef object get_excluded_device_info_by_index(unsigned int index): + """Acquire the device information for an excluded GPU device, based on its index. + + Args: + index (unsigned int): The index of the target GPU, >= 0 and < ``deviceCount``. + + Returns: + nvmlExcludedDeviceInfo_t: Reference in which to return the device information. + + .. seealso:: `nvmlGetExcludedDeviceInfoByIndex` + """ + cdef ExcludedDeviceInfo info_py = ExcludedDeviceInfo() + cdef nvmlExcludedDeviceInfo_t *info = (info_py._get_ptr()) + with nogil: + __status__ = nvmlGetExcludedDeviceInfoByIndex(index, info) + check_status(__status__) + return info_py + + +cpdef int device_set_mig_mode(intptr_t device, unsigned int mode) except? -1: + """Set MIG mode for the device. + + Args: + device (intptr_t): The identifier of the target device. + mode (unsigned int): The mode to be set, ``NVML_DEVICE_MIG_DISABLE`` or ``NVML_DEVICE_MIG_ENABLE``. + + Returns: + int: The activation_status status. + + .. seealso:: `nvmlDeviceSetMigMode` + """ + cdef _Return activation_status + with nogil: + __status__ = nvmlDeviceSetMigMode(device, mode, &activation_status) + check_status(__status__) + return activation_status + + +cpdef tuple device_get_mig_mode(intptr_t device): + """Get MIG mode for the device. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + A 2-tuple containing: + + - unsigned int: Returns the current mode, ``NVML_DEVICE_MIG_DISABLE`` or ``NVML_DEVICE_MIG_ENABLE``. + - unsigned int: Returns the pending mode, ``NVML_DEVICE_MIG_DISABLE`` or ``NVML_DEVICE_MIG_ENABLE``. + + .. seealso:: `nvmlDeviceGetMigMode` + """ + cdef unsigned int current_mode + cdef unsigned int pending_mode + with nogil: + __status__ = nvmlDeviceGetMigMode(device, ¤t_mode, &pending_mode) + check_status(__status__) + return (current_mode, pending_mode) + + +cpdef object device_get_gpu_instance_possible_placements_v2(intptr_t device, unsigned int profile_id): + """Get GPU instance placements. + + Args: + device (intptr_t): The identifier of the target device. + profile_id (unsigned int): The GPU instance profile ID. See ``nvmlDeviceGetGpuInstanceProfileInfo``. + + Returns: + nvmlGpuInstancePlacement_t: Returns placements allowed for the profile. Can be NULL to discover number of allowed placements for this profile. If non-NULL must be large enough to accommodate the placements supported by the profile. + + .. seealso:: `nvmlDeviceGetGpuInstancePossiblePlacements_v2` + """ + cdef unsigned int[1] count = [0] + with nogil: + __status__ = nvmlDeviceGetGpuInstancePossiblePlacements_v2(device, profile_id, NULL, count) + check_status_size(__status__) + cdef GpuInstancePlacement placements = GpuInstancePlacement(count[0]) + cdef nvmlGpuInstancePlacement_t *placements_ptr = (placements._get_ptr()) + if count[0] == 0: + return placements + with nogil: + __status__ = nvmlDeviceGetGpuInstancePossiblePlacements_v2(device, profile_id, placements_ptr, count) + check_status(__status__) + return placements + + +cpdef unsigned int device_get_gpu_instance_remaining_capacity(intptr_t device, unsigned int profile_id) except? 0: + """Get GPU instance profile capacity. + + Args: + device (intptr_t): The identifier of the target device. + profile_id (unsigned int): The GPU instance profile ID. See ``nvmlDeviceGetGpuInstanceProfileInfo``. + + Returns: + unsigned int: Returns remaining instance count for the profile ID. + + .. seealso:: `nvmlDeviceGetGpuInstanceRemainingCapacity` + """ + cdef unsigned int count + with nogil: + __status__ = nvmlDeviceGetGpuInstanceRemainingCapacity(device, profile_id, &count) + check_status(__status__) + return count + + +cpdef intptr_t device_create_gpu_instance(intptr_t device, unsigned int profile_id) except? 0: + """Create GPU instance. + + Args: + device (intptr_t): The identifier of the target device. + profile_id (unsigned int): The GPU instance profile ID. See ``nvmlDeviceGetGpuInstanceProfileInfo``. + + Returns: + intptr_t: Returns the GPU instance handle. + + .. seealso:: `nvmlDeviceCreateGpuInstance` + """ + cdef GpuInstance gpu_instance + with nogil: + __status__ = nvmlDeviceCreateGpuInstance(device, profile_id, &gpu_instance) + check_status(__status__) + return gpu_instance + + +cpdef intptr_t device_create_gpu_instance_with_placement(intptr_t device, unsigned int profile_id, intptr_t placement) except? 0: + """Create GPU instance with the specified placement. + + Args: + device (intptr_t): The identifier of the target device. + profile_id (unsigned int): The GPU instance profile ID. See ``nvmlDeviceGetGpuInstanceProfileInfo``. + placement (intptr_t): The requested placement. See ``nvmlDeviceGetGpuInstancePossiblePlacements_v2``. + + Returns: + intptr_t: Returns the GPU instance handle. + + .. seealso:: `nvmlDeviceCreateGpuInstanceWithPlacement` + """ + cdef GpuInstance gpu_instance + with nogil: + __status__ = nvmlDeviceCreateGpuInstanceWithPlacement(device, profile_id, placement, &gpu_instance) + check_status(__status__) + return gpu_instance + + +cpdef gpu_instance_destroy(intptr_t gpu_instance): + """Destroy GPU instance. + + Args: + gpu_instance (intptr_t): The GPU instance handle. + + .. seealso:: `nvmlGpuInstanceDestroy` + """ + with nogil: + __status__ = nvmlGpuInstanceDestroy(gpu_instance) + check_status(__status__) + + +cpdef intptr_t device_get_gpu_instance_by_id(intptr_t device, unsigned int id) except? 0: + """Get GPU instances for given instance ID. + + Args: + device (intptr_t): The identifier of the target device. + id (unsigned int): The GPU instance ID. + + Returns: + intptr_t: Returns GPU instance. + + .. seealso:: `nvmlDeviceGetGpuInstanceById` + """ + cdef GpuInstance gpu_instance + with nogil: + __status__ = nvmlDeviceGetGpuInstanceById(device, id, &gpu_instance) + check_status(__status__) + return gpu_instance + + +cpdef object gpu_instance_get_info(intptr_t gpu_instance): + """Get GPU instance information. + + Args: + gpu_instance (intptr_t): The GPU instance handle. + + Returns: + nvmlGpuInstanceInfo_t: Return GPU instance information. + + .. seealso:: `nvmlGpuInstanceGetInfo` + """ + cdef GpuInstanceInfo info_py = GpuInstanceInfo() + cdef nvmlGpuInstanceInfo_t *info = (info_py._get_ptr()) + with nogil: + __status__ = nvmlGpuInstanceGetInfo(gpu_instance, info) + check_status(__status__) + return info_py + + +cpdef object gpu_instance_get_compute_instance_profile_info_v(intptr_t gpu_instance, unsigned int profile, unsigned int eng_profile): + """Versioned wrapper around ``nvmlGpuInstanceGetComputeInstanceProfileInfo`` that accepts a versioned ``nvmlComputeInstanceProfileInfo_v2_t`` or later output structure. + + Args: + gpu_instance (intptr_t): The identifier of the target GPU instance. + profile (unsigned int): One of the NVML_COMPUTE_INSTANCE_PROFILE_*. + eng_profile (unsigned int): One of the NVML_COMPUTE_INSTANCE_ENGINE_PROFILE_*. + + Returns: + nvmlComputeInstanceProfileInfo_v2_t: Returns detailed profile information. + + .. seealso:: `nvmlGpuInstanceGetComputeInstanceProfileInfoV` + """ + cdef ComputeInstanceProfileInfo_v2 info_py = ComputeInstanceProfileInfo_v2() + cdef nvmlComputeInstanceProfileInfo_v2_t *info = (info_py._get_ptr()) + info.version = NVML_VERSION_STRUCT(sizeof(nvmlComputeInstanceProfileInfo_v2_t), 2) + with nogil: + __status__ = nvmlGpuInstanceGetComputeInstanceProfileInfoV(gpu_instance, profile, eng_profile, info) + check_status(__status__) + return info_py + + +cpdef unsigned int gpu_instance_get_compute_instance_remaining_capacity(intptr_t gpu_instance, unsigned int profile_id) except? 0: + """Get compute instance profile capacity. + + Args: + gpu_instance (intptr_t): The identifier of the target GPU instance. + profile_id (unsigned int): The compute instance profile ID. See ``nvmlGpuInstanceGetComputeInstanceProfileInfo``. + + Returns: + unsigned int: Returns remaining instance count for the profile ID. + + .. seealso:: `nvmlGpuInstanceGetComputeInstanceRemainingCapacity` + """ + cdef unsigned int count + with nogil: + __status__ = nvmlGpuInstanceGetComputeInstanceRemainingCapacity(gpu_instance, profile_id, &count) + check_status(__status__) + return count + + +cpdef object gpu_instance_get_compute_instance_possible_placements(intptr_t gpu_instance, unsigned int profile_id): + """Get compute instance placements. + + Args: + gpu_instance (intptr_t): The identifier of the target GPU instance. + profile_id (unsigned int): The compute instance profile ID. See ``nvmlGpuInstanceGetComputeInstanceProfileInfo``. + + Returns: + nvmlComputeInstancePlacement_t: Returns placements allowed for the profile. Can be NULL to discover number of allowed placements for this profile. If non-NULL must be large enough to accommodate the placements supported by the profile. + + .. seealso:: `nvmlGpuInstanceGetComputeInstancePossiblePlacements` + """ + cdef unsigned int[1] count = [0] + with nogil: + __status__ = nvmlGpuInstanceGetComputeInstancePossiblePlacements(gpu_instance, profile_id, NULL, count) + check_status_size(__status__) + cdef ComputeInstancePlacement placements = ComputeInstancePlacement(count[0]) + cdef nvmlComputeInstancePlacement_t *placements_ptr = (placements._get_ptr()) + if count[0] == 0: + return placements + with nogil: + __status__ = nvmlGpuInstanceGetComputeInstancePossiblePlacements(gpu_instance, profile_id, placements_ptr, count) + check_status(__status__) + return placements + + +cpdef intptr_t gpu_instance_create_compute_instance(intptr_t gpu_instance, unsigned int profile_id) except? 0: + """Create compute instance. + + Args: + gpu_instance (intptr_t): The identifier of the target GPU instance. + profile_id (unsigned int): The compute instance profile ID. See ``nvmlGpuInstanceGetComputeInstanceProfileInfo``. + + Returns: + intptr_t: Returns the compute instance handle. + + .. seealso:: `nvmlGpuInstanceCreateComputeInstance` + """ + cdef ComputeInstance compute_instance + with nogil: + __status__ = nvmlGpuInstanceCreateComputeInstance(gpu_instance, profile_id, &compute_instance) + check_status(__status__) + return compute_instance + + +cpdef intptr_t gpu_instance_create_compute_instance_with_placement(intptr_t gpu_instance, unsigned int profile_id, intptr_t placement) except? 0: + """Create compute instance with the specified placement. + + Args: + gpu_instance (intptr_t): The identifier of the target GPU instance. + profile_id (unsigned int): The compute instance profile ID. See ``nvmlGpuInstanceGetComputeInstanceProfileInfo``. + placement (intptr_t): The requested placement. See ``nvmlGpuInstanceGetComputeInstancePossiblePlacements``. + + Returns: + intptr_t: Returns the compute instance handle. + + .. seealso:: `nvmlGpuInstanceCreateComputeInstanceWithPlacement` + """ + cdef ComputeInstance compute_instance + with nogil: + __status__ = nvmlGpuInstanceCreateComputeInstanceWithPlacement(gpu_instance, profile_id, placement, &compute_instance) + check_status(__status__) + return compute_instance + + +cpdef compute_instance_destroy(intptr_t compute_instance): + """Destroy compute instance. + + Args: + compute_instance (intptr_t): The compute instance handle. + + .. seealso:: `nvmlComputeInstanceDestroy` + """ + with nogil: + __status__ = nvmlComputeInstanceDestroy(compute_instance) + check_status(__status__) + + +cpdef intptr_t gpu_instance_get_compute_instance_by_id(intptr_t gpu_instance, unsigned int id) except? 0: + """Get compute instance for given instance ID. + + Args: + gpu_instance (intptr_t): The identifier of the target GPU instance. + id (unsigned int): The compute instance ID. + + Returns: + intptr_t: Returns compute instance. + + .. seealso:: `nvmlGpuInstanceGetComputeInstanceById` + """ + cdef ComputeInstance compute_instance + with nogil: + __status__ = nvmlGpuInstanceGetComputeInstanceById(gpu_instance, id, &compute_instance) + check_status(__status__) + return compute_instance + + +cpdef object compute_instance_get_info_v2(intptr_t compute_instance): + """Get compute instance information. + + Args: + compute_instance (intptr_t): The compute instance handle. + + Returns: + nvmlComputeInstanceInfo_t: Return compute instance information. + + .. seealso:: `nvmlComputeInstanceGetInfo_v2` + """ + cdef ComputeInstanceInfo info_py = ComputeInstanceInfo() + cdef nvmlComputeInstanceInfo_t *info = (info_py._get_ptr()) + with nogil: + __status__ = nvmlComputeInstanceGetInfo_v2(compute_instance, info) + check_status(__status__) + return info_py + + +cpdef unsigned int device_is_mig_device_handle(intptr_t device) except? 0: + """Test if the given handle refers to a MIG device. + + Args: + device (intptr_t): NVML handle to test. + + Returns: + unsigned int: True when handle refers to a MIG device. + + .. seealso:: `nvmlDeviceIsMigDeviceHandle` + """ + cdef unsigned int is_mig_device + with nogil: + __status__ = nvmlDeviceIsMigDeviceHandle(device, &is_mig_device) + check_status(__status__) + return is_mig_device + + +cpdef unsigned int device_get_gpu_instance_id(intptr_t device) except? 0: + """Get GPU instance ID for the given MIG device handle. + + Args: + device (intptr_t): Target MIG device handle. + + Returns: + unsigned int: GPU instance ID. + + .. seealso:: `nvmlDeviceGetGpuInstanceId` + """ + cdef unsigned int id + with nogil: + __status__ = nvmlDeviceGetGpuInstanceId(device, &id) + check_status(__status__) + return id + + +cpdef unsigned int device_get_compute_instance_id(intptr_t device) except? 0: + """Get compute instance ID for the given MIG device handle. + + Args: + device (intptr_t): Target MIG device handle. + + Returns: + unsigned int: Compute instance ID. + + .. seealso:: `nvmlDeviceGetComputeInstanceId` + """ + cdef unsigned int id + with nogil: + __status__ = nvmlDeviceGetComputeInstanceId(device, &id) + check_status(__status__) + return id + + +cpdef unsigned int device_get_max_mig_device_count(intptr_t device) except? 0: + """Get the maximum number of MIG devices that can exist under a given parent NVML device. + + Args: + device (intptr_t): Target device handle. + + Returns: + unsigned int: Count of MIG devices. + + .. seealso:: `nvmlDeviceGetMaxMigDeviceCount` + """ + cdef unsigned int count + with nogil: + __status__ = nvmlDeviceGetMaxMigDeviceCount(device, &count) + check_status(__status__) + return count + + +cpdef intptr_t device_get_mig_device_handle_by_index(intptr_t device, unsigned int index) except? 0: + """Get MIG device handle for the given index under its parent NVML device. + + Args: + device (intptr_t): Reference to the parent GPU device handle. + index (unsigned int): Index of the MIG device. + + Returns: + intptr_t: Reference to the MIG device handle. + + .. seealso:: `nvmlDeviceGetMigDeviceHandleByIndex` + """ + cdef Device mig_device + with nogil: + __status__ = nvmlDeviceGetMigDeviceHandleByIndex(device, index, &mig_device) + check_status(__status__) + return mig_device + + +cpdef intptr_t device_get_device_handle_from_mig_device_handle(intptr_t mig_device) except? 0: + """Get parent device handle from a MIG device handle. + + Args: + mig_device (intptr_t): MIG device handle. + + Returns: + intptr_t: Device handle. + + .. seealso:: `nvmlDeviceGetDeviceHandleFromMigDeviceHandle` + """ + cdef Device device + with nogil: + __status__ = nvmlDeviceGetDeviceHandleFromMigDeviceHandle(mig_device, &device) + check_status(__status__) + return device + + +cpdef device_power_smoothing_activate_preset_profile(intptr_t device, intptr_t profile): + """Activiate a specific preset profile for datacenter power smoothing. The API only sets the active preset profile based on the input profileId, and ignores the other parameters of the structure. Requires root/admin permissions. + + Args: + device (intptr_t): The identifier of the target device. + profile (intptr_t): Reference to ``nvmlPowerSmoothingProfile_v1_t``. Note that only ``profile->profileId`` is used and the rest of the structure is ignored. + + .. seealso:: `nvmlDevicePowerSmoothingActivatePresetProfile` + """ + with nogil: + __status__ = nvmlDevicePowerSmoothingActivatePresetProfile(device, profile) + check_status(__status__) + + +cpdef device_power_smoothing_update_preset_profile_param(intptr_t device, intptr_t profile): + """Update the value of a specific profile parameter contained within ``nvmlPowerSmoothingProfile_v1_t``. Requires root/admin permissions. + + Args: + device (intptr_t): The identifier of the target device. + profile (intptr_t): Reference to ``nvmlPowerSmoothingProfile_v1_t`` struct. + + .. seealso:: `nvmlDevicePowerSmoothingUpdatePresetProfileParam` + """ + with nogil: + __status__ = nvmlDevicePowerSmoothingUpdatePresetProfileParam(device, profile) + check_status(__status__) + + +cpdef device_power_smoothing_set_state(intptr_t device, intptr_t state): + """Enable or disable the Power Smoothing Feature. Requires root/admin permissions. + + Args: + device (intptr_t): The identifier of the target device. + state (intptr_t): Reference to ``nvmlPowerSmoothingState_v1_t``. + + .. seealso:: `nvmlDevicePowerSmoothingSetState` + """ + with nogil: + __status__ = nvmlDevicePowerSmoothingSetState(device, state) + check_status(__status__) + + +cpdef object device_get_addressing_mode(intptr_t device): + """Get the addressing mode for a given GPU. Addressing modes can be one of:. + + Args: + device (intptr_t): The device handle. + + Returns: + nvmlDeviceAddressingMode_v1_t: Pointer to addressing mode of the device. + + .. seealso:: `nvmlDeviceGetAddressingMode` + """ + cdef DeviceAddressingMode_v1 mode_py = DeviceAddressingMode_v1() + cdef nvmlDeviceAddressingMode_t *mode = (mode_py._get_ptr()) + mode.version = NVML_VERSION_STRUCT(sizeof(nvmlDeviceAddressingMode_v1_t), 1) + with nogil: + __status__ = nvmlDeviceGetAddressingMode(device, mode) + check_status(__status__) + return mode_py + + +cpdef object device_get_repair_status(intptr_t device): + """Get the repair status for TPC/Channel repair. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + nvmlRepairStatus_v1_t: Reference to ``nvmlRepairStatus_t``. + + .. seealso:: `nvmlDeviceGetRepairStatus` + """ + cdef RepairStatus_v1 repair_status_py = RepairStatus_v1() + cdef nvmlRepairStatus_t *repair_status = (repair_status_py._get_ptr()) + repair_status.version = NVML_VERSION_STRUCT(sizeof(nvmlRepairStatus_v1_t), 1) + with nogil: + __status__ = nvmlDeviceGetRepairStatus(device, repair_status) + check_status(__status__) + return repair_status_py + + +cpdef object device_get_power_mizer_mode_v1(intptr_t device): + """Retrieves current power mizer mode on this device. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + nvmlDevicePowerMizerModes_v1_t: Reference in which to return the power mizer mode. + + .. seealso:: `nvmlDeviceGetPowerMizerMode_v1` + """ + cdef DevicePowerMizerModes_v1 power_mizer_mode_py = DevicePowerMizerModes_v1() + cdef nvmlDevicePowerMizerModes_v1_t *power_mizer_mode = (power_mizer_mode_py._get_ptr()) + with nogil: + __status__ = nvmlDeviceGetPowerMizerMode_v1(device, power_mizer_mode) + check_status(__status__) + return power_mizer_mode_py + + +cpdef device_set_power_mizer_mode_v1(intptr_t device, intptr_t power_mizer_mode): + """Sets the new power mizer mode. + + Args: + device (intptr_t): The identifier of the target device. + power_mizer_mode (intptr_t): Reference in which to set the power mizer mode. + + .. seealso:: `nvmlDeviceSetPowerMizerMode_v1` + """ + with nogil: + __status__ = nvmlDeviceSetPowerMizerMode_v1(device, power_mizer_mode) + check_status(__status__) + + +cpdef device_vgpu_force_gsp_unload(intptr_t device): + """Executes a forced GSP unload operation on a device. + + Args: + device (intptr_t): The identifier of the target device. + + .. seealso:: `nvmlDeviceVgpuForceGspUnload` + """ + with nogil: + __status__ = nvmlDeviceVgpuForceGspUnload(device) + check_status(__status__) + + +cpdef object device_get_vgpu_scheduler_state_v2(intptr_t device): + """Returns the vGPU scheduler state. The information returned in ``nvmlVgpuSchedulerStateInfo_v2_t`` is not relevant if the BEST EFFORT policy is set. + + Args: + device (intptr_t): The identifier of the target ``device``. + + Returns: + nvmlVgpuSchedulerStateInfo_v2_t: Reference in which ``p_scheduler_state_info`` is returned. + + .. seealso:: `nvmlDeviceGetVgpuSchedulerState_v2` + """ + cdef VgpuSchedulerStateInfo_v2 p_scheduler_state_info_py = VgpuSchedulerStateInfo_v2() + cdef nvmlVgpuSchedulerStateInfo_v2_t *p_scheduler_state_info = (p_scheduler_state_info_py._get_ptr()) + with nogil: + __status__ = nvmlDeviceGetVgpuSchedulerState_v2(device, p_scheduler_state_info) + check_status(__status__) + return p_scheduler_state_info_py + + +cpdef object gpu_instance_get_vgpu_scheduler_state_v2(intptr_t gpu_instance): + """Returns the vGPU scheduler state for the given GPU instance. The information returned in ``nvmlVgpuSchedulerStateInfo_v2_t`` is not relevant if the BEST EFFORT policy is set. + + Args: + gpu_instance (intptr_t): The GPU instance handle. + + Returns: + nvmlVgpuSchedulerStateInfo_v2_t: Reference in which ``p_scheduler_state_info`` is returned. + + .. seealso:: `nvmlGpuInstanceGetVgpuSchedulerState_v2` + """ + cdef VgpuSchedulerStateInfo_v2 p_scheduler_state_info_py = VgpuSchedulerStateInfo_v2() + cdef nvmlVgpuSchedulerStateInfo_v2_t *p_scheduler_state_info = (p_scheduler_state_info_py._get_ptr()) + with nogil: + __status__ = nvmlGpuInstanceGetVgpuSchedulerState_v2(gpu_instance, p_scheduler_state_info) + check_status(__status__) + return p_scheduler_state_info_py + + +cpdef object device_get_vgpu_scheduler_log_v2(intptr_t device): + """Returns the vGPU Software scheduler logs for the device. ``p_scheduler_log_info`` points to a caller-allocated structure to contain the logs. The number of elements returned will never exceed ``NVML_SCHEDULER_SW_MAX_LOG_ENTRIES``. + + Args: + device (intptr_t): The identifier of the target ``device``. + + Returns: + nvmlVgpuSchedulerLogInfo_v2_t: Reference in which ``p_scheduler_log_info`` is written. + + .. seealso:: `nvmlDeviceGetVgpuSchedulerLog_v2` + """ + cdef VgpuSchedulerLogInfo_v2 p_scheduler_log_info_py = VgpuSchedulerLogInfo_v2() + cdef nvmlVgpuSchedulerLogInfo_v2_t *p_scheduler_log_info = (p_scheduler_log_info_py._get_ptr()) + with nogil: + __status__ = nvmlDeviceGetVgpuSchedulerLog_v2(device, p_scheduler_log_info) + check_status(__status__) + return p_scheduler_log_info_py + + +cpdef object gpu_instance_get_vgpu_scheduler_log_v2(intptr_t gpu_instance): + """Returns the vGPU scheduler logs for the given GPU instance. ``p_scheduler_log_info`` points to a caller-allocated structure to contain the logs. The number of elements returned will never exceed ``NVML_SCHEDULER_SW_MAX_LOG_ENTRIES``. + + Args: + gpu_instance (intptr_t): The GPU instance handle. + + Returns: + nvmlVgpuSchedulerLogInfo_v2_t: Reference in which ``p_scheduler_log_info`` is written. + + .. seealso:: `nvmlGpuInstanceGetVgpuSchedulerLog_v2` + """ + cdef VgpuSchedulerLogInfo_v2 p_scheduler_log_info_py = VgpuSchedulerLogInfo_v2() + cdef nvmlVgpuSchedulerLogInfo_v2_t *p_scheduler_log_info = (p_scheduler_log_info_py._get_ptr()) + with nogil: + __status__ = nvmlGpuInstanceGetVgpuSchedulerLog_v2(gpu_instance, p_scheduler_log_info) + check_status(__status__) + return p_scheduler_log_info_py + + +cpdef device_set_vgpu_scheduler_state_v2(intptr_t device, intptr_t p_scheduler_state): + """Sets the vGPU scheduler state. + + Args: + device (intptr_t): The identifier of the target ``device``. + p_scheduler_state (intptr_t): vGPU ``p_scheduler_state`` to set. + + .. seealso:: `nvmlDeviceSetVgpuSchedulerState_v2` + """ + with nogil: + __status__ = nvmlDeviceSetVgpuSchedulerState_v2(device, p_scheduler_state) + check_status(__status__) + + +cpdef gpu_instance_set_vgpu_scheduler_state_v2(intptr_t gpu_instance, intptr_t p_scheduler_state): + """Set vGPU scheduler state for the given GPU instance. + + Args: + gpu_instance (intptr_t): The GPU instance handle. + p_scheduler_state (intptr_t): Pointer to the caller-provided structure of ``nvmlVgpuSchedulerState_v2_t``. + + .. seealso:: `nvmlGpuInstanceSetVgpuSchedulerState_v2` + """ + with nogil: + __status__ = nvmlGpuInstanceSetVgpuSchedulerState_v2(gpu_instance, p_scheduler_state) + check_status(__status__) + + +cpdef object system_get_topology_gpu_set(unsigned int cpuNumber): + """Retrieve the set of GPUs that have a CPU affinity with the given CPU number + + Args: + cpuNumber (unsigned int): The CPU number + + Returns: + array: An array of device handles for GPUs found with affinity to cpuNumber + """ + cdef unsigned int[1] count = [0] + with nogil: + __status__ = nvmlSystemGetTopologyGpuSet(cpuNumber, count, NULL) + check_status_size(__status__) + if count[0] == 0: + return view.array(shape=(1,), itemsize=sizeof(intptr_t), format="P", mode="c")[:0] + cdef view.array deviceArray = view.array(shape=(count[0],), itemsize=sizeof(intptr_t), format="P", mode="c") + with nogil: + __status__ = nvmlSystemGetTopologyGpuSet(cpuNumber, count, deviceArray.data) + check_status(__status__) + return deviceArray + + +cpdef str system_get_driver_branch(): + """Retrieves the driver branch of the NVIDIA driver installed on the system. + + Returns: + str: driver branch. + """ + cdef nvmlSystemDriverBranchInfo_t info + # Calculation copied from the macro NVML_STRUCT_VERSION in nvml.h + # Needs to be updated if the version of the nvmlSystemDriverBranchInfo_t + # struct changes in the future. + info.version = NVML_VERSION_STRUCT(sizeof(nvmlSystemDriverBranchInfo_v1_t), 1) + cdef unsigned int length = 80 + with nogil: + __status__ = nvmlSystemGetDriverBranch(&info, length) + check_status(__status__) + return cpython.PyUnicode_FromString(info.branch) + + +cpdef object unit_get_devices(intptr_t unit): + """Retrieves the set of GPU devices that are attached to the specified unit. + + Args: + unit (Unit): The identifier of the target unit. + + Returns: + array: An array of device handles for GPUs attached to the unit. + """ + cdef unsigned int[1] deviceCount = [0] + with nogil: + __status__ = nvmlUnitGetDevices(unit, deviceCount, NULL) + check_status_size(__status__) + if deviceCount[0] == 0: + return view.array(shape=(1,), itemsize=sizeof(intptr_t), format="P", mode="c")[:0] + cdef view.array deviceArray = view.array(shape=(deviceCount[0],), itemsize=sizeof(intptr_t), format="P", mode="c") + with nogil: + __status__ = nvmlUnitGetDevices(unit, deviceCount, deviceArray.data) + check_status(__status__) + return deviceArray + + +cpdef object device_get_topology_nearest_gpus(intptr_t device, unsigned int level): + """Retrieve the set of GPUs that are nearest to a given device at a specific interconnectivity level + + Args: + device (Device): The identifier of the first device + level (GpuTopologyLevel): The level to search for other GPUs + + Returns: + array: An array of device handles for GPUs found at level + """ + cdef unsigned int[1] count = [0] + with nogil: + __status__ = nvmlDeviceGetTopologyNearestGpus( + device, + level, + count, + NULL + ) + check_status_size(__status__) + if count[0] == 0: + return view.array(shape=(1,), itemsize=sizeof(intptr_t), format="P", mode="c")[:0] + cdef view.array deviceArray = view.array(shape=(count[0],), itemsize=sizeof(intptr_t), format="P", mode="c") + with nogil: + __status__ = nvmlDeviceGetTopologyNearestGpus( + device, + level, + count, + deviceArray.data + ) + check_status(__status__) + return deviceArray + + +cpdef int device_get_temperature_v(intptr_t device, nvmlTemperatureSensors_t sensorType): + """Retrieves the current temperature readings (in degrees C) for the given device. + + Args: + device (intptr_t): Target device identifier. + + Returns: + nvmlTemperature_v1_t: Structure specifying the sensor type (input) and retrieved temperature value (output). + + .. seealso:: `nvmlDeviceGetTemperatureV` + """ + cdef nvmlTemperature_v1_t[1] temperature + + with nogil: + temperature[0].version = NVML_VERSION_STRUCT(sizeof(nvmlTemperature_v1_t), 1) + temperature[0].sensorType = sensorType + __status__ = nvmlDeviceGetTemperatureV(device, temperature) + check_status(__status__) + return temperature.temperature + + +cpdef object device_get_supported_performance_states(intptr_t device): + """Get all supported Performance States (P-States) for the device. + + Args: + device (Device): The identifier of the target device. + """ + cdef int size = 16 # NVML_MAX_GPU_PERF_STATES + cdef view.array pstates = view.array(shape=(size,), itemsize=sizeof(unsigned int), format="I", mode="c") + + # The header says "size is the size of the pstates array in bytes". + # The size of an enum in C is implementation-defined, so we multiply by `sizeof(nvmlPstates_t)` here. + with nogil: + __status__ = nvmlDeviceGetSupportedPerformanceStates( + device, + pstates.data, + size * sizeof(nvmlPstates_t) + ) + check_status(__status__) + return pstates + + +cpdef object device_get_running_process_detail_list(intptr_t device, unsigned int mode): + """Get information about running processes on a device for input context + + Args: + device (Device): The device handle or MIG handle + mode (unsigned int): The process mode (Compute/Graphics/MPSCompute) + """ + + cdef ProcessDetailList_v1 plist = ProcessDetailList_v1() + cdef nvmlProcessDetailList_v1_t *ptr = plist._get_ptr() + + # Get size of array + with nogil: + ptr.version = NVML_VERSION_STRUCT(sizeof(nvmlProcessDetailList_v1_t), 1) + ptr.mode = mode + ptr.numProcArrayEntries = 0 + ptr.procArray = NULL + __status__ = nvmlDeviceGetRunningProcessDetailList(device, ptr) + check_status_size(__status__) + + if ptr.numProcArrayEntries == 0: + return plist + + procArray = ProcessDetail_v1(ptr.numProcArrayEntries) + plist.proc_array = procArray + + with nogil: + __status__ = nvmlDeviceGetRunningProcessDetailList(device, ptr) + check_status(__status__) + return plist + + +cpdef tuple device_get_samples(intptr_t device, int type, unsigned long long last_seen_time_stamp): + """Gets recent samples for the GPU. + + Args: + device (intptr_t): The identifier for the target device. + type (SamplingType): Type of sampling event. + last_seen_time_stamp (unsigned long long): Return only samples with timestamp greater than last_seen_time_stamp. + + .. seealso:: `nvmlDeviceGetSamples` + """ + cdef unsigned int[1] sample_count = [0] + cdef unsigned int[1] sample_val_type = [0] + with nogil: + __status__ = nvmlDeviceGetSamples(device, <_SamplingType>type, last_seen_time_stamp, <_ValueType*>sample_val_type, sample_count, NULL) + check_status_size(__status__) + cdef Sample samples = Sample(sample_count[0]) + cdef nvmlSample_t *samples_ptr = samples._get_ptr() + if sample_count[0] == 0: + return samples + with nogil: + __status__ = nvmlDeviceGetSamples(device, <_SamplingType>type, last_seen_time_stamp, <_ValueType*>sample_val_type, sample_count, samples_ptr) + check_status(__status__) + return (sample_val_type[0], samples) + + +cpdef tuple device_get_retired_pages_v2(intptr_t device, int cause): + """Returns the list of retired pages by source, including pages that are pending retirement + + Args: + device (Device): The identifier of the target device. + cause (PageRetirementCause): Filter page addresses by cause of retirement. + + Returns: + tuple: A tuple of two arrays (addresses, timestamps). + """ + cdef unsigned int[1] page_count = [0] + with nogil: + __status__ = nvmlDeviceGetRetiredPages_v2(device, <_PageRetirementCause>cause, page_count, NULL, NULL) + check_status_size(__status__) + if page_count[0] == 0: + return ( + view.array(shape=(1,), itemsize=sizeof(unsigned long long), format="Q", mode="c")[:0], + view.array(shape=(1,), itemsize=sizeof(unsigned long long), format="Q", mode="c")[:0] + ) + cdef view.array addresses = view.array(shape=(page_count[0],), itemsize=sizeof(unsigned long long), format="Q", mode="c") + cdef view.array timestamps = view.array(shape=(page_count[0],), itemsize=sizeof(unsigned long long), format="Q", mode="c") + with nogil: + __status__ = nvmlDeviceGetRetiredPages_v2(device, <_PageRetirementCause>cause, page_count, addresses.data, timestamps.data) + check_status(__status__) + return (addresses, timestamps) + + +cpdef object device_get_processes_utilization_info(intptr_t device, unsigned long long last_seen_time_stamp): + """Retrieves the recent utilization and process ID for all running processes + + Args: + device (Device): The identifier of the target device. + last_seen_time_stamp (unsigned long long): Timestamp in microseconds. Set it to 0 to read utilization based + on all the samples maintained by the driver's internal sample buffer. Set to a timeStamp retrieved from + a previous query to read utilization since the previous query. + + Returns: + ProcessesUtilizationInfo_v1: The processes utilization information structure. + """ + cdef ProcessesUtilizationInfo_v1 procesesUtilInfo = ProcessesUtilizationInfo_v1() + cdef nvmlProcessesUtilizationInfo_t *ptr = procesesUtilInfo._get_ptr() + + # Get size of array + with nogil: + ptr.version = NVML_VERSION_STRUCT(sizeof(nvmlProcessesUtilizationInfo_v1_t), 1) + ptr.processSamplesCount = 0 + ptr.lastSeenTimeStamp = last_seen_time_stamp + ptr.procUtilArray = NULL + __status__ = nvmlDeviceGetProcessesUtilizationInfo( + device, ptr + ) + check_status_size(__status__) + + if ptr.processSamplesCount == 0: + return procesesUtilInfo + + cdef ProcessUtilizationInfo_v1 procUtilArray = ProcessUtilizationInfo_v1(ptr.processSamplesCount) + procesesUtilInfo.proc_util_array = procUtilArray + + with nogil: + __status__ = nvmlDeviceGetProcessesUtilizationInfo( + device, ptr + ) + check_status(__status__) + + return procesesUtilInfo + + +cpdef device_set_hostname_v1(intptr_t device, str hostname): + """Set the hostname for the device. + + Args: + device (Device): The identifier of the target device. + hostname (str): The new hostname to set. + """ + cdef bytes = cpython.PyUnicode_AsASCIIString(hostname) + if len(bytes) > 64: + raise ValueError("hostname must 64 characters or less") + + cdef nvmlHostname_v1_t hostname_struct + memcpy(hostname_struct.value, cpython.PyBytes_AsString(bytes), len(bytes)) + + with nogil: + __status__ = nvmlDeviceSetHostname_v1(device, &hostname_struct) + check_status(__status__) + + +cpdef str device_get_hostname_v1(intptr_t device): + """Get the hostname for the device. + + Args: + device (Device): The identifier of the target device. + + Returns: + str: Hostname of the device. + """ + cdef nvmlHostname_v1_t hostname + with nogil: + __status__ = nvmlDeviceGetHostname_v1(device, &hostname) + check_status(__status__) + return cpython.PyUnicode_FromString(hostname.value) + + +cdef FieldValue _cast_field_values(values): + if isinstance(values, FieldValue): + return values + cdef FieldValue values_ + cdef unsigned int valuesCount = len(values) + values_ = FieldValue(valuesCount) + for i, v in enumerate(values): + if isinstance(v, tuple): + if len(v) != 2: + raise ValueError("FieldValue tuple must be of length 2") + if not isinstance(v[0], int) or not isinstance(v[1], int): + raise ValueError("FieldValue tuple elements must be integers") + values_[i].field_id = v[0] + values_[i].scope_id = v[1] + elif isinstance(v, int): + values_[i].field_id = v + else: + raise ValueError("Each entry must be an integer field ID, or a tuple of (field ID, scope ID)") + return values_ + + +cpdef object device_get_field_values(intptr_t device, values): + """Request values for a list of fields for a device. This API allows multiple fields to be queried at once. If any of the underlying fieldIds are populated by the same driver call, the results for those field IDs will be populated from a single call rather than making a driver call for each fieldId. + + Args: + device (intptr_t): The device handle of the GPU to request field values for. + values (FieldValue): Array of FieldValue specifying what to retrieve. + + .. seealso:: `nvmlDeviceGetFieldValues` + """ + cdef FieldValue values_ = _cast_field_values(values) + cdef nvmlFieldValue_t *ptr = values_._get_ptr() + cdef unsigned int valuesCount = len(values) + + # Passing a valuesCount of 0 to nvmlDeviceGetFieldValues returns NVML_INVALID_ARGUMENT + if valuesCount == 0: + return values_ + + with nogil: + __status__ = nvmlDeviceGetFieldValues(device, valuesCount, ptr) + check_status(__status__) + + values_._data.resize((valuesCount,)) + return values_ + + +cpdef device_clear_field_values(intptr_t device, values): + """Clear values for a list of fields for a device. This API allows multiple fields to be cleared at once. + + Args: + device (Device): The device handle of the GPU to request field values for + values (FieldValue): FieldValue instance to hold field values. Each value's fieldId must be populated + prior to this call + """ + cdef FieldValue values_ = _cast_field_values(values) + cdef nvmlFieldValue_t *ptr = values_._get_ptr() + cdef unsigned int valuesCount = len(values) + + # Passing a valuesCount of 0 to nvmlDeviceClearFieldValues returns NVML_INVALID_ARGUMENT + if valuesCount == 0: + return values_ + + with nogil: + __status__ = nvmlDeviceClearFieldValues(device, valuesCount, ptr) + check_status(__status__) + + +cpdef object device_get_supported_vgpus(intptr_t device): + """Retrieve the supported vGPU types on a physical GPU (device). + + Args: + device (Device): The identifier of the target device. + + Returns: + array: An array of supported vGPU type IDs. + """ + cdef unsigned int[1] vgpuCount = [0] + with nogil: + __status__ = nvmlDeviceGetSupportedVgpus(device, vgpuCount, NULL) + check_status_size(__status__) + if vgpuCount[0] == 0: + return view.array(shape=(1,), itemsize=sizeof(unsigned int), format="I", mode="c")[:0] + cdef view.array vgpuTypeIds = view.array(shape=(deviceCount[0],), itemsize=sizeof(unsigned int), format="I", mode="c") + with nogil: + __status__ = nvmlDeviceGetSupportedVgpus(device, vgpuCount, vgpuTypeIds.data) + check_status(__status__) + return vgpuTypeIds + + +cpdef object device_get_creatable_vgpus(intptr_t device): + """Retrieve the currently creatable vGPU types on a physical GPU (device). + + Args: + device (Device): The identifier of the target device. + + Returns: + array: An array of createable vGPU type IDs. + """ + cdef unsigned int[1] vgpuCount = [0] + with nogil: + __status__ = nvmlDeviceGetCreatableVgpus(device, vgpuCount, NULL) + check_status_size(__status__) + if vgpuCount[0] == 0: + return view.array(shape=(1,), itemsize=sizeof(unsigned int), format="I", mode="c")[:0] + cdef view.array vgpuTypeIds = view.array(shape=(deviceCount[0],), itemsize=sizeof(unsigned int), format="I", mode="c") + with nogil: + __status__ = nvmlDeviceGetCreatableVgpus(device, vgpuCount, vgpuTypeIds.data) + check_status(__status__) + return vgpuTypeIds + + +cpdef object device_get_active_vgpus(intptr_t device): + """Retrieve the active vGPU instances on a device. + + Args: + device (Device): The identifier of the target device. + + Returns: + array: An array of active vGPU instance IDs. + """ + cdef unsigned int[1] vgpuCount = [0] + with nogil: + __status__ = nvmlDeviceGetActiveVgpus(device, vgpuCount, NULL) + check_status_size(__status__) + if vgpuCount[0] == 0: + return view.array(shape=(1,), itemsize=sizeof(unsigned int), format="I", mode="c")[:0] + cdef view.array vgpuInstances = view.array(shape=(deviceCount[0],), itemsize=sizeof(unsigned int), format="I", mode="c") + with nogil: + __status__ = nvmlDeviceGetActiveVgpus(device, vgpuCount, vgpuInstances.data) + check_status(__status__) + return vgpuInstances + + +cpdef tuple vgpu_instance_get_vm_id(unsigned int vgpu_instance): + """Retrieve the VM ID associated with a vGPU instance. + + Args: + vgpu_instance (unsigned int): The identifier of the target vGPU instance. + + Returns: + tuple[str, VgpuVmIdType]: A tuple of (id, id_type). + """ + cdef unsigned int size = 80 + cdef char[80] vmId + cdef nvmlVgpuVmIdType_t[1] vmIdType + with nogil: + __status__ = nvmlVgpuInstanceGetVmID(vgpu_instance, vmId, size, vmIdType) + check_status(__status__) + return (cpython.PyUnicode_FromString(vmId), vmIdType[0]) + + +cpdef object gpu_instance_get_creatable_vgpus(intptr_t gpu_instance): + """Query the currently creatable vGPU types on a specific GPU Instance. + + Args: + gpu_instance (GpuInstance): The identifier of the target GPU Instance. + + Returns: + VgpuTypeIdInfo_v1: The vGPU type ID information structure. + """ + + cdef VgpuTypeIdInfo_v1 pVgpus = VgpuTypeIdInfo_v1() + cdef nvmlVgpuTypeIdInfo_v1_t *ptr = pVgpus._get_ptr() + + # Get size of array + with nogil: + ptr.version = NVML_VERSION_STRUCT(sizeof(nvmlVgpuTypeIdInfo_v1_t), 1) + ptr.vgpuCount = 0 + ptr.vgpuTypeIds = NULL + __status__ = nvmlGpuInstanceGetCreatableVgpus(gpu_instance, ptr) + check_status_size(__status__) + + if ptr.vgpuCount == 0: + return pVgpus + + cdef view.array vgpuTypeIds = view.array(shape=(ptr.vgpuCount,), itemsize=sizeof(unsigned int), format="I", mode="c") + pVgpus.vgpu_type_ids = vgpuTypeIds + + with nogil: + __status__ = nvmlGpuInstanceGetCreatableVgpus(gpu_instance, ptr) + check_status(__status__) + + return pVgpus + + +cpdef object gpu_instance_get_active_vgpus(intptr_t gpu_instance): + """Retrieve the active vGPU instances within a GPU instance. + + Args: + gpu_instance (GpuInstance): The identifier of the target GPU Instance. + + Returns: + ActiveVgpuInstanceInfo: The vGPU instance ID information structure. + """ + cdef ActiveVgpuInstanceInfo_v1 activeVgpuInfo = ActiveVgpuInstanceInfo_v1() + cdef nvmlActiveVgpuInstanceInfo_v1_t *ptr = activeVgpuInfo._get_ptr() + + with nogil: + ptr.version = NVML_VERSION_STRUCT(sizeof(nvmlActiveVgpuInstanceInfo_v1_t), 1) + ptr.vgpuCount = 0 + ptr.vgpuInstances = NULL + __status__ = nvmlGpuInstanceGetActiveVgpus(gpu_instance, ptr) + check_status_size(__status__) + + if ptr.vgpuCount == 0: + return activeVgpuInfo + + cdef view.array vgpuInstances = view.array(shape=(ptr.vgpuCount,), itemsize=sizeof(unsigned int), format="I", mode="c") + activeVgpuInfo.vgpu_instances = vgpuInstances + + with nogil: + __status__ = nvmlGpuInstanceGetActiveVgpus(gpu_instance, ptr) + check_status(__status__) + + return activeVgpuInfo + + +cpdef object gpu_instance_get_vgpu_type_creatable_placements(intptr_t gpu_instance, unsigned int vgpu_type_id): + """Query the creatable vGPU placement ID of the vGPU type within a GPU instance. + + Args: + gpu_instance (GpuInstance): The identifier of the target GPU Instance. + vgpu_type_id (unsigned int): The vGPU type ID. + + Returns: + VgpuPlacementList_v2: The vGPU placement list structure. + """ + + cdef VgpuCreatablePlacementInfo_v1 pCreatablePlacementInfo = VgpuCreatablePlacementInfo_v1() + cdef nvmlVgpuCreatablePlacementInfo_v1_t *ptr = pCreatablePlacementInfo._get_ptr() + + # Get size of array + with nogil: + ptr.version = NVML_VERSION_STRUCT(sizeof(nvmlVgpuCreatablePlacementInfo_v1_t), 1) + ptr.count = 0 + ptr.placementIds = NULL + ptr.vgpuTypeId = vgpu_type_id + __status__ = nvmlGpuInstanceGetVgpuTypeCreatablePlacements(gpu_instance, ptr) + check_status_size(__status__) + + if ptr.count == 0: + return pCreatablePlacementInfo + + cdef view.array placementIds = view.array(shape=(ptr.count,), itemsize=sizeof(unsigned int), format="I", mode="c") + pCreatablePlacementInfo.placement_ids = placementIds + + with nogil: + __status__ = nvmlGpuInstanceGetVgpuTypeCreatablePlacements(gpu_instance, ptr) + check_status(__status__) + + return pCreatablePlacementInfo + + +cpdef object device_get_vgpu_type_creatable_placements(intptr_t device, unsigned int vgpu_type_id, unsigned int mode): + """Query the creatable vGPU placement ID of the vGPU type within a GPU instance. + + Args: + device (Device): The identifier of the target device. + vgpu_type_id (unsigned int): The vGPU type ID. + mode (unsigned int): The placement mode. 0: Heterogeneous, 1: Homogeneous. + + Returns: + VgpuPlacementList_v2: The vGPU placement list structure. + """ + + cdef VgpuPlacementList_v2 pPlacementList = VgpuPlacementList_v2() + cdef nvmlVgpuPlacementList_v2_t *ptr = pPlacementList._get_ptr() + + # Get size of array + with nogil: + ptr.version = NVML_VERSION_STRUCT(sizeof(nvmlVgpuPlacementList_v2_t), 2) + ptr.count = 0 + ptr.placementIds = NULL + ptr.mode = mode + __status__ = nvmlDeviceGetVgpuTypeCreatablePlacements(device, vgpu_type_id, ptr) + check_status_size(__status__) + + if ptr.count == 0: + return pPlacementList + + cdef view.array placementIds = view.array(shape=(ptr.count,), itemsize=sizeof(unsigned int), format="I", mode="c") + pPlacementList.placement_ids = placementIds + + with nogil: + __status__ = nvmlDeviceGetVgpuTypeCreatablePlacements(device, vgpu_type_id, ptr) + check_status(__status__) + + return pPlacementList + + +cpdef object vgpu_instance_get_metadata(unsigned int vgpu_instance): + """Returns vGPU metadata structure for a running vGPU. The structure contains information about the vGPU and its + associated VM such as the currently installed NVIDIA guest driver version, together with host driver version and + an opaque data section containing internal state. + + Args: + vgpu_instance (unsigned int): The identifier of the target vGPU instance. + + Returns: + VgpuMetadata: Metadata. + """ + cdef VgpuMetadata vgpuMetadata = VgpuMetadata() + cdef unsigned int[1] bufferSize = [sizeof(nvmlVgpuMetadata_t)] + cdef nvmlVgpuMetadata_t *ptr = vgpuMetadata._get_ptr() + + with nogil: + __status__ = nvmlVgpuInstanceGetMetadata(vgpu_instance, ptr, bufferSize) + check_status_size(__status__) + + return vgpuMetadata + + +cpdef object device_get_vgpu_metadata(intptr_t device): + """Returns a vGPU metadata structure for the physical GPU indicated by device. The structure contains + information about the GPU and the currently installed NVIDIA host driver version that's controlling it, + together with an opaque data section containing internal state. + + Args: + device (Device): The identifier of the target device. + + Returns: + VgpuPgpuMetadata: Metadata. + """ + cdef VgpuPgpuMetadata pgpuMetadata = VgpuPgpuMetadata() + cdef unsigned int[1] bufferSize = [sizeof(nvmlVgpuPgpuMetadata_t)] + cdef nvmlVgpuPgpuMetadata_t *ptr = pgpuMetadata._get_ptr() + + with nogil: + __status__ = nvmlDeviceGetVgpuMetadata(device, ptr, bufferSize) + check_status_size(__status__) + + return pgpuMetadata + + +cpdef object get_vgpu_compatibility(VgpuMetadata vgpu_metadata, VgpuPgpuMetadata pgpu_metadata): + """Takes a vGPU instance metadata structure read from vgpu_instance_get_metadata() and a vGPU metadata structure + for a physical GPU read from device_get_vgpu_metadata, and returns compatibility information of the vGPU instance + and the physical GPU. + + Args: + vgpu_metadata (VgpuMetadata): The vGPU instance metadata. + pgpu_metadata (VgpuPgpuMetadata): The physical GPU metadata. + + Returns: + VgpuPgpuCompatibility: Compatibility information. + """ + cdef VgpuPgpuCompatibility compatibilityInfo = VgpuPgpuCompatibility() + cdef nvmlVgpuPgpuCompatibility_t *ptr = compatibilityInfo._get_ptr() + cdef nvmlVgpuMetadata_t *vgpu_metadata_ptr = vgpu_metadata._get_ptr() + cdef nvmlVgpuPgpuMetadata_t *pgpu_metadata_ptr = pgpu_metadata._get_ptr() + + with nogil: + __status__ = nvmlGetVgpuCompatibility(vgpu_metadata_ptr, pgpu_metadata_ptr, ptr) + check_status(__status__) + + return compatibilityInfo + + +cpdef tuple get_vgpu_version(): + """Query the ranges of supported vGPU versions. + + Returns: + tuple: A tuple of (VgpuVersion supported, VgpuVersion current). + """ + cdef VgpuVersion supported = VgpuVersion() + cdef nvmlVgpuVersion_t *supported_ptr = supported._get_ptr() + cdef VgpuVersion current = VgpuVersion() + cdef nvmlVgpuVersion_t *current_ptr = current._get_ptr() + + with nogil: + __status__ = nvmlGetVgpuVersion(supported_ptr, current_ptr) + + check_status(__status__) + return (supported, current) + + +cpdef object device_get_vgpu_instances_utilization_info(intptr_t device): + """ + Retrieves recent utilization for vGPU instances running on a physical GPU (device). + + Args: + device (Device): The identifier of the target device. + + Returns: + VgpuInstancesUtilizationInfo_v1: The vGPU instances utilization information structure. + """ + cdef VgpuInstancesUtilizationInfo_v1 vgpuUtilInfo = VgpuInstancesUtilizationInfo_v1() + cdef nvmlVgpuInstancesUtilizationInfo_v1_t *ptr = vgpuUtilInfo._get_ptr() + + with nogil: + ptr.version = NVML_VERSION_STRUCT(sizeof(nvmlVgpuInstancesUtilizationInfo_v1_t), 1) + ptr.vgpuInstanceCount = 0 + ptr.vgpuUtilArray = NULL + __status__ = nvmlDeviceGetVgpuInstancesUtilizationInfo(device, ptr) + check_status_size(__status__) + + if ptr.vgpuInstanceCount == 0: + return vgpuUtilInfo + + cdef VgpuInstanceUtilizationInfo_v1 vgpuUtilArray = VgpuInstanceUtilizationInfo_v1(ptr.vgpuInstanceCount) + vgpuUtilInfo.vgpu_util_array = vgpuUtilArray + + with nogil: + __status__ = nvmlDeviceGetVgpuInstancesUtilizationInfo(device, ptr) + check_status(__status__) + + return vgpuUtilInfo + + +cpdef object device_get_vgpu_processes_utilization_info(intptr_t device, unsigned int last_seen_time_stamp): + """ + Retrieves recent utilization for processes running on vGPU instances on a physical GPU (device). + + Args: + device (Device): The identifier of the target device. + + Returns: + VgpuProcessesUtilizationInfo: The vGPU processes utilization information structure. + """ + cdef VgpuProcessesUtilizationInfo_v1 vgpuProcUtilInfo = VgpuProcessesUtilizationInfo_v1() + cdef nvmlVgpuProcessesUtilizationInfo_v1_t *ptr = vgpuProcUtilInfo._get_ptr() + + with nogil: + ptr.version = NVML_VERSION_STRUCT(sizeof(nvmlVgpuProcessesUtilizationInfo_v1_t), 1) + ptr.vgpuProcessCount = 0 + ptr.vgpuProcUtilArray = NULL + ptr.lastSeenTimeStamp = last_seen_time_stamp + __status__ = nvmlDeviceGetVgpuProcessesUtilizationInfo(device, ptr) + check_status_size(__status__) + + if ptr.vgpuProcessCount == 0: + return vgpuProcUtilInfo + + cdef VgpuProcessUtilizationInfo_v1 vgpuProcUtilArray = VgpuProcessUtilizationInfo_v1(ptr.vgpuProcessCount) + vgpuProcUtilInfo.vgpu_proc_util_array = vgpuProcUtilArray + + with nogil: + __status__ = nvmlDeviceGetVgpuProcessesUtilizationInfo(device, ptr) + check_status(__status__) + + return vgpuProcUtilInfo + + +cpdef object device_get_gpu_instances(intptr_t device, unsigned int profile_id): + """Get GPU instances for given profile ID. + + Args: + device (Device): The identifier of the target device. + profile_id (unsigned int): The GPU instance profile ID. See device_get_gpu_instance_profile_info(). + + Returns: + array: An array of GPU instance handles. + """ + cdef unsigned int[1] count = [0] + with nogil: + __status__ = nvmlDeviceGetGpuInstances(device, profile_id, NULL, count) + check_status_size(__status__) + + if count[0] == 0: + view.array(shape=(1,), itemsize=sizeof(intptr_t), format="P", mode="c")[:0] + + cdef view.array gpuInstances = view.array(shape=(count[0],), itemsize=sizeof(intptr_t), format="P", mode="c") + with nogil: + __status__ = nvmlDeviceGetGpuInstances(device, profile_id, gpuInstances.data, count) + check_status(__status__) + + return gpuInstances + + +cpdef object gpu_instance_get_compute_instances(intptr_t gpu_instance, unsigned int profile_id): + """Get Compute instances for given profile ID. + + Args: + gpu_instance (GpuInstance): The identifier of the target GPU Instance. + profile_id (unsigned int): The Compute instance profile ID. + + Returns: + array: An array of Compute instance handles. + """ + cdef unsigned int[1] count = [0] + with nogil: + __status__ = nvmlGpuInstanceGetComputeInstances(gpu_instance, profile_id, NULL, count) + check_status_size(__status__) + + if count[0] == 0: + view.array(shape=(1,), itemsize=sizeof(intptr_t), format="P", mode="c")[:0] + + cdef view.array computeInstances = view.array(shape=(count[0],), itemsize=sizeof(intptr_t), format="P", mode="c") + with nogil: + __status__ = nvmlGpuInstanceGetComputeInstances(gpu_instance, profile_id, computeInstances.data, count) + check_status(__status__) + + return computeInstances + + +cpdef object device_get_sram_unique_uncorrected_ecc_error_counts(intptr_t device): + """Retrieves the counts of SRAM unique uncorrected ECC errors + + Args: + device (Device): The identifier of the target device. + + Returns: + EccSramUniqueUncorrectedErrorCounts_v1: The ECC SRAM unique uncorrected error counts structure. + """ + + cdef EccSramUniqueUncorrectedErrorCounts_v1 errorCounts = EccSramUniqueUncorrectedErrorCounts_v1() + cdef nvmlEccSramUniqueUncorrectedErrorCounts_v1_t *ptr = errorCounts._get_ptr() + + with nogil: + ptr.version = NVML_VERSION_STRUCT(sizeof(nvmlEccSramUniqueUncorrectedErrorCounts_v1_t), 1) + ptr.entryCount = 0 + ptr.entries = NULL + __status__ = nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts(device, ptr) + check_status_size(__status__) + + cdef EccSramUniqueUncorrectedErrorEntry_v1 entries = EccSramUniqueUncorrectedErrorEntry_v1(ptr.entryCount) + errorCounts.entries = entries + + if ptr.entryCount == 0: + return errorCounts + + with nogil: + __status__ = nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts(device, ptr) + check_status(__status__) + + return errorCounts + + +cpdef object device_get_gpu_fabric_info_v(intptr_t device): + """Versioned wrapper around nvmlDeviceGetGpuFabricInfo that accepts a versioned ``nvmlGpuFabricInfo_v2_t`` or later output structure. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + nvmlGpuFabricInfo_v3_t: Information about GPU fabric state. + + .. seealso:: `nvmlDeviceGetGpuFabricInfoV` + """ + cdef GpuFabricInfo_v3 gpu_fabric_info_v3_py + cdef GpuFabricInfo_v2 gpu_fabric_info_v2_py + cdef nvmlGpuFabricInfoV_t *gpu_fabric_info + if CUDA_VERSION >= 13000: + gpu_fabric_info_v3_py = GpuFabricInfo_v3() + gpu_fabric_info = (gpu_fabric_info_v3_py._get_ptr()) + with nogil: + gpu_fabric_info.version = NVML_VERSION_STRUCT(sizeof(nvmlGpuFabricInfo_v3_t), 3) + __status__ = nvmlDeviceGetGpuFabricInfoV(device, gpu_fabric_info) + check_status(__status__) + return gpu_fabric_info_v3_py + + else: + gpu_fabric_info_v2_py = GpuFabricInfo_v2() + gpu_fabric_info = (gpu_fabric_info_v2_py._get_ptr()) + with nogil: + gpu_fabric_info.version = NVML_VERSION_STRUCT(sizeof(nvmlGpuFabricInfo_v2_t), 2) + __status__ = nvmlDeviceGetGpuFabricInfoV(device, gpu_fabric_info) + check_status(__status__) + return gpu_fabric_info_v2_py + + +cpdef object device_get_platform_info(intptr_t device): + """Get platform information of this device. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + nvmlPlatformInfo_v2_t: Pointer to the caller-provided structure of nvmlPlatformInfo_t. + + .. seealso:: `nvmlDeviceGetPlatformInfo` + """ + cdef PlatformInfo_v1 platform_info_v1_py + cdef PlatformInfo_v2 platform_info_v2_py + cdef nvmlPlatformInfo_t *platform_info + + if CUDA_VERSION >= 13000: + platform_info_v2_py = PlatformInfo_v2() + platform_info = (platform_info_v2_py._get_ptr()) + with nogil: + platform_info.version = NVML_VERSION_STRUCT(sizeof(nvmlPlatformInfo_v2_t), 2) + __status__ = nvmlDeviceGetPlatformInfo(device, platform_info) + check_status(__status__) + return platform_info_v2_py + + else: + platform_info_v1_py = PlatformInfo_v1() + platform_info = (platform_info_v1_py._get_ptr()) + with nogil: + platform_info.version = NVML_VERSION_STRUCT(sizeof(nvmlPlatformInfo_v1_t), 1) + __status__ = nvmlDeviceGetPlatformInfo(device, platform_info) + check_status(__status__) + return platform_info_v1_py + + +cpdef object device_get_nvlink_info(intptr_t device): + """Query NVLINK information associated with this device. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + nvmlNvLinkInfo_v2_t: Reference to ``nvmlNvLinkInfo_t``. + + .. seealso:: `nvmlDeviceGetNvLinkInfo` + """ + cdef NvLinkInfo_v1 info_v1_py + cdef NvLinkInfo_v2 info_v2_py + cdef nvmlNvLinkInfo_t *info + + if CUDA_VERSION >= 13000: + info_v2_py = NvLinkInfo_v2() + info = (info_v2_py._get_ptr()) + with nogil: + info.version = NVML_VERSION_STRUCT(sizeof(nvmlNvLinkInfo_v2_t), 2) + __status__ = nvmlDeviceGetNvLinkInfo(device, info) + check_status(__status__) + return info_v2_py + + else: + info_v1_py = NvLinkInfo_v1() + info = (info_v1_py._get_ptr()) + with nogil: + info.version = NVML_VERSION_STRUCT(sizeof(nvmlNvLinkInfo_v1_t), 1) + __status__ = nvmlDeviceGetNvLinkInfo(device, info) + check_status(__status__) + return info_v1_py + + +cpdef intptr_t system_event_set_create(): + """Create an empty set of system events. Event set should be freed by ``nvmlSystemEventSetFree``.""" + cdef nvmlSystemEventSetCreateRequest_v1_t[1] request + with nogil: + request[0].version = NVML_VERSION_STRUCT(sizeof(nvmlSystemEventSetCreateRequest_v1_t), 1) + __status__ = nvmlSystemEventSetCreate(request) + check_status(__status__) + return (request[0].set) + + +cpdef system_event_set_free(intptr_t event_set): + """Frees an event set.""" + cdef nvmlSystemEventSetFreeRequest_v1_t[1] request + request[0].set = event_set + with nogil: + request[0].version = NVML_VERSION_STRUCT(sizeof(nvmlSystemEventSetFreeRequest_v1_t), 1) + __status__ = nvmlSystemEventSetFree(request) + check_status(__status__) + + +cpdef system_register_events(unsigned long long event_types, intptr_t event_set): + """Starts recording of events on system and add the events to specified ``nvmlSystemEventSet_t``. + + Args: + event_types (unsigned long long): Bitmask of nvmlSystemEventType_t values representing the events to register. + event_set (intptr_t): The system event set handle. + """ + cdef nvmlSystemRegisterEventRequest_v1_t[1] request + with nogil: + request[0].version = NVML_VERSION_STRUCT(sizeof(nvmlSystemRegisterEventRequest_v1_t), 1) + request[0].set = event_set + request[0].eventTypes = event_types + __status__ = nvmlSystemRegisterEvents(request) + check_status(__status__) + + +cpdef object system_event_set_wait(intptr_t event_set, unsigned int timeout_ms, unsigned int buffer_size): + """Waits for events to occur on the system event set. + + Args: + event_set (intptr_t): The system event set handle. + timeout_ms (unsigned int): The maximum amount of time in milliseconds to wait for an event. + buffer_size (unsigned int): The size of the event buffer. + + Returns: + SystemEvent: The system event that occurred. + """ + cdef nvmlSystemEventSetWaitRequest_v1_t[1] request + cdef SystemEventData_v1 event_data = SystemEventData_v1(buffer_size) + request[0].data = (event_data._get_ptr()) + with nogil: + request[0].version = NVML_VERSION_STRUCT(sizeof(nvmlSystemEventSetWaitRequest_v1_t), 1) + request[0].timeoutms = timeout_ms + request[0].set = event_set + request[0].dataSize = buffer_size + __status__ = nvmlSystemEventSetWait(request) + check_status(__status__) + event_data._data.resize((request[0].numEvent,)) + return event_data + + +cpdef unsigned int device_get_fan_speed_rpm(intptr_t device, unsigned int fan): + """Retrieves the intended operating speed in rotations per minute (RPM) of the device's specified fan. + + Args: + device (intptr_t): The identifier of the target device. + fan (unsigned int): The index of the fan to query. + + Returns: + rpm (unsigned int): The fan speed in RPM. + + .. seealso:: `nvmlDeviceGetFanSpeedRPM` + """ + cdef nvmlFanSpeedInfo_v1_t[1] fan_speed + with nogil: + fan_speed[0].version = NVML_VERSION_STRUCT(sizeof(nvmlFanSpeedInfo_v1_t), 1) + fan_speed[0].fan = fan + __status__ = nvmlDeviceGetFanSpeedRPM(device, fan_speed) + check_status(__status__) + return fan_speed[0].speed + + +cpdef int device_get_margin_temperature(intptr_t device): + """Retrieves the thermal margin temperature (distance to nearest slowdown threshold). + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + margin_temperature (int): The margin temperature value. + + .. seealso:: `nvmlDeviceGetMarginTemperature` + """ + cdef nvmlMarginTemperature_v1_t[1] margin_temp_info + with nogil: + margin_temp_info[0].version = NVML_VERSION_STRUCT(sizeof(nvmlMarginTemperature_v1_t), 1) + __status__ = nvmlDeviceGetMarginTemperature(device, margin_temp_info) + check_status(__status__) + return margin_temp_info[0].marginTemperature + + +cpdef object device_get_clock_offsets(intptr_t device, nvmlClockType_t clock_type, nvmlPstates_t pstate): + """Retrieve min, max and current clock offset of some clock domain for a given PState. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + nvmlClockOffset_v1_t: Structure specifying the clock type (input) and the pstate (input) retrieved clock offset value (output), min clock offset (output) and max clock offset (output). + + .. seealso:: `nvmlDeviceGetClockOffsets` + """ + cdef ClockOffset_v1 info_py = ClockOffset_v1() + cdef nvmlClockOffset_v1_t *info = (info_py._get_ptr()) + with nogil: + info.version = NVML_VERSION_STRUCT(sizeof(nvmlClockOffset_v1_t), 1) + info.type = clock_type + info.pstate = pstate + __status__ = nvmlDeviceGetClockOffsets(device, info) + check_status(__status__) + return info_py + + +cpdef object device_get_vgpu_type_supported_placements(intptr_t device, unsigned int vgpu_type_id, unsigned int mode): + """Query the supported vGPU placement ID of the vGPU type. + + Args: + device (intptr_t): Identifier of the target device. + vgpu_type_id (unsigned int): Handle to vGPU type. The vGPU type ID. + mode (unsigned int): The placement mode. 0: Heterogeneous, 1: Homogeneous. + + Returns: + nvmlVgpuPlacementList_v2_t: Pointer to the vGPU placement structure ``nvmlVgpuPlacementList_t``. + + .. seealso:: `nvmlDeviceGetVgpuTypeSupportedPlacements` + """ + cdef VgpuPlacementList_v2 p_placement_list_py = VgpuPlacementList_v2() + cdef nvmlVgpuPlacementList_t *p_placement_list = (p_placement_list_py._get_ptr()) + with nogil: + p_placement_list.count = 0 + p_placement_list.placementIds = NULL + p_placement_list.version = NVML_VERSION_STRUCT(sizeof(nvmlVgpuPlacementList_v2_t), 2) + __status__ = nvmlDeviceGetVgpuTypeSupportedPlacements(device, vgpu_type_id, p_placement_list) + check_status_size(__status__) + + if p_placement_list.count == 0: + return p_placement_list_py + + cdef view.array placement_ids = view.array(shape=(p_placement_list.count,), itemsize=sizeof(unsigned int), format="I", mode="c") + p_placement_list_py.placement_ids = placement_ids + + with nogil: + __status__ = nvmlDeviceGetVgpuTypeSupportedPlacements(device, vgpu_type_id, p_placement_list) + check_status(__status__) + + return p_placement_list_py + + +cpdef unsigned int vgpu_instance_get_placement_id(unsigned int vgpu_instance): + """Query the placement ID of active vGPU instance. + + Args: + vgpu_instance (unsigned int): Identifier of the target vGPU instance. + + Returns: + unsigned int: The placement ID + + .. seealso:: `nvmlVgpuInstanceGetPlacementId` + """ + cdef nvmlVgpuPlacementId_t[1] p_placement + with nogil: + p_placement[0].version = NVML_VERSION_STRUCT(sizeof(nvmlVgpuPlacementId_v1_t), 1) + __status__ = nvmlVgpuInstanceGetPlacementId(vgpu_instance, p_placement) + check_status(__status__) + return p_placement[0].placementId + + +cpdef object device_get_capabilities(intptr_t device): + """Get device capabilities. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + nvmlDeviceCapabilities_v1_t: Returns GPU's capabilities. + + .. seealso:: `nvmlDeviceGetCapabilities` + """ + cdef nvmlDeviceCapabilities_t[1] caps + with nogil: + caps[0].version = NVML_VERSION_STRUCT(sizeof(nvmlDeviceCapabilities_v1_t), 1) + __status__ = nvmlDeviceGetCapabilities(device, caps) + check_status(__status__) + return caps[0].capMask + + +cpdef object device_get_conf_compute_gpu_attestation_report(intptr_t device, char[32] nonce): + """Get Conf Computing GPU attestation report. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + nvmlConfComputeGpuAttestationReport_t: Reference in which to return the gpu attestation report. + + .. seealso:: `nvmlDeviceGetConfComputeGpuAttestationReport` + """ + cdef ConfComputeGpuAttestationReport gpu_atst_report_py = ConfComputeGpuAttestationReport() + cdef nvmlConfComputeGpuAttestationReport_t *gpu_atst_report = (gpu_atst_report_py._get_ptr()) + with nogil: + memcpy(gpu_atst_report.nonce, nonce, 32) + __status__ = nvmlDeviceGetConfComputeGpuAttestationReport(device, gpu_atst_report) + check_status(__status__) + return gpu_atst_report_py + + +cpdef tuple device_get_dram_encryption_mode(intptr_t device): + """Retrieves the current and pending DRAM Encryption modes for the device. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + A 2-tuple containing: + + - nvmlEnableState_t: Reference in which to return the current DRAM Encryption mode. + - nvmlEnableState_t: Reference in which to return the pending DRAM Encryption mode. + + .. seealso:: `nvmlDeviceGetDramEncryptionMode` + """ + cdef nvmlDramEncryptionInfo_t current + cdef nvmlDramEncryptionInfo_t pending + with nogil: + current.version = pending.version = NVML_VERSION_STRUCT(sizeof(nvmlDramEncryptionInfo_t), 1) + __status__ = nvmlDeviceGetDramEncryptionMode(device, ¤t, &pending) + check_status(__status__) + return (current.encryptionState, pending.encryptionState) + + +cpdef device_set_dram_encryption_mode(intptr_t device, int dram_encryption): + """Set the DRAM Encryption mode for the device. + + Args: + device (intptr_t): The identifier of the target device. + dram_encryption (nvmlEnableState_t): The target DRAM Encryption mode. + + .. seealso:: `nvmlDeviceSetDramEncryptionMode` + """ + cdef nvmlDramEncryptionInfo_t[1] encryption + with nogil: + encryption[0].version = NVML_VERSION_STRUCT(sizeof(nvmlDramEncryptionInfo_t), 1) + encryption[0].encryptionState = dram_encryption + __status__ = nvmlDeviceSetDramEncryptionMode(device, encryption) + check_status(__status__) + + +cpdef object device_get_gpu_instance_profile_info_by_id_v(intptr_t device, unsigned int profile_id): + """GPU instance profile query function that accepts profile ID, instead of profile name. It accepts a versioned ``nvmlGpuInstanceProfileInfo_v3_t`` or later output structure. + + Args: + device (intptr_t): The identifier of the target device. + profile_id (unsigned int): One of the profile IDs. + + Returns: + nvmlGpuInstanceProfileInfo_v3_t: Returns detailed profile information. + + .. seealso:: `nvmlDeviceGetGpuInstanceProfileInfoByIdV` + """ + cdef GpuInstanceProfileInfo_v3 info_py = GpuInstanceProfileInfo_v3() + cdef nvmlGpuInstanceProfileInfo_v3_t *info = (info_py._get_ptr()) + with nogil: + info.version = NVML_VERSION_STRUCT(sizeof(nvmlGpuInstanceProfileInfo_v3_t), 3) + __status__ = nvmlDeviceGetGpuInstanceProfileInfoByIdV(device, profile_id, info) + check_status(__status__) + return info_py + + +cpdef object device_get_gpu_instance_profile_info_v(intptr_t device, unsigned int profile): + """Versioned wrapper around ``nvmlDeviceGetGpuInstanceProfileInfo`` that accepts a versioned ``nvmlGpuInstanceProfileInfo_v3_t`` or later output structure. + + Args: + device (intptr_t): The identifier of the target device. + profile (unsigned int): One of the NVML_GPU_INSTANCE_PROFILE_*. + + Returns: + nvmlGpuInstanceProfileInfo_v3_t: Returns detailed profile information. + + .. seealso:: `nvmlDeviceGetGpuInstanceProfileInfoV` + """ + cdef GpuInstanceProfileInfo_v3 info_py = GpuInstanceProfileInfo_v3() + cdef nvmlGpuInstanceProfileInfo_v3_t *info = (info_py._get_ptr()) + with nogil: + info.version = NVML_VERSION_STRUCT(sizeof(nvmlGpuInstanceProfileInfo_v3_t), 3) + __status__ = nvmlDeviceGetGpuInstanceProfileInfoV(device, profile, info) + check_status(__status__) + return info_py + + +cpdef intptr_t device_get_handle_by_uuidv(int type, bytes uuid) except? 0: + """Acquire the handle for a particular device, based on its globally unique immutable UUID (in either ASCII or binary format) associated with each device. See ``nvmlUUID_v1_t`` for more information on the UUID struct. The caller must set the appropriate version prior to calling this API. + + Args: + type (UUIDType): The format of the UUID being provided (ASCII or binary). + uuid (intptr_t): The UUID of the target GPU or MIG instance. + + Returns: + intptr_t: Reference in which to return the device handle or MIG device handle. + + .. seealso:: `nvmlDeviceGetHandleByUUIDV` + """ + cdef Device device + cdef nvmlUUID_t[1] uuid_struct + cdef int NVML_DEVICE_UUID_ASCII_LEN = 41 + cdef int NVML_DEVICE_UUID_BINARY_LEN = 16 + cdef char *uuid_ptr = cpython.PyBytes_AsString(uuid) + + if type == UUIDType.ASCII: + if len(uuid) != NVML_DEVICE_UUID_ASCII_LEN - 1: + raise ValueError(f"UUID ASCII string must be {NVML_DEVICE_UUID_ASCII_LEN - 1} bytes long") + memcpy((uuid_struct[0].value.str), uuid_ptr, NVML_DEVICE_UUID_ASCII_LEN) + elif type == UUIDType.BINARY: + if len(uuid) != NVML_DEVICE_UUID_BINARY_LEN - 1: + raise ValueError(f"UUID binary string must be {NVML_DEVICE_UUID_BINARY_LEN - 1} bytes long") + memcpy((uuid_struct[0].value.bytes), uuid_ptr, NVML_DEVICE_UUID_BINARY_LEN) + else: + raise ValueError("Invalid UUID format specified") + + with nogil: + uuid_struct[0].version = NVML_VERSION_STRUCT(sizeof(nvmlUUID_v1_t), 1) + uuid_struct[0].type = type + __status__ = nvmlDeviceGetHandleByUUIDV(uuid_struct, &device) + check_status(__status__) + return device + + +cpdef unsigned long long device_get_pdi(intptr_t device): + """Retrieves the Per Device Identifier (PDI) associated with this device. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + unsigned long long: The GPU PDI. + + .. seealso:: `nvmlDeviceGetPdi` + """ + cdef nvmlPdi_v1_t[1] pdi + with nogil: + pdi[0].version = NVML_VERSION_STRUCT(sizeof(nvmlPdi_v1_t), 1) + __status__ = nvmlDeviceGetPdi(device, pdi) + check_status(__status__) + return pdi[0].value + + +cpdef str device_get_performance_modes(intptr_t device): + """Retrieves a performance mode string with all the performance modes defined for this device along with their associated GPU Clock and Memory Clock values. Not all tokens will be reported on all GPUs, and additional tokens may be added in the future. For backwards compatibility we still provide nvclock and memclock; those are the same as nvclockmin and memclockmin. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + str: The performance level string. + + .. seealso:: `nvmlDeviceGetPerformanceModes` + """ + cdef nvmlDevicePerfModes_t[1] perf_modes + with nogil: + perf_modes[0].version = NVML_VERSION_STRUCT(sizeof(nvmlDevicePerfModes_v1_t), 1) + __status__ = nvmlDeviceGetPerformanceModes(device, perf_modes) + check_status(__status__) + return cpython.PyUnicode_FromString(perf_modes[0].str) + + +cpdef unsigned int device_get_unrepairable_memory_flag_v1(intptr_t device): + """Get the unrepairable memory flag for a given GPU. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + unsigned int: unrepairable memory status + + .. seealso:: `nvmlDeviceGetUnrepairableMemoryFlag_v1` + """ + cdef nvmlUnrepairableMemoryStatus_v1_t[1] unrepairable_memory_status + with nogil: + __status__ = nvmlDeviceGetUnrepairableMemoryFlag_v1(device, unrepairable_memory_status) + check_status(__status__) + return unrepairable_memory_status.bUnrepairableMemory + + +cpdef unsigned int device_get_vgpu_heterogeneous_mode(intptr_t device): + """Get the vGPU heterogeneous mode for the device. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + unsigned int: The mode + + .. seealso:: `nvmlDeviceGetVgpuHeterogeneousMode` + """ + cdef nvmlVgpuHeterogeneousMode_t[1] heterogeneous_mode + with nogil: + heterogeneous_mode[0].version = NVML_VERSION_STRUCT(sizeof(nvmlVgpuHeterogeneousMode_v1_t), 1) + __status__ = nvmlDeviceGetVgpuHeterogeneousMode(device, heterogeneous_mode) + check_status(__status__) + return heterogeneous_mode[0].mode + + +cpdef device_set_vgpu_heterogeneous_mode(intptr_t device, int mode): + """Enable or disable vGPU heterogeneous mode for the device. + + Args: + device (intptr_t): Identifier of the target device. + heterogeneous_mode (unsigned int): mode + + .. seealso:: `nvmlDeviceSetVgpuHeterogeneousMode` + """ + cdef nvmlVgpuHeterogeneousMode_t[1] heterogeneous_mode + with nogil: + heterogeneous_mode[0].version = NVML_VERSION_STRUCT(sizeof(nvmlVgpuHeterogeneousMode_v1_t), 1) + heterogeneous_mode[0].mode = mode + __status__ = nvmlDeviceSetVgpuHeterogeneousMode(device, heterogeneous_mode) + check_status(__status__) + + +cpdef object gpu_instance_get_vgpu_heterogeneous_mode(intptr_t gpu_instance): + """Get the vGPU heterogeneous mode for the GPU instance. + + Args: + gpu_instance (intptr_t): The GPU instance handle. + + Returns: + unsigned int: the mode + + .. seealso:: `nvmlGpuInstanceGetVgpuHeterogeneousMode` + """ + cdef nvmlVgpuHeterogeneousMode_t[1] heterogeneous_mode + with nogil: + heterogeneous_mode[0].version = NVML_VERSION_STRUCT(sizeof(nvmlVgpuHeterogeneousMode_v1_t), 1) + __status__ = nvmlGpuInstanceGetVgpuHeterogeneousMode(gpu_instance, heterogeneous_mode) + check_status(__status__) + return heterogeneous_mode[0].mode + + +cpdef gpu_instance_set_vgpu_heterogeneous_mode(intptr_t gpu_instance, unsigned int mode): + """Enable or disable vGPU heterogeneous mode for the GPU instance. + + Args: + gpu_instance (intptr_t): The GPU instance handle. + mode (unsigned int): The mode + + .. seealso:: `nvmlGpuInstanceSetVgpuHeterogeneousMode` + """ + cdef nvmlVgpuHeterogeneousMode_t[1] heterogeneous_mode + with nogil: + heterogeneous_mode[0].version = NVML_VERSION_STRUCT(sizeof(nvmlVgpuHeterogeneousMode_v1_t), 1) + heterogeneous_mode[0].mode = mode + __status__ = nvmlGpuInstanceSetVgpuHeterogeneousMode(gpu_instance, heterogeneous_mode) + check_status(__status__) + + +cpdef tuple device_get_vgpu_utilization(intptr_t device, unsigned long long last_seen_time_stamp): + """Retrieves current utilization for vGPUs on a physical GPU (device). + + Args: + device (intptr_t): The identifier for the target device. + last_seen_time_stamp (unsigned long long): Return only samples with timestamp greater than last_seen_time_stamp. + + Returns: + A 2-tuple containing: + + - samples: Returned sample values. + - utilizationSamples: Utilization samples. + + .. seealso:: `nvmlDeviceGetVgpuUtilization` + """ + cdef unsigned int vgpu_instance_samples_count + with nogil: + __status__ = nvmlDeviceGetVgpuUtilization( + device, + last_seen_time_stamp, + NULL, + &vgpu_instance_samples_count, + NULL + ) + check_status_size(__status__) + + if vgpu_instance_samples_count == 0: + return ( + view.array(shape=(1,), itemsize=sizeof(int), format="I", mode="c")[:0], + VgpuInstanceUtilizationSample(0) + ) + + cdef view.array arr = view.array(shape=(vgpu_instance_samples_count,), itemsize=sizeof(int), format="I", mode="c") + cdef VgpuInstanceUtilizationSample utilization_samples_py = VgpuInstanceUtilizationSample(vgpu_instance_samples_count) + cdef nvmlVgpuInstanceUtilizationSample_t *ptr = utilization_samples_py._get_ptr() + + with nogil: + __status__ = nvmlDeviceGetVgpuUtilization( + device, + last_seen_time_stamp, + arr.data, + &vgpu_instance_samples_count, + ptr + ) + check_status(__status__) + + return (arr, utilization_samples_py) + + +cpdef object device_read_prm_counters_v1(intptr_t device, PRMCounter_v1 counters): + """Read a list of GPU PRM Counters. + + Args: + device (intptr_t): Identifer of target GPU device. + counters (PRMCounter_v1): Array holding the input parameters as well as the retrieved counter values. + + .. seealso:: `nvmlDeviceReadPRMCounters_v1` + """ + # Unlike in the raw C API, counter_list here is an PRMCounter_v1 + # AUTO_LOWPP_ARRAY, and we need to wrap it in a nvmlPRMCounterList_v1_t. + + cdef nvmlPRMCounterList_v1_t[1] counter_list + counter_list[0].numCounters = len(counters) + counter_list[0].counters = counters._get_ptr() + + with nogil: + __status__ = nvmlDeviceReadPRMCounters_v1(device, counter_list) + check_status(__status__) + + return counters + + +ctypedef union __nvmlPRMTLV_v1_value_t: + char[496] inData + char[496] outData + + +ctypedef struct __nvmlPRMTLV_v1_t: + unsigned dataSize + unsigned status + __nvmlPRMTLV_v1_value_t value + + +cpdef tuple device_read_write_prm_v1(intptr_t device, bytes in_data): + """Read or write a GPU PRM register. The input is assumed to be in TLV format in network byte order. + + Args: + device (intptr_t): Identifer of target GPU device. + in_data (bytes): The input data for the PRM register. + + Returns: + A 2-tuple containing: + + - unsigned int: Status of the PRM operation. + - bytes: Output data in TLV format. + + .. seealso:: `nvmlDeviceReadWritePRM_v1` + """ + cdef int NVML_PRM_DATA_MAX_SIZE = 496 + cdef __nvmlPRMTLV_v1_t buffer + cdef int in_data_size = len(in_data) + + if in_data_size > NVML_PRM_DATA_MAX_SIZE - 1: + raise ValueError(f"Input data size exceeds maximum allowed size of {NVML_PRM_DATA_MAX_SIZE - 1} bytes") + + cdef char *in_data_ptr = cpython.PyBytes_AsString(in_data) + + with nogil: + memcpy((buffer.value.inData), in_data_ptr, in_data_size) + buffer.dataSize = in_data_size + __status__ = nvmlDeviceReadWritePRM_v1(device, &buffer) + check_status(__status__) + + cdef bytes out_data = cpython.PyBytes_FromStringAndSize(buffer.value.outData, buffer.dataSize) + cdef unsigned int status = buffer.status + + return (status, out_data) + + +cpdef device_set_nvlink_device_low_power_threshold(intptr_t device, unsigned int threshold): + """Set NvLink Low Power Threshold for device. + + Args: + device (intptr_t): The identifier of the target device. + threshold (unsigned int): + + .. seealso:: `nvmlDeviceSetNvLinkDeviceLowPowerThreshold` + """ + cdef nvmlNvLinkPowerThres_t[1] info + + with nogil: + info[0].lowPwrThreshold + __status__ = nvmlDeviceSetNvLinkDeviceLowPowerThreshold(device, info) + check_status(__status__) + + +cpdef device_set_power_management_limit_v2(intptr_t device, int power_scope, unsigned int power_value_mw): + """Set new power limit of this device. + + Args: + device (intptr_t): The identifier of the target device. + power_scope (PowerScope): Device type + power_value_mw (unsigned int): Power value to retrieve or set in milliwatts + + .. seealso:: `nvmlDeviceSetPowerManagementLimit_v2` + """ + cdef nvmlPowerValue_v2_t[1] power_value + + with nogil: + power_value[0].version = NVML_VERSION_STRUCT(sizeof(nvmlPowerValue_v2_t), 2) + power_value[0].powerScope = power_scope + power_value[0].powerValueMw = power_value_mw + __status__ = nvmlDeviceSetPowerManagementLimit_v2(device, power_value) + check_status(__status__) + + +cpdef device_set_rusd_settings_v1(intptr_t device, unsigned long long poll_mask): + """Set Read-only user shared data (RUSD) settings for GPU. Requires root/admin permissions. + + Args: + device (intptr_t): The identifier of the target device. + poll_mask (unsigned long long): Bitmask of polling data. 0 value means the GPU's RUSD polling mask is cleared + + .. seealso:: `nvmlDeviceSetRusdSettings_v1` + """ + cdef nvmlRusdSettings_v1_t[1] settings + with nogil: + settings[0].version = NVML_VERSION_STRUCT(sizeof(nvmlRusdSettings_v1_t), 1) + settings[0].pollMask = poll_mask + __status__ = nvmlDeviceSetRusdSettings_v1(device, settings) + check_status(__status__) + + +cpdef device_set_temperature_threshold(intptr_t device, int threshold_type, int temp): + """Sets the temperature threshold for the GPU with the specified threshold type in degrees C. + + Args: + device (intptr_t): The identifier of the target device. + threshold_type (TemperatureThresholds): The type of threshold value to be set. + temp (int): The value to be set. + + .. seealso:: `nvmlDeviceSetTemperatureThreshold` + """ + with nogil: + __status__ = nvmlDeviceSetTemperatureThreshold(device, <_TemperatureThresholds>threshold_type, &temp) + check_status(__status__) + + +cpdef unsigned long long system_get_conf_compute_key_rotation_threshold_info(): + """Get Conf Computing key rotation threshold detail. + + Returns: + unsigned long long: The key rotation threshold data. + + .. seealso:: `nvmlSystemGetConfComputeKeyRotationThresholdInfo` + """ + cdef nvmlConfComputeGetKeyRotationThresholdInfo_t[1] key_rotation_thr_info + with nogil: + key_rotation_thr_info[0].version = NVML_VERSION_STRUCT(sizeof(nvmlConfComputeGetKeyRotationThresholdInfo_v1_t), 1) + __status__ = nvmlSystemGetConfComputeKeyRotationThresholdInfo(key_rotation_thr_info) + check_status(__status__) + return key_rotation_thr_info[0].attackerAdvantage + + +cpdef system_set_conf_compute_key_rotation_threshold_info(unsigned long long max_attacker_advantage): + """Set Conf Computing key rotation threshold. + + Args: + max_attacker_advantage (unsigned long long): The key rotation threshold data. + + .. seealso:: `nvmlSystemSetConfComputeKeyRotationThresholdInfo` + """ + cdef nvmlConfComputeSetKeyRotationThresholdInfo_t[1] key_rotation_thr_info + with nogil: + key_rotation_thr_info[0].version = NVML_VERSION_STRUCT(sizeof(nvmlConfComputeSetKeyRotationThresholdInfo_v1_t), 1) + key_rotation_thr_info[0].maxAttackerAdvantage = max_attacker_advantage + __status__ = nvmlSystemSetConfComputeKeyRotationThresholdInfo(key_rotation_thr_info) + check_status(__status__) + + +cpdef unsigned long long vgpu_instance_get_runtime_state_size(unsigned int vgpu_instance): + """Retrieve the currently used runtime state size of the vGPU instance. + + Args: + vgpu_instance (unsigned int): Identifier of the target vGPU instance. + + Returns: + unsigned long long: Runtime state size of the vGPU instance. + + .. seealso:: `nvmlVgpuInstanceGetRuntimeStateSize` + """ + cdef nvmlVgpuRuntimeState_t[1] p_state + with nogil: + p_state[0].version = NVML_VERSION_STRUCT(sizeof(nvmlVgpuRuntimeState_v1_t), 1) + __status__ = nvmlVgpuInstanceGetRuntimeStateSize(vgpu_instance, p_state) + check_status(__status__) + return p_state[0].size + + +cpdef unsigned int vgpu_type_get_max_instances_per_gpu_instance(unsigned int vgpu_type_id): + """Retrieve the maximum number of vGPU instances per GPU instance for given vGPU type. + + Args: + vgpu_type_id (VgpuTypeId): Handle to vGPU type. + + Returns: + unsigned int: Maximum number of vGPU instances per GPU instance + + .. seealso:: `nvmlVgpuTypeGetMaxInstancesPerGpuInstance` + """ + cdef nvmlVgpuTypeMaxInstance_t[1] max_instance + with nogil: + max_instance[0].version = NVML_VERSION_STRUCT(sizeof(nvmlVgpuTypeMaxInstance_v1_t), 1) + max_instance[0].vgpuTypeId = vgpu_type_id + __status__ = nvmlVgpuTypeGetMaxInstancesPerGpuInstance(max_instance) + check_status(__status__) + return max_instance[0].maxInstancePerGI + + +cpdef str device_get_current_clock_freqs(intptr_t device): + """Retrieves a string with the associated current GPU Clock and Memory Clock values. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + str: The current clock frequency string. + + .. seealso:: `nvmlDeviceGetCurrentClockFreqs` + """ + cdef nvmlDeviceCurrentClockFreqs_t[1] current_clock_freqs + with nogil: + current_clock_freqs[0].version = NVML_VERSION_STRUCT(sizeof(nvmlDeviceCurrentClockFreqs_v1_t), 1) + __status__ = nvmlDeviceGetCurrentClockFreqs(device, current_clock_freqs) + check_status(__status__) + return cpython.PyUnicode_FromString(current_clock_freqs[0].str) + + +cpdef str vgpu_type_get_name(unsigned int vgpu_type_id): + """Retrieve the vGPU type name. + + Args: + vgpu_type_id (unsigned int): Handle to vGPU type. + + .. seealso:: `nvmlVgpuTypeGetName` + """ + cdef unsigned int[1] size = [64] + cdef char[64] vgpu_type_name + with nogil: + __status__ = nvmlVgpuTypeGetName(vgpu_type_id, vgpu_type_name, size) + check_status(__status__) + return cpython.PyUnicode_FromStringAndSize(vgpu_type_name, size[0]) + + +# Cleanup some docstrings that don't parse as rst. +device_get_virtualization_mode.__doc__ = device_get_virtualization_mode.__doc__.replace("NVML_GPU_VIRTUALIZATION_?", "``NVML_GPU_VIRTUALIZATION_?``") +device_set_virtualization_mode.__doc__ = device_set_virtualization_mode.__doc__.replace("NVML_GPU_VIRTUALIZATION_?", "``NVML_GPU_VIRTUALIZATION_?``") +GpmMetricId.GPM_METRIC_DRAM_BW_UTIL.__doc__ = "Percentage of DRAM bw used vs theoretical maximum. ``0.0 - 100.0 *\u200d/``." +del _cyb_FastEnum diff --git a/cuda_bindings/cuda/bindings/nvrtc.pxd b/cuda_bindings/cuda/bindings/nvrtc.pxd new file mode 100644 index 00000000000..a17faea0763 --- /dev/null +++ b/cuda_bindings/cuda/bindings/nvrtc.pxd @@ -0,0 +1,94 @@ +# SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +# This code was automatically generated with version 13.3.0. Do not modify it directly. +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=06a058e3c626563f034714cce129fd58b33dd80c0e4a954723e92d0ae61c7c58 +cimport cuda.bindings.cynvrtc as cynvrtc + +include "_lib/utils.pxd" + +cdef class nvrtcProgram: + """ nvrtcProgram is the unit of compilation, and an opaque handle for a program. + + To compile a CUDA program string, an instance of nvrtcProgram must be created first with nvrtcCreateProgram, then compiled with nvrtcCompileProgram. + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + cdef cynvrtc.nvrtcProgram _pvt_val + cdef cynvrtc.nvrtcProgram* _pvt_ptr + +cdef class anon_struct0: + """ + Attributes + ---------- + + available : int + + + + compressedSize : size_t + + + + uncompressedSize : size_t + + + + cudaVersionMajor : int + + + + cudaVersionMinor : int + + + + numFiles : unsigned int + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + cdef cynvrtc.nvrtcBundledHeadersInfo* _pvt_ptr + +cdef class nvrtcBundledHeadersInfo(anon_struct0): + """ + Attributes + ---------- + + available : int + + + + compressedSize : size_t + + + + uncompressedSize : size_t + + + + cudaVersionMajor : int + + + + cudaVersionMinor : int + + + + numFiles : unsigned int + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + cdef cynvrtc.nvrtcBundledHeadersInfo _pvt_val diff --git a/cuda_bindings/cuda/bindings/nvrtc.pyx b/cuda_bindings/cuda/bindings/nvrtc.pyx new file mode 100644 index 00000000000..d963b48f791 --- /dev/null +++ b/cuda_bindings/cuda/bindings/nvrtc.pyx @@ -0,0 +1,1382 @@ +# SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +# This code was automatically generated with version 13.3.0. Do not modify it directly. +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=ac1af34ecd1468ac91074ce7f18423af19fbc7727653cdfc1cd9b6f33f6cec72 +from typing import Any, Optional +import cython +import ctypes +from libc.stdlib cimport calloc, malloc, free +from libc cimport string +from libc.stdint cimport int32_t, uint32_t, int64_t, uint64_t, uintptr_t +from libc.stddef cimport wchar_t +from libc.limits cimport CHAR_MIN +from libcpp.vector cimport vector +from cpython.buffer cimport PyObject_CheckBuffer, PyObject_GetBuffer, PyBuffer_Release, PyBUF_SIMPLE, PyBUF_ANY_CONTIGUOUS +from cpython.bytes cimport PyBytes_FromStringAndSize +from ._internal._fast_enum import FastEnum as _FastEnum + +import cuda.bindings.driver as _driver +_driver = _driver.__dict__ +include "_lib/utils.pxi" + +ctypedef unsigned long long signed_char_ptr +ctypedef unsigned long long unsigned_char_ptr +ctypedef unsigned long long char_ptr +ctypedef unsigned long long short_ptr +ctypedef unsigned long long unsigned_short_ptr +ctypedef unsigned long long int_ptr +ctypedef unsigned long long long_int_ptr +ctypedef unsigned long long long_long_int_ptr +ctypedef unsigned long long unsigned_int_ptr +ctypedef unsigned long long unsigned_long_int_ptr +ctypedef unsigned long long unsigned_long_long_int_ptr +ctypedef unsigned long long uint32_t_ptr +ctypedef unsigned long long uint64_t_ptr +ctypedef unsigned long long int32_t_ptr +ctypedef unsigned long long int64_t_ptr +ctypedef unsigned long long unsigned_ptr +ctypedef unsigned long long unsigned_long_long_ptr +ctypedef unsigned long long long_long_ptr +ctypedef unsigned long long size_t_ptr +ctypedef unsigned long long long_ptr +ctypedef unsigned long long float_ptr +ctypedef unsigned long long double_ptr +ctypedef unsigned long long void_ptr + +#: Flags for nvrtcInstallBundledHeaders.Skip installation if version marker +#: exists and version matches. This is the default behavior when flags=0. +NVRTC_INSTALL_HEADERS_SKIP_IF_EXISTS = cynvrtc.NVRTC_INSTALL_HEADERS_SKIP_IF_EXISTS + +#: Clear existing directory contents before installation. Guarantees +#: consistency by removing any existing files first. +NVRTC_INSTALL_HEADERS_FORCE_OVERWRITE = cynvrtc.NVRTC_INSTALL_HEADERS_FORCE_OVERWRITE + +#: Return NVRTC_ERROR_BUSY immediately if installation is in progress by +#: another process, instead of waiting for the lock. Can be combined with +#: FORCE_OVERWRITE using bitwise OR. +NVRTC_INSTALL_HEADERS_NO_WAIT = cynvrtc.NVRTC_INSTALL_HEADERS_NO_WAIT + +class nvrtcResult(_FastEnum): + """ + The enumerated type :py:obj:`~.nvrtcResult` defines API call result + codes. NVRTC API functions return :py:obj:`~.nvrtcResult` to + indicate the call result. + """ + + NVRTC_SUCCESS = cynvrtc.nvrtcResult.NVRTC_SUCCESS + + NVRTC_ERROR_OUT_OF_MEMORY = cynvrtc.nvrtcResult.NVRTC_ERROR_OUT_OF_MEMORY + + NVRTC_ERROR_PROGRAM_CREATION_FAILURE = cynvrtc.nvrtcResult.NVRTC_ERROR_PROGRAM_CREATION_FAILURE + + NVRTC_ERROR_INVALID_INPUT = cynvrtc.nvrtcResult.NVRTC_ERROR_INVALID_INPUT + + NVRTC_ERROR_INVALID_PROGRAM = cynvrtc.nvrtcResult.NVRTC_ERROR_INVALID_PROGRAM + + NVRTC_ERROR_INVALID_OPTION = cynvrtc.nvrtcResult.NVRTC_ERROR_INVALID_OPTION + + NVRTC_ERROR_COMPILATION = cynvrtc.nvrtcResult.NVRTC_ERROR_COMPILATION + + NVRTC_ERROR_BUILTIN_OPERATION_FAILURE = cynvrtc.nvrtcResult.NVRTC_ERROR_BUILTIN_OPERATION_FAILURE + + NVRTC_ERROR_NO_NAME_EXPRESSIONS_AFTER_COMPILATION = cynvrtc.nvrtcResult.NVRTC_ERROR_NO_NAME_EXPRESSIONS_AFTER_COMPILATION + + NVRTC_ERROR_NO_LOWERED_NAMES_BEFORE_COMPILATION = cynvrtc.nvrtcResult.NVRTC_ERROR_NO_LOWERED_NAMES_BEFORE_COMPILATION + + NVRTC_ERROR_NAME_EXPRESSION_NOT_VALID = cynvrtc.nvrtcResult.NVRTC_ERROR_NAME_EXPRESSION_NOT_VALID + + NVRTC_ERROR_INTERNAL_ERROR = cynvrtc.nvrtcResult.NVRTC_ERROR_INTERNAL_ERROR + + NVRTC_ERROR_TIME_FILE_WRITE_FAILED = cynvrtc.nvrtcResult.NVRTC_ERROR_TIME_FILE_WRITE_FAILED + + NVRTC_ERROR_NO_PCH_CREATE_ATTEMPTED = cynvrtc.nvrtcResult.NVRTC_ERROR_NO_PCH_CREATE_ATTEMPTED + + NVRTC_ERROR_PCH_CREATE_HEAP_EXHAUSTED = cynvrtc.nvrtcResult.NVRTC_ERROR_PCH_CREATE_HEAP_EXHAUSTED + + NVRTC_ERROR_PCH_CREATE = cynvrtc.nvrtcResult.NVRTC_ERROR_PCH_CREATE + + NVRTC_ERROR_CANCELLED = cynvrtc.nvrtcResult.NVRTC_ERROR_CANCELLED + + NVRTC_ERROR_TIME_TRACE_FILE_WRITE_FAILED = cynvrtc.nvrtcResult.NVRTC_ERROR_TIME_TRACE_FILE_WRITE_FAILED + + NVRTC_ERROR_BUSY = cynvrtc.nvrtcResult.NVRTC_ERROR_BUSY + +cdef object _nvrtcResult = nvrtcResult +cdef object _nvrtcResult_SUCCESS = nvrtcResult.NVRTC_SUCCESS + +cdef class nvrtcProgram: + """ nvrtcProgram is the unit of compilation, and an opaque handle for a program. + + To compile a CUDA program string, an instance of nvrtcProgram must be created first with nvrtcCreateProgram, then compiled with nvrtcCompileProgram. + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __eq__(self, other): + if not isinstance(other, nvrtcProgram): + return False + return self._pvt_ptr[0] == (other)._pvt_ptr[0] + def __hash__(self): + return hash((self._pvt_ptr[0])) + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class anon_struct0: + """ + Attributes + ---------- + + available : int + + + + compressedSize : size_t + + + + uncompressedSize : size_t + + + + cudaVersionMajor : int + + + + cudaVersionMinor : int + + + + numFiles : unsigned int + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr): + self._pvt_ptr = _ptr + + def __init__(self, void_ptr _ptr): + pass + def __dealloc__(self): + pass + def getPtr(self): + return self._pvt_ptr + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['available : ' + str(self.available)] + except ValueError: + str_list += ['available : '] + + + try: + str_list += ['compressedSize : ' + str(self.compressedSize)] + except ValueError: + str_list += ['compressedSize : '] + + + try: + str_list += ['uncompressedSize : ' + str(self.uncompressedSize)] + except ValueError: + str_list += ['uncompressedSize : '] + + + try: + str_list += ['cudaVersionMajor : ' + str(self.cudaVersionMajor)] + except ValueError: + str_list += ['cudaVersionMajor : '] + + + try: + str_list += ['cudaVersionMinor : ' + str(self.cudaVersionMinor)] + except ValueError: + str_list += ['cudaVersionMinor : '] + + + try: + str_list += ['numFiles : ' + str(self.numFiles)] + except ValueError: + str_list += ['numFiles : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def available(self): + return self._pvt_ptr[0].available + @available.setter + def available(self, int available): + self._pvt_ptr[0].available = available + + + @property + def compressedSize(self): + return self._pvt_ptr[0].compressedSize + @compressedSize.setter + def compressedSize(self, size_t compressedSize): + self._pvt_ptr[0].compressedSize = compressedSize + + + @property + def uncompressedSize(self): + return self._pvt_ptr[0].uncompressedSize + @uncompressedSize.setter + def uncompressedSize(self, size_t uncompressedSize): + self._pvt_ptr[0].uncompressedSize = uncompressedSize + + + @property + def cudaVersionMajor(self): + return self._pvt_ptr[0].cudaVersionMajor + @cudaVersionMajor.setter + def cudaVersionMajor(self, int cudaVersionMajor): + self._pvt_ptr[0].cudaVersionMajor = cudaVersionMajor + + + @property + def cudaVersionMinor(self): + return self._pvt_ptr[0].cudaVersionMinor + @cudaVersionMinor.setter + def cudaVersionMinor(self, int cudaVersionMinor): + self._pvt_ptr[0].cudaVersionMinor = cudaVersionMinor + + + @property + def numFiles(self): + return self._pvt_ptr[0].numFiles + @numFiles.setter + def numFiles(self, unsigned int numFiles): + self._pvt_ptr[0].numFiles = numFiles + + +cdef class nvrtcBundledHeadersInfo(anon_struct0): + """ + Attributes + ---------- + + available : int + + + + compressedSize : size_t + + + + uncompressedSize : size_t + + + + cudaVersionMajor : int + + + + cudaVersionMinor : int + + + + numFiles : unsigned int + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + + def __init__(self, void_ptr _ptr = 0): + pass + +@cython.embedsignature(True) +def nvrtcGetErrorString(result not None : nvrtcResult): + """ nvrtcGetErrorString is a helper function that returns a string describing the given :py:obj:`~.nvrtcResult` code, e.g., NVRTC_SUCCESS to `"NVRTC_SUCCESS"`. For unrecognized enumeration values, it returns `"NVRTC_ERROR unknown"`. + + Parameters + ---------- + result : :py:obj:`~.nvrtcResult` + CUDA Runtime Compilation API result code. + + Returns + ------- + nvrtcResult.NVRTC_SUCCESS + nvrtcResult.NVRTC_SUCCESS + bytes + Message string for the given :py:obj:`~.nvrtcResult` code. + """ + cdef cynvrtc.nvrtcResult cyresult = int(result) + with nogil: + err = cynvrtc.nvrtcGetErrorString(cyresult) + return (nvrtcResult.NVRTC_SUCCESS, err) + +@cython.embedsignature(True) +def nvrtcVersion(): + """ nvrtcVersion sets the output parameters `major` and `minor` with the CUDA Runtime Compilation version number. + + Returns + ------- + nvrtcResult + - :py:obj:`~.NVRTC_SUCCESS` + - :py:obj:`~.NVRTC_ERROR_INVALID_INPUT` + major : int + CUDA Runtime Compilation major version number. + minor : int + CUDA Runtime Compilation minor version number. + """ + cdef int major = 0 + cdef int minor = 0 + with nogil: + err = cynvrtc.nvrtcVersion(&major, &minor) + if err != cynvrtc.NVRTC_SUCCESS: + return (_nvrtcResult(err), None, None) + return (_nvrtcResult_SUCCESS, major, minor) + +@cython.embedsignature(True) +def nvrtcGetNumSupportedArchs(): + """ nvrtcGetNumSupportedArchs sets the output parameter `numArchs` with the number of architectures supported by NVRTC. This can then be used to pass an array to :py:obj:`~.nvrtcGetSupportedArchs` to get the supported architectures. + + see :py:obj:`~.nvrtcGetSupportedArchs` + + Returns + ------- + nvrtcResult + - :py:obj:`~.NVRTC_SUCCESS` + - :py:obj:`~.NVRTC_ERROR_INVALID_INPUT` + numArchs : int + number of supported architectures. + """ + cdef int numArchs = 0 + with nogil: + err = cynvrtc.nvrtcGetNumSupportedArchs(&numArchs) + if err != cynvrtc.NVRTC_SUCCESS: + return (_nvrtcResult(err), None) + return (_nvrtcResult_SUCCESS, numArchs) + +@cython.embedsignature(True) +def nvrtcGetSupportedArchs(): + """ nvrtcGetSupportedArchs populates the array passed via the output parameter `supportedArchs` with the architectures supported by NVRTC. The array is sorted in the ascending order. The size of the array to be passed can be determined using :py:obj:`~.nvrtcGetNumSupportedArchs`. + + see :py:obj:`~.nvrtcGetNumSupportedArchs` + + Returns + ------- + nvrtcResult + - :py:obj:`~.NVRTC_SUCCESS` + - :py:obj:`~.NVRTC_ERROR_INVALID_INPUT` + supportedArchs : list[int] + sorted array of supported architectures. + """ + cdef vector[int] supportedArchs + _, s = nvrtcGetNumSupportedArchs() + supportedArchs.resize(s) + + with nogil: + err = cynvrtc.nvrtcGetSupportedArchs(supportedArchs.data()) + if err != cynvrtc.NVRTC_SUCCESS: + return (_nvrtcResult(err), None) + return (_nvrtcResult_SUCCESS, supportedArchs) + +@cython.embedsignature(True) +def nvrtcCreateProgram(char* src, char* name, int numHeaders, headers : Optional[tuple[bytes] | list[bytes]], includeNames : Optional[tuple[bytes] | list[bytes]]): + """ nvrtcCreateProgram creates an instance of :py:obj:`~.nvrtcProgram` with the given input parameters, and sets the output parameter `prog` with it. + + Parameters + ---------- + src : bytes + CUDA program source. + name : bytes + CUDA program name. `name` can be `NULL`; `"default_program"` is + used when `name` is `NULL` or "". + numHeaders : int + Number of headers used. `numHeaders` must be greater than or equal + to 0. + headers : list[bytes] + Sources of the headers. `headers` can be `NULL` when `numHeaders` + is 0. + includeNames : list[bytes] + Name of each header by which they can be included in the CUDA + program source. `includeNames` can be `NULL` when `numHeaders` is + 0. These headers must be included with the exact names specified + here. + + Returns + ------- + nvrtcResult + - :py:obj:`~.NVRTC_SUCCESS` + - :py:obj:`~.NVRTC_ERROR_OUT_OF_MEMORY` + - :py:obj:`~.NVRTC_ERROR_PROGRAM_CREATION_FAILURE` + - :py:obj:`~.NVRTC_ERROR_INVALID_INPUT` + - :py:obj:`~.NVRTC_ERROR_INVALID_PROGRAM` + prog : :py:obj:`~.nvrtcProgram` + CUDA Runtime Compilation program. + + See Also + -------- + :py:obj:`~.nvrtcDestroyProgram` + """ + includeNames = [] if includeNames is None else includeNames + if not all(isinstance(_x, (bytes)) for _x in includeNames): + raise TypeError("Argument 'includeNames' is not instance of type (expected tuple[bytes] or list[bytes]") + headers = [] if headers is None else headers + if not all(isinstance(_x, (bytes)) for _x in headers): + raise TypeError("Argument 'headers' is not instance of type (expected tuple[bytes] or list[bytes]") + cdef nvrtcProgram prog = nvrtcProgram() + if numHeaders > len(headers): raise RuntimeError("List is too small: " + str(len(headers)) + " < " + str(numHeaders)) + if numHeaders > len(includeNames): raise RuntimeError("List is too small: " + str(len(includeNames)) + " < " + str(numHeaders)) + cdef vector[const char*] cyheaders = headers + cdef vector[const char*] cyincludeNames = includeNames + with nogil: + err = cynvrtc.nvrtcCreateProgram(prog._pvt_ptr, src, name, numHeaders, cyheaders.data(), cyincludeNames.data()) + if err != cynvrtc.NVRTC_SUCCESS: + return (_nvrtcResult(err), None) + return (_nvrtcResult_SUCCESS, prog) + +@cython.embedsignature(True) +def nvrtcDestroyProgram(prog): + """ nvrtcDestroyProgram destroys the given program. + + Parameters + ---------- + prog : :py:obj:`~.nvrtcProgram` + CUDA Runtime Compilation program. + + Returns + ------- + nvrtcResult + - :py:obj:`~.NVRTC_SUCCESS` + - :py:obj:`~.NVRTC_ERROR_INVALID_PROGRAM` + + See Also + -------- + :py:obj:`~.nvrtcCreateProgram` + """ + cdef cynvrtc.nvrtcProgram *cyprog + if prog is None: + cyprog = NULL + elif isinstance(prog, (nvrtcProgram,)): + pprog = prog.getPtr() + cyprog = pprog + elif isinstance(prog, (int)): + cyprog = prog + else: + raise TypeError("Argument 'prog' is not instance of type (expected , found " + str(type(prog))) + with nogil: + err = cynvrtc.nvrtcDestroyProgram(cyprog) + return (_nvrtcResult(err),) + +@cython.embedsignature(True) +def nvrtcCompileProgram(prog, int numOptions, options : Optional[tuple[bytes] | list[bytes]]): + """ nvrtcCompileProgram compiles the given program. + + It supports compile options listed in :py:obj:`~.Supported Compile + Options`. + + Parameters + ---------- + prog : :py:obj:`~.nvrtcProgram` + CUDA Runtime Compilation program. + numOptions : int + Number of compiler options passed. + options : list[bytes] + Compiler options in the form of C string array. `options` can be + `NULL` when `numOptions` is 0. + + Returns + ------- + nvrtcResult + - :py:obj:`~.NVRTC_SUCCESS` + - :py:obj:`~.NVRTC_ERROR_OUT_OF_MEMORY` + - :py:obj:`~.NVRTC_ERROR_INVALID_INPUT` + - :py:obj:`~.NVRTC_ERROR_INVALID_PROGRAM` + - :py:obj:`~.NVRTC_ERROR_INVALID_OPTION` + - :py:obj:`~.NVRTC_ERROR_COMPILATION` + - :py:obj:`~.NVRTC_ERROR_BUILTIN_OPERATION_FAILURE` + - :py:obj:`~.NVRTC_ERROR_TIME_FILE_WRITE_FAILED` + - :py:obj:`~.NVRTC_ERROR_CANCELLED` + """ + options = [] if options is None else options + if not all(isinstance(_x, (bytes)) for _x in options): + raise TypeError("Argument 'options' is not instance of type (expected tuple[bytes] or list[bytes]") + cdef cynvrtc.nvrtcProgram cyprog + if prog is None: + pprog = 0 + elif isinstance(prog, (nvrtcProgram,)): + pprog = int(prog) + else: + pprog = int(nvrtcProgram(prog)) + cyprog = pprog + if numOptions > len(options): raise RuntimeError("List is too small: " + str(len(options)) + " < " + str(numOptions)) + cdef vector[const char*] cyoptions = options + with nogil: + err = cynvrtc.nvrtcCompileProgram(cyprog, numOptions, cyoptions.data()) + return (_nvrtcResult(err),) + +@cython.embedsignature(True) +def nvrtcGetPTXSize(prog): + """ nvrtcGetPTXSize sets the value of `ptxSizeRet` with the size of the PTX generated by the previous compilation of `prog` (including the trailing `NULL`). + + Parameters + ---------- + prog : :py:obj:`~.nvrtcProgram` + CUDA Runtime Compilation program. + + Returns + ------- + nvrtcResult + - :py:obj:`~.NVRTC_SUCCESS` + - :py:obj:`~.NVRTC_ERROR_INVALID_INPUT` + - :py:obj:`~.NVRTC_ERROR_INVALID_PROGRAM` + ptxSizeRet : int + Size of the generated PTX (including the trailing `NULL`). + + See Also + -------- + :py:obj:`~.nvrtcGetPTX` + """ + cdef cynvrtc.nvrtcProgram cyprog + if prog is None: + pprog = 0 + elif isinstance(prog, (nvrtcProgram,)): + pprog = int(prog) + else: + pprog = int(nvrtcProgram(prog)) + cyprog = pprog + cdef size_t ptxSizeRet = 0 + with nogil: + err = cynvrtc.nvrtcGetPTXSize(cyprog, &ptxSizeRet) + if err != cynvrtc.NVRTC_SUCCESS: + return (_nvrtcResult(err), None) + return (_nvrtcResult_SUCCESS, ptxSizeRet) + +@cython.embedsignature(True) +def nvrtcGetPTX(prog, char* ptx): + """ nvrtcGetPTX stores the PTX generated by the previous compilation of `prog` in the memory pointed by `ptx`. + + Parameters + ---------- + prog : :py:obj:`~.nvrtcProgram` + CUDA Runtime Compilation program. + ptx : bytes + Compiled result. + + Returns + ------- + nvrtcResult + - :py:obj:`~.NVRTC_SUCCESS` + - :py:obj:`~.NVRTC_ERROR_INVALID_INPUT` + - :py:obj:`~.NVRTC_ERROR_INVALID_PROGRAM` + + See Also + -------- + :py:obj:`~.nvrtcGetPTXSize` + """ + cdef cynvrtc.nvrtcProgram cyprog + if prog is None: + pprog = 0 + elif isinstance(prog, (nvrtcProgram,)): + pprog = int(prog) + else: + pprog = int(nvrtcProgram(prog)) + cyprog = pprog + with nogil: + err = cynvrtc.nvrtcGetPTX(cyprog, ptx) + return (_nvrtcResult(err),) + +@cython.embedsignature(True) +def nvrtcGetCUBINSize(prog): + """ nvrtcGetCUBINSize sets the value of `cubinSizeRet` with the size of the cubin generated by the previous compilation of `prog`. The value of cubinSizeRet is set to 0 if the value specified to `-arch` is a virtual architecture instead of an actual architecture. + + Parameters + ---------- + prog : :py:obj:`~.nvrtcProgram` + CUDA Runtime Compilation program. + + Returns + ------- + nvrtcResult + - :py:obj:`~.NVRTC_SUCCESS` + - :py:obj:`~.NVRTC_ERROR_INVALID_INPUT` + - :py:obj:`~.NVRTC_ERROR_INVALID_PROGRAM` + cubinSizeRet : int + Size of the generated cubin. + + See Also + -------- + :py:obj:`~.nvrtcGetCUBIN` + """ + cdef cynvrtc.nvrtcProgram cyprog + if prog is None: + pprog = 0 + elif isinstance(prog, (nvrtcProgram,)): + pprog = int(prog) + else: + pprog = int(nvrtcProgram(prog)) + cyprog = pprog + cdef size_t cubinSizeRet = 0 + with nogil: + err = cynvrtc.nvrtcGetCUBINSize(cyprog, &cubinSizeRet) + if err != cynvrtc.NVRTC_SUCCESS: + return (_nvrtcResult(err), None) + return (_nvrtcResult_SUCCESS, cubinSizeRet) + +@cython.embedsignature(True) +def nvrtcGetCUBIN(prog, char* cubin): + """ nvrtcGetCUBIN stores the cubin generated by the previous compilation of `prog` in the memory pointed by `cubin`. No cubin is available if the value specified to `-arch` is a virtual architecture instead of an actual architecture. The cubin does not contain code for the Tile functions (`__tile__` / `__tile_global__`) or variables (`__tile__`); use `nvrtcGetTileIR()` to extract the cuda_tile IR generated for Tile code. + + Parameters + ---------- + prog : :py:obj:`~.nvrtcProgram` + CUDA Runtime Compilation program. + cubin : bytes + Compiled and assembled result. + + Returns + ------- + nvrtcResult + - :py:obj:`~.NVRTC_SUCCESS` + - :py:obj:`~.NVRTC_ERROR_INVALID_INPUT` + - :py:obj:`~.NVRTC_ERROR_INVALID_PROGRAM` + + See Also + -------- + :py:obj:`~.nvrtcGetCUBINSize` + """ + cdef cynvrtc.nvrtcProgram cyprog + if prog is None: + pprog = 0 + elif isinstance(prog, (nvrtcProgram,)): + pprog = int(prog) + else: + pprog = int(nvrtcProgram(prog)) + cyprog = pprog + with nogil: + err = cynvrtc.nvrtcGetCUBIN(cyprog, cubin) + return (_nvrtcResult(err),) + +@cython.embedsignature(True) +def nvrtcGetLTOIRSize(prog): + """ nvrtcGetLTOIRSize sets the value of `LTOIRSizeRet` with the size of the LTO IR generated by the previous compilation of `prog`. The value of LTOIRSizeRet is set to 0 if the program was not compiled with `-dlto`. + + Parameters + ---------- + prog : :py:obj:`~.nvrtcProgram` + CUDA Runtime Compilation program. + + Returns + ------- + nvrtcResult + - :py:obj:`~.NVRTC_SUCCESS` + - :py:obj:`~.NVRTC_ERROR_INVALID_INPUT` + - :py:obj:`~.NVRTC_ERROR_INVALID_PROGRAM` + LTOIRSizeRet : int + Size of the generated LTO IR. + + See Also + -------- + :py:obj:`~.nvrtcGetLTOIR` + """ + cdef cynvrtc.nvrtcProgram cyprog + if prog is None: + pprog = 0 + elif isinstance(prog, (nvrtcProgram,)): + pprog = int(prog) + else: + pprog = int(nvrtcProgram(prog)) + cyprog = pprog + cdef size_t LTOIRSizeRet = 0 + with nogil: + err = cynvrtc.nvrtcGetLTOIRSize(cyprog, <OIRSizeRet) + if err != cynvrtc.NVRTC_SUCCESS: + return (_nvrtcResult(err), None) + return (_nvrtcResult_SUCCESS, LTOIRSizeRet) + +@cython.embedsignature(True) +def nvrtcGetLTOIR(prog, char* LTOIR): + """ nvrtcGetLTOIR stores the LTO IR generated by the previous compilation of `prog` in the memory pointed by `LTOIR`. No LTO IR is available if the program was compiled without `-dlto`. + + Parameters + ---------- + prog : :py:obj:`~.nvrtcProgram` + CUDA Runtime Compilation program. + LTOIR : bytes + Compiled result. + + Returns + ------- + nvrtcResult + - :py:obj:`~.NVRTC_SUCCESS` + - :py:obj:`~.NVRTC_ERROR_INVALID_INPUT` + - :py:obj:`~.NVRTC_ERROR_INVALID_PROGRAM` + + See Also + -------- + :py:obj:`~.nvrtcGetLTOIRSize` + """ + cdef cynvrtc.nvrtcProgram cyprog + if prog is None: + pprog = 0 + elif isinstance(prog, (nvrtcProgram,)): + pprog = int(prog) + else: + pprog = int(nvrtcProgram(prog)) + cyprog = pprog + with nogil: + err = cynvrtc.nvrtcGetLTOIR(cyprog, LTOIR) + return (_nvrtcResult(err),) + +@cython.embedsignature(True) +def nvrtcGetOptiXIRSize(prog): + """ nvrtcGetOptiXIRSize sets the value of `optixirSizeRet` with the size of the OptiX IR generated by the previous compilation of `prog`. The value of nvrtcGetOptiXIRSize is set to 0 if the program was compiled with options incompatible with OptiX IR generation. + + Parameters + ---------- + prog : :py:obj:`~.nvrtcProgram` + CUDA Runtime Compilation program. + + Returns + ------- + nvrtcResult + - :py:obj:`~.NVRTC_SUCCESS` + - :py:obj:`~.NVRTC_ERROR_INVALID_INPUT` + - :py:obj:`~.NVRTC_ERROR_INVALID_PROGRAM` + optixirSizeRet : int + Size of the generated LTO IR. + + See Also + -------- + :py:obj:`~.nvrtcGetOptiXIR` + """ + cdef cynvrtc.nvrtcProgram cyprog + if prog is None: + pprog = 0 + elif isinstance(prog, (nvrtcProgram,)): + pprog = int(prog) + else: + pprog = int(nvrtcProgram(prog)) + cyprog = pprog + cdef size_t optixirSizeRet = 0 + with nogil: + err = cynvrtc.nvrtcGetOptiXIRSize(cyprog, &optixirSizeRet) + if err != cynvrtc.NVRTC_SUCCESS: + return (_nvrtcResult(err), None) + return (_nvrtcResult_SUCCESS, optixirSizeRet) + +@cython.embedsignature(True) +def nvrtcGetOptiXIR(prog, char* optixir): + """ nvrtcGetOptiXIR stores the OptiX IR generated by the previous compilation of `prog` in the memory pointed by `optixir`. No OptiX IR is available if the program was compiled with options incompatible with OptiX IR generation. + + Parameters + ---------- + prog : :py:obj:`~.nvrtcProgram` + CUDA Runtime Compilation program. + optixir : bytes + Optix IR Compiled result. + + Returns + ------- + nvrtcResult + - :py:obj:`~.NVRTC_SUCCESS` + - :py:obj:`~.NVRTC_ERROR_INVALID_INPUT` + - :py:obj:`~.NVRTC_ERROR_INVALID_PROGRAM` + + See Also + -------- + :py:obj:`~.nvrtcGetOptiXIRSize` + """ + cdef cynvrtc.nvrtcProgram cyprog + if prog is None: + pprog = 0 + elif isinstance(prog, (nvrtcProgram,)): + pprog = int(prog) + else: + pprog = int(nvrtcProgram(prog)) + cyprog = pprog + with nogil: + err = cynvrtc.nvrtcGetOptiXIR(cyprog, optixir) + return (_nvrtcResult(err),) + +@cython.embedsignature(True) +def nvrtcGetProgramLogSize(prog): + """ nvrtcGetProgramLogSize sets `logSizeRet` with the size of the log generated by the previous compilation of `prog` (including the trailing `NULL`). + + Note that compilation log may be generated with warnings and + informative messages, even when the compilation of `prog` succeeds. + + Parameters + ---------- + prog : :py:obj:`~.nvrtcProgram` + CUDA Runtime Compilation program. + + Returns + ------- + nvrtcResult + - :py:obj:`~.NVRTC_SUCCESS` + - :py:obj:`~.NVRTC_ERROR_INVALID_INPUT` + - :py:obj:`~.NVRTC_ERROR_INVALID_PROGRAM` + logSizeRet : int + Size of the compilation log (including the trailing `NULL`). + + See Also + -------- + :py:obj:`~.nvrtcGetProgramLog` + """ + cdef cynvrtc.nvrtcProgram cyprog + if prog is None: + pprog = 0 + elif isinstance(prog, (nvrtcProgram,)): + pprog = int(prog) + else: + pprog = int(nvrtcProgram(prog)) + cyprog = pprog + cdef size_t logSizeRet = 0 + with nogil: + err = cynvrtc.nvrtcGetProgramLogSize(cyprog, &logSizeRet) + if err != cynvrtc.NVRTC_SUCCESS: + return (_nvrtcResult(err), None) + return (_nvrtcResult_SUCCESS, logSizeRet) + +@cython.embedsignature(True) +def nvrtcGetProgramLog(prog, char* log): + """ nvrtcGetProgramLog stores the log generated by the previous compilation of `prog` in the memory pointed by `log`. + + Parameters + ---------- + prog : :py:obj:`~.nvrtcProgram` + CUDA Runtime Compilation program. + log : bytes + Compilation log. + + Returns + ------- + nvrtcResult + - :py:obj:`~.NVRTC_SUCCESS` + - :py:obj:`~.NVRTC_ERROR_INVALID_INPUT` + - :py:obj:`~.NVRTC_ERROR_INVALID_PROGRAM` + + See Also + -------- + :py:obj:`~.nvrtcGetProgramLogSize` + """ + cdef cynvrtc.nvrtcProgram cyprog + if prog is None: + pprog = 0 + elif isinstance(prog, (nvrtcProgram,)): + pprog = int(prog) + else: + pprog = int(nvrtcProgram(prog)) + cyprog = pprog + with nogil: + err = cynvrtc.nvrtcGetProgramLog(cyprog, log) + return (_nvrtcResult(err),) + +@cython.embedsignature(True) +def nvrtcAddNameExpression(prog, char* name_expression): + """ nvrtcAddNameExpression notes the given name expression denoting the address of a global function or device/__constant__ variable. + + The identical name expression string must be provided on a subsequent + call to nvrtcGetLoweredName to extract the lowered name. + + Parameters + ---------- + prog : :py:obj:`~.nvrtcProgram` + CUDA Runtime Compilation program. + name_expression : bytes + constant expression denoting the address of a global function or + device/__constant__ variable. + + Returns + ------- + nvrtcResult + - :py:obj:`~.NVRTC_SUCCESS` + - :py:obj:`~.NVRTC_ERROR_INVALID_PROGRAM` + - :py:obj:`~.NVRTC_ERROR_INVALID_INPUT` + - :py:obj:`~.NVRTC_ERROR_NO_NAME_EXPRESSIONS_AFTER_COMPILATION` + + See Also + -------- + :py:obj:`~.nvrtcGetLoweredName` + """ + cdef cynvrtc.nvrtcProgram cyprog + if prog is None: + pprog = 0 + elif isinstance(prog, (nvrtcProgram,)): + pprog = int(prog) + else: + pprog = int(nvrtcProgram(prog)) + cyprog = pprog + with nogil: + err = cynvrtc.nvrtcAddNameExpression(cyprog, name_expression) + return (_nvrtcResult(err),) + +@cython.embedsignature(True) +def nvrtcGetLoweredName(prog, char* name_expression): + """ nvrtcGetLoweredName extracts the lowered (mangled) name for a global function or device/__constant__ variable, and updates lowered_name to point to it. The memory containing the name is released when the NVRTC program is destroyed by nvrtcDestroyProgram. The identical name expression must have been previously provided to nvrtcAddNameExpression. + + Parameters + ---------- + prog : nvrtcProgram + CUDA Runtime Compilation program. + name_expression : bytes + constant expression denoting the address of a global function or + device/__constant__ variable. + + Returns + ------- + nvrtcResult + NVRTC_SUCCESS + NVRTC_ERROR_NO_LOWERED_NAMES_BEFORE_COMPILATION + NVRTC_ERROR_NAME_EXPRESSION_NOT_VALID + lowered_name : bytes + initialized by the function to point to a C string containing the + lowered (mangled) name corresponding to the provided name + expression. + + See Also + -------- + nvrtcAddNameExpression + """ + cdef cynvrtc.nvrtcProgram cyprog + if prog is None: + pprog = 0 + elif isinstance(prog, (nvrtcProgram,)): + pprog = int(prog) + else: + pprog = int(nvrtcProgram(prog)) + cyprog = pprog + cdef const char* lowered_name = NULL + with nogil: + err = cynvrtc.nvrtcGetLoweredName(cyprog, name_expression, &lowered_name) + if err != cynvrtc.NVRTC_SUCCESS: + return (_nvrtcResult(err), None) + return (_nvrtcResult_SUCCESS, lowered_name if lowered_name != NULL else None) + +@cython.embedsignature(True) +def nvrtcGetPCHHeapSize(): + """ retrieve the current size of the PCH Heap. + + Returns + ------- + nvrtcResult + - :py:obj:`~.NVRTC_SUCCESS` + - :py:obj:`~.NVRTC_ERROR_INVALID_INPUT` + ret : int + pointer to location where the size of the PCH Heap will be stored + """ + cdef size_t ret = 0 + with nogil: + err = cynvrtc.nvrtcGetPCHHeapSize(&ret) + if err != cynvrtc.NVRTC_SUCCESS: + return (_nvrtcResult(err), None) + return (_nvrtcResult_SUCCESS, ret) + +@cython.embedsignature(True) +def nvrtcSetPCHHeapSize(size_t size): + """ set the size of the PCH Heap. + + The requested size may be rounded up to a platform dependent alignment + (e.g. page size). If the PCH Heap has already been allocated, the heap + memory will be freed and a new PCH Heap will be allocated. + + Parameters + ---------- + size : size_t + requested size of the PCH Heap, in bytes + + Returns + ------- + nvrtcResult + - :py:obj:`~.NVRTC_SUCCESS` + """ + with nogil: + err = cynvrtc.nvrtcSetPCHHeapSize(size) + return (_nvrtcResult(err),) + +@cython.embedsignature(True) +def nvrtcGetPCHCreateStatus(prog): + """ returns the PCH creation status. + + NVRTC_SUCCESS indicates that the PCH was successfully created. + NVRTC_ERROR_NO_PCH_CREATE_ATTEMPTED indicates that no PCH creation was + attempted, either because PCH functionality was not requested during + the preceding nvrtcCompileProgram call, or automatic PCH processing was + requested, and compiler chose not to create a PCH file. + NVRTC_ERROR_PCH_CREATE_HEAP_EXHAUSTED indicates that a PCH file could + potentially have been created, but the compiler ran out space in the + PCH heap. In this scenario, the + :py:obj:`~.nvrtcGetPCHHeapSizeRequired()` can be used to query the + required heap size, the heap can be reallocated for this size with + :py:obj:`~.nvrtcSetPCHHeapSize()` and PCH creation may be reattempted + again invoking :py:obj:`~.nvrtcCompileProgram()` with a new NVRTC + program instance. NVRTC_ERROR_PCH_CREATE indicates that an error + condition prevented the PCH file from being created. + + Parameters + ---------- + prog : :py:obj:`~.nvrtcProgram` + CUDA Runtime Compilation program. + + Returns + ------- + nvrtcResult + - :py:obj:`~.NVRTC_SUCCESS` + - :py:obj:`~.NVRTC_ERROR_NO_PCH_CREATE_ATTEMPTED` + - :py:obj:`~.NVRTC_ERROR_PCH_CREATE` + - :py:obj:`~.NVRTC_ERROR_PCH_CREATE_HEAP_EXHAUSTED` + - :py:obj:`~.NVRTC_ERROR_INVALID_PROGRAM` + """ + cdef cynvrtc.nvrtcProgram cyprog + if prog is None: + pprog = 0 + elif isinstance(prog, (nvrtcProgram,)): + pprog = int(prog) + else: + pprog = int(nvrtcProgram(prog)) + cyprog = pprog + with nogil: + err = cynvrtc.nvrtcGetPCHCreateStatus(cyprog) + return (_nvrtcResult(err),) + +@cython.embedsignature(True) +def nvrtcGetPCHHeapSizeRequired(prog): + """ retrieve the required size of the PCH heap required to compile the given program. + + Parameters + ---------- + prog : :py:obj:`~.nvrtcProgram` + CUDA Runtime Compilation program. + + Returns + ------- + nvrtcResult + - :py:obj:`~.NVRTC_SUCCESS` + - :py:obj:`~.NVRTC_ERROR_INVALID_PROGRAM` + - :py:obj:`~.NVRTC_ERROR_INVALID_INPUT` The size retrieved using this function is only valid if :py:obj:`~.nvrtcGetPCHCreateStatus()` returned NVRTC_SUCCESS or NVRTC_ERROR_PCH_CREATE_HEAP_EXHAUSTED + size : int + pointer to location where the required size of the PCH Heap will be + stored + """ + cdef cynvrtc.nvrtcProgram cyprog + if prog is None: + pprog = 0 + elif isinstance(prog, (nvrtcProgram,)): + pprog = int(prog) + else: + pprog = int(nvrtcProgram(prog)) + cyprog = pprog + cdef size_t size = 0 + with nogil: + err = cynvrtc.nvrtcGetPCHHeapSizeRequired(cyprog, &size) + if err != cynvrtc.NVRTC_SUCCESS: + return (_nvrtcResult(err), None) + return (_nvrtcResult_SUCCESS, size) + +@cython.embedsignature(True) +def nvrtcSetFlowCallback(prog, callback, payload): + """ nvrtcSetFlowCallback registers a callback function that the compiler will invoke at different points during a call to nvrtcCompileProgram, and the callback function can decide whether to cancel compilation by returning specific values. + + The callback function must satisfy the following constraints: + + (1) Its signature should be: + + **View CUDA Toolkit Documentation for a C++ code example** + + When invoking the callback, the compiler will always pass `payload` to + param1 so that the callback may make decisions based on `payload` . + It'll always pass NULL to param2 for now which is reserved for future + extensions. + + (2) It must return 1 to cancel compilation or 0 to continue. Other + return values are reserved for future use. + + (3) It must return consistent values. Once it returns 1 at one point, + it must return 1 in all following invocations during the current + nvrtcCompileProgram call in progress. + + (4) It must be thread-safe. + + (5) It must not invoke any nvrtc/libnvvm/ptx APIs. + + Parameters + ---------- + prog : :py:obj:`~.nvrtcProgram` + CUDA Runtime Compilation program. + callback : Any + the callback that issues cancellation signal. + payload : Any + to be passed as a parameter when invoking the callback. + + Returns + ------- + nvrtcResult + - :py:obj:`~.NVRTC_SUCCESS` + - :py:obj:`~.NVRTC_ERROR_INVALID_PROGRAM` + - :py:obj:`~.NVRTC_ERROR_INVALID_INPUT` + """ + cdef cynvrtc.nvrtcProgram cyprog + if prog is None: + pprog = 0 + elif isinstance(prog, (nvrtcProgram,)): + pprog = int(prog) + else: + pprog = int(nvrtcProgram(prog)) + cyprog = pprog + cdef _HelperInputVoidPtrStruct cycallbackHelper + cdef void* cycallback = _helper_input_void_ptr(callback, &cycallbackHelper) + cdef _HelperInputVoidPtrStruct cypayloadHelper + cdef void* cypayload = _helper_input_void_ptr(payload, &cypayloadHelper) + with nogil: + err = cynvrtc.nvrtcSetFlowCallback(cyprog, cycallback, cypayload) + _helper_input_void_ptr_free(&cycallbackHelper) + _helper_input_void_ptr_free(&cypayloadHelper) + return (_nvrtcResult(err),) + +@cython.embedsignature(True) +def nvrtcGetTileIRSize(prog): + """ nvrtcGetTileIRSize sets the value of `TileIRSizeRet` with the size of the cuda_tile IR generated by the previous compilation of `prog`. + + Parameters + ---------- + prog : :py:obj:`~.nvrtcProgram` + CUDA Runtime Compilation program. + + Returns + ------- + nvrtcResult + - :py:obj:`~.NVRTC_SUCCESS` + - :py:obj:`~.NVRTC_ERROR_INVALID_INPUT` + - :py:obj:`~.NVRTC_ERROR_INVALID_PROGRAM` + TileIRSizeRet : int + Size of the generated cuda_tile IR. + + See Also + -------- + :py:obj:`~.nvrtcGetTileIR` + """ + cdef cynvrtc.nvrtcProgram cyprog + if prog is None: + pprog = 0 + elif isinstance(prog, (nvrtcProgram,)): + pprog = int(prog) + else: + pprog = int(nvrtcProgram(prog)) + cyprog = pprog + cdef size_t TileIRSizeRet = 0 + with nogil: + err = cynvrtc.nvrtcGetTileIRSize(cyprog, &TileIRSizeRet) + if err != cynvrtc.NVRTC_SUCCESS: + return (_nvrtcResult(err), None) + return (_nvrtcResult_SUCCESS, TileIRSizeRet) + +@cython.embedsignature(True) +def nvrtcGetTileIR(prog, char* TileIR): + """ nvrtcGetTileIR stores the cuda_tile IR generated by the previous compilation of `prog` in the memory pointed by `TileIR`. + + Parameters + ---------- + prog : :py:obj:`~.nvrtcProgram` + CUDA Runtime Compilation program. + TileIR : bytes + Generated cuda_tile IR. + + Returns + ------- + nvrtcResult + - :py:obj:`~.NVRTC_SUCCESS` + - :py:obj:`~.NVRTC_ERROR_INVALID_INPUT` + - :py:obj:`~.NVRTC_ERROR_INVALID_PROGRAM` + + See Also + -------- + :py:obj:`~.nvrtcGetTileIRSize` + """ + cdef cynvrtc.nvrtcProgram cyprog + if prog is None: + pprog = 0 + elif isinstance(prog, (nvrtcProgram,)): + pprog = int(prog) + else: + pprog = int(nvrtcProgram(prog)) + cyprog = pprog + with nogil: + err = cynvrtc.nvrtcGetTileIR(cyprog, TileIR) + return (_nvrtcResult(err),) + +@cython.embedsignature(True) +def nvrtcInstallBundledHeaders(char* installPath, unsigned int flags): + """ nvrtcInstallBundledHeaders extracts CUDA headers bundled with NVRTC to a specified directory for use during compilation. + + NVRTC bundles a set of CUDA Toolkit headers and CUDA C++ Core Libraries + (CCCL) within libnvrtc-builtins. This function extracts these headers + to the specified directory, allowing NVRTC programs to compile without + requiring a separate CUDA Toolkit installation. The bundled headers + match those available in the CUDA Toolkit plus CCCL libraries. + + After extraction, users can compile kernels by passing appropriate + include paths (such as "-I" and "-I/cccl") to + nvrtcCompileProgram. + + A version marker file (.nvrtc_headers_version) is created in the + installation directory to track the installed version. + + This function is thread-safe and process-safe. Concurrent calls from + multiple threads or processes will be serialized using file locking. By + default, the function waits for the lock; use + NVRTC_INSTALL_HEADERS_NO_WAIT to return immediately with + NVRTC_ERROR_BUSY if another process holds the lock. + + Parameters + ---------- + installPath : bytes + Path where headers should be extracted (UTF-8 encoded). The + directory will be created if it doesn't exist. + flags : unsigned int + NVRTC_INSTALL_HEADERS_* flags: + + Returns + ------- + nvrtcResult + - :py:obj:`~.NVRTC_SUCCESS` + - :py:obj:`~.NVRTC_ERROR_INVALID_INPUT` (invalid path or conflicting flags like SKIP_IF_EXISTS | FORCE_OVERWRITE) + - :py:obj:`~.NVRTC_ERROR_BUILTIN_OPERATION_FAILURE` (extraction failed or version mismatch) + - :py:obj:`~.NVRTC_ERROR_BUSY` (lock held by another process and NVRTC_INSTALL_HEADERS_NO_WAIT was specified) + errorLog : bytes + Optional pointer to receive detailed error message on failure. If + non-NULL, `*errorLog` will be set to point to a string describing + the error cause. Note: subsequent API calls from the same thread + may overwrite this message. May be NULL if error details are not + needed. + + See Also + -------- + :py:obj:`~.nvrtcCompileProgram` + + Notes + ----- + Use NVRTC_INSTALL_HEADERS_SKIP_IF_EXISTS to avoid reinstalling if headers already exist. Use NVRTC_INSTALL_HEADERS_FORCE_OVERWRITE to guarantee consistency by clearing the directory first. + """ + cdef const char* errorLog = NULL + with nogil: + err = cynvrtc.nvrtcInstallBundledHeaders(installPath, flags, &errorLog) + if err != cynvrtc.NVRTC_SUCCESS: + return (_nvrtcResult(err), None) + return (_nvrtcResult_SUCCESS, errorLog if errorLog != NULL else None) + +@cython.embedsignature(True) +def nvrtcGetBundledHeadersInfo(): + """ nvrtcGetBundledHeadersInfo queries information about the bundled headers without extracting them. + + This function allows users to determine if bundled headers are + available and get size estimates before calling + nvrtcInstallBundledHeaders. + + Returns + ------- + nvrtcResult + - :py:obj:`~.NVRTC_SUCCESS` + - :py:obj:`~.NVRTC_ERROR_INVALID_INPUT` (info is NULL) + - :py:obj:`~.NVRTC_ERROR_BUILTIN_OPERATION_FAILURE` (failed to query bundled headers) + info : :py:obj:`~.nvrtcBundledHeadersInfo` + Pointer to structure to receive header information. + errorLog : bytes + Optional pointer to receive detailed error message on failure. If + non-NULL, `*errorLog` will be set to point to a string describing + the error cause. Note: subsequent API calls from the same thread + may overwrite this message. May be NULL if error details are not + needed. + """ + cdef nvrtcBundledHeadersInfo info = nvrtcBundledHeadersInfo() + cdef const char* errorLog = NULL + with nogil: + err = cynvrtc.nvrtcGetBundledHeadersInfo(info._pvt_ptr, &errorLog) + if err != cynvrtc.NVRTC_SUCCESS: + return (_nvrtcResult(err), None, None) + return (_nvrtcResult_SUCCESS, info, errorLog if errorLog != NULL else None) + +@cython.embedsignature(True) +def nvrtcRemoveBundledHeaders(char* installPath): + """ nvrtcRemoveBundledHeaders removes previously installed bundled headers. + + This function removes the headers installed by + nvrtcInstallBundledHeaders, helping users manage disk space. It + recursively removes all files and subdirectories within the + installation directory. + + Parameters + ---------- + installPath : bytes + Path where headers were previously installed. Must be the same path + used with nvrtcInstallBundledHeaders. + + Returns + ------- + nvrtcResult + - :py:obj:`~.NVRTC_SUCCESS` + - :py:obj:`~.NVRTC_ERROR_INVALID_INPUT` (invalid path) + - :py:obj:`~.NVRTC_ERROR_BUILTIN_OPERATION_FAILURE` (removal failed) + errorLog : bytes + Optional pointer to receive detailed error message on failure. If + non-NULL, `*errorLog` will be set to point to a string describing + the error cause. Note: subsequent API calls from the same thread + may overwrite this message. May be NULL if error details are not + needed. + + Notes + ----- + This function will remove ALL contents of the specified directory, not just files installed by NVRTC. Use with caution. + """ + cdef const char* errorLog = NULL + with nogil: + err = cynvrtc.nvrtcRemoveBundledHeaders(installPath, &errorLog) + if err != cynvrtc.NVRTC_SUCCESS: + return (_nvrtcResult(err), None) + return (_nvrtcResult_SUCCESS, errorLog if errorLog != NULL else None) + +@cython.embedsignature(True) +def sizeof(objType): + """ Returns the size of provided CUDA Python structure in bytes + + Parameters + ---------- + objType : Any + CUDA Python object + + Returns + ------- + lowered_name : int + The size of `objType` in bytes + """ + + if objType == nvrtcProgram: + return sizeof(cynvrtc.nvrtcProgram) + + if objType == nvrtcBundledHeadersInfo: + return sizeof(cynvrtc.nvrtcBundledHeadersInfo) + raise TypeError("Unknown type: " + str(objType)) diff --git a/cuda_bindings/cuda/bindings/nvvm.pxd b/cuda_bindings/cuda/bindings/nvvm.pxd new file mode 100644 index 00000000000..cb97bd48714 --- /dev/null +++ b/cuda_bindings/cuda/bindings/nvvm.pxd @@ -0,0 +1,43 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +# This code was automatically generated across versions from 12.0.1 to 13.3.0. Do not modify it directly. + +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=b4e10f31d2308a47fccfc9401d4f179bf61d389c1eb1491e8f9b00bf37a14ea9 +from libc.stdint cimport intptr_t + +from .cynvvm cimport * + + +############################################################################### +# Types +############################################################################### + +ctypedef nvvmProgram Program + + +############################################################################### +# Enum +############################################################################### + +ctypedef nvvmResult _Result + + +############################################################################### +# Functions +############################################################################### + +cpdef str get_error_string(int result) +cpdef tuple version() +cpdef tuple ir_version() +cpdef intptr_t create_program() except? 0 +cpdef add_module_to_program(intptr_t prog, buffer, size_t size, name) +cpdef lazy_add_module_to_program(intptr_t prog, buffer, size_t size, name) +cpdef compile_program(intptr_t prog, int num_options, options) +cpdef verify_program(intptr_t prog, int num_options, options) +cpdef size_t get_compiled_result_size(intptr_t prog) except? 0 +cpdef get_compiled_result(intptr_t prog, buffer) +cpdef size_t get_program_log_size(intptr_t prog) except? 0 +cpdef get_program_log(intptr_t prog, buffer) +cpdef int llvm_version(arch) except? 0 diff --git a/cuda_bindings/cuda/bindings/nvvm.pyx b/cuda_bindings/cuda/bindings/nvvm.pyx new file mode 100644 index 00000000000..6d18a50f24c --- /dev/null +++ b/cuda_bindings/cuda/bindings/nvvm.pyx @@ -0,0 +1,334 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +# This code was automatically generated across versions from 12.0.1 to 13.3.0. Do not modify it directly. +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=82dc56ccc695031faa515d1971c9841131d5aadc60c6d6e6cc223580fc544d16 + + +# <<<< PREAMBLE CONTENT >>>> + +from cuda.bindings._internal._fast_enum import FastEnum as _cyb_FastEnum + + +# <<<< END OF PREAMBLE CONTENT >>>> + +cimport cython # NOQA + +from ._internal.utils cimport (get_buffer_pointer, get_nested_resource_ptr, + nested_resource) + + +############################################################################### +# Enum +############################################################################### + +class Result(_cyb_FastEnum): + """ + NVVM API call result code. + + See `nvvmResult`. + """ + SUCCESS = NVVM_SUCCESS + ERROR_OUT_OF_MEMORY = NVVM_ERROR_OUT_OF_MEMORY + ERROR_PROGRAM_CREATION_FAILURE = NVVM_ERROR_PROGRAM_CREATION_FAILURE + ERROR_IR_VERSION_MISMATCH = NVVM_ERROR_IR_VERSION_MISMATCH + ERROR_INVALID_INPUT = NVVM_ERROR_INVALID_INPUT + ERROR_INVALID_PROGRAM = NVVM_ERROR_INVALID_PROGRAM + ERROR_INVALID_IR = NVVM_ERROR_INVALID_IR + ERROR_INVALID_OPTION = NVVM_ERROR_INVALID_OPTION + ERROR_NO_MODULE_IN_PROGRAM = NVVM_ERROR_NO_MODULE_IN_PROGRAM + ERROR_COMPILATION = NVVM_ERROR_COMPILATION + ERROR_CANCELLED = NVVM_ERROR_CANCELLED + + +############################################################################### +# Error handling +############################################################################### + +class nvvmError(Exception): + + def __init__(self, status): + self.status = status + s = Result(status) + cdef str err = f"{s.name} ({s.value})" + super(nvvmError, self).__init__(err) + + def __reduce__(self): + return (type(self), (self.status,)) + + +@cython.profile(False) +cdef int check_status(int status) except 1 nogil: + if status != 0: + with gil: + raise nvvmError(status) + return status + + +############################################################################### +# Wrapper functions +############################################################################### + +cpdef destroy_program(intptr_t prog): + """Destroy a program. + + Args: + prog (intptr_t): nvvm prog. + + .. seealso:: `nvvmDestroyProgram` + """ + cdef Program p = prog + with nogil: + status = nvvmDestroyProgram(&p) + check_status(status) + + +cpdef str get_error_string(int result): + """Get the message string for the given ``nvvmResult`` code. + + Args: + result (Result): NVVM API result code. + + .. seealso:: `nvvmGetErrorString` + """ + cdef const char *_output_cstr_ + cdef bytes _output_ + with nogil: + _output_cstr_ = nvvmGetErrorString(<_Result>result) + _output_ = _output_cstr_ + return _output_.decode() + + +cpdef tuple version(): + """Get the NVVM version. + + Returns: + A 2-tuple containing: + + - int: NVVM major version number. + - int: NVVM minor version number. + + .. seealso:: `nvvmVersion` + """ + cdef int major + cdef int minor + with nogil: + __status__ = nvvmVersion(&major, &minor) + check_status(__status__) + return (major, minor) + + +cpdef tuple ir_version(): + """Get the NVVM IR version. + + Returns: + A 4-tuple containing: + + - int: NVVM IR major version number. + - int: NVVM IR minor version number. + - int: NVVM IR debug metadata major version number. + - int: NVVM IR debug metadata minor version number. + + .. seealso:: `nvvmIRVersion` + """ + cdef int major_ir + cdef int minor_ir + cdef int major_dbg + cdef int minor_dbg + with nogil: + __status__ = nvvmIRVersion(&major_ir, &minor_ir, &major_dbg, &minor_dbg) + check_status(__status__) + return (major_ir, minor_ir, major_dbg, minor_dbg) + + +cpdef intptr_t create_program() except? 0: + """Create a program, and set the value of its handle to ``*prog``. + + Returns: + intptr_t: NVVM program. + + .. seealso:: `nvvmCreateProgram` + """ + cdef Program prog + with nogil: + __status__ = nvvmCreateProgram(&prog) + check_status(__status__) + return prog + + +cpdef add_module_to_program(intptr_t prog, buffer, size_t size, name): + """Add a module level NVVM IR to a program. + + Args: + prog (intptr_t): NVVM program. + buffer (bytes): NVVM IR module in the bitcode or text representation. + size (size_t): Size of the NVVM IR module. + name (str): Name of the NVVM IR module. If NULL, "" is used as the name. + + .. seealso:: `nvvmAddModuleToProgram` + """ + cdef void* _buffer_ = get_buffer_pointer(buffer, size, readonly=True) + if not isinstance(name, str): + raise TypeError("name must be a Python str") + cdef bytes _temp_name_ = (name).encode() + cdef char* _name_ = _temp_name_ + with nogil: + __status__ = nvvmAddModuleToProgram(prog, _buffer_, size, _name_) + check_status(__status__) + + +cpdef lazy_add_module_to_program(intptr_t prog, buffer, size_t size, name): + """Add a module level NVVM IR to a program. + + Args: + prog (intptr_t): NVVM program. + buffer (bytes): NVVM IR module in the bitcode representation. + size (size_t): Size of the NVVM IR module. + name (str): Name of the NVVM IR module. If NULL, "" is used as the name. + + .. seealso:: `nvvmLazyAddModuleToProgram` + """ + cdef void* _buffer_ = get_buffer_pointer(buffer, size, readonly=True) + if not isinstance(name, str): + raise TypeError("name must be a Python str") + cdef bytes _temp_name_ = (name).encode() + cdef char* _name_ = _temp_name_ + with nogil: + __status__ = nvvmLazyAddModuleToProgram(prog, _buffer_, size, _name_) + check_status(__status__) + + +cpdef compile_program(intptr_t prog, int num_options, options): + """Compile the NVVM program. + + Args: + prog (intptr_t): NVVM program. + num_options (int): Number of compiler ``options`` passed. + options (object): Compiler options in the form of C string array. It can be: + + - an :class:`int` as the pointer address to the nested sequence, or + - a Python sequence of :class:`int`\s, each of which is a pointer address + to a valid sequence of 'char', or + - a nested Python sequence of ``str``. + + + .. seealso:: `nvvmCompileProgram` + """ + cdef nested_resource[ char ] _options_ + get_nested_resource_ptr[char](_options_, options, NULL) + with nogil: + __status__ = nvvmCompileProgram(prog, num_options, (_options_.ptrs.data())) + check_status(__status__) + + +cpdef verify_program(intptr_t prog, int num_options, options): + """Verify the NVVM program. + + Args: + prog (intptr_t): NVVM program. + num_options (int): Number of compiler ``options`` passed. + options (object): Compiler options in the form of C string array. It can be: + + - an :class:`int` as the pointer address to the nested sequence, or + - a Python sequence of :class:`int`\s, each of which is a pointer address + to a valid sequence of 'char', or + - a nested Python sequence of ``str``. + + + .. seealso:: `nvvmVerifyProgram` + """ + cdef nested_resource[ char ] _options_ + get_nested_resource_ptr[char](_options_, options, NULL) + with nogil: + __status__ = nvvmVerifyProgram(prog, num_options, (_options_.ptrs.data())) + check_status(__status__) + + +cpdef size_t get_compiled_result_size(intptr_t prog) except? 0: + """Get the size of the compiled result. + + Args: + prog (intptr_t): NVVM program. + + Returns: + size_t: Size of the compiled result (including the trailing NULL). + + .. seealso:: `nvvmGetCompiledResultSize` + """ + cdef size_t buffer_size_ret + with nogil: + __status__ = nvvmGetCompiledResultSize(prog, &buffer_size_ret) + check_status(__status__) + return buffer_size_ret + + +cpdef get_compiled_result(intptr_t prog, buffer): + """Get the compiled result. + + Args: + prog (intptr_t): NVVM program. + buffer (bytes): Compiled result. + + .. seealso:: `nvvmGetCompiledResult` + """ + cdef void* _buffer_ = get_buffer_pointer(buffer, -1, readonly=False) + with nogil: + __status__ = nvvmGetCompiledResult(prog, _buffer_) + check_status(__status__) + + +cpdef size_t get_program_log_size(intptr_t prog) except? 0: + """Get the Size of Compiler/Verifier Message. + + Args: + prog (intptr_t): NVVM program. + + Returns: + size_t: Size of the compilation/verification log (including the trailing NULL). + + .. seealso:: `nvvmGetProgramLogSize` + """ + cdef size_t buffer_size_ret + with nogil: + __status__ = nvvmGetProgramLogSize(prog, &buffer_size_ret) + check_status(__status__) + return buffer_size_ret + + +cpdef get_program_log(intptr_t prog, buffer): + """Get the Compiler/Verifier Message. + + Args: + prog (intptr_t): NVVM program. + buffer (bytes): Compilation/Verification log. + + .. seealso:: `nvvmGetProgramLog` + """ + cdef void* _buffer_ = get_buffer_pointer(buffer, -1, readonly=False) + with nogil: + __status__ = nvvmGetProgramLog(prog, _buffer_) + check_status(__status__) + + +cpdef int llvm_version(arch) except? 0: + """Get the LLVM IR version guaranteed to be supported by NVVM. + + Args: + arch (str): Architecture string. + + Returns: + int: IR version number. + + .. seealso:: `nvvmLLVMVersion` + """ + if not isinstance(arch, str): + raise TypeError("arch must be a Python str") + cdef bytes _temp_arch_ = (arch).encode() + cdef char* _arch_ = _temp_arch_ + cdef int major + with nogil: + __status__ = nvvmLLVMVersion(_arch_, &major) + check_status(__status__) + return major +del _cyb_FastEnum diff --git a/cuda/cudart.pxd.in b/cuda_bindings/cuda/bindings/runtime.pxd similarity index 61% rename from cuda/cudart.pxd.in rename to cuda_bindings/cuda/bindings/runtime.pxd index a23c879b6f3..7cb680d1743 100644 --- a/cuda/cudart.pxd.in +++ b/cuda_bindings/cuda/bindings/runtime.pxd @@ -1,15 +1,40 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. -# -# Please refer to the NVIDIA end user license agreement (EULA) associated -# with this source code for terms and conditions that govern your use of -# this software. Any use, reproduction, disclosure, or distribution of -# this software and related documentation outside the terms of the EULA -# is strictly prohibited. -cimport cuda.ccudart as ccudart -cimport cuda._lib.utils as utils -cimport cuda.cuda as cuda - -{{if 'cudaArray_t' in found_types}} +# SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +# This code was automatically generated with version 13.3.0. Do not modify it directly. +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=0f2431380680008795336b7acb5ccd83dba7a6e05d0c81c2b5f825bc95576ccd +cimport cuda.bindings.cyruntime as cyruntime + +include "_lib/utils.pxd" +cimport cuda.bindings.driver as driver + +cdef class cudaDevResourceDesc_t: + """ + + An opaque descriptor handle. The descriptor encapsulates multiple created and configured resources. Created via ::cudaDeviceResourceGenerateDesc + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + cdef cyruntime.cudaDevResourceDesc_t _pvt_val + cdef cyruntime.cudaDevResourceDesc_t* _pvt_ptr + +cdef class cudaExecutionContext_t: + """ + + An opaque handle to a CUDA execution context. It represents an execution context created via CUDA Runtime APIs such as cudaGreenCtxCreate. + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + cdef cyruntime.cudaExecutionContext_t _pvt_val + cdef cyruntime.cudaExecutionContext_t* _pvt_ptr cdef class cudaArray_t: """ @@ -22,11 +47,8 @@ cdef class cudaArray_t: Get memory address of class instance """ - cdef ccudart.cudaArray_t __val - cdef ccudart.cudaArray_t* _ptr -{{endif}} - -{{if 'cudaArray_const_t' in found_types}} + cdef cyruntime.cudaArray_t _pvt_val + cdef cyruntime.cudaArray_t* _pvt_ptr cdef class cudaArray_const_t: """ @@ -39,11 +61,8 @@ cdef class cudaArray_const_t: Get memory address of class instance """ - cdef ccudart.cudaArray_const_t __val - cdef ccudart.cudaArray_const_t* _ptr -{{endif}} - -{{if 'cudaMipmappedArray_t' in found_types}} + cdef cyruntime.cudaArray_const_t _pvt_val + cdef cyruntime.cudaArray_const_t* _pvt_ptr cdef class cudaMipmappedArray_t: """ @@ -56,11 +75,8 @@ cdef class cudaMipmappedArray_t: Get memory address of class instance """ - cdef ccudart.cudaMipmappedArray_t __val - cdef ccudart.cudaMipmappedArray_t* _ptr -{{endif}} - -{{if 'cudaMipmappedArray_const_t' in found_types}} + cdef cyruntime.cudaMipmappedArray_t _pvt_val + cdef cyruntime.cudaMipmappedArray_t* _pvt_ptr cdef class cudaMipmappedArray_const_t: """ @@ -73,11 +89,8 @@ cdef class cudaMipmappedArray_const_t: Get memory address of class instance """ - cdef ccudart.cudaMipmappedArray_const_t __val - cdef ccudart.cudaMipmappedArray_const_t* _ptr -{{endif}} - -{{if 'cudaGraphicsResource_t' in found_types}} + cdef cyruntime.cudaMipmappedArray_const_t _pvt_val + cdef cyruntime.cudaMipmappedArray_const_t* _pvt_ptr cdef class cudaGraphicsResource_t: """ @@ -90,11 +103,8 @@ cdef class cudaGraphicsResource_t: Get memory address of class instance """ - cdef ccudart.cudaGraphicsResource_t __val - cdef ccudart.cudaGraphicsResource_t* _ptr -{{endif}} - -{{if 'cudaExternalMemory_t' in found_types}} + cdef cyruntime.cudaGraphicsResource_t _pvt_val + cdef cyruntime.cudaGraphicsResource_t* _pvt_ptr cdef class cudaExternalMemory_t: """ @@ -107,11 +117,8 @@ cdef class cudaExternalMemory_t: Get memory address of class instance """ - cdef ccudart.cudaExternalMemory_t __val - cdef ccudart.cudaExternalMemory_t* _ptr -{{endif}} - -{{if 'cudaExternalSemaphore_t' in found_types}} + cdef cyruntime.cudaExternalMemory_t _pvt_val + cdef cyruntime.cudaExternalMemory_t* _pvt_ptr cdef class cudaExternalSemaphore_t: """ @@ -124,11 +131,8 @@ cdef class cudaExternalSemaphore_t: Get memory address of class instance """ - cdef ccudart.cudaExternalSemaphore_t __val - cdef ccudart.cudaExternalSemaphore_t* _ptr -{{endif}} - -{{if 'cudaKernel_t' in found_types}} + cdef cyruntime.cudaExternalSemaphore_t _pvt_val + cdef cyruntime.cudaExternalSemaphore_t* _pvt_ptr cdef class cudaKernel_t: """ @@ -141,11 +145,22 @@ cdef class cudaKernel_t: Get memory address of class instance """ - cdef ccudart.cudaKernel_t __val - cdef ccudart.cudaKernel_t* _ptr -{{endif}} + cdef cyruntime.cudaKernel_t _pvt_val + cdef cyruntime.cudaKernel_t* _pvt_ptr + +cdef class cudaLibrary_t: + """ + + CUDA library -{{if 'cudaGraphDeviceNode_t' in found_types}} + Methods + ------- + getPtr() + Get memory address of class instance + + """ + cdef cyruntime.cudaLibrary_t _pvt_val + cdef cyruntime.cudaLibrary_t* _pvt_ptr cdef class cudaGraphDeviceNode_t: """ @@ -158,11 +173,8 @@ cdef class cudaGraphDeviceNode_t: Get memory address of class instance """ - cdef ccudart.cudaGraphDeviceNode_t __val - cdef ccudart.cudaGraphDeviceNode_t* _ptr -{{endif}} - -{{if 'cudaAsyncCallbackHandle_t' in found_types}} + cdef cyruntime.cudaGraphDeviceNode_t _pvt_val + cdef cyruntime.cudaGraphDeviceNode_t* _pvt_ptr cdef class cudaAsyncCallbackHandle_t: """ @@ -175,11 +187,20 @@ cdef class cudaAsyncCallbackHandle_t: Get memory address of class instance """ - cdef ccudart.cudaAsyncCallbackHandle_t __val - cdef ccudart.cudaAsyncCallbackHandle_t* _ptr -{{endif}} + cdef cyruntime.cudaAsyncCallbackHandle_t _pvt_val + cdef cyruntime.cudaAsyncCallbackHandle_t* _pvt_ptr + +cdef class cudaLogsCallbackHandle: + """ + + Methods + ------- + getPtr() + Get memory address of class instance -{{if True}} + """ + cdef cyruntime.cudaLogsCallbackHandle _pvt_val + cdef cyruntime.cudaLogsCallbackHandle* _pvt_ptr cdef class EGLImageKHR: """ @@ -190,11 +211,8 @@ cdef class EGLImageKHR: Get memory address of class instance """ - cdef ccudart.EGLImageKHR __val - cdef ccudart.EGLImageKHR* _ptr -{{endif}} - -{{if True}} + cdef cyruntime.EGLImageKHR _pvt_val + cdef cyruntime.EGLImageKHR* _pvt_ptr cdef class EGLStreamKHR: """ @@ -205,11 +223,8 @@ cdef class EGLStreamKHR: Get memory address of class instance """ - cdef ccudart.EGLStreamKHR __val - cdef ccudart.EGLStreamKHR* _ptr -{{endif}} - -{{if True}} + cdef cyruntime.EGLStreamKHR _pvt_val + cdef cyruntime.EGLStreamKHR* _pvt_ptr cdef class EGLSyncKHR: """ @@ -220,11 +235,8 @@ cdef class EGLSyncKHR: Get memory address of class instance """ - cdef ccudart.EGLSyncKHR __val - cdef ccudart.EGLSyncKHR* _ptr -{{endif}} - -{{if 'cudaHostFn_t' in found_types}} + cdef cyruntime.EGLSyncKHR _pvt_val + cdef cyruntime.EGLSyncKHR* _pvt_ptr cdef class cudaHostFn_t: """ @@ -235,11 +247,8 @@ cdef class cudaHostFn_t: Get memory address of class instance """ - cdef ccudart.cudaHostFn_t __val - cdef ccudart.cudaHostFn_t* _ptr -{{endif}} - -{{if 'cudaAsyncCallback' in found_types}} + cdef cyruntime.cudaHostFn_t _pvt_val + cdef cyruntime.cudaHostFn_t* _pvt_ptr cdef class cudaAsyncCallback: """ @@ -250,11 +259,8 @@ cdef class cudaAsyncCallback: Get memory address of class instance """ - cdef ccudart.cudaAsyncCallback __val - cdef ccudart.cudaAsyncCallback* _ptr -{{endif}} - -{{if 'cudaStreamCallback_t' in found_types}} + cdef cyruntime.cudaAsyncCallback _pvt_val + cdef cyruntime.cudaAsyncCallback* _pvt_ptr cdef class cudaStreamCallback_t: """ @@ -265,33 +271,57 @@ cdef class cudaStreamCallback_t: Get memory address of class instance """ - cdef ccudart.cudaStreamCallback_t __val - cdef ccudart.cudaStreamCallback_t* _ptr -{{endif}} + cdef cyruntime.cudaStreamCallback_t _pvt_val + cdef cyruntime.cudaStreamCallback_t* _pvt_ptr + +cdef class cudaGraphRecaptureCallback_t: + """ + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + cdef cyruntime.cudaGraphRecaptureCallback_t _pvt_val + cdef cyruntime.cudaGraphRecaptureCallback_t* _pvt_ptr + +cdef class cudaLogsCallback_t: + """ + + Methods + ------- + getPtr() + Get memory address of class instance -{{if 'struct dim3' in found_types}} + """ + cdef cyruntime.cudaLogsCallback_t _pvt_val + cdef cyruntime.cudaLogsCallback_t* _pvt_ptr cdef class dim3: """ Attributes ---------- + x : unsigned int + + y : unsigned int + + z : unsigned int + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.dim3 __val - cdef ccudart.dim3* _ptr -{{endif}} -{{if 'struct cudaChannelFormatDesc' in found_types}} + cdef cyruntime.dim3 _pvt_val + cdef cyruntime.dim3* _pvt_ptr cdef class cudaChannelFormatDesc: """ @@ -299,48 +329,58 @@ cdef class cudaChannelFormatDesc: Attributes ---------- + x : int x + + y : int y + + z : int z + + w : int w + + f : cudaChannelFormatKind Channel format kind + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaChannelFormatDesc __val - cdef ccudart.cudaChannelFormatDesc* _ptr -{{endif}} -{{if 'struct cudaArraySparseProperties' in found_types}} + cdef cyruntime.cudaChannelFormatDesc _pvt_val + cdef cyruntime.cudaChannelFormatDesc* _pvt_ptr cdef class anon_struct0: """ Attributes ---------- + width : unsigned int + + height : unsigned int + + depth : unsigned int + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaArraySparseProperties* _ptr -{{endif}} -{{if 'struct cudaArraySparseProperties' in found_types}} + cdef cyruntime.cudaArraySparseProperties* _pvt_ptr cdef class cudaArraySparseProperties: """ @@ -348,28 +388,37 @@ cdef class cudaArraySparseProperties: Attributes ---------- + tileExtent : anon_struct0 + + miptailFirstLevel : unsigned int First mip level at which the mip tail begins + + miptailSize : unsigned long long Total size of the mip tail. + + flags : unsigned int Flags will either be zero or cudaArraySparsePropertiesSingleMipTail - reserved : List[unsigned int] + + + reserved : list[unsigned int] + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaArraySparseProperties __val - cdef ccudart.cudaArraySparseProperties* _ptr + cdef cyruntime.cudaArraySparseProperties _pvt_val + cdef cyruntime.cudaArraySparseProperties* _pvt_ptr + cdef anon_struct0 _tileExtent -{{endif}} -{{if 'struct cudaArrayMemoryRequirements' in found_types}} + cdef class cudaArrayMemoryRequirements: """ @@ -377,98 +426,115 @@ cdef class cudaArrayMemoryRequirements: Attributes ---------- + size : size_t Total size of the array. + + alignment : size_t Alignment necessary for mapping the array. - reserved : List[unsigned int] + + + reserved : list[unsigned int] + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaArrayMemoryRequirements __val - cdef ccudart.cudaArrayMemoryRequirements* _ptr -{{endif}} -{{if 'struct cudaPitchedPtr' in found_types}} + cdef cyruntime.cudaArrayMemoryRequirements _pvt_val + cdef cyruntime.cudaArrayMemoryRequirements* _pvt_ptr cdef class cudaPitchedPtr: """ - CUDA Pitched memory pointer ::make_cudaPitchedPtr + CUDA Pitched memory pointer make_cudaPitchedPtr Attributes ---------- + ptr : Any Pointer to allocated memory + + pitch : size_t Pitch of allocated memory in bytes + + xsize : size_t Logical width of allocation in elements + + ysize : size_t Logical height of allocation in elements + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaPitchedPtr __val - cdef ccudart.cudaPitchedPtr* _ptr -{{endif}} -{{if 'struct cudaExtent' in found_types}} + cdef cyruntime.cudaPitchedPtr _pvt_val + cdef cyruntime.cudaPitchedPtr* _pvt_ptr + + cdef _HelperInputVoidPtr _cyptr + cdef class cudaExtent: """ - CUDA extent ::make_cudaExtent + CUDA extent make_cudaExtent Attributes ---------- + width : size_t Width in elements when referring to array memory, in bytes when referring to linear memory + + height : size_t Height in elements + + depth : size_t Depth in elements + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaExtent __val - cdef ccudart.cudaExtent* _ptr -{{endif}} -{{if 'struct cudaPos' in found_types}} + cdef cyruntime.cudaExtent _pvt_val + cdef cyruntime.cudaExtent* _pvt_ptr cdef class cudaPos: """ - CUDA 3D position ::make_cudaPos + CUDA 3D position make_cudaPos Attributes ---------- + x : size_t x + + y : size_t y + + z : size_t z + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaPos __val - cdef ccudart.cudaPos* _ptr -{{endif}} -{{if 'struct cudaMemcpy3DParms' in found_types}} + cdef cyruntime.cudaPos _pvt_val + cdef cyruntime.cudaPos* _pvt_ptr cdef class cudaMemcpy3DParms: """ @@ -476,40 +542,67 @@ cdef class cudaMemcpy3DParms: Attributes ---------- + srcArray : cudaArray_t Source memory address + + srcPos : cudaPos Source position offset + + srcPtr : cudaPitchedPtr Pitched source memory address + + dstArray : cudaArray_t Destination memory address + + dstPos : cudaPos Destination position offset + + dstPtr : cudaPitchedPtr Pitched destination memory address + + extent : cudaExtent Requested memory copy size + + kind : cudaMemcpyKind Type of transfer + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaMemcpy3DParms __val - cdef ccudart.cudaMemcpy3DParms* _ptr + cdef cyruntime.cudaMemcpy3DParms _pvt_val + cdef cyruntime.cudaMemcpy3DParms* _pvt_ptr + cdef cudaArray_t _srcArray + + cdef cudaPos _srcPos + + cdef cudaPitchedPtr _srcPtr + + cdef cudaArray_t _dstArray + + cdef cudaPos _dstPos + + cdef cudaPitchedPtr _dstPtr + + cdef cudaExtent _extent -{{endif}} -{{if 'struct cudaMemcpyNodeParams' in found_types}} + cdef class cudaMemcpyNodeParams: """ @@ -517,24 +610,37 @@ cdef class cudaMemcpyNodeParams: Attributes ---------- + flags : int Must be zero - reserved : List[int] + + + reserved : int Must be zero + + + ctx : cudaExecutionContext_t + Context in which to run the memcpy. If NULL will try to use the + current context. + + copyParams : cudaMemcpy3DParms Parameters for the memory copy + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaMemcpyNodeParams __val - cdef ccudart.cudaMemcpyNodeParams* _ptr + cdef cyruntime.cudaMemcpyNodeParams _pvt_val + cdef cyruntime.cudaMemcpyNodeParams* _pvt_ptr + + cdef cudaExecutionContext_t _ctx + + cdef cudaMemcpy3DParms _copyParams -{{endif}} -{{if 'struct cudaMemcpy3DPeerParms' in found_types}} + cdef class cudaMemcpy3DPeerParms: """ @@ -542,42 +648,71 @@ cdef class cudaMemcpy3DPeerParms: Attributes ---------- + srcArray : cudaArray_t Source memory address + + srcPos : cudaPos Source position offset + + srcPtr : cudaPitchedPtr Pitched source memory address + + srcDevice : int Source device + + dstArray : cudaArray_t Destination memory address + + dstPos : cudaPos Destination position offset + + dstPtr : cudaPitchedPtr Pitched destination memory address + + dstDevice : int Destination device + + extent : cudaExtent Requested memory copy size + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaMemcpy3DPeerParms __val - cdef ccudart.cudaMemcpy3DPeerParms* _ptr + cdef cyruntime.cudaMemcpy3DPeerParms _pvt_val + cdef cyruntime.cudaMemcpy3DPeerParms* _pvt_ptr + cdef cudaArray_t _srcArray + + cdef cudaPos _srcPos + + cdef cudaPitchedPtr _srcPtr + + cdef cudaArray_t _dstArray + + cdef cudaPos _dstPos + + cdef cudaPitchedPtr _dstPtr + + cdef cudaExtent _extent -{{endif}} -{{if 'struct cudaMemsetParams' in found_types}} + cdef class cudaMemsetParams: """ @@ -585,29 +720,41 @@ cdef class cudaMemsetParams: Attributes ---------- + dst : Any Destination device pointer + + pitch : size_t Pitch of destination device pointer. Unused if height is 1 + + value : unsigned int Value to be set + + elementSize : unsigned int Size of each element in bytes. Must be 1, 2, or 4. + + width : size_t Width of the row in elements + + height : size_t Number of rows + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaMemsetParams __val - cdef ccudart.cudaMemsetParams* _ptr -{{endif}} -{{if 'struct cudaMemsetParamsV2' in found_types}} + cdef cyruntime.cudaMemsetParams _pvt_val + cdef cyruntime.cudaMemsetParams* _pvt_ptr + + cdef _HelperInputVoidPtr _cydst + cdef class cudaMemsetParamsV2: """ @@ -615,29 +762,49 @@ cdef class cudaMemsetParamsV2: Attributes ---------- + dst : Any Destination device pointer + + pitch : size_t Pitch of destination device pointer. Unused if height is 1 + + value : unsigned int Value to be set + + elementSize : unsigned int Size of each element in bytes. Must be 1, 2, or 4. + + width : size_t Width of the row in elements + + height : size_t Number of rows + + ctx : cudaExecutionContext_t + Context in which to run the memset. If NULL will try to use the + current context. + + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaMemsetParamsV2 __val - cdef ccudart.cudaMemsetParamsV2* _ptr -{{endif}} -{{if 'struct cudaAccessPolicyWindow' in found_types}} + cdef cyruntime.cudaMemsetParamsV2 _pvt_val + cdef cyruntime.cudaMemsetParamsV2* _pvt_ptr + + cdef _HelperInputVoidPtr _cydst + + + cdef cudaExecutionContext_t _ctx + cdef class cudaAccessPolicyWindow: """ @@ -652,31 +819,41 @@ cdef class cudaAccessPolicyWindow: Attributes ---------- + base_ptr : Any Starting address of the access policy window. CUDA driver may align it. + + num_bytes : size_t Size in bytes of the window policy. CUDA driver may restrict the maximum size and alignment. + + hitRatio : float hitRatio specifies percentage of lines assigned hitProp, rest are assigned missProp. - hitProp : cudaAccessProperty + + + hitProp : cudaAccessProperty ::CUaccessProperty set for hit. + + missProp : cudaAccessProperty ::CUaccessProperty set for miss. Must be either NORMAL or STREAMING. + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaAccessPolicyWindow __val - cdef ccudart.cudaAccessPolicyWindow* _ptr -{{endif}} -{{if 'struct cudaHostNodeParams' in found_types}} + cdef cyruntime.cudaAccessPolicyWindow _pvt_val + cdef cyruntime.cudaAccessPolicyWindow* _pvt_ptr + + cdef _HelperInputVoidPtr _cybase_ptr + cdef class cudaHostNodeParams: """ @@ -684,22 +861,28 @@ cdef class cudaHostNodeParams: Attributes ---------- + fn : cudaHostFn_t The function to call when the node executes + + userData : Any Argument to pass to the function + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaHostNodeParams __val - cdef ccudart.cudaHostNodeParams* _ptr + cdef cyruntime.cudaHostNodeParams _pvt_val + cdef cyruntime.cudaHostNodeParams* _pvt_ptr + cdef cudaHostFn_t _fn -{{endif}} -{{if 'struct cudaHostNodeParamsV2' in found_types}} + + + cdef _HelperInputVoidPtr _cyuserData + cdef class cudaHostNodeParamsV2: """ @@ -707,133 +890,201 @@ cdef class cudaHostNodeParamsV2: Attributes ---------- + fn : cudaHostFn_t The function to call when the node executes + + userData : Any Argument to pass to the function + + syncMode : unsigned int + The synchronization mode to use for the host task + + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaHostNodeParamsV2 __val - cdef ccudart.cudaHostNodeParamsV2* _ptr + cdef cyruntime.cudaHostNodeParamsV2 _pvt_val + cdef cyruntime.cudaHostNodeParamsV2* _pvt_ptr + cdef cudaHostFn_t _fn -{{endif}} -{{if 'struct cudaResourceDesc' in found_types}} + + + cdef _HelperInputVoidPtr _cyuserData + cdef class anon_struct1: """ Attributes ---------- + array : cudaArray_t + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaResourceDesc* _ptr + cdef cyruntime.cudaResourceDesc* _pvt_ptr + cdef cudaArray_t _array -{{endif}} -{{if 'struct cudaResourceDesc' in found_types}} + cdef class anon_struct2: """ Attributes ---------- + mipmap : cudaMipmappedArray_t + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaResourceDesc* _ptr + cdef cyruntime.cudaResourceDesc* _pvt_ptr + cdef cudaMipmappedArray_t _mipmap -{{endif}} -{{if 'struct cudaResourceDesc' in found_types}} + cdef class anon_struct3: """ Attributes ---------- + devPtr : Any + + desc : cudaChannelFormatDesc + + sizeInBytes : size_t + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaResourceDesc* _ptr + cdef cyruntime.cudaResourceDesc* _pvt_ptr + + cdef _HelperInputVoidPtr _cydevPtr + + cdef cudaChannelFormatDesc _desc -{{endif}} -{{if 'struct cudaResourceDesc' in found_types}} + cdef class anon_struct4: """ Attributes ---------- + devPtr : Any + + desc : cudaChannelFormatDesc + + width : size_t + + height : size_t + + pitchInBytes : size_t + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaResourceDesc* _ptr + cdef cyruntime.cudaResourceDesc* _pvt_ptr + + cdef _HelperInputVoidPtr _cydevPtr + + cdef cudaChannelFormatDesc _desc -{{endif}} -{{if 'struct cudaResourceDesc' in found_types}} + + +cdef class anon_struct5: + """ + Attributes + ---------- + + reserved : list[int] + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + cdef cyruntime.cudaResourceDesc* _pvt_ptr cdef class anon_union0: """ Attributes ---------- + array : anon_struct1 + + mipmap : anon_struct2 + + linear : anon_struct3 + + pitch2D : anon_struct4 + + reserved : anon_struct5 + + + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaResourceDesc* _ptr + cdef cyruntime.cudaResourceDesc* _pvt_ptr + cdef anon_struct1 _array + + cdef anon_struct2 _mipmap + + cdef anon_struct3 _linear + + cdef anon_struct4 _pitch2D -{{endif}} -{{if 'struct cudaResourceDesc' in found_types}} + + + cdef anon_struct5 _reserved + cdef class cudaResourceDesc: """ @@ -841,22 +1092,29 @@ cdef class cudaResourceDesc: Attributes ---------- + resType : cudaResourceType Resource type + + res : anon_union0 + + flags : unsigned int + Flags (must be zero) + + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaResourceDesc* _val_ptr - cdef ccudart.cudaResourceDesc* _ptr + cdef cyruntime.cudaResourceDesc* _val_ptr + cdef cyruntime.cudaResourceDesc* _pvt_ptr + cdef anon_union0 _res -{{endif}} -{{if 'struct cudaResourceViewDesc' in found_types}} + cdef class cudaResourceViewDesc: """ @@ -864,33 +1122,50 @@ cdef class cudaResourceViewDesc: Attributes ---------- + format : cudaResourceViewFormat Resource view format + + width : size_t Width of the resource view + + height : size_t Height of the resource view + + depth : size_t Depth of the resource view + + firstMipmapLevel : unsigned int First defined mipmap level + + lastMipmapLevel : unsigned int Last defined mipmap level + + firstLayer : unsigned int First layer index + + lastLayer : unsigned int Last layer index + + reserved : list[unsigned int] + Must be zero + + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaResourceViewDesc __val - cdef ccudart.cudaResourceViewDesc* _ptr -{{endif}} -{{if 'struct cudaPointerAttributes' in found_types}} + cdef cyruntime.cudaResourceViewDesc _pvt_val + cdef cyruntime.cudaResourceViewDesc* _pvt_ptr cdef class cudaPointerAttributes: """ @@ -898,9 +1173,12 @@ cdef class cudaPointerAttributes: Attributes ---------- + type : cudaMemoryType The type of memory - cudaMemoryTypeUnregistered, cudaMemoryTypeHost, cudaMemoryTypeDevice or cudaMemoryTypeManaged. + + device : int The device against which the memory was allocated or registered. If the memory type is cudaMemoryTypeDevice then this identifies the @@ -909,25 +1187,37 @@ cdef class cudaPointerAttributes: this identifies the device which was current when the memory was allocated or registered (and if that device is deinitialized then this allocation will vanish with that device's state). + + devicePointer : Any The address which may be dereferenced on the current device to access the memory or NULL if no such address exists. + + hostPointer : Any The address which may be dereferenced on the host to access the memory or NULL if no such address exists. CUDA doesn't check if unregistered memory is allocated so this field may contain invalid pointer if an invalid pointer has been passed to CUDA. + + reserved : list[long] + Must be zero + + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaPointerAttributes __val - cdef ccudart.cudaPointerAttributes* _ptr -{{endif}} -{{if 'struct cudaFuncAttributes' in found_types}} + cdef cyruntime.cudaPointerAttributes _pvt_val + cdef cyruntime.cudaPointerAttributes* _pvt_ptr + + cdef _HelperInputVoidPtr _cydevicePointer + + + cdef _HelperInputVoidPtr _cyhostPointer + cdef class cudaFuncAttributes: """ @@ -935,38 +1225,57 @@ cdef class cudaFuncAttributes: Attributes ---------- + sharedSizeBytes : size_t The size in bytes of statically-allocated shared memory per block required by this function. This does not include dynamically- allocated shared memory requested by the user at runtime. + + constSizeBytes : size_t The size in bytes of user-allocated constant memory required by this function. + + localSizeBytes : size_t The size in bytes of local memory used by each thread of this function. + + maxThreadsPerBlock : int The maximum number of threads per block, beyond which a launch of the function would fail. This number depends on both the function and the device on which the function is currently loaded. + + numRegs : int The number of registers used by each thread of this function. + + ptxVersion : int The PTX virtual architecture version for which the function was compiled. This value is the major PTX version * 10 + the minor PTX version, so a PTX version 1.3 function would return the value 13. + + binaryVersion : int The binary architecture version for which the function was compiled. This value is the major binary version * 10 + the minor binary version, so a binary version 1.3 function would return the value 13. + + cacheModeCA : int The attribute to indicate whether the function has been compiled with user specified option "-Xptxas --dlcm=ca" set. + + maxDynamicSharedSizeBytes : int The maximum size in bytes of dynamic shared memory per block for this function. Any launch must have a dynamic shared memory size smaller than this value. + + preferredShmemCarveout : int On devices where the L1 cache and shared memory use the same hardware resources, this sets the shared memory carveout @@ -974,9 +1283,13 @@ cdef class cudaFuncAttributes: cudaDevAttrMaxSharedMemoryPerMultiprocessor. This is only a hint, and the driver can choose a different ratio if required to execute the function. See cudaFuncSetAttribute + + clusterDimMustBeSet : int If this attribute is set, the kernel must launch with a valid cluster dimension specified. + + requiredClusterWidth : int The required cluster width/height/depth in blocks. The values must either all be 0 or all be positive. The validity of the cluster @@ -984,12 +1297,20 @@ cdef class cudaFuncAttributes: set during compile time, it cannot be set at runtime. Setting it at runtime should return cudaErrorNotPermitted. See cudaFuncSetAttribute + + requiredClusterHeight : int + + requiredClusterDepth : int + + clusterSchedulingPolicyPreference : int The block scheduling policy of a function. See cudaFuncSetAttribute + + nonPortableClusterSizeAllowed : int Whether the function can be launched with non-portable cluster size. 1 is allowed, 0 is disallowed. A non-portable cluster size @@ -1004,19 +1325,29 @@ cdef class cudaFuncAttributes: compute capabilities. The specific hardware unit may support higher cluster sizes that’s not guaranteed to be portable. See cudaFuncSetAttribute - reserved : List[int] + + + deviceNodeUpdateStatus : int + Whether the function can be updated on device. 1 means device node + update is supported, 0 is unsupported or driver is too old to check + the value. + + + reserved1 : int + + + + reserved : list[int] Reserved for future use. + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaFuncAttributes __val - cdef ccudart.cudaFuncAttributes* _ptr -{{endif}} -{{if 'struct cudaMemLocation' in found_types}} + cdef cyruntime.cudaFuncAttributes _pvt_val + cdef cyruntime.cudaFuncAttributes* _pvt_ptr cdef class cudaMemLocation: """ @@ -1027,21 +1358,24 @@ cdef class cudaMemLocation: Attributes ---------- + type : cudaMemLocationType Specifies the location type, which modifies the meaning of id. + + id : int - identifier for a given this location's ::CUmemLocationType. + Identifier for cudaMemLocationType::cudaMemLocationTypeDevice, + cudaMemLocationType::cudaMemLocationTypeHost, or + cudaMemLocationType::cudaMemLocationTypeHostNuma. + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaMemLocation __val - cdef ccudart.cudaMemLocation* _ptr -{{endif}} -{{if 'struct cudaMemAccessDesc' in found_types}} + cdef cyruntime.cudaMemLocation* _val_ptr + cdef cyruntime.cudaMemLocation* _pvt_ptr cdef class cudaMemAccessDesc: """ @@ -1049,22 +1383,25 @@ cdef class cudaMemAccessDesc: Attributes ---------- + location : cudaMemLocation Location on which the request is to change it's accessibility + + flags : cudaMemAccessFlags ::CUmemProt accessibility flags to set on the request + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaMemAccessDesc __val - cdef ccudart.cudaMemAccessDesc* _ptr + cdef cyruntime.cudaMemAccessDesc _pvt_val + cdef cyruntime.cudaMemAccessDesc* _pvt_ptr + cdef cudaMemLocation _location -{{endif}} -{{if 'struct cudaMemPoolProps' in found_types}} + cdef class cudaMemPoolProps: """ @@ -1072,36 +1409,54 @@ cdef class cudaMemPoolProps: Attributes ---------- + allocType : cudaMemAllocationType Allocation type. Currently must be specified as cudaMemAllocationTypePinned + + handleTypes : cudaMemAllocationHandleType Handle types that will be supported by allocations from the pool. + + location : cudaMemLocation Location allocations should reside. + + win32SecurityAttributes : Any Windows-specific LPSECURITYATTRIBUTES required when cudaMemHandleTypeWin32 is specified. This security attribute defines the scope of which exported allocations may be tranferred to other processes. In all other cases, this field is required to be zero. + + maxSize : size_t Maximum pool size. When set to 0, defaults to a system dependent value. + + + usage : unsigned short + Bitmask indicating intended usage for the pool. + + reserved : bytes reserved for future use, must be 0 + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaMemPoolProps __val - cdef ccudart.cudaMemPoolProps* _ptr + cdef cyruntime.cudaMemPoolProps _pvt_val + cdef cyruntime.cudaMemPoolProps* _pvt_ptr + cdef cudaMemLocation _location -{{endif}} -{{if 'struct cudaMemPoolPtrExportData' in found_types}} + + + cdef _HelperInputVoidPtr _cywin32SecurityAttributes + cdef class cudaMemPoolPtrExportData: """ @@ -1109,19 +1464,18 @@ cdef class cudaMemPoolPtrExportData: Attributes ---------- + reserved : bytes + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaMemPoolPtrExportData __val - cdef ccudart.cudaMemPoolPtrExportData* _ptr -{{endif}} -{{if 'struct cudaMemAllocNodeParams' in found_types}} + cdef cyruntime.cudaMemPoolPtrExportData _pvt_val + cdef cyruntime.cudaMemPoolPtrExportData* _pvt_ptr cdef class cudaMemAllocNodeParams: """ @@ -1129,35 +1483,48 @@ cdef class cudaMemAllocNodeParams: Attributes ---------- + poolProps : cudaMemPoolProps in: location where the allocation should reside (specified in ::location). ::handleTypes must be cudaMemHandleTypeNone. IPC is not supported. in: array of memory access descriptors. Used to describe peer GPU access + + accessDescs : cudaMemAccessDesc in: number of memory access descriptors. Must not exceed the number of GPUs. + + accessDescCount : size_t in: Number of `accessDescs`s + + bytesize : size_t in: size in bytes of the requested allocation + + dptr : Any out: address of the allocation returned by CUDA + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaMemAllocNodeParams __val - cdef ccudart.cudaMemAllocNodeParams* _ptr + cdef cyruntime.cudaMemAllocNodeParams _pvt_val + cdef cyruntime.cudaMemAllocNodeParams* _pvt_ptr + cdef cudaMemPoolProps _poolProps + + cdef size_t _accessDescs_length - cdef ccudart.cudaMemAccessDesc* _accessDescs + cdef cyruntime.cudaMemAccessDesc* _accessDescs + + + cdef _HelperInputVoidPtr _cydptr -{{endif}} -{{if 'struct cudaMemAllocNodeParamsV2' in found_types}} cdef class cudaMemAllocNodeParamsV2: """ @@ -1165,35 +1532,48 @@ cdef class cudaMemAllocNodeParamsV2: Attributes ---------- + poolProps : cudaMemPoolProps in: location where the allocation should reside (specified in ::location). ::handleTypes must be cudaMemHandleTypeNone. IPC is not supported. in: array of memory access descriptors. Used to describe peer GPU access + + accessDescs : cudaMemAccessDesc in: number of memory access descriptors. Must not exceed the number of GPUs. + + accessDescCount : size_t in: Number of `accessDescs`s + + bytesize : size_t in: size in bytes of the requested allocation + + dptr : Any out: address of the allocation returned by CUDA + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaMemAllocNodeParamsV2 __val - cdef ccudart.cudaMemAllocNodeParamsV2* _ptr + cdef cyruntime.cudaMemAllocNodeParamsV2 _pvt_val + cdef cyruntime.cudaMemAllocNodeParamsV2* _pvt_ptr + cdef cudaMemPoolProps _poolProps + + cdef size_t _accessDescs_length - cdef ccudart.cudaMemAccessDesc* _accessDescs + cdef cyruntime.cudaMemAccessDesc* _accessDescs + + + cdef _HelperInputVoidPtr _cydptr -{{endif}} -{{if 'struct cudaMemFreeNodeParams' in found_types}} cdef class cudaMemFreeNodeParams: """ @@ -1201,37 +1581,262 @@ cdef class cudaMemFreeNodeParams: Attributes ---------- + dptr : Any in: the pointer to free + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaMemFreeNodeParams __val - cdef ccudart.cudaMemFreeNodeParams* _ptr -{{endif}} -{{if 'struct CUuuid_st' in found_types}} + cdef cyruntime.cudaMemFreeNodeParams _pvt_val + cdef cyruntime.cudaMemFreeNodeParams* _pvt_ptr + + cdef _HelperInputVoidPtr _cydptr + + +cdef class cudaMemcpyAttributes: + """ + Attributes specific to copies within a batch. For more details on + usage see cudaMemcpyBatchAsync. + + Attributes + ---------- + + srcAccessOrder : cudaMemcpySrcAccessOrder + Source access ordering to be observed for copies with this + attribute. + + + srcLocHint : cudaMemLocation + Hint location for the source operand. Ignored when the pointers are + not managed memory or memory allocated outside CUDA. + + + dstLocHint : cudaMemLocation + Hint location for the destination operand. Ignored when the + pointers are not managed memory or memory allocated outside CUDA. + + + flags : unsigned int + Additional flags for copies with this attribute. See + cudaMemcpyFlags. + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + cdef cyruntime.cudaMemcpyAttributes _pvt_val + cdef cyruntime.cudaMemcpyAttributes* _pvt_ptr + + cdef cudaMemLocation _srcLocHint + + + cdef cudaMemLocation _dstLocHint + + +cdef class cudaOffset3D: + """ + Struct representing offset into a cudaArray_t in elements + + Attributes + ---------- + + x : size_t + + + + y : size_t + + + + z : size_t + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + cdef cyruntime.cudaOffset3D _pvt_val + cdef cyruntime.cudaOffset3D* _pvt_ptr + +cdef class anon_struct6: + """ + Attributes + ---------- + + ptr : Any + + + + rowLength : size_t + + + + layerHeight : size_t + + + + locHint : cudaMemLocation + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + cdef cyruntime.cudaMemcpy3DOperand* _pvt_ptr + + cdef _HelperInputVoidPtr _cyptr + + + cdef cudaMemLocation _locHint + + +cdef class anon_struct7: + """ + Attributes + ---------- + + array : cudaArray_t + + + + offset : cudaOffset3D + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + cdef cyruntime.cudaMemcpy3DOperand* _pvt_ptr + + cdef cudaArray_t _array + + + cdef cudaOffset3D _offset + + +cdef class anon_union2: + """ + Attributes + ---------- + + ptr : anon_struct6 + + + + array : anon_struct7 + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + cdef cyruntime.cudaMemcpy3DOperand* _pvt_ptr + + cdef anon_struct6 _ptr + + + cdef anon_struct7 _array + + +cdef class cudaMemcpy3DOperand: + """ + Struct representing an operand for copy with cudaMemcpy3DBatchAsync + + Attributes + ---------- + + type : cudaMemcpy3DOperandType + + + + op : anon_union2 + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + cdef cyruntime.cudaMemcpy3DOperand* _val_ptr + cdef cyruntime.cudaMemcpy3DOperand* _pvt_ptr + + cdef anon_union2 _op + + +cdef class cudaMemcpy3DBatchOp: + """ + Attributes + ---------- + + src : cudaMemcpy3DOperand + Source memcpy operand. + + + dst : cudaMemcpy3DOperand + Destination memcpy operand. + + + extent : cudaExtent + Extents of the memcpy between src and dst. The width, height and + depth components must not be 0. + + + srcAccessOrder : cudaMemcpySrcAccessOrder + Source access ordering to be observed for copy from src to dst. + + + flags : unsigned int + Additional flags for copy from src to dst. See cudaMemcpyFlags. + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + cdef cyruntime.cudaMemcpy3DBatchOp _pvt_val + cdef cyruntime.cudaMemcpy3DBatchOp* _pvt_ptr + + cdef cudaMemcpy3DOperand _src + + + cdef cudaMemcpy3DOperand _dst + + + cdef cudaExtent _extent + cdef class CUuuid_st: """ Attributes ---------- + bytes : bytes < CUDA definition of UUID + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.CUuuid_st __val - cdef ccudart.CUuuid_st* _ptr -{{endif}} -{{if 'struct cudaDeviceProp' in found_types}} + cdef cyruntime.CUuuid_st _pvt_val + cdef cyruntime.CUuuid_st* _pvt_ptr cdef class cudaDeviceProp: """ @@ -1239,704 +1844,1218 @@ cdef class cudaDeviceProp: Attributes ---------- + name : bytes ASCII string identifying device + + uuid : cudaUUID_t 16-byte unique identifier + + luid : bytes 8-byte locally unique identifier. Value is undefined on TCC and non-Windows platforms + + luidDeviceNodeMask : unsigned int LUID device node mask. Value is undefined on TCC and non-Windows platforms + + totalGlobalMem : size_t Global memory available on device in bytes + + sharedMemPerBlock : size_t Shared memory available per block in bytes + + regsPerBlock : int 32-bit registers available per block + + warpSize : int Warp size in threads + + memPitch : size_t Maximum pitch in bytes allowed by memory copies + + maxThreadsPerBlock : int Maximum number of threads per block - maxThreadsDim : List[int] + + + maxThreadsDim : list[int] Maximum size of each dimension of a block - maxGridSize : List[int] + + + maxGridSize : list[int] Maximum size of each dimension of a grid - clockRate : int - Deprecated, Clock frequency in kilohertz + + totalConstMem : size_t Constant memory available on device in bytes + + major : int Major compute capability + + minor : int Minor compute capability + + textureAlignment : size_t Alignment requirement for textures + + texturePitchAlignment : size_t Pitch alignment requirement for texture references bound to pitched memory - deviceOverlap : int - Device can concurrently copy memory and execute a kernel. - Deprecated. Use instead asyncEngineCount. + + multiProcessorCount : int Number of multiprocessors on device - kernelExecTimeoutEnabled : int - Deprecated, Specified whether there is a run time limit on kernels + + integrated : int Device is integrated as opposed to discrete + + canMapHostMemory : int Device can map host memory with cudaHostAlloc/cudaHostGetDevicePointer - computeMode : int - Deprecated, Compute mode (See cudaComputeMode) + + maxTexture1D : int Maximum 1D texture size + + maxTexture1DMipmap : int Maximum 1D mipmapped texture size - maxTexture1DLinear : int - Deprecated, do not use. Use cudaDeviceGetTexture1DLinearMaxWidth() - or cuDeviceGetTexture1DLinearMaxWidth() instead. - maxTexture2D : List[int] + + + maxTexture2D : list[int] Maximum 2D texture dimensions - maxTexture2DMipmap : List[int] + + + maxTexture2DMipmap : list[int] Maximum 2D mipmapped texture dimensions - maxTexture2DLinear : List[int] + + + maxTexture2DLinear : list[int] Maximum dimensions (width, height, pitch) for 2D textures bound to pitched memory - maxTexture2DGather : List[int] + + + maxTexture2DGather : list[int] Maximum 2D texture dimensions if texture gather operations have to be performed - maxTexture3D : List[int] + + + maxTexture3D : list[int] Maximum 3D texture dimensions - maxTexture3DAlt : List[int] + + + maxTexture3DAlt : list[int] Maximum alternate 3D texture dimensions + + maxTextureCubemap : int Maximum Cubemap texture dimensions - maxTexture1DLayered : List[int] + + + maxTexture1DLayered : list[int] Maximum 1D layered texture dimensions - maxTexture2DLayered : List[int] + + + maxTexture2DLayered : list[int] Maximum 2D layered texture dimensions - maxTextureCubemapLayered : List[int] + + + maxTextureCubemapLayered : list[int] Maximum Cubemap layered texture dimensions + + maxSurface1D : int Maximum 1D surface size - maxSurface2D : List[int] + + + maxSurface2D : list[int] Maximum 2D surface dimensions - maxSurface3D : List[int] + + + maxSurface3D : list[int] Maximum 3D surface dimensions - maxSurface1DLayered : List[int] + + + maxSurface1DLayered : list[int] Maximum 1D layered surface dimensions - maxSurface2DLayered : List[int] + + + maxSurface2DLayered : list[int] Maximum 2D layered surface dimensions + + maxSurfaceCubemap : int Maximum Cubemap surface dimensions - maxSurfaceCubemapLayered : List[int] + + + maxSurfaceCubemapLayered : list[int] Maximum Cubemap layered surface dimensions + + surfaceAlignment : size_t Alignment requirements for surfaces + + concurrentKernels : int Device can possibly execute multiple kernels concurrently + + ECCEnabled : int Device has ECC support enabled + + pciBusID : int PCI bus ID of the device + + pciDeviceID : int PCI device ID of the device + + pciDomainID : int PCI domain ID of the device + + tccDriver : int 1 if device is a Tesla device using TCC driver, 0 otherwise + + asyncEngineCount : int Number of asynchronous engines + + unifiedAddressing : int Device shares a unified address space with the host - memoryClockRate : int - Deprecated, Peak memory clock frequency in kilohertz + + memoryBusWidth : int Global memory bus width in bits + + l2CacheSize : int Size of L2 cache in bytes + + persistingL2CacheMaxSize : int Device's maximum l2 persisting lines capacity setting in bytes + + maxThreadsPerMultiProcessor : int Maximum resident threads per multiprocessor + + streamPrioritiesSupported : int Device supports stream priorities + + globalL1CacheSupported : int Device supports caching globals in L1 + + localL1CacheSupported : int Device supports caching locals in L1 + + sharedMemPerMultiprocessor : size_t Shared memory available per multiprocessor in bytes + + regsPerMultiprocessor : int 32-bit registers available per multiprocessor + + managedMemory : int Device supports allocating managed memory on this system + + isMultiGpuBoard : int Device is on a multi-GPU board + + multiGpuBoardGroupID : int Unique identifier for a group of devices on the same multi-GPU board + + hostNativeAtomicSupported : int Link between the device and the host supports native atomic operations - singleToDoublePrecisionPerfRatio : int - Deprecated, Ratio of single precision performance (in floating- - point operations per second) to double precision performance + + pageableMemoryAccess : int Device supports coherently accessing pageable memory without calling cudaHostRegister on it + + concurrentManagedAccess : int Device can coherently access managed memory concurrently with the CPU + + computePreemptionSupported : int Device supports Compute Preemption + + canUseHostPointerForRegisteredMem : int Device can access host registered memory at the same virtual address as the CPU + + cooperativeLaunch : int Device supports launching cooperative kernels via cudaLaunchCooperativeKernel - cooperativeMultiDeviceLaunch : int - Deprecated, cudaLaunchCooperativeKernelMultiDevice is deprecated. + + sharedMemPerBlockOptin : size_t Per device maximum shared memory per block usable by special opt in + + pageableMemoryAccessUsesHostPageTables : int Device accesses pageable memory via the host's page tables + + directManagedMemAccessFromHost : int Host can directly access managed memory on the device without migration. + + maxBlocksPerMultiProcessor : int Maximum number of resident blocks per multiprocessor + + accessPolicyMaxWindowSize : int The maximum value of cudaAccessPolicyWindow::num_bytes. + + reservedSharedMemPerBlock : size_t Shared memory reserved by CUDA driver per block in bytes + + hostRegisterSupported : int Device supports host memory registration via cudaHostRegister. + + sparseCudaArraySupported : int 1 if the device supports sparse CUDA arrays and sparse CUDA mipmapped arrays, 0 otherwise + + hostRegisterReadOnlySupported : int Device supports using the cudaHostRegister flag cudaHostRegisterReadOnly to register memory that must be mapped as read-only to the GPU + + timelineSemaphoreInteropSupported : int External timeline semaphore interop is supported on the device + + memoryPoolsSupported : int 1 if the device supports using the cudaMallocAsync and cudaMemPool family of APIs, 0 otherwise + + gpuDirectRDMASupported : int 1 if the device supports GPUDirect RDMA APIs, 0 otherwise + + gpuDirectRDMAFlushWritesOptions : unsigned int Bitmask to be interpreted according to the cudaFlushGPUDirectRDMAWritesOptions enum + + gpuDirectRDMAWritesOrdering : int See the cudaGPUDirectRDMAWritesOrdering enum for numerical values + + memoryPoolSupportedHandleTypes : unsigned int Bitmask of handle types supported with mempool-based IPC + + deferredMappingCudaArraySupported : int 1 if the device supports deferred mapping CUDA arrays and CUDA mipmapped arrays + + ipcEventSupported : int Device supports IPC Events. + + clusterLaunch : int Indicates device supports cluster launch + + unifiedFunctionPointers : int Indicates device supports unified pointers - reserved2 : List[int] - reserved1 : List[int] - Reserved for future use - reserved : List[int] + + deviceNumaConfig : int + NUMA configuration of a device: value is of type + cudaDeviceNumaConfig enum + + + deviceNumaId : int + NUMA node ID of the GPU memory + + + mpsEnabled : int + Indicates if contexts created on this device will be shared via MPS + + + hostNumaId : int + NUMA ID of the host node closest to the device or -1 when system + does not support NUMA + + + gpuPciDeviceID : unsigned int + The combined 16-bit PCI device ID and 16-bit PCI vendor ID + + + gpuPciSubsystemID : unsigned int + The combined 16-bit PCI subsystem ID and 16-bit PCI subsystem + vendor ID + + + hostNumaMultinodeIpcSupported : int + 1 if the device supports HostNuma location IPC between nodes in a + multi-node system. + + + reserved : list[int] Reserved for future use + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaDeviceProp __val - cdef ccudart.cudaDeviceProp* _ptr + cdef cyruntime.cudaDeviceProp _pvt_val + cdef cyruntime.cudaDeviceProp* _pvt_ptr + cdef cudaUUID_t _uuid -{{endif}} -{{if 'struct cudaIpcEventHandle_st' in found_types}} + cdef class cudaIpcEventHandle_st: """ CUDA IPC event handle - Attributes - ---------- - reserved : bytes + Attributes + ---------- + + reserved : bytes + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + cdef cyruntime.cudaIpcEventHandle_st _pvt_val + cdef cyruntime.cudaIpcEventHandle_st* _pvt_ptr + +cdef class cudaIpcMemHandle_st: + """ + CUDA IPC memory handle + + Attributes + ---------- + + reserved : bytes + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + cdef cyruntime.cudaIpcMemHandle_st _pvt_val + cdef cyruntime.cudaIpcMemHandle_st* _pvt_ptr + +cdef class cudaMemFabricHandle_st: + """ + Attributes + ---------- + + reserved : bytes + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + cdef cyruntime.cudaMemFabricHandle_st _pvt_val + cdef cyruntime.cudaMemFabricHandle_st* _pvt_ptr + +cdef class anon_struct8: + """ + Attributes + ---------- + + handle : Any + + + + name : Any + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + cdef cyruntime.cudaExternalMemoryHandleDesc* _pvt_ptr + + cdef _HelperInputVoidPtr _cyhandle + + + cdef _HelperInputVoidPtr _cyname + + +cdef class anon_union3: + """ + Attributes + ---------- + + fd : int + + + + win32 : anon_struct8 + + + + nvSciBufObject : Any + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + cdef cyruntime.cudaExternalMemoryHandleDesc* _pvt_ptr + + cdef anon_struct8 _win32 + + + cdef _HelperInputVoidPtr _cynvSciBufObject + + +cdef class cudaExternalMemoryHandleDesc: + """ + External memory handle descriptor + + Attributes + ---------- + + type : cudaExternalMemoryHandleType + Type of the handle + + + handle : anon_union3 + + + + size : unsigned long long + Size of the memory allocation + + + flags : unsigned int + Flags must either be zero or cudaExternalMemoryDedicated + + + reserved : list[unsigned int] + Must be zero + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + cdef cyruntime.cudaExternalMemoryHandleDesc* _val_ptr + cdef cyruntime.cudaExternalMemoryHandleDesc* _pvt_ptr + + cdef anon_union3 _handle + + +cdef class cudaExternalMemoryBufferDesc: + """ + External memory buffer descriptor + + Attributes + ---------- + + offset : unsigned long long + Offset into the memory object where the buffer's base is + + + size : unsigned long long + Size of the buffer + + + flags : unsigned int + Flags reserved for future use. Must be zero. + + + reserved : list[unsigned int] + Must be zero + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + cdef cyruntime.cudaExternalMemoryBufferDesc _pvt_val + cdef cyruntime.cudaExternalMemoryBufferDesc* _pvt_ptr + +cdef class cudaExternalMemoryMipmappedArrayDesc: + """ + External memory mipmap descriptor + + Attributes + ---------- + + offset : unsigned long long + Offset into the memory object where the base level of the mipmap + chain is. + + + formatDesc : cudaChannelFormatDesc + Format of base level of the mipmap chain + + + extent : cudaExtent + Dimensions of base level of the mipmap chain + + flags : unsigned int + Flags associated with CUDA mipmapped arrays. See + cudaMallocMipmappedArray - Methods - ------- - getPtr() - Get memory address of class instance - """ - cdef ccudart.cudaIpcEventHandle_st __val - cdef ccudart.cudaIpcEventHandle_st* _ptr -{{endif}} -{{if 'struct cudaIpcMemHandle_st' in found_types}} + numLevels : unsigned int + Total number of levels in the mipmap chain -cdef class cudaIpcMemHandle_st: - """ - CUDA IPC memory handle - Attributes - ---------- - reserved : bytes + reserved : list[unsigned int] + Must be zero Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaIpcMemHandle_st __val - cdef ccudart.cudaIpcMemHandle_st* _ptr -{{endif}} -{{if 'struct cudaMemFabricHandle_st' in found_types}} + cdef cyruntime.cudaExternalMemoryMipmappedArrayDesc _pvt_val + cdef cyruntime.cudaExternalMemoryMipmappedArrayDesc* _pvt_ptr -cdef class cudaMemFabricHandle_st: - """ - Attributes - ---------- - reserved : bytes + cdef cudaChannelFormatDesc _formatDesc - Methods - ------- - getPtr() - Get memory address of class instance + cdef cudaExtent _extent - """ - cdef ccudart.cudaMemFabricHandle_st __val - cdef ccudart.cudaMemFabricHandle_st* _ptr -{{endif}} -{{if 'struct cudaExternalMemoryHandleDesc' in found_types}} -cdef class anon_struct5: +cdef class anon_struct9: """ Attributes ---------- + handle : Any + + name : Any + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaExternalMemoryHandleDesc* _ptr -{{endif}} -{{if 'struct cudaExternalMemoryHandleDesc' in found_types}} + cdef cyruntime.cudaExternalSemaphoreHandleDesc* _pvt_ptr + + cdef _HelperInputVoidPtr _cyhandle + + + cdef _HelperInputVoidPtr _cyname -cdef class anon_union1: + +cdef class anon_union4: """ Attributes ---------- + fd : int - win32 : anon_struct5 - nvSciBufObject : Any + + win32 : anon_struct9 + + + + nvSciSyncObj : Any + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaExternalMemoryHandleDesc* _ptr - cdef anon_struct5 _win32 -{{endif}} -{{if 'struct cudaExternalMemoryHandleDesc' in found_types}} + cdef cyruntime.cudaExternalSemaphoreHandleDesc* _pvt_ptr -cdef class cudaExternalMemoryHandleDesc: + cdef anon_struct9 _win32 + + + cdef _HelperInputVoidPtr _cynvSciSyncObj + + +cdef class cudaExternalSemaphoreHandleDesc: """ - External memory handle descriptor + External semaphore handle descriptor Attributes ---------- - type : cudaExternalMemoryHandleType + + type : cudaExternalSemaphoreHandleType Type of the handle - handle : anon_union1 - size : unsigned long long - Size of the memory allocation + + handle : anon_union4 + + + flags : unsigned int - Flags must either be zero or cudaExternalMemoryDedicated + Flags reserved for the future. Must be zero. + + + reserved : list[unsigned int] + Must be zero + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaExternalMemoryHandleDesc* _val_ptr - cdef ccudart.cudaExternalMemoryHandleDesc* _ptr - cdef anon_union1 _handle -{{endif}} -{{if 'struct cudaExternalMemoryBufferDesc' in found_types}} + cdef cyruntime.cudaExternalSemaphoreHandleDesc* _val_ptr + cdef cyruntime.cudaExternalSemaphoreHandleDesc* _pvt_ptr + + cdef anon_union4 _handle -cdef class cudaExternalMemoryBufferDesc: - """ - External memory buffer descriptor +cdef class anon_struct10: + """ Attributes ---------- - offset : unsigned long long - Offset into the memory object where the buffer's base is - size : unsigned long long - Size of the buffer - flags : unsigned int - Flags reserved for future use. Must be zero. + + value : unsigned long long + + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaExternalMemoryBufferDesc __val - cdef ccudart.cudaExternalMemoryBufferDesc* _ptr -{{endif}} -{{if 'struct cudaExternalMemoryMipmappedArrayDesc' in found_types}} + cdef cyruntime.cudaExternalSemaphoreSignalParams* _pvt_ptr -cdef class cudaExternalMemoryMipmappedArrayDesc: +cdef class anon_union5: """ - External memory mipmap descriptor - Attributes ---------- - offset : unsigned long long - Offset into the memory object where the base level of the mipmap - chain is. - formatDesc : cudaChannelFormatDesc - Format of base level of the mipmap chain - extent : cudaExtent - Dimensions of base level of the mipmap chain - flags : unsigned int - Flags associated with CUDA mipmapped arrays. See - cudaMallocMipmappedArray - numLevels : unsigned int - Total number of levels in the mipmap chain + + fence : Any + + + + reserved : unsigned long long + + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaExternalMemoryMipmappedArrayDesc __val - cdef ccudart.cudaExternalMemoryMipmappedArrayDesc* _ptr - cdef cudaChannelFormatDesc _formatDesc - cdef cudaExtent _extent -{{endif}} -{{if 'struct cudaExternalSemaphoreHandleDesc' in found_types}} + cdef cyruntime.cudaExternalSemaphoreSignalParams* _pvt_ptr -cdef class anon_struct6: + cdef _HelperInputVoidPtr _cyfence + + +cdef class anon_struct11: """ Attributes ---------- - handle : Any - name : Any + key : unsigned long long + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaExternalSemaphoreHandleDesc* _ptr -{{endif}} -{{if 'struct cudaExternalSemaphoreHandleDesc' in found_types}} + cdef cyruntime.cudaExternalSemaphoreSignalParams* _pvt_ptr -cdef class anon_union2: +cdef class anon_struct12: """ Attributes ---------- - fd : int - win32 : anon_struct6 + fence : anon_struct10 + + + + nvSciSync : anon_union5 + + + + keyedMutex : anon_struct11 + + + + reserved : list[unsigned int] - nvSciSyncObj : Any Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaExternalSemaphoreHandleDesc* _ptr - cdef anon_struct6 _win32 -{{endif}} -{{if 'struct cudaExternalSemaphoreHandleDesc' in found_types}} + cdef cyruntime.cudaExternalSemaphoreSignalParams* _pvt_ptr -cdef class cudaExternalSemaphoreHandleDesc: + cdef anon_struct10 _fence + + + cdef anon_union5 _nvSciSync + + + cdef anon_struct11 _keyedMutex + + +cdef class cudaExternalSemaphoreSignalParams: """ - External semaphore handle descriptor + External semaphore signal parameters, compatible with driver type Attributes ---------- - type : cudaExternalSemaphoreHandleType - Type of the handle - handle : anon_union2 + + params : anon_struct12 + + flags : unsigned int - Flags reserved for the future. Must be zero. + Only when cudaExternalSemaphoreSignalParams is used to signal a + cudaExternalSemaphore_t of type + cudaExternalSemaphoreHandleTypeNvSciSync, the valid flag is + cudaExternalSemaphoreSignalSkipNvSciBufMemSync: which indicates + that while signaling the cudaExternalSemaphore_t, no memory + synchronization operations should be performed for any external + memory object imported as cudaExternalMemoryHandleTypeNvSciBuf. For + all other types of cudaExternalSemaphore_t, flags must be zero. + + + reserved : list[unsigned int] + + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaExternalSemaphoreHandleDesc* _val_ptr - cdef ccudart.cudaExternalSemaphoreHandleDesc* _ptr - cdef anon_union2 _handle -{{endif}} -{{if 'struct cudaExternalSemaphoreSignalParams' in found_types}} + cdef cyruntime.cudaExternalSemaphoreSignalParams _pvt_val + cdef cyruntime.cudaExternalSemaphoreSignalParams* _pvt_ptr + + cdef anon_struct12 _params + cdef class anon_struct13: """ Attributes ---------- + value : unsigned long long + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaExternalSemaphoreSignalParams* _ptr -{{endif}} -{{if 'struct cudaExternalSemaphoreSignalParams' in found_types}} + cdef cyruntime.cudaExternalSemaphoreWaitParams* _pvt_ptr -cdef class anon_union5: +cdef class anon_union6: """ Attributes ---------- + fence : Any + + reserved : unsigned long long + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaExternalSemaphoreSignalParams* _ptr -{{endif}} -{{if 'struct cudaExternalSemaphoreSignalParams' in found_types}} + cdef cyruntime.cudaExternalSemaphoreWaitParams* _pvt_ptr + + cdef _HelperInputVoidPtr _cyfence + cdef class anon_struct14: """ Attributes ---------- + key : unsigned long long + + timeoutMs : unsigned int + + + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaExternalSemaphoreSignalParams* _ptr -{{endif}} -{{if 'struct cudaExternalSemaphoreSignalParams' in found_types}} + cdef cyruntime.cudaExternalSemaphoreWaitParams* _pvt_ptr cdef class anon_struct15: """ Attributes ---------- + fence : anon_struct13 - nvSciSync : anon_union5 + + + nvSciSync : anon_union6 + + keyedMutex : anon_struct14 - reserved : List[unsigned int] + + + reserved : list[unsigned int] + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaExternalSemaphoreSignalParams* _ptr + cdef cyruntime.cudaExternalSemaphoreWaitParams* _pvt_ptr + cdef anon_struct13 _fence - cdef anon_union5 _nvSciSync + + + cdef anon_union6 _nvSciSync + + cdef anon_struct14 _keyedMutex -{{endif}} -{{if 'struct cudaExternalSemaphoreSignalParams' in found_types}} -cdef class cudaExternalSemaphoreSignalParams: + +cdef class cudaExternalSemaphoreWaitParams: """ - External semaphore signal parameters, compatible with driver type + External semaphore wait parameters, compatible with driver type Attributes ---------- + params : anon_struct15 + + flags : unsigned int Only when cudaExternalSemaphoreSignalParams is used to signal a cudaExternalSemaphore_t of type cudaExternalSemaphoreHandleTypeNvSciSync, the valid flag is cudaExternalSemaphoreSignalSkipNvSciBufMemSync: which indicates - that while signaling the cudaExternalSemaphore_t, no memory + that while waiting for the cudaExternalSemaphore_t, no memory synchronization operations should be performed for any external memory object imported as cudaExternalMemoryHandleTypeNvSciBuf. For all other types of cudaExternalSemaphore_t, flags must be zero. - reserved : List[unsigned int] + + + reserved : list[unsigned int] + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaExternalSemaphoreSignalParams __val - cdef ccudart.cudaExternalSemaphoreSignalParams* _ptr + cdef cyruntime.cudaExternalSemaphoreWaitParams _pvt_val + cdef cyruntime.cudaExternalSemaphoreWaitParams* _pvt_ptr + cdef anon_struct15 _params -{{endif}} -{{if 'struct cudaExternalSemaphoreWaitParams' in found_types}} -cdef class anon_struct16: + +cdef class cudaDevSmResource: """ + Data for SM-related resources All parameters in this structure are + OUTPUT only. Do not write to any of the fields in this structure. + Attributes ---------- - value : unsigned long long + + smCount : unsigned int + The amount of streaming multiprocessors available in this resource. + + + minSmPartitionSize : unsigned int + The minimum number of streaming multiprocessors required to + partition this resource. + + + smCoscheduledAlignment : unsigned int + The number of streaming multiprocessors in this resource that are + guaranteed to be co-scheduled on the same GPU processing cluster. + smCount will be a multiple of this value, unless the backfill flag + is set. + + + flags : unsigned int + The flags set on this SM resource. For available flags see + cudaDevSmResourceGroup_flags. + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + cdef cyruntime.cudaDevSmResource _pvt_val + cdef cyruntime.cudaDevSmResource* _pvt_ptr + +cdef class cudaDevWorkqueueConfigResource: + """ + Data for workqueue configuration related resources + + Attributes + ---------- + + device : int + The device on which the workqueue resources are available + + + wqConcurrencyLimit : unsigned int + The expected maximum number of concurrent stream-ordered workloads + + + sharingScope : cudaDevWorkqueueConfigScope + The sharing scope for the workqueue resources Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaExternalSemaphoreWaitParams* _ptr -{{endif}} -{{if 'struct cudaExternalSemaphoreWaitParams' in found_types}} + cdef cyruntime.cudaDevWorkqueueConfigResource _pvt_val + cdef cyruntime.cudaDevWorkqueueConfigResource* _pvt_ptr -cdef class anon_union6: +cdef class cudaDevWorkqueueResource: """ + Handle to a pre-existing workqueue related resource + Attributes ---------- - fence : Any - reserved : unsigned long long + reserved : bytes + Reserved for future use Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaExternalSemaphoreWaitParams* _ptr -{{endif}} -{{if 'struct cudaExternalSemaphoreWaitParams' in found_types}} + cdef cyruntime.cudaDevWorkqueueResource _pvt_val + cdef cyruntime.cudaDevWorkqueueResource* _pvt_ptr -cdef class anon_struct17: +cdef class cudaDevSmResourceGroupParams_st: """ + Input data for splitting SMs + Attributes ---------- - key : unsigned long long - timeoutMs : unsigned int + smCount : unsigned int + The amount of SMs available in this resource. + + + coscheduledSmCount : unsigned int + The amount of co-scheduled SMs grouped together for locality + purposes. + + + preferredCoscheduledSmCount : unsigned int + When possible, combine co-scheduled groups together into larger + groups of this size. + + + flags : unsigned int + Combination of `cudaDevSmResourceGroup_flags` values to indicate + this this group is created. + + + reserved : list[unsigned int] + Reserved for future use - ensure this is zero initialized. Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaExternalSemaphoreWaitParams* _ptr -{{endif}} -{{if 'struct cudaExternalSemaphoreWaitParams' in found_types}} + cdef cyruntime.cudaDevSmResourceGroupParams_st _pvt_val + cdef cyruntime.cudaDevSmResourceGroupParams_st* _pvt_ptr -cdef class anon_struct18: +cdef class cudaDevResource_st: """ + A tagged union describing different resources identified by the + type field. This structure should not be directly modified outside + of the API that created it. struct enumcudaDevResourceTypetype; + union structcudaDevSmResourcesm; + structcudaDevWorkqueueConfigResourcewqConfig; + structcudaDevWorkqueueResourcewq; ; ; - If `typename` is + `cudaDevResourceTypeInvalid`, this resoure is not valid and cannot + be further accessed. - If `typename` is `cudaDevResourceTypeSm`, + the cudaDevSmResource structure `sm` is filled in. For example, + `sm.smCount` will reflect the amount of streaming multiprocessors + available in this resource. - If `typename` is + `cudaDevResourceTypeWorkqueueConfig`, the + cudaDevWorkqueueConfigResource structure `wqConfig` is filled in. + - If `typename` is `cudaDevResourceTypeWorkqueue`, the + cudaDevWorkqueueResource structure `wq` is filled in. + Attributes ---------- - fence : anon_struct16 - nvSciSync : anon_union6 + type : cudaDevResourceType + Type of resource, dictates which union field was last set + + + _internal_padding : bytes + + + + sm : cudaDevSmResource + Resource corresponding to cudaDevResourceTypeSm `typename`. + - keyedMutex : anon_struct17 + wqConfig : cudaDevWorkqueueConfigResource + Resource corresponding to cudaDevResourceTypeWorkqueueConfig + `typename`. + + + wq : cudaDevWorkqueueResource + Resource corresponding to cudaDevResourceTypeWorkqueue `typename`. + + + _oversize : bytes + + + + nextResource : cudaDevResource_st - reserved : List[unsigned int] Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaExternalSemaphoreWaitParams* _ptr - cdef anon_struct16 _fence - cdef anon_union6 _nvSciSync - cdef anon_struct17 _keyedMutex -{{endif}} -{{if 'struct cudaExternalSemaphoreWaitParams' in found_types}} + cdef cyruntime.cudaDevResource_st* _val_ptr + cdef cyruntime.cudaDevResource_st* _pvt_ptr -cdef class cudaExternalSemaphoreWaitParams: - """ - External semaphore wait parameters, compatible with driver type + cdef cudaDevSmResource _sm + + + cdef cudaDevWorkqueueConfigResource _wqConfig + + + cdef cudaDevWorkqueueResource _wq + + cdef size_t _nextResource_length + cdef cyruntime.cudaDevResource_st* _nextResource + + +cdef class cudalibraryHostUniversalFunctionAndDataTable: + """ Attributes ---------- - params : anon_struct18 - flags : unsigned int - Only when cudaExternalSemaphoreSignalParams is used to signal a - cudaExternalSemaphore_t of type - cudaExternalSemaphoreHandleTypeNvSciSync, the valid flag is - cudaExternalSemaphoreSignalSkipNvSciBufMemSync: which indicates - that while waiting for the cudaExternalSemaphore_t, no memory - synchronization operations should be performed for any external - memory object imported as cudaExternalMemoryHandleTypeNvSciBuf. For - all other types of cudaExternalSemaphore_t, flags must be zero. - reserved : List[unsigned int] + functionTable : Any + + + + functionWindowSize : size_t + + + + dataTable : Any + + + + dataWindowSize : size_t + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaExternalSemaphoreWaitParams __val - cdef ccudart.cudaExternalSemaphoreWaitParams* _ptr - cdef anon_struct18 _params -{{endif}} -{{if 'struct cudaKernelNodeParams' in found_types}} + cdef cyruntime.cudalibraryHostUniversalFunctionAndDataTable _pvt_val + cdef cyruntime.cudalibraryHostUniversalFunctionAndDataTable* _pvt_ptr + + cdef _HelperInputVoidPtr _cyfunctionTable + + + cdef _HelperInputVoidPtr _cydataTable + cdef class cudaKernelNodeParams: """ @@ -1944,32 +3063,50 @@ cdef class cudaKernelNodeParams: Attributes ---------- + func : Any Kernel to launch + + gridDim : dim3 Grid dimensions + + blockDim : dim3 Block dimensions + + sharedMemBytes : unsigned int Dynamic shared-memory size per thread block in bytes + + kernelParams : Any Array of pointers to individual kernel arguments + + extra : Any Pointer to kernel arguments in the "extra" format + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaKernelNodeParams __val - cdef ccudart.cudaKernelNodeParams* _ptr + cdef cyruntime.cudaKernelNodeParams _pvt_val + cdef cyruntime.cudaKernelNodeParams* _pvt_ptr + + cdef _HelperInputVoidPtr _cyfunc + + cdef dim3 _gridDim + + cdef dim3 _blockDim - cdef utils.HelperKernelParams _ckernelParams -{{endif}} -{{if 'struct cudaKernelNodeParamsV2' in found_types}} + + + cdef _HelperKernelParams _cykernelParams + cdef class cudaKernelNodeParamsV2: """ @@ -1977,32 +3114,76 @@ cdef class cudaKernelNodeParamsV2: Attributes ---------- + func : Any - Kernel to launch + functionType = cudaKernelFucntionTypeDevice + + + kern : cudaKernel_t + functionType = cudaKernelFucntionTypeKernel + + + cuFunc : cudaFunction_t + functionType = cudaKernelFucntionTypeFunction + + gridDim : dim3 Grid dimensions + + blockDim : dim3 Block dimensions + + sharedMemBytes : unsigned int Dynamic shared-memory size per thread block in bytes + + kernelParams : Any Array of pointers to individual kernel arguments + + extra : Any Pointer to kernel arguments in the "extra" format + + ctx : cudaExecutionContext_t + Context in which to run the kernel. If NULL will try to use the + current context. + + + functionType : cudaKernelFunctionType + Type of handle passed in the func/kern/cuFunc union above + + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaKernelNodeParamsV2 __val - cdef ccudart.cudaKernelNodeParamsV2* _ptr + cdef cyruntime.cudaKernelNodeParamsV2* _val_ptr + cdef cyruntime.cudaKernelNodeParamsV2* _pvt_ptr + + cdef _HelperInputVoidPtr _cyfunc + + + cdef cudaKernel_t _kern + + + cdef cudaFunction_t _cuFunc + + cdef dim3 _gridDim + + cdef dim3 _blockDim - cdef utils.HelperKernelParams _ckernelParams -{{endif}} -{{if 'struct cudaExternalSemaphoreSignalNodeParams' in found_types}} + + + cdef _HelperKernelParams _cykernelParams + + + cdef cudaExecutionContext_t _ctx + cdef class cudaExternalSemaphoreSignalNodeParams: """ @@ -2010,30 +3191,35 @@ cdef class cudaExternalSemaphoreSignalNodeParams: Attributes ---------- + extSemArray : cudaExternalSemaphore_t Array of external semaphore handles. + + paramsArray : cudaExternalSemaphoreSignalParams Array of external semaphore signal parameters. + + numExtSems : unsigned int Number of handles and parameters supplied in extSemArray and paramsArray. + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaExternalSemaphoreSignalNodeParams __val - cdef ccudart.cudaExternalSemaphoreSignalNodeParams* _ptr + cdef cyruntime.cudaExternalSemaphoreSignalNodeParams _pvt_val + cdef cyruntime.cudaExternalSemaphoreSignalNodeParams* _pvt_ptr + cdef size_t _extSemArray_length - cdef ccudart.cudaExternalSemaphore_t* _extSemArray + cdef cyruntime.cudaExternalSemaphore_t* _extSemArray + cdef size_t _paramsArray_length - cdef ccudart.cudaExternalSemaphoreSignalParams* _paramsArray + cdef cyruntime.cudaExternalSemaphoreSignalParams* _paramsArray -{{endif}} -{{if 'struct cudaExternalSemaphoreSignalNodeParamsV2' in found_types}} cdef class cudaExternalSemaphoreSignalNodeParamsV2: """ @@ -2041,30 +3227,35 @@ cdef class cudaExternalSemaphoreSignalNodeParamsV2: Attributes ---------- + extSemArray : cudaExternalSemaphore_t Array of external semaphore handles. + + paramsArray : cudaExternalSemaphoreSignalParams Array of external semaphore signal parameters. + + numExtSems : unsigned int Number of handles and parameters supplied in extSemArray and paramsArray. + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaExternalSemaphoreSignalNodeParamsV2 __val - cdef ccudart.cudaExternalSemaphoreSignalNodeParamsV2* _ptr + cdef cyruntime.cudaExternalSemaphoreSignalNodeParamsV2 _pvt_val + cdef cyruntime.cudaExternalSemaphoreSignalNodeParamsV2* _pvt_ptr + cdef size_t _extSemArray_length - cdef ccudart.cudaExternalSemaphore_t* _extSemArray + cdef cyruntime.cudaExternalSemaphore_t* _extSemArray + cdef size_t _paramsArray_length - cdef ccudart.cudaExternalSemaphoreSignalParams* _paramsArray + cdef cyruntime.cudaExternalSemaphoreSignalParams* _paramsArray -{{endif}} -{{if 'struct cudaExternalSemaphoreWaitNodeParams' in found_types}} cdef class cudaExternalSemaphoreWaitNodeParams: """ @@ -2072,30 +3263,35 @@ cdef class cudaExternalSemaphoreWaitNodeParams: Attributes ---------- + extSemArray : cudaExternalSemaphore_t Array of external semaphore handles. + + paramsArray : cudaExternalSemaphoreWaitParams Array of external semaphore wait parameters. + + numExtSems : unsigned int Number of handles and parameters supplied in extSemArray and paramsArray. + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaExternalSemaphoreWaitNodeParams __val - cdef ccudart.cudaExternalSemaphoreWaitNodeParams* _ptr + cdef cyruntime.cudaExternalSemaphoreWaitNodeParams _pvt_val + cdef cyruntime.cudaExternalSemaphoreWaitNodeParams* _pvt_ptr + cdef size_t _extSemArray_length - cdef ccudart.cudaExternalSemaphore_t* _extSemArray + cdef cyruntime.cudaExternalSemaphore_t* _extSemArray + cdef size_t _paramsArray_length - cdef ccudart.cudaExternalSemaphoreWaitParams* _paramsArray + cdef cyruntime.cudaExternalSemaphoreWaitParams* _paramsArray -{{endif}} -{{if 'struct cudaExternalSemaphoreWaitNodeParamsV2' in found_types}} cdef class cudaExternalSemaphoreWaitNodeParamsV2: """ @@ -2103,30 +3299,35 @@ cdef class cudaExternalSemaphoreWaitNodeParamsV2: Attributes ---------- + extSemArray : cudaExternalSemaphore_t Array of external semaphore handles. + + paramsArray : cudaExternalSemaphoreWaitParams Array of external semaphore wait parameters. + + numExtSems : unsigned int Number of handles and parameters supplied in extSemArray and paramsArray. + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaExternalSemaphoreWaitNodeParamsV2 __val - cdef ccudart.cudaExternalSemaphoreWaitNodeParamsV2* _ptr + cdef cyruntime.cudaExternalSemaphoreWaitNodeParamsV2 _pvt_val + cdef cyruntime.cudaExternalSemaphoreWaitNodeParamsV2* _pvt_ptr + cdef size_t _extSemArray_length - cdef ccudart.cudaExternalSemaphore_t* _extSemArray + cdef cyruntime.cudaExternalSemaphore_t* _extSemArray + cdef size_t _paramsArray_length - cdef ccudart.cudaExternalSemaphoreWaitParams* _paramsArray + cdef cyruntime.cudaExternalSemaphoreWaitParams* _paramsArray -{{endif}} -{{if 'struct cudaConditionalNodeParams' in found_types}} cdef class cudaConditionalNodeParams: """ @@ -2134,13 +3335,22 @@ cdef class cudaConditionalNodeParams: Attributes ---------- + handle : cudaGraphConditionalHandle Conditional node handle. Handles must be created in advance of creating the node using cudaGraphConditionalHandleCreate. + + type : cudaGraphConditionalNodeType Type of conditional node. + + size : unsigned int - Size of graph output array. Must be 1. + Size of graph output array. Allowed values are 1 for + cudaGraphCondTypeWhile, 1 or 2 for cudaGraphCondTypeIf, or any + value greater than zero for cudaGraphCondTypeSwitch. + + phGraph_out : cudaGraph_t CUDA-owned array populated with conditional node child graphs during creation of the node. Valid for the lifetime of the @@ -2151,22 +3361,36 @@ cdef class cudaConditionalNodeParams: - All kernels, including kernels in nested conditionals or child graphs at any level, must belong to the same CUDA context. These graphs may be populated using graph node creation APIs or - cudaStreamBeginCaptureToGraph. + cudaStreamBeginCaptureToGraph. cudaGraphCondTypeIf: phGraph_out[0] + is executed when the condition is non-zero. If `size` == 2, + phGraph_out[1] will be executed when the condition is zero. + cudaGraphCondTypeWhile: phGraph_out[0] is executed as long as the + condition is non-zero. cudaGraphCondTypeSwitch: phGraph_out[n] is + executed when the condition is equal to n. If the condition >= + `size`, no body graph is executed. + + + ctx : cudaExecutionContext_t + CUDA Execution Context + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaConditionalNodeParams __val - cdef ccudart.cudaConditionalNodeParams* _ptr + cdef cyruntime.cudaConditionalNodeParams _pvt_val + cdef cyruntime.cudaConditionalNodeParams* _pvt_ptr + cdef cudaGraphConditionalHandle _handle + + cdef size_t _phGraph_out_length - cdef ccudart.cudaGraph_t* _phGraph_out + cdef cyruntime.cudaGraph_t* _phGraph_out + + + cdef cudaExecutionContext_t _ctx -{{endif}} -{{if 'struct cudaChildGraphNodeParams' in found_types}} cdef class cudaChildGraphNodeParams: """ @@ -2174,21 +3398,29 @@ cdef class cudaChildGraphNodeParams: Attributes ---------- + graph : cudaGraph_t The child graph to clone into the node for node creation, or a - handle to the graph owned by the node for node query + handle to the graph owned by the node for node query. The graph + must not contain conditional nodes. Graphs containing memory + allocation or memory free nodes must set the ownership to be moved + to the parent. + + + ownership : cudaGraphChildGraphNodeOwnership + The ownership relationship of the child graph node. + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaChildGraphNodeParams __val - cdef ccudart.cudaChildGraphNodeParams* _ptr + cdef cyruntime.cudaChildGraphNodeParams _pvt_val + cdef cyruntime.cudaChildGraphNodeParams* _pvt_ptr + cdef cudaGraph_t _graph -{{endif}} -{{if 'struct cudaEventRecordNodeParams' in found_types}} + cdef class cudaEventRecordNodeParams: """ @@ -2196,20 +3428,21 @@ cdef class cudaEventRecordNodeParams: Attributes ---------- + event : cudaEvent_t The event to record when the node executes + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaEventRecordNodeParams __val - cdef ccudart.cudaEventRecordNodeParams* _ptr + cdef cyruntime.cudaEventRecordNodeParams _pvt_val + cdef cyruntime.cudaEventRecordNodeParams* _pvt_ptr + cdef cudaEvent_t _event -{{endif}} -{{if 'struct cudaEventWaitNodeParams' in found_types}} + cdef class cudaEventWaitNodeParams: """ @@ -2217,20 +3450,21 @@ cdef class cudaEventWaitNodeParams: Attributes ---------- + event : cudaEvent_t The event to wait on from the node + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaEventWaitNodeParams __val - cdef ccudart.cudaEventWaitNodeParams* _ptr + cdef cyruntime.cudaEventWaitNodeParams _pvt_val + cdef cyruntime.cudaEventWaitNodeParams* _pvt_ptr + cdef cudaEvent_t _event -{{endif}} -{{if 'struct cudaGraphNodeParams' in found_types}} + cdef class cudaGraphNodeParams: """ @@ -2238,61 +3472,114 @@ cdef class cudaGraphNodeParams: Attributes ---------- + type : cudaGraphNodeType Type of the node - reserved0 : List[int] + + + reserved0 : list[int] Reserved. Must be zero. - reserved1 : List[long long] + + + reserved1 : list[long long] Padding. Unused bytes must be zero. + + kernel : cudaKernelNodeParamsV2 Kernel node parameters. + + memcpy : cudaMemcpyNodeParams Memcpy node parameters. + + memset : cudaMemsetParamsV2 Memset node parameters. + + host : cudaHostNodeParamsV2 Host node parameters. + + graph : cudaChildGraphNodeParams Child graph node parameters. + + eventWait : cudaEventWaitNodeParams Event wait node parameters. + + eventRecord : cudaEventRecordNodeParams Event record node parameters. + + extSemSignal : cudaExternalSemaphoreSignalNodeParamsV2 External semaphore signal node parameters. + + extSemWait : cudaExternalSemaphoreWaitNodeParamsV2 External semaphore wait node parameters. + + alloc : cudaMemAllocNodeParamsV2 Memory allocation node parameters. + + free : cudaMemFreeNodeParams Memory free node parameters. + + conditional : cudaConditionalNodeParams Conditional node parameters. + + reserved2 : long long Reserved bytes. Must be zero. + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaGraphNodeParams* _val_ptr - cdef ccudart.cudaGraphNodeParams* _ptr + cdef cyruntime.cudaGraphNodeParams* _val_ptr + cdef cyruntime.cudaGraphNodeParams* _pvt_ptr + cdef cudaKernelNodeParamsV2 _kernel + + cdef cudaMemcpyNodeParams _memcpy + + cdef cudaMemsetParamsV2 _memset + + cdef cudaHostNodeParamsV2 _host + + cdef cudaChildGraphNodeParams _graph + + cdef cudaEventWaitNodeParams _eventWait + + cdef cudaEventRecordNodeParams _eventRecord + + cdef cudaExternalSemaphoreSignalNodeParamsV2 _extSemSignal + + cdef cudaExternalSemaphoreWaitNodeParamsV2 _extSemWait + + cdef cudaMemAllocNodeParamsV2 _alloc + + cdef cudaMemFreeNodeParams _free + + cdef cudaConditionalNodeParams _conditional -{{endif}} -{{if 'struct cudaGraphEdgeData_st' in found_types}} + cdef class cudaGraphEdgeData_st: """ @@ -2303,6 +3590,7 @@ cdef class cudaGraphEdgeData_st: Attributes ---------- + from_port : bytes This indicates when the dependency is triggered from the upstream node on the edge. The meaning is specfic to the node type. A value @@ -2313,6 +3601,8 @@ cdef class cudaGraphEdgeData_st: cudaGraphKernelNodePortDefault, cudaGraphKernelNodePortProgrammatic, or cudaGraphKernelNodePortLaunchCompletion. + + to_port : bytes This indicates what portion of the downstream node is dependent on the upstream node or portion thereof (indicated by `from_port`). @@ -2320,24 +3610,26 @@ cdef class cudaGraphEdgeData_st: means the entirety of the downstream node is dependent on the upstream work. Currently no node types define non-zero ports. Accordingly, this field must be set to zero. + + type : bytes - This should be populated with a value from - ::cudaGraphDependencyType. (It is typed as char due to compiler- - specific layout of bitfields.) See ::cudaGraphDependencyType. + This should be populated with a value from cudaGraphDependencyType. + (It is typed as char due to compiler-specific layout of bitfields.) + See cudaGraphDependencyType. + + reserved : bytes These bytes are unused and must be zeroed. This ensures compatibility if additional fields are added in the future. + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaGraphEdgeData_st __val - cdef ccudart.cudaGraphEdgeData_st* _ptr -{{endif}} -{{if 'struct cudaGraphInstantiateParams_st' in found_types}} + cdef cyruntime.cudaGraphEdgeData_st _pvt_val + cdef cyruntime.cudaGraphEdgeData_st* _pvt_ptr cdef class cudaGraphInstantiateParams_st: """ @@ -2345,27 +3637,36 @@ cdef class cudaGraphInstantiateParams_st: Attributes ---------- + flags : unsigned long long Instantiation flags + + uploadStream : cudaStream_t Upload stream + + errNode_out : cudaGraphNode_t The node which caused instantiation to fail, if any + + result_out : cudaGraphInstantiateResult Whether instantiation was successful. If it failed, the reason why + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaGraphInstantiateParams_st __val - cdef ccudart.cudaGraphInstantiateParams_st* _ptr + cdef cyruntime.cudaGraphInstantiateParams_st _pvt_val + cdef cyruntime.cudaGraphInstantiateParams_st* _pvt_ptr + cdef cudaStream_t _uploadStream + + cdef cudaGraphNode_t _errNode_out -{{endif}} -{{if 'struct cudaGraphExecUpdateResultInfo_st' in found_types}} + cdef class cudaGraphExecUpdateResultInfo_st: """ @@ -2373,72 +3674,92 @@ cdef class cudaGraphExecUpdateResultInfo_st: Attributes ---------- + result : cudaGraphExecUpdateResult Gives more specific detail when a cuda graph update fails. + + errorNode : cudaGraphNode_t The "to node" of the error edge when the topologies do not match. The error node when the error is associated with a specific node. NULL when the error is generic. + + errorFromNode : cudaGraphNode_t The from node of error edge when the topologies do not match. Otherwise NULL. + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaGraphExecUpdateResultInfo_st __val - cdef ccudart.cudaGraphExecUpdateResultInfo_st* _ptr + cdef cyruntime.cudaGraphExecUpdateResultInfo_st _pvt_val + cdef cyruntime.cudaGraphExecUpdateResultInfo_st* _pvt_ptr + cdef cudaGraphNode_t _errorNode + + cdef cudaGraphNode_t _errorFromNode -{{endif}} -{{if 'struct cudaGraphKernelNodeUpdate' in found_types}} -cdef class anon_struct19: + +cdef class anon_struct16: """ Attributes ---------- + pValue : Any + + offset : size_t + + size : size_t + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaGraphKernelNodeUpdate* _ptr -{{endif}} -{{if 'struct cudaGraphKernelNodeUpdate' in found_types}} + cdef cyruntime.cudaGraphKernelNodeUpdate* _pvt_ptr + + cdef _HelperInputVoidPtr _cypValue -cdef class anon_union8: + +cdef class anon_union10: """ Attributes ---------- + gridDim : dim3 - param : anon_struct19 + + + param : anon_struct16 + + isEnabled : unsigned int + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaGraphKernelNodeUpdate* _ptr + cdef cyruntime.cudaGraphKernelNodeUpdate* _pvt_ptr + cdef dim3 _gridDim - cdef anon_struct19 _param -{{endif}} -{{if 'struct cudaGraphKernelNodeUpdate' in found_types}} + + + cdef anon_struct16 _param + cdef class cudaGraphKernelNodeUpdate: """ @@ -2447,156 +3768,210 @@ cdef class cudaGraphKernelNodeUpdate: Attributes ---------- + node : cudaGraphDeviceNode_t Node to update + + field : cudaGraphKernelNodeField Which type of update to apply. Determines how updateData is interpreted - updateData : anon_union8 + + + updateData : anon_union10 Update data to apply. Which field is used depends on field's value + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaGraphKernelNodeUpdate* _val_ptr - cdef ccudart.cudaGraphKernelNodeUpdate* _ptr + cdef cyruntime.cudaGraphKernelNodeUpdate* _val_ptr + cdef cyruntime.cudaGraphKernelNodeUpdate* _pvt_ptr + cdef cudaGraphDeviceNode_t _node - cdef anon_union8 _updateData -{{endif}} -{{if 'struct cudaLaunchMemSyncDomainMap_st' in found_types}} + + + cdef anon_union10 _updateData + cdef class cudaLaunchMemSyncDomainMap_st: """ Memory Synchronization Domain map See cudaLaunchMemSyncDomain. By default, kernels are launched in domain 0. Kernel launched with cudaLaunchMemSyncDomainRemote will have a different domain ID. User - may also alter the domain ID with ::cudaLaunchMemSyncDomainMap for - a specific stream / graph node / kernel launch. See + may also alter the domain ID with cudaLaunchMemSyncDomainMap for a + specific stream / graph node / kernel launch. See cudaLaunchAttributeMemSyncDomainMap. Domain ID range is available through cudaDevAttrMemSyncDomainCount. Attributes ---------- + default_ : bytes The default domain ID to use for designated kernels + + remote : bytes The remote domain ID to use for designated kernels + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaLaunchMemSyncDomainMap_st __val - cdef ccudart.cudaLaunchMemSyncDomainMap_st* _ptr -{{endif}} -{{if 'union cudaLaunchAttributeValue' in found_types}} + cdef cyruntime.cudaLaunchMemSyncDomainMap_st _pvt_val + cdef cyruntime.cudaLaunchMemSyncDomainMap_st* _pvt_ptr -cdef class anon_struct20: +cdef class anon_struct17: """ Attributes ---------- + x : unsigned int + + y : unsigned int + + z : unsigned int + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaLaunchAttributeValue* _ptr -{{endif}} -{{if 'union cudaLaunchAttributeValue' in found_types}} + cdef cyruntime.cudaLaunchAttributeValue* _pvt_ptr -cdef class anon_struct21: +cdef class anon_struct18: """ Attributes ---------- + event : cudaEvent_t + + flags : int + + triggerAtBlockStart : int + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaLaunchAttributeValue* _ptr + cdef cyruntime.cudaLaunchAttributeValue* _pvt_ptr + cdef cudaEvent_t _event -{{endif}} -{{if 'union cudaLaunchAttributeValue' in found_types}} -cdef class anon_struct22: + +cdef class anon_struct19: + """ + Attributes + ---------- + + x : unsigned int + + + + y : unsigned int + + + + z : unsigned int + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + cdef cyruntime.cudaLaunchAttributeValue* _pvt_ptr + +cdef class anon_struct20: """ Attributes ---------- + event : cudaEvent_t + + flags : int + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaLaunchAttributeValue* _ptr + cdef cyruntime.cudaLaunchAttributeValue* _pvt_ptr + cdef cudaEvent_t _event -{{endif}} -{{if 'union cudaLaunchAttributeValue' in found_types}} -cdef class anon_struct23: + +cdef class anon_struct21: """ Attributes ---------- + deviceUpdatable : int + + devNode : cudaGraphDeviceNode_t + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaLaunchAttributeValue* _ptr + cdef cyruntime.cudaLaunchAttributeValue* _pvt_ptr + cdef cudaGraphDeviceNode_t _devNode -{{endif}} -{{if 'union cudaLaunchAttributeValue' in found_types}} + cdef class cudaLaunchAttributeValue: """ - Launch attributes union; used as value field of - ::cudaLaunchAttribute + Launch attributes union; used as value field of cudaLaunchAttribute Attributes ---------- + pad : bytes + + accessPolicyWindow : cudaAccessPolicyWindow Value of launch attribute cudaLaunchAttributeAccessPolicyWindow. + + cooperative : int Value of launch attribute cudaLaunchAttributeCooperative. Nonzero indicates a cooperative kernel (see cudaLaunchCooperativeKernel). + + syncPolicy : cudaSynchronizationPolicy Value of launch attribute cudaLaunchAttributeSynchronizationPolicy. - ::cudaSynchronizationPolicy for work queued up in this stream. - clusterDim : anon_struct20 + cudaSynchronizationPolicy for work queued up in this stream. + + + clusterDim : anon_struct17 Value of launch attribute cudaLaunchAttributeClusterDimension that represents the desired cluster dimensions for the kernel. Opaque type with the following fields: - `x` - The X dimension of the @@ -2604,49 +3979,123 @@ cdef class cudaLaunchAttributeValue: `y` - The Y dimension of the cluster, in blocks. Must be a divisor of the grid Y dimension. - `z` - The Z dimension of the cluster, in blocks. Must be a divisor of the grid Z dimension. + + clusterSchedulingPolicyPreference : cudaClusterSchedulingPolicy Value of launch attribute cudaLaunchAttributeClusterSchedulingPolicyPreference. Cluster scheduling policy preference for the kernel. + + programmaticStreamSerializationAllowed : int Value of launch attribute cudaLaunchAttributeProgrammaticStreamSerialization. - programmaticEvent : anon_struct21 - Value of launch attribute cudaLaunchAttributeProgrammaticEvent. + + + programmaticEvent : anon_struct18 + Value of launch attribute cudaLaunchAttributeProgrammaticEvent with + the following fields: - `cudaEvent_t` event - Event to fire when + all blocks trigger it. - `int` flags; - Event record flags, see + cudaEventRecordWithFlags. Does not accept cudaEventRecordExternal. + - `int` triggerAtBlockStart - If this is set to non-0, each block + launch will automatically trigger the event. + + priority : int Value of launch attribute cudaLaunchAttributePriority. Execution priority of the kernel. + + memSyncDomainMap : cudaLaunchMemSyncDomainMap Value of launch attribute cudaLaunchAttributeMemSyncDomainMap. See - ::cudaLaunchMemSyncDomainMap. + cudaLaunchMemSyncDomainMap. + + memSyncDomain : cudaLaunchMemSyncDomain Value of launch attribute cudaLaunchAttributeMemSyncDomain. See cudaLaunchMemSyncDomain. - launchCompletionEvent : anon_struct22 - Value of launch attribute cudaLaunchAttributeLaunchCompletionEvent. - deviceUpdatableKernelNode : anon_struct23 + + + preferredClusterDim : anon_struct19 Value of launch attribute - cudaLaunchAttributeDeviceUpdatableKernelNode. + cudaLaunchAttributePreferredClusterDimension that represents the + desired preferred cluster dimensions for the kernel. Opaque type + with the following fields: - `x` - The X dimension of the preferred + cluster, in blocks. Must be a divisor of the grid X dimension, and + must be a multiple of the `x` field of + ::cudaLaunchAttributeValue::clusterDim. - `y` - The Y dimension + of the preferred cluster, in blocks. Must be a divisor of the grid + Y dimension, and must be a multiple of the `y` field of + ::cudaLaunchAttributeValue::clusterDim. - `z` - The Z dimension + of the preferred cluster, in blocks. Must be equal to the `z` field + of ::cudaLaunchAttributeValue::clusterDim. + + + launchCompletionEvent : anon_struct20 + Value of launch attribute cudaLaunchAttributeLaunchCompletionEvent + with the following fields: - `cudaEvent_t` event - Event to fire + when the last block launches. - `int` flags - Event record + flags, see cudaEventRecordWithFlags. Does not accept + cudaEventRecordExternal. + + + deviceUpdatableKernelNode : anon_struct21 + Value of launch attribute + cudaLaunchAttributeDeviceUpdatableKernelNode with the following + fields: - `int` deviceUpdatable - Whether or not the resulting + kernel node should be device-updatable. - + `cudaGraphDeviceNode_t` devNode - Returns a handle to pass to the + various device-side update functions. + + sharedMemCarveout : unsigned int Value of launch attribute cudaLaunchAttributePreferredSharedMemoryCarveout. + + nvlinkUtilCentricScheduling : unsigned int + Value of launch attribute + cudaLaunchAttributeNvlinkUtilCentricScheduling. + + + portableClusterSizeMode : cudaLaunchAttributePortableClusterMode + Value of launch attribute + cudaLaunchAttributePortableClusterSizeMode + + + sharedMemoryMode : cudaSharedMemoryMode + Value of launch attribute cudaLaunchAttributeSharedMemoryMode. See + cudaSharedMemoryMode for acceptable values. + + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaLaunchAttributeValue __val - cdef ccudart.cudaLaunchAttributeValue* _ptr + cdef cyruntime.cudaLaunchAttributeValue _pvt_val + cdef cyruntime.cudaLaunchAttributeValue* _pvt_ptr + cdef cudaAccessPolicyWindow _accessPolicyWindow - cdef anon_struct20 _clusterDim - cdef anon_struct21 _programmaticEvent + + + cdef anon_struct17 _clusterDim + + + cdef anon_struct18 _programmaticEvent + + cdef cudaLaunchMemSyncDomainMap _memSyncDomainMap - cdef anon_struct22 _launchCompletionEvent - cdef anon_struct23 _deviceUpdatableKernelNode -{{endif}} -{{if 'struct cudaLaunchAttribute_st' in found_types}} + + + cdef anon_struct19 _preferredClusterDim + + + cdef anon_struct20 _launchCompletionEvent + + + cdef anon_struct21 _deviceUpdatableKernelNode + cdef class cudaLaunchAttribute_st: """ @@ -2654,57 +4103,60 @@ cdef class cudaLaunchAttribute_st: Attributes ---------- + id : cudaLaunchAttributeID Attribute to set + + val : cudaLaunchAttributeValue Value of the attribute + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaLaunchAttribute_st __val - cdef ccudart.cudaLaunchAttribute_st* _ptr + cdef cyruntime.cudaLaunchAttribute_st _pvt_val + cdef cyruntime.cudaLaunchAttribute_st* _pvt_ptr + cdef cudaLaunchAttributeValue _val -{{endif}} -{{if 'struct cudaAsyncNotificationInfo' in found_types}} -cdef class anon_struct24: + +cdef class anon_struct22: """ Attributes ---------- + bytesOverBudget : unsigned long long + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaAsyncNotificationInfo* _ptr -{{endif}} -{{if 'struct cudaAsyncNotificationInfo' in found_types}} + cdef cyruntime.cudaAsyncNotificationInfo* _pvt_ptr -cdef class anon_union9: +cdef class anon_union11: """ Attributes ---------- - overBudget : anon_struct24 + + overBudget : anon_struct22 + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaAsyncNotificationInfo* _ptr - cdef anon_struct24 _overBudget -{{endif}} -{{if 'struct cudaAsyncNotificationInfo' in found_types}} + cdef cyruntime.cudaAsyncNotificationInfo* _pvt_ptr + + cdef anon_struct22 _overBudget + cdef class cudaAsyncNotificationInfo: """ @@ -2712,22 +4164,26 @@ cdef class cudaAsyncNotificationInfo: Attributes ---------- + type : cudaAsyncNotificationType + The type of notification being sent - info : anon_union9 + + info : anon_union11 + Information about the notification. `typename` must be checked in + order to interpret this field. Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaAsyncNotificationInfo* _val_ptr - cdef ccudart.cudaAsyncNotificationInfo* _ptr - cdef anon_union9 _info -{{endif}} -{{if 'struct cudaTextureDesc' in found_types}} + cdef cyruntime.cudaAsyncNotificationInfo* _val_ptr + cdef cyruntime.cudaAsyncNotificationInfo* _pvt_ptr + + cdef anon_union11 _info + cdef class cudaTextureDesc: """ @@ -2735,43 +4191,96 @@ cdef class cudaTextureDesc: Attributes ---------- - addressMode : List[cudaTextureAddressMode] + + addressMode : list[cudaTextureAddressMode] Texture address mode for up to 3 dimensions + + filterMode : cudaTextureFilterMode Texture filter mode + + readMode : cudaTextureReadMode Texture read mode + + sRGB : int Perform sRGB->linear conversion during texture read - borderColor : List[float] + + + borderColor : list[float] Texture Border Color + + normalizedCoords : int Indicates whether texture reads are normalized or not + + maxAnisotropy : unsigned int Limit to the anisotropy ratio + + mipmapFilterMode : cudaTextureFilterMode Mipmap filter mode + + mipmapLevelBias : float Offset applied to the supplied mipmap level + + minMipmapLevelClamp : float Lower end of the mipmap level range to clamp access to + + maxMipmapLevelClamp : float Upper end of the mipmap level range to clamp access to + + disableTrilinearOptimization : int Disable any trilinear filtering optimizations. + + seamlessCubemap : int Enable seamless cube map filtering. + Methods ------- getPtr() Get memory address of class instance + """ + cdef cyruntime.cudaTextureDesc _pvt_val + cdef cyruntime.cudaTextureDesc* _pvt_ptr + +cdef class cudaGraphRecaptureCallbackData: + """ + Struct of user callback data that is invoked when node parameter + mismatches are detected while recapturing to an existing graph + + Attributes + ---------- + + callbackFunc : cudaGraphRecaptureCallback_t + Callback function that will be invoked + + userData : Any + Generic pointer that is passed to the callback function + + + Methods + ------- + getPtr() + Get memory address of class instance """ - cdef ccudart.cudaTextureDesc __val - cdef ccudart.cudaTextureDesc* _ptr -{{endif}} -{{if True}} + cdef cyruntime.cudaGraphRecaptureCallbackData _pvt_val + cdef cyruntime.cudaGraphRecaptureCallbackData* _pvt_ptr + + cdef cudaGraphRecaptureCallback_t _callbackFunc + + + cdef _HelperInputVoidPtr _cyuserData + cdef class cudaEglPlaneDesc_st: """ @@ -2780,51 +4289,65 @@ cdef class cudaEglPlaneDesc_st: Attributes ---------- + width : unsigned int Width of plane + + height : unsigned int Height of plane + + depth : unsigned int Depth of plane + + pitch : unsigned int Pitch of plane + + numChannels : unsigned int Number of channels for the plane + + channelDesc : cudaChannelFormatDesc Channel Format Descriptor - reserved : List[unsigned int] + + + reserved : list[unsigned int] Reserved for future use + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaEglPlaneDesc_st __val - cdef ccudart.cudaEglPlaneDesc_st* _ptr + cdef cyruntime.cudaEglPlaneDesc_st _pvt_val + cdef cyruntime.cudaEglPlaneDesc_st* _pvt_ptr + cdef cudaChannelFormatDesc _channelDesc -{{endif}} -{{if True}} -cdef class anon_union10: + +cdef class anon_union12: """ Attributes ---------- - pArray : List[cudaArray_t] - pPitch : List[cudaPitchedPtr] + pArray : list[cudaArray_t] + + + + pPitch : list[cudaPitchedPtr] + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaEglFrame_st* _ptr -{{endif}} -{{if True}} + cdef cyruntime.cudaEglFrame_st* _pvt_ptr cdef class cudaEglFrame_st: """ @@ -2839,62 +4362,69 @@ cdef class cudaEglFrame_st: Attributes ---------- - frame : anon_union10 - planeDesc : List[cudaEglPlaneDesc] + frame : anon_union12 + + + + planeDesc : list[cudaEglPlaneDesc] CUDA EGL Plane Descriptor cudaEglPlaneDesc + + planeCount : unsigned int Number of planes + + frameType : cudaEglFrameType Array or Pitch + + eglColorFormat : cudaEglColorFormat CUDA EGL Color Format + Methods ------- getPtr() Get memory address of class instance - """ - cdef ccudart.cudaEglFrame_st* _val_ptr - cdef ccudart.cudaEglFrame_st* _ptr - cdef anon_union10 _frame -{{endif}} -{{if 'CUuuid' in found_types}} + cdef cyruntime.cudaEglFrame_st* _val_ptr + cdef cyruntime.cudaEglFrame_st* _pvt_ptr + + cdef anon_union12 _frame + cdef class CUuuid(CUuuid_st): """ Attributes ---------- + bytes : bytes < CUDA definition of UUID + Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'cudaUUID_t' in found_types}} cdef class cudaUUID_t(CUuuid_st): """ Attributes ---------- + bytes : bytes < CUDA definition of UUID + Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'cudaIpcEventHandle_t' in found_types}} cdef class cudaIpcEventHandle_t(cudaIpcEventHandle_st): """ @@ -2902,18 +4432,17 @@ cdef class cudaIpcEventHandle_t(cudaIpcEventHandle_st): Attributes ---------- + reserved : bytes + Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'cudaIpcMemHandle_t' in found_types}} cdef class cudaIpcMemHandle_t(cudaIpcMemHandle_st): """ @@ -2921,35 +4450,127 @@ cdef class cudaIpcMemHandle_t(cudaIpcMemHandle_st): Attributes ---------- + reserved : bytes + Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'cudaMemFabricHandle_t' in found_types}} cdef class cudaMemFabricHandle_t(cudaMemFabricHandle_st): """ Attributes ---------- + reserved : bytes + + Methods + ------- + getPtr() + Get memory address of class instance + """ + pass + +cdef class cudaDevSmResourceGroupParams(cudaDevSmResourceGroupParams_st): + """ + Input data for splitting SMs + + Attributes + ---------- + + smCount : unsigned int + The amount of SMs available in this resource. + + + coscheduledSmCount : unsigned int + The amount of co-scheduled SMs grouped together for locality + purposes. + + + preferredCoscheduledSmCount : unsigned int + When possible, combine co-scheduled groups together into larger + groups of this size. + + + flags : unsigned int + Combination of `cudaDevSmResourceGroup_flags` values to indicate + this this group is created. + + + reserved : list[unsigned int] + Reserved for future use - ensure this is zero initialized. + + Methods ------- getPtr() Get memory address of class instance + """ + pass + +cdef class cudaDevResource(cudaDevResource_st): + """ + A tagged union describing different resources identified by the + type field. This structure should not be directly modified outside + of the API that created it. struct enumcudaDevResourceTypetype; + union structcudaDevSmResourcesm; + structcudaDevWorkqueueConfigResourcewqConfig; + structcudaDevWorkqueueResourcewq; ; ; - If `typename` is + `cudaDevResourceTypeInvalid`, this resoure is not valid and cannot + be further accessed. - If `typename` is `cudaDevResourceTypeSm`, + the cudaDevSmResource structure `sm` is filled in. For example, + `sm.smCount` will reflect the amount of streaming multiprocessors + available in this resource. - If `typename` is + `cudaDevResourceTypeWorkqueueConfig`, the + cudaDevWorkqueueConfigResource structure `wqConfig` is filled in. + - If `typename` is `cudaDevResourceTypeWorkqueue`, the + cudaDevWorkqueueResource structure `wq` is filled in. + + Attributes + ---------- + + type : cudaDevResourceType + Type of resource, dictates which union field was last set + + + _internal_padding : bytes + + + + sm : cudaDevSmResource + Resource corresponding to cudaDevResourceTypeSm `typename`. + + wqConfig : cudaDevWorkqueueConfigResource + Resource corresponding to cudaDevResourceTypeWorkqueueConfig + `typename`. + + + wq : cudaDevWorkqueueResource + Resource corresponding to cudaDevResourceTypeWorkqueue `typename`. + + + _oversize : bytes + + + + nextResource : cudaDevResource_st + + + + Methods + ------- + getPtr() + Get memory address of class instance """ pass -{{endif}} -{{if 'cudaGraphEdgeData' in found_types}} cdef class cudaGraphEdgeData(cudaGraphEdgeData_st): """ @@ -2960,6 +4581,7 @@ cdef class cudaGraphEdgeData(cudaGraphEdgeData_st): Attributes ---------- + from_port : bytes This indicates when the dependency is triggered from the upstream node on the edge. The meaning is specfic to the node type. A value @@ -2970,6 +4592,8 @@ cdef class cudaGraphEdgeData(cudaGraphEdgeData_st): cudaGraphKernelNodePortDefault, cudaGraphKernelNodePortProgrammatic, or cudaGraphKernelNodePortLaunchCompletion. + + to_port : bytes This indicates what portion of the downstream node is dependent on the upstream node or portion thereof (indicated by `from_port`). @@ -2977,23 +4601,25 @@ cdef class cudaGraphEdgeData(cudaGraphEdgeData_st): means the entirety of the downstream node is dependent on the upstream work. Currently no node types define non-zero ports. Accordingly, this field must be set to zero. + + type : bytes - This should be populated with a value from - ::cudaGraphDependencyType. (It is typed as char due to compiler- - specific layout of bitfields.) See ::cudaGraphDependencyType. + This should be populated with a value from cudaGraphDependencyType. + (It is typed as char due to compiler-specific layout of bitfields.) + See cudaGraphDependencyType. + + reserved : bytes These bytes are unused and must be zeroed. This ensures compatibility if additional fields are added in the future. + Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'cudaGraphInstantiateParams' in found_types}} cdef class cudaGraphInstantiateParams(cudaGraphInstantiateParams_st): """ @@ -3001,24 +4627,29 @@ cdef class cudaGraphInstantiateParams(cudaGraphInstantiateParams_st): Attributes ---------- + flags : unsigned long long Instantiation flags + + uploadStream : cudaStream_t Upload stream + + errNode_out : cudaGraphNode_t The node which caused instantiation to fail, if any + + result_out : cudaGraphInstantiateResult Whether instantiation was successful. If it failed, the reason why + Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'cudaGraphExecUpdateResultInfo' in found_types}} cdef class cudaGraphExecUpdateResultInfo(cudaGraphExecUpdateResultInfo_st): """ @@ -3026,52 +4657,56 @@ cdef class cudaGraphExecUpdateResultInfo(cudaGraphExecUpdateResultInfo_st): Attributes ---------- + result : cudaGraphExecUpdateResult Gives more specific detail when a cuda graph update fails. + + errorNode : cudaGraphNode_t The "to node" of the error edge when the topologies do not match. The error node when the error is associated with a specific node. NULL when the error is generic. + + errorFromNode : cudaGraphNode_t The from node of error edge when the topologies do not match. Otherwise NULL. + Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'cudaLaunchMemSyncDomainMap' in found_types}} cdef class cudaLaunchMemSyncDomainMap(cudaLaunchMemSyncDomainMap_st): """ Memory Synchronization Domain map See cudaLaunchMemSyncDomain. By default, kernels are launched in domain 0. Kernel launched with cudaLaunchMemSyncDomainRemote will have a different domain ID. User - may also alter the domain ID with ::cudaLaunchMemSyncDomainMap for - a specific stream / graph node / kernel launch. See + may also alter the domain ID with cudaLaunchMemSyncDomainMap for a + specific stream / graph node / kernel launch. See cudaLaunchAttributeMemSyncDomainMap. Domain ID range is available through cudaDevAttrMemSyncDomainCount. Attributes ---------- + default_ : bytes The default domain ID to use for designated kernels + + remote : bytes The remote domain ID to use for designated kernels + Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'cudaLaunchAttribute' in found_types}} cdef class cudaLaunchAttribute(cudaLaunchAttribute_st): """ @@ -3079,20 +4714,21 @@ cdef class cudaLaunchAttribute(cudaLaunchAttribute_st): Attributes ---------- + id : cudaLaunchAttributeID Attribute to set + + val : cudaLaunchAttributeValue Value of the attribute + Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'cudaAsyncNotificationInfo_t' in found_types}} cdef class cudaAsyncNotificationInfo_t(cudaAsyncNotificationInfo): """ @@ -3100,39 +4736,49 @@ cdef class cudaAsyncNotificationInfo_t(cudaAsyncNotificationInfo): Attributes ---------- + type : cudaAsyncNotificationType + The type of notification being sent + - info : anon_union9 + info : anon_union11 + Information about the notification. `typename` must be checked in + order to interpret this field. Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if True}} cdef class cudaStreamAttrValue(cudaLaunchAttributeValue): """ - Launch attributes union; used as value field of - ::cudaLaunchAttribute + Launch attributes union; used as value field of cudaLaunchAttribute Attributes ---------- + pad : bytes + + accessPolicyWindow : cudaAccessPolicyWindow Value of launch attribute cudaLaunchAttributeAccessPolicyWindow. + + cooperative : int Value of launch attribute cudaLaunchAttributeCooperative. Nonzero indicates a cooperative kernel (see cudaLaunchCooperativeKernel). + + syncPolicy : cudaSynchronizationPolicy Value of launch attribute cudaLaunchAttributeSynchronizationPolicy. - ::cudaSynchronizationPolicy for work queued up in this stream. - clusterDim : anon_struct20 + cudaSynchronizationPolicy for work queued up in this stream. + + + clusterDim : anon_struct17 Value of launch attribute cudaLaunchAttributeClusterDimension that represents the desired cluster dimensions for the kernel. Opaque type with the following fields: - `x` - The X dimension of the @@ -3140,61 +4786,128 @@ cdef class cudaStreamAttrValue(cudaLaunchAttributeValue): `y` - The Y dimension of the cluster, in blocks. Must be a divisor of the grid Y dimension. - `z` - The Z dimension of the cluster, in blocks. Must be a divisor of the grid Z dimension. + + clusterSchedulingPolicyPreference : cudaClusterSchedulingPolicy Value of launch attribute cudaLaunchAttributeClusterSchedulingPolicyPreference. Cluster scheduling policy preference for the kernel. + + programmaticStreamSerializationAllowed : int Value of launch attribute cudaLaunchAttributeProgrammaticStreamSerialization. - programmaticEvent : anon_struct21 - Value of launch attribute cudaLaunchAttributeProgrammaticEvent. + + + programmaticEvent : anon_struct18 + Value of launch attribute cudaLaunchAttributeProgrammaticEvent with + the following fields: - `cudaEvent_t` event - Event to fire when + all blocks trigger it. - `int` flags; - Event record flags, see + cudaEventRecordWithFlags. Does not accept cudaEventRecordExternal. + - `int` triggerAtBlockStart - If this is set to non-0, each block + launch will automatically trigger the event. + + priority : int Value of launch attribute cudaLaunchAttributePriority. Execution priority of the kernel. + + memSyncDomainMap : cudaLaunchMemSyncDomainMap Value of launch attribute cudaLaunchAttributeMemSyncDomainMap. See - ::cudaLaunchMemSyncDomainMap. + cudaLaunchMemSyncDomainMap. + + memSyncDomain : cudaLaunchMemSyncDomain Value of launch attribute cudaLaunchAttributeMemSyncDomain. See cudaLaunchMemSyncDomain. - launchCompletionEvent : anon_struct22 - Value of launch attribute cudaLaunchAttributeLaunchCompletionEvent. - deviceUpdatableKernelNode : anon_struct23 + + + preferredClusterDim : anon_struct19 Value of launch attribute - cudaLaunchAttributeDeviceUpdatableKernelNode. + cudaLaunchAttributePreferredClusterDimension that represents the + desired preferred cluster dimensions for the kernel. Opaque type + with the following fields: - `x` - The X dimension of the preferred + cluster, in blocks. Must be a divisor of the grid X dimension, and + must be a multiple of the `x` field of + ::cudaLaunchAttributeValue::clusterDim. - `y` - The Y dimension + of the preferred cluster, in blocks. Must be a divisor of the grid + Y dimension, and must be a multiple of the `y` field of + ::cudaLaunchAttributeValue::clusterDim. - `z` - The Z dimension + of the preferred cluster, in blocks. Must be equal to the `z` field + of ::cudaLaunchAttributeValue::clusterDim. + + + launchCompletionEvent : anon_struct20 + Value of launch attribute cudaLaunchAttributeLaunchCompletionEvent + with the following fields: - `cudaEvent_t` event - Event to fire + when the last block launches. - `int` flags - Event record + flags, see cudaEventRecordWithFlags. Does not accept + cudaEventRecordExternal. + + + deviceUpdatableKernelNode : anon_struct21 + Value of launch attribute + cudaLaunchAttributeDeviceUpdatableKernelNode with the following + fields: - `int` deviceUpdatable - Whether or not the resulting + kernel node should be device-updatable. - + `cudaGraphDeviceNode_t` devNode - Returns a handle to pass to the + various device-side update functions. + + sharedMemCarveout : unsigned int Value of launch attribute cudaLaunchAttributePreferredSharedMemoryCarveout. + + nvlinkUtilCentricScheduling : unsigned int + Value of launch attribute + cudaLaunchAttributeNvlinkUtilCentricScheduling. + + + portableClusterSizeMode : cudaLaunchAttributePortableClusterMode + Value of launch attribute + cudaLaunchAttributePortableClusterSizeMode + + + sharedMemoryMode : cudaSharedMemoryMode + Value of launch attribute cudaLaunchAttributeSharedMemoryMode. See + cudaSharedMemoryMode for acceptable values. + + Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if True}} cdef class cudaKernelNodeAttrValue(cudaLaunchAttributeValue): """ - Launch attributes union; used as value field of - ::cudaLaunchAttribute + Launch attributes union; used as value field of cudaLaunchAttribute Attributes ---------- + pad : bytes + + accessPolicyWindow : cudaAccessPolicyWindow Value of launch attribute cudaLaunchAttributeAccessPolicyWindow. + + cooperative : int Value of launch attribute cudaLaunchAttributeCooperative. Nonzero indicates a cooperative kernel (see cudaLaunchCooperativeKernel). + + syncPolicy : cudaSynchronizationPolicy Value of launch attribute cudaLaunchAttributeSynchronizationPolicy. - ::cudaSynchronizationPolicy for work queued up in this stream. - clusterDim : anon_struct20 + cudaSynchronizationPolicy for work queued up in this stream. + + + clusterDim : anon_struct17 Value of launch attribute cudaLaunchAttributeClusterDimension that represents the desired cluster dimensions for the kernel. Opaque type with the following fields: - `x` - The X dimension of the @@ -3202,42 +4915,101 @@ cdef class cudaKernelNodeAttrValue(cudaLaunchAttributeValue): `y` - The Y dimension of the cluster, in blocks. Must be a divisor of the grid Y dimension. - `z` - The Z dimension of the cluster, in blocks. Must be a divisor of the grid Z dimension. + + clusterSchedulingPolicyPreference : cudaClusterSchedulingPolicy Value of launch attribute cudaLaunchAttributeClusterSchedulingPolicyPreference. Cluster scheduling policy preference for the kernel. + + programmaticStreamSerializationAllowed : int Value of launch attribute cudaLaunchAttributeProgrammaticStreamSerialization. - programmaticEvent : anon_struct21 - Value of launch attribute cudaLaunchAttributeProgrammaticEvent. + + + programmaticEvent : anon_struct18 + Value of launch attribute cudaLaunchAttributeProgrammaticEvent with + the following fields: - `cudaEvent_t` event - Event to fire when + all blocks trigger it. - `int` flags; - Event record flags, see + cudaEventRecordWithFlags. Does not accept cudaEventRecordExternal. + - `int` triggerAtBlockStart - If this is set to non-0, each block + launch will automatically trigger the event. + + priority : int Value of launch attribute cudaLaunchAttributePriority. Execution priority of the kernel. + + memSyncDomainMap : cudaLaunchMemSyncDomainMap Value of launch attribute cudaLaunchAttributeMemSyncDomainMap. See - ::cudaLaunchMemSyncDomainMap. + cudaLaunchMemSyncDomainMap. + + memSyncDomain : cudaLaunchMemSyncDomain Value of launch attribute cudaLaunchAttributeMemSyncDomain. See cudaLaunchMemSyncDomain. - launchCompletionEvent : anon_struct22 - Value of launch attribute cudaLaunchAttributeLaunchCompletionEvent. - deviceUpdatableKernelNode : anon_struct23 + + + preferredClusterDim : anon_struct19 Value of launch attribute - cudaLaunchAttributeDeviceUpdatableKernelNode. + cudaLaunchAttributePreferredClusterDimension that represents the + desired preferred cluster dimensions for the kernel. Opaque type + with the following fields: - `x` - The X dimension of the preferred + cluster, in blocks. Must be a divisor of the grid X dimension, and + must be a multiple of the `x` field of + ::cudaLaunchAttributeValue::clusterDim. - `y` - The Y dimension + of the preferred cluster, in blocks. Must be a divisor of the grid + Y dimension, and must be a multiple of the `y` field of + ::cudaLaunchAttributeValue::clusterDim. - `z` - The Z dimension + of the preferred cluster, in blocks. Must be equal to the `z` field + of ::cudaLaunchAttributeValue::clusterDim. + + + launchCompletionEvent : anon_struct20 + Value of launch attribute cudaLaunchAttributeLaunchCompletionEvent + with the following fields: - `cudaEvent_t` event - Event to fire + when the last block launches. - `int` flags - Event record + flags, see cudaEventRecordWithFlags. Does not accept + cudaEventRecordExternal. + + + deviceUpdatableKernelNode : anon_struct21 + Value of launch attribute + cudaLaunchAttributeDeviceUpdatableKernelNode with the following + fields: - `int` deviceUpdatable - Whether or not the resulting + kernel node should be device-updatable. - + `cudaGraphDeviceNode_t` devNode - Returns a handle to pass to the + various device-side update functions. + + sharedMemCarveout : unsigned int Value of launch attribute cudaLaunchAttributePreferredSharedMemoryCarveout. + + nvlinkUtilCentricScheduling : unsigned int + Value of launch attribute + cudaLaunchAttributeNvlinkUtilCentricScheduling. + + + portableClusterSizeMode : cudaLaunchAttributePortableClusterMode + Value of launch attribute + cudaLaunchAttributePortableClusterSizeMode + + + sharedMemoryMode : cudaSharedMemoryMode + Value of launch attribute cudaLaunchAttributeSharedMemoryMode. See + cudaSharedMemoryMode for acceptable values. + + Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if True}} cdef class cudaEglPlaneDesc(cudaEglPlaneDesc_st): """ @@ -3246,30 +5018,41 @@ cdef class cudaEglPlaneDesc(cudaEglPlaneDesc_st): Attributes ---------- + width : unsigned int Width of plane + + height : unsigned int Height of plane + + depth : unsigned int Depth of plane + + pitch : unsigned int Pitch of plane + + numChannels : unsigned int Number of channels for the plane + + channelDesc : cudaChannelFormatDesc Channel Format Descriptor - reserved : List[unsigned int] + + + reserved : list[unsigned int] Reserved for future use + Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if True}} cdef class cudaEglFrame(cudaEglFrame_st): """ @@ -3284,28 +5067,35 @@ cdef class cudaEglFrame(cudaEglFrame_st): Attributes ---------- - frame : anon_union10 - planeDesc : List[cudaEglPlaneDesc] + frame : anon_union12 + + + + planeDesc : list[cudaEglPlaneDesc] CUDA EGL Plane Descriptor cudaEglPlaneDesc + + planeCount : unsigned int Number of planes + + frameType : cudaEglFrameType Array or Pitch + + eglColorFormat : cudaEglColorFormat CUDA EGL Color Format + Methods ------- getPtr() Get memory address of class instance - """ pass -{{endif}} -{{if 'cudaStream_t' in found_types}} -cdef class cudaStream_t(cuda.CUstream): +cdef class cudaStream_t(driver.CUstream): """ CUDA stream @@ -3317,11 +5107,8 @@ cdef class cudaStream_t(cuda.CUstream): """ pass -{{endif}} - -{{if 'cudaEvent_t' in found_types}} -cdef class cudaEvent_t(cuda.CUevent): +cdef class cudaEvent_t(driver.CUevent): """ CUDA event types @@ -3333,11 +5120,8 @@ cdef class cudaEvent_t(cuda.CUevent): """ pass -{{endif}} -{{if 'cudaGraph_t' in found_types}} - -cdef class cudaGraph_t(cuda.CUgraph): +cdef class cudaGraph_t(driver.CUgraph): """ CUDA graph @@ -3349,11 +5133,8 @@ cdef class cudaGraph_t(cuda.CUgraph): """ pass -{{endif}} - -{{if 'cudaGraphNode_t' in found_types}} -cdef class cudaGraphNode_t(cuda.CUgraphNode): +cdef class cudaGraphNode_t(driver.CUgraphNode): """ CUDA graph node. @@ -3365,11 +5146,8 @@ cdef class cudaGraphNode_t(cuda.CUgraphNode): """ pass -{{endif}} -{{if 'cudaUserObject_t' in found_types}} - -cdef class cudaUserObject_t(cuda.CUuserObject): +cdef class cudaUserObject_t(driver.CUuserObject): """ CUDA user object for graphs @@ -3381,11 +5159,8 @@ cdef class cudaUserObject_t(cuda.CUuserObject): """ pass -{{endif}} - -{{if 'cudaFunction_t' in found_types}} -cdef class cudaFunction_t(cuda.CUfunction): +cdef class cudaFunction_t(driver.CUfunction): """ CUDA function @@ -3397,11 +5172,8 @@ cdef class cudaFunction_t(cuda.CUfunction): """ pass -{{endif}} -{{if 'cudaMemPool_t' in found_types}} - -cdef class cudaMemPool_t(cuda.CUmemoryPool): +cdef class cudaMemPool_t(driver.CUmemoryPool): """ CUDA memory pool @@ -3413,11 +5185,8 @@ cdef class cudaMemPool_t(cuda.CUmemoryPool): """ pass -{{endif}} - -{{if 'cudaGraphExec_t' in found_types}} -cdef class cudaGraphExec_t(cuda.CUgraphExec): +cdef class cudaGraphExec_t(driver.CUgraphExec): """ CUDA executable (launchable) graph @@ -3429,11 +5198,8 @@ cdef class cudaGraphExec_t(cuda.CUgraphExec): """ pass -{{endif}} -{{if True}} - -cdef class cudaEglStreamConnection(cuda.CUeglStreamConnection): +cdef class cudaEglStreamConnection(driver.CUeglStreamConnection): """ CUDA EGLSream Connection @@ -3445,9 +5211,6 @@ cdef class cudaEglStreamConnection(cuda.CUeglStreamConnection): """ pass -{{endif}} - -{{if 'cudaGraphConditionalHandle' in found_types}} cdef class cudaGraphConditionalHandle: """ @@ -3460,11 +5223,20 @@ cdef class cudaGraphConditionalHandle: Get memory address of class instance """ - cdef ccudart.cudaGraphConditionalHandle __val - cdef ccudart.cudaGraphConditionalHandle* _ptr -{{endif}} + cdef cyruntime.cudaGraphConditionalHandle _pvt_val + cdef cyruntime.cudaGraphConditionalHandle* _pvt_ptr -{{if 'cudaSurfaceObject_t' in found_types}} +cdef class cudaLogIterator: + """ + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + cdef cyruntime.cudaLogIterator _pvt_val + cdef cyruntime.cudaLogIterator* _pvt_ptr cdef class cudaSurfaceObject_t: """ @@ -3477,11 +5249,8 @@ cdef class cudaSurfaceObject_t: Get memory address of class instance """ - cdef ccudart.cudaSurfaceObject_t __val - cdef ccudart.cudaSurfaceObject_t* _ptr -{{endif}} - -{{if 'cudaTextureObject_t' in found_types}} + cdef cyruntime.cudaSurfaceObject_t _pvt_val + cdef cyruntime.cudaSurfaceObject_t* _pvt_ptr cdef class cudaTextureObject_t: """ @@ -3494,11 +5263,8 @@ cdef class cudaTextureObject_t: Get memory address of class instance """ - cdef ccudart.cudaTextureObject_t __val - cdef ccudart.cudaTextureObject_t* _ptr -{{endif}} - -{{if True}} + cdef cyruntime.cudaTextureObject_t _pvt_val + cdef cyruntime.cudaTextureObject_t* _pvt_ptr cdef class GLenum: """ @@ -3509,11 +5275,8 @@ cdef class GLenum: Get memory address of class instance """ - cdef ccudart.GLenum __val - cdef ccudart.GLenum* _ptr -{{endif}} - -{{if True}} + cdef cyruntime.GLenum _pvt_val + cdef cyruntime.GLenum* _pvt_ptr cdef class GLuint: """ @@ -3524,11 +5287,8 @@ cdef class GLuint: Get memory address of class instance """ - cdef ccudart.GLuint __val - cdef ccudart.GLuint* _ptr -{{endif}} - -{{if True}} + cdef cyruntime.GLuint _pvt_val + cdef cyruntime.GLuint* _pvt_ptr cdef class EGLint: """ @@ -3539,11 +5299,8 @@ cdef class EGLint: Get memory address of class instance """ - cdef ccudart.EGLint __val - cdef ccudart.EGLint* _ptr -{{endif}} - -{{if True}} + cdef cyruntime.EGLint _pvt_val + cdef cyruntime.EGLint* _pvt_ptr cdef class VdpDevice: """ @@ -3554,11 +5311,8 @@ cdef class VdpDevice: Get memory address of class instance """ - cdef ccudart.VdpDevice __val - cdef ccudart.VdpDevice* _ptr -{{endif}} - -{{if True}} + cdef cyruntime.VdpDevice _pvt_val + cdef cyruntime.VdpDevice* _pvt_ptr cdef class VdpGetProcAddress: """ @@ -3569,11 +5323,8 @@ cdef class VdpGetProcAddress: Get memory address of class instance """ - cdef ccudart.VdpGetProcAddress __val - cdef ccudart.VdpGetProcAddress* _ptr -{{endif}} - -{{if True}} + cdef cyruntime.VdpGetProcAddress _pvt_val + cdef cyruntime.VdpGetProcAddress* _pvt_ptr cdef class VdpVideoSurface: """ @@ -3584,11 +5335,8 @@ cdef class VdpVideoSurface: Get memory address of class instance """ - cdef ccudart.VdpVideoSurface __val - cdef ccudart.VdpVideoSurface* _ptr -{{endif}} - -{{if True}} + cdef cyruntime.VdpVideoSurface _pvt_val + cdef cyruntime.VdpVideoSurface* _pvt_ptr cdef class VdpOutputSurface: """ @@ -3599,6 +5347,5 @@ cdef class VdpOutputSurface: Get memory address of class instance """ - cdef ccudart.VdpOutputSurface __val - cdef ccudart.VdpOutputSurface* _ptr -{{endif}} + cdef cyruntime.VdpOutputSurface _pvt_val + cdef cyruntime.VdpOutputSurface* _pvt_ptr diff --git a/cuda/cudart.pyx.in b/cuda_bindings/cuda/bindings/runtime.pyx similarity index 53% rename from cuda/cudart.pyx.in rename to cuda_bindings/cuda/bindings/runtime.pyx index 75583c12b23..6e11bdfc932 100644 --- a/cuda/cudart.pyx.in +++ b/cuda_bindings/cuda/bindings/runtime.pyx @@ -1,23 +1,26 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. -# -# Please refer to the NVIDIA end user license agreement (EULA) associated -# with this source code for terms and conditions that govern your use of -# this software. Any use, reproduction, disclosure, or distribution of -# this software and related documentation outside the terms of the EULA -# is strictly prohibited. -from typing import List, Tuple, Any, Optional -from enum import IntEnum +# SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +# This code was automatically generated with version 13.3.0. Do not modify it directly. +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=783d27cfa66fa4f5818edcf88141aeb96dcc0e27e73a77a36571f82f30f3bb47 +from typing import Any, Optional import cython import ctypes -from libc.stdlib cimport calloc, free +from libc.stdlib cimport calloc, malloc, free from libc cimport string -from libc.stdint cimport int32_t, uint32_t, int64_t, uint64_t +from libc.stdint cimport int32_t, uint32_t, int64_t, uint64_t, uintptr_t from libc.stddef cimport wchar_t from libc.limits cimport CHAR_MIN from libcpp.vector cimport vector from cpython.buffer cimport PyObject_CheckBuffer, PyObject_GetBuffer, PyBuffer_Release, PyBUF_SIMPLE, PyBUF_ANY_CONTIGUOUS from cpython.bytes cimport PyBytes_FromStringAndSize -import cuda.cuda +from ._internal._fast_enum import FastEnum as _FastEnum +import cuda.bindings.driver +from libcpp.map cimport map + +import cuda.bindings.driver as _driver +_driver = _driver.__dict__ +include "_lib/utils.pxi" ctypedef unsigned long long signed_char_ptr ctypedef unsigned long long unsigned_char_ptr @@ -38,200 +41,194 @@ ctypedef unsigned long long unsigned_ptr ctypedef unsigned long long unsigned_long_long_ptr ctypedef unsigned long long long_long_ptr ctypedef unsigned long long size_t_ptr +ctypedef unsigned long long long_ptr ctypedef unsigned long long float_ptr ctypedef unsigned long long double_ptr ctypedef unsigned long long void_ptr #: Default page-locked allocation flag -cudaHostAllocDefault = ccudart.cudaHostAllocDefault +cudaHostAllocDefault = cyruntime.cudaHostAllocDefault #: Pinned memory accessible by all CUDA contexts -cudaHostAllocPortable = ccudart.cudaHostAllocPortable +cudaHostAllocPortable = cyruntime.cudaHostAllocPortable #: Map allocation into device space -cudaHostAllocMapped = ccudart.cudaHostAllocMapped +cudaHostAllocMapped = cyruntime.cudaHostAllocMapped #: Write-combined memory -cudaHostAllocWriteCombined = ccudart.cudaHostAllocWriteCombined +cudaHostAllocWriteCombined = cyruntime.cudaHostAllocWriteCombined #: Default host memory registration flag -cudaHostRegisterDefault = ccudart.cudaHostRegisterDefault +cudaHostRegisterDefault = cyruntime.cudaHostRegisterDefault #: Pinned memory accessible by all CUDA contexts -cudaHostRegisterPortable = ccudart.cudaHostRegisterPortable +cudaHostRegisterPortable = cyruntime.cudaHostRegisterPortable #: Map registered memory into device space -cudaHostRegisterMapped = ccudart.cudaHostRegisterMapped +cudaHostRegisterMapped = cyruntime.cudaHostRegisterMapped #: Memory-mapped I/O space -cudaHostRegisterIoMemory = ccudart.cudaHostRegisterIoMemory +cudaHostRegisterIoMemory = cyruntime.cudaHostRegisterIoMemory #: Memory-mapped read-only -cudaHostRegisterReadOnly = ccudart.cudaHostRegisterReadOnly +cudaHostRegisterReadOnly = cyruntime.cudaHostRegisterReadOnly #: Default peer addressing enable flag -cudaPeerAccessDefault = ccudart.cudaPeerAccessDefault +cudaPeerAccessDefault = cyruntime.cudaPeerAccessDefault #: Default stream flag -cudaStreamDefault = ccudart.cudaStreamDefault +cudaStreamDefault = cyruntime.cudaStreamDefault #: Stream does not synchronize with stream 0 (the NULL stream) -cudaStreamNonBlocking = ccudart.cudaStreamNonBlocking +cudaStreamNonBlocking = cyruntime.cudaStreamNonBlocking #: Legacy stream handle #: -#: Stream handle that can be passed as a cudaStream_t to use an implicit -#: stream with legacy synchronization behavior. +#: Stream handle that can be passed as a :py:obj:`~.cudaStream_t` to use an +#: implicit stream with legacy synchronization behavior. #: #: See details of the \link_sync_behavior -cudaStreamLegacy = ccudart.cudaStreamLegacy +cudaStreamLegacy = cyruntime.cudaStreamLegacy #: Per-thread stream handle #: -#: Stream handle that can be passed as a cudaStream_t to use an implicit -#: stream with per-thread synchronization behavior. +#: Stream handle that can be passed as a :py:obj:`~.cudaStream_t` to use an +#: implicit stream with per-thread synchronization behavior. #: #: See details of the \link_sync_behavior -cudaStreamPerThread = ccudart.cudaStreamPerThread +cudaStreamPerThread = cyruntime.cudaStreamPerThread #: Default event flag -cudaEventDefault = ccudart.cudaEventDefault +cudaEventDefault = cyruntime.cudaEventDefault #: Event uses blocking synchronization -cudaEventBlockingSync = ccudart.cudaEventBlockingSync +cudaEventBlockingSync = cyruntime.cudaEventBlockingSync #: Event will not record timing data -cudaEventDisableTiming = ccudart.cudaEventDisableTiming +cudaEventDisableTiming = cyruntime.cudaEventDisableTiming #: Event is suitable for interprocess use. cudaEventDisableTiming must be #: set -cudaEventInterprocess = ccudart.cudaEventInterprocess +cudaEventInterprocess = cyruntime.cudaEventInterprocess #: Default event record flag -cudaEventRecordDefault = ccudart.cudaEventRecordDefault +cudaEventRecordDefault = cyruntime.cudaEventRecordDefault #: Event is captured in the graph as an external event node when performing #: stream capture -cudaEventRecordExternal = ccudart.cudaEventRecordExternal +cudaEventRecordExternal = cyruntime.cudaEventRecordExternal #: Default event wait flag -cudaEventWaitDefault = ccudart.cudaEventWaitDefault +cudaEventWaitDefault = cyruntime.cudaEventWaitDefault #: Event is captured in the graph as an external event node when performing #: stream capture -cudaEventWaitExternal = ccudart.cudaEventWaitExternal +cudaEventWaitExternal = cyruntime.cudaEventWaitExternal #: Device flag - Automatic scheduling -cudaDeviceScheduleAuto = ccudart.cudaDeviceScheduleAuto +cudaDeviceScheduleAuto = cyruntime.cudaDeviceScheduleAuto #: Device flag - Spin default scheduling -cudaDeviceScheduleSpin = ccudart.cudaDeviceScheduleSpin +cudaDeviceScheduleSpin = cyruntime.cudaDeviceScheduleSpin #: Device flag - Yield default scheduling -cudaDeviceScheduleYield = ccudart.cudaDeviceScheduleYield +cudaDeviceScheduleYield = cyruntime.cudaDeviceScheduleYield #: Device flag - Use blocking synchronization -cudaDeviceScheduleBlockingSync = ccudart.cudaDeviceScheduleBlockingSync +cudaDeviceScheduleBlockingSync = cyruntime.cudaDeviceScheduleBlockingSync -#: Device flag - Use blocking synchronization [Deprecated] -cudaDeviceBlockingSync = ccudart.cudaDeviceBlockingSync +#: Device flag - Use blocking synchronization +#: [Deprecated] +cudaDeviceBlockingSync = cyruntime.cudaDeviceBlockingSync #: Device schedule flags mask -cudaDeviceScheduleMask = ccudart.cudaDeviceScheduleMask +cudaDeviceScheduleMask = cyruntime.cudaDeviceScheduleMask #: Device flag - Support mapped pinned allocations -cudaDeviceMapHost = ccudart.cudaDeviceMapHost +cudaDeviceMapHost = cyruntime.cudaDeviceMapHost #: Device flag - Keep local memory allocation after launch -cudaDeviceLmemResizeToMax = ccudart.cudaDeviceLmemResizeToMax +cudaDeviceLmemResizeToMax = cyruntime.cudaDeviceLmemResizeToMax #: Device flag - Ensure synchronous memory operations on this context will #: synchronize -cudaDeviceSyncMemops = ccudart.cudaDeviceSyncMemops +cudaDeviceSyncMemops = cyruntime.cudaDeviceSyncMemops #: Device flags mask -cudaDeviceMask = ccudart.cudaDeviceMask +cudaDeviceMask = cyruntime.cudaDeviceMask #: Default CUDA array allocation flag -cudaArrayDefault = ccudart.cudaArrayDefault +cudaArrayDefault = cyruntime.cudaArrayDefault #: Must be set in cudaMalloc3DArray to create a layered CUDA array -cudaArrayLayered = ccudart.cudaArrayLayered +cudaArrayLayered = cyruntime.cudaArrayLayered #: Must be set in cudaMallocArray or cudaMalloc3DArray in order to bind #: surfaces to the CUDA array -cudaArraySurfaceLoadStore = ccudart.cudaArraySurfaceLoadStore +cudaArraySurfaceLoadStore = cyruntime.cudaArraySurfaceLoadStore #: Must be set in cudaMalloc3DArray to create a cubemap CUDA array -cudaArrayCubemap = ccudart.cudaArrayCubemap +cudaArrayCubemap = cyruntime.cudaArrayCubemap #: Must be set in cudaMallocArray or cudaMalloc3DArray in order to perform #: texture gather operations on the CUDA array -cudaArrayTextureGather = ccudart.cudaArrayTextureGather +cudaArrayTextureGather = cyruntime.cudaArrayTextureGather #: Must be set in cudaExternalMemoryGetMappedMipmappedArray if the #: mipmapped array is used as a color target in a graphics API -cudaArrayColorAttachment = ccudart.cudaArrayColorAttachment +cudaArrayColorAttachment = cyruntime.cudaArrayColorAttachment #: Must be set in cudaMallocArray, cudaMalloc3DArray or #: cudaMallocMipmappedArray in order to create a sparse CUDA array or CUDA #: mipmapped array -cudaArraySparse = ccudart.cudaArraySparse +cudaArraySparse = cyruntime.cudaArraySparse #: Must be set in cudaMallocArray, cudaMalloc3DArray or #: cudaMallocMipmappedArray in order to create a deferred mapping CUDA #: array or CUDA mipmapped array -cudaArrayDeferredMapping = ccudart.cudaArrayDeferredMapping +cudaArrayDeferredMapping = cyruntime.cudaArrayDeferredMapping #: Automatically enable peer access between remote devices as needed -cudaIpcMemLazyEnablePeerAccess = ccudart.cudaIpcMemLazyEnablePeerAccess +cudaIpcMemLazyEnablePeerAccess = cyruntime.cudaIpcMemLazyEnablePeerAccess #: Memory can be accessed by any stream on any device -cudaMemAttachGlobal = ccudart.cudaMemAttachGlobal +cudaMemAttachGlobal = cyruntime.cudaMemAttachGlobal #: Memory cannot be accessed by any stream on any device -cudaMemAttachHost = ccudart.cudaMemAttachHost +cudaMemAttachHost = cyruntime.cudaMemAttachHost #: Memory can only be accessed by a single stream on the associated device -cudaMemAttachSingle = ccudart.cudaMemAttachSingle +cudaMemAttachSingle = cyruntime.cudaMemAttachSingle #: Default behavior -cudaOccupancyDefault = ccudart.cudaOccupancyDefault +cudaOccupancyDefault = cyruntime.cudaOccupancyDefault #: Assume global caching is enabled and cannot be automatically turned off -cudaOccupancyDisableCachingOverride = ccudart.cudaOccupancyDisableCachingOverride +cudaOccupancyDisableCachingOverride = cyruntime.cudaOccupancyDisableCachingOverride #: Device id that represents the CPU -cudaCpuDeviceId = ccudart.cudaCpuDeviceId +cudaCpuDeviceId = cyruntime.cudaCpuDeviceId #: Device id that represents an invalid device -cudaInvalidDeviceId = ccudart.cudaInvalidDeviceId +cudaInvalidDeviceId = cyruntime.cudaInvalidDeviceId #: Tell the CUDA runtime that DeviceFlags is being set in cudaInitDevice #: call -cudaInitDeviceFlagsAreValid = ccudart.cudaInitDeviceFlagsAreValid - -#: If set, each kernel launched as part of -#: :py:obj:`~.cudaLaunchCooperativeKernelMultiDevice` only waits for prior -#: work in the stream corresponding to that GPU to complete before the -#: kernel begins execution. -cudaCooperativeLaunchMultiDeviceNoPreSync = ccudart.cudaCooperativeLaunchMultiDeviceNoPreSync - -#: If set, any subsequent work pushed in a stream that participated in a -#: call to :py:obj:`~.cudaLaunchCooperativeKernelMultiDevice` will only -#: wait for the kernel launched on the GPU corresponding to that stream to -#: complete before it begins execution. -cudaCooperativeLaunchMultiDeviceNoPostSync = ccudart.cudaCooperativeLaunchMultiDeviceNoPostSync +cudaInitDeviceFlagsAreValid = cyruntime.cudaInitDeviceFlagsAreValid #: Indicates that the layered sparse CUDA array or CUDA mipmapped array has #: a single mip tail region for all layers -cudaArraySparsePropertiesSingleMipTail = ccudart.cudaArraySparsePropertiesSingleMipTail +cudaArraySparsePropertiesSingleMipTail = cyruntime.cudaArraySparsePropertiesSingleMipTail + +#: This flag, if set, indicates that the memory will be used as a buffer +#: for hardware accelerated decompression. +cudaMemPoolCreateUsageHwDecompress = cyruntime.cudaMemPoolCreateUsageHwDecompress #: CUDA IPC Handle Size -CUDA_IPC_HANDLE_SIZE = ccudart.CUDA_IPC_HANDLE_SIZE +CUDA_IPC_HANDLE_SIZE = cyruntime.CUDA_IPC_HANDLE_SIZE #: Indicates that the external memory object is a dedicated resource -cudaExternalMemoryDedicated = ccudart.cudaExternalMemoryDedicated +cudaExternalMemoryDedicated = cyruntime.cudaExternalMemoryDedicated #: When the /p flags parameter of #: :py:obj:`~.cudaExternalSemaphoreSignalParams` contains this flag, it @@ -241,7 +238,7 @@ cudaExternalMemoryDedicated = ccudart.cudaExternalMemoryDedicated #: :py:obj:`~.cudaExternalMemoryHandleTypeNvSciBuf`, which otherwise are #: performed by default to ensure data coherency with other importers of #: the same NvSciBuf memory objects. -cudaExternalSemaphoreSignalSkipNvSciBufMemSync = ccudart.cudaExternalSemaphoreSignalSkipNvSciBufMemSync +cudaExternalSemaphoreSignalSkipNvSciBufMemSync = cyruntime.cudaExternalSemaphoreSignalSkipNvSciBufMemSync #: When the /p flags parameter of #: :py:obj:`~.cudaExternalSemaphoreWaitParams` contains this flag, it @@ -251,7685 +248,12022 @@ cudaExternalSemaphoreSignalSkipNvSciBufMemSync = ccudart.cudaExternalSemaphoreSi #: :py:obj:`~.cudaExternalMemoryHandleTypeNvSciBuf`, which otherwise are #: performed by default to ensure data coherency with other importers of #: the same NvSciBuf memory objects. -cudaExternalSemaphoreWaitSkipNvSciBufMemSync = ccudart.cudaExternalSemaphoreWaitSkipNvSciBufMemSync +cudaExternalSemaphoreWaitSkipNvSciBufMemSync = cyruntime.cudaExternalSemaphoreWaitSkipNvSciBufMemSync #: When /p flags of :py:obj:`~.cudaDeviceGetNvSciSyncAttributes` is set to #: this, it indicates that application need signaler specific NvSciSyncAttr #: to be filled by :py:obj:`~.cudaDeviceGetNvSciSyncAttributes`. -cudaNvSciSyncAttrSignal = ccudart.cudaNvSciSyncAttrSignal +cudaNvSciSyncAttrSignal = cyruntime.cudaNvSciSyncAttrSignal #: When /p flags of :py:obj:`~.cudaDeviceGetNvSciSyncAttributes` is set to #: this, it indicates that application need waiter specific NvSciSyncAttr #: to be filled by :py:obj:`~.cudaDeviceGetNvSciSyncAttributes`. -cudaNvSciSyncAttrWait = ccudart.cudaNvSciSyncAttrWait +cudaNvSciSyncAttrWait = cyruntime.cudaNvSciSyncAttrWait #: This port activates when the kernel has finished executing. -cudaGraphKernelNodePortDefault = ccudart.cudaGraphKernelNodePortDefault +cudaGraphKernelNodePortDefault = cyruntime.cudaGraphKernelNodePortDefault #: This port activates when all blocks of the kernel have performed #: cudaTriggerProgrammaticLaunchCompletion() or have terminated. It must be #: used with edge type :py:obj:`~.cudaGraphDependencyTypeProgrammatic`. See #: also :py:obj:`~.cudaLaunchAttributeProgrammaticEvent`. -cudaGraphKernelNodePortProgrammatic = ccudart.cudaGraphKernelNodePortProgrammatic +cudaGraphKernelNodePortProgrammatic = cyruntime.cudaGraphKernelNodePortProgrammatic #: This port activates when all blocks of the kernel have begun execution. #: See also :py:obj:`~.cudaLaunchAttributeLaunchCompletionEvent`. -cudaGraphKernelNodePortLaunchCompletion = ccudart.cudaGraphKernelNodePortLaunchCompletion +cudaGraphKernelNodePortLaunchCompletion = cyruntime.cudaGraphKernelNodePortLaunchCompletion -cudaStreamAttributeAccessPolicyWindow = ccudart.cudaStreamAttributeAccessPolicyWindow +cudaStreamAttributeAccessPolicyWindow = cyruntime.cudaStreamAttributeAccessPolicyWindow -cudaStreamAttributeSynchronizationPolicy = ccudart.cudaStreamAttributeSynchronizationPolicy +cudaStreamAttributeSynchronizationPolicy = cyruntime.cudaStreamAttributeSynchronizationPolicy -cudaStreamAttributeMemSyncDomainMap = ccudart.cudaStreamAttributeMemSyncDomainMap +cudaStreamAttributeMemSyncDomainMap = cyruntime.cudaStreamAttributeMemSyncDomainMap -cudaStreamAttributeMemSyncDomain = ccudart.cudaStreamAttributeMemSyncDomain +cudaStreamAttributeMemSyncDomain = cyruntime.cudaStreamAttributeMemSyncDomain -cudaStreamAttributePriority = ccudart.cudaStreamAttributePriority +cudaStreamAttributePriority = cyruntime.cudaStreamAttributePriority -cudaKernelNodeAttributeAccessPolicyWindow = ccudart.cudaKernelNodeAttributeAccessPolicyWindow +cudaKernelNodeAttributeAccessPolicyWindow = cyruntime.cudaKernelNodeAttributeAccessPolicyWindow -cudaKernelNodeAttributeCooperative = ccudart.cudaKernelNodeAttributeCooperative +cudaKernelNodeAttributeCooperative = cyruntime.cudaKernelNodeAttributeCooperative -cudaKernelNodeAttributePriority = ccudart.cudaKernelNodeAttributePriority +cudaKernelNodeAttributePriority = cyruntime.cudaKernelNodeAttributePriority -cudaKernelNodeAttributeClusterDimension = ccudart.cudaKernelNodeAttributeClusterDimension +cudaKernelNodeAttributeClusterDimension = cyruntime.cudaKernelNodeAttributeClusterDimension -cudaKernelNodeAttributeClusterSchedulingPolicyPreference = ccudart.cudaKernelNodeAttributeClusterSchedulingPolicyPreference +cudaKernelNodeAttributeClusterSchedulingPolicyPreference = cyruntime.cudaKernelNodeAttributeClusterSchedulingPolicyPreference -cudaKernelNodeAttributeMemSyncDomainMap = ccudart.cudaKernelNodeAttributeMemSyncDomainMap +cudaKernelNodeAttributeMemSyncDomainMap = cyruntime.cudaKernelNodeAttributeMemSyncDomainMap -cudaKernelNodeAttributeMemSyncDomain = ccudart.cudaKernelNodeAttributeMemSyncDomain +cudaKernelNodeAttributeMemSyncDomain = cyruntime.cudaKernelNodeAttributeMemSyncDomain -cudaKernelNodeAttributePreferredSharedMemoryCarveout = ccudart.cudaKernelNodeAttributePreferredSharedMemoryCarveout +cudaKernelNodeAttributePreferredSharedMemoryCarveout = cyruntime.cudaKernelNodeAttributePreferredSharedMemoryCarveout -cudaKernelNodeAttributeDeviceUpdatableKernelNode = ccudart.cudaKernelNodeAttributeDeviceUpdatableKernelNode +cudaKernelNodeAttributeDeviceUpdatableKernelNode = cyruntime.cudaKernelNodeAttributeDeviceUpdatableKernelNode -cudaSurfaceType1D = ccudart.cudaSurfaceType1D +cudaKernelNodeAttributeNvlinkUtilCentricScheduling = cyruntime.cudaKernelNodeAttributeNvlinkUtilCentricScheduling -cudaSurfaceType2D = ccudart.cudaSurfaceType2D +cudaSurfaceType1D = cyruntime.cudaSurfaceType1D -cudaSurfaceType3D = ccudart.cudaSurfaceType3D +cudaSurfaceType2D = cyruntime.cudaSurfaceType2D -cudaSurfaceTypeCubemap = ccudart.cudaSurfaceTypeCubemap +cudaSurfaceType3D = cyruntime.cudaSurfaceType3D -cudaSurfaceType1DLayered = ccudart.cudaSurfaceType1DLayered +cudaSurfaceTypeCubemap = cyruntime.cudaSurfaceTypeCubemap -cudaSurfaceType2DLayered = ccudart.cudaSurfaceType2DLayered +cudaSurfaceType1DLayered = cyruntime.cudaSurfaceType1DLayered -cudaSurfaceTypeCubemapLayered = ccudart.cudaSurfaceTypeCubemapLayered +cudaSurfaceType2DLayered = cyruntime.cudaSurfaceType2DLayered -cudaTextureType1D = ccudart.cudaTextureType1D +cudaSurfaceTypeCubemapLayered = cyruntime.cudaSurfaceTypeCubemapLayered -cudaTextureType2D = ccudart.cudaTextureType2D +cudaTextureType1D = cyruntime.cudaTextureType1D -cudaTextureType3D = ccudart.cudaTextureType3D +cudaTextureType2D = cyruntime.cudaTextureType2D -cudaTextureTypeCubemap = ccudart.cudaTextureTypeCubemap +cudaTextureType3D = cyruntime.cudaTextureType3D -cudaTextureType1DLayered = ccudart.cudaTextureType1DLayered +cudaTextureTypeCubemap = cyruntime.cudaTextureTypeCubemap -cudaTextureType2DLayered = ccudart.cudaTextureType2DLayered +cudaTextureType1DLayered = cyruntime.cudaTextureType1DLayered -cudaTextureTypeCubemapLayered = ccudart.cudaTextureTypeCubemapLayered +cudaTextureType2DLayered = cyruntime.cudaTextureType2DLayered + +cudaTextureTypeCubemapLayered = cyruntime.cudaTextureTypeCubemapLayered #: CUDA Runtime API Version -CUDART_VERSION = ccudart.CUDART_VERSION +CUDART_VERSION = cyruntime.CUDART_VERSION -__CUDART_API_VERSION = ccudart.__CUDART_API_VERSION +__CUDART_API_VERSION = cyruntime.__CUDART_API_VERSION #: Maximum number of planes per frame -CUDA_EGL_MAX_PLANES = ccudart.CUDA_EGL_MAX_PLANES - -{{if 'cudaError' in found_types}} +CUDA_EGL_MAX_PLANES = cyruntime.CUDA_EGL_MAX_PLANES -class cudaError_t(IntEnum): +class cudaError_t(_FastEnum): """ impl_private CUDA error types """ - {{if 'cudaSuccess' in found_values}} - - #: The API call returned with no errors. In the case of query calls, - #: this also means that the operation being queried is complete (see - #: :py:obj:`~.cudaEventQuery()` and :py:obj:`~.cudaStreamQuery()`). - cudaSuccess = ccudart.cudaError.cudaSuccess{{endif}} - {{if 'cudaErrorInvalidValue' in found_values}} - - #: This indicates that one or more of the parameters passed to the API - #: call is not within an acceptable range of values. - cudaErrorInvalidValue = ccudart.cudaError.cudaErrorInvalidValue{{endif}} - {{if 'cudaErrorMemoryAllocation' in found_values}} - - #: The API call failed because it was unable to allocate enough memory - #: or other resources to perform the requested operation. - cudaErrorMemoryAllocation = ccudart.cudaError.cudaErrorMemoryAllocation{{endif}} - {{if 'cudaErrorInitializationError' in found_values}} - - #: The API call failed because the CUDA driver and runtime could not be - #: initialized. - cudaErrorInitializationError = ccudart.cudaError.cudaErrorInitializationError{{endif}} - {{if 'cudaErrorCudartUnloading' in found_values}} - - #: This indicates that a CUDA Runtime API call cannot be executed - #: because it is being called during process shut down, at a point in - #: time after CUDA driver has been unloaded. - cudaErrorCudartUnloading = ccudart.cudaError.cudaErrorCudartUnloading{{endif}} - {{if 'cudaErrorProfilerDisabled' in found_values}} - - #: This indicates profiler is not initialized for this run. This can - #: happen when the application is running with external profiling tools - #: like visual profiler. - cudaErrorProfilerDisabled = ccudart.cudaError.cudaErrorProfilerDisabled{{endif}} - {{if 'cudaErrorProfilerNotInitialized' in found_values}} - - #: [Deprecated] - cudaErrorProfilerNotInitialized = ccudart.cudaError.cudaErrorProfilerNotInitialized{{endif}} - {{if 'cudaErrorProfilerAlreadyStarted' in found_values}} - - #: [Deprecated] - cudaErrorProfilerAlreadyStarted = ccudart.cudaError.cudaErrorProfilerAlreadyStarted{{endif}} - {{if 'cudaErrorProfilerAlreadyStopped' in found_values}} - - #: [Deprecated] - cudaErrorProfilerAlreadyStopped = ccudart.cudaError.cudaErrorProfilerAlreadyStopped{{endif}} - {{if 'cudaErrorInvalidConfiguration' in found_values}} - - #: This indicates that a kernel launch is requesting resources that can - #: never be satisfied by the current device. Requesting more shared - #: memory per block than the device supports will trigger this error, - #: as will requesting too many threads or blocks. See - #: :py:obj:`~.cudaDeviceProp` for more device limitations. - cudaErrorInvalidConfiguration = ccudart.cudaError.cudaErrorInvalidConfiguration{{endif}} - {{if 'cudaErrorInvalidPitchValue' in found_values}} - - #: This indicates that one or more of the pitch-related parameters - #: passed to the API call is not within the acceptable range for pitch. - cudaErrorInvalidPitchValue = ccudart.cudaError.cudaErrorInvalidPitchValue{{endif}} - {{if 'cudaErrorInvalidSymbol' in found_values}} - - #: This indicates that the symbol name/identifier passed to the API - #: call is not a valid name or identifier. - cudaErrorInvalidSymbol = ccudart.cudaError.cudaErrorInvalidSymbol{{endif}} - {{if 'cudaErrorInvalidHostPointer' in found_values}} - - #: This indicates that at least one host pointer passed to the API call - #: is not a valid host pointer. [Deprecated] - cudaErrorInvalidHostPointer = ccudart.cudaError.cudaErrorInvalidHostPointer{{endif}} - {{if 'cudaErrorInvalidDevicePointer' in found_values}} - - #: This indicates that at least one device pointer passed to the API - #: call is not a valid device pointer. [Deprecated] - cudaErrorInvalidDevicePointer = ccudart.cudaError.cudaErrorInvalidDevicePointer{{endif}} - {{if 'cudaErrorInvalidTexture' in found_values}} - - #: This indicates that the texture passed to the API call is not a - #: valid texture. - cudaErrorInvalidTexture = ccudart.cudaError.cudaErrorInvalidTexture{{endif}} - {{if 'cudaErrorInvalidTextureBinding' in found_values}} - - #: This indicates that the texture binding is not valid. This occurs if - #: you call :py:obj:`~.cudaGetTextureAlignmentOffset()` with an unbound - #: texture. - cudaErrorInvalidTextureBinding = ccudart.cudaError.cudaErrorInvalidTextureBinding{{endif}} - {{if 'cudaErrorInvalidChannelDescriptor' in found_values}} - - #: This indicates that the channel descriptor passed to the API call is - #: not valid. This occurs if the format is not one of the formats - #: specified by :py:obj:`~.cudaChannelFormatKind`, or if one of the - #: dimensions is invalid. - cudaErrorInvalidChannelDescriptor = ccudart.cudaError.cudaErrorInvalidChannelDescriptor{{endif}} - {{if 'cudaErrorInvalidMemcpyDirection' in found_values}} - - #: This indicates that the direction of the memcpy passed to the API - #: call is not one of the types specified by - #: :py:obj:`~.cudaMemcpyKind`. - cudaErrorInvalidMemcpyDirection = ccudart.cudaError.cudaErrorInvalidMemcpyDirection{{endif}} - {{if 'cudaErrorAddressOfConstant' in found_values}} - - #: This indicated that the user has taken the address of a constant - #: variable, which was forbidden up until the CUDA 3.1 release. - #: [Deprecated] - cudaErrorAddressOfConstant = ccudart.cudaError.cudaErrorAddressOfConstant{{endif}} - {{if 'cudaErrorTextureFetchFailed' in found_values}} - - #: This indicated that a texture fetch was not able to be performed. - #: This was previously used for device emulation of texture operations. - #: [Deprecated] - cudaErrorTextureFetchFailed = ccudart.cudaError.cudaErrorTextureFetchFailed{{endif}} - {{if 'cudaErrorTextureNotBound' in found_values}} - - #: This indicated that a texture was not bound for access. This was - #: previously used for device emulation of texture operations. - #: [Deprecated] - cudaErrorTextureNotBound = ccudart.cudaError.cudaErrorTextureNotBound{{endif}} - {{if 'cudaErrorSynchronizationError' in found_values}} - - #: This indicated that a synchronization operation had failed. This was - #: previously used for some device emulation functions. [Deprecated] - cudaErrorSynchronizationError = ccudart.cudaError.cudaErrorSynchronizationError{{endif}} - {{if 'cudaErrorInvalidFilterSetting' in found_values}} - - #: This indicates that a non-float texture was being accessed with - #: linear filtering. This is not supported by CUDA. - cudaErrorInvalidFilterSetting = ccudart.cudaError.cudaErrorInvalidFilterSetting{{endif}} - {{if 'cudaErrorInvalidNormSetting' in found_values}} - - #: This indicates that an attempt was made to read a non-float texture - #: as a normalized float. This is not supported by CUDA. - cudaErrorInvalidNormSetting = ccudart.cudaError.cudaErrorInvalidNormSetting{{endif}} - {{if 'cudaErrorMixedDeviceExecution' in found_values}} - - #: Mixing of device and device emulation code was not allowed. - #: [Deprecated] - cudaErrorMixedDeviceExecution = ccudart.cudaError.cudaErrorMixedDeviceExecution{{endif}} - {{if 'cudaErrorNotYetImplemented' in found_values}} - - #: This indicates that the API call is not yet implemented. Production - #: releases of CUDA will never return this error. [Deprecated] - cudaErrorNotYetImplemented = ccudart.cudaError.cudaErrorNotYetImplemented{{endif}} - {{if 'cudaErrorMemoryValueTooLarge' in found_values}} - - #: This indicated that an emulated device pointer exceeded the 32-bit - #: address range. [Deprecated] - cudaErrorMemoryValueTooLarge = ccudart.cudaError.cudaErrorMemoryValueTooLarge{{endif}} - {{if 'cudaErrorStubLibrary' in found_values}} - - #: This indicates that the CUDA driver that the application has loaded - #: is a stub library. Applications that run with the stub rather than a - #: real driver loaded will result in CUDA API returning this error. - cudaErrorStubLibrary = ccudart.cudaError.cudaErrorStubLibrary{{endif}} - {{if 'cudaErrorInsufficientDriver' in found_values}} - - #: This indicates that the installed NVIDIA CUDA driver is older than - #: the CUDA runtime library. This is not a supported configuration. - #: Users should install an updated NVIDIA display driver to allow the - #: application to run. - cudaErrorInsufficientDriver = ccudart.cudaError.cudaErrorInsufficientDriver{{endif}} - {{if 'cudaErrorCallRequiresNewerDriver' in found_values}} - - #: This indicates that the API call requires a newer CUDA driver than - #: the one currently installed. Users should install an updated NVIDIA - #: CUDA driver to allow the API call to succeed. - cudaErrorCallRequiresNewerDriver = ccudart.cudaError.cudaErrorCallRequiresNewerDriver{{endif}} - {{if 'cudaErrorInvalidSurface' in found_values}} - - #: This indicates that the surface passed to the API call is not a - #: valid surface. - cudaErrorInvalidSurface = ccudart.cudaError.cudaErrorInvalidSurface{{endif}} - {{if 'cudaErrorDuplicateVariableName' in found_values}} - - #: This indicates that multiple global or constant variables (across - #: separate CUDA source files in the application) share the same string - #: name. - cudaErrorDuplicateVariableName = ccudart.cudaError.cudaErrorDuplicateVariableName{{endif}} - {{if 'cudaErrorDuplicateTextureName' in found_values}} - - #: This indicates that multiple textures (across separate CUDA source - #: files in the application) share the same string name. - cudaErrorDuplicateTextureName = ccudart.cudaError.cudaErrorDuplicateTextureName{{endif}} - {{if 'cudaErrorDuplicateSurfaceName' in found_values}} - - #: This indicates that multiple surfaces (across separate CUDA source - #: files in the application) share the same string name. - cudaErrorDuplicateSurfaceName = ccudart.cudaError.cudaErrorDuplicateSurfaceName{{endif}} - {{if 'cudaErrorDevicesUnavailable' in found_values}} - - #: This indicates that all CUDA devices are busy or unavailable at the - #: current time. Devices are often busy/unavailable due to use of - #: :py:obj:`~.cudaComputeModeProhibited`, - #: :py:obj:`~.cudaComputeModeExclusiveProcess`, or when long running - #: CUDA kernels have filled up the GPU and are blocking new work from - #: starting. They can also be unavailable due to memory constraints on - #: a device that already has active CUDA work being performed. - cudaErrorDevicesUnavailable = ccudart.cudaError.cudaErrorDevicesUnavailable{{endif}} - {{if 'cudaErrorIncompatibleDriverContext' in found_values}} - - #: This indicates that the current context is not compatible with this - #: the CUDA Runtime. This can only occur if you are using CUDA - #: Runtime/Driver interoperability and have created an existing Driver - #: context using the driver API. The Driver context may be incompatible - #: either because the Driver context was created using an older version - #: of the API, because the Runtime API call expects a primary driver - #: context and the Driver context is not primary, or because the Driver - #: context has been destroyed. Please see :py:obj:`~.Interactions`with - #: the CUDA Driver API" for more information. - cudaErrorIncompatibleDriverContext = ccudart.cudaError.cudaErrorIncompatibleDriverContext{{endif}} - {{if 'cudaErrorMissingConfiguration' in found_values}} - - #: The device function being invoked (usually via - #: :py:obj:`~.cudaLaunchKernel()`) was not previously configured via - #: the :py:obj:`~.cudaConfigureCall()` function. - cudaErrorMissingConfiguration = ccudart.cudaError.cudaErrorMissingConfiguration{{endif}} - {{if 'cudaErrorPriorLaunchFailure' in found_values}} - - #: This indicated that a previous kernel launch failed. This was - #: previously used for device emulation of kernel launches. - #: [Deprecated] - cudaErrorPriorLaunchFailure = ccudart.cudaError.cudaErrorPriorLaunchFailure{{endif}} - {{if 'cudaErrorLaunchMaxDepthExceeded' in found_values}} - - #: This error indicates that a device runtime grid launch did not occur - #: because the depth of the child grid would exceed the maximum - #: supported number of nested grid launches. - cudaErrorLaunchMaxDepthExceeded = ccudart.cudaError.cudaErrorLaunchMaxDepthExceeded{{endif}} - {{if 'cudaErrorLaunchFileScopedTex' in found_values}} - - #: This error indicates that a grid launch did not occur because the - #: kernel uses file-scoped textures which are unsupported by the device - #: runtime. Kernels launched via the device runtime only support - #: textures created with the Texture Object API's. - cudaErrorLaunchFileScopedTex = ccudart.cudaError.cudaErrorLaunchFileScopedTex{{endif}} - {{if 'cudaErrorLaunchFileScopedSurf' in found_values}} - - #: This error indicates that a grid launch did not occur because the - #: kernel uses file-scoped surfaces which are unsupported by the device - #: runtime. Kernels launched via the device runtime only support - #: surfaces created with the Surface Object API's. - cudaErrorLaunchFileScopedSurf = ccudart.cudaError.cudaErrorLaunchFileScopedSurf{{endif}} - {{if 'cudaErrorSyncDepthExceeded' in found_values}} - - #: This error indicates that a call to - #: :py:obj:`~.cudaDeviceSynchronize` made from the device runtime - #: failed because the call was made at grid depth greater than than - #: either the default (2 levels of grids) or user specified device - #: limit :py:obj:`~.cudaLimitDevRuntimeSyncDepth`. To be able to - #: synchronize on launched grids at a greater depth successfully, the - #: maximum nested depth at which :py:obj:`~.cudaDeviceSynchronize` will - #: be called must be specified with the - #: :py:obj:`~.cudaLimitDevRuntimeSyncDepth` limit to the - #: :py:obj:`~.cudaDeviceSetLimit` api before the host-side launch of a - #: kernel using the device runtime. Keep in mind that additional levels - #: of sync depth require the runtime to reserve large amounts of device - #: memory that cannot be used for user allocations. Note that - #: :py:obj:`~.cudaDeviceSynchronize` made from device runtime is only - #: supported on devices of compute capability < 9.0. - cudaErrorSyncDepthExceeded = ccudart.cudaError.cudaErrorSyncDepthExceeded{{endif}} - {{if 'cudaErrorLaunchPendingCountExceeded' in found_values}} - - #: This error indicates that a device runtime grid launch failed - #: because the launch would exceed the limit - #: :py:obj:`~.cudaLimitDevRuntimePendingLaunchCount`. For this launch - #: to proceed successfully, :py:obj:`~.cudaDeviceSetLimit` must be - #: called to set the :py:obj:`~.cudaLimitDevRuntimePendingLaunchCount` - #: to be higher than the upper bound of outstanding launches that can - #: be issued to the device runtime. Keep in mind that raising the limit - #: of pending device runtime launches will require the runtime to - #: reserve device memory that cannot be used for user allocations. - cudaErrorLaunchPendingCountExceeded = ccudart.cudaError.cudaErrorLaunchPendingCountExceeded{{endif}} - {{if 'cudaErrorInvalidDeviceFunction' in found_values}} - - #: The requested device function does not exist or is not compiled for - #: the proper device architecture. - cudaErrorInvalidDeviceFunction = ccudart.cudaError.cudaErrorInvalidDeviceFunction{{endif}} - {{if 'cudaErrorNoDevice' in found_values}} - - #: This indicates that no CUDA-capable devices were detected by the - #: installed CUDA driver. - cudaErrorNoDevice = ccudart.cudaError.cudaErrorNoDevice{{endif}} - {{if 'cudaErrorInvalidDevice' in found_values}} - - #: This indicates that the device ordinal supplied by the user does not - #: correspond to a valid CUDA device or that the action requested is - #: invalid for the specified device. - cudaErrorInvalidDevice = ccudart.cudaError.cudaErrorInvalidDevice{{endif}} - {{if 'cudaErrorDeviceNotLicensed' in found_values}} - - #: This indicates that the device doesn't have a valid Grid License. - cudaErrorDeviceNotLicensed = ccudart.cudaError.cudaErrorDeviceNotLicensed{{endif}} - {{if 'cudaErrorSoftwareValidityNotEstablished' in found_values}} - - #: By default, the CUDA runtime may perform a minimal set of self- - #: tests, as well as CUDA driver tests, to establish the validity of - #: both. Introduced in CUDA 11.2, this error return indicates that at - #: least one of these tests has failed and the validity of either the - #: runtime or the driver could not be established. - cudaErrorSoftwareValidityNotEstablished = ccudart.cudaError.cudaErrorSoftwareValidityNotEstablished{{endif}} - {{if 'cudaErrorStartupFailure' in found_values}} - - #: This indicates an internal startup failure in the CUDA runtime. - cudaErrorStartupFailure = ccudart.cudaError.cudaErrorStartupFailure{{endif}} - {{if 'cudaErrorInvalidKernelImage' in found_values}} - - #: This indicates that the device kernel image is invalid. - cudaErrorInvalidKernelImage = ccudart.cudaError.cudaErrorInvalidKernelImage{{endif}} - {{if 'cudaErrorDeviceUninitialized' in found_values}} - - #: This most frequently indicates that there is no context bound to the - #: current thread. This can also be returned if the context passed to - #: an API call is not a valid handle (such as a context that has had - #: :py:obj:`~.cuCtxDestroy()` invoked on it). This can also be returned - #: if a user mixes different API versions (i.e. 3010 context with 3020 - #: API calls). See :py:obj:`~.cuCtxGetApiVersion()` for more details. - cudaErrorDeviceUninitialized = ccudart.cudaError.cudaErrorDeviceUninitialized{{endif}} - {{if 'cudaErrorMapBufferObjectFailed' in found_values}} - - #: This indicates that the buffer object could not be mapped. - cudaErrorMapBufferObjectFailed = ccudart.cudaError.cudaErrorMapBufferObjectFailed{{endif}} - {{if 'cudaErrorUnmapBufferObjectFailed' in found_values}} - - #: This indicates that the buffer object could not be unmapped. - cudaErrorUnmapBufferObjectFailed = ccudart.cudaError.cudaErrorUnmapBufferObjectFailed{{endif}} - {{if 'cudaErrorArrayIsMapped' in found_values}} - - #: This indicates that the specified array is currently mapped and thus - #: cannot be destroyed. - cudaErrorArrayIsMapped = ccudart.cudaError.cudaErrorArrayIsMapped{{endif}} - {{if 'cudaErrorAlreadyMapped' in found_values}} - - #: This indicates that the resource is already mapped. - cudaErrorAlreadyMapped = ccudart.cudaError.cudaErrorAlreadyMapped{{endif}} - {{if 'cudaErrorNoKernelImageForDevice' in found_values}} - - #: This indicates that there is no kernel image available that is - #: suitable for the device. This can occur when a user specifies code - #: generation options for a particular CUDA source file that do not - #: include the corresponding device configuration. - cudaErrorNoKernelImageForDevice = ccudart.cudaError.cudaErrorNoKernelImageForDevice{{endif}} - {{if 'cudaErrorAlreadyAcquired' in found_values}} - - #: This indicates that a resource has already been acquired. - cudaErrorAlreadyAcquired = ccudart.cudaError.cudaErrorAlreadyAcquired{{endif}} - {{if 'cudaErrorNotMapped' in found_values}} - - #: This indicates that a resource is not mapped. - cudaErrorNotMapped = ccudart.cudaError.cudaErrorNotMapped{{endif}} - {{if 'cudaErrorNotMappedAsArray' in found_values}} - - #: This indicates that a mapped resource is not available for access as - #: an array. - cudaErrorNotMappedAsArray = ccudart.cudaError.cudaErrorNotMappedAsArray{{endif}} - {{if 'cudaErrorNotMappedAsPointer' in found_values}} - - #: This indicates that a mapped resource is not available for access as - #: a pointer. - cudaErrorNotMappedAsPointer = ccudart.cudaError.cudaErrorNotMappedAsPointer{{endif}} - {{if 'cudaErrorECCUncorrectable' in found_values}} - - #: This indicates that an uncorrectable ECC error was detected during - #: execution. - cudaErrorECCUncorrectable = ccudart.cudaError.cudaErrorECCUncorrectable{{endif}} - {{if 'cudaErrorUnsupportedLimit' in found_values}} - - #: This indicates that the :py:obj:`~.cudaLimit` passed to the API call - #: is not supported by the active device. - cudaErrorUnsupportedLimit = ccudart.cudaError.cudaErrorUnsupportedLimit{{endif}} - {{if 'cudaErrorDeviceAlreadyInUse' in found_values}} - - #: This indicates that a call tried to access an exclusive-thread - #: device that is already in use by a different thread. - cudaErrorDeviceAlreadyInUse = ccudart.cudaError.cudaErrorDeviceAlreadyInUse{{endif}} - {{if 'cudaErrorPeerAccessUnsupported' in found_values}} - - #: This error indicates that P2P access is not supported across the - #: given devices. - cudaErrorPeerAccessUnsupported = ccudart.cudaError.cudaErrorPeerAccessUnsupported{{endif}} - {{if 'cudaErrorInvalidPtx' in found_values}} - - #: A PTX compilation failed. The runtime may fall back to compiling PTX - #: if an application does not contain a suitable binary for the current - #: device. - cudaErrorInvalidPtx = ccudart.cudaError.cudaErrorInvalidPtx{{endif}} - {{if 'cudaErrorInvalidGraphicsContext' in found_values}} - - #: This indicates an error with the OpenGL or DirectX context. - cudaErrorInvalidGraphicsContext = ccudart.cudaError.cudaErrorInvalidGraphicsContext{{endif}} - {{if 'cudaErrorNvlinkUncorrectable' in found_values}} - - #: This indicates that an uncorrectable NVLink error was detected - #: during the execution. - cudaErrorNvlinkUncorrectable = ccudart.cudaError.cudaErrorNvlinkUncorrectable{{endif}} - {{if 'cudaErrorJitCompilerNotFound' in found_values}} - - #: This indicates that the PTX JIT compiler library was not found. The - #: JIT Compiler library is used for PTX compilation. The runtime may - #: fall back to compiling PTX if an application does not contain a - #: suitable binary for the current device. - cudaErrorJitCompilerNotFound = ccudart.cudaError.cudaErrorJitCompilerNotFound{{endif}} - {{if 'cudaErrorUnsupportedPtxVersion' in found_values}} - - #: This indicates that the provided PTX was compiled with an - #: unsupported toolchain. The most common reason for this, is the PTX - #: was generated by a compiler newer than what is supported by the CUDA - #: driver and PTX JIT compiler. - cudaErrorUnsupportedPtxVersion = ccudart.cudaError.cudaErrorUnsupportedPtxVersion{{endif}} - {{if 'cudaErrorJitCompilationDisabled' in found_values}} - - #: This indicates that the JIT compilation was disabled. The JIT - #: compilation compiles PTX. The runtime may fall back to compiling PTX - #: if an application does not contain a suitable binary for the current - #: device. - cudaErrorJitCompilationDisabled = ccudart.cudaError.cudaErrorJitCompilationDisabled{{endif}} - {{if 'cudaErrorUnsupportedExecAffinity' in found_values}} - - #: This indicates that the provided execution affinity is not supported - #: by the device. - cudaErrorUnsupportedExecAffinity = ccudart.cudaError.cudaErrorUnsupportedExecAffinity{{endif}} - {{if 'cudaErrorUnsupportedDevSideSync' in found_values}} - - #: This indicates that the code to be compiled by the PTX JIT contains - #: unsupported call to cudaDeviceSynchronize. - cudaErrorUnsupportedDevSideSync = ccudart.cudaError.cudaErrorUnsupportedDevSideSync{{endif}} - {{if 'cudaErrorInvalidSource' in found_values}} - - #: This indicates that the device kernel source is invalid. - cudaErrorInvalidSource = ccudart.cudaError.cudaErrorInvalidSource{{endif}} - {{if 'cudaErrorFileNotFound' in found_values}} - - #: This indicates that the file specified was not found. - cudaErrorFileNotFound = ccudart.cudaError.cudaErrorFileNotFound{{endif}} - {{if 'cudaErrorSharedObjectSymbolNotFound' in found_values}} - - #: This indicates that a link to a shared object failed to resolve. - cudaErrorSharedObjectSymbolNotFound = ccudart.cudaError.cudaErrorSharedObjectSymbolNotFound{{endif}} - {{if 'cudaErrorSharedObjectInitFailed' in found_values}} - - #: This indicates that initialization of a shared object failed. - cudaErrorSharedObjectInitFailed = ccudart.cudaError.cudaErrorSharedObjectInitFailed{{endif}} - {{if 'cudaErrorOperatingSystem' in found_values}} - - #: This error indicates that an OS call failed. - cudaErrorOperatingSystem = ccudart.cudaError.cudaErrorOperatingSystem{{endif}} - {{if 'cudaErrorInvalidResourceHandle' in found_values}} - - #: This indicates that a resource handle passed to the API call was not - #: valid. Resource handles are opaque types like - #: :py:obj:`~.cudaStream_t` and :py:obj:`~.cudaEvent_t`. - cudaErrorInvalidResourceHandle = ccudart.cudaError.cudaErrorInvalidResourceHandle{{endif}} - {{if 'cudaErrorIllegalState' in found_values}} - - #: This indicates that a resource required by the API call is not in a - #: valid state to perform the requested operation. - cudaErrorIllegalState = ccudart.cudaError.cudaErrorIllegalState{{endif}} - {{if 'cudaErrorLossyQuery' in found_values}} - - #: This indicates an attempt was made to introspect an object in a way - #: that would discard semantically important information. This is - #: either due to the object using funtionality newer than the API - #: version used to introspect it or omission of optional return - #: arguments. - cudaErrorLossyQuery = ccudart.cudaError.cudaErrorLossyQuery{{endif}} - {{if 'cudaErrorSymbolNotFound' in found_values}} - - #: This indicates that a named symbol was not found. Examples of - #: symbols are global/constant variable names, driver function names, - #: texture names, and surface names. - cudaErrorSymbolNotFound = ccudart.cudaError.cudaErrorSymbolNotFound{{endif}} - {{if 'cudaErrorNotReady' in found_values}} - - #: This indicates that asynchronous operations issued previously have - #: not completed yet. This result is not actually an error, but must be - #: indicated differently than :py:obj:`~.cudaSuccess` (which indicates - #: completion). Calls that may return this value include - #: :py:obj:`~.cudaEventQuery()` and :py:obj:`~.cudaStreamQuery()`. - cudaErrorNotReady = ccudart.cudaError.cudaErrorNotReady{{endif}} - {{if 'cudaErrorIllegalAddress' in found_values}} - - #: The device encountered a load or store instruction on an invalid - #: memory address. This leaves the process in an inconsistent state and - #: any further CUDA work will return the same error. To continue using - #: CUDA, the process must be terminated and relaunched. - cudaErrorIllegalAddress = ccudart.cudaError.cudaErrorIllegalAddress{{endif}} - {{if 'cudaErrorLaunchOutOfResources' in found_values}} - - #: This indicates that a launch did not occur because it did not have - #: appropriate resources. Although this error is similar to - #: :py:obj:`~.cudaErrorInvalidConfiguration`, this error usually - #: indicates that the user has attempted to pass too many arguments to - #: the device kernel, or the kernel launch specifies too many threads - #: for the kernel's register count. - cudaErrorLaunchOutOfResources = ccudart.cudaError.cudaErrorLaunchOutOfResources{{endif}} - {{if 'cudaErrorLaunchTimeout' in found_values}} - - #: This indicates that the device kernel took too long to execute. This - #: can only occur if timeouts are enabled - see the device property - #: :py:obj:`~.kernelExecTimeoutEnabled` for more information. This - #: leaves the process in an inconsistent state and any further CUDA - #: work will return the same error. To continue using CUDA, the process - #: must be terminated and relaunched. - cudaErrorLaunchTimeout = ccudart.cudaError.cudaErrorLaunchTimeout{{endif}} - {{if 'cudaErrorLaunchIncompatibleTexturing' in found_values}} - - #: This error indicates a kernel launch that uses an incompatible - #: texturing mode. - cudaErrorLaunchIncompatibleTexturing = ccudart.cudaError.cudaErrorLaunchIncompatibleTexturing{{endif}} - {{if 'cudaErrorPeerAccessAlreadyEnabled' in found_values}} - - #: This error indicates that a call to - #: :py:obj:`~.cudaDeviceEnablePeerAccess()` is trying to re-enable peer - #: addressing on from a context which has already had peer addressing - #: enabled. - cudaErrorPeerAccessAlreadyEnabled = ccudart.cudaError.cudaErrorPeerAccessAlreadyEnabled{{endif}} - {{if 'cudaErrorPeerAccessNotEnabled' in found_values}} - - #: This error indicates that :py:obj:`~.cudaDeviceDisablePeerAccess()` - #: is trying to disable peer addressing which has not been enabled yet - #: via :py:obj:`~.cudaDeviceEnablePeerAccess()`. - cudaErrorPeerAccessNotEnabled = ccudart.cudaError.cudaErrorPeerAccessNotEnabled{{endif}} - {{if 'cudaErrorSetOnActiveProcess' in found_values}} - - #: This indicates that the user has called - #: :py:obj:`~.cudaSetValidDevices()`, :py:obj:`~.cudaSetDeviceFlags()`, - #: :py:obj:`~.cudaD3D9SetDirect3DDevice()`, - #: :py:obj:`~.cudaD3D10SetDirect3DDevice`, - #: :py:obj:`~.cudaD3D11SetDirect3DDevice()`, or - #: :py:obj:`~.cudaVDPAUSetVDPAUDevice()` after initializing the CUDA - #: runtime by calling non-device management operations (allocating - #: memory and launching kernels are examples of non-device management - #: operations). This error can also be returned if using runtime/driver - #: interoperability and there is an existing :py:obj:`~.CUcontext` - #: active on the host thread. - cudaErrorSetOnActiveProcess = ccudart.cudaError.cudaErrorSetOnActiveProcess{{endif}} - {{if 'cudaErrorContextIsDestroyed' in found_values}} - - #: This error indicates that the context current to the calling thread - #: has been destroyed using :py:obj:`~.cuCtxDestroy`, or is a primary - #: context which has not yet been initialized. - cudaErrorContextIsDestroyed = ccudart.cudaError.cudaErrorContextIsDestroyed{{endif}} - {{if 'cudaErrorAssert' in found_values}} - - #: An assert triggered in device code during kernel execution. The - #: device cannot be used again. All existing allocations are invalid. - #: To continue using CUDA, the process must be terminated and - #: relaunched. - cudaErrorAssert = ccudart.cudaError.cudaErrorAssert{{endif}} - {{if 'cudaErrorTooManyPeers' in found_values}} - - #: This error indicates that the hardware resources required to enable - #: peer access have been exhausted for one or more of the devices - #: passed to :py:obj:`~.cudaEnablePeerAccess()`. - cudaErrorTooManyPeers = ccudart.cudaError.cudaErrorTooManyPeers{{endif}} - {{if 'cudaErrorHostMemoryAlreadyRegistered' in found_values}} - - #: This error indicates that the memory range passed to - #: :py:obj:`~.cudaHostRegister()` has already been registered. - cudaErrorHostMemoryAlreadyRegistered = ccudart.cudaError.cudaErrorHostMemoryAlreadyRegistered{{endif}} - {{if 'cudaErrorHostMemoryNotRegistered' in found_values}} - - #: This error indicates that the pointer passed to - #: :py:obj:`~.cudaHostUnregister()` does not correspond to any - #: currently registered memory region. - cudaErrorHostMemoryNotRegistered = ccudart.cudaError.cudaErrorHostMemoryNotRegistered{{endif}} - {{if 'cudaErrorHardwareStackError' in found_values}} - - #: Device encountered an error in the call stack during kernel - #: execution, possibly due to stack corruption or exceeding the stack - #: size limit. This leaves the process in an inconsistent state and any - #: further CUDA work will return the same error. To continue using - #: CUDA, the process must be terminated and relaunched. - cudaErrorHardwareStackError = ccudart.cudaError.cudaErrorHardwareStackError{{endif}} - {{if 'cudaErrorIllegalInstruction' in found_values}} - - #: The device encountered an illegal instruction during kernel - #: execution This leaves the process in an inconsistent state and any - #: further CUDA work will return the same error. To continue using - #: CUDA, the process must be terminated and relaunched. - cudaErrorIllegalInstruction = ccudart.cudaError.cudaErrorIllegalInstruction{{endif}} - {{if 'cudaErrorMisalignedAddress' in found_values}} - - #: The device encountered a load or store instruction on a memory - #: address which is not aligned. This leaves the process in an - #: inconsistent state and any further CUDA work will return the same - #: error. To continue using CUDA, the process must be terminated and - #: relaunched. - cudaErrorMisalignedAddress = ccudart.cudaError.cudaErrorMisalignedAddress{{endif}} - {{if 'cudaErrorInvalidAddressSpace' in found_values}} - - #: While executing a kernel, the device encountered an instruction - #: which can only operate on memory locations in certain address spaces - #: (global, shared, or local), but was supplied a memory address not - #: belonging to an allowed address space. This leaves the process in an - #: inconsistent state and any further CUDA work will return the same - #: error. To continue using CUDA, the process must be terminated and - #: relaunched. - cudaErrorInvalidAddressSpace = ccudart.cudaError.cudaErrorInvalidAddressSpace{{endif}} - {{if 'cudaErrorInvalidPc' in found_values}} - - #: The device encountered an invalid program counter. This leaves the - #: process in an inconsistent state and any further CUDA work will - #: return the same error. To continue using CUDA, the process must be - #: terminated and relaunched. - cudaErrorInvalidPc = ccudart.cudaError.cudaErrorInvalidPc{{endif}} - {{if 'cudaErrorLaunchFailure' in found_values}} - - #: An exception occurred on the device while executing a kernel. Common - #: causes include dereferencing an invalid device pointer and accessing - #: out of bounds shared memory. Less common cases can be system - #: specific - more information about these cases can be found in the - #: system specific user guide. This leaves the process in an - #: inconsistent state and any further CUDA work will return the same - #: error. To continue using CUDA, the process must be terminated and - #: relaunched. - cudaErrorLaunchFailure = ccudart.cudaError.cudaErrorLaunchFailure{{endif}} - {{if 'cudaErrorCooperativeLaunchTooLarge' in found_values}} - - #: This error indicates that the number of blocks launched per grid for - #: a kernel that was launched via either - #: :py:obj:`~.cudaLaunchCooperativeKernel` or - #: :py:obj:`~.cudaLaunchCooperativeKernelMultiDevice` exceeds the - #: maximum number of blocks as allowed by - #: :py:obj:`~.cudaOccupancyMaxActiveBlocksPerMultiprocessor` or - #: :py:obj:`~.cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags` - #: times the number of multiprocessors as specified by the device - #: attribute :py:obj:`~.cudaDevAttrMultiProcessorCount`. - cudaErrorCooperativeLaunchTooLarge = ccudart.cudaError.cudaErrorCooperativeLaunchTooLarge{{endif}} - {{if 'cudaErrorNotPermitted' in found_values}} - - #: This error indicates the attempted operation is not permitted. - cudaErrorNotPermitted = ccudart.cudaError.cudaErrorNotPermitted{{endif}} - {{if 'cudaErrorNotSupported' in found_values}} - - #: This error indicates the attempted operation is not supported on the - #: current system or device. - cudaErrorNotSupported = ccudart.cudaError.cudaErrorNotSupported{{endif}} - {{if 'cudaErrorSystemNotReady' in found_values}} - - #: This error indicates that the system is not yet ready to start any - #: CUDA work. To continue using CUDA, verify the system configuration - #: is in a valid state and all required driver daemons are actively - #: running. More information about this error can be found in the - #: system specific user guide. - cudaErrorSystemNotReady = ccudart.cudaError.cudaErrorSystemNotReady{{endif}} - {{if 'cudaErrorSystemDriverMismatch' in found_values}} - - #: This error indicates that there is a mismatch between the versions - #: of the display driver and the CUDA driver. Refer to the - #: compatibility documentation for supported versions. - cudaErrorSystemDriverMismatch = ccudart.cudaError.cudaErrorSystemDriverMismatch{{endif}} - {{if 'cudaErrorCompatNotSupportedOnDevice' in found_values}} - - #: This error indicates that the system was upgraded to run with - #: forward compatibility but the visible hardware detected by CUDA does - #: not support this configuration. Refer to the compatibility - #: documentation for the supported hardware matrix or ensure that only - #: supported hardware is visible during initialization via the - #: CUDA_VISIBLE_DEVICES environment variable. - cudaErrorCompatNotSupportedOnDevice = ccudart.cudaError.cudaErrorCompatNotSupportedOnDevice{{endif}} - {{if 'cudaErrorMpsConnectionFailed' in found_values}} - - #: This error indicates that the MPS client failed to connect to the - #: MPS control daemon or the MPS server. - cudaErrorMpsConnectionFailed = ccudart.cudaError.cudaErrorMpsConnectionFailed{{endif}} - {{if 'cudaErrorMpsRpcFailure' in found_values}} - - #: This error indicates that the remote procedural call between the MPS - #: server and the MPS client failed. - cudaErrorMpsRpcFailure = ccudart.cudaError.cudaErrorMpsRpcFailure{{endif}} - {{if 'cudaErrorMpsServerNotReady' in found_values}} - - #: This error indicates that the MPS server is not ready to accept new - #: MPS client requests. This error can be returned when the MPS server - #: is in the process of recovering from a fatal failure. - cudaErrorMpsServerNotReady = ccudart.cudaError.cudaErrorMpsServerNotReady{{endif}} - {{if 'cudaErrorMpsMaxClientsReached' in found_values}} - - #: This error indicates that the hardware resources required to create - #: MPS client have been exhausted. - cudaErrorMpsMaxClientsReached = ccudart.cudaError.cudaErrorMpsMaxClientsReached{{endif}} - {{if 'cudaErrorMpsMaxConnectionsReached' in found_values}} - - #: This error indicates the the hardware resources required to device - #: connections have been exhausted. - cudaErrorMpsMaxConnectionsReached = ccudart.cudaError.cudaErrorMpsMaxConnectionsReached{{endif}} - {{if 'cudaErrorMpsClientTerminated' in found_values}} - - #: This error indicates that the MPS client has been terminated by the - #: server. To continue using CUDA, the process must be terminated and - #: relaunched. - cudaErrorMpsClientTerminated = ccudart.cudaError.cudaErrorMpsClientTerminated{{endif}} - {{if 'cudaErrorCdpNotSupported' in found_values}} - - #: This error indicates, that the program is using CUDA Dynamic - #: Parallelism, but the current configuration, like MPS, does not - #: support it. - cudaErrorCdpNotSupported = ccudart.cudaError.cudaErrorCdpNotSupported{{endif}} - {{if 'cudaErrorCdpVersionMismatch' in found_values}} - - #: This error indicates, that the program contains an unsupported - #: interaction between different versions of CUDA Dynamic Parallelism. - cudaErrorCdpVersionMismatch = ccudart.cudaError.cudaErrorCdpVersionMismatch{{endif}} - {{if 'cudaErrorStreamCaptureUnsupported' in found_values}} - - #: The operation is not permitted when the stream is capturing. - cudaErrorStreamCaptureUnsupported = ccudart.cudaError.cudaErrorStreamCaptureUnsupported{{endif}} - {{if 'cudaErrorStreamCaptureInvalidated' in found_values}} - - #: The current capture sequence on the stream has been invalidated due - #: to a previous error. - cudaErrorStreamCaptureInvalidated = ccudart.cudaError.cudaErrorStreamCaptureInvalidated{{endif}} - {{if 'cudaErrorStreamCaptureMerge' in found_values}} - - #: The operation would have resulted in a merge of two independent - #: capture sequences. - cudaErrorStreamCaptureMerge = ccudart.cudaError.cudaErrorStreamCaptureMerge{{endif}} - {{if 'cudaErrorStreamCaptureUnmatched' in found_values}} - - #: The capture was not initiated in this stream. - cudaErrorStreamCaptureUnmatched = ccudart.cudaError.cudaErrorStreamCaptureUnmatched{{endif}} - {{if 'cudaErrorStreamCaptureUnjoined' in found_values}} - - #: The capture sequence contains a fork that was not joined to the - #: primary stream. - cudaErrorStreamCaptureUnjoined = ccudart.cudaError.cudaErrorStreamCaptureUnjoined{{endif}} - {{if 'cudaErrorStreamCaptureIsolation' in found_values}} - - #: A dependency would have been created which crosses the capture - #: sequence boundary. Only implicit in-stream ordering dependencies are - #: allowed to cross the boundary. - cudaErrorStreamCaptureIsolation = ccudart.cudaError.cudaErrorStreamCaptureIsolation{{endif}} - {{if 'cudaErrorStreamCaptureImplicit' in found_values}} - - #: The operation would have resulted in a disallowed implicit - #: dependency on a current capture sequence from cudaStreamLegacy. - cudaErrorStreamCaptureImplicit = ccudart.cudaError.cudaErrorStreamCaptureImplicit{{endif}} - {{if 'cudaErrorCapturedEvent' in found_values}} - - #: The operation is not permitted on an event which was last recorded - #: in a capturing stream. - cudaErrorCapturedEvent = ccudart.cudaError.cudaErrorCapturedEvent{{endif}} - {{if 'cudaErrorStreamCaptureWrongThread' in found_values}} - - #: A stream capture sequence not initiated with the - #: :py:obj:`~.cudaStreamCaptureModeRelaxed` argument to - #: :py:obj:`~.cudaStreamBeginCapture` was passed to - #: :py:obj:`~.cudaStreamEndCapture` in a different thread. - cudaErrorStreamCaptureWrongThread = ccudart.cudaError.cudaErrorStreamCaptureWrongThread{{endif}} - {{if 'cudaErrorTimeout' in found_values}} - - #: This indicates that the wait operation has timed out. - cudaErrorTimeout = ccudart.cudaError.cudaErrorTimeout{{endif}} - {{if 'cudaErrorGraphExecUpdateFailure' in found_values}} - - #: This error indicates that the graph update was not performed because - #: it included changes which violated constraints specific to - #: instantiated graph update. - cudaErrorGraphExecUpdateFailure = ccudart.cudaError.cudaErrorGraphExecUpdateFailure{{endif}} - {{if 'cudaErrorExternalDevice' in found_values}} - - #: This indicates that an async error has occurred in a device outside - #: of CUDA. If CUDA was waiting for an external device's signal before - #: consuming shared data, the external device signaled an error - #: indicating that the data is not valid for consumption. This leaves - #: the process in an inconsistent state and any further CUDA work will - #: return the same error. To continue using CUDA, the process must be - #: terminated and relaunched. - cudaErrorExternalDevice = ccudart.cudaError.cudaErrorExternalDevice{{endif}} - {{if 'cudaErrorInvalidClusterSize' in found_values}} - - #: This indicates that a kernel launch error has occurred due to - #: cluster misconfiguration. - cudaErrorInvalidClusterSize = ccudart.cudaError.cudaErrorInvalidClusterSize{{endif}} - {{if 'cudaErrorUnknown' in found_values}} - - #: This indicates that an unknown internal error has occurred. - cudaErrorUnknown = ccudart.cudaError.cudaErrorUnknown{{endif}} - {{if 'cudaErrorApiFailureBase' in found_values}} - cudaErrorApiFailureBase = ccudart.cudaError.cudaErrorApiFailureBase{{endif}} -{{endif}} -{{if 'cudaGraphDependencyType_enum' in found_types}} - -class cudaGraphDependencyType(IntEnum): - """ - Type annotations that can be applied to graph edges as part of - :py:obj:`~.cudaGraphEdgeData`. - """ - {{if 'cudaGraphDependencyTypeDefault' in found_values}} - - #: This is an ordinary dependency. - cudaGraphDependencyTypeDefault = ccudart.cudaGraphDependencyType_enum.cudaGraphDependencyTypeDefault{{endif}} - {{if 'cudaGraphDependencyTypeProgrammatic' in found_values}} - - #: This dependency type allows the downstream node to use - #: `cudaGridDependencySynchronize()`. It may only be used between - #: kernel nodes, and must be used with either the - #: :py:obj:`~.cudaGraphKernelNodePortProgrammatic` or - #: :py:obj:`~.cudaGraphKernelNodePortLaunchCompletion` outgoing port. - cudaGraphDependencyTypeProgrammatic = ccudart.cudaGraphDependencyType_enum.cudaGraphDependencyTypeProgrammatic{{endif}} -{{endif}} -{{if 'cudaGraphInstantiateResult' in found_types}} - -class cudaGraphInstantiateResult(IntEnum): - """ - Graph instantiation results - """ - {{if 'cudaGraphInstantiateSuccess' in found_values}} - - #: Instantiation succeeded - cudaGraphInstantiateSuccess = ccudart.cudaGraphInstantiateResult.cudaGraphInstantiateSuccess{{endif}} - {{if 'cudaGraphInstantiateError' in found_values}} - - #: Instantiation failed for an unexpected reason which is described in - #: the return value of the function - cudaGraphInstantiateError = ccudart.cudaGraphInstantiateResult.cudaGraphInstantiateError{{endif}} - {{if 'cudaGraphInstantiateInvalidStructure' in found_values}} - - #: Instantiation failed due to invalid structure, such as cycles - cudaGraphInstantiateInvalidStructure = ccudart.cudaGraphInstantiateResult.cudaGraphInstantiateInvalidStructure{{endif}} - {{if 'cudaGraphInstantiateNodeOperationNotSupported' in found_values}} - - #: Instantiation for device launch failed because the graph contained - #: an unsupported operation - cudaGraphInstantiateNodeOperationNotSupported = ccudart.cudaGraphInstantiateResult.cudaGraphInstantiateNodeOperationNotSupported{{endif}} - {{if 'cudaGraphInstantiateMultipleDevicesNotSupported' in found_values}} - - #: Instantiation for device launch failed due to the nodes belonging to - #: different contexts - cudaGraphInstantiateMultipleDevicesNotSupported = ccudart.cudaGraphInstantiateResult.cudaGraphInstantiateMultipleDevicesNotSupported{{endif}} -{{endif}} -{{if 'cudaLaunchMemSyncDomain' in found_types}} - -class cudaLaunchMemSyncDomain(IntEnum): - """ - Memory Synchronization Domain A kernel can be launched in a - specified memory synchronization domain that affects all memory - operations issued by that kernel. A memory barrier issued in one - domain will only order memory operations in that domain, thus - eliminating latency increase from memory barriers ordering - unrelated traffic. By default, kernels are launched in domain 0. - Kernel launched with :py:obj:`~.cudaLaunchMemSyncDomainRemote` will - have a different domain ID. User may also alter the domain ID with - :py:obj:`~.cudaLaunchMemSyncDomainMap` for a specific stream / - graph node / kernel launch. See - :py:obj:`~.cudaLaunchAttributeMemSyncDomain`, - :py:obj:`~.cudaStreamSetAttribute`, :py:obj:`~.cudaLaunchKernelEx`, - :py:obj:`~.cudaGraphKernelNodeSetAttribute`. Memory operations - done in kernels launched in different domains are considered - system-scope distanced. In other words, a GPU scoped memory - synchronization is not sufficient for memory order to be observed - by kernels in another memory synchronization domain even if they - are on the same GPU. - """ - {{if 'cudaLaunchMemSyncDomainDefault' in found_values}} - - #: Launch kernels in the default domain - cudaLaunchMemSyncDomainDefault = ccudart.cudaLaunchMemSyncDomain.cudaLaunchMemSyncDomainDefault{{endif}} - {{if 'cudaLaunchMemSyncDomainRemote' in found_values}} - - #: Launch kernels in the remote domain - cudaLaunchMemSyncDomainRemote = ccudart.cudaLaunchMemSyncDomain.cudaLaunchMemSyncDomainRemote{{endif}} -{{endif}} -{{if 'cudaLaunchAttributeID' in found_types}} - -class cudaLaunchAttributeID(IntEnum): - """ - Launch attributes enum; used as id field of - :py:obj:`~.cudaLaunchAttribute` - """ - {{if 'cudaLaunchAttributeIgnore' in found_values}} - - #: Ignored entry, for convenient composition - cudaLaunchAttributeIgnore = ccudart.cudaLaunchAttributeID.cudaLaunchAttributeIgnore{{endif}} - {{if 'cudaLaunchAttributeAccessPolicyWindow' in found_values}} - - #: Valid for streams, graph nodes, launches. See - #: :py:obj:`~.cudaLaunchAttributeValue.accessPolicyWindow`. - cudaLaunchAttributeAccessPolicyWindow = ccudart.cudaLaunchAttributeID.cudaLaunchAttributeAccessPolicyWindow{{endif}} - {{if 'cudaLaunchAttributeCooperative' in found_values}} - - #: Valid for graph nodes, launches. See - #: :py:obj:`~.cudaLaunchAttributeValue.cooperative`. - cudaLaunchAttributeCooperative = ccudart.cudaLaunchAttributeID.cudaLaunchAttributeCooperative{{endif}} - {{if 'cudaLaunchAttributeSynchronizationPolicy' in found_values}} - - #: Valid for streams. See - #: :py:obj:`~.cudaLaunchAttributeValue.syncPolicy`. - cudaLaunchAttributeSynchronizationPolicy = ccudart.cudaLaunchAttributeID.cudaLaunchAttributeSynchronizationPolicy{{endif}} - {{if 'cudaLaunchAttributeClusterDimension' in found_values}} - - #: Valid for graph nodes, launches. See - #: :py:obj:`~.cudaLaunchAttributeValue.clusterDim`. - cudaLaunchAttributeClusterDimension = ccudart.cudaLaunchAttributeID.cudaLaunchAttributeClusterDimension{{endif}} - {{if 'cudaLaunchAttributeClusterSchedulingPolicyPreference' in found_values}} - - #: Valid for graph nodes, launches. See - #: :py:obj:`~.cudaLaunchAttributeValue.clusterSchedulingPolicyPreference`. - cudaLaunchAttributeClusterSchedulingPolicyPreference = ccudart.cudaLaunchAttributeID.cudaLaunchAttributeClusterSchedulingPolicyPreference{{endif}} - {{if 'cudaLaunchAttributeProgrammaticStreamSerialization' in found_values}} - - #: Valid for launches. Setting - #: :py:obj:`~.cudaLaunchAttributeValue.programmaticStreamSerializationAllowed` - #: to non-0 signals that the kernel will use programmatic means to - #: resolve its stream dependency, so that the CUDA runtime should - #: opportunistically allow the grid's execution to overlap with the - #: previous kernel in the stream, if that kernel requests the overlap. - #: The dependent launches can choose to wait on the dependency using - #: the programmatic sync (cudaGridDependencySynchronize() or equivalent - #: PTX instructions). - cudaLaunchAttributeProgrammaticStreamSerialization = ccudart.cudaLaunchAttributeID.cudaLaunchAttributeProgrammaticStreamSerialization{{endif}} - {{if 'cudaLaunchAttributeProgrammaticEvent' in found_values}} - - #: Valid for launches. Set - #: :py:obj:`~.cudaLaunchAttributeValue.programmaticEvent` to record the - #: event. Event recorded through this launch attribute is guaranteed to - #: only trigger after all block in the associated kernel trigger the - #: event. A block can trigger the event programmatically in a future - #: CUDA release. A trigger can also be inserted at the beginning of - #: each block's execution if triggerAtBlockStart is set to non-0. The - #: dependent launches can choose to wait on the dependency using the - #: programmatic sync (cudaGridDependencySynchronize() or equivalent PTX - #: instructions). Note that dependents (including the CPU thread - #: calling :py:obj:`~.cudaEventSynchronize()`) are not guaranteed to - #: observe the release precisely when it is released. For example, - #: :py:obj:`~.cudaEventSynchronize()` may only observe the event - #: trigger long after the associated kernel has completed. This - #: recording type is primarily meant for establishing programmatic - #: dependency between device tasks. Note also this type of dependency - #: allows, but does not guarantee, concurrent execution of tasks. - #: The event supplied must not be an interprocess or interop event. - #: The event must disable timing (i.e. must be created with the - #: :py:obj:`~.cudaEventDisableTiming` flag set). - cudaLaunchAttributeProgrammaticEvent = ccudart.cudaLaunchAttributeID.cudaLaunchAttributeProgrammaticEvent{{endif}} - {{if 'cudaLaunchAttributePriority' in found_values}} - - #: Valid for streams, graph nodes, launches. See - #: :py:obj:`~.cudaLaunchAttributeValue.priority`. - cudaLaunchAttributePriority = ccudart.cudaLaunchAttributeID.cudaLaunchAttributePriority{{endif}} - {{if 'cudaLaunchAttributeMemSyncDomainMap' in found_values}} - - #: Valid for streams, graph nodes, launches. See - #: :py:obj:`~.cudaLaunchAttributeValue.memSyncDomainMap`. - cudaLaunchAttributeMemSyncDomainMap = ccudart.cudaLaunchAttributeID.cudaLaunchAttributeMemSyncDomainMap{{endif}} - {{if 'cudaLaunchAttributeMemSyncDomain' in found_values}} - - #: Valid for streams, graph nodes, launches. See - #: :py:obj:`~.cudaLaunchAttributeValue.memSyncDomain`. - cudaLaunchAttributeMemSyncDomain = ccudart.cudaLaunchAttributeID.cudaLaunchAttributeMemSyncDomain{{endif}} - {{if 'cudaLaunchAttributeLaunchCompletionEvent' in found_values}} - - #: Valid for launches. Set - #: :py:obj:`~.cudaLaunchAttributeValue.launchCompletionEvent` to record - #: the event. - #: Nominally, the event is triggered once all blocks of the kernel - #: have begun execution. Currently this is a best effort. If a kernel B - #: has a launch completion dependency on a kernel A, B may wait until A - #: is complete. Alternatively, blocks of B may begin before all blocks - #: of A have begun, for example if B can claim execution resources - #: unavailable to A (e.g. they run on different GPUs) or if B is a - #: higher priority than A. Exercise caution if such an ordering - #: inversion could lead to deadlock. - #: A launch completion event is nominally similar to a programmatic - #: event with `triggerAtBlockStart` set except that it is not visible - #: to `cudaGridDependencySynchronize()` and can be used with compute - #: capability less than 9.0. - #: The event supplied must not be an interprocess or interop event. - #: The event must disable timing (i.e. must be created with the - #: :py:obj:`~.cudaEventDisableTiming` flag set). - cudaLaunchAttributeLaunchCompletionEvent = ccudart.cudaLaunchAttributeID.cudaLaunchAttributeLaunchCompletionEvent{{endif}} - {{if 'cudaLaunchAttributeDeviceUpdatableKernelNode' in found_values}} - - #: Valid for graph nodes, launches. This attribute is graphs-only, and - #: passing it to a launch in a non-capturing stream will result in an - #: error. - #: :cudaLaunchAttributeValue::deviceUpdatableKernelNode::deviceUpdatable - #: can only be set to 0 or 1. Setting the field to 1 indicates that the - #: corresponding kernel node should be device-updatable. On success, a - #: handle will be returned via - #: :py:obj:`~.cudaLaunchAttributeValue`::deviceUpdatableKernelNode::devNode - #: which can be passed to the various device-side update functions to - #: update the node's kernel parameters from within another kernel. For - #: more information on the types of device updates that can be made, as - #: well as the relevant limitations thereof, see - #: :py:obj:`~.cudaGraphKernelNodeUpdatesApply`. - #: Nodes which are device-updatable have additional restrictions - #: compared to regular kernel nodes. Firstly, device-updatable nodes - #: cannot be removed from their graph via - #: :py:obj:`~.cudaGraphDestroyNode`. Additionally, once opted-in to - #: this functionality, a node cannot opt out, and any attempt to set - #: the deviceUpdatable attribute to 0 will result in an error. Device- - #: updatable kernel nodes also cannot have their attributes copied - #: to/from another kernel node via - #: :py:obj:`~.cudaGraphKernelNodeCopyAttributes`. Graphs containing one - #: or more device-updatable nodes also do not allow multiple - #: instantiation, and neither the graph nor its instantiated version - #: can be passed to :py:obj:`~.cudaGraphExecUpdate`. - #: If a graph contains device-updatable nodes and updates those nodes - #: from the device from within the graph, the graph must be uploaded - #: with :py:obj:`~.cuGraphUpload` before it is launched. For such a - #: graph, if host-side executable graph updates are made to the device- - #: updatable nodes, the graph must be uploaded before it is launched - #: again. - cudaLaunchAttributeDeviceUpdatableKernelNode = ccudart.cudaLaunchAttributeID.cudaLaunchAttributeDeviceUpdatableKernelNode{{endif}} - {{if 'cudaLaunchAttributePreferredSharedMemoryCarveout' in found_values}} - - #: Valid for launches. On devices where the L1 cache and shared memory - #: use the same hardware resources, setting - #: :py:obj:`~.cudaLaunchAttributeValue.sharedMemCarveout` to a - #: percentage between 0-100 signals sets the shared memory carveout - #: preference in percent of the total shared memory for that kernel - #: launch. This attribute takes precedence over - #: :py:obj:`~.cudaFuncAttributePreferredSharedMemoryCarveout`. This is - #: only a hint, and the driver can choose a different configuration if - #: required for the launch. - cudaLaunchAttributePreferredSharedMemoryCarveout = ccudart.cudaLaunchAttributeID.cudaLaunchAttributePreferredSharedMemoryCarveout{{endif}} -{{endif}} -{{if 'cudaAsyncNotificationType_enum' in found_types}} - -class cudaAsyncNotificationType(IntEnum): - """ - Types of async notification that can occur - """ - {{if 'cudaAsyncNotificationTypeOverBudget' in found_values}} - cudaAsyncNotificationTypeOverBudget = ccudart.cudaAsyncNotificationType_enum.cudaAsyncNotificationTypeOverBudget{{endif}} -{{endif}} -{{if 'cudaDataType_t' in found_types}} - -class cudaDataType(IntEnum): - """""" - {{if 'CUDA_R_32F' in found_values}} - CUDA_R_32F = ccudart.cudaDataType_t.CUDA_R_32F{{endif}} - {{if 'CUDA_R_64F' in found_values}} - CUDA_R_64F = ccudart.cudaDataType_t.CUDA_R_64F{{endif}} - {{if 'CUDA_R_16F' in found_values}} - CUDA_R_16F = ccudart.cudaDataType_t.CUDA_R_16F{{endif}} - {{if 'CUDA_R_8I' in found_values}} - CUDA_R_8I = ccudart.cudaDataType_t.CUDA_R_8I{{endif}} - {{if 'CUDA_C_32F' in found_values}} - CUDA_C_32F = ccudart.cudaDataType_t.CUDA_C_32F{{endif}} - {{if 'CUDA_C_64F' in found_values}} - CUDA_C_64F = ccudart.cudaDataType_t.CUDA_C_64F{{endif}} - {{if 'CUDA_C_16F' in found_values}} - CUDA_C_16F = ccudart.cudaDataType_t.CUDA_C_16F{{endif}} - {{if 'CUDA_C_8I' in found_values}} - CUDA_C_8I = ccudart.cudaDataType_t.CUDA_C_8I{{endif}} - {{if 'CUDA_R_8U' in found_values}} - CUDA_R_8U = ccudart.cudaDataType_t.CUDA_R_8U{{endif}} - {{if 'CUDA_C_8U' in found_values}} - CUDA_C_8U = ccudart.cudaDataType_t.CUDA_C_8U{{endif}} - {{if 'CUDA_R_32I' in found_values}} - CUDA_R_32I = ccudart.cudaDataType_t.CUDA_R_32I{{endif}} - {{if 'CUDA_C_32I' in found_values}} - CUDA_C_32I = ccudart.cudaDataType_t.CUDA_C_32I{{endif}} - {{if 'CUDA_R_32U' in found_values}} - CUDA_R_32U = ccudart.cudaDataType_t.CUDA_R_32U{{endif}} - {{if 'CUDA_C_32U' in found_values}} - CUDA_C_32U = ccudart.cudaDataType_t.CUDA_C_32U{{endif}} - {{if 'CUDA_R_16BF' in found_values}} - CUDA_R_16BF = ccudart.cudaDataType_t.CUDA_R_16BF{{endif}} - {{if 'CUDA_C_16BF' in found_values}} - CUDA_C_16BF = ccudart.cudaDataType_t.CUDA_C_16BF{{endif}} - {{if 'CUDA_R_4I' in found_values}} - CUDA_R_4I = ccudart.cudaDataType_t.CUDA_R_4I{{endif}} - {{if 'CUDA_C_4I' in found_values}} - CUDA_C_4I = ccudart.cudaDataType_t.CUDA_C_4I{{endif}} - {{if 'CUDA_R_4U' in found_values}} - CUDA_R_4U = ccudart.cudaDataType_t.CUDA_R_4U{{endif}} - {{if 'CUDA_C_4U' in found_values}} - CUDA_C_4U = ccudart.cudaDataType_t.CUDA_C_4U{{endif}} - {{if 'CUDA_R_16I' in found_values}} - CUDA_R_16I = ccudart.cudaDataType_t.CUDA_R_16I{{endif}} - {{if 'CUDA_C_16I' in found_values}} - CUDA_C_16I = ccudart.cudaDataType_t.CUDA_C_16I{{endif}} - {{if 'CUDA_R_16U' in found_values}} - CUDA_R_16U = ccudart.cudaDataType_t.CUDA_R_16U{{endif}} - {{if 'CUDA_C_16U' in found_values}} - CUDA_C_16U = ccudart.cudaDataType_t.CUDA_C_16U{{endif}} - {{if 'CUDA_R_64I' in found_values}} - CUDA_R_64I = ccudart.cudaDataType_t.CUDA_R_64I{{endif}} - {{if 'CUDA_C_64I' in found_values}} - CUDA_C_64I = ccudart.cudaDataType_t.CUDA_C_64I{{endif}} - {{if 'CUDA_R_64U' in found_values}} - CUDA_R_64U = ccudart.cudaDataType_t.CUDA_R_64U{{endif}} - {{if 'CUDA_C_64U' in found_values}} - CUDA_C_64U = ccudart.cudaDataType_t.CUDA_C_64U{{endif}} - {{if 'CUDA_R_8F_E4M3' in found_values}} - CUDA_R_8F_E4M3 = ccudart.cudaDataType_t.CUDA_R_8F_E4M3{{endif}} - {{if 'CUDA_R_8F_E5M2' in found_values}} - CUDA_R_8F_E5M2 = ccudart.cudaDataType_t.CUDA_R_8F_E5M2{{endif}} -{{endif}} -{{if 'libraryPropertyType_t' in found_types}} - -class libraryPropertyType(IntEnum): - """""" - {{if 'MAJOR_VERSION' in found_values}} - MAJOR_VERSION = ccudart.libraryPropertyType_t.MAJOR_VERSION{{endif}} - {{if 'MINOR_VERSION' in found_values}} - MINOR_VERSION = ccudart.libraryPropertyType_t.MINOR_VERSION{{endif}} - {{if 'PATCH_LEVEL' in found_values}} - PATCH_LEVEL = ccudart.libraryPropertyType_t.PATCH_LEVEL{{endif}} -{{endif}} -{{if True}} - -class cudaEglFrameType(IntEnum): - """ - CUDA EglFrame type - array or pointer - """ - {{if True}} - - #: Frame type CUDA array - cudaEglFrameTypeArray = ccudart.cudaEglFrameType_enum.cudaEglFrameTypeArray{{endif}} - {{if True}} - #: Frame type CUDA pointer - cudaEglFrameTypePitch = ccudart.cudaEglFrameType_enum.cudaEglFrameTypePitch{{endif}} -{{endif}} -{{if True}} -class cudaEglResourceLocationFlags(IntEnum): - """ - Resource location flags- sysmem or vidmem For CUDA context on - iGPU, since video and system memory are equivalent - these flags - will not have an effect on the execution. For CUDA context on - dGPU, applications can use the flag - :py:obj:`~.cudaEglResourceLocationFlags` to give a hint about the - desired location. :py:obj:`~.cudaEglResourceLocationSysmem` - the - frame data is made resident on the system memory to be accessed by - CUDA. :py:obj:`~.cudaEglResourceLocationVidmem` - the frame data - is made resident on the dedicated video memory to be accessed by - CUDA. There may be an additional latency due to new allocation and - data migration, if the frame is produced on a different memory. - """ - {{if True}} + cudaSuccess = ( + cyruntime.cudaError.cudaSuccess, + 'The API call returned with no errors. In the case of query calls, this also\n' + 'means that the operation being queried is complete (see\n' + ':py:obj:`~.cudaEventQuery()` and :py:obj:`~.cudaStreamQuery()`).\n' + ) - #: Resource location sysmem - cudaEglResourceLocationSysmem = ccudart.cudaEglResourceLocationFlags_enum.cudaEglResourceLocationSysmem{{endif}} - {{if True}} - #: Resource location vidmem - cudaEglResourceLocationVidmem = ccudart.cudaEglResourceLocationFlags_enum.cudaEglResourceLocationVidmem{{endif}} -{{endif}} -{{if True}} + cudaErrorInvalidValue = ( + cyruntime.cudaError.cudaErrorInvalidValue, + 'This indicates that one or more of the parameters passed to the API call is\n' + 'not within an acceptable range of values.\n' + ) -class cudaEglColorFormat(IntEnum): - """ - CUDA EGL Color Format - The different planar and multiplanar - formats currently supported for CUDA_EGL interops. - """ - {{if True}} - - #: Y, U, V in three surfaces, each in a separate surface, U/V width = - #: 1/2 Y width, U/V height = 1/2 Y height. - cudaEglColorFormatYUV420Planar = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatYUV420Planar{{endif}} - {{if True}} - - #: Y, UV in two surfaces (UV as one surface) with VU byte ordering, - #: width, height ratio same as YUV420Planar. - cudaEglColorFormatYUV420SemiPlanar = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatYUV420SemiPlanar{{endif}} - {{if True}} - - #: Y, U, V each in a separate surface, U/V width = 1/2 Y width, U/V - #: height = Y height. - cudaEglColorFormatYUV422Planar = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatYUV422Planar{{endif}} - {{if True}} - - #: Y, UV in two surfaces with VU byte ordering, width, height ratio - #: same as YUV422Planar. - cudaEglColorFormatYUV422SemiPlanar = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatYUV422SemiPlanar{{endif}} - {{if True}} - - #: R/G/B/A four channels in one surface with BGRA byte ordering. - cudaEglColorFormatARGB = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatARGB{{endif}} - {{if True}} - - #: R/G/B/A four channels in one surface with ABGR byte ordering. - cudaEglColorFormatRGBA = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatRGBA{{endif}} - {{if True}} - - #: single luminance channel in one surface. - cudaEglColorFormatL = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatL{{endif}} - {{if True}} - - #: single color channel in one surface. - cudaEglColorFormatR = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatR{{endif}} - {{if True}} - - #: Y, U, V in three surfaces, each in a separate surface, U/V width = Y - #: width, U/V height = Y height. - cudaEglColorFormatYUV444Planar = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatYUV444Planar{{endif}} - {{if True}} - - #: Y, UV in two surfaces (UV as one surface) with VU byte ordering, - #: width, height ratio same as YUV444Planar. - cudaEglColorFormatYUV444SemiPlanar = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatYUV444SemiPlanar{{endif}} - {{if True}} - - #: Y, U, V in one surface, interleaved as UYVY in one channel. - cudaEglColorFormatYUYV422 = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatYUYV422{{endif}} - {{if True}} - - #: Y, U, V in one surface, interleaved as YUYV in one channel. - cudaEglColorFormatUYVY422 = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatUYVY422{{endif}} - {{if True}} - - #: R/G/B/A four channels in one surface with RGBA byte ordering. - cudaEglColorFormatABGR = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatABGR{{endif}} - {{if True}} - - #: R/G/B/A four channels in one surface with ARGB byte ordering. - cudaEglColorFormatBGRA = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatBGRA{{endif}} - {{if True}} - - #: Alpha color format - one channel in one surface. - cudaEglColorFormatA = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatA{{endif}} - {{if True}} - - #: R/G color format - two channels in one surface with GR byte ordering - cudaEglColorFormatRG = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatRG{{endif}} - {{if True}} - - #: Y, U, V, A four channels in one surface, interleaved as VUYA. - cudaEglColorFormatAYUV = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatAYUV{{endif}} - {{if True}} - - #: Y, VU in two surfaces (VU as one surface) with UV byte ordering, U/V - #: width = Y width, U/V height = Y height. - cudaEglColorFormatYVU444SemiPlanar = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatYVU444SemiPlanar{{endif}} - {{if True}} - - #: Y, VU in two surfaces (VU as one surface) with UV byte ordering, U/V - #: width = 1/2 Y width, U/V height = Y height. - cudaEglColorFormatYVU422SemiPlanar = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatYVU422SemiPlanar{{endif}} - {{if True}} - - #: Y, VU in two surfaces (VU as one surface) with UV byte ordering, U/V - #: width = 1/2 Y width, U/V height = 1/2 Y height. - cudaEglColorFormatYVU420SemiPlanar = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatYVU420SemiPlanar{{endif}} - {{if True}} - - #: Y10, V10U10 in two surfaces (VU as one surface) with UV byte - #: ordering, U/V width = Y width, U/V height = Y height. - cudaEglColorFormatY10V10U10_444SemiPlanar = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatY10V10U10_444SemiPlanar{{endif}} - {{if True}} - - #: Y10, V10U10 in two surfaces (VU as one surface) with UV byte - #: ordering, U/V width = 1/2 Y width, U/V height = 1/2 Y height. - cudaEglColorFormatY10V10U10_420SemiPlanar = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatY10V10U10_420SemiPlanar{{endif}} - {{if True}} - - #: Y12, V12U12 in two surfaces (VU as one surface) with UV byte - #: ordering, U/V width = Y width, U/V height = Y height. - cudaEglColorFormatY12V12U12_444SemiPlanar = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatY12V12U12_444SemiPlanar{{endif}} - {{if True}} - - #: Y12, V12U12 in two surfaces (VU as one surface) with UV byte - #: ordering, U/V width = 1/2 Y width, U/V height = 1/2 Y height. - cudaEglColorFormatY12V12U12_420SemiPlanar = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatY12V12U12_420SemiPlanar{{endif}} - {{if True}} - - #: Extended Range Y, U, V in one surface, interleaved as YVYU in one - #: channel. - cudaEglColorFormatVYUY_ER = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatVYUY_ER{{endif}} - {{if True}} - - #: Extended Range Y, U, V in one surface, interleaved as YUYV in one - #: channel. - cudaEglColorFormatUYVY_ER = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatUYVY_ER{{endif}} - {{if True}} - - #: Extended Range Y, U, V in one surface, interleaved as UYVY in one - #: channel. - cudaEglColorFormatYUYV_ER = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatYUYV_ER{{endif}} - {{if True}} - - #: Extended Range Y, U, V in one surface, interleaved as VYUY in one - #: channel. - cudaEglColorFormatYVYU_ER = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatYVYU_ER{{endif}} - {{if True}} - - #: Extended Range Y, U, V, A four channels in one surface, interleaved - #: as AVUY. - cudaEglColorFormatYUVA_ER = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatYUVA_ER{{endif}} - {{if True}} - - #: Extended Range Y, U, V, A four channels in one surface, interleaved - #: as VUYA. - cudaEglColorFormatAYUV_ER = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatAYUV_ER{{endif}} - {{if True}} - - #: Extended Range Y, U, V in three surfaces, U/V width = Y width, U/V - #: height = Y height. - cudaEglColorFormatYUV444Planar_ER = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatYUV444Planar_ER{{endif}} - {{if True}} - - #: Extended Range Y, U, V in three surfaces, U/V width = 1/2 Y width, - #: U/V height = Y height. - cudaEglColorFormatYUV422Planar_ER = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatYUV422Planar_ER{{endif}} - {{if True}} - - #: Extended Range Y, U, V in three surfaces, U/V width = 1/2 Y width, - #: U/V height = 1/2 Y height. - cudaEglColorFormatYUV420Planar_ER = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatYUV420Planar_ER{{endif}} - {{if True}} - - #: Extended Range Y, UV in two surfaces (UV as one surface) with VU - #: byte ordering, U/V width = Y width, U/V height = Y height. - cudaEglColorFormatYUV444SemiPlanar_ER = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatYUV444SemiPlanar_ER{{endif}} - {{if True}} - - #: Extended Range Y, UV in two surfaces (UV as one surface) with VU - #: byte ordering, U/V width = 1/2 Y width, U/V height = Y height. - cudaEglColorFormatYUV422SemiPlanar_ER = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatYUV422SemiPlanar_ER{{endif}} - {{if True}} - - #: Extended Range Y, UV in two surfaces (UV as one surface) with VU - #: byte ordering, U/V width = 1/2 Y width, U/V height = 1/2 Y height. - cudaEglColorFormatYUV420SemiPlanar_ER = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatYUV420SemiPlanar_ER{{endif}} - {{if True}} - - #: Extended Range Y, V, U in three surfaces, U/V width = Y width, U/V - #: height = Y height. - cudaEglColorFormatYVU444Planar_ER = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatYVU444Planar_ER{{endif}} - {{if True}} - - #: Extended Range Y, V, U in three surfaces, U/V width = 1/2 Y width, - #: U/V height = Y height. - cudaEglColorFormatYVU422Planar_ER = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatYVU422Planar_ER{{endif}} - {{if True}} - - #: Extended Range Y, V, U in three surfaces, U/V width = 1/2 Y width, - #: U/V height = 1/2 Y height. - cudaEglColorFormatYVU420Planar_ER = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatYVU420Planar_ER{{endif}} - {{if True}} - - #: Extended Range Y, VU in two surfaces (VU as one surface) with UV - #: byte ordering, U/V width = Y width, U/V height = Y height. - cudaEglColorFormatYVU444SemiPlanar_ER = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatYVU444SemiPlanar_ER{{endif}} - {{if True}} - - #: Extended Range Y, VU in two surfaces (VU as one surface) with UV - #: byte ordering, U/V width = 1/2 Y width, U/V height = Y height. - cudaEglColorFormatYVU422SemiPlanar_ER = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatYVU422SemiPlanar_ER{{endif}} - {{if True}} - - #: Extended Range Y, VU in two surfaces (VU as one surface) with UV - #: byte ordering, U/V width = 1/2 Y width, U/V height = 1/2 Y height. - cudaEglColorFormatYVU420SemiPlanar_ER = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatYVU420SemiPlanar_ER{{endif}} - {{if True}} - - #: Bayer format - one channel in one surface with interleaved RGGB - #: ordering. - cudaEglColorFormatBayerRGGB = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatBayerRGGB{{endif}} - {{if True}} - - #: Bayer format - one channel in one surface with interleaved BGGR - #: ordering. - cudaEglColorFormatBayerBGGR = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatBayerBGGR{{endif}} - {{if True}} - - #: Bayer format - one channel in one surface with interleaved GRBG - #: ordering. - cudaEglColorFormatBayerGRBG = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatBayerGRBG{{endif}} - {{if True}} - - #: Bayer format - one channel in one surface with interleaved GBRG - #: ordering. - cudaEglColorFormatBayerGBRG = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatBayerGBRG{{endif}} - {{if True}} - - #: Bayer10 format - one channel in one surface with interleaved RGGB - #: ordering. Out of 16 bits, 10 bits used 6 bits No-op. - cudaEglColorFormatBayer10RGGB = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatBayer10RGGB{{endif}} - {{if True}} - - #: Bayer10 format - one channel in one surface with interleaved BGGR - #: ordering. Out of 16 bits, 10 bits used 6 bits No-op. - cudaEglColorFormatBayer10BGGR = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatBayer10BGGR{{endif}} - {{if True}} - - #: Bayer10 format - one channel in one surface with interleaved GRBG - #: ordering. Out of 16 bits, 10 bits used 6 bits No-op. - cudaEglColorFormatBayer10GRBG = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatBayer10GRBG{{endif}} - {{if True}} - - #: Bayer10 format - one channel in one surface with interleaved GBRG - #: ordering. Out of 16 bits, 10 bits used 6 bits No-op. - cudaEglColorFormatBayer10GBRG = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatBayer10GBRG{{endif}} - {{if True}} - - #: Bayer12 format - one channel in one surface with interleaved RGGB - #: ordering. Out of 16 bits, 12 bits used 4 bits No-op. - cudaEglColorFormatBayer12RGGB = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatBayer12RGGB{{endif}} - {{if True}} - - #: Bayer12 format - one channel in one surface with interleaved BGGR - #: ordering. Out of 16 bits, 12 bits used 4 bits No-op. - cudaEglColorFormatBayer12BGGR = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatBayer12BGGR{{endif}} - {{if True}} - - #: Bayer12 format - one channel in one surface with interleaved GRBG - #: ordering. Out of 16 bits, 12 bits used 4 bits No-op. - cudaEglColorFormatBayer12GRBG = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatBayer12GRBG{{endif}} - {{if True}} - - #: Bayer12 format - one channel in one surface with interleaved GBRG - #: ordering. Out of 16 bits, 12 bits used 4 bits No-op. - cudaEglColorFormatBayer12GBRG = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatBayer12GBRG{{endif}} - {{if True}} - - #: Bayer14 format - one channel in one surface with interleaved RGGB - #: ordering. Out of 16 bits, 14 bits used 2 bits No-op. - cudaEglColorFormatBayer14RGGB = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatBayer14RGGB{{endif}} - {{if True}} - - #: Bayer14 format - one channel in one surface with interleaved BGGR - #: ordering. Out of 16 bits, 14 bits used 2 bits No-op. - cudaEglColorFormatBayer14BGGR = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatBayer14BGGR{{endif}} - {{if True}} - - #: Bayer14 format - one channel in one surface with interleaved GRBG - #: ordering. Out of 16 bits, 14 bits used 2 bits No-op. - cudaEglColorFormatBayer14GRBG = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatBayer14GRBG{{endif}} - {{if True}} - - #: Bayer14 format - one channel in one surface with interleaved GBRG - #: ordering. Out of 16 bits, 14 bits used 2 bits No-op. - cudaEglColorFormatBayer14GBRG = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatBayer14GBRG{{endif}} - {{if True}} - - #: Bayer20 format - one channel in one surface with interleaved RGGB - #: ordering. Out of 32 bits, 20 bits used 12 bits No-op. - cudaEglColorFormatBayer20RGGB = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatBayer20RGGB{{endif}} - {{if True}} - - #: Bayer20 format - one channel in one surface with interleaved BGGR - #: ordering. Out of 32 bits, 20 bits used 12 bits No-op. - cudaEglColorFormatBayer20BGGR = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatBayer20BGGR{{endif}} - {{if True}} - - #: Bayer20 format - one channel in one surface with interleaved GRBG - #: ordering. Out of 32 bits, 20 bits used 12 bits No-op. - cudaEglColorFormatBayer20GRBG = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatBayer20GRBG{{endif}} - {{if True}} - - #: Bayer20 format - one channel in one surface with interleaved GBRG - #: ordering. Out of 32 bits, 20 bits used 12 bits No-op. - cudaEglColorFormatBayer20GBRG = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatBayer20GBRG{{endif}} - {{if True}} - - #: Y, V, U in three surfaces, each in a separate surface, U/V width = Y - #: width, U/V height = Y height. - cudaEglColorFormatYVU444Planar = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatYVU444Planar{{endif}} - {{if True}} - - #: Y, V, U in three surfaces, each in a separate surface, U/V width = - #: 1/2 Y width, U/V height = Y height. - cudaEglColorFormatYVU422Planar = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatYVU422Planar{{endif}} - {{if True}} - - #: Y, V, U in three surfaces, each in a separate surface, U/V width = - #: 1/2 Y width, U/V height = 1/2 Y height. - cudaEglColorFormatYVU420Planar = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatYVU420Planar{{endif}} - {{if True}} - - #: Nvidia proprietary Bayer ISP format - one channel in one surface - #: with interleaved RGGB ordering and mapped to opaque integer - #: datatype. - cudaEglColorFormatBayerIspRGGB = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatBayerIspRGGB{{endif}} - {{if True}} - - #: Nvidia proprietary Bayer ISP format - one channel in one surface - #: with interleaved BGGR ordering and mapped to opaque integer - #: datatype. - cudaEglColorFormatBayerIspBGGR = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatBayerIspBGGR{{endif}} - {{if True}} - - #: Nvidia proprietary Bayer ISP format - one channel in one surface - #: with interleaved GRBG ordering and mapped to opaque integer - #: datatype. - cudaEglColorFormatBayerIspGRBG = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatBayerIspGRBG{{endif}} - {{if True}} - - #: Nvidia proprietary Bayer ISP format - one channel in one surface - #: with interleaved GBRG ordering and mapped to opaque integer - #: datatype. - cudaEglColorFormatBayerIspGBRG = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatBayerIspGBRG{{endif}} - {{if True}} - - #: Bayer format - one channel in one surface with interleaved BCCR - #: ordering. - cudaEglColorFormatBayerBCCR = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatBayerBCCR{{endif}} - {{if True}} - - #: Bayer format - one channel in one surface with interleaved RCCB - #: ordering. - cudaEglColorFormatBayerRCCB = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatBayerRCCB{{endif}} - {{if True}} - - #: Bayer format - one channel in one surface with interleaved CRBC - #: ordering. - cudaEglColorFormatBayerCRBC = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatBayerCRBC{{endif}} - {{if True}} - - #: Bayer format - one channel in one surface with interleaved CBRC - #: ordering. - cudaEglColorFormatBayerCBRC = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatBayerCBRC{{endif}} - {{if True}} - - #: Bayer10 format - one channel in one surface with interleaved CCCC - #: ordering. Out of 16 bits, 10 bits used 6 bits No-op. - cudaEglColorFormatBayer10CCCC = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatBayer10CCCC{{endif}} - {{if True}} - - #: Bayer12 format - one channel in one surface with interleaved BCCR - #: ordering. Out of 16 bits, 12 bits used 4 bits No-op. - cudaEglColorFormatBayer12BCCR = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatBayer12BCCR{{endif}} - {{if True}} - - #: Bayer12 format - one channel in one surface with interleaved RCCB - #: ordering. Out of 16 bits, 12 bits used 4 bits No-op. - cudaEglColorFormatBayer12RCCB = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatBayer12RCCB{{endif}} - {{if True}} - - #: Bayer12 format - one channel in one surface with interleaved CRBC - #: ordering. Out of 16 bits, 12 bits used 4 bits No-op. - cudaEglColorFormatBayer12CRBC = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatBayer12CRBC{{endif}} - {{if True}} - - #: Bayer12 format - one channel in one surface with interleaved CBRC - #: ordering. Out of 16 bits, 12 bits used 4 bits No-op. - cudaEglColorFormatBayer12CBRC = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatBayer12CBRC{{endif}} - {{if True}} - - #: Bayer12 format - one channel in one surface with interleaved CCCC - #: ordering. Out of 16 bits, 12 bits used 4 bits No-op. - cudaEglColorFormatBayer12CCCC = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatBayer12CCCC{{endif}} - {{if True}} - - #: Color format for single Y plane. - cudaEglColorFormatY = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatY{{endif}} - {{if True}} - - #: Y, UV in two surfaces (UV as one surface) U/V width = 1/2 Y width, - #: U/V height = 1/2 Y height. - cudaEglColorFormatYUV420SemiPlanar_2020 = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatYUV420SemiPlanar_2020{{endif}} - {{if True}} - - #: Y, VU in two surfaces (VU as one surface) U/V width = 1/2 Y width, - #: U/V height = 1/2 Y height. - cudaEglColorFormatYVU420SemiPlanar_2020 = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatYVU420SemiPlanar_2020{{endif}} - {{if True}} - - #: Y, U, V in three surfaces, each in a separate surface, U/V width = - #: 1/2 Y width, U/V height = 1/2 Y height. - cudaEglColorFormatYUV420Planar_2020 = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatYUV420Planar_2020{{endif}} - {{if True}} - - #: Y, V, U in three surfaces, each in a separate surface, U/V width = - #: 1/2 Y width, U/V height = 1/2 Y height. - cudaEglColorFormatYVU420Planar_2020 = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatYVU420Planar_2020{{endif}} - {{if True}} - - #: Y, UV in two surfaces (UV as one surface) U/V width = 1/2 Y width, - #: U/V height = 1/2 Y height. - cudaEglColorFormatYUV420SemiPlanar_709 = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatYUV420SemiPlanar_709{{endif}} - {{if True}} - - #: Y, VU in two surfaces (VU as one surface) U/V width = 1/2 Y width, - #: U/V height = 1/2 Y height. - cudaEglColorFormatYVU420SemiPlanar_709 = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatYVU420SemiPlanar_709{{endif}} - {{if True}} - - #: Y, U, V in three surfaces, each in a separate surface, U/V width = - #: 1/2 Y width, U/V height = 1/2 Y height. - cudaEglColorFormatYUV420Planar_709 = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatYUV420Planar_709{{endif}} - {{if True}} - - #: Y, V, U in three surfaces, each in a separate surface, U/V width = - #: 1/2 Y width, U/V height = 1/2 Y height. - cudaEglColorFormatYVU420Planar_709 = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatYVU420Planar_709{{endif}} - {{if True}} - - #: Y10, V10U10 in two surfaces (VU as one surface) U/V width = 1/2 Y - #: width, U/V height = 1/2 Y height. - cudaEglColorFormatY10V10U10_420SemiPlanar_709 = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatY10V10U10_420SemiPlanar_709{{endif}} - {{if True}} - - #: Y10, V10U10 in two surfaces (VU as one surface) U/V width = 1/2 Y - #: width, U/V height = 1/2 Y height. - cudaEglColorFormatY10V10U10_420SemiPlanar_2020 = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatY10V10U10_420SemiPlanar_2020{{endif}} - {{if True}} - - #: Y10, V10U10 in two surfaces (VU as one surface) U/V width = 1/2 Y - #: width, U/V height = Y height. - cudaEglColorFormatY10V10U10_422SemiPlanar_2020 = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatY10V10U10_422SemiPlanar_2020{{endif}} - {{if True}} - - #: Y10, V10U10 in two surfaces (VU as one surface) U/V width = 1/2 Y - #: width, U/V height = Y height. - cudaEglColorFormatY10V10U10_422SemiPlanar = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatY10V10U10_422SemiPlanar{{endif}} - {{if True}} - - #: Y10, V10U10 in two surfaces (VU as one surface) U/V width = 1/2 Y - #: width, U/V height = Y height. - cudaEglColorFormatY10V10U10_422SemiPlanar_709 = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatY10V10U10_422SemiPlanar_709{{endif}} - {{if True}} - - #: Extended Range Color format for single Y plane. - cudaEglColorFormatY_ER = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatY_ER{{endif}} - {{if True}} - - #: Extended Range Color format for single Y plane. - cudaEglColorFormatY_709_ER = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatY_709_ER{{endif}} - {{if True}} - - #: Extended Range Color format for single Y10 plane. - cudaEglColorFormatY10_ER = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatY10_ER{{endif}} - {{if True}} - - #: Extended Range Color format for single Y10 plane. - cudaEglColorFormatY10_709_ER = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatY10_709_ER{{endif}} - {{if True}} - - #: Extended Range Color format for single Y12 plane. - cudaEglColorFormatY12_ER = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatY12_ER{{endif}} - {{if True}} - - #: Extended Range Color format for single Y12 plane. - cudaEglColorFormatY12_709_ER = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatY12_709_ER{{endif}} - {{if True}} - - #: Y, U, V, A four channels in one surface, interleaved as AVUY. - cudaEglColorFormatYUVA = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatYUVA{{endif}} - {{if True}} - - #: Y, U, V in one surface, interleaved as YVYU in one channel. - cudaEglColorFormatYVYU = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatYVYU{{endif}} - {{if True}} - - #: Y, U, V in one surface, interleaved as VYUY in one channel. - cudaEglColorFormatVYUY = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatVYUY{{endif}} - {{if True}} - - #: Extended Range Y10, V10U10 in two surfaces (VU as one surface) U/V - #: width = 1/2 Y width, U/V height = 1/2 Y height. - cudaEglColorFormatY10V10U10_420SemiPlanar_ER = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatY10V10U10_420SemiPlanar_ER{{endif}} - {{if True}} - - #: Extended Range Y10, V10U10 in two surfaces (VU as one surface) U/V - #: width = 1/2 Y width, U/V height = 1/2 Y height. - cudaEglColorFormatY10V10U10_420SemiPlanar_709_ER = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatY10V10U10_420SemiPlanar_709_ER{{endif}} - {{if True}} - - #: Extended Range Y10, V10U10 in two surfaces (VU as one surface) U/V - #: width = Y width, U/V height = Y height. - cudaEglColorFormatY10V10U10_444SemiPlanar_ER = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatY10V10U10_444SemiPlanar_ER{{endif}} - {{if True}} - - #: Extended Range Y10, V10U10 in two surfaces (VU as one surface) U/V - #: width = Y width, U/V height = Y height. - cudaEglColorFormatY10V10U10_444SemiPlanar_709_ER = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatY10V10U10_444SemiPlanar_709_ER{{endif}} - {{if True}} - - #: Extended Range Y12, V12U12 in two surfaces (VU as one surface) U/V - #: width = 1/2 Y width, U/V height = 1/2 Y height. - cudaEglColorFormatY12V12U12_420SemiPlanar_ER = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatY12V12U12_420SemiPlanar_ER{{endif}} - {{if True}} - - #: Extended Range Y12, V12U12 in two surfaces (VU as one surface) U/V - #: width = 1/2 Y width, U/V height = 1/2 Y height. - cudaEglColorFormatY12V12U12_420SemiPlanar_709_ER = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatY12V12U12_420SemiPlanar_709_ER{{endif}} - {{if True}} - - #: Extended Range Y12, V12U12 in two surfaces (VU as one surface) U/V - #: width = Y width, U/V height = Y height. - cudaEglColorFormatY12V12U12_444SemiPlanar_ER = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatY12V12U12_444SemiPlanar_ER{{endif}} - {{if True}} - - #: Extended Range Y12, V12U12 in two surfaces (VU as one surface) U/V - #: width = Y width, U/V height = Y height. - cudaEglColorFormatY12V12U12_444SemiPlanar_709_ER = ccudart.cudaEglColorFormat_enum.cudaEglColorFormatY12V12U12_444SemiPlanar_709_ER{{endif}} -{{endif}} -{{if 'cudaChannelFormatKind' in found_types}} - -class cudaChannelFormatKind(IntEnum): - """ - Channel format kind - """ - {{if 'cudaChannelFormatKindSigned' in found_values}} - #: Signed channel format - cudaChannelFormatKindSigned = ccudart.cudaChannelFormatKind.cudaChannelFormatKindSigned{{endif}} - {{if 'cudaChannelFormatKindUnsigned' in found_values}} + cudaErrorMemoryAllocation = ( + cyruntime.cudaError.cudaErrorMemoryAllocation, + 'The API call failed because it was unable to allocate enough memory or\n' + 'other resources to perform the requested operation.\n' + ) - #: Unsigned channel format - cudaChannelFormatKindUnsigned = ccudart.cudaChannelFormatKind.cudaChannelFormatKindUnsigned{{endif}} - {{if 'cudaChannelFormatKindFloat' in found_values}} - #: Float channel format - cudaChannelFormatKindFloat = ccudart.cudaChannelFormatKind.cudaChannelFormatKindFloat{{endif}} - {{if 'cudaChannelFormatKindNone' in found_values}} - - #: No channel format - cudaChannelFormatKindNone = ccudart.cudaChannelFormatKind.cudaChannelFormatKindNone{{endif}} - {{if 'cudaChannelFormatKindNV12' in found_values}} - - #: Unsigned 8-bit integers, planar 4:2:0 YUV format - cudaChannelFormatKindNV12 = ccudart.cudaChannelFormatKind.cudaChannelFormatKindNV12{{endif}} - {{if 'cudaChannelFormatKindUnsignedNormalized8X1' in found_values}} - - #: 1 channel unsigned 8-bit normalized integer - cudaChannelFormatKindUnsignedNormalized8X1 = ccudart.cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized8X1{{endif}} - {{if 'cudaChannelFormatKindUnsignedNormalized8X2' in found_values}} - - #: 2 channel unsigned 8-bit normalized integer - cudaChannelFormatKindUnsignedNormalized8X2 = ccudart.cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized8X2{{endif}} - {{if 'cudaChannelFormatKindUnsignedNormalized8X4' in found_values}} - - #: 4 channel unsigned 8-bit normalized integer - cudaChannelFormatKindUnsignedNormalized8X4 = ccudart.cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized8X4{{endif}} - {{if 'cudaChannelFormatKindUnsignedNormalized16X1' in found_values}} - - #: 1 channel unsigned 16-bit normalized integer - cudaChannelFormatKindUnsignedNormalized16X1 = ccudart.cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized16X1{{endif}} - {{if 'cudaChannelFormatKindUnsignedNormalized16X2' in found_values}} - - #: 2 channel unsigned 16-bit normalized integer - cudaChannelFormatKindUnsignedNormalized16X2 = ccudart.cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized16X2{{endif}} - {{if 'cudaChannelFormatKindUnsignedNormalized16X4' in found_values}} - - #: 4 channel unsigned 16-bit normalized integer - cudaChannelFormatKindUnsignedNormalized16X4 = ccudart.cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized16X4{{endif}} - {{if 'cudaChannelFormatKindSignedNormalized8X1' in found_values}} - - #: 1 channel signed 8-bit normalized integer - cudaChannelFormatKindSignedNormalized8X1 = ccudart.cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized8X1{{endif}} - {{if 'cudaChannelFormatKindSignedNormalized8X2' in found_values}} - - #: 2 channel signed 8-bit normalized integer - cudaChannelFormatKindSignedNormalized8X2 = ccudart.cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized8X2{{endif}} - {{if 'cudaChannelFormatKindSignedNormalized8X4' in found_values}} - - #: 4 channel signed 8-bit normalized integer - cudaChannelFormatKindSignedNormalized8X4 = ccudart.cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized8X4{{endif}} - {{if 'cudaChannelFormatKindSignedNormalized16X1' in found_values}} - - #: 1 channel signed 16-bit normalized integer - cudaChannelFormatKindSignedNormalized16X1 = ccudart.cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized16X1{{endif}} - {{if 'cudaChannelFormatKindSignedNormalized16X2' in found_values}} - - #: 2 channel signed 16-bit normalized integer - cudaChannelFormatKindSignedNormalized16X2 = ccudart.cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized16X2{{endif}} - {{if 'cudaChannelFormatKindSignedNormalized16X4' in found_values}} - - #: 4 channel signed 16-bit normalized integer - cudaChannelFormatKindSignedNormalized16X4 = ccudart.cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized16X4{{endif}} - {{if 'cudaChannelFormatKindUnsignedBlockCompressed1' in found_values}} - - #: 4 channel unsigned normalized block-compressed (BC1 compression) - #: format - cudaChannelFormatKindUnsignedBlockCompressed1 = ccudart.cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed1{{endif}} - {{if 'cudaChannelFormatKindUnsignedBlockCompressed1SRGB' in found_values}} - - #: 4 channel unsigned normalized block-compressed (BC1 compression) - #: format with sRGB encoding - cudaChannelFormatKindUnsignedBlockCompressed1SRGB = ccudart.cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed1SRGB{{endif}} - {{if 'cudaChannelFormatKindUnsignedBlockCompressed2' in found_values}} - - #: 4 channel unsigned normalized block-compressed (BC2 compression) - #: format - cudaChannelFormatKindUnsignedBlockCompressed2 = ccudart.cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed2{{endif}} - {{if 'cudaChannelFormatKindUnsignedBlockCompressed2SRGB' in found_values}} - - #: 4 channel unsigned normalized block-compressed (BC2 compression) - #: format with sRGB encoding - cudaChannelFormatKindUnsignedBlockCompressed2SRGB = ccudart.cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed2SRGB{{endif}} - {{if 'cudaChannelFormatKindUnsignedBlockCompressed3' in found_values}} - - #: 4 channel unsigned normalized block-compressed (BC3 compression) - #: format - cudaChannelFormatKindUnsignedBlockCompressed3 = ccudart.cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed3{{endif}} - {{if 'cudaChannelFormatKindUnsignedBlockCompressed3SRGB' in found_values}} - - #: 4 channel unsigned normalized block-compressed (BC3 compression) - #: format with sRGB encoding - cudaChannelFormatKindUnsignedBlockCompressed3SRGB = ccudart.cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed3SRGB{{endif}} - {{if 'cudaChannelFormatKindUnsignedBlockCompressed4' in found_values}} - - #: 1 channel unsigned normalized block-compressed (BC4 compression) - #: format - cudaChannelFormatKindUnsignedBlockCompressed4 = ccudart.cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed4{{endif}} - {{if 'cudaChannelFormatKindSignedBlockCompressed4' in found_values}} - - #: 1 channel signed normalized block-compressed (BC4 compression) - #: format - cudaChannelFormatKindSignedBlockCompressed4 = ccudart.cudaChannelFormatKind.cudaChannelFormatKindSignedBlockCompressed4{{endif}} - {{if 'cudaChannelFormatKindUnsignedBlockCompressed5' in found_values}} - - #: 2 channel unsigned normalized block-compressed (BC5 compression) - #: format - cudaChannelFormatKindUnsignedBlockCompressed5 = ccudart.cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed5{{endif}} - {{if 'cudaChannelFormatKindSignedBlockCompressed5' in found_values}} - - #: 2 channel signed normalized block-compressed (BC5 compression) - #: format - cudaChannelFormatKindSignedBlockCompressed5 = ccudart.cudaChannelFormatKind.cudaChannelFormatKindSignedBlockCompressed5{{endif}} - {{if 'cudaChannelFormatKindUnsignedBlockCompressed6H' in found_values}} - - #: 3 channel unsigned half-float block-compressed (BC6H compression) - #: format - cudaChannelFormatKindUnsignedBlockCompressed6H = ccudart.cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed6H{{endif}} - {{if 'cudaChannelFormatKindSignedBlockCompressed6H' in found_values}} - - #: 3 channel signed half-float block-compressed (BC6H compression) - #: format - cudaChannelFormatKindSignedBlockCompressed6H = ccudart.cudaChannelFormatKind.cudaChannelFormatKindSignedBlockCompressed6H{{endif}} - {{if 'cudaChannelFormatKindUnsignedBlockCompressed7' in found_values}} - - #: 4 channel unsigned normalized block-compressed (BC7 compression) - #: format - cudaChannelFormatKindUnsignedBlockCompressed7 = ccudart.cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed7{{endif}} - {{if 'cudaChannelFormatKindUnsignedBlockCompressed7SRGB' in found_values}} - - #: 4 channel unsigned normalized block-compressed (BC7 compression) - #: format with sRGB encoding - cudaChannelFormatKindUnsignedBlockCompressed7SRGB = ccudart.cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed7SRGB{{endif}} -{{endif}} -{{if 'cudaMemoryType' in found_types}} - -class cudaMemoryType(IntEnum): - """ - CUDA memory types - """ - {{if 'cudaMemoryTypeUnregistered' in found_values}} + cudaErrorInitializationError = ( + cyruntime.cudaError.cudaErrorInitializationError, + 'The API call failed because the CUDA driver and runtime could not be\n' + 'initialized.\n' + ) - #: Unregistered memory - cudaMemoryTypeUnregistered = ccudart.cudaMemoryType.cudaMemoryTypeUnregistered{{endif}} - {{if 'cudaMemoryTypeHost' in found_values}} - #: Host memory - cudaMemoryTypeHost = ccudart.cudaMemoryType.cudaMemoryTypeHost{{endif}} - {{if 'cudaMemoryTypeDevice' in found_values}} + cudaErrorCudartUnloading = ( + cyruntime.cudaError.cudaErrorCudartUnloading, + 'This indicates that a CUDA Runtime API call cannot be executed because it\n' + 'is being called during process shut down, at a point in time after CUDA\n' + 'driver has been unloaded.\n' + ) - #: Device memory - cudaMemoryTypeDevice = ccudart.cudaMemoryType.cudaMemoryTypeDevice{{endif}} - {{if 'cudaMemoryTypeManaged' in found_values}} - #: Managed memory - cudaMemoryTypeManaged = ccudart.cudaMemoryType.cudaMemoryTypeManaged{{endif}} -{{endif}} -{{if 'cudaMemcpyKind' in found_types}} + cudaErrorProfilerDisabled = ( + cyruntime.cudaError.cudaErrorProfilerDisabled, + 'This indicates profiler is not initialized for this run. This can happen\n' + 'when the application is running with external profiling tools like visual\n' + 'profiler.\n' + ) -class cudaMemcpyKind(IntEnum): - """ - CUDA memory copy types - """ - {{if 'cudaMemcpyHostToHost' in found_values}} - #: Host -> Host - cudaMemcpyHostToHost = ccudart.cudaMemcpyKind.cudaMemcpyHostToHost{{endif}} - {{if 'cudaMemcpyHostToDevice' in found_values}} + cudaErrorProfilerNotInitialized = ( + cyruntime.cudaError.cudaErrorProfilerNotInitialized, + '[Deprecated]\n' + ) - #: Host -> Device - cudaMemcpyHostToDevice = ccudart.cudaMemcpyKind.cudaMemcpyHostToDevice{{endif}} - {{if 'cudaMemcpyDeviceToHost' in found_values}} - #: Device -> Host - cudaMemcpyDeviceToHost = ccudart.cudaMemcpyKind.cudaMemcpyDeviceToHost{{endif}} - {{if 'cudaMemcpyDeviceToDevice' in found_values}} + cudaErrorProfilerAlreadyStarted = ( + cyruntime.cudaError.cudaErrorProfilerAlreadyStarted, + '[Deprecated]\n' + ) - #: Device -> Device - cudaMemcpyDeviceToDevice = ccudart.cudaMemcpyKind.cudaMemcpyDeviceToDevice{{endif}} - {{if 'cudaMemcpyDefault' in found_values}} - #: Direction of the transfer is inferred from the pointer values. - #: Requires unified virtual addressing - cudaMemcpyDefault = ccudart.cudaMemcpyKind.cudaMemcpyDefault{{endif}} -{{endif}} -{{if 'cudaAccessProperty' in found_types}} + cudaErrorProfilerAlreadyStopped = ( + cyruntime.cudaError.cudaErrorProfilerAlreadyStopped, + '[Deprecated]\n' + ) -class cudaAccessProperty(IntEnum): - """ - Specifies performance hint with :py:obj:`~.cudaAccessPolicyWindow` - for hitProp and missProp members. - """ - {{if 'cudaAccessPropertyNormal' in found_values}} - #: Normal cache persistence. - cudaAccessPropertyNormal = ccudart.cudaAccessProperty.cudaAccessPropertyNormal{{endif}} - {{if 'cudaAccessPropertyStreaming' in found_values}} + cudaErrorInvalidConfiguration = ( + cyruntime.cudaError.cudaErrorInvalidConfiguration, + 'This indicates that a kernel launch is requesting resources that can never\n' + 'be satisfied by the current device. Requesting more shared memory per block\n' + 'than the device supports will trigger this error, as will requesting too\n' + 'many threads or blocks. See :py:obj:`~.cudaDeviceProp` for more device\n' + 'limitations.\n' + ) - #: Streaming access is less likely to persit from cache. - cudaAccessPropertyStreaming = ccudart.cudaAccessProperty.cudaAccessPropertyStreaming{{endif}} - {{if 'cudaAccessPropertyPersisting' in found_values}} - #: Persisting access is more likely to persist in cache. - cudaAccessPropertyPersisting = ccudart.cudaAccessProperty.cudaAccessPropertyPersisting{{endif}} -{{endif}} -{{if 'cudaStreamCaptureStatus' in found_types}} + cudaErrorVersionTranslation = ( + cyruntime.cudaError.cudaErrorVersionTranslation, + 'This indicates that the driver is newer than the runtime version and\n' + 'returned graph node parameter information that the runtime does not\n' + 'understand and is unable to translate.\n' + ) -class cudaStreamCaptureStatus(IntEnum): - """ - Possible stream capture statuses returned by - :py:obj:`~.cudaStreamIsCapturing` - """ - {{if 'cudaStreamCaptureStatusNone' in found_values}} - #: Stream is not capturing - cudaStreamCaptureStatusNone = ccudart.cudaStreamCaptureStatus.cudaStreamCaptureStatusNone{{endif}} - {{if 'cudaStreamCaptureStatusActive' in found_values}} + cudaErrorInvalidPitchValue = ( + cyruntime.cudaError.cudaErrorInvalidPitchValue, + 'This indicates that one or more of the pitch-related parameters passed to\n' + 'the API call is not within the acceptable range for pitch.\n' + ) - #: Stream is actively capturing - cudaStreamCaptureStatusActive = ccudart.cudaStreamCaptureStatus.cudaStreamCaptureStatusActive{{endif}} - {{if 'cudaStreamCaptureStatusInvalidated' in found_values}} - #: Stream is part of a capture sequence that has been invalidated, but - #: not terminated - cudaStreamCaptureStatusInvalidated = ccudart.cudaStreamCaptureStatus.cudaStreamCaptureStatusInvalidated{{endif}} -{{endif}} -{{if 'cudaStreamCaptureMode' in found_types}} + cudaErrorInvalidSymbol = ( + cyruntime.cudaError.cudaErrorInvalidSymbol, + 'This indicates that the symbol name/identifier passed to the API call is\n' + 'not a valid name or identifier.\n' + ) -class cudaStreamCaptureMode(IntEnum): - """ - Possible modes for stream capture thread interactions. For more - details see :py:obj:`~.cudaStreamBeginCapture` and - :py:obj:`~.cudaThreadExchangeStreamCaptureMode` - """ - {{if 'cudaStreamCaptureModeGlobal' in found_values}} - cudaStreamCaptureModeGlobal = ccudart.cudaStreamCaptureMode.cudaStreamCaptureModeGlobal{{endif}} - {{if 'cudaStreamCaptureModeThreadLocal' in found_values}} - cudaStreamCaptureModeThreadLocal = ccudart.cudaStreamCaptureMode.cudaStreamCaptureModeThreadLocal{{endif}} - {{if 'cudaStreamCaptureModeRelaxed' in found_values}} - cudaStreamCaptureModeRelaxed = ccudart.cudaStreamCaptureMode.cudaStreamCaptureModeRelaxed{{endif}} -{{endif}} -{{if 'cudaSynchronizationPolicy' in found_types}} -class cudaSynchronizationPolicy(IntEnum): - """ + cudaErrorInvalidHostPointer = ( + cyruntime.cudaError.cudaErrorInvalidHostPointer, + 'This indicates that at least one host pointer passed to the API call is not\n' + 'a valid host pointer.\n' + '[Deprecated]\n' + ) - """ - {{if 'cudaSyncPolicyAuto' in found_values}} - cudaSyncPolicyAuto = ccudart.cudaSynchronizationPolicy.cudaSyncPolicyAuto{{endif}} - {{if 'cudaSyncPolicySpin' in found_values}} - cudaSyncPolicySpin = ccudart.cudaSynchronizationPolicy.cudaSyncPolicySpin{{endif}} - {{if 'cudaSyncPolicyYield' in found_values}} - cudaSyncPolicyYield = ccudart.cudaSynchronizationPolicy.cudaSyncPolicyYield{{endif}} - {{if 'cudaSyncPolicyBlockingSync' in found_values}} - cudaSyncPolicyBlockingSync = ccudart.cudaSynchronizationPolicy.cudaSyncPolicyBlockingSync{{endif}} -{{endif}} -{{if 'cudaClusterSchedulingPolicy' in found_types}} -class cudaClusterSchedulingPolicy(IntEnum): - """ - Cluster scheduling policies. These may be passed to - :py:obj:`~.cudaFuncSetAttribute` - """ - {{if 'cudaClusterSchedulingPolicyDefault' in found_values}} + cudaErrorInvalidDevicePointer = ( + cyruntime.cudaError.cudaErrorInvalidDevicePointer, + 'This indicates that at least one device pointer passed to the API call is\n' + 'not a valid device pointer.\n' + '[Deprecated]\n' + ) - #: the default policy - cudaClusterSchedulingPolicyDefault = ccudart.cudaClusterSchedulingPolicy.cudaClusterSchedulingPolicyDefault{{endif}} - {{if 'cudaClusterSchedulingPolicySpread' in found_values}} - #: spread the blocks within a cluster to the SMs - cudaClusterSchedulingPolicySpread = ccudart.cudaClusterSchedulingPolicy.cudaClusterSchedulingPolicySpread{{endif}} - {{if 'cudaClusterSchedulingPolicyLoadBalancing' in found_values}} + cudaErrorInvalidTexture = ( + cyruntime.cudaError.cudaErrorInvalidTexture, + 'This indicates that the texture passed to the API call is not a valid\n' + 'texture.\n' + ) - #: allow the hardware to load-balance the blocks in a cluster to the - #: SMs - cudaClusterSchedulingPolicyLoadBalancing = ccudart.cudaClusterSchedulingPolicy.cudaClusterSchedulingPolicyLoadBalancing{{endif}} -{{endif}} -{{if 'cudaStreamUpdateCaptureDependenciesFlags' in found_types}} -class cudaStreamUpdateCaptureDependenciesFlags(IntEnum): - """ - Flags for :py:obj:`~.cudaStreamUpdateCaptureDependencies` - """ - {{if 'cudaStreamAddCaptureDependencies' in found_values}} + cudaErrorInvalidTextureBinding = ( + cyruntime.cudaError.cudaErrorInvalidTextureBinding, + 'This indicates that the texture binding is not valid. This occurs if you\n' + 'call :py:obj:`~.cudaGetTextureAlignmentOffset()` with an unbound texture.\n' + ) - #: Add new nodes to the dependency set - cudaStreamAddCaptureDependencies = ccudart.cudaStreamUpdateCaptureDependenciesFlags.cudaStreamAddCaptureDependencies{{endif}} - {{if 'cudaStreamSetCaptureDependencies' in found_values}} - #: Replace the dependency set with the new nodes - cudaStreamSetCaptureDependencies = ccudart.cudaStreamUpdateCaptureDependenciesFlags.cudaStreamSetCaptureDependencies{{endif}} -{{endif}} -{{if 'cudaUserObjectFlags' in found_types}} + cudaErrorInvalidChannelDescriptor = ( + cyruntime.cudaError.cudaErrorInvalidChannelDescriptor, + 'This indicates that the channel descriptor passed to the API call is not\n' + 'valid. This occurs if the format is not one of the formats specified by\n' + ':py:obj:`~.cudaChannelFormatKind`, or if one of the dimensions is invalid.\n' + ) -class cudaUserObjectFlags(IntEnum): - """ - Flags for user objects for graphs - """ - {{if 'cudaUserObjectNoDestructorSync' in found_values}} - #: Indicates the destructor execution is not synchronized by any CUDA - #: handle. - cudaUserObjectNoDestructorSync = ccudart.cudaUserObjectFlags.cudaUserObjectNoDestructorSync{{endif}} -{{endif}} -{{if 'cudaUserObjectRetainFlags' in found_types}} + cudaErrorInvalidMemcpyDirection = ( + cyruntime.cudaError.cudaErrorInvalidMemcpyDirection, + 'This indicates that the direction of the memcpy passed to the API call is\n' + 'not one of the types specified by :py:obj:`~.cudaMemcpyKind`.\n' + ) -class cudaUserObjectRetainFlags(IntEnum): - """ - Flags for retaining user object references for graphs - """ - {{if 'cudaGraphUserObjectMove' in found_values}} - #: Transfer references from the caller rather than creating new - #: references. - cudaGraphUserObjectMove = ccudart.cudaUserObjectRetainFlags.cudaGraphUserObjectMove{{endif}} -{{endif}} -{{if 'cudaGraphicsRegisterFlags' in found_types}} + cudaErrorAddressOfConstant = ( + cyruntime.cudaError.cudaErrorAddressOfConstant, + 'This indicated that the user has taken the address of a constant variable,\n' + 'which was forbidden up until the CUDA 3.1 release.\n' + '[Deprecated]\n' + ) -class cudaGraphicsRegisterFlags(IntEnum): - """ - CUDA graphics interop register flags - """ - {{if 'cudaGraphicsRegisterFlagsNone' in found_values}} - #: Default - cudaGraphicsRegisterFlagsNone = ccudart.cudaGraphicsRegisterFlags.cudaGraphicsRegisterFlagsNone{{endif}} - {{if 'cudaGraphicsRegisterFlagsReadOnly' in found_values}} + cudaErrorTextureFetchFailed = ( + cyruntime.cudaError.cudaErrorTextureFetchFailed, + 'This indicated that a texture fetch was not able to be performed. This was\n' + 'previously used for device emulation of texture operations.\n' + '[Deprecated]\n' + ) - #: CUDA will not write to this resource - cudaGraphicsRegisterFlagsReadOnly = ccudart.cudaGraphicsRegisterFlags.cudaGraphicsRegisterFlagsReadOnly{{endif}} - {{if 'cudaGraphicsRegisterFlagsWriteDiscard' in found_values}} - #: CUDA will only write to and will not read from this resource - cudaGraphicsRegisterFlagsWriteDiscard = ccudart.cudaGraphicsRegisterFlags.cudaGraphicsRegisterFlagsWriteDiscard{{endif}} - {{if 'cudaGraphicsRegisterFlagsSurfaceLoadStore' in found_values}} + cudaErrorTextureNotBound = ( + cyruntime.cudaError.cudaErrorTextureNotBound, + 'This indicated that a texture was not bound for access. This was previously\n' + 'used for device emulation of texture operations.\n' + '[Deprecated]\n' + ) - #: CUDA will bind this resource to a surface reference - cudaGraphicsRegisterFlagsSurfaceLoadStore = ccudart.cudaGraphicsRegisterFlags.cudaGraphicsRegisterFlagsSurfaceLoadStore{{endif}} - {{if 'cudaGraphicsRegisterFlagsTextureGather' in found_values}} - #: CUDA will perform texture gather operations on this resource - cudaGraphicsRegisterFlagsTextureGather = ccudart.cudaGraphicsRegisterFlags.cudaGraphicsRegisterFlagsTextureGather{{endif}} -{{endif}} -{{if 'cudaGraphicsMapFlags' in found_types}} + cudaErrorSynchronizationError = ( + cyruntime.cudaError.cudaErrorSynchronizationError, + 'This indicated that a synchronization operation had failed. This was\n' + 'previously used for some device emulation functions.\n' + '[Deprecated]\n' + ) -class cudaGraphicsMapFlags(IntEnum): - """ - CUDA graphics interop map flags - """ - {{if 'cudaGraphicsMapFlagsNone' in found_values}} - #: Default; Assume resource can be read/written - cudaGraphicsMapFlagsNone = ccudart.cudaGraphicsMapFlags.cudaGraphicsMapFlagsNone{{endif}} - {{if 'cudaGraphicsMapFlagsReadOnly' in found_values}} + cudaErrorInvalidFilterSetting = ( + cyruntime.cudaError.cudaErrorInvalidFilterSetting, + 'This indicates that a non-float texture was being accessed with linear\n' + 'filtering. This is not supported by CUDA.\n' + ) - #: CUDA will not write to this resource - cudaGraphicsMapFlagsReadOnly = ccudart.cudaGraphicsMapFlags.cudaGraphicsMapFlagsReadOnly{{endif}} - {{if 'cudaGraphicsMapFlagsWriteDiscard' in found_values}} - #: CUDA will only write to and will not read from this resource - cudaGraphicsMapFlagsWriteDiscard = ccudart.cudaGraphicsMapFlags.cudaGraphicsMapFlagsWriteDiscard{{endif}} -{{endif}} -{{if 'cudaGraphicsCubeFace' in found_types}} + cudaErrorInvalidNormSetting = ( + cyruntime.cudaError.cudaErrorInvalidNormSetting, + 'This indicates that an attempt was made to read an unsupported data type as\n' + 'a normalized float. This is not supported by CUDA.\n' + ) -class cudaGraphicsCubeFace(IntEnum): - """ - CUDA graphics interop array indices for cube maps - """ - {{if 'cudaGraphicsCubeFacePositiveX' in found_values}} - #: Positive X face of cubemap - cudaGraphicsCubeFacePositiveX = ccudart.cudaGraphicsCubeFace.cudaGraphicsCubeFacePositiveX{{endif}} - {{if 'cudaGraphicsCubeFaceNegativeX' in found_values}} + cudaErrorMixedDeviceExecution = ( + cyruntime.cudaError.cudaErrorMixedDeviceExecution, + 'Mixing of device and device emulation code was not allowed.\n' + '[Deprecated]\n' + ) - #: Negative X face of cubemap - cudaGraphicsCubeFaceNegativeX = ccudart.cudaGraphicsCubeFace.cudaGraphicsCubeFaceNegativeX{{endif}} - {{if 'cudaGraphicsCubeFacePositiveY' in found_values}} - #: Positive Y face of cubemap - cudaGraphicsCubeFacePositiveY = ccudart.cudaGraphicsCubeFace.cudaGraphicsCubeFacePositiveY{{endif}} - {{if 'cudaGraphicsCubeFaceNegativeY' in found_values}} + cudaErrorNotYetImplemented = ( + cyruntime.cudaError.cudaErrorNotYetImplemented, + 'This indicates that the API call is not yet implemented. Production\n' + 'releases of CUDA will never return this error.\n' + '[Deprecated]\n' + ) - #: Negative Y face of cubemap - cudaGraphicsCubeFaceNegativeY = ccudart.cudaGraphicsCubeFace.cudaGraphicsCubeFaceNegativeY{{endif}} - {{if 'cudaGraphicsCubeFacePositiveZ' in found_values}} - #: Positive Z face of cubemap - cudaGraphicsCubeFacePositiveZ = ccudart.cudaGraphicsCubeFace.cudaGraphicsCubeFacePositiveZ{{endif}} - {{if 'cudaGraphicsCubeFaceNegativeZ' in found_values}} + cudaErrorMemoryValueTooLarge = ( + cyruntime.cudaError.cudaErrorMemoryValueTooLarge, + 'This indicated that an emulated device pointer exceeded the 32-bit address\n' + 'range.\n' + '[Deprecated]\n' + ) - #: Negative Z face of cubemap - cudaGraphicsCubeFaceNegativeZ = ccudart.cudaGraphicsCubeFace.cudaGraphicsCubeFaceNegativeZ{{endif}} -{{endif}} -{{if 'cudaResourceType' in found_types}} -class cudaResourceType(IntEnum): - """ - CUDA resource types - """ - {{if 'cudaResourceTypeArray' in found_values}} + cudaErrorStubLibrary = ( + cyruntime.cudaError.cudaErrorStubLibrary, + 'This indicates that the CUDA driver that the application has loaded is a\n' + 'stub library. Applications that run with the stub rather than a real driver\n' + 'loaded will result in CUDA API returning this error.\n' + ) - #: Array resource - cudaResourceTypeArray = ccudart.cudaResourceType.cudaResourceTypeArray{{endif}} - {{if 'cudaResourceTypeMipmappedArray' in found_values}} - #: Mipmapped array resource - cudaResourceTypeMipmappedArray = ccudart.cudaResourceType.cudaResourceTypeMipmappedArray{{endif}} - {{if 'cudaResourceTypeLinear' in found_values}} + cudaErrorInsufficientDriver = ( + cyruntime.cudaError.cudaErrorInsufficientDriver, + 'This indicates that the installed NVIDIA CUDA driver is older than the CUDA\n' + 'runtime library. This is not a supported configuration. Users should\n' + 'install an updated NVIDIA display driver to allow the application to run.\n' + ) - #: Linear resource - cudaResourceTypeLinear = ccudart.cudaResourceType.cudaResourceTypeLinear{{endif}} - {{if 'cudaResourceTypePitch2D' in found_values}} - #: Pitch 2D resource - cudaResourceTypePitch2D = ccudart.cudaResourceType.cudaResourceTypePitch2D{{endif}} -{{endif}} -{{if 'cudaResourceViewFormat' in found_types}} + cudaErrorCallRequiresNewerDriver = ( + cyruntime.cudaError.cudaErrorCallRequiresNewerDriver, + 'This indicates that the API call requires a newer CUDA driver than the one\n' + 'currently installed. Users should install an updated NVIDIA CUDA driver to\n' + 'allow the API call to succeed.\n' + ) + + + cudaErrorInvalidSurface = ( + cyruntime.cudaError.cudaErrorInvalidSurface, + 'This indicates that the surface passed to the API call is not a valid\n' + 'surface.\n' + ) + + + cudaErrorDuplicateVariableName = ( + cyruntime.cudaError.cudaErrorDuplicateVariableName, + 'This indicates that multiple global or constant variables (across separate\n' + 'CUDA source files in the application) share the same string name.\n' + ) + + + cudaErrorDuplicateTextureName = ( + cyruntime.cudaError.cudaErrorDuplicateTextureName, + 'This indicates that multiple textures (across separate CUDA source files in\n' + 'the application) share the same string name.\n' + ) + + + cudaErrorDuplicateSurfaceName = ( + cyruntime.cudaError.cudaErrorDuplicateSurfaceName, + 'This indicates that multiple surfaces (across separate CUDA source files in\n' + 'the application) share the same string name.\n' + ) + + + cudaErrorDevicesUnavailable = ( + cyruntime.cudaError.cudaErrorDevicesUnavailable, + 'This indicates that all CUDA devices are busy or unavailable at the current\n' + 'time. Devices are often busy/unavailable due to use of\n' + ':py:obj:`~.cudaComputeModeProhibited`,\n' + ':py:obj:`~.cudaComputeModeExclusiveProcess`, or when long running CUDA\n' + 'kernels have filled up the GPU and are blocking new work from starting.\n' + 'They can also be unavailable due to memory constraints on a device that\n' + 'already has active CUDA work being performed.\n' + ) + + + cudaErrorIncompatibleDriverContext = ( + cyruntime.cudaError.cudaErrorIncompatibleDriverContext, + 'This indicates that the current context is not compatible with this the\n' + 'CUDA Runtime. This can only occur if you are using CUDA Runtime/Driver\n' + 'interoperability and have created an existing Driver context using the\n' + 'driver API. The Driver context may be incompatible either because the\n' + 'Driver context was created using an older version of the API, because the\n' + 'Runtime API call expects a primary driver context and the Driver context is\n' + 'not primary, or because the Driver context has been destroyed. Please see\n' + ':py:obj:`~.Interactions with the CUDA Driver API` for more information.\n' + ) + + + cudaErrorMissingConfiguration = ( + cyruntime.cudaError.cudaErrorMissingConfiguration, + 'The device function being invoked (usually via\n' + ':py:obj:`~.cudaLaunchKernel()`) was not previously configured via the\n' + ':py:obj:`~.cudaConfigureCall()` function.\n' + ) + + + cudaErrorPriorLaunchFailure = ( + cyruntime.cudaError.cudaErrorPriorLaunchFailure, + 'This indicated that a previous kernel launch failed. This was previously\n' + 'used for device emulation of kernel launches.\n' + '[Deprecated]\n' + ) + + + cudaErrorLaunchMaxDepthExceeded = ( + cyruntime.cudaError.cudaErrorLaunchMaxDepthExceeded, + 'This error indicates that a device runtime grid launch did not occur\n' + 'because the depth of the child grid would exceed the maximum supported\n' + 'number of nested grid launches.\n' + ) + + + cudaErrorLaunchFileScopedTex = ( + cyruntime.cudaError.cudaErrorLaunchFileScopedTex, + 'This error indicates that a grid launch did not occur because the kernel\n' + 'uses file-scoped textures which are unsupported by the device runtime.\n' + 'Kernels launched via the device runtime only support textures created with\n' + "the Texture Object API's.\n" + ) + + + cudaErrorLaunchFileScopedSurf = ( + cyruntime.cudaError.cudaErrorLaunchFileScopedSurf, + 'This error indicates that a grid launch did not occur because the kernel\n' + 'uses file-scoped surfaces which are unsupported by the device runtime.\n' + 'Kernels launched via the device runtime only support surfaces created with\n' + "the Surface Object API's.\n" + ) + + + cudaErrorSyncDepthExceeded = ( + cyruntime.cudaError.cudaErrorSyncDepthExceeded, + 'This error indicates that a call to :py:obj:`~.cudaDeviceSynchronize` made\n' + 'from the device runtime failed because the call was made at grid depth\n' + 'greater than than either the default (2 levels of grids) or user specified\n' + 'device limit :py:obj:`~.cudaLimitDevRuntimeSyncDepth`. To be able to\n' + 'synchronize on launched grids at a greater depth successfully, the maximum\n' + 'nested depth at which :py:obj:`~.cudaDeviceSynchronize` will be called must\n' + 'be specified with the :py:obj:`~.cudaLimitDevRuntimeSyncDepth` limit to the\n' + ':py:obj:`~.cudaDeviceSetLimit` api before the host-side launch of a kernel\n' + 'using the device runtime. Keep in mind that additional levels of sync depth\n' + 'require the runtime to reserve large amounts of device memory that cannot\n' + 'be used for user allocations. Note that :py:obj:`~.cudaDeviceSynchronize`\n' + 'made from device runtime is only supported on devices of compute capability\n' + '< 9.0.\n' + ) + + + cudaErrorLaunchPendingCountExceeded = ( + cyruntime.cudaError.cudaErrorLaunchPendingCountExceeded, + 'This error indicates that a device runtime grid launch failed because the\n' + 'launch would exceed the limit\n' + ':py:obj:`~.cudaLimitDevRuntimePendingLaunchCount`. For this launch to\n' + 'proceed successfully, :py:obj:`~.cudaDeviceSetLimit` must be called to set\n' + 'the :py:obj:`~.cudaLimitDevRuntimePendingLaunchCount` to be higher than the\n' + 'upper bound of outstanding launches that can be issued to the device\n' + 'runtime. Keep in mind that raising the limit of pending device runtime\n' + 'launches will require the runtime to reserve device memory that cannot be\n' + 'used for user allocations.\n' + ) + + + cudaErrorInvalidDeviceFunction = ( + cyruntime.cudaError.cudaErrorInvalidDeviceFunction, + 'The requested device function does not exist or is not compiled for the\n' + 'proper device architecture.\n' + ) + + + cudaErrorNoDevice = ( + cyruntime.cudaError.cudaErrorNoDevice, + 'This indicates that no CUDA-capable devices were detected by the installed\n' + 'CUDA driver.\n' + ) + + + cudaErrorInvalidDevice = ( + cyruntime.cudaError.cudaErrorInvalidDevice, + 'This indicates that the device ordinal supplied by the user does not\n' + 'correspond to a valid CUDA device or that the action requested is invalid\n' + 'for the specified device.\n' + ) -class cudaResourceViewFormat(IntEnum): - """ - CUDA texture resource view formats - """ - {{if 'cudaResViewFormatNone' in found_values}} - #: No resource view format (use underlying resource format) - cudaResViewFormatNone = ccudart.cudaResourceViewFormat.cudaResViewFormatNone{{endif}} - {{if 'cudaResViewFormatUnsignedChar1' in found_values}} + cudaErrorDeviceNotLicensed = ( + cyruntime.cudaError.cudaErrorDeviceNotLicensed, + "This indicates that the device doesn't have a valid Grid License.\n" + ) + - #: 1 channel unsigned 8-bit integers - cudaResViewFormatUnsignedChar1 = ccudart.cudaResourceViewFormat.cudaResViewFormatUnsignedChar1{{endif}} - {{if 'cudaResViewFormatUnsignedChar2' in found_values}} + cudaErrorSoftwareValidityNotEstablished = ( + cyruntime.cudaError.cudaErrorSoftwareValidityNotEstablished, + 'By default, the CUDA runtime may perform a minimal set of self-tests, as\n' + 'well as CUDA driver tests, to establish the validity of both. Introduced in\n' + 'CUDA 11.2, this error return indicates that at least one of these tests has\n' + 'failed and the validity of either the runtime or the driver could not be\n' + 'established.\n' + ) - #: 2 channel unsigned 8-bit integers - cudaResViewFormatUnsignedChar2 = ccudart.cudaResourceViewFormat.cudaResViewFormatUnsignedChar2{{endif}} - {{if 'cudaResViewFormatUnsignedChar4' in found_values}} - #: 4 channel unsigned 8-bit integers - cudaResViewFormatUnsignedChar4 = ccudart.cudaResourceViewFormat.cudaResViewFormatUnsignedChar4{{endif}} - {{if 'cudaResViewFormatSignedChar1' in found_values}} + cudaErrorStartupFailure = ( + cyruntime.cudaError.cudaErrorStartupFailure, + 'This indicates an internal startup failure in the CUDA runtime.\n' + ) - #: 1 channel signed 8-bit integers - cudaResViewFormatSignedChar1 = ccudart.cudaResourceViewFormat.cudaResViewFormatSignedChar1{{endif}} - {{if 'cudaResViewFormatSignedChar2' in found_values}} - #: 2 channel signed 8-bit integers - cudaResViewFormatSignedChar2 = ccudart.cudaResourceViewFormat.cudaResViewFormatSignedChar2{{endif}} - {{if 'cudaResViewFormatSignedChar4' in found_values}} + cudaErrorInvalidKernelImage = ( + cyruntime.cudaError.cudaErrorInvalidKernelImage, + 'This indicates that the device kernel image is invalid.\n' + ) - #: 4 channel signed 8-bit integers - cudaResViewFormatSignedChar4 = ccudart.cudaResourceViewFormat.cudaResViewFormatSignedChar4{{endif}} - {{if 'cudaResViewFormatUnsignedShort1' in found_values}} - #: 1 channel unsigned 16-bit integers - cudaResViewFormatUnsignedShort1 = ccudart.cudaResourceViewFormat.cudaResViewFormatUnsignedShort1{{endif}} - {{if 'cudaResViewFormatUnsignedShort2' in found_values}} + cudaErrorDeviceUninitialized = ( + cyruntime.cudaError.cudaErrorDeviceUninitialized, + 'This most frequently indicates that there is no context bound to the\n' + 'current thread. This can also be returned if the context passed to an API\n' + 'call is not a valid handle (such as a context that has had\n' + ':py:obj:`~.cuCtxDestroy()` invoked on it). This can also be returned if a\n' + 'user mixes different API versions (i.e. 3010 context with 3020 API calls).\n' + 'See :py:obj:`~.cuCtxGetApiVersion()` for more details.\n' + ) - #: 2 channel unsigned 16-bit integers - cudaResViewFormatUnsignedShort2 = ccudart.cudaResourceViewFormat.cudaResViewFormatUnsignedShort2{{endif}} - {{if 'cudaResViewFormatUnsignedShort4' in found_values}} - #: 4 channel unsigned 16-bit integers - cudaResViewFormatUnsignedShort4 = ccudart.cudaResourceViewFormat.cudaResViewFormatUnsignedShort4{{endif}} - {{if 'cudaResViewFormatSignedShort1' in found_values}} + cudaErrorMapBufferObjectFailed = ( + cyruntime.cudaError.cudaErrorMapBufferObjectFailed, + 'This indicates that the buffer object could not be mapped.\n' + ) - #: 1 channel signed 16-bit integers - cudaResViewFormatSignedShort1 = ccudart.cudaResourceViewFormat.cudaResViewFormatSignedShort1{{endif}} - {{if 'cudaResViewFormatSignedShort2' in found_values}} - #: 2 channel signed 16-bit integers - cudaResViewFormatSignedShort2 = ccudart.cudaResourceViewFormat.cudaResViewFormatSignedShort2{{endif}} - {{if 'cudaResViewFormatSignedShort4' in found_values}} + cudaErrorUnmapBufferObjectFailed = ( + cyruntime.cudaError.cudaErrorUnmapBufferObjectFailed, + 'This indicates that the buffer object could not be unmapped.\n' + ) - #: 4 channel signed 16-bit integers - cudaResViewFormatSignedShort4 = ccudart.cudaResourceViewFormat.cudaResViewFormatSignedShort4{{endif}} - {{if 'cudaResViewFormatUnsignedInt1' in found_values}} - #: 1 channel unsigned 32-bit integers - cudaResViewFormatUnsignedInt1 = ccudart.cudaResourceViewFormat.cudaResViewFormatUnsignedInt1{{endif}} - {{if 'cudaResViewFormatUnsignedInt2' in found_values}} + cudaErrorArrayIsMapped = ( + cyruntime.cudaError.cudaErrorArrayIsMapped, + 'This indicates that the specified array is currently mapped and thus cannot\n' + 'be destroyed.\n' + ) - #: 2 channel unsigned 32-bit integers - cudaResViewFormatUnsignedInt2 = ccudart.cudaResourceViewFormat.cudaResViewFormatUnsignedInt2{{endif}} - {{if 'cudaResViewFormatUnsignedInt4' in found_values}} - #: 4 channel unsigned 32-bit integers - cudaResViewFormatUnsignedInt4 = ccudart.cudaResourceViewFormat.cudaResViewFormatUnsignedInt4{{endif}} - {{if 'cudaResViewFormatSignedInt1' in found_values}} + cudaErrorAlreadyMapped = ( + cyruntime.cudaError.cudaErrorAlreadyMapped, + 'This indicates that the resource is already mapped.\n' + ) - #: 1 channel signed 32-bit integers - cudaResViewFormatSignedInt1 = ccudart.cudaResourceViewFormat.cudaResViewFormatSignedInt1{{endif}} - {{if 'cudaResViewFormatSignedInt2' in found_values}} - #: 2 channel signed 32-bit integers - cudaResViewFormatSignedInt2 = ccudart.cudaResourceViewFormat.cudaResViewFormatSignedInt2{{endif}} - {{if 'cudaResViewFormatSignedInt4' in found_values}} + cudaErrorNoKernelImageForDevice = ( + cyruntime.cudaError.cudaErrorNoKernelImageForDevice, + 'This indicates that there is no kernel image available that is suitable for\n' + 'the device. This can occur when a user specifies code generation options\n' + 'for a particular CUDA source file that do not include the corresponding\n' + 'device configuration.\n' + ) - #: 4 channel signed 32-bit integers - cudaResViewFormatSignedInt4 = ccudart.cudaResourceViewFormat.cudaResViewFormatSignedInt4{{endif}} - {{if 'cudaResViewFormatHalf1' in found_values}} - #: 1 channel 16-bit floating point - cudaResViewFormatHalf1 = ccudart.cudaResourceViewFormat.cudaResViewFormatHalf1{{endif}} - {{if 'cudaResViewFormatHalf2' in found_values}} + cudaErrorAlreadyAcquired = ( + cyruntime.cudaError.cudaErrorAlreadyAcquired, + 'This indicates that a resource has already been acquired.\n' + ) - #: 2 channel 16-bit floating point - cudaResViewFormatHalf2 = ccudart.cudaResourceViewFormat.cudaResViewFormatHalf2{{endif}} - {{if 'cudaResViewFormatHalf4' in found_values}} - #: 4 channel 16-bit floating point - cudaResViewFormatHalf4 = ccudart.cudaResourceViewFormat.cudaResViewFormatHalf4{{endif}} - {{if 'cudaResViewFormatFloat1' in found_values}} + cudaErrorNotMapped = ( + cyruntime.cudaError.cudaErrorNotMapped, + 'This indicates that a resource is not mapped.\n' + ) - #: 1 channel 32-bit floating point - cudaResViewFormatFloat1 = ccudart.cudaResourceViewFormat.cudaResViewFormatFloat1{{endif}} - {{if 'cudaResViewFormatFloat2' in found_values}} - #: 2 channel 32-bit floating point - cudaResViewFormatFloat2 = ccudart.cudaResourceViewFormat.cudaResViewFormatFloat2{{endif}} - {{if 'cudaResViewFormatFloat4' in found_values}} + cudaErrorNotMappedAsArray = ( + cyruntime.cudaError.cudaErrorNotMappedAsArray, + 'This indicates that a mapped resource is not available for access as an\n' + 'array.\n' + ) - #: 4 channel 32-bit floating point - cudaResViewFormatFloat4 = ccudart.cudaResourceViewFormat.cudaResViewFormatFloat4{{endif}} - {{if 'cudaResViewFormatUnsignedBlockCompressed1' in found_values}} - #: Block compressed 1 - cudaResViewFormatUnsignedBlockCompressed1 = ccudart.cudaResourceViewFormat.cudaResViewFormatUnsignedBlockCompressed1{{endif}} - {{if 'cudaResViewFormatUnsignedBlockCompressed2' in found_values}} + cudaErrorNotMappedAsPointer = ( + cyruntime.cudaError.cudaErrorNotMappedAsPointer, + 'This indicates that a mapped resource is not available for access as a\n' + 'pointer.\n' + ) - #: Block compressed 2 - cudaResViewFormatUnsignedBlockCompressed2 = ccudart.cudaResourceViewFormat.cudaResViewFormatUnsignedBlockCompressed2{{endif}} - {{if 'cudaResViewFormatUnsignedBlockCompressed3' in found_values}} - #: Block compressed 3 - cudaResViewFormatUnsignedBlockCompressed3 = ccudart.cudaResourceViewFormat.cudaResViewFormatUnsignedBlockCompressed3{{endif}} - {{if 'cudaResViewFormatUnsignedBlockCompressed4' in found_values}} + cudaErrorECCUncorrectable = ( + cyruntime.cudaError.cudaErrorECCUncorrectable, + 'This indicates that an uncorrectable ECC error was detected during\n' + 'execution.\n' + ) - #: Block compressed 4 unsigned - cudaResViewFormatUnsignedBlockCompressed4 = ccudart.cudaResourceViewFormat.cudaResViewFormatUnsignedBlockCompressed4{{endif}} - {{if 'cudaResViewFormatSignedBlockCompressed4' in found_values}} - #: Block compressed 4 signed - cudaResViewFormatSignedBlockCompressed4 = ccudart.cudaResourceViewFormat.cudaResViewFormatSignedBlockCompressed4{{endif}} - {{if 'cudaResViewFormatUnsignedBlockCompressed5' in found_values}} + cudaErrorUnsupportedLimit = ( + cyruntime.cudaError.cudaErrorUnsupportedLimit, + 'This indicates that the :py:obj:`~.cudaLimit` passed to the API call is not\n' + 'supported by the active device.\n' + ) - #: Block compressed 5 unsigned - cudaResViewFormatUnsignedBlockCompressed5 = ccudart.cudaResourceViewFormat.cudaResViewFormatUnsignedBlockCompressed5{{endif}} - {{if 'cudaResViewFormatSignedBlockCompressed5' in found_values}} - #: Block compressed 5 signed - cudaResViewFormatSignedBlockCompressed5 = ccudart.cudaResourceViewFormat.cudaResViewFormatSignedBlockCompressed5{{endif}} - {{if 'cudaResViewFormatUnsignedBlockCompressed6H' in found_values}} + cudaErrorDeviceAlreadyInUse = ( + cyruntime.cudaError.cudaErrorDeviceAlreadyInUse, + 'This indicates that a call tried to access an exclusive-thread device that\n' + 'is already in use by a different thread.\n' + ) - #: Block compressed 6 unsigned half-float - cudaResViewFormatUnsignedBlockCompressed6H = ccudart.cudaResourceViewFormat.cudaResViewFormatUnsignedBlockCompressed6H{{endif}} - {{if 'cudaResViewFormatSignedBlockCompressed6H' in found_values}} - #: Block compressed 6 signed half-float - cudaResViewFormatSignedBlockCompressed6H = ccudart.cudaResourceViewFormat.cudaResViewFormatSignedBlockCompressed6H{{endif}} - {{if 'cudaResViewFormatUnsignedBlockCompressed7' in found_values}} + cudaErrorPeerAccessUnsupported = ( + cyruntime.cudaError.cudaErrorPeerAccessUnsupported, + 'This error indicates that P2P access is not supported across the given\n' + 'devices.\n' + ) - #: Block compressed 7 - cudaResViewFormatUnsignedBlockCompressed7 = ccudart.cudaResourceViewFormat.cudaResViewFormatUnsignedBlockCompressed7{{endif}} -{{endif}} -{{if 'cudaFuncAttribute' in found_types}} -class cudaFuncAttribute(IntEnum): - """ - CUDA function attributes that can be set using - :py:obj:`~.cudaFuncSetAttribute` - """ - {{if 'cudaFuncAttributeMaxDynamicSharedMemorySize' in found_values}} + cudaErrorInvalidPtx = ( + cyruntime.cudaError.cudaErrorInvalidPtx, + 'A PTX compilation failed. The runtime may fall back to compiling PTX if an\n' + 'application does not contain a suitable binary for the current device.\n' + ) - #: Maximum dynamic shared memory size - cudaFuncAttributeMaxDynamicSharedMemorySize = ccudart.cudaFuncAttribute.cudaFuncAttributeMaxDynamicSharedMemorySize{{endif}} - {{if 'cudaFuncAttributePreferredSharedMemoryCarveout' in found_values}} - #: Preferred shared memory-L1 cache split - cudaFuncAttributePreferredSharedMemoryCarveout = ccudart.cudaFuncAttribute.cudaFuncAttributePreferredSharedMemoryCarveout{{endif}} - {{if 'cudaFuncAttributeClusterDimMustBeSet' in found_values}} + cudaErrorInvalidGraphicsContext = ( + cyruntime.cudaError.cudaErrorInvalidGraphicsContext, + 'This indicates an error with the OpenGL or DirectX context.\n' + ) - #: Indicator to enforce valid cluster dimension specification on kernel - #: launch - cudaFuncAttributeClusterDimMustBeSet = ccudart.cudaFuncAttribute.cudaFuncAttributeClusterDimMustBeSet{{endif}} - {{if 'cudaFuncAttributeRequiredClusterWidth' in found_values}} - #: Required cluster width - cudaFuncAttributeRequiredClusterWidth = ccudart.cudaFuncAttribute.cudaFuncAttributeRequiredClusterWidth{{endif}} - {{if 'cudaFuncAttributeRequiredClusterHeight' in found_values}} + cudaErrorNvlinkUncorrectable = ( + cyruntime.cudaError.cudaErrorNvlinkUncorrectable, + 'This indicates that an uncorrectable NVLink error was detected during the\n' + 'execution.\n' + ) - #: Required cluster height - cudaFuncAttributeRequiredClusterHeight = ccudart.cudaFuncAttribute.cudaFuncAttributeRequiredClusterHeight{{endif}} - {{if 'cudaFuncAttributeRequiredClusterDepth' in found_values}} - #: Required cluster depth - cudaFuncAttributeRequiredClusterDepth = ccudart.cudaFuncAttribute.cudaFuncAttributeRequiredClusterDepth{{endif}} - {{if 'cudaFuncAttributeNonPortableClusterSizeAllowed' in found_values}} + cudaErrorJitCompilerNotFound = ( + cyruntime.cudaError.cudaErrorJitCompilerNotFound, + 'This indicates that the PTX JIT compiler library was not found. The JIT\n' + 'Compiler library is used for PTX compilation. The runtime may fall back to\n' + 'compiling PTX if an application does not contain a suitable binary for the\n' + 'current device.\n' + ) - #: Whether non-portable cluster scheduling policy is supported - cudaFuncAttributeNonPortableClusterSizeAllowed = ccudart.cudaFuncAttribute.cudaFuncAttributeNonPortableClusterSizeAllowed{{endif}} - {{if 'cudaFuncAttributeClusterSchedulingPolicyPreference' in found_values}} - #: Required cluster scheduling policy preference - cudaFuncAttributeClusterSchedulingPolicyPreference = ccudart.cudaFuncAttribute.cudaFuncAttributeClusterSchedulingPolicyPreference{{endif}} - {{if 'cudaFuncAttributeMax' in found_values}} - cudaFuncAttributeMax = ccudart.cudaFuncAttribute.cudaFuncAttributeMax{{endif}} -{{endif}} -{{if 'cudaFuncCache' in found_types}} + cudaErrorUnsupportedPtxVersion = ( + cyruntime.cudaError.cudaErrorUnsupportedPtxVersion, + 'This indicates that the provided PTX was compiled with an unsupported\n' + 'toolchain. The most common reason for this, is the PTX was generated by a\n' + 'compiler newer than what is supported by the CUDA driver and PTX JIT\n' + 'compiler.\n' + ) -class cudaFuncCache(IntEnum): - """ - CUDA function cache configurations - """ - {{if 'cudaFuncCachePreferNone' in found_values}} - #: Default function cache configuration, no preference - cudaFuncCachePreferNone = ccudart.cudaFuncCache.cudaFuncCachePreferNone{{endif}} - {{if 'cudaFuncCachePreferShared' in found_values}} + cudaErrorJitCompilationDisabled = ( + cyruntime.cudaError.cudaErrorJitCompilationDisabled, + 'This indicates that the JIT compilation was disabled. The JIT compilation\n' + 'compiles PTX. The runtime may fall back to compiling PTX if an application\n' + 'does not contain a suitable binary for the current device.\n' + ) - #: Prefer larger shared memory and smaller L1 cache - cudaFuncCachePreferShared = ccudart.cudaFuncCache.cudaFuncCachePreferShared{{endif}} - {{if 'cudaFuncCachePreferL1' in found_values}} - #: Prefer larger L1 cache and smaller shared memory - cudaFuncCachePreferL1 = ccudart.cudaFuncCache.cudaFuncCachePreferL1{{endif}} - {{if 'cudaFuncCachePreferEqual' in found_values}} + cudaErrorUnsupportedExecAffinity = ( + cyruntime.cudaError.cudaErrorUnsupportedExecAffinity, + 'This indicates that the provided execution affinity is not supported by the\n' + 'device.\n' + ) - #: Prefer equal size L1 cache and shared memory - cudaFuncCachePreferEqual = ccudart.cudaFuncCache.cudaFuncCachePreferEqual{{endif}} -{{endif}} -{{if 'cudaSharedMemConfig' in found_types}} -class cudaSharedMemConfig(IntEnum): - """ - CUDA shared memory configuration [Deprecated] - """ - {{if 'cudaSharedMemBankSizeDefault' in found_values}} - cudaSharedMemBankSizeDefault = ccudart.cudaSharedMemConfig.cudaSharedMemBankSizeDefault{{endif}} - {{if 'cudaSharedMemBankSizeFourByte' in found_values}} - cudaSharedMemBankSizeFourByte = ccudart.cudaSharedMemConfig.cudaSharedMemBankSizeFourByte{{endif}} - {{if 'cudaSharedMemBankSizeEightByte' in found_values}} - cudaSharedMemBankSizeEightByte = ccudart.cudaSharedMemConfig.cudaSharedMemBankSizeEightByte{{endif}} -{{endif}} -{{if 'cudaSharedCarveout' in found_types}} + cudaErrorUnsupportedDevSideSync = ( + cyruntime.cudaError.cudaErrorUnsupportedDevSideSync, + 'This indicates that the code to be compiled by the PTX JIT contains\n' + 'unsupported call to cudaDeviceSynchronize.\n' + ) -class cudaSharedCarveout(IntEnum): - """ - Shared memory carveout configurations. These may be passed to - cudaFuncSetAttribute - """ - {{if 'cudaSharedmemCarveoutDefault' in found_values}} - #: No preference for shared memory or L1 (default) - cudaSharedmemCarveoutDefault = ccudart.cudaSharedCarveout.cudaSharedmemCarveoutDefault{{endif}} - {{if 'cudaSharedmemCarveoutMaxL1' in found_values}} + cudaErrorContained = ( + cyruntime.cudaError.cudaErrorContained, + 'This indicates that an exception occurred on the device that is now\n' + "contained by the GPU's error containment capability. Common causes are - a.\n" + 'Certain types of invalid accesses of peer GPU memory over nvlink b. Certain\n' + 'classes of hardware errors This leaves the process in an inconsistent state\n' + 'and any further CUDA work will return the same error. To continue using\n' + 'CUDA, the process must be terminated and relaunched.\n' + ) - #: Prefer maximum available L1 cache, minimum shared memory - cudaSharedmemCarveoutMaxL1 = ccudart.cudaSharedCarveout.cudaSharedmemCarveoutMaxL1{{endif}} - {{if 'cudaSharedmemCarveoutMaxShared' in found_values}} - #: Prefer maximum available shared memory, minimum L1 cache - cudaSharedmemCarveoutMaxShared = ccudart.cudaSharedCarveout.cudaSharedmemCarveoutMaxShared{{endif}} -{{endif}} -{{if 'cudaComputeMode' in found_types}} + cudaErrorInvalidSource = ( + cyruntime.cudaError.cudaErrorInvalidSource, + 'This indicates that the device kernel source is invalid.\n' + ) -class cudaComputeMode(IntEnum): - """ - CUDA device compute modes - """ - {{if 'cudaComputeModeDefault' in found_values}} - #: Default compute mode (Multiple threads can use - #: :py:obj:`~.cudaSetDevice()` with this device) - cudaComputeModeDefault = ccudart.cudaComputeMode.cudaComputeModeDefault{{endif}} - {{if 'cudaComputeModeExclusive' in found_values}} + cudaErrorFileNotFound = ( + cyruntime.cudaError.cudaErrorFileNotFound, + 'This indicates that the file specified was not found.\n' + ) - #: Compute-exclusive-thread mode (Only one thread in one process will - #: be able to use :py:obj:`~.cudaSetDevice()` with this device) - cudaComputeModeExclusive = ccudart.cudaComputeMode.cudaComputeModeExclusive{{endif}} - {{if 'cudaComputeModeProhibited' in found_values}} - #: Compute-prohibited mode (No threads can use - #: :py:obj:`~.cudaSetDevice()` with this device) - cudaComputeModeProhibited = ccudart.cudaComputeMode.cudaComputeModeProhibited{{endif}} - {{if 'cudaComputeModeExclusiveProcess' in found_values}} + cudaErrorSharedObjectSymbolNotFound = ( + cyruntime.cudaError.cudaErrorSharedObjectSymbolNotFound, + 'This indicates that a link to a shared object failed to resolve.\n' + ) - #: Compute-exclusive-process mode (Many threads in one process will be - #: able to use :py:obj:`~.cudaSetDevice()` with this device) - cudaComputeModeExclusiveProcess = ccudart.cudaComputeMode.cudaComputeModeExclusiveProcess{{endif}} -{{endif}} -{{if 'cudaLimit' in found_types}} -class cudaLimit(IntEnum): - """ - CUDA Limits - """ - {{if 'cudaLimitStackSize' in found_values}} + cudaErrorSharedObjectInitFailed = ( + cyruntime.cudaError.cudaErrorSharedObjectInitFailed, + 'This indicates that initialization of a shared object failed.\n' + ) - #: GPU thread stack size - cudaLimitStackSize = ccudart.cudaLimit.cudaLimitStackSize{{endif}} - {{if 'cudaLimitPrintfFifoSize' in found_values}} - #: GPU printf FIFO size - cudaLimitPrintfFifoSize = ccudart.cudaLimit.cudaLimitPrintfFifoSize{{endif}} - {{if 'cudaLimitMallocHeapSize' in found_values}} + cudaErrorOperatingSystem = ( + cyruntime.cudaError.cudaErrorOperatingSystem, + 'This error indicates that an OS call failed.\n' + ) - #: GPU malloc heap size - cudaLimitMallocHeapSize = ccudart.cudaLimit.cudaLimitMallocHeapSize{{endif}} - {{if 'cudaLimitDevRuntimeSyncDepth' in found_values}} - #: GPU device runtime synchronize depth - cudaLimitDevRuntimeSyncDepth = ccudart.cudaLimit.cudaLimitDevRuntimeSyncDepth{{endif}} - {{if 'cudaLimitDevRuntimePendingLaunchCount' in found_values}} + cudaErrorInvalidResourceHandle = ( + cyruntime.cudaError.cudaErrorInvalidResourceHandle, + 'This indicates that a resource handle passed to the API call was not valid.\n' + 'Resource handles are opaque types like :py:obj:`~.cudaStream_t` and\n' + ':py:obj:`~.cudaEvent_t`.\n' + ) + + + cudaErrorIllegalState = ( + cyruntime.cudaError.cudaErrorIllegalState, + 'This indicates that a resource required by the API call is not in a valid\n' + 'state to perform the requested operation.\n' + ) + + + cudaErrorLossyQuery = ( + cyruntime.cudaError.cudaErrorLossyQuery, + 'This indicates an attempt was made to introspect an object in a way that\n' + 'would discard semantically important information. This is either due to the\n' + 'object using funtionality newer than the API version used to introspect it\n' + 'or omission of optional return arguments.\n' + ) + + + cudaErrorSymbolNotFound = ( + cyruntime.cudaError.cudaErrorSymbolNotFound, + 'This indicates that a named symbol was not found. Examples of symbols are\n' + 'global/constant variable names, driver function names, texture names, and\n' + 'surface names.\n' + ) + + + cudaErrorNotReady = ( + cyruntime.cudaError.cudaErrorNotReady, + 'This indicates that asynchronous operations issued previously have not\n' + 'completed yet. This result is not actually an error, but must be indicated\n' + 'differently than :py:obj:`~.cudaSuccess` (which indicates completion).\n' + 'Calls that may return this value include :py:obj:`~.cudaEventQuery()` and\n' + ':py:obj:`~.cudaStreamQuery()`.\n' + ) - #: GPU device runtime pending launch count - cudaLimitDevRuntimePendingLaunchCount = ccudart.cudaLimit.cudaLimitDevRuntimePendingLaunchCount{{endif}} - {{if 'cudaLimitMaxL2FetchGranularity' in found_values}} - #: A value between 0 and 128 that indicates the maximum fetch - #: granularity of L2 (in Bytes). This is a hint - cudaLimitMaxL2FetchGranularity = ccudart.cudaLimit.cudaLimitMaxL2FetchGranularity{{endif}} - {{if 'cudaLimitPersistingL2CacheSize' in found_values}} + cudaErrorIllegalAddress = ( + cyruntime.cudaError.cudaErrorIllegalAddress, + 'The device encountered a load or store instruction on an invalid memory\n' + 'address. This leaves the process in an inconsistent state and any further\n' + 'CUDA work will return the same error. To continue using CUDA, the process\n' + 'must be terminated and relaunched.\n' + ) - #: A size in bytes for L2 persisting lines cache size - cudaLimitPersistingL2CacheSize = ccudart.cudaLimit.cudaLimitPersistingL2CacheSize{{endif}} -{{endif}} -{{if 'cudaMemoryAdvise' in found_types}} -class cudaMemoryAdvise(IntEnum): - """ - CUDA Memory Advise values - """ - {{if 'cudaMemAdviseSetReadMostly' in found_values}} + cudaErrorLaunchOutOfResources = ( + cyruntime.cudaError.cudaErrorLaunchOutOfResources, + 'This indicates that a launch did not occur because it did not have\n' + 'appropriate resources. Although this error is similar to\n' + ':py:obj:`~.cudaErrorInvalidConfiguration`, this error usually indicates\n' + 'that the user has attempted to pass too many arguments to the device\n' + "kernel, or the kernel launch specifies too many threads for the kernel's\n" + 'register count.\n' + ) + + + cudaErrorLaunchTimeout = ( + cyruntime.cudaError.cudaErrorLaunchTimeout, + 'This indicates that the device kernel took too long to execute. This can\n' + 'only occur if timeouts are enabled - see the device attribute\n' + ':py:obj:`~.cudaDevAttrKernelExecTimeout` for more information. This leaves\n' + 'the process in an inconsistent state and any further CUDA work will return\n' + 'the same error. To continue using CUDA, the process must be terminated and\n' + 'relaunched.\n' + ) + + + cudaErrorLaunchIncompatibleTexturing = ( + cyruntime.cudaError.cudaErrorLaunchIncompatibleTexturing, + 'This error indicates a kernel launch that uses an incompatible texturing\n' + 'mode.\n' + ) + + + cudaErrorPeerAccessAlreadyEnabled = ( + cyruntime.cudaError.cudaErrorPeerAccessAlreadyEnabled, + 'This error indicates that a call to\n' + ':py:obj:`~.cudaDeviceEnablePeerAccess()` is trying to re-enable peer\n' + 'addressing on from a context which has already had peer addressing enabled.\n' + ) + + + cudaErrorPeerAccessNotEnabled = ( + cyruntime.cudaError.cudaErrorPeerAccessNotEnabled, + 'This error indicates that :py:obj:`~.cudaDeviceDisablePeerAccess()` is\n' + 'trying to disable peer addressing which has not been enabled yet via\n' + ':py:obj:`~.cudaDeviceEnablePeerAccess()`.\n' + ) + + + cudaErrorSetOnActiveProcess = ( + cyruntime.cudaError.cudaErrorSetOnActiveProcess, + 'This indicates that the user has called :py:obj:`~.cudaSetValidDevices()`,\n' + ':py:obj:`~.cudaSetDeviceFlags()`, :py:obj:`~.cudaD3D9SetDirect3DDevice()`,\n' + ':py:obj:`~.cudaD3D10SetDirect3DDevice`,\n' + ':py:obj:`~.cudaD3D11SetDirect3DDevice()`, or\n' + ':py:obj:`~.cudaVDPAUSetVDPAUDevice()` after initializing the CUDA runtime\n' + 'by calling non-device management operations (allocating memory and\n' + 'launching kernels are examples of non-device management operations). This\n' + 'error can also be returned if using runtime/driver interoperability and\n' + 'there is an existing :py:obj:`~.CUcontext` active on the host thread.\n' + ) + + + cudaErrorContextIsDestroyed = ( + cyruntime.cudaError.cudaErrorContextIsDestroyed, + 'This error indicates that the context current to the calling thread has\n' + 'been destroyed using :py:obj:`~.cuCtxDestroy`, or is a primary context\n' + 'which has not yet been initialized.\n' + ) + + + cudaErrorAssert = ( + cyruntime.cudaError.cudaErrorAssert, + 'An assert triggered in device code during kernel execution. The device\n' + 'cannot be used again. All existing allocations are invalid. To continue\n' + 'using CUDA, the process must be terminated and relaunched.\n' + ) + + + cudaErrorTooManyPeers = ( + cyruntime.cudaError.cudaErrorTooManyPeers, + 'This error indicates that the hardware resources required to enable peer\n' + 'access have been exhausted for one or more of the devices passed to\n' + ':py:obj:`~.cudaEnablePeerAccess()`.\n' + ) + + + cudaErrorHostMemoryAlreadyRegistered = ( + cyruntime.cudaError.cudaErrorHostMemoryAlreadyRegistered, + 'This error indicates that the memory range passed to\n' + ':py:obj:`~.cudaHostRegister()` has already been registered.\n' + ) + + + cudaErrorHostMemoryNotRegistered = ( + cyruntime.cudaError.cudaErrorHostMemoryNotRegistered, + 'This error indicates that the pointer passed to\n' + ':py:obj:`~.cudaHostUnregister()` does not correspond to any currently\n' + 'registered memory region.\n' + ) + + + cudaErrorHardwareStackError = ( + cyruntime.cudaError.cudaErrorHardwareStackError, + 'Device encountered an error in the call stack during kernel execution,\n' + 'possibly due to stack corruption or exceeding the stack size limit. This\n' + 'leaves the process in an inconsistent state and any further CUDA work will\n' + 'return the same error. To continue using CUDA, the process must be\n' + 'terminated and relaunched.\n' + ) + + + cudaErrorIllegalInstruction = ( + cyruntime.cudaError.cudaErrorIllegalInstruction, + 'The device encountered an illegal instruction during kernel execution This\n' + 'leaves the process in an inconsistent state and any further CUDA work will\n' + 'return the same error. To continue using CUDA, the process must be\n' + 'terminated and relaunched.\n' + ) + + + cudaErrorMisalignedAddress = ( + cyruntime.cudaError.cudaErrorMisalignedAddress, + 'The device encountered a load or store instruction on a memory address\n' + 'which is not aligned. This leaves the process in an inconsistent state and\n' + 'any further CUDA work will return the same error. To continue using CUDA,\n' + 'the process must be terminated and relaunched.\n' + ) + + + cudaErrorInvalidAddressSpace = ( + cyruntime.cudaError.cudaErrorInvalidAddressSpace, + 'While executing a kernel, the device encountered an instruction which can\n' + 'only operate on memory locations in certain address spaces (global, shared,\n' + 'or local), but was supplied a memory address not belonging to an allowed\n' + 'address space. This leaves the process in an inconsistent state and any\n' + 'further CUDA work will return the same error. To continue using CUDA, the\n' + 'process must be terminated and relaunched.\n' + ) + + + cudaErrorInvalidPc = ( + cyruntime.cudaError.cudaErrorInvalidPc, + 'The device encountered an invalid program counter. This leaves the process\n' + 'in an inconsistent state and any further CUDA work will return the same\n' + 'error. To continue using CUDA, the process must be terminated and\n' + 'relaunched.\n' + ) + + + cudaErrorLaunchFailure = ( + cyruntime.cudaError.cudaErrorLaunchFailure, + 'An exception occurred on the device while executing a kernel. Common causes\n' + 'include dereferencing an invalid device pointer and accessing out of bounds\n' + 'shared memory. Less common cases can be system specific - more information\n' + 'about these cases can be found in the system specific user guide. This\n' + 'leaves the process in an inconsistent state and any further CUDA work will\n' + 'return the same error. To continue using CUDA, the process must be\n' + 'terminated and relaunched.\n' + ) + + + cudaErrorCooperativeLaunchTooLarge = ( + cyruntime.cudaError.cudaErrorCooperativeLaunchTooLarge, + 'This error indicates that the number of blocks launched per grid for a\n' + 'kernel that was launched via either :py:obj:`~.cudaLaunchCooperativeKernel`\n' + 'exceeds the maximum number of blocks as allowed by\n' + ':py:obj:`~.cudaOccupancyMaxActiveBlocksPerMultiprocessor` or\n' + ':py:obj:`~.cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags` times\n' + 'the number of multiprocessors as specified by the device attribute\n' + ':py:obj:`~.cudaDevAttrMultiProcessorCount`.\n' + ) + + + cudaErrorTensorMemoryLeak = ( + cyruntime.cudaError.cudaErrorTensorMemoryLeak, + 'An exception occurred on the device while exiting a kernel using tensor\n' + 'memory: the tensor memory was not completely deallocated. This leaves the\n' + 'process in an inconsistent state and any further CUDA work will return the\n' + 'same error. To continue using CUDA, the process must be terminated and\n' + 'relaunched.\n' + ) + + + cudaErrorNotPermitted = ( + cyruntime.cudaError.cudaErrorNotPermitted, + 'This error indicates the attempted operation is not permitted.\n' + ) + + + cudaErrorNotSupported = ( + cyruntime.cudaError.cudaErrorNotSupported, + 'This error indicates the attempted operation is not supported on the\n' + 'current system or device.\n' + ) + + + cudaErrorSystemNotReady = ( + cyruntime.cudaError.cudaErrorSystemNotReady, + 'This error indicates that the system is not yet ready to start any CUDA\n' + 'work. To continue using CUDA, verify the system configuration is in a valid\n' + 'state and all required driver daemons are actively running. More\n' + 'information about this error can be found in the system specific user\n' + 'guide.\n' + ) + + + cudaErrorSystemDriverMismatch = ( + cyruntime.cudaError.cudaErrorSystemDriverMismatch, + 'This error indicates that there is a mismatch between the versions of the\n' + 'display driver and the CUDA driver. Refer to the compatibility\n' + 'documentation for supported versions.\n' + ) + - #: Data will mostly be read and only occassionally be written to - cudaMemAdviseSetReadMostly = ccudart.cudaMemoryAdvise.cudaMemAdviseSetReadMostly{{endif}} - {{if 'cudaMemAdviseUnsetReadMostly' in found_values}} + cudaErrorCompatNotSupportedOnDevice = ( + cyruntime.cudaError.cudaErrorCompatNotSupportedOnDevice, + 'This error indicates that the system was upgraded to run with forward\n' + 'compatibility but the visible hardware detected by CUDA does not support\n' + 'this configuration. Refer to the compatibility documentation for the\n' + 'supported hardware matrix or ensure that only supported hardware is visible\n' + 'during initialization via the CUDA_VISIBLE_DEVICES environment variable.\n' + ) - #: Undo the effect of :py:obj:`~.cudaMemAdviseSetReadMostly` - cudaMemAdviseUnsetReadMostly = ccudart.cudaMemoryAdvise.cudaMemAdviseUnsetReadMostly{{endif}} - {{if 'cudaMemAdviseSetPreferredLocation' in found_values}} - #: Set the preferred location for the data as the specified device - cudaMemAdviseSetPreferredLocation = ccudart.cudaMemoryAdvise.cudaMemAdviseSetPreferredLocation{{endif}} - {{if 'cudaMemAdviseUnsetPreferredLocation' in found_values}} + cudaErrorMpsConnectionFailed = ( + cyruntime.cudaError.cudaErrorMpsConnectionFailed, + 'This error indicates that the MPS client failed to connect to the MPS\n' + 'control daemon or the MPS server.\n' + ) - #: Clear the preferred location for the data - cudaMemAdviseUnsetPreferredLocation = ccudart.cudaMemoryAdvise.cudaMemAdviseUnsetPreferredLocation{{endif}} - {{if 'cudaMemAdviseSetAccessedBy' in found_values}} - #: Data will be accessed by the specified device, so prevent page - #: faults as much as possible - cudaMemAdviseSetAccessedBy = ccudart.cudaMemoryAdvise.cudaMemAdviseSetAccessedBy{{endif}} - {{if 'cudaMemAdviseUnsetAccessedBy' in found_values}} + cudaErrorMpsRpcFailure = ( + cyruntime.cudaError.cudaErrorMpsRpcFailure, + 'This error indicates that the remote procedural call between the MPS server\n' + 'and the MPS client failed.\n' + ) - #: Let the Unified Memory subsystem decide on the page faulting policy - #: for the specified device - cudaMemAdviseUnsetAccessedBy = ccudart.cudaMemoryAdvise.cudaMemAdviseUnsetAccessedBy{{endif}} -{{endif}} -{{if 'cudaMemRangeAttribute' in found_types}} -class cudaMemRangeAttribute(IntEnum): - """ - CUDA range attributes - """ - {{if 'cudaMemRangeAttributeReadMostly' in found_values}} + cudaErrorMpsServerNotReady = ( + cyruntime.cudaError.cudaErrorMpsServerNotReady, + 'This error indicates that the MPS server is not ready to accept new MPS\n' + 'client requests. This error can be returned when the MPS server is in the\n' + 'process of recovering from a fatal failure.\n' + ) - #: Whether the range will mostly be read and only occassionally be - #: written to - cudaMemRangeAttributeReadMostly = ccudart.cudaMemRangeAttribute.cudaMemRangeAttributeReadMostly{{endif}} - {{if 'cudaMemRangeAttributePreferredLocation' in found_values}} - #: The preferred location of the range - cudaMemRangeAttributePreferredLocation = ccudart.cudaMemRangeAttribute.cudaMemRangeAttributePreferredLocation{{endif}} - {{if 'cudaMemRangeAttributeAccessedBy' in found_values}} + cudaErrorMpsMaxClientsReached = ( + cyruntime.cudaError.cudaErrorMpsMaxClientsReached, + 'This error indicates that the hardware resources required to create MPS\n' + 'client have been exhausted.\n' + ) - #: Memory range has :py:obj:`~.cudaMemAdviseSetAccessedBy` set for - #: specified device - cudaMemRangeAttributeAccessedBy = ccudart.cudaMemRangeAttribute.cudaMemRangeAttributeAccessedBy{{endif}} - {{if 'cudaMemRangeAttributeLastPrefetchLocation' in found_values}} - #: The last location to which the range was prefetched - cudaMemRangeAttributeLastPrefetchLocation = ccudart.cudaMemRangeAttribute.cudaMemRangeAttributeLastPrefetchLocation{{endif}} - {{if 'cudaMemRangeAttributePreferredLocationType' in found_values}} + cudaErrorMpsMaxConnectionsReached = ( + cyruntime.cudaError.cudaErrorMpsMaxConnectionsReached, + 'This error indicates the the hardware resources required to device\n' + 'connections have been exhausted.\n' + ) - #: The preferred location type of the range - cudaMemRangeAttributePreferredLocationType = ccudart.cudaMemRangeAttribute.cudaMemRangeAttributePreferredLocationType{{endif}} - {{if 'cudaMemRangeAttributePreferredLocationId' in found_values}} - #: The preferred location id of the range - cudaMemRangeAttributePreferredLocationId = ccudart.cudaMemRangeAttribute.cudaMemRangeAttributePreferredLocationId{{endif}} - {{if 'cudaMemRangeAttributeLastPrefetchLocationType' in found_values}} + cudaErrorMpsClientTerminated = ( + cyruntime.cudaError.cudaErrorMpsClientTerminated, + 'This error indicates that the MPS client has been terminated by the server.\n' + 'To continue using CUDA, the process must be terminated and relaunched.\n' + ) - #: The last location type to which the range was prefetched - cudaMemRangeAttributeLastPrefetchLocationType = ccudart.cudaMemRangeAttribute.cudaMemRangeAttributeLastPrefetchLocationType{{endif}} - {{if 'cudaMemRangeAttributeLastPrefetchLocationId' in found_values}} - #: The last location id to which the range was prefetched - cudaMemRangeAttributeLastPrefetchLocationId = ccudart.cudaMemRangeAttribute.cudaMemRangeAttributeLastPrefetchLocationId{{endif}} -{{endif}} -{{if 'cudaFlushGPUDirectRDMAWritesOptions' in found_types}} + cudaErrorCdpNotSupported = ( + cyruntime.cudaError.cudaErrorCdpNotSupported, + 'This error indicates, that the program is using CUDA Dynamic Parallelism,\n' + 'but the current configuration, like MPS, does not support it.\n' + ) -class cudaFlushGPUDirectRDMAWritesOptions(IntEnum): - """ - CUDA GPUDirect RDMA flush writes APIs supported on the device - """ - {{if 'cudaFlushGPUDirectRDMAWritesOptionHost' in found_values}} - #: :py:obj:`~.cudaDeviceFlushGPUDirectRDMAWrites()` and its CUDA Driver - #: API counterpart are supported on the device. - cudaFlushGPUDirectRDMAWritesOptionHost = ccudart.cudaFlushGPUDirectRDMAWritesOptions.cudaFlushGPUDirectRDMAWritesOptionHost{{endif}} - {{if 'cudaFlushGPUDirectRDMAWritesOptionMemOps' in found_values}} + cudaErrorCdpVersionMismatch = ( + cyruntime.cudaError.cudaErrorCdpVersionMismatch, + 'This error indicates, that the program contains an unsupported interaction\n' + 'between different versions of CUDA Dynamic Parallelism.\n' + ) - #: The :py:obj:`~.CU_STREAM_WAIT_VALUE_FLUSH` flag and the - #: :py:obj:`~.CU_STREAM_MEM_OP_FLUSH_REMOTE_WRITES` MemOp are supported - #: on the CUDA device. - cudaFlushGPUDirectRDMAWritesOptionMemOps = ccudart.cudaFlushGPUDirectRDMAWritesOptions.cudaFlushGPUDirectRDMAWritesOptionMemOps{{endif}} -{{endif}} -{{if 'cudaGPUDirectRDMAWritesOrdering' in found_types}} -class cudaGPUDirectRDMAWritesOrdering(IntEnum): - """ - CUDA GPUDirect RDMA flush writes ordering features of the device - """ - {{if 'cudaGPUDirectRDMAWritesOrderingNone' in found_values}} + cudaErrorStreamCaptureUnsupported = ( + cyruntime.cudaError.cudaErrorStreamCaptureUnsupported, + 'The operation is not permitted when the stream is capturing.\n' + ) - #: The device does not natively support ordering of GPUDirect RDMA - #: writes. :py:obj:`~.cudaFlushGPUDirectRDMAWrites()` can be leveraged - #: if supported. - cudaGPUDirectRDMAWritesOrderingNone = ccudart.cudaGPUDirectRDMAWritesOrdering.cudaGPUDirectRDMAWritesOrderingNone{{endif}} - {{if 'cudaGPUDirectRDMAWritesOrderingOwner' in found_values}} - #: Natively, the device can consistently consume GPUDirect RDMA writes, - #: although other CUDA devices may not. - cudaGPUDirectRDMAWritesOrderingOwner = ccudart.cudaGPUDirectRDMAWritesOrdering.cudaGPUDirectRDMAWritesOrderingOwner{{endif}} - {{if 'cudaGPUDirectRDMAWritesOrderingAllDevices' in found_values}} + cudaErrorStreamCaptureInvalidated = ( + cyruntime.cudaError.cudaErrorStreamCaptureInvalidated, + 'The current capture sequence on the stream has been invalidated due to a\n' + 'previous error.\n' + ) - #: Any CUDA device in the system can consistently consume GPUDirect - #: RDMA writes to this device. - cudaGPUDirectRDMAWritesOrderingAllDevices = ccudart.cudaGPUDirectRDMAWritesOrdering.cudaGPUDirectRDMAWritesOrderingAllDevices{{endif}} -{{endif}} -{{if 'cudaFlushGPUDirectRDMAWritesScope' in found_types}} -class cudaFlushGPUDirectRDMAWritesScope(IntEnum): - """ - CUDA GPUDirect RDMA flush writes scopes - """ - {{if 'cudaFlushGPUDirectRDMAWritesToOwner' in found_values}} + cudaErrorStreamCaptureMerge = ( + cyruntime.cudaError.cudaErrorStreamCaptureMerge, + 'The operation would have resulted in a merge of two independent capture\n' + 'sequences.\n' + ) - #: Blocks until remote writes are visible to the CUDA device context - #: owning the data. - cudaFlushGPUDirectRDMAWritesToOwner = ccudart.cudaFlushGPUDirectRDMAWritesScope.cudaFlushGPUDirectRDMAWritesToOwner{{endif}} - {{if 'cudaFlushGPUDirectRDMAWritesToAllDevices' in found_values}} - #: Blocks until remote writes are visible to all CUDA device contexts. - cudaFlushGPUDirectRDMAWritesToAllDevices = ccudart.cudaFlushGPUDirectRDMAWritesScope.cudaFlushGPUDirectRDMAWritesToAllDevices{{endif}} -{{endif}} -{{if 'cudaFlushGPUDirectRDMAWritesTarget' in found_types}} + cudaErrorStreamCaptureUnmatched = ( + cyruntime.cudaError.cudaErrorStreamCaptureUnmatched, + 'The capture was not initiated in this stream.\n' + ) -class cudaFlushGPUDirectRDMAWritesTarget(IntEnum): - """ - CUDA GPUDirect RDMA flush writes targets - """ - {{if 'cudaFlushGPUDirectRDMAWritesTargetCurrentDevice' in found_values}} - #: Sets the target for :py:obj:`~.cudaDeviceFlushGPUDirectRDMAWrites()` - #: to the currently active CUDA device context. - cudaFlushGPUDirectRDMAWritesTargetCurrentDevice = ccudart.cudaFlushGPUDirectRDMAWritesTarget.cudaFlushGPUDirectRDMAWritesTargetCurrentDevice{{endif}} -{{endif}} -{{if 'cudaDeviceAttr' in found_types}} + cudaErrorStreamCaptureUnjoined = ( + cyruntime.cudaError.cudaErrorStreamCaptureUnjoined, + 'The capture sequence contains a fork that was not joined to the primary\n' + 'stream.\n' + ) -class cudaDeviceAttr(IntEnum): - """ - CUDA device attributes - """ - {{if 'cudaDevAttrMaxThreadsPerBlock' in found_values}} - #: Maximum number of threads per block - cudaDevAttrMaxThreadsPerBlock = ccudart.cudaDeviceAttr.cudaDevAttrMaxThreadsPerBlock{{endif}} - {{if 'cudaDevAttrMaxBlockDimX' in found_values}} + cudaErrorStreamCaptureIsolation = ( + cyruntime.cudaError.cudaErrorStreamCaptureIsolation, + 'A dependency would have been created which crosses the capture sequence\n' + 'boundary. Only implicit in-stream ordering dependencies are allowed to\n' + 'cross the boundary.\n' + ) - #: Maximum block dimension X - cudaDevAttrMaxBlockDimX = ccudart.cudaDeviceAttr.cudaDevAttrMaxBlockDimX{{endif}} - {{if 'cudaDevAttrMaxBlockDimY' in found_values}} - #: Maximum block dimension Y - cudaDevAttrMaxBlockDimY = ccudart.cudaDeviceAttr.cudaDevAttrMaxBlockDimY{{endif}} - {{if 'cudaDevAttrMaxBlockDimZ' in found_values}} + cudaErrorStreamCaptureImplicit = ( + cyruntime.cudaError.cudaErrorStreamCaptureImplicit, + 'The operation would have resulted in a disallowed implicit dependency on a\n' + 'current capture sequence from cudaStreamLegacy.\n' + ) - #: Maximum block dimension Z - cudaDevAttrMaxBlockDimZ = ccudart.cudaDeviceAttr.cudaDevAttrMaxBlockDimZ{{endif}} - {{if 'cudaDevAttrMaxGridDimX' in found_values}} - #: Maximum grid dimension X - cudaDevAttrMaxGridDimX = ccudart.cudaDeviceAttr.cudaDevAttrMaxGridDimX{{endif}} - {{if 'cudaDevAttrMaxGridDimY' in found_values}} + cudaErrorCapturedEvent = ( + cyruntime.cudaError.cudaErrorCapturedEvent, + 'The operation is not permitted on an event which was last recorded in a\n' + 'capturing stream.\n' + ) - #: Maximum grid dimension Y - cudaDevAttrMaxGridDimY = ccudart.cudaDeviceAttr.cudaDevAttrMaxGridDimY{{endif}} - {{if 'cudaDevAttrMaxGridDimZ' in found_values}} - #: Maximum grid dimension Z - cudaDevAttrMaxGridDimZ = ccudart.cudaDeviceAttr.cudaDevAttrMaxGridDimZ{{endif}} - {{if 'cudaDevAttrMaxSharedMemoryPerBlock' in found_values}} + cudaErrorStreamCaptureWrongThread = ( + cyruntime.cudaError.cudaErrorStreamCaptureWrongThread, + 'A stream capture sequence not initiated with the\n' + ':py:obj:`~.cudaStreamCaptureModeRelaxed` argument to\n' + ':py:obj:`~.cudaStreamBeginCapture` was passed to\n' + ':py:obj:`~.cudaStreamEndCapture` in a different thread.\n' + ) - #: Maximum shared memory available per block in bytes - cudaDevAttrMaxSharedMemoryPerBlock = ccudart.cudaDeviceAttr.cudaDevAttrMaxSharedMemoryPerBlock{{endif}} - {{if 'cudaDevAttrTotalConstantMemory' in found_values}} - #: Memory available on device for constant variables in a CUDA C kernel - #: in bytes - cudaDevAttrTotalConstantMemory = ccudart.cudaDeviceAttr.cudaDevAttrTotalConstantMemory{{endif}} - {{if 'cudaDevAttrWarpSize' in found_values}} + cudaErrorTimeout = ( + cyruntime.cudaError.cudaErrorTimeout, + 'This indicates that the wait operation has timed out.\n' + ) - #: Warp size in threads - cudaDevAttrWarpSize = ccudart.cudaDeviceAttr.cudaDevAttrWarpSize{{endif}} - {{if 'cudaDevAttrMaxPitch' in found_values}} - #: Maximum pitch in bytes allowed by memory copies - cudaDevAttrMaxPitch = ccudart.cudaDeviceAttr.cudaDevAttrMaxPitch{{endif}} - {{if 'cudaDevAttrMaxRegistersPerBlock' in found_values}} + cudaErrorGraphExecUpdateFailure = ( + cyruntime.cudaError.cudaErrorGraphExecUpdateFailure, + 'This error indicates that the graph update was not performed because it\n' + 'included changes which violated constraints specific to instantiated graph\n' + 'update.\n' + ) - #: Maximum number of 32-bit registers available per block - cudaDevAttrMaxRegistersPerBlock = ccudart.cudaDeviceAttr.cudaDevAttrMaxRegistersPerBlock{{endif}} - {{if 'cudaDevAttrClockRate' in found_values}} - #: Peak clock frequency in kilohertz - cudaDevAttrClockRate = ccudart.cudaDeviceAttr.cudaDevAttrClockRate{{endif}} - {{if 'cudaDevAttrTextureAlignment' in found_values}} + cudaErrorExternalDevice = ( + cyruntime.cudaError.cudaErrorExternalDevice, + 'This indicates that an error has occurred in a device outside of GPU. It\n' + 'can be a synchronous error w.r.t. CUDA API or an asynchronous error from\n' + 'the external device. In case of asynchronous error, it means that if cuda\n' + "was waiting for an external device's signal before consuming shared data,\n" + 'the external device signaled an error indicating that the data is not valid\n' + 'for consumption. This leaves the process in an inconsistent state and any\n' + 'further CUDA work will return the same error. To continue using CUDA, the\n' + 'process must be terminated and relaunched. In case of synchronous error, it\n' + 'means that one or more external devices have encountered an error and\n' + 'cannot complete the operation.\n' + ) - #: Alignment requirement for textures - cudaDevAttrTextureAlignment = ccudart.cudaDeviceAttr.cudaDevAttrTextureAlignment{{endif}} - {{if 'cudaDevAttrGpuOverlap' in found_values}} - #: Device can possibly copy memory and execute a kernel concurrently - cudaDevAttrGpuOverlap = ccudart.cudaDeviceAttr.cudaDevAttrGpuOverlap{{endif}} - {{if 'cudaDevAttrMultiProcessorCount' in found_values}} + cudaErrorInvalidClusterSize = ( + cyruntime.cudaError.cudaErrorInvalidClusterSize, + 'This indicates that a kernel launch error has occurred due to cluster\n' + 'misconfiguration.\n' + ) - #: Number of multiprocessors on device - cudaDevAttrMultiProcessorCount = ccudart.cudaDeviceAttr.cudaDevAttrMultiProcessorCount{{endif}} - {{if 'cudaDevAttrKernelExecTimeout' in found_values}} - #: Specifies whether there is a run time limit on kernels - cudaDevAttrKernelExecTimeout = ccudart.cudaDeviceAttr.cudaDevAttrKernelExecTimeout{{endif}} - {{if 'cudaDevAttrIntegrated' in found_values}} + cudaErrorFunctionNotLoaded = ( + cyruntime.cudaError.cudaErrorFunctionNotLoaded, + 'Indiciates a function handle is not loaded when calling an API that\n' + 'requires a loaded function.\n' + ) - #: Device is integrated with host memory - cudaDevAttrIntegrated = ccudart.cudaDeviceAttr.cudaDevAttrIntegrated{{endif}} - {{if 'cudaDevAttrCanMapHostMemory' in found_values}} - #: Device can map host memory into CUDA address space - cudaDevAttrCanMapHostMemory = ccudart.cudaDeviceAttr.cudaDevAttrCanMapHostMemory{{endif}} - {{if 'cudaDevAttrComputeMode' in found_values}} + cudaErrorInvalidResourceType = ( + cyruntime.cudaError.cudaErrorInvalidResourceType, + 'This error indicates one or more resources passed in are not valid resource\n' + 'types for the operation.\n' + ) - #: Compute mode (See :py:obj:`~.cudaComputeMode` for details) - cudaDevAttrComputeMode = ccudart.cudaDeviceAttr.cudaDevAttrComputeMode{{endif}} - {{if 'cudaDevAttrMaxTexture1DWidth' in found_values}} - #: Maximum 1D texture width - cudaDevAttrMaxTexture1DWidth = ccudart.cudaDeviceAttr.cudaDevAttrMaxTexture1DWidth{{endif}} - {{if 'cudaDevAttrMaxTexture2DWidth' in found_values}} + cudaErrorInvalidResourceConfiguration = ( + cyruntime.cudaError.cudaErrorInvalidResourceConfiguration, + 'This error indicates one or more resources are insufficient or non-\n' + 'applicable for the operation.\n' + ) - #: Maximum 2D texture width - cudaDevAttrMaxTexture2DWidth = ccudart.cudaDeviceAttr.cudaDevAttrMaxTexture2DWidth{{endif}} - {{if 'cudaDevAttrMaxTexture2DHeight' in found_values}} - #: Maximum 2D texture height - cudaDevAttrMaxTexture2DHeight = ccudart.cudaDeviceAttr.cudaDevAttrMaxTexture2DHeight{{endif}} - {{if 'cudaDevAttrMaxTexture3DWidth' in found_values}} + cudaErrorStreamDetached = ( + cyruntime.cudaError.cudaErrorStreamDetached, + 'This error indicates that the requested operation is not permitted because\n' + 'the stream is in a detached state. This can occur if the green context\n' + "associated with the stream has been destroyed, limiting the stream's\n" + 'operational capabilities.\n' + ) - #: Maximum 3D texture width - cudaDevAttrMaxTexture3DWidth = ccudart.cudaDeviceAttr.cudaDevAttrMaxTexture3DWidth{{endif}} - {{if 'cudaDevAttrMaxTexture3DHeight' in found_values}} - #: Maximum 3D texture height - cudaDevAttrMaxTexture3DHeight = ccudart.cudaDeviceAttr.cudaDevAttrMaxTexture3DHeight{{endif}} - {{if 'cudaDevAttrMaxTexture3DDepth' in found_values}} + cudaErrorGraphRecaptureFailure = ( + cyruntime.cudaError.cudaErrorGraphRecaptureFailure, + 'This error indicates that a graph recapture failed and had to be\n' + 'terminated.\n' + ) - #: Maximum 3D texture depth - cudaDevAttrMaxTexture3DDepth = ccudart.cudaDeviceAttr.cudaDevAttrMaxTexture3DDepth{{endif}} - {{if 'cudaDevAttrMaxTexture2DLayeredWidth' in found_values}} - #: Maximum 2D layered texture width - cudaDevAttrMaxTexture2DLayeredWidth = ccudart.cudaDeviceAttr.cudaDevAttrMaxTexture2DLayeredWidth{{endif}} - {{if 'cudaDevAttrMaxTexture2DLayeredHeight' in found_values}} + cudaErrorUnknown = ( + cyruntime.cudaError.cudaErrorUnknown, + 'This indicates that an unknown internal error has occurred.\n' + ) - #: Maximum 2D layered texture height - cudaDevAttrMaxTexture2DLayeredHeight = ccudart.cudaDeviceAttr.cudaDevAttrMaxTexture2DLayeredHeight{{endif}} - {{if 'cudaDevAttrMaxTexture2DLayeredLayers' in found_values}} + cudaErrorApiFailureBase = cyruntime.cudaError.cudaErrorApiFailureBase - #: Maximum layers in a 2D layered texture - cudaDevAttrMaxTexture2DLayeredLayers = ccudart.cudaDeviceAttr.cudaDevAttrMaxTexture2DLayeredLayers{{endif}} - {{if 'cudaDevAttrSurfaceAlignment' in found_values}} +class cudaSharedMemoryMode(_FastEnum): + """ + Shared memory related attributes for use with + :py:obj:`~.cuLaunchKernelEx` + """ - #: Alignment requirement for surfaces - cudaDevAttrSurfaceAlignment = ccudart.cudaDeviceAttr.cudaDevAttrSurfaceAlignment{{endif}} - {{if 'cudaDevAttrConcurrentKernels' in found_values}} - #: Device can possibly execute multiple kernels concurrently - cudaDevAttrConcurrentKernels = ccudart.cudaDeviceAttr.cudaDevAttrConcurrentKernels{{endif}} - {{if 'cudaDevAttrEccEnabled' in found_values}} + cudaSharedMemoryModeDefault = ( + cyruntime.cudaSharedMemoryMode.cudaSharedMemoryModeDefault, + 'The default to use for allowing non-portable shared memory size on launch -\n' + 'uses current function attributes for\n' + ':py:obj:`~.cudaFuncAttributeMaxDynamicSharedMemorySize`\n' + ) - #: Device has ECC support enabled - cudaDevAttrEccEnabled = ccudart.cudaDeviceAttr.cudaDevAttrEccEnabled{{endif}} - {{if 'cudaDevAttrPciBusId' in found_values}} - #: PCI bus ID of the device - cudaDevAttrPciBusId = ccudart.cudaDeviceAttr.cudaDevAttrPciBusId{{endif}} - {{if 'cudaDevAttrPciDeviceId' in found_values}} + cudaSharedMemoryModeRequirePortable = ( + cyruntime.cudaSharedMemoryMode.cudaSharedMemoryModeRequirePortable, + 'Specifies that the shared memory size requested must be a portable size\n' + 'within :py:obj:`~.cudaDevAttrMaxSharedMemoryPerBlock`\n' + ) - #: PCI device ID of the device - cudaDevAttrPciDeviceId = ccudart.cudaDeviceAttr.cudaDevAttrPciDeviceId{{endif}} - {{if 'cudaDevAttrTccDriver' in found_values}} - #: Device is using TCC driver model - cudaDevAttrTccDriver = ccudart.cudaDeviceAttr.cudaDevAttrTccDriver{{endif}} - {{if 'cudaDevAttrMemoryClockRate' in found_values}} + cudaSharedMemoryModeAllowNonPortable = ( + cyruntime.cudaSharedMemoryMode.cudaSharedMemoryModeAllowNonPortable, + 'Specifies that the shared memory size requested may be a non-portable size\n' + 'up to :py:obj:`~.cudaDevAttrMaxSharedMemoryPerBlockOptin`\n' + ) - #: Peak memory clock frequency in kilohertz - cudaDevAttrMemoryClockRate = ccudart.cudaDeviceAttr.cudaDevAttrMemoryClockRate{{endif}} - {{if 'cudaDevAttrGlobalMemoryBusWidth' in found_values}} +class cudaGraphDependencyType(_FastEnum): + """ + Type annotations that can be applied to graph edges as part of + :py:obj:`~.cudaGraphEdgeData`. + """ - #: Global memory bus width in bits - cudaDevAttrGlobalMemoryBusWidth = ccudart.cudaDeviceAttr.cudaDevAttrGlobalMemoryBusWidth{{endif}} - {{if 'cudaDevAttrL2CacheSize' in found_values}} - #: Size of L2 cache in bytes - cudaDevAttrL2CacheSize = ccudart.cudaDeviceAttr.cudaDevAttrL2CacheSize{{endif}} - {{if 'cudaDevAttrMaxThreadsPerMultiProcessor' in found_values}} + cudaGraphDependencyTypeDefault = ( + cyruntime.cudaGraphDependencyType_enum.cudaGraphDependencyTypeDefault, + 'This is an ordinary dependency.\n' + ) - #: Maximum resident threads per multiprocessor - cudaDevAttrMaxThreadsPerMultiProcessor = ccudart.cudaDeviceAttr.cudaDevAttrMaxThreadsPerMultiProcessor{{endif}} - {{if 'cudaDevAttrAsyncEngineCount' in found_values}} - #: Number of asynchronous engines - cudaDevAttrAsyncEngineCount = ccudart.cudaDeviceAttr.cudaDevAttrAsyncEngineCount{{endif}} - {{if 'cudaDevAttrUnifiedAddressing' in found_values}} + cudaGraphDependencyTypeProgrammatic = ( + cyruntime.cudaGraphDependencyType_enum.cudaGraphDependencyTypeProgrammatic, + 'This dependency type allows the downstream node to use\n' + '`cudaGridDependencySynchronize()`. It may only be used between kernel\n' + 'nodes, and must be used with either the\n' + ':py:obj:`~.cudaGraphKernelNodePortProgrammatic` or\n' + ':py:obj:`~.cudaGraphKernelNodePortLaunchCompletion` outgoing port.\n' + ) - #: Device shares a unified address space with the host - cudaDevAttrUnifiedAddressing = ccudart.cudaDeviceAttr.cudaDevAttrUnifiedAddressing{{endif}} - {{if 'cudaDevAttrMaxTexture1DLayeredWidth' in found_values}} +class cudaGraphInstantiateResult(_FastEnum): + """ + Graph instantiation results + """ - #: Maximum 1D layered texture width - cudaDevAttrMaxTexture1DLayeredWidth = ccudart.cudaDeviceAttr.cudaDevAttrMaxTexture1DLayeredWidth{{endif}} - {{if 'cudaDevAttrMaxTexture1DLayeredLayers' in found_values}} - #: Maximum layers in a 1D layered texture - cudaDevAttrMaxTexture1DLayeredLayers = ccudart.cudaDeviceAttr.cudaDevAttrMaxTexture1DLayeredLayers{{endif}} - {{if 'cudaDevAttrMaxTexture2DGatherWidth' in found_values}} + cudaGraphInstantiateSuccess = ( + cyruntime.cudaGraphInstantiateResult.cudaGraphInstantiateSuccess, + 'Instantiation succeeded\n' + ) - #: Maximum 2D texture width if cudaArrayTextureGather is set - cudaDevAttrMaxTexture2DGatherWidth = ccudart.cudaDeviceAttr.cudaDevAttrMaxTexture2DGatherWidth{{endif}} - {{if 'cudaDevAttrMaxTexture2DGatherHeight' in found_values}} - #: Maximum 2D texture height if cudaArrayTextureGather is set - cudaDevAttrMaxTexture2DGatherHeight = ccudart.cudaDeviceAttr.cudaDevAttrMaxTexture2DGatherHeight{{endif}} - {{if 'cudaDevAttrMaxTexture3DWidthAlt' in found_values}} + cudaGraphInstantiateError = ( + cyruntime.cudaGraphInstantiateResult.cudaGraphInstantiateError, + 'Instantiation failed for an unexpected reason which is described in the\n' + 'return value of the function\n' + ) - #: Alternate maximum 3D texture width - cudaDevAttrMaxTexture3DWidthAlt = ccudart.cudaDeviceAttr.cudaDevAttrMaxTexture3DWidthAlt{{endif}} - {{if 'cudaDevAttrMaxTexture3DHeightAlt' in found_values}} - #: Alternate maximum 3D texture height - cudaDevAttrMaxTexture3DHeightAlt = ccudart.cudaDeviceAttr.cudaDevAttrMaxTexture3DHeightAlt{{endif}} - {{if 'cudaDevAttrMaxTexture3DDepthAlt' in found_values}} + cudaGraphInstantiateInvalidStructure = ( + cyruntime.cudaGraphInstantiateResult.cudaGraphInstantiateInvalidStructure, + 'Instantiation failed due to invalid structure, such as cycles\n' + ) - #: Alternate maximum 3D texture depth - cudaDevAttrMaxTexture3DDepthAlt = ccudart.cudaDeviceAttr.cudaDevAttrMaxTexture3DDepthAlt{{endif}} - {{if 'cudaDevAttrPciDomainId' in found_values}} - #: PCI domain ID of the device - cudaDevAttrPciDomainId = ccudart.cudaDeviceAttr.cudaDevAttrPciDomainId{{endif}} - {{if 'cudaDevAttrTexturePitchAlignment' in found_values}} + cudaGraphInstantiateNodeOperationNotSupported = ( + cyruntime.cudaGraphInstantiateResult.cudaGraphInstantiateNodeOperationNotSupported, + 'Instantiation for device launch failed because the graph contained an\n' + 'unsupported operation\n' + ) - #: Pitch alignment requirement for textures - cudaDevAttrTexturePitchAlignment = ccudart.cudaDeviceAttr.cudaDevAttrTexturePitchAlignment{{endif}} - {{if 'cudaDevAttrMaxTextureCubemapWidth' in found_values}} - #: Maximum cubemap texture width/height - cudaDevAttrMaxTextureCubemapWidth = ccudart.cudaDeviceAttr.cudaDevAttrMaxTextureCubemapWidth{{endif}} - {{if 'cudaDevAttrMaxTextureCubemapLayeredWidth' in found_values}} + cudaGraphInstantiateMultipleDevicesNotSupported = ( + cyruntime.cudaGraphInstantiateResult.cudaGraphInstantiateMultipleDevicesNotSupported, + 'Instantiation for device launch failed due to the nodes belonging to\n' + 'different contexts\n' + ) - #: Maximum cubemap layered texture width/height - cudaDevAttrMaxTextureCubemapLayeredWidth = ccudart.cudaDeviceAttr.cudaDevAttrMaxTextureCubemapLayeredWidth{{endif}} - {{if 'cudaDevAttrMaxTextureCubemapLayeredLayers' in found_values}} - #: Maximum layers in a cubemap layered texture - cudaDevAttrMaxTextureCubemapLayeredLayers = ccudart.cudaDeviceAttr.cudaDevAttrMaxTextureCubemapLayeredLayers{{endif}} - {{if 'cudaDevAttrMaxSurface1DWidth' in found_values}} + cudaGraphInstantiateConditionalHandleUnused = ( + cyruntime.cudaGraphInstantiateResult.cudaGraphInstantiateConditionalHandleUnused, + 'One or more conditional handles are not associated with conditional nodes\n' + ) - #: Maximum 1D surface width - cudaDevAttrMaxSurface1DWidth = ccudart.cudaDeviceAttr.cudaDevAttrMaxSurface1DWidth{{endif}} - {{if 'cudaDevAttrMaxSurface2DWidth' in found_values}} +class cudaLaunchMemSyncDomain(_FastEnum): + """ + Memory Synchronization Domain A kernel can be launched in a + specified memory synchronization domain that affects all memory + operations issued by that kernel. A memory barrier issued in one + domain will only order memory operations in that domain, thus + eliminating latency increase from memory barriers ordering + unrelated traffic. By default, kernels are launched in domain 0. + Kernel launched with :py:obj:`~.cudaLaunchMemSyncDomainRemote` will + have a different domain ID. User may also alter the domain ID with + :py:obj:`~.cudaLaunchMemSyncDomainMap` for a specific stream / + graph node / kernel launch. See + :py:obj:`~.cudaLaunchAttributeMemSyncDomain`, + :py:obj:`~.cudaStreamSetAttribute`, :py:obj:`~.cudaLaunchKernelEx`, + :py:obj:`~.cudaGraphKernelNodeSetAttribute`. Memory operations + done in kernels launched in different domains are considered + system-scope distanced. In other words, a GPU scoped memory + synchronization is not sufficient for memory order to be observed + by kernels in another memory synchronization domain even if they + are on the same GPU. + """ - #: Maximum 2D surface width - cudaDevAttrMaxSurface2DWidth = ccudart.cudaDeviceAttr.cudaDevAttrMaxSurface2DWidth{{endif}} - {{if 'cudaDevAttrMaxSurface2DHeight' in found_values}} - #: Maximum 2D surface height - cudaDevAttrMaxSurface2DHeight = ccudart.cudaDeviceAttr.cudaDevAttrMaxSurface2DHeight{{endif}} - {{if 'cudaDevAttrMaxSurface3DWidth' in found_values}} + cudaLaunchMemSyncDomainDefault = ( + cyruntime.cudaLaunchMemSyncDomain.cudaLaunchMemSyncDomainDefault, + 'Launch kernels in the default domain\n' + ) - #: Maximum 3D surface width - cudaDevAttrMaxSurface3DWidth = ccudart.cudaDeviceAttr.cudaDevAttrMaxSurface3DWidth{{endif}} - {{if 'cudaDevAttrMaxSurface3DHeight' in found_values}} - #: Maximum 3D surface height - cudaDevAttrMaxSurface3DHeight = ccudart.cudaDeviceAttr.cudaDevAttrMaxSurface3DHeight{{endif}} - {{if 'cudaDevAttrMaxSurface3DDepth' in found_values}} + cudaLaunchMemSyncDomainRemote = ( + cyruntime.cudaLaunchMemSyncDomain.cudaLaunchMemSyncDomainRemote, + 'Launch kernels in the remote domain\n' + ) - #: Maximum 3D surface depth - cudaDevAttrMaxSurface3DDepth = ccudart.cudaDeviceAttr.cudaDevAttrMaxSurface3DDepth{{endif}} - {{if 'cudaDevAttrMaxSurface1DLayeredWidth' in found_values}} +class cudaLaunchAttributePortableClusterMode(_FastEnum): + """ + Enum for defining applicability of portable cluster size, used with + :py:obj:`~.cudaLaunchKernelEx` + """ - #: Maximum 1D layered surface width - cudaDevAttrMaxSurface1DLayeredWidth = ccudart.cudaDeviceAttr.cudaDevAttrMaxSurface1DLayeredWidth{{endif}} - {{if 'cudaDevAttrMaxSurface1DLayeredLayers' in found_values}} - #: Maximum layers in a 1D layered surface - cudaDevAttrMaxSurface1DLayeredLayers = ccudart.cudaDeviceAttr.cudaDevAttrMaxSurface1DLayeredLayers{{endif}} - {{if 'cudaDevAttrMaxSurface2DLayeredWidth' in found_values}} + cudaLaunchPortableClusterModeDefault = ( + cyruntime.cudaLaunchAttributePortableClusterMode.cudaLaunchPortableClusterModeDefault, + 'The default to use for allowing non-portable cluster size on launch - uses\n' + 'current function attribute for\n' + ':py:obj:`~.cudaFuncAttributeNonPortableClusterSizeAllowed`\n' + ) - #: Maximum 2D layered surface width - cudaDevAttrMaxSurface2DLayeredWidth = ccudart.cudaDeviceAttr.cudaDevAttrMaxSurface2DLayeredWidth{{endif}} - {{if 'cudaDevAttrMaxSurface2DLayeredHeight' in found_values}} - #: Maximum 2D layered surface height - cudaDevAttrMaxSurface2DLayeredHeight = ccudart.cudaDeviceAttr.cudaDevAttrMaxSurface2DLayeredHeight{{endif}} - {{if 'cudaDevAttrMaxSurface2DLayeredLayers' in found_values}} + cudaLaunchPortableClusterModeRequirePortable = ( + cyruntime.cudaLaunchAttributePortableClusterMode.cudaLaunchPortableClusterModeRequirePortable, + 'Specifies that the cluster size requested must be a portable size\n' + ) - #: Maximum layers in a 2D layered surface - cudaDevAttrMaxSurface2DLayeredLayers = ccudart.cudaDeviceAttr.cudaDevAttrMaxSurface2DLayeredLayers{{endif}} - {{if 'cudaDevAttrMaxSurfaceCubemapWidth' in found_values}} - #: Maximum cubemap surface width - cudaDevAttrMaxSurfaceCubemapWidth = ccudart.cudaDeviceAttr.cudaDevAttrMaxSurfaceCubemapWidth{{endif}} - {{if 'cudaDevAttrMaxSurfaceCubemapLayeredWidth' in found_values}} + cudaLaunchPortableClusterModeAllowNonPortable = ( + cyruntime.cudaLaunchAttributePortableClusterMode.cudaLaunchPortableClusterModeAllowNonPortable, + 'Specifies that the cluster size requested may be a non-portable size\n' + ) - #: Maximum cubemap layered surface width - cudaDevAttrMaxSurfaceCubemapLayeredWidth = ccudart.cudaDeviceAttr.cudaDevAttrMaxSurfaceCubemapLayeredWidth{{endif}} - {{if 'cudaDevAttrMaxSurfaceCubemapLayeredLayers' in found_values}} - - #: Maximum layers in a cubemap layered surface - cudaDevAttrMaxSurfaceCubemapLayeredLayers = ccudart.cudaDeviceAttr.cudaDevAttrMaxSurfaceCubemapLayeredLayers{{endif}} - {{if 'cudaDevAttrMaxTexture1DLinearWidth' in found_values}} - - #: Maximum 1D linear texture width - cudaDevAttrMaxTexture1DLinearWidth = ccudart.cudaDeviceAttr.cudaDevAttrMaxTexture1DLinearWidth{{endif}} - {{if 'cudaDevAttrMaxTexture2DLinearWidth' in found_values}} - - #: Maximum 2D linear texture width - cudaDevAttrMaxTexture2DLinearWidth = ccudart.cudaDeviceAttr.cudaDevAttrMaxTexture2DLinearWidth{{endif}} - {{if 'cudaDevAttrMaxTexture2DLinearHeight' in found_values}} - - #: Maximum 2D linear texture height - cudaDevAttrMaxTexture2DLinearHeight = ccudart.cudaDeviceAttr.cudaDevAttrMaxTexture2DLinearHeight{{endif}} - {{if 'cudaDevAttrMaxTexture2DLinearPitch' in found_values}} - - #: Maximum 2D linear texture pitch in bytes - cudaDevAttrMaxTexture2DLinearPitch = ccudart.cudaDeviceAttr.cudaDevAttrMaxTexture2DLinearPitch{{endif}} - {{if 'cudaDevAttrMaxTexture2DMipmappedWidth' in found_values}} - - #: Maximum mipmapped 2D texture width - cudaDevAttrMaxTexture2DMipmappedWidth = ccudart.cudaDeviceAttr.cudaDevAttrMaxTexture2DMipmappedWidth{{endif}} - {{if 'cudaDevAttrMaxTexture2DMipmappedHeight' in found_values}} - - #: Maximum mipmapped 2D texture height - cudaDevAttrMaxTexture2DMipmappedHeight = ccudart.cudaDeviceAttr.cudaDevAttrMaxTexture2DMipmappedHeight{{endif}} - {{if 'cudaDevAttrComputeCapabilityMajor' in found_values}} - - #: Major compute capability version number - cudaDevAttrComputeCapabilityMajor = ccudart.cudaDeviceAttr.cudaDevAttrComputeCapabilityMajor{{endif}} - {{if 'cudaDevAttrComputeCapabilityMinor' in found_values}} - - #: Minor compute capability version number - cudaDevAttrComputeCapabilityMinor = ccudart.cudaDeviceAttr.cudaDevAttrComputeCapabilityMinor{{endif}} - {{if 'cudaDevAttrMaxTexture1DMipmappedWidth' in found_values}} - - #: Maximum mipmapped 1D texture width - cudaDevAttrMaxTexture1DMipmappedWidth = ccudart.cudaDeviceAttr.cudaDevAttrMaxTexture1DMipmappedWidth{{endif}} - {{if 'cudaDevAttrStreamPrioritiesSupported' in found_values}} - - #: Device supports stream priorities - cudaDevAttrStreamPrioritiesSupported = ccudart.cudaDeviceAttr.cudaDevAttrStreamPrioritiesSupported{{endif}} - {{if 'cudaDevAttrGlobalL1CacheSupported' in found_values}} - - #: Device supports caching globals in L1 - cudaDevAttrGlobalL1CacheSupported = ccudart.cudaDeviceAttr.cudaDevAttrGlobalL1CacheSupported{{endif}} - {{if 'cudaDevAttrLocalL1CacheSupported' in found_values}} - - #: Device supports caching locals in L1 - cudaDevAttrLocalL1CacheSupported = ccudart.cudaDeviceAttr.cudaDevAttrLocalL1CacheSupported{{endif}} - {{if 'cudaDevAttrMaxSharedMemoryPerMultiprocessor' in found_values}} - - #: Maximum shared memory available per multiprocessor in bytes - cudaDevAttrMaxSharedMemoryPerMultiprocessor = ccudart.cudaDeviceAttr.cudaDevAttrMaxSharedMemoryPerMultiprocessor{{endif}} - {{if 'cudaDevAttrMaxRegistersPerMultiprocessor' in found_values}} - - #: Maximum number of 32-bit registers available per multiprocessor - cudaDevAttrMaxRegistersPerMultiprocessor = ccudart.cudaDeviceAttr.cudaDevAttrMaxRegistersPerMultiprocessor{{endif}} - {{if 'cudaDevAttrManagedMemory' in found_values}} - - #: Device can allocate managed memory on this system - cudaDevAttrManagedMemory = ccudart.cudaDeviceAttr.cudaDevAttrManagedMemory{{endif}} - {{if 'cudaDevAttrIsMultiGpuBoard' in found_values}} - - #: Device is on a multi-GPU board - cudaDevAttrIsMultiGpuBoard = ccudart.cudaDeviceAttr.cudaDevAttrIsMultiGpuBoard{{endif}} - {{if 'cudaDevAttrMultiGpuBoardGroupID' in found_values}} - - #: Unique identifier for a group of devices on the same multi-GPU board - cudaDevAttrMultiGpuBoardGroupID = ccudart.cudaDeviceAttr.cudaDevAttrMultiGpuBoardGroupID{{endif}} - {{if 'cudaDevAttrHostNativeAtomicSupported' in found_values}} - - #: Link between the device and the host supports native atomic - #: operations - cudaDevAttrHostNativeAtomicSupported = ccudart.cudaDeviceAttr.cudaDevAttrHostNativeAtomicSupported{{endif}} - {{if 'cudaDevAttrSingleToDoublePrecisionPerfRatio' in found_values}} - - #: Ratio of single precision performance (in floating-point operations - #: per second) to double precision performance - cudaDevAttrSingleToDoublePrecisionPerfRatio = ccudart.cudaDeviceAttr.cudaDevAttrSingleToDoublePrecisionPerfRatio{{endif}} - {{if 'cudaDevAttrPageableMemoryAccess' in found_values}} - - #: Device supports coherently accessing pageable memory without calling - #: cudaHostRegister on it - cudaDevAttrPageableMemoryAccess = ccudart.cudaDeviceAttr.cudaDevAttrPageableMemoryAccess{{endif}} - {{if 'cudaDevAttrConcurrentManagedAccess' in found_values}} - - #: Device can coherently access managed memory concurrently with the - #: CPU - cudaDevAttrConcurrentManagedAccess = ccudart.cudaDeviceAttr.cudaDevAttrConcurrentManagedAccess{{endif}} - {{if 'cudaDevAttrComputePreemptionSupported' in found_values}} - - #: Device supports Compute Preemption - cudaDevAttrComputePreemptionSupported = ccudart.cudaDeviceAttr.cudaDevAttrComputePreemptionSupported{{endif}} - {{if 'cudaDevAttrCanUseHostPointerForRegisteredMem' in found_values}} - - #: Device can access host registered memory at the same virtual address - #: as the CPU - cudaDevAttrCanUseHostPointerForRegisteredMem = ccudart.cudaDeviceAttr.cudaDevAttrCanUseHostPointerForRegisteredMem{{endif}} - {{if 'cudaDevAttrReserved92' in found_values}} - cudaDevAttrReserved92 = ccudart.cudaDeviceAttr.cudaDevAttrReserved92{{endif}} - {{if 'cudaDevAttrReserved93' in found_values}} - cudaDevAttrReserved93 = ccudart.cudaDeviceAttr.cudaDevAttrReserved93{{endif}} - {{if 'cudaDevAttrReserved94' in found_values}} - cudaDevAttrReserved94 = ccudart.cudaDeviceAttr.cudaDevAttrReserved94{{endif}} - {{if 'cudaDevAttrCooperativeLaunch' in found_values}} - - #: Device supports launching cooperative kernels via - #: :py:obj:`~.cudaLaunchCooperativeKernel` - cudaDevAttrCooperativeLaunch = ccudart.cudaDeviceAttr.cudaDevAttrCooperativeLaunch{{endif}} - {{if 'cudaDevAttrCooperativeMultiDeviceLaunch' in found_values}} - - #: Deprecated, cudaLaunchCooperativeKernelMultiDevice is deprecated. - cudaDevAttrCooperativeMultiDeviceLaunch = ccudart.cudaDeviceAttr.cudaDevAttrCooperativeMultiDeviceLaunch{{endif}} - {{if 'cudaDevAttrMaxSharedMemoryPerBlockOptin' in found_values}} - - #: The maximum optin shared memory per block. This value may vary by - #: chip. See :py:obj:`~.cudaFuncSetAttribute` - cudaDevAttrMaxSharedMemoryPerBlockOptin = ccudart.cudaDeviceAttr.cudaDevAttrMaxSharedMemoryPerBlockOptin{{endif}} - {{if 'cudaDevAttrCanFlushRemoteWrites' in found_values}} - - #: Device supports flushing of outstanding remote writes. - cudaDevAttrCanFlushRemoteWrites = ccudart.cudaDeviceAttr.cudaDevAttrCanFlushRemoteWrites{{endif}} - {{if 'cudaDevAttrHostRegisterSupported' in found_values}} - - #: Device supports host memory registration via - #: :py:obj:`~.cudaHostRegister`. - cudaDevAttrHostRegisterSupported = ccudart.cudaDeviceAttr.cudaDevAttrHostRegisterSupported{{endif}} - {{if 'cudaDevAttrPageableMemoryAccessUsesHostPageTables' in found_values}} - - #: Device accesses pageable memory via the host's page tables. - cudaDevAttrPageableMemoryAccessUsesHostPageTables = ccudart.cudaDeviceAttr.cudaDevAttrPageableMemoryAccessUsesHostPageTables{{endif}} - {{if 'cudaDevAttrDirectManagedMemAccessFromHost' in found_values}} - - #: Host can directly access managed memory on the device without - #: migration. - cudaDevAttrDirectManagedMemAccessFromHost = ccudart.cudaDeviceAttr.cudaDevAttrDirectManagedMemAccessFromHost{{endif}} - {{if 'cudaDevAttrMaxBlocksPerMultiprocessor' in found_values}} - - #: Maximum number of blocks per multiprocessor - cudaDevAttrMaxBlocksPerMultiprocessor = ccudart.cudaDeviceAttr.cudaDevAttrMaxBlocksPerMultiprocessor{{endif}} - {{if 'cudaDevAttrMaxPersistingL2CacheSize' in found_values}} - - #: Maximum L2 persisting lines capacity setting in bytes. - cudaDevAttrMaxPersistingL2CacheSize = ccudart.cudaDeviceAttr.cudaDevAttrMaxPersistingL2CacheSize{{endif}} - {{if 'cudaDevAttrMaxAccessPolicyWindowSize' in found_values}} - - #: Maximum value of :py:obj:`~.cudaAccessPolicyWindow.num_bytes`. - cudaDevAttrMaxAccessPolicyWindowSize = ccudart.cudaDeviceAttr.cudaDevAttrMaxAccessPolicyWindowSize{{endif}} - {{if 'cudaDevAttrReservedSharedMemoryPerBlock' in found_values}} - - #: Shared memory reserved by CUDA driver per block in bytes - cudaDevAttrReservedSharedMemoryPerBlock = ccudart.cudaDeviceAttr.cudaDevAttrReservedSharedMemoryPerBlock{{endif}} - {{if 'cudaDevAttrSparseCudaArraySupported' in found_values}} - - #: Device supports sparse CUDA arrays and sparse CUDA mipmapped arrays - cudaDevAttrSparseCudaArraySupported = ccudart.cudaDeviceAttr.cudaDevAttrSparseCudaArraySupported{{endif}} - {{if 'cudaDevAttrHostRegisterReadOnlySupported' in found_values}} - - #: Device supports using the :py:obj:`~.cudaHostRegister` flag - #: cudaHostRegisterReadOnly to register memory that must be mapped as - #: read-only to the GPU - cudaDevAttrHostRegisterReadOnlySupported = ccudart.cudaDeviceAttr.cudaDevAttrHostRegisterReadOnlySupported{{endif}} - {{if 'cudaDevAttrTimelineSemaphoreInteropSupported' in found_values}} - - #: External timeline semaphore interop is supported on the device - cudaDevAttrTimelineSemaphoreInteropSupported = ccudart.cudaDeviceAttr.cudaDevAttrTimelineSemaphoreInteropSupported{{endif}} - {{if 'cudaDevAttrMaxTimelineSemaphoreInteropSupported' in found_values}} - - #: Deprecated, External timeline semaphore interop is supported on the - #: device - cudaDevAttrMaxTimelineSemaphoreInteropSupported = ccudart.cudaDeviceAttr.cudaDevAttrMaxTimelineSemaphoreInteropSupported{{endif}} - {{if 'cudaDevAttrMemoryPoolsSupported' in found_values}} - - #: Device supports using the :py:obj:`~.cudaMallocAsync` and - #: :py:obj:`~.cudaMemPool` family of APIs - cudaDevAttrMemoryPoolsSupported = ccudart.cudaDeviceAttr.cudaDevAttrMemoryPoolsSupported{{endif}} - {{if 'cudaDevAttrGPUDirectRDMASupported' in found_values}} - - #: Device supports GPUDirect RDMA APIs, like nvidia_p2p_get_pages (see - #: https://docs.nvidia.com/cuda/gpudirect-rdma for more information) - cudaDevAttrGPUDirectRDMASupported = ccudart.cudaDeviceAttr.cudaDevAttrGPUDirectRDMASupported{{endif}} - {{if 'cudaDevAttrGPUDirectRDMAFlushWritesOptions' in found_values}} - - #: The returned attribute shall be interpreted as a bitmask, where the - #: individual bits are listed in the - #: :py:obj:`~.cudaFlushGPUDirectRDMAWritesOptions` enum - cudaDevAttrGPUDirectRDMAFlushWritesOptions = ccudart.cudaDeviceAttr.cudaDevAttrGPUDirectRDMAFlushWritesOptions{{endif}} - {{if 'cudaDevAttrGPUDirectRDMAWritesOrdering' in found_values}} - - #: GPUDirect RDMA writes to the device do not need to be flushed for - #: consumers within the scope indicated by the returned attribute. See - #: :py:obj:`~.cudaGPUDirectRDMAWritesOrdering` for the numerical values - #: returned here. - cudaDevAttrGPUDirectRDMAWritesOrdering = ccudart.cudaDeviceAttr.cudaDevAttrGPUDirectRDMAWritesOrdering{{endif}} - {{if 'cudaDevAttrMemoryPoolSupportedHandleTypes' in found_values}} - - #: Handle types supported with mempool based IPC - cudaDevAttrMemoryPoolSupportedHandleTypes = ccudart.cudaDeviceAttr.cudaDevAttrMemoryPoolSupportedHandleTypes{{endif}} - {{if 'cudaDevAttrClusterLaunch' in found_values}} - - #: Indicates device supports cluster launch - cudaDevAttrClusterLaunch = ccudart.cudaDeviceAttr.cudaDevAttrClusterLaunch{{endif}} - {{if 'cudaDevAttrDeferredMappingCudaArraySupported' in found_values}} - - #: Device supports deferred mapping CUDA arrays and CUDA mipmapped - #: arrays - cudaDevAttrDeferredMappingCudaArraySupported = ccudart.cudaDeviceAttr.cudaDevAttrDeferredMappingCudaArraySupported{{endif}} - {{if 'cudaDevAttrReserved122' in found_values}} - cudaDevAttrReserved122 = ccudart.cudaDeviceAttr.cudaDevAttrReserved122{{endif}} - {{if 'cudaDevAttrReserved123' in found_values}} - cudaDevAttrReserved123 = ccudart.cudaDeviceAttr.cudaDevAttrReserved123{{endif}} - {{if 'cudaDevAttrReserved124' in found_values}} - cudaDevAttrReserved124 = ccudart.cudaDeviceAttr.cudaDevAttrReserved124{{endif}} - {{if 'cudaDevAttrIpcEventSupport' in found_values}} - - #: Device supports IPC Events. - cudaDevAttrIpcEventSupport = ccudart.cudaDeviceAttr.cudaDevAttrIpcEventSupport{{endif}} - {{if 'cudaDevAttrMemSyncDomainCount' in found_values}} - - #: Number of memory synchronization domains the device supports. - cudaDevAttrMemSyncDomainCount = ccudart.cudaDeviceAttr.cudaDevAttrMemSyncDomainCount{{endif}} - {{if 'cudaDevAttrReserved127' in found_values}} - cudaDevAttrReserved127 = ccudart.cudaDeviceAttr.cudaDevAttrReserved127{{endif}} - {{if 'cudaDevAttrReserved128' in found_values}} - cudaDevAttrReserved128 = ccudart.cudaDeviceAttr.cudaDevAttrReserved128{{endif}} - {{if 'cudaDevAttrReserved129' in found_values}} - cudaDevAttrReserved129 = ccudart.cudaDeviceAttr.cudaDevAttrReserved129{{endif}} - {{if 'cudaDevAttrNumaConfig' in found_values}} - - #: NUMA configuration of a device: value is of type - #: :py:obj:`~.cudaDeviceNumaConfig` enum - cudaDevAttrNumaConfig = ccudart.cudaDeviceAttr.cudaDevAttrNumaConfig{{endif}} - {{if 'cudaDevAttrNumaId' in found_values}} - - #: NUMA node ID of the GPU memory - cudaDevAttrNumaId = ccudart.cudaDeviceAttr.cudaDevAttrNumaId{{endif}} - {{if 'cudaDevAttrReserved132' in found_values}} - cudaDevAttrReserved132 = ccudart.cudaDeviceAttr.cudaDevAttrReserved132{{endif}} - {{if 'cudaDevAttrMpsEnabled' in found_values}} - - #: Contexts created on this device will be shared via MPS - cudaDevAttrMpsEnabled = ccudart.cudaDeviceAttr.cudaDevAttrMpsEnabled{{endif}} - {{if 'cudaDevAttrHostNumaId' in found_values}} - - #: NUMA ID of the host node closest to the device. Returns -1 when - #: system does not support NUMA. - cudaDevAttrHostNumaId = ccudart.cudaDeviceAttr.cudaDevAttrHostNumaId{{endif}} - {{if 'cudaDevAttrD3D12CigSupported' in found_values}} - - #: Device supports CIG with D3D12. - cudaDevAttrD3D12CigSupported = ccudart.cudaDeviceAttr.cudaDevAttrD3D12CigSupported{{endif}} - {{if 'cudaDevAttrMax' in found_values}} - cudaDevAttrMax = ccudart.cudaDeviceAttr.cudaDevAttrMax{{endif}} -{{endif}} -{{if 'cudaMemPoolAttr' in found_types}} - -class cudaMemPoolAttr(IntEnum): - """ - CUDA memory pool attributes - """ - {{if 'cudaMemPoolReuseFollowEventDependencies' in found_values}} - - #: (value type = int) Allow cuMemAllocAsync to use memory - #: asynchronously freed in another streams as long as a stream ordering - #: dependency of the allocating stream on the free action exists. Cuda - #: events and null stream interactions can create the required stream - #: ordered dependencies. (default enabled) - cudaMemPoolReuseFollowEventDependencies = ccudart.cudaMemPoolAttr.cudaMemPoolReuseFollowEventDependencies{{endif}} - {{if 'cudaMemPoolReuseAllowOpportunistic' in found_values}} - - #: (value type = int) Allow reuse of already completed frees when there - #: is no dependency between the free and allocation. (default enabled) - cudaMemPoolReuseAllowOpportunistic = ccudart.cudaMemPoolAttr.cudaMemPoolReuseAllowOpportunistic{{endif}} - {{if 'cudaMemPoolReuseAllowInternalDependencies' in found_values}} - - #: (value type = int) Allow cuMemAllocAsync to insert new stream - #: dependencies in order to establish the stream ordering required to - #: reuse a piece of memory released by cuFreeAsync (default enabled). - cudaMemPoolReuseAllowInternalDependencies = ccudart.cudaMemPoolAttr.cudaMemPoolReuseAllowInternalDependencies{{endif}} - {{if 'cudaMemPoolAttrReleaseThreshold' in found_values}} - - #: (value type = cuuint64_t) Amount of reserved memory in bytes to hold - #: onto before trying to release memory back to the OS. When more than - #: the release threshold bytes of memory are held by the memory pool, - #: the allocator will try to release memory back to the OS on the next - #: call to stream, event or context synchronize. (default 0) - cudaMemPoolAttrReleaseThreshold = ccudart.cudaMemPoolAttr.cudaMemPoolAttrReleaseThreshold{{endif}} - {{if 'cudaMemPoolAttrReservedMemCurrent' in found_values}} - - #: (value type = cuuint64_t) Amount of backing memory currently - #: allocated for the mempool. - cudaMemPoolAttrReservedMemCurrent = ccudart.cudaMemPoolAttr.cudaMemPoolAttrReservedMemCurrent{{endif}} - {{if 'cudaMemPoolAttrReservedMemHigh' in found_values}} - - #: (value type = cuuint64_t) High watermark of backing memory allocated - #: for the mempool since the last time it was reset. High watermark can - #: only be reset to zero. - cudaMemPoolAttrReservedMemHigh = ccudart.cudaMemPoolAttr.cudaMemPoolAttrReservedMemHigh{{endif}} - {{if 'cudaMemPoolAttrUsedMemCurrent' in found_values}} - - #: (value type = cuuint64_t) Amount of memory from the pool that is - #: currently in use by the application. - cudaMemPoolAttrUsedMemCurrent = ccudart.cudaMemPoolAttr.cudaMemPoolAttrUsedMemCurrent{{endif}} - {{if 'cudaMemPoolAttrUsedMemHigh' in found_values}} - - #: (value type = cuuint64_t) High watermark of the amount of memory - #: from the pool that was in use by the application since the last time - #: it was reset. High watermark can only be reset to zero. - cudaMemPoolAttrUsedMemHigh = ccudart.cudaMemPoolAttr.cudaMemPoolAttrUsedMemHigh{{endif}} -{{endif}} -{{if 'cudaMemLocationType' in found_types}} - -class cudaMemLocationType(IntEnum): +class cudaLaunchAttributeID(_FastEnum): """ - Specifies the type of location + Launch attributes enum; used as id field of + :py:obj:`~.cudaLaunchAttribute` """ - {{if 'cudaMemLocationTypeInvalid' in found_values}} - cudaMemLocationTypeInvalid = ccudart.cudaMemLocationType.cudaMemLocationTypeInvalid{{endif}} - {{if 'cudaMemLocationTypeDevice' in found_values}} - - #: Location is a device location, thus id is a device ordinal - cudaMemLocationTypeDevice = ccudart.cudaMemLocationType.cudaMemLocationTypeDevice{{endif}} - {{if 'cudaMemLocationTypeHost' in found_values}} - - #: Location is host, id is ignored - cudaMemLocationTypeHost = ccudart.cudaMemLocationType.cudaMemLocationTypeHost{{endif}} - {{if 'cudaMemLocationTypeHostNuma' in found_values}} - - #: Location is a host NUMA node, thus id is a host NUMA node id - cudaMemLocationTypeHostNuma = ccudart.cudaMemLocationType.cudaMemLocationTypeHostNuma{{endif}} - {{if 'cudaMemLocationTypeHostNumaCurrent' in found_values}} - #: Location is the host NUMA node closest to the current thread's CPU, - #: id is ignored - cudaMemLocationTypeHostNumaCurrent = ccudart.cudaMemLocationType.cudaMemLocationTypeHostNumaCurrent{{endif}} -{{endif}} -{{if 'cudaMemAccessFlags' in found_types}} -class cudaMemAccessFlags(IntEnum): + cudaLaunchAttributeIgnore = ( + cyruntime.cudaLaunchAttributeID.cudaLaunchAttributeIgnore, + 'Ignored entry, for convenient composition\n' + ) + + + cudaLaunchAttributeAccessPolicyWindow = ( + cyruntime.cudaLaunchAttributeID.cudaLaunchAttributeAccessPolicyWindow, + 'Valid for streams, graph nodes, launches. See\n' + ':py:obj:`~.cudaLaunchAttributeValue.accessPolicyWindow`.\n' + ) + + + cudaLaunchAttributeCooperative = ( + cyruntime.cudaLaunchAttributeID.cudaLaunchAttributeCooperative, + 'Valid for graph nodes, launches. See\n' + ':py:obj:`~.cudaLaunchAttributeValue.cooperative`.\n' + ) + + + cudaLaunchAttributeSynchronizationPolicy = ( + cyruntime.cudaLaunchAttributeID.cudaLaunchAttributeSynchronizationPolicy, + 'Valid for streams. See :py:obj:`~.cudaLaunchAttributeValue.syncPolicy`.\n' + ) + + + cudaLaunchAttributeClusterDimension = ( + cyruntime.cudaLaunchAttributeID.cudaLaunchAttributeClusterDimension, + 'Valid for graph nodes, launches. See\n' + ':py:obj:`~.cudaLaunchAttributeValue.clusterDim`.\n' + ) + + + cudaLaunchAttributeClusterSchedulingPolicyPreference = ( + cyruntime.cudaLaunchAttributeID.cudaLaunchAttributeClusterSchedulingPolicyPreference, + 'Valid for graph nodes, launches. See\n' + ':py:obj:`~.cudaLaunchAttributeValue.clusterSchedulingPolicyPreference`.\n' + ) + + + cudaLaunchAttributeProgrammaticStreamSerialization = ( + cyruntime.cudaLaunchAttributeID.cudaLaunchAttributeProgrammaticStreamSerialization, + 'Valid for launches. Setting\n' + ':py:obj:`~.cudaLaunchAttributeValue.programmaticStreamSerializationAllowed`\n' + 'to non-0 signals that the kernel will use programmatic means to resolve its\n' + 'stream dependency, so that the CUDA runtime should opportunistically allow\n' + "the grid's execution to overlap with the previous kernel in the stream, if\n" + 'that kernel requests the overlap. The dependent launches can choose to wait\n' + 'on the dependency using the programmatic sync\n' + '(cudaGridDependencySynchronize() or equivalent PTX instructions).\n' + ) + + + cudaLaunchAttributeProgrammaticEvent = ( + cyruntime.cudaLaunchAttributeID.cudaLaunchAttributeProgrammaticEvent, + 'Valid for launches. Set\n' + ':py:obj:`~.cudaLaunchAttributeValue.programmaticEvent` to record the event.\n' + 'Event recorded through this launch attribute is guaranteed to only trigger\n' + 'after all block in the associated kernel trigger the event. A block can\n' + 'trigger the event programmatically in a future CUDA release. A trigger can\n' + "also be inserted at the beginning of each block's execution if\n" + 'triggerAtBlockStart is set to non-0. The dependent launches can choose to\n' + 'wait on the dependency using the programmatic sync\n' + '(cudaGridDependencySynchronize() or equivalent PTX instructions). Note that\n' + 'dependents (including the CPU thread calling\n' + ':py:obj:`~.cudaEventSynchronize()`) are not guaranteed to observe the\n' + 'release precisely when it is released. For example,\n' + ':py:obj:`~.cudaEventSynchronize()` may only observe the event trigger long\n' + 'after the associated kernel has completed. This recording type is primarily\n' + 'meant for establishing programmatic dependency between device tasks. Note\n' + 'also this type of dependency allows, but does not guarantee, concurrent\n' + 'execution of tasks.\n' + ' The event supplied must not be an interprocess or interop event. The event\n' + 'must disable timing (i.e. must be created with the\n' + ':py:obj:`~.cudaEventDisableTiming` flag set).\n' + ) + + + cudaLaunchAttributePriority = ( + cyruntime.cudaLaunchAttributeID.cudaLaunchAttributePriority, + 'Valid for streams, graph nodes, launches. See\n' + ':py:obj:`~.cudaLaunchAttributeValue.priority`.\n' + ) + + + cudaLaunchAttributeMemSyncDomainMap = ( + cyruntime.cudaLaunchAttributeID.cudaLaunchAttributeMemSyncDomainMap, + 'Valid for streams, graph nodes, launches. See\n' + ':py:obj:`~.cudaLaunchAttributeValue.memSyncDomainMap`.\n' + ) + + + cudaLaunchAttributeMemSyncDomain = ( + cyruntime.cudaLaunchAttributeID.cudaLaunchAttributeMemSyncDomain, + 'Valid for streams, graph nodes, launches. See\n' + ':py:obj:`~.cudaLaunchAttributeValue.memSyncDomain`.\n' + ) + + + cudaLaunchAttributePreferredClusterDimension = ( + cyruntime.cudaLaunchAttributeID.cudaLaunchAttributePreferredClusterDimension, + 'Valid for graph nodes and launches. Set\n' + ':py:obj:`~.cudaLaunchAttributeValue.preferredClusterDim` to allow the\n' + 'kernel launch to specify a preferred substitute cluster dimension. Blocks\n' + 'may be grouped according to either the dimensions specified with this\n' + 'attribute (grouped into a "preferred substitute cluster"), or the one\n' + 'specified with :py:obj:`~.cudaLaunchAttributeClusterDimension` attribute\n' + '(grouped into a "regular cluster"). The cluster dimensions of a "preferred\n' + 'substitute cluster" shall be an integer multiple greater than zero of the\n' + 'regular cluster dimensions. The device will attempt - on a best-effort\n' + 'basis - to group thread blocks into preferred clusters over grouping them\n' + 'into regular clusters. When it deems necessary (primarily when the device\n' + 'temporarily runs out of physical resources to launch the larger preferred\n' + 'clusters), the device may switch to launch the regular clusters instead to\n' + 'attempt to utilize as much of the physical device resources as possible.\n' + ' Each type of cluster will have its enumeration / coordinate setup as if\n' + 'the grid consists solely of its type of cluster. For example, if the\n' + 'preferred substitute cluster dimensions double the regular cluster\n' + 'dimensions, there might be simultaneously a regular cluster indexed at\n' + '(1,0,0), and a preferred cluster indexed at (1,0,0). In this example, the\n' + 'preferred substitute cluster (1,0,0) replaces regular clusters (2,0,0) and\n' + '(3,0,0) and groups their blocks.\n' + ' This attribute will only take effect when a regular cluster dimension has\n' + 'been specified. The preferred substitute cluster dimension must be an\n' + 'integer multiple greater than zero of the regular cluster dimension and\n' + 'must divide the grid. It must also be no more than `maxBlocksPerCluster`,\n' + "if it is set in the kernel's `__launch_bounds__`. Otherwise it must be less\n" + 'than the maximum value the driver can support. Otherwise, setting this\n' + 'attribute to a value physically unable to fit on any particular device is\n' + 'permitted.\n' + ) + + + cudaLaunchAttributeLaunchCompletionEvent = ( + cyruntime.cudaLaunchAttributeID.cudaLaunchAttributeLaunchCompletionEvent, + 'Valid for launches. Set\n' + ':py:obj:`~.cudaLaunchAttributeValue.launchCompletionEvent` to record the\n' + 'event.\n' + ' Nominally, the event is triggered once all blocks of the kernel have begun\n' + 'execution. Currently this is a best effort. If a kernel B has a launch\n' + 'completion dependency on a kernel A, B may wait until A is complete.\n' + 'Alternatively, blocks of B may begin before all blocks of A have begun, for\n' + 'example if B can claim execution resources unavailable to A (e.g. they run\n' + 'on different GPUs) or if B is a higher priority than A. Exercise caution if\n' + 'such an ordering inversion could lead to deadlock.\n' + ' A launch completion event is nominally similar to a programmatic event\n' + 'with `triggerAtBlockStart` set except that it is not visible to\n' + '`cudaGridDependencySynchronize()` and can be used with compute capability\n' + 'less than 9.0.\n' + ' The event supplied must not be an interprocess or interop event. The event\n' + 'must disable timing (i.e. must be created with the\n' + ':py:obj:`~.cudaEventDisableTiming` flag set).\n' + ) + + + cudaLaunchAttributeDeviceUpdatableKernelNode = ( + cyruntime.cudaLaunchAttributeID.cudaLaunchAttributeDeviceUpdatableKernelNode, + 'Valid for graph nodes, launches. This attribute is graphs-only, and passing\n' + 'it to a launch in a non-capturing stream will result in an error.\n' + ' :cudaLaunchAttributeValue::deviceUpdatableKernelNode::deviceUpdatable can\n' + 'only be set to 0 or 1. Setting the field to 1 indicates that the\n' + 'corresponding kernel node should be device-updatable. On success, a handle\n' + 'will be returned via\n' + ':py:obj:`~.cudaLaunchAttributeValue.deviceUpdatableKernelNode.devNode`\n' + 'which can be passed to the various device-side update functions to update\n' + "the node's kernel parameters from within another kernel. For more\n" + 'information on the types of device updates that can be made, as well as the\n' + 'relevant limitations thereof, see\n' + ':py:obj:`~.cudaGraphKernelNodeUpdatesApply`.\n' + ' Nodes which are device-updatable have additional restrictions compared to\n' + 'regular kernel nodes. Firstly, device-updatable nodes cannot be removed\n' + 'from their graph via :py:obj:`~.cudaGraphDestroyNode`. Additionally, once\n' + 'opted-in to this functionality, a node cannot opt out, and any attempt to\n' + 'set the deviceUpdatable attribute to 0 will result in an error. Device-\n' + 'updatable kernel nodes also cannot have their attributes copied to/from\n' + 'another kernel node via :py:obj:`~.cudaGraphKernelNodeCopyAttributes`.\n' + 'Graphs containing one or more device-updatable nodes also do not allow\n' + 'multiple instantiation, and neither the graph nor its instantiated version\n' + 'can be passed to :py:obj:`~.cudaGraphExecUpdate`.\n' + ' If a graph contains device-updatable nodes and updates those nodes from\n' + 'the device from within the graph, the graph must be uploaded with\n' + ':py:obj:`~.cuGraphUpload` before it is launched. For such a graph, if host-\n' + 'side executable graph updates are made to the device-updatable nodes, the\n' + 'graph must be uploaded before it is launched again.\n' + ) + + + cudaLaunchAttributePreferredSharedMemoryCarveout = ( + cyruntime.cudaLaunchAttributeID.cudaLaunchAttributePreferredSharedMemoryCarveout, + 'Valid for launches. On devices where the L1 cache and shared memory use the\n' + 'same hardware resources, setting\n' + ':py:obj:`~.cudaLaunchAttributeValue.sharedMemCarveout` to a percentage\n' + 'between 0-100 signals sets the shared memory carveout preference in percent\n' + 'of the total shared memory for that kernel launch. This attribute takes\n' + 'precedence over :py:obj:`~.cudaFuncAttributePreferredSharedMemoryCarveout`.\n' + 'This is only a hint, and the driver can choose a different configuration if\n' + 'required for the launch.\n' + ) + + + cudaLaunchAttributeNvlinkUtilCentricScheduling = ( + cyruntime.cudaLaunchAttributeID.cudaLaunchAttributeNvlinkUtilCentricScheduling, + 'Valid for streams, graph nodes, launches. This attribute is a hint to the\n' + 'CUDA runtime that the launch should attempt to make the kernel maximize its\n' + 'NVLINK utilization.\n' + ' When possible to honor this hint, CUDA will assume each block in the grid\n' + 'launch will carry out an even amount of NVLINK traffic, and make a best-\n' + 'effort attempt to adjust the kernel launch based on that assumption.\n' + ' This attribute is a hint only. CUDA makes no functional or performance\n' + 'guarantee. Its applicability can be affected by many different factors,\n' + "including driver version (i.e. CUDA doesn't guarantee the performance\n" + 'characteristics will be maintained between driver versions or a driver\n' + 'update could alter or regress previously observed perf characteristics.) It\n' + "also doesn't guarantee a successful result, i.e. applying the attribute may\n" + 'not improve the performance of either the targeted kernel or the\n' + 'encapsulating application.\n' + ' Valid values for\n' + ':py:obj:`~.cudaLaunchAttributeValue.nvlinkUtilCentricScheduling` are 0\n' + '(disabled) and 1 (enabled).\n' + ) + + + cudaLaunchAttributePortableClusterSizeMode = ( + cyruntime.cudaLaunchAttributeID.cudaLaunchAttributePortableClusterSizeMode, + 'Valid for graph nodes, launches. This indicates whether the kernel launch\n' + 'is allowed to use a non-portable cluster size. Valid values for\n' + ':py:obj:`~.cudaLaunchAttributeValue.portableClusterSizeMode` are values for\n' + ':py:obj:`~.cudaLaunchAttributePortableClusterMode` Any other value will\n' + 'return :py:obj:`~.cudaErrorInvalidValue`\n' + ) + + + cudaLaunchAttributeSharedMemoryMode = ( + cyruntime.cudaLaunchAttributeID.cudaLaunchAttributeSharedMemoryMode, + 'Valid for graph nodes, launches. This indicates that the kernel launch is\n' + 'allowed to use a non-portable shared memory mode.\n' + ) + +class cudaAsyncNotificationType(_FastEnum): """ - Specifies the memory protection flags for mapping. + Types of async notification that can occur """ - {{if 'cudaMemAccessFlagsProtNone' in found_values}} - #: Default, make the address range not accessible - cudaMemAccessFlagsProtNone = ccudart.cudaMemAccessFlags.cudaMemAccessFlagsProtNone{{endif}} - {{if 'cudaMemAccessFlagsProtRead' in found_values}} - #: Make the address range read accessible - cudaMemAccessFlagsProtRead = ccudart.cudaMemAccessFlags.cudaMemAccessFlagsProtRead{{endif}} - {{if 'cudaMemAccessFlagsProtReadWrite' in found_values}} + cudaAsyncNotificationTypeOverBudget = ( + cyruntime.cudaAsyncNotificationType_enum.cudaAsyncNotificationTypeOverBudget, + 'Sent when the process has exceeded its device memory budget\n' + ) - #: Make the address range read-write accessible - cudaMemAccessFlagsProtReadWrite = ccudart.cudaMemAccessFlags.cudaMemAccessFlagsProtReadWrite{{endif}} -{{endif}} -{{if 'cudaMemAllocationType' in found_types}} - -class cudaMemAllocationType(IntEnum): +class cudaLogLevel(_FastEnum): """ - Defines the allocation types available + """ - {{if 'cudaMemAllocationTypeInvalid' in found_values}} - cudaMemAllocationTypeInvalid = ccudart.cudaMemAllocationType.cudaMemAllocationTypeInvalid{{endif}} - {{if 'cudaMemAllocationTypePinned' in found_values}} - #: This allocation type is 'pinned', i.e. cannot migrate from its - #: current location while the application is actively using it - cudaMemAllocationTypePinned = ccudart.cudaMemAllocationType.cudaMemAllocationTypePinned{{endif}} - {{if 'cudaMemAllocationTypeMax' in found_values}} - cudaMemAllocationTypeMax = ccudart.cudaMemAllocationType.cudaMemAllocationTypeMax{{endif}} -{{endif}} -{{if 'cudaMemAllocationHandleType' in found_types}} + cudaLogLevelError = cyruntime.CUDAlogLevel_enum.cudaLogLevelError + + cudaLogLevelWarning = cyruntime.CUDAlogLevel_enum.cudaLogLevelWarning -class cudaMemAllocationHandleType(IntEnum): +class cudaDataType(_FastEnum): """ - Flags for specifying particular handle types + """ - {{if 'cudaMemHandleTypeNone' in found_values}} - #: Does not allow any export mechanism. > - cudaMemHandleTypeNone = ccudart.cudaMemAllocationHandleType.cudaMemHandleTypeNone{{endif}} - {{if 'cudaMemHandleTypePosixFileDescriptor' in found_values}} + CUDA_R_32F = cyruntime.cudaDataType_t.CUDA_R_32F - #: Allows a file descriptor to be used for exporting. Permitted only on - #: POSIX systems. (int) - cudaMemHandleTypePosixFileDescriptor = ccudart.cudaMemAllocationHandleType.cudaMemHandleTypePosixFileDescriptor{{endif}} - {{if 'cudaMemHandleTypeWin32' in found_values}} + CUDA_R_64F = cyruntime.cudaDataType_t.CUDA_R_64F - #: Allows a Win32 NT handle to be used for exporting. (HANDLE) - cudaMemHandleTypeWin32 = ccudart.cudaMemAllocationHandleType.cudaMemHandleTypeWin32{{endif}} - {{if 'cudaMemHandleTypeWin32Kmt' in found_values}} + CUDA_R_16F = cyruntime.cudaDataType_t.CUDA_R_16F - #: Allows a Win32 KMT handle to be used for exporting. (D3DKMT_HANDLE) - cudaMemHandleTypeWin32Kmt = ccudart.cudaMemAllocationHandleType.cudaMemHandleTypeWin32Kmt{{endif}} - {{if 'cudaMemHandleTypeFabric' in found_values}} + CUDA_R_8I = cyruntime.cudaDataType_t.CUDA_R_8I - #: Allows a fabric handle to be used for exporting. - #: (cudaMemFabricHandle_t) - cudaMemHandleTypeFabric = ccudart.cudaMemAllocationHandleType.cudaMemHandleTypeFabric{{endif}} -{{endif}} -{{if 'cudaGraphMemAttributeType' in found_types}} + CUDA_C_32F = cyruntime.cudaDataType_t.CUDA_C_32F -class cudaGraphMemAttributeType(IntEnum): - """ - Graph memory attributes - """ - {{if 'cudaGraphMemAttrUsedMemCurrent' in found_values}} + CUDA_C_64F = cyruntime.cudaDataType_t.CUDA_C_64F - #: (value type = cuuint64_t) Amount of memory, in bytes, currently - #: associated with graphs. - cudaGraphMemAttrUsedMemCurrent = ccudart.cudaGraphMemAttributeType.cudaGraphMemAttrUsedMemCurrent{{endif}} - {{if 'cudaGraphMemAttrUsedMemHigh' in found_values}} + CUDA_C_16F = cyruntime.cudaDataType_t.CUDA_C_16F - #: (value type = cuuint64_t) High watermark of memory, in bytes, - #: associated with graphs since the last time it was reset. High - #: watermark can only be reset to zero. - cudaGraphMemAttrUsedMemHigh = ccudart.cudaGraphMemAttributeType.cudaGraphMemAttrUsedMemHigh{{endif}} - {{if 'cudaGraphMemAttrReservedMemCurrent' in found_values}} + CUDA_C_8I = cyruntime.cudaDataType_t.CUDA_C_8I - #: (value type = cuuint64_t) Amount of memory, in bytes, currently - #: allocated for use by the CUDA graphs asynchronous allocator. - cudaGraphMemAttrReservedMemCurrent = ccudart.cudaGraphMemAttributeType.cudaGraphMemAttrReservedMemCurrent{{endif}} - {{if 'cudaGraphMemAttrReservedMemHigh' in found_values}} + CUDA_R_8U = cyruntime.cudaDataType_t.CUDA_R_8U - #: (value type = cuuint64_t) High watermark of memory, in bytes, - #: currently allocated for use by the CUDA graphs asynchronous - #: allocator. - cudaGraphMemAttrReservedMemHigh = ccudart.cudaGraphMemAttributeType.cudaGraphMemAttrReservedMemHigh{{endif}} -{{endif}} -{{if 'cudaDeviceP2PAttr' in found_types}} + CUDA_C_8U = cyruntime.cudaDataType_t.CUDA_C_8U -class cudaDeviceP2PAttr(IntEnum): - """ - CUDA device P2P attributes - """ - {{if 'cudaDevP2PAttrPerformanceRank' in found_values}} + CUDA_R_32I = cyruntime.cudaDataType_t.CUDA_R_32I - #: A relative value indicating the performance of the link between two - #: devices - cudaDevP2PAttrPerformanceRank = ccudart.cudaDeviceP2PAttr.cudaDevP2PAttrPerformanceRank{{endif}} - {{if 'cudaDevP2PAttrAccessSupported' in found_values}} + CUDA_C_32I = cyruntime.cudaDataType_t.CUDA_C_32I - #: Peer access is enabled - cudaDevP2PAttrAccessSupported = ccudart.cudaDeviceP2PAttr.cudaDevP2PAttrAccessSupported{{endif}} - {{if 'cudaDevP2PAttrNativeAtomicSupported' in found_values}} + CUDA_R_32U = cyruntime.cudaDataType_t.CUDA_R_32U - #: Native atomic operation over the link supported - cudaDevP2PAttrNativeAtomicSupported = ccudart.cudaDeviceP2PAttr.cudaDevP2PAttrNativeAtomicSupported{{endif}} - {{if 'cudaDevP2PAttrCudaArrayAccessSupported' in found_values}} + CUDA_C_32U = cyruntime.cudaDataType_t.CUDA_C_32U - #: Accessing CUDA arrays over the link supported - cudaDevP2PAttrCudaArrayAccessSupported = ccudart.cudaDeviceP2PAttr.cudaDevP2PAttrCudaArrayAccessSupported{{endif}} -{{endif}} -{{if 'cudaExternalMemoryHandleType' in found_types}} + CUDA_R_16BF = cyruntime.cudaDataType_t.CUDA_R_16BF -class cudaExternalMemoryHandleType(IntEnum): - """ - External memory handle types - """ - {{if 'cudaExternalMemoryHandleTypeOpaqueFd' in found_values}} + CUDA_C_16BF = cyruntime.cudaDataType_t.CUDA_C_16BF - #: Handle is an opaque file descriptor - cudaExternalMemoryHandleTypeOpaqueFd = ccudart.cudaExternalMemoryHandleType.cudaExternalMemoryHandleTypeOpaqueFd{{endif}} - {{if 'cudaExternalMemoryHandleTypeOpaqueWin32' in found_values}} + CUDA_R_4I = cyruntime.cudaDataType_t.CUDA_R_4I - #: Handle is an opaque shared NT handle - cudaExternalMemoryHandleTypeOpaqueWin32 = ccudart.cudaExternalMemoryHandleType.cudaExternalMemoryHandleTypeOpaqueWin32{{endif}} - {{if 'cudaExternalMemoryHandleTypeOpaqueWin32Kmt' in found_values}} + CUDA_C_4I = cyruntime.cudaDataType_t.CUDA_C_4I - #: Handle is an opaque, globally shared handle - cudaExternalMemoryHandleTypeOpaqueWin32Kmt = ccudart.cudaExternalMemoryHandleType.cudaExternalMemoryHandleTypeOpaqueWin32Kmt{{endif}} - {{if 'cudaExternalMemoryHandleTypeD3D12Heap' in found_values}} + CUDA_R_4U = cyruntime.cudaDataType_t.CUDA_R_4U - #: Handle is a D3D12 heap object - cudaExternalMemoryHandleTypeD3D12Heap = ccudart.cudaExternalMemoryHandleType.cudaExternalMemoryHandleTypeD3D12Heap{{endif}} - {{if 'cudaExternalMemoryHandleTypeD3D12Resource' in found_values}} + CUDA_C_4U = cyruntime.cudaDataType_t.CUDA_C_4U - #: Handle is a D3D12 committed resource - cudaExternalMemoryHandleTypeD3D12Resource = ccudart.cudaExternalMemoryHandleType.cudaExternalMemoryHandleTypeD3D12Resource{{endif}} - {{if 'cudaExternalMemoryHandleTypeD3D11Resource' in found_values}} + CUDA_R_16I = cyruntime.cudaDataType_t.CUDA_R_16I - #: Handle is a shared NT handle to a D3D11 resource - cudaExternalMemoryHandleTypeD3D11Resource = ccudart.cudaExternalMemoryHandleType.cudaExternalMemoryHandleTypeD3D11Resource{{endif}} - {{if 'cudaExternalMemoryHandleTypeD3D11ResourceKmt' in found_values}} + CUDA_C_16I = cyruntime.cudaDataType_t.CUDA_C_16I - #: Handle is a globally shared handle to a D3D11 resource - cudaExternalMemoryHandleTypeD3D11ResourceKmt = ccudart.cudaExternalMemoryHandleType.cudaExternalMemoryHandleTypeD3D11ResourceKmt{{endif}} - {{if 'cudaExternalMemoryHandleTypeNvSciBuf' in found_values}} + CUDA_R_16U = cyruntime.cudaDataType_t.CUDA_R_16U - #: Handle is an NvSciBuf object - cudaExternalMemoryHandleTypeNvSciBuf = ccudart.cudaExternalMemoryHandleType.cudaExternalMemoryHandleTypeNvSciBuf{{endif}} -{{endif}} -{{if 'cudaExternalSemaphoreHandleType' in found_types}} + CUDA_C_16U = cyruntime.cudaDataType_t.CUDA_C_16U -class cudaExternalSemaphoreHandleType(IntEnum): - """ - External semaphore handle types - """ - {{if 'cudaExternalSemaphoreHandleTypeOpaqueFd' in found_values}} + CUDA_R_64I = cyruntime.cudaDataType_t.CUDA_R_64I - #: Handle is an opaque file descriptor - cudaExternalSemaphoreHandleTypeOpaqueFd = ccudart.cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeOpaqueFd{{endif}} - {{if 'cudaExternalSemaphoreHandleTypeOpaqueWin32' in found_values}} + CUDA_C_64I = cyruntime.cudaDataType_t.CUDA_C_64I - #: Handle is an opaque shared NT handle - cudaExternalSemaphoreHandleTypeOpaqueWin32 = ccudart.cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeOpaqueWin32{{endif}} - {{if 'cudaExternalSemaphoreHandleTypeOpaqueWin32Kmt' in found_values}} + CUDA_R_64U = cyruntime.cudaDataType_t.CUDA_R_64U - #: Handle is an opaque, globally shared handle - cudaExternalSemaphoreHandleTypeOpaqueWin32Kmt = ccudart.cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeOpaqueWin32Kmt{{endif}} - {{if 'cudaExternalSemaphoreHandleTypeD3D12Fence' in found_values}} + CUDA_C_64U = cyruntime.cudaDataType_t.CUDA_C_64U - #: Handle is a shared NT handle referencing a D3D12 fence object - cudaExternalSemaphoreHandleTypeD3D12Fence = ccudart.cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeD3D12Fence{{endif}} - {{if 'cudaExternalSemaphoreHandleTypeD3D11Fence' in found_values}} + CUDA_R_8F_E4M3 = cyruntime.cudaDataType_t.CUDA_R_8F_E4M3 - #: Handle is a shared NT handle referencing a D3D11 fence object - cudaExternalSemaphoreHandleTypeD3D11Fence = ccudart.cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeD3D11Fence{{endif}} - {{if 'cudaExternalSemaphoreHandleTypeNvSciSync' in found_values}} + CUDA_R_8F_UE4M3 = cyruntime.cudaDataType_t.CUDA_R_8F_UE4M3 - #: Opaque handle to NvSciSync Object - cudaExternalSemaphoreHandleTypeNvSciSync = ccudart.cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeNvSciSync{{endif}} - {{if 'cudaExternalSemaphoreHandleTypeKeyedMutex' in found_values}} + CUDA_R_8F_E5M2 = cyruntime.cudaDataType_t.CUDA_R_8F_E5M2 - #: Handle is a shared NT handle referencing a D3D11 keyed mutex object - cudaExternalSemaphoreHandleTypeKeyedMutex = ccudart.cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeKeyedMutex{{endif}} - {{if 'cudaExternalSemaphoreHandleTypeKeyedMutexKmt' in found_values}} + CUDA_R_8F_UE8M0 = cyruntime.cudaDataType_t.CUDA_R_8F_UE8M0 - #: Handle is a shared KMT handle referencing a D3D11 keyed mutex object - cudaExternalSemaphoreHandleTypeKeyedMutexKmt = ccudart.cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeKeyedMutexKmt{{endif}} - {{if 'cudaExternalSemaphoreHandleTypeTimelineSemaphoreFd' in found_values}} + CUDA_R_6F_E2M3 = cyruntime.cudaDataType_t.CUDA_R_6F_E2M3 - #: Handle is an opaque handle file descriptor referencing a timeline - #: semaphore - cudaExternalSemaphoreHandleTypeTimelineSemaphoreFd = ccudart.cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeTimelineSemaphoreFd{{endif}} - {{if 'cudaExternalSemaphoreHandleTypeTimelineSemaphoreWin32' in found_values}} + CUDA_R_6F_E3M2 = cyruntime.cudaDataType_t.CUDA_R_6F_E3M2 - #: Handle is an opaque handle file descriptor referencing a timeline - #: semaphore - cudaExternalSemaphoreHandleTypeTimelineSemaphoreWin32 = ccudart.cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeTimelineSemaphoreWin32{{endif}} -{{endif}} -{{if 'cudaCGScope' in found_types}} + CUDA_R_4F_E2M1 = cyruntime.cudaDataType_t.CUDA_R_4F_E2M1 -class cudaCGScope(IntEnum): +class cudaEmulationStrategy(_FastEnum): """ - CUDA cooperative group scope + Enum for specifying how to leverage floating-point emulation + algorithms """ - {{if 'cudaCGScopeInvalid' in found_values}} - #: Invalid cooperative group scope - cudaCGScopeInvalid = ccudart.cudaCGScope.cudaCGScopeInvalid{{endif}} - {{if 'cudaCGScopeGrid' in found_values}} - #: Scope represented by a grid_group - cudaCGScopeGrid = ccudart.cudaCGScope.cudaCGScopeGrid{{endif}} - {{if 'cudaCGScopeMultiGrid' in found_values}} + CUDA_EMULATION_STRATEGY_DEFAULT = ( + cyruntime.cudaEmulationStrategy_t.CUDA_EMULATION_STRATEGY_DEFAULT, + 'The default emulation strategy. For emulated computations, this is\n' + 'equivalent to CUDA_EMULATION_STRATEGY_PERFORMANT, unless a library\n' + 'dependent environment variable is set\n' + ) - #: Scope represented by a multi_grid_group - cudaCGScopeMultiGrid = ccudart.cudaCGScope.cudaCGScopeMultiGrid{{endif}} -{{endif}} -{{if 'cudaGraphConditionalHandleFlags' in found_types}} -class cudaGraphConditionalHandleFlags(IntEnum): - """ + CUDA_EMULATION_STRATEGY_PERFORMANT = ( + cyruntime.cudaEmulationStrategy_t.CUDA_EMULATION_STRATEGY_PERFORMANT, + 'An emulation strategy which configures libraries to use emulation when it\n' + 'provides a performance benefit\n' + ) - """ - {{if 'cudaGraphCondAssignDefault' in found_values}} - #: Apply default handle value when graph is launched. - cudaGraphCondAssignDefault = ccudart.cudaGraphConditionalHandleFlags.cudaGraphCondAssignDefault{{endif}} -{{endif}} -{{if 'cudaGraphConditionalNodeType' in found_types}} + CUDA_EMULATION_STRATEGY_EAGER = ( + cyruntime.cudaEmulationStrategy_t.CUDA_EMULATION_STRATEGY_EAGER, + 'An emulation strategy which configures libraries to use emulation whenever\n' + 'possible\n' + ) -class cudaGraphConditionalNodeType(IntEnum): +class cudaEmulationMantissaControl(_FastEnum): """ - CUDA conditional node types + Enum to configure the mantissa related parameters for floating- + point emulation algorithms """ - {{if 'cudaGraphCondTypeIf' in found_values}} - #: Conditional 'if' Node. Body executed once if condition value is non- - #: zero. - cudaGraphCondTypeIf = ccudart.cudaGraphConditionalNodeType.cudaGraphCondTypeIf{{endif}} - {{if 'cudaGraphCondTypeWhile' in found_values}} - #: Conditional 'while' Node. Body executed repeatedly while condition - #: value is non-zero. - cudaGraphCondTypeWhile = ccudart.cudaGraphConditionalNodeType.cudaGraphCondTypeWhile{{endif}} -{{endif}} -{{if 'cudaGraphNodeType' in found_types}} + CUDA_EMULATION_MANTISSA_CONTROL_DYNAMIC = ( + cyruntime.cudaEmulationMantissaControl_t.CUDA_EMULATION_MANTISSA_CONTROL_DYNAMIC, + 'The number of retained mantissa bits are computed at runtime to ensure the\n' + 'same or better accuracy than the floating point representation being\n' + 'emulated\n' + ) -class cudaGraphNodeType(IntEnum): - """ - CUDA Graph node types - """ - {{if 'cudaGraphNodeTypeKernel' in found_values}} - - #: GPU kernel node - cudaGraphNodeTypeKernel = ccudart.cudaGraphNodeType.cudaGraphNodeTypeKernel{{endif}} - {{if 'cudaGraphNodeTypeMemcpy' in found_values}} - - #: Memcpy node - cudaGraphNodeTypeMemcpy = ccudart.cudaGraphNodeType.cudaGraphNodeTypeMemcpy{{endif}} - {{if 'cudaGraphNodeTypeMemset' in found_values}} - - #: Memset node - cudaGraphNodeTypeMemset = ccudart.cudaGraphNodeType.cudaGraphNodeTypeMemset{{endif}} - {{if 'cudaGraphNodeTypeHost' in found_values}} - - #: Host (executable) node - cudaGraphNodeTypeHost = ccudart.cudaGraphNodeType.cudaGraphNodeTypeHost{{endif}} - {{if 'cudaGraphNodeTypeGraph' in found_values}} - - #: Node which executes an embedded graph - cudaGraphNodeTypeGraph = ccudart.cudaGraphNodeType.cudaGraphNodeTypeGraph{{endif}} - {{if 'cudaGraphNodeTypeEmpty' in found_values}} - - #: Empty (no-op) node - cudaGraphNodeTypeEmpty = ccudart.cudaGraphNodeType.cudaGraphNodeTypeEmpty{{endif}} - {{if 'cudaGraphNodeTypeWaitEvent' in found_values}} - - #: External event wait node - cudaGraphNodeTypeWaitEvent = ccudart.cudaGraphNodeType.cudaGraphNodeTypeWaitEvent{{endif}} - {{if 'cudaGraphNodeTypeEventRecord' in found_values}} - - #: External event record node - cudaGraphNodeTypeEventRecord = ccudart.cudaGraphNodeType.cudaGraphNodeTypeEventRecord{{endif}} - {{if 'cudaGraphNodeTypeExtSemaphoreSignal' in found_values}} - - #: External semaphore signal node - cudaGraphNodeTypeExtSemaphoreSignal = ccudart.cudaGraphNodeType.cudaGraphNodeTypeExtSemaphoreSignal{{endif}} - {{if 'cudaGraphNodeTypeExtSemaphoreWait' in found_values}} - - #: External semaphore wait node - cudaGraphNodeTypeExtSemaphoreWait = ccudart.cudaGraphNodeType.cudaGraphNodeTypeExtSemaphoreWait{{endif}} - {{if 'cudaGraphNodeTypeMemAlloc' in found_values}} - - #: Memory allocation node - cudaGraphNodeTypeMemAlloc = ccudart.cudaGraphNodeType.cudaGraphNodeTypeMemAlloc{{endif}} - {{if 'cudaGraphNodeTypeMemFree' in found_values}} - - #: Memory free node - cudaGraphNodeTypeMemFree = ccudart.cudaGraphNodeType.cudaGraphNodeTypeMemFree{{endif}} - {{if 'cudaGraphNodeTypeConditional' in found_values}} - - #: Conditional node May be used to - #: implement a conditional execution path or loop - #: inside of a graph. The graph(s) - #: contained within the body of the conditional node - #: can be selectively executed or - #: iterated upon based on the value of a conditional - #: variable. - #: - #: Handles must be created in - #: advance of creating the node - #: using - #: :py:obj:`~.cudaGraphConditionalHandleCreate`. - #: - #: The following restrictions apply - #: to graphs which contain conditional nodes: - #: The graph cannot be used in a - #: child node. - #: Only one instantiation of the - #: graph may exist at any point in time. - #: The graph cannot be cloned. - #: - #: To set the control value, supply - #: a default value when creating the handle and/or - #: call - #: :py:obj:`~.cudaGraphSetConditional` from device code. - cudaGraphNodeTypeConditional = ccudart.cudaGraphNodeType.cudaGraphNodeTypeConditional{{endif}} - {{if 'cudaGraphNodeTypeCount' in found_values}} - cudaGraphNodeTypeCount = ccudart.cudaGraphNodeType.cudaGraphNodeTypeCount{{endif}} -{{endif}} -{{if 'cudaGraphExecUpdateResult' in found_types}} - -class cudaGraphExecUpdateResult(IntEnum): + + CUDA_EMULATION_MANTISSA_CONTROL_FIXED = ( + cyruntime.cudaEmulationMantissaControl_t.CUDA_EMULATION_MANTISSA_CONTROL_FIXED, + 'The number of retained mantissa bits are known at runtime\n' + ) + +class cudaEmulationSpecialValuesSupport(_FastEnum): """ - CUDA Graph Update error types + Enum to configure how special floating-point values will be handled + by emulation algorithms """ - {{if 'cudaGraphExecUpdateSuccess' in found_values}} - #: The update succeeded - cudaGraphExecUpdateSuccess = ccudart.cudaGraphExecUpdateResult.cudaGraphExecUpdateSuccess{{endif}} - {{if 'cudaGraphExecUpdateError' in found_values}} - #: The update failed for an unexpected reason which is described in the - #: return value of the function - cudaGraphExecUpdateError = ccudart.cudaGraphExecUpdateResult.cudaGraphExecUpdateError{{endif}} - {{if 'cudaGraphExecUpdateErrorTopologyChanged' in found_values}} + CUDA_EMULATION_SPECIAL_VALUES_SUPPORT_NONE = ( + cyruntime.cudaEmulationSpecialValuesSupport_t.CUDA_EMULATION_SPECIAL_VALUES_SUPPORT_NONE, + 'There are no requirements for emulation algorithms to support special\n' + 'values\n' + ) - #: The update failed because the topology changed - cudaGraphExecUpdateErrorTopologyChanged = ccudart.cudaGraphExecUpdateResult.cudaGraphExecUpdateErrorTopologyChanged{{endif}} - {{if 'cudaGraphExecUpdateErrorNodeTypeChanged' in found_values}} - #: The update failed because a node type changed - cudaGraphExecUpdateErrorNodeTypeChanged = ccudart.cudaGraphExecUpdateResult.cudaGraphExecUpdateErrorNodeTypeChanged{{endif}} - {{if 'cudaGraphExecUpdateErrorFunctionChanged' in found_values}} + CUDA_EMULATION_SPECIAL_VALUES_SUPPORT_INFINITY = ( + cyruntime.cudaEmulationSpecialValuesSupport_t.CUDA_EMULATION_SPECIAL_VALUES_SUPPORT_INFINITY, + 'Require emulation algorithms to handle signed infinity inputs and outputs\n' + ) - #: The update failed because the function of a kernel node changed - #: (CUDA driver < 11.2) - cudaGraphExecUpdateErrorFunctionChanged = ccudart.cudaGraphExecUpdateResult.cudaGraphExecUpdateErrorFunctionChanged{{endif}} - {{if 'cudaGraphExecUpdateErrorParametersChanged' in found_values}} - #: The update failed because the parameters changed in a way that is - #: not supported - cudaGraphExecUpdateErrorParametersChanged = ccudart.cudaGraphExecUpdateResult.cudaGraphExecUpdateErrorParametersChanged{{endif}} - {{if 'cudaGraphExecUpdateErrorNotSupported' in found_values}} + CUDA_EMULATION_SPECIAL_VALUES_SUPPORT_NAN = ( + cyruntime.cudaEmulationSpecialValuesSupport_t.CUDA_EMULATION_SPECIAL_VALUES_SUPPORT_NAN, + 'Require emulation algorithms to handle NaN inputs and outputs\n' + ) - #: The update failed because something about the node is not supported - cudaGraphExecUpdateErrorNotSupported = ccudart.cudaGraphExecUpdateResult.cudaGraphExecUpdateErrorNotSupported{{endif}} - {{if 'cudaGraphExecUpdateErrorUnsupportedFunctionChange' in found_values}} - #: The update failed because the function of a kernel node changed in - #: an unsupported way - cudaGraphExecUpdateErrorUnsupportedFunctionChange = ccudart.cudaGraphExecUpdateResult.cudaGraphExecUpdateErrorUnsupportedFunctionChange{{endif}} - {{if 'cudaGraphExecUpdateErrorAttributesChanged' in found_values}} + CUDA_EMULATION_SPECIAL_VALUES_SUPPORT_DEFAULT = ( + cyruntime.cudaEmulationSpecialValuesSupport_t.CUDA_EMULATION_SPECIAL_VALUES_SUPPORT_DEFAULT, + 'The default special value support mask which contains support for signed\n' + 'infinities and NaN values\n' + ) - #: The update failed because the node attributes changed in a way that - #: is not supported - cudaGraphExecUpdateErrorAttributesChanged = ccudart.cudaGraphExecUpdateResult.cudaGraphExecUpdateErrorAttributesChanged{{endif}} -{{endif}} -{{if 'cudaGraphKernelNodeField' in found_types}} - -class cudaGraphKernelNodeField(IntEnum): - """ - Specifies the field to update when performing multiple node updates - from the device +class libraryPropertyType(_FastEnum): """ - {{if 'cudaGraphKernelNodeFieldInvalid' in found_values}} - #: Invalid field - cudaGraphKernelNodeFieldInvalid = ccudart.cudaGraphKernelNodeField.cudaGraphKernelNodeFieldInvalid{{endif}} - {{if 'cudaGraphKernelNodeFieldGridDim' in found_values}} + """ - #: Grid dimension update - cudaGraphKernelNodeFieldGridDim = ccudart.cudaGraphKernelNodeField.cudaGraphKernelNodeFieldGridDim{{endif}} - {{if 'cudaGraphKernelNodeFieldParam' in found_values}} + MAJOR_VERSION = cyruntime.libraryPropertyType_t.MAJOR_VERSION - #: Kernel parameter update - cudaGraphKernelNodeFieldParam = ccudart.cudaGraphKernelNodeField.cudaGraphKernelNodeFieldParam{{endif}} - {{if 'cudaGraphKernelNodeFieldEnabled' in found_values}} + MINOR_VERSION = cyruntime.libraryPropertyType_t.MINOR_VERSION - #: Node enable/disable - cudaGraphKernelNodeFieldEnabled = ccudart.cudaGraphKernelNodeField.cudaGraphKernelNodeFieldEnabled{{endif}} -{{endif}} -{{if 'cudaGetDriverEntryPointFlags' in found_types}} + PATCH_LEVEL = cyruntime.libraryPropertyType_t.PATCH_LEVEL -class cudaGetDriverEntryPointFlags(IntEnum): +class cudaEglFrameType(_FastEnum): """ - Flags to specify search options to be used with - :py:obj:`~.cudaGetDriverEntryPoint` For more details see - :py:obj:`~.cuGetProcAddress` + CUDA EglFrame type - array or pointer """ - {{if 'cudaEnableDefault' in found_values}} - - #: Default search mode for driver symbols. - cudaEnableDefault = ccudart.cudaGetDriverEntryPointFlags.cudaEnableDefault{{endif}} - {{if 'cudaEnableLegacyStream' in found_values}} - #: Search for legacy versions of driver symbols. - cudaEnableLegacyStream = ccudart.cudaGetDriverEntryPointFlags.cudaEnableLegacyStream{{endif}} - {{if 'cudaEnablePerThreadDefaultStream' in found_values}} - #: Search for per-thread versions of driver symbols. - cudaEnablePerThreadDefaultStream = ccudart.cudaGetDriverEntryPointFlags.cudaEnablePerThreadDefaultStream{{endif}} -{{endif}} -{{if 'cudaDriverEntryPointQueryResult' in found_types}} + cudaEglFrameTypeArray = ( + cyruntime.cudaEglFrameType_enum.cudaEglFrameTypeArray, + 'Frame type CUDA array\n' + ) -class cudaDriverEntryPointQueryResult(IntEnum): - """ - Enum for status from obtaining driver entry points, used with - :py:obj:`~.cudaApiGetDriverEntryPoint` - """ - {{if 'cudaDriverEntryPointSuccess' in found_values}} - #: Search for symbol found a match - cudaDriverEntryPointSuccess = ccudart.cudaDriverEntryPointQueryResult.cudaDriverEntryPointSuccess{{endif}} - {{if 'cudaDriverEntryPointSymbolNotFound' in found_values}} + cudaEglFrameTypePitch = ( + cyruntime.cudaEglFrameType_enum.cudaEglFrameTypePitch, + 'Frame type CUDA pointer\n' + ) + +class cudaEglResourceLocationFlags(_FastEnum): + """ + Resource location flags- sysmem or vidmem For CUDA context on + iGPU, since video and system memory are equivalent - these flags + will not have an effect on the execution. For CUDA context on + dGPU, applications can use the flag + :py:obj:`~.cudaEglResourceLocationFlags` to give a hint about the + desired location. :py:obj:`~.cudaEglResourceLocationSysmem` - the + frame data is made resident on the system memory to be accessed by + CUDA. :py:obj:`~.cudaEglResourceLocationVidmem` - the frame data + is made resident on the dedicated video memory to be accessed by + CUDA. There may be an additional latency due to new allocation and + data migration, if the frame is produced on a different memory. + """ + + + cudaEglResourceLocationSysmem = ( + cyruntime.cudaEglResourceLocationFlags_enum.cudaEglResourceLocationSysmem, + 'Resource location sysmem\n' + ) - #: Search for symbol was not found - cudaDriverEntryPointSymbolNotFound = ccudart.cudaDriverEntryPointQueryResult.cudaDriverEntryPointSymbolNotFound{{endif}} - {{if 'cudaDriverEntryPointVersionNotSufficent' in found_values}} - #: Search for symbol was found but version wasn't great enough - cudaDriverEntryPointVersionNotSufficent = ccudart.cudaDriverEntryPointQueryResult.cudaDriverEntryPointVersionNotSufficent{{endif}} -{{endif}} -{{if 'cudaGraphDebugDotFlags' in found_types}} + cudaEglResourceLocationVidmem = ( + cyruntime.cudaEglResourceLocationFlags_enum.cudaEglResourceLocationVidmem, + 'Resource location vidmem\n' + ) -class cudaGraphDebugDotFlags(IntEnum): +class cudaEglColorFormat(_FastEnum): """ - CUDA Graph debug write options + CUDA EGL Color Format - The different planar and multiplanar + formats currently supported for CUDA_EGL interops. """ - {{if 'cudaGraphDebugDotFlagsVerbose' in found_values}} - #: Output all debug data as if every debug flag is enabled - cudaGraphDebugDotFlagsVerbose = ccudart.cudaGraphDebugDotFlags.cudaGraphDebugDotFlagsVerbose{{endif}} - {{if 'cudaGraphDebugDotFlagsKernelNodeParams' in found_values}} - #: Adds :py:obj:`~.cudaKernelNodeParams` to output - cudaGraphDebugDotFlagsKernelNodeParams = ccudart.cudaGraphDebugDotFlags.cudaGraphDebugDotFlagsKernelNodeParams{{endif}} - {{if 'cudaGraphDebugDotFlagsMemcpyNodeParams' in found_values}} + cudaEglColorFormatYUV420Planar = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatYUV420Planar, + 'Y, U, V in three surfaces, each in a separate surface, U/V width = 1/2 Y\n' + 'width, U/V height = 1/2 Y height.\n' + ) - #: Adds :py:obj:`~.cudaMemcpy3DParms` to output - cudaGraphDebugDotFlagsMemcpyNodeParams = ccudart.cudaGraphDebugDotFlags.cudaGraphDebugDotFlagsMemcpyNodeParams{{endif}} - {{if 'cudaGraphDebugDotFlagsMemsetNodeParams' in found_values}} - #: Adds :py:obj:`~.cudaMemsetParams` to output - cudaGraphDebugDotFlagsMemsetNodeParams = ccudart.cudaGraphDebugDotFlags.cudaGraphDebugDotFlagsMemsetNodeParams{{endif}} - {{if 'cudaGraphDebugDotFlagsHostNodeParams' in found_values}} + cudaEglColorFormatYUV420SemiPlanar = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatYUV420SemiPlanar, + 'Y, UV in two surfaces (UV as one surface) with VU byte ordering, width,\n' + 'height ratio same as YUV420Planar.\n' + ) - #: Adds :py:obj:`~.cudaHostNodeParams` to output - cudaGraphDebugDotFlagsHostNodeParams = ccudart.cudaGraphDebugDotFlags.cudaGraphDebugDotFlagsHostNodeParams{{endif}} - {{if 'cudaGraphDebugDotFlagsEventNodeParams' in found_values}} - #: Adds cudaEvent_t handle from record and wait nodes to output - cudaGraphDebugDotFlagsEventNodeParams = ccudart.cudaGraphDebugDotFlags.cudaGraphDebugDotFlagsEventNodeParams{{endif}} - {{if 'cudaGraphDebugDotFlagsExtSemasSignalNodeParams' in found_values}} + cudaEglColorFormatYUV422Planar = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatYUV422Planar, + 'Y, U, V each in a separate surface, U/V width = 1/2 Y width, U/V height = Y\n' + 'height.\n' + ) - #: Adds :py:obj:`~.cudaExternalSemaphoreSignalNodeParams` values to - #: output - cudaGraphDebugDotFlagsExtSemasSignalNodeParams = ccudart.cudaGraphDebugDotFlags.cudaGraphDebugDotFlagsExtSemasSignalNodeParams{{endif}} - {{if 'cudaGraphDebugDotFlagsExtSemasWaitNodeParams' in found_values}} - #: Adds :py:obj:`~.cudaExternalSemaphoreWaitNodeParams` to output - cudaGraphDebugDotFlagsExtSemasWaitNodeParams = ccudart.cudaGraphDebugDotFlags.cudaGraphDebugDotFlagsExtSemasWaitNodeParams{{endif}} - {{if 'cudaGraphDebugDotFlagsKernelNodeAttributes' in found_values}} + cudaEglColorFormatYUV422SemiPlanar = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatYUV422SemiPlanar, + 'Y, UV in two surfaces with VU byte ordering, width, height ratio same as\n' + 'YUV422Planar.\n' + ) - #: Adds cudaKernelNodeAttrID values to output - cudaGraphDebugDotFlagsKernelNodeAttributes = ccudart.cudaGraphDebugDotFlags.cudaGraphDebugDotFlagsKernelNodeAttributes{{endif}} - {{if 'cudaGraphDebugDotFlagsHandles' in found_values}} - #: Adds node handles and every kernel function handle to output - cudaGraphDebugDotFlagsHandles = ccudart.cudaGraphDebugDotFlags.cudaGraphDebugDotFlagsHandles{{endif}} - {{if 'cudaGraphDebugDotFlagsConditionalNodeParams' in found_values}} + cudaEglColorFormatARGB = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatARGB, + 'R/G/B/A four channels in one surface with BGRA byte ordering.\n' + ) - #: Adds :py:obj:`~.cudaConditionalNodeParams` to output - cudaGraphDebugDotFlagsConditionalNodeParams = ccudart.cudaGraphDebugDotFlags.cudaGraphDebugDotFlagsConditionalNodeParams{{endif}} -{{endif}} -{{if 'cudaGraphInstantiateFlags' in found_types}} -class cudaGraphInstantiateFlags(IntEnum): - """ - Flags for instantiating a graph - """ - {{if 'cudaGraphInstantiateFlagAutoFreeOnLaunch' in found_values}} + cudaEglColorFormatRGBA = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatRGBA, + 'R/G/B/A four channels in one surface with ABGR byte ordering.\n' + ) - #: Automatically free memory allocated in a graph before relaunching. - cudaGraphInstantiateFlagAutoFreeOnLaunch = ccudart.cudaGraphInstantiateFlags.cudaGraphInstantiateFlagAutoFreeOnLaunch{{endif}} - {{if 'cudaGraphInstantiateFlagUpload' in found_values}} - #: Automatically upload the graph after instantiation. Only supported - #: by - #: :py:obj:`~.cudaGraphInstantiateWithParams`. The upload will be - #: performed using the - #: stream provided in `instantiateParams`. - cudaGraphInstantiateFlagUpload = ccudart.cudaGraphInstantiateFlags.cudaGraphInstantiateFlagUpload{{endif}} - {{if 'cudaGraphInstantiateFlagDeviceLaunch' in found_values}} + cudaEglColorFormatL = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatL, + 'single luminance channel in one surface.\n' + ) - #: Instantiate the graph to be launchable from the device. This flag - #: can only - #: be used on platforms which support unified addressing. This flag - #: cannot be - #: used in conjunction with cudaGraphInstantiateFlagAutoFreeOnLaunch. - cudaGraphInstantiateFlagDeviceLaunch = ccudart.cudaGraphInstantiateFlags.cudaGraphInstantiateFlagDeviceLaunch{{endif}} - {{if 'cudaGraphInstantiateFlagUseNodePriority' in found_values}} - #: Run the graph using the per-node priority attributes rather than the - #: priority of the stream it is launched into. - cudaGraphInstantiateFlagUseNodePriority = ccudart.cudaGraphInstantiateFlags.cudaGraphInstantiateFlagUseNodePriority{{endif}} -{{endif}} -{{if 'cudaDeviceNumaConfig' in found_types}} + cudaEglColorFormatR = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatR, + 'single color channel in one surface.\n' + ) -class cudaDeviceNumaConfig(IntEnum): - """ - CUDA device NUMA config - """ - {{if 'cudaDeviceNumaConfigNone' in found_values}} - #: The GPU is not a NUMA node - cudaDeviceNumaConfigNone = ccudart.cudaDeviceNumaConfig.cudaDeviceNumaConfigNone{{endif}} - {{if 'cudaDeviceNumaConfigNumaNode' in found_values}} + cudaEglColorFormatYUV444Planar = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatYUV444Planar, + 'Y, U, V in three surfaces, each in a separate surface, U/V width = Y width,\n' + 'U/V height = Y height.\n' + ) - #: The GPU is a NUMA node, cudaDevAttrNumaId contains its NUMA ID - cudaDeviceNumaConfigNumaNode = ccudart.cudaDeviceNumaConfig.cudaDeviceNumaConfigNumaNode{{endif}} -{{endif}} -{{if 'cudaSurfaceBoundaryMode' in found_types}} -class cudaSurfaceBoundaryMode(IntEnum): - """ - CUDA Surface boundary modes - """ - {{if 'cudaBoundaryModeZero' in found_values}} + cudaEglColorFormatYUV444SemiPlanar = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatYUV444SemiPlanar, + 'Y, UV in two surfaces (UV as one surface) with VU byte ordering, width,\n' + 'height ratio same as YUV444Planar.\n' + ) - #: Zero boundary mode - cudaBoundaryModeZero = ccudart.cudaSurfaceBoundaryMode.cudaBoundaryModeZero{{endif}} - {{if 'cudaBoundaryModeClamp' in found_values}} - #: Clamp boundary mode - cudaBoundaryModeClamp = ccudart.cudaSurfaceBoundaryMode.cudaBoundaryModeClamp{{endif}} - {{if 'cudaBoundaryModeTrap' in found_values}} + cudaEglColorFormatYUYV422 = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatYUYV422, + 'Y, U, V in one surface, interleaved as UYVY in one channel.\n' + ) - #: Trap boundary mode - cudaBoundaryModeTrap = ccudart.cudaSurfaceBoundaryMode.cudaBoundaryModeTrap{{endif}} -{{endif}} -{{if 'cudaSurfaceFormatMode' in found_types}} -class cudaSurfaceFormatMode(IntEnum): - """ - CUDA Surface format modes - """ - {{if 'cudaFormatModeForced' in found_values}} + cudaEglColorFormatUYVY422 = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatUYVY422, + 'Y, U, V in one surface, interleaved as YUYV in one channel.\n' + ) - #: Forced format mode - cudaFormatModeForced = ccudart.cudaSurfaceFormatMode.cudaFormatModeForced{{endif}} - {{if 'cudaFormatModeAuto' in found_values}} - #: Auto format mode - cudaFormatModeAuto = ccudart.cudaSurfaceFormatMode.cudaFormatModeAuto{{endif}} -{{endif}} -{{if 'cudaTextureAddressMode' in found_types}} + cudaEglColorFormatABGR = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatABGR, + 'R/G/B/A four channels in one surface with RGBA byte ordering.\n' + ) -class cudaTextureAddressMode(IntEnum): - """ - CUDA texture address modes - """ - {{if 'cudaAddressModeWrap' in found_values}} - #: Wrapping address mode - cudaAddressModeWrap = ccudart.cudaTextureAddressMode.cudaAddressModeWrap{{endif}} - {{if 'cudaAddressModeClamp' in found_values}} + cudaEglColorFormatBGRA = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatBGRA, + 'R/G/B/A four channels in one surface with ARGB byte ordering.\n' + ) - #: Clamp to edge address mode - cudaAddressModeClamp = ccudart.cudaTextureAddressMode.cudaAddressModeClamp{{endif}} - {{if 'cudaAddressModeMirror' in found_values}} - #: Mirror address mode - cudaAddressModeMirror = ccudart.cudaTextureAddressMode.cudaAddressModeMirror{{endif}} - {{if 'cudaAddressModeBorder' in found_values}} + cudaEglColorFormatA = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatA, + 'Alpha color format - one channel in one surface.\n' + ) - #: Border address mode - cudaAddressModeBorder = ccudart.cudaTextureAddressMode.cudaAddressModeBorder{{endif}} -{{endif}} -{{if 'cudaTextureFilterMode' in found_types}} -class cudaTextureFilterMode(IntEnum): - """ - CUDA texture filter modes - """ - {{if 'cudaFilterModePoint' in found_values}} + cudaEglColorFormatRG = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatRG, + 'R/G color format - two channels in one surface with GR byte ordering\n' + ) - #: Point filter mode - cudaFilterModePoint = ccudart.cudaTextureFilterMode.cudaFilterModePoint{{endif}} - {{if 'cudaFilterModeLinear' in found_values}} - #: Linear filter mode - cudaFilterModeLinear = ccudart.cudaTextureFilterMode.cudaFilterModeLinear{{endif}} -{{endif}} -{{if 'cudaTextureReadMode' in found_types}} + cudaEglColorFormatAYUV = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatAYUV, + 'Y, U, V, A four channels in one surface, interleaved as VUYA.\n' + ) -class cudaTextureReadMode(IntEnum): - """ - CUDA texture read modes - """ - {{if 'cudaReadModeElementType' in found_values}} - #: Read texture as specified element type - cudaReadModeElementType = ccudart.cudaTextureReadMode.cudaReadModeElementType{{endif}} - {{if 'cudaReadModeNormalizedFloat' in found_values}} + cudaEglColorFormatYVU444SemiPlanar = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatYVU444SemiPlanar, + 'Y, VU in two surfaces (VU as one surface) with UV byte ordering, U/V width\n' + '= Y width, U/V height = Y height.\n' + ) - #: Read texture as normalized float - cudaReadModeNormalizedFloat = ccudart.cudaTextureReadMode.cudaReadModeNormalizedFloat{{endif}} -{{endif}} -{{if 'cudaRoundMode' in found_types}} -class cudaRoundMode(IntEnum): - """""" - {{if 'cudaRoundNearest' in found_values}} - cudaRoundNearest = ccudart.cudaRoundMode.cudaRoundNearest{{endif}} - {{if 'cudaRoundZero' in found_values}} - cudaRoundZero = ccudart.cudaRoundMode.cudaRoundZero{{endif}} - {{if 'cudaRoundPosInf' in found_values}} - cudaRoundPosInf = ccudart.cudaRoundMode.cudaRoundPosInf{{endif}} - {{if 'cudaRoundMinInf' in found_values}} - cudaRoundMinInf = ccudart.cudaRoundMode.cudaRoundMinInf{{endif}} -{{endif}} -{{if True}} - -class cudaGLDeviceList(IntEnum): - """ - CUDA devices corresponding to the current OpenGL context - """ - {{if True}} + cudaEglColorFormatYVU422SemiPlanar = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatYVU422SemiPlanar, + 'Y, VU in two surfaces (VU as one surface) with UV byte ordering, U/V width\n' + '= 1/2 Y width, U/V height = Y height.\n' + ) - #: The CUDA devices for all GPUs used by the current OpenGL context - cudaGLDeviceListAll = ccudart.cudaGLDeviceList.cudaGLDeviceListAll{{endif}} - {{if True}} - #: The CUDA devices for the GPUs used by the current OpenGL context in - #: its currently rendering frame - cudaGLDeviceListCurrentFrame = ccudart.cudaGLDeviceList.cudaGLDeviceListCurrentFrame{{endif}} - {{if True}} + cudaEglColorFormatYVU420SemiPlanar = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatYVU420SemiPlanar, + 'Y, VU in two surfaces (VU as one surface) with UV byte ordering, U/V width\n' + '= 1/2 Y width, U/V height = 1/2 Y height.\n' + ) - #: The CUDA devices for the GPUs to be used by the current OpenGL - #: context in the next frame - cudaGLDeviceListNextFrame = ccudart.cudaGLDeviceList.cudaGLDeviceListNextFrame{{endif}} -{{endif}} -{{if True}} -class cudaGLMapFlags(IntEnum): - """ - CUDA GL Map Flags - """ - {{if True}} + cudaEglColorFormatY10V10U10_444SemiPlanar = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatY10V10U10_444SemiPlanar, + 'Y10, V10U10 in two surfaces (VU as one surface) with UV byte ordering, U/V\n' + 'width = Y width, U/V height = Y height.\n' + ) - #: Default; Assume resource can be read/written - cudaGLMapFlagsNone = ccudart.cudaGLMapFlags.cudaGLMapFlagsNone{{endif}} - {{if True}} - #: CUDA kernels will not write to this resource - cudaGLMapFlagsReadOnly = ccudart.cudaGLMapFlags.cudaGLMapFlagsReadOnly{{endif}} - {{if True}} + cudaEglColorFormatY10V10U10_420SemiPlanar = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatY10V10U10_420SemiPlanar, + 'Y10, V10U10 in two surfaces (VU as one surface) with UV byte ordering, U/V\n' + 'width = 1/2 Y width, U/V height = 1/2 Y height.\n' + ) - #: CUDA kernels will only write to and will not read from this resource - cudaGLMapFlagsWriteDiscard = ccudart.cudaGLMapFlags.cudaGLMapFlagsWriteDiscard{{endif}} -{{endif}} -{{if 'cudaLaunchAttributeID' in found_types}} -class cudaStreamAttrID(IntEnum): - """ - Launch attributes enum; used as id field of - :py:obj:`~.cudaLaunchAttribute` - """ - {{if 'cudaLaunchAttributeIgnore' in found_values}} - - #: Ignored entry, for convenient composition - cudaLaunchAttributeIgnore = ccudart.cudaLaunchAttributeID.cudaLaunchAttributeIgnore{{endif}} - {{if 'cudaLaunchAttributeAccessPolicyWindow' in found_values}} - - #: Valid for streams, graph nodes, launches. See - #: :py:obj:`~.cudaLaunchAttributeValue.accessPolicyWindow`. - cudaLaunchAttributeAccessPolicyWindow = ccudart.cudaLaunchAttributeID.cudaLaunchAttributeAccessPolicyWindow{{endif}} - {{if 'cudaLaunchAttributeCooperative' in found_values}} - - #: Valid for graph nodes, launches. See - #: :py:obj:`~.cudaLaunchAttributeValue.cooperative`. - cudaLaunchAttributeCooperative = ccudart.cudaLaunchAttributeID.cudaLaunchAttributeCooperative{{endif}} - {{if 'cudaLaunchAttributeSynchronizationPolicy' in found_values}} - - #: Valid for streams. See - #: :py:obj:`~.cudaLaunchAttributeValue.syncPolicy`. - cudaLaunchAttributeSynchronizationPolicy = ccudart.cudaLaunchAttributeID.cudaLaunchAttributeSynchronizationPolicy{{endif}} - {{if 'cudaLaunchAttributeClusterDimension' in found_values}} - - #: Valid for graph nodes, launches. See - #: :py:obj:`~.cudaLaunchAttributeValue.clusterDim`. - cudaLaunchAttributeClusterDimension = ccudart.cudaLaunchAttributeID.cudaLaunchAttributeClusterDimension{{endif}} - {{if 'cudaLaunchAttributeClusterSchedulingPolicyPreference' in found_values}} - - #: Valid for graph nodes, launches. See - #: :py:obj:`~.cudaLaunchAttributeValue.clusterSchedulingPolicyPreference`. - cudaLaunchAttributeClusterSchedulingPolicyPreference = ccudart.cudaLaunchAttributeID.cudaLaunchAttributeClusterSchedulingPolicyPreference{{endif}} - {{if 'cudaLaunchAttributeProgrammaticStreamSerialization' in found_values}} - - #: Valid for launches. Setting - #: :py:obj:`~.cudaLaunchAttributeValue.programmaticStreamSerializationAllowed` - #: to non-0 signals that the kernel will use programmatic means to - #: resolve its stream dependency, so that the CUDA runtime should - #: opportunistically allow the grid's execution to overlap with the - #: previous kernel in the stream, if that kernel requests the overlap. - #: The dependent launches can choose to wait on the dependency using - #: the programmatic sync (cudaGridDependencySynchronize() or equivalent - #: PTX instructions). - cudaLaunchAttributeProgrammaticStreamSerialization = ccudart.cudaLaunchAttributeID.cudaLaunchAttributeProgrammaticStreamSerialization{{endif}} - {{if 'cudaLaunchAttributeProgrammaticEvent' in found_values}} - - #: Valid for launches. Set - #: :py:obj:`~.cudaLaunchAttributeValue.programmaticEvent` to record the - #: event. Event recorded through this launch attribute is guaranteed to - #: only trigger after all block in the associated kernel trigger the - #: event. A block can trigger the event programmatically in a future - #: CUDA release. A trigger can also be inserted at the beginning of - #: each block's execution if triggerAtBlockStart is set to non-0. The - #: dependent launches can choose to wait on the dependency using the - #: programmatic sync (cudaGridDependencySynchronize() or equivalent PTX - #: instructions). Note that dependents (including the CPU thread - #: calling :py:obj:`~.cudaEventSynchronize()`) are not guaranteed to - #: observe the release precisely when it is released. For example, - #: :py:obj:`~.cudaEventSynchronize()` may only observe the event - #: trigger long after the associated kernel has completed. This - #: recording type is primarily meant for establishing programmatic - #: dependency between device tasks. Note also this type of dependency - #: allows, but does not guarantee, concurrent execution of tasks. - #: The event supplied must not be an interprocess or interop event. - #: The event must disable timing (i.e. must be created with the - #: :py:obj:`~.cudaEventDisableTiming` flag set). - cudaLaunchAttributeProgrammaticEvent = ccudart.cudaLaunchAttributeID.cudaLaunchAttributeProgrammaticEvent{{endif}} - {{if 'cudaLaunchAttributePriority' in found_values}} - - #: Valid for streams, graph nodes, launches. See - #: :py:obj:`~.cudaLaunchAttributeValue.priority`. - cudaLaunchAttributePriority = ccudart.cudaLaunchAttributeID.cudaLaunchAttributePriority{{endif}} - {{if 'cudaLaunchAttributeMemSyncDomainMap' in found_values}} - - #: Valid for streams, graph nodes, launches. See - #: :py:obj:`~.cudaLaunchAttributeValue.memSyncDomainMap`. - cudaLaunchAttributeMemSyncDomainMap = ccudart.cudaLaunchAttributeID.cudaLaunchAttributeMemSyncDomainMap{{endif}} - {{if 'cudaLaunchAttributeMemSyncDomain' in found_values}} - - #: Valid for streams, graph nodes, launches. See - #: :py:obj:`~.cudaLaunchAttributeValue.memSyncDomain`. - cudaLaunchAttributeMemSyncDomain = ccudart.cudaLaunchAttributeID.cudaLaunchAttributeMemSyncDomain{{endif}} - {{if 'cudaLaunchAttributeLaunchCompletionEvent' in found_values}} - - #: Valid for launches. Set - #: :py:obj:`~.cudaLaunchAttributeValue.launchCompletionEvent` to record - #: the event. - #: Nominally, the event is triggered once all blocks of the kernel - #: have begun execution. Currently this is a best effort. If a kernel B - #: has a launch completion dependency on a kernel A, B may wait until A - #: is complete. Alternatively, blocks of B may begin before all blocks - #: of A have begun, for example if B can claim execution resources - #: unavailable to A (e.g. they run on different GPUs) or if B is a - #: higher priority than A. Exercise caution if such an ordering - #: inversion could lead to deadlock. - #: A launch completion event is nominally similar to a programmatic - #: event with `triggerAtBlockStart` set except that it is not visible - #: to `cudaGridDependencySynchronize()` and can be used with compute - #: capability less than 9.0. - #: The event supplied must not be an interprocess or interop event. - #: The event must disable timing (i.e. must be created with the - #: :py:obj:`~.cudaEventDisableTiming` flag set). - cudaLaunchAttributeLaunchCompletionEvent = ccudart.cudaLaunchAttributeID.cudaLaunchAttributeLaunchCompletionEvent{{endif}} - {{if 'cudaLaunchAttributeDeviceUpdatableKernelNode' in found_values}} - - #: Valid for graph nodes, launches. This attribute is graphs-only, and - #: passing it to a launch in a non-capturing stream will result in an - #: error. - #: :cudaLaunchAttributeValue::deviceUpdatableKernelNode::deviceUpdatable - #: can only be set to 0 or 1. Setting the field to 1 indicates that the - #: corresponding kernel node should be device-updatable. On success, a - #: handle will be returned via - #: :py:obj:`~.cudaLaunchAttributeValue`::deviceUpdatableKernelNode::devNode - #: which can be passed to the various device-side update functions to - #: update the node's kernel parameters from within another kernel. For - #: more information on the types of device updates that can be made, as - #: well as the relevant limitations thereof, see - #: :py:obj:`~.cudaGraphKernelNodeUpdatesApply`. - #: Nodes which are device-updatable have additional restrictions - #: compared to regular kernel nodes. Firstly, device-updatable nodes - #: cannot be removed from their graph via - #: :py:obj:`~.cudaGraphDestroyNode`. Additionally, once opted-in to - #: this functionality, a node cannot opt out, and any attempt to set - #: the deviceUpdatable attribute to 0 will result in an error. Device- - #: updatable kernel nodes also cannot have their attributes copied - #: to/from another kernel node via - #: :py:obj:`~.cudaGraphKernelNodeCopyAttributes`. Graphs containing one - #: or more device-updatable nodes also do not allow multiple - #: instantiation, and neither the graph nor its instantiated version - #: can be passed to :py:obj:`~.cudaGraphExecUpdate`. - #: If a graph contains device-updatable nodes and updates those nodes - #: from the device from within the graph, the graph must be uploaded - #: with :py:obj:`~.cuGraphUpload` before it is launched. For such a - #: graph, if host-side executable graph updates are made to the device- - #: updatable nodes, the graph must be uploaded before it is launched - #: again. - cudaLaunchAttributeDeviceUpdatableKernelNode = ccudart.cudaLaunchAttributeID.cudaLaunchAttributeDeviceUpdatableKernelNode{{endif}} - {{if 'cudaLaunchAttributePreferredSharedMemoryCarveout' in found_values}} - - #: Valid for launches. On devices where the L1 cache and shared memory - #: use the same hardware resources, setting - #: :py:obj:`~.cudaLaunchAttributeValue.sharedMemCarveout` to a - #: percentage between 0-100 signals sets the shared memory carveout - #: preference in percent of the total shared memory for that kernel - #: launch. This attribute takes precedence over - #: :py:obj:`~.cudaFuncAttributePreferredSharedMemoryCarveout`. This is - #: only a hint, and the driver can choose a different configuration if - #: required for the launch. - cudaLaunchAttributePreferredSharedMemoryCarveout = ccudart.cudaLaunchAttributeID.cudaLaunchAttributePreferredSharedMemoryCarveout{{endif}} -{{endif}} -{{if 'cudaLaunchAttributeID' in found_types}} - -class cudaKernelNodeAttrID(IntEnum): - """ - Launch attributes enum; used as id field of - :py:obj:`~.cudaLaunchAttribute` - """ - {{if 'cudaLaunchAttributeIgnore' in found_values}} - - #: Ignored entry, for convenient composition - cudaLaunchAttributeIgnore = ccudart.cudaLaunchAttributeID.cudaLaunchAttributeIgnore{{endif}} - {{if 'cudaLaunchAttributeAccessPolicyWindow' in found_values}} - - #: Valid for streams, graph nodes, launches. See - #: :py:obj:`~.cudaLaunchAttributeValue.accessPolicyWindow`. - cudaLaunchAttributeAccessPolicyWindow = ccudart.cudaLaunchAttributeID.cudaLaunchAttributeAccessPolicyWindow{{endif}} - {{if 'cudaLaunchAttributeCooperative' in found_values}} - - #: Valid for graph nodes, launches. See - #: :py:obj:`~.cudaLaunchAttributeValue.cooperative`. - cudaLaunchAttributeCooperative = ccudart.cudaLaunchAttributeID.cudaLaunchAttributeCooperative{{endif}} - {{if 'cudaLaunchAttributeSynchronizationPolicy' in found_values}} - - #: Valid for streams. See - #: :py:obj:`~.cudaLaunchAttributeValue.syncPolicy`. - cudaLaunchAttributeSynchronizationPolicy = ccudart.cudaLaunchAttributeID.cudaLaunchAttributeSynchronizationPolicy{{endif}} - {{if 'cudaLaunchAttributeClusterDimension' in found_values}} - - #: Valid for graph nodes, launches. See - #: :py:obj:`~.cudaLaunchAttributeValue.clusterDim`. - cudaLaunchAttributeClusterDimension = ccudart.cudaLaunchAttributeID.cudaLaunchAttributeClusterDimension{{endif}} - {{if 'cudaLaunchAttributeClusterSchedulingPolicyPreference' in found_values}} - - #: Valid for graph nodes, launches. See - #: :py:obj:`~.cudaLaunchAttributeValue.clusterSchedulingPolicyPreference`. - cudaLaunchAttributeClusterSchedulingPolicyPreference = ccudart.cudaLaunchAttributeID.cudaLaunchAttributeClusterSchedulingPolicyPreference{{endif}} - {{if 'cudaLaunchAttributeProgrammaticStreamSerialization' in found_values}} - - #: Valid for launches. Setting - #: :py:obj:`~.cudaLaunchAttributeValue.programmaticStreamSerializationAllowed` - #: to non-0 signals that the kernel will use programmatic means to - #: resolve its stream dependency, so that the CUDA runtime should - #: opportunistically allow the grid's execution to overlap with the - #: previous kernel in the stream, if that kernel requests the overlap. - #: The dependent launches can choose to wait on the dependency using - #: the programmatic sync (cudaGridDependencySynchronize() or equivalent - #: PTX instructions). - cudaLaunchAttributeProgrammaticStreamSerialization = ccudart.cudaLaunchAttributeID.cudaLaunchAttributeProgrammaticStreamSerialization{{endif}} - {{if 'cudaLaunchAttributeProgrammaticEvent' in found_values}} - - #: Valid for launches. Set - #: :py:obj:`~.cudaLaunchAttributeValue.programmaticEvent` to record the - #: event. Event recorded through this launch attribute is guaranteed to - #: only trigger after all block in the associated kernel trigger the - #: event. A block can trigger the event programmatically in a future - #: CUDA release. A trigger can also be inserted at the beginning of - #: each block's execution if triggerAtBlockStart is set to non-0. The - #: dependent launches can choose to wait on the dependency using the - #: programmatic sync (cudaGridDependencySynchronize() or equivalent PTX - #: instructions). Note that dependents (including the CPU thread - #: calling :py:obj:`~.cudaEventSynchronize()`) are not guaranteed to - #: observe the release precisely when it is released. For example, - #: :py:obj:`~.cudaEventSynchronize()` may only observe the event - #: trigger long after the associated kernel has completed. This - #: recording type is primarily meant for establishing programmatic - #: dependency between device tasks. Note also this type of dependency - #: allows, but does not guarantee, concurrent execution of tasks. - #: The event supplied must not be an interprocess or interop event. - #: The event must disable timing (i.e. must be created with the - #: :py:obj:`~.cudaEventDisableTiming` flag set). - cudaLaunchAttributeProgrammaticEvent = ccudart.cudaLaunchAttributeID.cudaLaunchAttributeProgrammaticEvent{{endif}} - {{if 'cudaLaunchAttributePriority' in found_values}} - - #: Valid for streams, graph nodes, launches. See - #: :py:obj:`~.cudaLaunchAttributeValue.priority`. - cudaLaunchAttributePriority = ccudart.cudaLaunchAttributeID.cudaLaunchAttributePriority{{endif}} - {{if 'cudaLaunchAttributeMemSyncDomainMap' in found_values}} - - #: Valid for streams, graph nodes, launches. See - #: :py:obj:`~.cudaLaunchAttributeValue.memSyncDomainMap`. - cudaLaunchAttributeMemSyncDomainMap = ccudart.cudaLaunchAttributeID.cudaLaunchAttributeMemSyncDomainMap{{endif}} - {{if 'cudaLaunchAttributeMemSyncDomain' in found_values}} - - #: Valid for streams, graph nodes, launches. See - #: :py:obj:`~.cudaLaunchAttributeValue.memSyncDomain`. - cudaLaunchAttributeMemSyncDomain = ccudart.cudaLaunchAttributeID.cudaLaunchAttributeMemSyncDomain{{endif}} - {{if 'cudaLaunchAttributeLaunchCompletionEvent' in found_values}} - - #: Valid for launches. Set - #: :py:obj:`~.cudaLaunchAttributeValue.launchCompletionEvent` to record - #: the event. - #: Nominally, the event is triggered once all blocks of the kernel - #: have begun execution. Currently this is a best effort. If a kernel B - #: has a launch completion dependency on a kernel A, B may wait until A - #: is complete. Alternatively, blocks of B may begin before all blocks - #: of A have begun, for example if B can claim execution resources - #: unavailable to A (e.g. they run on different GPUs) or if B is a - #: higher priority than A. Exercise caution if such an ordering - #: inversion could lead to deadlock. - #: A launch completion event is nominally similar to a programmatic - #: event with `triggerAtBlockStart` set except that it is not visible - #: to `cudaGridDependencySynchronize()` and can be used with compute - #: capability less than 9.0. - #: The event supplied must not be an interprocess or interop event. - #: The event must disable timing (i.e. must be created with the - #: :py:obj:`~.cudaEventDisableTiming` flag set). - cudaLaunchAttributeLaunchCompletionEvent = ccudart.cudaLaunchAttributeID.cudaLaunchAttributeLaunchCompletionEvent{{endif}} - {{if 'cudaLaunchAttributeDeviceUpdatableKernelNode' in found_values}} - - #: Valid for graph nodes, launches. This attribute is graphs-only, and - #: passing it to a launch in a non-capturing stream will result in an - #: error. - #: :cudaLaunchAttributeValue::deviceUpdatableKernelNode::deviceUpdatable - #: can only be set to 0 or 1. Setting the field to 1 indicates that the - #: corresponding kernel node should be device-updatable. On success, a - #: handle will be returned via - #: :py:obj:`~.cudaLaunchAttributeValue`::deviceUpdatableKernelNode::devNode - #: which can be passed to the various device-side update functions to - #: update the node's kernel parameters from within another kernel. For - #: more information on the types of device updates that can be made, as - #: well as the relevant limitations thereof, see - #: :py:obj:`~.cudaGraphKernelNodeUpdatesApply`. - #: Nodes which are device-updatable have additional restrictions - #: compared to regular kernel nodes. Firstly, device-updatable nodes - #: cannot be removed from their graph via - #: :py:obj:`~.cudaGraphDestroyNode`. Additionally, once opted-in to - #: this functionality, a node cannot opt out, and any attempt to set - #: the deviceUpdatable attribute to 0 will result in an error. Device- - #: updatable kernel nodes also cannot have their attributes copied - #: to/from another kernel node via - #: :py:obj:`~.cudaGraphKernelNodeCopyAttributes`. Graphs containing one - #: or more device-updatable nodes also do not allow multiple - #: instantiation, and neither the graph nor its instantiated version - #: can be passed to :py:obj:`~.cudaGraphExecUpdate`. - #: If a graph contains device-updatable nodes and updates those nodes - #: from the device from within the graph, the graph must be uploaded - #: with :py:obj:`~.cuGraphUpload` before it is launched. For such a - #: graph, if host-side executable graph updates are made to the device- - #: updatable nodes, the graph must be uploaded before it is launched - #: again. - cudaLaunchAttributeDeviceUpdatableKernelNode = ccudart.cudaLaunchAttributeID.cudaLaunchAttributeDeviceUpdatableKernelNode{{endif}} - {{if 'cudaLaunchAttributePreferredSharedMemoryCarveout' in found_values}} - - #: Valid for launches. On devices where the L1 cache and shared memory - #: use the same hardware resources, setting - #: :py:obj:`~.cudaLaunchAttributeValue.sharedMemCarveout` to a - #: percentage between 0-100 signals sets the shared memory carveout - #: preference in percent of the total shared memory for that kernel - #: launch. This attribute takes precedence over - #: :py:obj:`~.cudaFuncAttributePreferredSharedMemoryCarveout`. This is - #: only a hint, and the driver can choose a different configuration if - #: required for the launch. - cudaLaunchAttributePreferredSharedMemoryCarveout = ccudart.cudaLaunchAttributeID.cudaLaunchAttributePreferredSharedMemoryCarveout{{endif}} -{{endif}} -{{if 'cudaArray_t' in found_types}} + cudaEglColorFormatY12V12U12_444SemiPlanar = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatY12V12U12_444SemiPlanar, + 'Y12, V12U12 in two surfaces (VU as one surface) with UV byte ordering, U/V\n' + 'width = Y width, U/V height = Y height.\n' + ) -cdef class cudaArray_t: - """ - CUDA array + cudaEglColorFormatY12V12U12_420SemiPlanar = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatY12V12U12_420SemiPlanar, + 'Y12, V12U12 in two surfaces (VU as one surface) with UV byte ordering, U/V\n' + 'width = 1/2 Y width, U/V height = 1/2 Y height.\n' + ) - Methods - ------- - getPtr() - Get memory address of class instance - """ - def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - self._ptr[0] = init_value - else: - self._ptr = _ptr - def __init__(self, *args, **kwargs): - pass - def __repr__(self): - return '' - def __index__(self): - return self.__int__() - def __int__(self): - return self._ptr[0] - def getPtr(self): - return self._ptr -{{endif}} + cudaEglColorFormatVYUY_ER = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatVYUY_ER, + 'Extended Range Y, U, V in one surface, interleaved as YVYU in one channel.\n' + ) -{{if 'cudaArray_const_t' in found_types}} -cdef class cudaArray_const_t: - """ + cudaEglColorFormatUYVY_ER = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatUYVY_ER, + 'Extended Range Y, U, V in one surface, interleaved as YUYV in one channel.\n' + ) - CUDA array (as source copy argument) - Methods - ------- - getPtr() - Get memory address of class instance + cudaEglColorFormatYUYV_ER = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatYUYV_ER, + 'Extended Range Y, U, V in one surface, interleaved as UYVY in one channel.\n' + ) - """ - def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - self._ptr[0] = init_value - else: - self._ptr = _ptr - def __init__(self, *args, **kwargs): - pass - def __repr__(self): - return '' - def __index__(self): - return self.__int__() - def __int__(self): - return self._ptr[0] - def getPtr(self): - return self._ptr -{{endif}} -{{if 'cudaMipmappedArray_t' in found_types}} + cudaEglColorFormatYVYU_ER = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatYVYU_ER, + 'Extended Range Y, U, V in one surface, interleaved as VYUY in one channel.\n' + ) -cdef class cudaMipmappedArray_t: - """ - CUDA mipmapped array + cudaEglColorFormatYUVA_ER = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatYUVA_ER, + 'Extended Range Y, U, V, A four channels in one surface, interleaved as\n' + 'AVUY.\n' + ) - Methods - ------- - getPtr() - Get memory address of class instance - """ - def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - self._ptr[0] = init_value - else: - self._ptr = _ptr - def __init__(self, *args, **kwargs): - pass - def __repr__(self): - return '' - def __index__(self): - return self.__int__() - def __int__(self): - return self._ptr[0] - def getPtr(self): - return self._ptr -{{endif}} + cudaEglColorFormatAYUV_ER = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatAYUV_ER, + 'Extended Range Y, U, V, A four channels in one surface, interleaved as\n' + 'VUYA.\n' + ) -{{if 'cudaMipmappedArray_const_t' in found_types}} -cdef class cudaMipmappedArray_const_t: - """ + cudaEglColorFormatYUV444Planar_ER = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatYUV444Planar_ER, + 'Extended Range Y, U, V in three surfaces, U/V width = Y width, U/V height =\n' + 'Y height.\n' + ) - CUDA mipmapped array (as source argument) - Methods - ------- - getPtr() - Get memory address of class instance + cudaEglColorFormatYUV422Planar_ER = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatYUV422Planar_ER, + 'Extended Range Y, U, V in three surfaces, U/V width = 1/2 Y width, U/V\n' + 'height = Y height.\n' + ) - """ - def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - self._ptr[0] = init_value - else: - self._ptr = _ptr - def __init__(self, *args, **kwargs): - pass - def __repr__(self): - return '' - def __index__(self): - return self.__int__() - def __int__(self): - return self._ptr[0] - def getPtr(self): - return self._ptr -{{endif}} -{{if 'cudaGraphicsResource_t' in found_types}} + cudaEglColorFormatYUV420Planar_ER = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatYUV420Planar_ER, + 'Extended Range Y, U, V in three surfaces, U/V width = 1/2 Y width, U/V\n' + 'height = 1/2 Y height.\n' + ) -cdef class cudaGraphicsResource_t: - """ - CUDA graphics resource types + cudaEglColorFormatYUV444SemiPlanar_ER = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatYUV444SemiPlanar_ER, + 'Extended Range Y, UV in two surfaces (UV as one surface) with VU byte\n' + 'ordering, U/V width = Y width, U/V height = Y height.\n' + ) - Methods - ------- - getPtr() - Get memory address of class instance - """ - def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - self._ptr[0] = init_value - else: - self._ptr = _ptr - def __init__(self, *args, **kwargs): - pass - def __repr__(self): - return '' - def __index__(self): - return self.__int__() - def __int__(self): - return self._ptr[0] - def getPtr(self): - return self._ptr -{{endif}} + cudaEglColorFormatYUV422SemiPlanar_ER = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatYUV422SemiPlanar_ER, + 'Extended Range Y, UV in two surfaces (UV as one surface) with VU byte\n' + 'ordering, U/V width = 1/2 Y width, U/V height = Y height.\n' + ) -{{if 'cudaExternalMemory_t' in found_types}} -cdef class cudaExternalMemory_t: - """ + cudaEglColorFormatYUV420SemiPlanar_ER = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatYUV420SemiPlanar_ER, + 'Extended Range Y, UV in two surfaces (UV as one surface) with VU byte\n' + 'ordering, U/V width = 1/2 Y width, U/V height = 1/2 Y height.\n' + ) - CUDA external memory - Methods - ------- - getPtr() - Get memory address of class instance + cudaEglColorFormatYVU444Planar_ER = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatYVU444Planar_ER, + 'Extended Range Y, V, U in three surfaces, U/V width = Y width, U/V height =\n' + 'Y height.\n' + ) - """ - def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - self._ptr[0] = init_value - else: - self._ptr = _ptr - def __init__(self, *args, **kwargs): - pass - def __repr__(self): - return '' - def __index__(self): - return self.__int__() - def __int__(self): - return self._ptr[0] - def getPtr(self): - return self._ptr -{{endif}} -{{if 'cudaExternalSemaphore_t' in found_types}} + cudaEglColorFormatYVU422Planar_ER = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatYVU422Planar_ER, + 'Extended Range Y, V, U in three surfaces, U/V width = 1/2 Y width, U/V\n' + 'height = Y height.\n' + ) -cdef class cudaExternalSemaphore_t: - """ - CUDA external semaphore + cudaEglColorFormatYVU420Planar_ER = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatYVU420Planar_ER, + 'Extended Range Y, V, U in three surfaces, U/V width = 1/2 Y width, U/V\n' + 'height = 1/2 Y height.\n' + ) - Methods - ------- - getPtr() - Get memory address of class instance - """ - def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - self._ptr[0] = init_value - else: - self._ptr = _ptr - def __init__(self, *args, **kwargs): - pass - def __repr__(self): - return '' - def __index__(self): - return self.__int__() - def __int__(self): - return self._ptr[0] - def getPtr(self): - return self._ptr -{{endif}} + cudaEglColorFormatYVU444SemiPlanar_ER = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatYVU444SemiPlanar_ER, + 'Extended Range Y, VU in two surfaces (VU as one surface) with UV byte\n' + 'ordering, U/V width = Y width, U/V height = Y height.\n' + ) -{{if 'cudaKernel_t' in found_types}} -cdef class cudaKernel_t: - """ + cudaEglColorFormatYVU422SemiPlanar_ER = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatYVU422SemiPlanar_ER, + 'Extended Range Y, VU in two surfaces (VU as one surface) with UV byte\n' + 'ordering, U/V width = 1/2 Y width, U/V height = Y height.\n' + ) - CUDA kernel - Methods - ------- - getPtr() - Get memory address of class instance + cudaEglColorFormatYVU420SemiPlanar_ER = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatYVU420SemiPlanar_ER, + 'Extended Range Y, VU in two surfaces (VU as one surface) with UV byte\n' + 'ordering, U/V width = 1/2 Y width, U/V height = 1/2 Y height.\n' + ) - """ - def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - self._ptr[0] = init_value - else: - self._ptr = _ptr - def __init__(self, *args, **kwargs): - pass - def __repr__(self): - return '' - def __index__(self): - return self.__int__() - def __int__(self): - return self._ptr[0] - def getPtr(self): - return self._ptr -{{endif}} -{{if 'cudaGraphDeviceNode_t' in found_types}} + cudaEglColorFormatBayerRGGB = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatBayerRGGB, + 'Bayer format - one channel in one surface with interleaved RGGB ordering.\n' + ) -cdef class cudaGraphDeviceNode_t: - """ - CUDA device node handle for device-side node update + cudaEglColorFormatBayerBGGR = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatBayerBGGR, + 'Bayer format - one channel in one surface with interleaved BGGR ordering.\n' + ) - Methods - ------- - getPtr() - Get memory address of class instance - """ - def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - self._ptr[0] = init_value - else: - self._ptr = _ptr - def __init__(self, *args, **kwargs): - pass - def __repr__(self): - return '' - def __index__(self): - return self.__int__() - def __int__(self): - return self._ptr[0] - def getPtr(self): - return self._ptr -{{endif}} + cudaEglColorFormatBayerGRBG = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatBayerGRBG, + 'Bayer format - one channel in one surface with interleaved GRBG ordering.\n' + ) -{{if 'cudaAsyncCallbackHandle_t' in found_types}} -cdef class cudaAsyncCallbackHandle_t: - """ + cudaEglColorFormatBayerGBRG = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatBayerGBRG, + 'Bayer format - one channel in one surface with interleaved GBRG ordering.\n' + ) - CUDA async callback handle - Methods - ------- - getPtr() - Get memory address of class instance + cudaEglColorFormatBayer10RGGB = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatBayer10RGGB, + 'Bayer10 format - one channel in one surface with interleaved RGGB ordering.\n' + 'Out of 16 bits, 10 bits used 6 bits No-op.\n' + ) - """ - def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - self._ptr[0] = init_value - else: - self._ptr = _ptr - def __init__(self, *args, **kwargs): - pass - def __repr__(self): - return '' - def __index__(self): - return self.__int__() - def __int__(self): - return self._ptr[0] - def getPtr(self): - return self._ptr -{{endif}} -{{if True}} + cudaEglColorFormatBayer10BGGR = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatBayer10BGGR, + 'Bayer10 format - one channel in one surface with interleaved BGGR ordering.\n' + 'Out of 16 bits, 10 bits used 6 bits No-op.\n' + ) -cdef class EGLImageKHR: - """ - Methods - ------- - getPtr() - Get memory address of class instance + cudaEglColorFormatBayer10GRBG = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatBayer10GRBG, + 'Bayer10 format - one channel in one surface with interleaved GRBG ordering.\n' + 'Out of 16 bits, 10 bits used 6 bits No-op.\n' + ) - """ - def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - self._ptr[0] = init_value - else: - self._ptr = _ptr - def __init__(self, *args, **kwargs): - pass - def __repr__(self): - return '' - def __index__(self): - return self.__int__() - def __int__(self): - return self._ptr[0] - def getPtr(self): - return self._ptr -{{endif}} -{{if True}} + cudaEglColorFormatBayer10GBRG = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatBayer10GBRG, + 'Bayer10 format - one channel in one surface with interleaved GBRG ordering.\n' + 'Out of 16 bits, 10 bits used 6 bits No-op.\n' + ) -cdef class EGLStreamKHR: - """ - Methods - ------- - getPtr() - Get memory address of class instance + cudaEglColorFormatBayer12RGGB = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatBayer12RGGB, + 'Bayer12 format - one channel in one surface with interleaved RGGB ordering.\n' + 'Out of 16 bits, 12 bits used 4 bits No-op.\n' + ) - """ - def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - self._ptr[0] = init_value - else: - self._ptr = _ptr - def __init__(self, *args, **kwargs): - pass - def __repr__(self): - return '' - def __index__(self): - return self.__int__() - def __int__(self): - return self._ptr[0] - def getPtr(self): - return self._ptr -{{endif}} -{{if True}} + cudaEglColorFormatBayer12BGGR = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatBayer12BGGR, + 'Bayer12 format - one channel in one surface with interleaved BGGR ordering.\n' + 'Out of 16 bits, 12 bits used 4 bits No-op.\n' + ) -cdef class EGLSyncKHR: - """ - Methods - ------- - getPtr() - Get memory address of class instance + cudaEglColorFormatBayer12GRBG = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatBayer12GRBG, + 'Bayer12 format - one channel in one surface with interleaved GRBG ordering.\n' + 'Out of 16 bits, 12 bits used 4 bits No-op.\n' + ) - """ - def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - self._ptr[0] = init_value - else: - self._ptr = _ptr - def __init__(self, *args, **kwargs): - pass - def __repr__(self): - return '' - def __index__(self): - return self.__int__() - def __int__(self): - return self._ptr[0] - def getPtr(self): - return self._ptr -{{endif}} -{{if 'cudaHostFn_t' in found_types}} + cudaEglColorFormatBayer12GBRG = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatBayer12GBRG, + 'Bayer12 format - one channel in one surface with interleaved GBRG ordering.\n' + 'Out of 16 bits, 12 bits used 4 bits No-op.\n' + ) -cdef class cudaHostFn_t: - """ - Methods - ------- - getPtr() - Get memory address of class instance + cudaEglColorFormatBayer14RGGB = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatBayer14RGGB, + 'Bayer14 format - one channel in one surface with interleaved RGGB ordering.\n' + 'Out of 16 bits, 14 bits used 2 bits No-op.\n' + ) - """ - def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - self._ptr[0] = init_value - else: - self._ptr = _ptr - def __init__(self, *args, **kwargs): - pass - def __repr__(self): - return '' - def __index__(self): - return self.__int__() - def __int__(self): - return self._ptr[0] - def getPtr(self): - return self._ptr -{{endif}} -{{if 'cudaAsyncCallback' in found_types}} + cudaEglColorFormatBayer14BGGR = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatBayer14BGGR, + 'Bayer14 format - one channel in one surface with interleaved BGGR ordering.\n' + 'Out of 16 bits, 14 bits used 2 bits No-op.\n' + ) -cdef class cudaAsyncCallback: - """ - Methods - ------- - getPtr() - Get memory address of class instance + cudaEglColorFormatBayer14GRBG = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatBayer14GRBG, + 'Bayer14 format - one channel in one surface with interleaved GRBG ordering.\n' + 'Out of 16 bits, 14 bits used 2 bits No-op.\n' + ) - """ - def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - self._ptr[0] = init_value - else: - self._ptr = _ptr - def __init__(self, *args, **kwargs): - pass - def __repr__(self): - return '' - def __index__(self): - return self.__int__() - def __int__(self): - return self._ptr[0] - def getPtr(self): - return self._ptr -{{endif}} -{{if 'cudaStreamCallback_t' in found_types}} + cudaEglColorFormatBayer14GBRG = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatBayer14GBRG, + 'Bayer14 format - one channel in one surface with interleaved GBRG ordering.\n' + 'Out of 16 bits, 14 bits used 2 bits No-op.\n' + ) -cdef class cudaStreamCallback_t: - """ - Methods - ------- - getPtr() - Get memory address of class instance + cudaEglColorFormatBayer20RGGB = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatBayer20RGGB, + 'Bayer20 format - one channel in one surface with interleaved RGGB ordering.\n' + 'Out of 32 bits, 20 bits used 12 bits No-op.\n' + ) - """ - def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - self._ptr[0] = init_value - else: - self._ptr = _ptr - def __init__(self, *args, **kwargs): - pass - def __repr__(self): - return '' - def __index__(self): - return self.__int__() - def __int__(self): - return self._ptr[0] - def getPtr(self): - return self._ptr -{{endif}} -{{if 'struct dim3' in found_types}} + cudaEglColorFormatBayer20BGGR = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatBayer20BGGR, + 'Bayer20 format - one channel in one surface with interleaved BGGR ordering.\n' + 'Out of 32 bits, 20 bits used 12 bits No-op.\n' + ) -cdef class dim3: - """ - Attributes - ---------- - x : unsigned int - y : unsigned int + cudaEglColorFormatBayer20GRBG = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatBayer20GRBG, + 'Bayer20 format - one channel in one surface with interleaved GRBG ordering.\n' + 'Out of 32 bits, 20 bits used 12 bits No-op.\n' + ) - z : unsigned int + cudaEglColorFormatBayer20GBRG = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatBayer20GBRG, + 'Bayer20 format - one channel in one surface with interleaved GBRG ordering.\n' + 'Out of 32 bits, 20 bits used 12 bits No-op.\n' + ) - Methods - ------- - getPtr() - Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - else: - self._ptr = _ptr - def __init__(self, void_ptr _ptr = 0): - pass - def __dealloc__(self): - pass - def getPtr(self): - return self._ptr - def __repr__(self): - if self._ptr is not NULL: - str_list = [] - try: - str_list += ['x : ' + str(self.x)] - except ValueError: - str_list += ['x : '] - try: - str_list += ['y : ' + str(self.y)] - except ValueError: - str_list += ['y : '] - try: - str_list += ['z : ' + str(self.z)] - except ValueError: - str_list += ['z : '] - return '\n'.join(str_list) - else: - return '' - @property - def x(self): - return self._ptr[0].x - @x.setter - def x(self, unsigned int x): - self._ptr[0].x = x - @property - def y(self): - return self._ptr[0].y - @y.setter - def y(self, unsigned int y): - self._ptr[0].y = y - @property - def z(self): - return self._ptr[0].z - @z.setter - def z(self, unsigned int z): - self._ptr[0].z = z -{{endif}} -{{if 'struct cudaChannelFormatDesc' in found_types}} + cudaEglColorFormatYVU444Planar = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatYVU444Planar, + 'Y, V, U in three surfaces, each in a separate surface, U/V width = Y width,\n' + 'U/V height = Y height.\n' + ) -cdef class cudaChannelFormatDesc: - """ - CUDA Channel format descriptor - Attributes - ---------- - x : int - x - y : int - y - z : int - z - w : int - w - f : cudaChannelFormatKind - Channel format kind + cudaEglColorFormatYVU422Planar = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatYVU422Planar, + 'Y, V, U in three surfaces, each in a separate surface, U/V width = 1/2 Y\n' + 'width, U/V height = Y height.\n' + ) - Methods - ------- - getPtr() - Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - else: - self._ptr = _ptr - def __init__(self, void_ptr _ptr = 0): - pass - def __dealloc__(self): - pass - def getPtr(self): - return self._ptr - def __repr__(self): - if self._ptr is not NULL: - str_list = [] - try: - str_list += ['x : ' + str(self.x)] - except ValueError: - str_list += ['x : '] - try: - str_list += ['y : ' + str(self.y)] - except ValueError: - str_list += ['y : '] - try: - str_list += ['z : ' + str(self.z)] - except ValueError: - str_list += ['z : '] - try: - str_list += ['w : ' + str(self.w)] - except ValueError: - str_list += ['w : '] - try: - str_list += ['f : ' + str(self.f)] - except ValueError: - str_list += ['f : '] - return '\n'.join(str_list) - else: - return '' - @property - def x(self): - return self._ptr[0].x - @x.setter - def x(self, int x): - self._ptr[0].x = x - @property - def y(self): - return self._ptr[0].y - @y.setter - def y(self, int y): - self._ptr[0].y = y - @property - def z(self): - return self._ptr[0].z - @z.setter - def z(self, int z): - self._ptr[0].z = z - @property - def w(self): - return self._ptr[0].w - @w.setter - def w(self, int w): - self._ptr[0].w = w - @property - def f(self): - return cudaChannelFormatKind(self._ptr[0].f) - @f.setter - def f(self, f not None : cudaChannelFormatKind): - self._ptr[0].f = f.value -{{endif}} -{{if 'struct cudaArraySparseProperties' in found_types}} + cudaEglColorFormatYVU420Planar = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatYVU420Planar, + 'Y, V, U in three surfaces, each in a separate surface, U/V width = 1/2 Y\n' + 'width, U/V height = 1/2 Y height.\n' + ) -cdef class anon_struct0: - """ - Attributes - ---------- - width : unsigned int - height : unsigned int + cudaEglColorFormatBayerIspRGGB = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatBayerIspRGGB, + 'Nvidia proprietary Bayer ISP format - one channel in one surface with\n' + 'interleaved RGGB ordering and mapped to opaque integer datatype.\n' + ) - depth : unsigned int + cudaEglColorFormatBayerIspBGGR = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatBayerIspBGGR, + 'Nvidia proprietary Bayer ISP format - one channel in one surface with\n' + 'interleaved BGGR ordering and mapped to opaque integer datatype.\n' + ) - Methods - ------- - getPtr() - Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr + cudaEglColorFormatBayerIspGRBG = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatBayerIspGRBG, + 'Nvidia proprietary Bayer ISP format - one channel in one surface with\n' + 'interleaved GRBG ordering and mapped to opaque integer datatype.\n' + ) - def __init__(self, void_ptr _ptr): - pass - def __dealloc__(self): - pass - def getPtr(self): - return &self._ptr[0].tileExtent - def __repr__(self): - if self._ptr is not NULL: - str_list = [] - try: - str_list += ['width : ' + str(self.width)] - except ValueError: - str_list += ['width : '] - try: - str_list += ['height : ' + str(self.height)] - except ValueError: - str_list += ['height : '] - try: - str_list += ['depth : ' + str(self.depth)] - except ValueError: - str_list += ['depth : '] - return '\n'.join(str_list) - else: - return '' - @property - def width(self): - return self._ptr[0].tileExtent.width + + cudaEglColorFormatBayerIspGBRG = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatBayerIspGBRG, + 'Nvidia proprietary Bayer ISP format - one channel in one surface with\n' + 'interleaved GBRG ordering and mapped to opaque integer datatype.\n' + ) + + + cudaEglColorFormatBayerBCCR = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatBayerBCCR, + 'Bayer format - one channel in one surface with interleaved BCCR ordering.\n' + ) + + + cudaEglColorFormatBayerRCCB = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatBayerRCCB, + 'Bayer format - one channel in one surface with interleaved RCCB ordering.\n' + ) + + + cudaEglColorFormatBayerCRBC = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatBayerCRBC, + 'Bayer format - one channel in one surface with interleaved CRBC ordering.\n' + ) + + + cudaEglColorFormatBayerCBRC = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatBayerCBRC, + 'Bayer format - one channel in one surface with interleaved CBRC ordering.\n' + ) + + + cudaEglColorFormatBayer10CCCC = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatBayer10CCCC, + 'Bayer10 format - one channel in one surface with interleaved CCCC ordering.\n' + 'Out of 16 bits, 10 bits used 6 bits No-op.\n' + ) + + + cudaEglColorFormatBayer12BCCR = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatBayer12BCCR, + 'Bayer12 format - one channel in one surface with interleaved BCCR ordering.\n' + 'Out of 16 bits, 12 bits used 4 bits No-op.\n' + ) + + + cudaEglColorFormatBayer12RCCB = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatBayer12RCCB, + 'Bayer12 format - one channel in one surface with interleaved RCCB ordering.\n' + 'Out of 16 bits, 12 bits used 4 bits No-op.\n' + ) + + + cudaEglColorFormatBayer12CRBC = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatBayer12CRBC, + 'Bayer12 format - one channel in one surface with interleaved CRBC ordering.\n' + 'Out of 16 bits, 12 bits used 4 bits No-op.\n' + ) + + + cudaEglColorFormatBayer12CBRC = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatBayer12CBRC, + 'Bayer12 format - one channel in one surface with interleaved CBRC ordering.\n' + 'Out of 16 bits, 12 bits used 4 bits No-op.\n' + ) + + + cudaEglColorFormatBayer12CCCC = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatBayer12CCCC, + 'Bayer12 format - one channel in one surface with interleaved CCCC ordering.\n' + 'Out of 16 bits, 12 bits used 4 bits No-op.\n' + ) + + + cudaEglColorFormatY = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatY, + 'Color format for single Y plane.\n' + ) + + + cudaEglColorFormatYUV420SemiPlanar_2020 = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatYUV420SemiPlanar_2020, + 'Y, UV in two surfaces (UV as one surface) U/V width = 1/2 Y width, U/V\n' + 'height = 1/2 Y height.\n' + ) + + + cudaEglColorFormatYVU420SemiPlanar_2020 = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatYVU420SemiPlanar_2020, + 'Y, VU in two surfaces (VU as one surface) U/V width = 1/2 Y width, U/V\n' + 'height = 1/2 Y height.\n' + ) + + + cudaEglColorFormatYUV420Planar_2020 = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatYUV420Planar_2020, + 'Y, U, V in three surfaces, each in a separate surface, U/V width = 1/2 Y\n' + 'width, U/V height = 1/2 Y height.\n' + ) + + + cudaEglColorFormatYVU420Planar_2020 = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatYVU420Planar_2020, + 'Y, V, U in three surfaces, each in a separate surface, U/V width = 1/2 Y\n' + 'width, U/V height = 1/2 Y height.\n' + ) + + + cudaEglColorFormatYUV420SemiPlanar_709 = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatYUV420SemiPlanar_709, + 'Y, UV in two surfaces (UV as one surface) U/V width = 1/2 Y width, U/V\n' + 'height = 1/2 Y height.\n' + ) + + + cudaEglColorFormatYVU420SemiPlanar_709 = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatYVU420SemiPlanar_709, + 'Y, VU in two surfaces (VU as one surface) U/V width = 1/2 Y width, U/V\n' + 'height = 1/2 Y height.\n' + ) + + + cudaEglColorFormatYUV420Planar_709 = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatYUV420Planar_709, + 'Y, U, V in three surfaces, each in a separate surface, U/V width = 1/2 Y\n' + 'width, U/V height = 1/2 Y height.\n' + ) + + + cudaEglColorFormatYVU420Planar_709 = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatYVU420Planar_709, + 'Y, V, U in three surfaces, each in a separate surface, U/V width = 1/2 Y\n' + 'width, U/V height = 1/2 Y height.\n' + ) + + + cudaEglColorFormatY10V10U10_420SemiPlanar_709 = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatY10V10U10_420SemiPlanar_709, + 'Y10, V10U10 in two surfaces (VU as one surface) U/V width = 1/2 Y width,\n' + 'U/V height = 1/2 Y height.\n' + ) + + + cudaEglColorFormatY10V10U10_420SemiPlanar_2020 = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatY10V10U10_420SemiPlanar_2020, + 'Y10, V10U10 in two surfaces (VU as one surface) U/V width = 1/2 Y width,\n' + 'U/V height = 1/2 Y height.\n' + ) + + + cudaEglColorFormatY10V10U10_422SemiPlanar_2020 = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatY10V10U10_422SemiPlanar_2020, + 'Y10, V10U10 in two surfaces (VU as one surface) U/V width = 1/2 Y width,\n' + 'U/V height = Y height.\n' + ) + + + cudaEglColorFormatY10V10U10_422SemiPlanar = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatY10V10U10_422SemiPlanar, + 'Y10, V10U10 in two surfaces (VU as one surface) U/V width = 1/2 Y width,\n' + 'U/V height = Y height.\n' + ) + + + cudaEglColorFormatY10V10U10_422SemiPlanar_709 = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatY10V10U10_422SemiPlanar_709, + 'Y10, V10U10 in two surfaces (VU as one surface) U/V width = 1/2 Y width,\n' + 'U/V height = Y height.\n' + ) + + + cudaEglColorFormatY_ER = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatY_ER, + 'Extended Range Color format for single Y plane.\n' + ) + + + cudaEglColorFormatY_709_ER = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatY_709_ER, + 'Extended Range Color format for single Y plane.\n' + ) + + + cudaEglColorFormatY10_ER = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatY10_ER, + 'Extended Range Color format for single Y10 plane.\n' + ) + + + cudaEglColorFormatY10_709_ER = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatY10_709_ER, + 'Extended Range Color format for single Y10 plane.\n' + ) + + + cudaEglColorFormatY12_ER = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatY12_ER, + 'Extended Range Color format for single Y12 plane.\n' + ) + + + cudaEglColorFormatY12_709_ER = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatY12_709_ER, + 'Extended Range Color format for single Y12 plane.\n' + ) + + + cudaEglColorFormatYUVA = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatYUVA, + 'Y, U, V, A four channels in one surface, interleaved as AVUY.\n' + ) + + + cudaEglColorFormatYVYU = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatYVYU, + 'Y, U, V in one surface, interleaved as YVYU in one channel.\n' + ) + + + cudaEglColorFormatVYUY = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatVYUY, + 'Y, U, V in one surface, interleaved as VYUY in one channel.\n' + ) + + + cudaEglColorFormatY10V10U10_420SemiPlanar_ER = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatY10V10U10_420SemiPlanar_ER, + 'Extended Range Y10, V10U10 in two surfaces (VU as one surface) U/V width =\n' + '1/2 Y width, U/V height = 1/2 Y height.\n' + ) + + + cudaEglColorFormatY10V10U10_420SemiPlanar_709_ER = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatY10V10U10_420SemiPlanar_709_ER, + 'Extended Range Y10, V10U10 in two surfaces (VU as one surface) U/V width =\n' + '1/2 Y width, U/V height = 1/2 Y height.\n' + ) + + + cudaEglColorFormatY10V10U10_444SemiPlanar_ER = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatY10V10U10_444SemiPlanar_ER, + 'Extended Range Y10, V10U10 in two surfaces (VU as one surface) U/V width =\n' + 'Y width, U/V height = Y height.\n' + ) + + + cudaEglColorFormatY10V10U10_444SemiPlanar_709_ER = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatY10V10U10_444SemiPlanar_709_ER, + 'Extended Range Y10, V10U10 in two surfaces (VU as one surface) U/V width =\n' + 'Y width, U/V height = Y height.\n' + ) + + + cudaEglColorFormatY12V12U12_420SemiPlanar_ER = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatY12V12U12_420SemiPlanar_ER, + 'Extended Range Y12, V12U12 in two surfaces (VU as one surface) U/V width =\n' + '1/2 Y width, U/V height = 1/2 Y height.\n' + ) + + + cudaEglColorFormatY12V12U12_420SemiPlanar_709_ER = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatY12V12U12_420SemiPlanar_709_ER, + 'Extended Range Y12, V12U12 in two surfaces (VU as one surface) U/V width =\n' + '1/2 Y width, U/V height = 1/2 Y height.\n' + ) + + + cudaEglColorFormatY12V12U12_444SemiPlanar_ER = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatY12V12U12_444SemiPlanar_ER, + 'Extended Range Y12, V12U12 in two surfaces (VU as one surface) U/V width =\n' + 'Y width, U/V height = Y height.\n' + ) + + + cudaEglColorFormatY12V12U12_444SemiPlanar_709_ER = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatY12V12U12_444SemiPlanar_709_ER, + 'Extended Range Y12, V12U12 in two surfaces (VU as one surface) U/V width =\n' + 'Y width, U/V height = Y height.\n' + ) + + + cudaEglColorFormatUYVY709 = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatUYVY709, + 'Y, U, V in one surface, interleaved as UYVY in one channel.\n' + ) + + + cudaEglColorFormatUYVY709_ER = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatUYVY709_ER, + 'Extended Range Y, U, V in one surface, interleaved as UYVY in one channel.\n' + ) + + + cudaEglColorFormatUYVY2020 = ( + cyruntime.cudaEglColorFormat_enum.cudaEglColorFormatUYVY2020, + 'Y, U, V in one surface, interleaved as UYVY in one channel.\n' + ) + +class cudaChannelFormatKind(_FastEnum): + """ + Channel format kind + """ + + + cudaChannelFormatKindSigned = ( + cyruntime.cudaChannelFormatKind.cudaChannelFormatKindSigned, + 'Signed channel format\n' + ) + + + cudaChannelFormatKindUnsigned = ( + cyruntime.cudaChannelFormatKind.cudaChannelFormatKindUnsigned, + 'Unsigned channel format\n' + ) + + + cudaChannelFormatKindFloat = ( + cyruntime.cudaChannelFormatKind.cudaChannelFormatKindFloat, + 'Float channel format\n' + ) + + + cudaChannelFormatKindNone = ( + cyruntime.cudaChannelFormatKind.cudaChannelFormatKindNone, + 'No channel format\n' + ) + + + cudaChannelFormatKindNV12 = ( + cyruntime.cudaChannelFormatKind.cudaChannelFormatKindNV12, + 'Unsigned 8-bit integers, planar 4:2:0 YUV format\n' + ) + + + cudaChannelFormatKindUnsignedNormalized8X1 = ( + cyruntime.cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized8X1, + '1 channel unsigned 8-bit normalized integer\n' + ) + + + cudaChannelFormatKindUnsignedNormalized8X2 = ( + cyruntime.cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized8X2, + '2 channel unsigned 8-bit normalized integer\n' + ) + + + cudaChannelFormatKindUnsignedNormalized8X4 = ( + cyruntime.cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized8X4, + '4 channel unsigned 8-bit normalized integer\n' + ) + + + cudaChannelFormatKindUnsignedNormalized16X1 = ( + cyruntime.cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized16X1, + '1 channel unsigned 16-bit normalized integer\n' + ) + + + cudaChannelFormatKindUnsignedNormalized16X2 = ( + cyruntime.cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized16X2, + '2 channel unsigned 16-bit normalized integer\n' + ) + + + cudaChannelFormatKindUnsignedNormalized16X4 = ( + cyruntime.cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized16X4, + '4 channel unsigned 16-bit normalized integer\n' + ) + + + cudaChannelFormatKindSignedNormalized8X1 = ( + cyruntime.cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized8X1, + '1 channel signed 8-bit normalized integer\n' + ) + + + cudaChannelFormatKindSignedNormalized8X2 = ( + cyruntime.cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized8X2, + '2 channel signed 8-bit normalized integer\n' + ) + + + cudaChannelFormatKindSignedNormalized8X4 = ( + cyruntime.cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized8X4, + '4 channel signed 8-bit normalized integer\n' + ) + + + cudaChannelFormatKindSignedNormalized16X1 = ( + cyruntime.cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized16X1, + '1 channel signed 16-bit normalized integer\n' + ) + + + cudaChannelFormatKindSignedNormalized16X2 = ( + cyruntime.cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized16X2, + '2 channel signed 16-bit normalized integer\n' + ) + + + cudaChannelFormatKindSignedNormalized16X4 = ( + cyruntime.cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized16X4, + '4 channel signed 16-bit normalized integer\n' + ) + + + cudaChannelFormatKindUnsignedBlockCompressed1 = ( + cyruntime.cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed1, + '4 channel unsigned normalized block-compressed (BC1 compression) format\n' + ) + + + cudaChannelFormatKindUnsignedBlockCompressed1SRGB = ( + cyruntime.cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed1SRGB, + '4 channel unsigned normalized block-compressed (BC1 compression) format\n' + 'with sRGB encoding\n' + ) + + + cudaChannelFormatKindUnsignedBlockCompressed2 = ( + cyruntime.cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed2, + '4 channel unsigned normalized block-compressed (BC2 compression) format\n' + ) + + + cudaChannelFormatKindUnsignedBlockCompressed2SRGB = ( + cyruntime.cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed2SRGB, + '4 channel unsigned normalized block-compressed (BC2 compression) format\n' + 'with sRGB encoding\n' + ) + + + cudaChannelFormatKindUnsignedBlockCompressed3 = ( + cyruntime.cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed3, + '4 channel unsigned normalized block-compressed (BC3 compression) format\n' + ) + + + cudaChannelFormatKindUnsignedBlockCompressed3SRGB = ( + cyruntime.cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed3SRGB, + '4 channel unsigned normalized block-compressed (BC3 compression) format\n' + 'with sRGB encoding\n' + ) + + + cudaChannelFormatKindUnsignedBlockCompressed4 = ( + cyruntime.cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed4, + '1 channel unsigned normalized block-compressed (BC4 compression) format\n' + ) + + + cudaChannelFormatKindSignedBlockCompressed4 = ( + cyruntime.cudaChannelFormatKind.cudaChannelFormatKindSignedBlockCompressed4, + '1 channel signed normalized block-compressed (BC4 compression) format\n' + ) + + + cudaChannelFormatKindUnsignedBlockCompressed5 = ( + cyruntime.cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed5, + '2 channel unsigned normalized block-compressed (BC5 compression) format\n' + ) + + + cudaChannelFormatKindSignedBlockCompressed5 = ( + cyruntime.cudaChannelFormatKind.cudaChannelFormatKindSignedBlockCompressed5, + '2 channel signed normalized block-compressed (BC5 compression) format\n' + ) + + + cudaChannelFormatKindUnsignedBlockCompressed6H = ( + cyruntime.cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed6H, + '3 channel unsigned half-float block-compressed (BC6H compression) format\n' + ) + + + cudaChannelFormatKindSignedBlockCompressed6H = ( + cyruntime.cudaChannelFormatKind.cudaChannelFormatKindSignedBlockCompressed6H, + '3 channel signed half-float block-compressed (BC6H compression) format\n' + ) + + + cudaChannelFormatKindUnsignedBlockCompressed7 = ( + cyruntime.cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed7, + '4 channel unsigned normalized block-compressed (BC7 compression) format\n' + ) + + + cudaChannelFormatKindUnsignedBlockCompressed7SRGB = ( + cyruntime.cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed7SRGB, + '4 channel unsigned normalized block-compressed (BC7 compression) format\n' + 'with sRGB encoding\n' + ) + + + cudaChannelFormatKindUnsignedNormalized1010102 = ( + cyruntime.cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized1010102, + '4 channel unsigned normalized (10-bit, 10-bit, 10-bit, 2-bit) format\n' + ) + + + cudaChannelFormatKindUnsigned8Packed422 = ( + cyruntime.cudaChannelFormatKind.cudaChannelFormatKindUnsigned8Packed422, + '4 channel unsigned 8-bit packed format, with 4:2:2 sampling\n' + ) + + + cudaChannelFormatKindUnsigned8Packed444 = ( + cyruntime.cudaChannelFormatKind.cudaChannelFormatKindUnsigned8Packed444, + '4 channel unsigned 8-bit packed format, with 4:4:4 sampling\n' + ) + + + cudaChannelFormatKindUnsigned8SemiPlanar420 = ( + cyruntime.cudaChannelFormatKind.cudaChannelFormatKindUnsigned8SemiPlanar420, + '3 channel unsigned 8-bit semi-planar format, with 4:2:0 sampling\n' + ) + + + cudaChannelFormatKindUnsigned16SemiPlanar420 = ( + cyruntime.cudaChannelFormatKind.cudaChannelFormatKindUnsigned16SemiPlanar420, + '3 channel unsigned 16-bit semi-planar format, with 4:2:0 sampling\n' + ) + + + cudaChannelFormatKindUnsigned8SemiPlanar422 = ( + cyruntime.cudaChannelFormatKind.cudaChannelFormatKindUnsigned8SemiPlanar422, + '3 channel unsigned 8-bit semi-planar format, with 4:2:2 sampling\n' + ) + + + cudaChannelFormatKindUnsigned16SemiPlanar422 = ( + cyruntime.cudaChannelFormatKind.cudaChannelFormatKindUnsigned16SemiPlanar422, + '3 channel unsigned 16-bit semi-planar format, with 4:2:2 sampling\n' + ) + + + cudaChannelFormatKindUnsigned8SemiPlanar444 = ( + cyruntime.cudaChannelFormatKind.cudaChannelFormatKindUnsigned8SemiPlanar444, + '3 channel unsigned 8-bit semi-planar format, with 4:4:4 sampling\n' + ) + + + cudaChannelFormatKindUnsigned16SemiPlanar444 = ( + cyruntime.cudaChannelFormatKind.cudaChannelFormatKindUnsigned16SemiPlanar444, + '3 channel unsigned 16-bit semi-planar format, with 4:4:4 sampling\n' + ) + + + cudaChannelFormatKindUnsigned8Planar420 = ( + cyruntime.cudaChannelFormatKind.cudaChannelFormatKindUnsigned8Planar420, + '3 channel unsigned 8-bit planar format, with 4:2:0 sampling\n' + ) + + + cudaChannelFormatKindUnsigned16Planar420 = ( + cyruntime.cudaChannelFormatKind.cudaChannelFormatKindUnsigned16Planar420, + '3 channel unsigned 16-bit planar format, with 4:2:0 sampling\n' + ) + + + cudaChannelFormatKindUnsigned8Planar422 = ( + cyruntime.cudaChannelFormatKind.cudaChannelFormatKindUnsigned8Planar422, + '3 channel unsigned 8-bit planar format, with 4:2:2 sampling\n' + ) + + + cudaChannelFormatKindUnsigned16Planar422 = ( + cyruntime.cudaChannelFormatKind.cudaChannelFormatKindUnsigned16Planar422, + '3 channel unsigned 16-bit planar format, with 4:2:2 sampling\n' + ) + + + cudaChannelFormatKindUnsigned8Planar444 = ( + cyruntime.cudaChannelFormatKind.cudaChannelFormatKindUnsigned8Planar444, + '3 channel unsigned 8-bit planar format, with 4:4:4 sampling\n' + ) + + + cudaChannelFormatKindUnsigned16Planar444 = ( + cyruntime.cudaChannelFormatKind.cudaChannelFormatKindUnsigned16Planar444, + '3 channel unsigned 16-bit planar format, with 4:4:4 sampling\n' + ) + +class cudaMemoryType(_FastEnum): + """ + CUDA memory types + """ + + + cudaMemoryTypeUnregistered = ( + cyruntime.cudaMemoryType.cudaMemoryTypeUnregistered, + 'Unregistered memory\n' + ) + + + cudaMemoryTypeHost = ( + cyruntime.cudaMemoryType.cudaMemoryTypeHost, + 'Host memory\n' + ) + + + cudaMemoryTypeDevice = ( + cyruntime.cudaMemoryType.cudaMemoryTypeDevice, + 'Device memory\n' + ) + + + cudaMemoryTypeManaged = ( + cyruntime.cudaMemoryType.cudaMemoryTypeManaged, + 'Managed memory\n' + ) + +class cudaMemcpyKind(_FastEnum): + """ + CUDA memory copy types + """ + + + cudaMemcpyHostToHost = ( + cyruntime.cudaMemcpyKind.cudaMemcpyHostToHost, + 'Host -> Host\n' + ) + + + cudaMemcpyHostToDevice = ( + cyruntime.cudaMemcpyKind.cudaMemcpyHostToDevice, + 'Host -> Device\n' + ) + + + cudaMemcpyDeviceToHost = ( + cyruntime.cudaMemcpyKind.cudaMemcpyDeviceToHost, + 'Device -> Host\n' + ) + + + cudaMemcpyDeviceToDevice = ( + cyruntime.cudaMemcpyKind.cudaMemcpyDeviceToDevice, + 'Device -> Device\n' + ) + + + cudaMemcpyDefault = ( + cyruntime.cudaMemcpyKind.cudaMemcpyDefault, + 'Direction of the transfer is inferred from the pointer values. Requires\n' + 'unified virtual addressing\n' + ) + +class cudaAccessProperty(_FastEnum): + """ + Specifies performance hint with :py:obj:`~.cudaAccessPolicyWindow` + for hitProp and missProp members. + """ + + + cudaAccessPropertyNormal = ( + cyruntime.cudaAccessProperty.cudaAccessPropertyNormal, + 'Normal cache persistence.\n' + ) + + + cudaAccessPropertyStreaming = ( + cyruntime.cudaAccessProperty.cudaAccessPropertyStreaming, + 'Streaming access is less likely to persit from cache.\n' + ) + + + cudaAccessPropertyPersisting = ( + cyruntime.cudaAccessProperty.cudaAccessPropertyPersisting, + 'Persisting access is more likely to persist in cache.\n' + ) + +class cudaStreamCaptureStatus(_FastEnum): + """ + Possible stream capture statuses returned by + :py:obj:`~.cudaStreamIsCapturing` + """ + + + cudaStreamCaptureStatusNone = ( + cyruntime.cudaStreamCaptureStatus.cudaStreamCaptureStatusNone, + 'Stream is not capturing\n' + ) + + + cudaStreamCaptureStatusActive = ( + cyruntime.cudaStreamCaptureStatus.cudaStreamCaptureStatusActive, + 'Stream is actively capturing\n' + ) + + + cudaStreamCaptureStatusInvalidated = ( + cyruntime.cudaStreamCaptureStatus.cudaStreamCaptureStatusInvalidated, + 'Stream is part of a capture sequence that has been invalidated, but not\n' + 'terminated\n' + ) + +class cudaGraphRecaptureStatus(_FastEnum): + """ + Possible recapture statuses that can be returned to the user + callback + """ + + + cudaGraphRecaptureEligibleForUpdate = ( + cyruntime.cudaGraphRecaptureStatus.cudaGraphRecaptureEligibleForUpdate, + 'Node is eligible for update in an instantiated graph.\n' + ) + + + cudaGraphRecaptureIneligibleForUpdate = ( + cyruntime.cudaGraphRecaptureStatus.cudaGraphRecaptureIneligibleForUpdate, + 'Parameter changes in the node cannot be applied to an instantiated graph.\n' + ) + + + cudaGraphRecaptureError = ( + cyruntime.cudaGraphRecaptureStatus.cudaGraphRecaptureError, + 'Error while attempting to recapture the node. The recapture will be ended\n' + 'regardless of the return value from the callback.\n' + ) + +class cudaStreamCaptureMode(_FastEnum): + """ + Possible modes for stream capture thread interactions. For more + details see :py:obj:`~.cudaStreamBeginCapture` and + :py:obj:`~.cudaThreadExchangeStreamCaptureMode` + """ + + cudaStreamCaptureModeGlobal = cyruntime.cudaStreamCaptureMode.cudaStreamCaptureModeGlobal + + cudaStreamCaptureModeThreadLocal = cyruntime.cudaStreamCaptureMode.cudaStreamCaptureModeThreadLocal + + cudaStreamCaptureModeRelaxed = cyruntime.cudaStreamCaptureMode.cudaStreamCaptureModeRelaxed + +class cudaSynchronizationPolicy(_FastEnum): + """ + + """ + + cudaSyncPolicyAuto = cyruntime.cudaSynchronizationPolicy.cudaSyncPolicyAuto + + cudaSyncPolicySpin = cyruntime.cudaSynchronizationPolicy.cudaSyncPolicySpin + + cudaSyncPolicyYield = cyruntime.cudaSynchronizationPolicy.cudaSyncPolicyYield + + cudaSyncPolicyBlockingSync = cyruntime.cudaSynchronizationPolicy.cudaSyncPolicyBlockingSync + +class cudaClusterSchedulingPolicy(_FastEnum): + """ + Cluster scheduling policies. These may be passed to + :py:obj:`~.cudaFuncSetAttribute` + """ + + + cudaClusterSchedulingPolicyDefault = ( + cyruntime.cudaClusterSchedulingPolicy.cudaClusterSchedulingPolicyDefault, + 'the default policy\n' + ) + + + cudaClusterSchedulingPolicySpread = ( + cyruntime.cudaClusterSchedulingPolicy.cudaClusterSchedulingPolicySpread, + 'spread the blocks within a cluster to the SMs\n' + ) + + + cudaClusterSchedulingPolicyLoadBalancing = ( + cyruntime.cudaClusterSchedulingPolicy.cudaClusterSchedulingPolicyLoadBalancing, + 'allow the hardware to load-balance the blocks in a cluster to the SMs\n' + ) + +class cudaStreamUpdateCaptureDependenciesFlags(_FastEnum): + """ + Flags for :py:obj:`~.cudaStreamUpdateCaptureDependencies` + """ + + + cudaStreamAddCaptureDependencies = ( + cyruntime.cudaStreamUpdateCaptureDependenciesFlags.cudaStreamAddCaptureDependencies, + 'Add new nodes to the dependency set\n' + ) + + + cudaStreamSetCaptureDependencies = ( + cyruntime.cudaStreamUpdateCaptureDependenciesFlags.cudaStreamSetCaptureDependencies, + 'Replace the dependency set with the new nodes\n' + ) + +class cudaUserObjectFlags(_FastEnum): + """ + Flags for user objects for graphs + """ + + + cudaUserObjectNoDestructorSync = ( + cyruntime.cudaUserObjectFlags.cudaUserObjectNoDestructorSync, + 'Indicates the destructor execution is not synchronized by any CUDA handle.\n' + ) + +class cudaUserObjectRetainFlags(_FastEnum): + """ + Flags for retaining user object references for graphs + """ + + + cudaGraphUserObjectMove = ( + cyruntime.cudaUserObjectRetainFlags.cudaGraphUserObjectMove, + 'Transfer references from the caller rather than creating new references.\n' + ) + +class cudaHostTaskSyncMode(_FastEnum): + """ + Flags for host task sync mode + """ + + cudaHostTaskBlocking = cyruntime.cudaHostTaskSyncMode.cudaHostTaskBlocking + + cudaHostTaskSpinWait = cyruntime.cudaHostTaskSyncMode.cudaHostTaskSpinWait + +class cudaGraphicsRegisterFlags(_FastEnum): + """ + CUDA graphics interop register flags + """ + + + cudaGraphicsRegisterFlagsNone = ( + cyruntime.cudaGraphicsRegisterFlags.cudaGraphicsRegisterFlagsNone, + 'Default\n' + ) + + + cudaGraphicsRegisterFlagsReadOnly = ( + cyruntime.cudaGraphicsRegisterFlags.cudaGraphicsRegisterFlagsReadOnly, + 'CUDA will not write to this resource\n' + ) + + + cudaGraphicsRegisterFlagsWriteDiscard = ( + cyruntime.cudaGraphicsRegisterFlags.cudaGraphicsRegisterFlagsWriteDiscard, + 'CUDA will only write to and will not read from this resource\n' + ) + + + cudaGraphicsRegisterFlagsSurfaceLoadStore = ( + cyruntime.cudaGraphicsRegisterFlags.cudaGraphicsRegisterFlagsSurfaceLoadStore, + 'CUDA will bind this resource to a surface reference\n' + ) + + + cudaGraphicsRegisterFlagsTextureGather = ( + cyruntime.cudaGraphicsRegisterFlags.cudaGraphicsRegisterFlagsTextureGather, + 'CUDA will perform texture gather operations on this resource\n' + ) + +class cudaGraphicsMapFlags(_FastEnum): + """ + CUDA graphics interop map flags + """ + + + cudaGraphicsMapFlagsNone = ( + cyruntime.cudaGraphicsMapFlags.cudaGraphicsMapFlagsNone, + 'Default; Assume resource can be read/written\n' + ) + + + cudaGraphicsMapFlagsReadOnly = ( + cyruntime.cudaGraphicsMapFlags.cudaGraphicsMapFlagsReadOnly, + 'CUDA will not write to this resource\n' + ) + + + cudaGraphicsMapFlagsWriteDiscard = ( + cyruntime.cudaGraphicsMapFlags.cudaGraphicsMapFlagsWriteDiscard, + 'CUDA will only write to and will not read from this resource\n' + ) + +class cudaGraphicsCubeFace(_FastEnum): + """ + CUDA graphics interop array indices for cube maps + """ + + + cudaGraphicsCubeFacePositiveX = ( + cyruntime.cudaGraphicsCubeFace.cudaGraphicsCubeFacePositiveX, + 'Positive X face of cubemap\n' + ) + + + cudaGraphicsCubeFaceNegativeX = ( + cyruntime.cudaGraphicsCubeFace.cudaGraphicsCubeFaceNegativeX, + 'Negative X face of cubemap\n' + ) + + + cudaGraphicsCubeFacePositiveY = ( + cyruntime.cudaGraphicsCubeFace.cudaGraphicsCubeFacePositiveY, + 'Positive Y face of cubemap\n' + ) + + + cudaGraphicsCubeFaceNegativeY = ( + cyruntime.cudaGraphicsCubeFace.cudaGraphicsCubeFaceNegativeY, + 'Negative Y face of cubemap\n' + ) + + + cudaGraphicsCubeFacePositiveZ = ( + cyruntime.cudaGraphicsCubeFace.cudaGraphicsCubeFacePositiveZ, + 'Positive Z face of cubemap\n' + ) + + + cudaGraphicsCubeFaceNegativeZ = ( + cyruntime.cudaGraphicsCubeFace.cudaGraphicsCubeFaceNegativeZ, + 'Negative Z face of cubemap\n' + ) + +class cudaResourceType(_FastEnum): + """ + CUDA resource types + """ + + + cudaResourceTypeArray = ( + cyruntime.cudaResourceType.cudaResourceTypeArray, + 'Array resource\n' + ) + + + cudaResourceTypeMipmappedArray = ( + cyruntime.cudaResourceType.cudaResourceTypeMipmappedArray, + 'Mipmapped array resource\n' + ) + + + cudaResourceTypeLinear = ( + cyruntime.cudaResourceType.cudaResourceTypeLinear, + 'Linear resource\n' + ) + + + cudaResourceTypePitch2D = ( + cyruntime.cudaResourceType.cudaResourceTypePitch2D, + 'Pitch 2D resource\n' + ) + +class cudaResourceViewFormat(_FastEnum): + """ + CUDA texture resource view formats + """ + + + cudaResViewFormatNone = ( + cyruntime.cudaResourceViewFormat.cudaResViewFormatNone, + 'No resource view format (use underlying resource format)\n' + ) + + + cudaResViewFormatUnsignedChar1 = ( + cyruntime.cudaResourceViewFormat.cudaResViewFormatUnsignedChar1, + '1 channel unsigned 8-bit integers\n' + ) + + + cudaResViewFormatUnsignedChar2 = ( + cyruntime.cudaResourceViewFormat.cudaResViewFormatUnsignedChar2, + '2 channel unsigned 8-bit integers\n' + ) + + + cudaResViewFormatUnsignedChar4 = ( + cyruntime.cudaResourceViewFormat.cudaResViewFormatUnsignedChar4, + '4 channel unsigned 8-bit integers\n' + ) + + + cudaResViewFormatSignedChar1 = ( + cyruntime.cudaResourceViewFormat.cudaResViewFormatSignedChar1, + '1 channel signed 8-bit integers\n' + ) + + + cudaResViewFormatSignedChar2 = ( + cyruntime.cudaResourceViewFormat.cudaResViewFormatSignedChar2, + '2 channel signed 8-bit integers\n' + ) + + + cudaResViewFormatSignedChar4 = ( + cyruntime.cudaResourceViewFormat.cudaResViewFormatSignedChar4, + '4 channel signed 8-bit integers\n' + ) + + + cudaResViewFormatUnsignedShort1 = ( + cyruntime.cudaResourceViewFormat.cudaResViewFormatUnsignedShort1, + '1 channel unsigned 16-bit integers\n' + ) + + + cudaResViewFormatUnsignedShort2 = ( + cyruntime.cudaResourceViewFormat.cudaResViewFormatUnsignedShort2, + '2 channel unsigned 16-bit integers\n' + ) + + + cudaResViewFormatUnsignedShort4 = ( + cyruntime.cudaResourceViewFormat.cudaResViewFormatUnsignedShort4, + '4 channel unsigned 16-bit integers\n' + ) + + + cudaResViewFormatSignedShort1 = ( + cyruntime.cudaResourceViewFormat.cudaResViewFormatSignedShort1, + '1 channel signed 16-bit integers\n' + ) + + + cudaResViewFormatSignedShort2 = ( + cyruntime.cudaResourceViewFormat.cudaResViewFormatSignedShort2, + '2 channel signed 16-bit integers\n' + ) + + + cudaResViewFormatSignedShort4 = ( + cyruntime.cudaResourceViewFormat.cudaResViewFormatSignedShort4, + '4 channel signed 16-bit integers\n' + ) + + + cudaResViewFormatUnsignedInt1 = ( + cyruntime.cudaResourceViewFormat.cudaResViewFormatUnsignedInt1, + '1 channel unsigned 32-bit integers\n' + ) + + + cudaResViewFormatUnsignedInt2 = ( + cyruntime.cudaResourceViewFormat.cudaResViewFormatUnsignedInt2, + '2 channel unsigned 32-bit integers\n' + ) + + + cudaResViewFormatUnsignedInt4 = ( + cyruntime.cudaResourceViewFormat.cudaResViewFormatUnsignedInt4, + '4 channel unsigned 32-bit integers\n' + ) + + + cudaResViewFormatSignedInt1 = ( + cyruntime.cudaResourceViewFormat.cudaResViewFormatSignedInt1, + '1 channel signed 32-bit integers\n' + ) + + + cudaResViewFormatSignedInt2 = ( + cyruntime.cudaResourceViewFormat.cudaResViewFormatSignedInt2, + '2 channel signed 32-bit integers\n' + ) + + + cudaResViewFormatSignedInt4 = ( + cyruntime.cudaResourceViewFormat.cudaResViewFormatSignedInt4, + '4 channel signed 32-bit integers\n' + ) + + + cudaResViewFormatHalf1 = ( + cyruntime.cudaResourceViewFormat.cudaResViewFormatHalf1, + '1 channel 16-bit floating point\n' + ) + + + cudaResViewFormatHalf2 = ( + cyruntime.cudaResourceViewFormat.cudaResViewFormatHalf2, + '2 channel 16-bit floating point\n' + ) + + + cudaResViewFormatHalf4 = ( + cyruntime.cudaResourceViewFormat.cudaResViewFormatHalf4, + '4 channel 16-bit floating point\n' + ) + + + cudaResViewFormatFloat1 = ( + cyruntime.cudaResourceViewFormat.cudaResViewFormatFloat1, + '1 channel 32-bit floating point\n' + ) + + + cudaResViewFormatFloat2 = ( + cyruntime.cudaResourceViewFormat.cudaResViewFormatFloat2, + '2 channel 32-bit floating point\n' + ) + + + cudaResViewFormatFloat4 = ( + cyruntime.cudaResourceViewFormat.cudaResViewFormatFloat4, + '4 channel 32-bit floating point\n' + ) + + + cudaResViewFormatUnsignedBlockCompressed1 = ( + cyruntime.cudaResourceViewFormat.cudaResViewFormatUnsignedBlockCompressed1, + 'Block compressed 1\n' + ) + + + cudaResViewFormatUnsignedBlockCompressed2 = ( + cyruntime.cudaResourceViewFormat.cudaResViewFormatUnsignedBlockCompressed2, + 'Block compressed 2\n' + ) + + + cudaResViewFormatUnsignedBlockCompressed3 = ( + cyruntime.cudaResourceViewFormat.cudaResViewFormatUnsignedBlockCompressed3, + 'Block compressed 3\n' + ) + + + cudaResViewFormatUnsignedBlockCompressed4 = ( + cyruntime.cudaResourceViewFormat.cudaResViewFormatUnsignedBlockCompressed4, + 'Block compressed 4 unsigned\n' + ) + + + cudaResViewFormatSignedBlockCompressed4 = ( + cyruntime.cudaResourceViewFormat.cudaResViewFormatSignedBlockCompressed4, + 'Block compressed 4 signed\n' + ) + + + cudaResViewFormatUnsignedBlockCompressed5 = ( + cyruntime.cudaResourceViewFormat.cudaResViewFormatUnsignedBlockCompressed5, + 'Block compressed 5 unsigned\n' + ) + + + cudaResViewFormatSignedBlockCompressed5 = ( + cyruntime.cudaResourceViewFormat.cudaResViewFormatSignedBlockCompressed5, + 'Block compressed 5 signed\n' + ) + + + cudaResViewFormatUnsignedBlockCompressed6H = ( + cyruntime.cudaResourceViewFormat.cudaResViewFormatUnsignedBlockCompressed6H, + 'Block compressed 6 unsigned half-float\n' + ) + + + cudaResViewFormatSignedBlockCompressed6H = ( + cyruntime.cudaResourceViewFormat.cudaResViewFormatSignedBlockCompressed6H, + 'Block compressed 6 signed half-float\n' + ) + + + cudaResViewFormatUnsignedBlockCompressed7 = ( + cyruntime.cudaResourceViewFormat.cudaResViewFormatUnsignedBlockCompressed7, + 'Block compressed 7\n' + ) + +class cudaFuncAttribute(_FastEnum): + """ + CUDA function attributes that can be set using + :py:obj:`~.cudaFuncSetAttribute` + """ + + + cudaFuncAttributeMaxDynamicSharedMemorySize = ( + cyruntime.cudaFuncAttribute.cudaFuncAttributeMaxDynamicSharedMemorySize, + 'Maximum dynamic shared memory size\n' + ) + + + cudaFuncAttributePreferredSharedMemoryCarveout = ( + cyruntime.cudaFuncAttribute.cudaFuncAttributePreferredSharedMemoryCarveout, + 'Preferred shared memory-L1 cache split\n' + ) + + + cudaFuncAttributeClusterDimMustBeSet = ( + cyruntime.cudaFuncAttribute.cudaFuncAttributeClusterDimMustBeSet, + 'Indicator to enforce valid cluster dimension specification on kernel launch\n' + ) + + + cudaFuncAttributeRequiredClusterWidth = ( + cyruntime.cudaFuncAttribute.cudaFuncAttributeRequiredClusterWidth, + 'Required cluster width\n' + ) + + + cudaFuncAttributeRequiredClusterHeight = ( + cyruntime.cudaFuncAttribute.cudaFuncAttributeRequiredClusterHeight, + 'Required cluster height\n' + ) + + + cudaFuncAttributeRequiredClusterDepth = ( + cyruntime.cudaFuncAttribute.cudaFuncAttributeRequiredClusterDepth, + 'Required cluster depth\n' + ) + + + cudaFuncAttributeNonPortableClusterSizeAllowed = ( + cyruntime.cudaFuncAttribute.cudaFuncAttributeNonPortableClusterSizeAllowed, + 'Whether non-portable cluster scheduling policy is supported\n' + ) + + + cudaFuncAttributeClusterSchedulingPolicyPreference = ( + cyruntime.cudaFuncAttribute.cudaFuncAttributeClusterSchedulingPolicyPreference, + 'Required cluster scheduling policy preference\n' + ) + + cudaFuncAttributeMax = cyruntime.cudaFuncAttribute.cudaFuncAttributeMax + +class cudaFuncCache(_FastEnum): + """ + CUDA function cache configurations + """ + + + cudaFuncCachePreferNone = ( + cyruntime.cudaFuncCache.cudaFuncCachePreferNone, + 'Default function cache configuration, no preference\n' + ) + + + cudaFuncCachePreferShared = ( + cyruntime.cudaFuncCache.cudaFuncCachePreferShared, + 'Prefer larger shared memory and smaller L1 cache\n' + ) + + + cudaFuncCachePreferL1 = ( + cyruntime.cudaFuncCache.cudaFuncCachePreferL1, + 'Prefer larger L1 cache and smaller shared memory\n' + ) + + + cudaFuncCachePreferEqual = ( + cyruntime.cudaFuncCache.cudaFuncCachePreferEqual, + 'Prefer equal size L1 cache and shared memory\n' + ) + +class cudaSharedMemConfig(_FastEnum): + """ + CUDA shared memory configuration [Deprecated] + """ + + cudaSharedMemBankSizeDefault = cyruntime.cudaSharedMemConfig.cudaSharedMemBankSizeDefault + + cudaSharedMemBankSizeFourByte = cyruntime.cudaSharedMemConfig.cudaSharedMemBankSizeFourByte + + cudaSharedMemBankSizeEightByte = cyruntime.cudaSharedMemConfig.cudaSharedMemBankSizeEightByte + +class cudaSharedCarveout(_FastEnum): + """ + Shared memory carveout configurations. These may be passed to + cudaFuncSetAttribute + """ + + + cudaSharedmemCarveoutDefault = ( + cyruntime.cudaSharedCarveout.cudaSharedmemCarveoutDefault, + 'No preference for shared memory or L1 (default)\n' + ) + + + cudaSharedmemCarveoutMaxL1 = ( + cyruntime.cudaSharedCarveout.cudaSharedmemCarveoutMaxL1, + 'Prefer maximum available L1 cache, minimum shared memory\n' + ) + + + cudaSharedmemCarveoutMaxShared = ( + cyruntime.cudaSharedCarveout.cudaSharedmemCarveoutMaxShared, + 'Prefer maximum available shared memory, minimum L1 cache\n' + ) + +class cudaComputeMode(_FastEnum): + """ + CUDA device compute modes + """ + + + cudaComputeModeDefault = ( + cyruntime.cudaComputeMode.cudaComputeModeDefault, + 'Default compute mode (Multiple threads can use :py:obj:`~.cudaSetDevice()`\n' + 'with this device)\n' + ) + + + cudaComputeModeExclusive = ( + cyruntime.cudaComputeMode.cudaComputeModeExclusive, + 'Compute-exclusive-thread mode (Only one thread in one process will be able\n' + 'to use :py:obj:`~.cudaSetDevice()` with this device)\n' + ) + + + cudaComputeModeProhibited = ( + cyruntime.cudaComputeMode.cudaComputeModeProhibited, + 'Compute-prohibited mode (No threads can use :py:obj:`~.cudaSetDevice()`\n' + 'with this device)\n' + ) + + + cudaComputeModeExclusiveProcess = ( + cyruntime.cudaComputeMode.cudaComputeModeExclusiveProcess, + 'Compute-exclusive-process mode (Many threads in one process will be able to\n' + 'use :py:obj:`~.cudaSetDevice()` with this device)\n' + ) + +class cudaLimit(_FastEnum): + """ + CUDA Limits + """ + + + cudaLimitStackSize = ( + cyruntime.cudaLimit.cudaLimitStackSize, + 'GPU thread stack size\n' + ) + + + cudaLimitPrintfFifoSize = ( + cyruntime.cudaLimit.cudaLimitPrintfFifoSize, + 'GPU printf FIFO size\n' + ) + + + cudaLimitMallocHeapSize = ( + cyruntime.cudaLimit.cudaLimitMallocHeapSize, + 'GPU malloc heap size\n' + ) + + + cudaLimitDevRuntimeSyncDepth = ( + cyruntime.cudaLimit.cudaLimitDevRuntimeSyncDepth, + 'GPU device runtime synchronize depth\n' + ) + + + cudaLimitDevRuntimePendingLaunchCount = ( + cyruntime.cudaLimit.cudaLimitDevRuntimePendingLaunchCount, + 'GPU device runtime pending launch count\n' + ) + + + cudaLimitMaxL2FetchGranularity = ( + cyruntime.cudaLimit.cudaLimitMaxL2FetchGranularity, + 'A value between 0 and 128 that indicates the maximum fetch granularity of\n' + 'L2 (in Bytes). This is a hint\n' + ) + + + cudaLimitPersistingL2CacheSize = ( + cyruntime.cudaLimit.cudaLimitPersistingL2CacheSize, + 'A size in bytes for L2 persisting lines cache size\n' + ) + +class cudaMemoryAdvise(_FastEnum): + """ + CUDA Memory Advise values + """ + + + cudaMemAdviseSetReadMostly = ( + cyruntime.cudaMemoryAdvise.cudaMemAdviseSetReadMostly, + 'Data will mostly be read and only occassionally be written to\n' + ) + + + cudaMemAdviseUnsetReadMostly = ( + cyruntime.cudaMemoryAdvise.cudaMemAdviseUnsetReadMostly, + 'Undo the effect of :py:obj:`~.cudaMemAdviseSetReadMostly`\n' + ) + + + cudaMemAdviseSetPreferredLocation = ( + cyruntime.cudaMemoryAdvise.cudaMemAdviseSetPreferredLocation, + 'Set the preferred location for the data as the specified device\n' + ) + + + cudaMemAdviseUnsetPreferredLocation = ( + cyruntime.cudaMemoryAdvise.cudaMemAdviseUnsetPreferredLocation, + 'Clear the preferred location for the data\n' + ) + + + cudaMemAdviseSetAccessedBy = ( + cyruntime.cudaMemoryAdvise.cudaMemAdviseSetAccessedBy, + 'Data will be accessed by the specified device, so prevent page faults as\n' + 'much as possible\n' + ) + + + cudaMemAdviseUnsetAccessedBy = ( + cyruntime.cudaMemoryAdvise.cudaMemAdviseUnsetAccessedBy, + 'Let the Unified Memory subsystem decide on the page faulting policy for the\n' + 'specified device\n' + ) + +class cudaMemRangeAttribute(_FastEnum): + """ + CUDA range attributes + """ + + + cudaMemRangeAttributeReadMostly = ( + cyruntime.cudaMemRangeAttribute.cudaMemRangeAttributeReadMostly, + 'Whether the range will mostly be read and only occassionally be written to\n' + ) + + + cudaMemRangeAttributePreferredLocation = ( + cyruntime.cudaMemRangeAttribute.cudaMemRangeAttributePreferredLocation, + 'The preferred location of the range\n' + ) + + + cudaMemRangeAttributeAccessedBy = ( + cyruntime.cudaMemRangeAttribute.cudaMemRangeAttributeAccessedBy, + 'Memory range has :py:obj:`~.cudaMemAdviseSetAccessedBy` set for specified\n' + 'device\n' + ) + + + cudaMemRangeAttributeLastPrefetchLocation = ( + cyruntime.cudaMemRangeAttribute.cudaMemRangeAttributeLastPrefetchLocation, + 'The last location to which the range was prefetched\n' + ) + + + cudaMemRangeAttributePreferredLocationType = ( + cyruntime.cudaMemRangeAttribute.cudaMemRangeAttributePreferredLocationType, + 'The preferred location type of the range\n' + ) + + + cudaMemRangeAttributePreferredLocationId = ( + cyruntime.cudaMemRangeAttribute.cudaMemRangeAttributePreferredLocationId, + 'The preferred location id of the range\n' + ) + + + cudaMemRangeAttributeLastPrefetchLocationType = ( + cyruntime.cudaMemRangeAttribute.cudaMemRangeAttributeLastPrefetchLocationType, + 'The last location type to which the range was prefetched\n' + ) + + + cudaMemRangeAttributeLastPrefetchLocationId = ( + cyruntime.cudaMemRangeAttribute.cudaMemRangeAttributeLastPrefetchLocationId, + 'The last location id to which the range was prefetched\n' + ) + +class cudaFlushGPUDirectRDMAWritesOptions(_FastEnum): + """ + CUDA GPUDirect RDMA flush writes APIs supported on the device + """ + + + cudaFlushGPUDirectRDMAWritesOptionHost = ( + cyruntime.cudaFlushGPUDirectRDMAWritesOptions.cudaFlushGPUDirectRDMAWritesOptionHost, + ':py:obj:`~.cudaDeviceFlushGPUDirectRDMAWrites()` and its CUDA Driver API\n' + 'counterpart are supported on the device.\n' + ) + + + cudaFlushGPUDirectRDMAWritesOptionMemOps = ( + cyruntime.cudaFlushGPUDirectRDMAWritesOptions.cudaFlushGPUDirectRDMAWritesOptionMemOps, + 'The :py:obj:`~.CU_STREAM_WAIT_VALUE_FLUSH` flag and the\n' + ':py:obj:`~.CU_STREAM_MEM_OP_FLUSH_REMOTE_WRITES` MemOp are supported on the\n' + 'CUDA device.\n' + ) + +class cudaGPUDirectRDMAWritesOrdering(_FastEnum): + """ + CUDA GPUDirect RDMA flush writes ordering features of the device + """ + + + cudaGPUDirectRDMAWritesOrderingNone = ( + cyruntime.cudaGPUDirectRDMAWritesOrdering.cudaGPUDirectRDMAWritesOrderingNone, + 'The device does not natively support ordering of GPUDirect RDMA writes.\n' + ':py:obj:`~.cudaFlushGPUDirectRDMAWrites()` can be leveraged if supported.\n' + ) + + + cudaGPUDirectRDMAWritesOrderingOwner = ( + cyruntime.cudaGPUDirectRDMAWritesOrdering.cudaGPUDirectRDMAWritesOrderingOwner, + 'Natively, the device can consistently consume GPUDirect RDMA writes,\n' + 'although other CUDA devices may not.\n' + ) + + + cudaGPUDirectRDMAWritesOrderingAllDevices = ( + cyruntime.cudaGPUDirectRDMAWritesOrdering.cudaGPUDirectRDMAWritesOrderingAllDevices, + 'Any CUDA device in the system can consistently consume GPUDirect RDMA\n' + 'writes to this device.\n' + ) + +class cudaFlushGPUDirectRDMAWritesScope(_FastEnum): + """ + CUDA GPUDirect RDMA flush writes scopes + """ + + + cudaFlushGPUDirectRDMAWritesToOwner = ( + cyruntime.cudaFlushGPUDirectRDMAWritesScope.cudaFlushGPUDirectRDMAWritesToOwner, + 'Blocks until remote writes are visible to the CUDA device context owning\n' + 'the data.\n' + ) + + + cudaFlushGPUDirectRDMAWritesToAllDevices = ( + cyruntime.cudaFlushGPUDirectRDMAWritesScope.cudaFlushGPUDirectRDMAWritesToAllDevices, + 'Blocks until remote writes are visible to all CUDA device contexts.\n' + ) + +class cudaFlushGPUDirectRDMAWritesTarget(_FastEnum): + """ + CUDA GPUDirect RDMA flush writes targets + """ + + + cudaFlushGPUDirectRDMAWritesTargetCurrentDevice = ( + cyruntime.cudaFlushGPUDirectRDMAWritesTarget.cudaFlushGPUDirectRDMAWritesTargetCurrentDevice, + 'Sets the target for :py:obj:`~.cudaDeviceFlushGPUDirectRDMAWrites()` to the\n' + 'currently active CUDA device context.\n' + ) + +class cudaDeviceAttr(_FastEnum): + """ + CUDA device attributes + """ + + + cudaDevAttrMaxThreadsPerBlock = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMaxThreadsPerBlock, + 'Maximum number of threads per block\n' + ) + + + cudaDevAttrMaxBlockDimX = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMaxBlockDimX, + 'Maximum block dimension X\n' + ) + + + cudaDevAttrMaxBlockDimY = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMaxBlockDimY, + 'Maximum block dimension Y\n' + ) + + + cudaDevAttrMaxBlockDimZ = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMaxBlockDimZ, + 'Maximum block dimension Z\n' + ) + + + cudaDevAttrMaxGridDimX = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMaxGridDimX, + 'Maximum grid dimension X\n' + ) + + + cudaDevAttrMaxGridDimY = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMaxGridDimY, + 'Maximum grid dimension Y\n' + ) + + + cudaDevAttrMaxGridDimZ = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMaxGridDimZ, + 'Maximum grid dimension Z\n' + ) + + + cudaDevAttrMaxSharedMemoryPerBlock = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMaxSharedMemoryPerBlock, + 'Maximum shared memory available per block in bytes\n' + ) + + + cudaDevAttrTotalConstantMemory = ( + cyruntime.cudaDeviceAttr.cudaDevAttrTotalConstantMemory, + 'Memory available on device for constant variables in a CUDA C kernel in\n' + 'bytes\n' + ) + + + cudaDevAttrWarpSize = ( + cyruntime.cudaDeviceAttr.cudaDevAttrWarpSize, + 'Warp size in threads\n' + ) + + + cudaDevAttrMaxPitch = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMaxPitch, + 'Maximum pitch in bytes allowed by memory copies\n' + ) + + + cudaDevAttrMaxRegistersPerBlock = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMaxRegistersPerBlock, + 'Maximum number of 32-bit registers available per block\n' + ) + + + cudaDevAttrClockRate = ( + cyruntime.cudaDeviceAttr.cudaDevAttrClockRate, + 'Peak clock frequency in kilohertz\n' + ) + + + cudaDevAttrTextureAlignment = ( + cyruntime.cudaDeviceAttr.cudaDevAttrTextureAlignment, + 'Alignment requirement for textures\n' + ) + + + cudaDevAttrGpuOverlap = ( + cyruntime.cudaDeviceAttr.cudaDevAttrGpuOverlap, + 'Device can possibly copy memory and execute a kernel concurrently\n' + ) + + + cudaDevAttrMultiProcessorCount = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMultiProcessorCount, + 'Number of multiprocessors on device\n' + ) + + + cudaDevAttrKernelExecTimeout = ( + cyruntime.cudaDeviceAttr.cudaDevAttrKernelExecTimeout, + 'Specifies whether there is a run time limit on kernels\n' + ) + + + cudaDevAttrIntegrated = ( + cyruntime.cudaDeviceAttr.cudaDevAttrIntegrated, + 'Device is integrated with host memory\n' + ) + + + cudaDevAttrCanMapHostMemory = ( + cyruntime.cudaDeviceAttr.cudaDevAttrCanMapHostMemory, + 'Device can map host memory into CUDA address space\n' + ) + + + cudaDevAttrComputeMode = ( + cyruntime.cudaDeviceAttr.cudaDevAttrComputeMode, + 'Compute mode (See :py:obj:`~.cudaComputeMode` for details)\n' + ) + + + cudaDevAttrMaxTexture1DWidth = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMaxTexture1DWidth, + 'Maximum 1D texture width\n' + ) + + + cudaDevAttrMaxTexture2DWidth = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMaxTexture2DWidth, + 'Maximum 2D texture width\n' + ) + + + cudaDevAttrMaxTexture2DHeight = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMaxTexture2DHeight, + 'Maximum 2D texture height\n' + ) + + + cudaDevAttrMaxTexture3DWidth = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMaxTexture3DWidth, + 'Maximum 3D texture width\n' + ) + + + cudaDevAttrMaxTexture3DHeight = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMaxTexture3DHeight, + 'Maximum 3D texture height\n' + ) + + + cudaDevAttrMaxTexture3DDepth = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMaxTexture3DDepth, + 'Maximum 3D texture depth\n' + ) + + + cudaDevAttrMaxTexture2DLayeredWidth = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMaxTexture2DLayeredWidth, + 'Maximum 2D layered texture width\n' + ) + + + cudaDevAttrMaxTexture2DLayeredHeight = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMaxTexture2DLayeredHeight, + 'Maximum 2D layered texture height\n' + ) + + + cudaDevAttrMaxTexture2DLayeredLayers = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMaxTexture2DLayeredLayers, + 'Maximum layers in a 2D layered texture\n' + ) + + + cudaDevAttrSurfaceAlignment = ( + cyruntime.cudaDeviceAttr.cudaDevAttrSurfaceAlignment, + 'Alignment requirement for surfaces\n' + ) + + + cudaDevAttrConcurrentKernels = ( + cyruntime.cudaDeviceAttr.cudaDevAttrConcurrentKernels, + 'Device can possibly execute multiple kernels concurrently\n' + ) + + + cudaDevAttrEccEnabled = ( + cyruntime.cudaDeviceAttr.cudaDevAttrEccEnabled, + 'Device has ECC support enabled\n' + ) + + + cudaDevAttrPciBusId = ( + cyruntime.cudaDeviceAttr.cudaDevAttrPciBusId, + 'PCI bus ID of the device\n' + ) + + + cudaDevAttrPciDeviceId = ( + cyruntime.cudaDeviceAttr.cudaDevAttrPciDeviceId, + 'PCI device ID of the device\n' + ) + + + cudaDevAttrTccDriver = ( + cyruntime.cudaDeviceAttr.cudaDevAttrTccDriver, + 'Device is using TCC driver model\n' + ) + + + cudaDevAttrMemoryClockRate = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMemoryClockRate, + 'Peak memory clock frequency in kilohertz\n' + ) + + + cudaDevAttrGlobalMemoryBusWidth = ( + cyruntime.cudaDeviceAttr.cudaDevAttrGlobalMemoryBusWidth, + 'Global memory bus width in bits\n' + ) + + + cudaDevAttrL2CacheSize = ( + cyruntime.cudaDeviceAttr.cudaDevAttrL2CacheSize, + 'Size of L2 cache in bytes\n' + ) + + + cudaDevAttrMaxThreadsPerMultiProcessor = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMaxThreadsPerMultiProcessor, + 'Maximum resident threads per multiprocessor\n' + ) + + + cudaDevAttrAsyncEngineCount = ( + cyruntime.cudaDeviceAttr.cudaDevAttrAsyncEngineCount, + 'Number of asynchronous engines\n' + ) + + + cudaDevAttrUnifiedAddressing = ( + cyruntime.cudaDeviceAttr.cudaDevAttrUnifiedAddressing, + 'Device shares a unified address space with the host\n' + ) + + + cudaDevAttrMaxTexture1DLayeredWidth = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMaxTexture1DLayeredWidth, + 'Maximum 1D layered texture width\n' + ) + + + cudaDevAttrMaxTexture1DLayeredLayers = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMaxTexture1DLayeredLayers, + 'Maximum layers in a 1D layered texture\n' + ) + + + cudaDevAttrMaxTexture2DGatherWidth = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMaxTexture2DGatherWidth, + 'Maximum 2D texture width if cudaArrayTextureGather is set\n' + ) + + + cudaDevAttrMaxTexture2DGatherHeight = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMaxTexture2DGatherHeight, + 'Maximum 2D texture height if cudaArrayTextureGather is set\n' + ) + + + cudaDevAttrMaxTexture3DWidthAlt = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMaxTexture3DWidthAlt, + 'Alternate maximum 3D texture width\n' + ) + + + cudaDevAttrMaxTexture3DHeightAlt = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMaxTexture3DHeightAlt, + 'Alternate maximum 3D texture height\n' + ) + + + cudaDevAttrMaxTexture3DDepthAlt = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMaxTexture3DDepthAlt, + 'Alternate maximum 3D texture depth\n' + ) + + + cudaDevAttrPciDomainId = ( + cyruntime.cudaDeviceAttr.cudaDevAttrPciDomainId, + 'PCI domain ID of the device\n' + ) + + + cudaDevAttrTexturePitchAlignment = ( + cyruntime.cudaDeviceAttr.cudaDevAttrTexturePitchAlignment, + 'Pitch alignment requirement for textures\n' + ) + + + cudaDevAttrMaxTextureCubemapWidth = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMaxTextureCubemapWidth, + 'Maximum cubemap texture width/height\n' + ) + + + cudaDevAttrMaxTextureCubemapLayeredWidth = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMaxTextureCubemapLayeredWidth, + 'Maximum cubemap layered texture width/height\n' + ) + + + cudaDevAttrMaxTextureCubemapLayeredLayers = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMaxTextureCubemapLayeredLayers, + 'Maximum layers in a cubemap layered texture\n' + ) + + + cudaDevAttrMaxSurface1DWidth = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMaxSurface1DWidth, + 'Maximum 1D surface width\n' + ) + + + cudaDevAttrMaxSurface2DWidth = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMaxSurface2DWidth, + 'Maximum 2D surface width\n' + ) + + + cudaDevAttrMaxSurface2DHeight = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMaxSurface2DHeight, + 'Maximum 2D surface height\n' + ) + + + cudaDevAttrMaxSurface3DWidth = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMaxSurface3DWidth, + 'Maximum 3D surface width\n' + ) + + + cudaDevAttrMaxSurface3DHeight = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMaxSurface3DHeight, + 'Maximum 3D surface height\n' + ) + + + cudaDevAttrMaxSurface3DDepth = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMaxSurface3DDepth, + 'Maximum 3D surface depth\n' + ) + + + cudaDevAttrMaxSurface1DLayeredWidth = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMaxSurface1DLayeredWidth, + 'Maximum 1D layered surface width\n' + ) + + + cudaDevAttrMaxSurface1DLayeredLayers = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMaxSurface1DLayeredLayers, + 'Maximum layers in a 1D layered surface\n' + ) + + + cudaDevAttrMaxSurface2DLayeredWidth = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMaxSurface2DLayeredWidth, + 'Maximum 2D layered surface width\n' + ) + + + cudaDevAttrMaxSurface2DLayeredHeight = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMaxSurface2DLayeredHeight, + 'Maximum 2D layered surface height\n' + ) + + + cudaDevAttrMaxSurface2DLayeredLayers = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMaxSurface2DLayeredLayers, + 'Maximum layers in a 2D layered surface\n' + ) + + + cudaDevAttrMaxSurfaceCubemapWidth = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMaxSurfaceCubemapWidth, + 'Maximum cubemap surface width\n' + ) + + + cudaDevAttrMaxSurfaceCubemapLayeredWidth = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMaxSurfaceCubemapLayeredWidth, + 'Maximum cubemap layered surface width\n' + ) + + + cudaDevAttrMaxSurfaceCubemapLayeredLayers = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMaxSurfaceCubemapLayeredLayers, + 'Maximum layers in a cubemap layered surface\n' + ) + + + cudaDevAttrMaxTexture1DLinearWidth = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMaxTexture1DLinearWidth, + 'Maximum 1D linear texture width\n' + ) + + + cudaDevAttrMaxTexture2DLinearWidth = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMaxTexture2DLinearWidth, + 'Maximum 2D linear texture width\n' + ) + + + cudaDevAttrMaxTexture2DLinearHeight = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMaxTexture2DLinearHeight, + 'Maximum 2D linear texture height\n' + ) + + + cudaDevAttrMaxTexture2DLinearPitch = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMaxTexture2DLinearPitch, + 'Maximum 2D linear texture pitch in bytes\n' + ) + + + cudaDevAttrMaxTexture2DMipmappedWidth = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMaxTexture2DMipmappedWidth, + 'Maximum mipmapped 2D texture width\n' + ) + + + cudaDevAttrMaxTexture2DMipmappedHeight = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMaxTexture2DMipmappedHeight, + 'Maximum mipmapped 2D texture height\n' + ) + + + cudaDevAttrComputeCapabilityMajor = ( + cyruntime.cudaDeviceAttr.cudaDevAttrComputeCapabilityMajor, + 'Major compute capability version number\n' + ) + + + cudaDevAttrComputeCapabilityMinor = ( + cyruntime.cudaDeviceAttr.cudaDevAttrComputeCapabilityMinor, + 'Minor compute capability version number\n' + ) + + + cudaDevAttrMaxTexture1DMipmappedWidth = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMaxTexture1DMipmappedWidth, + 'Maximum mipmapped 1D texture width\n' + ) + + + cudaDevAttrStreamPrioritiesSupported = ( + cyruntime.cudaDeviceAttr.cudaDevAttrStreamPrioritiesSupported, + 'Device supports stream priorities\n' + ) + + + cudaDevAttrGlobalL1CacheSupported = ( + cyruntime.cudaDeviceAttr.cudaDevAttrGlobalL1CacheSupported, + 'Device supports caching globals in L1\n' + ) + + + cudaDevAttrLocalL1CacheSupported = ( + cyruntime.cudaDeviceAttr.cudaDevAttrLocalL1CacheSupported, + 'Device supports caching locals in L1\n' + ) + + + cudaDevAttrMaxSharedMemoryPerMultiprocessor = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMaxSharedMemoryPerMultiprocessor, + 'Maximum shared memory available per multiprocessor in bytes\n' + ) + + + cudaDevAttrMaxRegistersPerMultiprocessor = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMaxRegistersPerMultiprocessor, + 'Maximum number of 32-bit registers available per multiprocessor\n' + ) + + + cudaDevAttrManagedMemory = ( + cyruntime.cudaDeviceAttr.cudaDevAttrManagedMemory, + 'Device can allocate managed memory on this system\n' + ) + + + cudaDevAttrIsMultiGpuBoard = ( + cyruntime.cudaDeviceAttr.cudaDevAttrIsMultiGpuBoard, + 'Device is on a multi-GPU board\n' + ) + + + cudaDevAttrMultiGpuBoardGroupID = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMultiGpuBoardGroupID, + 'Unique identifier for a group of devices on the same multi-GPU board\n' + ) + + + cudaDevAttrHostNativeAtomicSupported = ( + cyruntime.cudaDeviceAttr.cudaDevAttrHostNativeAtomicSupported, + 'Link between the device and the host supports native atomic operations\n' + ) + + + cudaDevAttrSingleToDoublePrecisionPerfRatio = ( + cyruntime.cudaDeviceAttr.cudaDevAttrSingleToDoublePrecisionPerfRatio, + 'Ratio of single precision performance (in floating-point operations per\n' + 'second) to double precision performance\n' + ) + + + cudaDevAttrPageableMemoryAccess = ( + cyruntime.cudaDeviceAttr.cudaDevAttrPageableMemoryAccess, + 'Device supports coherently accessing pageable memory without calling\n' + 'cudaHostRegister on it\n' + ) + + + cudaDevAttrConcurrentManagedAccess = ( + cyruntime.cudaDeviceAttr.cudaDevAttrConcurrentManagedAccess, + 'Device can coherently access managed memory concurrently with the CPU\n' + ) + + + cudaDevAttrComputePreemptionSupported = ( + cyruntime.cudaDeviceAttr.cudaDevAttrComputePreemptionSupported, + 'Device supports Compute Preemption\n' + ) + + + cudaDevAttrCanUseHostPointerForRegisteredMem = ( + cyruntime.cudaDeviceAttr.cudaDevAttrCanUseHostPointerForRegisteredMem, + 'Device can access host registered memory at the same virtual address as the\n' + 'CPU\n' + ) + + cudaDevAttrReserved92 = cyruntime.cudaDeviceAttr.cudaDevAttrReserved92 + + cudaDevAttrReserved93 = cyruntime.cudaDeviceAttr.cudaDevAttrReserved93 + + cudaDevAttrReserved94 = cyruntime.cudaDeviceAttr.cudaDevAttrReserved94 + + + cudaDevAttrCooperativeLaunch = ( + cyruntime.cudaDeviceAttr.cudaDevAttrCooperativeLaunch, + 'Device supports launching cooperative kernels via\n' + ':py:obj:`~.cudaLaunchCooperativeKernel`\n' + ) + + cudaDevAttrReserved96 = cyruntime.cudaDeviceAttr.cudaDevAttrReserved96 + + + cudaDevAttrMaxSharedMemoryPerBlockOptin = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMaxSharedMemoryPerBlockOptin, + 'The maximum optin shared memory per block. This value may vary by chip. See\n' + ':py:obj:`~.cudaFuncSetAttribute`\n' + ) + + + cudaDevAttrCanFlushRemoteWrites = ( + cyruntime.cudaDeviceAttr.cudaDevAttrCanFlushRemoteWrites, + 'Device supports flushing of outstanding remote writes.\n' + ) + + + cudaDevAttrHostRegisterSupported = ( + cyruntime.cudaDeviceAttr.cudaDevAttrHostRegisterSupported, + 'Device supports host memory registration via :py:obj:`~.cudaHostRegister`.\n' + ) + + + cudaDevAttrPageableMemoryAccessUsesHostPageTables = ( + cyruntime.cudaDeviceAttr.cudaDevAttrPageableMemoryAccessUsesHostPageTables, + "Device accesses pageable memory via the host's page tables.\n" + ) + + + cudaDevAttrDirectManagedMemAccessFromHost = ( + cyruntime.cudaDeviceAttr.cudaDevAttrDirectManagedMemAccessFromHost, + 'Host can directly access managed memory on the device without migration.\n' + ) + + + cudaDevAttrMaxBlocksPerMultiprocessor = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMaxBlocksPerMultiprocessor, + 'Maximum number of blocks per multiprocessor\n' + ) + + + cudaDevAttrMaxPersistingL2CacheSize = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMaxPersistingL2CacheSize, + 'Maximum L2 persisting lines capacity setting in bytes.\n' + ) + + + cudaDevAttrMaxAccessPolicyWindowSize = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMaxAccessPolicyWindowSize, + 'Maximum value of :py:obj:`~.cudaAccessPolicyWindow.num_bytes`.\n' + ) + + + cudaDevAttrReservedSharedMemoryPerBlock = ( + cyruntime.cudaDeviceAttr.cudaDevAttrReservedSharedMemoryPerBlock, + 'Shared memory reserved by CUDA driver per block in bytes\n' + ) + + + cudaDevAttrSparseCudaArraySupported = ( + cyruntime.cudaDeviceAttr.cudaDevAttrSparseCudaArraySupported, + 'Device supports sparse CUDA arrays and sparse CUDA mipmapped arrays\n' + ) + + + cudaDevAttrHostRegisterReadOnlySupported = ( + cyruntime.cudaDeviceAttr.cudaDevAttrHostRegisterReadOnlySupported, + 'Device supports using the :py:obj:`~.cudaHostRegister` flag\n' + 'cudaHostRegisterReadOnly to register memory that must be mapped as read-\n' + 'only to the GPU\n' + ) + + + cudaDevAttrTimelineSemaphoreInteropSupported = ( + cyruntime.cudaDeviceAttr.cudaDevAttrTimelineSemaphoreInteropSupported, + 'External timeline semaphore interop is supported on the device\n' + ) + + + cudaDevAttrMemoryPoolsSupported = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMemoryPoolsSupported, + 'Device supports using the :py:obj:`~.cudaMallocAsync` and\n' + ':py:obj:`~.cudaMemPool` family of APIs\n' + ) + + + cudaDevAttrGPUDirectRDMASupported = ( + cyruntime.cudaDeviceAttr.cudaDevAttrGPUDirectRDMASupported, + 'Device supports GPUDirect RDMA APIs, like nvidia_p2p_get_pages (see\n' + 'https://docs.nvidia.com/cuda/gpudirect-rdma for more information)\n' + ) + + + cudaDevAttrGPUDirectRDMAFlushWritesOptions = ( + cyruntime.cudaDeviceAttr.cudaDevAttrGPUDirectRDMAFlushWritesOptions, + 'The returned attribute shall be interpreted as a bitmask, where the\n' + 'individual bits are listed in the\n' + ':py:obj:`~.cudaFlushGPUDirectRDMAWritesOptions` enum\n' + ) + + + cudaDevAttrGPUDirectRDMAWritesOrdering = ( + cyruntime.cudaDeviceAttr.cudaDevAttrGPUDirectRDMAWritesOrdering, + 'GPUDirect RDMA writes to the device do not need to be flushed for consumers\n' + 'within the scope indicated by the returned attribute. See\n' + ':py:obj:`~.cudaGPUDirectRDMAWritesOrdering` for the numerical values\n' + 'returned here.\n' + ) + + + cudaDevAttrMemoryPoolSupportedHandleTypes = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMemoryPoolSupportedHandleTypes, + 'Handle types supported with mempool based IPC\n' + ) + + + cudaDevAttrClusterLaunch = ( + cyruntime.cudaDeviceAttr.cudaDevAttrClusterLaunch, + 'Indicates device supports cluster launch\n' + ) + + + cudaDevAttrDeferredMappingCudaArraySupported = ( + cyruntime.cudaDeviceAttr.cudaDevAttrDeferredMappingCudaArraySupported, + 'Device supports deferred mapping CUDA arrays and CUDA mipmapped arrays\n' + ) + + cudaDevAttrReserved122 = cyruntime.cudaDeviceAttr.cudaDevAttrReserved122 + + cudaDevAttrReserved123 = cyruntime.cudaDeviceAttr.cudaDevAttrReserved123 + + cudaDevAttrReserved124 = cyruntime.cudaDeviceAttr.cudaDevAttrReserved124 + + + cudaDevAttrIpcEventSupport = ( + cyruntime.cudaDeviceAttr.cudaDevAttrIpcEventSupport, + 'Device supports IPC Events.\n' + ) + + + cudaDevAttrMemSyncDomainCount = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMemSyncDomainCount, + 'Number of memory synchronization domains the device supports.\n' + ) + + cudaDevAttrReserved127 = cyruntime.cudaDeviceAttr.cudaDevAttrReserved127 + + cudaDevAttrReserved128 = cyruntime.cudaDeviceAttr.cudaDevAttrReserved128 + + cudaDevAttrReserved129 = cyruntime.cudaDeviceAttr.cudaDevAttrReserved129 + + + cudaDevAttrNumaConfig = ( + cyruntime.cudaDeviceAttr.cudaDevAttrNumaConfig, + 'NUMA configuration of a device: value is of type\n' + ':py:obj:`~.cudaDeviceNumaConfig` enum\n' + ) + + + cudaDevAttrNumaId = ( + cyruntime.cudaDeviceAttr.cudaDevAttrNumaId, + 'NUMA node ID of the GPU memory\n' + ) + + cudaDevAttrReserved132 = cyruntime.cudaDeviceAttr.cudaDevAttrReserved132 + + + cudaDevAttrMpsEnabled = ( + cyruntime.cudaDeviceAttr.cudaDevAttrMpsEnabled, + 'Contexts created on this device will be shared via MPS\n' + ) + + + cudaDevAttrHostNumaId = ( + cyruntime.cudaDeviceAttr.cudaDevAttrHostNumaId, + 'NUMA ID of the host node closest to the device or -1 when system does not\n' + 'support NUMA\n' + ) + + + cudaDevAttrD3D12CigSupported = ( + cyruntime.cudaDeviceAttr.cudaDevAttrD3D12CigSupported, + 'Device supports CIG with D3D12.\n' + ) + + + cudaDevAttrVulkanCigSupported = ( + cyruntime.cudaDeviceAttr.cudaDevAttrVulkanCigSupported, + 'Device supports CIG with Vulkan.\n' + ) + + + cudaDevAttrGpuPciDeviceId = ( + cyruntime.cudaDeviceAttr.cudaDevAttrGpuPciDeviceId, + 'The combined 16-bit PCI device ID and 16-bit PCI vendor ID.\n' + ) + + + cudaDevAttrGpuPciSubsystemId = ( + cyruntime.cudaDeviceAttr.cudaDevAttrGpuPciSubsystemId, + 'The combined 16-bit PCI subsystem ID and 16-bit PCI subsystem vendor ID.\n' + ) + + cudaDevAttrReserved141 = cyruntime.cudaDeviceAttr.cudaDevAttrReserved141 + + + cudaDevAttrHostNumaMemoryPoolsSupported = ( + cyruntime.cudaDeviceAttr.cudaDevAttrHostNumaMemoryPoolsSupported, + 'Device supports HOST_NUMA location with the :py:obj:`~.cudaMallocAsync` and\n' + ':py:obj:`~.cudaMemPool` family of APIs\n' + ) + + + cudaDevAttrHostNumaMultinodeIpcSupported = ( + cyruntime.cudaDeviceAttr.cudaDevAttrHostNumaMultinodeIpcSupported, + 'Device supports HostNuma location IPC between nodes in a multi-node system.\n' + ) + + + cudaDevAttrHostMemoryPoolsSupported = ( + cyruntime.cudaDeviceAttr.cudaDevAttrHostMemoryPoolsSupported, + 'Device suports HOST location with the :py:obj:`~.cuMemAllocAsync` and\n' + ':py:obj:`~.cuMemPool` family of APIs\n' + ) + + cudaDevAttrReserved145 = cyruntime.cudaDeviceAttr.cudaDevAttrReserved145 + + + cudaDevAttrOnlyPartialHostNativeAtomicSupported = ( + cyruntime.cudaDeviceAttr.cudaDevAttrOnlyPartialHostNativeAtomicSupported, + 'Link between the device and the host supports only some native atomic\n' + 'operations\n' + ) + + + cudaDevAttrAtomicReductionSupported = ( + cyruntime.cudaDeviceAttr.cudaDevAttrAtomicReductionSupported, + 'Device supports atomic reduction operations in stream batch memory\n' + 'operations\n' + ) + + + cudaDevAttrCigStreamsSupported = ( + cyruntime.cudaDeviceAttr.cudaDevAttrCigStreamsSupported, + 'Device supports CIG streams\n' + ) + + cudaDevAttrMax = cyruntime.cudaDeviceAttr.cudaDevAttrMax + +class cudaMemPoolAttr(_FastEnum): + """ + CUDA memory pool attributes + """ + + + cudaMemPoolReuseFollowEventDependencies = ( + cyruntime.cudaMemPoolAttr.cudaMemPoolReuseFollowEventDependencies, + '(value type = int) Allow cuMemAllocAsync to use memory asynchronously freed\n' + 'in another streams as long as a stream ordering dependency of the\n' + 'allocating stream on the free action exists. Cuda events and null stream\n' + 'interactions can create the required stream ordered dependencies. (default\n' + 'enabled)\n' + ) + + + cudaMemPoolReuseAllowOpportunistic = ( + cyruntime.cudaMemPoolAttr.cudaMemPoolReuseAllowOpportunistic, + '(value type = int) Allow reuse of already completed frees when there is no\n' + 'dependency between the free and allocation. (default enabled)\n' + ) + + + cudaMemPoolReuseAllowInternalDependencies = ( + cyruntime.cudaMemPoolAttr.cudaMemPoolReuseAllowInternalDependencies, + '(value type = int) Allow cuMemAllocAsync to insert new stream dependencies\n' + 'in order to establish the stream ordering required to reuse a piece of\n' + 'memory released by cuFreeAsync (default enabled).\n' + ) + + + cudaMemPoolAttrReleaseThreshold = ( + cyruntime.cudaMemPoolAttr.cudaMemPoolAttrReleaseThreshold, + '(value type = cuuint64_t) Amount of reserved memory in bytes to hold onto\n' + 'before trying to release memory back to the OS. When more than the release\n' + 'threshold bytes of memory are held by the memory pool, the allocator will\n' + 'try to release memory back to the OS on the next call to stream, event or\n' + 'context synchronize. (default 0)\n' + ) + + + cudaMemPoolAttrReservedMemCurrent = ( + cyruntime.cudaMemPoolAttr.cudaMemPoolAttrReservedMemCurrent, + '(value type = cuuint64_t) Amount of backing memory currently allocated for\n' + 'the mempool.\n' + ) + + + cudaMemPoolAttrReservedMemHigh = ( + cyruntime.cudaMemPoolAttr.cudaMemPoolAttrReservedMemHigh, + '(value type = cuuint64_t) High watermark of backing memory allocated for\n' + 'the mempool since the last time it was reset. High watermark can only be\n' + 'reset to zero.\n' + ) + + + cudaMemPoolAttrUsedMemCurrent = ( + cyruntime.cudaMemPoolAttr.cudaMemPoolAttrUsedMemCurrent, + '(value type = cuuint64_t) Amount of memory from the pool that is currently\n' + 'in use by the application.\n' + ) + + + cudaMemPoolAttrUsedMemHigh = ( + cyruntime.cudaMemPoolAttr.cudaMemPoolAttrUsedMemHigh, + '(value type = cuuint64_t) High watermark of the amount of memory from the\n' + 'pool that was in use by the application since the last time it was reset.\n' + 'High watermark can only be reset to zero.\n' + ) + + + cudaMemPoolAttrAllocationType = ( + cyruntime.cudaMemPoolAttr.cudaMemPoolAttrAllocationType, + '(value type = :py:obj:`~.cudaMemAllocationType`) The allocation type of the\n' + 'mempool\n' + ) + + + cudaMemPoolAttrExportHandleTypes = ( + cyruntime.cudaMemPoolAttr.cudaMemPoolAttrExportHandleTypes, + '(value type = :py:obj:`~.cudaMemAllocationHandleType`) Available export\n' + 'handle types for the mempool. For imported pools this value is always\n' + 'cudaMemHandleTypeNone as an imported pool cannot be re-exported\n' + ) + + + cudaMemPoolAttrLocationId = ( + cyruntime.cudaMemPoolAttr.cudaMemPoolAttrLocationId, + '(value type = int) The location id for the mempool. If the location type\n' + 'for this pool is cudaMemLocationTypeInvisible then ID will be\n' + 'cudaInvalidDeviceId\n' + ) + + + cudaMemPoolAttrLocationType = ( + cyruntime.cudaMemPoolAttr.cudaMemPoolAttrLocationType, + '(value type = :py:obj:`~.cudaMemLocationType`) The location type for the\n' + 'mempool. For imported memory pools where the device is not directly visible\n' + 'to the importing process or pools imported via fabric handles across nodes\n' + 'this will be cudaMemLocationTypeInvisible\n' + ) + + + cudaMemPoolAttrMaxPoolSize = ( + cyruntime.cudaMemPoolAttr.cudaMemPoolAttrMaxPoolSize, + '(value type = cuuint64_t) Maximum size of the pool in bytes, this value may\n' + 'be higher than what was initially passed to cudaMemPoolCreate due to\n' + 'alignment requirements. A value of 0 indicates no maximum size. For\n' + 'cudaMemAllocationTypeManaged and IPC imported pools this value will be\n' + 'system dependent.\n' + ) + + + cudaMemPoolAttrHwDecompressEnabled = ( + cyruntime.cudaMemPoolAttr.cudaMemPoolAttrHwDecompressEnabled, + '(value type = int) Indicates whether the pool has hardware compresssion\n' + 'enabled\n' + ) + +class cudaMemLocationType(_FastEnum): + """ + Specifies the type of location + """ + + cudaMemLocationTypeInvalid = cyruntime.cudaMemLocationType.cudaMemLocationTypeInvalid + + + cudaMemLocationTypeNone = ( + cyruntime.cudaMemLocationType.cudaMemLocationTypeNone, + 'Location is unspecified. This is used when creating a managed memory pool\n' + 'to indicate no preferred location for the pool\n' + ) + + + cudaMemLocationTypeDevice = ( + cyruntime.cudaMemLocationType.cudaMemLocationTypeDevice, + 'Location is a device location, thus id is a device ordinal\n' + ) + + + cudaMemLocationTypeHost = ( + cyruntime.cudaMemLocationType.cudaMemLocationTypeHost, + 'Location is host, id is ignored\n' + ) + + + cudaMemLocationTypeHostNuma = ( + cyruntime.cudaMemLocationType.cudaMemLocationTypeHostNuma, + 'Location is a host NUMA node, thus id is a host NUMA node id\n' + ) + + + cudaMemLocationTypeHostNumaCurrent = ( + cyruntime.cudaMemLocationType.cudaMemLocationTypeHostNumaCurrent, + "Location is the host NUMA node closest to the current thread's CPU, id is\n" + 'ignored\n' + ) + + + cudaMemLocationTypeInvisible = ( + cyruntime.cudaMemLocationType.cudaMemLocationTypeInvisible, + 'Location is not visible but device is accessible, id is always\n' + 'cudaInvalidDeviceId\n' + ) + +class cudaMemAccessFlags(_FastEnum): + """ + Specifies the memory protection flags for mapping. + """ + + + cudaMemAccessFlagsProtNone = ( + cyruntime.cudaMemAccessFlags.cudaMemAccessFlagsProtNone, + 'Default, make the address range not accessible\n' + ) + + + cudaMemAccessFlagsProtRead = ( + cyruntime.cudaMemAccessFlags.cudaMemAccessFlagsProtRead, + 'Make the address range read accessible\n' + ) + + + cudaMemAccessFlagsProtReadWrite = ( + cyruntime.cudaMemAccessFlags.cudaMemAccessFlagsProtReadWrite, + 'Make the address range read-write accessible\n' + ) + +class cudaMemAllocationType(_FastEnum): + """ + Defines the allocation types available + """ + + cudaMemAllocationTypeInvalid = cyruntime.cudaMemAllocationType.cudaMemAllocationTypeInvalid + + + cudaMemAllocationTypePinned = ( + cyruntime.cudaMemAllocationType.cudaMemAllocationTypePinned, + "This allocation type is 'pinned', i.e. cannot migrate from its current\n" + 'location while the application is actively using it\n' + ) + + + cudaMemAllocationTypeManaged = ( + cyruntime.cudaMemAllocationType.cudaMemAllocationTypeManaged, + 'This allocation type is managed memory\n' + ) + + cudaMemAllocationTypeMax = cyruntime.cudaMemAllocationType.cudaMemAllocationTypeMax + +class cudaMemAllocationHandleType(_FastEnum): + """ + Flags for specifying particular handle types + """ + + + cudaMemHandleTypeNone = ( + cyruntime.cudaMemAllocationHandleType.cudaMemHandleTypeNone, + 'Does not allow any export mechanism. >\n' + ) + + + cudaMemHandleTypePosixFileDescriptor = ( + cyruntime.cudaMemAllocationHandleType.cudaMemHandleTypePosixFileDescriptor, + 'Allows a file descriptor to be used for exporting. Permitted only on POSIX\n' + 'systems. (int)\n' + ) + + + cudaMemHandleTypeWin32 = ( + cyruntime.cudaMemAllocationHandleType.cudaMemHandleTypeWin32, + 'Allows a Win32 NT handle to be used for exporting. (HANDLE)\n' + ) + + + cudaMemHandleTypeWin32Kmt = ( + cyruntime.cudaMemAllocationHandleType.cudaMemHandleTypeWin32Kmt, + 'Allows a Win32 KMT handle to be used for exporting. (D3DKMT_HANDLE)\n' + ) + + + cudaMemHandleTypeFabric = ( + cyruntime.cudaMemAllocationHandleType.cudaMemHandleTypeFabric, + 'Allows a fabric handle to be used for exporting.\n' + '(:py:obj:`~.cudaMemFabricHandle_t`)\n' + ) + +class cudaGraphMemAttributeType(_FastEnum): + """ + Graph memory attributes + """ + + + cudaGraphMemAttrUsedMemCurrent = ( + cyruntime.cudaGraphMemAttributeType.cudaGraphMemAttrUsedMemCurrent, + '(value type = cuuint64_t) Amount of memory, in bytes, currently associated\n' + 'with graphs.\n' + ) + + + cudaGraphMemAttrUsedMemHigh = ( + cyruntime.cudaGraphMemAttributeType.cudaGraphMemAttrUsedMemHigh, + '(value type = cuuint64_t) High watermark of memory, in bytes, associated\n' + 'with graphs since the last time it was reset. High watermark can only be\n' + 'reset to zero.\n' + ) + + + cudaGraphMemAttrReservedMemCurrent = ( + cyruntime.cudaGraphMemAttributeType.cudaGraphMemAttrReservedMemCurrent, + '(value type = cuuint64_t) Amount of memory, in bytes, currently allocated\n' + 'for use by the CUDA graphs asynchronous allocator.\n' + ) + + + cudaGraphMemAttrReservedMemHigh = ( + cyruntime.cudaGraphMemAttributeType.cudaGraphMemAttrReservedMemHigh, + '(value type = cuuint64_t) High watermark of memory, in bytes, currently\n' + 'allocated for use by the CUDA graphs asynchronous allocator.\n' + ) + +class cudaMemcpyFlags(_FastEnum): + """ + Flags to specify for copies within a batch. For more details see + :py:obj:`~.cudaMemcpyBatchAsync`. + """ + + cudaMemcpyFlagDefault = cyruntime.cudaMemcpyFlags.cudaMemcpyFlagDefault + + + cudaMemcpyFlagPreferOverlapWithCompute = ( + cyruntime.cudaMemcpyFlags.cudaMemcpyFlagPreferOverlapWithCompute, + 'Hint to the driver to try and overlap the copy with compute work on the\n' + 'SMs.\n' + ) + +class cudaMemcpySrcAccessOrder(_FastEnum): + """ + + """ + + + cudaMemcpySrcAccessOrderInvalid = ( + cyruntime.cudaMemcpySrcAccessOrder.cudaMemcpySrcAccessOrderInvalid, + 'Default invalid.\n' + ) + + + cudaMemcpySrcAccessOrderStream = ( + cyruntime.cudaMemcpySrcAccessOrder.cudaMemcpySrcAccessOrderStream, + 'Indicates that access to the source pointer must be in stream order.\n' + ) + + + cudaMemcpySrcAccessOrderDuringApiCall = ( + cyruntime.cudaMemcpySrcAccessOrder.cudaMemcpySrcAccessOrderDuringApiCall, + 'Indicates that access to the source pointer can be out of stream order and\n' + 'all accesses must be complete before the API call returns. This flag is\n' + "suited for ephemeral sources (ex., stack variables) when it's known that no\n" + 'prior operations in the stream can be accessing the memory and also that\n' + 'the lifetime of the memory is limited to the scope that the source variable\n' + 'was declared in. Specifying this flag allows the driver to optimize the\n' + 'copy and removes the need for the user to synchronize the stream after the\n' + 'API call.\n' + ) + + + cudaMemcpySrcAccessOrderAny = ( + cyruntime.cudaMemcpySrcAccessOrder.cudaMemcpySrcAccessOrderAny, + 'Indicates that access to the source pointer can be out of stream order and\n' + 'the accesses can happen even after the API call returns. This flag is\n' + "suited for host pointers allocated outside CUDA (ex., via malloc) when it's\n" + 'known that no prior operations in the stream can be accessing the memory.\n' + 'Specifying this flag allows the driver to optimize the copy on certain\n' + 'platforms.\n' + ) + + cudaMemcpySrcAccessOrderMax = cyruntime.cudaMemcpySrcAccessOrder.cudaMemcpySrcAccessOrderMax + +class cudaMemcpy3DOperandType(_FastEnum): + """ + These flags allow applications to convey the operand type for + individual copies specified in :py:obj:`~.cudaMemcpy3DBatchAsync`. + """ + + + cudaMemcpyOperandTypePointer = ( + cyruntime.cudaMemcpy3DOperandType.cudaMemcpyOperandTypePointer, + 'Memcpy operand is a valid pointer.\n' + ) + + + cudaMemcpyOperandTypeArray = ( + cyruntime.cudaMemcpy3DOperandType.cudaMemcpyOperandTypeArray, + 'Memcpy operand is a CUarray.\n' + ) + + cudaMemcpyOperandTypeMax = cyruntime.cudaMemcpy3DOperandType.cudaMemcpyOperandTypeMax + +class cudaDeviceP2PAttr(_FastEnum): + """ + CUDA device P2P attributes + """ + + + cudaDevP2PAttrPerformanceRank = ( + cyruntime.cudaDeviceP2PAttr.cudaDevP2PAttrPerformanceRank, + 'A relative value indicating the performance of the link between two devices\n' + ) + + + cudaDevP2PAttrAccessSupported = ( + cyruntime.cudaDeviceP2PAttr.cudaDevP2PAttrAccessSupported, + 'Peer access is enabled\n' + ) + + + cudaDevP2PAttrNativeAtomicSupported = ( + cyruntime.cudaDeviceP2PAttr.cudaDevP2PAttrNativeAtomicSupported, + 'Native atomic operation over the link supported\n' + ) + + + cudaDevP2PAttrCudaArrayAccessSupported = ( + cyruntime.cudaDeviceP2PAttr.cudaDevP2PAttrCudaArrayAccessSupported, + 'Accessing CUDA arrays over the link supported\n' + ) + + + cudaDevP2PAttrOnlyPartialNativeAtomicSupported = ( + cyruntime.cudaDeviceP2PAttr.cudaDevP2PAttrOnlyPartialNativeAtomicSupported, + 'Only some CUDA-valid atomic operations over the link are supported.\n' + ) + +class cudaAtomicOperation(_FastEnum): + """ + CUDA-valid Atomic Operations + """ + + cudaAtomicOperationIntegerAdd = cyruntime.cudaAtomicOperation.cudaAtomicOperationIntegerAdd + + cudaAtomicOperationIntegerMin = cyruntime.cudaAtomicOperation.cudaAtomicOperationIntegerMin + + cudaAtomicOperationIntegerMax = cyruntime.cudaAtomicOperation.cudaAtomicOperationIntegerMax + + cudaAtomicOperationIntegerIncrement = cyruntime.cudaAtomicOperation.cudaAtomicOperationIntegerIncrement + + cudaAtomicOperationIntegerDecrement = cyruntime.cudaAtomicOperation.cudaAtomicOperationIntegerDecrement + + cudaAtomicOperationAnd = cyruntime.cudaAtomicOperation.cudaAtomicOperationAnd + + cudaAtomicOperationOr = cyruntime.cudaAtomicOperation.cudaAtomicOperationOr + + cudaAtomicOperationXOR = cyruntime.cudaAtomicOperation.cudaAtomicOperationXOR + + cudaAtomicOperationExchange = cyruntime.cudaAtomicOperation.cudaAtomicOperationExchange + + cudaAtomicOperationCAS = cyruntime.cudaAtomicOperation.cudaAtomicOperationCAS + + cudaAtomicOperationFloatAdd = cyruntime.cudaAtomicOperation.cudaAtomicOperationFloatAdd + + cudaAtomicOperationFloatMin = cyruntime.cudaAtomicOperation.cudaAtomicOperationFloatMin + + cudaAtomicOperationFloatMax = cyruntime.cudaAtomicOperation.cudaAtomicOperationFloatMax + +class cudaAtomicOperationCapability(_FastEnum): + """ + CUDA-valid Atomic Operation capabilities + """ + + cudaAtomicCapabilitySigned = cyruntime.cudaAtomicOperationCapability.cudaAtomicCapabilitySigned + + cudaAtomicCapabilityUnsigned = cyruntime.cudaAtomicOperationCapability.cudaAtomicCapabilityUnsigned + + cudaAtomicCapabilityReduction = cyruntime.cudaAtomicOperationCapability.cudaAtomicCapabilityReduction + + cudaAtomicCapabilityScalar32 = cyruntime.cudaAtomicOperationCapability.cudaAtomicCapabilityScalar32 + + cudaAtomicCapabilityScalar64 = cyruntime.cudaAtomicOperationCapability.cudaAtomicCapabilityScalar64 + + cudaAtomicCapabilityScalar128 = cyruntime.cudaAtomicOperationCapability.cudaAtomicCapabilityScalar128 + + cudaAtomicCapabilityVector32x4 = cyruntime.cudaAtomicOperationCapability.cudaAtomicCapabilityVector32x4 + +class cudaExternalMemoryHandleType(_FastEnum): + """ + External memory handle types + """ + + + cudaExternalMemoryHandleTypeOpaqueFd = ( + cyruntime.cudaExternalMemoryHandleType.cudaExternalMemoryHandleTypeOpaqueFd, + 'Handle is an opaque file descriptor\n' + ) + + + cudaExternalMemoryHandleTypeOpaqueWin32 = ( + cyruntime.cudaExternalMemoryHandleType.cudaExternalMemoryHandleTypeOpaqueWin32, + 'Handle is an opaque shared NT handle\n' + ) + + + cudaExternalMemoryHandleTypeOpaqueWin32Kmt = ( + cyruntime.cudaExternalMemoryHandleType.cudaExternalMemoryHandleTypeOpaqueWin32Kmt, + 'Handle is an opaque, globally shared handle\n' + ) + + + cudaExternalMemoryHandleTypeD3D12Heap = ( + cyruntime.cudaExternalMemoryHandleType.cudaExternalMemoryHandleTypeD3D12Heap, + 'Handle is a D3D12 heap object\n' + ) + + + cudaExternalMemoryHandleTypeD3D12Resource = ( + cyruntime.cudaExternalMemoryHandleType.cudaExternalMemoryHandleTypeD3D12Resource, + 'Handle is a D3D12 committed resource\n' + ) + + + cudaExternalMemoryHandleTypeD3D11Resource = ( + cyruntime.cudaExternalMemoryHandleType.cudaExternalMemoryHandleTypeD3D11Resource, + 'Handle is a shared NT handle to a D3D11 resource\n' + ) + + + cudaExternalMemoryHandleTypeD3D11ResourceKmt = ( + cyruntime.cudaExternalMemoryHandleType.cudaExternalMemoryHandleTypeD3D11ResourceKmt, + 'Handle is a globally shared handle to a D3D11 resource\n' + ) + + + cudaExternalMemoryHandleTypeNvSciBuf = ( + cyruntime.cudaExternalMemoryHandleType.cudaExternalMemoryHandleTypeNvSciBuf, + 'Handle is an NvSciBuf object\n' + ) + +class cudaExternalSemaphoreHandleType(_FastEnum): + """ + External semaphore handle types + """ + + + cudaExternalSemaphoreHandleTypeOpaqueFd = ( + cyruntime.cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeOpaqueFd, + 'Handle is an opaque file descriptor\n' + ) + + + cudaExternalSemaphoreHandleTypeOpaqueWin32 = ( + cyruntime.cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeOpaqueWin32, + 'Handle is an opaque shared NT handle\n' + ) + + + cudaExternalSemaphoreHandleTypeOpaqueWin32Kmt = ( + cyruntime.cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeOpaqueWin32Kmt, + 'Handle is an opaque, globally shared handle\n' + ) + + + cudaExternalSemaphoreHandleTypeD3D12Fence = ( + cyruntime.cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeD3D12Fence, + 'Handle is a shared NT handle referencing a D3D12 fence object\n' + ) + + + cudaExternalSemaphoreHandleTypeD3D11Fence = ( + cyruntime.cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeD3D11Fence, + 'Handle is a shared NT handle referencing a D3D11 fence object\n' + ) + + + cudaExternalSemaphoreHandleTypeNvSciSync = ( + cyruntime.cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeNvSciSync, + 'Opaque handle to NvSciSync Object\n' + ) + + + cudaExternalSemaphoreHandleTypeKeyedMutex = ( + cyruntime.cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeKeyedMutex, + 'Handle is a shared NT handle referencing a D3D11 keyed mutex object\n' + ) + + + cudaExternalSemaphoreHandleTypeKeyedMutexKmt = ( + cyruntime.cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeKeyedMutexKmt, + 'Handle is a shared KMT handle referencing a D3D11 keyed mutex object\n' + ) + + + cudaExternalSemaphoreHandleTypeTimelineSemaphoreFd = ( + cyruntime.cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeTimelineSemaphoreFd, + 'Handle is an opaque handle file descriptor referencing a timeline semaphore\n' + ) + + + cudaExternalSemaphoreHandleTypeTimelineSemaphoreWin32 = ( + cyruntime.cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeTimelineSemaphoreWin32, + 'Handle is an opaque handle file descriptor referencing a timeline semaphore\n' + ) + +class cudaDevSmResourceGroup_flags(_FastEnum): + """ + Flags for a CUdevSmResource group + """ + + cudaDevSmResourceGroupDefault = cyruntime.cudaDevSmResourceGroup_flags.cudaDevSmResourceGroupDefault + + + cudaDevSmResourceGroupBackfill = ( + cyruntime.cudaDevSmResourceGroup_flags.cudaDevSmResourceGroupBackfill, + 'Lets smCount be a non-multiple of minCoscheduledCount, filling the\n' + 'difference with other SMs.\n' + ) + +class cudaDevSmResourceSplitByCount_flags(_FastEnum): + """ + + """ + + cudaDevSmResourceSplitIgnoreSmCoscheduling = cyruntime.cudaDevSmResourceSplitByCount_flags.cudaDevSmResourceSplitIgnoreSmCoscheduling + + cudaDevSmResourceSplitMaxPotentialClusterSize = cyruntime.cudaDevSmResourceSplitByCount_flags.cudaDevSmResourceSplitMaxPotentialClusterSize + +class cudaDevResourceType(_FastEnum): + """ + Type of resource + """ + + cudaDevResourceTypeInvalid = cyruntime.cudaDevResourceType.cudaDevResourceTypeInvalid + + + cudaDevResourceTypeSm = ( + cyruntime.cudaDevResourceType.cudaDevResourceTypeSm, + 'Streaming multiprocessors related information\n' + ) + + + cudaDevResourceTypeWorkqueueConfig = ( + cyruntime.cudaDevResourceType.cudaDevResourceTypeWorkqueueConfig, + 'Workqueue configuration related information\n' + ) + + + cudaDevResourceTypeWorkqueue = ( + cyruntime.cudaDevResourceType.cudaDevResourceTypeWorkqueue, + 'Pre-existing workqueue related information\n' + ) + +class cudaDevWorkqueueConfigScope(_FastEnum): + """ + Sharing scope for workqueues + """ + + + cudaDevWorkqueueConfigScopeDeviceCtx = ( + cyruntime.cudaDevWorkqueueConfigScope.cudaDevWorkqueueConfigScopeDeviceCtx, + 'Use all shared workqueue resources on the device. Default driver behaviour.\n' + ) + + + cudaDevWorkqueueConfigScopeGreenCtxBalanced = ( + cyruntime.cudaDevWorkqueueConfigScope.cudaDevWorkqueueConfigScopeGreenCtxBalanced, + 'When possible, use non-overlapping workqueue resources with other balanced\n' + 'green contexts.\n' + ) + +class cudaJitOption(_FastEnum): + """ + Online compiler and linker options + """ + + + cudaJitMaxRegisters = ( + cyruntime.cudaJitOption.cudaJitMaxRegisters, + 'Max number of registers that a thread may use.\n' + 'Option type: unsigned int\n' + 'Applies to: compiler only\n' + ) + + + cudaJitThreadsPerBlock = ( + cyruntime.cudaJitOption.cudaJitThreadsPerBlock, + 'IN: Specifies minimum number of threads per block to target compilation for\n' + 'OUT: Returns the number of threads the compiler actually targeted. This\n' + 'restricts the resource utilization of the compiler (e.g. max registers)\n' + 'such that a block with the given number of threads should be able to launch\n' + 'based on register limitations. Note, this option does not currently take\n' + 'into account any other resource limitations, such as shared memory\n' + 'utilization.\n' + 'Option type: unsigned int\n' + 'Applies to: compiler only\n' + ) + + + cudaJitWallTime = ( + cyruntime.cudaJitOption.cudaJitWallTime, + 'Overwrites the option value with the total wall clock time, in\n' + 'milliseconds, spent in the compiler and linker\n' + 'Option type: float\n' + 'Applies to: compiler and linker\n' + ) + + + cudaJitInfoLogBuffer = ( + cyruntime.cudaJitOption.cudaJitInfoLogBuffer, + 'Pointer to a buffer in which to print any log messages that are\n' + 'informational in nature (the buffer size is specified via option\n' + ':py:obj:`~.cudaJitInfoLogBufferSizeBytes`)\n' + 'Option type: char *\n' + 'Applies to: compiler and linker\n' + ) + + + cudaJitInfoLogBufferSizeBytes = ( + cyruntime.cudaJitOption.cudaJitInfoLogBufferSizeBytes, + 'IN: Log buffer size in bytes. Log messages will be capped at this size\n' + '(including null terminator)\n' + 'OUT: Amount of log buffer filled with messages\n' + 'Option type: unsigned int\n' + 'Applies to: compiler and linker\n' + ) + + + cudaJitErrorLogBuffer = ( + cyruntime.cudaJitOption.cudaJitErrorLogBuffer, + 'Pointer to a buffer in which to print any log messages that reflect errors\n' + '(the buffer size is specified via option\n' + ':py:obj:`~.cudaJitErrorLogBufferSizeBytes`)\n' + 'Option type: char *\n' + 'Applies to: compiler and linker\n' + ) + + + cudaJitErrorLogBufferSizeBytes = ( + cyruntime.cudaJitOption.cudaJitErrorLogBufferSizeBytes, + 'IN: Log buffer size in bytes. Log messages will be capped at this size\n' + '(including null terminator)\n' + 'OUT: Amount of log buffer filled with messages\n' + 'Option type: unsigned int\n' + 'Applies to: compiler and linker\n' + ) + + + cudaJitOptimizationLevel = ( + cyruntime.cudaJitOption.cudaJitOptimizationLevel, + 'Level of optimizations to apply to generated code (0 - 4), with 4 being the\n' + 'default and highest level of optimizations.\n' + 'Option type: unsigned int\n' + 'Applies to: compiler only\n' + ) + + + cudaJitFallbackStrategy = ( + cyruntime.cudaJitOption.cudaJitFallbackStrategy, + 'Specifies choice of fallback strategy if matching cubin is not found.\n' + 'Choice is based on supplied :py:obj:`~.cudaJit_Fallback`. Option type:\n' + 'unsigned int for enumerated type :py:obj:`~.cudaJit_Fallback`\n' + 'Applies to: compiler only\n' + ) + + + cudaJitGenerateDebugInfo = ( + cyruntime.cudaJitOption.cudaJitGenerateDebugInfo, + 'Specifies whether to create debug information in output (-g) (0: false,\n' + 'default)\n' + 'Option type: int\n' + 'Applies to: compiler and linker\n' + ) + + + cudaJitLogVerbose = ( + cyruntime.cudaJitOption.cudaJitLogVerbose, + 'Generate verbose log messages (0: false, default)\n' + 'Option type: int\n' + 'Applies to: compiler and linker\n' + ) + + + cudaJitGenerateLineInfo = ( + cyruntime.cudaJitOption.cudaJitGenerateLineInfo, + 'Generate line number information (-lineinfo) (0: false, default)\n' + 'Option type: int\n' + 'Applies to: compiler only\n' + ) + + + cudaJitCacheMode = ( + cyruntime.cudaJitOption.cudaJitCacheMode, + 'Specifies whether to enable caching explicitly (-dlcm)\n' + 'Choice is based on supplied :py:obj:`~.cudaJit_CacheMode`.\n' + 'Option type: unsigned int for enumerated type :py:obj:`~.cudaJit_CacheMode`\n' + 'Applies to: compiler only\n' + ) + + + cudaJitPositionIndependentCode = ( + cyruntime.cudaJitOption.cudaJitPositionIndependentCode, + 'Generate position independent code (0: false)\n' + 'Option type: int\n' + 'Applies to: compiler only\n' + ) + + + cudaJitMinCtaPerSm = ( + cyruntime.cudaJitOption.cudaJitMinCtaPerSm, + 'This option hints to the JIT compiler the minimum number of CTAs from the\n' + 'kernel’s grid to be mapped to a SM. This option is ignored when used\n' + 'together with :py:obj:`~.cudaJitMaxRegisters` or\n' + ':py:obj:`~.cudaJitThreadsPerBlock`. Optimizations based on this option need\n' + ':py:obj:`~.cudaJitMaxThreadsPerBlock` to be specified as well. For kernels\n' + 'already using PTX directive .minnctapersm, this option will be ignored by\n' + 'default. Use :py:obj:`~.cudaJitOverrideDirectiveValues` to let this option\n' + 'take precedence over the PTX directive. Option type: unsigned int\n' + 'Applies to: compiler only\n' + ) + + + cudaJitMaxThreadsPerBlock = ( + cyruntime.cudaJitOption.cudaJitMaxThreadsPerBlock, + 'Maximum number threads in a thread block, computed as the product of the\n' + 'maximum extent specifed for each dimension of the block. This limit is\n' + 'guaranteed not to be exeeded in any invocation of the kernel. Exceeding the\n' + 'the maximum number of threads results in runtime error or kernel launch\n' + 'failure. For kernels already using PTX directive .maxntid, this option will\n' + 'be ignored by default. Use :py:obj:`~.cudaJitOverrideDirectiveValues` to\n' + 'let this option take precedence over the PTX directive. Option type: int\n' + 'Applies to: compiler only\n' + ) + + + cudaJitOverrideDirectiveValues = ( + cyruntime.cudaJitOption.cudaJitOverrideDirectiveValues, + 'This option lets the values specified using\n' + ':py:obj:`~.cudaJitMaxRegisters`, :py:obj:`~.cudaJitThreadsPerBlock`,\n' + ':py:obj:`~.cudaJitMaxThreadsPerBlock` and :py:obj:`~.cudaJitMinCtaPerSm`\n' + 'take precedence over any PTX directives. (0: Disable, default; 1: Enable)\n' + 'Option type: int\n' + 'Applies to: compiler only\n' + ) + +class cudaLibraryOption(_FastEnum): + """ + Library options to be specified with + :py:obj:`~.cudaLibraryLoadData()` or + :py:obj:`~.cudaLibraryLoadFromFile()` + """ + + cudaLibraryHostUniversalFunctionAndDataTable = cyruntime.cudaLibraryOption.cudaLibraryHostUniversalFunctionAndDataTable + + + cudaLibraryBinaryIsPreserved = ( + cyruntime.cudaLibraryOption.cudaLibraryBinaryIsPreserved, + 'Specifes that the argument `code` passed to\n' + ':py:obj:`~.cudaLibraryLoadData()` will be preserved. Specifying this option\n' + 'will let the driver know that `code` can be accessed at any point until\n' + ':py:obj:`~.cudaLibraryUnload()`. The default behavior is for the driver to\n' + 'allocate and maintain its own copy of `code`. Note that this is only a\n' + 'memory usage optimization hint and the driver can choose to ignore it if\n' + 'required. Specifying this option with :py:obj:`~.cudaLibraryLoadFromFile()`\n' + 'is invalid and will return :py:obj:`~.cudaErrorInvalidValue`.\n' + ) + +class cudaJit_CacheMode(_FastEnum): + """ + Caching modes for dlcm + """ + + + cudaJitCacheOptionNone = ( + cyruntime.cudaJit_CacheMode.cudaJitCacheOptionNone, + 'Compile with no -dlcm flag specified\n' + ) + + + cudaJitCacheOptionCG = ( + cyruntime.cudaJit_CacheMode.cudaJitCacheOptionCG, + 'Compile with L1 cache disabled\n' + ) + + + cudaJitCacheOptionCA = ( + cyruntime.cudaJit_CacheMode.cudaJitCacheOptionCA, + 'Compile with L1 cache enabled\n' + ) + +class cudaJit_Fallback(_FastEnum): + """ + Cubin matching fallback strategies + """ + + + cudaPreferPtx = ( + cyruntime.cudaJit_Fallback.cudaPreferPtx, + 'Prefer to compile ptx if exact binary match not found\n' + ) + + + cudaPreferBinary = ( + cyruntime.cudaJit_Fallback.cudaPreferBinary, + 'Prefer to fall back to compatible binary code if exact match not found\n' + ) + +class cudaCGScope(_FastEnum): + """ + CUDA cooperative group scope + """ + + + cudaCGScopeInvalid = ( + cyruntime.cudaCGScope.cudaCGScopeInvalid, + 'Invalid cooperative group scope\n' + ) + + + cudaCGScopeGrid = ( + cyruntime.cudaCGScope.cudaCGScopeGrid, + 'Scope represented by a grid_group\n' + ) + + + cudaCGScopeReserved = ( + cyruntime.cudaCGScope.cudaCGScopeReserved, + 'Reserved\n' + ) + +class cudaKernelFunctionType(_FastEnum): + """ + CUDA Kernel Function Handle Type + """ + + + cudaKernelFunctionTypeUnspecified = ( + cyruntime.cudaKernelFunctionType.cudaKernelFunctionTypeUnspecified, + 'CUDA will attempt to deduce the type of the function handle\n' + ) + + + cudaKernelFunctionTypeDeviceEntry = ( + cyruntime.cudaKernelFunctionType.cudaKernelFunctionTypeDeviceEntry, + 'Function handle is a device-entry function pointer(i.e. global function\n' + 'pointer)\n' + ) + + + cudaKernelFunctionTypeKernel = ( + cyruntime.cudaKernelFunctionType.cudaKernelFunctionTypeKernel, + 'Function handle is a :py:obj:`~.cudaKernel_t`\n' + ) + + + cudaKernelFunctionTypeFunction = ( + cyruntime.cudaKernelFunctionType.cudaKernelFunctionTypeFunction, + 'Function handle is a :py:obj:`~.cudaFunction_t`\n' + ) + +class cudaGraphConditionalHandleFlags(_FastEnum): + """ + + """ + + + cudaGraphCondAssignDefault = ( + cyruntime.cudaGraphConditionalHandleFlags.cudaGraphCondAssignDefault, + 'Apply default handle value when graph is launched.\n' + ) + +class cudaGraphConditionalNodeType(_FastEnum): + """ + CUDA conditional node types + """ + + + cudaGraphCondTypeIf = ( + cyruntime.cudaGraphConditionalNodeType.cudaGraphCondTypeIf, + "Conditional 'if/else' Node. Body[0] executed if condition is non-zero. If\n" + '`size` == 2, an optional ELSE graph is created and this is executed if the\n' + 'condition is zero.\n' + ) + + + cudaGraphCondTypeWhile = ( + cyruntime.cudaGraphConditionalNodeType.cudaGraphCondTypeWhile, + "Conditional 'while' Node. Body executed repeatedly while condition value is\n" + 'non-zero.\n' + ) + + + cudaGraphCondTypeSwitch = ( + cyruntime.cudaGraphConditionalNodeType.cudaGraphCondTypeSwitch, + "Conditional 'switch' Node. Body[n] is executed once, where 'n' is the value\n" + 'of the condition. If the condition does not match a body index, no body is\n' + 'launched.\n' + ) + +class cudaGraphNodeType(_FastEnum): + """ + CUDA Graph node types + """ + + + cudaGraphNodeTypeKernel = ( + cyruntime.cudaGraphNodeType.cudaGraphNodeTypeKernel, + 'GPU kernel node\n' + ) + + + cudaGraphNodeTypeMemcpy = ( + cyruntime.cudaGraphNodeType.cudaGraphNodeTypeMemcpy, + 'Memcpy node\n' + ) + + + cudaGraphNodeTypeMemset = ( + cyruntime.cudaGraphNodeType.cudaGraphNodeTypeMemset, + 'Memset node\n' + ) + + + cudaGraphNodeTypeHost = ( + cyruntime.cudaGraphNodeType.cudaGraphNodeTypeHost, + 'Host (executable) node\n' + ) + + + cudaGraphNodeTypeGraph = ( + cyruntime.cudaGraphNodeType.cudaGraphNodeTypeGraph, + 'Node which executes an embedded graph\n' + ) + + + cudaGraphNodeTypeEmpty = ( + cyruntime.cudaGraphNodeType.cudaGraphNodeTypeEmpty, + 'Empty (no-op) node\n' + ) + + + cudaGraphNodeTypeWaitEvent = ( + cyruntime.cudaGraphNodeType.cudaGraphNodeTypeWaitEvent, + 'External event wait node\n' + ) + + + cudaGraphNodeTypeEventRecord = ( + cyruntime.cudaGraphNodeType.cudaGraphNodeTypeEventRecord, + 'External event record node\n' + ) + + + cudaGraphNodeTypeExtSemaphoreSignal = ( + cyruntime.cudaGraphNodeType.cudaGraphNodeTypeExtSemaphoreSignal, + 'External semaphore signal node\n' + ) + + + cudaGraphNodeTypeExtSemaphoreWait = ( + cyruntime.cudaGraphNodeType.cudaGraphNodeTypeExtSemaphoreWait, + 'External semaphore wait node\n' + ) + + + cudaGraphNodeTypeMemAlloc = ( + cyruntime.cudaGraphNodeType.cudaGraphNodeTypeMemAlloc, + 'Memory allocation node\n' + ) + + + cudaGraphNodeTypeMemFree = ( + cyruntime.cudaGraphNodeType.cudaGraphNodeTypeMemFree, + 'Memory free node\n' + ) + + + cudaGraphNodeTypeConditional = ( + cyruntime.cudaGraphNodeType.cudaGraphNodeTypeConditional, + 'Conditional node May be used to\n' + 'implement a conditional execution path or loop\n' + ' inside of a graph. The graph(s)\n' + 'contained within the body of the conditional node\n' + ' can be selectively executed or iterated\n' + 'upon based on the value of a conditional\n' + ' variable.\n' + ' Handles must be created in advance of\n' + 'creating the node\n' + ' using\n' + ':py:obj:`~.cudaGraphConditionalHandleCreate`.\n' + ' The following restrictions apply to\n' + 'graphs which contain conditional nodes:\n' + ' The graph cannot be used in a child\n' + 'node.\n' + ' Only one instantiation of the graph\n' + 'may exist at any point in time.\n' + ' The graph cannot be cloned.\n' + ' To set the control value, supply a\n' + 'default value when creating the handle and/or\n' + ' call :py:obj:`~.cudaGraphSetConditional`\n' + 'from device code.\n' + ) + + + cudaGraphNodeTypeReserved16 = ( + cyruntime.cudaGraphNodeType.cudaGraphNodeTypeReserved16, + 'Reserved.\n' + ) + + cudaGraphNodeTypeCount = cyruntime.cudaGraphNodeType.cudaGraphNodeTypeCount + +class cudaGraphChildGraphNodeOwnership(_FastEnum): + """ + Child graph node ownership + """ + + + cudaGraphChildGraphOwnershipInvalid = ( + cyruntime.cudaGraphChildGraphNodeOwnership.cudaGraphChildGraphOwnershipInvalid, + 'Invalid ownership flag. Set when params are queried to prevent accidentally\n' + 'reusing the driver-owned graph object\n' + ) + + + cudaGraphChildGraphOwnershipClone = ( + cyruntime.cudaGraphChildGraphNodeOwnership.cudaGraphChildGraphOwnershipClone, + 'Default behavior for a child graph node. Child graph is cloned into the\n' + "parent and memory allocation/free nodes can't be present in the child\n" + 'graph.\n' + ) + + + cudaGraphChildGraphOwnershipMove = ( + cyruntime.cudaGraphChildGraphNodeOwnership.cudaGraphChildGraphOwnershipMove, + 'The child graph is moved to the parent. The handle to the child graph is\n' + 'owned by the parent and will be destroyed when the parent is destroyed.\n' + 'The following restrictions apply to child graphs after they have been\n' + 'moved: Cannot be independently instantiated or destroyed; Cannot be added\n' + 'as a child graph of a separate parent graph; Cannot be used as an argument\n' + 'to cudaGraphExecUpdate; Cannot have additional memory allocation or free\n' + 'nodes added.\n' + ) + +class cudaGraphExecUpdateResult(_FastEnum): + """ + CUDA Graph Update error types + """ + + + cudaGraphExecUpdateSuccess = ( + cyruntime.cudaGraphExecUpdateResult.cudaGraphExecUpdateSuccess, + 'The update succeeded\n' + ) + + + cudaGraphExecUpdateError = ( + cyruntime.cudaGraphExecUpdateResult.cudaGraphExecUpdateError, + 'The update failed for an unexpected reason which is described in the return\n' + 'value of the function\n' + ) + + + cudaGraphExecUpdateErrorTopologyChanged = ( + cyruntime.cudaGraphExecUpdateResult.cudaGraphExecUpdateErrorTopologyChanged, + 'The update failed because the topology changed\n' + ) + + + cudaGraphExecUpdateErrorNodeTypeChanged = ( + cyruntime.cudaGraphExecUpdateResult.cudaGraphExecUpdateErrorNodeTypeChanged, + 'The update failed because a node type changed\n' + ) + + + cudaGraphExecUpdateErrorFunctionChanged = ( + cyruntime.cudaGraphExecUpdateResult.cudaGraphExecUpdateErrorFunctionChanged, + 'The update failed because the function of a kernel node changed (CUDA\n' + 'driver < 11.2)\n' + ) + + + cudaGraphExecUpdateErrorParametersChanged = ( + cyruntime.cudaGraphExecUpdateResult.cudaGraphExecUpdateErrorParametersChanged, + 'The update failed because the parameters changed in a way that is not\n' + 'supported\n' + ) + + + cudaGraphExecUpdateErrorNotSupported = ( + cyruntime.cudaGraphExecUpdateResult.cudaGraphExecUpdateErrorNotSupported, + 'The update failed because something about the node is not supported\n' + ) + + + cudaGraphExecUpdateErrorUnsupportedFunctionChange = ( + cyruntime.cudaGraphExecUpdateResult.cudaGraphExecUpdateErrorUnsupportedFunctionChange, + 'The update failed because the function of a kernel node changed in an\n' + 'unsupported way\n' + ) + + + cudaGraphExecUpdateErrorAttributesChanged = ( + cyruntime.cudaGraphExecUpdateResult.cudaGraphExecUpdateErrorAttributesChanged, + 'The update failed because the node attributes changed in a way that is not\n' + 'supported\n' + ) + +class cudaGraphKernelNodeField(_FastEnum): + """ + Specifies the field to update when performing multiple node updates + from the device + """ + + + cudaGraphKernelNodeFieldInvalid = ( + cyruntime.cudaGraphKernelNodeField.cudaGraphKernelNodeFieldInvalid, + 'Invalid field\n' + ) + + + cudaGraphKernelNodeFieldGridDim = ( + cyruntime.cudaGraphKernelNodeField.cudaGraphKernelNodeFieldGridDim, + 'Grid dimension update\n' + ) + + + cudaGraphKernelNodeFieldParam = ( + cyruntime.cudaGraphKernelNodeField.cudaGraphKernelNodeFieldParam, + 'Kernel parameter update\n' + ) + + + cudaGraphKernelNodeFieldEnabled = ( + cyruntime.cudaGraphKernelNodeField.cudaGraphKernelNodeFieldEnabled, + 'Node enable/disable\n' + ) + +class cudaGetDriverEntryPointFlags(_FastEnum): + """ + Flags to specify search options to be used with + :py:obj:`~.cudaGetDriverEntryPoint` For more details see + :py:obj:`~.cuGetProcAddress` + """ + + + cudaEnableDefault = ( + cyruntime.cudaGetDriverEntryPointFlags.cudaEnableDefault, + 'Default search mode for driver symbols.\n' + ) + + + cudaEnableLegacyStream = ( + cyruntime.cudaGetDriverEntryPointFlags.cudaEnableLegacyStream, + 'Search for legacy versions of driver symbols.\n' + ) + + + cudaEnablePerThreadDefaultStream = ( + cyruntime.cudaGetDriverEntryPointFlags.cudaEnablePerThreadDefaultStream, + 'Search for per-thread versions of driver symbols.\n' + ) + +class cudaDriverEntryPointQueryResult(_FastEnum): + """ + Enum for status from obtaining driver entry points, used with + :py:obj:`~.cudaApiGetDriverEntryPoint` + """ + + + cudaDriverEntryPointSuccess = ( + cyruntime.cudaDriverEntryPointQueryResult.cudaDriverEntryPointSuccess, + 'Search for symbol found a match\n' + ) + + + cudaDriverEntryPointSymbolNotFound = ( + cyruntime.cudaDriverEntryPointQueryResult.cudaDriverEntryPointSymbolNotFound, + 'Search for symbol was not found\n' + ) + + + cudaDriverEntryPointVersionNotSufficent = ( + cyruntime.cudaDriverEntryPointQueryResult.cudaDriverEntryPointVersionNotSufficent, + "Search for symbol was found but version wasn't great enough\n" + ) + +class cudaGraphDebugDotFlags(_FastEnum): + """ + CUDA Graph debug write options + """ + + + cudaGraphDebugDotFlagsVerbose = ( + cyruntime.cudaGraphDebugDotFlags.cudaGraphDebugDotFlagsVerbose, + 'Output all debug data as if every debug flag is enabled\n' + ) + + + cudaGraphDebugDotFlagsKernelNodeParams = ( + cyruntime.cudaGraphDebugDotFlags.cudaGraphDebugDotFlagsKernelNodeParams, + 'Adds :py:obj:`~.cudaKernelNodeParams` to output\n' + ) + + + cudaGraphDebugDotFlagsMemcpyNodeParams = ( + cyruntime.cudaGraphDebugDotFlags.cudaGraphDebugDotFlagsMemcpyNodeParams, + 'Adds :py:obj:`~.cudaMemcpy3DParms` to output\n' + ) + + + cudaGraphDebugDotFlagsMemsetNodeParams = ( + cyruntime.cudaGraphDebugDotFlags.cudaGraphDebugDotFlagsMemsetNodeParams, + 'Adds :py:obj:`~.cudaMemsetParams` to output\n' + ) + + + cudaGraphDebugDotFlagsHostNodeParams = ( + cyruntime.cudaGraphDebugDotFlags.cudaGraphDebugDotFlagsHostNodeParams, + 'Adds :py:obj:`~.cudaHostNodeParams` to output\n' + ) + + + cudaGraphDebugDotFlagsEventNodeParams = ( + cyruntime.cudaGraphDebugDotFlags.cudaGraphDebugDotFlagsEventNodeParams, + 'Adds :py:obj:`~.cudaEvent_t` handle from record and wait nodes to output\n' + ) + + + cudaGraphDebugDotFlagsExtSemasSignalNodeParams = ( + cyruntime.cudaGraphDebugDotFlags.cudaGraphDebugDotFlagsExtSemasSignalNodeParams, + 'Adds :py:obj:`~.cudaExternalSemaphoreSignalNodeParams` values to output\n' + ) + + + cudaGraphDebugDotFlagsExtSemasWaitNodeParams = ( + cyruntime.cudaGraphDebugDotFlags.cudaGraphDebugDotFlagsExtSemasWaitNodeParams, + 'Adds :py:obj:`~.cudaExternalSemaphoreWaitNodeParams` to output\n' + ) + + + cudaGraphDebugDotFlagsKernelNodeAttributes = ( + cyruntime.cudaGraphDebugDotFlags.cudaGraphDebugDotFlagsKernelNodeAttributes, + 'Adds cudaKernelNodeAttrID values to output\n' + ) + + + cudaGraphDebugDotFlagsHandles = ( + cyruntime.cudaGraphDebugDotFlags.cudaGraphDebugDotFlagsHandles, + 'Adds node handles and every kernel function handle to output\n' + ) + + + cudaGraphDebugDotFlagsConditionalNodeParams = ( + cyruntime.cudaGraphDebugDotFlags.cudaGraphDebugDotFlagsConditionalNodeParams, + 'Adds :py:obj:`~.cudaConditionalNodeParams` to output\n' + ) + +class cudaGraphInstantiateFlags(_FastEnum): + """ + Flags for instantiating a graph + """ + + + cudaGraphInstantiateFlagAutoFreeOnLaunch = ( + cyruntime.cudaGraphInstantiateFlags.cudaGraphInstantiateFlagAutoFreeOnLaunch, + 'Automatically free memory allocated in a graph before relaunching.\n' + ) + + + cudaGraphInstantiateFlagUpload = ( + cyruntime.cudaGraphInstantiateFlags.cudaGraphInstantiateFlagUpload, + 'Automatically upload the graph after instantiation. Only supported by\n' + ' :py:obj:`~.cudaGraphInstantiateWithParams`. The upload will be performed\n' + 'using the\n' + ' stream provided in `instantiateParams`.\n' + ) + + + cudaGraphInstantiateFlagDeviceLaunch = ( + cyruntime.cudaGraphInstantiateFlags.cudaGraphInstantiateFlagDeviceLaunch, + 'Instantiate the graph to be launchable from the device. This flag can only\n' + ' be used on platforms which support unified addressing. This flag cannot be\n' + ' used in conjunction with cudaGraphInstantiateFlagAutoFreeOnLaunch.\n' + ) + + + cudaGraphInstantiateFlagUseNodePriority = ( + cyruntime.cudaGraphInstantiateFlags.cudaGraphInstantiateFlagUseNodePriority, + 'Run the graph using the per-node priority attributes rather than the\n' + 'priority of the stream it is launched into.\n' + ) + +class cudaDeviceNumaConfig(_FastEnum): + """ + CUDA device NUMA config + """ + + + cudaDeviceNumaConfigNone = ( + cyruntime.cudaDeviceNumaConfig.cudaDeviceNumaConfigNone, + 'The GPU is not a NUMA node\n' + ) + + + cudaDeviceNumaConfigNumaNode = ( + cyruntime.cudaDeviceNumaConfig.cudaDeviceNumaConfigNumaNode, + 'The GPU is a NUMA node, cudaDevAttrNumaId contains its NUMA ID\n' + ) + +class cudaFabricOpStatusSource(_FastEnum): + """ + Fabric operation status source + """ + + + cudaFabricOpStatusSourceMbarrierV1 = ( + cyruntime.cudaFabricOpStatusSource.cudaFabricOpStatusSourceMbarrierV1, + '1B-aligned 1B-wide status from an mbarrier.layout::v1\n' + ) + + cudaFabricOpStatusSourceMax = cyruntime.cudaFabricOpStatusSource.cudaFabricOpStatusSourceMax + +class cudaFabricOpStatusInfo(_FastEnum): + """ + Fabric operation status info + """ + + cudaFabricOpStatusInfoSuccess = cyruntime.cudaFabricOpStatusInfo.cudaFabricOpStatusInfoSuccess + + cudaFabricOpStatusInfoLast = cyruntime.cudaFabricOpStatusInfo.cudaFabricOpStatusInfoLast + + cudaFabricOpStatusInfoMax = cyruntime.cudaFabricOpStatusInfo.cudaFabricOpStatusInfoMax + +class cudaSurfaceBoundaryMode(_FastEnum): + """ + CUDA Surface boundary modes + """ + + + cudaBoundaryModeZero = ( + cyruntime.cudaSurfaceBoundaryMode.cudaBoundaryModeZero, + 'Zero boundary mode\n' + ) + + + cudaBoundaryModeClamp = ( + cyruntime.cudaSurfaceBoundaryMode.cudaBoundaryModeClamp, + 'Clamp boundary mode\n' + ) + + + cudaBoundaryModeTrap = ( + cyruntime.cudaSurfaceBoundaryMode.cudaBoundaryModeTrap, + 'Trap boundary mode\n' + ) + +class cudaSurfaceFormatMode(_FastEnum): + """ + CUDA Surface format modes + """ + + + cudaFormatModeForced = ( + cyruntime.cudaSurfaceFormatMode.cudaFormatModeForced, + 'Forced format mode\n' + ) + + + cudaFormatModeAuto = ( + cyruntime.cudaSurfaceFormatMode.cudaFormatModeAuto, + 'Auto format mode\n' + ) + +class cudaTextureAddressMode(_FastEnum): + """ + CUDA texture address modes + """ + + + cudaAddressModeWrap = ( + cyruntime.cudaTextureAddressMode.cudaAddressModeWrap, + 'Wrapping address mode\n' + ) + + + cudaAddressModeClamp = ( + cyruntime.cudaTextureAddressMode.cudaAddressModeClamp, + 'Clamp to edge address mode\n' + ) + + + cudaAddressModeMirror = ( + cyruntime.cudaTextureAddressMode.cudaAddressModeMirror, + 'Mirror address mode\n' + ) + + + cudaAddressModeBorder = ( + cyruntime.cudaTextureAddressMode.cudaAddressModeBorder, + 'Border address mode\n' + ) + +class cudaTextureFilterMode(_FastEnum): + """ + CUDA texture filter modes + """ + + + cudaFilterModePoint = ( + cyruntime.cudaTextureFilterMode.cudaFilterModePoint, + 'Point filter mode\n' + ) + + + cudaFilterModeLinear = ( + cyruntime.cudaTextureFilterMode.cudaFilterModeLinear, + 'Linear filter mode\n' + ) + +class cudaTextureReadMode(_FastEnum): + """ + CUDA texture read modes + """ + + + cudaReadModeElementType = ( + cyruntime.cudaTextureReadMode.cudaReadModeElementType, + 'Read texture as specified element type\n' + ) + + + cudaReadModeNormalizedFloat = ( + cyruntime.cudaTextureReadMode.cudaReadModeNormalizedFloat, + 'Read texture as normalized float\n' + ) + +class cudaRoundMode(_FastEnum): + """ + + """ + + cudaRoundNearest = cyruntime.cudaRoundMode.cudaRoundNearest + + cudaRoundZero = cyruntime.cudaRoundMode.cudaRoundZero + + cudaRoundPosInf = cyruntime.cudaRoundMode.cudaRoundPosInf + + cudaRoundMinInf = cyruntime.cudaRoundMode.cudaRoundMinInf + +class cudaGLDeviceList(_FastEnum): + """ + CUDA devices corresponding to the current OpenGL context + """ + + + cudaGLDeviceListAll = ( + cyruntime.cudaGLDeviceList.cudaGLDeviceListAll, + 'The CUDA devices for all GPUs used by the current OpenGL context\n' + ) + + + cudaGLDeviceListCurrentFrame = ( + cyruntime.cudaGLDeviceList.cudaGLDeviceListCurrentFrame, + 'The CUDA devices for the GPUs used by the current OpenGL context in its\n' + 'currently rendering frame\n' + ) + + + cudaGLDeviceListNextFrame = ( + cyruntime.cudaGLDeviceList.cudaGLDeviceListNextFrame, + 'The CUDA devices for the GPUs to be used by the current OpenGL context in\n' + 'the next frame\n' + ) + +class cudaGLMapFlags(_FastEnum): + """ + CUDA GL Map Flags + """ + + + cudaGLMapFlagsNone = ( + cyruntime.cudaGLMapFlags.cudaGLMapFlagsNone, + 'Default; Assume resource can be read/written\n' + ) + + + cudaGLMapFlagsReadOnly = ( + cyruntime.cudaGLMapFlags.cudaGLMapFlagsReadOnly, + 'CUDA kernels will not write to this resource\n' + ) + + + cudaGLMapFlagsWriteDiscard = ( + cyruntime.cudaGLMapFlags.cudaGLMapFlagsWriteDiscard, + 'CUDA kernels will only write to and will not read from this resource\n' + ) + +cdef object _cudaError_t = cudaError_t +cdef object _cudaError_t_SUCCESS = cudaError_t.cudaSuccess + +class cudaStreamAttrID(_FastEnum): + """ + Launch attributes enum; used as id field of + :py:obj:`~.cudaLaunchAttribute` + """ + + + cudaLaunchAttributeIgnore = ( + cyruntime.cudaLaunchAttributeID.cudaLaunchAttributeIgnore, + 'Ignored entry, for convenient composition\n' + ) + + + cudaLaunchAttributeAccessPolicyWindow = ( + cyruntime.cudaLaunchAttributeID.cudaLaunchAttributeAccessPolicyWindow, + 'Valid for streams, graph nodes, launches. See\n' + ':py:obj:`~.cudaLaunchAttributeValue.accessPolicyWindow`.\n' + ) + + + cudaLaunchAttributeCooperative = ( + cyruntime.cudaLaunchAttributeID.cudaLaunchAttributeCooperative, + 'Valid for graph nodes, launches. See\n' + ':py:obj:`~.cudaLaunchAttributeValue.cooperative`.\n' + ) + + + cudaLaunchAttributeSynchronizationPolicy = ( + cyruntime.cudaLaunchAttributeID.cudaLaunchAttributeSynchronizationPolicy, + 'Valid for streams. See :py:obj:`~.cudaLaunchAttributeValue.syncPolicy`.\n' + ) + + + cudaLaunchAttributeClusterDimension = ( + cyruntime.cudaLaunchAttributeID.cudaLaunchAttributeClusterDimension, + 'Valid for graph nodes, launches. See\n' + ':py:obj:`~.cudaLaunchAttributeValue.clusterDim`.\n' + ) + + + cudaLaunchAttributeClusterSchedulingPolicyPreference = ( + cyruntime.cudaLaunchAttributeID.cudaLaunchAttributeClusterSchedulingPolicyPreference, + 'Valid for graph nodes, launches. See\n' + ':py:obj:`~.cudaLaunchAttributeValue.clusterSchedulingPolicyPreference`.\n' + ) + + + cudaLaunchAttributeProgrammaticStreamSerialization = ( + cyruntime.cudaLaunchAttributeID.cudaLaunchAttributeProgrammaticStreamSerialization, + 'Valid for launches. Setting\n' + ':py:obj:`~.cudaLaunchAttributeValue.programmaticStreamSerializationAllowed`\n' + 'to non-0 signals that the kernel will use programmatic means to resolve its\n' + 'stream dependency, so that the CUDA runtime should opportunistically allow\n' + "the grid's execution to overlap with the previous kernel in the stream, if\n" + 'that kernel requests the overlap. The dependent launches can choose to wait\n' + 'on the dependency using the programmatic sync\n' + '(cudaGridDependencySynchronize() or equivalent PTX instructions).\n' + ) + + + cudaLaunchAttributeProgrammaticEvent = ( + cyruntime.cudaLaunchAttributeID.cudaLaunchAttributeProgrammaticEvent, + 'Valid for launches. Set\n' + ':py:obj:`~.cudaLaunchAttributeValue.programmaticEvent` to record the event.\n' + 'Event recorded through this launch attribute is guaranteed to only trigger\n' + 'after all block in the associated kernel trigger the event. A block can\n' + 'trigger the event programmatically in a future CUDA release. A trigger can\n' + "also be inserted at the beginning of each block's execution if\n" + 'triggerAtBlockStart is set to non-0. The dependent launches can choose to\n' + 'wait on the dependency using the programmatic sync\n' + '(cudaGridDependencySynchronize() or equivalent PTX instructions). Note that\n' + 'dependents (including the CPU thread calling\n' + ':py:obj:`~.cudaEventSynchronize()`) are not guaranteed to observe the\n' + 'release precisely when it is released. For example,\n' + ':py:obj:`~.cudaEventSynchronize()` may only observe the event trigger long\n' + 'after the associated kernel has completed. This recording type is primarily\n' + 'meant for establishing programmatic dependency between device tasks. Note\n' + 'also this type of dependency allows, but does not guarantee, concurrent\n' + 'execution of tasks.\n' + ' The event supplied must not be an interprocess or interop event. The event\n' + 'must disable timing (i.e. must be created with the\n' + ':py:obj:`~.cudaEventDisableTiming` flag set).\n' + ) + + + cudaLaunchAttributePriority = ( + cyruntime.cudaLaunchAttributeID.cudaLaunchAttributePriority, + 'Valid for streams, graph nodes, launches. See\n' + ':py:obj:`~.cudaLaunchAttributeValue.priority`.\n' + ) + + + cudaLaunchAttributeMemSyncDomainMap = ( + cyruntime.cudaLaunchAttributeID.cudaLaunchAttributeMemSyncDomainMap, + 'Valid for streams, graph nodes, launches. See\n' + ':py:obj:`~.cudaLaunchAttributeValue.memSyncDomainMap`.\n' + ) + + + cudaLaunchAttributeMemSyncDomain = ( + cyruntime.cudaLaunchAttributeID.cudaLaunchAttributeMemSyncDomain, + 'Valid for streams, graph nodes, launches. See\n' + ':py:obj:`~.cudaLaunchAttributeValue.memSyncDomain`.\n' + ) + + + cudaLaunchAttributePreferredClusterDimension = ( + cyruntime.cudaLaunchAttributeID.cudaLaunchAttributePreferredClusterDimension, + 'Valid for graph nodes and launches. Set\n' + ':py:obj:`~.cudaLaunchAttributeValue.preferredClusterDim` to allow the\n' + 'kernel launch to specify a preferred substitute cluster dimension. Blocks\n' + 'may be grouped according to either the dimensions specified with this\n' + 'attribute (grouped into a "preferred substitute cluster"), or the one\n' + 'specified with :py:obj:`~.cudaLaunchAttributeClusterDimension` attribute\n' + '(grouped into a "regular cluster"). The cluster dimensions of a "preferred\n' + 'substitute cluster" shall be an integer multiple greater than zero of the\n' + 'regular cluster dimensions. The device will attempt - on a best-effort\n' + 'basis - to group thread blocks into preferred clusters over grouping them\n' + 'into regular clusters. When it deems necessary (primarily when the device\n' + 'temporarily runs out of physical resources to launch the larger preferred\n' + 'clusters), the device may switch to launch the regular clusters instead to\n' + 'attempt to utilize as much of the physical device resources as possible.\n' + ' Each type of cluster will have its enumeration / coordinate setup as if\n' + 'the grid consists solely of its type of cluster. For example, if the\n' + 'preferred substitute cluster dimensions double the regular cluster\n' + 'dimensions, there might be simultaneously a regular cluster indexed at\n' + '(1,0,0), and a preferred cluster indexed at (1,0,0). In this example, the\n' + 'preferred substitute cluster (1,0,0) replaces regular clusters (2,0,0) and\n' + '(3,0,0) and groups their blocks.\n' + ' This attribute will only take effect when a regular cluster dimension has\n' + 'been specified. The preferred substitute cluster dimension must be an\n' + 'integer multiple greater than zero of the regular cluster dimension and\n' + 'must divide the grid. It must also be no more than `maxBlocksPerCluster`,\n' + "if it is set in the kernel's `__launch_bounds__`. Otherwise it must be less\n" + 'than the maximum value the driver can support. Otherwise, setting this\n' + 'attribute to a value physically unable to fit on any particular device is\n' + 'permitted.\n' + ) + + + cudaLaunchAttributeLaunchCompletionEvent = ( + cyruntime.cudaLaunchAttributeID.cudaLaunchAttributeLaunchCompletionEvent, + 'Valid for launches. Set\n' + ':py:obj:`~.cudaLaunchAttributeValue.launchCompletionEvent` to record the\n' + 'event.\n' + ' Nominally, the event is triggered once all blocks of the kernel have begun\n' + 'execution. Currently this is a best effort. If a kernel B has a launch\n' + 'completion dependency on a kernel A, B may wait until A is complete.\n' + 'Alternatively, blocks of B may begin before all blocks of A have begun, for\n' + 'example if B can claim execution resources unavailable to A (e.g. they run\n' + 'on different GPUs) or if B is a higher priority than A. Exercise caution if\n' + 'such an ordering inversion could lead to deadlock.\n' + ' A launch completion event is nominally similar to a programmatic event\n' + 'with `triggerAtBlockStart` set except that it is not visible to\n' + '`cudaGridDependencySynchronize()` and can be used with compute capability\n' + 'less than 9.0.\n' + ' The event supplied must not be an interprocess or interop event. The event\n' + 'must disable timing (i.e. must be created with the\n' + ':py:obj:`~.cudaEventDisableTiming` flag set).\n' + ) + + + cudaLaunchAttributeDeviceUpdatableKernelNode = ( + cyruntime.cudaLaunchAttributeID.cudaLaunchAttributeDeviceUpdatableKernelNode, + 'Valid for graph nodes, launches. This attribute is graphs-only, and passing\n' + 'it to a launch in a non-capturing stream will result in an error.\n' + ' :cudaLaunchAttributeValue::deviceUpdatableKernelNode::deviceUpdatable can\n' + 'only be set to 0 or 1. Setting the field to 1 indicates that the\n' + 'corresponding kernel node should be device-updatable. On success, a handle\n' + 'will be returned via\n' + ':py:obj:`~.cudaLaunchAttributeValue.deviceUpdatableKernelNode.devNode`\n' + 'which can be passed to the various device-side update functions to update\n' + "the node's kernel parameters from within another kernel. For more\n" + 'information on the types of device updates that can be made, as well as the\n' + 'relevant limitations thereof, see\n' + ':py:obj:`~.cudaGraphKernelNodeUpdatesApply`.\n' + ' Nodes which are device-updatable have additional restrictions compared to\n' + 'regular kernel nodes. Firstly, device-updatable nodes cannot be removed\n' + 'from their graph via :py:obj:`~.cudaGraphDestroyNode`. Additionally, once\n' + 'opted-in to this functionality, a node cannot opt out, and any attempt to\n' + 'set the deviceUpdatable attribute to 0 will result in an error. Device-\n' + 'updatable kernel nodes also cannot have their attributes copied to/from\n' + 'another kernel node via :py:obj:`~.cudaGraphKernelNodeCopyAttributes`.\n' + 'Graphs containing one or more device-updatable nodes also do not allow\n' + 'multiple instantiation, and neither the graph nor its instantiated version\n' + 'can be passed to :py:obj:`~.cudaGraphExecUpdate`.\n' + ' If a graph contains device-updatable nodes and updates those nodes from\n' + 'the device from within the graph, the graph must be uploaded with\n' + ':py:obj:`~.cuGraphUpload` before it is launched. For such a graph, if host-\n' + 'side executable graph updates are made to the device-updatable nodes, the\n' + 'graph must be uploaded before it is launched again.\n' + ) + + + cudaLaunchAttributePreferredSharedMemoryCarveout = ( + cyruntime.cudaLaunchAttributeID.cudaLaunchAttributePreferredSharedMemoryCarveout, + 'Valid for launches. On devices where the L1 cache and shared memory use the\n' + 'same hardware resources, setting\n' + ':py:obj:`~.cudaLaunchAttributeValue.sharedMemCarveout` to a percentage\n' + 'between 0-100 signals sets the shared memory carveout preference in percent\n' + 'of the total shared memory for that kernel launch. This attribute takes\n' + 'precedence over :py:obj:`~.cudaFuncAttributePreferredSharedMemoryCarveout`.\n' + 'This is only a hint, and the driver can choose a different configuration if\n' + 'required for the launch.\n' + ) + + + cudaLaunchAttributeNvlinkUtilCentricScheduling = ( + cyruntime.cudaLaunchAttributeID.cudaLaunchAttributeNvlinkUtilCentricScheduling, + 'Valid for streams, graph nodes, launches. This attribute is a hint to the\n' + 'CUDA runtime that the launch should attempt to make the kernel maximize its\n' + 'NVLINK utilization.\n' + ' When possible to honor this hint, CUDA will assume each block in the grid\n' + 'launch will carry out an even amount of NVLINK traffic, and make a best-\n' + 'effort attempt to adjust the kernel launch based on that assumption.\n' + ' This attribute is a hint only. CUDA makes no functional or performance\n' + 'guarantee. Its applicability can be affected by many different factors,\n' + "including driver version (i.e. CUDA doesn't guarantee the performance\n" + 'characteristics will be maintained between driver versions or a driver\n' + 'update could alter or regress previously observed perf characteristics.) It\n' + "also doesn't guarantee a successful result, i.e. applying the attribute may\n" + 'not improve the performance of either the targeted kernel or the\n' + 'encapsulating application.\n' + ' Valid values for\n' + ':py:obj:`~.cudaLaunchAttributeValue.nvlinkUtilCentricScheduling` are 0\n' + '(disabled) and 1 (enabled).\n' + ) + + + cudaLaunchAttributePortableClusterSizeMode = ( + cyruntime.cudaLaunchAttributeID.cudaLaunchAttributePortableClusterSizeMode, + 'Valid for graph nodes, launches. This indicates whether the kernel launch\n' + 'is allowed to use a non-portable cluster size. Valid values for\n' + ':py:obj:`~.cudaLaunchAttributeValue.portableClusterSizeMode` are values for\n' + ':py:obj:`~.cudaLaunchAttributePortableClusterMode` Any other value will\n' + 'return :py:obj:`~.cudaErrorInvalidValue`\n' + ) + + + cudaLaunchAttributeSharedMemoryMode = ( + cyruntime.cudaLaunchAttributeID.cudaLaunchAttributeSharedMemoryMode, + 'Valid for graph nodes, launches. This indicates that the kernel launch is\n' + 'allowed to use a non-portable shared memory mode.\n' + ) + +class cudaKernelNodeAttrID(_FastEnum): + """ + Launch attributes enum; used as id field of + :py:obj:`~.cudaLaunchAttribute` + """ + + + cudaLaunchAttributeIgnore = ( + cyruntime.cudaLaunchAttributeID.cudaLaunchAttributeIgnore, + 'Ignored entry, for convenient composition\n' + ) + + + cudaLaunchAttributeAccessPolicyWindow = ( + cyruntime.cudaLaunchAttributeID.cudaLaunchAttributeAccessPolicyWindow, + 'Valid for streams, graph nodes, launches. See\n' + ':py:obj:`~.cudaLaunchAttributeValue.accessPolicyWindow`.\n' + ) + + + cudaLaunchAttributeCooperative = ( + cyruntime.cudaLaunchAttributeID.cudaLaunchAttributeCooperative, + 'Valid for graph nodes, launches. See\n' + ':py:obj:`~.cudaLaunchAttributeValue.cooperative`.\n' + ) + + + cudaLaunchAttributeSynchronizationPolicy = ( + cyruntime.cudaLaunchAttributeID.cudaLaunchAttributeSynchronizationPolicy, + 'Valid for streams. See :py:obj:`~.cudaLaunchAttributeValue.syncPolicy`.\n' + ) + + + cudaLaunchAttributeClusterDimension = ( + cyruntime.cudaLaunchAttributeID.cudaLaunchAttributeClusterDimension, + 'Valid for graph nodes, launches. See\n' + ':py:obj:`~.cudaLaunchAttributeValue.clusterDim`.\n' + ) + + + cudaLaunchAttributeClusterSchedulingPolicyPreference = ( + cyruntime.cudaLaunchAttributeID.cudaLaunchAttributeClusterSchedulingPolicyPreference, + 'Valid for graph nodes, launches. See\n' + ':py:obj:`~.cudaLaunchAttributeValue.clusterSchedulingPolicyPreference`.\n' + ) + + + cudaLaunchAttributeProgrammaticStreamSerialization = ( + cyruntime.cudaLaunchAttributeID.cudaLaunchAttributeProgrammaticStreamSerialization, + 'Valid for launches. Setting\n' + ':py:obj:`~.cudaLaunchAttributeValue.programmaticStreamSerializationAllowed`\n' + 'to non-0 signals that the kernel will use programmatic means to resolve its\n' + 'stream dependency, so that the CUDA runtime should opportunistically allow\n' + "the grid's execution to overlap with the previous kernel in the stream, if\n" + 'that kernel requests the overlap. The dependent launches can choose to wait\n' + 'on the dependency using the programmatic sync\n' + '(cudaGridDependencySynchronize() or equivalent PTX instructions).\n' + ) + + + cudaLaunchAttributeProgrammaticEvent = ( + cyruntime.cudaLaunchAttributeID.cudaLaunchAttributeProgrammaticEvent, + 'Valid for launches. Set\n' + ':py:obj:`~.cudaLaunchAttributeValue.programmaticEvent` to record the event.\n' + 'Event recorded through this launch attribute is guaranteed to only trigger\n' + 'after all block in the associated kernel trigger the event. A block can\n' + 'trigger the event programmatically in a future CUDA release. A trigger can\n' + "also be inserted at the beginning of each block's execution if\n" + 'triggerAtBlockStart is set to non-0. The dependent launches can choose to\n' + 'wait on the dependency using the programmatic sync\n' + '(cudaGridDependencySynchronize() or equivalent PTX instructions). Note that\n' + 'dependents (including the CPU thread calling\n' + ':py:obj:`~.cudaEventSynchronize()`) are not guaranteed to observe the\n' + 'release precisely when it is released. For example,\n' + ':py:obj:`~.cudaEventSynchronize()` may only observe the event trigger long\n' + 'after the associated kernel has completed. This recording type is primarily\n' + 'meant for establishing programmatic dependency between device tasks. Note\n' + 'also this type of dependency allows, but does not guarantee, concurrent\n' + 'execution of tasks.\n' + ' The event supplied must not be an interprocess or interop event. The event\n' + 'must disable timing (i.e. must be created with the\n' + ':py:obj:`~.cudaEventDisableTiming` flag set).\n' + ) + + + cudaLaunchAttributePriority = ( + cyruntime.cudaLaunchAttributeID.cudaLaunchAttributePriority, + 'Valid for streams, graph nodes, launches. See\n' + ':py:obj:`~.cudaLaunchAttributeValue.priority`.\n' + ) + + + cudaLaunchAttributeMemSyncDomainMap = ( + cyruntime.cudaLaunchAttributeID.cudaLaunchAttributeMemSyncDomainMap, + 'Valid for streams, graph nodes, launches. See\n' + ':py:obj:`~.cudaLaunchAttributeValue.memSyncDomainMap`.\n' + ) + + + cudaLaunchAttributeMemSyncDomain = ( + cyruntime.cudaLaunchAttributeID.cudaLaunchAttributeMemSyncDomain, + 'Valid for streams, graph nodes, launches. See\n' + ':py:obj:`~.cudaLaunchAttributeValue.memSyncDomain`.\n' + ) + + + cudaLaunchAttributePreferredClusterDimension = ( + cyruntime.cudaLaunchAttributeID.cudaLaunchAttributePreferredClusterDimension, + 'Valid for graph nodes and launches. Set\n' + ':py:obj:`~.cudaLaunchAttributeValue.preferredClusterDim` to allow the\n' + 'kernel launch to specify a preferred substitute cluster dimension. Blocks\n' + 'may be grouped according to either the dimensions specified with this\n' + 'attribute (grouped into a "preferred substitute cluster"), or the one\n' + 'specified with :py:obj:`~.cudaLaunchAttributeClusterDimension` attribute\n' + '(grouped into a "regular cluster"). The cluster dimensions of a "preferred\n' + 'substitute cluster" shall be an integer multiple greater than zero of the\n' + 'regular cluster dimensions. The device will attempt - on a best-effort\n' + 'basis - to group thread blocks into preferred clusters over grouping them\n' + 'into regular clusters. When it deems necessary (primarily when the device\n' + 'temporarily runs out of physical resources to launch the larger preferred\n' + 'clusters), the device may switch to launch the regular clusters instead to\n' + 'attempt to utilize as much of the physical device resources as possible.\n' + ' Each type of cluster will have its enumeration / coordinate setup as if\n' + 'the grid consists solely of its type of cluster. For example, if the\n' + 'preferred substitute cluster dimensions double the regular cluster\n' + 'dimensions, there might be simultaneously a regular cluster indexed at\n' + '(1,0,0), and a preferred cluster indexed at (1,0,0). In this example, the\n' + 'preferred substitute cluster (1,0,0) replaces regular clusters (2,0,0) and\n' + '(3,0,0) and groups their blocks.\n' + ' This attribute will only take effect when a regular cluster dimension has\n' + 'been specified. The preferred substitute cluster dimension must be an\n' + 'integer multiple greater than zero of the regular cluster dimension and\n' + 'must divide the grid. It must also be no more than `maxBlocksPerCluster`,\n' + "if it is set in the kernel's `__launch_bounds__`. Otherwise it must be less\n" + 'than the maximum value the driver can support. Otherwise, setting this\n' + 'attribute to a value physically unable to fit on any particular device is\n' + 'permitted.\n' + ) + + + cudaLaunchAttributeLaunchCompletionEvent = ( + cyruntime.cudaLaunchAttributeID.cudaLaunchAttributeLaunchCompletionEvent, + 'Valid for launches. Set\n' + ':py:obj:`~.cudaLaunchAttributeValue.launchCompletionEvent` to record the\n' + 'event.\n' + ' Nominally, the event is triggered once all blocks of the kernel have begun\n' + 'execution. Currently this is a best effort. If a kernel B has a launch\n' + 'completion dependency on a kernel A, B may wait until A is complete.\n' + 'Alternatively, blocks of B may begin before all blocks of A have begun, for\n' + 'example if B can claim execution resources unavailable to A (e.g. they run\n' + 'on different GPUs) or if B is a higher priority than A. Exercise caution if\n' + 'such an ordering inversion could lead to deadlock.\n' + ' A launch completion event is nominally similar to a programmatic event\n' + 'with `triggerAtBlockStart` set except that it is not visible to\n' + '`cudaGridDependencySynchronize()` and can be used with compute capability\n' + 'less than 9.0.\n' + ' The event supplied must not be an interprocess or interop event. The event\n' + 'must disable timing (i.e. must be created with the\n' + ':py:obj:`~.cudaEventDisableTiming` flag set).\n' + ) + + + cudaLaunchAttributeDeviceUpdatableKernelNode = ( + cyruntime.cudaLaunchAttributeID.cudaLaunchAttributeDeviceUpdatableKernelNode, + 'Valid for graph nodes, launches. This attribute is graphs-only, and passing\n' + 'it to a launch in a non-capturing stream will result in an error.\n' + ' :cudaLaunchAttributeValue::deviceUpdatableKernelNode::deviceUpdatable can\n' + 'only be set to 0 or 1. Setting the field to 1 indicates that the\n' + 'corresponding kernel node should be device-updatable. On success, a handle\n' + 'will be returned via\n' + ':py:obj:`~.cudaLaunchAttributeValue.deviceUpdatableKernelNode.devNode`\n' + 'which can be passed to the various device-side update functions to update\n' + "the node's kernel parameters from within another kernel. For more\n" + 'information on the types of device updates that can be made, as well as the\n' + 'relevant limitations thereof, see\n' + ':py:obj:`~.cudaGraphKernelNodeUpdatesApply`.\n' + ' Nodes which are device-updatable have additional restrictions compared to\n' + 'regular kernel nodes. Firstly, device-updatable nodes cannot be removed\n' + 'from their graph via :py:obj:`~.cudaGraphDestroyNode`. Additionally, once\n' + 'opted-in to this functionality, a node cannot opt out, and any attempt to\n' + 'set the deviceUpdatable attribute to 0 will result in an error. Device-\n' + 'updatable kernel nodes also cannot have their attributes copied to/from\n' + 'another kernel node via :py:obj:`~.cudaGraphKernelNodeCopyAttributes`.\n' + 'Graphs containing one or more device-updatable nodes also do not allow\n' + 'multiple instantiation, and neither the graph nor its instantiated version\n' + 'can be passed to :py:obj:`~.cudaGraphExecUpdate`.\n' + ' If a graph contains device-updatable nodes and updates those nodes from\n' + 'the device from within the graph, the graph must be uploaded with\n' + ':py:obj:`~.cuGraphUpload` before it is launched. For such a graph, if host-\n' + 'side executable graph updates are made to the device-updatable nodes, the\n' + 'graph must be uploaded before it is launched again.\n' + ) + + + cudaLaunchAttributePreferredSharedMemoryCarveout = ( + cyruntime.cudaLaunchAttributeID.cudaLaunchAttributePreferredSharedMemoryCarveout, + 'Valid for launches. On devices where the L1 cache and shared memory use the\n' + 'same hardware resources, setting\n' + ':py:obj:`~.cudaLaunchAttributeValue.sharedMemCarveout` to a percentage\n' + 'between 0-100 signals sets the shared memory carveout preference in percent\n' + 'of the total shared memory for that kernel launch. This attribute takes\n' + 'precedence over :py:obj:`~.cudaFuncAttributePreferredSharedMemoryCarveout`.\n' + 'This is only a hint, and the driver can choose a different configuration if\n' + 'required for the launch.\n' + ) + + + cudaLaunchAttributeNvlinkUtilCentricScheduling = ( + cyruntime.cudaLaunchAttributeID.cudaLaunchAttributeNvlinkUtilCentricScheduling, + 'Valid for streams, graph nodes, launches. This attribute is a hint to the\n' + 'CUDA runtime that the launch should attempt to make the kernel maximize its\n' + 'NVLINK utilization.\n' + ' When possible to honor this hint, CUDA will assume each block in the grid\n' + 'launch will carry out an even amount of NVLINK traffic, and make a best-\n' + 'effort attempt to adjust the kernel launch based on that assumption.\n' + ' This attribute is a hint only. CUDA makes no functional or performance\n' + 'guarantee. Its applicability can be affected by many different factors,\n' + "including driver version (i.e. CUDA doesn't guarantee the performance\n" + 'characteristics will be maintained between driver versions or a driver\n' + 'update could alter or regress previously observed perf characteristics.) It\n' + "also doesn't guarantee a successful result, i.e. applying the attribute may\n" + 'not improve the performance of either the targeted kernel or the\n' + 'encapsulating application.\n' + ' Valid values for\n' + ':py:obj:`~.cudaLaunchAttributeValue.nvlinkUtilCentricScheduling` are 0\n' + '(disabled) and 1 (enabled).\n' + ) + + + cudaLaunchAttributePortableClusterSizeMode = ( + cyruntime.cudaLaunchAttributeID.cudaLaunchAttributePortableClusterSizeMode, + 'Valid for graph nodes, launches. This indicates whether the kernel launch\n' + 'is allowed to use a non-portable cluster size. Valid values for\n' + ':py:obj:`~.cudaLaunchAttributeValue.portableClusterSizeMode` are values for\n' + ':py:obj:`~.cudaLaunchAttributePortableClusterMode` Any other value will\n' + 'return :py:obj:`~.cudaErrorInvalidValue`\n' + ) + + + cudaLaunchAttributeSharedMemoryMode = ( + cyruntime.cudaLaunchAttributeID.cudaLaunchAttributeSharedMemoryMode, + 'Valid for graph nodes, launches. This indicates that the kernel launch is\n' + 'allowed to use a non-portable shared memory mode.\n' + ) + +cdef class cudaDevResourceDesc_t: + """ + + An opaque descriptor handle. The descriptor encapsulates multiple created and configured resources. Created via ::cudaDeviceResourceGenerateDesc + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __eq__(self, other): + if not isinstance(other, cudaDevResourceDesc_t): + return False + return self._pvt_ptr[0] == (other)._pvt_ptr[0] + def __hash__(self): + return hash((self._pvt_ptr[0])) + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class cudaExecutionContext_t: + """ + + An opaque handle to a CUDA execution context. It represents an execution context created via CUDA Runtime APIs such as cudaGreenCtxCreate. + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __eq__(self, other): + if not isinstance(other, cudaExecutionContext_t): + return False + return self._pvt_ptr[0] == (other)._pvt_ptr[0] + def __hash__(self): + return hash((self._pvt_ptr[0])) + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class cudaArray_t: + """ + + CUDA array + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __eq__(self, other): + if not isinstance(other, cudaArray_t): + return False + return self._pvt_ptr[0] == (other)._pvt_ptr[0] + def __hash__(self): + return hash((self._pvt_ptr[0])) + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class cudaArray_const_t: + """ + + CUDA array (as source copy argument) + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __eq__(self, other): + if not isinstance(other, cudaArray_const_t): + return False + return self._pvt_ptr[0] == (other)._pvt_ptr[0] + def __hash__(self): + return hash((self._pvt_ptr[0])) + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class cudaMipmappedArray_t: + """ + + CUDA mipmapped array + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __eq__(self, other): + if not isinstance(other, cudaMipmappedArray_t): + return False + return self._pvt_ptr[0] == (other)._pvt_ptr[0] + def __hash__(self): + return hash((self._pvt_ptr[0])) + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class cudaMipmappedArray_const_t: + """ + + CUDA mipmapped array (as source argument) + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __eq__(self, other): + if not isinstance(other, cudaMipmappedArray_const_t): + return False + return self._pvt_ptr[0] == (other)._pvt_ptr[0] + def __hash__(self): + return hash((self._pvt_ptr[0])) + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class cudaGraphicsResource_t: + """ + + CUDA graphics resource types + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __eq__(self, other): + if not isinstance(other, cudaGraphicsResource_t): + return False + return self._pvt_ptr[0] == (other)._pvt_ptr[0] + def __hash__(self): + return hash((self._pvt_ptr[0])) + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class cudaExternalMemory_t: + """ + + CUDA external memory + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __eq__(self, other): + if not isinstance(other, cudaExternalMemory_t): + return False + return self._pvt_ptr[0] == (other)._pvt_ptr[0] + def __hash__(self): + return hash((self._pvt_ptr[0])) + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class cudaExternalSemaphore_t: + """ + + CUDA external semaphore + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __eq__(self, other): + if not isinstance(other, cudaExternalSemaphore_t): + return False + return self._pvt_ptr[0] == (other)._pvt_ptr[0] + def __hash__(self): + return hash((self._pvt_ptr[0])) + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class cudaKernel_t: + """ + + CUDA kernel + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __eq__(self, other): + if not isinstance(other, cudaKernel_t): + return False + return self._pvt_ptr[0] == (other)._pvt_ptr[0] + def __hash__(self): + return hash((self._pvt_ptr[0])) + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class cudaLibrary_t: + """ + + CUDA library + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __eq__(self, other): + if not isinstance(other, cudaLibrary_t): + return False + return self._pvt_ptr[0] == (other)._pvt_ptr[0] + def __hash__(self): + return hash((self._pvt_ptr[0])) + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class cudaGraphDeviceNode_t: + """ + + CUDA device node handle for device-side node update + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __eq__(self, other): + if not isinstance(other, cudaGraphDeviceNode_t): + return False + return self._pvt_ptr[0] == (other)._pvt_ptr[0] + def __hash__(self): + return hash((self._pvt_ptr[0])) + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class cudaAsyncCallbackHandle_t: + """ + + CUDA async callback handle + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __eq__(self, other): + if not isinstance(other, cudaAsyncCallbackHandle_t): + return False + return self._pvt_ptr[0] == (other)._pvt_ptr[0] + def __hash__(self): + return hash((self._pvt_ptr[0])) + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class cudaLogsCallbackHandle: + """ + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __eq__(self, other): + if not isinstance(other, cudaLogsCallbackHandle): + return False + return self._pvt_ptr[0] == (other)._pvt_ptr[0] + def __hash__(self): + return hash((self._pvt_ptr[0])) + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class EGLImageKHR: + """ + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __eq__(self, other): + if not isinstance(other, EGLImageKHR): + return False + return self._pvt_ptr[0] == (other)._pvt_ptr[0] + def __hash__(self): + return hash((self._pvt_ptr[0])) + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class EGLStreamKHR: + """ + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __eq__(self, other): + if not isinstance(other, EGLStreamKHR): + return False + return self._pvt_ptr[0] == (other)._pvt_ptr[0] + def __hash__(self): + return hash((self._pvt_ptr[0])) + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class EGLSyncKHR: + """ + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __eq__(self, other): + if not isinstance(other, EGLSyncKHR): + return False + return self._pvt_ptr[0] == (other)._pvt_ptr[0] + def __hash__(self): + return hash((self._pvt_ptr[0])) + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class cudaHostFn_t: + """ + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class cudaAsyncCallback: + """ + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class cudaStreamCallback_t: + """ + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class cudaGraphRecaptureCallback_t: + """ + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class cudaLogsCallback_t: + """ + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, void_ptr init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + self._pvt_ptr[0] = init_value + else: + self._pvt_ptr = _ptr + def __init__(self, *args, **kwargs): + pass + def __repr__(self): + return '' + def __index__(self): + return self.__int__() + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr + +cdef class dim3: + """ + Attributes + ---------- + + x : unsigned int + + + + y : unsigned int + + + + z : unsigned int + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass + def __dealloc__(self): + pass + def getPtr(self): + return self._pvt_ptr + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['x : ' + str(self.x)] + except ValueError: + str_list += ['x : '] + + + try: + str_list += ['y : ' + str(self.y)] + except ValueError: + str_list += ['y : '] + + + try: + str_list += ['z : ' + str(self.z)] + except ValueError: + str_list += ['z : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def x(self): + return self._pvt_ptr[0].x + @x.setter + def x(self, unsigned int x): + self._pvt_ptr[0].x = x + + + @property + def y(self): + return self._pvt_ptr[0].y + @y.setter + def y(self, unsigned int y): + self._pvt_ptr[0].y = y + + + @property + def z(self): + return self._pvt_ptr[0].z + @z.setter + def z(self, unsigned int z): + self._pvt_ptr[0].z = z + + +cdef class cudaChannelFormatDesc: + """ + CUDA Channel format descriptor + + Attributes + ---------- + + x : int + x + + + y : int + y + + + z : int + z + + + w : int + w + + + f : cudaChannelFormatKind + Channel format kind + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass + def __dealloc__(self): + pass + def getPtr(self): + return self._pvt_ptr + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['x : ' + str(self.x)] + except ValueError: + str_list += ['x : '] + + + try: + str_list += ['y : ' + str(self.y)] + except ValueError: + str_list += ['y : '] + + + try: + str_list += ['z : ' + str(self.z)] + except ValueError: + str_list += ['z : '] + + + try: + str_list += ['w : ' + str(self.w)] + except ValueError: + str_list += ['w : '] + + + try: + str_list += ['f : ' + str(self.f)] + except ValueError: + str_list += ['f : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def x(self): + return self._pvt_ptr[0].x + @x.setter + def x(self, int x): + self._pvt_ptr[0].x = x + + + @property + def y(self): + return self._pvt_ptr[0].y + @y.setter + def y(self, int y): + self._pvt_ptr[0].y = y + + + @property + def z(self): + return self._pvt_ptr[0].z + @z.setter + def z(self, int z): + self._pvt_ptr[0].z = z + + + @property + def w(self): + return self._pvt_ptr[0].w + @w.setter + def w(self, int w): + self._pvt_ptr[0].w = w + + + @property + def f(self): + return cudaChannelFormatKind(self._pvt_ptr[0].f) + @f.setter + def f(self, f not None : cudaChannelFormatKind): + self._pvt_ptr[0].f = int(f) + + +cdef class anon_struct0: + """ + Attributes + ---------- + + width : unsigned int + + + + height : unsigned int + + + + depth : unsigned int + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr): + self._pvt_ptr = _ptr + + def __init__(self, void_ptr _ptr): + pass + def __dealloc__(self): + pass + def getPtr(self): + return &self._pvt_ptr[0].tileExtent + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['width : ' + str(self.width)] + except ValueError: + str_list += ['width : '] + + + try: + str_list += ['height : ' + str(self.height)] + except ValueError: + str_list += ['height : '] + + + try: + str_list += ['depth : ' + str(self.depth)] + except ValueError: + str_list += ['depth : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def width(self): + return self._pvt_ptr[0].tileExtent.width + @width.setter + def width(self, unsigned int width): + self._pvt_ptr[0].tileExtent.width = width + + + @property + def height(self): + return self._pvt_ptr[0].tileExtent.height + @height.setter + def height(self, unsigned int height): + self._pvt_ptr[0].tileExtent.height = height + + + @property + def depth(self): + return self._pvt_ptr[0].tileExtent.depth + @depth.setter + def depth(self, unsigned int depth): + self._pvt_ptr[0].tileExtent.depth = depth + + +cdef class cudaArraySparseProperties: + """ + Sparse CUDA array and CUDA mipmapped array properties + + Attributes + ---------- + + tileExtent : anon_struct0 + + + + miptailFirstLevel : unsigned int + First mip level at which the mip tail begins + + + miptailSize : unsigned long long + Total size of the mip tail. + + + flags : unsigned int + Flags will either be zero or cudaArraySparsePropertiesSingleMipTail + + + reserved : list[unsigned int] + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass + + self._tileExtent = anon_struct0(_ptr=self._pvt_ptr) + + def __dealloc__(self): + pass + def getPtr(self): + return self._pvt_ptr + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['tileExtent :\n' + '\n'.join([' ' + line for line in str(self.tileExtent).splitlines()])] + except ValueError: + str_list += ['tileExtent : '] + + + try: + str_list += ['miptailFirstLevel : ' + str(self.miptailFirstLevel)] + except ValueError: + str_list += ['miptailFirstLevel : '] + + + try: + str_list += ['miptailSize : ' + str(self.miptailSize)] + except ValueError: + str_list += ['miptailSize : '] + + + try: + str_list += ['flags : ' + str(self.flags)] + except ValueError: + str_list += ['flags : '] + + + try: + str_list += ['reserved : ' + str(self.reserved)] + except ValueError: + str_list += ['reserved : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def tileExtent(self): + return self._tileExtent + @tileExtent.setter + def tileExtent(self, tileExtent not None : anon_struct0): + string.memcpy(&self._pvt_ptr[0].tileExtent, tileExtent.getPtr(), sizeof(self._pvt_ptr[0].tileExtent)) + + + @property + def miptailFirstLevel(self): + return self._pvt_ptr[0].miptailFirstLevel + @miptailFirstLevel.setter + def miptailFirstLevel(self, unsigned int miptailFirstLevel): + self._pvt_ptr[0].miptailFirstLevel = miptailFirstLevel + + + @property + def miptailSize(self): + return self._pvt_ptr[0].miptailSize + @miptailSize.setter + def miptailSize(self, unsigned long long miptailSize): + self._pvt_ptr[0].miptailSize = miptailSize + + + @property + def flags(self): + return self._pvt_ptr[0].flags + @flags.setter + def flags(self, unsigned int flags): + self._pvt_ptr[0].flags = flags + + + @property + def reserved(self): + return self._pvt_ptr[0].reserved + @reserved.setter + def reserved(self, reserved): + self._pvt_ptr[0].reserved = reserved + + +cdef class cudaArrayMemoryRequirements: + """ + CUDA array and CUDA mipmapped array memory requirements + + Attributes + ---------- + + size : size_t + Total size of the array. + + + alignment : size_t + Alignment necessary for mapping the array. + + + reserved : list[unsigned int] + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass + def __dealloc__(self): + pass + def getPtr(self): + return self._pvt_ptr + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['size : ' + str(self.size)] + except ValueError: + str_list += ['size : '] + + + try: + str_list += ['alignment : ' + str(self.alignment)] + except ValueError: + str_list += ['alignment : '] + + + try: + str_list += ['reserved : ' + str(self.reserved)] + except ValueError: + str_list += ['reserved : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def size(self): + return self._pvt_ptr[0].size + @size.setter + def size(self, size_t size): + self._pvt_ptr[0].size = size + + + @property + def alignment(self): + return self._pvt_ptr[0].alignment + @alignment.setter + def alignment(self, size_t alignment): + self._pvt_ptr[0].alignment = alignment + + + @property + def reserved(self): + return self._pvt_ptr[0].reserved + @reserved.setter + def reserved(self, reserved): + self._pvt_ptr[0].reserved = reserved + + +cdef class cudaPitchedPtr: + """ + CUDA Pitched memory pointer make_cudaPitchedPtr + + Attributes + ---------- + + ptr : Any + Pointer to allocated memory + + + pitch : size_t + Pitch of allocated memory in bytes + + + xsize : size_t + Logical width of allocation in elements + + + ysize : size_t + Logical height of allocation in elements + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass + def __dealloc__(self): + pass + def getPtr(self): + return self._pvt_ptr + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['ptr : ' + hex(self.ptr)] + except ValueError: + str_list += ['ptr : '] + + + try: + str_list += ['pitch : ' + str(self.pitch)] + except ValueError: + str_list += ['pitch : '] + + + try: + str_list += ['xsize : ' + str(self.xsize)] + except ValueError: + str_list += ['xsize : '] + + + try: + str_list += ['ysize : ' + str(self.ysize)] + except ValueError: + str_list += ['ysize : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def ptr(self): + return self._pvt_ptr[0].ptr + @ptr.setter + def ptr(self, ptr): + self._cyptr = _HelperInputVoidPtr(ptr) + self._pvt_ptr[0].ptr = self._cyptr.cptr + + + @property + def pitch(self): + return self._pvt_ptr[0].pitch + @pitch.setter + def pitch(self, size_t pitch): + self._pvt_ptr[0].pitch = pitch + + + @property + def xsize(self): + return self._pvt_ptr[0].xsize + @xsize.setter + def xsize(self, size_t xsize): + self._pvt_ptr[0].xsize = xsize + + + @property + def ysize(self): + return self._pvt_ptr[0].ysize + @ysize.setter + def ysize(self, size_t ysize): + self._pvt_ptr[0].ysize = ysize + + +cdef class cudaExtent: + """ + CUDA extent make_cudaExtent + + Attributes + ---------- + + width : size_t + Width in elements when referring to array memory, in bytes when + referring to linear memory + + + height : size_t + Height in elements + + + depth : size_t + Depth in elements + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass + def __dealloc__(self): + pass + def getPtr(self): + return self._pvt_ptr + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['width : ' + str(self.width)] + except ValueError: + str_list += ['width : '] + + + try: + str_list += ['height : ' + str(self.height)] + except ValueError: + str_list += ['height : '] + + + try: + str_list += ['depth : ' + str(self.depth)] + except ValueError: + str_list += ['depth : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def width(self): + return self._pvt_ptr[0].width + @width.setter + def width(self, size_t width): + self._pvt_ptr[0].width = width + + + @property + def height(self): + return self._pvt_ptr[0].height + @height.setter + def height(self, size_t height): + self._pvt_ptr[0].height = height + + + @property + def depth(self): + return self._pvt_ptr[0].depth + @depth.setter + def depth(self, size_t depth): + self._pvt_ptr[0].depth = depth + + +cdef class cudaPos: + """ + CUDA 3D position make_cudaPos + + Attributes + ---------- + + x : size_t + x + + + y : size_t + y + + + z : size_t + z + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass + def __dealloc__(self): + pass + def getPtr(self): + return self._pvt_ptr + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['x : ' + str(self.x)] + except ValueError: + str_list += ['x : '] + + + try: + str_list += ['y : ' + str(self.y)] + except ValueError: + str_list += ['y : '] + + + try: + str_list += ['z : ' + str(self.z)] + except ValueError: + str_list += ['z : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def x(self): + return self._pvt_ptr[0].x + @x.setter + def x(self, size_t x): + self._pvt_ptr[0].x = x + + + @property + def y(self): + return self._pvt_ptr[0].y + @y.setter + def y(self, size_t y): + self._pvt_ptr[0].y = y + + + @property + def z(self): + return self._pvt_ptr[0].z + @z.setter + def z(self, size_t z): + self._pvt_ptr[0].z = z + + +cdef class cudaMemcpy3DParms: + """ + CUDA 3D memory copying parameters + + Attributes + ---------- + + srcArray : cudaArray_t + Source memory address + + + srcPos : cudaPos + Source position offset + + + srcPtr : cudaPitchedPtr + Pitched source memory address + + + dstArray : cudaArray_t + Destination memory address + + + dstPos : cudaPos + Destination position offset + + + dstPtr : cudaPitchedPtr + Pitched destination memory address + + + extent : cudaExtent + Requested memory copy size + + + kind : cudaMemcpyKind + Type of transfer + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass + + self._srcArray = cudaArray_t(_ptr=&self._pvt_ptr[0].srcArray) + + + self._srcPos = cudaPos(_ptr=&self._pvt_ptr[0].srcPos) + + + self._srcPtr = cudaPitchedPtr(_ptr=&self._pvt_ptr[0].srcPtr) + + + self._dstArray = cudaArray_t(_ptr=&self._pvt_ptr[0].dstArray) + + + self._dstPos = cudaPos(_ptr=&self._pvt_ptr[0].dstPos) + + + self._dstPtr = cudaPitchedPtr(_ptr=&self._pvt_ptr[0].dstPtr) + + + self._extent = cudaExtent(_ptr=&self._pvt_ptr[0].extent) + + def __dealloc__(self): + pass + def getPtr(self): + return self._pvt_ptr + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['srcArray : ' + str(self.srcArray)] + except ValueError: + str_list += ['srcArray : '] + + + try: + str_list += ['srcPos :\n' + '\n'.join([' ' + line for line in str(self.srcPos).splitlines()])] + except ValueError: + str_list += ['srcPos : '] + + + try: + str_list += ['srcPtr :\n' + '\n'.join([' ' + line for line in str(self.srcPtr).splitlines()])] + except ValueError: + str_list += ['srcPtr : '] + + + try: + str_list += ['dstArray : ' + str(self.dstArray)] + except ValueError: + str_list += ['dstArray : '] + + + try: + str_list += ['dstPos :\n' + '\n'.join([' ' + line for line in str(self.dstPos).splitlines()])] + except ValueError: + str_list += ['dstPos : '] + + + try: + str_list += ['dstPtr :\n' + '\n'.join([' ' + line for line in str(self.dstPtr).splitlines()])] + except ValueError: + str_list += ['dstPtr : '] + + + try: + str_list += ['extent :\n' + '\n'.join([' ' + line for line in str(self.extent).splitlines()])] + except ValueError: + str_list += ['extent : '] + + + try: + str_list += ['kind : ' + str(self.kind)] + except ValueError: + str_list += ['kind : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def srcArray(self): + return self._srcArray + @srcArray.setter + def srcArray(self, srcArray): + cdef cyruntime.cudaArray_t cysrcArray + if srcArray is None: + cysrcArray = 0 + elif isinstance(srcArray, (cudaArray_t,)): + psrcArray = int(srcArray) + cysrcArray = psrcArray + else: + psrcArray = int(cudaArray_t(srcArray)) + cysrcArray = psrcArray + self._srcArray._pvt_ptr[0] = cysrcArray + + + @property + def srcPos(self): + return self._srcPos + @srcPos.setter + def srcPos(self, srcPos not None : cudaPos): + string.memcpy(&self._pvt_ptr[0].srcPos, srcPos.getPtr(), sizeof(self._pvt_ptr[0].srcPos)) + + + @property + def srcPtr(self): + return self._srcPtr + @srcPtr.setter + def srcPtr(self, srcPtr not None : cudaPitchedPtr): + string.memcpy(&self._pvt_ptr[0].srcPtr, srcPtr.getPtr(), sizeof(self._pvt_ptr[0].srcPtr)) + + + @property + def dstArray(self): + return self._dstArray + @dstArray.setter + def dstArray(self, dstArray): + cdef cyruntime.cudaArray_t cydstArray + if dstArray is None: + cydstArray = 0 + elif isinstance(dstArray, (cudaArray_t,)): + pdstArray = int(dstArray) + cydstArray = pdstArray + else: + pdstArray = int(cudaArray_t(dstArray)) + cydstArray = pdstArray + self._dstArray._pvt_ptr[0] = cydstArray + + + @property + def dstPos(self): + return self._dstPos + @dstPos.setter + def dstPos(self, dstPos not None : cudaPos): + string.memcpy(&self._pvt_ptr[0].dstPos, dstPos.getPtr(), sizeof(self._pvt_ptr[0].dstPos)) + + + @property + def dstPtr(self): + return self._dstPtr + @dstPtr.setter + def dstPtr(self, dstPtr not None : cudaPitchedPtr): + string.memcpy(&self._pvt_ptr[0].dstPtr, dstPtr.getPtr(), sizeof(self._pvt_ptr[0].dstPtr)) + + + @property + def extent(self): + return self._extent + @extent.setter + def extent(self, extent not None : cudaExtent): + string.memcpy(&self._pvt_ptr[0].extent, extent.getPtr(), sizeof(self._pvt_ptr[0].extent)) + + + @property + def kind(self): + return cudaMemcpyKind(self._pvt_ptr[0].kind) + @kind.setter + def kind(self, kind not None : cudaMemcpyKind): + self._pvt_ptr[0].kind = int(kind) + + +cdef class cudaMemcpyNodeParams: + """ + Memcpy node parameters + + Attributes + ---------- + + flags : int + Must be zero + + + reserved : int + Must be zero + + + ctx : cudaExecutionContext_t + Context in which to run the memcpy. If NULL will try to use the + current context. + + + copyParams : cudaMemcpy3DParms + Parameters for the memory copy + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass + + self._ctx = cudaExecutionContext_t(_ptr=&self._pvt_ptr[0].ctx) + + + self._copyParams = cudaMemcpy3DParms(_ptr=&self._pvt_ptr[0].copyParams) + + def __dealloc__(self): + pass + def getPtr(self): + return self._pvt_ptr + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['flags : ' + str(self.flags)] + except ValueError: + str_list += ['flags : '] + + + try: + str_list += ['reserved : ' + str(self.reserved)] + except ValueError: + str_list += ['reserved : '] + + + try: + str_list += ['ctx : ' + str(self.ctx)] + except ValueError: + str_list += ['ctx : '] + + + try: + str_list += ['copyParams :\n' + '\n'.join([' ' + line for line in str(self.copyParams).splitlines()])] + except ValueError: + str_list += ['copyParams : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def flags(self): + return self._pvt_ptr[0].flags + @flags.setter + def flags(self, int flags): + self._pvt_ptr[0].flags = flags + + + @property + def reserved(self): + return self._pvt_ptr[0].reserved + @reserved.setter + def reserved(self, int reserved): + self._pvt_ptr[0].reserved = reserved + + + @property + def ctx(self): + return self._ctx + @ctx.setter + def ctx(self, ctx): + cdef cyruntime.cudaExecutionContext_t cyctx + if ctx is None: + cyctx = 0 + elif isinstance(ctx, (cudaExecutionContext_t,)): + pctx = int(ctx) + cyctx = pctx + else: + pctx = int(cudaExecutionContext_t(ctx)) + cyctx = pctx + self._ctx._pvt_ptr[0] = cyctx + + + @property + def copyParams(self): + return self._copyParams + @copyParams.setter + def copyParams(self, copyParams not None : cudaMemcpy3DParms): + string.memcpy(&self._pvt_ptr[0].copyParams, copyParams.getPtr(), sizeof(self._pvt_ptr[0].copyParams)) + + +cdef class cudaMemcpy3DPeerParms: + """ + CUDA 3D cross-device memory copying parameters + + Attributes + ---------- + + srcArray : cudaArray_t + Source memory address + + + srcPos : cudaPos + Source position offset + + + srcPtr : cudaPitchedPtr + Pitched source memory address + + + srcDevice : int + Source device + + + dstArray : cudaArray_t + Destination memory address + + + dstPos : cudaPos + Destination position offset + + + dstPtr : cudaPitchedPtr + Pitched destination memory address + + + dstDevice : int + Destination device + + + extent : cudaExtent + Requested memory copy size + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass + + self._srcArray = cudaArray_t(_ptr=&self._pvt_ptr[0].srcArray) + + + self._srcPos = cudaPos(_ptr=&self._pvt_ptr[0].srcPos) + + + self._srcPtr = cudaPitchedPtr(_ptr=&self._pvt_ptr[0].srcPtr) + + + self._dstArray = cudaArray_t(_ptr=&self._pvt_ptr[0].dstArray) + + + self._dstPos = cudaPos(_ptr=&self._pvt_ptr[0].dstPos) + + + self._dstPtr = cudaPitchedPtr(_ptr=&self._pvt_ptr[0].dstPtr) + + + self._extent = cudaExtent(_ptr=&self._pvt_ptr[0].extent) + + def __dealloc__(self): + pass + def getPtr(self): + return self._pvt_ptr + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['srcArray : ' + str(self.srcArray)] + except ValueError: + str_list += ['srcArray : '] + + + try: + str_list += ['srcPos :\n' + '\n'.join([' ' + line for line in str(self.srcPos).splitlines()])] + except ValueError: + str_list += ['srcPos : '] + + + try: + str_list += ['srcPtr :\n' + '\n'.join([' ' + line for line in str(self.srcPtr).splitlines()])] + except ValueError: + str_list += ['srcPtr : '] + + + try: + str_list += ['srcDevice : ' + str(self.srcDevice)] + except ValueError: + str_list += ['srcDevice : '] + + + try: + str_list += ['dstArray : ' + str(self.dstArray)] + except ValueError: + str_list += ['dstArray : '] + + + try: + str_list += ['dstPos :\n' + '\n'.join([' ' + line for line in str(self.dstPos).splitlines()])] + except ValueError: + str_list += ['dstPos : '] + + + try: + str_list += ['dstPtr :\n' + '\n'.join([' ' + line for line in str(self.dstPtr).splitlines()])] + except ValueError: + str_list += ['dstPtr : '] + + + try: + str_list += ['dstDevice : ' + str(self.dstDevice)] + except ValueError: + str_list += ['dstDevice : '] + + + try: + str_list += ['extent :\n' + '\n'.join([' ' + line for line in str(self.extent).splitlines()])] + except ValueError: + str_list += ['extent : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def srcArray(self): + return self._srcArray + @srcArray.setter + def srcArray(self, srcArray): + cdef cyruntime.cudaArray_t cysrcArray + if srcArray is None: + cysrcArray = 0 + elif isinstance(srcArray, (cudaArray_t,)): + psrcArray = int(srcArray) + cysrcArray = psrcArray + else: + psrcArray = int(cudaArray_t(srcArray)) + cysrcArray = psrcArray + self._srcArray._pvt_ptr[0] = cysrcArray + + + @property + def srcPos(self): + return self._srcPos + @srcPos.setter + def srcPos(self, srcPos not None : cudaPos): + string.memcpy(&self._pvt_ptr[0].srcPos, srcPos.getPtr(), sizeof(self._pvt_ptr[0].srcPos)) + + + @property + def srcPtr(self): + return self._srcPtr + @srcPtr.setter + def srcPtr(self, srcPtr not None : cudaPitchedPtr): + string.memcpy(&self._pvt_ptr[0].srcPtr, srcPtr.getPtr(), sizeof(self._pvt_ptr[0].srcPtr)) + + + @property + def srcDevice(self): + return self._pvt_ptr[0].srcDevice + @srcDevice.setter + def srcDevice(self, int srcDevice): + self._pvt_ptr[0].srcDevice = srcDevice + + + @property + def dstArray(self): + return self._dstArray + @dstArray.setter + def dstArray(self, dstArray): + cdef cyruntime.cudaArray_t cydstArray + if dstArray is None: + cydstArray = 0 + elif isinstance(dstArray, (cudaArray_t,)): + pdstArray = int(dstArray) + cydstArray = pdstArray + else: + pdstArray = int(cudaArray_t(dstArray)) + cydstArray = pdstArray + self._dstArray._pvt_ptr[0] = cydstArray + + + @property + def dstPos(self): + return self._dstPos + @dstPos.setter + def dstPos(self, dstPos not None : cudaPos): + string.memcpy(&self._pvt_ptr[0].dstPos, dstPos.getPtr(), sizeof(self._pvt_ptr[0].dstPos)) + + + @property + def dstPtr(self): + return self._dstPtr + @dstPtr.setter + def dstPtr(self, dstPtr not None : cudaPitchedPtr): + string.memcpy(&self._pvt_ptr[0].dstPtr, dstPtr.getPtr(), sizeof(self._pvt_ptr[0].dstPtr)) + + + @property + def dstDevice(self): + return self._pvt_ptr[0].dstDevice + @dstDevice.setter + def dstDevice(self, int dstDevice): + self._pvt_ptr[0].dstDevice = dstDevice + + + @property + def extent(self): + return self._extent + @extent.setter + def extent(self, extent not None : cudaExtent): + string.memcpy(&self._pvt_ptr[0].extent, extent.getPtr(), sizeof(self._pvt_ptr[0].extent)) + + +cdef class cudaMemsetParams: + """ + CUDA Memset node parameters + + Attributes + ---------- + + dst : Any + Destination device pointer + + + pitch : size_t + Pitch of destination device pointer. Unused if height is 1 + + + value : unsigned int + Value to be set + + + elementSize : unsigned int + Size of each element in bytes. Must be 1, 2, or 4. + + + width : size_t + Width of the row in elements + + + height : size_t + Number of rows + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass + def __dealloc__(self): + pass + def getPtr(self): + return self._pvt_ptr + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['dst : ' + hex(self.dst)] + except ValueError: + str_list += ['dst : '] + + + try: + str_list += ['pitch : ' + str(self.pitch)] + except ValueError: + str_list += ['pitch : '] + + + try: + str_list += ['value : ' + str(self.value)] + except ValueError: + str_list += ['value : '] + + + try: + str_list += ['elementSize : ' + str(self.elementSize)] + except ValueError: + str_list += ['elementSize : '] + + + try: + str_list += ['width : ' + str(self.width)] + except ValueError: + str_list += ['width : '] + + + try: + str_list += ['height : ' + str(self.height)] + except ValueError: + str_list += ['height : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def dst(self): + return self._pvt_ptr[0].dst + @dst.setter + def dst(self, dst): + self._cydst = _HelperInputVoidPtr(dst) + self._pvt_ptr[0].dst = self._cydst.cptr + + + @property + def pitch(self): + return self._pvt_ptr[0].pitch + @pitch.setter + def pitch(self, size_t pitch): + self._pvt_ptr[0].pitch = pitch + + + @property + def value(self): + return self._pvt_ptr[0].value + @value.setter + def value(self, unsigned int value): + self._pvt_ptr[0].value = value + + + @property + def elementSize(self): + return self._pvt_ptr[0].elementSize + @elementSize.setter + def elementSize(self, unsigned int elementSize): + self._pvt_ptr[0].elementSize = elementSize + + + @property + def width(self): + return self._pvt_ptr[0].width @width.setter - def width(self, unsigned int width): - self._ptr[0].tileExtent.width = width + def width(self, size_t width): + self._pvt_ptr[0].width = width + + @property def height(self): - return self._ptr[0].tileExtent.height + return self._pvt_ptr[0].height @height.setter - def height(self, unsigned int height): - self._ptr[0].tileExtent.height = height + def height(self, size_t height): + self._pvt_ptr[0].height = height + + +cdef class cudaMemsetParamsV2: + """ + CUDA Memset node parameters + + Attributes + ---------- + + dst : Any + Destination device pointer + + + pitch : size_t + Pitch of destination device pointer. Unused if height is 1 + + + value : unsigned int + Value to be set + + + elementSize : unsigned int + Size of each element in bytes. Must be 1, 2, or 4. + + + width : size_t + Width of the row in elements + + + height : size_t + Number of rows + + + ctx : cudaExecutionContext_t + Context in which to run the memset. If NULL will try to use the + current context. + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass + + self._ctx = cudaExecutionContext_t(_ptr=&self._pvt_ptr[0].ctx) + + def __dealloc__(self): + pass + def getPtr(self): + return self._pvt_ptr + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['dst : ' + hex(self.dst)] + except ValueError: + str_list += ['dst : '] + + + try: + str_list += ['pitch : ' + str(self.pitch)] + except ValueError: + str_list += ['pitch : '] + + + try: + str_list += ['value : ' + str(self.value)] + except ValueError: + str_list += ['value : '] + + + try: + str_list += ['elementSize : ' + str(self.elementSize)] + except ValueError: + str_list += ['elementSize : '] + + + try: + str_list += ['width : ' + str(self.width)] + except ValueError: + str_list += ['width : '] + + + try: + str_list += ['height : ' + str(self.height)] + except ValueError: + str_list += ['height : '] + + + try: + str_list += ['ctx : ' + str(self.ctx)] + except ValueError: + str_list += ['ctx : '] + + return '\n'.join(str_list) + else: + return '' + @property - def depth(self): - return self._ptr[0].tileExtent.depth - @depth.setter - def depth(self, unsigned int depth): - self._ptr[0].tileExtent.depth = depth -{{endif}} -{{if 'struct cudaArraySparseProperties' in found_types}} + def dst(self): + return self._pvt_ptr[0].dst + @dst.setter + def dst(self, dst): + self._cydst = _HelperInputVoidPtr(dst) + self._pvt_ptr[0].dst = self._cydst.cptr -cdef class cudaArraySparseProperties: + + @property + def pitch(self): + return self._pvt_ptr[0].pitch + @pitch.setter + def pitch(self, size_t pitch): + self._pvt_ptr[0].pitch = pitch + + + @property + def value(self): + return self._pvt_ptr[0].value + @value.setter + def value(self, unsigned int value): + self._pvt_ptr[0].value = value + + + @property + def elementSize(self): + return self._pvt_ptr[0].elementSize + @elementSize.setter + def elementSize(self, unsigned int elementSize): + self._pvt_ptr[0].elementSize = elementSize + + + @property + def width(self): + return self._pvt_ptr[0].width + @width.setter + def width(self, size_t width): + self._pvt_ptr[0].width = width + + + @property + def height(self): + return self._pvt_ptr[0].height + @height.setter + def height(self, size_t height): + self._pvt_ptr[0].height = height + + + @property + def ctx(self): + return self._ctx + @ctx.setter + def ctx(self, ctx): + cdef cyruntime.cudaExecutionContext_t cyctx + if ctx is None: + cyctx = 0 + elif isinstance(ctx, (cudaExecutionContext_t,)): + pctx = int(ctx) + cyctx = pctx + else: + pctx = int(cudaExecutionContext_t(ctx)) + cyctx = pctx + self._ctx._pvt_ptr[0] = cyctx + + +cdef class cudaAccessPolicyWindow: """ - Sparse CUDA array and CUDA mipmapped array properties + Specifies an access policy for a window, a contiguous extent of + memory beginning at base_ptr and ending at base_ptr + num_bytes. + Partition into many segments and assign segments such that. sum of + "hit segments" / window == approx. ratio. sum of "miss segments" / + window == approx 1-ratio. Segments and ratio specifications are + fitted to the capabilities of the architecture. Accesses in a hit + segment apply the hitProp access policy. Accesses in a miss segment + apply the missProp access policy. Attributes ---------- - tileExtent : anon_struct0 - miptailFirstLevel : unsigned int - First mip level at which the mip tail begins - miptailSize : unsigned long long - Total size of the mip tail. - flags : unsigned int - Flags will either be zero or cudaArraySparsePropertiesSingleMipTail - reserved : List[unsigned int] + base_ptr : Any + Starting address of the access policy window. CUDA driver may align + it. + + + num_bytes : size_t + Size in bytes of the window policy. CUDA driver may restrict the + maximum size and alignment. + + + hitRatio : float + hitRatio specifies percentage of lines assigned hitProp, rest are + assigned missProp. + + + hitProp : cudaAccessProperty + ::CUaccessProperty set for hit. + + + missProp : cudaAccessProperty + ::CUaccessProperty set for miss. Must be either NORMAL or + STREAMING. Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - self._tileExtent = anon_struct0(_ptr=self._ptr) + pass def __dealloc__(self): pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['tileExtent :\n' + '\n'.join([' ' + line for line in str(self.tileExtent).splitlines()])] + str_list += ['base_ptr : ' + hex(self.base_ptr)] except ValueError: - str_list += ['tileExtent : '] + str_list += ['base_ptr : '] + + try: - str_list += ['miptailFirstLevel : ' + str(self.miptailFirstLevel)] + str_list += ['num_bytes : ' + str(self.num_bytes)] except ValueError: - str_list += ['miptailFirstLevel : '] + str_list += ['num_bytes : '] + + try: - str_list += ['miptailSize : ' + str(self.miptailSize)] + str_list += ['hitRatio : ' + str(self.hitRatio)] except ValueError: - str_list += ['miptailSize : '] + str_list += ['hitRatio : '] + + try: - str_list += ['flags : ' + str(self.flags)] + str_list += ['hitProp : ' + str(self.hitProp)] except ValueError: - str_list += ['flags : '] + str_list += ['hitProp : '] + + try: - str_list += ['reserved : ' + str(self.reserved)] + str_list += ['missProp : ' + str(self.missProp)] except ValueError: - str_list += ['reserved : '] + str_list += ['missProp : '] + return '\n'.join(str_list) else: return '' + @property - def tileExtent(self): - return self._tileExtent - @tileExtent.setter - def tileExtent(self, tileExtent not None : anon_struct0): - string.memcpy(&self._ptr[0].tileExtent, tileExtent.getPtr(), sizeof(self._ptr[0].tileExtent)) + def base_ptr(self): + return self._pvt_ptr[0].base_ptr + @base_ptr.setter + def base_ptr(self, base_ptr): + self._cybase_ptr = _HelperInputVoidPtr(base_ptr) + self._pvt_ptr[0].base_ptr = self._cybase_ptr.cptr + + @property - def miptailFirstLevel(self): - return self._ptr[0].miptailFirstLevel - @miptailFirstLevel.setter - def miptailFirstLevel(self, unsigned int miptailFirstLevel): - self._ptr[0].miptailFirstLevel = miptailFirstLevel + def num_bytes(self): + return self._pvt_ptr[0].num_bytes + @num_bytes.setter + def num_bytes(self, size_t num_bytes): + self._pvt_ptr[0].num_bytes = num_bytes + + @property - def miptailSize(self): - return self._ptr[0].miptailSize - @miptailSize.setter - def miptailSize(self, unsigned long long miptailSize): - self._ptr[0].miptailSize = miptailSize + def hitRatio(self): + return self._pvt_ptr[0].hitRatio + @hitRatio.setter + def hitRatio(self, float hitRatio): + self._pvt_ptr[0].hitRatio = hitRatio + + @property - def flags(self): - return self._ptr[0].flags - @flags.setter - def flags(self, unsigned int flags): - self._ptr[0].flags = flags + def hitProp(self): + return cudaAccessProperty(self._pvt_ptr[0].hitProp) + @hitProp.setter + def hitProp(self, hitProp not None : cudaAccessProperty): + self._pvt_ptr[0].hitProp = int(hitProp) + + @property - def reserved(self): - return self._ptr[0].reserved - @reserved.setter - def reserved(self, reserved): - self._ptr[0].reserved = reserved -{{endif}} -{{if 'struct cudaArrayMemoryRequirements' in found_types}} + def missProp(self): + return cudaAccessProperty(self._pvt_ptr[0].missProp) + @missProp.setter + def missProp(self, missProp not None : cudaAccessProperty): + self._pvt_ptr[0].missProp = int(missProp) -cdef class cudaArrayMemoryRequirements: + +cdef class cudaHostNodeParams: """ - CUDA array and CUDA mipmapped array memory requirements + CUDA host node parameters Attributes ---------- - size : size_t - Total size of the array. - alignment : size_t - Alignment necessary for mapping the array. - reserved : List[unsigned int] + + fn : cudaHostFn_t + The function to call when the node executes + + + userData : Any + Argument to pass to the function Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): pass + + self._fn = cudaHostFn_t(_ptr=&self._pvt_ptr[0].fn) + def __dealloc__(self): pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['size : ' + str(self.size)] - except ValueError: - str_list += ['size : '] - try: - str_list += ['alignment : ' + str(self.alignment)] + str_list += ['fn : ' + str(self.fn)] except ValueError: - str_list += ['alignment : '] + str_list += ['fn : '] + + try: - str_list += ['reserved : ' + str(self.reserved)] + str_list += ['userData : ' + hex(self.userData)] except ValueError: - str_list += ['reserved : '] + str_list += ['userData : '] + return '\n'.join(str_list) else: return '' + @property - def size(self): - return self._ptr[0].size - @size.setter - def size(self, size_t size): - self._ptr[0].size = size - @property - def alignment(self): - return self._ptr[0].alignment - @alignment.setter - def alignment(self, size_t alignment): - self._ptr[0].alignment = alignment + def fn(self): + return self._fn + @fn.setter + def fn(self, fn): + cdef cyruntime.cudaHostFn_t cyfn + if fn is None: + cyfn = 0 + elif isinstance(fn, (cudaHostFn_t)): + pfn = int(fn) + cyfn = pfn + else: + pfn = int(cudaHostFn_t(fn)) + cyfn = pfn + self._fn._pvt_ptr[0] = cyfn + + @property - def reserved(self): - return self._ptr[0].reserved - @reserved.setter - def reserved(self, reserved): - self._ptr[0].reserved = reserved -{{endif}} -{{if 'struct cudaPitchedPtr' in found_types}} + def userData(self): + return self._pvt_ptr[0].userData + @userData.setter + def userData(self, userData): + self._cyuserData = _HelperInputVoidPtr(userData) + self._pvt_ptr[0].userData = self._cyuserData.cptr -cdef class cudaPitchedPtr: + +cdef class cudaHostNodeParamsV2: """ - CUDA Pitched memory pointer ::make_cudaPitchedPtr + CUDA host node parameters Attributes ---------- - ptr : Any - Pointer to allocated memory - pitch : size_t - Pitch of allocated memory in bytes - xsize : size_t - Logical width of allocation in elements - ysize : size_t - Logical height of allocation in elements + + fn : cudaHostFn_t + The function to call when the node executes + + + userData : Any + Argument to pass to the function + + + syncMode : unsigned int + The synchronization mode to use for the host task + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): pass + + self._fn = cudaHostFn_t(_ptr=&self._pvt_ptr[0].fn) + def __dealloc__(self): pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['ptr : ' + hex(self.ptr)] - except ValueError: - str_list += ['ptr : '] - try: - str_list += ['pitch : ' + str(self.pitch)] + str_list += ['fn : ' + str(self.fn)] except ValueError: - str_list += ['pitch : '] + str_list += ['fn : '] + + try: - str_list += ['xsize : ' + str(self.xsize)] + str_list += ['userData : ' + hex(self.userData)] except ValueError: - str_list += ['xsize : '] + str_list += ['userData : '] + + try: - str_list += ['ysize : ' + str(self.ysize)] + str_list += ['syncMode : ' + str(self.syncMode)] except ValueError: - str_list += ['ysize : '] + str_list += ['syncMode : '] + return '\n'.join(str_list) else: return '' + @property - def ptr(self): - return self._ptr[0].ptr - @ptr.setter - def ptr(self, ptr): - _cptr = utils.HelperInputVoidPtr(ptr) - self._ptr[0].ptr = _cptr.cptr - @property - def pitch(self): - return self._ptr[0].pitch - @pitch.setter - def pitch(self, size_t pitch): - self._ptr[0].pitch = pitch + def fn(self): + return self._fn + @fn.setter + def fn(self, fn): + cdef cyruntime.cudaHostFn_t cyfn + if fn is None: + cyfn = 0 + elif isinstance(fn, (cudaHostFn_t)): + pfn = int(fn) + cyfn = pfn + else: + pfn = int(cudaHostFn_t(fn)) + cyfn = pfn + self._fn._pvt_ptr[0] = cyfn + + @property - def xsize(self): - return self._ptr[0].xsize - @xsize.setter - def xsize(self, size_t xsize): - self._ptr[0].xsize = xsize + def userData(self): + return self._pvt_ptr[0].userData + @userData.setter + def userData(self, userData): + self._cyuserData = _HelperInputVoidPtr(userData) + self._pvt_ptr[0].userData = self._cyuserData.cptr + + @property - def ysize(self): - return self._ptr[0].ysize - @ysize.setter - def ysize(self, size_t ysize): - self._ptr[0].ysize = ysize -{{endif}} -{{if 'struct cudaExtent' in found_types}} + def syncMode(self): + return self._pvt_ptr[0].syncMode + @syncMode.setter + def syncMode(self, unsigned int syncMode): + self._pvt_ptr[0].syncMode = syncMode -cdef class cudaExtent: + +cdef class anon_struct1: + """ + Attributes + ---------- + + array : cudaArray_t + + + + Methods + ------- + getPtr() + Get memory address of class instance """ - CUDA extent ::make_cudaExtent + def __cinit__(self, void_ptr _ptr): + self._pvt_ptr = _ptr + + def __init__(self, void_ptr _ptr): + pass + + self._array = cudaArray_t(_ptr=&self._pvt_ptr[0].res.array.array) + + def __dealloc__(self): + pass + def getPtr(self): + return &self._pvt_ptr[0].res.array + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['array : ' + str(self.array)] + except ValueError: + str_list += ['array : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def array(self): + return self._array + @array.setter + def array(self, array): + cdef cyruntime.cudaArray_t cyarray + if array is None: + cyarray = 0 + elif isinstance(array, (cudaArray_t,)): + parray = int(array) + cyarray = parray + else: + parray = int(cudaArray_t(array)) + cyarray = parray + self._array._pvt_ptr[0] = cyarray + +cdef class anon_struct2: + """ Attributes ---------- - width : size_t - Width in elements when referring to array memory, in bytes when - referring to linear memory - height : size_t - Height in elements - depth : size_t - Depth in elements + + mipmap : cudaMipmappedArray_t + + Methods ------- getPtr() Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - else: - self._ptr = _ptr - def __init__(self, void_ptr _ptr = 0): + def __cinit__(self, void_ptr _ptr): + self._pvt_ptr = _ptr + + def __init__(self, void_ptr _ptr): pass + + self._mipmap = cudaMipmappedArray_t(_ptr=&self._pvt_ptr[0].res.mipmap.mipmap) + def __dealloc__(self): pass def getPtr(self): - return self._ptr + return &self._pvt_ptr[0].res.mipmap def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['width : ' + str(self.width)] - except ValueError: - str_list += ['width : '] - try: - str_list += ['height : ' + str(self.height)] - except ValueError: - str_list += ['height : '] - try: - str_list += ['depth : ' + str(self.depth)] + str_list += ['mipmap : ' + str(self.mipmap)] except ValueError: - str_list += ['depth : '] + str_list += ['mipmap : '] + return '\n'.join(str_list) else: return '' + @property - def width(self): - return self._ptr[0].width - @width.setter - def width(self, size_t width): - self._ptr[0].width = width - @property - def height(self): - return self._ptr[0].height - @height.setter - def height(self, size_t height): - self._ptr[0].height = height - @property - def depth(self): - return self._ptr[0].depth - @depth.setter - def depth(self, size_t depth): - self._ptr[0].depth = depth -{{endif}} -{{if 'struct cudaPos' in found_types}} + def mipmap(self): + return self._mipmap + @mipmap.setter + def mipmap(self, mipmap): + cdef cyruntime.cudaMipmappedArray_t cymipmap + if mipmap is None: + cymipmap = 0 + elif isinstance(mipmap, (cudaMipmappedArray_t,)): + pmipmap = int(mipmap) + cymipmap = pmipmap + else: + pmipmap = int(cudaMipmappedArray_t(mipmap)) + cymipmap = pmipmap + self._mipmap._pvt_ptr[0] = cymipmap -cdef class cudaPos: - """ - CUDA 3D position ::make_cudaPos +cdef class anon_struct3: + """ Attributes ---------- - x : size_t - x - y : size_t - y - z : size_t - z + + devPtr : Any + + + + desc : cudaChannelFormatDesc + + + + sizeInBytes : size_t + + Methods ------- getPtr() Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - else: - self._ptr = _ptr - def __init__(self, void_ptr _ptr = 0): + def __cinit__(self, void_ptr _ptr): + self._pvt_ptr = _ptr + + def __init__(self, void_ptr _ptr): pass + + self._desc = cudaChannelFormatDesc(_ptr=&self._pvt_ptr[0].res.linear.desc) + def __dealloc__(self): pass def getPtr(self): - return self._ptr + return &self._pvt_ptr[0].res.linear def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['x : ' + str(self.x)] + str_list += ['devPtr : ' + hex(self.devPtr)] except ValueError: - str_list += ['x : '] + str_list += ['devPtr : '] + + try: - str_list += ['y : ' + str(self.y)] + str_list += ['desc :\n' + '\n'.join([' ' + line for line in str(self.desc).splitlines()])] except ValueError: - str_list += ['y : '] + str_list += ['desc : '] + + try: - str_list += ['z : ' + str(self.z)] + str_list += ['sizeInBytes : ' + str(self.sizeInBytes)] except ValueError: - str_list += ['z : '] + str_list += ['sizeInBytes : '] + return '\n'.join(str_list) else: return '' + @property - def x(self): - return self._ptr[0].x - @x.setter - def x(self, size_t x): - self._ptr[0].x = x + def devPtr(self): + return self._pvt_ptr[0].res.linear.devPtr + @devPtr.setter + def devPtr(self, devPtr): + self._cydevPtr = _HelperInputVoidPtr(devPtr) + self._pvt_ptr[0].res.linear.devPtr = self._cydevPtr.cptr + + @property - def y(self): - return self._ptr[0].y - @y.setter - def y(self, size_t y): - self._ptr[0].y = y + def desc(self): + return self._desc + @desc.setter + def desc(self, desc not None : cudaChannelFormatDesc): + string.memcpy(&self._pvt_ptr[0].res.linear.desc, desc.getPtr(), sizeof(self._pvt_ptr[0].res.linear.desc)) + + @property - def z(self): - return self._ptr[0].z - @z.setter - def z(self, size_t z): - self._ptr[0].z = z -{{endif}} -{{if 'struct cudaMemcpy3DParms' in found_types}} + def sizeInBytes(self): + return self._pvt_ptr[0].res.linear.sizeInBytes + @sizeInBytes.setter + def sizeInBytes(self, size_t sizeInBytes): + self._pvt_ptr[0].res.linear.sizeInBytes = sizeInBytes -cdef class cudaMemcpy3DParms: - """ - CUDA 3D memory copying parameters +cdef class anon_struct4: + """ Attributes ---------- - srcArray : cudaArray_t - Source memory address - srcPos : cudaPos - Source position offset - srcPtr : cudaPitchedPtr - Pitched source memory address - dstArray : cudaArray_t - Destination memory address - dstPos : cudaPos - Destination position offset - dstPtr : cudaPitchedPtr - Pitched destination memory address - extent : cudaExtent - Requested memory copy size - kind : cudaMemcpyKind - Type of transfer + + devPtr : Any + + + + desc : cudaChannelFormatDesc + + + + width : size_t + + + + height : size_t + + + + pitchInBytes : size_t + + Methods ------- getPtr() Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - else: - self._ptr = _ptr - def __init__(self, void_ptr _ptr = 0): - self._srcArray = cudaArray_t(_ptr=&self._ptr[0].srcArray) - self._srcPos = cudaPos(_ptr=&self._ptr[0].srcPos) - self._srcPtr = cudaPitchedPtr(_ptr=&self._ptr[0].srcPtr) - self._dstArray = cudaArray_t(_ptr=&self._ptr[0].dstArray) - self._dstPos = cudaPos(_ptr=&self._ptr[0].dstPos) - self._dstPtr = cudaPitchedPtr(_ptr=&self._ptr[0].dstPtr) - self._extent = cudaExtent(_ptr=&self._ptr[0].extent) + def __cinit__(self, void_ptr _ptr): + self._pvt_ptr = _ptr + + def __init__(self, void_ptr _ptr): + pass + + self._desc = cudaChannelFormatDesc(_ptr=&self._pvt_ptr[0].res.pitch2D.desc) + def __dealloc__(self): pass def getPtr(self): - return self._ptr + return &self._pvt_ptr[0].res.pitch2D def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['srcArray : ' + str(self.srcArray)] - except ValueError: - str_list += ['srcArray : '] - try: - str_list += ['srcPos :\n' + '\n'.join([' ' + line for line in str(self.srcPos).splitlines()])] - except ValueError: - str_list += ['srcPos : '] - try: - str_list += ['srcPtr :\n' + '\n'.join([' ' + line for line in str(self.srcPtr).splitlines()])] - except ValueError: - str_list += ['srcPtr : '] - try: - str_list += ['dstArray : ' + str(self.dstArray)] + str_list += ['devPtr : ' + hex(self.devPtr)] except ValueError: - str_list += ['dstArray : '] + str_list += ['devPtr : '] + + try: - str_list += ['dstPos :\n' + '\n'.join([' ' + line for line in str(self.dstPos).splitlines()])] + str_list += ['desc :\n' + '\n'.join([' ' + line for line in str(self.desc).splitlines()])] except ValueError: - str_list += ['dstPos : '] + str_list += ['desc : '] + + try: - str_list += ['dstPtr :\n' + '\n'.join([' ' + line for line in str(self.dstPtr).splitlines()])] + str_list += ['width : ' + str(self.width)] except ValueError: - str_list += ['dstPtr : '] + str_list += ['width : '] + + try: - str_list += ['extent :\n' + '\n'.join([' ' + line for line in str(self.extent).splitlines()])] + str_list += ['height : ' + str(self.height)] except ValueError: - str_list += ['extent : '] + str_list += ['height : '] + + try: - str_list += ['kind : ' + str(self.kind)] + str_list += ['pitchInBytes : ' + str(self.pitchInBytes)] except ValueError: - str_list += ['kind : '] - return '\n'.join(str_list) - else: - return '' - @property - def srcArray(self): - return self._srcArray - @srcArray.setter - def srcArray(self, srcArray): - cdef ccudart.cudaArray_t csrcArray - if srcArray is None: - csrcArray = 0 - elif isinstance(srcArray, (cudaArray_t,)): - psrcArray = int(srcArray) - csrcArray = psrcArray - else: - psrcArray = int(cudaArray_t(srcArray)) - csrcArray = psrcArray - self._srcArray._ptr[0] = csrcArray - @property - def srcPos(self): - return self._srcPos - @srcPos.setter - def srcPos(self, srcPos not None : cudaPos): - string.memcpy(&self._ptr[0].srcPos, srcPos.getPtr(), sizeof(self._ptr[0].srcPos)) - @property - def srcPtr(self): - return self._srcPtr - @srcPtr.setter - def srcPtr(self, srcPtr not None : cudaPitchedPtr): - string.memcpy(&self._ptr[0].srcPtr, srcPtr.getPtr(), sizeof(self._ptr[0].srcPtr)) - @property - def dstArray(self): - return self._dstArray - @dstArray.setter - def dstArray(self, dstArray): - cdef ccudart.cudaArray_t cdstArray - if dstArray is None: - cdstArray = 0 - elif isinstance(dstArray, (cudaArray_t,)): - pdstArray = int(dstArray) - cdstArray = pdstArray + str_list += ['pitchInBytes : '] + + return '\n'.join(str_list) else: - pdstArray = int(cudaArray_t(dstArray)) - cdstArray = pdstArray - self._dstArray._ptr[0] = cdstArray + return '' + @property - def dstPos(self): - return self._dstPos - @dstPos.setter - def dstPos(self, dstPos not None : cudaPos): - string.memcpy(&self._ptr[0].dstPos, dstPos.getPtr(), sizeof(self._ptr[0].dstPos)) + def devPtr(self): + return self._pvt_ptr[0].res.pitch2D.devPtr + @devPtr.setter + def devPtr(self, devPtr): + self._cydevPtr = _HelperInputVoidPtr(devPtr) + self._pvt_ptr[0].res.pitch2D.devPtr = self._cydevPtr.cptr + + @property - def dstPtr(self): - return self._dstPtr - @dstPtr.setter - def dstPtr(self, dstPtr not None : cudaPitchedPtr): - string.memcpy(&self._ptr[0].dstPtr, dstPtr.getPtr(), sizeof(self._ptr[0].dstPtr)) + def desc(self): + return self._desc + @desc.setter + def desc(self, desc not None : cudaChannelFormatDesc): + string.memcpy(&self._pvt_ptr[0].res.pitch2D.desc, desc.getPtr(), sizeof(self._pvt_ptr[0].res.pitch2D.desc)) + + @property - def extent(self): - return self._extent - @extent.setter - def extent(self, extent not None : cudaExtent): - string.memcpy(&self._ptr[0].extent, extent.getPtr(), sizeof(self._ptr[0].extent)) + def width(self): + return self._pvt_ptr[0].res.pitch2D.width + @width.setter + def width(self, size_t width): + self._pvt_ptr[0].res.pitch2D.width = width + + @property - def kind(self): - return cudaMemcpyKind(self._ptr[0].kind) - @kind.setter - def kind(self, kind not None : cudaMemcpyKind): - self._ptr[0].kind = kind.value -{{endif}} -{{if 'struct cudaMemcpyNodeParams' in found_types}} + def height(self): + return self._pvt_ptr[0].res.pitch2D.height + @height.setter + def height(self, size_t height): + self._pvt_ptr[0].res.pitch2D.height = height + + + @property + def pitchInBytes(self): + return self._pvt_ptr[0].res.pitch2D.pitchInBytes + @pitchInBytes.setter + def pitchInBytes(self, size_t pitchInBytes): + self._pvt_ptr[0].res.pitch2D.pitchInBytes = pitchInBytes -cdef class cudaMemcpyNodeParams: - """ - Memcpy node parameters +cdef class anon_struct5: + """ Attributes ---------- - flags : int - Must be zero - reserved : List[int] - Must be zero - copyParams : cudaMemcpy3DParms - Parameters for the memory copy + + reserved : list[int] + + Methods ------- getPtr() Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - else: - self._ptr = _ptr - def __init__(self, void_ptr _ptr = 0): - self._copyParams = cudaMemcpy3DParms(_ptr=&self._ptr[0].copyParams) + def __cinit__(self, void_ptr _ptr): + self._pvt_ptr = _ptr + + def __init__(self, void_ptr _ptr): + pass def __dealloc__(self): pass def getPtr(self): - return self._ptr + return &self._pvt_ptr[0].res.reserved def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] - try: - str_list += ['flags : ' + str(self.flags)] - except ValueError: - str_list += ['flags : '] + try: str_list += ['reserved : ' + str(self.reserved)] except ValueError: str_list += ['reserved : '] - try: - str_list += ['copyParams :\n' + '\n'.join([' ' + line for line in str(self.copyParams).splitlines()])] - except ValueError: - str_list += ['copyParams : '] + return '\n'.join(str_list) else: return '' - @property - def flags(self): - return self._ptr[0].flags - @flags.setter - def flags(self, int flags): - self._ptr[0].flags = flags + @property def reserved(self): - return self._ptr[0].reserved + return self._pvt_ptr[0].res.reserved.reserved @reserved.setter def reserved(self, reserved): - self._ptr[0].reserved = reserved - @property - def copyParams(self): - return self._copyParams - @copyParams.setter - def copyParams(self, copyParams not None : cudaMemcpy3DParms): - string.memcpy(&self._ptr[0].copyParams, copyParams.getPtr(), sizeof(self._ptr[0].copyParams)) -{{endif}} -{{if 'struct cudaMemcpy3DPeerParms' in found_types}} + self._pvt_ptr[0].res.reserved.reserved = reserved -cdef class cudaMemcpy3DPeerParms: - """ - CUDA 3D cross-device memory copying parameters +cdef class anon_union0: + """ Attributes ---------- - srcArray : cudaArray_t - Source memory address - srcPos : cudaPos - Source position offset - srcPtr : cudaPitchedPtr - Pitched source memory address - srcDevice : int - Source device - dstArray : cudaArray_t - Destination memory address - dstPos : cudaPos - Destination position offset - dstPtr : cudaPitchedPtr - Pitched destination memory address - dstDevice : int - Destination device - extent : cudaExtent - Requested memory copy size + + array : anon_struct1 + + + + mipmap : anon_struct2 + + + + linear : anon_struct3 + + + + pitch2D : anon_struct4 + + + + reserved : anon_struct5 + + Methods ------- getPtr() Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - else: - self._ptr = _ptr - def __init__(self, void_ptr _ptr = 0): - self._srcArray = cudaArray_t(_ptr=&self._ptr[0].srcArray) - self._srcPos = cudaPos(_ptr=&self._ptr[0].srcPos) - self._srcPtr = cudaPitchedPtr(_ptr=&self._ptr[0].srcPtr) - self._dstArray = cudaArray_t(_ptr=&self._ptr[0].dstArray) - self._dstPos = cudaPos(_ptr=&self._ptr[0].dstPos) - self._dstPtr = cudaPitchedPtr(_ptr=&self._ptr[0].dstPtr) - self._extent = cudaExtent(_ptr=&self._ptr[0].extent) + def __cinit__(self, void_ptr _ptr): + self._pvt_ptr = _ptr + + def __init__(self, void_ptr _ptr): + pass + + self._array = anon_struct1(_ptr=self._pvt_ptr) + + + self._mipmap = anon_struct2(_ptr=self._pvt_ptr) + + + self._linear = anon_struct3(_ptr=self._pvt_ptr) + + + self._pitch2D = anon_struct4(_ptr=self._pvt_ptr) + + + self._reserved = anon_struct5(_ptr=self._pvt_ptr) + def __dealloc__(self): pass def getPtr(self): - return self._ptr + return &self._pvt_ptr[0].res def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['srcArray : ' + str(self.srcArray)] - except ValueError: - str_list += ['srcArray : '] - try: - str_list += ['srcPos :\n' + '\n'.join([' ' + line for line in str(self.srcPos).splitlines()])] - except ValueError: - str_list += ['srcPos : '] - try: - str_list += ['srcPtr :\n' + '\n'.join([' ' + line for line in str(self.srcPtr).splitlines()])] - except ValueError: - str_list += ['srcPtr : '] - try: - str_list += ['srcDevice : ' + str(self.srcDevice)] - except ValueError: - str_list += ['srcDevice : '] - try: - str_list += ['dstArray : ' + str(self.dstArray)] + str_list += ['array :\n' + '\n'.join([' ' + line for line in str(self.array).splitlines()])] except ValueError: - str_list += ['dstArray : '] + str_list += ['array : '] + + try: - str_list += ['dstPos :\n' + '\n'.join([' ' + line for line in str(self.dstPos).splitlines()])] + str_list += ['mipmap :\n' + '\n'.join([' ' + line for line in str(self.mipmap).splitlines()])] except ValueError: - str_list += ['dstPos : '] + str_list += ['mipmap : '] + + try: - str_list += ['dstPtr :\n' + '\n'.join([' ' + line for line in str(self.dstPtr).splitlines()])] + str_list += ['linear :\n' + '\n'.join([' ' + line for line in str(self.linear).splitlines()])] except ValueError: - str_list += ['dstPtr : '] + str_list += ['linear : '] + + try: - str_list += ['dstDevice : ' + str(self.dstDevice)] + str_list += ['pitch2D :\n' + '\n'.join([' ' + line for line in str(self.pitch2D).splitlines()])] except ValueError: - str_list += ['dstDevice : '] + str_list += ['pitch2D : '] + + try: - str_list += ['extent :\n' + '\n'.join([' ' + line for line in str(self.extent).splitlines()])] + str_list += ['reserved :\n' + '\n'.join([' ' + line for line in str(self.reserved).splitlines()])] except ValueError: - str_list += ['extent : '] + str_list += ['reserved : '] + return '\n'.join(str_list) else: return '' + @property - def srcArray(self): - return self._srcArray - @srcArray.setter - def srcArray(self, srcArray): - cdef ccudart.cudaArray_t csrcArray - if srcArray is None: - csrcArray = 0 - elif isinstance(srcArray, (cudaArray_t,)): - psrcArray = int(srcArray) - csrcArray = psrcArray - else: - psrcArray = int(cudaArray_t(srcArray)) - csrcArray = psrcArray - self._srcArray._ptr[0] = csrcArray - @property - def srcPos(self): - return self._srcPos - @srcPos.setter - def srcPos(self, srcPos not None : cudaPos): - string.memcpy(&self._ptr[0].srcPos, srcPos.getPtr(), sizeof(self._ptr[0].srcPos)) - @property - def srcPtr(self): - return self._srcPtr - @srcPtr.setter - def srcPtr(self, srcPtr not None : cudaPitchedPtr): - string.memcpy(&self._ptr[0].srcPtr, srcPtr.getPtr(), sizeof(self._ptr[0].srcPtr)) - @property - def srcDevice(self): - return self._ptr[0].srcDevice - @srcDevice.setter - def srcDevice(self, int srcDevice): - self._ptr[0].srcDevice = srcDevice - @property - def dstArray(self): - return self._dstArray - @dstArray.setter - def dstArray(self, dstArray): - cdef ccudart.cudaArray_t cdstArray - if dstArray is None: - cdstArray = 0 - elif isinstance(dstArray, (cudaArray_t,)): - pdstArray = int(dstArray) - cdstArray = pdstArray - else: - pdstArray = int(cudaArray_t(dstArray)) - cdstArray = pdstArray - self._dstArray._ptr[0] = cdstArray - @property - def dstPos(self): - return self._dstPos - @dstPos.setter - def dstPos(self, dstPos not None : cudaPos): - string.memcpy(&self._ptr[0].dstPos, dstPos.getPtr(), sizeof(self._ptr[0].dstPos)) + def array(self): + return self._array + @array.setter + def array(self, array not None : anon_struct1): + string.memcpy(&self._pvt_ptr[0].res.array, array.getPtr(), sizeof(self._pvt_ptr[0].res.array)) + + @property - def dstPtr(self): - return self._dstPtr - @dstPtr.setter - def dstPtr(self, dstPtr not None : cudaPitchedPtr): - string.memcpy(&self._ptr[0].dstPtr, dstPtr.getPtr(), sizeof(self._ptr[0].dstPtr)) + def mipmap(self): + return self._mipmap + @mipmap.setter + def mipmap(self, mipmap not None : anon_struct2): + string.memcpy(&self._pvt_ptr[0].res.mipmap, mipmap.getPtr(), sizeof(self._pvt_ptr[0].res.mipmap)) + + @property - def dstDevice(self): - return self._ptr[0].dstDevice - @dstDevice.setter - def dstDevice(self, int dstDevice): - self._ptr[0].dstDevice = dstDevice + def linear(self): + return self._linear + @linear.setter + def linear(self, linear not None : anon_struct3): + string.memcpy(&self._pvt_ptr[0].res.linear, linear.getPtr(), sizeof(self._pvt_ptr[0].res.linear)) + + @property - def extent(self): - return self._extent - @extent.setter - def extent(self, extent not None : cudaExtent): - string.memcpy(&self._ptr[0].extent, extent.getPtr(), sizeof(self._ptr[0].extent)) -{{endif}} -{{if 'struct cudaMemsetParams' in found_types}} + def pitch2D(self): + return self._pitch2D + @pitch2D.setter + def pitch2D(self, pitch2D not None : anon_struct4): + string.memcpy(&self._pvt_ptr[0].res.pitch2D, pitch2D.getPtr(), sizeof(self._pvt_ptr[0].res.pitch2D)) -cdef class cudaMemsetParams: + + @property + def reserved(self): + return self._reserved + @reserved.setter + def reserved(self, reserved not None : anon_struct5): + string.memcpy(&self._pvt_ptr[0].res.reserved, reserved.getPtr(), sizeof(self._pvt_ptr[0].res.reserved)) + + +cdef class cudaResourceDesc: """ - CUDA Memset node parameters + CUDA resource descriptor Attributes ---------- - dst : Any - Destination device pointer - pitch : size_t - Pitch of destination device pointer. Unused if height is 1 - value : unsigned int - Value to be set - elementSize : unsigned int - Size of each element in bytes. Must be 1, 2, or 4. - width : size_t - Width of the row in elements - height : size_t - Number of rows + + resType : cudaResourceType + Resource type + + + res : anon_union0 + + + + flags : unsigned int + Flags (must be zero) + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._val_ptr = calloc(1, sizeof(cyruntime.cudaResourceDesc)) + self._pvt_ptr = self._val_ptr else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): pass + + self._res = anon_union0(_ptr=self._pvt_ptr) + def __dealloc__(self): - pass + if self._val_ptr is not NULL: + free(self._val_ptr) def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['dst : ' + hex(self.dst)] - except ValueError: - str_list += ['dst : '] - try: - str_list += ['pitch : ' + str(self.pitch)] - except ValueError: - str_list += ['pitch : '] - try: - str_list += ['value : ' + str(self.value)] - except ValueError: - str_list += ['value : '] - try: - str_list += ['elementSize : ' + str(self.elementSize)] + str_list += ['resType : ' + str(self.resType)] except ValueError: - str_list += ['elementSize : '] + str_list += ['resType : '] + + try: - str_list += ['width : ' + str(self.width)] + str_list += ['res :\n' + '\n'.join([' ' + line for line in str(self.res).splitlines()])] except ValueError: - str_list += ['width : '] + str_list += ['res : '] + + try: - str_list += ['height : ' + str(self.height)] + str_list += ['flags : ' + str(self.flags)] except ValueError: - str_list += ['height : '] + str_list += ['flags : '] + return '\n'.join(str_list) else: return '' + @property - def dst(self): - return self._ptr[0].dst - @dst.setter - def dst(self, dst): - _cdst = utils.HelperInputVoidPtr(dst) - self._ptr[0].dst = _cdst.cptr - @property - def pitch(self): - return self._ptr[0].pitch - @pitch.setter - def pitch(self, size_t pitch): - self._ptr[0].pitch = pitch - @property - def value(self): - return self._ptr[0].value - @value.setter - def value(self, unsigned int value): - self._ptr[0].value = value - @property - def elementSize(self): - return self._ptr[0].elementSize - @elementSize.setter - def elementSize(self, unsigned int elementSize): - self._ptr[0].elementSize = elementSize + def resType(self): + return cudaResourceType(self._pvt_ptr[0].resType) + @resType.setter + def resType(self, resType not None : cudaResourceType): + self._pvt_ptr[0].resType = int(resType) + + @property - def width(self): - return self._ptr[0].width - @width.setter - def width(self, size_t width): - self._ptr[0].width = width + def res(self): + return self._res + @res.setter + def res(self, res not None : anon_union0): + string.memcpy(&self._pvt_ptr[0].res, res.getPtr(), sizeof(self._pvt_ptr[0].res)) + + @property - def height(self): - return self._ptr[0].height - @height.setter - def height(self, size_t height): - self._ptr[0].height = height -{{endif}} -{{if 'struct cudaMemsetParamsV2' in found_types}} + def flags(self): + return self._pvt_ptr[0].flags + @flags.setter + def flags(self, unsigned int flags): + self._pvt_ptr[0].flags = flags -cdef class cudaMemsetParamsV2: + +cdef class cudaResourceViewDesc: """ - CUDA Memset node parameters + CUDA resource view descriptor Attributes ---------- - dst : Any - Destination device pointer - pitch : size_t - Pitch of destination device pointer. Unused if height is 1 - value : unsigned int - Value to be set - elementSize : unsigned int - Size of each element in bytes. Must be 1, 2, or 4. + + format : cudaResourceViewFormat + Resource view format + + width : size_t - Width of the row in elements + Width of the resource view + + height : size_t - Number of rows + Height of the resource view + + + depth : size_t + Depth of the resource view + + + firstMipmapLevel : unsigned int + First defined mipmap level + + + lastMipmapLevel : unsigned int + Last defined mipmap level + + + firstLayer : unsigned int + First layer index + + + lastLayer : unsigned int + Last layer index + + + reserved : list[unsigned int] + Must be zero + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): pass def __dealloc__(self): pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['dst : ' + hex(self.dst)] + str_list += ['format : ' + str(self.format)] except ValueError: - str_list += ['dst : '] + str_list += ['format : '] + + try: - str_list += ['pitch : ' + str(self.pitch)] + str_list += ['width : ' + str(self.width)] except ValueError: - str_list += ['pitch : '] + str_list += ['width : '] + + try: - str_list += ['value : ' + str(self.value)] + str_list += ['height : ' + str(self.height)] except ValueError: - str_list += ['value : '] + str_list += ['height : '] + + try: - str_list += ['elementSize : ' + str(self.elementSize)] + str_list += ['depth : ' + str(self.depth)] except ValueError: - str_list += ['elementSize : '] + str_list += ['depth : '] + + try: - str_list += ['width : ' + str(self.width)] + str_list += ['firstMipmapLevel : ' + str(self.firstMipmapLevel)] except ValueError: - str_list += ['width : '] + str_list += ['firstMipmapLevel : '] + + try: - str_list += ['height : ' + str(self.height)] + str_list += ['lastMipmapLevel : ' + str(self.lastMipmapLevel)] except ValueError: - str_list += ['height : '] + str_list += ['lastMipmapLevel : '] + + + try: + str_list += ['firstLayer : ' + str(self.firstLayer)] + except ValueError: + str_list += ['firstLayer : '] + + + try: + str_list += ['lastLayer : ' + str(self.lastLayer)] + except ValueError: + str_list += ['lastLayer : '] + + + try: + str_list += ['reserved : ' + str(self.reserved)] + except ValueError: + str_list += ['reserved : '] + return '\n'.join(str_list) else: return '' + @property - def dst(self): - return self._ptr[0].dst - @dst.setter - def dst(self, dst): - _cdst = utils.HelperInputVoidPtr(dst) - self._ptr[0].dst = _cdst.cptr + def format(self): + return cudaResourceViewFormat(self._pvt_ptr[0].format) + @format.setter + def format(self, format not None : cudaResourceViewFormat): + self._pvt_ptr[0].format = int(format) + + @property - def pitch(self): - return self._ptr[0].pitch - @pitch.setter - def pitch(self, size_t pitch): - self._ptr[0].pitch = pitch + def width(self): + return self._pvt_ptr[0].width + @width.setter + def width(self, size_t width): + self._pvt_ptr[0].width = width + + @property - def value(self): - return self._ptr[0].value - @value.setter - def value(self, unsigned int value): - self._ptr[0].value = value + def height(self): + return self._pvt_ptr[0].height + @height.setter + def height(self, size_t height): + self._pvt_ptr[0].height = height + + + @property + def depth(self): + return self._pvt_ptr[0].depth + @depth.setter + def depth(self, size_t depth): + self._pvt_ptr[0].depth = depth + + + @property + def firstMipmapLevel(self): + return self._pvt_ptr[0].firstMipmapLevel + @firstMipmapLevel.setter + def firstMipmapLevel(self, unsigned int firstMipmapLevel): + self._pvt_ptr[0].firstMipmapLevel = firstMipmapLevel + + + @property + def lastMipmapLevel(self): + return self._pvt_ptr[0].lastMipmapLevel + @lastMipmapLevel.setter + def lastMipmapLevel(self, unsigned int lastMipmapLevel): + self._pvt_ptr[0].lastMipmapLevel = lastMipmapLevel + + @property - def elementSize(self): - return self._ptr[0].elementSize - @elementSize.setter - def elementSize(self, unsigned int elementSize): - self._ptr[0].elementSize = elementSize + def firstLayer(self): + return self._pvt_ptr[0].firstLayer + @firstLayer.setter + def firstLayer(self, unsigned int firstLayer): + self._pvt_ptr[0].firstLayer = firstLayer + + @property - def width(self): - return self._ptr[0].width - @width.setter - def width(self, size_t width): - self._ptr[0].width = width + def lastLayer(self): + return self._pvt_ptr[0].lastLayer + @lastLayer.setter + def lastLayer(self, unsigned int lastLayer): + self._pvt_ptr[0].lastLayer = lastLayer + + @property - def height(self): - return self._ptr[0].height - @height.setter - def height(self, size_t height): - self._ptr[0].height = height -{{endif}} -{{if 'struct cudaAccessPolicyWindow' in found_types}} + def reserved(self): + return self._pvt_ptr[0].reserved + @reserved.setter + def reserved(self, reserved): + self._pvt_ptr[0].reserved = reserved -cdef class cudaAccessPolicyWindow: + +cdef class cudaPointerAttributes: """ - Specifies an access policy for a window, a contiguous extent of - memory beginning at base_ptr and ending at base_ptr + num_bytes. - Partition into many segments and assign segments such that. sum of - "hit segments" / window == approx. ratio. sum of "miss segments" / - window == approx 1-ratio. Segments and ratio specifications are - fitted to the capabilities of the architecture. Accesses in a hit - segment apply the hitProp access policy. Accesses in a miss segment - apply the missProp access policy. + CUDA pointer attributes Attributes ---------- - base_ptr : Any - Starting address of the access policy window. CUDA driver may align - it. - num_bytes : size_t - Size in bytes of the window policy. CUDA driver may restrict the - maximum size and alignment. - hitRatio : float - hitRatio specifies percentage of lines assigned hitProp, rest are - assigned missProp. - hitProp : cudaAccessProperty - ::CUaccessProperty set for hit. - missProp : cudaAccessProperty - ::CUaccessProperty set for miss. Must be either NORMAL or - STREAMING. + + type : cudaMemoryType + The type of memory - cudaMemoryTypeUnregistered, + cudaMemoryTypeHost, cudaMemoryTypeDevice or cudaMemoryTypeManaged. + + + device : int + The device against which the memory was allocated or registered. If + the memory type is cudaMemoryTypeDevice then this identifies the + device on which the memory referred physically resides. If the + memory type is cudaMemoryTypeHost or::cudaMemoryTypeManaged then + this identifies the device which was current when the memory was + allocated or registered (and if that device is deinitialized then + this allocation will vanish with that device's state). + + + devicePointer : Any + The address which may be dereferenced on the current device to + access the memory or NULL if no such address exists. + + + hostPointer : Any + The address which may be dereferenced on the host to access the + memory or NULL if no such address exists. CUDA doesn't check if + unregistered memory is allocated so this field may contain invalid + pointer if an invalid pointer has been passed to CUDA. + + + reserved : list[long] + Must be zero + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): pass def __dealloc__(self): pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['base_ptr : ' + hex(self.base_ptr)] + str_list += ['type : ' + str(self.type)] except ValueError: - str_list += ['base_ptr : '] + str_list += ['type : '] + + try: - str_list += ['num_bytes : ' + str(self.num_bytes)] + str_list += ['device : ' + str(self.device)] except ValueError: - str_list += ['num_bytes : '] + str_list += ['device : '] + + try: - str_list += ['hitRatio : ' + str(self.hitRatio)] + str_list += ['devicePointer : ' + hex(self.devicePointer)] except ValueError: - str_list += ['hitRatio : '] + str_list += ['devicePointer : '] + + try: - str_list += ['hitProp : ' + str(self.hitProp)] + str_list += ['hostPointer : ' + hex(self.hostPointer)] except ValueError: - str_list += ['hitProp : '] + str_list += ['hostPointer : '] + + try: - str_list += ['missProp : ' + str(self.missProp)] + str_list += ['reserved : ' + str(self.reserved)] except ValueError: - str_list += ['missProp : '] + str_list += ['reserved : '] + return '\n'.join(str_list) else: return '' + @property - def base_ptr(self): - return self._ptr[0].base_ptr - @base_ptr.setter - def base_ptr(self, base_ptr): - _cbase_ptr = utils.HelperInputVoidPtr(base_ptr) - self._ptr[0].base_ptr = _cbase_ptr.cptr + def type(self): + return cudaMemoryType(self._pvt_ptr[0].type) + @type.setter + def type(self, type not None : cudaMemoryType): + self._pvt_ptr[0].type = int(type) + + @property - def num_bytes(self): - return self._ptr[0].num_bytes - @num_bytes.setter - def num_bytes(self, size_t num_bytes): - self._ptr[0].num_bytes = num_bytes + def device(self): + return self._pvt_ptr[0].device + @device.setter + def device(self, int device): + self._pvt_ptr[0].device = device + + @property - def hitRatio(self): - return self._ptr[0].hitRatio - @hitRatio.setter - def hitRatio(self, float hitRatio): - self._ptr[0].hitRatio = hitRatio + def devicePointer(self): + return self._pvt_ptr[0].devicePointer + @devicePointer.setter + def devicePointer(self, devicePointer): + self._cydevicePointer = _HelperInputVoidPtr(devicePointer) + self._pvt_ptr[0].devicePointer = self._cydevicePointer.cptr + + @property - def hitProp(self): - return cudaAccessProperty(self._ptr[0].hitProp) - @hitProp.setter - def hitProp(self, hitProp not None : cudaAccessProperty): - self._ptr[0].hitProp = hitProp.value + def hostPointer(self): + return self._pvt_ptr[0].hostPointer + @hostPointer.setter + def hostPointer(self, hostPointer): + self._cyhostPointer = _HelperInputVoidPtr(hostPointer) + self._pvt_ptr[0].hostPointer = self._cyhostPointer.cptr + + @property - def missProp(self): - return cudaAccessProperty(self._ptr[0].missProp) - @missProp.setter - def missProp(self, missProp not None : cudaAccessProperty): - self._ptr[0].missProp = missProp.value -{{endif}} -{{if 'struct cudaHostNodeParams' in found_types}} + def reserved(self): + return self._pvt_ptr[0].reserved + @reserved.setter + def reserved(self, reserved): + self._pvt_ptr[0].reserved = reserved + + +cdef class cudaFuncAttributes: + """ + CUDA function attributes + + Attributes + ---------- + + sharedSizeBytes : size_t + The size in bytes of statically-allocated shared memory per block + required by this function. This does not include dynamically- + allocated shared memory requested by the user at runtime. + + + constSizeBytes : size_t + The size in bytes of user-allocated constant memory required by + this function. + + + localSizeBytes : size_t + The size in bytes of local memory used by each thread of this + function. + + + maxThreadsPerBlock : int + The maximum number of threads per block, beyond which a launch of + the function would fail. This number depends on both the function + and the device on which the function is currently loaded. + + + numRegs : int + The number of registers used by each thread of this function. + + + ptxVersion : int + The PTX virtual architecture version for which the function was + compiled. This value is the major PTX version * 10 + the minor PTX + version, so a PTX version 1.3 function would return the value 13. + + + binaryVersion : int + The binary architecture version for which the function was + compiled. This value is the major binary version * 10 + the minor + binary version, so a binary version 1.3 function would return the + value 13. + + + cacheModeCA : int + The attribute to indicate whether the function has been compiled + with user specified option "-Xptxas --dlcm=ca" set. + + + maxDynamicSharedSizeBytes : int + The maximum size in bytes of dynamic shared memory per block for + this function. Any launch must have a dynamic shared memory size + smaller than this value. + + + preferredShmemCarveout : int + On devices where the L1 cache and shared memory use the same + hardware resources, this sets the shared memory carveout + preference, in percent of the maximum shared memory. Refer to + cudaDevAttrMaxSharedMemoryPerMultiprocessor. This is only a hint, + and the driver can choose a different ratio if required to execute + the function. See cudaFuncSetAttribute + + + clusterDimMustBeSet : int + If this attribute is set, the kernel must launch with a valid + cluster dimension specified. + + + requiredClusterWidth : int + The required cluster width/height/depth in blocks. The values must + either all be 0 or all be positive. The validity of the cluster + dimensions is otherwise checked at launch time. If the value is + set during compile time, it cannot be set at runtime. Setting it at + runtime should return cudaErrorNotPermitted. See + cudaFuncSetAttribute + + + requiredClusterHeight : int + + + + requiredClusterDepth : int + + + + clusterSchedulingPolicyPreference : int + The block scheduling policy of a function. See cudaFuncSetAttribute + + + nonPortableClusterSizeAllowed : int + Whether the function can be launched with non-portable cluster + size. 1 is allowed, 0 is disallowed. A non-portable cluster size + may only function on the specific SKUs the program is tested on. + The launch might fail if the program is run on a different hardware + platform. CUDA API provides cudaOccupancyMaxActiveClusters to + assist with checking whether the desired size can be launched on + the current device. Portable Cluster Size A portable cluster size + is guaranteed to be functional on all compute capabilities higher + than the target compute capability. The portable cluster size for + sm_90 is 8 blocks per cluster. This value may increase for future + compute capabilities. The specific hardware unit may support + higher cluster sizes that’s not guaranteed to be portable. See + cudaFuncSetAttribute -cdef class cudaHostNodeParams: - """ - CUDA host node parameters - Attributes - ---------- - fn : cudaHostFn_t - The function to call when the node executes - userData : Any - Argument to pass to the function + deviceNodeUpdateStatus : int + Whether the function can be updated on device. 1 means device node + update is supported, 0 is unsupported or driver is too old to check + the value. + + + reserved1 : int + + + + reserved : list[int] + Reserved for future use. + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - self._fn = cudaHostFn_t(_ptr=&self._ptr[0].fn) + pass def __dealloc__(self): pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['fn : ' + str(self.fn)] + str_list += ['sharedSizeBytes : ' + str(self.sharedSizeBytes)] except ValueError: - str_list += ['fn : '] + str_list += ['sharedSizeBytes : '] + + try: - str_list += ['userData : ' + hex(self.userData)] + str_list += ['constSizeBytes : ' + str(self.constSizeBytes)] except ValueError: - str_list += ['userData : '] - return '\n'.join(str_list) - else: - return '' - @property - def fn(self): - return self._fn - @fn.setter - def fn(self, fn): - cdef ccudart.cudaHostFn_t cfn - if fn is None: - cfn = 0 - elif isinstance(fn, (cudaHostFn_t)): - pfn = int(fn) - cfn = pfn - else: - pfn = int(cudaHostFn_t(fn)) - cfn = pfn - self._fn._ptr[0] = cfn - @property - def userData(self): - return self._ptr[0].userData - @userData.setter - def userData(self, userData): - _cuserData = utils.HelperInputVoidPtr(userData) - self._ptr[0].userData = _cuserData.cptr -{{endif}} -{{if 'struct cudaHostNodeParamsV2' in found_types}} + str_list += ['constSizeBytes : '] -cdef class cudaHostNodeParamsV2: - """ - CUDA host node parameters - Attributes - ---------- - fn : cudaHostFn_t - The function to call when the node executes - userData : Any - Argument to pass to the function + try: + str_list += ['localSizeBytes : ' + str(self.localSizeBytes)] + except ValueError: + str_list += ['localSizeBytes : '] - Methods - ------- - getPtr() - Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - else: - self._ptr = _ptr - def __init__(self, void_ptr _ptr = 0): - self._fn = cudaHostFn_t(_ptr=&self._ptr[0].fn) - def __dealloc__(self): - pass - def getPtr(self): - return self._ptr - def __repr__(self): - if self._ptr is not NULL: - str_list = [] try: - str_list += ['fn : ' + str(self.fn)] + str_list += ['maxThreadsPerBlock : ' + str(self.maxThreadsPerBlock)] except ValueError: - str_list += ['fn : '] + str_list += ['maxThreadsPerBlock : '] + + try: - str_list += ['userData : ' + hex(self.userData)] + str_list += ['numRegs : ' + str(self.numRegs)] except ValueError: - str_list += ['userData : '] + str_list += ['numRegs : '] + + + try: + str_list += ['ptxVersion : ' + str(self.ptxVersion)] + except ValueError: + str_list += ['ptxVersion : '] + + + try: + str_list += ['binaryVersion : ' + str(self.binaryVersion)] + except ValueError: + str_list += ['binaryVersion : '] + + + try: + str_list += ['cacheModeCA : ' + str(self.cacheModeCA)] + except ValueError: + str_list += ['cacheModeCA : '] + + + try: + str_list += ['maxDynamicSharedSizeBytes : ' + str(self.maxDynamicSharedSizeBytes)] + except ValueError: + str_list += ['maxDynamicSharedSizeBytes : '] + + + try: + str_list += ['preferredShmemCarveout : ' + str(self.preferredShmemCarveout)] + except ValueError: + str_list += ['preferredShmemCarveout : '] + + + try: + str_list += ['clusterDimMustBeSet : ' + str(self.clusterDimMustBeSet)] + except ValueError: + str_list += ['clusterDimMustBeSet : '] + + + try: + str_list += ['requiredClusterWidth : ' + str(self.requiredClusterWidth)] + except ValueError: + str_list += ['requiredClusterWidth : '] + + + try: + str_list += ['requiredClusterHeight : ' + str(self.requiredClusterHeight)] + except ValueError: + str_list += ['requiredClusterHeight : '] + + + try: + str_list += ['requiredClusterDepth : ' + str(self.requiredClusterDepth)] + except ValueError: + str_list += ['requiredClusterDepth : '] + + + try: + str_list += ['clusterSchedulingPolicyPreference : ' + str(self.clusterSchedulingPolicyPreference)] + except ValueError: + str_list += ['clusterSchedulingPolicyPreference : '] + + + try: + str_list += ['nonPortableClusterSizeAllowed : ' + str(self.nonPortableClusterSizeAllowed)] + except ValueError: + str_list += ['nonPortableClusterSizeAllowed : '] + + + try: + str_list += ['deviceNodeUpdateStatus : ' + str(self.deviceNodeUpdateStatus)] + except ValueError: + str_list += ['deviceNodeUpdateStatus : '] + + + try: + str_list += ['reserved1 : ' + str(self.reserved1)] + except ValueError: + str_list += ['reserved1 : '] + + + try: + str_list += ['reserved : ' + str(self.reserved)] + except ValueError: + str_list += ['reserved : '] + return '\n'.join(str_list) else: return '' + @property - def fn(self): - return self._fn - @fn.setter - def fn(self, fn): - cdef ccudart.cudaHostFn_t cfn - if fn is None: - cfn = 0 - elif isinstance(fn, (cudaHostFn_t)): - pfn = int(fn) - cfn = pfn - else: - pfn = int(cudaHostFn_t(fn)) - cfn = pfn - self._fn._ptr[0] = cfn + def sharedSizeBytes(self): + return self._pvt_ptr[0].sharedSizeBytes + @sharedSizeBytes.setter + def sharedSizeBytes(self, size_t sharedSizeBytes): + self._pvt_ptr[0].sharedSizeBytes = sharedSizeBytes + + @property - def userData(self): - return self._ptr[0].userData - @userData.setter - def userData(self, userData): - _cuserData = utils.HelperInputVoidPtr(userData) - self._ptr[0].userData = _cuserData.cptr -{{endif}} -{{if 'struct cudaResourceDesc' in found_types}} + def constSizeBytes(self): + return self._pvt_ptr[0].constSizeBytes + @constSizeBytes.setter + def constSizeBytes(self, size_t constSizeBytes): + self._pvt_ptr[0].constSizeBytes = constSizeBytes + + + @property + def localSizeBytes(self): + return self._pvt_ptr[0].localSizeBytes + @localSizeBytes.setter + def localSizeBytes(self, size_t localSizeBytes): + self._pvt_ptr[0].localSizeBytes = localSizeBytes + + + @property + def maxThreadsPerBlock(self): + return self._pvt_ptr[0].maxThreadsPerBlock + @maxThreadsPerBlock.setter + def maxThreadsPerBlock(self, int maxThreadsPerBlock): + self._pvt_ptr[0].maxThreadsPerBlock = maxThreadsPerBlock + + + @property + def numRegs(self): + return self._pvt_ptr[0].numRegs + @numRegs.setter + def numRegs(self, int numRegs): + self._pvt_ptr[0].numRegs = numRegs + + + @property + def ptxVersion(self): + return self._pvt_ptr[0].ptxVersion + @ptxVersion.setter + def ptxVersion(self, int ptxVersion): + self._pvt_ptr[0].ptxVersion = ptxVersion + + + @property + def binaryVersion(self): + return self._pvt_ptr[0].binaryVersion + @binaryVersion.setter + def binaryVersion(self, int binaryVersion): + self._pvt_ptr[0].binaryVersion = binaryVersion + + + @property + def cacheModeCA(self): + return self._pvt_ptr[0].cacheModeCA + @cacheModeCA.setter + def cacheModeCA(self, int cacheModeCA): + self._pvt_ptr[0].cacheModeCA = cacheModeCA + + + @property + def maxDynamicSharedSizeBytes(self): + return self._pvt_ptr[0].maxDynamicSharedSizeBytes + @maxDynamicSharedSizeBytes.setter + def maxDynamicSharedSizeBytes(self, int maxDynamicSharedSizeBytes): + self._pvt_ptr[0].maxDynamicSharedSizeBytes = maxDynamicSharedSizeBytes + + + @property + def preferredShmemCarveout(self): + return self._pvt_ptr[0].preferredShmemCarveout + @preferredShmemCarveout.setter + def preferredShmemCarveout(self, int preferredShmemCarveout): + self._pvt_ptr[0].preferredShmemCarveout = preferredShmemCarveout + + + @property + def clusterDimMustBeSet(self): + return self._pvt_ptr[0].clusterDimMustBeSet + @clusterDimMustBeSet.setter + def clusterDimMustBeSet(self, int clusterDimMustBeSet): + self._pvt_ptr[0].clusterDimMustBeSet = clusterDimMustBeSet + + + @property + def requiredClusterWidth(self): + return self._pvt_ptr[0].requiredClusterWidth + @requiredClusterWidth.setter + def requiredClusterWidth(self, int requiredClusterWidth): + self._pvt_ptr[0].requiredClusterWidth = requiredClusterWidth + + + @property + def requiredClusterHeight(self): + return self._pvt_ptr[0].requiredClusterHeight + @requiredClusterHeight.setter + def requiredClusterHeight(self, int requiredClusterHeight): + self._pvt_ptr[0].requiredClusterHeight = requiredClusterHeight -cdef class anon_struct1: - """ - Attributes - ---------- - array : cudaArray_t + @property + def requiredClusterDepth(self): + return self._pvt_ptr[0].requiredClusterDepth + @requiredClusterDepth.setter + def requiredClusterDepth(self, int requiredClusterDepth): + self._pvt_ptr[0].requiredClusterDepth = requiredClusterDepth - Methods - ------- - getPtr() - Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr + @property + def clusterSchedulingPolicyPreference(self): + return self._pvt_ptr[0].clusterSchedulingPolicyPreference + @clusterSchedulingPolicyPreference.setter + def clusterSchedulingPolicyPreference(self, int clusterSchedulingPolicyPreference): + self._pvt_ptr[0].clusterSchedulingPolicyPreference = clusterSchedulingPolicyPreference + - def __init__(self, void_ptr _ptr): - self._array = cudaArray_t(_ptr=&self._ptr[0].res.array.array) - def __dealloc__(self): - pass - def getPtr(self): - return &self._ptr[0].res.array - def __repr__(self): - if self._ptr is not NULL: - str_list = [] - try: - str_list += ['array : ' + str(self.array)] - except ValueError: - str_list += ['array : '] - return '\n'.join(str_list) - else: - return '' @property - def array(self): - return self._array - @array.setter - def array(self, array): - cdef ccudart.cudaArray_t carray - if array is None: - carray = 0 - elif isinstance(array, (cudaArray_t,)): - parray = int(array) - carray = parray - else: - parray = int(cudaArray_t(array)) - carray = parray - self._array._ptr[0] = carray -{{endif}} -{{if 'struct cudaResourceDesc' in found_types}} + def nonPortableClusterSizeAllowed(self): + return self._pvt_ptr[0].nonPortableClusterSizeAllowed + @nonPortableClusterSizeAllowed.setter + def nonPortableClusterSizeAllowed(self, int nonPortableClusterSizeAllowed): + self._pvt_ptr[0].nonPortableClusterSizeAllowed = nonPortableClusterSizeAllowed -cdef class anon_struct2: - """ - Attributes - ---------- - mipmap : cudaMipmappedArray_t + @property + def deviceNodeUpdateStatus(self): + return self._pvt_ptr[0].deviceNodeUpdateStatus + @deviceNodeUpdateStatus.setter + def deviceNodeUpdateStatus(self, int deviceNodeUpdateStatus): + self._pvt_ptr[0].deviceNodeUpdateStatus = deviceNodeUpdateStatus - Methods - ------- - getPtr() - Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr + @property + def reserved1(self): + return self._pvt_ptr[0].reserved1 + @reserved1.setter + def reserved1(self, int reserved1): + self._pvt_ptr[0].reserved1 = reserved1 + - def __init__(self, void_ptr _ptr): - self._mipmap = cudaMipmappedArray_t(_ptr=&self._ptr[0].res.mipmap.mipmap) - def __dealloc__(self): - pass - def getPtr(self): - return &self._ptr[0].res.mipmap - def __repr__(self): - if self._ptr is not NULL: - str_list = [] - try: - str_list += ['mipmap : ' + str(self.mipmap)] - except ValueError: - str_list += ['mipmap : '] - return '\n'.join(str_list) - else: - return '' @property - def mipmap(self): - return self._mipmap - @mipmap.setter - def mipmap(self, mipmap): - cdef ccudart.cudaMipmappedArray_t cmipmap - if mipmap is None: - cmipmap = 0 - elif isinstance(mipmap, (cudaMipmappedArray_t,)): - pmipmap = int(mipmap) - cmipmap = pmipmap - else: - pmipmap = int(cudaMipmappedArray_t(mipmap)) - cmipmap = pmipmap - self._mipmap._ptr[0] = cmipmap -{{endif}} -{{if 'struct cudaResourceDesc' in found_types}} + def reserved(self): + return self._pvt_ptr[0].reserved + @reserved.setter + def reserved(self, reserved): + self._pvt_ptr[0].reserved = reserved -cdef class anon_struct3: + +cdef class cudaMemLocation: """ + Specifies a memory location. To specify a gpu, set type = + cudaMemLocationTypeDevice and set id = the gpu's device ordinal. To + specify a cpu NUMA node, set type = cudaMemLocationTypeHostNuma and + set id = host NUMA node id. + Attributes ---------- - devPtr : Any - desc : cudaChannelFormatDesc + type : cudaMemLocationType + Specifies the location type, which modifies the meaning of id. - sizeInBytes : size_t + + id : int + Identifier for cudaMemLocationType::cudaMemLocationTypeDevice, + cudaMemLocationType::cudaMemLocationTypeHost, or + cudaMemLocationType::cudaMemLocationTypeHostNuma. Methods ------- getPtr() Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr - - def __init__(self, void_ptr _ptr): - self._desc = cudaChannelFormatDesc(_ptr=&self._ptr[0].res.linear.desc) - def __dealloc__(self): + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._val_ptr = calloc(1, sizeof(cyruntime.cudaMemLocation)) + self._pvt_ptr = self._val_ptr + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): pass + def __dealloc__(self): + if self._val_ptr is not NULL: + free(self._val_ptr) def getPtr(self): - return &self._ptr[0].res.linear + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['devPtr : ' + hex(self.devPtr)] - except ValueError: - str_list += ['devPtr : '] - try: - str_list += ['desc :\n' + '\n'.join([' ' + line for line in str(self.desc).splitlines()])] + str_list += ['type : ' + str(self.type)] except ValueError: - str_list += ['desc : '] + str_list += ['type : '] + + try: - str_list += ['sizeInBytes : ' + str(self.sizeInBytes)] + str_list += ['id : ' + str(self.id)] except ValueError: - str_list += ['sizeInBytes : '] + str_list += ['id : '] + return '\n'.join(str_list) else: return '' + @property - def devPtr(self): - return self._ptr[0].res.linear.devPtr - @devPtr.setter - def devPtr(self, devPtr): - _cdevPtr = utils.HelperInputVoidPtr(devPtr) - self._ptr[0].res.linear.devPtr = _cdevPtr.cptr - @property - def desc(self): - return self._desc - @desc.setter - def desc(self, desc not None : cudaChannelFormatDesc): - string.memcpy(&self._ptr[0].res.linear.desc, desc.getPtr(), sizeof(self._ptr[0].res.linear.desc)) + def type(self): + return cudaMemLocationType(self._pvt_ptr[0].type) + @type.setter + def type(self, type not None : cudaMemLocationType): + self._pvt_ptr[0].type = int(type) + + @property - def sizeInBytes(self): - return self._ptr[0].res.linear.sizeInBytes - @sizeInBytes.setter - def sizeInBytes(self, size_t sizeInBytes): - self._ptr[0].res.linear.sizeInBytes = sizeInBytes -{{endif}} -{{if 'struct cudaResourceDesc' in found_types}} + def id(self): + return self._pvt_ptr[0].id + @id.setter + def id(self, int id): + self._pvt_ptr[0].id = id -cdef class anon_struct4: + +cdef class cudaMemAccessDesc: """ + Memory access descriptor + Attributes ---------- - devPtr : Any - desc : cudaChannelFormatDesc - - width : size_t + location : cudaMemLocation + Location on which the request is to change it's accessibility - height : size_t - pitchInBytes : size_t + flags : cudaMemAccessFlags + ::CUmemProt accessibility flags to set on the request Methods ------- getPtr() Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass + + self._location = cudaMemLocation(_ptr=&self._pvt_ptr[0].location) - def __init__(self, void_ptr _ptr): - self._desc = cudaChannelFormatDesc(_ptr=&self._ptr[0].res.pitch2D.desc) def __dealloc__(self): pass def getPtr(self): - return &self._ptr[0].res.pitch2D + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['devPtr : ' + hex(self.devPtr)] - except ValueError: - str_list += ['devPtr : '] - try: - str_list += ['desc :\n' + '\n'.join([' ' + line for line in str(self.desc).splitlines()])] - except ValueError: - str_list += ['desc : '] - try: - str_list += ['width : ' + str(self.width)] - except ValueError: - str_list += ['width : '] - try: - str_list += ['height : ' + str(self.height)] + str_list += ['location :\n' + '\n'.join([' ' + line for line in str(self.location).splitlines()])] except ValueError: - str_list += ['height : '] + str_list += ['location : '] + + try: - str_list += ['pitchInBytes : ' + str(self.pitchInBytes)] + str_list += ['flags : ' + str(self.flags)] except ValueError: - str_list += ['pitchInBytes : '] + str_list += ['flags : '] + return '\n'.join(str_list) else: return '' + @property - def devPtr(self): - return self._ptr[0].res.pitch2D.devPtr - @devPtr.setter - def devPtr(self, devPtr): - _cdevPtr = utils.HelperInputVoidPtr(devPtr) - self._ptr[0].res.pitch2D.devPtr = _cdevPtr.cptr - @property - def desc(self): - return self._desc - @desc.setter - def desc(self, desc not None : cudaChannelFormatDesc): - string.memcpy(&self._ptr[0].res.pitch2D.desc, desc.getPtr(), sizeof(self._ptr[0].res.pitch2D.desc)) - @property - def width(self): - return self._ptr[0].res.pitch2D.width - @width.setter - def width(self, size_t width): - self._ptr[0].res.pitch2D.width = width - @property - def height(self): - return self._ptr[0].res.pitch2D.height - @height.setter - def height(self, size_t height): - self._ptr[0].res.pitch2D.height = height + def location(self): + return self._location + @location.setter + def location(self, location not None : cudaMemLocation): + string.memcpy(&self._pvt_ptr[0].location, location.getPtr(), sizeof(self._pvt_ptr[0].location)) + + @property - def pitchInBytes(self): - return self._ptr[0].res.pitch2D.pitchInBytes - @pitchInBytes.setter - def pitchInBytes(self, size_t pitchInBytes): - self._ptr[0].res.pitch2D.pitchInBytes = pitchInBytes -{{endif}} -{{if 'struct cudaResourceDesc' in found_types}} + def flags(self): + return cudaMemAccessFlags(self._pvt_ptr[0].flags) + @flags.setter + def flags(self, flags not None : cudaMemAccessFlags): + self._pvt_ptr[0].flags = int(flags) -cdef class anon_union0: + +cdef class cudaMemPoolProps: """ + Specifies the properties of allocations made from the pool. + Attributes ---------- - array : anon_struct1 - mipmap : anon_struct2 + allocType : cudaMemAllocationType + Allocation type. Currently must be specified as + cudaMemAllocationTypePinned + + + handleTypes : cudaMemAllocationHandleType + Handle types that will be supported by allocations from the pool. + + + location : cudaMemLocation + Location allocations should reside. + + + win32SecurityAttributes : Any + Windows-specific LPSECURITYATTRIBUTES required when + cudaMemHandleTypeWin32 is specified. This security attribute + defines the scope of which exported allocations may be tranferred + to other processes. In all other cases, this field is required to + be zero. + + + maxSize : size_t + Maximum pool size. When set to 0, defaults to a system dependent + value. + - linear : anon_struct3 + usage : unsigned short + Bitmask indicating intended usage for the pool. - pitch2D : anon_struct4 + + reserved : bytes + reserved for future use, must be 0 Methods ------- getPtr() Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass + + self._location = cudaMemLocation(_ptr=&self._pvt_ptr[0].location) - def __init__(self, void_ptr _ptr): - self._array = anon_struct1(_ptr=self._ptr) - self._mipmap = anon_struct2(_ptr=self._ptr) - self._linear = anon_struct3(_ptr=self._ptr) - self._pitch2D = anon_struct4(_ptr=self._ptr) def __dealloc__(self): pass def getPtr(self): - return &self._ptr[0].res + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['array :\n' + '\n'.join([' ' + line for line in str(self.array).splitlines()])] + str_list += ['allocType : ' + str(self.allocType)] except ValueError: - str_list += ['array : '] + str_list += ['allocType : '] + + try: - str_list += ['mipmap :\n' + '\n'.join([' ' + line for line in str(self.mipmap).splitlines()])] + str_list += ['handleTypes : ' + str(self.handleTypes)] except ValueError: - str_list += ['mipmap : '] + str_list += ['handleTypes : '] + + try: - str_list += ['linear :\n' + '\n'.join([' ' + line for line in str(self.linear).splitlines()])] + str_list += ['location :\n' + '\n'.join([' ' + line for line in str(self.location).splitlines()])] except ValueError: - str_list += ['linear : '] + str_list += ['location : '] + + try: - str_list += ['pitch2D :\n' + '\n'.join([' ' + line for line in str(self.pitch2D).splitlines()])] + str_list += ['win32SecurityAttributes : ' + hex(self.win32SecurityAttributes)] except ValueError: - str_list += ['pitch2D : '] + str_list += ['win32SecurityAttributes : '] + + + try: + str_list += ['maxSize : ' + str(self.maxSize)] + except ValueError: + str_list += ['maxSize : '] + + + try: + str_list += ['usage : ' + str(self.usage)] + except ValueError: + str_list += ['usage : '] + + + try: + str_list += ['reserved : ' + str(self.reserved)] + except ValueError: + str_list += ['reserved : '] + return '\n'.join(str_list) else: return '' + @property - def array(self): - return self._array - @array.setter - def array(self, array not None : anon_struct1): - string.memcpy(&self._ptr[0].res.array, array.getPtr(), sizeof(self._ptr[0].res.array)) + def allocType(self): + return cudaMemAllocationType(self._pvt_ptr[0].allocType) + @allocType.setter + def allocType(self, allocType not None : cudaMemAllocationType): + self._pvt_ptr[0].allocType = int(allocType) + + @property - def mipmap(self): - return self._mipmap - @mipmap.setter - def mipmap(self, mipmap not None : anon_struct2): - string.memcpy(&self._ptr[0].res.mipmap, mipmap.getPtr(), sizeof(self._ptr[0].res.mipmap)) + def handleTypes(self): + return cudaMemAllocationHandleType(self._pvt_ptr[0].handleTypes) + @handleTypes.setter + def handleTypes(self, handleTypes not None : cudaMemAllocationHandleType): + self._pvt_ptr[0].handleTypes = int(handleTypes) + + @property - def linear(self): - return self._linear - @linear.setter - def linear(self, linear not None : anon_struct3): - string.memcpy(&self._ptr[0].res.linear, linear.getPtr(), sizeof(self._ptr[0].res.linear)) + def location(self): + return self._location + @location.setter + def location(self, location not None : cudaMemLocation): + string.memcpy(&self._pvt_ptr[0].location, location.getPtr(), sizeof(self._pvt_ptr[0].location)) + + @property - def pitch2D(self): - return self._pitch2D - @pitch2D.setter - def pitch2D(self, pitch2D not None : anon_struct4): - string.memcpy(&self._ptr[0].res.pitch2D, pitch2D.getPtr(), sizeof(self._ptr[0].res.pitch2D)) -{{endif}} -{{if 'struct cudaResourceDesc' in found_types}} + def win32SecurityAttributes(self): + return self._pvt_ptr[0].win32SecurityAttributes + @win32SecurityAttributes.setter + def win32SecurityAttributes(self, win32SecurityAttributes): + self._cywin32SecurityAttributes = _HelperInputVoidPtr(win32SecurityAttributes) + self._pvt_ptr[0].win32SecurityAttributes = self._cywin32SecurityAttributes.cptr -cdef class cudaResourceDesc: + + @property + def maxSize(self): + return self._pvt_ptr[0].maxSize + @maxSize.setter + def maxSize(self, size_t maxSize): + self._pvt_ptr[0].maxSize = maxSize + + + @property + def usage(self): + return self._pvt_ptr[0].usage + @usage.setter + def usage(self, unsigned short usage): + self._pvt_ptr[0].usage = usage + + + @property + def reserved(self): + return PyBytes_FromStringAndSize(self._pvt_ptr[0].reserved, 54) + @reserved.setter + def reserved(self, reserved): + if len(reserved) != 54: + raise ValueError("reserved length must be 54, is " + str(len(reserved))) + for i, b in enumerate(reserved): + self._pvt_ptr[0].reserved[i] = b + + +cdef class cudaMemPoolPtrExportData: """ - CUDA resource descriptor + Opaque data for exporting a pool allocation Attributes ---------- - resType : cudaResourceType - Resource type - res : anon_union0 + + reserved : bytes + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._val_ptr = calloc(1, sizeof(ccudart.cudaResourceDesc)) - self._ptr = self._val_ptr + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - self._res = anon_union0(_ptr=self._ptr) + pass def __dealloc__(self): - if self._val_ptr is not NULL: - free(self._val_ptr) + pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['resType : ' + str(self.resType)] - except ValueError: - str_list += ['resType : '] - try: - str_list += ['res :\n' + '\n'.join([' ' + line for line in str(self.res).splitlines()])] + str_list += ['reserved : ' + str(self.reserved)] except ValueError: - str_list += ['res : '] + str_list += ['reserved : '] + return '\n'.join(str_list) else: return '' + @property - def resType(self): - return cudaResourceType(self._ptr[0].resType) - @resType.setter - def resType(self, resType not None : cudaResourceType): - self._ptr[0].resType = resType.value - @property - def res(self): - return self._res - @res.setter - def res(self, res not None : anon_union0): - string.memcpy(&self._ptr[0].res, res.getPtr(), sizeof(self._ptr[0].res)) -{{endif}} -{{if 'struct cudaResourceViewDesc' in found_types}} + def reserved(self): + return PyBytes_FromStringAndSize(self._pvt_ptr[0].reserved, 64) + @reserved.setter + def reserved(self, reserved): + if len(reserved) != 64: + raise ValueError("reserved length must be 64, is " + str(len(reserved))) + for i, b in enumerate(reserved): + self._pvt_ptr[0].reserved[i] = b -cdef class cudaResourceViewDesc: + +cdef class cudaMemAllocNodeParams: """ - CUDA resource view descriptor + Memory allocation node parameters Attributes ---------- - format : cudaResourceViewFormat - Resource view format - width : size_t - Width of the resource view - height : size_t - Height of the resource view - depth : size_t - Depth of the resource view - firstMipmapLevel : unsigned int - First defined mipmap level - lastMipmapLevel : unsigned int - Last defined mipmap level - firstLayer : unsigned int - First layer index - lastLayer : unsigned int - Last layer index + + poolProps : cudaMemPoolProps + in: location where the allocation should reside (specified in + ::location). ::handleTypes must be cudaMemHandleTypeNone. IPC is + not supported. in: array of memory access descriptors. Used to + describe peer GPU access + + + accessDescs : cudaMemAccessDesc + in: number of memory access descriptors. Must not exceed the number + of GPUs. + + + accessDescCount : size_t + in: Number of `accessDescs`s + + + bytesize : size_t + in: size in bytes of the requested allocation + + + dptr : Any + out: address of the allocation returned by CUDA + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): pass + + self._poolProps = cudaMemPoolProps(_ptr=&self._pvt_ptr[0].poolProps) + def __dealloc__(self): pass + + if self._accessDescs is not NULL: + free(self._accessDescs) + self._pvt_ptr[0].accessDescs = NULL + def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['format : ' + str(self.format)] - except ValueError: - str_list += ['format : '] - try: - str_list += ['width : ' + str(self.width)] - except ValueError: - str_list += ['width : '] - try: - str_list += ['height : ' + str(self.height)] - except ValueError: - str_list += ['height : '] - try: - str_list += ['depth : ' + str(self.depth)] + str_list += ['poolProps :\n' + '\n'.join([' ' + line for line in str(self.poolProps).splitlines()])] except ValueError: - str_list += ['depth : '] + str_list += ['poolProps : '] + + try: - str_list += ['firstMipmapLevel : ' + str(self.firstMipmapLevel)] + str_list += ['accessDescs : ' + str(self.accessDescs)] except ValueError: - str_list += ['firstMipmapLevel : '] + str_list += ['accessDescs : '] + + try: - str_list += ['lastMipmapLevel : ' + str(self.lastMipmapLevel)] + str_list += ['accessDescCount : ' + str(self.accessDescCount)] except ValueError: - str_list += ['lastMipmapLevel : '] + str_list += ['accessDescCount : '] + + try: - str_list += ['firstLayer : ' + str(self.firstLayer)] + str_list += ['bytesize : ' + str(self.bytesize)] except ValueError: - str_list += ['firstLayer : '] + str_list += ['bytesize : '] + + try: - str_list += ['lastLayer : ' + str(self.lastLayer)] + str_list += ['dptr : ' + hex(self.dptr)] except ValueError: - str_list += ['lastLayer : '] + str_list += ['dptr : '] + return '\n'.join(str_list) else: return '' + @property - def format(self): - return cudaResourceViewFormat(self._ptr[0].format) - @format.setter - def format(self, format not None : cudaResourceViewFormat): - self._ptr[0].format = format.value - @property - def width(self): - return self._ptr[0].width - @width.setter - def width(self, size_t width): - self._ptr[0].width = width - @property - def height(self): - return self._ptr[0].height - @height.setter - def height(self, size_t height): - self._ptr[0].height = height - @property - def depth(self): - return self._ptr[0].depth - @depth.setter - def depth(self, size_t depth): - self._ptr[0].depth = depth + def poolProps(self): + return self._poolProps + @poolProps.setter + def poolProps(self, poolProps not None : cudaMemPoolProps): + string.memcpy(&self._pvt_ptr[0].poolProps, poolProps.getPtr(), sizeof(self._pvt_ptr[0].poolProps)) + + @property - def firstMipmapLevel(self): - return self._ptr[0].firstMipmapLevel - @firstMipmapLevel.setter - def firstMipmapLevel(self, unsigned int firstMipmapLevel): - self._ptr[0].firstMipmapLevel = firstMipmapLevel + def accessDescs(self): + arrs = [self._pvt_ptr[0].accessDescs + x*sizeof(cyruntime.cudaMemAccessDesc) for x in range(self._accessDescs_length)] + return [cudaMemAccessDesc(_ptr=arr) for arr in arrs] + @accessDescs.setter + def accessDescs(self, val): + if len(val) == 0: + free(self._accessDescs) + self._accessDescs = NULL + self._accessDescs_length = 0 + self._pvt_ptr[0].accessDescs = NULL + else: + if self._accessDescs_length != len(val): + free(self._accessDescs) + self._accessDescs = calloc(len(val), sizeof(cyruntime.cudaMemAccessDesc)) + if self._accessDescs is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(cyruntime.cudaMemAccessDesc))) + self._accessDescs_length = len(val) + self._pvt_ptr[0].accessDescs = self._accessDescs + for idx in range(len(val)): + string.memcpy(&self._accessDescs[idx], (val[idx])._pvt_ptr, sizeof(cyruntime.cudaMemAccessDesc)) + + + @property - def lastMipmapLevel(self): - return self._ptr[0].lastMipmapLevel - @lastMipmapLevel.setter - def lastMipmapLevel(self, unsigned int lastMipmapLevel): - self._ptr[0].lastMipmapLevel = lastMipmapLevel + def accessDescCount(self): + return self._pvt_ptr[0].accessDescCount + @accessDescCount.setter + def accessDescCount(self, size_t accessDescCount): + self._pvt_ptr[0].accessDescCount = accessDescCount + + @property - def firstLayer(self): - return self._ptr[0].firstLayer - @firstLayer.setter - def firstLayer(self, unsigned int firstLayer): - self._ptr[0].firstLayer = firstLayer + def bytesize(self): + return self._pvt_ptr[0].bytesize + @bytesize.setter + def bytesize(self, size_t bytesize): + self._pvt_ptr[0].bytesize = bytesize + + @property - def lastLayer(self): - return self._ptr[0].lastLayer - @lastLayer.setter - def lastLayer(self, unsigned int lastLayer): - self._ptr[0].lastLayer = lastLayer -{{endif}} -{{if 'struct cudaPointerAttributes' in found_types}} + def dptr(self): + return self._pvt_ptr[0].dptr + @dptr.setter + def dptr(self, dptr): + self._cydptr = _HelperInputVoidPtr(dptr) + self._pvt_ptr[0].dptr = self._cydptr.cptr -cdef class cudaPointerAttributes: + +cdef class cudaMemAllocNodeParamsV2: """ - CUDA pointer attributes + Memory allocation node parameters Attributes ---------- - type : cudaMemoryType - The type of memory - cudaMemoryTypeUnregistered, - cudaMemoryTypeHost, cudaMemoryTypeDevice or cudaMemoryTypeManaged. - device : int - The device against which the memory was allocated or registered. If - the memory type is cudaMemoryTypeDevice then this identifies the - device on which the memory referred physically resides. If the - memory type is cudaMemoryTypeHost or::cudaMemoryTypeManaged then - this identifies the device which was current when the memory was - allocated or registered (and if that device is deinitialized then - this allocation will vanish with that device's state). - devicePointer : Any - The address which may be dereferenced on the current device to - access the memory or NULL if no such address exists. - hostPointer : Any - The address which may be dereferenced on the host to access the - memory or NULL if no such address exists. CUDA doesn't check if - unregistered memory is allocated so this field may contain invalid - pointer if an invalid pointer has been passed to CUDA. + + poolProps : cudaMemPoolProps + in: location where the allocation should reside (specified in + ::location). ::handleTypes must be cudaMemHandleTypeNone. IPC is + not supported. in: array of memory access descriptors. Used to + describe peer GPU access + + + accessDescs : cudaMemAccessDesc + in: number of memory access descriptors. Must not exceed the number + of GPUs. + + + accessDescCount : size_t + in: Number of `accessDescs`s + + + bytesize : size_t + in: size in bytes of the requested allocation + + + dptr : Any + out: address of the allocation returned by CUDA + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): pass + + self._poolProps = cudaMemPoolProps(_ptr=&self._pvt_ptr[0].poolProps) + def __dealloc__(self): pass + + if self._accessDescs is not NULL: + free(self._accessDescs) + self._pvt_ptr[0].accessDescs = NULL + def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['type : ' + str(self.type)] + str_list += ['poolProps :\n' + '\n'.join([' ' + line for line in str(self.poolProps).splitlines()])] except ValueError: - str_list += ['type : '] + str_list += ['poolProps : '] + + try: - str_list += ['device : ' + str(self.device)] + str_list += ['accessDescs : ' + str(self.accessDescs)] except ValueError: - str_list += ['device : '] + str_list += ['accessDescs : '] + + try: - str_list += ['devicePointer : ' + hex(self.devicePointer)] + str_list += ['accessDescCount : ' + str(self.accessDescCount)] except ValueError: - str_list += ['devicePointer : '] + str_list += ['accessDescCount : '] + + try: - str_list += ['hostPointer : ' + hex(self.hostPointer)] + str_list += ['bytesize : ' + str(self.bytesize)] except ValueError: - str_list += ['hostPointer : '] + str_list += ['bytesize : '] + + + try: + str_list += ['dptr : ' + hex(self.dptr)] + except ValueError: + str_list += ['dptr : '] + return '\n'.join(str_list) else: return '' + @property - def type(self): - return cudaMemoryType(self._ptr[0].type) - @type.setter - def type(self, type not None : cudaMemoryType): - self._ptr[0].type = type.value - @property - def device(self): - return self._ptr[0].device - @device.setter - def device(self, int device): - self._ptr[0].device = device + def poolProps(self): + return self._poolProps + @poolProps.setter + def poolProps(self, poolProps not None : cudaMemPoolProps): + string.memcpy(&self._pvt_ptr[0].poolProps, poolProps.getPtr(), sizeof(self._pvt_ptr[0].poolProps)) + + @property - def devicePointer(self): - return self._ptr[0].devicePointer - @devicePointer.setter - def devicePointer(self, devicePointer): - _cdevicePointer = utils.HelperInputVoidPtr(devicePointer) - self._ptr[0].devicePointer = _cdevicePointer.cptr + def accessDescs(self): + arrs = [self._pvt_ptr[0].accessDescs + x*sizeof(cyruntime.cudaMemAccessDesc) for x in range(self._accessDescs_length)] + return [cudaMemAccessDesc(_ptr=arr) for arr in arrs] + @accessDescs.setter + def accessDescs(self, val): + if len(val) == 0: + free(self._accessDescs) + self._accessDescs = NULL + self._accessDescs_length = 0 + self._pvt_ptr[0].accessDescs = NULL + else: + if self._accessDescs_length != len(val): + free(self._accessDescs) + self._accessDescs = calloc(len(val), sizeof(cyruntime.cudaMemAccessDesc)) + if self._accessDescs is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(cyruntime.cudaMemAccessDesc))) + self._accessDescs_length = len(val) + self._pvt_ptr[0].accessDescs = self._accessDescs + for idx in range(len(val)): + string.memcpy(&self._accessDescs[idx], (val[idx])._pvt_ptr, sizeof(cyruntime.cudaMemAccessDesc)) + + + @property - def hostPointer(self): - return self._ptr[0].hostPointer - @hostPointer.setter - def hostPointer(self, hostPointer): - _chostPointer = utils.HelperInputVoidPtr(hostPointer) - self._ptr[0].hostPointer = _chostPointer.cptr -{{endif}} -{{if 'struct cudaFuncAttributes' in found_types}} + def accessDescCount(self): + return self._pvt_ptr[0].accessDescCount + @accessDescCount.setter + def accessDescCount(self, size_t accessDescCount): + self._pvt_ptr[0].accessDescCount = accessDescCount -cdef class cudaFuncAttributes: - """ - CUDA function attributes - Attributes - ---------- - sharedSizeBytes : size_t - The size in bytes of statically-allocated shared memory per block - required by this function. This does not include dynamically- - allocated shared memory requested by the user at runtime. - constSizeBytes : size_t - The size in bytes of user-allocated constant memory required by - this function. - localSizeBytes : size_t - The size in bytes of local memory used by each thread of this - function. - maxThreadsPerBlock : int - The maximum number of threads per block, beyond which a launch of - the function would fail. This number depends on both the function - and the device on which the function is currently loaded. - numRegs : int - The number of registers used by each thread of this function. - ptxVersion : int - The PTX virtual architecture version for which the function was - compiled. This value is the major PTX version * 10 + the minor PTX - version, so a PTX version 1.3 function would return the value 13. - binaryVersion : int - The binary architecture version for which the function was - compiled. This value is the major binary version * 10 + the minor - binary version, so a binary version 1.3 function would return the - value 13. - cacheModeCA : int - The attribute to indicate whether the function has been compiled - with user specified option "-Xptxas --dlcm=ca" set. - maxDynamicSharedSizeBytes : int - The maximum size in bytes of dynamic shared memory per block for - this function. Any launch must have a dynamic shared memory size - smaller than this value. - preferredShmemCarveout : int - On devices where the L1 cache and shared memory use the same - hardware resources, this sets the shared memory carveout - preference, in percent of the maximum shared memory. Refer to - cudaDevAttrMaxSharedMemoryPerMultiprocessor. This is only a hint, - and the driver can choose a different ratio if required to execute - the function. See cudaFuncSetAttribute - clusterDimMustBeSet : int - If this attribute is set, the kernel must launch with a valid - cluster dimension specified. - requiredClusterWidth : int - The required cluster width/height/depth in blocks. The values must - either all be 0 or all be positive. The validity of the cluster - dimensions is otherwise checked at launch time. If the value is - set during compile time, it cannot be set at runtime. Setting it at - runtime should return cudaErrorNotPermitted. See - cudaFuncSetAttribute - requiredClusterHeight : int + @property + def bytesize(self): + return self._pvt_ptr[0].bytesize + @bytesize.setter + def bytesize(self, size_t bytesize): + self._pvt_ptr[0].bytesize = bytesize - requiredClusterDepth : int - clusterSchedulingPolicyPreference : int - The block scheduling policy of a function. See cudaFuncSetAttribute - nonPortableClusterSizeAllowed : int - Whether the function can be launched with non-portable cluster - size. 1 is allowed, 0 is disallowed. A non-portable cluster size - may only function on the specific SKUs the program is tested on. - The launch might fail if the program is run on a different hardware - platform. CUDA API provides cudaOccupancyMaxActiveClusters to - assist with checking whether the desired size can be launched on - the current device. Portable Cluster Size A portable cluster size - is guaranteed to be functional on all compute capabilities higher - than the target compute capability. The portable cluster size for - sm_90 is 8 blocks per cluster. This value may increase for future - compute capabilities. The specific hardware unit may support - higher cluster sizes that’s not guaranteed to be portable. See - cudaFuncSetAttribute - reserved : List[int] - Reserved for future use. + @property + def dptr(self): + return self._pvt_ptr[0].dptr + @dptr.setter + def dptr(self, dptr): + self._cydptr = _HelperInputVoidPtr(dptr) + self._pvt_ptr[0].dptr = self._cydptr.cptr + + +cdef class cudaMemFreeNodeParams: + """ + Memory free node parameters + + Attributes + ---------- + + dptr : Any + in: the pointer to free + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): pass def __dealloc__(self): pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['sharedSizeBytes : ' + str(self.sharedSizeBytes)] - except ValueError: - str_list += ['sharedSizeBytes : '] - try: - str_list += ['constSizeBytes : ' + str(self.constSizeBytes)] - except ValueError: - str_list += ['constSizeBytes : '] - try: - str_list += ['localSizeBytes : ' + str(self.localSizeBytes)] - except ValueError: - str_list += ['localSizeBytes : '] - try: - str_list += ['maxThreadsPerBlock : ' + str(self.maxThreadsPerBlock)] - except ValueError: - str_list += ['maxThreadsPerBlock : '] - try: - str_list += ['numRegs : ' + str(self.numRegs)] - except ValueError: - str_list += ['numRegs : '] - try: - str_list += ['ptxVersion : ' + str(self.ptxVersion)] - except ValueError: - str_list += ['ptxVersion : '] - try: - str_list += ['binaryVersion : ' + str(self.binaryVersion)] - except ValueError: - str_list += ['binaryVersion : '] - try: - str_list += ['cacheModeCA : ' + str(self.cacheModeCA)] - except ValueError: - str_list += ['cacheModeCA : '] - try: - str_list += ['maxDynamicSharedSizeBytes : ' + str(self.maxDynamicSharedSizeBytes)] - except ValueError: - str_list += ['maxDynamicSharedSizeBytes : '] - try: - str_list += ['preferredShmemCarveout : ' + str(self.preferredShmemCarveout)] - except ValueError: - str_list += ['preferredShmemCarveout : '] - try: - str_list += ['clusterDimMustBeSet : ' + str(self.clusterDimMustBeSet)] - except ValueError: - str_list += ['clusterDimMustBeSet : '] - try: - str_list += ['requiredClusterWidth : ' + str(self.requiredClusterWidth)] - except ValueError: - str_list += ['requiredClusterWidth : '] - try: - str_list += ['requiredClusterHeight : ' + str(self.requiredClusterHeight)] + str_list += ['dptr : ' + hex(self.dptr)] except ValueError: - str_list += ['requiredClusterHeight : '] + str_list += ['dptr : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def dptr(self): + return self._pvt_ptr[0].dptr + @dptr.setter + def dptr(self, dptr): + self._cydptr = _HelperInputVoidPtr(dptr) + self._pvt_ptr[0].dptr = self._cydptr.cptr + + +cdef class cudaMemcpyAttributes: + """ + Attributes specific to copies within a batch. For more details on + usage see cudaMemcpyBatchAsync. + + Attributes + ---------- + + srcAccessOrder : cudaMemcpySrcAccessOrder + Source access ordering to be observed for copies with this + attribute. + + + srcLocHint : cudaMemLocation + Hint location for the source operand. Ignored when the pointers are + not managed memory or memory allocated outside CUDA. + + + dstLocHint : cudaMemLocation + Hint location for the destination operand. Ignored when the + pointers are not managed memory or memory allocated outside CUDA. + + + flags : unsigned int + Additional flags for copies with this attribute. See + cudaMemcpyFlags. + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass + + self._srcLocHint = cudaMemLocation(_ptr=&self._pvt_ptr[0].srcLocHint) + + + self._dstLocHint = cudaMemLocation(_ptr=&self._pvt_ptr[0].dstLocHint) + + def __dealloc__(self): + pass + def getPtr(self): + return self._pvt_ptr + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + try: - str_list += ['requiredClusterDepth : ' + str(self.requiredClusterDepth)] + str_list += ['srcAccessOrder : ' + str(self.srcAccessOrder)] except ValueError: - str_list += ['requiredClusterDepth : '] + str_list += ['srcAccessOrder : '] + + try: - str_list += ['clusterSchedulingPolicyPreference : ' + str(self.clusterSchedulingPolicyPreference)] + str_list += ['srcLocHint :\n' + '\n'.join([' ' + line for line in str(self.srcLocHint).splitlines()])] except ValueError: - str_list += ['clusterSchedulingPolicyPreference : '] + str_list += ['srcLocHint : '] + + try: - str_list += ['nonPortableClusterSizeAllowed : ' + str(self.nonPortableClusterSizeAllowed)] + str_list += ['dstLocHint :\n' + '\n'.join([' ' + line for line in str(self.dstLocHint).splitlines()])] except ValueError: - str_list += ['nonPortableClusterSizeAllowed : '] + str_list += ['dstLocHint : '] + + try: - str_list += ['reserved : ' + str(self.reserved)] + str_list += ['flags : ' + str(self.flags)] except ValueError: - str_list += ['reserved : '] + str_list += ['flags : '] + return '\n'.join(str_list) else: return '' + @property - def sharedSizeBytes(self): - return self._ptr[0].sharedSizeBytes - @sharedSizeBytes.setter - def sharedSizeBytes(self, size_t sharedSizeBytes): - self._ptr[0].sharedSizeBytes = sharedSizeBytes - @property - def constSizeBytes(self): - return self._ptr[0].constSizeBytes - @constSizeBytes.setter - def constSizeBytes(self, size_t constSizeBytes): - self._ptr[0].constSizeBytes = constSizeBytes - @property - def localSizeBytes(self): - return self._ptr[0].localSizeBytes - @localSizeBytes.setter - def localSizeBytes(self, size_t localSizeBytes): - self._ptr[0].localSizeBytes = localSizeBytes - @property - def maxThreadsPerBlock(self): - return self._ptr[0].maxThreadsPerBlock - @maxThreadsPerBlock.setter - def maxThreadsPerBlock(self, int maxThreadsPerBlock): - self._ptr[0].maxThreadsPerBlock = maxThreadsPerBlock - @property - def numRegs(self): - return self._ptr[0].numRegs - @numRegs.setter - def numRegs(self, int numRegs): - self._ptr[0].numRegs = numRegs - @property - def ptxVersion(self): - return self._ptr[0].ptxVersion - @ptxVersion.setter - def ptxVersion(self, int ptxVersion): - self._ptr[0].ptxVersion = ptxVersion - @property - def binaryVersion(self): - return self._ptr[0].binaryVersion - @binaryVersion.setter - def binaryVersion(self, int binaryVersion): - self._ptr[0].binaryVersion = binaryVersion - @property - def cacheModeCA(self): - return self._ptr[0].cacheModeCA - @cacheModeCA.setter - def cacheModeCA(self, int cacheModeCA): - self._ptr[0].cacheModeCA = cacheModeCA - @property - def maxDynamicSharedSizeBytes(self): - return self._ptr[0].maxDynamicSharedSizeBytes - @maxDynamicSharedSizeBytes.setter - def maxDynamicSharedSizeBytes(self, int maxDynamicSharedSizeBytes): - self._ptr[0].maxDynamicSharedSizeBytes = maxDynamicSharedSizeBytes - @property - def preferredShmemCarveout(self): - return self._ptr[0].preferredShmemCarveout - @preferredShmemCarveout.setter - def preferredShmemCarveout(self, int preferredShmemCarveout): - self._ptr[0].preferredShmemCarveout = preferredShmemCarveout - @property - def clusterDimMustBeSet(self): - return self._ptr[0].clusterDimMustBeSet - @clusterDimMustBeSet.setter - def clusterDimMustBeSet(self, int clusterDimMustBeSet): - self._ptr[0].clusterDimMustBeSet = clusterDimMustBeSet - @property - def requiredClusterWidth(self): - return self._ptr[0].requiredClusterWidth - @requiredClusterWidth.setter - def requiredClusterWidth(self, int requiredClusterWidth): - self._ptr[0].requiredClusterWidth = requiredClusterWidth - @property - def requiredClusterHeight(self): - return self._ptr[0].requiredClusterHeight - @requiredClusterHeight.setter - def requiredClusterHeight(self, int requiredClusterHeight): - self._ptr[0].requiredClusterHeight = requiredClusterHeight - @property - def requiredClusterDepth(self): - return self._ptr[0].requiredClusterDepth - @requiredClusterDepth.setter - def requiredClusterDepth(self, int requiredClusterDepth): - self._ptr[0].requiredClusterDepth = requiredClusterDepth + def srcAccessOrder(self): + return cudaMemcpySrcAccessOrder(self._pvt_ptr[0].srcAccessOrder) + @srcAccessOrder.setter + def srcAccessOrder(self, srcAccessOrder not None : cudaMemcpySrcAccessOrder): + self._pvt_ptr[0].srcAccessOrder = int(srcAccessOrder) + + @property - def clusterSchedulingPolicyPreference(self): - return self._ptr[0].clusterSchedulingPolicyPreference - @clusterSchedulingPolicyPreference.setter - def clusterSchedulingPolicyPreference(self, int clusterSchedulingPolicyPreference): - self._ptr[0].clusterSchedulingPolicyPreference = clusterSchedulingPolicyPreference + def srcLocHint(self): + return self._srcLocHint + @srcLocHint.setter + def srcLocHint(self, srcLocHint not None : cudaMemLocation): + string.memcpy(&self._pvt_ptr[0].srcLocHint, srcLocHint.getPtr(), sizeof(self._pvt_ptr[0].srcLocHint)) + + @property - def nonPortableClusterSizeAllowed(self): - return self._ptr[0].nonPortableClusterSizeAllowed - @nonPortableClusterSizeAllowed.setter - def nonPortableClusterSizeAllowed(self, int nonPortableClusterSizeAllowed): - self._ptr[0].nonPortableClusterSizeAllowed = nonPortableClusterSizeAllowed + def dstLocHint(self): + return self._dstLocHint + @dstLocHint.setter + def dstLocHint(self, dstLocHint not None : cudaMemLocation): + string.memcpy(&self._pvt_ptr[0].dstLocHint, dstLocHint.getPtr(), sizeof(self._pvt_ptr[0].dstLocHint)) + + @property - def reserved(self): - return self._ptr[0].reserved - @reserved.setter - def reserved(self, reserved): - self._ptr[0].reserved = reserved -{{endif}} -{{if 'struct cudaMemLocation' in found_types}} + def flags(self): + return self._pvt_ptr[0].flags + @flags.setter + def flags(self, unsigned int flags): + self._pvt_ptr[0].flags = flags -cdef class cudaMemLocation: + +cdef class cudaOffset3D: """ - Specifies a memory location. To specify a gpu, set type = - cudaMemLocationTypeDevice and set id = the gpu's device ordinal. To - specify a cpu NUMA node, set type = cudaMemLocationTypeHostNuma and - set id = host NUMA node id. + Struct representing offset into a cudaArray_t in elements Attributes ---------- - type : cudaMemLocationType - Specifies the location type, which modifies the meaning of id. - id : int - identifier for a given this location's ::CUmemLocationType. + + x : size_t + + + + y : size_t + + + + z : size_t + + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): pass def __dealloc__(self): pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['type : ' + str(self.type)] + str_list += ['x : ' + str(self.x)] except ValueError: - str_list += ['type : '] + str_list += ['x : '] + + try: - str_list += ['id : ' + str(self.id)] + str_list += ['y : ' + str(self.y)] except ValueError: - str_list += ['id : '] + str_list += ['y : '] + + + try: + str_list += ['z : ' + str(self.z)] + except ValueError: + str_list += ['z : '] + return '\n'.join(str_list) else: return '' + @property - def type(self): - return cudaMemLocationType(self._ptr[0].type) - @type.setter - def type(self, type not None : cudaMemLocationType): - self._ptr[0].type = type.value + def x(self): + return self._pvt_ptr[0].x + @x.setter + def x(self, size_t x): + self._pvt_ptr[0].x = x + + + @property + def y(self): + return self._pvt_ptr[0].y + @y.setter + def y(self, size_t y): + self._pvt_ptr[0].y = y + + @property - def id(self): - return self._ptr[0].id - @id.setter - def id(self, int id): - self._ptr[0].id = id -{{endif}} -{{if 'struct cudaMemAccessDesc' in found_types}} + def z(self): + return self._pvt_ptr[0].z + @z.setter + def z(self, size_t z): + self._pvt_ptr[0].z = z -cdef class cudaMemAccessDesc: - """ - Memory access descriptor +cdef class anon_struct6: + """ Attributes ---------- - location : cudaMemLocation - Location on which the request is to change it's accessibility - flags : cudaMemAccessFlags - ::CUmemProt accessibility flags to set on the request + + ptr : Any + + + + rowLength : size_t + + + + layerHeight : size_t + + + + locHint : cudaMemLocation + + Methods ------- getPtr() Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - else: - self._ptr = _ptr - def __init__(self, void_ptr _ptr = 0): - self._location = cudaMemLocation(_ptr=&self._ptr[0].location) + def __cinit__(self, void_ptr _ptr): + self._pvt_ptr = _ptr + + def __init__(self, void_ptr _ptr): + pass + + self._locHint = cudaMemLocation(_ptr=&self._pvt_ptr[0].op.ptr.locHint) + def __dealloc__(self): pass def getPtr(self): - return self._ptr + return &self._pvt_ptr[0].op.ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['location :\n' + '\n'.join([' ' + line for line in str(self.location).splitlines()])] + str_list += ['ptr : ' + hex(self.ptr)] except ValueError: - str_list += ['location : '] + str_list += ['ptr : '] + + try: - str_list += ['flags : ' + str(self.flags)] + str_list += ['rowLength : ' + str(self.rowLength)] except ValueError: - str_list += ['flags : '] + str_list += ['rowLength : '] + + + try: + str_list += ['layerHeight : ' + str(self.layerHeight)] + except ValueError: + str_list += ['layerHeight : '] + + + try: + str_list += ['locHint :\n' + '\n'.join([' ' + line for line in str(self.locHint).splitlines()])] + except ValueError: + str_list += ['locHint : '] + return '\n'.join(str_list) else: return '' + @property - def location(self): - return self._location - @location.setter - def location(self, location not None : cudaMemLocation): - string.memcpy(&self._ptr[0].location, location.getPtr(), sizeof(self._ptr[0].location)) + def ptr(self): + return self._pvt_ptr[0].op.ptr.ptr + @ptr.setter + def ptr(self, ptr): + self._cyptr = _HelperInputVoidPtr(ptr) + self._pvt_ptr[0].op.ptr.ptr = self._cyptr.cptr + + @property - def flags(self): - return cudaMemAccessFlags(self._ptr[0].flags) - @flags.setter - def flags(self, flags not None : cudaMemAccessFlags): - self._ptr[0].flags = flags.value -{{endif}} -{{if 'struct cudaMemPoolProps' in found_types}} + def rowLength(self): + return self._pvt_ptr[0].op.ptr.rowLength + @rowLength.setter + def rowLength(self, size_t rowLength): + self._pvt_ptr[0].op.ptr.rowLength = rowLength + + + @property + def layerHeight(self): + return self._pvt_ptr[0].op.ptr.layerHeight + @layerHeight.setter + def layerHeight(self, size_t layerHeight): + self._pvt_ptr[0].op.ptr.layerHeight = layerHeight + + + @property + def locHint(self): + return self._locHint + @locHint.setter + def locHint(self, locHint not None : cudaMemLocation): + string.memcpy(&self._pvt_ptr[0].op.ptr.locHint, locHint.getPtr(), sizeof(self._pvt_ptr[0].op.ptr.locHint)) -cdef class cudaMemPoolProps: - """ - Specifies the properties of allocations made from the pool. +cdef class anon_struct7: + """ Attributes ---------- - allocType : cudaMemAllocationType - Allocation type. Currently must be specified as - cudaMemAllocationTypePinned - handleTypes : cudaMemAllocationHandleType - Handle types that will be supported by allocations from the pool. - location : cudaMemLocation - Location allocations should reside. - win32SecurityAttributes : Any - Windows-specific LPSECURITYATTRIBUTES required when - cudaMemHandleTypeWin32 is specified. This security attribute - defines the scope of which exported allocations may be tranferred - to other processes. In all other cases, this field is required to - be zero. - maxSize : size_t - Maximum pool size. When set to 0, defaults to a system dependent - value. - reserved : bytes - reserved for future use, must be 0 + + array : cudaArray_t + + + + offset : cudaOffset3D + + Methods ------- getPtr() Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - else: - self._ptr = _ptr - def __init__(self, void_ptr _ptr = 0): - self._location = cudaMemLocation(_ptr=&self._ptr[0].location) + def __cinit__(self, void_ptr _ptr): + self._pvt_ptr = _ptr + + def __init__(self, void_ptr _ptr): + pass + + self._array = cudaArray_t(_ptr=&self._pvt_ptr[0].op.array.array) + + + self._offset = cudaOffset3D(_ptr=&self._pvt_ptr[0].op.array.offset) + def __dealloc__(self): pass def getPtr(self): - return self._ptr + return &self._pvt_ptr[0].op.array def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['allocType : ' + str(self.allocType)] - except ValueError: - str_list += ['allocType : '] - try: - str_list += ['handleTypes : ' + str(self.handleTypes)] - except ValueError: - str_list += ['handleTypes : '] - try: - str_list += ['location :\n' + '\n'.join([' ' + line for line in str(self.location).splitlines()])] - except ValueError: - str_list += ['location : '] - try: - str_list += ['win32SecurityAttributes : ' + hex(self.win32SecurityAttributes)] - except ValueError: - str_list += ['win32SecurityAttributes : '] - try: - str_list += ['maxSize : ' + str(self.maxSize)] + str_list += ['array : ' + str(self.array)] except ValueError: - str_list += ['maxSize : '] + str_list += ['array : '] + + try: - str_list += ['reserved : ' + str(self.reserved)] + str_list += ['offset :\n' + '\n'.join([' ' + line for line in str(self.offset).splitlines()])] except ValueError: - str_list += ['reserved : '] + str_list += ['offset : '] + return '\n'.join(str_list) else: return '' + @property - def allocType(self): - return cudaMemAllocationType(self._ptr[0].allocType) - @allocType.setter - def allocType(self, allocType not None : cudaMemAllocationType): - self._ptr[0].allocType = allocType.value - @property - def handleTypes(self): - return cudaMemAllocationHandleType(self._ptr[0].handleTypes) - @handleTypes.setter - def handleTypes(self, handleTypes not None : cudaMemAllocationHandleType): - self._ptr[0].handleTypes = handleTypes.value - @property - def location(self): - return self._location - @location.setter - def location(self, location not None : cudaMemLocation): - string.memcpy(&self._ptr[0].location, location.getPtr(), sizeof(self._ptr[0].location)) - @property - def win32SecurityAttributes(self): - return self._ptr[0].win32SecurityAttributes - @win32SecurityAttributes.setter - def win32SecurityAttributes(self, win32SecurityAttributes): - _cwin32SecurityAttributes = utils.HelperInputVoidPtr(win32SecurityAttributes) - self._ptr[0].win32SecurityAttributes = _cwin32SecurityAttributes.cptr - @property - def maxSize(self): - return self._ptr[0].maxSize - @maxSize.setter - def maxSize(self, size_t maxSize): - self._ptr[0].maxSize = maxSize + def array(self): + return self._array + @array.setter + def array(self, array): + cdef cyruntime.cudaArray_t cyarray + if array is None: + cyarray = 0 + elif isinstance(array, (cudaArray_t,)): + parray = int(array) + cyarray = parray + else: + parray = int(cudaArray_t(array)) + cyarray = parray + self._array._pvt_ptr[0] = cyarray + + @property - def reserved(self): - return PyBytes_FromStringAndSize(self._ptr[0].reserved, 56) - @reserved.setter - def reserved(self, reserved): - if len(reserved) != 56: - raise ValueError("reserved length must be 56, is " + str(len(reserved))) - for i, b in enumerate(reserved): - self._ptr[0].reserved[i] = b -{{endif}} -{{if 'struct cudaMemPoolPtrExportData' in found_types}} + def offset(self): + return self._offset + @offset.setter + def offset(self, offset not None : cudaOffset3D): + string.memcpy(&self._pvt_ptr[0].op.array.offset, offset.getPtr(), sizeof(self._pvt_ptr[0].op.array.offset)) -cdef class cudaMemPoolPtrExportData: - """ - Opaque data for exporting a pool allocation +cdef class anon_union2: + """ Attributes ---------- - reserved : bytes + + ptr : anon_struct6 + + + + array : anon_struct7 + Methods ------- getPtr() Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - else: - self._ptr = _ptr - def __init__(self, void_ptr _ptr = 0): + def __cinit__(self, void_ptr _ptr): + self._pvt_ptr = _ptr + + def __init__(self, void_ptr _ptr): pass + + self._ptr = anon_struct6(_ptr=self._pvt_ptr) + + + self._array = anon_struct7(_ptr=self._pvt_ptr) + def __dealloc__(self): pass def getPtr(self): - return self._ptr + return &self._pvt_ptr[0].op def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['reserved : ' + str(self.reserved)] + str_list += ['ptr :\n' + '\n'.join([' ' + line for line in str(self.ptr).splitlines()])] except ValueError: - str_list += ['reserved : '] + str_list += ['ptr : '] + + + try: + str_list += ['array :\n' + '\n'.join([' ' + line for line in str(self.array).splitlines()])] + except ValueError: + str_list += ['array : '] + return '\n'.join(str_list) else: return '' + @property - def reserved(self): - return PyBytes_FromStringAndSize(self._ptr[0].reserved, 64) - @reserved.setter - def reserved(self, reserved): - if len(reserved) != 64: - raise ValueError("reserved length must be 64, is " + str(len(reserved))) - for i, b in enumerate(reserved): - self._ptr[0].reserved[i] = b -{{endif}} -{{if 'struct cudaMemAllocNodeParams' in found_types}} + def ptr(self): + return self._ptr + @ptr.setter + def ptr(self, ptr not None : anon_struct6): + string.memcpy(&self._pvt_ptr[0].op.ptr, ptr.getPtr(), sizeof(self._pvt_ptr[0].op.ptr)) -cdef class cudaMemAllocNodeParams: + + @property + def array(self): + return self._array + @array.setter + def array(self, array not None : anon_struct7): + string.memcpy(&self._pvt_ptr[0].op.array, array.getPtr(), sizeof(self._pvt_ptr[0].op.array)) + + +cdef class cudaMemcpy3DOperand: """ - Memory allocation node parameters + Struct representing an operand for copy with cudaMemcpy3DBatchAsync Attributes ---------- - poolProps : cudaMemPoolProps - in: location where the allocation should reside (specified in - ::location). ::handleTypes must be cudaMemHandleTypeNone. IPC is - not supported. in: array of memory access descriptors. Used to - describe peer GPU access - accessDescs : cudaMemAccessDesc - in: number of memory access descriptors. Must not exceed the number - of GPUs. - accessDescCount : size_t - in: Number of `accessDescs`s - bytesize : size_t - in: size in bytes of the requested allocation - dptr : Any - out: address of the allocation returned by CUDA + + type : cudaMemcpy3DOperandType + + + + op : anon_union2 + + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._val_ptr = calloc(1, sizeof(cyruntime.cudaMemcpy3DOperand)) + self._pvt_ptr = self._val_ptr else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - self._poolProps = cudaMemPoolProps(_ptr=&self._ptr[0].poolProps) + pass + + self._op = anon_union2(_ptr=self._pvt_ptr) + def __dealloc__(self): - if self._accessDescs is not NULL: - free(self._accessDescs) + if self._val_ptr is not NULL: + free(self._val_ptr) def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['poolProps :\n' + '\n'.join([' ' + line for line in str(self.poolProps).splitlines()])] - except ValueError: - str_list += ['poolProps : '] - try: - str_list += ['accessDescs : ' + str(self.accessDescs)] - except ValueError: - str_list += ['accessDescs : '] - try: - str_list += ['accessDescCount : ' + str(self.accessDescCount)] - except ValueError: - str_list += ['accessDescCount : '] - try: - str_list += ['bytesize : ' + str(self.bytesize)] + str_list += ['type : ' + str(self.type)] except ValueError: - str_list += ['bytesize : '] + str_list += ['type : '] + + try: - str_list += ['dptr : ' + hex(self.dptr)] + str_list += ['op :\n' + '\n'.join([' ' + line for line in str(self.op).splitlines()])] except ValueError: - str_list += ['dptr : '] + str_list += ['op : '] + return '\n'.join(str_list) else: return '' - @property - def poolProps(self): - return self._poolProps - @poolProps.setter - def poolProps(self, poolProps not None : cudaMemPoolProps): - string.memcpy(&self._ptr[0].poolProps, poolProps.getPtr(), sizeof(self._ptr[0].poolProps)) - @property - def accessDescs(self): - arrs = [self._ptr[0].accessDescs + x*sizeof(ccudart.cudaMemAccessDesc) for x in range(self._accessDescs_length)] - return [cudaMemAccessDesc(_ptr=arr) for arr in arrs] - @accessDescs.setter - def accessDescs(self, val): - if len(val) == 0: - free(self._accessDescs) - self._accessDescs_length = 0 - self._ptr[0].accessDescs = NULL - else: - if self._accessDescs_length != len(val): - free(self._accessDescs) - self._accessDescs = calloc(len(val), sizeof(ccudart.cudaMemAccessDesc)) - if self._accessDescs is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(ccudart.cudaMemAccessDesc))) - self._accessDescs_length = len(val) - self._ptr[0].accessDescs = self._accessDescs - for idx in range(len(val)): - string.memcpy(&self._accessDescs[idx], (val[idx])._ptr, sizeof(ccudart.cudaMemAccessDesc)) @property - def accessDescCount(self): - return self._ptr[0].accessDescCount - @accessDescCount.setter - def accessDescCount(self, size_t accessDescCount): - self._ptr[0].accessDescCount = accessDescCount - @property - def bytesize(self): - return self._ptr[0].bytesize - @bytesize.setter - def bytesize(self, size_t bytesize): - self._ptr[0].bytesize = bytesize + def type(self): + return cudaMemcpy3DOperandType(self._pvt_ptr[0].type) + @type.setter + def type(self, type not None : cudaMemcpy3DOperandType): + self._pvt_ptr[0].type = int(type) + + @property - def dptr(self): - return self._ptr[0].dptr - @dptr.setter - def dptr(self, dptr): - _cdptr = utils.HelperInputVoidPtr(dptr) - self._ptr[0].dptr = _cdptr.cptr -{{endif}} -{{if 'struct cudaMemAllocNodeParamsV2' in found_types}} + def op(self): + return self._op + @op.setter + def op(self, op not None : anon_union2): + string.memcpy(&self._pvt_ptr[0].op, op.getPtr(), sizeof(self._pvt_ptr[0].op)) -cdef class cudaMemAllocNodeParamsV2: - """ - Memory allocation node parameters +cdef class cudaMemcpy3DBatchOp: + """ Attributes ---------- - poolProps : cudaMemPoolProps - in: location where the allocation should reside (specified in - ::location). ::handleTypes must be cudaMemHandleTypeNone. IPC is - not supported. in: array of memory access descriptors. Used to - describe peer GPU access - accessDescs : cudaMemAccessDesc - in: number of memory access descriptors. Must not exceed the number - of GPUs. - accessDescCount : size_t - in: Number of `accessDescs`s - bytesize : size_t - in: size in bytes of the requested allocation - dptr : Any - out: address of the allocation returned by CUDA + + src : cudaMemcpy3DOperand + Source memcpy operand. + + + dst : cudaMemcpy3DOperand + Destination memcpy operand. + + + extent : cudaExtent + Extents of the memcpy between src and dst. The width, height and + depth components must not be 0. + + + srcAccessOrder : cudaMemcpySrcAccessOrder + Source access ordering to be observed for copy from src to dst. + + + flags : unsigned int + Additional flags for copy from src to dst. See cudaMemcpyFlags. + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - self._poolProps = cudaMemPoolProps(_ptr=&self._ptr[0].poolProps) + pass + + self._src = cudaMemcpy3DOperand(_ptr=&self._pvt_ptr[0].src) + + + self._dst = cudaMemcpy3DOperand(_ptr=&self._pvt_ptr[0].dst) + + + self._extent = cudaExtent(_ptr=&self._pvt_ptr[0].extent) + def __dealloc__(self): - if self._accessDescs is not NULL: - free(self._accessDescs) + pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['poolProps :\n' + '\n'.join([' ' + line for line in str(self.poolProps).splitlines()])] + str_list += ['src :\n' + '\n'.join([' ' + line for line in str(self.src).splitlines()])] except ValueError: - str_list += ['poolProps : '] + str_list += ['src : '] + + try: - str_list += ['accessDescs : ' + str(self.accessDescs)] + str_list += ['dst :\n' + '\n'.join([' ' + line for line in str(self.dst).splitlines()])] except ValueError: - str_list += ['accessDescs : '] + str_list += ['dst : '] + + try: - str_list += ['accessDescCount : ' + str(self.accessDescCount)] + str_list += ['extent :\n' + '\n'.join([' ' + line for line in str(self.extent).splitlines()])] except ValueError: - str_list += ['accessDescCount : '] + str_list += ['extent : '] + + try: - str_list += ['bytesize : ' + str(self.bytesize)] + str_list += ['srcAccessOrder : ' + str(self.srcAccessOrder)] except ValueError: - str_list += ['bytesize : '] + str_list += ['srcAccessOrder : '] + + try: - str_list += ['dptr : ' + hex(self.dptr)] + str_list += ['flags : ' + str(self.flags)] except ValueError: - str_list += ['dptr : '] + str_list += ['flags : '] + return '\n'.join(str_list) else: return '' - @property - def poolProps(self): - return self._poolProps - @poolProps.setter - def poolProps(self, poolProps not None : cudaMemPoolProps): - string.memcpy(&self._ptr[0].poolProps, poolProps.getPtr(), sizeof(self._ptr[0].poolProps)) - @property - def accessDescs(self): - arrs = [self._ptr[0].accessDescs + x*sizeof(ccudart.cudaMemAccessDesc) for x in range(self._accessDescs_length)] - return [cudaMemAccessDesc(_ptr=arr) for arr in arrs] - @accessDescs.setter - def accessDescs(self, val): - if len(val) == 0: - free(self._accessDescs) - self._accessDescs_length = 0 - self._ptr[0].accessDescs = NULL - else: - if self._accessDescs_length != len(val): - free(self._accessDescs) - self._accessDescs = calloc(len(val), sizeof(ccudart.cudaMemAccessDesc)) - if self._accessDescs is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(ccudart.cudaMemAccessDesc))) - self._accessDescs_length = len(val) - self._ptr[0].accessDescs = self._accessDescs - for idx in range(len(val)): - string.memcpy(&self._accessDescs[idx], (val[idx])._ptr, sizeof(ccudart.cudaMemAccessDesc)) @property - def accessDescCount(self): - return self._ptr[0].accessDescCount - @accessDescCount.setter - def accessDescCount(self, size_t accessDescCount): - self._ptr[0].accessDescCount = accessDescCount + def src(self): + return self._src + @src.setter + def src(self, src not None : cudaMemcpy3DOperand): + string.memcpy(&self._pvt_ptr[0].src, src.getPtr(), sizeof(self._pvt_ptr[0].src)) + + @property - def bytesize(self): - return self._ptr[0].bytesize - @bytesize.setter - def bytesize(self, size_t bytesize): - self._ptr[0].bytesize = bytesize + def dst(self): + return self._dst + @dst.setter + def dst(self, dst not None : cudaMemcpy3DOperand): + string.memcpy(&self._pvt_ptr[0].dst, dst.getPtr(), sizeof(self._pvt_ptr[0].dst)) + + @property - def dptr(self): - return self._ptr[0].dptr - @dptr.setter - def dptr(self, dptr): - _cdptr = utils.HelperInputVoidPtr(dptr) - self._ptr[0].dptr = _cdptr.cptr -{{endif}} -{{if 'struct cudaMemFreeNodeParams' in found_types}} + def extent(self): + return self._extent + @extent.setter + def extent(self, extent not None : cudaExtent): + string.memcpy(&self._pvt_ptr[0].extent, extent.getPtr(), sizeof(self._pvt_ptr[0].extent)) -cdef class cudaMemFreeNodeParams: - """ - Memory free node parameters - Attributes - ---------- - dptr : Any - in: the pointer to free + @property + def srcAccessOrder(self): + return cudaMemcpySrcAccessOrder(self._pvt_ptr[0].srcAccessOrder) + @srcAccessOrder.setter + def srcAccessOrder(self, srcAccessOrder not None : cudaMemcpySrcAccessOrder): + self._pvt_ptr[0].srcAccessOrder = int(srcAccessOrder) - Methods - ------- - getPtr() - Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - else: - self._ptr = _ptr - def __init__(self, void_ptr _ptr = 0): - pass - def __dealloc__(self): - pass - def getPtr(self): - return self._ptr - def __repr__(self): - if self._ptr is not NULL: - str_list = [] - try: - str_list += ['dptr : ' + hex(self.dptr)] - except ValueError: - str_list += ['dptr : '] - return '\n'.join(str_list) - else: - return '' @property - def dptr(self): - return self._ptr[0].dptr - @dptr.setter - def dptr(self, dptr): - _cdptr = utils.HelperInputVoidPtr(dptr) - self._ptr[0].dptr = _cdptr.cptr -{{endif}} -{{if 'struct CUuuid_st' in found_types}} + def flags(self): + return self._pvt_ptr[0].flags + @flags.setter + def flags(self, unsigned int flags): + self._pvt_ptr[0].flags = flags + cdef class CUuuid_st: """ Attributes ---------- + bytes : bytes < CUDA definition of UUID + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): pass def __dealloc__(self): pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: str_list += ['bytes : ' + str(self.bytes.hex())] except ValueError: str_list += ['bytes : '] + return '\n'.join(str_list) else: return '' + @property def bytes(self): - return PyBytes_FromStringAndSize(self._ptr[0].bytes, 16) + return PyBytes_FromStringAndSize(self._pvt_ptr[0].bytes, 16) -{{endif}} -{{if 'struct cudaDeviceProp' in found_types}} cdef class cudaDeviceProp: """ @@ -7937,644 +12271,1006 @@ cdef class cudaDeviceProp: Attributes ---------- + name : bytes ASCII string identifying device + + uuid : cudaUUID_t 16-byte unique identifier + + luid : bytes 8-byte locally unique identifier. Value is undefined on TCC and non-Windows platforms + + luidDeviceNodeMask : unsigned int LUID device node mask. Value is undefined on TCC and non-Windows platforms + + totalGlobalMem : size_t Global memory available on device in bytes + + sharedMemPerBlock : size_t Shared memory available per block in bytes + + regsPerBlock : int 32-bit registers available per block + + warpSize : int Warp size in threads + + memPitch : size_t Maximum pitch in bytes allowed by memory copies + + maxThreadsPerBlock : int Maximum number of threads per block - maxThreadsDim : List[int] + + + maxThreadsDim : list[int] Maximum size of each dimension of a block - maxGridSize : List[int] + + + maxGridSize : list[int] Maximum size of each dimension of a grid - clockRate : int - Deprecated, Clock frequency in kilohertz + + totalConstMem : size_t Constant memory available on device in bytes + + major : int Major compute capability + + minor : int Minor compute capability + + textureAlignment : size_t Alignment requirement for textures + + texturePitchAlignment : size_t Pitch alignment requirement for texture references bound to pitched memory - deviceOverlap : int - Device can concurrently copy memory and execute a kernel. - Deprecated. Use instead asyncEngineCount. + + multiProcessorCount : int Number of multiprocessors on device - kernelExecTimeoutEnabled : int - Deprecated, Specified whether there is a run time limit on kernels + + integrated : int Device is integrated as opposed to discrete + + canMapHostMemory : int Device can map host memory with cudaHostAlloc/cudaHostGetDevicePointer - computeMode : int - Deprecated, Compute mode (See cudaComputeMode) + + maxTexture1D : int Maximum 1D texture size + + maxTexture1DMipmap : int Maximum 1D mipmapped texture size - maxTexture1DLinear : int - Deprecated, do not use. Use cudaDeviceGetTexture1DLinearMaxWidth() - or cuDeviceGetTexture1DLinearMaxWidth() instead. - maxTexture2D : List[int] + + + maxTexture2D : list[int] Maximum 2D texture dimensions - maxTexture2DMipmap : List[int] + + + maxTexture2DMipmap : list[int] Maximum 2D mipmapped texture dimensions - maxTexture2DLinear : List[int] + + + maxTexture2DLinear : list[int] Maximum dimensions (width, height, pitch) for 2D textures bound to pitched memory - maxTexture2DGather : List[int] + + + maxTexture2DGather : list[int] Maximum 2D texture dimensions if texture gather operations have to be performed - maxTexture3D : List[int] + + + maxTexture3D : list[int] Maximum 3D texture dimensions - maxTexture3DAlt : List[int] + + + maxTexture3DAlt : list[int] Maximum alternate 3D texture dimensions + + maxTextureCubemap : int Maximum Cubemap texture dimensions - maxTexture1DLayered : List[int] + + + maxTexture1DLayered : list[int] Maximum 1D layered texture dimensions - maxTexture2DLayered : List[int] + + + maxTexture2DLayered : list[int] Maximum 2D layered texture dimensions - maxTextureCubemapLayered : List[int] + + + maxTextureCubemapLayered : list[int] Maximum Cubemap layered texture dimensions + + maxSurface1D : int Maximum 1D surface size - maxSurface2D : List[int] + + + maxSurface2D : list[int] Maximum 2D surface dimensions - maxSurface3D : List[int] + + + maxSurface3D : list[int] Maximum 3D surface dimensions - maxSurface1DLayered : List[int] + + + maxSurface1DLayered : list[int] Maximum 1D layered surface dimensions - maxSurface2DLayered : List[int] + + + maxSurface2DLayered : list[int] Maximum 2D layered surface dimensions + + maxSurfaceCubemap : int Maximum Cubemap surface dimensions - maxSurfaceCubemapLayered : List[int] + + + maxSurfaceCubemapLayered : list[int] Maximum Cubemap layered surface dimensions + + surfaceAlignment : size_t Alignment requirements for surfaces + + concurrentKernels : int Device can possibly execute multiple kernels concurrently + + ECCEnabled : int Device has ECC support enabled + + pciBusID : int PCI bus ID of the device + + pciDeviceID : int PCI device ID of the device + + pciDomainID : int PCI domain ID of the device + + tccDriver : int 1 if device is a Tesla device using TCC driver, 0 otherwise + + asyncEngineCount : int Number of asynchronous engines + + unifiedAddressing : int Device shares a unified address space with the host - memoryClockRate : int - Deprecated, Peak memory clock frequency in kilohertz + + memoryBusWidth : int Global memory bus width in bits + + l2CacheSize : int Size of L2 cache in bytes + + persistingL2CacheMaxSize : int Device's maximum l2 persisting lines capacity setting in bytes + + maxThreadsPerMultiProcessor : int Maximum resident threads per multiprocessor + + streamPrioritiesSupported : int Device supports stream priorities + + globalL1CacheSupported : int Device supports caching globals in L1 + + localL1CacheSupported : int Device supports caching locals in L1 + + sharedMemPerMultiprocessor : size_t Shared memory available per multiprocessor in bytes + + regsPerMultiprocessor : int 32-bit registers available per multiprocessor + + managedMemory : int Device supports allocating managed memory on this system + + isMultiGpuBoard : int Device is on a multi-GPU board + + multiGpuBoardGroupID : int Unique identifier for a group of devices on the same multi-GPU board + + hostNativeAtomicSupported : int Link between the device and the host supports native atomic operations - singleToDoublePrecisionPerfRatio : int - Deprecated, Ratio of single precision performance (in floating- - point operations per second) to double precision performance + + pageableMemoryAccess : int Device supports coherently accessing pageable memory without calling cudaHostRegister on it + + concurrentManagedAccess : int Device can coherently access managed memory concurrently with the CPU + + computePreemptionSupported : int Device supports Compute Preemption + + canUseHostPointerForRegisteredMem : int Device can access host registered memory at the same virtual address as the CPU + + cooperativeLaunch : int Device supports launching cooperative kernels via cudaLaunchCooperativeKernel - cooperativeMultiDeviceLaunch : int - Deprecated, cudaLaunchCooperativeKernelMultiDevice is deprecated. + + sharedMemPerBlockOptin : size_t Per device maximum shared memory per block usable by special opt in + + pageableMemoryAccessUsesHostPageTables : int Device accesses pageable memory via the host's page tables + + directManagedMemAccessFromHost : int Host can directly access managed memory on the device without migration. + + maxBlocksPerMultiProcessor : int Maximum number of resident blocks per multiprocessor + + accessPolicyMaxWindowSize : int The maximum value of cudaAccessPolicyWindow::num_bytes. + + reservedSharedMemPerBlock : size_t Shared memory reserved by CUDA driver per block in bytes + + hostRegisterSupported : int Device supports host memory registration via cudaHostRegister. + + sparseCudaArraySupported : int 1 if the device supports sparse CUDA arrays and sparse CUDA mipmapped arrays, 0 otherwise + + hostRegisterReadOnlySupported : int Device supports using the cudaHostRegister flag cudaHostRegisterReadOnly to register memory that must be mapped as read-only to the GPU + + timelineSemaphoreInteropSupported : int External timeline semaphore interop is supported on the device + + memoryPoolsSupported : int 1 if the device supports using the cudaMallocAsync and cudaMemPool family of APIs, 0 otherwise + + gpuDirectRDMASupported : int 1 if the device supports GPUDirect RDMA APIs, 0 otherwise + + gpuDirectRDMAFlushWritesOptions : unsigned int Bitmask to be interpreted according to the cudaFlushGPUDirectRDMAWritesOptions enum + + gpuDirectRDMAWritesOrdering : int See the cudaGPUDirectRDMAWritesOrdering enum for numerical values + + memoryPoolSupportedHandleTypes : unsigned int Bitmask of handle types supported with mempool-based IPC + + deferredMappingCudaArraySupported : int 1 if the device supports deferred mapping CUDA arrays and CUDA mipmapped arrays + + ipcEventSupported : int Device supports IPC Events. + + clusterLaunch : int Indicates device supports cluster launch + + unifiedFunctionPointers : int Indicates device supports unified pointers - reserved2 : List[int] - reserved1 : List[int] - Reserved for future use - reserved : List[int] + + deviceNumaConfig : int + NUMA configuration of a device: value is of type + cudaDeviceNumaConfig enum + + + deviceNumaId : int + NUMA node ID of the GPU memory + + + mpsEnabled : int + Indicates if contexts created on this device will be shared via MPS + + + hostNumaId : int + NUMA ID of the host node closest to the device or -1 when system + does not support NUMA + + + gpuPciDeviceID : unsigned int + The combined 16-bit PCI device ID and 16-bit PCI vendor ID + + + gpuPciSubsystemID : unsigned int + The combined 16-bit PCI subsystem ID and 16-bit PCI subsystem + vendor ID + + + hostNumaMultinodeIpcSupported : int + 1 if the device supports HostNuma location IPC between nodes in a + multi-node system. + + + reserved : list[int] Reserved for future use + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - self._uuid = cudaUUID_t(_ptr=&self._ptr[0].uuid) + pass + + self._uuid = cudaUUID_t(_ptr=&self._pvt_ptr[0].uuid) + def __dealloc__(self): pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: str_list += ['name : ' + self.name.decode('utf-8')] except ValueError: str_list += ['name : '] + + try: str_list += ['uuid :\n' + '\n'.join([' ' + line for line in str(self.uuid).splitlines()])] except ValueError: str_list += ['uuid : '] + + try: str_list += ['luid : ' + self.luid.hex()] except ValueError: str_list += ['luid : '] + + try: str_list += ['luidDeviceNodeMask : ' + str(self.luidDeviceNodeMask)] except ValueError: str_list += ['luidDeviceNodeMask : '] + + try: str_list += ['totalGlobalMem : ' + str(self.totalGlobalMem)] except ValueError: str_list += ['totalGlobalMem : '] + + try: str_list += ['sharedMemPerBlock : ' + str(self.sharedMemPerBlock)] except ValueError: str_list += ['sharedMemPerBlock : '] + + try: str_list += ['regsPerBlock : ' + str(self.regsPerBlock)] except ValueError: str_list += ['regsPerBlock : '] + + try: str_list += ['warpSize : ' + str(self.warpSize)] except ValueError: str_list += ['warpSize : '] + + try: str_list += ['memPitch : ' + str(self.memPitch)] except ValueError: str_list += ['memPitch : '] + + try: str_list += ['maxThreadsPerBlock : ' + str(self.maxThreadsPerBlock)] except ValueError: str_list += ['maxThreadsPerBlock : '] + + try: str_list += ['maxThreadsDim : ' + str(self.maxThreadsDim)] except ValueError: str_list += ['maxThreadsDim : '] + + try: str_list += ['maxGridSize : ' + str(self.maxGridSize)] except ValueError: str_list += ['maxGridSize : '] - try: - str_list += ['clockRate : ' + str(self.clockRate)] - except ValueError: - str_list += ['clockRate : '] + + try: str_list += ['totalConstMem : ' + str(self.totalConstMem)] except ValueError: str_list += ['totalConstMem : '] + + try: str_list += ['major : ' + str(self.major)] except ValueError: str_list += ['major : '] + + try: str_list += ['minor : ' + str(self.minor)] except ValueError: str_list += ['minor : '] + + try: str_list += ['textureAlignment : ' + str(self.textureAlignment)] except ValueError: str_list += ['textureAlignment : '] + + try: str_list += ['texturePitchAlignment : ' + str(self.texturePitchAlignment)] except ValueError: str_list += ['texturePitchAlignment : '] - try: - str_list += ['deviceOverlap : ' + str(self.deviceOverlap)] - except ValueError: - str_list += ['deviceOverlap : '] + + try: str_list += ['multiProcessorCount : ' + str(self.multiProcessorCount)] except ValueError: str_list += ['multiProcessorCount : '] - try: - str_list += ['kernelExecTimeoutEnabled : ' + str(self.kernelExecTimeoutEnabled)] - except ValueError: - str_list += ['kernelExecTimeoutEnabled : '] + + try: str_list += ['integrated : ' + str(self.integrated)] except ValueError: str_list += ['integrated : '] + + try: str_list += ['canMapHostMemory : ' + str(self.canMapHostMemory)] except ValueError: str_list += ['canMapHostMemory : '] - try: - str_list += ['computeMode : ' + str(self.computeMode)] - except ValueError: - str_list += ['computeMode : '] + + try: str_list += ['maxTexture1D : ' + str(self.maxTexture1D)] except ValueError: str_list += ['maxTexture1D : '] + + try: str_list += ['maxTexture1DMipmap : ' + str(self.maxTexture1DMipmap)] except ValueError: str_list += ['maxTexture1DMipmap : '] - try: - str_list += ['maxTexture1DLinear : ' + str(self.maxTexture1DLinear)] - except ValueError: - str_list += ['maxTexture1DLinear : '] + + try: str_list += ['maxTexture2D : ' + str(self.maxTexture2D)] except ValueError: str_list += ['maxTexture2D : '] + + try: str_list += ['maxTexture2DMipmap : ' + str(self.maxTexture2DMipmap)] except ValueError: str_list += ['maxTexture2DMipmap : '] + + try: str_list += ['maxTexture2DLinear : ' + str(self.maxTexture2DLinear)] except ValueError: str_list += ['maxTexture2DLinear : '] + + try: str_list += ['maxTexture2DGather : ' + str(self.maxTexture2DGather)] except ValueError: str_list += ['maxTexture2DGather : '] + + try: str_list += ['maxTexture3D : ' + str(self.maxTexture3D)] except ValueError: str_list += ['maxTexture3D : '] + + try: str_list += ['maxTexture3DAlt : ' + str(self.maxTexture3DAlt)] except ValueError: str_list += ['maxTexture3DAlt : '] + + try: str_list += ['maxTextureCubemap : ' + str(self.maxTextureCubemap)] except ValueError: str_list += ['maxTextureCubemap : '] + + try: str_list += ['maxTexture1DLayered : ' + str(self.maxTexture1DLayered)] except ValueError: str_list += ['maxTexture1DLayered : '] + + try: str_list += ['maxTexture2DLayered : ' + str(self.maxTexture2DLayered)] except ValueError: str_list += ['maxTexture2DLayered : '] + + try: str_list += ['maxTextureCubemapLayered : ' + str(self.maxTextureCubemapLayered)] except ValueError: str_list += ['maxTextureCubemapLayered : '] + + try: str_list += ['maxSurface1D : ' + str(self.maxSurface1D)] except ValueError: str_list += ['maxSurface1D : '] + + try: str_list += ['maxSurface2D : ' + str(self.maxSurface2D)] except ValueError: str_list += ['maxSurface2D : '] + + try: str_list += ['maxSurface3D : ' + str(self.maxSurface3D)] except ValueError: str_list += ['maxSurface3D : '] + + try: str_list += ['maxSurface1DLayered : ' + str(self.maxSurface1DLayered)] except ValueError: str_list += ['maxSurface1DLayered : '] + + try: str_list += ['maxSurface2DLayered : ' + str(self.maxSurface2DLayered)] except ValueError: str_list += ['maxSurface2DLayered : '] + + try: str_list += ['maxSurfaceCubemap : ' + str(self.maxSurfaceCubemap)] except ValueError: str_list += ['maxSurfaceCubemap : '] + + try: str_list += ['maxSurfaceCubemapLayered : ' + str(self.maxSurfaceCubemapLayered)] except ValueError: str_list += ['maxSurfaceCubemapLayered : '] + + try: str_list += ['surfaceAlignment : ' + str(self.surfaceAlignment)] except ValueError: str_list += ['surfaceAlignment : '] + + try: str_list += ['concurrentKernels : ' + str(self.concurrentKernels)] except ValueError: str_list += ['concurrentKernels : '] + + try: str_list += ['ECCEnabled : ' + str(self.ECCEnabled)] except ValueError: str_list += ['ECCEnabled : '] + + try: str_list += ['pciBusID : ' + str(self.pciBusID)] except ValueError: str_list += ['pciBusID : '] + + try: str_list += ['pciDeviceID : ' + str(self.pciDeviceID)] except ValueError: str_list += ['pciDeviceID : '] + + try: str_list += ['pciDomainID : ' + str(self.pciDomainID)] except ValueError: str_list += ['pciDomainID : '] + + try: str_list += ['tccDriver : ' + str(self.tccDriver)] except ValueError: str_list += ['tccDriver : '] + + try: str_list += ['asyncEngineCount : ' + str(self.asyncEngineCount)] except ValueError: str_list += ['asyncEngineCount : '] + + try: str_list += ['unifiedAddressing : ' + str(self.unifiedAddressing)] except ValueError: str_list += ['unifiedAddressing : '] - try: - str_list += ['memoryClockRate : ' + str(self.memoryClockRate)] - except ValueError: - str_list += ['memoryClockRate : '] + + try: str_list += ['memoryBusWidth : ' + str(self.memoryBusWidth)] except ValueError: str_list += ['memoryBusWidth : '] + + try: str_list += ['l2CacheSize : ' + str(self.l2CacheSize)] except ValueError: str_list += ['l2CacheSize : '] + + try: str_list += ['persistingL2CacheMaxSize : ' + str(self.persistingL2CacheMaxSize)] except ValueError: str_list += ['persistingL2CacheMaxSize : '] + + try: str_list += ['maxThreadsPerMultiProcessor : ' + str(self.maxThreadsPerMultiProcessor)] except ValueError: str_list += ['maxThreadsPerMultiProcessor : '] + + try: str_list += ['streamPrioritiesSupported : ' + str(self.streamPrioritiesSupported)] except ValueError: str_list += ['streamPrioritiesSupported : '] + + try: str_list += ['globalL1CacheSupported : ' + str(self.globalL1CacheSupported)] except ValueError: str_list += ['globalL1CacheSupported : '] + + try: str_list += ['localL1CacheSupported : ' + str(self.localL1CacheSupported)] except ValueError: str_list += ['localL1CacheSupported : '] + + try: str_list += ['sharedMemPerMultiprocessor : ' + str(self.sharedMemPerMultiprocessor)] except ValueError: str_list += ['sharedMemPerMultiprocessor : '] + + try: str_list += ['regsPerMultiprocessor : ' + str(self.regsPerMultiprocessor)] except ValueError: str_list += ['regsPerMultiprocessor : '] + + try: str_list += ['managedMemory : ' + str(self.managedMemory)] except ValueError: str_list += ['managedMemory : '] + + try: str_list += ['isMultiGpuBoard : ' + str(self.isMultiGpuBoard)] except ValueError: str_list += ['isMultiGpuBoard : '] + + try: str_list += ['multiGpuBoardGroupID : ' + str(self.multiGpuBoardGroupID)] except ValueError: str_list += ['multiGpuBoardGroupID : '] + + try: str_list += ['hostNativeAtomicSupported : ' + str(self.hostNativeAtomicSupported)] except ValueError: str_list += ['hostNativeAtomicSupported : '] - try: - str_list += ['singleToDoublePrecisionPerfRatio : ' + str(self.singleToDoublePrecisionPerfRatio)] - except ValueError: - str_list += ['singleToDoublePrecisionPerfRatio : '] + + try: str_list += ['pageableMemoryAccess : ' + str(self.pageableMemoryAccess)] except ValueError: str_list += ['pageableMemoryAccess : '] + + try: str_list += ['concurrentManagedAccess : ' + str(self.concurrentManagedAccess)] except ValueError: str_list += ['concurrentManagedAccess : '] + + try: str_list += ['computePreemptionSupported : ' + str(self.computePreemptionSupported)] except ValueError: str_list += ['computePreemptionSupported : '] + + try: str_list += ['canUseHostPointerForRegisteredMem : ' + str(self.canUseHostPointerForRegisteredMem)] except ValueError: str_list += ['canUseHostPointerForRegisteredMem : '] + + try: str_list += ['cooperativeLaunch : ' + str(self.cooperativeLaunch)] except ValueError: str_list += ['cooperativeLaunch : '] - try: - str_list += ['cooperativeMultiDeviceLaunch : ' + str(self.cooperativeMultiDeviceLaunch)] - except ValueError: - str_list += ['cooperativeMultiDeviceLaunch : '] + + try: str_list += ['sharedMemPerBlockOptin : ' + str(self.sharedMemPerBlockOptin)] except ValueError: str_list += ['sharedMemPerBlockOptin : '] + + try: str_list += ['pageableMemoryAccessUsesHostPageTables : ' + str(self.pageableMemoryAccessUsesHostPageTables)] except ValueError: str_list += ['pageableMemoryAccessUsesHostPageTables : '] + + try: str_list += ['directManagedMemAccessFromHost : ' + str(self.directManagedMemAccessFromHost)] except ValueError: str_list += ['directManagedMemAccessFromHost : '] + + try: str_list += ['maxBlocksPerMultiProcessor : ' + str(self.maxBlocksPerMultiProcessor)] except ValueError: str_list += ['maxBlocksPerMultiProcessor : '] + + try: str_list += ['accessPolicyMaxWindowSize : ' + str(self.accessPolicyMaxWindowSize)] except ValueError: str_list += ['accessPolicyMaxWindowSize : '] + + try: str_list += ['reservedSharedMemPerBlock : ' + str(self.reservedSharedMemPerBlock)] except ValueError: str_list += ['reservedSharedMemPerBlock : '] + + try: str_list += ['hostRegisterSupported : ' + str(self.hostRegisterSupported)] except ValueError: str_list += ['hostRegisterSupported : '] + + try: str_list += ['sparseCudaArraySupported : ' + str(self.sparseCudaArraySupported)] except ValueError: str_list += ['sparseCudaArraySupported : '] + + try: str_list += ['hostRegisterReadOnlySupported : ' + str(self.hostRegisterReadOnlySupported)] except ValueError: str_list += ['hostRegisterReadOnlySupported : '] + + try: str_list += ['timelineSemaphoreInteropSupported : ' + str(self.timelineSemaphoreInteropSupported)] except ValueError: str_list += ['timelineSemaphoreInteropSupported : '] + + try: str_list += ['memoryPoolsSupported : ' + str(self.memoryPoolsSupported)] except ValueError: str_list += ['memoryPoolsSupported : '] + + try: str_list += ['gpuDirectRDMASupported : ' + str(self.gpuDirectRDMASupported)] except ValueError: str_list += ['gpuDirectRDMASupported : '] + + try: str_list += ['gpuDirectRDMAFlushWritesOptions : ' + str(self.gpuDirectRDMAFlushWritesOptions)] except ValueError: str_list += ['gpuDirectRDMAFlushWritesOptions : '] + + try: str_list += ['gpuDirectRDMAWritesOrdering : ' + str(self.gpuDirectRDMAWritesOrdering)] except ValueError: str_list += ['gpuDirectRDMAWritesOrdering : '] + + try: str_list += ['memoryPoolSupportedHandleTypes : ' + str(self.memoryPoolSupportedHandleTypes)] except ValueError: str_list += ['memoryPoolSupportedHandleTypes : '] + + try: str_list += ['deferredMappingCudaArraySupported : ' + str(self.deferredMappingCudaArraySupported)] except ValueError: str_list += ['deferredMappingCudaArraySupported : '] + + try: str_list += ['ipcEventSupported : ' + str(self.ipcEventSupported)] except ValueError: str_list += ['ipcEventSupported : '] + + try: str_list += ['clusterLaunch : ' + str(self.clusterLaunch)] except ValueError: str_list += ['clusterLaunch : '] + + try: str_list += ['unifiedFunctionPointers : ' + str(self.unifiedFunctionPointers)] except ValueError: str_list += ['unifiedFunctionPointers : '] + + try: - str_list += ['reserved2 : ' + str(self.reserved2)] + str_list += ['deviceNumaConfig : ' + str(self.deviceNumaConfig)] except ValueError: - str_list += ['reserved2 : '] + str_list += ['deviceNumaConfig : '] + + try: - str_list += ['reserved1 : ' + str(self.reserved1)] + str_list += ['deviceNumaId : ' + str(self.deviceNumaId)] except ValueError: - str_list += ['reserved1 : '] + str_list += ['deviceNumaId : '] + + + try: + str_list += ['mpsEnabled : ' + str(self.mpsEnabled)] + except ValueError: + str_list += ['mpsEnabled : '] + + + try: + str_list += ['hostNumaId : ' + str(self.hostNumaId)] + except ValueError: + str_list += ['hostNumaId : '] + + + try: + str_list += ['gpuPciDeviceID : ' + str(self.gpuPciDeviceID)] + except ValueError: + str_list += ['gpuPciDeviceID : '] + + + try: + str_list += ['gpuPciSubsystemID : ' + str(self.gpuPciSubsystemID)] + except ValueError: + str_list += ['gpuPciSubsystemID : '] + + + try: + str_list += ['hostNumaMultinodeIpcSupported : ' + str(self.hostNumaMultinodeIpcSupported)] + except ValueError: + str_list += ['hostNumaMultinodeIpcSupported : '] + + try: str_list += ['reserved : ' + str(self.reserved)] except ValueError: str_list += ['reserved : '] + return '\n'.join(str_list) else: return '' + @property def name(self): - return self._ptr[0].name + return self._pvt_ptr[0].name @name.setter def name(self, name): pass - self._ptr[0].name = name + self._pvt_ptr[0].name = name + + @property def uuid(self): return self._uuid @uuid.setter def uuid(self, uuid not None : cudaUUID_t): - string.memcpy(&self._ptr[0].uuid, uuid.getPtr(), sizeof(self._ptr[0].uuid)) + string.memcpy(&self._pvt_ptr[0].uuid, uuid.getPtr(), sizeof(self._pvt_ptr[0].uuid)) + + @property def luid(self): - return PyBytes_FromStringAndSize(self._ptr[0].luid, 8) + return PyBytes_FromStringAndSize(self._pvt_ptr[0].luid, 8) @luid.setter def luid(self, luid): if len(luid) != 8: @@ -8583,1893 +13279,3083 @@ cdef class cudaDeviceProp: for i, b in enumerate(luid): if b < 0 and b > -129: b = b + 256 - self._ptr[0].luid[i] = b + self._pvt_ptr[0].luid[i] = b else: for i, b in enumerate(luid): if b > 127 and b < 256: b = b - 256 - self._ptr[0].luid[i] = b + self._pvt_ptr[0].luid[i] = b + + @property def luidDeviceNodeMask(self): - return self._ptr[0].luidDeviceNodeMask + return self._pvt_ptr[0].luidDeviceNodeMask @luidDeviceNodeMask.setter def luidDeviceNodeMask(self, unsigned int luidDeviceNodeMask): - self._ptr[0].luidDeviceNodeMask = luidDeviceNodeMask + self._pvt_ptr[0].luidDeviceNodeMask = luidDeviceNodeMask + + @property def totalGlobalMem(self): - return self._ptr[0].totalGlobalMem + return self._pvt_ptr[0].totalGlobalMem @totalGlobalMem.setter def totalGlobalMem(self, size_t totalGlobalMem): - self._ptr[0].totalGlobalMem = totalGlobalMem + self._pvt_ptr[0].totalGlobalMem = totalGlobalMem + + @property def sharedMemPerBlock(self): - return self._ptr[0].sharedMemPerBlock + return self._pvt_ptr[0].sharedMemPerBlock @sharedMemPerBlock.setter def sharedMemPerBlock(self, size_t sharedMemPerBlock): - self._ptr[0].sharedMemPerBlock = sharedMemPerBlock + self._pvt_ptr[0].sharedMemPerBlock = sharedMemPerBlock + + @property def regsPerBlock(self): - return self._ptr[0].regsPerBlock + return self._pvt_ptr[0].regsPerBlock @regsPerBlock.setter def regsPerBlock(self, int regsPerBlock): - self._ptr[0].regsPerBlock = regsPerBlock + self._pvt_ptr[0].regsPerBlock = regsPerBlock + + @property def warpSize(self): - return self._ptr[0].warpSize + return self._pvt_ptr[0].warpSize @warpSize.setter def warpSize(self, int warpSize): - self._ptr[0].warpSize = warpSize + self._pvt_ptr[0].warpSize = warpSize + + @property def memPitch(self): - return self._ptr[0].memPitch + return self._pvt_ptr[0].memPitch @memPitch.setter def memPitch(self, size_t memPitch): - self._ptr[0].memPitch = memPitch + self._pvt_ptr[0].memPitch = memPitch + + @property def maxThreadsPerBlock(self): - return self._ptr[0].maxThreadsPerBlock + return self._pvt_ptr[0].maxThreadsPerBlock @maxThreadsPerBlock.setter def maxThreadsPerBlock(self, int maxThreadsPerBlock): - self._ptr[0].maxThreadsPerBlock = maxThreadsPerBlock + self._pvt_ptr[0].maxThreadsPerBlock = maxThreadsPerBlock + + @property def maxThreadsDim(self): - return self._ptr[0].maxThreadsDim + return self._pvt_ptr[0].maxThreadsDim @maxThreadsDim.setter def maxThreadsDim(self, maxThreadsDim): - self._ptr[0].maxThreadsDim = maxThreadsDim + self._pvt_ptr[0].maxThreadsDim = maxThreadsDim + + @property def maxGridSize(self): - return self._ptr[0].maxGridSize + return self._pvt_ptr[0].maxGridSize @maxGridSize.setter def maxGridSize(self, maxGridSize): - self._ptr[0].maxGridSize = maxGridSize - @property - def clockRate(self): - return self._ptr[0].clockRate - @clockRate.setter - def clockRate(self, int clockRate): - self._ptr[0].clockRate = clockRate + self._pvt_ptr[0].maxGridSize = maxGridSize + + @property def totalConstMem(self): - return self._ptr[0].totalConstMem + return self._pvt_ptr[0].totalConstMem @totalConstMem.setter def totalConstMem(self, size_t totalConstMem): - self._ptr[0].totalConstMem = totalConstMem + self._pvt_ptr[0].totalConstMem = totalConstMem + + @property def major(self): - return self._ptr[0].major + return self._pvt_ptr[0].major @major.setter def major(self, int major): - self._ptr[0].major = major + self._pvt_ptr[0].major = major + + @property def minor(self): - return self._ptr[0].minor + return self._pvt_ptr[0].minor @minor.setter def minor(self, int minor): - self._ptr[0].minor = minor + self._pvt_ptr[0].minor = minor + + @property def textureAlignment(self): - return self._ptr[0].textureAlignment + return self._pvt_ptr[0].textureAlignment @textureAlignment.setter def textureAlignment(self, size_t textureAlignment): - self._ptr[0].textureAlignment = textureAlignment + self._pvt_ptr[0].textureAlignment = textureAlignment + + @property def texturePitchAlignment(self): - return self._ptr[0].texturePitchAlignment + return self._pvt_ptr[0].texturePitchAlignment @texturePitchAlignment.setter def texturePitchAlignment(self, size_t texturePitchAlignment): - self._ptr[0].texturePitchAlignment = texturePitchAlignment - @property - def deviceOverlap(self): - return self._ptr[0].deviceOverlap - @deviceOverlap.setter - def deviceOverlap(self, int deviceOverlap): - self._ptr[0].deviceOverlap = deviceOverlap + self._pvt_ptr[0].texturePitchAlignment = texturePitchAlignment + + @property def multiProcessorCount(self): - return self._ptr[0].multiProcessorCount + return self._pvt_ptr[0].multiProcessorCount @multiProcessorCount.setter def multiProcessorCount(self, int multiProcessorCount): - self._ptr[0].multiProcessorCount = multiProcessorCount - @property - def kernelExecTimeoutEnabled(self): - return self._ptr[0].kernelExecTimeoutEnabled - @kernelExecTimeoutEnabled.setter - def kernelExecTimeoutEnabled(self, int kernelExecTimeoutEnabled): - self._ptr[0].kernelExecTimeoutEnabled = kernelExecTimeoutEnabled + self._pvt_ptr[0].multiProcessorCount = multiProcessorCount + + @property def integrated(self): - return self._ptr[0].integrated + return self._pvt_ptr[0].integrated @integrated.setter def integrated(self, int integrated): - self._ptr[0].integrated = integrated + self._pvt_ptr[0].integrated = integrated + + @property def canMapHostMemory(self): - return self._ptr[0].canMapHostMemory + return self._pvt_ptr[0].canMapHostMemory @canMapHostMemory.setter def canMapHostMemory(self, int canMapHostMemory): - self._ptr[0].canMapHostMemory = canMapHostMemory - @property - def computeMode(self): - return self._ptr[0].computeMode - @computeMode.setter - def computeMode(self, int computeMode): - self._ptr[0].computeMode = computeMode + self._pvt_ptr[0].canMapHostMemory = canMapHostMemory + + @property def maxTexture1D(self): - return self._ptr[0].maxTexture1D + return self._pvt_ptr[0].maxTexture1D @maxTexture1D.setter def maxTexture1D(self, int maxTexture1D): - self._ptr[0].maxTexture1D = maxTexture1D + self._pvt_ptr[0].maxTexture1D = maxTexture1D + + @property def maxTexture1DMipmap(self): - return self._ptr[0].maxTexture1DMipmap + return self._pvt_ptr[0].maxTexture1DMipmap @maxTexture1DMipmap.setter def maxTexture1DMipmap(self, int maxTexture1DMipmap): - self._ptr[0].maxTexture1DMipmap = maxTexture1DMipmap - @property - def maxTexture1DLinear(self): - return self._ptr[0].maxTexture1DLinear - @maxTexture1DLinear.setter - def maxTexture1DLinear(self, int maxTexture1DLinear): - self._ptr[0].maxTexture1DLinear = maxTexture1DLinear + self._pvt_ptr[0].maxTexture1DMipmap = maxTexture1DMipmap + + @property def maxTexture2D(self): - return self._ptr[0].maxTexture2D + return self._pvt_ptr[0].maxTexture2D @maxTexture2D.setter def maxTexture2D(self, maxTexture2D): - self._ptr[0].maxTexture2D = maxTexture2D + self._pvt_ptr[0].maxTexture2D = maxTexture2D + + @property def maxTexture2DMipmap(self): - return self._ptr[0].maxTexture2DMipmap + return self._pvt_ptr[0].maxTexture2DMipmap @maxTexture2DMipmap.setter def maxTexture2DMipmap(self, maxTexture2DMipmap): - self._ptr[0].maxTexture2DMipmap = maxTexture2DMipmap + self._pvt_ptr[0].maxTexture2DMipmap = maxTexture2DMipmap + + @property def maxTexture2DLinear(self): - return self._ptr[0].maxTexture2DLinear + return self._pvt_ptr[0].maxTexture2DLinear @maxTexture2DLinear.setter def maxTexture2DLinear(self, maxTexture2DLinear): - self._ptr[0].maxTexture2DLinear = maxTexture2DLinear + self._pvt_ptr[0].maxTexture2DLinear = maxTexture2DLinear + + @property def maxTexture2DGather(self): - return self._ptr[0].maxTexture2DGather + return self._pvt_ptr[0].maxTexture2DGather @maxTexture2DGather.setter def maxTexture2DGather(self, maxTexture2DGather): - self._ptr[0].maxTexture2DGather = maxTexture2DGather + self._pvt_ptr[0].maxTexture2DGather = maxTexture2DGather + + @property def maxTexture3D(self): - return self._ptr[0].maxTexture3D + return self._pvt_ptr[0].maxTexture3D @maxTexture3D.setter def maxTexture3D(self, maxTexture3D): - self._ptr[0].maxTexture3D = maxTexture3D + self._pvt_ptr[0].maxTexture3D = maxTexture3D + + @property def maxTexture3DAlt(self): - return self._ptr[0].maxTexture3DAlt + return self._pvt_ptr[0].maxTexture3DAlt @maxTexture3DAlt.setter def maxTexture3DAlt(self, maxTexture3DAlt): - self._ptr[0].maxTexture3DAlt = maxTexture3DAlt + self._pvt_ptr[0].maxTexture3DAlt = maxTexture3DAlt + + @property def maxTextureCubemap(self): - return self._ptr[0].maxTextureCubemap + return self._pvt_ptr[0].maxTextureCubemap @maxTextureCubemap.setter def maxTextureCubemap(self, int maxTextureCubemap): - self._ptr[0].maxTextureCubemap = maxTextureCubemap + self._pvt_ptr[0].maxTextureCubemap = maxTextureCubemap + + @property def maxTexture1DLayered(self): - return self._ptr[0].maxTexture1DLayered + return self._pvt_ptr[0].maxTexture1DLayered @maxTexture1DLayered.setter def maxTexture1DLayered(self, maxTexture1DLayered): - self._ptr[0].maxTexture1DLayered = maxTexture1DLayered + self._pvt_ptr[0].maxTexture1DLayered = maxTexture1DLayered + + @property def maxTexture2DLayered(self): - return self._ptr[0].maxTexture2DLayered + return self._pvt_ptr[0].maxTexture2DLayered @maxTexture2DLayered.setter def maxTexture2DLayered(self, maxTexture2DLayered): - self._ptr[0].maxTexture2DLayered = maxTexture2DLayered + self._pvt_ptr[0].maxTexture2DLayered = maxTexture2DLayered + + @property def maxTextureCubemapLayered(self): - return self._ptr[0].maxTextureCubemapLayered + return self._pvt_ptr[0].maxTextureCubemapLayered @maxTextureCubemapLayered.setter def maxTextureCubemapLayered(self, maxTextureCubemapLayered): - self._ptr[0].maxTextureCubemapLayered = maxTextureCubemapLayered + self._pvt_ptr[0].maxTextureCubemapLayered = maxTextureCubemapLayered + + @property def maxSurface1D(self): - return self._ptr[0].maxSurface1D + return self._pvt_ptr[0].maxSurface1D @maxSurface1D.setter def maxSurface1D(self, int maxSurface1D): - self._ptr[0].maxSurface1D = maxSurface1D + self._pvt_ptr[0].maxSurface1D = maxSurface1D + + @property def maxSurface2D(self): - return self._ptr[0].maxSurface2D + return self._pvt_ptr[0].maxSurface2D @maxSurface2D.setter def maxSurface2D(self, maxSurface2D): - self._ptr[0].maxSurface2D = maxSurface2D + self._pvt_ptr[0].maxSurface2D = maxSurface2D + + @property def maxSurface3D(self): - return self._ptr[0].maxSurface3D + return self._pvt_ptr[0].maxSurface3D @maxSurface3D.setter def maxSurface3D(self, maxSurface3D): - self._ptr[0].maxSurface3D = maxSurface3D + self._pvt_ptr[0].maxSurface3D = maxSurface3D + + @property def maxSurface1DLayered(self): - return self._ptr[0].maxSurface1DLayered + return self._pvt_ptr[0].maxSurface1DLayered @maxSurface1DLayered.setter def maxSurface1DLayered(self, maxSurface1DLayered): - self._ptr[0].maxSurface1DLayered = maxSurface1DLayered + self._pvt_ptr[0].maxSurface1DLayered = maxSurface1DLayered + + @property def maxSurface2DLayered(self): - return self._ptr[0].maxSurface2DLayered + return self._pvt_ptr[0].maxSurface2DLayered @maxSurface2DLayered.setter def maxSurface2DLayered(self, maxSurface2DLayered): - self._ptr[0].maxSurface2DLayered = maxSurface2DLayered + self._pvt_ptr[0].maxSurface2DLayered = maxSurface2DLayered + + @property def maxSurfaceCubemap(self): - return self._ptr[0].maxSurfaceCubemap + return self._pvt_ptr[0].maxSurfaceCubemap @maxSurfaceCubemap.setter def maxSurfaceCubemap(self, int maxSurfaceCubemap): - self._ptr[0].maxSurfaceCubemap = maxSurfaceCubemap + self._pvt_ptr[0].maxSurfaceCubemap = maxSurfaceCubemap + + @property def maxSurfaceCubemapLayered(self): - return self._ptr[0].maxSurfaceCubemapLayered + return self._pvt_ptr[0].maxSurfaceCubemapLayered @maxSurfaceCubemapLayered.setter def maxSurfaceCubemapLayered(self, maxSurfaceCubemapLayered): - self._ptr[0].maxSurfaceCubemapLayered = maxSurfaceCubemapLayered + self._pvt_ptr[0].maxSurfaceCubemapLayered = maxSurfaceCubemapLayered + + @property def surfaceAlignment(self): - return self._ptr[0].surfaceAlignment + return self._pvt_ptr[0].surfaceAlignment @surfaceAlignment.setter def surfaceAlignment(self, size_t surfaceAlignment): - self._ptr[0].surfaceAlignment = surfaceAlignment + self._pvt_ptr[0].surfaceAlignment = surfaceAlignment + + @property def concurrentKernels(self): - return self._ptr[0].concurrentKernels + return self._pvt_ptr[0].concurrentKernels @concurrentKernels.setter def concurrentKernels(self, int concurrentKernels): - self._ptr[0].concurrentKernels = concurrentKernels + self._pvt_ptr[0].concurrentKernels = concurrentKernels + + @property def ECCEnabled(self): - return self._ptr[0].ECCEnabled + return self._pvt_ptr[0].ECCEnabled @ECCEnabled.setter def ECCEnabled(self, int ECCEnabled): - self._ptr[0].ECCEnabled = ECCEnabled + self._pvt_ptr[0].ECCEnabled = ECCEnabled + + @property def pciBusID(self): - return self._ptr[0].pciBusID + return self._pvt_ptr[0].pciBusID @pciBusID.setter def pciBusID(self, int pciBusID): - self._ptr[0].pciBusID = pciBusID + self._pvt_ptr[0].pciBusID = pciBusID + + @property def pciDeviceID(self): - return self._ptr[0].pciDeviceID + return self._pvt_ptr[0].pciDeviceID @pciDeviceID.setter def pciDeviceID(self, int pciDeviceID): - self._ptr[0].pciDeviceID = pciDeviceID + self._pvt_ptr[0].pciDeviceID = pciDeviceID + + @property def pciDomainID(self): - return self._ptr[0].pciDomainID + return self._pvt_ptr[0].pciDomainID @pciDomainID.setter def pciDomainID(self, int pciDomainID): - self._ptr[0].pciDomainID = pciDomainID + self._pvt_ptr[0].pciDomainID = pciDomainID + + @property def tccDriver(self): - return self._ptr[0].tccDriver + return self._pvt_ptr[0].tccDriver @tccDriver.setter def tccDriver(self, int tccDriver): - self._ptr[0].tccDriver = tccDriver + self._pvt_ptr[0].tccDriver = tccDriver + + @property def asyncEngineCount(self): - return self._ptr[0].asyncEngineCount + return self._pvt_ptr[0].asyncEngineCount @asyncEngineCount.setter def asyncEngineCount(self, int asyncEngineCount): - self._ptr[0].asyncEngineCount = asyncEngineCount + self._pvt_ptr[0].asyncEngineCount = asyncEngineCount + + @property def unifiedAddressing(self): - return self._ptr[0].unifiedAddressing + return self._pvt_ptr[0].unifiedAddressing @unifiedAddressing.setter def unifiedAddressing(self, int unifiedAddressing): - self._ptr[0].unifiedAddressing = unifiedAddressing - @property - def memoryClockRate(self): - return self._ptr[0].memoryClockRate - @memoryClockRate.setter - def memoryClockRate(self, int memoryClockRate): - self._ptr[0].memoryClockRate = memoryClockRate + self._pvt_ptr[0].unifiedAddressing = unifiedAddressing + + @property def memoryBusWidth(self): - return self._ptr[0].memoryBusWidth + return self._pvt_ptr[0].memoryBusWidth @memoryBusWidth.setter def memoryBusWidth(self, int memoryBusWidth): - self._ptr[0].memoryBusWidth = memoryBusWidth + self._pvt_ptr[0].memoryBusWidth = memoryBusWidth + + @property def l2CacheSize(self): - return self._ptr[0].l2CacheSize + return self._pvt_ptr[0].l2CacheSize @l2CacheSize.setter def l2CacheSize(self, int l2CacheSize): - self._ptr[0].l2CacheSize = l2CacheSize + self._pvt_ptr[0].l2CacheSize = l2CacheSize + + @property def persistingL2CacheMaxSize(self): - return self._ptr[0].persistingL2CacheMaxSize + return self._pvt_ptr[0].persistingL2CacheMaxSize @persistingL2CacheMaxSize.setter def persistingL2CacheMaxSize(self, int persistingL2CacheMaxSize): - self._ptr[0].persistingL2CacheMaxSize = persistingL2CacheMaxSize + self._pvt_ptr[0].persistingL2CacheMaxSize = persistingL2CacheMaxSize + + @property def maxThreadsPerMultiProcessor(self): - return self._ptr[0].maxThreadsPerMultiProcessor + return self._pvt_ptr[0].maxThreadsPerMultiProcessor @maxThreadsPerMultiProcessor.setter def maxThreadsPerMultiProcessor(self, int maxThreadsPerMultiProcessor): - self._ptr[0].maxThreadsPerMultiProcessor = maxThreadsPerMultiProcessor + self._pvt_ptr[0].maxThreadsPerMultiProcessor = maxThreadsPerMultiProcessor + + @property def streamPrioritiesSupported(self): - return self._ptr[0].streamPrioritiesSupported + return self._pvt_ptr[0].streamPrioritiesSupported @streamPrioritiesSupported.setter def streamPrioritiesSupported(self, int streamPrioritiesSupported): - self._ptr[0].streamPrioritiesSupported = streamPrioritiesSupported + self._pvt_ptr[0].streamPrioritiesSupported = streamPrioritiesSupported + + @property def globalL1CacheSupported(self): - return self._ptr[0].globalL1CacheSupported + return self._pvt_ptr[0].globalL1CacheSupported @globalL1CacheSupported.setter def globalL1CacheSupported(self, int globalL1CacheSupported): - self._ptr[0].globalL1CacheSupported = globalL1CacheSupported + self._pvt_ptr[0].globalL1CacheSupported = globalL1CacheSupported + + @property def localL1CacheSupported(self): - return self._ptr[0].localL1CacheSupported + return self._pvt_ptr[0].localL1CacheSupported @localL1CacheSupported.setter def localL1CacheSupported(self, int localL1CacheSupported): - self._ptr[0].localL1CacheSupported = localL1CacheSupported + self._pvt_ptr[0].localL1CacheSupported = localL1CacheSupported + + @property def sharedMemPerMultiprocessor(self): - return self._ptr[0].sharedMemPerMultiprocessor + return self._pvt_ptr[0].sharedMemPerMultiprocessor @sharedMemPerMultiprocessor.setter def sharedMemPerMultiprocessor(self, size_t sharedMemPerMultiprocessor): - self._ptr[0].sharedMemPerMultiprocessor = sharedMemPerMultiprocessor + self._pvt_ptr[0].sharedMemPerMultiprocessor = sharedMemPerMultiprocessor + + @property def regsPerMultiprocessor(self): - return self._ptr[0].regsPerMultiprocessor + return self._pvt_ptr[0].regsPerMultiprocessor @regsPerMultiprocessor.setter def regsPerMultiprocessor(self, int regsPerMultiprocessor): - self._ptr[0].regsPerMultiprocessor = regsPerMultiprocessor + self._pvt_ptr[0].regsPerMultiprocessor = regsPerMultiprocessor + + @property def managedMemory(self): - return self._ptr[0].managedMemory + return self._pvt_ptr[0].managedMemory @managedMemory.setter def managedMemory(self, int managedMemory): - self._ptr[0].managedMemory = managedMemory + self._pvt_ptr[0].managedMemory = managedMemory + + @property def isMultiGpuBoard(self): - return self._ptr[0].isMultiGpuBoard + return self._pvt_ptr[0].isMultiGpuBoard @isMultiGpuBoard.setter def isMultiGpuBoard(self, int isMultiGpuBoard): - self._ptr[0].isMultiGpuBoard = isMultiGpuBoard + self._pvt_ptr[0].isMultiGpuBoard = isMultiGpuBoard + + @property def multiGpuBoardGroupID(self): - return self._ptr[0].multiGpuBoardGroupID + return self._pvt_ptr[0].multiGpuBoardGroupID @multiGpuBoardGroupID.setter def multiGpuBoardGroupID(self, int multiGpuBoardGroupID): - self._ptr[0].multiGpuBoardGroupID = multiGpuBoardGroupID + self._pvt_ptr[0].multiGpuBoardGroupID = multiGpuBoardGroupID + + @property def hostNativeAtomicSupported(self): - return self._ptr[0].hostNativeAtomicSupported + return self._pvt_ptr[0].hostNativeAtomicSupported @hostNativeAtomicSupported.setter def hostNativeAtomicSupported(self, int hostNativeAtomicSupported): - self._ptr[0].hostNativeAtomicSupported = hostNativeAtomicSupported - @property - def singleToDoublePrecisionPerfRatio(self): - return self._ptr[0].singleToDoublePrecisionPerfRatio - @singleToDoublePrecisionPerfRatio.setter - def singleToDoublePrecisionPerfRatio(self, int singleToDoublePrecisionPerfRatio): - self._ptr[0].singleToDoublePrecisionPerfRatio = singleToDoublePrecisionPerfRatio + self._pvt_ptr[0].hostNativeAtomicSupported = hostNativeAtomicSupported + + @property def pageableMemoryAccess(self): - return self._ptr[0].pageableMemoryAccess + return self._pvt_ptr[0].pageableMemoryAccess @pageableMemoryAccess.setter def pageableMemoryAccess(self, int pageableMemoryAccess): - self._ptr[0].pageableMemoryAccess = pageableMemoryAccess + self._pvt_ptr[0].pageableMemoryAccess = pageableMemoryAccess + + @property def concurrentManagedAccess(self): - return self._ptr[0].concurrentManagedAccess + return self._pvt_ptr[0].concurrentManagedAccess @concurrentManagedAccess.setter def concurrentManagedAccess(self, int concurrentManagedAccess): - self._ptr[0].concurrentManagedAccess = concurrentManagedAccess + self._pvt_ptr[0].concurrentManagedAccess = concurrentManagedAccess + + @property def computePreemptionSupported(self): - return self._ptr[0].computePreemptionSupported + return self._pvt_ptr[0].computePreemptionSupported @computePreemptionSupported.setter def computePreemptionSupported(self, int computePreemptionSupported): - self._ptr[0].computePreemptionSupported = computePreemptionSupported + self._pvt_ptr[0].computePreemptionSupported = computePreemptionSupported + + @property def canUseHostPointerForRegisteredMem(self): - return self._ptr[0].canUseHostPointerForRegisteredMem + return self._pvt_ptr[0].canUseHostPointerForRegisteredMem @canUseHostPointerForRegisteredMem.setter def canUseHostPointerForRegisteredMem(self, int canUseHostPointerForRegisteredMem): - self._ptr[0].canUseHostPointerForRegisteredMem = canUseHostPointerForRegisteredMem + self._pvt_ptr[0].canUseHostPointerForRegisteredMem = canUseHostPointerForRegisteredMem + + @property def cooperativeLaunch(self): - return self._ptr[0].cooperativeLaunch + return self._pvt_ptr[0].cooperativeLaunch @cooperativeLaunch.setter def cooperativeLaunch(self, int cooperativeLaunch): - self._ptr[0].cooperativeLaunch = cooperativeLaunch - @property - def cooperativeMultiDeviceLaunch(self): - return self._ptr[0].cooperativeMultiDeviceLaunch - @cooperativeMultiDeviceLaunch.setter - def cooperativeMultiDeviceLaunch(self, int cooperativeMultiDeviceLaunch): - self._ptr[0].cooperativeMultiDeviceLaunch = cooperativeMultiDeviceLaunch + self._pvt_ptr[0].cooperativeLaunch = cooperativeLaunch + + @property def sharedMemPerBlockOptin(self): - return self._ptr[0].sharedMemPerBlockOptin + return self._pvt_ptr[0].sharedMemPerBlockOptin @sharedMemPerBlockOptin.setter def sharedMemPerBlockOptin(self, size_t sharedMemPerBlockOptin): - self._ptr[0].sharedMemPerBlockOptin = sharedMemPerBlockOptin + self._pvt_ptr[0].sharedMemPerBlockOptin = sharedMemPerBlockOptin + + @property def pageableMemoryAccessUsesHostPageTables(self): - return self._ptr[0].pageableMemoryAccessUsesHostPageTables + return self._pvt_ptr[0].pageableMemoryAccessUsesHostPageTables @pageableMemoryAccessUsesHostPageTables.setter def pageableMemoryAccessUsesHostPageTables(self, int pageableMemoryAccessUsesHostPageTables): - self._ptr[0].pageableMemoryAccessUsesHostPageTables = pageableMemoryAccessUsesHostPageTables + self._pvt_ptr[0].pageableMemoryAccessUsesHostPageTables = pageableMemoryAccessUsesHostPageTables + + @property def directManagedMemAccessFromHost(self): - return self._ptr[0].directManagedMemAccessFromHost + return self._pvt_ptr[0].directManagedMemAccessFromHost @directManagedMemAccessFromHost.setter def directManagedMemAccessFromHost(self, int directManagedMemAccessFromHost): - self._ptr[0].directManagedMemAccessFromHost = directManagedMemAccessFromHost + self._pvt_ptr[0].directManagedMemAccessFromHost = directManagedMemAccessFromHost + + @property def maxBlocksPerMultiProcessor(self): - return self._ptr[0].maxBlocksPerMultiProcessor + return self._pvt_ptr[0].maxBlocksPerMultiProcessor @maxBlocksPerMultiProcessor.setter def maxBlocksPerMultiProcessor(self, int maxBlocksPerMultiProcessor): - self._ptr[0].maxBlocksPerMultiProcessor = maxBlocksPerMultiProcessor + self._pvt_ptr[0].maxBlocksPerMultiProcessor = maxBlocksPerMultiProcessor + + @property def accessPolicyMaxWindowSize(self): - return self._ptr[0].accessPolicyMaxWindowSize + return self._pvt_ptr[0].accessPolicyMaxWindowSize @accessPolicyMaxWindowSize.setter def accessPolicyMaxWindowSize(self, int accessPolicyMaxWindowSize): - self._ptr[0].accessPolicyMaxWindowSize = accessPolicyMaxWindowSize + self._pvt_ptr[0].accessPolicyMaxWindowSize = accessPolicyMaxWindowSize + + @property def reservedSharedMemPerBlock(self): - return self._ptr[0].reservedSharedMemPerBlock + return self._pvt_ptr[0].reservedSharedMemPerBlock @reservedSharedMemPerBlock.setter def reservedSharedMemPerBlock(self, size_t reservedSharedMemPerBlock): - self._ptr[0].reservedSharedMemPerBlock = reservedSharedMemPerBlock + self._pvt_ptr[0].reservedSharedMemPerBlock = reservedSharedMemPerBlock + + @property def hostRegisterSupported(self): - return self._ptr[0].hostRegisterSupported + return self._pvt_ptr[0].hostRegisterSupported @hostRegisterSupported.setter def hostRegisterSupported(self, int hostRegisterSupported): - self._ptr[0].hostRegisterSupported = hostRegisterSupported + self._pvt_ptr[0].hostRegisterSupported = hostRegisterSupported + + @property def sparseCudaArraySupported(self): - return self._ptr[0].sparseCudaArraySupported + return self._pvt_ptr[0].sparseCudaArraySupported @sparseCudaArraySupported.setter def sparseCudaArraySupported(self, int sparseCudaArraySupported): - self._ptr[0].sparseCudaArraySupported = sparseCudaArraySupported + self._pvt_ptr[0].sparseCudaArraySupported = sparseCudaArraySupported + + @property def hostRegisterReadOnlySupported(self): - return self._ptr[0].hostRegisterReadOnlySupported + return self._pvt_ptr[0].hostRegisterReadOnlySupported @hostRegisterReadOnlySupported.setter def hostRegisterReadOnlySupported(self, int hostRegisterReadOnlySupported): - self._ptr[0].hostRegisterReadOnlySupported = hostRegisterReadOnlySupported + self._pvt_ptr[0].hostRegisterReadOnlySupported = hostRegisterReadOnlySupported + + @property def timelineSemaphoreInteropSupported(self): - return self._ptr[0].timelineSemaphoreInteropSupported + return self._pvt_ptr[0].timelineSemaphoreInteropSupported @timelineSemaphoreInteropSupported.setter def timelineSemaphoreInteropSupported(self, int timelineSemaphoreInteropSupported): - self._ptr[0].timelineSemaphoreInteropSupported = timelineSemaphoreInteropSupported + self._pvt_ptr[0].timelineSemaphoreInteropSupported = timelineSemaphoreInteropSupported + + @property def memoryPoolsSupported(self): - return self._ptr[0].memoryPoolsSupported + return self._pvt_ptr[0].memoryPoolsSupported @memoryPoolsSupported.setter def memoryPoolsSupported(self, int memoryPoolsSupported): - self._ptr[0].memoryPoolsSupported = memoryPoolsSupported + self._pvt_ptr[0].memoryPoolsSupported = memoryPoolsSupported + + @property def gpuDirectRDMASupported(self): - return self._ptr[0].gpuDirectRDMASupported + return self._pvt_ptr[0].gpuDirectRDMASupported @gpuDirectRDMASupported.setter def gpuDirectRDMASupported(self, int gpuDirectRDMASupported): - self._ptr[0].gpuDirectRDMASupported = gpuDirectRDMASupported + self._pvt_ptr[0].gpuDirectRDMASupported = gpuDirectRDMASupported + + @property def gpuDirectRDMAFlushWritesOptions(self): - return self._ptr[0].gpuDirectRDMAFlushWritesOptions + return self._pvt_ptr[0].gpuDirectRDMAFlushWritesOptions @gpuDirectRDMAFlushWritesOptions.setter def gpuDirectRDMAFlushWritesOptions(self, unsigned int gpuDirectRDMAFlushWritesOptions): - self._ptr[0].gpuDirectRDMAFlushWritesOptions = gpuDirectRDMAFlushWritesOptions + self._pvt_ptr[0].gpuDirectRDMAFlushWritesOptions = gpuDirectRDMAFlushWritesOptions + + @property def gpuDirectRDMAWritesOrdering(self): - return self._ptr[0].gpuDirectRDMAWritesOrdering + return self._pvt_ptr[0].gpuDirectRDMAWritesOrdering @gpuDirectRDMAWritesOrdering.setter def gpuDirectRDMAWritesOrdering(self, int gpuDirectRDMAWritesOrdering): - self._ptr[0].gpuDirectRDMAWritesOrdering = gpuDirectRDMAWritesOrdering + self._pvt_ptr[0].gpuDirectRDMAWritesOrdering = gpuDirectRDMAWritesOrdering + + @property def memoryPoolSupportedHandleTypes(self): - return self._ptr[0].memoryPoolSupportedHandleTypes + return self._pvt_ptr[0].memoryPoolSupportedHandleTypes @memoryPoolSupportedHandleTypes.setter def memoryPoolSupportedHandleTypes(self, unsigned int memoryPoolSupportedHandleTypes): - self._ptr[0].memoryPoolSupportedHandleTypes = memoryPoolSupportedHandleTypes + self._pvt_ptr[0].memoryPoolSupportedHandleTypes = memoryPoolSupportedHandleTypes + + @property def deferredMappingCudaArraySupported(self): - return self._ptr[0].deferredMappingCudaArraySupported + return self._pvt_ptr[0].deferredMappingCudaArraySupported @deferredMappingCudaArraySupported.setter def deferredMappingCudaArraySupported(self, int deferredMappingCudaArraySupported): - self._ptr[0].deferredMappingCudaArraySupported = deferredMappingCudaArraySupported + self._pvt_ptr[0].deferredMappingCudaArraySupported = deferredMappingCudaArraySupported + + @property def ipcEventSupported(self): - return self._ptr[0].ipcEventSupported + return self._pvt_ptr[0].ipcEventSupported @ipcEventSupported.setter def ipcEventSupported(self, int ipcEventSupported): - self._ptr[0].ipcEventSupported = ipcEventSupported + self._pvt_ptr[0].ipcEventSupported = ipcEventSupported + + + @property + def clusterLaunch(self): + return self._pvt_ptr[0].clusterLaunch + @clusterLaunch.setter + def clusterLaunch(self, int clusterLaunch): + self._pvt_ptr[0].clusterLaunch = clusterLaunch + + + @property + def unifiedFunctionPointers(self): + return self._pvt_ptr[0].unifiedFunctionPointers + @unifiedFunctionPointers.setter + def unifiedFunctionPointers(self, int unifiedFunctionPointers): + self._pvt_ptr[0].unifiedFunctionPointers = unifiedFunctionPointers + + + @property + def deviceNumaConfig(self): + return self._pvt_ptr[0].deviceNumaConfig + @deviceNumaConfig.setter + def deviceNumaConfig(self, int deviceNumaConfig): + self._pvt_ptr[0].deviceNumaConfig = deviceNumaConfig + + + @property + def deviceNumaId(self): + return self._pvt_ptr[0].deviceNumaId + @deviceNumaId.setter + def deviceNumaId(self, int deviceNumaId): + self._pvt_ptr[0].deviceNumaId = deviceNumaId + + + @property + def mpsEnabled(self): + return self._pvt_ptr[0].mpsEnabled + @mpsEnabled.setter + def mpsEnabled(self, int mpsEnabled): + self._pvt_ptr[0].mpsEnabled = mpsEnabled + + + @property + def hostNumaId(self): + return self._pvt_ptr[0].hostNumaId + @hostNumaId.setter + def hostNumaId(self, int hostNumaId): + self._pvt_ptr[0].hostNumaId = hostNumaId + + + @property + def gpuPciDeviceID(self): + return self._pvt_ptr[0].gpuPciDeviceID + @gpuPciDeviceID.setter + def gpuPciDeviceID(self, unsigned int gpuPciDeviceID): + self._pvt_ptr[0].gpuPciDeviceID = gpuPciDeviceID + + + @property + def gpuPciSubsystemID(self): + return self._pvt_ptr[0].gpuPciSubsystemID + @gpuPciSubsystemID.setter + def gpuPciSubsystemID(self, unsigned int gpuPciSubsystemID): + self._pvt_ptr[0].gpuPciSubsystemID = gpuPciSubsystemID + + + @property + def hostNumaMultinodeIpcSupported(self): + return self._pvt_ptr[0].hostNumaMultinodeIpcSupported + @hostNumaMultinodeIpcSupported.setter + def hostNumaMultinodeIpcSupported(self, int hostNumaMultinodeIpcSupported): + self._pvt_ptr[0].hostNumaMultinodeIpcSupported = hostNumaMultinodeIpcSupported + + + @property + def reserved(self): + return self._pvt_ptr[0].reserved + @reserved.setter + def reserved(self, reserved): + self._pvt_ptr[0].reserved = reserved + + +cdef class cudaIpcEventHandle_st: + """ + CUDA IPC event handle + + Attributes + ---------- + + reserved : bytes + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass + def __dealloc__(self): + pass + def getPtr(self): + return self._pvt_ptr + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['reserved : ' + str(self.reserved)] + except ValueError: + str_list += ['reserved : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def reserved(self): + return PyBytes_FromStringAndSize(self._pvt_ptr[0].reserved, 64) + @reserved.setter + def reserved(self, reserved): + if len(reserved) != 64: + raise ValueError("reserved length must be 64, is " + str(len(reserved))) + if CHAR_MIN == 0: + for i, b in enumerate(reserved): + if b < 0 and b > -129: + b = b + 256 + self._pvt_ptr[0].reserved[i] = b + else: + for i, b in enumerate(reserved): + if b > 127 and b < 256: + b = b - 256 + self._pvt_ptr[0].reserved[i] = b + + +cdef class cudaIpcMemHandle_st: + """ + CUDA IPC memory handle + + Attributes + ---------- + + reserved : bytes + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass + def __dealloc__(self): + pass + def getPtr(self): + return self._pvt_ptr + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['reserved : ' + str(self.reserved)] + except ValueError: + str_list += ['reserved : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def reserved(self): + return PyBytes_FromStringAndSize(self._pvt_ptr[0].reserved, 64) + @reserved.setter + def reserved(self, reserved): + if len(reserved) != 64: + raise ValueError("reserved length must be 64, is " + str(len(reserved))) + if CHAR_MIN == 0: + for i, b in enumerate(reserved): + if b < 0 and b > -129: + b = b + 256 + self._pvt_ptr[0].reserved[i] = b + else: + for i, b in enumerate(reserved): + if b > 127 and b < 256: + b = b - 256 + self._pvt_ptr[0].reserved[i] = b + + +cdef class cudaMemFabricHandle_st: + """ + Attributes + ---------- + + reserved : bytes + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass + def __dealloc__(self): + pass + def getPtr(self): + return self._pvt_ptr + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['reserved : ' + str(self.reserved)] + except ValueError: + str_list += ['reserved : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def reserved(self): + return PyBytes_FromStringAndSize(self._pvt_ptr[0].reserved, 64) + @reserved.setter + def reserved(self, reserved): + if len(reserved) != 64: + raise ValueError("reserved length must be 64, is " + str(len(reserved))) + if CHAR_MIN == 0: + for i, b in enumerate(reserved): + if b < 0 and b > -129: + b = b + 256 + self._pvt_ptr[0].reserved[i] = b + else: + for i, b in enumerate(reserved): + if b > 127 and b < 256: + b = b - 256 + self._pvt_ptr[0].reserved[i] = b + + +cdef class anon_struct8: + """ + Attributes + ---------- + + handle : Any + + + + name : Any + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr): + self._pvt_ptr = _ptr + + def __init__(self, void_ptr _ptr): + pass + def __dealloc__(self): + pass + def getPtr(self): + return &self._pvt_ptr[0].handle.win32 + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['handle : ' + hex(self.handle)] + except ValueError: + str_list += ['handle : '] + + + try: + str_list += ['name : ' + hex(self.name)] + except ValueError: + str_list += ['name : '] + + return '\n'.join(str_list) + else: + return '' + @property - def clusterLaunch(self): - return self._ptr[0].clusterLaunch - @clusterLaunch.setter - def clusterLaunch(self, int clusterLaunch): - self._ptr[0].clusterLaunch = clusterLaunch + def handle(self): + return self._pvt_ptr[0].handle.win32.handle + @handle.setter + def handle(self, handle): + self._cyhandle = _HelperInputVoidPtr(handle) + self._pvt_ptr[0].handle.win32.handle = self._cyhandle.cptr + + @property - def unifiedFunctionPointers(self): - return self._ptr[0].unifiedFunctionPointers - @unifiedFunctionPointers.setter - def unifiedFunctionPointers(self, int unifiedFunctionPointers): - self._ptr[0].unifiedFunctionPointers = unifiedFunctionPointers + def name(self): + return self._pvt_ptr[0].handle.win32.name + @name.setter + def name(self, name): + self._cyname = _HelperInputVoidPtr(name) + self._pvt_ptr[0].handle.win32.name = self._cyname.cptr + + +cdef class anon_union3: + """ + Attributes + ---------- + + fd : int + + + + win32 : anon_struct8 + + + + nvSciBufObject : Any + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr): + self._pvt_ptr = _ptr + + def __init__(self, void_ptr _ptr): + pass + + self._win32 = anon_struct8(_ptr=self._pvt_ptr) + + def __dealloc__(self): + pass + def getPtr(self): + return &self._pvt_ptr[0].handle + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['fd : ' + str(self.fd)] + except ValueError: + str_list += ['fd : '] + + + try: + str_list += ['win32 :\n' + '\n'.join([' ' + line for line in str(self.win32).splitlines()])] + except ValueError: + str_list += ['win32 : '] + + + try: + str_list += ['nvSciBufObject : ' + hex(self.nvSciBufObject)] + except ValueError: + str_list += ['nvSciBufObject : '] + + return '\n'.join(str_list) + else: + return '' + @property - def reserved2(self): - return self._ptr[0].reserved2 - @reserved2.setter - def reserved2(self, reserved2): - self._ptr[0].reserved2 = reserved2 + def fd(self): + return self._pvt_ptr[0].handle.fd + @fd.setter + def fd(self, int fd): + self._pvt_ptr[0].handle.fd = fd + + @property - def reserved1(self): - return self._ptr[0].reserved1 - @reserved1.setter - def reserved1(self, reserved1): - self._ptr[0].reserved1 = reserved1 + def win32(self): + return self._win32 + @win32.setter + def win32(self, win32 not None : anon_struct8): + string.memcpy(&self._pvt_ptr[0].handle.win32, win32.getPtr(), sizeof(self._pvt_ptr[0].handle.win32)) + + @property - def reserved(self): - return self._ptr[0].reserved - @reserved.setter - def reserved(self, reserved): - self._ptr[0].reserved = reserved -{{endif}} -{{if 'struct cudaIpcEventHandle_st' in found_types}} + def nvSciBufObject(self): + return self._pvt_ptr[0].handle.nvSciBufObject + @nvSciBufObject.setter + def nvSciBufObject(self, nvSciBufObject): + self._cynvSciBufObject = _HelperInputVoidPtr(nvSciBufObject) + self._pvt_ptr[0].handle.nvSciBufObject = self._cynvSciBufObject.cptr -cdef class cudaIpcEventHandle_st: + +cdef class cudaExternalMemoryHandleDesc: """ - CUDA IPC event handle + External memory handle descriptor Attributes ---------- - reserved : bytes + + type : cudaExternalMemoryHandleType + Type of the handle + + + handle : anon_union3 + + + + size : unsigned long long + Size of the memory allocation + + + flags : unsigned int + Flags must either be zero or cudaExternalMemoryDedicated + + + reserved : list[unsigned int] + Must be zero Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._val_ptr = calloc(1, sizeof(cyruntime.cudaExternalMemoryHandleDesc)) + self._pvt_ptr = self._val_ptr else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): pass + + self._handle = anon_union3(_ptr=self._pvt_ptr) + def __dealloc__(self): - pass + if self._val_ptr is not NULL: + free(self._val_ptr) def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + + try: + str_list += ['type : ' + str(self.type)] + except ValueError: + str_list += ['type : '] + + + try: + str_list += ['handle :\n' + '\n'.join([' ' + line for line in str(self.handle).splitlines()])] + except ValueError: + str_list += ['handle : '] + + + try: + str_list += ['size : ' + str(self.size)] + except ValueError: + str_list += ['size : '] + + + try: + str_list += ['flags : ' + str(self.flags)] + except ValueError: + str_list += ['flags : '] + + try: str_list += ['reserved : ' + str(self.reserved)] except ValueError: str_list += ['reserved : '] + return '\n'.join(str_list) else: return '' + + @property + def type(self): + return cudaExternalMemoryHandleType(self._pvt_ptr[0].type) + @type.setter + def type(self, type not None : cudaExternalMemoryHandleType): + self._pvt_ptr[0].type = int(type) + + + @property + def handle(self): + return self._handle + @handle.setter + def handle(self, handle not None : anon_union3): + string.memcpy(&self._pvt_ptr[0].handle, handle.getPtr(), sizeof(self._pvt_ptr[0].handle)) + + + @property + def size(self): + return self._pvt_ptr[0].size + @size.setter + def size(self, unsigned long long size): + self._pvt_ptr[0].size = size + + + @property + def flags(self): + return self._pvt_ptr[0].flags + @flags.setter + def flags(self, unsigned int flags): + self._pvt_ptr[0].flags = flags + + @property def reserved(self): - return PyBytes_FromStringAndSize(self._ptr[0].reserved, 64) + return self._pvt_ptr[0].reserved @reserved.setter def reserved(self, reserved): - if len(reserved) != 64: - raise ValueError("reserved length must be 64, is " + str(len(reserved))) - if CHAR_MIN == 0: - for i, b in enumerate(reserved): - if b < 0 and b > -129: - b = b + 256 - self._ptr[0].reserved[i] = b - else: - for i, b in enumerate(reserved): - if b > 127 and b < 256: - b = b - 256 - self._ptr[0].reserved[i] = b -{{endif}} -{{if 'struct cudaIpcMemHandle_st' in found_types}} + self._pvt_ptr[0].reserved = reserved -cdef class cudaIpcMemHandle_st: + +cdef class cudaExternalMemoryBufferDesc: """ - CUDA IPC memory handle + External memory buffer descriptor Attributes ---------- - reserved : bytes + + offset : unsigned long long + Offset into the memory object where the buffer's base is + + + size : unsigned long long + Size of the buffer + + + flags : unsigned int + Flags reserved for future use. Must be zero. + + + reserved : list[unsigned int] + Must be zero Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): pass def __dealloc__(self): pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + + try: + str_list += ['offset : ' + str(self.offset)] + except ValueError: + str_list += ['offset : '] + + + try: + str_list += ['size : ' + str(self.size)] + except ValueError: + str_list += ['size : '] + + + try: + str_list += ['flags : ' + str(self.flags)] + except ValueError: + str_list += ['flags : '] + + try: str_list += ['reserved : ' + str(self.reserved)] except ValueError: str_list += ['reserved : '] + return '\n'.join(str_list) else: return '' + + @property + def offset(self): + return self._pvt_ptr[0].offset + @offset.setter + def offset(self, unsigned long long offset): + self._pvt_ptr[0].offset = offset + + + @property + def size(self): + return self._pvt_ptr[0].size + @size.setter + def size(self, unsigned long long size): + self._pvt_ptr[0].size = size + + + @property + def flags(self): + return self._pvt_ptr[0].flags + @flags.setter + def flags(self, unsigned int flags): + self._pvt_ptr[0].flags = flags + + @property def reserved(self): - return PyBytes_FromStringAndSize(self._ptr[0].reserved, 64) + return self._pvt_ptr[0].reserved @reserved.setter def reserved(self, reserved): - if len(reserved) != 64: - raise ValueError("reserved length must be 64, is " + str(len(reserved))) - if CHAR_MIN == 0: - for i, b in enumerate(reserved): - if b < 0 and b > -129: - b = b + 256 - self._ptr[0].reserved[i] = b - else: - for i, b in enumerate(reserved): - if b > 127 and b < 256: - b = b - 256 - self._ptr[0].reserved[i] = b -{{endif}} -{{if 'struct cudaMemFabricHandle_st' in found_types}} + self._pvt_ptr[0].reserved = reserved -cdef class cudaMemFabricHandle_st: + +cdef class cudaExternalMemoryMipmappedArrayDesc: """ + External memory mipmap descriptor + Attributes ---------- - reserved : bytes + + offset : unsigned long long + Offset into the memory object where the base level of the mipmap + chain is. + + + formatDesc : cudaChannelFormatDesc + Format of base level of the mipmap chain + + + extent : cudaExtent + Dimensions of base level of the mipmap chain + + + flags : unsigned int + Flags associated with CUDA mipmapped arrays. See + cudaMallocMipmappedArray + + + numLevels : unsigned int + Total number of levels in the mipmap chain + + + reserved : list[unsigned int] + Must be zero Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): pass + + self._formatDesc = cudaChannelFormatDesc(_ptr=&self._pvt_ptr[0].formatDesc) + + + self._extent = cudaExtent(_ptr=&self._pvt_ptr[0].extent) + def __dealloc__(self): pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + + try: + str_list += ['offset : ' + str(self.offset)] + except ValueError: + str_list += ['offset : '] + + + try: + str_list += ['formatDesc :\n' + '\n'.join([' ' + line for line in str(self.formatDesc).splitlines()])] + except ValueError: + str_list += ['formatDesc : '] + + + try: + str_list += ['extent :\n' + '\n'.join([' ' + line for line in str(self.extent).splitlines()])] + except ValueError: + str_list += ['extent : '] + + + try: + str_list += ['flags : ' + str(self.flags)] + except ValueError: + str_list += ['flags : '] + + + try: + str_list += ['numLevels : ' + str(self.numLevels)] + except ValueError: + str_list += ['numLevels : '] + + try: str_list += ['reserved : ' + str(self.reserved)] except ValueError: str_list += ['reserved : '] + return '\n'.join(str_list) else: return '' + + @property + def offset(self): + return self._pvt_ptr[0].offset + @offset.setter + def offset(self, unsigned long long offset): + self._pvt_ptr[0].offset = offset + + + @property + def formatDesc(self): + return self._formatDesc + @formatDesc.setter + def formatDesc(self, formatDesc not None : cudaChannelFormatDesc): + string.memcpy(&self._pvt_ptr[0].formatDesc, formatDesc.getPtr(), sizeof(self._pvt_ptr[0].formatDesc)) + + + @property + def extent(self): + return self._extent + @extent.setter + def extent(self, extent not None : cudaExtent): + string.memcpy(&self._pvt_ptr[0].extent, extent.getPtr(), sizeof(self._pvt_ptr[0].extent)) + + + @property + def flags(self): + return self._pvt_ptr[0].flags + @flags.setter + def flags(self, unsigned int flags): + self._pvt_ptr[0].flags = flags + + + @property + def numLevels(self): + return self._pvt_ptr[0].numLevels + @numLevels.setter + def numLevels(self, unsigned int numLevels): + self._pvt_ptr[0].numLevels = numLevels + + @property def reserved(self): - return PyBytes_FromStringAndSize(self._ptr[0].reserved, 64) + return self._pvt_ptr[0].reserved @reserved.setter def reserved(self, reserved): - if len(reserved) != 64: - raise ValueError("reserved length must be 64, is " + str(len(reserved))) - if CHAR_MIN == 0: - for i, b in enumerate(reserved): - if b < 0 and b > -129: - b = b + 256 - self._ptr[0].reserved[i] = b - else: - for i, b in enumerate(reserved): - if b > 127 and b < 256: - b = b - 256 - self._ptr[0].reserved[i] = b -{{endif}} -{{if 'struct cudaExternalMemoryHandleDesc' in found_types}} + self._pvt_ptr[0].reserved = reserved -cdef class anon_struct5: + +cdef class anon_struct9: """ Attributes ---------- + handle : Any + + name : Any + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): pass def __dealloc__(self): pass def getPtr(self): - return &self._ptr[0].handle.win32 + return &self._pvt_ptr[0].handle.win32 def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: str_list += ['handle : ' + hex(self.handle)] except ValueError: str_list += ['handle : '] + + try: str_list += ['name : ' + hex(self.name)] except ValueError: str_list += ['name : '] + return '\n'.join(str_list) else: return '' + @property def handle(self): - return self._ptr[0].handle.win32.handle + return self._pvt_ptr[0].handle.win32.handle @handle.setter def handle(self, handle): - _chandle = utils.HelperInputVoidPtr(handle) - self._ptr[0].handle.win32.handle = _chandle.cptr + self._cyhandle = _HelperInputVoidPtr(handle) + self._pvt_ptr[0].handle.win32.handle = self._cyhandle.cptr + + @property def name(self): - return self._ptr[0].handle.win32.name + return self._pvt_ptr[0].handle.win32.name @name.setter def name(self, name): - _cname = utils.HelperInputVoidPtr(name) - self._ptr[0].handle.win32.name = _cname.cptr -{{endif}} -{{if 'struct cudaExternalMemoryHandleDesc' in found_types}} + self._cyname = _HelperInputVoidPtr(name) + self._pvt_ptr[0].handle.win32.name = self._cyname.cptr -cdef class anon_union1: + +cdef class anon_union4: """ Attributes ---------- + fd : int - win32 : anon_struct5 - nvSciBufObject : Any + + win32 : anon_struct9 + + + + nvSciSyncObj : Any + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - self._win32 = anon_struct5(_ptr=self._ptr) + pass + + self._win32 = anon_struct9(_ptr=self._pvt_ptr) + def __dealloc__(self): pass def getPtr(self): - return &self._ptr[0].handle + return &self._pvt_ptr[0].handle def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: str_list += ['fd : ' + str(self.fd)] except ValueError: str_list += ['fd : '] + + try: str_list += ['win32 :\n' + '\n'.join([' ' + line for line in str(self.win32).splitlines()])] except ValueError: str_list += ['win32 : '] + + try: - str_list += ['nvSciBufObject : ' + hex(self.nvSciBufObject)] + str_list += ['nvSciSyncObj : ' + hex(self.nvSciSyncObj)] except ValueError: - str_list += ['nvSciBufObject : '] + str_list += ['nvSciSyncObj : '] + return '\n'.join(str_list) else: return '' + @property def fd(self): - return self._ptr[0].handle.fd + return self._pvt_ptr[0].handle.fd @fd.setter def fd(self, int fd): - self._ptr[0].handle.fd = fd + self._pvt_ptr[0].handle.fd = fd + + @property def win32(self): return self._win32 @win32.setter - def win32(self, win32 not None : anon_struct5): - string.memcpy(&self._ptr[0].handle.win32, win32.getPtr(), sizeof(self._ptr[0].handle.win32)) + def win32(self, win32 not None : anon_struct9): + string.memcpy(&self._pvt_ptr[0].handle.win32, win32.getPtr(), sizeof(self._pvt_ptr[0].handle.win32)) + + @property - def nvSciBufObject(self): - return self._ptr[0].handle.nvSciBufObject - @nvSciBufObject.setter - def nvSciBufObject(self, nvSciBufObject): - _cnvSciBufObject = utils.HelperInputVoidPtr(nvSciBufObject) - self._ptr[0].handle.nvSciBufObject = _cnvSciBufObject.cptr -{{endif}} -{{if 'struct cudaExternalMemoryHandleDesc' in found_types}} + def nvSciSyncObj(self): + return self._pvt_ptr[0].handle.nvSciSyncObj + @nvSciSyncObj.setter + def nvSciSyncObj(self, nvSciSyncObj): + self._cynvSciSyncObj = _HelperInputVoidPtr(nvSciSyncObj) + self._pvt_ptr[0].handle.nvSciSyncObj = self._cynvSciSyncObj.cptr -cdef class cudaExternalMemoryHandleDesc: + +cdef class cudaExternalSemaphoreHandleDesc: """ - External memory handle descriptor + External semaphore handle descriptor Attributes ---------- - type : cudaExternalMemoryHandleType + + type : cudaExternalSemaphoreHandleType Type of the handle - handle : anon_union1 - size : unsigned long long - Size of the memory allocation + + handle : anon_union4 + + + flags : unsigned int - Flags must either be zero or cudaExternalMemoryDedicated + Flags reserved for the future. Must be zero. + + + reserved : list[unsigned int] + Must be zero + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._val_ptr = calloc(1, sizeof(ccudart.cudaExternalMemoryHandleDesc)) - self._ptr = self._val_ptr + self._val_ptr = calloc(1, sizeof(cyruntime.cudaExternalSemaphoreHandleDesc)) + self._pvt_ptr = self._val_ptr else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - self._handle = anon_union1(_ptr=self._ptr) + pass + + self._handle = anon_union4(_ptr=self._pvt_ptr) + def __dealloc__(self): if self._val_ptr is not NULL: free(self._val_ptr) def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: str_list += ['type : ' + str(self.type)] except ValueError: str_list += ['type : '] + + try: str_list += ['handle :\n' + '\n'.join([' ' + line for line in str(self.handle).splitlines()])] except ValueError: str_list += ['handle : '] - try: - str_list += ['size : ' + str(self.size)] - except ValueError: - str_list += ['size : '] + + try: str_list += ['flags : ' + str(self.flags)] except ValueError: str_list += ['flags : '] + + + try: + str_list += ['reserved : ' + str(self.reserved)] + except ValueError: + str_list += ['reserved : '] + return '\n'.join(str_list) else: return '' + @property def type(self): - return cudaExternalMemoryHandleType(self._ptr[0].type) + return cudaExternalSemaphoreHandleType(self._pvt_ptr[0].type) @type.setter - def type(self, type not None : cudaExternalMemoryHandleType): - self._ptr[0].type = type.value + def type(self, type not None : cudaExternalSemaphoreHandleType): + self._pvt_ptr[0].type = int(type) + + @property def handle(self): return self._handle @handle.setter - def handle(self, handle not None : anon_union1): - string.memcpy(&self._ptr[0].handle, handle.getPtr(), sizeof(self._ptr[0].handle)) - @property - def size(self): - return self._ptr[0].size - @size.setter - def size(self, unsigned long long size): - self._ptr[0].size = size + def handle(self, handle not None : anon_union4): + string.memcpy(&self._pvt_ptr[0].handle, handle.getPtr(), sizeof(self._pvt_ptr[0].handle)) + + @property def flags(self): - return self._ptr[0].flags + return self._pvt_ptr[0].flags @flags.setter def flags(self, unsigned int flags): - self._ptr[0].flags = flags -{{endif}} -{{if 'struct cudaExternalMemoryBufferDesc' in found_types}} + self._pvt_ptr[0].flags = flags -cdef class cudaExternalMemoryBufferDesc: - """ - External memory buffer descriptor + @property + def reserved(self): + return self._pvt_ptr[0].reserved + @reserved.setter + def reserved(self, reserved): + self._pvt_ptr[0].reserved = reserved + + +cdef class anon_struct10: + """ Attributes ---------- - offset : unsigned long long - Offset into the memory object where the buffer's base is - size : unsigned long long - Size of the buffer - flags : unsigned int - Flags reserved for future use. Must be zero. + + value : unsigned long long + + Methods ------- getPtr() Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - else: - self._ptr = _ptr - def __init__(self, void_ptr _ptr = 0): + def __cinit__(self, void_ptr _ptr): + self._pvt_ptr = _ptr + + def __init__(self, void_ptr _ptr): pass def __dealloc__(self): pass def getPtr(self): - return self._ptr + return &self._pvt_ptr[0].params.fence def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['offset : ' + str(self.offset)] - except ValueError: - str_list += ['offset : '] - try: - str_list += ['size : ' + str(self.size)] - except ValueError: - str_list += ['size : '] - try: - str_list += ['flags : ' + str(self.flags)] + str_list += ['value : ' + str(self.value)] except ValueError: - str_list += ['flags : '] - return '\n'.join(str_list) - else: - return '' - @property - def offset(self): - return self._ptr[0].offset - @offset.setter - def offset(self, unsigned long long offset): - self._ptr[0].offset = offset - @property - def size(self): - return self._ptr[0].size - @size.setter - def size(self, unsigned long long size): - self._ptr[0].size = size + str_list += ['value : '] + + return '\n'.join(str_list) + else: + return '' + @property - def flags(self): - return self._ptr[0].flags - @flags.setter - def flags(self, unsigned int flags): - self._ptr[0].flags = flags -{{endif}} -{{if 'struct cudaExternalMemoryMipmappedArrayDesc' in found_types}} + def value(self): + return self._pvt_ptr[0].params.fence.value + @value.setter + def value(self, unsigned long long value): + self._pvt_ptr[0].params.fence.value = value -cdef class cudaExternalMemoryMipmappedArrayDesc: - """ - External memory mipmap descriptor +cdef class anon_union5: + """ Attributes ---------- - offset : unsigned long long - Offset into the memory object where the base level of the mipmap - chain is. - formatDesc : cudaChannelFormatDesc - Format of base level of the mipmap chain - extent : cudaExtent - Dimensions of base level of the mipmap chain - flags : unsigned int - Flags associated with CUDA mipmapped arrays. See - cudaMallocMipmappedArray - numLevels : unsigned int - Total number of levels in the mipmap chain + + fence : Any + + + + reserved : unsigned long long + + Methods ------- getPtr() Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr = 0): - if _ptr == 0: - self._ptr = &self.__val - else: - self._ptr = _ptr - def __init__(self, void_ptr _ptr = 0): - self._formatDesc = cudaChannelFormatDesc(_ptr=&self._ptr[0].formatDesc) - self._extent = cudaExtent(_ptr=&self._ptr[0].extent) + def __cinit__(self, void_ptr _ptr): + self._pvt_ptr = _ptr + + def __init__(self, void_ptr _ptr): + pass def __dealloc__(self): pass def getPtr(self): - return self._ptr + return &self._pvt_ptr[0].params.nvSciSync def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['offset : ' + str(self.offset)] - except ValueError: - str_list += ['offset : '] - try: - str_list += ['formatDesc :\n' + '\n'.join([' ' + line for line in str(self.formatDesc).splitlines()])] - except ValueError: - str_list += ['formatDesc : '] - try: - str_list += ['extent :\n' + '\n'.join([' ' + line for line in str(self.extent).splitlines()])] - except ValueError: - str_list += ['extent : '] - try: - str_list += ['flags : ' + str(self.flags)] + str_list += ['fence : ' + hex(self.fence)] except ValueError: - str_list += ['flags : '] + str_list += ['fence : '] + + try: - str_list += ['numLevels : ' + str(self.numLevels)] + str_list += ['reserved : ' + str(self.reserved)] except ValueError: - str_list += ['numLevels : '] + str_list += ['reserved : '] + return '\n'.join(str_list) else: return '' + @property - def offset(self): - return self._ptr[0].offset - @offset.setter - def offset(self, unsigned long long offset): - self._ptr[0].offset = offset - @property - def formatDesc(self): - return self._formatDesc - @formatDesc.setter - def formatDesc(self, formatDesc not None : cudaChannelFormatDesc): - string.memcpy(&self._ptr[0].formatDesc, formatDesc.getPtr(), sizeof(self._ptr[0].formatDesc)) - @property - def extent(self): - return self._extent - @extent.setter - def extent(self, extent not None : cudaExtent): - string.memcpy(&self._ptr[0].extent, extent.getPtr(), sizeof(self._ptr[0].extent)) - @property - def flags(self): - return self._ptr[0].flags - @flags.setter - def flags(self, unsigned int flags): - self._ptr[0].flags = flags + def fence(self): + return self._pvt_ptr[0].params.nvSciSync.fence + @fence.setter + def fence(self, fence): + self._cyfence = _HelperInputVoidPtr(fence) + self._pvt_ptr[0].params.nvSciSync.fence = self._cyfence.cptr + + @property - def numLevels(self): - return self._ptr[0].numLevels - @numLevels.setter - def numLevels(self, unsigned int numLevels): - self._ptr[0].numLevels = numLevels -{{endif}} -{{if 'struct cudaExternalSemaphoreHandleDesc' in found_types}} + def reserved(self): + return self._pvt_ptr[0].params.nvSciSync.reserved + @reserved.setter + def reserved(self, unsigned long long reserved): + self._pvt_ptr[0].params.nvSciSync.reserved = reserved -cdef class anon_struct6: + +cdef class anon_struct11: """ Attributes ---------- - handle : Any - name : Any + key : unsigned long long + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): pass def __dealloc__(self): pass def getPtr(self): - return &self._ptr[0].handle.win32 + return &self._pvt_ptr[0].params.keyedMutex def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['handle : ' + hex(self.handle)] - except ValueError: - str_list += ['handle : '] - try: - str_list += ['name : ' + hex(self.name)] + str_list += ['key : ' + str(self.key)] except ValueError: - str_list += ['name : '] + str_list += ['key : '] + return '\n'.join(str_list) else: return '' + @property - def handle(self): - return self._ptr[0].handle.win32.handle - @handle.setter - def handle(self, handle): - _chandle = utils.HelperInputVoidPtr(handle) - self._ptr[0].handle.win32.handle = _chandle.cptr - @property - def name(self): - return self._ptr[0].handle.win32.name - @name.setter - def name(self, name): - _cname = utils.HelperInputVoidPtr(name) - self._ptr[0].handle.win32.name = _cname.cptr -{{endif}} -{{if 'struct cudaExternalSemaphoreHandleDesc' in found_types}} + def key(self): + return self._pvt_ptr[0].params.keyedMutex.key + @key.setter + def key(self, unsigned long long key): + self._pvt_ptr[0].params.keyedMutex.key = key -cdef class anon_union2: + +cdef class anon_struct12: """ Attributes ---------- - fd : int - win32 : anon_struct6 + fence : anon_struct10 + + + + nvSciSync : anon_union5 + + + + keyedMutex : anon_struct11 + + + + reserved : list[unsigned int] - nvSciSyncObj : Any Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - self._win32 = anon_struct6(_ptr=self._ptr) + pass + + self._fence = anon_struct10(_ptr=self._pvt_ptr) + + + self._nvSciSync = anon_union5(_ptr=self._pvt_ptr) + + + self._keyedMutex = anon_struct11(_ptr=self._pvt_ptr) + def __dealloc__(self): pass def getPtr(self): - return &self._ptr[0].handle + return &self._pvt_ptr[0].params def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['fd : ' + str(self.fd)] + str_list += ['fence :\n' + '\n'.join([' ' + line for line in str(self.fence).splitlines()])] except ValueError: - str_list += ['fd : '] + str_list += ['fence : '] + + try: - str_list += ['win32 :\n' + '\n'.join([' ' + line for line in str(self.win32).splitlines()])] + str_list += ['nvSciSync :\n' + '\n'.join([' ' + line for line in str(self.nvSciSync).splitlines()])] except ValueError: - str_list += ['win32 : '] + str_list += ['nvSciSync : '] + + try: - str_list += ['nvSciSyncObj : ' + hex(self.nvSciSyncObj)] + str_list += ['keyedMutex :\n' + '\n'.join([' ' + line for line in str(self.keyedMutex).splitlines()])] except ValueError: - str_list += ['nvSciSyncObj : '] + str_list += ['keyedMutex : '] + + + try: + str_list += ['reserved : ' + str(self.reserved)] + except ValueError: + str_list += ['reserved : '] + return '\n'.join(str_list) else: return '' + @property - def fd(self): - return self._ptr[0].handle.fd - @fd.setter - def fd(self, int fd): - self._ptr[0].handle.fd = fd + def fence(self): + return self._fence + @fence.setter + def fence(self, fence not None : anon_struct10): + string.memcpy(&self._pvt_ptr[0].params.fence, fence.getPtr(), sizeof(self._pvt_ptr[0].params.fence)) + + @property - def win32(self): - return self._win32 - @win32.setter - def win32(self, win32 not None : anon_struct6): - string.memcpy(&self._ptr[0].handle.win32, win32.getPtr(), sizeof(self._ptr[0].handle.win32)) + def nvSciSync(self): + return self._nvSciSync + @nvSciSync.setter + def nvSciSync(self, nvSciSync not None : anon_union5): + string.memcpy(&self._pvt_ptr[0].params.nvSciSync, nvSciSync.getPtr(), sizeof(self._pvt_ptr[0].params.nvSciSync)) + + @property - def nvSciSyncObj(self): - return self._ptr[0].handle.nvSciSyncObj - @nvSciSyncObj.setter - def nvSciSyncObj(self, nvSciSyncObj): - _cnvSciSyncObj = utils.HelperInputVoidPtr(nvSciSyncObj) - self._ptr[0].handle.nvSciSyncObj = _cnvSciSyncObj.cptr -{{endif}} -{{if 'struct cudaExternalSemaphoreHandleDesc' in found_types}} + def keyedMutex(self): + return self._keyedMutex + @keyedMutex.setter + def keyedMutex(self, keyedMutex not None : anon_struct11): + string.memcpy(&self._pvt_ptr[0].params.keyedMutex, keyedMutex.getPtr(), sizeof(self._pvt_ptr[0].params.keyedMutex)) -cdef class cudaExternalSemaphoreHandleDesc: + + @property + def reserved(self): + return self._pvt_ptr[0].params.reserved + @reserved.setter + def reserved(self, reserved): + self._pvt_ptr[0].params.reserved = reserved + + +cdef class cudaExternalSemaphoreSignalParams: """ - External semaphore handle descriptor + External semaphore signal parameters, compatible with driver type Attributes ---------- - type : cudaExternalSemaphoreHandleType - Type of the handle - handle : anon_union2 + + params : anon_struct12 + + flags : unsigned int - Flags reserved for the future. Must be zero. + Only when cudaExternalSemaphoreSignalParams is used to signal a + cudaExternalSemaphore_t of type + cudaExternalSemaphoreHandleTypeNvSciSync, the valid flag is + cudaExternalSemaphoreSignalSkipNvSciBufMemSync: which indicates + that while signaling the cudaExternalSemaphore_t, no memory + synchronization operations should be performed for any external + memory object imported as cudaExternalMemoryHandleTypeNvSciBuf. For + all other types of cudaExternalSemaphore_t, flags must be zero. + + + reserved : list[unsigned int] + + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._val_ptr = calloc(1, sizeof(ccudart.cudaExternalSemaphoreHandleDesc)) - self._ptr = self._val_ptr + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - self._handle = anon_union2(_ptr=self._ptr) + pass + + self._params = anon_struct12(_ptr=self._pvt_ptr) + def __dealloc__(self): - if self._val_ptr is not NULL: - free(self._val_ptr) + pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['type : ' + str(self.type)] - except ValueError: - str_list += ['type : '] - try: - str_list += ['handle :\n' + '\n'.join([' ' + line for line in str(self.handle).splitlines()])] + str_list += ['params :\n' + '\n'.join([' ' + line for line in str(self.params).splitlines()])] except ValueError: - str_list += ['handle : '] + str_list += ['params : '] + + try: str_list += ['flags : ' + str(self.flags)] except ValueError: str_list += ['flags : '] + + + try: + str_list += ['reserved : ' + str(self.reserved)] + except ValueError: + str_list += ['reserved : '] + return '\n'.join(str_list) else: return '' + @property - def type(self): - return cudaExternalSemaphoreHandleType(self._ptr[0].type) - @type.setter - def type(self, type not None : cudaExternalSemaphoreHandleType): - self._ptr[0].type = type.value - @property - def handle(self): - return self._handle - @handle.setter - def handle(self, handle not None : anon_union2): - string.memcpy(&self._ptr[0].handle, handle.getPtr(), sizeof(self._ptr[0].handle)) + def params(self): + return self._params + @params.setter + def params(self, params not None : anon_struct12): + string.memcpy(&self._pvt_ptr[0].params, params.getPtr(), sizeof(self._pvt_ptr[0].params)) + + @property def flags(self): - return self._ptr[0].flags + return self._pvt_ptr[0].flags @flags.setter def flags(self, unsigned int flags): - self._ptr[0].flags = flags -{{endif}} -{{if 'struct cudaExternalSemaphoreSignalParams' in found_types}} + self._pvt_ptr[0].flags = flags + + + @property + def reserved(self): + return self._pvt_ptr[0].reserved + @reserved.setter + def reserved(self, reserved): + self._pvt_ptr[0].reserved = reserved + cdef class anon_struct13: """ Attributes ---------- + value : unsigned long long + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): pass def __dealloc__(self): pass def getPtr(self): - return &self._ptr[0].params.fence + return &self._pvt_ptr[0].params.fence def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: str_list += ['value : ' + str(self.value)] except ValueError: str_list += ['value : '] + return '\n'.join(str_list) else: return '' + @property def value(self): - return self._ptr[0].params.fence.value + return self._pvt_ptr[0].params.fence.value @value.setter def value(self, unsigned long long value): - self._ptr[0].params.fence.value = value -{{endif}} -{{if 'struct cudaExternalSemaphoreSignalParams' in found_types}} + self._pvt_ptr[0].params.fence.value = value -cdef class anon_union5: + +cdef class anon_union6: """ Attributes ---------- + fence : Any + + reserved : unsigned long long + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): pass def __dealloc__(self): pass def getPtr(self): - return &self._ptr[0].params.nvSciSync + return &self._pvt_ptr[0].params.nvSciSync def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: str_list += ['fence : ' + hex(self.fence)] except ValueError: str_list += ['fence : '] + + try: str_list += ['reserved : ' + str(self.reserved)] except ValueError: str_list += ['reserved : '] + return '\n'.join(str_list) else: return '' + @property def fence(self): - return self._ptr[0].params.nvSciSync.fence + return self._pvt_ptr[0].params.nvSciSync.fence @fence.setter def fence(self, fence): - _cfence = utils.HelperInputVoidPtr(fence) - self._ptr[0].params.nvSciSync.fence = _cfence.cptr + self._cyfence = _HelperInputVoidPtr(fence) + self._pvt_ptr[0].params.nvSciSync.fence = self._cyfence.cptr + + @property def reserved(self): - return self._ptr[0].params.nvSciSync.reserved + return self._pvt_ptr[0].params.nvSciSync.reserved @reserved.setter def reserved(self, unsigned long long reserved): - self._ptr[0].params.nvSciSync.reserved = reserved -{{endif}} -{{if 'struct cudaExternalSemaphoreSignalParams' in found_types}} + self._pvt_ptr[0].params.nvSciSync.reserved = reserved + cdef class anon_struct14: """ Attributes ---------- + key : unsigned long long + + timeoutMs : unsigned int + + + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): pass def __dealloc__(self): pass def getPtr(self): - return &self._ptr[0].params.keyedMutex + return &self._pvt_ptr[0].params.keyedMutex def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: str_list += ['key : ' + str(self.key)] except ValueError: str_list += ['key : '] + + + try: + str_list += ['timeoutMs : ' + str(self.timeoutMs)] + except ValueError: + str_list += ['timeoutMs : '] + return '\n'.join(str_list) else: return '' + @property def key(self): - return self._ptr[0].params.keyedMutex.key + return self._pvt_ptr[0].params.keyedMutex.key @key.setter def key(self, unsigned long long key): - self._ptr[0].params.keyedMutex.key = key -{{endif}} -{{if 'struct cudaExternalSemaphoreSignalParams' in found_types}} + self._pvt_ptr[0].params.keyedMutex.key = key + + + @property + def timeoutMs(self): + return self._pvt_ptr[0].params.keyedMutex.timeoutMs + @timeoutMs.setter + def timeoutMs(self, unsigned int timeoutMs): + self._pvt_ptr[0].params.keyedMutex.timeoutMs = timeoutMs + cdef class anon_struct15: """ Attributes ---------- + fence : anon_struct13 - nvSciSync : anon_union5 + + + nvSciSync : anon_union6 + + keyedMutex : anon_struct14 - reserved : List[unsigned int] + + + reserved : list[unsigned int] + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - self._fence = anon_struct13(_ptr=self._ptr) - self._nvSciSync = anon_union5(_ptr=self._ptr) - self._keyedMutex = anon_struct14(_ptr=self._ptr) + pass + + self._fence = anon_struct13(_ptr=self._pvt_ptr) + + + self._nvSciSync = anon_union6(_ptr=self._pvt_ptr) + + + self._keyedMutex = anon_struct14(_ptr=self._pvt_ptr) + def __dealloc__(self): pass def getPtr(self): - return &self._ptr[0].params + return &self._pvt_ptr[0].params def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: str_list += ['fence :\n' + '\n'.join([' ' + line for line in str(self.fence).splitlines()])] except ValueError: str_list += ['fence : '] + + try: str_list += ['nvSciSync :\n' + '\n'.join([' ' + line for line in str(self.nvSciSync).splitlines()])] except ValueError: str_list += ['nvSciSync : '] + + try: str_list += ['keyedMutex :\n' + '\n'.join([' ' + line for line in str(self.keyedMutex).splitlines()])] except ValueError: str_list += ['keyedMutex : '] + + try: str_list += ['reserved : ' + str(self.reserved)] except ValueError: str_list += ['reserved : '] + return '\n'.join(str_list) else: return '' + @property def fence(self): return self._fence @fence.setter def fence(self, fence not None : anon_struct13): - string.memcpy(&self._ptr[0].params.fence, fence.getPtr(), sizeof(self._ptr[0].params.fence)) + string.memcpy(&self._pvt_ptr[0].params.fence, fence.getPtr(), sizeof(self._pvt_ptr[0].params.fence)) + + @property def nvSciSync(self): return self._nvSciSync @nvSciSync.setter - def nvSciSync(self, nvSciSync not None : anon_union5): - string.memcpy(&self._ptr[0].params.nvSciSync, nvSciSync.getPtr(), sizeof(self._ptr[0].params.nvSciSync)) + def nvSciSync(self, nvSciSync not None : anon_union6): + string.memcpy(&self._pvt_ptr[0].params.nvSciSync, nvSciSync.getPtr(), sizeof(self._pvt_ptr[0].params.nvSciSync)) + + @property def keyedMutex(self): return self._keyedMutex @keyedMutex.setter def keyedMutex(self, keyedMutex not None : anon_struct14): - string.memcpy(&self._ptr[0].params.keyedMutex, keyedMutex.getPtr(), sizeof(self._ptr[0].params.keyedMutex)) + string.memcpy(&self._pvt_ptr[0].params.keyedMutex, keyedMutex.getPtr(), sizeof(self._pvt_ptr[0].params.keyedMutex)) + + @property def reserved(self): - return self._ptr[0].params.reserved + return self._pvt_ptr[0].params.reserved @reserved.setter def reserved(self, reserved): - self._ptr[0].params.reserved = reserved -{{endif}} -{{if 'struct cudaExternalSemaphoreSignalParams' in found_types}} + self._pvt_ptr[0].params.reserved = reserved -cdef class cudaExternalSemaphoreSignalParams: + +cdef class cudaExternalSemaphoreWaitParams: """ - External semaphore signal parameters, compatible with driver type + External semaphore wait parameters, compatible with driver type Attributes ---------- + params : anon_struct15 + + flags : unsigned int Only when cudaExternalSemaphoreSignalParams is used to signal a cudaExternalSemaphore_t of type cudaExternalSemaphoreHandleTypeNvSciSync, the valid flag is cudaExternalSemaphoreSignalSkipNvSciBufMemSync: which indicates - that while signaling the cudaExternalSemaphore_t, no memory + that while waiting for the cudaExternalSemaphore_t, no memory synchronization operations should be performed for any external memory object imported as cudaExternalMemoryHandleTypeNvSciBuf. For all other types of cudaExternalSemaphore_t, flags must be zero. - reserved : List[unsigned int] + + + reserved : list[unsigned int] + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - self._params = anon_struct15(_ptr=self._ptr) + pass + + self._params = anon_struct15(_ptr=self._pvt_ptr) + def __dealloc__(self): pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: str_list += ['params :\n' + '\n'.join([' ' + line for line in str(self.params).splitlines()])] except ValueError: str_list += ['params : '] + + try: str_list += ['flags : ' + str(self.flags)] except ValueError: str_list += ['flags : '] + + try: str_list += ['reserved : ' + str(self.reserved)] except ValueError: str_list += ['reserved : '] + return '\n'.join(str_list) else: return '' + @property def params(self): return self._params @params.setter def params(self, params not None : anon_struct15): - string.memcpy(&self._ptr[0].params, params.getPtr(), sizeof(self._ptr[0].params)) + string.memcpy(&self._pvt_ptr[0].params, params.getPtr(), sizeof(self._pvt_ptr[0].params)) + + @property def flags(self): - return self._ptr[0].flags + return self._pvt_ptr[0].flags @flags.setter def flags(self, unsigned int flags): - self._ptr[0].flags = flags + self._pvt_ptr[0].flags = flags + + @property def reserved(self): - return self._ptr[0].reserved + return self._pvt_ptr[0].reserved @reserved.setter def reserved(self, reserved): - self._ptr[0].reserved = reserved -{{endif}} -{{if 'struct cudaExternalSemaphoreWaitParams' in found_types}} + self._pvt_ptr[0].reserved = reserved -cdef class anon_struct16: + +cdef class cudaDevSmResource: """ + Data for SM-related resources All parameters in this structure are + OUTPUT only. Do not write to any of the fields in this structure. + Attributes ---------- - value : unsigned long long + + smCount : unsigned int + The amount of streaming multiprocessors available in this resource. + + + minSmPartitionSize : unsigned int + The minimum number of streaming multiprocessors required to + partition this resource. + + + smCoscheduledAlignment : unsigned int + The number of streaming multiprocessors in this resource that are + guaranteed to be co-scheduled on the same GPU processing cluster. + smCount will be a multiple of this value, unless the backfill flag + is set. + + + flags : unsigned int + The flags set on this SM resource. For available flags see + cudaDevSmResourceGroup_flags. Methods ------- getPtr() Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr - - def __init__(self, void_ptr _ptr): + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): pass def __dealloc__(self): pass def getPtr(self): - return &self._ptr[0].params.fence + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['value : ' + str(self.value)] + str_list += ['smCount : ' + str(self.smCount)] except ValueError: - str_list += ['value : '] + str_list += ['smCount : '] + + + try: + str_list += ['minSmPartitionSize : ' + str(self.minSmPartitionSize)] + except ValueError: + str_list += ['minSmPartitionSize : '] + + + try: + str_list += ['smCoscheduledAlignment : ' + str(self.smCoscheduledAlignment)] + except ValueError: + str_list += ['smCoscheduledAlignment : '] + + + try: + str_list += ['flags : ' + str(self.flags)] + except ValueError: + str_list += ['flags : '] + return '\n'.join(str_list) else: return '' + @property - def value(self): - return self._ptr[0].params.fence.value - @value.setter - def value(self, unsigned long long value): - self._ptr[0].params.fence.value = value -{{endif}} -{{if 'struct cudaExternalSemaphoreWaitParams' in found_types}} + def smCount(self): + return self._pvt_ptr[0].smCount + @smCount.setter + def smCount(self, unsigned int smCount): + self._pvt_ptr[0].smCount = smCount -cdef class anon_union6: + + @property + def minSmPartitionSize(self): + return self._pvt_ptr[0].minSmPartitionSize + @minSmPartitionSize.setter + def minSmPartitionSize(self, unsigned int minSmPartitionSize): + self._pvt_ptr[0].minSmPartitionSize = minSmPartitionSize + + + @property + def smCoscheduledAlignment(self): + return self._pvt_ptr[0].smCoscheduledAlignment + @smCoscheduledAlignment.setter + def smCoscheduledAlignment(self, unsigned int smCoscheduledAlignment): + self._pvt_ptr[0].smCoscheduledAlignment = smCoscheduledAlignment + + + @property + def flags(self): + return self._pvt_ptr[0].flags + @flags.setter + def flags(self, unsigned int flags): + self._pvt_ptr[0].flags = flags + + +cdef class cudaDevWorkqueueConfigResource: """ + Data for workqueue configuration related resources + Attributes ---------- - fence : Any - reserved : unsigned long long + device : int + The device on which the workqueue resources are available + + + wqConcurrencyLimit : unsigned int + The expected maximum number of concurrent stream-ordered workloads + + + sharingScope : cudaDevWorkqueueConfigScope + The sharing scope for the workqueue resources Methods ------- getPtr() Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr - - def __init__(self, void_ptr _ptr): + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): pass def __dealloc__(self): pass def getPtr(self): - return &self._ptr[0].params.nvSciSync + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['fence : ' + hex(self.fence)] + str_list += ['device : ' + str(self.device)] except ValueError: - str_list += ['fence : '] + str_list += ['device : '] + + try: - str_list += ['reserved : ' + str(self.reserved)] + str_list += ['wqConcurrencyLimit : ' + str(self.wqConcurrencyLimit)] except ValueError: - str_list += ['reserved : '] + str_list += ['wqConcurrencyLimit : '] + + + try: + str_list += ['sharingScope : ' + str(self.sharingScope)] + except ValueError: + str_list += ['sharingScope : '] + return '\n'.join(str_list) else: return '' + @property - def fence(self): - return self._ptr[0].params.nvSciSync.fence - @fence.setter - def fence(self, fence): - _cfence = utils.HelperInputVoidPtr(fence) - self._ptr[0].params.nvSciSync.fence = _cfence.cptr + def device(self): + return self._pvt_ptr[0].device + @device.setter + def device(self, int device): + self._pvt_ptr[0].device = device + + + @property + def wqConcurrencyLimit(self): + return self._pvt_ptr[0].wqConcurrencyLimit + @wqConcurrencyLimit.setter + def wqConcurrencyLimit(self, unsigned int wqConcurrencyLimit): + self._pvt_ptr[0].wqConcurrencyLimit = wqConcurrencyLimit + + + @property + def sharingScope(self): + return cudaDevWorkqueueConfigScope(self._pvt_ptr[0].sharingScope) + @sharingScope.setter + def sharingScope(self, sharingScope not None : cudaDevWorkqueueConfigScope): + self._pvt_ptr[0].sharingScope = int(sharingScope) + + +cdef class cudaDevWorkqueueResource: + """ + Handle to a pre-existing workqueue related resource + + Attributes + ---------- + + reserved : bytes + Reserved for future use + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass + def __dealloc__(self): + pass + def getPtr(self): + return self._pvt_ptr + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['reserved : ' + str(self.reserved)] + except ValueError: + str_list += ['reserved : '] + + return '\n'.join(str_list) + else: + return '' + @property def reserved(self): - return self._ptr[0].params.nvSciSync.reserved + return PyBytes_FromStringAndSize(self._pvt_ptr[0].reserved, 40) @reserved.setter - def reserved(self, unsigned long long reserved): - self._ptr[0].params.nvSciSync.reserved = reserved -{{endif}} -{{if 'struct cudaExternalSemaphoreWaitParams' in found_types}} + def reserved(self, reserved): + if len(reserved) != 40: + raise ValueError("reserved length must be 40, is " + str(len(reserved))) + for i, b in enumerate(reserved): + self._pvt_ptr[0].reserved[i] = b -cdef class anon_struct17: + +cdef class cudaDevSmResourceGroupParams_st: """ + Input data for splitting SMs + Attributes ---------- - key : unsigned long long - timeoutMs : unsigned int + smCount : unsigned int + The amount of SMs available in this resource. + + + coscheduledSmCount : unsigned int + The amount of co-scheduled SMs grouped together for locality + purposes. + + + preferredCoscheduledSmCount : unsigned int + When possible, combine co-scheduled groups together into larger + groups of this size. + + + flags : unsigned int + Combination of `cudaDevSmResourceGroup_flags` values to indicate + this this group is created. + + + reserved : list[unsigned int] + Reserved for future use - ensure this is zero initialized. Methods ------- getPtr() Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr - - def __init__(self, void_ptr _ptr): + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): pass def __dealloc__(self): pass def getPtr(self): - return &self._ptr[0].params.keyedMutex + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['key : ' + str(self.key)] + str_list += ['smCount : ' + str(self.smCount)] except ValueError: - str_list += ['key : '] + str_list += ['smCount : '] + + try: - str_list += ['timeoutMs : ' + str(self.timeoutMs)] + str_list += ['coscheduledSmCount : ' + str(self.coscheduledSmCount)] except ValueError: - str_list += ['timeoutMs : '] + str_list += ['coscheduledSmCount : '] + + + try: + str_list += ['preferredCoscheduledSmCount : ' + str(self.preferredCoscheduledSmCount)] + except ValueError: + str_list += ['preferredCoscheduledSmCount : '] + + + try: + str_list += ['flags : ' + str(self.flags)] + except ValueError: + str_list += ['flags : '] + + + try: + str_list += ['reserved : ' + str(self.reserved)] + except ValueError: + str_list += ['reserved : '] + return '\n'.join(str_list) else: return '' + @property - def key(self): - return self._ptr[0].params.keyedMutex.key - @key.setter - def key(self, unsigned long long key): - self._ptr[0].params.keyedMutex.key = key + def smCount(self): + return self._pvt_ptr[0].smCount + @smCount.setter + def smCount(self, unsigned int smCount): + self._pvt_ptr[0].smCount = smCount + + @property - def timeoutMs(self): - return self._ptr[0].params.keyedMutex.timeoutMs - @timeoutMs.setter - def timeoutMs(self, unsigned int timeoutMs): - self._ptr[0].params.keyedMutex.timeoutMs = timeoutMs -{{endif}} -{{if 'struct cudaExternalSemaphoreWaitParams' in found_types}} + def coscheduledSmCount(self): + return self._pvt_ptr[0].coscheduledSmCount + @coscheduledSmCount.setter + def coscheduledSmCount(self, unsigned int coscheduledSmCount): + self._pvt_ptr[0].coscheduledSmCount = coscheduledSmCount + + + @property + def preferredCoscheduledSmCount(self): + return self._pvt_ptr[0].preferredCoscheduledSmCount + @preferredCoscheduledSmCount.setter + def preferredCoscheduledSmCount(self, unsigned int preferredCoscheduledSmCount): + self._pvt_ptr[0].preferredCoscheduledSmCount = preferredCoscheduledSmCount + + + @property + def flags(self): + return self._pvt_ptr[0].flags + @flags.setter + def flags(self, unsigned int flags): + self._pvt_ptr[0].flags = flags + + + @property + def reserved(self): + return self._pvt_ptr[0].reserved + @reserved.setter + def reserved(self, reserved): + self._pvt_ptr[0].reserved = reserved + + +cdef class cudaDevResource_st: + """ + A tagged union describing different resources identified by the + type field. This structure should not be directly modified outside + of the API that created it. struct enumcudaDevResourceTypetype; + union structcudaDevSmResourcesm; + structcudaDevWorkqueueConfigResourcewqConfig; + structcudaDevWorkqueueResourcewq; ; ; - If `typename` is + `cudaDevResourceTypeInvalid`, this resoure is not valid and cannot + be further accessed. - If `typename` is `cudaDevResourceTypeSm`, + the cudaDevSmResource structure `sm` is filled in. For example, + `sm.smCount` will reflect the amount of streaming multiprocessors + available in this resource. - If `typename` is + `cudaDevResourceTypeWorkqueueConfig`, the + cudaDevWorkqueueConfigResource structure `wqConfig` is filled in. + - If `typename` is `cudaDevResourceTypeWorkqueue`, the + cudaDevWorkqueueResource structure `wq` is filled in. -cdef class anon_struct18: - """ Attributes ---------- - fence : anon_struct16 - nvSciSync : anon_union6 + type : cudaDevResourceType + Type of resource, dictates which union field was last set + + + _internal_padding : bytes - keyedMutex : anon_struct17 - reserved : List[unsigned int] + + sm : cudaDevSmResource + Resource corresponding to cudaDevResourceTypeSm `typename`. + + + wqConfig : cudaDevWorkqueueConfigResource + Resource corresponding to cudaDevResourceTypeWorkqueueConfig + `typename`. + + + wq : cudaDevWorkqueueResource + Resource corresponding to cudaDevResourceTypeWorkqueue `typename`. + + + _oversize : bytes + + + + nextResource : cudaDevResource_st + Methods ------- getPtr() Get memory address of class instance - """ - def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._val_ptr = calloc(1, sizeof(cyruntime.cudaDevResource_st)) + self._pvt_ptr = self._val_ptr + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass + + self._sm = cudaDevSmResource(_ptr=&self._pvt_ptr[0].sm) + + + self._wqConfig = cudaDevWorkqueueConfigResource(_ptr=&self._pvt_ptr[0].wqConfig) + + + self._wq = cudaDevWorkqueueResource(_ptr=&self._pvt_ptr[0].wq) - def __init__(self, void_ptr _ptr): - self._fence = anon_struct16(_ptr=self._ptr) - self._nvSciSync = anon_union6(_ptr=self._ptr) - self._keyedMutex = anon_struct17(_ptr=self._ptr) def __dealloc__(self): - pass + if self._val_ptr is not NULL: + free(self._val_ptr) + + if self._nextResource is not NULL: + free(self._nextResource) + self._pvt_ptr[0].nextResource = NULL + def getPtr(self): - return &self._ptr[0].params + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['fence :\n' + '\n'.join([' ' + line for line in str(self.fence).splitlines()])] + str_list += ['type : ' + str(self.type)] except ValueError: - str_list += ['fence : '] + str_list += ['type : '] + + try: - str_list += ['nvSciSync :\n' + '\n'.join([' ' + line for line in str(self.nvSciSync).splitlines()])] + str_list += ['_internal_padding : ' + str(self._internal_padding)] except ValueError: - str_list += ['nvSciSync : '] + str_list += ['_internal_padding : '] + + try: - str_list += ['keyedMutex :\n' + '\n'.join([' ' + line for line in str(self.keyedMutex).splitlines()])] + str_list += ['sm :\n' + '\n'.join([' ' + line for line in str(self.sm).splitlines()])] except ValueError: - str_list += ['keyedMutex : '] + str_list += ['sm : '] + + try: - str_list += ['reserved : ' + str(self.reserved)] + str_list += ['wqConfig :\n' + '\n'.join([' ' + line for line in str(self.wqConfig).splitlines()])] except ValueError: - str_list += ['reserved : '] + str_list += ['wqConfig : '] + + + try: + str_list += ['wq :\n' + '\n'.join([' ' + line for line in str(self.wq).splitlines()])] + except ValueError: + str_list += ['wq : '] + + + try: + str_list += ['_oversize : ' + str(self._oversize)] + except ValueError: + str_list += ['_oversize : '] + + + try: + str_list += ['nextResource : ' + str(self.nextResource)] + except ValueError: + str_list += ['nextResource : '] + return '\n'.join(str_list) else: return '' + @property - def fence(self): - return self._fence - @fence.setter - def fence(self, fence not None : anon_struct16): - string.memcpy(&self._ptr[0].params.fence, fence.getPtr(), sizeof(self._ptr[0].params.fence)) + def type(self): + return cudaDevResourceType(self._pvt_ptr[0].type) + @type.setter + def type(self, type not None : cudaDevResourceType): + self._pvt_ptr[0].type = int(type) + + @property - def nvSciSync(self): - return self._nvSciSync - @nvSciSync.setter - def nvSciSync(self, nvSciSync not None : anon_union6): - string.memcpy(&self._ptr[0].params.nvSciSync, nvSciSync.getPtr(), sizeof(self._ptr[0].params.nvSciSync)) + def _internal_padding(self): + return PyBytes_FromStringAndSize(self._pvt_ptr[0]._internal_padding, 92) + @_internal_padding.setter + def _internal_padding(self, _internal_padding): + if len(_internal_padding) != 92: + raise ValueError("_internal_padding length must be 92, is " + str(len(_internal_padding))) + for i, b in enumerate(_internal_padding): + self._pvt_ptr[0]._internal_padding[i] = b + + @property - def keyedMutex(self): - return self._keyedMutex - @keyedMutex.setter - def keyedMutex(self, keyedMutex not None : anon_struct17): - string.memcpy(&self._ptr[0].params.keyedMutex, keyedMutex.getPtr(), sizeof(self._ptr[0].params.keyedMutex)) + def sm(self): + return self._sm + @sm.setter + def sm(self, sm not None : cudaDevSmResource): + string.memcpy(&self._pvt_ptr[0].sm, sm.getPtr(), sizeof(self._pvt_ptr[0].sm)) + + @property - def reserved(self): - return self._ptr[0].params.reserved - @reserved.setter - def reserved(self, reserved): - self._ptr[0].params.reserved = reserved -{{endif}} -{{if 'struct cudaExternalSemaphoreWaitParams' in found_types}} + def wqConfig(self): + return self._wqConfig + @wqConfig.setter + def wqConfig(self, wqConfig not None : cudaDevWorkqueueConfigResource): + string.memcpy(&self._pvt_ptr[0].wqConfig, wqConfig.getPtr(), sizeof(self._pvt_ptr[0].wqConfig)) + + + @property + def wq(self): + return self._wq + @wq.setter + def wq(self, wq not None : cudaDevWorkqueueResource): + string.memcpy(&self._pvt_ptr[0].wq, wq.getPtr(), sizeof(self._pvt_ptr[0].wq)) + + + @property + def _oversize(self): + return PyBytes_FromStringAndSize(self._pvt_ptr[0]._oversize, 40) + @_oversize.setter + def _oversize(self, _oversize): + if len(_oversize) != 40: + raise ValueError("_oversize length must be 40, is " + str(len(_oversize))) + for i, b in enumerate(_oversize): + self._pvt_ptr[0]._oversize[i] = b + + + @property + def nextResource(self): + arrs = [self._pvt_ptr[0].nextResource + x*sizeof(cyruntime.cudaDevResource_st) for x in range(self._nextResource_length)] + return [cudaDevResource_st(_ptr=arr) for arr in arrs] + @nextResource.setter + def nextResource(self, val): + if len(val) == 0: + free(self._nextResource) + self._nextResource = NULL + self._nextResource_length = 0 + self._pvt_ptr[0].nextResource = NULL + else: + if self._nextResource_length != len(val): + free(self._nextResource) + self._nextResource = calloc(len(val), sizeof(cyruntime.cudaDevResource_st)) + if self._nextResource is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(cyruntime.cudaDevResource_st))) + self._nextResource_length = len(val) + self._pvt_ptr[0].nextResource = self._nextResource + for idx in range(len(val)): + string.memcpy(&self._nextResource[idx], (val[idx])._pvt_ptr, sizeof(cyruntime.cudaDevResource_st)) -cdef class cudaExternalSemaphoreWaitParams: - """ - External semaphore wait parameters, compatible with driver type + +cdef class cudalibraryHostUniversalFunctionAndDataTable: + """ Attributes ---------- - params : anon_struct18 - flags : unsigned int - Only when cudaExternalSemaphoreSignalParams is used to signal a - cudaExternalSemaphore_t of type - cudaExternalSemaphoreHandleTypeNvSciSync, the valid flag is - cudaExternalSemaphoreSignalSkipNvSciBufMemSync: which indicates - that while waiting for the cudaExternalSemaphore_t, no memory - synchronization operations should be performed for any external - memory object imported as cudaExternalMemoryHandleTypeNvSciBuf. For - all other types of cudaExternalSemaphore_t, flags must be zero. - reserved : List[unsigned int] + functionTable : Any + + + + functionWindowSize : size_t + + + + dataTable : Any + + + + dataWindowSize : size_t + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - self._params = anon_struct18(_ptr=self._ptr) + pass def __dealloc__(self): pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: - str_list += ['params :\n' + '\n'.join([' ' + line for line in str(self.params).splitlines()])] + str_list += ['functionTable : ' + hex(self.functionTable)] except ValueError: - str_list += ['params : '] + str_list += ['functionTable : '] + + try: - str_list += ['flags : ' + str(self.flags)] + str_list += ['functionWindowSize : ' + str(self.functionWindowSize)] except ValueError: - str_list += ['flags : '] + str_list += ['functionWindowSize : '] + + try: - str_list += ['reserved : ' + str(self.reserved)] + str_list += ['dataTable : ' + hex(self.dataTable)] except ValueError: - str_list += ['reserved : '] + str_list += ['dataTable : '] + + + try: + str_list += ['dataWindowSize : ' + str(self.dataWindowSize)] + except ValueError: + str_list += ['dataWindowSize : '] + return '\n'.join(str_list) else: return '' + @property - def params(self): - return self._params - @params.setter - def params(self, params not None : anon_struct18): - string.memcpy(&self._ptr[0].params, params.getPtr(), sizeof(self._ptr[0].params)) + def functionTable(self): + return self._pvt_ptr[0].functionTable + @functionTable.setter + def functionTable(self, functionTable): + self._cyfunctionTable = _HelperInputVoidPtr(functionTable) + self._pvt_ptr[0].functionTable = self._cyfunctionTable.cptr + + @property - def flags(self): - return self._ptr[0].flags - @flags.setter - def flags(self, unsigned int flags): - self._ptr[0].flags = flags + def functionWindowSize(self): + return self._pvt_ptr[0].functionWindowSize + @functionWindowSize.setter + def functionWindowSize(self, size_t functionWindowSize): + self._pvt_ptr[0].functionWindowSize = functionWindowSize + + @property - def reserved(self): - return self._ptr[0].reserved - @reserved.setter - def reserved(self, reserved): - self._ptr[0].reserved = reserved -{{endif}} -{{if 'struct cudaKernelNodeParams' in found_types}} + def dataTable(self): + return self._pvt_ptr[0].dataTable + @dataTable.setter + def dataTable(self, dataTable): + self._cydataTable = _HelperInputVoidPtr(dataTable) + self._pvt_ptr[0].dataTable = self._cydataTable.cptr + + + @property + def dataWindowSize(self): + return self._pvt_ptr[0].dataWindowSize + @dataWindowSize.setter + def dataWindowSize(self, size_t dataWindowSize): + self._pvt_ptr[0].dataWindowSize = dataWindowSize + cdef class cudaKernelNodeParams: """ @@ -10477,107 +16363,145 @@ cdef class cudaKernelNodeParams: Attributes ---------- + func : Any Kernel to launch + + gridDim : dim3 Grid dimensions + + blockDim : dim3 Block dimensions + + sharedMemBytes : unsigned int Dynamic shared-memory size per thread block in bytes + + kernelParams : Any Array of pointers to individual kernel arguments + + extra : Any Pointer to kernel arguments in the "extra" format + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - self._gridDim = dim3(_ptr=&self._ptr[0].gridDim) - self._blockDim = dim3(_ptr=&self._ptr[0].blockDim) + pass + + self._gridDim = dim3(_ptr=&self._pvt_ptr[0].gridDim) + + + self._blockDim = dim3(_ptr=&self._pvt_ptr[0].blockDim) + def __dealloc__(self): pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: str_list += ['func : ' + hex(self.func)] except ValueError: str_list += ['func : '] + + try: str_list += ['gridDim :\n' + '\n'.join([' ' + line for line in str(self.gridDim).splitlines()])] except ValueError: str_list += ['gridDim : '] + + try: str_list += ['blockDim :\n' + '\n'.join([' ' + line for line in str(self.blockDim).splitlines()])] except ValueError: str_list += ['blockDim : '] + + try: str_list += ['sharedMemBytes : ' + str(self.sharedMemBytes)] except ValueError: str_list += ['sharedMemBytes : '] + + try: str_list += ['kernelParams : ' + str(self.kernelParams)] except ValueError: str_list += ['kernelParams : '] + + try: str_list += ['extra : ' + str(self.extra)] except ValueError: str_list += ['extra : '] + return '\n'.join(str_list) else: return '' + @property def func(self): - return self._ptr[0].func + return self._pvt_ptr[0].func @func.setter def func(self, func): - _cfunc = utils.HelperInputVoidPtr(func) - self._ptr[0].func = _cfunc.cptr + self._cyfunc = _HelperInputVoidPtr(func) + self._pvt_ptr[0].func = self._cyfunc.cptr + + @property def gridDim(self): return self._gridDim @gridDim.setter def gridDim(self, gridDim not None : dim3): - string.memcpy(&self._ptr[0].gridDim, gridDim.getPtr(), sizeof(self._ptr[0].gridDim)) + string.memcpy(&self._pvt_ptr[0].gridDim, gridDim.getPtr(), sizeof(self._pvt_ptr[0].gridDim)) + + @property def blockDim(self): return self._blockDim @blockDim.setter def blockDim(self, blockDim not None : dim3): - string.memcpy(&self._ptr[0].blockDim, blockDim.getPtr(), sizeof(self._ptr[0].blockDim)) + string.memcpy(&self._pvt_ptr[0].blockDim, blockDim.getPtr(), sizeof(self._pvt_ptr[0].blockDim)) + + @property def sharedMemBytes(self): - return self._ptr[0].sharedMemBytes + return self._pvt_ptr[0].sharedMemBytes @sharedMemBytes.setter def sharedMemBytes(self, unsigned int sharedMemBytes): - self._ptr[0].sharedMemBytes = sharedMemBytes + self._pvt_ptr[0].sharedMemBytes = sharedMemBytes + + @property def kernelParams(self): - return self._ptr[0].kernelParams + return self._pvt_ptr[0].kernelParams @kernelParams.setter def kernelParams(self, kernelParams): - self._ckernelParams = utils.HelperKernelParams(kernelParams) - self._ptr[0].kernelParams = self._ckernelParams.ckernelParams + self._cykernelParams = _HelperKernelParams(kernelParams) + self._pvt_ptr[0].kernelParams = self._cykernelParams.ckernelParams + + @property def extra(self): - return self._ptr[0].extra + return self._pvt_ptr[0].extra @extra.setter def extra(self, void_ptr extra): - self._ptr[0].extra = extra -{{endif}} -{{if 'struct cudaKernelNodeParamsV2' in found_types}} + self._pvt_ptr[0].extra = extra + cdef class cudaKernelNodeParamsV2: """ @@ -10585,107 +16509,256 @@ cdef class cudaKernelNodeParamsV2: Attributes ---------- + func : Any - Kernel to launch + functionType = cudaKernelFucntionTypeDevice + + + kern : cudaKernel_t + functionType = cudaKernelFucntionTypeKernel + + + cuFunc : cudaFunction_t + functionType = cudaKernelFucntionTypeFunction + + gridDim : dim3 Grid dimensions + + blockDim : dim3 Block dimensions + + sharedMemBytes : unsigned int Dynamic shared-memory size per thread block in bytes + + kernelParams : Any Array of pointers to individual kernel arguments + + extra : Any Pointer to kernel arguments in the "extra" format + + ctx : cudaExecutionContext_t + Context in which to run the kernel. If NULL will try to use the + current context. + + + functionType : cudaKernelFunctionType + Type of handle passed in the func/kern/cuFunc union above + + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._val_ptr = calloc(1, sizeof(cyruntime.cudaKernelNodeParamsV2)) + self._pvt_ptr = self._val_ptr else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - self._gridDim = dim3(_ptr=&self._ptr[0].gridDim) - self._blockDim = dim3(_ptr=&self._ptr[0].blockDim) - def __dealloc__(self): pass + + self._kern = cudaKernel_t(_ptr=&self._pvt_ptr[0].kern) + + + self._cuFunc = cudaFunction_t(_ptr=&self._pvt_ptr[0].cuFunc) + + + self._gridDim = dim3(_ptr=&self._pvt_ptr[0].gridDim) + + + self._blockDim = dim3(_ptr=&self._pvt_ptr[0].blockDim) + + + self._ctx = cudaExecutionContext_t(_ptr=&self._pvt_ptr[0].ctx) + + def __dealloc__(self): + if self._val_ptr is not NULL: + free(self._val_ptr) def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: str_list += ['func : ' + hex(self.func)] except ValueError: str_list += ['func : '] + + + try: + str_list += ['kern : ' + str(self.kern)] + except ValueError: + str_list += ['kern : '] + + + try: + str_list += ['cuFunc : ' + str(self.cuFunc)] + except ValueError: + str_list += ['cuFunc : '] + + try: str_list += ['gridDim :\n' + '\n'.join([' ' + line for line in str(self.gridDim).splitlines()])] except ValueError: str_list += ['gridDim : '] + + try: str_list += ['blockDim :\n' + '\n'.join([' ' + line for line in str(self.blockDim).splitlines()])] except ValueError: str_list += ['blockDim : '] + + try: str_list += ['sharedMemBytes : ' + str(self.sharedMemBytes)] except ValueError: str_list += ['sharedMemBytes : '] + + try: str_list += ['kernelParams : ' + str(self.kernelParams)] except ValueError: str_list += ['kernelParams : '] + + try: str_list += ['extra : ' + str(self.extra)] except ValueError: str_list += ['extra : '] + + + try: + str_list += ['ctx : ' + str(self.ctx)] + except ValueError: + str_list += ['ctx : '] + + + try: + str_list += ['functionType : ' + str(self.functionType)] + except ValueError: + str_list += ['functionType : '] + return '\n'.join(str_list) else: return '' + @property def func(self): - return self._ptr[0].func + return self._pvt_ptr[0].func @func.setter def func(self, func): - _cfunc = utils.HelperInputVoidPtr(func) - self._ptr[0].func = _cfunc.cptr + self._cyfunc = _HelperInputVoidPtr(func) + self._pvt_ptr[0].func = self._cyfunc.cptr + + + @property + def kern(self): + return self._kern + @kern.setter + def kern(self, kern): + cdef cyruntime.cudaKernel_t cykern + if kern is None: + cykern = 0 + elif isinstance(kern, (cudaKernel_t,)): + pkern = int(kern) + cykern = pkern + else: + pkern = int(cudaKernel_t(kern)) + cykern = pkern + self._kern._pvt_ptr[0] = cykern + + + @property + def cuFunc(self): + return self._cuFunc + @cuFunc.setter + def cuFunc(self, cuFunc): + cdef cyruntime.cudaFunction_t cycuFunc + if cuFunc is None: + cycuFunc = 0 + elif isinstance(cuFunc, (cudaFunction_t,driver.CUfunction)): + pcuFunc = int(cuFunc) + cycuFunc = pcuFunc + else: + pcuFunc = int(cudaFunction_t(cuFunc)) + cycuFunc = pcuFunc + self._cuFunc._pvt_ptr[0] = cycuFunc + + @property def gridDim(self): return self._gridDim @gridDim.setter def gridDim(self, gridDim not None : dim3): - string.memcpy(&self._ptr[0].gridDim, gridDim.getPtr(), sizeof(self._ptr[0].gridDim)) + string.memcpy(&self._pvt_ptr[0].gridDim, gridDim.getPtr(), sizeof(self._pvt_ptr[0].gridDim)) + + @property def blockDim(self): return self._blockDim @blockDim.setter def blockDim(self, blockDim not None : dim3): - string.memcpy(&self._ptr[0].blockDim, blockDim.getPtr(), sizeof(self._ptr[0].blockDim)) + string.memcpy(&self._pvt_ptr[0].blockDim, blockDim.getPtr(), sizeof(self._pvt_ptr[0].blockDim)) + + @property def sharedMemBytes(self): - return self._ptr[0].sharedMemBytes + return self._pvt_ptr[0].sharedMemBytes @sharedMemBytes.setter def sharedMemBytes(self, unsigned int sharedMemBytes): - self._ptr[0].sharedMemBytes = sharedMemBytes + self._pvt_ptr[0].sharedMemBytes = sharedMemBytes + + @property def kernelParams(self): - return self._ptr[0].kernelParams + return self._pvt_ptr[0].kernelParams @kernelParams.setter def kernelParams(self, kernelParams): - self._ckernelParams = utils.HelperKernelParams(kernelParams) - self._ptr[0].kernelParams = self._ckernelParams.ckernelParams + self._cykernelParams = _HelperKernelParams(kernelParams) + self._pvt_ptr[0].kernelParams = self._cykernelParams.ckernelParams + + @property def extra(self): - return self._ptr[0].extra + return self._pvt_ptr[0].extra @extra.setter def extra(self, void_ptr extra): - self._ptr[0].extra = extra -{{endif}} -{{if 'struct cudaExternalSemaphoreSignalNodeParams' in found_types}} + self._pvt_ptr[0].extra = extra + + + @property + def ctx(self): + return self._ctx + @ctx.setter + def ctx(self, ctx): + cdef cyruntime.cudaExecutionContext_t cyctx + if ctx is None: + cyctx = 0 + elif isinstance(ctx, (cudaExecutionContext_t,)): + pctx = int(ctx) + cyctx = pctx + else: + pctx = int(cudaExecutionContext_t(ctx)) + cyctx = pctx + self._ctx._pvt_ptr[0] = cyctx + + + @property + def functionType(self): + return cudaKernelFunctionType(self._pvt_ptr[0].functionType) + @functionType.setter + def functionType(self, functionType not None : cudaKernelFunctionType): + self._pvt_ptr[0].functionType = int(functionType) + cdef class cudaExternalSemaphoreSignalNodeParams: """ @@ -10693,102 +16766,126 @@ cdef class cudaExternalSemaphoreSignalNodeParams: Attributes ---------- + extSemArray : cudaExternalSemaphore_t Array of external semaphore handles. + + paramsArray : cudaExternalSemaphoreSignalParams Array of external semaphore signal parameters. + + numExtSems : unsigned int Number of handles and parameters supplied in extSemArray and paramsArray. + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): pass def __dealloc__(self): + pass + if self._extSemArray is not NULL: free(self._extSemArray) + self._pvt_ptr[0].extSemArray = NULL + + if self._paramsArray is not NULL: free(self._paramsArray) + self._pvt_ptr[0].paramsArray = NULL + def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: str_list += ['extSemArray : ' + str(self.extSemArray)] except ValueError: str_list += ['extSemArray : '] + + try: str_list += ['paramsArray : ' + str(self.paramsArray)] except ValueError: str_list += ['paramsArray : '] + + try: str_list += ['numExtSems : ' + str(self.numExtSems)] except ValueError: str_list += ['numExtSems : '] + return '\n'.join(str_list) else: return '' + @property def extSemArray(self): - arrs = [self._ptr[0].extSemArray + x*sizeof(ccudart.cudaExternalSemaphore_t) for x in range(self._extSemArray_length)] + arrs = [self._pvt_ptr[0].extSemArray + x*sizeof(cyruntime.cudaExternalSemaphore_t) for x in range(self._extSemArray_length)] return [cudaExternalSemaphore_t(_ptr=arr) for arr in arrs] @extSemArray.setter def extSemArray(self, val): if len(val) == 0: free(self._extSemArray) + self._extSemArray = NULL self._extSemArray_length = 0 - self._ptr[0].extSemArray = NULL + self._pvt_ptr[0].extSemArray = NULL else: if self._extSemArray_length != len(val): free(self._extSemArray) - self._extSemArray = calloc(len(val), sizeof(ccudart.cudaExternalSemaphore_t)) + self._extSemArray = calloc(len(val), sizeof(cyruntime.cudaExternalSemaphore_t)) if self._extSemArray is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(ccudart.cudaExternalSemaphore_t))) + raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(cyruntime.cudaExternalSemaphore_t))) self._extSemArray_length = len(val) - self._ptr[0].extSemArray = self._extSemArray + self._pvt_ptr[0].extSemArray = self._extSemArray for idx in range(len(val)): - self._extSemArray[idx] = (val[idx])._ptr[0] + self._extSemArray[idx] = (val[idx])._pvt_ptr[0] + + @property def paramsArray(self): - arrs = [self._ptr[0].paramsArray + x*sizeof(ccudart.cudaExternalSemaphoreSignalParams) for x in range(self._paramsArray_length)] + arrs = [self._pvt_ptr[0].paramsArray + x*sizeof(cyruntime.cudaExternalSemaphoreSignalParams) for x in range(self._paramsArray_length)] return [cudaExternalSemaphoreSignalParams(_ptr=arr) for arr in arrs] @paramsArray.setter def paramsArray(self, val): if len(val) == 0: free(self._paramsArray) + self._paramsArray = NULL self._paramsArray_length = 0 - self._ptr[0].paramsArray = NULL + self._pvt_ptr[0].paramsArray = NULL else: if self._paramsArray_length != len(val): free(self._paramsArray) - self._paramsArray = calloc(len(val), sizeof(ccudart.cudaExternalSemaphoreSignalParams)) + self._paramsArray = calloc(len(val), sizeof(cyruntime.cudaExternalSemaphoreSignalParams)) if self._paramsArray is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(ccudart.cudaExternalSemaphoreSignalParams))) + raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(cyruntime.cudaExternalSemaphoreSignalParams))) self._paramsArray_length = len(val) - self._ptr[0].paramsArray = self._paramsArray + self._pvt_ptr[0].paramsArray = self._paramsArray for idx in range(len(val)): - string.memcpy(&self._paramsArray[idx], (val[idx])._ptr, sizeof(ccudart.cudaExternalSemaphoreSignalParams)) + string.memcpy(&self._paramsArray[idx], (val[idx])._pvt_ptr, sizeof(cyruntime.cudaExternalSemaphoreSignalParams)) + + @property def numExtSems(self): - return self._ptr[0].numExtSems + return self._pvt_ptr[0].numExtSems @numExtSems.setter def numExtSems(self, unsigned int numExtSems): - self._ptr[0].numExtSems = numExtSems -{{endif}} -{{if 'struct cudaExternalSemaphoreSignalNodeParamsV2' in found_types}} + self._pvt_ptr[0].numExtSems = numExtSems + cdef class cudaExternalSemaphoreSignalNodeParamsV2: """ @@ -10796,102 +16893,126 @@ cdef class cudaExternalSemaphoreSignalNodeParamsV2: Attributes ---------- + extSemArray : cudaExternalSemaphore_t Array of external semaphore handles. + + paramsArray : cudaExternalSemaphoreSignalParams Array of external semaphore signal parameters. + + numExtSems : unsigned int Number of handles and parameters supplied in extSemArray and paramsArray. + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): pass def __dealloc__(self): + pass + if self._extSemArray is not NULL: free(self._extSemArray) + self._pvt_ptr[0].extSemArray = NULL + + if self._paramsArray is not NULL: free(self._paramsArray) + self._pvt_ptr[0].paramsArray = NULL + def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: str_list += ['extSemArray : ' + str(self.extSemArray)] except ValueError: str_list += ['extSemArray : '] + + try: str_list += ['paramsArray : ' + str(self.paramsArray)] except ValueError: str_list += ['paramsArray : '] + + try: str_list += ['numExtSems : ' + str(self.numExtSems)] except ValueError: str_list += ['numExtSems : '] + return '\n'.join(str_list) else: return '' + @property def extSemArray(self): - arrs = [self._ptr[0].extSemArray + x*sizeof(ccudart.cudaExternalSemaphore_t) for x in range(self._extSemArray_length)] + arrs = [self._pvt_ptr[0].extSemArray + x*sizeof(cyruntime.cudaExternalSemaphore_t) for x in range(self._extSemArray_length)] return [cudaExternalSemaphore_t(_ptr=arr) for arr in arrs] @extSemArray.setter def extSemArray(self, val): if len(val) == 0: free(self._extSemArray) + self._extSemArray = NULL self._extSemArray_length = 0 - self._ptr[0].extSemArray = NULL + self._pvt_ptr[0].extSemArray = NULL else: if self._extSemArray_length != len(val): free(self._extSemArray) - self._extSemArray = calloc(len(val), sizeof(ccudart.cudaExternalSemaphore_t)) + self._extSemArray = calloc(len(val), sizeof(cyruntime.cudaExternalSemaphore_t)) if self._extSemArray is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(ccudart.cudaExternalSemaphore_t))) + raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(cyruntime.cudaExternalSemaphore_t))) self._extSemArray_length = len(val) - self._ptr[0].extSemArray = self._extSemArray + self._pvt_ptr[0].extSemArray = self._extSemArray for idx in range(len(val)): - self._extSemArray[idx] = (val[idx])._ptr[0] + self._extSemArray[idx] = (val[idx])._pvt_ptr[0] + + @property def paramsArray(self): - arrs = [self._ptr[0].paramsArray + x*sizeof(ccudart.cudaExternalSemaphoreSignalParams) for x in range(self._paramsArray_length)] + arrs = [self._pvt_ptr[0].paramsArray + x*sizeof(cyruntime.cudaExternalSemaphoreSignalParams) for x in range(self._paramsArray_length)] return [cudaExternalSemaphoreSignalParams(_ptr=arr) for arr in arrs] @paramsArray.setter def paramsArray(self, val): if len(val) == 0: free(self._paramsArray) + self._paramsArray = NULL self._paramsArray_length = 0 - self._ptr[0].paramsArray = NULL + self._pvt_ptr[0].paramsArray = NULL else: if self._paramsArray_length != len(val): free(self._paramsArray) - self._paramsArray = calloc(len(val), sizeof(ccudart.cudaExternalSemaphoreSignalParams)) + self._paramsArray = calloc(len(val), sizeof(cyruntime.cudaExternalSemaphoreSignalParams)) if self._paramsArray is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(ccudart.cudaExternalSemaphoreSignalParams))) + raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(cyruntime.cudaExternalSemaphoreSignalParams))) self._paramsArray_length = len(val) - self._ptr[0].paramsArray = self._paramsArray + self._pvt_ptr[0].paramsArray = self._paramsArray for idx in range(len(val)): - string.memcpy(&self._paramsArray[idx], (val[idx])._ptr, sizeof(ccudart.cudaExternalSemaphoreSignalParams)) + string.memcpy(&self._paramsArray[idx], (val[idx])._pvt_ptr, sizeof(cyruntime.cudaExternalSemaphoreSignalParams)) + + @property def numExtSems(self): - return self._ptr[0].numExtSems + return self._pvt_ptr[0].numExtSems @numExtSems.setter def numExtSems(self, unsigned int numExtSems): - self._ptr[0].numExtSems = numExtSems -{{endif}} -{{if 'struct cudaExternalSemaphoreWaitNodeParams' in found_types}} + self._pvt_ptr[0].numExtSems = numExtSems + cdef class cudaExternalSemaphoreWaitNodeParams: """ @@ -10899,102 +17020,126 @@ cdef class cudaExternalSemaphoreWaitNodeParams: Attributes ---------- + extSemArray : cudaExternalSemaphore_t Array of external semaphore handles. + + paramsArray : cudaExternalSemaphoreWaitParams Array of external semaphore wait parameters. + + numExtSems : unsigned int Number of handles and parameters supplied in extSemArray and paramsArray. + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): pass def __dealloc__(self): + pass + if self._extSemArray is not NULL: free(self._extSemArray) + self._pvt_ptr[0].extSemArray = NULL + + if self._paramsArray is not NULL: free(self._paramsArray) + self._pvt_ptr[0].paramsArray = NULL + def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: str_list += ['extSemArray : ' + str(self.extSemArray)] except ValueError: str_list += ['extSemArray : '] + + try: str_list += ['paramsArray : ' + str(self.paramsArray)] except ValueError: str_list += ['paramsArray : '] + + try: str_list += ['numExtSems : ' + str(self.numExtSems)] except ValueError: str_list += ['numExtSems : '] + return '\n'.join(str_list) else: return '' + @property def extSemArray(self): - arrs = [self._ptr[0].extSemArray + x*sizeof(ccudart.cudaExternalSemaphore_t) for x in range(self._extSemArray_length)] + arrs = [self._pvt_ptr[0].extSemArray + x*sizeof(cyruntime.cudaExternalSemaphore_t) for x in range(self._extSemArray_length)] return [cudaExternalSemaphore_t(_ptr=arr) for arr in arrs] @extSemArray.setter def extSemArray(self, val): if len(val) == 0: free(self._extSemArray) + self._extSemArray = NULL self._extSemArray_length = 0 - self._ptr[0].extSemArray = NULL + self._pvt_ptr[0].extSemArray = NULL else: if self._extSemArray_length != len(val): free(self._extSemArray) - self._extSemArray = calloc(len(val), sizeof(ccudart.cudaExternalSemaphore_t)) + self._extSemArray = calloc(len(val), sizeof(cyruntime.cudaExternalSemaphore_t)) if self._extSemArray is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(ccudart.cudaExternalSemaphore_t))) + raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(cyruntime.cudaExternalSemaphore_t))) self._extSemArray_length = len(val) - self._ptr[0].extSemArray = self._extSemArray + self._pvt_ptr[0].extSemArray = self._extSemArray for idx in range(len(val)): - self._extSemArray[idx] = (val[idx])._ptr[0] + self._extSemArray[idx] = (val[idx])._pvt_ptr[0] + + @property def paramsArray(self): - arrs = [self._ptr[0].paramsArray + x*sizeof(ccudart.cudaExternalSemaphoreWaitParams) for x in range(self._paramsArray_length)] + arrs = [self._pvt_ptr[0].paramsArray + x*sizeof(cyruntime.cudaExternalSemaphoreWaitParams) for x in range(self._paramsArray_length)] return [cudaExternalSemaphoreWaitParams(_ptr=arr) for arr in arrs] @paramsArray.setter def paramsArray(self, val): if len(val) == 0: free(self._paramsArray) + self._paramsArray = NULL self._paramsArray_length = 0 - self._ptr[0].paramsArray = NULL + self._pvt_ptr[0].paramsArray = NULL else: if self._paramsArray_length != len(val): free(self._paramsArray) - self._paramsArray = calloc(len(val), sizeof(ccudart.cudaExternalSemaphoreWaitParams)) + self._paramsArray = calloc(len(val), sizeof(cyruntime.cudaExternalSemaphoreWaitParams)) if self._paramsArray is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(ccudart.cudaExternalSemaphoreWaitParams))) + raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(cyruntime.cudaExternalSemaphoreWaitParams))) self._paramsArray_length = len(val) - self._ptr[0].paramsArray = self._paramsArray + self._pvt_ptr[0].paramsArray = self._paramsArray for idx in range(len(val)): - string.memcpy(&self._paramsArray[idx], (val[idx])._ptr, sizeof(ccudart.cudaExternalSemaphoreWaitParams)) + string.memcpy(&self._paramsArray[idx], (val[idx])._pvt_ptr, sizeof(cyruntime.cudaExternalSemaphoreWaitParams)) + + @property def numExtSems(self): - return self._ptr[0].numExtSems + return self._pvt_ptr[0].numExtSems @numExtSems.setter def numExtSems(self, unsigned int numExtSems): - self._ptr[0].numExtSems = numExtSems -{{endif}} -{{if 'struct cudaExternalSemaphoreWaitNodeParamsV2' in found_types}} + self._pvt_ptr[0].numExtSems = numExtSems + cdef class cudaExternalSemaphoreWaitNodeParamsV2: """ @@ -11002,102 +17147,126 @@ cdef class cudaExternalSemaphoreWaitNodeParamsV2: Attributes ---------- + extSemArray : cudaExternalSemaphore_t Array of external semaphore handles. + + paramsArray : cudaExternalSemaphoreWaitParams Array of external semaphore wait parameters. + + numExtSems : unsigned int Number of handles and parameters supplied in extSemArray and paramsArray. + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): pass def __dealloc__(self): + pass + if self._extSemArray is not NULL: free(self._extSemArray) + self._pvt_ptr[0].extSemArray = NULL + + if self._paramsArray is not NULL: free(self._paramsArray) + self._pvt_ptr[0].paramsArray = NULL + def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: str_list += ['extSemArray : ' + str(self.extSemArray)] except ValueError: str_list += ['extSemArray : '] + + try: str_list += ['paramsArray : ' + str(self.paramsArray)] except ValueError: str_list += ['paramsArray : '] + + try: str_list += ['numExtSems : ' + str(self.numExtSems)] except ValueError: str_list += ['numExtSems : '] + return '\n'.join(str_list) else: return '' + @property def extSemArray(self): - arrs = [self._ptr[0].extSemArray + x*sizeof(ccudart.cudaExternalSemaphore_t) for x in range(self._extSemArray_length)] + arrs = [self._pvt_ptr[0].extSemArray + x*sizeof(cyruntime.cudaExternalSemaphore_t) for x in range(self._extSemArray_length)] return [cudaExternalSemaphore_t(_ptr=arr) for arr in arrs] @extSemArray.setter def extSemArray(self, val): if len(val) == 0: free(self._extSemArray) + self._extSemArray = NULL self._extSemArray_length = 0 - self._ptr[0].extSemArray = NULL + self._pvt_ptr[0].extSemArray = NULL else: if self._extSemArray_length != len(val): free(self._extSemArray) - self._extSemArray = calloc(len(val), sizeof(ccudart.cudaExternalSemaphore_t)) + self._extSemArray = calloc(len(val), sizeof(cyruntime.cudaExternalSemaphore_t)) if self._extSemArray is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(ccudart.cudaExternalSemaphore_t))) + raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(cyruntime.cudaExternalSemaphore_t))) self._extSemArray_length = len(val) - self._ptr[0].extSemArray = self._extSemArray + self._pvt_ptr[0].extSemArray = self._extSemArray for idx in range(len(val)): - self._extSemArray[idx] = (val[idx])._ptr[0] + self._extSemArray[idx] = (val[idx])._pvt_ptr[0] + + @property def paramsArray(self): - arrs = [self._ptr[0].paramsArray + x*sizeof(ccudart.cudaExternalSemaphoreWaitParams) for x in range(self._paramsArray_length)] + arrs = [self._pvt_ptr[0].paramsArray + x*sizeof(cyruntime.cudaExternalSemaphoreWaitParams) for x in range(self._paramsArray_length)] return [cudaExternalSemaphoreWaitParams(_ptr=arr) for arr in arrs] @paramsArray.setter def paramsArray(self, val): if len(val) == 0: free(self._paramsArray) + self._paramsArray = NULL self._paramsArray_length = 0 - self._ptr[0].paramsArray = NULL + self._pvt_ptr[0].paramsArray = NULL else: if self._paramsArray_length != len(val): free(self._paramsArray) - self._paramsArray = calloc(len(val), sizeof(ccudart.cudaExternalSemaphoreWaitParams)) + self._paramsArray = calloc(len(val), sizeof(cyruntime.cudaExternalSemaphoreWaitParams)) if self._paramsArray is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(ccudart.cudaExternalSemaphoreWaitParams))) + raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(cyruntime.cudaExternalSemaphoreWaitParams))) self._paramsArray_length = len(val) - self._ptr[0].paramsArray = self._paramsArray + self._pvt_ptr[0].paramsArray = self._paramsArray for idx in range(len(val)): - string.memcpy(&self._paramsArray[idx], (val[idx])._ptr, sizeof(ccudart.cudaExternalSemaphoreWaitParams)) + string.memcpy(&self._paramsArray[idx], (val[idx])._pvt_ptr, sizeof(cyruntime.cudaExternalSemaphoreWaitParams)) + + @property def numExtSems(self): - return self._ptr[0].numExtSems + return self._pvt_ptr[0].numExtSems @numExtSems.setter def numExtSems(self, unsigned int numExtSems): - self._ptr[0].numExtSems = numExtSems -{{endif}} -{{if 'struct cudaConditionalNodeParams' in found_types}} + self._pvt_ptr[0].numExtSems = numExtSems + cdef class cudaConditionalNodeParams: """ @@ -11105,13 +17274,22 @@ cdef class cudaConditionalNodeParams: Attributes ---------- + handle : cudaGraphConditionalHandle Conditional node handle. Handles must be created in advance of creating the node using cudaGraphConditionalHandleCreate. + + type : cudaGraphConditionalNodeType Type of conditional node. + + size : unsigned int - Size of graph output array. Must be 1. + Size of graph output array. Allowed values are 1 for + cudaGraphCondTypeWhile, 1 or 2 for cudaGraphCondTypeIf, or any + value greater than zero for cudaGraphCondTypeSwitch. + + phGraph_out : cudaGraph_t CUDA-owned array populated with conditional node child graphs during creation of the node. Valid for the lifetime of the @@ -11122,81 +17300,134 @@ cdef class cudaConditionalNodeParams: - All kernels, including kernels in nested conditionals or child graphs at any level, must belong to the same CUDA context. These graphs may be populated using graph node creation APIs or - cudaStreamBeginCaptureToGraph. + cudaStreamBeginCaptureToGraph. cudaGraphCondTypeIf: phGraph_out[0] + is executed when the condition is non-zero. If `size` == 2, + phGraph_out[1] will be executed when the condition is zero. + cudaGraphCondTypeWhile: phGraph_out[0] is executed as long as the + condition is non-zero. cudaGraphCondTypeSwitch: phGraph_out[n] is + executed when the condition is equal to n. If the condition >= + `size`, no body graph is executed. + + + ctx : cudaExecutionContext_t + CUDA Execution Context + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - self._handle = cudaGraphConditionalHandle(_ptr=&self._ptr[0].handle) + pass + + self._handle = cudaGraphConditionalHandle(_ptr=&self._pvt_ptr[0].handle) + + + self._ctx = cudaExecutionContext_t(_ptr=&self._pvt_ptr[0].ctx) + def __dealloc__(self): pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: str_list += ['handle : ' + str(self.handle)] except ValueError: str_list += ['handle : '] + + try: str_list += ['type : ' + str(self.type)] except ValueError: str_list += ['type : '] + + try: str_list += ['size : ' + str(self.size)] except ValueError: str_list += ['size : '] + + try: str_list += ['phGraph_out : ' + str(self.phGraph_out)] except ValueError: str_list += ['phGraph_out : '] + + + try: + str_list += ['ctx : ' + str(self.ctx)] + except ValueError: + str_list += ['ctx : '] + return '\n'.join(str_list) else: return '' + @property def handle(self): return self._handle @handle.setter def handle(self, handle): - cdef ccudart.cudaGraphConditionalHandle chandle + cdef cyruntime.cudaGraphConditionalHandle cyhandle if handle is None: - chandle = 0 + cyhandle = 0 elif isinstance(handle, (cudaGraphConditionalHandle)): phandle = int(handle) - chandle = phandle + cyhandle = phandle else: phandle = int(cudaGraphConditionalHandle(handle)) - chandle = phandle - self._handle._ptr[0] = chandle + cyhandle = phandle + self._handle._pvt_ptr[0] = cyhandle + + @property def type(self): - return cudaGraphConditionalNodeType(self._ptr[0].type) + return cudaGraphConditionalNodeType(self._pvt_ptr[0].type) @type.setter def type(self, type not None : cudaGraphConditionalNodeType): - self._ptr[0].type = type.value + self._pvt_ptr[0].type = int(type) + + @property def size(self): - return self._ptr[0].size + return self._pvt_ptr[0].size @size.setter def size(self, unsigned int size): - self._ptr[0].size = size + self._pvt_ptr[0].size = size + + @property def phGraph_out(self): - arrs = [self._ptr[0].phGraph_out + x*sizeof(ccudart.cudaGraph_t) for x in range(self.size)] + arrs = [self._pvt_ptr[0].phGraph_out + x*sizeof(cyruntime.cudaGraph_t) for x in range(self.size)] return [cudaGraph_t(_ptr=arr) for arr in arrs] -{{endif}} -{{if 'struct cudaChildGraphNodeParams' in found_types}} + + + @property + def ctx(self): + return self._ctx + @ctx.setter + def ctx(self, ctx): + cdef cyruntime.cudaExecutionContext_t cyctx + if ctx is None: + cyctx = 0 + elif isinstance(ctx, (cudaExecutionContext_t,)): + pctx = int(ctx) + cyctx = pctx + else: + pctx = int(cudaExecutionContext_t(ctx)) + cyctx = pctx + self._ctx._pvt_ptr[0] = cyctx + cdef class cudaChildGraphNodeParams: """ @@ -11204,54 +17435,81 @@ cdef class cudaChildGraphNodeParams: Attributes ---------- + graph : cudaGraph_t The child graph to clone into the node for node creation, or a - handle to the graph owned by the node for node query + handle to the graph owned by the node for node query. The graph + must not contain conditional nodes. Graphs containing memory + allocation or memory free nodes must set the ownership to be moved + to the parent. + + + ownership : cudaGraphChildGraphNodeOwnership + The ownership relationship of the child graph node. + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - self._graph = cudaGraph_t(_ptr=&self._ptr[0].graph) + pass + + self._graph = cudaGraph_t(_ptr=&self._pvt_ptr[0].graph) + def __dealloc__(self): pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: str_list += ['graph : ' + str(self.graph)] except ValueError: str_list += ['graph : '] + + + try: + str_list += ['ownership : ' + str(self.ownership)] + except ValueError: + str_list += ['ownership : '] + return '\n'.join(str_list) else: return '' + @property def graph(self): return self._graph @graph.setter def graph(self, graph): - cdef ccudart.cudaGraph_t cgraph + cdef cyruntime.cudaGraph_t cygraph if graph is None: - cgraph = 0 - elif isinstance(graph, (cudaGraph_t,cuda.CUgraph)): + cygraph = 0 + elif isinstance(graph, (cudaGraph_t,driver.CUgraph)): pgraph = int(graph) - cgraph = pgraph + cygraph = pgraph else: pgraph = int(cudaGraph_t(graph)) - cgraph = pgraph - self._graph._ptr[0] = cgraph -{{endif}} -{{if 'struct cudaEventRecordNodeParams' in found_types}} + cygraph = pgraph + self._graph._pvt_ptr[0] = cygraph + + + @property + def ownership(self): + return cudaGraphChildGraphNodeOwnership(self._pvt_ptr[0].ownership) + @ownership.setter + def ownership(self, ownership not None : cudaGraphChildGraphNodeOwnership): + self._pvt_ptr[0].ownership = int(ownership) + cdef class cudaEventRecordNodeParams: """ @@ -11259,53 +17517,59 @@ cdef class cudaEventRecordNodeParams: Attributes ---------- + event : cudaEvent_t The event to record when the node executes + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - self._event = cudaEvent_t(_ptr=&self._ptr[0].event) + pass + + self._event = cudaEvent_t(_ptr=&self._pvt_ptr[0].event) + def __dealloc__(self): pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: str_list += ['event : ' + str(self.event)] except ValueError: str_list += ['event : '] + return '\n'.join(str_list) else: return '' + @property def event(self): return self._event @event.setter def event(self, event): - cdef ccudart.cudaEvent_t cevent + cdef cyruntime.cudaEvent_t cyevent if event is None: - cevent = 0 - elif isinstance(event, (cudaEvent_t,cuda.CUevent)): + cyevent = 0 + elif isinstance(event, (cudaEvent_t,driver.CUevent)): pevent = int(event) - cevent = pevent + cyevent = pevent else: pevent = int(cudaEvent_t(event)) - cevent = pevent - self._event._ptr[0] = cevent -{{endif}} -{{if 'struct cudaEventWaitNodeParams' in found_types}} + cyevent = pevent + self._event._pvt_ptr[0] = cyevent + cdef class cudaEventWaitNodeParams: """ @@ -11313,53 +17577,59 @@ cdef class cudaEventWaitNodeParams: Attributes ---------- + event : cudaEvent_t The event to wait on from the node + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - self._event = cudaEvent_t(_ptr=&self._ptr[0].event) + pass + + self._event = cudaEvent_t(_ptr=&self._pvt_ptr[0].event) + def __dealloc__(self): pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: str_list += ['event : ' + str(self.event)] except ValueError: str_list += ['event : '] + return '\n'.join(str_list) else: return '' + @property def event(self): return self._event @event.setter def event(self, event): - cdef ccudart.cudaEvent_t cevent + cdef cyruntime.cudaEvent_t cyevent if event is None: - cevent = 0 - elif isinstance(event, (cudaEvent_t,cuda.CUevent)): + cyevent = 0 + elif isinstance(event, (cudaEvent_t,driver.CUevent)): pevent = int(event) - cevent = pevent + cyevent = pevent else: pevent = int(cudaEvent_t(event)) - cevent = pevent - self._event._ptr[0] = cevent -{{endif}} -{{if 'struct cudaGraphNodeParams' in found_types}} + cyevent = pevent + self._event._pvt_ptr[0] = cyevent + cdef class cudaGraphNodeParams: """ @@ -11367,237 +17637,355 @@ cdef class cudaGraphNodeParams: Attributes ---------- + type : cudaGraphNodeType Type of the node - reserved0 : List[int] + + + reserved0 : list[int] Reserved. Must be zero. - reserved1 : List[long long] + + + reserved1 : list[long long] Padding. Unused bytes must be zero. + + kernel : cudaKernelNodeParamsV2 Kernel node parameters. + + memcpy : cudaMemcpyNodeParams Memcpy node parameters. + + memset : cudaMemsetParamsV2 Memset node parameters. + + host : cudaHostNodeParamsV2 Host node parameters. + + graph : cudaChildGraphNodeParams Child graph node parameters. + + eventWait : cudaEventWaitNodeParams Event wait node parameters. + + eventRecord : cudaEventRecordNodeParams Event record node parameters. + + extSemSignal : cudaExternalSemaphoreSignalNodeParamsV2 External semaphore signal node parameters. + + extSemWait : cudaExternalSemaphoreWaitNodeParamsV2 External semaphore wait node parameters. + + alloc : cudaMemAllocNodeParamsV2 Memory allocation node parameters. + + free : cudaMemFreeNodeParams Memory free node parameters. + + conditional : cudaConditionalNodeParams Conditional node parameters. + + reserved2 : long long Reserved bytes. Must be zero. + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._val_ptr = calloc(1, sizeof(ccudart.cudaGraphNodeParams)) - self._ptr = self._val_ptr + self._val_ptr = calloc(1, sizeof(cyruntime.cudaGraphNodeParams)) + self._pvt_ptr = self._val_ptr else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - self._kernel = cudaKernelNodeParamsV2(_ptr=&self._ptr[0].kernel) - self._memcpy = cudaMemcpyNodeParams(_ptr=&self._ptr[0].memcpy) - self._memset = cudaMemsetParamsV2(_ptr=&self._ptr[0].memset) - self._host = cudaHostNodeParamsV2(_ptr=&self._ptr[0].host) - self._graph = cudaChildGraphNodeParams(_ptr=&self._ptr[0].graph) - self._eventWait = cudaEventWaitNodeParams(_ptr=&self._ptr[0].eventWait) - self._eventRecord = cudaEventRecordNodeParams(_ptr=&self._ptr[0].eventRecord) - self._extSemSignal = cudaExternalSemaphoreSignalNodeParamsV2(_ptr=&self._ptr[0].extSemSignal) - self._extSemWait = cudaExternalSemaphoreWaitNodeParamsV2(_ptr=&self._ptr[0].extSemWait) - self._alloc = cudaMemAllocNodeParamsV2(_ptr=&self._ptr[0].alloc) - self._free = cudaMemFreeNodeParams(_ptr=&self._ptr[0].free) - self._conditional = cudaConditionalNodeParams(_ptr=&self._ptr[0].conditional) + pass + + self._kernel = cudaKernelNodeParamsV2(_ptr=&self._pvt_ptr[0].kernel) + + + self._memcpy = cudaMemcpyNodeParams(_ptr=&self._pvt_ptr[0].memcpy) + + + self._memset = cudaMemsetParamsV2(_ptr=&self._pvt_ptr[0].memset) + + + self._host = cudaHostNodeParamsV2(_ptr=&self._pvt_ptr[0].host) + + + self._graph = cudaChildGraphNodeParams(_ptr=&self._pvt_ptr[0].graph) + + + self._eventWait = cudaEventWaitNodeParams(_ptr=&self._pvt_ptr[0].eventWait) + + + self._eventRecord = cudaEventRecordNodeParams(_ptr=&self._pvt_ptr[0].eventRecord) + + + self._extSemSignal = cudaExternalSemaphoreSignalNodeParamsV2(_ptr=&self._pvt_ptr[0].extSemSignal) + + + self._extSemWait = cudaExternalSemaphoreWaitNodeParamsV2(_ptr=&self._pvt_ptr[0].extSemWait) + + + self._alloc = cudaMemAllocNodeParamsV2(_ptr=&self._pvt_ptr[0].alloc) + + + self._free = cudaMemFreeNodeParams(_ptr=&self._pvt_ptr[0].free) + + + self._conditional = cudaConditionalNodeParams(_ptr=&self._pvt_ptr[0].conditional) + def __dealloc__(self): if self._val_ptr is not NULL: free(self._val_ptr) def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: str_list += ['type : ' + str(self.type)] except ValueError: str_list += ['type : '] + + try: str_list += ['reserved0 : ' + str(self.reserved0)] except ValueError: str_list += ['reserved0 : '] + + try: str_list += ['reserved1 : ' + str(self.reserved1)] except ValueError: str_list += ['reserved1 : '] + + try: str_list += ['kernel :\n' + '\n'.join([' ' + line for line in str(self.kernel).splitlines()])] except ValueError: str_list += ['kernel : '] + + try: str_list += ['memcpy :\n' + '\n'.join([' ' + line for line in str(self.memcpy).splitlines()])] except ValueError: str_list += ['memcpy : '] + + try: str_list += ['memset :\n' + '\n'.join([' ' + line for line in str(self.memset).splitlines()])] except ValueError: str_list += ['memset : '] + + try: str_list += ['host :\n' + '\n'.join([' ' + line for line in str(self.host).splitlines()])] except ValueError: str_list += ['host : '] + + try: str_list += ['graph :\n' + '\n'.join([' ' + line for line in str(self.graph).splitlines()])] except ValueError: str_list += ['graph : '] + + try: str_list += ['eventWait :\n' + '\n'.join([' ' + line for line in str(self.eventWait).splitlines()])] except ValueError: str_list += ['eventWait : '] + + try: str_list += ['eventRecord :\n' + '\n'.join([' ' + line for line in str(self.eventRecord).splitlines()])] except ValueError: str_list += ['eventRecord : '] + + try: str_list += ['extSemSignal :\n' + '\n'.join([' ' + line for line in str(self.extSemSignal).splitlines()])] except ValueError: str_list += ['extSemSignal : '] + + try: str_list += ['extSemWait :\n' + '\n'.join([' ' + line for line in str(self.extSemWait).splitlines()])] except ValueError: str_list += ['extSemWait : '] + + try: str_list += ['alloc :\n' + '\n'.join([' ' + line for line in str(self.alloc).splitlines()])] except ValueError: str_list += ['alloc : '] + + try: str_list += ['free :\n' + '\n'.join([' ' + line for line in str(self.free).splitlines()])] except ValueError: str_list += ['free : '] + + try: str_list += ['conditional :\n' + '\n'.join([' ' + line for line in str(self.conditional).splitlines()])] except ValueError: str_list += ['conditional : '] + + try: str_list += ['reserved2 : ' + str(self.reserved2)] except ValueError: str_list += ['reserved2 : '] + return '\n'.join(str_list) else: return '' + @property def type(self): - return cudaGraphNodeType(self._ptr[0].type) + return cudaGraphNodeType(self._pvt_ptr[0].type) @type.setter def type(self, type not None : cudaGraphNodeType): - self._ptr[0].type = type.value + self._pvt_ptr[0].type = int(type) + + @property def reserved0(self): - return self._ptr[0].reserved0 + return self._pvt_ptr[0].reserved0 @reserved0.setter def reserved0(self, reserved0): - self._ptr[0].reserved0 = reserved0 + self._pvt_ptr[0].reserved0 = reserved0 + + @property def reserved1(self): - return self._ptr[0].reserved1 + return self._pvt_ptr[0].reserved1 @reserved1.setter def reserved1(self, reserved1): - self._ptr[0].reserved1 = reserved1 + self._pvt_ptr[0].reserved1 = reserved1 + + @property def kernel(self): return self._kernel @kernel.setter def kernel(self, kernel not None : cudaKernelNodeParamsV2): - string.memcpy(&self._ptr[0].kernel, kernel.getPtr(), sizeof(self._ptr[0].kernel)) + string.memcpy(&self._pvt_ptr[0].kernel, kernel.getPtr(), sizeof(self._pvt_ptr[0].kernel)) + + @property def memcpy(self): return self._memcpy @memcpy.setter def memcpy(self, memcpy not None : cudaMemcpyNodeParams): - string.memcpy(&self._ptr[0].memcpy, memcpy.getPtr(), sizeof(self._ptr[0].memcpy)) + string.memcpy(&self._pvt_ptr[0].memcpy, memcpy.getPtr(), sizeof(self._pvt_ptr[0].memcpy)) + + @property def memset(self): return self._memset @memset.setter def memset(self, memset not None : cudaMemsetParamsV2): - string.memcpy(&self._ptr[0].memset, memset.getPtr(), sizeof(self._ptr[0].memset)) + string.memcpy(&self._pvt_ptr[0].memset, memset.getPtr(), sizeof(self._pvt_ptr[0].memset)) + + @property def host(self): return self._host @host.setter def host(self, host not None : cudaHostNodeParamsV2): - string.memcpy(&self._ptr[0].host, host.getPtr(), sizeof(self._ptr[0].host)) + string.memcpy(&self._pvt_ptr[0].host, host.getPtr(), sizeof(self._pvt_ptr[0].host)) + + @property def graph(self): return self._graph @graph.setter def graph(self, graph not None : cudaChildGraphNodeParams): - string.memcpy(&self._ptr[0].graph, graph.getPtr(), sizeof(self._ptr[0].graph)) + string.memcpy(&self._pvt_ptr[0].graph, graph.getPtr(), sizeof(self._pvt_ptr[0].graph)) + + @property def eventWait(self): return self._eventWait @eventWait.setter def eventWait(self, eventWait not None : cudaEventWaitNodeParams): - string.memcpy(&self._ptr[0].eventWait, eventWait.getPtr(), sizeof(self._ptr[0].eventWait)) + string.memcpy(&self._pvt_ptr[0].eventWait, eventWait.getPtr(), sizeof(self._pvt_ptr[0].eventWait)) + + @property def eventRecord(self): return self._eventRecord @eventRecord.setter def eventRecord(self, eventRecord not None : cudaEventRecordNodeParams): - string.memcpy(&self._ptr[0].eventRecord, eventRecord.getPtr(), sizeof(self._ptr[0].eventRecord)) + string.memcpy(&self._pvt_ptr[0].eventRecord, eventRecord.getPtr(), sizeof(self._pvt_ptr[0].eventRecord)) + + @property def extSemSignal(self): return self._extSemSignal @extSemSignal.setter def extSemSignal(self, extSemSignal not None : cudaExternalSemaphoreSignalNodeParamsV2): - string.memcpy(&self._ptr[0].extSemSignal, extSemSignal.getPtr(), sizeof(self._ptr[0].extSemSignal)) + string.memcpy(&self._pvt_ptr[0].extSemSignal, extSemSignal.getPtr(), sizeof(self._pvt_ptr[0].extSemSignal)) + + @property def extSemWait(self): return self._extSemWait @extSemWait.setter def extSemWait(self, extSemWait not None : cudaExternalSemaphoreWaitNodeParamsV2): - string.memcpy(&self._ptr[0].extSemWait, extSemWait.getPtr(), sizeof(self._ptr[0].extSemWait)) + string.memcpy(&self._pvt_ptr[0].extSemWait, extSemWait.getPtr(), sizeof(self._pvt_ptr[0].extSemWait)) + + @property def alloc(self): return self._alloc @alloc.setter def alloc(self, alloc not None : cudaMemAllocNodeParamsV2): - string.memcpy(&self._ptr[0].alloc, alloc.getPtr(), sizeof(self._ptr[0].alloc)) + string.memcpy(&self._pvt_ptr[0].alloc, alloc.getPtr(), sizeof(self._pvt_ptr[0].alloc)) + + @property def free(self): return self._free @free.setter def free(self, free not None : cudaMemFreeNodeParams): - string.memcpy(&self._ptr[0].free, free.getPtr(), sizeof(self._ptr[0].free)) + string.memcpy(&self._pvt_ptr[0].free, free.getPtr(), sizeof(self._pvt_ptr[0].free)) + + @property def conditional(self): return self._conditional @conditional.setter def conditional(self, conditional not None : cudaConditionalNodeParams): - string.memcpy(&self._ptr[0].conditional, conditional.getPtr(), sizeof(self._ptr[0].conditional)) + string.memcpy(&self._pvt_ptr[0].conditional, conditional.getPtr(), sizeof(self._pvt_ptr[0].conditional)) + + @property def reserved2(self): - return self._ptr[0].reserved2 + return self._pvt_ptr[0].reserved2 @reserved2.setter def reserved2(self, long long reserved2): - self._ptr[0].reserved2 = reserved2 -{{endif}} -{{if 'struct cudaGraphEdgeData_st' in found_types}} + self._pvt_ptr[0].reserved2 = reserved2 + cdef class cudaGraphEdgeData_st: """ @@ -11608,6 +17996,7 @@ cdef class cudaGraphEdgeData_st: Attributes ---------- + from_port : bytes This indicates when the dependency is triggered from the upstream node on the edge. The meaning is specfic to the node type. A value @@ -11618,6 +18007,8 @@ cdef class cudaGraphEdgeData_st: cudaGraphKernelNodePortDefault, cudaGraphKernelNodePortProgrammatic, or cudaGraphKernelNodePortLaunchCompletion. + + to_port : bytes This indicates what portion of the downstream node is dependent on the upstream node or portion thereof (indicated by `from_port`). @@ -11625,82 +18016,100 @@ cdef class cudaGraphEdgeData_st: means the entirety of the downstream node is dependent on the upstream work. Currently no node types define non-zero ports. Accordingly, this field must be set to zero. + + type : bytes - This should be populated with a value from - ::cudaGraphDependencyType. (It is typed as char due to compiler- - specific layout of bitfields.) See ::cudaGraphDependencyType. + This should be populated with a value from cudaGraphDependencyType. + (It is typed as char due to compiler-specific layout of bitfields.) + See cudaGraphDependencyType. + + reserved : bytes These bytes are unused and must be zeroed. This ensures compatibility if additional fields are added in the future. + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): pass def __dealloc__(self): pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: str_list += ['from_port : ' + str(self.from_port)] except ValueError: str_list += ['from_port : '] + + try: str_list += ['to_port : ' + str(self.to_port)] except ValueError: str_list += ['to_port : '] + + try: str_list += ['type : ' + str(self.type)] except ValueError: str_list += ['type : '] + + try: str_list += ['reserved : ' + str(self.reserved)] except ValueError: str_list += ['reserved : '] + return '\n'.join(str_list) else: return '' + @property def from_port(self): - return self._ptr[0].from_port + return self._pvt_ptr[0].from_port @from_port.setter def from_port(self, unsigned char from_port): - self._ptr[0].from_port = from_port + self._pvt_ptr[0].from_port = from_port + + @property def to_port(self): - return self._ptr[0].to_port + return self._pvt_ptr[0].to_port @to_port.setter def to_port(self, unsigned char to_port): - self._ptr[0].to_port = to_port + self._pvt_ptr[0].to_port = to_port + + @property def type(self): - return self._ptr[0].type + return self._pvt_ptr[0].type @type.setter def type(self, unsigned char type): - self._ptr[0].type = type + self._pvt_ptr[0].type = type + + @property def reserved(self): - return PyBytes_FromStringAndSize(self._ptr[0].reserved, 5) + return PyBytes_FromStringAndSize(self._pvt_ptr[0].reserved, 5) @reserved.setter def reserved(self, reserved): if len(reserved) != 5: raise ValueError("reserved length must be 5, is " + str(len(reserved))) for i, b in enumerate(reserved): - self._ptr[0].reserved[i] = b -{{endif}} -{{if 'struct cudaGraphInstantiateParams_st' in found_types}} + self._pvt_ptr[0].reserved[i] = b + cdef class cudaGraphInstantiateParams_st: """ @@ -11708,99 +18117,125 @@ cdef class cudaGraphInstantiateParams_st: Attributes ---------- + flags : unsigned long long Instantiation flags + + uploadStream : cudaStream_t Upload stream + + errNode_out : cudaGraphNode_t The node which caused instantiation to fail, if any + + result_out : cudaGraphInstantiateResult Whether instantiation was successful. If it failed, the reason why + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - self._uploadStream = cudaStream_t(_ptr=&self._ptr[0].uploadStream) - self._errNode_out = cudaGraphNode_t(_ptr=&self._ptr[0].errNode_out) + pass + + self._uploadStream = cudaStream_t(_ptr=&self._pvt_ptr[0].uploadStream) + + + self._errNode_out = cudaGraphNode_t(_ptr=&self._pvt_ptr[0].errNode_out) + def __dealloc__(self): pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: str_list += ['flags : ' + str(self.flags)] except ValueError: str_list += ['flags : '] + + try: str_list += ['uploadStream : ' + str(self.uploadStream)] except ValueError: str_list += ['uploadStream : '] + + try: str_list += ['errNode_out : ' + str(self.errNode_out)] except ValueError: str_list += ['errNode_out : '] + + try: str_list += ['result_out : ' + str(self.result_out)] except ValueError: str_list += ['result_out : '] + return '\n'.join(str_list) else: return '' + @property def flags(self): - return self._ptr[0].flags + return self._pvt_ptr[0].flags @flags.setter def flags(self, unsigned long long flags): - self._ptr[0].flags = flags + self._pvt_ptr[0].flags = flags + + @property def uploadStream(self): return self._uploadStream @uploadStream.setter def uploadStream(self, uploadStream): - cdef ccudart.cudaStream_t cuploadStream + cdef cyruntime.cudaStream_t cyuploadStream if uploadStream is None: - cuploadStream = 0 - elif isinstance(uploadStream, (cudaStream_t,cuda.CUstream)): + cyuploadStream = 0 + elif isinstance(uploadStream, (cudaStream_t,driver.CUstream)): puploadStream = int(uploadStream) - cuploadStream = puploadStream + cyuploadStream = puploadStream else: puploadStream = int(cudaStream_t(uploadStream)) - cuploadStream = puploadStream - self._uploadStream._ptr[0] = cuploadStream + cyuploadStream = puploadStream + self._uploadStream._pvt_ptr[0] = cyuploadStream + + @property def errNode_out(self): return self._errNode_out @errNode_out.setter def errNode_out(self, errNode_out): - cdef ccudart.cudaGraphNode_t cerrNode_out + cdef cyruntime.cudaGraphNode_t cyerrNode_out if errNode_out is None: - cerrNode_out = 0 - elif isinstance(errNode_out, (cudaGraphNode_t,cuda.CUgraphNode)): + cyerrNode_out = 0 + elif isinstance(errNode_out, (cudaGraphNode_t,driver.CUgraphNode)): perrNode_out = int(errNode_out) - cerrNode_out = perrNode_out + cyerrNode_out = perrNode_out else: perrNode_out = int(cudaGraphNode_t(errNode_out)) - cerrNode_out = perrNode_out - self._errNode_out._ptr[0] = cerrNode_out + cyerrNode_out = perrNode_out + self._errNode_out._pvt_ptr[0] = cyerrNode_out + + @property def result_out(self): - return cudaGraphInstantiateResult(self._ptr[0].result_out) + return cudaGraphInstantiateResult(self._pvt_ptr[0].result_out) @result_out.setter def result_out(self, result_out not None : cudaGraphInstantiateResult): - self._ptr[0].result_out = result_out.value -{{endif}} -{{if 'struct cudaGraphExecUpdateResultInfo_st' in found_types}} + self._pvt_ptr[0].result_out = int(result_out) + cdef class cudaGraphExecUpdateResultInfo_st: """ @@ -11808,222 +18243,277 @@ cdef class cudaGraphExecUpdateResultInfo_st: Attributes ---------- + result : cudaGraphExecUpdateResult Gives more specific detail when a cuda graph update fails. + + errorNode : cudaGraphNode_t The "to node" of the error edge when the topologies do not match. The error node when the error is associated with a specific node. NULL when the error is generic. + + errorFromNode : cudaGraphNode_t The from node of error edge when the topologies do not match. Otherwise NULL. + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - self._errorNode = cudaGraphNode_t(_ptr=&self._ptr[0].errorNode) - self._errorFromNode = cudaGraphNode_t(_ptr=&self._ptr[0].errorFromNode) + pass + + self._errorNode = cudaGraphNode_t(_ptr=&self._pvt_ptr[0].errorNode) + + + self._errorFromNode = cudaGraphNode_t(_ptr=&self._pvt_ptr[0].errorFromNode) + def __dealloc__(self): pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: str_list += ['result : ' + str(self.result)] except ValueError: str_list += ['result : '] + + try: str_list += ['errorNode : ' + str(self.errorNode)] except ValueError: str_list += ['errorNode : '] + + try: str_list += ['errorFromNode : ' + str(self.errorFromNode)] except ValueError: str_list += ['errorFromNode : '] + return '\n'.join(str_list) else: return '' + @property def result(self): - return cudaGraphExecUpdateResult(self._ptr[0].result) + return cudaGraphExecUpdateResult(self._pvt_ptr[0].result) @result.setter def result(self, result not None : cudaGraphExecUpdateResult): - self._ptr[0].result = result.value + self._pvt_ptr[0].result = int(result) + + @property def errorNode(self): return self._errorNode @errorNode.setter def errorNode(self, errorNode): - cdef ccudart.cudaGraphNode_t cerrorNode + cdef cyruntime.cudaGraphNode_t cyerrorNode if errorNode is None: - cerrorNode = 0 - elif isinstance(errorNode, (cudaGraphNode_t,cuda.CUgraphNode)): + cyerrorNode = 0 + elif isinstance(errorNode, (cudaGraphNode_t,driver.CUgraphNode)): perrorNode = int(errorNode) - cerrorNode = perrorNode + cyerrorNode = perrorNode else: perrorNode = int(cudaGraphNode_t(errorNode)) - cerrorNode = perrorNode - self._errorNode._ptr[0] = cerrorNode + cyerrorNode = perrorNode + self._errorNode._pvt_ptr[0] = cyerrorNode + + @property def errorFromNode(self): return self._errorFromNode @errorFromNode.setter def errorFromNode(self, errorFromNode): - cdef ccudart.cudaGraphNode_t cerrorFromNode + cdef cyruntime.cudaGraphNode_t cyerrorFromNode if errorFromNode is None: - cerrorFromNode = 0 - elif isinstance(errorFromNode, (cudaGraphNode_t,cuda.CUgraphNode)): + cyerrorFromNode = 0 + elif isinstance(errorFromNode, (cudaGraphNode_t,driver.CUgraphNode)): perrorFromNode = int(errorFromNode) - cerrorFromNode = perrorFromNode + cyerrorFromNode = perrorFromNode else: perrorFromNode = int(cudaGraphNode_t(errorFromNode)) - cerrorFromNode = perrorFromNode - self._errorFromNode._ptr[0] = cerrorFromNode -{{endif}} -{{if 'struct cudaGraphKernelNodeUpdate' in found_types}} + cyerrorFromNode = perrorFromNode + self._errorFromNode._pvt_ptr[0] = cyerrorFromNode -cdef class anon_struct19: + +cdef class anon_struct16: """ Attributes ---------- + pValue : Any + + offset : size_t + + size : size_t + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): pass def __dealloc__(self): pass def getPtr(self): - return &self._ptr[0].updateData.param + return &self._pvt_ptr[0].updateData.param def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: str_list += ['pValue : ' + hex(self.pValue)] except ValueError: str_list += ['pValue : '] + + try: str_list += ['offset : ' + str(self.offset)] except ValueError: str_list += ['offset : '] + + try: str_list += ['size : ' + str(self.size)] except ValueError: str_list += ['size : '] + return '\n'.join(str_list) else: return '' + @property def pValue(self): - return self._ptr[0].updateData.param.pValue + return self._pvt_ptr[0].updateData.param.pValue @pValue.setter def pValue(self, pValue): - _cpValue = utils.HelperInputVoidPtr(pValue) - self._ptr[0].updateData.param.pValue = _cpValue.cptr + self._cypValue = _HelperInputVoidPtr(pValue) + self._pvt_ptr[0].updateData.param.pValue = self._cypValue.cptr + + @property def offset(self): - return self._ptr[0].updateData.param.offset + return self._pvt_ptr[0].updateData.param.offset @offset.setter def offset(self, size_t offset): - self._ptr[0].updateData.param.offset = offset + self._pvt_ptr[0].updateData.param.offset = offset + + @property def size(self): - return self._ptr[0].updateData.param.size + return self._pvt_ptr[0].updateData.param.size @size.setter def size(self, size_t size): - self._ptr[0].updateData.param.size = size -{{endif}} -{{if 'struct cudaGraphKernelNodeUpdate' in found_types}} + self._pvt_ptr[0].updateData.param.size = size + -cdef class anon_union8: +cdef class anon_union10: """ Attributes ---------- + gridDim : dim3 - param : anon_struct19 + + + param : anon_struct16 + + isEnabled : unsigned int + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - self._gridDim = dim3(_ptr=&self._ptr[0].updateData.gridDim) - self._param = anon_struct19(_ptr=self._ptr) + pass + + self._gridDim = dim3(_ptr=&self._pvt_ptr[0].updateData.gridDim) + + + self._param = anon_struct16(_ptr=self._pvt_ptr) + def __dealloc__(self): pass def getPtr(self): - return &self._ptr[0].updateData + return &self._pvt_ptr[0].updateData def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: str_list += ['gridDim :\n' + '\n'.join([' ' + line for line in str(self.gridDim).splitlines()])] except ValueError: str_list += ['gridDim : '] + + try: str_list += ['param :\n' + '\n'.join([' ' + line for line in str(self.param).splitlines()])] except ValueError: str_list += ['param : '] + + try: str_list += ['isEnabled : ' + str(self.isEnabled)] except ValueError: str_list += ['isEnabled : '] + return '\n'.join(str_list) else: return '' + @property def gridDim(self): return self._gridDim @gridDim.setter def gridDim(self, gridDim not None : dim3): - string.memcpy(&self._ptr[0].updateData.gridDim, gridDim.getPtr(), sizeof(self._ptr[0].updateData.gridDim)) + string.memcpy(&self._pvt_ptr[0].updateData.gridDim, gridDim.getPtr(), sizeof(self._pvt_ptr[0].updateData.gridDim)) + + @property def param(self): return self._param @param.setter - def param(self, param not None : anon_struct19): - string.memcpy(&self._ptr[0].updateData.param, param.getPtr(), sizeof(self._ptr[0].updateData.param)) + def param(self, param not None : anon_struct16): + string.memcpy(&self._pvt_ptr[0].updateData.param, param.getPtr(), sizeof(self._pvt_ptr[0].updateData.param)) + + @property def isEnabled(self): - return self._ptr[0].updateData.isEnabled + return self._pvt_ptr[0].updateData.isEnabled @isEnabled.setter def isEnabled(self, unsigned int isEnabled): - self._ptr[0].updateData.isEnabled = isEnabled -{{endif}} -{{if 'struct cudaGraphKernelNodeUpdate' in found_types}} + self._pvt_ptr[0].updateData.isEnabled = isEnabled + cdef class cudaGraphKernelNodeUpdate: """ @@ -12032,426 +18522,600 @@ cdef class cudaGraphKernelNodeUpdate: Attributes ---------- + node : cudaGraphDeviceNode_t Node to update + + field : cudaGraphKernelNodeField Which type of update to apply. Determines how updateData is interpreted - updateData : anon_union8 + + + updateData : anon_union10 Update data to apply. Which field is used depends on field's value + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._val_ptr = calloc(1, sizeof(ccudart.cudaGraphKernelNodeUpdate)) - self._ptr = self._val_ptr + self._val_ptr = calloc(1, sizeof(cyruntime.cudaGraphKernelNodeUpdate)) + self._pvt_ptr = self._val_ptr else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - self._node = cudaGraphDeviceNode_t(_ptr=&self._ptr[0].node) - self._updateData = anon_union8(_ptr=self._ptr) + pass + + self._node = cudaGraphDeviceNode_t(_ptr=&self._pvt_ptr[0].node) + + + self._updateData = anon_union10(_ptr=self._pvt_ptr) + def __dealloc__(self): if self._val_ptr is not NULL: free(self._val_ptr) def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: str_list += ['node : ' + str(self.node)] except ValueError: str_list += ['node : '] + + try: str_list += ['field : ' + str(self.field)] except ValueError: str_list += ['field : '] + + try: str_list += ['updateData :\n' + '\n'.join([' ' + line for line in str(self.updateData).splitlines()])] except ValueError: str_list += ['updateData : '] + return '\n'.join(str_list) else: return '' + @property def node(self): return self._node @node.setter def node(self, node): - cdef ccudart.cudaGraphDeviceNode_t cnode + cdef cyruntime.cudaGraphDeviceNode_t cynode if node is None: - cnode = 0 + cynode = 0 elif isinstance(node, (cudaGraphDeviceNode_t,)): pnode = int(node) - cnode = pnode + cynode = pnode else: pnode = int(cudaGraphDeviceNode_t(node)) - cnode = pnode - self._node._ptr[0] = cnode + cynode = pnode + self._node._pvt_ptr[0] = cynode + + @property def field(self): - return cudaGraphKernelNodeField(self._ptr[0].field) + return cudaGraphKernelNodeField(self._pvt_ptr[0].field) @field.setter def field(self, field not None : cudaGraphKernelNodeField): - self._ptr[0].field = field.value + self._pvt_ptr[0].field = int(field) + + @property def updateData(self): return self._updateData @updateData.setter - def updateData(self, updateData not None : anon_union8): - string.memcpy(&self._ptr[0].updateData, updateData.getPtr(), sizeof(self._ptr[0].updateData)) -{{endif}} -{{if 'struct cudaLaunchMemSyncDomainMap_st' in found_types}} + def updateData(self, updateData not None : anon_union10): + string.memcpy(&self._pvt_ptr[0].updateData, updateData.getPtr(), sizeof(self._pvt_ptr[0].updateData)) + cdef class cudaLaunchMemSyncDomainMap_st: """ Memory Synchronization Domain map See cudaLaunchMemSyncDomain. By default, kernels are launched in domain 0. Kernel launched with cudaLaunchMemSyncDomainRemote will have a different domain ID. User - may also alter the domain ID with ::cudaLaunchMemSyncDomainMap for - a specific stream / graph node / kernel launch. See + may also alter the domain ID with cudaLaunchMemSyncDomainMap for a + specific stream / graph node / kernel launch. See cudaLaunchAttributeMemSyncDomainMap. Domain ID range is available through cudaDevAttrMemSyncDomainCount. Attributes ---------- + default_ : bytes The default domain ID to use for designated kernels + + remote : bytes The remote domain ID to use for designated kernels + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): pass def __dealloc__(self): pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: str_list += ['default_ : ' + str(self.default_)] except ValueError: str_list += ['default_ : '] + + try: str_list += ['remote : ' + str(self.remote)] except ValueError: str_list += ['remote : '] + return '\n'.join(str_list) else: return '' + @property def default_(self): - return self._ptr[0].default_ + return self._pvt_ptr[0].default_ @default_.setter def default_(self, unsigned char default_): - self._ptr[0].default_ = default_ + self._pvt_ptr[0].default_ = default_ + + @property def remote(self): - return self._ptr[0].remote + return self._pvt_ptr[0].remote @remote.setter def remote(self, unsigned char remote): - self._ptr[0].remote = remote -{{endif}} -{{if 'union cudaLaunchAttributeValue' in found_types}} + self._pvt_ptr[0].remote = remote -cdef class anon_struct20: + +cdef class anon_struct17: """ Attributes ---------- + x : unsigned int + + y : unsigned int + + z : unsigned int + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): pass def __dealloc__(self): pass def getPtr(self): - return &self._ptr[0].clusterDim + return &self._pvt_ptr[0].clusterDim def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: str_list += ['x : ' + str(self.x)] except ValueError: str_list += ['x : '] + + try: str_list += ['y : ' + str(self.y)] except ValueError: str_list += ['y : '] + + try: str_list += ['z : ' + str(self.z)] except ValueError: str_list += ['z : '] + return '\n'.join(str_list) else: return '' + @property def x(self): - return self._ptr[0].clusterDim.x + return self._pvt_ptr[0].clusterDim.x @x.setter def x(self, unsigned int x): - self._ptr[0].clusterDim.x = x + self._pvt_ptr[0].clusterDim.x = x + + @property def y(self): - return self._ptr[0].clusterDim.y + return self._pvt_ptr[0].clusterDim.y @y.setter def y(self, unsigned int y): - self._ptr[0].clusterDim.y = y + self._pvt_ptr[0].clusterDim.y = y + + @property def z(self): - return self._ptr[0].clusterDim.z + return self._pvt_ptr[0].clusterDim.z @z.setter def z(self, unsigned int z): - self._ptr[0].clusterDim.z = z -{{endif}} -{{if 'union cudaLaunchAttributeValue' in found_types}} + self._pvt_ptr[0].clusterDim.z = z -cdef class anon_struct21: + +cdef class anon_struct18: """ Attributes ---------- + event : cudaEvent_t + + flags : int + + triggerAtBlockStart : int + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - self._event = cudaEvent_t(_ptr=&self._ptr[0].programmaticEvent.event) + pass + + self._event = cudaEvent_t(_ptr=&self._pvt_ptr[0].programmaticEvent.event) + def __dealloc__(self): pass def getPtr(self): - return &self._ptr[0].programmaticEvent + return &self._pvt_ptr[0].programmaticEvent def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: str_list += ['event : ' + str(self.event)] except ValueError: str_list += ['event : '] + + try: str_list += ['flags : ' + str(self.flags)] except ValueError: str_list += ['flags : '] + + try: str_list += ['triggerAtBlockStart : ' + str(self.triggerAtBlockStart)] except ValueError: str_list += ['triggerAtBlockStart : '] + return '\n'.join(str_list) else: return '' + @property def event(self): return self._event @event.setter def event(self, event): - cdef ccudart.cudaEvent_t cevent + cdef cyruntime.cudaEvent_t cyevent if event is None: - cevent = 0 - elif isinstance(event, (cudaEvent_t,cuda.CUevent)): + cyevent = 0 + elif isinstance(event, (cudaEvent_t,driver.CUevent)): pevent = int(event) - cevent = pevent + cyevent = pevent else: pevent = int(cudaEvent_t(event)) - cevent = pevent - self._event._ptr[0] = cevent + cyevent = pevent + self._event._pvt_ptr[0] = cyevent + + @property def flags(self): - return self._ptr[0].programmaticEvent.flags + return self._pvt_ptr[0].programmaticEvent.flags @flags.setter def flags(self, int flags): - self._ptr[0].programmaticEvent.flags = flags + self._pvt_ptr[0].programmaticEvent.flags = flags + + @property def triggerAtBlockStart(self): - return self._ptr[0].programmaticEvent.triggerAtBlockStart + return self._pvt_ptr[0].programmaticEvent.triggerAtBlockStart @triggerAtBlockStart.setter def triggerAtBlockStart(self, int triggerAtBlockStart): - self._ptr[0].programmaticEvent.triggerAtBlockStart = triggerAtBlockStart -{{endif}} -{{if 'union cudaLaunchAttributeValue' in found_types}} + self._pvt_ptr[0].programmaticEvent.triggerAtBlockStart = triggerAtBlockStart -cdef class anon_struct22: + +cdef class anon_struct19: + """ + Attributes + ---------- + + x : unsigned int + + + + y : unsigned int + + + + z : unsigned int + + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr): + self._pvt_ptr = _ptr + + def __init__(self, void_ptr _ptr): + pass + def __dealloc__(self): + pass + def getPtr(self): + return &self._pvt_ptr[0].preferredClusterDim + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['x : ' + str(self.x)] + except ValueError: + str_list += ['x : '] + + + try: + str_list += ['y : ' + str(self.y)] + except ValueError: + str_list += ['y : '] + + + try: + str_list += ['z : ' + str(self.z)] + except ValueError: + str_list += ['z : '] + + return '\n'.join(str_list) + else: + return '' + + @property + def x(self): + return self._pvt_ptr[0].preferredClusterDim.x + @x.setter + def x(self, unsigned int x): + self._pvt_ptr[0].preferredClusterDim.x = x + + + @property + def y(self): + return self._pvt_ptr[0].preferredClusterDim.y + @y.setter + def y(self, unsigned int y): + self._pvt_ptr[0].preferredClusterDim.y = y + + + @property + def z(self): + return self._pvt_ptr[0].preferredClusterDim.z + @z.setter + def z(self, unsigned int z): + self._pvt_ptr[0].preferredClusterDim.z = z + + +cdef class anon_struct20: """ Attributes ---------- + event : cudaEvent_t + + flags : int + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - self._event = cudaEvent_t(_ptr=&self._ptr[0].launchCompletionEvent.event) + pass + + self._event = cudaEvent_t(_ptr=&self._pvt_ptr[0].launchCompletionEvent.event) + def __dealloc__(self): pass def getPtr(self): - return &self._ptr[0].launchCompletionEvent + return &self._pvt_ptr[0].launchCompletionEvent def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: str_list += ['event : ' + str(self.event)] except ValueError: str_list += ['event : '] + + try: str_list += ['flags : ' + str(self.flags)] except ValueError: str_list += ['flags : '] + return '\n'.join(str_list) else: return '' + @property def event(self): return self._event @event.setter def event(self, event): - cdef ccudart.cudaEvent_t cevent + cdef cyruntime.cudaEvent_t cyevent if event is None: - cevent = 0 - elif isinstance(event, (cudaEvent_t,cuda.CUevent)): + cyevent = 0 + elif isinstance(event, (cudaEvent_t,driver.CUevent)): pevent = int(event) - cevent = pevent + cyevent = pevent else: pevent = int(cudaEvent_t(event)) - cevent = pevent - self._event._ptr[0] = cevent + cyevent = pevent + self._event._pvt_ptr[0] = cyevent + + @property def flags(self): - return self._ptr[0].launchCompletionEvent.flags + return self._pvt_ptr[0].launchCompletionEvent.flags @flags.setter def flags(self, int flags): - self._ptr[0].launchCompletionEvent.flags = flags -{{endif}} -{{if 'union cudaLaunchAttributeValue' in found_types}} + self._pvt_ptr[0].launchCompletionEvent.flags = flags + -cdef class anon_struct23: +cdef class anon_struct21: """ Attributes ---------- + deviceUpdatable : int + + devNode : cudaGraphDeviceNode_t + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - self._devNode = cudaGraphDeviceNode_t(_ptr=&self._ptr[0].deviceUpdatableKernelNode.devNode) + pass + + self._devNode = cudaGraphDeviceNode_t(_ptr=&self._pvt_ptr[0].deviceUpdatableKernelNode.devNode) + def __dealloc__(self): pass def getPtr(self): - return &self._ptr[0].deviceUpdatableKernelNode + return &self._pvt_ptr[0].deviceUpdatableKernelNode def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: str_list += ['deviceUpdatable : ' + str(self.deviceUpdatable)] except ValueError: str_list += ['deviceUpdatable : '] + + try: str_list += ['devNode : ' + str(self.devNode)] except ValueError: str_list += ['devNode : '] + return '\n'.join(str_list) else: return '' + @property def deviceUpdatable(self): - return self._ptr[0].deviceUpdatableKernelNode.deviceUpdatable + return self._pvt_ptr[0].deviceUpdatableKernelNode.deviceUpdatable @deviceUpdatable.setter def deviceUpdatable(self, int deviceUpdatable): - self._ptr[0].deviceUpdatableKernelNode.deviceUpdatable = deviceUpdatable + self._pvt_ptr[0].deviceUpdatableKernelNode.deviceUpdatable = deviceUpdatable + + @property def devNode(self): return self._devNode @devNode.setter def devNode(self, devNode): - cdef ccudart.cudaGraphDeviceNode_t cdevNode + cdef cyruntime.cudaGraphDeviceNode_t cydevNode if devNode is None: - cdevNode = 0 + cydevNode = 0 elif isinstance(devNode, (cudaGraphDeviceNode_t,)): pdevNode = int(devNode) - cdevNode = pdevNode + cydevNode = pdevNode else: pdevNode = int(cudaGraphDeviceNode_t(devNode)) - cdevNode = pdevNode - self._devNode._ptr[0] = cdevNode -{{endif}} -{{if 'union cudaLaunchAttributeValue' in found_types}} + cydevNode = pdevNode + self._devNode._pvt_ptr[0] = cydevNode + cdef class cudaLaunchAttributeValue: """ - Launch attributes union; used as value field of - ::cudaLaunchAttribute + Launch attributes union; used as value field of cudaLaunchAttribute Attributes ---------- + pad : bytes + + accessPolicyWindow : cudaAccessPolicyWindow Value of launch attribute cudaLaunchAttributeAccessPolicyWindow. + + cooperative : int Value of launch attribute cudaLaunchAttributeCooperative. Nonzero indicates a cooperative kernel (see cudaLaunchCooperativeKernel). + + syncPolicy : cudaSynchronizationPolicy Value of launch attribute cudaLaunchAttributeSynchronizationPolicy. - ::cudaSynchronizationPolicy for work queued up in this stream. - clusterDim : anon_struct20 + cudaSynchronizationPolicy for work queued up in this stream. + + + clusterDim : anon_struct17 Value of launch attribute cudaLaunchAttributeClusterDimension that represents the desired cluster dimensions for the kernel. Opaque type with the following fields: - `x` - The X dimension of the @@ -12459,120 +19123,250 @@ cdef class cudaLaunchAttributeValue: `y` - The Y dimension of the cluster, in blocks. Must be a divisor of the grid Y dimension. - `z` - The Z dimension of the cluster, in blocks. Must be a divisor of the grid Z dimension. + + clusterSchedulingPolicyPreference : cudaClusterSchedulingPolicy Value of launch attribute cudaLaunchAttributeClusterSchedulingPolicyPreference. Cluster scheduling policy preference for the kernel. + + programmaticStreamSerializationAllowed : int Value of launch attribute cudaLaunchAttributeProgrammaticStreamSerialization. - programmaticEvent : anon_struct21 - Value of launch attribute cudaLaunchAttributeProgrammaticEvent. + + + programmaticEvent : anon_struct18 + Value of launch attribute cudaLaunchAttributeProgrammaticEvent with + the following fields: - `cudaEvent_t` event - Event to fire when + all blocks trigger it. - `int` flags; - Event record flags, see + cudaEventRecordWithFlags. Does not accept cudaEventRecordExternal. + - `int` triggerAtBlockStart - If this is set to non-0, each block + launch will automatically trigger the event. + + priority : int Value of launch attribute cudaLaunchAttributePriority. Execution priority of the kernel. + + memSyncDomainMap : cudaLaunchMemSyncDomainMap Value of launch attribute cudaLaunchAttributeMemSyncDomainMap. See - ::cudaLaunchMemSyncDomainMap. + cudaLaunchMemSyncDomainMap. + + memSyncDomain : cudaLaunchMemSyncDomain Value of launch attribute cudaLaunchAttributeMemSyncDomain. See cudaLaunchMemSyncDomain. - launchCompletionEvent : anon_struct22 - Value of launch attribute cudaLaunchAttributeLaunchCompletionEvent. - deviceUpdatableKernelNode : anon_struct23 + + + preferredClusterDim : anon_struct19 Value of launch attribute - cudaLaunchAttributeDeviceUpdatableKernelNode. + cudaLaunchAttributePreferredClusterDimension that represents the + desired preferred cluster dimensions for the kernel. Opaque type + with the following fields: - `x` - The X dimension of the preferred + cluster, in blocks. Must be a divisor of the grid X dimension, and + must be a multiple of the `x` field of + ::cudaLaunchAttributeValue::clusterDim. - `y` - The Y dimension + of the preferred cluster, in blocks. Must be a divisor of the grid + Y dimension, and must be a multiple of the `y` field of + ::cudaLaunchAttributeValue::clusterDim. - `z` - The Z dimension + of the preferred cluster, in blocks. Must be equal to the `z` field + of ::cudaLaunchAttributeValue::clusterDim. + + + launchCompletionEvent : anon_struct20 + Value of launch attribute cudaLaunchAttributeLaunchCompletionEvent + with the following fields: - `cudaEvent_t` event - Event to fire + when the last block launches. - `int` flags - Event record + flags, see cudaEventRecordWithFlags. Does not accept + cudaEventRecordExternal. + + + deviceUpdatableKernelNode : anon_struct21 + Value of launch attribute + cudaLaunchAttributeDeviceUpdatableKernelNode with the following + fields: - `int` deviceUpdatable - Whether or not the resulting + kernel node should be device-updatable. - + `cudaGraphDeviceNode_t` devNode - Returns a handle to pass to the + various device-side update functions. + + sharedMemCarveout : unsigned int Value of launch attribute cudaLaunchAttributePreferredSharedMemoryCarveout. + + nvlinkUtilCentricScheduling : unsigned int + Value of launch attribute + cudaLaunchAttributeNvlinkUtilCentricScheduling. + + + portableClusterSizeMode : cudaLaunchAttributePortableClusterMode + Value of launch attribute + cudaLaunchAttributePortableClusterSizeMode + + + sharedMemoryMode : cudaSharedMemoryMode + Value of launch attribute cudaLaunchAttributeSharedMemoryMode. See + cudaSharedMemoryMode for acceptable values. + + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - self._accessPolicyWindow = cudaAccessPolicyWindow(_ptr=&self._ptr[0].accessPolicyWindow) - self._clusterDim = anon_struct20(_ptr=self._ptr) - self._programmaticEvent = anon_struct21(_ptr=self._ptr) - self._memSyncDomainMap = cudaLaunchMemSyncDomainMap(_ptr=&self._ptr[0].memSyncDomainMap) - self._launchCompletionEvent = anon_struct22(_ptr=self._ptr) - self._deviceUpdatableKernelNode = anon_struct23(_ptr=self._ptr) + pass + + self._accessPolicyWindow = cudaAccessPolicyWindow(_ptr=&self._pvt_ptr[0].accessPolicyWindow) + + + self._clusterDim = anon_struct17(_ptr=self._pvt_ptr) + + + self._programmaticEvent = anon_struct18(_ptr=self._pvt_ptr) + + + self._memSyncDomainMap = cudaLaunchMemSyncDomainMap(_ptr=&self._pvt_ptr[0].memSyncDomainMap) + + + self._preferredClusterDim = anon_struct19(_ptr=self._pvt_ptr) + + + self._launchCompletionEvent = anon_struct20(_ptr=self._pvt_ptr) + + + self._deviceUpdatableKernelNode = anon_struct21(_ptr=self._pvt_ptr) + def __dealloc__(self): pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: str_list += ['pad : ' + str(self.pad)] except ValueError: str_list += ['pad : '] + + try: str_list += ['accessPolicyWindow :\n' + '\n'.join([' ' + line for line in str(self.accessPolicyWindow).splitlines()])] except ValueError: str_list += ['accessPolicyWindow : '] + + try: str_list += ['cooperative : ' + str(self.cooperative)] except ValueError: str_list += ['cooperative : '] + + try: str_list += ['syncPolicy : ' + str(self.syncPolicy)] except ValueError: str_list += ['syncPolicy : '] + + try: str_list += ['clusterDim :\n' + '\n'.join([' ' + line for line in str(self.clusterDim).splitlines()])] except ValueError: str_list += ['clusterDim : '] + + try: str_list += ['clusterSchedulingPolicyPreference : ' + str(self.clusterSchedulingPolicyPreference)] except ValueError: str_list += ['clusterSchedulingPolicyPreference : '] + + try: str_list += ['programmaticStreamSerializationAllowed : ' + str(self.programmaticStreamSerializationAllowed)] except ValueError: str_list += ['programmaticStreamSerializationAllowed : '] + + try: str_list += ['programmaticEvent :\n' + '\n'.join([' ' + line for line in str(self.programmaticEvent).splitlines()])] except ValueError: str_list += ['programmaticEvent : '] + + try: str_list += ['priority : ' + str(self.priority)] except ValueError: str_list += ['priority : '] + + try: str_list += ['memSyncDomainMap :\n' + '\n'.join([' ' + line for line in str(self.memSyncDomainMap).splitlines()])] except ValueError: str_list += ['memSyncDomainMap : '] + + try: str_list += ['memSyncDomain : ' + str(self.memSyncDomain)] except ValueError: str_list += ['memSyncDomain : '] + + + try: + str_list += ['preferredClusterDim :\n' + '\n'.join([' ' + line for line in str(self.preferredClusterDim).splitlines()])] + except ValueError: + str_list += ['preferredClusterDim : '] + + try: str_list += ['launchCompletionEvent :\n' + '\n'.join([' ' + line for line in str(self.launchCompletionEvent).splitlines()])] except ValueError: str_list += ['launchCompletionEvent : '] + + try: str_list += ['deviceUpdatableKernelNode :\n' + '\n'.join([' ' + line for line in str(self.deviceUpdatableKernelNode).splitlines()])] except ValueError: str_list += ['deviceUpdatableKernelNode : '] + + try: str_list += ['sharedMemCarveout : ' + str(self.sharedMemCarveout)] except ValueError: str_list += ['sharedMemCarveout : '] + + + try: + str_list += ['nvlinkUtilCentricScheduling : ' + str(self.nvlinkUtilCentricScheduling)] + except ValueError: + str_list += ['nvlinkUtilCentricScheduling : '] + + + try: + str_list += ['portableClusterSizeMode : ' + str(self.portableClusterSizeMode)] + except ValueError: + str_list += ['portableClusterSizeMode : '] + + + try: + str_list += ['sharedMemoryMode : ' + str(self.sharedMemoryMode)] + except ValueError: + str_list += ['sharedMemoryMode : '] + return '\n'.join(str_list) else: return '' + @property def pad(self): - return PyBytes_FromStringAndSize(self._ptr[0].pad, 64) + return PyBytes_FromStringAndSize(self._pvt_ptr[0].pad, 64) @pad.setter def pad(self, pad): if len(pad) != 64: @@ -12581,92 +19375,149 @@ cdef class cudaLaunchAttributeValue: for i, b in enumerate(pad): if b < 0 and b > -129: b = b + 256 - self._ptr[0].pad[i] = b + self._pvt_ptr[0].pad[i] = b else: for i, b in enumerate(pad): if b > 127 and b < 256: b = b - 256 - self._ptr[0].pad[i] = b + self._pvt_ptr[0].pad[i] = b + + @property def accessPolicyWindow(self): return self._accessPolicyWindow @accessPolicyWindow.setter def accessPolicyWindow(self, accessPolicyWindow not None : cudaAccessPolicyWindow): - string.memcpy(&self._ptr[0].accessPolicyWindow, accessPolicyWindow.getPtr(), sizeof(self._ptr[0].accessPolicyWindow)) + string.memcpy(&self._pvt_ptr[0].accessPolicyWindow, accessPolicyWindow.getPtr(), sizeof(self._pvt_ptr[0].accessPolicyWindow)) + + @property def cooperative(self): - return self._ptr[0].cooperative + return self._pvt_ptr[0].cooperative @cooperative.setter def cooperative(self, int cooperative): - self._ptr[0].cooperative = cooperative + self._pvt_ptr[0].cooperative = cooperative + + @property def syncPolicy(self): - return cudaSynchronizationPolicy(self._ptr[0].syncPolicy) + return cudaSynchronizationPolicy(self._pvt_ptr[0].syncPolicy) @syncPolicy.setter def syncPolicy(self, syncPolicy not None : cudaSynchronizationPolicy): - self._ptr[0].syncPolicy = syncPolicy.value + self._pvt_ptr[0].syncPolicy = int(syncPolicy) + + @property def clusterDim(self): return self._clusterDim @clusterDim.setter - def clusterDim(self, clusterDim not None : anon_struct20): - string.memcpy(&self._ptr[0].clusterDim, clusterDim.getPtr(), sizeof(self._ptr[0].clusterDim)) + def clusterDim(self, clusterDim not None : anon_struct17): + string.memcpy(&self._pvt_ptr[0].clusterDim, clusterDim.getPtr(), sizeof(self._pvt_ptr[0].clusterDim)) + + @property def clusterSchedulingPolicyPreference(self): - return cudaClusterSchedulingPolicy(self._ptr[0].clusterSchedulingPolicyPreference) + return cudaClusterSchedulingPolicy(self._pvt_ptr[0].clusterSchedulingPolicyPreference) @clusterSchedulingPolicyPreference.setter def clusterSchedulingPolicyPreference(self, clusterSchedulingPolicyPreference not None : cudaClusterSchedulingPolicy): - self._ptr[0].clusterSchedulingPolicyPreference = clusterSchedulingPolicyPreference.value + self._pvt_ptr[0].clusterSchedulingPolicyPreference = int(clusterSchedulingPolicyPreference) + + @property def programmaticStreamSerializationAllowed(self): - return self._ptr[0].programmaticStreamSerializationAllowed + return self._pvt_ptr[0].programmaticStreamSerializationAllowed @programmaticStreamSerializationAllowed.setter def programmaticStreamSerializationAllowed(self, int programmaticStreamSerializationAllowed): - self._ptr[0].programmaticStreamSerializationAllowed = programmaticStreamSerializationAllowed + self._pvt_ptr[0].programmaticStreamSerializationAllowed = programmaticStreamSerializationAllowed + + @property def programmaticEvent(self): return self._programmaticEvent @programmaticEvent.setter - def programmaticEvent(self, programmaticEvent not None : anon_struct21): - string.memcpy(&self._ptr[0].programmaticEvent, programmaticEvent.getPtr(), sizeof(self._ptr[0].programmaticEvent)) + def programmaticEvent(self, programmaticEvent not None : anon_struct18): + string.memcpy(&self._pvt_ptr[0].programmaticEvent, programmaticEvent.getPtr(), sizeof(self._pvt_ptr[0].programmaticEvent)) + + @property def priority(self): - return self._ptr[0].priority + return self._pvt_ptr[0].priority @priority.setter def priority(self, int priority): - self._ptr[0].priority = priority + self._pvt_ptr[0].priority = priority + + @property def memSyncDomainMap(self): return self._memSyncDomainMap @memSyncDomainMap.setter def memSyncDomainMap(self, memSyncDomainMap not None : cudaLaunchMemSyncDomainMap): - string.memcpy(&self._ptr[0].memSyncDomainMap, memSyncDomainMap.getPtr(), sizeof(self._ptr[0].memSyncDomainMap)) + string.memcpy(&self._pvt_ptr[0].memSyncDomainMap, memSyncDomainMap.getPtr(), sizeof(self._pvt_ptr[0].memSyncDomainMap)) + + @property def memSyncDomain(self): - return cudaLaunchMemSyncDomain(self._ptr[0].memSyncDomain) + return cudaLaunchMemSyncDomain(self._pvt_ptr[0].memSyncDomain) @memSyncDomain.setter def memSyncDomain(self, memSyncDomain not None : cudaLaunchMemSyncDomain): - self._ptr[0].memSyncDomain = memSyncDomain.value + self._pvt_ptr[0].memSyncDomain = int(memSyncDomain) + + + @property + def preferredClusterDim(self): + return self._preferredClusterDim + @preferredClusterDim.setter + def preferredClusterDim(self, preferredClusterDim not None : anon_struct19): + string.memcpy(&self._pvt_ptr[0].preferredClusterDim, preferredClusterDim.getPtr(), sizeof(self._pvt_ptr[0].preferredClusterDim)) + + @property def launchCompletionEvent(self): return self._launchCompletionEvent @launchCompletionEvent.setter - def launchCompletionEvent(self, launchCompletionEvent not None : anon_struct22): - string.memcpy(&self._ptr[0].launchCompletionEvent, launchCompletionEvent.getPtr(), sizeof(self._ptr[0].launchCompletionEvent)) + def launchCompletionEvent(self, launchCompletionEvent not None : anon_struct20): + string.memcpy(&self._pvt_ptr[0].launchCompletionEvent, launchCompletionEvent.getPtr(), sizeof(self._pvt_ptr[0].launchCompletionEvent)) + + @property def deviceUpdatableKernelNode(self): return self._deviceUpdatableKernelNode @deviceUpdatableKernelNode.setter - def deviceUpdatableKernelNode(self, deviceUpdatableKernelNode not None : anon_struct23): - string.memcpy(&self._ptr[0].deviceUpdatableKernelNode, deviceUpdatableKernelNode.getPtr(), sizeof(self._ptr[0].deviceUpdatableKernelNode)) + def deviceUpdatableKernelNode(self, deviceUpdatableKernelNode not None : anon_struct21): + string.memcpy(&self._pvt_ptr[0].deviceUpdatableKernelNode, deviceUpdatableKernelNode.getPtr(), sizeof(self._pvt_ptr[0].deviceUpdatableKernelNode)) + + @property def sharedMemCarveout(self): - return self._ptr[0].sharedMemCarveout + return self._pvt_ptr[0].sharedMemCarveout @sharedMemCarveout.setter def sharedMemCarveout(self, unsigned int sharedMemCarveout): - self._ptr[0].sharedMemCarveout = sharedMemCarveout -{{endif}} -{{if 'struct cudaLaunchAttribute_st' in found_types}} + self._pvt_ptr[0].sharedMemCarveout = sharedMemCarveout + + + @property + def nvlinkUtilCentricScheduling(self): + return self._pvt_ptr[0].nvlinkUtilCentricScheduling + @nvlinkUtilCentricScheduling.setter + def nvlinkUtilCentricScheduling(self, unsigned int nvlinkUtilCentricScheduling): + self._pvt_ptr[0].nvlinkUtilCentricScheduling = nvlinkUtilCentricScheduling + + + @property + def portableClusterSizeMode(self): + return cudaLaunchAttributePortableClusterMode(self._pvt_ptr[0].portableClusterSizeMode) + @portableClusterSizeMode.setter + def portableClusterSizeMode(self, portableClusterSizeMode not None : cudaLaunchAttributePortableClusterMode): + self._pvt_ptr[0].portableClusterSizeMode = int(portableClusterSizeMode) + + + @property + def sharedMemoryMode(self): + return cudaSharedMemoryMode(self._pvt_ptr[0].sharedMemoryMode) + @sharedMemoryMode.setter + def sharedMemoryMode(self, sharedMemoryMode not None : cudaSharedMemoryMode): + self._pvt_ptr[0].sharedMemoryMode = int(sharedMemoryMode) + cdef class cudaLaunchAttribute_st: """ @@ -12674,138 +19525,159 @@ cdef class cudaLaunchAttribute_st: Attributes ---------- + id : cudaLaunchAttributeID Attribute to set + + val : cudaLaunchAttributeValue Value of the attribute + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - self._val = cudaLaunchAttributeValue(_ptr=&self._ptr[0].val) + pass + + self._val = cudaLaunchAttributeValue(_ptr=&self._pvt_ptr[0].val) + def __dealloc__(self): pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: str_list += ['id : ' + str(self.id)] except ValueError: str_list += ['id : '] + + try: str_list += ['val :\n' + '\n'.join([' ' + line for line in str(self.val).splitlines()])] except ValueError: str_list += ['val : '] + return '\n'.join(str_list) else: return '' + @property def id(self): - return cudaLaunchAttributeID(self._ptr[0].id) + return cudaLaunchAttributeID(self._pvt_ptr[0].id) @id.setter def id(self, id not None : cudaLaunchAttributeID): - self._ptr[0].id = id.value + self._pvt_ptr[0].id = int(id) + + @property def val(self): return self._val @val.setter def val(self, val not None : cudaLaunchAttributeValue): - string.memcpy(&self._ptr[0].val, val.getPtr(), sizeof(self._ptr[0].val)) -{{endif}} -{{if 'struct cudaAsyncNotificationInfo' in found_types}} + string.memcpy(&self._pvt_ptr[0].val, val.getPtr(), sizeof(self._pvt_ptr[0].val)) + -cdef class anon_struct24: +cdef class anon_struct22: """ Attributes ---------- + bytesOverBudget : unsigned long long + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): pass def __dealloc__(self): pass def getPtr(self): - return &self._ptr[0].info.overBudget + return &self._pvt_ptr[0].info.overBudget def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: str_list += ['bytesOverBudget : ' + str(self.bytesOverBudget)] except ValueError: str_list += ['bytesOverBudget : '] + return '\n'.join(str_list) else: return '' + @property def bytesOverBudget(self): - return self._ptr[0].info.overBudget.bytesOverBudget + return self._pvt_ptr[0].info.overBudget.bytesOverBudget @bytesOverBudget.setter def bytesOverBudget(self, unsigned long long bytesOverBudget): - self._ptr[0].info.overBudget.bytesOverBudget = bytesOverBudget -{{endif}} -{{if 'struct cudaAsyncNotificationInfo' in found_types}} + self._pvt_ptr[0].info.overBudget.bytesOverBudget = bytesOverBudget + -cdef class anon_union9: +cdef class anon_union11: """ Attributes ---------- - overBudget : anon_struct24 + + overBudget : anon_struct22 + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - self._overBudget = anon_struct24(_ptr=self._ptr) + pass + + self._overBudget = anon_struct22(_ptr=self._pvt_ptr) + def __dealloc__(self): pass def getPtr(self): - return &self._ptr[0].info + return &self._pvt_ptr[0].info def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: str_list += ['overBudget :\n' + '\n'.join([' ' + line for line in str(self.overBudget).splitlines()])] except ValueError: str_list += ['overBudget : '] + return '\n'.join(str_list) else: return '' + @property def overBudget(self): return self._overBudget @overBudget.setter - def overBudget(self, overBudget not None : anon_struct24): - string.memcpy(&self._ptr[0].info.overBudget, overBudget.getPtr(), sizeof(self._ptr[0].info.overBudget)) -{{endif}} -{{if 'struct cudaAsyncNotificationInfo' in found_types}} + def overBudget(self, overBudget not None : anon_struct22): + string.memcpy(&self._pvt_ptr[0].info.overBudget, overBudget.getPtr(), sizeof(self._pvt_ptr[0].info.overBudget)) + cdef class cudaAsyncNotificationInfo: """ @@ -12813,58 +19685,71 @@ cdef class cudaAsyncNotificationInfo: Attributes ---------- + type : cudaAsyncNotificationType + The type of notification being sent + - info : anon_union9 + info : anon_union11 + Information about the notification. `typename` must be checked in + order to interpret this field. Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._val_ptr = calloc(1, sizeof(ccudart.cudaAsyncNotificationInfo)) - self._ptr = self._val_ptr + self._val_ptr = calloc(1, sizeof(cyruntime.cudaAsyncNotificationInfo)) + self._pvt_ptr = self._val_ptr else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - self._info = anon_union9(_ptr=self._ptr) + pass + + self._info = anon_union11(_ptr=self._pvt_ptr) + def __dealloc__(self): if self._val_ptr is not NULL: free(self._val_ptr) def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: str_list += ['type : ' + str(self.type)] except ValueError: str_list += ['type : '] + + try: str_list += ['info :\n' + '\n'.join([' ' + line for line in str(self.info).splitlines()])] except ValueError: str_list += ['info : '] + return '\n'.join(str_list) else: return '' + @property def type(self): - return cudaAsyncNotificationType(self._ptr[0].type) + return cudaAsyncNotificationType(self._pvt_ptr[0].type) @type.setter def type(self, type not None : cudaAsyncNotificationType): - self._ptr[0].type = type.value + self._pvt_ptr[0].type = int(type) + + @property def info(self): return self._info @info.setter - def info(self, info not None : anon_union9): - string.memcpy(&self._ptr[0].info, info.getPtr(), sizeof(self._ptr[0].info)) -{{endif}} -{{if 'struct cudaTextureDesc' in found_types}} + def info(self, info not None : anon_union11): + string.memcpy(&self._pvt_ptr[0].info, info.getPtr(), sizeof(self._pvt_ptr[0].info)) + cdef class cudaTextureDesc: """ @@ -12872,188 +19757,343 @@ cdef class cudaTextureDesc: Attributes ---------- - addressMode : List[cudaTextureAddressMode] + + addressMode : list[cudaTextureAddressMode] Texture address mode for up to 3 dimensions + + filterMode : cudaTextureFilterMode Texture filter mode + + readMode : cudaTextureReadMode Texture read mode + + sRGB : int Perform sRGB->linear conversion during texture read - borderColor : List[float] + + + borderColor : list[float] Texture Border Color + + normalizedCoords : int Indicates whether texture reads are normalized or not + + maxAnisotropy : unsigned int Limit to the anisotropy ratio + + mipmapFilterMode : cudaTextureFilterMode Mipmap filter mode + + mipmapLevelBias : float Offset applied to the supplied mipmap level + + minMipmapLevelClamp : float Lower end of the mipmap level range to clamp access to + + maxMipmapLevelClamp : float Upper end of the mipmap level range to clamp access to + + disableTrilinearOptimization : int Disable any trilinear filtering optimizations. + + seamlessCubemap : int Enable seamless cube map filtering. + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): pass def __dealloc__(self): pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: str_list += ['addressMode : ' + str(self.addressMode)] except ValueError: str_list += ['addressMode : '] + + try: str_list += ['filterMode : ' + str(self.filterMode)] except ValueError: str_list += ['filterMode : '] + + try: str_list += ['readMode : ' + str(self.readMode)] except ValueError: str_list += ['readMode : '] + + try: str_list += ['sRGB : ' + str(self.sRGB)] except ValueError: str_list += ['sRGB : '] + + try: str_list += ['borderColor : ' + str(self.borderColor)] except ValueError: str_list += ['borderColor : '] + + try: str_list += ['normalizedCoords : ' + str(self.normalizedCoords)] except ValueError: str_list += ['normalizedCoords : '] + + try: str_list += ['maxAnisotropy : ' + str(self.maxAnisotropy)] except ValueError: str_list += ['maxAnisotropy : '] + + try: str_list += ['mipmapFilterMode : ' + str(self.mipmapFilterMode)] except ValueError: str_list += ['mipmapFilterMode : '] + + try: str_list += ['mipmapLevelBias : ' + str(self.mipmapLevelBias)] except ValueError: str_list += ['mipmapLevelBias : '] + + try: str_list += ['minMipmapLevelClamp : ' + str(self.minMipmapLevelClamp)] except ValueError: str_list += ['minMipmapLevelClamp : '] + + try: str_list += ['maxMipmapLevelClamp : ' + str(self.maxMipmapLevelClamp)] except ValueError: str_list += ['maxMipmapLevelClamp : '] + + try: str_list += ['disableTrilinearOptimization : ' + str(self.disableTrilinearOptimization)] except ValueError: str_list += ['disableTrilinearOptimization : '] + + try: str_list += ['seamlessCubemap : ' + str(self.seamlessCubemap)] except ValueError: str_list += ['seamlessCubemap : '] + return '\n'.join(str_list) else: return '' + @property def addressMode(self): - return [cudaTextureAddressMode(_x) for _x in list(self._ptr[0].addressMode)] + return [cudaTextureAddressMode(_x) for _x in list(self._pvt_ptr[0].addressMode)] @addressMode.setter def addressMode(self, addressMode): - self._ptr[0].addressMode = [_x.value for _x in addressMode] + self._pvt_ptr[0].addressMode = [int(_x) for _x in addressMode] + + @property def filterMode(self): - return cudaTextureFilterMode(self._ptr[0].filterMode) + return cudaTextureFilterMode(self._pvt_ptr[0].filterMode) @filterMode.setter def filterMode(self, filterMode not None : cudaTextureFilterMode): - self._ptr[0].filterMode = filterMode.value + self._pvt_ptr[0].filterMode = int(filterMode) + + @property def readMode(self): - return cudaTextureReadMode(self._ptr[0].readMode) + return cudaTextureReadMode(self._pvt_ptr[0].readMode) @readMode.setter def readMode(self, readMode not None : cudaTextureReadMode): - self._ptr[0].readMode = readMode.value + self._pvt_ptr[0].readMode = int(readMode) + + @property def sRGB(self): - return self._ptr[0].sRGB + return self._pvt_ptr[0].sRGB @sRGB.setter def sRGB(self, int sRGB): - self._ptr[0].sRGB = sRGB + self._pvt_ptr[0].sRGB = sRGB + + @property def borderColor(self): - return self._ptr[0].borderColor + return self._pvt_ptr[0].borderColor @borderColor.setter def borderColor(self, borderColor): - self._ptr[0].borderColor = borderColor + self._pvt_ptr[0].borderColor = borderColor + + @property def normalizedCoords(self): - return self._ptr[0].normalizedCoords + return self._pvt_ptr[0].normalizedCoords @normalizedCoords.setter def normalizedCoords(self, int normalizedCoords): - self._ptr[0].normalizedCoords = normalizedCoords + self._pvt_ptr[0].normalizedCoords = normalizedCoords + + @property def maxAnisotropy(self): - return self._ptr[0].maxAnisotropy + return self._pvt_ptr[0].maxAnisotropy @maxAnisotropy.setter def maxAnisotropy(self, unsigned int maxAnisotropy): - self._ptr[0].maxAnisotropy = maxAnisotropy + self._pvt_ptr[0].maxAnisotropy = maxAnisotropy + + @property def mipmapFilterMode(self): - return cudaTextureFilterMode(self._ptr[0].mipmapFilterMode) + return cudaTextureFilterMode(self._pvt_ptr[0].mipmapFilterMode) @mipmapFilterMode.setter def mipmapFilterMode(self, mipmapFilterMode not None : cudaTextureFilterMode): - self._ptr[0].mipmapFilterMode = mipmapFilterMode.value + self._pvt_ptr[0].mipmapFilterMode = int(mipmapFilterMode) + + @property def mipmapLevelBias(self): - return self._ptr[0].mipmapLevelBias + return self._pvt_ptr[0].mipmapLevelBias @mipmapLevelBias.setter def mipmapLevelBias(self, float mipmapLevelBias): - self._ptr[0].mipmapLevelBias = mipmapLevelBias + self._pvt_ptr[0].mipmapLevelBias = mipmapLevelBias + + @property def minMipmapLevelClamp(self): - return self._ptr[0].minMipmapLevelClamp + return self._pvt_ptr[0].minMipmapLevelClamp @minMipmapLevelClamp.setter def minMipmapLevelClamp(self, float minMipmapLevelClamp): - self._ptr[0].minMipmapLevelClamp = minMipmapLevelClamp + self._pvt_ptr[0].minMipmapLevelClamp = minMipmapLevelClamp + + @property def maxMipmapLevelClamp(self): - return self._ptr[0].maxMipmapLevelClamp + return self._pvt_ptr[0].maxMipmapLevelClamp @maxMipmapLevelClamp.setter def maxMipmapLevelClamp(self, float maxMipmapLevelClamp): - self._ptr[0].maxMipmapLevelClamp = maxMipmapLevelClamp + self._pvt_ptr[0].maxMipmapLevelClamp = maxMipmapLevelClamp + + + @property + def disableTrilinearOptimization(self): + return self._pvt_ptr[0].disableTrilinearOptimization + @disableTrilinearOptimization.setter + def disableTrilinearOptimization(self, int disableTrilinearOptimization): + self._pvt_ptr[0].disableTrilinearOptimization = disableTrilinearOptimization + + + @property + def seamlessCubemap(self): + return self._pvt_ptr[0].seamlessCubemap + @seamlessCubemap.setter + def seamlessCubemap(self, int seamlessCubemap): + self._pvt_ptr[0].seamlessCubemap = seamlessCubemap + + +cdef class cudaGraphRecaptureCallbackData: + """ + Struct of user callback data that is invoked when node parameter + mismatches are detected while recapturing to an existing graph + + Attributes + ---------- + + callbackFunc : cudaGraphRecaptureCallback_t + Callback function that will be invoked + + + userData : Any + Generic pointer that is passed to the callback function + + + Methods + ------- + getPtr() + Get memory address of class instance + """ + def __cinit__(self, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + def __init__(self, void_ptr _ptr = 0): + pass + + self._callbackFunc = cudaGraphRecaptureCallback_t(_ptr=&self._pvt_ptr[0].callbackFunc) + + def __dealloc__(self): + pass + def getPtr(self): + return self._pvt_ptr + def __repr__(self): + if self._pvt_ptr is not NULL: + str_list = [] + + try: + str_list += ['callbackFunc : ' + str(self.callbackFunc)] + except ValueError: + str_list += ['callbackFunc : '] + + + try: + str_list += ['userData : ' + hex(self.userData)] + except ValueError: + str_list += ['userData : '] + + return '\n'.join(str_list) + else: + return '' + @property - def disableTrilinearOptimization(self): - return self._ptr[0].disableTrilinearOptimization - @disableTrilinearOptimization.setter - def disableTrilinearOptimization(self, int disableTrilinearOptimization): - self._ptr[0].disableTrilinearOptimization = disableTrilinearOptimization + def callbackFunc(self): + return self._callbackFunc + @callbackFunc.setter + def callbackFunc(self, callbackFunc): + cdef cyruntime.cudaGraphRecaptureCallback_t cycallbackFunc + if callbackFunc is None: + cycallbackFunc = 0 + elif isinstance(callbackFunc, (cudaGraphRecaptureCallback_t)): + pcallbackFunc = int(callbackFunc) + cycallbackFunc = pcallbackFunc + else: + pcallbackFunc = int(cudaGraphRecaptureCallback_t(callbackFunc)) + cycallbackFunc = pcallbackFunc + self._callbackFunc._pvt_ptr[0] = cycallbackFunc + + @property - def seamlessCubemap(self): - return self._ptr[0].seamlessCubemap - @seamlessCubemap.setter - def seamlessCubemap(self, int seamlessCubemap): - self._ptr[0].seamlessCubemap = seamlessCubemap -{{endif}} -{{if True}} + def userData(self): + return self._pvt_ptr[0].userData + @userData.setter + def userData(self, userData): + self._cyuserData = _HelperInputVoidPtr(userData) + self._pvt_ptr[0].userData = self._cyuserData.cptr + cdef class cudaEglPlaneDesc_st: """ @@ -13062,181 +20102,232 @@ cdef class cudaEglPlaneDesc_st: Attributes ---------- + width : unsigned int Width of plane + + height : unsigned int Height of plane + + depth : unsigned int Depth of plane + + pitch : unsigned int Pitch of plane + + numChannels : unsigned int Number of channels for the plane + + channelDesc : cudaChannelFormatDesc Channel Format Descriptor - reserved : List[unsigned int] + + + reserved : list[unsigned int] Reserved for future use + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - self._channelDesc = cudaChannelFormatDesc(_ptr=&self._ptr[0].channelDesc) + pass + + self._channelDesc = cudaChannelFormatDesc(_ptr=&self._pvt_ptr[0].channelDesc) + def __dealloc__(self): pass def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: str_list += ['width : ' + str(self.width)] except ValueError: str_list += ['width : '] + + try: str_list += ['height : ' + str(self.height)] except ValueError: str_list += ['height : '] + + try: str_list += ['depth : ' + str(self.depth)] except ValueError: str_list += ['depth : '] + + try: str_list += ['pitch : ' + str(self.pitch)] except ValueError: str_list += ['pitch : '] + + try: str_list += ['numChannels : ' + str(self.numChannels)] except ValueError: str_list += ['numChannels : '] + + try: str_list += ['channelDesc :\n' + '\n'.join([' ' + line for line in str(self.channelDesc).splitlines()])] except ValueError: str_list += ['channelDesc : '] + + try: str_list += ['reserved : ' + str(self.reserved)] except ValueError: str_list += ['reserved : '] + return '\n'.join(str_list) else: return '' + @property def width(self): - return self._ptr[0].width + return self._pvt_ptr[0].width @width.setter def width(self, unsigned int width): - self._ptr[0].width = width + self._pvt_ptr[0].width = width + + @property def height(self): - return self._ptr[0].height + return self._pvt_ptr[0].height @height.setter def height(self, unsigned int height): - self._ptr[0].height = height + self._pvt_ptr[0].height = height + + @property def depth(self): - return self._ptr[0].depth + return self._pvt_ptr[0].depth @depth.setter def depth(self, unsigned int depth): - self._ptr[0].depth = depth + self._pvt_ptr[0].depth = depth + + @property def pitch(self): - return self._ptr[0].pitch + return self._pvt_ptr[0].pitch @pitch.setter def pitch(self, unsigned int pitch): - self._ptr[0].pitch = pitch + self._pvt_ptr[0].pitch = pitch + + @property def numChannels(self): - return self._ptr[0].numChannels + return self._pvt_ptr[0].numChannels @numChannels.setter def numChannels(self, unsigned int numChannels): - self._ptr[0].numChannels = numChannels + self._pvt_ptr[0].numChannels = numChannels + + @property def channelDesc(self): return self._channelDesc @channelDesc.setter def channelDesc(self, channelDesc not None : cudaChannelFormatDesc): - string.memcpy(&self._ptr[0].channelDesc, channelDesc.getPtr(), sizeof(self._ptr[0].channelDesc)) + string.memcpy(&self._pvt_ptr[0].channelDesc, channelDesc.getPtr(), sizeof(self._pvt_ptr[0].channelDesc)) + + @property def reserved(self): - return self._ptr[0].reserved + return self._pvt_ptr[0].reserved @reserved.setter def reserved(self, reserved): - self._ptr[0].reserved = reserved -{{endif}} -{{if True}} + self._pvt_ptr[0].reserved = reserved -cdef class anon_union10: + +cdef class anon_union12: """ Attributes ---------- - pArray : List[cudaArray_t] - pPitch : List[cudaPitchedPtr] + pArray : list[cudaArray_t] + + + + pPitch : list[cudaPitchedPtr] + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr): - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): pass def __dealloc__(self): pass def getPtr(self): - return &self._ptr[0].frame + return &self._pvt_ptr[0].frame def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: str_list += ['pArray : ' + str(self.pArray)] except ValueError: str_list += ['pArray : '] + + try: str_list += ['pPitch :\n' + '\n'.join([' ' + line for line in str(self.pPitch).splitlines()])] except ValueError: str_list += ['pPitch : '] + return '\n'.join(str_list) else: return '' + @property def pArray(self): - return [cudaArray_t(init_value=_pArray) for _pArray in self._ptr[0].frame.pArray] + return [cudaArray_t(init_value=_pArray) for _pArray in self._pvt_ptr[0].frame.pArray] @pArray.setter - def pArray(self, pArray : List[cudaArray_t]): + def pArray(self, pArray : list[cudaArray_t]): if len(pArray) != 3: raise IndexError('not enough values found during array assignment, expected 3, got', len(pArray)) pArray = [int(_pArray) for _pArray in pArray] for _idx, _pArray in enumerate(pArray): - self._ptr[0].frame.pArray[_idx] = _pArray + self._pvt_ptr[0].frame.pArray[_idx] = _pArray + + @property def pPitch(self): - out_pPitch = [cudaPitchedPtr() for _pPitch in self._ptr[0].frame.pPitch] + out_pPitch = [cudaPitchedPtr() for _pPitch in self._pvt_ptr[0].frame.pPitch] for _idx in range(len(out_pPitch)): - string.memcpy(out_pPitch[_idx].getPtr(), &self._ptr[0].frame.pPitch[_idx], sizeof(ccudart.cudaPitchedPtr)) + string.memcpy(out_pPitch[_idx].getPtr(), &self._pvt_ptr[0].frame.pPitch[_idx], sizeof(cyruntime.cudaPitchedPtr)) return out_pPitch @pPitch.setter - def pPitch(self, pPitch : List[cudaPitchedPtr]): + def pPitch(self, pPitch : list[cudaPitchedPtr]): if len(pPitch) != 3: raise IndexError('not enough values found during array assignment, expected 3, got', len(pPitch)) for _idx in range(len(pPitch)): - string.memcpy(&self._ptr[0].frame.pPitch[_idx], pPitch[_idx].getPtr(), sizeof(ccudart.cudaPitchedPtr)) + string.memcpy(&self._pvt_ptr[0].frame.pPitch[_idx], pPitch[_idx].getPtr(), sizeof(cyruntime.cudaPitchedPtr)) + -{{endif}} -{{if True}} cdef class cudaEglFrame_st: """ @@ -13251,101 +20342,131 @@ cdef class cudaEglFrame_st: Attributes ---------- - frame : anon_union10 - planeDesc : List[cudaEglPlaneDesc] + frame : anon_union12 + + + + planeDesc : list[cudaEglPlaneDesc] CUDA EGL Plane Descriptor cudaEglPlaneDesc + + planeCount : unsigned int Number of planes + + frameType : cudaEglFrameType Array or Pitch + + eglColorFormat : cudaEglColorFormat CUDA EGL Color Format + Methods ------- getPtr() Get memory address of class instance - """ def __cinit__(self, void_ptr _ptr = 0): if _ptr == 0: - self._val_ptr = calloc(1, sizeof(ccudart.cudaEglFrame_st)) - self._ptr = self._val_ptr + self._val_ptr = calloc(1, sizeof(cyruntime.cudaEglFrame_st)) + self._pvt_ptr = self._val_ptr else: - self._ptr = _ptr + self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - self._frame = anon_union10(_ptr=self._ptr) + pass + + self._frame = anon_union12(_ptr=self._pvt_ptr) + def __dealloc__(self): if self._val_ptr is not NULL: free(self._val_ptr) def getPtr(self): - return self._ptr + return self._pvt_ptr def __repr__(self): - if self._ptr is not NULL: + if self._pvt_ptr is not NULL: str_list = [] + try: str_list += ['frame :\n' + '\n'.join([' ' + line for line in str(self.frame).splitlines()])] except ValueError: str_list += ['frame : '] + + try: str_list += ['planeDesc :\n' + '\n'.join([' ' + line for line in str(self.planeDesc).splitlines()])] except ValueError: str_list += ['planeDesc : '] + + try: str_list += ['planeCount : ' + str(self.planeCount)] except ValueError: str_list += ['planeCount : '] + + try: str_list += ['frameType : ' + str(self.frameType)] except ValueError: str_list += ['frameType : '] + + try: str_list += ['eglColorFormat : ' + str(self.eglColorFormat)] except ValueError: str_list += ['eglColorFormat : '] + return '\n'.join(str_list) else: return '' + @property def frame(self): return self._frame @frame.setter - def frame(self, frame not None : anon_union10): - string.memcpy(&self._ptr[0].frame, frame.getPtr(), sizeof(self._ptr[0].frame)) + def frame(self, frame not None : anon_union12): + string.memcpy(&self._pvt_ptr[0].frame, frame.getPtr(), sizeof(self._pvt_ptr[0].frame)) + + @property def planeDesc(self): - out_planeDesc = [cudaEglPlaneDesc() for _planeDesc in self._ptr[0].planeDesc] + out_planeDesc = [cudaEglPlaneDesc() for _planeDesc in self._pvt_ptr[0].planeDesc] for _idx in range(len(out_planeDesc)): - string.memcpy(out_planeDesc[_idx].getPtr(), &self._ptr[0].planeDesc[_idx], sizeof(ccudart.cudaEglPlaneDesc)) + string.memcpy(out_planeDesc[_idx].getPtr(), &self._pvt_ptr[0].planeDesc[_idx], sizeof(cyruntime.cudaEglPlaneDesc)) return out_planeDesc @planeDesc.setter - def planeDesc(self, planeDesc : List[cudaEglPlaneDesc]): + def planeDesc(self, planeDesc : list[cudaEglPlaneDesc]): if len(planeDesc) != 3: raise IndexError('not enough values found during array assignment, expected 3, got', len(planeDesc)) for _idx in range(len(planeDesc)): - string.memcpy(&self._ptr[0].planeDesc[_idx], planeDesc[_idx].getPtr(), sizeof(ccudart.cudaEglPlaneDesc)) + string.memcpy(&self._pvt_ptr[0].planeDesc[_idx], planeDesc[_idx].getPtr(), sizeof(cyruntime.cudaEglPlaneDesc)) + + @property def planeCount(self): - return self._ptr[0].planeCount + return self._pvt_ptr[0].planeCount @planeCount.setter def planeCount(self, unsigned int planeCount): - self._ptr[0].planeCount = planeCount + self._pvt_ptr[0].planeCount = planeCount + + @property def frameType(self): - return cudaEglFrameType(self._ptr[0].frameType) + return cudaEglFrameType(self._pvt_ptr[0].frameType) @frameType.setter def frameType(self, frameType not None : cudaEglFrameType): - self._ptr[0].frameType = frameType.value + self._pvt_ptr[0].frameType = int(frameType) + + @property def eglColorFormat(self): - return cudaEglColorFormat(self._ptr[0].eglColorFormat) + return cudaEglColorFormat(self._pvt_ptr[0].eglColorFormat) @eglColorFormat.setter def eglColorFormat(self, eglColorFormat not None : cudaEglColorFormat): - self._ptr[0].eglColorFormat = eglColorFormat.value -{{endif}} -{{if 'cudaGraphConditionalHandle' in found_types}} + self._pvt_ptr[0].eglColorFormat = int(eglColorFormat) + cdef class cudaGraphConditionalHandle: """ @@ -13360,22 +20481,44 @@ cdef class cudaGraphConditionalHandle: """ def __cinit__(self, unsigned long long init_value = 0, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr if init_value: - self._ptr[0] = init_value + self._pvt_ptr[0] = init_value def __dealloc__(self): pass def __repr__(self): return '' def __int__(self): - return self._ptr[0] + return self._pvt_ptr[0] def getPtr(self): - return self._ptr -{{endif}} + return self._pvt_ptr -{{if 'cudaSurfaceObject_t' in found_types}} +cdef class cudaLogIterator: + """ + + Methods + ------- + getPtr() + Get memory address of class instance + + """ + def __cinit__(self, unsigned int init_value = 0, void_ptr _ptr = 0): + if _ptr == 0: + self._pvt_ptr = &self._pvt_val + else: + self._pvt_ptr = _ptr + if init_value: + self._pvt_ptr[0] = init_value + def __dealloc__(self): + pass + def __repr__(self): + return '' + def __int__(self): + return self._pvt_ptr[0] + def getPtr(self): + return self._pvt_ptr cdef class cudaSurfaceObject_t: """ @@ -13390,22 +20533,19 @@ cdef class cudaSurfaceObject_t: """ def __cinit__(self, unsigned long long init_value = 0, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr if init_value: - self._ptr[0] = init_value + self._pvt_ptr[0] = init_value def __dealloc__(self): pass def __repr__(self): return '' def __int__(self): - return self._ptr[0] + return self._pvt_ptr[0] def getPtr(self): - return self._ptr -{{endif}} - -{{if 'cudaTextureObject_t' in found_types}} + return self._pvt_ptr cdef class cudaTextureObject_t: """ @@ -13420,22 +20560,19 @@ cdef class cudaTextureObject_t: """ def __cinit__(self, unsigned long long init_value = 0, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr if init_value: - self._ptr[0] = init_value + self._pvt_ptr[0] = init_value def __dealloc__(self): pass def __repr__(self): return '' def __int__(self): - return self._ptr[0] + return self._pvt_ptr[0] def getPtr(self): - return self._ptr -{{endif}} - -{{if True}} + return self._pvt_ptr cdef class GLenum: """ @@ -13448,22 +20585,19 @@ cdef class GLenum: """ def __cinit__(self, unsigned int init_value = 0, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr if init_value: - self._ptr[0] = init_value + self._pvt_ptr[0] = init_value def __dealloc__(self): pass def __repr__(self): return '' def __int__(self): - return self._ptr[0] + return self._pvt_ptr[0] def getPtr(self): - return self._ptr -{{endif}} - -{{if True}} + return self._pvt_ptr cdef class GLuint: """ @@ -13476,22 +20610,19 @@ cdef class GLuint: """ def __cinit__(self, unsigned int init_value = 0, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr if init_value: - self._ptr[0] = init_value + self._pvt_ptr[0] = init_value def __dealloc__(self): pass def __repr__(self): return '' def __int__(self): - return self._ptr[0] + return self._pvt_ptr[0] def getPtr(self): - return self._ptr -{{endif}} - -{{if True}} + return self._pvt_ptr cdef class EGLint: """ @@ -13504,22 +20635,19 @@ cdef class EGLint: """ def __cinit__(self, unsigned int init_value = 0, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr if init_value: - self._ptr[0] = init_value + self._pvt_ptr[0] = init_value def __dealloc__(self): pass def __repr__(self): return '' def __int__(self): - return self._ptr[0] + return self._pvt_ptr[0] def getPtr(self): - return self._ptr -{{endif}} - -{{if True}} + return self._pvt_ptr cdef class VdpDevice: """ @@ -13532,22 +20660,19 @@ cdef class VdpDevice: """ def __cinit__(self, uint32_t init_value = 0, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr if init_value: - self._ptr[0] = init_value + self._pvt_ptr[0] = init_value def __dealloc__(self): pass def __repr__(self): return '' def __int__(self): - return self._ptr[0] + return self._pvt_ptr[0] def getPtr(self): - return self._ptr -{{endif}} - -{{if True}} + return self._pvt_ptr cdef class VdpGetProcAddress: """ @@ -13560,22 +20685,19 @@ cdef class VdpGetProcAddress: """ def __cinit__(self, unsigned long long init_value = 0, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr if init_value: - self._ptr[0] = init_value + self._pvt_ptr[0] = init_value def __dealloc__(self): pass def __repr__(self): return '' def __int__(self): - return self._ptr[0] + return self._pvt_ptr[0] def getPtr(self): - return self._ptr -{{endif}} - -{{if True}} + return self._pvt_ptr cdef class VdpVideoSurface: """ @@ -13588,22 +20710,19 @@ cdef class VdpVideoSurface: """ def __cinit__(self, uint32_t init_value = 0, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr if init_value: - self._ptr[0] = init_value + self._pvt_ptr[0] = init_value def __dealloc__(self): pass def __repr__(self): return '' def __int__(self): - return self._ptr[0] + return self._pvt_ptr[0] def getPtr(self): - return self._ptr -{{endif}} - -{{if True}} + return self._pvt_ptr cdef class VdpOutputSurface: """ @@ -13616,22 +20735,19 @@ cdef class VdpOutputSurface: """ def __cinit__(self, uint32_t init_value = 0, void_ptr _ptr = 0): if _ptr == 0: - self._ptr = &self.__val + self._pvt_ptr = &self._pvt_val else: - self._ptr = _ptr + self._pvt_ptr = _ptr if init_value: - self._ptr[0] = init_value + self._pvt_ptr[0] = init_value def __dealloc__(self): pass def __repr__(self): return '' def __int__(self): - return self._ptr[0] + return self._pvt_ptr[0] def getPtr(self): - return self._ptr -{{endif}} - -{{if 'cudaDeviceReset' in found_functions}} + return self._pvt_ptr @cython.embedsignature(True) def cudaDeviceReset(): @@ -13673,11 +20789,9 @@ def cudaDeviceReset(): If a non-primary :py:obj:`~.CUcontext` is current to the thread, :py:obj:`~.cudaDeviceReset()` will destroy only the internal CUDA RT state for that :py:obj:`~.CUcontext`. """ - err = ccudart.cudaDeviceReset() - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaDeviceSynchronize' in found_functions}} + with nogil: + err = cyruntime.cudaDeviceReset() + return (_cudaError_t(err),) @cython.embedsignature(True) def cudaDeviceSynchronize(): @@ -13693,19 +20807,15 @@ def cudaDeviceSynchronize(): Returns ------- cudaError_t - :py:obj:`~.cudaSuccess` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorStreamCaptureUnsupported` See Also -------- :py:obj:`~.cudaDeviceReset`, :py:obj:`~.cuCtxSynchronize` """ with nogil: - err = ccudart.cudaDeviceSynchronize() - - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaDeviceSetLimit' in found_functions}} + err = cyruntime.cudaDeviceSynchronize() + return (_cudaError_t(err),) @cython.embedsignature(True) def cudaDeviceSetLimit(limit not None : cudaLimit, size_t value): @@ -13802,12 +20912,10 @@ def cudaDeviceSetLimit(limit not None : cudaLimit, size_t value): -------- :py:obj:`~.cudaDeviceGetLimit`, :py:obj:`~.cuCtxSetLimit` """ - cdef ccudart.cudaLimit climit = limit.value - err = ccudart.cudaDeviceSetLimit(climit, value) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaDeviceGetLimit' in found_functions}} + cdef cyruntime.cudaLimit cylimit = int(limit) + with nogil: + err = cyruntime.cudaDeviceSetLimit(cylimit, value) + return (_cudaError_t(err),) @cython.embedsignature(True) def cudaDeviceGetLimit(limit not None : cudaLimit): @@ -13859,12 +20967,12 @@ def cudaDeviceGetLimit(limit not None : cudaLimit): :py:obj:`~.cudaDeviceSetLimit`, :py:obj:`~.cuCtxGetLimit` """ cdef size_t pValue = 0 - cdef ccudart.cudaLimit climit = limit.value - err = ccudart.cudaDeviceGetLimit(&pValue, climit) - return (cudaError_t(err), pValue) -{{endif}} - -{{if 'cudaDeviceGetTexture1DLinearMaxWidth' in found_functions}} + cdef cyruntime.cudaLimit cylimit = int(limit) + with nogil: + err = cyruntime.cudaDeviceGetLimit(&pValue, cylimit) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, pValue) @cython.embedsignature(True) def cudaDeviceGetTexture1DLinearMaxWidth(fmtDesc : Optional[cudaChannelFormatDesc], int device): @@ -13894,12 +21002,12 @@ def cudaDeviceGetTexture1DLinearMaxWidth(fmtDesc : Optional[cudaChannelFormatDes :py:obj:`~.cuDeviceGetTexture1DLinearMaxWidth` """ cdef size_t maxWidthInElements = 0 - cdef ccudart.cudaChannelFormatDesc* cfmtDesc_ptr = fmtDesc._ptr if fmtDesc != None else NULL - err = ccudart.cudaDeviceGetTexture1DLinearMaxWidth(&maxWidthInElements, cfmtDesc_ptr, device) - return (cudaError_t(err), maxWidthInElements) -{{endif}} - -{{if 'cudaDeviceGetCacheConfig' in found_functions}} + cdef cyruntime.cudaChannelFormatDesc* cyfmtDesc_ptr = fmtDesc._pvt_ptr if fmtDesc is not None else NULL + with nogil: + err = cyruntime.cudaDeviceGetTexture1DLinearMaxWidth(&maxWidthInElements, cyfmtDesc_ptr, device) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, maxWidthInElements) @cython.embedsignature(True) def cudaDeviceGetCacheConfig(): @@ -13941,12 +21049,12 @@ def cudaDeviceGetCacheConfig(): -------- :py:obj:`~.cudaDeviceSetCacheConfig`, :py:obj:`~.cudaFuncSetCacheConfig (C API)`, cudaFuncSetCacheConfig (C++ API), :py:obj:`~.cuCtxGetCacheConfig` """ - cdef ccudart.cudaFuncCache pCacheConfig - err = ccudart.cudaDeviceGetCacheConfig(&pCacheConfig) - return (cudaError_t(err), cudaFuncCache(pCacheConfig)) -{{endif}} - -{{if 'cudaDeviceGetStreamPriorityRange' in found_functions}} + cdef cyruntime.cudaFuncCache pCacheConfig + with nogil: + err = cyruntime.cudaDeviceGetCacheConfig(&pCacheConfig) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, cudaFuncCache(pCacheConfig)) @cython.embedsignature(True) def cudaDeviceGetStreamPriorityRange(): @@ -13986,11 +21094,11 @@ def cudaDeviceGetStreamPriorityRange(): """ cdef int leastPriority = 0 cdef int greatestPriority = 0 - err = ccudart.cudaDeviceGetStreamPriorityRange(&leastPriority, &greatestPriority) - return (cudaError_t(err), leastPriority, greatestPriority) -{{endif}} - -{{if 'cudaDeviceSetCacheConfig' in found_functions}} + with nogil: + err = cyruntime.cudaDeviceGetStreamPriorityRange(&leastPriority, &greatestPriority) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None, None) + return (_cudaError_t_SUCCESS, leastPriority, greatestPriority) @cython.embedsignature(True) def cudaDeviceSetCacheConfig(cacheConfig not None : cudaFuncCache): @@ -14042,12 +21150,10 @@ def cudaDeviceSetCacheConfig(cacheConfig not None : cudaFuncCache): -------- :py:obj:`~.cudaDeviceGetCacheConfig`, :py:obj:`~.cudaFuncSetCacheConfig (C API)`, cudaFuncSetCacheConfig (C++ API), :py:obj:`~.cuCtxSetCacheConfig` """ - cdef ccudart.cudaFuncCache ccacheConfig = cacheConfig.value - err = ccudart.cudaDeviceSetCacheConfig(ccacheConfig) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaDeviceGetByPCIBusId' in found_functions}} + cdef cyruntime.cudaFuncCache cycacheConfig = int(cacheConfig) + with nogil: + err = cyruntime.cudaDeviceSetCacheConfig(cycacheConfig) + return (_cudaError_t(err),) @cython.embedsignature(True) def cudaDeviceGetByPCIBusId(char* pciBusId): @@ -14075,11 +21181,11 @@ def cudaDeviceGetByPCIBusId(char* pciBusId): :py:obj:`~.cudaDeviceGetPCIBusId`, :py:obj:`~.cuDeviceGetByPCIBusId` """ cdef int device = 0 - err = ccudart.cudaDeviceGetByPCIBusId(&device, pciBusId) - return (cudaError_t(err), device) -{{endif}} - -{{if 'cudaDeviceGetPCIBusId' in found_functions}} + with nogil: + err = cyruntime.cudaDeviceGetByPCIBusId(&device, pciBusId) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, device) @cython.embedsignature(True) def cudaDeviceGetPCIBusId(int length, int device): @@ -14113,11 +21219,11 @@ def cudaDeviceGetPCIBusId(int length, int device): """ pypciBusId = b" " * length cdef char* pciBusId = pypciBusId - err = ccudart.cudaDeviceGetPCIBusId(pciBusId, length, device) - return (cudaError_t(err), pypciBusId) -{{endif}} - -{{if 'cudaIpcGetEventHandle' in found_functions}} + with nogil: + err = cyruntime.cudaDeviceGetPCIBusId(pciBusId, length, device) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, pypciBusId) @cython.embedsignature(True) def cudaIpcGetEventHandle(event): @@ -14162,21 +21268,20 @@ def cudaIpcGetEventHandle(event): -------- :py:obj:`~.cudaEventCreate`, :py:obj:`~.cudaEventDestroy`, :py:obj:`~.cudaEventSynchronize`, :py:obj:`~.cudaEventQuery`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cudaIpcOpenEventHandle`, :py:obj:`~.cudaIpcGetMemHandle`, :py:obj:`~.cudaIpcOpenMemHandle`, :py:obj:`~.cudaIpcCloseMemHandle`, :py:obj:`~.cuIpcGetEventHandle` """ - cdef ccudart.cudaEvent_t cevent + cdef cyruntime.cudaEvent_t cyevent if event is None: - cevent = 0 - elif isinstance(event, (cudaEvent_t,cuda.CUevent)): + pevent = 0 + elif isinstance(event, (cudaEvent_t,driver.CUevent)): pevent = int(event) - cevent = pevent else: pevent = int(cudaEvent_t(event)) - cevent = pevent + cyevent = pevent cdef cudaIpcEventHandle_t handle = cudaIpcEventHandle_t() - err = ccudart.cudaIpcGetEventHandle(handle._ptr, cevent) - return (cudaError_t(err), handle) -{{endif}} - -{{if 'cudaIpcOpenEventHandle' in found_functions}} + with nogil: + err = cyruntime.cudaIpcGetEventHandle(handle._pvt_ptr, cyevent) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, handle) @cython.embedsignature(True) def cudaIpcOpenEventHandle(handle not None : cudaIpcEventHandle_t): @@ -14216,11 +21321,11 @@ def cudaIpcOpenEventHandle(handle not None : cudaIpcEventHandle_t): :py:obj:`~.cudaEventCreate`, :py:obj:`~.cudaEventDestroy`, :py:obj:`~.cudaEventSynchronize`, :py:obj:`~.cudaEventQuery`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cudaIpcGetEventHandle`, :py:obj:`~.cudaIpcGetMemHandle`, :py:obj:`~.cudaIpcOpenMemHandle`, :py:obj:`~.cudaIpcCloseMemHandle`, :py:obj:`~.cuIpcOpenEventHandle` """ cdef cudaEvent_t event = cudaEvent_t() - err = ccudart.cudaIpcOpenEventHandle(event._ptr, handle._ptr[0]) - return (cudaError_t(err), event) -{{endif}} - -{{if 'cudaIpcGetMemHandle' in found_functions}} + with nogil: + err = cyruntime.cudaIpcOpenEventHandle(event._pvt_ptr, handle._pvt_ptr[0]) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, event) @cython.embedsignature(True) def cudaIpcGetMemHandle(devPtr): @@ -14261,13 +21366,14 @@ def cudaIpcGetMemHandle(devPtr): :py:obj:`~.cudaMalloc`, :py:obj:`~.cudaFree`, :py:obj:`~.cudaIpcGetEventHandle`, :py:obj:`~.cudaIpcOpenEventHandle`, :py:obj:`~.cudaIpcOpenMemHandle`, :py:obj:`~.cudaIpcCloseMemHandle`, :py:obj:`~.cuIpcGetMemHandle` """ cdef cudaIpcMemHandle_t handle = cudaIpcMemHandle_t() - cdevPtr = utils.HelperInputVoidPtr(devPtr) - cdef void* cdevPtr_ptr = cdevPtr.cptr - err = ccudart.cudaIpcGetMemHandle(handle._ptr, cdevPtr_ptr) - return (cudaError_t(err), handle) -{{endif}} - -{{if 'cudaIpcOpenMemHandle' in found_functions}} + cdef _HelperInputVoidPtrStruct cydevPtrHelper + cdef void* cydevPtr = _helper_input_void_ptr(devPtr, &cydevPtrHelper) + with nogil: + err = cyruntime.cudaIpcGetMemHandle(handle._pvt_ptr, cydevPtr) + _helper_input_void_ptr_free(&cydevPtrHelper) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, handle) @cython.embedsignature(True) def cudaIpcOpenMemHandle(handle not None : cudaIpcMemHandle_t, unsigned int flags): @@ -14329,15 +21435,15 @@ def cudaIpcOpenMemHandle(handle not None : cudaIpcMemHandle_t, unsigned int flag Notes ----- - No guarantees are made about the address returned in `*devPtr`. + No guarantees are made about the address returned in `*devPtr`. In particular, multiple processes may not receive the same address for the same `handle`. """ cdef void_ptr devPtr = 0 - err = ccudart.cudaIpcOpenMemHandle(&devPtr, handle._ptr[0], flags) - return (cudaError_t(err), devPtr) -{{endif}} - -{{if 'cudaIpcCloseMemHandle' in found_functions}} + with nogil: + err = cyruntime.cudaIpcOpenMemHandle(&devPtr, handle._pvt_ptr[0], flags) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, devPtr) @cython.embedsignature(True) def cudaIpcCloseMemHandle(devPtr): @@ -14373,13 +21479,12 @@ def cudaIpcCloseMemHandle(devPtr): -------- :py:obj:`~.cudaMalloc`, :py:obj:`~.cudaFree`, :py:obj:`~.cudaIpcGetEventHandle`, :py:obj:`~.cudaIpcOpenEventHandle`, :py:obj:`~.cudaIpcGetMemHandle`, :py:obj:`~.cudaIpcOpenMemHandle`, :py:obj:`~.cuIpcCloseMemHandle` """ - cdevPtr = utils.HelperInputVoidPtr(devPtr) - cdef void* cdevPtr_ptr = cdevPtr.cptr - err = ccudart.cudaIpcCloseMemHandle(cdevPtr_ptr) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaDeviceFlushGPUDirectRDMAWrites' in found_functions}} + cdef _HelperInputVoidPtrStruct cydevPtrHelper + cdef void* cydevPtr = _helper_input_void_ptr(devPtr, &cydevPtrHelper) + with nogil: + err = cyruntime.cudaIpcCloseMemHandle(cydevPtr) + _helper_input_void_ptr_free(&cydevPtrHelper) + return (_cudaError_t(err),) @cython.embedsignature(True) def cudaDeviceFlushGPUDirectRDMAWrites(target not None : cudaFlushGPUDirectRDMAWritesTarget, scope not None : cudaFlushGPUDirectRDMAWritesScope): @@ -14402,9 +21507,11 @@ def cudaDeviceFlushGPUDirectRDMAWrites(target not None : cudaFlushGPUDirectRDMAW Parameters ---------- target : :py:obj:`~.cudaFlushGPUDirectRDMAWritesTarget` - The target of the operation, see cudaFlushGPUDirectRDMAWritesTarget + The target of the operation, see + :py:obj:`~.cudaFlushGPUDirectRDMAWritesTarget` scope : :py:obj:`~.cudaFlushGPUDirectRDMAWritesScope` - The scope of the operation, see cudaFlushGPUDirectRDMAWritesScope + The scope of the operation, see + :py:obj:`~.cudaFlushGPUDirectRDMAWritesScope` Returns ------- @@ -14415,13 +21522,23 @@ def cudaDeviceFlushGPUDirectRDMAWrites(target not None : cudaFlushGPUDirectRDMAW -------- :py:obj:`~.cuFlushGPUDirectRDMAWrites` """ - cdef ccudart.cudaFlushGPUDirectRDMAWritesTarget ctarget = target.value - cdef ccudart.cudaFlushGPUDirectRDMAWritesScope cscope = scope.value - err = ccudart.cudaDeviceFlushGPUDirectRDMAWrites(ctarget, cscope) - return (cudaError_t(err),) -{{endif}} + cdef cyruntime.cudaFlushGPUDirectRDMAWritesTarget cytarget = int(target) + cdef cyruntime.cudaFlushGPUDirectRDMAWritesScope cyscope = int(scope) + with nogil: + err = cyruntime.cudaDeviceFlushGPUDirectRDMAWrites(cytarget, cyscope) + return (_cudaError_t(err),) + +ctypedef struct cudaAsyncCallbackData_st: + cyruntime.cudaAsyncCallback callback + void *userData + +ctypedef cudaAsyncCallbackData_st cudaAsyncCallbackData -{{if 'cudaDeviceRegisterAsyncNotification' in found_functions}} +@cython.show_performance_hints(False) +cdef void cudaAsyncNotificationCallbackWrapper(cyruntime.cudaAsyncNotificationInfo_t *info, void *data, cyruntime.cudaAsyncCallbackHandle_t handle) nogil: + cdef cudaAsyncCallbackData *cbData = data + with gil: + cbData.callback(info, cbData.userData, handle) @cython.embedsignature(True) def cudaDeviceRegisterAsyncNotification(int device, callbackFunc, userData): @@ -14466,23 +21583,36 @@ def cudaDeviceRegisterAsyncNotification(int device, callbackFunc, userData): -------- :py:obj:`~.cudaDeviceUnregisterAsyncNotification` """ - cdef ccudart.cudaAsyncCallback ccallbackFunc + cdef cyruntime.cudaAsyncCallback cycallbackFunc if callbackFunc is None: - ccallbackFunc = 0 + pcallbackFunc = 0 elif isinstance(callbackFunc, (cudaAsyncCallback,)): pcallbackFunc = int(callbackFunc) - ccallbackFunc = pcallbackFunc else: pcallbackFunc = int(cudaAsyncCallback(callbackFunc)) - ccallbackFunc = pcallbackFunc - cuserData = utils.HelperInputVoidPtr(userData) - cdef void* cuserData_ptr = cuserData.cptr + cycallbackFunc = pcallbackFunc + cdef _HelperInputVoidPtrStruct cyuserDataHelper + cdef void* cyuserData = _helper_input_void_ptr(userData, &cyuserDataHelper) + + cdef cudaAsyncCallbackData *cbData = NULL + cbData = malloc(sizeof(cbData[0])) + if cbData == NULL: + return (cudaError_t.cudaErrorMemoryAllocation, None) + cbData.callback = cycallbackFunc + cbData.userData = cyuserData + cdef cudaAsyncCallbackHandle_t callback = cudaAsyncCallbackHandle_t() - err = ccudart.cudaDeviceRegisterAsyncNotification(device, ccallbackFunc, cuserData_ptr, callback._ptr) - return (cudaError_t(err), callback) -{{endif}} + with nogil: + err = cyruntime.cudaDeviceRegisterAsyncNotification(device, cudaAsyncNotificationCallbackWrapper, cbData, callback._pvt_ptr) + if err != cyruntime.cudaSuccess: + free(cbData) + else: + m_global._allocated[int(callback)] = cbData + _helper_input_void_ptr_free(&cyuserDataHelper) -{{if 'cudaDeviceUnregisterAsyncNotification' in found_functions}} + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, callback) @cython.embedsignature(True) def cudaDeviceUnregisterAsyncNotification(int device, callback): @@ -14508,20 +21638,20 @@ def cudaDeviceUnregisterAsyncNotification(int device, callback): -------- :py:obj:`~.cudaDeviceRegisterAsyncNotification` """ - cdef ccudart.cudaAsyncCallbackHandle_t ccallback + cdef cyruntime.cudaAsyncCallbackHandle_t cycallback if callback is None: - ccallback = 0 + pcallback = 0 elif isinstance(callback, (cudaAsyncCallbackHandle_t,)): pcallback = int(callback) - ccallback = pcallback else: pcallback = int(cudaAsyncCallbackHandle_t(callback)) - ccallback = pcallback - err = ccudart.cudaDeviceUnregisterAsyncNotification(device, ccallback) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaDeviceGetSharedMemConfig' in found_functions}} + cycallback = pcallback + with nogil: + err = cyruntime.cudaDeviceUnregisterAsyncNotification(device, cycallback) + if err == cyruntime.cudaSuccess: + free(m_global._allocated[pcallback]) + m_global._allocated.erase(pcallback) + return (_cudaError_t(err),) @cython.embedsignature(True) def cudaDeviceGetSharedMemConfig(): @@ -14557,12 +21687,12 @@ def cudaDeviceGetSharedMemConfig(): -------- :py:obj:`~.cudaDeviceSetCacheConfig`, :py:obj:`~.cudaDeviceGetCacheConfig`, :py:obj:`~.cudaDeviceSetSharedMemConfig`, :py:obj:`~.cudaFuncSetCacheConfig`, :py:obj:`~.cuCtxGetSharedMemConfig` """ - cdef ccudart.cudaSharedMemConfig pConfig - err = ccudart.cudaDeviceGetSharedMemConfig(&pConfig) - return (cudaError_t(err), cudaSharedMemConfig(pConfig)) -{{endif}} - -{{if 'cudaDeviceSetSharedMemConfig' in found_functions}} + cdef cyruntime.cudaSharedMemConfig pConfig + with nogil: + err = cyruntime.cudaDeviceGetSharedMemConfig(&pConfig) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, cudaSharedMemConfig(pConfig)) @cython.embedsignature(True) def cudaDeviceSetSharedMemConfig(config not None : cudaSharedMemConfig): @@ -14613,12 +21743,10 @@ def cudaDeviceSetSharedMemConfig(config not None : cudaSharedMemConfig): -------- :py:obj:`~.cudaDeviceSetCacheConfig`, :py:obj:`~.cudaDeviceGetCacheConfig`, :py:obj:`~.cudaDeviceGetSharedMemConfig`, :py:obj:`~.cudaFuncSetCacheConfig`, :py:obj:`~.cuCtxSetSharedMemConfig` """ - cdef ccudart.cudaSharedMemConfig cconfig = config.value - err = ccudart.cudaDeviceSetSharedMemConfig(cconfig) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaGetLastError' in found_functions}} + cdef cyruntime.cudaSharedMemConfig cyconfig = int(config) + with nogil: + err = cyruntime.cudaDeviceSetSharedMemConfig(cyconfig) + return (_cudaError_t(err),) @cython.embedsignature(True) def cudaGetLastError(): @@ -14641,11 +21769,9 @@ def cudaGetLastError(): -------- :py:obj:`~.cudaPeekAtLastError`, :py:obj:`~.cudaGetErrorName`, :py:obj:`~.cudaGetErrorString`, :py:obj:`~.cudaError` """ - err = ccudart.cudaGetLastError() - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaPeekAtLastError' in found_functions}} + with nogil: + err = cyruntime.cudaGetLastError() + return (_cudaError_t(err),) @cython.embedsignature(True) def cudaPeekAtLastError(): @@ -14669,11 +21795,9 @@ def cudaPeekAtLastError(): -------- :py:obj:`~.cudaGetLastError`, :py:obj:`~.cudaGetErrorName`, :py:obj:`~.cudaGetErrorString`, :py:obj:`~.cudaError` """ - err = ccudart.cudaPeekAtLastError() - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaGetErrorName' in found_functions}} + with nogil: + err = cyruntime.cudaPeekAtLastError() + return (_cudaError_t(err),) @cython.embedsignature(True) def cudaGetErrorName(error not None : cudaError_t): @@ -14699,12 +21823,10 @@ def cudaGetErrorName(error not None : cudaError_t): -------- :py:obj:`~.cudaGetErrorString`, :py:obj:`~.cudaGetLastError`, :py:obj:`~.cudaPeekAtLastError`, :py:obj:`~.cudaError`, :py:obj:`~.cuGetErrorName` """ - cdef ccudart.cudaError_t cerror = error.value - err = ccudart.cudaGetErrorName(cerror) + cdef cyruntime.cudaError_t cyerror = int(error) + with nogil: + err = cyruntime.cudaGetErrorName(cyerror) return (cudaError_t.cudaSuccess, err) -{{endif}} - -{{if 'cudaGetErrorString' in found_functions}} @cython.embedsignature(True) def cudaGetErrorString(error not None : cudaError_t): @@ -14729,12 +21851,10 @@ def cudaGetErrorString(error not None : cudaError_t): -------- :py:obj:`~.cudaGetErrorName`, :py:obj:`~.cudaGetLastError`, :py:obj:`~.cudaPeekAtLastError`, :py:obj:`~.cudaError`, :py:obj:`~.cuGetErrorString` """ - cdef ccudart.cudaError_t cerror = error.value - err = ccudart.cudaGetErrorString(cerror) + cdef cyruntime.cudaError_t cyerror = int(error) + with nogil: + err = cyruntime.cudaGetErrorString(cyerror) return (cudaError_t.cudaSuccess, err) -{{endif}} - -{{if 'cudaGetDeviceCount' in found_functions}} @cython.embedsignature(True) def cudaGetDeviceCount(): @@ -14756,1873 +21876,2825 @@ def cudaGetDeviceCount(): :py:obj:`~.cudaGetDevice`, :py:obj:`~.cudaSetDevice`, :py:obj:`~.cudaGetDeviceProperties`, :py:obj:`~.cudaChooseDevice`, :py:obj:`~.cudaInitDevice`, :py:obj:`~.cuDeviceGetCount` """ cdef int count = 0 - err = ccudart.cudaGetDeviceCount(&count) - return (cudaError_t(err), count) -{{endif}} - -{{if 'cudaGetDeviceProperties_v2' in found_functions}} + with nogil: + err = cyruntime.cudaGetDeviceCount(&count) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, count) @cython.embedsignature(True) def cudaGetDeviceProperties(int device): """ Returns information about the compute-device. - Returns in `*prop` the properties of device `dev`. The - :py:obj:`~.cudaDeviceProp` structure is defined as: + Returns in `*prop` the properties of device `dev`. - **View CUDA Toolkit Documentation for a C++ code example** - - where: - - - :py:obj:`~.name[256]` is an ASCII string identifying the device. - - - :py:obj:`~.uuid` is a 16-byte unique identifier. - - - :py:obj:`~.totalGlobalMem` is the total amount of global memory - available on the device in bytes. - - - :py:obj:`~.sharedMemPerBlock` is the maximum amount of shared memory - available to a thread block in bytes. - - - :py:obj:`~.regsPerBlock` is the maximum number of 32-bit registers - available to a thread block. + Parameters + ---------- + device : int + Device number to get properties for - - :py:obj:`~.warpSize` is the warp size in threads. + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDevice` + prop : :py:obj:`~.cudaDeviceProp` + Properties for the specified device - - :py:obj:`~.memPitch` is the maximum pitch in bytes allowed by the - memory copy functions that involve memory regions allocated through - :py:obj:`~.cudaMallocPitch()`. + See Also + -------- + :py:obj:`~.cudaGetDeviceCount`, :py:obj:`~.cudaGetDevice`, :py:obj:`~.cudaSetDevice`, :py:obj:`~.cudaChooseDevice`, :py:obj:`~.cudaDeviceGetAttribute`, :py:obj:`~.cudaInitDevice`, :py:obj:`~.cuDeviceGetAttribute`, :py:obj:`~.cuDeviceGetName` + """ + cdef cudaDeviceProp prop = cudaDeviceProp() + with nogil: + err = cyruntime.cudaGetDeviceProperties(prop._pvt_ptr, device) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, prop) - - :py:obj:`~.maxThreadsPerBlock` is the maximum number of threads per - block. +@cython.embedsignature(True) +def cudaDeviceGetAttribute(attr not None : cudaDeviceAttr, int device): + """ Returns information about the device. - - :py:obj:`~.maxThreadsDim[3]` contains the maximum size of each - dimension of a block. + Returns in `*value` the integer value of the attribute `attr` on device + `device`. - - :py:obj:`~.maxGridSize[3]` contains the maximum size of each - dimension of a grid. + Parameters + ---------- + attr : :py:obj:`~.cudaDeviceAttr` + Device attribute to query + device : int + Device number to query - - :py:obj:`~.clockRate` is the clock frequency in kilohertz. + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDevice`, :py:obj:`~.cudaErrorInvalidValue` + value : int + Returned device attribute value - - :py:obj:`~.totalConstMem` is the total amount of constant memory - available on the device in bytes. + See Also + -------- + :py:obj:`~.cudaGetDeviceCount`, :py:obj:`~.cudaGetDevice`, :py:obj:`~.cudaSetDevice`, :py:obj:`~.cudaChooseDevice`, :py:obj:`~.cudaGetDeviceProperties`, :py:obj:`~.cudaInitDevice`, :py:obj:`~.cuDeviceGetAttribute` + """ + cdef int value = 0 + cdef cyruntime.cudaDeviceAttr cyattr = int(attr) + with nogil: + err = cyruntime.cudaDeviceGetAttribute(&value, cyattr, device) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, value) - - :py:obj:`~.major`, :py:obj:`~.minor` are the major and minor revision - numbers defining the device's compute capability. +@cython.embedsignature(True) +def cudaDeviceGetHostAtomicCapabilities(operations : Optional[tuple[cudaAtomicOperation] | list[cudaAtomicOperation]], unsigned int count, int device): + """ Queries details about atomic operations supported between the device and host. - - :py:obj:`~.textureAlignment` is the alignment requirement; texture - base addresses that are aligned to :py:obj:`~.textureAlignment` bytes - do not need an offset applied to texture fetches. + Returns in `*capabilities` the details about requested atomic + `*operations` over the the link between `dev` and the host. The + allocated size of `*operations` and `*capabilities` must be `count`. - - :py:obj:`~.texturePitchAlignment` is the pitch alignment requirement - for 2D texture references that are bound to pitched memory. + For each :py:obj:`~.cudaAtomicOperation` in `*operations`, the + corresponding result in `*capabilities` will be a bitmask indicating + which of :py:obj:`~.cudaAtomicOperationCapability` the link supports + natively. - - :py:obj:`~.deviceOverlap` is 1 if the device can concurrently copy - memory between host and device while executing a kernel, or 0 if not. - Deprecated, use instead asyncEngineCount. + Returns :py:obj:`~.cudaErrorInvalidDevice` if `dev` is not valid. - - :py:obj:`~.multiProcessorCount` is the number of multiprocessors on - the device. + Returns :py:obj:`~.cudaErrorInvalidValue` if `*capabilities` or + `*operations` is NULL, if `count` is 0, or if any of `*operations` is + not valid. - - :py:obj:`~.kernelExecTimeoutEnabled` is 1 if there is a run time - limit for kernels executed on the device, or 0 if not. + Parameters + ---------- + operations : list[:py:obj:`~.cudaAtomicOperation`] + Requested operations + count : unsigned int + Count of requested operations and size of capabilities + dev : int + Device handle - - :py:obj:`~.integrated` is 1 if the device is an integrated - (motherboard) GPU and 0 if it is a discrete (card) component. + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDevice`, :py:obj:`~.cudaErrorInvalidValue` + capabilities : list[unsigned int] + Returned capability details of each requested operation - - :py:obj:`~.canMapHostMemory` is 1 if the device can map host memory - into the CUDA address space for use with - :py:obj:`~.cudaHostAlloc()`/:py:obj:`~.cudaHostGetDevicePointer()`, - or 0 if not. + See Also + -------- + :py:obj:`~.cudaDeviceGetAttribute`, :py:obj:`~.cudaDeviceGetP2PAtomicCapabilities`, :py:obj:`~.cuDeviceGeHostAtomicCapabilities` + """ + operations = [] if operations is None else operations + if not all(isinstance(_x, (cudaAtomicOperation)) for _x in operations): + raise TypeError("Argument 'operations' is not instance of type (expected tuple[cyruntime.cudaAtomicOperation] or list[cyruntime.cudaAtomicOperation]") + cdef unsigned int* cycapabilities = NULL + pycapabilities = [] + if count != 0: + cycapabilities = calloc(count, sizeof(unsigned int)) + if cycapabilities is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(count) + 'x' + str(sizeof(unsigned int))) + cdef vector[cyruntime.cudaAtomicOperation] cyoperations = operations + if count > len(operations): raise RuntimeError("List is too small: " + str(len(operations)) + " < " + str(count)) + with nogil: + err = cyruntime.cudaDeviceGetHostAtomicCapabilities(cycapabilities, cyoperations.data(), count, device) + if cudaError_t(err) == cudaError_t(0): + pycapabilities = [cycapabilities[idx] for idx in range(count)] + if cycapabilities is not NULL: + free(cycapabilities) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, pycapabilities) - - :py:obj:`~.computeMode` is the compute mode that the device is - currently in. Available modes are as follows: +@cython.embedsignature(True) +def cudaDeviceGetDefaultMemPool(int device): + """ Returns the default mempool of a device. - - cudaComputeModeDefault: Default mode - Device is not restricted and - multiple threads can use :py:obj:`~.cudaSetDevice()` with this - device. + The default mempool of a device contains device memory from that + device. - - cudaComputeModeProhibited: Compute-prohibited mode - No threads can - use :py:obj:`~.cudaSetDevice()` with this device. + Parameters + ---------- + device : int + None - - cudaComputeModeExclusiveProcess: Compute-exclusive-process mode - - Many threads in one process will be able to use - :py:obj:`~.cudaSetDevice()` with this device. When an occupied - exclusive mode device is chosen with :py:obj:`~.cudaSetDevice`, all - subsequent non-device management runtime functions will return - :py:obj:`~.cudaErrorDevicesUnavailable`. + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDevice`, :py:obj:`~.cudaErrorInvalidValue` :py:obj:`~.cudaErrorNotSupported` + memPool : :py:obj:`~.cudaMemPool_t` + None - - :py:obj:`~.maxTexture1D` is the maximum 1D texture size. + See Also + -------- + :py:obj:`~.cuDeviceGetDefaultMemPool`, :py:obj:`~.cudaMallocAsync`, :py:obj:`~.cudaMemPoolTrimTo`, :py:obj:`~.cudaMemPoolGetAttribute`, :py:obj:`~.cudaDeviceSetMemPool`, :py:obj:`~.cudaMemPoolSetAttribute`, :py:obj:`~.cudaMemPoolSetAccess` + """ + cdef cudaMemPool_t memPool = cudaMemPool_t() + with nogil: + err = cyruntime.cudaDeviceGetDefaultMemPool(memPool._pvt_ptr, device) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, memPool) - - :py:obj:`~.maxTexture1DMipmap` is the maximum 1D mipmapped texture - texture size. +@cython.embedsignature(True) +def cudaDeviceSetMemPool(int device, memPool): + """ Sets the current memory pool of a device. - - :py:obj:`~.maxTexture1DLinear` is the maximum 1D texture size for - textures bound to linear memory. + The memory pool must be local to the specified device. Unless a mempool + is specified in the :py:obj:`~.cudaMallocAsync` call, + :py:obj:`~.cudaMallocAsync` allocates from the current mempool of the + provided stream's device. By default, a device's current memory pool is + its default memory pool. - - :py:obj:`~.maxTexture2D[2]` contains the maximum 2D texture - dimensions. + Parameters + ---------- + device : int + None + memPool : :py:obj:`~.CUmemoryPool` or :py:obj:`~.cudaMemPool_t` + None - - :py:obj:`~.maxTexture2DMipmap[2]` contains the maximum 2D mipmapped - texture dimensions. + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :py:obj:`~.cudaErrorInvalidDevice` :py:obj:`~.cudaErrorNotSupported` - - :py:obj:`~.maxTexture2DLinear[3]` contains the maximum 2D texture - dimensions for 2D textures bound to pitch linear memory. + See Also + -------- + :py:obj:`~.cuDeviceSetMemPool`, :py:obj:`~.cudaDeviceGetMemPool`, :py:obj:`~.cudaDeviceGetDefaultMemPool`, :py:obj:`~.cudaMemPoolCreate`, :py:obj:`~.cudaMemPoolDestroy`, :py:obj:`~.cudaMallocFromPoolAsync` - - :py:obj:`~.maxTexture2DGather[2]` contains the maximum 2D texture - dimensions if texture gather operations have to be performed. + Notes + ----- + Use :py:obj:`~.cudaMallocFromPoolAsync` to specify asynchronous allocations from a device different than the one the stream runs on. + """ + cdef cyruntime.cudaMemPool_t cymemPool + if memPool is None: + pmemPool = 0 + elif isinstance(memPool, (cudaMemPool_t,driver.CUmemoryPool)): + pmemPool = int(memPool) + else: + pmemPool = int(cudaMemPool_t(memPool)) + cymemPool = pmemPool + with nogil: + err = cyruntime.cudaDeviceSetMemPool(device, cymemPool) + return (_cudaError_t(err),) - - :py:obj:`~.maxTexture3D[3]` contains the maximum 3D texture - dimensions. +@cython.embedsignature(True) +def cudaDeviceGetMemPool(int device): + """ Gets the current mempool for a device. - - :py:obj:`~.maxTexture3DAlt[3]` contains the maximum alternate 3D - texture dimensions. + Returns the last pool provided to :py:obj:`~.cudaDeviceSetMemPool` for + this device or the device's default memory pool if + :py:obj:`~.cudaDeviceSetMemPool` has never been called. By default the + current mempool is the default mempool for a device, otherwise the + returned pool must have been set with :py:obj:`~.cuDeviceSetMemPool` or + :py:obj:`~.cudaDeviceSetMemPool`. - - :py:obj:`~.maxTextureCubemap` is the maximum cubemap texture width or - height. + Parameters + ---------- + device : int + None - - :py:obj:`~.maxTexture1DLayered[2]` contains the maximum 1D layered - texture dimensions. + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :py:obj:`~.cudaErrorNotSupported` + memPool : :py:obj:`~.cudaMemPool_t` + None - - :py:obj:`~.maxTexture2DLayered[3]` contains the maximum 2D layered - texture dimensions. + See Also + -------- + :py:obj:`~.cuDeviceGetMemPool`, :py:obj:`~.cudaDeviceGetDefaultMemPool`, :py:obj:`~.cudaDeviceSetMemPool` + """ + cdef cudaMemPool_t memPool = cudaMemPool_t() + with nogil: + err = cyruntime.cudaDeviceGetMemPool(memPool._pvt_ptr, device) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, memPool) - - :py:obj:`~.maxTextureCubemapLayered[2]` contains the maximum cubemap - layered texture dimensions. +@cython.embedsignature(True) +def cudaDeviceGetNvSciSyncAttributes(nvSciSyncAttrList, int device, int flags): + """ Return NvSciSync attributes that this device can support. - - :py:obj:`~.maxSurface1D` is the maximum 1D surface size. + Returns in `nvSciSyncAttrList`, the properties of NvSciSync that this + CUDA device, `dev` can support. The returned `nvSciSyncAttrList` can be + used to create an NvSciSync that matches this device's capabilities. - - :py:obj:`~.maxSurface2D[2]` contains the maximum 2D surface - dimensions. + If NvSciSyncAttrKey_RequiredPerm field in `nvSciSyncAttrList` is + already set this API will return :py:obj:`~.cudaErrorInvalidValue`. - - :py:obj:`~.maxSurface3D[3]` contains the maximum 3D surface - dimensions. + The applications should set `nvSciSyncAttrList` to a valid + NvSciSyncAttrList failing which this API will return + :py:obj:`~.cudaErrorInvalidHandle`. - - :py:obj:`~.maxSurface1DLayered[2]` contains the maximum 1D layered - surface dimensions. + The `flags` controls how applications intends to use the NvSciSync + created from the `nvSciSyncAttrList`. The valid flags are: - - :py:obj:`~.maxSurface2DLayered[3]` contains the maximum 2D layered - surface dimensions. + - :py:obj:`~.cudaNvSciSyncAttrSignal`, specifies that the applications + intends to signal an NvSciSync on this CUDA device. - - :py:obj:`~.maxSurfaceCubemap` is the maximum cubemap surface width or - height. + - :py:obj:`~.cudaNvSciSyncAttrWait`, specifies that the applications + intends to wait on an NvSciSync on this CUDA device. - - :py:obj:`~.maxSurfaceCubemapLayered[2]` contains the maximum cubemap - layered surface dimensions. + At least one of these flags must be set, failing which the API returns + :py:obj:`~.cudaErrorInvalidValue`. Both the flags are orthogonal to one + another: a developer may set both these flags that allows to set both + wait and signal specific attributes in the same `nvSciSyncAttrList`. - - :py:obj:`~.surfaceAlignment` specifies the alignment requirements for - surfaces. + Note that this API updates the input `nvSciSyncAttrList` with values + equivalent to the following public attribute key-values: + NvSciSyncAttrKey_RequiredPerm is set to - - :py:obj:`~.concurrentKernels` is 1 if the device supports executing - multiple kernels within the same context simultaneously, or 0 if not. - It is not guaranteed that multiple kernels will be resident on the - device concurrently so this feature should not be relied upon for - correctness. + - NvSciSyncAccessPerm_SignalOnly if :py:obj:`~.cudaNvSciSyncAttrSignal` + is set in `flags`. - - :py:obj:`~.ECCEnabled` is 1 if the device has ECC support turned on, - or 0 if not. + - NvSciSyncAccessPerm_WaitOnly if :py:obj:`~.cudaNvSciSyncAttrWait` is + set in `flags`. - - :py:obj:`~.pciBusID` is the PCI bus identifier of the device. + - NvSciSyncAccessPerm_WaitSignal if both + :py:obj:`~.cudaNvSciSyncAttrWait` and + :py:obj:`~.cudaNvSciSyncAttrSignal` are set in `flags`. + NvSciSyncAttrKey_PrimitiveInfo is set to - - :py:obj:`~.pciDeviceID` is the PCI device (sometimes called slot) - identifier of the device. + - NvSciSyncAttrValPrimitiveType_SysmemSemaphore on any valid `device`. - - :py:obj:`~.pciDomainID` is the PCI domain identifier of the device. + - NvSciSyncAttrValPrimitiveType_Syncpoint if `device` is a Tegra + device. - - :py:obj:`~.tccDriver` is 1 if the device is using a TCC driver or 0 - if not. + - NvSciSyncAttrValPrimitiveType_SysmemSemaphorePayload64b if `device` + is GA10X+. NvSciSyncAttrKey_GpuId is set to the same UUID that is + returned in `cudaDeviceProp.uuid` from + :py:obj:`~.cudaDeviceGetProperties` for this `device`. - - :py:obj:`~.asyncEngineCount` is 1 when the device can concurrently - copy memory between host and device while executing a kernel. It is 2 - when the device can concurrently copy memory between host and device - in both directions and execute a kernel at the same time. It is 0 if - neither of these is supported. + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorDeviceUninitialized`, + :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidHandle`, + :py:obj:`~.cudaErrorInvalidDevice`, :py:obj:`~.cudaErrorNotSupported`, + :py:obj:`~.cudaErrorMemoryAllocation` - - :py:obj:`~.unifiedAddressing` is 1 if the device shares a unified - address space with the host and 0 otherwise. + Parameters + ---------- + nvSciSyncAttrList : Any + Return NvSciSync attributes supported. + device : int + Valid Cuda Device to get NvSciSync attributes for. + flags : int + flags describing NvSciSync usage. - - :py:obj:`~.memoryClockRate` is the peak memory clock frequency in - kilohertz. + Returns + ------- + cudaError_t - - :py:obj:`~.memoryBusWidth` is the memory bus width in bits. + See Also + -------- + :py:obj:`~.cudaImportExternalSemaphore`, :py:obj:`~.cudaDestroyExternalSemaphore`, :py:obj:`~.cudaSignalExternalSemaphoresAsync`, :py:obj:`~.cudaWaitExternalSemaphoresAsync` + """ + cdef _HelperInputVoidPtrStruct cynvSciSyncAttrListHelper + cdef void* cynvSciSyncAttrList = _helper_input_void_ptr(nvSciSyncAttrList, &cynvSciSyncAttrListHelper) + with nogil: + err = cyruntime.cudaDeviceGetNvSciSyncAttributes(cynvSciSyncAttrList, device, flags) + _helper_input_void_ptr_free(&cynvSciSyncAttrListHelper) + return (_cudaError_t(err),) - - :py:obj:`~.l2CacheSize` is L2 cache size in bytes. +@cython.embedsignature(True) +def cudaDeviceGetP2PAttribute(attr not None : cudaDeviceP2PAttr, int srcDevice, int dstDevice): + """ Queries attributes of the link between two devices. - - :py:obj:`~.persistingL2CacheMaxSize` is L2 cache's maximum persisting - lines size in bytes. + Returns in `*value` the value of the requested attribute `attrib` of + the link between `srcDevice` and `dstDevice`. The supported attributes + are: - - :py:obj:`~.maxThreadsPerMultiProcessor` is the number of maximum - resident threads per multiprocessor. + - :py:obj:`~.cudaDevP2PAttrPerformanceRank`: A relative value + indicating the performance of the link between two devices. Lower + value means better performance (0 being the value used for most + performant link). - - :py:obj:`~.streamPrioritiesSupported` is 1 if the device supports - stream priorities, or 0 if it is not supported. + - :py:obj:`~.cudaDevP2PAttrAccessSupported`: 1 if peer access is + enabled. - - :py:obj:`~.globalL1CacheSupported` is 1 if the device supports - caching of globals in L1 cache, or 0 if it is not supported. + - :py:obj:`~.cudaDevP2PAttrNativeAtomicSupported`: 1 if all native + atomic operations over the link are supported. - - :py:obj:`~.localL1CacheSupported` is 1 if the device supports caching - of locals in L1 cache, or 0 if it is not supported. + - :py:obj:`~.cudaDevP2PAttrCudaArrayAccessSupported`: 1 if accessing + CUDA arrays over the link is supported. - - :py:obj:`~.sharedMemPerMultiprocessor` is the maximum amount of - shared memory available to a multiprocessor in bytes; this amount is - shared by all thread blocks simultaneously resident on a - multiprocessor. + - :py:obj:`~.cudaDevP2PAttrOnlyPartialNativeAtomicSupported`: 1 if some + CUDA-valid atomic operations over the link are supported. Information + about specific operations can be retrieved with + :py:obj:`~.cudaDeviceGetP2PAtomicCapabilities`. - - :py:obj:`~.regsPerMultiprocessor` is the maximum number of 32-bit - registers available to a multiprocessor; this number is shared by all - thread blocks simultaneously resident on a multiprocessor. + Returns :py:obj:`~.cudaErrorInvalidDevice` if `srcDevice` or + `dstDevice` are not valid or if they represent the same device. - - :py:obj:`~.managedMemory` is 1 if the device supports allocating - managed memory on this system, or 0 if it is not supported. + Returns :py:obj:`~.cudaErrorInvalidValue` if `attrib` is not valid or + if `value` is a null pointer. - - :py:obj:`~.isMultiGpuBoard` is 1 if the device is on a multi-GPU - board (e.g. Gemini cards), and 0 if not; + Parameters + ---------- + attrib : :py:obj:`~.cudaDeviceP2PAttr` + The requested attribute of the link between `srcDevice` and + `dstDevice`. + srcDevice : int + The source device of the target link. + dstDevice : int + The destination device of the target link. - - :py:obj:`~.multiGpuBoardGroupID` is a unique identifier for a group - of devices associated with the same board. Devices on the same multi- - GPU board will share the same identifier. + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDevice`, :py:obj:`~.cudaErrorInvalidValue` + value : int + Returned value of the requested attribute - - :py:obj:`~.hostNativeAtomicSupported` is 1 if the link between the - device and the host supports native atomic operations, or 0 if it is - not supported. + See Also + -------- + :py:obj:`~.cudaDeviceEnablePeerAccess`, :py:obj:`~.cudaDeviceDisablePeerAccess`, :py:obj:`~.cudaDeviceCanAccessPeer`, :py:obj:`~.cuDeviceGetP2PAttribute` :py:obj:`~.cudaDeviceGetP2PAtomicCapabilities` + """ + cdef int value = 0 + cdef cyruntime.cudaDeviceP2PAttr cyattr = int(attr) + with nogil: + err = cyruntime.cudaDeviceGetP2PAttribute(&value, cyattr, srcDevice, dstDevice) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, value) - - :py:obj:`~.singleToDoublePrecisionPerfRatio` is the ratio of single - precision performance (in floating-point operations per second) to - double precision performance. +@cython.embedsignature(True) +def cudaDeviceGetP2PAtomicCapabilities(operations : Optional[tuple[cudaAtomicOperation] | list[cudaAtomicOperation]], unsigned int count, int srcDevice, int dstDevice): + """ Queries details about atomic operations supported between two devices. - - :py:obj:`~.pageableMemoryAccess` is 1 if the device supports - coherently accessing pageable memory without calling cudaHostRegister - on it, and 0 otherwise. + Returns in `*capabilities` the details about requested atomic + `*operations` over the the link between `srcDevice` and `dstDevice`. + The allocated size of `*operations` and `*capabilities` must be + `count`. - - :py:obj:`~.concurrentManagedAccess` is 1 if the device can coherently - access managed memory concurrently with the CPU, and 0 otherwise. + For each :py:obj:`~.cudaAtomicOperation` in `*operations`, the + corresponding result in `*capabilities` will be a bitmask indicating + which of :py:obj:`~.cudaAtomicOperationCapability` the link supports + natively. - - :py:obj:`~.computePreemptionSupported` is 1 if the device supports - Compute Preemption, and 0 otherwise. + Returns :py:obj:`~.cudaErrorInvalidDevice` if `srcDevice` or + `dstDevice` are not valid or if they represent the same device. - - :py:obj:`~.canUseHostPointerForRegisteredMem` is 1 if the device can - access host registered memory at the same virtual address as the CPU, - and 0 otherwise. + Returns :py:obj:`~.cudaErrorInvalidValue` if `*capabilities` or + `*operations` is NULL, if `count` is 0, or if any of `*operations` is + not valid. - - :py:obj:`~.cooperativeLaunch` is 1 if the device supports launching - cooperative kernels via :py:obj:`~.cudaLaunchCooperativeKernel`, and - 0 otherwise. + Parameters + ---------- + operations : list[:py:obj:`~.cudaAtomicOperation`] + Requested operations + count : unsigned int + Count of requested operations and size of capabilities + srcDevice : int + The source device of the target link + dstDevice : int + The destination device of the target link - - :py:obj:`~.cooperativeMultiDeviceLaunch` is 1 if the device supports - launching cooperative kernels via - :py:obj:`~.cudaLaunchCooperativeKernelMultiDevice`, and 0 otherwise. + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDevice`, :py:obj:`~.cudaErrorInvalidValue` + capabilities : list[unsigned int] + Returned capability details of each requested operation - - :py:obj:`~.sharedMemPerBlockOptin` is the per device maximum shared - memory per block usable by special opt in + See Also + -------- + :py:obj:`~.cudaDeviceGetP2PAttribute`, :py:obj:`~.cuDeviceGetP2PAttribute`, :py:obj:`~.cuDeviceGetP2PAtomicCapabilities` + """ + operations = [] if operations is None else operations + if not all(isinstance(_x, (cudaAtomicOperation)) for _x in operations): + raise TypeError("Argument 'operations' is not instance of type (expected tuple[cyruntime.cudaAtomicOperation] or list[cyruntime.cudaAtomicOperation]") + cdef unsigned int* cycapabilities = NULL + pycapabilities = [] + if count != 0: + cycapabilities = calloc(count, sizeof(unsigned int)) + if cycapabilities is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(count) + 'x' + str(sizeof(unsigned int))) + cdef vector[cyruntime.cudaAtomicOperation] cyoperations = operations + if count > len(operations): raise RuntimeError("List is too small: " + str(len(operations)) + " < " + str(count)) + with nogil: + err = cyruntime.cudaDeviceGetP2PAtomicCapabilities(cycapabilities, cyoperations.data(), count, srcDevice, dstDevice) + if cudaError_t(err) == cudaError_t(0): + pycapabilities = [cycapabilities[idx] for idx in range(count)] + if cycapabilities is not NULL: + free(cycapabilities) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, pycapabilities) - - :py:obj:`~.pageableMemoryAccessUsesHostPageTables` is 1 if the device - accesses pageable memory via the host's page tables, and 0 otherwise. +@cython.embedsignature(True) +def cudaChooseDevice(prop : Optional[cudaDeviceProp]): + """ Select compute-device which best matches criteria. - - :py:obj:`~.directManagedMemAccessFromHost` is 1 if the host can - directly access managed memory on the device without migration, and 0 - otherwise. + Returns in `*device` the device which has properties that best match + `*prop`. - - :py:obj:`~.maxBlocksPerMultiProcessor` is the maximum number of - thread blocks that can reside on a multiprocessor. + Parameters + ---------- + prop : :py:obj:`~.cudaDeviceProp` + Desired device properties - - :py:obj:`~.accessPolicyMaxWindowSize` is the maximum value of - :py:obj:`~.cudaAccessPolicyWindow.num_bytes`. + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + device : int + Device with best match - - :py:obj:`~.reservedSharedMemPerBlock` is the shared memory reserved - by CUDA driver per block in bytes + See Also + -------- + :py:obj:`~.cudaGetDeviceCount`, :py:obj:`~.cudaGetDevice`, :py:obj:`~.cudaSetDevice`, :py:obj:`~.cudaGetDeviceProperties`, :py:obj:`~.cudaInitDevice` + """ + cdef int device = 0 + cdef cyruntime.cudaDeviceProp* cyprop_ptr = prop._pvt_ptr if prop is not None else NULL + with nogil: + err = cyruntime.cudaChooseDevice(&device, cyprop_ptr) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, device) - - :py:obj:`~.hostRegisterSupported` is 1 if the device supports host - memory registration via :py:obj:`~.cudaHostRegister`, and 0 - otherwise. +@cython.embedsignature(True) +def cudaInitDevice(int device, unsigned int deviceFlags, unsigned int flags): + """ Initialize device to be used for GPU executions. - - :py:obj:`~.sparseCudaArraySupported` is 1 if the device supports - sparse CUDA arrays and sparse CUDA mipmapped arrays, 0 otherwise + This function will initialize the CUDA Runtime structures and primary + context on `device` when called, but the context will not be made + current to `device`. - - :py:obj:`~.hostRegisterReadOnlySupported` is 1 if the device supports - using the :py:obj:`~.cudaHostRegister` flag cudaHostRegisterReadOnly - to register memory that must be mapped as read-only to the GPU + When :py:obj:`~.cudaInitDeviceFlagsAreValid` is set in `flags`, + deviceFlags are applied to the requested device. The values of + deviceFlags match those of the flags parameters in + :py:obj:`~.cudaSetDeviceFlags`. The effect may be verified by + :py:obj:`~.cudaGetDeviceFlags`. - - :py:obj:`~.timelineSemaphoreInteropSupported` is 1 if external - timeline semaphore interop is supported on the device, 0 otherwise + This function will return an error if the device is in + :py:obj:`~.cudaComputeModeExclusiveProcess` and is occupied by another + process or if the device is in :py:obj:`~.cudaComputeModeProhibited`. - - :py:obj:`~.memoryPoolsSupported` is 1 if the device supports using - the cudaMallocAsync and cudaMemPool family of APIs, 0 otherwise + Parameters + ---------- + device : int + Device on which the runtime will initialize itself. + deviceFlags : unsigned int + Parameters for device operation. + flags : unsigned int + Flags for controlling the device initialization. - - :py:obj:`~.gpuDirectRDMASupported` is 1 if the device supports - GPUDirect RDMA APIs, 0 otherwise + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDevice`, - - :py:obj:`~.gpuDirectRDMAFlushWritesOptions` is a bitmask to be - interpreted according to the - :py:obj:`~.cudaFlushGPUDirectRDMAWritesOptions` enum + See Also + -------- + :py:obj:`~.cudaGetDeviceCount`, :py:obj:`~.cudaGetDevice`, :py:obj:`~.cudaGetDeviceProperties`, :py:obj:`~.cudaChooseDevice`, :py:obj:`~.cudaSetDevice` :py:obj:`~.cuCtxSetCurrent` + """ + with nogil: + err = cyruntime.cudaInitDevice(device, deviceFlags, flags) + return (_cudaError_t(err),) - - :py:obj:`~.gpuDirectRDMAWritesOrdering` See the - :py:obj:`~.cudaGPUDirectRDMAWritesOrdering` enum for numerical values +@cython.embedsignature(True) +def cudaSetDevice(int device): + """ Set device to be used for GPU executions. - - :py:obj:`~.memoryPoolSupportedHandleTypes` is a bitmask of handle - types supported with mempool-based IPC + Sets `device` as the current device for the calling host thread. Valid + device id's are 0 to (:py:obj:`~.cudaGetDeviceCount()` - 1). - - :py:obj:`~.deferredMappingCudaArraySupported` is 1 if the device - supports deferred mapping CUDA arrays and CUDA mipmapped arrays + Any device memory subsequently allocated from this host thread using + :py:obj:`~.cudaMalloc()`, :py:obj:`~.cudaMallocPitch()` or + :py:obj:`~.cudaMallocArray()` will be physically resident on `device`. + Any host memory allocated from this host thread using + :py:obj:`~.cudaMallocHost()` or :py:obj:`~.cudaHostAlloc()` or + :py:obj:`~.cudaHostRegister()` will have its lifetime associated with + `device`. Any streams or events created from this host thread will be + associated with `device`. Any kernels launched from this host thread + using the <<<>>> operator or :py:obj:`~.cudaLaunchKernel()` will be + executed on `device`. - - :py:obj:`~.ipcEventSupported` is 1 if the device supports IPC Events, - and 0 otherwise + This call may be made from any host thread, to any device, and at any + time. This function will do no synchronization with the previous or new + device, and should only take significant time when it initializes the + runtime's context state. This call will bind the primary context of the + specified device to the calling thread and all the subsequent memory + allocations, stream and event creations, and kernel launches will be + associated with the primary context. This function will also + immediately initialize the runtime state on the primary context, and + the context will be current on `device` immediately. This function will + return an error if the device is in + :py:obj:`~.cudaComputeModeExclusiveProcess` and is occupied by another + process or if the device is in :py:obj:`~.cudaComputeModeProhibited`. - - :py:obj:`~.unifiedFunctionPointers` is 1 if the device support - unified pointers, and 0 otherwise + It is not required to call :py:obj:`~.cudaInitDevice` before using this + function. Parameters ---------- device : int - Device number to get properties for + Device on which the active host thread should execute the device + code. Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDevice` - prop : :py:obj:`~.cudaDeviceProp` - Properties for the specified device + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDevice`, :py:obj:`~.cudaErrorDeviceUnavailable`, See Also -------- - :py:obj:`~.cudaGetDeviceCount`, :py:obj:`~.cudaGetDevice`, :py:obj:`~.cudaSetDevice`, :py:obj:`~.cudaChooseDevice`, :py:obj:`~.cudaDeviceGetAttribute`, :py:obj:`~.cudaInitDevice`, :py:obj:`~.cuDeviceGetAttribute`, :py:obj:`~.cuDeviceGetName` + :py:obj:`~.cudaGetDeviceCount`, :py:obj:`~.cudaGetDevice`, :py:obj:`~.cudaGetDeviceProperties`, :py:obj:`~.cudaChooseDevice`, :py:obj:`~.cudaInitDevice`, :py:obj:`~.cuCtxSetCurrent` """ - cdef cudaDeviceProp prop = cudaDeviceProp() - err = ccudart.cudaGetDeviceProperties(prop._ptr, device) - return (cudaError_t(err), prop) -{{endif}} - -{{if 'cudaDeviceGetAttribute' in found_functions}} + with nogil: + err = cyruntime.cudaSetDevice(device) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaDeviceGetAttribute(attr not None : cudaDeviceAttr, int device): - """ Returns information about the device. - - Returns in `*value` the integer value of the attribute `attr` on device - `device`. The supported attributes are: - - - :py:obj:`~.cudaDevAttrMaxThreadsPerBlock`: Maximum number of threads - per block - - - :py:obj:`~.cudaDevAttrMaxBlockDimX`: Maximum x-dimension of a block - - - :py:obj:`~.cudaDevAttrMaxBlockDimY`: Maximum y-dimension of a block - - - :py:obj:`~.cudaDevAttrMaxBlockDimZ`: Maximum z-dimension of a block - - - :py:obj:`~.cudaDevAttrMaxGridDimX`: Maximum x-dimension of a grid - - - :py:obj:`~.cudaDevAttrMaxGridDimY`: Maximum y-dimension of a grid - - - :py:obj:`~.cudaDevAttrMaxGridDimZ`: Maximum z-dimension of a grid - - - :py:obj:`~.cudaDevAttrMaxSharedMemoryPerBlock`: Maximum amount of - shared memory available to a thread block in bytes - - - :py:obj:`~.cudaDevAttrTotalConstantMemory`: Memory available on - device for constant variables in a CUDA C kernel in bytes - - - :py:obj:`~.cudaDevAttrWarpSize`: Warp size in threads - - - :py:obj:`~.cudaDevAttrMaxPitch`: Maximum pitch in bytes allowed by - the memory copy functions that involve memory regions allocated - through :py:obj:`~.cudaMallocPitch()` +def cudaGetDevice(): + """ Returns which device is currently being used. - - :py:obj:`~.cudaDevAttrMaxTexture1DWidth`: Maximum 1D texture width + Returns in `*device` the current device for the calling host thread. - - :py:obj:`~.cudaDevAttrMaxTexture1DLinearWidth`: Maximum width for a - 1D texture bound to linear memory + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorDeviceUnavailable`, + device : int + Returns the device on which the active host thread executes the + device code. - - :py:obj:`~.cudaDevAttrMaxTexture1DMipmappedWidth`: Maximum mipmapped - 1D texture width + See Also + -------- + :py:obj:`~.cudaGetDeviceCount`, :py:obj:`~.cudaSetDevice`, :py:obj:`~.cudaGetDeviceProperties`, :py:obj:`~.cudaChooseDevice`, :py:obj:`~.cuCtxGetCurrent` + """ + cdef int device = 0 + with nogil: + err = cyruntime.cudaGetDevice(&device) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, device) - - :py:obj:`~.cudaDevAttrMaxTexture2DWidth`: Maximum 2D texture width +@cython.embedsignature(True) +def cudaSetDeviceFlags(unsigned int flags): + """ Sets flags to be used for device executions. - - :py:obj:`~.cudaDevAttrMaxTexture2DHeight`: Maximum 2D texture height + Records `flags` as the flags for the current device. If the current + device has been set and that device has already been initialized, the + previous flags are overwritten. If the current device has not been + initialized, it is initialized with the provided flags. If no device + has been made current to the calling thread, a default device is + selected and initialized with the provided flags. - - :py:obj:`~.cudaDevAttrMaxTexture2DLinearWidth`: Maximum width for a - 2D texture bound to linear memory + The three LSBs of the `flags` parameter can be used to control how the + CPU thread interacts with the OS scheduler when waiting for results + from the device. - - :py:obj:`~.cudaDevAttrMaxTexture2DLinearHeight`: Maximum height for a - 2D texture bound to linear memory + - :py:obj:`~.cudaDeviceScheduleAuto`: The default value if the `flags` + parameter is zero, uses a heuristic based on the number of active + CUDA contexts in the process `C` and the number of logical processors + in the system `P`. If `C` > `P`, then CUDA will yield to other OS + threads when waiting for the device, otherwise CUDA will not yield + while waiting for results and actively spin on the processor. + Additionally, on Tegra devices, :py:obj:`~.cudaDeviceScheduleAuto` + uses a heuristic based on the power profile of the platform and may + choose :py:obj:`~.cudaDeviceScheduleBlockingSync` for low-powered + devices. - - :py:obj:`~.cudaDevAttrMaxTexture2DLinearPitch`: Maximum pitch in - bytes for a 2D texture bound to linear memory + - :py:obj:`~.cudaDeviceScheduleSpin`: Instruct CUDA to actively spin + when waiting for results from the device. This can decrease latency + when waiting for the device, but may lower the performance of CPU + threads if they are performing work in parallel with the CUDA thread. - - :py:obj:`~.cudaDevAttrMaxTexture2DMipmappedWidth`: Maximum mipmapped - 2D texture width + - :py:obj:`~.cudaDeviceScheduleYield`: Instruct CUDA to yield its + thread when waiting for results from the device. This can increase + latency when waiting for the device, but can increase the performance + of CPU threads performing work in parallel with the device. - - :py:obj:`~.cudaDevAttrMaxTexture2DMipmappedHeight`: Maximum mipmapped - 2D texture height + - :py:obj:`~.cudaDeviceScheduleBlockingSync`: Instruct CUDA to block + the CPU thread on a synchronization primitive when waiting for the + device to finish work. - - :py:obj:`~.cudaDevAttrMaxTexture3DWidth`: Maximum 3D texture width + - :py:obj:`~.cudaDeviceBlockingSync`: Instruct CUDA to block the CPU + thread on a synchronization primitive when waiting for the device to + finish work. :py:obj:`~.Deprecated:` This flag was deprecated as of + CUDA 4.0 and replaced with + :py:obj:`~.cudaDeviceScheduleBlockingSync`. - - :py:obj:`~.cudaDevAttrMaxTexture3DHeight`: Maximum 3D texture height + - :py:obj:`~.cudaDeviceMapHost`: This flag enables allocating pinned + host memory that is accessible to the device. It is implicit for the + runtime but may be absent if a context is created using the driver + API. If this flag is not set, :py:obj:`~.cudaHostGetDevicePointer()` + will always return a failure code. - - :py:obj:`~.cudaDevAttrMaxTexture3DDepth`: Maximum 3D texture depth + - :py:obj:`~.cudaDeviceLmemResizeToMax`: Instruct CUDA to not reduce + local memory after resizing local memory for a kernel. This can + prevent thrashing by local memory allocations when launching many + kernels with high local memory usage at the cost of potentially + increased memory usage. :py:obj:`~.Deprecated:` This flag is + deprecated and the behavior enabled by this flag is now the default + and cannot be disabled. - - :py:obj:`~.cudaDevAttrMaxTexture3DWidthAlt`: Alternate maximum 3D - texture width, 0 if no alternate maximum 3D texture size is supported + - :py:obj:`~.cudaDeviceSyncMemops`: Ensures that synchronous memory + operations initiated on this context will always synchronize. See + further documentation in the section titled "API Synchronization + behavior" to learn more about cases when synchronous memory + operations can exhibit asynchronous behavior. - - :py:obj:`~.cudaDevAttrMaxTexture3DHeightAlt`: Alternate maximum 3D - texture height, 0 if no alternate maximum 3D texture size is - supported + Parameters + ---------- + flags : unsigned int + Parameters for device operation - - :py:obj:`~.cudaDevAttrMaxTexture3DDepthAlt`: Alternate maximum 3D - texture depth, 0 if no alternate maximum 3D texture size is supported + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` - - :py:obj:`~.cudaDevAttrMaxTextureCubemapWidth`: Maximum cubemap - texture width or height + See Also + -------- + :py:obj:`~.cudaGetDeviceFlags`, :py:obj:`~.cudaGetDeviceCount`, :py:obj:`~.cudaGetDevice`, :py:obj:`~.cudaGetDeviceProperties`, :py:obj:`~.cudaSetDevice`, :py:obj:`~.cudaSetValidDevices`, :py:obj:`~.cudaInitDevice`, :py:obj:`~.cudaChooseDevice`, :py:obj:`~.cuDevicePrimaryCtxSetFlags` + """ + with nogil: + err = cyruntime.cudaSetDeviceFlags(flags) + return (_cudaError_t(err),) - - :py:obj:`~.cudaDevAttrMaxTexture1DLayeredWidth`: Maximum 1D layered - texture width +@cython.embedsignature(True) +def cudaGetDeviceFlags(): + """ Gets the flags for the current device. - - :py:obj:`~.cudaDevAttrMaxTexture1DLayeredLayers`: Maximum layers in a - 1D layered texture + Returns in `flags` the flags for the current device. If there is a + current device for the calling thread, the flags for the device are + returned. If there is no current device, the flags for the first device + are returned, which may be the default flags. Compare to the behavior + of :py:obj:`~.cudaSetDeviceFlags`. - - :py:obj:`~.cudaDevAttrMaxTexture2DLayeredWidth`: Maximum 2D layered - texture width + Typically, the flags returned should match the behavior that will be + seen if the calling thread uses a device after this call, without any + change to the flags or current device inbetween by this or another + thread. Note that if the device is not initialized, it is possible for + another thread to change the flags for the current device before it is + initialized. Additionally, when using exclusive mode, if this thread + has not requested a specific device, it may use a device other than the + first device, contrary to the assumption made by this function. - - :py:obj:`~.cudaDevAttrMaxTexture2DLayeredHeight`: Maximum 2D layered - texture height + If a context has been created via the driver API and is current to the + calling thread, the flags for that context are always returned. - - :py:obj:`~.cudaDevAttrMaxTexture2DLayeredLayers`: Maximum layers in a - 2D layered texture + Flags returned by this function may specifically include + :py:obj:`~.cudaDeviceMapHost` even though it is not accepted by + :py:obj:`~.cudaSetDeviceFlags` because it is implicit in runtime API + flags. The reason for this is that the current context may have been + created via the driver API in which case the flag is not implicit and + may be unset. - - :py:obj:`~.cudaDevAttrMaxTextureCubemapLayeredWidth`: Maximum cubemap - layered texture width or height + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDevice` + flags : unsigned int + Pointer to store the device flags - - :py:obj:`~.cudaDevAttrMaxTextureCubemapLayeredLayers`: Maximum layers - in a cubemap layered texture + See Also + -------- + :py:obj:`~.cudaGetDevice`, :py:obj:`~.cudaGetDeviceProperties`, :py:obj:`~.cudaSetDevice`, :py:obj:`~.cudaSetDeviceFlags`, :py:obj:`~.cudaInitDevice`, :py:obj:`~.cuCtxGetFlags`, :py:obj:`~.cuDevicePrimaryCtxGetState` + """ + cdef unsigned int flags = 0 + with nogil: + err = cyruntime.cudaGetDeviceFlags(&flags) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, flags) - - :py:obj:`~.cudaDevAttrMaxSurface1DWidth`: Maximum 1D surface width +@cython.embedsignature(True) +def cudaStreamCreate(): + """ Create an asynchronous stream. - - :py:obj:`~.cudaDevAttrMaxSurface2DWidth`: Maximum 2D surface width + Creates a new asynchronous stream on the context that is current to the + calling host thread. If no context is current to the calling host + thread, then the primary context for a device is selected, made current + to the calling thread, and initialized before creating a stream on it. - - :py:obj:`~.cudaDevAttrMaxSurface2DHeight`: Maximum 2D surface height + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :py:obj:`~.cudaErrorExternalDevice` + pStream : :py:obj:`~.cudaStream_t` + Pointer to new stream identifier - - :py:obj:`~.cudaDevAttrMaxSurface3DWidth`: Maximum 3D surface width + See Also + -------- + :py:obj:`~.cudaStreamCreateWithPriority`, :py:obj:`~.cudaStreamCreateWithFlags`, :py:obj:`~.cudaStreamGetPriority`, :py:obj:`~.cudaStreamGetFlags`, :py:obj:`~.cudaStreamGetDevice`, :py:obj:`~.cudaStreamGetDevResource`, :py:obj:`~.cudaStreamQuery`, :py:obj:`~.cudaStreamSynchronize`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cudaStreamAddCallback`, :py:obj:`~.cudaSetDevice`, :py:obj:`~.cudaStreamDestroy`, :py:obj:`~.cuStreamCreate` + """ + cdef cudaStream_t pStream = cudaStream_t() + with nogil: + err = cyruntime.cudaStreamCreate(pStream._pvt_ptr) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, pStream) - - :py:obj:`~.cudaDevAttrMaxSurface3DHeight`: Maximum 3D surface height +@cython.embedsignature(True) +def cudaStreamCreateWithFlags(unsigned int flags): + """ Create an asynchronous stream. - - :py:obj:`~.cudaDevAttrMaxSurface3DDepth`: Maximum 3D surface depth + Creates a new asynchronous stream on the context that is current to the + calling host thread. If no context is current to the calling host + thread, then the primary context for a device is selected, made current + to the calling thread, and initialized before creating a stream on it. + The `flags` argument determines the behaviors of the stream. Valid + values for `flags` are - - :py:obj:`~.cudaDevAttrMaxSurface1DLayeredWidth`: Maximum 1D layered - surface width + - :py:obj:`~.cudaStreamDefault`: Default stream creation flag. - - :py:obj:`~.cudaDevAttrMaxSurface1DLayeredLayers`: Maximum layers in a - 1D layered surface + - :py:obj:`~.cudaStreamNonBlocking`: Specifies that work running in the + created stream may run concurrently with work in stream 0 (the NULL + stream), and that the created stream should perform no implicit + synchronization with stream 0. - - :py:obj:`~.cudaDevAttrMaxSurface2DLayeredWidth`: Maximum 2D layered - surface width + Parameters + ---------- + flags : unsigned int + Parameters for stream creation - - :py:obj:`~.cudaDevAttrMaxSurface2DLayeredHeight`: Maximum 2D layered - surface height + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :py:obj:`~.cudaErrorExternalDevice` + pStream : :py:obj:`~.cudaStream_t` + Pointer to new stream identifier - - :py:obj:`~.cudaDevAttrMaxSurface2DLayeredLayers`: Maximum layers in a - 2D layered surface + See Also + -------- + :py:obj:`~.cudaStreamCreate`, :py:obj:`~.cudaStreamCreateWithPriority`, :py:obj:`~.cudaStreamGetFlags`, :py:obj:`~.cudaStreamGetDevice`, :py:obj:`~.cudaStreamGetDevResource`, :py:obj:`~.cudaStreamQuery`, :py:obj:`~.cudaStreamSynchronize`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cudaStreamAddCallback`, :py:obj:`~.cudaSetDevice`, :py:obj:`~.cudaStreamDestroy`, :py:obj:`~.cuStreamCreate` + """ + cdef cudaStream_t pStream = cudaStream_t() + with nogil: + err = cyruntime.cudaStreamCreateWithFlags(pStream._pvt_ptr, flags) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, pStream) - - :py:obj:`~.cudaDevAttrMaxSurfaceCubemapWidth`: Maximum cubemap - surface width +@cython.embedsignature(True) +def cudaStreamCreateWithPriority(unsigned int flags, int priority): + """ Create an asynchronous stream with the specified priority. - - :py:obj:`~.cudaDevAttrMaxSurfaceCubemapLayeredWidth`: Maximum cubemap - layered surface width + Creates a stream with the specified priority and returns a handle in + `pStream`. The stream is created on the context that is current to the + calling host thread. If no context is current to the calling host + thread, then the primary context for a device is selected, made current + to the calling thread, and initialized before creating a stream on it. + This affects the scheduling priority of work in the stream. Priorities + provide a hint to preferentially run work with higher priority when + possible, but do not preempt already-running work or provide any other + functional guarantee on execution order. - - :py:obj:`~.cudaDevAttrMaxSurfaceCubemapLayeredLayers`: Maximum layers - in a cubemap layered surface + `priority` follows a convention where lower numbers represent higher + priorities. '0' represents default priority. The range of meaningful + numerical priorities can be queried using + :py:obj:`~.cudaDeviceGetStreamPriorityRange`. If the specified priority + is outside the numerical range returned by + :py:obj:`~.cudaDeviceGetStreamPriorityRange`, it will automatically be + clamped to the lowest or the highest number in the range. - - :py:obj:`~.cudaDevAttrMaxRegistersPerBlock`: Maximum number of 32-bit - registers available to a thread block + Parameters + ---------- + flags : unsigned int + Flags for stream creation. See + :py:obj:`~.cudaStreamCreateWithFlags` for a list of valid flags + that can be passed + priority : int + Priority of the stream. Lower numbers represent higher priorities. + See :py:obj:`~.cudaDeviceGetStreamPriorityRange` for more + information about the meaningful stream priorities that can be + passed. - - :py:obj:`~.cudaDevAttrClockRate`: Peak clock frequency in kilohertz + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :py:obj:`~.cudaErrorExternalDevice` + pStream : :py:obj:`~.cudaStream_t` + Pointer to new stream identifier - - :py:obj:`~.cudaDevAttrTextureAlignment`: Alignment requirement; - texture base addresses aligned to :py:obj:`~.textureAlign` bytes do - not need an offset applied to texture fetches + See Also + -------- + :py:obj:`~.cudaStreamCreate`, :py:obj:`~.cudaStreamCreateWithFlags`, :py:obj:`~.cudaDeviceGetStreamPriorityRange`, :py:obj:`~.cudaStreamGetPriority`, :py:obj:`~.cudaStreamQuery`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cudaStreamAddCallback`, :py:obj:`~.cudaStreamSynchronize`, :py:obj:`~.cudaSetDevice`, :py:obj:`~.cudaStreamDestroy`, :py:obj:`~.cuStreamCreateWithPriority` - - :py:obj:`~.cudaDevAttrTexturePitchAlignment`: Pitch alignment - requirement for 2D texture references bound to pitched memory + Notes + ----- + Stream priorities are supported only on GPUs with compute capability 3.5 or higher. - - :py:obj:`~.cudaDevAttrGpuOverlap`: 1 if the device can concurrently - copy memory between host and device while executing a kernel, or 0 if - not + In the current implementation, only compute kernels launched in priority streams are affected by the stream's priority. Stream priorities have no effect on host-to-device and device-to-host memory operations. + """ + cdef cudaStream_t pStream = cudaStream_t() + with nogil: + err = cyruntime.cudaStreamCreateWithPriority(pStream._pvt_ptr, flags, priority) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, pStream) - - :py:obj:`~.cudaDevAttrMultiProcessorCount`: Number of multiprocessors - on the device +@cython.embedsignature(True) +def cudaStreamGetPriority(hStream): + """ Query the priority of a stream. - - :py:obj:`~.cudaDevAttrKernelExecTimeout`: 1 if there is a run time - limit for kernels executed on the device, or 0 if not + Query the priority of a stream. The priority is returned in in + `priority`. Note that if the stream was created with a priority outside + the meaningful numerical range returned by + :py:obj:`~.cudaDeviceGetStreamPriorityRange`, this function returns the + clamped priority. See :py:obj:`~.cudaStreamCreateWithPriority` for + details about priority clamping. - - :py:obj:`~.cudaDevAttrIntegrated`: 1 if the device is integrated with - the memory subsystem, or 0 if not + Parameters + ---------- + hStream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + Handle to the stream to be queried - - :py:obj:`~.cudaDevAttrCanMapHostMemory`: 1 if the device can map host - memory into the CUDA address space, or 0 if not + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle` + priority : int + Pointer to a signed integer in which the stream's priority is + returned - - :py:obj:`~.cudaDevAttrComputeMode`: Compute mode is the compute mode - that the device is currently in. Available modes are as follows: + See Also + -------- + :py:obj:`~.cudaStreamCreateWithPriority`, :py:obj:`~.cudaDeviceGetStreamPriorityRange`, :py:obj:`~.cudaStreamGetFlags`, :py:obj:`~.cudaStreamGetDevice`, :py:obj:`~.cudaStreamGetDevResource`, :py:obj:`~.cuStreamGetPriority` + """ + cdef cyruntime.cudaStream_t cyhStream + if hStream is None: + phStream = 0 + elif isinstance(hStream, (cudaStream_t,driver.CUstream)): + phStream = int(hStream) + else: + phStream = int(cudaStream_t(hStream)) + cyhStream = phStream + cdef int priority = 0 + with nogil: + err = cyruntime.cudaStreamGetPriority(cyhStream, &priority) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, priority) - - :py:obj:`~.cudaComputeModeDefault`: Default mode - Device is not - restricted and multiple threads can use :py:obj:`~.cudaSetDevice()` - with this device. +@cython.embedsignature(True) +def cudaStreamGetFlags(hStream): + """ Query the flags of a stream. - - :py:obj:`~.cudaComputeModeProhibited`: Compute-prohibited mode - No - threads can use :py:obj:`~.cudaSetDevice()` with this device. + Query the flags of a stream. The flags are returned in `flags`. See + :py:obj:`~.cudaStreamCreateWithFlags` for a list of valid flags. - - :py:obj:`~.cudaComputeModeExclusiveProcess`: Compute-exclusive- - process mode - Many threads in one process will be able to use - :py:obj:`~.cudaSetDevice()` with this device. + Parameters + ---------- + hStream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + Handle to the stream to be queried - - :py:obj:`~.cudaDevAttrConcurrentKernels`: 1 if the device supports - executing multiple kernels within the same context simultaneously, or - 0 if not. It is not guaranteed that multiple kernels will be resident - on the device concurrently so this feature should not be relied upon - for correctness. + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle` + flags : unsigned int + Pointer to an unsigned integer in which the stream's flags are + returned - - :py:obj:`~.cudaDevAttrEccEnabled`: 1 if error correction is enabled - on the device, 0 if error correction is disabled or not supported by - the device + See Also + -------- + :py:obj:`~.cudaStreamCreateWithPriority`, :py:obj:`~.cudaStreamCreateWithFlags`, :py:obj:`~.cudaStreamGetPriority`, :py:obj:`~.cudaStreamGetDevice`, :py:obj:`~.cuStreamGetFlags` + """ + cdef cyruntime.cudaStream_t cyhStream + if hStream is None: + phStream = 0 + elif isinstance(hStream, (cudaStream_t,driver.CUstream)): + phStream = int(hStream) + else: + phStream = int(cudaStream_t(hStream)) + cyhStream = phStream + cdef unsigned int flags = 0 + with nogil: + err = cyruntime.cudaStreamGetFlags(cyhStream, &flags) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, flags) - - :py:obj:`~.cudaDevAttrPciBusId`: PCI bus identifier of the device +@cython.embedsignature(True) +def cudaStreamGetId(hStream): + """ Query the Id of a stream. - - :py:obj:`~.cudaDevAttrPciDeviceId`: PCI device (also known as slot) - identifier of the device + Query the Id of a stream. The Id is returned in `streamId`. The Id is + unique for the life of the program. - - :py:obj:`~.cudaDevAttrTccDriver`: 1 if the device is using a TCC - driver. TCC is only available on Tesla hardware running Windows Vista - or later. + The stream handle `hStream` can refer to any of the following: - - :py:obj:`~.cudaDevAttrMemoryClockRate`: Peak memory clock frequency - in kilohertz + - a stream created via any of the CUDA runtime APIs such as + :py:obj:`~.cudaStreamCreate`, :py:obj:`~.cudaStreamCreateWithFlags` + and :py:obj:`~.cudaStreamCreateWithPriority`, or their driver API + equivalents such as :py:obj:`~.cuStreamCreate` or + :py:obj:`~.cuStreamCreateWithPriority`. Passing an invalid handle + will result in undefined behavior. - - :py:obj:`~.cudaDevAttrGlobalMemoryBusWidth`: Global memory bus width - in bits + - any of the special streams such as the NULL stream, + :py:obj:`~.cudaStreamLegacy` and :py:obj:`~.cudaStreamPerThread` + respectively. The driver API equivalents of these are also accepted + which are NULL, :py:obj:`~.CU_STREAM_LEGACY` and + :py:obj:`~.CU_STREAM_PER_THREAD`. - - :py:obj:`~.cudaDevAttrL2CacheSize`: Size of L2 cache in bytes. 0 if - the device doesn't have L2 cache. + Parameters + ---------- + hStream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + Handle to the stream to be queried - - :py:obj:`~.cudaDevAttrMaxThreadsPerMultiProcessor`: Maximum resident - threads per multiprocessor + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle` + streamId : unsigned long long + Pointer to an unsigned long long in which the stream Id is returned - - :py:obj:`~.cudaDevAttrUnifiedAddressing`: 1 if the device shares a - unified address space with the host, or 0 if not + See Also + -------- + :py:obj:`~.cudaStreamCreateWithPriority`, :py:obj:`~.cudaStreamCreateWithFlags`, :py:obj:`~.cudaStreamGetPriority`, :py:obj:`~.cudaStreamGetFlags`, :py:obj:`~.cuStreamGetId` + """ + cdef cyruntime.cudaStream_t cyhStream + if hStream is None: + phStream = 0 + elif isinstance(hStream, (cudaStream_t,driver.CUstream)): + phStream = int(hStream) + else: + phStream = int(cudaStream_t(hStream)) + cyhStream = phStream + cdef unsigned long long streamId = 0 + with nogil: + err = cyruntime.cudaStreamGetId(cyhStream, &streamId) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, streamId) - - :py:obj:`~.cudaDevAttrComputeCapabilityMajor`: Major compute - capability version number +@cython.embedsignature(True) +def cudaStreamGetDevice(hStream): + """ Query the device of a stream. - - :py:obj:`~.cudaDevAttrComputeCapabilityMinor`: Minor compute - capability version number + Returns in `*device` the device of the stream. - - :py:obj:`~.cudaDevAttrStreamPrioritiesSupported`: 1 if the device - supports stream priorities, or 0 if not + Parameters + ---------- + hStream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + Handle to the stream to be queried - - :py:obj:`~.cudaDevAttrGlobalL1CacheSupported`: 1 if device supports - caching globals in L1 cache, 0 if not + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorDeviceUnavailable`, + device : int + Returns the device to which the stream belongs - - :py:obj:`~.cudaDevAttrLocalL1CacheSupported`: 1 if device supports - caching locals in L1 cache, 0 if not + See Also + -------- + :py:obj:`~.cudaSetDevice`, :py:obj:`~.cudaGetDevice`, :py:obj:`~.cudaStreamCreate`, :py:obj:`~.cudaStreamGetPriority`, :py:obj:`~.cudaStreamGetFlags`, :py:obj:`~.cuStreamGetId` + """ + cdef cyruntime.cudaStream_t cyhStream + if hStream is None: + phStream = 0 + elif isinstance(hStream, (cudaStream_t,driver.CUstream)): + phStream = int(hStream) + else: + phStream = int(cudaStream_t(hStream)) + cyhStream = phStream + cdef int device = 0 + with nogil: + err = cyruntime.cudaStreamGetDevice(cyhStream, &device) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, device) - - :py:obj:`~.cudaDevAttrMaxSharedMemoryPerMultiprocessor`: Maximum - amount of shared memory available to a multiprocessor in bytes; this - amount is shared by all thread blocks simultaneously resident on a - multiprocessor +@cython.embedsignature(True) +def cudaCtxResetPersistingL2Cache(): + """ Resets all persisting lines in cache to normal status. - - :py:obj:`~.cudaDevAttrMaxRegistersPerMultiprocessor`: Maximum number - of 32-bit registers available to a multiprocessor; this number is - shared by all thread blocks simultaneously resident on a - multiprocessor + Resets all persisting lines in cache to normal status. Takes effect on + function return. - - :py:obj:`~.cudaDevAttrManagedMemory`: 1 if device supports allocating - managed memory, 0 if not + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, - - :py:obj:`~.cudaDevAttrIsMultiGpuBoard`: 1 if device is on a multi-GPU - board, 0 if not + See Also + -------- + :py:obj:`~.cudaAccessPolicyWindow` + """ + with nogil: + err = cyruntime.cudaCtxResetPersistingL2Cache() + return (_cudaError_t(err),) - - :py:obj:`~.cudaDevAttrMultiGpuBoardGroupID`: Unique identifier for a - group of devices on the same multi-GPU board +@cython.embedsignature(True) +def cudaStreamCopyAttributes(dst, src): + """ Copies attributes from source stream to destination stream. - - :py:obj:`~.cudaDevAttrHostNativeAtomicSupported`: 1 if the link - between the device and the host supports native atomic operations + Copies attributes from source stream `src` to destination stream `dst`. + Both streams must have the same context. - - :py:obj:`~.cudaDevAttrSingleToDoublePrecisionPerfRatio`: Ratio of - single precision performance (in floating-point operations per - second) to double precision performance + Parameters + ---------- + dst : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + Destination stream + src : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + Source stream For attributes see :py:obj:`~.cudaStreamAttrID` - - :py:obj:`~.cudaDevAttrPageableMemoryAccess`: 1 if the device supports - coherently accessing pageable memory without calling cudaHostRegister - on it, and 0 otherwise + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorNotSupported` - - :py:obj:`~.cudaDevAttrConcurrentManagedAccess`: 1 if the device can - coherently access managed memory concurrently with the CPU, and 0 - otherwise + See Also + -------- + :py:obj:`~.cudaAccessPolicyWindow` + """ + cdef cyruntime.cudaStream_t cysrc + if src is None: + psrc = 0 + elif isinstance(src, (cudaStream_t,driver.CUstream)): + psrc = int(src) + else: + psrc = int(cudaStream_t(src)) + cysrc = psrc + cdef cyruntime.cudaStream_t cydst + if dst is None: + pdst = 0 + elif isinstance(dst, (cudaStream_t,driver.CUstream)): + pdst = int(dst) + else: + pdst = int(cudaStream_t(dst)) + cydst = pdst + with nogil: + err = cyruntime.cudaStreamCopyAttributes(cydst, cysrc) + return (_cudaError_t(err),) - - :py:obj:`~.cudaDevAttrComputePreemptionSupported`: 1 if the device - supports Compute Preemption, 0 if not +@cython.embedsignature(True) +def cudaStreamGetAttribute(hStream, attr not None : cudaStreamAttrID): + """ Queries stream attribute. - - :py:obj:`~.cudaDevAttrCanUseHostPointerForRegisteredMem`: 1 if the - device can access host registered memory at the same virtual address - as the CPU, and 0 otherwise + Queries attribute `attr` from `hStream` and stores it in corresponding + member of `value_out`. - - :py:obj:`~.cudaDevAttrCooperativeLaunch`: 1 if the device supports - launching cooperative kernels via - :py:obj:`~.cudaLaunchCooperativeKernel`, and 0 otherwise + Parameters + ---------- + hStream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` - - :py:obj:`~.cudaDevAttrCooperativeMultiDeviceLaunch`: 1 if the device - supports launching cooperative kernels via - :py:obj:`~.cudaLaunchCooperativeKernelMultiDevice`, and 0 otherwise + attr : :py:obj:`~.cudaStreamAttrID` - - :py:obj:`~.cudaDevAttrCanFlushRemoteWrites`: 1 if the device supports - flushing of outstanding remote writes, and 0 otherwise + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle` + value_out : :py:obj:`~.cudaStreamAttrValue` - - :py:obj:`~.cudaDevAttrHostRegisterSupported`: 1 if the device - supports host memory registration via :py:obj:`~.cudaHostRegister`, - and 0 otherwise + See Also + -------- + :py:obj:`~.cudaAccessPolicyWindow` + """ + cdef cyruntime.cudaStream_t cyhStream + if hStream is None: + phStream = 0 + elif isinstance(hStream, (cudaStream_t,driver.CUstream)): + phStream = int(hStream) + else: + phStream = int(cudaStream_t(hStream)) + cyhStream = phStream + cdef cyruntime.cudaStreamAttrID cyattr = int(attr) + cdef cudaStreamAttrValue value_out = cudaStreamAttrValue() + with nogil: + err = cyruntime.cudaStreamGetAttribute(cyhStream, cyattr, value_out._pvt_ptr) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, value_out) - - :py:obj:`~.cudaDevAttrPageableMemoryAccessUsesHostPageTables`: 1 if - the device accesses pageable memory via the host's page tables, and 0 - otherwise +@cython.embedsignature(True) +def cudaStreamSetAttribute(hStream, attr not None : cudaStreamAttrID, value : Optional[cudaStreamAttrValue]): + """ Sets stream attribute. - - :py:obj:`~.cudaDevAttrDirectManagedMemAccessFromHost`: 1 if the host - can directly access managed memory on the device without migration, - and 0 otherwise + Sets attribute `attr` on `hStream` from corresponding attribute of + `value`. The updated attribute will be applied to subsequent work + submitted to the stream. It will not affect previously submitted work. - - :py:obj:`~.cudaDevAttrMaxSharedMemoryPerBlockOptin`: Maximum per - block shared memory size on the device. This value can be opted into - when using :py:obj:`~.cudaFuncSetAttribute` + Parameters + ---------- + hStream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` - - :py:obj:`~.cudaDevAttrMaxBlocksPerMultiprocessor`: Maximum number of - thread blocks that can reside on a multiprocessor + attr : :py:obj:`~.cudaStreamAttrID` - - :py:obj:`~.cudaDevAttrMaxPersistingL2CacheSize`: Maximum L2 - persisting lines capacity setting in bytes + value : :py:obj:`~.cudaStreamAttrValue` - - :py:obj:`~.cudaDevAttrMaxAccessPolicyWindowSize`: Maximum value of - :py:obj:`~.cudaAccessPolicyWindow.num_bytes` + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle` - - :py:obj:`~.cudaDevAttrReservedSharedMemoryPerBlock`: Shared memory - reserved by CUDA driver per block in bytes + See Also + -------- + :py:obj:`~.cudaAccessPolicyWindow` + """ + cdef cyruntime.cudaStream_t cyhStream + if hStream is None: + phStream = 0 + elif isinstance(hStream, (cudaStream_t,driver.CUstream)): + phStream = int(hStream) + else: + phStream = int(cudaStream_t(hStream)) + cyhStream = phStream + cdef cyruntime.cudaStreamAttrID cyattr = int(attr) + cdef cyruntime.cudaStreamAttrValue* cyvalue_ptr = value._pvt_ptr if value is not None else NULL + with nogil: + err = cyruntime.cudaStreamSetAttribute(cyhStream, cyattr, cyvalue_ptr) + return (_cudaError_t(err),) - - :py:obj:`~.cudaDevAttrSparseCudaArraySupported`: 1 if the device - supports sparse CUDA arrays and sparse CUDA mipmapped arrays. +@cython.embedsignature(True) +def cudaStreamDestroy(stream): + """ Destroys and cleans up an asynchronous stream. - - :py:obj:`~.cudaDevAttrHostRegisterReadOnlySupported`: Device supports - using the :py:obj:`~.cudaHostRegister` flag cudaHostRegisterReadOnly - to register memory that must be mapped as read-only to the GPU + Destroys and cleans up the asynchronous stream specified by `stream`. - - :py:obj:`~.cudaDevAttrMemoryPoolsSupported`: 1 if the device supports - using the cudaMallocAsync and cudaMemPool family of APIs, and 0 - otherwise + In case the device is still doing work in the stream `stream` when + :py:obj:`~.cudaStreamDestroy()` is called, the function will return + immediately and the resources associated with `stream` will be released + automatically once the device has completed all work in `stream`. - - :py:obj:`~.cudaDevAttrGPUDirectRDMASupported`: 1 if the device - supports GPUDirect RDMA APIs, and 0 otherwise + Parameters + ---------- + stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + Stream identifier - - :py:obj:`~.cudaDevAttrGPUDirectRDMAFlushWritesOptions`: bitmask to be - interpreted according to the - :py:obj:`~.cudaFlushGPUDirectRDMAWritesOptions` enum + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle` :py:obj:`~.cudaErrorExternalDevice` - - :py:obj:`~.cudaDevAttrGPUDirectRDMAWritesOrdering`: see the - :py:obj:`~.cudaGPUDirectRDMAWritesOrdering` enum for numerical values + See Also + -------- + :py:obj:`~.cudaStreamCreate`, :py:obj:`~.cudaStreamCreateWithFlags`, :py:obj:`~.cudaStreamQuery`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cudaStreamSynchronize`, :py:obj:`~.cudaStreamAddCallback`, :py:obj:`~.cuStreamDestroy` + """ + cdef cyruntime.cudaStream_t cystream + if stream is None: + pstream = 0 + elif isinstance(stream, (cudaStream_t,driver.CUstream)): + pstream = int(stream) + else: + pstream = int(cudaStream_t(stream)) + cystream = pstream + with nogil: + err = cyruntime.cudaStreamDestroy(cystream) + return (_cudaError_t(err),) - - :py:obj:`~.cudaDevAttrMemoryPoolSupportedHandleTypes`: Bitmask of - handle types supported with mempool based IPC +@cython.embedsignature(True) +def cudaStreamWaitEvent(stream, event, unsigned int flags): + """ Make a compute stream wait on an event. - - :py:obj:`~.cudaDevAttrDeferredMappingCudaArraySupported` : 1 if the - device supports deferred mapping CUDA arrays and CUDA mipmapped - arrays. + Makes all future work submitted to `stream` wait for all work captured + in `event`. See :py:obj:`~.cudaEventRecord()` for details on what is + captured by an event. The synchronization will be performed efficiently + on the device when applicable. `event` may be from a different device + than `stream`. - - :py:obj:`~.cudaDevAttrIpcEventSupport`: 1 if the device supports IPC - Events. + flags include: - - :py:obj:`~.cudaDevAttrNumaConfig`: NUMA configuration of a device: - value is of type :py:obj:`~.cudaDeviceNumaConfig` enum + - :py:obj:`~.cudaEventWaitDefault`: Default event creation flag. - - :py:obj:`~.cudaDevAttrNumaId`: NUMA node ID of the GPU memory + - :py:obj:`~.cudaEventWaitExternal`: Event is captured in the graph as + an external event node when performing stream capture. Parameters ---------- - attr : :py:obj:`~.cudaDeviceAttr` - Device attribute to query - device : int - Device number to query + stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + Stream to wait + event : :py:obj:`~.CUevent` or :py:obj:`~.cudaEvent_t` + Event to wait on + flags : unsigned int + Parameters for the operation(See above) Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDevice`, :py:obj:`~.cudaErrorInvalidValue` - value : int - Returned device attribute value + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle` See Also -------- - :py:obj:`~.cudaGetDeviceCount`, :py:obj:`~.cudaGetDevice`, :py:obj:`~.cudaSetDevice`, :py:obj:`~.cudaChooseDevice`, :py:obj:`~.cudaGetDeviceProperties`, :py:obj:`~.cudaInitDevice`, :py:obj:`~.cuDeviceGetAttribute` + :py:obj:`~.cudaStreamCreate`, :py:obj:`~.cudaStreamCreateWithFlags`, :py:obj:`~.cudaStreamQuery`, :py:obj:`~.cudaStreamSynchronize`, :py:obj:`~.cudaStreamAddCallback`, :py:obj:`~.cudaStreamDestroy`, :py:obj:`~.cuStreamWaitEvent` """ - cdef int value = 0 - cdef ccudart.cudaDeviceAttr cattr = attr.value - err = ccudart.cudaDeviceGetAttribute(&value, cattr, device) - return (cudaError_t(err), value) -{{endif}} + cdef cyruntime.cudaEvent_t cyevent + if event is None: + pevent = 0 + elif isinstance(event, (cudaEvent_t,driver.CUevent)): + pevent = int(event) + else: + pevent = int(cudaEvent_t(event)) + cyevent = pevent + cdef cyruntime.cudaStream_t cystream + if stream is None: + pstream = 0 + elif isinstance(stream, (cudaStream_t,driver.CUstream)): + pstream = int(stream) + else: + pstream = int(cudaStream_t(stream)) + cystream = pstream + with nogil: + err = cyruntime.cudaStreamWaitEvent(cystream, cyevent, flags) + return (_cudaError_t(err),) + +ctypedef struct cudaStreamCallbackData_st: + cyruntime.cudaStreamCallback_t callback + void *userData + +ctypedef cudaStreamCallbackData_st cudaStreamCallbackData + +@cython.show_performance_hints(False) +cdef void cudaStreamRtCallbackWrapper(cyruntime.cudaStream_t stream, cyruntime.cudaError_t status, void *data) nogil: + cdef cudaStreamCallbackData *cbData = data + with gil: + cbData.callback(stream, status, cbData.userData) + free(cbData) + +@cython.embedsignature(True) +def cudaStreamAddCallback(stream, callback, userData, unsigned int flags): + """ Add a callback to a compute stream. + + Adds a callback to be called on the host after all currently enqueued + items in the stream have completed. For each cudaStreamAddCallback + call, a callback will be executed exactly once. The callback will block + later work in the stream until it is finished. + + The callback may be passed :py:obj:`~.cudaSuccess` or an error code. In + the event of a device error, all subsequently executed callbacks will + receive an appropriate :py:obj:`~.cudaError_t`. + + Callbacks must not make any CUDA API calls. Attempting to use CUDA APIs + may result in :py:obj:`~.cudaErrorNotPermitted`. Callbacks must not + perform any synchronization that may depend on outstanding device work + or other callbacks that are not mandated to run earlier. Callbacks + without a mandated order (in independent streams) execute in undefined + order and may be serialized. + + For the purposes of Unified Memory, callback execution makes a number + of guarantees: -{{if 'cudaDeviceGetDefaultMemPool' in found_functions}} + - The callback stream is considered idle for the duration of the + callback. Thus, for example, a callback may always use memory + attached to the callback stream. -@cython.embedsignature(True) -def cudaDeviceGetDefaultMemPool(int device): - """ Returns the default mempool of a device. + - The start of execution of a callback has the same effect as + synchronizing an event recorded in the same stream immediately prior + to the callback. It thus synchronizes streams which have been + "joined" prior to the callback. - The default mempool of a device contains device memory from that - device. + - Adding device work to any stream does not have the effect of making + the stream active until all preceding callbacks have executed. Thus, + for example, a callback might use global attached memory even if work + has been added to another stream, if it has been properly ordered + with an event. + + - Completion of a callback does not cause a stream to become active + except as described above. The callback stream will remain idle if no + device work follows the callback, and will remain idle across + consecutive callbacks without device work in between. Thus, for + example, stream synchronization can be done by signaling from a + callback at the end of the stream. Parameters ---------- - device : int - None + stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + Stream to add callback to + callback : :py:obj:`~.cudaStreamCallback_t` + The function to call once preceding stream operations are complete + userData : Any + User specified data to be passed to the callback function + flags : unsigned int + Reserved for future use, must be 0 Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDevice`, :py:obj:`~.cudaErrorInvalidValue` :py:obj:`~.cudaErrorNotSupported` - memPool : :py:obj:`~.cudaMemPool_t` - None + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorNotSupported` See Also -------- - :py:obj:`~.cuDeviceGetDefaultMemPool`, :py:obj:`~.cudaMallocAsync`, :py:obj:`~.cudaMemPoolTrimTo`, :py:obj:`~.cudaMemPoolGetAttribute`, :py:obj:`~.cudaDeviceSetMemPool`, :py:obj:`~.cudaMemPoolSetAttribute`, :py:obj:`~.cudaMemPoolSetAccess` + :py:obj:`~.cudaStreamCreate`, :py:obj:`~.cudaStreamCreateWithFlags`, :py:obj:`~.cudaStreamQuery`, :py:obj:`~.cudaStreamSynchronize`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cudaStreamDestroy`, :py:obj:`~.cudaMallocManaged`, :py:obj:`~.cudaStreamAttachMemAsync`, :py:obj:`~.cudaLaunchHostFunc`, :py:obj:`~.cuStreamAddCallback` + + Notes + ----- + This function is slated for eventual deprecation and removal. If you do not require the callback to execute in case of a device error, consider using :py:obj:`~.cudaLaunchHostFunc`. Additionally, this function is not supported with :py:obj:`~.cudaStreamBeginCapture` and :py:obj:`~.cudaStreamEndCapture`, unlike :py:obj:`~.cudaLaunchHostFunc`. """ - cdef cudaMemPool_t memPool = cudaMemPool_t() - with nogil: - err = ccudart.cudaDeviceGetDefaultMemPool(memPool._ptr, device) + cdef cyruntime.cudaStreamCallback_t cycallback + if callback is None: + pcallback = 0 + elif isinstance(callback, (cudaStreamCallback_t,)): + pcallback = int(callback) + else: + pcallback = int(cudaStreamCallback_t(callback)) + cycallback = pcallback + cdef cyruntime.cudaStream_t cystream + if stream is None: + pstream = 0 + elif isinstance(stream, (cudaStream_t,driver.CUstream)): + pstream = int(stream) + else: + pstream = int(cudaStream_t(stream)) + cystream = pstream + cdef _HelperInputVoidPtrStruct cyuserDataHelper + cdef void* cyuserData = _helper_input_void_ptr(userData, &cyuserDataHelper) - return (cudaError_t(err), memPool) -{{endif}} + cdef cudaStreamCallbackData *cbData = NULL + cbData = malloc(sizeof(cbData[0])) + if cbData == NULL: + return (cudaError_t.cudaErrorMemoryAllocation,) + cbData.callback = cycallback + cbData.userData = cyuserData -{{if 'cudaDeviceSetMemPool' in found_functions}} + with nogil: + err = cyruntime.cudaStreamAddCallback(cystream, cudaStreamRtCallbackWrapper, cbData, flags) + if err != cyruntime.cudaSuccess: + free(cbData) + _helper_input_void_ptr_free(&cyuserDataHelper) + + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaDeviceSetMemPool(int device, memPool): - """ Sets the current memory pool of a device. +def cudaStreamSynchronize(stream): + """ Waits for stream tasks to complete. - The memory pool must be local to the specified device. Unless a mempool - is specified in the :py:obj:`~.cudaMallocAsync` call, - :py:obj:`~.cudaMallocAsync` allocates from the current mempool of the - provided stream's device. By default, a device's current memory pool is - its default memory pool. + Blocks until `stream` has completed all operations. If the + :py:obj:`~.cudaDeviceScheduleBlockingSync` flag was set for this + device, the host thread will block until the stream is finished with + all of its tasks. Parameters ---------- - device : int - None - memPool : :py:obj:`~.CUmemoryPool` or :py:obj:`~.cudaMemPool_t` - None + stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + Stream identifier Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :py:obj:`~.cudaErrorInvalidDevice` :py:obj:`~.cudaErrorNotSupported` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidResourceHandle` See Also -------- - :py:obj:`~.cuDeviceSetMemPool`, :py:obj:`~.cudaDeviceGetMemPool`, :py:obj:`~.cudaDeviceGetDefaultMemPool`, :py:obj:`~.cudaMemPoolCreate`, :py:obj:`~.cudaMemPoolDestroy`, :py:obj:`~.cudaMallocFromPoolAsync` - - Notes - ----- - Use :py:obj:`~.cudaMallocFromPoolAsync` to specify asynchronous allocations from a device different than the one the stream runs on. + :py:obj:`~.cudaStreamCreate`, :py:obj:`~.cudaStreamCreateWithFlags`, :py:obj:`~.cudaStreamQuery`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cudaStreamAddCallback`, :py:obj:`~.cudaStreamDestroy`, :py:obj:`~.cuStreamSynchronize` """ - cdef ccudart.cudaMemPool_t cmemPool - if memPool is None: - cmemPool = 0 - elif isinstance(memPool, (cudaMemPool_t,cuda.CUmemoryPool)): - pmemPool = int(memPool) - cmemPool = pmemPool + cdef cyruntime.cudaStream_t cystream + if stream is None: + pstream = 0 + elif isinstance(stream, (cudaStream_t,driver.CUstream)): + pstream = int(stream) else: - pmemPool = int(cudaMemPool_t(memPool)) - cmemPool = pmemPool + pstream = int(cudaStream_t(stream)) + cystream = pstream with nogil: - err = ccudart.cudaDeviceSetMemPool(device, cmemPool) - - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaDeviceGetMemPool' in found_functions}} + err = cyruntime.cudaStreamSynchronize(cystream) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaDeviceGetMemPool(int device): - """ Gets the current mempool for a device. +def cudaStreamQuery(stream): + """ Queries an asynchronous stream for completion status. - Returns the last pool provided to :py:obj:`~.cudaDeviceSetMemPool` for - this device or the device's default memory pool if - :py:obj:`~.cudaDeviceSetMemPool` has never been called. By default the - current mempool is the default mempool for a device, otherwise the - returned pool must have been set with :py:obj:`~.cuDeviceSetMemPool` or - :py:obj:`~.cudaDeviceSetMemPool`. + Returns :py:obj:`~.cudaSuccess` if all operations in `stream` have + completed, or :py:obj:`~.cudaErrorNotReady` if not. + + For the purposes of Unified Memory, a return value of + :py:obj:`~.cudaSuccess` is equivalent to having called + :py:obj:`~.cudaStreamSynchronize()`. Parameters ---------- - device : int - None + stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + Stream identifier Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :py:obj:`~.cudaErrorNotSupported` - memPool : :py:obj:`~.cudaMemPool_t` - None + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorNotReady`, :py:obj:`~.cudaErrorInvalidResourceHandle` See Also -------- - :py:obj:`~.cuDeviceGetMemPool`, :py:obj:`~.cudaDeviceGetDefaultMemPool`, :py:obj:`~.cudaDeviceSetMemPool` + :py:obj:`~.cudaStreamCreate`, :py:obj:`~.cudaStreamCreateWithFlags`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cudaStreamSynchronize`, :py:obj:`~.cudaStreamAddCallback`, :py:obj:`~.cudaStreamDestroy`, :py:obj:`~.cuStreamQuery` """ - cdef cudaMemPool_t memPool = cudaMemPool_t() + cdef cyruntime.cudaStream_t cystream + if stream is None: + pstream = 0 + elif isinstance(stream, (cudaStream_t,driver.CUstream)): + pstream = int(stream) + else: + pstream = int(cudaStream_t(stream)) + cystream = pstream with nogil: - err = ccudart.cudaDeviceGetMemPool(memPool._ptr, device) + err = cyruntime.cudaStreamQuery(cystream) + return (_cudaError_t(err),) - return (cudaError_t(err), memPool) -{{endif}} +@cython.embedsignature(True) +def cudaStreamAttachMemAsync(stream, devPtr, size_t length, unsigned int flags): + """ Attach memory to a stream asynchronously. -{{if 'cudaDeviceGetNvSciSyncAttributes' in found_functions}} + Enqueues an operation in `stream` to specify stream association of + `length` bytes of memory starting from `devPtr`. This function is a + stream-ordered operation, meaning that it is dependent on, and will + only take effect when, previous work in stream has completed. Any + previous association is automatically replaced. -@cython.embedsignature(True) -def cudaDeviceGetNvSciSyncAttributes(nvSciSyncAttrList, int device, int flags): - """ Return NvSciSync attributes that this device can support. + `devPtr` must point to an one of the following types of memories: - Returns in `nvSciSyncAttrList`, the properties of NvSciSync that this - CUDA device, `dev` can support. The returned `nvSciSyncAttrList` can be - used to create an NvSciSync that matches this device's capabilities. + - managed memory declared using the managed keyword or allocated with + :py:obj:`~.cudaMallocManaged`. - If NvSciSyncAttrKey_RequiredPerm field in `nvSciSyncAttrList` is - already set this API will return :py:obj:`~.cudaErrorInvalidValue`. + - a valid host-accessible region of system-allocated pageable memory. + This type of memory may only be specified if the device associated + with the stream reports a non-zero value for the device attribute + :py:obj:`~.cudaDevAttrPageableMemoryAccess`. - The applications should set `nvSciSyncAttrList` to a valid - NvSciSyncAttrList failing which this API will return - :py:obj:`~.cudaErrorInvalidHandle`. + For managed allocations, `length` must be either zero or the entire + allocation's size. Both indicate that the entire allocation's stream + association is being changed. Currently, it is not possible to change + stream association for a portion of a managed allocation. - The `flags` controls how applications intends to use the NvSciSync - created from the `nvSciSyncAttrList`. The valid flags are: + For pageable allocations, `length` must be non-zero. - - :py:obj:`~.cudaNvSciSyncAttrSignal`, specifies that the applications - intends to signal an NvSciSync on this CUDA device. + The stream association is specified using `flags` which must be one of + :py:obj:`~.cudaMemAttachGlobal`, :py:obj:`~.cudaMemAttachHost` or + :py:obj:`~.cudaMemAttachSingle`. The default value for `flags` is + :py:obj:`~.cudaMemAttachSingle` If the :py:obj:`~.cudaMemAttachGlobal` + flag is specified, the memory can be accessed by any stream on any + device. If the :py:obj:`~.cudaMemAttachHost` flag is specified, the + program makes a guarantee that it won't access the memory on the device + from any stream on a device that has a zero value for the device + attribute :py:obj:`~.cudaDevAttrConcurrentManagedAccess`. If the + :py:obj:`~.cudaMemAttachSingle` flag is specified and `stream` is + associated with a device that has a zero value for the device attribute + :py:obj:`~.cudaDevAttrConcurrentManagedAccess`, the program makes a + guarantee that it will only access the memory on the device from + `stream`. It is illegal to attach singly to the NULL stream, because + the NULL stream is a virtual global stream and not a specific stream. + An error will be returned in this case. - - :py:obj:`~.cudaNvSciSyncAttrWait`, specifies that the applications - intends to wait on an NvSciSync on this CUDA device. + When memory is associated with a single stream, the Unified Memory + system will allow CPU access to this memory region so long as all + operations in `stream` have completed, regardless of whether other + streams are active. In effect, this constrains exclusive ownership of + the managed memory region by an active GPU to per-stream activity + instead of whole-GPU activity. - At least one of these flags must be set, failing which the API returns - :py:obj:`~.cudaErrorInvalidValue`. Both the flags are orthogonal to one - another: a developer may set both these flags that allows to set both - wait and signal specific attributes in the same `nvSciSyncAttrList`. + Accessing memory on the device from streams that are not associated + with it will produce undefined results. No error checking is performed + by the Unified Memory system to ensure that kernels launched into other + streams do not access this region. - Note that this API updates the input `nvSciSyncAttrList` with values - equivalent to the following public attribute key-values: - NvSciSyncAttrKey_RequiredPerm is set to + It is a program's responsibility to order calls to + :py:obj:`~.cudaStreamAttachMemAsync` via events, synchronization or + other means to ensure legal access to memory at all times. Data + visibility and coherency will be changed appropriately for all kernels + which follow a stream-association change. - - NvSciSyncAccessPerm_SignalOnly if :py:obj:`~.cudaNvSciSyncAttrSignal` - is set in `flags`. + If `stream` is destroyed while data is associated with it, the + association is removed and the association reverts to the default + visibility of the allocation as specified at + :py:obj:`~.cudaMallocManaged`. For managed variables, the default + association is always :py:obj:`~.cudaMemAttachGlobal`. Note that + destroying a stream is an asynchronous operation, and as a result, the + change to default association won't happen until all work in the stream + has completed. - - NvSciSyncAccessPerm_WaitOnly if :py:obj:`~.cudaNvSciSyncAttrWait` is - set in `flags`. + Parameters + ---------- + stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + Stream in which to enqueue the attach operation + devPtr : Any + Pointer to memory (must be a pointer to managed memory or to a + valid host-accessible region of system-allocated memory) + length : size_t + Length of memory (defaults to zero) + flags : unsigned int + Must be one of :py:obj:`~.cudaMemAttachGlobal`, + :py:obj:`~.cudaMemAttachHost` or :py:obj:`~.cudaMemAttachSingle` + (defaults to :py:obj:`~.cudaMemAttachSingle`) - - NvSciSyncAccessPerm_WaitSignal if both - :py:obj:`~.cudaNvSciSyncAttrWait` and - :py:obj:`~.cudaNvSciSyncAttrSignal` are set in `flags`. - NvSciSyncAttrKey_PrimitiveInfo is set to + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorNotReady`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle` - - NvSciSyncAttrValPrimitiveType_SysmemSemaphore on any valid `device`. + See Also + -------- + :py:obj:`~.cudaStreamCreate`, :py:obj:`~.cudaStreamCreateWithFlags`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cudaStreamSynchronize`, :py:obj:`~.cudaStreamAddCallback`, :py:obj:`~.cudaStreamDestroy`, :py:obj:`~.cudaMallocManaged`, :py:obj:`~.cuStreamAttachMemAsync` + """ + cdef cyruntime.cudaStream_t cystream + if stream is None: + pstream = 0 + elif isinstance(stream, (cudaStream_t,driver.CUstream)): + pstream = int(stream) + else: + pstream = int(cudaStream_t(stream)) + cystream = pstream + cdef _HelperInputVoidPtrStruct cydevPtrHelper + cdef void* cydevPtr = _helper_input_void_ptr(devPtr, &cydevPtrHelper) + with nogil: + err = cyruntime.cudaStreamAttachMemAsync(cystream, cydevPtr, length, flags) + _helper_input_void_ptr_free(&cydevPtrHelper) + return (_cudaError_t(err),) - - NvSciSyncAttrValPrimitiveType_Syncpoint if `device` is a Tegra - device. +@cython.embedsignature(True) +def cudaStreamBeginCapture(stream, mode not None : cudaStreamCaptureMode): + """ Begins graph capture on a stream. - - NvSciSyncAttrValPrimitiveType_SysmemSemaphorePayload64b if `device` - is GA10X+. NvSciSyncAttrKey_GpuId is set to the same UUID that is - returned in `None` from :py:obj:`~.cudaDeviceGetProperties` for this - `device`. + Begin graph capture on `stream`. When a stream is in capture mode, all + operations pushed into the stream will not be executed, but will + instead be captured into a graph, which will be returned via + :py:obj:`~.cudaStreamEndCapture`. Capture may not be initiated if + `stream` is :py:obj:`~.cudaStreamLegacy`. Capture must be ended on the + same stream in which it was initiated, and it may only be initiated if + the stream is not already in capture mode. The capture mode may be + queried via :py:obj:`~.cudaStreamIsCapturing`. A unique id representing + the capture sequence may be queried via + :py:obj:`~.cudaStreamGetCaptureInfo`. - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorDeviceUninitialized`, - :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidHandle`, - :py:obj:`~.cudaErrorInvalidDevice`, :py:obj:`~.cudaErrorNotSupported`, - :py:obj:`~.cudaErrorMemoryAllocation` + If `mode` is not :py:obj:`~.cudaStreamCaptureModeRelaxed`, + :py:obj:`~.cudaStreamEndCapture` must be called on this stream from the + same thread. Parameters ---------- - nvSciSyncAttrList : Any - Return NvSciSync attributes supported. - device : int - Valid Cuda Device to get NvSciSync attributes for. - flags : int - flags describing NvSciSync usage. + stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + Stream in which to initiate capture + mode : :py:obj:`~.cudaStreamCaptureMode` + Controls the interaction of this capture sequence with other API + calls that are potentially unsafe. For more details see + :py:obj:`~.cudaThreadExchangeStreamCaptureMode`. Returns ------- cudaError_t - + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` See Also -------- - :py:obj:`~.cudaImportExternalSemaphore`, :py:obj:`~.cudaDestroyExternalSemaphore`, :py:obj:`~.cudaSignalExternalSemaphoresAsync`, :py:obj:`~.cudaWaitExternalSemaphoresAsync` - """ - cnvSciSyncAttrList = utils.HelperInputVoidPtr(nvSciSyncAttrList) - cdef void* cnvSciSyncAttrList_ptr = cnvSciSyncAttrList.cptr - err = ccudart.cudaDeviceGetNvSciSyncAttributes(cnvSciSyncAttrList_ptr, device, flags) - return (cudaError_t(err),) -{{endif}} + :py:obj:`~.cudaStreamCreate`, :py:obj:`~.cudaStreamIsCapturing`, :py:obj:`~.cudaStreamEndCapture`, :py:obj:`~.cudaThreadExchangeStreamCaptureMode` -{{if 'cudaDeviceGetP2PAttribute' in found_functions}} + Notes + ----- + Kernels captured using this API must not use texture and surface references. Reading or writing through any texture or surface reference is undefined behavior. This restriction does not apply to texture and surface objects. + """ + cdef cyruntime.cudaStream_t cystream + if stream is None: + pstream = 0 + elif isinstance(stream, (cudaStream_t,driver.CUstream)): + pstream = int(stream) + else: + pstream = int(cudaStream_t(stream)) + cystream = pstream + cdef cyruntime.cudaStreamCaptureMode cymode = int(mode) + with nogil: + err = cyruntime.cudaStreamBeginCapture(cystream, cymode) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaDeviceGetP2PAttribute(attr not None : cudaDeviceP2PAttr, int srcDevice, int dstDevice): - """ Queries attributes of the link between two devices. - - Returns in `*value` the value of the requested attribute `attrib` of - the link between `srcDevice` and `dstDevice`. The supported attributes - are: +def cudaStreamBeginRecaptureToGraph(stream, mode not None : cudaStreamCaptureMode, graph, callbackData : Optional[cudaGraphRecaptureCallbackData]): + """ Begin graph capture on a stream to an existing graph. - - :py:obj:`~.cudaDevP2PAttrPerformanceRank`: A relative value - indicating the performance of the link between two devices. Lower - value means better performance (0 being the value used for most - performant link). + Begin graph capture on `stream` to the existing `graph`. The node + creation order while recapturing the graph must be identical to the + original graph. The recapture will fail immediately for: - - :py:obj:`~.cudaDevP2PAttrAccessSupported`: 1 if peer access is - enabled. + - Topology mismatches between the existing graph and the recaptured + graph - - :py:obj:`~.cudaDevP2PAttrNativeAtomicSupported`: 1 if native atomic - operations over the link are supported. + - Parameter mismatches for memory allocation or free nodes - - :py:obj:`~.cudaDevP2PAttrCudaArrayAccessSupported`: 1 if accessing - CUDA arrays over the link is supported. + Any other node parameter mismatches during recapture can be configured + to call the function provided in `callbackFunc`. The recapture will + fail immediately if the callback returns anything other than + cudaSuccess. - Returns :py:obj:`~.cudaErrorInvalidDevice` if `srcDevice` or - `dstDevice` are not valid or if they represent the same device. + If the recapture fails for any reason, the `graph` will be in an + undefined state and should be destroyed. - Returns :py:obj:`~.cudaErrorInvalidValue` if `attrib` is not valid or - if `value` is a null pointer. + See cudaStreamBeginCapture for additional detail on beginning the + capture. Parameters ---------- - attrib : :py:obj:`~.cudaDeviceP2PAttr` - The requested attribute of the link between `srcDevice` and - `dstDevice`. - srcDevice : int - The source device of the target link. - dstDevice : int - The destination device of the target link. + stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + Stream in which to initiate capture + mode : :py:obj:`~.cudaStreamCaptureMode` + Controls the interaction of this capture sequence with other API + calls that are potentially unsafe. For more details see + :py:obj:`~.cudaThreadExchangeStreamCaptureMode`. + graph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` + Existing CUDA graph to be captured into + callbackData : :py:obj:`~.cudaGraphRecaptureCallbackData` + Optional struct of callback data that will be invoked for all + parameter mismatches from the original graph Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDevice`, :py:obj:`~.cudaErrorInvalidValue` - value : int - Returned value of the requested attribute + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorDeinitialized`, :py:obj:`~.cudaErrorNotInitialized`, :py:obj:`~.cudaErrorInvalidValue`, See Also -------- - :py:obj:`~.cudaDeviceEnablePeerAccess`, :py:obj:`~.cudaDeviceDisablePeerAccess`, :py:obj:`~.cudaDeviceCanAccessPeer`, :py:obj:`~.cuDeviceGetP2PAttribute` - """ - cdef int value = 0 - cdef ccudart.cudaDeviceP2PAttr cattr = attr.value - err = ccudart.cudaDeviceGetP2PAttribute(&value, cattr, srcDevice, dstDevice) - return (cudaError_t(err), value) -{{endif}} + :py:obj:`~.cudaStreamCreate`, :py:obj:`~.cudaStreamBeginCapture`, :py:obj:`~.cudaStreamIsCapturing`, :py:obj:`~.cudaStreamEndCapture`, :py:obj:`~.cudaThreadExchangeStreamCaptureMode` -{{if 'cudaChooseDevice' in found_functions}} + Notes + ----- + Any user objects associated with `graph` will be released prior to the recapture. + """ + cdef cyruntime.cudaGraph_t cygraph + if graph is None: + pgraph = 0 + elif isinstance(graph, (cudaGraph_t,driver.CUgraph)): + pgraph = int(graph) + else: + pgraph = int(cudaGraph_t(graph)) + cygraph = pgraph + cdef cyruntime.cudaStream_t cystream + if stream is None: + pstream = 0 + elif isinstance(stream, (cudaStream_t,driver.CUstream)): + pstream = int(stream) + else: + pstream = int(cudaStream_t(stream)) + cystream = pstream + cdef cyruntime.cudaStreamCaptureMode cymode = int(mode) + cdef cyruntime.cudaGraphRecaptureCallbackData* cycallbackData_ptr = callbackData._pvt_ptr if callbackData is not None else NULL + with nogil: + err = cyruntime.cudaStreamBeginRecaptureToGraph(cystream, cymode, cygraph, cycallbackData_ptr) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaChooseDevice(prop : Optional[cudaDeviceProp]): - """ Select compute-device which best matches criteria. +def cudaStreamBeginCaptureToGraph(stream, graph, dependencies : Optional[tuple[cudaGraphNode_t] | list[cudaGraphNode_t]], dependencyData : Optional[tuple[cudaGraphEdgeData] | list[cudaGraphEdgeData]], size_t numDependencies, mode not None : cudaStreamCaptureMode): + """ Begins graph capture on a stream to an existing graph. - Returns in `*device` the device which has properties that best match - `*prop`. + Begin graph capture on `stream`. When a stream is in capture mode, all + operations pushed into the stream will not be executed, but will + instead be captured into `graph`, which will be returned via + :py:obj:`~.cudaStreamEndCapture`. + + Capture may not be initiated if `stream` is + :py:obj:`~.cudaStreamLegacy`. Capture must be ended on the same stream + in which it was initiated, and it may only be initiated if the stream + is not already in capture mode. The capture mode may be queried via + :py:obj:`~.cudaStreamIsCapturing`. A unique id representing the capture + sequence may be queried via :py:obj:`~.cudaStreamGetCaptureInfo`. + + If `mode` is not :py:obj:`~.cudaStreamCaptureModeRelaxed`, + :py:obj:`~.cudaStreamEndCapture` must be called on this stream from the + same thread. Parameters ---------- - prop : :py:obj:`~.cudaDeviceProp` - Desired device properties + stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + Stream in which to initiate capture. + graph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` + Graph to capture into. + dependencies : list[:py:obj:`~.cudaGraphNode_t`] + Dependencies of the first node captured in the stream. Can be NULL + if numDependencies is 0. + dependencyData : list[:py:obj:`~.cudaGraphEdgeData`] + Optional array of data associated with each dependency. + numDependencies : size_t + Number of dependencies. + mode : :py:obj:`~.cudaStreamCaptureMode` + Controls the interaction of this capture sequence with other API + calls that are potentially unsafe. For more details see + :py:obj:`~.cudaThreadExchangeStreamCaptureMode`. Returns ------- cudaError_t :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` - device : int - Device with best match See Also -------- - :py:obj:`~.cudaGetDeviceCount`, :py:obj:`~.cudaGetDevice`, :py:obj:`~.cudaSetDevice`, :py:obj:`~.cudaGetDeviceProperties`, :py:obj:`~.cudaInitDevice` - """ - cdef int device = 0 - cdef ccudart.cudaDeviceProp* cprop_ptr = prop._ptr if prop != None else NULL - err = ccudart.cudaChooseDevice(&device, cprop_ptr) - return (cudaError_t(err), device) -{{endif}} + :py:obj:`~.cudaStreamCreate`, :py:obj:`~.cudaStreamIsCapturing`, :py:obj:`~.cudaStreamEndCapture`, :py:obj:`~.cudaThreadExchangeStreamCaptureMode` -{{if 'cudaInitDevice' in found_functions}} + Notes + ----- + Kernels captured using this API must not use texture and surface references. Reading or writing through any texture or surface reference is undefined behavior. This restriction does not apply to texture and surface objects. + """ + dependencyData = [] if dependencyData is None else dependencyData + if not all(isinstance(_x, (cudaGraphEdgeData,)) for _x in dependencyData): + raise TypeError("Argument 'dependencyData' is not instance of type (expected tuple[cyruntime.cudaGraphEdgeData,] or list[cyruntime.cudaGraphEdgeData,]") + dependencies = [] if dependencies is None else dependencies + if not all(isinstance(_x, (cudaGraphNode_t,driver.CUgraphNode)) for _x in dependencies): + raise TypeError("Argument 'dependencies' is not instance of type (expected tuple[cyruntime.cudaGraphNode_t,driver.CUgraphNode] or list[cyruntime.cudaGraphNode_t,driver.CUgraphNode]") + cdef cyruntime.cudaGraph_t cygraph + if graph is None: + pgraph = 0 + elif isinstance(graph, (cudaGraph_t,driver.CUgraph)): + pgraph = int(graph) + else: + pgraph = int(cudaGraph_t(graph)) + cygraph = pgraph + cdef cyruntime.cudaStream_t cystream + if stream is None: + pstream = 0 + elif isinstance(stream, (cudaStream_t,driver.CUstream)): + pstream = int(stream) + else: + pstream = int(cudaStream_t(stream)) + cystream = pstream + cdef cyruntime.cudaGraphNode_t* cydependencies = NULL + if len(dependencies) > 1: + cydependencies = calloc(len(dependencies), sizeof(cyruntime.cudaGraphNode_t)) + if cydependencies is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(dependencies)) + 'x' + str(sizeof(cyruntime.cudaGraphNode_t))) + else: + for idx in range(len(dependencies)): + cydependencies[idx] = (dependencies[idx])._pvt_ptr[0] + elif len(dependencies) == 1: + cydependencies = (dependencies[0])._pvt_ptr + cdef cyruntime.cudaGraphEdgeData* cydependencyData = NULL + if len(dependencyData) > 1: + cydependencyData = calloc(len(dependencyData), sizeof(cyruntime.cudaGraphEdgeData)) + if cydependencyData is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(dependencyData)) + 'x' + str(sizeof(cyruntime.cudaGraphEdgeData))) + for idx in range(len(dependencyData)): + string.memcpy(&cydependencyData[idx], (dependencyData[idx])._pvt_ptr, sizeof(cyruntime.cudaGraphEdgeData)) + elif len(dependencyData) == 1: + cydependencyData = (dependencyData[0])._pvt_ptr + if numDependencies > len(dependencies): raise RuntimeError("List is too small: " + str(len(dependencies)) + " < " + str(numDependencies)) + cdef cyruntime.cudaStreamCaptureMode cymode = int(mode) + with nogil: + err = cyruntime.cudaStreamBeginCaptureToGraph(cystream, cygraph, cydependencies, cydependencyData, numDependencies, cymode) + if len(dependencies) > 1 and cydependencies is not NULL: + free(cydependencies) + if len(dependencyData) > 1 and cydependencyData is not NULL: + free(cydependencyData) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaInitDevice(int device, unsigned int deviceFlags, unsigned int flags): - """ Initialize device to be used for GPU executions. +def cudaThreadExchangeStreamCaptureMode(mode not None : cudaStreamCaptureMode): + """ Swaps the stream capture interaction mode for a thread. - This function will initialize the CUDA Runtime structures and primary - context on `device` when called, but the context will not be made - current to `device`. + Sets the calling thread's stream capture interaction mode to the value + contained in `*mode`, and overwrites `*mode` with the previous mode for + the thread. To facilitate deterministic behavior across function or + module boundaries, callers are encouraged to use this API in a push-pop + fashion: - When :py:obj:`~.cudaInitDeviceFlagsAreValid` is set in `flags`, - deviceFlags are applied to the requested device. The values of - deviceFlags match those of the flags parameters in - :py:obj:`~.cudaSetDeviceFlags`. The effect may be verified by - :py:obj:`~.cudaGetDeviceFlags`. + **View CUDA Toolkit Documentation for a C++ code example** - This function will return an error if the device is in - :py:obj:`~.cudaComputeModeExclusiveProcess` and is occupied by another - process or if the device is in :py:obj:`~.cudaComputeModeProhibited`. + During stream capture (see :py:obj:`~.cudaStreamBeginCapture`), some + actions, such as a call to :py:obj:`~.cudaMalloc`, may be unsafe. In + the case of :py:obj:`~.cudaMalloc`, the operation is not enqueued + asynchronously to a stream, and is not observed by stream capture. + Therefore, if the sequence of operations captured via + :py:obj:`~.cudaStreamBeginCapture` depended on the allocation being + replayed whenever the graph is launched, the captured graph would be + invalid. + + Therefore, stream capture places restrictions on API calls that can be + made within or concurrently to a + :py:obj:`~.cudaStreamBeginCapture`-:py:obj:`~.cudaStreamEndCapture` + sequence. This behavior can be controlled via this API and flags to + :py:obj:`~.cudaStreamBeginCapture`. + + A thread's mode is one of the following: + + - `cudaStreamCaptureModeGlobal:` This is the default mode. If the local + thread has an ongoing capture sequence that was not initiated with + `cudaStreamCaptureModeRelaxed` at `cuStreamBeginCapture`, or if any + other thread has a concurrent capture sequence initiated with + `cudaStreamCaptureModeGlobal`, this thread is prohibited from + potentially unsafe API calls. + + - `cudaStreamCaptureModeThreadLocal:` If the local thread has an + ongoing capture sequence not initiated with + `cudaStreamCaptureModeRelaxed`, it is prohibited from potentially + unsafe API calls. Concurrent capture sequences in other threads are + ignored. + + - `cudaStreamCaptureModeRelaxed:` The local thread is not prohibited + from potentially unsafe API calls. Note that the thread is still + prohibited from API calls which necessarily conflict with stream + capture, for example, attempting :py:obj:`~.cudaEventQuery` on an + event that was last recorded inside a capture sequence. Parameters ---------- - device : int - Device on which the runtime will initialize itself. - deviceFlags : unsigned int - Parameters for device operation. - flags : unsigned int - Flags for controlling the device initialization. + mode : :py:obj:`~.cudaStreamCaptureMode` + Pointer to mode value to swap with the current mode Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDevice`, + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + mode : :py:obj:`~.cudaStreamCaptureMode` + Pointer to mode value to swap with the current mode See Also -------- - :py:obj:`~.cudaGetDeviceCount`, :py:obj:`~.cudaGetDevice`, :py:obj:`~.cudaGetDeviceProperties`, :py:obj:`~.cudaChooseDevice`, :py:obj:`~.cudaSetDevice` :py:obj:`~.cuCtxSetCurrent` + :py:obj:`~.cudaStreamBeginCapture` """ - err = ccudart.cudaInitDevice(device, deviceFlags, flags) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaSetDevice' in found_functions}} + cdef cyruntime.cudaStreamCaptureMode cymode = int(mode) + with nogil: + err = cyruntime.cudaThreadExchangeStreamCaptureMode(&cymode) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, cudaStreamCaptureMode(cymode)) @cython.embedsignature(True) -def cudaSetDevice(int device): - """ Set device to be used for GPU executions. - - Sets `device` as the current device for the calling host thread. Valid - device id's are 0 to (:py:obj:`~.cudaGetDeviceCount()` - 1). - - Any device memory subsequently allocated from this host thread using - :py:obj:`~.cudaMalloc()`, :py:obj:`~.cudaMallocPitch()` or - :py:obj:`~.cudaMallocArray()` will be physically resident on `device`. - Any host memory allocated from this host thread using - :py:obj:`~.cudaMallocHost()` or :py:obj:`~.cudaHostAlloc()` or - :py:obj:`~.cudaHostRegister()` will have its lifetime associated with - `device`. Any streams or events created from this host thread will be - associated with `device`. Any kernels launched from this host thread - using the <<<>>> operator or :py:obj:`~.cudaLaunchKernel()` will be - executed on `device`. - - This call may be made from any host thread, to any device, and at any - time. This function will do no synchronization with the previous or new - device, and should only take significant time when it initializes the - runtime's context state. This call will bind the primary context of the - specified device to the calling thread and all the subsequent memory - allocations, stream and event creations, and kernel launches will be - associated with the primary context. This function will also - immediately initialize the runtime state on the primary context, and - the context will be current on `device` immediately. This function will - return an error if the device is in - :py:obj:`~.cudaComputeModeExclusiveProcess` and is occupied by another - process or if the device is in :py:obj:`~.cudaComputeModeProhibited`. +def cudaStreamEndCapture(stream): + """ Ends capture on a stream, returning the captured graph. - It is not required to call :py:obj:`~.cudaInitDevice` before using this - function. + End capture on `stream`, returning the captured graph via `pGraph`. + Capture must have been initiated on `stream` via a call to + :py:obj:`~.cudaStreamBeginCapture`. If capture was invalidated, due to + a violation of the rules of stream capture, then a NULL graph will be + returned. + + If the `mode` argument to :py:obj:`~.cudaStreamBeginCapture` was not + :py:obj:`~.cudaStreamCaptureModeRelaxed`, this call must be from the + same thread as :py:obj:`~.cudaStreamBeginCapture`. Parameters ---------- - device : int - Device on which the active host thread should execute the device - code. + stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + Stream to query Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDevice`, :py:obj:`~.cudaErrorDeviceUnavailable`, + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorStreamCaptureWrongThread` + pGraph : :py:obj:`~.cudaGraph_t` + The captured graph See Also -------- - :py:obj:`~.cudaGetDeviceCount`, :py:obj:`~.cudaGetDevice`, :py:obj:`~.cudaGetDeviceProperties`, :py:obj:`~.cudaChooseDevice`, :py:obj:`~.cudaInitDevice`, :py:obj:`~.cuCtxSetCurrent` + :py:obj:`~.cudaStreamCreate`, :py:obj:`~.cudaStreamBeginCapture`, :py:obj:`~.cudaStreamIsCapturing`, :py:obj:`~.cudaGraphDestroy` """ - err = ccudart.cudaSetDevice(device) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaGetDevice' in found_functions}} + cdef cyruntime.cudaStream_t cystream + if stream is None: + pstream = 0 + elif isinstance(stream, (cudaStream_t,driver.CUstream)): + pstream = int(stream) + else: + pstream = int(cudaStream_t(stream)) + cystream = pstream + cdef cudaGraph_t pGraph = cudaGraph_t() + with nogil: + err = cyruntime.cudaStreamEndCapture(cystream, pGraph._pvt_ptr) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, pGraph) @cython.embedsignature(True) -def cudaGetDevice(): - """ Returns which device is currently being used. +def cudaStreamIsCapturing(stream): + """ Returns a stream's capture status. - Returns in `*device` the current device for the calling host thread. + Return the capture status of `stream` via `pCaptureStatus`. After a + successful call, `*pCaptureStatus` will contain one of the following: + + - :py:obj:`~.cudaStreamCaptureStatusNone`: The stream is not capturing. + + - :py:obj:`~.cudaStreamCaptureStatusActive`: The stream is capturing. + + - :py:obj:`~.cudaStreamCaptureStatusInvalidated`: The stream was + capturing but an error has invalidated the capture sequence. The + capture sequence must be terminated with + :py:obj:`~.cudaStreamEndCapture` on the stream where it was initiated + in order to continue using `stream`. + + Note that, if this is called on :py:obj:`~.cudaStreamLegacy` (the "null + stream") while a blocking stream on the same device is capturing, it + will return :py:obj:`~.cudaErrorStreamCaptureImplicit` and + `*pCaptureStatus` is unspecified after the call. The blocking stream + capture is not invalidated. + + When a blocking stream is capturing, the legacy stream is in an + unusable state until the blocking stream capture is terminated. The + legacy stream is not supported for stream capture, but attempted use + would have an implicit dependency on the capturing stream(s). + + Parameters + ---------- + stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + Stream to query Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorDeviceUnavailable`, - device : int - Returns the device on which the active host thread executes the - device code. + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorStreamCaptureImplicit` + pCaptureStatus : :py:obj:`~.cudaStreamCaptureStatus` + Returns the stream's capture status See Also -------- - :py:obj:`~.cudaGetDeviceCount`, :py:obj:`~.cudaSetDevice`, :py:obj:`~.cudaGetDeviceProperties`, :py:obj:`~.cudaChooseDevice`, :py:obj:`~.cuCtxGetCurrent` + :py:obj:`~.cudaStreamCreate`, :py:obj:`~.cudaStreamBeginCapture`, :py:obj:`~.cudaStreamEndCapture` """ - cdef int device = 0 - err = ccudart.cudaGetDevice(&device) - return (cudaError_t(err), device) -{{endif}} - -{{if 'cudaSetDeviceFlags' in found_functions}} + cdef cyruntime.cudaStream_t cystream + if stream is None: + pstream = 0 + elif isinstance(stream, (cudaStream_t,driver.CUstream)): + pstream = int(stream) + else: + pstream = int(cudaStream_t(stream)) + cystream = pstream + cdef cyruntime.cudaStreamCaptureStatus pCaptureStatus + with nogil: + err = cyruntime.cudaStreamIsCapturing(cystream, &pCaptureStatus) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, cudaStreamCaptureStatus(pCaptureStatus)) @cython.embedsignature(True) -def cudaSetDeviceFlags(unsigned int flags): - """ Sets flags to be used for device executions. - - Records `flags` as the flags for the current device. If the current - device has been set and that device has already been initialized, the - previous flags are overwritten. If the current device has not been - initialized, it is initialized with the provided flags. If no device - has been made current to the calling thread, a default device is - selected and initialized with the provided flags. - - The two LSBs of the `flags` parameter can be used to control how the - CPU thread interacts with the OS scheduler when waiting for results - from the device. - - - :py:obj:`~.cudaDeviceScheduleAuto`: The default value if the `flags` - parameter is zero, uses a heuristic based on the number of active - CUDA contexts in the process `C` and the number of logical processors - in the system `P`. If `C` > `P`, then CUDA will yield to other OS - threads when waiting for the device, otherwise CUDA will not yield - while waiting for results and actively spin on the processor. - Additionally, on Tegra devices, :py:obj:`~.cudaDeviceScheduleAuto` - uses a heuristic based on the power profile of the platform and may - choose :py:obj:`~.cudaDeviceScheduleBlockingSync` for low-powered - devices. - - - :py:obj:`~.cudaDeviceScheduleSpin`: Instruct CUDA to actively spin - when waiting for results from the device. This can decrease latency - when waiting for the device, but may lower the performance of CPU - threads if they are performing work in parallel with the CUDA thread. +def cudaStreamGetCaptureInfo(stream): + """ Query a stream's capture state. - - :py:obj:`~.cudaDeviceScheduleYield`: Instruct CUDA to yield its - thread when waiting for results from the device. This can increase - latency when waiting for the device, but can increase the performance - of CPU threads performing work in parallel with the device. + Query stream state related to stream capture. - - :py:obj:`~.cudaDeviceScheduleBlockingSync`: Instruct CUDA to block - the CPU thread on a synchronization primitive when waiting for the - device to finish work. + If called on :py:obj:`~.cudaStreamLegacy` (the "null stream") while a + stream not created with :py:obj:`~.cudaStreamNonBlocking` is capturing, + returns :py:obj:`~.cudaErrorStreamCaptureImplicit`. - - :py:obj:`~.cudaDeviceBlockingSync`: Instruct CUDA to block the CPU - thread on a synchronization primitive when waiting for the device to - finish work. :py:obj:`~.Deprecated:` This flag was deprecated as of - CUDA 4.0 and replaced with - :py:obj:`~.cudaDeviceScheduleBlockingSync`. + Valid data (other than capture status) is returned only if both of the + following are true: - - :py:obj:`~.cudaDeviceMapHost`: This flag enables allocating pinned - host memory that is accessible to the device. It is implicit for the - runtime but may be absent if a context is created using the driver - API. If this flag is not set, :py:obj:`~.cudaHostGetDevicePointer()` - will always return a failure code. + - the call returns cudaSuccess - - :py:obj:`~.cudaDeviceLmemResizeToMax`: Instruct CUDA to not reduce - local memory after resizing local memory for a kernel. This can - prevent thrashing by local memory allocations when launching many - kernels with high local memory usage at the cost of potentially - increased memory usage. :py:obj:`~.Deprecated:` This flag is - deprecated and the behavior enabled by this flag is now the default - and cannot be disabled. + - the returned capture status is + :py:obj:`~.cudaStreamCaptureStatusActive` - - :py:obj:`~.cudaDeviceSyncMemops`: Ensures that synchronous memory - operations initiated on this context will always synchronize. See - further documentation in the section titled "API Synchronization - behavior" to learn more about cases when synchronous memory - operations can exhibit asynchronous behavior. + If `edgeData_out` is non-NULL then `dependencies_out` must be as well. + If `dependencies_out` is non-NULL and `edgeData_out` is NULL, but there + is non-zero edge data for one or more of the current stream + dependencies, the call will return :py:obj:`~.cudaErrorLossyQuery`. Parameters ---------- - flags : unsigned int - Parameters for device operation + stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + The stream to query Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorStreamCaptureImplicit`, :py:obj:`~.cudaErrorLossyQuery` + captureStatus_out : :py:obj:`~.cudaStreamCaptureStatus` + Location to return the capture status of the stream; required + id_out : unsigned long long + Optional location to return an id for the capture sequence, which + is unique over the lifetime of the process + graph_out : :py:obj:`~.cudaGraph_t` + Optional location to return the graph being captured into. All + operations other than destroy and node removal are permitted on the + graph while the capture sequence is in progress. This API does not + transfer ownership of the graph, which is transferred or destroyed + at :py:obj:`~.cudaStreamEndCapture`. Note that the graph handle may + be invalidated before end of capture for certain errors. Nodes that + are or become unreachable from the original stream at + :py:obj:`~.cudaStreamEndCapture` due to direct actions on the graph + do not trigger :py:obj:`~.cudaErrorStreamCaptureUnjoined`. + dependencies_out : list[:py:obj:`~.cudaGraphNode_t`] + Optional location to store a pointer to an array of nodes. The next + node to be captured in the stream will depend on this set of nodes, + absent operations such as event wait which modify this set. The + array pointer is valid until the next API call which operates on + the stream or until the capture is terminated. The node handles may + be copied out and are valid until they or the graph is destroyed. + The driver-owned array may also be passed directly to APIs that + operate on the graph (not the stream) without copying. + edgeData_out : list[:py:obj:`~.cudaGraphEdgeData`] + Optional location to store a pointer to an array of graph edge + data. This array parallels `dependencies_out`; the next node to be + added has an edge to `dependencies_out`[i] with annotation + `edgeData_out`[i] for each `i`. The array pointer is valid until + the next API call which operates on the stream or until the capture + is terminated. + numDependencies_out : int + Optional location to store the size of the array returned in + dependencies_out. See Also -------- - :py:obj:`~.cudaGetDeviceFlags`, :py:obj:`~.cudaGetDeviceCount`, :py:obj:`~.cudaGetDevice`, :py:obj:`~.cudaGetDeviceProperties`, :py:obj:`~.cudaSetDevice`, :py:obj:`~.cudaSetValidDevices`, :py:obj:`~.cudaInitDevice`, :py:obj:`~.cudaChooseDevice`, :py:obj:`~.cuDevicePrimaryCtxSetFlags` + :py:obj:`~.cudaStreamBeginCapture`, :py:obj:`~.cudaStreamIsCapturing`, :py:obj:`~.cudaStreamUpdateCaptureDependencies` """ - err = ccudart.cudaSetDeviceFlags(flags) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaGetDeviceFlags' in found_functions}} + cdef cyruntime.cudaStream_t cystream + if stream is None: + pstream = 0 + elif isinstance(stream, (cudaStream_t,driver.CUstream)): + pstream = int(stream) + else: + pstream = int(cudaStream_t(stream)) + cystream = pstream + cdef cyruntime.cudaStreamCaptureStatus captureStatus_out + cdef unsigned long long id_out = 0 + cdef cudaGraph_t graph_out = cudaGraph_t() + cdef const cyruntime.cudaGraphNode_t* cydependencies_out = NULL + pydependencies_out = [] + cdef const cyruntime.cudaGraphEdgeData* cyedgeData_out = NULL + pyedgeData_out = [] + cdef size_t numDependencies_out = 0 + with nogil: + err = cyruntime.cudaStreamGetCaptureInfo(cystream, &captureStatus_out, &id_out, graph_out._pvt_ptr, &cydependencies_out, &cyedgeData_out, &numDependencies_out) + if cudaError_t(err) == cudaError_t(0): + pydependencies_out = [cudaGraphNode_t() for _ in range(numDependencies_out)] + for idx in range(numDependencies_out): + (pydependencies_out[idx])._pvt_ptr[0] = cydependencies_out[idx] + if cudaError_t(err) == cudaError_t(0): + pyedgeData_out = [cudaGraphEdgeData() for _ in range(numDependencies_out)] + for idx in range(numDependencies_out): + (pyedgeData_out[idx])._pvt_ptr[0] = cyedgeData_out[idx] + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None, None, None, None, None, None) + return (_cudaError_t_SUCCESS, cudaStreamCaptureStatus(captureStatus_out), id_out, graph_out, pydependencies_out, pyedgeData_out, numDependencies_out) @cython.embedsignature(True) -def cudaGetDeviceFlags(): - """ Gets the flags for the current device. +def cudaStreamUpdateCaptureDependencies(stream, dependencies : Optional[tuple[cudaGraphNode_t] | list[cudaGraphNode_t]], dependencyData : Optional[tuple[cudaGraphEdgeData] | list[cudaGraphEdgeData]], size_t numDependencies, unsigned int flags): + """ Update the set of dependencies in a capturing stream. - Returns in `flags` the flags for the current device. If there is a - current device for the calling thread, the flags for the device are - returned. If there is no current device, the flags for the first device - are returned, which may be the default flags. Compare to the behavior - of :py:obj:`~.cudaSetDeviceFlags`. + Modifies the dependency set of a capturing stream. The dependency set + is the set of nodes that the next captured node in the stream will + depend on. - Typically, the flags returned should match the behavior that will be - seen if the calling thread uses a device after this call, without any - change to the flags or current device inbetween by this or another - thread. Note that if the device is not initialized, it is possible for - another thread to change the flags for the current device before it is - initialized. Additionally, when using exclusive mode, if this thread - has not requested a specific device, it may use a device other than the - first device, contrary to the assumption made by this function. + Valid flags are :py:obj:`~.cudaStreamAddCaptureDependencies` and + :py:obj:`~.cudaStreamSetCaptureDependencies`. These control whether the + set passed to the API is added to the existing set or replaces it. A + flags value of 0 defaults to + :py:obj:`~.cudaStreamAddCaptureDependencies`. - If a context has been created via the driver API and is current to the - calling thread, the flags for that context are always returned. + Nodes that are removed from the dependency set via this API do not + result in :py:obj:`~.cudaErrorStreamCaptureUnjoined` if they are + unreachable from the stream at :py:obj:`~.cudaStreamEndCapture`. - Flags returned by this function may specifically include - :py:obj:`~.cudaDeviceMapHost` even though it is not accepted by - :py:obj:`~.cudaSetDeviceFlags` because it is implicit in runtime API - flags. The reason for this is that the current context may have been - created via the driver API in which case the flag is not implicit and - may be unset. + Returns :py:obj:`~.cudaErrorIllegalState` if the stream is not + capturing. + + Parameters + ---------- + stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + The stream to update + dependencies : list[:py:obj:`~.cudaGraphNode_t`] + The set of dependencies to add + dependencyData : list[:py:obj:`~.cudaGraphEdgeData`] + Optional array of data associated with each dependency. + numDependencies : size_t + The size of the dependencies array + flags : unsigned int + See above Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDevice` - flags : unsigned int - Pointer to store the device flags + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorIllegalState` See Also -------- - :py:obj:`~.cudaGetDevice`, :py:obj:`~.cudaGetDeviceProperties`, :py:obj:`~.cudaSetDevice`, :py:obj:`~.cudaSetDeviceFlags`, :py:obj:`~.cudaInitDevice`, :py:obj:`~.cuCtxGetFlags`, :py:obj:`~.cuDevicePrimaryCtxGetState` + :py:obj:`~.cudaStreamBeginCapture`, :py:obj:`~.cudaStreamGetCaptureInfo`, """ - cdef unsigned int flags = 0 - err = ccudart.cudaGetDeviceFlags(&flags) - return (cudaError_t(err), flags) -{{endif}} - -{{if 'cudaStreamCreate' in found_functions}} + dependencyData = [] if dependencyData is None else dependencyData + if not all(isinstance(_x, (cudaGraphEdgeData,)) for _x in dependencyData): + raise TypeError("Argument 'dependencyData' is not instance of type (expected tuple[cyruntime.cudaGraphEdgeData,] or list[cyruntime.cudaGraphEdgeData,]") + dependencies = [] if dependencies is None else dependencies + if not all(isinstance(_x, (cudaGraphNode_t,driver.CUgraphNode)) for _x in dependencies): + raise TypeError("Argument 'dependencies' is not instance of type (expected tuple[cyruntime.cudaGraphNode_t,driver.CUgraphNode] or list[cyruntime.cudaGraphNode_t,driver.CUgraphNode]") + cdef cyruntime.cudaStream_t cystream + if stream is None: + pstream = 0 + elif isinstance(stream, (cudaStream_t,driver.CUstream)): + pstream = int(stream) + else: + pstream = int(cudaStream_t(stream)) + cystream = pstream + cdef cyruntime.cudaGraphNode_t* cydependencies = NULL + if len(dependencies) > 1: + cydependencies = calloc(len(dependencies), sizeof(cyruntime.cudaGraphNode_t)) + if cydependencies is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(dependencies)) + 'x' + str(sizeof(cyruntime.cudaGraphNode_t))) + else: + for idx in range(len(dependencies)): + cydependencies[idx] = (dependencies[idx])._pvt_ptr[0] + elif len(dependencies) == 1: + cydependencies = (dependencies[0])._pvt_ptr + cdef cyruntime.cudaGraphEdgeData* cydependencyData = NULL + if len(dependencyData) > 1: + cydependencyData = calloc(len(dependencyData), sizeof(cyruntime.cudaGraphEdgeData)) + if cydependencyData is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(dependencyData)) + 'x' + str(sizeof(cyruntime.cudaGraphEdgeData))) + for idx in range(len(dependencyData)): + string.memcpy(&cydependencyData[idx], (dependencyData[idx])._pvt_ptr, sizeof(cyruntime.cudaGraphEdgeData)) + elif len(dependencyData) == 1: + cydependencyData = (dependencyData[0])._pvt_ptr + with nogil: + err = cyruntime.cudaStreamUpdateCaptureDependencies(cystream, cydependencies, cydependencyData, numDependencies, flags) + if len(dependencies) > 1 and cydependencies is not NULL: + free(cydependencies) + if len(dependencyData) > 1 and cydependencyData is not NULL: + free(cydependencyData) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaStreamCreate(): - """ Create an asynchronous stream. +def cudaEventCreate(): + """ Creates an event object. - Creates a new asynchronous stream. + Creates an event object for the current device using + :py:obj:`~.cudaEventDefault`. Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` - pStream : :py:obj:`~.cudaStream_t` - Pointer to new stream identifier + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorLaunchFailure`, :py:obj:`~.cudaErrorMemoryAllocation` + event : :py:obj:`~.cudaEvent_t` + Newly created event See Also -------- - :py:obj:`~.cudaStreamCreateWithPriority`, :py:obj:`~.cudaStreamCreateWithFlags`, :py:obj:`~.cudaStreamGetPriority`, :py:obj:`~.cudaStreamGetFlags`, :py:obj:`~.cudaStreamQuery`, :py:obj:`~.cudaStreamSynchronize`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cudaStreamAddCallback`, :py:obj:`~.cudaStreamDestroy`, :py:obj:`~.cuStreamCreate` + cudaEventCreate (C++ API), :py:obj:`~.cudaEventCreateWithFlags`, :py:obj:`~.cudaEventRecord`, :py:obj:`~.cudaEventQuery`, :py:obj:`~.cudaEventSynchronize`, :py:obj:`~.cudaEventDestroy`, :py:obj:`~.cudaEventElapsedTime`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cuEventCreate` """ - cdef cudaStream_t pStream = cudaStream_t() - err = ccudart.cudaStreamCreate(pStream._ptr) - return (cudaError_t(err), pStream) -{{endif}} - -{{if 'cudaStreamCreateWithFlags' in found_functions}} + cdef cudaEvent_t event = cudaEvent_t() + with nogil: + err = cyruntime.cudaEventCreate(event._pvt_ptr) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, event) @cython.embedsignature(True) -def cudaStreamCreateWithFlags(unsigned int flags): - """ Create an asynchronous stream. +def cudaEventCreateWithFlags(unsigned int flags): + """ Creates an event object with the specified flags. - Creates a new asynchronous stream. The `flags` argument determines the - behaviors of the stream. Valid values for `flags` are + Creates an event object for the current device with the specified + flags. Valid flags include: - - :py:obj:`~.cudaStreamDefault`: Default stream creation flag. + - :py:obj:`~.cudaEventDefault`: Default event creation flag. - - :py:obj:`~.cudaStreamNonBlocking`: Specifies that work running in the - created stream may run concurrently with work in stream 0 (the NULL - stream), and that the created stream should perform no implicit - synchronization with stream 0. + - :py:obj:`~.cudaEventBlockingSync`: Specifies that event should use + blocking synchronization. A host thread that uses + :py:obj:`~.cudaEventSynchronize()` to wait on an event created with + this flag will block until the event actually completes. + + - :py:obj:`~.cudaEventDisableTiming`: Specifies that the created event + does not need to record timing data. Events created with this flag + specified and the :py:obj:`~.cudaEventBlockingSync` flag not + specified will provide the best performance when used with + :py:obj:`~.cudaStreamWaitEvent()` and :py:obj:`~.cudaEventQuery()`. + + - :py:obj:`~.cudaEventInterprocess`: Specifies that the created event + may be used as an interprocess event by + :py:obj:`~.cudaIpcGetEventHandle()`. + :py:obj:`~.cudaEventInterprocess` must be specified along with + :py:obj:`~.cudaEventDisableTiming`. Parameters ---------- flags : unsigned int - Parameters for stream creation + Flags for new event Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` - pStream : :py:obj:`~.cudaStream_t` - Pointer to new stream identifier + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorLaunchFailure`, :py:obj:`~.cudaErrorMemoryAllocation` + event : :py:obj:`~.cudaEvent_t` + Newly created event See Also -------- - :py:obj:`~.cudaStreamCreate`, :py:obj:`~.cudaStreamCreateWithPriority`, :py:obj:`~.cudaStreamGetFlags`, :py:obj:`~.cudaStreamQuery`, :py:obj:`~.cudaStreamSynchronize`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cudaStreamAddCallback`, :py:obj:`~.cudaStreamDestroy`, :py:obj:`~.cuStreamCreate` + :py:obj:`~.cudaEventCreate (C API)`, :py:obj:`~.cudaEventSynchronize`, :py:obj:`~.cudaEventDestroy`, :py:obj:`~.cudaEventElapsedTime`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cuEventCreate` """ - cdef cudaStream_t pStream = cudaStream_t() - err = ccudart.cudaStreamCreateWithFlags(pStream._ptr, flags) - return (cudaError_t(err), pStream) -{{endif}} - -{{if 'cudaStreamCreateWithPriority' in found_functions}} + cdef cudaEvent_t event = cudaEvent_t() + with nogil: + err = cyruntime.cudaEventCreateWithFlags(event._pvt_ptr, flags) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, event) @cython.embedsignature(True) -def cudaStreamCreateWithPriority(unsigned int flags, int priority): - """ Create an asynchronous stream with the specified priority. +def cudaEventRecord(event, stream): + """ Records an event. - Creates a stream with the specified priority and returns a handle in - `pStream`. This affects the scheduling priority of work in the stream. - Priorities provide a hint to preferentially run work with higher - priority when possible, but do not preempt already-running work or - provide any other functional guarantee on execution order. + Captures in `event` the contents of `stream` at the time of this call. + `event` and `stream` must be on the same CUDA context. Calls such as + :py:obj:`~.cudaEventQuery()` or :py:obj:`~.cudaStreamWaitEvent()` will + then examine or wait for completion of the work that was captured. Uses + of `stream` after this call do not modify `event`. See note on default + stream behavior for what is captured in the default case. - `priority` follows a convention where lower numbers represent higher - priorities. '0' represents default priority. The range of meaningful - numerical priorities can be queried using - :py:obj:`~.cudaDeviceGetStreamPriorityRange`. If the specified priority - is outside the numerical range returned by - :py:obj:`~.cudaDeviceGetStreamPriorityRange`, it will automatically be - clamped to the lowest or the highest number in the range. + :py:obj:`~.cudaEventRecord()` can be called multiple times on the same + event and will overwrite the previously captured state. Other APIs such + as :py:obj:`~.cudaStreamWaitEvent()` use the most recently captured + state at the time of the API call, and are not affected by later calls + to :py:obj:`~.cudaEventRecord()`. Before the first call to + :py:obj:`~.cudaEventRecord()`, an event represents an empty set of + work, so for example :py:obj:`~.cudaEventQuery()` would return + :py:obj:`~.cudaSuccess`. Parameters ---------- - flags : unsigned int - Flags for stream creation. See - :py:obj:`~.cudaStreamCreateWithFlags` for a list of valid flags - that can be passed - priority : int - Priority of the stream. Lower numbers represent higher priorities. - See :py:obj:`~.cudaDeviceGetStreamPriorityRange` for more - information about the meaningful stream priorities that can be - passed. + event : :py:obj:`~.CUevent` or :py:obj:`~.cudaEvent_t` + Event to record + stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + Stream in which to record event Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` - pStream : :py:obj:`~.cudaStream_t` - Pointer to new stream identifier + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorLaunchFailure` See Also -------- - :py:obj:`~.cudaStreamCreate`, :py:obj:`~.cudaStreamCreateWithFlags`, :py:obj:`~.cudaDeviceGetStreamPriorityRange`, :py:obj:`~.cudaStreamGetPriority`, :py:obj:`~.cudaStreamQuery`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cudaStreamAddCallback`, :py:obj:`~.cudaStreamSynchronize`, :py:obj:`~.cudaStreamDestroy`, :py:obj:`~.cuStreamCreateWithPriority` - - Notes - ----- - Stream priorities are supported only on GPUs with compute capability 3.5 or higher. - - In the current implementation, only compute kernels launched in priority streams are affected by the stream's priority. Stream priorities have no effect on host-to-device and device-to-host memory operations. + :py:obj:`~.cudaEventCreate (C API)`, :py:obj:`~.cudaEventCreateWithFlags`, :py:obj:`~.cudaEventQuery`, :py:obj:`~.cudaEventSynchronize`, :py:obj:`~.cudaEventDestroy`, :py:obj:`~.cudaEventElapsedTime`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cudaEventRecordWithFlags`, :py:obj:`~.cuEventRecord` """ - cdef cudaStream_t pStream = cudaStream_t() - err = ccudart.cudaStreamCreateWithPriority(pStream._ptr, flags, priority) - return (cudaError_t(err), pStream) -{{endif}} - -{{if 'cudaStreamGetPriority' in found_functions}} + cdef cyruntime.cudaStream_t cystream + if stream is None: + pstream = 0 + elif isinstance(stream, (cudaStream_t,driver.CUstream)): + pstream = int(stream) + else: + pstream = int(cudaStream_t(stream)) + cystream = pstream + cdef cyruntime.cudaEvent_t cyevent + if event is None: + pevent = 0 + elif isinstance(event, (cudaEvent_t,driver.CUevent)): + pevent = int(event) + else: + pevent = int(cudaEvent_t(event)) + cyevent = pevent + with nogil: + err = cyruntime.cudaEventRecord(cyevent, cystream) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaStreamGetPriority(hStream): - """ Query the priority of a stream. - - Query the priority of a stream. The priority is returned in in - `priority`. Note that if the stream was created with a priority outside - the meaningful numerical range returned by - :py:obj:`~.cudaDeviceGetStreamPriorityRange`, this function returns the - clamped priority. See :py:obj:`~.cudaStreamCreateWithPriority` for - details about priority clamping. - - Parameters - ---------- - hStream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` - Handle to the stream to be queried +def cudaEventRecordWithFlags(event, stream, unsigned int flags): + """ Records an event. - Returns - ------- - cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle` - priority : int - Pointer to a signed integer in which the stream's priority is - returned + Captures in `event` the contents of `stream` at the time of this call. + `event` and `stream` must be on the same CUDA context. Calls such as + :py:obj:`~.cudaEventQuery()` or :py:obj:`~.cudaStreamWaitEvent()` will + then examine or wait for completion of the work that was captured. Uses + of `stream` after this call do not modify `event`. See note on default + stream behavior for what is captured in the default case. - See Also - -------- - :py:obj:`~.cudaStreamCreateWithPriority`, :py:obj:`~.cudaDeviceGetStreamPriorityRange`, :py:obj:`~.cudaStreamGetFlags`, :py:obj:`~.cuStreamGetPriority` - """ - cdef ccudart.cudaStream_t chStream - if hStream is None: - chStream = 0 - elif isinstance(hStream, (cudaStream_t,cuda.CUstream)): - phStream = int(hStream) - chStream = phStream - else: - phStream = int(cudaStream_t(hStream)) - chStream = phStream - cdef int priority = 0 - err = ccudart.cudaStreamGetPriority(chStream, &priority) - return (cudaError_t(err), priority) -{{endif}} + :py:obj:`~.cudaEventRecordWithFlags()` can be called multiple times on + the same event and will overwrite the previously captured state. Other + APIs such as :py:obj:`~.cudaStreamWaitEvent()` use the most recently + captured state at the time of the API call, and are not affected by + later calls to :py:obj:`~.cudaEventRecordWithFlags()`. Before the first + call to :py:obj:`~.cudaEventRecordWithFlags()`, an event represents an + empty set of work, so for example :py:obj:`~.cudaEventQuery()` would + return :py:obj:`~.cudaSuccess`. -{{if 'cudaStreamGetFlags' in found_functions}} + flags include: -@cython.embedsignature(True) -def cudaStreamGetFlags(hStream): - """ Query the flags of a stream. + - :py:obj:`~.cudaEventRecordDefault`: Default event creation flag. - Query the flags of a stream. The flags are returned in `flags`. See - :py:obj:`~.cudaStreamCreateWithFlags` for a list of valid flags. + - :py:obj:`~.cudaEventRecordExternal`: Event is captured in the graph + as an external event node when performing stream capture. Parameters ---------- - hStream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` - Handle to the stream to be queried + event : :py:obj:`~.CUevent` or :py:obj:`~.cudaEvent_t` + Event to record + stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + Stream in which to record event + flags : unsigned int + Parameters for the operation(See above) Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle` - flags : unsigned int - Pointer to an unsigned integer in which the stream's flags are - returned + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorLaunchFailure` See Also -------- - :py:obj:`~.cudaStreamCreateWithPriority`, :py:obj:`~.cudaStreamCreateWithFlags`, :py:obj:`~.cudaStreamGetPriority`, :py:obj:`~.cuStreamGetFlags` + :py:obj:`~.cudaEventCreate (C API)`, :py:obj:`~.cudaEventCreateWithFlags`, :py:obj:`~.cudaEventQuery`, :py:obj:`~.cudaEventSynchronize`, :py:obj:`~.cudaEventDestroy`, :py:obj:`~.cudaEventElapsedTime`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cudaEventRecord`, :py:obj:`~.cuEventRecord`, """ - cdef ccudart.cudaStream_t chStream - if hStream is None: - chStream = 0 - elif isinstance(hStream, (cudaStream_t,cuda.CUstream)): - phStream = int(hStream) - chStream = phStream + cdef cyruntime.cudaStream_t cystream + if stream is None: + pstream = 0 + elif isinstance(stream, (cudaStream_t,driver.CUstream)): + pstream = int(stream) else: - phStream = int(cudaStream_t(hStream)) - chStream = phStream - cdef unsigned int flags = 0 - err = ccudart.cudaStreamGetFlags(chStream, &flags) - return (cudaError_t(err), flags) -{{endif}} - -{{if 'cudaStreamGetId' in found_functions}} + pstream = int(cudaStream_t(stream)) + cystream = pstream + cdef cyruntime.cudaEvent_t cyevent + if event is None: + pevent = 0 + elif isinstance(event, (cudaEvent_t,driver.CUevent)): + pevent = int(event) + else: + pevent = int(cudaEvent_t(event)) + cyevent = pevent + with nogil: + err = cyruntime.cudaEventRecordWithFlags(cyevent, cystream, flags) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaStreamGetId(hStream): - """ Query the Id of a stream. - - Query the Id of a stream. The Id is returned in `streamId`. The Id is - unique for the life of the program. +def cudaEventQuery(event): + """ Queries an event's status. - The stream handle `hStream` can refer to any of the following: + Queries the status of all work currently captured by `event`. See + :py:obj:`~.cudaEventRecord()` for details on what is captured by an + event. - - a stream created via any of the CUDA runtime APIs such as - :py:obj:`~.cudaStreamCreate`, :py:obj:`~.cudaStreamCreateWithFlags` - and :py:obj:`~.cudaStreamCreateWithPriority`, or their driver API - equivalents such as :py:obj:`~.cuStreamCreate` or - :py:obj:`~.cuStreamCreateWithPriority`. Passing an invalid handle - will result in undefined behavior. + Returns :py:obj:`~.cudaSuccess` if all captured work has been + completed, or :py:obj:`~.cudaErrorNotReady` if any captured work is + incomplete. - - any of the special streams such as the NULL stream, - :py:obj:`~.cudaStreamLegacy` and :py:obj:`~.cudaStreamPerThread` - respectively. The driver API equivalents of these are also accepted - which are NULL, :py:obj:`~.CU_STREAM_LEGACY` and - :py:obj:`~.CU_STREAM_PER_THREAD`. + For the purposes of Unified Memory, a return value of + :py:obj:`~.cudaSuccess` is equivalent to having called + :py:obj:`~.cudaEventSynchronize()`. Parameters ---------- - hStream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` - Handle to the stream to be queried + event : :py:obj:`~.CUevent` or :py:obj:`~.cudaEvent_t` + Event to query Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle` - streamId : unsigned long long - Pointer to an unsigned long long in which the stream Id is returned + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorNotReady`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorLaunchFailure` See Also -------- - :py:obj:`~.cudaStreamCreateWithPriority`, :py:obj:`~.cudaStreamCreateWithFlags`, :py:obj:`~.cudaStreamGetPriority`, :py:obj:`~.cudaStreamGetFlags`, :py:obj:`~.cuStreamGetId` + :py:obj:`~.cudaEventCreate (C API)`, :py:obj:`~.cudaEventCreateWithFlags`, :py:obj:`~.cudaEventRecord`, :py:obj:`~.cudaEventSynchronize`, :py:obj:`~.cudaEventDestroy`, :py:obj:`~.cudaEventElapsedTime`, :py:obj:`~.cuEventQuery` """ - cdef ccudart.cudaStream_t chStream - if hStream is None: - chStream = 0 - elif isinstance(hStream, (cudaStream_t,cuda.CUstream)): - phStream = int(hStream) - chStream = phStream + cdef cyruntime.cudaEvent_t cyevent + if event is None: + pevent = 0 + elif isinstance(event, (cudaEvent_t,driver.CUevent)): + pevent = int(event) else: - phStream = int(cudaStream_t(hStream)) - chStream = phStream - cdef unsigned long long streamId = 0 - err = ccudart.cudaStreamGetId(chStream, &streamId) - return (cudaError_t(err), streamId) -{{endif}} + pevent = int(cudaEvent_t(event)) + cyevent = pevent + with nogil: + err = cyruntime.cudaEventQuery(cyevent) + return (_cudaError_t(err),) + +@cython.embedsignature(True) +def cudaEventSynchronize(event): + """ Waits for an event to complete. -{{if 'cudaCtxResetPersistingL2Cache' in found_functions}} + Waits until the completion of all work currently captured in `event`. + See :py:obj:`~.cudaEventRecord()` for details on what is captured by an + event. -@cython.embedsignature(True) -def cudaCtxResetPersistingL2Cache(): - """ Resets all persisting lines in cache to normal status. + Waiting for an event that was created with the + :py:obj:`~.cudaEventBlockingSync` flag will cause the calling CPU + thread to block until the event has been completed by the device. If + the :py:obj:`~.cudaEventBlockingSync` flag has not been set, then the + CPU thread will busy-wait until the event has been completed by the + device. - Resets all persisting lines in cache to normal status. Takes effect on - function return. + Parameters + ---------- + event : :py:obj:`~.CUevent` or :py:obj:`~.cudaEvent_t` + Event to wait for Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorLaunchFailure` See Also -------- - :py:obj:`~.cudaAccessPolicyWindow` + :py:obj:`~.cudaEventCreate (C API)`, :py:obj:`~.cudaEventCreateWithFlags`, :py:obj:`~.cudaEventRecord`, :py:obj:`~.cudaEventQuery`, :py:obj:`~.cudaEventDestroy`, :py:obj:`~.cudaEventElapsedTime`, :py:obj:`~.cuEventSynchronize` """ - err = ccudart.cudaCtxResetPersistingL2Cache() - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaStreamCopyAttributes' in found_functions}} + cdef cyruntime.cudaEvent_t cyevent + if event is None: + pevent = 0 + elif isinstance(event, (cudaEvent_t,driver.CUevent)): + pevent = int(event) + else: + pevent = int(cudaEvent_t(event)) + cyevent = pevent + with nogil: + err = cyruntime.cudaEventSynchronize(cyevent) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaStreamCopyAttributes(dst, src): - """ Copies attributes from source stream to destination stream. +def cudaEventDestroy(event): + """ Destroys an event object. - Copies attributes from source stream `src` to destination stream `dst`. - Both streams must have the same context. + Destroys the event specified by `event`. + + An event may be destroyed before it is complete (i.e., while + :py:obj:`~.cudaEventQuery()` would return + :py:obj:`~.cudaErrorNotReady`). In this case, the call does not block + on completion of the event, and any associated resources will + automatically be released asynchronously at completion. Parameters ---------- - dst : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` - Destination stream - src : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` - Source stream For attributes see :py:obj:`~.cudaStreamAttrID` + event : :py:obj:`~.CUevent` or :py:obj:`~.cudaEvent_t` + Event to destroy Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorNotSupported` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorLaunchFailure` See Also -------- - :py:obj:`~.cudaAccessPolicyWindow` + :py:obj:`~.cudaEventCreate (C API)`, :py:obj:`~.cudaEventCreateWithFlags`, :py:obj:`~.cudaEventQuery`, :py:obj:`~.cudaEventSynchronize`, :py:obj:`~.cudaEventRecord`, :py:obj:`~.cudaEventElapsedTime`, :py:obj:`~.cuEventDestroy` """ - cdef ccudart.cudaStream_t csrc - if src is None: - csrc = 0 - elif isinstance(src, (cudaStream_t,cuda.CUstream)): - psrc = int(src) - csrc = psrc - else: - psrc = int(cudaStream_t(src)) - csrc = psrc - cdef ccudart.cudaStream_t cdst - if dst is None: - cdst = 0 - elif isinstance(dst, (cudaStream_t,cuda.CUstream)): - pdst = int(dst) - cdst = pdst + cdef cyruntime.cudaEvent_t cyevent + if event is None: + pevent = 0 + elif isinstance(event, (cudaEvent_t,driver.CUevent)): + pevent = int(event) else: - pdst = int(cudaStream_t(dst)) - cdst = pdst - err = ccudart.cudaStreamCopyAttributes(cdst, csrc) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaStreamGetAttribute' in found_functions}} + pevent = int(cudaEvent_t(event)) + cyevent = pevent + with nogil: + err = cyruntime.cudaEventDestroy(cyevent) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaStreamGetAttribute(hStream, attr not None : cudaStreamAttrID): - """ Queries stream attribute. +def cudaEventElapsedTime(start, end): + """ Computes the elapsed time between events. - Queries attribute `attr` from `hStream` and stores it in corresponding - member of `value_out`. + Computes the elapsed time between two events (in milliseconds with a + resolution of around 0.5 microseconds). Note this API is not guaranteed + to return the latest errors for pending work. As such this API is + intended to serve as a elapsed time calculation only and polling for + completion on the events to be compared should be done with + :py:obj:`~.cudaEventQuery` instead. - Parameters - ---------- - hStream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + If either event was last recorded in a non-NULL stream, the resulting + time may be greater than expected (even if both used the same stream + handle). This happens because the :py:obj:`~.cudaEventRecord()` + operation takes place asynchronously and there is no guarantee that the + measured latency is actually just between the two events. Any number of + other different stream operations could execute in between the two + measured events, thus altering the timing in a significant way. - attr : :py:obj:`~.cudaStreamAttrID` + If :py:obj:`~.cudaEventRecord()` has not been called on either event, + then :py:obj:`~.cudaErrorInvalidResourceHandle` is returned. If + :py:obj:`~.cudaEventRecord()` has been called on both events but one or + both of them has not yet been completed (that is, + :py:obj:`~.cudaEventQuery()` would return :py:obj:`~.cudaErrorNotReady` + on at least one of the events), :py:obj:`~.cudaErrorNotReady` is + returned. If either event was created with the + :py:obj:`~.cudaEventDisableTiming` flag, then this function will return + :py:obj:`~.cudaErrorInvalidResourceHandle`. + Parameters + ---------- + start : :py:obj:`~.CUevent` or :py:obj:`~.cudaEvent_t` + Starting event + end : :py:obj:`~.CUevent` or :py:obj:`~.cudaEvent_t` + Ending event Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle` - value_out : :py:obj:`~.cudaStreamAttrValue` - + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorNotReady`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorLaunchFailure`, :py:obj:`~.cudaErrorUnknown` + ms : float + Time between `start` and `end` in ms See Also -------- - :py:obj:`~.cudaAccessPolicyWindow` + :py:obj:`~.cudaEventCreate (C API)`, :py:obj:`~.cudaEventCreateWithFlags`, :py:obj:`~.cudaEventQuery`, :py:obj:`~.cudaEventSynchronize`, :py:obj:`~.cudaEventDestroy`, :py:obj:`~.cudaEventRecord`, :py:obj:`~.cuEventElapsedTime` """ - cdef ccudart.cudaStream_t chStream - if hStream is None: - chStream = 0 - elif isinstance(hStream, (cudaStream_t,cuda.CUstream)): - phStream = int(hStream) - chStream = phStream + cdef cyruntime.cudaEvent_t cyend + if end is None: + pend = 0 + elif isinstance(end, (cudaEvent_t,driver.CUevent)): + pend = int(end) else: - phStream = int(cudaStream_t(hStream)) - chStream = phStream - cdef ccudart.cudaStreamAttrID cattr = attr.value - cdef cudaStreamAttrValue value_out = cudaStreamAttrValue() - err = ccudart.cudaStreamGetAttribute(chStream, cattr, value_out._ptr) - return (cudaError_t(err), value_out) -{{endif}} - -{{if 'cudaStreamSetAttribute' in found_functions}} + pend = int(cudaEvent_t(end)) + cyend = pend + cdef cyruntime.cudaEvent_t cystart + if start is None: + pstart = 0 + elif isinstance(start, (cudaEvent_t,driver.CUevent)): + pstart = int(start) + else: + pstart = int(cudaEvent_t(start)) + cystart = pstart + cdef float ms = 0 + with nogil: + err = cyruntime.cudaEventElapsedTime(&ms, cystart, cyend) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, ms) @cython.embedsignature(True) -def cudaStreamSetAttribute(hStream, attr not None : cudaStreamAttrID, value : Optional[cudaStreamAttrValue]): - """ Sets stream attribute. +def cudaImportExternalMemory(memHandleDesc : Optional[cudaExternalMemoryHandleDesc]): + """ Imports an external memory object. - Sets attribute `attr` on `hStream` from corresponding attribute of - `value`. The updated attribute will be applied to subsequent work - submitted to the stream. It will not affect previously submitted work. + Imports an externally allocated memory object and returns a handle to + that in `extMem_out`. - Parameters - ---------- - hStream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + The properties of the handle being imported must be described in + `memHandleDesc`. The :py:obj:`~.cudaExternalMemoryHandleDesc` structure + is defined as follows: - attr : :py:obj:`~.cudaStreamAttrID` + **View CUDA Toolkit Documentation for a C++ code example** - value : :py:obj:`~.cudaStreamAttrValue` + where :py:obj:`~.cudaExternalMemoryHandleDesc.type` specifies the type + of handle being imported. :py:obj:`~.cudaExternalMemoryHandleType` is + defined as: + **View CUDA Toolkit Documentation for a C++ code example** - Returns - ------- - cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle` + If :py:obj:`~.cudaExternalMemoryHandleDesc.type` is + :py:obj:`~.cudaExternalMemoryHandleTypeOpaqueFd`, then + :py:obj:`~.cudaExternalMemoryHandleDesc.handle.fd` must be a valid file + descriptor referencing a memory object. Ownership of the file + descriptor is transferred to the CUDA driver when the handle is + imported successfully. Performing any operations on the file descriptor + after it is imported results in undefined behavior. - See Also - -------- - :py:obj:`~.cudaAccessPolicyWindow` - """ - cdef ccudart.cudaStream_t chStream - if hStream is None: - chStream = 0 - elif isinstance(hStream, (cudaStream_t,cuda.CUstream)): - phStream = int(hStream) - chStream = phStream - else: - phStream = int(cudaStream_t(hStream)) - chStream = phStream - cdef ccudart.cudaStreamAttrID cattr = attr.value - cdef ccudart.cudaStreamAttrValue* cvalue_ptr = value._ptr if value != None else NULL - err = ccudart.cudaStreamSetAttribute(chStream, cattr, cvalue_ptr) - return (cudaError_t(err),) -{{endif}} + If :py:obj:`~.cudaExternalMemoryHandleDesc.type` is + :py:obj:`~.cudaExternalMemoryHandleTypeOpaqueWin32`, then exactly one + of :py:obj:`~.cudaExternalMemoryHandleDesc.handle.win32.handle` and + :py:obj:`~.cudaExternalMemoryHandleDesc.handle.win32.name` must not be + NULL. If :py:obj:`~.cudaExternalMemoryHandleDesc.handle.win32.handle` + is not NULL, then it must represent a valid shared NT handle that + references a memory object. Ownership of this handle is not transferred + to CUDA after the import operation, so the application must release the + handle using the appropriate system call. If + :py:obj:`~.cudaExternalMemoryHandleDesc.handle.win32.name` is not NULL, + then it must point to a NULL-terminated array of UTF-16 characters that + refers to a memory object. + + If :py:obj:`~.cudaExternalMemoryHandleDesc.type` is + :py:obj:`~.cudaExternalMemoryHandleTypeOpaqueWin32Kmt`, then + :py:obj:`~.cudaExternalMemoryHandleDesc.handle.win32.handle` must be + non-NULL and :py:obj:`~.cudaExternalMemoryHandleDesc.handle.win32.name` + must be NULL. The handle specified must be a globally shared KMT + handle. This handle does not hold a reference to the underlying object, + and thus will be invalid when all references to the memory object are + destroyed. -{{if 'cudaStreamDestroy' in found_functions}} + If :py:obj:`~.cudaExternalMemoryHandleDesc.type` is + :py:obj:`~.cudaExternalMemoryHandleTypeD3D12Heap`, then exactly one of + :py:obj:`~.cudaExternalMemoryHandleDesc.handle.win32.handle` and + :py:obj:`~.cudaExternalMemoryHandleDesc.handle.win32.name` must not be + NULL. If :py:obj:`~.cudaExternalMemoryHandleDesc.handle.win32.handle` + is not NULL, then it must represent a valid shared NT handle that is + returned by ID3D12Device::CreateSharedHandle when referring to a + ID3D12Heap object. This handle holds a reference to the underlying + object. If :py:obj:`~.cudaExternalMemoryHandleDesc.handle.win32.name` + is not NULL, then it must point to a NULL-terminated array of UTF-16 + characters that refers to a ID3D12Heap object. -@cython.embedsignature(True) -def cudaStreamDestroy(stream): - """ Destroys and cleans up an asynchronous stream. + If :py:obj:`~.cudaExternalMemoryHandleDesc.type` is + :py:obj:`~.cudaExternalMemoryHandleTypeD3D12Resource`, then exactly one + of :py:obj:`~.cudaExternalMemoryHandleDesc.handle.win32.handle` and + :py:obj:`~.cudaExternalMemoryHandleDesc.handle.win32.name` must not be + NULL. If :py:obj:`~.cudaExternalMemoryHandleDesc.handle.win32.handle` + is not NULL, then it must represent a valid shared NT handle that is + returned by ID3D12Device::CreateSharedHandle when referring to a + ID3D12Resource object. This handle holds a reference to the underlying + object. If :py:obj:`~.cudaExternalMemoryHandleDesc.handle.win32.name` + is not NULL, then it must point to a NULL-terminated array of UTF-16 + characters that refers to a ID3D12Resource object. - Destroys and cleans up the asynchronous stream specified by `stream`. + If :py:obj:`~.cudaExternalMemoryHandleDesc.type` is + :py:obj:`~.cudaExternalMemoryHandleTypeD3D11Resource`,then exactly one + of :py:obj:`~.cudaExternalMemoryHandleDesc.handle.win32.handle` and + :py:obj:`~.cudaExternalMemoryHandleDesc.handle.win32.name` must not be + NULL. If :py:obj:`~.cudaExternalMemoryHandleDesc.handle.win32.handle` + is not NULL, then it must represent a valid shared NT handle that is + returned by IDXGIResource1::CreateSharedHandle when referring to a + ID3D11Resource object. If + :py:obj:`~.cudaExternalMemoryHandleDesc.handle.win32.name` is not NULL, + then it must point to a NULL-terminated array of UTF-16 characters that + refers to a ID3D11Resource object. - In case the device is still doing work in the stream `stream` when - :py:obj:`~.cudaStreamDestroy()` is called, the function will return - immediately and the resources associated with `stream` will be released - automatically once the device has completed all work in `stream`. + If :py:obj:`~.cudaExternalMemoryHandleDesc.type` is + :py:obj:`~.cudaExternalMemoryHandleTypeD3D11ResourceKmt`, then + :py:obj:`~.cudaExternalMemoryHandleDesc.handle.win32.handle` must be + non-NULL and :py:obj:`~.cudaExternalMemoryHandleDesc.handle.win32.name` + must be NULL. The handle specified must be a valid shared KMT handle + that is returned by IDXGIResource::GetSharedHandle when referring to a + ID3D11Resource object. + + If :py:obj:`~.cudaExternalMemoryHandleDesc.type` is + :py:obj:`~.cudaExternalMemoryHandleTypeNvSciBuf`, then + :py:obj:`~.cudaExternalMemoryHandleDesc.handle.nvSciBufObject` must be + NON-NULL and reference a valid NvSciBuf object. If the NvSciBuf object + imported into CUDA is also mapped by other drivers, then the + application must use :py:obj:`~.cudaWaitExternalSemaphoresAsync` or + :py:obj:`~.cudaSignalExternalSemaphoresAsync` as approprriate barriers + to maintain coherence between CUDA and the other drivers. See + :py:obj:`~.cudaExternalSemaphoreWaitSkipNvSciBufMemSync` and + :py:obj:`~.cudaExternalSemaphoreSignalSkipNvSciBufMemSync` for memory + synchronization. + + The size of the memory object must be specified in + :py:obj:`~.cudaExternalMemoryHandleDesc.size`. + + Specifying the flag :py:obj:`~.cudaExternalMemoryDedicated` in + :py:obj:`~.cudaExternalMemoryHandleDesc.flags` indicates that the + resource is a dedicated resource. The definition of what a dedicated + resource is outside the scope of this extension. This flag must be set + if :py:obj:`~.cudaExternalMemoryHandleDesc.type` is one of the + following: :py:obj:`~.cudaExternalMemoryHandleTypeD3D12Resource` + :py:obj:`~.cudaExternalMemoryHandleTypeD3D11Resource` + :py:obj:`~.cudaExternalMemoryHandleTypeD3D11ResourceKmt` Parameters ---------- - stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` - Stream identifier + memHandleDesc : :py:obj:`~.cudaExternalMemoryHandleDesc` + Memory import handle descriptor Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorOperatingSystem` + extMem_out : :py:obj:`~.cudaExternalMemory_t` + Returned handle to an external memory object See Also -------- - :py:obj:`~.cudaStreamCreate`, :py:obj:`~.cudaStreamCreateWithFlags`, :py:obj:`~.cudaStreamQuery`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cudaStreamSynchronize`, :py:obj:`~.cudaStreamAddCallback`, :py:obj:`~.cuStreamDestroy` - """ - cdef ccudart.cudaStream_t cstream - if stream is None: - cstream = 0 - elif isinstance(stream, (cudaStream_t,cuda.CUstream)): - pstream = int(stream) - cstream = pstream - else: - pstream = int(cudaStream_t(stream)) - cstream = pstream - err = ccudart.cudaStreamDestroy(cstream) - return (cudaError_t(err),) -{{endif}} + :py:obj:`~.cudaDestroyExternalMemory`, :py:obj:`~.cudaExternalMemoryGetMappedBuffer`, :py:obj:`~.cudaExternalMemoryGetMappedMipmappedArray` -{{if 'cudaStreamWaitEvent' in found_functions}} + Notes + ----- + If the Vulkan memory imported into CUDA is mapped on the CPU then the application must use vkInvalidateMappedMemoryRanges/vkFlushMappedMemoryRanges as well as appropriate Vulkan pipeline barriers to maintain coherence between CPU and GPU. For more information on these APIs, please refer to "Synchronization + and Cache Control" chapter from Vulkan specification. + """ + cdef cudaExternalMemory_t extMem_out = cudaExternalMemory_t() + cdef cyruntime.cudaExternalMemoryHandleDesc* cymemHandleDesc_ptr = memHandleDesc._pvt_ptr if memHandleDesc is not None else NULL + with nogil: + err = cyruntime.cudaImportExternalMemory(extMem_out._pvt_ptr, cymemHandleDesc_ptr) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, extMem_out) @cython.embedsignature(True) -def cudaStreamWaitEvent(stream, event, unsigned int flags): - """ Make a compute stream wait on an event. +def cudaExternalMemoryGetMappedBuffer(extMem, bufferDesc : Optional[cudaExternalMemoryBufferDesc]): + """ Maps a buffer onto an imported memory object. - Makes all future work submitted to `stream` wait for all work captured - in `event`. See :py:obj:`~.cudaEventRecord()` for details on what is - captured by an event. The synchronization will be performed efficiently - on the device when applicable. `event` may be from a different device - than `stream`. + Maps a buffer onto an imported memory object and returns a device + pointer in `devPtr`. - flags include: + The properties of the buffer being mapped must be described in + `bufferDesc`. The :py:obj:`~.cudaExternalMemoryBufferDesc` structure is + defined as follows: - - :py:obj:`~.cudaEventWaitDefault`: Default event creation flag. + **View CUDA Toolkit Documentation for a C++ code example** + + where :py:obj:`~.cudaExternalMemoryBufferDesc.offset` is the offset in + the memory object where the buffer's base address is. + :py:obj:`~.cudaExternalMemoryBufferDesc.size` is the size of the + buffer. :py:obj:`~.cudaExternalMemoryBufferDesc.flags` must be zero. + + The offset and size have to be suitably aligned to match the + requirements of the external API. Mapping two buffers whose ranges + overlap may or may not result in the same virtual address being + returned for the overlapped portion. In such cases, the application + must ensure that all accesses to that region from the GPU are volatile. + Otherwise writes made via one address are not guaranteed to be visible + via the other address, even if they're issued by the same thread. It is + recommended that applications map the combined range instead of mapping + separate buffers and then apply the appropriate offsets to the returned + pointer to derive the individual buffers. - - :py:obj:`~.cudaEventWaitExternal`: Event is captured in the graph as - an external event node when performing stream capture. + The returned pointer `devPtr` must be freed using :py:obj:`~.cudaFree`. Parameters ---------- - stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` - Stream to wait - event : :py:obj:`~.CUevent` or :py:obj:`~.cudaEvent_t` - Event to wait on - flags : unsigned int - Parameters for the operation(See above) + extMem : :py:obj:`~.cudaExternalMemory_t` + Handle to external memory object + bufferDesc : :py:obj:`~.cudaExternalMemoryBufferDesc` + Buffer descriptor Returns ------- cudaError_t :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle` + devPtr : Any + Returned device pointer to buffer See Also -------- - :py:obj:`~.cudaStreamCreate`, :py:obj:`~.cudaStreamCreateWithFlags`, :py:obj:`~.cudaStreamQuery`, :py:obj:`~.cudaStreamSynchronize`, :py:obj:`~.cudaStreamAddCallback`, :py:obj:`~.cudaStreamDestroy`, :py:obj:`~.cuStreamWaitEvent` + :py:obj:`~.cudaImportExternalMemory`, :py:obj:`~.cudaDestroyExternalMemory`, :py:obj:`~.cudaExternalMemoryGetMappedMipmappedArray` """ - cdef ccudart.cudaEvent_t cevent - if event is None: - cevent = 0 - elif isinstance(event, (cudaEvent_t,cuda.CUevent)): - pevent = int(event) - cevent = pevent - else: - pevent = int(cudaEvent_t(event)) - cevent = pevent - cdef ccudart.cudaStream_t cstream - if stream is None: - cstream = 0 - elif isinstance(stream, (cudaStream_t,cuda.CUstream)): - pstream = int(stream) - cstream = pstream + cdef cyruntime.cudaExternalMemory_t cyextMem + if extMem is None: + pextMem = 0 + elif isinstance(extMem, (cudaExternalMemory_t,)): + pextMem = int(extMem) else: - pstream = int(cudaStream_t(stream)) - cstream = pstream + pextMem = int(cudaExternalMemory_t(extMem)) + cyextMem = pextMem + cdef void_ptr devPtr = 0 + cdef cyruntime.cudaExternalMemoryBufferDesc* cybufferDesc_ptr = bufferDesc._pvt_ptr if bufferDesc is not None else NULL with nogil: - err = ccudart.cudaStreamWaitEvent(cstream, cevent, flags) - - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaStreamAddCallback' in found_functions}} + err = cyruntime.cudaExternalMemoryGetMappedBuffer(&devPtr, cyextMem, cybufferDesc_ptr) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, devPtr) @cython.embedsignature(True) -def cudaStreamAddCallback(stream, callback, userData, unsigned int flags): - """ Add a callback to a compute stream. - - Adds a callback to be called on the host after all currently enqueued - items in the stream have completed. For each cudaStreamAddCallback - call, a callback will be executed exactly once. The callback will block - later work in the stream until it is finished. - - The callback may be passed :py:obj:`~.cudaSuccess` or an error code. In - the event of a device error, all subsequently executed callbacks will - receive an appropriate :py:obj:`~.cudaError_t`. - - Callbacks must not make any CUDA API calls. Attempting to use CUDA APIs - may result in :py:obj:`~.cudaErrorNotPermitted`. Callbacks must not - perform any synchronization that may depend on outstanding device work - or other callbacks that are not mandated to run earlier. Callbacks - without a mandated order (in independent streams) execute in undefined - order and may be serialized. +def cudaExternalMemoryGetMappedMipmappedArray(extMem, mipmapDesc : Optional[cudaExternalMemoryMipmappedArrayDesc]): + """ Maps a CUDA mipmapped array onto an external memory object. - For the purposes of Unified Memory, callback execution makes a number - of guarantees: + Maps a CUDA mipmapped array onto an external object and returns a + handle to it in `mipmap`. - - The callback stream is considered idle for the duration of the - callback. Thus, for example, a callback may always use memory - attached to the callback stream. + The properties of the CUDA mipmapped array being mapped must be + described in `mipmapDesc`. The structure + :py:obj:`~.cudaExternalMemoryMipmappedArrayDesc` is defined as follows: - - The start of execution of a callback has the same effect as - synchronizing an event recorded in the same stream immediately prior - to the callback. It thus synchronizes streams which have been - "joined" prior to the callback. + **View CUDA Toolkit Documentation for a C++ code example** - - Adding device work to any stream does not have the effect of making - the stream active until all preceding callbacks have executed. Thus, - for example, a callback might use global attached memory even if work - has been added to another stream, if it has been properly ordered - with an event. + where :py:obj:`~.cudaExternalMemoryMipmappedArrayDesc.offset` is the + offset in the memory object where the base level of the mipmap chain + is. :py:obj:`~.cudaExternalMemoryMipmappedArrayDesc.formatDesc` + describes the format of the data. + :py:obj:`~.cudaExternalMemoryMipmappedArrayDesc.extent` specifies the + dimensions of the base level of the mipmap chain. + :py:obj:`~.cudaExternalMemoryMipmappedArrayDesc.flags` are flags + associated with CUDA mipmapped arrays. For further details, please + refer to the documentation for :py:obj:`~.cudaMalloc3DArray`. Note that + if the mipmapped array is bound as a color target in the graphics API, + then the flag :py:obj:`~.cudaArrayColorAttachment` must be specified in + :py:obj:`~.cudaExternalMemoryMipmappedArrayDesc.flags`. + :py:obj:`~.cudaExternalMemoryMipmappedArrayDesc.numLevels` specifies + the total number of levels in the mipmap chain. - - Completion of a callback does not cause a stream to become active - except as described above. The callback stream will remain idle if no - device work follows the callback, and will remain idle across - consecutive callbacks without device work in between. Thus, for - example, stream synchronization can be done by signaling from a - callback at the end of the stream. + The returned CUDA mipmapped array must be freed using + :py:obj:`~.cudaFreeMipmappedArray`. Parameters ---------- - stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` - Stream to add callback to - callback : :py:obj:`~.cudaStreamCallback_t` - The function to call once preceding stream operations are complete - userData : Any - User specified data to be passed to the callback function - flags : unsigned int - Reserved for future use, must be 0 + extMem : :py:obj:`~.cudaExternalMemory_t` + Handle to external memory object + mipmapDesc : :py:obj:`~.cudaExternalMemoryMipmappedArrayDesc` + CUDA array descriptor Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorNotSupported` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle` + mipmap : :py:obj:`~.cudaMipmappedArray_t` + Returned CUDA mipmapped array See Also -------- - :py:obj:`~.cudaStreamCreate`, :py:obj:`~.cudaStreamCreateWithFlags`, :py:obj:`~.cudaStreamQuery`, :py:obj:`~.cudaStreamSynchronize`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cudaStreamDestroy`, :py:obj:`~.cudaMallocManaged`, :py:obj:`~.cudaStreamAttachMemAsync`, :py:obj:`~.cudaLaunchHostFunc`, :py:obj:`~.cuStreamAddCallback` + :py:obj:`~.cudaImportExternalMemory`, :py:obj:`~.cudaDestroyExternalMemory`, :py:obj:`~.cudaExternalMemoryGetMappedBuffer` Notes ----- - This function is slated for eventual deprecation and removal. If you do not require the callback to execute in case of a device error, consider using :py:obj:`~.cudaLaunchHostFunc`. Additionally, this function is not supported with :py:obj:`~.cudaStreamBeginCapture` and :py:obj:`~.cudaStreamEndCapture`, unlike :py:obj:`~.cudaLaunchHostFunc`. + If :py:obj:`~.cudaExternalMemoryHandleDesc.type` is :py:obj:`~.cudaExternalMemoryHandleTypeNvSciBuf`, then :py:obj:`~.cudaExternalMemoryMipmappedArrayDesc.numLevels` must not be greater than 1. """ - cdef ccudart.cudaStreamCallback_t ccallback - if callback is None: - ccallback = 0 - elif isinstance(callback, (cudaStreamCallback_t,)): - pcallback = int(callback) - ccallback = pcallback - else: - pcallback = int(cudaStreamCallback_t(callback)) - ccallback = pcallback - cdef ccudart.cudaStream_t cstream - if stream is None: - cstream = 0 - elif isinstance(stream, (cudaStream_t,cuda.CUstream)): - pstream = int(stream) - cstream = pstream + cdef cyruntime.cudaExternalMemory_t cyextMem + if extMem is None: + pextMem = 0 + elif isinstance(extMem, (cudaExternalMemory_t,)): + pextMem = int(extMem) else: - pstream = int(cudaStream_t(stream)) - cstream = pstream - cuserData = utils.HelperInputVoidPtr(userData) - cdef void* cuserData_ptr = cuserData.cptr + pextMem = int(cudaExternalMemory_t(extMem)) + cyextMem = pextMem + cdef cudaMipmappedArray_t mipmap = cudaMipmappedArray_t() + cdef cyruntime.cudaExternalMemoryMipmappedArrayDesc* cymipmapDesc_ptr = mipmapDesc._pvt_ptr if mipmapDesc is not None else NULL with nogil: - err = ccudart.cudaStreamAddCallback(cstream, ccallback, cuserData_ptr, flags) - - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaStreamSynchronize' in found_functions}} + err = cyruntime.cudaExternalMemoryGetMappedMipmappedArray(mipmap._pvt_ptr, cyextMem, cymipmapDesc_ptr) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, mipmap) @cython.embedsignature(True) -def cudaStreamSynchronize(stream): - """ Waits for stream tasks to complete. +def cudaDestroyExternalMemory(extMem): + """ Destroys an external memory object. - Blocks until `stream` has completed all operations. If the - :py:obj:`~.cudaDeviceScheduleBlockingSync` flag was set for this - device, the host thread will block until the stream is finished with - all of its tasks. + Destroys the specified external memory object. Any existing buffers and + CUDA mipmapped arrays mapped onto this object must no longer be used + and must be explicitly freed using :py:obj:`~.cudaFree` and + :py:obj:`~.cudaFreeMipmappedArray` respectively. Parameters ---------- - stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` - Stream identifier + extMem : :py:obj:`~.cudaExternalMemory_t` + External memory object to be destroyed Returns ------- @@ -16631,3722 +24703,3893 @@ def cudaStreamSynchronize(stream): See Also -------- - :py:obj:`~.cudaStreamCreate`, :py:obj:`~.cudaStreamCreateWithFlags`, :py:obj:`~.cudaStreamQuery`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cudaStreamAddCallback`, :py:obj:`~.cudaStreamDestroy`, :py:obj:`~.cuStreamSynchronize` + :py:obj:`~.cudaImportExternalMemory`, :py:obj:`~.cudaExternalMemoryGetMappedBuffer`, :py:obj:`~.cudaExternalMemoryGetMappedMipmappedArray` """ - cdef ccudart.cudaStream_t cstream - if stream is None: - cstream = 0 - elif isinstance(stream, (cudaStream_t,cuda.CUstream)): - pstream = int(stream) - cstream = pstream + cdef cyruntime.cudaExternalMemory_t cyextMem + if extMem is None: + pextMem = 0 + elif isinstance(extMem, (cudaExternalMemory_t,)): + pextMem = int(extMem) else: - pstream = int(cudaStream_t(stream)) - cstream = pstream + pextMem = int(cudaExternalMemory_t(extMem)) + cyextMem = pextMem with nogil: - err = ccudart.cudaStreamSynchronize(cstream) - - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaStreamQuery' in found_functions}} + err = cyruntime.cudaDestroyExternalMemory(cyextMem) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaStreamQuery(stream): - """ Queries an asynchronous stream for completion status. - - Returns :py:obj:`~.cudaSuccess` if all operations in `stream` have - completed, or :py:obj:`~.cudaErrorNotReady` if not. - - For the purposes of Unified Memory, a return value of - :py:obj:`~.cudaSuccess` is equivalent to having called - :py:obj:`~.cudaStreamSynchronize()`. - - Parameters - ---------- - stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` - Stream identifier - - Returns - ------- - cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorNotReady`, :py:obj:`~.cudaErrorInvalidResourceHandle` - - See Also - -------- - :py:obj:`~.cudaStreamCreate`, :py:obj:`~.cudaStreamCreateWithFlags`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cudaStreamSynchronize`, :py:obj:`~.cudaStreamAddCallback`, :py:obj:`~.cudaStreamDestroy`, :py:obj:`~.cuStreamQuery` - """ - cdef ccudart.cudaStream_t cstream - if stream is None: - cstream = 0 - elif isinstance(stream, (cudaStream_t,cuda.CUstream)): - pstream = int(stream) - cstream = pstream - else: - pstream = int(cudaStream_t(stream)) - cstream = pstream - err = ccudart.cudaStreamQuery(cstream) - return (cudaError_t(err),) -{{endif}} +def cudaImportExternalSemaphore(semHandleDesc : Optional[cudaExternalSemaphoreHandleDesc]): + """ Imports an external semaphore. -{{if 'cudaStreamAttachMemAsync' in found_functions}} + Imports an externally allocated synchronization object and returns a + handle to that in `extSem_out`. -@cython.embedsignature(True) -def cudaStreamAttachMemAsync(stream, devPtr, size_t length, unsigned int flags): - """ Attach memory to a stream asynchronously. + The properties of the handle being imported must be described in + `semHandleDesc`. The :py:obj:`~.cudaExternalSemaphoreHandleDesc` is + defined as follows: - Enqueues an operation in `stream` to specify stream association of - `length` bytes of memory starting from `devPtr`. This function is a - stream-ordered operation, meaning that it is dependent on, and will - only take effect when, previous work in stream has completed. Any - previous association is automatically replaced. + **View CUDA Toolkit Documentation for a C++ code example** - `devPtr` must point to an one of the following types of memories: + where :py:obj:`~.cudaExternalSemaphoreHandleDesc.type` specifies the + type of handle being imported. + :py:obj:`~.cudaExternalSemaphoreHandleType` is defined as: - - managed memory declared using the managed keyword or allocated with - :py:obj:`~.cudaMallocManaged`. + **View CUDA Toolkit Documentation for a C++ code example** - - a valid host-accessible region of system-allocated pageable memory. - This type of memory may only be specified if the device associated - with the stream reports a non-zero value for the device attribute - :py:obj:`~.cudaDevAttrPageableMemoryAccess`. + If :py:obj:`~.cudaExternalSemaphoreHandleDesc.type` is + :py:obj:`~.cudaExternalSemaphoreHandleTypeOpaqueFd`, then + :py:obj:`~.cudaExternalSemaphoreHandleDesc.handle.fd` must be a valid + file descriptor referencing a synchronization object. Ownership of the + file descriptor is transferred to the CUDA driver when the handle is + imported successfully. Performing any operations on the file descriptor + after it is imported results in undefined behavior. - For managed allocations, `length` must be either zero or the entire - allocation's size. Both indicate that the entire allocation's stream - association is being changed. Currently, it is not possible to change - stream association for a portion of a managed allocation. + If :py:obj:`~.cudaExternalSemaphoreHandleDesc.type` is + :py:obj:`~.cudaExternalSemaphoreHandleTypeOpaqueWin32`, then exactly + one of :py:obj:`~.cudaExternalSemaphoreHandleDesc.handle.win32.handle` + and :py:obj:`~.cudaExternalSemaphoreHandleDesc.handle.win32.name` must + not be NULL. If + :py:obj:`~.cudaExternalSemaphoreHandleDesc.handle.win32.handle` is not + NULL, then it must represent a valid shared NT handle that references a + synchronization object. Ownership of this handle is not transferred to + CUDA after the import operation, so the application must release the + handle using the appropriate system call. If + :py:obj:`~.cudaExternalSemaphoreHandleDesc.handle.win32.name` is not + NULL, then it must name a valid synchronization object. - For pageable allocations, `length` must be non-zero. + If :py:obj:`~.cudaExternalSemaphoreHandleDesc.type` is + :py:obj:`~.cudaExternalSemaphoreHandleTypeOpaqueWin32Kmt`, then + :py:obj:`~.cudaExternalSemaphoreHandleDesc.handle.win32.handle` must be + non-NULL and + :py:obj:`~.cudaExternalSemaphoreHandleDesc.handle.win32.name` must be + NULL. The handle specified must be a globally shared KMT handle. This + handle does not hold a reference to the underlying object, and thus + will be invalid when all references to the synchronization object are + destroyed. - The stream association is specified using `flags` which must be one of - :py:obj:`~.cudaMemAttachGlobal`, :py:obj:`~.cudaMemAttachHost` or - :py:obj:`~.cudaMemAttachSingle`. The default value for `flags` is - :py:obj:`~.cudaMemAttachSingle` If the :py:obj:`~.cudaMemAttachGlobal` - flag is specified, the memory can be accessed by any stream on any - device. If the :py:obj:`~.cudaMemAttachHost` flag is specified, the - program makes a guarantee that it won't access the memory on the device - from any stream on a device that has a zero value for the device - attribute :py:obj:`~.cudaDevAttrConcurrentManagedAccess`. If the - :py:obj:`~.cudaMemAttachSingle` flag is specified and `stream` is - associated with a device that has a zero value for the device attribute - :py:obj:`~.cudaDevAttrConcurrentManagedAccess`, the program makes a - guarantee that it will only access the memory on the device from - `stream`. It is illegal to attach singly to the NULL stream, because - the NULL stream is a virtual global stream and not a specific stream. - An error will be returned in this case. + If :py:obj:`~.cudaExternalSemaphoreHandleDesc.type` is + :py:obj:`~.cudaExternalSemaphoreHandleTypeD3D12Fence`, then exactly one + of :py:obj:`~.cudaExternalSemaphoreHandleDesc.handle.win32.handle` and + :py:obj:`~.cudaExternalSemaphoreHandleDesc.handle.win32.name` must not + be NULL. If + :py:obj:`~.cudaExternalSemaphoreHandleDesc.handle.win32.handle` is not + NULL, then it must represent a valid shared NT handle that is returned + by ID3D12Device::CreateSharedHandle when referring to a ID3D12Fence + object. This handle holds a reference to the underlying object. If + :py:obj:`~.cudaExternalSemaphoreHandleDesc.handle.win32.name` is not + NULL, then it must name a valid synchronization object that refers to a + valid ID3D12Fence object. - When memory is associated with a single stream, the Unified Memory - system will allow CPU access to this memory region so long as all - operations in `stream` have completed, regardless of whether other - streams are active. In effect, this constrains exclusive ownership of - the managed memory region by an active GPU to per-stream activity - instead of whole-GPU activity. + If :py:obj:`~.cudaExternalSemaphoreHandleDesc.type` is + :py:obj:`~.cudaExternalSemaphoreHandleTypeD3D11Fence`, then exactly one + of :py:obj:`~.cudaExternalSemaphoreHandleDesc.handle.win32.handle` and + :py:obj:`~.cudaExternalSemaphoreHandleDesc.handle.win32.name` must not + be NULL. If + :py:obj:`~.cudaExternalSemaphoreHandleDesc.handle.win32.handle` is not + NULL, then it must represent a valid shared NT handle that is returned + by ID3D11Fence::CreateSharedHandle. If + :py:obj:`~.cudaExternalSemaphoreHandleDesc.handle.win32.name` is not + NULL, then it must name a valid synchronization object that refers to a + valid ID3D11Fence object. - Accessing memory on the device from streams that are not associated - with it will produce undefined results. No error checking is performed - by the Unified Memory system to ensure that kernels launched into other - streams do not access this region. + If :py:obj:`~.cudaExternalSemaphoreHandleDesc.type` is + :py:obj:`~.cudaExternalSemaphoreHandleTypeNvSciSync`, then + :py:obj:`~.cudaExternalSemaphoreHandleDesc.handle.nvSciSyncObj` + represents a valid NvSciSyncObj. - It is a program's responsibility to order calls to - :py:obj:`~.cudaStreamAttachMemAsync` via events, synchronization or - other means to ensure legal access to memory at all times. Data - visibility and coherency will be changed appropriately for all kernels - which follow a stream-association change. + :py:obj:`~.cudaExternalSemaphoreHandleTypeKeyedMutex`, then exactly one + of :py:obj:`~.cudaExternalSemaphoreHandleDesc.handle.win32.handle` and + :py:obj:`~.cudaExternalSemaphoreHandleDesc.handle.win32.name` must not + be NULL. If + :py:obj:`~.cudaExternalSemaphoreHandleDesc.handle.win32.handle` is not + NULL, then it represent a valid shared NT handle that is returned by + IDXGIResource1::CreateSharedHandle when referring to a IDXGIKeyedMutex + object. - If `stream` is destroyed while data is associated with it, the - association is removed and the association reverts to the default - visibility of the allocation as specified at - :py:obj:`~.cudaMallocManaged`. For managed variables, the default - association is always :py:obj:`~.cudaMemAttachGlobal`. Note that - destroying a stream is an asynchronous operation, and as a result, the - change to default association won't happen until all work in the stream - has completed. + If :py:obj:`~.cudaExternalSemaphoreHandleDesc.type` is + :py:obj:`~.cudaExternalSemaphoreHandleTypeKeyedMutexKmt`, then + :py:obj:`~.cudaExternalSemaphoreHandleDesc.handle.win32.handle` must be + non-NULL and + :py:obj:`~.cudaExternalSemaphoreHandleDesc.handle.win32.name` must be + NULL. The handle specified must represent a valid KMT handle that is + returned by IDXGIResource::GetSharedHandle when referring to a + IDXGIKeyedMutex object. + + If :py:obj:`~.cudaExternalSemaphoreHandleDesc.type` is + :py:obj:`~.cudaExternalSemaphoreHandleTypeTimelineSemaphoreFd`, then + :py:obj:`~.cudaExternalSemaphoreHandleDesc.handle.fd` must be a valid + file descriptor referencing a synchronization object. Ownership of the + file descriptor is transferred to the CUDA driver when the handle is + imported successfully. Performing any operations on the file descriptor + after it is imported results in undefined behavior. + + If :py:obj:`~.cudaExternalSemaphoreHandleDesc.type` is + :py:obj:`~.cudaExternalSemaphoreHandleTypeTimelineSemaphoreWin32`, then + exactly one of + :py:obj:`~.cudaExternalSemaphoreHandleDesc.handle.win32.handle` and + :py:obj:`~.cudaExternalSemaphoreHandleDesc.handle.win32.name` must not + be NULL. If + :py:obj:`~.cudaExternalSemaphoreHandleDesc.handle.win32.handle` is not + NULL, then it must represent a valid shared NT handle that references a + synchronization object. Ownership of this handle is not transferred to + CUDA after the import operation, so the application must release the + handle using the appropriate system call. If + :py:obj:`~.cudaExternalSemaphoreHandleDesc.handle.win32.name` is not + NULL, then it must name a valid synchronization object. Parameters ---------- - stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` - Stream in which to enqueue the attach operation - devPtr : Any - Pointer to memory (must be a pointer to managed memory or to a - valid host-accessible region of system-allocated memory) - length : size_t - Length of memory (defaults to zero) - flags : unsigned int - Must be one of :py:obj:`~.cudaMemAttachGlobal`, - :py:obj:`~.cudaMemAttachHost` or :py:obj:`~.cudaMemAttachSingle` - (defaults to :py:obj:`~.cudaMemAttachSingle`) + semHandleDesc : :py:obj:`~.cudaExternalSemaphoreHandleDesc` + Semaphore import handle descriptor Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorNotReady`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorOperatingSystem` + extSem_out : :py:obj:`~.cudaExternalSemaphore_t` + Returned handle to an external semaphore See Also -------- - :py:obj:`~.cudaStreamCreate`, :py:obj:`~.cudaStreamCreateWithFlags`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cudaStreamSynchronize`, :py:obj:`~.cudaStreamAddCallback`, :py:obj:`~.cudaStreamDestroy`, :py:obj:`~.cudaMallocManaged`, :py:obj:`~.cuStreamAttachMemAsync` + :py:obj:`~.cudaDestroyExternalSemaphore`, :py:obj:`~.cudaSignalExternalSemaphoresAsync`, :py:obj:`~.cudaWaitExternalSemaphoresAsync` """ - cdef ccudart.cudaStream_t cstream - if stream is None: - cstream = 0 - elif isinstance(stream, (cudaStream_t,cuda.CUstream)): - pstream = int(stream) - cstream = pstream - else: - pstream = int(cudaStream_t(stream)) - cstream = pstream - cdevPtr = utils.HelperInputVoidPtr(devPtr) - cdef void* cdevPtr_ptr = cdevPtr.cptr - err = ccudart.cudaStreamAttachMemAsync(cstream, cdevPtr_ptr, length, flags) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaStreamBeginCapture' in found_functions}} + cdef cudaExternalSemaphore_t extSem_out = cudaExternalSemaphore_t() + cdef cyruntime.cudaExternalSemaphoreHandleDesc* cysemHandleDesc_ptr = semHandleDesc._pvt_ptr if semHandleDesc is not None else NULL + with nogil: + err = cyruntime.cudaImportExternalSemaphore(extSem_out._pvt_ptr, cysemHandleDesc_ptr) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, extSem_out) @cython.embedsignature(True) -def cudaStreamBeginCapture(stream, mode not None : cudaStreamCaptureMode): - """ Begins graph capture on a stream. +def cudaSignalExternalSemaphoresAsync(extSemArray : Optional[tuple[cudaExternalSemaphore_t] | list[cudaExternalSemaphore_t]], paramsArray : Optional[tuple[cudaExternalSemaphoreSignalParams] | list[cudaExternalSemaphoreSignalParams]], unsigned int numExtSems, stream): + """ Signals a set of external semaphore objects. - Begin graph capture on `stream`. When a stream is in capture mode, all - operations pushed into the stream will not be executed, but will - instead be captured into a graph, which will be returned via - :py:obj:`~.cudaStreamEndCapture`. Capture may not be initiated if - `stream` is :py:obj:`~.cudaStreamLegacy`. Capture must be ended on the - same stream in which it was initiated, and it may only be initiated if - the stream is not already in capture mode. The capture mode may be - queried via :py:obj:`~.cudaStreamIsCapturing`. A unique id representing - the capture sequence may be queried via - :py:obj:`~.cudaStreamGetCaptureInfo`. + Enqueues a signal operation on a set of externally allocated semaphore + object in the specified stream. The operations will be executed when + all prior operations in the stream complete. - If `mode` is not :py:obj:`~.cudaStreamCaptureModeRelaxed`, - :py:obj:`~.cudaStreamEndCapture` must be called on this stream from the - same thread. + The exact semantics of signaling a semaphore depends on the type of the + object. + + If the semaphore object is any one of the following types: + :py:obj:`~.cudaExternalSemaphoreHandleTypeOpaqueFd`, + :py:obj:`~.cudaExternalSemaphoreHandleTypeOpaqueWin32`, + :py:obj:`~.cudaExternalSemaphoreHandleTypeOpaqueWin32Kmt` then + signaling the semaphore will set it to the signaled state. + + If the semaphore object is any one of the following types: + :py:obj:`~.cudaExternalSemaphoreHandleTypeD3D12Fence`, + :py:obj:`~.cudaExternalSemaphoreHandleTypeD3D11Fence`, + :py:obj:`~.cudaExternalSemaphoreHandleTypeTimelineSemaphoreFd`, + :py:obj:`~.cudaExternalSemaphoreHandleTypeTimelineSemaphoreWin32` then + the semaphore will be set to the value specified in + :py:obj:`~.cudaExternalSemaphoreSignalParams.params.fence.value`. + + If the semaphore object is of the type + :py:obj:`~.cudaExternalSemaphoreHandleTypeNvSciSync` this API sets + :py:obj:`~.cudaExternalSemaphoreSignalParams.params.nvSciSync.fence` to + a value that can be used by subsequent waiters of the same NvSciSync + object to order operations with those currently submitted in `stream`. + Such an update will overwrite previous contents of + :py:obj:`~.cudaExternalSemaphoreSignalParams.params.nvSciSync.fence`. + By default, signaling such an external semaphore object causes + appropriate memory synchronization operations to be performed over all + the external memory objects that are imported as + :py:obj:`~.cudaExternalMemoryHandleTypeNvSciBuf`. This ensures that any + subsequent accesses made by other importers of the same set of NvSciBuf + memory object(s) are coherent. These operations can be skipped by + specifying the flag + :py:obj:`~.cudaExternalSemaphoreSignalSkipNvSciBufMemSync`, which can + be used as a performance optimization when data coherency is not + required. But specifying this flag in scenarios where data coherency is + required results in undefined behavior. Also, for semaphore object of + the type :py:obj:`~.cudaExternalSemaphoreHandleTypeNvSciSync`, if the + NvSciSyncAttrList used to create the NvSciSyncObj had not set the flags + in :py:obj:`~.cudaDeviceGetNvSciSyncAttributes` to + cudaNvSciSyncAttrSignal, this API will return cudaErrorNotSupported. + + :py:obj:`~.cudaExternalSemaphoreSignalParams.params.nvSciSync.fence` + associated with semaphore object of the type + :py:obj:`~.cudaExternalSemaphoreHandleTypeNvSciSync` can be + deterministic. For this the NvSciSyncAttrList used to create the + semaphore object must have value of + NvSciSyncAttrKey_RequireDeterministicFences key set to true. + Deterministic fences allow users to enqueue a wait over the semaphore + object even before corresponding signal is enqueued. For such a + semaphore object, CUDA guarantees that each signal operation will + increment the fence value by '1'. Users are expected to track count of + signals enqueued on the semaphore object and insert waits accordingly. + When such a semaphore object is signaled from multiple streams, due to + concurrent stream execution, it is possible that the order in which the + semaphore gets signaled is indeterministic. This could lead to waiters + of the semaphore getting unblocked incorrectly. Users are expected to + handle such situations, either by not using the same semaphore object + with deterministic fence support enabled in different streams or by + adding explicit dependency amongst such streams so that the semaphore + is signaled in order. + :py:obj:`~.cudaExternalSemaphoreSignalParams.params.nvSciSync.fence` + associated with semaphore object of the type + :py:obj:`~.cudaExternalSemaphoreHandleTypeNvSciSync` can be timestamp + enabled. For this the NvSciSyncAttrList used to create the object must + have the value of NvSciSyncAttrKey_WaiterRequireTimestamps key set to + true. Timestamps are emitted asynchronously by the GPU and CUDA saves + the GPU timestamp in the corresponding NvSciSyncFence at the time of + signal on GPU. Users are expected to convert GPU clocks to CPU clocks + using appropriate scaling functions. Users are expected to wait for the + completion of the fence before extracting timestamp using appropriate + NvSciSync APIs. Users are expected to ensure that there is only one + outstanding timestamp enabled fence per Cuda-NvSciSync object at any + point of time, failing which leads to undefined behavior. Extracting + the timestamp before the corresponding fence is signalled could lead to + undefined behaviour. Timestamp extracted via appropriate NvSciSync API + would be in microseconds. + + If the semaphore object is any one of the following types: + :py:obj:`~.cudaExternalSemaphoreHandleTypeKeyedMutex`, + :py:obj:`~.cudaExternalSemaphoreHandleTypeKeyedMutexKmt`, then the + keyed mutex will be released with the key specified in + :py:obj:`~.cudaExternalSemaphoreSignalParams.params.keyedmutex.key`. Parameters ---------- + extSemArray : list[:py:obj:`~.cudaExternalSemaphore_t`] + Set of external semaphores to be signaled + paramsArray : list[:py:obj:`~.cudaExternalSemaphoreSignalParams`] + Array of semaphore parameters + numExtSems : unsigned int + Number of semaphores to signal stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` - Stream in which to initiate capture - mode : :py:obj:`~.cudaStreamCaptureMode` - Controls the interaction of this capture sequence with other API - calls that are potentially unsafe. For more details see - :py:obj:`~.cudaThreadExchangeStreamCaptureMode`. + Stream to enqueue the signal operations in Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidResourceHandle` See Also -------- - :py:obj:`~.cudaStreamCreate`, :py:obj:`~.cudaStreamIsCapturing`, :py:obj:`~.cudaStreamEndCapture`, :py:obj:`~.cudaThreadExchangeStreamCaptureMode` - - Notes - ----- - Kernels captured using this API must not use texture and surface references. Reading or writing through any texture or surface reference is undefined behavior. This restriction does not apply to texture and surface objects. + :py:obj:`~.cudaImportExternalSemaphore`, :py:obj:`~.cudaDestroyExternalSemaphore`, :py:obj:`~.cudaWaitExternalSemaphoresAsync` """ - cdef ccudart.cudaStream_t cstream + cdef cyruntime.cudaStream_t cystream if stream is None: - cstream = 0 - elif isinstance(stream, (cudaStream_t,cuda.CUstream)): + pstream = 0 + elif isinstance(stream, (cudaStream_t,driver.CUstream)): pstream = int(stream) - cstream = pstream else: pstream = int(cudaStream_t(stream)) - cstream = pstream - cdef ccudart.cudaStreamCaptureMode cmode = mode.value - err = ccudart.cudaStreamBeginCapture(cstream, cmode) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaStreamBeginCaptureToGraph' in found_functions}} + cystream = pstream + paramsArray = [] if paramsArray is None else paramsArray + if not all(isinstance(_x, (cudaExternalSemaphoreSignalParams,)) for _x in paramsArray): + raise TypeError("Argument 'paramsArray' is not instance of type (expected tuple[cyruntime.cudaExternalSemaphoreSignalParams,] or list[cyruntime.cudaExternalSemaphoreSignalParams,]") + extSemArray = [] if extSemArray is None else extSemArray + if not all(isinstance(_x, (cudaExternalSemaphore_t,)) for _x in extSemArray): + raise TypeError("Argument 'extSemArray' is not instance of type (expected tuple[cyruntime.cudaExternalSemaphore_t,] or list[cyruntime.cudaExternalSemaphore_t,]") + cdef cyruntime.cudaExternalSemaphore_t* cyextSemArray = NULL + if len(extSemArray) > 1: + cyextSemArray = calloc(len(extSemArray), sizeof(cyruntime.cudaExternalSemaphore_t)) + if cyextSemArray is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(extSemArray)) + 'x' + str(sizeof(cyruntime.cudaExternalSemaphore_t))) + else: + for idx in range(len(extSemArray)): + cyextSemArray[idx] = (extSemArray[idx])._pvt_ptr[0] + elif len(extSemArray) == 1: + cyextSemArray = (extSemArray[0])._pvt_ptr + cdef cyruntime.cudaExternalSemaphoreSignalParams* cyparamsArray = NULL + if len(paramsArray) > 1: + cyparamsArray = calloc(len(paramsArray), sizeof(cyruntime.cudaExternalSemaphoreSignalParams)) + if cyparamsArray is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(paramsArray)) + 'x' + str(sizeof(cyruntime.cudaExternalSemaphoreSignalParams))) + for idx in range(len(paramsArray)): + string.memcpy(&cyparamsArray[idx], (paramsArray[idx])._pvt_ptr, sizeof(cyruntime.cudaExternalSemaphoreSignalParams)) + elif len(paramsArray) == 1: + cyparamsArray = (paramsArray[0])._pvt_ptr + if numExtSems > len(extSemArray): raise RuntimeError("List is too small: " + str(len(extSemArray)) + " < " + str(numExtSems)) + if numExtSems > len(paramsArray): raise RuntimeError("List is too small: " + str(len(paramsArray)) + " < " + str(numExtSems)) + with nogil: + err = cyruntime.cudaSignalExternalSemaphoresAsync(cyextSemArray, cyparamsArray, numExtSems, cystream) + if len(extSemArray) > 1 and cyextSemArray is not NULL: + free(cyextSemArray) + if len(paramsArray) > 1 and cyparamsArray is not NULL: + free(cyparamsArray) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaStreamBeginCaptureToGraph(stream, graph, dependencies : Optional[List[cudaGraphNode_t]], dependencyData : Optional[List[cudaGraphEdgeData]], size_t numDependencies, mode not None : cudaStreamCaptureMode): - """ Begins graph capture on a stream to an existing graph. +def cudaWaitExternalSemaphoresAsync(extSemArray : Optional[tuple[cudaExternalSemaphore_t] | list[cudaExternalSemaphore_t]], paramsArray : Optional[tuple[cudaExternalSemaphoreWaitParams] | list[cudaExternalSemaphoreWaitParams]], unsigned int numExtSems, stream): + """ Waits on a set of external semaphore objects. - Begin graph capture on `stream`. When a stream is in capture mode, all - operations pushed into the stream will not be executed, but will - instead be captured into `graph`, which will be returned via - :py:obj:`~.cudaStreamEndCapture`. + Enqueues a wait operation on a set of externally allocated semaphore + object in the specified stream. The operations will be executed when + all prior operations in the stream complete. - Capture may not be initiated if `stream` is - :py:obj:`~.cudaStreamLegacy`. Capture must be ended on the same stream - in which it was initiated, and it may only be initiated if the stream - is not already in capture mode. The capture mode may be queried via - :py:obj:`~.cudaStreamIsCapturing`. A unique id representing the capture - sequence may be queried via :py:obj:`~.cudaStreamGetCaptureInfo`. + The exact semantics of waiting on a semaphore depends on the type of + the object. - If `mode` is not :py:obj:`~.cudaStreamCaptureModeRelaxed`, - :py:obj:`~.cudaStreamEndCapture` must be called on this stream from the - same thread. + If the semaphore object is any one of the following types: + :py:obj:`~.cudaExternalSemaphoreHandleTypeOpaqueFd`, + :py:obj:`~.cudaExternalSemaphoreHandleTypeOpaqueWin32`, + :py:obj:`~.cudaExternalSemaphoreHandleTypeOpaqueWin32Kmt` then waiting + on the semaphore will wait until the semaphore reaches the signaled + state. The semaphore will then be reset to the unsignaled state. + Therefore for every signal operation, there can only be one wait + operation. + + If the semaphore object is any one of the following types: + :py:obj:`~.cudaExternalSemaphoreHandleTypeD3D12Fence`, + :py:obj:`~.cudaExternalSemaphoreHandleTypeD3D11Fence`, + :py:obj:`~.cudaExternalSemaphoreHandleTypeTimelineSemaphoreFd`, + :py:obj:`~.cudaExternalSemaphoreHandleTypeTimelineSemaphoreWin32` then + waiting on the semaphore will wait until the value of the semaphore is + greater than or equal to + :py:obj:`~.cudaExternalSemaphoreWaitParams.params.fence.value`. + + If the semaphore object is of the type + :py:obj:`~.cudaExternalSemaphoreHandleTypeNvSciSync` then, waiting on + the semaphore will wait until the + :py:obj:`~.cudaExternalSemaphoreSignalParams.params.nvSciSync.fence` is + signaled by the signaler of the NvSciSyncObj that was associated with + this semaphore object. By default, waiting on such an external + semaphore object causes appropriate memory synchronization operations + to be performed over all external memory objects that are imported as + :py:obj:`~.cudaExternalMemoryHandleTypeNvSciBuf`. This ensures that any + subsequent accesses made by other importers of the same set of NvSciBuf + memory object(s) are coherent. These operations can be skipped by + specifying the flag + :py:obj:`~.cudaExternalSemaphoreWaitSkipNvSciBufMemSync`, which can be + used as a performance optimization when data coherency is not required. + But specifying this flag in scenarios where data coherency is required + results in undefined behavior. Also, for semaphore object of the type + :py:obj:`~.cudaExternalSemaphoreHandleTypeNvSciSync`, if the + NvSciSyncAttrList used to create the NvSciSyncObj had not set the flags + in :py:obj:`~.cudaDeviceGetNvSciSyncAttributes` to + cudaNvSciSyncAttrWait, this API will return cudaErrorNotSupported. + + If the semaphore object is any one of the following types: + :py:obj:`~.cudaExternalSemaphoreHandleTypeKeyedMutex`, + :py:obj:`~.cudaExternalSemaphoreHandleTypeKeyedMutexKmt`, then the + keyed mutex will be acquired when it is released with the key specified + in :py:obj:`~.cudaExternalSemaphoreSignalParams.params.keyedmutex.key` + or until the timeout specified by + :py:obj:`~.cudaExternalSemaphoreSignalParams.params.keyedmutex.timeoutMs` + has lapsed. The timeout interval can either be a finite value specified + in milliseconds or an infinite value. In case an infinite value is + specified the timeout never elapses. The windows INFINITE macro must be + used to specify infinite timeout Parameters ---------- + extSemArray : list[:py:obj:`~.cudaExternalSemaphore_t`] + External semaphores to be waited on + paramsArray : list[:py:obj:`~.cudaExternalSemaphoreWaitParams`] + Array of semaphore parameters + numExtSems : unsigned int + Number of semaphores to wait on stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` - Stream in which to initiate capture. - graph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` - Graph to capture into. - dependencies : List[:py:obj:`~.cudaGraphNode_t`] - Dependencies of the first node captured in the stream. Can be NULL - if numDependencies is 0. - dependencyData : List[:py:obj:`~.cudaGraphEdgeData`] - Optional array of data associated with each dependency. - numDependencies : size_t - Number of dependencies. - mode : :py:obj:`~.cudaStreamCaptureMode` - Controls the interaction of this capture sequence with other API - calls that are potentially unsafe. For more details see - :py:obj:`~.cudaThreadExchangeStreamCaptureMode`. + Stream to enqueue the wait operations in Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidResourceHandle` :py:obj:`~.cudaErrorTimeout` See Also -------- - :py:obj:`~.cudaStreamCreate`, :py:obj:`~.cudaStreamIsCapturing`, :py:obj:`~.cudaStreamEndCapture`, :py:obj:`~.cudaThreadExchangeStreamCaptureMode` - - Notes - ----- - Kernels captured using this API must not use texture and surface references. Reading or writing through any texture or surface reference is undefined behavior. This restriction does not apply to texture and surface objects. + :py:obj:`~.cudaImportExternalSemaphore`, :py:obj:`~.cudaDestroyExternalSemaphore`, :py:obj:`~.cudaSignalExternalSemaphoresAsync` """ - dependencyData = [] if dependencyData is None else dependencyData - if not all(isinstance(_x, (cudaGraphEdgeData,)) for _x in dependencyData): - raise TypeError("Argument 'dependencyData' is not instance of type (expected List[ccudart.cudaGraphEdgeData,]") - dependencies = [] if dependencies is None else dependencies - if not all(isinstance(_x, (cudaGraphNode_t,cuda.CUgraphNode)) for _x in dependencies): - raise TypeError("Argument 'dependencies' is not instance of type (expected List[ccudart.cudaGraphNode_t,cuda.CUgraphNode]") - cdef ccudart.cudaGraph_t cgraph - if graph is None: - cgraph = 0 - elif isinstance(graph, (cudaGraph_t,cuda.CUgraph)): - pgraph = int(graph) - cgraph = pgraph - else: - pgraph = int(cudaGraph_t(graph)) - cgraph = pgraph - cdef ccudart.cudaStream_t cstream + cdef cyruntime.cudaStream_t cystream if stream is None: - cstream = 0 - elif isinstance(stream, (cudaStream_t,cuda.CUstream)): + pstream = 0 + elif isinstance(stream, (cudaStream_t,driver.CUstream)): pstream = int(stream) - cstream = pstream else: pstream = int(cudaStream_t(stream)) - cstream = pstream - cdef ccudart.cudaGraphNode_t* cdependencies = NULL - if len(dependencies) > 0: - cdependencies = calloc(len(dependencies), sizeof(ccudart.cudaGraphNode_t)) - if cdependencies is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(dependencies)) + 'x' + str(sizeof(ccudart.cudaGraphNode_t))) + cystream = pstream + paramsArray = [] if paramsArray is None else paramsArray + if not all(isinstance(_x, (cudaExternalSemaphoreWaitParams,)) for _x in paramsArray): + raise TypeError("Argument 'paramsArray' is not instance of type (expected tuple[cyruntime.cudaExternalSemaphoreWaitParams,] or list[cyruntime.cudaExternalSemaphoreWaitParams,]") + extSemArray = [] if extSemArray is None else extSemArray + if not all(isinstance(_x, (cudaExternalSemaphore_t,)) for _x in extSemArray): + raise TypeError("Argument 'extSemArray' is not instance of type (expected tuple[cyruntime.cudaExternalSemaphore_t,] or list[cyruntime.cudaExternalSemaphore_t,]") + cdef cyruntime.cudaExternalSemaphore_t* cyextSemArray = NULL + if len(extSemArray) > 1: + cyextSemArray = calloc(len(extSemArray), sizeof(cyruntime.cudaExternalSemaphore_t)) + if cyextSemArray is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(extSemArray)) + 'x' + str(sizeof(cyruntime.cudaExternalSemaphore_t))) else: - for idx in range(len(dependencies)): - cdependencies[idx] = (dependencies[idx])._ptr[0] - cdef ccudart.cudaGraphEdgeData* cdependencyData = NULL - if len(dependencyData) > 0: - cdependencyData = calloc(len(dependencyData), sizeof(ccudart.cudaGraphEdgeData)) - if cdependencyData is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(dependencyData)) + 'x' + str(sizeof(ccudart.cudaGraphEdgeData))) - for idx in range(len(dependencyData)): - string.memcpy(&cdependencyData[idx], (dependencyData[idx])._ptr, sizeof(ccudart.cudaGraphEdgeData)) - if numDependencies > len(dependencies): raise RuntimeError("List is too small: " + str(len(dependencies)) + " < " + str(numDependencies)) - cdef ccudart.cudaStreamCaptureMode cmode = mode.value - err = ccudart.cudaStreamBeginCaptureToGraph(cstream, cgraph, (dependencies[0])._ptr if len(dependencies) == 1 else cdependencies, (dependencyData[0])._ptr if len(dependencyData) == 1 else cdependencyData, numDependencies, cmode) - if cdependencies is not NULL: - free(cdependencies) - if cdependencyData is not NULL: - free(cdependencyData) - return (cudaError_t(err),) -{{endif}} + for idx in range(len(extSemArray)): + cyextSemArray[idx] = (extSemArray[idx])._pvt_ptr[0] + elif len(extSemArray) == 1: + cyextSemArray = (extSemArray[0])._pvt_ptr + cdef cyruntime.cudaExternalSemaphoreWaitParams* cyparamsArray = NULL + if len(paramsArray) > 1: + cyparamsArray = calloc(len(paramsArray), sizeof(cyruntime.cudaExternalSemaphoreWaitParams)) + if cyparamsArray is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(paramsArray)) + 'x' + str(sizeof(cyruntime.cudaExternalSemaphoreWaitParams))) + for idx in range(len(paramsArray)): + string.memcpy(&cyparamsArray[idx], (paramsArray[idx])._pvt_ptr, sizeof(cyruntime.cudaExternalSemaphoreWaitParams)) + elif len(paramsArray) == 1: + cyparamsArray = (paramsArray[0])._pvt_ptr + if numExtSems > len(extSemArray): raise RuntimeError("List is too small: " + str(len(extSemArray)) + " < " + str(numExtSems)) + if numExtSems > len(paramsArray): raise RuntimeError("List is too small: " + str(len(paramsArray)) + " < " + str(numExtSems)) + with nogil: + err = cyruntime.cudaWaitExternalSemaphoresAsync(cyextSemArray, cyparamsArray, numExtSems, cystream) + if len(extSemArray) > 1 and cyextSemArray is not NULL: + free(cyextSemArray) + if len(paramsArray) > 1 and cyparamsArray is not NULL: + free(cyparamsArray) + return (_cudaError_t(err),) + +@cython.embedsignature(True) +def cudaDestroyExternalSemaphore(extSem): + """ Destroys an external semaphore. + + Destroys an external semaphore object and releases any references to + the underlying resource. Any outstanding signals or waits must have + completed before the semaphore is destroyed. + + Parameters + ---------- + extSem : :py:obj:`~.cudaExternalSemaphore_t` + External semaphore to be destroyed -{{if 'cudaThreadExchangeStreamCaptureMode' in found_functions}} + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidResourceHandle` + + See Also + -------- + :py:obj:`~.cudaImportExternalSemaphore`, :py:obj:`~.cudaSignalExternalSemaphoresAsync`, :py:obj:`~.cudaWaitExternalSemaphoresAsync` + """ + cdef cyruntime.cudaExternalSemaphore_t cyextSem + if extSem is None: + pextSem = 0 + elif isinstance(extSem, (cudaExternalSemaphore_t,)): + pextSem = int(extSem) + else: + pextSem = int(cudaExternalSemaphore_t(extSem)) + cyextSem = pextSem + with nogil: + err = cyruntime.cudaDestroyExternalSemaphore(cyextSem) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaThreadExchangeStreamCaptureMode(mode not None : cudaStreamCaptureMode): - """ Swaps the stream capture interaction mode for a thread. +def cudaFuncSetCacheConfig(func, cacheConfig not None : cudaFuncCache): + """ Sets the preferred cache configuration for a device function. - Sets the calling thread's stream capture interaction mode to the value - contained in `*mode`, and overwrites `*mode` with the previous mode for - the thread. To facilitate deterministic behavior across function or - module boundaries, callers are encouraged to use this API in a push-pop - fashion: + On devices where the L1 cache and shared memory use the same hardware + resources, this sets through `cacheConfig` the preferred cache + configuration for the function specified via `func`. This is only a + preference. The runtime will use the requested configuration if + possible, but it is free to choose a different configuration if + required to execute `func`. - **View CUDA Toolkit Documentation for a C++ code example** + `func` is a device function symbol and must be declared as a + `__global__` function. If the specified function does not exist, then + :py:obj:`~.cudaErrorInvalidDeviceFunction` is returned. For templated + functions, pass the function symbol as follows: + func_name - During stream capture (see :py:obj:`~.cudaStreamBeginCapture`), some - actions, such as a call to :py:obj:`~.cudaMalloc`, may be unsafe. In - the case of :py:obj:`~.cudaMalloc`, the operation is not enqueued - asynchronously to a stream, and is not observed by stream capture. - Therefore, if the sequence of operations captured via - :py:obj:`~.cudaStreamBeginCapture` depended on the allocation being - replayed whenever the graph is launched, the captured graph would be - invalid. + This setting does nothing on devices where the size of the L1 cache and + shared memory are fixed. - Therefore, stream capture places restrictions on API calls that can be - made within or concurrently to a - :py:obj:`~.cudaStreamBeginCapture`-:py:obj:`~.cudaStreamEndCapture` - sequence. This behavior can be controlled via this API and flags to - :py:obj:`~.cudaStreamBeginCapture`. + Launching a kernel with a different preference than the most recent + preference setting may insert a device-side synchronization point. - A thread's mode is one of the following: + The supported cache configurations are: - - `cudaStreamCaptureModeGlobal:` This is the default mode. If the local - thread has an ongoing capture sequence that was not initiated with - `cudaStreamCaptureModeRelaxed` at `cuStreamBeginCapture`, or if any - other thread has a concurrent capture sequence initiated with - `cudaStreamCaptureModeGlobal`, this thread is prohibited from - potentially unsafe API calls. + - :py:obj:`~.cudaFuncCachePreferNone`: no preference for shared memory + or L1 (default) - - `cudaStreamCaptureModeThreadLocal:` If the local thread has an - ongoing capture sequence not initiated with - `cudaStreamCaptureModeRelaxed`, it is prohibited from potentially - unsafe API calls. Concurrent capture sequences in other threads are - ignored. + - :py:obj:`~.cudaFuncCachePreferShared`: prefer larger shared memory + and smaller L1 cache - - `cudaStreamCaptureModeRelaxed:` The local thread is not prohibited - from potentially unsafe API calls. Note that the thread is still - prohibited from API calls which necessarily conflict with stream - capture, for example, attempting :py:obj:`~.cudaEventQuery` on an - event that was last recorded inside a capture sequence. + - :py:obj:`~.cudaFuncCachePreferL1`: prefer larger L1 cache and smaller + shared memory + + - :py:obj:`~.cudaFuncCachePreferEqual`: prefer equal size L1 cache and + shared memory Parameters ---------- - mode : :py:obj:`~.cudaStreamCaptureMode` - Pointer to mode value to swap with the current mode + func : Any + Device function symbol + cacheConfig : :py:obj:`~.cudaFuncCache` + Requested cache configuration Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` - mode : :py:obj:`~.cudaStreamCaptureMode` - Pointer to mode value to swap with the current mode + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDeviceFunction`2 See Also -------- - :py:obj:`~.cudaStreamBeginCapture` - """ - cdef ccudart.cudaStreamCaptureMode cmode = mode.value - err = ccudart.cudaThreadExchangeStreamCaptureMode(&cmode) - return (cudaError_t(err), cudaStreamCaptureMode(cmode)) -{{endif}} + cudaFuncSetCacheConfig (C++ API), :py:obj:`~.cudaFuncGetAttributes (C API)`, :py:obj:`~.cudaLaunchKernel (C API)`, :py:obj:`~.cuFuncSetCacheConfig` -{{if 'cudaStreamEndCapture' in found_functions}} + Notes + ----- + This API does not accept a :py:obj:`~.cudaKernel_t` casted as void*. If cache config modification is required for a :py:obj:`~.cudaKernel_t` (or a global function), it can be replaced with a call to :py:obj:`~.cudaFuncSetAttributes` with the attribute :py:obj:`~.cudaFuncAttributePreferredSharedMemoryCarveout` to specify a more granular L1 cache and shared memory split configuration. + """ + cdef _HelperInputVoidPtrStruct cyfuncHelper + cdef void* cyfunc = _helper_input_void_ptr(func, &cyfuncHelper) + cdef cyruntime.cudaFuncCache cycacheConfig = int(cacheConfig) + with nogil: + err = cyruntime.cudaFuncSetCacheConfig(cyfunc, cycacheConfig) + _helper_input_void_ptr_free(&cyfuncHelper) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaStreamEndCapture(stream): - """ Ends capture on a stream, returning the captured graph. +def cudaFuncGetAttributes(func): + """ Find out attributes for a given function. - End capture on `stream`, returning the captured graph via `pGraph`. - Capture must have been initiated on `stream` via a call to - :py:obj:`~.cudaStreamBeginCapture`. If capture was invalidated, due to - a violation of the rules of stream capture, then a NULL graph will be - returned. + This function obtains the attributes of a function specified via + `func`. `func` is a device function symbol and must be declared as a + `__global__` function. The fetched attributes are placed in `attr`. If + the specified function does not exist, then it is assumed to be a + :py:obj:`~.cudaKernel_t` and used as is. For templated functions, pass + the function symbol as follows: + func_name - If the `mode` argument to :py:obj:`~.cudaStreamBeginCapture` was not - :py:obj:`~.cudaStreamCaptureModeRelaxed`, this call must be from the - same thread as :py:obj:`~.cudaStreamBeginCapture`. + Note that some function attributes such as + :py:obj:`~.maxThreadsPerBlock` may vary based on the device that is + currently being used. Parameters ---------- - stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` - Stream to query + func : Any + Device function symbol Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorStreamCaptureWrongThread` - pGraph : :py:obj:`~.cudaGraph_t` - The captured graph + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDeviceFunction`2 + attr : :py:obj:`~.cudaFuncAttributes` + Return pointer to function's attributes See Also -------- - :py:obj:`~.cudaStreamCreate`, :py:obj:`~.cudaStreamBeginCapture`, :py:obj:`~.cudaStreamIsCapturing`, :py:obj:`~.cudaGraphDestroy` + :py:obj:`~.cudaFuncSetCacheConfig (C API)`, cudaFuncGetAttributes (C++ API), :py:obj:`~.cudaLaunchKernel (C API)`, :py:obj:`~.cuFuncGetAttribute` """ - cdef ccudart.cudaStream_t cstream - if stream is None: - cstream = 0 - elif isinstance(stream, (cudaStream_t,cuda.CUstream)): - pstream = int(stream) - cstream = pstream - else: - pstream = int(cudaStream_t(stream)) - cstream = pstream - cdef cudaGraph_t pGraph = cudaGraph_t() - err = ccudart.cudaStreamEndCapture(cstream, pGraph._ptr) - return (cudaError_t(err), pGraph) -{{endif}} - -{{if 'cudaStreamIsCapturing' in found_functions}} + cdef cudaFuncAttributes attr = cudaFuncAttributes() + cdef _HelperInputVoidPtrStruct cyfuncHelper + cdef void* cyfunc = _helper_input_void_ptr(func, &cyfuncHelper) + with nogil: + err = cyruntime.cudaFuncGetAttributes(attr._pvt_ptr, cyfunc) + _helper_input_void_ptr_free(&cyfuncHelper) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, attr) @cython.embedsignature(True) -def cudaStreamIsCapturing(stream): - """ Returns a stream's capture status. +def cudaFuncSetAttribute(func, attr not None : cudaFuncAttribute, int value): + """ Set attributes for a given function. - Return the capture status of `stream` via `pCaptureStatus`. After a - successful call, `*pCaptureStatus` will contain one of the following: + This function sets the attributes of a function specified via `func`. + The parameter `func` must be a pointer to a function that executes on + the device. The parameter specified by `func` must be declared as a + `__global__` function. The enumeration defined by `attr` is set to the + value defined by `value`. If the specified function does not exist, + then it is assumed to be a :py:obj:`~.cudaKernel_t` and used as is. If + the specified attribute cannot be written, or if the value is + incorrect, then :py:obj:`~.cudaErrorInvalidValue` is returned. - - :py:obj:`~.cudaStreamCaptureStatusNone`: The stream is not capturing. + Valid values for `attr` are: - - :py:obj:`~.cudaStreamCaptureStatusActive`: The stream is capturing. + - :py:obj:`~.cudaFuncAttributeMaxDynamicSharedMemorySize` - The + requested maximum size in bytes of dynamically-allocated shared + memory. The sum of this value and the function attribute + :py:obj:`~.sharedSizeBytes` cannot exceed the device attribute + :py:obj:`~.cudaDevAttrMaxSharedMemoryPerBlockOptin`. The maximal size + of requestable dynamic shared memory may differ by GPU architecture. - - :py:obj:`~.cudaStreamCaptureStatusInvalidated`: The stream was - capturing but an error has invalidated the capture sequence. The - capture sequence must be terminated with - :py:obj:`~.cudaStreamEndCapture` on the stream where it was initiated - in order to continue using `stream`. + - :py:obj:`~.cudaFuncAttributePreferredSharedMemoryCarveout` - On + devices where the L1 cache and shared memory use the same hardware + resources, this sets the shared memory carveout preference, in + percent of the total shared memory. See + :py:obj:`~.cudaDevAttrMaxSharedMemoryPerMultiprocessor`. This is only + a hint, and the driver can choose a different ratio if required to + execute the function. - Note that, if this is called on :py:obj:`~.cudaStreamLegacy` (the "null - stream") while a blocking stream on the same device is capturing, it - will return :py:obj:`~.cudaErrorStreamCaptureImplicit` and - `*pCaptureStatus` is unspecified after the call. The blocking stream - capture is not invalidated. + - :py:obj:`~.cudaFuncAttributeRequiredClusterWidth`: The required + cluster width in blocks. The width, height, and depth values must + either all be 0 or all be positive. The validity of the cluster + dimensions is checked at launch time. If the value is set during + compile time, it cannot be set at runtime. Setting it at runtime will + return cudaErrorNotPermitted. - When a blocking stream is capturing, the legacy stream is in an - unusable state until the blocking stream capture is terminated. The - legacy stream is not supported for stream capture, but attempted use - would have an implicit dependency on the capturing stream(s). + - :py:obj:`~.cudaFuncAttributeRequiredClusterHeight`: The required + cluster height in blocks. The width, height, and depth values must + either all be 0 or all be positive. The validity of the cluster + dimensions is checked at launch time. If the value is set during + compile time, it cannot be set at runtime. Setting it at runtime will + return cudaErrorNotPermitted. + + - :py:obj:`~.cudaFuncAttributeRequiredClusterDepth`: The required + cluster depth in blocks. The width, height, and depth values must + either all be 0 or all be positive. The validity of the cluster + dimensions is checked at launch time. If the value is set during + compile time, it cannot be set at runtime. Setting it at runtime will + return cudaErrorNotPermitted. + + - :py:obj:`~.cudaFuncAttributeNonPortableClusterSizeAllowed`: Indicates + whether the function can be launched with non-portable cluster size. + 1 is allowed, 0 is disallowed. + + - :py:obj:`~.cudaFuncAttributeClusterSchedulingPolicyPreference`: The + block scheduling policy of a function. The value type is + :py:obj:`~.cudaClusterSchedulingPolicy`. + + cudaLaunchKernel (C++ API), cudaFuncSetCacheConfig (C++ API), + :py:obj:`~.cudaFuncGetAttributes (C API)`, Parameters ---------- - stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` - Stream to query + func : Any + Function to get attributes of + attr : :py:obj:`~.cudaFuncAttribute` + Attribute to set + value : int + Value to set Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorStreamCaptureImplicit` - pCaptureStatus : :py:obj:`~.cudaStreamCaptureStatus` - Returns the stream's capture status - - See Also - -------- - :py:obj:`~.cudaStreamCreate`, :py:obj:`~.cudaStreamBeginCapture`, :py:obj:`~.cudaStreamEndCapture` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDeviceFunction`, :py:obj:`~.cudaErrorInvalidValue` """ - cdef ccudart.cudaStream_t cstream - if stream is None: - cstream = 0 - elif isinstance(stream, (cudaStream_t,cuda.CUstream)): - pstream = int(stream) - cstream = pstream - else: - pstream = int(cudaStream_t(stream)) - cstream = pstream - cdef ccudart.cudaStreamCaptureStatus pCaptureStatus - err = ccudart.cudaStreamIsCapturing(cstream, &pCaptureStatus) - return (cudaError_t(err), cudaStreamCaptureStatus(pCaptureStatus)) -{{endif}} - -{{if 'cudaStreamGetCaptureInfo_v2' in found_functions}} + cdef _HelperInputVoidPtrStruct cyfuncHelper + cdef void* cyfunc = _helper_input_void_ptr(func, &cyfuncHelper) + cdef cyruntime.cudaFuncAttribute cyattr = int(attr) + with nogil: + err = cyruntime.cudaFuncSetAttribute(cyfunc, cyattr, value) + _helper_input_void_ptr_free(&cyfuncHelper) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaStreamGetCaptureInfo(stream): - """ Query a stream's capture state. - - Query stream state related to stream capture. - - If called on :py:obj:`~.cudaStreamLegacy` (the "null stream") while a - stream not created with :py:obj:`~.cudaStreamNonBlocking` is capturing, - returns :py:obj:`~.cudaErrorStreamCaptureImplicit`. - - Valid data (other than capture status) is returned only if both of the - following are true: - - - the call returns cudaSuccess +def cudaFuncGetParamCount(func): + """ Returns the number of parameters used by the function. - - the returned capture status is - :py:obj:`~.cudaStreamCaptureStatusActive` + Queries the number of kernel parameters used by `func` and returns it + in `paramCount`. Parameters ---------- - stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` - The stream to query + func : Any + The function to query Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorStreamCaptureImplicit` - captureStatus_out : :py:obj:`~.cudaStreamCaptureStatus` - Location to return the capture status of the stream; required - id_out : unsigned long long - Optional location to return an id for the capture sequence, which - is unique over the lifetime of the process - graph_out : :py:obj:`~.cudaGraph_t` - Optional location to return the graph being captured into. All - operations other than destroy and node removal are permitted on the - graph while the capture sequence is in progress. This API does not - transfer ownership of the graph, which is transferred or destroyed - at :py:obj:`~.cudaStreamEndCapture`. Note that the graph handle may - be invalidated before end of capture for certain errors. Nodes that - are or become unreachable from the original stream at - :py:obj:`~.cudaStreamEndCapture` due to direct actions on the graph - do not trigger :py:obj:`~.cudaErrorStreamCaptureUnjoined`. - dependencies_out : List[:py:obj:`~.cudaGraphNode_t`] - Optional location to store a pointer to an array of nodes. The next - node to be captured in the stream will depend on this set of nodes, - absent operations such as event wait which modify this set. The - array pointer is valid until the next API call which operates on - the stream or until the capture is terminated. The node handles may - be copied out and are valid until they or the graph is destroyed. - The driver-owned array may also be passed directly to APIs that - operate on the graph (not the stream) without copying. - numDependencies_out : int - Optional location to store the size of the array returned in - dependencies_out. - - See Also - -------- - :py:obj:`~.cudaStreamGetCaptureInfo_v3`, :py:obj:`~.cudaStreamBeginCapture`, :py:obj:`~.cudaStreamIsCapturing`, :py:obj:`~.cudaStreamUpdateCaptureDependencies` + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, + paramCount : int + Returns the number of parameters used by the function """ - cdef ccudart.cudaStream_t cstream - if stream is None: - cstream = 0 - elif isinstance(stream, (cudaStream_t,cuda.CUstream)): - pstream = int(stream) - cstream = pstream - else: - pstream = int(cudaStream_t(stream)) - cstream = pstream - cdef ccudart.cudaStreamCaptureStatus captureStatus_out - cdef unsigned long long id_out = 0 - cdef cudaGraph_t graph_out = cudaGraph_t() - cdef const ccudart.cudaGraphNode_t* cdependencies_out = NULL - pydependencies_out = [] - cdef size_t numDependencies_out = 0 - err = ccudart.cudaStreamGetCaptureInfo(cstream, &captureStatus_out, &id_out, graph_out._ptr, &cdependencies_out, &numDependencies_out) - if cudaError_t(err) == cudaError_t(0): - pydependencies_out = [cudaGraphNode_t(init_value=cdependencies_out[idx]) for idx in range(numDependencies_out)] - return (cudaError_t(err), cudaStreamCaptureStatus(captureStatus_out), id_out, graph_out, pydependencies_out, numDependencies_out) -{{endif}} + cdef _HelperInputVoidPtrStruct cyfuncHelper + cdef void* cyfunc = _helper_input_void_ptr(func, &cyfuncHelper) + cdef size_t paramCount = 0 + with nogil: + err = cyruntime.cudaFuncGetParamCount(cyfunc, ¶mCount) + _helper_input_void_ptr_free(&cyfuncHelper) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, paramCount) + +ctypedef struct cudaStreamHostCallbackData_st: + cyruntime.cudaHostFn_t callback + void *userData -{{if 'cudaStreamGetCaptureInfo_v3' in found_functions}} +ctypedef cudaStreamHostCallbackData_st cudaStreamHostCallbackData + +@cython.show_performance_hints(False) +cdef void cudaStreamRtHostCallbackWrapper(void *data) nogil: + cdef cudaStreamHostCallbackData *cbData = data + with gil: + cbData.callback(cbData.userData) + free(cbData) @cython.embedsignature(True) -def cudaStreamGetCaptureInfo_v3(stream): - """ Query a stream's capture state (12.3+) +def cudaLaunchHostFunc(stream, fn, userData): + """ Enqueues a host function call in a stream. - Query stream state related to stream capture. + Enqueues a host function to run in a stream. The function will be + called after currently enqueued work and will block work added after + it. - If called on :py:obj:`~.cudaStreamLegacy` (the "null stream") while a - stream not created with :py:obj:`~.cudaStreamNonBlocking` is capturing, - returns :py:obj:`~.cudaErrorStreamCaptureImplicit`. + The host function must not make any CUDA API calls. Attempting to use a + CUDA API may result in :py:obj:`~.cudaErrorNotPermitted`, but this is + not required. The host function must not perform any synchronization + that may depend on outstanding CUDA work not mandated to run earlier. + Host functions without a mandated order (such as in independent + streams) execute in undefined order and may be serialized. - Valid data (other than capture status) is returned only if both of the - following are true: + For the purposes of Unified Memory, execution makes a number of + guarantees: - - the call returns cudaSuccess + - The stream is considered idle for the duration of the function's + execution. Thus, for example, the function may always use memory + attached to the stream it was enqueued in. - - the returned capture status is - :py:obj:`~.cudaStreamCaptureStatusActive` + - The start of execution of the function has the same effect as + synchronizing an event recorded in the same stream immediately prior + to the function. It thus synchronizes streams which have been + "joined" prior to the function. - If `edgeData_out` is non-NULL then `dependencies_out` must be as well. - If `dependencies_out` is non-NULL and `edgeData_out` is NULL, but there - is non-zero edge data for one or more of the current stream - dependencies, the call will return :py:obj:`~.cudaErrorLossyQuery`. + - Adding device work to any stream does not have the effect of making + the stream active until all preceding host functions and stream + callbacks have executed. Thus, for example, a function might use + global attached memory even if work has been added to another stream, + if the work has been ordered behind the function call with an event. + + - Completion of the function does not cause a stream to become active + except as described above. The stream will remain idle if no device + work follows the function, and will remain idle across consecutive + host functions or stream callbacks without device work in between. + Thus, for example, stream synchronization can be done by signaling + from a host function at the end of the stream. + + Note that, in constrast to :py:obj:`~.cuStreamAddCallback`, the + function will not be called in the event of an error in the CUDA + context. Parameters ---------- - stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` - The stream to query + hStream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + Stream to enqueue function call in + fn : :py:obj:`~.cudaHostFn_t` + The function to call once preceding stream operations are complete + userData : Any + User-specified data to be passed to the function Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorStreamCaptureImplicit`, :py:obj:`~.cudaErrorLossyQuery` - captureStatus_out : :py:obj:`~.cudaStreamCaptureStatus` - Location to return the capture status of the stream; required - id_out : unsigned long long - Optional location to return an id for the capture sequence, which - is unique over the lifetime of the process - graph_out : :py:obj:`~.cudaGraph_t` - Optional location to return the graph being captured into. All - operations other than destroy and node removal are permitted on the - graph while the capture sequence is in progress. This API does not - transfer ownership of the graph, which is transferred or destroyed - at :py:obj:`~.cudaStreamEndCapture`. Note that the graph handle may - be invalidated before end of capture for certain errors. Nodes that - are or become unreachable from the original stream at - :py:obj:`~.cudaStreamEndCapture` due to direct actions on the graph - do not trigger :py:obj:`~.cudaErrorStreamCaptureUnjoined`. - dependencies_out : List[:py:obj:`~.cudaGraphNode_t`] - Optional location to store a pointer to an array of nodes. The next - node to be captured in the stream will depend on this set of nodes, - absent operations such as event wait which modify this set. The - array pointer is valid until the next API call which operates on - the stream or until the capture is terminated. The node handles may - be copied out and are valid until they or the graph is destroyed. - The driver-owned array may also be passed directly to APIs that - operate on the graph (not the stream) without copying. - edgeData_out : List[:py:obj:`~.cudaGraphEdgeData`] - Optional location to store a pointer to an array of graph edge - data. This array parallels `dependencies_out`; the next node to be - added has an edge to `dependencies_out`[i] with annotation - `edgeData_out`[i] for each `i`. The array pointer is valid until - the next API call which operates on the stream or until the capture - is terminated. - numDependencies_out : int - Optional location to store the size of the array returned in - dependencies_out. + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorNotSupported` See Also -------- - :py:obj:`~.cudaStreamBeginCapture`, :py:obj:`~.cudaStreamIsCapturing`, :py:obj:`~.cudaStreamUpdateCaptureDependencies` + :py:obj:`~.cudaStreamCreate`, :py:obj:`~.cudaStreamQuery`, :py:obj:`~.cudaStreamSynchronize`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cudaStreamDestroy`, :py:obj:`~.cudaMallocManaged`, :py:obj:`~.cudaStreamAttachMemAsync`, :py:obj:`~.cudaStreamAddCallback`, :py:obj:`~.cuLaunchHostFunc` """ - cdef ccudart.cudaStream_t cstream + cdef cyruntime.cudaHostFn_t cyfn + if fn is None: + pfn = 0 + elif isinstance(fn, (cudaHostFn_t,)): + pfn = int(fn) + else: + pfn = int(cudaHostFn_t(fn)) + cyfn = pfn + cdef cyruntime.cudaStream_t cystream if stream is None: - cstream = 0 - elif isinstance(stream, (cudaStream_t,cuda.CUstream)): + pstream = 0 + elif isinstance(stream, (cudaStream_t,driver.CUstream)): pstream = int(stream) - cstream = pstream else: pstream = int(cudaStream_t(stream)) - cstream = pstream - cdef ccudart.cudaStreamCaptureStatus captureStatus_out - cdef unsigned long long id_out = 0 - cdef cudaGraph_t graph_out = cudaGraph_t() - cdef const ccudart.cudaGraphNode_t* cdependencies_out = NULL - pydependencies_out = [] - cdef const ccudart.cudaGraphEdgeData* cedgeData_out = NULL - pyedgeData_out = [] - cdef size_t numDependencies_out = 0 - err = ccudart.cudaStreamGetCaptureInfo_v3(cstream, &captureStatus_out, &id_out, graph_out._ptr, &cdependencies_out, &cedgeData_out, &numDependencies_out) - if cudaError_t(err) == cudaError_t(0): - pydependencies_out = [cudaGraphNode_t(init_value=cdependencies_out[idx]) for idx in range(numDependencies_out)] - if cudaError_t(err) == cudaError_t(0): - pyedgeData_out = [cudaGraphEdgeData(_ptr=&cedgeData_out[idx]) for idx in range(numDependencies_out)] - return (cudaError_t(err), cudaStreamCaptureStatus(captureStatus_out), id_out, graph_out, pydependencies_out, pyedgeData_out, numDependencies_out) -{{endif}} - -{{if 'cudaStreamUpdateCaptureDependencies' in found_functions}} - -@cython.embedsignature(True) -def cudaStreamUpdateCaptureDependencies(stream, dependencies : Optional[List[cudaGraphNode_t]], size_t numDependencies, unsigned int flags): - """ Update the set of dependencies in a capturing stream (11.3+) - - Modifies the dependency set of a capturing stream. The dependency set - is the set of nodes that the next captured node in the stream will - depend on. - - Valid flags are :py:obj:`~.cudaStreamAddCaptureDependencies` and - :py:obj:`~.cudaStreamSetCaptureDependencies`. These control whether the - set passed to the API is added to the existing set or replaces it. A - flags value of 0 defaults to - :py:obj:`~.cudaStreamAddCaptureDependencies`. + cystream = pstream + cdef _HelperInputVoidPtrStruct cyuserDataHelper + cdef void* cyuserData = _helper_input_void_ptr(userData, &cyuserDataHelper) - Nodes that are removed from the dependency set via this API do not - result in :py:obj:`~.cudaErrorStreamCaptureUnjoined` if they are - unreachable from the stream at :py:obj:`~.cudaStreamEndCapture`. + cdef cudaStreamHostCallbackData *cbData = NULL + cbData = malloc(sizeof(cbData[0])) + if cbData == NULL: + return (cudaError_t.cudaErrorMemoryAllocation,) + cbData.callback = cyfn + cbData.userData = cyuserData - Returns :py:obj:`~.cudaErrorIllegalState` if the stream is not - capturing. + with nogil: + err = cyruntime.cudaLaunchHostFunc(cystream, cudaStreamRtHostCallbackWrapper, cbData) + if err != cyruntime.cudaSuccess: + free(cbData) + _helper_input_void_ptr_free(&cyuserDataHelper) - This API is new in CUDA 11.3. Developers requiring compatibility across - minor versions of the CUDA driver to 11.0 should not use this API or - provide a fallback. + return (_cudaError_t(err),) - Parameters - ---------- - stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` - The stream to update - dependencies : List[:py:obj:`~.cudaGraphNode_t`] - The set of dependencies to add - numDependencies : size_t - The size of the dependencies array - flags : unsigned int - See above +@cython.embedsignature(True) +def cudaLaunchHostFunc_v2(stream, fn, userData, unsigned int syncMode): + """ Enqueues a host function call in a stream. - Returns - ------- - cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorIllegalState` + Enqueues a host function to run in a stream. The function will be + called after currently enqueued work and will block work added after + it. - See Also - -------- - :py:obj:`~.cudaStreamBeginCapture`, :py:obj:`~.cudaStreamGetCaptureInfo`, - """ - dependencies = [] if dependencies is None else dependencies - if not all(isinstance(_x, (cudaGraphNode_t,cuda.CUgraphNode)) for _x in dependencies): - raise TypeError("Argument 'dependencies' is not instance of type (expected List[ccudart.cudaGraphNode_t,cuda.CUgraphNode]") - cdef ccudart.cudaStream_t cstream - if stream is None: - cstream = 0 - elif isinstance(stream, (cudaStream_t,cuda.CUstream)): - pstream = int(stream) - cstream = pstream - else: - pstream = int(cudaStream_t(stream)) - cstream = pstream - cdef ccudart.cudaGraphNode_t* cdependencies = NULL - if len(dependencies) > 0: - cdependencies = calloc(len(dependencies), sizeof(ccudart.cudaGraphNode_t)) - if cdependencies is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(dependencies)) + 'x' + str(sizeof(ccudart.cudaGraphNode_t))) - else: - for idx in range(len(dependencies)): - cdependencies[idx] = (dependencies[idx])._ptr[0] - if numDependencies > len(dependencies): raise RuntimeError("List is too small: " + str(len(dependencies)) + " < " + str(numDependencies)) - err = ccudart.cudaStreamUpdateCaptureDependencies(cstream, (dependencies[0])._ptr if len(dependencies) == 1 else cdependencies, numDependencies, flags) - if cdependencies is not NULL: - free(cdependencies) - return (cudaError_t(err),) -{{endif}} + The host function must not make any CUDA API calls. Attempting to use a + CUDA API may result in :py:obj:`~.cudaErrorNotPermitted`, but this is + not required. The host function must not perform any synchronization + that may depend on outstanding CUDA work not mandated to run earlier. + Host functions without a mandated order (such as in independent + streams) execute in undefined order and may be serialized. -{{if 'cudaStreamUpdateCaptureDependencies_v2' in found_functions}} + For the purposes of Unified Memory, execution makes a number of + guarantees: -@cython.embedsignature(True) -def cudaStreamUpdateCaptureDependencies_v2(stream, dependencies : Optional[List[cudaGraphNode_t]], dependencyData : Optional[List[cudaGraphEdgeData]], size_t numDependencies, unsigned int flags): - """ Update the set of dependencies in a capturing stream (12.3+) + - The stream is considered idle for the duration of the function's + execution. Thus, for example, the function may always use memory + attached to the stream it was enqueued in. - Modifies the dependency set of a capturing stream. The dependency set - is the set of nodes that the next captured node in the stream will - depend on. + - The start of execution of the function has the same effect as + synchronizing an event recorded in the same stream immediately prior + to the function. It thus synchronizes streams which have been + "joined" prior to the function. - Valid flags are :py:obj:`~.cudaStreamAddCaptureDependencies` and - :py:obj:`~.cudaStreamSetCaptureDependencies`. These control whether the - set passed to the API is added to the existing set or replaces it. A - flags value of 0 defaults to - :py:obj:`~.cudaStreamAddCaptureDependencies`. + - Adding device work to any stream does not have the effect of making + the stream active until all preceding host functions and stream + callbacks have executed. Thus, for example, a function might use + global attached memory even if work has been added to another stream, + if the work has been ordered behind the function call with an event. - Nodes that are removed from the dependency set via this API do not - result in :py:obj:`~.cudaErrorStreamCaptureUnjoined` if they are - unreachable from the stream at :py:obj:`~.cudaStreamEndCapture`. + - Completion of the function does not cause a stream to become active + except as described above. The stream will remain idle if no device + work follows the function, and will remain idle across consecutive + host functions or stream callbacks without device work in between. + Thus, for example, stream synchronization can be done by signaling + from a host function at the end of the stream. - Returns :py:obj:`~.cudaErrorIllegalState` if the stream is not - capturing. + Note that, in constrast to :py:obj:`~.cuStreamAddCallback`, the + function will not be called in the event of an error in the CUDA + context. Parameters ---------- - stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` - The stream to update - dependencies : List[:py:obj:`~.cudaGraphNode_t`] - The set of dependencies to add - dependencyData : List[:py:obj:`~.cudaGraphEdgeData`] - Optional array of data associated with each dependency. - numDependencies : size_t - The size of the dependencies array - flags : unsigned int - See above + hStream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + Stream to enqueue function call in + fn : :py:obj:`~.cudaHostFn_t` + The function to call once preceding stream operations are complete + userData : Any + User-specified data to be passed to the function + syncMode : unsigned int + Sync mode for the host function Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorIllegalState` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorNotSupported` See Also -------- - :py:obj:`~.cudaStreamBeginCapture`, :py:obj:`~.cudaStreamGetCaptureInfo`, + :py:obj:`~.cudaStreamCreate`, :py:obj:`~.cudaStreamQuery`, :py:obj:`~.cudaStreamSynchronize`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cudaStreamDestroy`, :py:obj:`~.cudaMallocManaged`, :py:obj:`~.cudaStreamAttachMemAsync`, :py:obj:`~.cudaStreamAddCallback`, :py:obj:`~.cuLaunchHostFunc` """ - dependencyData = [] if dependencyData is None else dependencyData - if not all(isinstance(_x, (cudaGraphEdgeData,)) for _x in dependencyData): - raise TypeError("Argument 'dependencyData' is not instance of type (expected List[ccudart.cudaGraphEdgeData,]") - dependencies = [] if dependencies is None else dependencies - if not all(isinstance(_x, (cudaGraphNode_t,cuda.CUgraphNode)) for _x in dependencies): - raise TypeError("Argument 'dependencies' is not instance of type (expected List[ccudart.cudaGraphNode_t,cuda.CUgraphNode]") - cdef ccudart.cudaStream_t cstream + cdef cyruntime.cudaHostFn_t cyfn + if fn is None: + pfn = 0 + elif isinstance(fn, (cudaHostFn_t,)): + pfn = int(fn) + else: + pfn = int(cudaHostFn_t(fn)) + cyfn = pfn + cdef cyruntime.cudaStream_t cystream if stream is None: - cstream = 0 - elif isinstance(stream, (cudaStream_t,cuda.CUstream)): + pstream = 0 + elif isinstance(stream, (cudaStream_t,driver.CUstream)): pstream = int(stream) - cstream = pstream else: pstream = int(cudaStream_t(stream)) - cstream = pstream - cdef ccudart.cudaGraphNode_t* cdependencies = NULL - if len(dependencies) > 0: - cdependencies = calloc(len(dependencies), sizeof(ccudart.cudaGraphNode_t)) - if cdependencies is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(dependencies)) + 'x' + str(sizeof(ccudart.cudaGraphNode_t))) - else: - for idx in range(len(dependencies)): - cdependencies[idx] = (dependencies[idx])._ptr[0] - cdef ccudart.cudaGraphEdgeData* cdependencyData = NULL - if len(dependencyData) > 0: - cdependencyData = calloc(len(dependencyData), sizeof(ccudart.cudaGraphEdgeData)) - if cdependencyData is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(dependencyData)) + 'x' + str(sizeof(ccudart.cudaGraphEdgeData))) - for idx in range(len(dependencyData)): - string.memcpy(&cdependencyData[idx], (dependencyData[idx])._ptr, sizeof(ccudart.cudaGraphEdgeData)) - err = ccudart.cudaStreamUpdateCaptureDependencies_v2(cstream, (dependencies[0])._ptr if len(dependencies) == 1 else cdependencies, (dependencyData[0])._ptr if len(dependencyData) == 1 else cdependencyData, numDependencies, flags) - if cdependencies is not NULL: - free(cdependencies) - if cdependencyData is not NULL: - free(cdependencyData) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaEventCreate' in found_functions}} + cystream = pstream + cdef _HelperInputVoidPtrStruct cyuserDataHelper + cdef void* cyuserData = _helper_input_void_ptr(userData, &cyuserDataHelper) + with nogil: + err = cyruntime.cudaLaunchHostFunc_v2(cystream, cyfn, cyuserData, syncMode) + _helper_input_void_ptr_free(&cyuserDataHelper) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaEventCreate(): - """ Creates an event object. +def cudaFuncSetSharedMemConfig(func, config not None : cudaSharedMemConfig): + """ Sets the shared memory configuration for a device function. - Creates an event object for the current device using - :py:obj:`~.cudaEventDefault`. + [Deprecated] - Returns - ------- - cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorLaunchFailure`, :py:obj:`~.cudaErrorMemoryAllocation` - event : :py:obj:`~.cudaEvent_t` - Newly created event + On devices with configurable shared memory banks, this function will + force all subsequent launches of the specified device function to have + the given shared memory bank size configuration. On any given launch of + the function, the shared memory configuration of the device will be + temporarily changed if needed to suit the function's preferred + configuration. Changes in shared memory configuration between + subsequent launches of functions, may introduce a device side + synchronization point. - See Also - -------- - cudaEventCreate (C++ API), :py:obj:`~.cudaEventCreateWithFlags`, :py:obj:`~.cudaEventRecord`, :py:obj:`~.cudaEventQuery`, :py:obj:`~.cudaEventSynchronize`, :py:obj:`~.cudaEventDestroy`, :py:obj:`~.cudaEventElapsedTime`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cuEventCreate` - """ - cdef cudaEvent_t event = cudaEvent_t() - err = ccudart.cudaEventCreate(event._ptr) - return (cudaError_t(err), event) -{{endif}} + Any per-function setting of shared memory bank size set via + :py:obj:`~.cudaFuncSetSharedMemConfig` will override the device wide + setting set by :py:obj:`~.cudaDeviceSetSharedMemConfig`. -{{if 'cudaEventCreateWithFlags' in found_functions}} + Changing the shared memory bank size will not increase shared memory + usage or affect occupancy of kernels, but may have major effects on + performance. Larger bank sizes will allow for greater potential + bandwidth to shared memory, but will change what kinds of accesses to + shared memory will result in bank conflicts. -@cython.embedsignature(True) -def cudaEventCreateWithFlags(unsigned int flags): - """ Creates an event object with the specified flags. + This function will do nothing on devices with fixed shared memory bank + size. - Creates an event object for the current device with the specified - flags. Valid flags include: + For templated functions, pass the function symbol as follows: + func_name - - :py:obj:`~.cudaEventDefault`: Default event creation flag. + The supported bank configurations are: - - :py:obj:`~.cudaEventBlockingSync`: Specifies that event should use - blocking synchronization. A host thread that uses - :py:obj:`~.cudaEventSynchronize()` to wait on an event created with - this flag will block until the event actually completes. + - :py:obj:`~.cudaSharedMemBankSizeDefault`: use the device's shared + memory configuration when launching this function. - - :py:obj:`~.cudaEventDisableTiming`: Specifies that the created event - does not need to record timing data. Events created with this flag - specified and the :py:obj:`~.cudaEventBlockingSync` flag not - specified will provide the best performance when used with - :py:obj:`~.cudaStreamWaitEvent()` and :py:obj:`~.cudaEventQuery()`. + - :py:obj:`~.cudaSharedMemBankSizeFourByte`: set shared memory bank + width to be four bytes natively when launching this function. - - :py:obj:`~.cudaEventInterprocess`: Specifies that the created event - may be used as an interprocess event by - :py:obj:`~.cudaIpcGetEventHandle()`. - :py:obj:`~.cudaEventInterprocess` must be specified along with - :py:obj:`~.cudaEventDisableTiming`. + - :py:obj:`~.cudaSharedMemBankSizeEightByte`: set shared memory bank + width to be eight bytes natively when launching this function. Parameters ---------- - flags : unsigned int - Flags for new event + func : Any + Device function symbol + config : :py:obj:`~.cudaSharedMemConfig` + Requested shared memory configuration Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorLaunchFailure`, :py:obj:`~.cudaErrorMemoryAllocation` - event : :py:obj:`~.cudaEvent_t` - Newly created event + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDeviceFunction`, :py:obj:`~.cudaErrorInvalidValue`,2 See Also -------- - :py:obj:`~.cudaEventCreate (C API)`, :py:obj:`~.cudaEventSynchronize`, :py:obj:`~.cudaEventDestroy`, :py:obj:`~.cudaEventElapsedTime`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cuEventCreate` + :py:obj:`~.cudaDeviceSetSharedMemConfig`, :py:obj:`~.cudaDeviceGetSharedMemConfig`, :py:obj:`~.cudaDeviceSetCacheConfig`, :py:obj:`~.cudaDeviceGetCacheConfig`, :py:obj:`~.cudaFuncSetCacheConfig`, :py:obj:`~.cuFuncSetSharedMemConfig` """ - cdef cudaEvent_t event = cudaEvent_t() - err = ccudart.cudaEventCreateWithFlags(event._ptr, flags) - return (cudaError_t(err), event) -{{endif}} - -{{if 'cudaEventRecord' in found_functions}} + cdef _HelperInputVoidPtrStruct cyfuncHelper + cdef void* cyfunc = _helper_input_void_ptr(func, &cyfuncHelper) + cdef cyruntime.cudaSharedMemConfig cyconfig = int(config) + with nogil: + err = cyruntime.cudaFuncSetSharedMemConfig(cyfunc, cyconfig) + _helper_input_void_ptr_free(&cyfuncHelper) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaEventRecord(event, stream): - """ Records an event. - - Captures in `event` the contents of `stream` at the time of this call. - `event` and `stream` must be on the same CUDA context. Calls such as - :py:obj:`~.cudaEventQuery()` or :py:obj:`~.cudaStreamWaitEvent()` will - then examine or wait for completion of the work that was captured. Uses - of `stream` after this call do not modify `event`. See note on default - stream behavior for what is captured in the default case. +def cudaOccupancyMaxActiveBlocksPerMultiprocessor(func, int blockSize, size_t dynamicSMemSize): + """ Returns occupancy for a device function. - :py:obj:`~.cudaEventRecord()` can be called multiple times on the same - event and will overwrite the previously captured state. Other APIs such - as :py:obj:`~.cudaStreamWaitEvent()` use the most recently captured - state at the time of the API call, and are not affected by later calls - to :py:obj:`~.cudaEventRecord()`. Before the first call to - :py:obj:`~.cudaEventRecord()`, an event represents an empty set of - work, so for example :py:obj:`~.cudaEventQuery()` would return - :py:obj:`~.cudaSuccess`. + Returns in `*numBlocks` the maximum number of active blocks per + streaming multiprocessor for the device function. Parameters ---------- - event : :py:obj:`~.CUevent` or :py:obj:`~.cudaEvent_t` - Event to record - stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` - Stream in which to record event + func : Any + Kernel function for which occupancy is calculated + blockSize : int + Block size the kernel is intended to be launched with + dynamicSMemSize : size_t + Per-block dynamic shared memory usage intended, in bytes Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorLaunchFailure` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDevice`, :py:obj:`~.cudaErrorInvalidDeviceFunction`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorUnknown`, + numBlocks : int + Returned occupancy See Also -------- - :py:obj:`~.cudaEventCreate (C API)`, :py:obj:`~.cudaEventCreateWithFlags`, :py:obj:`~.cudaEventQuery`, :py:obj:`~.cudaEventSynchronize`, :py:obj:`~.cudaEventDestroy`, :py:obj:`~.cudaEventElapsedTime`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cudaEventRecordWithFlags`, :py:obj:`~.cuEventRecord` + :py:obj:`~.cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags`, cudaOccupancyMaxPotentialBlockSize (C++ API), cudaOccupancyMaxPotentialBlockSizeWithFlags (C++ API), cudaOccupancyMaxPotentialBlockSizeVariableSMem (C++ API), cudaOccupancyMaxPotentialBlockSizeVariableSMemWithFlags (C++ API), cudaOccupancyAvailableDynamicSMemPerBlock (C++ API), :py:obj:`~.cuOccupancyMaxActiveBlocksPerMultiprocessor` """ - cdef ccudart.cudaStream_t cstream - if stream is None: - cstream = 0 - elif isinstance(stream, (cudaStream_t,cuda.CUstream)): - pstream = int(stream) - cstream = pstream - else: - pstream = int(cudaStream_t(stream)) - cstream = pstream - cdef ccudart.cudaEvent_t cevent - if event is None: - cevent = 0 - elif isinstance(event, (cudaEvent_t,cuda.CUevent)): - pevent = int(event) - cevent = pevent - else: - pevent = int(cudaEvent_t(event)) - cevent = pevent - err = ccudart.cudaEventRecord(cevent, cstream) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaEventRecordWithFlags' in found_functions}} + cdef int numBlocks = 0 + cdef _HelperInputVoidPtrStruct cyfuncHelper + cdef void* cyfunc = _helper_input_void_ptr(func, &cyfuncHelper) + with nogil: + err = cyruntime.cudaOccupancyMaxActiveBlocksPerMultiprocessor(&numBlocks, cyfunc, blockSize, dynamicSMemSize) + _helper_input_void_ptr_free(&cyfuncHelper) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, numBlocks) @cython.embedsignature(True) -def cudaEventRecordWithFlags(event, stream, unsigned int flags): - """ Records an event. - - Captures in `event` the contents of `stream` at the time of this call. - `event` and `stream` must be on the same CUDA context. Calls such as - :py:obj:`~.cudaEventQuery()` or :py:obj:`~.cudaStreamWaitEvent()` will - then examine or wait for completion of the work that was captured. Uses - of `stream` after this call do not modify `event`. See note on default - stream behavior for what is captured in the default case. - - :py:obj:`~.cudaEventRecordWithFlags()` can be called multiple times on - the same event and will overwrite the previously captured state. Other - APIs such as :py:obj:`~.cudaStreamWaitEvent()` use the most recently - captured state at the time of the API call, and are not affected by - later calls to :py:obj:`~.cudaEventRecordWithFlags()`. Before the first - call to :py:obj:`~.cudaEventRecordWithFlags()`, an event represents an - empty set of work, so for example :py:obj:`~.cudaEventQuery()` would - return :py:obj:`~.cudaSuccess`. - - flags include: - - - :py:obj:`~.cudaEventRecordDefault`: Default event creation flag. +def cudaOccupancyAvailableDynamicSMemPerBlock(func, int numBlocks, int blockSize): + """ Returns dynamic shared memory available per block when launching `numBlocks` blocks on SM. - - :py:obj:`~.cudaEventRecordExternal`: Event is captured in the graph - as an external event node when performing stream capture. + Returns in `*dynamicSmemSize` the maximum size of dynamic shared memory + to allow `numBlocks` blocks per SM. Parameters ---------- - event : :py:obj:`~.CUevent` or :py:obj:`~.cudaEvent_t` - Event to record - stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` - Stream in which to record event - flags : unsigned int - Parameters for the operation(See above) + func : Any + Kernel function for which occupancy is calculated + numBlocks : int + Number of blocks to fit on SM + blockSize : int + Size of the block Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorLaunchFailure` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDevice`, :py:obj:`~.cudaErrorInvalidDeviceFunction`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorUnknown`, + dynamicSmemSize : int + Returned maximum dynamic shared memory See Also -------- - :py:obj:`~.cudaEventCreate (C API)`, :py:obj:`~.cudaEventCreateWithFlags`, :py:obj:`~.cudaEventQuery`, :py:obj:`~.cudaEventSynchronize`, :py:obj:`~.cudaEventDestroy`, :py:obj:`~.cudaEventElapsedTime`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cudaEventRecord`, :py:obj:`~.cuEventRecord`, + :py:obj:`~.cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags`, cudaOccupancyMaxPotentialBlockSize (C++ API), cudaOccupancyMaxPotentialBlockSizeWithFlags (C++ API), cudaOccupancyMaxPotentialBlockSizeVariableSMem (C++ API), cudaOccupancyMaxPotentialBlockSizeVariableSMemWithFlags (C++ API), :py:obj:`~.cudaOccupancyAvailableDynamicSMemPerBlock` """ - cdef ccudart.cudaStream_t cstream - if stream is None: - cstream = 0 - elif isinstance(stream, (cudaStream_t,cuda.CUstream)): - pstream = int(stream) - cstream = pstream - else: - pstream = int(cudaStream_t(stream)) - cstream = pstream - cdef ccudart.cudaEvent_t cevent - if event is None: - cevent = 0 - elif isinstance(event, (cudaEvent_t,cuda.CUevent)): - pevent = int(event) - cevent = pevent - else: - pevent = int(cudaEvent_t(event)) - cevent = pevent - err = ccudart.cudaEventRecordWithFlags(cevent, cstream, flags) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaEventQuery' in found_functions}} + cdef size_t dynamicSmemSize = 0 + cdef _HelperInputVoidPtrStruct cyfuncHelper + cdef void* cyfunc = _helper_input_void_ptr(func, &cyfuncHelper) + with nogil: + err = cyruntime.cudaOccupancyAvailableDynamicSMemPerBlock(&dynamicSmemSize, cyfunc, numBlocks, blockSize) + _helper_input_void_ptr_free(&cyfuncHelper) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, dynamicSmemSize) @cython.embedsignature(True) -def cudaEventQuery(event): - """ Queries an event's status. +def cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(func, int blockSize, size_t dynamicSMemSize, unsigned int flags): + """ Returns occupancy for a device function with the specified flags. - Queries the status of all work currently captured by `event`. See - :py:obj:`~.cudaEventRecord()` for details on what is captured by an - event. + Returns in `*numBlocks` the maximum number of active blocks per + streaming multiprocessor for the device function. - Returns :py:obj:`~.cudaSuccess` if all captured work has been - completed, or :py:obj:`~.cudaErrorNotReady` if any captured work is - incomplete. + The `flags` parameter controls how special cases are handled. Valid + flags include: + + - :py:obj:`~.cudaOccupancyDefault`: keeps the default behavior as + :py:obj:`~.cudaOccupancyMaxActiveBlocksPerMultiprocessor` - For the purposes of Unified Memory, a return value of - :py:obj:`~.cudaSuccess` is equivalent to having called - :py:obj:`~.cudaEventSynchronize()`. + - :py:obj:`~.cudaOccupancyDisableCachingOverride`: This flag suppresses + the default behavior on platform where global caching affects + occupancy. On such platforms, if caching is enabled, but per-block SM + resource usage would result in zero occupancy, the occupancy + calculator will calculate the occupancy as if caching is disabled. + Setting this flag makes the occupancy calculator to return 0 in such + cases. More information can be found about this feature in the + "Unified L1/Texture Cache" section of the Maxwell tuning guide. Parameters ---------- - event : :py:obj:`~.CUevent` or :py:obj:`~.cudaEvent_t` - Event to query + func : Any + Kernel function for which occupancy is calculated + blockSize : int + Block size the kernel is intended to be launched with + dynamicSMemSize : size_t + Per-block dynamic shared memory usage intended, in bytes + flags : unsigned int + Requested behavior for the occupancy calculator Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorNotReady`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorLaunchFailure` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDevice`, :py:obj:`~.cudaErrorInvalidDeviceFunction`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorUnknown`, + numBlocks : int + Returned occupancy See Also -------- - :py:obj:`~.cudaEventCreate (C API)`, :py:obj:`~.cudaEventCreateWithFlags`, :py:obj:`~.cudaEventRecord`, :py:obj:`~.cudaEventSynchronize`, :py:obj:`~.cudaEventDestroy`, :py:obj:`~.cudaEventElapsedTime`, :py:obj:`~.cuEventQuery` + :py:obj:`~.cudaOccupancyMaxActiveBlocksPerMultiprocessor`, cudaOccupancyMaxPotentialBlockSize (C++ API), cudaOccupancyMaxPotentialBlockSizeWithFlags (C++ API), cudaOccupancyMaxPotentialBlockSizeVariableSMem (C++ API), cudaOccupancyMaxPotentialBlockSizeVariableSMemWithFlags (C++ API), cudaOccupancyAvailableDynamicSMemPerBlock (C++ API), :py:obj:`~.cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags` """ - cdef ccudart.cudaEvent_t cevent - if event is None: - cevent = 0 - elif isinstance(event, (cudaEvent_t,cuda.CUevent)): - pevent = int(event) - cevent = pevent - else: - pevent = int(cudaEvent_t(event)) - cevent = pevent - err = ccudart.cudaEventQuery(cevent) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaEventSynchronize' in found_functions}} + cdef int numBlocks = 0 + cdef _HelperInputVoidPtrStruct cyfuncHelper + cdef void* cyfunc = _helper_input_void_ptr(func, &cyfuncHelper) + with nogil: + err = cyruntime.cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(&numBlocks, cyfunc, blockSize, dynamicSMemSize, flags) + _helper_input_void_ptr_free(&cyfuncHelper) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, numBlocks) @cython.embedsignature(True) -def cudaEventSynchronize(event): - """ Waits for an event to complete. +def cudaMallocManaged(size_t size, unsigned int flags): + """ Allocates memory that will be automatically managed by the Unified Memory system. - Waits until the completion of all work currently captured in `event`. - See :py:obj:`~.cudaEventRecord()` for details on what is captured by an - event. + Allocates `size` bytes of managed memory on the device and returns in + `*devPtr` a pointer to the allocated memory. If the device doesn't + support allocating managed memory, :py:obj:`~.cudaErrorNotSupported` is + returned. Support for managed memory can be queried using the device + attribute :py:obj:`~.cudaDevAttrManagedMemory`. The allocated memory is + suitably aligned for any kind of variable. The memory is not cleared. + If `size` is 0, :py:obj:`~.cudaMallocManaged` returns + :py:obj:`~.cudaErrorInvalidValue`. The pointer is valid on the CPU and + on all GPUs in the system that support managed memory. All accesses to + this pointer must obey the Unified Memory programming model. - Waiting for an event that was created with the - :py:obj:`~.cudaEventBlockingSync` flag will cause the calling CPU - thread to block until the event has been completed by the device. If - the :py:obj:`~.cudaEventBlockingSync` flag has not been set, then the - CPU thread will busy-wait until the event has been completed by the - device. + `flags` specifies the default stream association for this allocation. + `flags` must be one of :py:obj:`~.cudaMemAttachGlobal` or + :py:obj:`~.cudaMemAttachHost`. The default value for `flags` is + :py:obj:`~.cudaMemAttachGlobal`. If :py:obj:`~.cudaMemAttachGlobal` is + specified, then this memory is accessible from any stream on any + device. If :py:obj:`~.cudaMemAttachHost` is specified, then the + allocation should not be accessed from devices that have a zero value + for the device attribute + :py:obj:`~.cudaDevAttrConcurrentManagedAccess`; an explicit call to + :py:obj:`~.cudaStreamAttachMemAsync` will be required to enable access + on such devices. - Parameters - ---------- - event : :py:obj:`~.CUevent` or :py:obj:`~.cudaEvent_t` - Event to wait for + If the association is later changed via + :py:obj:`~.cudaStreamAttachMemAsync` to a single stream, the default + association, as specifed during :py:obj:`~.cudaMallocManaged`, is + restored when that stream is destroyed. For managed variables, the + default association is always :py:obj:`~.cudaMemAttachGlobal`. Note + that destroying a stream is an asynchronous operation, and as a result, + the change to default association won't happen until all work in the + stream has completed. - Returns - ------- - cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorLaunchFailure` + Memory allocated with :py:obj:`~.cudaMallocManaged` should be released + with :py:obj:`~.cudaFree`. - See Also - -------- - :py:obj:`~.cudaEventCreate (C API)`, :py:obj:`~.cudaEventCreateWithFlags`, :py:obj:`~.cudaEventRecord`, :py:obj:`~.cudaEventQuery`, :py:obj:`~.cudaEventDestroy`, :py:obj:`~.cudaEventElapsedTime`, :py:obj:`~.cuEventSynchronize` - """ - cdef ccudart.cudaEvent_t cevent - if event is None: - cevent = 0 - elif isinstance(event, (cudaEvent_t,cuda.CUevent)): - pevent = int(event) - cevent = pevent - else: - pevent = int(cudaEvent_t(event)) - cevent = pevent - err = ccudart.cudaEventSynchronize(cevent) - return (cudaError_t(err),) -{{endif}} + Device memory oversubscription is possible for GPUs that have a non- + zero value for the device attribute + :py:obj:`~.cudaDevAttrConcurrentManagedAccess`. Managed memory on such + GPUs may be evicted from device memory to host memory at any time by + the Unified Memory driver in order to make room for other allocations. -{{if 'cudaEventDestroy' in found_functions}} + In a system where all GPUs have a non-zero value for the device + attribute :py:obj:`~.cudaDevAttrConcurrentManagedAccess`, managed + memory may not be populated when this API returns and instead may be + populated on access. In such systems, managed memory can migrate to any + processor's memory at any time. The Unified Memory driver will employ + heuristics to maintain data locality and prevent excessive page faults + to the extent possible. The application can also guide the driver about + memory usage patterns via :py:obj:`~.cudaMemAdvise`. The application + can also explicitly migrate memory to a desired processor's memory via + :py:obj:`~.cudaMemPrefetchAsync`. -@cython.embedsignature(True) -def cudaEventDestroy(event): - """ Destroys an event object. + In a multi-GPU system where all of the GPUs have a zero value for the + device attribute :py:obj:`~.cudaDevAttrConcurrentManagedAccess` and all + the GPUs have peer-to-peer support with each other, the physical + storage for managed memory is created on the GPU which is active at the + time :py:obj:`~.cudaMallocManaged` is called. All other GPUs will + reference the data at reduced bandwidth via peer mappings over the PCIe + bus. The Unified Memory driver does not migrate memory among such GPUs. - Destroys the event specified by `event`. + In a multi-GPU system where not all GPUs have peer-to-peer support with + each other and where the value of the device attribute + :py:obj:`~.cudaDevAttrConcurrentManagedAccess` is zero for at least one + of those GPUs, the location chosen for physical storage of managed + memory is system-dependent. - An event may be destroyed before it is complete (i.e., while - :py:obj:`~.cudaEventQuery()` would return - :py:obj:`~.cudaErrorNotReady`). In this case, the call does not block - on completion of the event, and any associated resources will - automatically be released asynchronously at completion. + - On Linux, the location chosen will be device memory as long as the + current set of active contexts are on devices that either have peer- + to-peer support with each other or have a non-zero value for the + device attribute :py:obj:`~.cudaDevAttrConcurrentManagedAccess`. If + there is an active context on a GPU that does not have a non-zero + value for that device attribute and it does not have peer-to-peer + support with the other devices that have active contexts on them, + then the location for physical storage will be 'zero-copy' or host + memory. Note that this means that managed memory that is located in + device memory is migrated to host memory if a new context is created + on a GPU that doesn't have a non-zero value for the device attribute + and does not support peer-to-peer with at least one of the other + devices that has an active context. This in turn implies that context + creation may fail if there is insufficient host memory to migrate all + managed allocations. + + - On Windows, the physical storage is always created in 'zero-copy' or + host memory. All GPUs will reference the data at reduced bandwidth + over the PCIe bus. In these circumstances, use of the environment + variable CUDA_VISIBLE_DEVICES is recommended to restrict CUDA to only + use those GPUs that have peer-to-peer support. Alternatively, users + can also set CUDA_MANAGED_FORCE_DEVICE_ALLOC to a non-zero value to + force the driver to always use device memory for physical storage. + When this environment variable is set to a non-zero value, all + devices used in that process that support managed memory have to be + peer-to-peer compatible with each other. The error + :py:obj:`~.cudaErrorInvalidDevice` will be returned if a device that + supports managed memory is used and it is not peer-to-peer compatible + with any of the other managed memory supporting devices that were + previously used in that process, even if :py:obj:`~.cudaDeviceReset` + has been called on those devices. These environment variables are + described in the CUDA programming guide under the "CUDA environment + variables" section. Parameters ---------- - event : :py:obj:`~.CUevent` or :py:obj:`~.cudaEvent_t` - Event to destroy + size : size_t + Requested allocation size in bytes + flags : unsigned int + Must be either :py:obj:`~.cudaMemAttachGlobal` or + :py:obj:`~.cudaMemAttachHost` (defaults to + :py:obj:`~.cudaMemAttachGlobal`) Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorLaunchFailure` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorMemoryAllocation`, :py:obj:`~.cudaErrorNotSupported`, :py:obj:`~.cudaErrorInvalidValue` + devPtr : Any + Pointer to allocated device memory See Also -------- - :py:obj:`~.cudaEventCreate (C API)`, :py:obj:`~.cudaEventCreateWithFlags`, :py:obj:`~.cudaEventQuery`, :py:obj:`~.cudaEventSynchronize`, :py:obj:`~.cudaEventRecord`, :py:obj:`~.cudaEventElapsedTime`, :py:obj:`~.cuEventDestroy` + :py:obj:`~.cudaMallocPitch`, :py:obj:`~.cudaFree`, :py:obj:`~.cudaMallocArray`, :py:obj:`~.cudaFreeArray`, :py:obj:`~.cudaMalloc3D`, :py:obj:`~.cudaMalloc3DArray`, :py:obj:`~.cudaMallocHost (C API)`, :py:obj:`~.cudaFreeHost`, :py:obj:`~.cudaHostAlloc`, :py:obj:`~.cudaDeviceGetAttribute`, :py:obj:`~.cudaStreamAttachMemAsync`, :py:obj:`~.cuMemAllocManaged` """ - cdef ccudart.cudaEvent_t cevent - if event is None: - cevent = 0 - elif isinstance(event, (cudaEvent_t,cuda.CUevent)): - pevent = int(event) - cevent = pevent - else: - pevent = int(cudaEvent_t(event)) - cevent = pevent - err = ccudart.cudaEventDestroy(cevent) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaEventElapsedTime' in found_functions}} + cdef void_ptr devPtr = 0 + with nogil: + err = cyruntime.cudaMallocManaged(&devPtr, size, flags) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, devPtr) @cython.embedsignature(True) -def cudaEventElapsedTime(start, end): - """ Computes the elapsed time between events. - - Computes the elapsed time between two events (in milliseconds with a - resolution of around 0.5 microseconds). +def cudaMalloc(size_t size): + """ Allocate memory on the device. - If either event was last recorded in a non-NULL stream, the resulting - time may be greater than expected (even if both used the same stream - handle). This happens because the :py:obj:`~.cudaEventRecord()` - operation takes place asynchronously and there is no guarantee that the - measured latency is actually just between the two events. Any number of - other different stream operations could execute in between the two - measured events, thus altering the timing in a significant way. + Allocates `size` bytes of linear memory on the device and returns in + `*devPtr` a pointer to the allocated memory. The allocated memory is + suitably aligned for any kind of variable. The memory is not cleared. + :py:obj:`~.cudaMalloc()` returns :py:obj:`~.cudaErrorMemoryAllocation` + in case of failure. - If :py:obj:`~.cudaEventRecord()` has not been called on either event, - then :py:obj:`~.cudaErrorInvalidResourceHandle` is returned. If - :py:obj:`~.cudaEventRecord()` has been called on both events but one or - both of them has not yet been completed (that is, - :py:obj:`~.cudaEventQuery()` would return :py:obj:`~.cudaErrorNotReady` - on at least one of the events), :py:obj:`~.cudaErrorNotReady` is - returned. If either event was created with the - :py:obj:`~.cudaEventDisableTiming` flag, then this function will return - :py:obj:`~.cudaErrorInvalidResourceHandle`. + The device version of :py:obj:`~.cudaFree` cannot be used with a + `*devPtr` allocated using the host API, and vice versa. Parameters ---------- - start : :py:obj:`~.CUevent` or :py:obj:`~.cudaEvent_t` - Starting event - end : :py:obj:`~.CUevent` or :py:obj:`~.cudaEvent_t` - Ending event + size : size_t + Requested allocation size in bytes Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorNotReady`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorLaunchFailure`, :py:obj:`~.cudaErrorUnknown` - ms : float - Time between `start` and `end` in ms + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorMemoryAllocation`, :py:obj:`~.cudaErrorExternalDevice` + devPtr : Any + Pointer to allocated device memory See Also -------- - :py:obj:`~.cudaEventCreate (C API)`, :py:obj:`~.cudaEventCreateWithFlags`, :py:obj:`~.cudaEventQuery`, :py:obj:`~.cudaEventSynchronize`, :py:obj:`~.cudaEventDestroy`, :py:obj:`~.cudaEventRecord`, :py:obj:`~.cuEventElapsedTime` + :py:obj:`~.cudaMallocPitch`, :py:obj:`~.cudaFree`, :py:obj:`~.cudaMallocArray`, :py:obj:`~.cudaFreeArray`, :py:obj:`~.cudaMalloc3D`, :py:obj:`~.cudaMalloc3DArray`, :py:obj:`~.cudaMallocHost (C API)`, :py:obj:`~.cudaFreeHost`, :py:obj:`~.cudaHostAlloc`, :py:obj:`~.cuMemAlloc` """ - cdef ccudart.cudaEvent_t cend - if end is None: - cend = 0 - elif isinstance(end, (cudaEvent_t,cuda.CUevent)): - pend = int(end) - cend = pend - else: - pend = int(cudaEvent_t(end)) - cend = pend - cdef ccudart.cudaEvent_t cstart - if start is None: - cstart = 0 - elif isinstance(start, (cudaEvent_t,cuda.CUevent)): - pstart = int(start) - cstart = pstart - else: - pstart = int(cudaEvent_t(start)) - cstart = pstart - cdef float ms = 0 - err = ccudart.cudaEventElapsedTime(&ms, cstart, cend) - return (cudaError_t(err), ms) -{{endif}} - -{{if 'cudaImportExternalMemory' in found_functions}} + cdef void_ptr devPtr = 0 + with nogil: + err = cyruntime.cudaMalloc(&devPtr, size) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, devPtr) @cython.embedsignature(True) -def cudaImportExternalMemory(memHandleDesc : Optional[cudaExternalMemoryHandleDesc]): - """ Imports an external memory object. - - Imports an externally allocated memory object and returns a handle to - that in `extMem_out`. - - The properties of the handle being imported must be described in - `memHandleDesc`. The :py:obj:`~.cudaExternalMemoryHandleDesc` structure - is defined as follows: - - **View CUDA Toolkit Documentation for a C++ code example** - - where :py:obj:`~.cudaExternalMemoryHandleDesc.type` specifies the type - of handle being imported. :py:obj:`~.cudaExternalMemoryHandleType` is - defined as: - - **View CUDA Toolkit Documentation for a C++ code example** +def cudaMallocHost(size_t size): + """ Allocates page-locked memory on the host. - If :py:obj:`~.cudaExternalMemoryHandleDesc.type` is - :py:obj:`~.cudaExternalMemoryHandleTypeOpaqueFd`, then - :py:obj:`~.cudaExternalMemoryHandleDesc`::handle::fd must be a valid - file descriptor referencing a memory object. Ownership of the file - descriptor is transferred to the CUDA driver when the handle is - imported successfully. Performing any operations on the file descriptor - after it is imported results in undefined behavior. + Allocates `size` bytes of host memory that is page-locked and + accessible to the device. The driver tracks the virtual memory ranges + allocated with this function and automatically accelerates calls to + functions such as :py:obj:`~.cudaMemcpy`*(). Since the memory can be + accessed directly by the device, it can be read or written with much + higher bandwidth than pageable memory obtained with functions such as + :py:obj:`~.malloc()`. - If :py:obj:`~.cudaExternalMemoryHandleDesc.type` is - :py:obj:`~.cudaExternalMemoryHandleTypeOpaqueWin32`, then exactly one - of :py:obj:`~.cudaExternalMemoryHandleDesc`::handle::win32::handle and - :py:obj:`~.cudaExternalMemoryHandleDesc`::handle::win32::name must not - be NULL. If - :py:obj:`~.cudaExternalMemoryHandleDesc`::handle::win32::handle is not - NULL, then it must represent a valid shared NT handle that references a - memory object. Ownership of this handle is not transferred to CUDA - after the import operation, so the application must release the handle - using the appropriate system call. If - :py:obj:`~.cudaExternalMemoryHandleDesc`::handle::win32::name is not - NULL, then it must point to a NULL-terminated array of UTF-16 - characters that refers to a memory object. + On systems where :py:obj:`~.pageableMemoryAccessUsesHostPageTables` is + true, :py:obj:`~.cudaMallocHost` may not page-lock the allocated + memory. - If :py:obj:`~.cudaExternalMemoryHandleDesc.type` is - :py:obj:`~.cudaExternalMemoryHandleTypeOpaqueWin32Kmt`, then - :py:obj:`~.cudaExternalMemoryHandleDesc`::handle::win32::handle must be - non-NULL and - :py:obj:`~.cudaExternalMemoryHandleDesc`::handle::win32::name must be - NULL. The handle specified must be a globally shared KMT handle. This - handle does not hold a reference to the underlying object, and thus - will be invalid when all references to the memory object are destroyed. + Page-locking excessive amounts of memory with + :py:obj:`~.cudaMallocHost()` may degrade system performance, since it + reduces the amount of memory available to the system for paging. As a + result, this function is best used sparingly to allocate staging areas + for data exchange between host and device. - If :py:obj:`~.cudaExternalMemoryHandleDesc.type` is - :py:obj:`~.cudaExternalMemoryHandleTypeD3D12Heap`, then exactly one of - :py:obj:`~.cudaExternalMemoryHandleDesc`::handle::win32::handle and - :py:obj:`~.cudaExternalMemoryHandleDesc`::handle::win32::name must not - be NULL. If - :py:obj:`~.cudaExternalMemoryHandleDesc`::handle::win32::handle is not - NULL, then it must represent a valid shared NT handle that is returned - by ID3D12Device::CreateSharedHandle when referring to a ID3D12Heap - object. This handle holds a reference to the underlying object. If - :py:obj:`~.cudaExternalMemoryHandleDesc`::handle::win32::name is not - NULL, then it must point to a NULL-terminated array of UTF-16 - characters that refers to a ID3D12Heap object. + Parameters + ---------- + size : size_t + Requested allocation size in bytes - If :py:obj:`~.cudaExternalMemoryHandleDesc.type` is - :py:obj:`~.cudaExternalMemoryHandleTypeD3D12Resource`, then exactly one - of :py:obj:`~.cudaExternalMemoryHandleDesc`::handle::win32::handle and - :py:obj:`~.cudaExternalMemoryHandleDesc`::handle::win32::name must not - be NULL. If - :py:obj:`~.cudaExternalMemoryHandleDesc`::handle::win32::handle is not - NULL, then it must represent a valid shared NT handle that is returned - by ID3D12Device::CreateSharedHandle when referring to a ID3D12Resource - object. This handle holds a reference to the underlying object. If - :py:obj:`~.cudaExternalMemoryHandleDesc`::handle::win32::name is not - NULL, then it must point to a NULL-terminated array of UTF-16 - characters that refers to a ID3D12Resource object. + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorMemoryAllocation`, :py:obj:`~.cudaErrorExternalDevice` + ptr : Any + Pointer to allocated host memory - If :py:obj:`~.cudaExternalMemoryHandleDesc.type` is - :py:obj:`~.cudaExternalMemoryHandleTypeD3D11Resource`,then exactly one - of :py:obj:`~.cudaExternalMemoryHandleDesc`::handle::win32::handle and - :py:obj:`~.cudaExternalMemoryHandleDesc`::handle::win32::name must not - be NULL. If - :py:obj:`~.cudaExternalMemoryHandleDesc`::handle::win32::handle is - not NULL, then it must represent a valid shared NT handle that is - returned by IDXGIResource1::CreateSharedHandle when referring to a - ID3D11Resource object. If - :py:obj:`~.cudaExternalMemoryHandleDesc`::handle::win32::name is not - NULL, then it must point to a NULL-terminated array of UTF-16 - characters that refers to a ID3D11Resource object. + See Also + -------- + :py:obj:`~.cudaMalloc`, :py:obj:`~.cudaMallocPitch`, :py:obj:`~.cudaMallocArray`, :py:obj:`~.cudaMalloc3D`, :py:obj:`~.cudaMalloc3DArray`, :py:obj:`~.cudaHostAlloc`, :py:obj:`~.cudaFree`, :py:obj:`~.cudaFreeArray`, cudaMallocHost (C++ API), :py:obj:`~.cudaFreeHost`, :py:obj:`~.cudaHostAlloc`, :py:obj:`~.cuMemAllocHost` + """ + cdef void_ptr ptr = 0 + with nogil: + err = cyruntime.cudaMallocHost(&ptr, size) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, ptr) - If :py:obj:`~.cudaExternalMemoryHandleDesc.type` is - :py:obj:`~.cudaExternalMemoryHandleTypeD3D11ResourceKmt`, then - :py:obj:`~.cudaExternalMemoryHandleDesc`::handle::win32::handle must be - non-NULL and - :py:obj:`~.cudaExternalMemoryHandleDesc`::handle::win32::name must be - NULL. The handle specified must be a valid shared KMT handle that is - returned by IDXGIResource::GetSharedHandle when referring to a - ID3D11Resource object. +@cython.embedsignature(True) +def cudaMallocPitch(size_t width, size_t height): + """ Allocates pitched memory on the device. - If :py:obj:`~.cudaExternalMemoryHandleDesc.type` is - :py:obj:`~.cudaExternalMemoryHandleTypeNvSciBuf`, then - :py:obj:`~.cudaExternalMemoryHandleDesc`::handle::nvSciBufObject must - be NON-NULL and reference a valid NvSciBuf object. If the NvSciBuf - object imported into CUDA is also mapped by other drivers, then the - application must use :py:obj:`~.cudaWaitExternalSemaphoresAsync` or - :py:obj:`~.cudaSignalExternalSemaphoresAsync` as approprriate barriers - to maintain coherence between CUDA and the other drivers. See - :py:obj:`~.cudaExternalSemaphoreWaitSkipNvSciBufMemSync` and - :py:obj:`~.cudaExternalSemaphoreSignalSkipNvSciBufMemSync` for memory - synchronization. + Allocates at least `width` (in bytes) * `height` bytes of linear memory + on the device and returns in `*devPtr` a pointer to the allocated + memory. The function may pad the allocation to ensure that + corresponding pointers in any given row will continue to meet the + alignment requirements for coalescing as the address is updated from + row to row. The pitch returned in `*pitch` by + :py:obj:`~.cudaMallocPitch()` is the width in bytes of the allocation. + The intended usage of `pitch` is as a separate parameter of the + allocation, used to compute addresses within the 2D array. Given the + row and column of an array element of type `T`, the address is computed + as: - The size of the memory object must be specified in - :py:obj:`~.cudaExternalMemoryHandleDesc.size`. + **View CUDA Toolkit Documentation for a C++ code example** - Specifying the flag :py:obj:`~.cudaExternalMemoryDedicated` in - :py:obj:`~.cudaExternalMemoryHandleDesc.flags` indicates that the - resource is a dedicated resource. The definition of what a dedicated - resource is outside the scope of this extension. This flag must be set - if :py:obj:`~.cudaExternalMemoryHandleDesc.type` is one of the - following: :py:obj:`~.cudaExternalMemoryHandleTypeD3D12Resource` - :py:obj:`~.cudaExternalMemoryHandleTypeD3D11Resource` - :py:obj:`~.cudaExternalMemoryHandleTypeD3D11ResourceKmt` + For allocations of 2D arrays, it is recommended that programmers + consider performing pitch allocations using + :py:obj:`~.cudaMallocPitch()`. Due to pitch alignment restrictions in + the hardware, this is especially true if the application will be + performing 2D memory copies between different regions of device memory + (whether linear memory or CUDA arrays). Parameters ---------- - memHandleDesc : :py:obj:`~.cudaExternalMemoryHandleDesc` - Memory import handle descriptor + width : size_t + Requested pitched allocation width (in bytes) + height : size_t + Requested pitched allocation height Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorOperatingSystem` - extMem_out : :py:obj:`~.cudaExternalMemory_t` - Returned handle to an external memory object + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorMemoryAllocation` + devPtr : Any + Pointer to allocated pitched device memory + pitch : int + Pitch for allocation See Also -------- - :py:obj:`~.cudaDestroyExternalMemory`, :py:obj:`~.cudaExternalMemoryGetMappedBuffer`, :py:obj:`~.cudaExternalMemoryGetMappedMipmappedArray` - - Notes - ----- - If the Vulkan memory imported into CUDA is mapped on the CPU then the application must use vkInvalidateMappedMemoryRanges/vkFlushMappedMemoryRanges as well as appropriate Vulkan pipeline barriers to maintain coherence between CPU and GPU. For more information on these APIs, please refer to "Synchronization - and Cache Control" chapter from Vulkan specification. + :py:obj:`~.cudaMalloc`, :py:obj:`~.cudaFree`, :py:obj:`~.cudaMallocArray`, :py:obj:`~.cudaFreeArray`, :py:obj:`~.cudaMallocHost (C API)`, :py:obj:`~.cudaFreeHost`, :py:obj:`~.cudaMalloc3D`, :py:obj:`~.cudaMalloc3DArray`, :py:obj:`~.cudaHostAlloc`, :py:obj:`~.cuMemAllocPitch` """ - cdef cudaExternalMemory_t extMem_out = cudaExternalMemory_t() - cdef ccudart.cudaExternalMemoryHandleDesc* cmemHandleDesc_ptr = memHandleDesc._ptr if memHandleDesc != None else NULL - err = ccudart.cudaImportExternalMemory(extMem_out._ptr, cmemHandleDesc_ptr) - return (cudaError_t(err), extMem_out) -{{endif}} - -{{if 'cudaExternalMemoryGetMappedBuffer' in found_functions}} + cdef void_ptr devPtr = 0 + cdef size_t pitch = 0 + with nogil: + err = cyruntime.cudaMallocPitch(&devPtr, &pitch, width, height) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None, None) + return (_cudaError_t_SUCCESS, devPtr, pitch) @cython.embedsignature(True) -def cudaExternalMemoryGetMappedBuffer(extMem, bufferDesc : Optional[cudaExternalMemoryBufferDesc]): - """ Maps a buffer onto an imported memory object. +def cudaMallocArray(desc : Optional[cudaChannelFormatDesc], size_t width, size_t height, unsigned int flags): + """ Allocate an array on the device. - Maps a buffer onto an imported memory object and returns a device - pointer in `devPtr`. + Allocates a CUDA array according to the + :py:obj:`~.cudaChannelFormatDesc` structure `desc` and returns a handle + to the new CUDA array in `*array`. - The properties of the buffer being mapped must be described in - `bufferDesc`. The :py:obj:`~.cudaExternalMemoryBufferDesc` structure is - defined as follows: + The :py:obj:`~.cudaChannelFormatDesc` is defined as: **View CUDA Toolkit Documentation for a C++ code example** - where :py:obj:`~.cudaExternalMemoryBufferDesc.offset` is the offset in - the memory object where the buffer's base address is. - :py:obj:`~.cudaExternalMemoryBufferDesc.size` is the size of the - buffer. :py:obj:`~.cudaExternalMemoryBufferDesc.flags` must be zero. + where :py:obj:`~.cudaChannelFormatKind` is one of + :py:obj:`~.cudaChannelFormatKindSigned`, + :py:obj:`~.cudaChannelFormatKindUnsigned`, or + :py:obj:`~.cudaChannelFormatKindFloat`. - The offset and size have to be suitably aligned to match the - requirements of the external API. Mapping two buffers whose ranges - overlap may or may not result in the same virtual address being - returned for the overlapped portion. In such cases, the application - must ensure that all accesses to that region from the GPU are volatile. - Otherwise writes made via one address are not guaranteed to be visible - via the other address, even if they're issued by the same thread. It is - recommended that applications map the combined range instead of mapping - separate buffers and then apply the appropriate offsets to the returned - pointer to derive the individual buffers. + The `flags` parameter enables different options to be specified that + affect the allocation, as follows. - The returned pointer `devPtr` must be freed using :py:obj:`~.cudaFree`. + - :py:obj:`~.cudaArrayDefault`: This flag's value is defined to be 0 + and provides default array allocation + + - :py:obj:`~.cudaArraySurfaceLoadStore`: Allocates an array that can be + read from or written to using a surface reference + + - :py:obj:`~.cudaArrayTextureGather`: This flag indicates that texture + gather operations will be performed on the array. + + - :py:obj:`~.cudaArraySparse`: Allocates a CUDA array without physical + backing memory. The subregions within this sparse array can later be + mapped onto a physical memory allocation by calling + :py:obj:`~.cuMemMapArrayAsync`. The physical backing memory must be + allocated via :py:obj:`~.cuMemCreate`. + + - :py:obj:`~.cudaArrayDeferredMapping`: Allocates a CUDA array without + physical backing memory. The entire array can later be mapped onto a + physical memory allocation by calling :py:obj:`~.cuMemMapArrayAsync`. + The physical backing memory must be allocated via + :py:obj:`~.cuMemCreate`. + + `width` and `height` must meet certain size requirements. See + :py:obj:`~.cudaMalloc3DArray()` for more details. Parameters ---------- - extMem : :py:obj:`~.cudaExternalMemory_t` - Handle to external memory object - bufferDesc : :py:obj:`~.cudaExternalMemoryBufferDesc` - Buffer descriptor + desc : :py:obj:`~.cudaChannelFormatDesc` + Requested channel format + width : size_t + Requested array allocation width + height : size_t + Requested array allocation height + flags : unsigned int + Requested properties of allocated array Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle` - devPtr : Any - Returned device pointer to buffer + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorMemoryAllocation` + array : :py:obj:`~.cudaArray_t` + Pointer to allocated array in device memory See Also -------- - :py:obj:`~.cudaImportExternalMemory`, :py:obj:`~.cudaDestroyExternalMemory`, :py:obj:`~.cudaExternalMemoryGetMappedMipmappedArray` + :py:obj:`~.cudaMalloc`, :py:obj:`~.cudaMallocPitch`, :py:obj:`~.cudaFree`, :py:obj:`~.cudaFreeArray`, :py:obj:`~.cudaMallocHost (C API)`, :py:obj:`~.cudaFreeHost`, :py:obj:`~.cudaMalloc3D`, :py:obj:`~.cudaMalloc3DArray`, :py:obj:`~.cudaHostAlloc`, :py:obj:`~.cuArrayCreate` """ - cdef ccudart.cudaExternalMemory_t cextMem - if extMem is None: - cextMem = 0 - elif isinstance(extMem, (cudaExternalMemory_t,)): - pextMem = int(extMem) - cextMem = pextMem - else: - pextMem = int(cudaExternalMemory_t(extMem)) - cextMem = pextMem - cdef void_ptr devPtr = 0 - cdef ccudart.cudaExternalMemoryBufferDesc* cbufferDesc_ptr = bufferDesc._ptr if bufferDesc != None else NULL - err = ccudart.cudaExternalMemoryGetMappedBuffer(&devPtr, cextMem, cbufferDesc_ptr) - return (cudaError_t(err), devPtr) -{{endif}} - -{{if 'cudaExternalMemoryGetMappedMipmappedArray' in found_functions}} + cdef cudaArray_t array = cudaArray_t() + cdef cyruntime.cudaChannelFormatDesc* cydesc_ptr = desc._pvt_ptr if desc is not None else NULL + with nogil: + err = cyruntime.cudaMallocArray(array._pvt_ptr, cydesc_ptr, width, height, flags) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, array) @cython.embedsignature(True) -def cudaExternalMemoryGetMappedMipmappedArray(extMem, mipmapDesc : Optional[cudaExternalMemoryMipmappedArrayDesc]): - """ Maps a CUDA mipmapped array onto an external memory object. - - Maps a CUDA mipmapped array onto an external object and returns a - handle to it in `mipmap`. +def cudaFree(devPtr): + """ Frees memory on the device. - The properties of the CUDA mipmapped array being mapped must be - described in `mipmapDesc`. The structure - :py:obj:`~.cudaExternalMemoryMipmappedArrayDesc` is defined as follows: + Frees the memory space pointed to by `devPtr`, which must have been + returned by a previous call to one of the following memory allocation + APIs - :py:obj:`~.cudaMalloc()`, :py:obj:`~.cudaMallocPitch()`, + :py:obj:`~.cudaMallocManaged()`, :py:obj:`~.cudaMallocAsync()`, + :py:obj:`~.cudaMallocFromPoolAsync()`. - **View CUDA Toolkit Documentation for a C++ code example** + Note - This API will not perform any implicit synchronization when the + pointer was allocated with :py:obj:`~.cudaMallocAsync` or + :py:obj:`~.cudaMallocFromPoolAsync`. Callers must ensure that all + accesses to these pointer have completed before invoking + :py:obj:`~.cudaFree`. For best performance and memory reuse, users + should use :py:obj:`~.cudaFreeAsync` to free memory allocated via the + stream ordered memory allocator. For all other pointers, this API may + perform implicit synchronization. - where :py:obj:`~.cudaExternalMemoryMipmappedArrayDesc.offset` is the - offset in the memory object where the base level of the mipmap chain - is. :py:obj:`~.cudaExternalMemoryMipmappedArrayDesc.formatDesc` - describes the format of the data. - :py:obj:`~.cudaExternalMemoryMipmappedArrayDesc.extent` specifies the - dimensions of the base level of the mipmap chain. - :py:obj:`~.cudaExternalMemoryMipmappedArrayDesc.flags` are flags - associated with CUDA mipmapped arrays. For further details, please - refer to the documentation for :py:obj:`~.cudaMalloc3DArray`. Note that - if the mipmapped array is bound as a color target in the graphics API, - then the flag :py:obj:`~.cudaArrayColorAttachment` must be specified in - :py:obj:`~.cudaExternalMemoryMipmappedArrayDesc.flags`. - :py:obj:`~.cudaExternalMemoryMipmappedArrayDesc.numLevels` specifies - the total number of levels in the mipmap chain. + If :py:obj:`~.cudaFree`(`devPtr`) has already been called before, an + error is returned. If `devPtr` is 0, no operation is performed. + :py:obj:`~.cudaFree()` returns :py:obj:`~.cudaErrorValue` in case of + failure. - The returned CUDA mipmapped array must be freed using - :py:obj:`~.cudaFreeMipmappedArray`. + The device version of :py:obj:`~.cudaFree` cannot be used with a + `*devPtr` allocated using the host API, and vice versa. Parameters ---------- - extMem : :py:obj:`~.cudaExternalMemory_t` - Handle to external memory object - mipmapDesc : :py:obj:`~.cudaExternalMemoryMipmappedArrayDesc` - CUDA array descriptor + devPtr : Any + Device pointer to memory to free Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle` - mipmap : :py:obj:`~.cudaMipmappedArray_t` - Returned CUDA mipmapped array + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` See Also -------- - :py:obj:`~.cudaImportExternalMemory`, :py:obj:`~.cudaDestroyExternalMemory`, :py:obj:`~.cudaExternalMemoryGetMappedBuffer` - - Notes - ----- - If :py:obj:`~.cudaExternalMemoryHandleDesc.type` is :py:obj:`~.cudaExternalMemoryHandleTypeNvSciBuf`, then :py:obj:`~.cudaExternalMemoryMipmappedArrayDesc.numLevels` must not be greater than 1. + :py:obj:`~.cudaMalloc`, :py:obj:`~.cudaMallocPitch`, :py:obj:`~.cudaMallocManaged`, :py:obj:`~.cudaMallocArray`, :py:obj:`~.cudaFreeArray`, :py:obj:`~.cudaMallocAsync`, :py:obj:`~.cudaMallocFromPoolAsync` :py:obj:`~.cudaMallocHost (C API)`, :py:obj:`~.cudaFreeHost`, :py:obj:`~.cudaMalloc3D`, :py:obj:`~.cudaMalloc3DArray`, :py:obj:`~.cudaFreeAsync` :py:obj:`~.cudaHostAlloc`, :py:obj:`~.cuMemFree` """ - cdef ccudart.cudaExternalMemory_t cextMem - if extMem is None: - cextMem = 0 - elif isinstance(extMem, (cudaExternalMemory_t,)): - pextMem = int(extMem) - cextMem = pextMem - else: - pextMem = int(cudaExternalMemory_t(extMem)) - cextMem = pextMem - cdef cudaMipmappedArray_t mipmap = cudaMipmappedArray_t() - cdef ccudart.cudaExternalMemoryMipmappedArrayDesc* cmipmapDesc_ptr = mipmapDesc._ptr if mipmapDesc != None else NULL - err = ccudart.cudaExternalMemoryGetMappedMipmappedArray(mipmap._ptr, cextMem, cmipmapDesc_ptr) - return (cudaError_t(err), mipmap) -{{endif}} - -{{if 'cudaDestroyExternalMemory' in found_functions}} + cdef _HelperInputVoidPtrStruct cydevPtrHelper + cdef void* cydevPtr = _helper_input_void_ptr(devPtr, &cydevPtrHelper) + with nogil: + err = cyruntime.cudaFree(cydevPtr) + _helper_input_void_ptr_free(&cydevPtrHelper) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaDestroyExternalMemory(extMem): - """ Destroys an external memory object. +def cudaFreeHost(ptr): + """ Frees page-locked memory. - Destroys the specified external memory object. Any existing buffers and - CUDA mipmapped arrays mapped onto this object must no longer be used - and must be explicitly freed using :py:obj:`~.cudaFree` and - :py:obj:`~.cudaFreeMipmappedArray` respectively. + Frees the memory space pointed to by `hostPtr`, which must have been + returned by a previous call to :py:obj:`~.cudaMallocHost()` or + :py:obj:`~.cudaHostAlloc()`. Parameters ---------- - extMem : :py:obj:`~.cudaExternalMemory_t` - External memory object to be destroyed + ptr : Any + Pointer to memory to free Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidResourceHandle` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` See Also -------- - :py:obj:`~.cudaImportExternalMemory`, :py:obj:`~.cudaExternalMemoryGetMappedBuffer`, :py:obj:`~.cudaExternalMemoryGetMappedMipmappedArray` + :py:obj:`~.cudaMalloc`, :py:obj:`~.cudaMallocPitch`, :py:obj:`~.cudaFree`, :py:obj:`~.cudaMallocArray`, :py:obj:`~.cudaFreeArray`, :py:obj:`~.cudaMallocHost (C API)`, :py:obj:`~.cudaMalloc3D`, :py:obj:`~.cudaMalloc3DArray`, :py:obj:`~.cudaHostAlloc`, :py:obj:`~.cuMemFreeHost` """ - cdef ccudart.cudaExternalMemory_t cextMem - if extMem is None: - cextMem = 0 - elif isinstance(extMem, (cudaExternalMemory_t,)): - pextMem = int(extMem) - cextMem = pextMem - else: - pextMem = int(cudaExternalMemory_t(extMem)) - cextMem = pextMem - err = ccudart.cudaDestroyExternalMemory(cextMem) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaImportExternalSemaphore' in found_functions}} + cdef _HelperInputVoidPtrStruct cyptrHelper + cdef void* cyptr = _helper_input_void_ptr(ptr, &cyptrHelper) + with nogil: + err = cyruntime.cudaFreeHost(cyptr) + _helper_input_void_ptr_free(&cyptrHelper) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaImportExternalSemaphore(semHandleDesc : Optional[cudaExternalSemaphoreHandleDesc]): - """ Imports an external semaphore. - - Imports an externally allocated synchronization object and returns a - handle to that in `extSem_out`. - - The properties of the handle being imported must be described in - `semHandleDesc`. The :py:obj:`~.cudaExternalSemaphoreHandleDesc` is - defined as follows: - - **View CUDA Toolkit Documentation for a C++ code example** - - where :py:obj:`~.cudaExternalSemaphoreHandleDesc.type` specifies the - type of handle being imported. - :py:obj:`~.cudaExternalSemaphoreHandleType` is defined as: - - **View CUDA Toolkit Documentation for a C++ code example** - - If :py:obj:`~.cudaExternalSemaphoreHandleDesc.type` is - :py:obj:`~.cudaExternalSemaphoreHandleTypeOpaqueFd`, then - :py:obj:`~.cudaExternalSemaphoreHandleDesc`::handle::fd must be a valid - file descriptor referencing a synchronization object. Ownership of the - file descriptor is transferred to the CUDA driver when the handle is - imported successfully. Performing any operations on the file descriptor - after it is imported results in undefined behavior. - - If :py:obj:`~.cudaExternalSemaphoreHandleDesc.type` is - :py:obj:`~.cudaExternalSemaphoreHandleTypeOpaqueWin32`, then exactly - one of - :py:obj:`~.cudaExternalSemaphoreHandleDesc`::handle::win32::handle and - :py:obj:`~.cudaExternalSemaphoreHandleDesc`::handle::win32::name must - not be NULL. If - :py:obj:`~.cudaExternalSemaphoreHandleDesc`::handle::win32::handle is - not NULL, then it must represent a valid shared NT handle that - references a synchronization object. Ownership of this handle is not - transferred to CUDA after the import operation, so the application must - release the handle using the appropriate system call. If - :py:obj:`~.cudaExternalSemaphoreHandleDesc`::handle::win32::name is not - NULL, then it must name a valid synchronization object. - - If :py:obj:`~.cudaExternalSemaphoreHandleDesc.type` is - :py:obj:`~.cudaExternalSemaphoreHandleTypeOpaqueWin32Kmt`, then - :py:obj:`~.cudaExternalSemaphoreHandleDesc`::handle::win32::handle must - be non-NULL and - :py:obj:`~.cudaExternalSemaphoreHandleDesc`::handle::win32::name must - be NULL. The handle specified must be a globally shared KMT handle. - This handle does not hold a reference to the underlying object, and - thus will be invalid when all references to the synchronization object - are destroyed. - - If :py:obj:`~.cudaExternalSemaphoreHandleDesc.type` is - :py:obj:`~.cudaExternalSemaphoreHandleTypeD3D12Fence`, then exactly one - of :py:obj:`~.cudaExternalSemaphoreHandleDesc`::handle::win32::handle - and :py:obj:`~.cudaExternalSemaphoreHandleDesc`::handle::win32::name - must not be NULL. If - :py:obj:`~.cudaExternalSemaphoreHandleDesc`::handle::win32::handle is - not NULL, then it must represent a valid shared NT handle that is - returned by ID3D12Device::CreateSharedHandle when referring to a - ID3D12Fence object. This handle holds a reference to the underlying - object. If - :py:obj:`~.cudaExternalSemaphoreHandleDesc`::handle::win32::name is not - NULL, then it must name a valid synchronization object that refers to a - valid ID3D12Fence object. +def cudaFreeArray(array): + """ Frees an array on the device. - If :py:obj:`~.cudaExternalSemaphoreHandleDesc.type` is - :py:obj:`~.cudaExternalSemaphoreHandleTypeD3D11Fence`, then exactly one - of :py:obj:`~.cudaExternalSemaphoreHandleDesc`::handle::win32::handle - and :py:obj:`~.cudaExternalSemaphoreHandleDesc`::handle::win32::name - must not be NULL. If - :py:obj:`~.cudaExternalSemaphoreHandleDesc`::handle::win32::handle is - not NULL, then it must represent a valid shared NT handle that is - returned by ID3D11Fence::CreateSharedHandle. If - :py:obj:`~.cudaExternalSemaphoreHandleDesc`::handle::win32::name is not - NULL, then it must name a valid synchronization object that refers to a - valid ID3D11Fence object. + Frees the CUDA array `array`, which must have been returned by a + previous call to :py:obj:`~.cudaMallocArray()`. If `devPtr` is 0, no + operation is performed. - If :py:obj:`~.cudaExternalSemaphoreHandleDesc.type` is - :py:obj:`~.cudaExternalSemaphoreHandleTypeNvSciSync`, then - :py:obj:`~.cudaExternalSemaphoreHandleDesc`::handle::nvSciSyncObj - represents a valid NvSciSyncObj. + Parameters + ---------- + array : :py:obj:`~.cudaArray_t` + Pointer to array to free - :py:obj:`~.cudaExternalSemaphoreHandleTypeKeyedMutex`, then exactly one - of :py:obj:`~.cudaExternalSemaphoreHandleDesc`::handle::win32::handle - and :py:obj:`~.cudaExternalSemaphoreHandleDesc`::handle::win32::name - must not be NULL. If - :py:obj:`~.cudaExternalSemaphoreHandleDesc`::handle::win32::handle is - not NULL, then it represent a valid shared NT handle that is returned - by IDXGIResource1::CreateSharedHandle when referring to a - IDXGIKeyedMutex object. + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` - If :py:obj:`~.cudaExternalSemaphoreHandleDesc.type` is - :py:obj:`~.cudaExternalSemaphoreHandleTypeKeyedMutexKmt`, then - :py:obj:`~.cudaExternalSemaphoreHandleDesc`::handle::win32::handle must - be non-NULL and - :py:obj:`~.cudaExternalSemaphoreHandleDesc`::handle::win32::name must - be NULL. The handle specified must represent a valid KMT handle that is - returned by IDXGIResource::GetSharedHandle when referring to a - IDXGIKeyedMutex object. + See Also + -------- + :py:obj:`~.cudaMalloc`, :py:obj:`~.cudaMallocPitch`, :py:obj:`~.cudaFree`, :py:obj:`~.cudaMallocArray`, :py:obj:`~.cudaMallocHost (C API)`, :py:obj:`~.cudaFreeHost`, :py:obj:`~.cudaHostAlloc`, :py:obj:`~.cuArrayDestroy` + """ + cdef cyruntime.cudaArray_t cyarray + if array is None: + parray = 0 + elif isinstance(array, (cudaArray_t,)): + parray = int(array) + else: + parray = int(cudaArray_t(array)) + cyarray = parray + with nogil: + err = cyruntime.cudaFreeArray(cyarray) + return (_cudaError_t(err),) - If :py:obj:`~.cudaExternalSemaphoreHandleDesc.type` is - :py:obj:`~.cudaExternalSemaphoreHandleTypeTimelineSemaphoreFd`, then - :py:obj:`~.cudaExternalSemaphoreHandleDesc`::handle::fd must be a valid - file descriptor referencing a synchronization object. Ownership of the - file descriptor is transferred to the CUDA driver when the handle is - imported successfully. Performing any operations on the file descriptor - after it is imported results in undefined behavior. +@cython.embedsignature(True) +def cudaFreeMipmappedArray(mipmappedArray): + """ Frees a mipmapped array on the device. - If :py:obj:`~.cudaExternalSemaphoreHandleDesc.type` is - :py:obj:`~.cudaExternalSemaphoreHandleTypeTimelineSemaphoreWin32`, then - exactly one of - :py:obj:`~.cudaExternalSemaphoreHandleDesc`::handle::win32::handle and - :py:obj:`~.cudaExternalSemaphoreHandleDesc`::handle::win32::name must - not be NULL. If - :py:obj:`~.cudaExternalSemaphoreHandleDesc`::handle::win32::handle is - not NULL, then it must represent a valid shared NT handle that - references a synchronization object. Ownership of this handle is not - transferred to CUDA after the import operation, so the application must - release the handle using the appropriate system call. If - :py:obj:`~.cudaExternalSemaphoreHandleDesc`::handle::win32::name is not - NULL, then it must name a valid synchronization object. + Frees the CUDA mipmapped array `mipmappedArray`, which must have been + returned by a previous call to :py:obj:`~.cudaMallocMipmappedArray()`. + If `devPtr` is 0, no operation is performed. Parameters ---------- - semHandleDesc : :py:obj:`~.cudaExternalSemaphoreHandleDesc` - Semaphore import handle descriptor + mipmappedArray : :py:obj:`~.cudaMipmappedArray_t` + Pointer to mipmapped array to free Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorOperatingSystem` - extSem_out : :py:obj:`~.cudaExternalSemaphore_t` - Returned handle to an external semaphore + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` See Also -------- - :py:obj:`~.cudaDestroyExternalSemaphore`, :py:obj:`~.cudaSignalExternalSemaphoresAsync`, :py:obj:`~.cudaWaitExternalSemaphoresAsync` + :py:obj:`~.cudaMalloc`, :py:obj:`~.cudaMallocPitch`, :py:obj:`~.cudaFree`, :py:obj:`~.cudaMallocArray`, :py:obj:`~.cudaMallocHost (C API)`, :py:obj:`~.cudaFreeHost`, :py:obj:`~.cudaHostAlloc`, :py:obj:`~.cuMipmappedArrayDestroy` """ - cdef cudaExternalSemaphore_t extSem_out = cudaExternalSemaphore_t() - cdef ccudart.cudaExternalSemaphoreHandleDesc* csemHandleDesc_ptr = semHandleDesc._ptr if semHandleDesc != None else NULL - err = ccudart.cudaImportExternalSemaphore(extSem_out._ptr, csemHandleDesc_ptr) - return (cudaError_t(err), extSem_out) -{{endif}} - -{{if 'cudaSignalExternalSemaphoresAsync_v2' in found_functions}} + cdef cyruntime.cudaMipmappedArray_t cymipmappedArray + if mipmappedArray is None: + pmipmappedArray = 0 + elif isinstance(mipmappedArray, (cudaMipmappedArray_t,)): + pmipmappedArray = int(mipmappedArray) + else: + pmipmappedArray = int(cudaMipmappedArray_t(mipmappedArray)) + cymipmappedArray = pmipmappedArray + with nogil: + err = cyruntime.cudaFreeMipmappedArray(cymipmappedArray) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaSignalExternalSemaphoresAsync(extSemArray : Optional[List[cudaExternalSemaphore_t]], paramsArray : Optional[List[cudaExternalSemaphoreSignalParams]], unsigned int numExtSems, stream): - """ Signals a set of external semaphore objects. +def cudaHostAlloc(size_t size, unsigned int flags): + """ Allocates page-locked memory on the host. - Enqueues a signal operation on a set of externally allocated semaphore - object in the specified stream. The operations will be executed when - all prior operations in the stream complete. + Allocates `size` bytes of host memory that is page-locked and + accessible to the device. The driver tracks the virtual memory ranges + allocated with this function and automatically accelerates calls to + functions such as :py:obj:`~.cudaMemcpy()`. Since the memory can be + accessed directly by the device, it can be read or written with much + higher bandwidth than pageable memory obtained with functions such as + :py:obj:`~.malloc()`. Allocating excessive amounts of pinned memory may + degrade system performance, since it reduces the amount of memory + available to the system for paging. As a result, this function is best + used sparingly to allocate staging areas for data exchange between host + and device. - The exact semantics of signaling a semaphore depends on the type of the - object. + The `flags` parameter enables different options to be specified that + affect the allocation, as follows. - If the semaphore object is any one of the following types: - :py:obj:`~.cudaExternalSemaphoreHandleTypeOpaqueFd`, - :py:obj:`~.cudaExternalSemaphoreHandleTypeOpaqueWin32`, - :py:obj:`~.cudaExternalSemaphoreHandleTypeOpaqueWin32Kmt` then - signaling the semaphore will set it to the signaled state. + - :py:obj:`~.cudaHostAllocDefault`: This flag's value is defined to be + 0 and causes :py:obj:`~.cudaHostAlloc()` to emulate + :py:obj:`~.cudaMallocHost()`. - If the semaphore object is any one of the following types: - :py:obj:`~.cudaExternalSemaphoreHandleTypeD3D12Fence`, - :py:obj:`~.cudaExternalSemaphoreHandleTypeD3D11Fence`, - :py:obj:`~.cudaExternalSemaphoreHandleTypeTimelineSemaphoreFd`, - :py:obj:`~.cudaExternalSemaphoreHandleTypeTimelineSemaphoreWin32` then - the semaphore will be set to the value specified in - :py:obj:`~.cudaExternalSemaphoreSignalParams`::params::fence::value. + - :py:obj:`~.cudaHostAllocPortable`: The memory returned by this call + will be considered as pinned memory by all CUDA contexts, not just + the one that performed the allocation. - If the semaphore object is of the type - :py:obj:`~.cudaExternalSemaphoreHandleTypeNvSciSync` this API sets - :py:obj:`~.cudaExternalSemaphoreSignalParams`::params::nvSciSync::fence - to a value that can be used by subsequent waiters of the same NvSciSync - object to order operations with those currently submitted in `stream`. - Such an update will overwrite previous contents of - :py:obj:`~.cudaExternalSemaphoreSignalParams`::params::nvSciSync::fence. - By default, signaling such an external semaphore object causes - appropriate memory synchronization operations to be performed over all - the external memory objects that are imported as - :py:obj:`~.cudaExternalMemoryHandleTypeNvSciBuf`. This ensures that any - subsequent accesses made by other importers of the same set of NvSciBuf - memory object(s) are coherent. These operations can be skipped by - specifying the flag - :py:obj:`~.cudaExternalSemaphoreSignalSkipNvSciBufMemSync`, which can - be used as a performance optimization when data coherency is not - required. But specifying this flag in scenarios where data coherency is - required results in undefined behavior. Also, for semaphore object of - the type :py:obj:`~.cudaExternalSemaphoreHandleTypeNvSciSync`, if the - NvSciSyncAttrList used to create the NvSciSyncObj had not set the flags - in :py:obj:`~.cudaDeviceGetNvSciSyncAttributes` to - cudaNvSciSyncAttrSignal, this API will return cudaErrorNotSupported. + - :py:obj:`~.cudaHostAllocMapped`: Maps the allocation into the CUDA + address space. The device pointer to the memory may be obtained by + calling :py:obj:`~.cudaHostGetDevicePointer()`. - :py:obj:`~.cudaExternalSemaphoreSignalParams`::params::nvSciSync::fence - associated with semaphore object of the type - :py:obj:`~.cudaExternalSemaphoreHandleTypeNvSciSync` can be - deterministic. For this the NvSciSyncAttrList used to create the - semaphore object must have value of - NvSciSyncAttrKey_RequireDeterministicFences key set to true. - Deterministic fences allow users to enqueue a wait over the semaphore - object even before corresponding signal is enqueued. For such a - semaphore object, CUDA guarantees that each signal operation will - increment the fence value by '1'. Users are expected to track count of - signals enqueued on the semaphore object and insert waits accordingly. - When such a semaphore object is signaled from multiple streams, due to - concurrent stream execution, it is possible that the order in which the - semaphore gets signaled is indeterministic. This could lead to waiters - of the semaphore getting unblocked incorrectly. Users are expected to - handle such situations, either by not using the same semaphore object - with deterministic fence support enabled in different streams or by - adding explicit dependency amongst such streams so that the semaphore - is signaled in order. + - :py:obj:`~.cudaHostAllocWriteCombined`: Allocates the memory as + write-combined (WC). WC memory can be transferred across the PCI + Express bus more quickly on some system configurations, but cannot be + read efficiently by most CPUs. WC memory is a good option for buffers + that will be written by the CPU and read by the device via mapped + pinned memory or host->device transfers. + + All of these flags are orthogonal to one another: a developer may + allocate memory that is portable, mapped and/or write-combined with no + restrictions. + + In order for the :py:obj:`~.cudaHostAllocMapped` flag to have any + effect, the CUDA context must support the :py:obj:`~.cudaDeviceMapHost` + flag, which can be checked via :py:obj:`~.cudaGetDeviceFlags()`. The + :py:obj:`~.cudaDeviceMapHost` flag is implicitly set for contexts + created via the runtime API. - If the semaphore object is any one of the following types: - :py:obj:`~.cudaExternalSemaphoreHandleTypeKeyedMutex`, - :py:obj:`~.cudaExternalSemaphoreHandleTypeKeyedMutexKmt`, then the - keyed mutex will be released with the key specified in - :py:obj:`~.cudaExternalSemaphoreSignalParams`::params::keyedmutex::key. + The :py:obj:`~.cudaHostAllocMapped` flag may be specified on CUDA + contexts for devices that do not support mapped pinned memory. The + failure is deferred to :py:obj:`~.cudaHostGetDevicePointer()` because + the memory may be mapped into other CUDA contexts via the + :py:obj:`~.cudaHostAllocPortable` flag. + + Memory allocated by this function must be freed with + :py:obj:`~.cudaFreeHost()`. Parameters ---------- - extSemArray : List[:py:obj:`~.cudaExternalSemaphore_t`] - Set of external semaphores to be signaled - paramsArray : List[:py:obj:`~.cudaExternalSemaphoreSignalParams`] - Array of semaphore parameters - numExtSems : unsigned int - Number of semaphores to signal - stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` - Stream to enqueue the signal operations in + size : size_t + Requested allocation size in bytes + flags : unsigned int + Requested properties of allocated memory Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidResourceHandle` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorMemoryAllocation`, :py:obj:`~.cudaErrorExternalDevice` + pHost : Any + Device pointer to allocated memory See Also -------- - :py:obj:`~.cudaImportExternalSemaphore`, :py:obj:`~.cudaDestroyExternalSemaphore`, :py:obj:`~.cudaWaitExternalSemaphoresAsync` + :py:obj:`~.cudaSetDeviceFlags`, :py:obj:`~.cudaMallocHost (C API)`, :py:obj:`~.cudaFreeHost`, :py:obj:`~.cudaGetDeviceFlags`, :py:obj:`~.cuMemHostAlloc` """ - cdef ccudart.cudaStream_t cstream - if stream is None: - cstream = 0 - elif isinstance(stream, (cudaStream_t,cuda.CUstream)): - pstream = int(stream) - cstream = pstream - else: - pstream = int(cudaStream_t(stream)) - cstream = pstream - paramsArray = [] if paramsArray is None else paramsArray - if not all(isinstance(_x, (cudaExternalSemaphoreSignalParams,)) for _x in paramsArray): - raise TypeError("Argument 'paramsArray' is not instance of type (expected List[ccudart.cudaExternalSemaphoreSignalParams,]") - extSemArray = [] if extSemArray is None else extSemArray - if not all(isinstance(_x, (cudaExternalSemaphore_t,)) for _x in extSemArray): - raise TypeError("Argument 'extSemArray' is not instance of type (expected List[ccudart.cudaExternalSemaphore_t,]") - cdef ccudart.cudaExternalSemaphore_t* cextSemArray = NULL - if len(extSemArray) > 0: - cextSemArray = calloc(len(extSemArray), sizeof(ccudart.cudaExternalSemaphore_t)) - if cextSemArray is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(extSemArray)) + 'x' + str(sizeof(ccudart.cudaExternalSemaphore_t))) - else: - for idx in range(len(extSemArray)): - cextSemArray[idx] = (extSemArray[idx])._ptr[0] - cdef ccudart.cudaExternalSemaphoreSignalParams* cparamsArray = NULL - if len(paramsArray) > 0: - cparamsArray = calloc(len(paramsArray), sizeof(ccudart.cudaExternalSemaphoreSignalParams)) - if cparamsArray is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(paramsArray)) + 'x' + str(sizeof(ccudart.cudaExternalSemaphoreSignalParams))) - for idx in range(len(paramsArray)): - string.memcpy(&cparamsArray[idx], (paramsArray[idx])._ptr, sizeof(ccudart.cudaExternalSemaphoreSignalParams)) - if numExtSems > len(extSemArray): raise RuntimeError("List is too small: " + str(len(extSemArray)) + " < " + str(numExtSems)) - if numExtSems > len(paramsArray): raise RuntimeError("List is too small: " + str(len(paramsArray)) + " < " + str(numExtSems)) - err = ccudart.cudaSignalExternalSemaphoresAsync((extSemArray[0])._ptr if len(extSemArray) == 1 else cextSemArray, (paramsArray[0])._ptr if len(paramsArray) == 1 else cparamsArray, numExtSems, cstream) - if cextSemArray is not NULL: - free(cextSemArray) - if cparamsArray is not NULL: - free(cparamsArray) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaWaitExternalSemaphoresAsync_v2' in found_functions}} + cdef void_ptr pHost = 0 + with nogil: + err = cyruntime.cudaHostAlloc(&pHost, size, flags) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, pHost) @cython.embedsignature(True) -def cudaWaitExternalSemaphoresAsync(extSemArray : Optional[List[cudaExternalSemaphore_t]], paramsArray : Optional[List[cudaExternalSemaphoreWaitParams]], unsigned int numExtSems, stream): - """ Waits on a set of external semaphore objects. +def cudaHostRegister(ptr, size_t size, unsigned int flags): + """ Registers an existing host memory range for use by CUDA. - Enqueues a wait operation on a set of externally allocated semaphore - object in the specified stream. The operations will be executed when - all prior operations in the stream complete. + Page-locks the memory range specified by `ptr` and `size` and maps it + for the device(s) as specified by `flags`. This memory range also is + added to the same tracking mechanism as :py:obj:`~.cudaHostAlloc()` to + automatically accelerate calls to functions such as + :py:obj:`~.cudaMemcpy()`. Since the memory can be accessed directly by + the device, it can be read or written with much higher bandwidth than + pageable memory that has not been registered. Page-locking excessive + amounts of memory may degrade system performance, since it reduces the + amount of memory available to the system for paging. As a result, this + function is best used sparingly to register staging areas for data + exchange between host and device. - The exact semantics of waiting on a semaphore depends on the type of - the object. + On systems where :py:obj:`~.pageableMemoryAccessUsesHostPageTables` is + true, :py:obj:`~.cudaHostRegister` will not page-lock the memory range + specified by `ptr` but only populate unpopulated pages. - If the semaphore object is any one of the following types: - :py:obj:`~.cudaExternalSemaphoreHandleTypeOpaqueFd`, - :py:obj:`~.cudaExternalSemaphoreHandleTypeOpaqueWin32`, - :py:obj:`~.cudaExternalSemaphoreHandleTypeOpaqueWin32Kmt` then waiting - on the semaphore will wait until the semaphore reaches the signaled - state. The semaphore will then be reset to the unsignaled state. - Therefore for every signal operation, there can only be one wait - operation. + :py:obj:`~.cudaHostRegister` is supported only on I/O coherent devices + that have a non-zero value for the device attribute + :py:obj:`~.cudaDevAttrHostRegisterSupported`. - If the semaphore object is any one of the following types: - :py:obj:`~.cudaExternalSemaphoreHandleTypeD3D12Fence`, - :py:obj:`~.cudaExternalSemaphoreHandleTypeD3D11Fence`, - :py:obj:`~.cudaExternalSemaphoreHandleTypeTimelineSemaphoreFd`, - :py:obj:`~.cudaExternalSemaphoreHandleTypeTimelineSemaphoreWin32` then - waiting on the semaphore will wait until the value of the semaphore is - greater than or equal to - :py:obj:`~.cudaExternalSemaphoreWaitParams`::params::fence::value. + The `flags` parameter enables different options to be specified that + affect the allocation, as follows. - If the semaphore object is of the type - :py:obj:`~.cudaExternalSemaphoreHandleTypeNvSciSync` then, waiting on - the semaphore will wait until the - :py:obj:`~.cudaExternalSemaphoreSignalParams`::params::nvSciSync::fence - is signaled by the signaler of the NvSciSyncObj that was associated - with this semaphore object. By default, waiting on such an external - semaphore object causes appropriate memory synchronization operations - to be performed over all external memory objects that are imported as - :py:obj:`~.cudaExternalMemoryHandleTypeNvSciBuf`. This ensures that any - subsequent accesses made by other importers of the same set of NvSciBuf - memory object(s) are coherent. These operations can be skipped by - specifying the flag - :py:obj:`~.cudaExternalSemaphoreWaitSkipNvSciBufMemSync`, which can be - used as a performance optimization when data coherency is not required. - But specifying this flag in scenarios where data coherency is required - results in undefined behavior. Also, for semaphore object of the type - :py:obj:`~.cudaExternalSemaphoreHandleTypeNvSciSync`, if the - NvSciSyncAttrList used to create the NvSciSyncObj had not set the flags - in :py:obj:`~.cudaDeviceGetNvSciSyncAttributes` to - cudaNvSciSyncAttrWait, this API will return cudaErrorNotSupported. + - :py:obj:`~.cudaHostRegisterDefault`: On a system with unified virtual + addressing, the memory will be both mapped and portable. On a system + with no unified virtual addressing, the memory will be neither mapped + nor portable. - If the semaphore object is any one of the following types: - :py:obj:`~.cudaExternalSemaphoreHandleTypeKeyedMutex`, - :py:obj:`~.cudaExternalSemaphoreHandleTypeKeyedMutexKmt`, then the - keyed mutex will be acquired when it is released with the key specified - in - :py:obj:`~.cudaExternalSemaphoreSignalParams`::params::keyedmutex::key - or until the timeout specified by - :py:obj:`~.cudaExternalSemaphoreSignalParams`::params::keyedmutex::timeoutMs - has lapsed. The timeout interval can either be a finite value specified - in milliseconds or an infinite value. In case an infinite value is - specified the timeout never elapses. The windows INFINITE macro must be - used to specify infinite timeout + - :py:obj:`~.cudaHostRegisterPortable`: The memory returned by this + call will be considered as pinned memory by all CUDA contexts, not + just the one that performed the allocation. + + - :py:obj:`~.cudaHostRegisterMapped`: Maps the allocation into the CUDA + address space. The device pointer to the memory may be obtained by + calling :py:obj:`~.cudaHostGetDevicePointer()`. + + - :py:obj:`~.cudaHostRegisterIoMemory`: The passed memory pointer is + treated as pointing to some memory-mapped I/O space, e.g. belonging + to a third-party PCIe device, and it will marked as non cache- + coherent and contiguous. + + - :py:obj:`~.cudaHostRegisterReadOnly`: The passed memory pointer is + treated as pointing to memory that is considered read-only by the + device. On platforms without + :py:obj:`~.cudaDevAttrPageableMemoryAccessUsesHostPageTables`, this + flag is required in order to register memory mapped to the CPU as + read-only. Support for the use of this flag can be queried from the + device attribute + :py:obj:`~.cudaDevAttrHostRegisterReadOnlySupported`. Using this flag + with a current context associated with a device that does not have + this attribute set will cause :py:obj:`~.cudaHostRegister` to error + with cudaErrorNotSupported. + + All of these flags are orthogonal to one another: a developer may page- + lock memory that is portable or mapped with no restrictions. + + The CUDA context must have been created with the + :py:obj:`~.cudaMapHost` flag in order for the + :py:obj:`~.cudaHostRegisterMapped` flag to have any effect. + + The :py:obj:`~.cudaHostRegisterMapped` flag may be specified on CUDA + contexts for devices that do not support mapped pinned memory. The + failure is deferred to :py:obj:`~.cudaHostGetDevicePointer()` because + the memory may be mapped into other CUDA contexts via the + :py:obj:`~.cudaHostRegisterPortable` flag. + + For devices that have a non-zero value for the device attribute + :py:obj:`~.cudaDevAttrCanUseHostPointerForRegisteredMem`, the memory + can also be accessed from the device using the host pointer `ptr`. The + device pointer returned by :py:obj:`~.cudaHostGetDevicePointer()` may + or may not match the original host pointer `ptr` and depends on the + devices visible to the application. If all devices visible to the + application have a non-zero value for the device attribute, the device + pointer returned by :py:obj:`~.cudaHostGetDevicePointer()` will match + the original pointer `ptr`. If any device visible to the application + has a zero value for the device attribute, the device pointer returned + by :py:obj:`~.cudaHostGetDevicePointer()` will not match the original + host pointer `ptr`, but it will be suitable for use on all devices + provided Unified Virtual Addressing is enabled. In such systems, it is + valid to access the memory using either pointer on devices that have a + non-zero value for the device attribute. Note however that such devices + should access the memory using only of the two pointers and not both. + + The memory page-locked by this function must be unregistered with + :py:obj:`~.cudaHostUnregister()`. Parameters ---------- - extSemArray : List[:py:obj:`~.cudaExternalSemaphore_t`] - External semaphores to be waited on - paramsArray : List[:py:obj:`~.cudaExternalSemaphoreWaitParams`] - Array of semaphore parameters - numExtSems : unsigned int - Number of semaphores to wait on - stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` - Stream to enqueue the wait operations in + ptr : Any + Host pointer to memory to page-lock + size : size_t + Size in bytes of the address range to page-lock in bytes + flags : unsigned int + Flags for allocation request Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidResourceHandle` :py:obj:`~.cudaErrorTimeout` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorMemoryAllocation`, :py:obj:`~.cudaErrorHostMemoryAlreadyRegistered`, :py:obj:`~.cudaErrorNotSupported`, :py:obj:`~.cudaErrorExternalDevice` See Also -------- - :py:obj:`~.cudaImportExternalSemaphore`, :py:obj:`~.cudaDestroyExternalSemaphore`, :py:obj:`~.cudaSignalExternalSemaphoresAsync` + :py:obj:`~.cudaHostUnregister`, :py:obj:`~.cudaHostGetFlags`, :py:obj:`~.cudaHostGetDevicePointer`, :py:obj:`~.cuMemHostRegister` """ - cdef ccudart.cudaStream_t cstream - if stream is None: - cstream = 0 - elif isinstance(stream, (cudaStream_t,cuda.CUstream)): - pstream = int(stream) - cstream = pstream - else: - pstream = int(cudaStream_t(stream)) - cstream = pstream - paramsArray = [] if paramsArray is None else paramsArray - if not all(isinstance(_x, (cudaExternalSemaphoreWaitParams,)) for _x in paramsArray): - raise TypeError("Argument 'paramsArray' is not instance of type (expected List[ccudart.cudaExternalSemaphoreWaitParams,]") - extSemArray = [] if extSemArray is None else extSemArray - if not all(isinstance(_x, (cudaExternalSemaphore_t,)) for _x in extSemArray): - raise TypeError("Argument 'extSemArray' is not instance of type (expected List[ccudart.cudaExternalSemaphore_t,]") - cdef ccudart.cudaExternalSemaphore_t* cextSemArray = NULL - if len(extSemArray) > 0: - cextSemArray = calloc(len(extSemArray), sizeof(ccudart.cudaExternalSemaphore_t)) - if cextSemArray is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(extSemArray)) + 'x' + str(sizeof(ccudart.cudaExternalSemaphore_t))) - else: - for idx in range(len(extSemArray)): - cextSemArray[idx] = (extSemArray[idx])._ptr[0] - cdef ccudart.cudaExternalSemaphoreWaitParams* cparamsArray = NULL - if len(paramsArray) > 0: - cparamsArray = calloc(len(paramsArray), sizeof(ccudart.cudaExternalSemaphoreWaitParams)) - if cparamsArray is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(paramsArray)) + 'x' + str(sizeof(ccudart.cudaExternalSemaphoreWaitParams))) - for idx in range(len(paramsArray)): - string.memcpy(&cparamsArray[idx], (paramsArray[idx])._ptr, sizeof(ccudart.cudaExternalSemaphoreWaitParams)) - if numExtSems > len(extSemArray): raise RuntimeError("List is too small: " + str(len(extSemArray)) + " < " + str(numExtSems)) - if numExtSems > len(paramsArray): raise RuntimeError("List is too small: " + str(len(paramsArray)) + " < " + str(numExtSems)) - err = ccudart.cudaWaitExternalSemaphoresAsync((extSemArray[0])._ptr if len(extSemArray) == 1 else cextSemArray, (paramsArray[0])._ptr if len(paramsArray) == 1 else cparamsArray, numExtSems, cstream) - if cextSemArray is not NULL: - free(cextSemArray) - if cparamsArray is not NULL: - free(cparamsArray) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaDestroyExternalSemaphore' in found_functions}} + cdef _HelperInputVoidPtrStruct cyptrHelper + cdef void* cyptr = _helper_input_void_ptr(ptr, &cyptrHelper) + with nogil: + err = cyruntime.cudaHostRegister(cyptr, size, flags) + _helper_input_void_ptr_free(&cyptrHelper) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaDestroyExternalSemaphore(extSem): - """ Destroys an external semaphore. +def cudaHostUnregister(ptr): + """ Unregisters a memory range that was registered with cudaHostRegister. - Destroys an external semaphore object and releases any references to - the underlying resource. Any outstanding signals or waits must have - completed before the semaphore is destroyed. + Unmaps the memory range whose base address is specified by `ptr`, and + makes it pageable again. + + The base address must be the same one specified to + :py:obj:`~.cudaHostRegister()`. Parameters ---------- - extSem : :py:obj:`~.cudaExternalSemaphore_t` - External semaphore to be destroyed + ptr : Any + Host pointer to memory to unregister Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidResourceHandle` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorHostMemoryNotRegistered` See Also -------- - :py:obj:`~.cudaImportExternalSemaphore`, :py:obj:`~.cudaSignalExternalSemaphoresAsync`, :py:obj:`~.cudaWaitExternalSemaphoresAsync` + :py:obj:`~.cudaHostUnregister`, :py:obj:`~.cuMemHostUnregister` """ - cdef ccudart.cudaExternalSemaphore_t cextSem - if extSem is None: - cextSem = 0 - elif isinstance(extSem, (cudaExternalSemaphore_t,)): - pextSem = int(extSem) - cextSem = pextSem - else: - pextSem = int(cudaExternalSemaphore_t(extSem)) - cextSem = pextSem - err = ccudart.cudaDestroyExternalSemaphore(cextSem) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaFuncSetCacheConfig' in found_functions}} + cdef _HelperInputVoidPtrStruct cyptrHelper + cdef void* cyptr = _helper_input_void_ptr(ptr, &cyptrHelper) + with nogil: + err = cyruntime.cudaHostUnregister(cyptr) + _helper_input_void_ptr_free(&cyptrHelper) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaFuncSetCacheConfig(func, cacheConfig not None : cudaFuncCache): - """ Sets the preferred cache configuration for a device function. +def cudaHostGetDevicePointer(pHost, unsigned int flags): + """ Passes back device pointer of mapped host memory allocated by cudaHostAlloc or registered by cudaHostRegister. - On devices where the L1 cache and shared memory use the same hardware - resources, this sets through `cacheConfig` the preferred cache - configuration for the function specified via `func`. This is only a - preference. The runtime will use the requested configuration if - possible, but it is free to choose a different configuration if - required to execute `func`. + Passes back the device pointer corresponding to the mapped, pinned host + buffer allocated by :py:obj:`~.cudaHostAlloc()` or registered by + :py:obj:`~.cudaHostRegister()`. - `func` is a device function symbol and must be declared as a `None` - function. If the specified function does not exist, then - :py:obj:`~.cudaErrorInvalidDeviceFunction` is returned. For templated - functions, pass the function symbol as follows: - func_name + :py:obj:`~.cudaHostGetDevicePointer()` will fail if the + :py:obj:`~.cudaDeviceMapHost` flag was not specified before deferred + context creation occurred, or if called on a device that does not + support mapped, pinned memory. - This setting does nothing on devices where the size of the L1 cache and - shared memory are fixed. + For devices that have a non-zero value for the device attribute + :py:obj:`~.cudaDevAttrCanUseHostPointerForRegisteredMem`, the memory + can also be accessed from the device using the host pointer `pHost`. + The device pointer returned by :py:obj:`~.cudaHostGetDevicePointer()` + may or may not match the original host pointer `pHost` and depends on + the devices visible to the application. If all devices visible to the + application have a non-zero value for the device attribute, the device + pointer returned by :py:obj:`~.cudaHostGetDevicePointer()` will match + the original pointer `pHost`. If any device visible to the application + has a zero value for the device attribute, the device pointer returned + by :py:obj:`~.cudaHostGetDevicePointer()` will not match the original + host pointer `pHost`, but it will be suitable for use on all devices + provided Unified Virtual Addressing is enabled. In such systems, it is + valid to access the memory using either pointer on devices that have a + non-zero value for the device attribute. Note however that such devices + should access the memory using only of the two pointers and not both. - Launching a kernel with a different preference than the most recent - preference setting may insert a device-side synchronization point. + `flags` provides for future releases. For now, it must be set to 0. - The supported cache configurations are: + Parameters + ---------- + pHost : Any + Requested host pointer mapping + flags : unsigned int + Flags for extensions (must be 0 for now) - - :py:obj:`~.cudaFuncCachePreferNone`: no preference for shared memory - or L1 (default) + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorMemoryAllocation` + pDevice : Any + Returned device pointer for mapped memory - - :py:obj:`~.cudaFuncCachePreferShared`: prefer larger shared memory - and smaller L1 cache + See Also + -------- + :py:obj:`~.cudaSetDeviceFlags`, :py:obj:`~.cudaHostAlloc`, :py:obj:`~.cuMemHostGetDevicePointer` + """ + cdef void_ptr pDevice = 0 + cdef _HelperInputVoidPtrStruct cypHostHelper + cdef void* cypHost = _helper_input_void_ptr(pHost, &cypHostHelper) + with nogil: + err = cyruntime.cudaHostGetDevicePointer(&pDevice, cypHost, flags) + _helper_input_void_ptr_free(&cypHostHelper) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, pDevice) - - :py:obj:`~.cudaFuncCachePreferL1`: prefer larger L1 cache and smaller - shared memory +@cython.embedsignature(True) +def cudaHostGetFlags(pHost): + """ Passes back flags used to allocate pinned host memory allocated by cudaHostAlloc. - - :py:obj:`~.cudaFuncCachePreferEqual`: prefer equal size L1 cache and - shared memory + :py:obj:`~.cudaHostGetFlags()` will fail if the input pointer does not + reside in an address range allocated by :py:obj:`~.cudaHostAlloc()`. Parameters ---------- - func : Any - Device function symbol - cacheConfig : :py:obj:`~.cudaFuncCache` - Requested cache configuration + pHost : Any + Host pointer Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDeviceFunction`2 + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + pFlags : unsigned int + Returned flags word See Also -------- - cudaFuncSetCacheConfig (C++ API), :py:obj:`~.cudaFuncGetAttributes (C API)`, :py:obj:`~.cudaLaunchKernel (C API)`, :py:obj:`~.cuFuncSetCacheConfig` + :py:obj:`~.cudaHostAlloc`, :py:obj:`~.cuMemHostGetFlags` """ - cfunc = utils.HelperInputVoidPtr(func) - cdef void* cfunc_ptr = cfunc.cptr - cdef ccudart.cudaFuncCache ccacheConfig = cacheConfig.value - err = ccudart.cudaFuncSetCacheConfig(cfunc_ptr, ccacheConfig) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaFuncGetAttributes' in found_functions}} + cdef unsigned int pFlags = 0 + cdef _HelperInputVoidPtrStruct cypHostHelper + cdef void* cypHost = _helper_input_void_ptr(pHost, &cypHostHelper) + with nogil: + err = cyruntime.cudaHostGetFlags(&pFlags, cypHost) + _helper_input_void_ptr_free(&cypHostHelper) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, pFlags) @cython.embedsignature(True) -def cudaFuncGetAttributes(func): - """ Find out attributes for a given function. +def cudaMalloc3D(extent not None : cudaExtent): + """ Allocates logical 1D, 2D, or 3D memory objects on the device. - This function obtains the attributes of a function specified via - `func`. `func` is a device function symbol and must be declared as a - `None` function. The fetched attributes are placed in `attr`. If the - specified function does not exist, then - :py:obj:`~.cudaErrorInvalidDeviceFunction` is returned. For templated - functions, pass the function symbol as follows: - func_name + Allocates at least `width` * `height` * `depth` bytes of linear memory + on the device and returns a :py:obj:`~.cudaPitchedPtr` in which `ptr` + is a pointer to the allocated memory. The function may pad the + allocation to ensure hardware alignment requirements are met. The pitch + returned in the `pitch` field of `pitchedDevPtr` is the width in bytes + of the allocation. - Note that some function attributes such as - :py:obj:`~.maxThreadsPerBlock` may vary based on the device that is - currently being used. + The returned :py:obj:`~.cudaPitchedPtr` contains additional fields + `xsize` and `ysize`, the logical width and height of the allocation, + which are equivalent to the `width` and `height` `extent` parameters + provided by the programmer during allocation. + + For allocations of 2D and 3D objects, it is highly recommended that + programmers perform allocations using :py:obj:`~.cudaMalloc3D()` or + :py:obj:`~.cudaMallocPitch()`. Due to alignment restrictions in the + hardware, this is especially true if the application will be performing + memory copies involving 2D or 3D objects (whether linear memory or CUDA + arrays). Parameters ---------- - func : Any - Device function symbol + extent : :py:obj:`~.cudaExtent` + Requested allocation size (`width` field in bytes) Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDeviceFunction`2 - attr : :py:obj:`~.cudaFuncAttributes` - Return pointer to function's attributes + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorMemoryAllocation` + pitchedDevPtr : :py:obj:`~.cudaPitchedPtr` + Pointer to allocated pitched device memory See Also -------- - :py:obj:`~.cudaFuncSetCacheConfig (C API)`, cudaFuncGetAttributes (C++ API), :py:obj:`~.cudaLaunchKernel (C API)`, :py:obj:`~.cuFuncGetAttribute` + :py:obj:`~.cudaMallocPitch`, :py:obj:`~.cudaFree`, :py:obj:`~.cudaMemcpy3D`, :py:obj:`~.cudaMemset3D`, :py:obj:`~.cudaMalloc3DArray`, :py:obj:`~.cudaMallocArray`, :py:obj:`~.cudaFreeArray`, :py:obj:`~.cudaMallocHost (C API)`, :py:obj:`~.cudaFreeHost`, :py:obj:`~.cudaHostAlloc`, :py:obj:`~.make_cudaPitchedPtr`, :py:obj:`~.make_cudaExtent`, :py:obj:`~.cuMemAllocPitch` """ - cdef cudaFuncAttributes attr = cudaFuncAttributes() - cfunc = utils.HelperInputVoidPtr(func) - cdef void* cfunc_ptr = cfunc.cptr - err = ccudart.cudaFuncGetAttributes(attr._ptr, cfunc_ptr) - return (cudaError_t(err), attr) -{{endif}} - -{{if 'cudaFuncSetAttribute' in found_functions}} + cdef cudaPitchedPtr pitchedDevPtr = cudaPitchedPtr() + with nogil: + err = cyruntime.cudaMalloc3D(pitchedDevPtr._pvt_ptr, extent._pvt_ptr[0]) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, pitchedDevPtr) @cython.embedsignature(True) -def cudaFuncSetAttribute(func, attr not None : cudaFuncAttribute, int value): - """ Set attributes for a given function. +def cudaMalloc3DArray(desc : Optional[cudaChannelFormatDesc], extent not None : cudaExtent, unsigned int flags): + """ Allocate an array on the device. - This function sets the attributes of a function specified via `func`. - The parameter `func` must be a pointer to a function that executes on - the device. The parameter specified by `func` must be declared as a - `None` function. The enumeration defined by `attr` is set to the value - defined by `value`. If the specified function does not exist, then - :py:obj:`~.cudaErrorInvalidDeviceFunction` is returned. If the - specified attribute cannot be written, or if the value is incorrect, - then :py:obj:`~.cudaErrorInvalidValue` is returned. + Allocates a CUDA array according to the + :py:obj:`~.cudaChannelFormatDesc` structure `desc` and returns a handle + to the new CUDA array in `*array`. - Valid values for `attr` are: + The :py:obj:`~.cudaChannelFormatDesc` is defined as: - - :py:obj:`~.cudaFuncAttributeMaxDynamicSharedMemorySize` - The - requested maximum size in bytes of dynamically-allocated shared - memory. The sum of this value and the function attribute - :py:obj:`~.sharedSizeBytes` cannot exceed the device attribute - :py:obj:`~.cudaDevAttrMaxSharedMemoryPerBlockOptin`. The maximal size - of requestable dynamic shared memory may differ by GPU architecture. + **View CUDA Toolkit Documentation for a C++ code example** - - :py:obj:`~.cudaFuncAttributePreferredSharedMemoryCarveout` - On - devices where the L1 cache and shared memory use the same hardware - resources, this sets the shared memory carveout preference, in - percent of the total shared memory. See - :py:obj:`~.cudaDevAttrMaxSharedMemoryPerMultiprocessor`. This is only - a hint, and the driver can choose a different ratio if required to - execute the function. + where :py:obj:`~.cudaChannelFormatKind` is one of + :py:obj:`~.cudaChannelFormatKindSigned`, + :py:obj:`~.cudaChannelFormatKindUnsigned`, or + :py:obj:`~.cudaChannelFormatKindFloat`. - - :py:obj:`~.cudaFuncAttributeRequiredClusterWidth`: The required - cluster width in blocks. The width, height, and depth values must - either all be 0 or all be positive. The validity of the cluster - dimensions is checked at launch time. If the value is set during - compile time, it cannot be set at runtime. Setting it at runtime will - return cudaErrorNotPermitted. + :py:obj:`~.cudaMalloc3DArray()` can allocate the following: - - :py:obj:`~.cudaFuncAttributeRequiredClusterHeight`: The required - cluster height in blocks. The width, height, and depth values must - either all be 0 or all be positive. The validity of the cluster - dimensions is checked at launch time. If the value is set during - compile time, it cannot be set at runtime. Setting it at runtime will - return cudaErrorNotPermitted. + - A 1D array is allocated if the height and depth extents are both + zero. - - :py:obj:`~.cudaFuncAttributeRequiredClusterDepth`: The required - cluster depth in blocks. The width, height, and depth values must - either all be 0 or all be positive. The validity of the cluster - dimensions is checked at launch time. If the value is set during - compile time, it cannot be set at runtime. Setting it at runtime will - return cudaErrorNotPermitted. + - A 2D array is allocated if only the depth extent is zero. - - :py:obj:`~.cudaFuncAttributeNonPortableClusterSizeAllowed`: Indicates - whether the function can be launched with non-portable cluster size. - 1 is allowed, 0 is disallowed. + - A 3D array is allocated if all three extents are non-zero. - - :py:obj:`~.cudaFuncAttributeClusterSchedulingPolicyPreference`: The - block scheduling policy of a function. The value type is - cudaClusterSchedulingPolicy. + - A 1D layered CUDA array is allocated if only the height extent is + zero and the cudaArrayLayered flag is set. Each layer is a 1D array. + The number of layers is determined by the depth extent. - cudaLaunchKernel (C++ API), cudaFuncSetCacheConfig (C++ API), - :py:obj:`~.cudaFuncGetAttributes (C API)`, + - A 2D layered CUDA array is allocated if all three extents are non- + zero and the cudaArrayLayered flag is set. Each layer is a 2D array. + The number of layers is determined by the depth extent. - Parameters - ---------- - func : Any - Function to get attributes of - attr : :py:obj:`~.cudaFuncAttribute` - Attribute to set - value : int - Value to set + - A cubemap CUDA array is allocated if all three extents are non-zero + and the cudaArrayCubemap flag is set. Width must be equal to height, + and depth must be six. A cubemap is a special type of 2D layered CUDA + array, where the six layers represent the six faces of a cube. The + order of the six layers in memory is the same as that listed in + :py:obj:`~.cudaGraphicsCubeFace`. - Returns - ------- - cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDeviceFunction`, :py:obj:`~.cudaErrorInvalidValue` - """ - cfunc = utils.HelperInputVoidPtr(func) - cdef void* cfunc_ptr = cfunc.cptr - cdef ccudart.cudaFuncAttribute cattr = attr.value - err = ccudart.cudaFuncSetAttribute(cfunc_ptr, cattr, value) - return (cudaError_t(err),) -{{endif}} + - A cubemap layered CUDA array is allocated if all three extents are + non-zero, and both, cudaArrayCubemap and cudaArrayLayered flags are + set. Width must be equal to height, and depth must be a multiple of + six. A cubemap layered CUDA array is a special type of 2D layered + CUDA array that consists of a collection of cubemaps. The first six + layers represent the first cubemap, the next six layers form the + second cubemap, and so on. -{{if 'cudaLaunchHostFunc' in found_functions}} + The `flags` parameter enables different options to be specified that + affect the allocation, as follows. -@cython.embedsignature(True) -def cudaLaunchHostFunc(stream, fn, userData): - """ Enqueues a host function call in a stream. + - :py:obj:`~.cudaArrayDefault`: This flag's value is defined to be 0 + and provides default array allocation - Enqueues a host function to run in a stream. The function will be - called after currently enqueued work and will block work added after - it. + - :py:obj:`~.cudaArrayLayered`: Allocates a layered CUDA array, with + the depth extent indicating the number of layers - The host function must not make any CUDA API calls. Attempting to use a - CUDA API may result in :py:obj:`~.cudaErrorNotPermitted`, but this is - not required. The host function must not perform any synchronization - that may depend on outstanding CUDA work not mandated to run earlier. - Host functions without a mandated order (such as in independent - streams) execute in undefined order and may be serialized. + - :py:obj:`~.cudaArrayCubemap`: Allocates a cubemap CUDA array. Width + must be equal to height, and depth must be six. If the + cudaArrayLayered flag is also set, depth must be a multiple of six. - For the purposes of Unified Memory, execution makes a number of - guarantees: + - :py:obj:`~.cudaArraySurfaceLoadStore`: Allocates a CUDA array that + could be read from or written to using a surface reference. - - The stream is considered idle for the duration of the function's - execution. Thus, for example, the function may always use memory - attached to the stream it was enqueued in. + - :py:obj:`~.cudaArrayTextureGather`: This flag indicates that texture + gather operations will be performed on the CUDA array. Texture gather + can only be performed on 2D CUDA arrays. - - The start of execution of the function has the same effect as - synchronizing an event recorded in the same stream immediately prior - to the function. It thus synchronizes streams which have been - "joined" prior to the function. + - :py:obj:`~.cudaArraySparse`: Allocates a CUDA array without physical + backing memory. The subregions within this sparse array can later be + mapped onto a physical memory allocation by calling + :py:obj:`~.cuMemMapArrayAsync`. This flag can only be used for + creating 2D, 3D or 2D layered sparse CUDA arrays. The physical + backing memory must be allocated via :py:obj:`~.cuMemCreate`. - - Adding device work to any stream does not have the effect of making - the stream active until all preceding host functions and stream - callbacks have executed. Thus, for example, a function might use - global attached memory even if work has been added to another stream, - if the work has been ordered behind the function call with an event. + - :py:obj:`~.cudaArrayDeferredMapping`: Allocates a CUDA array without + physical backing memory. The entire array can later be mapped onto a + physical memory allocation by calling :py:obj:`~.cuMemMapArrayAsync`. + The physical backing memory must be allocated via + :py:obj:`~.cuMemCreate`. - - Completion of the function does not cause a stream to become active - except as described above. The stream will remain idle if no device - work follows the function, and will remain idle across consecutive - host functions or stream callbacks without device work in between. - Thus, for example, stream synchronization can be done by signaling - from a host function at the end of the stream. + The width, height and depth extents must meet certain size requirements + as listed in the following table. All values are specified in elements. + + Note that 2D CUDA arrays have different size requirements if the + :py:obj:`~.cudaArrayTextureGather` flag is set. In that case, the valid + range for (width, height, depth) is ((1,maxTexture2DGather[0]), + (1,maxTexture2DGather[1]), 0). - Note that, in constrast to :py:obj:`~.cuStreamAddCallback`, the - function will not be called in the event of an error in the CUDA - context. + **View CUDA Toolkit Documentation for a table example** Parameters ---------- - hStream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` - Stream to enqueue function call in - fn : :py:obj:`~.cudaHostFn_t` - The function to call once preceding stream operations are complete - userData : Any - User-specified data to be passed to the function + desc : :py:obj:`~.cudaChannelFormatDesc` + Requested channel format + extent : :py:obj:`~.cudaExtent` + Requested allocation size (`width` field in elements) + flags : unsigned int + Flags for extensions Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorNotSupported` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorMemoryAllocation` + array : :py:obj:`~.cudaArray_t` + Pointer to allocated array in device memory See Also -------- - :py:obj:`~.cudaStreamCreate`, :py:obj:`~.cudaStreamQuery`, :py:obj:`~.cudaStreamSynchronize`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cudaStreamDestroy`, :py:obj:`~.cudaMallocManaged`, :py:obj:`~.cudaStreamAttachMemAsync`, :py:obj:`~.cudaStreamAddCallback`, :py:obj:`~.cuLaunchHostFunc` + :py:obj:`~.cudaMalloc3D`, :py:obj:`~.cudaMalloc`, :py:obj:`~.cudaMallocPitch`, :py:obj:`~.cudaFree`, :py:obj:`~.cudaFreeArray`, :py:obj:`~.cudaMallocHost (C API)`, :py:obj:`~.cudaFreeHost`, :py:obj:`~.cudaHostAlloc`, :py:obj:`~.make_cudaExtent`, :py:obj:`~.cuArray3DCreate` """ - cdef ccudart.cudaHostFn_t cfn - if fn is None: - cfn = 0 - elif isinstance(fn, (cudaHostFn_t,)): - pfn = int(fn) - cfn = pfn - else: - pfn = int(cudaHostFn_t(fn)) - cfn = pfn - cdef ccudart.cudaStream_t cstream - if stream is None: - cstream = 0 - elif isinstance(stream, (cudaStream_t,cuda.CUstream)): - pstream = int(stream) - cstream = pstream - else: - pstream = int(cudaStream_t(stream)) - cstream = pstream - cuserData = utils.HelperInputVoidPtr(userData) - cdef void* cuserData_ptr = cuserData.cptr + cdef cudaArray_t array = cudaArray_t() + cdef cyruntime.cudaChannelFormatDesc* cydesc_ptr = desc._pvt_ptr if desc is not None else NULL with nogil: - err = ccudart.cudaLaunchHostFunc(cstream, cfn, cuserData_ptr) - - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaFuncSetSharedMemConfig' in found_functions}} + err = cyruntime.cudaMalloc3DArray(array._pvt_ptr, cydesc_ptr, extent._pvt_ptr[0], flags) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, array) @cython.embedsignature(True) -def cudaFuncSetSharedMemConfig(func, config not None : cudaSharedMemConfig): - """ Sets the shared memory configuration for a device function. +def cudaMallocMipmappedArray(desc : Optional[cudaChannelFormatDesc], extent not None : cudaExtent, unsigned int numLevels, unsigned int flags): + """ Allocate a mipmapped array on the device. - [Deprecated] + Allocates a CUDA mipmapped array according to the + :py:obj:`~.cudaChannelFormatDesc` structure `desc` and returns a handle + to the new CUDA mipmapped array in `*mipmappedArray`. `numLevels` + specifies the number of mipmap levels to be allocated. This value is + clamped to the range [1, 1 + floor(log2(max(width, height, depth)))]. - On devices with configurable shared memory banks, this function will - force all subsequent launches of the specified device function to have - the given shared memory bank size configuration. On any given launch of - the function, the shared memory configuration of the device will be - temporarily changed if needed to suit the function's preferred - configuration. Changes in shared memory configuration between - subsequent launches of functions, may introduce a device side - synchronization point. + The :py:obj:`~.cudaChannelFormatDesc` is defined as: - Any per-function setting of shared memory bank size set via - :py:obj:`~.cudaFuncSetSharedMemConfig` will override the device wide - setting set by :py:obj:`~.cudaDeviceSetSharedMemConfig`. + **View CUDA Toolkit Documentation for a C++ code example** - Changing the shared memory bank size will not increase shared memory - usage or affect occupancy of kernels, but may have major effects on - performance. Larger bank sizes will allow for greater potential - bandwidth to shared memory, but will change what kinds of accesses to - shared memory will result in bank conflicts. + where :py:obj:`~.cudaChannelFormatKind` is one of + :py:obj:`~.cudaChannelFormatKindSigned`, + :py:obj:`~.cudaChannelFormatKindUnsigned`, or + :py:obj:`~.cudaChannelFormatKindFloat`. - This function will do nothing on devices with fixed shared memory bank - size. + :py:obj:`~.cudaMallocMipmappedArray()` can allocate the following: - For templated functions, pass the function symbol as follows: - func_name + - A 1D mipmapped array is allocated if the height and depth extents are + both zero. - The supported bank configurations are: + - A 2D mipmapped array is allocated if only the depth extent is zero. - - :py:obj:`~.cudaSharedMemBankSizeDefault`: use the device's shared - memory configuration when launching this function. + - A 3D mipmapped array is allocated if all three extents are non-zero. - - :py:obj:`~.cudaSharedMemBankSizeFourByte`: set shared memory bank - width to be four bytes natively when launching this function. + - A 1D layered CUDA mipmapped array is allocated if only the height + extent is zero and the cudaArrayLayered flag is set. Each layer is a + 1D mipmapped array. The number of layers is determined by the depth + extent. - - :py:obj:`~.cudaSharedMemBankSizeEightByte`: set shared memory bank - width to be eight bytes natively when launching this function. + - A 2D layered CUDA mipmapped array is allocated if all three extents + are non-zero and the cudaArrayLayered flag is set. Each layer is a 2D + mipmapped array. The number of layers is determined by the depth + extent. - Parameters - ---------- - func : Any - Device function symbol - config : :py:obj:`~.cudaSharedMemConfig` - Requested shared memory configuration + - A cubemap CUDA mipmapped array is allocated if all three extents are + non-zero and the cudaArrayCubemap flag is set. Width must be equal to + height, and depth must be six. The order of the six layers in memory + is the same as that listed in :py:obj:`~.cudaGraphicsCubeFace`. - Returns - ------- - cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDeviceFunction`, :py:obj:`~.cudaErrorInvalidValue`,2 + - A cubemap layered CUDA mipmapped array is allocated if all three + extents are non-zero, and both, cudaArrayCubemap and cudaArrayLayered + flags are set. Width must be equal to height, and depth must be a + multiple of six. A cubemap layered CUDA mipmapped array is a special + type of 2D layered CUDA mipmapped array that consists of a collection + of cubemap mipmapped arrays. The first six layers represent the first + cubemap mipmapped array, the next six layers form the second cubemap + mipmapped array, and so on. - See Also - -------- - :py:obj:`~.cudaDeviceSetSharedMemConfig`, :py:obj:`~.cudaDeviceGetSharedMemConfig`, :py:obj:`~.cudaDeviceSetCacheConfig`, :py:obj:`~.cudaDeviceGetCacheConfig`, :py:obj:`~.cudaFuncSetCacheConfig`, :py:obj:`~.cuFuncSetSharedMemConfig` - """ - cfunc = utils.HelperInputVoidPtr(func) - cdef void* cfunc_ptr = cfunc.cptr - cdef ccudart.cudaSharedMemConfig cconfig = config.value - err = ccudart.cudaFuncSetSharedMemConfig(cfunc_ptr, cconfig) - return (cudaError_t(err),) -{{endif}} + The `flags` parameter enables different options to be specified that + affect the allocation, as follows. -{{if 'cudaOccupancyMaxActiveBlocksPerMultiprocessor' in found_functions}} + - :py:obj:`~.cudaArrayDefault`: This flag's value is defined to be 0 + and provides default mipmapped array allocation -@cython.embedsignature(True) -def cudaOccupancyMaxActiveBlocksPerMultiprocessor(func, int blockSize, size_t dynamicSMemSize): - """ Returns occupancy for a device function. + - :py:obj:`~.cudaArrayLayered`: Allocates a layered CUDA mipmapped + array, with the depth extent indicating the number of layers - Returns in `*numBlocks` the maximum number of active blocks per - streaming multiprocessor for the device function. + - :py:obj:`~.cudaArrayCubemap`: Allocates a cubemap CUDA mipmapped + array. Width must be equal to height, and depth must be six. If the + cudaArrayLayered flag is also set, depth must be a multiple of six. - Parameters - ---------- - func : Any - Kernel function for which occupancy is calculated - blockSize : int - Block size the kernel is intended to be launched with - dynamicSMemSize : size_t - Per-block dynamic shared memory usage intended, in bytes + - :py:obj:`~.cudaArraySurfaceLoadStore`: This flag indicates that + individual mipmap levels of the CUDA mipmapped array will be read + from or written to using a surface reference. - Returns - ------- - cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDevice`, :py:obj:`~.cudaErrorInvalidDeviceFunction`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorUnknown`, - numBlocks : int - Returned occupancy + - :py:obj:`~.cudaArrayTextureGather`: This flag indicates that texture + gather operations will be performed on the CUDA array. Texture gather + can only be performed on 2D CUDA mipmapped arrays, and the gather + operations are performed only on the most detailed mipmap level. - See Also - -------- - :py:obj:`~.cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags`, cudaOccupancyMaxPotentialBlockSize (C++ API), cudaOccupancyMaxPotentialBlockSizeWithFlags (C++ API), cudaOccupancyMaxPotentialBlockSizeVariableSMem (C++ API), cudaOccupancyMaxPotentialBlockSizeVariableSMemWithFlags (C++ API), cudaOccupancyAvailableDynamicSMemPerBlock (C++ API), :py:obj:`~.cuOccupancyMaxActiveBlocksPerMultiprocessor` - """ - cdef int numBlocks = 0 - cfunc = utils.HelperInputVoidPtr(func) - cdef void* cfunc_ptr = cfunc.cptr - err = ccudart.cudaOccupancyMaxActiveBlocksPerMultiprocessor(&numBlocks, cfunc_ptr, blockSize, dynamicSMemSize) - return (cudaError_t(err), numBlocks) -{{endif}} + - :py:obj:`~.cudaArraySparse`: Allocates a CUDA mipmapped array without + physical backing memory. The subregions within this sparse array can + later be mapped onto a physical memory allocation by calling + :py:obj:`~.cuMemMapArrayAsync`. This flag can only be used for + creating 2D, 3D or 2D layered sparse CUDA mipmapped arrays. The + physical backing memory must be allocated via + :py:obj:`~.cuMemCreate`. -{{if 'cudaOccupancyAvailableDynamicSMemPerBlock' in found_functions}} + - :py:obj:`~.cudaArrayDeferredMapping`: Allocates a CUDA mipmapped + array without physical backing memory. The entire array can later be + mapped onto a physical memory allocation by calling + :py:obj:`~.cuMemMapArrayAsync`. The physical backing memory must be + allocated via :py:obj:`~.cuMemCreate`. -@cython.embedsignature(True) -def cudaOccupancyAvailableDynamicSMemPerBlock(func, int numBlocks, int blockSize): - """ Returns dynamic shared memory available per block when launching `numBlocks` blocks on SM. + The width, height and depth extents must meet certain size requirements + as listed in the following table. All values are specified in elements. - Returns in `*dynamicSmemSize` the maximum size of dynamic shared memory - to allow `numBlocks` blocks per SM. + **View CUDA Toolkit Documentation for a table example** Parameters ---------- - func : Any - Kernel function for which occupancy is calculated - numBlocks : int - Number of blocks to fit on SM - blockSize : int - Size of the block + desc : :py:obj:`~.cudaChannelFormatDesc` + Requested channel format + extent : :py:obj:`~.cudaExtent` + Requested allocation size (`width` field in elements) + numLevels : unsigned int + Number of mipmap levels to allocate + flags : unsigned int + Flags for extensions Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDevice`, :py:obj:`~.cudaErrorInvalidDeviceFunction`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorUnknown`, - dynamicSmemSize : int - Returned maximum dynamic shared memory + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorMemoryAllocation` + mipmappedArray : :py:obj:`~.cudaMipmappedArray_t` + Pointer to allocated mipmapped array in device memory See Also -------- - :py:obj:`~.cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags`, cudaOccupancyMaxPotentialBlockSize (C++ API), cudaOccupancyMaxPotentialBlockSizeWithFlags (C++ API), cudaOccupancyMaxPotentialBlockSizeVariableSMem (C++ API), cudaOccupancyMaxPotentialBlockSizeVariableSMemWithFlags (C++ API), :py:obj:`~.cudaOccupancyAvailableDynamicSMemPerBlock` + :py:obj:`~.cudaMalloc3D`, :py:obj:`~.cudaMalloc`, :py:obj:`~.cudaMallocPitch`, :py:obj:`~.cudaFree`, :py:obj:`~.cudaFreeArray`, :py:obj:`~.cudaMallocHost (C API)`, :py:obj:`~.cudaFreeHost`, :py:obj:`~.cudaHostAlloc`, :py:obj:`~.make_cudaExtent`, :py:obj:`~.cuMipmappedArrayCreate` """ - cdef size_t dynamicSmemSize = 0 - cfunc = utils.HelperInputVoidPtr(func) - cdef void* cfunc_ptr = cfunc.cptr - err = ccudart.cudaOccupancyAvailableDynamicSMemPerBlock(&dynamicSmemSize, cfunc_ptr, numBlocks, blockSize) - return (cudaError_t(err), dynamicSmemSize) -{{endif}} - -{{if 'cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags' in found_functions}} + cdef cudaMipmappedArray_t mipmappedArray = cudaMipmappedArray_t() + cdef cyruntime.cudaChannelFormatDesc* cydesc_ptr = desc._pvt_ptr if desc is not None else NULL + with nogil: + err = cyruntime.cudaMallocMipmappedArray(mipmappedArray._pvt_ptr, cydesc_ptr, extent._pvt_ptr[0], numLevels, flags) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, mipmappedArray) @cython.embedsignature(True) -def cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(func, int blockSize, size_t dynamicSMemSize, unsigned int flags): - """ Returns occupancy for a device function with the specified flags. - - Returns in `*numBlocks` the maximum number of active blocks per - streaming multiprocessor for the device function. +def cudaGetMipmappedArrayLevel(mipmappedArray, unsigned int level): + """ Gets a mipmap level of a CUDA mipmapped array. - The `flags` parameter controls how special cases are handled. Valid - flags include: + Returns in `*levelArray` a CUDA array that represents a single mipmap + level of the CUDA mipmapped array `mipmappedArray`. - - :py:obj:`~.cudaOccupancyDefault`: keeps the default behavior as - :py:obj:`~.cudaOccupancyMaxActiveBlocksPerMultiprocessor` + If `level` is greater than the maximum number of levels in this + mipmapped array, :py:obj:`~.cudaErrorInvalidValue` is returned. - - :py:obj:`~.cudaOccupancyDisableCachingOverride`: This flag suppresses - the default behavior on platform where global caching affects - occupancy. On such platforms, if caching is enabled, but per-block SM - resource usage would result in zero occupancy, the occupancy - calculator will calculate the occupancy as if caching is disabled. - Setting this flag makes the occupancy calculator to return 0 in such - cases. More information can be found about this feature in the - "Unified L1/Texture Cache" section of the Maxwell tuning guide. + If `mipmappedArray` is NULL, :py:obj:`~.cudaErrorInvalidResourceHandle` + is returned. Parameters ---------- - func : Any - Kernel function for which occupancy is calculated - blockSize : int - Block size the kernel is intended to be launched with - dynamicSMemSize : size_t - Per-block dynamic shared memory usage intended, in bytes - flags : unsigned int - Requested behavior for the occupancy calculator + mipmappedArray : :py:obj:`~.cudaMipmappedArray_const_t` + CUDA mipmapped array + level : unsigned int + Mipmap level Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDevice`, :py:obj:`~.cudaErrorInvalidDeviceFunction`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorUnknown`, - numBlocks : int - Returned occupancy + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :py:obj:`~.cudaErrorInvalidResourceHandle` + levelArray : :py:obj:`~.cudaArray_t` + Returned mipmap level CUDA array See Also -------- - :py:obj:`~.cudaOccupancyMaxActiveBlocksPerMultiprocessor`, cudaOccupancyMaxPotentialBlockSize (C++ API), cudaOccupancyMaxPotentialBlockSizeWithFlags (C++ API), cudaOccupancyMaxPotentialBlockSizeVariableSMem (C++ API), cudaOccupancyMaxPotentialBlockSizeVariableSMemWithFlags (C++ API), cudaOccupancyAvailableDynamicSMemPerBlock (C++ API), :py:obj:`~.cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags` + :py:obj:`~.cudaMalloc3D`, :py:obj:`~.cudaMalloc`, :py:obj:`~.cudaMallocPitch`, :py:obj:`~.cudaFree`, :py:obj:`~.cudaFreeArray`, :py:obj:`~.cudaMallocHost (C API)`, :py:obj:`~.cudaFreeHost`, :py:obj:`~.cudaHostAlloc`, :py:obj:`~.make_cudaExtent`, :py:obj:`~.cuMipmappedArrayGetLevel` """ - cdef int numBlocks = 0 - cfunc = utils.HelperInputVoidPtr(func) - cdef void* cfunc_ptr = cfunc.cptr - err = ccudart.cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(&numBlocks, cfunc_ptr, blockSize, dynamicSMemSize, flags) - return (cudaError_t(err), numBlocks) -{{endif}} - -{{if 'cudaMallocManaged' in found_functions}} + cdef cyruntime.cudaMipmappedArray_const_t cymipmappedArray + if mipmappedArray is None: + pmipmappedArray = 0 + elif isinstance(mipmappedArray, (cudaMipmappedArray_const_t,)): + pmipmappedArray = int(mipmappedArray) + else: + pmipmappedArray = int(cudaMipmappedArray_const_t(mipmappedArray)) + cymipmappedArray = pmipmappedArray + cdef cudaArray_t levelArray = cudaArray_t() + with nogil: + err = cyruntime.cudaGetMipmappedArrayLevel(levelArray._pvt_ptr, cymipmappedArray, level) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, levelArray) @cython.embedsignature(True) -def cudaMallocManaged(size_t size, unsigned int flags): - """ Allocates memory that will be automatically managed by the Unified Memory system. +def cudaMemcpy3D(p : Optional[cudaMemcpy3DParms]): + """ Copies data between 3D objects. - Allocates `size` bytes of managed memory on the device and returns in - `*devPtr` a pointer to the allocated memory. If the device doesn't - support allocating managed memory, :py:obj:`~.cudaErrorNotSupported` is - returned. Support for managed memory can be queried using the device - attribute :py:obj:`~.cudaDevAttrManagedMemory`. The allocated memory is - suitably aligned for any kind of variable. The memory is not cleared. - If `size` is 0, :py:obj:`~.cudaMallocManaged` returns - :py:obj:`~.cudaErrorInvalidValue`. The pointer is valid on the CPU and - on all GPUs in the system that support managed memory. All accesses to - this pointer must obey the Unified Memory programming model. + **View CUDA Toolkit Documentation for a C++ code example** - `flags` specifies the default stream association for this allocation. - `flags` must be one of :py:obj:`~.cudaMemAttachGlobal` or - :py:obj:`~.cudaMemAttachHost`. The default value for `flags` is - :py:obj:`~.cudaMemAttachGlobal`. If :py:obj:`~.cudaMemAttachGlobal` is - specified, then this memory is accessible from any stream on any - device. If :py:obj:`~.cudaMemAttachHost` is specified, then the - allocation should not be accessed from devices that have a zero value - for the device attribute - :py:obj:`~.cudaDevAttrConcurrentManagedAccess`; an explicit call to - :py:obj:`~.cudaStreamAttachMemAsync` will be required to enable access - on such devices. + :py:obj:`~.cudaMemcpy3D()` copies data betwen two 3D objects. The + source and destination objects may be in either host memory, device + memory, or a CUDA array. The source, destination, extent, and kind of + copy performed is specified by the :py:obj:`~.cudaMemcpy3DParms` struct + which should be initialized to zero before use: - If the association is later changed via - :py:obj:`~.cudaStreamAttachMemAsync` to a single stream, the default - association, as specifed during :py:obj:`~.cudaMallocManaged`, is - restored when that stream is destroyed. For managed variables, the - default association is always :py:obj:`~.cudaMemAttachGlobal`. Note - that destroying a stream is an asynchronous operation, and as a result, - the change to default association won't happen until all work in the - stream has completed. + **View CUDA Toolkit Documentation for a C++ code example** - Memory allocated with :py:obj:`~.cudaMallocManaged` should be released - with :py:obj:`~.cudaFree`. + The struct passed to :py:obj:`~.cudaMemcpy3D()` must specify one of + `srcArray` or `srcPtr` and one of `dstArray` or `dstPtr`. Passing more + than one non-zero source or destination will cause + :py:obj:`~.cudaMemcpy3D()` to return an error. - Device memory oversubscription is possible for GPUs that have a non- - zero value for the device attribute - :py:obj:`~.cudaDevAttrConcurrentManagedAccess`. Managed memory on such - GPUs may be evicted from device memory to host memory at any time by - the Unified Memory driver in order to make room for other allocations. + The `srcPos` and `dstPos` fields are optional offsets into the source + and destination objects and are defined in units of each object's + elements. The element for a host or device pointer is assumed to be + unsigned char. - In a system where all GPUs have a non-zero value for the device - attribute :py:obj:`~.cudaDevAttrConcurrentManagedAccess`, managed - memory may not be populated when this API returns and instead may be - populated on access. In such systems, managed memory can migrate to any - processor's memory at any time. The Unified Memory driver will employ - heuristics to maintain data locality and prevent excessive page faults - to the extent possible. The application can also guide the driver about - memory usage patterns via :py:obj:`~.cudaMemAdvise`. The application - can also explicitly migrate memory to a desired processor's memory via - :py:obj:`~.cudaMemPrefetchAsync`. + The `extent` field defines the dimensions of the transferred area in + elements. If a CUDA array is participating in the copy, the extent is + defined in terms of that array's elements. If no CUDA array is + participating in the copy then the extents are defined in elements of + unsigned char. - In a multi-GPU system where all of the GPUs have a zero value for the - device attribute :py:obj:`~.cudaDevAttrConcurrentManagedAccess` and all - the GPUs have peer-to-peer support with each other, the physical - storage for managed memory is created on the GPU which is active at the - time :py:obj:`~.cudaMallocManaged` is called. All other GPUs will - reference the data at reduced bandwidth via peer mappings over the PCIe - bus. The Unified Memory driver does not migrate memory among such GPUs. + The `kind` field defines the direction of the copy. It must be one of + :py:obj:`~.cudaMemcpyHostToHost`, :py:obj:`~.cudaMemcpyHostToDevice`, + :py:obj:`~.cudaMemcpyDeviceToHost`, + :py:obj:`~.cudaMemcpyDeviceToDevice`, or :py:obj:`~.cudaMemcpyDefault`. + Passing :py:obj:`~.cudaMemcpyDefault` is recommended, in which case the + type of transfer is inferred from the pointer values. However, + :py:obj:`~.cudaMemcpyDefault` is only allowed on systems that support + unified virtual addressing. For :py:obj:`~.cudaMemcpyHostToHost` or + :py:obj:`~.cudaMemcpyHostToDevice` or + :py:obj:`~.cudaMemcpyDeviceToHost` passed as kind and cudaArray type + passed as source or destination, if the kind implies cudaArray type to + be present on the host, :py:obj:`~.cudaMemcpy3D()` will disregard that + implication and silently correct the kind based on the fact that + cudaArray type can only be present on the device. - In a multi-GPU system where not all GPUs have peer-to-peer support with - each other and where the value of the device attribute - :py:obj:`~.cudaDevAttrConcurrentManagedAccess` is zero for at least one - of those GPUs, the location chosen for physical storage of managed - memory is system-dependent. + If the source and destination are both arrays, + :py:obj:`~.cudaMemcpy3D()` will return an error if they do not have the + same element size. - - On Linux, the location chosen will be device memory as long as the - current set of active contexts are on devices that either have peer- - to-peer support with each other or have a non-zero value for the - device attribute :py:obj:`~.cudaDevAttrConcurrentManagedAccess`. If - there is an active context on a GPU that does not have a non-zero - value for that device attribute and it does not have peer-to-peer - support with the other devices that have active contexts on them, - then the location for physical storage will be 'zero-copy' or host - memory. Note that this means that managed memory that is located in - device memory is migrated to host memory if a new context is created - on a GPU that doesn't have a non-zero value for the device attribute - and does not support peer-to-peer with at least one of the other - devices that has an active context. This in turn implies that context - creation may fail if there is insufficient host memory to migrate all - managed allocations. + The source and destination object may not overlap. If overlapping + source and destination objects are specified, undefined behavior will + result. - - On Windows, the physical storage is always created in 'zero-copy' or - host memory. All GPUs will reference the data at reduced bandwidth - over the PCIe bus. In these circumstances, use of the environment - variable CUDA_VISIBLE_DEVICES is recommended to restrict CUDA to only - use those GPUs that have peer-to-peer support. Alternatively, users - can also set CUDA_MANAGED_FORCE_DEVICE_ALLOC to a non-zero value to - force the driver to always use device memory for physical storage. - When this environment variable is set to a non-zero value, all - devices used in that process that support managed memory have to be - peer-to-peer compatible with each other. The error - :py:obj:`~.cudaErrorInvalidDevice` will be returned if a device that - supports managed memory is used and it is not peer-to-peer compatible - with any of the other managed memory supporting devices that were - previously used in that process, even if :py:obj:`~.cudaDeviceReset` - has been called on those devices. These environment variables are - described in the CUDA programming guide under the "CUDA environment - variables" section. + The source object must entirely contain the region defined by `srcPos` + and `extent`. The destination object must entirely contain the region + defined by `dstPos` and `extent`. + + :py:obj:`~.cudaMemcpy3D()` returns an error if the pitch of `srcPtr` or + `dstPtr` exceeds the maximum allowed. The pitch of a + :py:obj:`~.cudaPitchedPtr` allocated with :py:obj:`~.cudaMalloc3D()` + will always be valid. Parameters ---------- - size : size_t - Requested allocation size in bytes - flags : unsigned int - Must be either :py:obj:`~.cudaMemAttachGlobal` or - :py:obj:`~.cudaMemAttachHost` (defaults to - :py:obj:`~.cudaMemAttachGlobal`) + p : :py:obj:`~.cudaMemcpy3DParms` + 3D memory copy parameters Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorMemoryAllocation`, :py:obj:`~.cudaErrorNotSupported`, :py:obj:`~.cudaErrorInvalidValue` - devPtr : Any - Pointer to allocated device memory + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidPitchValue`, :py:obj:`~.cudaErrorInvalidMemcpyDirection` See Also -------- - :py:obj:`~.cudaMallocPitch`, :py:obj:`~.cudaFree`, :py:obj:`~.cudaMallocArray`, :py:obj:`~.cudaFreeArray`, :py:obj:`~.cudaMalloc3D`, :py:obj:`~.cudaMalloc3DArray`, :py:obj:`~.cudaMallocHost (C API)`, :py:obj:`~.cudaFreeHost`, :py:obj:`~.cudaHostAlloc`, :py:obj:`~.cudaDeviceGetAttribute`, :py:obj:`~.cudaStreamAttachMemAsync`, :py:obj:`~.cuMemAllocManaged` + :py:obj:`~.cudaMalloc3D`, :py:obj:`~.cudaMalloc3DArray`, :py:obj:`~.cudaMemset3D`, :py:obj:`~.cudaMemcpy3DAsync`, :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpy2D`, :py:obj:`~.cudaMemcpy2DToArray`, :py:obj:`~.cudaMemcpy2DFromArray`, :py:obj:`~.cudaMemcpy2DArrayToArray`, :py:obj:`~.cudaMemcpyToSymbol`, :py:obj:`~.cudaMemcpyFromSymbol`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpy2DAsync`, :py:obj:`~.cudaMemcpy2DToArrayAsync`, :py:obj:`~.cudaMemcpy2DFromArrayAsync`, :py:obj:`~.cudaMemcpyToSymbolAsync`, :py:obj:`~.cudaMemcpyFromSymbolAsync`, :py:obj:`~.make_cudaExtent`, :py:obj:`~.make_cudaPos`, :py:obj:`~.cuMemcpy3D` """ - cdef void_ptr devPtr = 0 + cdef cyruntime.cudaMemcpy3DParms* cyp_ptr = p._pvt_ptr if p is not None else NULL with nogil: - err = ccudart.cudaMallocManaged(&devPtr, size, flags) - - return (cudaError_t(err), devPtr) -{{endif}} - -{{if 'cudaMalloc' in found_functions}} + err = cyruntime.cudaMemcpy3D(cyp_ptr) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaMalloc(size_t size): - """ Allocate memory on the device. +def cudaMemcpy3DPeer(p : Optional[cudaMemcpy3DPeerParms]): + """ Copies memory between devices. - Allocates `size` bytes of linear memory on the device and returns in - `*devPtr` a pointer to the allocated memory. The allocated memory is - suitably aligned for any kind of variable. The memory is not cleared. - :py:obj:`~.cudaMalloc()` returns :py:obj:`~.cudaErrorMemoryAllocation` - in case of failure. + Perform a 3D memory copy according to the parameters specified in `p`. + See the definition of the :py:obj:`~.cudaMemcpy3DPeerParms` structure + for documentation of its parameters. - The device version of :py:obj:`~.cudaFree` cannot be used with a - `*devPtr` allocated using the host API, and vice versa. + Note that this function is synchronous with respect to the host only if + the source or destination of the transfer is host memory. Note also + that this copy is serialized with respect to all pending and future + asynchronous work in to the current device, the copy's source device, + and the copy's destination device (use + :py:obj:`~.cudaMemcpy3DPeerAsync` to avoid this synchronization). Parameters ---------- - size : size_t - Requested allocation size in bytes + p : :py:obj:`~.cudaMemcpy3DPeerParms` + Parameters for the memory copy Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorMemoryAllocation` - devPtr : Any - Pointer to allocated device memory + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidDevice`, :py:obj:`~.cudaErrorInvalidPitchValue` See Also -------- - :py:obj:`~.cudaMallocPitch`, :py:obj:`~.cudaFree`, :py:obj:`~.cudaMallocArray`, :py:obj:`~.cudaFreeArray`, :py:obj:`~.cudaMalloc3D`, :py:obj:`~.cudaMalloc3DArray`, :py:obj:`~.cudaMallocHost (C API)`, :py:obj:`~.cudaFreeHost`, :py:obj:`~.cudaHostAlloc`, :py:obj:`~.cuMemAlloc` + :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpyPeer`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpyPeerAsync`, :py:obj:`~.cudaMemcpy3DPeerAsync`, :py:obj:`~.cuMemcpy3DPeer` """ - cdef void_ptr devPtr = 0 + cdef cyruntime.cudaMemcpy3DPeerParms* cyp_ptr = p._pvt_ptr if p is not None else NULL with nogil: - err = ccudart.cudaMalloc(&devPtr, size) + err = cyruntime.cudaMemcpy3DPeer(cyp_ptr) + return (_cudaError_t(err),) - return (cudaError_t(err), devPtr) -{{endif}} +@cython.embedsignature(True) +def cudaMemcpy3DAsync(p : Optional[cudaMemcpy3DParms], stream): + """ Copies data between 3D objects. -{{if 'cudaMallocHost' in found_functions}} + **View CUDA Toolkit Documentation for a C++ code example** -@cython.embedsignature(True) -def cudaMallocHost(size_t size): - """ Allocates page-locked memory on the host. + :py:obj:`~.cudaMemcpy3DAsync()` copies data betwen two 3D objects. The + source and destination objects may be in either host memory, device + memory, or a CUDA array. The source, destination, extent, and kind of + copy performed is specified by the :py:obj:`~.cudaMemcpy3DParms` struct + which should be initialized to zero before use: - Allocates `size` bytes of host memory that is page-locked and - accessible to the device. The driver tracks the virtual memory ranges - allocated with this function and automatically accelerates calls to - functions such as :py:obj:`~.cudaMemcpy`*(). Since the memory can be - accessed directly by the device, it can be read or written with much - higher bandwidth than pageable memory obtained with functions such as - :py:obj:`~.malloc()`. + **View CUDA Toolkit Documentation for a C++ code example** + + The struct passed to :py:obj:`~.cudaMemcpy3DAsync()` must specify one + of `srcArray` or `srcPtr` and one of `dstArray` or `dstPtr`. Passing + more than one non-zero source or destination will cause + :py:obj:`~.cudaMemcpy3DAsync()` to return an error. + + The `srcPos` and `dstPos` fields are optional offsets into the source + and destination objects and are defined in units of each object's + elements. The element for a host or device pointer is assumed to be + unsigned char. For CUDA arrays, positions must be in the range [0, + 2048) for any dimension. + + The `extent` field defines the dimensions of the transferred area in + elements. If a CUDA array is participating in the copy, the extent is + defined in terms of that array's elements. If no CUDA array is + participating in the copy then the extents are defined in elements of + unsigned char. + + The `kind` field defines the direction of the copy. It must be one of + :py:obj:`~.cudaMemcpyHostToHost`, :py:obj:`~.cudaMemcpyHostToDevice`, + :py:obj:`~.cudaMemcpyDeviceToHost`, + :py:obj:`~.cudaMemcpyDeviceToDevice`, or :py:obj:`~.cudaMemcpyDefault`. + Passing :py:obj:`~.cudaMemcpyDefault` is recommended, in which case the + type of transfer is inferred from the pointer values. However, + :py:obj:`~.cudaMemcpyDefault` is only allowed on systems that support + unified virtual addressing. For :py:obj:`~.cudaMemcpyHostToHost` or + :py:obj:`~.cudaMemcpyHostToDevice` or + :py:obj:`~.cudaMemcpyDeviceToHost` passed as kind and cudaArray type + passed as source or destination, if the kind implies cudaArray type to + be present on the host, :py:obj:`~.cudaMemcpy3DAsync()` will disregard + that implication and silently correct the kind based on the fact that + cudaArray type can only be present on the device. + + If the source and destination are both arrays, + :py:obj:`~.cudaMemcpy3DAsync()` will return an error if they do not + have the same element size. + + The source and destination object may not overlap. If overlapping + source and destination objects are specified, undefined behavior will + result. + + The source object must lie entirely within the region defined by + `srcPos` and `extent`. The destination object must lie entirely within + the region defined by `dstPos` and `extent`. - On systems where :py:obj:`~.pageableMemoryAccessUsesHostPageTables` is - true, :py:obj:`~.cudaMallocHost` may not page-lock the allocated - memory. + :py:obj:`~.cudaMemcpy3DAsync()` returns an error if the pitch of + `srcPtr` or `dstPtr` exceeds the maximum allowed. The pitch of a + :py:obj:`~.cudaPitchedPtr` allocated with :py:obj:`~.cudaMalloc3D()` + will always be valid. - Page-locking excessive amounts of memory with - :py:obj:`~.cudaMallocHost()` may degrade system performance, since it - reduces the amount of memory available to the system for paging. As a - result, this function is best used sparingly to allocate staging areas - for data exchange between host and device. + :py:obj:`~.cudaMemcpy3DAsync()` is asynchronous with respect to the + host, so the call may return before the copy is complete. The copy can + optionally be associated to a stream by passing a non-zero `stream` + argument. If `kind` is :py:obj:`~.cudaMemcpyHostToDevice` or + :py:obj:`~.cudaMemcpyDeviceToHost` and `stream` is non-zero, the copy + may overlap with operations in other streams. + + The device version of this function only handles device to device + copies and cannot be given local or shared pointers. Parameters ---------- - size : size_t - Requested allocation size in bytes + p : :py:obj:`~.cudaMemcpy3DParms` + 3D memory copy parameters + stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + Stream identifier Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorMemoryAllocation` - ptr : Any - Pointer to allocated host memory + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidPitchValue`, :py:obj:`~.cudaErrorInvalidMemcpyDirection` See Also -------- - :py:obj:`~.cudaMalloc`, :py:obj:`~.cudaMallocPitch`, :py:obj:`~.cudaMallocArray`, :py:obj:`~.cudaMalloc3D`, :py:obj:`~.cudaMalloc3DArray`, :py:obj:`~.cudaHostAlloc`, :py:obj:`~.cudaFree`, :py:obj:`~.cudaFreeArray`, cudaMallocHost (C++ API), :py:obj:`~.cudaFreeHost`, :py:obj:`~.cudaHostAlloc`, :py:obj:`~.cuMemAllocHost` + :py:obj:`~.cudaMalloc3D`, :py:obj:`~.cudaMalloc3DArray`, :py:obj:`~.cudaMemset3D`, :py:obj:`~.cudaMemcpy3D`, :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpy2D`, :py:obj:`~.cudaMemcpy2DToArray`, ::::py:obj:`~.cudaMemcpy2DFromArray`, :py:obj:`~.cudaMemcpy2DArrayToArray`, :py:obj:`~.cudaMemcpyToSymbol`, :py:obj:`~.cudaMemcpyFromSymbol`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpy2DAsync`, :py:obj:`~.cudaMemcpy2DToArrayAsync`, :py:obj:`~.cudaMemcpy2DFromArrayAsync`, :py:obj:`~.cudaMemcpyToSymbolAsync`, :py:obj:`~.cudaMemcpyFromSymbolAsync`, :py:obj:`~.make_cudaExtent`, :py:obj:`~.make_cudaPos`, :py:obj:`~.cuMemcpy3DAsync` """ - cdef void_ptr ptr = 0 - err = ccudart.cudaMallocHost(&ptr, size) - return (cudaError_t(err), ptr) -{{endif}} - -{{if 'cudaMallocPitch' in found_functions}} + cdef cyruntime.cudaStream_t cystream + if stream is None: + pstream = 0 + elif isinstance(stream, (cudaStream_t,driver.CUstream)): + pstream = int(stream) + else: + pstream = int(cudaStream_t(stream)) + cystream = pstream + cdef cyruntime.cudaMemcpy3DParms* cyp_ptr = p._pvt_ptr if p is not None else NULL + with nogil: + err = cyruntime.cudaMemcpy3DAsync(cyp_ptr, cystream) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaMallocPitch(size_t width, size_t height): - """ Allocates pitched memory on the device. - - Allocates at least `width` (in bytes) * `height` bytes of linear memory - on the device and returns in `*devPtr` a pointer to the allocated - memory. The function may pad the allocation to ensure that - corresponding pointers in any given row will continue to meet the - alignment requirements for coalescing as the address is updated from - row to row. The pitch returned in `*pitch` by - :py:obj:`~.cudaMallocPitch()` is the width in bytes of the allocation. - The intended usage of `pitch` is as a separate parameter of the - allocation, used to compute addresses within the 2D array. Given the - row and column of an array element of type `T`, the address is computed - as: - - **View CUDA Toolkit Documentation for a C++ code example** +def cudaMemcpy3DPeerAsync(p : Optional[cudaMemcpy3DPeerParms], stream): + """ Copies memory between devices asynchronously. - For allocations of 2D arrays, it is recommended that programmers - consider performing pitch allocations using - :py:obj:`~.cudaMallocPitch()`. Due to pitch alignment restrictions in - the hardware, this is especially true if the application will be - performing 2D memory copies between different regions of device memory - (whether linear memory or CUDA arrays). + Perform a 3D memory copy according to the parameters specified in `p`. + See the definition of the :py:obj:`~.cudaMemcpy3DPeerParms` structure + for documentation of its parameters. Parameters ---------- - width : size_t - Requested pitched allocation width (in bytes) - height : size_t - Requested pitched allocation height + p : :py:obj:`~.cudaMemcpy3DPeerParms` + Parameters for the memory copy + stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + Stream identifier Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorMemoryAllocation` - devPtr : Any - Pointer to allocated pitched device memory - pitch : int - Pitch for allocation + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidDevice`, :py:obj:`~.cudaErrorInvalidPitchValue` See Also -------- - :py:obj:`~.cudaMalloc`, :py:obj:`~.cudaFree`, :py:obj:`~.cudaMallocArray`, :py:obj:`~.cudaFreeArray`, :py:obj:`~.cudaMallocHost (C API)`, :py:obj:`~.cudaFreeHost`, :py:obj:`~.cudaMalloc3D`, :py:obj:`~.cudaMalloc3DArray`, :py:obj:`~.cudaHostAlloc`, :py:obj:`~.cuMemAllocPitch` + :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpyPeer`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpyPeerAsync`, :py:obj:`~.cudaMemcpy3DPeerAsync`, :py:obj:`~.cuMemcpy3DPeerAsync` """ - cdef void_ptr devPtr = 0 - cdef size_t pitch = 0 - err = ccudart.cudaMallocPitch(&devPtr, &pitch, width, height) - return (cudaError_t(err), devPtr, pitch) -{{endif}} - -{{if 'cudaMallocArray' in found_functions}} + cdef cyruntime.cudaStream_t cystream + if stream is None: + pstream = 0 + elif isinstance(stream, (cudaStream_t,driver.CUstream)): + pstream = int(stream) + else: + pstream = int(cudaStream_t(stream)) + cystream = pstream + cdef cyruntime.cudaMemcpy3DPeerParms* cyp_ptr = p._pvt_ptr if p is not None else NULL + with nogil: + err = cyruntime.cudaMemcpy3DPeerAsync(cyp_ptr, cystream) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaMallocArray(desc : Optional[cudaChannelFormatDesc], size_t width, size_t height, unsigned int flags): - """ Allocate an array on the device. - - Allocates a CUDA array according to the - :py:obj:`~.cudaChannelFormatDesc` structure `desc` and returns a handle - to the new CUDA array in `*array`. - - The :py:obj:`~.cudaChannelFormatDesc` is defined as: - - **View CUDA Toolkit Documentation for a C++ code example** - - where :py:obj:`~.cudaChannelFormatKind` is one of - :py:obj:`~.cudaChannelFormatKindSigned`, - :py:obj:`~.cudaChannelFormatKindUnsigned`, or - :py:obj:`~.cudaChannelFormatKindFloat`. - - The `flags` parameter enables different options to be specified that - affect the allocation, as follows. - - - :py:obj:`~.cudaArrayDefault`: This flag's value is defined to be 0 - and provides default array allocation - - - :py:obj:`~.cudaArraySurfaceLoadStore`: Allocates an array that can be - read from or written to using a surface reference - - - :py:obj:`~.cudaArrayTextureGather`: This flag indicates that texture - gather operations will be performed on the array. - - - :py:obj:`~.cudaArraySparse`: Allocates a CUDA array without physical - backing memory. The subregions within this sparse array can later be - mapped onto a physical memory allocation by calling - :py:obj:`~.cuMemMapArrayAsync`. The physical backing memory must be - allocated via :py:obj:`~.cuMemCreate`. - - - :py:obj:`~.cudaArrayDeferredMapping`: Allocates a CUDA array without - physical backing memory. The entire array can later be mapped onto a - physical memory allocation by calling :py:obj:`~.cuMemMapArrayAsync`. - The physical backing memory must be allocated via - :py:obj:`~.cuMemCreate`. +def cudaMemGetInfo(): + """ Gets free and total device memory. - `width` and `height` must meet certain size requirements. See - :py:obj:`~.cudaMalloc3DArray()` for more details. + Returns in `*total` the total amount of memory available to the the + current context. Returns in `*free` the amount of memory on the device + that is free according to the OS. CUDA is not guaranteed to be able to + allocate all of the memory that the OS reports as free. In a multi- + tenet situation, free estimate returned is prone to race condition + where a new allocation/free done by a different process or a different + thread in the same process between the time when free memory was + estimated and reported, will result in deviation in free value reported + and actual free memory. - Parameters - ---------- - desc : :py:obj:`~.cudaChannelFormatDesc` - Requested channel format - width : size_t - Requested array allocation width - height : size_t - Requested array allocation height - flags : unsigned int - Requested properties of allocated array + The integrated GPU on Tegra shares memory with CPU and other component + of the SoC. The free and total values returned by the API excludes the + SWAP memory space maintained by the OS on some platforms. The OS may + move some of the memory pages into swap area as the GPU or CPU allocate + or access memory. See Tegra app note on how to calculate total and free + memory on Tegra. Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorMemoryAllocation` - array : :py:obj:`~.cudaArray_t` - Pointer to allocated array in device memory + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorLaunchFailure` + free : int + Returned free memory in bytes + total : int + Returned total memory in bytes See Also -------- - :py:obj:`~.cudaMalloc`, :py:obj:`~.cudaMallocPitch`, :py:obj:`~.cudaFree`, :py:obj:`~.cudaFreeArray`, :py:obj:`~.cudaMallocHost (C API)`, :py:obj:`~.cudaFreeHost`, :py:obj:`~.cudaMalloc3D`, :py:obj:`~.cudaMalloc3DArray`, :py:obj:`~.cudaHostAlloc`, :py:obj:`~.cuArrayCreate` + :py:obj:`~.cuMemGetInfo` """ - cdef cudaArray_t array = cudaArray_t() - cdef ccudart.cudaChannelFormatDesc* cdesc_ptr = desc._ptr if desc != None else NULL + cdef size_t free = 0 + cdef size_t total = 0 with nogil: - err = ccudart.cudaMallocArray(array._ptr, cdesc_ptr, width, height, flags) - - return (cudaError_t(err), array) -{{endif}} - -{{if 'cudaFree' in found_functions}} + err = cyruntime.cudaMemGetInfo(&free, &total) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None, None) + return (_cudaError_t_SUCCESS, free, total) @cython.embedsignature(True) -def cudaFree(devPtr): - """ Frees memory on the device. - - Frees the memory space pointed to by `devPtr`, which must have been - returned by a previous call to one of the following memory allocation - APIs - :py:obj:`~.cudaMalloc()`, :py:obj:`~.cudaMallocPitch()`, - :py:obj:`~.cudaMallocManaged()`, :py:obj:`~.cudaMallocAsync()`, - :py:obj:`~.cudaMallocFromPoolAsync()`. - - Note - This API will not perform any implicit synchronization when the - pointer was allocated with :py:obj:`~.cudaMallocAsync` or - :py:obj:`~.cudaMallocFromPoolAsync`. Callers must ensure that all - accesses to the pointer have completed before invoking - :py:obj:`~.cudaFree`. For best performance and memory reuse, users - should use :py:obj:`~.cudaFreeAsync` to free memory allocated via the - stream ordered memory allocator. +def cudaArrayGetInfo(array): + """ Gets info about the specified cudaArray. - If :py:obj:`~.cudaFree`(`devPtr`) has already been called before, an - error is returned. If `devPtr` is 0, no operation is performed. - :py:obj:`~.cudaFree()` returns :py:obj:`~.cudaErrorValue` in case of - failure. + Returns in `*desc`, `*extent` and `*flags` respectively, the type, + shape and flags of `array`. - The device version of :py:obj:`~.cudaFree` cannot be used with a - `*devPtr` allocated using the host API, and vice versa. + Any of `*desc`, `*extent` and `*flags` may be specified as NULL. Parameters ---------- - devPtr : Any - Device pointer to memory to free + array : :py:obj:`~.cudaArray_t` + The :py:obj:`~.cudaArray` to get info for Returns ------- cudaError_t :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + desc : :py:obj:`~.cudaChannelFormatDesc` + Returned array type + extent : :py:obj:`~.cudaExtent` + Returned array shape. 2D arrays will have depth of zero + flags : unsigned int + Returned array flags See Also -------- - :py:obj:`~.cudaMalloc`, :py:obj:`~.cudaMallocPitch`, :py:obj:`~.cudaMallocManaged`, :py:obj:`~.cudaMallocArray`, :py:obj:`~.cudaFreeArray`, :py:obj:`~.cudaMallocAsync`, :py:obj:`~.cudaMallocFromPoolAsync` :py:obj:`~.cudaMallocHost (C API)`, :py:obj:`~.cudaFreeHost`, :py:obj:`~.cudaMalloc3D`, :py:obj:`~.cudaMalloc3DArray`, :py:obj:`~.cudaFreeAsync` :py:obj:`~.cudaHostAlloc`, :py:obj:`~.cuMemFree` + :py:obj:`~.cuArrayGetDescriptor`, :py:obj:`~.cuArray3DGetDescriptor` """ - cdevPtr = utils.HelperInputVoidPtr(devPtr) - cdef void* cdevPtr_ptr = cdevPtr.cptr + cdef cyruntime.cudaArray_t cyarray + if array is None: + parray = 0 + elif isinstance(array, (cudaArray_t,)): + parray = int(array) + else: + parray = int(cudaArray_t(array)) + cyarray = parray + cdef cudaChannelFormatDesc desc = cudaChannelFormatDesc() + cdef cudaExtent extent = cudaExtent() + cdef unsigned int flags = 0 with nogil: - err = ccudart.cudaFree(cdevPtr_ptr) + err = cyruntime.cudaArrayGetInfo(desc._pvt_ptr, extent._pvt_ptr, &flags, cyarray) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None, None, None) + return (_cudaError_t_SUCCESS, desc, extent, flags) - return (cudaError_t(err),) -{{endif}} +@cython.embedsignature(True) +def cudaArrayGetPlane(hArray, unsigned int planeIdx): + """ Gets a CUDA array plane from a CUDA array. -{{if 'cudaFreeHost' in found_functions}} + Returns in `pPlaneArray` a CUDA array that represents a single format + plane of the CUDA array `hArray`. -@cython.embedsignature(True) -def cudaFreeHost(ptr): - """ Frees page-locked memory. + If `planeIdx` is greater than the maximum number of planes in this + array or if the array does not have a multi-planar format e.g: + :py:obj:`~.cudaChannelFormatKindNV12`, then + :py:obj:`~.cudaErrorInvalidValue` is returned. - Frees the memory space pointed to by `hostPtr`, which must have been - returned by a previous call to :py:obj:`~.cudaMallocHost()` or - :py:obj:`~.cudaHostAlloc()`. + Note that if the `hArray` has format + :py:obj:`~.cudaChannelFormatKindNV12`, then passing in 0 for `planeIdx` + returns a CUDA array of the same size as `hArray` but with one 8-bit + channel and :py:obj:`~.cudaChannelFormatKindUnsigned` as its format + kind. If 1 is passed for `planeIdx`, then the returned CUDA array has + half the height and width of `hArray` with two 8-bit channels and + :py:obj:`~.cudaChannelFormatKindUnsigned` as its format kind. Parameters ---------- - ptr : Any - Pointer to memory to free + hArray : :py:obj:`~.cudaArray_t` + CUDA array + planeIdx : unsigned int + Plane index Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :py:obj:`~.cudaErrorInvalidResourceHandle` + pPlaneArray : :py:obj:`~.cudaArray_t` + Returned CUDA array referenced by the `planeIdx` See Also -------- - :py:obj:`~.cudaMalloc`, :py:obj:`~.cudaMallocPitch`, :py:obj:`~.cudaFree`, :py:obj:`~.cudaMallocArray`, :py:obj:`~.cudaFreeArray`, :py:obj:`~.cudaMallocHost (C API)`, :py:obj:`~.cudaMalloc3D`, :py:obj:`~.cudaMalloc3DArray`, :py:obj:`~.cudaHostAlloc`, :py:obj:`~.cuMemFreeHost` + :py:obj:`~.cuArrayGetPlane` """ - cptr = utils.HelperInputVoidPtr(ptr) - cdef void* cptr_ptr = cptr.cptr + cdef cyruntime.cudaArray_t cyhArray + if hArray is None: + phArray = 0 + elif isinstance(hArray, (cudaArray_t,)): + phArray = int(hArray) + else: + phArray = int(cudaArray_t(hArray)) + cyhArray = phArray + cdef cudaArray_t pPlaneArray = cudaArray_t() with nogil: - err = ccudart.cudaFreeHost(cptr_ptr) - - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaFreeArray' in found_functions}} + err = cyruntime.cudaArrayGetPlane(pPlaneArray._pvt_ptr, cyhArray, planeIdx) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, pPlaneArray) @cython.embedsignature(True) -def cudaFreeArray(array): - """ Frees an array on the device. +def cudaArrayGetMemoryRequirements(array, int device): + """ Returns the memory requirements of a CUDA array. - Frees the CUDA array `array`, which must have been returned by a - previous call to :py:obj:`~.cudaMallocArray()`. If `devPtr` is 0, no - operation is performed. + Returns the memory requirements of a CUDA array in `memoryRequirements` + If the CUDA array is not allocated with flag + :py:obj:`~.cudaArrayDeferredMapping` :py:obj:`~.cudaErrorInvalidValue` + will be returned. + + The returned value in :py:obj:`~.cudaArrayMemoryRequirements.size` + represents the total size of the CUDA array. The returned value in + :py:obj:`~.cudaArrayMemoryRequirements.alignment` represents the + alignment necessary for mapping the CUDA array. Parameters ---------- array : :py:obj:`~.cudaArray_t` - Pointer to array to free + CUDA array to get the memory requirements of + device : int + Device to get the memory requirements for Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + :py:obj:`~.cudaSuccess` :py:obj:`~.cudaErrorInvalidValue` + memoryRequirements : :py:obj:`~.cudaArrayMemoryRequirements` + Pointer to :py:obj:`~.cudaArrayMemoryRequirements` See Also -------- - :py:obj:`~.cudaMalloc`, :py:obj:`~.cudaMallocPitch`, :py:obj:`~.cudaFree`, :py:obj:`~.cudaMallocArray`, :py:obj:`~.cudaMallocHost (C API)`, :py:obj:`~.cudaFreeHost`, :py:obj:`~.cudaHostAlloc`, :py:obj:`~.cuArrayDestroy` + :py:obj:`~.cudaMipmappedArrayGetMemoryRequirements` """ - cdef ccudart.cudaArray_t carray + cdef cyruntime.cudaArray_t cyarray if array is None: - carray = 0 + parray = 0 elif isinstance(array, (cudaArray_t,)): parray = int(array) - carray = parray else: parray = int(cudaArray_t(array)) - carray = parray + cyarray = parray + cdef cudaArrayMemoryRequirements memoryRequirements = cudaArrayMemoryRequirements() with nogil: - err = ccudart.cudaFreeArray(carray) - - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaFreeMipmappedArray' in found_functions}} + err = cyruntime.cudaArrayGetMemoryRequirements(memoryRequirements._pvt_ptr, cyarray, device) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, memoryRequirements) @cython.embedsignature(True) -def cudaFreeMipmappedArray(mipmappedArray): - """ Frees a mipmapped array on the device. +def cudaMipmappedArrayGetMemoryRequirements(mipmap, int device): + """ Returns the memory requirements of a CUDA mipmapped array. - Frees the CUDA mipmapped array `mipmappedArray`, which must have been - returned by a previous call to :py:obj:`~.cudaMallocMipmappedArray()`. - If `devPtr` is 0, no operation is performed. + Returns the memory requirements of a CUDA mipmapped array in + `memoryRequirements` If the CUDA mipmapped array is not allocated with + flag :py:obj:`~.cudaArrayDeferredMapping` + :py:obj:`~.cudaErrorInvalidValue` will be returned. + + The returned value in :py:obj:`~.cudaArrayMemoryRequirements.size` + represents the total size of the CUDA mipmapped array. The returned + value in :py:obj:`~.cudaArrayMemoryRequirements.alignment` represents + the alignment necessary for mapping the CUDA mipmapped array. Parameters ---------- - mipmappedArray : :py:obj:`~.cudaMipmappedArray_t` - Pointer to mipmapped array to free + mipmap : :py:obj:`~.cudaMipmappedArray_t` + CUDA mipmapped array to get the memory requirements of + device : int + Device to get the memory requirements for Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + :py:obj:`~.cudaSuccess` :py:obj:`~.cudaErrorInvalidValue` + memoryRequirements : :py:obj:`~.cudaArrayMemoryRequirements` + Pointer to :py:obj:`~.cudaArrayMemoryRequirements` See Also -------- - :py:obj:`~.cudaMalloc`, :py:obj:`~.cudaMallocPitch`, :py:obj:`~.cudaFree`, :py:obj:`~.cudaMallocArray`, :py:obj:`~.cudaMallocHost (C API)`, :py:obj:`~.cudaFreeHost`, :py:obj:`~.cudaHostAlloc`, :py:obj:`~.cuMipmappedArrayDestroy` + :py:obj:`~.cudaArrayGetMemoryRequirements` """ - cdef ccudart.cudaMipmappedArray_t cmipmappedArray - if mipmappedArray is None: - cmipmappedArray = 0 - elif isinstance(mipmappedArray, (cudaMipmappedArray_t,)): - pmipmappedArray = int(mipmappedArray) - cmipmappedArray = pmipmappedArray + cdef cyruntime.cudaMipmappedArray_t cymipmap + if mipmap is None: + pmipmap = 0 + elif isinstance(mipmap, (cudaMipmappedArray_t,)): + pmipmap = int(mipmap) else: - pmipmappedArray = int(cudaMipmappedArray_t(mipmappedArray)) - cmipmappedArray = pmipmappedArray - err = ccudart.cudaFreeMipmappedArray(cmipmappedArray) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaHostAlloc' in found_functions}} + pmipmap = int(cudaMipmappedArray_t(mipmap)) + cymipmap = pmipmap + cdef cudaArrayMemoryRequirements memoryRequirements = cudaArrayMemoryRequirements() + with nogil: + err = cyruntime.cudaMipmappedArrayGetMemoryRequirements(memoryRequirements._pvt_ptr, cymipmap, device) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, memoryRequirements) @cython.embedsignature(True) -def cudaHostAlloc(size_t size, unsigned int flags): - """ Allocates page-locked memory on the host. - - Allocates `size` bytes of host memory that is page-locked and - accessible to the device. The driver tracks the virtual memory ranges - allocated with this function and automatically accelerates calls to - functions such as :py:obj:`~.cudaMemcpy()`. Since the memory can be - accessed directly by the device, it can be read or written with much - higher bandwidth than pageable memory obtained with functions such as - :py:obj:`~.malloc()`. Allocating excessive amounts of pinned memory may - degrade system performance, since it reduces the amount of memory - available to the system for paging. As a result, this function is best - used sparingly to allocate staging areas for data exchange between host - and device. - - The `flags` parameter enables different options to be specified that - affect the allocation, as follows. - - - :py:obj:`~.cudaHostAllocDefault`: This flag's value is defined to be - 0 and causes :py:obj:`~.cudaHostAlloc()` to emulate - :py:obj:`~.cudaMallocHost()`. - - - :py:obj:`~.cudaHostAllocPortable`: The memory returned by this call - will be considered as pinned memory by all CUDA contexts, not just - the one that performed the allocation. - - - :py:obj:`~.cudaHostAllocMapped`: Maps the allocation into the CUDA - address space. The device pointer to the memory may be obtained by - calling :py:obj:`~.cudaHostGetDevicePointer()`. - - - :py:obj:`~.cudaHostAllocWriteCombined`: Allocates the memory as - write-combined (WC). WC memory can be transferred across the PCI - Express bus more quickly on some system configurations, but cannot be - read efficiently by most CPUs. WC memory is a good option for buffers - that will be written by the CPU and read by the device via mapped - pinned memory or host->device transfers. - - All of these flags are orthogonal to one another: a developer may - allocate memory that is portable, mapped and/or write-combined with no - restrictions. - - In order for the :py:obj:`~.cudaHostAllocMapped` flag to have any - effect, the CUDA context must support the :py:obj:`~.cudaDeviceMapHost` - flag, which can be checked via :py:obj:`~.cudaGetDeviceFlags()`. The - :py:obj:`~.cudaDeviceMapHost` flag is implicitly set for contexts - created via the runtime API. +def cudaArrayGetSparseProperties(array): + """ Returns the layout properties of a sparse CUDA array. - The :py:obj:`~.cudaHostAllocMapped` flag may be specified on CUDA - contexts for devices that do not support mapped pinned memory. The - failure is deferred to :py:obj:`~.cudaHostGetDevicePointer()` because - the memory may be mapped into other CUDA contexts via the - :py:obj:`~.cudaHostAllocPortable` flag. + Returns the layout properties of a sparse CUDA array in + `sparseProperties`. If the CUDA array is not allocated with flag + :py:obj:`~.cudaArraySparse` :py:obj:`~.cudaErrorInvalidValue` will be + returned. - Memory allocated by this function must be freed with - :py:obj:`~.cudaFreeHost()`. + If the returned value in :py:obj:`~.cudaArraySparseProperties.flags` + contains :py:obj:`~.cudaArraySparsePropertiesSingleMipTail`, then + :py:obj:`~.cudaArraySparseProperties.miptailSize` represents the total + size of the array. Otherwise, it will be zero. Also, the returned value + in :py:obj:`~.cudaArraySparseProperties.miptailFirstLevel` is always + zero. Note that the `array` must have been allocated using + :py:obj:`~.cudaMallocArray` or :py:obj:`~.cudaMalloc3DArray`. For CUDA + arrays obtained using :py:obj:`~.cudaMipmappedArrayGetLevel`, + :py:obj:`~.cudaErrorInvalidValue` will be returned. Instead, + :py:obj:`~.cudaMipmappedArrayGetSparseProperties` must be used to + obtain the sparse properties of the entire CUDA mipmapped array to + which `array` belongs to. Parameters ---------- - size : size_t - Requested allocation size in bytes - flags : unsigned int - Requested properties of allocated memory + array : :py:obj:`~.cudaArray_t` + The CUDA array to get the sparse properties of Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorMemoryAllocation` - pHost : Any - Device pointer to allocated memory + :py:obj:`~.cudaSuccess` :py:obj:`~.cudaErrorInvalidValue` + sparseProperties : :py:obj:`~.cudaArraySparseProperties` + Pointer to return the :py:obj:`~.cudaArraySparseProperties` See Also -------- - :py:obj:`~.cudaSetDeviceFlags`, :py:obj:`~.cudaMallocHost (C API)`, :py:obj:`~.cudaFreeHost`, :py:obj:`~.cudaGetDeviceFlags`, :py:obj:`~.cuMemHostAlloc` + :py:obj:`~.cudaMipmappedArrayGetSparseProperties`, :py:obj:`~.cuMemMapArrayAsync` """ - cdef void_ptr pHost = 0 + cdef cyruntime.cudaArray_t cyarray + if array is None: + parray = 0 + elif isinstance(array, (cudaArray_t,)): + parray = int(array) + else: + parray = int(cudaArray_t(array)) + cyarray = parray + cdef cudaArraySparseProperties sparseProperties = cudaArraySparseProperties() with nogil: - err = ccudart.cudaHostAlloc(&pHost, size, flags) - - return (cudaError_t(err), pHost) -{{endif}} - -{{if 'cudaHostRegister' in found_functions}} + err = cyruntime.cudaArrayGetSparseProperties(sparseProperties._pvt_ptr, cyarray) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, sparseProperties) @cython.embedsignature(True) -def cudaHostRegister(ptr, size_t size, unsigned int flags): - """ Registers an existing host memory range for use by CUDA. - - Page-locks the memory range specified by `ptr` and `size` and maps it - for the device(s) as specified by `flags`. This memory range also is - added to the same tracking mechanism as :py:obj:`~.cudaHostAlloc()` to - automatically accelerate calls to functions such as - :py:obj:`~.cudaMemcpy()`. Since the memory can be accessed directly by - the device, it can be read or written with much higher bandwidth than - pageable memory that has not been registered. Page-locking excessive - amounts of memory may degrade system performance, since it reduces the - amount of memory available to the system for paging. As a result, this - function is best used sparingly to register staging areas for data - exchange between host and device. +def cudaMipmappedArrayGetSparseProperties(mipmap): + """ Returns the layout properties of a sparse CUDA mipmapped array. - On systems where :py:obj:`~.pageableMemoryAccessUsesHostPageTables` is - true, :py:obj:`~.cudaHostRegister` will not page-lock the memory range - specified by `ptr` but only populate unpopulated pages. + Returns the sparse array layout properties in `sparseProperties`. If + the CUDA mipmapped array is not allocated with flag + :py:obj:`~.cudaArraySparse` :py:obj:`~.cudaErrorInvalidValue` will be + returned. - :py:obj:`~.cudaHostRegister` is supported only on I/O coherent devices - that have a non-zero value for the device attribute - :py:obj:`~.cudaDevAttrHostRegisterSupported`. + For non-layered CUDA mipmapped arrays, + :py:obj:`~.cudaArraySparseProperties.miptailSize` returns the size of + the mip tail region. The mip tail region includes all mip levels whose + width, height or depth is less than that of the tile. For layered CUDA + mipmapped arrays, if :py:obj:`~.cudaArraySparseProperties.flags` + contains :py:obj:`~.cudaArraySparsePropertiesSingleMipTail`, then + :py:obj:`~.cudaArraySparseProperties.miptailSize` specifies the size of + the mip tail of all layers combined. Otherwise, + :py:obj:`~.cudaArraySparseProperties.miptailSize` specifies mip tail + size per layer. The returned value of + :py:obj:`~.cudaArraySparseProperties.miptailFirstLevel` is valid only + if :py:obj:`~.cudaArraySparseProperties.miptailSize` is non-zero. - The `flags` parameter enables different options to be specified that - affect the allocation, as follows. + Parameters + ---------- + mipmap : :py:obj:`~.cudaMipmappedArray_t` + The CUDA mipmapped array to get the sparse properties of - - :py:obj:`~.cudaHostRegisterDefault`: On a system with unified virtual - addressing, the memory will be both mapped and portable. On a system - with no unified virtual addressing, the memory will be neither mapped - nor portable. + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess` :py:obj:`~.cudaErrorInvalidValue` + sparseProperties : :py:obj:`~.cudaArraySparseProperties` + Pointer to return :py:obj:`~.cudaArraySparseProperties` - - :py:obj:`~.cudaHostRegisterPortable`: The memory returned by this - call will be considered as pinned memory by all CUDA contexts, not - just the one that performed the allocation. + See Also + -------- + :py:obj:`~.cudaArrayGetSparseProperties`, :py:obj:`~.cuMemMapArrayAsync` + """ + cdef cyruntime.cudaMipmappedArray_t cymipmap + if mipmap is None: + pmipmap = 0 + elif isinstance(mipmap, (cudaMipmappedArray_t,)): + pmipmap = int(mipmap) + else: + pmipmap = int(cudaMipmappedArray_t(mipmap)) + cymipmap = pmipmap + cdef cudaArraySparseProperties sparseProperties = cudaArraySparseProperties() + with nogil: + err = cyruntime.cudaMipmappedArrayGetSparseProperties(sparseProperties._pvt_ptr, cymipmap) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, sparseProperties) - - :py:obj:`~.cudaHostRegisterMapped`: Maps the allocation into the CUDA - address space. The device pointer to the memory may be obtained by - calling :py:obj:`~.cudaHostGetDevicePointer()`. +@cython.embedsignature(True) +def cudaMemcpy(dst, src, size_t count, kind not None : cudaMemcpyKind): + """ Copies data between host and device. - - :py:obj:`~.cudaHostRegisterIoMemory`: The passed memory pointer is - treated as pointing to some memory-mapped I/O space, e.g. belonging - to a third-party PCIe device, and it will marked as non cache- - coherent and contiguous. + Copies `count` bytes from the memory area pointed to by `src` to the + memory area pointed to by `dst`, where `kind` specifies the direction + of the copy, and must be one of :py:obj:`~.cudaMemcpyHostToHost`, + :py:obj:`~.cudaMemcpyHostToDevice`, :py:obj:`~.cudaMemcpyDeviceToHost`, + :py:obj:`~.cudaMemcpyDeviceToDevice`, or :py:obj:`~.cudaMemcpyDefault`. + Passing :py:obj:`~.cudaMemcpyDefault` is recommended, in which case the + type of transfer is inferred from the pointer values. However, + :py:obj:`~.cudaMemcpyDefault` is only allowed on systems that support + unified virtual addressing. Calling :py:obj:`~.cudaMemcpy()` with dst + and src pointers that do not match the direction of the copy results in + an undefined behavior. - - :py:obj:`~.cudaHostRegisterReadOnly`: The passed memory pointer is - treated as pointing to memory that is considered read-only by the - device. On platforms without - :py:obj:`~.cudaDevAttrPageableMemoryAccessUsesHostPageTables`, this - flag is required in order to register memory mapped to the CPU as - read-only. Support for the use of this flag can be queried from the - device attribute cudaDeviceAttrReadOnlyHostRegisterSupported. Using - this flag with a current context associated with a device that does - not have this attribute set will cause :py:obj:`~.cudaHostRegister` - to error with cudaErrorNotSupported. + \note_sync - All of these flags are orthogonal to one another: a developer may page- - lock memory that is portable or mapped with no restrictions. + Parameters + ---------- + dst : Any + Destination memory address + src : Any + Source memory address + count : size_t + Size in bytes to copy + kind : :py:obj:`~.cudaMemcpyKind` + Type of transfer - The CUDA context must have been created with the - :py:obj:`~.cudaMapHost` flag in order for the - :py:obj:`~.cudaHostRegisterMapped` flag to have any effect. + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidMemcpyDirection` - The :py:obj:`~.cudaHostRegisterMapped` flag may be specified on CUDA - contexts for devices that do not support mapped pinned memory. The - failure is deferred to :py:obj:`~.cudaHostGetDevicePointer()` because - the memory may be mapped into other CUDA contexts via the - :py:obj:`~.cudaHostRegisterPortable` flag. + See Also + -------- + :py:obj:`~.cudaMemcpy2D`, :py:obj:`~.cudaMemcpy2DToArray`, :py:obj:`~.cudaMemcpy2DFromArray`, :py:obj:`~.cudaMemcpy2DArrayToArray`, :py:obj:`~.cudaMemcpyToSymbol`, :py:obj:`~.cudaMemcpyFromSymbol`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpy2DAsync`, :py:obj:`~.cudaMemcpy2DToArrayAsync`, :py:obj:`~.cudaMemcpy2DFromArrayAsync`, :py:obj:`~.cudaMemcpyToSymbolAsync`, :py:obj:`~.cudaMemcpyFromSymbolAsync`, :py:obj:`~.cuMemcpyDtoH`, :py:obj:`~.cuMemcpyHtoD`, :py:obj:`~.cuMemcpyDtoD`, :py:obj:`~.cuMemcpy` + """ + cdef _HelperInputVoidPtrStruct cydstHelper + cdef void* cydst = _helper_input_void_ptr(dst, &cydstHelper) + cdef _HelperInputVoidPtrStruct cysrcHelper + cdef void* cysrc = _helper_input_void_ptr(src, &cysrcHelper) + cdef cyruntime.cudaMemcpyKind cykind = int(kind) + with nogil: + err = cyruntime.cudaMemcpy(cydst, cysrc, count, cykind) + _helper_input_void_ptr_free(&cydstHelper) + _helper_input_void_ptr_free(&cysrcHelper) + return (_cudaError_t(err),) - For devices that have a non-zero value for the device attribute - :py:obj:`~.cudaDevAttrCanUseHostPointerForRegisteredMem`, the memory - can also be accessed from the device using the host pointer `ptr`. The - device pointer returned by :py:obj:`~.cudaHostGetDevicePointer()` may - or may not match the original host pointer `ptr` and depends on the - devices visible to the application. If all devices visible to the - application have a non-zero value for the device attribute, the device - pointer returned by :py:obj:`~.cudaHostGetDevicePointer()` will match - the original pointer `ptr`. If any device visible to the application - has a zero value for the device attribute, the device pointer returned - by :py:obj:`~.cudaHostGetDevicePointer()` will not match the original - host pointer `ptr`, but it will be suitable for use on all devices - provided Unified Virtual Addressing is enabled. In such systems, it is - valid to access the memory using either pointer on devices that have a - non-zero value for the device attribute. Note however that such devices - should access the memory using only of the two pointers and not both. +@cython.embedsignature(True) +def cudaMemcpyPeer(dst, int dstDevice, src, int srcDevice, size_t count): + """ Copies memory between two devices. - The memory page-locked by this function must be unregistered with - :py:obj:`~.cudaHostUnregister()`. + Copies memory from one device to memory on another device. `dst` is the + base device pointer of the destination memory and `dstDevice` is the + destination device. `src` is the base device pointer of the source + memory and `srcDevice` is the source device. `count` specifies the + number of bytes to copy. + + Note that this function is asynchronous with respect to the host, but + serialized with respect all pending and future asynchronous work in to + the current device, `srcDevice`, and `dstDevice` (use + :py:obj:`~.cudaMemcpyPeerAsync` to avoid this synchronization). Parameters ---------- - ptr : Any - Host pointer to memory to page-lock - size : size_t - Size in bytes of the address range to page-lock in bytes - flags : unsigned int - Flags for allocation request + dst : Any + Destination device pointer + dstDevice : int + Destination device + src : Any + Source device pointer + srcDevice : int + Source device + count : size_t + Size of memory copy in bytes Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorMemoryAllocation`, :py:obj:`~.cudaErrorHostMemoryAlreadyRegistered`, :py:obj:`~.cudaErrorNotSupported` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidDevice` See Also -------- - :py:obj:`~.cudaHostUnregister`, :py:obj:`~.cudaHostGetFlags`, :py:obj:`~.cudaHostGetDevicePointer`, :py:obj:`~.cuMemHostRegister` + :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpyPeerAsync`, :py:obj:`~.cudaMemcpy3DPeerAsync`, :py:obj:`~.cuMemcpyPeer` """ - cptr = utils.HelperInputVoidPtr(ptr) - cdef void* cptr_ptr = cptr.cptr + cdef _HelperInputVoidPtrStruct cydstHelper + cdef void* cydst = _helper_input_void_ptr(dst, &cydstHelper) + cdef _HelperInputVoidPtrStruct cysrcHelper + cdef void* cysrc = _helper_input_void_ptr(src, &cysrcHelper) with nogil: - err = ccudart.cudaHostRegister(cptr_ptr, size, flags) - - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaHostUnregister' in found_functions}} + err = cyruntime.cudaMemcpyPeer(cydst, dstDevice, cysrc, srcDevice, count) + _helper_input_void_ptr_free(&cydstHelper) + _helper_input_void_ptr_free(&cysrcHelper) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaHostUnregister(ptr): - """ Unregisters a memory range that was registered with cudaHostRegister. - - Unmaps the memory range whose base address is specified by `ptr`, and - makes it pageable again. +def cudaMemcpy2D(dst, size_t dpitch, src, size_t spitch, size_t width, size_t height, kind not None : cudaMemcpyKind): + """ Copies data between host and device. - The base address must be the same one specified to - :py:obj:`~.cudaHostRegister()`. + Copies a matrix (`height` rows of `width` bytes each) from the memory + area pointed to by `src` to the memory area pointed to by `dst`, where + `kind` specifies the direction of the copy, and must be one of + :py:obj:`~.cudaMemcpyHostToHost`, :py:obj:`~.cudaMemcpyHostToDevice`, + :py:obj:`~.cudaMemcpyDeviceToHost`, + :py:obj:`~.cudaMemcpyDeviceToDevice`, or :py:obj:`~.cudaMemcpyDefault`. + Passing :py:obj:`~.cudaMemcpyDefault` is recommended, in which case the + type of transfer is inferred from the pointer values. However, + :py:obj:`~.cudaMemcpyDefault` is only allowed on systems that support + unified virtual addressing. `dpitch` and `spitch` are the widths in + memory in bytes of the 2D arrays pointed to by `dst` and `src`, + including any padding added to the end of each row. The memory areas + may not overlap. `width` must not exceed either `dpitch` or `spitch`. + Calling :py:obj:`~.cudaMemcpy2D()` with `dst` and `src` pointers that + do not match the direction of the copy results in an undefined + behavior. :py:obj:`~.cudaMemcpy2D()` returns an error if `dpitch` or + `spitch` exceeds the maximum allowed. Parameters ---------- - ptr : Any - Host pointer to memory to unregister + dst : Any + Destination memory address + dpitch : size_t + Pitch of destination memory + src : Any + Source memory address + spitch : size_t + Pitch of source memory + width : size_t + Width of matrix transfer (columns in bytes) + height : size_t + Height of matrix transfer (rows) + kind : :py:obj:`~.cudaMemcpyKind` + Type of transfer Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorHostMemoryNotRegistered` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidPitchValue`, :py:obj:`~.cudaErrorInvalidMemcpyDirection` See Also -------- - :py:obj:`~.cudaHostUnregister`, :py:obj:`~.cuMemHostUnregister` + :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpy2DToArray`, :py:obj:`~.cudaMemcpy2DFromArray`, :py:obj:`~.cudaMemcpy2DArrayToArray`, :py:obj:`~.cudaMemcpyToSymbol`, :py:obj:`~.cudaMemcpyFromSymbol`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpy2DAsync`, :py:obj:`~.cudaMemcpy2DToArrayAsync`, :py:obj:`~.cudaMemcpy2DFromArrayAsync`, :py:obj:`~.cudaMemcpyToSymbolAsync`, :py:obj:`~.cudaMemcpyFromSymbolAsync`, :py:obj:`~.cuMemcpy2D`, :py:obj:`~.cuMemcpy2DUnaligned` """ - cptr = utils.HelperInputVoidPtr(ptr) - cdef void* cptr_ptr = cptr.cptr + cdef _HelperInputVoidPtrStruct cydstHelper + cdef void* cydst = _helper_input_void_ptr(dst, &cydstHelper) + cdef _HelperInputVoidPtrStruct cysrcHelper + cdef void* cysrc = _helper_input_void_ptr(src, &cysrcHelper) + cdef cyruntime.cudaMemcpyKind cykind = int(kind) with nogil: - err = ccudart.cudaHostUnregister(cptr_ptr) + err = cyruntime.cudaMemcpy2D(cydst, dpitch, cysrc, spitch, width, height, cykind) + _helper_input_void_ptr_free(&cydstHelper) + _helper_input_void_ptr_free(&cysrcHelper) + return (_cudaError_t(err),) - return (cudaError_t(err),) -{{endif}} +@cython.embedsignature(True) +def cudaMemcpy2DToArray(dst, size_t wOffset, size_t hOffset, src, size_t spitch, size_t width, size_t height, kind not None : cudaMemcpyKind): + """ Copies data between host and device. -{{if 'cudaHostGetDevicePointer' in found_functions}} + Copies a matrix (`height` rows of `width` bytes each) from the memory + area pointed to by `src` to the CUDA array `dst` starting at `hOffset` + rows and `wOffset` bytes from the upper left corner, where `kind` + specifies the direction of the copy, and must be one of + :py:obj:`~.cudaMemcpyHostToHost`, :py:obj:`~.cudaMemcpyHostToDevice`, + :py:obj:`~.cudaMemcpyDeviceToHost`, + :py:obj:`~.cudaMemcpyDeviceToDevice`, or :py:obj:`~.cudaMemcpyDefault`. + Passing :py:obj:`~.cudaMemcpyDefault` is recommended, in which case the + type of transfer is inferred from the pointer values. However, + :py:obj:`~.cudaMemcpyDefault` is only allowed on systems that support + unified virtual addressing. `spitch` is the width in memory in bytes of + the 2D array pointed to by `src`, including any padding added to the + end of each row. `wOffset` + `width` must not exceed the width of the + CUDA array `dst`. `width` must not exceed `spitch`. + :py:obj:`~.cudaMemcpy2DToArray()` returns an error if `spitch` exceeds + the maximum allowed. -@cython.embedsignature(True) -def cudaHostGetDevicePointer(pHost, unsigned int flags): - """ Passes back device pointer of mapped host memory allocated by cudaHostAlloc or registered by cudaHostRegister. + Parameters + ---------- + dst : :py:obj:`~.cudaArray_t` + Destination memory address + wOffset : size_t + Destination starting X offset (columns in bytes) + hOffset : size_t + Destination starting Y offset (rows) + src : Any + Source memory address + spitch : size_t + Pitch of source memory + width : size_t + Width of matrix transfer (columns in bytes) + height : size_t + Height of matrix transfer (rows) + kind : :py:obj:`~.cudaMemcpyKind` + Type of transfer - Passes back the device pointer corresponding to the mapped, pinned host - buffer allocated by :py:obj:`~.cudaHostAlloc()` or registered by - :py:obj:`~.cudaHostRegister()`. + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidPitchValue`, :py:obj:`~.cudaErrorInvalidMemcpyDirection` - :py:obj:`~.cudaHostGetDevicePointer()` will fail if the - :py:obj:`~.cudaDeviceMapHost` flag was not specified before deferred - context creation occurred, or if called on a device that does not - support mapped, pinned memory. + See Also + -------- + :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpy2D`, :py:obj:`~.cudaMemcpy2DFromArray`, :py:obj:`~.cudaMemcpy2DArrayToArray`, :py:obj:`~.cudaMemcpyToSymbol`, :py:obj:`~.cudaMemcpyFromSymbol`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpy2DAsync`, :py:obj:`~.cudaMemcpy2DToArrayAsync`, :py:obj:`~.cudaMemcpy2DFromArrayAsync`, :py:obj:`~.cudaMemcpyToSymbolAsync`, :py:obj:`~.cudaMemcpyFromSymbolAsync`, :py:obj:`~.cuMemcpy2D`, :py:obj:`~.cuMemcpy2DUnaligned` + """ + cdef cyruntime.cudaArray_t cydst + if dst is None: + pdst = 0 + elif isinstance(dst, (cudaArray_t,)): + pdst = int(dst) + else: + pdst = int(cudaArray_t(dst)) + cydst = pdst + cdef _HelperInputVoidPtrStruct cysrcHelper + cdef void* cysrc = _helper_input_void_ptr(src, &cysrcHelper) + cdef cyruntime.cudaMemcpyKind cykind = int(kind) + with nogil: + err = cyruntime.cudaMemcpy2DToArray(cydst, wOffset, hOffset, cysrc, spitch, width, height, cykind) + _helper_input_void_ptr_free(&cysrcHelper) + return (_cudaError_t(err),) - For devices that have a non-zero value for the device attribute - :py:obj:`~.cudaDevAttrCanUseHostPointerForRegisteredMem`, the memory - can also be accessed from the device using the host pointer `pHost`. - The device pointer returned by :py:obj:`~.cudaHostGetDevicePointer()` - may or may not match the original host pointer `pHost` and depends on - the devices visible to the application. If all devices visible to the - application have a non-zero value for the device attribute, the device - pointer returned by :py:obj:`~.cudaHostGetDevicePointer()` will match - the original pointer `pHost`. If any device visible to the application - has a zero value for the device attribute, the device pointer returned - by :py:obj:`~.cudaHostGetDevicePointer()` will not match the original - host pointer `pHost`, but it will be suitable for use on all devices - provided Unified Virtual Addressing is enabled. In such systems, it is - valid to access the memory using either pointer on devices that have a - non-zero value for the device attribute. Note however that such devices - should access the memory using only of the two pointers and not both. +@cython.embedsignature(True) +def cudaMemcpy2DFromArray(dst, size_t dpitch, src, size_t wOffset, size_t hOffset, size_t width, size_t height, kind not None : cudaMemcpyKind): + """ Copies data between host and device. - `flags` provides for future releases. For now, it must be set to 0. + Copies a matrix (`height` rows of `width` bytes each) from the CUDA + array `src` starting at `hOffset` rows and `wOffset` bytes from the + upper left corner to the memory area pointed to by `dst`, where `kind` + specifies the direction of the copy, and must be one of + :py:obj:`~.cudaMemcpyHostToHost`, :py:obj:`~.cudaMemcpyHostToDevice`, + :py:obj:`~.cudaMemcpyDeviceToHost`, + :py:obj:`~.cudaMemcpyDeviceToDevice`, or :py:obj:`~.cudaMemcpyDefault`. + Passing :py:obj:`~.cudaMemcpyDefault` is recommended, in which case the + type of transfer is inferred from the pointer values. However, + :py:obj:`~.cudaMemcpyDefault` is only allowed on systems that support + unified virtual addressing. `dpitch` is the width in memory in bytes of + the 2D array pointed to by `dst`, including any padding added to the + end of each row. `wOffset` + `width` must not exceed the width of the + CUDA array `src`. `width` must not exceed `dpitch`. + :py:obj:`~.cudaMemcpy2DFromArray()` returns an error if `dpitch` + exceeds the maximum allowed. Parameters ---------- - pHost : Any - Requested host pointer mapping - flags : unsigned int - Flags for extensions (must be 0 for now) + dst : Any + Destination memory address + dpitch : size_t + Pitch of destination memory + src : :py:obj:`~.cudaArray_const_t` + Source memory address + wOffset : size_t + Source starting X offset (columns in bytes) + hOffset : size_t + Source starting Y offset (rows) + width : size_t + Width of matrix transfer (columns in bytes) + height : size_t + Height of matrix transfer (rows) + kind : :py:obj:`~.cudaMemcpyKind` + Type of transfer Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorMemoryAllocation` - pDevice : Any - Returned device pointer for mapped memory + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidPitchValue`, :py:obj:`~.cudaErrorInvalidMemcpyDirection` See Also -------- - :py:obj:`~.cudaSetDeviceFlags`, :py:obj:`~.cudaHostAlloc`, :py:obj:`~.cuMemHostGetDevicePointer` + :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpy2D`, :py:obj:`~.cudaMemcpy2DToArray`, :py:obj:`~.cudaMemcpy2DArrayToArray`, :py:obj:`~.cudaMemcpyToSymbol`, :py:obj:`~.cudaMemcpyFromSymbol`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpy2DAsync`, :py:obj:`~.cudaMemcpy2DToArrayAsync`, :py:obj:`~.cudaMemcpy2DFromArrayAsync`, :py:obj:`~.cudaMemcpyToSymbolAsync`, :py:obj:`~.cudaMemcpyFromSymbolAsync`, :py:obj:`~.cuMemcpy2D`, :py:obj:`~.cuMemcpy2DUnaligned` """ - cdef void_ptr pDevice = 0 - cpHost = utils.HelperInputVoidPtr(pHost) - cdef void* cpHost_ptr = cpHost.cptr - err = ccudart.cudaHostGetDevicePointer(&pDevice, cpHost_ptr, flags) - return (cudaError_t(err), pDevice) -{{endif}} - -{{if 'cudaHostGetFlags' in found_functions}} + cdef cyruntime.cudaArray_const_t cysrc + if src is None: + psrc = 0 + elif isinstance(src, (cudaArray_const_t,)): + psrc = int(src) + else: + psrc = int(cudaArray_const_t(src)) + cysrc = psrc + cdef _HelperInputVoidPtrStruct cydstHelper + cdef void* cydst = _helper_input_void_ptr(dst, &cydstHelper) + cdef cyruntime.cudaMemcpyKind cykind = int(kind) + with nogil: + err = cyruntime.cudaMemcpy2DFromArray(cydst, dpitch, cysrc, wOffset, hOffset, width, height, cykind) + _helper_input_void_ptr_free(&cydstHelper) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaHostGetFlags(pHost): - """ Passes back flags used to allocate pinned host memory allocated by cudaHostAlloc. +def cudaMemcpy2DArrayToArray(dst, size_t wOffsetDst, size_t hOffsetDst, src, size_t wOffsetSrc, size_t hOffsetSrc, size_t width, size_t height, kind not None : cudaMemcpyKind): + """ Copies data between host and device. - :py:obj:`~.cudaHostGetFlags()` will fail if the input pointer does not - reside in an address range allocated by :py:obj:`~.cudaHostAlloc()`. + Copies a matrix (`height` rows of `width` bytes each) from the CUDA + array `src` starting at `hOffsetSrc` rows and `wOffsetSrc` bytes from + the upper left corner to the CUDA array `dst` starting at `hOffsetDst` + rows and `wOffsetDst` bytes from the upper left corner, where `kind` + specifies the direction of the copy, and must be one of + :py:obj:`~.cudaMemcpyHostToHost`, :py:obj:`~.cudaMemcpyHostToDevice`, + :py:obj:`~.cudaMemcpyDeviceToHost`, + :py:obj:`~.cudaMemcpyDeviceToDevice`, or :py:obj:`~.cudaMemcpyDefault`. + Passing :py:obj:`~.cudaMemcpyDefault` is recommended, in which case the + type of transfer is inferred from the pointer values. However, + :py:obj:`~.cudaMemcpyDefault` is only allowed on systems that support + unified virtual addressing. `wOffsetDst` + `width` must not exceed the + width of the CUDA array `dst`. `wOffsetSrc` + `width` must not exceed + the width of the CUDA array `src`. Parameters ---------- - pHost : Any - Host pointer + dst : :py:obj:`~.cudaArray_t` + Destination memory address + wOffsetDst : size_t + Destination starting X offset (columns in bytes) + hOffsetDst : size_t + Destination starting Y offset (rows) + src : :py:obj:`~.cudaArray_const_t` + Source memory address + wOffsetSrc : size_t + Source starting X offset (columns in bytes) + hOffsetSrc : size_t + Source starting Y offset (rows) + width : size_t + Width of matrix transfer (columns in bytes) + height : size_t + Height of matrix transfer (rows) + kind : :py:obj:`~.cudaMemcpyKind` + Type of transfer Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` - pFlags : unsigned int - Returned flags word + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidMemcpyDirection` See Also -------- - :py:obj:`~.cudaHostAlloc`, :py:obj:`~.cuMemHostGetFlags` + :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpy2D`, :py:obj:`~.cudaMemcpy2DToArray`, :py:obj:`~.cudaMemcpy2DFromArray`, :py:obj:`~.cudaMemcpyToSymbol`, :py:obj:`~.cudaMemcpyFromSymbol`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpy2DAsync`, :py:obj:`~.cudaMemcpy2DToArrayAsync`, :py:obj:`~.cudaMemcpy2DFromArrayAsync`, :py:obj:`~.cudaMemcpyToSymbolAsync`, :py:obj:`~.cudaMemcpyFromSymbolAsync`, :py:obj:`~.cuMemcpy2D`, :py:obj:`~.cuMemcpy2DUnaligned` """ - cdef unsigned int pFlags = 0 - cpHost = utils.HelperInputVoidPtr(pHost) - cdef void* cpHost_ptr = cpHost.cptr - err = ccudart.cudaHostGetFlags(&pFlags, cpHost_ptr) - return (cudaError_t(err), pFlags) -{{endif}} - -{{if 'cudaMalloc3D' in found_functions}} + cdef cyruntime.cudaArray_const_t cysrc + if src is None: + psrc = 0 + elif isinstance(src, (cudaArray_const_t,)): + psrc = int(src) + else: + psrc = int(cudaArray_const_t(src)) + cysrc = psrc + cdef cyruntime.cudaArray_t cydst + if dst is None: + pdst = 0 + elif isinstance(dst, (cudaArray_t,)): + pdst = int(dst) + else: + pdst = int(cudaArray_t(dst)) + cydst = pdst + cdef cyruntime.cudaMemcpyKind cykind = int(kind) + with nogil: + err = cyruntime.cudaMemcpy2DArrayToArray(cydst, wOffsetDst, hOffsetDst, cysrc, wOffsetSrc, hOffsetSrc, width, height, cykind) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaMalloc3D(extent not None : cudaExtent): - """ Allocates logical 1D, 2D, or 3D memory objects on the device. +def cudaMemcpyAsync(dst, src, size_t count, kind not None : cudaMemcpyKind, stream): + """ Copies data between host and device. - Allocates at least `width` * `height` * `depth` bytes of linear memory - on the device and returns a :py:obj:`~.cudaPitchedPtr` in which `ptr` - is a pointer to the allocated memory. The function may pad the - allocation to ensure hardware alignment requirements are met. The pitch - returned in the `pitch` field of `pitchedDevPtr` is the width in bytes - of the allocation. + Copies `count` bytes from the memory area pointed to by `src` to the + memory area pointed to by `dst`, where `kind` specifies the direction + of the copy, and must be one of :py:obj:`~.cudaMemcpyHostToHost`, + :py:obj:`~.cudaMemcpyHostToDevice`, :py:obj:`~.cudaMemcpyDeviceToHost`, + :py:obj:`~.cudaMemcpyDeviceToDevice`, or :py:obj:`~.cudaMemcpyDefault`. + Passing :py:obj:`~.cudaMemcpyDefault` is recommended, in which case the + type of transfer is inferred from the pointer values. However, + :py:obj:`~.cudaMemcpyDefault` is only allowed on systems that support + unified virtual addressing. - The returned :py:obj:`~.cudaPitchedPtr` contains additional fields - `xsize` and `ysize`, the logical width and height of the allocation, - which are equivalent to the `width` and `height` `extent` parameters - provided by the programmer during allocation. + The memory areas may not overlap. Calling :py:obj:`~.cudaMemcpyAsync()` + with `dst` and `src` pointers that do not match the direction of the + copy results in an undefined behavior. - For allocations of 2D and 3D objects, it is highly recommended that - programmers perform allocations using :py:obj:`~.cudaMalloc3D()` or - :py:obj:`~.cudaMallocPitch()`. Due to alignment restrictions in the - hardware, this is especially true if the application will be performing - memory copies involving 2D or 3D objects (whether linear memory or CUDA - arrays). + :py:obj:`~.cudaMemcpyAsync()` is asynchronous with respect to the host, + so the call may return before the copy is complete. The copy can + optionally be associated to a stream by passing a non-zero `stream` + argument. If `kind` is :py:obj:`~.cudaMemcpyHostToDevice` or + :py:obj:`~.cudaMemcpyDeviceToHost` and the `stream` is non-zero, the + copy may overlap with operations in other streams. + + The device version of this function only handles device to device + copies and cannot be given local or shared pointers. Parameters ---------- - extent : :py:obj:`~.cudaExtent` - Requested allocation size (`width` field in bytes) + dst : Any + Destination memory address + src : Any + Source memory address + count : size_t + Size in bytes to copy + kind : :py:obj:`~.cudaMemcpyKind` + Type of transfer + stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + Stream identifier Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorMemoryAllocation` - pitchedDevPtr : :py:obj:`~.cudaPitchedPtr` - Pointer to allocated pitched device memory + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidMemcpyDirection` See Also -------- - :py:obj:`~.cudaMallocPitch`, :py:obj:`~.cudaFree`, :py:obj:`~.cudaMemcpy3D`, :py:obj:`~.cudaMemset3D`, :py:obj:`~.cudaMalloc3DArray`, :py:obj:`~.cudaMallocArray`, :py:obj:`~.cudaFreeArray`, :py:obj:`~.cudaMallocHost (C API)`, :py:obj:`~.cudaFreeHost`, :py:obj:`~.cudaHostAlloc`, :py:obj:`~.make_cudaPitchedPtr`, :py:obj:`~.make_cudaExtent`, :py:obj:`~.cuMemAllocPitch` + :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpy2D`, :py:obj:`~.cudaMemcpy2DToArray`, :py:obj:`~.cudaMemcpy2DFromArray`, :py:obj:`~.cudaMemcpy2DArrayToArray`, :py:obj:`~.cudaMemcpyToSymbol`, :py:obj:`~.cudaMemcpyFromSymbol`, :py:obj:`~.cudaMemcpy2DAsync`, :py:obj:`~.cudaMemcpy2DToArrayAsync`, :py:obj:`~.cudaMemcpy2DFromArrayAsync`, :py:obj:`~.cudaMemcpyToSymbolAsync`, :py:obj:`~.cudaMemcpyFromSymbolAsync`, :py:obj:`~.cuMemcpyAsync`, :py:obj:`~.cuMemcpyDtoHAsync`, :py:obj:`~.cuMemcpyHtoDAsync`, :py:obj:`~.cuMemcpyDtoDAsync` """ - cdef cudaPitchedPtr pitchedDevPtr = cudaPitchedPtr() - err = ccudart.cudaMalloc3D(pitchedDevPtr._ptr, extent._ptr[0]) - return (cudaError_t(err), pitchedDevPtr) -{{endif}} - -{{if 'cudaMalloc3DArray' in found_functions}} + cdef cyruntime.cudaStream_t cystream + if stream is None: + pstream = 0 + elif isinstance(stream, (cudaStream_t,driver.CUstream)): + pstream = int(stream) + else: + pstream = int(cudaStream_t(stream)) + cystream = pstream + cdef _HelperInputVoidPtrStruct cydstHelper + cdef void* cydst = _helper_input_void_ptr(dst, &cydstHelper) + cdef _HelperInputVoidPtrStruct cysrcHelper + cdef void* cysrc = _helper_input_void_ptr(src, &cysrcHelper) + cdef cyruntime.cudaMemcpyKind cykind = int(kind) + with nogil: + err = cyruntime.cudaMemcpyAsync(cydst, cysrc, count, cykind, cystream) + _helper_input_void_ptr_free(&cydstHelper) + _helper_input_void_ptr_free(&cysrcHelper) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaMalloc3DArray(desc : Optional[cudaChannelFormatDesc], extent not None : cudaExtent, unsigned int flags): - """ Allocate an array on the device. - - Allocates a CUDA array according to the - :py:obj:`~.cudaChannelFormatDesc` structure `desc` and returns a handle - to the new CUDA array in `*array`. - - The :py:obj:`~.cudaChannelFormatDesc` is defined as: - - **View CUDA Toolkit Documentation for a C++ code example** - - where :py:obj:`~.cudaChannelFormatKind` is one of - :py:obj:`~.cudaChannelFormatKindSigned`, - :py:obj:`~.cudaChannelFormatKindUnsigned`, or - :py:obj:`~.cudaChannelFormatKindFloat`. - - :py:obj:`~.cudaMalloc3DArray()` can allocate the following: - - - A 1D array is allocated if the height and depth extents are both - zero. - - - A 2D array is allocated if only the depth extent is zero. - - - A 3D array is allocated if all three extents are non-zero. - - - A 1D layered CUDA array is allocated if only the height extent is - zero and the cudaArrayLayered flag is set. Each layer is a 1D array. - The number of layers is determined by the depth extent. - - - A 2D layered CUDA array is allocated if all three extents are non- - zero and the cudaArrayLayered flag is set. Each layer is a 2D array. - The number of layers is determined by the depth extent. - - - A cubemap CUDA array is allocated if all three extents are non-zero - and the cudaArrayCubemap flag is set. Width must be equal to height, - and depth must be six. A cubemap is a special type of 2D layered CUDA - array, where the six layers represent the six faces of a cube. The - order of the six layers in memory is the same as that listed in - :py:obj:`~.cudaGraphicsCubeFace`. +def cudaMemcpyPeerAsync(dst, int dstDevice, src, int srcDevice, size_t count, stream): + """ Copies memory between two devices asynchronously. - - A cubemap layered CUDA array is allocated if all three extents are - non-zero, and both, cudaArrayCubemap and cudaArrayLayered flags are - set. Width must be equal to height, and depth must be a multiple of - six. A cubemap layered CUDA array is a special type of 2D layered - CUDA array that consists of a collection of cubemaps. The first six - layers represent the first cubemap, the next six layers form the - second cubemap, and so on. + Copies memory from one device to memory on another device. `dst` is the + base device pointer of the destination memory and `dstDevice` is the + destination device. `src` is the base device pointer of the source + memory and `srcDevice` is the source device. `count` specifies the + number of bytes to copy. - The `flags` parameter enables different options to be specified that - affect the allocation, as follows. + Note that this function is asynchronous with respect to the host and + all work on other devices. - - :py:obj:`~.cudaArrayDefault`: This flag's value is defined to be 0 - and provides default array allocation + Parameters + ---------- + dst : Any + Destination device pointer + dstDevice : int + Destination device + src : Any + Source device pointer + srcDevice : int + Source device + count : size_t + Size of memory copy in bytes + stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + Stream identifier - - :py:obj:`~.cudaArrayLayered`: Allocates a layered CUDA array, with - the depth extent indicating the number of layers + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidDevice` - - :py:obj:`~.cudaArrayCubemap`: Allocates a cubemap CUDA array. Width - must be equal to height, and depth must be six. If the - cudaArrayLayered flag is also set, depth must be a multiple of six. + See Also + -------- + :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpyPeer`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpy3DPeerAsync`, :py:obj:`~.cuMemcpyPeerAsync` + """ + cdef cyruntime.cudaStream_t cystream + if stream is None: + pstream = 0 + elif isinstance(stream, (cudaStream_t,driver.CUstream)): + pstream = int(stream) + else: + pstream = int(cudaStream_t(stream)) + cystream = pstream + cdef _HelperInputVoidPtrStruct cydstHelper + cdef void* cydst = _helper_input_void_ptr(dst, &cydstHelper) + cdef _HelperInputVoidPtrStruct cysrcHelper + cdef void* cysrc = _helper_input_void_ptr(src, &cysrcHelper) + with nogil: + err = cyruntime.cudaMemcpyPeerAsync(cydst, dstDevice, cysrc, srcDevice, count, cystream) + _helper_input_void_ptr_free(&cydstHelper) + _helper_input_void_ptr_free(&cysrcHelper) + return (_cudaError_t(err),) + +@cython.embedsignature(True) +def cudaMemcpyBatchAsync(dsts : Optional[tuple[Any] | list[Any]], srcs : Optional[tuple[Any] | list[Any]], sizes : tuple[int] | list[int], size_t count, attrs : Optional[tuple[cudaMemcpyAttributes] | list[cudaMemcpyAttributes]], attrsIdxs : tuple[int] | list[int], size_t numAttrs, stream): + """ Performs a batch of memory copies asynchronously. + + Performs a batch of memory copies. The batch as a whole executes in + stream order but copies within a batch are not guaranteed to execute in + any specific order. This API only supports pointer-to-pointer copies. + For copies involving CUDA arrays, please see + :py:obj:`~.cudaMemcpy3DBatchAsync`. + + Performs memory copies from source buffers specified in `srcs` to + destination buffers specified in `dsts`. The size of each copy is + specified in `sizes`. All three arrays must be of the same length as + specified by `count`. Since there are no ordering guarantees for copies + within a batch, specifying any dependent copies within a batch will + result in undefined behavior. - - :py:obj:`~.cudaArraySurfaceLoadStore`: Allocates a CUDA array that - could be read from or written to using a surface reference. + Every copy in the batch has to be associated with a set of attributes + specified in the `attrs` array. Each entry in this array can apply to + more than one copy. This can be done by specifying in the `attrsIdxs` + array, the index of the first copy that the corresponding entry in the + `attrs` array applies to. Both `attrs` and `attrsIdxs` must be of the + same length as specified by `numAttrs`. For example, if a batch has 10 + copies listed in dst/src/sizes, the first 6 of which have one set of + attributes and the remaining 4 another, then `numAttrs` will be 2, + `attrsIdxs` will be {0, 6} and `attrs` will contains the two sets of + attributes. Note that the first entry in `attrsIdxs` must always be 0. + Also, each entry must be greater than the previous entry and the last + entry should be less than `count`. Furthermore, `numAttrs` must be + lesser than or equal to `count`. + + The :py:obj:`~.cudaMemcpyAttributes.srcAccessOrder` indicates the + source access ordering to be observed for copies associated with the + attribute. If the source access order is set to + :py:obj:`~.cudaMemcpySrcAccessOrderStream`, then the source will be + accessed in stream order. If the source access order is set to + :py:obj:`~.cudaMemcpySrcAccessOrderDuringApiCall` then it indicates + that access to the source pointer can be out of stream order and all + accesses must be complete before the API call returns. This flag is + suited for ephemeral sources (ex., stack variables) when it's known + that no prior operations in the stream can be accessing the memory and + also that the lifetime of the memory is limited to the scope that the + source variable was declared in. Specifying this flag allows the driver + to optimize the copy and removes the need for the user to synchronize + the stream after the API call. If the source access order is set to + :py:obj:`~.cudaMemcpySrcAccessOrderAny` then it indicates that access + to the source pointer can be out of stream order and the accesses can + happen even after the API call returns. This flag is suited for host + pointers allocated outside CUDA (ex., via malloc) when it's known that + no prior operations in the stream can be accessing the memory. + Specifying this flag allows the driver to optimize the copy on certain + platforms. Each memcpy operation in the batch must have a valid + :py:obj:`~.cudaMemcpyAttributes` corresponding to it including the + appropriate srcAccessOrder setting, otherwise the API will return + :py:obj:`~.cudaErrorInvalidValue`. + + The :py:obj:`~.cudaMemcpyAttributes.srcLocHint` and + :py:obj:`~.cudaMemcpyAttributes.dstLocHint` allows applications to + specify hint locations for operands of a copy when the operand doesn't + have a fixed location. That is, these hints are only applicable for + managed memory pointers on devices where + :py:obj:`~.cudaDevAttrConcurrentManagedAccess` is true or system- + allocated pageable memory on devices where + :py:obj:`~.cudaDevAttrPageableMemoryAccess` is true. For other cases, + these hints are ignored. + + The :py:obj:`~.cudaMemcpyAttributes.flags` field can be used to specify + certain flags for copies. Setting the + :py:obj:`~.cudaMemcpyFlagPreferOverlapWithCompute` flag indicates that + the associated copies should preferably overlap with any compute work. + Note that this flag is a hint and can be ignored depending on the + platform and other parameters of the copy. + + Parameters + ---------- + dsts : list[Any] + Array of destination pointers. + srcs : list[Any] + Array of memcpy source pointers. + sizes : list[int] + Array of sizes for memcpy operations. + count : size_t + Size of `dsts`, `srcs` and `sizes` arrays + attrs : list[:py:obj:`~.cudaMemcpyAttributes`] + Array of memcpy attributes. + attrsIdxs : list[int] + Array of indices to specify which copies each entry in the `attrs` + array applies to. The attributes specified in attrs[k] will be + applied to copies starting from attrsIdxs[k] through attrsIdxs[k+1] + - 1. Also attrs[numAttrs-1] will apply to copies starting from + attrsIdxs[numAttrs-1] through count - 1. + numAttrs : size_t + Size of `attrs` and `attrsIdxs` arrays. + hStream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + The stream to enqueue the operations in. Must not be legacy NULL + stream. - - :py:obj:`~.cudaArrayTextureGather`: This flag indicates that texture - gather operations will be performed on the CUDA array. Texture gather - can only be performed on 2D CUDA arrays. + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess` :py:obj:`~.cudaErrorInvalidValue` + """ + cdef cyruntime.cudaStream_t cystream + if stream is None: + pstream = 0 + elif isinstance(stream, (cudaStream_t,driver.CUstream)): + pstream = int(stream) + else: + pstream = int(cudaStream_t(stream)) + cystream = pstream + if not all(isinstance(_x, (int)) for _x in attrsIdxs): + raise TypeError("Argument 'attrsIdxs' is not instance of type (expected tuple[int] or list[int]") + attrs = [] if attrs is None else attrs + if not all(isinstance(_x, (cudaMemcpyAttributes,)) for _x in attrs): + raise TypeError("Argument 'attrs' is not instance of type (expected tuple[cyruntime.cudaMemcpyAttributes,] or list[cyruntime.cudaMemcpyAttributes,]") + if not all(isinstance(_x, (int)) for _x in sizes): + raise TypeError("Argument 'sizes' is not instance of type (expected tuple[int] or list[int]") + srcs = [] if srcs is None else srcs + dsts = [] if dsts is None else dsts + pylist = [_HelperInputVoidPtr(pydsts) for pydsts in dsts] + cdef _InputVoidPtrPtrHelper voidStarHelperdsts = _InputVoidPtrPtrHelper(pylist) + cdef const void** cydsts_ptr = voidStarHelperdsts.cptr + pylist = [_HelperInputVoidPtr(pysrcs) for pysrcs in srcs] + cdef _InputVoidPtrPtrHelper voidStarHelpersrcs = _InputVoidPtrPtrHelper(pylist) + cdef const void** cysrcs_ptr = voidStarHelpersrcs.cptr + cdef vector[size_t] cysizes = sizes + if count > len(dsts): raise RuntimeError("List is too small: " + str(len(dsts)) + " < " + str(count)) + if count > len(srcs): raise RuntimeError("List is too small: " + str(len(srcs)) + " < " + str(count)) + if count > len(sizes): raise RuntimeError("List is too small: " + str(len(sizes)) + " < " + str(count)) + cdef cyruntime.cudaMemcpyAttributes* cyattrs = NULL + if len(attrs) > 1: + cyattrs = calloc(len(attrs), sizeof(cyruntime.cudaMemcpyAttributes)) + if cyattrs is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(attrs)) + 'x' + str(sizeof(cyruntime.cudaMemcpyAttributes))) + for idx in range(len(attrs)): + string.memcpy(&cyattrs[idx], (attrs[idx])._pvt_ptr, sizeof(cyruntime.cudaMemcpyAttributes)) + elif len(attrs) == 1: + cyattrs = (attrs[0])._pvt_ptr + cdef vector[size_t] cyattrsIdxs = attrsIdxs + if numAttrs > len(attrs): raise RuntimeError("List is too small: " + str(len(attrs)) + " < " + str(numAttrs)) + if numAttrs > len(attrsIdxs): raise RuntimeError("List is too small: " + str(len(attrsIdxs)) + " < " + str(numAttrs)) + with nogil: + err = cyruntime.cudaMemcpyBatchAsync(cydsts_ptr, cysrcs_ptr, cysizes.data(), count, cyattrs, cyattrsIdxs.data(), numAttrs, cystream) + if len(attrs) > 1 and cyattrs is not NULL: + free(cyattrs) + return (_cudaError_t(err),) + +@cython.embedsignature(True) +def cudaMemcpy3DBatchAsync(size_t numOps, opList : Optional[tuple[cudaMemcpy3DBatchOp] | list[cudaMemcpy3DBatchOp]], unsigned long long flags, stream): + """ Performs a batch of 3D memory copies asynchronously. + + Performs a batch of memory copies. The batch as a whole executes in + stream order but copies within a batch are not guaranteed to execute in + any specific order. Note that this means specifying any dependent + copies within a batch will result in undefined behavior. + + Performs memory copies as specified in the `opList` array. The length + of this array is specified in `numOps`. Each entry in this array + describes a copy operation. This includes among other things, the + source and destination operands for the copy as specified in + :py:obj:`~.cudaMemcpy3DBatchOp.src` and + :py:obj:`~.cudaMemcpy3DBatchOp.dst` respectively. The source and + destination operands of a copy can either be a pointer or a CUDA array. + The width, height and depth of a copy is specified in + :py:obj:`~.cudaMemcpy3DBatchOp.extent`. The width, height and depth of + a copy are specified in elements and must not be zero. For pointer-to- + pointer copies, the element size is considered to be 1. For pointer to + CUDA array or vice versa copies, the element size is determined by the + CUDA array. For CUDA array to CUDA array copies, the element size of + the two CUDA arrays must match. + + For a given operand, if :py:obj:`~.cudaMemcpy3DOperand.type` is + specified as :py:obj:`~.cudaMemcpyOperandTypePointer`, then + :py:obj:`~.cudaMemcpy3DOperand.op.ptr` will be used. The + :py:obj:`~.cudaMemcpy3DOperand.op.ptr.ptr` field must contain the + pointer where the copy should begin. The + :py:obj:`~.cudaMemcpy3DOperand.op.ptr.rowLength` field specifies the + length of each row in elements and must either be zero or be greater + than or equal to the width of the copy specified in + :py:obj:`~.cudaMemcpy3DBatchOp.extent.width`. The + :py:obj:`~.cudaMemcpy3DOperand.op.ptr.layerHeight` field specifies the + height of each layer and must either be zero or be greater than or + equal to the height of the copy specified in + :py:obj:`~.cudaMemcpy3DBatchOp.extent.height`. When either of these + values is zero, that aspect of the operand is considered to be tightly + packed according to the copy extent. For managed memory pointers on + devices where :py:obj:`~.cudaDevAttrConcurrentManagedAccess` is true or + system-allocated pageable memory on devices where + :py:obj:`~.cudaDevAttrPageableMemoryAccess` is true, the + :py:obj:`~.cudaMemcpy3DOperand.op.ptr.locHint` field can be used to + hint the location of the operand. + + If an operand's type is specified as + :py:obj:`~.cudaMemcpyOperandTypeArray`, then + :py:obj:`~.cudaMemcpy3DOperand.op.array` will be used. The + :py:obj:`~.cudaMemcpy3DOperand.op.array.array` field specifies the CUDA + array and :py:obj:`~.cudaMemcpy3DOperand.op.array.offset` specifies the + 3D offset into that array where the copy begins. + + The :py:obj:`~.cudaMemcpyAttributes.srcAccessOrder` indicates the + source access ordering to be observed for copies associated with the + attribute. If the source access order is set to + :py:obj:`~.cudaMemcpySrcAccessOrderStream`, then the source will be + accessed in stream order. If the source access order is set to + :py:obj:`~.cudaMemcpySrcAccessOrderDuringApiCall` then it indicates + that access to the source pointer can be out of stream order and all + accesses must be complete before the API call returns. This flag is + suited for ephemeral sources (ex., stack variables) when it's known + that no prior operations in the stream can be accessing the memory and + also that the lifetime of the memory is limited to the scope that the + source variable was declared in. Specifying this flag allows the driver + to optimize the copy and removes the need for the user to synchronize + the stream after the API call. If the source access order is set to + :py:obj:`~.cudaMemcpySrcAccessOrderAny` then it indicates that access + to the source pointer can be out of stream order and the accesses can + happen even after the API call returns. This flag is suited for host + pointers allocated outside CUDA (ex., via malloc) when it's known that + no prior operations in the stream can be accessing the memory. + Specifying this flag allows the driver to optimize the copy on certain + platforms. Each memcopy operation in `opList` must have a valid + srcAccessOrder setting, otherwise this API will return + :py:obj:`~.cudaErrorInvalidValue`. + + The :py:obj:`~.cudaMemcpyAttributes.flags` field can be used to specify + certain flags for copies. Setting the + :py:obj:`~.cudaMemcpyFlagPreferOverlapWithCompute` flag indicates that + the associated copies should preferably overlap with any compute work. + Note that this flag is a hint and can be ignored depending on the + platform and other parameters of the copy. + + Parameters + ---------- + numOps : size_t + Total number of memcpy operations. + opList : list[:py:obj:`~.cudaMemcpy3DBatchOp`] + Array of size `numOps` containing the actual memcpy operations. + flags : unsigned long long + Flags for future use, must be zero now. + hStream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + The stream to enqueue the operations in. Must not be default NULL + stream. - - :py:obj:`~.cudaArraySparse`: Allocates a CUDA array without physical - backing memory. The subregions within this sparse array can later be - mapped onto a physical memory allocation by calling - :py:obj:`~.cuMemMapArrayAsync`. This flag can only be used for - creating 2D, 3D or 2D layered sparse CUDA arrays. The physical - backing memory must be allocated via :py:obj:`~.cuMemCreate`. + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess` :py:obj:`~.cudaErrorInvalidValue` + """ + cdef cyruntime.cudaStream_t cystream + if stream is None: + pstream = 0 + elif isinstance(stream, (cudaStream_t,driver.CUstream)): + pstream = int(stream) + else: + pstream = int(cudaStream_t(stream)) + cystream = pstream + opList = [] if opList is None else opList + if not all(isinstance(_x, (cudaMemcpy3DBatchOp,)) for _x in opList): + raise TypeError("Argument 'opList' is not instance of type (expected tuple[cyruntime.cudaMemcpy3DBatchOp,] or list[cyruntime.cudaMemcpy3DBatchOp,]") + if numOps > len(opList): raise RuntimeError("List is too small: " + str(len(opList)) + " < " + str(numOps)) + cdef cyruntime.cudaMemcpy3DBatchOp* cyopList = NULL + if len(opList) > 1: + cyopList = calloc(len(opList), sizeof(cyruntime.cudaMemcpy3DBatchOp)) + if cyopList is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(opList)) + 'x' + str(sizeof(cyruntime.cudaMemcpy3DBatchOp))) + for idx in range(len(opList)): + string.memcpy(&cyopList[idx], (opList[idx])._pvt_ptr, sizeof(cyruntime.cudaMemcpy3DBatchOp)) + elif len(opList) == 1: + cyopList = (opList[0])._pvt_ptr + with nogil: + err = cyruntime.cudaMemcpy3DBatchAsync(numOps, cyopList, flags, cystream) + if len(opList) > 1 and cyopList is not NULL: + free(cyopList) + return (_cudaError_t(err),) - - :py:obj:`~.cudaArrayDeferredMapping`: Allocates a CUDA array without - physical backing memory. The entire array can later be mapped onto a - physical memory allocation by calling :py:obj:`~.cuMemMapArrayAsync`. - The physical backing memory must be allocated via - :py:obj:`~.cuMemCreate`. +@cython.embedsignature(True) +def cudaMemcpyWithAttributesAsync(dst, src, size_t size, attr : Optional[cudaMemcpyAttributes], stream): + """ - The width, height and depth extents must meet certain size requirements - as listed in the following table. All values are specified in elements. + Performs asynchronous memory copy operation with the specified + attributes. - Note that 2D CUDA arrays have different size requirements if the - :py:obj:`~.cudaArrayTextureGather` flag is set. In that case, the valid - range for (width, height, depth) is ((1,maxTexture2DGather[0]), - (1,maxTexture2DGather[1]), 0). + Performs asynchronous memory copy operation where `dst` and `src` are + the destination and source pointers respectively. `size` specifies the + number of bytes to copy. `attr` specifies the attributes for the copy + and `hStream` specifies the stream to enqueue the operation in. - **View CUDA Toolkit Documentation for a table example** + For more information regarding the attributes, please refer to + :py:obj:`~.cudaMemcpyAttributes` and it's usage desciption + in::cudaMemcpyBatchAsync Parameters ---------- - desc : :py:obj:`~.cudaChannelFormatDesc` - Requested channel format - extent : :py:obj:`~.cudaExtent` - Requested allocation size (`width` field in elements) - flags : unsigned int - Flags for extensions + dst : Any + Destination device pointer + src : Any + Source device pointer + size : size_t + Number of bytes to copy + attr : :py:obj:`~.cudaMemcpyAttributes` + Attributes for the copy + hStream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + Stream to enqueue the operation in Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorMemoryAllocation` - array : :py:obj:`~.cudaArray_t` - Pointer to allocated array in device memory + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` See Also -------- - :py:obj:`~.cudaMalloc3D`, :py:obj:`~.cudaMalloc`, :py:obj:`~.cudaMallocPitch`, :py:obj:`~.cudaFree`, :py:obj:`~.cudaFreeArray`, :py:obj:`~.cudaMallocHost (C API)`, :py:obj:`~.cudaFreeHost`, :py:obj:`~.cudaHostAlloc`, :py:obj:`~.make_cudaExtent`, :py:obj:`~.cuArray3DCreate` + :py:obj:`~.cudaMemcpyBatchAsync` """ - cdef cudaArray_t array = cudaArray_t() - cdef ccudart.cudaChannelFormatDesc* cdesc_ptr = desc._ptr if desc != None else NULL + cdef cyruntime.cudaStream_t cystream + if stream is None: + pstream = 0 + elif isinstance(stream, (cudaStream_t,driver.CUstream)): + pstream = int(stream) + else: + pstream = int(cudaStream_t(stream)) + cystream = pstream + cdef _HelperInputVoidPtrStruct cydstHelper + cdef void* cydst = _helper_input_void_ptr(dst, &cydstHelper) + cdef _HelperInputVoidPtrStruct cysrcHelper + cdef void* cysrc = _helper_input_void_ptr(src, &cysrcHelper) + cdef cyruntime.cudaMemcpyAttributes* cyattr_ptr = attr._pvt_ptr if attr is not None else NULL with nogil: - err = ccudart.cudaMalloc3DArray(array._ptr, cdesc_ptr, extent._ptr[0], flags) - - return (cudaError_t(err), array) -{{endif}} - -{{if 'cudaMallocMipmappedArray' in found_functions}} + err = cyruntime.cudaMemcpyWithAttributesAsync(cydst, cysrc, size, cyattr_ptr, cystream) + _helper_input_void_ptr_free(&cydstHelper) + _helper_input_void_ptr_free(&cysrcHelper) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaMallocMipmappedArray(desc : Optional[cudaChannelFormatDesc], extent not None : cudaExtent, unsigned int numLevels, unsigned int flags): - """ Allocate a mipmapped array on the device. - - Allocates a CUDA mipmapped array according to the - :py:obj:`~.cudaChannelFormatDesc` structure `desc` and returns a handle - to the new CUDA mipmapped array in `*mipmappedArray`. `numLevels` - specifies the number of mipmap levels to be allocated. This value is - clamped to the range [1, 1 + floor(log2(max(width, height, depth)))]. - - The :py:obj:`~.cudaChannelFormatDesc` is defined as: - - **View CUDA Toolkit Documentation for a C++ code example** - - where :py:obj:`~.cudaChannelFormatKind` is one of - :py:obj:`~.cudaChannelFormatKindSigned`, - :py:obj:`~.cudaChannelFormatKindUnsigned`, or - :py:obj:`~.cudaChannelFormatKindFloat`. - - :py:obj:`~.cudaMallocMipmappedArray()` can allocate the following: - - - A 1D mipmapped array is allocated if the height and depth extents are - both zero. - - - A 2D mipmapped array is allocated if only the depth extent is zero. - - - A 3D mipmapped array is allocated if all three extents are non-zero. - - - A 1D layered CUDA mipmapped array is allocated if only the height - extent is zero and the cudaArrayLayered flag is set. Each layer is a - 1D mipmapped array. The number of layers is determined by the depth - extent. - - - A 2D layered CUDA mipmapped array is allocated if all three extents - are non-zero and the cudaArrayLayered flag is set. Each layer is a 2D - mipmapped array. The number of layers is determined by the depth - extent. - - - A cubemap CUDA mipmapped array is allocated if all three extents are - non-zero and the cudaArrayCubemap flag is set. Width must be equal to - height, and depth must be six. The order of the six layers in memory - is the same as that listed in :py:obj:`~.cudaGraphicsCubeFace`. +def cudaMemcpy3DWithAttributesAsync(op : Optional[cudaMemcpy3DBatchOp], unsigned long long flags, stream): + """ - - A cubemap layered CUDA mipmapped array is allocated if all three - extents are non-zero, and both, cudaArrayCubemap and cudaArrayLayered - flags are set. Width must be equal to height, and depth must be a - multiple of six. A cubemap layered CUDA mipmapped array is a special - type of 2D layered CUDA mipmapped array that consists of a collection - of cubemap mipmapped arrays. The first six layers represent the first - cubemap mipmapped array, the next six layers form the second cubemap - mipmapped array, and so on. + Performs 3D asynchronous memory copy with the specified attributes. - The `flags` parameter enables different options to be specified that - affect the allocation, as follows. + Performs the copy operation specified in `op`. `flags` specifies the + flags for the copy and `hStream` specifies the stream to enqueue the + operation in. - - :py:obj:`~.cudaArrayDefault`: This flag's value is defined to be 0 - and provides default mipmapped array allocation + For more information regarding the operation, please refer to + :py:obj:`~.cudaMemcpy3DBatchOp` and it's usage desciption + in::cudaMemcpy3DBatchAsync - - :py:obj:`~.cudaArrayLayered`: Allocates a layered CUDA mipmapped - array, with the depth extent indicating the number of layers + Parameters + ---------- + op : :py:obj:`~.cudaMemcpy3DBatchOp` + Operation to perform + flags : unsigned long long + Flags for the copy, must be zero now. + hStream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + Stream to enqueue the operation in - - :py:obj:`~.cudaArrayCubemap`: Allocates a cubemap CUDA mipmapped - array. Width must be equal to height, and depth must be six. If the - cudaArrayLayered flag is also set, depth must be a multiple of six. + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` - - :py:obj:`~.cudaArraySurfaceLoadStore`: This flag indicates that - individual mipmap levels of the CUDA mipmapped array will be read - from or written to using a surface reference. + See Also + -------- + :py:obj:`~.cudaMemcpy3DBatchAsync` + """ + cdef cyruntime.cudaStream_t cystream + if stream is None: + pstream = 0 + elif isinstance(stream, (cudaStream_t,driver.CUstream)): + pstream = int(stream) + else: + pstream = int(cudaStream_t(stream)) + cystream = pstream + cdef cyruntime.cudaMemcpy3DBatchOp* cyop_ptr = op._pvt_ptr if op is not None else NULL + with nogil: + err = cyruntime.cudaMemcpy3DWithAttributesAsync(cyop_ptr, flags, cystream) + return (_cudaError_t(err),) - - :py:obj:`~.cudaArrayTextureGather`: This flag indicates that texture - gather operations will be performed on the CUDA array. Texture gather - can only be performed on 2D CUDA mipmapped arrays, and the gather - operations are performed only on the most detailed mipmap level. +@cython.embedsignature(True) +def cudaMemcpy2DAsync(dst, size_t dpitch, src, size_t spitch, size_t width, size_t height, kind not None : cudaMemcpyKind, stream): + """ Copies data between host and device. - - :py:obj:`~.cudaArraySparse`: Allocates a CUDA mipmapped array without - physical backing memory. The subregions within this sparse array can - later be mapped onto a physical memory allocation by calling - :py:obj:`~.cuMemMapArrayAsync`. This flag can only be used for - creating 2D, 3D or 2D layered sparse CUDA mipmapped arrays. The - physical backing memory must be allocated via - :py:obj:`~.cuMemCreate`. + Copies a matrix (`height` rows of `width` bytes each) from the memory + area pointed to by `src` to the memory area pointed to by `dst`, where + `kind` specifies the direction of the copy, and must be one of + :py:obj:`~.cudaMemcpyHostToHost`, :py:obj:`~.cudaMemcpyHostToDevice`, + :py:obj:`~.cudaMemcpyDeviceToHost`, + :py:obj:`~.cudaMemcpyDeviceToDevice`, or :py:obj:`~.cudaMemcpyDefault`. + Passing :py:obj:`~.cudaMemcpyDefault` is recommended, in which case the + type of transfer is inferred from the pointer values. However, + :py:obj:`~.cudaMemcpyDefault` is only allowed on systems that support + unified virtual addressing. `dpitch` and `spitch` are the widths in + memory in bytes of the 2D arrays pointed to by `dst` and `src`, + including any padding added to the end of each row. The memory areas + may not overlap. `width` must not exceed either `dpitch` or `spitch`. - - :py:obj:`~.cudaArrayDeferredMapping`: Allocates a CUDA mipmapped - array without physical backing memory. The entire array can later be - mapped onto a physical memory allocation by calling - :py:obj:`~.cuMemMapArrayAsync`. The physical backing memory must be - allocated via :py:obj:`~.cuMemCreate`. + Calling :py:obj:`~.cudaMemcpy2DAsync()` with `dst` and `src` pointers + that do not match the direction of the copy results in an undefined + behavior. :py:obj:`~.cudaMemcpy2DAsync()` returns an error if `dpitch` + or `spitch` is greater than the maximum allowed. - The width, height and depth extents must meet certain size requirements - as listed in the following table. All values are specified in elements. + :py:obj:`~.cudaMemcpy2DAsync()` is asynchronous with respect to the + host, so the call may return before the copy is complete. The copy can + optionally be associated to a stream by passing a non-zero `stream` + argument. If `kind` is :py:obj:`~.cudaMemcpyHostToDevice` or + :py:obj:`~.cudaMemcpyDeviceToHost` and `stream` is non-zero, the copy + may overlap with operations in other streams. - **View CUDA Toolkit Documentation for a table example** + The device version of this function only handles device to device + copies and cannot be given local or shared pointers. Parameters ---------- - desc : :py:obj:`~.cudaChannelFormatDesc` - Requested channel format - extent : :py:obj:`~.cudaExtent` - Requested allocation size (`width` field in elements) - numLevels : unsigned int - Number of mipmap levels to allocate - flags : unsigned int - Flags for extensions + dst : Any + Destination memory address + dpitch : size_t + Pitch of destination memory + src : Any + Source memory address + spitch : size_t + Pitch of source memory + width : size_t + Width of matrix transfer (columns in bytes) + height : size_t + Height of matrix transfer (rows) + kind : :py:obj:`~.cudaMemcpyKind` + Type of transfer + stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + Stream identifier Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorMemoryAllocation` - mipmappedArray : :py:obj:`~.cudaMipmappedArray_t` - Pointer to allocated mipmapped array in device memory + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidPitchValue`, :py:obj:`~.cudaErrorInvalidMemcpyDirection` See Also -------- - :py:obj:`~.cudaMalloc3D`, :py:obj:`~.cudaMalloc`, :py:obj:`~.cudaMallocPitch`, :py:obj:`~.cudaFree`, :py:obj:`~.cudaFreeArray`, :py:obj:`~.cudaMallocHost (C API)`, :py:obj:`~.cudaFreeHost`, :py:obj:`~.cudaHostAlloc`, :py:obj:`~.make_cudaExtent`, :py:obj:`~.cuMipmappedArrayCreate` + :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpy2D`, :py:obj:`~.cudaMemcpy2DToArray`, :py:obj:`~.cudaMemcpy2DFromArray`, :py:obj:`~.cudaMemcpy2DArrayToArray`, :py:obj:`~.cudaMemcpyToSymbol`, :py:obj:`~.cudaMemcpyFromSymbol`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpy2DToArrayAsync`, :py:obj:`~.cudaMemcpy2DFromArrayAsync`, :py:obj:`~.cudaMemcpyToSymbolAsync`, :py:obj:`~.cudaMemcpyFromSymbolAsync`, :py:obj:`~.cuMemcpy2DAsync` """ - cdef cudaMipmappedArray_t mipmappedArray = cudaMipmappedArray_t() - cdef ccudart.cudaChannelFormatDesc* cdesc_ptr = desc._ptr if desc != None else NULL - err = ccudart.cudaMallocMipmappedArray(mipmappedArray._ptr, cdesc_ptr, extent._ptr[0], numLevels, flags) - return (cudaError_t(err), mipmappedArray) -{{endif}} - -{{if 'cudaGetMipmappedArrayLevel' in found_functions}} + cdef cyruntime.cudaStream_t cystream + if stream is None: + pstream = 0 + elif isinstance(stream, (cudaStream_t,driver.CUstream)): + pstream = int(stream) + else: + pstream = int(cudaStream_t(stream)) + cystream = pstream + cdef _HelperInputVoidPtrStruct cydstHelper + cdef void* cydst = _helper_input_void_ptr(dst, &cydstHelper) + cdef _HelperInputVoidPtrStruct cysrcHelper + cdef void* cysrc = _helper_input_void_ptr(src, &cysrcHelper) + cdef cyruntime.cudaMemcpyKind cykind = int(kind) + with nogil: + err = cyruntime.cudaMemcpy2DAsync(cydst, dpitch, cysrc, spitch, width, height, cykind, cystream) + _helper_input_void_ptr_free(&cydstHelper) + _helper_input_void_ptr_free(&cysrcHelper) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaGetMipmappedArrayLevel(mipmappedArray, unsigned int level): - """ Gets a mipmap level of a CUDA mipmapped array. +def cudaMemcpy2DToArrayAsync(dst, size_t wOffset, size_t hOffset, src, size_t spitch, size_t width, size_t height, kind not None : cudaMemcpyKind, stream): + """ Copies data between host and device. - Returns in `*levelArray` a CUDA array that represents a single mipmap - level of the CUDA mipmapped array `mipmappedArray`. + Copies a matrix (`height` rows of `width` bytes each) from the memory + area pointed to by `src` to the CUDA array `dst` starting at `hOffset` + rows and `wOffset` bytes from the upper left corner, where `kind` + specifies the direction of the copy, and must be one of + :py:obj:`~.cudaMemcpyHostToHost`, :py:obj:`~.cudaMemcpyHostToDevice`, + :py:obj:`~.cudaMemcpyDeviceToHost`, + :py:obj:`~.cudaMemcpyDeviceToDevice`, or :py:obj:`~.cudaMemcpyDefault`. + Passing :py:obj:`~.cudaMemcpyDefault` is recommended, in which case the + type of transfer is inferred from the pointer values. However, + :py:obj:`~.cudaMemcpyDefault` is only allowed on systems that support + unified virtual addressing. `spitch` is the width in memory in bytes of + the 2D array pointed to by `src`, including any padding added to the + end of each row. `wOffset` + `width` must not exceed the width of the + CUDA array `dst`. `width` must not exceed `spitch`. + :py:obj:`~.cudaMemcpy2DToArrayAsync()` returns an error if `spitch` + exceeds the maximum allowed. - If `level` is greater than the maximum number of levels in this - mipmapped array, :py:obj:`~.cudaErrorInvalidValue` is returned. + :py:obj:`~.cudaMemcpy2DToArrayAsync()` is asynchronous with respect to + the host, so the call may return before the copy is complete. The copy + can optionally be associated to a stream by passing a non-zero `stream` + argument. If `kind` is :py:obj:`~.cudaMemcpyHostToDevice` or + :py:obj:`~.cudaMemcpyDeviceToHost` and `stream` is non-zero, the copy + may overlap with operations in other streams. - If `mipmappedArray` is NULL, :py:obj:`~.cudaErrorInvalidResourceHandle` - is returned. + :py:obj:`~.cudaMemcpy2DFromArrayAsync`, + :py:obj:`~.cudaMemcpyToSymbolAsync`, + :py:obj:`~.cudaMemcpyFromSymbolAsync`, :py:obj:`~.cuMemcpy2DAsync` Parameters ---------- - mipmappedArray : :py:obj:`~.cudaMipmappedArray_const_t` - CUDA mipmapped array - level : unsigned int - Mipmap level + dst : :py:obj:`~.cudaArray_t` + Destination memory address + wOffset : size_t + Destination starting X offset (columns in bytes) + hOffset : size_t + Destination starting Y offset (rows) + src : Any + Source memory address + spitch : size_t + Pitch of source memory + width : size_t + Width of matrix transfer (columns in bytes) + height : size_t + Height of matrix transfer (rows) + kind : :py:obj:`~.cudaMemcpyKind` + Type of transfer + stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + Stream identifier Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :py:obj:`~.cudaErrorInvalidResourceHandle` - levelArray : :py:obj:`~.cudaArray_t` - Returned mipmap level CUDA array + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidPitchValue`, :py:obj:`~.cudaErrorInvalidMemcpyDirection` See Also -------- - :py:obj:`~.cudaMalloc3D`, :py:obj:`~.cudaMalloc`, :py:obj:`~.cudaMallocPitch`, :py:obj:`~.cudaFree`, :py:obj:`~.cudaFreeArray`, :py:obj:`~.cudaMallocHost (C API)`, :py:obj:`~.cudaFreeHost`, :py:obj:`~.cudaHostAlloc`, :py:obj:`~.make_cudaExtent`, :py:obj:`~.cuMipmappedArrayGetLevel` + :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpy2D`, :py:obj:`~.cudaMemcpy2DToArray`, :py:obj:`~.cudaMemcpy2DFromArray`, :py:obj:`~.cudaMemcpy2DArrayToArray`, :py:obj:`~.cudaMemcpyToSymbol`, :py:obj:`~.cudaMemcpyFromSymbol`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpy2DAsync`, """ - cdef ccudart.cudaMipmappedArray_const_t cmipmappedArray - if mipmappedArray is None: - cmipmappedArray = 0 - elif isinstance(mipmappedArray, (cudaMipmappedArray_const_t,)): - pmipmappedArray = int(mipmappedArray) - cmipmappedArray = pmipmappedArray + cdef cyruntime.cudaStream_t cystream + if stream is None: + pstream = 0 + elif isinstance(stream, (cudaStream_t,driver.CUstream)): + pstream = int(stream) else: - pmipmappedArray = int(cudaMipmappedArray_const_t(mipmappedArray)) - cmipmappedArray = pmipmappedArray - cdef cudaArray_t levelArray = cudaArray_t() - err = ccudart.cudaGetMipmappedArrayLevel(levelArray._ptr, cmipmappedArray, level) - return (cudaError_t(err), levelArray) -{{endif}} - -{{if 'cudaMemcpy3D' in found_functions}} + pstream = int(cudaStream_t(stream)) + cystream = pstream + cdef cyruntime.cudaArray_t cydst + if dst is None: + pdst = 0 + elif isinstance(dst, (cudaArray_t,)): + pdst = int(dst) + else: + pdst = int(cudaArray_t(dst)) + cydst = pdst + cdef _HelperInputVoidPtrStruct cysrcHelper + cdef void* cysrc = _helper_input_void_ptr(src, &cysrcHelper) + cdef cyruntime.cudaMemcpyKind cykind = int(kind) + with nogil: + err = cyruntime.cudaMemcpy2DToArrayAsync(cydst, wOffset, hOffset, cysrc, spitch, width, height, cykind, cystream) + _helper_input_void_ptr_free(&cysrcHelper) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaMemcpy3D(p : Optional[cudaMemcpy3DParms]): - """ Copies data between 3D objects. - - **View CUDA Toolkit Documentation for a C++ code example** - - :py:obj:`~.cudaMemcpy3D()` copies data betwen two 3D objects. The - source and destination objects may be in either host memory, device - memory, or a CUDA array. The source, destination, extent, and kind of - copy performed is specified by the :py:obj:`~.cudaMemcpy3DParms` struct - which should be initialized to zero before use: - - **View CUDA Toolkit Documentation for a C++ code example** - - The struct passed to :py:obj:`~.cudaMemcpy3D()` must specify one of - `srcArray` or `srcPtr` and one of `dstArray` or `dstPtr`. Passing more - than one non-zero source or destination will cause - :py:obj:`~.cudaMemcpy3D()` to return an error. - - The `srcPos` and `dstPos` fields are optional offsets into the source - and destination objects and are defined in units of each object's - elements. The element for a host or device pointer is assumed to be - unsigned char. - - The `extent` field defines the dimensions of the transferred area in - elements. If a CUDA array is participating in the copy, the extent is - defined in terms of that array's elements. If no CUDA array is - participating in the copy then the extents are defined in elements of - unsigned char. +def cudaMemcpy2DFromArrayAsync(dst, size_t dpitch, src, size_t wOffset, size_t hOffset, size_t width, size_t height, kind not None : cudaMemcpyKind, stream): + """ Copies data between host and device. - The `kind` field defines the direction of the copy. It must be one of + Copies a matrix (`height` rows of `width` bytes each) from the CUDA + array `src` starting at `hOffset` rows and `wOffset` bytes from the + upper left corner to the memory area pointed to by `dst`, where `kind` + specifies the direction of the copy, and must be one of :py:obj:`~.cudaMemcpyHostToHost`, :py:obj:`~.cudaMemcpyHostToDevice`, :py:obj:`~.cudaMemcpyDeviceToHost`, :py:obj:`~.cudaMemcpyDeviceToDevice`, or :py:obj:`~.cudaMemcpyDefault`. Passing :py:obj:`~.cudaMemcpyDefault` is recommended, in which case the type of transfer is inferred from the pointer values. However, :py:obj:`~.cudaMemcpyDefault` is only allowed on systems that support - unified virtual addressing. For :py:obj:`~.cudaMemcpyHostToHost` or - :py:obj:`~.cudaMemcpyHostToDevice` or - :py:obj:`~.cudaMemcpyDeviceToHost` passed as kind and cudaArray type - passed as source or destination, if the kind implies cudaArray type to - be present on the host, :py:obj:`~.cudaMemcpy3D()` will disregard that - implication and silently correct the kind based on the fact that - cudaArray type can only be present on the device. - - If the source and destination are both arrays, - :py:obj:`~.cudaMemcpy3D()` will return an error if they do not have the - same element size. - - The source and destination object may not overlap. If overlapping - source and destination objects are specified, undefined behavior will - result. + unified virtual addressing. `dpitch` is the width in memory in bytes of + the 2D array pointed to by `dst`, including any padding added to the + end of each row. `wOffset` + `width` must not exceed the width of the + CUDA array `src`. `width` must not exceed `dpitch`. + :py:obj:`~.cudaMemcpy2DFromArrayAsync()` returns an error if `dpitch` + exceeds the maximum allowed. - The source object must entirely contain the region defined by `srcPos` - and `extent`. The destination object must entirely contain the region - defined by `dstPos` and `extent`. + :py:obj:`~.cudaMemcpy2DFromArrayAsync()` is asynchronous with respect + to the host, so the call may return before the copy is complete. The + copy can optionally be associated to a stream by passing a non-zero + `stream` argument. If `kind` is :py:obj:`~.cudaMemcpyHostToDevice` or + :py:obj:`~.cudaMemcpyDeviceToHost` and `stream` is non-zero, the copy + may overlap with operations in other streams. - :py:obj:`~.cudaMemcpy3D()` returns an error if the pitch of `srcPtr` or - `dstPtr` exceeds the maximum allowed. The pitch of a - :py:obj:`~.cudaPitchedPtr` allocated with :py:obj:`~.cudaMalloc3D()` - will always be valid. + :py:obj:`~.cudaMemcpyToSymbolAsync`, + :py:obj:`~.cudaMemcpyFromSymbolAsync`, :py:obj:`~.cuMemcpy2DAsync` Parameters ---------- - p : :py:obj:`~.cudaMemcpy3DParms` - 3D memory copy parameters + dst : Any + Destination memory address + dpitch : size_t + Pitch of destination memory + src : :py:obj:`~.cudaArray_const_t` + Source memory address + wOffset : size_t + Source starting X offset (columns in bytes) + hOffset : size_t + Source starting Y offset (rows) + width : size_t + Width of matrix transfer (columns in bytes) + height : size_t + Height of matrix transfer (rows) + kind : :py:obj:`~.cudaMemcpyKind` + Type of transfer + stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + Stream identifier Returns ------- @@ -20355,625 +28598,920 @@ def cudaMemcpy3D(p : Optional[cudaMemcpy3DParms]): See Also -------- - :py:obj:`~.cudaMalloc3D`, :py:obj:`~.cudaMalloc3DArray`, :py:obj:`~.cudaMemset3D`, :py:obj:`~.cudaMemcpy3DAsync`, :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpy2D`, :py:obj:`~.cudaMemcpy2DToArray`, :py:obj:`~.cudaMemcpy2DFromArray`, :py:obj:`~.cudaMemcpy2DArrayToArray`, :py:obj:`~.cudaMemcpyToSymbol`, :py:obj:`~.cudaMemcpyFromSymbol`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpy2DAsync`, :py:obj:`~.cudaMemcpy2DToArrayAsync`, :py:obj:`~.cudaMemcpy2DFromArrayAsync`, :py:obj:`~.cudaMemcpyToSymbolAsync`, :py:obj:`~.cudaMemcpyFromSymbolAsync`, :py:obj:`~.make_cudaExtent`, :py:obj:`~.make_cudaPos`, :py:obj:`~.cuMemcpy3D` + :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpy2D`, :py:obj:`~.cudaMemcpy2DToArray`, :py:obj:`~.cudaMemcpy2DFromArray`, :py:obj:`~.cudaMemcpy2DArrayToArray`, :py:obj:`~.cudaMemcpyToSymbol`, :py:obj:`~.cudaMemcpyFromSymbol`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpy2DAsync`, :py:obj:`~.cudaMemcpy2DToArrayAsync`, """ - cdef ccudart.cudaMemcpy3DParms* cp_ptr = p._ptr if p != None else NULL + cdef cyruntime.cudaStream_t cystream + if stream is None: + pstream = 0 + elif isinstance(stream, (cudaStream_t,driver.CUstream)): + pstream = int(stream) + else: + pstream = int(cudaStream_t(stream)) + cystream = pstream + cdef cyruntime.cudaArray_const_t cysrc + if src is None: + psrc = 0 + elif isinstance(src, (cudaArray_const_t,)): + psrc = int(src) + else: + psrc = int(cudaArray_const_t(src)) + cysrc = psrc + cdef _HelperInputVoidPtrStruct cydstHelper + cdef void* cydst = _helper_input_void_ptr(dst, &cydstHelper) + cdef cyruntime.cudaMemcpyKind cykind = int(kind) with nogil: - err = ccudart.cudaMemcpy3D(cp_ptr) - - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaMemcpy3DPeer' in found_functions}} + err = cyruntime.cudaMemcpy2DFromArrayAsync(cydst, dpitch, cysrc, wOffset, hOffset, width, height, cykind, cystream) + _helper_input_void_ptr_free(&cydstHelper) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaMemcpy3DPeer(p : Optional[cudaMemcpy3DPeerParms]): - """ Copies memory between devices. +def cudaMemset(devPtr, int value, size_t count): + """ Initializes or sets device memory to a value. - Perform a 3D memory copy according to the parameters specified in `p`. - See the definition of the :py:obj:`~.cudaMemcpy3DPeerParms` structure - for documentation of its parameters. + Fills the first `count` bytes of the memory area pointed to by `devPtr` + with the constant byte value `value`. - Note that this function is synchronous with respect to the host only if - the source or destination of the transfer is host memory. Note also - that this copy is serialized with respect to all pending and future - asynchronous work in to the current device, the copy's source device, - and the copy's destination device (use - :py:obj:`~.cudaMemcpy3DPeerAsync` to avoid this synchronization). + Note that this function is asynchronous with respect to the host unless + `devPtr` refers to pinned host memory. Parameters ---------- - p : :py:obj:`~.cudaMemcpy3DPeerParms` - Parameters for the memory copy + devPtr : Any + Pointer to device memory + value : int + Value to set for each byte of specified memory + count : size_t + Size in bytes to set Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidDevice`, :py:obj:`~.cudaErrorInvalidPitchValue` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, See Also -------- - :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpyPeer`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpyPeerAsync`, :py:obj:`~.cudaMemcpy3DPeerAsync`, :py:obj:`~.cuMemcpy3DPeer` + :py:obj:`~.cuMemsetD8`, :py:obj:`~.cuMemsetD16`, :py:obj:`~.cuMemsetD32` """ - cdef ccudart.cudaMemcpy3DPeerParms* cp_ptr = p._ptr if p != None else NULL - err = ccudart.cudaMemcpy3DPeer(cp_ptr) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaMemcpy3DAsync' in found_functions}} + cdef _HelperInputVoidPtrStruct cydevPtrHelper + cdef void* cydevPtr = _helper_input_void_ptr(devPtr, &cydevPtrHelper) + with nogil: + err = cyruntime.cudaMemset(cydevPtr, value, count) + _helper_input_void_ptr_free(&cydevPtrHelper) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaMemcpy3DAsync(p : Optional[cudaMemcpy3DParms], stream): - """ Copies data between 3D objects. - - **View CUDA Toolkit Documentation for a C++ code example** - - :py:obj:`~.cudaMemcpy3DAsync()` copies data betwen two 3D objects. The - source and destination objects may be in either host memory, device - memory, or a CUDA array. The source, destination, extent, and kind of - copy performed is specified by the :py:obj:`~.cudaMemcpy3DParms` struct - which should be initialized to zero before use: - - **View CUDA Toolkit Documentation for a C++ code example** - - The struct passed to :py:obj:`~.cudaMemcpy3DAsync()` must specify one - of `srcArray` or `srcPtr` and one of `dstArray` or `dstPtr`. Passing - more than one non-zero source or destination will cause - :py:obj:`~.cudaMemcpy3DAsync()` to return an error. - - The `srcPos` and `dstPos` fields are optional offsets into the source - and destination objects and are defined in units of each object's - elements. The element for a host or device pointer is assumed to be - unsigned char. For CUDA arrays, positions must be in the range [0, - 2048) for any dimension. - - The `extent` field defines the dimensions of the transferred area in - elements. If a CUDA array is participating in the copy, the extent is - defined in terms of that array's elements. If no CUDA array is - participating in the copy then the extents are defined in elements of - unsigned char. - - The `kind` field defines the direction of the copy. It must be one of - :py:obj:`~.cudaMemcpyHostToHost`, :py:obj:`~.cudaMemcpyHostToDevice`, - :py:obj:`~.cudaMemcpyDeviceToHost`, - :py:obj:`~.cudaMemcpyDeviceToDevice`, or :py:obj:`~.cudaMemcpyDefault`. - Passing :py:obj:`~.cudaMemcpyDefault` is recommended, in which case the - type of transfer is inferred from the pointer values. However, - :py:obj:`~.cudaMemcpyDefault` is only allowed on systems that support - unified virtual addressing. For :py:obj:`~.cudaMemcpyHostToHost` or - :py:obj:`~.cudaMemcpyHostToDevice` or - :py:obj:`~.cudaMemcpyDeviceToHost` passed as kind and cudaArray type - passed as source or destination, if the kind implies cudaArray type to - be present on the host, :py:obj:`~.cudaMemcpy3DAsync()` will disregard - that implication and silently correct the kind based on the fact that - cudaArray type can only be present on the device. - - If the source and destination are both arrays, - :py:obj:`~.cudaMemcpy3DAsync()` will return an error if they do not - have the same element size. - - The source and destination object may not overlap. If overlapping - source and destination objects are specified, undefined behavior will - result. - - The source object must lie entirely within the region defined by - `srcPos` and `extent`. The destination object must lie entirely within - the region defined by `dstPos` and `extent`. - - :py:obj:`~.cudaMemcpy3DAsync()` returns an error if the pitch of - `srcPtr` or `dstPtr` exceeds the maximum allowed. The pitch of a - :py:obj:`~.cudaPitchedPtr` allocated with :py:obj:`~.cudaMalloc3D()` - will always be valid. +def cudaMemset2D(devPtr, size_t pitch, int value, size_t width, size_t height): + """ Initializes or sets device memory to a value. - :py:obj:`~.cudaMemcpy3DAsync()` is asynchronous with respect to the - host, so the call may return before the copy is complete. The copy can - optionally be associated to a stream by passing a non-zero `stream` - argument. If `kind` is :py:obj:`~.cudaMemcpyHostToDevice` or - :py:obj:`~.cudaMemcpyDeviceToHost` and `stream` is non-zero, the copy - may overlap with operations in other streams. + Sets to the specified value `value` a matrix (`height` rows of `width` + bytes each) pointed to by `dstPtr`. `pitch` is the width in bytes of + the 2D array pointed to by `dstPtr`, including any padding added to the + end of each row. This function performs fastest when the pitch is one + that has been passed back by :py:obj:`~.cudaMallocPitch()`. - The device version of this function only handles device to device - copies and cannot be given local or shared pointers. + Note that this function is asynchronous with respect to the host unless + `devPtr` refers to pinned host memory. Parameters ---------- - p : :py:obj:`~.cudaMemcpy3DParms` - 3D memory copy parameters - stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` - Stream identifier + devPtr : Any + Pointer to 2D device memory + pitch : size_t + Pitch in bytes of 2D device memory(Unused if `height` is 1) + value : int + Value to set for each byte of specified memory + width : size_t + Width of matrix set (columns in bytes) + height : size_t + Height of matrix set (rows) Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidPitchValue`, :py:obj:`~.cudaErrorInvalidMemcpyDirection` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, See Also -------- - :py:obj:`~.cudaMalloc3D`, :py:obj:`~.cudaMalloc3DArray`, :py:obj:`~.cudaMemset3D`, :py:obj:`~.cudaMemcpy3D`, :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpy2D`, :py:obj:`~.cudaMemcpy2DToArray`, ::::py:obj:`~.cudaMemcpy2DFromArray`, :py:obj:`~.cudaMemcpy2DArrayToArray`, :py:obj:`~.cudaMemcpyToSymbol`, :py:obj:`~.cudaMemcpyFromSymbol`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpy2DAsync`, :py:obj:`~.cudaMemcpy2DToArrayAsync`, :py:obj:`~.cudaMemcpy2DFromArrayAsync`, :py:obj:`~.cudaMemcpyToSymbolAsync`, :py:obj:`~.cudaMemcpyFromSymbolAsync`, :py:obj:`~.make_cudaExtent`, :py:obj:`~.make_cudaPos`, :py:obj:`~.cuMemcpy3DAsync` + :py:obj:`~.cudaMemset`, :py:obj:`~.cudaMemset3D`, :py:obj:`~.cudaMemsetAsync`, :py:obj:`~.cudaMemset2DAsync`, :py:obj:`~.cudaMemset3DAsync`, :py:obj:`~.cuMemsetD2D8`, :py:obj:`~.cuMemsetD2D16`, :py:obj:`~.cuMemsetD2D32` """ - cdef ccudart.cudaStream_t cstream - if stream is None: - cstream = 0 - elif isinstance(stream, (cudaStream_t,cuda.CUstream)): - pstream = int(stream) - cstream = pstream - else: - pstream = int(cudaStream_t(stream)) - cstream = pstream - cdef ccudart.cudaMemcpy3DParms* cp_ptr = p._ptr if p != None else NULL + cdef _HelperInputVoidPtrStruct cydevPtrHelper + cdef void* cydevPtr = _helper_input_void_ptr(devPtr, &cydevPtrHelper) with nogil: - err = ccudart.cudaMemcpy3DAsync(cp_ptr, cstream) - - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaMemcpy3DPeerAsync' in found_functions}} + err = cyruntime.cudaMemset2D(cydevPtr, pitch, value, width, height) + _helper_input_void_ptr_free(&cydevPtrHelper) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaMemcpy3DPeerAsync(p : Optional[cudaMemcpy3DPeerParms], stream): - """ Copies memory between devices asynchronously. - - Perform a 3D memory copy according to the parameters specified in `p`. - See the definition of the :py:obj:`~.cudaMemcpy3DPeerParms` structure - for documentation of its parameters. - - Parameters - ---------- - p : :py:obj:`~.cudaMemcpy3DPeerParms` - Parameters for the memory copy - stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` - Stream identifier +def cudaMemset3D(pitchedDevPtr not None : cudaPitchedPtr, int value, extent not None : cudaExtent): + """ Initializes or sets device memory to a value. - Returns - ------- - cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidDevice`, :py:obj:`~.cudaErrorInvalidPitchValue` + Initializes each element of a 3D array to the specified value `value`. + The object to initialize is defined by `pitchedDevPtr`. The `pitch` + field of `pitchedDevPtr` is the width in memory in bytes of the 3D + array pointed to by `pitchedDevPtr`, including any padding added to the + end of each row. The `xsize` field specifies the logical width of each + row in bytes, while the `ysize` field specifies the height of each 2D + slice in rows. The `pitch` field of `pitchedDevPtr` is ignored when + `height` and `depth` are both equal to 1. - See Also - -------- - :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpyPeer`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpyPeerAsync`, :py:obj:`~.cudaMemcpy3DPeerAsync`, :py:obj:`~.cuMemcpy3DPeerAsync` - """ - cdef ccudart.cudaStream_t cstream - if stream is None: - cstream = 0 - elif isinstance(stream, (cudaStream_t,cuda.CUstream)): - pstream = int(stream) - cstream = pstream - else: - pstream = int(cudaStream_t(stream)) - cstream = pstream - cdef ccudart.cudaMemcpy3DPeerParms* cp_ptr = p._ptr if p != None else NULL - err = ccudart.cudaMemcpy3DPeerAsync(cp_ptr, cstream) - return (cudaError_t(err),) -{{endif}} + The extents of the initialized region are specified as a `width` in + bytes, a `height` in rows, and a `depth` in slices. -{{if 'cudaMemGetInfo' in found_functions}} + Extents with `width` greater than or equal to the `xsize` of + `pitchedDevPtr` may perform significantly faster than extents narrower + than the `xsize`. Secondarily, extents with `height` equal to the + `ysize` of `pitchedDevPtr` will perform faster than when the `height` + is shorter than the `ysize`. -@cython.embedsignature(True) -def cudaMemGetInfo(): - """ Gets free and total device memory. + This function performs fastest when the `pitchedDevPtr` has been + allocated by :py:obj:`~.cudaMalloc3D()`. - Returns in `*total` the total amount of memory available to the the - current context. Returns in `*free` the amount of memory on the device - that is free according to the OS. CUDA is not guaranteed to be able to - allocate all of the memory that the OS reports as free. In a multi- - tenet situation, free estimate returned is prone to race condition - where a new allocation/free done by a different process or a different - thread in the same process between the time when free memory was - estimated and reported, will result in deviation in free value reported - and actual free memory. + Note that this function is asynchronous with respect to the host unless + `pitchedDevPtr` refers to pinned host memory. - The integrated GPU on Tegra shares memory with CPU and other component - of the SoC. The free and total values returned by the API excludes the - SWAP memory space maintained by the OS on some platforms. The OS may - move some of the memory pages into swap area as the GPU or CPU allocate - or access memory. See Tegra app note on how to calculate total and free - memory on Tegra. + Parameters + ---------- + pitchedDevPtr : :py:obj:`~.cudaPitchedPtr` + Pointer to pitched device memory + value : int + Value to set for each byte of specified memory + extent : :py:obj:`~.cudaExtent` + Size parameters for where to set device memory (`width` field in + bytes) Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorLaunchFailure` - free : int - Returned free memory in bytes - total : int - Returned total memory in bytes + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, See Also -------- - :py:obj:`~.cuMemGetInfo` + :py:obj:`~.cudaMemset`, :py:obj:`~.cudaMemset2D`, :py:obj:`~.cudaMemsetAsync`, :py:obj:`~.cudaMemset2DAsync`, :py:obj:`~.cudaMemset3DAsync`, :py:obj:`~.cudaMalloc3D`, :py:obj:`~.make_cudaPitchedPtr`, :py:obj:`~.make_cudaExtent` """ - cdef size_t free = 0 - cdef size_t total = 0 - err = ccudart.cudaMemGetInfo(&free, &total) - return (cudaError_t(err), free, total) -{{endif}} - -{{if 'cudaArrayGetInfo' in found_functions}} + with nogil: + err = cyruntime.cudaMemset3D(pitchedDevPtr._pvt_ptr[0], value, extent._pvt_ptr[0]) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaArrayGetInfo(array): - """ Gets info about the specified cudaArray. +def cudaMemsetAsync(devPtr, int value, size_t count, stream): + """ Initializes or sets device memory to a value. - Returns in `*desc`, `*extent` and `*flags` respectively, the type, - shape and flags of `array`. + Fills the first `count` bytes of the memory area pointed to by `devPtr` + with the constant byte value `value`. - Any of `*desc`, `*extent` and `*flags` may be specified as NULL. + :py:obj:`~.cudaMemsetAsync()` is asynchronous with respect to the host, + so the call may return before the memset is complete. The operation can + optionally be associated to a stream by passing a non-zero `stream` + argument. If `stream` is non-zero, the operation may overlap with + operations in other streams. + + The device version of this function only handles device to device + copies and cannot be given local or shared pointers. Parameters ---------- - array : :py:obj:`~.cudaArray_t` - The :py:obj:`~.cudaArray` to get info for + devPtr : Any + Pointer to device memory + value : int + Value to set for each byte of specified memory + count : size_t + Size in bytes to set + stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + Stream identifier Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` - desc : :py:obj:`~.cudaChannelFormatDesc` - Returned array type - extent : :py:obj:`~.cudaExtent` - Returned array shape. 2D arrays will have depth of zero - flags : unsigned int - Returned array flags + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, See Also -------- - :py:obj:`~.cuArrayGetDescriptor`, :py:obj:`~.cuArray3DGetDescriptor` + :py:obj:`~.cudaMemset`, :py:obj:`~.cudaMemset2D`, :py:obj:`~.cudaMemset3D`, :py:obj:`~.cudaMemset2DAsync`, :py:obj:`~.cudaMemset3DAsync`, :py:obj:`~.cuMemsetD8Async`, :py:obj:`~.cuMemsetD16Async`, :py:obj:`~.cuMemsetD32Async` """ - cdef ccudart.cudaArray_t carray - if array is None: - carray = 0 - elif isinstance(array, (cudaArray_t,)): - parray = int(array) - carray = parray + cdef cyruntime.cudaStream_t cystream + if stream is None: + pstream = 0 + elif isinstance(stream, (cudaStream_t,driver.CUstream)): + pstream = int(stream) else: - parray = int(cudaArray_t(array)) - carray = parray - cdef cudaChannelFormatDesc desc = cudaChannelFormatDesc() - cdef cudaExtent extent = cudaExtent() - cdef unsigned int flags = 0 - err = ccudart.cudaArrayGetInfo(desc._ptr, extent._ptr, &flags, carray) - return (cudaError_t(err), desc, extent, flags) -{{endif}} - -{{if 'cudaArrayGetPlane' in found_functions}} + pstream = int(cudaStream_t(stream)) + cystream = pstream + cdef _HelperInputVoidPtrStruct cydevPtrHelper + cdef void* cydevPtr = _helper_input_void_ptr(devPtr, &cydevPtrHelper) + with nogil: + err = cyruntime.cudaMemsetAsync(cydevPtr, value, count, cystream) + _helper_input_void_ptr_free(&cydevPtrHelper) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaArrayGetPlane(hArray, unsigned int planeIdx): - """ Gets a CUDA array plane from a CUDA array. +def cudaMemset2DAsync(devPtr, size_t pitch, int value, size_t width, size_t height, stream): + """ Initializes or sets device memory to a value. - Returns in `pPlaneArray` a CUDA array that represents a single format - plane of the CUDA array `hArray`. + Sets to the specified value `value` a matrix (`height` rows of `width` + bytes each) pointed to by `dstPtr`. `pitch` is the width in bytes of + the 2D array pointed to by `dstPtr`, including any padding added to the + end of each row. This function performs fastest when the pitch is one + that has been passed back by :py:obj:`~.cudaMallocPitch()`. - If `planeIdx` is greater than the maximum number of planes in this - array or if the array does not have a multi-planar format e.g: - :py:obj:`~.cudaChannelFormatKindNV12`, then - :py:obj:`~.cudaErrorInvalidValue` is returned. + :py:obj:`~.cudaMemset2DAsync()` is asynchronous with respect to the + host, so the call may return before the memset is complete. The + operation can optionally be associated to a stream by passing a non- + zero `stream` argument. If `stream` is non-zero, the operation may + overlap with operations in other streams. - Note that if the `hArray` has format - :py:obj:`~.cudaChannelFormatKindNV12`, then passing in 0 for `planeIdx` - returns a CUDA array of the same size as `hArray` but with one 8-bit - channel and :py:obj:`~.cudaChannelFormatKindUnsigned` as its format - kind. If 1 is passed for `planeIdx`, then the returned CUDA array has - half the height and width of `hArray` with two 8-bit channels and - :py:obj:`~.cudaChannelFormatKindUnsigned` as its format kind. + The device version of this function only handles device to device + copies and cannot be given local or shared pointers. Parameters ---------- - hArray : :py:obj:`~.cudaArray_t` - CUDA array - planeIdx : unsigned int - Plane index + devPtr : Any + Pointer to 2D device memory + pitch : size_t + Pitch in bytes of 2D device memory(Unused if `height` is 1) + value : int + Value to set for each byte of specified memory + width : size_t + Width of matrix set (columns in bytes) + height : size_t + Height of matrix set (rows) + stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + Stream identifier Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` :py:obj:`~.cudaErrorInvalidResourceHandle` - pPlaneArray : :py:obj:`~.cudaArray_t` - Returned CUDA array referenced by the `planeIdx` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, See Also -------- - :py:obj:`~.cuArrayGetPlane` + :py:obj:`~.cudaMemset`, :py:obj:`~.cudaMemset2D`, :py:obj:`~.cudaMemset3D`, :py:obj:`~.cudaMemsetAsync`, :py:obj:`~.cudaMemset3DAsync`, :py:obj:`~.cuMemsetD2D8Async`, :py:obj:`~.cuMemsetD2D16Async`, :py:obj:`~.cuMemsetD2D32Async` """ - cdef ccudart.cudaArray_t chArray - if hArray is None: - chArray = 0 - elif isinstance(hArray, (cudaArray_t,)): - phArray = int(hArray) - chArray = phArray + cdef cyruntime.cudaStream_t cystream + if stream is None: + pstream = 0 + elif isinstance(stream, (cudaStream_t,driver.CUstream)): + pstream = int(stream) else: - phArray = int(cudaArray_t(hArray)) - chArray = phArray - cdef cudaArray_t pPlaneArray = cudaArray_t() - err = ccudart.cudaArrayGetPlane(pPlaneArray._ptr, chArray, planeIdx) - return (cudaError_t(err), pPlaneArray) -{{endif}} - -{{if 'cudaArrayGetMemoryRequirements' in found_functions}} + pstream = int(cudaStream_t(stream)) + cystream = pstream + cdef _HelperInputVoidPtrStruct cydevPtrHelper + cdef void* cydevPtr = _helper_input_void_ptr(devPtr, &cydevPtrHelper) + with nogil: + err = cyruntime.cudaMemset2DAsync(cydevPtr, pitch, value, width, height, cystream) + _helper_input_void_ptr_free(&cydevPtrHelper) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaArrayGetMemoryRequirements(array, int device): - """ Returns the memory requirements of a CUDA array. +def cudaMemset3DAsync(pitchedDevPtr not None : cudaPitchedPtr, int value, extent not None : cudaExtent, stream): + """ Initializes or sets device memory to a value. - Returns the memory requirements of a CUDA array in `memoryRequirements` - If the CUDA array is not allocated with flag - :py:obj:`~.cudaArrayDeferredMapping` :py:obj:`~.cudaErrorInvalidValue` - will be returned. + Initializes each element of a 3D array to the specified value `value`. + The object to initialize is defined by `pitchedDevPtr`. The `pitch` + field of `pitchedDevPtr` is the width in memory in bytes of the 3D + array pointed to by `pitchedDevPtr`, including any padding added to the + end of each row. The `xsize` field specifies the logical width of each + row in bytes, while the `ysize` field specifies the height of each 2D + slice in rows. The `pitch` field of `pitchedDevPtr` is ignored when + `height` and `depth` are both equal to 1. - The returned value in :py:obj:`~.cudaArrayMemoryRequirements.size` - represents the total size of the CUDA array. The returned value in - :py:obj:`~.cudaArrayMemoryRequirements.alignment` represents the - alignment necessary for mapping the CUDA array. + The extents of the initialized region are specified as a `width` in + bytes, a `height` in rows, and a `depth` in slices. + + Extents with `width` greater than or equal to the `xsize` of + `pitchedDevPtr` may perform significantly faster than extents narrower + than the `xsize`. Secondarily, extents with `height` equal to the + `ysize` of `pitchedDevPtr` will perform faster than when the `height` + is shorter than the `ysize`. + + This function performs fastest when the `pitchedDevPtr` has been + allocated by :py:obj:`~.cudaMalloc3D()`. + + :py:obj:`~.cudaMemset3DAsync()` is asynchronous with respect to the + host, so the call may return before the memset is complete. The + operation can optionally be associated to a stream by passing a non- + zero `stream` argument. If `stream` is non-zero, the operation may + overlap with operations in other streams. + + The device version of this function only handles device to device + copies and cannot be given local or shared pointers. Parameters ---------- - array : :py:obj:`~.cudaArray_t` - CUDA array to get the memory requirements of - device : int - Device to get the memory requirements for + pitchedDevPtr : :py:obj:`~.cudaPitchedPtr` + Pointer to pitched device memory + value : int + Value to set for each byte of specified memory + extent : :py:obj:`~.cudaExtent` + Size parameters for where to set device memory (`width` field in + bytes) + stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + Stream identifier Returns ------- cudaError_t - :py:obj:`~.cudaSuccess` :py:obj:`~.cudaErrorInvalidValue` - memoryRequirements : :py:obj:`~.cudaArrayMemoryRequirements` - Pointer to :py:obj:`~.cudaArrayMemoryRequirements` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, See Also -------- - :py:obj:`~.cudaMipmappedArrayGetMemoryRequirements` + :py:obj:`~.cudaMemset`, :py:obj:`~.cudaMemset2D`, :py:obj:`~.cudaMemset3D`, :py:obj:`~.cudaMemsetAsync`, :py:obj:`~.cudaMemset2DAsync`, :py:obj:`~.cudaMalloc3D`, :py:obj:`~.make_cudaPitchedPtr`, :py:obj:`~.make_cudaExtent` """ - cdef ccudart.cudaArray_t carray - if array is None: - carray = 0 - elif isinstance(array, (cudaArray_t,)): - parray = int(array) - carray = parray + cdef cyruntime.cudaStream_t cystream + if stream is None: + pstream = 0 + elif isinstance(stream, (cudaStream_t,driver.CUstream)): + pstream = int(stream) else: - parray = int(cudaArray_t(array)) - carray = parray - cdef cudaArrayMemoryRequirements memoryRequirements = cudaArrayMemoryRequirements() - err = ccudart.cudaArrayGetMemoryRequirements(memoryRequirements._ptr, carray, device) - return (cudaError_t(err), memoryRequirements) -{{endif}} + pstream = int(cudaStream_t(stream)) + cystream = pstream + with nogil: + err = cyruntime.cudaMemset3DAsync(pitchedDevPtr._pvt_ptr[0], value, extent._pvt_ptr[0], cystream) + return (_cudaError_t(err),) + +@cython.embedsignature(True) +def cudaMemPrefetchAsync(devPtr, size_t count, location not None : cudaMemLocation, unsigned int flags, stream): + """ Prefetches memory to the specified destination location. + + Prefetches memory to the specified destination location. `devPtr` is + the base device pointer of the memory to be prefetched and `location` + specifies the destination location. `count` specifies the number of + bytes to copy. `stream` is the stream in which the operation is + enqueued. The memory range must refer to managed memory allocated via + :py:obj:`~.cudaMallocManaged` or declared via managed variables, or it + may also refer to memory allocated from a managed memory pool, or it + may also refer to system-allocated memory on systems with non-zero + cudaDevAttrPageableMemoryAccess. + + Specifying :py:obj:`~.cudaMemLocationTypeDevice` for + :py:obj:`~.cudaMemLocation.type` will prefetch memory to GPU specified + by device ordinal :py:obj:`~.cudaMemLocation.id` which must have non- + zero value for the device attribute + :py:obj:`~.concurrentManagedAccess`. Additionally, `stream` must be + associated with a device that has a non-zero value for the device + attribute :py:obj:`~.concurrentManagedAccess`. Specifying + :py:obj:`~.cudaMemLocationTypeHost` as :py:obj:`~.cudaMemLocation.type` + will prefetch data to host memory. Applications can request prefetching + memory to a specific host NUMA node by specifying + :py:obj:`~.cudaMemLocationTypeHostNuma` for + :py:obj:`~.cudaMemLocation.type` and a valid host NUMA node id in + :py:obj:`~.cudaMemLocation.id` Users can also request prefetching + memory to the host NUMA node closest to the current thread's CPU by + specifying :py:obj:`~.cudaMemLocationTypeHostNumaCurrent` for + :py:obj:`~.cudaMemLocation.type`. Note when + :py:obj:`~.cudaMemLocation.type` is etiher + :py:obj:`~.cudaMemLocationTypeHost` OR + :py:obj:`~.cudaMemLocationTypeHostNumaCurrent`, + :py:obj:`~.cudaMemLocation.id` will be ignored. -{{if 'cudaMipmappedArrayGetMemoryRequirements' in found_functions}} + The start address and end address of the memory range will be rounded + down and rounded up respectively to be aligned to CPU page size before + the prefetch operation is enqueued in the stream. -@cython.embedsignature(True) -def cudaMipmappedArrayGetMemoryRequirements(mipmap, int device): - """ Returns the memory requirements of a CUDA mipmapped array. + If no physical memory has been allocated for this region, then this + memory region will be populated and mapped on the destination device. + If there's insufficient memory to prefetch the desired region, the + Unified Memory driver may evict pages from other + :py:obj:`~.cudaMallocManaged` allocations to host memory in order to + make room. Device memory allocated using :py:obj:`~.cudaMalloc` or + :py:obj:`~.cudaMallocArray` will not be evicted. - Returns the memory requirements of a CUDA mipmapped array in - `memoryRequirements` If the CUDA mipmapped array is not allocated with - flag :py:obj:`~.cudaArrayDeferredMapping` - :py:obj:`~.cudaErrorInvalidValue` will be returned. + By default, any mappings to the previous location of the migrated pages + are removed and mappings for the new location are only setup on the + destination location. The exact behavior however also depends on the + settings applied to this memory range via :py:obj:`~.cuMemAdvise` as + described below: - The returned value in :py:obj:`~.cudaArrayMemoryRequirements.size` - represents the total size of the CUDA mipmapped array. The returned - value in :py:obj:`~.cudaArrayMemoryRequirements.alignment` represents - the alignment necessary for mapping the CUDA mipmapped array. + If :py:obj:`~.cudaMemAdviseSetReadMostly` was set on any subset of this + memory range, then that subset will create a read-only copy of the + pages on destination location. If however the destination location is a + host NUMA node, then any pages of that subset that are already in + another host NUMA node will be transferred to the destination. + + If :py:obj:`~.cudaMemAdviseSetPreferredLocation` was called on any + subset of this memory range, then the pages will be migrated to + `location` even if `location` is not the preferred location of any + pages in the memory range. + + If :py:obj:`~.cudaMemAdviseSetAccessedBy` was called on any subset of + this memory range, then mappings to those pages from all the + appropriate processors are updated to refer to the new location if + establishing such a mapping is possible. Otherwise, those mappings are + cleared. + + Note that this API is not required for functionality and only serves to + improve performance by allowing the application to migrate data to a + suitable location before it is accessed. Memory accesses to this range + are always coherent and are allowed even when the data is actively + being migrated. + + Note that this function is asynchronous with respect to the host and + all work on other devices. Parameters ---------- - mipmap : :py:obj:`~.cudaMipmappedArray_t` - CUDA mipmapped array to get the memory requirements of - device : int - Device to get the memory requirements for + devPtr : Any + Pointer to be prefetched + count : size_t + Size in bytes + location : :py:obj:`~.cudaMemLocation` + location to prefetch to + flags : unsigned int + flags for future use, must be zero now. + stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + Stream to enqueue prefetch operation Returns ------- cudaError_t - :py:obj:`~.cudaSuccess` :py:obj:`~.cudaErrorInvalidValue` - memoryRequirements : :py:obj:`~.cudaArrayMemoryRequirements` - Pointer to :py:obj:`~.cudaArrayMemoryRequirements` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidDevice` See Also -------- - :py:obj:`~.cudaArrayGetMemoryRequirements` + :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpyPeer`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpy3DPeerAsync`, :py:obj:`~.cudaMemAdvise`, :py:obj:`~.cuMemPrefetchAsync` """ - cdef ccudart.cudaMipmappedArray_t cmipmap - if mipmap is None: - cmipmap = 0 - elif isinstance(mipmap, (cudaMipmappedArray_t,)): - pmipmap = int(mipmap) - cmipmap = pmipmap + cdef cyruntime.cudaStream_t cystream + if stream is None: + pstream = 0 + elif isinstance(stream, (cudaStream_t,driver.CUstream)): + pstream = int(stream) else: - pmipmap = int(cudaMipmappedArray_t(mipmap)) - cmipmap = pmipmap - cdef cudaArrayMemoryRequirements memoryRequirements = cudaArrayMemoryRequirements() - err = ccudart.cudaMipmappedArrayGetMemoryRequirements(memoryRequirements._ptr, cmipmap, device) - return (cudaError_t(err), memoryRequirements) -{{endif}} - -{{if 'cudaArrayGetSparseProperties' in found_functions}} + pstream = int(cudaStream_t(stream)) + cystream = pstream + cdef _HelperInputVoidPtrStruct cydevPtrHelper + cdef void* cydevPtr = _helper_input_void_ptr(devPtr, &cydevPtrHelper) + with nogil: + err = cyruntime.cudaMemPrefetchAsync(cydevPtr, count, location._pvt_ptr[0], flags, cystream) + _helper_input_void_ptr_free(&cydevPtrHelper) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaArrayGetSparseProperties(array): - """ Returns the layout properties of a sparse CUDA array. +def cudaMemPrefetchBatchAsync(dptrs : Optional[tuple[Any] | list[Any]], sizes : tuple[int] | list[int], size_t count, prefetchLocs : Optional[tuple[cudaMemLocation] | list[cudaMemLocation]], prefetchLocIdxs : tuple[int] | list[int], size_t numPrefetchLocs, unsigned long long flags, stream): + """ Performs a batch of memory prefetches asynchronously. - Returns the layout properties of a sparse CUDA array in - `sparseProperties`. If the CUDA array is not allocated with flag - :py:obj:`~.cudaArraySparse` :py:obj:`~.cudaErrorInvalidValue` will be - returned. + Performs a batch of memory prefetches. The batch as a whole executes in + stream order but operations within a batch are not guaranteed to + execute in any specific order. All devices in the system must have a + non-zero value for the device attribute + :py:obj:`~.cudaDevAttrConcurrentManagedAccess` otherwise the API will + return an error. - If the returned value in :py:obj:`~.cudaArraySparseProperties.flags` - contains :py:obj:`~.cudaArraySparsePropertiesSingleMipTail`, then - :py:obj:`~.cudaArraySparseProperties.miptailSize` represents the total - size of the array. Otherwise, it will be zero. Also, the returned value - in :py:obj:`~.cudaArraySparseProperties.miptailFirstLevel` is always - zero. Note that the `array` must have been allocated using - :py:obj:`~.cudaMallocArray` or :py:obj:`~.cudaMalloc3DArray`. For CUDA - arrays obtained using :py:obj:`~.cudaMipmappedArrayGetLevel`, - :py:obj:`~.cudaErrorInvalidValue` will be returned. Instead, - :py:obj:`~.cudaMipmappedArrayGetSparseProperties` must be used to - obtain the sparse properties of the entire CUDA mipmapped array to - which `array` belongs to. + The semantics of the individual prefetch operations are as described in + :py:obj:`~.cudaMemPrefetchAsync`. - Parameters - ---------- - array : :py:obj:`~.cudaArray_t` - The CUDA array to get the sparse properties of + Performs memory prefetch on address ranges specified in `dptrs` and + `sizes`. Both arrays must be of the same length as specified by + `count`. Each memory range specified must refer to managed memory + allocated via :py:obj:`~.cudaMallocManaged` or declared via managed + variables or it may also refer to system-allocated memory when all + devices have a non-zero value for + :py:obj:`~.cudaDevAttrPageableMemoryAccess`. The prefetch location for + every operation in the batch is specified in the `prefetchLocs` array. + Each entry in this array can apply to more than one operation. This can + be done by specifying in the `prefetchLocIdxs` array, the index of the + first prefetch operation that the corresponding entry in the + `prefetchLocs` array applies to. Both `prefetchLocs` and + `prefetchLocIdxs` must be of the same length as specified by + `numPrefetchLocs`. For example, if a batch has 10 prefetches listed in + dptrs/sizes, the first 4 of which are to be prefetched to one location + and the remaining 6 are to be prefetched to another, then + `numPrefetchLocs` will be 2, `prefetchLocIdxs` will be {0, 4} and + `prefetchLocs` will contain the two locations. Note the first entry in + `prefetchLocIdxs` must always be 0. Also, each entry must be greater + than the previous entry and the last entry should be less than `count`. + Furthermore, `numPrefetchLocs` must be lesser than or equal to `count`. + + Parameters + ---------- + dptrs : list[Any] + Array of pointers to be prefetched + sizes : list[int] + Array of sizes for memory prefetch operations. + count : size_t + Size of `dptrs` and `sizes` arrays. + prefetchLocs : list[:py:obj:`~.cudaMemLocation`] + Array of locations to prefetch to. + prefetchLocIdxs : list[int] + Array of indices to specify which operands each entry in the + `prefetchLocs` array applies to. The locations specified in + prefetchLocs[k] will be applied to copies starting from + prefetchLocIdxs[k] through prefetchLocIdxs[k+1] - 1. Also + prefetchLocs[numPrefetchLocs - 1] will apply to prefetches starting + from prefetchLocIdxs[numPrefetchLocs - 1] through count - 1. + numPrefetchLocs : size_t + Size of `prefetchLocs` and `prefetchLocIdxs` arrays. + flags : unsigned long long + Flags reserved for future use. Must be zero. + hStream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + The stream to enqueue the operations in. Must not be legacy NULL + stream. Returns ------- cudaError_t - :py:obj:`~.cudaSuccess` :py:obj:`~.cudaErrorInvalidValue` - sparseProperties : :py:obj:`~.cudaArraySparseProperties` - Pointer to return the :py:obj:`~.cudaArraySparseProperties` - See Also - -------- - :py:obj:`~.cudaMipmappedArrayGetSparseProperties`, :py:obj:`~.cuMemMapArrayAsync` """ - cdef ccudart.cudaArray_t carray - if array is None: - carray = 0 - elif isinstance(array, (cudaArray_t,)): - parray = int(array) - carray = parray + cdef cyruntime.cudaStream_t cystream + if stream is None: + pstream = 0 + elif isinstance(stream, (cudaStream_t,driver.CUstream)): + pstream = int(stream) else: - parray = int(cudaArray_t(array)) - carray = parray - cdef cudaArraySparseProperties sparseProperties = cudaArraySparseProperties() - err = ccudart.cudaArrayGetSparseProperties(sparseProperties._ptr, carray) - return (cudaError_t(err), sparseProperties) -{{endif}} - -{{if 'cudaMipmappedArrayGetSparseProperties' in found_functions}} - -@cython.embedsignature(True) -def cudaMipmappedArrayGetSparseProperties(mipmap): - """ Returns the layout properties of a sparse CUDA mipmapped array. - - Returns the sparse array layout properties in `sparseProperties`. If - the CUDA mipmapped array is not allocated with flag - :py:obj:`~.cudaArraySparse` :py:obj:`~.cudaErrorInvalidValue` will be - returned. - - For non-layered CUDA mipmapped arrays, - :py:obj:`~.cudaArraySparseProperties.miptailSize` returns the size of - the mip tail region. The mip tail region includes all mip levels whose - width, height or depth is less than that of the tile. For layered CUDA - mipmapped arrays, if :py:obj:`~.cudaArraySparseProperties.flags` - contains :py:obj:`~.cudaArraySparsePropertiesSingleMipTail`, then - :py:obj:`~.cudaArraySparseProperties.miptailSize` specifies the size of - the mip tail of all layers combined. Otherwise, - :py:obj:`~.cudaArraySparseProperties.miptailSize` specifies mip tail - size per layer. The returned value of - :py:obj:`~.cudaArraySparseProperties.miptailFirstLevel` is valid only - if :py:obj:`~.cudaArraySparseProperties.miptailSize` is non-zero. + pstream = int(cudaStream_t(stream)) + cystream = pstream + if not all(isinstance(_x, (int)) for _x in prefetchLocIdxs): + raise TypeError("Argument 'prefetchLocIdxs' is not instance of type (expected tuple[int] or list[int]") + prefetchLocs = [] if prefetchLocs is None else prefetchLocs + if not all(isinstance(_x, (cudaMemLocation,)) for _x in prefetchLocs): + raise TypeError("Argument 'prefetchLocs' is not instance of type (expected tuple[cyruntime.cudaMemLocation,] or list[cyruntime.cudaMemLocation,]") + if not all(isinstance(_x, (int)) for _x in sizes): + raise TypeError("Argument 'sizes' is not instance of type (expected tuple[int] or list[int]") + dptrs = [] if dptrs is None else dptrs + pylist = [_HelperInputVoidPtr(pydptrs) for pydptrs in dptrs] + cdef _InputVoidPtrPtrHelper voidStarHelperdptrs = _InputVoidPtrPtrHelper(pylist) + cdef void** cydptrs_ptr = voidStarHelperdptrs.cptr + cdef vector[size_t] cysizes = sizes + if count > len(dptrs): raise RuntimeError("List is too small: " + str(len(dptrs)) + " < " + str(count)) + if count > len(sizes): raise RuntimeError("List is too small: " + str(len(sizes)) + " < " + str(count)) + cdef cyruntime.cudaMemLocation* cyprefetchLocs = NULL + if len(prefetchLocs) > 1: + cyprefetchLocs = calloc(len(prefetchLocs), sizeof(cyruntime.cudaMemLocation)) + if cyprefetchLocs is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(prefetchLocs)) + 'x' + str(sizeof(cyruntime.cudaMemLocation))) + for idx in range(len(prefetchLocs)): + string.memcpy(&cyprefetchLocs[idx], (prefetchLocs[idx])._pvt_ptr, sizeof(cyruntime.cudaMemLocation)) + elif len(prefetchLocs) == 1: + cyprefetchLocs = (prefetchLocs[0])._pvt_ptr + cdef vector[size_t] cyprefetchLocIdxs = prefetchLocIdxs + if numPrefetchLocs > len(prefetchLocs): raise RuntimeError("List is too small: " + str(len(prefetchLocs)) + " < " + str(numPrefetchLocs)) + if numPrefetchLocs > len(prefetchLocIdxs): raise RuntimeError("List is too small: " + str(len(prefetchLocIdxs)) + " < " + str(numPrefetchLocs)) + with nogil: + err = cyruntime.cudaMemPrefetchBatchAsync(cydptrs_ptr, cysizes.data(), count, cyprefetchLocs, cyprefetchLocIdxs.data(), numPrefetchLocs, flags, cystream) + if len(prefetchLocs) > 1 and cyprefetchLocs is not NULL: + free(cyprefetchLocs) + return (_cudaError_t(err),) + +@cython.embedsignature(True) +def cudaMemDiscardBatchAsync(dptrs : Optional[tuple[Any] | list[Any]], sizes : tuple[int] | list[int], size_t count, unsigned long long flags, stream): + """ Performs a batch of memory discards asynchronously. + + Performs a batch of memory discards. The batch as a whole executes in + stream order but operations within a batch are not guaranteed to + execute in any specific order. All devices in the system must have a + non-zero value for the device attribute + :py:obj:`~.cudaDevAttrConcurrentManagedAccess` otherwise the API will + return an error. + + Discarding a memory range informs the driver that the contents of that + range are no longer useful. Discarding memory ranges allows the driver + to optimize certain data migrations and can also help reduce memory + pressure. This operation can be undone on any part of the range by + either writing to it or prefetching it via + :py:obj:`~.cudaMemPrefetchAsync` or + :py:obj:`~.cudaMemPrefetchBatchAsync`. Reading from a discarded range, + without a subsequent write or prefetch to that part of the range, will + return an indeterminate value. Note that any reads, writes or + prefetches to any part of the memory range that occur simultaneously + with the discard operation result in undefined behavior. + + Performs memory discard on address ranges specified in `dptrs` and + `sizes`. Both arrays must be of the same length as specified by + `count`. Each memory range specified must refer to managed memory + allocated via :py:obj:`~.cudaMallocManaged` or declared via managed + variables or it may also refer to system-allocated memory when all + devices have a non-zero value for + :py:obj:`~.cudaDevAttrPageableMemoryAccess`. Parameters ---------- - mipmap : :py:obj:`~.cudaMipmappedArray_t` - The CUDA mipmapped array to get the sparse properties of + dptrs : list[Any] + Array of pointers to be discarded + sizes : list[int] + Array of sizes for memory discard operations. + count : size_t + Size of `dptrs` and `sizes` arrays. + flags : unsigned long long + Flags reserved for future use. Must be zero. + hStream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + The stream to enqueue the operations in. Must not be legacy NULL + stream. Returns ------- cudaError_t - :py:obj:`~.cudaSuccess` :py:obj:`~.cudaErrorInvalidValue` - sparseProperties : :py:obj:`~.cudaArraySparseProperties` - Pointer to return :py:obj:`~.cudaArraySparseProperties` - See Also - -------- - :py:obj:`~.cudaArrayGetSparseProperties`, :py:obj:`~.cuMemMapArrayAsync` """ - cdef ccudart.cudaMipmappedArray_t cmipmap - if mipmap is None: - cmipmap = 0 - elif isinstance(mipmap, (cudaMipmappedArray_t,)): - pmipmap = int(mipmap) - cmipmap = pmipmap + cdef cyruntime.cudaStream_t cystream + if stream is None: + pstream = 0 + elif isinstance(stream, (cudaStream_t,driver.CUstream)): + pstream = int(stream) else: - pmipmap = int(cudaMipmappedArray_t(mipmap)) - cmipmap = pmipmap - cdef cudaArraySparseProperties sparseProperties = cudaArraySparseProperties() - err = ccudart.cudaMipmappedArrayGetSparseProperties(sparseProperties._ptr, cmipmap) - return (cudaError_t(err), sparseProperties) -{{endif}} - -{{if 'cudaMemcpy' in found_functions}} - -@cython.embedsignature(True) -def cudaMemcpy(dst, src, size_t count, kind not None : cudaMemcpyKind): - """ Copies data between host and device. - - Copies `count` bytes from the memory area pointed to by `src` to the - memory area pointed to by `dst`, where `kind` specifies the direction - of the copy, and must be one of :py:obj:`~.cudaMemcpyHostToHost`, - :py:obj:`~.cudaMemcpyHostToDevice`, :py:obj:`~.cudaMemcpyDeviceToHost`, - :py:obj:`~.cudaMemcpyDeviceToDevice`, or :py:obj:`~.cudaMemcpyDefault`. - Passing :py:obj:`~.cudaMemcpyDefault` is recommended, in which case the - type of transfer is inferred from the pointer values. However, - :py:obj:`~.cudaMemcpyDefault` is only allowed on systems that support - unified virtual addressing. Calling :py:obj:`~.cudaMemcpy()` with dst - and src pointers that do not match the direction of the copy results in - an undefined behavior. - - \note_sync + pstream = int(cudaStream_t(stream)) + cystream = pstream + if not all(isinstance(_x, (int)) for _x in sizes): + raise TypeError("Argument 'sizes' is not instance of type (expected tuple[int] or list[int]") + dptrs = [] if dptrs is None else dptrs + pylist = [_HelperInputVoidPtr(pydptrs) for pydptrs in dptrs] + cdef _InputVoidPtrPtrHelper voidStarHelperdptrs = _InputVoidPtrPtrHelper(pylist) + cdef void** cydptrs_ptr = voidStarHelperdptrs.cptr + cdef vector[size_t] cysizes = sizes + if count > len(dptrs): raise RuntimeError("List is too small: " + str(len(dptrs)) + " < " + str(count)) + if count > len(sizes): raise RuntimeError("List is too small: " + str(len(sizes)) + " < " + str(count)) + with nogil: + err = cyruntime.cudaMemDiscardBatchAsync(cydptrs_ptr, cysizes.data(), count, flags, cystream) + return (_cudaError_t(err),) + +@cython.embedsignature(True) +def cudaMemDiscardAndPrefetchBatchAsync(dptrs : Optional[tuple[Any] | list[Any]], sizes : tuple[int] | list[int], size_t count, prefetchLocs : Optional[tuple[cudaMemLocation] | list[cudaMemLocation]], prefetchLocIdxs : tuple[int] | list[int], size_t numPrefetchLocs, unsigned long long flags, stream): + """ Performs a batch of memory discards and prefetches asynchronously. + + Performs a batch of memory discards followed by prefetches. The batch + as a whole executes in stream order but operations within a batch are + not guaranteed to execute in any specific order. All devices in the + system must have a non-zero value for the device attribute + :py:obj:`~.cudaDevAttrConcurrentManagedAccess` otherwise the API will + return an error. + + Calling :py:obj:`~.cudaMemDiscardAndPrefetchBatchAsync` is semantically + equivalent to calling :py:obj:`~.cudaMemDiscardBatchAsync` followed by + :py:obj:`~.cudaMemPrefetchBatchAsync`, but is more optimal. For more + details on what discarding and prefetching imply, please refer to + :py:obj:`~.cudaMemDiscardBatchAsync` and + :py:obj:`~.cudaMemPrefetchBatchAsync` respectively. Note that any + reads, writes or prefetches to any part of the memory range that occur + simultaneously with this combined discard+prefetch operation result in + undefined behavior. - Parameters - ---------- - dst : Any - Destination memory address - src : Any - Source memory address + Performs memory discard and prefetch on address ranges specified in + `dptrs` and `sizes`. Both arrays must be of the same length as + specified by `count`. Each memory range specified must refer to managed + memory allocated via :py:obj:`~.cudaMallocManaged` or declared via + managed variables or it may also refer to system-allocated memory when + all devices have a non-zero value for + :py:obj:`~.cudaDevAttrPageableMemoryAccess`. Every operation in the + batch has to be associated with a valid location to prefetch the + address range to and specified in the `prefetchLocs` array. Each entry + in this array can apply to more than one operation. This can be done by + specifying in the `prefetchLocIdxs` array, the index of the first + operation that the corresponding entry in the `prefetchLocs` array + applies to. Both `prefetchLocs` and `prefetchLocIdxs` must be of the + same length as specified by `numPrefetchLocs`. For example, if a batch + has 10 operations listed in dptrs/sizes, the first 6 of which are to be + prefetched to one location and the remaining 4 are to be prefetched to + another, then `numPrefetchLocs` will be 2, `prefetchLocIdxs` will be + {0, 6} and `prefetchLocs` will contain the two set of locations. Note + the first entry in `prefetchLocIdxs` must always be 0. Also, each entry + must be greater than the previous entry and the last entry should be + less than `count`. Furthermore, `numPrefetchLocs` must be lesser than + or equal to `count`. + + Parameters + ---------- + dptrs : list[Any] + Array of pointers to be discarded + sizes : list[int] + Array of sizes for memory discard operations. count : size_t - Size in bytes to copy - kind : :py:obj:`~.cudaMemcpyKind` - Type of transfer + Size of `dptrs` and `sizes` arrays. + prefetchLocs : list[:py:obj:`~.cudaMemLocation`] + Array of locations to prefetch to. + prefetchLocIdxs : list[int] + Array of indices to specify which operands each entry in the + `prefetchLocs` array applies to. The locations specified in + prefetchLocs[k] will be applied to operations starting from + prefetchLocIdxs[k] through prefetchLocIdxs[k+1] - 1. Also + prefetchLocs[numPrefetchLocs - 1] will apply to copies starting + from prefetchLocIdxs[numPrefetchLocs - 1] through count - 1. + numPrefetchLocs : size_t + Size of `prefetchLocs` and `prefetchLocIdxs` arrays. + flags : unsigned long long + Flags reserved for future use. Must be zero. + hStream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + The stream to enqueue the operations in. Must not be legacy NULL + stream. Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidMemcpyDirection` - See Also - -------- - :py:obj:`~.cudaMemcpy2D`, :py:obj:`~.cudaMemcpy2DToArray`, :py:obj:`~.cudaMemcpy2DFromArray`, :py:obj:`~.cudaMemcpy2DArrayToArray`, :py:obj:`~.cudaMemcpyToSymbol`, :py:obj:`~.cudaMemcpyFromSymbol`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpy2DAsync`, :py:obj:`~.cudaMemcpy2DToArrayAsync`, :py:obj:`~.cudaMemcpy2DFromArrayAsync`, :py:obj:`~.cudaMemcpyToSymbolAsync`, :py:obj:`~.cudaMemcpyFromSymbolAsync`, :py:obj:`~.cuMemcpyDtoH`, :py:obj:`~.cuMemcpyHtoD`, :py:obj:`~.cuMemcpyDtoD`, :py:obj:`~.cuMemcpy` """ - cdst = utils.HelperInputVoidPtr(dst) - cdef void* cdst_ptr = cdst.cptr - csrc = utils.HelperInputVoidPtr(src) - cdef void* csrc_ptr = csrc.cptr - cdef ccudart.cudaMemcpyKind ckind = kind.value + cdef cyruntime.cudaStream_t cystream + if stream is None: + pstream = 0 + elif isinstance(stream, (cudaStream_t,driver.CUstream)): + pstream = int(stream) + else: + pstream = int(cudaStream_t(stream)) + cystream = pstream + if not all(isinstance(_x, (int)) for _x in prefetchLocIdxs): + raise TypeError("Argument 'prefetchLocIdxs' is not instance of type (expected tuple[int] or list[int]") + prefetchLocs = [] if prefetchLocs is None else prefetchLocs + if not all(isinstance(_x, (cudaMemLocation,)) for _x in prefetchLocs): + raise TypeError("Argument 'prefetchLocs' is not instance of type (expected tuple[cyruntime.cudaMemLocation,] or list[cyruntime.cudaMemLocation,]") + if not all(isinstance(_x, (int)) for _x in sizes): + raise TypeError("Argument 'sizes' is not instance of type (expected tuple[int] or list[int]") + dptrs = [] if dptrs is None else dptrs + pylist = [_HelperInputVoidPtr(pydptrs) for pydptrs in dptrs] + cdef _InputVoidPtrPtrHelper voidStarHelperdptrs = _InputVoidPtrPtrHelper(pylist) + cdef void** cydptrs_ptr = voidStarHelperdptrs.cptr + cdef vector[size_t] cysizes = sizes + if count > len(dptrs): raise RuntimeError("List is too small: " + str(len(dptrs)) + " < " + str(count)) + if count > len(sizes): raise RuntimeError("List is too small: " + str(len(sizes)) + " < " + str(count)) + cdef cyruntime.cudaMemLocation* cyprefetchLocs = NULL + if len(prefetchLocs) > 1: + cyprefetchLocs = calloc(len(prefetchLocs), sizeof(cyruntime.cudaMemLocation)) + if cyprefetchLocs is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(prefetchLocs)) + 'x' + str(sizeof(cyruntime.cudaMemLocation))) + for idx in range(len(prefetchLocs)): + string.memcpy(&cyprefetchLocs[idx], (prefetchLocs[idx])._pvt_ptr, sizeof(cyruntime.cudaMemLocation)) + elif len(prefetchLocs) == 1: + cyprefetchLocs = (prefetchLocs[0])._pvt_ptr + cdef vector[size_t] cyprefetchLocIdxs = prefetchLocIdxs + if numPrefetchLocs > len(prefetchLocs): raise RuntimeError("List is too small: " + str(len(prefetchLocs)) + " < " + str(numPrefetchLocs)) + if numPrefetchLocs > len(prefetchLocIdxs): raise RuntimeError("List is too small: " + str(len(prefetchLocIdxs)) + " < " + str(numPrefetchLocs)) with nogil: - err = ccudart.cudaMemcpy(cdst_ptr, csrc_ptr, count, ckind) + err = cyruntime.cudaMemDiscardAndPrefetchBatchAsync(cydptrs_ptr, cysizes.data(), count, cyprefetchLocs, cyprefetchLocIdxs.data(), numPrefetchLocs, flags, cystream) + if len(prefetchLocs) > 1 and cyprefetchLocs is not NULL: + free(cyprefetchLocs) + return (_cudaError_t(err),) + +@cython.embedsignature(True) +def cudaMemAdvise(devPtr, size_t count, advice not None : cudaMemoryAdvise, location not None : cudaMemLocation): + """ Advise about the usage of a given memory range. + + Advise the Unified Memory subsystem about the usage pattern for the + memory range starting at `devPtr` with a size of `count` bytes. The + start address and end address of the memory range will be rounded down + and rounded up respectively to be aligned to CPU page size before the + advice is applied. The memory range must refer to managed memory + allocated via :py:obj:`~.cudaMallocManaged` or declared via managed + variables. The memory range could also refer to system-allocated + pageable memory provided it represents a valid, host-accessible region + of memory and all additional constraints imposed by `advice` as + outlined below are also satisfied. Specifying an invalid system- + allocated pageable memory range results in an error being returned. + + The `advice` parameter can take the following values: + + - :py:obj:`~.cudaMemAdviseSetReadMostly`: This implies that the data is + mostly going to be read from and only occasionally written to. Any + read accesses from any processor to this region will create a read- + only copy of at least the accessed pages in that processor's memory. + Additionally, if :py:obj:`~.cudaMemPrefetchAsync` or + :py:obj:`~.cudaMemPrefetchAsync` is called on this region, it will + create a read-only copy of the data on the destination processor. If + the target location for :py:obj:`~.cudaMemPrefetchAsync` is a host + NUMA node and a read-only copy already exists on another host NUMA + node, that copy will be migrated to the targeted host NUMA node. If + any processor writes to this region, all copies of the corresponding + page will be invalidated except for the one where the write occurred. + If the writing processor is the CPU and the preferred location of the + page is a host NUMA node, then the page will also be migrated to that + host NUMA node. The `location` argument is ignored for this advice. + Note that for a page to be read-duplicated, the accessing processor + must either be the CPU or a GPU that has a non-zero value for the + device attribute :py:obj:`~.cudaDevAttrConcurrentManagedAccess`. + Also, if a context is created on a device that does not have the + device attribute :py:obj:`~.cudaDevAttrConcurrentManagedAccess` set, + then read-duplication will not occur until all such contexts are + destroyed. If the memory region refers to valid system-allocated + pageable memory, then the accessing device must have a non-zero value + for the device attribute :py:obj:`~.cudaDevAttrPageableMemoryAccess` + for a read-only copy to be created on that device. Note however that + if the accessing device also has a non-zero value for the device + attribute + :py:obj:`~.cudaDevAttrPageableMemoryAccessUsesHostPageTables`, then + setting this advice will not create a read-only copy when that device + accesses this memory region. - return (cudaError_t(err),) -{{endif}} + - :py:obj:`~.cudaMemAdviceUnsetReadMostly`: Undoes the effect of + :py:obj:`~.cudaMemAdviseSetReadMostly` and also prevents the Unified + Memory driver from attempting heuristic read-duplication on the + memory range. Any read-duplicated copies of the data will be + collapsed into a single copy. The location for the collapsed copy + will be the preferred location if the page has a preferred location + and one of the read-duplicated copies was resident at that location. + Otherwise, the location chosen is arbitrary. Note: The `location` + argument is ignored for this advice. -{{if 'cudaMemcpyPeer' in found_functions}} + - :py:obj:`~.cudaMemAdviseSetPreferredLocation`: This advice sets the + preferred location for the data to be the memory belonging to + `location`. When :py:obj:`~.cudaMemLocation.type` is + :py:obj:`~.cudaMemLocationTypeHost`, :py:obj:`~.cudaMemLocation.id` + is ignored and the preferred location is set to be host memory. To + set the preferred location to a specific host NUMA node, applications + must set :py:obj:`~.cudaMemLocation.type` to + :py:obj:`~.cudaMemLocationTypeHostNuma` and + :py:obj:`~.cudaMemLocation.id` must specify the NUMA ID of the host + NUMA node. If :py:obj:`~.cudaMemLocation.type` is set to + :py:obj:`~.cudaMemLocationTypeHostNumaCurrent`, + :py:obj:`~.cudaMemLocation.id` will be ignored and the host NUMA node + closest to the calling thread's CPU will be used as the preferred + location. If :py:obj:`~.cudaMemLocation.type` is a + :py:obj:`~.cudaMemLocationTypeDevice`, then + :py:obj:`~.cudaMemLocation.id` must be a valid device ordinal and the + device must have a non-zero value for the device attribute + :py:obj:`~.cudaDevAttrConcurrentManagedAccess`. Setting the preferred + location does not cause data to migrate to that location immediately. + Instead, it guides the migration policy when a fault occurs on that + memory region. If the data is already in its preferred location and + the faulting processor can establish a mapping without requiring the + data to be migrated, then data migration will be avoided. On the + other hand, if the data is not in its preferred location or if a + direct mapping cannot be established, then it will be migrated to the + processor accessing it. It is important to note that setting the + preferred location does not prevent data prefetching done using + :py:obj:`~.cudaMemPrefetchAsync`. Having a preferred location can + override the page thrash detection and resolution logic in the + Unified Memory driver. Normally, if a page is detected to be + constantly thrashing between for example host and device memory, the + page may eventually be pinned to host memory by the Unified Memory + driver. But if the preferred location is set as device memory, then + the page will continue to thrash indefinitely. If + :py:obj:`~.cudaMemAdviseSetReadMostly` is also set on this memory + region or any subset of it, then the policies associated with that + advice will override the policies of this advice, unless read + accesses from `location` will not result in a read-only copy being + created on that procesor as outlined in description for the advice + :py:obj:`~.cudaMemAdviseSetReadMostly`. If the memory region refers + to valid system-allocated pageable memory, and + :py:obj:`~.cudaMemLocation.type` is + :py:obj:`~.cudaMemLocationTypeDevice` then + :py:obj:`~.cudaMemLocation.id` must be a valid device that has a non- + zero alue for the device attribute + :py:obj:`~.cudaDevAttrPageableMemoryAccess`. -@cython.embedsignature(True) -def cudaMemcpyPeer(dst, int dstDevice, src, int srcDevice, size_t count): - """ Copies memory between two devices. + - :py:obj:`~.cudaMemAdviseUnsetPreferredLocation`: Undoes the effect of + :py:obj:`~.cudaMemAdviseSetPreferredLocation` and changes the + preferred location to none. The `location` argument is ignored for + this advice. - Copies memory from one device to memory on another device. `dst` is the - base device pointer of the destination memory and `dstDevice` is the - destination device. `src` is the base device pointer of the source - memory and `srcDevice` is the source device. `count` specifies the - number of bytes to copy. + - :py:obj:`~.cudaMemAdviseSetAccessedBy`: This advice implies that the + data will be accessed by processor `location`. The + :py:obj:`~.cudaMemLocation.type` must be either + :py:obj:`~.cudaMemLocationTypeDevice` with + :py:obj:`~.cudaMemLocation.id` representing a valid device ordinal or + :py:obj:`~.cudaMemLocationTypeHost` and + :py:obj:`~.cudaMemLocation.id` will be ignored. All other location + types are invalid. If :py:obj:`~.cudaMemLocation.id` is a GPU, then + the device attribute :py:obj:`~.cudaDevAttrConcurrentManagedAccess` + must be non-zero. This advice does not cause data migration and has + no impact on the location of the data per se. Instead, it causes the + data to always be mapped in the specified processor's page tables, as + long as the location of the data permits a mapping to be established. + If the data gets migrated for any reason, the mappings are updated + accordingly. This advice is recommended in scenarios where data + locality is not important, but avoiding faults is. Consider for + example a system containing multiple GPUs with peer-to-peer access + enabled, where the data located on one GPU is occasionally accessed + by peer GPUs. In such scenarios, migrating data over to the other + GPUs is not as important because the accesses are infrequent and the + overhead of migration may be too high. But preventing faults can + still help improve performance, and so having a mapping set up in + advance is useful. Note that on CPU access of this data, the data may + be migrated to host memory because the CPU typically cannot access + device memory directly. Any GPU that had the + :py:obj:`~.cudaMemAdviseSetAccessedBy` flag set for this data will + now have its mapping updated to point to the page in host memory. If + :py:obj:`~.cudaMemAdviseSetReadMostly` is also set on this memory + region or any subset of it, then the policies associated with that + advice will override the policies of this advice. Additionally, if + the preferred location of this memory region or any subset of it is + also `location`, then the policies associated with + :py:obj:`~.CU_MEM_ADVISE_SET_PREFERRED_LOCATION` will override the + policies of this advice. If the memory region refers to valid system- + allocated pageable memory, and :py:obj:`~.cudaMemLocation.type` is + :py:obj:`~.cudaMemLocationTypeDevice` then device in + :py:obj:`~.cudaMemLocation.id` must have a non-zero value for the + device attribute :py:obj:`~.cudaDevAttrPageableMemoryAccess`. + Additionally, if :py:obj:`~.cudaMemLocation.id` has a non-zero value + for the device attribute + :py:obj:`~.cudaDevAttrPageableMemoryAccessUsesHostPageTables`, then + this call has no effect. - Note that this function is asynchronous with respect to the host, but - serialized with respect all pending and future asynchronous work in to - the current device, `srcDevice`, and `dstDevice` (use - :py:obj:`~.cudaMemcpyPeerAsync` to avoid this synchronization). + - :py:obj:`~.CU_MEM_ADVISE_UNSET_ACCESSED_BY`: Undoes the effect of + :py:obj:`~.cudaMemAdviseSetAccessedBy`. Any mappings to the data from + `location` may be removed at any time causing accesses to result in + non-fatal page faults. If the memory region refers to valid system- + allocated pageable memory, and :py:obj:`~.cudaMemLocation.type` is + :py:obj:`~.cudaMemLocationTypeDevice` then device in + :py:obj:`~.cudaMemLocation.id` must have a non-zero value for the + device attribute :py:obj:`~.cudaDevAttrPageableMemoryAccess`. + Additionally, if :py:obj:`~.cudaMemLocation.id` has a non-zero value + for the device attribute + :py:obj:`~.cudaDevAttrPageableMemoryAccessUsesHostPageTables`, then + this call has no effect. Parameters ---------- - dst : Any - Destination device pointer - dstDevice : int - Destination device - src : Any - Source device pointer - srcDevice : int - Source device + devPtr : Any + Pointer to memory to set the advice for count : size_t - Size of memory copy in bytes + Size in bytes of the memory range + advice : :py:obj:`~.cudaMemoryAdvise` + Advice to be applied for the specified memory range + location : :py:obj:`~.cudaMemLocation` + location to apply the advice for Returns ------- @@ -20982,256 +29520,272 @@ def cudaMemcpyPeer(dst, int dstDevice, src, int srcDevice, size_t count): See Also -------- - :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpyPeerAsync`, :py:obj:`~.cudaMemcpy3DPeerAsync`, :py:obj:`~.cuMemcpyPeer` + :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpyPeer`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpy3DPeerAsync`, :py:obj:`~.cudaMemPrefetchAsync`, :py:obj:`~.cuMemAdvise` """ - cdst = utils.HelperInputVoidPtr(dst) - cdef void* cdst_ptr = cdst.cptr - csrc = utils.HelperInputVoidPtr(src) - cdef void* csrc_ptr = csrc.cptr + cdef _HelperInputVoidPtrStruct cydevPtrHelper + cdef void* cydevPtr = _helper_input_void_ptr(devPtr, &cydevPtrHelper) + cdef cyruntime.cudaMemoryAdvise cyadvice = int(advice) with nogil: - err = ccudart.cudaMemcpyPeer(cdst_ptr, dstDevice, csrc_ptr, srcDevice, count) - - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaMemcpy2D' in found_functions}} + err = cyruntime.cudaMemAdvise(cydevPtr, count, cyadvice, location._pvt_ptr[0]) + _helper_input_void_ptr_free(&cydevPtrHelper) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaMemcpy2D(dst, size_t dpitch, src, size_t spitch, size_t width, size_t height, kind not None : cudaMemcpyKind): - """ Copies data between host and device. - - Copies a matrix (`height` rows of `width` bytes each) from the memory - area pointed to by `src` to the memory area pointed to by `dst`, where - `kind` specifies the direction of the copy, and must be one of - :py:obj:`~.cudaMemcpyHostToHost`, :py:obj:`~.cudaMemcpyHostToDevice`, - :py:obj:`~.cudaMemcpyDeviceToHost`, - :py:obj:`~.cudaMemcpyDeviceToDevice`, or :py:obj:`~.cudaMemcpyDefault`. - Passing :py:obj:`~.cudaMemcpyDefault` is recommended, in which case the - type of transfer is inferred from the pointer values. However, - :py:obj:`~.cudaMemcpyDefault` is only allowed on systems that support - unified virtual addressing. `dpitch` and `spitch` are the widths in - memory in bytes of the 2D arrays pointed to by `dst` and `src`, - including any padding added to the end of each row. The memory areas - may not overlap. `width` must not exceed either `dpitch` or `spitch`. - Calling :py:obj:`~.cudaMemcpy2D()` with `dst` and `src` pointers that - do not match the direction of the copy results in an undefined - behavior. :py:obj:`~.cudaMemcpy2D()` returns an error if `dpitch` or - `spitch` exceeds the maximum allowed. - - Parameters - ---------- - dst : Any - Destination memory address - dpitch : size_t - Pitch of destination memory - src : Any - Source memory address - spitch : size_t - Pitch of source memory - width : size_t - Width of matrix transfer (columns in bytes) - height : size_t - Height of matrix transfer (rows) - kind : :py:obj:`~.cudaMemcpyKind` - Type of transfer +def cudaMemRangeGetAttribute(size_t dataSize, attribute not None : cudaMemRangeAttribute, devPtr, size_t count): + """ Query an attribute of a given memory range. - Returns - ------- - cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidPitchValue`, :py:obj:`~.cudaErrorInvalidMemcpyDirection` + Query an attribute about the memory range starting at `devPtr` with a + size of `count` bytes. The memory range must refer to managed memory + allocated via :py:obj:`~.cudaMallocManaged` or declared via managed + variables. - See Also - -------- - :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpy2DToArray`, :py:obj:`~.cudaMemcpy2DFromArray`, :py:obj:`~.cudaMemcpy2DArrayToArray`, :py:obj:`~.cudaMemcpyToSymbol`, :py:obj:`~.cudaMemcpyFromSymbol`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpy2DAsync`, :py:obj:`~.cudaMemcpy2DToArrayAsync`, :py:obj:`~.cudaMemcpy2DFromArrayAsync`, :py:obj:`~.cudaMemcpyToSymbolAsync`, :py:obj:`~.cudaMemcpyFromSymbolAsync`, :py:obj:`~.cuMemcpy2D`, :py:obj:`~.cuMemcpy2DUnaligned` - """ - cdst = utils.HelperInputVoidPtr(dst) - cdef void* cdst_ptr = cdst.cptr - csrc = utils.HelperInputVoidPtr(src) - cdef void* csrc_ptr = csrc.cptr - cdef ccudart.cudaMemcpyKind ckind = kind.value - with nogil: - err = ccudart.cudaMemcpy2D(cdst_ptr, dpitch, csrc_ptr, spitch, width, height, ckind) + The `attribute` parameter can take the following values: - return (cudaError_t(err),) -{{endif}} + - :py:obj:`~.cudaMemRangeAttributeReadMostly`: If this attribute is + specified, `data` will be interpreted as a 32-bit integer, and + `dataSize` must be 4. The result returned will be 1 if all pages in + the given memory range have read-duplication enabled, or 0 otherwise. -{{if 'cudaMemcpy2DToArray' in found_functions}} + - :py:obj:`~.cudaMemRangeAttributePreferredLocation`: If this attribute + is specified, `data` will be interpreted as a 32-bit integer, and + `dataSize` must be 4. The result returned will be a GPU device id if + all pages in the memory range have that GPU as their preferred + location, or it will be cudaCpuDeviceId if all pages in the memory + range have the CPU as their preferred location, or it will be + cudaInvalidDeviceId if either all the pages don't have the same + preferred location or some of the pages don't have a preferred + location at all. Note that the actual location of the pages in the + memory range at the time of the query may be different from the + preferred location. -@cython.embedsignature(True) -def cudaMemcpy2DToArray(dst, size_t wOffset, size_t hOffset, src, size_t spitch, size_t width, size_t height, kind not None : cudaMemcpyKind): - """ Copies data between host and device. + - :py:obj:`~.cudaMemRangeAttributeAccessedBy`: If this attribute is + specified, `data` will be interpreted as an array of 32-bit integers, + and `dataSize` must be a non-zero multiple of 4. The result returned + will be a list of device ids that had + :py:obj:`~.cudaMemAdviceSetAccessedBy` set for that entire memory + range. If any device does not have that advice set for the entire + memory range, that device will not be included. If `data` is larger + than the number of devices that have that advice set for that memory + range, cudaInvalidDeviceId will be returned in all the extra space + provided. For ex., if `dataSize` is 12 (i.e. `data` has 3 elements) + and only device 0 has the advice set, then the result returned will + be { 0, cudaInvalidDeviceId, cudaInvalidDeviceId }. If `data` is + smaller than the number of devices that have that advice set, then + only as many devices will be returned as can fit in the array. There + is no guarantee on which specific devices will be returned, however. - Copies a matrix (`height` rows of `width` bytes each) from the memory - area pointed to by `src` to the CUDA array `dst` starting at `hOffset` - rows and `wOffset` bytes from the upper left corner, where `kind` - specifies the direction of the copy, and must be one of - :py:obj:`~.cudaMemcpyHostToHost`, :py:obj:`~.cudaMemcpyHostToDevice`, - :py:obj:`~.cudaMemcpyDeviceToHost`, - :py:obj:`~.cudaMemcpyDeviceToDevice`, or :py:obj:`~.cudaMemcpyDefault`. - Passing :py:obj:`~.cudaMemcpyDefault` is recommended, in which case the - type of transfer is inferred from the pointer values. However, - :py:obj:`~.cudaMemcpyDefault` is only allowed on systems that support - unified virtual addressing. `spitch` is the width in memory in bytes of - the 2D array pointed to by `src`, including any padding added to the - end of each row. `wOffset` + `width` must not exceed the width of the - CUDA array `dst`. `width` must not exceed `spitch`. - :py:obj:`~.cudaMemcpy2DToArray()` returns an error if `spitch` exceeds - the maximum allowed. + - :py:obj:`~.cudaMemRangeAttributeLastPrefetchLocation`: If this + attribute is specified, `data` will be interpreted as a 32-bit + integer, and `dataSize` must be 4. The result returned will be the + last location to which all pages in the memory range were prefetched + explicitly via :py:obj:`~.cudaMemPrefetchAsync`. This will either be + a GPU id or cudaCpuDeviceId depending on whether the last location + for prefetch was a GPU or the CPU respectively. If any page in the + memory range was never explicitly prefetched or if all pages were not + prefetched to the same location, cudaInvalidDeviceId will be + returned. Note that this simply returns the last location that the + applicaton requested to prefetch the memory range to. It gives no + indication as to whether the prefetch operation to that location has + completed or even begun. + + - :py:obj:`~.cudaMemRangeAttributePreferredLocationType`: If this + attribute is specified, `data` will be interpreted as a + :py:obj:`~.cudaMemLocationType`, and `dataSize` must be + sizeof(cudaMemLocationType). The :py:obj:`~.cudaMemLocationType` + returned will be :py:obj:`~.cudaMemLocationTypeDevice` if all pages + in the memory range have the same GPU as their preferred location, or + :py:obj:`~.cudaMemLocationType` will be + :py:obj:`~.cudaMemLocationTypeHost` if all pages in the memory range + have the CPU as their preferred location, or or it will be + :py:obj:`~.cudaMemLocationTypeHostNuma` if all the pages in the + memory range have the same host NUMA node ID as their preferred + location or it will be :py:obj:`~.cudaMemLocationTypeInvalid` if + either all the pages don't have the same preferred location or some + of the pages don't have a preferred location at all. Note that the + actual location type of the pages in the memory range at the time of + the query may be different from the preferred location type. + + - :py:obj:`~.cudaMemRangeAttributePreferredLocationId`: If this + attribute is specified, `data` will be interpreted as a 32-bit + integer, and `dataSize` must be 4. If the + :py:obj:`~.cudaMemRangeAttributePreferredLocationType` query for + the same address range returns + :py:obj:`~.cudaMemLocationTypeDevice`, it will be a valid device + ordinal or if it returns :py:obj:`~.cudaMemLocationTypeHostNuma`, + it will be a valid host NUMA node ID or if it returns any other + location type, the id should be ignored. + + - :py:obj:`~.cudaMemRangeAttributeLastPrefetchLocationType`: If this + attribute is specified, `data` will be interpreted as a + :py:obj:`~.cudaMemLocationType`, and `dataSize` must be + sizeof(cudaMemLocationType). The result returned will be the last + location type to which all pages in the memory range were prefetched + explicitly via :py:obj:`~.cuMemPrefetchAsync`. The + :py:obj:`~.cudaMemLocationType` returned will be + :py:obj:`~.cudaMemLocationTypeDevice` if the last prefetch location + was the GPU or :py:obj:`~.cudaMemLocationTypeHost` if it was the CPU + or :py:obj:`~.cudaMemLocationTypeHostNuma` if the last prefetch + location was a specific host NUMA node. If any page in the memory + range was never explicitly prefetched or if all pages were not + prefetched to the same location, :py:obj:`~.CUmemLocationType` will + be :py:obj:`~.cudaMemLocationTypeInvalid`. Note that this simply + returns the last location type that the application requested to + prefetch the memory range to. It gives no indication as to whether + the prefetch operation to that location has completed or even begun. + + - :py:obj:`~.cudaMemRangeAttributeLastPrefetchLocationId`: If this + attribute is specified, `data` will be interpreted as a 32-bit + integer, and `dataSize` must be 4. If the + :py:obj:`~.cudaMemRangeAttributeLastPrefetchLocationType` query for + the same address range returns + :py:obj:`~.cudaMemLocationTypeDevice`, it will be a valid device + ordinal or if it returns :py:obj:`~.cudaMemLocationTypeHostNuma`, + it will be a valid host NUMA node ID or if it returns any other + location type, the id should be ignored. Parameters ---------- - dst : :py:obj:`~.cudaArray_t` - Destination memory address - wOffset : size_t - Destination starting X offset (columns in bytes) - hOffset : size_t - Destination starting Y offset (rows) - src : Any - Source memory address - spitch : size_t - Pitch of source memory - width : size_t - Width of matrix transfer (columns in bytes) - height : size_t - Height of matrix transfer (rows) - kind : :py:obj:`~.cudaMemcpyKind` - Type of transfer + dataSize : size_t + Array containing the size of data + attribute : :py:obj:`~.cudaMemRangeAttribute` + The attribute to query + devPtr : Any + Start of the range to query + count : size_t + Size of the range to query Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidPitchValue`, :py:obj:`~.cudaErrorInvalidMemcpyDirection` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + data : Any + A pointers to a memory location where the result of each attribute + query will be written to. See Also -------- - :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpy2D`, :py:obj:`~.cudaMemcpy2DFromArray`, :py:obj:`~.cudaMemcpy2DArrayToArray`, :py:obj:`~.cudaMemcpyToSymbol`, :py:obj:`~.cudaMemcpyFromSymbol`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpy2DAsync`, :py:obj:`~.cudaMemcpy2DToArrayAsync`, :py:obj:`~.cudaMemcpy2DFromArrayAsync`, :py:obj:`~.cudaMemcpyToSymbolAsync`, :py:obj:`~.cudaMemcpyFromSymbolAsync`, :py:obj:`~.cuMemcpy2D`, :py:obj:`~.cuMemcpy2DUnaligned` + :py:obj:`~.cudaMemRangeGetAttributes`, :py:obj:`~.cudaMemPrefetchAsync`, :py:obj:`~.cudaMemAdvise`, :py:obj:`~.cuMemRangeGetAttribute` """ - cdef ccudart.cudaArray_t cdst - if dst is None: - cdst = 0 - elif isinstance(dst, (cudaArray_t,)): - pdst = int(dst) - cdst = pdst - else: - pdst = int(cudaArray_t(dst)) - cdst = pdst - csrc = utils.HelperInputVoidPtr(src) - cdef void* csrc_ptr = csrc.cptr - cdef ccudart.cudaMemcpyKind ckind = kind.value + cdef _HelperCUmem_range_attribute cydata = _HelperCUmem_range_attribute(attribute, dataSize) + cdef void* cydata_ptr = cydata.cptr + cdef cyruntime.cudaMemRangeAttribute cyattribute = int(attribute) + cdef _HelperInputVoidPtrStruct cydevPtrHelper + cdef void* cydevPtr = _helper_input_void_ptr(devPtr, &cydevPtrHelper) with nogil: - err = ccudart.cudaMemcpy2DToArray(cdst, wOffset, hOffset, csrc_ptr, spitch, width, height, ckind) + err = cyruntime.cudaMemRangeGetAttribute(cydata_ptr, dataSize, cyattribute, cydevPtr, count) + _helper_input_void_ptr_free(&cydevPtrHelper) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, cydata.pyObj()) - return (cudaError_t(err),) -{{endif}} +@cython.embedsignature(True) +def cudaMemRangeGetAttributes(dataSizes : tuple[int] | list[int], attributes : Optional[tuple[cudaMemRangeAttribute] | list[cudaMemRangeAttribute]], size_t numAttributes, devPtr, size_t count): + """ Query attributes of a given memory range. -{{if 'cudaMemcpy2DFromArray' in found_functions}} + Query attributes of the memory range starting at `devPtr` with a size + of `count` bytes. The memory range must refer to managed memory + allocated via :py:obj:`~.cudaMallocManaged` or declared via managed + variables. The `attributes` array will be interpreted to have + `numAttributes` entries. The `dataSizes` array will also be interpreted + to have `numAttributes` entries. The results of the query will be + stored in `data`. -@cython.embedsignature(True) -def cudaMemcpy2DFromArray(dst, size_t dpitch, src, size_t wOffset, size_t hOffset, size_t width, size_t height, kind not None : cudaMemcpyKind): - """ Copies data between host and device. + The list of supported attributes are given below. Please refer to + :py:obj:`~.cudaMemRangeGetAttribute` for attribute descriptions and + restrictions. - Copies a matrix (`height` rows of `width` bytes each) from the CUDA - array `src` starting at `hOffset` rows and `wOffset` bytes from the - upper left corner to the memory area pointed to by `dst`, where `kind` - specifies the direction of the copy, and must be one of - :py:obj:`~.cudaMemcpyHostToHost`, :py:obj:`~.cudaMemcpyHostToDevice`, - :py:obj:`~.cudaMemcpyDeviceToHost`, - :py:obj:`~.cudaMemcpyDeviceToDevice`, or :py:obj:`~.cudaMemcpyDefault`. - Passing :py:obj:`~.cudaMemcpyDefault` is recommended, in which case the - type of transfer is inferred from the pointer values. However, - :py:obj:`~.cudaMemcpyDefault` is only allowed on systems that support - unified virtual addressing. `dpitch` is the width in memory in bytes of - the 2D array pointed to by `dst`, including any padding added to the - end of each row. `wOffset` + `width` must not exceed the width of the - CUDA array `src`. `width` must not exceed `dpitch`. - :py:obj:`~.cudaMemcpy2DFromArray()` returns an error if `dpitch` - exceeds the maximum allowed. + - :py:obj:`~.cudaMemRangeAttributeReadMostly` + + - :py:obj:`~.cudaMemRangeAttributePreferredLocation` + + - :py:obj:`~.cudaMemRangeAttributeAccessedBy` + + - :py:obj:`~.cudaMemRangeAttributeLastPrefetchLocation` + + - :: cudaMemRangeAttributePreferredLocationType + + - :: cudaMemRangeAttributePreferredLocationId + + - :: cudaMemRangeAttributeLastPrefetchLocationType + + - :: cudaMemRangeAttributeLastPrefetchLocationId Parameters ---------- - dst : Any - Destination memory address - dpitch : size_t - Pitch of destination memory - src : :py:obj:`~.cudaArray_const_t` - Source memory address - wOffset : size_t - Source starting X offset (columns in bytes) - hOffset : size_t - Source starting Y offset (rows) - width : size_t - Width of matrix transfer (columns in bytes) - height : size_t - Height of matrix transfer (rows) - kind : :py:obj:`~.cudaMemcpyKind` - Type of transfer + dataSizes : list[int] + Array containing the sizes of each result + attributes : list[:py:obj:`~.cudaMemRangeAttribute`] + An array of attributes to query (numAttributes and the number of + attributes in this array should match) + numAttributes : size_t + Number of attributes to query + devPtr : Any + Start of the range to query + count : size_t + Size of the range to query Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidPitchValue`, :py:obj:`~.cudaErrorInvalidMemcpyDirection` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + data : list[Any] + A two-dimensional array containing pointers to memory locations + where the result of each attribute query will be written to. See Also -------- - :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpy2D`, :py:obj:`~.cudaMemcpy2DToArray`, :py:obj:`~.cudaMemcpy2DArrayToArray`, :py:obj:`~.cudaMemcpyToSymbol`, :py:obj:`~.cudaMemcpyFromSymbol`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpy2DAsync`, :py:obj:`~.cudaMemcpy2DToArrayAsync`, :py:obj:`~.cudaMemcpy2DFromArrayAsync`, :py:obj:`~.cudaMemcpyToSymbolAsync`, :py:obj:`~.cudaMemcpyFromSymbolAsync`, :py:obj:`~.cuMemcpy2D`, :py:obj:`~.cuMemcpy2DUnaligned` + :py:obj:`~.cudaMemRangeGetAttribute`, :py:obj:`~.cudaMemAdvise`, :py:obj:`~.cudaMemPrefetchAsync`, :py:obj:`~.cuMemRangeGetAttributes` """ - cdef ccudart.cudaArray_const_t csrc - if src is None: - csrc = 0 - elif isinstance(src, (cudaArray_const_t,)): - psrc = int(src) - csrc = psrc - else: - psrc = int(cudaArray_const_t(src)) - csrc = psrc - cdst = utils.HelperInputVoidPtr(dst) - cdef void* cdst_ptr = cdst.cptr - cdef ccudart.cudaMemcpyKind ckind = kind.value + attributes = [] if attributes is None else attributes + if not all(isinstance(_x, (cudaMemRangeAttribute)) for _x in attributes): + raise TypeError("Argument 'attributes' is not instance of type (expected tuple[cyruntime.cudaMemRangeAttribute] or list[cyruntime.cudaMemRangeAttribute]") + if not all(isinstance(_x, (int)) for _x in dataSizes): + raise TypeError("Argument 'dataSizes' is not instance of type (expected tuple[int] or list[int]") + pylist = [_HelperCUmem_range_attribute(pyattributes, pydataSizes) for (pyattributes, pydataSizes) in zip(attributes, dataSizes)] + cdef _InputVoidPtrPtrHelper voidStarHelperdata = _InputVoidPtrPtrHelper(pylist) + cdef void** cyvoidStarHelper_ptr = voidStarHelperdata.cptr + cdef vector[size_t] cydataSizes = dataSizes + cdef vector[cyruntime.cudaMemRangeAttribute] cyattributes = attributes + if numAttributes > len(dataSizes): raise RuntimeError("List is too small: " + str(len(dataSizes)) + " < " + str(numAttributes)) + if numAttributes > len(attributes): raise RuntimeError("List is too small: " + str(len(attributes)) + " < " + str(numAttributes)) + cdef _HelperInputVoidPtrStruct cydevPtrHelper + cdef void* cydevPtr = _helper_input_void_ptr(devPtr, &cydevPtrHelper) with nogil: - err = ccudart.cudaMemcpy2DFromArray(cdst_ptr, dpitch, csrc, wOffset, hOffset, width, height, ckind) - - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaMemcpy2DArrayToArray' in found_functions}} + err = cyruntime.cudaMemRangeGetAttributes(cyvoidStarHelper_ptr, cydataSizes.data(), cyattributes.data(), numAttributes, cydevPtr, count) + _helper_input_void_ptr_free(&cydevPtrHelper) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, [obj.pyObj() for obj in pylist]) @cython.embedsignature(True) -def cudaMemcpy2DArrayToArray(dst, size_t wOffsetDst, size_t hOffsetDst, src, size_t wOffsetSrc, size_t hOffsetSrc, size_t width, size_t height, kind not None : cudaMemcpyKind): +def cudaMemcpyToArray(dst, size_t wOffset, size_t hOffset, src, size_t count, kind not None : cudaMemcpyKind): """ Copies data between host and device. - Copies a matrix (`height` rows of `width` bytes each) from the CUDA - array `src` starting at `hOffsetSrc` rows and `wOffsetSrc` bytes from - the upper left corner to the CUDA array `dst` starting at `hOffsetDst` - rows and `wOffsetDst` bytes from the upper left corner, where `kind` - specifies the direction of the copy, and must be one of - :py:obj:`~.cudaMemcpyHostToHost`, :py:obj:`~.cudaMemcpyHostToDevice`, - :py:obj:`~.cudaMemcpyDeviceToHost`, + [Deprecated] + + Copies `count` bytes from the memory area pointed to by `src` to the + CUDA array `dst` starting at `hOffset` rows and `wOffset` bytes from + the upper left corner, where `kind` specifies the direction of the + copy, and must be one of :py:obj:`~.cudaMemcpyHostToHost`, + :py:obj:`~.cudaMemcpyHostToDevice`, :py:obj:`~.cudaMemcpyDeviceToHost`, :py:obj:`~.cudaMemcpyDeviceToDevice`, or :py:obj:`~.cudaMemcpyDefault`. Passing :py:obj:`~.cudaMemcpyDefault` is recommended, in which case the type of transfer is inferred from the pointer values. However, :py:obj:`~.cudaMemcpyDefault` is only allowed on systems that support - unified virtual addressing. `wOffsetDst` + `width` must not exceed the - width of the CUDA array `dst`. `wOffsetSrc` + `width` must not exceed - the width of the CUDA array `src`. + unified virtual addressing. Parameters ---------- dst : :py:obj:`~.cudaArray_t` Destination memory address - wOffsetDst : size_t + wOffset : size_t Destination starting X offset (columns in bytes) - hOffsetDst : size_t + hOffset : size_t Destination starting Y offset (rows) - src : :py:obj:`~.cudaArray_const_t` + src : Any Source memory address - wOffsetSrc : size_t - Source starting X offset (columns in bytes) - hOffsetSrc : size_t - Source starting Y offset (rows) - width : size_t - Width of matrix transfer (columns in bytes) - height : size_t - Height of matrix transfer (rows) + count : size_t + Size in bytes to copy kind : :py:obj:`~.cudaMemcpyKind` Type of transfer @@ -21242,40 +29796,34 @@ def cudaMemcpy2DArrayToArray(dst, size_t wOffsetDst, size_t hOffsetDst, src, siz See Also -------- - :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpy2D`, :py:obj:`~.cudaMemcpy2DToArray`, :py:obj:`~.cudaMemcpy2DFromArray`, :py:obj:`~.cudaMemcpyToSymbol`, :py:obj:`~.cudaMemcpyFromSymbol`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpy2DAsync`, :py:obj:`~.cudaMemcpy2DToArrayAsync`, :py:obj:`~.cudaMemcpy2DFromArrayAsync`, :py:obj:`~.cudaMemcpyToSymbolAsync`, :py:obj:`~.cudaMemcpyFromSymbolAsync`, :py:obj:`~.cuMemcpy2D`, :py:obj:`~.cuMemcpy2DUnaligned` + :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpy2D`, :py:obj:`~.cudaMemcpy2DToArray`, :py:obj:`~.cudaMemcpyFromArray`, :py:obj:`~.cudaMemcpy2DFromArray`, :py:obj:`~.cudaMemcpyArrayToArray`, :py:obj:`~.cudaMemcpy2DArrayToArray`, :py:obj:`~.cudaMemcpyToSymbol`, :py:obj:`~.cudaMemcpyFromSymbol`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpy2DAsync`, :py:obj:`~.cudaMemcpyToArrayAsync`, :py:obj:`~.cudaMemcpy2DToArrayAsync`, :py:obj:`~.cudaMemcpyFromArrayAsync`, :py:obj:`~.cudaMemcpy2DFromArrayAsync`, :py:obj:`~.cudaMemcpyToSymbolAsync`, :py:obj:`~.cudaMemcpyFromSymbolAsync`, :py:obj:`~.cuMemcpyHtoA`, :py:obj:`~.cuMemcpyDtoA` """ - cdef ccudart.cudaArray_const_t csrc - if src is None: - csrc = 0 - elif isinstance(src, (cudaArray_const_t,)): - psrc = int(src) - csrc = psrc - else: - psrc = int(cudaArray_const_t(src)) - csrc = psrc - cdef ccudart.cudaArray_t cdst + cdef cyruntime.cudaArray_t cydst if dst is None: - cdst = 0 + pdst = 0 elif isinstance(dst, (cudaArray_t,)): pdst = int(dst) - cdst = pdst else: pdst = int(cudaArray_t(dst)) - cdst = pdst - cdef ccudart.cudaMemcpyKind ckind = kind.value - err = ccudart.cudaMemcpy2DArrayToArray(cdst, wOffsetDst, hOffsetDst, csrc, wOffsetSrc, hOffsetSrc, width, height, ckind) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaMemcpyAsync' in found_functions}} + cydst = pdst + cdef _HelperInputVoidPtrStruct cysrcHelper + cdef void* cysrc = _helper_input_void_ptr(src, &cysrcHelper) + cdef cyruntime.cudaMemcpyKind cykind = int(kind) + with nogil: + err = cyruntime.cudaMemcpyToArray(cydst, wOffset, hOffset, cysrc, count, cykind) + _helper_input_void_ptr_free(&cysrcHelper) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaMemcpyAsync(dst, src, size_t count, kind not None : cudaMemcpyKind, stream): +def cudaMemcpyFromArray(dst, src, size_t wOffset, size_t hOffset, size_t count, kind not None : cudaMemcpyKind): """ Copies data between host and device. - Copies `count` bytes from the memory area pointed to by `src` to the - memory area pointed to by `dst`, where `kind` specifies the direction - of the copy, and must be one of :py:obj:`~.cudaMemcpyHostToHost`, + [Deprecated] + + Copies `count` bytes from the CUDA array `src` starting at `hOffset` + rows and `wOffset` bytes from the upper left corner to the memory area + pointed to by `dst`, where `kind` specifies the direction of the copy, + and must be one of :py:obj:`~.cudaMemcpyHostToHost`, :py:obj:`~.cudaMemcpyHostToDevice`, :py:obj:`~.cudaMemcpyDeviceToHost`, :py:obj:`~.cudaMemcpyDeviceToDevice`, or :py:obj:`~.cudaMemcpyDefault`. Passing :py:obj:`~.cudaMemcpyDefault` is recommended, in which case the @@ -21283,237 +29831,137 @@ def cudaMemcpyAsync(dst, src, size_t count, kind not None : cudaMemcpyKind, stre :py:obj:`~.cudaMemcpyDefault` is only allowed on systems that support unified virtual addressing. - The memory areas may not overlap. Calling :py:obj:`~.cudaMemcpyAsync()` - with `dst` and `src` pointers that do not match the direction of the - copy results in an undefined behavior. - - :py:obj:`~.cudaMemcpyAsync()` is asynchronous with respect to the host, - so the call may return before the copy is complete. The copy can - optionally be associated to a stream by passing a non-zero `stream` - argument. If `kind` is :py:obj:`~.cudaMemcpyHostToDevice` or - :py:obj:`~.cudaMemcpyDeviceToHost` and the `stream` is non-zero, the - copy may overlap with operations in other streams. - - The device version of this function only handles device to device - copies and cannot be given local or shared pointers. - Parameters ---------- dst : Any Destination memory address - src : Any - Source memory address - count : size_t - Size in bytes to copy - kind : :py:obj:`~.cudaMemcpyKind` - Type of transfer - stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` - Stream identifier - - Returns - ------- - cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidMemcpyDirection` - - See Also - -------- - :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpy2D`, :py:obj:`~.cudaMemcpy2DToArray`, :py:obj:`~.cudaMemcpy2DFromArray`, :py:obj:`~.cudaMemcpy2DArrayToArray`, :py:obj:`~.cudaMemcpyToSymbol`, :py:obj:`~.cudaMemcpyFromSymbol`, :py:obj:`~.cudaMemcpy2DAsync`, :py:obj:`~.cudaMemcpy2DToArrayAsync`, :py:obj:`~.cudaMemcpy2DFromArrayAsync`, :py:obj:`~.cudaMemcpyToSymbolAsync`, :py:obj:`~.cudaMemcpyFromSymbolAsync`, :py:obj:`~.cuMemcpyAsync`, :py:obj:`~.cuMemcpyDtoHAsync`, :py:obj:`~.cuMemcpyHtoDAsync`, :py:obj:`~.cuMemcpyDtoDAsync` - """ - cdef ccudart.cudaStream_t cstream - if stream is None: - cstream = 0 - elif isinstance(stream, (cudaStream_t,cuda.CUstream)): - pstream = int(stream) - cstream = pstream - else: - pstream = int(cudaStream_t(stream)) - cstream = pstream - cdst = utils.HelperInputVoidPtr(dst) - cdef void* cdst_ptr = cdst.cptr - csrc = utils.HelperInputVoidPtr(src) - cdef void* csrc_ptr = csrc.cptr - cdef ccudart.cudaMemcpyKind ckind = kind.value - with nogil: - err = ccudart.cudaMemcpyAsync(cdst_ptr, csrc_ptr, count, ckind, cstream) - - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaMemcpyPeerAsync' in found_functions}} - -@cython.embedsignature(True) -def cudaMemcpyPeerAsync(dst, int dstDevice, src, int srcDevice, size_t count, stream): - """ Copies memory between two devices asynchronously. - - Copies memory from one device to memory on another device. `dst` is the - base device pointer of the destination memory and `dstDevice` is the - destination device. `src` is the base device pointer of the source - memory and `srcDevice` is the source device. `count` specifies the - number of bytes to copy. - - Note that this function is asynchronous with respect to the host and - all work on other devices. - - Parameters - ---------- - dst : Any - Destination device pointer - dstDevice : int - Destination device - src : Any - Source device pointer - srcDevice : int - Source device + src : :py:obj:`~.cudaArray_const_t` + Source memory address + wOffset : size_t + Source starting X offset (columns in bytes) + hOffset : size_t + Source starting Y offset (rows) count : size_t - Size of memory copy in bytes - stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` - Stream identifier + Size in bytes to copy + kind : :py:obj:`~.cudaMemcpyKind` + Type of transfer Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidDevice` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidMemcpyDirection` See Also -------- - :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpyPeer`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpy3DPeerAsync`, :py:obj:`~.cuMemcpyPeerAsync` + :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpy2D`, :py:obj:`~.cudaMemcpyToArray`, :py:obj:`~.cudaMemcpy2DToArray`, :py:obj:`~.cudaMemcpy2DFromArray`, :py:obj:`~.cudaMemcpyArrayToArray`, :py:obj:`~.cudaMemcpy2DArrayToArray`, :py:obj:`~.cudaMemcpyToSymbol`, :py:obj:`~.cudaMemcpyFromSymbol`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpy2DAsync`, :py:obj:`~.cudaMemcpyToArrayAsync`, :py:obj:`~.cudaMemcpy2DToArrayAsync`, :py:obj:`~.cudaMemcpyFromArrayAsync`, :py:obj:`~.cudaMemcpy2DFromArrayAsync`, :py:obj:`~.cudaMemcpyToSymbolAsync`, :py:obj:`~.cudaMemcpyFromSymbolAsync`, :py:obj:`~.cuMemcpyAtoH`, :py:obj:`~.cuMemcpyAtoD` """ - cdef ccudart.cudaStream_t cstream - if stream is None: - cstream = 0 - elif isinstance(stream, (cudaStream_t,cuda.CUstream)): - pstream = int(stream) - cstream = pstream + cdef cyruntime.cudaArray_const_t cysrc + if src is None: + psrc = 0 + elif isinstance(src, (cudaArray_const_t,)): + psrc = int(src) else: - pstream = int(cudaStream_t(stream)) - cstream = pstream - cdst = utils.HelperInputVoidPtr(dst) - cdef void* cdst_ptr = cdst.cptr - csrc = utils.HelperInputVoidPtr(src) - cdef void* csrc_ptr = csrc.cptr + psrc = int(cudaArray_const_t(src)) + cysrc = psrc + cdef _HelperInputVoidPtrStruct cydstHelper + cdef void* cydst = _helper_input_void_ptr(dst, &cydstHelper) + cdef cyruntime.cudaMemcpyKind cykind = int(kind) with nogil: - err = ccudart.cudaMemcpyPeerAsync(cdst_ptr, dstDevice, csrc_ptr, srcDevice, count, cstream) - - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaMemcpy2DAsync' in found_functions}} + err = cyruntime.cudaMemcpyFromArray(cydst, cysrc, wOffset, hOffset, count, cykind) + _helper_input_void_ptr_free(&cydstHelper) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaMemcpy2DAsync(dst, size_t dpitch, src, size_t spitch, size_t width, size_t height, kind not None : cudaMemcpyKind, stream): +def cudaMemcpyArrayToArray(dst, size_t wOffsetDst, size_t hOffsetDst, src, size_t wOffsetSrc, size_t hOffsetSrc, size_t count, kind not None : cudaMemcpyKind): """ Copies data between host and device. - Copies a matrix (`height` rows of `width` bytes each) from the memory - area pointed to by `src` to the memory area pointed to by `dst`, where - `kind` specifies the direction of the copy, and must be one of - :py:obj:`~.cudaMemcpyHostToHost`, :py:obj:`~.cudaMemcpyHostToDevice`, - :py:obj:`~.cudaMemcpyDeviceToHost`, + [Deprecated] + + Copies `count` bytes from the CUDA array `src` starting at `hOffsetSrc` + rows and `wOffsetSrc` bytes from the upper left corner to the CUDA + array `dst` starting at `hOffsetDst` rows and `wOffsetDst` bytes from + the upper left corner, where `kind` specifies the direction of the + copy, and must be one of :py:obj:`~.cudaMemcpyHostToHost`, + :py:obj:`~.cudaMemcpyHostToDevice`, :py:obj:`~.cudaMemcpyDeviceToHost`, :py:obj:`~.cudaMemcpyDeviceToDevice`, or :py:obj:`~.cudaMemcpyDefault`. Passing :py:obj:`~.cudaMemcpyDefault` is recommended, in which case the type of transfer is inferred from the pointer values. However, :py:obj:`~.cudaMemcpyDefault` is only allowed on systems that support - unified virtual addressing. `dpitch` and `spitch` are the widths in - memory in bytes of the 2D arrays pointed to by `dst` and `src`, - including any padding added to the end of each row. The memory areas - may not overlap. `width` must not exceed either `dpitch` or `spitch`. - - Calling :py:obj:`~.cudaMemcpy2DAsync()` with `dst` and `src` pointers - that do not match the direction of the copy results in an undefined - behavior. :py:obj:`~.cudaMemcpy2DAsync()` returns an error if `dpitch` - or `spitch` is greater than the maximum allowed. - - :py:obj:`~.cudaMemcpy2DAsync()` is asynchronous with respect to the - host, so the call may return before the copy is complete. The copy can - optionally be associated to a stream by passing a non-zero `stream` - argument. If `kind` is :py:obj:`~.cudaMemcpyHostToDevice` or - :py:obj:`~.cudaMemcpyDeviceToHost` and `stream` is non-zero, the copy - may overlap with operations in other streams. - - The device version of this function only handles device to device - copies and cannot be given local or shared pointers. + unified virtual addressing. Parameters ---------- - dst : Any + dst : :py:obj:`~.cudaArray_t` Destination memory address - dpitch : size_t - Pitch of destination memory - src : Any + wOffsetDst : size_t + Destination starting X offset (columns in bytes) + hOffsetDst : size_t + Destination starting Y offset (rows) + src : :py:obj:`~.cudaArray_const_t` Source memory address - spitch : size_t - Pitch of source memory - width : size_t - Width of matrix transfer (columns in bytes) - height : size_t - Height of matrix transfer (rows) + wOffsetSrc : size_t + Source starting X offset (columns in bytes) + hOffsetSrc : size_t + Source starting Y offset (rows) + count : size_t + Size in bytes to copy kind : :py:obj:`~.cudaMemcpyKind` Type of transfer - stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` - Stream identifier Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidPitchValue`, :py:obj:`~.cudaErrorInvalidMemcpyDirection` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidMemcpyDirection` See Also -------- - :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpy2D`, :py:obj:`~.cudaMemcpy2DToArray`, :py:obj:`~.cudaMemcpy2DFromArray`, :py:obj:`~.cudaMemcpy2DArrayToArray`, :py:obj:`~.cudaMemcpyToSymbol`, :py:obj:`~.cudaMemcpyFromSymbol`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpy2DToArrayAsync`, :py:obj:`~.cudaMemcpy2DFromArrayAsync`, :py:obj:`~.cudaMemcpyToSymbolAsync`, :py:obj:`~.cudaMemcpyFromSymbolAsync`, :py:obj:`~.cuMemcpy2DAsync` + :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpy2D`, :py:obj:`~.cudaMemcpyToArray`, :py:obj:`~.cudaMemcpy2DToArray`, :py:obj:`~.cudaMemcpyFromArray`, :py:obj:`~.cudaMemcpy2DFromArray`, :py:obj:`~.cudaMemcpy2DArrayToArray`, :py:obj:`~.cudaMemcpyToSymbol`, :py:obj:`~.cudaMemcpyFromSymbol`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpy2DAsync`, :py:obj:`~.cudaMemcpyToArrayAsync`, :py:obj:`~.cudaMemcpy2DToArrayAsync`, :py:obj:`~.cudaMemcpyFromArrayAsync`, :py:obj:`~.cudaMemcpy2DFromArrayAsync`, :py:obj:`~.cudaMemcpyToSymbolAsync`, :py:obj:`~.cudaMemcpyFromSymbolAsync`, :py:obj:`~.cuMemcpyAtoA` """ - cdef ccudart.cudaStream_t cstream - if stream is None: - cstream = 0 - elif isinstance(stream, (cudaStream_t,cuda.CUstream)): - pstream = int(stream) - cstream = pstream + cdef cyruntime.cudaArray_const_t cysrc + if src is None: + psrc = 0 + elif isinstance(src, (cudaArray_const_t,)): + psrc = int(src) else: - pstream = int(cudaStream_t(stream)) - cstream = pstream - cdst = utils.HelperInputVoidPtr(dst) - cdef void* cdst_ptr = cdst.cptr - csrc = utils.HelperInputVoidPtr(src) - cdef void* csrc_ptr = csrc.cptr - cdef ccudart.cudaMemcpyKind ckind = kind.value + psrc = int(cudaArray_const_t(src)) + cysrc = psrc + cdef cyruntime.cudaArray_t cydst + if dst is None: + pdst = 0 + elif isinstance(dst, (cudaArray_t,)): + pdst = int(dst) + else: + pdst = int(cudaArray_t(dst)) + cydst = pdst + cdef cyruntime.cudaMemcpyKind cykind = int(kind) with nogil: - err = ccudart.cudaMemcpy2DAsync(cdst_ptr, dpitch, csrc_ptr, spitch, width, height, ckind, cstream) - - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaMemcpy2DToArrayAsync' in found_functions}} + err = cyruntime.cudaMemcpyArrayToArray(cydst, wOffsetDst, hOffsetDst, cysrc, wOffsetSrc, hOffsetSrc, count, cykind) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaMemcpy2DToArrayAsync(dst, size_t wOffset, size_t hOffset, src, size_t spitch, size_t width, size_t height, kind not None : cudaMemcpyKind, stream): +def cudaMemcpyToArrayAsync(dst, size_t wOffset, size_t hOffset, src, size_t count, kind not None : cudaMemcpyKind, stream): """ Copies data between host and device. - Copies a matrix (`height` rows of `width` bytes each) from the memory - area pointed to by `src` to the CUDA array `dst` starting at `hOffset` - rows and `wOffset` bytes from the upper left corner, where `kind` - specifies the direction of the copy, and must be one of - :py:obj:`~.cudaMemcpyHostToHost`, :py:obj:`~.cudaMemcpyHostToDevice`, - :py:obj:`~.cudaMemcpyDeviceToHost`, + [Deprecated] + + Copies `count` bytes from the memory area pointed to by `src` to the + CUDA array `dst` starting at `hOffset` rows and `wOffset` bytes from + the upper left corner, where `kind` specifies the direction of the + copy, and must be one of :py:obj:`~.cudaMemcpyHostToHost`, + :py:obj:`~.cudaMemcpyHostToDevice`, :py:obj:`~.cudaMemcpyDeviceToHost`, :py:obj:`~.cudaMemcpyDeviceToDevice`, or :py:obj:`~.cudaMemcpyDefault`. Passing :py:obj:`~.cudaMemcpyDefault` is recommended, in which case the type of transfer is inferred from the pointer values. However, :py:obj:`~.cudaMemcpyDefault` is only allowed on systems that support - unified virtual addressing. `spitch` is the width in memory in bytes of - the 2D array pointed to by `src`, including any padding added to the - end of each row. `wOffset` + `width` must not exceed the width of the - CUDA array `dst`. `width` must not exceed `spitch`. - :py:obj:`~.cudaMemcpy2DToArrayAsync()` returns an error if `spitch` - exceeds the maximum allowed. + unified virtual addressing. - :py:obj:`~.cudaMemcpy2DToArrayAsync()` is asynchronous with respect to + :py:obj:`~.cudaMemcpyToArrayAsync()` is asynchronous with respect to the host, so the call may return before the copy is complete. The copy can optionally be associated to a stream by passing a non-zero `stream` argument. If `kind` is :py:obj:`~.cudaMemcpyHostToDevice` or :py:obj:`~.cudaMemcpyDeviceToHost` and `stream` is non-zero, the copy may overlap with operations in other streams. - :py:obj:`~.cudaMemcpy2DFromArrayAsync`, - :py:obj:`~.cudaMemcpyToSymbolAsync`, - :py:obj:`~.cudaMemcpyFromSymbolAsync`, :py:obj:`~.cuMemcpy2DAsync` - Parameters ---------- dst : :py:obj:`~.cudaArray_t` @@ -21524,12 +29972,8 @@ def cudaMemcpy2DToArrayAsync(dst, size_t wOffset, size_t hOffset, src, size_t sp Destination starting Y offset (rows) src : Any Source memory address - spitch : size_t - Pitch of source memory - width : size_t - Width of matrix transfer (columns in bytes) - height : size_t - Height of matrix transfer (rows) + count : size_t + Size in bytes to copy kind : :py:obj:`~.cudaMemcpyKind` Type of transfer stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` @@ -21538,88 +29982,72 @@ def cudaMemcpy2DToArrayAsync(dst, size_t wOffset, size_t hOffset, src, size_t sp Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidPitchValue`, :py:obj:`~.cudaErrorInvalidMemcpyDirection` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidMemcpyDirection` See Also -------- - :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpy2D`, :py:obj:`~.cudaMemcpy2DToArray`, :py:obj:`~.cudaMemcpy2DFromArray`, :py:obj:`~.cudaMemcpy2DArrayToArray`, :py:obj:`~.cudaMemcpyToSymbol`, :py:obj:`~.cudaMemcpyFromSymbol`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpy2DAsync`, + :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpy2D`, :py:obj:`~.cudaMemcpyToArray`, :py:obj:`~.cudaMemcpy2DToArray`, :py:obj:`~.cudaMemcpyFromArray`, :py:obj:`~.cudaMemcpy2DFromArray`, :py:obj:`~.cudaMemcpyArrayToArray`, :py:obj:`~.cudaMemcpy2DArrayToArray`, :py:obj:`~.cudaMemcpyToSymbol`, :py:obj:`~.cudaMemcpyFromSymbol`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpy2DAsync`, :py:obj:`~.cudaMemcpy2DToArrayAsync`, :py:obj:`~.cudaMemcpyFromArrayAsync`, :py:obj:`~.cudaMemcpy2DFromArrayAsync`, :py:obj:`~.cudaMemcpyToSymbolAsync`, :py:obj:`~.cudaMemcpyFromSymbolAsync`, :py:obj:`~.cuMemcpyHtoAAsync`, :py:obj:`~.cuMemcpy2DAsync` """ - cdef ccudart.cudaStream_t cstream + cdef cyruntime.cudaStream_t cystream if stream is None: - cstream = 0 - elif isinstance(stream, (cudaStream_t,cuda.CUstream)): + pstream = 0 + elif isinstance(stream, (cudaStream_t,driver.CUstream)): pstream = int(stream) - cstream = pstream else: pstream = int(cudaStream_t(stream)) - cstream = pstream - cdef ccudart.cudaArray_t cdst + cystream = pstream + cdef cyruntime.cudaArray_t cydst if dst is None: - cdst = 0 + pdst = 0 elif isinstance(dst, (cudaArray_t,)): pdst = int(dst) - cdst = pdst else: pdst = int(cudaArray_t(dst)) - cdst = pdst - csrc = utils.HelperInputVoidPtr(src) - cdef void* csrc_ptr = csrc.cptr - cdef ccudart.cudaMemcpyKind ckind = kind.value + cydst = pdst + cdef _HelperInputVoidPtrStruct cysrcHelper + cdef void* cysrc = _helper_input_void_ptr(src, &cysrcHelper) + cdef cyruntime.cudaMemcpyKind cykind = int(kind) with nogil: - err = ccudart.cudaMemcpy2DToArrayAsync(cdst, wOffset, hOffset, csrc_ptr, spitch, width, height, ckind, cstream) - - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaMemcpy2DFromArrayAsync' in found_functions}} + err = cyruntime.cudaMemcpyToArrayAsync(cydst, wOffset, hOffset, cysrc, count, cykind, cystream) + _helper_input_void_ptr_free(&cysrcHelper) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaMemcpy2DFromArrayAsync(dst, size_t dpitch, src, size_t wOffset, size_t hOffset, size_t width, size_t height, kind not None : cudaMemcpyKind, stream): +def cudaMemcpyFromArrayAsync(dst, src, size_t wOffset, size_t hOffset, size_t count, kind not None : cudaMemcpyKind, stream): """ Copies data between host and device. - Copies a matrix (`height` rows of `width` bytes each) from the CUDA - array `src` starting at `hOffset` rows and `wOffset` bytes from the - upper left corner to the memory area pointed to by `dst`, where `kind` - specifies the direction of the copy, and must be one of - :py:obj:`~.cudaMemcpyHostToHost`, :py:obj:`~.cudaMemcpyHostToDevice`, - :py:obj:`~.cudaMemcpyDeviceToHost`, + [Deprecated] + + Copies `count` bytes from the CUDA array `src` starting at `hOffset` + rows and `wOffset` bytes from the upper left corner to the memory area + pointed to by `dst`, where `kind` specifies the direction of the copy, + and must be one of :py:obj:`~.cudaMemcpyHostToHost`, + :py:obj:`~.cudaMemcpyHostToDevice`, :py:obj:`~.cudaMemcpyDeviceToHost`, :py:obj:`~.cudaMemcpyDeviceToDevice`, or :py:obj:`~.cudaMemcpyDefault`. Passing :py:obj:`~.cudaMemcpyDefault` is recommended, in which case the type of transfer is inferred from the pointer values. However, :py:obj:`~.cudaMemcpyDefault` is only allowed on systems that support - unified virtual addressing. `dpitch` is the width in memory in bytes of - the 2D array pointed to by `dst`, including any padding added to the - end of each row. `wOffset` + `width` must not exceed the width of the - CUDA array `src`. `width` must not exceed `dpitch`. - :py:obj:`~.cudaMemcpy2DFromArrayAsync()` returns an error if `dpitch` - exceeds the maximum allowed. + unified virtual addressing. - :py:obj:`~.cudaMemcpy2DFromArrayAsync()` is asynchronous with respect - to the host, so the call may return before the copy is complete. The - copy can optionally be associated to a stream by passing a non-zero - `stream` argument. If `kind` is :py:obj:`~.cudaMemcpyHostToDevice` or + :py:obj:`~.cudaMemcpyFromArrayAsync()` is asynchronous with respect to + the host, so the call may return before the copy is complete. The copy + can optionally be associated to a stream by passing a non-zero `stream` + argument. If `kind` is :py:obj:`~.cudaMemcpyHostToDevice` or :py:obj:`~.cudaMemcpyDeviceToHost` and `stream` is non-zero, the copy may overlap with operations in other streams. - :py:obj:`~.cudaMemcpyToSymbolAsync`, - :py:obj:`~.cudaMemcpyFromSymbolAsync`, :py:obj:`~.cuMemcpy2DAsync` - Parameters ---------- dst : Any Destination memory address - dpitch : size_t - Pitch of destination memory src : :py:obj:`~.cudaArray_const_t` Source memory address wOffset : size_t Source starting X offset (columns in bytes) hOffset : size_t Source starting Y offset (rows) - width : size_t - Width of matrix transfer (columns in bytes) - height : size_t - Height of matrix transfer (rows) + count : size_t + Size in bytes to copy kind : :py:obj:`~.cudaMemcpyKind` Type of transfer stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` @@ -21628,3885 +30056,3945 @@ def cudaMemcpy2DFromArrayAsync(dst, size_t dpitch, src, size_t wOffset, size_t h Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidPitchValue`, :py:obj:`~.cudaErrorInvalidMemcpyDirection` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidMemcpyDirection` See Also -------- - :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpy2D`, :py:obj:`~.cudaMemcpy2DToArray`, :py:obj:`~.cudaMemcpy2DFromArray`, :py:obj:`~.cudaMemcpy2DArrayToArray`, :py:obj:`~.cudaMemcpyToSymbol`, :py:obj:`~.cudaMemcpyFromSymbol`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpy2DAsync`, :py:obj:`~.cudaMemcpy2DToArrayAsync`, + :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpy2D`, :py:obj:`~.cudaMemcpyToArray`, :py:obj:`~.cudaMemcpy2DToArray`, :py:obj:`~.cudaMemcpyFromArray`, :py:obj:`~.cudaMemcpy2DFromArray`, :py:obj:`~.cudaMemcpyArrayToArray`, :py:obj:`~.cudaMemcpy2DArrayToArray`, :py:obj:`~.cudaMemcpyToSymbol`, :py:obj:`~.cudaMemcpyFromSymbol`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpy2DAsync`, :py:obj:`~.cudaMemcpyToArrayAsync`, :py:obj:`~.cudaMemcpy2DToArrayAsync`, :py:obj:`~.cudaMemcpy2DFromArrayAsync`, :py:obj:`~.cudaMemcpyToSymbolAsync`, :py:obj:`~.cudaMemcpyFromSymbolAsync`, :py:obj:`~.cuMemcpyAtoHAsync`, :py:obj:`~.cuMemcpy2DAsync` """ - cdef ccudart.cudaStream_t cstream + cdef cyruntime.cudaStream_t cystream if stream is None: - cstream = 0 - elif isinstance(stream, (cudaStream_t,cuda.CUstream)): + pstream = 0 + elif isinstance(stream, (cudaStream_t,driver.CUstream)): pstream = int(stream) - cstream = pstream else: pstream = int(cudaStream_t(stream)) - cstream = pstream - cdef ccudart.cudaArray_const_t csrc + cystream = pstream + cdef cyruntime.cudaArray_const_t cysrc if src is None: - csrc = 0 + psrc = 0 elif isinstance(src, (cudaArray_const_t,)): psrc = int(src) - csrc = psrc else: psrc = int(cudaArray_const_t(src)) - csrc = psrc - cdst = utils.HelperInputVoidPtr(dst) - cdef void* cdst_ptr = cdst.cptr - cdef ccudart.cudaMemcpyKind ckind = kind.value + cysrc = psrc + cdef _HelperInputVoidPtrStruct cydstHelper + cdef void* cydst = _helper_input_void_ptr(dst, &cydstHelper) + cdef cyruntime.cudaMemcpyKind cykind = int(kind) with nogil: - err = ccudart.cudaMemcpy2DFromArrayAsync(cdst_ptr, dpitch, csrc, wOffset, hOffset, width, height, ckind, cstream) - - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaMemset' in found_functions}} + err = cyruntime.cudaMemcpyFromArrayAsync(cydst, cysrc, wOffset, hOffset, count, cykind, cystream) + _helper_input_void_ptr_free(&cydstHelper) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaMemset(devPtr, int value, size_t count): - """ Initializes or sets device memory to a value. - - Fills the first `count` bytes of the memory area pointed to by `devPtr` - with the constant byte value `value`. +def cudaMallocAsync(size_t size, hStream): + """ Allocates memory with stream ordered semantics. - Note that this function is asynchronous with respect to the host unless - `devPtr` refers to pinned host memory. + Inserts an allocation operation into `hStream`. A pointer to the + allocated memory is returned immediately in *dptr. The allocation must + not be accessed until the the allocation operation completes. The + allocation comes from the memory pool associated with the stream's + device. Parameters ---------- - devPtr : Any - Pointer to device memory - value : int - Value to set for each byte of specified memory - count : size_t - Size in bytes to set + size : size_t + Number of bytes to allocate + hStream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + The stream establishing the stream ordering contract and the memory + pool to allocate from Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, - - See Also - -------- - :py:obj:`~.cuMemsetD8`, :py:obj:`~.cuMemsetD16`, :py:obj:`~.cuMemsetD32` - """ - cdevPtr = utils.HelperInputVoidPtr(devPtr) - cdef void* cdevPtr_ptr = cdevPtr.cptr - with nogil: - err = ccudart.cudaMemset(cdevPtr_ptr, value, count) - - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaMemset2D' in found_functions}} - -@cython.embedsignature(True) -def cudaMemset2D(devPtr, size_t pitch, int value, size_t width, size_t height): - """ Initializes or sets device memory to a value. - - Sets to the specified value `value` a matrix (`height` rows of `width` - bytes each) pointed to by `dstPtr`. `pitch` is the width in bytes of - the 2D array pointed to by `dstPtr`, including any padding added to the - end of each row. This function performs fastest when the pitch is one - that has been passed back by :py:obj:`~.cudaMallocPitch()`. - - Note that this function is asynchronous with respect to the host unless - `devPtr` refers to pinned host memory. - - Parameters - ---------- + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorNotSupported`, :py:obj:`~.cudaErrorOutOfMemory`, devPtr : Any - Pointer to 2D device memory - pitch : size_t - Pitch in bytes of 2D device memory(Unused if `height` is 1) - value : int - Value to set for each byte of specified memory - width : size_t - Width of matrix set (columns in bytes) - height : size_t - Height of matrix set (rows) - - Returns - ------- - cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, + Returned device pointer See Also -------- - :py:obj:`~.cudaMemset`, :py:obj:`~.cudaMemset3D`, :py:obj:`~.cudaMemsetAsync`, :py:obj:`~.cudaMemset2DAsync`, :py:obj:`~.cudaMemset3DAsync`, :py:obj:`~.cuMemsetD2D8`, :py:obj:`~.cuMemsetD2D16`, :py:obj:`~.cuMemsetD2D32` - """ - cdevPtr = utils.HelperInputVoidPtr(devPtr) - cdef void* cdevPtr_ptr = cdevPtr.cptr - err = ccudart.cudaMemset2D(cdevPtr_ptr, pitch, value, width, height) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaMemset3D' in found_functions}} - -@cython.embedsignature(True) -def cudaMemset3D(pitchedDevPtr not None : cudaPitchedPtr, int value, extent not None : cudaExtent): - """ Initializes or sets device memory to a value. + :py:obj:`~.cuMemAllocAsync`, cudaMallocAsync (C++ API), :py:obj:`~.cudaMallocFromPoolAsync`, :py:obj:`~.cudaFreeAsync`, :py:obj:`~.cudaDeviceSetMemPool`, :py:obj:`~.cudaDeviceGetDefaultMemPool`, :py:obj:`~.cudaDeviceGetMemPool`, :py:obj:`~.cudaMemPoolSetAccess`, :py:obj:`~.cudaMemPoolSetAttribute`, :py:obj:`~.cudaMemPoolGetAttribute` - Initializes each element of a 3D array to the specified value `value`. - The object to initialize is defined by `pitchedDevPtr`. The `pitch` - field of `pitchedDevPtr` is the width in memory in bytes of the 3D - array pointed to by `pitchedDevPtr`, including any padding added to the - end of each row. The `xsize` field specifies the logical width of each - row in bytes, while the `ysize` field specifies the height of each 2D - slice in rows. The `pitch` field of `pitchedDevPtr` is ignored when - `height` and `depth` are both equal to 1. + Notes + ----- + The default memory pool of a device contains device memory from that device. - The extents of the initialized region are specified as a `width` in - bytes, a `height` in rows, and a `depth` in slices. + Basic stream ordering allows future work submitted into the same stream to use the allocation. Stream query, stream synchronize, and CUDA events can be used to guarantee that the allocation operation completes before work submitted in a separate stream runs. - Extents with `width` greater than or equal to the `xsize` of - `pitchedDevPtr` may perform significantly faster than extents narrower - than the `xsize`. Secondarily, extents with `height` equal to the - `ysize` of `pitchedDevPtr` will perform faster than when the `height` - is shorter than the `ysize`. + During stream capture, this function results in the creation of an allocation node. In this case, the allocation is owned by the graph instead of the memory pool. The memory pool's properties are used to set the node's creation parameters. + """ + cdef cyruntime.cudaStream_t cyhStream + if hStream is None: + phStream = 0 + elif isinstance(hStream, (cudaStream_t,driver.CUstream)): + phStream = int(hStream) + else: + phStream = int(cudaStream_t(hStream)) + cyhStream = phStream + cdef void_ptr devPtr = 0 + with nogil: + err = cyruntime.cudaMallocAsync(&devPtr, size, cyhStream) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, devPtr) - This function performs fastest when the `pitchedDevPtr` has been - allocated by :py:obj:`~.cudaMalloc3D()`. +@cython.embedsignature(True) +def cudaFreeAsync(devPtr, hStream): + """ Frees memory with stream ordered semantics. - Note that this function is asynchronous with respect to the host unless - `pitchedDevPtr` refers to pinned host memory. + Inserts a free operation into `hStream`. The allocation must not be + accessed after stream execution reaches the free. After this API + returns, accessing the memory from any subsequent work launched on the + GPU or querying its pointer attributes results in undefined behavior. Parameters ---------- - pitchedDevPtr : :py:obj:`~.cudaPitchedPtr` - Pointer to pitched device memory - value : int - Value to set for each byte of specified memory - extent : :py:obj:`~.cudaExtent` - Size parameters for where to set device memory (`width` field in - bytes) + dptr : Any + memory to free + hStream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + The stream establishing the stream ordering promise Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorNotSupported` See Also -------- - :py:obj:`~.cudaMemset`, :py:obj:`~.cudaMemset2D`, :py:obj:`~.cudaMemsetAsync`, :py:obj:`~.cudaMemset2DAsync`, :py:obj:`~.cudaMemset3DAsync`, :py:obj:`~.cudaMalloc3D`, :py:obj:`~.make_cudaPitchedPtr`, :py:obj:`~.make_cudaExtent` - """ - err = ccudart.cudaMemset3D(pitchedDevPtr._ptr[0], value, extent._ptr[0]) - return (cudaError_t(err),) -{{endif}} + :py:obj:`~.cuMemFreeAsync`, :py:obj:`~.cudaMallocAsync` -{{if 'cudaMemsetAsync' in found_functions}} + Notes + ----- + During stream capture, this function results in the creation of a free node and must therefore be passed the address of a graph allocation. + """ + cdef cyruntime.cudaStream_t cyhStream + if hStream is None: + phStream = 0 + elif isinstance(hStream, (cudaStream_t,driver.CUstream)): + phStream = int(hStream) + else: + phStream = int(cudaStream_t(hStream)) + cyhStream = phStream + cdef _HelperInputVoidPtrStruct cydevPtrHelper + cdef void* cydevPtr = _helper_input_void_ptr(devPtr, &cydevPtrHelper) + with nogil: + err = cyruntime.cudaFreeAsync(cydevPtr, cyhStream) + _helper_input_void_ptr_free(&cydevPtrHelper) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaMemsetAsync(devPtr, int value, size_t count, stream): - """ Initializes or sets device memory to a value. - - Fills the first `count` bytes of the memory area pointed to by `devPtr` - with the constant byte value `value`. - - :py:obj:`~.cudaMemsetAsync()` is asynchronous with respect to the host, - so the call may return before the memset is complete. The operation can - optionally be associated to a stream by passing a non-zero `stream` - argument. If `stream` is non-zero, the operation may overlap with - operations in other streams. +def cudaMemPoolTrimTo(memPool, size_t minBytesToKeep): + """ Tries to release memory back to the OS. - The device version of this function only handles device to device - copies and cannot be given local or shared pointers. + Releases memory back to the OS until the pool contains fewer than + minBytesToKeep reserved bytes, or there is no more memory that the + allocator can safely release. The allocator cannot release OS + allocations that back outstanding asynchronous allocations. The OS + allocations may happen at different granularity from the user + allocations. Parameters ---------- - devPtr : Any - Pointer to device memory - value : int - Value to set for each byte of specified memory - count : size_t - Size in bytes to set - stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` - Stream identifier + pool : :py:obj:`~.CUmemoryPool` or :py:obj:`~.cudaMemPool_t` + The memory pool to trim + minBytesToKeep : size_t + If the pool has less than minBytesToKeep reserved, the TrimTo + operation is a no-op. Otherwise the pool will be guaranteed to have + at least minBytesToKeep bytes reserved after the operation. Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` See Also -------- - :py:obj:`~.cudaMemset`, :py:obj:`~.cudaMemset2D`, :py:obj:`~.cudaMemset3D`, :py:obj:`~.cudaMemset2DAsync`, :py:obj:`~.cudaMemset3DAsync`, :py:obj:`~.cuMemsetD8Async`, :py:obj:`~.cuMemsetD16Async`, :py:obj:`~.cuMemsetD32Async` + :py:obj:`~.cuMemPoolTrimTo`, :py:obj:`~.cudaMallocAsync`, :py:obj:`~.cudaFreeAsync`, :py:obj:`~.cudaDeviceGetDefaultMemPool`, :py:obj:`~.cudaDeviceGetMemPool`, :py:obj:`~.cudaMemPoolCreate` + + Notes + ----- + : Allocations that have not been freed count as outstanding. + + : Allocations that have been asynchronously freed but whose completion has not been observed on the host (eg. by a synchronize) can count as outstanding. """ - cdef ccudart.cudaStream_t cstream - if stream is None: - cstream = 0 - elif isinstance(stream, (cudaStream_t,cuda.CUstream)): - pstream = int(stream) - cstream = pstream + cdef cyruntime.cudaMemPool_t cymemPool + if memPool is None: + pmemPool = 0 + elif isinstance(memPool, (cudaMemPool_t,driver.CUmemoryPool)): + pmemPool = int(memPool) else: - pstream = int(cudaStream_t(stream)) - cstream = pstream - cdevPtr = utils.HelperInputVoidPtr(devPtr) - cdef void* cdevPtr_ptr = cdevPtr.cptr + pmemPool = int(cudaMemPool_t(memPool)) + cymemPool = pmemPool with nogil: - err = ccudart.cudaMemsetAsync(cdevPtr_ptr, value, count, cstream) + err = cyruntime.cudaMemPoolTrimTo(cymemPool, minBytesToKeep) + return (_cudaError_t(err),) - return (cudaError_t(err),) -{{endif}} +@cython.embedsignature(True) +def cudaMemPoolSetAttribute(memPool, attr not None : cudaMemPoolAttr, value): + """ Sets attributes of a memory pool. -{{if 'cudaMemset2DAsync' in found_functions}} + Supported attributes are: -@cython.embedsignature(True) -def cudaMemset2DAsync(devPtr, size_t pitch, int value, size_t width, size_t height, stream): - """ Initializes or sets device memory to a value. + - :py:obj:`~.cudaMemPoolAttrReleaseThreshold`: (value type = + cuuint64_t) Amount of reserved memory in bytes to hold onto before + trying to release memory back to the OS. When more than the release + threshold bytes of memory are held by the memory pool, the allocator + will try to release memory back to the OS on the next call to stream, + event or context synchronize. (default 0) - Sets to the specified value `value` a matrix (`height` rows of `width` - bytes each) pointed to by `dstPtr`. `pitch` is the width in bytes of - the 2D array pointed to by `dstPtr`, including any padding added to the - end of each row. This function performs fastest when the pitch is one - that has been passed back by :py:obj:`~.cudaMallocPitch()`. + - :py:obj:`~.cudaMemPoolReuseFollowEventDependencies`: (value type = + int) Allow :py:obj:`~.cudaMallocAsync` to use memory asynchronously + freed in another stream as long as a stream ordering dependency of + the allocating stream on the free action exists. Cuda events and null + stream interactions can create the required stream ordered + dependencies. (default enabled) - :py:obj:`~.cudaMemset2DAsync()` is asynchronous with respect to the - host, so the call may return before the memset is complete. The - operation can optionally be associated to a stream by passing a non- - zero `stream` argument. If `stream` is non-zero, the operation may - overlap with operations in other streams. + - :py:obj:`~.cudaMemPoolReuseAllowOpportunistic`: (value type = int) + Allow reuse of already completed frees when there is no dependency + between the free and allocation. (default enabled) - The device version of this function only handles device to device - copies and cannot be given local or shared pointers. + - :py:obj:`~.cudaMemPoolReuseAllowInternalDependencies`: (value type = + int) Allow :py:obj:`~.cudaMallocAsync` to insert new stream + dependencies in order to establish the stream ordering required to + reuse a piece of memory released by :py:obj:`~.cudaFreeAsync` + (default enabled). + + - :py:obj:`~.cudaMemPoolAttrReservedMemHigh`: (value type = cuuint64_t) + Reset the high watermark that tracks the amount of backing memory + that was allocated for the memory pool. It is illegal to set this + attribute to a non-zero value. + + - :py:obj:`~.cudaMemPoolAttrUsedMemHigh`: (value type = cuuint64_t) + Reset the high watermark that tracks the amount of used memory that + was allocated for the memory pool. It is illegal to set this + attribute to a non-zero value. Parameters ---------- - devPtr : Any - Pointer to 2D device memory - pitch : size_t - Pitch in bytes of 2D device memory(Unused if `height` is 1) - value : int - Value to set for each byte of specified memory - width : size_t - Width of matrix set (columns in bytes) - height : size_t - Height of matrix set (rows) - stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` - Stream identifier + pool : :py:obj:`~.CUmemoryPool` or :py:obj:`~.cudaMemPool_t` + The memory pool to modify + attr : :py:obj:`~.cudaMemPoolAttr` + The attribute to modify + value : Any + Pointer to the value to assign Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` See Also -------- - :py:obj:`~.cudaMemset`, :py:obj:`~.cudaMemset2D`, :py:obj:`~.cudaMemset3D`, :py:obj:`~.cudaMemsetAsync`, :py:obj:`~.cudaMemset3DAsync`, :py:obj:`~.cuMemsetD2D8Async`, :py:obj:`~.cuMemsetD2D16Async`, :py:obj:`~.cuMemsetD2D32Async` + :py:obj:`~.cuMemPoolSetAttribute`, :py:obj:`~.cudaMallocAsync`, :py:obj:`~.cudaFreeAsync`, :py:obj:`~.cudaDeviceGetDefaultMemPool`, :py:obj:`~.cudaDeviceGetMemPool`, :py:obj:`~.cudaMemPoolCreate` """ - cdef ccudart.cudaStream_t cstream - if stream is None: - cstream = 0 - elif isinstance(stream, (cudaStream_t,cuda.CUstream)): - pstream = int(stream) - cstream = pstream + cdef cyruntime.cudaMemPool_t cymemPool + if memPool is None: + pmemPool = 0 + elif isinstance(memPool, (cudaMemPool_t,driver.CUmemoryPool)): + pmemPool = int(memPool) else: - pstream = int(cudaStream_t(stream)) - cstream = pstream - cdevPtr = utils.HelperInputVoidPtr(devPtr) - cdef void* cdevPtr_ptr = cdevPtr.cptr - err = ccudart.cudaMemset2DAsync(cdevPtr_ptr, pitch, value, width, height, cstream) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaMemset3DAsync' in found_functions}} + pmemPool = int(cudaMemPool_t(memPool)) + cymemPool = pmemPool + cdef cyruntime.cudaMemPoolAttr cyattr = int(attr) + cdef _HelperCUmemPool_attribute cyvalue = _HelperCUmemPool_attribute(attr, value, is_getter=False) + cdef void* cyvalue_ptr = cyvalue.cptr + with nogil: + err = cyruntime.cudaMemPoolSetAttribute(cymemPool, cyattr, cyvalue_ptr) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaMemset3DAsync(pitchedDevPtr not None : cudaPitchedPtr, int value, extent not None : cudaExtent, stream): - """ Initializes or sets device memory to a value. +def cudaMemPoolGetAttribute(memPool, attr not None : cudaMemPoolAttr): + """ Gets attributes of a memory pool. - Initializes each element of a 3D array to the specified value `value`. - The object to initialize is defined by `pitchedDevPtr`. The `pitch` - field of `pitchedDevPtr` is the width in memory in bytes of the 3D - array pointed to by `pitchedDevPtr`, including any padding added to the - end of each row. The `xsize` field specifies the logical width of each - row in bytes, while the `ysize` field specifies the height of each 2D - slice in rows. The `pitch` field of `pitchedDevPtr` is ignored when - `height` and `depth` are both equal to 1. + Supported attributes are: + + - :py:obj:`~.cudaMemPoolAttrReleaseThreshold`: (value type = + cuuint64_t) Amount of reserved memory in bytes to hold onto before + trying to release memory back to the OS. When more than the release + threshold bytes of memory are held by the memory pool, the allocator + will try to release memory back to the OS on the next call to stream, + event or context synchronize. (default 0) + + - :py:obj:`~.cudaMemPoolReuseFollowEventDependencies`: (value type = + int) Allow :py:obj:`~.cudaMallocAsync` to use memory asynchronously + freed in another stream as long as a stream ordering dependency of + the allocating stream on the free action exists. Cuda events and null + stream interactions can create the required stream ordered + dependencies. (default enabled) + + - :py:obj:`~.cudaMemPoolReuseAllowOpportunistic`: (value type = int) + Allow reuse of already completed frees when there is no dependency + between the free and allocation. (default enabled) + + - :py:obj:`~.cudaMemPoolReuseAllowInternalDependencies`: (value type = + int) Allow :py:obj:`~.cudaMallocAsync` to insert new stream + dependencies in order to establish the stream ordering required to + reuse a piece of memory released by :py:obj:`~.cudaFreeAsync` + (default enabled). + + - :py:obj:`~.cudaMemPoolAttrReservedMemCurrent`: (value type = + cuuint64_t) Amount of backing memory currently allocated for the + mempool. + + - :py:obj:`~.cudaMemPoolAttrReservedMemHigh`: (value type = cuuint64_t) + High watermark of backing memory allocated for the mempool since the + last time it was reset. + + - :py:obj:`~.cudaMemPoolAttrUsedMemCurrent`: (value type = cuuint64_t) + Amount of memory from the pool that is currently in use by the + application. + + - :py:obj:`~.cudaMemPoolAttrUsedMemHigh`: (value type = cuuint64_t) + High watermark of the amount of memory from the pool that was in use + by the application since the last time it was reset. + + The following properties can be also be queried on imported and default + pools: + + - :py:obj:`~.cudaMemPoolAttrAllocationType`: (value type = + :py:obj:`~.cudaMemAllocationType`) The allocation type of the mempool - The extents of the initialized region are specified as a `width` in - bytes, a `height` in rows, and a `depth` in slices. + - :py:obj:`~.cudaMemPoolAttrExportHandleTypes`: (value type = + :py:obj:`~.cudaMemAllocationHandleType`) Available export handle + types for the mempool. For imported pools this value is always + cudaMemHandleTypeNone as an imported pool cannot be re-exported - Extents with `width` greater than or equal to the `xsize` of - `pitchedDevPtr` may perform significantly faster than extents narrower - than the `xsize`. Secondarily, extents with `height` equal to the - `ysize` of `pitchedDevPtr` will perform faster than when the `height` - is shorter than the `ysize`. + - :py:obj:`~.cudaMemPoolAttrLocationId`: (value type = int) The + location id for the mempool. If the location type for this pool is + cudaMemLocationTypeInvisible then ID will be cudaInvalidDeviceId. - This function performs fastest when the `pitchedDevPtr` has been - allocated by :py:obj:`~.cudaMalloc3D()`. + - :py:obj:`~.cudaMemPoolAttrLocationType`: (value type = + :py:obj:`~.cudaMemLocationType`) The location type for the mempool. + For imported memory pools where the device is not directly visible to + the importing process or pools imported via fabric handles across + nodes this will be cudaMemlocataionTypeInvisible. - :py:obj:`~.cudaMemset3DAsync()` is asynchronous with respect to the - host, so the call may return before the memset is complete. The - operation can optionally be associated to a stream by passing a non- - zero `stream` argument. If `stream` is non-zero, the operation may - overlap with operations in other streams. + - :py:obj:`~.cudaMemPoolAttrMaxPoolSize`: (value type = cuuint64_t) + Maximum size of the pool in bytes, this value may be higher than what + was initially passed to cuMemPoolCreate due to alignment + requirements. A value of 0 indicates no maximum size. For + cudaMemAllocationTypeManaged and IPC imported pools this value will + be system dependent. - The device version of this function only handles device to device - copies and cannot be given local or shared pointers. + - :py:obj:`~.cudaMemPoolAttrHwDecompressEnabled`: (value type = int) + Indicates whether the pool has hardware compresssion enabled Parameters ---------- - pitchedDevPtr : :py:obj:`~.cudaPitchedPtr` - Pointer to pitched device memory - value : int - Value to set for each byte of specified memory - extent : :py:obj:`~.cudaExtent` - Size parameters for where to set device memory (`width` field in - bytes) - stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` - Stream identifier + pool : :py:obj:`~.CUmemoryPool` or :py:obj:`~.cudaMemPool_t` + The memory pool to get attributes of + attr : :py:obj:`~.cudaMemPoolAttr` + The attribute to get Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + value : Any + Retrieved value See Also -------- - :py:obj:`~.cudaMemset`, :py:obj:`~.cudaMemset2D`, :py:obj:`~.cudaMemset3D`, :py:obj:`~.cudaMemsetAsync`, :py:obj:`~.cudaMemset2DAsync`, :py:obj:`~.cudaMalloc3D`, :py:obj:`~.make_cudaPitchedPtr`, :py:obj:`~.make_cudaExtent` + :py:obj:`~.cuMemPoolGetAttribute`, :py:obj:`~.cudaMallocAsync`, :py:obj:`~.cudaFreeAsync`, :py:obj:`~.cudaDeviceGetDefaultMemPool`, :py:obj:`~.cudaDeviceGetMemPool`, :py:obj:`~.cudaMemPoolCreate` """ - cdef ccudart.cudaStream_t cstream - if stream is None: - cstream = 0 - elif isinstance(stream, (cudaStream_t,cuda.CUstream)): - pstream = int(stream) - cstream = pstream + cdef cyruntime.cudaMemPool_t cymemPool + if memPool is None: + pmemPool = 0 + elif isinstance(memPool, (cudaMemPool_t,driver.CUmemoryPool)): + pmemPool = int(memPool) else: - pstream = int(cudaStream_t(stream)) - cstream = pstream - err = ccudart.cudaMemset3DAsync(pitchedDevPtr._ptr[0], value, extent._ptr[0], cstream) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaMemPrefetchAsync' in found_functions}} + pmemPool = int(cudaMemPool_t(memPool)) + cymemPool = pmemPool + cdef cyruntime.cudaMemPoolAttr cyattr = int(attr) + cdef _HelperCUmemPool_attribute cyvalue = _HelperCUmemPool_attribute(attr, 0, is_getter=True) + cdef void* cyvalue_ptr = cyvalue.cptr + with nogil: + err = cyruntime.cudaMemPoolGetAttribute(cymemPool, cyattr, cyvalue_ptr) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, cyvalue.pyObj()) @cython.embedsignature(True) -def cudaMemPrefetchAsync(devPtr, size_t count, int dstDevice, stream): - """ Prefetches memory to the specified destination device. +def cudaMemPoolSetAccess(memPool, descList : Optional[tuple[cudaMemAccessDesc] | list[cudaMemAccessDesc]], size_t count): + """ Controls visibility of pools between devices. - Prefetches memory to the specified destination device. `devPtr` is the - base device pointer of the memory to be prefetched and `dstDevice` is - the destination device. `count` specifies the number of bytes to copy. - `stream` is the stream in which the operation is enqueued. The memory - range must refer to managed memory allocated via - :py:obj:`~.cudaMallocManaged` or declared via managed variables. + Parameters + ---------- + pool : :py:obj:`~.CUmemoryPool` or :py:obj:`~.cudaMemPool_t` + The pool being modified + map : list[:py:obj:`~.cudaMemAccessDesc`] + Array of access descriptors. Each descriptor instructs the access + to enable for a single gpu + count : size_t + Number of descriptors in the map array. - Passing in cudaCpuDeviceId for `dstDevice` will prefetch the data to - host memory. If `dstDevice` is a GPU, then the device attribute - :py:obj:`~.cudaDevAttrConcurrentManagedAccess` must be non-zero. - Additionally, `stream` must be associated with a device that has a non- - zero value for the device attribute - :py:obj:`~.cudaDevAttrConcurrentManagedAccess`. + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` - The start address and end address of the memory range will be rounded - down and rounded up respectively to be aligned to CPU page size before - the prefetch operation is enqueued in the stream. + See Also + -------- + :py:obj:`~.cuMemPoolSetAccess`, :py:obj:`~.cudaMemPoolGetAccess`, :py:obj:`~.cudaMallocAsync`, :py:obj:`~.cudaFreeAsync` + """ + descList = [] if descList is None else descList + if not all(isinstance(_x, (cudaMemAccessDesc,)) for _x in descList): + raise TypeError("Argument 'descList' is not instance of type (expected tuple[cyruntime.cudaMemAccessDesc,] or list[cyruntime.cudaMemAccessDesc,]") + cdef cyruntime.cudaMemPool_t cymemPool + if memPool is None: + pmemPool = 0 + elif isinstance(memPool, (cudaMemPool_t,driver.CUmemoryPool)): + pmemPool = int(memPool) + else: + pmemPool = int(cudaMemPool_t(memPool)) + cymemPool = pmemPool + cdef cyruntime.cudaMemAccessDesc* cydescList = NULL + if len(descList) > 1: + cydescList = calloc(len(descList), sizeof(cyruntime.cudaMemAccessDesc)) + if cydescList is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(descList)) + 'x' + str(sizeof(cyruntime.cudaMemAccessDesc))) + for idx in range(len(descList)): + string.memcpy(&cydescList[idx], (descList[idx])._pvt_ptr, sizeof(cyruntime.cudaMemAccessDesc)) + elif len(descList) == 1: + cydescList = (descList[0])._pvt_ptr + if count > len(descList): raise RuntimeError("List is too small: " + str(len(descList)) + " < " + str(count)) + with nogil: + err = cyruntime.cudaMemPoolSetAccess(cymemPool, cydescList, count) + if len(descList) > 1 and cydescList is not NULL: + free(cydescList) + return (_cudaError_t(err),) - If no physical memory has been allocated for this region, then this - memory region will be populated and mapped on the destination device. - If there's insufficient memory to prefetch the desired region, the - Unified Memory driver may evict pages from other - :py:obj:`~.cudaMallocManaged` allocations to host memory in order to - make room. Device memory allocated using :py:obj:`~.cudaMalloc` or - :py:obj:`~.cudaMallocArray` will not be evicted. +@cython.embedsignature(True) +def cudaMemPoolGetAccess(memPool, location : Optional[cudaMemLocation]): + """ Returns the accessibility of a pool from a device. - By default, any mappings to the previous location of the migrated pages - are removed and mappings for the new location are only setup on - `dstDevice`. The exact behavior however also depends on the settings - applied to this memory range via :py:obj:`~.cudaMemAdvise` as described - below: + Returns the accessibility of the pool's memory from the specified + location. - If :py:obj:`~.cudaMemAdviseSetReadMostly` was set on any subset of this - memory range, then that subset will create a read-only copy of the - pages on `dstDevice`. + Parameters + ---------- + memPool : :py:obj:`~.CUmemoryPool` or :py:obj:`~.cudaMemPool_t` + the pool being queried + location : :py:obj:`~.cudaMemLocation` + the location accessing the pool - If :py:obj:`~.cudaMemAdviseSetPreferredLocation` was called on any - subset of this memory range, then the pages will be migrated to - `dstDevice` even if `dstDevice` is not the preferred location of any - pages in the memory range. + Returns + ------- + cudaError_t - If :py:obj:`~.cudaMemAdviseSetAccessedBy` was called on any subset of - this memory range, then mappings to those pages from all the - appropriate processors are updated to refer to the new location if - establishing such a mapping is possible. Otherwise, those mappings are - cleared. + flags : :py:obj:`~.cudaMemAccessFlags` + the accessibility of the pool from the specified location - Note that this API is not required for functionality and only serves to - improve performance by allowing the application to migrate data to a - suitable location before it is accessed. Memory accesses to this range - are always coherent and are allowed even when the data is actively - being migrated. + See Also + -------- + :py:obj:`~.cuMemPoolGetAccess`, :py:obj:`~.cudaMemPoolSetAccess` + """ + cdef cyruntime.cudaMemPool_t cymemPool + if memPool is None: + pmemPool = 0 + elif isinstance(memPool, (cudaMemPool_t,driver.CUmemoryPool)): + pmemPool = int(memPool) + else: + pmemPool = int(cudaMemPool_t(memPool)) + cymemPool = pmemPool + cdef cyruntime.cudaMemAccessFlags flags + cdef cyruntime.cudaMemLocation* cylocation_ptr = location._pvt_ptr if location is not None else NULL + with nogil: + err = cyruntime.cudaMemPoolGetAccess(&flags, cymemPool, cylocation_ptr) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, cudaMemAccessFlags(flags)) - Note that this function is asynchronous with respect to the host and - all work on other devices. +@cython.embedsignature(True) +def cudaMemPoolCreate(poolProps : Optional[cudaMemPoolProps]): + """ Creates a memory pool. + + Creates a CUDA memory pool and returns the handle in `pool`. The + `poolProps` determines the properties of the pool such as the backing + device and IPC capabilities. + + To create a memory pool for host memory not targeting a specific NUMA + node, applications must set set + :py:obj:`~.cudaMemPoolProps.cudaMemLocation.type` to + :py:obj:`~.cudaMemLocationTypeHost`. + :py:obj:`~.cudaMemPoolProps.cudaMemLocation.id` is ignored for such + pools. Pools created with the type :py:obj:`~.cudaMemLocationTypeHost` + are not IPC capable and :py:obj:`~.cudaMemPoolProps.handleTypes` must + be 0, any other values will result in + :py:obj:`~.cudaErrorInvalidValue`. To create a memory pool targeting a + specific host NUMA node, applications must set + :py:obj:`~.cudaMemPoolProps.cudaMemLocation.type` to + :py:obj:`~.cudaMemLocationTypeHostNuma` and + :py:obj:`~.cudaMemPoolProps.cudaMemLocation.id` must specify the NUMA + ID of the host memory node. Specifying + :py:obj:`~.cudaMemLocationTypeHostNumaCurrent` as the + :py:obj:`~.cudaMemPoolProps.cudaMemLocation.type` will result in + :py:obj:`~.cudaErrorInvalidValue`. By default, the pool's memory will + be accessible from the device it is allocated on. In the case of pools + created with :py:obj:`~.cudaMemLocationTypeHostNuma` or + :py:obj:`~.cudaMemLocationTypeHost`, their default accessibility will + be from the host CPU. Applications can control the maximum size of the + pool by specifying a non-zero value for + :py:obj:`~.cudaMemPoolProps.maxSize`. If set to 0, the maximum size of + the pool will default to a system dependent value. + + Applications that intend to use :py:obj:`~.CU_MEM_HANDLE_TYPE_FABRIC` + based memory sharing must ensure: (1) `nvidia-caps-imex-channels` + character device is created by the driver and is listed under + /proc/devices (2) have at least one IMEX channel file accessible by the + user launching the application. + + When exporter and importer CUDA processes have been granted access to + the same IMEX channel, they can securely share memory. + + The IMEX channel security model works on a per user basis. Which means + all processes under a user can share memory if the user has access to a + valid IMEX channel. When multi-user isolation is desired, a separate + IMEX channel is required for each user. + + These channel files exist in /dev/nvidia-caps-imex-channels/channel* + and can be created using standard OS native calls like mknod on Linux. + For example: To create channel0 with the major number from + /proc/devices users can execute the following command: `mknod + /dev/nvidia-caps-imex-channels/channel0 c 0` + + To create a managed memory pool, applications must set + :py:obj:`~.cudaMemPoolProps.py`:obj:`~.cudaMemAllocationType` to + :py:obj:`~.cudaMemAllocationTypeManaged`. + :py:obj:`~.cudaMemPoolProps.cudaMemAllocationHandleType` must also be + set to :py:obj:`~.cudaMemHandleTypeNone` since IPC is not supported. + For managed memory pools, :py:obj:`~.cudaMemPoolProps.cudaMemLocation` + will be treated as the preferred location for all allocations created + from the pool. An application can also set + :py:obj:`~.cudaMemLocationTypeNone` to indicate no preferred location. + :py:obj:`~.cudaMemPoolProps.maxSize` must be set to zero for managed + memory pools. :py:obj:`~.cudaMemPoolProps.usage` should be zero as + decompress for managed memory is not supported. For managed memory + pools, all devices on the system must have non-zero + :py:obj:`~.concurrentManagedAccess`. If not, this call returns + :py:obj:`~.cudaErrorNotSupported` Parameters ---------- - devPtr : Any - Pointer to be prefetched - count : size_t - Size in bytes - dstDevice : int - Destination device to prefetch to - stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` - Stream to enqueue prefetch operation + poolProps : :py:obj:`~.cudaMemPoolProps` + None Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidDevice` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorNotSupported` + memPool : :py:obj:`~.cudaMemPool_t` + None See Also -------- - :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpyPeer`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpy3DPeerAsync`, :py:obj:`~.cudaMemAdvise`, :py:obj:`~.cudaMemAdvise_v2` :py:obj:`~.cuMemPrefetchAsync` + :py:obj:`~.cuMemPoolCreate`, :py:obj:`~.cudaDeviceSetMemPool`, :py:obj:`~.cudaMallocFromPoolAsync`, :py:obj:`~.cudaMemPoolExportToShareableHandle`, :py:obj:`~.cudaDeviceGetDefaultMemPool`, :py:obj:`~.cudaDeviceGetMemPool` + + Notes + ----- + Specifying :py:obj:`~.cudaMemHandleTypeNone` creates a memory pool that will not support IPC. """ - cdef ccudart.cudaStream_t cstream - if stream is None: - cstream = 0 - elif isinstance(stream, (cudaStream_t,cuda.CUstream)): - pstream = int(stream) - cstream = pstream - else: - pstream = int(cudaStream_t(stream)) - cstream = pstream - cdevPtr = utils.HelperInputVoidPtr(devPtr) - cdef void* cdevPtr_ptr = cdevPtr.cptr + cdef cudaMemPool_t memPool = cudaMemPool_t() + cdef cyruntime.cudaMemPoolProps* cypoolProps_ptr = poolProps._pvt_ptr if poolProps is not None else NULL with nogil: - err = ccudart.cudaMemPrefetchAsync(cdevPtr_ptr, count, dstDevice, cstream) + err = cyruntime.cudaMemPoolCreate(memPool._pvt_ptr, cypoolProps_ptr) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, memPool) - return (cudaError_t(err),) -{{endif}} +@cython.embedsignature(True) +def cudaMemPoolDestroy(memPool): + """ Destroys the specified memory pool. -{{if 'cudaMemPrefetchAsync_v2' in found_functions}} + If any pointers obtained from this pool haven't been freed or the pool + has free operations that haven't completed when + :py:obj:`~.cudaMemPoolDestroy` is invoked, the function will return + immediately and the resources associated with the pool will be released + automatically once there are no more outstanding allocations. -@cython.embedsignature(True) -def cudaMemPrefetchAsync_v2(devPtr, size_t count, location not None : cudaMemLocation, unsigned int flags, stream): - """ + Destroying the current mempool of a device sets the default mempool of + that device as the current mempool for that device. Parameters ---------- - devPtr : Any - None - count : size_t - None - location : :py:obj:`~.cudaMemLocation` - None - flags : unsigned int - None - stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + memPool : :py:obj:`~.CUmemoryPool` or :py:obj:`~.cudaMemPool_t` None Returns ------- cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + + See Also + -------- + cuMemPoolDestroy, :py:obj:`~.cudaFreeAsync`, :py:obj:`~.cudaDeviceSetMemPool`, :py:obj:`~.cudaDeviceGetDefaultMemPool`, :py:obj:`~.cudaDeviceGetMemPool`, :py:obj:`~.cudaMemPoolCreate` + Notes + ----- + A device's default memory pool cannot be destroyed. """ - cdef ccudart.cudaStream_t cstream - if stream is None: - cstream = 0 - elif isinstance(stream, (cudaStream_t,cuda.CUstream)): - pstream = int(stream) - cstream = pstream + cdef cyruntime.cudaMemPool_t cymemPool + if memPool is None: + pmemPool = 0 + elif isinstance(memPool, (cudaMemPool_t,driver.CUmemoryPool)): + pmemPool = int(memPool) else: - pstream = int(cudaStream_t(stream)) - cstream = pstream - cdevPtr = utils.HelperInputVoidPtr(devPtr) - cdef void* cdevPtr_ptr = cdevPtr.cptr + pmemPool = int(cudaMemPool_t(memPool)) + cymemPool = pmemPool with nogil: - err = ccudart.cudaMemPrefetchAsync_v2(cdevPtr_ptr, count, location._ptr[0], flags, cstream) - - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaMemAdvise' in found_functions}} + err = cyruntime.cudaMemPoolDestroy(cymemPool) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaMemAdvise(devPtr, size_t count, advice not None : cudaMemoryAdvise, int device): - """ Advise about the usage of a given memory range. - - Advise the Unified Memory subsystem about the usage pattern for the - memory range starting at `devPtr` with a size of `count` bytes. The - start address and end address of the memory range will be rounded down - and rounded up respectively to be aligned to CPU page size before the - advice is applied. The memory range must refer to managed memory - allocated via :py:obj:`~.cudaMallocManaged` or declared via managed - variables. The memory range could also refer to system-allocated - pageable memory provided it represents a valid, host-accessible region - of memory and all additional constraints imposed by `advice` as - outlined below are also satisfied. Specifying an invalid system- - allocated pageable memory range results in an error being returned. +def cudaMemGetDefaultMemPool(location : Optional[cudaMemLocation], typename not None : cudaMemAllocationType): + """ Returns the default memory pool for a given location and allocation type. - The `advice` parameter can take the following values: - - - :py:obj:`~.cudaMemAdviseSetReadMostly`: This implies that the data is - mostly going to be read from and only occasionally written to. Any - read accesses from any processor to this region will create a read- - only copy of at least the accessed pages in that processor's memory. - Additionally, if :py:obj:`~.cudaMemPrefetchAsync` is called on this - region, it will create a read-only copy of the data on the - destination processor. If any processor writes to this region, all - copies of the corresponding page will be invalidated except for the - one where the write occurred. The `device` argument is ignored for - this advice. Note that for a page to be read-duplicated, the - accessing processor must either be the CPU or a GPU that has a non- - zero value for the device attribute - :py:obj:`~.cudaDevAttrConcurrentManagedAccess`. Also, if a context is - created on a device that does not have the device attribute - :py:obj:`~.cudaDevAttrConcurrentManagedAccess` set, then read- - duplication will not occur until all such contexts are destroyed. If - the memory region refers to valid system-allocated pageable memory, - then the accessing device must have a non-zero value for the device - attribute :py:obj:`~.cudaDevAttrPageableMemoryAccess` for a read-only - copy to be created on that device. Note however that if the accessing - device also has a non-zero value for the device attribute - :py:obj:`~.cudaDevAttrPageableMemoryAccessUsesHostPageTables`, then - setting this advice will not create a read-only copy when that device - accesses this memory region. + The memory location can be of one of + :py:obj:`~.cudaMemLocationTypeDevice`, + :py:obj:`~.cudaMemLocationTypeHost`, or + :py:obj:`~.cudaMemLocationTypeHostNuma`. The allocation type can be one + of :py:obj:`~.cudaMemAllocationTypePinned` or + :py:obj:`~.cudaMemAllocationTypeManaged`. When the allocation type is + :py:obj:`~.cudaMemAllocationTypeManaged`, the location type can also be + :py:obj:`~.cudaMemLocationTypeNone` to indicate no preferred location + for the managed memory pool. In all other cases, the call return + :py:obj:`~.cudaErrorInvalidValue` - - :py:obj:`~.cudaMemAdviceUnsetReadMostly`: Undoes the effect of - :py:obj:`~.cudaMemAdviceReadMostly` and also prevents the Unified - Memory driver from attempting heuristic read-duplication on the - memory range. Any read-duplicated copies of the data will be - collapsed into a single copy. The location for the collapsed copy - will be the preferred location if the page has a preferred location - and one of the read-duplicated copies was resident at that location. - Otherwise, the location chosen is arbitrary. + Parameters + ---------- + location : :py:obj:`~.cudaMemLocation` + None + typename : :py:obj:`~.cudaMemAllocationType` + None - - :py:obj:`~.cudaMemAdviseSetPreferredLocation`: This advice sets the - preferred location for the data to be the memory belonging to - `device`. Passing in cudaCpuDeviceId for `device` sets the preferred - location as host memory. If `device` is a GPU, then it must have a - non-zero value for the device attribute - :py:obj:`~.cudaDevAttrConcurrentManagedAccess`. Setting the preferred - location does not cause data to migrate to that location immediately. - Instead, it guides the migration policy when a fault occurs on that - memory region. If the data is already in its preferred location and - the faulting processor can establish a mapping without requiring the - data to be migrated, then data migration will be avoided. On the - other hand, if the data is not in its preferred location or if a - direct mapping cannot be established, then it will be migrated to the - processor accessing it. It is important to note that setting the - preferred location does not prevent data prefetching done using - :py:obj:`~.cudaMemPrefetchAsync`. Having a preferred location can - override the page thrash detection and resolution logic in the - Unified Memory driver. Normally, if a page is detected to be - constantly thrashing between for example host and device memory, the - page may eventually be pinned to host memory by the Unified Memory - driver. But if the preferred location is set as device memory, then - the page will continue to thrash indefinitely. If - :py:obj:`~.cudaMemAdviseSetReadMostly` is also set on this memory - region or any subset of it, then the policies associated with that - advice will override the policies of this advice, unless read - accesses from `device` will not result in a read-only copy being - created on that device as outlined in description for the advice - :py:obj:`~.cudaMemAdviseSetReadMostly`. If the memory region refers - to valid system-allocated pageable memory, then `device` must have a - non-zero value for the device attribute - :py:obj:`~.cudaDevAttrPageableMemoryAccess`. + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorNotSupported`, + memPool : :py:obj:`~.cudaMemPool_t` + None - - :py:obj:`~.cudaMemAdviseUnsetPreferredLocation`: Undoes the effect of - :py:obj:`~.cudaMemAdviseSetPreferredLocation` and changes the - preferred location to none. + See Also + -------- + :py:obj:`~.cuMemAllocAsync`, :py:obj:`~.cuMemPoolTrimTo`, :py:obj:`~.cuMemPoolGetAttribute`, :py:obj:`~.cuMemPoolSetAttribute`, cuMemPoolSetAccess, :py:obj:`~.cuMemGetMemPool`, :py:obj:`~.cuMemPoolCreate` + """ + cdef cudaMemPool_t memPool = cudaMemPool_t() + cdef cyruntime.cudaMemLocation* cylocation_ptr = location._pvt_ptr if location is not None else NULL + cdef cyruntime.cudaMemAllocationType cytypename = int(typename) + with nogil: + err = cyruntime.cudaMemGetDefaultMemPool(memPool._pvt_ptr, cylocation_ptr, cytypename) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, memPool) - - :py:obj:`~.cudaMemAdviseSetAccessedBy`: This advice implies that the - data will be accessed by `device`. Passing in - :py:obj:`~.cudaCpuDeviceId` for `device` will set the advice for the - CPU. If `device` is a GPU, then the device attribute - :py:obj:`~.cudaDevAttrConcurrentManagedAccess` must be non-zero. This - advice does not cause data migration and has no impact on the - location of the data per se. Instead, it causes the data to always be - mapped in the specified processor's page tables, as long as the - location of the data permits a mapping to be established. If the data - gets migrated for any reason, the mappings are updated accordingly. - This advice is recommended in scenarios where data locality is not - important, but avoiding faults is. Consider for example a system - containing multiple GPUs with peer-to-peer access enabled, where the - data located on one GPU is occasionally accessed by peer GPUs. In - such scenarios, migrating data over to the other GPUs is not as - important because the accesses are infrequent and the overhead of - migration may be too high. But preventing faults can still help - improve performance, and so having a mapping set up in advance is - useful. Note that on CPU access of this data, the data may be - migrated to host memory because the CPU typically cannot access - device memory directly. Any GPU that had the - :py:obj:`~.cudaMemAdviceSetAccessedBy` flag set for this data will - now have its mapping updated to point to the page in host memory. If - :py:obj:`~.cudaMemAdviseSetReadMostly` is also set on this memory - region or any subset of it, then the policies associated with that - advice will override the policies of this advice. Additionally, if - the preferred location of this memory region or any subset of it is - also `device`, then the policies associated with - :py:obj:`~.cudaMemAdviseSetPreferredLocation` will override the - policies of this advice. If the memory region refers to valid system- - allocated pageable memory, then `device` must have a non-zero value - for the device attribute :py:obj:`~.cudaDevAttrPageableMemoryAccess`. - Additionally, if `device` has a non-zero value for the device - attribute - :py:obj:`~.cudaDevAttrPageableMemoryAccessUsesHostPageTables`, then - this call has no effect. +@cython.embedsignature(True) +def cudaMemGetMemPool(location : Optional[cudaMemLocation], typename not None : cudaMemAllocationType): + """ Gets the current memory pool for a given memory location and allocation type. - - :py:obj:`~.cudaMemAdviseUnsetAccessedBy`: Undoes the effect of - :py:obj:`~.cudaMemAdviseSetAccessedBy`. Any mappings to the data from - `device` may be removed at any time causing accesses to result in - non-fatal page faults. If the memory region refers to valid system- - allocated pageable memory, then `device` must have a non-zero value - for the device attribute :py:obj:`~.cudaDevAttrPageableMemoryAccess`. - Additionally, if `device` has a non-zero value for the device - attribute - :py:obj:`~.cudaDevAttrPageableMemoryAccessUsesHostPageTables`, then - this call has no effect. + The memory location can be of one of + :py:obj:`~.cudaMemLocationTypeDevice`, + :py:obj:`~.cudaMemLocationTypeHost`, or + :py:obj:`~.cudaMemLocationTypeHostNuma`. The allocation type can be one + of :py:obj:`~.cudaMemAllocationTypePinned` or + :py:obj:`~.cudaMemAllocationTypeManaged`. When the allocation type is + :py:obj:`~.cudaMemAllocationTypeManaged`, the location type can also be + :py:obj:`~.cudaMemLocationTypeNone` to indicate no preferred location + for the managed memory pool. In all other cases, the call return + :py:obj:`~.cudaErrorInvalidValue` + + Returns the last pool provided to :py:obj:`~.cudaMemSetMemPool` or + :py:obj:`~.cudaDeviceSetMemPool` for this location and allocation type + or the location's default memory pool if :py:obj:`~.cudaMemSetMemPool` + or :py:obj:`~.cudaDeviceSetMemPool` for that allocType and location has + never been called. By default the current mempool of a location is the + default mempool for a device that can be obtained via + cudaMemGetDefaultMemPool Otherwise the returned pool must have been set + with :py:obj:`~.cudaDeviceSetMemPool`. Parameters ---------- - devPtr : Any - Pointer to memory to set the advice for - count : size_t - Size in bytes of the memory range - advice : :py:obj:`~.cudaMemoryAdvise` - Advice to be applied for the specified memory range - device : int - Device to apply the advice for + location : :py:obj:`~.cudaMemLocation` + None + typename : :py:obj:`~.cudaMemAllocationType` + None Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidDevice` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + memPool : :py:obj:`~.cudaMemPool_t` + None See Also -------- - :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpyPeer`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpy3DPeerAsync`, :py:obj:`~.cudaMemPrefetchAsync`, :py:obj:`~.cuMemAdvise` + :py:obj:`~.cuDeviceGetDefaultMemPool`, :py:obj:`~.cuMemPoolCreate`, :py:obj:`~.cuDeviceSetMemPool`, :py:obj:`~.cuMemSetMemPool` """ - cdevPtr = utils.HelperInputVoidPtr(devPtr) - cdef void* cdevPtr_ptr = cdevPtr.cptr - cdef ccudart.cudaMemoryAdvise cadvice = advice.value + cdef cudaMemPool_t memPool = cudaMemPool_t() + cdef cyruntime.cudaMemLocation* cylocation_ptr = location._pvt_ptr if location is not None else NULL + cdef cyruntime.cudaMemAllocationType cytypename = int(typename) with nogil: - err = ccudart.cudaMemAdvise(cdevPtr_ptr, count, cadvice, device) + err = cyruntime.cudaMemGetMemPool(memPool._pvt_ptr, cylocation_ptr, cytypename) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, memPool) + +@cython.embedsignature(True) +def cudaMemSetMemPool(location : Optional[cudaMemLocation], typename not None : cudaMemAllocationType, memPool): + """ Sets the current memory pool for a memory location and allocation type. + + The memory location can be of one of + :py:obj:`~.cudaMemLocationTypeDevice`, + :py:obj:`~.cudaMemLocationTypeHost` or + :py:obj:`~.cudaMemLocationTypeHostNuma`. The allocation type can be one + of :py:obj:`~.cudaMemAllocationTypePinned` or + :py:obj:`~.cudaMemAllocationTypeManaged`. When the allocation type is + :py:obj:`~.cudaMemAllocationTypeManaged`, the location type can also be + :py:obj:`~.cudaMemLocationTypeNone` to indicate no preferred location + for the managed memory pool. In all other cases, the call return + :py:obj:`~.cudaErrorInvalidValue` + + When a memory pool is set as the current memory pool, the location + parameter should be the same as the location of the pool. If the + location type or index don't match, the call returns + :py:obj:`~.cudaErrorInvalidValue`. The type of memory pool should also + match the parameter allocType. Else the call returns + :py:obj:`~.cudaErrorInvalidValue`. By default, a memory location's + current memory pool is its default memory pool. If the location type is + :py:obj:`~.cudaMemLocationTypeDevice` and the allocation type is + :py:obj:`~.cudaMemAllocationTypePinned`, then this API is the + equivalent of calling :py:obj:`~.cudaDeviceSetMemPool` with the + location id as the device. For further details on the implications, + please refer to the documentation for :py:obj:`~.cudaDeviceSetMemPool`. - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaMemAdvise_v2' in found_functions}} + Parameters + ---------- + location : :py:obj:`~.cudaMemLocation` + None + typename : :py:obj:`~.cudaMemAllocationType` + None + memPool : :py:obj:`~.CUmemoryPool` or :py:obj:`~.cudaMemPool_t` + None -@cython.embedsignature(True) -def cudaMemAdvise_v2(devPtr, size_t count, advice not None : cudaMemoryAdvise, location not None : cudaMemLocation): - """ Advise about the usage of a given memory range. + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` - Advise the Unified Memory subsystem about the usage pattern for the - memory range starting at `devPtr` with a size of `count` bytes. The - start address and end address of the memory range will be rounded down - and rounded up respectively to be aligned to CPU page size before the - advice is applied. The memory range must refer to managed memory - allocated via :py:obj:`~.cudaMemAllocManaged` or declared via managed - variables. The memory range could also refer to system-allocated - pageable memory provided it represents a valid, host-accessible region - of memory and all additional constraints imposed by `advice` as - outlined below are also satisfied. Specifying an invalid system- - allocated pageable memory range results in an error being returned. + See Also + -------- + :py:obj:`~.cuDeviceGetDefaultMemPool`, :py:obj:`~.cuDeviceGetMemPool`, :py:obj:`~.cuMemGetMemPool`, :py:obj:`~.cuMemPoolCreate`, :py:obj:`~.cuMemPoolDestroy`, :py:obj:`~.cuMemAllocFromPoolAsync` - The `advice` parameter can take the following values: + Notes + ----- + Use :py:obj:`~.cudaMallocFromPoolAsync` to specify asynchronous allocations from a device different than the one the stream runs on. + """ + cdef cyruntime.cudaMemPool_t cymemPool + if memPool is None: + pmemPool = 0 + elif isinstance(memPool, (cudaMemPool_t,driver.CUmemoryPool)): + pmemPool = int(memPool) + else: + pmemPool = int(cudaMemPool_t(memPool)) + cymemPool = pmemPool + cdef cyruntime.cudaMemLocation* cylocation_ptr = location._pvt_ptr if location is not None else NULL + cdef cyruntime.cudaMemAllocationType cytypename = int(typename) + with nogil: + err = cyruntime.cudaMemSetMemPool(cylocation_ptr, cytypename, cymemPool) + return (_cudaError_t(err),) - - :py:obj:`~.cudaMemAdviseSetReadMostly`: This implies that the data is - mostly going to be read from and only occasionally written to. Any - read accesses from any processor to this region will create a read- - only copy of at least the accessed pages in that processor's memory. - Additionally, if :py:obj:`~.cudaMemPrefetchAsync` or - :py:obj:`~.cudaMemPrefetchAsync_v2` is called on this region, it will - create a read-only copy of the data on the destination processor. If - the target location for :py:obj:`~.cudaMemPrefetchAsync_v2` is a host - NUMA node and a read-only copy already exists on another host NUMA - node, that copy will be migrated to the targeted host NUMA node. If - any processor writes to this region, all copies of the corresponding - page will be invalidated except for the one where the write occurred. - If the writing processor is the CPU and the preferred location of the - page is a host NUMA node, then the page will also be migrated to that - host NUMA node. The `location` argument is ignored for this advice. - Note that for a page to be read-duplicated, the accessing processor - must either be the CPU or a GPU that has a non-zero value for the - device attribute :py:obj:`~.cudaDevAttrConcurrentManagedAccess`. - Also, if a context is created on a device that does not have the - device attribute :py:obj:`~.cudaDevAttrConcurrentManagedAccess` set, - then read-duplication will not occur until all such contexts are - destroyed. If the memory region refers to valid system-allocated - pageable memory, then the accessing device must have a non-zero value - for the device attribute :py:obj:`~.cudaDevAttrPageableMemoryAccess` - for a read-only copy to be created on that device. Note however that - if the accessing device also has a non-zero value for the device - attribute - :py:obj:`~.cudaDevAttrPageableMemoryAccessUsesHostPageTables`, then - setting this advice will not create a read-only copy when that device - accesses this memory region. +@cython.embedsignature(True) +def cudaMallocFromPoolAsync(size_t size, memPool, stream): + """ Allocates memory from a specified pool with stream ordered semantics. - - :py:obj:`~.cudaMemAdviceUnsetReadMostly`: Undoes the effect of - :py:obj:`~.cudaMemAdviseSetReadMostly` and also prevents the Unified - Memory driver from attempting heuristic read-duplication on the - memory range. Any read-duplicated copies of the data will be - collapsed into a single copy. The location for the collapsed copy - will be the preferred location if the page has a preferred location - and one of the read-duplicated copies was resident at that location. - Otherwise, the location chosen is arbitrary. Note: The `location` - argument is ignored for this advice. + Inserts an allocation operation into `hStream`. A pointer to the + allocated memory is returned immediately in *dptr. The allocation must + not be accessed until the the allocation operation completes. The + allocation comes from the specified memory pool. - - :py:obj:`~.cudaMemAdviseSetPreferredLocation`: This advice sets the - preferred location for the data to be the memory belonging to - `location`. When :py:obj:`~.cudaMemLocation.type` is - :py:obj:`~.cudaMemLocationTypeHost`, :py:obj:`~.cudaMemLocation.id` - is ignored and the preferred location is set to be host memory. To - set the preferred location to a specific host NUMA node, applications - must set :py:obj:`~.cudaMemLocation.type` to - :py:obj:`~.cudaMemLocationTypeHostNuma` and - :py:obj:`~.cudaMemLocation.id` must specify the NUMA ID of the host - NUMA node. If :py:obj:`~.cudaMemLocation.type` is set to - :py:obj:`~.cudaMemLocationTypeHostNumaCurrent`, - :py:obj:`~.cudaMemLocation.id` will be ignored and the host NUMA node - closest to the calling thread's CPU will be used as the preferred - location. If :py:obj:`~.cudaMemLocation.type` is a - :py:obj:`~.cudaMemLocationTypeDevice`, then - :py:obj:`~.cudaMemLocation.id` must be a valid device ordinal and the - device must have a non-zero value for the device attribute - :py:obj:`~.cudaDevAttrConcurrentManagedAccess`. Setting the preferred - location does not cause data to migrate to that location immediately. - Instead, it guides the migration policy when a fault occurs on that - memory region. If the data is already in its preferred location and - the faulting processor can establish a mapping without requiring the - data to be migrated, then data migration will be avoided. On the - other hand, if the data is not in its preferred location or if a - direct mapping cannot be established, then it will be migrated to the - processor accessing it. It is important to note that setting the - preferred location does not prevent data prefetching done using - :py:obj:`~.cudaMemPrefetchAsync`. Having a preferred location can - override the page thrash detection and resolution logic in the - Unified Memory driver. Normally, if a page is detected to be - constantly thrashing between for example host and device memory, the - page may eventually be pinned to host memory by the Unified Memory - driver. But if the preferred location is set as device memory, then - the page will continue to thrash indefinitely. If - :py:obj:`~.cudaMemAdviseSetReadMostly` is also set on this memory - region or any subset of it, then the policies associated with that - advice will override the policies of this advice, unless read - accesses from `location` will not result in a read-only copy being - created on that procesor as outlined in description for the advice - :py:obj:`~.cudaMemAdviseSetReadMostly`. If the memory region refers - to valid system-allocated pageable memory, and - :py:obj:`~.cudaMemLocation.type` is - :py:obj:`~.cudaMemLocationTypeDevice` then - :py:obj:`~.cudaMemLocation.id` must be a valid device that has a non- - zero alue for the device attribute - :py:obj:`~.cudaDevAttrPageableMemoryAccess`. + Parameters + ---------- + bytesize : size_t + Number of bytes to allocate + memPool : :py:obj:`~.CUmemoryPool` or :py:obj:`~.cudaMemPool_t` + The pool to allocate from + stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + The stream establishing the stream ordering semantic - - :py:obj:`~.cudaMemAdviseUnsetPreferredLocation`: Undoes the effect of - :py:obj:`~.cudaMemAdviseSetPreferredLocation` and changes the - preferred location to none. The `location` argument is ignored for - this advice. + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorNotSupported`, :py:obj:`~.cudaErrorOutOfMemory` + ptr : Any + Returned device pointer - - :py:obj:`~.cudaMemAdviseSetAccessedBy`: This advice implies that the - data will be accessed by processor `location`. The - :py:obj:`~.cudaMemLocation.type` must be either - :py:obj:`~.cudaMemLocationTypeDevice` with - :py:obj:`~.cudaMemLocation.id` representing a valid device ordinal or - :py:obj:`~.cudaMemLocationTypeHost` and - :py:obj:`~.cudaMemLocation.id` will be ignored. All other location - types are invalid. If :py:obj:`~.cudaMemLocation.id` is a GPU, then - the device attribute :py:obj:`~.cudaDevAttrConcurrentManagedAccess` - must be non-zero. This advice does not cause data migration and has - no impact on the location of the data per se. Instead, it causes the - data to always be mapped in the specified processor's page tables, as - long as the location of the data permits a mapping to be established. - If the data gets migrated for any reason, the mappings are updated - accordingly. This advice is recommended in scenarios where data - locality is not important, but avoiding faults is. Consider for - example a system containing multiple GPUs with peer-to-peer access - enabled, where the data located on one GPU is occasionally accessed - by peer GPUs. In such scenarios, migrating data over to the other - GPUs is not as important because the accesses are infrequent and the - overhead of migration may be too high. But preventing faults can - still help improve performance, and so having a mapping set up in - advance is useful. Note that on CPU access of this data, the data may - be migrated to host memory because the CPU typically cannot access - device memory directly. Any GPU that had the - :py:obj:`~.cudaMemAdviseSetAccessedBy` flag set for this data will - now have its mapping updated to point to the page in host memory. If - :py:obj:`~.cudaMemAdviseSetReadMostly` is also set on this memory - region or any subset of it, then the policies associated with that - advice will override the policies of this advice. Additionally, if - the preferred location of this memory region or any subset of it is - also `location`, then the policies associated with - :py:obj:`~.CU_MEM_ADVISE_SET_PREFERRED_LOCATION` will override the - policies of this advice. If the memory region refers to valid system- - allocated pageable memory, and :py:obj:`~.cudaMemLocation.type` is - :py:obj:`~.cudaMemLocationTypeDevice` then device in - :py:obj:`~.cudaMemLocation.id` must have a non-zero value for the - device attribute :py:obj:`~.cudaDevAttrPageableMemoryAccess`. - Additionally, if :py:obj:`~.cudaMemLocation.id` has a non-zero value - for the device attribute - :py:obj:`~.cudaDevAttrPageableMemoryAccessUsesHostPageTables`, then - this call has no effect. + See Also + -------- + :py:obj:`~.cuMemAllocFromPoolAsync`, cudaMallocAsync (C++ API), :py:obj:`~.cudaMallocAsync`, :py:obj:`~.cudaFreeAsync`, :py:obj:`~.cudaDeviceGetDefaultMemPool`, :py:obj:`~.cudaMemPoolCreate`, :py:obj:`~.cudaMemPoolSetAccess`, :py:obj:`~.cudaMemPoolSetAttribute` - - :py:obj:`~.CU_MEM_ADVISE_UNSET_ACCESSED_BY`: Undoes the effect of - :py:obj:`~.cudaMemAdviseSetAccessedBy`. Any mappings to the data from - `location` may be removed at any time causing accesses to result in - non-fatal page faults. If the memory region refers to valid system- - allocated pageable memory, and :py:obj:`~.cudaMemLocation.type` is - :py:obj:`~.cudaMemLocationTypeDevice` then device in - :py:obj:`~.cudaMemLocation.id` must have a non-zero value for the - device attribute :py:obj:`~.cudaDevAttrPageableMemoryAccess`. - Additionally, if :py:obj:`~.cudaMemLocation.id` has a non-zero value - for the device attribute - :py:obj:`~.cudaDevAttrPageableMemoryAccessUsesHostPageTables`, then - this call has no effect. + Notes + ----- + During stream capture, this function results in the creation of an allocation node. In this case, the allocation is owned by the graph instead of the memory pool. The memory pool's properties are used to set the node's creation parameters. + """ + cdef cyruntime.cudaStream_t cystream + if stream is None: + pstream = 0 + elif isinstance(stream, (cudaStream_t,driver.CUstream)): + pstream = int(stream) + else: + pstream = int(cudaStream_t(stream)) + cystream = pstream + cdef cyruntime.cudaMemPool_t cymemPool + if memPool is None: + pmemPool = 0 + elif isinstance(memPool, (cudaMemPool_t,driver.CUmemoryPool)): + pmemPool = int(memPool) + else: + pmemPool = int(cudaMemPool_t(memPool)) + cymemPool = pmemPool + cdef void_ptr ptr = 0 + with nogil: + err = cyruntime.cudaMallocFromPoolAsync(&ptr, size, cymemPool, cystream) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, ptr) + +@cython.embedsignature(True) +def cudaMemPoolExportToShareableHandle(memPool, handleType not None : cudaMemAllocationHandleType, unsigned int flags): + """ Exports a memory pool to the requested handle type. + + Given an IPC capable mempool, create an OS handle to share the pool + with another process. A recipient process can convert the shareable + handle into a mempool with + :py:obj:`~.cudaMemPoolImportFromShareableHandle`. Individual pointers + can then be shared with the :py:obj:`~.cudaMemPoolExportPointer` and + :py:obj:`~.cudaMemPoolImportPointer` APIs. The implementation of what + the shareable handle is and how it can be transferred is defined by the + requested handle type. Parameters ---------- - devPtr : Any - Pointer to memory to set the advice for - count : size_t - Size in bytes of the memory range - advice : :py:obj:`~.cudaMemoryAdvise` - Advice to be applied for the specified memory range - location : :py:obj:`~.cudaMemLocation` - location to apply the advice for + pool : :py:obj:`~.CUmemoryPool` or :py:obj:`~.cudaMemPool_t` + pool to export + handleType : :py:obj:`~.cudaMemAllocationHandleType` + the type of handle to create + flags : unsigned int + must be 0 Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidDevice` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorOutOfMemory` + handle_out : Any + pointer to the location in which to store the requested handle See Also -------- - :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpyPeer`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpy3DPeerAsync`, :py:obj:`~.cudaMemPrefetchAsync`, :py:obj:`~.cuMemAdvise`, :py:obj:`~.cuMemAdvise_v2` + :py:obj:`~.cuMemPoolExportToShareableHandle`, :py:obj:`~.cudaMemPoolImportFromShareableHandle`, :py:obj:`~.cudaMemPoolExportPointer`, :py:obj:`~.cudaMemPoolImportPointer` + + Notes + ----- + : To create an IPC capable mempool, create a mempool with a CUmemAllocationHandleType other than cudaMemHandleTypeNone. """ - cdevPtr = utils.HelperInputVoidPtr(devPtr) - cdef void* cdevPtr_ptr = cdevPtr.cptr - cdef ccudart.cudaMemoryAdvise cadvice = advice.value + cdef cyruntime.cudaMemPool_t cymemPool + if memPool is None: + pmemPool = 0 + elif isinstance(memPool, (cudaMemPool_t,driver.CUmemoryPool)): + pmemPool = int(memPool) + else: + pmemPool = int(cudaMemPool_t(memPool)) + cymemPool = pmemPool + cdef _HelperCUmemAllocationHandleType cyshareableHandle = _HelperCUmemAllocationHandleType(handleType) + cdef void* cyshareableHandle_ptr = cyshareableHandle.cptr + cdef cyruntime.cudaMemAllocationHandleType cyhandleType = int(handleType) with nogil: - err = ccudart.cudaMemAdvise_v2(cdevPtr_ptr, count, cadvice, location._ptr[0]) - - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaMemRangeGetAttribute' in found_functions}} + err = cyruntime.cudaMemPoolExportToShareableHandle(cyshareableHandle_ptr, cymemPool, cyhandleType, flags) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, cyshareableHandle.pyObj()) @cython.embedsignature(True) -def cudaMemRangeGetAttribute(size_t dataSize, attribute not None : cudaMemRangeAttribute, devPtr, size_t count): - """ Query an attribute of a given memory range. +def cudaMemPoolImportFromShareableHandle(shareableHandle, handleType not None : cudaMemAllocationHandleType, unsigned int flags): + """ imports a memory pool from a shared handle. - Query an attribute about the memory range starting at `devPtr` with a - size of `count` bytes. The memory range must refer to managed memory - allocated via :py:obj:`~.cudaMallocManaged` or declared via managed - variables. + Specific allocations can be imported from the imported pool with + :py:obj:`~.cudaMemPoolImportPointer`. - The `attribute` parameter can take the following values: + Parameters + ---------- + handle : Any + OS handle of the pool to open + handleType : :py:obj:`~.cudaMemAllocationHandleType` + The type of handle being imported + flags : unsigned int + must be 0 - - :py:obj:`~.cudaMemRangeAttributeReadMostly`: If this attribute is - specified, `data` will be interpreted as a 32-bit integer, and - `dataSize` must be 4. The result returned will be 1 if all pages in - the given memory range have read-duplication enabled, or 0 otherwise. + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorOutOfMemory` + pool_out : :py:obj:`~.cudaMemPool_t` + Returned memory pool - - :py:obj:`~.cudaMemRangeAttributePreferredLocation`: If this attribute - is specified, `data` will be interpreted as a 32-bit integer, and - `dataSize` must be 4. The result returned will be a GPU device id if - all pages in the memory range have that GPU as their preferred - location, or it will be cudaCpuDeviceId if all pages in the memory - range have the CPU as their preferred location, or it will be - cudaInvalidDeviceId if either all the pages don't have the same - preferred location or some of the pages don't have a preferred - location at all. Note that the actual location of the pages in the - memory range at the time of the query may be different from the - preferred location. + See Also + -------- + :py:obj:`~.cuMemPoolImportFromShareableHandle`, :py:obj:`~.cudaMemPoolExportToShareableHandle`, :py:obj:`~.cudaMemPoolExportPointer`, :py:obj:`~.cudaMemPoolImportPointer` - - :py:obj:`~.cudaMemRangeAttributeAccessedBy`: If this attribute is - specified, `data` will be interpreted as an array of 32-bit integers, - and `dataSize` must be a non-zero multiple of 4. The result returned - will be a list of device ids that had - :py:obj:`~.cudaMemAdviceSetAccessedBy` set for that entire memory - range. If any device does not have that advice set for the entire - memory range, that device will not be included. If `data` is larger - than the number of devices that have that advice set for that memory - range, cudaInvalidDeviceId will be returned in all the extra space - provided. For ex., if `dataSize` is 12 (i.e. `data` has 3 elements) - and only device 0 has the advice set, then the result returned will - be { 0, cudaInvalidDeviceId, cudaInvalidDeviceId }. If `data` is - smaller than the number of devices that have that advice set, then - only as many devices will be returned as can fit in the array. There - is no guarantee on which specific devices will be returned, however. + Notes + ----- + Imported memory pools do not support creating new allocations. As such imported memory pools may not be used in :py:obj:`~.cudaDeviceSetMemPool` or :py:obj:`~.cudaMallocFromPoolAsync` calls. + """ + cdef cudaMemPool_t memPool = cudaMemPool_t() + cdef _HelperInputVoidPtrStruct cyshareableHandleHelper + cdef void* cyshareableHandle = _helper_input_void_ptr(shareableHandle, &cyshareableHandleHelper) + cdef cyruntime.cudaMemAllocationHandleType cyhandleType = int(handleType) + with nogil: + err = cyruntime.cudaMemPoolImportFromShareableHandle(memPool._pvt_ptr, cyshareableHandle, cyhandleType, flags) + _helper_input_void_ptr_free(&cyshareableHandleHelper) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, memPool) - - :py:obj:`~.cudaMemRangeAttributeLastPrefetchLocation`: If this - attribute is specified, `data` will be interpreted as a 32-bit - integer, and `dataSize` must be 4. The result returned will be the - last location to which all pages in the memory range were prefetched - explicitly via :py:obj:`~.cudaMemPrefetchAsync`. This will either be - a GPU id or cudaCpuDeviceId depending on whether the last location - for prefetch was a GPU or the CPU respectively. If any page in the - memory range was never explicitly prefetched or if all pages were not - prefetched to the same location, cudaInvalidDeviceId will be - returned. Note that this simply returns the last location that the - applicaton requested to prefetch the memory range to. It gives no - indication as to whether the prefetch operation to that location has - completed or even begun. +@cython.embedsignature(True) +def cudaMemPoolExportPointer(ptr): + """ Export data to share a memory pool allocation between processes. - - :py:obj:`~.cudaMemRangeAttributePreferredLocationType`: If this - attribute is specified, `data` will be interpreted as a - :py:obj:`~.cudaMemLocationType`, and `dataSize` must be - sizeof(cudaMemLocationType). The :py:obj:`~.cudaMemLocationType` - returned will be :py:obj:`~.cudaMemLocationTypeDevice` if all pages - in the memory range have the same GPU as their preferred location, - or :py:obj:`~.cudaMemLocationType` will be - :py:obj:`~.cudaMemLocationTypeHost` if all pages in the memory - range have the CPU as their preferred location, or or it will be - :py:obj:`~.cudaMemLocationTypeHostNuma` if all the pages in the - memory range have the same host NUMA node ID as their preferred - location or it will be :py:obj:`~.cudaMemLocationTypeInvalid` if - either all the pages don't have the same preferred location or some - of the pages don't have a preferred location at all. Note that the - actual location type of the pages in the memory range at the time - of the query may be different from the preferred location type. - - - :py:obj:`~.cudaMemRangeAttributePreferredLocationId`: If this - attribute is specified, `data` will be interpreted as a 32-bit integer, - and `dataSize` must be 4. If the - :py:obj:`~.cudaMemRangeAttributePreferredLocationType` query for the - same address range returns :py:obj:`~.cudaMemLocationTypeDevice`, it - will be a valid device ordinal or if it returns - :py:obj:`~.cudaMemLocationTypeHostNuma`, it will be a valid host NUMA - node ID or if it returns any other location type, the id should be - ignored. - - - :py:obj:`~.cudaMemRangeAttributeLastPrefetchLocationType`: If this - attribute is specified, `data` will be interpreted as a - :py:obj:`~.cudaMemLocationType`, and `dataSize` must be - sizeof(cudaMemLocationType). The result returned will be the last - location type to which all pages in the memory range were - prefetched explicitly via :py:obj:`~.cuMemPrefetchAsync`. The - :py:obj:`~.cudaMemLocationType` returned will be - :py:obj:`~.cudaMemLocationTypeDevice` if the last prefetch location - was the GPU or :py:obj:`~.cudaMemLocationTypeHost` if it was the - CPU or :py:obj:`~.cudaMemLocationTypeHostNuma` if the last prefetch - location was a specific host NUMA node. If any page in the memory - range was never explicitly prefetched or if all pages were not - prefetched to the same location, :py:obj:`~.CUmemLocationType` will - be :py:obj:`~.cudaMemLocationTypeInvalid`. Note that this simply - returns the last location type that the application requested to - prefetch the memory range to. It gives no indication as to whether - the prefetch operation to that location has completed or even - begun. - - - :py:obj:`~.cudaMemRangeAttributeLastPrefetchLocationId`: If this - attribute is specified, `data` will be interpreted as a 32-bit integer, - and `dataSize` must be 4. If the - :py:obj:`~.cudaMemRangeAttributeLastPrefetchLocationType` query for the - same address range returns :py:obj:`~.cudaMemLocationTypeDevice`, it - will be a valid device ordinal or if it returns - :py:obj:`~.cudaMemLocationTypeHostNuma`, it will be a valid host NUMA - node ID or if it returns any other location type, the id should be - ignored. + Constructs `shareData_out` for sharing a specific allocation from an + already shared memory pool. The recipient process can import the + allocation with the :py:obj:`~.cudaMemPoolImportPointer` api. The data + is not a handle and may be shared through any IPC mechanism. Parameters ---------- - dataSize : size_t - Array containing the size of data - attribute : :py:obj:`~.cudaMemRangeAttribute` - The attribute to query - devPtr : Any - Start of the range to query - count : size_t - Size of the range to query + ptr : Any + pointer to memory being exported Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` - data : Any - A pointers to a memory location where the result of each attribute - query will be written to. + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorOutOfMemory` + shareData_out : :py:obj:`~.cudaMemPoolPtrExportData` + Returned export data See Also -------- - :py:obj:`~.cudaMemRangeGetAttributes`, :py:obj:`~.cudaMemPrefetchAsync`, :py:obj:`~.cudaMemAdvise`, :py:obj:`~.cuMemRangeGetAttribute` + :py:obj:`~.cuMemPoolExportPointer`, :py:obj:`~.cudaMemPoolExportToShareableHandle`, :py:obj:`~.cudaMemPoolImportFromShareableHandle`, :py:obj:`~.cudaMemPoolImportPointer` """ - cdef utils.HelperCUmem_range_attribute cdata = utils.HelperCUmem_range_attribute(attribute, dataSize) - cdef void* cdata_ptr = cdata.cptr - cdef ccudart.cudaMemRangeAttribute cattribute = attribute.value - cdevPtr = utils.HelperInputVoidPtr(devPtr) - cdef void* cdevPtr_ptr = cdevPtr.cptr - err = ccudart.cudaMemRangeGetAttribute(cdata_ptr, dataSize, cattribute, cdevPtr_ptr, count) - return (cudaError_t(err), cdata.pyObj()) -{{endif}} - -{{if 'cudaMemRangeGetAttributes' in found_functions}} + cdef cudaMemPoolPtrExportData exportData = cudaMemPoolPtrExportData() + cdef _HelperInputVoidPtrStruct cyptrHelper + cdef void* cyptr = _helper_input_void_ptr(ptr, &cyptrHelper) + with nogil: + err = cyruntime.cudaMemPoolExportPointer(exportData._pvt_ptr, cyptr) + _helper_input_void_ptr_free(&cyptrHelper) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, exportData) @cython.embedsignature(True) -def cudaMemRangeGetAttributes(dataSizes : List[int], attributes : Optional[List[cudaMemRangeAttribute]], size_t numAttributes, devPtr, size_t count): - """ Query attributes of a given memory range. - - Query attributes of the memory range starting at `devPtr` with a size - of `count` bytes. The memory range must refer to managed memory - allocated via :py:obj:`~.cudaMallocManaged` or declared via managed - variables. The `attributes` array will be interpreted to have - `numAttributes` entries. The `dataSizes` array will also be interpreted - to have `numAttributes` entries. The results of the query will be - stored in `data`. - - The list of supported attributes are given below. Please refer to - :py:obj:`~.cudaMemRangeGetAttribute` for attribute descriptions and - restrictions. - - - :py:obj:`~.cudaMemRangeAttributeReadMostly` - - - :py:obj:`~.cudaMemRangeAttributePreferredLocation` - - - :py:obj:`~.cudaMemRangeAttributeAccessedBy` - - - :py:obj:`~.cudaMemRangeAttributeLastPrefetchLocation` - - - :: cudaMemRangeAttributePreferredLocationType - - - :: cudaMemRangeAttributePreferredLocationId - - - :: cudaMemRangeAttributeLastPrefetchLocationType +def cudaMemPoolImportPointer(memPool, exportData : Optional[cudaMemPoolPtrExportData]): + """ Import a memory pool allocation from another process. - - :: cudaMemRangeAttributeLastPrefetchLocationId + Returns in `ptr_out` a pointer to the imported memory. The imported + memory must not be accessed before the allocation operation completes + in the exporting process. The imported memory must be freed from all + importing processes before being freed in the exporting process. The + pointer may be freed with cudaFree or cudaFreeAsync. If + :py:obj:`~.cudaFreeAsync` is used, the free must be completed on the + importing process before the free operation on the exporting process. Parameters ---------- - dataSizes : List[int] - Array containing the sizes of each result - attributes : List[:py:obj:`~.cudaMemRangeAttribute`] - An array of attributes to query (numAttributes and the number of - attributes in this array should match) - numAttributes : size_t - Number of attributes to query - devPtr : Any - Start of the range to query - count : size_t - Size of the range to query + pool : :py:obj:`~.CUmemoryPool` or :py:obj:`~.cudaMemPool_t` + pool from which to import + shareData : :py:obj:`~.cudaMemPoolPtrExportData` + data specifying the memory to import Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` - data : List[Any] - A two-dimensional array containing pointers to memory locations - where the result of each attribute query will be written to. + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_OUT_OF_MEMORY` + ptr_out : Any + pointer to imported memory See Also -------- - :py:obj:`~.cudaMemRangeGetAttribute`, :py:obj:`~.cudaMemAdvise`, :py:obj:`~.cudaMemPrefetchAsync`, :py:obj:`~.cuMemRangeGetAttributes` - """ - attributes = [] if attributes is None else attributes - if not all(isinstance(_x, (cudaMemRangeAttribute)) for _x in attributes): - raise TypeError("Argument 'attributes' is not instance of type (expected List[ccudart.cudaMemRangeAttribute]") - if not all(isinstance(_x, (int)) for _x in dataSizes): - raise TypeError("Argument 'dataSizes' is not instance of type (expected List[int]") - pylist = [utils.HelperCUmem_range_attribute(pyattributes, pydataSizes) for (pyattributes, pydataSizes) in zip(attributes, dataSizes)] - cdef utils.InputVoidPtrPtrHelper voidStarHelperdata = utils.InputVoidPtrPtrHelper(pylist) - cdef void** cvoidStarHelper_ptr = voidStarHelperdata.cptr - cdef vector[size_t] cdataSizes = dataSizes - cdef vector[ccudart.cudaMemRangeAttribute] cattributes = [pyattributes.value for pyattributes in (attributes)] - if numAttributes > len(dataSizes): raise RuntimeError("List is too small: " + str(len(dataSizes)) + " < " + str(numAttributes)) - if numAttributes > len(attributes): raise RuntimeError("List is too small: " + str(len(attributes)) + " < " + str(numAttributes)) - cdevPtr = utils.HelperInputVoidPtr(devPtr) - cdef void* cdevPtr_ptr = cdevPtr.cptr - err = ccudart.cudaMemRangeGetAttributes(cvoidStarHelper_ptr, cdataSizes.data(), cattributes.data(), numAttributes, cdevPtr_ptr, count) - return (cudaError_t(err), [obj.pyObj() for obj in pylist]) -{{endif}} + :py:obj:`~.cuMemPoolImportPointer`, :py:obj:`~.cudaMemPoolExportToShareableHandle`, :py:obj:`~.cudaMemPoolImportFromShareableHandle`, :py:obj:`~.cudaMemPoolExportPointer` -{{if 'cudaMemcpyToArray' in found_functions}} + Notes + ----- + The :py:obj:`~.cudaFreeAsync` api may be used in the exporting process before the :py:obj:`~.cudaFreeAsync` operation completes in its stream as long as the :py:obj:`~.cudaFreeAsync` in the exporting process specifies a stream with a stream dependency on the importing process's :py:obj:`~.cudaFreeAsync`. + """ + cdef cyruntime.cudaMemPool_t cymemPool + if memPool is None: + pmemPool = 0 + elif isinstance(memPool, (cudaMemPool_t,driver.CUmemoryPool)): + pmemPool = int(memPool) + else: + pmemPool = int(cudaMemPool_t(memPool)) + cymemPool = pmemPool + cdef void_ptr ptr = 0 + cdef cyruntime.cudaMemPoolPtrExportData* cyexportData_ptr = exportData._pvt_ptr if exportData is not None else NULL + with nogil: + err = cyruntime.cudaMemPoolImportPointer(&ptr, cymemPool, cyexportData_ptr) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, ptr) @cython.embedsignature(True) -def cudaMemcpyToArray(dst, size_t wOffset, size_t hOffset, src, size_t count, kind not None : cudaMemcpyKind): - """ Copies data between host and device. +def cudaPointerGetAttributes(ptr): + """ Returns attributes about a specified pointer. - [Deprecated] + Returns in `*attributes` the attributes of the pointer `ptr`. If + pointer was not allocated in, mapped by or registered with context + supporting unified addressing :py:obj:`~.cudaErrorInvalidValue` is + returned. + + The :py:obj:`~.cudaPointerAttributes` structure is defined as: + + **View CUDA Toolkit Documentation for a C++ code example** + + In this structure, the individual fields mean + + - :py:obj:`~.cudaPointerAttributes.type` identifies type of memory. It + can be :py:obj:`~.cudaMemoryTypeUnregistered` for unregistered host + memory, :py:obj:`~.cudaMemoryTypeHost` for registered host memory, + :py:obj:`~.cudaMemoryTypeDevice` for device memory or + :py:obj:`~.cudaMemoryTypeManaged` for managed memory. + + - :py:obj:`~.device` is the device against which `ptr` was allocated. + If `ptr` has memory type :py:obj:`~.cudaMemoryTypeDevice` then this + identifies the device on which the memory referred to by `ptr` + physically resides. If `ptr` has memory type + :py:obj:`~.cudaMemoryTypeHost` then this identifies the device which + was current when the allocation was made (and if that device is + deinitialized then this allocation will vanish with that device's + state). + + - :py:obj:`~.devicePointer` is the device pointer alias through which + the memory referred to by `ptr` may be accessed on the current + device. If the memory referred to by `ptr` cannot be accessed + directly by the current device then this is NULL. - Copies `count` bytes from the memory area pointed to by `src` to the - CUDA array `dst` starting at `hOffset` rows and `wOffset` bytes from - the upper left corner, where `kind` specifies the direction of the - copy, and must be one of :py:obj:`~.cudaMemcpyHostToHost`, - :py:obj:`~.cudaMemcpyHostToDevice`, :py:obj:`~.cudaMemcpyDeviceToHost`, - :py:obj:`~.cudaMemcpyDeviceToDevice`, or :py:obj:`~.cudaMemcpyDefault`. - Passing :py:obj:`~.cudaMemcpyDefault` is recommended, in which case the - type of transfer is inferred from the pointer values. However, - :py:obj:`~.cudaMemcpyDefault` is only allowed on systems that support - unified virtual addressing. + - :py:obj:`~.hostPointer` is the host pointer alias through which the + memory referred to by `ptr` may be accessed on the host. If the + memory referred to by `ptr` cannot be accessed directly by the host + then this is NULL. Parameters ---------- - dst : :py:obj:`~.cudaArray_t` - Destination memory address - wOffset : size_t - Destination starting X offset (columns in bytes) - hOffset : size_t - Destination starting Y offset (rows) - src : Any - Source memory address - count : size_t - Size in bytes to copy - kind : :py:obj:`~.cudaMemcpyKind` - Type of transfer + ptr : Any + Pointer to get attributes for Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidMemcpyDirection` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDevice`, :py:obj:`~.cudaErrorInvalidValue` + attributes : :py:obj:`~.cudaPointerAttributes` + Attributes for the specified pointer See Also -------- - :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpy2D`, :py:obj:`~.cudaMemcpy2DToArray`, :py:obj:`~.cudaMemcpyFromArray`, :py:obj:`~.cudaMemcpy2DFromArray`, :py:obj:`~.cudaMemcpyArrayToArray`, :py:obj:`~.cudaMemcpy2DArrayToArray`, :py:obj:`~.cudaMemcpyToSymbol`, :py:obj:`~.cudaMemcpyFromSymbol`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpy2DAsync`, :py:obj:`~.cudaMemcpyToArrayAsync`, :py:obj:`~.cudaMemcpy2DToArrayAsync`, :py:obj:`~.cudaMemcpyFromArrayAsync`, :py:obj:`~.cudaMemcpy2DFromArrayAsync`, :py:obj:`~.cudaMemcpyToSymbolAsync`, :py:obj:`~.cudaMemcpyFromSymbolAsync`, :py:obj:`~.cuMemcpyHtoA`, :py:obj:`~.cuMemcpyDtoA` - """ - cdef ccudart.cudaArray_t cdst - if dst is None: - cdst = 0 - elif isinstance(dst, (cudaArray_t,)): - pdst = int(dst) - cdst = pdst - else: - pdst = int(cudaArray_t(dst)) - cdst = pdst - csrc = utils.HelperInputVoidPtr(src) - cdef void* csrc_ptr = csrc.cptr - cdef ccudart.cudaMemcpyKind ckind = kind.value - err = ccudart.cudaMemcpyToArray(cdst, wOffset, hOffset, csrc_ptr, count, ckind) - return (cudaError_t(err),) -{{endif}} + :py:obj:`~.cudaGetDeviceCount`, :py:obj:`~.cudaGetDevice`, :py:obj:`~.cudaSetDevice`, :py:obj:`~.cudaChooseDevice`, :py:obj:`~.cudaInitDevice`, :py:obj:`~.cuPointerGetAttributes` -{{if 'cudaMemcpyFromArray' in found_functions}} + Notes + ----- + In CUDA 11.0 forward passing host pointer will return :py:obj:`~.cudaMemoryTypeUnregistered` in :py:obj:`~.cudaPointerAttributes.type` and call will return :py:obj:`~.cudaSuccess`. + """ + cdef cudaPointerAttributes attributes = cudaPointerAttributes() + cdef _HelperInputVoidPtrStruct cyptrHelper + cdef void* cyptr = _helper_input_void_ptr(ptr, &cyptrHelper) + with nogil: + err = cyruntime.cudaPointerGetAttributes(attributes._pvt_ptr, cyptr) + _helper_input_void_ptr_free(&cyptrHelper) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, attributes) @cython.embedsignature(True) -def cudaMemcpyFromArray(dst, src, size_t wOffset, size_t hOffset, size_t count, kind not None : cudaMemcpyKind): - """ Copies data between host and device. - - [Deprecated] +def cudaDeviceCanAccessPeer(int device, int peerDevice): + """ Queries if a device may directly access a peer device's memory. - Copies `count` bytes from the CUDA array `src` starting at `hOffset` - rows and `wOffset` bytes from the upper left corner to the memory area - pointed to by `dst`, where `kind` specifies the direction of the copy, - and must be one of :py:obj:`~.cudaMemcpyHostToHost`, - :py:obj:`~.cudaMemcpyHostToDevice`, :py:obj:`~.cudaMemcpyDeviceToHost`, - :py:obj:`~.cudaMemcpyDeviceToDevice`, or :py:obj:`~.cudaMemcpyDefault`. - Passing :py:obj:`~.cudaMemcpyDefault` is recommended, in which case the - type of transfer is inferred from the pointer values. However, - :py:obj:`~.cudaMemcpyDefault` is only allowed on systems that support - unified virtual addressing. + Returns in `*canAccessPeer` a value of 1 if device `device` is capable + of directly accessing memory from `peerDevice` and 0 otherwise. If + direct access of `peerDevice` from `device` is possible, then access + may be enabled by calling :py:obj:`~.cudaDeviceEnablePeerAccess()`. Parameters ---------- - dst : Any - Destination memory address - src : :py:obj:`~.cudaArray_const_t` - Source memory address - wOffset : size_t - Source starting X offset (columns in bytes) - hOffset : size_t - Source starting Y offset (rows) - count : size_t - Size in bytes to copy - kind : :py:obj:`~.cudaMemcpyKind` - Type of transfer + device : int + Device from which allocations on `peerDevice` are to be directly + accessed. + peerDevice : int + Device on which the allocations to be directly accessed by `device` + reside. Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidMemcpyDirection` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDevice` + canAccessPeer : int + Returned access capability See Also -------- - :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpy2D`, :py:obj:`~.cudaMemcpyToArray`, :py:obj:`~.cudaMemcpy2DToArray`, :py:obj:`~.cudaMemcpy2DFromArray`, :py:obj:`~.cudaMemcpyArrayToArray`, :py:obj:`~.cudaMemcpy2DArrayToArray`, :py:obj:`~.cudaMemcpyToSymbol`, :py:obj:`~.cudaMemcpyFromSymbol`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpy2DAsync`, :py:obj:`~.cudaMemcpyToArrayAsync`, :py:obj:`~.cudaMemcpy2DToArrayAsync`, :py:obj:`~.cudaMemcpyFromArrayAsync`, :py:obj:`~.cudaMemcpy2DFromArrayAsync`, :py:obj:`~.cudaMemcpyToSymbolAsync`, :py:obj:`~.cudaMemcpyFromSymbolAsync`, :py:obj:`~.cuMemcpyAtoH`, :py:obj:`~.cuMemcpyAtoD` + :py:obj:`~.cudaDeviceEnablePeerAccess`, :py:obj:`~.cudaDeviceDisablePeerAccess`, :py:obj:`~.cuDeviceCanAccessPeer` """ - cdef ccudart.cudaArray_const_t csrc - if src is None: - csrc = 0 - elif isinstance(src, (cudaArray_const_t,)): - psrc = int(src) - csrc = psrc - else: - psrc = int(cudaArray_const_t(src)) - csrc = psrc - cdst = utils.HelperInputVoidPtr(dst) - cdef void* cdst_ptr = cdst.cptr - cdef ccudart.cudaMemcpyKind ckind = kind.value - err = ccudart.cudaMemcpyFromArray(cdst_ptr, csrc, wOffset, hOffset, count, ckind) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaMemcpyArrayToArray' in found_functions}} + cdef int canAccessPeer = 0 + with nogil: + err = cyruntime.cudaDeviceCanAccessPeer(&canAccessPeer, device, peerDevice) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, canAccessPeer) @cython.embedsignature(True) -def cudaMemcpyArrayToArray(dst, size_t wOffsetDst, size_t hOffsetDst, src, size_t wOffsetSrc, size_t hOffsetSrc, size_t count, kind not None : cudaMemcpyKind): - """ Copies data between host and device. +def cudaDeviceEnablePeerAccess(int peerDevice, unsigned int flags): + """ Enables direct access to memory allocations on a peer device. - [Deprecated] + On success, all allocations from `peerDevice` will immediately be + accessible by the current device. They will remain accessible until + access is explicitly disabled using + :py:obj:`~.cudaDeviceDisablePeerAccess()` or either device is reset + using :py:obj:`~.cudaDeviceReset()`. - Copies `count` bytes from the CUDA array `src` starting at `hOffsetSrc` - rows and `wOffsetSrc` bytes from the upper left corner to the CUDA - array `dst` starting at `hOffsetDst` rows and `wOffsetDst` bytes from - the upper left corner, where `kind` specifies the direction of the - copy, and must be one of :py:obj:`~.cudaMemcpyHostToHost`, - :py:obj:`~.cudaMemcpyHostToDevice`, :py:obj:`~.cudaMemcpyDeviceToHost`, - :py:obj:`~.cudaMemcpyDeviceToDevice`, or :py:obj:`~.cudaMemcpyDefault`. - Passing :py:obj:`~.cudaMemcpyDefault` is recommended, in which case the - type of transfer is inferred from the pointer values. However, - :py:obj:`~.cudaMemcpyDefault` is only allowed on systems that support - unified virtual addressing. + Note that access granted by this call is unidirectional and that in + order to access memory on the current device from `peerDevice`, a + separate symmetric call to :py:obj:`~.cudaDeviceEnablePeerAccess()` is + required. + + Note that there are both device-wide and system-wide limitations per + system configuration, as noted in the CUDA Programming Guide under the + section "Peer-to-Peer Memory Access". + + Returns :py:obj:`~.cudaErrorInvalidDevice` if + :py:obj:`~.cudaDeviceCanAccessPeer()` indicates that the current device + cannot directly access memory from `peerDevice`. + + Returns :py:obj:`~.cudaErrorPeerAccessAlreadyEnabled` if direct access + of `peerDevice` from the current device has already been enabled. + + Returns :py:obj:`~.cudaErrorInvalidValue` if `flags` is not 0. Parameters ---------- - dst : :py:obj:`~.cudaArray_t` - Destination memory address - wOffsetDst : size_t - Destination starting X offset (columns in bytes) - hOffsetDst : size_t - Destination starting Y offset (rows) - src : :py:obj:`~.cudaArray_const_t` - Source memory address - wOffsetSrc : size_t - Source starting X offset (columns in bytes) - hOffsetSrc : size_t - Source starting Y offset (rows) - count : size_t - Size in bytes to copy - kind : :py:obj:`~.cudaMemcpyKind` - Type of transfer + peerDevice : int + Peer device to enable direct access to from the current device + flags : unsigned int + Reserved for future use and must be set to 0 Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidMemcpyDirection` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDevice`, :py:obj:`~.cudaErrorPeerAccessAlreadyEnabled`, :py:obj:`~.cudaErrorInvalidValue` See Also -------- - :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpy2D`, :py:obj:`~.cudaMemcpyToArray`, :py:obj:`~.cudaMemcpy2DToArray`, :py:obj:`~.cudaMemcpyFromArray`, :py:obj:`~.cudaMemcpy2DFromArray`, :py:obj:`~.cudaMemcpy2DArrayToArray`, :py:obj:`~.cudaMemcpyToSymbol`, :py:obj:`~.cudaMemcpyFromSymbol`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpy2DAsync`, :py:obj:`~.cudaMemcpyToArrayAsync`, :py:obj:`~.cudaMemcpy2DToArrayAsync`, :py:obj:`~.cudaMemcpyFromArrayAsync`, :py:obj:`~.cudaMemcpy2DFromArrayAsync`, :py:obj:`~.cudaMemcpyToSymbolAsync`, :py:obj:`~.cudaMemcpyFromSymbolAsync`, :py:obj:`~.cuMemcpyAtoA` + :py:obj:`~.cudaDeviceCanAccessPeer`, :py:obj:`~.cudaDeviceDisablePeerAccess`, :py:obj:`~.cuCtxEnablePeerAccess` """ - cdef ccudart.cudaArray_const_t csrc - if src is None: - csrc = 0 - elif isinstance(src, (cudaArray_const_t,)): - psrc = int(src) - csrc = psrc - else: - psrc = int(cudaArray_const_t(src)) - csrc = psrc - cdef ccudart.cudaArray_t cdst - if dst is None: - cdst = 0 - elif isinstance(dst, (cudaArray_t,)): - pdst = int(dst) - cdst = pdst - else: - pdst = int(cudaArray_t(dst)) - cdst = pdst - cdef ccudart.cudaMemcpyKind ckind = kind.value - err = ccudart.cudaMemcpyArrayToArray(cdst, wOffsetDst, hOffsetDst, csrc, wOffsetSrc, hOffsetSrc, count, ckind) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaMemcpyToArrayAsync' in found_functions}} + with nogil: + err = cyruntime.cudaDeviceEnablePeerAccess(peerDevice, flags) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaMemcpyToArrayAsync(dst, size_t wOffset, size_t hOffset, src, size_t count, kind not None : cudaMemcpyKind, stream): - """ Copies data between host and device. - - [Deprecated] - - Copies `count` bytes from the memory area pointed to by `src` to the - CUDA array `dst` starting at `hOffset` rows and `wOffset` bytes from - the upper left corner, where `kind` specifies the direction of the - copy, and must be one of :py:obj:`~.cudaMemcpyHostToHost`, - :py:obj:`~.cudaMemcpyHostToDevice`, :py:obj:`~.cudaMemcpyDeviceToHost`, - :py:obj:`~.cudaMemcpyDeviceToDevice`, or :py:obj:`~.cudaMemcpyDefault`. - Passing :py:obj:`~.cudaMemcpyDefault` is recommended, in which case the - type of transfer is inferred from the pointer values. However, - :py:obj:`~.cudaMemcpyDefault` is only allowed on systems that support - unified virtual addressing. +def cudaDeviceDisablePeerAccess(int peerDevice): + """ Disables direct access to memory allocations on a peer device. - :py:obj:`~.cudaMemcpyToArrayAsync()` is asynchronous with respect to - the host, so the call may return before the copy is complete. The copy - can optionally be associated to a stream by passing a non-zero `stream` - argument. If `kind` is :py:obj:`~.cudaMemcpyHostToDevice` or - :py:obj:`~.cudaMemcpyDeviceToHost` and `stream` is non-zero, the copy - may overlap with operations in other streams. + Returns :py:obj:`~.cudaErrorPeerAccessNotEnabled` if direct access to + memory on `peerDevice` has not yet been enabled from the current + device. Parameters ---------- - dst : :py:obj:`~.cudaArray_t` - Destination memory address - wOffset : size_t - Destination starting X offset (columns in bytes) - hOffset : size_t - Destination starting Y offset (rows) - src : Any - Source memory address - count : size_t - Size in bytes to copy - kind : :py:obj:`~.cudaMemcpyKind` - Type of transfer - stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` - Stream identifier + peerDevice : int + Peer device to disable direct access to Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidMemcpyDirection` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorPeerAccessNotEnabled`, :py:obj:`~.cudaErrorInvalidDevice` See Also -------- - :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpy2D`, :py:obj:`~.cudaMemcpyToArray`, :py:obj:`~.cudaMemcpy2DToArray`, :py:obj:`~.cudaMemcpyFromArray`, :py:obj:`~.cudaMemcpy2DFromArray`, :py:obj:`~.cudaMemcpyArrayToArray`, :py:obj:`~.cudaMemcpy2DArrayToArray`, :py:obj:`~.cudaMemcpyToSymbol`, :py:obj:`~.cudaMemcpyFromSymbol`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpy2DAsync`, :py:obj:`~.cudaMemcpy2DToArrayAsync`, :py:obj:`~.cudaMemcpyFromArrayAsync`, :py:obj:`~.cudaMemcpy2DFromArrayAsync`, :py:obj:`~.cudaMemcpyToSymbolAsync`, :py:obj:`~.cudaMemcpyFromSymbolAsync`, :py:obj:`~.cuMemcpyHtoAAsync`, :py:obj:`~.cuMemcpy2DAsync` + :py:obj:`~.cudaDeviceCanAccessPeer`, :py:obj:`~.cudaDeviceEnablePeerAccess`, :py:obj:`~.cuCtxDisablePeerAccess` """ - cdef ccudart.cudaStream_t cstream - if stream is None: - cstream = 0 - elif isinstance(stream, (cudaStream_t,cuda.CUstream)): - pstream = int(stream) - cstream = pstream - else: - pstream = int(cudaStream_t(stream)) - cstream = pstream - cdef ccudart.cudaArray_t cdst - if dst is None: - cdst = 0 - elif isinstance(dst, (cudaArray_t,)): - pdst = int(dst) - cdst = pdst - else: - pdst = int(cudaArray_t(dst)) - cdst = pdst - csrc = utils.HelperInputVoidPtr(src) - cdef void* csrc_ptr = csrc.cptr - cdef ccudart.cudaMemcpyKind ckind = kind.value - err = ccudart.cudaMemcpyToArrayAsync(cdst, wOffset, hOffset, csrc_ptr, count, ckind, cstream) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaMemcpyFromArrayAsync' in found_functions}} + with nogil: + err = cyruntime.cudaDeviceDisablePeerAccess(peerDevice) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaMemcpyFromArrayAsync(dst, src, size_t wOffset, size_t hOffset, size_t count, kind not None : cudaMemcpyKind, stream): - """ Copies data between host and device. - - [Deprecated] +def cudaGraphicsUnregisterResource(resource): + """ Unregisters a graphics resource for access by CUDA. - Copies `count` bytes from the CUDA array `src` starting at `hOffset` - rows and `wOffset` bytes from the upper left corner to the memory area - pointed to by `dst`, where `kind` specifies the direction of the copy, - and must be one of :py:obj:`~.cudaMemcpyHostToHost`, - :py:obj:`~.cudaMemcpyHostToDevice`, :py:obj:`~.cudaMemcpyDeviceToHost`, - :py:obj:`~.cudaMemcpyDeviceToDevice`, or :py:obj:`~.cudaMemcpyDefault`. - Passing :py:obj:`~.cudaMemcpyDefault` is recommended, in which case the - type of transfer is inferred from the pointer values. However, - :py:obj:`~.cudaMemcpyDefault` is only allowed on systems that support - unified virtual addressing. + Unregisters the graphics resource `resource` so it is not accessible by + CUDA unless registered again. - :py:obj:`~.cudaMemcpyFromArrayAsync()` is asynchronous with respect to - the host, so the call may return before the copy is complete. The copy - can optionally be associated to a stream by passing a non-zero `stream` - argument. If `kind` is :py:obj:`~.cudaMemcpyHostToDevice` or - :py:obj:`~.cudaMemcpyDeviceToHost` and `stream` is non-zero, the copy - may overlap with operations in other streams. + If `resource` is invalid then + :py:obj:`~.cudaErrorInvalidResourceHandle` is returned. Parameters ---------- - dst : Any - Destination memory address - src : :py:obj:`~.cudaArray_const_t` - Source memory address - wOffset : size_t - Source starting X offset (columns in bytes) - hOffset : size_t - Source starting Y offset (rows) - count : size_t - Size in bytes to copy - kind : :py:obj:`~.cudaMemcpyKind` - Type of transfer - stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` - Stream identifier + resource : :py:obj:`~.cudaGraphicsResource_t` + Resource to unregister Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidMemcpyDirection` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorUnknown` See Also -------- - :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaMemcpy2D`, :py:obj:`~.cudaMemcpyToArray`, :py:obj:`~.cudaMemcpy2DToArray`, :py:obj:`~.cudaMemcpyFromArray`, :py:obj:`~.cudaMemcpy2DFromArray`, :py:obj:`~.cudaMemcpyArrayToArray`, :py:obj:`~.cudaMemcpy2DArrayToArray`, :py:obj:`~.cudaMemcpyToSymbol`, :py:obj:`~.cudaMemcpyFromSymbol`, :py:obj:`~.cudaMemcpyAsync`, :py:obj:`~.cudaMemcpy2DAsync`, :py:obj:`~.cudaMemcpyToArrayAsync`, :py:obj:`~.cudaMemcpy2DToArrayAsync`, :py:obj:`~.cudaMemcpy2DFromArrayAsync`, :py:obj:`~.cudaMemcpyToSymbolAsync`, :py:obj:`~.cudaMemcpyFromSymbolAsync`, :py:obj:`~.cuMemcpyAtoHAsync`, :py:obj:`~.cuMemcpy2DAsync` + :py:obj:`~.cudaGraphicsD3D9RegisterResource`, :py:obj:`~.cudaGraphicsD3D10RegisterResource`, :py:obj:`~.cudaGraphicsD3D11RegisterResource`, :py:obj:`~.cudaGraphicsGLRegisterBuffer`, :py:obj:`~.cudaGraphicsGLRegisterImage`, :py:obj:`~.cuGraphicsUnregisterResource` """ - cdef ccudart.cudaStream_t cstream - if stream is None: - cstream = 0 - elif isinstance(stream, (cudaStream_t,cuda.CUstream)): - pstream = int(stream) - cstream = pstream - else: - pstream = int(cudaStream_t(stream)) - cstream = pstream - cdef ccudart.cudaArray_const_t csrc - if src is None: - csrc = 0 - elif isinstance(src, (cudaArray_const_t,)): - psrc = int(src) - csrc = psrc + cdef cyruntime.cudaGraphicsResource_t cyresource + if resource is None: + presource = 0 + elif isinstance(resource, (cudaGraphicsResource_t,)): + presource = int(resource) else: - psrc = int(cudaArray_const_t(src)) - csrc = psrc - cdst = utils.HelperInputVoidPtr(dst) - cdef void* cdst_ptr = cdst.cptr - cdef ccudart.cudaMemcpyKind ckind = kind.value - err = ccudart.cudaMemcpyFromArrayAsync(cdst_ptr, csrc, wOffset, hOffset, count, ckind, cstream) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaMallocAsync' in found_functions}} + presource = int(cudaGraphicsResource_t(resource)) + cyresource = presource + with nogil: + err = cyruntime.cudaGraphicsUnregisterResource(cyresource) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaMallocAsync(size_t size, hStream): - """ Allocates memory with stream ordered semantics. +def cudaGraphicsResourceSetMapFlags(resource, unsigned int flags): + """ Set usage flags for mapping a graphics resource. - Inserts an allocation operation into `hStream`. A pointer to the - allocated memory is returned immediately in *dptr. The allocation must - not be accessed until the the allocation operation completes. The - allocation comes from the memory pool associated with the stream's - device. + Set `flags` for mapping the graphics resource `resource`. + + Changes to `flags` will take effect the next time `resource` is mapped. + The `flags` argument may be any of the following: + + - :py:obj:`~.cudaGraphicsMapFlagsNone`: Specifies no hints about how + `resource` will be used. It is therefore assumed that CUDA may read + from or write to `resource`. + + - :py:obj:`~.cudaGraphicsMapFlagsReadOnly`: Specifies that CUDA will + not write to `resource`. + + - :py:obj:`~.cudaGraphicsMapFlagsWriteDiscard`: Specifies CUDA will not + read from `resource` and will write over the entire contents of + `resource`, so none of the data previously stored in `resource` will + be preserved. + + If `resource` is presently mapped for access by CUDA then + :py:obj:`~.cudaErrorUnknown` is returned. If `flags` is not one of the + above values then :py:obj:`~.cudaErrorInvalidValue` is returned. Parameters ---------- - size : size_t - Number of bytes to allocate - hStream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` - The stream establishing the stream ordering contract and the memory - pool to allocate from + resource : :py:obj:`~.cudaGraphicsResource_t` + Registered resource to set flags for + flags : unsigned int + Parameters for resource mapping Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorNotSupported`, :py:obj:`~.cudaErrorOutOfMemory`, - devPtr : Any - Returned device pointer + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorUnknown`, See Also -------- - :py:obj:`~.cuMemAllocAsync`, cudaMallocAsync (C++ API), :py:obj:`~.cudaMallocFromPoolAsync`, :py:obj:`~.cudaFreeAsync`, :py:obj:`~.cudaDeviceSetMemPool`, :py:obj:`~.cudaDeviceGetDefaultMemPool`, :py:obj:`~.cudaDeviceGetMemPool`, :py:obj:`~.cudaMemPoolSetAccess`, :py:obj:`~.cudaMemPoolSetAttribute`, :py:obj:`~.cudaMemPoolGetAttribute` - - Notes - ----- - The default memory pool of a device contains device memory from that device. - - Basic stream ordering allows future work submitted into the same stream to use the allocation. Stream query, stream synchronize, and CUDA events can be used to guarantee that the allocation operation completes before work submitted in a separate stream runs. - - During stream capture, this function results in the creation of an allocation node. In this case, the allocation is owned by the graph instead of the memory pool. The memory pool's properties are used to set the node's creation parameters. + :py:obj:`~.cudaGraphicsMapResources`, :py:obj:`~.cuGraphicsResourceSetMapFlags` """ - cdef ccudart.cudaStream_t chStream - if hStream is None: - chStream = 0 - elif isinstance(hStream, (cudaStream_t,cuda.CUstream)): - phStream = int(hStream) - chStream = phStream + cdef cyruntime.cudaGraphicsResource_t cyresource + if resource is None: + presource = 0 + elif isinstance(resource, (cudaGraphicsResource_t,)): + presource = int(resource) else: - phStream = int(cudaStream_t(hStream)) - chStream = phStream - cdef void_ptr devPtr = 0 + presource = int(cudaGraphicsResource_t(resource)) + cyresource = presource with nogil: - err = ccudart.cudaMallocAsync(&devPtr, size, chStream) + err = cyruntime.cudaGraphicsResourceSetMapFlags(cyresource, flags) + return (_cudaError_t(err),) + +@cython.embedsignature(True) +def cudaGraphicsMapResources(int count, resources, stream): + """ Map graphics resources for access by CUDA. - return (cudaError_t(err), devPtr) -{{endif}} + Maps the `count` graphics resources in `resources` for access by CUDA. -{{if 'cudaFreeAsync' in found_functions}} + The resources in `resources` may be accessed by CUDA until they are + unmapped. The graphics API from which `resources` were registered + should not access any resources while they are mapped by CUDA. If an + application does so, the results are undefined. -@cython.embedsignature(True) -def cudaFreeAsync(devPtr, hStream): - """ Frees memory with stream ordered semantics. + This function provides the synchronization guarantee that any graphics + calls issued before :py:obj:`~.cudaGraphicsMapResources()` will + complete before any subsequent CUDA work issued in `stream` begins. - Inserts a free operation into `hStream`. The allocation must not be - accessed after stream execution reaches the free. After this API - returns, accessing the memory from any subsequent work launched on the - GPU or querying its pointer attributes results in undefined behavior. + If `resources` contains any duplicate entries then + :py:obj:`~.cudaErrorInvalidResourceHandle` is returned. If any of + `resources` are presently mapped for access by CUDA then + :py:obj:`~.cudaErrorUnknown` is returned. Parameters ---------- - dptr : Any - memory to free - hStream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` - The stream establishing the stream ordering promise + count : int + Number of resources to map + resources : :py:obj:`~.cudaGraphicsResource_t` + Resources to map for CUDA + stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + Stream for synchronization Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorNotSupported` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorUnknown` See Also -------- - :py:obj:`~.cuMemFreeAsync`, :py:obj:`~.cudaMallocAsync` - - Notes - ----- - During stream capture, this function results in the creation of a free node and must therefore be passed the address of a graph allocation. + :py:obj:`~.cudaGraphicsResourceGetMappedPointer`, :py:obj:`~.cudaGraphicsSubResourceGetMappedArray`, :py:obj:`~.cudaGraphicsUnmapResources`, :py:obj:`~.cuGraphicsMapResources` """ - cdef ccudart.cudaStream_t chStream - if hStream is None: - chStream = 0 - elif isinstance(hStream, (cudaStream_t,cuda.CUstream)): - phStream = int(hStream) - chStream = phStream + cdef cyruntime.cudaStream_t cystream + if stream is None: + pstream = 0 + elif isinstance(stream, (cudaStream_t,driver.CUstream)): + pstream = int(stream) else: - phStream = int(cudaStream_t(hStream)) - chStream = phStream - cdevPtr = utils.HelperInputVoidPtr(devPtr) - cdef void* cdevPtr_ptr = cdevPtr.cptr + pstream = int(cudaStream_t(stream)) + cystream = pstream + cdef cyruntime.cudaGraphicsResource_t *cyresources + if resources is None: + cyresources = NULL + elif isinstance(resources, (cudaGraphicsResource_t,)): + presources = resources.getPtr() + cyresources = presources + elif isinstance(resources, (int)): + cyresources = resources + else: + raise TypeError("Argument 'resources' is not instance of type (expected , found " + str(type(resources))) with nogil: - err = ccudart.cudaFreeAsync(cdevPtr_ptr, chStream) + err = cyruntime.cudaGraphicsMapResources(count, cyresources, cystream) + return (_cudaError_t(err),) - return (cudaError_t(err),) -{{endif}} +@cython.embedsignature(True) +def cudaGraphicsUnmapResources(int count, resources, stream): + """ Unmap graphics resources. -{{if 'cudaMemPoolTrimTo' in found_functions}} + Unmaps the `count` graphics resources in `resources`. -@cython.embedsignature(True) -def cudaMemPoolTrimTo(memPool, size_t minBytesToKeep): - """ Tries to release memory back to the OS. + Once unmapped, the resources in `resources` may not be accessed by CUDA + until they are mapped again. - Releases memory back to the OS until the pool contains fewer than - minBytesToKeep reserved bytes, or there is no more memory that the - allocator can safely release. The allocator cannot release OS - allocations that back outstanding asynchronous allocations. The OS - allocations may happen at different granularity from the user - allocations. + This function provides the synchronization guarantee that any CUDA work + issued in `stream` before :py:obj:`~.cudaGraphicsUnmapResources()` will + complete before any subsequently issued graphics work begins. + + If `resources` contains any duplicate entries then + :py:obj:`~.cudaErrorInvalidResourceHandle` is returned. If any of + `resources` are not presently mapped for access by CUDA then + :py:obj:`~.cudaErrorUnknown` is returned. Parameters ---------- - pool : :py:obj:`~.CUmemoryPool` or :py:obj:`~.cudaMemPool_t` - The memory pool to trim - minBytesToKeep : size_t - If the pool has less than minBytesToKeep reserved, the TrimTo - operation is a no-op. Otherwise the pool will be guaranteed to have - at least minBytesToKeep bytes reserved after the operation. + count : int + Number of resources to unmap + resources : :py:obj:`~.cudaGraphicsResource_t` + Resources to unmap + stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + Stream for synchronization Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorUnknown` See Also -------- - :py:obj:`~.cuMemPoolTrimTo`, :py:obj:`~.cudaMallocAsync`, :py:obj:`~.cudaFreeAsync`, :py:obj:`~.cudaDeviceGetDefaultMemPool`, :py:obj:`~.cudaDeviceGetMemPool`, :py:obj:`~.cudaMemPoolCreate` - - Notes - ----- - : Allocations that have not been freed count as outstanding. - - : Allocations that have been asynchronously freed but whose completion has not been observed on the host (eg. by a synchronize) can count as outstanding. + :py:obj:`~.cudaGraphicsMapResources`, :py:obj:`~.cuGraphicsUnmapResources` """ - cdef ccudart.cudaMemPool_t cmemPool - if memPool is None: - cmemPool = 0 - elif isinstance(memPool, (cudaMemPool_t,cuda.CUmemoryPool)): - pmemPool = int(memPool) - cmemPool = pmemPool + cdef cyruntime.cudaStream_t cystream + if stream is None: + pstream = 0 + elif isinstance(stream, (cudaStream_t,driver.CUstream)): + pstream = int(stream) else: - pmemPool = int(cudaMemPool_t(memPool)) - cmemPool = pmemPool + pstream = int(cudaStream_t(stream)) + cystream = pstream + cdef cyruntime.cudaGraphicsResource_t *cyresources + if resources is None: + cyresources = NULL + elif isinstance(resources, (cudaGraphicsResource_t,)): + presources = resources.getPtr() + cyresources = presources + elif isinstance(resources, (int)): + cyresources = resources + else: + raise TypeError("Argument 'resources' is not instance of type (expected , found " + str(type(resources))) with nogil: - err = ccudart.cudaMemPoolTrimTo(cmemPool, minBytesToKeep) - - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaMemPoolSetAttribute' in found_functions}} + err = cyruntime.cudaGraphicsUnmapResources(count, cyresources, cystream) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaMemPoolSetAttribute(memPool, attr not None : cudaMemPoolAttr, value): - """ Sets attributes of a memory pool. +def cudaGraphicsResourceGetMappedPointer(resource): + """ Get an device pointer through which to access a mapped graphics resource. - Supported attributes are: + Returns in `*devPtr` a pointer through which the mapped graphics + resource `resource` may be accessed. Returns in `*size` the size of the + memory in bytes which may be accessed from that pointer. The value set + in `devPtr` may change every time that `resource` is mapped. - - :py:obj:`~.cudaMemPoolAttrReleaseThreshold`: (value type = - cuuint64_t) Amount of reserved memory in bytes to hold onto before - trying to release memory back to the OS. When more than the release - threshold bytes of memory are held by the memory pool, the allocator - will try to release memory back to the OS on the next call to stream, - event or context synchronize. (default 0) + If `resource` is not a buffer then it cannot be accessed via a pointer + and :py:obj:`~.cudaErrorUnknown` is returned. If `resource` is not + mapped then :py:obj:`~.cudaErrorUnknown` is returned. - - :py:obj:`~.cudaMemPoolReuseFollowEventDependencies`: (value type = - int) Allow :py:obj:`~.cudaMallocAsync` to use memory asynchronously - freed in another stream as long as a stream ordering dependency of - the allocating stream on the free action exists. Cuda events and null - stream interactions can create the required stream ordered - dependencies. (default enabled) + Parameters + ---------- + resource : :py:obj:`~.cudaGraphicsResource_t` + None - - :py:obj:`~.cudaMemPoolReuseAllowOpportunistic`: (value type = int) - Allow reuse of already completed frees when there is no dependency - between the free and allocation. (default enabled) + Returns + ------- + cudaError_t - - :py:obj:`~.cudaMemPoolReuseAllowInternalDependencies`: (value type = - int) Allow :py:obj:`~.cudaMallocAsync` to insert new stream - dependencies in order to establish the stream ordering required to - reuse a piece of memory released by :py:obj:`~.cudaFreeAsync` - (default enabled). + devPtr : Any + None + size : int + None + """ + cdef cyruntime.cudaGraphicsResource_t cyresource + if resource is None: + presource = 0 + elif isinstance(resource, (cudaGraphicsResource_t,)): + presource = int(resource) + else: + presource = int(cudaGraphicsResource_t(resource)) + cyresource = presource + cdef void_ptr devPtr = 0 + cdef size_t size = 0 + with nogil: + err = cyruntime.cudaGraphicsResourceGetMappedPointer(&devPtr, &size, cyresource) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None, None) + return (_cudaError_t_SUCCESS, devPtr, size) - - :py:obj:`~.cudaMemPoolAttrReservedMemHigh`: (value type = cuuint64_t) - Reset the high watermark that tracks the amount of backing memory - that was allocated for the memory pool. It is illegal to set this - attribute to a non-zero value. +@cython.embedsignature(True) +def cudaGraphicsSubResourceGetMappedArray(resource, unsigned int arrayIndex, unsigned int mipLevel): + """ Get an array through which to access a subresource of a mapped graphics resource. - - :py:obj:`~.cudaMemPoolAttrUsedMemHigh`: (value type = cuuint64_t) - Reset the high watermark that tracks the amount of used memory that - was allocated for the memory pool. It is illegal to set this - attribute to a non-zero value. + Returns in `*array` an array through which the subresource of the + mapped graphics resource `resource` which corresponds to array index + `arrayIndex` and mipmap level `mipLevel` may be accessed. The value set + in `array` may change every time that `resource` is mapped. + + If `resource` is not a texture then it cannot be accessed via an array + and :py:obj:`~.cudaErrorUnknown` is returned. If `arrayIndex` is not a + valid array index for `resource` then :py:obj:`~.cudaErrorInvalidValue` + is returned. If `mipLevel` is not a valid mipmap level for `resource` + then :py:obj:`~.cudaErrorInvalidValue` is returned. If `resource` is + not mapped then :py:obj:`~.cudaErrorUnknown` is returned. Parameters ---------- - pool : :py:obj:`~.CUmemoryPool` or :py:obj:`~.cudaMemPool_t` - The memory pool to modify - attr : :py:obj:`~.cudaMemPoolAttr` - The attribute to modify - value : Any - Pointer to the value to assign + resource : :py:obj:`~.cudaGraphicsResource_t` + Mapped resource to access + arrayIndex : unsigned int + Array index for array textures or cubemap face index as defined by + :py:obj:`~.cudaGraphicsCubeFace` for cubemap textures for the + subresource to access + mipLevel : unsigned int + Mipmap level for the subresource to access Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorUnknown` + array : :py:obj:`~.cudaArray_t` + Returned array through which a subresource of `resource` may be + accessed See Also -------- - :py:obj:`~.cuMemPoolSetAttribute`, :py:obj:`~.cudaMallocAsync`, :py:obj:`~.cudaFreeAsync`, :py:obj:`~.cudaDeviceGetDefaultMemPool`, :py:obj:`~.cudaDeviceGetMemPool`, :py:obj:`~.cudaMemPoolCreate` + :py:obj:`~.cudaGraphicsResourceGetMappedPointer`, :py:obj:`~.cuGraphicsSubResourceGetMappedArray` """ - cdef ccudart.cudaMemPool_t cmemPool - if memPool is None: - cmemPool = 0 - elif isinstance(memPool, (cudaMemPool_t,cuda.CUmemoryPool)): - pmemPool = int(memPool) - cmemPool = pmemPool + cdef cyruntime.cudaGraphicsResource_t cyresource + if resource is None: + presource = 0 + elif isinstance(resource, (cudaGraphicsResource_t,)): + presource = int(resource) else: - pmemPool = int(cudaMemPool_t(memPool)) - cmemPool = pmemPool - cdef ccudart.cudaMemPoolAttr cattr = attr.value - cdef utils.HelperCUmemPool_attribute cvalue = utils.HelperCUmemPool_attribute(attr, value, is_getter=False) - cdef void* cvalue_ptr = cvalue.cptr + presource = int(cudaGraphicsResource_t(resource)) + cyresource = presource + cdef cudaArray_t array = cudaArray_t() with nogil: - err = ccudart.cudaMemPoolSetAttribute(cmemPool, cattr, cvalue_ptr) - - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaMemPoolGetAttribute' in found_functions}} + err = cyruntime.cudaGraphicsSubResourceGetMappedArray(array._pvt_ptr, cyresource, arrayIndex, mipLevel) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, array) @cython.embedsignature(True) -def cudaMemPoolGetAttribute(memPool, attr not None : cudaMemPoolAttr): - """ Gets attributes of a memory pool. - - Supported attributes are: - - - :py:obj:`~.cudaMemPoolAttrReleaseThreshold`: (value type = - cuuint64_t) Amount of reserved memory in bytes to hold onto before - trying to release memory back to the OS. When more than the release - threshold bytes of memory are held by the memory pool, the allocator - will try to release memory back to the OS on the next call to stream, - event or context synchronize. (default 0) - - - :py:obj:`~.cudaMemPoolReuseFollowEventDependencies`: (value type = - int) Allow :py:obj:`~.cudaMallocAsync` to use memory asynchronously - freed in another stream as long as a stream ordering dependency of - the allocating stream on the free action exists. Cuda events and null - stream interactions can create the required stream ordered - dependencies. (default enabled) - - - :py:obj:`~.cudaMemPoolReuseAllowOpportunistic`: (value type = int) - Allow reuse of already completed frees when there is no dependency - between the free and allocation. (default enabled) - - - :py:obj:`~.cudaMemPoolReuseAllowInternalDependencies`: (value type = - int) Allow :py:obj:`~.cudaMallocAsync` to insert new stream - dependencies in order to establish the stream ordering required to - reuse a piece of memory released by :py:obj:`~.cudaFreeAsync` - (default enabled). - - - :py:obj:`~.cudaMemPoolAttrReservedMemCurrent`: (value type = - cuuint64_t) Amount of backing memory currently allocated for the - mempool. - - - :py:obj:`~.cudaMemPoolAttrReservedMemHigh`: (value type = cuuint64_t) - High watermark of backing memory allocated for the mempool since the - last time it was reset. +def cudaGraphicsResourceGetMappedMipmappedArray(resource): + """ Get a mipmapped array through which to access a mapped graphics resource. - - :py:obj:`~.cudaMemPoolAttrUsedMemCurrent`: (value type = cuuint64_t) - Amount of memory from the pool that is currently in use by the - application. + Returns in `*mipmappedArray` a mipmapped array through which the mapped + graphics resource `resource` may be accessed. The value set in + `mipmappedArray` may change every time that `resource` is mapped. - - :py:obj:`~.cudaMemPoolAttrUsedMemHigh`: (value type = cuuint64_t) - High watermark of the amount of memory from the pool that was in use - by the application since the last time it was reset. + If `resource` is not a texture then it cannot be accessed via an array + and :py:obj:`~.cudaErrorUnknown` is returned. If `resource` is not + mapped then :py:obj:`~.cudaErrorUnknown` is returned. Parameters ---------- - pool : :py:obj:`~.CUmemoryPool` or :py:obj:`~.cudaMemPool_t` - The memory pool to get attributes of - attr : :py:obj:`~.cudaMemPoolAttr` - The attribute to get + resource : :py:obj:`~.cudaGraphicsResource_t` + Mapped resource to access Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` - value : Any - Retrieved value + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorUnknown` + mipmappedArray : :py:obj:`~.cudaMipmappedArray_t` + Returned mipmapped array through which `resource` may be accessed See Also -------- - :py:obj:`~.cuMemPoolGetAttribute`, :py:obj:`~.cudaMallocAsync`, :py:obj:`~.cudaFreeAsync`, :py:obj:`~.cudaDeviceGetDefaultMemPool`, :py:obj:`~.cudaDeviceGetMemPool`, :py:obj:`~.cudaMemPoolCreate` + :py:obj:`~.cudaGraphicsResourceGetMappedPointer`, :py:obj:`~.cuGraphicsResourceGetMappedMipmappedArray` """ - cdef ccudart.cudaMemPool_t cmemPool - if memPool is None: - cmemPool = 0 - elif isinstance(memPool, (cudaMemPool_t,cuda.CUmemoryPool)): - pmemPool = int(memPool) - cmemPool = pmemPool + cdef cyruntime.cudaGraphicsResource_t cyresource + if resource is None: + presource = 0 + elif isinstance(resource, (cudaGraphicsResource_t,)): + presource = int(resource) else: - pmemPool = int(cudaMemPool_t(memPool)) - cmemPool = pmemPool - cdef ccudart.cudaMemPoolAttr cattr = attr.value - cdef utils.HelperCUmemPool_attribute cvalue = utils.HelperCUmemPool_attribute(attr, 0, is_getter=True) - cdef void* cvalue_ptr = cvalue.cptr + presource = int(cudaGraphicsResource_t(resource)) + cyresource = presource + cdef cudaMipmappedArray_t mipmappedArray = cudaMipmappedArray_t() with nogil: - err = ccudart.cudaMemPoolGetAttribute(cmemPool, cattr, cvalue_ptr) - - return (cudaError_t(err), cvalue.pyObj()) -{{endif}} - -{{if 'cudaMemPoolSetAccess' in found_functions}} + err = cyruntime.cudaGraphicsResourceGetMappedMipmappedArray(mipmappedArray._pvt_ptr, cyresource) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, mipmappedArray) @cython.embedsignature(True) -def cudaMemPoolSetAccess(memPool, descList : Optional[List[cudaMemAccessDesc]], size_t count): - """ Controls visibility of pools between devices. +def cudaGetChannelDesc(array): + """ Get the channel descriptor of an array. + + Returns in `*desc` the channel descriptor of the CUDA array `array`. Parameters ---------- - pool : :py:obj:`~.CUmemoryPool` or :py:obj:`~.cudaMemPool_t` - The pool being modified - map : List[:py:obj:`~.cudaMemAccessDesc`] - Array of access descriptors. Each descriptor instructs the access - to enable for a single gpu - count : size_t - Number of descriptors in the map array. + array : :py:obj:`~.cudaArray_const_t` + Memory array on device Returns ------- cudaError_t :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + desc : :py:obj:`~.cudaChannelFormatDesc` + Channel format See Also -------- - :py:obj:`~.cuMemPoolSetAccess`, :py:obj:`~.cudaMemPoolGetAccess`, :py:obj:`~.cudaMallocAsync`, :py:obj:`~.cudaFreeAsync` + :py:obj:`~.cudaCreateChannelDesc (C API)`, :py:obj:`~.cudaCreateTextureObject`, :py:obj:`~.cudaCreateSurfaceObject` """ - descList = [] if descList is None else descList - if not all(isinstance(_x, (cudaMemAccessDesc,)) for _x in descList): - raise TypeError("Argument 'descList' is not instance of type (expected List[ccudart.cudaMemAccessDesc,]") - cdef ccudart.cudaMemPool_t cmemPool - if memPool is None: - cmemPool = 0 - elif isinstance(memPool, (cudaMemPool_t,cuda.CUmemoryPool)): - pmemPool = int(memPool) - cmemPool = pmemPool + cdef cyruntime.cudaArray_const_t cyarray + if array is None: + parray = 0 + elif isinstance(array, (cudaArray_const_t,)): + parray = int(array) else: - pmemPool = int(cudaMemPool_t(memPool)) - cmemPool = pmemPool - cdef ccudart.cudaMemAccessDesc* cdescList = NULL - if len(descList) > 0: - cdescList = calloc(len(descList), sizeof(ccudart.cudaMemAccessDesc)) - if cdescList is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(descList)) + 'x' + str(sizeof(ccudart.cudaMemAccessDesc))) - for idx in range(len(descList)): - string.memcpy(&cdescList[idx], (descList[idx])._ptr, sizeof(ccudart.cudaMemAccessDesc)) - if count > len(descList): raise RuntimeError("List is too small: " + str(len(descList)) + " < " + str(count)) - err = ccudart.cudaMemPoolSetAccess(cmemPool, (descList[0])._ptr if len(descList) == 1 else cdescList, count) - if cdescList is not NULL: - free(cdescList) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaMemPoolGetAccess' in found_functions}} + parray = int(cudaArray_const_t(array)) + cyarray = parray + cdef cudaChannelFormatDesc desc = cudaChannelFormatDesc() + with nogil: + err = cyruntime.cudaGetChannelDesc(desc._pvt_ptr, cyarray) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, desc) @cython.embedsignature(True) -def cudaMemPoolGetAccess(memPool, location : Optional[cudaMemLocation]): - """ Returns the accessibility of a pool from a device. +def cudaCreateChannelDesc(int x, int y, int z, int w, f not None : cudaChannelFormatKind): + """ Returns a channel descriptor using the specified format. - Returns the accessibility of the pool's memory from the specified - location. + Returns a channel descriptor with format `f` and number of bits of each + component `x`, `y`, `z`, and `w`. The :py:obj:`~.cudaChannelFormatDesc` + is defined as: + + **View CUDA Toolkit Documentation for a C++ code example** + + where :py:obj:`~.cudaChannelFormatKind` is one of + :py:obj:`~.cudaChannelFormatKindSigned`, + :py:obj:`~.cudaChannelFormatKindUnsigned`, or + :py:obj:`~.cudaChannelFormatKindFloat`. Parameters ---------- - memPool : :py:obj:`~.CUmemoryPool` or :py:obj:`~.cudaMemPool_t` - the pool being queried - location : :py:obj:`~.cudaMemLocation` - the location accessing the pool + x : int + X component + y : int + Y component + z : int + Z component + w : int + W component + f : :py:obj:`~.cudaChannelFormatKind` + Channel format Returns ------- - cudaError_t - - flags : :py:obj:`~.cudaMemAccessFlags` - the accessibility of the pool from the specified location + cudaError_t.cudaSuccess + cudaError_t.cudaSuccess + :py:obj:`~.cudaChannelFormatDesc` + Channel descriptor with format `f` See Also -------- - :py:obj:`~.cuMemPoolGetAccess`, :py:obj:`~.cudaMemPoolSetAccess` + cudaCreateChannelDesc (C++ API), :py:obj:`~.cudaGetChannelDesc`, :py:obj:`~.cudaCreateTextureObject`, :py:obj:`~.cudaCreateSurfaceObject` """ - cdef ccudart.cudaMemPool_t cmemPool - if memPool is None: - cmemPool = 0 - elif isinstance(memPool, (cudaMemPool_t,cuda.CUmemoryPool)): - pmemPool = int(memPool) - cmemPool = pmemPool - else: - pmemPool = int(cudaMemPool_t(memPool)) - cmemPool = pmemPool - cdef ccudart.cudaMemAccessFlags flags - cdef ccudart.cudaMemLocation* clocation_ptr = location._ptr if location != None else NULL - err = ccudart.cudaMemPoolGetAccess(&flags, cmemPool, clocation_ptr) - return (cudaError_t(err), cudaMemAccessFlags(flags)) -{{endif}} - -{{if 'cudaMemPoolCreate' in found_functions}} + cdef cyruntime.cudaChannelFormatKind cyf = int(f) + with nogil: + err = cyruntime.cudaCreateChannelDesc(x, y, z, w, cyf) + cdef cudaChannelFormatDesc wrapper = cudaChannelFormatDesc() + wrapper._pvt_ptr[0] = err + return (cudaError_t.cudaSuccess, wrapper) @cython.embedsignature(True) -def cudaMemPoolCreate(poolProps : Optional[cudaMemPoolProps]): - """ Creates a memory pool. +def cudaCreateTextureObject(pResDesc : Optional[cudaResourceDesc], pTexDesc : Optional[cudaTextureDesc], pResViewDesc : Optional[cudaResourceViewDesc]): + """ Creates a texture object. - Creates a CUDA memory pool and returns the handle in `pool`. The - `poolProps` determines the properties of the pool such as the backing - device and IPC capabilities. + Creates a texture object and returns it in `pTexObject`. `pResDesc` + describes the data to texture from. `pTexDesc` describes how the data + should be sampled. `pResViewDesc` is an optional argument that + specifies an alternate format for the data described by `pResDesc`, and + also describes the subresource region to restrict access to when + texturing. `pResViewDesc` can only be specified if the type of resource + is a CUDA array or a CUDA mipmapped array not in a block compressed + format. - To create a memory pool targeting a specific host NUMA node, - applications must set - :py:obj:`~.cudaMemPoolProps`::cudaMemLocation::type to - :py:obj:`~.cudaMemLocationTypeHostNuma` and - :py:obj:`~.cudaMemPoolProps`::cudaMemLocation::id must specify the NUMA - ID of the host memory node. By default, the pool's memory will be - accessible from the device it is allocated on. In the case of pools - created with :py:obj:`~.cudaMemLocationTypeHostNuma`, their default - accessibility will be from the host CPU. Applications can control the - maximum size of the pool by specifying a non-zero value for - :py:obj:`~.cudaMemPoolProps.maxSize`. If set to 0, the maximum size of - the pool will default to a system dependent value. + Texture objects are only supported on devices of compute capability 3.0 + or higher. Additionally, a texture object is an opaque value, and, as + such, should only be accessed through CUDA API calls. - Applications can set :py:obj:`~.cudaMemPoolProps.handleTypes` to - :py:obj:`~.cudaMemHandleTypeFabric` in order to create - :py:obj:`~.cudaMemPool_t` suitable for sharing within an IMEX domain. - An IMEX domain is either an OS instance or a group of securely - connected OS instances using the NVIDIA IMEX daemon. An IMEX channel is - a global resource within the IMEX domain that represents a logical - entity that aims to provide fine grained accessibility control for the - participating processes. When exporter and importer CUDA processes have - been granted access to the same IMEX channel, they can securely share - memory. If the allocating process does not have access setup for an - IMEX channel, attempting to export a :py:obj:`~.CUmemoryPool` with - :py:obj:`~.cudaMemHandleTypeFabric` will result in - :py:obj:`~.cudaErrorNotPermitted`. The nvidia-modprobe CLI provides - more information regarding setting up of IMEX channels. + The :py:obj:`~.cudaResourceDesc` structure is defined as: - Parameters - ---------- - poolProps : :py:obj:`~.cudaMemPoolProps` - None + **View CUDA Toolkit Documentation for a C++ code example** - Returns - ------- - cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorNotSupported` - memPool : :py:obj:`~.cudaMemPool_t` - None + where: + + - :py:obj:`~.cudaResourceDesc.resType` specifies the type of resource + to texture from. CUresourceType is defined as: + + - **View CUDA Toolkit Documentation for a C++ code example** + + If :py:obj:`~.cudaResourceDesc.resType` is set to + :py:obj:`~.cudaResourceTypeArray`, + :py:obj:`~.cudaResourceDesc.res.array.array` must be set to a valid + CUDA array handle. + + If :py:obj:`~.cudaResourceDesc.resType` is set to + :py:obj:`~.cudaResourceTypeMipmappedArray`, + :py:obj:`~.cudaResourceDesc.res.mipmap.mipmap` must be set to a valid + CUDA mipmapped array handle and + :py:obj:`~.cudaTextureDesc.normalizedCoords` must be set to true. + + If :py:obj:`~.cudaResourceDesc.resType` is set to + :py:obj:`~.cudaResourceTypeLinear`, + :py:obj:`~.cudaResourceDesc.res.linear.devPtr` must be set to a valid + device pointer, that is aligned to + :py:obj:`~.cudaDeviceProp.textureAlignment`. + :py:obj:`~.cudaResourceDesc.res.linear.desc` describes the format and + the number of components per array element. + :py:obj:`~.cudaResourceDesc.res.linear.sizeInBytes` specifies the size + of the array in bytes. The total number of elements in the linear + address range cannot exceed + :py:obj:`~.cudaDeviceGetTexture1DLinearMaxWidth()`. The number of + elements is computed as (sizeInBytes / sizeof(desc)). - See Also - -------- - :py:obj:`~.cuMemPoolCreate`, :py:obj:`~.cudaDeviceSetMemPool`, :py:obj:`~.cudaMallocFromPoolAsync`, :py:obj:`~.cudaMemPoolExportToShareableHandle`, :py:obj:`~.cudaDeviceGetDefaultMemPool`, :py:obj:`~.cudaDeviceGetMemPool` + If :py:obj:`~.cudaResourceDesc.resType` is set to + :py:obj:`~.cudaResourceTypePitch2D`, + :py:obj:`~.cudaResourceDesc.res.pitch2D.devPtr` must be set to a valid + device pointer, that is aligned to + :py:obj:`~.cudaDeviceProp.textureAlignment`. + :py:obj:`~.cudaResourceDesc.res.pitch2D.desc` describes the format and + the number of components per array element. + :py:obj:`~.cudaResourceDesc.res.pitch2D.width` and + :py:obj:`~.cudaResourceDesc.res.pitch2D.height` specify the width and + height of the array in elements, and cannot exceed + :py:obj:`~.cudaDeviceProp.maxTexture2DLinear`[0] and + :py:obj:`~.cudaDeviceProp.maxTexture2DLinear`[1] respectively. + :py:obj:`~.cudaResourceDesc.res.pitch2D.pitchInBytes` specifies the + pitch between two rows in bytes and has to be aligned to + :py:obj:`~.cudaDeviceProp.texturePitchAlignment`. Pitch cannot exceed + :py:obj:`~.cudaDeviceProp.maxTexture2DLinear`[2]. - Notes - ----- - Specifying cudaMemHandleTypeNone creates a memory pool that will not support IPC. - """ - cdef cudaMemPool_t memPool = cudaMemPool_t() - cdef ccudart.cudaMemPoolProps* cpoolProps_ptr = poolProps._ptr if poolProps != None else NULL - err = ccudart.cudaMemPoolCreate(memPool._ptr, cpoolProps_ptr) - return (cudaError_t(err), memPool) -{{endif}} + The :py:obj:`~.cudaTextureDesc` struct is defined as -{{if 'cudaMemPoolDestroy' in found_functions}} + **View CUDA Toolkit Documentation for a C++ code example** -@cython.embedsignature(True) -def cudaMemPoolDestroy(memPool): - """ Destroys the specified memory pool. + where - If any pointers obtained from this pool haven't been freed or the pool - has free operations that haven't completed when - :py:obj:`~.cudaMemPoolDestroy` is invoked, the function will return - immediately and the resources associated with the pool will be released - automatically once there are no more outstanding allocations. + - :py:obj:`~.cudaTextureDesc.addressMode` specifies the addressing mode + for each dimension of the texture data. + :py:obj:`~.cudaTextureAddressMode` is defined as: - Destroying the current mempool of a device sets the default mempool of - that device as the current mempool for that device. + - **View CUDA Toolkit Documentation for a C++ code example** - Parameters - ---------- - memPool : :py:obj:`~.CUmemoryPool` or :py:obj:`~.cudaMemPool_t` - None + - This is ignored if :py:obj:`~.cudaResourceDesc.resType` is + :py:obj:`~.cudaResourceTypeLinear`. Also, if + :py:obj:`~.cudaTextureDesc.normalizedCoords` is set to zero, + :py:obj:`~.cudaAddressModeWrap` and :py:obj:`~.cudaAddressModeMirror` + won't be supported and will be switched to + :py:obj:`~.cudaAddressModeClamp`. - Returns - ------- - cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + - :py:obj:`~.cudaTextureDesc.filterMode` specifies the filtering mode + to be used when fetching from the texture. + :py:obj:`~.cudaTextureFilterMode` is defined as: - See Also - -------- - cuMemPoolDestroy, :py:obj:`~.cudaFreeAsync`, :py:obj:`~.cudaDeviceSetMemPool`, :py:obj:`~.cudaDeviceGetDefaultMemPool`, :py:obj:`~.cudaDeviceGetMemPool`, :py:obj:`~.cudaMemPoolCreate` + - **View CUDA Toolkit Documentation for a C++ code example** - Notes - ----- - A device's default memory pool cannot be destroyed. - """ - cdef ccudart.cudaMemPool_t cmemPool - if memPool is None: - cmemPool = 0 - elif isinstance(memPool, (cudaMemPool_t,cuda.CUmemoryPool)): - pmemPool = int(memPool) - cmemPool = pmemPool - else: - pmemPool = int(cudaMemPool_t(memPool)) - cmemPool = pmemPool - err = ccudart.cudaMemPoolDestroy(cmemPool) - return (cudaError_t(err),) -{{endif}} + - This is ignored if :py:obj:`~.cudaResourceDesc.resType` is + :py:obj:`~.cudaResourceTypeLinear`. -{{if 'cudaMallocFromPoolAsync' in found_functions}} + - :py:obj:`~.cudaTextureDesc.readMode` specifies whether integer data + should be converted to floating point or not. + :py:obj:`~.cudaTextureReadMode` is defined as: -@cython.embedsignature(True) -def cudaMallocFromPoolAsync(size_t size, memPool, stream): - """ Allocates memory from a specified pool with stream ordered semantics. + - **View CUDA Toolkit Documentation for a C++ code example** - Inserts an allocation operation into `hStream`. A pointer to the - allocated memory is returned immediately in *dptr. The allocation must - not be accessed until the the allocation operation completes. The - allocation comes from the specified memory pool. + - Note that this applies only to 8-bit and 16-bit integer formats. + 32-bit integer format would not be promoted, regardless of whether or + not this :py:obj:`~.cudaTextureDesc.readMode` is set + :py:obj:`~.cudaReadModeNormalizedFloat` is specified. - Parameters - ---------- - bytesize : size_t - Number of bytes to allocate - memPool : :py:obj:`~.CUmemoryPool` or :py:obj:`~.cudaMemPool_t` - The pool to allocate from - stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` - The stream establishing the stream ordering semantic + - :py:obj:`~.cudaTextureDesc.sRGB` specifies whether sRGB to linear + conversion should be performed during texture fetch. - Returns - ------- - cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorNotSupported`, :py:obj:`~.cudaErrorOutOfMemory` - ptr : Any - Returned device pointer + - :py:obj:`~.cudaTextureDesc.borderColor` specifies the float values of + color. where: :py:obj:`~.cudaTextureDesc.borderColor`[0] contains + value of 'R', :py:obj:`~.cudaTextureDesc.borderColor`[1] contains + value of 'G', :py:obj:`~.cudaTextureDesc.borderColor`[2] contains + value of 'B', :py:obj:`~.cudaTextureDesc.borderColor`[3] contains + value of 'A' Note that application using integer border color values + will need to these values to float. The values are + set only when the addressing mode specified by + :py:obj:`~.cudaTextureDesc.addressMode` is cudaAddressModeBorder. - See Also - -------- - :py:obj:`~.cuMemAllocFromPoolAsync`, cudaMallocAsync (C++ API), :py:obj:`~.cudaMallocAsync`, :py:obj:`~.cudaFreeAsync`, :py:obj:`~.cudaDeviceGetDefaultMemPool`, :py:obj:`~.cudaMemPoolCreate`, :py:obj:`~.cudaMemPoolSetAccess`, :py:obj:`~.cudaMemPoolSetAttribute` + - :py:obj:`~.cudaTextureDesc.normalizedCoords` specifies whether the + texture coordinates will be normalized or not. - Notes - ----- - During stream capture, this function results in the creation of an allocation node. In this case, the allocation is owned by the graph instead of the memory pool. The memory pool's properties are used to set the node's creation parameters. - """ - cdef ccudart.cudaStream_t cstream - if stream is None: - cstream = 0 - elif isinstance(stream, (cudaStream_t,cuda.CUstream)): - pstream = int(stream) - cstream = pstream - else: - pstream = int(cudaStream_t(stream)) - cstream = pstream - cdef ccudart.cudaMemPool_t cmemPool - if memPool is None: - cmemPool = 0 - elif isinstance(memPool, (cudaMemPool_t,cuda.CUmemoryPool)): - pmemPool = int(memPool) - cmemPool = pmemPool - else: - pmemPool = int(cudaMemPool_t(memPool)) - cmemPool = pmemPool - cdef void_ptr ptr = 0 - err = ccudart.cudaMallocFromPoolAsync(&ptr, size, cmemPool, cstream) - return (cudaError_t(err), ptr) -{{endif}} + - :py:obj:`~.cudaTextureDesc.maxAnisotropy` specifies the maximum + anistropy ratio to be used when doing anisotropic filtering. This + value will be clamped to the range [1,16]. -{{if 'cudaMemPoolExportToShareableHandle' in found_functions}} + - :py:obj:`~.cudaTextureDesc.mipmapFilterMode` specifies the filter + mode when the calculated mipmap level lies between two defined mipmap + levels. -@cython.embedsignature(True) -def cudaMemPoolExportToShareableHandle(memPool, handleType not None : cudaMemAllocationHandleType, unsigned int flags): - """ Exports a memory pool to the requested handle type. + - :py:obj:`~.cudaTextureDesc.mipmapLevelBias` specifies the offset to + be applied to the calculated mipmap level. - Given an IPC capable mempool, create an OS handle to share the pool - with another process. A recipient process can convert the shareable - handle into a mempool with - :py:obj:`~.cudaMemPoolImportFromShareableHandle`. Individual pointers - can then be shared with the :py:obj:`~.cudaMemPoolExportPointer` and - :py:obj:`~.cudaMemPoolImportPointer` APIs. The implementation of what - the shareable handle is and how it can be transferred is defined by the - requested handle type. + - :py:obj:`~.cudaTextureDesc.minMipmapLevelClamp` specifies the lower + end of the mipmap level range to clamp access to. - Parameters - ---------- - pool : :py:obj:`~.CUmemoryPool` or :py:obj:`~.cudaMemPool_t` - pool to export - handleType : :py:obj:`~.cudaMemAllocationHandleType` - the type of handle to create - flags : unsigned int - must be 0 + - :py:obj:`~.cudaTextureDesc.maxMipmapLevelClamp` specifies the upper + end of the mipmap level range to clamp access to. - Returns - ------- - cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorOutOfMemory` - handle_out : Any - pointer to the location in which to store the requested handle + - :py:obj:`~.cudaTextureDesc.disableTrilinearOptimization` specifies + whether the trilinear filtering optimizations will be disabled. - See Also - -------- - :py:obj:`~.cuMemPoolExportToShareableHandle`, :py:obj:`~.cudaMemPoolImportFromShareableHandle`, :py:obj:`~.cudaMemPoolExportPointer`, :py:obj:`~.cudaMemPoolImportPointer` + - :py:obj:`~.cudaTextureDesc.seamlessCubemap` specifies whether + seamless cube map filtering is enabled. This flag can only be + specified if the underlying resource is a CUDA array or a CUDA + mipmapped array that was created with the flag + :py:obj:`~.cudaArrayCubemap`. When seamless cube map filtering is + enabled, texture address modes specified by + :py:obj:`~.cudaTextureDesc.addressMode` are ignored. Instead, if the + :py:obj:`~.cudaTextureDesc.filterMode` is set to + :py:obj:`~.cudaFilterModePoint` the address mode + :py:obj:`~.cudaAddressModeClamp` will be applied for all dimensions. + If the :py:obj:`~.cudaTextureDesc.filterMode` is set to + :py:obj:`~.cudaFilterModeLinear` seamless cube map filtering will be + performed when sampling along the cube face borders. - Notes - ----- - : To create an IPC capable mempool, create a mempool with a CUmemAllocationHandleType other than cudaMemHandleTypeNone. - """ - cdef ccudart.cudaMemPool_t cmemPool - if memPool is None: - cmemPool = 0 - elif isinstance(memPool, (cudaMemPool_t,cuda.CUmemoryPool)): - pmemPool = int(memPool) - cmemPool = pmemPool - else: - pmemPool = int(cudaMemPool_t(memPool)) - cmemPool = pmemPool - cdef utils.HelperCUmemAllocationHandleType cshareableHandle = utils.HelperCUmemAllocationHandleType(handleType) - cdef void* cshareableHandle_ptr = cshareableHandle.cptr - cdef ccudart.cudaMemAllocationHandleType chandleType = handleType.value - err = ccudart.cudaMemPoolExportToShareableHandle(cshareableHandle_ptr, cmemPool, chandleType, flags) - return (cudaError_t(err), cshareableHandle.pyObj()) -{{endif}} + The :py:obj:`~.cudaResourceViewDesc` struct is defined as -{{if 'cudaMemPoolImportFromShareableHandle' in found_functions}} + **View CUDA Toolkit Documentation for a C++ code example** -@cython.embedsignature(True) -def cudaMemPoolImportFromShareableHandle(shareableHandle, handleType not None : cudaMemAllocationHandleType, unsigned int flags): - """ imports a memory pool from a shared handle. + where: - Specific allocations can be imported from the imported pool with - :py:obj:`~.cudaMemPoolImportPointer`. + - :py:obj:`~.cudaResourceViewDesc.format` specifies how the data + contained in the CUDA array or CUDA mipmapped array should be + interpreted. Note that this can incur a change in size of the texture + data. If the resource view format is a block compressed format, then + the underlying CUDA array or CUDA mipmapped array has to have a + 32-bit unsigned integer format with 2 or 4 channels, depending on the + block compressed format. For ex., BC1 and BC4 require the underlying + CUDA array to have a 32-bit unsigned int with 2 channels. The other + BC formats require the underlying resource to have the same 32-bit + unsigned int format but with 4 channels. - Parameters - ---------- - handle : Any - OS handle of the pool to open - handleType : :py:obj:`~.cudaMemAllocationHandleType` - The type of handle being imported - flags : unsigned int - must be 0 + - :py:obj:`~.cudaResourceViewDesc.width` specifies the new width of the + texture data. If the resource view format is a block compressed + format, this value has to be 4 times the original width of the + resource. For non block compressed formats, this value has to be + equal to that of the original resource. - Returns - ------- - cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorOutOfMemory` - pool_out : :py:obj:`~.cudaMemPool_t` - Returned memory pool + - :py:obj:`~.cudaResourceViewDesc.height` specifies the new height of + the texture data. If the resource view format is a block compressed + format, this value has to be 4 times the original height of the + resource. For non block compressed formats, this value has to be + equal to that of the original resource. - See Also - -------- - :py:obj:`~.cuMemPoolImportFromShareableHandle`, :py:obj:`~.cudaMemPoolExportToShareableHandle`, :py:obj:`~.cudaMemPoolExportPointer`, :py:obj:`~.cudaMemPoolImportPointer` + - :py:obj:`~.cudaResourceViewDesc.depth` specifies the new depth of the + texture data. This value has to be equal to that of the original + resource. - Notes - ----- - Imported memory pools do not support creating new allocations. As such imported memory pools may not be used in :py:obj:`~.cudaDeviceSetMemPool` or :py:obj:`~.cudaMallocFromPoolAsync` calls. - """ - cdef cudaMemPool_t memPool = cudaMemPool_t() - cshareableHandle = utils.HelperInputVoidPtr(shareableHandle) - cdef void* cshareableHandle_ptr = cshareableHandle.cptr - cdef ccudart.cudaMemAllocationHandleType chandleType = handleType.value - err = ccudart.cudaMemPoolImportFromShareableHandle(memPool._ptr, cshareableHandle_ptr, chandleType, flags) - return (cudaError_t(err), memPool) -{{endif}} + - :py:obj:`~.cudaResourceViewDesc.firstMipmapLevel` specifies the most + detailed mipmap level. This will be the new mipmap level zero. For + non-mipmapped resources, this value has to be + zero.:py:obj:`~.cudaTextureDesc.minMipmapLevelClamp` and + :py:obj:`~.cudaTextureDesc.maxMipmapLevelClamp` will be relative to + this value. For ex., if the firstMipmapLevel is set to 2, and a + minMipmapLevelClamp of 1.2 is specified, then the actual minimum + mipmap level clamp will be 3.2. -{{if 'cudaMemPoolExportPointer' in found_functions}} + - :py:obj:`~.cudaResourceViewDesc.lastMipmapLevel` specifies the least + detailed mipmap level. For non-mipmapped resources, this value has to + be zero. -@cython.embedsignature(True) -def cudaMemPoolExportPointer(ptr): - """ Export data to share a memory pool allocation between processes. + - :py:obj:`~.cudaResourceViewDesc.firstLayer` specifies the first layer + index for layered textures. This will be the new layer zero. For non- + layered resources, this value has to be zero. - Constructs `shareData_out` for sharing a specific allocation from an - already shared memory pool. The recipient process can import the - allocation with the :py:obj:`~.cudaMemPoolImportPointer` api. The data - is not a handle and may be shared through any IPC mechanism. + - :py:obj:`~.cudaResourceViewDesc.lastLayer` specifies the last layer + index for layered textures. For non-layered resources, this value has + to be zero. Parameters ---------- - ptr : Any - pointer to memory being exported + pResDesc : :py:obj:`~.cudaResourceDesc` + Resource descriptor + pTexDesc : :py:obj:`~.cudaTextureDesc` + Texture descriptor + pResViewDesc : :py:obj:`~.cudaResourceViewDesc` + Resource view descriptor Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorOutOfMemory` - shareData_out : :py:obj:`~.cudaMemPoolPtrExportData` - Returned export data + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + pTexObject : :py:obj:`~.cudaTextureObject_t` + Texture object to create See Also -------- - :py:obj:`~.cuMemPoolExportPointer`, :py:obj:`~.cudaMemPoolExportToShareableHandle`, :py:obj:`~.cudaMemPoolImportFromShareableHandle`, :py:obj:`~.cudaMemPoolImportPointer` + :py:obj:`~.cudaDestroyTextureObject`, :py:obj:`~.cuTexObjectCreate` """ - cdef cudaMemPoolPtrExportData exportData = cudaMemPoolPtrExportData() - cptr = utils.HelperInputVoidPtr(ptr) - cdef void* cptr_ptr = cptr.cptr - err = ccudart.cudaMemPoolExportPointer(exportData._ptr, cptr_ptr) - return (cudaError_t(err), exportData) -{{endif}} - -{{if 'cudaMemPoolImportPointer' in found_functions}} + cdef cudaTextureObject_t pTexObject = cudaTextureObject_t() + cdef cyruntime.cudaResourceDesc* cypResDesc_ptr = pResDesc._pvt_ptr if pResDesc is not None else NULL + cdef cyruntime.cudaTextureDesc* cypTexDesc_ptr = pTexDesc._pvt_ptr if pTexDesc is not None else NULL + cdef cyruntime.cudaResourceViewDesc* cypResViewDesc_ptr = pResViewDesc._pvt_ptr if pResViewDesc is not None else NULL + with nogil: + err = cyruntime.cudaCreateTextureObject(pTexObject._pvt_ptr, cypResDesc_ptr, cypTexDesc_ptr, cypResViewDesc_ptr) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, pTexObject) @cython.embedsignature(True) -def cudaMemPoolImportPointer(memPool, exportData : Optional[cudaMemPoolPtrExportData]): - """ Import a memory pool allocation from another process. +def cudaDestroyTextureObject(texObject): + """ Destroys a texture object. - Returns in `ptr_out` a pointer to the imported memory. The imported - memory must not be accessed before the allocation operation completes - in the exporting process. The imported memory must be freed from all - importing processes before being freed in the exporting process. The - pointer may be freed with cudaFree or cudaFreeAsync. If - :py:obj:`~.cudaFreeAsync` is used, the free must be completed on the - importing process before the free operation on the exporting process. + Destroys the texture object specified by `texObject`. Parameters ---------- - pool : :py:obj:`~.CUmemoryPool` or :py:obj:`~.cudaMemPool_t` - pool from which to import - shareData : :py:obj:`~.cudaMemPoolPtrExportData` - data specifying the memory to import + texObject : :py:obj:`~.cudaTextureObject_t` + Texture object to destroy Returns ------- cudaError_t - :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_OUT_OF_MEMORY` - ptr_out : Any - pointer to imported memory + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` See Also -------- - :py:obj:`~.cuMemPoolImportPointer`, :py:obj:`~.cudaMemPoolExportToShareableHandle`, :py:obj:`~.cudaMemPoolImportFromShareableHandle`, :py:obj:`~.cudaMemPoolExportPointer` - - Notes - ----- - The :py:obj:`~.cudaFreeAsync` api may be used in the exporting process before the :py:obj:`~.cudaFreeAsync` operation completes in its stream as long as the :py:obj:`~.cudaFreeAsync` in the exporting process specifies a stream with a stream dependency on the importing process's :py:obj:`~.cudaFreeAsync`. + :py:obj:`~.cudaCreateTextureObject`, :py:obj:`~.cuTexObjectDestroy` """ - cdef ccudart.cudaMemPool_t cmemPool - if memPool is None: - cmemPool = 0 - elif isinstance(memPool, (cudaMemPool_t,cuda.CUmemoryPool)): - pmemPool = int(memPool) - cmemPool = pmemPool + cdef cyruntime.cudaTextureObject_t cytexObject + if texObject is None: + ptexObject = 0 + elif isinstance(texObject, (cudaTextureObject_t,)): + ptexObject = int(texObject) else: - pmemPool = int(cudaMemPool_t(memPool)) - cmemPool = pmemPool - cdef void_ptr ptr = 0 - cdef ccudart.cudaMemPoolPtrExportData* cexportData_ptr = exportData._ptr if exportData != None else NULL - err = ccudart.cudaMemPoolImportPointer(&ptr, cmemPool, cexportData_ptr) - return (cudaError_t(err), ptr) -{{endif}} - -{{if 'cudaPointerGetAttributes' in found_functions}} + ptexObject = int(cudaTextureObject_t(texObject)) + cytexObject = ptexObject + with nogil: + err = cyruntime.cudaDestroyTextureObject(cytexObject) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaPointerGetAttributes(ptr): - """ Returns attributes about a specified pointer. - - Returns in `*attributes` the attributes of the pointer `ptr`. If - pointer was not allocated in, mapped by or registered with context - supporting unified addressing :py:obj:`~.cudaErrorInvalidValue` is - returned. - - The :py:obj:`~.cudaPointerAttributes` structure is defined as: - - **View CUDA Toolkit Documentation for a C++ code example** - - In this structure, the individual fields mean - - - :py:obj:`~.cudaPointerAttributes.type` identifies type of memory. It - can be :py:obj:`~.cudaMemoryTypeUnregistered` for unregistered host - memory, :py:obj:`~.cudaMemoryTypeHost` for registered host memory, - :py:obj:`~.cudaMemoryTypeDevice` for device memory or - :py:obj:`~.cudaMemoryTypeManaged` for managed memory. - - - :py:obj:`~.device` is the device against which `ptr` was allocated. - If `ptr` has memory type :py:obj:`~.cudaMemoryTypeDevice` then this - identifies the device on which the memory referred to by `ptr` - physically resides. If `ptr` has memory type - :py:obj:`~.cudaMemoryTypeHost` then this identifies the device which - was current when the allocation was made (and if that device is - deinitialized then this allocation will vanish with that device's - state). - - - :py:obj:`~.devicePointer` is the device pointer alias through which - the memory referred to by `ptr` may be accessed on the current - device. If the memory referred to by `ptr` cannot be accessed - directly by the current device then this is NULL. +def cudaGetTextureObjectResourceDesc(texObject): + """ Returns a texture object's resource descriptor. - - :py:obj:`~.hostPointer` is the host pointer alias through which the - memory referred to by `ptr` may be accessed on the host. If the - memory referred to by `ptr` cannot be accessed directly by the host - then this is NULL. + Returns the resource descriptor for the texture object specified by + `texObject`. Parameters ---------- - ptr : Any - Pointer to get attributes for + texObject : :py:obj:`~.cudaTextureObject_t` + Texture object Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDevice`, :py:obj:`~.cudaErrorInvalidValue` - attributes : :py:obj:`~.cudaPointerAttributes` - Attributes for the specified pointer + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + pResDesc : :py:obj:`~.cudaResourceDesc` + Resource descriptor See Also -------- - :py:obj:`~.cudaGetDeviceCount`, :py:obj:`~.cudaGetDevice`, :py:obj:`~.cudaSetDevice`, :py:obj:`~.cudaChooseDevice`, :py:obj:`~.cudaInitDevice`, :py:obj:`~.cuPointerGetAttributes` - - Notes - ----- - In CUDA 11.0 forward passing host pointer will return :py:obj:`~.cudaMemoryTypeUnregistered` in :py:obj:`~.cudaPointerAttributes.type` and call will return :py:obj:`~.cudaSuccess`. + :py:obj:`~.cudaCreateTextureObject`, :py:obj:`~.cuTexObjectGetResourceDesc` """ - cdef cudaPointerAttributes attributes = cudaPointerAttributes() - cptr = utils.HelperInputVoidPtr(ptr) - cdef void* cptr_ptr = cptr.cptr - err = ccudart.cudaPointerGetAttributes(attributes._ptr, cptr_ptr) - return (cudaError_t(err), attributes) -{{endif}} - -{{if 'cudaDeviceCanAccessPeer' in found_functions}} + cdef cyruntime.cudaTextureObject_t cytexObject + if texObject is None: + ptexObject = 0 + elif isinstance(texObject, (cudaTextureObject_t,)): + ptexObject = int(texObject) + else: + ptexObject = int(cudaTextureObject_t(texObject)) + cytexObject = ptexObject + cdef cudaResourceDesc pResDesc = cudaResourceDesc() + with nogil: + err = cyruntime.cudaGetTextureObjectResourceDesc(pResDesc._pvt_ptr, cytexObject) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, pResDesc) @cython.embedsignature(True) -def cudaDeviceCanAccessPeer(int device, int peerDevice): - """ Queries if a device may directly access a peer device's memory. +def cudaGetTextureObjectTextureDesc(texObject): + """ Returns a texture object's texture descriptor. - Returns in `*canAccessPeer` a value of 1 if device `device` is capable - of directly accessing memory from `peerDevice` and 0 otherwise. If - direct access of `peerDevice` from `device` is possible, then access - may be enabled by calling :py:obj:`~.cudaDeviceEnablePeerAccess()`. + Returns the texture descriptor for the texture object specified by + `texObject`. Parameters ---------- - device : int - Device from which allocations on `peerDevice` are to be directly - accessed. - peerDevice : int - Device on which the allocations to be directly accessed by `device` - reside. + texObject : :py:obj:`~.cudaTextureObject_t` + Texture object Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDevice` - canAccessPeer : int - Returned access capability + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + pTexDesc : :py:obj:`~.cudaTextureDesc` + Texture descriptor See Also -------- - :py:obj:`~.cudaDeviceEnablePeerAccess`, :py:obj:`~.cudaDeviceDisablePeerAccess`, :py:obj:`~.cuDeviceCanAccessPeer` + :py:obj:`~.cudaCreateTextureObject`, :py:obj:`~.cuTexObjectGetTextureDesc` """ - cdef int canAccessPeer = 0 - err = ccudart.cudaDeviceCanAccessPeer(&canAccessPeer, device, peerDevice) - return (cudaError_t(err), canAccessPeer) -{{endif}} - -{{if 'cudaDeviceEnablePeerAccess' in found_functions}} + cdef cyruntime.cudaTextureObject_t cytexObject + if texObject is None: + ptexObject = 0 + elif isinstance(texObject, (cudaTextureObject_t,)): + ptexObject = int(texObject) + else: + ptexObject = int(cudaTextureObject_t(texObject)) + cytexObject = ptexObject + cdef cudaTextureDesc pTexDesc = cudaTextureDesc() + with nogil: + err = cyruntime.cudaGetTextureObjectTextureDesc(pTexDesc._pvt_ptr, cytexObject) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, pTexDesc) @cython.embedsignature(True) -def cudaDeviceEnablePeerAccess(int peerDevice, unsigned int flags): - """ Enables direct access to memory allocations on a peer device. - - On success, all allocations from `peerDevice` will immediately be - accessible by the current device. They will remain accessible until - access is explicitly disabled using - :py:obj:`~.cudaDeviceDisablePeerAccess()` or either device is reset - using :py:obj:`~.cudaDeviceReset()`. - - Note that access granted by this call is unidirectional and that in - order to access memory on the current device from `peerDevice`, a - separate symmetric call to :py:obj:`~.cudaDeviceEnablePeerAccess()` is - required. - - Note that there are both device-wide and system-wide limitations per - system configuration, as noted in the CUDA Programming Guide under the - section "Peer-to-Peer Memory Access". - - Returns :py:obj:`~.cudaErrorInvalidDevice` if - :py:obj:`~.cudaDeviceCanAccessPeer()` indicates that the current device - cannot directly access memory from `peerDevice`. - - Returns :py:obj:`~.cudaErrorPeerAccessAlreadyEnabled` if direct access - of `peerDevice` from the current device has already been enabled. +def cudaGetTextureObjectResourceViewDesc(texObject): + """ Returns a texture object's resource view descriptor. - Returns :py:obj:`~.cudaErrorInvalidValue` if `flags` is not 0. + Returns the resource view descriptor for the texture object specified + by `texObject`. If no resource view was specified, + :py:obj:`~.cudaErrorInvalidValue` is returned. Parameters ---------- - peerDevice : int - Peer device to enable direct access to from the current device - flags : unsigned int - Reserved for future use and must be set to 0 + texObject : :py:obj:`~.cudaTextureObject_t` + Texture object Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDevice`, :py:obj:`~.cudaErrorPeerAccessAlreadyEnabled`, :py:obj:`~.cudaErrorInvalidValue` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + pResViewDesc : :py:obj:`~.cudaResourceViewDesc` + Resource view descriptor See Also -------- - :py:obj:`~.cudaDeviceCanAccessPeer`, :py:obj:`~.cudaDeviceDisablePeerAccess`, :py:obj:`~.cuCtxEnablePeerAccess` + :py:obj:`~.cudaCreateTextureObject`, :py:obj:`~.cuTexObjectGetResourceViewDesc` """ - err = ccudart.cudaDeviceEnablePeerAccess(peerDevice, flags) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaDeviceDisablePeerAccess' in found_functions}} + cdef cyruntime.cudaTextureObject_t cytexObject + if texObject is None: + ptexObject = 0 + elif isinstance(texObject, (cudaTextureObject_t,)): + ptexObject = int(texObject) + else: + ptexObject = int(cudaTextureObject_t(texObject)) + cytexObject = ptexObject + cdef cudaResourceViewDesc pResViewDesc = cudaResourceViewDesc() + with nogil: + err = cyruntime.cudaGetTextureObjectResourceViewDesc(pResViewDesc._pvt_ptr, cytexObject) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, pResViewDesc) @cython.embedsignature(True) -def cudaDeviceDisablePeerAccess(int peerDevice): - """ Disables direct access to memory allocations on a peer device. +def cudaCreateSurfaceObject(pResDesc : Optional[cudaResourceDesc]): + """ Creates a surface object. - Returns :py:obj:`~.cudaErrorPeerAccessNotEnabled` if direct access to - memory on `peerDevice` has not yet been enabled from the current - device. + Creates a surface object and returns it in `pSurfObject`. `pResDesc` + describes the data to perform surface load/stores on. + :py:obj:`~.cudaResourceDesc.resType` must be + :py:obj:`~.cudaResourceTypeArray` and + :py:obj:`~.cudaResourceDesc.res.array.array` must be set to a valid + CUDA array handle. + + Surface objects are only supported on devices of compute capability 3.0 + or higher. Additionally, a surface object is an opaque value, and, as + such, should only be accessed through CUDA API calls. Parameters ---------- - peerDevice : int - Peer device to disable direct access to + pResDesc : :py:obj:`~.cudaResourceDesc` + Resource descriptor Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorPeerAccessNotEnabled`, :py:obj:`~.cudaErrorInvalidDevice` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidChannelDescriptor`, :py:obj:`~.cudaErrorInvalidResourceHandle` + pSurfObject : :py:obj:`~.cudaSurfaceObject_t` + Surface object to create See Also -------- - :py:obj:`~.cudaDeviceCanAccessPeer`, :py:obj:`~.cudaDeviceEnablePeerAccess`, :py:obj:`~.cuCtxDisablePeerAccess` + :py:obj:`~.cudaDestroySurfaceObject`, :py:obj:`~.cuSurfObjectCreate` """ - err = ccudart.cudaDeviceDisablePeerAccess(peerDevice) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaGraphicsUnregisterResource' in found_functions}} + cdef cudaSurfaceObject_t pSurfObject = cudaSurfaceObject_t() + cdef cyruntime.cudaResourceDesc* cypResDesc_ptr = pResDesc._pvt_ptr if pResDesc is not None else NULL + with nogil: + err = cyruntime.cudaCreateSurfaceObject(pSurfObject._pvt_ptr, cypResDesc_ptr) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, pSurfObject) @cython.embedsignature(True) -def cudaGraphicsUnregisterResource(resource): - """ Unregisters a graphics resource for access by CUDA. - - Unregisters the graphics resource `resource` so it is not accessible by - CUDA unless registered again. +def cudaDestroySurfaceObject(surfObject): + """ Destroys a surface object. - If `resource` is invalid then - :py:obj:`~.cudaErrorInvalidResourceHandle` is returned. + Destroys the surface object specified by `surfObject`. Parameters ---------- - resource : :py:obj:`~.cudaGraphicsResource_t` - Resource to unregister + surfObject : :py:obj:`~.cudaSurfaceObject_t` + Surface object to destroy Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorUnknown` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` See Also -------- - :py:obj:`~.cudaGraphicsD3D9RegisterResource`, :py:obj:`~.cudaGraphicsD3D10RegisterResource`, :py:obj:`~.cudaGraphicsD3D11RegisterResource`, :py:obj:`~.cudaGraphicsGLRegisterBuffer`, :py:obj:`~.cudaGraphicsGLRegisterImage`, :py:obj:`~.cuGraphicsUnregisterResource` + :py:obj:`~.cudaCreateSurfaceObject`, :py:obj:`~.cuSurfObjectDestroy` """ - cdef ccudart.cudaGraphicsResource_t cresource - if resource is None: - cresource = 0 - elif isinstance(resource, (cudaGraphicsResource_t,)): - presource = int(resource) - cresource = presource + cdef cyruntime.cudaSurfaceObject_t cysurfObject + if surfObject is None: + psurfObject = 0 + elif isinstance(surfObject, (cudaSurfaceObject_t,)): + psurfObject = int(surfObject) else: - presource = int(cudaGraphicsResource_t(resource)) - cresource = presource - err = ccudart.cudaGraphicsUnregisterResource(cresource) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaGraphicsResourceSetMapFlags' in found_functions}} + psurfObject = int(cudaSurfaceObject_t(surfObject)) + cysurfObject = psurfObject + with nogil: + err = cyruntime.cudaDestroySurfaceObject(cysurfObject) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaGraphicsResourceSetMapFlags(resource, unsigned int flags): - """ Set usage flags for mapping a graphics resource. - - Set `flags` for mapping the graphics resource `resource`. - - Changes to `flags` will take effect the next time `resource` is mapped. - The `flags` argument may be any of the following: - - - :py:obj:`~.cudaGraphicsMapFlagsNone`: Specifies no hints about how - `resource` will be used. It is therefore assumed that CUDA may read - from or write to `resource`. - - - :py:obj:`~.cudaGraphicsMapFlagsReadOnly`: Specifies that CUDA will - not write to `resource`. - - - :py:obj:`~.cudaGraphicsMapFlagsWriteDiscard`: Specifies CUDA will not - read from `resource` and will write over the entire contents of - `resource`, so none of the data previously stored in `resource` will - be preserved. - - If `resource` is presently mapped for access by CUDA then - :py:obj:`~.cudaErrorUnknown` is returned. If `flags` is not one of the - above values then :py:obj:`~.cudaErrorInvalidValue` is returned. +def cudaGetSurfaceObjectResourceDesc(surfObject): + """ Returns a surface object's resource descriptor Returns the resource descriptor for the surface object specified by `surfObject`. Parameters ---------- - resource : :py:obj:`~.cudaGraphicsResource_t` - Registered resource to set flags for - flags : unsigned int - Parameters for resource mapping + surfObject : :py:obj:`~.cudaSurfaceObject_t` + Surface object Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorUnknown`, + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + pResDesc : :py:obj:`~.cudaResourceDesc` + Resource descriptor See Also -------- - :py:obj:`~.cudaGraphicsMapResources`, :py:obj:`~.cuGraphicsResourceSetMapFlags` + :py:obj:`~.cudaCreateSurfaceObject`, :py:obj:`~.cuSurfObjectGetResourceDesc` """ - cdef ccudart.cudaGraphicsResource_t cresource - if resource is None: - cresource = 0 - elif isinstance(resource, (cudaGraphicsResource_t,)): - presource = int(resource) - cresource = presource + cdef cyruntime.cudaSurfaceObject_t cysurfObject + if surfObject is None: + psurfObject = 0 + elif isinstance(surfObject, (cudaSurfaceObject_t,)): + psurfObject = int(surfObject) else: - presource = int(cudaGraphicsResource_t(resource)) - cresource = presource - err = ccudart.cudaGraphicsResourceSetMapFlags(cresource, flags) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaGraphicsMapResources' in found_functions}} + psurfObject = int(cudaSurfaceObject_t(surfObject)) + cysurfObject = psurfObject + cdef cudaResourceDesc pResDesc = cudaResourceDesc() + with nogil: + err = cyruntime.cudaGetSurfaceObjectResourceDesc(pResDesc._pvt_ptr, cysurfObject) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, pResDesc) @cython.embedsignature(True) -def cudaGraphicsMapResources(int count, resources, stream): - """ Map graphics resources for access by CUDA. - - Maps the `count` graphics resources in `resources` for access by CUDA. - - The resources in `resources` may be accessed by CUDA until they are - unmapped. The graphics API from which `resources` were registered - should not access any resources while they are mapped by CUDA. If an - application does so, the results are undefined. - - This function provides the synchronization guarantee that any graphics - calls issued before :py:obj:`~.cudaGraphicsMapResources()` will - complete before any subsequent CUDA work issued in `stream` begins. +def cudaDriverGetVersion(): + """ Returns the latest version of CUDA supported by the driver. - If `resources` contains any duplicate entries then - :py:obj:`~.cudaErrorInvalidResourceHandle` is returned. If any of - `resources` are presently mapped for access by CUDA then - :py:obj:`~.cudaErrorUnknown` is returned. + Returns in `*driverVersion` the latest version of CUDA supported by the + driver. The version is returned as (1000 * major + 10 * minor). For + example, CUDA 9.2 would be represented by 9020. If no driver is + installed, then 0 is returned as the driver version. - Parameters - ---------- - count : int - Number of resources to map - resources : :py:obj:`~.cudaGraphicsResource_t` - Resources to map for CUDA - stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` - Stream for synchronization + This function automatically returns :py:obj:`~.cudaErrorInvalidValue` + if `driverVersion` is NULL. Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorUnknown` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + driverVersion : int + Returns the CUDA driver version. See Also -------- - :py:obj:`~.cudaGraphicsResourceGetMappedPointer`, :py:obj:`~.cudaGraphicsSubResourceGetMappedArray`, :py:obj:`~.cudaGraphicsUnmapResources`, :py:obj:`~.cuGraphicsMapResources` + :py:obj:`~.cudaRuntimeGetVersion`, :py:obj:`~.cuDriverGetVersion` """ - cdef ccudart.cudaStream_t cstream - if stream is None: - cstream = 0 - elif isinstance(stream, (cudaStream_t,cuda.CUstream)): - pstream = int(stream) - cstream = pstream - else: - pstream = int(cudaStream_t(stream)) - cstream = pstream - cdef ccudart.cudaGraphicsResource_t *cresources - if resources is None: - cresources = NULL - elif isinstance(resources, (cudaGraphicsResource_t,)): - presources = resources.getPtr() - cresources = presources - elif isinstance(resources, (int)): - cresources = resources - else: - raise TypeError("Argument 'resources' is not instance of type (expected , found " + str(type(resources))) - err = ccudart.cudaGraphicsMapResources(count, cresources, cstream) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaGraphicsUnmapResources' in found_functions}} + cdef int driverVersion = 0 + with nogil: + err = cyruntime.cudaDriverGetVersion(&driverVersion) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, driverVersion) @cython.embedsignature(True) -def cudaGraphicsUnmapResources(int count, resources, stream): - """ Unmap graphics resources. - - Unmaps the `count` graphics resources in `resources`. - - Once unmapped, the resources in `resources` may not be accessed by CUDA - until they are mapped again. +def cudaRuntimeGetVersion(): + """ Returns the CUDA Runtime version. - This function provides the synchronization guarantee that any CUDA work - issued in `stream` before :py:obj:`~.cudaGraphicsUnmapResources()` will - complete before any subsequently issued graphics work begins. + Returns in `*runtimeVersion` the version number of the current CUDA + Runtime instance. The version is returned as (1000 * major + 10 * + minor). For example, CUDA 9.2 would be represented by 9020. - If `resources` contains any duplicate entries then - :py:obj:`~.cudaErrorInvalidResourceHandle` is returned. If any of - `resources` are not presently mapped for access by CUDA then - :py:obj:`~.cudaErrorUnknown` is returned. + As of CUDA 12.0, this function no longer initializes CUDA. The purpose + of this API is solely to return a compile-time constant stating the + CUDA Toolkit version in the above format. - Parameters - ---------- - count : int - Number of resources to unmap - resources : :py:obj:`~.cudaGraphicsResource_t` - Resources to unmap - stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` - Stream for synchronization + This function automatically returns :py:obj:`~.cudaErrorInvalidValue` + if the `runtimeVersion` argument is NULL. Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorUnknown` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + runtimeVersion : int + Returns the CUDA Runtime version. See Also -------- - :py:obj:`~.cudaGraphicsMapResources`, :py:obj:`~.cuGraphicsUnmapResources` + :py:obj:`~.cudaDriverGetVersion`, :py:obj:`~.cuDriverGetVersion` """ - cdef ccudart.cudaStream_t cstream - if stream is None: - cstream = 0 - elif isinstance(stream, (cudaStream_t,cuda.CUstream)): - pstream = int(stream) - cstream = pstream - else: - pstream = int(cudaStream_t(stream)) - cstream = pstream - cdef ccudart.cudaGraphicsResource_t *cresources - if resources is None: - cresources = NULL - elif isinstance(resources, (cudaGraphicsResource_t,)): - presources = resources.getPtr() - cresources = presources - elif isinstance(resources, (int)): - cresources = resources - else: - raise TypeError("Argument 'resources' is not instance of type (expected , found " + str(type(resources))) - err = ccudart.cudaGraphicsUnmapResources(count, cresources, cstream) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaGraphicsResourceGetMappedPointer' in found_functions}} + cdef int runtimeVersion = 0 + with nogil: + err = cyruntime.cudaRuntimeGetVersion(&runtimeVersion) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, runtimeVersion) @cython.embedsignature(True) -def cudaGraphicsResourceGetMappedPointer(resource): - """ Get an device pointer through which to access a mapped graphics resource. - - Returns in `*devPtr` a pointer through which the mapped graphics - resource `resource` may be accessed. Returns in `*size` the size of the - memory in bytes which may be accessed from that pointer. The value set - in `devPtr` may change every time that `resource` is mapped. - - If `resource` is not a buffer then it cannot be accessed via a pointer - and :py:obj:`~.cudaErrorUnknown` is returned. If `resource` is not - mapped then :py:obj:`~.cudaErrorUnknown` is returned. +def cudaLogsRegisterCallback(callbackFunc, userData): + """ Register a callback function to receive error log messages. Parameters ---------- - resource : :py:obj:`~.cudaGraphicsResource_t` - None + callbackFunc : :py:obj:`~.cudaLogsCallback_t` + The function to register as a callback + userData : Any + A generic pointer to user data. This is passed into the callback + function. Returns ------- cudaError_t - - devPtr : Any - None - size : int - None + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, + callback_out : :py:obj:`~.cudaLogsCallbackHandle` + Optional location to store the callback handle after it is + registered """ - cdef ccudart.cudaGraphicsResource_t cresource - if resource is None: - cresource = 0 - elif isinstance(resource, (cudaGraphicsResource_t,)): - presource = int(resource) - cresource = presource + cdef cyruntime.cudaLogsCallback_t cycallbackFunc + if callbackFunc is None: + pcallbackFunc = 0 + elif isinstance(callbackFunc, (cudaLogsCallback_t,)): + pcallbackFunc = int(callbackFunc) else: - presource = int(cudaGraphicsResource_t(resource)) - cresource = presource - cdef void_ptr devPtr = 0 - cdef size_t size = 0 - err = ccudart.cudaGraphicsResourceGetMappedPointer(&devPtr, &size, cresource) - return (cudaError_t(err), devPtr, size) -{{endif}} - -{{if 'cudaGraphicsSubResourceGetMappedArray' in found_functions}} + pcallbackFunc = int(cudaLogsCallback_t(callbackFunc)) + cycallbackFunc = pcallbackFunc + cdef _HelperInputVoidPtrStruct cyuserDataHelper + cdef void* cyuserData = _helper_input_void_ptr(userData, &cyuserDataHelper) + cdef cudaLogsCallbackHandle callback_out = cudaLogsCallbackHandle() + with nogil: + err = cyruntime.cudaLogsRegisterCallback(cycallbackFunc, cyuserData, callback_out._pvt_ptr) + _helper_input_void_ptr_free(&cyuserDataHelper) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, callback_out) @cython.embedsignature(True) -def cudaGraphicsSubResourceGetMappedArray(resource, unsigned int arrayIndex, unsigned int mipLevel): - """ Get an array through which to access a subresource of a mapped graphics resource. - - Returns in `*array` an array through which the subresource of the - mapped graphics resource `resource` which corresponds to array index - `arrayIndex` and mipmap level `mipLevel` may be accessed. The value set - in `array` may change every time that `resource` is mapped. - - If `resource` is not a texture then it cannot be accessed via an array - and :py:obj:`~.cudaErrorUnknown` is returned. If `arrayIndex` is not a - valid array index for `resource` then :py:obj:`~.cudaErrorInvalidValue` - is returned. If `mipLevel` is not a valid mipmap level for `resource` - then :py:obj:`~.cudaErrorInvalidValue` is returned. If `resource` is - not mapped then :py:obj:`~.cudaErrorUnknown` is returned. +def cudaLogsUnregisterCallback(callback): + """ Unregister a log message callback. Parameters ---------- - resource : :py:obj:`~.cudaGraphicsResource_t` - Mapped resource to access - arrayIndex : unsigned int - Array index for array textures or cubemap face index as defined by - :py:obj:`~.cudaGraphicsCubeFace` for cubemap textures for the - subresource to access - mipLevel : unsigned int - Mipmap level for the subresource to access + callback : :py:obj:`~.cudaLogsCallbackHandle` + The callback instance to unregister from receiving log messages Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorUnknown` - array : :py:obj:`~.cudaArray_t` - Returned array through which a subresource of `resource` may be - accessed - - See Also - -------- - :py:obj:`~.cudaGraphicsResourceGetMappedPointer`, :py:obj:`~.cuGraphicsSubResourceGetMappedArray` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, """ - cdef ccudart.cudaGraphicsResource_t cresource - if resource is None: - cresource = 0 - elif isinstance(resource, (cudaGraphicsResource_t,)): - presource = int(resource) - cresource = presource + cdef cyruntime.cudaLogsCallbackHandle cycallback + if callback is None: + pcallback = 0 + elif isinstance(callback, (cudaLogsCallbackHandle,)): + pcallback = int(callback) else: - presource = int(cudaGraphicsResource_t(resource)) - cresource = presource - cdef cudaArray_t array = cudaArray_t() - err = ccudart.cudaGraphicsSubResourceGetMappedArray(array._ptr, cresource, arrayIndex, mipLevel) - return (cudaError_t(err), array) -{{endif}} - -{{if 'cudaGraphicsResourceGetMappedMipmappedArray' in found_functions}} + pcallback = int(cudaLogsCallbackHandle(callback)) + cycallback = pcallback + with nogil: + err = cyruntime.cudaLogsUnregisterCallback(cycallback) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaGraphicsResourceGetMappedMipmappedArray(resource): - """ Get a mipmapped array through which to access a mapped graphics resource. +def cudaLogsCurrent(unsigned int flags): + """ Sets log iterator to point to the end of log buffer, where the next message would be written. - Returns in `*mipmappedArray` a mipmapped array through which the mapped - graphics resource `resource` may be accessed. The value set in - `mipmappedArray` may change every time that `resource` is mapped. + Parameters + ---------- + flags : unsigned int + Reserved for future use, must be 0 + + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, + iterator_out : :py:obj:`~.cudaLogIterator` + Location to store an iterator to the current tail of the logs + """ + cdef cudaLogIterator iterator_out = cudaLogIterator() + with nogil: + err = cyruntime.cudaLogsCurrent(iterator_out._pvt_ptr, flags) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, iterator_out) - If `resource` is not a texture then it cannot be accessed via an array - and :py:obj:`~.cudaErrorUnknown` is returned. If `resource` is not - mapped then :py:obj:`~.cudaErrorUnknown` is returned. +@cython.embedsignature(True) +def cudaLogsDumpToFile(iterator : Optional[cudaLogIterator], char* pathToFile, unsigned int flags): + """ Dump accumulated driver logs into a file. + + Logs generated by the driver are stored in an internal buffer and can + be copied out using this API. This API dumps all driver logs starting + from `iterator` into `pathToFile` provided. Parameters ---------- - resource : :py:obj:`~.cudaGraphicsResource_t` - Mapped resource to access + iterator : :py:obj:`~.cudaLogIterator` + Optional auto-advancing iterator specifying the starting log to + read. NULL value dumps all logs. + pathToFile : bytes + Path to output file for dumping logs + flags : unsigned int + Reserved for future use, must be 0 Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorUnknown` - mipmappedArray : :py:obj:`~.cudaMipmappedArray_t` - Returned mipmapped array through which `resource` may be accessed + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, + iterator : :py:obj:`~.cudaLogIterator` + Optional auto-advancing iterator specifying the starting log to + read. NULL value dumps all logs. - See Also - -------- - :py:obj:`~.cudaGraphicsResourceGetMappedPointer`, :py:obj:`~.cuGraphicsResourceGetMappedMipmappedArray` + Notes + ----- + `iterator` is auto-advancing. Dumping logs will update the value of `iterator` to receive the next generated log. + + The driver reserves limited memory for storing logs. The oldest logs may be overwritten and become unrecoverable. An indication will appear in the destination outupt if the logs have been truncated. Call dump after each failed API to mitigate this risk. """ - cdef ccudart.cudaGraphicsResource_t cresource - if resource is None: - cresource = 0 - elif isinstance(resource, (cudaGraphicsResource_t,)): - presource = int(resource) - cresource = presource - else: - presource = int(cudaGraphicsResource_t(resource)) - cresource = presource - cdef cudaMipmappedArray_t mipmappedArray = cudaMipmappedArray_t() - err = ccudart.cudaGraphicsResourceGetMappedMipmappedArray(mipmappedArray._ptr, cresource) - return (cudaError_t(err), mipmappedArray) -{{endif}} + cdef cyruntime.cudaLogIterator* cyiterator = NULL + if iterator is not None: + cyiterator = iterator._pvt_ptr + with nogil: + err = cyruntime.cudaLogsDumpToFile(cyiterator, pathToFile, flags) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, iterator) + +@cython.embedsignature(True) +def cudaLogsDumpToMemory(iterator : Optional[cudaLogIterator], char* buffer, size_t size, unsigned int flags): + """ Dump accumulated driver logs into a buffer. + + Logs generated by the driver are stored in an internal buffer and can + be copied out using this API. This API dumps driver logs from + `iterator` into `buffer` up to the size specified in `*size`. The + driver will always null terminate the buffer but there will not be a + null character between log entries, only a newline \n. The driver will + then return the actual number of bytes written in `*size`, excluding + the null terminator. If there are no messages to dump, `*size` will be + set to 0 and the function will return :py:obj:`~.CUDA_SUCCESS`. If the + provided `buffer` is not large enough to hold any messages, `*size` + will be set to 0 and the function will return + :py:obj:`~.CUDA_ERROR_INVALID_VALUE`. + + Parameters + ---------- + iterator : :py:obj:`~.cudaLogIterator` + Optional auto-advancing iterator specifying the starting log to + read. NULL value dumps all logs. + buffer : bytes + Pointer to dump logs + size : int + See description + flags : unsigned int + Reserved for future use, must be 0 + + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, + iterator : :py:obj:`~.cudaLogIterator` + Optional auto-advancing iterator specifying the starting log to + read. NULL value dumps all logs. + size : int + See description + + Notes + ----- + `iterator` is auto-advancing. Dumping logs will update the value of `iterator` to receive the next generated log. -{{if 'cudaGetChannelDesc' in found_functions}} + The driver reserves limited memory for storing logs. The maximum size of the buffer is 25600 bytes. The oldest logs may be overwritten and become unrecoverable. An indication will appear in the destination outupt if the logs have been truncated. Call dump after each failed API to mitigate this risk. + + If the provided value in `*size` is not large enough to hold all buffered messages, a message will be added at the head of the buffer indicating this. The driver then computes the number of messages it is able to store in `buffer` and writes it out. The final message in `buffer` will always be the most recent log message as of when the API is called. + """ + cdef cyruntime.cudaLogIterator* cyiterator = NULL + if iterator is not None: + cyiterator = iterator._pvt_ptr + with nogil: + err = cyruntime.cudaLogsDumpToMemory(cyiterator, buffer, &size, flags) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None, None) + return (_cudaError_t_SUCCESS, iterator, size) @cython.embedsignature(True) -def cudaGetChannelDesc(array): - """ Get the channel descriptor of an array. +def cudaGraphCreate(unsigned int flags): + """ Creates a graph. - Returns in `*desc` the channel descriptor of the CUDA array `array`. + Creates an empty graph, which is returned via `pGraph`. Parameters ---------- - array : :py:obj:`~.cudaArray_const_t` - Memory array on device + flags : unsigned int + Graph creation flags, must be 0 Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` - desc : :py:obj:`~.cudaChannelFormatDesc` - Channel format + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorMemoryAllocation` + pGraph : :py:obj:`~.cudaGraph_t` + Returns newly created graph See Also -------- - :py:obj:`~.cudaCreateChannelDesc (C API)`, :py:obj:`~.cudaCreateTextureObject`, :py:obj:`~.cudaCreateSurfaceObject` + :py:obj:`~.cudaGraphAddChildGraphNode`, :py:obj:`~.cudaGraphAddEmptyNode`, :py:obj:`~.cudaGraphAddKernelNode`, :py:obj:`~.cudaGraphAddHostNode`, :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphAddMemsetNode`, :py:obj:`~.cudaGraphInstantiate`, :py:obj:`~.cudaGraphDestroy`, :py:obj:`~.cudaGraphGetNodes`, :py:obj:`~.cudaGraphGetRootNodes`, :py:obj:`~.cudaGraphGetEdges`, :py:obj:`~.cudaGraphClone` """ - cdef ccudart.cudaArray_const_t carray - if array is None: - carray = 0 - elif isinstance(array, (cudaArray_const_t,)): - parray = int(array) - carray = parray - else: - parray = int(cudaArray_const_t(array)) - carray = parray - cdef cudaChannelFormatDesc desc = cudaChannelFormatDesc() + cdef cudaGraph_t pGraph = cudaGraph_t() with nogil: - err = ccudart.cudaGetChannelDesc(desc._ptr, carray) - - return (cudaError_t(err), desc) -{{endif}} - -{{if 'cudaCreateChannelDesc' in found_functions}} + err = cyruntime.cudaGraphCreate(pGraph._pvt_ptr, flags) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, pGraph) @cython.embedsignature(True) -def cudaCreateChannelDesc(int x, int y, int z, int w, f not None : cudaChannelFormatKind): - """ Returns a channel descriptor using the specified format. +def cudaGraphAddKernelNode(graph, pDependencies : Optional[tuple[cudaGraphNode_t] | list[cudaGraphNode_t]], size_t numDependencies, pNodeParams : Optional[cudaKernelNodeParams]): + """ Creates a kernel execution node and adds it to a graph. - Returns a channel descriptor with format `f` and number of bits of each - component `x`, `y`, `z`, and `w`. The :py:obj:`~.cudaChannelFormatDesc` - is defined as: + Creates a new kernel execution node and adds it to `graph` with + `numDependencies` dependencies specified via `pDependencies` and + arguments specified in `pNodeParams`. It is possible for + `numDependencies` to be 0, in which case the node will be placed at the + root of the graph. `pDependencies` may not have any duplicate entries. + A handle to the new node will be returned in `pGraphNode`. + + The :py:obj:`~.cudaKernelNodeParams` structure is defined as: **View CUDA Toolkit Documentation for a C++ code example** - where :py:obj:`~.cudaChannelFormatKind` is one of - :py:obj:`~.cudaChannelFormatKindSigned`, - :py:obj:`~.cudaChannelFormatKindUnsigned`, or - :py:obj:`~.cudaChannelFormatKindFloat`. + When the graph is launched, the node will invoke kernel `func` on a + (`gridDim.x` x `gridDim.y` x `gridDim.z`) grid of blocks. Each block + contains (`blockDim.x` x `blockDim.y` x `blockDim.z`) threads. + + `sharedMem` sets the amount of dynamic shared memory that will be + available to each thread block. + + Kernel parameters to `func` can be specified in one of two ways: + + 1) Kernel parameters can be specified via `kernelParams`. If the kernel + has N parameters, then `kernelParams` needs to be an array of N + pointers. Each pointer, from `kernelParams`[0] to `kernelParams`[N-1], + points to the region of memory from which the actual parameter will be + copied. The number of kernel parameters and their offsets and sizes do + not need to be specified as that information is retrieved directly from + the kernel's image. + + 2) Kernel parameters can also be packaged by the application into a + single buffer that is passed in via `extra`. This places the burden on + the application of knowing each kernel parameter's size and + alignment/padding within the buffer. The `extra` parameter exists to + allow this function to take additional less commonly used arguments. + `extra` specifies a list of names of extra settings and their + corresponding values. Each extra setting name is immediately followed + by the corresponding value. The list must be terminated with either + NULL or CU_LAUNCH_PARAM_END. + + - :py:obj:`~.CU_LAUNCH_PARAM_END`, which indicates the end of the + `extra` array; + + - :py:obj:`~.CU_LAUNCH_PARAM_BUFFER_POINTER`, which specifies that the + next value in `extra` will be a pointer to a buffer containing all + the kernel parameters for launching kernel `func`; + + - :py:obj:`~.CU_LAUNCH_PARAM_BUFFER_SIZE`, which specifies that the + next value in `extra` will be a pointer to a size_t containing the + size of the buffer specified with + :py:obj:`~.CU_LAUNCH_PARAM_BUFFER_POINTER`; + + The error :py:obj:`~.cudaErrorInvalidValue` will be returned if kernel + parameters are specified with both `kernelParams` and `extra` (i.e. + both `kernelParams` and `extra` are non-NULL). + + The `kernelParams` or `extra` array, as well as the argument values it + points to, are copied during this call. Parameters ---------- - x : int - X component - y : int - Y component - z : int - Z component - w : int - W component - f : :py:obj:`~.cudaChannelFormatKind` - Channel format + graph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` + Graph to which to add the node + pDependencies : list[:py:obj:`~.cudaGraphNode_t`] + Dependencies of the node + numDependencies : size_t + Number of dependencies + pNodeParams : :py:obj:`~.cudaKernelNodeParams` + Parameters for the GPU execution node Returns ------- - cudaError_t.cudaSuccess - cudaError_t.cudaSuccess - :py:obj:`~.cudaChannelFormatDesc` - Channel descriptor with format `f` + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidDeviceFunction` + pGraphNode : :py:obj:`~.cudaGraphNode_t` + Returns newly created node See Also -------- - cudaCreateChannelDesc (C++ API), :py:obj:`~.cudaGetChannelDesc`, :py:obj:`~.cudaCreateTextureObject`, :py:obj:`~.cudaCreateSurfaceObject` - """ - cdef ccudart.cudaChannelFormatKind cf = f.value - err = ccudart.cudaCreateChannelDesc(x, y, z, w, cf) - cdef cudaChannelFormatDesc wrapper = cudaChannelFormatDesc() - wrapper._ptr[0] = err - return (cudaError_t.cudaSuccess, wrapper) -{{endif}} + :py:obj:`~.cudaGraphAddNode`, :py:obj:`~.cudaLaunchKernel`, :py:obj:`~.cudaGraphKernelNodeGetParams`, :py:obj:`~.cudaGraphKernelNodeSetParams`, :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphDestroyNode`, :py:obj:`~.cudaGraphAddChildGraphNode`, :py:obj:`~.cudaGraphAddEmptyNode`, :py:obj:`~.cudaGraphAddHostNode`, :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphAddMemsetNode` -{{if 'cudaCreateTextureObject' in found_functions}} + Notes + ----- + Kernels launched using graphs must not use texture and surface references. Reading or writing through any texture or surface reference is undefined behavior. This restriction does not apply to texture and surface objects. + """ + pDependencies = [] if pDependencies is None else pDependencies + if not all(isinstance(_x, (cudaGraphNode_t,driver.CUgraphNode)) for _x in pDependencies): + raise TypeError("Argument 'pDependencies' is not instance of type (expected tuple[cyruntime.cudaGraphNode_t,driver.CUgraphNode] or list[cyruntime.cudaGraphNode_t,driver.CUgraphNode]") + cdef cyruntime.cudaGraph_t cygraph + if graph is None: + pgraph = 0 + elif isinstance(graph, (cudaGraph_t,driver.CUgraph)): + pgraph = int(graph) + else: + pgraph = int(cudaGraph_t(graph)) + cygraph = pgraph + cdef cudaGraphNode_t pGraphNode = cudaGraphNode_t() + cdef cyruntime.cudaGraphNode_t* cypDependencies = NULL + if len(pDependencies) > 1: + cypDependencies = calloc(len(pDependencies), sizeof(cyruntime.cudaGraphNode_t)) + if cypDependencies is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(pDependencies)) + 'x' + str(sizeof(cyruntime.cudaGraphNode_t))) + else: + for idx in range(len(pDependencies)): + cypDependencies[idx] = (pDependencies[idx])._pvt_ptr[0] + elif len(pDependencies) == 1: + cypDependencies = (pDependencies[0])._pvt_ptr + if numDependencies > len(pDependencies): raise RuntimeError("List is too small: " + str(len(pDependencies)) + " < " + str(numDependencies)) + cdef cyruntime.cudaKernelNodeParams* cypNodeParams_ptr = pNodeParams._pvt_ptr if pNodeParams is not None else NULL + with nogil: + err = cyruntime.cudaGraphAddKernelNode(pGraphNode._pvt_ptr, cygraph, cypDependencies, numDependencies, cypNodeParams_ptr) + if len(pDependencies) > 1 and cypDependencies is not NULL: + free(cypDependencies) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, pGraphNode) @cython.embedsignature(True) -def cudaCreateTextureObject(pResDesc : Optional[cudaResourceDesc], pTexDesc : Optional[cudaTextureDesc], pResViewDesc : Optional[cudaResourceViewDesc]): - """ Creates a texture object. - - Creates a texture object and returns it in `pTexObject`. `pResDesc` - describes the data to texture from. `pTexDesc` describes how the data - should be sampled. `pResViewDesc` is an optional argument that - specifies an alternate format for the data described by `pResDesc`, and - also describes the subresource region to restrict access to when - texturing. `pResViewDesc` can only be specified if the type of resource - is a CUDA array or a CUDA mipmapped array not in a block compressed - format. - - Texture objects are only supported on devices of compute capability 3.0 - or higher. Additionally, a texture object is an opaque value, and, as - such, should only be accessed through CUDA API calls. - - The :py:obj:`~.cudaResourceDesc` structure is defined as: - - **View CUDA Toolkit Documentation for a C++ code example** - - where: +def cudaGraphKernelNodeGetParams(node): + """ Returns a kernel node's parameters. - - :py:obj:`~.cudaResourceDesc.resType` specifies the type of resource - to texture from. CUresourceType is defined as: + Returns the parameters of kernel node `node` in `pNodeParams`. The + `kernelParams` or `extra` array returned in `pNodeParams`, as well as + the argument values it points to, are owned by the node. This memory + remains valid until the node is destroyed or its parameters are + modified, and should not be modified directly. Use + :py:obj:`~.cudaGraphKernelNodeSetParams` to update the parameters of + this node. - - **View CUDA Toolkit Documentation for a C++ code example** + The params will contain either `kernelParams` or `extra`, according to + which of these was most recently set on the node. - If :py:obj:`~.cudaResourceDesc.resType` is set to - :py:obj:`~.cudaResourceTypeArray`, - :py:obj:`~.cudaResourceDesc`::res::array::array must be set to a valid - CUDA array handle. + Parameters + ---------- + node : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` + Node to get the parameters for - If :py:obj:`~.cudaResourceDesc.resType` is set to - :py:obj:`~.cudaResourceTypeMipmappedArray`, - :py:obj:`~.cudaResourceDesc`::res::mipmap::mipmap must be set to a - valid CUDA mipmapped array handle and - :py:obj:`~.cudaTextureDesc.normalizedCoords` must be set to true. + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidDeviceFunction` + pNodeParams : :py:obj:`~.cudaKernelNodeParams` + Pointer to return the parameters - If :py:obj:`~.cudaResourceDesc.resType` is set to - :py:obj:`~.cudaResourceTypeLinear`, - :py:obj:`~.cudaResourceDesc`::res::linear::devPtr must be set to a - valid device pointer, that is aligned to - :py:obj:`~.cudaDeviceProp.textureAlignment`. - :py:obj:`~.cudaResourceDesc`::res::linear::desc describes the format - and the number of components per array element. - :py:obj:`~.cudaResourceDesc`::res::linear::sizeInBytes specifies the - size of the array in bytes. The total number of elements in the linear - address range cannot exceed - :py:obj:`~.cudaDeviceProp.maxTexture1DLinear`. The number of elements - is computed as (sizeInBytes / sizeof(desc)). + See Also + -------- + :py:obj:`~.cudaGraphNodeGetParams`, :py:obj:`~.cudaLaunchKernel`, :py:obj:`~.cudaGraphAddKernelNode`, :py:obj:`~.cudaGraphKernelNodeSetParams` + """ + cdef cyruntime.cudaGraphNode_t cynode + if node is None: + pnode = 0 + elif isinstance(node, (cudaGraphNode_t,driver.CUgraphNode)): + pnode = int(node) + else: + pnode = int(cudaGraphNode_t(node)) + cynode = pnode + cdef cudaKernelNodeParams pNodeParams = cudaKernelNodeParams() + with nogil: + err = cyruntime.cudaGraphKernelNodeGetParams(cynode, pNodeParams._pvt_ptr) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, pNodeParams) - If :py:obj:`~.cudaResourceDesc.resType` is set to - :py:obj:`~.cudaResourceTypePitch2D`, - :py:obj:`~.cudaResourceDesc`::res::pitch2D::devPtr must be set to a - valid device pointer, that is aligned to - :py:obj:`~.cudaDeviceProp.textureAlignment`. - :py:obj:`~.cudaResourceDesc`::res::pitch2D::desc describes the format - and the number of components per array element. - :py:obj:`~.cudaResourceDesc`::res::pitch2D::width and - :py:obj:`~.cudaResourceDesc`::res::pitch2D::height specify the width - and height of the array in elements, and cannot exceed - :py:obj:`~.cudaDeviceProp.maxTexture2DLinear`[0] and - :py:obj:`~.cudaDeviceProp.maxTexture2DLinear`[1] respectively. - :py:obj:`~.cudaResourceDesc`::res::pitch2D::pitchInBytes specifies the - pitch between two rows in bytes and has to be aligned to - :py:obj:`~.cudaDeviceProp.texturePitchAlignment`. Pitch cannot exceed - :py:obj:`~.cudaDeviceProp.maxTexture2DLinear`[2]. +@cython.embedsignature(True) +def cudaGraphKernelNodeSetParams(node, pNodeParams : Optional[cudaKernelNodeParams]): + """ Sets a kernel node's parameters. - The :py:obj:`~.cudaTextureDesc` struct is defined as + Sets the parameters of kernel node `node` to `pNodeParams`. - **View CUDA Toolkit Documentation for a C++ code example** + Parameters + ---------- + node : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` + Node to set the parameters for + pNodeParams : :py:obj:`~.cudaKernelNodeParams` + Parameters to copy - where + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorMemoryAllocation` - - :py:obj:`~.cudaTextureDesc.addressMode` specifies the addressing mode - for each dimension of the texture data. - :py:obj:`~.cudaTextureAddressMode` is defined as: + See Also + -------- + :py:obj:`~.cudaGraphNodeSetParams`, :py:obj:`~.cudaLaunchKernel`, :py:obj:`~.cudaGraphAddKernelNode`, :py:obj:`~.cudaGraphKernelNodeGetParams` + """ + cdef cyruntime.cudaGraphNode_t cynode + if node is None: + pnode = 0 + elif isinstance(node, (cudaGraphNode_t,driver.CUgraphNode)): + pnode = int(node) + else: + pnode = int(cudaGraphNode_t(node)) + cynode = pnode + cdef cyruntime.cudaKernelNodeParams* cypNodeParams_ptr = pNodeParams._pvt_ptr if pNodeParams is not None else NULL + with nogil: + err = cyruntime.cudaGraphKernelNodeSetParams(cynode, cypNodeParams_ptr) + return (_cudaError_t(err),) - - **View CUDA Toolkit Documentation for a C++ code example** +@cython.embedsignature(True) +def cudaGraphKernelNodeCopyAttributes(hDst, hSrc): + """ Copies attributes from source node to destination node. - - This is ignored if :py:obj:`~.cudaResourceDesc.resType` is - :py:obj:`~.cudaResourceTypeLinear`. Also, if - :py:obj:`~.cudaTextureDesc.normalizedCoords` is set to zero, - :py:obj:`~.cudaAddressModeWrap` and :py:obj:`~.cudaAddressModeMirror` - won't be supported and will be switched to - :py:obj:`~.cudaAddressModeClamp`. + Copies attributes from source node `hSrc` to destination node `hDst`. + Both node must have the same context. - - :py:obj:`~.cudaTextureDesc.filterMode` specifies the filtering mode - to be used when fetching from the texture. - :py:obj:`~.cudaTextureFilterMode` is defined as: + Parameters + ---------- + hDst : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` + Destination node + hSrc : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` + Source node For list of attributes see + :py:obj:`~.cudaKernelNodeAttrID` - - **View CUDA Toolkit Documentation for a C++ code example** + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidContext` - - This is ignored if :py:obj:`~.cudaResourceDesc.resType` is - :py:obj:`~.cudaResourceTypeLinear`. + See Also + -------- + :py:obj:`~.cudaAccessPolicyWindow` + """ + cdef cyruntime.cudaGraphNode_t cyhSrc + if hSrc is None: + phSrc = 0 + elif isinstance(hSrc, (cudaGraphNode_t,driver.CUgraphNode)): + phSrc = int(hSrc) + else: + phSrc = int(cudaGraphNode_t(hSrc)) + cyhSrc = phSrc + cdef cyruntime.cudaGraphNode_t cyhDst + if hDst is None: + phDst = 0 + elif isinstance(hDst, (cudaGraphNode_t,driver.CUgraphNode)): + phDst = int(hDst) + else: + phDst = int(cudaGraphNode_t(hDst)) + cyhDst = phDst + with nogil: + err = cyruntime.cudaGraphKernelNodeCopyAttributes(cyhDst, cyhSrc) + return (_cudaError_t(err),) - - :py:obj:`~.cudaTextureDesc.readMode` specifies whether integer data - should be converted to floating point or not. - :py:obj:`~.cudaTextureReadMode` is defined as: +@cython.embedsignature(True) +def cudaGraphKernelNodeGetAttribute(hNode, attr not None : cudaKernelNodeAttrID): + """ Queries node attribute. - - **View CUDA Toolkit Documentation for a C++ code example** + Queries attribute `attr` from node `hNode` and stores it in + corresponding member of `value_out`. - - Note that this applies only to 8-bit and 16-bit integer formats. - 32-bit integer format would not be promoted, regardless of whether or - not this :py:obj:`~.cudaTextureDesc.readMode` is set - :py:obj:`~.cudaReadModeNormalizedFloat` is specified. + Parameters + ---------- + hNode : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` - - :py:obj:`~.cudaTextureDesc.sRGB` specifies whether sRGB to linear - conversion should be performed during texture fetch. + attr : :py:obj:`~.cudaKernelNodeAttrID` - - :py:obj:`~.cudaTextureDesc.borderColor` specifies the float values of - color. where: :py:obj:`~.cudaTextureDesc.borderColor`[0] contains - value of 'R', :py:obj:`~.cudaTextureDesc.borderColor`[1] contains - value of 'G', :py:obj:`~.cudaTextureDesc.borderColor`[2] contains - value of 'B', :py:obj:`~.cudaTextureDesc.borderColor`[3] contains - value of 'A' Note that application using integer border color values - will need to these values to float. The values are - set only when the addressing mode specified by - :py:obj:`~.cudaTextureDesc.addressMode` is cudaAddressModeBorder. + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle` + value_out : :py:obj:`~.cudaKernelNodeAttrValue` - - :py:obj:`~.cudaTextureDesc.normalizedCoords` specifies whether the - texture coordinates will be normalized or not. + See Also + -------- + :py:obj:`~.cudaAccessPolicyWindow` + """ + cdef cyruntime.cudaGraphNode_t cyhNode + if hNode is None: + phNode = 0 + elif isinstance(hNode, (cudaGraphNode_t,driver.CUgraphNode)): + phNode = int(hNode) + else: + phNode = int(cudaGraphNode_t(hNode)) + cyhNode = phNode + cdef cyruntime.cudaKernelNodeAttrID cyattr = int(attr) + cdef cudaKernelNodeAttrValue value_out = cudaKernelNodeAttrValue() + with nogil: + err = cyruntime.cudaGraphKernelNodeGetAttribute(cyhNode, cyattr, value_out._pvt_ptr) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, value_out) - - :py:obj:`~.cudaTextureDesc.maxAnisotropy` specifies the maximum - anistropy ratio to be used when doing anisotropic filtering. This - value will be clamped to the range [1,16]. +@cython.embedsignature(True) +def cudaGraphKernelNodeSetAttribute(hNode, attr not None : cudaKernelNodeAttrID, value : Optional[cudaKernelNodeAttrValue]): + """ Sets node attribute. - - :py:obj:`~.cudaTextureDesc.mipmapFilterMode` specifies the filter - mode when the calculated mipmap level lies between two defined mipmap - levels. + Sets attribute `attr` on node `hNode` from corresponding attribute of + `value`. - - :py:obj:`~.cudaTextureDesc.mipmapLevelBias` specifies the offset to - be applied to the calculated mipmap level. + Parameters + ---------- + hNode : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` - - :py:obj:`~.cudaTextureDesc.minMipmapLevelClamp` specifies the lower - end of the mipmap level range to clamp access to. + attr : :py:obj:`~.cudaKernelNodeAttrID` - - :py:obj:`~.cudaTextureDesc.maxMipmapLevelClamp` specifies the upper - end of the mipmap level range to clamp access to. + value : :py:obj:`~.cudaKernelNodeAttrValue` - - :py:obj:`~.cudaTextureDesc.disableTrilinearOptimization` specifies - whether the trilinear filtering optimizations will be disabled. + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle` - - :py:obj:`~.cudaTextureDesc.seamlessCubemap` specifies whether - seamless cube map filtering is enabled. This flag can only be - specified if the underlying resource is a CUDA array or a CUDA - mipmapped array that was created with the flag - :py:obj:`~.cudaArrayCubemap`. When seamless cube map filtering is - enabled, texture address modes specified by - :py:obj:`~.cudaTextureDesc.addressMode` are ignored. Instead, if the - :py:obj:`~.cudaTextureDesc.filterMode` is set to - :py:obj:`~.cudaFilterModePoint` the address mode - :py:obj:`~.cudaAddressModeClamp` will be applied for all dimensions. - If the :py:obj:`~.cudaTextureDesc.filterMode` is set to - :py:obj:`~.cudaFilterModeLinear` seamless cube map filtering will be - performed when sampling along the cube face borders. + See Also + -------- + :py:obj:`~.cudaAccessPolicyWindow` + """ + cdef cyruntime.cudaGraphNode_t cyhNode + if hNode is None: + phNode = 0 + elif isinstance(hNode, (cudaGraphNode_t,driver.CUgraphNode)): + phNode = int(hNode) + else: + phNode = int(cudaGraphNode_t(hNode)) + cyhNode = phNode + cdef cyruntime.cudaKernelNodeAttrID cyattr = int(attr) + cdef cyruntime.cudaKernelNodeAttrValue* cyvalue_ptr = value._pvt_ptr if value is not None else NULL + with nogil: + err = cyruntime.cudaGraphKernelNodeSetAttribute(cyhNode, cyattr, cyvalue_ptr) + return (_cudaError_t(err),) - The :py:obj:`~.cudaResourceViewDesc` struct is defined as +@cython.embedsignature(True) +def cudaGraphAddMemcpyNode(graph, pDependencies : Optional[tuple[cudaGraphNode_t] | list[cudaGraphNode_t]], size_t numDependencies, pCopyParams : Optional[cudaMemcpy3DParms]): + """ Creates a memcpy node and adds it to a graph. - **View CUDA Toolkit Documentation for a C++ code example** + Creates a new memcpy node and adds it to `graph` with `numDependencies` + dependencies specified via `pDependencies`. It is possible for + `numDependencies` to be 0, in which case the node will be placed at the + root of the graph. `pDependencies` may not have any duplicate entries. + A handle to the new node will be returned in `pGraphNode`. - where: + When the graph is launched, the node will perform the memcpy described + by `pCopyParams`. See :py:obj:`~.cudaMemcpy3D()` for a description of + the structure and its restrictions. - - :py:obj:`~.cudaResourceViewDesc.format` specifies how the data - contained in the CUDA array or CUDA mipmapped array should be - interpreted. Note that this can incur a change in size of the texture - data. If the resource view format is a block compressed format, then - the underlying CUDA array or CUDA mipmapped array has to have a - 32-bit unsigned integer format with 2 or 4 channels, depending on the - block compressed format. For ex., BC1 and BC4 require the underlying - CUDA array to have a 32-bit unsigned int with 2 channels. The other - BC formats require the underlying resource to have the same 32-bit - unsigned int format but with 4 channels. + Memcpy nodes have some additional restrictions with regards to managed + memory, if the system contains at least one device which has a zero + value for the device attribute + :py:obj:`~.cudaDevAttrConcurrentManagedAccess`. - - :py:obj:`~.cudaResourceViewDesc.width` specifies the new width of the - texture data. If the resource view format is a block compressed - format, this value has to be 4 times the original width of the - resource. For non block compressed formats, this value has to be - equal to that of the original resource. + Parameters + ---------- + graph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` + Graph to which to add the node + pDependencies : list[:py:obj:`~.cudaGraphNode_t`] + Dependencies of the node + numDependencies : size_t + Number of dependencies + pCopyParams : :py:obj:`~.cudaMemcpy3DParms` + Parameters for the memory copy - - :py:obj:`~.cudaResourceViewDesc.height` specifies the new height of - the texture data. If the resource view format is a block compressed - format, this value has to be 4 times the original height of the - resource. For non block compressed formats, this value has to be - equal to that of the original resource. + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + pGraphNode : :py:obj:`~.cudaGraphNode_t` + Returns newly created node - - :py:obj:`~.cudaResourceViewDesc.depth` specifies the new depth of the - texture data. This value has to be equal to that of the original - resource. + See Also + -------- + :py:obj:`~.cudaGraphAddNode`, :py:obj:`~.cudaMemcpy3D`, :py:obj:`~.cudaGraphAddMemcpyNodeToSymbol`, :py:obj:`~.cudaGraphAddMemcpyNodeFromSymbol`, :py:obj:`~.cudaGraphAddMemcpyNode1D`, :py:obj:`~.cudaGraphMemcpyNodeGetParams`, :py:obj:`~.cudaGraphMemcpyNodeSetParams`, :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphDestroyNode`, :py:obj:`~.cudaGraphAddChildGraphNode`, :py:obj:`~.cudaGraphAddEmptyNode`, :py:obj:`~.cudaGraphAddKernelNode`, :py:obj:`~.cudaGraphAddHostNode`, :py:obj:`~.cudaGraphAddMemsetNode` + """ + pDependencies = [] if pDependencies is None else pDependencies + if not all(isinstance(_x, (cudaGraphNode_t,driver.CUgraphNode)) for _x in pDependencies): + raise TypeError("Argument 'pDependencies' is not instance of type (expected tuple[cyruntime.cudaGraphNode_t,driver.CUgraphNode] or list[cyruntime.cudaGraphNode_t,driver.CUgraphNode]") + cdef cyruntime.cudaGraph_t cygraph + if graph is None: + pgraph = 0 + elif isinstance(graph, (cudaGraph_t,driver.CUgraph)): + pgraph = int(graph) + else: + pgraph = int(cudaGraph_t(graph)) + cygraph = pgraph + cdef cudaGraphNode_t pGraphNode = cudaGraphNode_t() + cdef cyruntime.cudaGraphNode_t* cypDependencies = NULL + if len(pDependencies) > 1: + cypDependencies = calloc(len(pDependencies), sizeof(cyruntime.cudaGraphNode_t)) + if cypDependencies is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(pDependencies)) + 'x' + str(sizeof(cyruntime.cudaGraphNode_t))) + else: + for idx in range(len(pDependencies)): + cypDependencies[idx] = (pDependencies[idx])._pvt_ptr[0] + elif len(pDependencies) == 1: + cypDependencies = (pDependencies[0])._pvt_ptr + if numDependencies > len(pDependencies): raise RuntimeError("List is too small: " + str(len(pDependencies)) + " < " + str(numDependencies)) + cdef cyruntime.cudaMemcpy3DParms* cypCopyParams_ptr = pCopyParams._pvt_ptr if pCopyParams is not None else NULL + with nogil: + err = cyruntime.cudaGraphAddMemcpyNode(pGraphNode._pvt_ptr, cygraph, cypDependencies, numDependencies, cypCopyParams_ptr) + if len(pDependencies) > 1 and cypDependencies is not NULL: + free(cypDependencies) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, pGraphNode) - - :py:obj:`~.cudaResourceViewDesc.firstMipmapLevel` specifies the most - detailed mipmap level. This will be the new mipmap level zero. For - non-mipmapped resources, this value has to be - zero.:py:obj:`~.cudaTextureDesc.minMipmapLevelClamp` and - :py:obj:`~.cudaTextureDesc.maxMipmapLevelClamp` will be relative to - this value. For ex., if the firstMipmapLevel is set to 2, and a - minMipmapLevelClamp of 1.2 is specified, then the actual minimum - mipmap level clamp will be 3.2. +@cython.embedsignature(True) +def cudaGraphAddMemcpyNode1D(graph, pDependencies : Optional[tuple[cudaGraphNode_t] | list[cudaGraphNode_t]], size_t numDependencies, dst, src, size_t count, kind not None : cudaMemcpyKind): + """ Creates a 1D memcpy node and adds it to a graph. - - :py:obj:`~.cudaResourceViewDesc.lastMipmapLevel` specifies the least - detailed mipmap level. For non-mipmapped resources, this value has to - be zero. + Creates a new 1D memcpy node and adds it to `graph` with + `numDependencies` dependencies specified via `pDependencies`. It is + possible for `numDependencies` to be 0, in which case the node will be + placed at the root of the graph. `pDependencies` may not have any + duplicate entries. A handle to the new node will be returned in + `pGraphNode`. - - :py:obj:`~.cudaResourceViewDesc.firstLayer` specifies the first layer - index for layered textures. This will be the new layer zero. For non- - layered resources, this value has to be zero. + When the graph is launched, the node will copy `count` bytes from the + memory area pointed to by `src` to the memory area pointed to by `dst`, + where `kind` specifies the direction of the copy, and must be one of + :py:obj:`~.cudaMemcpyHostToHost`, :py:obj:`~.cudaMemcpyHostToDevice`, + :py:obj:`~.cudaMemcpyDeviceToHost`, + :py:obj:`~.cudaMemcpyDeviceToDevice`, or :py:obj:`~.cudaMemcpyDefault`. + Passing :py:obj:`~.cudaMemcpyDefault` is recommended, in which case the + type of transfer is inferred from the pointer values. However, + :py:obj:`~.cudaMemcpyDefault` is only allowed on systems that support + unified virtual addressing. Launching a memcpy node with dst and src + pointers that do not match the direction of the copy results in an + undefined behavior. - - :py:obj:`~.cudaResourceViewDesc.lastLayer` specifies the last layer - index for layered textures. For non-layered resources, this value has - to be zero. + Memcpy nodes have some additional restrictions with regards to managed + memory, if the system contains at least one device which has a zero + value for the device attribute + :py:obj:`~.cudaDevAttrConcurrentManagedAccess`. Parameters ---------- - pResDesc : :py:obj:`~.cudaResourceDesc` - Resource descriptor - pTexDesc : :py:obj:`~.cudaTextureDesc` - Texture descriptor - pResViewDesc : :py:obj:`~.cudaResourceViewDesc` - Resource view descriptor + graph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` + Graph to which to add the node + pDependencies : list[:py:obj:`~.cudaGraphNode_t`] + Dependencies of the node + numDependencies : size_t + Number of dependencies + dst : Any + Destination memory address + src : Any + Source memory address + count : size_t + Size in bytes to copy + kind : :py:obj:`~.cudaMemcpyKind` + Type of transfer Returns ------- cudaError_t :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` - pTexObject : :py:obj:`~.cudaTextureObject_t` - Texture object to create + pGraphNode : :py:obj:`~.cudaGraphNode_t` + Returns newly created node See Also -------- - :py:obj:`~.cudaDestroyTextureObject`, :py:obj:`~.cuTexObjectCreate` + :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphMemcpyNodeGetParams`, :py:obj:`~.cudaGraphMemcpyNodeSetParams`, :py:obj:`~.cudaGraphMemcpyNodeSetParams1D`, :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphDestroyNode`, :py:obj:`~.cudaGraphAddChildGraphNode`, :py:obj:`~.cudaGraphAddEmptyNode`, :py:obj:`~.cudaGraphAddKernelNode`, :py:obj:`~.cudaGraphAddHostNode`, :py:obj:`~.cudaGraphAddMemsetNode` """ - cdef cudaTextureObject_t pTexObject = cudaTextureObject_t() - cdef ccudart.cudaResourceDesc* cpResDesc_ptr = pResDesc._ptr if pResDesc != None else NULL - cdef ccudart.cudaTextureDesc* cpTexDesc_ptr = pTexDesc._ptr if pTexDesc != None else NULL - cdef ccudart.cudaResourceViewDesc* cpResViewDesc_ptr = pResViewDesc._ptr if pResViewDesc != None else NULL - err = ccudart.cudaCreateTextureObject(pTexObject._ptr, cpResDesc_ptr, cpTexDesc_ptr, cpResViewDesc_ptr) - return (cudaError_t(err), pTexObject) -{{endif}} - -{{if 'cudaDestroyTextureObject' in found_functions}} + pDependencies = [] if pDependencies is None else pDependencies + if not all(isinstance(_x, (cudaGraphNode_t,driver.CUgraphNode)) for _x in pDependencies): + raise TypeError("Argument 'pDependencies' is not instance of type (expected tuple[cyruntime.cudaGraphNode_t,driver.CUgraphNode] or list[cyruntime.cudaGraphNode_t,driver.CUgraphNode]") + cdef cyruntime.cudaGraph_t cygraph + if graph is None: + pgraph = 0 + elif isinstance(graph, (cudaGraph_t,driver.CUgraph)): + pgraph = int(graph) + else: + pgraph = int(cudaGraph_t(graph)) + cygraph = pgraph + cdef cudaGraphNode_t pGraphNode = cudaGraphNode_t() + cdef cyruntime.cudaGraphNode_t* cypDependencies = NULL + if len(pDependencies) > 1: + cypDependencies = calloc(len(pDependencies), sizeof(cyruntime.cudaGraphNode_t)) + if cypDependencies is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(pDependencies)) + 'x' + str(sizeof(cyruntime.cudaGraphNode_t))) + else: + for idx in range(len(pDependencies)): + cypDependencies[idx] = (pDependencies[idx])._pvt_ptr[0] + elif len(pDependencies) == 1: + cypDependencies = (pDependencies[0])._pvt_ptr + cdef _HelperInputVoidPtrStruct cydstHelper + cdef void* cydst = _helper_input_void_ptr(dst, &cydstHelper) + cdef _HelperInputVoidPtrStruct cysrcHelper + cdef void* cysrc = _helper_input_void_ptr(src, &cysrcHelper) + cdef cyruntime.cudaMemcpyKind cykind = int(kind) + with nogil: + err = cyruntime.cudaGraphAddMemcpyNode1D(pGraphNode._pvt_ptr, cygraph, cypDependencies, numDependencies, cydst, cysrc, count, cykind) + if len(pDependencies) > 1 and cypDependencies is not NULL: + free(cypDependencies) + _helper_input_void_ptr_free(&cydstHelper) + _helper_input_void_ptr_free(&cysrcHelper) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, pGraphNode) @cython.embedsignature(True) -def cudaDestroyTextureObject(texObject): - """ Destroys a texture object. +def cudaGraphMemcpyNodeGetParams(node): + """ Returns a memcpy node's parameters. - Destroys the texture object specified by `texObject`. + Returns the parameters of memcpy node `node` in `pNodeParams`. Parameters ---------- - texObject : :py:obj:`~.cudaTextureObject_t` - Texture object to destroy + node : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` + Node to get the parameters for Returns ------- cudaError_t :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + pNodeParams : :py:obj:`~.cudaMemcpy3DParms` + Pointer to return the parameters See Also -------- - :py:obj:`~.cudaCreateTextureObject`, :py:obj:`~.cuTexObjectDestroy` + :py:obj:`~.cudaGraphNodeGetParams`, :py:obj:`~.cudaMemcpy3D`, :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphMemcpyNodeSetParams` """ - cdef ccudart.cudaTextureObject_t ctexObject - if texObject is None: - ctexObject = 0 - elif isinstance(texObject, (cudaTextureObject_t,)): - ptexObject = int(texObject) - ctexObject = ptexObject + cdef cyruntime.cudaGraphNode_t cynode + if node is None: + pnode = 0 + elif isinstance(node, (cudaGraphNode_t,driver.CUgraphNode)): + pnode = int(node) else: - ptexObject = int(cudaTextureObject_t(texObject)) - ctexObject = ptexObject + pnode = int(cudaGraphNode_t(node)) + cynode = pnode + cdef cudaMemcpy3DParms pNodeParams = cudaMemcpy3DParms() with nogil: - err = ccudart.cudaDestroyTextureObject(ctexObject) + err = cyruntime.cudaGraphMemcpyNodeGetParams(cynode, pNodeParams._pvt_ptr) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, pNodeParams) + +@cython.embedsignature(True) +def cudaGraphMemcpyNodeSetParams(node, pNodeParams : Optional[cudaMemcpy3DParms]): + """ Sets a memcpy node's parameters. + + Sets the parameters of memcpy node `node` to `pNodeParams`. - return (cudaError_t(err),) -{{endif}} + Parameters + ---------- + node : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` + Node to set the parameters for + pNodeParams : :py:obj:`~.cudaMemcpy3DParms` + Parameters to copy + + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, -{{if 'cudaGetTextureObjectResourceDesc' in found_functions}} + See Also + -------- + :py:obj:`~.cudaGraphNodeSetParams`, :py:obj:`~.cudaMemcpy3D`, :py:obj:`~.cudaGraphMemcpyNodeSetParamsToSymbol`, :py:obj:`~.cudaGraphMemcpyNodeSetParamsFromSymbol`, :py:obj:`~.cudaGraphMemcpyNodeSetParams1D`, :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphMemcpyNodeGetParams` + """ + cdef cyruntime.cudaGraphNode_t cynode + if node is None: + pnode = 0 + elif isinstance(node, (cudaGraphNode_t,driver.CUgraphNode)): + pnode = int(node) + else: + pnode = int(cudaGraphNode_t(node)) + cynode = pnode + cdef cyruntime.cudaMemcpy3DParms* cypNodeParams_ptr = pNodeParams._pvt_ptr if pNodeParams is not None else NULL + with nogil: + err = cyruntime.cudaGraphMemcpyNodeSetParams(cynode, cypNodeParams_ptr) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaGetTextureObjectResourceDesc(texObject): - """ Returns a texture object's resource descriptor. +def cudaGraphMemcpyNodeSetParams1D(node, dst, src, size_t count, kind not None : cudaMemcpyKind): + """ Sets a memcpy node's parameters to perform a 1-dimensional copy. - Returns the resource descriptor for the texture object specified by - `texObject`. + Sets the parameters of memcpy node `node` to the copy described by the + provided parameters. + + When the graph is launched, the node will copy `count` bytes from the + memory area pointed to by `src` to the memory area pointed to by `dst`, + where `kind` specifies the direction of the copy, and must be one of + :py:obj:`~.cudaMemcpyHostToHost`, :py:obj:`~.cudaMemcpyHostToDevice`, + :py:obj:`~.cudaMemcpyDeviceToHost`, + :py:obj:`~.cudaMemcpyDeviceToDevice`, or :py:obj:`~.cudaMemcpyDefault`. + Passing :py:obj:`~.cudaMemcpyDefault` is recommended, in which case the + type of transfer is inferred from the pointer values. However, + :py:obj:`~.cudaMemcpyDefault` is only allowed on systems that support + unified virtual addressing. Launching a memcpy node with dst and src + pointers that do not match the direction of the copy results in an + undefined behavior. Parameters ---------- - texObject : :py:obj:`~.cudaTextureObject_t` - Texture object + node : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` + Node to set the parameters for + dst : Any + Destination memory address + src : Any + Source memory address + count : size_t + Size in bytes to copy + kind : :py:obj:`~.cudaMemcpyKind` + Type of transfer Returns ------- cudaError_t :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` - pResDesc : :py:obj:`~.cudaResourceDesc` - Resource descriptor See Also -------- - :py:obj:`~.cudaCreateTextureObject`, :py:obj:`~.cuTexObjectGetResourceDesc` + :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaGraphMemcpyNodeSetParams`, :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphMemcpyNodeGetParams` """ - cdef ccudart.cudaTextureObject_t ctexObject - if texObject is None: - ctexObject = 0 - elif isinstance(texObject, (cudaTextureObject_t,)): - ptexObject = int(texObject) - ctexObject = ptexObject + cdef cyruntime.cudaGraphNode_t cynode + if node is None: + pnode = 0 + elif isinstance(node, (cudaGraphNode_t,driver.CUgraphNode)): + pnode = int(node) else: - ptexObject = int(cudaTextureObject_t(texObject)) - ctexObject = ptexObject - cdef cudaResourceDesc pResDesc = cudaResourceDesc() + pnode = int(cudaGraphNode_t(node)) + cynode = pnode + cdef _HelperInputVoidPtrStruct cydstHelper + cdef void* cydst = _helper_input_void_ptr(dst, &cydstHelper) + cdef _HelperInputVoidPtrStruct cysrcHelper + cdef void* cysrc = _helper_input_void_ptr(src, &cysrcHelper) + cdef cyruntime.cudaMemcpyKind cykind = int(kind) with nogil: - err = ccudart.cudaGetTextureObjectResourceDesc(pResDesc._ptr, ctexObject) + err = cyruntime.cudaGraphMemcpyNodeSetParams1D(cynode, cydst, cysrc, count, cykind) + _helper_input_void_ptr_free(&cydstHelper) + _helper_input_void_ptr_free(&cysrcHelper) + return (_cudaError_t(err),) + +@cython.embedsignature(True) +def cudaGraphAddMemsetNode(graph, pDependencies : Optional[tuple[cudaGraphNode_t] | list[cudaGraphNode_t]], size_t numDependencies, pMemsetParams : Optional[cudaMemsetParams]): + """ Creates a memset node and adds it to a graph. + + Creates a new memset node and adds it to `graph` with `numDependencies` + dependencies specified via `pDependencies`. It is possible for + `numDependencies` to be 0, in which case the node will be placed at the + root of the graph. `pDependencies` may not have any duplicate entries. + A handle to the new node will be returned in `pGraphNode`. + + The element size must be 1, 2, or 4 bytes. When the graph is launched, + the node will perform the memset described by `pMemsetParams`. + + Parameters + ---------- + graph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` + Graph to which to add the node + pDependencies : list[:py:obj:`~.cudaGraphNode_t`] + Dependencies of the node + numDependencies : size_t + Number of dependencies + pMemsetParams : :py:obj:`~.cudaMemsetParams` + Parameters for the memory set - return (cudaError_t(err), pResDesc) -{{endif}} + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidDevice` + pGraphNode : :py:obj:`~.cudaGraphNode_t` + Returns newly created node -{{if 'cudaGetTextureObjectTextureDesc' in found_functions}} + See Also + -------- + :py:obj:`~.cudaGraphAddNode`, :py:obj:`~.cudaMemset2D`, :py:obj:`~.cudaGraphMemsetNodeGetParams`, :py:obj:`~.cudaGraphMemsetNodeSetParams`, :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphDestroyNode`, :py:obj:`~.cudaGraphAddChildGraphNode`, :py:obj:`~.cudaGraphAddEmptyNode`, :py:obj:`~.cudaGraphAddKernelNode`, :py:obj:`~.cudaGraphAddHostNode`, :py:obj:`~.cudaGraphAddMemcpyNode` + """ + pDependencies = [] if pDependencies is None else pDependencies + if not all(isinstance(_x, (cudaGraphNode_t,driver.CUgraphNode)) for _x in pDependencies): + raise TypeError("Argument 'pDependencies' is not instance of type (expected tuple[cyruntime.cudaGraphNode_t,driver.CUgraphNode] or list[cyruntime.cudaGraphNode_t,driver.CUgraphNode]") + cdef cyruntime.cudaGraph_t cygraph + if graph is None: + pgraph = 0 + elif isinstance(graph, (cudaGraph_t,driver.CUgraph)): + pgraph = int(graph) + else: + pgraph = int(cudaGraph_t(graph)) + cygraph = pgraph + cdef cudaGraphNode_t pGraphNode = cudaGraphNode_t() + cdef cyruntime.cudaGraphNode_t* cypDependencies = NULL + if len(pDependencies) > 1: + cypDependencies = calloc(len(pDependencies), sizeof(cyruntime.cudaGraphNode_t)) + if cypDependencies is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(pDependencies)) + 'x' + str(sizeof(cyruntime.cudaGraphNode_t))) + else: + for idx in range(len(pDependencies)): + cypDependencies[idx] = (pDependencies[idx])._pvt_ptr[0] + elif len(pDependencies) == 1: + cypDependencies = (pDependencies[0])._pvt_ptr + if numDependencies > len(pDependencies): raise RuntimeError("List is too small: " + str(len(pDependencies)) + " < " + str(numDependencies)) + cdef cyruntime.cudaMemsetParams* cypMemsetParams_ptr = pMemsetParams._pvt_ptr if pMemsetParams is not None else NULL + with nogil: + err = cyruntime.cudaGraphAddMemsetNode(pGraphNode._pvt_ptr, cygraph, cypDependencies, numDependencies, cypMemsetParams_ptr) + if len(pDependencies) > 1 and cypDependencies is not NULL: + free(cypDependencies) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, pGraphNode) @cython.embedsignature(True) -def cudaGetTextureObjectTextureDesc(texObject): - """ Returns a texture object's texture descriptor. +def cudaGraphMemsetNodeGetParams(node): + """ Returns a memset node's parameters. - Returns the texture descriptor for the texture object specified by - `texObject`. + Returns the parameters of memset node `node` in `pNodeParams`. Parameters ---------- - texObject : :py:obj:`~.cudaTextureObject_t` - Texture object + node : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` + Node to get the parameters for Returns ------- cudaError_t :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` - pTexDesc : :py:obj:`~.cudaTextureDesc` - Texture descriptor + pNodeParams : :py:obj:`~.cudaMemsetParams` + Pointer to return the parameters See Also -------- - :py:obj:`~.cudaCreateTextureObject`, :py:obj:`~.cuTexObjectGetTextureDesc` + :py:obj:`~.cudaGraphNodeGetParams`, :py:obj:`~.cudaMemset2D`, :py:obj:`~.cudaGraphAddMemsetNode`, :py:obj:`~.cudaGraphMemsetNodeSetParams` """ - cdef ccudart.cudaTextureObject_t ctexObject - if texObject is None: - ctexObject = 0 - elif isinstance(texObject, (cudaTextureObject_t,)): - ptexObject = int(texObject) - ctexObject = ptexObject + cdef cyruntime.cudaGraphNode_t cynode + if node is None: + pnode = 0 + elif isinstance(node, (cudaGraphNode_t,driver.CUgraphNode)): + pnode = int(node) else: - ptexObject = int(cudaTextureObject_t(texObject)) - ctexObject = ptexObject - cdef cudaTextureDesc pTexDesc = cudaTextureDesc() + pnode = int(cudaGraphNode_t(node)) + cynode = pnode + cdef cudaMemsetParams pNodeParams = cudaMemsetParams() with nogil: - err = ccudart.cudaGetTextureObjectTextureDesc(pTexDesc._ptr, ctexObject) - - return (cudaError_t(err), pTexDesc) -{{endif}} - -{{if 'cudaGetTextureObjectResourceViewDesc' in found_functions}} + err = cyruntime.cudaGraphMemsetNodeGetParams(cynode, pNodeParams._pvt_ptr) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, pNodeParams) @cython.embedsignature(True) -def cudaGetTextureObjectResourceViewDesc(texObject): - """ Returns a texture object's resource view descriptor. +def cudaGraphMemsetNodeSetParams(node, pNodeParams : Optional[cudaMemsetParams]): + """ Sets a memset node's parameters. - Returns the resource view descriptor for the texture object specified - by `texObject`. If no resource view was specified, - :py:obj:`~.cudaErrorInvalidValue` is returned. + Sets the parameters of memset node `node` to `pNodeParams`. Parameters ---------- - texObject : :py:obj:`~.cudaTextureObject_t` - Texture object + node : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` + Node to set the parameters for + pNodeParams : :py:obj:`~.cudaMemsetParams` + Parameters to copy Returns ------- cudaError_t :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` - pResViewDesc : :py:obj:`~.cudaResourceViewDesc` - Resource view descriptor See Also -------- - :py:obj:`~.cudaCreateTextureObject`, :py:obj:`~.cuTexObjectGetResourceViewDesc` + :py:obj:`~.cudaGraphNodeSetParams`, :py:obj:`~.cudaMemset2D`, :py:obj:`~.cudaGraphAddMemsetNode`, :py:obj:`~.cudaGraphMemsetNodeGetParams` """ - cdef ccudart.cudaTextureObject_t ctexObject - if texObject is None: - ctexObject = 0 - elif isinstance(texObject, (cudaTextureObject_t,)): - ptexObject = int(texObject) - ctexObject = ptexObject + cdef cyruntime.cudaGraphNode_t cynode + if node is None: + pnode = 0 + elif isinstance(node, (cudaGraphNode_t,driver.CUgraphNode)): + pnode = int(node) else: - ptexObject = int(cudaTextureObject_t(texObject)) - ctexObject = ptexObject - cdef cudaResourceViewDesc pResViewDesc = cudaResourceViewDesc() - err = ccudart.cudaGetTextureObjectResourceViewDesc(pResViewDesc._ptr, ctexObject) - return (cudaError_t(err), pResViewDesc) -{{endif}} - -{{if 'cudaCreateSurfaceObject' in found_functions}} + pnode = int(cudaGraphNode_t(node)) + cynode = pnode + cdef cyruntime.cudaMemsetParams* cypNodeParams_ptr = pNodeParams._pvt_ptr if pNodeParams is not None else NULL + with nogil: + err = cyruntime.cudaGraphMemsetNodeSetParams(cynode, cypNodeParams_ptr) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaCreateSurfaceObject(pResDesc : Optional[cudaResourceDesc]): - """ Creates a surface object. +def cudaGraphAddHostNode(graph, pDependencies : Optional[tuple[cudaGraphNode_t] | list[cudaGraphNode_t]], size_t numDependencies, pNodeParams : Optional[cudaHostNodeParams]): + """ Creates a host execution node and adds it to a graph. - Creates a surface object and returns it in `pSurfObject`. `pResDesc` - describes the data to perform surface load/stores on. - :py:obj:`~.cudaResourceDesc.resType` must be - :py:obj:`~.cudaResourceTypeArray` and - :py:obj:`~.cudaResourceDesc`::res::array::array must be set to a valid - CUDA array handle. + Creates a new CPU execution node and adds it to `graph` with + `numDependencies` dependencies specified via `pDependencies` and + arguments specified in `pNodeParams`. It is possible for + `numDependencies` to be 0, in which case the node will be placed at the + root of the graph. `pDependencies` may not have any duplicate entries. + A handle to the new node will be returned in `pGraphNode`. - Surface objects are only supported on devices of compute capability 3.0 - or higher. Additionally, a surface object is an opaque value, and, as - such, should only be accessed through CUDA API calls. + When the graph is launched, the node will invoke the specified CPU + function. Host nodes are not supported under MPS with pre-Volta GPUs. Parameters ---------- - pResDesc : :py:obj:`~.cudaResourceDesc` - Resource descriptor + graph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` + Graph to which to add the node + pDependencies : list[:py:obj:`~.cudaGraphNode_t`] + Dependencies of the node + numDependencies : size_t + Number of dependencies + pNodeParams : :py:obj:`~.cudaHostNodeParams` + Parameters for the host node Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidChannelDescriptor`, :py:obj:`~.cudaErrorInvalidResourceHandle` - pSurfObject : :py:obj:`~.cudaSurfaceObject_t` - Surface object to create + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorNotSupported`, :py:obj:`~.cudaErrorInvalidValue` + pGraphNode : :py:obj:`~.cudaGraphNode_t` + Returns newly created node See Also -------- - :py:obj:`~.cudaDestroySurfaceObject`, :py:obj:`~.cuSurfObjectCreate` + :py:obj:`~.cudaGraphAddNode`, :py:obj:`~.cudaLaunchHostFunc`, :py:obj:`~.cudaGraphHostNodeGetParams`, :py:obj:`~.cudaGraphHostNodeSetParams`, :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphDestroyNode`, :py:obj:`~.cudaGraphAddChildGraphNode`, :py:obj:`~.cudaGraphAddEmptyNode`, :py:obj:`~.cudaGraphAddKernelNode`, :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphAddMemsetNode` """ - cdef cudaSurfaceObject_t pSurfObject = cudaSurfaceObject_t() - cdef ccudart.cudaResourceDesc* cpResDesc_ptr = pResDesc._ptr if pResDesc != None else NULL + pDependencies = [] if pDependencies is None else pDependencies + if not all(isinstance(_x, (cudaGraphNode_t,driver.CUgraphNode)) for _x in pDependencies): + raise TypeError("Argument 'pDependencies' is not instance of type (expected tuple[cyruntime.cudaGraphNode_t,driver.CUgraphNode] or list[cyruntime.cudaGraphNode_t,driver.CUgraphNode]") + cdef cyruntime.cudaGraph_t cygraph + if graph is None: + pgraph = 0 + elif isinstance(graph, (cudaGraph_t,driver.CUgraph)): + pgraph = int(graph) + else: + pgraph = int(cudaGraph_t(graph)) + cygraph = pgraph + cdef cudaGraphNode_t pGraphNode = cudaGraphNode_t() + cdef cyruntime.cudaGraphNode_t* cypDependencies = NULL + if len(pDependencies) > 1: + cypDependencies = calloc(len(pDependencies), sizeof(cyruntime.cudaGraphNode_t)) + if cypDependencies is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(pDependencies)) + 'x' + str(sizeof(cyruntime.cudaGraphNode_t))) + else: + for idx in range(len(pDependencies)): + cypDependencies[idx] = (pDependencies[idx])._pvt_ptr[0] + elif len(pDependencies) == 1: + cypDependencies = (pDependencies[0])._pvt_ptr + if numDependencies > len(pDependencies): raise RuntimeError("List is too small: " + str(len(pDependencies)) + " < " + str(numDependencies)) + cdef cyruntime.cudaHostNodeParams* cypNodeParams_ptr = pNodeParams._pvt_ptr if pNodeParams is not None else NULL with nogil: - err = ccudart.cudaCreateSurfaceObject(pSurfObject._ptr, cpResDesc_ptr) - - return (cudaError_t(err), pSurfObject) -{{endif}} - -{{if 'cudaDestroySurfaceObject' in found_functions}} + err = cyruntime.cudaGraphAddHostNode(pGraphNode._pvt_ptr, cygraph, cypDependencies, numDependencies, cypNodeParams_ptr) + if len(pDependencies) > 1 and cypDependencies is not NULL: + free(cypDependencies) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, pGraphNode) @cython.embedsignature(True) -def cudaDestroySurfaceObject(surfObject): - """ Destroys a surface object. +def cudaGraphHostNodeGetParams(node): + """ Returns a host node's parameters. - Destroys the surface object specified by `surfObject`. + Returns the parameters of host node `node` in `pNodeParams`. Parameters ---------- - surfObject : :py:obj:`~.cudaSurfaceObject_t` - Surface object to destroy + node : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` + Node to get the parameters for Returns ------- cudaError_t :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + pNodeParams : :py:obj:`~.cudaHostNodeParams` + Pointer to return the parameters See Also -------- - :py:obj:`~.cudaCreateSurfaceObject`, :py:obj:`~.cuSurfObjectDestroy` + :py:obj:`~.cudaGraphNodeGetParams`, :py:obj:`~.cudaLaunchHostFunc`, :py:obj:`~.cudaGraphAddHostNode`, :py:obj:`~.cudaGraphHostNodeSetParams` """ - cdef ccudart.cudaSurfaceObject_t csurfObject - if surfObject is None: - csurfObject = 0 - elif isinstance(surfObject, (cudaSurfaceObject_t,)): - psurfObject = int(surfObject) - csurfObject = psurfObject + cdef cyruntime.cudaGraphNode_t cynode + if node is None: + pnode = 0 + elif isinstance(node, (cudaGraphNode_t,driver.CUgraphNode)): + pnode = int(node) else: - psurfObject = int(cudaSurfaceObject_t(surfObject)) - csurfObject = psurfObject + pnode = int(cudaGraphNode_t(node)) + cynode = pnode + cdef cudaHostNodeParams pNodeParams = cudaHostNodeParams() with nogil: - err = ccudart.cudaDestroySurfaceObject(csurfObject) - - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaGetSurfaceObjectResourceDesc' in found_functions}} + err = cyruntime.cudaGraphHostNodeGetParams(cynode, pNodeParams._pvt_ptr) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, pNodeParams) @cython.embedsignature(True) -def cudaGetSurfaceObjectResourceDesc(surfObject): - """ Returns a surface object's resource descriptor Returns the resource descriptor for the surface object specified by `surfObject`. +def cudaGraphHostNodeSetParams(node, pNodeParams : Optional[cudaHostNodeParams]): + """ Sets a host node's parameters. + + Sets the parameters of host node `node` to `nodeParams`. Parameters ---------- - surfObject : :py:obj:`~.cudaSurfaceObject_t` - Surface object + node : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` + Node to set the parameters for + pNodeParams : :py:obj:`~.cudaHostNodeParams` + Parameters to copy Returns ------- cudaError_t :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` - pResDesc : :py:obj:`~.cudaResourceDesc` - Resource descriptor See Also -------- - :py:obj:`~.cudaCreateSurfaceObject`, :py:obj:`~.cuSurfObjectGetResourceDesc` + :py:obj:`~.cudaGraphNodeSetParams`, :py:obj:`~.cudaLaunchHostFunc`, :py:obj:`~.cudaGraphAddHostNode`, :py:obj:`~.cudaGraphHostNodeGetParams` """ - cdef ccudart.cudaSurfaceObject_t csurfObject - if surfObject is None: - csurfObject = 0 - elif isinstance(surfObject, (cudaSurfaceObject_t,)): - psurfObject = int(surfObject) - csurfObject = psurfObject + cdef cyruntime.cudaGraphNode_t cynode + if node is None: + pnode = 0 + elif isinstance(node, (cudaGraphNode_t,driver.CUgraphNode)): + pnode = int(node) else: - psurfObject = int(cudaSurfaceObject_t(surfObject)) - csurfObject = psurfObject - cdef cudaResourceDesc pResDesc = cudaResourceDesc() - err = ccudart.cudaGetSurfaceObjectResourceDesc(pResDesc._ptr, csurfObject) - return (cudaError_t(err), pResDesc) -{{endif}} - -{{if 'cudaDriverGetVersion' in found_functions}} + pnode = int(cudaGraphNode_t(node)) + cynode = pnode + cdef cyruntime.cudaHostNodeParams* cypNodeParams_ptr = pNodeParams._pvt_ptr if pNodeParams is not None else NULL + with nogil: + err = cyruntime.cudaGraphHostNodeSetParams(cynode, cypNodeParams_ptr) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaDriverGetVersion(): - """ Returns the latest version of CUDA supported by the driver. +def cudaGraphAddChildGraphNode(graph, pDependencies : Optional[tuple[cudaGraphNode_t] | list[cudaGraphNode_t]], size_t numDependencies, childGraph): + """ Creates a child graph node and adds it to a graph. - Returns in `*driverVersion` the latest version of CUDA supported by the - driver. The version is returned as (1000 * major + 10 * minor). For - example, CUDA 9.2 would be represented by 9020. If no driver is - installed, then 0 is returned as the driver version. + Creates a new node which executes an embedded graph, and adds it to + `graph` with `numDependencies` dependencies specified via + `pDependencies`. It is possible for `numDependencies` to be 0, in which + case the node will be placed at the root of the graph. `pDependencies` + may not have any duplicate entries. A handle to the new node will be + returned in `pGraphNode`. - This function automatically returns :py:obj:`~.cudaErrorInvalidValue` - if `driverVersion` is NULL. + If `childGraph` contains allocation nodes, free nodes, or conditional + nodes, this call will return an error. + + The node executes an embedded child graph. The child graph is cloned in + this call. + + Parameters + ---------- + graph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` + Graph to which to add the node + pDependencies : list[:py:obj:`~.cudaGraphNode_t`] + Dependencies of the node + numDependencies : size_t + Number of dependencies + childGraph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` + The graph to clone into this node Returns ------- cudaError_t :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` - driverVersion : int - Returns the CUDA driver version. + pGraphNode : :py:obj:`~.cudaGraphNode_t` + Returns newly created node See Also -------- - :py:obj:`~.cudaRuntimeGetVersion`, :py:obj:`~.cuDriverGetVersion` + :py:obj:`~.cudaGraphAddNode`, :py:obj:`~.cudaGraphChildGraphNodeGetGraph`, :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphDestroyNode`, :py:obj:`~.cudaGraphAddEmptyNode`, :py:obj:`~.cudaGraphAddKernelNode`, :py:obj:`~.cudaGraphAddHostNode`, :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphAddMemsetNode`, :py:obj:`~.cudaGraphClone` """ - cdef int driverVersion = 0 - err = ccudart.cudaDriverGetVersion(&driverVersion) - return (cudaError_t(err), driverVersion) -{{endif}} - -{{if 'cudaRuntimeGetVersion' in found_functions}} + cdef cyruntime.cudaGraph_t cychildGraph + if childGraph is None: + pchildGraph = 0 + elif isinstance(childGraph, (cudaGraph_t,driver.CUgraph)): + pchildGraph = int(childGraph) + else: + pchildGraph = int(cudaGraph_t(childGraph)) + cychildGraph = pchildGraph + pDependencies = [] if pDependencies is None else pDependencies + if not all(isinstance(_x, (cudaGraphNode_t,driver.CUgraphNode)) for _x in pDependencies): + raise TypeError("Argument 'pDependencies' is not instance of type (expected tuple[cyruntime.cudaGraphNode_t,driver.CUgraphNode] or list[cyruntime.cudaGraphNode_t,driver.CUgraphNode]") + cdef cyruntime.cudaGraph_t cygraph + if graph is None: + pgraph = 0 + elif isinstance(graph, (cudaGraph_t,driver.CUgraph)): + pgraph = int(graph) + else: + pgraph = int(cudaGraph_t(graph)) + cygraph = pgraph + cdef cudaGraphNode_t pGraphNode = cudaGraphNode_t() + cdef cyruntime.cudaGraphNode_t* cypDependencies = NULL + if len(pDependencies) > 1: + cypDependencies = calloc(len(pDependencies), sizeof(cyruntime.cudaGraphNode_t)) + if cypDependencies is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(pDependencies)) + 'x' + str(sizeof(cyruntime.cudaGraphNode_t))) + else: + for idx in range(len(pDependencies)): + cypDependencies[idx] = (pDependencies[idx])._pvt_ptr[0] + elif len(pDependencies) == 1: + cypDependencies = (pDependencies[0])._pvt_ptr + if numDependencies > len(pDependencies): raise RuntimeError("List is too small: " + str(len(pDependencies)) + " < " + str(numDependencies)) + with nogil: + err = cyruntime.cudaGraphAddChildGraphNode(pGraphNode._pvt_ptr, cygraph, cypDependencies, numDependencies, cychildGraph) + if len(pDependencies) > 1 and cypDependencies is not NULL: + free(cypDependencies) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, pGraphNode) @cython.embedsignature(True) -def cudaRuntimeGetVersion(): - """ Returns the CUDA Runtime version. +def cudaGraphChildGraphNodeGetGraph(node): + """ Gets a handle to the embedded graph of a child graph node. - Returns in `*runtimeVersion` the version number of the current CUDA - Runtime instance. The version is returned as (1000 * major + 10 * - minor). For example, CUDA 9.2 would be represented by 9020. + Gets a handle to the embedded graph in a child graph node. This call + does not clone the graph. Changes to the graph will be reflected in the + node, and the node retains ownership of the graph. - As of CUDA 12.0, this function no longer initializes CUDA. The purpose - of this API is solely to return a compile-time constant stating the - CUDA Toolkit version in the above format. + Allocation and free nodes cannot be added to the returned graph. + Attempting to do so will return an error. - This function automatically returns :py:obj:`~.cudaErrorInvalidValue` - if the `runtimeVersion` argument is NULL. + Parameters + ---------- + node : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` + Node to get the embedded graph for Returns ------- cudaError_t :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` - runtimeVersion : int - Returns the CUDA Runtime version. + pGraph : :py:obj:`~.cudaGraph_t` + Location to store a handle to the graph See Also -------- - :py:obj:`~.cudaDriverGetVersion`, :py:obj:`~.cuDriverGetVersion` + :py:obj:`~.cudaGraphAddChildGraphNode`, :py:obj:`~.cudaGraphNodeFindInClone` """ - cdef int runtimeVersion = 0 - err = ccudart.cudaRuntimeGetVersion(&runtimeVersion) - return (cudaError_t(err), runtimeVersion) -{{endif}} - -{{if 'cudaGraphCreate' in found_functions}} + cdef cyruntime.cudaGraphNode_t cynode + if node is None: + pnode = 0 + elif isinstance(node, (cudaGraphNode_t,driver.CUgraphNode)): + pnode = int(node) + else: + pnode = int(cudaGraphNode_t(node)) + cynode = pnode + cdef cudaGraph_t pGraph = cudaGraph_t() + with nogil: + err = cyruntime.cudaGraphChildGraphNodeGetGraph(cynode, pGraph._pvt_ptr) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, pGraph) @cython.embedsignature(True) -def cudaGraphCreate(unsigned int flags): - """ Creates a graph. +def cudaGraphAddEmptyNode(graph, pDependencies : Optional[tuple[cudaGraphNode_t] | list[cudaGraphNode_t]], size_t numDependencies): + """ Creates an empty node and adds it to a graph. - Creates an empty graph, which is returned via `pGraph`. + Creates a new node which performs no operation, and adds it to `graph` + with `numDependencies` dependencies specified via `pDependencies`. It + is possible for `numDependencies` to be 0, in which case the node will + be placed at the root of the graph. `pDependencies` may not have any + duplicate entries. A handle to the new node will be returned in + `pGraphNode`. + + An empty node performs no operation during execution, but can be used + for transitive ordering. For example, a phased execution graph with 2 + groups of n nodes with a barrier between them can be represented using + an empty node and 2*n dependency edges, rather than no empty node and + n^2 dependency edges. Parameters ---------- - flags : unsigned int - Graph creation flags, must be 0 + graph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` + Graph to which to add the node + pDependencies : list[:py:obj:`~.cudaGraphNode_t`] + Dependencies of the node + numDependencies : size_t + Number of dependencies Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorMemoryAllocation` - pGraph : :py:obj:`~.cudaGraph_t` - Returns newly created graph + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + pGraphNode : :py:obj:`~.cudaGraphNode_t` + Returns newly created node See Also -------- - :py:obj:`~.cudaGraphAddChildGraphNode`, :py:obj:`~.cudaGraphAddEmptyNode`, :py:obj:`~.cudaGraphAddKernelNode`, :py:obj:`~.cudaGraphAddHostNode`, :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphAddMemsetNode`, :py:obj:`~.cudaGraphInstantiate`, :py:obj:`~.cudaGraphDestroy`, :py:obj:`~.cudaGraphGetNodes`, :py:obj:`~.cudaGraphGetRootNodes`, :py:obj:`~.cudaGraphGetEdges`, :py:obj:`~.cudaGraphClone` + :py:obj:`~.cudaGraphAddNode`, :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphDestroyNode`, :py:obj:`~.cudaGraphAddChildGraphNode`, :py:obj:`~.cudaGraphAddKernelNode`, :py:obj:`~.cudaGraphAddHostNode`, :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphAddMemsetNode` """ - cdef cudaGraph_t pGraph = cudaGraph_t() - err = ccudart.cudaGraphCreate(pGraph._ptr, flags) - return (cudaError_t(err), pGraph) -{{endif}} - -{{if 'cudaGraphAddKernelNode' in found_functions}} + pDependencies = [] if pDependencies is None else pDependencies + if not all(isinstance(_x, (cudaGraphNode_t,driver.CUgraphNode)) for _x in pDependencies): + raise TypeError("Argument 'pDependencies' is not instance of type (expected tuple[cyruntime.cudaGraphNode_t,driver.CUgraphNode] or list[cyruntime.cudaGraphNode_t,driver.CUgraphNode]") + cdef cyruntime.cudaGraph_t cygraph + if graph is None: + pgraph = 0 + elif isinstance(graph, (cudaGraph_t,driver.CUgraph)): + pgraph = int(graph) + else: + pgraph = int(cudaGraph_t(graph)) + cygraph = pgraph + cdef cudaGraphNode_t pGraphNode = cudaGraphNode_t() + cdef cyruntime.cudaGraphNode_t* cypDependencies = NULL + if len(pDependencies) > 1: + cypDependencies = calloc(len(pDependencies), sizeof(cyruntime.cudaGraphNode_t)) + if cypDependencies is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(pDependencies)) + 'x' + str(sizeof(cyruntime.cudaGraphNode_t))) + else: + for idx in range(len(pDependencies)): + cypDependencies[idx] = (pDependencies[idx])._pvt_ptr[0] + elif len(pDependencies) == 1: + cypDependencies = (pDependencies[0])._pvt_ptr + if numDependencies > len(pDependencies): raise RuntimeError("List is too small: " + str(len(pDependencies)) + " < " + str(numDependencies)) + with nogil: + err = cyruntime.cudaGraphAddEmptyNode(pGraphNode._pvt_ptr, cygraph, cypDependencies, numDependencies) + if len(pDependencies) > 1 and cypDependencies is not NULL: + free(cypDependencies) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, pGraphNode) @cython.embedsignature(True) -def cudaGraphAddKernelNode(graph, pDependencies : Optional[List[cudaGraphNode_t]], size_t numDependencies, pNodeParams : Optional[cudaKernelNodeParams]): - """ Creates a kernel execution node and adds it to a graph. - - Creates a new kernel execution node and adds it to `graph` with - `numDependencies` dependencies specified via `pDependencies` and - arguments specified in `pNodeParams`. It is possible for - `numDependencies` to be 0, in which case the node will be placed at the - root of the graph. `pDependencies` may not have any duplicate entries. - A handle to the new node will be returned in `pGraphNode`. - - The :py:obj:`~.cudaKernelNodeParams` structure is defined as: - - **View CUDA Toolkit Documentation for a C++ code example** - - When the graph is launched, the node will invoke kernel `func` on a - (`gridDim.x` x `gridDim.y` x `gridDim.z`) grid of blocks. Each block - contains (`blockDim.x` x `blockDim.y` x `blockDim.z`) threads. - - `sharedMem` sets the amount of dynamic shared memory that will be - available to each thread block. - - Kernel parameters to `func` can be specified in one of two ways: - - 1) Kernel parameters can be specified via `kernelParams`. If the kernel - has N parameters, then `kernelParams` needs to be an array of N - pointers. Each pointer, from `kernelParams`[0] to `kernelParams`[N-1], - points to the region of memory from which the actual parameter will be - copied. The number of kernel parameters and their offsets and sizes do - not need to be specified as that information is retrieved directly from - the kernel's image. - - 2) Kernel parameters can also be packaged by the application into a - single buffer that is passed in via `extra`. This places the burden on - the application of knowing each kernel parameter's size and - alignment/padding within the buffer. The `extra` parameter exists to - allow this function to take additional less commonly used arguments. - `extra` specifies a list of names of extra settings and their - corresponding values. Each extra setting name is immediately followed - by the corresponding value. The list must be terminated with either - NULL or CU_LAUNCH_PARAM_END. - - - :py:obj:`~.CU_LAUNCH_PARAM_END`, which indicates the end of the - `extra` array; - - - :py:obj:`~.CU_LAUNCH_PARAM_BUFFER_POINTER`, which specifies that the - next value in `extra` will be a pointer to a buffer containing all - the kernel parameters for launching kernel `func`; - - - :py:obj:`~.CU_LAUNCH_PARAM_BUFFER_SIZE`, which specifies that the - next value in `extra` will be a pointer to a size_t containing the - size of the buffer specified with - :py:obj:`~.CU_LAUNCH_PARAM_BUFFER_POINTER`; +def cudaGraphAddEventRecordNode(graph, pDependencies : Optional[tuple[cudaGraphNode_t] | list[cudaGraphNode_t]], size_t numDependencies, event): + """ Creates an event record node and adds it to a graph. - The error :py:obj:`~.cudaErrorInvalidValue` will be returned if kernel - parameters are specified with both `kernelParams` and `extra` (i.e. - both `kernelParams` and `extra` are non-NULL). + Creates a new event record node and adds it to `hGraph` with + `numDependencies` dependencies specified via `dependencies` and event + specified in `event`. It is possible for `numDependencies` to be 0, in + which case the node will be placed at the root of the graph. + `dependencies` may not have any duplicate entries. A handle to the new + node will be returned in `phGraphNode`. - The `kernelParams` or `extra` array, as well as the argument values it - points to, are copied during this call. + Each launch of the graph will record `event` to capture execution of + the node's dependencies. + + These nodes may not be used in loops or conditionals. Parameters ---------- - graph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` + hGraph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` Graph to which to add the node - pDependencies : List[:py:obj:`~.cudaGraphNode_t`] + dependencies : list[:py:obj:`~.cudaGraphNode_t`] Dependencies of the node numDependencies : size_t Number of dependencies - pNodeParams : :py:obj:`~.cudaKernelNodeParams` - Parameters for the GPU execution node + event : :py:obj:`~.CUevent` or :py:obj:`~.cudaEvent_t` + Event for the node Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidDeviceFunction` - pGraphNode : :py:obj:`~.cudaGraphNode_t` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + phGraphNode : :py:obj:`~.cudaGraphNode_t` Returns newly created node See Also -------- - :py:obj:`~.cudaGraphAddNode`, :py:obj:`~.cudaLaunchKernel`, :py:obj:`~.cudaGraphKernelNodeGetParams`, :py:obj:`~.cudaGraphKernelNodeSetParams`, :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphDestroyNode`, :py:obj:`~.cudaGraphAddChildGraphNode`, :py:obj:`~.cudaGraphAddEmptyNode`, :py:obj:`~.cudaGraphAddHostNode`, :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphAddMemsetNode` - - Notes - ----- - Kernels launched using graphs must not use texture and surface references. Reading or writing through any texture or surface reference is undefined behavior. This restriction does not apply to texture and surface objects. + :py:obj:`~.cudaGraphAddNode`, :py:obj:`~.cudaGraphAddEventWaitNode`, :py:obj:`~.cudaEventRecordWithFlags`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphDestroyNode`, :py:obj:`~.cudaGraphAddChildGraphNode`, :py:obj:`~.cudaGraphAddEmptyNode`, :py:obj:`~.cudaGraphAddKernelNode`, :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphAddMemsetNode` """ + cdef cyruntime.cudaEvent_t cyevent + if event is None: + pevent = 0 + elif isinstance(event, (cudaEvent_t,driver.CUevent)): + pevent = int(event) + else: + pevent = int(cudaEvent_t(event)) + cyevent = pevent pDependencies = [] if pDependencies is None else pDependencies - if not all(isinstance(_x, (cudaGraphNode_t,cuda.CUgraphNode)) for _x in pDependencies): - raise TypeError("Argument 'pDependencies' is not instance of type (expected List[ccudart.cudaGraphNode_t,cuda.CUgraphNode]") - cdef ccudart.cudaGraph_t cgraph + if not all(isinstance(_x, (cudaGraphNode_t,driver.CUgraphNode)) for _x in pDependencies): + raise TypeError("Argument 'pDependencies' is not instance of type (expected tuple[cyruntime.cudaGraphNode_t,driver.CUgraphNode] or list[cyruntime.cudaGraphNode_t,driver.CUgraphNode]") + cdef cyruntime.cudaGraph_t cygraph if graph is None: - cgraph = 0 - elif isinstance(graph, (cudaGraph_t,cuda.CUgraph)): + pgraph = 0 + elif isinstance(graph, (cudaGraph_t,driver.CUgraph)): pgraph = int(graph) - cgraph = pgraph else: pgraph = int(cudaGraph_t(graph)) - cgraph = pgraph + cygraph = pgraph cdef cudaGraphNode_t pGraphNode = cudaGraphNode_t() - cdef ccudart.cudaGraphNode_t* cpDependencies = NULL - if len(pDependencies) > 0: - cpDependencies = calloc(len(pDependencies), sizeof(ccudart.cudaGraphNode_t)) - if cpDependencies is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(pDependencies)) + 'x' + str(sizeof(ccudart.cudaGraphNode_t))) + cdef cyruntime.cudaGraphNode_t* cypDependencies = NULL + if len(pDependencies) > 1: + cypDependencies = calloc(len(pDependencies), sizeof(cyruntime.cudaGraphNode_t)) + if cypDependencies is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(pDependencies)) + 'x' + str(sizeof(cyruntime.cudaGraphNode_t))) else: for idx in range(len(pDependencies)): - cpDependencies[idx] = (pDependencies[idx])._ptr[0] + cypDependencies[idx] = (pDependencies[idx])._pvt_ptr[0] + elif len(pDependencies) == 1: + cypDependencies = (pDependencies[0])._pvt_ptr if numDependencies > len(pDependencies): raise RuntimeError("List is too small: " + str(len(pDependencies)) + " < " + str(numDependencies)) - cdef ccudart.cudaKernelNodeParams* cpNodeParams_ptr = pNodeParams._ptr if pNodeParams != None else NULL - err = ccudart.cudaGraphAddKernelNode(pGraphNode._ptr, cgraph, (pDependencies[0])._ptr if len(pDependencies) == 1 else cpDependencies, numDependencies, cpNodeParams_ptr) - if cpDependencies is not NULL: - free(cpDependencies) - return (cudaError_t(err), pGraphNode) -{{endif}} - -{{if 'cudaGraphKernelNodeGetParams' in found_functions}} + with nogil: + err = cyruntime.cudaGraphAddEventRecordNode(pGraphNode._pvt_ptr, cygraph, cypDependencies, numDependencies, cyevent) + if len(pDependencies) > 1 and cypDependencies is not NULL: + free(cypDependencies) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, pGraphNode) @cython.embedsignature(True) -def cudaGraphKernelNodeGetParams(node): - """ Returns a kernel node's parameters. - - Returns the parameters of kernel node `node` in `pNodeParams`. The - `kernelParams` or `extra` array returned in `pNodeParams`, as well as - the argument values it points to, are owned by the node. This memory - remains valid until the node is destroyed or its parameters are - modified, and should not be modified directly. Use - :py:obj:`~.cudaGraphKernelNodeSetParams` to update the parameters of - this node. +def cudaGraphEventRecordNodeGetEvent(node): + """ Returns the event associated with an event record node. - The params will contain either `kernelParams` or `extra`, according to - which of these was most recently set on the node. + Returns the event of event record node `hNode` in `event_out`. Parameters ---------- - node : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` - Node to get the parameters for + hNode : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` + Node to get the event for Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidDeviceFunction` - pNodeParams : :py:obj:`~.cudaKernelNodeParams` - Pointer to return the parameters + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + event_out : :py:obj:`~.cudaEvent_t` + Pointer to return the event See Also -------- - :py:obj:`~.cudaLaunchKernel`, :py:obj:`~.cudaGraphAddKernelNode`, :py:obj:`~.cudaGraphKernelNodeSetParams` + :py:obj:`~.cudaGraphAddEventRecordNode`, :py:obj:`~.cudaGraphEventRecordNodeSetEvent`, :py:obj:`~.cudaGraphEventWaitNodeGetEvent`, :py:obj:`~.cudaEventRecordWithFlags`, :py:obj:`~.cudaStreamWaitEvent` """ - cdef ccudart.cudaGraphNode_t cnode + cdef cyruntime.cudaGraphNode_t cynode if node is None: - cnode = 0 - elif isinstance(node, (cudaGraphNode_t,cuda.CUgraphNode)): + pnode = 0 + elif isinstance(node, (cudaGraphNode_t,driver.CUgraphNode)): pnode = int(node) - cnode = pnode else: pnode = int(cudaGraphNode_t(node)) - cnode = pnode - cdef cudaKernelNodeParams pNodeParams = cudaKernelNodeParams() - err = ccudart.cudaGraphKernelNodeGetParams(cnode, pNodeParams._ptr) - return (cudaError_t(err), pNodeParams) -{{endif}} - -{{if 'cudaGraphKernelNodeSetParams' in found_functions}} + cynode = pnode + cdef cudaEvent_t event_out = cudaEvent_t() + with nogil: + err = cyruntime.cudaGraphEventRecordNodeGetEvent(cynode, event_out._pvt_ptr) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, event_out) @cython.embedsignature(True) -def cudaGraphKernelNodeSetParams(node, pNodeParams : Optional[cudaKernelNodeParams]): - """ Sets a kernel node's parameters. +def cudaGraphEventRecordNodeSetEvent(node, event): + """ Sets an event record node's event. - Sets the parameters of kernel node `node` to `pNodeParams`. + Sets the event of event record node `hNode` to `event`. Parameters ---------- - node : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` - Node to set the parameters for - pNodeParams : :py:obj:`~.cudaKernelNodeParams` - Parameters to copy + hNode : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` + Node to set the event for + event : :py:obj:`~.CUevent` or :py:obj:`~.cudaEvent_t` + Event to use Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorMemoryAllocation` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` See Also -------- - :py:obj:`~.cudaGraphNodeSetParams`, :py:obj:`~.cudaLaunchKernel`, :py:obj:`~.cudaGraphAddKernelNode`, :py:obj:`~.cudaGraphKernelNodeGetParams` + :py:obj:`~.cudaGraphNodeSetParams`, :py:obj:`~.cudaGraphAddEventRecordNode`, :py:obj:`~.cudaGraphEventRecordNodeGetEvent`, :py:obj:`~.cudaGraphEventWaitNodeSetEvent`, :py:obj:`~.cudaEventRecordWithFlags`, :py:obj:`~.cudaStreamWaitEvent` """ - cdef ccudart.cudaGraphNode_t cnode + cdef cyruntime.cudaEvent_t cyevent + if event is None: + pevent = 0 + elif isinstance(event, (cudaEvent_t,driver.CUevent)): + pevent = int(event) + else: + pevent = int(cudaEvent_t(event)) + cyevent = pevent + cdef cyruntime.cudaGraphNode_t cynode if node is None: - cnode = 0 - elif isinstance(node, (cudaGraphNode_t,cuda.CUgraphNode)): + pnode = 0 + elif isinstance(node, (cudaGraphNode_t,driver.CUgraphNode)): pnode = int(node) - cnode = pnode else: pnode = int(cudaGraphNode_t(node)) - cnode = pnode - cdef ccudart.cudaKernelNodeParams* cpNodeParams_ptr = pNodeParams._ptr if pNodeParams != None else NULL - err = ccudart.cudaGraphKernelNodeSetParams(cnode, cpNodeParams_ptr) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaGraphKernelNodeCopyAttributes' in found_functions}} + cynode = pnode + with nogil: + err = cyruntime.cudaGraphEventRecordNodeSetEvent(cynode, cyevent) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaGraphKernelNodeCopyAttributes(hSrc, hDst): - """ Copies attributes from source node to destination node. +def cudaGraphAddEventWaitNode(graph, pDependencies : Optional[tuple[cudaGraphNode_t] | list[cudaGraphNode_t]], size_t numDependencies, event): + """ Creates an event wait node and adds it to a graph. - Copies attributes from source node `src` to destination node `dst`. - Both node must have the same context. + Creates a new event wait node and adds it to `hGraph` with + `numDependencies` dependencies specified via `dependencies` and event + specified in `event`. It is possible for `numDependencies` to be 0, in + which case the node will be placed at the root of the graph. + `dependencies` may not have any duplicate entries. A handle to the new + node will be returned in `phGraphNode`. + + The graph node will wait for all work captured in `event`. See + :py:obj:`~.cuEventRecord()` for details on what is captured by an + event. The synchronization will be performed efficiently on the device + when applicable. `event` may be from a different context or device than + the launch stream. + + These nodes may not be used in loops or conditionals. Parameters ---------- - dst : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` - Destination node - src : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` - Source node For list of attributes see - :py:obj:`~.cudaKernelNodeAttrID` + hGraph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` + Graph to which to add the node + dependencies : list[:py:obj:`~.cudaGraphNode_t`] + Dependencies of the node + numDependencies : size_t + Number of dependencies + event : :py:obj:`~.CUevent` or :py:obj:`~.cudaEvent_t` + Event for the node Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidContext` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + phGraphNode : :py:obj:`~.cudaGraphNode_t` + Returns newly created node See Also -------- - :py:obj:`~.cudaAccessPolicyWindow` + :py:obj:`~.cudaGraphAddNode`, :py:obj:`~.cudaGraphAddEventRecordNode`, :py:obj:`~.cudaEventRecordWithFlags`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphDestroyNode`, :py:obj:`~.cudaGraphAddChildGraphNode`, :py:obj:`~.cudaGraphAddEmptyNode`, :py:obj:`~.cudaGraphAddKernelNode`, :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphAddMemsetNode` """ - cdef ccudart.cudaGraphNode_t chDst - if hDst is None: - chDst = 0 - elif isinstance(hDst, (cudaGraphNode_t,cuda.CUgraphNode)): - phDst = int(hDst) - chDst = phDst + cdef cyruntime.cudaEvent_t cyevent + if event is None: + pevent = 0 + elif isinstance(event, (cudaEvent_t,driver.CUevent)): + pevent = int(event) else: - phDst = int(cudaGraphNode_t(hDst)) - chDst = phDst - cdef ccudart.cudaGraphNode_t chSrc - if hSrc is None: - chSrc = 0 - elif isinstance(hSrc, (cudaGraphNode_t,cuda.CUgraphNode)): - phSrc = int(hSrc) - chSrc = phSrc + pevent = int(cudaEvent_t(event)) + cyevent = pevent + pDependencies = [] if pDependencies is None else pDependencies + if not all(isinstance(_x, (cudaGraphNode_t,driver.CUgraphNode)) for _x in pDependencies): + raise TypeError("Argument 'pDependencies' is not instance of type (expected tuple[cyruntime.cudaGraphNode_t,driver.CUgraphNode] or list[cyruntime.cudaGraphNode_t,driver.CUgraphNode]") + cdef cyruntime.cudaGraph_t cygraph + if graph is None: + pgraph = 0 + elif isinstance(graph, (cudaGraph_t,driver.CUgraph)): + pgraph = int(graph) else: - phSrc = int(cudaGraphNode_t(hSrc)) - chSrc = phSrc - err = ccudart.cudaGraphKernelNodeCopyAttributes(chSrc, chDst) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaGraphKernelNodeGetAttribute' in found_functions}} + pgraph = int(cudaGraph_t(graph)) + cygraph = pgraph + cdef cudaGraphNode_t pGraphNode = cudaGraphNode_t() + cdef cyruntime.cudaGraphNode_t* cypDependencies = NULL + if len(pDependencies) > 1: + cypDependencies = calloc(len(pDependencies), sizeof(cyruntime.cudaGraphNode_t)) + if cypDependencies is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(pDependencies)) + 'x' + str(sizeof(cyruntime.cudaGraphNode_t))) + else: + for idx in range(len(pDependencies)): + cypDependencies[idx] = (pDependencies[idx])._pvt_ptr[0] + elif len(pDependencies) == 1: + cypDependencies = (pDependencies[0])._pvt_ptr + if numDependencies > len(pDependencies): raise RuntimeError("List is too small: " + str(len(pDependencies)) + " < " + str(numDependencies)) + with nogil: + err = cyruntime.cudaGraphAddEventWaitNode(pGraphNode._pvt_ptr, cygraph, cypDependencies, numDependencies, cyevent) + if len(pDependencies) > 1 and cypDependencies is not NULL: + free(cypDependencies) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, pGraphNode) @cython.embedsignature(True) -def cudaGraphKernelNodeGetAttribute(hNode, attr not None : cudaKernelNodeAttrID): - """ Queries node attribute. +def cudaGraphEventWaitNodeGetEvent(node): + """ Returns the event associated with an event wait node. - Queries attribute `attr` from node `hNode` and stores it in - corresponding member of `value_out`. + Returns the event of event wait node `hNode` in `event_out`. Parameters ---------- hNode : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` + Node to get the event for - attr : :py:obj:`~.cudaKernelNodeAttrID` + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + event_out : :py:obj:`~.cudaEvent_t` + Pointer to return the event + + See Also + -------- + :py:obj:`~.cudaGraphAddEventWaitNode`, :py:obj:`~.cudaGraphEventWaitNodeSetEvent`, :py:obj:`~.cudaGraphEventRecordNodeGetEvent`, :py:obj:`~.cudaEventRecordWithFlags`, :py:obj:`~.cudaStreamWaitEvent` + """ + cdef cyruntime.cudaGraphNode_t cynode + if node is None: + pnode = 0 + elif isinstance(node, (cudaGraphNode_t,driver.CUgraphNode)): + pnode = int(node) + else: + pnode = int(cudaGraphNode_t(node)) + cynode = pnode + cdef cudaEvent_t event_out = cudaEvent_t() + with nogil: + err = cyruntime.cudaGraphEventWaitNodeGetEvent(cynode, event_out._pvt_ptr) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, event_out) + +@cython.embedsignature(True) +def cudaGraphEventWaitNodeSetEvent(node, event): + """ Sets an event wait node's event. + + Sets the event of event wait node `hNode` to `event`. + Parameters + ---------- + hNode : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` + Node to set the event for + event : :py:obj:`~.CUevent` or :py:obj:`~.cudaEvent_t` + Event to use Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle` - value_out : :py:obj:`~.cudaKernelNodeAttrValue` - + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` See Also -------- - :py:obj:`~.cudaAccessPolicyWindow` + :py:obj:`~.cudaGraphNodeSetParams`, :py:obj:`~.cudaGraphAddEventWaitNode`, :py:obj:`~.cudaGraphEventWaitNodeGetEvent`, :py:obj:`~.cudaGraphEventRecordNodeSetEvent`, :py:obj:`~.cudaEventRecordWithFlags`, :py:obj:`~.cudaStreamWaitEvent` """ - cdef ccudart.cudaGraphNode_t chNode - if hNode is None: - chNode = 0 - elif isinstance(hNode, (cudaGraphNode_t,cuda.CUgraphNode)): - phNode = int(hNode) - chNode = phNode + cdef cyruntime.cudaEvent_t cyevent + if event is None: + pevent = 0 + elif isinstance(event, (cudaEvent_t,driver.CUevent)): + pevent = int(event) else: - phNode = int(cudaGraphNode_t(hNode)) - chNode = phNode - cdef ccudart.cudaKernelNodeAttrID cattr = attr.value - cdef cudaKernelNodeAttrValue value_out = cudaKernelNodeAttrValue() - err = ccudart.cudaGraphKernelNodeGetAttribute(chNode, cattr, value_out._ptr) - return (cudaError_t(err), value_out) -{{endif}} + pevent = int(cudaEvent_t(event)) + cyevent = pevent + cdef cyruntime.cudaGraphNode_t cynode + if node is None: + pnode = 0 + elif isinstance(node, (cudaGraphNode_t,driver.CUgraphNode)): + pnode = int(node) + else: + pnode = int(cudaGraphNode_t(node)) + cynode = pnode + with nogil: + err = cyruntime.cudaGraphEventWaitNodeSetEvent(cynode, cyevent) + return (_cudaError_t(err),) + +@cython.embedsignature(True) +def cudaGraphAddExternalSemaphoresSignalNode(graph, pDependencies : Optional[tuple[cudaGraphNode_t] | list[cudaGraphNode_t]], size_t numDependencies, nodeParams : Optional[cudaExternalSemaphoreSignalNodeParams]): + """ Creates an external semaphore signal node and adds it to a graph. + + Creates a new external semaphore signal node and adds it to `graph` + with `numDependencies` dependencies specified via `dependencies` and + arguments specified in `nodeParams`. It is possible for + `numDependencies` to be 0, in which case the node will be placed at the + root of the graph. `dependencies` may not have any duplicate entries. A + handle to the new node will be returned in `pGraphNode`. + + Performs a signal operation on a set of externally allocated semaphore + objects when the node is launched. The operation(s) will occur after + all of the node's dependencies have completed. + + Parameters + ---------- + graph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` + Graph to which to add the node + pDependencies : list[:py:obj:`~.cudaGraphNode_t`] + Dependencies of the node + numDependencies : size_t + Number of dependencies + nodeParams : :py:obj:`~.cudaExternalSemaphoreSignalNodeParams` + Parameters for the node + + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + pGraphNode : :py:obj:`~.cudaGraphNode_t` + Returns newly created node -{{if 'cudaGraphKernelNodeSetAttribute' in found_functions}} + See Also + -------- + :py:obj:`~.cudaGraphAddNode`, :py:obj:`~.cudaGraphExternalSemaphoresSignalNodeGetParams`, :py:obj:`~.cudaGraphExternalSemaphoresSignalNodeSetParams`, :py:obj:`~.cudaGraphExecExternalSemaphoresSignalNodeSetParams`, :py:obj:`~.cudaGraphAddExternalSemaphoresWaitNode`, :py:obj:`~.cudaImportExternalSemaphore`, :py:obj:`~.cudaSignalExternalSemaphoresAsync`, :py:obj:`~.cudaWaitExternalSemaphoresAsync`, :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphDestroyNode`, :py:obj:`~.cudaGraphAddEventRecordNode`, :py:obj:`~.cudaGraphAddEventWaitNode`, :py:obj:`~.cudaGraphAddChildGraphNode`, :py:obj:`~.cudaGraphAddEmptyNode`, :py:obj:`~.cudaGraphAddKernelNode`, :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphAddMemsetNode` + """ + pDependencies = [] if pDependencies is None else pDependencies + if not all(isinstance(_x, (cudaGraphNode_t,driver.CUgraphNode)) for _x in pDependencies): + raise TypeError("Argument 'pDependencies' is not instance of type (expected tuple[cyruntime.cudaGraphNode_t,driver.CUgraphNode] or list[cyruntime.cudaGraphNode_t,driver.CUgraphNode]") + cdef cyruntime.cudaGraph_t cygraph + if graph is None: + pgraph = 0 + elif isinstance(graph, (cudaGraph_t,driver.CUgraph)): + pgraph = int(graph) + else: + pgraph = int(cudaGraph_t(graph)) + cygraph = pgraph + cdef cudaGraphNode_t pGraphNode = cudaGraphNode_t() + cdef cyruntime.cudaGraphNode_t* cypDependencies = NULL + if len(pDependencies) > 1: + cypDependencies = calloc(len(pDependencies), sizeof(cyruntime.cudaGraphNode_t)) + if cypDependencies is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(pDependencies)) + 'x' + str(sizeof(cyruntime.cudaGraphNode_t))) + else: + for idx in range(len(pDependencies)): + cypDependencies[idx] = (pDependencies[idx])._pvt_ptr[0] + elif len(pDependencies) == 1: + cypDependencies = (pDependencies[0])._pvt_ptr + if numDependencies > len(pDependencies): raise RuntimeError("List is too small: " + str(len(pDependencies)) + " < " + str(numDependencies)) + cdef cyruntime.cudaExternalSemaphoreSignalNodeParams* cynodeParams_ptr = nodeParams._pvt_ptr if nodeParams is not None else NULL + with nogil: + err = cyruntime.cudaGraphAddExternalSemaphoresSignalNode(pGraphNode._pvt_ptr, cygraph, cypDependencies, numDependencies, cynodeParams_ptr) + if len(pDependencies) > 1 and cypDependencies is not NULL: + free(cypDependencies) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, pGraphNode) @cython.embedsignature(True) -def cudaGraphKernelNodeSetAttribute(hNode, attr not None : cudaKernelNodeAttrID, value : Optional[cudaKernelNodeAttrValue]): - """ Sets node attribute. +def cudaGraphExternalSemaphoresSignalNodeGetParams(hNode): + """ Returns an external semaphore signal node's parameters. - Sets attribute `attr` on node `hNode` from corresponding attribute of - `value`. + Returns the parameters of an external semaphore signal node `hNode` in + `params_out`. The `extSemArray` and `paramsArray` returned in + `params_out`, are owned by the node. This memory remains valid until + the node is destroyed or its parameters are modified, and should not be + modified directly. Use + :py:obj:`~.cudaGraphExternalSemaphoresSignalNodeSetParams` to update + the parameters of this node. Parameters ---------- hNode : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` - - attr : :py:obj:`~.cudaKernelNodeAttrID` - - value : :py:obj:`~.cudaKernelNodeAttrValue` - + Node to get the parameters for Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + params_out : :py:obj:`~.cudaExternalSemaphoreSignalNodeParams` + Pointer to return the parameters See Also -------- - :py:obj:`~.cudaAccessPolicyWindow` + :py:obj:`~.cudaGraphNodeGetParams`, :py:obj:`~.cudaLaunchKernel`, :py:obj:`~.cudaGraphAddExternalSemaphoresSignalNode`, :py:obj:`~.cudaGraphExternalSemaphoresSignalNodeSetParams`, :py:obj:`~.cudaGraphAddExternalSemaphoresWaitNode`, :py:obj:`~.cudaSignalExternalSemaphoresAsync`, :py:obj:`~.cudaWaitExternalSemaphoresAsync` """ - cdef ccudart.cudaGraphNode_t chNode + cdef cyruntime.cudaGraphNode_t cyhNode if hNode is None: - chNode = 0 - elif isinstance(hNode, (cudaGraphNode_t,cuda.CUgraphNode)): + phNode = 0 + elif isinstance(hNode, (cudaGraphNode_t,driver.CUgraphNode)): phNode = int(hNode) - chNode = phNode else: phNode = int(cudaGraphNode_t(hNode)) - chNode = phNode - cdef ccudart.cudaKernelNodeAttrID cattr = attr.value - cdef ccudart.cudaKernelNodeAttrValue* cvalue_ptr = value._ptr if value != None else NULL - err = ccudart.cudaGraphKernelNodeSetAttribute(chNode, cattr, cvalue_ptr) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaGraphAddMemcpyNode' in found_functions}} + cyhNode = phNode + cdef cudaExternalSemaphoreSignalNodeParams params_out = cudaExternalSemaphoreSignalNodeParams() + with nogil: + err = cyruntime.cudaGraphExternalSemaphoresSignalNodeGetParams(cyhNode, params_out._pvt_ptr) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, params_out) @cython.embedsignature(True) -def cudaGraphAddMemcpyNode(graph, pDependencies : Optional[List[cudaGraphNode_t]], size_t numDependencies, pCopyParams : Optional[cudaMemcpy3DParms]): - """ Creates a memcpy node and adds it to a graph. - - Creates a new memcpy node and adds it to `graph` with `numDependencies` - dependencies specified via `pDependencies`. It is possible for - `numDependencies` to be 0, in which case the node will be placed at the - root of the graph. `pDependencies` may not have any duplicate entries. - A handle to the new node will be returned in `pGraphNode`. - - When the graph is launched, the node will perform the memcpy described - by `pCopyParams`. See :py:obj:`~.cudaMemcpy3D()` for a description of - the structure and its restrictions. +def cudaGraphExternalSemaphoresSignalNodeSetParams(hNode, nodeParams : Optional[cudaExternalSemaphoreSignalNodeParams]): + """ Sets an external semaphore signal node's parameters. - Memcpy nodes have some additional restrictions with regards to managed - memory, if the system contains at least one device which has a zero - value for the device attribute - :py:obj:`~.cudaDevAttrConcurrentManagedAccess`. + Sets the parameters of an external semaphore signal node `hNode` to + `nodeParams`. Parameters ---------- - graph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` - Graph to which to add the node - pDependencies : List[:py:obj:`~.cudaGraphNode_t`] - Dependencies of the node - numDependencies : size_t - Number of dependencies - pCopyParams : :py:obj:`~.cudaMemcpy3DParms` - Parameters for the memory copy + hNode : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` + Node to set the parameters for + nodeParams : :py:obj:`~.cudaExternalSemaphoreSignalNodeParams` + Parameters to copy Returns ------- cudaError_t :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` - pGraphNode : :py:obj:`~.cudaGraphNode_t` - Returns newly created node See Also -------- - :py:obj:`~.cudaGraphAddNode`, :py:obj:`~.cudaMemcpy3D`, :py:obj:`~.cudaGraphAddMemcpyNodeToSymbol`, :py:obj:`~.cudaGraphAddMemcpyNodeFromSymbol`, :py:obj:`~.cudaGraphAddMemcpyNode1D`, :py:obj:`~.cudaGraphMemcpyNodeGetParams`, :py:obj:`~.cudaGraphMemcpyNodeSetParams`, :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphDestroyNode`, :py:obj:`~.cudaGraphAddChildGraphNode`, :py:obj:`~.cudaGraphAddEmptyNode`, :py:obj:`~.cudaGraphAddKernelNode`, :py:obj:`~.cudaGraphAddHostNode`, :py:obj:`~.cudaGraphAddMemsetNode` + :py:obj:`~.cudaGraphNodeSetParams`, :py:obj:`~.cudaGraphAddExternalSemaphoresSignalNode`, :py:obj:`~.cudaGraphExternalSemaphoresSignalNodeSetParams`, :py:obj:`~.cudaGraphAddExternalSemaphoresWaitNode`, :py:obj:`~.cudaSignalExternalSemaphoresAsync`, :py:obj:`~.cudaWaitExternalSemaphoresAsync` """ - pDependencies = [] if pDependencies is None else pDependencies - if not all(isinstance(_x, (cudaGraphNode_t,cuda.CUgraphNode)) for _x in pDependencies): - raise TypeError("Argument 'pDependencies' is not instance of type (expected List[ccudart.cudaGraphNode_t,cuda.CUgraphNode]") - cdef ccudart.cudaGraph_t cgraph - if graph is None: - cgraph = 0 - elif isinstance(graph, (cudaGraph_t,cuda.CUgraph)): - pgraph = int(graph) - cgraph = pgraph + cdef cyruntime.cudaGraphNode_t cyhNode + if hNode is None: + phNode = 0 + elif isinstance(hNode, (cudaGraphNode_t,driver.CUgraphNode)): + phNode = int(hNode) else: - pgraph = int(cudaGraph_t(graph)) - cgraph = pgraph - cdef cudaGraphNode_t pGraphNode = cudaGraphNode_t() - cdef ccudart.cudaGraphNode_t* cpDependencies = NULL - if len(pDependencies) > 0: - cpDependencies = calloc(len(pDependencies), sizeof(ccudart.cudaGraphNode_t)) - if cpDependencies is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(pDependencies)) + 'x' + str(sizeof(ccudart.cudaGraphNode_t))) - else: - for idx in range(len(pDependencies)): - cpDependencies[idx] = (pDependencies[idx])._ptr[0] - if numDependencies > len(pDependencies): raise RuntimeError("List is too small: " + str(len(pDependencies)) + " < " + str(numDependencies)) - cdef ccudart.cudaMemcpy3DParms* cpCopyParams_ptr = pCopyParams._ptr if pCopyParams != None else NULL - err = ccudart.cudaGraphAddMemcpyNode(pGraphNode._ptr, cgraph, (pDependencies[0])._ptr if len(pDependencies) == 1 else cpDependencies, numDependencies, cpCopyParams_ptr) - if cpDependencies is not NULL: - free(cpDependencies) - return (cudaError_t(err), pGraphNode) -{{endif}} - -{{if 'cudaGraphAddMemcpyNode1D' in found_functions}} + phNode = int(cudaGraphNode_t(hNode)) + cyhNode = phNode + cdef cyruntime.cudaExternalSemaphoreSignalNodeParams* cynodeParams_ptr = nodeParams._pvt_ptr if nodeParams is not None else NULL + with nogil: + err = cyruntime.cudaGraphExternalSemaphoresSignalNodeSetParams(cyhNode, cynodeParams_ptr) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaGraphAddMemcpyNode1D(graph, pDependencies : Optional[List[cudaGraphNode_t]], size_t numDependencies, dst, src, size_t count, kind not None : cudaMemcpyKind): - """ Creates a 1D memcpy node and adds it to a graph. - - Creates a new 1D memcpy node and adds it to `graph` with - `numDependencies` dependencies specified via `pDependencies`. It is - possible for `numDependencies` to be 0, in which case the node will be - placed at the root of the graph. `pDependencies` may not have any - duplicate entries. A handle to the new node will be returned in - `pGraphNode`. +def cudaGraphAddExternalSemaphoresWaitNode(graph, pDependencies : Optional[tuple[cudaGraphNode_t] | list[cudaGraphNode_t]], size_t numDependencies, nodeParams : Optional[cudaExternalSemaphoreWaitNodeParams]): + """ Creates an external semaphore wait node and adds it to a graph. - When the graph is launched, the node will copy `count` bytes from the - memory area pointed to by `src` to the memory area pointed to by `dst`, - where `kind` specifies the direction of the copy, and must be one of - :py:obj:`~.cudaMemcpyHostToHost`, :py:obj:`~.cudaMemcpyHostToDevice`, - :py:obj:`~.cudaMemcpyDeviceToHost`, - :py:obj:`~.cudaMemcpyDeviceToDevice`, or :py:obj:`~.cudaMemcpyDefault`. - Passing :py:obj:`~.cudaMemcpyDefault` is recommended, in which case the - type of transfer is inferred from the pointer values. However, - :py:obj:`~.cudaMemcpyDefault` is only allowed on systems that support - unified virtual addressing. Launching a memcpy node with dst and src - pointers that do not match the direction of the copy results in an - undefined behavior. + Creates a new external semaphore wait node and adds it to `graph` with + `numDependencies` dependencies specified via `dependencies` and + arguments specified in `nodeParams`. It is possible for + `numDependencies` to be 0, in which case the node will be placed at the + root of the graph. `dependencies` may not have any duplicate entries. A + handle to the new node will be returned in `pGraphNode`. - Memcpy nodes have some additional restrictions with regards to managed - memory, if the system contains at least one device which has a zero - value for the device attribute - :py:obj:`~.cudaDevAttrConcurrentManagedAccess`. + Performs a wait operation on a set of externally allocated semaphore + objects when the node is launched. The node's dependencies will not be + launched until the wait operation has completed. Parameters ---------- graph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` Graph to which to add the node - pDependencies : List[:py:obj:`~.cudaGraphNode_t`] + pDependencies : list[:py:obj:`~.cudaGraphNode_t`] Dependencies of the node numDependencies : size_t Number of dependencies - dst : Any - Destination memory address - src : Any - Source memory address - count : size_t - Size in bytes to copy - kind : :py:obj:`~.cudaMemcpyKind` - Type of transfer + nodeParams : :py:obj:`~.cudaExternalSemaphoreWaitNodeParams` + Parameters for the node Returns ------- @@ -25517,251 +34005,235 @@ def cudaGraphAddMemcpyNode1D(graph, pDependencies : Optional[List[cudaGraphNode_ See Also -------- - :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphMemcpyNodeGetParams`, :py:obj:`~.cudaGraphMemcpyNodeSetParams`, :py:obj:`~.cudaGraphMemcpyNodeSetParams1D`, :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphDestroyNode`, :py:obj:`~.cudaGraphAddChildGraphNode`, :py:obj:`~.cudaGraphAddEmptyNode`, :py:obj:`~.cudaGraphAddKernelNode`, :py:obj:`~.cudaGraphAddHostNode`, :py:obj:`~.cudaGraphAddMemsetNode` + :py:obj:`~.cudaGraphAddNode`, :py:obj:`~.cudaGraphExternalSemaphoresWaitNodeGetParams`, :py:obj:`~.cudaGraphExternalSemaphoresWaitNodeSetParams`, :py:obj:`~.cudaGraphExecExternalSemaphoresWaitNodeSetParams`, :py:obj:`~.cudaGraphAddExternalSemaphoresSignalNode`, :py:obj:`~.cudaImportExternalSemaphore`, :py:obj:`~.cudaSignalExternalSemaphoresAsync`, :py:obj:`~.cudaWaitExternalSemaphoresAsync`, :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphDestroyNode`, :py:obj:`~.cudaGraphAddEventRecordNode`, :py:obj:`~.cudaGraphAddEventWaitNode`, :py:obj:`~.cudaGraphAddChildGraphNode`, :py:obj:`~.cudaGraphAddEmptyNode`, :py:obj:`~.cudaGraphAddKernelNode`, :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphAddMemsetNode` """ pDependencies = [] if pDependencies is None else pDependencies - if not all(isinstance(_x, (cudaGraphNode_t,cuda.CUgraphNode)) for _x in pDependencies): - raise TypeError("Argument 'pDependencies' is not instance of type (expected List[ccudart.cudaGraphNode_t,cuda.CUgraphNode]") - cdef ccudart.cudaGraph_t cgraph + if not all(isinstance(_x, (cudaGraphNode_t,driver.CUgraphNode)) for _x in pDependencies): + raise TypeError("Argument 'pDependencies' is not instance of type (expected tuple[cyruntime.cudaGraphNode_t,driver.CUgraphNode] or list[cyruntime.cudaGraphNode_t,driver.CUgraphNode]") + cdef cyruntime.cudaGraph_t cygraph if graph is None: - cgraph = 0 - elif isinstance(graph, (cudaGraph_t,cuda.CUgraph)): + pgraph = 0 + elif isinstance(graph, (cudaGraph_t,driver.CUgraph)): pgraph = int(graph) - cgraph = pgraph else: pgraph = int(cudaGraph_t(graph)) - cgraph = pgraph + cygraph = pgraph cdef cudaGraphNode_t pGraphNode = cudaGraphNode_t() - cdef ccudart.cudaGraphNode_t* cpDependencies = NULL - if len(pDependencies) > 0: - cpDependencies = calloc(len(pDependencies), sizeof(ccudart.cudaGraphNode_t)) - if cpDependencies is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(pDependencies)) + 'x' + str(sizeof(ccudart.cudaGraphNode_t))) + cdef cyruntime.cudaGraphNode_t* cypDependencies = NULL + if len(pDependencies) > 1: + cypDependencies = calloc(len(pDependencies), sizeof(cyruntime.cudaGraphNode_t)) + if cypDependencies is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(pDependencies)) + 'x' + str(sizeof(cyruntime.cudaGraphNode_t))) else: for idx in range(len(pDependencies)): - cpDependencies[idx] = (pDependencies[idx])._ptr[0] - cdst = utils.HelperInputVoidPtr(dst) - cdef void* cdst_ptr = cdst.cptr - csrc = utils.HelperInputVoidPtr(src) - cdef void* csrc_ptr = csrc.cptr - cdef ccudart.cudaMemcpyKind ckind = kind.value - err = ccudart.cudaGraphAddMemcpyNode1D(pGraphNode._ptr, cgraph, (pDependencies[0])._ptr if len(pDependencies) == 1 else cpDependencies, numDependencies, cdst_ptr, csrc_ptr, count, ckind) - if cpDependencies is not NULL: - free(cpDependencies) - return (cudaError_t(err), pGraphNode) -{{endif}} - -{{if 'cudaGraphMemcpyNodeGetParams' in found_functions}} + cypDependencies[idx] = (pDependencies[idx])._pvt_ptr[0] + elif len(pDependencies) == 1: + cypDependencies = (pDependencies[0])._pvt_ptr + if numDependencies > len(pDependencies): raise RuntimeError("List is too small: " + str(len(pDependencies)) + " < " + str(numDependencies)) + cdef cyruntime.cudaExternalSemaphoreWaitNodeParams* cynodeParams_ptr = nodeParams._pvt_ptr if nodeParams is not None else NULL + with nogil: + err = cyruntime.cudaGraphAddExternalSemaphoresWaitNode(pGraphNode._pvt_ptr, cygraph, cypDependencies, numDependencies, cynodeParams_ptr) + if len(pDependencies) > 1 and cypDependencies is not NULL: + free(cypDependencies) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, pGraphNode) @cython.embedsignature(True) -def cudaGraphMemcpyNodeGetParams(node): - """ Returns a memcpy node's parameters. +def cudaGraphExternalSemaphoresWaitNodeGetParams(hNode): + """ Returns an external semaphore wait node's parameters. - Returns the parameters of memcpy node `node` in `pNodeParams`. + Returns the parameters of an external semaphore wait node `hNode` in + `params_out`. The `extSemArray` and `paramsArray` returned in + `params_out`, are owned by the node. This memory remains valid until + the node is destroyed or its parameters are modified, and should not be + modified directly. Use + :py:obj:`~.cudaGraphExternalSemaphoresSignalNodeSetParams` to update + the parameters of this node. Parameters ---------- - node : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` + hNode : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` Node to get the parameters for Returns ------- cudaError_t :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` - pNodeParams : :py:obj:`~.cudaMemcpy3DParms` + params_out : :py:obj:`~.cudaExternalSemaphoreWaitNodeParams` Pointer to return the parameters See Also -------- - :py:obj:`~.cudaMemcpy3D`, :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphMemcpyNodeSetParams` + :py:obj:`~.cudaGraphNodeGetParams`, :py:obj:`~.cudaLaunchKernel`, :py:obj:`~.cudaGraphAddExternalSemaphoresWaitNode`, :py:obj:`~.cudaGraphExternalSemaphoresWaitNodeSetParams`, :py:obj:`~.cudaGraphAddExternalSemaphoresWaitNode`, :py:obj:`~.cudaSignalExternalSemaphoresAsync`, :py:obj:`~.cudaWaitExternalSemaphoresAsync` """ - cdef ccudart.cudaGraphNode_t cnode - if node is None: - cnode = 0 - elif isinstance(node, (cudaGraphNode_t,cuda.CUgraphNode)): - pnode = int(node) - cnode = pnode + cdef cyruntime.cudaGraphNode_t cyhNode + if hNode is None: + phNode = 0 + elif isinstance(hNode, (cudaGraphNode_t,driver.CUgraphNode)): + phNode = int(hNode) else: - pnode = int(cudaGraphNode_t(node)) - cnode = pnode - cdef cudaMemcpy3DParms pNodeParams = cudaMemcpy3DParms() - err = ccudart.cudaGraphMemcpyNodeGetParams(cnode, pNodeParams._ptr) - return (cudaError_t(err), pNodeParams) -{{endif}} - -{{if 'cudaGraphMemcpyNodeSetParams' in found_functions}} + phNode = int(cudaGraphNode_t(hNode)) + cyhNode = phNode + cdef cudaExternalSemaphoreWaitNodeParams params_out = cudaExternalSemaphoreWaitNodeParams() + with nogil: + err = cyruntime.cudaGraphExternalSemaphoresWaitNodeGetParams(cyhNode, params_out._pvt_ptr) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, params_out) @cython.embedsignature(True) -def cudaGraphMemcpyNodeSetParams(node, pNodeParams : Optional[cudaMemcpy3DParms]): - """ Sets a memcpy node's parameters. +def cudaGraphExternalSemaphoresWaitNodeSetParams(hNode, nodeParams : Optional[cudaExternalSemaphoreWaitNodeParams]): + """ Sets an external semaphore wait node's parameters. - Sets the parameters of memcpy node `node` to `pNodeParams`. + Sets the parameters of an external semaphore wait node `hNode` to + `nodeParams`. Parameters ---------- - node : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` + hNode : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` Node to set the parameters for - pNodeParams : :py:obj:`~.cudaMemcpy3DParms` + nodeParams : :py:obj:`~.cudaExternalSemaphoreWaitNodeParams` Parameters to copy Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` See Also -------- - :py:obj:`~.cudaGraphNodeSetParams`, :py:obj:`~.cudaMemcpy3D`, :py:obj:`~.cudaGraphMemcpyNodeSetParamsToSymbol`, :py:obj:`~.cudaGraphMemcpyNodeSetParamsFromSymbol`, :py:obj:`~.cudaGraphMemcpyNodeSetParams1D`, :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphMemcpyNodeGetParams` + :py:obj:`~.cudaGraphNodeSetParams`, :py:obj:`~.cudaGraphAddExternalSemaphoresWaitNode`, :py:obj:`~.cudaGraphExternalSemaphoresWaitNodeSetParams`, :py:obj:`~.cudaGraphAddExternalSemaphoresWaitNode`, :py:obj:`~.cudaSignalExternalSemaphoresAsync`, :py:obj:`~.cudaWaitExternalSemaphoresAsync` """ - cdef ccudart.cudaGraphNode_t cnode - if node is None: - cnode = 0 - elif isinstance(node, (cudaGraphNode_t,cuda.CUgraphNode)): - pnode = int(node) - cnode = pnode + cdef cyruntime.cudaGraphNode_t cyhNode + if hNode is None: + phNode = 0 + elif isinstance(hNode, (cudaGraphNode_t,driver.CUgraphNode)): + phNode = int(hNode) else: - pnode = int(cudaGraphNode_t(node)) - cnode = pnode - cdef ccudart.cudaMemcpy3DParms* cpNodeParams_ptr = pNodeParams._ptr if pNodeParams != None else NULL - err = ccudart.cudaGraphMemcpyNodeSetParams(cnode, cpNodeParams_ptr) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaGraphMemcpyNodeSetParams1D' in found_functions}} + phNode = int(cudaGraphNode_t(hNode)) + cyhNode = phNode + cdef cyruntime.cudaExternalSemaphoreWaitNodeParams* cynodeParams_ptr = nodeParams._pvt_ptr if nodeParams is not None else NULL + with nogil: + err = cyruntime.cudaGraphExternalSemaphoresWaitNodeSetParams(cyhNode, cynodeParams_ptr) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaGraphMemcpyNodeSetParams1D(node, dst, src, size_t count, kind not None : cudaMemcpyKind): - """ Sets a memcpy node's parameters to perform a 1-dimensional copy. +def cudaGraphAddMemAllocNode(graph, pDependencies : Optional[tuple[cudaGraphNode_t] | list[cudaGraphNode_t]], size_t numDependencies, nodeParams : Optional[cudaMemAllocNodeParams]): + """ Creates an allocation node and adds it to a graph. - Sets the parameters of memcpy node `node` to the copy described by the - provided parameters. + Creates a new allocation node and adds it to `graph` with + `numDependencies` dependencies specified via `pDependencies` and + arguments specified in `nodeParams`. It is possible for + `numDependencies` to be 0, in which case the node will be placed at the + root of the graph. `pDependencies` may not have any duplicate entries. + A handle to the new node will be returned in `pGraphNode`. - When the graph is launched, the node will copy `count` bytes from the - memory area pointed to by `src` to the memory area pointed to by `dst`, - where `kind` specifies the direction of the copy, and must be one of - :py:obj:`~.cudaMemcpyHostToHost`, :py:obj:`~.cudaMemcpyHostToDevice`, - :py:obj:`~.cudaMemcpyDeviceToHost`, - :py:obj:`~.cudaMemcpyDeviceToDevice`, or :py:obj:`~.cudaMemcpyDefault`. - Passing :py:obj:`~.cudaMemcpyDefault` is recommended, in which case the - type of transfer is inferred from the pointer values. However, - :py:obj:`~.cudaMemcpyDefault` is only allowed on systems that support - unified virtual addressing. Launching a memcpy node with dst and src - pointers that do not match the direction of the copy results in an - undefined behavior. + When :py:obj:`~.cudaGraphAddMemAllocNode` creates an allocation node, + it returns the address of the allocation in `nodeParams.dptr`. The + allocation's address remains fixed across instantiations and launches. - Parameters - ---------- - node : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` - Node to set the parameters for - dst : Any - Destination memory address - src : Any - Source memory address - count : size_t - Size in bytes to copy - kind : :py:obj:`~.cudaMemcpyKind` - Type of transfer + If the allocation is freed in the same graph, by creating a free node + using :py:obj:`~.cudaGraphAddMemFreeNode`, the allocation can be + accessed by nodes ordered after the allocation node but before the free + node. These allocations cannot be freed outside the owning graph, and + they can only be freed once in the owning graph. - Returns - ------- - cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + If the allocation is not freed in the same graph, then it can be + accessed not only by nodes in the graph which are ordered after the + allocation node, but also by stream operations ordered after the + graph's execution but before the allocation is freed. - See Also - -------- - :py:obj:`~.cudaMemcpy`, :py:obj:`~.cudaGraphMemcpyNodeSetParams`, :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphMemcpyNodeGetParams` - """ - cdef ccudart.cudaGraphNode_t cnode - if node is None: - cnode = 0 - elif isinstance(node, (cudaGraphNode_t,cuda.CUgraphNode)): - pnode = int(node) - cnode = pnode - else: - pnode = int(cudaGraphNode_t(node)) - cnode = pnode - cdst = utils.HelperInputVoidPtr(dst) - cdef void* cdst_ptr = cdst.cptr - csrc = utils.HelperInputVoidPtr(src) - cdef void* csrc_ptr = csrc.cptr - cdef ccudart.cudaMemcpyKind ckind = kind.value - err = ccudart.cudaGraphMemcpyNodeSetParams1D(cnode, cdst_ptr, csrc_ptr, count, ckind) - return (cudaError_t(err),) -{{endif}} + Allocations which are not freed in the same graph can be freed by: -{{if 'cudaGraphAddMemsetNode' in found_functions}} + - passing the allocation to :py:obj:`~.cudaMemFreeAsync` or + :py:obj:`~.cudaMemFree`; -@cython.embedsignature(True) -def cudaGraphAddMemsetNode(graph, pDependencies : Optional[List[cudaGraphNode_t]], size_t numDependencies, pMemsetParams : Optional[cudaMemsetParams]): - """ Creates a memset node and adds it to a graph. + - launching a graph with a free node for that allocation; or - Creates a new memset node and adds it to `graph` with `numDependencies` - dependencies specified via `pDependencies`. It is possible for - `numDependencies` to be 0, in which case the node will be placed at the - root of the graph. `pDependencies` may not have any duplicate entries. - A handle to the new node will be returned in `pGraphNode`. + - specifying :py:obj:`~.cudaGraphInstantiateFlagAutoFreeOnLaunch` + during instantiation, which makes each launch behave as though it + called :py:obj:`~.cudaMemFreeAsync` for every unfreed allocation. - The element size must be 1, 2, or 4 bytes. When the graph is launched, - the node will perform the memset described by `pMemsetParams`. + It is not possible to free an allocation in both the owning graph and + another graph. If the allocation is freed in the same graph, a free + node cannot be added to another graph. If the allocation is freed in + another graph, a free node can no longer be added to the owning graph. + + The following restrictions apply to graphs which contain allocation + and/or memory free nodes: + + - Nodes and edges of the graph cannot be deleted. + + - The graph can only be used in a child node if the ownership is moved + to the parent. + + - Only one instantiation of the graph may exist at any point in time. + + - The graph cannot be cloned. Parameters ---------- graph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` Graph to which to add the node - pDependencies : List[:py:obj:`~.cudaGraphNode_t`] + pDependencies : list[:py:obj:`~.cudaGraphNode_t`] Dependencies of the node numDependencies : size_t Number of dependencies - pMemsetParams : :py:obj:`~.cudaMemsetParams` - Parameters for the memory set + nodeParams : :py:obj:`~.cudaMemAllocNodeParams` + Parameters for the node Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidDevice` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorCudartUnloading`, :py:obj:`~.cudaErrorInitializationError`, :py:obj:`~.cudaErrorNotSupported`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorOutOfMemory` pGraphNode : :py:obj:`~.cudaGraphNode_t` Returns newly created node See Also -------- - :py:obj:`~.cudaGraphAddNode`, :py:obj:`~.cudaMemset2D`, :py:obj:`~.cudaGraphMemsetNodeGetParams`, :py:obj:`~.cudaGraphMemsetNodeSetParams`, :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphDestroyNode`, :py:obj:`~.cudaGraphAddChildGraphNode`, :py:obj:`~.cudaGraphAddEmptyNode`, :py:obj:`~.cudaGraphAddKernelNode`, :py:obj:`~.cudaGraphAddHostNode`, :py:obj:`~.cudaGraphAddMemcpyNode` + :py:obj:`~.cudaGraphAddNode`, :py:obj:`~.cudaGraphAddMemFreeNode`, :py:obj:`~.cudaGraphMemAllocNodeGetParams`, :py:obj:`~.cudaDeviceGraphMemTrim`, :py:obj:`~.cudaDeviceGetGraphMemAttribute`, :py:obj:`~.cudaDeviceSetGraphMemAttribute`, :py:obj:`~.cudaMallocAsync`, :py:obj:`~.cudaFreeAsync`, :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphDestroyNode`, :py:obj:`~.cudaGraphAddChildGraphNode`, :py:obj:`~.cudaGraphAddEmptyNode`, :py:obj:`~.cudaGraphAddEventRecordNode`, :py:obj:`~.cudaGraphAddEventWaitNode`, :py:obj:`~.cudaGraphAddExternalSemaphoresSignalNode`, :py:obj:`~.cudaGraphAddExternalSemaphoresWaitNode`, :py:obj:`~.cudaGraphAddKernelNode`, :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphAddMemsetNode` """ pDependencies = [] if pDependencies is None else pDependencies - if not all(isinstance(_x, (cudaGraphNode_t,cuda.CUgraphNode)) for _x in pDependencies): - raise TypeError("Argument 'pDependencies' is not instance of type (expected List[ccudart.cudaGraphNode_t,cuda.CUgraphNode]") - cdef ccudart.cudaGraph_t cgraph + if not all(isinstance(_x, (cudaGraphNode_t,driver.CUgraphNode)) for _x in pDependencies): + raise TypeError("Argument 'pDependencies' is not instance of type (expected tuple[cyruntime.cudaGraphNode_t,driver.CUgraphNode] or list[cyruntime.cudaGraphNode_t,driver.CUgraphNode]") + cdef cyruntime.cudaGraph_t cygraph if graph is None: - cgraph = 0 - elif isinstance(graph, (cudaGraph_t,cuda.CUgraph)): + pgraph = 0 + elif isinstance(graph, (cudaGraph_t,driver.CUgraph)): pgraph = int(graph) - cgraph = pgraph else: pgraph = int(cudaGraph_t(graph)) - cgraph = pgraph + cygraph = pgraph cdef cudaGraphNode_t pGraphNode = cudaGraphNode_t() - cdef ccudart.cudaGraphNode_t* cpDependencies = NULL - if len(pDependencies) > 0: - cpDependencies = calloc(len(pDependencies), sizeof(ccudart.cudaGraphNode_t)) - if cpDependencies is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(pDependencies)) + 'x' + str(sizeof(ccudart.cudaGraphNode_t))) + cdef cyruntime.cudaGraphNode_t* cypDependencies = NULL + if len(pDependencies) > 1: + cypDependencies = calloc(len(pDependencies), sizeof(cyruntime.cudaGraphNode_t)) + if cypDependencies is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(pDependencies)) + 'x' + str(sizeof(cyruntime.cudaGraphNode_t))) else: for idx in range(len(pDependencies)): - cpDependencies[idx] = (pDependencies[idx])._ptr[0] + cypDependencies[idx] = (pDependencies[idx])._pvt_ptr[0] + elif len(pDependencies) == 1: + cypDependencies = (pDependencies[0])._pvt_ptr if numDependencies > len(pDependencies): raise RuntimeError("List is too small: " + str(len(pDependencies)) + " < " + str(numDependencies)) - cdef ccudart.cudaMemsetParams* cpMemsetParams_ptr = pMemsetParams._ptr if pMemsetParams != None else NULL - err = ccudart.cudaGraphAddMemsetNode(pGraphNode._ptr, cgraph, (pDependencies[0])._ptr if len(pDependencies) == 1 else cpDependencies, numDependencies, cpMemsetParams_ptr) - if cpDependencies is not NULL: - free(cpDependencies) - return (cudaError_t(err), pGraphNode) -{{endif}} - -{{if 'cudaGraphMemsetNodeGetParams' in found_functions}} + cdef cyruntime.cudaMemAllocNodeParams* cynodeParams_ptr = nodeParams._pvt_ptr if nodeParams is not None else NULL + with nogil: + err = cyruntime.cudaGraphAddMemAllocNode(pGraphNode._pvt_ptr, cygraph, cypDependencies, numDependencies, cynodeParams_ptr) + if len(pDependencies) > 1 and cypDependencies is not NULL: + free(cypDependencies) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, pGraphNode) @cython.embedsignature(True) -def cudaGraphMemsetNodeGetParams(node): - """ Returns a memset node's parameters. +def cudaGraphMemAllocNodeGetParams(node): + """ Returns a memory alloc node's parameters. - Returns the parameters of memset node `node` in `pNodeParams`. + Returns the parameters of a memory alloc node `hNode` in `params_out`. + The `poolProps` and `accessDescs` returned in `params_out`, are owned + by the node. This memory remains valid until the node is destroyed. The + returned parameters must not be modified. Parameters ---------- @@ -25772,139 +34244,121 @@ def cudaGraphMemsetNodeGetParams(node): ------- cudaError_t :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` - pNodeParams : :py:obj:`~.cudaMemsetParams` + params_out : :py:obj:`~.cudaMemAllocNodeParams` Pointer to return the parameters See Also -------- - :py:obj:`~.cudaMemset2D`, :py:obj:`~.cudaGraphAddMemsetNode`, :py:obj:`~.cudaGraphMemsetNodeSetParams` + :py:obj:`~.cudaGraphNodeGetParams`, :py:obj:`~.cudaGraphAddMemAllocNode`, :py:obj:`~.cudaGraphMemFreeNodeGetParams` """ - cdef ccudart.cudaGraphNode_t cnode + cdef cyruntime.cudaGraphNode_t cynode if node is None: - cnode = 0 - elif isinstance(node, (cudaGraphNode_t,cuda.CUgraphNode)): + pnode = 0 + elif isinstance(node, (cudaGraphNode_t,driver.CUgraphNode)): pnode = int(node) - cnode = pnode else: pnode = int(cudaGraphNode_t(node)) - cnode = pnode - cdef cudaMemsetParams pNodeParams = cudaMemsetParams() - err = ccudart.cudaGraphMemsetNodeGetParams(cnode, pNodeParams._ptr) - return (cudaError_t(err), pNodeParams) -{{endif}} - -{{if 'cudaGraphMemsetNodeSetParams' in found_functions}} + cynode = pnode + cdef cudaMemAllocNodeParams params_out = cudaMemAllocNodeParams() + with nogil: + err = cyruntime.cudaGraphMemAllocNodeGetParams(cynode, params_out._pvt_ptr) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, params_out) @cython.embedsignature(True) -def cudaGraphMemsetNodeSetParams(node, pNodeParams : Optional[cudaMemsetParams]): - """ Sets a memset node's parameters. +def cudaGraphAddMemFreeNode(graph, pDependencies : Optional[tuple[cudaGraphNode_t] | list[cudaGraphNode_t]], size_t numDependencies, dptr): + """ Creates a memory free node and adds it to a graph. - Sets the parameters of memset node `node` to `pNodeParams`. + Creates a new memory free node and adds it to `graph` with + `numDependencies` dependencies specified via `pDependencies` and + address specified in `dptr`. It is possible for `numDependencies` to be + 0, in which case the node will be placed at the root of the graph. + `pDependencies` may not have any duplicate entries. A handle to the new + node will be returned in `pGraphNode`. - Parameters - ---------- - node : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` - Node to set the parameters for - pNodeParams : :py:obj:`~.cudaMemsetParams` - Parameters to copy + :py:obj:`~.cudaGraphAddMemFreeNode` will return + :py:obj:`~.cudaErrorInvalidValue` if the user attempts to free: - Returns - ------- - cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + - an allocation twice in the same graph. - See Also - -------- - :py:obj:`~.cudaGraphNodeSetParams`, :py:obj:`~.cudaMemset2D`, :py:obj:`~.cudaGraphAddMemsetNode`, :py:obj:`~.cudaGraphMemsetNodeGetParams` - """ - cdef ccudart.cudaGraphNode_t cnode - if node is None: - cnode = 0 - elif isinstance(node, (cudaGraphNode_t,cuda.CUgraphNode)): - pnode = int(node) - cnode = pnode - else: - pnode = int(cudaGraphNode_t(node)) - cnode = pnode - cdef ccudart.cudaMemsetParams* cpNodeParams_ptr = pNodeParams._ptr if pNodeParams != None else NULL - err = ccudart.cudaGraphMemsetNodeSetParams(cnode, cpNodeParams_ptr) - return (cudaError_t(err),) -{{endif}} + - an address that was not returned by an allocation node. -{{if 'cudaGraphAddHostNode' in found_functions}} + - an invalid address. -@cython.embedsignature(True) -def cudaGraphAddHostNode(graph, pDependencies : Optional[List[cudaGraphNode_t]], size_t numDependencies, pNodeParams : Optional[cudaHostNodeParams]): - """ Creates a host execution node and adds it to a graph. + The following restrictions apply to graphs which contain allocation + and/or memory free nodes: - Creates a new CPU execution node and adds it to `graph` with - `numDependencies` dependencies specified via `pDependencies` and - arguments specified in `pNodeParams`. It is possible for - `numDependencies` to be 0, in which case the node will be placed at the - root of the graph. `pDependencies` may not have any duplicate entries. - A handle to the new node will be returned in `pGraphNode`. + - Nodes and edges of the graph cannot be deleted. - When the graph is launched, the node will invoke the specified CPU - function. Host nodes are not supported under MPS with pre-Volta GPUs. + - The graph can only be used in a child node if the ownership is moved + to the parent. + + - Only one instantiation of the graph may exist at any point in time. + + - The graph cannot be cloned. Parameters ---------- graph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` Graph to which to add the node - pDependencies : List[:py:obj:`~.cudaGraphNode_t`] + pDependencies : list[:py:obj:`~.cudaGraphNode_t`] Dependencies of the node numDependencies : size_t Number of dependencies - pNodeParams : :py:obj:`~.cudaHostNodeParams` - Parameters for the host node + dptr : Any + Address of memory to free Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorNotSupported`, :py:obj:`~.cudaErrorInvalidValue` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorCudartUnloading`, :py:obj:`~.cudaErrorInitializationError`, :py:obj:`~.cudaErrorNotSupported`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorOutOfMemory` pGraphNode : :py:obj:`~.cudaGraphNode_t` Returns newly created node See Also -------- - :py:obj:`~.cudaGraphAddNode`, :py:obj:`~.cudaLaunchHostFunc`, :py:obj:`~.cudaGraphHostNodeGetParams`, :py:obj:`~.cudaGraphHostNodeSetParams`, :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphDestroyNode`, :py:obj:`~.cudaGraphAddChildGraphNode`, :py:obj:`~.cudaGraphAddEmptyNode`, :py:obj:`~.cudaGraphAddKernelNode`, :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphAddMemsetNode` + :py:obj:`~.cudaGraphAddNode`, :py:obj:`~.cudaGraphAddMemAllocNode`, :py:obj:`~.cudaGraphMemFreeNodeGetParams`, :py:obj:`~.cudaDeviceGraphMemTrim`, :py:obj:`~.cudaDeviceGetGraphMemAttribute`, :py:obj:`~.cudaDeviceSetGraphMemAttribute`, :py:obj:`~.cudaMallocAsync`, :py:obj:`~.cudaFreeAsync`, :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphDestroyNode`, :py:obj:`~.cudaGraphAddChildGraphNode`, :py:obj:`~.cudaGraphAddEmptyNode`, :py:obj:`~.cudaGraphAddEventRecordNode`, :py:obj:`~.cudaGraphAddEventWaitNode`, :py:obj:`~.cudaGraphAddExternalSemaphoresSignalNode`, :py:obj:`~.cudaGraphAddExternalSemaphoresWaitNode`, :py:obj:`~.cudaGraphAddKernelNode`, :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphAddMemsetNode` """ pDependencies = [] if pDependencies is None else pDependencies - if not all(isinstance(_x, (cudaGraphNode_t,cuda.CUgraphNode)) for _x in pDependencies): - raise TypeError("Argument 'pDependencies' is not instance of type (expected List[ccudart.cudaGraphNode_t,cuda.CUgraphNode]") - cdef ccudart.cudaGraph_t cgraph + if not all(isinstance(_x, (cudaGraphNode_t,driver.CUgraphNode)) for _x in pDependencies): + raise TypeError("Argument 'pDependencies' is not instance of type (expected tuple[cyruntime.cudaGraphNode_t,driver.CUgraphNode] or list[cyruntime.cudaGraphNode_t,driver.CUgraphNode]") + cdef cyruntime.cudaGraph_t cygraph if graph is None: - cgraph = 0 - elif isinstance(graph, (cudaGraph_t,cuda.CUgraph)): + pgraph = 0 + elif isinstance(graph, (cudaGraph_t,driver.CUgraph)): pgraph = int(graph) - cgraph = pgraph else: pgraph = int(cudaGraph_t(graph)) - cgraph = pgraph + cygraph = pgraph cdef cudaGraphNode_t pGraphNode = cudaGraphNode_t() - cdef ccudart.cudaGraphNode_t* cpDependencies = NULL - if len(pDependencies) > 0: - cpDependencies = calloc(len(pDependencies), sizeof(ccudart.cudaGraphNode_t)) - if cpDependencies is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(pDependencies)) + 'x' + str(sizeof(ccudart.cudaGraphNode_t))) + cdef cyruntime.cudaGraphNode_t* cypDependencies = NULL + if len(pDependencies) > 1: + cypDependencies = calloc(len(pDependencies), sizeof(cyruntime.cudaGraphNode_t)) + if cypDependencies is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(pDependencies)) + 'x' + str(sizeof(cyruntime.cudaGraphNode_t))) else: for idx in range(len(pDependencies)): - cpDependencies[idx] = (pDependencies[idx])._ptr[0] + cypDependencies[idx] = (pDependencies[idx])._pvt_ptr[0] + elif len(pDependencies) == 1: + cypDependencies = (pDependencies[0])._pvt_ptr if numDependencies > len(pDependencies): raise RuntimeError("List is too small: " + str(len(pDependencies)) + " < " + str(numDependencies)) - cdef ccudart.cudaHostNodeParams* cpNodeParams_ptr = pNodeParams._ptr if pNodeParams != None else NULL - err = ccudart.cudaGraphAddHostNode(pGraphNode._ptr, cgraph, (pDependencies[0])._ptr if len(pDependencies) == 1 else cpDependencies, numDependencies, cpNodeParams_ptr) - if cpDependencies is not NULL: - free(cpDependencies) - return (cudaError_t(err), pGraphNode) -{{endif}} - -{{if 'cudaGraphHostNodeGetParams' in found_functions}} + cdef _HelperInputVoidPtrStruct cydptrHelper + cdef void* cydptr = _helper_input_void_ptr(dptr, &cydptrHelper) + with nogil: + err = cyruntime.cudaGraphAddMemFreeNode(pGraphNode._pvt_ptr, cygraph, cypDependencies, numDependencies, cydptr) + if len(pDependencies) > 1 and cypDependencies is not NULL: + free(cypDependencies) + _helper_input_void_ptr_free(&cydptrHelper) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, pGraphNode) @cython.embedsignature(True) -def cudaGraphHostNodeGetParams(node): - """ Returns a host node's parameters. +def cudaGraphMemFreeNodeGetParams(node): + """ Returns a memory free node's parameters. - Returns the parameters of host node `node` in `pNodeParams`. + Returns the address of a memory free node `hNode` in `dptr_out`. Parameters ---------- @@ -25915,41 +34369,41 @@ def cudaGraphHostNodeGetParams(node): ------- cudaError_t :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` - pNodeParams : :py:obj:`~.cudaHostNodeParams` - Pointer to return the parameters + dptr_out : Any + Pointer to return the device address See Also -------- - :py:obj:`~.cudaLaunchHostFunc`, :py:obj:`~.cudaGraphAddHostNode`, :py:obj:`~.cudaGraphHostNodeSetParams` + :py:obj:`~.cudaGraphNodeGetParams`, :py:obj:`~.cudaGraphAddMemFreeNode`, :py:obj:`~.cudaGraphMemFreeNodeGetParams` """ - cdef ccudart.cudaGraphNode_t cnode + cdef cyruntime.cudaGraphNode_t cynode if node is None: - cnode = 0 - elif isinstance(node, (cudaGraphNode_t,cuda.CUgraphNode)): + pnode = 0 + elif isinstance(node, (cudaGraphNode_t,driver.CUgraphNode)): pnode = int(node) - cnode = pnode else: pnode = int(cudaGraphNode_t(node)) - cnode = pnode - cdef cudaHostNodeParams pNodeParams = cudaHostNodeParams() - err = ccudart.cudaGraphHostNodeGetParams(cnode, pNodeParams._ptr) - return (cudaError_t(err), pNodeParams) -{{endif}} - -{{if 'cudaGraphHostNodeSetParams' in found_functions}} + cynode = pnode + cdef void_ptr dptr_out = 0 + cdef void* cydptr_out_ptr = &dptr_out + with nogil: + err = cyruntime.cudaGraphMemFreeNodeGetParams(cynode, cydptr_out_ptr) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, dptr_out) @cython.embedsignature(True) -def cudaGraphHostNodeSetParams(node, pNodeParams : Optional[cudaHostNodeParams]): - """ Sets a host node's parameters. +def cudaDeviceGraphMemTrim(int device): + """ Free unused memory that was cached on the specified device for use with graphs back to the OS. - Sets the parameters of host node `node` to `nodeParams`. + Blocks which are not in use by a graph that is either currently + executing or scheduled to execute are freed back to the operating + system. Parameters ---------- - node : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` - Node to set the parameters for - pNodeParams : :py:obj:`~.cudaHostNodeParams` - Parameters to copy + device : int + The device for which cached memory should be freed. Returns ------- @@ -25958,2845 +34412,2594 @@ def cudaGraphHostNodeSetParams(node, pNodeParams : Optional[cudaHostNodeParams]) See Also -------- - :py:obj:`~.cudaGraphNodeSetParams`, :py:obj:`~.cudaLaunchHostFunc`, :py:obj:`~.cudaGraphAddHostNode`, :py:obj:`~.cudaGraphHostNodeGetParams` + :py:obj:`~.cudaGraphAddMemAllocNode`, :py:obj:`~.cudaGraphAddMemFreeNode`, :py:obj:`~.cudaDeviceGetGraphMemAttribute`, :py:obj:`~.cudaDeviceSetGraphMemAttribute`, :py:obj:`~.cudaMallocAsync`, :py:obj:`~.cudaFreeAsync` """ - cdef ccudart.cudaGraphNode_t cnode - if node is None: - cnode = 0 - elif isinstance(node, (cudaGraphNode_t,cuda.CUgraphNode)): - pnode = int(node) - cnode = pnode - else: - pnode = int(cudaGraphNode_t(node)) - cnode = pnode - cdef ccudart.cudaHostNodeParams* cpNodeParams_ptr = pNodeParams._ptr if pNodeParams != None else NULL - err = ccudart.cudaGraphHostNodeSetParams(cnode, cpNodeParams_ptr) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaGraphAddChildGraphNode' in found_functions}} + with nogil: + err = cyruntime.cudaDeviceGraphMemTrim(device) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaGraphAddChildGraphNode(graph, pDependencies : Optional[List[cudaGraphNode_t]], size_t numDependencies, childGraph): - """ Creates a child graph node and adds it to a graph. +def cudaDeviceGetGraphMemAttribute(int device, attr not None : cudaGraphMemAttributeType): + """ Query asynchronous allocation attributes related to graphs. - Creates a new node which executes an embedded graph, and adds it to - `graph` with `numDependencies` dependencies specified via - `pDependencies`. It is possible for `numDependencies` to be 0, in which - case the node will be placed at the root of the graph. `pDependencies` - may not have any duplicate entries. A handle to the new node will be - returned in `pGraphNode`. + Valid attributes are: - If `hGraph` contains allocation or free nodes, this call will return an - error. + - :py:obj:`~.cudaGraphMemAttrUsedMemCurrent`: Amount of memory, in + bytes, currently associated with graphs - The node executes an embedded child graph. The child graph is cloned in - this call. + - :py:obj:`~.cudaGraphMemAttrUsedMemHigh`: High watermark of memory, in + bytes, associated with graphs since the last time it was reset. High + watermark can only be reset to zero. + + - :py:obj:`~.cudaGraphMemAttrReservedMemCurrent`: Amount of memory, in + bytes, currently allocated for use by the CUDA graphs asynchronous + allocator. + + - :py:obj:`~.cudaGraphMemAttrReservedMemHigh`: High watermark of + memory, in bytes, currently allocated for use by the CUDA graphs + asynchronous allocator. Parameters ---------- - graph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` - Graph to which to add the node - pDependencies : List[:py:obj:`~.cudaGraphNode_t`] - Dependencies of the node - numDependencies : size_t - Number of dependencies - childGraph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` - The graph to clone into this node + device : int + Specifies the scope of the query + attr : :py:obj:`~.cudaGraphMemAttributeType` + attribute to get Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` - pGraphNode : :py:obj:`~.cudaGraphNode_t` - Returns newly created node + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDevice` + value : Any + retrieved value See Also -------- - :py:obj:`~.cudaGraphAddNode`, :py:obj:`~.cudaGraphChildGraphNodeGetGraph`, :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphDestroyNode`, :py:obj:`~.cudaGraphAddEmptyNode`, :py:obj:`~.cudaGraphAddKernelNode`, :py:obj:`~.cudaGraphAddHostNode`, :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphAddMemsetNode`, :py:obj:`~.cudaGraphClone` + :py:obj:`~.cudaDeviceSetGraphMemAttribute`, :py:obj:`~.cudaGraphAddMemAllocNode`, :py:obj:`~.cudaGraphAddMemFreeNode`, :py:obj:`~.cudaDeviceGraphMemTrim`, :py:obj:`~.cudaMallocAsync`, :py:obj:`~.cudaFreeAsync` """ - cdef ccudart.cudaGraph_t cchildGraph - if childGraph is None: - cchildGraph = 0 - elif isinstance(childGraph, (cudaGraph_t,cuda.CUgraph)): - pchildGraph = int(childGraph) - cchildGraph = pchildGraph - else: - pchildGraph = int(cudaGraph_t(childGraph)) - cchildGraph = pchildGraph - pDependencies = [] if pDependencies is None else pDependencies - if not all(isinstance(_x, (cudaGraphNode_t,cuda.CUgraphNode)) for _x in pDependencies): - raise TypeError("Argument 'pDependencies' is not instance of type (expected List[ccudart.cudaGraphNode_t,cuda.CUgraphNode]") - cdef ccudart.cudaGraph_t cgraph - if graph is None: - cgraph = 0 - elif isinstance(graph, (cudaGraph_t,cuda.CUgraph)): - pgraph = int(graph) - cgraph = pgraph - else: - pgraph = int(cudaGraph_t(graph)) - cgraph = pgraph - cdef cudaGraphNode_t pGraphNode = cudaGraphNode_t() - cdef ccudart.cudaGraphNode_t* cpDependencies = NULL - if len(pDependencies) > 0: - cpDependencies = calloc(len(pDependencies), sizeof(ccudart.cudaGraphNode_t)) - if cpDependencies is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(pDependencies)) + 'x' + str(sizeof(ccudart.cudaGraphNode_t))) - else: - for idx in range(len(pDependencies)): - cpDependencies[idx] = (pDependencies[idx])._ptr[0] - if numDependencies > len(pDependencies): raise RuntimeError("List is too small: " + str(len(pDependencies)) + " < " + str(numDependencies)) - err = ccudart.cudaGraphAddChildGraphNode(pGraphNode._ptr, cgraph, (pDependencies[0])._ptr if len(pDependencies) == 1 else cpDependencies, numDependencies, cchildGraph) - if cpDependencies is not NULL: - free(cpDependencies) - return (cudaError_t(err), pGraphNode) -{{endif}} - -{{if 'cudaGraphChildGraphNodeGetGraph' in found_functions}} + cdef cyruntime.cudaGraphMemAttributeType cyattr = int(attr) + cdef _HelperCUgraphMem_attribute cyvalue = _HelperCUgraphMem_attribute(attr, 0, is_getter=True) + cdef void* cyvalue_ptr = cyvalue.cptr + with nogil: + err = cyruntime.cudaDeviceGetGraphMemAttribute(device, cyattr, cyvalue_ptr) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, cyvalue.pyObj()) @cython.embedsignature(True) -def cudaGraphChildGraphNodeGetGraph(node): - """ Gets a handle to the embedded graph of a child graph node. +def cudaDeviceSetGraphMemAttribute(int device, attr not None : cudaGraphMemAttributeType, value): + """ Set asynchronous allocation attributes related to graphs. - Gets a handle to the embedded graph in a child graph node. This call - does not clone the graph. Changes to the graph will be reflected in the - node, and the node retains ownership of the graph. + Valid attributes are: - Allocation and free nodes cannot be added to the returned graph. - Attempting to do so will return an error. + - :py:obj:`~.cudaGraphMemAttrUsedMemHigh`: High watermark of memory, in + bytes, associated with graphs since the last time it was reset. High + watermark can only be reset to zero. + + - :py:obj:`~.cudaGraphMemAttrReservedMemHigh`: High watermark of + memory, in bytes, currently allocated for use by the CUDA graphs + asynchronous allocator. Parameters ---------- - node : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` - Node to get the embedded graph for + device : int + Specifies the scope of the query + attr : :py:obj:`~.cudaGraphMemAttributeType` + attribute to get + value : Any + pointer to value to set Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` - pGraph : :py:obj:`~.cudaGraph_t` - Location to store a handle to the graph + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDevice` See Also -------- - :py:obj:`~.cudaGraphAddChildGraphNode`, :py:obj:`~.cudaGraphNodeFindInClone` + :py:obj:`~.cudaDeviceGetGraphMemAttribute`, :py:obj:`~.cudaGraphAddMemAllocNode`, :py:obj:`~.cudaGraphAddMemFreeNode`, :py:obj:`~.cudaDeviceGraphMemTrim`, :py:obj:`~.cudaMallocAsync`, :py:obj:`~.cudaFreeAsync` """ - cdef ccudart.cudaGraphNode_t cnode - if node is None: - cnode = 0 - elif isinstance(node, (cudaGraphNode_t,cuda.CUgraphNode)): - pnode = int(node) - cnode = pnode - else: - pnode = int(cudaGraphNode_t(node)) - cnode = pnode - cdef cudaGraph_t pGraph = cudaGraph_t() - err = ccudart.cudaGraphChildGraphNodeGetGraph(cnode, pGraph._ptr) - return (cudaError_t(err), pGraph) -{{endif}} - -{{if 'cudaGraphAddEmptyNode' in found_functions}} + cdef cyruntime.cudaGraphMemAttributeType cyattr = int(attr) + cdef _HelperCUgraphMem_attribute cyvalue = _HelperCUgraphMem_attribute(attr, value, is_getter=False) + cdef void* cyvalue_ptr = cyvalue.cptr + with nogil: + err = cyruntime.cudaDeviceSetGraphMemAttribute(device, cyattr, cyvalue_ptr) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaGraphAddEmptyNode(graph, pDependencies : Optional[List[cudaGraphNode_t]], size_t numDependencies): - """ Creates an empty node and adds it to a graph. +def cudaGraphClone(originalGraph): + """ Clones a graph. - Creates a new node which performs no operation, and adds it to `graph` - with `numDependencies` dependencies specified via `pDependencies`. It - is possible for `numDependencies` to be 0, in which case the node will - be placed at the root of the graph. `pDependencies` may not have any - duplicate entries. A handle to the new node will be returned in - `pGraphNode`. + This function creates a copy of `originalGraph` and returns it in + `pGraphClone`. All parameters are copied into the cloned graph. The + original graph may be modified after this call without affecting the + clone. - An empty node performs no operation during execution, but can be used - for transitive ordering. For example, a phased execution graph with 2 - groups of n nodes with a barrier between them can be represented using - an empty node and 2*n dependency edges, rather than no empty node and - n^2 dependency edges. + Child graph nodes in the original graph are recursively copied into the + clone. Parameters ---------- - graph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` - Graph to which to add the node - pDependencies : List[:py:obj:`~.cudaGraphNode_t`] - Dependencies of the node - numDependencies : size_t - Number of dependencies + originalGraph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` + Graph to clone Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` - pGraphNode : :py:obj:`~.cudaGraphNode_t` - Returns newly created node + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorMemoryAllocation` + pGraphClone : :py:obj:`~.cudaGraph_t` + Returns newly created cloned graph See Also -------- - :py:obj:`~.cudaGraphAddNode`, :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphDestroyNode`, :py:obj:`~.cudaGraphAddChildGraphNode`, :py:obj:`~.cudaGraphAddKernelNode`, :py:obj:`~.cudaGraphAddHostNode`, :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphAddMemsetNode` - """ - pDependencies = [] if pDependencies is None else pDependencies - if not all(isinstance(_x, (cudaGraphNode_t,cuda.CUgraphNode)) for _x in pDependencies): - raise TypeError("Argument 'pDependencies' is not instance of type (expected List[ccudart.cudaGraphNode_t,cuda.CUgraphNode]") - cdef ccudart.cudaGraph_t cgraph - if graph is None: - cgraph = 0 - elif isinstance(graph, (cudaGraph_t,cuda.CUgraph)): - pgraph = int(graph) - cgraph = pgraph - else: - pgraph = int(cudaGraph_t(graph)) - cgraph = pgraph - cdef cudaGraphNode_t pGraphNode = cudaGraphNode_t() - cdef ccudart.cudaGraphNode_t* cpDependencies = NULL - if len(pDependencies) > 0: - cpDependencies = calloc(len(pDependencies), sizeof(ccudart.cudaGraphNode_t)) - if cpDependencies is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(pDependencies)) + 'x' + str(sizeof(ccudart.cudaGraphNode_t))) - else: - for idx in range(len(pDependencies)): - cpDependencies[idx] = (pDependencies[idx])._ptr[0] - if numDependencies > len(pDependencies): raise RuntimeError("List is too small: " + str(len(pDependencies)) + " < " + str(numDependencies)) - err = ccudart.cudaGraphAddEmptyNode(pGraphNode._ptr, cgraph, (pDependencies[0])._ptr if len(pDependencies) == 1 else cpDependencies, numDependencies) - if cpDependencies is not NULL: - free(cpDependencies) - return (cudaError_t(err), pGraphNode) -{{endif}} + :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphNodeFindInClone` -{{if 'cudaGraphAddEventRecordNode' in found_functions}} + Notes + ----- + : Cloning is not supported for graphs which contain memory allocation nodes, memory free nodes, or conditional nodes. + """ + cdef cyruntime.cudaGraph_t cyoriginalGraph + if originalGraph is None: + poriginalGraph = 0 + elif isinstance(originalGraph, (cudaGraph_t,driver.CUgraph)): + poriginalGraph = int(originalGraph) + else: + poriginalGraph = int(cudaGraph_t(originalGraph)) + cyoriginalGraph = poriginalGraph + cdef cudaGraph_t pGraphClone = cudaGraph_t() + with nogil: + err = cyruntime.cudaGraphClone(pGraphClone._pvt_ptr, cyoriginalGraph) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, pGraphClone) @cython.embedsignature(True) -def cudaGraphAddEventRecordNode(graph, pDependencies : Optional[List[cudaGraphNode_t]], size_t numDependencies, event): - """ Creates an event record node and adds it to a graph. - - Creates a new event record node and adds it to `hGraph` with - `numDependencies` dependencies specified via `dependencies` and event - specified in `event`. It is possible for `numDependencies` to be 0, in - which case the node will be placed at the root of the graph. - `dependencies` may not have any duplicate entries. A handle to the new - node will be returned in `phGraphNode`. +def cudaGraphNodeFindInClone(originalNode, clonedGraph): + """ Finds a cloned version of a node. - Each launch of the graph will record `event` to capture execution of - the node's dependencies. + This function returns the node in `clonedGraph` corresponding to + `originalNode` in the original graph. - These nodes may not be used in loops or conditionals. + `clonedGraph` must have been cloned from `originalGraph` via + :py:obj:`~.cudaGraphClone`. `originalNode` must have been in + `originalGraph` at the time of the call to :py:obj:`~.cudaGraphClone`, + and the corresponding cloned node in `clonedGraph` must not have been + removed. The cloned node is then returned via `pClonedNode`. Parameters ---------- - hGraph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` - Graph to which to add the node - dependencies : List[:py:obj:`~.cudaGraphNode_t`] - Dependencies of the node - numDependencies : size_t - Number of dependencies - event : :py:obj:`~.CUevent` or :py:obj:`~.cudaEvent_t` - Event for the node + originalNode : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` + Handle to the original node + clonedGraph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` + Cloned graph to query Returns ------- cudaError_t :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` - phGraphNode : :py:obj:`~.cudaGraphNode_t` - Returns newly created node + pNode : :py:obj:`~.cudaGraphNode_t` + Returns handle to the cloned node See Also -------- - :py:obj:`~.cudaGraphAddNode`, :py:obj:`~.cudaGraphAddEventWaitNode`, :py:obj:`~.cudaEventRecordWithFlags`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphDestroyNode`, :py:obj:`~.cudaGraphAddChildGraphNode`, :py:obj:`~.cudaGraphAddEmptyNode`, :py:obj:`~.cudaGraphAddKernelNode`, :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphAddMemsetNode` + :py:obj:`~.cudaGraphClone` """ - cdef ccudart.cudaEvent_t cevent - if event is None: - cevent = 0 - elif isinstance(event, (cudaEvent_t,cuda.CUevent)): - pevent = int(event) - cevent = pevent + cdef cyruntime.cudaGraph_t cyclonedGraph + if clonedGraph is None: + pclonedGraph = 0 + elif isinstance(clonedGraph, (cudaGraph_t,driver.CUgraph)): + pclonedGraph = int(clonedGraph) else: - pevent = int(cudaEvent_t(event)) - cevent = pevent - pDependencies = [] if pDependencies is None else pDependencies - if not all(isinstance(_x, (cudaGraphNode_t,cuda.CUgraphNode)) for _x in pDependencies): - raise TypeError("Argument 'pDependencies' is not instance of type (expected List[ccudart.cudaGraphNode_t,cuda.CUgraphNode]") - cdef ccudart.cudaGraph_t cgraph - if graph is None: - cgraph = 0 - elif isinstance(graph, (cudaGraph_t,cuda.CUgraph)): - pgraph = int(graph) - cgraph = pgraph + pclonedGraph = int(cudaGraph_t(clonedGraph)) + cyclonedGraph = pclonedGraph + cdef cyruntime.cudaGraphNode_t cyoriginalNode + if originalNode is None: + poriginalNode = 0 + elif isinstance(originalNode, (cudaGraphNode_t,driver.CUgraphNode)): + poriginalNode = int(originalNode) else: - pgraph = int(cudaGraph_t(graph)) - cgraph = pgraph - cdef cudaGraphNode_t pGraphNode = cudaGraphNode_t() - cdef ccudart.cudaGraphNode_t* cpDependencies = NULL - if len(pDependencies) > 0: - cpDependencies = calloc(len(pDependencies), sizeof(ccudart.cudaGraphNode_t)) - if cpDependencies is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(pDependencies)) + 'x' + str(sizeof(ccudart.cudaGraphNode_t))) - else: - for idx in range(len(pDependencies)): - cpDependencies[idx] = (pDependencies[idx])._ptr[0] - if numDependencies > len(pDependencies): raise RuntimeError("List is too small: " + str(len(pDependencies)) + " < " + str(numDependencies)) - err = ccudart.cudaGraphAddEventRecordNode(pGraphNode._ptr, cgraph, (pDependencies[0])._ptr if len(pDependencies) == 1 else cpDependencies, numDependencies, cevent) - if cpDependencies is not NULL: - free(cpDependencies) - return (cudaError_t(err), pGraphNode) -{{endif}} - -{{if 'cudaGraphEventRecordNodeGetEvent' in found_functions}} + poriginalNode = int(cudaGraphNode_t(originalNode)) + cyoriginalNode = poriginalNode + cdef cudaGraphNode_t pNode = cudaGraphNode_t() + with nogil: + err = cyruntime.cudaGraphNodeFindInClone(pNode._pvt_ptr, cyoriginalNode, cyclonedGraph) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, pNode) @cython.embedsignature(True) -def cudaGraphEventRecordNodeGetEvent(node): - """ Returns the event associated with an event record node. +def cudaGraphNodeGetType(node): + """ Returns a node's type. - Returns the event of event record node `hNode` in `event_out`. + Returns the node type of `node` in `pType`. Parameters ---------- - hNode : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` - Node to get the event for + node : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` + Node to query Returns ------- cudaError_t :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` - event_out : :py:obj:`~.cudaEvent_t` - Pointer to return the event + pType : :py:obj:`~.cudaGraphNodeType` + Pointer to return the node type See Also -------- - :py:obj:`~.cudaGraphAddEventRecordNode`, :py:obj:`~.cudaGraphEventRecordNodeSetEvent`, :py:obj:`~.cudaGraphEventWaitNodeGetEvent`, :py:obj:`~.cudaEventRecordWithFlags`, :py:obj:`~.cudaStreamWaitEvent` + :py:obj:`~.cudaGraphGetNodes`, :py:obj:`~.cudaGraphGetRootNodes`, :py:obj:`~.cudaGraphChildGraphNodeGetGraph`, :py:obj:`~.cudaGraphKernelNodeGetParams`, :py:obj:`~.cudaGraphKernelNodeSetParams`, :py:obj:`~.cudaGraphHostNodeGetParams`, :py:obj:`~.cudaGraphHostNodeSetParams`, :py:obj:`~.cudaGraphMemcpyNodeGetParams`, :py:obj:`~.cudaGraphMemcpyNodeSetParams`, :py:obj:`~.cudaGraphMemsetNodeGetParams`, :py:obj:`~.cudaGraphMemsetNodeSetParams` """ - cdef ccudart.cudaGraphNode_t cnode + cdef cyruntime.cudaGraphNode_t cynode if node is None: - cnode = 0 - elif isinstance(node, (cudaGraphNode_t,cuda.CUgraphNode)): + pnode = 0 + elif isinstance(node, (cudaGraphNode_t,driver.CUgraphNode)): pnode = int(node) - cnode = pnode else: pnode = int(cudaGraphNode_t(node)) - cnode = pnode - cdef cudaEvent_t event_out = cudaEvent_t() - err = ccudart.cudaGraphEventRecordNodeGetEvent(cnode, event_out._ptr) - return (cudaError_t(err), event_out) -{{endif}} - -{{if 'cudaGraphEventRecordNodeSetEvent' in found_functions}} + cynode = pnode + cdef cyruntime.cudaGraphNodeType pType + with nogil: + err = cyruntime.cudaGraphNodeGetType(cynode, &pType) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, cudaGraphNodeType(pType)) @cython.embedsignature(True) -def cudaGraphEventRecordNodeSetEvent(node, event): - """ Sets an event record node's event. +def cudaGraphNodeGetContainingGraph(hNode): + """ Returns the graph that contains a given graph node. - Sets the event of event record node `hNode` to `event`. + Returns the graph that contains `hNode` in `*phGraph`. If hNode is in a + child graph, the child graph it is in is returned. Parameters ---------- hNode : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` - Node to set the event for - event : :py:obj:`~.CUevent` or :py:obj:`~.cudaEvent_t` - Event to use + Node to query Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + :py:obj:`~.cudaSuccess` :py:obj:`~.cudaErrorInvalidValue` + phGraph : :py:obj:`~.cudaGraph_t` + Pointer to return the containing graph See Also -------- - :py:obj:`~.cudaGraphNodeSetParams`, :py:obj:`~.cudaGraphAddEventRecordNode`, :py:obj:`~.cudaGraphEventRecordNodeGetEvent`, :py:obj:`~.cudaGraphEventWaitNodeSetEvent`, :py:obj:`~.cudaEventRecordWithFlags`, :py:obj:`~.cudaStreamWaitEvent` + :py:obj:`~.cudaGraphGetNodes`, :py:obj:`~.cudaGraphDebugDotPrint` :py:obj:`~.cudaGraphNodeGetLocalId` :py:obj:`~.cudaGraphNodeGetToolsId` :py:obj:`~.cudaGraphGetId` :py:obj:`~.cudaGraphExecGetId` """ - cdef ccudart.cudaEvent_t cevent - if event is None: - cevent = 0 - elif isinstance(event, (cudaEvent_t,cuda.CUevent)): - pevent = int(event) - cevent = pevent - else: - pevent = int(cudaEvent_t(event)) - cevent = pevent - cdef ccudart.cudaGraphNode_t cnode - if node is None: - cnode = 0 - elif isinstance(node, (cudaGraphNode_t,cuda.CUgraphNode)): - pnode = int(node) - cnode = pnode + cdef cyruntime.cudaGraphNode_t cyhNode + if hNode is None: + phNode = 0 + elif isinstance(hNode, (cudaGraphNode_t,driver.CUgraphNode)): + phNode = int(hNode) else: - pnode = int(cudaGraphNode_t(node)) - cnode = pnode - err = ccudart.cudaGraphEventRecordNodeSetEvent(cnode, cevent) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaGraphAddEventWaitNode' in found_functions}} + phNode = int(cudaGraphNode_t(hNode)) + cyhNode = phNode + cdef cudaGraph_t phGraph = cudaGraph_t() + with nogil: + err = cyruntime.cudaGraphNodeGetContainingGraph(cyhNode, phGraph._pvt_ptr) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, phGraph) @cython.embedsignature(True) -def cudaGraphAddEventWaitNode(graph, pDependencies : Optional[List[cudaGraphNode_t]], size_t numDependencies, event): - """ Creates an event wait node and adds it to a graph. - - Creates a new event wait node and adds it to `hGraph` with - `numDependencies` dependencies specified via `dependencies` and event - specified in `event`. It is possible for `numDependencies` to be 0, in - which case the node will be placed at the root of the graph. - `dependencies` may not have any duplicate entries. A handle to the new - node will be returned in `phGraphNode`. - - The graph node will wait for all work captured in `event`. See - :py:obj:`~.cuEventRecord()` for details on what is captured by an - event. The synchronization will be performed efficiently on the device - when applicable. `event` may be from a different context or device than - the launch stream. +def cudaGraphNodeGetLocalId(hNode): + """ Returns the node id of a given graph node. - These nodes may not be used in loops or conditionals. + Returns the node id of `hNode` in `*nodeId`. The nodeId matches that + referenced by :py:obj:`~.cudaGraphDebugDotPrint`. The local nodeId and + graphId together can uniquely identify the node. Parameters ---------- - hGraph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` - Graph to which to add the node - dependencies : List[:py:obj:`~.cudaGraphNode_t`] - Dependencies of the node - numDependencies : size_t - Number of dependencies - event : :py:obj:`~.CUevent` or :py:obj:`~.cudaEvent_t` - Event for the node + hNode : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` + Node to query Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` - phGraphNode : :py:obj:`~.cudaGraphNode_t` - Returns newly created node + :py:obj:`~.cudaSuccess` :py:obj:`~.cudaErrorInvalidValue` + nodeId : unsigned int + Pointer to return the nodeId See Also -------- - :py:obj:`~.cudaGraphAddNode`, :py:obj:`~.cudaGraphAddEventRecordNode`, :py:obj:`~.cudaEventRecordWithFlags`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphDestroyNode`, :py:obj:`~.cudaGraphAddChildGraphNode`, :py:obj:`~.cudaGraphAddEmptyNode`, :py:obj:`~.cudaGraphAddKernelNode`, :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphAddMemsetNode` + :py:obj:`~.cudaGraphGetNodes`, :py:obj:`~.cudaGraphDebugDotPrint` :py:obj:`~.cudaGraphNodeGetContainingGraph` :py:obj:`~.cudaGraphNodeGetToolsId` :py:obj:`~.cudaGraphGetId` :py:obj:`~.cudaGraphExecGetId` """ - cdef ccudart.cudaEvent_t cevent - if event is None: - cevent = 0 - elif isinstance(event, (cudaEvent_t,cuda.CUevent)): - pevent = int(event) - cevent = pevent - else: - pevent = int(cudaEvent_t(event)) - cevent = pevent - pDependencies = [] if pDependencies is None else pDependencies - if not all(isinstance(_x, (cudaGraphNode_t,cuda.CUgraphNode)) for _x in pDependencies): - raise TypeError("Argument 'pDependencies' is not instance of type (expected List[ccudart.cudaGraphNode_t,cuda.CUgraphNode]") - cdef ccudart.cudaGraph_t cgraph - if graph is None: - cgraph = 0 - elif isinstance(graph, (cudaGraph_t,cuda.CUgraph)): - pgraph = int(graph) - cgraph = pgraph + cdef cyruntime.cudaGraphNode_t cyhNode + if hNode is None: + phNode = 0 + elif isinstance(hNode, (cudaGraphNode_t,driver.CUgraphNode)): + phNode = int(hNode) else: - pgraph = int(cudaGraph_t(graph)) - cgraph = pgraph - cdef cudaGraphNode_t pGraphNode = cudaGraphNode_t() - cdef ccudart.cudaGraphNode_t* cpDependencies = NULL - if len(pDependencies) > 0: - cpDependencies = calloc(len(pDependencies), sizeof(ccudart.cudaGraphNode_t)) - if cpDependencies is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(pDependencies)) + 'x' + str(sizeof(ccudart.cudaGraphNode_t))) - else: - for idx in range(len(pDependencies)): - cpDependencies[idx] = (pDependencies[idx])._ptr[0] - if numDependencies > len(pDependencies): raise RuntimeError("List is too small: " + str(len(pDependencies)) + " < " + str(numDependencies)) - err = ccudart.cudaGraphAddEventWaitNode(pGraphNode._ptr, cgraph, (pDependencies[0])._ptr if len(pDependencies) == 1 else cpDependencies, numDependencies, cevent) - if cpDependencies is not NULL: - free(cpDependencies) - return (cudaError_t(err), pGraphNode) -{{endif}} - -{{if 'cudaGraphEventWaitNodeGetEvent' in found_functions}} + phNode = int(cudaGraphNode_t(hNode)) + cyhNode = phNode + cdef unsigned int nodeId = 0 + with nogil: + err = cyruntime.cudaGraphNodeGetLocalId(cyhNode, &nodeId) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, nodeId) @cython.embedsignature(True) -def cudaGraphEventWaitNodeGetEvent(node): - """ Returns the event associated with an event wait node. - - Returns the event of event wait node `hNode` in `event_out`. +def cudaGraphNodeGetToolsId(hNode): + """ Returns an id used by tools to identify a given node. Parameters ---------- hNode : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` - Node to get the event for + Node to query Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` - event_out : :py:obj:`~.cudaEvent_t` - Pointer to return the event + :py:obj:`~.CUDA_SUCCESS` :py:obj:`~.cudaErrorInvalidValue` + *toolsNodeId : unsigned long long + Pointer to return the id used by tools See Also -------- - :py:obj:`~.cudaGraphAddEventWaitNode`, :py:obj:`~.cudaGraphEventWaitNodeSetEvent`, :py:obj:`~.cudaGraphEventRecordNodeGetEvent`, :py:obj:`~.cudaEventRecordWithFlags`, :py:obj:`~.cudaStreamWaitEvent` + :py:obj:`~.cudaGraphGetNodes`, :py:obj:`~.cudaGraphDebugDotPrint` :py:obj:`~.cudaGraphNodeGetContainingGraph` :py:obj:`~.cudaGraphNodeGetLocalId` :py:obj:`~.cudaGraphGetId` :py:obj:`~.cudaGraphExecGetId` """ - cdef ccudart.cudaGraphNode_t cnode - if node is None: - cnode = 0 - elif isinstance(node, (cudaGraphNode_t,cuda.CUgraphNode)): - pnode = int(node) - cnode = pnode + cdef cyruntime.cudaGraphNode_t cyhNode + if hNode is None: + phNode = 0 + elif isinstance(hNode, (cudaGraphNode_t,driver.CUgraphNode)): + phNode = int(hNode) else: - pnode = int(cudaGraphNode_t(node)) - cnode = pnode - cdef cudaEvent_t event_out = cudaEvent_t() - err = ccudart.cudaGraphEventWaitNodeGetEvent(cnode, event_out._ptr) - return (cudaError_t(err), event_out) -{{endif}} - -{{if 'cudaGraphEventWaitNodeSetEvent' in found_functions}} + phNode = int(cudaGraphNode_t(hNode)) + cyhNode = phNode + cdef unsigned long long toolsNodeId = 0 + with nogil: + err = cyruntime.cudaGraphNodeGetToolsId(cyhNode, &toolsNodeId) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, toolsNodeId) @cython.embedsignature(True) -def cudaGraphEventWaitNodeSetEvent(node, event): - """ Sets an event wait node's event. +def cudaGraphGetId(hGraph): + """ Returns the id of a given graph. - Sets the event of event wait node `hNode` to `event`. + Returns the id of `hGraph` in `*graphId`. The value in `*graphId` + matches that referenced by :py:obj:`~.cudaGraphDebugDotPrint`. Parameters ---------- - hNode : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` - Node to set the event for - event : :py:obj:`~.CUevent` or :py:obj:`~.cudaEvent_t` - Event to use + hGraph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` + Graph to query Returns ------- cudaError_t :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + graphId : unsigned int + Pointer to return the graphId See Also -------- - :py:obj:`~.cudaGraphNodeSetParams`, :py:obj:`~.cudaGraphAddEventWaitNode`, :py:obj:`~.cudaGraphEventWaitNodeGetEvent`, :py:obj:`~.cudaGraphEventRecordNodeSetEvent`, :py:obj:`~.cudaEventRecordWithFlags`, :py:obj:`~.cudaStreamWaitEvent` + :py:obj:`~.cudaGraphGetNodes`, :py:obj:`~.cudaGraphDebugDotPrint` :py:obj:`~.cudaGraphNodeGetContainingGraph` :py:obj:`~.cudaGraphNodeGetLocalId` :py:obj:`~.cudaGraphNodeGetToolsId` :py:obj:`~.cudaGraphExecGetId` """ - cdef ccudart.cudaEvent_t cevent - if event is None: - cevent = 0 - elif isinstance(event, (cudaEvent_t,cuda.CUevent)): - pevent = int(event) - cevent = pevent - else: - pevent = int(cudaEvent_t(event)) - cevent = pevent - cdef ccudart.cudaGraphNode_t cnode - if node is None: - cnode = 0 - elif isinstance(node, (cudaGraphNode_t,cuda.CUgraphNode)): - pnode = int(node) - cnode = pnode + cdef cyruntime.cudaGraph_t cyhGraph + if hGraph is None: + phGraph = 0 + elif isinstance(hGraph, (cudaGraph_t,driver.CUgraph)): + phGraph = int(hGraph) else: - pnode = int(cudaGraphNode_t(node)) - cnode = pnode - err = ccudart.cudaGraphEventWaitNodeSetEvent(cnode, cevent) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaGraphAddExternalSemaphoresSignalNode' in found_functions}} + phGraph = int(cudaGraph_t(hGraph)) + cyhGraph = phGraph + cdef unsigned int graphID = 0 + with nogil: + err = cyruntime.cudaGraphGetId(cyhGraph, &graphID) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, graphID) @cython.embedsignature(True) -def cudaGraphAddExternalSemaphoresSignalNode(graph, pDependencies : Optional[List[cudaGraphNode_t]], size_t numDependencies, nodeParams : Optional[cudaExternalSemaphoreSignalNodeParams]): - """ Creates an external semaphore signal node and adds it to a graph. - - Creates a new external semaphore signal node and adds it to `graph` - with `numDependencies` dependencies specified via `dependencies` and - arguments specified in `nodeParams`. It is possible for - `numDependencies` to be 0, in which case the node will be placed at the - root of the graph. `dependencies` may not have any duplicate entries. A - handle to the new node will be returned in `pGraphNode`. +def cudaGraphExecGetId(hGraphExec): + """ Returns the id of a given graph exec. - Performs a signal operation on a set of externally allocated semaphore - objects when the node is launched. The operation(s) will occur after - all of the node's dependencies have completed. + Returns the id of `hGraphExec` in `*graphId`. The value in `*graphId` + matches that referenced by :py:obj:`~.cudaGraphDebugDotPrint`. Parameters ---------- - graph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` - Graph to which to add the node - pDependencies : List[:py:obj:`~.cudaGraphNode_t`] - Dependencies of the node - numDependencies : size_t - Number of dependencies - nodeParams : :py:obj:`~.cudaExternalSemaphoreSignalNodeParams` - Parameters for the node + hGraphExec : :py:obj:`~.CUgraphExec` or :py:obj:`~.cudaGraphExec_t` + Graph to query Returns ------- cudaError_t :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` - pGraphNode : :py:obj:`~.cudaGraphNode_t` - Returns newly created node + graphId : unsigned int + Pointer to return the graphId See Also -------- - :py:obj:`~.cudaGraphAddNode`, :py:obj:`~.cudaGraphExternalSemaphoresSignalNodeGetParams`, :py:obj:`~.cudaGraphExternalSemaphoresSignalNodeSetParams`, :py:obj:`~.cudaGraphExecExternalSemaphoresSignalNodeSetParams`, :py:obj:`~.cudaGraphAddExternalSemaphoresWaitNode`, :py:obj:`~.cudaImportExternalSemaphore`, :py:obj:`~.cudaSignalExternalSemaphoresAsync`, :py:obj:`~.cudaWaitExternalSemaphoresAsync`, :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphDestroyNode`, :py:obj:`~.cudaGraphAddEventRecordNode`, :py:obj:`~.cudaGraphAddEventWaitNode`, :py:obj:`~.cudaGraphAddChildGraphNode`, :py:obj:`~.cudaGraphAddEmptyNode`, :py:obj:`~.cudaGraphAddKernelNode`, :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphAddMemsetNode` + :py:obj:`~.cudaGraphGetNodes`, :py:obj:`~.cudaGraphDebugDotPrint` :py:obj:`~.cudaGraphNodeGetContainingGraph` :py:obj:`~.cudaGraphNodeGetLocalId` :py:obj:`~.cudaGraphNodeGetToolsId` :py:obj:`~.cudaGraphGetId` """ - pDependencies = [] if pDependencies is None else pDependencies - if not all(isinstance(_x, (cudaGraphNode_t,cuda.CUgraphNode)) for _x in pDependencies): - raise TypeError("Argument 'pDependencies' is not instance of type (expected List[ccudart.cudaGraphNode_t,cuda.CUgraphNode]") - cdef ccudart.cudaGraph_t cgraph - if graph is None: - cgraph = 0 - elif isinstance(graph, (cudaGraph_t,cuda.CUgraph)): - pgraph = int(graph) - cgraph = pgraph + cdef cyruntime.cudaGraphExec_t cyhGraphExec + if hGraphExec is None: + phGraphExec = 0 + elif isinstance(hGraphExec, (cudaGraphExec_t,driver.CUgraphExec)): + phGraphExec = int(hGraphExec) else: - pgraph = int(cudaGraph_t(graph)) - cgraph = pgraph - cdef cudaGraphNode_t pGraphNode = cudaGraphNode_t() - cdef ccudart.cudaGraphNode_t* cpDependencies = NULL - if len(pDependencies) > 0: - cpDependencies = calloc(len(pDependencies), sizeof(ccudart.cudaGraphNode_t)) - if cpDependencies is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(pDependencies)) + 'x' + str(sizeof(ccudart.cudaGraphNode_t))) - else: - for idx in range(len(pDependencies)): - cpDependencies[idx] = (pDependencies[idx])._ptr[0] - if numDependencies > len(pDependencies): raise RuntimeError("List is too small: " + str(len(pDependencies)) + " < " + str(numDependencies)) - cdef ccudart.cudaExternalSemaphoreSignalNodeParams* cnodeParams_ptr = nodeParams._ptr if nodeParams != None else NULL - err = ccudart.cudaGraphAddExternalSemaphoresSignalNode(pGraphNode._ptr, cgraph, (pDependencies[0])._ptr if len(pDependencies) == 1 else cpDependencies, numDependencies, cnodeParams_ptr) - if cpDependencies is not NULL: - free(cpDependencies) - return (cudaError_t(err), pGraphNode) -{{endif}} - -{{if 'cudaGraphExternalSemaphoresSignalNodeGetParams' in found_functions}} + phGraphExec = int(cudaGraphExec_t(hGraphExec)) + cyhGraphExec = phGraphExec + cdef unsigned int graphID = 0 + with nogil: + err = cyruntime.cudaGraphExecGetId(cyhGraphExec, &graphID) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, graphID) @cython.embedsignature(True) -def cudaGraphExternalSemaphoresSignalNodeGetParams(hNode): - """ Returns an external semaphore signal node's parameters. +def cudaGraphGetNodes(graph, size_t numNodes = 0): + """ Returns a graph's nodes. - Returns the parameters of an external semaphore signal node `hNode` in - `params_out`. The `extSemArray` and `paramsArray` returned in - `params_out`, are owned by the node. This memory remains valid until - the node is destroyed or its parameters are modified, and should not be - modified directly. Use - :py:obj:`~.cudaGraphExternalSemaphoresSignalNodeSetParams` to update - the parameters of this node. + Returns a list of `graph's` nodes. `nodes` may be NULL, in which case + this function will return the number of nodes in `numNodes`. Otherwise, + `numNodes` entries will be filled in. If `numNodes` is higher than the + actual number of nodes, the remaining entries in `nodes` will be set to + NULL, and the number of nodes actually obtained will be returned in + `numNodes`. Parameters ---------- - hNode : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` - Node to get the parameters for + graph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` + Graph to query + numNodes : int + See description Returns ------- cudaError_t :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` - params_out : :py:obj:`~.cudaExternalSemaphoreSignalNodeParams` - Pointer to return the parameters + nodes : list[:py:obj:`~.cudaGraphNode_t`] + Pointer to return the nodes + numNodes : int + See description See Also -------- - :py:obj:`~.cudaLaunchKernel`, :py:obj:`~.cudaGraphAddExternalSemaphoresSignalNode`, :py:obj:`~.cudaGraphExternalSemaphoresSignalNodeSetParams`, :py:obj:`~.cudaGraphAddExternalSemaphoresWaitNode`, :py:obj:`~.cudaSignalExternalSemaphoresAsync`, :py:obj:`~.cudaWaitExternalSemaphoresAsync` + :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphGetRootNodes`, :py:obj:`~.cudaGraphGetEdges`, :py:obj:`~.cudaGraphNodeGetType`, :py:obj:`~.cudaGraphNodeGetDependencies`, :py:obj:`~.cudaGraphNodeGetDependentNodes` """ - cdef ccudart.cudaGraphNode_t chNode - if hNode is None: - chNode = 0 - elif isinstance(hNode, (cudaGraphNode_t,cuda.CUgraphNode)): - phNode = int(hNode) - chNode = phNode + cdef size_t _graph_length = numNodes + cdef cyruntime.cudaGraph_t cygraph + if graph is None: + pgraph = 0 + elif isinstance(graph, (cudaGraph_t,driver.CUgraph)): + pgraph = int(graph) else: - phNode = int(cudaGraphNode_t(hNode)) - chNode = phNode - cdef cudaExternalSemaphoreSignalNodeParams params_out = cudaExternalSemaphoreSignalNodeParams() - err = ccudart.cudaGraphExternalSemaphoresSignalNodeGetParams(chNode, params_out._ptr) - return (cudaError_t(err), params_out) -{{endif}} - -{{if 'cudaGraphExternalSemaphoresSignalNodeSetParams' in found_functions}} + pgraph = int(cudaGraph_t(graph)) + cygraph = pgraph + cdef cyruntime.cudaGraphNode_t* cynodes = NULL + pynodes = [] + if _graph_length != 0: + cynodes = calloc(_graph_length, sizeof(cyruntime.cudaGraphNode_t)) + if cynodes is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(_graph_length) + 'x' + str(sizeof(cyruntime.cudaGraphNode_t))) + with nogil: + err = cyruntime.cudaGraphGetNodes(cygraph, cynodes, &numNodes) + if cudaError_t(err) == cudaError_t(0): + pynodes = [cudaGraphNode_t() for _ in range(_graph_length)] + for idx in range(_graph_length): + (pynodes[idx])._pvt_ptr[0] = cynodes[idx] + if cynodes is not NULL: + free(cynodes) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None, None) + return (_cudaError_t_SUCCESS, pynodes, numNodes) @cython.embedsignature(True) -def cudaGraphExternalSemaphoresSignalNodeSetParams(hNode, nodeParams : Optional[cudaExternalSemaphoreSignalNodeParams]): - """ Sets an external semaphore signal node's parameters. +def cudaGraphGetRootNodes(graph, size_t pNumRootNodes = 0): + """ Returns a graph's root nodes. - Sets the parameters of an external semaphore signal node `hNode` to - `nodeParams`. + Returns a list of `graph's` root nodes. `pRootNodes` may be NULL, in + which case this function will return the number of root nodes in + `pNumRootNodes`. Otherwise, `pNumRootNodes` entries will be filled in. + If `pNumRootNodes` is higher than the actual number of root nodes, the + remaining entries in `pRootNodes` will be set to NULL, and the number + of nodes actually obtained will be returned in `pNumRootNodes`. Parameters ---------- - hNode : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` - Node to set the parameters for - nodeParams : :py:obj:`~.cudaExternalSemaphoreSignalNodeParams` - Parameters to copy + graph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` + Graph to query + pNumRootNodes : int + See description Returns ------- cudaError_t :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + pRootNodes : list[:py:obj:`~.cudaGraphNode_t`] + Pointer to return the root nodes + pNumRootNodes : int + See description See Also -------- - :py:obj:`~.cudaGraphNodeSetParams`, :py:obj:`~.cudaGraphAddExternalSemaphoresSignalNode`, :py:obj:`~.cudaGraphExternalSemaphoresSignalNodeSetParams`, :py:obj:`~.cudaGraphAddExternalSemaphoresWaitNode`, :py:obj:`~.cudaSignalExternalSemaphoresAsync`, :py:obj:`~.cudaWaitExternalSemaphoresAsync` + :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphGetNodes`, :py:obj:`~.cudaGraphGetEdges`, :py:obj:`~.cudaGraphNodeGetType`, :py:obj:`~.cudaGraphNodeGetDependencies`, :py:obj:`~.cudaGraphNodeGetDependentNodes` """ - cdef ccudart.cudaGraphNode_t chNode - if hNode is None: - chNode = 0 - elif isinstance(hNode, (cudaGraphNode_t,cuda.CUgraphNode)): - phNode = int(hNode) - chNode = phNode + cdef size_t _graph_length = pNumRootNodes + cdef cyruntime.cudaGraph_t cygraph + if graph is None: + pgraph = 0 + elif isinstance(graph, (cudaGraph_t,driver.CUgraph)): + pgraph = int(graph) else: - phNode = int(cudaGraphNode_t(hNode)) - chNode = phNode - cdef ccudart.cudaExternalSemaphoreSignalNodeParams* cnodeParams_ptr = nodeParams._ptr if nodeParams != None else NULL - err = ccudart.cudaGraphExternalSemaphoresSignalNodeSetParams(chNode, cnodeParams_ptr) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaGraphAddExternalSemaphoresWaitNode' in found_functions}} + pgraph = int(cudaGraph_t(graph)) + cygraph = pgraph + cdef cyruntime.cudaGraphNode_t* cypRootNodes = NULL + pypRootNodes = [] + if _graph_length != 0: + cypRootNodes = calloc(_graph_length, sizeof(cyruntime.cudaGraphNode_t)) + if cypRootNodes is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(_graph_length) + 'x' + str(sizeof(cyruntime.cudaGraphNode_t))) + with nogil: + err = cyruntime.cudaGraphGetRootNodes(cygraph, cypRootNodes, &pNumRootNodes) + if cudaError_t(err) == cudaError_t(0): + pypRootNodes = [cudaGraphNode_t() for _ in range(_graph_length)] + for idx in range(_graph_length): + (pypRootNodes[idx])._pvt_ptr[0] = cypRootNodes[idx] + if cypRootNodes is not NULL: + free(cypRootNodes) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None, None) + return (_cudaError_t_SUCCESS, pypRootNodes, pNumRootNodes) @cython.embedsignature(True) -def cudaGraphAddExternalSemaphoresWaitNode(graph, pDependencies : Optional[List[cudaGraphNode_t]], size_t numDependencies, nodeParams : Optional[cudaExternalSemaphoreWaitNodeParams]): - """ Creates an external semaphore wait node and adds it to a graph. - - Creates a new external semaphore wait node and adds it to `graph` with - `numDependencies` dependencies specified via `dependencies` and - arguments specified in `nodeParams`. It is possible for - `numDependencies` to be 0, in which case the node will be placed at the - root of the graph. `dependencies` may not have any duplicate entries. A - handle to the new node will be returned in `pGraphNode`. +def cudaGraphGetEdges(graph, size_t numEdges = 0): + """ Returns a graph's dependency edges. - Performs a wait operation on a set of externally allocated semaphore - objects when the node is launched. The node's dependencies will not be - launched until the wait operation has completed. + Returns a list of `graph's` dependency edges. Edges are returned via + corresponding indices in `from`, `to` and `edgeData`; that is, the node + in `to`[i] has a dependency on the node in `from`[i] with data + `edgeData`[i]. `from` and `to` may both be NULL, in which case this + function only returns the number of edges in `numEdges`. Otherwise, + `numEdges` entries will be filled in. If `numEdges` is higher than the + actual number of edges, the remaining entries in `from` and `to` will + be set to NULL, and the number of edges actually returned will be + written to `numEdges`. `edgeData` may alone be NULL, in which case the + edges must all have default (zeroed) edge data. Attempting a losst + query via NULL `edgeData` will result in + :py:obj:`~.cudaErrorLossyQuery`. If `edgeData` is non-NULL then `from` + and `to` must be as well. Parameters ---------- graph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` - Graph to which to add the node - pDependencies : List[:py:obj:`~.cudaGraphNode_t`] - Dependencies of the node - numDependencies : size_t - Number of dependencies - nodeParams : :py:obj:`~.cudaExternalSemaphoreWaitNodeParams` - Parameters for the node + Graph to get the edges from + numEdges : int + See description Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` - pGraphNode : :py:obj:`~.cudaGraphNode_t` - Returns newly created node + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorLossyQuery`, :py:obj:`~.cudaErrorInvalidValue` + from : list[:py:obj:`~.cudaGraphNode_t`] + Location to return edge endpoints + to : list[:py:obj:`~.cudaGraphNode_t`] + Location to return edge endpoints + edgeData : list[:py:obj:`~.cudaGraphEdgeData`] + Optional location to return edge data + numEdges : int + See description See Also -------- - :py:obj:`~.cudaGraphAddNode`, :py:obj:`~.cudaGraphExternalSemaphoresWaitNodeGetParams`, :py:obj:`~.cudaGraphExternalSemaphoresWaitNodeSetParams`, :py:obj:`~.cudaGraphExecExternalSemaphoresWaitNodeSetParams`, :py:obj:`~.cudaGraphAddExternalSemaphoresSignalNode`, :py:obj:`~.cudaImportExternalSemaphore`, :py:obj:`~.cudaSignalExternalSemaphoresAsync`, :py:obj:`~.cudaWaitExternalSemaphoresAsync`, :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphDestroyNode`, :py:obj:`~.cudaGraphAddEventRecordNode`, :py:obj:`~.cudaGraphAddEventWaitNode`, :py:obj:`~.cudaGraphAddChildGraphNode`, :py:obj:`~.cudaGraphAddEmptyNode`, :py:obj:`~.cudaGraphAddKernelNode`, :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphAddMemsetNode` + :py:obj:`~.cudaGraphGetNodes`, :py:obj:`~.cudaGraphGetRootNodes`, :py:obj:`~.cudaGraphAddDependencies`, :py:obj:`~.cudaGraphRemoveDependencies`, :py:obj:`~.cudaGraphNodeGetDependencies`, :py:obj:`~.cudaGraphNodeGetDependentNodes` """ - pDependencies = [] if pDependencies is None else pDependencies - if not all(isinstance(_x, (cudaGraphNode_t,cuda.CUgraphNode)) for _x in pDependencies): - raise TypeError("Argument 'pDependencies' is not instance of type (expected List[ccudart.cudaGraphNode_t,cuda.CUgraphNode]") - cdef ccudart.cudaGraph_t cgraph + cdef size_t _graph_length = numEdges + cdef cyruntime.cudaGraph_t cygraph if graph is None: - cgraph = 0 - elif isinstance(graph, (cudaGraph_t,cuda.CUgraph)): + pgraph = 0 + elif isinstance(graph, (cudaGraph_t,driver.CUgraph)): pgraph = int(graph) - cgraph = pgraph else: pgraph = int(cudaGraph_t(graph)) - cgraph = pgraph - cdef cudaGraphNode_t pGraphNode = cudaGraphNode_t() - cdef ccudart.cudaGraphNode_t* cpDependencies = NULL - if len(pDependencies) > 0: - cpDependencies = calloc(len(pDependencies), sizeof(ccudart.cudaGraphNode_t)) - if cpDependencies is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(pDependencies)) + 'x' + str(sizeof(ccudart.cudaGraphNode_t))) - else: - for idx in range(len(pDependencies)): - cpDependencies[idx] = (pDependencies[idx])._ptr[0] - if numDependencies > len(pDependencies): raise RuntimeError("List is too small: " + str(len(pDependencies)) + " < " + str(numDependencies)) - cdef ccudart.cudaExternalSemaphoreWaitNodeParams* cnodeParams_ptr = nodeParams._ptr if nodeParams != None else NULL - err = ccudart.cudaGraphAddExternalSemaphoresWaitNode(pGraphNode._ptr, cgraph, (pDependencies[0])._ptr if len(pDependencies) == 1 else cpDependencies, numDependencies, cnodeParams_ptr) - if cpDependencies is not NULL: - free(cpDependencies) - return (cudaError_t(err), pGraphNode) -{{endif}} - -{{if 'cudaGraphExternalSemaphoresWaitNodeGetParams' in found_functions}} + cygraph = pgraph + cdef cyruntime.cudaGraphNode_t* cyfrom_ = NULL + pyfrom_ = [] + if _graph_length != 0: + cyfrom_ = calloc(_graph_length, sizeof(cyruntime.cudaGraphNode_t)) + if cyfrom_ is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(_graph_length) + 'x' + str(sizeof(cyruntime.cudaGraphNode_t))) + cdef cyruntime.cudaGraphNode_t* cyto = NULL + pyto = [] + if _graph_length != 0: + cyto = calloc(_graph_length, sizeof(cyruntime.cudaGraphNode_t)) + if cyto is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(_graph_length) + 'x' + str(sizeof(cyruntime.cudaGraphNode_t))) + cdef cyruntime.cudaGraphEdgeData* cyedgeData = NULL + pyedgeData = [] + if _graph_length != 0: + cyedgeData = calloc(_graph_length, sizeof(cyruntime.cudaGraphEdgeData)) + if cyedgeData is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(_graph_length) + 'x' + str(sizeof(cyruntime.cudaGraphEdgeData))) + with nogil: + err = cyruntime.cudaGraphGetEdges(cygraph, cyfrom_, cyto, cyedgeData, &numEdges) + if cudaError_t(err) == cudaError_t(0): + pyfrom_ = [cudaGraphNode_t() for _ in range(_graph_length)] + for idx in range(_graph_length): + (pyfrom_[idx])._pvt_ptr[0] = cyfrom_[idx] + if cyfrom_ is not NULL: + free(cyfrom_) + if cudaError_t(err) == cudaError_t(0): + pyto = [cudaGraphNode_t() for _ in range(_graph_length)] + for idx in range(_graph_length): + (pyto[idx])._pvt_ptr[0] = cyto[idx] + if cyto is not NULL: + free(cyto) + if cudaError_t(err) == cudaError_t(0): + pyedgeData = [cudaGraphEdgeData() for _ in range(_graph_length)] + for idx in range(_graph_length): + (pyedgeData[idx])._pvt_ptr[0] = cyedgeData[idx] + if cyedgeData is not NULL: + free(cyedgeData) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None, None, None, None) + return (_cudaError_t_SUCCESS, pyfrom_, pyto, pyedgeData, numEdges) @cython.embedsignature(True) -def cudaGraphExternalSemaphoresWaitNodeGetParams(hNode): - """ Returns an external semaphore wait node's parameters. +def cudaGraphNodeGetDependencies(node, size_t pNumDependencies = 0): + """ Returns a node's dependencies. - Returns the parameters of an external semaphore wait node `hNode` in - `params_out`. The `extSemArray` and `paramsArray` returned in - `params_out`, are owned by the node. This memory remains valid until - the node is destroyed or its parameters are modified, and should not be - modified directly. Use - :py:obj:`~.cudaGraphExternalSemaphoresSignalNodeSetParams` to update - the parameters of this node. + Returns a list of `node's` dependencies. `pDependencies` may be NULL, + in which case this function will return the number of dependencies in + `pNumDependencies`. Otherwise, `pNumDependencies` entries will be + filled in. If `pNumDependencies` is higher than the actual number of + dependencies, the remaining entries in `pDependencies` will be set to + NULL, and the number of nodes actually obtained will be returned in + `pNumDependencies`. + + Note that if an edge has non-zero (non-default) edge data and + `edgeData` is NULL, this API will return + :py:obj:`~.cudaErrorLossyQuery`. If `edgeData` is non-NULL, then + `pDependencies` must be as well. Parameters ---------- - hNode : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` - Node to get the parameters for + node : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` + Node to query + pNumDependencies : int + See description Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` - params_out : :py:obj:`~.cudaExternalSemaphoreWaitNodeParams` - Pointer to return the parameters + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorLossyQuery`, :py:obj:`~.cudaErrorInvalidValue` + pDependencies : list[:py:obj:`~.cudaGraphNode_t`] + Pointer to return the dependencies + edgeData : list[:py:obj:`~.cudaGraphEdgeData`] + Optional array to return edge data for each dependency + pNumDependencies : int + See description See Also -------- - :py:obj:`~.cudaLaunchKernel`, :py:obj:`~.cudaGraphAddExternalSemaphoresWaitNode`, :py:obj:`~.cudaGraphExternalSemaphoresWaitNodeSetParams`, :py:obj:`~.cudaGraphAddExternalSemaphoresWaitNode`, :py:obj:`~.cudaSignalExternalSemaphoresAsync`, :py:obj:`~.cudaWaitExternalSemaphoresAsync` + :py:obj:`~.cudaGraphNodeGetDependentNodes`, :py:obj:`~.cudaGraphGetNodes`, :py:obj:`~.cudaGraphGetRootNodes`, :py:obj:`~.cudaGraphGetEdges`, :py:obj:`~.cudaGraphAddDependencies`, :py:obj:`~.cudaGraphRemoveDependencies` """ - cdef ccudart.cudaGraphNode_t chNode - if hNode is None: - chNode = 0 - elif isinstance(hNode, (cudaGraphNode_t,cuda.CUgraphNode)): - phNode = int(hNode) - chNode = phNode + cdef size_t _graph_length = pNumDependencies + cdef cyruntime.cudaGraphNode_t cynode + if node is None: + pnode = 0 + elif isinstance(node, (cudaGraphNode_t,driver.CUgraphNode)): + pnode = int(node) else: - phNode = int(cudaGraphNode_t(hNode)) - chNode = phNode - cdef cudaExternalSemaphoreWaitNodeParams params_out = cudaExternalSemaphoreWaitNodeParams() - err = ccudart.cudaGraphExternalSemaphoresWaitNodeGetParams(chNode, params_out._ptr) - return (cudaError_t(err), params_out) -{{endif}} - -{{if 'cudaGraphExternalSemaphoresWaitNodeSetParams' in found_functions}} + pnode = int(cudaGraphNode_t(node)) + cynode = pnode + cdef cyruntime.cudaGraphNode_t* cypDependencies = NULL + pypDependencies = [] + if _graph_length != 0: + cypDependencies = calloc(_graph_length, sizeof(cyruntime.cudaGraphNode_t)) + if cypDependencies is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(_graph_length) + 'x' + str(sizeof(cyruntime.cudaGraphNode_t))) + cdef cyruntime.cudaGraphEdgeData* cyedgeData = NULL + pyedgeData = [] + if _graph_length != 0: + cyedgeData = calloc(_graph_length, sizeof(cyruntime.cudaGraphEdgeData)) + if cyedgeData is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(_graph_length) + 'x' + str(sizeof(cyruntime.cudaGraphEdgeData))) + with nogil: + err = cyruntime.cudaGraphNodeGetDependencies(cynode, cypDependencies, cyedgeData, &pNumDependencies) + if cudaError_t(err) == cudaError_t(0): + pypDependencies = [cudaGraphNode_t() for _ in range(_graph_length)] + for idx in range(_graph_length): + (pypDependencies[idx])._pvt_ptr[0] = cypDependencies[idx] + if cypDependencies is not NULL: + free(cypDependencies) + if cudaError_t(err) == cudaError_t(0): + pyedgeData = [cudaGraphEdgeData() for _ in range(_graph_length)] + for idx in range(_graph_length): + (pyedgeData[idx])._pvt_ptr[0] = cyedgeData[idx] + if cyedgeData is not NULL: + free(cyedgeData) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None, None, None) + return (_cudaError_t_SUCCESS, pypDependencies, pyedgeData, pNumDependencies) @cython.embedsignature(True) -def cudaGraphExternalSemaphoresWaitNodeSetParams(hNode, nodeParams : Optional[cudaExternalSemaphoreWaitNodeParams]): - """ Sets an external semaphore wait node's parameters. +def cudaGraphNodeGetDependentNodes(node, size_t pNumDependentNodes = 0): + """ Returns a node's dependent nodes. - Sets the parameters of an external semaphore wait node `hNode` to - `nodeParams`. + Returns a list of `node's` dependent nodes. `pDependentNodes` may be + NULL, in which case this function will return the number of dependent + nodes in `pNumDependentNodes`. Otherwise, `pNumDependentNodes` entries + will be filled in. If `pNumDependentNodes` is higher than the actual + number of dependent nodes, the remaining entries in `pDependentNodes` + will be set to NULL, and the number of nodes actually obtained will be + returned in `pNumDependentNodes`. + + Note that if an edge has non-zero (non-default) edge data and + `edgeData` is NULL, this API will return + :py:obj:`~.cudaErrorLossyQuery`. If `edgeData` is non-NULL, then + `pDependentNodes` must be as well. Parameters ---------- - hNode : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` - Node to set the parameters for - nodeParams : :py:obj:`~.cudaExternalSemaphoreWaitNodeParams` - Parameters to copy + node : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` + Node to query + pNumDependentNodes : int + See description Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorLossyQuery`, :py:obj:`~.cudaErrorInvalidValue` + pDependentNodes : list[:py:obj:`~.cudaGraphNode_t`] + Pointer to return the dependent nodes + edgeData : list[:py:obj:`~.cudaGraphEdgeData`] + Optional pointer to return edge data for dependent nodes + pNumDependentNodes : int + See description See Also -------- - :py:obj:`~.cudaGraphNodeSetParams`, :py:obj:`~.cudaGraphAddExternalSemaphoresWaitNode`, :py:obj:`~.cudaGraphExternalSemaphoresWaitNodeSetParams`, :py:obj:`~.cudaGraphAddExternalSemaphoresWaitNode`, :py:obj:`~.cudaSignalExternalSemaphoresAsync`, :py:obj:`~.cudaWaitExternalSemaphoresAsync` + :py:obj:`~.cudaGraphNodeGetDependencies`, :py:obj:`~.cudaGraphGetNodes`, :py:obj:`~.cudaGraphGetRootNodes`, :py:obj:`~.cudaGraphGetEdges`, :py:obj:`~.cudaGraphAddDependencies`, :py:obj:`~.cudaGraphRemoveDependencies` """ - cdef ccudart.cudaGraphNode_t chNode - if hNode is None: - chNode = 0 - elif isinstance(hNode, (cudaGraphNode_t,cuda.CUgraphNode)): - phNode = int(hNode) - chNode = phNode + cdef size_t _graph_length = pNumDependentNodes + cdef cyruntime.cudaGraphNode_t cynode + if node is None: + pnode = 0 + elif isinstance(node, (cudaGraphNode_t,driver.CUgraphNode)): + pnode = int(node) else: - phNode = int(cudaGraphNode_t(hNode)) - chNode = phNode - cdef ccudart.cudaExternalSemaphoreWaitNodeParams* cnodeParams_ptr = nodeParams._ptr if nodeParams != None else NULL - err = ccudart.cudaGraphExternalSemaphoresWaitNodeSetParams(chNode, cnodeParams_ptr) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaGraphAddMemAllocNode' in found_functions}} + pnode = int(cudaGraphNode_t(node)) + cynode = pnode + cdef cyruntime.cudaGraphNode_t* cypDependentNodes = NULL + pypDependentNodes = [] + if _graph_length != 0: + cypDependentNodes = calloc(_graph_length, sizeof(cyruntime.cudaGraphNode_t)) + if cypDependentNodes is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(_graph_length) + 'x' + str(sizeof(cyruntime.cudaGraphNode_t))) + cdef cyruntime.cudaGraphEdgeData* cyedgeData = NULL + pyedgeData = [] + if _graph_length != 0: + cyedgeData = calloc(_graph_length, sizeof(cyruntime.cudaGraphEdgeData)) + if cyedgeData is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(_graph_length) + 'x' + str(sizeof(cyruntime.cudaGraphEdgeData))) + with nogil: + err = cyruntime.cudaGraphNodeGetDependentNodes(cynode, cypDependentNodes, cyedgeData, &pNumDependentNodes) + if cudaError_t(err) == cudaError_t(0): + pypDependentNodes = [cudaGraphNode_t() for _ in range(_graph_length)] + for idx in range(_graph_length): + (pypDependentNodes[idx])._pvt_ptr[0] = cypDependentNodes[idx] + if cypDependentNodes is not NULL: + free(cypDependentNodes) + if cudaError_t(err) == cudaError_t(0): + pyedgeData = [cudaGraphEdgeData() for _ in range(_graph_length)] + for idx in range(_graph_length): + (pyedgeData[idx])._pvt_ptr[0] = cyedgeData[idx] + if cyedgeData is not NULL: + free(cyedgeData) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None, None, None) + return (_cudaError_t_SUCCESS, pypDependentNodes, pyedgeData, pNumDependentNodes) @cython.embedsignature(True) -def cudaGraphAddMemAllocNode(graph, pDependencies : Optional[List[cudaGraphNode_t]], size_t numDependencies, nodeParams : Optional[cudaMemAllocNodeParams]): - """ Creates an allocation node and adds it to a graph. - - Creates a new allocation node and adds it to `graph` with - `numDependencies` dependencies specified via `pDependencies` and - arguments specified in `nodeParams`. It is possible for - `numDependencies` to be 0, in which case the node will be placed at the - root of the graph. `pDependencies` may not have any duplicate entries. - A handle to the new node will be returned in `pGraphNode`. - - When :py:obj:`~.cudaGraphAddMemAllocNode` creates an allocation node, - it returns the address of the allocation in `nodeParams.dptr`. The - allocation's address remains fixed across instantiations and launches. - - If the allocation is freed in the same graph, by creating a free node - using :py:obj:`~.cudaGraphAddMemFreeNode`, the allocation can be - accessed by nodes ordered after the allocation node but before the free - node. These allocations cannot be freed outside the owning graph, and - they can only be freed once in the owning graph. - - If the allocation is not freed in the same graph, then it can be - accessed not only by nodes in the graph which are ordered after the - allocation node, but also by stream operations ordered after the - graph's execution but before the allocation is freed. - - Allocations which are not freed in the same graph can be freed by: - - - passing the allocation to :py:obj:`~.cudaMemFreeAsync` or - :py:obj:`~.cudaMemFree`; - - - launching a graph with a free node for that allocation; or +def cudaGraphAddDependencies(graph, from_ : Optional[tuple[cudaGraphNode_t] | list[cudaGraphNode_t]], to : Optional[tuple[cudaGraphNode_t] | list[cudaGraphNode_t]], edgeData : Optional[tuple[cudaGraphEdgeData] | list[cudaGraphEdgeData]], size_t numDependencies): + """ Adds dependency edges to a graph. - - specifying :py:obj:`~.cudaGraphInstantiateFlagAutoFreeOnLaunch` - during instantiation, which makes each launch behave as though it - called :py:obj:`~.cudaMemFreeAsync` for every unfreed allocation. + The number of dependencies to be added is defined by `numDependencies` + Elements in `pFrom` and `pTo` at corresponding indices define a + dependency. Each node in `pFrom` and `pTo` must belong to `graph`. - It is not possible to free an allocation in both the owning graph and - another graph. If the allocation is freed in the same graph, a free - node cannot be added to another graph. If the allocation is freed in - another graph, a free node can no longer be added to the owning graph. + If `numDependencies` is 0, elements in `pFrom` and `pTo` will be + ignored. Specifying an existing dependency will return an error. - The following restrictions apply to graphs which contain allocation - and/or memory free nodes: + Parameters + ---------- + graph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` + Graph to which dependencies are added + from : list[:py:obj:`~.cudaGraphNode_t`] + Array of nodes that provide the dependencies + to : list[:py:obj:`~.cudaGraphNode_t`] + Array of dependent nodes + edgeData : list[:py:obj:`~.cudaGraphEdgeData`] + Optional array of edge data. If NULL, default (zeroed) edge data is + assumed. + numDependencies : size_t + Number of dependencies to be added - - Nodes and edges of the graph cannot be deleted. + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + + See Also + -------- + :py:obj:`~.cudaGraphRemoveDependencies`, :py:obj:`~.cudaGraphGetEdges`, :py:obj:`~.cudaGraphNodeGetDependencies`, :py:obj:`~.cudaGraphNodeGetDependentNodes` + """ + edgeData = [] if edgeData is None else edgeData + if not all(isinstance(_x, (cudaGraphEdgeData,)) for _x in edgeData): + raise TypeError("Argument 'edgeData' is not instance of type (expected tuple[cyruntime.cudaGraphEdgeData,] or list[cyruntime.cudaGraphEdgeData,]") + to = [] if to is None else to + if not all(isinstance(_x, (cudaGraphNode_t,driver.CUgraphNode)) for _x in to): + raise TypeError("Argument 'to' is not instance of type (expected tuple[cyruntime.cudaGraphNode_t,driver.CUgraphNode] or list[cyruntime.cudaGraphNode_t,driver.CUgraphNode]") + from_ = [] if from_ is None else from_ + if not all(isinstance(_x, (cudaGraphNode_t,driver.CUgraphNode)) for _x in from_): + raise TypeError("Argument 'from_' is not instance of type (expected tuple[cyruntime.cudaGraphNode_t,driver.CUgraphNode] or list[cyruntime.cudaGraphNode_t,driver.CUgraphNode]") + cdef cyruntime.cudaGraph_t cygraph + if graph is None: + pgraph = 0 + elif isinstance(graph, (cudaGraph_t,driver.CUgraph)): + pgraph = int(graph) + else: + pgraph = int(cudaGraph_t(graph)) + cygraph = pgraph + cdef cyruntime.cudaGraphNode_t* cyfrom_ = NULL + if len(from_) > 1: + cyfrom_ = calloc(len(from_), sizeof(cyruntime.cudaGraphNode_t)) + if cyfrom_ is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(from_)) + 'x' + str(sizeof(cyruntime.cudaGraphNode_t))) + else: + for idx in range(len(from_)): + cyfrom_[idx] = (from_[idx])._pvt_ptr[0] + elif len(from_) == 1: + cyfrom_ = (from_[0])._pvt_ptr + cdef cyruntime.cudaGraphNode_t* cyto = NULL + if len(to) > 1: + cyto = calloc(len(to), sizeof(cyruntime.cudaGraphNode_t)) + if cyto is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(to)) + 'x' + str(sizeof(cyruntime.cudaGraphNode_t))) + else: + for idx in range(len(to)): + cyto[idx] = (to[idx])._pvt_ptr[0] + elif len(to) == 1: + cyto = (to[0])._pvt_ptr + cdef cyruntime.cudaGraphEdgeData* cyedgeData = NULL + if len(edgeData) > 1: + cyedgeData = calloc(len(edgeData), sizeof(cyruntime.cudaGraphEdgeData)) + if cyedgeData is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(edgeData)) + 'x' + str(sizeof(cyruntime.cudaGraphEdgeData))) + for idx in range(len(edgeData)): + string.memcpy(&cyedgeData[idx], (edgeData[idx])._pvt_ptr, sizeof(cyruntime.cudaGraphEdgeData)) + elif len(edgeData) == 1: + cyedgeData = (edgeData[0])._pvt_ptr + with nogil: + err = cyruntime.cudaGraphAddDependencies(cygraph, cyfrom_, cyto, cyedgeData, numDependencies) + if len(from_) > 1 and cyfrom_ is not NULL: + free(cyfrom_) + if len(to) > 1 and cyto is not NULL: + free(cyto) + if len(edgeData) > 1 and cyedgeData is not NULL: + free(cyedgeData) + return (_cudaError_t(err),) - - The graph cannot be used in a child node. +@cython.embedsignature(True) +def cudaGraphRemoveDependencies(graph, from_ : Optional[tuple[cudaGraphNode_t] | list[cudaGraphNode_t]], to : Optional[tuple[cudaGraphNode_t] | list[cudaGraphNode_t]], edgeData : Optional[tuple[cudaGraphEdgeData] | list[cudaGraphEdgeData]], size_t numDependencies): + """ Removes dependency edges from a graph. - - Only one instantiation of the graph may exist at any point in time. + The number of `pDependencies` to be removed is defined by + `numDependencies`. Elements in `pFrom` and `pTo` at corresponding + indices define a dependency. Each node in `pFrom` and `pTo` must belong + to `graph`. - - The graph cannot be cloned. + If `numDependencies` is 0, elements in `pFrom` and `pTo` will be + ignored. Specifying an edge that does not exist in the graph, with data + matching `edgeData`, results in an error. `edgeData` is nullable, which + is equivalent to passing default (zeroed) data for each edge. Parameters ---------- graph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` - Graph to which to add the node - pDependencies : List[:py:obj:`~.cudaGraphNode_t`] - Dependencies of the node + Graph from which to remove dependencies + from : list[:py:obj:`~.cudaGraphNode_t`] + Array of nodes that provide the dependencies + to : list[:py:obj:`~.cudaGraphNode_t`] + Array of dependent nodes + edgeData : list[:py:obj:`~.cudaGraphEdgeData`] + Optional array of edge data. If NULL, edge data is assumed to be + default (zeroed). numDependencies : size_t - Number of dependencies - nodeParams : :py:obj:`~.cudaMemAllocNodeParams` - Parameters for the node + Number of dependencies to be removed Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorCudartUnloading`, :py:obj:`~.cudaErrorInitializationError`, :py:obj:`~.cudaErrorNotSupported`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorOutOfMemory` - pGraphNode : :py:obj:`~.cudaGraphNode_t` - Returns newly created node + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` See Also -------- - :py:obj:`~.cudaGraphAddNode`, :py:obj:`~.cudaGraphAddMemFreeNode`, :py:obj:`~.cudaGraphMemAllocNodeGetParams`, :py:obj:`~.cudaDeviceGraphMemTrim`, :py:obj:`~.cudaDeviceGetGraphMemAttribute`, :py:obj:`~.cudaDeviceSetGraphMemAttribute`, :py:obj:`~.cudaMallocAsync`, :py:obj:`~.cudaFreeAsync`, :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphDestroyNode`, :py:obj:`~.cudaGraphAddChildGraphNode`, :py:obj:`~.cudaGraphAddEmptyNode`, :py:obj:`~.cudaGraphAddEventRecordNode`, :py:obj:`~.cudaGraphAddEventWaitNode`, :py:obj:`~.cudaGraphAddExternalSemaphoresSignalNode`, :py:obj:`~.cudaGraphAddExternalSemaphoresWaitNode`, :py:obj:`~.cudaGraphAddKernelNode`, :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphAddMemsetNode` + :py:obj:`~.cudaGraphAddDependencies`, :py:obj:`~.cudaGraphGetEdges`, :py:obj:`~.cudaGraphNodeGetDependencies`, :py:obj:`~.cudaGraphNodeGetDependentNodes` """ - pDependencies = [] if pDependencies is None else pDependencies - if not all(isinstance(_x, (cudaGraphNode_t,cuda.CUgraphNode)) for _x in pDependencies): - raise TypeError("Argument 'pDependencies' is not instance of type (expected List[ccudart.cudaGraphNode_t,cuda.CUgraphNode]") - cdef ccudart.cudaGraph_t cgraph + edgeData = [] if edgeData is None else edgeData + if not all(isinstance(_x, (cudaGraphEdgeData,)) for _x in edgeData): + raise TypeError("Argument 'edgeData' is not instance of type (expected tuple[cyruntime.cudaGraphEdgeData,] or list[cyruntime.cudaGraphEdgeData,]") + to = [] if to is None else to + if not all(isinstance(_x, (cudaGraphNode_t,driver.CUgraphNode)) for _x in to): + raise TypeError("Argument 'to' is not instance of type (expected tuple[cyruntime.cudaGraphNode_t,driver.CUgraphNode] or list[cyruntime.cudaGraphNode_t,driver.CUgraphNode]") + from_ = [] if from_ is None else from_ + if not all(isinstance(_x, (cudaGraphNode_t,driver.CUgraphNode)) for _x in from_): + raise TypeError("Argument 'from_' is not instance of type (expected tuple[cyruntime.cudaGraphNode_t,driver.CUgraphNode] or list[cyruntime.cudaGraphNode_t,driver.CUgraphNode]") + cdef cyruntime.cudaGraph_t cygraph if graph is None: - cgraph = 0 - elif isinstance(graph, (cudaGraph_t,cuda.CUgraph)): + pgraph = 0 + elif isinstance(graph, (cudaGraph_t,driver.CUgraph)): pgraph = int(graph) - cgraph = pgraph else: pgraph = int(cudaGraph_t(graph)) - cgraph = pgraph - cdef cudaGraphNode_t pGraphNode = cudaGraphNode_t() - cdef ccudart.cudaGraphNode_t* cpDependencies = NULL - if len(pDependencies) > 0: - cpDependencies = calloc(len(pDependencies), sizeof(ccudart.cudaGraphNode_t)) - if cpDependencies is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(pDependencies)) + 'x' + str(sizeof(ccudart.cudaGraphNode_t))) + cygraph = pgraph + cdef cyruntime.cudaGraphNode_t* cyfrom_ = NULL + if len(from_) > 1: + cyfrom_ = calloc(len(from_), sizeof(cyruntime.cudaGraphNode_t)) + if cyfrom_ is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(from_)) + 'x' + str(sizeof(cyruntime.cudaGraphNode_t))) else: - for idx in range(len(pDependencies)): - cpDependencies[idx] = (pDependencies[idx])._ptr[0] - if numDependencies > len(pDependencies): raise RuntimeError("List is too small: " + str(len(pDependencies)) + " < " + str(numDependencies)) - cdef ccudart.cudaMemAllocNodeParams* cnodeParams_ptr = nodeParams._ptr if nodeParams != None else NULL - err = ccudart.cudaGraphAddMemAllocNode(pGraphNode._ptr, cgraph, (pDependencies[0])._ptr if len(pDependencies) == 1 else cpDependencies, numDependencies, cnodeParams_ptr) - if cpDependencies is not NULL: - free(cpDependencies) - return (cudaError_t(err), pGraphNode) -{{endif}} - -{{if 'cudaGraphMemAllocNodeGetParams' in found_functions}} + for idx in range(len(from_)): + cyfrom_[idx] = (from_[idx])._pvt_ptr[0] + elif len(from_) == 1: + cyfrom_ = (from_[0])._pvt_ptr + cdef cyruntime.cudaGraphNode_t* cyto = NULL + if len(to) > 1: + cyto = calloc(len(to), sizeof(cyruntime.cudaGraphNode_t)) + if cyto is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(to)) + 'x' + str(sizeof(cyruntime.cudaGraphNode_t))) + else: + for idx in range(len(to)): + cyto[idx] = (to[idx])._pvt_ptr[0] + elif len(to) == 1: + cyto = (to[0])._pvt_ptr + cdef cyruntime.cudaGraphEdgeData* cyedgeData = NULL + if len(edgeData) > 1: + cyedgeData = calloc(len(edgeData), sizeof(cyruntime.cudaGraphEdgeData)) + if cyedgeData is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(edgeData)) + 'x' + str(sizeof(cyruntime.cudaGraphEdgeData))) + for idx in range(len(edgeData)): + string.memcpy(&cyedgeData[idx], (edgeData[idx])._pvt_ptr, sizeof(cyruntime.cudaGraphEdgeData)) + elif len(edgeData) == 1: + cyedgeData = (edgeData[0])._pvt_ptr + with nogil: + err = cyruntime.cudaGraphRemoveDependencies(cygraph, cyfrom_, cyto, cyedgeData, numDependencies) + if len(from_) > 1 and cyfrom_ is not NULL: + free(cyfrom_) + if len(to) > 1 and cyto is not NULL: + free(cyto) + if len(edgeData) > 1 and cyedgeData is not NULL: + free(cyedgeData) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaGraphMemAllocNodeGetParams(node): - """ Returns a memory alloc node's parameters. +def cudaGraphDestroyNode(node): + """ Remove a node from the graph. - Returns the parameters of a memory alloc node `hNode` in `params_out`. - The `poolProps` and `accessDescs` returned in `params_out`, are owned - by the node. This memory remains valid until the node is destroyed. The - returned parameters must not be modified. + Removes `node` from its graph. This operation also severs any + dependencies of other nodes on `node` and vice versa. + + Dependencies cannot be removed from graphs which contain allocation or + free nodes. Any attempt to do so will return an error. Parameters ---------- node : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` - Node to get the parameters for + Node to remove Returns ------- cudaError_t :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` - params_out : :py:obj:`~.cudaMemAllocNodeParams` - Pointer to return the parameters See Also -------- - :py:obj:`~.cudaGraphAddMemAllocNode`, :py:obj:`~.cudaGraphMemFreeNodeGetParams` + :py:obj:`~.cudaGraphAddChildGraphNode`, :py:obj:`~.cudaGraphAddEmptyNode`, :py:obj:`~.cudaGraphAddKernelNode`, :py:obj:`~.cudaGraphAddHostNode`, :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphAddMemsetNode` """ - cdef ccudart.cudaGraphNode_t cnode + cdef cyruntime.cudaGraphNode_t cynode if node is None: - cnode = 0 - elif isinstance(node, (cudaGraphNode_t,cuda.CUgraphNode)): + pnode = 0 + elif isinstance(node, (cudaGraphNode_t,driver.CUgraphNode)): pnode = int(node) - cnode = pnode else: pnode = int(cudaGraphNode_t(node)) - cnode = pnode - cdef cudaMemAllocNodeParams params_out = cudaMemAllocNodeParams() - err = ccudart.cudaGraphMemAllocNodeGetParams(cnode, params_out._ptr) - return (cudaError_t(err), params_out) -{{endif}} - -{{if 'cudaGraphAddMemFreeNode' in found_functions}} + cynode = pnode + with nogil: + err = cyruntime.cudaGraphDestroyNode(cynode) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaGraphAddMemFreeNode(graph, pDependencies : Optional[List[cudaGraphNode_t]], size_t numDependencies, dptr): - """ Creates a memory free node and adds it to a graph. +def cudaGraphInstantiate(graph, unsigned long long flags): + """ Creates an executable graph from a graph. - Creates a new memory free node and adds it to `graph` with - `numDependencies` dependencies specified via `pDependencies` and - address specified in `dptr`. It is possible for `numDependencies` to be - 0, in which case the node will be placed at the root of the graph. - `pDependencies` may not have any duplicate entries. A handle to the new - node will be returned in `pGraphNode`. + Instantiates `graph` as an executable graph. The graph is validated for + any structural constraints or intra-node constraints which were not + previously validated. If instantiation is successful, a handle to the + instantiated graph is returned in `pGraphExec`. - :py:obj:`~.cudaGraphAddMemFreeNode` will return - :py:obj:`~.cudaErrorInvalidValue` if the user attempts to free: + The `flags` parameter controls the behavior of instantiation and + subsequent graph launches. Valid flags are: - - an allocation twice in the same graph. + - :py:obj:`~.cudaGraphInstantiateFlagAutoFreeOnLaunch`, which + configures a graph containing memory allocation nodes to + automatically free any unfreed memory allocations before the graph is + relaunched. - - an address that was not returned by an allocation node. + - :py:obj:`~.cudaGraphInstantiateFlagDeviceLaunch`, which configures + the graph for launch from the device. If this flag is passed, the + executable graph handle returned can be used to launch the graph from + both the host and device. This flag cannot be used in conjunction + with :py:obj:`~.cudaGraphInstantiateFlagAutoFreeOnLaunch`. - - an invalid address. + - :py:obj:`~.cudaGraphInstantiateFlagUseNodePriority`, which causes the + graph to use the priorities from the per-node attributes rather than + the priority of the launch stream during execution. Note that + priorities are only available on kernel nodes, and are copied from + stream priority during stream capture. - The following restrictions apply to graphs which contain allocation - and/or memory free nodes: + If `graph` contains any allocation or free nodes, there can be at most + one executable graph in existence for that graph at a time. An attempt + to instantiate a second executable graph before destroying the first + with :py:obj:`~.cudaGraphExecDestroy` will result in an error. The same + also applies if `graph` contains any device-updatable kernel nodes. - - Nodes and edges of the graph cannot be deleted. + Graphs instantiated for launch on the device have additional + restrictions which do not apply to host graphs: - - The graph cannot be used in a child node. + - The graph's nodes must reside on a single device. - - Only one instantiation of the graph may exist at any point in time. + - The graph can only contain kernel nodes, memcpy nodes, memset nodes, + and child graph nodes. - - The graph cannot be cloned. + - The graph cannot be empty and must contain at least one kernel, + memcpy, or memset node. Operation-specific restrictions are outlined + below. + + - Kernel nodes: + + - Use of CUDA Dynamic Parallelism is not permitted. + + - Cooperative launches are permitted as long as MPS is not in use. + + - Memcpy nodes: + + - Only copies involving device memory and/or pinned device-mapped + host memory are permitted. + + - Copies involving CUDA arrays are not permitted. + + - Both operands must be accessible from the current device, and the + current device must match the device of other nodes in the graph. + + If `graph` is not instantiated for launch on the device but contains + kernels which call device-side :py:obj:`~.cudaGraphLaunch()` from + multiple devices, this will result in an error. Parameters ---------- graph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` - Graph to which to add the node - pDependencies : List[:py:obj:`~.cudaGraphNode_t`] - Dependencies of the node - numDependencies : size_t - Number of dependencies - dptr : Any - Address of memory to free + Graph to instantiate + flags : unsigned long long + Flags to control instantiation. See + :py:obj:`~.CUgraphInstantiate_flags`. Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorCudartUnloading`, :py:obj:`~.cudaErrorInitializationError`, :py:obj:`~.cudaErrorNotSupported`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorOutOfMemory` - pGraphNode : :py:obj:`~.cudaGraphNode_t` - Returns newly created node + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + pGraphExec : :py:obj:`~.cudaGraphExec_t` + Returns instantiated graph See Also -------- - :py:obj:`~.cudaGraphAddNode`, :py:obj:`~.cudaGraphAddMemAllocNode`, :py:obj:`~.cudaGraphMemFreeNodeGetParams`, :py:obj:`~.cudaDeviceGraphMemTrim`, :py:obj:`~.cudaDeviceGetGraphMemAttribute`, :py:obj:`~.cudaDeviceSetGraphMemAttribute`, :py:obj:`~.cudaMallocAsync`, :py:obj:`~.cudaFreeAsync`, :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphDestroyNode`, :py:obj:`~.cudaGraphAddChildGraphNode`, :py:obj:`~.cudaGraphAddEmptyNode`, :py:obj:`~.cudaGraphAddEventRecordNode`, :py:obj:`~.cudaGraphAddEventWaitNode`, :py:obj:`~.cudaGraphAddExternalSemaphoresSignalNode`, :py:obj:`~.cudaGraphAddExternalSemaphoresWaitNode`, :py:obj:`~.cudaGraphAddKernelNode`, :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphAddMemsetNode` + :py:obj:`~.cudaGraphInstantiateWithFlags`, :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphUpload`, :py:obj:`~.cudaGraphLaunch`, :py:obj:`~.cudaGraphExecDestroy` """ - pDependencies = [] if pDependencies is None else pDependencies - if not all(isinstance(_x, (cudaGraphNode_t,cuda.CUgraphNode)) for _x in pDependencies): - raise TypeError("Argument 'pDependencies' is not instance of type (expected List[ccudart.cudaGraphNode_t,cuda.CUgraphNode]") - cdef ccudart.cudaGraph_t cgraph + cdef cyruntime.cudaGraph_t cygraph if graph is None: - cgraph = 0 - elif isinstance(graph, (cudaGraph_t,cuda.CUgraph)): + pgraph = 0 + elif isinstance(graph, (cudaGraph_t,driver.CUgraph)): pgraph = int(graph) - cgraph = pgraph else: pgraph = int(cudaGraph_t(graph)) - cgraph = pgraph - cdef cudaGraphNode_t pGraphNode = cudaGraphNode_t() - cdef ccudart.cudaGraphNode_t* cpDependencies = NULL - if len(pDependencies) > 0: - cpDependencies = calloc(len(pDependencies), sizeof(ccudart.cudaGraphNode_t)) - if cpDependencies is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(pDependencies)) + 'x' + str(sizeof(ccudart.cudaGraphNode_t))) - else: - for idx in range(len(pDependencies)): - cpDependencies[idx] = (pDependencies[idx])._ptr[0] - if numDependencies > len(pDependencies): raise RuntimeError("List is too small: " + str(len(pDependencies)) + " < " + str(numDependencies)) - cdptr = utils.HelperInputVoidPtr(dptr) - cdef void* cdptr_ptr = cdptr.cptr - err = ccudart.cudaGraphAddMemFreeNode(pGraphNode._ptr, cgraph, (pDependencies[0])._ptr if len(pDependencies) == 1 else cpDependencies, numDependencies, cdptr_ptr) - if cpDependencies is not NULL: - free(cpDependencies) - return (cudaError_t(err), pGraphNode) -{{endif}} - -{{if 'cudaGraphMemFreeNodeGetParams' in found_functions}} + cygraph = pgraph + cdef cudaGraphExec_t pGraphExec = cudaGraphExec_t() + with nogil: + err = cyruntime.cudaGraphInstantiate(pGraphExec._pvt_ptr, cygraph, flags) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, pGraphExec) @cython.embedsignature(True) -def cudaGraphMemFreeNodeGetParams(node): - """ Returns a memory free node's parameters. +def cudaGraphInstantiateWithFlags(graph, unsigned long long flags): + """ Creates an executable graph from a graph. - Returns the address of a memory free node `hNode` in `dptr_out`. + Instantiates `graph` as an executable graph. The graph is validated for + any structural constraints or intra-node constraints which were not + previously validated. If instantiation is successful, a handle to the + instantiated graph is returned in `pGraphExec`. - Parameters - ---------- - node : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` - Node to get the parameters for + The `flags` parameter controls the behavior of instantiation and + subsequent graph launches. Valid flags are: - Returns - ------- - cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` - dptr_out : Any - Pointer to return the device address + - :py:obj:`~.cudaGraphInstantiateFlagAutoFreeOnLaunch`, which + configures a graph containing memory allocation nodes to + automatically free any unfreed memory allocations before the graph is + relaunched. - See Also - -------- - :py:obj:`~.cudaGraphAddMemFreeNode`, :py:obj:`~.cudaGraphMemFreeNodeGetParams` - """ - cdef ccudart.cudaGraphNode_t cnode - if node is None: - cnode = 0 - elif isinstance(node, (cudaGraphNode_t,cuda.CUgraphNode)): - pnode = int(node) - cnode = pnode - else: - pnode = int(cudaGraphNode_t(node)) - cnode = pnode - cdef void_ptr dptr_out = 0 - cdef void* cdptr_out_ptr = &dptr_out - err = ccudart.cudaGraphMemFreeNodeGetParams(cnode, cdptr_out_ptr) - return (cudaError_t(err), dptr_out) -{{endif}} + - :py:obj:`~.cudaGraphInstantiateFlagDeviceLaunch`, which configures + the graph for launch from the device. If this flag is passed, the + executable graph handle returned can be used to launch the graph from + both the host and device. This flag can only be used on platforms + which support unified addressing. This flag cannot be used in + conjunction with + :py:obj:`~.cudaGraphInstantiateFlagAutoFreeOnLaunch`. -{{if 'cudaDeviceGraphMemTrim' in found_functions}} + - :py:obj:`~.cudaGraphInstantiateFlagUseNodePriority`, which causes the + graph to use the priorities from the per-node attributes rather than + the priority of the launch stream during execution. Note that + priorities are only available on kernel nodes, and are copied from + stream priority during stream capture. -@cython.embedsignature(True) -def cudaDeviceGraphMemTrim(int device): - """ Free unused memory that was cached on the specified device for use with graphs back to the OS. + If `graph` contains any allocation or free nodes, there can be at most + one executable graph in existence for that graph at a time. An attempt + to instantiate a second executable graph before destroying the first + with :py:obj:`~.cudaGraphExecDestroy` will result in an error. The same + also applies if `graph` contains any device-updatable kernel nodes. - Blocks which are not in use by a graph that is either currently - executing or scheduled to execute are freed back to the operating - system. + If `graph` contains kernels which call device-side + :py:obj:`~.cudaGraphLaunch()` from multiple devices, this will result + in an error. - Parameters - ---------- - device : int - The device for which cached memory should be freed. + Graphs instantiated for launch on the device have additional + restrictions which do not apply to host graphs: - Returns - ------- - cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + - The graph's nodes must reside on a single device. - See Also - -------- - :py:obj:`~.cudaGraphAddMemAllocNode`, :py:obj:`~.cudaGraphAddMemFreeNode`, :py:obj:`~.cudaDeviceGetGraphMemAttribute`, :py:obj:`~.cudaDeviceSetGraphMemAttribute`, :py:obj:`~.cudaMallocAsync`, :py:obj:`~.cudaFreeAsync` - """ - err = ccudart.cudaDeviceGraphMemTrim(device) - return (cudaError_t(err),) -{{endif}} + - The graph can only contain kernel nodes, memcpy nodes, memset nodes, + and child graph nodes. -{{if 'cudaDeviceGetGraphMemAttribute' in found_functions}} + - The graph cannot be empty and must contain at least one kernel, + memcpy, or memset node. Operation-specific restrictions are outlined + below. -@cython.embedsignature(True) -def cudaDeviceGetGraphMemAttribute(int device, attr not None : cudaGraphMemAttributeType): - """ Query asynchronous allocation attributes related to graphs. + - Kernel nodes: - Valid attributes are: + - Use of CUDA Dynamic Parallelism is not permitted. - - :py:obj:`~.cudaGraphMemAttrUsedMemCurrent`: Amount of memory, in - bytes, currently associated with graphs + - Cooperative launches are permitted as long as MPS is not in use. - - :py:obj:`~.cudaGraphMemAttrUsedMemHigh`: High watermark of memory, in - bytes, associated with graphs since the last time it was reset. High - watermark can only be reset to zero. + - Memcpy nodes: - - :py:obj:`~.cudaGraphMemAttrReservedMemCurrent`: Amount of memory, in - bytes, currently allocated for use by the CUDA graphs asynchronous - allocator. + - Only copies involving device memory and/or pinned device-mapped + host memory are permitted. - - :py:obj:`~.cudaGraphMemAttrReservedMemHigh`: High watermark of - memory, in bytes, currently allocated for use by the CUDA graphs - asynchronous allocator. + - Copies involving CUDA arrays are not permitted. + + - Both operands must be accessible from the current device, and the + current device must match the device of other nodes in the graph. Parameters ---------- - device : int - Specifies the scope of the query - attr : :py:obj:`~.cudaGraphMemAttributeType` - attribute to get + graph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` + Graph to instantiate + flags : unsigned long long + Flags to control instantiation. See + :py:obj:`~.CUgraphInstantiate_flags`. Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDevice` - value : Any - retrieved value + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + pGraphExec : :py:obj:`~.cudaGraphExec_t` + Returns instantiated graph See Also -------- - :py:obj:`~.cudaDeviceSetGraphMemAttribute`, :py:obj:`~.cudaGraphAddMemAllocNode`, :py:obj:`~.cudaGraphAddMemFreeNode`, :py:obj:`~.cudaDeviceGraphMemTrim`, :py:obj:`~.cudaMallocAsync`, :py:obj:`~.cudaFreeAsync` + :py:obj:`~.cudaGraphInstantiate`, :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphUpload`, :py:obj:`~.cudaGraphLaunch`, :py:obj:`~.cudaGraphExecDestroy` """ - cdef ccudart.cudaGraphMemAttributeType cattr = attr.value - cdef utils.HelperCUgraphMem_attribute cvalue = utils.HelperCUgraphMem_attribute(attr, 0, is_getter=True) - cdef void* cvalue_ptr = cvalue.cptr - err = ccudart.cudaDeviceGetGraphMemAttribute(device, cattr, cvalue_ptr) - return (cudaError_t(err), cvalue.pyObj()) -{{endif}} - -{{if 'cudaDeviceSetGraphMemAttribute' in found_functions}} + cdef cyruntime.cudaGraph_t cygraph + if graph is None: + pgraph = 0 + elif isinstance(graph, (cudaGraph_t,driver.CUgraph)): + pgraph = int(graph) + else: + pgraph = int(cudaGraph_t(graph)) + cygraph = pgraph + cdef cudaGraphExec_t pGraphExec = cudaGraphExec_t() + with nogil: + err = cyruntime.cudaGraphInstantiateWithFlags(pGraphExec._pvt_ptr, cygraph, flags) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, pGraphExec) @cython.embedsignature(True) -def cudaDeviceSetGraphMemAttribute(int device, attr not None : cudaGraphMemAttributeType, value): - """ Set asynchronous allocation attributes related to graphs. - - Valid attributes are: - - - :py:obj:`~.cudaGraphMemAttrUsedMemHigh`: High watermark of memory, in - bytes, associated with graphs since the last time it was reset. High - watermark can only be reset to zero. +def cudaGraphInstantiateWithParams(graph, instantiateParams : Optional[cudaGraphInstantiateParams]): + """ Creates an executable graph from a graph. - - :py:obj:`~.cudaGraphMemAttrReservedMemHigh`: High watermark of - memory, in bytes, currently allocated for use by the CUDA graphs - asynchronous allocator. + Instantiates `graph` as an executable graph according to the + `instantiateParams` structure. The graph is validated for any + structural constraints or intra-node constraints which were not + previously validated. If instantiation is successful, a handle to the + instantiated graph is returned in `pGraphExec`. - Parameters - ---------- - device : int - Specifies the scope of the query - attr : :py:obj:`~.cudaGraphMemAttributeType` - attribute to get - value : Any - pointer to value to set + `instantiateParams` controls the behavior of instantiation and + subsequent graph launches, as well as returning more detailed + information in the event of an error. + :py:obj:`~.cudaGraphInstantiateParams` is defined as: - Returns - ------- - cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDevice` + **View CUDA Toolkit Documentation for a C++ code example** - See Also - -------- - :py:obj:`~.cudaDeviceGetGraphMemAttribute`, :py:obj:`~.cudaGraphAddMemAllocNode`, :py:obj:`~.cudaGraphAddMemFreeNode`, :py:obj:`~.cudaDeviceGraphMemTrim`, :py:obj:`~.cudaMallocAsync`, :py:obj:`~.cudaFreeAsync` - """ - cdef ccudart.cudaGraphMemAttributeType cattr = attr.value - cdef utils.HelperCUgraphMem_attribute cvalue = utils.HelperCUgraphMem_attribute(attr, value, is_getter=False) - cdef void* cvalue_ptr = cvalue.cptr - err = ccudart.cudaDeviceSetGraphMemAttribute(device, cattr, cvalue_ptr) - return (cudaError_t(err),) -{{endif}} + The `flags` field controls the behavior of instantiation and subsequent + graph launches. Valid flags are: -{{if 'cudaGraphClone' in found_functions}} + - :py:obj:`~.cudaGraphInstantiateFlagAutoFreeOnLaunch`, which + configures a graph containing memory allocation nodes to + automatically free any unfreed memory allocations before the graph is + relaunched. -@cython.embedsignature(True) -def cudaGraphClone(originalGraph): - """ Clones a graph. + - :py:obj:`~.cudaGraphInstantiateFlagUpload`, which will perform an + upload of the graph into `uploadStream` once the graph has been + instantiated. - This function creates a copy of `originalGraph` and returns it in - `pGraphClone`. All parameters are copied into the cloned graph. The - original graph may be modified after this call without affecting the - clone. + - :py:obj:`~.cudaGraphInstantiateFlagDeviceLaunch`, which configures + the graph for launch from the device. If this flag is passed, the + executable graph handle returned can be used to launch the graph from + both the host and device. This flag can only be used on platforms + which support unified addressing. This flag cannot be used in + conjunction with + :py:obj:`~.cudaGraphInstantiateFlagAutoFreeOnLaunch`. - Child graph nodes in the original graph are recursively copied into the - clone. + - :py:obj:`~.cudaGraphInstantiateFlagUseNodePriority`, which causes the + graph to use the priorities from the per-node attributes rather than + the priority of the launch stream during execution. Note that + priorities are only available on kernel nodes, and are copied from + stream priority during stream capture. - Parameters - ---------- - originalGraph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` - Graph to clone + If `graph` contains any allocation or free nodes, there can be at most + one executable graph in existence for that graph at a time. An attempt + to instantiate a second executable graph before destroying the first + with :py:obj:`~.cudaGraphExecDestroy` will result in an error. The same + also applies if `graph` contains any device-updatable kernel nodes. - Returns - ------- - cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorMemoryAllocation` - pGraphClone : :py:obj:`~.cudaGraph_t` - Returns newly created cloned graph + If `graph` contains kernels which call device-side + :py:obj:`~.cudaGraphLaunch()` from multiple devices, this will result + in an error. - See Also - -------- - :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphNodeFindInClone` - """ - cdef ccudart.cudaGraph_t coriginalGraph - if originalGraph is None: - coriginalGraph = 0 - elif isinstance(originalGraph, (cudaGraph_t,cuda.CUgraph)): - poriginalGraph = int(originalGraph) - coriginalGraph = poriginalGraph - else: - poriginalGraph = int(cudaGraph_t(originalGraph)) - coriginalGraph = poriginalGraph - cdef cudaGraph_t pGraphClone = cudaGraph_t() - err = ccudart.cudaGraphClone(pGraphClone._ptr, coriginalGraph) - return (cudaError_t(err), pGraphClone) -{{endif}} + Graphs instantiated for launch on the device have additional + restrictions which do not apply to host graphs: -{{if 'cudaGraphNodeFindInClone' in found_functions}} + - The graph's nodes must reside on a single device. -@cython.embedsignature(True) -def cudaGraphNodeFindInClone(originalNode, clonedGraph): - """ Finds a cloned version of a node. + - The graph can only contain kernel nodes, memcpy nodes, memset nodes, + and child graph nodes. - This function returns the node in `clonedGraph` corresponding to - `originalNode` in the original graph. + - The graph cannot be empty and must contain at least one kernel, + memcpy, or memset node. Operation-specific restrictions are outlined + below. - `clonedGraph` must have been cloned from `originalGraph` via - :py:obj:`~.cudaGraphClone`. `originalNode` must have been in - `originalGraph` at the time of the call to :py:obj:`~.cudaGraphClone`, - and the corresponding cloned node in `clonedGraph` must not have been - removed. The cloned node is then returned via `pClonedNode`. + - Kernel nodes: - Parameters - ---------- - originalNode : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` - Handle to the original node - clonedGraph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` - Cloned graph to query + - Use of CUDA Dynamic Parallelism is not permitted. - Returns - ------- - cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` - pNode : :py:obj:`~.cudaGraphNode_t` - Returns handle to the cloned node + - Cooperative launches are permitted as long as MPS is not in use. - See Also - -------- - :py:obj:`~.cudaGraphClone` - """ - cdef ccudart.cudaGraph_t cclonedGraph - if clonedGraph is None: - cclonedGraph = 0 - elif isinstance(clonedGraph, (cudaGraph_t,cuda.CUgraph)): - pclonedGraph = int(clonedGraph) - cclonedGraph = pclonedGraph - else: - pclonedGraph = int(cudaGraph_t(clonedGraph)) - cclonedGraph = pclonedGraph - cdef ccudart.cudaGraphNode_t coriginalNode - if originalNode is None: - coriginalNode = 0 - elif isinstance(originalNode, (cudaGraphNode_t,cuda.CUgraphNode)): - poriginalNode = int(originalNode) - coriginalNode = poriginalNode - else: - poriginalNode = int(cudaGraphNode_t(originalNode)) - coriginalNode = poriginalNode - cdef cudaGraphNode_t pNode = cudaGraphNode_t() - err = ccudart.cudaGraphNodeFindInClone(pNode._ptr, coriginalNode, cclonedGraph) - return (cudaError_t(err), pNode) -{{endif}} + - Memcpy nodes: -{{if 'cudaGraphNodeGetType' in found_functions}} + - Only copies involving device memory and/or pinned device-mapped + host memory are permitted. -@cython.embedsignature(True) -def cudaGraphNodeGetType(node): - """ Returns a node's type. + - Copies involving CUDA arrays are not permitted. - Returns the node type of `node` in `pType`. + - Both operands must be accessible from the current device, and the + current device must match the device of other nodes in the graph. - Parameters - ---------- - node : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` - Node to query + In the event of an error, the `result_out` and `errNode_out` fields + will contain more information about the nature of the error. Possible + error reporting includes: - Returns - ------- - cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` - pType : :py:obj:`~.cudaGraphNodeType` - Pointer to return the node type + - :py:obj:`~.cudaGraphInstantiateError`, if passed an invalid value or + if an unexpected error occurred which is described by the return + value of the function. `errNode_out` will be set to NULL. - See Also - -------- - :py:obj:`~.cudaGraphGetNodes`, :py:obj:`~.cudaGraphGetRootNodes`, :py:obj:`~.cudaGraphChildGraphNodeGetGraph`, :py:obj:`~.cudaGraphKernelNodeGetParams`, :py:obj:`~.cudaGraphKernelNodeSetParams`, :py:obj:`~.cudaGraphHostNodeGetParams`, :py:obj:`~.cudaGraphHostNodeSetParams`, :py:obj:`~.cudaGraphMemcpyNodeGetParams`, :py:obj:`~.cudaGraphMemcpyNodeSetParams`, :py:obj:`~.cudaGraphMemsetNodeGetParams`, :py:obj:`~.cudaGraphMemsetNodeSetParams` - """ - cdef ccudart.cudaGraphNode_t cnode - if node is None: - cnode = 0 - elif isinstance(node, (cudaGraphNode_t,cuda.CUgraphNode)): - pnode = int(node) - cnode = pnode - else: - pnode = int(cudaGraphNode_t(node)) - cnode = pnode - cdef ccudart.cudaGraphNodeType pType - err = ccudart.cudaGraphNodeGetType(cnode, &pType) - return (cudaError_t(err), cudaGraphNodeType(pType)) -{{endif}} + - :py:obj:`~.cudaGraphInstantiateInvalidStructure`, if the graph + structure is invalid. `errNode_out` will be set to one of the + offending nodes. -{{if 'cudaGraphGetNodes' in found_functions}} + - :py:obj:`~.cudaGraphInstantiateNodeOperationNotSupported`, if the + graph is instantiated for device launch but contains a node of an + unsupported node type, or a node which performs unsupported + operations, such as use of CUDA dynamic parallelism within a kernel + node. `errNode_out` will be set to this node. -@cython.embedsignature(True) -def cudaGraphGetNodes(graph, size_t numNodes = 0): - """ Returns a graph's nodes. + - :py:obj:`~.cudaGraphInstantiateMultipleDevicesNotSupported`, if the + graph is instantiated for device launch but a node’s device differs + from that of another node. This error can also be returned if a graph + is not instantiated for device launch and it contains kernels which + call device-side :py:obj:`~.cudaGraphLaunch()` from multiple devices. + `errNode_out` will be set to this node. - Returns a list of `graph's` nodes. `nodes` may be NULL, in which case - this function will return the number of nodes in `numNodes`. Otherwise, - `numNodes` entries will be filled in. If `numNodes` is higher than the - actual number of nodes, the remaining entries in `nodes` will be set to - NULL, and the number of nodes actually obtained will be returned in - `numNodes`. + If instantiation is successful, `result_out` will be set to + :py:obj:`~.cudaGraphInstantiateSuccess`, and `hErrNode_out` will be set + to NULL. Parameters ---------- graph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` - Graph to query - numNodes : int - See description + Graph to instantiate + instantiateParams : :py:obj:`~.cudaGraphInstantiateParams` + Instantiation parameters Returns ------- cudaError_t :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` - nodes : List[:py:obj:`~.cudaGraphNode_t`] - Pointer to return the nodes - numNodes : int - See description + pGraphExec : :py:obj:`~.cudaGraphExec_t` + Returns instantiated graph See Also -------- - :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphGetRootNodes`, :py:obj:`~.cudaGraphGetEdges`, :py:obj:`~.cudaGraphNodeGetType`, :py:obj:`~.cudaGraphNodeGetDependencies`, :py:obj:`~.cudaGraphNodeGetDependentNodes` + :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphInstantiate`, :py:obj:`~.cudaGraphInstantiateWithFlags`, :py:obj:`~.cudaGraphExecDestroy` """ - cdef size_t _graph_length = numNodes - cdef ccudart.cudaGraph_t cgraph + cdef cyruntime.cudaGraph_t cygraph if graph is None: - cgraph = 0 - elif isinstance(graph, (cudaGraph_t,cuda.CUgraph)): + pgraph = 0 + elif isinstance(graph, (cudaGraph_t,driver.CUgraph)): pgraph = int(graph) - cgraph = pgraph else: pgraph = int(cudaGraph_t(graph)) - cgraph = pgraph - cdef ccudart.cudaGraphNode_t* cnodes = NULL - pynodes = [] - if _graph_length != 0: - cnodes = calloc(_graph_length, sizeof(ccudart.cudaGraphNode_t)) - if cnodes is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(_graph_length) + 'x' + str(sizeof(ccudart.cudaGraphNode_t))) - err = ccudart.cudaGraphGetNodes(cgraph, cnodes, &numNodes) - if cudaError_t(err) == cudaError_t(0): - pynodes = [cudaGraphNode_t(init_value=cnodes[idx]) for idx in range(_graph_length)] - if cnodes is not NULL: - free(cnodes) - return (cudaError_t(err), pynodes, numNodes) -{{endif}} - -{{if 'cudaGraphGetRootNodes' in found_functions}} + cygraph = pgraph + cdef cudaGraphExec_t pGraphExec = cudaGraphExec_t() + cdef cyruntime.cudaGraphInstantiateParams* cyinstantiateParams_ptr = instantiateParams._pvt_ptr if instantiateParams is not None else NULL + with nogil: + err = cyruntime.cudaGraphInstantiateWithParams(pGraphExec._pvt_ptr, cygraph, cyinstantiateParams_ptr) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, pGraphExec) @cython.embedsignature(True) -def cudaGraphGetRootNodes(graph, size_t pNumRootNodes = 0): - """ Returns a graph's root nodes. +def cudaGraphExecGetFlags(graphExec): + """ Query the instantiation flags of an executable graph. - Returns a list of `graph's` root nodes. `pRootNodes` may be NULL, in - which case this function will return the number of root nodes in - `pNumRootNodes`. Otherwise, `pNumRootNodes` entries will be filled in. - If `pNumRootNodes` is higher than the actual number of root nodes, the - remaining entries in `pRootNodes` will be set to NULL, and the number - of nodes actually obtained will be returned in `pNumRootNodes`. + Returns the flags that were passed to instantiation for the given + executable graph. :py:obj:`~.cudaGraphInstantiateFlagUpload` will not + be returned by this API as it does not affect the resulting executable + graph. Parameters ---------- - graph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` - Graph to query - pNumRootNodes : int - See description + graphExec : :py:obj:`~.CUgraphExec` or :py:obj:`~.cudaGraphExec_t` + The executable graph to query Returns ------- cudaError_t :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` - pRootNodes : List[:py:obj:`~.cudaGraphNode_t`] - Pointer to return the root nodes - pNumRootNodes : int - See description + flags : unsigned long long + Returns the instantiation flags See Also -------- - :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphGetNodes`, :py:obj:`~.cudaGraphGetEdges`, :py:obj:`~.cudaGraphNodeGetType`, :py:obj:`~.cudaGraphNodeGetDependencies`, :py:obj:`~.cudaGraphNodeGetDependentNodes` + :py:obj:`~.cudaGraphInstantiate`, :py:obj:`~.cudaGraphInstantiateWithFlags`, :py:obj:`~.cudaGraphInstantiateWithParams` """ - cdef size_t _graph_length = pNumRootNodes - cdef ccudart.cudaGraph_t cgraph - if graph is None: - cgraph = 0 - elif isinstance(graph, (cudaGraph_t,cuda.CUgraph)): - pgraph = int(graph) - cgraph = pgraph + cdef cyruntime.cudaGraphExec_t cygraphExec + if graphExec is None: + pgraphExec = 0 + elif isinstance(graphExec, (cudaGraphExec_t,driver.CUgraphExec)): + pgraphExec = int(graphExec) else: - pgraph = int(cudaGraph_t(graph)) - cgraph = pgraph - cdef ccudart.cudaGraphNode_t* cpRootNodes = NULL - pypRootNodes = [] - if _graph_length != 0: - cpRootNodes = calloc(_graph_length, sizeof(ccudart.cudaGraphNode_t)) - if cpRootNodes is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(_graph_length) + 'x' + str(sizeof(ccudart.cudaGraphNode_t))) - err = ccudart.cudaGraphGetRootNodes(cgraph, cpRootNodes, &pNumRootNodes) - if cudaError_t(err) == cudaError_t(0): - pypRootNodes = [cudaGraphNode_t(init_value=cpRootNodes[idx]) for idx in range(_graph_length)] - if cpRootNodes is not NULL: - free(cpRootNodes) - return (cudaError_t(err), pypRootNodes, pNumRootNodes) -{{endif}} - -{{if 'cudaGraphGetEdges' in found_functions}} + pgraphExec = int(cudaGraphExec_t(graphExec)) + cygraphExec = pgraphExec + cdef unsigned long long flags = 0 + with nogil: + err = cyruntime.cudaGraphExecGetFlags(cygraphExec, &flags) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, flags) @cython.embedsignature(True) -def cudaGraphGetEdges(graph, size_t numEdges = 0): - """ Returns a graph's dependency edges. +def cudaGraphExecKernelNodeSetParams(hGraphExec, node, pNodeParams : Optional[cudaKernelNodeParams]): + """ Sets the parameters for a kernel node in the given graphExec. - Returns a list of `graph's` dependency edges. Edges are returned via - corresponding indices in `from` and `to`; that is, the node in `to`[i] - has a dependency on the node in `from`[i]. `from` and `to` may both be - NULL, in which case this function only returns the number of edges in - `numEdges`. Otherwise, `numEdges` entries will be filled in. If - `numEdges` is higher than the actual number of edges, the remaining - entries in `from` and `to` will be set to NULL, and the number of edges - actually returned will be written to `numEdges`. + Sets the parameters of a kernel node in an executable graph + `hGraphExec`. The node is identified by the corresponding node `node` + in the non-executable graph, from which the executable graph was + instantiated. + + `node` must not have been removed from the original graph. All + `nodeParams` fields may change, but the following restrictions apply to + `func` updates: + + - The owning device of the function cannot change. + + - A node whose function originally did not use CUDA dynamic parallelism + cannot be updated to a function which uses CDP + + - A node whose function originally did not make device-side update + calls cannot be updated to a function which makes device-side update + calls. + + - If `hGraphExec` was not instantiated for device launch, a node whose + function originally did not use device-side + :py:obj:`~.cudaGraphLaunch()` cannot be updated to a function which + uses device-side :py:obj:`~.cudaGraphLaunch()` unless the node + resides on the same device as nodes which contained such calls at + instantiate-time. If no such calls were present at instantiation, + these updates cannot be performed at all. + + The modifications only affect future launches of `hGraphExec`. Already + enqueued or running launches of `hGraphExec` are not affected by this + call. `node` is also not modified by this call. + + If `node` is a device-updatable kernel node, the next upload/launch of + `hGraphExec` will overwrite any previous device-side updates. + Additionally, applying host updates to a device-updatable kernel node + while it is being updated from the device will result in undefined + behavior. Parameters ---------- - graph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` - Graph to get the edges from - numEdges : int - See description + hGraphExec : :py:obj:`~.CUgraphExec` or :py:obj:`~.cudaGraphExec_t` + The executable graph in which to set the specified node + node : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` + kernel node from the graph from which graphExec was instantiated + pNodeParams : :py:obj:`~.cudaKernelNodeParams` + Updated Parameters to set Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` - from : List[:py:obj:`~.cudaGraphNode_t`] - Location to return edge endpoints - to : List[:py:obj:`~.cudaGraphNode_t`] - Location to return edge endpoints - numEdges : int - See description + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, See Also -------- - :py:obj:`~.cudaGraphGetNodes`, :py:obj:`~.cudaGraphGetRootNodes`, :py:obj:`~.cudaGraphAddDependencies`, :py:obj:`~.cudaGraphRemoveDependencies`, :py:obj:`~.cudaGraphNodeGetDependencies`, :py:obj:`~.cudaGraphNodeGetDependentNodes` + :py:obj:`~.cudaGraphExecNodeSetParams`, :py:obj:`~.cudaGraphAddKernelNode`, :py:obj:`~.cudaGraphKernelNodeSetParams`, :py:obj:`~.cudaGraphExecMemcpyNodeSetParams`, :py:obj:`~.cudaGraphExecMemsetNodeSetParams`, :py:obj:`~.cudaGraphExecHostNodeSetParams`, :py:obj:`~.cudaGraphExecChildGraphNodeSetParams`, :py:obj:`~.cudaGraphExecEventRecordNodeSetEvent`, :py:obj:`~.cudaGraphExecEventWaitNodeSetEvent`, :py:obj:`~.cudaGraphExecExternalSemaphoresSignalNodeSetParams`, :py:obj:`~.cudaGraphExecExternalSemaphoresWaitNodeSetParams`, :py:obj:`~.cudaGraphExecUpdate`, :py:obj:`~.cudaGraphInstantiate` """ - cdef size_t _graph_length = numEdges - cdef ccudart.cudaGraph_t cgraph - if graph is None: - cgraph = 0 - elif isinstance(graph, (cudaGraph_t,cuda.CUgraph)): - pgraph = int(graph) - cgraph = pgraph + cdef cyruntime.cudaGraphNode_t cynode + if node is None: + pnode = 0 + elif isinstance(node, (cudaGraphNode_t,driver.CUgraphNode)): + pnode = int(node) else: - pgraph = int(cudaGraph_t(graph)) - cgraph = pgraph - cdef ccudart.cudaGraphNode_t* cfrom_ = NULL - pyfrom_ = [] - if _graph_length != 0: - cfrom_ = calloc(_graph_length, sizeof(ccudart.cudaGraphNode_t)) - if cfrom_ is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(_graph_length) + 'x' + str(sizeof(ccudart.cudaGraphNode_t))) - cdef ccudart.cudaGraphNode_t* cto = NULL - pyto = [] - if _graph_length != 0: - cto = calloc(_graph_length, sizeof(ccudart.cudaGraphNode_t)) - if cto is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(_graph_length) + 'x' + str(sizeof(ccudart.cudaGraphNode_t))) - err = ccudart.cudaGraphGetEdges(cgraph, cfrom_, cto, &numEdges) - if cudaError_t(err) == cudaError_t(0): - pyfrom_ = [cudaGraphNode_t(init_value=cfrom_[idx]) for idx in range(_graph_length)] - if cfrom_ is not NULL: - free(cfrom_) - if cudaError_t(err) == cudaError_t(0): - pyto = [cudaGraphNode_t(init_value=cto[idx]) for idx in range(_graph_length)] - if cto is not NULL: - free(cto) - return (cudaError_t(err), pyfrom_, pyto, numEdges) -{{endif}} - -{{if 'cudaGraphGetEdges_v2' in found_functions}} + pnode = int(cudaGraphNode_t(node)) + cynode = pnode + cdef cyruntime.cudaGraphExec_t cyhGraphExec + if hGraphExec is None: + phGraphExec = 0 + elif isinstance(hGraphExec, (cudaGraphExec_t,driver.CUgraphExec)): + phGraphExec = int(hGraphExec) + else: + phGraphExec = int(cudaGraphExec_t(hGraphExec)) + cyhGraphExec = phGraphExec + cdef cyruntime.cudaKernelNodeParams* cypNodeParams_ptr = pNodeParams._pvt_ptr if pNodeParams is not None else NULL + with nogil: + err = cyruntime.cudaGraphExecKernelNodeSetParams(cyhGraphExec, cynode, cypNodeParams_ptr) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaGraphGetEdges_v2(graph, size_t numEdges = 0): - """ Returns a graph's dependency edges (12.3+) +def cudaGraphExecMemcpyNodeSetParams(hGraphExec, node, pNodeParams : Optional[cudaMemcpy3DParms]): + """ Sets the parameters for a memcpy node in the given graphExec. - Returns a list of `graph's` dependency edges. Edges are returned via - corresponding indices in `from`, `to` and `edgeData`; that is, the node - in `to`[i] has a dependency on the node in `from`[i] with data - `edgeData`[i]. `from` and `to` may both be NULL, in which case this - function only returns the number of edges in `numEdges`. Otherwise, - `numEdges` entries will be filled in. If `numEdges` is higher than the - actual number of edges, the remaining entries in `from` and `to` will - be set to NULL, and the number of edges actually returned will be - written to `numEdges`. `edgeData` may alone be NULL, in which case the - edges must all have default (zeroed) edge data. Attempting a losst - query via NULL `edgeData` will result in - :py:obj:`~.cudaErrorLossyQuery`. If `edgeData` is non-NULL then `from` - and `to` must be as well. + Updates the work represented by `node` in `hGraphExec` as though `node` + had contained `pNodeParams` at instantiation. `node` must remain in the + graph which was used to instantiate `hGraphExec`. Changed edges to and + from `node` are ignored. + + The source and destination memory in `pNodeParams` must be allocated + from the same contexts as the original source and destination memory. + Both the instantiation-time memory operands and the memory operands in + `pNodeParams` must be 1-dimensional. Zero-length operations are not + supported. + + The modifications only affect future launches of `hGraphExec`. Already + enqueued or running launches of `hGraphExec` are not affected by this + call. `node` is also not modified by this call. + + Returns :py:obj:`~.cudaErrorInvalidValue` if the memory operands' + mappings changed or either the original or new memory operands are + multidimensional. Parameters ---------- - graph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` - Graph to get the edges from - numEdges : int - See description + hGraphExec : :py:obj:`~.CUgraphExec` or :py:obj:`~.cudaGraphExec_t` + The executable graph in which to set the specified node + node : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` + Memcpy node from the graph which was used to instantiate graphExec + pNodeParams : :py:obj:`~.cudaMemcpy3DParms` + Updated Parameters to set Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorLossyQuery`, :py:obj:`~.cudaErrorInvalidValue` - from : List[:py:obj:`~.cudaGraphNode_t`] - Location to return edge endpoints - to : List[:py:obj:`~.cudaGraphNode_t`] - Location to return edge endpoints - edgeData : List[:py:obj:`~.cudaGraphEdgeData`] - Optional location to return edge data - numEdges : int - See description + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, See Also -------- - :py:obj:`~.cudaGraphGetNodes`, :py:obj:`~.cudaGraphGetRootNodes`, :py:obj:`~.cudaGraphAddDependencies`, :py:obj:`~.cudaGraphRemoveDependencies`, :py:obj:`~.cudaGraphNodeGetDependencies`, :py:obj:`~.cudaGraphNodeGetDependentNodes` + :py:obj:`~.cudaGraphExecNodeSetParams`, :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphMemcpyNodeSetParams`, :py:obj:`~.cudaGraphExecMemcpyNodeSetParamsToSymbol`, :py:obj:`~.cudaGraphExecMemcpyNodeSetParamsFromSymbol`, :py:obj:`~.cudaGraphExecMemcpyNodeSetParams1D`, :py:obj:`~.cudaGraphExecKernelNodeSetParams`, :py:obj:`~.cudaGraphExecMemsetNodeSetParams`, :py:obj:`~.cudaGraphExecHostNodeSetParams`, :py:obj:`~.cudaGraphExecChildGraphNodeSetParams`, :py:obj:`~.cudaGraphExecEventRecordNodeSetEvent`, :py:obj:`~.cudaGraphExecEventWaitNodeSetEvent`, :py:obj:`~.cudaGraphExecExternalSemaphoresSignalNodeSetParams`, :py:obj:`~.cudaGraphExecExternalSemaphoresWaitNodeSetParams`, :py:obj:`~.cudaGraphExecUpdate`, :py:obj:`~.cudaGraphInstantiate` """ - cdef size_t _graph_length = numEdges - cdef ccudart.cudaGraph_t cgraph - if graph is None: - cgraph = 0 - elif isinstance(graph, (cudaGraph_t,cuda.CUgraph)): - pgraph = int(graph) - cgraph = pgraph + cdef cyruntime.cudaGraphNode_t cynode + if node is None: + pnode = 0 + elif isinstance(node, (cudaGraphNode_t,driver.CUgraphNode)): + pnode = int(node) else: - pgraph = int(cudaGraph_t(graph)) - cgraph = pgraph - cdef ccudart.cudaGraphNode_t* cfrom_ = NULL - pyfrom_ = [] - if _graph_length != 0: - cfrom_ = calloc(_graph_length, sizeof(ccudart.cudaGraphNode_t)) - if cfrom_ is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(_graph_length) + 'x' + str(sizeof(ccudart.cudaGraphNode_t))) - cdef ccudart.cudaGraphNode_t* cto = NULL - pyto = [] - if _graph_length != 0: - cto = calloc(_graph_length, sizeof(ccudart.cudaGraphNode_t)) - if cto is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(_graph_length) + 'x' + str(sizeof(ccudart.cudaGraphNode_t))) - cdef ccudart.cudaGraphEdgeData* cedgeData = NULL - pyedgeData = [] - if _graph_length != 0: - cedgeData = calloc(_graph_length, sizeof(ccudart.cudaGraphEdgeData)) - if cedgeData is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(_graph_length) + 'x' + str(sizeof(ccudart.cudaGraphEdgeData))) - err = ccudart.cudaGraphGetEdges_v2(cgraph, cfrom_, cto, cedgeData, &numEdges) - if cudaError_t(err) == cudaError_t(0): - pyfrom_ = [cudaGraphNode_t(init_value=cfrom_[idx]) for idx in range(_graph_length)] - if cfrom_ is not NULL: - free(cfrom_) - if cudaError_t(err) == cudaError_t(0): - pyto = [cudaGraphNode_t(init_value=cto[idx]) for idx in range(_graph_length)] - if cto is not NULL: - free(cto) - if cudaError_t(err) == cudaError_t(0): - pyedgeData = [cudaGraphEdgeData(_ptr=&cedgeData[idx]) for idx in range(_graph_length)] - if cedgeData is not NULL: - free(cedgeData) - return (cudaError_t(err), pyfrom_, pyto, pyedgeData, numEdges) -{{endif}} - -{{if 'cudaGraphNodeGetDependencies' in found_functions}} + pnode = int(cudaGraphNode_t(node)) + cynode = pnode + cdef cyruntime.cudaGraphExec_t cyhGraphExec + if hGraphExec is None: + phGraphExec = 0 + elif isinstance(hGraphExec, (cudaGraphExec_t,driver.CUgraphExec)): + phGraphExec = int(hGraphExec) + else: + phGraphExec = int(cudaGraphExec_t(hGraphExec)) + cyhGraphExec = phGraphExec + cdef cyruntime.cudaMemcpy3DParms* cypNodeParams_ptr = pNodeParams._pvt_ptr if pNodeParams is not None else NULL + with nogil: + err = cyruntime.cudaGraphExecMemcpyNodeSetParams(cyhGraphExec, cynode, cypNodeParams_ptr) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaGraphNodeGetDependencies(node, size_t pNumDependencies = 0): - """ Returns a node's dependencies. +def cudaGraphExecMemcpyNodeSetParams1D(hGraphExec, node, dst, src, size_t count, kind not None : cudaMemcpyKind): + """ Sets the parameters for a memcpy node in the given graphExec to perform a 1-dimensional copy. - Returns a list of `node's` dependencies. `pDependencies` may be NULL, - in which case this function will return the number of dependencies in - `pNumDependencies`. Otherwise, `pNumDependencies` entries will be - filled in. If `pNumDependencies` is higher than the actual number of - dependencies, the remaining entries in `pDependencies` will be set to - NULL, and the number of nodes actually obtained will be returned in - `pNumDependencies`. + Updates the work represented by `node` in `hGraphExec` as though `node` + had contained the given params at instantiation. `node` must remain in + the graph which was used to instantiate `hGraphExec`. Changed edges to + and from `node` are ignored. + + `src` and `dst` must be allocated from the same contexts as the + original source and destination memory. The instantiation-time memory + operands must be 1-dimensional. Zero-length operations are not + supported. + + The modifications only affect future launches of `hGraphExec`. Already + enqueued or running launches of `hGraphExec` are not affected by this + call. `node` is also not modified by this call. + + Returns :py:obj:`~.cudaErrorInvalidValue` if the memory operands' + mappings changed or the original memory operands are multidimensional. Parameters ---------- + hGraphExec : :py:obj:`~.CUgraphExec` or :py:obj:`~.cudaGraphExec_t` + The executable graph in which to set the specified node node : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` - Node to query - pNumDependencies : int - See description + Memcpy node from the graph which was used to instantiate graphExec + dst : Any + Destination memory address + src : Any + Source memory address + count : size_t + Size in bytes to copy + kind : :py:obj:`~.cudaMemcpyKind` + Type of transfer Returns ------- cudaError_t :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` - pDependencies : List[:py:obj:`~.cudaGraphNode_t`] - Pointer to return the dependencies - pNumDependencies : int - See description See Also -------- - :py:obj:`~.cudaGraphNodeGetDependentNodes`, :py:obj:`~.cudaGraphGetNodes`, :py:obj:`~.cudaGraphGetRootNodes`, :py:obj:`~.cudaGraphGetEdges`, :py:obj:`~.cudaGraphAddDependencies`, :py:obj:`~.cudaGraphRemoveDependencies` + :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphAddMemcpyNode1D`, :py:obj:`~.cudaGraphMemcpyNodeSetParams`, :py:obj:`~.cudaGraphMemcpyNodeSetParams1D`, :py:obj:`~.cudaGraphExecMemcpyNodeSetParams`, :py:obj:`~.cudaGraphExecKernelNodeSetParams`, :py:obj:`~.cudaGraphExecMemsetNodeSetParams`, :py:obj:`~.cudaGraphExecHostNodeSetParams`, :py:obj:`~.cudaGraphExecChildGraphNodeSetParams`, :py:obj:`~.cudaGraphExecEventRecordNodeSetEvent`, :py:obj:`~.cudaGraphExecEventWaitNodeSetEvent`, :py:obj:`~.cudaGraphExecExternalSemaphoresSignalNodeSetParams`, :py:obj:`~.cudaGraphExecExternalSemaphoresWaitNodeSetParams`, :py:obj:`~.cudaGraphExecUpdate`, :py:obj:`~.cudaGraphInstantiate` """ - cdef size_t _graph_length = pNumDependencies - cdef ccudart.cudaGraphNode_t cnode + cdef cyruntime.cudaGraphNode_t cynode if node is None: - cnode = 0 - elif isinstance(node, (cudaGraphNode_t,cuda.CUgraphNode)): + pnode = 0 + elif isinstance(node, (cudaGraphNode_t,driver.CUgraphNode)): pnode = int(node) - cnode = pnode else: pnode = int(cudaGraphNode_t(node)) - cnode = pnode - cdef ccudart.cudaGraphNode_t* cpDependencies = NULL - pypDependencies = [] - if _graph_length != 0: - cpDependencies = calloc(_graph_length, sizeof(ccudart.cudaGraphNode_t)) - if cpDependencies is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(_graph_length) + 'x' + str(sizeof(ccudart.cudaGraphNode_t))) - err = ccudart.cudaGraphNodeGetDependencies(cnode, cpDependencies, &pNumDependencies) - if cudaError_t(err) == cudaError_t(0): - pypDependencies = [cudaGraphNode_t(init_value=cpDependencies[idx]) for idx in range(_graph_length)] - if cpDependencies is not NULL: - free(cpDependencies) - return (cudaError_t(err), pypDependencies, pNumDependencies) -{{endif}} - -{{if 'cudaGraphNodeGetDependencies_v2' in found_functions}} + cynode = pnode + cdef cyruntime.cudaGraphExec_t cyhGraphExec + if hGraphExec is None: + phGraphExec = 0 + elif isinstance(hGraphExec, (cudaGraphExec_t,driver.CUgraphExec)): + phGraphExec = int(hGraphExec) + else: + phGraphExec = int(cudaGraphExec_t(hGraphExec)) + cyhGraphExec = phGraphExec + cdef _HelperInputVoidPtrStruct cydstHelper + cdef void* cydst = _helper_input_void_ptr(dst, &cydstHelper) + cdef _HelperInputVoidPtrStruct cysrcHelper + cdef void* cysrc = _helper_input_void_ptr(src, &cysrcHelper) + cdef cyruntime.cudaMemcpyKind cykind = int(kind) + with nogil: + err = cyruntime.cudaGraphExecMemcpyNodeSetParams1D(cyhGraphExec, cynode, cydst, cysrc, count, cykind) + _helper_input_void_ptr_free(&cydstHelper) + _helper_input_void_ptr_free(&cysrcHelper) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaGraphNodeGetDependencies_v2(node, size_t pNumDependencies = 0): - """ Returns a node's dependencies (12.3+) +def cudaGraphExecMemsetNodeSetParams(hGraphExec, node, pNodeParams : Optional[cudaMemsetParams]): + """ Sets the parameters for a memset node in the given graphExec. - Returns a list of `node's` dependencies. `pDependencies` may be NULL, - in which case this function will return the number of dependencies in - `pNumDependencies`. Otherwise, `pNumDependencies` entries will be - filled in. If `pNumDependencies` is higher than the actual number of - dependencies, the remaining entries in `pDependencies` will be set to - NULL, and the number of nodes actually obtained will be returned in - `pNumDependencies`. + Updates the work represented by `node` in `hGraphExec` as though `node` + had contained `pNodeParams` at instantiation. `node` must remain in the + graph which was used to instantiate `hGraphExec`. Changed edges to and + from `node` are ignored. - Note that if an edge has non-zero (non-default) edge data and - `edgeData` is NULL, this API will return - :py:obj:`~.cudaErrorLossyQuery`. If `edgeData` is non-NULL, then - `pDependencies` must be as well. + Zero sized operations are not supported. + + The new destination pointer in `pNodeParams` must be to the same kind + of allocation as the original destination pointer and have the same + context association and device mapping as the original destination + pointer. + + Both the value and pointer address may be updated. Changing other + aspects of the memset (width, height, element size or pitch) may cause + the update to be rejected. Specifically, for 2d memsets, all dimension + changes are rejected. For 1d memsets, changes in height are explicitly + rejected and other changes are opportunistically allowed if the + resulting work maps onto the work resources already allocated for the + node. + + The modifications only affect future launches of `hGraphExec`. Already + enqueued or running launches of `hGraphExec` are not affected by this + call. `node` is also not modified by this call. Parameters ---------- + hGraphExec : :py:obj:`~.CUgraphExec` or :py:obj:`~.cudaGraphExec_t` + The executable graph in which to set the specified node node : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` - Node to query - pNumDependencies : int - See description + Memset node from the graph which was used to instantiate graphExec + pNodeParams : :py:obj:`~.cudaMemsetParams` + Updated Parameters to set Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorLossyQuery`, :py:obj:`~.cudaErrorInvalidValue` - pDependencies : List[:py:obj:`~.cudaGraphNode_t`] - Pointer to return the dependencies - edgeData : List[:py:obj:`~.cudaGraphEdgeData`] - Optional array to return edge data for each dependency - pNumDependencies : int - See description + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, See Also -------- - :py:obj:`~.cudaGraphNodeGetDependentNodes`, :py:obj:`~.cudaGraphGetNodes`, :py:obj:`~.cudaGraphGetRootNodes`, :py:obj:`~.cudaGraphGetEdges`, :py:obj:`~.cudaGraphAddDependencies`, :py:obj:`~.cudaGraphRemoveDependencies` + :py:obj:`~.cudaGraphExecNodeSetParams`, :py:obj:`~.cudaGraphAddMemsetNode`, :py:obj:`~.cudaGraphMemsetNodeSetParams`, :py:obj:`~.cudaGraphExecKernelNodeSetParams`, :py:obj:`~.cudaGraphExecMemcpyNodeSetParams`, :py:obj:`~.cudaGraphExecHostNodeSetParams`, :py:obj:`~.cudaGraphExecChildGraphNodeSetParams`, :py:obj:`~.cudaGraphExecEventRecordNodeSetEvent`, :py:obj:`~.cudaGraphExecEventWaitNodeSetEvent`, :py:obj:`~.cudaGraphExecExternalSemaphoresSignalNodeSetParams`, :py:obj:`~.cudaGraphExecExternalSemaphoresWaitNodeSetParams`, :py:obj:`~.cudaGraphExecUpdate`, :py:obj:`~.cudaGraphInstantiate` """ - cdef size_t _graph_length = pNumDependencies - cdef ccudart.cudaGraphNode_t cnode + cdef cyruntime.cudaGraphNode_t cynode if node is None: - cnode = 0 - elif isinstance(node, (cudaGraphNode_t,cuda.CUgraphNode)): + pnode = 0 + elif isinstance(node, (cudaGraphNode_t,driver.CUgraphNode)): pnode = int(node) - cnode = pnode else: pnode = int(cudaGraphNode_t(node)) - cnode = pnode - cdef ccudart.cudaGraphNode_t* cpDependencies = NULL - pypDependencies = [] - if _graph_length != 0: - cpDependencies = calloc(_graph_length, sizeof(ccudart.cudaGraphNode_t)) - if cpDependencies is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(_graph_length) + 'x' + str(sizeof(ccudart.cudaGraphNode_t))) - cdef ccudart.cudaGraphEdgeData* cedgeData = NULL - pyedgeData = [] - if _graph_length != 0: - cedgeData = calloc(_graph_length, sizeof(ccudart.cudaGraphEdgeData)) - if cedgeData is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(_graph_length) + 'x' + str(sizeof(ccudart.cudaGraphEdgeData))) - err = ccudart.cudaGraphNodeGetDependencies_v2(cnode, cpDependencies, cedgeData, &pNumDependencies) - if cudaError_t(err) == cudaError_t(0): - pypDependencies = [cudaGraphNode_t(init_value=cpDependencies[idx]) for idx in range(_graph_length)] - if cpDependencies is not NULL: - free(cpDependencies) - if cudaError_t(err) == cudaError_t(0): - pyedgeData = [cudaGraphEdgeData(_ptr=&cedgeData[idx]) for idx in range(_graph_length)] - if cedgeData is not NULL: - free(cedgeData) - return (cudaError_t(err), pypDependencies, pyedgeData, pNumDependencies) -{{endif}} - -{{if 'cudaGraphNodeGetDependentNodes' in found_functions}} + cynode = pnode + cdef cyruntime.cudaGraphExec_t cyhGraphExec + if hGraphExec is None: + phGraphExec = 0 + elif isinstance(hGraphExec, (cudaGraphExec_t,driver.CUgraphExec)): + phGraphExec = int(hGraphExec) + else: + phGraphExec = int(cudaGraphExec_t(hGraphExec)) + cyhGraphExec = phGraphExec + cdef cyruntime.cudaMemsetParams* cypNodeParams_ptr = pNodeParams._pvt_ptr if pNodeParams is not None else NULL + with nogil: + err = cyruntime.cudaGraphExecMemsetNodeSetParams(cyhGraphExec, cynode, cypNodeParams_ptr) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaGraphNodeGetDependentNodes(node, size_t pNumDependentNodes = 0): - """ Returns a node's dependent nodes. +def cudaGraphExecHostNodeSetParams(hGraphExec, node, pNodeParams : Optional[cudaHostNodeParams]): + """ Sets the parameters for a host node in the given graphExec. - Returns a list of `node's` dependent nodes. `pDependentNodes` may be - NULL, in which case this function will return the number of dependent - nodes in `pNumDependentNodes`. Otherwise, `pNumDependentNodes` entries - will be filled in. If `pNumDependentNodes` is higher than the actual - number of dependent nodes, the remaining entries in `pDependentNodes` - will be set to NULL, and the number of nodes actually obtained will be - returned in `pNumDependentNodes`. + Updates the work represented by `node` in `hGraphExec` as though `node` + had contained `pNodeParams` at instantiation. `node` must remain in the + graph which was used to instantiate `hGraphExec`. Changed edges to and + from `node` are ignored. + + The modifications only affect future launches of `hGraphExec`. Already + enqueued or running launches of `hGraphExec` are not affected by this + call. `node` is also not modified by this call. Parameters ---------- + hGraphExec : :py:obj:`~.CUgraphExec` or :py:obj:`~.cudaGraphExec_t` + The executable graph in which to set the specified node node : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` - Node to query - pNumDependentNodes : int - See description + Host node from the graph which was used to instantiate graphExec + pNodeParams : :py:obj:`~.cudaHostNodeParams` + Updated Parameters to set Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` - pDependentNodes : List[:py:obj:`~.cudaGraphNode_t`] - Pointer to return the dependent nodes - pNumDependentNodes : int - See description + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, See Also -------- - :py:obj:`~.cudaGraphNodeGetDependencies`, :py:obj:`~.cudaGraphGetNodes`, :py:obj:`~.cudaGraphGetRootNodes`, :py:obj:`~.cudaGraphGetEdges`, :py:obj:`~.cudaGraphAddDependencies`, :py:obj:`~.cudaGraphRemoveDependencies` + :py:obj:`~.cudaGraphExecNodeSetParams`, :py:obj:`~.cudaGraphAddHostNode`, :py:obj:`~.cudaGraphHostNodeSetParams`, :py:obj:`~.cudaGraphExecKernelNodeSetParams`, :py:obj:`~.cudaGraphExecMemcpyNodeSetParams`, :py:obj:`~.cudaGraphExecMemsetNodeSetParams`, :py:obj:`~.cudaGraphExecChildGraphNodeSetParams`, :py:obj:`~.cudaGraphExecEventRecordNodeSetEvent`, :py:obj:`~.cudaGraphExecEventWaitNodeSetEvent`, :py:obj:`~.cudaGraphExecExternalSemaphoresSignalNodeSetParams`, :py:obj:`~.cudaGraphExecExternalSemaphoresWaitNodeSetParams`, :py:obj:`~.cudaGraphExecUpdate`, :py:obj:`~.cudaGraphInstantiate` """ - cdef size_t _graph_length = pNumDependentNodes - cdef ccudart.cudaGraphNode_t cnode + cdef cyruntime.cudaGraphNode_t cynode if node is None: - cnode = 0 - elif isinstance(node, (cudaGraphNode_t,cuda.CUgraphNode)): + pnode = 0 + elif isinstance(node, (cudaGraphNode_t,driver.CUgraphNode)): pnode = int(node) - cnode = pnode else: pnode = int(cudaGraphNode_t(node)) - cnode = pnode - cdef ccudart.cudaGraphNode_t* cpDependentNodes = NULL - pypDependentNodes = [] - if _graph_length != 0: - cpDependentNodes = calloc(_graph_length, sizeof(ccudart.cudaGraphNode_t)) - if cpDependentNodes is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(_graph_length) + 'x' + str(sizeof(ccudart.cudaGraphNode_t))) - err = ccudart.cudaGraphNodeGetDependentNodes(cnode, cpDependentNodes, &pNumDependentNodes) - if cudaError_t(err) == cudaError_t(0): - pypDependentNodes = [cudaGraphNode_t(init_value=cpDependentNodes[idx]) for idx in range(_graph_length)] - if cpDependentNodes is not NULL: - free(cpDependentNodes) - return (cudaError_t(err), pypDependentNodes, pNumDependentNodes) -{{endif}} - -{{if 'cudaGraphNodeGetDependentNodes_v2' in found_functions}} + cynode = pnode + cdef cyruntime.cudaGraphExec_t cyhGraphExec + if hGraphExec is None: + phGraphExec = 0 + elif isinstance(hGraphExec, (cudaGraphExec_t,driver.CUgraphExec)): + phGraphExec = int(hGraphExec) + else: + phGraphExec = int(cudaGraphExec_t(hGraphExec)) + cyhGraphExec = phGraphExec + cdef cyruntime.cudaHostNodeParams* cypNodeParams_ptr = pNodeParams._pvt_ptr if pNodeParams is not None else NULL + with nogil: + err = cyruntime.cudaGraphExecHostNodeSetParams(cyhGraphExec, cynode, cypNodeParams_ptr) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaGraphNodeGetDependentNodes_v2(node, size_t pNumDependentNodes = 0): - """ Returns a node's dependent nodes (12.3+) +def cudaGraphExecChildGraphNodeSetParams(hGraphExec, node, childGraph): + """ Updates node parameters in the child graph node in the given graphExec. - Returns a list of `node's` dependent nodes. `pDependentNodes` may be - NULL, in which case this function will return the number of dependent - nodes in `pNumDependentNodes`. Otherwise, `pNumDependentNodes` entries - will be filled in. If `pNumDependentNodes` is higher than the actual - number of dependent nodes, the remaining entries in `pDependentNodes` - will be set to NULL, and the number of nodes actually obtained will be - returned in `pNumDependentNodes`. + Updates the work represented by `node` in `hGraphExec` as though the + nodes contained in `node's` graph had the parameters contained in + `childGraph's` nodes at instantiation. `node` must remain in the graph + which was used to instantiate `hGraphExec`. Changed edges to and from + `node` are ignored. - Note that if an edge has non-zero (non-default) edge data and - `edgeData` is NULL, this API will return - :py:obj:`~.cudaErrorLossyQuery`. If `edgeData` is non-NULL, then - `pDependentNodes` must be as well. + The modifications only affect future launches of `hGraphExec`. Already + enqueued or running launches of `hGraphExec` are not affected by this + call. `node` is also not modified by this call. + + The topology of `childGraph`, as well as the node insertion order, must + match that of the graph contained in `node`. See + :py:obj:`~.cudaGraphExecUpdate()` for a list of restrictions on what + can be updated in an instantiated graph. The update is recursive, so + child graph nodes contained within the top level child graph will also + be updated. Parameters ---------- + hGraphExec : :py:obj:`~.CUgraphExec` or :py:obj:`~.cudaGraphExec_t` + The executable graph in which to set the specified node node : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` - Node to query - pNumDependentNodes : int - See description + Host node from the graph which was used to instantiate graphExec + childGraph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` + The graph supplying the updated parameters Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorLossyQuery`, :py:obj:`~.cudaErrorInvalidValue` - pDependentNodes : List[:py:obj:`~.cudaGraphNode_t`] - Pointer to return the dependent nodes - edgeData : List[:py:obj:`~.cudaGraphEdgeData`] - Optional pointer to return edge data for dependent nodes - pNumDependentNodes : int - See description + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, See Also -------- - :py:obj:`~.cudaGraphNodeGetDependencies`, :py:obj:`~.cudaGraphGetNodes`, :py:obj:`~.cudaGraphGetRootNodes`, :py:obj:`~.cudaGraphGetEdges`, :py:obj:`~.cudaGraphAddDependencies`, :py:obj:`~.cudaGraphRemoveDependencies` + :py:obj:`~.cudaGraphExecNodeSetParams`, :py:obj:`~.cudaGraphAddChildGraphNode`, :py:obj:`~.cudaGraphChildGraphNodeGetGraph`, :py:obj:`~.cudaGraphExecKernelNodeSetParams`, :py:obj:`~.cudaGraphExecMemcpyNodeSetParams`, :py:obj:`~.cudaGraphExecMemsetNodeSetParams`, :py:obj:`~.cudaGraphExecHostNodeSetParams`, :py:obj:`~.cudaGraphExecEventRecordNodeSetEvent`, :py:obj:`~.cudaGraphExecEventWaitNodeSetEvent`, :py:obj:`~.cudaGraphExecExternalSemaphoresSignalNodeSetParams`, :py:obj:`~.cudaGraphExecExternalSemaphoresWaitNodeSetParams`, :py:obj:`~.cudaGraphExecUpdate`, :py:obj:`~.cudaGraphInstantiate` """ - cdef size_t _graph_length = pNumDependentNodes - cdef ccudart.cudaGraphNode_t cnode + cdef cyruntime.cudaGraph_t cychildGraph + if childGraph is None: + pchildGraph = 0 + elif isinstance(childGraph, (cudaGraph_t,driver.CUgraph)): + pchildGraph = int(childGraph) + else: + pchildGraph = int(cudaGraph_t(childGraph)) + cychildGraph = pchildGraph + cdef cyruntime.cudaGraphNode_t cynode if node is None: - cnode = 0 - elif isinstance(node, (cudaGraphNode_t,cuda.CUgraphNode)): + pnode = 0 + elif isinstance(node, (cudaGraphNode_t,driver.CUgraphNode)): pnode = int(node) - cnode = pnode else: pnode = int(cudaGraphNode_t(node)) - cnode = pnode - cdef ccudart.cudaGraphNode_t* cpDependentNodes = NULL - pypDependentNodes = [] - if _graph_length != 0: - cpDependentNodes = calloc(_graph_length, sizeof(ccudart.cudaGraphNode_t)) - if cpDependentNodes is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(_graph_length) + 'x' + str(sizeof(ccudart.cudaGraphNode_t))) - cdef ccudart.cudaGraphEdgeData* cedgeData = NULL - pyedgeData = [] - if _graph_length != 0: - cedgeData = calloc(_graph_length, sizeof(ccudart.cudaGraphEdgeData)) - if cedgeData is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(_graph_length) + 'x' + str(sizeof(ccudart.cudaGraphEdgeData))) - err = ccudart.cudaGraphNodeGetDependentNodes_v2(cnode, cpDependentNodes, cedgeData, &pNumDependentNodes) - if cudaError_t(err) == cudaError_t(0): - pypDependentNodes = [cudaGraphNode_t(init_value=cpDependentNodes[idx]) for idx in range(_graph_length)] - if cpDependentNodes is not NULL: - free(cpDependentNodes) - if cudaError_t(err) == cudaError_t(0): - pyedgeData = [cudaGraphEdgeData(_ptr=&cedgeData[idx]) for idx in range(_graph_length)] - if cedgeData is not NULL: - free(cedgeData) - return (cudaError_t(err), pypDependentNodes, pyedgeData, pNumDependentNodes) -{{endif}} - -{{if 'cudaGraphAddDependencies' in found_functions}} - -@cython.embedsignature(True) -def cudaGraphAddDependencies(graph, from_ : Optional[List[cudaGraphNode_t]], to : Optional[List[cudaGraphNode_t]], size_t numDependencies): - """ Adds dependency edges to a graph. - - The number of dependencies to be added is defined by `numDependencies` - Elements in `pFrom` and `pTo` at corresponding indices define a - dependency. Each node in `pFrom` and `pTo` must belong to `graph`. - - If `numDependencies` is 0, elements in `pFrom` and `pTo` will be - ignored. Specifying an existing dependency will return an error. - - Parameters - ---------- - graph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` - Graph to which dependencies are added - from : List[:py:obj:`~.cudaGraphNode_t`] - Array of nodes that provide the dependencies - to : List[:py:obj:`~.cudaGraphNode_t`] - Array of dependent nodes - numDependencies : size_t - Number of dependencies to be added - - Returns - ------- - cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` - - See Also - -------- - :py:obj:`~.cudaGraphRemoveDependencies`, :py:obj:`~.cudaGraphGetEdges`, :py:obj:`~.cudaGraphNodeGetDependencies`, :py:obj:`~.cudaGraphNodeGetDependentNodes` - """ - to = [] if to is None else to - if not all(isinstance(_x, (cudaGraphNode_t,cuda.CUgraphNode)) for _x in to): - raise TypeError("Argument 'to' is not instance of type (expected List[ccudart.cudaGraphNode_t,cuda.CUgraphNode]") - from_ = [] if from_ is None else from_ - if not all(isinstance(_x, (cudaGraphNode_t,cuda.CUgraphNode)) for _x in from_): - raise TypeError("Argument 'from_' is not instance of type (expected List[ccudart.cudaGraphNode_t,cuda.CUgraphNode]") - cdef ccudart.cudaGraph_t cgraph - if graph is None: - cgraph = 0 - elif isinstance(graph, (cudaGraph_t,cuda.CUgraph)): - pgraph = int(graph) - cgraph = pgraph + cynode = pnode + cdef cyruntime.cudaGraphExec_t cyhGraphExec + if hGraphExec is None: + phGraphExec = 0 + elif isinstance(hGraphExec, (cudaGraphExec_t,driver.CUgraphExec)): + phGraphExec = int(hGraphExec) else: - pgraph = int(cudaGraph_t(graph)) - cgraph = pgraph - cdef ccudart.cudaGraphNode_t* cfrom_ = NULL - if len(from_) > 0: - cfrom_ = calloc(len(from_), sizeof(ccudart.cudaGraphNode_t)) - if cfrom_ is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(from_)) + 'x' + str(sizeof(ccudart.cudaGraphNode_t))) - else: - for idx in range(len(from_)): - cfrom_[idx] = (from_[idx])._ptr[0] - cdef ccudart.cudaGraphNode_t* cto = NULL - if len(to) > 0: - cto = calloc(len(to), sizeof(ccudart.cudaGraphNode_t)) - if cto is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(to)) + 'x' + str(sizeof(ccudart.cudaGraphNode_t))) - else: - for idx in range(len(to)): - cto[idx] = (to[idx])._ptr[0] - if numDependencies > len(from_): raise RuntimeError("List is too small: " + str(len(from_)) + " < " + str(numDependencies)) - if numDependencies > len(to): raise RuntimeError("List is too small: " + str(len(to)) + " < " + str(numDependencies)) - err = ccudart.cudaGraphAddDependencies(cgraph, (from_[0])._ptr if len(from_) == 1 else cfrom_, (to[0])._ptr if len(to) == 1 else cto, numDependencies) - if cfrom_ is not NULL: - free(cfrom_) - if cto is not NULL: - free(cto) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaGraphAddDependencies_v2' in found_functions}} + phGraphExec = int(cudaGraphExec_t(hGraphExec)) + cyhGraphExec = phGraphExec + with nogil: + err = cyruntime.cudaGraphExecChildGraphNodeSetParams(cyhGraphExec, cynode, cychildGraph) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaGraphAddDependencies_v2(graph, from_ : Optional[List[cudaGraphNode_t]], to : Optional[List[cudaGraphNode_t]], edgeData : Optional[List[cudaGraphEdgeData]], size_t numDependencies): - """ Adds dependency edges to a graph. (12.3+) +def cudaGraphExecEventRecordNodeSetEvent(hGraphExec, hNode, event): + """ Sets the event for an event record node in the given graphExec. - The number of dependencies to be added is defined by `numDependencies` - Elements in `pFrom` and `pTo` at corresponding indices define a - dependency. Each node in `pFrom` and `pTo` must belong to `graph`. + Sets the event of an event record node in an executable graph + `hGraphExec`. The node is identified by the corresponding node `hNode` + in the non-executable graph, from which the executable graph was + instantiated. - If `numDependencies` is 0, elements in `pFrom` and `pTo` will be - ignored. Specifying an existing dependency will return an error. + The modifications only affect future launches of `hGraphExec`. Already + enqueued or running launches of `hGraphExec` are not affected by this + call. `hNode` is also not modified by this call. Parameters ---------- - graph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` - Graph to which dependencies are added - from : List[:py:obj:`~.cudaGraphNode_t`] - Array of nodes that provide the dependencies - to : List[:py:obj:`~.cudaGraphNode_t`] - Array of dependent nodes - edgeData : List[:py:obj:`~.cudaGraphEdgeData`] - Optional array of edge data. If NULL, default (zeroed) edge data is - assumed. - numDependencies : size_t - Number of dependencies to be added + hGraphExec : :py:obj:`~.CUgraphExec` or :py:obj:`~.cudaGraphExec_t` + The executable graph in which to set the specified node + hNode : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` + Event record node from the graph from which graphExec was + instantiated + event : :py:obj:`~.CUevent` or :py:obj:`~.cudaEvent_t` + Updated event to use Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, See Also -------- - :py:obj:`~.cudaGraphRemoveDependencies`, :py:obj:`~.cudaGraphGetEdges`, :py:obj:`~.cudaGraphNodeGetDependencies`, :py:obj:`~.cudaGraphNodeGetDependentNodes` + :py:obj:`~.cudaGraphExecNodeSetParams`, :py:obj:`~.cudaGraphAddEventRecordNode`, :py:obj:`~.cudaGraphEventRecordNodeGetEvent`, :py:obj:`~.cudaGraphEventWaitNodeSetEvent`, :py:obj:`~.cudaEventRecordWithFlags`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cudaGraphExecKernelNodeSetParams`, :py:obj:`~.cudaGraphExecMemcpyNodeSetParams`, :py:obj:`~.cudaGraphExecMemsetNodeSetParams`, :py:obj:`~.cudaGraphExecHostNodeSetParams`, :py:obj:`~.cudaGraphExecChildGraphNodeSetParams`, :py:obj:`~.cudaGraphExecEventWaitNodeSetEvent`, :py:obj:`~.cudaGraphExecExternalSemaphoresSignalNodeSetParams`, :py:obj:`~.cudaGraphExecExternalSemaphoresWaitNodeSetParams`, :py:obj:`~.cudaGraphExecUpdate`, :py:obj:`~.cudaGraphInstantiate` """ - edgeData = [] if edgeData is None else edgeData - if not all(isinstance(_x, (cudaGraphEdgeData,)) for _x in edgeData): - raise TypeError("Argument 'edgeData' is not instance of type (expected List[ccudart.cudaGraphEdgeData,]") - to = [] if to is None else to - if not all(isinstance(_x, (cudaGraphNode_t,cuda.CUgraphNode)) for _x in to): - raise TypeError("Argument 'to' is not instance of type (expected List[ccudart.cudaGraphNode_t,cuda.CUgraphNode]") - from_ = [] if from_ is None else from_ - if not all(isinstance(_x, (cudaGraphNode_t,cuda.CUgraphNode)) for _x in from_): - raise TypeError("Argument 'from_' is not instance of type (expected List[ccudart.cudaGraphNode_t,cuda.CUgraphNode]") - cdef ccudart.cudaGraph_t cgraph - if graph is None: - cgraph = 0 - elif isinstance(graph, (cudaGraph_t,cuda.CUgraph)): - pgraph = int(graph) - cgraph = pgraph + cdef cyruntime.cudaEvent_t cyevent + if event is None: + pevent = 0 + elif isinstance(event, (cudaEvent_t,driver.CUevent)): + pevent = int(event) else: - pgraph = int(cudaGraph_t(graph)) - cgraph = pgraph - cdef ccudart.cudaGraphNode_t* cfrom_ = NULL - if len(from_) > 0: - cfrom_ = calloc(len(from_), sizeof(ccudart.cudaGraphNode_t)) - if cfrom_ is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(from_)) + 'x' + str(sizeof(ccudart.cudaGraphNode_t))) - else: - for idx in range(len(from_)): - cfrom_[idx] = (from_[idx])._ptr[0] - cdef ccudart.cudaGraphNode_t* cto = NULL - if len(to) > 0: - cto = calloc(len(to), sizeof(ccudart.cudaGraphNode_t)) - if cto is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(to)) + 'x' + str(sizeof(ccudart.cudaGraphNode_t))) - else: - for idx in range(len(to)): - cto[idx] = (to[idx])._ptr[0] - cdef ccudart.cudaGraphEdgeData* cedgeData = NULL - if len(edgeData) > 0: - cedgeData = calloc(len(edgeData), sizeof(ccudart.cudaGraphEdgeData)) - if cedgeData is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(edgeData)) + 'x' + str(sizeof(ccudart.cudaGraphEdgeData))) - for idx in range(len(edgeData)): - string.memcpy(&cedgeData[idx], (edgeData[idx])._ptr, sizeof(ccudart.cudaGraphEdgeData)) - err = ccudart.cudaGraphAddDependencies_v2(cgraph, (from_[0])._ptr if len(from_) == 1 else cfrom_, (to[0])._ptr if len(to) == 1 else cto, (edgeData[0])._ptr if len(edgeData) == 1 else cedgeData, numDependencies) - if cfrom_ is not NULL: - free(cfrom_) - if cto is not NULL: - free(cto) - if cedgeData is not NULL: - free(cedgeData) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaGraphRemoveDependencies' in found_functions}} + pevent = int(cudaEvent_t(event)) + cyevent = pevent + cdef cyruntime.cudaGraphNode_t cyhNode + if hNode is None: + phNode = 0 + elif isinstance(hNode, (cudaGraphNode_t,driver.CUgraphNode)): + phNode = int(hNode) + else: + phNode = int(cudaGraphNode_t(hNode)) + cyhNode = phNode + cdef cyruntime.cudaGraphExec_t cyhGraphExec + if hGraphExec is None: + phGraphExec = 0 + elif isinstance(hGraphExec, (cudaGraphExec_t,driver.CUgraphExec)): + phGraphExec = int(hGraphExec) + else: + phGraphExec = int(cudaGraphExec_t(hGraphExec)) + cyhGraphExec = phGraphExec + with nogil: + err = cyruntime.cudaGraphExecEventRecordNodeSetEvent(cyhGraphExec, cyhNode, cyevent) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaGraphRemoveDependencies(graph, from_ : Optional[List[cudaGraphNode_t]], to : Optional[List[cudaGraphNode_t]], size_t numDependencies): - """ Removes dependency edges from a graph. +def cudaGraphExecEventWaitNodeSetEvent(hGraphExec, hNode, event): + """ Sets the event for an event wait node in the given graphExec. - The number of `pDependencies` to be removed is defined by - `numDependencies`. Elements in `pFrom` and `pTo` at corresponding - indices define a dependency. Each node in `pFrom` and `pTo` must belong - to `graph`. + Sets the event of an event wait node in an executable graph + `hGraphExec`. The node is identified by the corresponding node `hNode` + in the non-executable graph, from which the executable graph was + instantiated. - If `numDependencies` is 0, elements in `pFrom` and `pTo` will be - ignored. Specifying a non-existing dependency will return an error. + The modifications only affect future launches of `hGraphExec`. Already + enqueued or running launches of `hGraphExec` are not affected by this + call. `hNode` is also not modified by this call. Parameters ---------- - graph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` - Graph from which to remove dependencies - from : List[:py:obj:`~.cudaGraphNode_t`] - Array of nodes that provide the dependencies - to : List[:py:obj:`~.cudaGraphNode_t`] - Array of dependent nodes - numDependencies : size_t - Number of dependencies to be removed + hGraphExec : :py:obj:`~.CUgraphExec` or :py:obj:`~.cudaGraphExec_t` + The executable graph in which to set the specified node + hNode : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` + Event wait node from the graph from which graphExec was + instantiated + event : :py:obj:`~.CUevent` or :py:obj:`~.cudaEvent_t` + Updated event to use Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, See Also -------- - :py:obj:`~.cudaGraphAddDependencies`, :py:obj:`~.cudaGraphGetEdges`, :py:obj:`~.cudaGraphNodeGetDependencies`, :py:obj:`~.cudaGraphNodeGetDependentNodes` + :py:obj:`~.cudaGraphExecNodeSetParams`, :py:obj:`~.cudaGraphAddEventWaitNode`, :py:obj:`~.cudaGraphEventWaitNodeGetEvent`, :py:obj:`~.cudaGraphEventRecordNodeSetEvent`, :py:obj:`~.cudaEventRecordWithFlags`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cudaGraphExecKernelNodeSetParams`, :py:obj:`~.cudaGraphExecMemcpyNodeSetParams`, :py:obj:`~.cudaGraphExecMemsetNodeSetParams`, :py:obj:`~.cudaGraphExecHostNodeSetParams`, :py:obj:`~.cudaGraphExecChildGraphNodeSetParams`, :py:obj:`~.cudaGraphExecEventRecordNodeSetEvent`, :py:obj:`~.cudaGraphExecExternalSemaphoresSignalNodeSetParams`, :py:obj:`~.cudaGraphExecExternalSemaphoresWaitNodeSetParams`, :py:obj:`~.cudaGraphExecUpdate`, :py:obj:`~.cudaGraphInstantiate` """ - to = [] if to is None else to - if not all(isinstance(_x, (cudaGraphNode_t,cuda.CUgraphNode)) for _x in to): - raise TypeError("Argument 'to' is not instance of type (expected List[ccudart.cudaGraphNode_t,cuda.CUgraphNode]") - from_ = [] if from_ is None else from_ - if not all(isinstance(_x, (cudaGraphNode_t,cuda.CUgraphNode)) for _x in from_): - raise TypeError("Argument 'from_' is not instance of type (expected List[ccudart.cudaGraphNode_t,cuda.CUgraphNode]") - cdef ccudart.cudaGraph_t cgraph - if graph is None: - cgraph = 0 - elif isinstance(graph, (cudaGraph_t,cuda.CUgraph)): - pgraph = int(graph) - cgraph = pgraph + cdef cyruntime.cudaEvent_t cyevent + if event is None: + pevent = 0 + elif isinstance(event, (cudaEvent_t,driver.CUevent)): + pevent = int(event) else: - pgraph = int(cudaGraph_t(graph)) - cgraph = pgraph - cdef ccudart.cudaGraphNode_t* cfrom_ = NULL - if len(from_) > 0: - cfrom_ = calloc(len(from_), sizeof(ccudart.cudaGraphNode_t)) - if cfrom_ is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(from_)) + 'x' + str(sizeof(ccudart.cudaGraphNode_t))) - else: - for idx in range(len(from_)): - cfrom_[idx] = (from_[idx])._ptr[0] - cdef ccudart.cudaGraphNode_t* cto = NULL - if len(to) > 0: - cto = calloc(len(to), sizeof(ccudart.cudaGraphNode_t)) - if cto is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(to)) + 'x' + str(sizeof(ccudart.cudaGraphNode_t))) - else: - for idx in range(len(to)): - cto[idx] = (to[idx])._ptr[0] - if numDependencies > len(from_): raise RuntimeError("List is too small: " + str(len(from_)) + " < " + str(numDependencies)) - if numDependencies > len(to): raise RuntimeError("List is too small: " + str(len(to)) + " < " + str(numDependencies)) - err = ccudart.cudaGraphRemoveDependencies(cgraph, (from_[0])._ptr if len(from_) == 1 else cfrom_, (to[0])._ptr if len(to) == 1 else cto, numDependencies) - if cfrom_ is not NULL: - free(cfrom_) - if cto is not NULL: - free(cto) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaGraphRemoveDependencies_v2' in found_functions}} + pevent = int(cudaEvent_t(event)) + cyevent = pevent + cdef cyruntime.cudaGraphNode_t cyhNode + if hNode is None: + phNode = 0 + elif isinstance(hNode, (cudaGraphNode_t,driver.CUgraphNode)): + phNode = int(hNode) + else: + phNode = int(cudaGraphNode_t(hNode)) + cyhNode = phNode + cdef cyruntime.cudaGraphExec_t cyhGraphExec + if hGraphExec is None: + phGraphExec = 0 + elif isinstance(hGraphExec, (cudaGraphExec_t,driver.CUgraphExec)): + phGraphExec = int(hGraphExec) + else: + phGraphExec = int(cudaGraphExec_t(hGraphExec)) + cyhGraphExec = phGraphExec + with nogil: + err = cyruntime.cudaGraphExecEventWaitNodeSetEvent(cyhGraphExec, cyhNode, cyevent) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaGraphRemoveDependencies_v2(graph, from_ : Optional[List[cudaGraphNode_t]], to : Optional[List[cudaGraphNode_t]], edgeData : Optional[List[cudaGraphEdgeData]], size_t numDependencies): - """ Removes dependency edges from a graph. (12.3+) +def cudaGraphExecExternalSemaphoresSignalNodeSetParams(hGraphExec, hNode, nodeParams : Optional[cudaExternalSemaphoreSignalNodeParams]): + """ Sets the parameters for an external semaphore signal node in the given graphExec. - The number of `pDependencies` to be removed is defined by - `numDependencies`. Elements in `pFrom` and `pTo` at corresponding - indices define a dependency. Each node in `pFrom` and `pTo` must belong - to `graph`. + Sets the parameters of an external semaphore signal node in an + executable graph `hGraphExec`. The node is identified by the + corresponding node `hNode` in the non-executable graph, from which the + executable graph was instantiated. - If `numDependencies` is 0, elements in `pFrom` and `pTo` will be - ignored. Specifying an edge that does not exist in the graph, with data - matching `edgeData`, results in an error. `edgeData` is nullable, which - is equivalent to passing default (zeroed) data for each edge. + `hNode` must not have been removed from the original graph. + + The modifications only affect future launches of `hGraphExec`. Already + enqueued or running launches of `hGraphExec` are not affected by this + call. `hNode` is also not modified by this call. + + Changing `nodeParams->numExtSems` is not supported. Parameters ---------- - graph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` - Graph from which to remove dependencies - from : List[:py:obj:`~.cudaGraphNode_t`] - Array of nodes that provide the dependencies - to : List[:py:obj:`~.cudaGraphNode_t`] - Array of dependent nodes - edgeData : List[:py:obj:`~.cudaGraphEdgeData`] - Optional array of edge data. If NULL, edge data is assumed to be - default (zeroed). - numDependencies : size_t - Number of dependencies to be removed + hGraphExec : :py:obj:`~.CUgraphExec` or :py:obj:`~.cudaGraphExec_t` + The executable graph in which to set the specified node + hNode : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` + semaphore signal node from the graph from which graphExec was + instantiated + nodeParams : :py:obj:`~.cudaExternalSemaphoreSignalNodeParams` + Updated Parameters to set Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, See Also -------- - :py:obj:`~.cudaGraphAddDependencies`, :py:obj:`~.cudaGraphGetEdges`, :py:obj:`~.cudaGraphNodeGetDependencies`, :py:obj:`~.cudaGraphNodeGetDependentNodes` + :py:obj:`~.cudaGraphExecNodeSetParams`, :py:obj:`~.cudaGraphAddExternalSemaphoresSignalNode`, :py:obj:`~.cudaImportExternalSemaphore`, :py:obj:`~.cudaSignalExternalSemaphoresAsync`, :py:obj:`~.cudaWaitExternalSemaphoresAsync`, :py:obj:`~.cudaGraphExecKernelNodeSetParams`, :py:obj:`~.cudaGraphExecMemcpyNodeSetParams`, :py:obj:`~.cudaGraphExecMemsetNodeSetParams`, :py:obj:`~.cudaGraphExecHostNodeSetParams`, :py:obj:`~.cudaGraphExecChildGraphNodeSetParams`, :py:obj:`~.cudaGraphExecEventRecordNodeSetEvent`, :py:obj:`~.cudaGraphExecEventWaitNodeSetEvent`, :py:obj:`~.cudaGraphExecExternalSemaphoresWaitNodeSetParams`, :py:obj:`~.cudaGraphExecUpdate`, :py:obj:`~.cudaGraphInstantiate` """ - edgeData = [] if edgeData is None else edgeData - if not all(isinstance(_x, (cudaGraphEdgeData,)) for _x in edgeData): - raise TypeError("Argument 'edgeData' is not instance of type (expected List[ccudart.cudaGraphEdgeData,]") - to = [] if to is None else to - if not all(isinstance(_x, (cudaGraphNode_t,cuda.CUgraphNode)) for _x in to): - raise TypeError("Argument 'to' is not instance of type (expected List[ccudart.cudaGraphNode_t,cuda.CUgraphNode]") - from_ = [] if from_ is None else from_ - if not all(isinstance(_x, (cudaGraphNode_t,cuda.CUgraphNode)) for _x in from_): - raise TypeError("Argument 'from_' is not instance of type (expected List[ccudart.cudaGraphNode_t,cuda.CUgraphNode]") - cdef ccudart.cudaGraph_t cgraph - if graph is None: - cgraph = 0 - elif isinstance(graph, (cudaGraph_t,cuda.CUgraph)): - pgraph = int(graph) - cgraph = pgraph + cdef cyruntime.cudaGraphNode_t cyhNode + if hNode is None: + phNode = 0 + elif isinstance(hNode, (cudaGraphNode_t,driver.CUgraphNode)): + phNode = int(hNode) else: - pgraph = int(cudaGraph_t(graph)) - cgraph = pgraph - cdef ccudart.cudaGraphNode_t* cfrom_ = NULL - if len(from_) > 0: - cfrom_ = calloc(len(from_), sizeof(ccudart.cudaGraphNode_t)) - if cfrom_ is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(from_)) + 'x' + str(sizeof(ccudart.cudaGraphNode_t))) - else: - for idx in range(len(from_)): - cfrom_[idx] = (from_[idx])._ptr[0] - cdef ccudart.cudaGraphNode_t* cto = NULL - if len(to) > 0: - cto = calloc(len(to), sizeof(ccudart.cudaGraphNode_t)) - if cto is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(to)) + 'x' + str(sizeof(ccudart.cudaGraphNode_t))) - else: - for idx in range(len(to)): - cto[idx] = (to[idx])._ptr[0] - cdef ccudart.cudaGraphEdgeData* cedgeData = NULL - if len(edgeData) > 0: - cedgeData = calloc(len(edgeData), sizeof(ccudart.cudaGraphEdgeData)) - if cedgeData is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(edgeData)) + 'x' + str(sizeof(ccudart.cudaGraphEdgeData))) - for idx in range(len(edgeData)): - string.memcpy(&cedgeData[idx], (edgeData[idx])._ptr, sizeof(ccudart.cudaGraphEdgeData)) - err = ccudart.cudaGraphRemoveDependencies_v2(cgraph, (from_[0])._ptr if len(from_) == 1 else cfrom_, (to[0])._ptr if len(to) == 1 else cto, (edgeData[0])._ptr if len(edgeData) == 1 else cedgeData, numDependencies) - if cfrom_ is not NULL: - free(cfrom_) - if cto is not NULL: - free(cto) - if cedgeData is not NULL: - free(cedgeData) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaGraphDestroyNode' in found_functions}} + phNode = int(cudaGraphNode_t(hNode)) + cyhNode = phNode + cdef cyruntime.cudaGraphExec_t cyhGraphExec + if hGraphExec is None: + phGraphExec = 0 + elif isinstance(hGraphExec, (cudaGraphExec_t,driver.CUgraphExec)): + phGraphExec = int(hGraphExec) + else: + phGraphExec = int(cudaGraphExec_t(hGraphExec)) + cyhGraphExec = phGraphExec + cdef cyruntime.cudaExternalSemaphoreSignalNodeParams* cynodeParams_ptr = nodeParams._pvt_ptr if nodeParams is not None else NULL + with nogil: + err = cyruntime.cudaGraphExecExternalSemaphoresSignalNodeSetParams(cyhGraphExec, cyhNode, cynodeParams_ptr) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaGraphDestroyNode(node): - """ Remove a node from the graph. +def cudaGraphExecExternalSemaphoresWaitNodeSetParams(hGraphExec, hNode, nodeParams : Optional[cudaExternalSemaphoreWaitNodeParams]): + """ Sets the parameters for an external semaphore wait node in the given graphExec. - Removes `node` from its graph. This operation also severs any - dependencies of other nodes on `node` and vice versa. + Sets the parameters of an external semaphore wait node in an executable + graph `hGraphExec`. The node is identified by the corresponding node + `hNode` in the non-executable graph, from which the executable graph + was instantiated. - Dependencies cannot be removed from graphs which contain allocation or - free nodes. Any attempt to do so will return an error. + `hNode` must not have been removed from the original graph. + + The modifications only affect future launches of `hGraphExec`. Already + enqueued or running launches of `hGraphExec` are not affected by this + call. `hNode` is also not modified by this call. + + Changing `nodeParams->numExtSems` is not supported. Parameters ---------- - node : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` - Node to remove + hGraphExec : :py:obj:`~.CUgraphExec` or :py:obj:`~.cudaGraphExec_t` + The executable graph in which to set the specified node + hNode : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` + semaphore wait node from the graph from which graphExec was + instantiated + nodeParams : :py:obj:`~.cudaExternalSemaphoreWaitNodeParams` + Updated Parameters to set Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, See Also -------- - :py:obj:`~.cudaGraphAddChildGraphNode`, :py:obj:`~.cudaGraphAddEmptyNode`, :py:obj:`~.cudaGraphAddKernelNode`, :py:obj:`~.cudaGraphAddHostNode`, :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphAddMemsetNode` + :py:obj:`~.cudaGraphExecNodeSetParams`, :py:obj:`~.cudaGraphAddExternalSemaphoresWaitNode`, :py:obj:`~.cudaImportExternalSemaphore`, :py:obj:`~.cudaSignalExternalSemaphoresAsync`, :py:obj:`~.cudaWaitExternalSemaphoresAsync`, :py:obj:`~.cudaGraphExecKernelNodeSetParams`, :py:obj:`~.cudaGraphExecMemcpyNodeSetParams`, :py:obj:`~.cudaGraphExecMemsetNodeSetParams`, :py:obj:`~.cudaGraphExecHostNodeSetParams`, :py:obj:`~.cudaGraphExecChildGraphNodeSetParams`, :py:obj:`~.cudaGraphExecEventRecordNodeSetEvent`, :py:obj:`~.cudaGraphExecEventWaitNodeSetEvent`, :py:obj:`~.cudaGraphExecExternalSemaphoresSignalNodeSetParams`, :py:obj:`~.cudaGraphExecUpdate`, :py:obj:`~.cudaGraphInstantiate` """ - cdef ccudart.cudaGraphNode_t cnode - if node is None: - cnode = 0 - elif isinstance(node, (cudaGraphNode_t,cuda.CUgraphNode)): - pnode = int(node) - cnode = pnode + cdef cyruntime.cudaGraphNode_t cyhNode + if hNode is None: + phNode = 0 + elif isinstance(hNode, (cudaGraphNode_t,driver.CUgraphNode)): + phNode = int(hNode) else: - pnode = int(cudaGraphNode_t(node)) - cnode = pnode - err = ccudart.cudaGraphDestroyNode(cnode) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaGraphInstantiate' in found_functions}} + phNode = int(cudaGraphNode_t(hNode)) + cyhNode = phNode + cdef cyruntime.cudaGraphExec_t cyhGraphExec + if hGraphExec is None: + phGraphExec = 0 + elif isinstance(hGraphExec, (cudaGraphExec_t,driver.CUgraphExec)): + phGraphExec = int(hGraphExec) + else: + phGraphExec = int(cudaGraphExec_t(hGraphExec)) + cyhGraphExec = phGraphExec + cdef cyruntime.cudaExternalSemaphoreWaitNodeParams* cynodeParams_ptr = nodeParams._pvt_ptr if nodeParams is not None else NULL + with nogil: + err = cyruntime.cudaGraphExecExternalSemaphoresWaitNodeSetParams(cyhGraphExec, cyhNode, cynodeParams_ptr) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaGraphInstantiate(graph, unsigned long long flags): - """ Creates an executable graph from a graph. - - Instantiates `graph` as an executable graph. The graph is validated for - any structural constraints or intra-node constraints which were not - previously validated. If instantiation is successful, a handle to the - instantiated graph is returned in `pGraphExec`. - - The `flags` parameter controls the behavior of instantiation and - subsequent graph launches. Valid flags are: - - - :py:obj:`~.cudaGraphInstantiateFlagAutoFreeOnLaunch`, which - configures a graph containing memory allocation nodes to - automatically free any unfreed memory allocations before the graph is - relaunched. - - - :py:obj:`~.cudaGraphInstantiateFlagDeviceLaunch`, which configures - the graph for launch from the device. If this flag is passed, the - executable graph handle returned can be used to launch the graph from - both the host and device. This flag cannot be used in conjunction - with :py:obj:`~.cudaGraphInstantiateFlagAutoFreeOnLaunch`. - - - :py:obj:`~.cudaGraphInstantiateFlagUseNodePriority`, which causes the - graph to use the priorities from the per-node attributes rather than - the priority of the launch stream during execution. Note that - priorities are only available on kernel nodes, and are copied from - stream priority during stream capture. - - If `graph` contains any allocation or free nodes, there can be at most - one executable graph in existence for that graph at a time. An attempt - to instantiate a second executable graph before destroying the first - with :py:obj:`~.cudaGraphExecDestroy` will result in an error. The same - also applies if `graph` contains any device-updatable kernel nodes. - - Graphs instantiated for launch on the device have additional - restrictions which do not apply to host graphs: - - - The graph's nodes must reside on a single device. - - - The graph can only contain kernel nodes, memcpy nodes, memset nodes, - and child graph nodes. - - - The graph cannot be empty and must contain at least one kernel, - memcpy, or memset node. Operation-specific restrictions are outlined - below. - - - Kernel nodes: - - - Use of CUDA Dynamic Parallelism is not permitted. - - - Cooperative launches are permitted as long as MPS is not in use. - - - Memcpy nodes: +def cudaGraphNodeSetEnabled(hGraphExec, hNode, unsigned int isEnabled): + """ Enables or disables the specified node in the given graphExec. - - Only copies involving device memory and/or pinned device-mapped - host memory are permitted. + Sets `hNode` to be either enabled or disabled. Disabled nodes are + functionally equivalent to empty nodes until they are reenabled. + Existing node parameters are not affected by disabling/enabling the + node. - - Copies involving CUDA arrays are not permitted. + The node is identified by the corresponding node `hNode` in the non- + executable graph, from which the executable graph was instantiated. - - Both operands must be accessible from the current device, and the - current device must match the device of other nodes in the graph. + `hNode` must not have been removed from the original graph. - If `graph` is not instantiated for launch on the device but contains - kernels which call device-side :py:obj:`~.cudaGraphLaunch()` from - multiple devices, this will result in an error. + The modifications only affect future launches of `hGraphExec`. Already + enqueued or running launches of `hGraphExec` are not affected by this + call. `hNode` is also not modified by this call. Parameters ---------- - graph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` - Graph to instantiate - flags : unsigned long long - Flags to control instantiation. See - :py:obj:`~.CUgraphInstantiate_flags`. + hGraphExec : :py:obj:`~.CUgraphExec` or :py:obj:`~.cudaGraphExec_t` + The executable graph in which to set the specified node + hNode : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` + Node from the graph from which graphExec was instantiated + isEnabled : unsigned int + Node is enabled if != 0, otherwise the node is disabled Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` - pGraphExec : :py:obj:`~.cudaGraphExec_t` - Returns instantiated graph + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, See Also -------- - :py:obj:`~.cudaGraphInstantiateWithFlags`, :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphUpload`, :py:obj:`~.cudaGraphLaunch`, :py:obj:`~.cudaGraphExecDestroy` + :py:obj:`~.cudaGraphNodeGetEnabled`, :py:obj:`~.cudaGraphExecUpdate`, :py:obj:`~.cudaGraphInstantiate` :py:obj:`~.cudaGraphLaunch` + + Notes + ----- + Currently only kernel, memset and memcpy nodes are supported. """ - cdef ccudart.cudaGraph_t cgraph - if graph is None: - cgraph = 0 - elif isinstance(graph, (cudaGraph_t,cuda.CUgraph)): - pgraph = int(graph) - cgraph = pgraph + cdef cyruntime.cudaGraphNode_t cyhNode + if hNode is None: + phNode = 0 + elif isinstance(hNode, (cudaGraphNode_t,driver.CUgraphNode)): + phNode = int(hNode) else: - pgraph = int(cudaGraph_t(graph)) - cgraph = pgraph - cdef cudaGraphExec_t pGraphExec = cudaGraphExec_t() - err = ccudart.cudaGraphInstantiate(pGraphExec._ptr, cgraph, flags) - return (cudaError_t(err), pGraphExec) -{{endif}} - -{{if 'cudaGraphInstantiateWithFlags' in found_functions}} + phNode = int(cudaGraphNode_t(hNode)) + cyhNode = phNode + cdef cyruntime.cudaGraphExec_t cyhGraphExec + if hGraphExec is None: + phGraphExec = 0 + elif isinstance(hGraphExec, (cudaGraphExec_t,driver.CUgraphExec)): + phGraphExec = int(hGraphExec) + else: + phGraphExec = int(cudaGraphExec_t(hGraphExec)) + cyhGraphExec = phGraphExec + with nogil: + err = cyruntime.cudaGraphNodeSetEnabled(cyhGraphExec, cyhNode, isEnabled) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaGraphInstantiateWithFlags(graph, unsigned long long flags): - """ Creates an executable graph from a graph. - - Instantiates `graph` as an executable graph. The graph is validated for - any structural constraints or intra-node constraints which were not - previously validated. If instantiation is successful, a handle to the - instantiated graph is returned in `pGraphExec`. +def cudaGraphNodeGetEnabled(hGraphExec, hNode): + """ Query whether a node in the given graphExec is enabled. - The `flags` parameter controls the behavior of instantiation and - subsequent graph launches. Valid flags are: + Sets isEnabled to 1 if `hNode` is enabled, or 0 if `hNode` is disabled. - - :py:obj:`~.cudaGraphInstantiateFlagAutoFreeOnLaunch`, which - configures a graph containing memory allocation nodes to - automatically free any unfreed memory allocations before the graph is - relaunched. + The node is identified by the corresponding node `hNode` in the non- + executable graph, from which the executable graph was instantiated. - - :py:obj:`~.cudaGraphInstantiateFlagDeviceLaunch`, which configures - the graph for launch from the device. If this flag is passed, the - executable graph handle returned can be used to launch the graph from - both the host and device. This flag can only be used on platforms - which support unified addressing. This flag cannot be used in - conjunction with - :py:obj:`~.cudaGraphInstantiateFlagAutoFreeOnLaunch`. + `hNode` must not have been removed from the original graph. - - :py:obj:`~.cudaGraphInstantiateFlagUseNodePriority`, which causes the - graph to use the priorities from the per-node attributes rather than - the priority of the launch stream during execution. Note that - priorities are only available on kernel nodes, and are copied from - stream priority during stream capture. + Parameters + ---------- + hGraphExec : :py:obj:`~.CUgraphExec` or :py:obj:`~.cudaGraphExec_t` + The executable graph in which to set the specified node + hNode : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` + Node from the graph from which graphExec was instantiated - If `graph` contains any allocation or free nodes, there can be at most - one executable graph in existence for that graph at a time. An attempt - to instantiate a second executable graph before destroying the first - with :py:obj:`~.cudaGraphExecDestroy` will result in an error. The same - also applies if `graph` contains any device-updatable kernel nodes. + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, + isEnabled : unsigned int + Location to return the enabled status of the node - If `graph` contains kernels which call device-side - :py:obj:`~.cudaGraphLaunch()` from multiple devices, this will result - in an error. + See Also + -------- + :py:obj:`~.cudaGraphNodeSetEnabled`, :py:obj:`~.cudaGraphExecUpdate`, :py:obj:`~.cudaGraphInstantiate` :py:obj:`~.cudaGraphLaunch` - Graphs instantiated for launch on the device have additional - restrictions which do not apply to host graphs: + Notes + ----- + Currently only kernel, memset and memcpy nodes are supported. + """ + cdef cyruntime.cudaGraphNode_t cyhNode + if hNode is None: + phNode = 0 + elif isinstance(hNode, (cudaGraphNode_t,driver.CUgraphNode)): + phNode = int(hNode) + else: + phNode = int(cudaGraphNode_t(hNode)) + cyhNode = phNode + cdef cyruntime.cudaGraphExec_t cyhGraphExec + if hGraphExec is None: + phGraphExec = 0 + elif isinstance(hGraphExec, (cudaGraphExec_t,driver.CUgraphExec)): + phGraphExec = int(hGraphExec) + else: + phGraphExec = int(cudaGraphExec_t(hGraphExec)) + cyhGraphExec = phGraphExec + cdef unsigned int isEnabled = 0 + with nogil: + err = cyruntime.cudaGraphNodeGetEnabled(cyhGraphExec, cyhNode, &isEnabled) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, isEnabled) - - The graph's nodes must reside on a single device. +@cython.embedsignature(True) +def cudaGraphExecUpdate(hGraphExec, hGraph): + """ Check whether an executable graph can be updated with a graph and perform the update if possible. - - The graph can only contain kernel nodes, memcpy nodes, memset nodes, - and child graph nodes. + Updates the node parameters in the instantiated graph specified by + `hGraphExec` with the node parameters in a topologically identical + graph specified by `hGraph`. - - The graph cannot be empty and must contain at least one kernel, - memcpy, or memset node. Operation-specific restrictions are outlined - below. + Limitations: - Kernel nodes: - - Use of CUDA Dynamic Parallelism is not permitted. + - The owning context of the function cannot change. - - Cooperative launches are permitted as long as MPS is not in use. + - A node whose function originally did not use CUDA dynamic + parallelism cannot be updated to a function which uses CDP. - - Memcpy nodes: + - A node whose function originally did not make device-side update + calls cannot be updated to a function which makes device-side + update calls. - - Only copies involving device memory and/or pinned device-mapped - host memory are permitted. + - A cooperative node cannot be updated to a non-cooperative node, and + vice-versa. - - Copies involving CUDA arrays are not permitted. + - If the graph was instantiated with + cudaGraphInstantiateFlagUseNodePriority, the priority attribute + cannot change. Equality is checked on the originally requested + priority values, before they are clamped to the device's supported + range. - - Both operands must be accessible from the current device, and the - current device must match the device of other nodes in the graph. + - If `hGraphExec` was not instantiated for device launch, a node + whose function originally did not use device-side + :py:obj:`~.cudaGraphLaunch()` cannot be updated to a function which + uses device-side :py:obj:`~.cudaGraphLaunch()` unless the node + resides on the same device as nodes which contained such calls at + instantiate-time. If no such calls were present at instantiation, + these updates cannot be performed at all. - Parameters - ---------- - graph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` - Graph to instantiate - flags : unsigned long long - Flags to control instantiation. See - :py:obj:`~.CUgraphInstantiate_flags`. + - Neither `hGraph` nor `hGraphExec` may contain device-updatable + kernel nodes. - Returns - ------- - cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` - pGraphExec : :py:obj:`~.cudaGraphExec_t` - Returns instantiated graph + - Memset and memcpy nodes: - See Also - -------- - :py:obj:`~.cudaGraphInstantiate`, :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphUpload`, :py:obj:`~.cudaGraphLaunch`, :py:obj:`~.cudaGraphExecDestroy` - """ - cdef ccudart.cudaGraph_t cgraph - if graph is None: - cgraph = 0 - elif isinstance(graph, (cudaGraph_t,cuda.CUgraph)): - pgraph = int(graph) - cgraph = pgraph - else: - pgraph = int(cudaGraph_t(graph)) - cgraph = pgraph - cdef cudaGraphExec_t pGraphExec = cudaGraphExec_t() - err = ccudart.cudaGraphInstantiateWithFlags(pGraphExec._ptr, cgraph, flags) - return (cudaError_t(err), pGraphExec) -{{endif}} + - The CUDA device(s) to which the operand(s) was allocated/mapped + cannot change. -{{if 'cudaGraphInstantiateWithParams' in found_functions}} + - The source/destination memory must be allocated from the same + contexts as the original source/destination memory. -@cython.embedsignature(True) -def cudaGraphInstantiateWithParams(graph, instantiateParams : Optional[cudaGraphInstantiateParams]): - """ Creates an executable graph from a graph. + - For 2d memsets, only address and assigned value may be updated. - Instantiates `graph` as an executable graph according to the - `instantiateParams` structure. The graph is validated for any - structural constraints or intra-node constraints which were not - previously validated. If instantiation is successful, a handle to the - instantiated graph is returned in `pGraphExec`. + - For 1d memsets, updating dimensions is also allowed, but may fail + if the resulting operation doesn't map onto the work resources + already allocated for the node. - `instantiateParams` controls the behavior of instantiation and - subsequent graph launches, as well as returning more detailed - information in the event of an error. - :py:obj:`~.cudaGraphInstantiateParams` is defined as: + - Additional memcpy node restrictions: - **View CUDA Toolkit Documentation for a C++ code example** + - Changing either the source or destination memory type(i.e. + CU_MEMORYTYPE_DEVICE, CU_MEMORYTYPE_ARRAY, etc.) is not supported. - The `flags` field controls the behavior of instantiation and subsequent - graph launches. Valid flags are: + - Conditional nodes: - - :py:obj:`~.cudaGraphInstantiateFlagAutoFreeOnLaunch`, which - configures a graph containing memory allocation nodes to - automatically free any unfreed memory allocations before the graph is - relaunched. + - Changing node parameters is not supported. - - :py:obj:`~.cudaGraphInstantiateFlagUpload`, which will perform an - upload of the graph into `uploadStream` once the graph has been - instantiated. + - Changing parameters of nodes within the conditional body graph is + subject to the rules above. - - :py:obj:`~.cudaGraphInstantiateFlagDeviceLaunch`, which configures - the graph for launch from the device. If this flag is passed, the - executable graph handle returned can be used to launch the graph from - both the host and device. This flag can only be used on platforms - which support unified addressing. This flag cannot be used in - conjunction with - :py:obj:`~.cudaGraphInstantiateFlagAutoFreeOnLaunch`. + - Conditional handle flags and default values are updated as part of + the graph update. - - :py:obj:`~.cudaGraphInstantiateFlagUseNodePriority`, which causes the - graph to use the priorities from the per-node attributes rather than - the priority of the launch stream during execution. Note that - priorities are only available on kernel nodes, and are copied from - stream priority during stream capture. + Note: The API may add further restrictions in future releases. The + return code should always be checked. - If `graph` contains any allocation or free nodes, there can be at most - one executable graph in existence for that graph at a time. An attempt - to instantiate a second executable graph before destroying the first - with :py:obj:`~.cudaGraphExecDestroy` will result in an error. The same - also applies if `graph` contains any device-updatable kernel nodes. + cudaGraphExecUpdate sets the result member of `resultInfo` to + cudaGraphExecUpdateErrorTopologyChanged under the following conditions: - If `graph` contains kernels which call device-side - :py:obj:`~.cudaGraphLaunch()` from multiple devices, this will result - in an error. + - The count of nodes directly in `hGraphExec` and `hGraph` differ, in + which case resultInfo->errorNode is set to NULL. - Graphs instantiated for launch on the device have additional - restrictions which do not apply to host graphs: + - `hGraph` has more exit nodes than `hGraph`, in which case + resultInfo->errorNode is set to one of the exit nodes in hGraph. - - The graph's nodes must reside on a single device. + - A node in `hGraph` has a different number of dependencies than the + node from `hGraphExec` it is paired with, in which case + resultInfo->errorNode is set to the node from `hGraph`. - - The graph can only contain kernel nodes, memcpy nodes, memset nodes, - and child graph nodes. + - A node in `hGraph` has a dependency that does not match with the + corresponding dependency of the paired node from `hGraphExec`. + resultInfo->errorNode will be set to the node from `hGraph`. + resultInfo->errorFromNode will be set to the mismatched dependency. + The dependencies are paired based on edge order and a dependency does + not match when the nodes are already paired based on other edges + examined in the graph. + + cudaGraphExecUpdate sets `the` result member of `resultInfo` to: - - The graph cannot be empty and must contain at least one kernel, - memcpy, or memset node. Operation-specific restrictions are outlined - below. + - cudaGraphExecUpdateError if passed an invalid value. - - Kernel nodes: + - cudaGraphExecUpdateErrorTopologyChanged if the graph topology changed - - Use of CUDA Dynamic Parallelism is not permitted. + - cudaGraphExecUpdateErrorNodeTypeChanged if the type of a node + changed, in which case `hErrorNode_out` is set to the node from + `hGraph`. - - Cooperative launches are permitted as long as MPS is not in use. + - cudaGraphExecUpdateErrorFunctionChanged if the function of a kernel + node changed (CUDA driver < 11.2) - - Memcpy nodes: + - cudaGraphExecUpdateErrorUnsupportedFunctionChange if the func field + of a kernel changed in an unsupported way(see note above), in which + case `hErrorNode_out` is set to the node from `hGraph` - - Only copies involving device memory and/or pinned device-mapped - host memory are permitted. + - cudaGraphExecUpdateErrorParametersChanged if any parameters to a node + changed in a way that is not supported, in which case + `hErrorNode_out` is set to the node from `hGraph` - - Copies involving CUDA arrays are not permitted. + - cudaGraphExecUpdateErrorAttributesChanged if any attributes of a node + changed in a way that is not supported, in which case + `hErrorNode_out` is set to the node from `hGraph` - - Both operands must be accessible from the current device, and the - current device must match the device of other nodes in the graph. + - cudaGraphExecUpdateErrorNotSupported if something about a node is + unsupported, like the node's type or configuration, in which case + `hErrorNode_out` is set to the node from `hGraph` - In the event of an error, the `result_out` and `errNode_out` fields - will contain more information about the nature of the error. Possible - error reporting includes: + If the update fails for a reason not listed above, the result member of + `resultInfo` will be set to cudaGraphExecUpdateError. If the update + succeeds, the result member will be set to cudaGraphExecUpdateSuccess. - - :py:obj:`~.cudaGraphInstantiateError`, if passed an invalid value or - if an unexpected error occurred which is described by the return - value of the function. `errNode_out` will be set to NULL. + cudaGraphExecUpdate returns cudaSuccess when the updated was performed + successfully. It returns cudaErrorGraphExecUpdateFailure if the graph + update was not performed because it included changes which violated + constraints specific to instantiated graph update. - - :py:obj:`~.cudaGraphInstantiateInvalidStructure`, if the graph - structure is invalid. `errNode_out` will be set to one of the - offending nodes. + Parameters + ---------- + hGraphExec : :py:obj:`~.CUgraphExec` or :py:obj:`~.cudaGraphExec_t` + The instantiated graph to be updated + hGraph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` + The graph containing the updated parameters - - :py:obj:`~.cudaGraphInstantiateNodeOperationNotSupported`, if the - graph is instantiated for device launch but contains a node of an - unsupported node type, or a node which performs unsupported - operations, such as use of CUDA dynamic parallelism within a kernel - node. `errNode_out` will be set to this node. + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorGraphExecUpdateFailure`, + resultInfo : :py:obj:`~.cudaGraphExecUpdateResultInfo` + the error info structure - - :py:obj:`~.cudaGraphInstantiateMultipleDevicesNotSupported`, if the - graph is instantiated for device launch but a node’s device differs - from that of another node. This error can also be returned if a graph - is not instantiated for device launch and it contains kernels which - call device-side :py:obj:`~.cudaGraphLaunch()` from multiple devices. - `errNode_out` will be set to this node. + See Also + -------- + :py:obj:`~.cudaGraphInstantiate` + """ + cdef cyruntime.cudaGraph_t cyhGraph + if hGraph is None: + phGraph = 0 + elif isinstance(hGraph, (cudaGraph_t,driver.CUgraph)): + phGraph = int(hGraph) + else: + phGraph = int(cudaGraph_t(hGraph)) + cyhGraph = phGraph + cdef cyruntime.cudaGraphExec_t cyhGraphExec + if hGraphExec is None: + phGraphExec = 0 + elif isinstance(hGraphExec, (cudaGraphExec_t,driver.CUgraphExec)): + phGraphExec = int(hGraphExec) + else: + phGraphExec = int(cudaGraphExec_t(hGraphExec)) + cyhGraphExec = phGraphExec + cdef cudaGraphExecUpdateResultInfo resultInfo = cudaGraphExecUpdateResultInfo() + with nogil: + err = cyruntime.cudaGraphExecUpdate(cyhGraphExec, cyhGraph, resultInfo._pvt_ptr) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, resultInfo) - If instantiation is successful, `result_out` will be set to - :py:obj:`~.cudaGraphInstantiateSuccess`, and `hErrNode_out` will be set - to NULL. +@cython.embedsignature(True) +def cudaGraphUpload(graphExec, stream): + """ Uploads an executable graph in a stream. + + Uploads `hGraphExec` to the device in `hStream` without executing it. + Uploads of the same `hGraphExec` will be serialized. Each upload is + ordered behind both any previous work in `hStream` and any previous + launches of `hGraphExec`. Uses memory cached by `stream` to back the + allocations owned by `graphExec`. Parameters ---------- - graph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` - Graph to instantiate - instantiateParams : :py:obj:`~.cudaGraphInstantiateParams` - Instantiation parameters + hGraphExec : :py:obj:`~.CUgraphExec` or :py:obj:`~.cudaGraphExec_t` + Executable graph to upload + hStream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + Stream in which to upload the graph Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` - pGraphExec : :py:obj:`~.cudaGraphExec_t` - Returns instantiated graph + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, See Also -------- - :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphInstantiate`, :py:obj:`~.cudaGraphInstantiateWithFlags`, :py:obj:`~.cudaGraphExecDestroy` + :py:obj:`~.cudaGraphInstantiate`, :py:obj:`~.cudaGraphLaunch`, :py:obj:`~.cudaGraphExecDestroy` """ - cdef ccudart.cudaGraph_t cgraph - if graph is None: - cgraph = 0 - elif isinstance(graph, (cudaGraph_t,cuda.CUgraph)): - pgraph = int(graph) - cgraph = pgraph + cdef cyruntime.cudaStream_t cystream + if stream is None: + pstream = 0 + elif isinstance(stream, (cudaStream_t,driver.CUstream)): + pstream = int(stream) else: - pgraph = int(cudaGraph_t(graph)) - cgraph = pgraph - cdef cudaGraphExec_t pGraphExec = cudaGraphExec_t() - cdef ccudart.cudaGraphInstantiateParams* cinstantiateParams_ptr = instantiateParams._ptr if instantiateParams != None else NULL - err = ccudart.cudaGraphInstantiateWithParams(pGraphExec._ptr, cgraph, cinstantiateParams_ptr) - return (cudaError_t(err), pGraphExec) -{{endif}} - -{{if 'cudaGraphExecGetFlags' in found_functions}} + pstream = int(cudaStream_t(stream)) + cystream = pstream + cdef cyruntime.cudaGraphExec_t cygraphExec + if graphExec is None: + pgraphExec = 0 + elif isinstance(graphExec, (cudaGraphExec_t,driver.CUgraphExec)): + pgraphExec = int(graphExec) + else: + pgraphExec = int(cudaGraphExec_t(graphExec)) + cygraphExec = pgraphExec + with nogil: + err = cyruntime.cudaGraphUpload(cygraphExec, cystream) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaGraphExecGetFlags(graphExec): - """ Query the instantiation flags of an executable graph. +def cudaGraphLaunch(graphExec, stream): + """ Launches an executable graph in a stream. - Returns the flags that were passed to instantiation for the given - executable graph. :py:obj:`~.cudaGraphInstantiateFlagUpload` will not - be returned by this API as it does not affect the resulting executable - graph. + Executes `graphExec` in `stream`. Only one instance of `graphExec` may + be executing at a time. Each launch is ordered behind both any previous + work in `stream` and any previous launches of `graphExec`. To execute a + graph concurrently, it must be instantiated multiple times into + multiple executable graphs. + + If any allocations created by `graphExec` remain unfreed (from a + previous launch) and `graphExec` was not instantiated with + :py:obj:`~.cudaGraphInstantiateFlagAutoFreeOnLaunch`, the launch will + fail with :py:obj:`~.cudaErrorInvalidValue`. Parameters ---------- graphExec : :py:obj:`~.CUgraphExec` or :py:obj:`~.cudaGraphExec_t` - The executable graph to query + Executable graph to launch + stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + Stream in which to launch the graph Returns ------- cudaError_t :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` - flags : unsigned long long - Returns the instantiation flags See Also -------- - :py:obj:`~.cudaGraphInstantiate`, :py:obj:`~.cudaGraphInstantiateWithFlags`, :py:obj:`~.cudaGraphInstantiateWithParams` + :py:obj:`~.cudaGraphInstantiate`, :py:obj:`~.cudaGraphUpload`, :py:obj:`~.cudaGraphExecDestroy` """ - cdef ccudart.cudaGraphExec_t cgraphExec + cdef cyruntime.cudaStream_t cystream + if stream is None: + pstream = 0 + elif isinstance(stream, (cudaStream_t,driver.CUstream)): + pstream = int(stream) + else: + pstream = int(cudaStream_t(stream)) + cystream = pstream + cdef cyruntime.cudaGraphExec_t cygraphExec if graphExec is None: - cgraphExec = 0 - elif isinstance(graphExec, (cudaGraphExec_t,cuda.CUgraphExec)): + pgraphExec = 0 + elif isinstance(graphExec, (cudaGraphExec_t,driver.CUgraphExec)): pgraphExec = int(graphExec) - cgraphExec = pgraphExec else: pgraphExec = int(cudaGraphExec_t(graphExec)) - cgraphExec = pgraphExec - cdef unsigned long long flags = 0 - err = ccudart.cudaGraphExecGetFlags(cgraphExec, &flags) - return (cudaError_t(err), flags) -{{endif}} - -{{if 'cudaGraphExecKernelNodeSetParams' in found_functions}} + cygraphExec = pgraphExec + with nogil: + err = cyruntime.cudaGraphLaunch(cygraphExec, cystream) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaGraphExecKernelNodeSetParams(hGraphExec, node, pNodeParams : Optional[cudaKernelNodeParams]): - """ Sets the parameters for a kernel node in the given graphExec. - - Sets the parameters of a kernel node in an executable graph - `hGraphExec`. The node is identified by the corresponding node `node` - in the non-executable graph, from which the executable graph was - instantiated. - - `node` must not have been removed from the original graph. All - `nodeParams` fields may change, but the following restrictions apply to - `func` updates: +def cudaGraphExecDestroy(graphExec): + """ Destroys an executable graph. - - The owning device of the function cannot change. + Destroys the executable graph specified by `graphExec`. - - A node whose function originally did not use CUDA dynamic parallelism - cannot be updated to a function which uses CDP + Parameters + ---------- + graphExec : :py:obj:`~.CUgraphExec` or :py:obj:`~.cudaGraphExec_t` + Executable graph to destroy - - A node whose function originally did not make device-side update - calls cannot be updated to a function which makes device-side update - calls. + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` - - If `hGraphExec` was not instantiated for device launch, a node whose - function originally did not use device-side - :py:obj:`~.cudaGraphLaunch()` cannot be updated to a function which - uses device-side :py:obj:`~.cudaGraphLaunch()` unless the node - resides on the same device as nodes which contained such calls at - instantiate-time. If no such calls were present at instantiation, - these updates cannot be performed at all. + See Also + -------- + :py:obj:`~.cudaGraphInstantiate`, :py:obj:`~.cudaGraphUpload`, :py:obj:`~.cudaGraphLaunch` + """ + cdef cyruntime.cudaGraphExec_t cygraphExec + if graphExec is None: + pgraphExec = 0 + elif isinstance(graphExec, (cudaGraphExec_t,driver.CUgraphExec)): + pgraphExec = int(graphExec) + else: + pgraphExec = int(cudaGraphExec_t(graphExec)) + cygraphExec = pgraphExec + with nogil: + err = cyruntime.cudaGraphExecDestroy(cygraphExec) + return (_cudaError_t(err),) - The modifications only affect future launches of `hGraphExec`. Already - enqueued or running launches of `hGraphExec` are not affected by this - call. `node` is also not modified by this call. +@cython.embedsignature(True) +def cudaGraphDestroy(graph): + """ Destroys a graph. - If `node` is a device-updatable kernel node, the next upload/launch of - `hGraphExec` will overwrite any previous device-side updates. - Additionally, applying host updates to a device-updatable kernel node - while it is being updated from the device will result in undefined - behavior. + Destroys the graph specified by `graph`, as well as all of its nodes. Parameters ---------- - hGraphExec : :py:obj:`~.CUgraphExec` or :py:obj:`~.cudaGraphExec_t` - The executable graph in which to set the specified node - node : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` - kernel node from the graph from which graphExec was instantiated - pNodeParams : :py:obj:`~.cudaKernelNodeParams` - Updated Parameters to set + graph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` + Graph to destroy Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` See Also -------- - :py:obj:`~.cudaGraphExecNodeSetParams`, :py:obj:`~.cudaGraphAddKernelNode`, :py:obj:`~.cudaGraphKernelNodeSetParams`, :py:obj:`~.cudaGraphExecMemcpyNodeSetParams`, :py:obj:`~.cudaGraphExecMemsetNodeSetParams`, :py:obj:`~.cudaGraphExecHostNodeSetParams`, :py:obj:`~.cudaGraphExecChildGraphNodeSetParams`, :py:obj:`~.cudaGraphExecEventRecordNodeSetEvent`, :py:obj:`~.cudaGraphExecEventWaitNodeSetEvent`, :py:obj:`~.cudaGraphExecExternalSemaphoresSignalNodeSetParams`, :py:obj:`~.cudaGraphExecExternalSemaphoresWaitNodeSetParams`, :py:obj:`~.cudaGraphExecUpdate`, :py:obj:`~.cudaGraphInstantiate` + :py:obj:`~.cudaGraphCreate` """ - cdef ccudart.cudaGraphNode_t cnode - if node is None: - cnode = 0 - elif isinstance(node, (cudaGraphNode_t,cuda.CUgraphNode)): - pnode = int(node) - cnode = pnode + cdef cyruntime.cudaGraph_t cygraph + if graph is None: + pgraph = 0 + elif isinstance(graph, (cudaGraph_t,driver.CUgraph)): + pgraph = int(graph) else: - pnode = int(cudaGraphNode_t(node)) - cnode = pnode - cdef ccudart.cudaGraphExec_t chGraphExec - if hGraphExec is None: - chGraphExec = 0 - elif isinstance(hGraphExec, (cudaGraphExec_t,cuda.CUgraphExec)): - phGraphExec = int(hGraphExec) - chGraphExec = phGraphExec + pgraph = int(cudaGraph_t(graph)) + cygraph = pgraph + with nogil: + err = cyruntime.cudaGraphDestroy(cygraph) + return (_cudaError_t(err),) + +@cython.embedsignature(True) +def cudaGraphDebugDotPrint(graph, char* path, unsigned int flags): + """ Write a DOT file describing graph structure. + + Using the provided `graph`, write to `path` a DOT formatted description + of the graph. By default this includes the graph topology, node types, + node id, kernel names and memcpy direction. `flags` can be specified to + write more detailed information about each node type such as parameter + values, kernel attributes, node and function handles. + + Parameters + ---------- + graph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` + The graph to create a DOT file from + path : bytes + The path to write the DOT file to + flags : unsigned int + Flags from :py:obj:`~.cudaGraphDebugDotFlags` for specifying which + additional node information to write + + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorOperatingSystem` + """ + cdef cyruntime.cudaGraph_t cygraph + if graph is None: + pgraph = 0 + elif isinstance(graph, (cudaGraph_t,driver.CUgraph)): + pgraph = int(graph) else: - phGraphExec = int(cudaGraphExec_t(hGraphExec)) - chGraphExec = phGraphExec - cdef ccudart.cudaKernelNodeParams* cpNodeParams_ptr = pNodeParams._ptr if pNodeParams != None else NULL - err = ccudart.cudaGraphExecKernelNodeSetParams(chGraphExec, cnode, cpNodeParams_ptr) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaGraphExecMemcpyNodeSetParams' in found_functions}} + pgraph = int(cudaGraph_t(graph)) + cygraph = pgraph + with nogil: + err = cyruntime.cudaGraphDebugDotPrint(cygraph, path, flags) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaGraphExecMemcpyNodeSetParams(hGraphExec, node, pNodeParams : Optional[cudaMemcpy3DParms]): - """ Sets the parameters for a memcpy node in the given graphExec. - - Updates the work represented by `node` in `hGraphExec` as though `node` - had contained `pNodeParams` at instantiation. `node` must remain in the - graph which was used to instantiate `hGraphExec`. Changed edges to and - from `node` are ignored. +def cudaUserObjectCreate(ptr, destroy, unsigned int initialRefcount, unsigned int flags): + """ Create a user object. - The source and destination memory in `pNodeParams` must be allocated - from the same contexts as the original source and destination memory. - Both the instantiation-time memory operands and the memory operands in - `pNodeParams` must be 1-dimensional. Zero-length operations are not - supported. + Create a user object with the specified destructor callback and initial + reference count. The initial references are owned by the caller. - The modifications only affect future launches of `hGraphExec`. Already - enqueued or running launches of `hGraphExec` are not affected by this - call. `node` is also not modified by this call. + Destructor callbacks cannot make CUDA API calls and should avoid + blocking behavior, as they are executed by a shared internal thread. + Another thread may be signaled to perform such actions, if it does not + block forward progress of tasks scheduled through CUDA. - Returns :py:obj:`~.cudaErrorInvalidValue` if the memory operands' - mappings changed or either the original or new memory operands are - multidimensional. + See CUDA User Objects in the CUDA C++ Programming Guide for more + information on user objects. Parameters ---------- - hGraphExec : :py:obj:`~.CUgraphExec` or :py:obj:`~.cudaGraphExec_t` - The executable graph in which to set the specified node - node : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` - Memcpy node from the graph which was used to instantiate graphExec - pNodeParams : :py:obj:`~.cudaMemcpy3DParms` - Updated Parameters to set + ptr : Any + The pointer to pass to the destroy function + destroy : :py:obj:`~.cudaHostFn_t` + Callback to free the user object when it is no longer in use + initialRefcount : unsigned int + The initial refcount to create the object with, typically 1. The + initial references are owned by the calling thread. + flags : unsigned int + Currently it is required to pass + :py:obj:`~.cudaUserObjectNoDestructorSync`, which is the only + defined flag. This indicates that the destroy callback cannot be + waited on by any CUDA API. Users requiring synchronization of the + callback should signal its completion manually. Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + object_out : :py:obj:`~.cudaUserObject_t` + Location to return the user object handle See Also -------- - :py:obj:`~.cudaGraphExecNodeSetParams`, :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphMemcpyNodeSetParams`, :py:obj:`~.cudaGraphExecMemcpyNodeSetParamsToSymbol`, :py:obj:`~.cudaGraphExecMemcpyNodeSetParamsFromSymbol`, :py:obj:`~.cudaGraphExecMemcpyNodeSetParams1D`, :py:obj:`~.cudaGraphExecKernelNodeSetParams`, :py:obj:`~.cudaGraphExecMemsetNodeSetParams`, :py:obj:`~.cudaGraphExecHostNodeSetParams`, :py:obj:`~.cudaGraphExecChildGraphNodeSetParams`, :py:obj:`~.cudaGraphExecEventRecordNodeSetEvent`, :py:obj:`~.cudaGraphExecEventWaitNodeSetEvent`, :py:obj:`~.cudaGraphExecExternalSemaphoresSignalNodeSetParams`, :py:obj:`~.cudaGraphExecExternalSemaphoresWaitNodeSetParams`, :py:obj:`~.cudaGraphExecUpdate`, :py:obj:`~.cudaGraphInstantiate` + :py:obj:`~.cudaUserObjectRetain`, :py:obj:`~.cudaUserObjectRelease`, :py:obj:`~.cudaGraphRetainUserObject`, :py:obj:`~.cudaGraphReleaseUserObject`, :py:obj:`~.cudaGraphCreate` """ - cdef ccudart.cudaGraphNode_t cnode - if node is None: - cnode = 0 - elif isinstance(node, (cudaGraphNode_t,cuda.CUgraphNode)): - pnode = int(node) - cnode = pnode - else: - pnode = int(cudaGraphNode_t(node)) - cnode = pnode - cdef ccudart.cudaGraphExec_t chGraphExec - if hGraphExec is None: - chGraphExec = 0 - elif isinstance(hGraphExec, (cudaGraphExec_t,cuda.CUgraphExec)): - phGraphExec = int(hGraphExec) - chGraphExec = phGraphExec + cdef cyruntime.cudaHostFn_t cydestroy + if destroy is None: + pdestroy = 0 + elif isinstance(destroy, (cudaHostFn_t,)): + pdestroy = int(destroy) else: - phGraphExec = int(cudaGraphExec_t(hGraphExec)) - chGraphExec = phGraphExec - cdef ccudart.cudaMemcpy3DParms* cpNodeParams_ptr = pNodeParams._ptr if pNodeParams != None else NULL - err = ccudart.cudaGraphExecMemcpyNodeSetParams(chGraphExec, cnode, cpNodeParams_ptr) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaGraphExecMemcpyNodeSetParams1D' in found_functions}} + pdestroy = int(cudaHostFn_t(destroy)) + cydestroy = pdestroy + cdef cudaUserObject_t object_out = cudaUserObject_t() + cdef _HelperInputVoidPtrStruct cyptrHelper + cdef void* cyptr = _helper_input_void_ptr(ptr, &cyptrHelper) + with nogil: + err = cyruntime.cudaUserObjectCreate(object_out._pvt_ptr, cyptr, cydestroy, initialRefcount, flags) + _helper_input_void_ptr_free(&cyptrHelper) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, object_out) @cython.embedsignature(True) -def cudaGraphExecMemcpyNodeSetParams1D(hGraphExec, node, dst, src, size_t count, kind not None : cudaMemcpyKind): - """ Sets the parameters for a memcpy node in the given graphExec to perform a 1-dimensional copy. - - Updates the work represented by `node` in `hGraphExec` as though `node` - had contained the given params at instantiation. `node` must remain in - the graph which was used to instantiate `hGraphExec`. Changed edges to - and from `node` are ignored. - - `src` and `dst` must be allocated from the same contexts as the - original source and destination memory. The instantiation-time memory - operands must be 1-dimensional. Zero-length operations are not - supported. +def cudaUserObjectRetain(object, unsigned int count): + """ Retain a reference to a user object. - The modifications only affect future launches of `hGraphExec`. Already - enqueued or running launches of `hGraphExec` are not affected by this - call. `node` is also not modified by this call. + Retains new references to a user object. The new references are owned + by the caller. - Returns :py:obj:`~.cudaErrorInvalidValue` if the memory operands' - mappings changed or the original memory operands are multidimensional. + See CUDA User Objects in the CUDA C++ Programming Guide for more + information on user objects. Parameters ---------- - hGraphExec : :py:obj:`~.CUgraphExec` or :py:obj:`~.cudaGraphExec_t` - The executable graph in which to set the specified node - node : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` - Memcpy node from the graph which was used to instantiate graphExec - dst : Any - Destination memory address - src : Any - Source memory address - count : size_t - Size in bytes to copy - kind : :py:obj:`~.cudaMemcpyKind` - Type of transfer + object : :py:obj:`~.cudaUserObject_t` + The object to retain + count : unsigned int + The number of references to retain, typically 1. Must be nonzero + and not larger than INT_MAX. Returns ------- @@ -28805,1774 +37008,2257 @@ def cudaGraphExecMemcpyNodeSetParams1D(hGraphExec, node, dst, src, size_t count, See Also -------- - :py:obj:`~.cudaGraphAddMemcpyNode`, :py:obj:`~.cudaGraphAddMemcpyNode1D`, :py:obj:`~.cudaGraphMemcpyNodeSetParams`, :py:obj:`~.cudaGraphMemcpyNodeSetParams1D`, :py:obj:`~.cudaGraphExecMemcpyNodeSetParams`, :py:obj:`~.cudaGraphExecKernelNodeSetParams`, :py:obj:`~.cudaGraphExecMemsetNodeSetParams`, :py:obj:`~.cudaGraphExecHostNodeSetParams`, :py:obj:`~.cudaGraphExecChildGraphNodeSetParams`, :py:obj:`~.cudaGraphExecEventRecordNodeSetEvent`, :py:obj:`~.cudaGraphExecEventWaitNodeSetEvent`, :py:obj:`~.cudaGraphExecExternalSemaphoresSignalNodeSetParams`, :py:obj:`~.cudaGraphExecExternalSemaphoresWaitNodeSetParams`, :py:obj:`~.cudaGraphExecUpdate`, :py:obj:`~.cudaGraphInstantiate` + :py:obj:`~.cudaUserObjectCreate`, :py:obj:`~.cudaUserObjectRelease`, :py:obj:`~.cudaGraphRetainUserObject`, :py:obj:`~.cudaGraphReleaseUserObject`, :py:obj:`~.cudaGraphCreate` """ - cdef ccudart.cudaGraphNode_t cnode - if node is None: - cnode = 0 - elif isinstance(node, (cudaGraphNode_t,cuda.CUgraphNode)): - pnode = int(node) - cnode = pnode - else: - pnode = int(cudaGraphNode_t(node)) - cnode = pnode - cdef ccudart.cudaGraphExec_t chGraphExec - if hGraphExec is None: - chGraphExec = 0 - elif isinstance(hGraphExec, (cudaGraphExec_t,cuda.CUgraphExec)): - phGraphExec = int(hGraphExec) - chGraphExec = phGraphExec + cdef cyruntime.cudaUserObject_t cyobject + if object is None: + pobject = 0 + elif isinstance(object, (cudaUserObject_t,driver.CUuserObject)): + pobject = int(object) else: - phGraphExec = int(cudaGraphExec_t(hGraphExec)) - chGraphExec = phGraphExec - cdst = utils.HelperInputVoidPtr(dst) - cdef void* cdst_ptr = cdst.cptr - csrc = utils.HelperInputVoidPtr(src) - cdef void* csrc_ptr = csrc.cptr - cdef ccudart.cudaMemcpyKind ckind = kind.value - err = ccudart.cudaGraphExecMemcpyNodeSetParams1D(chGraphExec, cnode, cdst_ptr, csrc_ptr, count, ckind) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaGraphExecMemsetNodeSetParams' in found_functions}} + pobject = int(cudaUserObject_t(object)) + cyobject = pobject + with nogil: + err = cyruntime.cudaUserObjectRetain(cyobject, count) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaGraphExecMemsetNodeSetParams(hGraphExec, node, pNodeParams : Optional[cudaMemsetParams]): - """ Sets the parameters for a memset node in the given graphExec. - - Updates the work represented by `node` in `hGraphExec` as though `node` - had contained `pNodeParams` at instantiation. `node` must remain in the - graph which was used to instantiate `hGraphExec`. Changed edges to and - from `node` are ignored. +def cudaUserObjectRelease(object, unsigned int count): + """ Release a reference to a user object. - The destination memory in `pNodeParams` must be allocated from the same - context as the original destination memory. Both the instantiation-time - memory operand and the memory operand in `pNodeParams` must be - 1-dimensional. Zero-length operations are not supported. + Releases user object references owned by the caller. The object's + destructor is invoked if the reference count reaches zero. - The modifications only affect future launches of `hGraphExec`. Already - enqueued or running launches of `hGraphExec` are not affected by this - call. `node` is also not modified by this call. + It is undefined behavior to release references not owned by the caller, + or to use a user object handle after all references are released. - Returns cudaErrorInvalidValue if the memory operand's mappings changed - or either the original or new memory operand are multidimensional. + See CUDA User Objects in the CUDA C++ Programming Guide for more + information on user objects. Parameters ---------- - hGraphExec : :py:obj:`~.CUgraphExec` or :py:obj:`~.cudaGraphExec_t` - The executable graph in which to set the specified node - node : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` - Memset node from the graph which was used to instantiate graphExec - pNodeParams : :py:obj:`~.cudaMemsetParams` - Updated Parameters to set + object : :py:obj:`~.cudaUserObject_t` + The object to release + count : unsigned int + The number of references to release, typically 1. Must be nonzero + and not larger than INT_MAX. Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` See Also -------- - :py:obj:`~.cudaGraphExecNodeSetParams`, :py:obj:`~.cudaGraphAddMemsetNode`, :py:obj:`~.cudaGraphMemsetNodeSetParams`, :py:obj:`~.cudaGraphExecKernelNodeSetParams`, :py:obj:`~.cudaGraphExecMemcpyNodeSetParams`, :py:obj:`~.cudaGraphExecHostNodeSetParams`, :py:obj:`~.cudaGraphExecChildGraphNodeSetParams`, :py:obj:`~.cudaGraphExecEventRecordNodeSetEvent`, :py:obj:`~.cudaGraphExecEventWaitNodeSetEvent`, :py:obj:`~.cudaGraphExecExternalSemaphoresSignalNodeSetParams`, :py:obj:`~.cudaGraphExecExternalSemaphoresWaitNodeSetParams`, :py:obj:`~.cudaGraphExecUpdate`, :py:obj:`~.cudaGraphInstantiate` + :py:obj:`~.cudaUserObjectCreate`, :py:obj:`~.cudaUserObjectRetain`, :py:obj:`~.cudaGraphRetainUserObject`, :py:obj:`~.cudaGraphReleaseUserObject`, :py:obj:`~.cudaGraphCreate` """ - cdef ccudart.cudaGraphNode_t cnode - if node is None: - cnode = 0 - elif isinstance(node, (cudaGraphNode_t,cuda.CUgraphNode)): - pnode = int(node) - cnode = pnode - else: - pnode = int(cudaGraphNode_t(node)) - cnode = pnode - cdef ccudart.cudaGraphExec_t chGraphExec - if hGraphExec is None: - chGraphExec = 0 - elif isinstance(hGraphExec, (cudaGraphExec_t,cuda.CUgraphExec)): - phGraphExec = int(hGraphExec) - chGraphExec = phGraphExec + cdef cyruntime.cudaUserObject_t cyobject + if object is None: + pobject = 0 + elif isinstance(object, (cudaUserObject_t,driver.CUuserObject)): + pobject = int(object) else: - phGraphExec = int(cudaGraphExec_t(hGraphExec)) - chGraphExec = phGraphExec - cdef ccudart.cudaMemsetParams* cpNodeParams_ptr = pNodeParams._ptr if pNodeParams != None else NULL - err = ccudart.cudaGraphExecMemsetNodeSetParams(chGraphExec, cnode, cpNodeParams_ptr) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaGraphExecHostNodeSetParams' in found_functions}} + pobject = int(cudaUserObject_t(object)) + cyobject = pobject + with nogil: + err = cyruntime.cudaUserObjectRelease(cyobject, count) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaGraphExecHostNodeSetParams(hGraphExec, node, pNodeParams : Optional[cudaHostNodeParams]): - """ Sets the parameters for a host node in the given graphExec. +def cudaGraphRetainUserObject(graph, object, unsigned int count, unsigned int flags): + """ Retain a reference to a user object from a graph. - Updates the work represented by `node` in `hGraphExec` as though `node` - had contained `pNodeParams` at instantiation. `node` must remain in the - graph which was used to instantiate `hGraphExec`. Changed edges to and - from `node` are ignored. + Creates or moves user object references that will be owned by a CUDA + graph. - The modifications only affect future launches of `hGraphExec`. Already - enqueued or running launches of `hGraphExec` are not affected by this - call. `node` is also not modified by this call. + See CUDA User Objects in the CUDA C++ Programming Guide for more + information on user objects. Parameters ---------- - hGraphExec : :py:obj:`~.CUgraphExec` or :py:obj:`~.cudaGraphExec_t` - The executable graph in which to set the specified node - node : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` - Host node from the graph which was used to instantiate graphExec - pNodeParams : :py:obj:`~.cudaHostNodeParams` - Updated Parameters to set + graph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` + The graph to associate the reference with + object : :py:obj:`~.cudaUserObject_t` + The user object to retain a reference for + count : unsigned int + The number of references to add to the graph, typically 1. Must be + nonzero and not larger than INT_MAX. + flags : unsigned int + The optional flag :py:obj:`~.cudaGraphUserObjectMove` transfers + references from the calling thread, rather than create new + references. Pass 0 to create new references. Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` See Also -------- - :py:obj:`~.cudaGraphExecNodeSetParams`, :py:obj:`~.cudaGraphAddHostNode`, :py:obj:`~.cudaGraphHostNodeSetParams`, :py:obj:`~.cudaGraphExecKernelNodeSetParams`, :py:obj:`~.cudaGraphExecMemcpyNodeSetParams`, :py:obj:`~.cudaGraphExecMemsetNodeSetParams`, :py:obj:`~.cudaGraphExecChildGraphNodeSetParams`, :py:obj:`~.cudaGraphExecEventRecordNodeSetEvent`, :py:obj:`~.cudaGraphExecEventWaitNodeSetEvent`, :py:obj:`~.cudaGraphExecExternalSemaphoresSignalNodeSetParams`, :py:obj:`~.cudaGraphExecExternalSemaphoresWaitNodeSetParams`, :py:obj:`~.cudaGraphExecUpdate`, :py:obj:`~.cudaGraphInstantiate` + :py:obj:`~.cudaUserObjectCreate` :py:obj:`~.cudaUserObjectRetain`, :py:obj:`~.cudaUserObjectRelease`, :py:obj:`~.cudaGraphReleaseUserObject`, :py:obj:`~.cudaGraphCreate` """ - cdef ccudart.cudaGraphNode_t cnode - if node is None: - cnode = 0 - elif isinstance(node, (cudaGraphNode_t,cuda.CUgraphNode)): - pnode = int(node) - cnode = pnode + cdef cyruntime.cudaUserObject_t cyobject + if object is None: + pobject = 0 + elif isinstance(object, (cudaUserObject_t,driver.CUuserObject)): + pobject = int(object) else: - pnode = int(cudaGraphNode_t(node)) - cnode = pnode - cdef ccudart.cudaGraphExec_t chGraphExec - if hGraphExec is None: - chGraphExec = 0 - elif isinstance(hGraphExec, (cudaGraphExec_t,cuda.CUgraphExec)): - phGraphExec = int(hGraphExec) - chGraphExec = phGraphExec + pobject = int(cudaUserObject_t(object)) + cyobject = pobject + cdef cyruntime.cudaGraph_t cygraph + if graph is None: + pgraph = 0 + elif isinstance(graph, (cudaGraph_t,driver.CUgraph)): + pgraph = int(graph) else: - phGraphExec = int(cudaGraphExec_t(hGraphExec)) - chGraphExec = phGraphExec - cdef ccudart.cudaHostNodeParams* cpNodeParams_ptr = pNodeParams._ptr if pNodeParams != None else NULL - err = ccudart.cudaGraphExecHostNodeSetParams(chGraphExec, cnode, cpNodeParams_ptr) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaGraphExecChildGraphNodeSetParams' in found_functions}} + pgraph = int(cudaGraph_t(graph)) + cygraph = pgraph + with nogil: + err = cyruntime.cudaGraphRetainUserObject(cygraph, cyobject, count, flags) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaGraphExecChildGraphNodeSetParams(hGraphExec, node, childGraph): - """ Updates node parameters in the child graph node in the given graphExec. - - Updates the work represented by `node` in `hGraphExec` as though the - nodes contained in `node's` graph had the parameters contained in - `childGraph's` nodes at instantiation. `node` must remain in the graph - which was used to instantiate `hGraphExec`. Changed edges to and from - `node` are ignored. +def cudaGraphReleaseUserObject(graph, object, unsigned int count): + """ Release a user object reference from a graph. - The modifications only affect future launches of `hGraphExec`. Already - enqueued or running launches of `hGraphExec` are not affected by this - call. `node` is also not modified by this call. + Releases user object references owned by a graph. - The topology of `childGraph`, as well as the node insertion order, must - match that of the graph contained in `node`. See - :py:obj:`~.cudaGraphExecUpdate()` for a list of restrictions on what - can be updated in an instantiated graph. The update is recursive, so - child graph nodes contained within the top level child graph will also - be updated. + See CUDA User Objects in the CUDA C++ Programming Guide for more + information on user objects. Parameters ---------- - hGraphExec : :py:obj:`~.CUgraphExec` or :py:obj:`~.cudaGraphExec_t` - The executable graph in which to set the specified node - node : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` - Host node from the graph which was used to instantiate graphExec - childGraph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` - The graph supplying the updated parameters + graph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` + The graph that will release the reference + object : :py:obj:`~.cudaUserObject_t` + The user object to release a reference for + count : unsigned int + The number of references to release, typically 1. Must be nonzero + and not larger than INT_MAX. Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` See Also -------- - :py:obj:`~.cudaGraphExecNodeSetParams`, :py:obj:`~.cudaGraphAddChildGraphNode`, :py:obj:`~.cudaGraphChildGraphNodeGetGraph`, :py:obj:`~.cudaGraphExecKernelNodeSetParams`, :py:obj:`~.cudaGraphExecMemcpyNodeSetParams`, :py:obj:`~.cudaGraphExecMemsetNodeSetParams`, :py:obj:`~.cudaGraphExecHostNodeSetParams`, :py:obj:`~.cudaGraphExecEventRecordNodeSetEvent`, :py:obj:`~.cudaGraphExecEventWaitNodeSetEvent`, :py:obj:`~.cudaGraphExecExternalSemaphoresSignalNodeSetParams`, :py:obj:`~.cudaGraphExecExternalSemaphoresWaitNodeSetParams`, :py:obj:`~.cudaGraphExecUpdate`, :py:obj:`~.cudaGraphInstantiate` + :py:obj:`~.cudaUserObjectCreate` :py:obj:`~.cudaUserObjectRetain`, :py:obj:`~.cudaUserObjectRelease`, :py:obj:`~.cudaGraphRetainUserObject`, :py:obj:`~.cudaGraphCreate` """ - cdef ccudart.cudaGraph_t cchildGraph - if childGraph is None: - cchildGraph = 0 - elif isinstance(childGraph, (cudaGraph_t,cuda.CUgraph)): - pchildGraph = int(childGraph) - cchildGraph = pchildGraph - else: - pchildGraph = int(cudaGraph_t(childGraph)) - cchildGraph = pchildGraph - cdef ccudart.cudaGraphNode_t cnode - if node is None: - cnode = 0 - elif isinstance(node, (cudaGraphNode_t,cuda.CUgraphNode)): - pnode = int(node) - cnode = pnode + cdef cyruntime.cudaUserObject_t cyobject + if object is None: + pobject = 0 + elif isinstance(object, (cudaUserObject_t,driver.CUuserObject)): + pobject = int(object) else: - pnode = int(cudaGraphNode_t(node)) - cnode = pnode - cdef ccudart.cudaGraphExec_t chGraphExec - if hGraphExec is None: - chGraphExec = 0 - elif isinstance(hGraphExec, (cudaGraphExec_t,cuda.CUgraphExec)): - phGraphExec = int(hGraphExec) - chGraphExec = phGraphExec + pobject = int(cudaUserObject_t(object)) + cyobject = pobject + cdef cyruntime.cudaGraph_t cygraph + if graph is None: + pgraph = 0 + elif isinstance(graph, (cudaGraph_t,driver.CUgraph)): + pgraph = int(graph) else: - phGraphExec = int(cudaGraphExec_t(hGraphExec)) - chGraphExec = phGraphExec - err = ccudart.cudaGraphExecChildGraphNodeSetParams(chGraphExec, cnode, cchildGraph) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaGraphExecEventRecordNodeSetEvent' in found_functions}} + pgraph = int(cudaGraph_t(graph)) + cygraph = pgraph + with nogil: + err = cyruntime.cudaGraphReleaseUserObject(cygraph, cyobject, count) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaGraphExecEventRecordNodeSetEvent(hGraphExec, hNode, event): - """ Sets the event for an event record node in the given graphExec. +def cudaGraphAddNode(graph, pDependencies : Optional[tuple[cudaGraphNode_t] | list[cudaGraphNode_t]], dependencyData : Optional[tuple[cudaGraphEdgeData] | list[cudaGraphEdgeData]], size_t numDependencies, nodeParams : Optional[cudaGraphNodeParams]): + """ Adds a node of arbitrary type to a graph. - Sets the event of an event record node in an executable graph - `hGraphExec`. The node is identified by the corresponding node `hNode` - in the non-executable graph, from which the executable graph was - instantiated. + Creates a new node in `graph` described by `nodeParams` with + `numDependencies` dependencies specified via `pDependencies`. + `numDependencies` may be 0. `pDependencies` may be null if + `numDependencies` is 0. `pDependencies` may not have any duplicate + entries. - The modifications only affect future launches of `hGraphExec`. Already - enqueued or running launches of `hGraphExec` are not affected by this - call. `hNode` is also not modified by this call. + `nodeParams` is a tagged union. The node type should be specified in + the `typename` field, and type-specific parameters in the corresponding + union member. All unused bytes - that is, `reserved0` and all bytes + past the utilized union member - must be set to zero. It is recommended + to use brace initialization or memset to ensure all bytes are + initialized. + + Note that for some node types, `nodeParams` may contain "out + parameters" which are modified during the call, such as + `nodeParams->alloc.dptr`. + + A handle to the new node will be returned in `phGraphNode`. Parameters ---------- - hGraphExec : :py:obj:`~.CUgraphExec` or :py:obj:`~.cudaGraphExec_t` - The executable graph in which to set the specified node - hNode : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` - Event record node from the graph from which graphExec was - instantiated - event : :py:obj:`~.CUevent` or :py:obj:`~.cudaEvent_t` - Updated event to use + graph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` + Graph to which to add the node + pDependencies : list[:py:obj:`~.cudaGraphNode_t`] + Dependencies of the node + dependencyData : list[:py:obj:`~.cudaGraphEdgeData`] + Optional edge data for the dependencies. If NULL, the data is + assumed to be default (zeroed) for all dependencies. + numDependencies : size_t + Number of dependencies + nodeParams : :py:obj:`~.cudaGraphNodeParams` + Specification of the node Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidDeviceFunction`, :py:obj:`~.cudaErrorNotSupported` + pGraphNode : :py:obj:`~.cudaGraphNode_t` + Returns newly created node See Also -------- - :py:obj:`~.cudaGraphExecNodeSetParams`, :py:obj:`~.cudaGraphAddEventRecordNode`, :py:obj:`~.cudaGraphEventRecordNodeGetEvent`, :py:obj:`~.cudaGraphEventWaitNodeSetEvent`, :py:obj:`~.cudaEventRecordWithFlags`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cudaGraphExecKernelNodeSetParams`, :py:obj:`~.cudaGraphExecMemcpyNodeSetParams`, :py:obj:`~.cudaGraphExecMemsetNodeSetParams`, :py:obj:`~.cudaGraphExecHostNodeSetParams`, :py:obj:`~.cudaGraphExecChildGraphNodeSetParams`, :py:obj:`~.cudaGraphExecEventWaitNodeSetEvent`, :py:obj:`~.cudaGraphExecExternalSemaphoresSignalNodeSetParams`, :py:obj:`~.cudaGraphExecExternalSemaphoresWaitNodeSetParams`, :py:obj:`~.cudaGraphExecUpdate`, :py:obj:`~.cudaGraphInstantiate` + :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphNodeSetParams`, :py:obj:`~.cudaGraphExecNodeSetParams` """ - cdef ccudart.cudaEvent_t cevent - if event is None: - cevent = 0 - elif isinstance(event, (cudaEvent_t,cuda.CUevent)): - pevent = int(event) - cevent = pevent - else: - pevent = int(cudaEvent_t(event)) - cevent = pevent - cdef ccudart.cudaGraphNode_t chNode - if hNode is None: - chNode = 0 - elif isinstance(hNode, (cudaGraphNode_t,cuda.CUgraphNode)): - phNode = int(hNode) - chNode = phNode - else: - phNode = int(cudaGraphNode_t(hNode)) - chNode = phNode - cdef ccudart.cudaGraphExec_t chGraphExec - if hGraphExec is None: - chGraphExec = 0 - elif isinstance(hGraphExec, (cudaGraphExec_t,cuda.CUgraphExec)): - phGraphExec = int(hGraphExec) - chGraphExec = phGraphExec + dependencyData = [] if dependencyData is None else dependencyData + if not all(isinstance(_x, (cudaGraphEdgeData,)) for _x in dependencyData): + raise TypeError("Argument 'dependencyData' is not instance of type (expected tuple[cyruntime.cudaGraphEdgeData,] or list[cyruntime.cudaGraphEdgeData,]") + pDependencies = [] if pDependencies is None else pDependencies + if not all(isinstance(_x, (cudaGraphNode_t,driver.CUgraphNode)) for _x in pDependencies): + raise TypeError("Argument 'pDependencies' is not instance of type (expected tuple[cyruntime.cudaGraphNode_t,driver.CUgraphNode] or list[cyruntime.cudaGraphNode_t,driver.CUgraphNode]") + cdef cyruntime.cudaGraph_t cygraph + if graph is None: + pgraph = 0 + elif isinstance(graph, (cudaGraph_t,driver.CUgraph)): + pgraph = int(graph) else: - phGraphExec = int(cudaGraphExec_t(hGraphExec)) - chGraphExec = phGraphExec - err = ccudart.cudaGraphExecEventRecordNodeSetEvent(chGraphExec, chNode, cevent) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaGraphExecEventWaitNodeSetEvent' in found_functions}} + pgraph = int(cudaGraph_t(graph)) + cygraph = pgraph + cdef cudaGraphNode_t pGraphNode = cudaGraphNode_t() + cdef cyruntime.cudaGraphNode_t* cypDependencies = NULL + if len(pDependencies) > 1: + cypDependencies = calloc(len(pDependencies), sizeof(cyruntime.cudaGraphNode_t)) + if cypDependencies is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(pDependencies)) + 'x' + str(sizeof(cyruntime.cudaGraphNode_t))) + else: + for idx in range(len(pDependencies)): + cypDependencies[idx] = (pDependencies[idx])._pvt_ptr[0] + elif len(pDependencies) == 1: + cypDependencies = (pDependencies[0])._pvt_ptr + cdef cyruntime.cudaGraphEdgeData* cydependencyData = NULL + if len(dependencyData) > 1: + cydependencyData = calloc(len(dependencyData), sizeof(cyruntime.cudaGraphEdgeData)) + if cydependencyData is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(dependencyData)) + 'x' + str(sizeof(cyruntime.cudaGraphEdgeData))) + for idx in range(len(dependencyData)): + string.memcpy(&cydependencyData[idx], (dependencyData[idx])._pvt_ptr, sizeof(cyruntime.cudaGraphEdgeData)) + elif len(dependencyData) == 1: + cydependencyData = (dependencyData[0])._pvt_ptr + cdef cyruntime.cudaGraphNodeParams* cynodeParams_ptr = nodeParams._pvt_ptr if nodeParams is not None else NULL + with nogil: + err = cyruntime.cudaGraphAddNode(pGraphNode._pvt_ptr, cygraph, cypDependencies, cydependencyData, numDependencies, cynodeParams_ptr) + if len(pDependencies) > 1 and cypDependencies is not NULL: + free(cypDependencies) + if len(dependencyData) > 1 and cydependencyData is not NULL: + free(cydependencyData) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, pGraphNode) @cython.embedsignature(True) -def cudaGraphExecEventWaitNodeSetEvent(hGraphExec, hNode, event): - """ Sets the event for an event wait node in the given graphExec. +def cudaGraphNodeSetParams(node, nodeParams : Optional[cudaGraphNodeParams]): + """ Update a graph node's parameters. - Sets the event of an event wait node in an executable graph - `hGraphExec`. The node is identified by the corresponding node `hNode` - in the non-executable graph, from which the executable graph was - instantiated. + Sets the parameters of graph node `node` to `nodeParams`. The node type + specified by `nodeParams->type` must match the type of `node`. + `nodeParams` must be fully initialized and all unused bytes (reserved, + padding) zeroed. - The modifications only affect future launches of `hGraphExec`. Already - enqueued or running launches of `hGraphExec` are not affected by this - call. `hNode` is also not modified by this call. + Modifying parameters is not supported for node types + cudaGraphNodeTypeMemAlloc and cudaGraphNodeTypeMemFree. Parameters ---------- - hGraphExec : :py:obj:`~.CUgraphExec` or :py:obj:`~.cudaGraphExec_t` - The executable graph in which to set the specified node - hNode : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` - Event wait node from the graph from which graphExec was - instantiated - event : :py:obj:`~.CUevent` or :py:obj:`~.cudaEvent_t` - Updated event to use + node : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` + Node to set the parameters for + nodeParams : :py:obj:`~.cudaGraphNodeParams` + Parameters to copy Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidDeviceFunction`, :py:obj:`~.cudaErrorNotSupported` See Also -------- - :py:obj:`~.cudaGraphExecNodeSetParams`, :py:obj:`~.cudaGraphAddEventWaitNode`, :py:obj:`~.cudaGraphEventWaitNodeGetEvent`, :py:obj:`~.cudaGraphEventRecordNodeSetEvent`, :py:obj:`~.cudaEventRecordWithFlags`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cudaGraphExecKernelNodeSetParams`, :py:obj:`~.cudaGraphExecMemcpyNodeSetParams`, :py:obj:`~.cudaGraphExecMemsetNodeSetParams`, :py:obj:`~.cudaGraphExecHostNodeSetParams`, :py:obj:`~.cudaGraphExecChildGraphNodeSetParams`, :py:obj:`~.cudaGraphExecEventRecordNodeSetEvent`, :py:obj:`~.cudaGraphExecExternalSemaphoresSignalNodeSetParams`, :py:obj:`~.cudaGraphExecExternalSemaphoresWaitNodeSetParams`, :py:obj:`~.cudaGraphExecUpdate`, :py:obj:`~.cudaGraphInstantiate` + :py:obj:`~.cudaGraphNodeGetParams`, :py:obj:`~.cudaGraphAddNode`, :py:obj:`~.cudaGraphExecNodeSetParams` """ - cdef ccudart.cudaEvent_t cevent - if event is None: - cevent = 0 - elif isinstance(event, (cudaEvent_t,cuda.CUevent)): - pevent = int(event) - cevent = pevent - else: - pevent = int(cudaEvent_t(event)) - cevent = pevent - cdef ccudart.cudaGraphNode_t chNode - if hNode is None: - chNode = 0 - elif isinstance(hNode, (cudaGraphNode_t,cuda.CUgraphNode)): - phNode = int(hNode) - chNode = phNode - else: - phNode = int(cudaGraphNode_t(hNode)) - chNode = phNode - cdef ccudart.cudaGraphExec_t chGraphExec - if hGraphExec is None: - chGraphExec = 0 - elif isinstance(hGraphExec, (cudaGraphExec_t,cuda.CUgraphExec)): - phGraphExec = int(hGraphExec) - chGraphExec = phGraphExec + cdef cyruntime.cudaGraphNode_t cynode + if node is None: + pnode = 0 + elif isinstance(node, (cudaGraphNode_t,driver.CUgraphNode)): + pnode = int(node) else: - phGraphExec = int(cudaGraphExec_t(hGraphExec)) - chGraphExec = phGraphExec - err = ccudart.cudaGraphExecEventWaitNodeSetEvent(chGraphExec, chNode, cevent) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaGraphExecExternalSemaphoresSignalNodeSetParams' in found_functions}} + pnode = int(cudaGraphNode_t(node)) + cynode = pnode + cdef cyruntime.cudaGraphNodeParams* cynodeParams_ptr = nodeParams._pvt_ptr if nodeParams is not None else NULL + with nogil: + err = cyruntime.cudaGraphNodeSetParams(cynode, cynodeParams_ptr) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaGraphExecExternalSemaphoresSignalNodeSetParams(hGraphExec, hNode, nodeParams : Optional[cudaExternalSemaphoreSignalNodeParams]): - """ Sets the parameters for an external semaphore signal node in the given graphExec. +def cudaGraphNodeGetParams(node): + """ Returns a graph node's parameters. - Sets the parameters of an external semaphore signal node in an - executable graph `hGraphExec`. The node is identified by the - corresponding node `hNode` in the non-executable graph, from which the - executable graph was instantiated. + Returns the parameters of graph node `node` in `*nodeParams`. - `hNode` must not have been removed from the original graph. - - The modifications only affect future launches of `hGraphExec`. Already - enqueued or running launches of `hGraphExec` are not affected by this - call. `hNode` is also not modified by this call. + Any pointers returned in `*nodeParams` point to driver-owned memory + associated with the node. This memory remains valid until the node is + destroyed. Any memory pointed to from `*nodeParams` must not be + modified. - Changing `nodeParams->numExtSems` is not supported. + The returned parameters are a description of the node, but may not be + identical to the struct provided at creation and may not be suitable + for direct creation of identical nodes. This is because parameters may + be partially unspecified and filled in by the driver at creation, may + reference non-copyable handles, or may describe ownership semantics or + other parameters that govern behavior of node creation but are not part + of the final functional descriptor. Parameters ---------- - hGraphExec : :py:obj:`~.CUgraphExec` or :py:obj:`~.cudaGraphExec_t` - The executable graph in which to set the specified node - hNode : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` - semaphore signal node from the graph from which graphExec was - instantiated - nodeParams : :py:obj:`~.cudaExternalSemaphoreSignalNodeParams` - Updated Parameters to set + node : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` + Node to get the parameters for Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorNotSupported` + nodeParams : :py:obj:`~.cudaGraphNodeParams` + Pointer to return the parameters See Also -------- - :py:obj:`~.cudaGraphExecNodeSetParams`, :py:obj:`~.cudaGraphAddExternalSemaphoresSignalNode`, :py:obj:`~.cudaImportExternalSemaphore`, :py:obj:`~.cudaSignalExternalSemaphoresAsync`, :py:obj:`~.cudaWaitExternalSemaphoresAsync`, :py:obj:`~.cudaGraphExecKernelNodeSetParams`, :py:obj:`~.cudaGraphExecMemcpyNodeSetParams`, :py:obj:`~.cudaGraphExecMemsetNodeSetParams`, :py:obj:`~.cudaGraphExecHostNodeSetParams`, :py:obj:`~.cudaGraphExecChildGraphNodeSetParams`, :py:obj:`~.cudaGraphExecEventRecordNodeSetEvent`, :py:obj:`~.cudaGraphExecEventWaitNodeSetEvent`, :py:obj:`~.cudaGraphExecExternalSemaphoresWaitNodeSetParams`, :py:obj:`~.cudaGraphExecUpdate`, :py:obj:`~.cudaGraphInstantiate` + :py:obj:`~.cudaGraphNodeGetParams`, :py:obj:`~.cudaGraphNodeSetParams`, :py:obj:`~.cudaGraphAddNode`, :py:obj:`~.cudaGraphExecNodeSetParams` """ - cdef ccudart.cudaGraphNode_t chNode - if hNode is None: - chNode = 0 - elif isinstance(hNode, (cudaGraphNode_t,cuda.CUgraphNode)): - phNode = int(hNode) - chNode = phNode - else: - phNode = int(cudaGraphNode_t(hNode)) - chNode = phNode - cdef ccudart.cudaGraphExec_t chGraphExec - if hGraphExec is None: - chGraphExec = 0 - elif isinstance(hGraphExec, (cudaGraphExec_t,cuda.CUgraphExec)): - phGraphExec = int(hGraphExec) - chGraphExec = phGraphExec + cdef cyruntime.cudaGraphNode_t cynode + if node is None: + pnode = 0 + elif isinstance(node, (cudaGraphNode_t,driver.CUgraphNode)): + pnode = int(node) else: - phGraphExec = int(cudaGraphExec_t(hGraphExec)) - chGraphExec = phGraphExec - cdef ccudart.cudaExternalSemaphoreSignalNodeParams* cnodeParams_ptr = nodeParams._ptr if nodeParams != None else NULL - err = ccudart.cudaGraphExecExternalSemaphoresSignalNodeSetParams(chGraphExec, chNode, cnodeParams_ptr) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaGraphExecExternalSemaphoresWaitNodeSetParams' in found_functions}} + pnode = int(cudaGraphNode_t(node)) + cynode = pnode + cdef cudaGraphNodeParams nodeParams = cudaGraphNodeParams() + with nogil: + err = cyruntime.cudaGraphNodeGetParams(cynode, nodeParams._pvt_ptr) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, nodeParams) @cython.embedsignature(True) -def cudaGraphExecExternalSemaphoresWaitNodeSetParams(hGraphExec, hNode, nodeParams : Optional[cudaExternalSemaphoreWaitNodeParams]): - """ Sets the parameters for an external semaphore wait node in the given graphExec. +def cudaGraphExecNodeSetParams(graphExec, node, nodeParams : Optional[cudaGraphNodeParams]): + """ Update a graph node's parameters in an instantiated graph. - Sets the parameters of an external semaphore wait node in an executable - graph `hGraphExec`. The node is identified by the corresponding node - `hNode` in the non-executable graph, from which the executable graph - was instantiated. + Sets the parameters of a node in an executable graph `graphExec`. The + node is identified by the corresponding node `node` in the non- + executable graph from which the executable graph was instantiated. + `node` must not have been removed from the original graph. - `hNode` must not have been removed from the original graph. + The modifications only affect future launches of `graphExec`. Already + enqueued or running launches of `graphExec` are not affected by this + call. `node` is also not modified by this call. - The modifications only affect future launches of `hGraphExec`. Already - enqueued or running launches of `hGraphExec` are not affected by this - call. `hNode` is also not modified by this call. + Allowed changes to parameters on executable graphs are as follows: - Changing `nodeParams->numExtSems` is not supported. + **View CUDA Toolkit Documentation for a table example** Parameters ---------- - hGraphExec : :py:obj:`~.CUgraphExec` or :py:obj:`~.cudaGraphExec_t` - The executable graph in which to set the specified node - hNode : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` - semaphore wait node from the graph from which graphExec was + graphExec : :py:obj:`~.CUgraphExec` or :py:obj:`~.cudaGraphExec_t` + The executable graph in which to update the specified node + node : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` + Corresponding node from the graph from which graphExec was instantiated - nodeParams : :py:obj:`~.cudaExternalSemaphoreWaitNodeParams` + nodeParams : :py:obj:`~.cudaGraphNodeParams` Updated Parameters to set Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidDeviceFunction`, :py:obj:`~.cudaErrorNotSupported` See Also -------- - :py:obj:`~.cudaGraphExecNodeSetParams`, :py:obj:`~.cudaGraphAddExternalSemaphoresWaitNode`, :py:obj:`~.cudaImportExternalSemaphore`, :py:obj:`~.cudaSignalExternalSemaphoresAsync`, :py:obj:`~.cudaWaitExternalSemaphoresAsync`, :py:obj:`~.cudaGraphExecKernelNodeSetParams`, :py:obj:`~.cudaGraphExecMemcpyNodeSetParams`, :py:obj:`~.cudaGraphExecMemsetNodeSetParams`, :py:obj:`~.cudaGraphExecHostNodeSetParams`, :py:obj:`~.cudaGraphExecChildGraphNodeSetParams`, :py:obj:`~.cudaGraphExecEventRecordNodeSetEvent`, :py:obj:`~.cudaGraphExecEventWaitNodeSetEvent`, :py:obj:`~.cudaGraphExecExternalSemaphoresSignalNodeSetParams`, :py:obj:`~.cudaGraphExecUpdate`, :py:obj:`~.cudaGraphInstantiate` + :py:obj:`~.cudaGraphAddNode`, :py:obj:`~.cudaGraphNodeSetParams` :py:obj:`~.cudaGraphExecUpdate`, :py:obj:`~.cudaGraphInstantiate` """ - cdef ccudart.cudaGraphNode_t chNode - if hNode is None: - chNode = 0 - elif isinstance(hNode, (cudaGraphNode_t,cuda.CUgraphNode)): - phNode = int(hNode) - chNode = phNode + cdef cyruntime.cudaGraphNode_t cynode + if node is None: + pnode = 0 + elif isinstance(node, (cudaGraphNode_t,driver.CUgraphNode)): + pnode = int(node) else: - phNode = int(cudaGraphNode_t(hNode)) - chNode = phNode - cdef ccudart.cudaGraphExec_t chGraphExec - if hGraphExec is None: - chGraphExec = 0 - elif isinstance(hGraphExec, (cudaGraphExec_t,cuda.CUgraphExec)): - phGraphExec = int(hGraphExec) - chGraphExec = phGraphExec + pnode = int(cudaGraphNode_t(node)) + cynode = pnode + cdef cyruntime.cudaGraphExec_t cygraphExec + if graphExec is None: + pgraphExec = 0 + elif isinstance(graphExec, (cudaGraphExec_t,driver.CUgraphExec)): + pgraphExec = int(graphExec) else: - phGraphExec = int(cudaGraphExec_t(hGraphExec)) - chGraphExec = phGraphExec - cdef ccudart.cudaExternalSemaphoreWaitNodeParams* cnodeParams_ptr = nodeParams._ptr if nodeParams != None else NULL - err = ccudart.cudaGraphExecExternalSemaphoresWaitNodeSetParams(chGraphExec, chNode, cnodeParams_ptr) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaGraphNodeSetEnabled' in found_functions}} + pgraphExec = int(cudaGraphExec_t(graphExec)) + cygraphExec = pgraphExec + cdef cyruntime.cudaGraphNodeParams* cynodeParams_ptr = nodeParams._pvt_ptr if nodeParams is not None else NULL + with nogil: + err = cyruntime.cudaGraphExecNodeSetParams(cygraphExec, cynode, cynodeParams_ptr) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaGraphNodeSetEnabled(hGraphExec, hNode, unsigned int isEnabled): - """ Enables or disables the specified node in the given graphExec. - - Sets `hNode` to be either enabled or disabled. Disabled nodes are - functionally equivalent to empty nodes until they are reenabled. - Existing node parameters are not affected by disabling/enabling the - node. +def cudaGraphConditionalHandleCreate(graph, unsigned int defaultLaunchValue, unsigned int flags): + """ Create a conditional handle. - The node is identified by the corresponding node `hNode` in the non- - executable graph, from which the executable graph was instantiated. + Creates a conditional handle associated with `hGraph`. - `hNode` must not have been removed from the original graph. + The conditional handle must be associated with a conditional node in + this graph or one of its children. - The modifications only affect future launches of `hGraphExec`. Already - enqueued or running launches of `hGraphExec` are not affected by this - call. `hNode` is also not modified by this call. + Handles not associated with a conditional node may cause graph + instantiation to fail. Parameters - ---------- - hGraphExec : :py:obj:`~.CUgraphExec` or :py:obj:`~.cudaGraphExec_t` - The executable graph in which to set the specified node - hNode : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` - Node from the graph from which graphExec was instantiated - isEnabled : unsigned int - Node is enabled if != 0, otherwise the node is disabled + ---------- + graph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` + Graph which will contain the conditional node using this handle. + defaultLaunchValue : unsigned int + Optional initial value for the conditional variable. Applied at the + beginning of each graph execution if cudaGraphCondAssignDefault is + set in `flags`. + flags : unsigned int + Currently must be cudaGraphCondAssignDefault or 0. Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_NOT_SUPPORTED` + pHandle_out : :py:obj:`~.cudaGraphConditionalHandle` + Pointer used to return the handle to the caller. See Also -------- - :py:obj:`~.cudaGraphNodeGetEnabled`, :py:obj:`~.cudaGraphExecUpdate`, :py:obj:`~.cudaGraphInstantiate` :py:obj:`~.cudaGraphLaunch` - - Notes - ----- - Currently only kernel, memset and memcpy nodes are supported. + :py:obj:`~.cuGraphAddNode`, """ - cdef ccudart.cudaGraphNode_t chNode - if hNode is None: - chNode = 0 - elif isinstance(hNode, (cudaGraphNode_t,cuda.CUgraphNode)): - phNode = int(hNode) - chNode = phNode - else: - phNode = int(cudaGraphNode_t(hNode)) - chNode = phNode - cdef ccudart.cudaGraphExec_t chGraphExec - if hGraphExec is None: - chGraphExec = 0 - elif isinstance(hGraphExec, (cudaGraphExec_t,cuda.CUgraphExec)): - phGraphExec = int(hGraphExec) - chGraphExec = phGraphExec + cdef cyruntime.cudaGraph_t cygraph + if graph is None: + pgraph = 0 + elif isinstance(graph, (cudaGraph_t,driver.CUgraph)): + pgraph = int(graph) else: - phGraphExec = int(cudaGraphExec_t(hGraphExec)) - chGraphExec = phGraphExec - err = ccudart.cudaGraphNodeSetEnabled(chGraphExec, chNode, isEnabled) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaGraphNodeGetEnabled' in found_functions}} + pgraph = int(cudaGraph_t(graph)) + cygraph = pgraph + cdef cudaGraphConditionalHandle pHandle_out = cudaGraphConditionalHandle() + with nogil: + err = cyruntime.cudaGraphConditionalHandleCreate(pHandle_out._pvt_ptr, cygraph, defaultLaunchValue, flags) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, pHandle_out) @cython.embedsignature(True) -def cudaGraphNodeGetEnabled(hGraphExec, hNode): - """ Query whether a node in the given graphExec is enabled. +def cudaGraphConditionalHandleCreate_v2(graph, ctx, unsigned int defaultLaunchValue, unsigned int flags): + """ Create a conditional handle. - Sets isEnabled to 1 if `hNode` is enabled, or 0 if `hNode` is disabled. + Creates a conditional handle associated with `hGraph`. - The node is identified by the corresponding node `hNode` in the non- - executable graph, from which the executable graph was instantiated. + The conditional handle must be associated with a conditional node in + this graph or one of its children. - `hNode` must not have been removed from the original graph. + Handles not associated with a conditional node may cause graph + instantiation to fail. Parameters ---------- - hGraphExec : :py:obj:`~.CUgraphExec` or :py:obj:`~.cudaGraphExec_t` - The executable graph in which to set the specified node - hNode : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` - Node from the graph from which graphExec was instantiated + graph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` + Graph which will contain the conditional node using this handle. + ctx : :py:obj:`~.cudaExecutionContext_t` + Execution context for the handle and associated conditional node. + If NULL, current context will be used. + defaultLaunchValue : unsigned int + Optional initial value for the conditional variable. Applied at the + beginning of each graph execution if cudaGraphCondAssignDefault is + set in `flags`. + flags : unsigned int + Currently must be cudaGraphCondAssignDefault or 0. Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, - isEnabled : unsigned int - Location to return the enabled status of the node + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_NOT_SUPPORTED` + pHandle_out : :py:obj:`~.cudaGraphConditionalHandle` + Pointer used to return the handle to the caller. See Also -------- - :py:obj:`~.cudaGraphNodeSetEnabled`, :py:obj:`~.cudaGraphExecUpdate`, :py:obj:`~.cudaGraphInstantiate` :py:obj:`~.cudaGraphLaunch` - - Notes - ----- - Currently only kernel, memset and memcpy nodes are supported. + :py:obj:`~.cuGraphAddNode`, """ - cdef ccudart.cudaGraphNode_t chNode - if hNode is None: - chNode = 0 - elif isinstance(hNode, (cudaGraphNode_t,cuda.CUgraphNode)): - phNode = int(hNode) - chNode = phNode + cdef cyruntime.cudaExecutionContext_t cyctx + if ctx is None: + pctx = 0 + elif isinstance(ctx, (cudaExecutionContext_t,)): + pctx = int(ctx) else: - phNode = int(cudaGraphNode_t(hNode)) - chNode = phNode - cdef ccudart.cudaGraphExec_t chGraphExec - if hGraphExec is None: - chGraphExec = 0 - elif isinstance(hGraphExec, (cudaGraphExec_t,cuda.CUgraphExec)): - phGraphExec = int(hGraphExec) - chGraphExec = phGraphExec + pctx = int(cudaExecutionContext_t(ctx)) + cyctx = pctx + cdef cyruntime.cudaGraph_t cygraph + if graph is None: + pgraph = 0 + elif isinstance(graph, (cudaGraph_t,driver.CUgraph)): + pgraph = int(graph) else: - phGraphExec = int(cudaGraphExec_t(hGraphExec)) - chGraphExec = phGraphExec - cdef unsigned int isEnabled = 0 - err = ccudart.cudaGraphNodeGetEnabled(chGraphExec, chNode, &isEnabled) - return (cudaError_t(err), isEnabled) -{{endif}} - -{{if 'cudaGraphExecUpdate' in found_functions}} + pgraph = int(cudaGraph_t(graph)) + cygraph = pgraph + cdef cudaGraphConditionalHandle pHandle_out = cudaGraphConditionalHandle() + with nogil: + err = cyruntime.cudaGraphConditionalHandleCreate_v2(pHandle_out._pvt_ptr, cygraph, cyctx, defaultLaunchValue, flags) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, pHandle_out) @cython.embedsignature(True) -def cudaGraphExecUpdate(hGraphExec, hGraph): - """ Check whether an executable graph can be updated with a graph and perform the update if possible. +def cudaGetDriverEntryPoint(char* symbol, unsigned long long flags): + """ Returns the requested driver API function pointer. - Updates the node parameters in the instantiated graph specified by - `hGraphExec` with the node parameters in a topologically identical - graph specified by `hGraph`. + [Deprecated] - Limitations: + Returns in `**funcPtr` the address of the CUDA driver function for the + requested flags. - - Kernel nodes: + For a requested driver symbol, if the CUDA version in which the driver + symbol was introduced is less than or equal to the CUDA runtime + version, the API will return the function pointer to the corresponding + versioned driver function. - - The owning context of the function cannot change. + The pointer returned by the API should be cast to a function pointer + matching the requested driver function's definition in the API header + file. The function pointer typedef can be picked up from the + corresponding typedefs header file. For example, cudaTypedefs.h + consists of function pointer typedefs for driver APIs defined in + cuda.h. - - A node whose function originally did not use CUDA dynamic - parallelism cannot be updated to a function which uses CDP. + The API will return :py:obj:`~.cudaSuccess` and set the returned + `funcPtr` if the requested driver function is valid and supported on + the platform. - - A node whose function originally did not make device-side update - calls cannot be updated to a function which makes device-side - update calls. + The API will return :py:obj:`~.cudaSuccess` and set the returned + `funcPtr` to NULL if the requested driver function is not supported on + the platform, no ABI compatible driver function exists for the CUDA + runtime version or if the driver symbol is invalid. - - A cooperative node cannot be updated to a non-cooperative node, and - vice-versa. + It will also set the optional `driverStatus` to one of the values in + :py:obj:`~.cudaDriverEntryPointQueryResult` with the following + meanings: - - If the graph was instantiated with - cudaGraphInstantiateFlagUseNodePriority, the priority attribute - cannot change. Equality is checked on the originally requested - priority values, before they are clamped to the device's supported - range. + - :py:obj:`~.cudaDriverEntryPointSuccess` - The requested symbol was + succesfully found based on input arguments and `pfn` is valid - - If `hGraphExec` was not instantiated for device launch, a node - whose function originally did not use device-side - :py:obj:`~.cudaGraphLaunch()` cannot be updated to a function which - uses device-side :py:obj:`~.cudaGraphLaunch()` unless the node - resides on the same device as nodes which contained such calls at - instantiate-time. If no such calls were present at instantiation, - these updates cannot be performed at all. + - :py:obj:`~.cudaDriverEntryPointSymbolNotFound` - The requested symbol + was not found - - Neither `hGraph` nor `hGraphExec` may contain device-updatable - kernel nodes. + - :py:obj:`~.cudaDriverEntryPointVersionNotSufficent` - The requested + symbol was found but is not supported by the current runtime version + (CUDART_VERSION) - - Memset and memcpy nodes: + The requested flags can be: - - The CUDA device(s) to which the operand(s) was allocated/mapped - cannot change. + - :py:obj:`~.cudaEnableDefault`: This is the default mode. This is + equivalent to :py:obj:`~.cudaEnablePerThreadDefaultStream` if the + code is compiled with --default-stream per-thread compilation flag or + the macro CUDA_API_PER_THREAD_DEFAULT_STREAM is defined; + :py:obj:`~.cudaEnableLegacyStream` otherwise. - - The source/destination memory must be allocated from the same - contexts as the original source/destination memory. + - :py:obj:`~.cudaEnableLegacyStream`: This will enable the search for + all driver symbols that match the requested driver symbol name except + the corresponding per-thread versions. - - Only 1D memsets can be changed. + - :py:obj:`~.cudaEnablePerThreadDefaultStream`: This will enable the + search for all driver symbols that match the requested driver symbol + name including the per-thread versions. If a per-thread version is + not found, the API will return the legacy version of the driver + function. - - Additional memcpy node restrictions: + Parameters + ---------- + symbol : bytes + The base name of the driver API function to look for. As an + example, for the driver API :py:obj:`~.cuMemAlloc_v2`, `symbol` + would be cuMemAlloc. Note that the API will use the CUDA runtime + version to return the address to the most recent ABI compatible + driver symbol, :py:obj:`~.cuMemAlloc` or :py:obj:`~.cuMemAlloc_v2`. + flags : unsigned long long + Flags to specify search options. - - Changing either the source or destination memory type(i.e. - CU_MEMORYTYPE_DEVICE, CU_MEMORYTYPE_ARRAY, etc.) is not supported. + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorNotSupported` + funcPtr : Any + Location to return the function pointer to the requested driver + function + driverStatus : :py:obj:`~.cudaDriverEntryPointQueryResult` + Optional location to store the status of finding the symbol from + the driver. See :py:obj:`~.cudaDriverEntryPointQueryResult` for + possible values. - - Conditional nodes: + See Also + -------- + :py:obj:`~.cuGetProcAddress` - - Changing node parameters is not supported. + Notes + ----- + This API is deprecated and :py:obj:`~.cudaGetDriverEntryPointByVersion` (with a hardcoded :py:obj:`~.cudaVersion`) should be used instead. + """ + cdef void_ptr funcPtr = 0 + cdef cyruntime.cudaDriverEntryPointQueryResult driverStatus + with nogil: + err = cyruntime.cudaGetDriverEntryPoint(symbol, &funcPtr, flags, &driverStatus) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None, None) + return (_cudaError_t_SUCCESS, funcPtr, cudaDriverEntryPointQueryResult(driverStatus)) - - Changeing parameters of nodes within the conditional body graph is - subject to the rules above. +@cython.embedsignature(True) +def cudaGetDriverEntryPointByVersion(char* symbol, unsigned int cudaVersion, unsigned long long flags): + """ Returns the requested driver API function pointer by CUDA version. - - Conditional handle flags and default values are updated as part of - the graph update. + Returns in `**funcPtr` the address of the CUDA driver function for the + requested flags and CUDA driver version. - Note: The API may add further restrictions in future releases. The - return code should always be checked. + The CUDA version is specified as (1000 * major + 10 * minor), so CUDA + 11.2 should be specified as 11020. For a requested driver symbol, if + the specified CUDA version is greater than or equal to the CUDA version + in which the driver symbol was introduced, this API will return the + function pointer to the corresponding versioned function. If the + specified CUDA version is greater than the driver version, the API will + return :py:obj:`~.cudaErrorInvalidValue`. - cudaGraphExecUpdate sets the result member of `resultInfo` to - cudaGraphExecUpdateErrorTopologyChanged under the following conditions: + The pointer returned by the API should be cast to a function pointer + matching the requested driver function's definition in the API header + file. The function pointer typedef can be picked up from the + corresponding typedefs header file. For example, cudaTypedefs.h + consists of function pointer typedefs for driver APIs defined in + cuda.h. - - The count of nodes directly in `hGraphExec` and `hGraph` differ, in - which case resultInfo->errorNode is set to NULL. + For the case where the CUDA version requested is greater than the CUDA + Toolkit installed, there may not be an appropriate function pointer + typedef in the corresponding header file and may need a custom typedef + to match the driver function signature returned. This can be done by + getting the typedefs from a later toolkit or creating appropriately + matching custom function typedefs. - - `hGraph` has more exit nodes than `hGraph`, in which case - resultInfo->errorNode is set to one of the exit nodes in hGraph. + The API will return :py:obj:`~.cudaSuccess` and set the returned + `funcPtr` if the requested driver function is valid and supported on + the platform. - - A node in `hGraph` has a different number of dependencies than the - node from `hGraphExec` it is paired with, in which case - resultInfo->errorNode is set to the node from `hGraph`. + The API will return :py:obj:`~.cudaSuccess` and set the returned + `funcPtr` to NULL if the requested driver function is not supported on + the platform, no ABI compatible driver function exists for the + requested version or if the driver symbol is invalid. - - A node in `hGraph` has a dependency that does not match with the - corresponding dependency of the paired node from `hGraphExec`. - resultInfo->errorNode will be set to the node from `hGraph`. - resultInfo->errorFromNode will be set to the mismatched dependency. - The dependencies are paired based on edge order and a dependency does - not match when the nodes are already paired based on other edges - examined in the graph. + It will also set the optional `driverStatus` to one of the values in + :py:obj:`~.cudaDriverEntryPointQueryResult` with the following + meanings: + + - :py:obj:`~.cudaDriverEntryPointSuccess` - The requested symbol was + succesfully found based on input arguments and `pfn` is valid + + - :py:obj:`~.cudaDriverEntryPointSymbolNotFound` - The requested symbol + was not found + + - :py:obj:`~.cudaDriverEntryPointVersionNotSufficent` - The requested + symbol was found but is not supported by the specified version + `cudaVersion` + + The requested flags can be: + + - :py:obj:`~.cudaEnableDefault`: This is the default mode. This is + equivalent to :py:obj:`~.cudaEnablePerThreadDefaultStream` if the + code is compiled with --default-stream per-thread compilation flag or + the macro CUDA_API_PER_THREAD_DEFAULT_STREAM is defined; + :py:obj:`~.cudaEnableLegacyStream` otherwise. - cudaGraphExecUpdate sets `the` result member of `resultInfo` to: + - :py:obj:`~.cudaEnableLegacyStream`: This will enable the search for + all driver symbols that match the requested driver symbol name except + the corresponding per-thread versions. - - cudaGraphExecUpdateError if passed an invalid value. + - :py:obj:`~.cudaEnablePerThreadDefaultStream`: This will enable the + search for all driver symbols that match the requested driver symbol + name including the per-thread versions. If a per-thread version is + not found, the API will return the legacy version of the driver + function. - - cudaGraphExecUpdateErrorTopologyChanged if the graph topology changed + Parameters + ---------- + symbol : bytes + The base name of the driver API function to look for. As an + example, for the driver API :py:obj:`~.cuMemAlloc_v2`, `symbol` + would be cuMemAlloc. + cudaVersion : unsigned int + The CUDA version to look for the requested driver symbol + flags : unsigned long long + Flags to specify search options. - - cudaGraphExecUpdateErrorNodeTypeChanged if the type of a node - changed, in which case `hErrorNode_out` is set to the node from - `hGraph`. + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorNotSupported` + funcPtr : Any + Location to return the function pointer to the requested driver + function + driverStatus : :py:obj:`~.cudaDriverEntryPointQueryResult` + Optional location to store the status of finding the symbol from + the driver. See :py:obj:`~.cudaDriverEntryPointQueryResult` for + possible values. - - cudaGraphExecUpdateErrorFunctionChanged if the function of a kernel - node changed (CUDA driver < 11.2) + See Also + -------- + :py:obj:`~.cuGetProcAddress` + """ + cdef void_ptr funcPtr = 0 + cdef cyruntime.cudaDriverEntryPointQueryResult driverStatus + with nogil: + err = cyruntime.cudaGetDriverEntryPointByVersion(symbol, &funcPtr, cudaVersion, flags, &driverStatus) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None, None) + return (_cudaError_t_SUCCESS, funcPtr, cudaDriverEntryPointQueryResult(driverStatus)) + +@cython.embedsignature(True) +def cudaLibraryLoadData(code, jitOptions : Optional[tuple[cudaJitOption] | list[cudaJitOption]], jitOptionsValues : Optional[tuple[Any] | list[Any]], unsigned int numJitOptions, libraryOptions : Optional[tuple[cudaLibraryOption] | list[cudaLibraryOption]], libraryOptionValues : Optional[tuple[Any] | list[Any]], unsigned int numLibraryOptions): + """ Load a library with specified code and options. + + Takes a pointer `code` and loads the corresponding library `library` + based on the application defined library loading mode: + + - If module loading is set to EAGER, via the environment variables + described in "Module loading", `library` is loaded eagerly into all + contexts at the time of the call and future contexts at the time of + creation until the library is unloaded with + :py:obj:`~.cudaLibraryUnload()`. + + - If the environment variables are set to LAZY, `library` is not + immediately loaded onto all existent contexts and will only be loaded + when a function is needed for that context, such as a kernel launch. + + These environment variables are described in the CUDA programming guide + under the "CUDA environment variables" section. + + The `code` may be a `cubin` or `fatbin` as output by nvcc, or a NULL- + terminated `PTX`, either as output by nvcc or hand-written, or `Tile` + IR data. A fatbin should also contain relocatable code when doing + separate compilation. Please also see the documentation for nvrtc + (https://docs.nvidia.com/cuda/nvrtc/index.html), nvjitlink + (https://docs.nvidia.com/cuda/nvjitlink/index.html), and nvfatbin + (https://docs.nvidia.com/cuda/nvfatbin/index.html) for more information + on generating loadable code at runtime. + + Options are passed as an array via `jitOptions` and any corresponding + parameters are passed in `jitOptionsValues`. The number of total JIT + options is supplied via `numJitOptions`. Any outputs will be returned + via `jitOptionsValues`. + + Library load options are passed as an array via `libraryOptions` and + any corresponding parameters are passed in `libraryOptionValues`. The + number of total library load options is supplied via + `numLibraryOptions`. + + Parameters + ---------- + code : Any + Code to load + jitOptions : list[:py:obj:`~.cudaJitOption`] + Options for JIT + jitOptionsValues : list[Any] + Option values for JIT + numJitOptions : unsigned int + Number of options + libraryOptions : list[:py:obj:`~.cudaLibraryOption`] + Options for loading + libraryOptionValues : list[Any] + Option values for loading + numLibraryOptions : unsigned int + Number of options for loading + + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorMemoryAllocation`, :py:obj:`~.cudaErrorInitializationError`, :py:obj:`~.cudaErrorCudartUnloading`, :py:obj:`~.cudaErrorInvalidPtx`, :py:obj:`~.cudaErrorUnsupportedPtxVersion`, :py:obj:`~.cudaErrorNoKernelImageForDevice`, :py:obj:`~.cudaErrorSharedObjectSymbolNotFound`, :py:obj:`~.cudaErrorSharedObjectInitFailed`, :py:obj:`~.cudaErrorJitCompilerNotFound` + library : :py:obj:`~.cudaLibrary_t` + Returned library + + See Also + -------- + :py:obj:`~.cudaLibraryLoadFromFile`, :py:obj:`~.cudaLibraryUnload`, :py:obj:`~.cuLibraryLoadData` + """ + libraryOptionValues = [] if libraryOptionValues is None else libraryOptionValues + libraryOptions = [] if libraryOptions is None else libraryOptions + if not all(isinstance(_x, (cudaLibraryOption)) for _x in libraryOptions): + raise TypeError("Argument 'libraryOptions' is not instance of type (expected tuple[cyruntime.cudaLibraryOption] or list[cyruntime.cudaLibraryOption]") + jitOptionsValues = [] if jitOptionsValues is None else jitOptionsValues + jitOptions = [] if jitOptions is None else jitOptions + if not all(isinstance(_x, (cudaJitOption)) for _x in jitOptions): + raise TypeError("Argument 'jitOptions' is not instance of type (expected tuple[cyruntime.cudaJitOption] or list[cyruntime.cudaJitOption]") + cdef cudaLibrary_t library = cudaLibrary_t() + cdef _HelperInputVoidPtrStruct cycodeHelper + cdef void* cycode = _helper_input_void_ptr(code, &cycodeHelper) + cdef vector[cyruntime.cudaJitOption] cyjitOptions = jitOptions + pylist = [_HelperCudaJitOption(pyoptions, pyoptionValues) for pyoptions, pyoptionValues in zip(jitOptions, jitOptionsValues)] + cdef _InputVoidPtrPtrHelper voidStarHelperjitOptionsValues = _InputVoidPtrPtrHelper(pylist) + cdef void** cyjitOptionsValues_ptr = voidStarHelperjitOptionsValues.cptr + if numJitOptions > len(jitOptions): raise RuntimeError("List is too small: " + str(len(jitOptions)) + " < " + str(numJitOptions)) + if numJitOptions > len(jitOptionsValues): raise RuntimeError("List is too small: " + str(len(jitOptionsValues)) + " < " + str(numJitOptions)) + cdef vector[cyruntime.cudaLibraryOption] cylibraryOptions = libraryOptions + pylist = [_HelperCudaLibraryOption(pyoptions, pyoptionValues) for pyoptions, pyoptionValues in zip(libraryOptions, libraryOptionValues)] + cdef _InputVoidPtrPtrHelper voidStarHelperlibraryOptionValues = _InputVoidPtrPtrHelper(pylist) + cdef void** cylibraryOptionValues_ptr = voidStarHelperlibraryOptionValues.cptr + if numLibraryOptions > len(libraryOptions): raise RuntimeError("List is too small: " + str(len(libraryOptions)) + " < " + str(numLibraryOptions)) + if numLibraryOptions > len(libraryOptionValues): raise RuntimeError("List is too small: " + str(len(libraryOptionValues)) + " < " + str(numLibraryOptions)) + with nogil: + err = cyruntime.cudaLibraryLoadData(library._pvt_ptr, cycode, cyjitOptions.data(), cyjitOptionsValues_ptr, numJitOptions, cylibraryOptions.data(), cylibraryOptionValues_ptr, numLibraryOptions) + _helper_input_void_ptr_free(&cycodeHelper) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, library) + +@cython.embedsignature(True) +def cudaLibraryLoadFromFile(char* fileName, jitOptions : Optional[tuple[cudaJitOption] | list[cudaJitOption]], jitOptionsValues : Optional[tuple[Any] | list[Any]], unsigned int numJitOptions, libraryOptions : Optional[tuple[cudaLibraryOption] | list[cudaLibraryOption]], libraryOptionValues : Optional[tuple[Any] | list[Any]], unsigned int numLibraryOptions): + """ Load a library with specified file and options. + + Takes a pointer `code` and loads the corresponding library `library` + based on the application defined library loading mode: + + - If module loading is set to EAGER, via the environment variables + described in "Module loading", `library` is loaded eagerly into all + contexts at the time of the call and future contexts at the time of + creation until the library is unloaded with + :py:obj:`~.cudaLibraryUnload()`. + + - If the environment variables are set to LAZY, `library` is not + immediately loaded onto all existent contexts and will only be loaded + when a function is needed for that context, such as a kernel launch. + + These environment variables are described in the CUDA programming guide + under the "CUDA environment variables" section. + + The file should be a `cubin` file as output by nvcc, or a `PTX` file + either as output by nvcc or handwritten, or a `fatbin` file as output + by nvcc or hand-written, or `Tile` IR file. A fatbin should also + contain relocatable code when doing separate compilation. Please also + see the documentation for nvrtc + (https://docs.nvidia.com/cuda/nvrtc/index.html), nvjitlink + (https://docs.nvidia.com/cuda/nvjitlink/index.html), and nvfatbin + (https://docs.nvidia.com/cuda/nvfatbin/index.html) for more information + on generating loadable code at runtime. + + Options are passed as an array via `jitOptions` and any corresponding + parameters are passed in `jitOptionsValues`. The number of total + options is supplied via `numJitOptions`. Any outputs will be returned + via `jitOptionsValues`. + + Library load options are passed as an array via `libraryOptions` and + any corresponding parameters are passed in `libraryOptionValues`. The + number of total library load options is supplied via + `numLibraryOptions`. + + Parameters + ---------- + fileName : bytes + File to load from + jitOptions : list[:py:obj:`~.cudaJitOption`] + Options for JIT + jitOptionsValues : list[Any] + Option values for JIT + numJitOptions : unsigned int + Number of options + libraryOptions : list[:py:obj:`~.cudaLibraryOption`] + Options for loading + libraryOptionValues : list[Any] + Option values for loading + numLibraryOptions : unsigned int + Number of options for loading + + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorMemoryAllocation`, :py:obj:`~.cudaErrorInitializationError`, :py:obj:`~.cudaErrorCudartUnloading`, :py:obj:`~.cudaErrorInvalidPtx`, :py:obj:`~.cudaErrorUnsupportedPtxVersion`, :py:obj:`~.cudaErrorNoKernelImageForDevice`, :py:obj:`~.cudaErrorSharedObjectSymbolNotFound`, :py:obj:`~.cudaErrorSharedObjectInitFailed`, :py:obj:`~.cudaErrorJitCompilerNotFound` + library : :py:obj:`~.cudaLibrary_t` + Returned library + + See Also + -------- + :py:obj:`~.cudaLibraryLoadData`, :py:obj:`~.cudaLibraryUnload`, :py:obj:`~.cuLibraryLoadFromFile` + """ + libraryOptionValues = [] if libraryOptionValues is None else libraryOptionValues + libraryOptions = [] if libraryOptions is None else libraryOptions + if not all(isinstance(_x, (cudaLibraryOption)) for _x in libraryOptions): + raise TypeError("Argument 'libraryOptions' is not instance of type (expected tuple[cyruntime.cudaLibraryOption] or list[cyruntime.cudaLibraryOption]") + jitOptionsValues = [] if jitOptionsValues is None else jitOptionsValues + jitOptions = [] if jitOptions is None else jitOptions + if not all(isinstance(_x, (cudaJitOption)) for _x in jitOptions): + raise TypeError("Argument 'jitOptions' is not instance of type (expected tuple[cyruntime.cudaJitOption] or list[cyruntime.cudaJitOption]") + cdef cudaLibrary_t library = cudaLibrary_t() + cdef vector[cyruntime.cudaJitOption] cyjitOptions = jitOptions + pylist = [_HelperCudaJitOption(pyoptions, pyoptionValues) for pyoptions, pyoptionValues in zip(jitOptions, jitOptionsValues)] + cdef _InputVoidPtrPtrHelper voidStarHelperjitOptionsValues = _InputVoidPtrPtrHelper(pylist) + cdef void** cyjitOptionsValues_ptr = voidStarHelperjitOptionsValues.cptr + if numJitOptions > len(jitOptions): raise RuntimeError("List is too small: " + str(len(jitOptions)) + " < " + str(numJitOptions)) + if numJitOptions > len(jitOptionsValues): raise RuntimeError("List is too small: " + str(len(jitOptionsValues)) + " < " + str(numJitOptions)) + cdef vector[cyruntime.cudaLibraryOption] cylibraryOptions = libraryOptions + pylist = [_HelperCudaLibraryOption(pyoptions, pyoptionValues) for pyoptions, pyoptionValues in zip(libraryOptions, libraryOptionValues)] + cdef _InputVoidPtrPtrHelper voidStarHelperlibraryOptionValues = _InputVoidPtrPtrHelper(pylist) + cdef void** cylibraryOptionValues_ptr = voidStarHelperlibraryOptionValues.cptr + if numLibraryOptions > len(libraryOptions): raise RuntimeError("List is too small: " + str(len(libraryOptions)) + " < " + str(numLibraryOptions)) + if numLibraryOptions > len(libraryOptionValues): raise RuntimeError("List is too small: " + str(len(libraryOptionValues)) + " < " + str(numLibraryOptions)) + with nogil: + err = cyruntime.cudaLibraryLoadFromFile(library._pvt_ptr, fileName, cyjitOptions.data(), cyjitOptionsValues_ptr, numJitOptions, cylibraryOptions.data(), cylibraryOptionValues_ptr, numLibraryOptions) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, library) - - cudaGraphExecUpdateErrorUnsupportedFunctionChange if the func field - of a kernel changed in an unsupported way(see note above), in which - case `hErrorNode_out` is set to the node from `hGraph` +@cython.embedsignature(True) +def cudaLibraryUnload(library): + """ Unloads a library. - - cudaGraphExecUpdateErrorParametersChanged if any parameters to a node - changed in a way that is not supported, in which case - `hErrorNode_out` is set to the node from `hGraph` + Unloads the library specified with `library` - - cudaGraphExecUpdateErrorAttributesChanged if any attributes of a node - changed in a way that is not supported, in which case - `hErrorNode_out` is set to the node from `hGraph` + Parameters + ---------- + library : :py:obj:`~.cudaLibrary_t` + Library to unload - - cudaGraphExecUpdateErrorNotSupported if something about a node is - unsupported, like the node's type or configuration, in which case - `hErrorNode_out` is set to the node from `hGraph` + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorCudartUnloading`, :py:obj:`~.cudaErrorInitializationError`, :py:obj:`~.cudaErrorInvalidValue` - If the update fails for a reason not listed above, the result member of - `resultInfo` will be set to cudaGraphExecUpdateError. If the update - succeeds, the result member will be set to cudaGraphExecUpdateSuccess. + See Also + -------- + :py:obj:`~.cudaLibraryLoadData`, :py:obj:`~.cudaLibraryLoadFromFile`, :py:obj:`~.cuLibraryUnload` + """ + cdef cyruntime.cudaLibrary_t cylibrary + if library is None: + plibrary = 0 + elif isinstance(library, (cudaLibrary_t,)): + plibrary = int(library) + else: + plibrary = int(cudaLibrary_t(library)) + cylibrary = plibrary + with nogil: + err = cyruntime.cudaLibraryUnload(cylibrary) + return (_cudaError_t(err),) - cudaGraphExecUpdate returns cudaSuccess when the updated was performed - successfully. It returns cudaErrorGraphExecUpdateFailure if the graph - update was not performed because it included changes which violated - constraints specific to instantiated graph update. +@cython.embedsignature(True) +def cudaLibraryGetKernel(library, char* name): + """ Returns a kernel handle. + + Returns in `pKernel` the handle of the kernel with name `name` located + in library `library`. If kernel handle is not found, the call returns + :py:obj:`~.cudaErrorSymbolNotFound`. Parameters ---------- - hGraphExec : :py:obj:`~.CUgraphExec` or :py:obj:`~.cudaGraphExec_t` - The instantiated graph to be updated - hGraph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` - The graph containing the updated parameters + library : :py:obj:`~.cudaLibrary_t` + Library to retrieve kernel from + name : bytes + Name of kernel to retrieve Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorGraphExecUpdateFailure`, - resultInfo : :py:obj:`~.cudaGraphExecUpdateResultInfo` - the error info structure + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorCudartUnloading`, :py:obj:`~.cudaErrorInitializationError`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorSymbolNotFound` + pKernel : :py:obj:`~.cudaKernel_t` + Returned kernel handle See Also -------- - :py:obj:`~.cudaGraphInstantiate` + :py:obj:`~.cudaLibraryLoadData`, :py:obj:`~.cudaLibraryLoadFromFile`, :py:obj:`~.cudaLibraryUnload`, :py:obj:`~.cuLibraryGetKernel` """ - cdef ccudart.cudaGraph_t chGraph - if hGraph is None: - chGraph = 0 - elif isinstance(hGraph, (cudaGraph_t,cuda.CUgraph)): - phGraph = int(hGraph) - chGraph = phGraph - else: - phGraph = int(cudaGraph_t(hGraph)) - chGraph = phGraph - cdef ccudart.cudaGraphExec_t chGraphExec - if hGraphExec is None: - chGraphExec = 0 - elif isinstance(hGraphExec, (cudaGraphExec_t,cuda.CUgraphExec)): - phGraphExec = int(hGraphExec) - chGraphExec = phGraphExec + cdef cyruntime.cudaLibrary_t cylibrary + if library is None: + plibrary = 0 + elif isinstance(library, (cudaLibrary_t,)): + plibrary = int(library) else: - phGraphExec = int(cudaGraphExec_t(hGraphExec)) - chGraphExec = phGraphExec - cdef cudaGraphExecUpdateResultInfo resultInfo = cudaGraphExecUpdateResultInfo() - err = ccudart.cudaGraphExecUpdate(chGraphExec, chGraph, resultInfo._ptr) - return (cudaError_t(err), resultInfo) -{{endif}} - -{{if 'cudaGraphUpload' in found_functions}} + plibrary = int(cudaLibrary_t(library)) + cylibrary = plibrary + cdef cudaKernel_t pKernel = cudaKernel_t() + with nogil: + err = cyruntime.cudaLibraryGetKernel(pKernel._pvt_ptr, cylibrary, name) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, pKernel) @cython.embedsignature(True) -def cudaGraphUpload(graphExec, stream): - """ Uploads an executable graph in a stream. +def cudaLibraryGetGlobal(library, char* name): + """ Returns a global device pointer. - Uploads `hGraphExec` to the device in `hStream` without executing it. - Uploads of the same `hGraphExec` will be serialized. Each upload is - ordered behind both any previous work in `hStream` and any previous - launches of `hGraphExec`. Uses memory cached by `stream` to back the - allocations owned by `graphExec`. + Returns in `*dptr` and `*bytes` the base pointer and size of the global + with name `name` for the requested library `library` and the current + device. If no global for the requested name `name` exists, the call + returns :py:obj:`~.cudaErrorSymbolNotFound`. One of the parameters + `dptr` or `numbytes` (not both) can be NULL in which case it is + ignored. The returned `dptr` cannot be passed to the Symbol APIs such + as :py:obj:`~.cudaMemcpyToSymbol`, :py:obj:`~.cudaMemcpyFromSymbol`, + :py:obj:`~.cudaGetSymbolAddress`, or :py:obj:`~.cudaGetSymbolSize`. Parameters ---------- - hGraphExec : :py:obj:`~.CUgraphExec` or :py:obj:`~.cudaGraphExec_t` - Executable graph to upload - hStream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` - Stream in which to upload the graph + library : :py:obj:`~.cudaLibrary_t` + Library to retrieve global from + name : bytes + Name of global to retrieve Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorCudartUnloading`, :py:obj:`~.cudaErrorInitializationError`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorSymbolNotFound` :py:obj:`~.cudaErrorDeviceUninitialized`, :py:obj:`~.cudaErrorContextIsDestroyed` + dptr : Any + Returned global device pointer for the requested library + numbytes : int + Returned global size in bytes See Also -------- - :py:obj:`~.cudaGraphInstantiate`, :py:obj:`~.cudaGraphLaunch`, :py:obj:`~.cudaGraphExecDestroy` + :py:obj:`~.cudaLibraryLoadData`, :py:obj:`~.cudaLibraryLoadFromFile`, :py:obj:`~.cudaLibraryUnload`, :py:obj:`~.cudaLibraryGetManaged`, :py:obj:`~.cuLibraryGetGlobal` """ - cdef ccudart.cudaStream_t cstream - if stream is None: - cstream = 0 - elif isinstance(stream, (cudaStream_t,cuda.CUstream)): - pstream = int(stream) - cstream = pstream - else: - pstream = int(cudaStream_t(stream)) - cstream = pstream - cdef ccudart.cudaGraphExec_t cgraphExec - if graphExec is None: - cgraphExec = 0 - elif isinstance(graphExec, (cudaGraphExec_t,cuda.CUgraphExec)): - pgraphExec = int(graphExec) - cgraphExec = pgraphExec + cdef cyruntime.cudaLibrary_t cylibrary + if library is None: + plibrary = 0 + elif isinstance(library, (cudaLibrary_t,)): + plibrary = int(library) else: - pgraphExec = int(cudaGraphExec_t(graphExec)) - cgraphExec = pgraphExec - err = ccudart.cudaGraphUpload(cgraphExec, cstream) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaGraphLaunch' in found_functions}} + plibrary = int(cudaLibrary_t(library)) + cylibrary = plibrary + cdef void_ptr dptr = 0 + cdef size_t numbytes = 0 + with nogil: + err = cyruntime.cudaLibraryGetGlobal(&dptr, &numbytes, cylibrary, name) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None, None) + return (_cudaError_t_SUCCESS, dptr, numbytes) @cython.embedsignature(True) -def cudaGraphLaunch(graphExec, stream): - """ Launches an executable graph in a stream. - - Executes `graphExec` in `stream`. Only one instance of `graphExec` may - be executing at a time. Each launch is ordered behind both any previous - work in `stream` and any previous launches of `graphExec`. To execute a - graph concurrently, it must be instantiated multiple times into - multiple executable graphs. +def cudaLibraryGetManaged(library, char* name): + """ Returns a pointer to managed memory. - If any allocations created by `graphExec` remain unfreed (from a - previous launch) and `graphExec` was not instantiated with - :py:obj:`~.cudaGraphInstantiateFlagAutoFreeOnLaunch`, the launch will - fail with :py:obj:`~.cudaErrorInvalidValue`. + Returns in `*dptr` and `*bytes` the base pointer and size of the + managed memory with name `name` for the requested library `library`. If + no managed memory with the requested name `name` exists, the call + returns :py:obj:`~.cudaErrorSymbolNotFound`. One of the parameters + `dptr` or `numbytes` (not both) can be NULL in which case it is + ignored. Note that managed memory for library `library` is shared + across devices and is registered when the library is loaded. The + returned `dptr` cannot be passed to the Symbol APIs such as + :py:obj:`~.cudaMemcpyToSymbol`, :py:obj:`~.cudaMemcpyFromSymbol`, + :py:obj:`~.cudaGetSymbolAddress`, or :py:obj:`~.cudaGetSymbolSize`. Parameters ---------- - graphExec : :py:obj:`~.CUgraphExec` or :py:obj:`~.cudaGraphExec_t` - Executable graph to launch - stream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` - Stream in which to launch the graph + library : :py:obj:`~.cudaLibrary_t` + Library to retrieve managed memory from + name : bytes + Name of managed memory to retrieve Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorCudartUnloading`, :py:obj:`~.cudaErrorInitializationError`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorSymbolNotFound` + dptr : Any + Returned pointer to the managed memory + numbytes : int + Returned memory size in bytes See Also -------- - :py:obj:`~.cudaGraphInstantiate`, :py:obj:`~.cudaGraphUpload`, :py:obj:`~.cudaGraphExecDestroy` + :py:obj:`~.cudaLibraryLoadData`, :py:obj:`~.cudaLibraryLoadFromFile`, :py:obj:`~.cudaLibraryUnload`, :py:obj:`~.cudaLibraryGetGlobal`, :py:obj:`~.cuLibraryGetManaged` """ - cdef ccudart.cudaStream_t cstream - if stream is None: - cstream = 0 - elif isinstance(stream, (cudaStream_t,cuda.CUstream)): - pstream = int(stream) - cstream = pstream - else: - pstream = int(cudaStream_t(stream)) - cstream = pstream - cdef ccudart.cudaGraphExec_t cgraphExec - if graphExec is None: - cgraphExec = 0 - elif isinstance(graphExec, (cudaGraphExec_t,cuda.CUgraphExec)): - pgraphExec = int(graphExec) - cgraphExec = pgraphExec + cdef cyruntime.cudaLibrary_t cylibrary + if library is None: + plibrary = 0 + elif isinstance(library, (cudaLibrary_t,)): + plibrary = int(library) else: - pgraphExec = int(cudaGraphExec_t(graphExec)) - cgraphExec = pgraphExec - err = ccudart.cudaGraphLaunch(cgraphExec, cstream) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaGraphExecDestroy' in found_functions}} + plibrary = int(cudaLibrary_t(library)) + cylibrary = plibrary + cdef void_ptr dptr = 0 + cdef size_t numbytes = 0 + with nogil: + err = cyruntime.cudaLibraryGetManaged(&dptr, &numbytes, cylibrary, name) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None, None) + return (_cudaError_t_SUCCESS, dptr, numbytes) @cython.embedsignature(True) -def cudaGraphExecDestroy(graphExec): - """ Destroys an executable graph. +def cudaLibraryGetUnifiedFunction(library, char* symbol): + """ Returns a pointer to a unified function. - Destroys the executable graph specified by `graphExec`. + Returns in `*fptr` the function pointer to a unified function denoted + by `symbol`. If no unified function with name `symbol` exists, the call + returns :py:obj:`~.cudaErrorSymbolNotFound`. If there is no device with + attribute :py:obj:`~.cudaDeviceProp.unifiedFunctionPointers` present in + the system, the call may return :py:obj:`~.cudaErrorSymbolNotFound`. Parameters ---------- - graphExec : :py:obj:`~.CUgraphExec` or :py:obj:`~.cudaGraphExec_t` - Executable graph to destroy + library : :py:obj:`~.cudaLibrary_t` + Library to retrieve function pointer memory from + symbol : bytes + Name of function pointer to retrieve Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorCudartUnloading`, :py:obj:`~.cudaErrorInitializationError`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorSymbolNotFound` + fptr : Any + Returned pointer to a unified function See Also -------- - :py:obj:`~.cudaGraphInstantiate`, :py:obj:`~.cudaGraphUpload`, :py:obj:`~.cudaGraphLaunch` + :py:obj:`~.cudaLibraryLoadData`, :py:obj:`~.cudaLibraryLoadFromFile`, :py:obj:`~.cudaLibraryUnload`, :py:obj:`~.cuLibraryGetUnifiedFunction` """ - cdef ccudart.cudaGraphExec_t cgraphExec - if graphExec is None: - cgraphExec = 0 - elif isinstance(graphExec, (cudaGraphExec_t,cuda.CUgraphExec)): - pgraphExec = int(graphExec) - cgraphExec = pgraphExec + cdef cyruntime.cudaLibrary_t cylibrary + if library is None: + plibrary = 0 + elif isinstance(library, (cudaLibrary_t,)): + plibrary = int(library) else: - pgraphExec = int(cudaGraphExec_t(graphExec)) - cgraphExec = pgraphExec - err = ccudart.cudaGraphExecDestroy(cgraphExec) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaGraphDestroy' in found_functions}} + plibrary = int(cudaLibrary_t(library)) + cylibrary = plibrary + cdef void_ptr fptr = 0 + with nogil: + err = cyruntime.cudaLibraryGetUnifiedFunction(&fptr, cylibrary, symbol) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, fptr) @cython.embedsignature(True) -def cudaGraphDestroy(graph): - """ Destroys a graph. +def cudaLibraryGetKernelCount(lib): + """ Returns the number of kernels within a library. - Destroys the graph specified by `graph`, as well as all of its nodes. + Returns in `count` the number of kernels in `lib`. Parameters ---------- - graph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` - Graph to destroy + lib : :py:obj:`~.cudaLibrary_t` + Library to query Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorCudartUnloading`, :py:obj:`~.cudaErrorInitializationError`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle` + count : unsigned int + Number of kernels found within the library See Also -------- - :py:obj:`~.cudaGraphCreate` + :py:obj:`~.cudaLibraryEnumerateKernels`, :py:obj:`~.cudaLibraryLoadFromFile`, :py:obj:`~.cudaLibraryLoadData`, :py:obj:`~.cuLibraryGetKernelCount` """ - cdef ccudart.cudaGraph_t cgraph - if graph is None: - cgraph = 0 - elif isinstance(graph, (cudaGraph_t,cuda.CUgraph)): - pgraph = int(graph) - cgraph = pgraph + cdef cyruntime.cudaLibrary_t cylib + if lib is None: + plib = 0 + elif isinstance(lib, (cudaLibrary_t,)): + plib = int(lib) else: - pgraph = int(cudaGraph_t(graph)) - cgraph = pgraph - err = ccudart.cudaGraphDestroy(cgraph) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaGraphDebugDotPrint' in found_functions}} + plib = int(cudaLibrary_t(lib)) + cylib = plib + cdef unsigned int count = 0 + with nogil: + err = cyruntime.cudaLibraryGetKernelCount(&count, cylib) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, count) @cython.embedsignature(True) -def cudaGraphDebugDotPrint(graph, char* path, unsigned int flags): - """ Write a DOT file describing graph structure. +def cudaLibraryEnumerateKernels(unsigned int numKernels, lib): + """ Retrieve the kernel handles within a library. - Using the provided `graph`, write to `path` a DOT formatted description - of the graph. By default this includes the graph topology, node types, - node id, kernel names and memcpy direction. `flags` can be specified to - write more detailed information about each node type such as parameter - values, kernel attributes, node and function handles. + Returns in `kernels` a maximum number of `numKernels` kernel handles + within `lib`. The returned kernel handle becomes invalid when the + library is unloaded. Parameters ---------- - graph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` - The graph to create a DOT file from - path : bytes - The path to write the DOT file to - flags : unsigned int - Flags from cudaGraphDebugDotFlags for specifying which additional - node information to write + numKernels : unsigned int + Maximum number of kernel handles may be returned to the buffer + lib : :py:obj:`~.cudaLibrary_t` + Library to query from Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorOperatingSystem` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorCudartUnloading`, :py:obj:`~.cudaErrorInitializationError`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle` + kernels : list[:py:obj:`~.cudaKernel_t`] + Buffer where the kernel handles are returned to + + See Also + -------- + :py:obj:`~.cudaLibraryGetKernelCount`, :py:obj:`~.cuLibraryEnumerateKernels` """ - cdef ccudart.cudaGraph_t cgraph - if graph is None: - cgraph = 0 - elif isinstance(graph, (cudaGraph_t,cuda.CUgraph)): - pgraph = int(graph) - cgraph = pgraph + cdef cyruntime.cudaLibrary_t cylib + if lib is None: + plib = 0 + elif isinstance(lib, (cudaLibrary_t,)): + plib = int(lib) else: - pgraph = int(cudaGraph_t(graph)) - cgraph = pgraph - err = ccudart.cudaGraphDebugDotPrint(cgraph, path, flags) - return (cudaError_t(err),) -{{endif}} + plib = int(cudaLibrary_t(lib)) + cylib = plib + cdef cyruntime.cudaKernel_t* cykernels = NULL + pykernels = [] + if numKernels != 0: + cykernels = calloc(numKernels, sizeof(cyruntime.cudaKernel_t)) + if cykernels is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(numKernels) + 'x' + str(sizeof(cyruntime.cudaKernel_t))) + with nogil: + err = cyruntime.cudaLibraryEnumerateKernels(cykernels, numKernels, cylib) + if cudaError_t(err) == cudaError_t(0): + pykernels = [cudaKernel_t(init_value=cykernels[idx]) for idx in range(numKernels)] + if cykernels is not NULL: + free(cykernels) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, pykernels) + +@cython.embedsignature(True) +def cudaKernelSetAttributeForDevice(kernel, attr not None : cudaFuncAttribute, int value, int device): + """ Sets information about a kernel. + + This call sets the value of a specified attribute `attr` on the kernel + `kernel` for the requested device `device` to an integer value + specified by `value`. This function returns :py:obj:`~.cudaSuccess` if + the new value of the attribute could be successfully set. If the set + fails, this call will return an error. Not all attributes can have + values set. Attempting to set a value on a read-only attribute will + result in an error (:py:obj:`~.cudaErrorInvalidValue`) + + Note that attributes set using :py:obj:`~.cudaFuncSetAttribute()` will + override the attribute set by this API irrespective of whether the call + to :py:obj:`~.cudaFuncSetAttribute()` is made before or after this API + call. Because of this and the stricter locking requirements mentioned + below it is suggested that this call be used during the initialization + path and not on each thread accessing `kernel` such as on kernel + launches or on the critical path. -{{if 'cudaUserObjectCreate' in found_functions}} + Valid values for `attr` are: -@cython.embedsignature(True) -def cudaUserObjectCreate(ptr, destroy, unsigned int initialRefcount, unsigned int flags): - """ Create a user object. + - :py:obj:`~.cudaFuncAttributeMaxDynamicSharedMemorySize` - The + requested maximum size in bytes of dynamically-allocated shared + memory. The sum of this value and the function attribute + :py:obj:`~.sharedSizeBytes` cannot exceed the device attribute + :py:obj:`~.cudaDevAttrMaxSharedMemoryPerBlockOptin`. The maximal size + of requestable dynamic shared memory may differ by GPU architecture. - Create a user object with the specified destructor callback and initial - reference count. The initial references are owned by the caller. + - :py:obj:`~.cudaFuncAttributePreferredSharedMemoryCarveout` - On + devices where the L1 cache and shared memory use the same hardware + resources, this sets the shared memory carveout preference, in + percent of the total shared memory. See + :py:obj:`~.cudaDevAttrMaxSharedMemoryPerMultiprocessor`. This is only + a hint, and the driver can choose a different ratio if required to + execute the function. - Destructor callbacks cannot make CUDA API calls and should avoid - blocking behavior, as they are executed by a shared internal thread. - Another thread may be signaled to perform such actions, if it does not - block forward progress of tasks scheduled through CUDA. + - :py:obj:`~.cudaFuncAttributeRequiredClusterWidth`: The required + cluster width in blocks. The width, height, and depth values must + either all be 0 or all be positive. The validity of the cluster + dimensions is checked at launch time. If the value is set during + compile time, it cannot be set at runtime. Setting it at runtime will + return cudaErrorNotPermitted. - See CUDA User Objects in the CUDA C++ Programming Guide for more - information on user objects. + - :py:obj:`~.cudaFuncAttributeRequiredClusterHeight`: The required + cluster height in blocks. The width, height, and depth values must + either all be 0 or all be positive. The validity of the cluster + dimensions is checked at launch time. If the value is set during + compile time, it cannot be set at runtime. Setting it at runtime will + return cudaErrorNotPermitted. - Parameters - ---------- - ptr : Any - The pointer to pass to the destroy function - destroy : :py:obj:`~.cudaHostFn_t` - Callback to free the user object when it is no longer in use - initialRefcount : unsigned int - The initial refcount to create the object with, typically 1. The - initial references are owned by the calling thread. - flags : unsigned int - Currently it is required to pass - :py:obj:`~.cudaUserObjectNoDestructorSync`, which is the only - defined flag. This indicates that the destroy callback cannot be - waited on by any CUDA API. Users requiring synchronization of the - callback should signal its completion manually. + - :py:obj:`~.cudaFuncAttributeRequiredClusterDepth`: The required + cluster depth in blocks. The width, height, and depth values must + either all be 0 or all be positive. The validity of the cluster + dimensions is checked at launch time. If the value is set during + compile time, it cannot be set at runtime. Setting it at runtime will + return cudaErrorNotPermitted. + + - :py:obj:`~.cudaFuncAttributeNonPortableClusterSizeAllowed`: Indicates + whether the function can be launched with non-portable cluster size. + 1 is allowed, 0 is disallowed. + + - :py:obj:`~.cudaFuncAttributeClusterSchedulingPolicyPreference`: The + block scheduling policy of a function. The value type is + :py:obj:`~.cudaClusterSchedulingPolicy`. + + Parameters + ---------- + kernel : :py:obj:`~.cudaKernel_t` + Kernel to set attribute of + attr : :py:obj:`~.cudaFuncAttribute` + Attribute requested + value : int + Value to set + device : int + Device to set attribute of Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` - object_out : :py:obj:`~.cudaUserObject_t` - Location to return the user object handle + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidDeviceFunction`, :py:obj:`~.cudaErrorInvalidValue` See Also -------- - :py:obj:`~.cudaUserObjectRetain`, :py:obj:`~.cudaUserObjectRelease`, :py:obj:`~.cudaGraphRetainUserObject`, :py:obj:`~.cudaGraphReleaseUserObject`, :py:obj:`~.cudaGraphCreate` + :py:obj:`~.cudaLibraryLoadData`, :py:obj:`~.cudaLibraryLoadFromFile`, :py:obj:`~.cudaLibraryUnload`, :py:obj:`~.cudaLibraryGetKernel`, :py:obj:`~.cudaLaunchKernel`, :py:obj:`~.cudaFuncSetAttribute`, :py:obj:`~.cuKernelSetAttribute` + + Notes + ----- + The API has stricter locking requirements in comparison to its legacy counterpart :py:obj:`~.cudaFuncSetAttribute()` due to device-wide semantics. If multiple threads are trying to set the same attribute on the same device simultaneously, the attribute setting will depend on the interleavings chosen by the OS scheduler and memory consistency. """ - cdef ccudart.cudaHostFn_t cdestroy - if destroy is None: - cdestroy = 0 - elif isinstance(destroy, (cudaHostFn_t,)): - pdestroy = int(destroy) - cdestroy = pdestroy + cdef cyruntime.cudaKernel_t cykernel + if kernel is None: + pkernel = 0 + elif isinstance(kernel, (cudaKernel_t,)): + pkernel = int(kernel) else: - pdestroy = int(cudaHostFn_t(destroy)) - cdestroy = pdestroy - cdef cudaUserObject_t object_out = cudaUserObject_t() - cptr = utils.HelperInputVoidPtr(ptr) - cdef void* cptr_ptr = cptr.cptr - err = ccudart.cudaUserObjectCreate(object_out._ptr, cptr_ptr, cdestroy, initialRefcount, flags) - return (cudaError_t(err), object_out) -{{endif}} - -{{if 'cudaUserObjectRetain' in found_functions}} + pkernel = int(cudaKernel_t(kernel)) + cykernel = pkernel + cdef cyruntime.cudaFuncAttribute cyattr = int(attr) + with nogil: + err = cyruntime.cudaKernelSetAttributeForDevice(cykernel, cyattr, value, device) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaUserObjectRetain(object, unsigned int count): - """ Retain a reference to a user object. +def cudaDeviceGetDevResource(int device, typename not None : cudaDevResourceType): + """ Get device resources. - Retains new references to a user object. The new references are owned - by the caller. + Get the `typename` resources available to the `device`. This may often + be the starting point for further partitioning or configuring of + resources. - See CUDA User Objects in the CUDA C++ Programming Guide for more - information on user objects. + Note: The API is not supported on 32-bit platforms. Parameters ---------- - object : :py:obj:`~.cudaUserObject_t` - The object to retain - count : unsigned int - The number of references to retain, typically 1. Must be nonzero - and not larger than INT_MAX. + device : int + Device to get resource for + typename : :py:obj:`~.cudaDevResourceType` + Type of resource to retrieve Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorNotPermitted`, :py:obj:`~.cudaErrorInvalidDevice`, :py:obj:`~.cudaErrorInvalidResourceType`, :py:obj:`~.cudaErrorNotSupported`, :py:obj:`~.cudaErrorCudartUnloading`, :py:obj:`~.cudaErrorInitializationError` + resource : :py:obj:`~.cudaDevResource` + Output pointer to a :py:obj:`~.cudaDevResource` structure See Also -------- - :py:obj:`~.cudaUserObjectCreate`, :py:obj:`~.cudaUserObjectRelease`, :py:obj:`~.cudaGraphRetainUserObject`, :py:obj:`~.cudaGraphReleaseUserObject`, :py:obj:`~.cudaGraphCreate` + :py:obj:`~.cuDeviceGetDevResource`, :py:obj:`~.cudaExecutionCtxGetDevResource`, :py:obj:`~.cudaDevSmResourceSplit`, :py:obj:`~.cudaDevResourceGenerateDesc` """ - cdef ccudart.cudaUserObject_t cobject - if object is None: - cobject = 0 - elif isinstance(object, (cudaUserObject_t,cuda.CUuserObject)): - pobject = int(object) - cobject = pobject - else: - pobject = int(cudaUserObject_t(object)) - cobject = pobject - err = ccudart.cudaUserObjectRetain(cobject, count) - return (cudaError_t(err),) -{{endif}} + cdef cudaDevResource resource = cudaDevResource() + cdef cyruntime.cudaDevResourceType cytypename = int(typename) + with nogil: + err = cyruntime.cudaDeviceGetDevResource(device, resource._pvt_ptr, cytypename) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, resource) + +@cython.embedsignature(True) +def cudaDevSmResourceSplitByCount(unsigned int nbGroups, input_ : Optional[cudaDevResource], unsigned int flags, unsigned int minCount): + """ Splits `cudaDevResourceTypeSm` resources. + + Splits `cudaDevResourceTypeSm` resources into `nbGroups`, adhering to + the minimum SM count specified in `minCount` and the usage flags in + `flags`. If `result` is NULL, the API simulates a split and provides + the amount of groups that would be created in `nbGroups`. Otherwise, + `nbGroups` must point to the amount of elements in `result` and on + return, the API will overwrite `nbGroups` with the amount actually + created. The groups are written to the array in `result`. `nbGroups` + can be less than the total amount if a smaller number of groups is + needed. + + This API is used to spatially partition the input resource. The input + resource needs to come from one of + :py:obj:`~.cudaDeviceGetDevResource`, or + :py:obj:`~.cudaExecutionCtxGetDevResource`. A limitation of the API is + that the output results cannot be split again without first creating a + descriptor and a green context with that descriptor. + + When creating the groups, the API will take into account the + performance and functional characteristics of the input resource, and + guarantee a split that will create a disjoint set of symmetrical + partitions. This may lead to fewer groups created than purely dividing + the total SM count by the `minCount` due to cluster requirements or + alignment and granularity requirements for the minCount. These + requirements can be queried with :py:obj:`~.cudaDeviceGetDevResource`, + or :py:obj:`~.cudaExecutionCtxGetDevResource` for + :py:obj:`~.cudaDevResourceTypeSm`, using the `minSmPartitionSize` and + `smCoscheduledAlignment` fields to determine minimum partition size and + alignment granularity, respectively. + + The `remainder` set does not have the same functional or performance + guarantees as the groups in `result`. Its use should be carefully + planned and future partitions of the `remainder` set are discouraged. + + The following flags are supported: + + - `cudaDevSmResourceSplitIgnoreSmCoscheduling` : Lower the minimum SM + count and alignment, and treat each SM independent of its hierarchy. + This allows more fine grained partitions but at the cost of advanced + features (such as large clusters on compute capability 9.0+). + + - `cudaDevSmResourceSplitMaxPotentialClusterSize` : Compute Capability + 9.0+ only. Attempt to create groups that may allow for maximally + sized thread clusters. This can be queried post green context + creation using :py:obj:`~.cudaOccupancyMaxPotentialClusterSize`. + + A successful API call must either have: + + - A valid array of `result` pointers of size passed in `nbGroups`, with + `input` of type `cudaDevResourceTypeSm`. Value of `minCount` must be + between 0 and the SM count specified in `input`. `remaining` may be + NULL. + + - NULL passed in for `result`, with a valid integer pointer in + `nbGroups` and `input` of type `cudaDevResourceTypeSm`. Value of + `minCount` must be between 0 and the SM count specified in `input`. + `remaining` may be NULL. This queries the number of groups that would + be created by the API. + + Note: The API is not supported on 32-bit platforms. + + Parameters + ---------- + nbGroups : unsigned int + This is a pointer, specifying the number of groups that would be or + should be created as described below. + input : :py:obj:`~.cudaDevResource` + Input SM resource to be split. Must be a valid `cudaDevSmResource` + resource. + flags : unsigned int + Flags specifying how these partitions are used or which constraints + to abide by when splitting the input. Zero is valid for default + behavior. + minCount : unsigned int + Minimum number of SMs required + + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorNotPermitted`, :py:obj:`~.cudaErrorInvalidResourceType`, :py:obj:`~.cudaErrorInvalidResourceConfiguration`, :py:obj:`~.cudaErrorNotSupported`, :py:obj:`~.cudaErrorCudartUnloading`, :py:obj:`~.cudaErrorInitializationError` + result : list[:py:obj:`~.cudaDevResource`] + Output array of `cudaDevResource` resources. Can be NULL to query + the number of groups. + nbGroups : unsigned int + This is a pointer, specifying the number of groups that would be or + should be created as described below. + remaining : :py:obj:`~.cudaDevResource` + If the input resource cannot be cleanly split among `nbGroups`, the + remaining is placed in here. Can be ommitted (NULL) if the user + does not need the remaining set. + + See Also + -------- + :py:obj:`~.cuDevSmResourceSplitByCount`, :py:obj:`~.cudaDeviceGetDevResource`, :py:obj:`~.cudaExecutionCtxGetDevResource`, :py:obj:`~.cudaDevResourceGenerateDesc` + """ + cdef cyruntime.cudaDevResource* cyresult = NULL + pyresult = [cudaDevResource() for idx in range(nbGroups)] + if nbGroups != 0: + cyresult = calloc(nbGroups, sizeof(cyruntime.cudaDevResource)) + if cyresult is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(nbGroups) + 'x' + str(sizeof(cyruntime.cudaDevResource))) + cdef unsigned int cynbGroups = nbGroups + cdef cyruntime.cudaDevResource* cyinput__ptr = input_._pvt_ptr if input_ is not None else NULL + cdef cudaDevResource remaining = cudaDevResource() + with nogil: + err = cyruntime.cudaDevSmResourceSplitByCount(cyresult, &cynbGroups, cyinput__ptr, remaining._pvt_ptr, flags, minCount) + if cudaError_t(err) == cudaError_t(0): + for idx in range(nbGroups): + string.memcpy((pyresult[idx])._pvt_ptr, &cyresult[idx], sizeof(cyruntime.cudaDevResource)) + if cyresult is not NULL: + free(cyresult) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None, None, None) + return (_cudaError_t_SUCCESS, pyresult, cynbGroups, remaining) + +@cython.embedsignature(True) +def cudaDevSmResourceSplit(unsigned int nbGroups, input_ : Optional[cudaDevResource], unsigned int flags, groupParams : Optional[tuple[cudaDevSmResourceGroupParams] | list[cudaDevSmResourceGroupParams]]): + """ Splits a `cudaDevResourceTypeSm` resource into structured groups. + + This API will split a resource of :py:obj:`~.cudaDevResourceTypeSm` + into `nbGroups` structured device resource groups (the `result` array), + as well as an optional `remainder`, according to a set of requirements + specified in the `groupParams` array. The term “structured” is a trait + that specifies the `result` has SMs that are co-scheduled together. + This co-scheduling can be specified via the `coscheduledSmCount` field + of the `groupParams` structure, while the `smCount` will specify how + many SMs are required in total for that result. The remainder is always + “unstructured”, it does not have any set guarantees with respect to co- + scheduling and those properties will need to either be queried via the + occupancy set of APIs or further split into structured groups by this + API. + + The API has a discovery mode for use cases where it is difficult to + know ahead of time what the SM count should be. Discovery happens when + the `smCount` field of a given `groupParams` array entry is set to 0 - + the smCount will be filled in by the API with the derived SM count + according to the provided `groupParams` fields and constraints. + Discovery can be used with both a valid result array and with a NULL + `result` pointer value. The latter is useful in situations where the + smCount will end up being zero, which is an invalid value to create a + result entry with, but allowed for discovery purposes when the `result` + is NULL. + + The `groupParams` array is evaluated from index 0 to `nbGroups` - 1. + For each index in the `groupParams` array, the API will evaluate which + SMs may be a good fit based on constraints and assign those SMs to + `result`. This evaluation order is important to consider when using + discovery mode, as it helps discover the remaining SMs. + + For a valid call: + + - `result` should point to a `cudaDevResource` array of size + `nbGroups`, or alternatively, may be NULL, if the developer wishes + for only the groupParams entries to be updated + + - `input` should be a valid :py:obj:`~.cudaDevResourceTypeSm` resource + that originates from querying the execution context, or device. + + - The `remainder` group may be NULL. + + - There are no API `flags` at this time, so the value passed in should + be 0. + + - A :py:obj:`~.cudaDevSmResourceGroupParams` array of size `nbGroups`. + Each entry must be zero-initialized. + + - `smCount:` must be either 0 or in the range of [2,inputSmCount] + where inputSmCount is the amount of SMs the `input` resource has. + `smCount` must be a multiple of 2, as well as a multiple of + `coscheduledSmCount`. When assigning SMs to a group (and if results + are expected by having the `result` parameter set), `smCount` + cannot end up with 0 or a value less than `coscheduledSmCount` + otherwise :py:obj:`~.cudaErrorInvalidResourceConfiguration` will be + returned. + + - `coscheduledSmCount:` allows grouping SMs together in order to be + able to launch clusters on Compute Architecture 9.0+. The default + value may be queried from the device’s + :py:obj:`~.cudaDevResourceTypeSm` resource (8 on Compute + Architecture 9.0+ and 2 otherwise). The maximum is 32 on Compute + Architecture 9.0+ and 2 otherwise. + + - `preferredCoscheduledSmCount:` Attempts to merge + `coscheduledSmCount` groups into larger groups, in order to make + use of `preferredClusterDimensions` on Compute Architecture 10.0+. + The default value is set to `coscheduledSmCount`. + + - `flags:` + + - `cudaDevSmResourceGroupBackfill:` lets `smCount` be a non-multiple of + `coscheduledSmCount`, filling the difference between SM count and + already assigned co-scheduled groupings with other SMs. This lets any + resulting group behave similar to the `remainder` group for example. + + Example params and their effect: + + A groupParams array element is defined in the following order: + + **View CUDA Toolkit Documentation for a C++ code example** + + **View CUDA Toolkit Documentation for a C++ code example** -{{if 'cudaUserObjectRelease' in found_functions}} + **View CUDA Toolkit Documentation for a C++ code example** + + **View CUDA Toolkit Documentation for a C++ code example** + + The difference between a catch-all param group as the last entry and + the remainder is in two aspects: + + - The remainder may be NULL / _TYPE_INVALID (if there are no SMs + remaining), while a result group must always be valid. + + - The remainder does not have a structure, while the result group will + always need to adhere to a structure of coscheduledSmCount (even if + its just 2), and therefore must always have enough coscheduled SMs to + cover that requirement (even with the + `cudaDevSmResourceGroupBackfill` flag enabled). + + Splitting an input into N groups, can be accomplished by repeatedly + splitting off 1 group and re-splitting the remainder (a bisect + operation). However, it's recommended to accomplish this with a single + call wherever possible. + + Parameters + ---------- + nbGroups : unsigned int + Specifies the number of groups in `result` and `groupParams` + input : :py:obj:`~.cudaDevResource` + Input SM resource to be split. Must be a valid + `cudaDevResourceTypeSm` resource. + flags : unsigned int + Flags specifying how the API should behave. The value should be 0 + for now. + groupParams : list[:py:obj:`~.cudaDevSmResourceGroupParams`] + Description of how the SMs should be split and assigned to the + corresponding result entry. + + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorNotPermitted`, :py:obj:`~.cudaErrorInvalidResourceType`, :py:obj:`~.cudaErrorInvalidResourceConfiguration`, :py:obj:`~.cudaErrorNotSupported`, :py:obj:`~.cudaErrorCudartUnloading`, :py:obj:`~.cudaErrorInitializationError` + result : list[:py:obj:`~.cudaDevResource`] + Output array of `cudaDevResource` resources. Can be NULL, alongside + an smCount of 0, for discovery purpose. + remainder : :py:obj:`~.cudaDevResource` + If splitting the input resource leaves any SMs, the remainder is + placed in here. + + See Also + -------- + :py:obj:`~.cuDevSmResourceSplit`, :py:obj:`~.cudaDeviceGetDevResource`, :py:obj:`~.cudaExecutionCtxGetDevResource`, :py:obj:`~.cudaDevResourceGenerateDesc` + """ + groupParams = [] if groupParams is None else groupParams + if not all(isinstance(_x, (cudaDevSmResourceGroupParams,)) for _x in groupParams): + raise TypeError("Argument 'groupParams' is not instance of type (expected tuple[cyruntime.cudaDevSmResourceGroupParams,] or list[cyruntime.cudaDevSmResourceGroupParams,]") + cdef cyruntime.cudaDevResource* cyresult = NULL + pyresult = [cudaDevResource() for idx in range(nbGroups)] + if nbGroups != 0: + cyresult = calloc(nbGroups, sizeof(cyruntime.cudaDevResource)) + if cyresult is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(nbGroups) + 'x' + str(sizeof(cyruntime.cudaDevResource))) + cdef cyruntime.cudaDevResource* cyinput__ptr = input_._pvt_ptr if input_ is not None else NULL + cdef cudaDevResource remainder = cudaDevResource() + cdef cyruntime.cudaDevSmResourceGroupParams* cygroupParams = NULL + if len(groupParams) > 1: + cygroupParams = calloc(len(groupParams), sizeof(cyruntime.cudaDevSmResourceGroupParams)) + if cygroupParams is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(groupParams)) + 'x' + str(sizeof(cyruntime.cudaDevSmResourceGroupParams))) + for idx in range(len(groupParams)): + string.memcpy(&cygroupParams[idx], (groupParams[idx])._pvt_ptr, sizeof(cyruntime.cudaDevSmResourceGroupParams)) + elif len(groupParams) == 1: + cygroupParams = (groupParams[0])._pvt_ptr + with nogil: + err = cyruntime.cudaDevSmResourceSplit(cyresult, nbGroups, cyinput__ptr, remainder._pvt_ptr, flags, cygroupParams) + if cudaError_t(err) == cudaError_t(0): + for idx in range(nbGroups): + string.memcpy((pyresult[idx])._pvt_ptr, &cyresult[idx], sizeof(cyruntime.cudaDevResource)) + if cyresult is not NULL: + free(cyresult) + if len(groupParams) > 1 and cygroupParams is not NULL: + free(cygroupParams) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None, None) + return (_cudaError_t_SUCCESS, pyresult, remainder) @cython.embedsignature(True) -def cudaUserObjectRelease(object, unsigned int count): - """ Release a reference to a user object. +def cudaDevResourceGenerateDesc(resources : Optional[tuple[cudaDevResource] | list[cudaDevResource]], unsigned int nbResources): + """ Generate a resource descriptor. - Releases user object references owned by the caller. The object's - destructor is invoked if the reference count reaches zero. + Generates a single resource descriptor with the set of resources + specified in `resources`. The generated resource descriptor is + necessary for the creation of green contexts via the + :py:obj:`~.cudaGreenCtxCreate` API. Resources of the same type can be + passed in, provided they meet the requirements as noted below. - It is undefined behavior to release references not owned by the caller, - or to use a user object handle after all references are released. + A successful API call must have: - See CUDA User Objects in the CUDA C++ Programming Guide for more - information on user objects. + - A valid output pointer for the `phDesc` descriptor as well as a valid + array of `resources` pointers, with the array size passed in + `nbResources`. If multiple resources are provided in `resources`, the + device they came from must be the same, otherwise + :py:obj:`~.cudaErrorInvalidResourceConfiguration` is returned. If + multiple resources are provided in `resources` and they are of type + :py:obj:`~.cudaDevResourceTypeSm`, they must be outputs (whether + `result` or `remaining`) from the same split API instance and have + the same smCoscheduledAlignment values, otherwise + :py:obj:`~.cudaErrorInvalidResourceConfiguration` is returned. + + Note: The API is not supported on 32-bit platforms. Parameters ---------- - object : :py:obj:`~.cudaUserObject_t` - The object to release - count : unsigned int - The number of references to release, typically 1. Must be nonzero - and not larger than INT_MAX. + resources : list[:py:obj:`~.cudaDevResource`] + Array of resources to be included in the descriptor + nbResources : unsigned int + Number of resources passed in `resources` Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorNotPermitted`, :py:obj:`~.cudaErrorInvalidResourceType`, :py:obj:`~.cudaErrorInvalidResourceConfiguration`, :py:obj:`~.cudaErrorNotSupported`, :py:obj:`~.cudaErrorOutOfMemory`, :py:obj:`~.cudaErrorCudartUnloading`, :py:obj:`~.cudaErrorInitializationError` + phDesc : :py:obj:`~.cudaDevResourceDesc_t` + Output descriptor See Also -------- - :py:obj:`~.cudaUserObjectCreate`, :py:obj:`~.cudaUserObjectRetain`, :py:obj:`~.cudaGraphRetainUserObject`, :py:obj:`~.cudaGraphReleaseUserObject`, :py:obj:`~.cudaGraphCreate` + :py:obj:`~.cuDevResourceGenerateDesc`, :py:obj:`~.cudaDeviceGetDevResource`, :py:obj:`~.cudaExecutionCtxGetDevResource`, :py:obj:`~.cudaDevSmResourceSplit`, :py:obj:`~.cudaGreenCtxCreate` """ - cdef ccudart.cudaUserObject_t cobject - if object is None: - cobject = 0 - elif isinstance(object, (cudaUserObject_t,cuda.CUuserObject)): - pobject = int(object) - cobject = pobject - else: - pobject = int(cudaUserObject_t(object)) - cobject = pobject - err = ccudart.cudaUserObjectRelease(cobject, count) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaGraphRetainUserObject' in found_functions}} - -@cython.embedsignature(True) -def cudaGraphRetainUserObject(graph, object, unsigned int count, unsigned int flags): - """ Retain a reference to a user object from a graph. - - Creates or moves user object references that will be owned by a CUDA - graph. + resources = [] if resources is None else resources + if not all(isinstance(_x, (cudaDevResource,)) for _x in resources): + raise TypeError("Argument 'resources' is not instance of type (expected tuple[cyruntime.cudaDevResource,] or list[cyruntime.cudaDevResource,]") + cdef cudaDevResourceDesc_t phDesc = cudaDevResourceDesc_t() + cdef cyruntime.cudaDevResource* cyresources = NULL + if len(resources) > 1: + cyresources = calloc(len(resources), sizeof(cyruntime.cudaDevResource)) + if cyresources is NULL: + raise MemoryError('Failed to allocate length x size memory: ' + str(len(resources)) + 'x' + str(sizeof(cyruntime.cudaDevResource))) + for idx in range(len(resources)): + string.memcpy(&cyresources[idx], (resources[idx])._pvt_ptr, sizeof(cyruntime.cudaDevResource)) + elif len(resources) == 1: + cyresources = (resources[0])._pvt_ptr + with nogil: + err = cyruntime.cudaDevResourceGenerateDesc(phDesc._pvt_ptr, cyresources, nbResources) + if len(resources) > 1 and cyresources is not NULL: + free(cyresources) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, phDesc) + +@cython.embedsignature(True) +def cudaGreenCtxCreate(desc, int device, unsigned int flags): + """ Creates a green context with a specified set of resources. + + This API creates a green context with the resources specified in the + descriptor `desc` and returns it in the handle represented by `phCtx`. + + This API retains the device’s primary context for the lifetime of the + green context. The primary context will be released when the green + context is destroyed. To avoid the overhead of repeated initialization + and teardown, it is recommended to explicitly initialize the device's + primary context ahead of time using :py:obj:`~.cudaInitDevice`. This + ensures that the primary context remains initialized throughout the + program’s lifetime, minimizing overhead during green context creation + and destruction. + + The API does not create a default stream for the green context. + Developers are expected to create streams explicitly using + :py:obj:`~.cudaExecutionCtxStreamCreate` to submit work to the green + context. - See CUDA User Objects in the CUDA C++ Programming Guide for more - information on user objects. + Note: The API is not supported on 32-bit platforms. Parameters ---------- - graph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` - The graph to associate the reference with - object : :py:obj:`~.cudaUserObject_t` - The user object to retain a reference for - count : unsigned int - The number of references to add to the graph, typically 1. Must be - nonzero and not larger than INT_MAX. + desc : :py:obj:`~.cudaDevResourceDesc_t` + Descriptor generated via :py:obj:`~.cudaDevResourceGenerateDesc` + which contains the set of resources to be used + device : int + Device on which to create the green context. flags : unsigned int - The optional flag :py:obj:`~.cudaGraphUserObjectMove` transfers - references from the calling thread, rather than create new - references. Pass 0 to create new references. + Green context creation flags. Must be 0, currently reserved for + future use. Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidDevice`, :py:obj:`~.cudaErrorNotPermitted`, :py:obj:`~.cudaErrorNotSupported`, :py:obj:`~.cudaErrorOutOfMemory`, :py:obj:`~.cudaErrorCudartUnloading`, :py:obj:`~.cudaErrorInitializationError` + phCtx : :py:obj:`~.cudaExecutionContext_t` + Pointer for the output handle to the green context See Also -------- - :py:obj:`~.cudaUserObjectCreate` :py:obj:`~.cudaUserObjectRetain`, :py:obj:`~.cudaUserObjectRelease`, :py:obj:`~.cudaGraphReleaseUserObject`, :py:obj:`~.cudaGraphCreate` + :py:obj:`~.cudaDeviceGetDevResource`, :py:obj:`~.cudaDevSmResourceSplit`, :py:obj:`~.cudaDevResourceGenerateDesc`, :py:obj:`~.cudaExecutionCtxGetDevResource`, :py:obj:`~.cudaExecutionCtxDestroy`, :py:obj:`~.cudaInitDevice`, :py:obj:`~.cudaExecutionCtxStreamCreate` """ - cdef ccudart.cudaUserObject_t cobject - if object is None: - cobject = 0 - elif isinstance(object, (cudaUserObject_t,cuda.CUuserObject)): - pobject = int(object) - cobject = pobject - else: - pobject = int(cudaUserObject_t(object)) - cobject = pobject - cdef ccudart.cudaGraph_t cgraph - if graph is None: - cgraph = 0 - elif isinstance(graph, (cudaGraph_t,cuda.CUgraph)): - pgraph = int(graph) - cgraph = pgraph + cdef cyruntime.cudaDevResourceDesc_t cydesc + if desc is None: + pdesc = 0 + elif isinstance(desc, (cudaDevResourceDesc_t,)): + pdesc = int(desc) else: - pgraph = int(cudaGraph_t(graph)) - cgraph = pgraph - err = ccudart.cudaGraphRetainUserObject(cgraph, cobject, count, flags) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaGraphReleaseUserObject' in found_functions}} + pdesc = int(cudaDevResourceDesc_t(desc)) + cydesc = pdesc + cdef cudaExecutionContext_t phCtx = cudaExecutionContext_t() + with nogil: + err = cyruntime.cudaGreenCtxCreate(phCtx._pvt_ptr, cydesc, device, flags) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, phCtx) @cython.embedsignature(True) -def cudaGraphReleaseUserObject(graph, object, unsigned int count): - """ Release a user object reference from a graph. +def cudaExecutionCtxDestroy(ctx): + """ Destroy a execution context. - Releases user object references owned by a graph. + Destroys the specified execution context `ctx`. It is the + responsibility of the caller to ensure that no API call issues using + `ctx` while :py:obj:`~.cudaExecutionCtxDestroy()` is executing or + subsequently. - See CUDA User Objects in the CUDA C++ Programming Guide for more - information on user objects. + If `ctx` is a green context, any resources provisioned for it (that + were initially available via the resource descriptor) are released as + well. + + The API does not destroy streams created via + :py:obj:`~.cudaExecutionCtxStreamCreate`. Users are expected to destroy + these streams explicitly using :py:obj:`~.cudaStreamDestroy` to avoid + resource leaks. Once the execution context is destroyed, any subsequent + API calls involving these streams will return + :py:obj:`~.cudaErrorStreamDetached` with the exception of the following + APIs: + + - :py:obj:`~.cudaStreamDestroy`. Note this is only supported on CUDA + drivers 13.1 and above. + + Additionally, the API will invalidate all active captures on these + streams. + + Passing in a `ctx` that was not explicitly created via CUDA Runtime + APIs is not allowed and will result in undefined behavior. Parameters ---------- - graph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` - The graph that will release the reference - object : :py:obj:`~.cudaUserObject_t` - The user object to release a reference for - count : unsigned int - The number of references to release, typically 1. Must be nonzero - and not larger than INT_MAX. + ctx : :py:obj:`~.cudaExecutionContext_t` + Execution context to destroy (required parameter, see note below) Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorNotPermitted`, :py:obj:`~.cudaErrorCudartUnloading`, :py:obj:`~.cudaErrorInitializationError` See Also -------- - :py:obj:`~.cudaUserObjectCreate` :py:obj:`~.cudaUserObjectRetain`, :py:obj:`~.cudaUserObjectRelease`, :py:obj:`~.cudaGraphRetainUserObject`, :py:obj:`~.cudaGraphCreate` + :py:obj:`~.cudaGreenCtxCreate` """ - cdef ccudart.cudaUserObject_t cobject - if object is None: - cobject = 0 - elif isinstance(object, (cudaUserObject_t,cuda.CUuserObject)): - pobject = int(object) - cobject = pobject - else: - pobject = int(cudaUserObject_t(object)) - cobject = pobject - cdef ccudart.cudaGraph_t cgraph - if graph is None: - cgraph = 0 - elif isinstance(graph, (cudaGraph_t,cuda.CUgraph)): - pgraph = int(graph) - cgraph = pgraph + cdef cyruntime.cudaExecutionContext_t cyctx + if ctx is None: + pctx = 0 + elif isinstance(ctx, (cudaExecutionContext_t,)): + pctx = int(ctx) else: - pgraph = int(cudaGraph_t(graph)) - cgraph = pgraph - err = ccudart.cudaGraphReleaseUserObject(cgraph, cobject, count) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaGraphAddNode' in found_functions}} + pctx = int(cudaExecutionContext_t(ctx)) + cyctx = pctx + with nogil: + err = cyruntime.cudaExecutionCtxDestroy(cyctx) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaGraphAddNode(graph, pDependencies : Optional[List[cudaGraphNode_t]], size_t numDependencies, nodeParams : Optional[cudaGraphNodeParams]): - """ Adds a node of arbitrary type to a graph. - - Creates a new node in `graph` described by `nodeParams` with - `numDependencies` dependencies specified via `pDependencies`. - `numDependencies` may be 0. `pDependencies` may be null if - `numDependencies` is 0. `pDependencies` may not have any duplicate - entries. - - `nodeParams` is a tagged union. The node type should be specified in - the `typename` field, and type-specific parameters in the corresponding - union member. All unused bytes - that is, `reserved0` and all bytes - past the utilized union member - must be set to zero. It is recommended - to use brace initialization or memset to ensure all bytes are - initialized. +def cudaExecutionCtxGetDevResource(ctx, typename not None : cudaDevResourceType): + """ Get context resources. - Note that for some node types, `nodeParams` may contain "out - parameters" which are modified during the call, such as - `nodeParams->alloc.dptr`. + Get the `typename` resources available to context represented by `ctx`. - A handle to the new node will be returned in `phGraphNode`. + Note: The API is not supported on 32-bit platforms. Parameters ---------- - graph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` - Graph to which to add the node - pDependencies : List[:py:obj:`~.cudaGraphNode_t`] - Dependencies of the node - numDependencies : size_t - Number of dependencies - nodeParams : :py:obj:`~.cudaGraphNodeParams` - Specification of the node + ctx : :py:obj:`~.cudaExecutionContext_t` + Execution context to get resource for (required parameter, see note + below) + typename : :py:obj:`~.cudaDevResourceType` + Type of resource to retrieve Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidDeviceFunction`, :py:obj:`~.cudaErrorNotSupported` - pGraphNode : :py:obj:`~.cudaGraphNode_t` - Returns newly created node + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorNotSupported`, :py:obj:`~.cudaErrorNotPermitted`, :py:obj:`~.cudaErrorCudartUnloading`, :py:obj:`~.cudaErrorInitializationError` + resource : :py:obj:`~.cudaDevResource` + Output pointer to a :py:obj:`~.cudaDevResource` structure See Also -------- - :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphNodeSetParams`, :py:obj:`~.cudaGraphExecNodeSetParams` + :py:obj:`~.cudaDeviceGetDevResource`, :py:obj:`~.cudaDevSmResourceSplit`, :py:obj:`~.cudaDevResourceGenerateDesc`, :py:obj:`~.cudaGreenCtxCreate` """ - pDependencies = [] if pDependencies is None else pDependencies - if not all(isinstance(_x, (cudaGraphNode_t,cuda.CUgraphNode)) for _x in pDependencies): - raise TypeError("Argument 'pDependencies' is not instance of type (expected List[ccudart.cudaGraphNode_t,cuda.CUgraphNode]") - cdef ccudart.cudaGraph_t cgraph - if graph is None: - cgraph = 0 - elif isinstance(graph, (cudaGraph_t,cuda.CUgraph)): - pgraph = int(graph) - cgraph = pgraph + cdef cyruntime.cudaExecutionContext_t cyctx + if ctx is None: + pctx = 0 + elif isinstance(ctx, (cudaExecutionContext_t,)): + pctx = int(ctx) else: - pgraph = int(cudaGraph_t(graph)) - cgraph = pgraph - cdef cudaGraphNode_t pGraphNode = cudaGraphNode_t() - cdef ccudart.cudaGraphNode_t* cpDependencies = NULL - if len(pDependencies) > 0: - cpDependencies = calloc(len(pDependencies), sizeof(ccudart.cudaGraphNode_t)) - if cpDependencies is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(pDependencies)) + 'x' + str(sizeof(ccudart.cudaGraphNode_t))) - else: - for idx in range(len(pDependencies)): - cpDependencies[idx] = (pDependencies[idx])._ptr[0] - if numDependencies > len(pDependencies): raise RuntimeError("List is too small: " + str(len(pDependencies)) + " < " + str(numDependencies)) - cdef ccudart.cudaGraphNodeParams* cnodeParams_ptr = nodeParams._ptr if nodeParams != None else NULL - err = ccudart.cudaGraphAddNode(pGraphNode._ptr, cgraph, (pDependencies[0])._ptr if len(pDependencies) == 1 else cpDependencies, numDependencies, cnodeParams_ptr) - if cpDependencies is not NULL: - free(cpDependencies) - return (cudaError_t(err), pGraphNode) -{{endif}} - -{{if 'cudaGraphAddNode_v2' in found_functions}} + pctx = int(cudaExecutionContext_t(ctx)) + cyctx = pctx + cdef cudaDevResource resource = cudaDevResource() + cdef cyruntime.cudaDevResourceType cytypename = int(typename) + with nogil: + err = cyruntime.cudaExecutionCtxGetDevResource(cyctx, resource._pvt_ptr, cytypename) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, resource) @cython.embedsignature(True) -def cudaGraphAddNode_v2(graph, pDependencies : Optional[List[cudaGraphNode_t]], dependencyData : Optional[List[cudaGraphEdgeData]], size_t numDependencies, nodeParams : Optional[cudaGraphNodeParams]): - """ Adds a node of arbitrary type to a graph (12.3+) - - Creates a new node in `graph` described by `nodeParams` with - `numDependencies` dependencies specified via `pDependencies`. - `numDependencies` may be 0. `pDependencies` may be null if - `numDependencies` is 0. `pDependencies` may not have any duplicate - entries. - - `nodeParams` is a tagged union. The node type should be specified in - the `typename` field, and type-specific parameters in the corresponding - union member. All unused bytes - that is, `reserved0` and all bytes - past the utilized union member - must be set to zero. It is recommended - to use brace initialization or memset to ensure all bytes are - initialized. - - Note that for some node types, `nodeParams` may contain "out - parameters" which are modified during the call, such as - `nodeParams->alloc.dptr`. +def cudaExecutionCtxGetDevice(ctx): + """ Returns the device handle for the execution context. - A handle to the new node will be returned in `phGraphNode`. + Returns in `*device` the handle of the specified execution context's + device. The execution context should not be NULL. Parameters ---------- - graph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` - Graph to which to add the node - pDependencies : List[:py:obj:`~.cudaGraphNode_t`] - Dependencies of the node - dependencyData : List[:py:obj:`~.cudaGraphEdgeData`] - Optional edge data for the dependencies. If NULL, the data is - assumed to be default (zeroed) for all dependencies. - numDependencies : size_t - Number of dependencies - nodeParams : :py:obj:`~.cudaGraphNodeParams` - Specification of the node + ctx : :py:obj:`~.cudaExecutionContext_t` + Execution context for which to obtain the device (required + parameter, see note below) Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidDeviceFunction`, :py:obj:`~.cudaErrorNotSupported` - pGraphNode : :py:obj:`~.cudaGraphNode_t` - Returns newly created node + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorCudartUnloading`, :py:obj:`~.cudaErrorInitializationError`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorNotPermitted` + device : int + Returned device handle for the specified execution context See Also -------- - :py:obj:`~.cudaGraphCreate`, :py:obj:`~.cudaGraphNodeSetParams`, :py:obj:`~.cudaGraphExecNodeSetParams` + :py:obj:`~.cudaGreenCtxCreate`, :py:obj:`~.cudaExecutionCtxDestroy`, :py:obj:`~.cuCtxGetDevice` """ - dependencyData = [] if dependencyData is None else dependencyData - if not all(isinstance(_x, (cudaGraphEdgeData,)) for _x in dependencyData): - raise TypeError("Argument 'dependencyData' is not instance of type (expected List[ccudart.cudaGraphEdgeData,]") - pDependencies = [] if pDependencies is None else pDependencies - if not all(isinstance(_x, (cudaGraphNode_t,cuda.CUgraphNode)) for _x in pDependencies): - raise TypeError("Argument 'pDependencies' is not instance of type (expected List[ccudart.cudaGraphNode_t,cuda.CUgraphNode]") - cdef ccudart.cudaGraph_t cgraph - if graph is None: - cgraph = 0 - elif isinstance(graph, (cudaGraph_t,cuda.CUgraph)): - pgraph = int(graph) - cgraph = pgraph + cdef cyruntime.cudaExecutionContext_t cyctx + if ctx is None: + pctx = 0 + elif isinstance(ctx, (cudaExecutionContext_t,)): + pctx = int(ctx) else: - pgraph = int(cudaGraph_t(graph)) - cgraph = pgraph - cdef cudaGraphNode_t pGraphNode = cudaGraphNode_t() - cdef ccudart.cudaGraphNode_t* cpDependencies = NULL - if len(pDependencies) > 0: - cpDependencies = calloc(len(pDependencies), sizeof(ccudart.cudaGraphNode_t)) - if cpDependencies is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(pDependencies)) + 'x' + str(sizeof(ccudart.cudaGraphNode_t))) - else: - for idx in range(len(pDependencies)): - cpDependencies[idx] = (pDependencies[idx])._ptr[0] - cdef ccudart.cudaGraphEdgeData* cdependencyData = NULL - if len(dependencyData) > 0: - cdependencyData = calloc(len(dependencyData), sizeof(ccudart.cudaGraphEdgeData)) - if cdependencyData is NULL: - raise MemoryError('Failed to allocate length x size memory: ' + str(len(dependencyData)) + 'x' + str(sizeof(ccudart.cudaGraphEdgeData))) - for idx in range(len(dependencyData)): - string.memcpy(&cdependencyData[idx], (dependencyData[idx])._ptr, sizeof(ccudart.cudaGraphEdgeData)) - if numDependencies > len(pDependencies): raise RuntimeError("List is too small: " + str(len(pDependencies)) + " < " + str(numDependencies)) - if numDependencies > len(dependencyData): raise RuntimeError("List is too small: " + str(len(dependencyData)) + " < " + str(numDependencies)) - cdef ccudart.cudaGraphNodeParams* cnodeParams_ptr = nodeParams._ptr if nodeParams != None else NULL - err = ccudart.cudaGraphAddNode_v2(pGraphNode._ptr, cgraph, (pDependencies[0])._ptr if len(pDependencies) == 1 else cpDependencies, (dependencyData[0])._ptr if len(dependencyData) == 1 else cdependencyData, numDependencies, cnodeParams_ptr) - if cpDependencies is not NULL: - free(cpDependencies) - if cdependencyData is not NULL: - free(cdependencyData) - return (cudaError_t(err), pGraphNode) -{{endif}} - -{{if 'cudaGraphNodeSetParams' in found_functions}} + pctx = int(cudaExecutionContext_t(ctx)) + cyctx = pctx + cdef int device = 0 + with nogil: + err = cyruntime.cudaExecutionCtxGetDevice(&device, cyctx) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, device) @cython.embedsignature(True) -def cudaGraphNodeSetParams(node, nodeParams : Optional[cudaGraphNodeParams]): - """ Update's a graph node's parameters. - - Sets the parameters of graph node `node` to `nodeParams`. The node type - specified by `nodeParams->type` must match the type of `node`. - `nodeParams` must be fully initialized and all unused bytes (reserved, - padding) zeroed. +def cudaExecutionCtxGetId(ctx): + """ Returns the unique Id associated with the execution context supplied. - Modifying parameters is not supported for node types - cudaGraphNodeTypeMemAlloc and cudaGraphNodeTypeMemFree. + Returns in `ctxId` the unique Id which is associated with a given + context. The Id is unique for the life of the program for this instance + of CUDA. The execution context should not be NULL. Parameters - ---------- - node : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` - Node to set the parameters for - nodeParams : :py:obj:`~.cudaGraphNodeParams` - Parameters to copy + ---------- + ctx : :py:obj:`~.cudaExecutionContext_t` + Context for which to obtain the Id (required parameter, see note + below) Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidDeviceFunction`, :py:obj:`~.cudaErrorNotSupported` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorCudartUnloading`, :py:obj:`~.cudaErrorInitializationError`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorNotPermitted` + ctxId : unsigned long long + Pointer to store the Id of the context See Also -------- - :py:obj:`~.cudaGraphAddNode`, :py:obj:`~.cudaGraphExecNodeSetParams` + :py:obj:`~.cudaGreenCtxCreate`, :py:obj:`~.cudaExecutionCtxDestroy`, :py:obj:`~.cudaExecutionCtxGetDevice`, :py:obj:`~.cuCtxGetId` """ - cdef ccudart.cudaGraphNode_t cnode - if node is None: - cnode = 0 - elif isinstance(node, (cudaGraphNode_t,cuda.CUgraphNode)): - pnode = int(node) - cnode = pnode + cdef cyruntime.cudaExecutionContext_t cyctx + if ctx is None: + pctx = 0 + elif isinstance(ctx, (cudaExecutionContext_t,)): + pctx = int(ctx) else: - pnode = int(cudaGraphNode_t(node)) - cnode = pnode - cdef ccudart.cudaGraphNodeParams* cnodeParams_ptr = nodeParams._ptr if nodeParams != None else NULL - err = ccudart.cudaGraphNodeSetParams(cnode, cnodeParams_ptr) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaGraphExecNodeSetParams' in found_functions}} + pctx = int(cudaExecutionContext_t(ctx)) + cyctx = pctx + cdef unsigned long long ctxId = 0 + with nogil: + err = cyruntime.cudaExecutionCtxGetId(cyctx, &ctxId) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, ctxId) @cython.embedsignature(True) -def cudaGraphExecNodeSetParams(graphExec, node, nodeParams : Optional[cudaGraphNodeParams]): - """ Update's a graph node's parameters in an instantiated graph. +def cudaExecutionCtxStreamCreate(ctx, unsigned int flags, int priority): + """ Creates a stream and initializes it for the given execution context. - Sets the parameters of a node in an executable graph `graphExec`. The - node is identified by the corresponding node `node` in the non- - executable graph from which the executable graph was instantiated. - `node` must not have been removed from the original graph. + The API creates a CUDA stream with the specified `flags` and + `priority`, initializing it with resources as defined at the time of + creating the specified `ctx`. Additionally, the API also enables work + submitted to to the stream to be tracked under `ctx`. - The modifications only affect future launches of `graphExec`. Already - enqueued or running launches of `graphExec` are not affected by this - call. `node` is also not modified by this call. + The supported values for `flags` are: - Allowed changes to parameters on executable graphs are as follows: + - :py:obj:`~.cudaStreamDefault`: Default stream creation flag. This + would be :py:obj:`~.cudaStreamNonBlocking` for streams created on a + green context. - **View CUDA Toolkit Documentation for a table example** + - :py:obj:`~.cudaStreamNonBlocking`: Specifies that work running in the + created stream may run concurrently with work in stream 0 (the NULL + stream), and that the created stream should perform no implicit + synchronization with stream 0 + + Specifying `priority` affects the scheduling priority of work in the + stream. Priorities provide a hint to preferentially run work with + higher priority when possible, but do not preempt already-running work + or provide any other functional guarantee on execution order. + `priority` follows a convention where lower numbers represent higher + priorities. '0' represents default priority. The range of meaningful + numerical priorities can be queried using + :py:obj:`~.cudaDeviceGetStreamPriorityRange`. If the specified priority + is outside the numerical range returned by + :py:obj:`~.cudaDeviceGetStreamPriorityRange`, it will automatically be + clamped to the lowest or the highest number in the range. Parameters ---------- - graphExec : :py:obj:`~.CUgraphExec` or :py:obj:`~.cudaGraphExec_t` - The executable graph in which to update the specified node - node : :py:obj:`~.CUgraphNode` or :py:obj:`~.cudaGraphNode_t` - Corresponding node from the graph from which graphExec was - instantiated - nodeParams : :py:obj:`~.cudaGraphNodeParams` - Updated Parameters to set + ctx : :py:obj:`~.cudaExecutionContext_t` + Execution context to initialize the stream with (required + parameter, see note below) + flags : unsigned int + Flags for stream creation + priority : int + Stream priority Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidDeviceFunction`, :py:obj:`~.cudaErrorNotSupported` + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorNotPermitted`, :py:obj:`~.cudaErrorOutOfMemory`, :py:obj:`~.cudaErrorCudartUnloading`, :py:obj:`~.cudaErrorInitializationError` + phStream : :py:obj:`~.cudaStream_t` + Returned stream handle See Also -------- - :py:obj:`~.cudaGraphAddNode`, :py:obj:`~.cudaGraphNodeSetParams` :py:obj:`~.cudaGraphExecUpdate`, :py:obj:`~.cudaGraphInstantiate` + :py:obj:`~.cudaStreamDestroy`, :py:obj:`~.cudaGreenCtxCreate`, :py:obj:`~.cudaDeviceGetStreamPriorityRange`, :py:obj:`~.cudaStreamGetFlags`, :py:obj:`~.cudaStreamGetPriority`, :py:obj:`~.cudaStreamGetDevice`, :py:obj:`~.cudaStreamGetDevResource`, :py:obj:`~.cudaLaunchKernel`, :py:obj:`~.cudaEventRecord`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cudaStreamQuery`, :py:obj:`~.cudaStreamSynchronize`, :py:obj:`~.cudaStreamAddCallback` + + Notes + ----- + In the current implementation, only compute kernels launched in priority streams are affected by the stream's priority. Stream priorities have no effect on host-to-device and device-to-host memory operations. """ - cdef ccudart.cudaGraphNode_t cnode - if node is None: - cnode = 0 - elif isinstance(node, (cudaGraphNode_t,cuda.CUgraphNode)): - pnode = int(node) - cnode = pnode - else: - pnode = int(cudaGraphNode_t(node)) - cnode = pnode - cdef ccudart.cudaGraphExec_t cgraphExec - if graphExec is None: - cgraphExec = 0 - elif isinstance(graphExec, (cudaGraphExec_t,cuda.CUgraphExec)): - pgraphExec = int(graphExec) - cgraphExec = pgraphExec + cdef cyruntime.cudaExecutionContext_t cyctx + if ctx is None: + pctx = 0 + elif isinstance(ctx, (cudaExecutionContext_t,)): + pctx = int(ctx) else: - pgraphExec = int(cudaGraphExec_t(graphExec)) - cgraphExec = pgraphExec - cdef ccudart.cudaGraphNodeParams* cnodeParams_ptr = nodeParams._ptr if nodeParams != None else NULL - err = ccudart.cudaGraphExecNodeSetParams(cgraphExec, cnode, cnodeParams_ptr) - return (cudaError_t(err),) -{{endif}} - -{{if 'cudaGraphConditionalHandleCreate' in found_functions}} + pctx = int(cudaExecutionContext_t(ctx)) + cyctx = pctx + cdef cudaStream_t phStream = cudaStream_t() + with nogil: + err = cyruntime.cudaExecutionCtxStreamCreate(phStream._pvt_ptr, cyctx, flags, priority) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, phStream) @cython.embedsignature(True) -def cudaGraphConditionalHandleCreate(graph, unsigned int defaultLaunchValue, unsigned int flags): - """ Create a conditional handle. - - Creates a conditional handle associated with `hGraph`. +def cudaExecutionCtxSynchronize(ctx): + """ Block for the specified execution context's tasks to complete. - The conditional handle must be associated with a conditional node in - this graph or one of its children. + Blocks until the specified execution context has completed all + preceding requested tasks. If the specified execution context is the + device (primary) context obtained via + :py:obj:`~.cudaDeviceGetExecutionCtx`, green contexts that have been + created on the device will also be synchronized. - Handles not associated with a conditional node may cause graph - instantiation to fail. + The API returns an error if one of the preceding tasks failed. Parameters ---------- - hGraph : :py:obj:`~.CUgraph` or :py:obj:`~.cudaGraph_t` - Graph which will contain the conditional node using this handle. - defaultLaunchValue : unsigned int - Optional initial value for the conditional variable. - flags : unsigned int - Currently must be cudaGraphCondAssignDefault or 0. + ctx : :py:obj:`~.cudaExecutionContext_t` + Execution context to synchronize (required parameter, see note + below) Returns ------- cudaError_t - :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_NOT_SUPPORTED` - pHandle_out : :py:obj:`~.cudaGraphConditionalHandle` - Pointer used to return the handle to the caller. + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorCudartUnloading`, :py:obj:`~.cudaErrorDeviceUninitialized`, :py:obj:`~.cudaErrorInvalidValue` See Also -------- - :py:obj:`~.cuGraphAddNode`, + :py:obj:`~.cudaGreenCtxCreate`, :py:obj:`~.cudaExecutionCtxDestroy`, :py:obj:`~.cudaDeviceSynchronize`, :py:obj:`~.cuCtxSynchronize_v2` """ - cdef ccudart.cudaGraph_t cgraph - if graph is None: - cgraph = 0 - elif isinstance(graph, (cudaGraph_t,cuda.CUgraph)): - pgraph = int(graph) - cgraph = pgraph + cdef cyruntime.cudaExecutionContext_t cyctx + if ctx is None: + pctx = 0 + elif isinstance(ctx, (cudaExecutionContext_t,)): + pctx = int(ctx) else: - pgraph = int(cudaGraph_t(graph)) - cgraph = pgraph - cdef cudaGraphConditionalHandle pHandle_out = cudaGraphConditionalHandle() - err = ccudart.cudaGraphConditionalHandleCreate(pHandle_out._ptr, cgraph, defaultLaunchValue, flags) - return (cudaError_t(err), pHandle_out) -{{endif}} - -{{if 'cudaGetDriverEntryPoint' in found_functions}} + pctx = int(cudaExecutionContext_t(ctx)) + cyctx = pctx + with nogil: + err = cyruntime.cudaExecutionCtxSynchronize(cyctx) + return (_cudaError_t(err),) @cython.embedsignature(True) -def cudaGetDriverEntryPoint(char* symbol, unsigned long long flags): - """ Returns the requested driver API function pointer. - - Returns in `**funcPtr` the address of the CUDA driver function for the - requested flags. - - For a requested driver symbol, if the CUDA version in which the driver - symbol was introduced is less than or equal to the CUDA runtime - version, the API will return the function pointer to the corresponding - versioned driver function. - - The pointer returned by the API should be cast to a function pointer - matching the requested driver function's definition in the API header - file. The function pointer typedef can be picked up from the - corresponding typedefs header file. For example, cudaTypedefs.h - consists of function pointer typedefs for driver APIs defined in - cuda.h. - - The API will return :py:obj:`~.cudaSuccess` and set the returned - `funcPtr` if the requested driver function is valid and supported on - the platform. +def cudaStreamGetDevResource(hStream, typename not None : cudaDevResourceType): + """ Get stream resources. - The API will return :py:obj:`~.cudaSuccess` and set the returned - `funcPtr` to NULL if the requested driver function is not supported on - the platform, no ABI compatible driver function exists for the CUDA - runtime version or if the driver symbol is invalid. - - It will also set the optional `driverStatus` to one of the values in - :py:obj:`~.cudaDriverEntryPointQueryResult` with the following - meanings: - - - :py:obj:`~.cudaDriverEntryPointSuccess` - The requested symbol was - succesfully found based on input arguments and `pfn` is valid - - - :py:obj:`~.cudaDriverEntryPointSymbolNotFound` - The requested symbol - was not found - - - :py:obj:`~.cudaDriverEntryPointVersionNotSufficent` - The requested - symbol was found but is not supported by the current runtime version - (CUDART_VERSION) - - The requested flags can be: - - - :py:obj:`~.cudaEnableDefault`: This is the default mode. This is - equivalent to :py:obj:`~.cudaEnablePerThreadDefaultStream` if the - code is compiled with --default-stream per-thread compilation flag or - the macro CUDA_API_PER_THREAD_DEFAULT_STREAM is defined; - :py:obj:`~.cudaEnableLegacyStream` otherwise. - - - :py:obj:`~.cudaEnableLegacyStream`: This will enable the search for - all driver symbols that match the requested driver symbol name except - the corresponding per-thread versions. + Get the `typename` resources available to the `hStream` and store them + in `resource`. - - :py:obj:`~.cudaEnablePerThreadDefaultStream`: This will enable the - search for all driver symbols that match the requested driver symbol - name including the per-thread versions. If a per-thread version is - not found, the API will return the legacy version of the driver - function. + Note: The API will return :py:obj:`~.cudaErrorInvalidResourceType` is + `typename` is `cudaDevResourceTypeWorkqueueConfig` or + `cudaDevResourceTypeWorkqueue`. Parameters ---------- - symbol : bytes - The base name of the driver API function to look for. As an - example, for the driver API :py:obj:`~.cuMemAlloc_v2`, `symbol` - would be cuMemAlloc. Note that the API will use the CUDA runtime - version to return the address to the most recent ABI compatible - driver symbol, :py:obj:`~.cuMemAlloc` or :py:obj:`~.cuMemAlloc_v2`. - flags : unsigned long long - Flags to specify search options. + hStream : :py:obj:`~.CUstream` or :py:obj:`~.cudaStream_t` + Stream to get resource for + typename : :py:obj:`~.cudaDevResourceType` + Type of resource to retrieve Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorNotSupported` - funcPtr : Any - Location to return the function pointer to the requested driver - function - driverStatus : :py:obj:`~.cudaDriverEntryPointQueryResult` - Optional location to store the status of finding the symbol from - the driver. See :py:obj:`~.cudaDriverEntryPointQueryResult` for - possible values. + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorCudartUnloading`, :py:obj:`~.cudaErrorInitializationError`, :py:obj:`~.cudaErrorDeviceUninitialized`, :py:obj:`~.cudaErrorInvalidResourceType`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidHandle`, :py:obj:`~.cudaErrorNotPermitted`, :py:obj:`~.cudaErrorCallRequiresNewerDriver`, + resource : :py:obj:`~.cudaDevResource` + Output pointer to a :py:obj:`~.cudaDevResource` structure See Also -------- - :py:obj:`~.cuGetProcAddress` + :py:obj:`~.cudaGreenCtxCreate`, :py:obj:`~.cudaExecutionCtxStreamCreate`, :py:obj:`~.cudaStreamCreate`, :py:obj:`~.cudaDevSmResourceSplit`, :py:obj:`~.cudaDevResourceGenerateDesc`, :py:obj:`~.cuStreamGetDevResource` """ - cdef void_ptr funcPtr = 0 - cdef ccudart.cudaDriverEntryPointQueryResult driverStatus - err = ccudart.cudaGetDriverEntryPoint(symbol, &funcPtr, flags, &driverStatus) - return (cudaError_t(err), funcPtr, cudaDriverEntryPointQueryResult(driverStatus)) -{{endif}} - -{{if 'cudaGetDriverEntryPointByVersion' in found_functions}} + cdef cyruntime.cudaStream_t cyhStream + if hStream is None: + phStream = 0 + elif isinstance(hStream, (cudaStream_t,driver.CUstream)): + phStream = int(hStream) + else: + phStream = int(cudaStream_t(hStream)) + cyhStream = phStream + cdef cudaDevResource resource = cudaDevResource() + cdef cyruntime.cudaDevResourceType cytypename = int(typename) + with nogil: + err = cyruntime.cudaStreamGetDevResource(cyhStream, resource._pvt_ptr, cytypename) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, resource) @cython.embedsignature(True) -def cudaGetDriverEntryPointByVersion(char* symbol, unsigned int cudaVersion, unsigned long long flags): - """ Returns the requested driver API function pointer by CUDA version. +def cudaExecutionCtxRecordEvent(ctx, event): + """ Records an event for the specified execution context. - Returns in `**funcPtr` the address of the CUDA driver function for the - requested flags and CUDA driver version. + Captures in `event` all the activities of the execution context `ctx` + at the time of this call. `event` and `ctx` must be from the same CUDA + device, otherwise :py:obj:`~.cudaErrorInvalidHandle` will be returned. + Calls such as :py:obj:`~.cudaEventQuery()` or + :py:obj:`~.cudaExecutionCtxWaitEvent()` will then examine or wait for + completion of the work that was captured. Uses of `ctx` after this call + do not modify `event`. If the execution context passed to `ctx` is the + device (primary) context obtained via + :py:obj:`~.cudaDeviceGetExecutionCtx()`, `event` will capture all the + activities of the green contexts created on the device as well. - The CUDA version is specified as (1000 * major + 10 * minor), so CUDA - 11.2 should be specified as 11020. For a requested driver symbol, if - the specified CUDA version is greater than or equal to the CUDA version - in which the driver symbol was introduced, this API will return the - function pointer to the corresponding versioned function. + Parameters + ---------- + ctx : :py:obj:`~.cudaExecutionContext_t` + Execution context to record event for (required parameter, see note + below) + event : :py:obj:`~.CUevent` or :py:obj:`~.cudaEvent_t` + Event to record - The pointer returned by the API should be cast to a function pointer - matching the requested driver function's definition in the API header - file. The function pointer typedef can be picked up from the - corresponding typedefs header file. For example, cudaTypedefs.h - consists of function pointer typedefs for driver APIs defined in - cuda.h. + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorCudartUnloading`, :py:obj:`~.cudaErrorInitializationError`, :py:obj:`~.cudaErrorInvalidHandle`, :py:obj:`~.cudaErrorStreamCaptureUnsupported` - For the case where the CUDA version requested is greater than the CUDA - Toolkit installed, there may not be an appropriate function pointer - typedef in the corresponding header file and may need a custom typedef - to match the driver function signature returned. This can be done by - getting the typedefs from a later toolkit or creating appropriately - matching custom function typedefs. + See Also + -------- + :py:obj:`~.cudaEventRecord`, :py:obj:`~.cudaExecutionCtxWaitEvent`, :py:obj:`~.cuCtxRecordEvent`, :py:obj:`~.cuGreenCtxRecordEvent` - The API will return :py:obj:`~.cudaSuccess` and set the returned - `funcPtr` if the requested driver function is valid and supported on - the platform. + Notes + ----- + The API will return :py:obj:`~.cudaErrorStreamCaptureUnsupported` if the specified execution context `ctx` has a stream in the capture mode. In such a case, the call will invalidate all the conflicting captures. + """ + cdef cyruntime.cudaEvent_t cyevent + if event is None: + pevent = 0 + elif isinstance(event, (cudaEvent_t,driver.CUevent)): + pevent = int(event) + else: + pevent = int(cudaEvent_t(event)) + cyevent = pevent + cdef cyruntime.cudaExecutionContext_t cyctx + if ctx is None: + pctx = 0 + elif isinstance(ctx, (cudaExecutionContext_t,)): + pctx = int(ctx) + else: + pctx = int(cudaExecutionContext_t(ctx)) + cyctx = pctx + with nogil: + err = cyruntime.cudaExecutionCtxRecordEvent(cyctx, cyevent) + return (_cudaError_t(err),) - The API will return :py:obj:`~.cudaSuccess` and set the returned - `funcPtr` to NULL if the requested driver function is not supported on - the platform, no ABI compatible driver function exists for the - requested version or if the driver symbol is invalid. +@cython.embedsignature(True) +def cudaExecutionCtxWaitEvent(ctx, event): + """ Make an execution context wait on an event. - It will also set the optional `driverStatus` to one of the values in - :py:obj:`~.cudaDriverEntryPointQueryResult` with the following - meanings: + Makes all future work submitted to execution context `ctx` wait for all + work captured in `event`. The synchronization will be performed on the + device and will not block the calling CPU thread. See + :py:obj:`~.cudaExecutionCtxRecordEvent()` for details on what is + captured by an event. If the execution context passed to `ctx` is the + device (primary) context obtained via + :py:obj:`~.cudaDeviceGetExecutionCtx()`, all green contexts created on + the device will wait for `event` as well. - - :py:obj:`~.cudaDriverEntryPointSuccess` - The requested symbol was - succesfully found based on input arguments and `pfn` is valid + Parameters + ---------- + ctx : :py:obj:`~.cudaExecutionContext_t` + Execution context to wait for (required parameter, see note below) + event : :py:obj:`~.CUevent` or :py:obj:`~.cudaEvent_t` + Event to wait on - - :py:obj:`~.cudaDriverEntryPointSymbolNotFound` - The requested symbol - was not found + Returns + ------- + cudaError_t + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorCudartUnloading`, :py:obj:`~.cudaErrorInitializationError`, :py:obj:`~.cudaErrorInvalidHandle`, :py:obj:`~.cudaErrorStreamCaptureUnsupported` - - :py:obj:`~.cudaDriverEntryPointVersionNotSufficent` - The requested - symbol was found but is not supported by the specified version - `cudaVersion` + See Also + -------- + :py:obj:`~.cudaExecutionCtxRecordEvent`, :py:obj:`~.cudaStreamWaitEvent`, :py:obj:`~.cuCtxWaitEvent`, :py:obj:`~.cuGreenCtxWaitEvent` - The requested flags can be: + Notes + ----- + `event` may be from a different execution context or device than `ctx`. - - :py:obj:`~.cudaEnableDefault`: This is the default mode. This is - equivalent to :py:obj:`~.cudaEnablePerThreadDefaultStream` if the - code is compiled with --default-stream per-thread compilation flag or - the macro CUDA_API_PER_THREAD_DEFAULT_STREAM is defined; - :py:obj:`~.cudaEnableLegacyStream` otherwise. + The API will return :py:obj:`~.cudaErrorStreamCaptureUnsupported` and invalidate the capture if the specified event `event` is part of an ongoing capture sequence or if the specified execution context `ctx` has a stream in the capture mode. + """ + cdef cyruntime.cudaEvent_t cyevent + if event is None: + pevent = 0 + elif isinstance(event, (cudaEvent_t,driver.CUevent)): + pevent = int(event) + else: + pevent = int(cudaEvent_t(event)) + cyevent = pevent + cdef cyruntime.cudaExecutionContext_t cyctx + if ctx is None: + pctx = 0 + elif isinstance(ctx, (cudaExecutionContext_t,)): + pctx = int(ctx) + else: + pctx = int(cudaExecutionContext_t(ctx)) + cyctx = pctx + with nogil: + err = cyruntime.cudaExecutionCtxWaitEvent(cyctx, cyevent) + return (_cudaError_t(err),) - - :py:obj:`~.cudaEnableLegacyStream`: This will enable the search for - all driver symbols that match the requested driver symbol name except - the corresponding per-thread versions. +@cython.embedsignature(True) +def cudaDeviceGetExecutionCtx(int device): + """ Returns the execution context for a device. - - :py:obj:`~.cudaEnablePerThreadDefaultStream`: This will enable the - search for all driver symbols that match the requested driver symbol - name including the per-thread versions. If a per-thread version is - not found, the API will return the legacy version of the driver - function. + Returns in `ctx` the execution context for the specified device. This + is the device's primary context. The returned context can then be + passed to APIs that take in a :py:obj:`~.cudaExecutionContext_t` + enabling explicit context-based programming without relying on thread- + local state. - Parameters - ---------- - symbol : bytes - The base name of the driver API function to look for. As an - example, for the driver API :py:obj:`~.cuMemAlloc_v2`, `symbol` - would be cuMemAlloc. - cudaVersion : unsigned int - The CUDA version to look for the requested driver symbol - flags : unsigned long long - Flags to specify search options. + Passing the returned execution context to + :py:obj:`~.cudaExecutionCtxDestroy()` is not allowed and will result in + undefined behavior. + + Parameters + ---------- + device : int + Device to get the execution context for Returns ------- cudaError_t - :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorNotSupported` - funcPtr : Any - Location to return the function pointer to the requested driver - function - driverStatus : :py:obj:`~.cudaDriverEntryPointQueryResult` - Optional location to store the status of finding the symbol from - the driver. See :py:obj:`~.cudaDriverEntryPointQueryResult` for - possible values. + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidDevice` + ctx : :py:obj:`~.cudaExecutionContext_t` + Returns the device execution context See Also -------- - :py:obj:`~.cuGetProcAddress` + :py:obj:`~.cudaExecutionCtxGetDevice`, :py:obj:`~.cudaExecutionCtxGetId` """ - cdef void_ptr funcPtr = 0 - cdef ccudart.cudaDriverEntryPointQueryResult driverStatus - err = ccudart.cudaGetDriverEntryPointByVersion(symbol, &funcPtr, cudaVersion, flags, &driverStatus) - return (cudaError_t(err), funcPtr, cudaDriverEntryPointQueryResult(driverStatus)) -{{endif}} - -{{if 'cudaGetExportTable' in found_functions}} + cdef cudaExecutionContext_t ctx = cudaExecutionContext_t() + with nogil: + err = cyruntime.cudaDeviceGetExecutionCtx(ctx._pvt_ptr, device) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, ctx) @cython.embedsignature(True) def cudaGetExportTable(pExportTableId : Optional[cudaUUID_t]): """""" cdef void_ptr ppExportTable = 0 - cdef ccudart.cudaUUID_t* cpExportTableId_ptr = pExportTableId._ptr if pExportTableId != None else NULL - err = ccudart.cudaGetExportTable(&ppExportTable, cpExportTableId_ptr) - return (cudaError_t(err), ppExportTable) -{{endif}} - -{{if 'cudaGetKernel' in found_functions}} + cdef cyruntime.cudaUUID_t* cypExportTableId_ptr = pExportTableId._pvt_ptr if pExportTableId is not None else NULL + with nogil: + err = cyruntime.cudaGetExportTable(&ppExportTable, cypExportTableId_ptr) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, ppExportTable) @cython.embedsignature(True) def cudaGetKernel(entryFuncAddr): @@ -30581,6 +39267,15 @@ def cudaGetKernel(entryFuncAddr): Returns in `kernelPtr` the device kernel corresponding to the entry function `entryFuncAddr`. + Note that it is possible that there are multiple symbols belonging to + different translation units with the same `entryFuncAddr` registered + with this CUDA Runtime and so the order which the translation units are + loaded and registered with the CUDA Runtime can lead to differing + return pointers in `kernelPtr` . Suggested methods of ensuring + uniqueness are to limit visibility of global device functions by using + static or hidden visibility attribute in the respective translation + units. + Parameters ---------- entryFuncAddr : Any @@ -30598,13 +39293,14 @@ def cudaGetKernel(entryFuncAddr): cudaGetKernel (C++ API) """ cdef cudaKernel_t kernelPtr = cudaKernel_t() - centryFuncAddr = utils.HelperInputVoidPtr(entryFuncAddr) - cdef void* centryFuncAddr_ptr = centryFuncAddr.cptr - err = ccudart.cudaGetKernel(kernelPtr._ptr, centryFuncAddr_ptr) - return (cudaError_t(err), kernelPtr) -{{endif}} - -{{if 'make_cudaPitchedPtr' in found_functions}} + cdef _HelperInputVoidPtrStruct cyentryFuncAddrHelper + cdef void* cyentryFuncAddr = _helper_input_void_ptr(entryFuncAddr, &cyentryFuncAddrHelper) + with nogil: + err = cyruntime.cudaGetKernel(kernelPtr._pvt_ptr, cyentryFuncAddr) + _helper_input_void_ptr_free(&cyentryFuncAddrHelper) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, kernelPtr) @cython.embedsignature(True) def make_cudaPitchedPtr(d, size_t p, size_t xsz, size_t ysz): @@ -30635,15 +39331,14 @@ def make_cudaPitchedPtr(d, size_t p, size_t xsz, size_t ysz): -------- make_cudaExtent, make_cudaPos """ - cd = utils.HelperInputVoidPtr(d) - cdef void* cd_ptr = cd.cptr - err = ccudart.make_cudaPitchedPtr(cd_ptr, p, xsz, ysz) + cdef _HelperInputVoidPtrStruct cydHelper + cdef void* cyd = _helper_input_void_ptr(d, &cydHelper) + with nogil: + err = cyruntime.make_cudaPitchedPtr(cyd, p, xsz, ysz) + _helper_input_void_ptr_free(&cydHelper) cdef cudaPitchedPtr wrapper = cudaPitchedPtr() - wrapper._ptr[0] = err + wrapper._pvt_ptr[0] = err return wrapper -{{endif}} - -{{if 'make_cudaPos' in found_functions}} @cython.embedsignature(True) def make_cudaPos(size_t x, size_t y, size_t z): @@ -30672,13 +39367,11 @@ def make_cudaPos(size_t x, size_t y, size_t z): -------- make_cudaExtent, make_cudaPitchedPtr """ - err = ccudart.make_cudaPos(x, y, z) + with nogil: + err = cyruntime.make_cudaPos(x, y, z) cdef cudaPos wrapper = cudaPos() - wrapper._ptr[0] = err + wrapper._pvt_ptr[0] = err return wrapper -{{endif}} - -{{if 'make_cudaExtent' in found_functions}} @cython.embedsignature(True) def make_cudaExtent(size_t w, size_t h, size_t d): @@ -30708,23 +39401,22 @@ def make_cudaExtent(size_t w, size_t h, size_t d): -------- make_cudaPitchedPtr, make_cudaPos """ - err = ccudart.make_cudaExtent(w, h, d) + with nogil: + err = cyruntime.make_cudaExtent(w, h, d) cdef cudaExtent wrapper = cudaExtent() - wrapper._ptr[0] = err + wrapper._pvt_ptr[0] = err return wrapper -{{endif}} - -{{if True}} @cython.embedsignature(True) def cudaGraphicsEGLRegisterImage(image, unsigned int flags): """ Registers an EGL image. - Registers the EGLImageKHR specified by `image` for access by CUDA. A - handle to the registered object is returned as `pCudaResource`. - Additional Mapping/Unmapping is not required for the registered - resource and :py:obj:`~.cudaGraphicsResourceGetMappedEglFrame` can be - directly called on the `pCudaResource`. + Registers the :py:obj:`~.EGLImageKHR` specified by `image` for access + by CUDA. A handle to the registered object is returned as + `pCudaResource`. Additional Mapping/Unmapping is not required for the + registered resource and + :py:obj:`~.cudaGraphicsResourceGetMappedEglFrame` can be directly + called on the `pCudaResource`. The application will be responsible for synchronizing access to shared objects. The application must ensure that any pending operation which @@ -30752,14 +39444,15 @@ def cudaGraphicsEGLRegisterImage(image, unsigned int flags): contents of the resource, so none of the data previously stored in the resource will be preserved. - The EGLImageKHR is an object which can be used to create EGLImage - target resource. It is defined as a void pointer. typedef void* - EGLImageKHR + The :py:obj:`~.EGLImageKHR` is an object which can be used to create + EGLImage target resource. It is defined as a void pointer. typedef + void* :py:obj:`~.EGLImageKHR` Parameters ---------- image : :py:obj:`~.EGLImageKHR` - An EGLImageKHR image which can be used to create target resource. + An :py:obj:`~.EGLImageKHR` image which can be used to create target + resource. flags : unsigned int Map flags @@ -30774,35 +39467,35 @@ def cudaGraphicsEGLRegisterImage(image, unsigned int flags): -------- :py:obj:`~.cudaGraphicsUnregisterResource`, :py:obj:`~.cudaGraphicsResourceGetMappedEglFrame`, :py:obj:`~.cuGraphicsEGLRegisterImage` """ - cdef ccudart.EGLImageKHR cimage + cdef cyruntime.EGLImageKHR cyimage if image is None: - cimage = 0 + pimage = 0 elif isinstance(image, (EGLImageKHR,)): pimage = int(image) - cimage = pimage else: pimage = int(EGLImageKHR(image)) - cimage = pimage + cyimage = pimage cdef cudaGraphicsResource_t pCudaResource = cudaGraphicsResource_t() - err = ccudart.cudaGraphicsEGLRegisterImage(pCudaResource._ptr, cimage, flags) - return (cudaError_t(err), pCudaResource) -{{endif}} - -{{if True}} + with nogil: + err = cyruntime.cudaGraphicsEGLRegisterImage(pCudaResource._pvt_ptr, cyimage, flags) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, pCudaResource) @cython.embedsignature(True) def cudaEGLStreamConsumerConnect(eglStream): """ Connect CUDA to EGLStream as a consumer. - Connect CUDA as a consumer to EGLStreamKHR specified by `eglStream`. + Connect CUDA as a consumer to :py:obj:`~.EGLStreamKHR` specified by + `eglStream`. - The EGLStreamKHR is an EGL object that transfers a sequence of image - frames from one API to another. + The :py:obj:`~.EGLStreamKHR` is an EGL object that transfers a sequence + of image frames from one API to another. Parameters ---------- eglStream : :py:obj:`~.EGLStreamKHR` - EGLStreamKHR handle + :py:obj:`~.EGLStreamKHR` handle Returns ------- @@ -30815,28 +39508,28 @@ def cudaEGLStreamConsumerConnect(eglStream): -------- :py:obj:`~.cudaEGLStreamConsumerDisconnect`, :py:obj:`~.cudaEGLStreamConsumerAcquireFrame`, :py:obj:`~.cudaEGLStreamConsumerReleaseFrame`, :py:obj:`~.cuEGLStreamConsumerConnect` """ - cdef ccudart.EGLStreamKHR ceglStream + cdef cyruntime.EGLStreamKHR cyeglStream if eglStream is None: - ceglStream = 0 + peglStream = 0 elif isinstance(eglStream, (EGLStreamKHR,)): peglStream = int(eglStream) - ceglStream = peglStream else: peglStream = int(EGLStreamKHR(eglStream)) - ceglStream = peglStream + cyeglStream = peglStream cdef cudaEglStreamConnection conn = cudaEglStreamConnection() - err = ccudart.cudaEGLStreamConsumerConnect(conn._ptr, ceglStream) - return (cudaError_t(err), conn) -{{endif}} - -{{if True}} + with nogil: + err = cyruntime.cudaEGLStreamConsumerConnect(conn._pvt_ptr, cyeglStream) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, conn) @cython.embedsignature(True) def cudaEGLStreamConsumerConnectWithFlags(eglStream, unsigned int flags): """ Connect CUDA to EGLStream as a consumer with given flags. - Connect CUDA as a consumer to EGLStreamKHR specified by `stream` with - specified `flags` defined by :py:obj:`~.cudaEglResourceLocationFlags`. + Connect CUDA as a consumer to :py:obj:`~.EGLStreamKHR` specified by + `stream` with specified `flags` defined by + :py:obj:`~.cudaEglResourceLocationFlags`. The flags specify whether the consumer wants to access frames from system memory or video memory. Default is @@ -30845,7 +39538,7 @@ def cudaEGLStreamConsumerConnectWithFlags(eglStream, unsigned int flags): Parameters ---------- eglStream : :py:obj:`~.EGLStreamKHR` - EGLStreamKHR handle + :py:obj:`~.EGLStreamKHR` handle flags : unsigned int Flags denote intended location - system or video. @@ -30860,27 +39553,26 @@ def cudaEGLStreamConsumerConnectWithFlags(eglStream, unsigned int flags): -------- :py:obj:`~.cudaEGLStreamConsumerDisconnect`, :py:obj:`~.cudaEGLStreamConsumerAcquireFrame`, :py:obj:`~.cudaEGLStreamConsumerReleaseFrame`, :py:obj:`~.cuEGLStreamConsumerConnectWithFlags` """ - cdef ccudart.EGLStreamKHR ceglStream + cdef cyruntime.EGLStreamKHR cyeglStream if eglStream is None: - ceglStream = 0 + peglStream = 0 elif isinstance(eglStream, (EGLStreamKHR,)): peglStream = int(eglStream) - ceglStream = peglStream else: peglStream = int(EGLStreamKHR(eglStream)) - ceglStream = peglStream + cyeglStream = peglStream cdef cudaEglStreamConnection conn = cudaEglStreamConnection() - err = ccudart.cudaEGLStreamConsumerConnectWithFlags(conn._ptr, ceglStream, flags) - return (cudaError_t(err), conn) -{{endif}} - -{{if True}} + with nogil: + err = cyruntime.cudaEGLStreamConsumerConnectWithFlags(conn._pvt_ptr, cyeglStream, flags) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, conn) @cython.embedsignature(True) def cudaEGLStreamConsumerDisconnect(conn): """ Disconnect CUDA as a consumer to EGLStream . - Disconnect CUDA as a consumer to EGLStreamKHR. + Disconnect CUDA as a consumer to :py:obj:`~.EGLStreamKHR`. Parameters ---------- @@ -30896,27 +39588,25 @@ def cudaEGLStreamConsumerDisconnect(conn): -------- :py:obj:`~.cudaEGLStreamConsumerConnect`, :py:obj:`~.cudaEGLStreamConsumerAcquireFrame`, :py:obj:`~.cudaEGLStreamConsumerReleaseFrame`, :py:obj:`~.cuEGLStreamConsumerDisconnect` """ - cdef ccudart.cudaEglStreamConnection *cconn + cdef cyruntime.cudaEglStreamConnection *cyconn if conn is None: - cconn = NULL - elif isinstance(conn, (cudaEglStreamConnection,cuda.CUeglStreamConnection)): + cyconn = NULL + elif isinstance(conn, (cudaEglStreamConnection,driver.CUeglStreamConnection)): pconn = conn.getPtr() - cconn = pconn + cyconn = pconn elif isinstance(conn, (int)): - cconn = conn + cyconn = conn else: - raise TypeError("Argument 'conn' is not instance of type (expected , found " + str(type(conn))) - err = ccudart.cudaEGLStreamConsumerDisconnect(cconn) - return (cudaError_t(err),) -{{endif}} - -{{if True}} + raise TypeError("Argument 'conn' is not instance of type (expected , found " + str(type(conn))) + with nogil: + err = cyruntime.cudaEGLStreamConsumerDisconnect(cyconn) + return (_cudaError_t(err),) @cython.embedsignature(True) def cudaEGLStreamConsumerAcquireFrame(conn, pCudaResource, pStream, unsigned int timeout): """ Acquire an image frame from the EGLStream with CUDA as a consumer. - Acquire an image frame from EGLStreamKHR. + Acquire an image frame from :py:obj:`~.EGLStreamKHR`. :py:obj:`~.cudaGraphicsResourceGetMappedEglFrame` can be called on `pCudaResource` to get :py:obj:`~.cudaEglFrame`. @@ -30941,48 +39631,46 @@ def cudaEGLStreamConsumerAcquireFrame(conn, pCudaResource, pStream, unsigned int -------- :py:obj:`~.cudaEGLStreamConsumerConnect`, :py:obj:`~.cudaEGLStreamConsumerDisconnect`, :py:obj:`~.cudaEGLStreamConsumerReleaseFrame`, :py:obj:`~.cuEGLStreamConsumerAcquireFrame` """ - cdef ccudart.cudaStream_t *cpStream + cdef cyruntime.cudaStream_t *cypStream if pStream is None: - cpStream = NULL - elif isinstance(pStream, (cudaStream_t,cuda.CUstream)): + cypStream = NULL + elif isinstance(pStream, (cudaStream_t,driver.CUstream)): ppStream = pStream.getPtr() - cpStream = ppStream + cypStream = ppStream elif isinstance(pStream, (int)): - cpStream = pStream + cypStream = pStream else: - raise TypeError("Argument 'pStream' is not instance of type (expected , found " + str(type(pStream))) - cdef ccudart.cudaGraphicsResource_t *cpCudaResource + raise TypeError("Argument 'pStream' is not instance of type (expected , found " + str(type(pStream))) + cdef cyruntime.cudaGraphicsResource_t *cypCudaResource if pCudaResource is None: - cpCudaResource = NULL + cypCudaResource = NULL elif isinstance(pCudaResource, (cudaGraphicsResource_t,)): ppCudaResource = pCudaResource.getPtr() - cpCudaResource = ppCudaResource + cypCudaResource = ppCudaResource elif isinstance(pCudaResource, (int)): - cpCudaResource = pCudaResource + cypCudaResource = pCudaResource else: - raise TypeError("Argument 'pCudaResource' is not instance of type (expected , found " + str(type(pCudaResource))) - cdef ccudart.cudaEglStreamConnection *cconn + raise TypeError("Argument 'pCudaResource' is not instance of type (expected , found " + str(type(pCudaResource))) + cdef cyruntime.cudaEglStreamConnection *cyconn if conn is None: - cconn = NULL - elif isinstance(conn, (cudaEglStreamConnection,cuda.CUeglStreamConnection)): + cyconn = NULL + elif isinstance(conn, (cudaEglStreamConnection,driver.CUeglStreamConnection)): pconn = conn.getPtr() - cconn = pconn + cyconn = pconn elif isinstance(conn, (int)): - cconn = conn + cyconn = conn else: - raise TypeError("Argument 'conn' is not instance of type (expected , found " + str(type(conn))) - err = ccudart.cudaEGLStreamConsumerAcquireFrame(cconn, cpCudaResource, cpStream, timeout) - return (cudaError_t(err),) -{{endif}} - -{{if True}} + raise TypeError("Argument 'conn' is not instance of type (expected , found " + str(type(conn))) + with nogil: + err = cyruntime.cudaEGLStreamConsumerAcquireFrame(cyconn, cypCudaResource, cypStream, timeout) + return (_cudaError_t(err),) @cython.embedsignature(True) def cudaEGLStreamConsumerReleaseFrame(conn, pCudaResource, pStream): """ Releases the last frame acquired from the EGLStream. Release the acquired image frame specified by `pCudaResource` to - EGLStreamKHR. + :py:obj:`~.EGLStreamKHR`. Parameters ---------- @@ -31002,54 +39690,52 @@ def cudaEGLStreamConsumerReleaseFrame(conn, pCudaResource, pStream): -------- :py:obj:`~.cudaEGLStreamConsumerConnect`, :py:obj:`~.cudaEGLStreamConsumerDisconnect`, :py:obj:`~.cudaEGLStreamConsumerAcquireFrame`, :py:obj:`~.cuEGLStreamConsumerReleaseFrame` """ - cdef ccudart.cudaStream_t *cpStream + cdef cyruntime.cudaStream_t *cypStream if pStream is None: - cpStream = NULL - elif isinstance(pStream, (cudaStream_t,cuda.CUstream)): + cypStream = NULL + elif isinstance(pStream, (cudaStream_t,driver.CUstream)): ppStream = pStream.getPtr() - cpStream = ppStream + cypStream = ppStream elif isinstance(pStream, (int)): - cpStream = pStream + cypStream = pStream else: - raise TypeError("Argument 'pStream' is not instance of type (expected , found " + str(type(pStream))) - cdef ccudart.cudaGraphicsResource_t cpCudaResource + raise TypeError("Argument 'pStream' is not instance of type (expected , found " + str(type(pStream))) + cdef cyruntime.cudaGraphicsResource_t cypCudaResource if pCudaResource is None: - cpCudaResource = 0 + ppCudaResource = 0 elif isinstance(pCudaResource, (cudaGraphicsResource_t,)): ppCudaResource = int(pCudaResource) - cpCudaResource = ppCudaResource else: ppCudaResource = int(cudaGraphicsResource_t(pCudaResource)) - cpCudaResource = ppCudaResource - cdef ccudart.cudaEglStreamConnection *cconn + cypCudaResource = ppCudaResource + cdef cyruntime.cudaEglStreamConnection *cyconn if conn is None: - cconn = NULL - elif isinstance(conn, (cudaEglStreamConnection,cuda.CUeglStreamConnection)): + cyconn = NULL + elif isinstance(conn, (cudaEglStreamConnection,driver.CUeglStreamConnection)): pconn = conn.getPtr() - cconn = pconn + cyconn = pconn elif isinstance(conn, (int)): - cconn = conn + cyconn = conn else: - raise TypeError("Argument 'conn' is not instance of type (expected , found " + str(type(conn))) - err = ccudart.cudaEGLStreamConsumerReleaseFrame(cconn, cpCudaResource, cpStream) - return (cudaError_t(err),) -{{endif}} - -{{if True}} + raise TypeError("Argument 'conn' is not instance of type (expected , found " + str(type(conn))) + with nogil: + err = cyruntime.cudaEGLStreamConsumerReleaseFrame(cyconn, cypCudaResource, cypStream) + return (_cudaError_t(err),) @cython.embedsignature(True) def cudaEGLStreamProducerConnect(eglStream, width, height): """ Connect CUDA to EGLStream as a producer. - Connect CUDA as a producer to EGLStreamKHR specified by `stream`. + Connect CUDA as a producer to :py:obj:`~.EGLStreamKHR` specified by + `stream`. - The EGLStreamKHR is an EGL object that transfers a sequence of image - frames from one API to another. + The :py:obj:`~.EGLStreamKHR` is an EGL object that transfers a sequence + of image frames from one API to another. Parameters ---------- eglStream : :py:obj:`~.EGLStreamKHR` - EGLStreamKHR handle + :py:obj:`~.EGLStreamKHR` handle width : :py:obj:`~.EGLint` width of the image to be submitted to the stream height : :py:obj:`~.EGLint` @@ -31066,45 +39752,42 @@ def cudaEGLStreamProducerConnect(eglStream, width, height): -------- :py:obj:`~.cudaEGLStreamProducerDisconnect`, :py:obj:`~.cudaEGLStreamProducerPresentFrame`, :py:obj:`~.cudaEGLStreamProducerReturnFrame`, :py:obj:`~.cuEGLStreamProducerConnect` """ - cdef ccudart.EGLint cheight + cdef cyruntime.EGLint cyheight if height is None: - cheight = 0 + pheight = 0 elif isinstance(height, (EGLint,)): pheight = int(height) - cheight = pheight else: pheight = int(EGLint(height)) - cheight = pheight - cdef ccudart.EGLint cwidth + cyheight = pheight + cdef cyruntime.EGLint cywidth if width is None: - cwidth = 0 + pwidth = 0 elif isinstance(width, (EGLint,)): pwidth = int(width) - cwidth = pwidth else: pwidth = int(EGLint(width)) - cwidth = pwidth - cdef ccudart.EGLStreamKHR ceglStream + cywidth = pwidth + cdef cyruntime.EGLStreamKHR cyeglStream if eglStream is None: - ceglStream = 0 + peglStream = 0 elif isinstance(eglStream, (EGLStreamKHR,)): peglStream = int(eglStream) - ceglStream = peglStream else: peglStream = int(EGLStreamKHR(eglStream)) - ceglStream = peglStream + cyeglStream = peglStream cdef cudaEglStreamConnection conn = cudaEglStreamConnection() - err = ccudart.cudaEGLStreamProducerConnect(conn._ptr, ceglStream, cwidth, cheight) - return (cudaError_t(err), conn) -{{endif}} - -{{if True}} + with nogil: + err = cyruntime.cudaEGLStreamProducerConnect(conn._pvt_ptr, cyeglStream, cywidth, cyheight) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, conn) @cython.embedsignature(True) def cudaEGLStreamProducerDisconnect(conn): """ Disconnect CUDA as a producer to EGLStream . - Disconnect CUDA as a producer to EGLStreamKHR. + Disconnect CUDA as a producer to :py:obj:`~.EGLStreamKHR`. Parameters ---------- @@ -31120,21 +39803,19 @@ def cudaEGLStreamProducerDisconnect(conn): -------- :py:obj:`~.cudaEGLStreamProducerConnect`, :py:obj:`~.cudaEGLStreamProducerPresentFrame`, :py:obj:`~.cudaEGLStreamProducerReturnFrame`, :py:obj:`~.cuEGLStreamProducerDisconnect` """ - cdef ccudart.cudaEglStreamConnection *cconn + cdef cyruntime.cudaEglStreamConnection *cyconn if conn is None: - cconn = NULL - elif isinstance(conn, (cudaEglStreamConnection,cuda.CUeglStreamConnection)): + cyconn = NULL + elif isinstance(conn, (cudaEglStreamConnection,driver.CUeglStreamConnection)): pconn = conn.getPtr() - cconn = pconn + cyconn = pconn elif isinstance(conn, (int)): - cconn = conn + cyconn = conn else: - raise TypeError("Argument 'conn' is not instance of type (expected , found " + str(type(conn))) - err = ccudart.cudaEGLStreamProducerDisconnect(cconn) - return (cudaError_t(err),) -{{endif}} - -{{if True}} + raise TypeError("Argument 'conn' is not instance of type (expected , found " + str(type(conn))) + with nogil: + err = cyruntime.cudaEGLStreamProducerDisconnect(cyconn) + return (_cudaError_t(err),) @cython.embedsignature(True) def cudaEGLStreamProducerPresentFrame(conn, eglframe not None : cudaEglFrame, pStream): @@ -31169,31 +39850,29 @@ def cudaEGLStreamProducerPresentFrame(conn, eglframe not None : cudaEglFrame, pS -------- :py:obj:`~.cudaEGLStreamProducerConnect`, :py:obj:`~.cudaEGLStreamProducerDisconnect`, :py:obj:`~.cudaEGLStreamProducerReturnFrame`, :py:obj:`~.cuEGLStreamProducerPresentFrame` """ - cdef ccudart.cudaStream_t *cpStream + cdef cyruntime.cudaStream_t *cypStream if pStream is None: - cpStream = NULL - elif isinstance(pStream, (cudaStream_t,cuda.CUstream)): + cypStream = NULL + elif isinstance(pStream, (cudaStream_t,driver.CUstream)): ppStream = pStream.getPtr() - cpStream = ppStream + cypStream = ppStream elif isinstance(pStream, (int)): - cpStream = pStream + cypStream = pStream else: - raise TypeError("Argument 'pStream' is not instance of type (expected , found " + str(type(pStream))) - cdef ccudart.cudaEglStreamConnection *cconn + raise TypeError("Argument 'pStream' is not instance of type (expected , found " + str(type(pStream))) + cdef cyruntime.cudaEglStreamConnection *cyconn if conn is None: - cconn = NULL - elif isinstance(conn, (cudaEglStreamConnection,cuda.CUeglStreamConnection)): + cyconn = NULL + elif isinstance(conn, (cudaEglStreamConnection,driver.CUeglStreamConnection)): pconn = conn.getPtr() - cconn = pconn + cyconn = pconn elif isinstance(conn, (int)): - cconn = conn + cyconn = conn else: - raise TypeError("Argument 'conn' is not instance of type (expected , found " + str(type(conn))) - err = ccudart.cudaEGLStreamProducerPresentFrame(cconn, eglframe._ptr[0], cpStream) - return (cudaError_t(err),) -{{endif}} - -{{if True}} + raise TypeError("Argument 'conn' is not instance of type (expected , found " + str(type(conn))) + with nogil: + err = cyruntime.cudaEGLStreamProducerPresentFrame(cyconn, eglframe._pvt_ptr[0], cypStream) + return (_cudaError_t(err),) @cython.embedsignature(True) def cudaEGLStreamProducerReturnFrame(conn, eglframe : Optional[cudaEglFrame], pStream): @@ -31222,32 +39901,30 @@ def cudaEGLStreamProducerReturnFrame(conn, eglframe : Optional[cudaEglFrame], pS -------- :py:obj:`~.cudaEGLStreamProducerConnect`, :py:obj:`~.cudaEGLStreamProducerDisconnect`, :py:obj:`~.cudaEGLStreamProducerPresentFrame`, :py:obj:`~.cuEGLStreamProducerReturnFrame` """ - cdef ccudart.cudaStream_t *cpStream + cdef cyruntime.cudaStream_t *cypStream if pStream is None: - cpStream = NULL - elif isinstance(pStream, (cudaStream_t,cuda.CUstream)): + cypStream = NULL + elif isinstance(pStream, (cudaStream_t,driver.CUstream)): ppStream = pStream.getPtr() - cpStream = ppStream + cypStream = ppStream elif isinstance(pStream, (int)): - cpStream = pStream + cypStream = pStream else: - raise TypeError("Argument 'pStream' is not instance of type (expected , found " + str(type(pStream))) - cdef ccudart.cudaEglStreamConnection *cconn + raise TypeError("Argument 'pStream' is not instance of type (expected , found " + str(type(pStream))) + cdef cyruntime.cudaEglStreamConnection *cyconn if conn is None: - cconn = NULL - elif isinstance(conn, (cudaEglStreamConnection,cuda.CUeglStreamConnection)): + cyconn = NULL + elif isinstance(conn, (cudaEglStreamConnection,driver.CUeglStreamConnection)): pconn = conn.getPtr() - cconn = pconn + cyconn = pconn elif isinstance(conn, (int)): - cconn = conn + cyconn = conn else: - raise TypeError("Argument 'conn' is not instance of type (expected , found " + str(type(conn))) - cdef ccudart.cudaEglFrame* ceglframe_ptr = eglframe._ptr if eglframe != None else NULL - err = ccudart.cudaEGLStreamProducerReturnFrame(cconn, ceglframe_ptr, cpStream) - return (cudaError_t(err),) -{{endif}} - -{{if True}} + raise TypeError("Argument 'conn' is not instance of type (expected , found " + str(type(conn))) + cdef cyruntime.cudaEglFrame* cyeglframe_ptr = eglframe._pvt_ptr if eglframe is not None else NULL + with nogil: + err = cyruntime.cudaEGLStreamProducerReturnFrame(cyconn, cyeglframe_ptr, cypStream) + return (_cudaError_t(err),) @cython.embedsignature(True) def cudaGraphicsResourceGetMappedEglFrame(resource, unsigned int index, unsigned int mipLevel): @@ -31285,28 +39962,27 @@ def cudaGraphicsResourceGetMappedEglFrame(resource, unsigned int index, unsigned ----- Note that in case of multiplanar `*eglFrame`, pitch of only first plane (unsigned int :py:obj:`~.cudaEglPlaneDesc.pitch`) is to be considered by the application. """ - cdef ccudart.cudaGraphicsResource_t cresource + cdef cyruntime.cudaGraphicsResource_t cyresource if resource is None: - cresource = 0 + presource = 0 elif isinstance(resource, (cudaGraphicsResource_t,)): presource = int(resource) - cresource = presource else: presource = int(cudaGraphicsResource_t(resource)) - cresource = presource + cyresource = presource cdef cudaEglFrame eglFrame = cudaEglFrame() - err = ccudart.cudaGraphicsResourceGetMappedEglFrame(eglFrame._ptr, cresource, index, mipLevel) - return (cudaError_t(err), eglFrame) -{{endif}} - -{{if True}} + with nogil: + err = cyruntime.cudaGraphicsResourceGetMappedEglFrame(eglFrame._pvt_ptr, cyresource, index, mipLevel) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, eglFrame) @cython.embedsignature(True) def cudaEventCreateFromEGLSync(eglSync, unsigned int flags): """ Creates an event from EGLSync object. - Creates an event *phEvent from an EGLSyncKHR eglSync with the flages - specified via `flags`. Valid flags include: + Creates an event *phEvent from an :py:obj:`~.EGLSyncKHR` eglSync with + the flages specified via `flags`. Valid flags include: - :py:obj:`~.cudaEventDefault`: Default event creation flag. @@ -31318,8 +39994,8 @@ def cudaEventCreateFromEGLSync(eglSync, unsigned int flags): :py:obj:`~.cudaEventRecord` and TimingData are not supported for events created from EGLSync. - The EGLSyncKHR is an opaque handle to an EGL sync object. typedef void* - EGLSyncKHR + The :py:obj:`~.EGLSyncKHR` is an opaque handle to an EGL sync object. + typedef void* :py:obj:`~.EGLSyncKHR` Parameters ---------- @@ -31339,21 +40015,20 @@ def cudaEventCreateFromEGLSync(eglSync, unsigned int flags): -------- :py:obj:`~.cudaEventQuery`, :py:obj:`~.cudaEventSynchronize`, :py:obj:`~.cudaEventDestroy` """ - cdef ccudart.EGLSyncKHR ceglSync + cdef cyruntime.EGLSyncKHR cyeglSync if eglSync is None: - ceglSync = 0 + peglSync = 0 elif isinstance(eglSync, (EGLSyncKHR,)): peglSync = int(eglSync) - ceglSync = peglSync else: peglSync = int(EGLSyncKHR(eglSync)) - ceglSync = peglSync + cyeglSync = peglSync cdef cudaEvent_t phEvent = cudaEvent_t() - err = ccudart.cudaEventCreateFromEGLSync(phEvent._ptr, ceglSync, flags) - return (cudaError_t(err), phEvent) -{{endif}} - -{{if True}} + with nogil: + err = cyruntime.cudaEventCreateFromEGLSync(phEvent._pvt_ptr, cyeglSync, flags) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, phEvent) @cython.embedsignature(True) def cudaProfilerStart(): @@ -31376,11 +40051,9 @@ def cudaProfilerStart(): -------- :py:obj:`~.cudaProfilerStop`, :py:obj:`~.cuProfilerStart` """ - err = ccudart.cudaProfilerStart() - return (cudaError_t(err),) -{{endif}} - -{{if True}} + with nogil: + err = cyruntime.cudaProfilerStart() + return (_cudaError_t(err),) @cython.embedsignature(True) def cudaProfilerStop(): @@ -31403,11 +40076,9 @@ def cudaProfilerStop(): -------- :py:obj:`~.cudaProfilerStart`, :py:obj:`~.cuProfilerStop` """ - err = ccudart.cudaProfilerStop() - return (cudaError_t(err),) -{{endif}} - -{{if True}} + with nogil: + err = cyruntime.cudaProfilerStop() + return (_cudaError_t(err),) @cython.embedsignature(True) def cudaGLGetDevices(unsigned int cudaDeviceCount, deviceList not None : cudaGLDeviceList): @@ -31440,7 +40111,7 @@ def cudaGLGetDevices(unsigned int cudaDeviceCount, deviceList not None : cudaGLD pCudaDeviceCount : unsigned int Returned number of CUDA devices corresponding to the current OpenGL context - pCudaDevices : List[int] + pCudaDevices : list[int] Returned CUDA devices corresponding to the current OpenGL context See Also @@ -31457,22 +40128,22 @@ def cudaGLGetDevices(unsigned int cudaDeviceCount, deviceList not None : cudaGLD """ cdef unsigned int pCudaDeviceCount = 0 - cdef int* cpCudaDevices = NULL + cdef int* cypCudaDevices = NULL pypCudaDevices = [] if cudaDeviceCount != 0: - cpCudaDevices = calloc(cudaDeviceCount, sizeof(int)) - if cpCudaDevices is NULL: + cypCudaDevices = calloc(cudaDeviceCount, sizeof(int)) + if cypCudaDevices is NULL: raise MemoryError('Failed to allocate length x size memory: ' + str(cudaDeviceCount) + 'x' + str(sizeof(int))) - cdef ccudart.cudaGLDeviceList cdeviceList = deviceList.value - err = ccudart.cudaGLGetDevices(&pCudaDeviceCount, cpCudaDevices, cudaDeviceCount, cdeviceList) + cdef cyruntime.cudaGLDeviceList cydeviceList = int(deviceList) + with nogil: + err = cyruntime.cudaGLGetDevices(&pCudaDeviceCount, cypCudaDevices, cudaDeviceCount, cydeviceList) if cudaError_t(err) == cudaError_t(0): - pypCudaDevices = [cpCudaDevices[idx] for idx in range(cudaDeviceCount)] - if cpCudaDevices is not NULL: - free(cpCudaDevices) - return (cudaError_t(err), pCudaDeviceCount, pypCudaDevices) -{{endif}} - -{{if True}} + pypCudaDevices = [cypCudaDevices[idx] for idx in range(cudaDeviceCount)] + if cypCudaDevices is not NULL: + free(cypCudaDevices) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None, None) + return (_cudaError_t_SUCCESS, pCudaDeviceCount, pypCudaDevices) @cython.embedsignature(True) def cudaGraphicsGLRegisterImage(image, target, unsigned int flags): @@ -31548,30 +40219,28 @@ def cudaGraphicsGLRegisterImage(image, target, unsigned int flags): -------- :py:obj:`~.cudaGraphicsUnregisterResource`, :py:obj:`~.cudaGraphicsMapResources`, :py:obj:`~.cudaGraphicsSubResourceGetMappedArray`, :py:obj:`~.cuGraphicsGLRegisterImage` """ - cdef ccudart.GLenum ctarget + cdef cyruntime.GLenum cytarget if target is None: - ctarget = 0 + ptarget = 0 elif isinstance(target, (GLenum,)): ptarget = int(target) - ctarget = ptarget else: ptarget = int(GLenum(target)) - ctarget = ptarget - cdef ccudart.GLuint cimage + cytarget = ptarget + cdef cyruntime.GLuint cyimage if image is None: - cimage = 0 + pimage = 0 elif isinstance(image, (GLuint,)): pimage = int(image) - cimage = pimage else: pimage = int(GLuint(image)) - cimage = pimage + cyimage = pimage cdef cudaGraphicsResource_t resource = cudaGraphicsResource_t() - err = ccudart.cudaGraphicsGLRegisterImage(resource._ptr, cimage, ctarget, flags) - return (cudaError_t(err), resource) -{{endif}} - -{{if True}} + with nogil: + err = cyruntime.cudaGraphicsGLRegisterImage(resource._pvt_ptr, cyimage, cytarget, flags) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, resource) @cython.embedsignature(True) def cudaGraphicsGLRegisterBuffer(buffer, unsigned int flags): @@ -31612,34 +40281,34 @@ def cudaGraphicsGLRegisterBuffer(buffer, unsigned int flags): -------- :py:obj:`~.cudaGraphicsUnregisterResource`, :py:obj:`~.cudaGraphicsMapResources`, :py:obj:`~.cudaGraphicsResourceGetMappedPointer`, :py:obj:`~.cuGraphicsGLRegisterBuffer` """ - cdef ccudart.GLuint cbuffer + cdef cyruntime.GLuint cybuffer if buffer is None: - cbuffer = 0 + pbuffer = 0 elif isinstance(buffer, (GLuint,)): pbuffer = int(buffer) - cbuffer = pbuffer else: pbuffer = int(GLuint(buffer)) - cbuffer = pbuffer + cybuffer = pbuffer cdef cudaGraphicsResource_t resource = cudaGraphicsResource_t() - err = ccudart.cudaGraphicsGLRegisterBuffer(resource._ptr, cbuffer, flags) - return (cudaError_t(err), resource) -{{endif}} - -{{if True}} + with nogil: + err = cyruntime.cudaGraphicsGLRegisterBuffer(resource._pvt_ptr, cybuffer, flags) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, resource) @cython.embedsignature(True) def cudaVDPAUGetDevice(vdpDevice, vdpGetProcAddress): - """ Gets the CUDA device associated with a VdpDevice. + """ Gets the CUDA device associated with a :py:obj:`~.VdpDevice`. - Returns the CUDA device associated with a VdpDevice, if applicable. + Returns the CUDA device associated with a :py:obj:`~.VdpDevice`, if + applicable. Parameters ---------- vdpDevice : :py:obj:`~.VdpDevice` - A VdpDevice handle + A :py:obj:`~.VdpDevice` handle vdpGetProcAddress : :py:obj:`~.VdpGetProcAddress` - VDPAU's VdpGetProcAddress function pointer + VDPAU's :py:obj:`~.VdpGetProcAddress` function pointer Returns ------- @@ -31653,39 +40322,38 @@ def cudaVDPAUGetDevice(vdpDevice, vdpGetProcAddress): -------- :py:obj:`~.cudaVDPAUSetVDPAUDevice`, :py:obj:`~.cuVDPAUGetDevice` """ - cdef ccudart.VdpGetProcAddress *cvdpGetProcAddress + cdef cyruntime.VdpGetProcAddress *cyvdpGetProcAddress if vdpGetProcAddress is None: - cvdpGetProcAddress = NULL + cyvdpGetProcAddress = NULL elif isinstance(vdpGetProcAddress, (VdpGetProcAddress,)): pvdpGetProcAddress = vdpGetProcAddress.getPtr() - cvdpGetProcAddress = pvdpGetProcAddress + cyvdpGetProcAddress = pvdpGetProcAddress elif isinstance(vdpGetProcAddress, (int)): - cvdpGetProcAddress = vdpGetProcAddress + cyvdpGetProcAddress = vdpGetProcAddress else: - raise TypeError("Argument 'vdpGetProcAddress' is not instance of type (expected , found " + str(type(vdpGetProcAddress))) - cdef ccudart.VdpDevice cvdpDevice + raise TypeError("Argument 'vdpGetProcAddress' is not instance of type (expected , found " + str(type(vdpGetProcAddress))) + cdef cyruntime.VdpDevice cyvdpDevice if vdpDevice is None: - cvdpDevice = 0 + pvdpDevice = 0 elif isinstance(vdpDevice, (VdpDevice,)): pvdpDevice = int(vdpDevice) - cvdpDevice = pvdpDevice else: pvdpDevice = int(VdpDevice(vdpDevice)) - cvdpDevice = pvdpDevice + cyvdpDevice = pvdpDevice cdef int device = 0 - err = ccudart.cudaVDPAUGetDevice(&device, cvdpDevice, cvdpGetProcAddress) - return (cudaError_t(err), device) -{{endif}} - -{{if True}} + with nogil: + err = cyruntime.cudaVDPAUGetDevice(&device, cyvdpDevice, cyvdpGetProcAddress) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, device) @cython.embedsignature(True) def cudaVDPAUSetVDPAUDevice(int device, vdpDevice, vdpGetProcAddress): """ Sets a CUDA device to use VDPAU interoperability. - Records `vdpDevice` as the VdpDevice for VDPAU interoperability with - the CUDA device `device` and sets `device` as the current device for - the calling host thread. + Records `vdpDevice` as the :py:obj:`~.VdpDevice` for VDPAU + interoperability with the CUDA device `device` and sets `device` as the + current device for the calling host thread. This function will immediately initialize the primary context on `device` if needed. @@ -31700,9 +40368,9 @@ def cudaVDPAUSetVDPAUDevice(int device, vdpDevice, vdpGetProcAddress): device : int Device to use for VDPAU interoperability vdpDevice : :py:obj:`~.VdpDevice` - The VdpDevice to interoperate with + The :py:obj:`~.VdpDevice` to interoperate with vdpGetProcAddress : :py:obj:`~.VdpGetProcAddress` - VDPAU's VdpGetProcAddress function pointer + VDPAU's :py:obj:`~.VdpGetProcAddress` function pointer Returns ------- @@ -31713,38 +40381,36 @@ def cudaVDPAUSetVDPAUDevice(int device, vdpDevice, vdpGetProcAddress): -------- :py:obj:`~.cudaGraphicsVDPAURegisterVideoSurface`, :py:obj:`~.cudaGraphicsVDPAURegisterOutputSurface`, :py:obj:`~.cudaDeviceReset` """ - cdef ccudart.VdpGetProcAddress *cvdpGetProcAddress + cdef cyruntime.VdpGetProcAddress *cyvdpGetProcAddress if vdpGetProcAddress is None: - cvdpGetProcAddress = NULL + cyvdpGetProcAddress = NULL elif isinstance(vdpGetProcAddress, (VdpGetProcAddress,)): pvdpGetProcAddress = vdpGetProcAddress.getPtr() - cvdpGetProcAddress = pvdpGetProcAddress + cyvdpGetProcAddress = pvdpGetProcAddress elif isinstance(vdpGetProcAddress, (int)): - cvdpGetProcAddress = vdpGetProcAddress + cyvdpGetProcAddress = vdpGetProcAddress else: - raise TypeError("Argument 'vdpGetProcAddress' is not instance of type (expected , found " + str(type(vdpGetProcAddress))) - cdef ccudart.VdpDevice cvdpDevice + raise TypeError("Argument 'vdpGetProcAddress' is not instance of type (expected , found " + str(type(vdpGetProcAddress))) + cdef cyruntime.VdpDevice cyvdpDevice if vdpDevice is None: - cvdpDevice = 0 + pvdpDevice = 0 elif isinstance(vdpDevice, (VdpDevice,)): pvdpDevice = int(vdpDevice) - cvdpDevice = pvdpDevice else: pvdpDevice = int(VdpDevice(vdpDevice)) - cvdpDevice = pvdpDevice - err = ccudart.cudaVDPAUSetVDPAUDevice(device, cvdpDevice, cvdpGetProcAddress) - return (cudaError_t(err),) -{{endif}} - -{{if True}} + cyvdpDevice = pvdpDevice + with nogil: + err = cyruntime.cudaVDPAUSetVDPAUDevice(device, cyvdpDevice, cyvdpGetProcAddress) + return (_cudaError_t(err),) @cython.embedsignature(True) def cudaGraphicsVDPAURegisterVideoSurface(vdpSurface, unsigned int flags): - """ Register a VdpVideoSurface object. + """ Register a :py:obj:`~.VdpVideoSurface` object. - Registers the VdpVideoSurface specified by `vdpSurface` for access by - CUDA. A handle to the registered object is returned as `resource`. The - surface's intended usage is specified using `flags`, as follows: + Registers the :py:obj:`~.VdpVideoSurface` specified by `vdpSurface` for + access by CUDA. A handle to the registered object is returned as + `resource`. The surface's intended usage is specified using `flags`, as + follows: - :py:obj:`~.cudaGraphicsMapFlagsNone`: Specifies no hints about how this resource will be used. It is therefore assumed that this @@ -31777,29 +40443,29 @@ def cudaGraphicsVDPAURegisterVideoSurface(vdpSurface, unsigned int flags): -------- :py:obj:`~.cudaVDPAUSetVDPAUDevice`, :py:obj:`~.cudaGraphicsUnregisterResource`, :py:obj:`~.cudaGraphicsSubResourceGetMappedArray`, :py:obj:`~.cuGraphicsVDPAURegisterVideoSurface` """ - cdef ccudart.VdpVideoSurface cvdpSurface + cdef cyruntime.VdpVideoSurface cyvdpSurface if vdpSurface is None: - cvdpSurface = 0 + pvdpSurface = 0 elif isinstance(vdpSurface, (VdpVideoSurface,)): pvdpSurface = int(vdpSurface) - cvdpSurface = pvdpSurface else: pvdpSurface = int(VdpVideoSurface(vdpSurface)) - cvdpSurface = pvdpSurface + cyvdpSurface = pvdpSurface cdef cudaGraphicsResource_t resource = cudaGraphicsResource_t() - err = ccudart.cudaGraphicsVDPAURegisterVideoSurface(resource._ptr, cvdpSurface, flags) - return (cudaError_t(err), resource) -{{endif}} - -{{if True}} + with nogil: + err = cyruntime.cudaGraphicsVDPAURegisterVideoSurface(resource._pvt_ptr, cyvdpSurface, flags) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, resource) @cython.embedsignature(True) def cudaGraphicsVDPAURegisterOutputSurface(vdpSurface, unsigned int flags): - """ Register a VdpOutputSurface object. + """ Register a :py:obj:`~.VdpOutputSurface` object. - Registers the VdpOutputSurface specified by `vdpSurface` for access by - CUDA. A handle to the registered object is returned as `resource`. The - surface's intended usage is specified using `flags`, as follows: + Registers the :py:obj:`~.VdpOutputSurface` specified by `vdpSurface` + for access by CUDA. A handle to the registered object is returned as + `resource`. The surface's intended usage is specified using `flags`, as + follows: - :py:obj:`~.cudaGraphicsMapFlagsNone`: Specifies no hints about how this resource will be used. It is therefore assumed that this @@ -31832,20 +40498,20 @@ def cudaGraphicsVDPAURegisterOutputSurface(vdpSurface, unsigned int flags): -------- :py:obj:`~.cudaVDPAUSetVDPAUDevice`, :py:obj:`~.cudaGraphicsUnregisterResource`, :py:obj:`~.cudaGraphicsSubResourceGetMappedArray`, :py:obj:`~.cuGraphicsVDPAURegisterOutputSurface` """ - cdef ccudart.VdpOutputSurface cvdpSurface + cdef cyruntime.VdpOutputSurface cyvdpSurface if vdpSurface is None: - cvdpSurface = 0 + pvdpSurface = 0 elif isinstance(vdpSurface, (VdpOutputSurface,)): pvdpSurface = int(vdpSurface) - cvdpSurface = pvdpSurface else: pvdpSurface = int(VdpOutputSurface(vdpSurface)) - cvdpSurface = pvdpSurface + cyvdpSurface = pvdpSurface cdef cudaGraphicsResource_t resource = cudaGraphicsResource_t() - err = ccudart.cudaGraphicsVDPAURegisterOutputSurface(resource._ptr, cvdpSurface, flags) - return (cudaError_t(err), resource) -{{endif}} - + with nogil: + err = cyruntime.cudaGraphicsVDPAURegisterOutputSurface(resource._pvt_ptr, cyvdpSurface, flags) + if err != cyruntime.cudaSuccess: + return (_cudaError_t(err), None) + return (_cudaError_t_SUCCESS, resource) @cython.embedsignature(True) def getLocalRuntimeVersion(): @@ -31874,9 +40540,18 @@ def getLocalRuntimeVersion(): :py:obj:`~.cudaDriverGetVersion`, :py:obj:`~.cuDriverGetVersion` """ cdef int runtimeVersion = 0 - err = ccudart.getLocalRuntimeVersion(&runtimeVersion) + err = cyruntime.getLocalRuntimeVersion(&runtimeVersion) return (cudaError_t(err), runtimeVersion) +cdef class cudaBindingsRuntimeGlobal: + cdef map[void_ptr, void*] _allocated + + def __dealloc__(self): + for item in self._allocated: + free(item.second) + self._allocated.clear() + +cdef cudaBindingsRuntimeGlobal m_global = cudaBindingsRuntimeGlobal() @cython.embedsignature(True) def sizeof(objType): @@ -31892,331 +40567,500 @@ def sizeof(objType): lowered_name : int The size of `objType` in bytes """ - {{if 'struct dim3' in found_types}} + if objType == dim3: - return sizeof(ccudart.dim3){{endif}} - {{if 'struct cudaChannelFormatDesc' in found_types}} + return sizeof(cyruntime.dim3) + + if objType == cudaDevResourceDesc_t: + return sizeof(cyruntime.cudaDevResourceDesc_t) + + if objType == cudaExecutionContext_t: + return sizeof(cyruntime.cudaExecutionContext_t) + if objType == cudaChannelFormatDesc: - return sizeof(ccudart.cudaChannelFormatDesc){{endif}} - {{if 'cudaArray_t' in found_types}} + return sizeof(cyruntime.cudaChannelFormatDesc) + if objType == cudaArray_t: - return sizeof(ccudart.cudaArray_t){{endif}} - {{if 'cudaArray_const_t' in found_types}} + return sizeof(cyruntime.cudaArray_t) + if objType == cudaArray_const_t: - return sizeof(ccudart.cudaArray_const_t){{endif}} - {{if 'cudaMipmappedArray_t' in found_types}} + return sizeof(cyruntime.cudaArray_const_t) + if objType == cudaMipmappedArray_t: - return sizeof(ccudart.cudaMipmappedArray_t){{endif}} - {{if 'cudaMipmappedArray_const_t' in found_types}} + return sizeof(cyruntime.cudaMipmappedArray_t) + if objType == cudaMipmappedArray_const_t: - return sizeof(ccudart.cudaMipmappedArray_const_t){{endif}} - {{if 'struct cudaArraySparseProperties' in found_types}} + return sizeof(cyruntime.cudaMipmappedArray_const_t) + if objType == cudaArraySparseProperties: - return sizeof(ccudart.cudaArraySparseProperties){{endif}} - {{if 'struct cudaArrayMemoryRequirements' in found_types}} + return sizeof(cyruntime.cudaArraySparseProperties) + if objType == cudaArrayMemoryRequirements: - return sizeof(ccudart.cudaArrayMemoryRequirements){{endif}} - {{if 'struct cudaPitchedPtr' in found_types}} + return sizeof(cyruntime.cudaArrayMemoryRequirements) + if objType == cudaPitchedPtr: - return sizeof(ccudart.cudaPitchedPtr){{endif}} - {{if 'struct cudaExtent' in found_types}} + return sizeof(cyruntime.cudaPitchedPtr) + if objType == cudaExtent: - return sizeof(ccudart.cudaExtent){{endif}} - {{if 'struct cudaPos' in found_types}} + return sizeof(cyruntime.cudaExtent) + if objType == cudaPos: - return sizeof(ccudart.cudaPos){{endif}} - {{if 'struct cudaMemcpy3DParms' in found_types}} + return sizeof(cyruntime.cudaPos) + if objType == cudaMemcpy3DParms: - return sizeof(ccudart.cudaMemcpy3DParms){{endif}} - {{if 'struct cudaMemcpyNodeParams' in found_types}} + return sizeof(cyruntime.cudaMemcpy3DParms) + if objType == cudaMemcpyNodeParams: - return sizeof(ccudart.cudaMemcpyNodeParams){{endif}} - {{if 'struct cudaMemcpy3DPeerParms' in found_types}} + return sizeof(cyruntime.cudaMemcpyNodeParams) + if objType == cudaMemcpy3DPeerParms: - return sizeof(ccudart.cudaMemcpy3DPeerParms){{endif}} - {{if 'struct cudaMemsetParams' in found_types}} + return sizeof(cyruntime.cudaMemcpy3DPeerParms) + if objType == cudaMemsetParams: - return sizeof(ccudart.cudaMemsetParams){{endif}} - {{if 'struct cudaMemsetParamsV2' in found_types}} + return sizeof(cyruntime.cudaMemsetParams) + if objType == cudaMemsetParamsV2: - return sizeof(ccudart.cudaMemsetParamsV2){{endif}} - {{if 'struct cudaAccessPolicyWindow' in found_types}} + return sizeof(cyruntime.cudaMemsetParamsV2) + if objType == cudaAccessPolicyWindow: - return sizeof(ccudart.cudaAccessPolicyWindow){{endif}} - {{if 'cudaHostFn_t' in found_types}} + return sizeof(cyruntime.cudaAccessPolicyWindow) + if objType == cudaHostFn_t: - return sizeof(ccudart.cudaHostFn_t){{endif}} - {{if 'struct cudaHostNodeParams' in found_types}} + return sizeof(cyruntime.cudaHostFn_t) + if objType == cudaHostNodeParams: - return sizeof(ccudart.cudaHostNodeParams){{endif}} - {{if 'struct cudaHostNodeParamsV2' in found_types}} + return sizeof(cyruntime.cudaHostNodeParams) + if objType == cudaHostNodeParamsV2: - return sizeof(ccudart.cudaHostNodeParamsV2){{endif}} - {{if 'struct cudaResourceDesc' in found_types}} + return sizeof(cyruntime.cudaHostNodeParamsV2) + if objType == cudaResourceDesc: - return sizeof(ccudart.cudaResourceDesc){{endif}} - {{if 'struct cudaResourceViewDesc' in found_types}} + return sizeof(cyruntime.cudaResourceDesc) + if objType == cudaResourceViewDesc: - return sizeof(ccudart.cudaResourceViewDesc){{endif}} - {{if 'struct cudaPointerAttributes' in found_types}} + return sizeof(cyruntime.cudaResourceViewDesc) + if objType == cudaPointerAttributes: - return sizeof(ccudart.cudaPointerAttributes){{endif}} - {{if 'struct cudaFuncAttributes' in found_types}} + return sizeof(cyruntime.cudaPointerAttributes) + if objType == cudaFuncAttributes: - return sizeof(ccudart.cudaFuncAttributes){{endif}} - {{if 'struct cudaMemLocation' in found_types}} + return sizeof(cyruntime.cudaFuncAttributes) + if objType == cudaMemLocation: - return sizeof(ccudart.cudaMemLocation){{endif}} - {{if 'struct cudaMemAccessDesc' in found_types}} + return sizeof(cyruntime.cudaMemLocation) + if objType == cudaMemAccessDesc: - return sizeof(ccudart.cudaMemAccessDesc){{endif}} - {{if 'struct cudaMemPoolProps' in found_types}} + return sizeof(cyruntime.cudaMemAccessDesc) + if objType == cudaMemPoolProps: - return sizeof(ccudart.cudaMemPoolProps){{endif}} - {{if 'struct cudaMemPoolPtrExportData' in found_types}} + return sizeof(cyruntime.cudaMemPoolProps) + if objType == cudaMemPoolPtrExportData: - return sizeof(ccudart.cudaMemPoolPtrExportData){{endif}} - {{if 'struct cudaMemAllocNodeParams' in found_types}} + return sizeof(cyruntime.cudaMemPoolPtrExportData) + if objType == cudaMemAllocNodeParams: - return sizeof(ccudart.cudaMemAllocNodeParams){{endif}} - {{if 'struct cudaMemAllocNodeParamsV2' in found_types}} + return sizeof(cyruntime.cudaMemAllocNodeParams) + if objType == cudaMemAllocNodeParamsV2: - return sizeof(ccudart.cudaMemAllocNodeParamsV2){{endif}} - {{if 'struct cudaMemFreeNodeParams' in found_types}} + return sizeof(cyruntime.cudaMemAllocNodeParamsV2) + if objType == cudaMemFreeNodeParams: - return sizeof(ccudart.cudaMemFreeNodeParams){{endif}} - {{if 'struct CUuuid_st' in found_types}} + return sizeof(cyruntime.cudaMemFreeNodeParams) + + if objType == cudaMemcpyAttributes: + return sizeof(cyruntime.cudaMemcpyAttributes) + + if objType == cudaOffset3D: + return sizeof(cyruntime.cudaOffset3D) + + if objType == cudaMemcpy3DOperand: + return sizeof(cyruntime.cudaMemcpy3DOperand) + + if objType == cudaMemcpy3DBatchOp: + return sizeof(cyruntime.cudaMemcpy3DBatchOp) + if objType == CUuuid_st: - return sizeof(ccudart.CUuuid_st){{endif}} - {{if 'CUuuid' in found_types}} + return sizeof(cyruntime.CUuuid_st) + if objType == CUuuid: - return sizeof(ccudart.CUuuid){{endif}} - {{if 'cudaUUID_t' in found_types}} + return sizeof(cyruntime.CUuuid) + if objType == cudaUUID_t: - return sizeof(ccudart.cudaUUID_t){{endif}} - {{if 'struct cudaDeviceProp' in found_types}} + return sizeof(cyruntime.cudaUUID_t) + if objType == cudaDeviceProp: - return sizeof(ccudart.cudaDeviceProp){{endif}} - {{if 'struct cudaIpcEventHandle_st' in found_types}} + return sizeof(cyruntime.cudaDeviceProp) + if objType == cudaIpcEventHandle_st: - return sizeof(ccudart.cudaIpcEventHandle_st){{endif}} - {{if 'cudaIpcEventHandle_t' in found_types}} + return sizeof(cyruntime.cudaIpcEventHandle_st) + if objType == cudaIpcEventHandle_t: - return sizeof(ccudart.cudaIpcEventHandle_t){{endif}} - {{if 'struct cudaIpcMemHandle_st' in found_types}} + return sizeof(cyruntime.cudaIpcEventHandle_t) + if objType == cudaIpcMemHandle_st: - return sizeof(ccudart.cudaIpcMemHandle_st){{endif}} - {{if 'cudaIpcMemHandle_t' in found_types}} + return sizeof(cyruntime.cudaIpcMemHandle_st) + if objType == cudaIpcMemHandle_t: - return sizeof(ccudart.cudaIpcMemHandle_t){{endif}} - {{if 'struct cudaMemFabricHandle_st' in found_types}} + return sizeof(cyruntime.cudaIpcMemHandle_t) + if objType == cudaMemFabricHandle_st: - return sizeof(ccudart.cudaMemFabricHandle_st){{endif}} - {{if 'cudaMemFabricHandle_t' in found_types}} + return sizeof(cyruntime.cudaMemFabricHandle_st) + if objType == cudaMemFabricHandle_t: - return sizeof(ccudart.cudaMemFabricHandle_t){{endif}} - {{if 'struct cudaExternalMemoryHandleDesc' in found_types}} + return sizeof(cyruntime.cudaMemFabricHandle_t) + if objType == cudaExternalMemoryHandleDesc: - return sizeof(ccudart.cudaExternalMemoryHandleDesc){{endif}} - {{if 'struct cudaExternalMemoryBufferDesc' in found_types}} + return sizeof(cyruntime.cudaExternalMemoryHandleDesc) + if objType == cudaExternalMemoryBufferDesc: - return sizeof(ccudart.cudaExternalMemoryBufferDesc){{endif}} - {{if 'struct cudaExternalMemoryMipmappedArrayDesc' in found_types}} + return sizeof(cyruntime.cudaExternalMemoryBufferDesc) + if objType == cudaExternalMemoryMipmappedArrayDesc: - return sizeof(ccudart.cudaExternalMemoryMipmappedArrayDesc){{endif}} - {{if 'struct cudaExternalSemaphoreHandleDesc' in found_types}} + return sizeof(cyruntime.cudaExternalMemoryMipmappedArrayDesc) + if objType == cudaExternalSemaphoreHandleDesc: - return sizeof(ccudart.cudaExternalSemaphoreHandleDesc){{endif}} - {{if 'struct cudaExternalSemaphoreSignalParams' in found_types}} + return sizeof(cyruntime.cudaExternalSemaphoreHandleDesc) + if objType == cudaExternalSemaphoreSignalParams: - return sizeof(ccudart.cudaExternalSemaphoreSignalParams){{endif}} - {{if 'struct cudaExternalSemaphoreWaitParams' in found_types}} + return sizeof(cyruntime.cudaExternalSemaphoreSignalParams) + if objType == cudaExternalSemaphoreWaitParams: - return sizeof(ccudart.cudaExternalSemaphoreWaitParams){{endif}} - {{if 'cudaStream_t' in found_types}} + return sizeof(cyruntime.cudaExternalSemaphoreWaitParams) + + if objType == cudaDevSmResource: + return sizeof(cyruntime.cudaDevSmResource) + + if objType == cudaDevWorkqueueConfigResource: + return sizeof(cyruntime.cudaDevWorkqueueConfigResource) + + if objType == cudaDevWorkqueueResource: + return sizeof(cyruntime.cudaDevWorkqueueResource) + + if objType == cudaDevSmResourceGroupParams_st: + return sizeof(cyruntime.cudaDevSmResourceGroupParams_st) + + if objType == cudaDevSmResourceGroupParams: + return sizeof(cyruntime.cudaDevSmResourceGroupParams) + + if objType == cudaDevResource_st: + return sizeof(cyruntime.cudaDevResource_st) + + if objType == cudaDevResource: + return sizeof(cyruntime.cudaDevResource) + if objType == cudaStream_t: - return sizeof(ccudart.cudaStream_t){{endif}} - {{if 'cudaEvent_t' in found_types}} + return sizeof(cyruntime.cudaStream_t) + if objType == cudaEvent_t: - return sizeof(ccudart.cudaEvent_t){{endif}} - {{if 'cudaGraphicsResource_t' in found_types}} + return sizeof(cyruntime.cudaEvent_t) + if objType == cudaGraphicsResource_t: - return sizeof(ccudart.cudaGraphicsResource_t){{endif}} - {{if 'cudaExternalMemory_t' in found_types}} + return sizeof(cyruntime.cudaGraphicsResource_t) + if objType == cudaExternalMemory_t: - return sizeof(ccudart.cudaExternalMemory_t){{endif}} - {{if 'cudaExternalSemaphore_t' in found_types}} + return sizeof(cyruntime.cudaExternalMemory_t) + if objType == cudaExternalSemaphore_t: - return sizeof(ccudart.cudaExternalSemaphore_t){{endif}} - {{if 'cudaGraph_t' in found_types}} + return sizeof(cyruntime.cudaExternalSemaphore_t) + if objType == cudaGraph_t: - return sizeof(ccudart.cudaGraph_t){{endif}} - {{if 'cudaGraphNode_t' in found_types}} + return sizeof(cyruntime.cudaGraph_t) + if objType == cudaGraphNode_t: - return sizeof(ccudart.cudaGraphNode_t){{endif}} - {{if 'cudaUserObject_t' in found_types}} + return sizeof(cyruntime.cudaGraphNode_t) + if objType == cudaUserObject_t: - return sizeof(ccudart.cudaUserObject_t){{endif}} - {{if 'cudaGraphConditionalHandle' in found_types}} + return sizeof(cyruntime.cudaUserObject_t) + if objType == cudaGraphConditionalHandle: - return sizeof(ccudart.cudaGraphConditionalHandle){{endif}} - {{if 'cudaFunction_t' in found_types}} + return sizeof(cyruntime.cudaGraphConditionalHandle) + if objType == cudaFunction_t: - return sizeof(ccudart.cudaFunction_t){{endif}} - {{if 'cudaKernel_t' in found_types}} + return sizeof(cyruntime.cudaFunction_t) + if objType == cudaKernel_t: - return sizeof(ccudart.cudaKernel_t){{endif}} - {{if 'cudaMemPool_t' in found_types}} + return sizeof(cyruntime.cudaKernel_t) + + if objType == cudalibraryHostUniversalFunctionAndDataTable: + return sizeof(cyruntime.cudalibraryHostUniversalFunctionAndDataTable) + + if objType == cudaLibrary_t: + return sizeof(cyruntime.cudaLibrary_t) + if objType == cudaMemPool_t: - return sizeof(ccudart.cudaMemPool_t){{endif}} - {{if 'struct cudaKernelNodeParams' in found_types}} + return sizeof(cyruntime.cudaMemPool_t) + if objType == cudaKernelNodeParams: - return sizeof(ccudart.cudaKernelNodeParams){{endif}} - {{if 'struct cudaKernelNodeParamsV2' in found_types}} + return sizeof(cyruntime.cudaKernelNodeParams) + if objType == cudaKernelNodeParamsV2: - return sizeof(ccudart.cudaKernelNodeParamsV2){{endif}} - {{if 'struct cudaExternalSemaphoreSignalNodeParams' in found_types}} + return sizeof(cyruntime.cudaKernelNodeParamsV2) + if objType == cudaExternalSemaphoreSignalNodeParams: - return sizeof(ccudart.cudaExternalSemaphoreSignalNodeParams){{endif}} - {{if 'struct cudaExternalSemaphoreSignalNodeParamsV2' in found_types}} + return sizeof(cyruntime.cudaExternalSemaphoreSignalNodeParams) + if objType == cudaExternalSemaphoreSignalNodeParamsV2: - return sizeof(ccudart.cudaExternalSemaphoreSignalNodeParamsV2){{endif}} - {{if 'struct cudaExternalSemaphoreWaitNodeParams' in found_types}} + return sizeof(cyruntime.cudaExternalSemaphoreSignalNodeParamsV2) + if objType == cudaExternalSemaphoreWaitNodeParams: - return sizeof(ccudart.cudaExternalSemaphoreWaitNodeParams){{endif}} - {{if 'struct cudaExternalSemaphoreWaitNodeParamsV2' in found_types}} + return sizeof(cyruntime.cudaExternalSemaphoreWaitNodeParams) + if objType == cudaExternalSemaphoreWaitNodeParamsV2: - return sizeof(ccudart.cudaExternalSemaphoreWaitNodeParamsV2){{endif}} - {{if 'struct cudaConditionalNodeParams' in found_types}} + return sizeof(cyruntime.cudaExternalSemaphoreWaitNodeParamsV2) + if objType == cudaConditionalNodeParams: - return sizeof(ccudart.cudaConditionalNodeParams){{endif}} - {{if 'struct cudaChildGraphNodeParams' in found_types}} + return sizeof(cyruntime.cudaConditionalNodeParams) + if objType == cudaChildGraphNodeParams: - return sizeof(ccudart.cudaChildGraphNodeParams){{endif}} - {{if 'struct cudaEventRecordNodeParams' in found_types}} + return sizeof(cyruntime.cudaChildGraphNodeParams) + if objType == cudaEventRecordNodeParams: - return sizeof(ccudart.cudaEventRecordNodeParams){{endif}} - {{if 'struct cudaEventWaitNodeParams' in found_types}} + return sizeof(cyruntime.cudaEventRecordNodeParams) + if objType == cudaEventWaitNodeParams: - return sizeof(ccudart.cudaEventWaitNodeParams){{endif}} - {{if 'struct cudaGraphNodeParams' in found_types}} + return sizeof(cyruntime.cudaEventWaitNodeParams) + if objType == cudaGraphNodeParams: - return sizeof(ccudart.cudaGraphNodeParams){{endif}} - {{if 'struct cudaGraphEdgeData_st' in found_types}} + return sizeof(cyruntime.cudaGraphNodeParams) + if objType == cudaGraphEdgeData_st: - return sizeof(ccudart.cudaGraphEdgeData_st){{endif}} - {{if 'cudaGraphEdgeData' in found_types}} + return sizeof(cyruntime.cudaGraphEdgeData_st) + if objType == cudaGraphEdgeData: - return sizeof(ccudart.cudaGraphEdgeData){{endif}} - {{if 'cudaGraphExec_t' in found_types}} + return sizeof(cyruntime.cudaGraphEdgeData) + if objType == cudaGraphExec_t: - return sizeof(ccudart.cudaGraphExec_t){{endif}} - {{if 'struct cudaGraphInstantiateParams_st' in found_types}} + return sizeof(cyruntime.cudaGraphExec_t) + if objType == cudaGraphInstantiateParams_st: - return sizeof(ccudart.cudaGraphInstantiateParams_st){{endif}} - {{if 'cudaGraphInstantiateParams' in found_types}} + return sizeof(cyruntime.cudaGraphInstantiateParams_st) + if objType == cudaGraphInstantiateParams: - return sizeof(ccudart.cudaGraphInstantiateParams){{endif}} - {{if 'struct cudaGraphExecUpdateResultInfo_st' in found_types}} + return sizeof(cyruntime.cudaGraphInstantiateParams) + if objType == cudaGraphExecUpdateResultInfo_st: - return sizeof(ccudart.cudaGraphExecUpdateResultInfo_st){{endif}} - {{if 'cudaGraphExecUpdateResultInfo' in found_types}} + return sizeof(cyruntime.cudaGraphExecUpdateResultInfo_st) + if objType == cudaGraphExecUpdateResultInfo: - return sizeof(ccudart.cudaGraphExecUpdateResultInfo){{endif}} - {{if 'cudaGraphDeviceNode_t' in found_types}} + return sizeof(cyruntime.cudaGraphExecUpdateResultInfo) + if objType == cudaGraphDeviceNode_t: - return sizeof(ccudart.cudaGraphDeviceNode_t){{endif}} - {{if 'struct cudaGraphKernelNodeUpdate' in found_types}} + return sizeof(cyruntime.cudaGraphDeviceNode_t) + if objType == cudaGraphKernelNodeUpdate: - return sizeof(ccudart.cudaGraphKernelNodeUpdate){{endif}} - {{if 'struct cudaLaunchMemSyncDomainMap_st' in found_types}} + return sizeof(cyruntime.cudaGraphKernelNodeUpdate) + if objType == cudaLaunchMemSyncDomainMap_st: - return sizeof(ccudart.cudaLaunchMemSyncDomainMap_st){{endif}} - {{if 'cudaLaunchMemSyncDomainMap' in found_types}} + return sizeof(cyruntime.cudaLaunchMemSyncDomainMap_st) + if objType == cudaLaunchMemSyncDomainMap: - return sizeof(ccudart.cudaLaunchMemSyncDomainMap){{endif}} - {{if 'union cudaLaunchAttributeValue' in found_types}} + return sizeof(cyruntime.cudaLaunchMemSyncDomainMap) + if objType == cudaLaunchAttributeValue: - return sizeof(ccudart.cudaLaunchAttributeValue){{endif}} - {{if 'struct cudaLaunchAttribute_st' in found_types}} + return sizeof(cyruntime.cudaLaunchAttributeValue) + if objType == cudaLaunchAttribute_st: - return sizeof(ccudart.cudaLaunchAttribute_st){{endif}} - {{if 'cudaLaunchAttribute' in found_types}} + return sizeof(cyruntime.cudaLaunchAttribute_st) + if objType == cudaLaunchAttribute: - return sizeof(ccudart.cudaLaunchAttribute){{endif}} - {{if 'cudaAsyncCallbackHandle_t' in found_types}} + return sizeof(cyruntime.cudaLaunchAttribute) + if objType == cudaAsyncCallbackHandle_t: - return sizeof(ccudart.cudaAsyncCallbackHandle_t){{endif}} - {{if 'struct cudaAsyncNotificationInfo' in found_types}} + return sizeof(cyruntime.cudaAsyncCallbackHandle_t) + if objType == cudaAsyncNotificationInfo: - return sizeof(ccudart.cudaAsyncNotificationInfo){{endif}} - {{if 'cudaAsyncNotificationInfo_t' in found_types}} + return sizeof(cyruntime.cudaAsyncNotificationInfo) + if objType == cudaAsyncNotificationInfo_t: - return sizeof(ccudart.cudaAsyncNotificationInfo_t){{endif}} - {{if 'cudaAsyncCallback' in found_types}} + return sizeof(cyruntime.cudaAsyncNotificationInfo_t) + if objType == cudaAsyncCallback: - return sizeof(ccudart.cudaAsyncCallback){{endif}} - {{if 'cudaSurfaceObject_t' in found_types}} + return sizeof(cyruntime.cudaAsyncCallback) + + if objType == cudaLogsCallbackHandle: + return sizeof(cyruntime.cudaLogsCallbackHandle) + + if objType == cudaLogIterator: + return sizeof(cyruntime.cudaLogIterator) + if objType == cudaSurfaceObject_t: - return sizeof(ccudart.cudaSurfaceObject_t){{endif}} - {{if 'struct cudaTextureDesc' in found_types}} + return sizeof(cyruntime.cudaSurfaceObject_t) + if objType == cudaTextureDesc: - return sizeof(ccudart.cudaTextureDesc){{endif}} - {{if 'cudaTextureObject_t' in found_types}} + return sizeof(cyruntime.cudaTextureDesc) + if objType == cudaTextureObject_t: - return sizeof(ccudart.cudaTextureObject_t){{endif}} - {{if 'cudaStreamCallback_t' in found_types}} + return sizeof(cyruntime.cudaTextureObject_t) + if objType == cudaStreamCallback_t: - return sizeof(ccudart.cudaStreamCallback_t){{endif}} - {{if True}} + return sizeof(cyruntime.cudaStreamCallback_t) + + if objType == cudaGraphRecaptureCallback_t: + return sizeof(cyruntime.cudaGraphRecaptureCallback_t) + + if objType == cudaGraphRecaptureCallbackData: + return sizeof(cyruntime.cudaGraphRecaptureCallbackData) + + if objType == cudaLogsCallback_t: + return sizeof(cyruntime.cudaLogsCallback_t) + if objType == GLenum: - return sizeof(ccudart.GLenum){{endif}} - {{if True}} + return sizeof(cyruntime.GLenum) + if objType == GLuint: - return sizeof(ccudart.GLuint){{endif}} - {{if True}} + return sizeof(cyruntime.GLuint) + if objType == EGLImageKHR: - return sizeof(ccudart.EGLImageKHR){{endif}} - {{if True}} + return sizeof(cyruntime.EGLImageKHR) + if objType == EGLStreamKHR: - return sizeof(ccudart.EGLStreamKHR){{endif}} - {{if True}} + return sizeof(cyruntime.EGLStreamKHR) + if objType == EGLint: - return sizeof(ccudart.EGLint){{endif}} - {{if True}} + return sizeof(cyruntime.EGLint) + if objType == EGLSyncKHR: - return sizeof(ccudart.EGLSyncKHR){{endif}} - {{if True}} + return sizeof(cyruntime.EGLSyncKHR) + if objType == VdpDevice: - return sizeof(ccudart.VdpDevice){{endif}} - {{if True}} + return sizeof(cyruntime.VdpDevice) + if objType == VdpGetProcAddress: - return sizeof(ccudart.VdpGetProcAddress){{endif}} - {{if True}} + return sizeof(cyruntime.VdpGetProcAddress) + if objType == VdpVideoSurface: - return sizeof(ccudart.VdpVideoSurface){{endif}} - {{if True}} + return sizeof(cyruntime.VdpVideoSurface) + if objType == VdpOutputSurface: - return sizeof(ccudart.VdpOutputSurface){{endif}} - {{if True}} + return sizeof(cyruntime.VdpOutputSurface) + if objType == cudaStreamAttrValue: - return sizeof(ccudart.cudaStreamAttrValue){{endif}} - {{if True}} + return sizeof(cyruntime.cudaStreamAttrValue) + if objType == cudaKernelNodeAttrValue: - return sizeof(ccudart.cudaKernelNodeAttrValue){{endif}} - {{if True}} + return sizeof(cyruntime.cudaKernelNodeAttrValue) + if objType == cudaEglPlaneDesc_st: - return sizeof(ccudart.cudaEglPlaneDesc_st){{endif}} - {{if True}} + return sizeof(cyruntime.cudaEglPlaneDesc_st) + if objType == cudaEglPlaneDesc: - return sizeof(ccudart.cudaEglPlaneDesc){{endif}} - {{if True}} + return sizeof(cyruntime.cudaEglPlaneDesc) + if objType == cudaEglFrame_st: - return sizeof(ccudart.cudaEglFrame_st){{endif}} - {{if True}} + return sizeof(cyruntime.cudaEglFrame_st) + if objType == cudaEglFrame: - return sizeof(ccudart.cudaEglFrame){{endif}} - {{if True}} + return sizeof(cyruntime.cudaEglFrame) + if objType == cudaEglStreamConnection: - return sizeof(ccudart.cudaEglStreamConnection){{endif}} - raise TypeError("Unknown type: " + str(objType)) \ No newline at end of file + return sizeof(cyruntime.cudaEglStreamConnection) + raise TypeError("Unknown type: " + str(objType)) + +cdef int _add_native_handle_getters() except?-1: + from cuda.bindings.utils import _add_cuda_native_handle_getter + + def cudaDevResourceDesc_t_getter(cudaDevResourceDesc_t x): return (x._pvt_ptr[0]) + _add_cuda_native_handle_getter(cudaDevResourceDesc_t, cudaDevResourceDesc_t_getter) + + + def cudaExecutionContext_t_getter(cudaExecutionContext_t x): return (x._pvt_ptr[0]) + _add_cuda_native_handle_getter(cudaExecutionContext_t, cudaExecutionContext_t_getter) + + + def cudaArray_t_getter(cudaArray_t x): return (x._pvt_ptr[0]) + _add_cuda_native_handle_getter(cudaArray_t, cudaArray_t_getter) + + + def cudaArray_const_t_getter(cudaArray_const_t x): return (x._pvt_ptr[0]) + _add_cuda_native_handle_getter(cudaArray_const_t, cudaArray_const_t_getter) + + + def cudaMipmappedArray_t_getter(cudaMipmappedArray_t x): return (x._pvt_ptr[0]) + _add_cuda_native_handle_getter(cudaMipmappedArray_t, cudaMipmappedArray_t_getter) + + + def cudaMipmappedArray_const_t_getter(cudaMipmappedArray_const_t x): return (x._pvt_ptr[0]) + _add_cuda_native_handle_getter(cudaMipmappedArray_const_t, cudaMipmappedArray_const_t_getter) + + + def cudaStream_t_getter(cudaStream_t x): return (x._pvt_ptr[0]) + _add_cuda_native_handle_getter(cudaStream_t, cudaStream_t_getter) + + + def cudaEvent_t_getter(cudaEvent_t x): return (x._pvt_ptr[0]) + _add_cuda_native_handle_getter(cudaEvent_t, cudaEvent_t_getter) + + + def cudaGraphicsResource_t_getter(cudaGraphicsResource_t x): return (x._pvt_ptr[0]) + _add_cuda_native_handle_getter(cudaGraphicsResource_t, cudaGraphicsResource_t_getter) + + + def cudaExternalMemory_t_getter(cudaExternalMemory_t x): return (x._pvt_ptr[0]) + _add_cuda_native_handle_getter(cudaExternalMemory_t, cudaExternalMemory_t_getter) + + + def cudaExternalSemaphore_t_getter(cudaExternalSemaphore_t x): return (x._pvt_ptr[0]) + _add_cuda_native_handle_getter(cudaExternalSemaphore_t, cudaExternalSemaphore_t_getter) + + + def cudaGraph_t_getter(cudaGraph_t x): return (x._pvt_ptr[0]) + _add_cuda_native_handle_getter(cudaGraph_t, cudaGraph_t_getter) + + + def cudaGraphNode_t_getter(cudaGraphNode_t x): return (x._pvt_ptr[0]) + _add_cuda_native_handle_getter(cudaGraphNode_t, cudaGraphNode_t_getter) + + + def cudaUserObject_t_getter(cudaUserObject_t x): return (x._pvt_ptr[0]) + _add_cuda_native_handle_getter(cudaUserObject_t, cudaUserObject_t_getter) + + + def cudaFunction_t_getter(cudaFunction_t x): return (x._pvt_ptr[0]) + _add_cuda_native_handle_getter(cudaFunction_t, cudaFunction_t_getter) + + + def cudaKernel_t_getter(cudaKernel_t x): return (x._pvt_ptr[0]) + _add_cuda_native_handle_getter(cudaKernel_t, cudaKernel_t_getter) + + + def cudaLibrary_t_getter(cudaLibrary_t x): return (x._pvt_ptr[0]) + _add_cuda_native_handle_getter(cudaLibrary_t, cudaLibrary_t_getter) + + + def cudaMemPool_t_getter(cudaMemPool_t x): return (x._pvt_ptr[0]) + _add_cuda_native_handle_getter(cudaMemPool_t, cudaMemPool_t_getter) + + + def cudaGraphExec_t_getter(cudaGraphExec_t x): return (x._pvt_ptr[0]) + _add_cuda_native_handle_getter(cudaGraphExec_t, cudaGraphExec_t_getter) + + + def cudaGraphDeviceNode_t_getter(cudaGraphDeviceNode_t x): return (x._pvt_ptr[0]) + _add_cuda_native_handle_getter(cudaGraphDeviceNode_t, cudaGraphDeviceNode_t_getter) + + + def cudaAsyncCallbackHandle_t_getter(cudaAsyncCallbackHandle_t x): return (x._pvt_ptr[0]) + _add_cuda_native_handle_getter(cudaAsyncCallbackHandle_t, cudaAsyncCallbackHandle_t_getter) + + + def cudaLogsCallbackHandle_getter(cudaLogsCallbackHandle x): return (x._pvt_ptr[0]) + _add_cuda_native_handle_getter(cudaLogsCallbackHandle, cudaLogsCallbackHandle_getter) + + + def EGLImageKHR_getter(EGLImageKHR x): return (x._pvt_ptr[0]) + _add_cuda_native_handle_getter(EGLImageKHR, EGLImageKHR_getter) + + + def EGLStreamKHR_getter(EGLStreamKHR x): return (x._pvt_ptr[0]) + _add_cuda_native_handle_getter(EGLStreamKHR, EGLStreamKHR_getter) + + + def EGLSyncKHR_getter(EGLSyncKHR x): return (x._pvt_ptr[0]) + _add_cuda_native_handle_getter(EGLSyncKHR, EGLSyncKHR_getter) + + + def cudaEglStreamConnection_getter(cudaEglStreamConnection x): return (x._pvt_ptr[0]) + _add_cuda_native_handle_getter(cudaEglStreamConnection, cudaEglStreamConnection_getter) + + return 0 +_add_native_handle_getters() diff --git a/cuda_bindings/cuda/bindings/utils/__init__.py b/cuda_bindings/cuda/bindings/utils/__init__.py new file mode 100644 index 00000000000..0bfff4b78be --- /dev/null +++ b/cuda_bindings/cuda/bindings/utils/__init__.py @@ -0,0 +1,32 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 +from typing import Any, Callable + +from ._nvvm_utils import check_nvvm_compiler_options +from ._ptx_utils import get_minimal_required_cuda_ver_from_ptx_ver, get_ptx_ver +from ._version_check import warn_if_cuda_major_version_mismatch + +_handle_getters: dict[type, Callable[[Any], int]] = {} + + +def _add_cuda_native_handle_getter(t: type, getter: Callable[[Any], int]) -> None: + _handle_getters[t] = getter + + +def get_cuda_native_handle(obj: Any) -> int: + """Returns the address of the provided CUDA Python object as a Python int. + + Parameters + ---------- + obj : Any + CUDA Python object + + Returns + ------- + int : The object address. + """ + obj_type = type(obj) + try: + return _handle_getters[obj_type](obj) + except KeyError: + raise TypeError("Unknown type: " + str(obj_type)) from None diff --git a/cuda_bindings/cuda/bindings/utils/_nvvm_utils.py b/cuda_bindings/cuda/bindings/utils/_nvvm_utils.py new file mode 100644 index 00000000000..9ac37c3a236 --- /dev/null +++ b/cuda_bindings/cuda/bindings/utils/_nvvm_utils.py @@ -0,0 +1,89 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +from typing import Sequence + +_PRECHECK_NVVM_IR = """target triple = "nvptx64-unknown-cuda" +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-i128:128:128-f32:32:32-f64:64:64-v16:16:16-v32:32:32-v64:64:64-v128:128:128-n16:32:64" + +define void @dummy_kernel() {{ +entry: + ret void +}} + +!nvvm.annotations = !{{!0}} +!0 = !{{void ()* @dummy_kernel, !"kernel", i32 1}} + +!nvvmir.version = !{{!1}} +!1 = !{{i32 {major}, i32 {minor}, i32 {debug_major}, i32 {debug_minor}}} +""" + + +def check_nvvm_compiler_options(options: Sequence[str]) -> bool: + """ + Abstracted from https://github.com/NVIDIA/numba-cuda/pull/681 + + Check if the specified options are supported by the current libNVVM version. + + The options are a list of strings, each representing a compiler option. + + If the test program fails to compile, the options are not supported and False + is returned. + + If the test program compiles successfully, True is returned. + + cuda.bindings.nvvm returns exceptions instead of return codes. + + Parameters + ---------- + options : Sequence[str] + List of compiler options as strings (e.g., ["-arch=compute_90", "-g"]). + + Returns + ------- + bool + True if the options are supported, False otherwise. + + Examples + -------- + >>> from cuda.bindings.utils import check_nvvm_compiler_options + >>> check_nvvm_compiler_options(["-arch=compute_90", "-g"]) + True + """ + try: + from cuda.bindings import nvvm + except ModuleNotFoundError as exc: + if exc.name == "nvvm": + return False + raise + + from cuda.bindings._internal.nvvm import _inspect_function_pointer + + if _inspect_function_pointer("__nvvmCreateProgram") == 0: + return False + + program = nvvm.create_program() + try: + major, minor, debug_major, debug_minor = nvvm.ir_version() + precheck_ir = _PRECHECK_NVVM_IR.format( + major=major, + minor=minor, + debug_major=debug_major, + debug_minor=debug_minor, + ) + precheck_ir_bytes = precheck_ir.encode("utf-8") + nvvm.add_module_to_program( + program, + precheck_ir_bytes, + len(precheck_ir_bytes), + "precheck.ll", + ) + try: + nvvm.compile_program(program, len(options), options) + except nvvm.nvvmError as e: + if e.status == nvvm.Result.ERROR_INVALID_OPTION: + return False + raise + finally: + nvvm.destroy_program(program) + return True diff --git a/cuda_bindings/cuda/bindings/utils/_ptx_utils.py b/cuda_bindings/cuda/bindings/utils/_ptx_utils.py new file mode 100644 index 00000000000..1395fdfd469 --- /dev/null +++ b/cuda_bindings/cuda/bindings/utils/_ptx_utils.py @@ -0,0 +1,135 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +import re + +# Mapping based on the official PTX ISA <-> CUDA Release table +# https://docs.nvidia.com/cuda/parallel-thread-execution/#release-notes-ptx-release-history +_ptx_to_cuda = { + "1.0": (1, 0), + "1.1": (1, 1), + "1.2": (2, 0), + "1.3": (2, 1), + "1.4": (2, 2), + "2.0": (3, 0), + "2.1": (3, 1), + "2.2": (3, 2), + "2.3": (4, 0), + "3.0": (4, 1), + "3.1": (5, 0), + "3.2": (5, 5), + "4.0": (6, 0), + "4.1": (6, 5), + "4.2": (7, 0), + "4.3": (7, 5), + "5.0": (8, 0), + "6.0": (9, 0), + "6.1": (9, 1), + "6.2": (9, 2), + "6.3": (10, 0), + "6.4": (10, 1), + "6.5": (10, 2), + "7.0": (11, 0), + "7.1": (11, 1), + "7.2": (11, 2), + "7.3": (11, 3), + "7.4": (11, 4), + "7.5": (11, 5), + "7.6": (11, 6), + "7.7": (11, 7), + "7.8": (11, 8), + "8.0": (12, 0), + "8.1": (12, 1), + "8.2": (12, 2), + "8.3": (12, 3), + "8.4": (12, 4), + "8.5": (12, 5), + "8.6": (12, 7), + "8.7": (12, 8), + "8.8": (12, 9), + "9.0": (13, 0), + "9.1": (13, 1), + "9.2": (13, 2), + "9.3": (13, 3), +} + + +def get_minimal_required_cuda_ver_from_ptx_ver(ptx_version: str) -> int: + """ + Maps the PTX ISA version to the minimal CUDA driver, nvPTXCompiler, or nvJitLink version + that is needed to load a PTX of the given ISA version. + + Parameters + ---------- + ptx_version : str + PTX ISA version as a string, e.g. "8.8" for PTX ISA 8.8. This is the ``.version`` + directive in the PTX header. + + Returns + ------- + int + Minimal CUDA version as 1000 * major + 10 * minor, e.g. 12090 for CUDA 12.9. + + Raises + ------ + ValueError + If the PTX version is unknown. + + Examples + -------- + >>> get_minimal_required_driver_ver_from_ptx_ver("8.8") + 12090 + >>> get_minimal_required_driver_ver_from_ptx_ver("7.0") + 11000 + """ + try: + major, minor = _ptx_to_cuda[ptx_version] + return 1000 * major + 10 * minor + except KeyError: + raise ValueError(f"Unknown or unsupported PTX ISA version: {ptx_version}") from None + + +# Regex pattern to match .version directive and capture the version number +# TODO: if import speed is a concern, consider lazy-initializing it. +_ptx_ver_pattern = re.compile(r"\.version\s+([0-9]+\.[0-9]+)") + + +def get_ptx_ver(ptx: str) -> str: + """ + Extract the PTX ISA version string from PTX source code. + + Parameters + ---------- + ptx : str + The PTX assembly source code as a string. + + Returns + ------- + str + The PTX ISA version string, e.g., "8.8". + + Raises + ------ + ValueError + If the .version directive is not found in the PTX source. + + Examples + -------- + >>> ptx = r''' + ... .version 8.8 + ... .target sm_86 + ... .address_size 64 + ... + ... .visible .entry test_kernel() + ... { + ... ret; + ... } + ... ''' + >>> get_ptx_ver(ptx) + '8.8' + """ + m = _ptx_ver_pattern.search(ptx) + if m: + return m.group(1) + else: + raise ValueError("No .version directive found in PTX source. Is it a valid PTX?") diff --git a/cuda_bindings/cuda/bindings/utils/_version_check.py b/cuda_bindings/cuda/bindings/utils/_version_check.py new file mode 100644 index 00000000000..5c68b50152e --- /dev/null +++ b/cuda_bindings/cuda/bindings/utils/_version_check.py @@ -0,0 +1,61 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +import os +import threading +import warnings + +# Track whether we've already checked major version compatibility +_major_version_compatibility_checked = False +_lock = threading.Lock() + + +def warn_if_cuda_major_version_mismatch(): + """Warn if the CUDA driver major version is older than cuda-bindings compile-time version. + + This function compares the CUDA major version that cuda-bindings was compiled + against with the CUDA major version supported by the installed driver. If the + compile-time major version is greater than the driver's major version, a warning + is issued. + + The check runs only once per process. Subsequent calls are no-ops. + + The warning can be suppressed by setting the environment variable + ``CUDA_PYTHON_DISABLE_MAJOR_VERSION_WARNING=1``. + """ + global _major_version_compatibility_checked + if _major_version_compatibility_checked: + return + with _lock: + if _major_version_compatibility_checked: + return + _major_version_compatibility_checked = True + + # Allow users to suppress the warning + if os.environ.get("CUDA_PYTHON_DISABLE_MAJOR_VERSION_WARNING"): + return + + # Import here to avoid circular imports and allow lazy loading + from cuda.bindings import driver + + # Get compile-time CUDA version from cuda-bindings + compile_version = driver.CUDA_VERSION # e.g., 13010 + compile_major = compile_version // 1000 + + # Get runtime driver version + err, runtime_version = driver.cuDriverGetVersion() + if err != driver.CUresult.CUDA_SUCCESS: + raise RuntimeError(f"Failed to query CUDA driver version: {err}") + + runtime_major = runtime_version // 1000 + + if compile_major > runtime_major: + warnings.warn( + f"cuda-bindings was built for CUDA major version {compile_major}, but the " + f"NVIDIA driver only supports up to CUDA {runtime_major}. Some cuda-bindings " + f"features may not work correctly. Consider updating your NVIDIA driver, " + f"or using a cuda-bindings version built for CUDA {runtime_major}. " + f"(Set CUDA_PYTHON_DISABLE_MAJOR_VERSION_WARNING=1 to suppress this warning.)", + UserWarning, + stacklevel=3, + ) diff --git a/cuda_bindings/docs/Makefile b/cuda_bindings/docs/Makefile new file mode 100644 index 00000000000..5d861d28088 --- /dev/null +++ b/cuda_bindings/docs/Makefile @@ -0,0 +1,23 @@ +# SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= -j auto +SPHINXBUILD ?= sphinx-build +SOURCEDIR = source +BUILDDIR = build/html/${SPHINX_CUDA_BINDINGS_VER} + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -b help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -b $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/cuda_bindings/docs/README.md b/cuda_bindings/docs/README.md new file mode 100644 index 00000000000..54d670d0917 --- /dev/null +++ b/cuda_bindings/docs/README.md @@ -0,0 +1,11 @@ +# Build the documentation + +1. Install the `cuda-bindings` package of the version that we need to document. +2. Ensure the version is included in the [`nv-versions.json`](./nv-versions.json). +3. Build the docs with `./build_docs.sh`. +4. The html artifacts should be available under both `./build/html/latest` and `./build/html/`. + +Alternatively, we can build all the docs at once by running [`cuda_python/docs/build_all_docs.sh`](../../cuda_python/docs/build_all_docs.sh). + +To publish the docs with the built version, it is important to note that the html files of older versions +should be kept intact, in order for the version selection (through `nv-versions.json`) to work. diff --git a/cuda_bindings/docs/build_docs.sh b/cuda_bindings/docs/build_docs.sh new file mode 100755 index 00000000000..199ababce60 --- /dev/null +++ b/cuda_bindings/docs/build_docs.sh @@ -0,0 +1,60 @@ +#!/bin/bash + +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +set -ex + +if [[ "$#" == "0" ]]; then + LATEST_ONLY="0" +elif [[ "$#" == "1" && "$1" == "latest-only" ]]; then + LATEST_ONLY="1" +else + echo "usage: ./build_docs.sh [latest-only]" + exit 1 +fi + +# SPHINX_CUDA_BINDINGS_VER is used to create a subdir under build/html +# (the Makefile file for sphinx-build also honors it if defined). +# If there's a post release (ex: .post1) we don't want it to show up in the +# version selector or directory structure. +if [[ -z "${SPHINX_CUDA_BINDINGS_VER}" ]]; then + export SPHINX_CUDA_BINDINGS_VER=$(python -c "from importlib.metadata import version; \ + ver = '.'.join(str(version('cuda-bindings')).split('.')[:3]); \ + print(ver)" \ + | awk -F'+' '{print $1}') +fi + +if [[ "${LATEST_ONLY}" == "1" && -z "${BUILD_PREVIEW:-}" && -z "${BUILD_LATEST:-}" ]]; then + export BUILD_LATEST=1 +fi + +# build the docs (in parallel) +if [[ -z "${SPHINXOPTS:-}" ]]; then + HTML_SPHINXOPTS="-j 4 -d build/.doctrees" +else + HTML_SPHINXOPTS="${SPHINXOPTS}" +fi +SPHINXOPTS="${HTML_SPHINXOPTS}" make html + +# for debugging/developing (conf.py), please comment out the above line and +# use the line below instead, as we must build in serial to avoid getting +# obsecure Sphinx errors +#SPHINXOPTS="-v" make html + +# to support version dropdown menu +cp ./versions.json build/html +cp ./nv-versions.json build/html + +# to have a redirection page (to the latest docs) +cp source/_templates/main.html build/html/index.html + +# ensure that the latest docs is the one we built +if [[ $LATEST_ONLY == "0" ]]; then + cp -r build/html/${SPHINX_CUDA_BINDINGS_VER} build/html/latest +else + mv build/html/${SPHINX_CUDA_BINDINGS_VER} build/html/latest +fi + +# ensure that the Sphinx reference uses the latest docs +cp build/html/latest/objects.inv build/html diff --git a/docs_src/make.bat b/cuda_bindings/docs/make.bat similarity index 83% rename from docs_src/make.bat rename to cuda_bindings/docs/make.bat index 9534b018135..85f34efee44 100644 --- a/docs_src/make.bat +++ b/cuda_bindings/docs/make.bat @@ -1,5 +1,8 @@ @ECHO OFF +REM SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +REM SPDX-License-Identifier: Apache-2.0 + pushd %~dp0 REM Command file for Sphinx documentation diff --git a/cuda_bindings/docs/nv-versions.json b/cuda_bindings/docs/nv-versions.json new file mode 100644 index 00000000000..f5795e15f66 --- /dev/null +++ b/cuda_bindings/docs/nv-versions.json @@ -0,0 +1,86 @@ +[ + { + "version": "latest", + "url": "https://nvidia.github.io/cuda-python/cuda-bindings/latest/" + }, + { + "version": "13.3.1", + "url": "https://nvidia.github.io/cuda-python/cuda-bindings/13.3.1/" + }, + { + "version": "13.3.0", + "url": "https://nvidia.github.io/cuda-python/cuda-bindings/13.3.0/" + }, + { + "version": "13.2.0", + "url": "https://nvidia.github.io/cuda-python/cuda-bindings/13.2.0/" + }, + { + "version": "13.1.1", + "url": "https://nvidia.github.io/cuda-python/cuda-bindings/13.1.1/" + }, + { + "version": "13.1.0", + "url": "https://nvidia.github.io/cuda-python/cuda-bindings/13.1.0/" + }, + { + "version": "13.0.3", + "url": "https://nvidia.github.io/cuda-python/cuda-bindings/13.0.3/" + }, + { + "version": "13.0.2", + "url": "https://nvidia.github.io/cuda-python/cuda-bindings/13.0.2/" + }, + { + "version": "13.0.1", + "url": "https://nvidia.github.io/cuda-python/cuda-bindings/13.0.1/" + }, + { + "version": "13.0.0", + "url": "https://nvidia.github.io/cuda-python/cuda-bindings/13.0.0/" + }, + { + "version": "12.9.7", + "url": "https://nvidia.github.io/cuda-python/cuda-bindings/12.9.7/" + }, + { + "version": "12.9.6", + "url": "https://nvidia.github.io/cuda-python/cuda-bindings/12.9.6/" + }, + { + "version": "12.9.5", + "url": "https://nvidia.github.io/cuda-python/cuda-bindings/12.9.5/" + }, + { + "version": "12.9.4", + "url": "https://nvidia.github.io/cuda-python/cuda-bindings/12.9.4/" + }, + { + "version": "12.9.3", + "url": "https://nvidia.github.io/cuda-python/cuda-bindings/12.9.3/" + }, + { + "version": "12.9.2", + "url": "https://nvidia.github.io/cuda-python/cuda-bindings/12.9.2/" + }, + { + "version": "12.9.1", + "url": "https://nvidia.github.io/cuda-python/cuda-bindings/12.9.1/" + }, + { + "version": "12.9.0", + "url": "https://nvidia.github.io/cuda-python/cuda-bindings/12.9.0/" + }, + { + "version": "12.8.0", + "url": "https://nvidia.github.io/cuda-python/cuda-bindings/12.8.0/" + }, + { + "version": "12.6.2", + "url": "https://nvidia.github.io/cuda-python/cuda-bindings/12.6.2/" + }, + { + "version": "12.6.1", + "url": "https://nvidia.github.io/cuda-python/cuda-bindings/12.6.1/" + } +] diff --git a/docs/_images/Nsigth-Compute-CLI-625x473.png b/cuda_bindings/docs/source/_static/images/Nsight-Compute-CLI-625x473.png similarity index 100% rename from docs/_images/Nsigth-Compute-CLI-625x473.png rename to cuda_bindings/docs/source/_static/images/Nsight-Compute-CLI-625x473.png diff --git a/cuda_bindings/docs/source/_templates/main.html b/cuda_bindings/docs/source/_templates/main.html new file mode 100644 index 00000000000..b5e870a278d --- /dev/null +++ b/cuda_bindings/docs/source/_templates/main.html @@ -0,0 +1,13 @@ + + + + + + + + +

If this page does not refresh automatically, then please direct your browser to + our latest docs. +

+ + diff --git a/cuda_bindings/docs/source/api.rst b/cuda_bindings/docs/source/api.rst new file mode 100644 index 00000000000..c3de98f24d9 --- /dev/null +++ b/cuda_bindings/docs/source/api.rst @@ -0,0 +1,21 @@ +.. SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +------------------------- +CUDA Python API Reference +------------------------- + +.. toctree:: + :maxdepth: 3 + :caption: CaptionHolder: + + module/driver + module/runtime + module/nvrtc + module/nvjitlink + module/nvvm + module/nvfatbin + module/cudla + module/cufile + module/nvml + module/utils diff --git a/docs/_sources/conduct.md.txt b/cuda_bindings/docs/source/conduct.rst similarity index 82% rename from docs/_sources/conduct.md.txt rename to cuda_bindings/docs/source/conduct.rst index ae72cd62707..8983e183956 100644 --- a/docs/_sources/conduct.md.txt +++ b/cuda_bindings/docs/source/conduct.rst @@ -1,10 +1,16 @@ -# Code of Conduct +.. SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 -## Overview +Code of Conduct +=============== -Define the code of conduct followed and enforced for the CUDA Python project. +Overview +-------- -## Our Pledge +Define the code of conduct followed and enforced for the ``cuda.bindings`` project. + +Our Pledge +---------- In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and @@ -13,7 +19,8 @@ size, disability, ethnicity, sex characteristics, gender identity and expression level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. -## Our Standards +Our Standards +------------- Examples of behavior that contributes to creating a positive environment include: @@ -35,7 +42,8 @@ Examples of unacceptable behavior by participants include: * Other conduct which could reasonably be considered inappropriate in a professional setting -## Our Responsibilities +Our Responsibilities +-------------------- Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in @@ -47,7 +55,8 @@ that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. -## Scope +Scope +----- This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of @@ -56,11 +65,12 @@ address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. -## Enforcement +Enforcement +----------- Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at -[cuda-python-conduct@nvidia.com](mailto:cuda-python-conduct@nvidia.com) All +`cuda-python-conduct@nvidia.com `_ All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an @@ -71,12 +81,11 @@ Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. -## Attribution - -This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, -available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html +Attribution +----------- -[homepage]: https://www.contributor-covenant.org +This Code of Conduct is adapted from the `Contributor Covenant `_, version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct/ For answers to common questions about this code of conduct, see https://www.contributor-covenant.org/faq diff --git a/cuda_bindings/docs/source/conf.py b/cuda_bindings/docs/source/conf.py new file mode 100644 index 00000000000..8a7e15d1be0 --- /dev/null +++ b/cuda_bindings/docs/source/conf.py @@ -0,0 +1,155 @@ +# SPDX-FileCopyrightText: Copyright (c) 2012-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +# Configuration file for the Sphinx documentation builder. +# +# This file only contains a selection of the most common options. For a full +# list see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Path setup -------------------------------------------------------------- + +import os +import sys +from pathlib import Path + +sys.path.insert(0, str((Path(__file__).parents[3] / "cuda_python" / "docs" / "exts").absolute())) + + +# -- Project information ----------------------------------------------------- + +project = "cuda.bindings" +copyright = "2021-2026, NVIDIA" +author = "NVIDIA" + +# The full version, including alpha/beta/rc tags +release = os.environ["SPHINX_CUDA_BINDINGS_VER"] + + +def _github_examples_ref(): + if ref := os.environ.get("CUDA_PYTHON_DOCS_GITHUB_REF"): + return ref + if int(os.environ.get("BUILD_PREVIEW", 0)) or int(os.environ.get("BUILD_LATEST", 0)): + return "main" + return f"v{release}" + + +GITHUB_EXAMPLES_REF = _github_examples_ref() + + +def _html_baseurl(): + docs_domain = os.environ.get("CUDA_PYTHON_DOCS_DOMAIN", "https://nvidia.github.io/cuda-python") + if int(os.environ.get("BUILD_PREVIEW", 0)): + return f"{docs_domain}/pr-preview/pr-{os.environ['PR_NUMBER']}/cuda-bindings/latest/" + if int(os.environ.get("BUILD_LATEST", 0)): + return f"{docs_domain}/cuda-bindings/latest/" + return f"{docs_domain}/cuda-bindings/{release}/" + + +# -- General configuration --------------------------------------------------- + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + "sphinx.ext.autodoc", + "sphinx.ext.autosummary", + "sphinx.ext.extlinks", + "sphinx.ext.napoleon", + "sphinx.ext.intersphinx", + "myst_nb", + "sphinx_copybutton", + "release_toc", + "release_date", + "enum_documenter", +] + +nb_execution_mode = "off" +numfig = True + +# Add any paths that contain templates here, relative to this directory. +templates_path = ["_templates"] + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This pattern also affects html_static_path and html_extra_path. +exclude_patterns = [] + +# Include object entries (methods, attributes, etc.) in the table of contents +# This enables the "On This Page" sidebar to show class methods and properties +# Requires Sphinx 5.1+ +toc_object_entries = True +toc_object_entries_show_parents = "domain" + +# -- Options for HTML output ------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +html_baseurl = _html_baseurl() +html_theme = "nvidia_sphinx_theme" +html_theme_options = { + "switcher": { + "json_url": "https://nvidia.github.io/cuda-python/cuda-bindings/nv-versions.json", + "version_match": release, + }, + # Add light/dark mode and documentation version switcher + "navbar_center": [ + "version-switcher", + "navbar-nav", + ], + # Use custom secondary sidebar that includes autodoc entries + "secondary_sidebar_items": ["page-toc"], + # Show more TOC levels by default + "show_toc_level": 3, +} +if os.environ.get("CI"): + if int(os.environ.get("BUILD_PREVIEW", 0)): + PR_NUMBER = f"{os.environ['PR_NUMBER']}" + PR_TEXT = f'PR {PR_NUMBER}' + html_theme_options["announcement"] = f"Warning: This documentation is only a preview for {PR_TEXT}!" + elif int(os.environ.get("BUILD_LATEST", 0)): + html_theme_options["announcement"] = ( + "Warning: This documentation is built from the development branch!" + ) + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = [] # ["_static"] does not exist in our environment + +# skip cmdline prompts +copybutton_exclude = ".linenos, .gp" + +extlinks = { + "cuda-bindings-example": ( + f"https://github.com/NVIDIA/cuda-python/blob/{GITHUB_EXAMPLES_REF}/cuda_bindings/examples/%s", + "%s", + ), + "cuda-bindings-examples": ( + f"https://github.com/NVIDIA/cuda-python/tree/{GITHUB_EXAMPLES_REF}/cuda_bindings/examples%s", + "%s", + ), +} + +intersphinx_mapping = { + "python": ("https://docs.python.org/3/", None), + "numpy": ("https://numpy.org/doc/stable/", None), + "nvvm": ("https://docs.nvidia.com/cuda/libnvvm-api/", None), + "nvjitlink": ("https://docs.nvidia.com/cuda/nvjitlink/", None), + "cufile": ("https://docs.nvidia.com/gpudirect-storage/api-reference-guide/", None), +} + + +def rewrite_source(app, docname, source): + if docname.startswith("release/"): + source[0] = source[0].replace(".. module:: cuda.bindings\n\n", "", 1) + + +suppress_warnings = [ + # for warnings about multiple possible targets, see NVIDIA/cuda-python#152 + "ref.python", +] + + +def setup(app): + app.connect("source-read", rewrite_source) diff --git a/cuda_bindings/docs/source/contribute.rst b/cuda_bindings/docs/source/contribute.rst new file mode 100644 index 00000000000..f2a4fc9c53d --- /dev/null +++ b/cuda_bindings/docs/source/contribute.rst @@ -0,0 +1,27 @@ +.. SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +Contributing +============ + +Thank you for your interest in contributing to ``cuda-bindings``! Based on the +type of contribution, it will fall into two categories: + +1. You want to report a bug, feature request, or documentation issue. + + File an `issue `_ + describing what you encountered or what you want to see changed. The NVIDIA + team will evaluate the issue, triage it, and schedule it for a release. If + you believe the issue needs priority attention, comment on the issue to + notify the team. + +2. You want to implement a feature, improvement, or bug fix. + + Before starting work on an existing issue, comment on the issue to express + your interest and wait to be assigned by a maintainer. This helps avoid + redundant effort. + + Follow the repository `contribution guide + `_, including + signing off each commit under the Developer Certificate of Origin (DCO) and + cryptographically signing commits. diff --git a/cuda_bindings/docs/source/environment_variables.rst b/cuda_bindings/docs/source/environment_variables.rst new file mode 100644 index 00000000000..7f716b1234a --- /dev/null +++ b/cuda_bindings/docs/source/environment_variables.rst @@ -0,0 +1,27 @@ +.. SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +Environment Variables +===================== + +Runtime Environment Variables +----------------------------- + +- ``CUDA_PYTHON_CUDA_PER_THREAD_DEFAULT_STREAM`` : When set to 1, the default stream is the per-thread default stream. When set to 0, the default stream is the legacy default stream. This defaults to 0, for the legacy default stream. See `Stream Synchronization Behavior `_ for an explanation of the legacy and per-thread default streams. + +- ``CUDA_PYTHON_DISABLE_MAJOR_VERSION_WARNING`` : When set to 1, suppresses warnings about CUDA major version mismatches between ``cuda-bindings`` and the installed driver. + + +Build-Time Environment Variables +-------------------------------- + +- ``CUDA_PATH`` or ``CUDA_HOME``: Specifies the location of the CUDA Toolkit. If both are set, ``CUDA_PATH`` takes precedence. + + .. note:: + The ``CUDA_PATH`` > ``CUDA_HOME`` priority is determined by ``cuda-pathfinder``. + Earlier versions of ``cuda-pathfinder`` (before 1.5.0) used the opposite order + (``CUDA_HOME`` > ``CUDA_PATH``). See the + `cuda-pathfinder 1.5.0 release notes `_ + for details and migration guidance. + +- ``CUDA_PYTHON_PARALLEL_LEVEL`` (previously ``PARALLEL_LEVEL``) : int, sets the number of threads used in the compilation of extension modules. Not setting it or setting it to 0 would disable parallel builds. diff --git a/cuda_bindings/docs/source/examples.rst b/cuda_bindings/docs/source/examples.rst new file mode 100644 index 00000000000..911c27a099a --- /dev/null +++ b/cuda_bindings/docs/source/examples.rst @@ -0,0 +1,65 @@ +.. SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +Examples +======== + +This page links to the ``cuda.bindings`` examples shipped in the +:cuda-bindings-examples:`cuda-python repository `. +Use it as a quick index when you want a runnable sample for a specific API area +or CUDA feature. + +Introduction +------------ + +- :cuda-bindings-example:`clock_nvrtc.py <0_Introduction/clock_nvrtc.py>` + uses NVRTC-compiled CUDA code and the device clock to time a reduction + kernel. +- :cuda-bindings-example:`simple_cubemap_texture.py <0_Introduction/simple_cubemap_texture.py>` + demonstrates cubemap texture sampling and transformation. +- :cuda-bindings-example:`simple_p2p.py <0_Introduction/simple_p2p.py>` + shows peer-to-peer memory access and transfers between multiple GPUs. +- :cuda-bindings-example:`simple_zero_copy.py <0_Introduction/simple_zero_copy.py>` + uses zero-copy mapped host memory for vector addition. +- :cuda-bindings-example:`system_wide_atomics.py <0_Introduction/system_wide_atomics.py>` + demonstrates system-wide atomic operations on managed memory. +- :cuda-bindings-example:`vector_add_drv.py <0_Introduction/vector_add_drv.py>` + uses the CUDA Driver API and unified virtual addressing for vector addition. +- :cuda-bindings-example:`vector_add_mmap.py <0_Introduction/vector_add_mmap.py>` + uses virtual memory management APIs such as ``cuMemCreate`` and + ``cuMemMap`` for vector addition. + +Concepts and techniques +----------------------- + +- :cuda-bindings-example:`stream_ordered_allocation.py <2_Concepts_and_Techniques/stream_ordered_allocation.py>` + demonstrates ``cudaMallocAsync`` and ``cudaFreeAsync`` together with + memory-pool release thresholds. + +CUDA features +------------- + +- :cuda-bindings-example:`global_to_shmem_async_copy.py <3_CUDA_Features/global_to_shmem_async_copy.py>` + compares asynchronous global-to-shared-memory copy strategies in matrix + multiplication kernels. +- :cuda-bindings-example:`simple_cuda_graphs.py <3_CUDA_Features/simple_cuda_graphs.py>` + shows both manual CUDA graph construction and stream-capture-based replay. + +Libraries and tools +------------------- + +- :cuda-bindings-example:`conjugate_gradient_multi_block_cg.py <4_CUDA_Libraries/conjugate_gradient_multi_block_cg.py>` + implements a conjugate-gradient solver with cooperative groups and + multi-block synchronization. +- :cuda-bindings-example:`nvidia_smi.py <4_CUDA_Libraries/nvidia_smi.py>` + uses NVML to implement a Python subset of ``nvidia-smi``. + +Advanced and interoperability +----------------------------- + +- :cuda-bindings-example:`iso_fd_modelling.py ` + runs isotropic finite-difference wave propagation across multiple GPUs with + peer-to-peer halo exchange. +- :cuda-bindings-example:`jit_program.py ` + JIT-compiles a SAXPY kernel with NVRTC and launches it through the Driver + API. diff --git a/cuda_bindings/docs/source/index.rst b/cuda_bindings/docs/source/index.rst new file mode 100644 index 00000000000..20642f2cdc5 --- /dev/null +++ b/cuda_bindings/docs/source/index.rst @@ -0,0 +1,30 @@ +.. SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +``cuda.bindings``: Low-level Python Bindings for CUDA +===================================================== + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + + release + install + overview + examples + motivation + environment_variables + api + tips_and_tricks + support + contribute + conduct + license + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` diff --git a/cuda_bindings/docs/source/install.rst b/cuda_bindings/docs/source/install.rst new file mode 100644 index 00000000000..7f890365ea3 --- /dev/null +++ b/cuda_bindings/docs/source/install.rst @@ -0,0 +1,149 @@ +.. SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +Installation +============ + +Runtime Requirements +-------------------- + +``cuda.bindings`` supports the same platforms as CUDA. Runtime dependencies are: + +* Linux (x86-64, arm64) and Windows (x86-64) +* Python 3.10 - 3.14 +* Driver: Linux (580.65.06 or later) Windows (580.88 or later) +* Optionally, NVRTC, nvJitLink, nvFatBin, NVVM, cuFile, and cuDLA from CUDA Toolkit 13.x + +.. note:: + + The optional CUDA Toolkit components are now installed via the ``cuda-toolkit`` metapackage from PyPI for improved dependency resolution. Components can also be installed via Conda, OS-specific package managers, or local installers (as described in the CUDA Toolkit `Windows `_ and `Linux `_ Installation Guides). + +Starting from v12.8.0, ``cuda-python`` becomes a meta package which currently depends only on ``cuda-bindings``; in the future more sub-packages will be added to ``cuda-python``. In the instructions below, we still use ``cuda-python`` as example to serve existing users, but everything is applicable to ``cuda-bindings`` as well. + + +Free-threading Build Support +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +As of cuda-bindings 13.0.2 and 12.9.3, **experimental** packages for the `free-threaded interpreter`_ are shipped. + +1. Support for these builds is best effort, due to heavy use of `built-in + modules that are known to be thread-unsafe`_, such as ``ctypes``. +2. For now, you are responsible for making sure that calls into the ``cuda-bindings`` + library are thread-safe. This is subject to change. + +.. _built-in modules that are known to be thread-unsafe: https://github.com/python/cpython/issues/116738 +.. _free-threaded interpreter: https://docs.python.org/3/howto/free-threading-python.html + + +Installing from PyPI +-------------------- + +.. code-block:: console + + $ pip install -U cuda-python + +Install all optional dependencies with: + +.. code-block:: console + + $ pip install -U cuda-python[all] + +Where the optional dependencies include: + +* ``nvidia-cuda-nvrtc`` (NVRTC runtime compilation library) +* ``nvidia-nvjitlink`` (nvJitLink library) +* ``nvidia-nvfatbin`` (nvFatBin library) +* ``nvidia-nvvm`` (NVVM library) +* ``nvidia-cufile`` (cuFile library, Linux only) +* ``nvidia-cudla`` (cuDLA library, Linux aarch64 only) + +These are now installed through the ``cuda-toolkit`` metapackage, where available, for improved dependency resolution. + +Installing from Conda +--------------------- + +.. code-block:: console + + $ conda install -c conda-forge cuda-python + +.. note:: + + When using conda, the ``cuda-version`` metapackage can be used to control the versions of CUDA Toolkit components that are installed to the conda environment. + +For example: + +.. code-block:: console + + $ conda install -c conda-forge cuda-python cuda-version=13 + +.. note:: + + Tegra users can install the cuDLA conda package from conda-forge through ``conda install -c conda-forge libcudla cuda-version=13``, if it does not already exist on the system. + +Development environment +----------------------- + +The sections above cover end-user installation. The section below focuses on +a repeatable *development* workflow (editable installs and running tests). + +Installing the latest nightly (top-of-tree builds) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +These are useful for users looking to test new features or bug fixes prior to +their inclusion in a release. + +CI publishes wheels as GitHub Actions artifacts on every push to ``main``. To +obtain the most recent build, use the following commands: + +.. code-block:: console + + $ # Find the latest successful CI run on main: + $ RUN_ID=$(gh run list -R NVIDIA/cuda-python -w ci.yml -b main -s success -L1 --json databaseId -q '.[0].databaseId') + + $ # Download the wheel (pick your Python version and platform): + $ gh run download "$RUN_ID" -R NVIDIA/cuda-python -p "cuda-bindings-python312-cuda13*-linux-64-*" + + $ # Install the downloaded wheel: + $ pip install cuda-bindings-python312-cuda13*-linux-64-*/cuda_bindings*.whl[all] + +Replace ``python312`` with your Python version (e.g. ``python310``, ``python311``, +``python313``, ``python314``, ``python314t``). For aarch64, replace ``linux-64`` +with ``linux-aarch64``; for Windows, use ``win-64``. Only the current CUDA +major version is built on ``main``; wheels for the prior CUDA major are +published from the corresponding backport branch. + +Installing from Source +~~~~~~~~~~~~~~~~~~~~~~ + +Requirements +^^^^^^^^^^^^ + +* CUDA Toolkit headers[^1] +* CUDA Runtime static library[^2] + +[^1]: User projects that ``cimport`` CUDA symbols in Cython must also use CUDA Toolkit (CTK) types as provided by the ``cuda.bindings`` major.minor version. This results in CTK headers becoming a transitive dependency of downstream projects through CUDA Python. + +[^2]: The CUDA Runtime static library (``libcudart_static.a`` on Linux, ``cudart_static.lib`` on Windows) is part of the CUDA Toolkit. If using conda packages, it is contained in the ``cuda-cudart-static`` package. + +Source builds require that the provided CUDA headers are of the same major.minor version as the ``cuda.bindings`` you're trying to build. Despite this requirement, note that the minor version compatibility is still maintained. Use the ``CUDA_PATH`` (or ``CUDA_HOME``) environment variable to specify the location of your headers. If both are set, ``CUDA_PATH`` takes precedence. For example, if your headers are located in ``/usr/local/cuda/include``, then you should set ``CUDA_PATH`` with: + +.. code-block:: console + + $ export CUDA_PATH=/usr/local/cuda + +See :doc:`Environment Variables ` for a description of other build-time environment variables. + +.. note:: + + Only ``cydriver``, ``cyruntime`` and ``cynvrtc`` are impacted by the header requirement. + +Editable Install +^^^^^^^^^^^^^^^^ + +You can use: + +.. code-block:: console + + $ pip install -v -e . + +to install the module as editable in your current Python environment (e.g. for testing of porting other libraries to use the binding). diff --git a/cuda_bindings/docs/source/license.rst b/cuda_bindings/docs/source/license.rst new file mode 100644 index 00000000000..f5de9869980 --- /dev/null +++ b/cuda_bindings/docs/source/license.rst @@ -0,0 +1,8 @@ +.. SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +Apache License 2.0 +****************** + +.. literalinclude:: ../../LICENSE + :language: text diff --git a/cuda_bindings/docs/source/module/cudla.rst b/cuda_bindings/docs/source/module/cudla.rst new file mode 100644 index 00000000000..5a77fd45c56 --- /dev/null +++ b/cuda_bindings/docs/source/module/cudla.rst @@ -0,0 +1,64 @@ +.. SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +.. default-role:: cpp:any + +cudla +===== + +Note +---- + +The cuDLA bindings require a Jetson platform with DLA hardware (Xavier or Orin). +cuDLA is not available on desktop GPUs. + +Functions +--------- + +cuDLA defines the following functions for DLA device management and inference. + +.. autofunction:: cuda.bindings.cudla.get_version +.. autofunction:: cuda.bindings.cudla.device_get_count +.. autofunction:: cuda.bindings.cudla.create_device +.. autofunction:: cuda.bindings.cudla.destroy_device +.. autofunction:: cuda.bindings.cudla.mem_register +.. autofunction:: cuda.bindings.cudla.mem_unregister +.. autofunction:: cuda.bindings.cudla.module_load_from_memory +.. autofunction:: cuda.bindings.cudla.module_get_attributes +.. autofunction:: cuda.bindings.cudla.module_unload +.. autofunction:: cuda.bindings.cudla.submit_task +.. autofunction:: cuda.bindings.cudla.device_get_attribute +.. autofunction:: cuda.bindings.cudla.get_last_error +.. autofunction:: cuda.bindings.cudla.set_task_timeout_in_ms + +Types +----- + +.. autoclass:: cuda.bindings.cudla.ExternalMemoryHandleDesc +.. autoclass:: cuda.bindings.cudla.ExternalSemaphoreHandleDesc +.. autoclass:: cuda.bindings.cudla.ModuleTensorDescriptor +.. autoclass:: cuda.bindings.cudla.Fence +.. autoclass:: cuda.bindings.cudla.DevAttribute +.. autoclass:: cuda.bindings.cudla.ModuleAttribute +.. autoclass:: cuda.bindings.cudla.WaitEvents +.. autoclass:: cuda.bindings.cudla.SignalEvents +.. autoclass:: cuda.bindings.cudla.Task + +Enums +----- + +.. autoclass:: cuda.bindings.cudla.Status + + .. autoattribute:: cuda.bindings.cudla.Status.Success + +.. autoclass:: cuda.bindings.cudla.Mode + + .. autoattribute:: cuda.bindings.cudla.Mode.CUDA_DLA + .. autoattribute:: cuda.bindings.cudla.Mode.STANDALONE + +.. autoclass:: cuda.bindings.cudla.ModuleAttributeType +.. autoclass:: cuda.bindings.cudla.FenceType +.. autoclass:: cuda.bindings.cudla.ModuleLoadFlags +.. autoclass:: cuda.bindings.cudla.SubmissionFlags +.. autoclass:: cuda.bindings.cudla.AccessPermissionFlags +.. autoclass:: cuda.bindings.cudla.DevAttributeType diff --git a/cuda_bindings/docs/source/module/cufile.rst b/cuda_bindings/docs/source/module/cufile.rst new file mode 100644 index 00000000000..bd51ff26a40 --- /dev/null +++ b/cuda_bindings/docs/source/module/cufile.rst @@ -0,0 +1,76 @@ +.. SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +.. default-role:: cpp:any +.. module:: cuda.bindings.cufile + +cufile +====== + +The ``cuda.bindings.cufile`` Python module wraps the +`cuFile C APIs `_. +Supported on Linux only. + +Currently using this module requires NumPy to be present. Any recent NumPy 1.x or 2.x should work. + + +Functions +--------- + +.. autosummary:: + :toctree: generated/ + + handle_register + handle_deregister + buf_register + buf_deregister + read + write + driver_open + use_count + driver_get_properties + driver_set_poll_mode + driver_set_max_direct_io_size + driver_set_max_cache_size + driver_set_max_pinned_mem_size + batch_io_set_up + batch_io_submit + batch_io_get_status + batch_io_cancel + batch_io_destroy + read_async + write_async + stream_register + stream_deregister + get_version + get_parameter_size_t + get_parameter_bool + get_parameter_string + set_parameter_size_t + set_parameter_bool + set_parameter_string + op_status_error + driver_close + + +Types +----- + +.. autosummary:: + :toctree: generated/ + + IOEvents + Descr + IOParams + OpError + DriverStatusFlags + DriverControlFlags + FeatureFlags + FileHandleType + Opcode + Status + BatchMode + SizeTConfigParameter + BoolConfigParameter + StringConfigParameter + cuFileError diff --git a/cuda_bindings/docs/source/module/driver.rst b/cuda_bindings/docs/source/module/driver.rst new file mode 100644 index 00000000000..8d9490f54a7 --- /dev/null +++ b/cuda_bindings/docs/source/module/driver.rst @@ -0,0 +1,8077 @@ +.. SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +.. CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=15f77ea651a2deffa7f7ae710189546cff9c23ba311b693207743eaf339a0a9c +------ +driver +------ + +Data types used by CUDA driver +------------------------------ + + + +.. autoclass:: cuda.bindings.driver.CUuuid_st +.. autoclass:: cuda.bindings.driver.CUmemFabricHandle_st +.. autoclass:: cuda.bindings.driver.CUipcEventHandle_st +.. autoclass:: cuda.bindings.driver.CUipcMemHandle_st +.. autoclass:: cuda.bindings.driver.CUstreamBatchMemOpParams_union +.. autoclass:: cuda.bindings.driver.CUDA_BATCH_MEM_OP_NODE_PARAMS_v1_st +.. autoclass:: cuda.bindings.driver.CUDA_BATCH_MEM_OP_NODE_PARAMS_v2_st +.. autoclass:: cuda.bindings.driver.CUasyncNotificationInfo_st +.. autoclass:: cuda.bindings.driver.CUdevprop_st +.. autoclass:: cuda.bindings.driver.CUaccessPolicyWindow_st +.. autoclass:: cuda.bindings.driver.CUDA_KERNEL_NODE_PARAMS_st +.. autoclass:: cuda.bindings.driver.CUDA_KERNEL_NODE_PARAMS_v2_st +.. autoclass:: cuda.bindings.driver.CUDA_KERNEL_NODE_PARAMS_v3_st +.. autoclass:: cuda.bindings.driver.CUDA_MEMSET_NODE_PARAMS_st +.. autoclass:: cuda.bindings.driver.CUDA_MEMSET_NODE_PARAMS_v2_st +.. autoclass:: cuda.bindings.driver.CUDA_HOST_NODE_PARAMS_st +.. autoclass:: cuda.bindings.driver.CUDA_HOST_NODE_PARAMS_v2_st +.. autoclass:: cuda.bindings.driver.CUDA_CONDITIONAL_NODE_PARAMS +.. autoclass:: cuda.bindings.driver.CUgraphEdgeData_st +.. autoclass:: cuda.bindings.driver.CUDA_GRAPH_INSTANTIATE_PARAMS_st +.. autoclass:: cuda.bindings.driver.CUlaunchMemSyncDomainMap_st +.. autoclass:: cuda.bindings.driver.CUlaunchAttributeValue_union +.. autoclass:: cuda.bindings.driver.CUlaunchAttribute_st +.. autoclass:: cuda.bindings.driver.CUlaunchConfig_st +.. autoclass:: cuda.bindings.driver.CUexecAffinitySmCount_st +.. autoclass:: cuda.bindings.driver.CUexecAffinityParam_st +.. autoclass:: cuda.bindings.driver.CUctxCigParam_st +.. autoclass:: cuda.bindings.driver.CUctxCreateParams_st +.. autoclass:: cuda.bindings.driver.CUstreamCigParam_st +.. autoclass:: cuda.bindings.driver.CUstreamCigCaptureParams_st +.. autoclass:: cuda.bindings.driver.CUlibraryHostUniversalFunctionAndDataTable_st +.. autoclass:: cuda.bindings.driver.CUDA_MEMCPY2D_st +.. autoclass:: cuda.bindings.driver.CUDA_MEMCPY3D_st +.. autoclass:: cuda.bindings.driver.CUDA_MEMCPY3D_PEER_st +.. autoclass:: cuda.bindings.driver.CUDA_MEMCPY_NODE_PARAMS_st +.. autoclass:: cuda.bindings.driver.CUDA_ARRAY_DESCRIPTOR_st +.. autoclass:: cuda.bindings.driver.CUDA_ARRAY3D_DESCRIPTOR_st +.. autoclass:: cuda.bindings.driver.CUDA_ARRAY_SPARSE_PROPERTIES_st +.. autoclass:: cuda.bindings.driver.CUDA_ARRAY_MEMORY_REQUIREMENTS_st +.. autoclass:: cuda.bindings.driver.CUDA_RESOURCE_DESC_st +.. autoclass:: cuda.bindings.driver.CUDA_TEXTURE_DESC_st +.. autoclass:: cuda.bindings.driver.CUDA_RESOURCE_VIEW_DESC_st +.. autoclass:: cuda.bindings.driver.CUtensorMap_st +.. autoclass:: cuda.bindings.driver.CUDA_POINTER_ATTRIBUTE_P2P_TOKENS_st +.. autoclass:: cuda.bindings.driver.CUDA_LAUNCH_PARAMS_st +.. autoclass:: cuda.bindings.driver.CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st +.. autoclass:: cuda.bindings.driver.CUDA_EXTERNAL_MEMORY_BUFFER_DESC_st +.. autoclass:: cuda.bindings.driver.CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_st +.. autoclass:: cuda.bindings.driver.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st +.. autoclass:: cuda.bindings.driver.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st +.. autoclass:: cuda.bindings.driver.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st +.. autoclass:: cuda.bindings.driver.CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_st +.. autoclass:: cuda.bindings.driver.CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2_st +.. autoclass:: cuda.bindings.driver.CUDA_EXT_SEM_WAIT_NODE_PARAMS_st +.. autoclass:: cuda.bindings.driver.CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2_st +.. autoclass:: cuda.bindings.driver.CUarrayMapInfo_st +.. autoclass:: cuda.bindings.driver.CUmemLocation_st +.. autoclass:: cuda.bindings.driver.CUmemAllocationProp_st +.. autoclass:: cuda.bindings.driver.CUmulticastObjectProp_st +.. autoclass:: cuda.bindings.driver.CUmemAccessDesc_st +.. autoclass:: cuda.bindings.driver.CUgraphExecUpdateResultInfo_st +.. autoclass:: cuda.bindings.driver.CUmemPoolProps_st +.. autoclass:: cuda.bindings.driver.CUmemPoolPtrExportData_st +.. autoclass:: cuda.bindings.driver.CUmemcpyAttributes_st +.. autoclass:: cuda.bindings.driver.CUoffset3D_st +.. autoclass:: cuda.bindings.driver.CUextent3D_st +.. autoclass:: cuda.bindings.driver.CUmemcpy3DOperand_st +.. autoclass:: cuda.bindings.driver.CUDA_MEMCPY3D_BATCH_OP_st +.. autoclass:: cuda.bindings.driver.CUDA_MEM_ALLOC_NODE_PARAMS_v1_st +.. autoclass:: cuda.bindings.driver.CUDA_MEM_ALLOC_NODE_PARAMS_v2_st +.. autoclass:: cuda.bindings.driver.CUDA_MEM_FREE_NODE_PARAMS_st +.. autoclass:: cuda.bindings.driver.CUDA_CHILD_GRAPH_NODE_PARAMS_st +.. autoclass:: cuda.bindings.driver.CUDA_EVENT_RECORD_NODE_PARAMS_st +.. autoclass:: cuda.bindings.driver.CUDA_EVENT_WAIT_NODE_PARAMS_st +.. autoclass:: cuda.bindings.driver.CUgraphNodeParams_st +.. autoclass:: cuda.bindings.driver.CUcheckpointLockArgs_st +.. autoclass:: cuda.bindings.driver.CUcheckpointCheckpointArgs_st +.. autoclass:: cuda.bindings.driver.CUcheckpointGpuPair_st +.. autoclass:: cuda.bindings.driver.CUcheckpointRestoreArgs_st +.. autoclass:: cuda.bindings.driver.CUcheckpointUnlockArgs_st +.. autoclass:: cuda.bindings.driver.CUeglFrame_st +.. autoclass:: cuda.bindings.driver.CUipcMem_flags + + .. autoattribute:: cuda.bindings.driver.CUipcMem_flags.CU_IPC_MEM_LAZY_ENABLE_PEER_ACCESS + + + Automatically enable peer access between remote devices as needed + +.. autoclass:: cuda.bindings.driver.CUmemAttach_flags + + .. autoattribute:: cuda.bindings.driver.CUmemAttach_flags.CU_MEM_ATTACH_GLOBAL + + + Memory can be accessed by any stream on any device + + + .. autoattribute:: cuda.bindings.driver.CUmemAttach_flags.CU_MEM_ATTACH_HOST + + + Memory cannot be accessed by any stream on any device + + + .. autoattribute:: cuda.bindings.driver.CUmemAttach_flags.CU_MEM_ATTACH_SINGLE + + + Memory can only be accessed by a single stream on the associated device + +.. autoclass:: cuda.bindings.driver.CUctx_flags + + .. autoattribute:: cuda.bindings.driver.CUctx_flags.CU_CTX_SCHED_AUTO + + + Automatic scheduling + + + .. autoattribute:: cuda.bindings.driver.CUctx_flags.CU_CTX_SCHED_SPIN + + + Set spin as default scheduling + + + .. autoattribute:: cuda.bindings.driver.CUctx_flags.CU_CTX_SCHED_YIELD + + + Set yield as default scheduling + + + .. autoattribute:: cuda.bindings.driver.CUctx_flags.CU_CTX_SCHED_BLOCKING_SYNC + + + Set blocking synchronization as default scheduling + + + .. autoattribute:: cuda.bindings.driver.CUctx_flags.CU_CTX_BLOCKING_SYNC + + + Set blocking synchronization as default scheduling + + [Deprecated] + + + .. autoattribute:: cuda.bindings.driver.CUctx_flags.CU_CTX_SCHED_MASK + + + .. autoattribute:: cuda.bindings.driver.CUctx_flags.CU_CTX_MAP_HOST + + + [Deprecated] + + + .. autoattribute:: cuda.bindings.driver.CUctx_flags.CU_CTX_LMEM_RESIZE_TO_MAX + + + Keep local memory allocation after launch + + + .. autoattribute:: cuda.bindings.driver.CUctx_flags.CU_CTX_COREDUMP_ENABLE + + + Trigger coredumps from exceptions in this context + + + .. autoattribute:: cuda.bindings.driver.CUctx_flags.CU_CTX_USER_COREDUMP_ENABLE + + + Enable user pipe to trigger coredumps in this context + + + .. autoattribute:: cuda.bindings.driver.CUctx_flags.CU_CTX_SYNC_MEMOPS + + + Ensure synchronous memory operations on this context will synchronize + + + .. autoattribute:: cuda.bindings.driver.CUctx_flags.CU_CTX_FLAGS_MASK + +.. autoclass:: cuda.bindings.driver.CUevent_sched_flags + + .. autoattribute:: cuda.bindings.driver.CUevent_sched_flags.CU_EVENT_SCHED_AUTO + + + Automatic scheduling + + + .. autoattribute:: cuda.bindings.driver.CUevent_sched_flags.CU_EVENT_SCHED_SPIN + + + Set spin as default scheduling + + + .. autoattribute:: cuda.bindings.driver.CUevent_sched_flags.CU_EVENT_SCHED_YIELD + + + Set yield as default scheduling + + + .. autoattribute:: cuda.bindings.driver.CUevent_sched_flags.CU_EVENT_SCHED_BLOCKING_SYNC + + + Set blocking synchronization as default scheduling + +.. autoclass:: cuda.bindings.driver.cl_event_flags + + .. autoattribute:: cuda.bindings.driver.cl_event_flags.NVCL_EVENT_SCHED_AUTO + + + Automatic scheduling + + + .. autoattribute:: cuda.bindings.driver.cl_event_flags.NVCL_EVENT_SCHED_SPIN + + + Set spin as default scheduling + + + .. autoattribute:: cuda.bindings.driver.cl_event_flags.NVCL_EVENT_SCHED_YIELD + + + Set yield as default scheduling + + + .. autoattribute:: cuda.bindings.driver.cl_event_flags.NVCL_EVENT_SCHED_BLOCKING_SYNC + + + Set blocking synchronization as default scheduling + +.. autoclass:: cuda.bindings.driver.cl_context_flags + + .. autoattribute:: cuda.bindings.driver.cl_context_flags.NVCL_CTX_SCHED_AUTO + + + Automatic scheduling + + + .. autoattribute:: cuda.bindings.driver.cl_context_flags.NVCL_CTX_SCHED_SPIN + + + Set spin as default scheduling + + + .. autoattribute:: cuda.bindings.driver.cl_context_flags.NVCL_CTX_SCHED_YIELD + + + Set yield as default scheduling + + + .. autoattribute:: cuda.bindings.driver.cl_context_flags.NVCL_CTX_SCHED_BLOCKING_SYNC + + + Set blocking synchronization as default scheduling + +.. autoclass:: cuda.bindings.driver.CUhostTaskSyncMode + + .. autoattribute:: cuda.bindings.driver.CUhostTaskSyncMode.CU_HOST_TASK_BLOCKING + + + The execution thread will block until new host tasks are ready to run + + + .. autoattribute:: cuda.bindings.driver.CUhostTaskSyncMode.CU_HOST_TASK_SPINWAIT + + + The execution thread will spin wait until new host tasks are ready to run + +.. autoclass:: cuda.bindings.driver.CUstream_flags + + .. autoattribute:: cuda.bindings.driver.CUstream_flags.CU_STREAM_DEFAULT + + + Default stream flag + + + .. autoattribute:: cuda.bindings.driver.CUstream_flags.CU_STREAM_NON_BLOCKING + + + Stream does not synchronize with stream 0 (the NULL stream) + +.. autoclass:: cuda.bindings.driver.CUevent_flags + + .. autoattribute:: cuda.bindings.driver.CUevent_flags.CU_EVENT_DEFAULT + + + Default event flag + + + .. autoattribute:: cuda.bindings.driver.CUevent_flags.CU_EVENT_BLOCKING_SYNC + + + Event uses blocking synchronization + + + .. autoattribute:: cuda.bindings.driver.CUevent_flags.CU_EVENT_DISABLE_TIMING + + + Event will not record timing data + + + .. autoattribute:: cuda.bindings.driver.CUevent_flags.CU_EVENT_INTERPROCESS + + + Event is suitable for interprocess use. CU_EVENT_DISABLE_TIMING must be set + +.. autoclass:: cuda.bindings.driver.CUevent_record_flags + + .. autoattribute:: cuda.bindings.driver.CUevent_record_flags.CU_EVENT_RECORD_DEFAULT + + + Default event record flag + + + .. autoattribute:: cuda.bindings.driver.CUevent_record_flags.CU_EVENT_RECORD_EXTERNAL + + + When using stream capture, create an event record node instead of the default behavior. This flag is invalid when used outside of capture. + +.. autoclass:: cuda.bindings.driver.CUevent_wait_flags + + .. autoattribute:: cuda.bindings.driver.CUevent_wait_flags.CU_EVENT_WAIT_DEFAULT + + + Default event wait flag + + + .. autoattribute:: cuda.bindings.driver.CUevent_wait_flags.CU_EVENT_WAIT_EXTERNAL + + + When using stream capture, create an event wait node instead of the default behavior. This flag is invalid when used outside of capture. + +.. autoclass:: cuda.bindings.driver.CUatomicOperation + + .. autoattribute:: cuda.bindings.driver.CUatomicOperation.CU_ATOMIC_OPERATION_INTEGER_ADD + + + .. autoattribute:: cuda.bindings.driver.CUatomicOperation.CU_ATOMIC_OPERATION_INTEGER_MIN + + + .. autoattribute:: cuda.bindings.driver.CUatomicOperation.CU_ATOMIC_OPERATION_INTEGER_MAX + + + .. autoattribute:: cuda.bindings.driver.CUatomicOperation.CU_ATOMIC_OPERATION_INTEGER_INCREMENT + + + .. autoattribute:: cuda.bindings.driver.CUatomicOperation.CU_ATOMIC_OPERATION_INTEGER_DECREMENT + + + .. autoattribute:: cuda.bindings.driver.CUatomicOperation.CU_ATOMIC_OPERATION_AND + + + .. autoattribute:: cuda.bindings.driver.CUatomicOperation.CU_ATOMIC_OPERATION_OR + + + .. autoattribute:: cuda.bindings.driver.CUatomicOperation.CU_ATOMIC_OPERATION_XOR + + + .. autoattribute:: cuda.bindings.driver.CUatomicOperation.CU_ATOMIC_OPERATION_EXCHANGE + + + .. autoattribute:: cuda.bindings.driver.CUatomicOperation.CU_ATOMIC_OPERATION_CAS + + + .. autoattribute:: cuda.bindings.driver.CUatomicOperation.CU_ATOMIC_OPERATION_FLOAT_ADD + + + .. autoattribute:: cuda.bindings.driver.CUatomicOperation.CU_ATOMIC_OPERATION_FLOAT_MIN + + + .. autoattribute:: cuda.bindings.driver.CUatomicOperation.CU_ATOMIC_OPERATION_FLOAT_MAX + + + .. autoattribute:: cuda.bindings.driver.CUatomicOperation.CU_ATOMIC_OPERATION_MAX + +.. autoclass:: cuda.bindings.driver.CUatomicOperationCapability + + .. autoattribute:: cuda.bindings.driver.CUatomicOperationCapability.CU_ATOMIC_CAPABILITY_SIGNED + + + .. autoattribute:: cuda.bindings.driver.CUatomicOperationCapability.CU_ATOMIC_CAPABILITY_UNSIGNED + + + .. autoattribute:: cuda.bindings.driver.CUatomicOperationCapability.CU_ATOMIC_CAPABILITY_REDUCTION + + + .. autoattribute:: cuda.bindings.driver.CUatomicOperationCapability.CU_ATOMIC_CAPABILITY_SCALAR_32 + + + .. autoattribute:: cuda.bindings.driver.CUatomicOperationCapability.CU_ATOMIC_CAPABILITY_SCALAR_64 + + + .. autoattribute:: cuda.bindings.driver.CUatomicOperationCapability.CU_ATOMIC_CAPABILITY_SCALAR_128 + + + .. autoattribute:: cuda.bindings.driver.CUatomicOperationCapability.CU_ATOMIC_CAPABILITY_VECTOR_32x4 + +.. autoclass:: cuda.bindings.driver.CUstreamWaitValue_flags + + .. autoattribute:: cuda.bindings.driver.CUstreamWaitValue_flags.CU_STREAM_WAIT_VALUE_GEQ + + + Wait until (int32_t)(\*addr - value) >= 0 (or int64_t for 64 bit values). Note this is a cyclic comparison which ignores wraparound. (Default behavior.) + + + .. autoattribute:: cuda.bindings.driver.CUstreamWaitValue_flags.CU_STREAM_WAIT_VALUE_EQ + + + Wait until \*addr == value. + + + .. autoattribute:: cuda.bindings.driver.CUstreamWaitValue_flags.CU_STREAM_WAIT_VALUE_AND + + + Wait until (\*addr & value) != 0. + + + .. autoattribute:: cuda.bindings.driver.CUstreamWaitValue_flags.CU_STREAM_WAIT_VALUE_NOR + + + Wait until ~(\*addr | value) != 0. Support for this operation can be queried with :py:obj:`~.cuDeviceGetAttribute()` and :py:obj:`~.CU_DEVICE_ATTRIBUTE_CAN_USE_STREAM_WAIT_VALUE_NOR`. + + + .. autoattribute:: cuda.bindings.driver.CUstreamWaitValue_flags.CU_STREAM_WAIT_VALUE_FLUSH + + + Follow the wait operation with a flush of outstanding remote writes. This means that, if a remote write operation is guaranteed to have reached the device before the wait can be satisfied, that write is guaranteed to be visible to downstream device work. The device is permitted to reorder remote writes internally. For example, this flag would be required if two remote writes arrive in a defined order, the wait is satisfied by the second write, and downstream work needs to observe the first write. Support for this operation is restricted to selected platforms and can be queried with :py:obj:`~.CU_DEVICE_ATTRIBUTE_CAN_FLUSH_REMOTE_WRITES`. + +.. autoclass:: cuda.bindings.driver.CUstreamWriteValue_flags + + .. autoattribute:: cuda.bindings.driver.CUstreamWriteValue_flags.CU_STREAM_WRITE_VALUE_DEFAULT + + + Default behavior + + + .. autoattribute:: cuda.bindings.driver.CUstreamWriteValue_flags.CU_STREAM_WRITE_VALUE_NO_MEMORY_BARRIER + + + Permits the write to be reordered with writes which were issued before it, as a performance optimization. Normally, :py:obj:`~.cuStreamWriteValue32` will provide a memory fence before the write, which has similar semantics to __threadfence_system() but is scoped to the stream rather than a CUDA thread. This flag is not supported in the v2 API. + +.. autoclass:: cuda.bindings.driver.CUstreamBatchMemOpType + + .. autoattribute:: cuda.bindings.driver.CUstreamBatchMemOpType.CU_STREAM_MEM_OP_WAIT_VALUE_32 + + + Represents a :py:obj:`~.cuStreamWaitValue32` operation + + + .. autoattribute:: cuda.bindings.driver.CUstreamBatchMemOpType.CU_STREAM_MEM_OP_WRITE_VALUE_32 + + + Represents a :py:obj:`~.cuStreamWriteValue32` operation + + + .. autoattribute:: cuda.bindings.driver.CUstreamBatchMemOpType.CU_STREAM_MEM_OP_WAIT_VALUE_64 + + + Represents a :py:obj:`~.cuStreamWaitValue64` operation + + + .. autoattribute:: cuda.bindings.driver.CUstreamBatchMemOpType.CU_STREAM_MEM_OP_WRITE_VALUE_64 + + + Represents a :py:obj:`~.cuStreamWriteValue64` operation + + + .. autoattribute:: cuda.bindings.driver.CUstreamBatchMemOpType.CU_STREAM_MEM_OP_BARRIER + + + Insert a memory barrier of the specified type + + + .. autoattribute:: cuda.bindings.driver.CUstreamBatchMemOpType.CU_STREAM_MEM_OP_ATOMIC_REDUCTION + + + Perform a atomic reduction. See :py:obj:`~.CUstreamBatchMemOpParams.atomicReduction` + + + .. autoattribute:: cuda.bindings.driver.CUstreamBatchMemOpType.CU_STREAM_MEM_OP_FLUSH_REMOTE_WRITES + + + This has the same effect as :py:obj:`~.CU_STREAM_WAIT_VALUE_FLUSH`, but as a standalone operation. + +.. autoclass:: cuda.bindings.driver.CUstreamMemoryBarrier_flags + + .. autoattribute:: cuda.bindings.driver.CUstreamMemoryBarrier_flags.CU_STREAM_MEMORY_BARRIER_TYPE_SYS + + + System-wide memory barrier. + + + .. autoattribute:: cuda.bindings.driver.CUstreamMemoryBarrier_flags.CU_STREAM_MEMORY_BARRIER_TYPE_GPU + + + Limit memory barrier scope to the GPU. + +.. autoclass:: cuda.bindings.driver.CUstreamAtomicReductionOpType + + .. autoattribute:: cuda.bindings.driver.CUstreamAtomicReductionOpType.CU_STREAM_ATOMIC_REDUCTION_OP_OR + + + Performs an atomic OR: \*(address) = \*(address) | value + + + .. autoattribute:: cuda.bindings.driver.CUstreamAtomicReductionOpType.CU_STREAM_ATOMIC_REDUCTION_OP_AND + + + Performs an atomic AND: \*(address) = \*(address) & value + + + .. autoattribute:: cuda.bindings.driver.CUstreamAtomicReductionOpType.CU_STREAM_ATOMIC_REDUCTION_OP_ADD + + + Performs an atomic ADD: \*(address) = \*(address) + value + +.. autoclass:: cuda.bindings.driver.CUstreamAtomicReductionDataType + + .. autoattribute:: cuda.bindings.driver.CUstreamAtomicReductionDataType.CU_STREAM_ATOMIC_REDUCTION_UNSIGNED_32 + + + .. autoattribute:: cuda.bindings.driver.CUstreamAtomicReductionDataType.CU_STREAM_ATOMIC_REDUCTION_UNSIGNED_64 + +.. autoclass:: cuda.bindings.driver.CUoccupancy_flags + + .. autoattribute:: cuda.bindings.driver.CUoccupancy_flags.CU_OCCUPANCY_DEFAULT + + + Default behavior + + + .. autoattribute:: cuda.bindings.driver.CUoccupancy_flags.CU_OCCUPANCY_DISABLE_CACHING_OVERRIDE + + + Assume global caching is enabled and cannot be automatically turned off + +.. autoclass:: cuda.bindings.driver.CUstreamUpdateCaptureDependencies_flags + + .. autoattribute:: cuda.bindings.driver.CUstreamUpdateCaptureDependencies_flags.CU_STREAM_ADD_CAPTURE_DEPENDENCIES + + + Add new nodes to the dependency set + + + .. autoattribute:: cuda.bindings.driver.CUstreamUpdateCaptureDependencies_flags.CU_STREAM_SET_CAPTURE_DEPENDENCIES + + + Replace the dependency set with the new nodes + +.. autoclass:: cuda.bindings.driver.CUasyncNotificationType + + .. autoattribute:: cuda.bindings.driver.CUasyncNotificationType.CU_ASYNC_NOTIFICATION_TYPE_OVER_BUDGET + + + Sent when the process has exceeded its device memory budget + +.. autoclass:: cuda.bindings.driver.CUarray_format + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_UNSIGNED_INT8 + + + Unsigned 8-bit integers + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_UNSIGNED_INT16 + + + Unsigned 16-bit integers + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_UNSIGNED_INT32 + + + Unsigned 32-bit integers + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_SIGNED_INT8 + + + Signed 8-bit integers + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_SIGNED_INT16 + + + Signed 16-bit integers + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_SIGNED_INT32 + + + Signed 32-bit integers + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_HALF + + + 16-bit floating point + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_FLOAT + + + 32-bit floating point + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_NV12 + + + 8-bit YUV planar format, with 4:2:0 sampling + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_UNORM_INT8X1 + + + 1 channel unsigned 8-bit normalized integer + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_UNORM_INT8X2 + + + 2 channel unsigned 8-bit normalized integer + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_UNORM_INT8X4 + + + 4 channel unsigned 8-bit normalized integer + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_UNORM_INT16X1 + + + 1 channel unsigned 16-bit normalized integer + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_UNORM_INT16X2 + + + 2 channel unsigned 16-bit normalized integer + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_UNORM_INT16X4 + + + 4 channel unsigned 16-bit normalized integer + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_SNORM_INT8X1 + + + 1 channel signed 8-bit normalized integer + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_SNORM_INT8X2 + + + 2 channel signed 8-bit normalized integer + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_SNORM_INT8X4 + + + 4 channel signed 8-bit normalized integer + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_SNORM_INT16X1 + + + 1 channel signed 16-bit normalized integer + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_SNORM_INT16X2 + + + 2 channel signed 16-bit normalized integer + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_SNORM_INT16X4 + + + 4 channel signed 16-bit normalized integer + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_BC1_UNORM + + + 4 channel unsigned normalized block-compressed (BC1 compression) format + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_BC1_UNORM_SRGB + + + 4 channel unsigned normalized block-compressed (BC1 compression) format with sRGB encoding + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_BC2_UNORM + + + 4 channel unsigned normalized block-compressed (BC2 compression) format + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_BC2_UNORM_SRGB + + + 4 channel unsigned normalized block-compressed (BC2 compression) format with sRGB encoding + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_BC3_UNORM + + + 4 channel unsigned normalized block-compressed (BC3 compression) format + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_BC3_UNORM_SRGB + + + 4 channel unsigned normalized block-compressed (BC3 compression) format with sRGB encoding + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_BC4_UNORM + + + 1 channel unsigned normalized block-compressed (BC4 compression) format + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_BC4_SNORM + + + 1 channel signed normalized block-compressed (BC4 compression) format + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_BC5_UNORM + + + 2 channel unsigned normalized block-compressed (BC5 compression) format + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_BC5_SNORM + + + 2 channel signed normalized block-compressed (BC5 compression) format + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_BC6H_UF16 + + + 3 channel unsigned half-float block-compressed (BC6H compression) format + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_BC6H_SF16 + + + 3 channel signed half-float block-compressed (BC6H compression) format + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_BC7_UNORM + + + 4 channel unsigned normalized block-compressed (BC7 compression) format + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_BC7_UNORM_SRGB + + + 4 channel unsigned normalized block-compressed (BC7 compression) format with sRGB encoding + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_P010 + + + 10-bit YUV planar format, with 4:2:0 sampling + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_P016 + + + 16-bit YUV planar format, with 4:2:0 sampling + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_NV16 + + + 8-bit YUV planar format, with 4:2:2 sampling + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_P210 + + + 10-bit YUV planar format, with 4:2:2 sampling + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_P216 + + + 16-bit YUV planar format, with 4:2:2 sampling + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_YUY2 + + + 2 channel, 8-bit YUV packed planar format, with 4:2:2 sampling + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_Y210 + + + 2 channel, 10-bit YUV packed planar format, with 4:2:2 sampling + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_Y216 + + + 2 channel, 16-bit YUV packed planar format, with 4:2:2 sampling + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_AYUV + + + 4 channel, 8-bit YUV packed planar format, with 4:4:4 sampling + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_Y410 + + + 10-bit YUV packed planar format, with 4:4:4 sampling + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_Y416 + + + 4 channel, 12-bit YUV packed planar format, with 4:4:4 sampling + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_Y444_PLANAR8 + + + 3 channel 8-bit YUV planar format, with 4:4:4 sampling + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_Y444_PLANAR10 + + + 3 channel 10-bit YUV planar format, with 4:4:4 sampling + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_YUV444_8bit_SemiPlanar + + + 3 channel 8-bit YUV semi-planar format, with 4:4:4 sampling + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_YUV444_16bit_SemiPlanar + + + 3 channel 16-bit YUV semi-planar format, with 4:4:4 sampling + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_UNORM_INT_101010_2 + + + 4 channel unorm R10G10B10A2 RGB format + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_UINT8_PACKED_422 + + + 4 channel unsigned 8-bit YUV packed format, with 4:2:2 sampling + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_UINT8_PACKED_444 + + + 4 channel unsigned 8-bit YUV packed format, with 4:4:4 sampling + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_UINT8_SEMIPLANAR_420 + + + 3 channel unsigned 8-bit YUV semi-planar format, with 4:2:0 sampling + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_UINT16_SEMIPLANAR_420 + + + 3 channel unsigned 16-bit YUV semi-planar format, with 4:2:0 sampling + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_UINT8_SEMIPLANAR_422 + + + 3 channel unsigned 8-bit YUV semi-planar format, with 4:2:2 sampling + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_UINT16_SEMIPLANAR_422 + + + 3 channel unsigned 16-bit YUV semi-planar format, with 4:2:2 sampling + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_UINT8_SEMIPLANAR_444 + + + 3 channel unsigned 8-bit YUV semi-planar format, with 4:4:4 sampling + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_UINT16_SEMIPLANAR_444 + + + 3 channel unsigned 16-bit YUV semi-planar format, with 4:4:4 sampling + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_UINT8_PLANAR_420 + + + 3 channel unsigned 8-bit YUV planar format, with 4:2:0 sampling + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_UINT16_PLANAR_420 + + + 3 channel unsigned 16-bit YUV planar format, with 4:2:0 sampling + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_UINT8_PLANAR_422 + + + 3 channel unsigned 8-bit YUV planar format, with 4:2:2 sampling + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_UINT16_PLANAR_422 + + + 3 channel unsigned 16-bit YUV planar format, with 4:2:2 sampling + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_UINT8_PLANAR_444 + + + 3 channel unsigned 8-bit YUV planar format, with 4:4:4 sampling + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_UINT16_PLANAR_444 + + + 3 channel unsigned 16-bit YUV planar format, with 4:4:4 sampling + + + .. autoattribute:: cuda.bindings.driver.CUarray_format.CU_AD_FORMAT_MAX + +.. autoclass:: cuda.bindings.driver.CUaddress_mode + + .. autoattribute:: cuda.bindings.driver.CUaddress_mode.CU_TR_ADDRESS_MODE_WRAP + + + Wrapping address mode + + + .. autoattribute:: cuda.bindings.driver.CUaddress_mode.CU_TR_ADDRESS_MODE_CLAMP + + + Clamp to edge address mode + + + .. autoattribute:: cuda.bindings.driver.CUaddress_mode.CU_TR_ADDRESS_MODE_MIRROR + + + Mirror address mode + + + .. autoattribute:: cuda.bindings.driver.CUaddress_mode.CU_TR_ADDRESS_MODE_BORDER + + + Border address mode + +.. autoclass:: cuda.bindings.driver.CUfilter_mode + + .. autoattribute:: cuda.bindings.driver.CUfilter_mode.CU_TR_FILTER_MODE_POINT + + + Point filter mode + + + .. autoattribute:: cuda.bindings.driver.CUfilter_mode.CU_TR_FILTER_MODE_LINEAR + + + Linear filter mode + +.. autoclass:: cuda.bindings.driver.CUdevice_attribute + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_BLOCK + + + Maximum number of threads per block + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_X + + + Maximum block dimension X + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Y + + + Maximum block dimension Y + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Z + + + Maximum block dimension Z + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_X + + + Maximum grid dimension X + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Y + + + Maximum grid dimension Y + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Z + + + Maximum grid dimension Z + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK + + + Maximum shared memory available per block in bytes + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_SHARED_MEMORY_PER_BLOCK + + + Deprecated, use CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_TOTAL_CONSTANT_MEMORY + + + Memory available on device for constant variables in a CUDA C kernel in bytes + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_WARP_SIZE + + + Warp size in threads + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAX_PITCH + + + Maximum pitch in bytes allowed by memory copies + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_BLOCK + + + Maximum number of 32-bit registers available per block + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_REGISTERS_PER_BLOCK + + + Deprecated, use CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_BLOCK + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_CLOCK_RATE + + + Typical clock frequency in kilohertz + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_TEXTURE_ALIGNMENT + + + Alignment requirement for textures + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_GPU_OVERLAP + + + Device can possibly copy memory and execute a kernel concurrently. Deprecated. Use instead CU_DEVICE_ATTRIBUTE_ASYNC_ENGINE_COUNT. + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT + + + Number of multiprocessors on device + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_KERNEL_EXEC_TIMEOUT + + + Specifies whether there is a run time limit on kernels + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_INTEGRATED + + + Device is integrated with host memory + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_CAN_MAP_HOST_MEMORY + + + Device can map host memory into CUDA address space + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_COMPUTE_MODE + + + Compute mode (See :py:obj:`~.CUcomputemode` for details) + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_WIDTH + + + Maximum 1D texture width + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_WIDTH + + + Maximum 2D texture width + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_HEIGHT + + + Maximum 2D texture height + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_WIDTH + + + Maximum 3D texture width + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_HEIGHT + + + Maximum 3D texture height + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_DEPTH + + + Maximum 3D texture depth + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_WIDTH + + + Maximum 2D layered texture width + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_HEIGHT + + + Maximum 2D layered texture height + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_LAYERS + + + Maximum layers in a 2D layered texture + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_WIDTH + + + Deprecated, use CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_WIDTH + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_HEIGHT + + + Deprecated, use CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_HEIGHT + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_NUMSLICES + + + Deprecated, use CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_LAYERS + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_SURFACE_ALIGNMENT + + + Alignment requirement for surfaces + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_CONCURRENT_KERNELS + + + Device can possibly execute multiple kernels concurrently + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_ECC_ENABLED + + + Device has ECC support enabled + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_PCI_BUS_ID + + + PCI bus ID of the device + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_PCI_DEVICE_ID + + + PCI device ID of the device + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_TCC_DRIVER + + + Device is using TCC driver model + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MEMORY_CLOCK_RATE + + + Peak memory clock frequency in kilohertz + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_GLOBAL_MEMORY_BUS_WIDTH + + + Global memory bus width in bits + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_L2_CACHE_SIZE + + + Size of L2 cache in bytes + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_MULTIPROCESSOR + + + Maximum resident threads per multiprocessor + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_ASYNC_ENGINE_COUNT + + + Number of asynchronous engines + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_UNIFIED_ADDRESSING + + + Device shares a unified address space with the host + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LAYERED_WIDTH + + + Maximum 1D layered texture width + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LAYERED_LAYERS + + + Maximum layers in a 1D layered texture + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_CAN_TEX2D_GATHER + + + Deprecated, do not use. + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_GATHER_WIDTH + + + Maximum 2D texture width if CUDA_ARRAY3D_TEXTURE_GATHER is set + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_GATHER_HEIGHT + + + Maximum 2D texture height if CUDA_ARRAY3D_TEXTURE_GATHER is set + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_WIDTH_ALTERNATE + + + Alternate maximum 3D texture width + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_HEIGHT_ALTERNATE + + + Alternate maximum 3D texture height + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_DEPTH_ALTERNATE + + + Alternate maximum 3D texture depth + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_PCI_DOMAIN_ID + + + PCI domain ID of the device + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_TEXTURE_PITCH_ALIGNMENT + + + Pitch alignment requirement for textures + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_WIDTH + + + Maximum cubemap texture width/height + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_LAYERED_WIDTH + + + Maximum cubemap layered texture width/height + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_LAYERED_LAYERS + + + Maximum layers in a cubemap layered texture + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_WIDTH + + + Maximum 1D surface width + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_WIDTH + + + Maximum 2D surface width + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_HEIGHT + + + Maximum 2D surface height + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_WIDTH + + + Maximum 3D surface width + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_HEIGHT + + + Maximum 3D surface height + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_DEPTH + + + Maximum 3D surface depth + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_LAYERED_WIDTH + + + Maximum 1D layered surface width + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_LAYERED_LAYERS + + + Maximum layers in a 1D layered surface + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_WIDTH + + + Maximum 2D layered surface width + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_HEIGHT + + + Maximum 2D layered surface height + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_LAYERS + + + Maximum layers in a 2D layered surface + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_WIDTH + + + Maximum cubemap surface width + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_LAYERED_WIDTH + + + Maximum cubemap layered surface width + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_LAYERED_LAYERS + + + Maximum layers in a cubemap layered surface + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LINEAR_WIDTH + + + Deprecated, do not use. Use cudaDeviceGetTexture1DLinearMaxWidth() or :py:obj:`~.cuDeviceGetTexture1DLinearMaxWidth()` instead. + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_WIDTH + + + Maximum 2D linear texture width + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_HEIGHT + + + Maximum 2D linear texture height + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_PITCH + + + Maximum 2D linear texture pitch in bytes + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_MIPMAPPED_WIDTH + + + Maximum mipmapped 2D texture width + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_MIPMAPPED_HEIGHT + + + Maximum mipmapped 2D texture height + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR + + + Major compute capability version number + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR + + + Minor compute capability version number + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_MIPMAPPED_WIDTH + + + Maximum mipmapped 1D texture width + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_STREAM_PRIORITIES_SUPPORTED + + + Device supports stream priorities + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_GLOBAL_L1_CACHE_SUPPORTED + + + Device supports caching globals in L1 + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_LOCAL_L1_CACHE_SUPPORTED + + + Device supports caching locals in L1 + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_MULTIPROCESSOR + + + Maximum shared memory available per multiprocessor in bytes + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_MULTIPROCESSOR + + + Maximum number of 32-bit registers available per multiprocessor + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MANAGED_MEMORY + + + Device can allocate managed memory on this system + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MULTI_GPU_BOARD + + + Device is on a multi-GPU board + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MULTI_GPU_BOARD_GROUP_ID + + + Unique id for a group of devices on the same multi-GPU board + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_HOST_NATIVE_ATOMIC_SUPPORTED + + + Link between the device and the host supports all native atomic operations + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_SINGLE_TO_DOUBLE_PRECISION_PERF_RATIO + + + Ratio of single precision performance (in floating-point operations per second) to double precision performance + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS + + + Device supports coherently accessing pageable memory without calling cudaHostRegister on it + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS + + + Device can coherently access managed memory concurrently with the CPU + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_COMPUTE_PREEMPTION_SUPPORTED + + + Device supports compute preemption. + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_CAN_USE_HOST_POINTER_FOR_REGISTERED_MEM + + + Device can access host registered memory at the same virtual address as the CPU + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_CAN_USE_STREAM_MEM_OPS_V1 + + + Deprecated, along with v1 MemOps API, :py:obj:`~.cuStreamBatchMemOp` and related APIs are supported. + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_CAN_USE_64_BIT_STREAM_MEM_OPS_V1 + + + Deprecated, along with v1 MemOps API, 64-bit operations are supported in :py:obj:`~.cuStreamBatchMemOp` and related APIs. + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_CAN_USE_STREAM_WAIT_VALUE_NOR_V1 + + + Deprecated, along with v1 MemOps API, :py:obj:`~.CU_STREAM_WAIT_VALUE_NOR` is supported. + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_COOPERATIVE_LAUNCH + + + Device supports launching cooperative kernels via :py:obj:`~.cuLaunchCooperativeKernel` + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_COOPERATIVE_MULTI_DEVICE_LAUNCH + + + Deprecated, :py:obj:`~.cuLaunchCooperativeKernelMultiDevice` is deprecated. + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK_OPTIN + + + Maximum optin shared memory per block. That is shared memory that is available for dynamic allocation or static allocation (including architecture specific static shared memory) on this device but is not guaranteed to be portable. + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_CAN_FLUSH_REMOTE_WRITES + + + The :py:obj:`~.CU_STREAM_WAIT_VALUE_FLUSH` flag and the :py:obj:`~.CU_STREAM_MEM_OP_FLUSH_REMOTE_WRITES` MemOp are supported on the device. See :py:obj:`~.Stream Memory Operations` for additional details. + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_HOST_REGISTER_SUPPORTED + + + Device supports host memory registration via :py:obj:`~.cudaHostRegister`. + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS_USES_HOST_PAGE_TABLES + + + Device accesses pageable memory via the host's page tables. + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_DIRECT_MANAGED_MEM_ACCESS_FROM_HOST + + + The host can directly access managed memory on the device without migration. + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_VIRTUAL_ADDRESS_MANAGEMENT_SUPPORTED + + + Deprecated, Use CU_DEVICE_ATTRIBUTE_VIRTUAL_MEMORY_MANAGEMENT_SUPPORTED + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_VIRTUAL_MEMORY_MANAGEMENT_SUPPORTED + + + Device supports virtual memory management APIs like :py:obj:`~.cuMemAddressReserve`, :py:obj:`~.cuMemCreate`, :py:obj:`~.cuMemMap` and related APIs + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_POSIX_FILE_DESCRIPTOR_SUPPORTED + + + Device supports exporting memory to a posix file descriptor with :py:obj:`~.cuMemExportToShareableHandle`, if requested via :py:obj:`~.cuMemCreate` + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_WIN32_HANDLE_SUPPORTED + + + Device supports exporting memory to a Win32 NT handle with :py:obj:`~.cuMemExportToShareableHandle`, if requested via :py:obj:`~.cuMemCreate` + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_WIN32_KMT_HANDLE_SUPPORTED + + + Device supports exporting memory to a Win32 KMT handle with :py:obj:`~.cuMemExportToShareableHandle`, if requested via :py:obj:`~.cuMemCreate` + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAX_BLOCKS_PER_MULTIPROCESSOR + + + Maximum number of blocks per multiprocessor + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_GENERIC_COMPRESSION_SUPPORTED + + + Device supports compression of memory + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAX_PERSISTING_L2_CACHE_SIZE + + + Maximum L2 persisting lines capacity setting in bytes. + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAX_ACCESS_POLICY_WINDOW_SIZE + + + Maximum value of :py:obj:`~.CUaccessPolicyWindow.num_bytes`. + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_WITH_CUDA_VMM_SUPPORTED + + + Device supports specifying the GPUDirect RDMA flag with :py:obj:`~.cuMemCreate` + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_RESERVED_SHARED_MEMORY_PER_BLOCK + + + Shared memory reserved by CUDA driver per block in bytes + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_SPARSE_CUDA_ARRAY_SUPPORTED + + + Device supports sparse CUDA arrays and sparse CUDA mipmapped arrays + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_READ_ONLY_HOST_REGISTER_SUPPORTED + + + Device supports using the :py:obj:`~.cuMemHostRegister` flag :py:obj:`~.CU_MEMHOSTERGISTER_READ_ONLY` to register memory that must be mapped as read-only to the GPU + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_TIMELINE_SEMAPHORE_INTEROP_SUPPORTED + + + External timeline semaphore interop is supported on the device + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MEMORY_POOLS_SUPPORTED + + + Device supports using the :py:obj:`~.cuMemAllocAsync` and :py:obj:`~.cuMemPool` family of APIs + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_SUPPORTED + + + Device supports GPUDirect RDMA APIs, like nvidia_p2p_get_pages (see https://docs.nvidia.com/cuda/gpudirect-rdma for more information) + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_FLUSH_WRITES_OPTIONS + + + The returned attribute shall be interpreted as a bitmask, where the individual bits are described by the :py:obj:`~.CUflushGPUDirectRDMAWritesOptions` enum + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_WRITES_ORDERING + + + GPUDirect RDMA writes to the device do not need to be flushed for consumers within the scope indicated by the returned attribute. See :py:obj:`~.CUGPUDirectRDMAWritesOrdering` for the numerical values returned here. + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MEMPOOL_SUPPORTED_HANDLE_TYPES + + + Handle types supported with mempool based IPC + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_CLUSTER_LAUNCH + + + Indicates device supports cluster launch + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_DEFERRED_MAPPING_CUDA_ARRAY_SUPPORTED + + + Device supports deferred mapping CUDA arrays and CUDA mipmapped arrays + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_CAN_USE_64_BIT_STREAM_MEM_OPS + + + 64-bit operations are supported in :py:obj:`~.cuStreamBatchMemOp` and related MemOp APIs. + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_CAN_USE_STREAM_WAIT_VALUE_NOR + + + :py:obj:`~.CU_STREAM_WAIT_VALUE_NOR` is supported by MemOp APIs. + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_DMA_BUF_SUPPORTED + + + Device supports buffer sharing with dma_buf mechanism. + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_IPC_EVENT_SUPPORTED + + + Device supports IPC Events. + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MEM_SYNC_DOMAIN_COUNT + + + Number of memory domains the device supports. + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_TENSOR_MAP_ACCESS_SUPPORTED + + + Device supports accessing memory using Tensor Map. + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_FABRIC_SUPPORTED + + + Device supports exporting memory to a fabric handle with :py:obj:`~.cuMemExportToShareableHandle()` or requested with :py:obj:`~.cuMemCreate()` + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_UNIFIED_FUNCTION_POINTERS + + + Device supports unified function pointers. + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_NUMA_CONFIG + + + NUMA configuration of a device: value is of type :py:obj:`~.CUdeviceNumaConfig` enum + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_NUMA_ID + + + NUMA node ID of the GPU memory + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MULTICAST_SUPPORTED + + + Device supports switch multicast and reduction operations. + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MPS_ENABLED + + + Indicates if contexts created on this device will be shared via MPS + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_HOST_NUMA_ID + + + NUMA ID of the host node closest to the device. Returns -1 when system does not support NUMA. + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_D3D12_CIG_SUPPORTED + + + Device supports CIG with D3D12. + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MEM_DECOMPRESS_ALGORITHM_MASK + + + The returned valued shall be interpreted as a bitmask, where the individual bits are described by the :py:obj:`~.CUmemDecompressAlgorithm` enum. + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MEM_DECOMPRESS_MAXIMUM_LENGTH + + + The returned valued is the maximum length in bytes of a single decompress operation that is allowed. + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_VULKAN_CIG_SUPPORTED + + + Device supports CIG with Vulkan. + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_GPU_PCI_DEVICE_ID + + + The combined 16-bit PCI device ID and 16-bit PCI vendor ID. + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_GPU_PCI_SUBSYSTEM_ID + + + The combined 16-bit PCI subsystem ID and 16-bit PCI subsystem vendor ID. + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_HOST_NUMA_VIRTUAL_MEMORY_MANAGEMENT_SUPPORTED + + + Device supports HOST_NUMA location with the virtual memory management APIs like :py:obj:`~.cuMemCreate`, :py:obj:`~.cuMemMap` and related APIs + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_HOST_NUMA_MEMORY_POOLS_SUPPORTED + + + Device supports HOST_NUMA location with the :py:obj:`~.cuMemAllocAsync` and :py:obj:`~.cuMemPool` family of APIs + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_HOST_NUMA_MULTINODE_IPC_SUPPORTED + + + Device supports HOST_NUMA location IPC between nodes in a multi-node system. + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_HOST_MEMORY_POOLS_SUPPORTED + + + Device suports HOST location with the :py:obj:`~.cuMemAllocAsync` and :py:obj:`~.cuMemPool` family of APIs + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_HOST_VIRTUAL_MEMORY_MANAGEMENT_SUPPORTED + + + Device supports HOST location with the virtual memory management APIs like :py:obj:`~.cuMemCreate`, :py:obj:`~.cuMemMap` and related APIs + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_HOST_ALLOC_DMA_BUF_SUPPORTED + + + Device supports page-locked host memory buffer sharing with dma_buf mechanism. + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_ONLY_PARTIAL_HOST_NATIVE_ATOMIC_SUPPORTED + + + Link between the device and the host supports only some native atomic operations + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_ATOMIC_REDUCTION_SUPPORTED + + + Device supports atomic reduction operations in stream batch memory operations + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_D3D12_CIG_STREAMS_SUPPORTED + + + Device supports CIG streams with D3D12 + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_DMA_BUF_MMAP_SUPPORTED + + + Device supports mmap() of dmabuf file descriptors for CUDA device memory allocations + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_LOGICAL_ENDPOINT_UNICAST_SUPPORTED + + + Device supports unicast logical endpoints + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_LOGICAL_ENDPOINT_MULTICAST_SUPPORTED + + + Device supports multicast logical endpoints + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_LOGICAL_ENDPOINT_COUNTED_OPS_SUPPORTED + + + Device supports counted operations via logical endpoints + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_LOGICAL_ENDPOINT_UNICAST_ACCESS_ON_OWNER_DEVICE_SUPPORTED + + + Device supports unicast logical endpoint access on the owner device + + + .. autoattribute:: cuda.bindings.driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAX + +.. autoclass:: cuda.bindings.driver.CUpointer_attribute + + .. autoattribute:: cuda.bindings.driver.CUpointer_attribute.CU_POINTER_ATTRIBUTE_CONTEXT + + + The :py:obj:`~.CUcontext` on which a pointer was allocated or registered + + + .. autoattribute:: cuda.bindings.driver.CUpointer_attribute.CU_POINTER_ATTRIBUTE_MEMORY_TYPE + + + The :py:obj:`~.CUmemorytype` describing the physical location of a pointer + + + .. autoattribute:: cuda.bindings.driver.CUpointer_attribute.CU_POINTER_ATTRIBUTE_DEVICE_POINTER + + + The address at which a pointer's memory may be accessed on the device + + + .. autoattribute:: cuda.bindings.driver.CUpointer_attribute.CU_POINTER_ATTRIBUTE_HOST_POINTER + + + The address at which a pointer's memory may be accessed on the host + + + .. autoattribute:: cuda.bindings.driver.CUpointer_attribute.CU_POINTER_ATTRIBUTE_P2P_TOKENS + + + A pair of tokens for use with the nv-p2p.h Linux kernel interface + + + .. autoattribute:: cuda.bindings.driver.CUpointer_attribute.CU_POINTER_ATTRIBUTE_SYNC_MEMOPS + + + Synchronize every synchronous memory operation initiated on this region + + + .. autoattribute:: cuda.bindings.driver.CUpointer_attribute.CU_POINTER_ATTRIBUTE_BUFFER_ID + + + A process-wide unique ID for an allocated memory region + + + .. autoattribute:: cuda.bindings.driver.CUpointer_attribute.CU_POINTER_ATTRIBUTE_IS_MANAGED + + + Indicates if the pointer points to managed memory + + + .. autoattribute:: cuda.bindings.driver.CUpointer_attribute.CU_POINTER_ATTRIBUTE_DEVICE_ORDINAL + + + A device ordinal of a device on which a pointer was allocated or registered + + + .. autoattribute:: cuda.bindings.driver.CUpointer_attribute.CU_POINTER_ATTRIBUTE_IS_LEGACY_CUDA_IPC_CAPABLE + + + 1 if this pointer maps to an allocation that is suitable for :py:obj:`~.cudaIpcGetMemHandle`, 0 otherwise + + + .. autoattribute:: cuda.bindings.driver.CUpointer_attribute.CU_POINTER_ATTRIBUTE_RANGE_START_ADDR + + + Starting address for this requested pointer + + + .. autoattribute:: cuda.bindings.driver.CUpointer_attribute.CU_POINTER_ATTRIBUTE_RANGE_SIZE + + + Size of the address range for this requested pointer + + + .. autoattribute:: cuda.bindings.driver.CUpointer_attribute.CU_POINTER_ATTRIBUTE_MAPPED + + + 1 if this pointer is in a valid address range that is mapped to a backing allocation, 0 otherwise + + + .. autoattribute:: cuda.bindings.driver.CUpointer_attribute.CU_POINTER_ATTRIBUTE_ALLOWED_HANDLE_TYPES + + + Bitmask of allowed :py:obj:`~.CUmemAllocationHandleType` for this allocation + + + .. autoattribute:: cuda.bindings.driver.CUpointer_attribute.CU_POINTER_ATTRIBUTE_IS_GPU_DIRECT_RDMA_CAPABLE + + + 1 if the memory this pointer is referencing can be used with the GPUDirect RDMA API + + + .. autoattribute:: cuda.bindings.driver.CUpointer_attribute.CU_POINTER_ATTRIBUTE_ACCESS_FLAGS + + + Returns the access flags the device associated with the current context has on the corresponding memory referenced by the pointer given + + + .. autoattribute:: cuda.bindings.driver.CUpointer_attribute.CU_POINTER_ATTRIBUTE_MEMPOOL_HANDLE + + + Returns the mempool handle for the allocation if it was allocated from a mempool. Otherwise returns NULL. + + + .. autoattribute:: cuda.bindings.driver.CUpointer_attribute.CU_POINTER_ATTRIBUTE_MAPPING_SIZE + + + Size of the actual underlying mapping that the pointer belongs to + + + .. autoattribute:: cuda.bindings.driver.CUpointer_attribute.CU_POINTER_ATTRIBUTE_MAPPING_BASE_ADDR + + + The start address of the mapping that the pointer belongs to + + + .. autoattribute:: cuda.bindings.driver.CUpointer_attribute.CU_POINTER_ATTRIBUTE_MEMORY_BLOCK_ID + + + A process-wide unique id corresponding to the physical allocation the pointer belongs to + + + .. autoattribute:: cuda.bindings.driver.CUpointer_attribute.CU_POINTER_ATTRIBUTE_IS_HW_DECOMPRESS_CAPABLE + + + Returns in ``*data`` a boolean that indicates whether the pointer points to memory that is capable to be used for hardware accelerated decompression. + +.. autoclass:: cuda.bindings.driver.CUfunction_attribute + + .. autoattribute:: cuda.bindings.driver.CUfunction_attribute.CU_FUNC_ATTRIBUTE_MAX_THREADS_PER_BLOCK + + + The maximum number of threads per block, beyond which a launch of the function would fail. This number depends on both the function and the device on which the function is currently loaded. + + + .. autoattribute:: cuda.bindings.driver.CUfunction_attribute.CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES + + + The size in bytes of statically-allocated shared memory required by this function. This does not include dynamically-allocated shared memory requested by the user at runtime. + + + .. autoattribute:: cuda.bindings.driver.CUfunction_attribute.CU_FUNC_ATTRIBUTE_CONST_SIZE_BYTES + + + The size in bytes of user-allocated constant memory required by this function. + + + .. autoattribute:: cuda.bindings.driver.CUfunction_attribute.CU_FUNC_ATTRIBUTE_LOCAL_SIZE_BYTES + + + The size in bytes of local memory used by each thread of this function. + + + .. autoattribute:: cuda.bindings.driver.CUfunction_attribute.CU_FUNC_ATTRIBUTE_NUM_REGS + + + The number of registers used by each thread of this function. + + + .. autoattribute:: cuda.bindings.driver.CUfunction_attribute.CU_FUNC_ATTRIBUTE_PTX_VERSION + + + The PTX virtual architecture version for which the function was compiled. This value is the major PTX version \* 10 + the minor PTX version, so a PTX version 1.3 function would return the value 13. Note that this may return the undefined value of 0 for cubins compiled prior to CUDA 3.0. + + + .. autoattribute:: cuda.bindings.driver.CUfunction_attribute.CU_FUNC_ATTRIBUTE_BINARY_VERSION + + + The binary architecture version for which the function was compiled. This value is the major binary version \* 10 + the minor binary version, so a binary version 1.3 function would return the value 13. Note that this will return a value of 10 for legacy cubins that do not have a properly-encoded binary architecture version. + + + .. autoattribute:: cuda.bindings.driver.CUfunction_attribute.CU_FUNC_ATTRIBUTE_CACHE_MODE_CA + + + The attribute to indicate whether the function has been compiled with user specified option "-Xptxas --dlcm=ca" set . + + + .. autoattribute:: cuda.bindings.driver.CUfunction_attribute.CU_FUNC_ATTRIBUTE_MAX_DYNAMIC_SHARED_SIZE_BYTES + + + The maximum size in bytes of dynamically-allocated shared memory that can be used by this function. If the user-specified dynamic shared memory size is larger than this value, the launch will fail. The default value of this attribute is :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK` - :py:obj:`~.CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES`, except when :py:obj:`~.CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES` is greater than :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK`, then the default value of this attribute is 0. The value can be increased to :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK_OPTIN` - :py:obj:`~.CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES`. See :py:obj:`~.cuFuncSetAttribute`, :py:obj:`~.cuKernelSetAttribute` + + + .. autoattribute:: cuda.bindings.driver.CUfunction_attribute.CU_FUNC_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT + + + On devices where the L1 cache and shared memory use the same hardware resources, this sets the shared memory carveout preference, in percent of the total shared memory. Refer to :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_MULTIPROCESSOR`. This is only a hint, and the driver can choose a different ratio if required to execute the function. See :py:obj:`~.cuFuncSetAttribute`, :py:obj:`~.cuKernelSetAttribute` + + + .. autoattribute:: cuda.bindings.driver.CUfunction_attribute.CU_FUNC_ATTRIBUTE_CLUSTER_SIZE_MUST_BE_SET + + + If this attribute is set, the kernel must launch with a valid cluster size specified. See :py:obj:`~.cuFuncSetAttribute`, :py:obj:`~.cuKernelSetAttribute` + + + .. autoattribute:: cuda.bindings.driver.CUfunction_attribute.CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_WIDTH + + + The required cluster width in blocks. The values must either all be 0 or all be positive. The validity of the cluster dimensions is otherwise checked at launch time. + + + + If the value is set during compile time, it cannot be set at runtime. Setting it at runtime will return CUDA_ERROR_NOT_PERMITTED. See :py:obj:`~.cuFuncSetAttribute`, :py:obj:`~.cuKernelSetAttribute` + + + .. autoattribute:: cuda.bindings.driver.CUfunction_attribute.CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_HEIGHT + + + The required cluster height in blocks. The values must either all be 0 or all be positive. The validity of the cluster dimensions is otherwise checked at launch time. + + + + If the value is set during compile time, it cannot be set at runtime. Setting it at runtime should return CUDA_ERROR_NOT_PERMITTED. See :py:obj:`~.cuFuncSetAttribute`, :py:obj:`~.cuKernelSetAttribute` + + + .. autoattribute:: cuda.bindings.driver.CUfunction_attribute.CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_DEPTH + + + The required cluster depth in blocks. The values must either all be 0 or all be positive. The validity of the cluster dimensions is otherwise checked at launch time. + + + + If the value is set during compile time, it cannot be set at runtime. Setting it at runtime should return CUDA_ERROR_NOT_PERMITTED. See :py:obj:`~.cuFuncSetAttribute`, :py:obj:`~.cuKernelSetAttribute` + + + .. autoattribute:: cuda.bindings.driver.CUfunction_attribute.CU_FUNC_ATTRIBUTE_NON_PORTABLE_CLUSTER_SIZE_ALLOWED + + + Whether the function can be launched with non-portable cluster size. 1 is allowed, 0 is disallowed. A non-portable cluster size may only function on the specific SKUs the program is tested on. The launch might fail if the program is run on a different hardware platform. + + + + CUDA API provides cudaOccupancyMaxActiveClusters to assist with checking whether the desired size can be launched on the current device. + + + + Portable Cluster Size + + + + A portable cluster size is guaranteed to be functional on all compute capabilities higher than the target compute capability. The portable cluster size for sm_90 is 8 blocks per cluster. This value may increase for future compute capabilities. + + + + The specific hardware unit may support higher cluster sizes that’s not guaranteed to be portable. See :py:obj:`~.cuFuncSetAttribute`, :py:obj:`~.cuKernelSetAttribute` + + + .. autoattribute:: cuda.bindings.driver.CUfunction_attribute.CU_FUNC_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE + + + The block scheduling policy of a function. The value type is :py:obj:`~.CUclusterSchedulingPolicy` / cudaClusterSchedulingPolicy. See :py:obj:`~.cuFuncSetAttribute`, :py:obj:`~.cuKernelSetAttribute` + + + .. autoattribute:: cuda.bindings.driver.CUfunction_attribute.CU_FUNC_ATTRIBUTE_DEVICE_NODE_UPDATE_SUPPORTED + + + Whether the function can be updated on device. 1 means device node update is supported, 0 is unsupported. See :py:obj:`~.cuFuncGetAttribute`. + + + .. autoattribute:: cuda.bindings.driver.CUfunction_attribute.CU_FUNC_ATTRIBUTE_MAX + +.. autoclass:: cuda.bindings.driver.CUfunc_cache + + .. autoattribute:: cuda.bindings.driver.CUfunc_cache.CU_FUNC_CACHE_PREFER_NONE + + + no preference for shared memory or L1 (default) + + + .. autoattribute:: cuda.bindings.driver.CUfunc_cache.CU_FUNC_CACHE_PREFER_SHARED + + + prefer larger shared memory and smaller L1 cache + + + .. autoattribute:: cuda.bindings.driver.CUfunc_cache.CU_FUNC_CACHE_PREFER_L1 + + + prefer larger L1 cache and smaller shared memory + + + .. autoattribute:: cuda.bindings.driver.CUfunc_cache.CU_FUNC_CACHE_PREFER_EQUAL + + + prefer equal sized L1 cache and shared memory + +.. autoclass:: cuda.bindings.driver.CUsharedconfig + + .. autoattribute:: cuda.bindings.driver.CUsharedconfig.CU_SHARED_MEM_CONFIG_DEFAULT_BANK_SIZE + + + set default shared memory bank size + + + .. autoattribute:: cuda.bindings.driver.CUsharedconfig.CU_SHARED_MEM_CONFIG_FOUR_BYTE_BANK_SIZE + + + set shared memory bank width to four bytes + + + .. autoattribute:: cuda.bindings.driver.CUsharedconfig.CU_SHARED_MEM_CONFIG_EIGHT_BYTE_BANK_SIZE + + + set shared memory bank width to eight bytes + +.. autoclass:: cuda.bindings.driver.CUshared_carveout + + .. autoattribute:: cuda.bindings.driver.CUshared_carveout.CU_SHAREDMEM_CARVEOUT_DEFAULT + + + No preference for shared memory or L1 (default) + + + .. autoattribute:: cuda.bindings.driver.CUshared_carveout.CU_SHAREDMEM_CARVEOUT_MAX_SHARED + + + Prefer maximum available shared memory, minimum L1 cache + + + .. autoattribute:: cuda.bindings.driver.CUshared_carveout.CU_SHAREDMEM_CARVEOUT_MAX_L1 + + + Prefer maximum available L1 cache, minimum shared memory + +.. autoclass:: cuda.bindings.driver.CUmemorytype + + .. autoattribute:: cuda.bindings.driver.CUmemorytype.CU_MEMORYTYPE_HOST + + + Host memory + + + .. autoattribute:: cuda.bindings.driver.CUmemorytype.CU_MEMORYTYPE_DEVICE + + + Device memory + + + .. autoattribute:: cuda.bindings.driver.CUmemorytype.CU_MEMORYTYPE_ARRAY + + + Array memory + + + .. autoattribute:: cuda.bindings.driver.CUmemorytype.CU_MEMORYTYPE_UNIFIED + + + Unified device or host memory + +.. autoclass:: cuda.bindings.driver.CUcomputemode + + .. autoattribute:: cuda.bindings.driver.CUcomputemode.CU_COMPUTEMODE_DEFAULT + + + Default compute mode (Multiple contexts allowed per device) + + + .. autoattribute:: cuda.bindings.driver.CUcomputemode.CU_COMPUTEMODE_PROHIBITED + + + Compute-prohibited mode (No contexts can be created on this device at this time) + + + .. autoattribute:: cuda.bindings.driver.CUcomputemode.CU_COMPUTEMODE_EXCLUSIVE_PROCESS + + + Compute-exclusive-process mode (Only one context used by a single process can be present on this device at a time) + +.. autoclass:: cuda.bindings.driver.CUmem_advise + + .. autoattribute:: cuda.bindings.driver.CUmem_advise.CU_MEM_ADVISE_SET_READ_MOSTLY + + + Data will mostly be read and only occasionally be written to + + + .. autoattribute:: cuda.bindings.driver.CUmem_advise.CU_MEM_ADVISE_UNSET_READ_MOSTLY + + + Undo the effect of :py:obj:`~.CU_MEM_ADVISE_SET_READ_MOSTLY` + + + .. autoattribute:: cuda.bindings.driver.CUmem_advise.CU_MEM_ADVISE_SET_PREFERRED_LOCATION + + + Set the preferred location for the data as the specified device + + + .. autoattribute:: cuda.bindings.driver.CUmem_advise.CU_MEM_ADVISE_UNSET_PREFERRED_LOCATION + + + Clear the preferred location for the data + + + .. autoattribute:: cuda.bindings.driver.CUmem_advise.CU_MEM_ADVISE_SET_ACCESSED_BY + + + Data will be accessed by the specified device, so prevent page faults as much as possible + + + .. autoattribute:: cuda.bindings.driver.CUmem_advise.CU_MEM_ADVISE_UNSET_ACCESSED_BY + + + Let the Unified Memory subsystem decide on the page faulting policy for the specified device + +.. autoclass:: cuda.bindings.driver.CUmem_range_attribute + + .. autoattribute:: cuda.bindings.driver.CUmem_range_attribute.CU_MEM_RANGE_ATTRIBUTE_READ_MOSTLY + + + Whether the range will mostly be read and only occasionally be written to + + + .. autoattribute:: cuda.bindings.driver.CUmem_range_attribute.CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION + + + The preferred location of the range + + + .. autoattribute:: cuda.bindings.driver.CUmem_range_attribute.CU_MEM_RANGE_ATTRIBUTE_ACCESSED_BY + + + Memory range has :py:obj:`~.CU_MEM_ADVISE_SET_ACCESSED_BY` set for specified device + + + .. autoattribute:: cuda.bindings.driver.CUmem_range_attribute.CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION + + + The last location to which the range was prefetched + + + .. autoattribute:: cuda.bindings.driver.CUmem_range_attribute.CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION_TYPE + + + The preferred location type of the range + + + .. autoattribute:: cuda.bindings.driver.CUmem_range_attribute.CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION_ID + + + The preferred location id of the range + + + .. autoattribute:: cuda.bindings.driver.CUmem_range_attribute.CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION_TYPE + + + The last location type to which the range was prefetched + + + .. autoattribute:: cuda.bindings.driver.CUmem_range_attribute.CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION_ID + + + The last location id to which the range was prefetched + +.. autoclass:: cuda.bindings.driver.CUjit_option + + .. autoattribute:: cuda.bindings.driver.CUjit_option.CU_JIT_MAX_REGISTERS + + + Max number of registers that a thread may use. + + Option type: unsigned int + + Applies to: compiler only + + + .. autoattribute:: cuda.bindings.driver.CUjit_option.CU_JIT_THREADS_PER_BLOCK + + + IN: Specifies minimum number of threads per block to target compilation for + + OUT: Returns the number of threads the compiler actually targeted. This restricts the resource utilization of the compiler (e.g. max registers) such that a block with the given number of threads should be able to launch based on register limitations. Note, this option does not currently take into account any other resource limitations, such as shared memory utilization. + + Cannot be combined with :py:obj:`~.CU_JIT_TARGET`. + + Option type: unsigned int + + Applies to: compiler only + + + .. autoattribute:: cuda.bindings.driver.CUjit_option.CU_JIT_WALL_TIME + + + Overwrites the option value with the total wall clock time, in milliseconds, spent in the compiler and linker + + Option type: float + + Applies to: compiler and linker + + + .. autoattribute:: cuda.bindings.driver.CUjit_option.CU_JIT_INFO_LOG_BUFFER + + + Pointer to a buffer in which to print any log messages that are informational in nature (the buffer size is specified via option :py:obj:`~.CU_JIT_INFO_LOG_BUFFER_SIZE_BYTES`) + + Option type: char \* + + Applies to: compiler and linker + + + .. autoattribute:: cuda.bindings.driver.CUjit_option.CU_JIT_INFO_LOG_BUFFER_SIZE_BYTES + + + IN: Log buffer size in bytes. Log messages will be capped at this size (including null terminator) + + OUT: Amount of log buffer filled with messages + + Option type: unsigned int + + Applies to: compiler and linker + + + .. autoattribute:: cuda.bindings.driver.CUjit_option.CU_JIT_ERROR_LOG_BUFFER + + + Pointer to a buffer in which to print any log messages that reflect errors (the buffer size is specified via option :py:obj:`~.CU_JIT_ERROR_LOG_BUFFER_SIZE_BYTES`) + + Option type: char \* + + Applies to: compiler and linker + + + .. autoattribute:: cuda.bindings.driver.CUjit_option.CU_JIT_ERROR_LOG_BUFFER_SIZE_BYTES + + + IN: Log buffer size in bytes. Log messages will be capped at this size (including null terminator) + + OUT: Amount of log buffer filled with messages + + Option type: unsigned int + + Applies to: compiler and linker + + + .. autoattribute:: cuda.bindings.driver.CUjit_option.CU_JIT_OPTIMIZATION_LEVEL + + + Level of optimizations to apply to generated code (0 - 4), with 4 being the default and highest level of optimizations. + + Option type: unsigned int + + Applies to: compiler only + + + .. autoattribute:: cuda.bindings.driver.CUjit_option.CU_JIT_TARGET_FROM_CUCONTEXT + + + No option value required. Determines the target based on the current attached context (default) + + Option type: No option value needed + + Applies to: compiler and linker + + + .. autoattribute:: cuda.bindings.driver.CUjit_option.CU_JIT_TARGET + + + Target is chosen based on supplied :py:obj:`~.CUjit_target`. Cannot be combined with :py:obj:`~.CU_JIT_THREADS_PER_BLOCK`. + + Option type: unsigned int for enumerated type :py:obj:`~.CUjit_target` + + Applies to: compiler and linker + + + .. autoattribute:: cuda.bindings.driver.CUjit_option.CU_JIT_FALLBACK_STRATEGY + + + Specifies choice of fallback strategy if matching cubin is not found. Choice is based on supplied :py:obj:`~.CUjit_fallback`. This option cannot be used with cuLink\* APIs as the linker requires exact matches. + + Option type: unsigned int for enumerated type :py:obj:`~.CUjit_fallback` + + Applies to: compiler only + + + .. autoattribute:: cuda.bindings.driver.CUjit_option.CU_JIT_GENERATE_DEBUG_INFO + + + Specifies whether to create debug information in output (-g) (0: false, default) + + Option type: int + + Applies to: compiler and linker + + + .. autoattribute:: cuda.bindings.driver.CUjit_option.CU_JIT_LOG_VERBOSE + + + Generate verbose log messages (0: false, default) + + Option type: int + + Applies to: compiler and linker + + + .. autoattribute:: cuda.bindings.driver.CUjit_option.CU_JIT_GENERATE_LINE_INFO + + + Generate line number information (-lineinfo) (0: false, default) + + Option type: int + + Applies to: compiler only + + + .. autoattribute:: cuda.bindings.driver.CUjit_option.CU_JIT_CACHE_MODE + + + Specifies whether to enable caching explicitly (-dlcm) + + Choice is based on supplied :py:obj:`~.CUjit_cacheMode_enum`. + + Option type: unsigned int for enumerated type :py:obj:`~.CUjit_cacheMode_enum` + + Applies to: compiler only + + + .. autoattribute:: cuda.bindings.driver.CUjit_option.CU_JIT_NEW_SM3X_OPT + + + [Deprecated] + + + .. autoattribute:: cuda.bindings.driver.CUjit_option.CU_JIT_FAST_COMPILE + + + This jit option is used for internal purpose only. + + + .. autoattribute:: cuda.bindings.driver.CUjit_option.CU_JIT_GLOBAL_SYMBOL_NAMES + + + Array of device symbol names that will be relocated to the corresponding host addresses stored in :py:obj:`~.CU_JIT_GLOBAL_SYMBOL_ADDRESSES`. + + Must contain :py:obj:`~.CU_JIT_GLOBAL_SYMBOL_COUNT` entries. + + When loading a device module, driver will relocate all encountered unresolved symbols to the host addresses. + + It is only allowed to register symbols that correspond to unresolved global variables. + + It is illegal to register the same device symbol at multiple addresses. + + Option type: const char \*\* + + Applies to: dynamic linker only + + + .. autoattribute:: cuda.bindings.driver.CUjit_option.CU_JIT_GLOBAL_SYMBOL_ADDRESSES + + + Array of host addresses that will be used to relocate corresponding device symbols stored in :py:obj:`~.CU_JIT_GLOBAL_SYMBOL_NAMES`. + + Must contain :py:obj:`~.CU_JIT_GLOBAL_SYMBOL_COUNT` entries. + + Option type: void \*\* + + Applies to: dynamic linker only + + + .. autoattribute:: cuda.bindings.driver.CUjit_option.CU_JIT_GLOBAL_SYMBOL_COUNT + + + Number of entries in :py:obj:`~.CU_JIT_GLOBAL_SYMBOL_NAMES` and :py:obj:`~.CU_JIT_GLOBAL_SYMBOL_ADDRESSES` arrays. + + Option type: unsigned int + + Applies to: dynamic linker only + + + .. autoattribute:: cuda.bindings.driver.CUjit_option.CU_JIT_LTO + + + [Deprecated] + + + + Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0 + + + .. autoattribute:: cuda.bindings.driver.CUjit_option.CU_JIT_FTZ + + + [Deprecated] + + + + Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0 + + + .. autoattribute:: cuda.bindings.driver.CUjit_option.CU_JIT_PREC_DIV + + + [Deprecated] + + + + Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0 + + + .. autoattribute:: cuda.bindings.driver.CUjit_option.CU_JIT_PREC_SQRT + + + [Deprecated] + + + + Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0 + + + .. autoattribute:: cuda.bindings.driver.CUjit_option.CU_JIT_FMA + + + [Deprecated] + + + + Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0 + + + .. autoattribute:: cuda.bindings.driver.CUjit_option.CU_JIT_REFERENCED_KERNEL_NAMES + + + [Deprecated] + + + + Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0 + + + .. autoattribute:: cuda.bindings.driver.CUjit_option.CU_JIT_REFERENCED_KERNEL_COUNT + + + [Deprecated] + + + + Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0 + + + .. autoattribute:: cuda.bindings.driver.CUjit_option.CU_JIT_REFERENCED_VARIABLE_NAMES + + + [Deprecated] + + + + Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0 + + + .. autoattribute:: cuda.bindings.driver.CUjit_option.CU_JIT_REFERENCED_VARIABLE_COUNT + + + [Deprecated] + + + + Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0 + + + .. autoattribute:: cuda.bindings.driver.CUjit_option.CU_JIT_OPTIMIZE_UNUSED_DEVICE_VARIABLES + + + [Deprecated] + + + + Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0 + + + .. autoattribute:: cuda.bindings.driver.CUjit_option.CU_JIT_POSITION_INDEPENDENT_CODE + + + Generate position independent code (0: false) + + Option type: int + + Applies to: compiler only + + + .. autoattribute:: cuda.bindings.driver.CUjit_option.CU_JIT_MIN_CTA_PER_SM + + + This option hints to the JIT compiler the minimum number of CTAs from the kernel’s grid to be mapped to a SM. This option is ignored when used together with :py:obj:`~.CU_JIT_MAX_REGISTERS` or :py:obj:`~.CU_JIT_THREADS_PER_BLOCK`. Optimizations based on this option need :py:obj:`~.CU_JIT_MAX_THREADS_PER_BLOCK` to be specified as well. For kernels already using PTX directive .minnctapersm, this option will be ignored by default. Use :py:obj:`~.CU_JIT_OVERRIDE_DIRECTIVE_VALUES` to let this option take precedence over the PTX directive. Option type: unsigned int + + Applies to: compiler only + + + .. autoattribute:: cuda.bindings.driver.CUjit_option.CU_JIT_MAX_THREADS_PER_BLOCK + + + Maximum number threads in a thread block, computed as the product of the maximum extent specifed for each dimension of the block. This limit is guaranteed not to be exeeded in any invocation of the kernel. Exceeding the the maximum number of threads results in runtime error or kernel launch failure. For kernels already using PTX directive .maxntid, this option will be ignored by default. Use :py:obj:`~.CU_JIT_OVERRIDE_DIRECTIVE_VALUES` to let this option take precedence over the PTX directive. Option type: int + + Applies to: compiler only + + + .. autoattribute:: cuda.bindings.driver.CUjit_option.CU_JIT_OVERRIDE_DIRECTIVE_VALUES + + + This option lets the values specified using :py:obj:`~.CU_JIT_MAX_REGISTERS`, :py:obj:`~.CU_JIT_THREADS_PER_BLOCK`, :py:obj:`~.CU_JIT_MAX_THREADS_PER_BLOCK` and :py:obj:`~.CU_JIT_MIN_CTA_PER_SM` take precedence over any PTX directives. (0: Disable, default; 1: Enable) Option type: int + + Applies to: compiler only + + + .. autoattribute:: cuda.bindings.driver.CUjit_option.CU_JIT_SPLIT_COMPILE + + + This option specifies the maximum number of concurrent threads to use when running compiler optimizations. If the specified value is 1, the option will be ignored. If the specified value is 0, the number of threads will match the number of CPUs on the underlying machine. Otherwise, if the option is N, then up to N threads will be used. Option type: unsigned int + + Applies to: compiler only + + + .. autoattribute:: cuda.bindings.driver.CUjit_option.CU_JIT_BINARY_LOADER_THREAD_COUNT + + + This option specifies the maximum number of concurrent threads to use when compiling device code. If the specified value is 1, the option will be ignored. If the specified value is 0, the number of threads will match the number of CPUs on the underlying machine. Otherwise, if the option is N, then up to N threads will be used. This option is ignored if the env var CUDA_BINARY_LOADER_THREAD_COUNT is set. Option type: unsigned int + + Applies to: compiler and linker + + + .. autoattribute:: cuda.bindings.driver.CUjit_option.CU_JIT_NUM_OPTIONS + +.. autoclass:: cuda.bindings.driver.CUjit_target + + .. autoattribute:: cuda.bindings.driver.CUjit_target.CU_TARGET_COMPUTE_30 + + + Compute device class 3.0 + + + .. autoattribute:: cuda.bindings.driver.CUjit_target.CU_TARGET_COMPUTE_32 + + + Compute device class 3.2 + + + .. autoattribute:: cuda.bindings.driver.CUjit_target.CU_TARGET_COMPUTE_35 + + + Compute device class 3.5 + + + .. autoattribute:: cuda.bindings.driver.CUjit_target.CU_TARGET_COMPUTE_37 + + + Compute device class 3.7 + + + .. autoattribute:: cuda.bindings.driver.CUjit_target.CU_TARGET_COMPUTE_50 + + + Compute device class 5.0 + + + .. autoattribute:: cuda.bindings.driver.CUjit_target.CU_TARGET_COMPUTE_52 + + + Compute device class 5.2 + + + .. autoattribute:: cuda.bindings.driver.CUjit_target.CU_TARGET_COMPUTE_53 + + + Compute device class 5.3 + + + .. autoattribute:: cuda.bindings.driver.CUjit_target.CU_TARGET_COMPUTE_60 + + + Compute device class 6.0. + + + .. autoattribute:: cuda.bindings.driver.CUjit_target.CU_TARGET_COMPUTE_61 + + + Compute device class 6.1. + + + .. autoattribute:: cuda.bindings.driver.CUjit_target.CU_TARGET_COMPUTE_62 + + + Compute device class 6.2. + + + .. autoattribute:: cuda.bindings.driver.CUjit_target.CU_TARGET_COMPUTE_70 + + + Compute device class 7.0. + + + .. autoattribute:: cuda.bindings.driver.CUjit_target.CU_TARGET_COMPUTE_72 + + + Compute device class 7.2. + + + .. autoattribute:: cuda.bindings.driver.CUjit_target.CU_TARGET_COMPUTE_75 + + + Compute device class 7.5. + + + .. autoattribute:: cuda.bindings.driver.CUjit_target.CU_TARGET_COMPUTE_80 + + + Compute device class 8.0. + + + .. autoattribute:: cuda.bindings.driver.CUjit_target.CU_TARGET_COMPUTE_86 + + + Compute device class 8.6. + + + .. autoattribute:: cuda.bindings.driver.CUjit_target.CU_TARGET_COMPUTE_87 + + + Compute device class 8.7. + + + .. autoattribute:: cuda.bindings.driver.CUjit_target.CU_TARGET_COMPUTE_89 + + + Compute device class 8.9. + + + .. autoattribute:: cuda.bindings.driver.CUjit_target.CU_TARGET_COMPUTE_90 + + + Compute device class 9.0. + + + .. autoattribute:: cuda.bindings.driver.CUjit_target.CU_TARGET_COMPUTE_100 + + + Compute device class 10.0. + + + .. autoattribute:: cuda.bindings.driver.CUjit_target.CU_TARGET_COMPUTE_110 + + + Compute device class 11.0. + + + .. autoattribute:: cuda.bindings.driver.CUjit_target.CU_TARGET_COMPUTE_103 + + + Compute device class 10.3. + + + .. autoattribute:: cuda.bindings.driver.CUjit_target.CU_TARGET_COMPUTE_120 + + + Compute device class 12.0. + + + .. autoattribute:: cuda.bindings.driver.CUjit_target.CU_TARGET_COMPUTE_121 + + + Compute device class 12.1. Compute device class 9.0. with accelerated features. + + + .. autoattribute:: cuda.bindings.driver.CUjit_target.CU_TARGET_COMPUTE_90A + + + Compute device class 10.0. with accelerated features. + + + .. autoattribute:: cuda.bindings.driver.CUjit_target.CU_TARGET_COMPUTE_100A + + + Compute device class 11.0 with accelerated features. + + + .. autoattribute:: cuda.bindings.driver.CUjit_target.CU_TARGET_COMPUTE_110A + + + Compute device class 10.3. with accelerated features. + + + .. autoattribute:: cuda.bindings.driver.CUjit_target.CU_TARGET_COMPUTE_103A + + + Compute device class 12.0. with accelerated features. + + + .. autoattribute:: cuda.bindings.driver.CUjit_target.CU_TARGET_COMPUTE_120A + + + Compute device class 12.1. with accelerated features. + + + .. autoattribute:: cuda.bindings.driver.CUjit_target.CU_TARGET_COMPUTE_121A + + + Compute device class 10.x with family features. + + + .. autoattribute:: cuda.bindings.driver.CUjit_target.CU_TARGET_COMPUTE_100F + + + Compute device class 11.0 with family features. + + + .. autoattribute:: cuda.bindings.driver.CUjit_target.CU_TARGET_COMPUTE_110F + + + Compute device class 10.3. with family features. + + + .. autoattribute:: cuda.bindings.driver.CUjit_target.CU_TARGET_COMPUTE_103F + + + Compute device class 12.0. with family features. + + + .. autoattribute:: cuda.bindings.driver.CUjit_target.CU_TARGET_COMPUTE_120F + + + Compute device class 12.1. with family features. + + + .. autoattribute:: cuda.bindings.driver.CUjit_target.CU_TARGET_COMPUTE_121F + +.. autoclass:: cuda.bindings.driver.CUjit_fallback + + .. autoattribute:: cuda.bindings.driver.CUjit_fallback.CU_PREFER_PTX + + + Prefer to compile ptx if exact binary match not found + + + .. autoattribute:: cuda.bindings.driver.CUjit_fallback.CU_PREFER_BINARY + + + Prefer to fall back to compatible binary code if exact match not found + +.. autoclass:: cuda.bindings.driver.CUjit_cacheMode + + .. autoattribute:: cuda.bindings.driver.CUjit_cacheMode.CU_JIT_CACHE_OPTION_NONE + + + Compile with no -dlcm flag specified + + + .. autoattribute:: cuda.bindings.driver.CUjit_cacheMode.CU_JIT_CACHE_OPTION_CG + + + Compile with L1 cache disabled + + + .. autoattribute:: cuda.bindings.driver.CUjit_cacheMode.CU_JIT_CACHE_OPTION_CA + + + Compile with L1 cache enabled + +.. autoclass:: cuda.bindings.driver.CUjitInputType + + .. autoattribute:: cuda.bindings.driver.CUjitInputType.CU_JIT_INPUT_CUBIN + + + Compiled device-class-specific device code + + Applicable options: none + + + .. autoattribute:: cuda.bindings.driver.CUjitInputType.CU_JIT_INPUT_PTX + + + PTX source code + + Applicable options: PTX compiler options + + + .. autoattribute:: cuda.bindings.driver.CUjitInputType.CU_JIT_INPUT_FATBINARY + + + Bundle of multiple cubins and/or PTX of some device code + + Applicable options: PTX compiler options, :py:obj:`~.CU_JIT_FALLBACK_STRATEGY` + + + .. autoattribute:: cuda.bindings.driver.CUjitInputType.CU_JIT_INPUT_OBJECT + + + Host object with embedded device code + + Applicable options: PTX compiler options, :py:obj:`~.CU_JIT_FALLBACK_STRATEGY` + + + .. autoattribute:: cuda.bindings.driver.CUjitInputType.CU_JIT_INPUT_LIBRARY + + + Archive of host objects with embedded device code + + Applicable options: PTX compiler options, :py:obj:`~.CU_JIT_FALLBACK_STRATEGY` + + + .. autoattribute:: cuda.bindings.driver.CUjitInputType.CU_JIT_INPUT_NVVM + + + [Deprecated] + + + + Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0 + + + .. autoattribute:: cuda.bindings.driver.CUjitInputType.CU_JIT_NUM_INPUT_TYPES + +.. autoclass:: cuda.bindings.driver.CUgraphicsRegisterFlags + + .. autoattribute:: cuda.bindings.driver.CUgraphicsRegisterFlags.CU_GRAPHICS_REGISTER_FLAGS_NONE + + + .. autoattribute:: cuda.bindings.driver.CUgraphicsRegisterFlags.CU_GRAPHICS_REGISTER_FLAGS_READ_ONLY + + + .. autoattribute:: cuda.bindings.driver.CUgraphicsRegisterFlags.CU_GRAPHICS_REGISTER_FLAGS_WRITE_DISCARD + + + .. autoattribute:: cuda.bindings.driver.CUgraphicsRegisterFlags.CU_GRAPHICS_REGISTER_FLAGS_SURFACE_LDST + + + .. autoattribute:: cuda.bindings.driver.CUgraphicsRegisterFlags.CU_GRAPHICS_REGISTER_FLAGS_TEXTURE_GATHER + +.. autoclass:: cuda.bindings.driver.CUgraphicsMapResourceFlags + + .. autoattribute:: cuda.bindings.driver.CUgraphicsMapResourceFlags.CU_GRAPHICS_MAP_RESOURCE_FLAGS_NONE + + + .. autoattribute:: cuda.bindings.driver.CUgraphicsMapResourceFlags.CU_GRAPHICS_MAP_RESOURCE_FLAGS_READ_ONLY + + + .. autoattribute:: cuda.bindings.driver.CUgraphicsMapResourceFlags.CU_GRAPHICS_MAP_RESOURCE_FLAGS_WRITE_DISCARD + +.. autoclass:: cuda.bindings.driver.CUarray_cubemap_face + + .. autoattribute:: cuda.bindings.driver.CUarray_cubemap_face.CU_CUBEMAP_FACE_POSITIVE_X + + + Positive X face of cubemap + + + .. autoattribute:: cuda.bindings.driver.CUarray_cubemap_face.CU_CUBEMAP_FACE_NEGATIVE_X + + + Negative X face of cubemap + + + .. autoattribute:: cuda.bindings.driver.CUarray_cubemap_face.CU_CUBEMAP_FACE_POSITIVE_Y + + + Positive Y face of cubemap + + + .. autoattribute:: cuda.bindings.driver.CUarray_cubemap_face.CU_CUBEMAP_FACE_NEGATIVE_Y + + + Negative Y face of cubemap + + + .. autoattribute:: cuda.bindings.driver.CUarray_cubemap_face.CU_CUBEMAP_FACE_POSITIVE_Z + + + Positive Z face of cubemap + + + .. autoattribute:: cuda.bindings.driver.CUarray_cubemap_face.CU_CUBEMAP_FACE_NEGATIVE_Z + + + Negative Z face of cubemap + +.. autoclass:: cuda.bindings.driver.CUlimit + + .. autoattribute:: cuda.bindings.driver.CUlimit.CU_LIMIT_STACK_SIZE + + + GPU thread stack size + + + .. autoattribute:: cuda.bindings.driver.CUlimit.CU_LIMIT_PRINTF_FIFO_SIZE + + + GPU printf FIFO size + + + .. autoattribute:: cuda.bindings.driver.CUlimit.CU_LIMIT_MALLOC_HEAP_SIZE + + + GPU malloc heap size + + + .. autoattribute:: cuda.bindings.driver.CUlimit.CU_LIMIT_DEV_RUNTIME_SYNC_DEPTH + + + GPU device runtime launch synchronize depth + + + .. autoattribute:: cuda.bindings.driver.CUlimit.CU_LIMIT_DEV_RUNTIME_PENDING_LAUNCH_COUNT + + + GPU device runtime pending launch count + + + .. autoattribute:: cuda.bindings.driver.CUlimit.CU_LIMIT_MAX_L2_FETCH_GRANULARITY + + + A value between 0 and 128 that indicates the maximum fetch granularity of L2 (in Bytes). This is a hint + + + .. autoattribute:: cuda.bindings.driver.CUlimit.CU_LIMIT_PERSISTING_L2_CACHE_SIZE + + + A size in bytes for L2 persisting lines cache size + + + .. autoattribute:: cuda.bindings.driver.CUlimit.CU_LIMIT_SHMEM_SIZE + + + A maximum size in bytes of shared memory available to CUDA kernels on a CIG context. Can only be queried, cannot be set + + + .. autoattribute:: cuda.bindings.driver.CUlimit.CU_LIMIT_CIG_ENABLED + + + A non-zero value indicates this CUDA context is a CIG-enabled context. Can only be queried, cannot be set + + + .. autoattribute:: cuda.bindings.driver.CUlimit.CU_LIMIT_CIG_SHMEM_FALLBACK_ENABLED + + + When set to zero, CUDA will fail to launch a kernel on a CIG context, instead of using the fallback path, if the kernel uses more shared memory than available + + + .. autoattribute:: cuda.bindings.driver.CUlimit.CU_LIMIT_MAX + +.. autoclass:: cuda.bindings.driver.CUresourcetype + + .. autoattribute:: cuda.bindings.driver.CUresourcetype.CU_RESOURCE_TYPE_ARRAY + + + Array resource + + + .. autoattribute:: cuda.bindings.driver.CUresourcetype.CU_RESOURCE_TYPE_MIPMAPPED_ARRAY + + + Mipmapped array resource + + + .. autoattribute:: cuda.bindings.driver.CUresourcetype.CU_RESOURCE_TYPE_LINEAR + + + Linear resource + + + .. autoattribute:: cuda.bindings.driver.CUresourcetype.CU_RESOURCE_TYPE_PITCH2D + + + Pitch 2D resource + +.. autoclass:: cuda.bindings.driver.CUaccessProperty + + .. autoattribute:: cuda.bindings.driver.CUaccessProperty.CU_ACCESS_PROPERTY_NORMAL + + + Normal cache persistence. + + + .. autoattribute:: cuda.bindings.driver.CUaccessProperty.CU_ACCESS_PROPERTY_STREAMING + + + Streaming access is less likely to persit from cache. + + + .. autoattribute:: cuda.bindings.driver.CUaccessProperty.CU_ACCESS_PROPERTY_PERSISTING + + + Persisting access is more likely to persist in cache. + +.. autoclass:: cuda.bindings.driver.CUgraphConditionalNodeType + + .. autoattribute:: cuda.bindings.driver.CUgraphConditionalNodeType.CU_GRAPH_COND_TYPE_IF + + + Conditional 'if/else' Node. Body[0] executed if condition is non-zero. If ``size`` == 2, an optional ELSE graph is created and this is executed if the condition is zero. + + + .. autoattribute:: cuda.bindings.driver.CUgraphConditionalNodeType.CU_GRAPH_COND_TYPE_WHILE + + + Conditional 'while' Node. Body executed repeatedly while condition value is non-zero. + + + .. autoattribute:: cuda.bindings.driver.CUgraphConditionalNodeType.CU_GRAPH_COND_TYPE_SWITCH + + + Conditional 'switch' Node. Body[n] is executed once, where 'n' is the value of the condition. If the condition does not match a body index, no body is launched. + +.. autoclass:: cuda.bindings.driver.CUgraphNodeType + + .. autoattribute:: cuda.bindings.driver.CUgraphNodeType.CU_GRAPH_NODE_TYPE_KERNEL + + + GPU kernel node + + + .. autoattribute:: cuda.bindings.driver.CUgraphNodeType.CU_GRAPH_NODE_TYPE_MEMCPY + + + Memcpy node + + + .. autoattribute:: cuda.bindings.driver.CUgraphNodeType.CU_GRAPH_NODE_TYPE_MEMSET + + + Memset node + + + .. autoattribute:: cuda.bindings.driver.CUgraphNodeType.CU_GRAPH_NODE_TYPE_HOST + + + Host (executable) node + + + .. autoattribute:: cuda.bindings.driver.CUgraphNodeType.CU_GRAPH_NODE_TYPE_GRAPH + + + Node which executes an embedded graph + + + .. autoattribute:: cuda.bindings.driver.CUgraphNodeType.CU_GRAPH_NODE_TYPE_EMPTY + + + Empty (no-op) node + + + .. autoattribute:: cuda.bindings.driver.CUgraphNodeType.CU_GRAPH_NODE_TYPE_WAIT_EVENT + + + External event wait node + + + .. autoattribute:: cuda.bindings.driver.CUgraphNodeType.CU_GRAPH_NODE_TYPE_EVENT_RECORD + + + External event record node + + + .. autoattribute:: cuda.bindings.driver.CUgraphNodeType.CU_GRAPH_NODE_TYPE_EXT_SEMAS_SIGNAL + + + External semaphore signal node + + + .. autoattribute:: cuda.bindings.driver.CUgraphNodeType.CU_GRAPH_NODE_TYPE_EXT_SEMAS_WAIT + + + External semaphore wait node + + + .. autoattribute:: cuda.bindings.driver.CUgraphNodeType.CU_GRAPH_NODE_TYPE_MEM_ALLOC + + + Memory Allocation Node + + + .. autoattribute:: cuda.bindings.driver.CUgraphNodeType.CU_GRAPH_NODE_TYPE_MEM_FREE + + + Memory Free Node + + + .. autoattribute:: cuda.bindings.driver.CUgraphNodeType.CU_GRAPH_NODE_TYPE_BATCH_MEM_OP + + + Batch MemOp Node See :py:obj:`~.cuStreamBatchMemOp` and :py:obj:`~.CUstreamBatchMemOpType` for what these nodes can do. + + + .. autoattribute:: cuda.bindings.driver.CUgraphNodeType.CU_GRAPH_NODE_TYPE_CONDITIONAL + + + Conditional Node May be used to implement a conditional execution path or loop + + inside of a graph. The graph(s) contained within the body of the conditional node + + can be selectively executed or iterated upon based on the value of a conditional + + variable. + + + + Handles must be created in advance of creating the node + + using :py:obj:`~.cuGraphConditionalHandleCreate`. + + + + The following restrictions apply to graphs which contain conditional nodes: + + The graph cannot be used in a child node. + + Only one instantiation of the graph may exist at any point in time. + + The graph cannot be cloned. + + + + To set the control value, supply a default value when creating the handle and/or + + call :py:obj:`~.cudaGraphSetConditional` from device code. + + + .. autoattribute:: cuda.bindings.driver.CUgraphNodeType.CU_GRAPH_NODE_TYPE_RESERVED_16 + + + Reserved + +.. autoclass:: cuda.bindings.driver.CUgraphDependencyType + + .. autoattribute:: cuda.bindings.driver.CUgraphDependencyType.CU_GRAPH_DEPENDENCY_TYPE_DEFAULT + + + This is an ordinary dependency. + + + .. autoattribute:: cuda.bindings.driver.CUgraphDependencyType.CU_GRAPH_DEPENDENCY_TYPE_PROGRAMMATIC + + + This dependency type allows the downstream node to use ``cudaGridDependencySynchronize()``. It may only be used between kernel nodes, and must be used with either the :py:obj:`~.CU_GRAPH_KERNEL_NODE_PORT_PROGRAMMATIC` or :py:obj:`~.CU_GRAPH_KERNEL_NODE_PORT_LAUNCH_ORDER` outgoing port. + +.. autoclass:: cuda.bindings.driver.CUgraphInstantiateResult + + .. autoattribute:: cuda.bindings.driver.CUgraphInstantiateResult.CUDA_GRAPH_INSTANTIATE_SUCCESS + + + Instantiation succeeded + + + .. autoattribute:: cuda.bindings.driver.CUgraphInstantiateResult.CUDA_GRAPH_INSTANTIATE_ERROR + + + Instantiation failed for an unexpected reason which is described in the return value of the function + + + .. autoattribute:: cuda.bindings.driver.CUgraphInstantiateResult.CUDA_GRAPH_INSTANTIATE_INVALID_STRUCTURE + + + Instantiation failed due to invalid structure, such as cycles + + + .. autoattribute:: cuda.bindings.driver.CUgraphInstantiateResult.CUDA_GRAPH_INSTANTIATE_NODE_OPERATION_NOT_SUPPORTED + + + Instantiation for device launch failed because the graph contained an unsupported operation + + + .. autoattribute:: cuda.bindings.driver.CUgraphInstantiateResult.CUDA_GRAPH_INSTANTIATE_MULTIPLE_CTXS_NOT_SUPPORTED + + + Instantiation for device launch failed due to the nodes belonging to different contexts + + + .. autoattribute:: cuda.bindings.driver.CUgraphInstantiateResult.CUDA_GRAPH_INSTANTIATE_CONDITIONAL_HANDLE_UNUSED + + + One or more conditional handles are not associated with conditional nodes + +.. autoclass:: cuda.bindings.driver.CUsynchronizationPolicy + + .. autoattribute:: cuda.bindings.driver.CUsynchronizationPolicy.CU_SYNC_POLICY_AUTO + + + .. autoattribute:: cuda.bindings.driver.CUsynchronizationPolicy.CU_SYNC_POLICY_SPIN + + + .. autoattribute:: cuda.bindings.driver.CUsynchronizationPolicy.CU_SYNC_POLICY_YIELD + + + .. autoattribute:: cuda.bindings.driver.CUsynchronizationPolicy.CU_SYNC_POLICY_BLOCKING_SYNC + +.. autoclass:: cuda.bindings.driver.CUclusterSchedulingPolicy + + .. autoattribute:: cuda.bindings.driver.CUclusterSchedulingPolicy.CU_CLUSTER_SCHEDULING_POLICY_DEFAULT + + + the default policy + + + .. autoattribute:: cuda.bindings.driver.CUclusterSchedulingPolicy.CU_CLUSTER_SCHEDULING_POLICY_SPREAD + + + spread the blocks within a cluster to the SMs + + + .. autoattribute:: cuda.bindings.driver.CUclusterSchedulingPolicy.CU_CLUSTER_SCHEDULING_POLICY_LOAD_BALANCING + + + allow the hardware to load-balance the blocks in a cluster to the SMs + +.. autoclass:: cuda.bindings.driver.CUlaunchMemSyncDomain + + .. autoattribute:: cuda.bindings.driver.CUlaunchMemSyncDomain.CU_LAUNCH_MEM_SYNC_DOMAIN_DEFAULT + + + Launch kernels in the default domain + + + .. autoattribute:: cuda.bindings.driver.CUlaunchMemSyncDomain.CU_LAUNCH_MEM_SYNC_DOMAIN_REMOTE + + + Launch kernels in the remote domain + +.. autoclass:: cuda.bindings.driver.CUlaunchAttributePortableClusterMode + + .. autoattribute:: cuda.bindings.driver.CUlaunchAttributePortableClusterMode.CU_LAUNCH_PORTABLE_CLUSTER_MODE_DEFAULT + + + The default to use for allowing non-portable cluster size on launch - uses current function attribute for :py:obj:`~.CU_FUNC_ATTRIBUTE_NON_PORTABLE_CLUSTER_SIZE_ALLOWED` + + + .. autoattribute:: cuda.bindings.driver.CUlaunchAttributePortableClusterMode.CU_LAUNCH_PORTABLE_CLUSTER_MODE_REQUIRE_PORTABLE + + + Specifies that the cluster size requested must be a portable size + + + .. autoattribute:: cuda.bindings.driver.CUlaunchAttributePortableClusterMode.CU_LAUNCH_PORTABLE_CLUSTER_MODE_ALLOW_NON_PORTABLE + + + Specifies that the cluster size requested may be a non-portable size + +.. autoclass:: cuda.bindings.driver.CUsharedMemoryMode + + .. autoattribute:: cuda.bindings.driver.CUsharedMemoryMode.CU_SHARED_MEMORY_MODE_DEFAULT + + + The default to use for shared memory on launch - uses current function attribute for :py:obj:`~.CU_FUNC_ATTRIBUTE_MAX_DYNAMIC_SHARED_SIZE_BYTES` + + + .. autoattribute:: cuda.bindings.driver.CUsharedMemoryMode.CU_SHARED_MEMORY_MODE_REQUIRE_PORTABLE + + + Specifies that the dynamic shared size bytes requested must be a portable size within the bounds of :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK` + + + .. autoattribute:: cuda.bindings.driver.CUsharedMemoryMode.CU_SHARED_MEMORY_MODE_ALLOW_NON_PORTABLE + + + Specifies that the dynamic shared size bytes requested may be a non-portable size but still within the bounds of :py:obj:`~.CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK_OPTIN` + +.. autoclass:: cuda.bindings.driver.CUlaunchAttributeID + + .. autoattribute:: cuda.bindings.driver.CUlaunchAttributeID.CU_LAUNCH_ATTRIBUTE_IGNORE + + + Ignored entry, for convenient composition + + + .. autoattribute:: cuda.bindings.driver.CUlaunchAttributeID.CU_LAUNCH_ATTRIBUTE_ACCESS_POLICY_WINDOW + + + Valid for streams, graph nodes, launches. See :py:obj:`~.CUlaunchAttributeValue.accessPolicyWindow`. + + + .. autoattribute:: cuda.bindings.driver.CUlaunchAttributeID.CU_LAUNCH_ATTRIBUTE_COOPERATIVE + + + Valid for graph nodes, launches. See :py:obj:`~.CUlaunchAttributeValue.cooperative`. + + + .. autoattribute:: cuda.bindings.driver.CUlaunchAttributeID.CU_LAUNCH_ATTRIBUTE_SYNCHRONIZATION_POLICY + + + Valid for streams. See :py:obj:`~.CUlaunchAttributeValue.syncPolicy`. + + + .. autoattribute:: cuda.bindings.driver.CUlaunchAttributeID.CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION + + + Valid for graph nodes, launches. See :py:obj:`~.CUlaunchAttributeValue.clusterDim`. + + + .. autoattribute:: cuda.bindings.driver.CUlaunchAttributeID.CU_LAUNCH_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE + + + Valid for graph nodes, launches. See :py:obj:`~.CUlaunchAttributeValue.clusterSchedulingPolicyPreference`. + + + .. autoattribute:: cuda.bindings.driver.CUlaunchAttributeID.CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_STREAM_SERIALIZATION + + + Valid for launches. Setting :py:obj:`~.CUlaunchAttributeValue.programmaticStreamSerializationAllowed` to non-0 signals that the kernel will use programmatic means to resolve its stream dependency, so that the CUDA runtime should opportunistically allow the grid's execution to overlap with the previous kernel in the stream, if that kernel requests the overlap. The dependent launches can choose to wait on the dependency using the programmatic sync (cudaGridDependencySynchronize() or equivalent PTX instructions). + + + .. autoattribute:: cuda.bindings.driver.CUlaunchAttributeID.CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_EVENT + + + Valid for launches. Set :py:obj:`~.CUlaunchAttributeValue.programmaticEvent` to record the event. Event recorded through this launch attribute is guaranteed to only trigger after all block in the associated kernel trigger the event. A block can trigger the event through PTX launchdep.release or CUDA builtin function cudaTriggerProgrammaticLaunchCompletion(). A trigger can also be inserted at the beginning of each block's execution if triggerAtBlockStart is set to non-0. The dependent launches can choose to wait on the dependency using the programmatic sync (cudaGridDependencySynchronize() or equivalent PTX instructions). Note that dependents (including the CPU thread calling :py:obj:`~.cuEventSynchronize()`) are not guaranteed to observe the release precisely when it is released. For example, :py:obj:`~.cuEventSynchronize()` may only observe the event trigger long after the associated kernel has completed. This recording type is primarily meant for establishing programmatic dependency between device tasks. Note also this type of dependency allows, but does not guarantee, concurrent execution of tasks. + + The event supplied must not be an interprocess or interop event. The event must disable timing (i.e. must be created with the :py:obj:`~.CU_EVENT_DISABLE_TIMING` flag set). + + + .. autoattribute:: cuda.bindings.driver.CUlaunchAttributeID.CU_LAUNCH_ATTRIBUTE_PRIORITY + + + Valid for streams, graph nodes, launches. See :py:obj:`~.CUlaunchAttributeValue.priority`. + + + .. autoattribute:: cuda.bindings.driver.CUlaunchAttributeID.CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP + + + Valid for streams, graph nodes, launches. See :py:obj:`~.CUlaunchAttributeValue.memSyncDomainMap`. + + + .. autoattribute:: cuda.bindings.driver.CUlaunchAttributeID.CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN + + + Valid for streams, graph nodes, launches. See :py:obj:`~.CUlaunchAttributeValue.memSyncDomain`. + + + .. autoattribute:: cuda.bindings.driver.CUlaunchAttributeID.CU_LAUNCH_ATTRIBUTE_PREFERRED_CLUSTER_DIMENSION + + + Valid for graph nodes, launches. Set :py:obj:`~.CUlaunchAttributeValue.preferredClusterDim` to allow the kernel launch to specify a preferred substitute cluster dimension. Blocks may be grouped according to either the dimensions specified with this attribute (grouped into a "preferred substitute cluster"), or the one specified with :py:obj:`~.CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION` attribute (grouped into a "regular cluster"). The cluster dimensions of a "preferred substitute cluster" shall be an integer multiple greater than zero of the regular cluster dimensions. The device will attempt - on a best-effort basis - to group thread blocks into preferred clusters over grouping them into regular clusters. When it deems necessary (primarily when the device temporarily runs out of physical resources to launch the larger preferred clusters), the device may switch to launch the regular clusters instead to attempt to utilize as much of the physical device resources as possible. + + Each type of cluster will have its enumeration / coordinate setup as if the grid consists solely of its type of cluster. For example, if the preferred substitute cluster dimensions double the regular cluster dimensions, there might be simultaneously a regular cluster indexed at (1,0,0), and a preferred cluster indexed at (1,0,0). In this example, the preferred substitute cluster (1,0,0) replaces regular clusters (2,0,0) and (3,0,0) and groups their blocks. + + This attribute will only take effect when a regular cluster dimension has been specified. The preferred substitute cluster dimension must be an integer multiple greater than zero of the regular cluster dimension and must divide the grid. It must also be no more than ``maxBlocksPerCluster``, if it is set in the kernel's ``__launch_bounds__``. Otherwise it must be less than the maximum value the driver can support. Otherwise, setting this attribute to a value physically unable to fit on any particular device is permitted. + + + .. autoattribute:: cuda.bindings.driver.CUlaunchAttributeID.CU_LAUNCH_ATTRIBUTE_LAUNCH_COMPLETION_EVENT + + + Valid for launches. Set :py:obj:`~.CUlaunchAttributeValue.launchCompletionEvent` to record the event. + + Nominally, the event is triggered once all blocks of the kernel have begun execution. Currently this is a best effort. If a kernel B has a launch completion dependency on a kernel A, B may wait until A is complete. Alternatively, blocks of B may begin before all blocks of A have begun, for example if B can claim execution resources unavailable to A (e.g. they run on different GPUs) or if B is a higher priority than A. Exercise caution if such an ordering inversion could lead to deadlock. + + A launch completion event is nominally similar to a programmatic event with ``triggerAtBlockStart`` set except that it is not visible to ``cudaGridDependencySynchronize()`` and can be used with compute capability less than 9.0. + + The event supplied must not be an interprocess or interop event. The event must disable timing (i.e. must be created with the :py:obj:`~.CU_EVENT_DISABLE_TIMING` flag set). + + + .. autoattribute:: cuda.bindings.driver.CUlaunchAttributeID.CU_LAUNCH_ATTRIBUTE_DEVICE_UPDATABLE_KERNEL_NODE + + + Valid for graph nodes, launches. This attribute is graphs-only, and passing it to a launch in a non-capturing stream will result in an error. + + :py:obj:`~.CUlaunchAttributeValue.deviceUpdatableKernelNode.deviceUpdatable` can only be set to 0 or 1. Setting the field to 1 indicates that the corresponding kernel node should be device-updatable. On success, a handle will be returned via :py:obj:`~.CUlaunchAttributeValue.deviceUpdatableKernelNode.devNode` which can be passed to the various device-side update functions to update the node's kernel parameters from within another kernel. For more information on the types of device updates that can be made, as well as the relevant limitations thereof, see :py:obj:`~.cudaGraphKernelNodeUpdatesApply`. + + Nodes which are device-updatable have additional restrictions compared to regular kernel nodes. Firstly, device-updatable nodes cannot be removed from their graph via :py:obj:`~.cuGraphDestroyNode`. Additionally, once opted-in to this functionality, a node cannot opt out, and any attempt to set the deviceUpdatable attribute to 0 will result in an error. Device-updatable kernel nodes also cannot have their attributes copied to/from another kernel node via :py:obj:`~.cuGraphKernelNodeCopyAttributes`. Graphs containing one or more device-updatable nodes also do not allow multiple instantiation, and neither the graph nor its instantiated version can be passed to :py:obj:`~.cuGraphExecUpdate`. + + If a graph contains device-updatable nodes and updates those nodes from the device from within the graph, the graph must be uploaded with :py:obj:`~.cuGraphUpload` before it is launched. For such a graph, if host-side executable graph updates are made to the device-updatable nodes, the graph must be uploaded before it is launched again. + + + .. autoattribute:: cuda.bindings.driver.CUlaunchAttributeID.CU_LAUNCH_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT + + + Valid for launches. On devices where the L1 cache and shared memory use the same hardware resources, setting :py:obj:`~.CUlaunchAttributeValue.sharedMemCarveout` to a percentage between 0-100 signals the CUDA driver to set the shared memory carveout preference, in percent of the total shared memory for that kernel launch. This attribute takes precedence over :py:obj:`~.CU_FUNC_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT`. This is only a hint, and the CUDA driver can choose a different configuration if required for the launch. + + + .. autoattribute:: cuda.bindings.driver.CUlaunchAttributeID.CU_LAUNCH_ATTRIBUTE_NVLINK_UTIL_CENTRIC_SCHEDULING + + + Valid for streams, graph nodes, launches. This attribute is a hint to the CUDA runtime that the launch should attempt to make the kernel maximize its NVLINK utilization. + + + + When possible to honor this hint, CUDA will assume each block in the grid launch will carry out an even amount of NVLINK traffic, and make a best-effort attempt to adjust the kernel launch based on that assumption. + + This attribute is a hint only. CUDA makes no functional or performance guarantee. Its applicability can be affected by many different factors, including driver version (i.e. CUDA doesn't guarantee the performance characteristics will be maintained between driver versions or a driver update could alter or regress previously observed perf characteristics.) It also doesn't guarantee a successful result, i.e. applying the attribute may not improve the performance of either the targeted kernel or the encapsulating application. + + Valid values for :py:obj:`~.CUlaunchAttributeValue.nvlinkUtilCentricScheduling` are 0 (disabled) and 1 (enabled). + + + .. autoattribute:: cuda.bindings.driver.CUlaunchAttributeID.CU_LAUNCH_ATTRIBUTE_PORTABLE_CLUSTER_SIZE_MODE + + + Valid for graph nodes, launches. This controls whether the kernel launch is allowed to use a non-portable cluster size. Valid values for :py:obj:`~.CUlaunchAttributeValue.portableClusterSizeMode` are described in :py:obj:`~.CUlaunchAttributePortableClusterMode`. Any other value will return :py:obj:`~.CUDA_ERROR_INVALID_VALUE` + + + .. autoattribute:: cuda.bindings.driver.CUlaunchAttributeID.CU_LAUNCH_ATTRIBUTE_SHARED_MEMORY_MODE + + + Valid for graph nodes, launches. This indicates if the kernel is allowed to use a non-portable dynamic shared memory mode. + +.. autoclass:: cuda.bindings.driver.CUstreamCaptureStatus + + .. autoattribute:: cuda.bindings.driver.CUstreamCaptureStatus.CU_STREAM_CAPTURE_STATUS_NONE + + + Stream is not capturing + + + .. autoattribute:: cuda.bindings.driver.CUstreamCaptureStatus.CU_STREAM_CAPTURE_STATUS_ACTIVE + + + Stream is actively capturing + + + .. autoattribute:: cuda.bindings.driver.CUstreamCaptureStatus.CU_STREAM_CAPTURE_STATUS_INVALIDATED + + + Stream is part of a capture sequence that has been invalidated, but not terminated + +.. autoclass:: cuda.bindings.driver.CUstreamCaptureMode + + .. autoattribute:: cuda.bindings.driver.CUstreamCaptureMode.CU_STREAM_CAPTURE_MODE_GLOBAL + + + .. autoattribute:: cuda.bindings.driver.CUstreamCaptureMode.CU_STREAM_CAPTURE_MODE_THREAD_LOCAL + + + .. autoattribute:: cuda.bindings.driver.CUstreamCaptureMode.CU_STREAM_CAPTURE_MODE_RELAXED + +.. autoclass:: cuda.bindings.driver.CUdriverProcAddress_flags + + .. autoattribute:: cuda.bindings.driver.CUdriverProcAddress_flags.CU_GET_PROC_ADDRESS_DEFAULT + + + Default search mode for driver symbols. + + + .. autoattribute:: cuda.bindings.driver.CUdriverProcAddress_flags.CU_GET_PROC_ADDRESS_LEGACY_STREAM + + + Search for legacy versions of driver symbols. + + + .. autoattribute:: cuda.bindings.driver.CUdriverProcAddress_flags.CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM + + + Search for per-thread versions of driver symbols. + +.. autoclass:: cuda.bindings.driver.CUdriverProcAddressQueryResult + + .. autoattribute:: cuda.bindings.driver.CUdriverProcAddressQueryResult.CU_GET_PROC_ADDRESS_SUCCESS + + + Symbol was succesfully found + + + .. autoattribute:: cuda.bindings.driver.CUdriverProcAddressQueryResult.CU_GET_PROC_ADDRESS_SYMBOL_NOT_FOUND + + + Symbol was not found in search + + + .. autoattribute:: cuda.bindings.driver.CUdriverProcAddressQueryResult.CU_GET_PROC_ADDRESS_VERSION_NOT_SUFFICIENT + + + Symbol was found but version supplied was not sufficient + +.. autoclass:: cuda.bindings.driver.CUexecAffinityType + + .. autoattribute:: cuda.bindings.driver.CUexecAffinityType.CU_EXEC_AFFINITY_TYPE_SM_COUNT + + + Create a context with limited SMs. + + + .. autoattribute:: cuda.bindings.driver.CUexecAffinityType.CU_EXEC_AFFINITY_TYPE_MAX + +.. autoclass:: cuda.bindings.driver.CUcigDataType + + .. autoattribute:: cuda.bindings.driver.CUcigDataType.CIG_DATA_TYPE_D3D12_COMMAND_QUEUE + + + D3D12 Command Queue Handle + + + .. autoattribute:: cuda.bindings.driver.CUcigDataType.CIG_DATA_TYPE_NV_BLOB + + + Nvidia specific data blob used for Vulkan and other NV clients + +.. autoclass:: cuda.bindings.driver.CUstreamCigDataType + + .. autoattribute:: cuda.bindings.driver.CUstreamCigDataType.STREAM_CIG_DATA_TYPE_D3D12_COMMAND_LIST + + + D3D12 Command List Handle + +.. autoclass:: cuda.bindings.driver.CUlibraryOption + + .. autoattribute:: cuda.bindings.driver.CUlibraryOption.CU_LIBRARY_HOST_UNIVERSAL_FUNCTION_AND_DATA_TABLE + + + .. autoattribute:: cuda.bindings.driver.CUlibraryOption.CU_LIBRARY_BINARY_IS_PRESERVED + + + Specifes that the argument ``code`` passed to :py:obj:`~.cuLibraryLoadData()` will be preserved. Specifying this option will let the driver know that ``code`` can be accessed at any point until :py:obj:`~.cuLibraryUnload()`. The default behavior is for the driver to allocate and maintain its own copy of ``code``. Note that this is only a memory usage optimization hint and the driver can choose to ignore it if required. Specifying this option with :py:obj:`~.cuLibraryLoadFromFile()` is invalid and will return :py:obj:`~.CUDA_ERROR_INVALID_VALUE`. + + + .. autoattribute:: cuda.bindings.driver.CUlibraryOption.CU_LIBRARY_NUM_OPTIONS + +.. autoclass:: cuda.bindings.driver.CUresult + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_SUCCESS + + + The API call returned with no errors. In the case of query calls, this also means that the operation being queried is complete (see :py:obj:`~.cuEventQuery()` and :py:obj:`~.cuStreamQuery()`). + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_INVALID_VALUE + + + This indicates that one or more of the parameters passed to the API call is not within an acceptable range of values. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_OUT_OF_MEMORY + + + The API call failed because it was unable to allocate enough memory or other resources to perform the requested operation. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_NOT_INITIALIZED + + + This indicates that the CUDA driver has not been initialized with :py:obj:`~.cuInit()` or that initialization has failed. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_DEINITIALIZED + + + This indicates that the CUDA driver is in the process of shutting down. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_PROFILER_DISABLED + + + This indicates profiler is not initialized for this run. This can happen when the application is running with external profiling tools like visual profiler. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_PROFILER_NOT_INITIALIZED + + + [Deprecated] + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_PROFILER_ALREADY_STARTED + + + [Deprecated] + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_PROFILER_ALREADY_STOPPED + + + [Deprecated] + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_STUB_LIBRARY + + + This indicates that the CUDA driver that the application has loaded is a stub library. Applications that run with the stub rather than a real driver loaded will result in CUDA API returning this error. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_CALL_REQUIRES_NEWER_DRIVER + + + This indicates that the API call requires a newer CUDA driver than the one currently installed. Users should install an updated NVIDIA CUDA driver to allow the API call to succeed. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_DEVICE_UNAVAILABLE + + + This indicates that requested CUDA device is unavailable at the current time. Devices are often unavailable due to use of :py:obj:`~.CU_COMPUTEMODE_EXCLUSIVE_PROCESS` or :py:obj:`~.CU_COMPUTEMODE_PROHIBITED`. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_NO_DEVICE + + + This indicates that no CUDA-capable devices were detected by the installed CUDA driver. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_INVALID_DEVICE + + + This indicates that the device ordinal supplied by the user does not correspond to a valid CUDA device or that the action requested is invalid for the specified device. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_DEVICE_NOT_LICENSED + + + This error indicates that the Grid license is not applied. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_INVALID_IMAGE + + + This indicates that the device kernel image is invalid. This can also indicate an invalid CUDA module. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_INVALID_CONTEXT + + + This most frequently indicates that there is no context bound to the current thread. This can also be returned if the context passed to an API call is not a valid handle (such as a context that has had :py:obj:`~.cuCtxDestroy()` invoked on it). This can also be returned if a user mixes different API versions (i.e. 3010 context with 3020 API calls). See :py:obj:`~.cuCtxGetApiVersion()` for more details. This can also be returned if the green context passed to an API call was not converted to a :py:obj:`~.CUcontext` using :py:obj:`~.cuCtxFromGreenCtx` API. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_CONTEXT_ALREADY_CURRENT + + + This indicated that the context being supplied as a parameter to the API call was already the active context. + + [Deprecated] + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_MAP_FAILED + + + This indicates that a map or register operation has failed. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_UNMAP_FAILED + + + This indicates that an unmap or unregister operation has failed. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_ARRAY_IS_MAPPED + + + This indicates that the specified array is currently mapped and thus cannot be destroyed. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_ALREADY_MAPPED + + + This indicates that the resource is already mapped. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_NO_BINARY_FOR_GPU + + + This indicates that there is no kernel image available that is suitable for the device. This can occur when a user specifies code generation options for a particular CUDA source file that do not include the corresponding device configuration. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_ALREADY_ACQUIRED + + + This indicates that a resource has already been acquired. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_NOT_MAPPED + + + This indicates that a resource is not mapped. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_NOT_MAPPED_AS_ARRAY + + + This indicates that a mapped resource is not available for access as an array. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_NOT_MAPPED_AS_POINTER + + + This indicates that a mapped resource is not available for access as a pointer. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_ECC_UNCORRECTABLE + + + This indicates that an uncorrectable ECC error was detected during execution. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_UNSUPPORTED_LIMIT + + + This indicates that the :py:obj:`~.CUlimit` passed to the API call is not supported by the active device. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_CONTEXT_ALREADY_IN_USE + + + This indicates that the :py:obj:`~.CUcontext` passed to the API call can only be bound to a single CPU thread at a time but is already bound to a CPU thread. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_PEER_ACCESS_UNSUPPORTED + + + This indicates that peer access is not supported across the given devices. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_INVALID_PTX + + + This indicates that a PTX JIT compilation failed. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_INVALID_GRAPHICS_CONTEXT + + + This indicates an error with OpenGL or DirectX context. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_NVLINK_UNCORRECTABLE + + + This indicates that an uncorrectable NVLink error was detected during the execution. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_JIT_COMPILER_NOT_FOUND + + + This indicates that the PTX JIT compiler library was not found. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_UNSUPPORTED_PTX_VERSION + + + This indicates that the provided PTX was compiled with an unsupported toolchain. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_JIT_COMPILATION_DISABLED + + + This indicates that the PTX JIT compilation was disabled. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_UNSUPPORTED_EXEC_AFFINITY + + + This indicates that the :py:obj:`~.CUexecAffinityType` passed to the API call is not supported by the active device. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_UNSUPPORTED_DEVSIDE_SYNC + + + This indicates that the code to be compiled by the PTX JIT contains unsupported call to cudaDeviceSynchronize. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_CONTAINED + + + This indicates that an exception occurred on the device that is now contained by the GPU's error containment capability. Common causes are - a. Certain types of invalid accesses of peer GPU memory over nvlink b. Certain classes of hardware errors This leaves the process in an inconsistent state and any further CUDA work will return the same error. To continue using CUDA, the process must be terminated and relaunched. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_INVALID_SOURCE + + + This indicates that the device kernel source is invalid. This includes compilation/linker errors encountered in device code or user error. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_FILE_NOT_FOUND + + + This indicates that the file specified was not found. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND + + + This indicates that a link to a shared object failed to resolve. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_SHARED_OBJECT_INIT_FAILED + + + This indicates that initialization of a shared object failed. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_OPERATING_SYSTEM + + + This indicates that an OS call failed. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_INVALID_HANDLE + + + This indicates that a resource handle passed to the API call was not valid. Resource handles are opaque types like :py:obj:`~.CUstream` and :py:obj:`~.CUevent`. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_ILLEGAL_STATE + + + This indicates that a resource required by the API call is not in a valid state to perform the requested operation. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_LOSSY_QUERY + + + This indicates an attempt was made to introspect an object in a way that would discard semantically important information. This is either due to the object using funtionality newer than the API version used to introspect it or omission of optional return arguments. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_NOT_FOUND + + + This indicates that a named symbol was not found. Examples of symbols are global/constant variable names, driver function names, texture names, and surface names. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_NOT_READY + + + This indicates that asynchronous operations issued previously have not completed yet. This result is not actually an error, but must be indicated differently than :py:obj:`~.CUDA_SUCCESS` (which indicates completion). Calls that may return this value include :py:obj:`~.cuEventQuery()` and :py:obj:`~.cuStreamQuery()`. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_ILLEGAL_ADDRESS + + + While executing a kernel, the device encountered a load or store instruction on an invalid memory address. This leaves the process in an inconsistent state and any further CUDA work will return the same error. To continue using CUDA, the process must be terminated and relaunched. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES + + + This indicates that a launch did not occur because it did not have appropriate resources. This error usually indicates that the user has attempted to pass too many arguments to the device kernel, or the kernel launch specifies too many threads for the kernel's register count. Passing arguments of the wrong size (i.e. a 64-bit pointer when a 32-bit int is expected) is equivalent to passing too many arguments and can also result in this error. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_LAUNCH_TIMEOUT + + + This indicates that the device kernel took too long to execute. This can only occur if timeouts are enabled - see the device attribute :py:obj:`~.CU_DEVICE_ATTRIBUTE_KERNEL_EXEC_TIMEOUT` for more information. This leaves the process in an inconsistent state and any further CUDA work will return the same error. To continue using CUDA, the process must be terminated and relaunched. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING + + + This error indicates a kernel launch that uses an incompatible texturing mode. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_PEER_ACCESS_ALREADY_ENABLED + + + This error indicates that a call to :py:obj:`~.cuCtxEnablePeerAccess()` is trying to re-enable peer access to a context which has already had peer access to it enabled. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_PEER_ACCESS_NOT_ENABLED + + + This error indicates that :py:obj:`~.cuCtxDisablePeerAccess()` is trying to disable peer access which has not been enabled yet via :py:obj:`~.cuCtxEnablePeerAccess()`. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_PRIMARY_CONTEXT_ACTIVE + + + This error indicates that the primary context for the specified device has already been initialized. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_CONTEXT_IS_DESTROYED + + + This error indicates that the context current to the calling thread has been destroyed using :py:obj:`~.cuCtxDestroy`, or is a primary context which has not yet been initialized. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_ASSERT + + + A device-side assert triggered during kernel execution. The context cannot be used anymore, and must be destroyed. All existing device memory allocations from this context are invalid and must be reconstructed if the program is to continue using CUDA. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_TOO_MANY_PEERS + + + This error indicates that the hardware resources required to enable peer access have been exhausted for one or more of the devices passed to :py:obj:`~.cuCtxEnablePeerAccess()`. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_HOST_MEMORY_ALREADY_REGISTERED + + + This error indicates that the memory range passed to :py:obj:`~.cuMemHostRegister()` has already been registered. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_HOST_MEMORY_NOT_REGISTERED + + + This error indicates that the pointer passed to :py:obj:`~.cuMemHostUnregister()` does not correspond to any currently registered memory region. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_HARDWARE_STACK_ERROR + + + While executing a kernel, the device encountered a stack error. This can be due to stack corruption or exceeding the stack size limit. This leaves the process in an inconsistent state and any further CUDA work will return the same error. To continue using CUDA, the process must be terminated and relaunched. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_ILLEGAL_INSTRUCTION + + + While executing a kernel, the device encountered an illegal instruction. This leaves the process in an inconsistent state and any further CUDA work will return the same error. To continue using CUDA, the process must be terminated and relaunched. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_MISALIGNED_ADDRESS + + + While executing a kernel, the device encountered a load or store instruction on a memory address which is not aligned. This leaves the process in an inconsistent state and any further CUDA work will return the same error. To continue using CUDA, the process must be terminated and relaunched. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_INVALID_ADDRESS_SPACE + + + While executing a kernel, the device encountered an instruction which can only operate on memory locations in certain address spaces (global, shared, or local), but was supplied a memory address not belonging to an allowed address space. This leaves the process in an inconsistent state and any further CUDA work will return the same error. To continue using CUDA, the process must be terminated and relaunched. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_INVALID_PC + + + While executing a kernel, the device program counter wrapped its address space. This leaves the process in an inconsistent state and any further CUDA work will return the same error. To continue using CUDA, the process must be terminated and relaunched. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_LAUNCH_FAILED + + + An exception occurred on the device while executing a kernel. Common causes include dereferencing an invalid device pointer and accessing out of bounds shared memory. Less common cases can be system specific - more information about these cases can be found in the system specific user guide. This leaves the process in an inconsistent state and any further CUDA work will return the same error. To continue using CUDA, the process must be terminated and relaunched. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_COOPERATIVE_LAUNCH_TOO_LARGE + + + This error indicates that the number of blocks launched per grid for a kernel that was launched via either :py:obj:`~.cuLaunchCooperativeKernel` or :py:obj:`~.cuLaunchCooperativeKernelMultiDevice` exceeds the maximum number of blocks as allowed by :py:obj:`~.cuOccupancyMaxActiveBlocksPerMultiprocessor` or :py:obj:`~.cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags` times the number of multiprocessors as specified by the device attribute :py:obj:`~.CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT`. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_TENSOR_MEMORY_LEAK + + + An exception occurred on the device while exiting a kernel using tensor memory: the tensor memory was not completely deallocated. This leaves the process in an inconsistent state and any further CUDA work will return the same error. To continue using CUDA, the process must be terminated and relaunched. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_NOT_PERMITTED + + + This error indicates that the attempted operation is not permitted. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_NOT_SUPPORTED + + + This error indicates that the attempted operation is not supported on the current system or device. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_SYSTEM_NOT_READY + + + This error indicates that the system is not yet ready to start any CUDA work. To continue using CUDA, verify the system configuration is in a valid state and all required driver daemons are actively running. More information about this error can be found in the system specific user guide. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_SYSTEM_DRIVER_MISMATCH + + + This error indicates that there is a mismatch between the versions of the display driver and the CUDA driver. Refer to the compatibility documentation for supported versions. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_COMPAT_NOT_SUPPORTED_ON_DEVICE + + + This error indicates that the system was upgraded to run with forward compatibility but the visible hardware detected by CUDA does not support this configuration. Refer to the compatibility documentation for the supported hardware matrix or ensure that only supported hardware is visible during initialization via the CUDA_VISIBLE_DEVICES environment variable. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_MPS_CONNECTION_FAILED + + + This error indicates that the MPS client failed to connect to the MPS control daemon or the MPS server. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_MPS_RPC_FAILURE + + + This error indicates that the remote procedural call between the MPS server and the MPS client failed. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_MPS_SERVER_NOT_READY + + + This error indicates that the MPS server is not ready to accept new MPS client requests. This error can be returned when the MPS server is in the process of recovering from a fatal failure. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_MPS_MAX_CLIENTS_REACHED + + + This error indicates that the hardware resources required to create MPS client have been exhausted. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_MPS_MAX_CONNECTIONS_REACHED + + + This error indicates the the hardware resources required to support device connections have been exhausted. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_MPS_CLIENT_TERMINATED + + + This error indicates that the MPS client has been terminated by the server. To continue using CUDA, the process must be terminated and relaunched. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_CDP_NOT_SUPPORTED + + + This error indicates that the module is using CUDA Dynamic Parallelism, but the current configuration, like MPS, does not support it. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_CDP_VERSION_MISMATCH + + + This error indicates that a module contains an unsupported interaction between different versions of CUDA Dynamic Parallelism. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_STREAM_CAPTURE_UNSUPPORTED + + + This error indicates that the operation is not permitted when the stream is capturing. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_STREAM_CAPTURE_INVALIDATED + + + This error indicates that the current capture sequence on the stream has been invalidated due to a previous error. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_STREAM_CAPTURE_MERGE + + + This error indicates that the operation would have resulted in a merge of two independent capture sequences. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_STREAM_CAPTURE_UNMATCHED + + + This error indicates that the capture was not initiated in this stream. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_STREAM_CAPTURE_UNJOINED + + + This error indicates that the capture sequence contains a fork that was not joined to the primary stream. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_STREAM_CAPTURE_ISOLATION + + + This error indicates that a dependency would have been created which crosses the capture sequence boundary. Only implicit in-stream ordering dependencies are allowed to cross the boundary. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_STREAM_CAPTURE_IMPLICIT + + + This error indicates a disallowed implicit dependency on a current capture sequence from cudaStreamLegacy. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_CAPTURED_EVENT + + + This error indicates that the operation is not permitted on an event which was last recorded in a capturing stream. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_STREAM_CAPTURE_WRONG_THREAD + + + A stream capture sequence not initiated with the :py:obj:`~.CU_STREAM_CAPTURE_MODE_RELAXED` argument to :py:obj:`~.cuStreamBeginCapture` was passed to :py:obj:`~.cuStreamEndCapture` in a different thread. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_TIMEOUT + + + This error indicates that the timeout specified for the wait operation has lapsed. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_GRAPH_EXEC_UPDATE_FAILURE + + + This error indicates that the graph update was not performed because it included changes which violated constraints specific to instantiated graph update. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_EXTERNAL_DEVICE + + + This indicates that an error has occurred in a device outside of GPU. It can be a synchronous error w.r.t. CUDA API or an asynchronous error from the external device. In case of asynchronous error, it means that if cuda was waiting for an external device's signal before consuming shared data, the external device signaled an error indicating that the data is not valid for consumption. This leaves the process in an inconsistent state and any further CUDA work will return the same error. To continue using CUDA, the process must be terminated and relaunched. In case of synchronous error, it means that one or more external devices have encountered an error and cannot complete the operation. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_INVALID_CLUSTER_SIZE + + + Indicates a kernel launch error due to cluster misconfiguration. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_FUNCTION_NOT_LOADED + + + Indiciates a function handle is not loaded when calling an API that requires a loaded function. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_INVALID_RESOURCE_TYPE + + + This error indicates one or more resources passed in are not valid resource types for the operation. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_INVALID_RESOURCE_CONFIGURATION + + + This error indicates one or more resources are insufficient or non-applicable for the operation. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_KEY_ROTATION + + + This error indicates that an error happened during the key rotation sequence. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_STREAM_DETACHED + + + This error indicates that the requested operation is not permitted because the stream is in a detached state. This can occur if the green context associated with the stream has been destroyed, limiting the stream's operational capabilities. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_GRAPH_RECAPTURE_FAILURE + + + This error indicates that a graph recapture failed and had to be terminated. + + + .. autoattribute:: cuda.bindings.driver.CUresult.CUDA_ERROR_UNKNOWN + + + This indicates that an unknown internal error has occurred. + +.. autoclass:: cuda.bindings.driver.CUdevice_P2PAttribute + + .. autoattribute:: cuda.bindings.driver.CUdevice_P2PAttribute.CU_DEVICE_P2P_ATTRIBUTE_PERFORMANCE_RANK + + + A relative value indicating the performance of the link between two devices + + + .. autoattribute:: cuda.bindings.driver.CUdevice_P2PAttribute.CU_DEVICE_P2P_ATTRIBUTE_ACCESS_SUPPORTED + + + P2P Access is enable + + + .. autoattribute:: cuda.bindings.driver.CUdevice_P2PAttribute.CU_DEVICE_P2P_ATTRIBUTE_NATIVE_ATOMIC_SUPPORTED + + + All CUDA-valid atomic operation over the link are supported + + + .. autoattribute:: cuda.bindings.driver.CUdevice_P2PAttribute.CU_DEVICE_P2P_ATTRIBUTE_ACCESS_ACCESS_SUPPORTED + + + [Deprecated] + + + .. autoattribute:: cuda.bindings.driver.CUdevice_P2PAttribute.CU_DEVICE_P2P_ATTRIBUTE_CUDA_ARRAY_ACCESS_SUPPORTED + + + Accessing CUDA arrays over the link supported + + + .. autoattribute:: cuda.bindings.driver.CUdevice_P2PAttribute.CU_DEVICE_P2P_ATTRIBUTE_ONLY_PARTIAL_NATIVE_ATOMIC_SUPPORTED + + + Only some CUDA-valid atomic operations over the link are supported. + +.. autoclass:: cuda.bindings.driver.CUresourceViewFormat + + .. autoattribute:: cuda.bindings.driver.CUresourceViewFormat.CU_RES_VIEW_FORMAT_NONE + + + No resource view format (use underlying resource format) + + + .. autoattribute:: cuda.bindings.driver.CUresourceViewFormat.CU_RES_VIEW_FORMAT_UINT_1X8 + + + 1 channel unsigned 8-bit integers + + + .. autoattribute:: cuda.bindings.driver.CUresourceViewFormat.CU_RES_VIEW_FORMAT_UINT_2X8 + + + 2 channel unsigned 8-bit integers + + + .. autoattribute:: cuda.bindings.driver.CUresourceViewFormat.CU_RES_VIEW_FORMAT_UINT_4X8 + + + 4 channel unsigned 8-bit integers + + + .. autoattribute:: cuda.bindings.driver.CUresourceViewFormat.CU_RES_VIEW_FORMAT_SINT_1X8 + + + 1 channel signed 8-bit integers + + + .. autoattribute:: cuda.bindings.driver.CUresourceViewFormat.CU_RES_VIEW_FORMAT_SINT_2X8 + + + 2 channel signed 8-bit integers + + + .. autoattribute:: cuda.bindings.driver.CUresourceViewFormat.CU_RES_VIEW_FORMAT_SINT_4X8 + + + 4 channel signed 8-bit integers + + + .. autoattribute:: cuda.bindings.driver.CUresourceViewFormat.CU_RES_VIEW_FORMAT_UINT_1X16 + + + 1 channel unsigned 16-bit integers + + + .. autoattribute:: cuda.bindings.driver.CUresourceViewFormat.CU_RES_VIEW_FORMAT_UINT_2X16 + + + 2 channel unsigned 16-bit integers + + + .. autoattribute:: cuda.bindings.driver.CUresourceViewFormat.CU_RES_VIEW_FORMAT_UINT_4X16 + + + 4 channel unsigned 16-bit integers + + + .. autoattribute:: cuda.bindings.driver.CUresourceViewFormat.CU_RES_VIEW_FORMAT_SINT_1X16 + + + 1 channel signed 16-bit integers + + + .. autoattribute:: cuda.bindings.driver.CUresourceViewFormat.CU_RES_VIEW_FORMAT_SINT_2X16 + + + 2 channel signed 16-bit integers + + + .. autoattribute:: cuda.bindings.driver.CUresourceViewFormat.CU_RES_VIEW_FORMAT_SINT_4X16 + + + 4 channel signed 16-bit integers + + + .. autoattribute:: cuda.bindings.driver.CUresourceViewFormat.CU_RES_VIEW_FORMAT_UINT_1X32 + + + 1 channel unsigned 32-bit integers + + + .. autoattribute:: cuda.bindings.driver.CUresourceViewFormat.CU_RES_VIEW_FORMAT_UINT_2X32 + + + 2 channel unsigned 32-bit integers + + + .. autoattribute:: cuda.bindings.driver.CUresourceViewFormat.CU_RES_VIEW_FORMAT_UINT_4X32 + + + 4 channel unsigned 32-bit integers + + + .. autoattribute:: cuda.bindings.driver.CUresourceViewFormat.CU_RES_VIEW_FORMAT_SINT_1X32 + + + 1 channel signed 32-bit integers + + + .. autoattribute:: cuda.bindings.driver.CUresourceViewFormat.CU_RES_VIEW_FORMAT_SINT_2X32 + + + 2 channel signed 32-bit integers + + + .. autoattribute:: cuda.bindings.driver.CUresourceViewFormat.CU_RES_VIEW_FORMAT_SINT_4X32 + + + 4 channel signed 32-bit integers + + + .. autoattribute:: cuda.bindings.driver.CUresourceViewFormat.CU_RES_VIEW_FORMAT_FLOAT_1X16 + + + 1 channel 16-bit floating point + + + .. autoattribute:: cuda.bindings.driver.CUresourceViewFormat.CU_RES_VIEW_FORMAT_FLOAT_2X16 + + + 2 channel 16-bit floating point + + + .. autoattribute:: cuda.bindings.driver.CUresourceViewFormat.CU_RES_VIEW_FORMAT_FLOAT_4X16 + + + 4 channel 16-bit floating point + + + .. autoattribute:: cuda.bindings.driver.CUresourceViewFormat.CU_RES_VIEW_FORMAT_FLOAT_1X32 + + + 1 channel 32-bit floating point + + + .. autoattribute:: cuda.bindings.driver.CUresourceViewFormat.CU_RES_VIEW_FORMAT_FLOAT_2X32 + + + 2 channel 32-bit floating point + + + .. autoattribute:: cuda.bindings.driver.CUresourceViewFormat.CU_RES_VIEW_FORMAT_FLOAT_4X32 + + + 4 channel 32-bit floating point + + + .. autoattribute:: cuda.bindings.driver.CUresourceViewFormat.CU_RES_VIEW_FORMAT_UNSIGNED_BC1 + + + Block compressed 1 + + + .. autoattribute:: cuda.bindings.driver.CUresourceViewFormat.CU_RES_VIEW_FORMAT_UNSIGNED_BC2 + + + Block compressed 2 + + + .. autoattribute:: cuda.bindings.driver.CUresourceViewFormat.CU_RES_VIEW_FORMAT_UNSIGNED_BC3 + + + Block compressed 3 + + + .. autoattribute:: cuda.bindings.driver.CUresourceViewFormat.CU_RES_VIEW_FORMAT_UNSIGNED_BC4 + + + Block compressed 4 unsigned + + + .. autoattribute:: cuda.bindings.driver.CUresourceViewFormat.CU_RES_VIEW_FORMAT_SIGNED_BC4 + + + Block compressed 4 signed + + + .. autoattribute:: cuda.bindings.driver.CUresourceViewFormat.CU_RES_VIEW_FORMAT_UNSIGNED_BC5 + + + Block compressed 5 unsigned + + + .. autoattribute:: cuda.bindings.driver.CUresourceViewFormat.CU_RES_VIEW_FORMAT_SIGNED_BC5 + + + Block compressed 5 signed + + + .. autoattribute:: cuda.bindings.driver.CUresourceViewFormat.CU_RES_VIEW_FORMAT_UNSIGNED_BC6H + + + Block compressed 6 unsigned half-float + + + .. autoattribute:: cuda.bindings.driver.CUresourceViewFormat.CU_RES_VIEW_FORMAT_SIGNED_BC6H + + + Block compressed 6 signed half-float + + + .. autoattribute:: cuda.bindings.driver.CUresourceViewFormat.CU_RES_VIEW_FORMAT_UNSIGNED_BC7 + + + Block compressed 7 + +.. autoclass:: cuda.bindings.driver.CUtensorMapDataType + + .. autoattribute:: cuda.bindings.driver.CUtensorMapDataType.CU_TENSOR_MAP_DATA_TYPE_UINT8 + + + .. autoattribute:: cuda.bindings.driver.CUtensorMapDataType.CU_TENSOR_MAP_DATA_TYPE_UINT16 + + + .. autoattribute:: cuda.bindings.driver.CUtensorMapDataType.CU_TENSOR_MAP_DATA_TYPE_UINT32 + + + .. autoattribute:: cuda.bindings.driver.CUtensorMapDataType.CU_TENSOR_MAP_DATA_TYPE_INT32 + + + .. autoattribute:: cuda.bindings.driver.CUtensorMapDataType.CU_TENSOR_MAP_DATA_TYPE_UINT64 + + + .. autoattribute:: cuda.bindings.driver.CUtensorMapDataType.CU_TENSOR_MAP_DATA_TYPE_INT64 + + + .. autoattribute:: cuda.bindings.driver.CUtensorMapDataType.CU_TENSOR_MAP_DATA_TYPE_FLOAT16 + + + .. autoattribute:: cuda.bindings.driver.CUtensorMapDataType.CU_TENSOR_MAP_DATA_TYPE_FLOAT32 + + + .. autoattribute:: cuda.bindings.driver.CUtensorMapDataType.CU_TENSOR_MAP_DATA_TYPE_FLOAT64 + + + .. autoattribute:: cuda.bindings.driver.CUtensorMapDataType.CU_TENSOR_MAP_DATA_TYPE_BFLOAT16 + + + .. autoattribute:: cuda.bindings.driver.CUtensorMapDataType.CU_TENSOR_MAP_DATA_TYPE_FLOAT32_FTZ + + + .. autoattribute:: cuda.bindings.driver.CUtensorMapDataType.CU_TENSOR_MAP_DATA_TYPE_TFLOAT32 + + + .. autoattribute:: cuda.bindings.driver.CUtensorMapDataType.CU_TENSOR_MAP_DATA_TYPE_TFLOAT32_FTZ + + + .. autoattribute:: cuda.bindings.driver.CUtensorMapDataType.CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN8B + + + .. autoattribute:: cuda.bindings.driver.CUtensorMapDataType.CU_TENSOR_MAP_DATA_TYPE_16U4_ALIGN16B + + + .. autoattribute:: cuda.bindings.driver.CUtensorMapDataType.CU_TENSOR_MAP_DATA_TYPE_16U6_ALIGN16B + +.. autoclass:: cuda.bindings.driver.CUtensorMapInterleave + + .. autoattribute:: cuda.bindings.driver.CUtensorMapInterleave.CU_TENSOR_MAP_INTERLEAVE_NONE + + + .. autoattribute:: cuda.bindings.driver.CUtensorMapInterleave.CU_TENSOR_MAP_INTERLEAVE_16B + + + .. autoattribute:: cuda.bindings.driver.CUtensorMapInterleave.CU_TENSOR_MAP_INTERLEAVE_32B + +.. autoclass:: cuda.bindings.driver.CUtensorMapSwizzle + + .. autoattribute:: cuda.bindings.driver.CUtensorMapSwizzle.CU_TENSOR_MAP_SWIZZLE_NONE + + + .. autoattribute:: cuda.bindings.driver.CUtensorMapSwizzle.CU_TENSOR_MAP_SWIZZLE_32B + + + .. autoattribute:: cuda.bindings.driver.CUtensorMapSwizzle.CU_TENSOR_MAP_SWIZZLE_64B + + + .. autoattribute:: cuda.bindings.driver.CUtensorMapSwizzle.CU_TENSOR_MAP_SWIZZLE_128B + + + .. autoattribute:: cuda.bindings.driver.CUtensorMapSwizzle.CU_TENSOR_MAP_SWIZZLE_128B_ATOM_32B + + + .. autoattribute:: cuda.bindings.driver.CUtensorMapSwizzle.CU_TENSOR_MAP_SWIZZLE_128B_ATOM_32B_FLIP_8B + + + .. autoattribute:: cuda.bindings.driver.CUtensorMapSwizzle.CU_TENSOR_MAP_SWIZZLE_128B_ATOM_64B + +.. autoclass:: cuda.bindings.driver.CUtensorMapL2promotion + + .. autoattribute:: cuda.bindings.driver.CUtensorMapL2promotion.CU_TENSOR_MAP_L2_PROMOTION_NONE + + + .. autoattribute:: cuda.bindings.driver.CUtensorMapL2promotion.CU_TENSOR_MAP_L2_PROMOTION_L2_64B + + + .. autoattribute:: cuda.bindings.driver.CUtensorMapL2promotion.CU_TENSOR_MAP_L2_PROMOTION_L2_128B + + + .. autoattribute:: cuda.bindings.driver.CUtensorMapL2promotion.CU_TENSOR_MAP_L2_PROMOTION_L2_256B + +.. autoclass:: cuda.bindings.driver.CUtensorMapFloatOOBfill + + .. autoattribute:: cuda.bindings.driver.CUtensorMapFloatOOBfill.CU_TENSOR_MAP_FLOAT_OOB_FILL_NONE + + + .. autoattribute:: cuda.bindings.driver.CUtensorMapFloatOOBfill.CU_TENSOR_MAP_FLOAT_OOB_FILL_NAN_REQUEST_ZERO_FMA + +.. autoclass:: cuda.bindings.driver.CUtensorMapIm2ColWideMode + + .. autoattribute:: cuda.bindings.driver.CUtensorMapIm2ColWideMode.CU_TENSOR_MAP_IM2COL_WIDE_MODE_W + + + .. autoattribute:: cuda.bindings.driver.CUtensorMapIm2ColWideMode.CU_TENSOR_MAP_IM2COL_WIDE_MODE_W128 + +.. autoclass:: cuda.bindings.driver.CUDA_POINTER_ATTRIBUTE_ACCESS_FLAGS + + .. autoattribute:: cuda.bindings.driver.CUDA_POINTER_ATTRIBUTE_ACCESS_FLAGS.CU_POINTER_ATTRIBUTE_ACCESS_FLAG_NONE + + + No access, meaning the device cannot access this memory at all, thus must be staged through accessible memory in order to complete certain operations + + + .. autoattribute:: cuda.bindings.driver.CUDA_POINTER_ATTRIBUTE_ACCESS_FLAGS.CU_POINTER_ATTRIBUTE_ACCESS_FLAG_READ + + + Read-only access, meaning writes to this memory are considered invalid accesses and thus return error in that case. + + + .. autoattribute:: cuda.bindings.driver.CUDA_POINTER_ATTRIBUTE_ACCESS_FLAGS.CU_POINTER_ATTRIBUTE_ACCESS_FLAG_READWRITE + + + Read-write access, the device has full read-write access to the memory + +.. autoclass:: cuda.bindings.driver.CUexternalMemoryHandleType + + .. autoattribute:: cuda.bindings.driver.CUexternalMemoryHandleType.CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD + + + Handle is an opaque file descriptor + + + .. autoattribute:: cuda.bindings.driver.CUexternalMemoryHandleType.CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32 + + + Handle is an opaque shared NT handle + + + .. autoattribute:: cuda.bindings.driver.CUexternalMemoryHandleType.CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT + + + Handle is an opaque, globally shared handle + + + .. autoattribute:: cuda.bindings.driver.CUexternalMemoryHandleType.CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP + + + Handle is a D3D12 heap object + + + .. autoattribute:: cuda.bindings.driver.CUexternalMemoryHandleType.CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE + + + Handle is a D3D12 committed resource + + + .. autoattribute:: cuda.bindings.driver.CUexternalMemoryHandleType.CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE + + + Handle is a shared NT handle to a D3D11 resource + + + .. autoattribute:: cuda.bindings.driver.CUexternalMemoryHandleType.CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE_KMT + + + Handle is a globally shared handle to a D3D11 resource + + + .. autoattribute:: cuda.bindings.driver.CUexternalMemoryHandleType.CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF + + + Handle is an NvSciBuf object + + + .. autoattribute:: cuda.bindings.driver.CUexternalMemoryHandleType.CU_EXTERNAL_MEMORY_HANDLE_TYPE_DMABUF_FD + + + Handle is a dma_buf file descriptor + +.. autoclass:: cuda.bindings.driver.CUexternalSemaphoreHandleType + + .. autoattribute:: cuda.bindings.driver.CUexternalSemaphoreHandleType.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD + + + Handle is an opaque file descriptor + + + .. autoattribute:: cuda.bindings.driver.CUexternalSemaphoreHandleType.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32 + + + Handle is an opaque shared NT handle + + + .. autoattribute:: cuda.bindings.driver.CUexternalSemaphoreHandleType.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT + + + Handle is an opaque, globally shared handle + + + .. autoattribute:: cuda.bindings.driver.CUexternalSemaphoreHandleType.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE + + + Handle is a shared NT handle referencing a D3D12 fence object + + + .. autoattribute:: cuda.bindings.driver.CUexternalSemaphoreHandleType.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_FENCE + + + Handle is a shared NT handle referencing a D3D11 fence object + + + .. autoattribute:: cuda.bindings.driver.CUexternalSemaphoreHandleType.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC + + + Opaque handle to NvSciSync Object + + + .. autoattribute:: cuda.bindings.driver.CUexternalSemaphoreHandleType.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX + + + Handle is a shared NT handle referencing a D3D11 keyed mutex object + + + .. autoattribute:: cuda.bindings.driver.CUexternalSemaphoreHandleType.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX_KMT + + + Handle is a globally shared handle referencing a D3D11 keyed mutex object + + + .. autoattribute:: cuda.bindings.driver.CUexternalSemaphoreHandleType.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_FD + + + Handle is an opaque file descriptor referencing a timeline semaphore + + + .. autoattribute:: cuda.bindings.driver.CUexternalSemaphoreHandleType.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_WIN32 + + + Handle is an opaque shared NT handle referencing a timeline semaphore + +.. autoclass:: cuda.bindings.driver.CUmemAllocationHandleType + + .. autoattribute:: cuda.bindings.driver.CUmemAllocationHandleType.CU_MEM_HANDLE_TYPE_NONE + + + Does not allow any export mechanism. > + + + .. autoattribute:: cuda.bindings.driver.CUmemAllocationHandleType.CU_MEM_HANDLE_TYPE_POSIX_FILE_DESCRIPTOR + + + Allows a file descriptor to be used for exporting. Permitted only on POSIX systems. (int) + + + .. autoattribute:: cuda.bindings.driver.CUmemAllocationHandleType.CU_MEM_HANDLE_TYPE_WIN32 + + + Allows a Win32 NT handle to be used for exporting. (HANDLE) + + + .. autoattribute:: cuda.bindings.driver.CUmemAllocationHandleType.CU_MEM_HANDLE_TYPE_WIN32_KMT + + + Allows a Win32 KMT handle to be used for exporting. (D3DKMT_HANDLE) + + + .. autoattribute:: cuda.bindings.driver.CUmemAllocationHandleType.CU_MEM_HANDLE_TYPE_FABRIC + + + Allows a fabric handle to be used for exporting. (:py:obj:`~.CUmemFabricHandle`) + + + .. autoattribute:: cuda.bindings.driver.CUmemAllocationHandleType.CU_MEM_HANDLE_TYPE_MAX + +.. autoclass:: cuda.bindings.driver.CUmemAccess_flags + + .. autoattribute:: cuda.bindings.driver.CUmemAccess_flags.CU_MEM_ACCESS_FLAGS_PROT_NONE + + + Default, make the address range not accessible + + + .. autoattribute:: cuda.bindings.driver.CUmemAccess_flags.CU_MEM_ACCESS_FLAGS_PROT_READ + + + Make the address range read accessible + + + .. autoattribute:: cuda.bindings.driver.CUmemAccess_flags.CU_MEM_ACCESS_FLAGS_PROT_READWRITE + + + Make the address range read-write accessible + + + .. autoattribute:: cuda.bindings.driver.CUmemAccess_flags.CU_MEM_ACCESS_FLAGS_PROT_MAX + +.. autoclass:: cuda.bindings.driver.CUmemLocationType + + .. autoattribute:: cuda.bindings.driver.CUmemLocationType.CU_MEM_LOCATION_TYPE_INVALID + + + .. autoattribute:: cuda.bindings.driver.CUmemLocationType.CU_MEM_LOCATION_TYPE_NONE + + + Location is unspecified. This is used when creating a managed memory pool to indicate no preferred location for the pool + + + .. autoattribute:: cuda.bindings.driver.CUmemLocationType.CU_MEM_LOCATION_TYPE_DEVICE + + + Location is a device location, thus id is a device ordinal + + + .. autoattribute:: cuda.bindings.driver.CUmemLocationType.CU_MEM_LOCATION_TYPE_HOST + + + Location is host, id is ignored + + + .. autoattribute:: cuda.bindings.driver.CUmemLocationType.CU_MEM_LOCATION_TYPE_HOST_NUMA + + + Location is a host NUMA node, thus id is a host NUMA node id + + + .. autoattribute:: cuda.bindings.driver.CUmemLocationType.CU_MEM_LOCATION_TYPE_HOST_NUMA_CURRENT + + + Location is a host NUMA node of the current thread, id is ignored + + + .. autoattribute:: cuda.bindings.driver.CUmemLocationType.CU_MEM_LOCATION_TYPE_INVISIBLE + + + Location is not visible but device is accessible, id is always CU_DEVICE_INVALID + + + .. autoattribute:: cuda.bindings.driver.CUmemLocationType.CU_MEM_LOCATION_TYPE_MAX + +.. autoclass:: cuda.bindings.driver.CUmemAllocationType + + .. autoattribute:: cuda.bindings.driver.CUmemAllocationType.CU_MEM_ALLOCATION_TYPE_INVALID + + + .. autoattribute:: cuda.bindings.driver.CUmemAllocationType.CU_MEM_ALLOCATION_TYPE_PINNED + + + This allocation type is 'pinned', i.e. cannot migrate from its current location while the application is actively using it + + + .. autoattribute:: cuda.bindings.driver.CUmemAllocationType.CU_MEM_ALLOCATION_TYPE_MANAGED + + + This allocation type is managed memory + + + .. autoattribute:: cuda.bindings.driver.CUmemAllocationType.CU_MEM_ALLOCATION_TYPE_MAX + +.. autoclass:: cuda.bindings.driver.CUmemAllocationGranularity_flags + + .. autoattribute:: cuda.bindings.driver.CUmemAllocationGranularity_flags.CU_MEM_ALLOC_GRANULARITY_MINIMUM + + + Minimum required granularity for allocation + + + .. autoattribute:: cuda.bindings.driver.CUmemAllocationGranularity_flags.CU_MEM_ALLOC_GRANULARITY_RECOMMENDED + + + Recommended granularity for allocation for best performance + +.. autoclass:: cuda.bindings.driver.CUmemRangeHandleType + + .. autoattribute:: cuda.bindings.driver.CUmemRangeHandleType.CU_MEM_RANGE_HANDLE_TYPE_DMA_BUF_FD + + + .. autoattribute:: cuda.bindings.driver.CUmemRangeHandleType.CU_MEM_RANGE_HANDLE_TYPE_MAX + +.. autoclass:: cuda.bindings.driver.CUmemRangeFlags + + .. autoattribute:: cuda.bindings.driver.CUmemRangeFlags.CU_MEM_RANGE_FLAG_DMA_BUF_MAPPING_TYPE_PCIE + + + Indicates that DMA_BUF handle should be mapped via PCIe BAR1 + +.. autoclass:: cuda.bindings.driver.CUarraySparseSubresourceType + + .. autoattribute:: cuda.bindings.driver.CUarraySparseSubresourceType.CU_ARRAY_SPARSE_SUBRESOURCE_TYPE_SPARSE_LEVEL + + + .. autoattribute:: cuda.bindings.driver.CUarraySparseSubresourceType.CU_ARRAY_SPARSE_SUBRESOURCE_TYPE_MIPTAIL + +.. autoclass:: cuda.bindings.driver.CUmemOperationType + + .. autoattribute:: cuda.bindings.driver.CUmemOperationType.CU_MEM_OPERATION_TYPE_MAP + + + .. autoattribute:: cuda.bindings.driver.CUmemOperationType.CU_MEM_OPERATION_TYPE_UNMAP + +.. autoclass:: cuda.bindings.driver.CUmemHandleType + + .. autoattribute:: cuda.bindings.driver.CUmemHandleType.CU_MEM_HANDLE_TYPE_GENERIC + +.. autoclass:: cuda.bindings.driver.CUmemAllocationCompType + + .. autoattribute:: cuda.bindings.driver.CUmemAllocationCompType.CU_MEM_ALLOCATION_COMP_NONE + + + Allocating non-compressible memory + + + .. autoattribute:: cuda.bindings.driver.CUmemAllocationCompType.CU_MEM_ALLOCATION_COMP_GENERIC + + + Allocating compressible memory + +.. autoclass:: cuda.bindings.driver.CUmulticastGranularity_flags + + .. autoattribute:: cuda.bindings.driver.CUmulticastGranularity_flags.CU_MULTICAST_GRANULARITY_MINIMUM + + + Minimum required granularity + + + .. autoattribute:: cuda.bindings.driver.CUmulticastGranularity_flags.CU_MULTICAST_GRANULARITY_RECOMMENDED + + + Recommended granularity for best performance + +.. autoclass:: cuda.bindings.driver.CUgraphExecUpdateResult + + .. autoattribute:: cuda.bindings.driver.CUgraphExecUpdateResult.CU_GRAPH_EXEC_UPDATE_SUCCESS + + + The update succeeded + + + .. autoattribute:: cuda.bindings.driver.CUgraphExecUpdateResult.CU_GRAPH_EXEC_UPDATE_ERROR + + + The update failed for an unexpected reason which is described in the return value of the function + + + .. autoattribute:: cuda.bindings.driver.CUgraphExecUpdateResult.CU_GRAPH_EXEC_UPDATE_ERROR_TOPOLOGY_CHANGED + + + The update failed because the topology changed + + + .. autoattribute:: cuda.bindings.driver.CUgraphExecUpdateResult.CU_GRAPH_EXEC_UPDATE_ERROR_NODE_TYPE_CHANGED + + + The update failed because a node type changed + + + .. autoattribute:: cuda.bindings.driver.CUgraphExecUpdateResult.CU_GRAPH_EXEC_UPDATE_ERROR_FUNCTION_CHANGED + + + The update failed because the function of a kernel node changed (CUDA driver < 11.2) + + + .. autoattribute:: cuda.bindings.driver.CUgraphExecUpdateResult.CU_GRAPH_EXEC_UPDATE_ERROR_PARAMETERS_CHANGED + + + The update failed because the parameters changed in a way that is not supported + + + .. autoattribute:: cuda.bindings.driver.CUgraphExecUpdateResult.CU_GRAPH_EXEC_UPDATE_ERROR_NOT_SUPPORTED + + + The update failed because something about the node is not supported + + + .. autoattribute:: cuda.bindings.driver.CUgraphExecUpdateResult.CU_GRAPH_EXEC_UPDATE_ERROR_UNSUPPORTED_FUNCTION_CHANGE + + + The update failed because the function of a kernel node changed in an unsupported way + + + .. autoattribute:: cuda.bindings.driver.CUgraphExecUpdateResult.CU_GRAPH_EXEC_UPDATE_ERROR_ATTRIBUTES_CHANGED + + + The update failed because the node attributes changed in a way that is not supported + +.. autoclass:: cuda.bindings.driver.CUmemPool_attribute + + .. autoattribute:: cuda.bindings.driver.CUmemPool_attribute.CU_MEMPOOL_ATTR_REUSE_FOLLOW_EVENT_DEPENDENCIES + + + (value type = int) Allow cuMemAllocAsync to use memory asynchronously freed in another streams as long as a stream ordering dependency of the allocating stream on the free action exists. Cuda events and null stream interactions can create the required stream ordered dependencies. (default enabled) + + + .. autoattribute:: cuda.bindings.driver.CUmemPool_attribute.CU_MEMPOOL_ATTR_REUSE_ALLOW_OPPORTUNISTIC + + + (value type = int) Allow reuse of already completed frees when there is no dependency between the free and allocation. (default enabled) + + + .. autoattribute:: cuda.bindings.driver.CUmemPool_attribute.CU_MEMPOOL_ATTR_REUSE_ALLOW_INTERNAL_DEPENDENCIES + + + (value type = int) Allow cuMemAllocAsync to insert new stream dependencies in order to establish the stream ordering required to reuse a piece of memory released by cuMemFreeAsync (default enabled). + + + .. autoattribute:: cuda.bindings.driver.CUmemPool_attribute.CU_MEMPOOL_ATTR_RELEASE_THRESHOLD + + + (value type = :py:obj:`~.cuuint64_t`) Amount of reserved memory in bytes to hold onto before trying to release memory back to the OS. When more than the release threshold bytes of memory are held by the memory pool, the allocator will try to release memory back to the OS on the next call to stream, event or context synchronize. (default 0) + + + .. autoattribute:: cuda.bindings.driver.CUmemPool_attribute.CU_MEMPOOL_ATTR_RESERVED_MEM_CURRENT + + + (value type = :py:obj:`~.cuuint64_t`) Amount of backing memory currently allocated for the mempool. + + + .. autoattribute:: cuda.bindings.driver.CUmemPool_attribute.CU_MEMPOOL_ATTR_RESERVED_MEM_HIGH + + + (value type = :py:obj:`~.cuuint64_t`) High watermark of backing memory allocated for the mempool since the last time it was reset. High watermark can only be reset to zero. + + + .. autoattribute:: cuda.bindings.driver.CUmemPool_attribute.CU_MEMPOOL_ATTR_USED_MEM_CURRENT + + + (value type = :py:obj:`~.cuuint64_t`) Amount of memory from the pool that is currently in use by the application. + + + .. autoattribute:: cuda.bindings.driver.CUmemPool_attribute.CU_MEMPOOL_ATTR_USED_MEM_HIGH + + + (value type = :py:obj:`~.cuuint64_t`) High watermark of the amount of memory from the pool that was in use by the application since the last time it was reset. High watermark can only be reset to zero. + + + .. autoattribute:: cuda.bindings.driver.CUmemPool_attribute.CU_MEMPOOL_ATTR_ALLOCATION_TYPE + + + (value type = :py:obj:`~.CUmemAllocationType`) The allocation type of the mempool + + + .. autoattribute:: cuda.bindings.driver.CUmemPool_attribute.CU_MEMPOOL_ATTR_EXPORT_HANDLE_TYPES + + + (value type = :py:obj:`~.CUmemAllocationHandleType`) Available export handle types for the mempool. For imported pools this value is always CU_MEM_HANDLE_TYPE_NONE as an imported pool cannot be re-exported + + + .. autoattribute:: cuda.bindings.driver.CUmemPool_attribute.CU_MEMPOOL_ATTR_LOCATION_ID + + + (value type = int) The location id for the mempool. If the location type for this pool is CU_MEM_LOCATION_TYPE_INVISIBLE then ID will be CU_DEVICE_INVALID. + + + .. autoattribute:: cuda.bindings.driver.CUmemPool_attribute.CU_MEMPOOL_ATTR_LOCATION_TYPE + + + (value type = :py:obj:`~.CUmemLocationType`) The location type for the mempool. For imported memory pools where the device is not directly visible to the importing process or pools imported via fabric handles across nodes this will be CU_MEM_LOCATION_TYPE_INVISIBLE. + + + .. autoattribute:: cuda.bindings.driver.CUmemPool_attribute.CU_MEMPOOL_ATTR_MAX_POOL_SIZE + + + (value type = :py:obj:`~.cuuint64_t`) Maximum size of the pool in bytes, this value may be higher than what was initially passed to cuMemPoolCreate due to alignment requirements. A value of 0 indicates no maximum size. For CU_MEM_ALLOCATION_TYPE_MANAGED and IPC imported pools this value will be system dependent. + + + .. autoattribute:: cuda.bindings.driver.CUmemPool_attribute.CU_MEMPOOL_ATTR_HW_DECOMPRESS_ENABLED + + + (value type = int) Indicates whether the pool has hardware compresssion enabled + +.. autoclass:: cuda.bindings.driver.CUmemcpyFlags + + .. autoattribute:: cuda.bindings.driver.CUmemcpyFlags.CU_MEMCPY_FLAG_DEFAULT + + + .. autoattribute:: cuda.bindings.driver.CUmemcpyFlags.CU_MEMCPY_FLAG_PREFER_OVERLAP_WITH_COMPUTE + + + Hint to the driver to try and overlap the copy with compute work on the SMs. + +.. autoclass:: cuda.bindings.driver.CUmemcpySrcAccessOrder + + .. autoattribute:: cuda.bindings.driver.CUmemcpySrcAccessOrder.CU_MEMCPY_SRC_ACCESS_ORDER_INVALID + + + Default invalid. + + + .. autoattribute:: cuda.bindings.driver.CUmemcpySrcAccessOrder.CU_MEMCPY_SRC_ACCESS_ORDER_STREAM + + + Indicates that access to the source pointer must be in stream order. + + + .. autoattribute:: cuda.bindings.driver.CUmemcpySrcAccessOrder.CU_MEMCPY_SRC_ACCESS_ORDER_DURING_API_CALL + + + Indicates that access to the source pointer can be out of stream order and all accesses must be complete before the API call returns. This flag is suited for ephemeral sources (ex., stack variables) when it's known that no prior operations in the stream can be accessing the memory and also that the lifetime of the memory is limited to the scope that the source variable was declared in. Specifying this flag allows the driver to optimize the copy and removes the need for the user to synchronize the stream after the API call. + + + .. autoattribute:: cuda.bindings.driver.CUmemcpySrcAccessOrder.CU_MEMCPY_SRC_ACCESS_ORDER_ANY + + + Indicates that access to the source pointer can be out of stream order and the accesses can happen even after the API call returns. This flag is suited for host pointers allocated outside CUDA (ex., via malloc) when it's known that no prior operations in the stream can be accessing the memory. Specifying this flag allows the driver to optimize the copy on certain platforms. + + + .. autoattribute:: cuda.bindings.driver.CUmemcpySrcAccessOrder.CU_MEMCPY_SRC_ACCESS_ORDER_MAX + +.. autoclass:: cuda.bindings.driver.CUmemcpy3DOperandType + + .. autoattribute:: cuda.bindings.driver.CUmemcpy3DOperandType.CU_MEMCPY_OPERAND_TYPE_POINTER + + + Memcpy operand is a valid pointer. + + + .. autoattribute:: cuda.bindings.driver.CUmemcpy3DOperandType.CU_MEMCPY_OPERAND_TYPE_ARRAY + + + Memcpy operand is a :py:obj:`~.CUarray`. + + + .. autoattribute:: cuda.bindings.driver.CUmemcpy3DOperandType.CU_MEMCPY_OPERAND_TYPE_MAX + +.. autoclass:: cuda.bindings.driver.CUgraphMem_attribute + + .. autoattribute:: cuda.bindings.driver.CUgraphMem_attribute.CU_GRAPH_MEM_ATTR_USED_MEM_CURRENT + + + (value type = :py:obj:`~.cuuint64_t`) Amount of memory, in bytes, currently associated with graphs + + + .. autoattribute:: cuda.bindings.driver.CUgraphMem_attribute.CU_GRAPH_MEM_ATTR_USED_MEM_HIGH + + + (value type = :py:obj:`~.cuuint64_t`) High watermark of memory, in bytes, associated with graphs since the last time it was reset. High watermark can only be reset to zero. + + + .. autoattribute:: cuda.bindings.driver.CUgraphMem_attribute.CU_GRAPH_MEM_ATTR_RESERVED_MEM_CURRENT + + + (value type = :py:obj:`~.cuuint64_t`) Amount of memory, in bytes, currently allocated for use by the CUDA graphs asynchronous allocator. + + + .. autoattribute:: cuda.bindings.driver.CUgraphMem_attribute.CU_GRAPH_MEM_ATTR_RESERVED_MEM_HIGH + + + (value type = :py:obj:`~.cuuint64_t`) High watermark of memory, in bytes, currently allocated for use by the CUDA graphs asynchronous allocator. + +.. autoclass:: cuda.bindings.driver.CUgraphChildGraphNodeOwnership + + .. autoattribute:: cuda.bindings.driver.CUgraphChildGraphNodeOwnership.CU_GRAPH_CHILD_GRAPH_OWNERSHIP_CLONE + + + Default behavior for a child graph node. Child graph is cloned into the parent and memory allocation/free nodes can't be present in the child graph. + + + .. autoattribute:: cuda.bindings.driver.CUgraphChildGraphNodeOwnership.CU_GRAPH_CHILD_GRAPH_OWNERSHIP_MOVE + + + The child graph is moved to the parent. The handle to the child graph is owned by the parent and will be destroyed when the parent is destroyed. + + + + The following restrictions apply to child graphs after they have been moved: Cannot be independently instantiated or destroyed; Cannot be added as a child graph of a separate parent graph; Cannot be used as an argument to cuGraphExecUpdate; Cannot have additional memory allocation or free nodes added. + + + .. autoattribute:: cuda.bindings.driver.CUgraphChildGraphNodeOwnership.CU_GRAPH_CHILD_GRAPH_OWNERSHIP_INVALID + + + Invalid ownership flag. Set when params are queried to prevent accidentally reusing the driver-owned graph object + +.. autoclass:: cuda.bindings.driver.CUflushGPUDirectRDMAWritesOptions + + .. autoattribute:: cuda.bindings.driver.CUflushGPUDirectRDMAWritesOptions.CU_FLUSH_GPU_DIRECT_RDMA_WRITES_OPTION_HOST + + + :py:obj:`~.cuFlushGPUDirectRDMAWrites()` and its CUDA Runtime API counterpart are supported on the device. + + + .. autoattribute:: cuda.bindings.driver.CUflushGPUDirectRDMAWritesOptions.CU_FLUSH_GPU_DIRECT_RDMA_WRITES_OPTION_MEMOPS + + + The :py:obj:`~.CU_STREAM_WAIT_VALUE_FLUSH` flag and the :py:obj:`~.CU_STREAM_MEM_OP_FLUSH_REMOTE_WRITES` MemOp are supported on the device. + +.. autoclass:: cuda.bindings.driver.CUGPUDirectRDMAWritesOrdering + + .. autoattribute:: cuda.bindings.driver.CUGPUDirectRDMAWritesOrdering.CU_GPU_DIRECT_RDMA_WRITES_ORDERING_NONE + + + The device does not natively support ordering of remote writes. :py:obj:`~.cuFlushGPUDirectRDMAWrites()` can be leveraged if supported. + + + .. autoattribute:: cuda.bindings.driver.CUGPUDirectRDMAWritesOrdering.CU_GPU_DIRECT_RDMA_WRITES_ORDERING_OWNER + + + Natively, the device can consistently consume remote writes, although other CUDA devices may not. + + + .. autoattribute:: cuda.bindings.driver.CUGPUDirectRDMAWritesOrdering.CU_GPU_DIRECT_RDMA_WRITES_ORDERING_ALL_DEVICES + + + Any CUDA device in the system can consistently consume remote writes to this device. + +.. autoclass:: cuda.bindings.driver.CUflushGPUDirectRDMAWritesScope + + .. autoattribute:: cuda.bindings.driver.CUflushGPUDirectRDMAWritesScope.CU_FLUSH_GPU_DIRECT_RDMA_WRITES_TO_OWNER + + + Blocks until remote writes are visible to the CUDA device context owning the data. + + + .. autoattribute:: cuda.bindings.driver.CUflushGPUDirectRDMAWritesScope.CU_FLUSH_GPU_DIRECT_RDMA_WRITES_TO_ALL_DEVICES + + + Blocks until remote writes are visible to all CUDA device contexts. + +.. autoclass:: cuda.bindings.driver.CUflushGPUDirectRDMAWritesTarget + + .. autoattribute:: cuda.bindings.driver.CUflushGPUDirectRDMAWritesTarget.CU_FLUSH_GPU_DIRECT_RDMA_WRITES_TARGET_CURRENT_CTX + + + Sets the target for :py:obj:`~.cuFlushGPUDirectRDMAWrites()` to the currently active CUDA device context. + +.. autoclass:: cuda.bindings.driver.CUgraphDebugDot_flags + + .. autoattribute:: cuda.bindings.driver.CUgraphDebugDot_flags.CU_GRAPH_DEBUG_DOT_FLAGS_VERBOSE + + + Output all debug data as if every debug flag is enabled + + + .. autoattribute:: cuda.bindings.driver.CUgraphDebugDot_flags.CU_GRAPH_DEBUG_DOT_FLAGS_RUNTIME_TYPES + + + Use CUDA Runtime structures for output + + + .. autoattribute:: cuda.bindings.driver.CUgraphDebugDot_flags.CU_GRAPH_DEBUG_DOT_FLAGS_KERNEL_NODE_PARAMS + + + Adds :py:obj:`~.CUDA_KERNEL_NODE_PARAMS` values to output + + + .. autoattribute:: cuda.bindings.driver.CUgraphDebugDot_flags.CU_GRAPH_DEBUG_DOT_FLAGS_MEMCPY_NODE_PARAMS + + + Adds :py:obj:`~.CUDA_MEMCPY3D` values to output + + + .. autoattribute:: cuda.bindings.driver.CUgraphDebugDot_flags.CU_GRAPH_DEBUG_DOT_FLAGS_MEMSET_NODE_PARAMS + + + Adds :py:obj:`~.CUDA_MEMSET_NODE_PARAMS` values to output + + + .. autoattribute:: cuda.bindings.driver.CUgraphDebugDot_flags.CU_GRAPH_DEBUG_DOT_FLAGS_HOST_NODE_PARAMS + + + Adds :py:obj:`~.CUDA_HOST_NODE_PARAMS` values to output + + + .. autoattribute:: cuda.bindings.driver.CUgraphDebugDot_flags.CU_GRAPH_DEBUG_DOT_FLAGS_EVENT_NODE_PARAMS + + + Adds :py:obj:`~.CUevent` handle from record and wait nodes to output + + + .. autoattribute:: cuda.bindings.driver.CUgraphDebugDot_flags.CU_GRAPH_DEBUG_DOT_FLAGS_EXT_SEMAS_SIGNAL_NODE_PARAMS + + + Adds :py:obj:`~.CUDA_EXT_SEM_SIGNAL_NODE_PARAMS` values to output + + + .. autoattribute:: cuda.bindings.driver.CUgraphDebugDot_flags.CU_GRAPH_DEBUG_DOT_FLAGS_EXT_SEMAS_WAIT_NODE_PARAMS + + + Adds :py:obj:`~.CUDA_EXT_SEM_WAIT_NODE_PARAMS` values to output + + + .. autoattribute:: cuda.bindings.driver.CUgraphDebugDot_flags.CU_GRAPH_DEBUG_DOT_FLAGS_KERNEL_NODE_ATTRIBUTES + + + Adds :py:obj:`~.CUkernelNodeAttrValue` values to output + + + .. autoattribute:: cuda.bindings.driver.CUgraphDebugDot_flags.CU_GRAPH_DEBUG_DOT_FLAGS_HANDLES + + + Adds node handles and every kernel function handle to output + + + .. autoattribute:: cuda.bindings.driver.CUgraphDebugDot_flags.CU_GRAPH_DEBUG_DOT_FLAGS_MEM_ALLOC_NODE_PARAMS + + + Adds memory alloc node parameters to output + + + .. autoattribute:: cuda.bindings.driver.CUgraphDebugDot_flags.CU_GRAPH_DEBUG_DOT_FLAGS_MEM_FREE_NODE_PARAMS + + + Adds memory free node parameters to output + + + .. autoattribute:: cuda.bindings.driver.CUgraphDebugDot_flags.CU_GRAPH_DEBUG_DOT_FLAGS_BATCH_MEM_OP_NODE_PARAMS + + + Adds batch mem op node parameters to output + + + .. autoattribute:: cuda.bindings.driver.CUgraphDebugDot_flags.CU_GRAPH_DEBUG_DOT_FLAGS_EXTRA_TOPO_INFO + + + Adds edge numbering information + + + .. autoattribute:: cuda.bindings.driver.CUgraphDebugDot_flags.CU_GRAPH_DEBUG_DOT_FLAGS_CONDITIONAL_NODE_PARAMS + + + Adds conditional node parameters to output + +.. autoclass:: cuda.bindings.driver.CUuserObject_flags + + .. autoattribute:: cuda.bindings.driver.CUuserObject_flags.CU_USER_OBJECT_NO_DESTRUCTOR_SYNC + + + Indicates the destructor execution is not synchronized by any CUDA handle. + +.. autoclass:: cuda.bindings.driver.CUuserObjectRetain_flags + + .. autoattribute:: cuda.bindings.driver.CUuserObjectRetain_flags.CU_GRAPH_USER_OBJECT_MOVE + + + Transfer references from the caller rather than creating new references. + +.. autoclass:: cuda.bindings.driver.CUgraphInstantiate_flags + + .. autoattribute:: cuda.bindings.driver.CUgraphInstantiate_flags.CUDA_GRAPH_INSTANTIATE_FLAG_AUTO_FREE_ON_LAUNCH + + + Automatically free memory allocated in a graph before relaunching. + + + .. autoattribute:: cuda.bindings.driver.CUgraphInstantiate_flags.CUDA_GRAPH_INSTANTIATE_FLAG_UPLOAD + + + Automatically upload the graph after instantiation. Only supported by :py:obj:`~.cuGraphInstantiateWithParams`. The upload will be performed using the stream provided in ``instantiateParams``. + + + .. autoattribute:: cuda.bindings.driver.CUgraphInstantiate_flags.CUDA_GRAPH_INSTANTIATE_FLAG_DEVICE_LAUNCH + + + Instantiate the graph to be launchable from the device. This flag can only be used on platforms which support unified addressing. This flag cannot be used in conjunction with CUDA_GRAPH_INSTANTIATE_FLAG_AUTO_FREE_ON_LAUNCH. + + + .. autoattribute:: cuda.bindings.driver.CUgraphInstantiate_flags.CUDA_GRAPH_INSTANTIATE_FLAG_USE_NODE_PRIORITY + + + Run the graph using the per-node priority attributes rather than the priority of the stream it is launched into. + +.. autoclass:: cuda.bindings.driver.CUdeviceNumaConfig + + .. autoattribute:: cuda.bindings.driver.CUdeviceNumaConfig.CU_DEVICE_NUMA_CONFIG_NONE + + + The GPU is not a NUMA node + + + .. autoattribute:: cuda.bindings.driver.CUdeviceNumaConfig.CU_DEVICE_NUMA_CONFIG_NUMA_NODE + + + The GPU is a NUMA node, CU_DEVICE_ATTRIBUTE_NUMA_ID contains its NUMA ID + +.. autoclass:: cuda.bindings.driver.CUprocessState + + .. autoattribute:: cuda.bindings.driver.CUprocessState.CU_PROCESS_STATE_RUNNING + + + Default process state + + + .. autoattribute:: cuda.bindings.driver.CUprocessState.CU_PROCESS_STATE_LOCKED + + + CUDA API locks are taken so further CUDA API calls will block + + + .. autoattribute:: cuda.bindings.driver.CUprocessState.CU_PROCESS_STATE_CHECKPOINTED + + + Application memory contents have been checkpointed and underlying allocations and device handles have been released + + + .. autoattribute:: cuda.bindings.driver.CUprocessState.CU_PROCESS_STATE_FAILED + + + Application entered an uncorrectable error during the checkpoint/restore process + +.. autoclass:: cuda.bindings.driver.CUeglFrameType + + .. autoattribute:: cuda.bindings.driver.CUeglFrameType.CU_EGL_FRAME_TYPE_ARRAY + + + Frame type CUDA array + + + .. autoattribute:: cuda.bindings.driver.CUeglFrameType.CU_EGL_FRAME_TYPE_PITCH + + + Frame type pointer + +.. autoclass:: cuda.bindings.driver.CUeglResourceLocationFlags + + .. autoattribute:: cuda.bindings.driver.CUeglResourceLocationFlags.CU_EGL_RESOURCE_LOCATION_SYSMEM + + + Resource location sysmem + + + .. autoattribute:: cuda.bindings.driver.CUeglResourceLocationFlags.CU_EGL_RESOURCE_LOCATION_VIDMEM + + + Resource location vidmem + +.. autoclass:: cuda.bindings.driver.CUeglColorFormat + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_YUV420_PLANAR + + + Y, U, V in three surfaces, each in a separate surface, U/V width = 1/2 Y width, U/V height = 1/2 Y height. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR + + + Y, UV in two surfaces (UV as one surface) with VU byte ordering, width, height ratio same as YUV420Planar. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_YUV422_PLANAR + + + Y, U, V each in a separate surface, U/V width = 1/2 Y width, U/V height = Y height. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_YUV422_SEMIPLANAR + + + Y, UV in two surfaces with VU byte ordering, width, height ratio same as YUV422Planar. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_RGB + + + R/G/B three channels in one surface with BGR byte ordering. Only pitch linear format supported. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_BGR + + + R/G/B three channels in one surface with RGB byte ordering. Only pitch linear format supported. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_ARGB + + + R/G/B/A four channels in one surface with BGRA byte ordering. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_RGBA + + + R/G/B/A four channels in one surface with ABGR byte ordering. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_L + + + single luminance channel in one surface. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_R + + + single color channel in one surface. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_YUV444_PLANAR + + + Y, U, V in three surfaces, each in a separate surface, U/V width = Y width, U/V height = Y height. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_YUV444_SEMIPLANAR + + + Y, UV in two surfaces (UV as one surface) with VU byte ordering, width, height ratio same as YUV444Planar. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_YUYV_422 + + + Y, U, V in one surface, interleaved as UYVY in one channel. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_UYVY_422 + + + Y, U, V in one surface, interleaved as YUYV in one channel. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_ABGR + + + R/G/B/A four channels in one surface with RGBA byte ordering. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_BGRA + + + R/G/B/A four channels in one surface with ARGB byte ordering. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_A + + + Alpha color format - one channel in one surface. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_RG + + + R/G color format - two channels in one surface with GR byte ordering + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_AYUV + + + Y, U, V, A four channels in one surface, interleaved as VUYA. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_YVU444_SEMIPLANAR + + + Y, VU in two surfaces (VU as one surface) with UV byte ordering, U/V width = Y width, U/V height = Y height. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_YVU422_SEMIPLANAR + + + Y, VU in two surfaces (VU as one surface) with UV byte ordering, U/V width = 1/2 Y width, U/V height = Y height. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR + + + Y, VU in two surfaces (VU as one surface) with UV byte ordering, U/V width = 1/2 Y width, U/V height = 1/2 Y height. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR + + + Y10, V10U10 in two surfaces (VU as one surface) with UV byte ordering, U/V width = Y width, U/V height = Y height. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR + + + Y10, V10U10 in two surfaces (VU as one surface) with UV byte ordering, U/V width = 1/2 Y width, U/V height = 1/2 Y height. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR + + + Y12, V12U12 in two surfaces (VU as one surface) with UV byte ordering, U/V width = Y width, U/V height = Y height. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR + + + Y12, V12U12 in two surfaces (VU as one surface) with UV byte ordering, U/V width = 1/2 Y width, U/V height = 1/2 Y height. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_VYUY_ER + + + Extended Range Y, U, V in one surface, interleaved as YVYU in one channel. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_UYVY_ER + + + Extended Range Y, U, V in one surface, interleaved as YUYV in one channel. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_YUYV_ER + + + Extended Range Y, U, V in one surface, interleaved as UYVY in one channel. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_YVYU_ER + + + Extended Range Y, U, V in one surface, interleaved as VYUY in one channel. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_YUV_ER + + + Extended Range Y, U, V three channels in one surface, interleaved as VUY. Only pitch linear format supported. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_YUVA_ER + + + Extended Range Y, U, V, A four channels in one surface, interleaved as AVUY. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_AYUV_ER + + + Extended Range Y, U, V, A four channels in one surface, interleaved as VUYA. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_YUV444_PLANAR_ER + + + Extended Range Y, U, V in three surfaces, U/V width = Y width, U/V height = Y height. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_YUV422_PLANAR_ER + + + Extended Range Y, U, V in three surfaces, U/V width = 1/2 Y width, U/V height = Y height. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_YUV420_PLANAR_ER + + + Extended Range Y, U, V in three surfaces, U/V width = 1/2 Y width, U/V height = 1/2 Y height. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_YUV444_SEMIPLANAR_ER + + + Extended Range Y, UV in two surfaces (UV as one surface) with VU byte ordering, U/V width = Y width, U/V height = Y height. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_YUV422_SEMIPLANAR_ER + + + Extended Range Y, UV in two surfaces (UV as one surface) with VU byte ordering, U/V width = 1/2 Y width, U/V height = Y height. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR_ER + + + Extended Range Y, UV in two surfaces (UV as one surface) with VU byte ordering, U/V width = 1/2 Y width, U/V height = 1/2 Y height. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_YVU444_PLANAR_ER + + + Extended Range Y, V, U in three surfaces, U/V width = Y width, U/V height = Y height. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_YVU422_PLANAR_ER + + + Extended Range Y, V, U in three surfaces, U/V width = 1/2 Y width, U/V height = Y height. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_YVU420_PLANAR_ER + + + Extended Range Y, V, U in three surfaces, U/V width = 1/2 Y width, U/V height = 1/2 Y height. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_YVU444_SEMIPLANAR_ER + + + Extended Range Y, VU in two surfaces (VU as one surface) with UV byte ordering, U/V width = Y width, U/V height = Y height. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_YVU422_SEMIPLANAR_ER + + + Extended Range Y, VU in two surfaces (VU as one surface) with UV byte ordering, U/V width = 1/2 Y width, U/V height = Y height. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR_ER + + + Extended Range Y, VU in two surfaces (VU as one surface) with UV byte ordering, U/V width = 1/2 Y width, U/V height = 1/2 Y height. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_BAYER_RGGB + + + Bayer format - one channel in one surface with interleaved RGGB ordering. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_BAYER_BGGR + + + Bayer format - one channel in one surface with interleaved BGGR ordering. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_BAYER_GRBG + + + Bayer format - one channel in one surface with interleaved GRBG ordering. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_BAYER_GBRG + + + Bayer format - one channel in one surface with interleaved GBRG ordering. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_BAYER10_RGGB + + + Bayer10 format - one channel in one surface with interleaved RGGB ordering. Out of 16 bits, 10 bits used 6 bits No-op. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_BAYER10_BGGR + + + Bayer10 format - one channel in one surface with interleaved BGGR ordering. Out of 16 bits, 10 bits used 6 bits No-op. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_BAYER10_GRBG + + + Bayer10 format - one channel in one surface with interleaved GRBG ordering. Out of 16 bits, 10 bits used 6 bits No-op. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_BAYER10_GBRG + + + Bayer10 format - one channel in one surface with interleaved GBRG ordering. Out of 16 bits, 10 bits used 6 bits No-op. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_BAYER12_RGGB + + + Bayer12 format - one channel in one surface with interleaved RGGB ordering. Out of 16 bits, 12 bits used 4 bits No-op. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_BAYER12_BGGR + + + Bayer12 format - one channel in one surface with interleaved BGGR ordering. Out of 16 bits, 12 bits used 4 bits No-op. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_BAYER12_GRBG + + + Bayer12 format - one channel in one surface with interleaved GRBG ordering. Out of 16 bits, 12 bits used 4 bits No-op. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_BAYER12_GBRG + + + Bayer12 format - one channel in one surface with interleaved GBRG ordering. Out of 16 bits, 12 bits used 4 bits No-op. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_BAYER14_RGGB + + + Bayer14 format - one channel in one surface with interleaved RGGB ordering. Out of 16 bits, 14 bits used 2 bits No-op. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_BAYER14_BGGR + + + Bayer14 format - one channel in one surface with interleaved BGGR ordering. Out of 16 bits, 14 bits used 2 bits No-op. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_BAYER14_GRBG + + + Bayer14 format - one channel in one surface with interleaved GRBG ordering. Out of 16 bits, 14 bits used 2 bits No-op. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_BAYER14_GBRG + + + Bayer14 format - one channel in one surface with interleaved GBRG ordering. Out of 16 bits, 14 bits used 2 bits No-op. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_BAYER20_RGGB + + + Bayer20 format - one channel in one surface with interleaved RGGB ordering. Out of 32 bits, 20 bits used 12 bits No-op. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_BAYER20_BGGR + + + Bayer20 format - one channel in one surface with interleaved BGGR ordering. Out of 32 bits, 20 bits used 12 bits No-op. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_BAYER20_GRBG + + + Bayer20 format - one channel in one surface with interleaved GRBG ordering. Out of 32 bits, 20 bits used 12 bits No-op. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_BAYER20_GBRG + + + Bayer20 format - one channel in one surface with interleaved GBRG ordering. Out of 32 bits, 20 bits used 12 bits No-op. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_YVU444_PLANAR + + + Y, V, U in three surfaces, each in a separate surface, U/V width = Y width, U/V height = Y height. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_YVU422_PLANAR + + + Y, V, U in three surfaces, each in a separate surface, U/V width = 1/2 Y width, U/V height = Y height. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_YVU420_PLANAR + + + Y, V, U in three surfaces, each in a separate surface, U/V width = 1/2 Y width, U/V height = 1/2 Y height. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_BAYER_ISP_RGGB + + + Nvidia proprietary Bayer ISP format - one channel in one surface with interleaved RGGB ordering and mapped to opaque integer datatype. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_BAYER_ISP_BGGR + + + Nvidia proprietary Bayer ISP format - one channel in one surface with interleaved BGGR ordering and mapped to opaque integer datatype. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_BAYER_ISP_GRBG + + + Nvidia proprietary Bayer ISP format - one channel in one surface with interleaved GRBG ordering and mapped to opaque integer datatype. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_BAYER_ISP_GBRG + + + Nvidia proprietary Bayer ISP format - one channel in one surface with interleaved GBRG ordering and mapped to opaque integer datatype. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_BAYER_BCCR + + + Bayer format - one channel in one surface with interleaved BCCR ordering. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_BAYER_RCCB + + + Bayer format - one channel in one surface with interleaved RCCB ordering. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_BAYER_CRBC + + + Bayer format - one channel in one surface with interleaved CRBC ordering. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_BAYER_CBRC + + + Bayer format - one channel in one surface with interleaved CBRC ordering. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_BAYER10_CCCC + + + Bayer10 format - one channel in one surface with interleaved CCCC ordering. Out of 16 bits, 10 bits used 6 bits No-op. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_BAYER12_BCCR + + + Bayer12 format - one channel in one surface with interleaved BCCR ordering. Out of 16 bits, 12 bits used 4 bits No-op. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_BAYER12_RCCB + + + Bayer12 format - one channel in one surface with interleaved RCCB ordering. Out of 16 bits, 12 bits used 4 bits No-op. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_BAYER12_CRBC + + + Bayer12 format - one channel in one surface with interleaved CRBC ordering. Out of 16 bits, 12 bits used 4 bits No-op. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_BAYER12_CBRC + + + Bayer12 format - one channel in one surface with interleaved CBRC ordering. Out of 16 bits, 12 bits used 4 bits No-op. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_BAYER12_CCCC + + + Bayer12 format - one channel in one surface with interleaved CCCC ordering. Out of 16 bits, 12 bits used 4 bits No-op. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_Y + + + Color format for single Y plane. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR_2020 + + + Y, UV in two surfaces (UV as one surface) U/V width = 1/2 Y width, U/V height = 1/2 Y height. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR_2020 + + + Y, VU in two surfaces (VU as one surface) U/V width = 1/2 Y width, U/V height = 1/2 Y height. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_YUV420_PLANAR_2020 + + + Y, U, V each in a separate surface, U/V width = 1/2 Y width, U/V height= 1/2 Y height. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_YVU420_PLANAR_2020 + + + Y, V, U each in a separate surface, U/V width = 1/2 Y width, U/V height = 1/2 Y height. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR_709 + + + Y, UV in two surfaces (UV as one surface) U/V width = 1/2 Y width, U/V height = 1/2 Y height. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR_709 + + + Y, VU in two surfaces (VU as one surface) U/V width = 1/2 Y width, U/V height = 1/2 Y height. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_YUV420_PLANAR_709 + + + Y, U, V each in a separate surface, U/V width = 1/2 Y width, U/V height = 1/2 Y height. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_YVU420_PLANAR_709 + + + Y, V, U each in a separate surface, U/V width = 1/2 Y width, U/V height = 1/2 Y height. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_709 + + + Y10, V10U10 in two surfaces (VU as one surface), U/V width = 1/2 Y width, U/V height = 1/2 Y height. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_2020 + + + Y10, V10U10 in two surfaces (VU as one surface), U/V width = 1/2 Y width, U/V height = 1/2 Y height. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR_2020 + + + Y10, V10U10 in two surfaces(VU as one surface) U/V width = 1/2 Y width, U/V height = Y height. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR + + + Y10, V10U10 in two surfaces(VU as one surface) U/V width = 1/2 Y width, U/V height = Y height. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR_709 + + + Y10, V10U10 in two surfaces(VU as one surface) U/V width = 1/2 Y width, U/V height = Y height. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_Y_ER + + + Extended Range Color format for single Y plane. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_Y_709_ER + + + Extended Range Color format for single Y plane. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_Y10_ER + + + Extended Range Color format for single Y10 plane. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_Y10_709_ER + + + Extended Range Color format for single Y10 plane. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_Y12_ER + + + Extended Range Color format for single Y12 plane. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_Y12_709_ER + + + Extended Range Color format for single Y12 plane. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_YUVA + + + Y, U, V, A four channels in one surface, interleaved as AVUY. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_YUV + + + Y, U, V three channels in one surface, interleaved as VUY. Only pitch linear format supported. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_YVYU + + + Y, U, V in one surface, interleaved as YVYU in one channel. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_VYUY + + + Y, U, V in one surface, interleaved as VYUY in one channel. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_ER + + + Extended Range Y10, V10U10 in two surfaces(VU as one surface) U/V width = 1/2 Y width, U/V height = 1/2 Y height. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_709_ER + + + Extended Range Y10, V10U10 in two surfaces(VU as one surface) U/V width = 1/2 Y width, U/V height = 1/2 Y height. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR_ER + + + Extended Range Y10, V10U10 in two surfaces (VU as one surface) U/V width = Y width, U/V height = Y height. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR_709_ER + + + Extended Range Y10, V10U10 in two surfaces (VU as one surface) U/V width = Y width, U/V height = Y height. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR_ER + + + Extended Range Y12, V12U12 in two surfaces (VU as one surface) U/V width = 1/2 Y width, U/V height = 1/2 Y height. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR_709_ER + + + Extended Range Y12, V12U12 in two surfaces (VU as one surface) U/V width = 1/2 Y width, U/V height = 1/2 Y height. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR_ER + + + Extended Range Y12, V12U12 in two surfaces (VU as one surface) U/V width = Y width, U/V height = Y height. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR_709_ER + + + Extended Range Y12, V12U12 in two surfaces (VU as one surface) U/V width = Y width, U/V height = Y height. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_UYVY_709 + + + Y, U, V in one surface, interleaved as UYVY in one channel. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_UYVY_709_ER + + + Extended Range Y, U, V in one surface, interleaved as UYVY in one channel. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_UYVY_2020 + + + Y, U, V in one surface, interleaved as UYVY in one channel. + + + .. autoattribute:: cuda.bindings.driver.CUeglColorFormat.CU_EGL_COLOR_FORMAT_MAX + +.. autoclass:: cuda.bindings.driver.CUdeviceptr_v2 +.. autoclass:: cuda.bindings.driver.CUdeviceptr +.. autoclass:: cuda.bindings.driver.CUdevice_v1 +.. autoclass:: cuda.bindings.driver.CUdevice +.. autoclass:: cuda.bindings.driver.CUcontext +.. autoclass:: cuda.bindings.driver.CUmodule +.. autoclass:: cuda.bindings.driver.CUfunction +.. autoclass:: cuda.bindings.driver.CUlibrary +.. autoclass:: cuda.bindings.driver.CUkernel +.. autoclass:: cuda.bindings.driver.CUarray +.. autoclass:: cuda.bindings.driver.CUmipmappedArray +.. autoclass:: cuda.bindings.driver.CUtexref +.. autoclass:: cuda.bindings.driver.CUsurfref +.. autoclass:: cuda.bindings.driver.CUevent +.. autoclass:: cuda.bindings.driver.CUstream +.. autoclass:: cuda.bindings.driver.CUgraphicsResource +.. autoclass:: cuda.bindings.driver.CUtexObject_v1 +.. autoclass:: cuda.bindings.driver.CUtexObject +.. autoclass:: cuda.bindings.driver.CUsurfObject_v1 +.. autoclass:: cuda.bindings.driver.CUsurfObject +.. autoclass:: cuda.bindings.driver.CUexternalMemory +.. autoclass:: cuda.bindings.driver.CUexternalSemaphore +.. autoclass:: cuda.bindings.driver.CUgraph +.. autoclass:: cuda.bindings.driver.CUgraphNode +.. autoclass:: cuda.bindings.driver.CUgraphExec +.. autoclass:: cuda.bindings.driver.CUmemoryPool +.. autoclass:: cuda.bindings.driver.CUuserObject +.. autoclass:: cuda.bindings.driver.CUgraphConditionalHandle +.. autoclass:: cuda.bindings.driver.CUgraphDeviceNode +.. autoclass:: cuda.bindings.driver.CUasyncCallbackHandle +.. autoclass:: cuda.bindings.driver.CUgreenCtx +.. autoclass:: cuda.bindings.driver.CUuuid +.. autoclass:: cuda.bindings.driver.CUmemFabricHandle_v1 +.. autoclass:: cuda.bindings.driver.CUmemFabricHandle +.. autoclass:: cuda.bindings.driver.CUipcEventHandle_v1 +.. autoclass:: cuda.bindings.driver.CUipcEventHandle +.. autoclass:: cuda.bindings.driver.CUipcMemHandle_v1 +.. autoclass:: cuda.bindings.driver.CUipcMemHandle +.. autoclass:: cuda.bindings.driver.CUstreamBatchMemOpParams_v1 +.. autoclass:: cuda.bindings.driver.CUstreamBatchMemOpParams +.. autoclass:: cuda.bindings.driver.CUDA_BATCH_MEM_OP_NODE_PARAMS_v1 +.. autoclass:: cuda.bindings.driver.CUDA_BATCH_MEM_OP_NODE_PARAMS +.. autoclass:: cuda.bindings.driver.CUDA_BATCH_MEM_OP_NODE_PARAMS_v2 +.. autoclass:: cuda.bindings.driver.CUasyncNotificationInfo +.. autoclass:: cuda.bindings.driver.CUasyncCallback +.. autoclass:: cuda.bindings.driver.CUdevprop_v1 +.. autoclass:: cuda.bindings.driver.CUdevprop +.. autoclass:: cuda.bindings.driver.CUlinkState +.. autoclass:: cuda.bindings.driver.CUhostFn +.. autoclass:: cuda.bindings.driver.CUaccessPolicyWindow_v1 +.. autoclass:: cuda.bindings.driver.CUaccessPolicyWindow +.. autoclass:: cuda.bindings.driver.CUDA_KERNEL_NODE_PARAMS_v1 +.. autoclass:: cuda.bindings.driver.CUDA_KERNEL_NODE_PARAMS_v2 +.. autoclass:: cuda.bindings.driver.CUDA_KERNEL_NODE_PARAMS +.. autoclass:: cuda.bindings.driver.CUDA_KERNEL_NODE_PARAMS_v3 +.. autoclass:: cuda.bindings.driver.CUDA_MEMSET_NODE_PARAMS_v1 +.. autoclass:: cuda.bindings.driver.CUDA_MEMSET_NODE_PARAMS +.. autoclass:: cuda.bindings.driver.CUDA_MEMSET_NODE_PARAMS_v2 +.. autoclass:: cuda.bindings.driver.CUDA_HOST_NODE_PARAMS_v1 +.. autoclass:: cuda.bindings.driver.CUDA_HOST_NODE_PARAMS +.. autoclass:: cuda.bindings.driver.CUDA_HOST_NODE_PARAMS_v2 +.. autoclass:: cuda.bindings.driver.CUDA_CONDITIONAL_NODE_PARAMS +.. autoclass:: cuda.bindings.driver.CUgraphEdgeData +.. autoclass:: cuda.bindings.driver.CUDA_GRAPH_INSTANTIATE_PARAMS +.. autoclass:: cuda.bindings.driver.CUlaunchMemSyncDomainMap +.. autoclass:: cuda.bindings.driver.CUlaunchAttributeValue +.. autoclass:: cuda.bindings.driver.CUlaunchAttribute +.. autoclass:: cuda.bindings.driver.CUlaunchConfig +.. autoclass:: cuda.bindings.driver.CUkernelNodeAttrID +.. autoclass:: cuda.bindings.driver.CUkernelNodeAttrValue_v1 +.. autoclass:: cuda.bindings.driver.CUkernelNodeAttrValue +.. autoclass:: cuda.bindings.driver.CUstreamAttrID +.. autoclass:: cuda.bindings.driver.CUstreamAttrValue_v1 +.. autoclass:: cuda.bindings.driver.CUstreamAttrValue +.. autoclass:: cuda.bindings.driver.CUexecAffinitySmCount_v1 +.. autoclass:: cuda.bindings.driver.CUexecAffinitySmCount +.. autoclass:: cuda.bindings.driver.CUexecAffinityParam_v1 +.. autoclass:: cuda.bindings.driver.CUexecAffinityParam +.. autoclass:: cuda.bindings.driver.CUctxCigParam +.. autoclass:: cuda.bindings.driver.CUctxCreateParams +.. autoclass:: cuda.bindings.driver.CUstreamCigParam +.. autoclass:: cuda.bindings.driver.CUstreamCigCaptureParams +.. autoclass:: cuda.bindings.driver.CUlibraryHostUniversalFunctionAndDataTable +.. autoclass:: cuda.bindings.driver.CUstreamCallback +.. autoclass:: cuda.bindings.driver.CUoccupancyB2DSize +.. autoclass:: cuda.bindings.driver.CUDA_MEMCPY2D_v2 +.. autoclass:: cuda.bindings.driver.CUDA_MEMCPY2D +.. autoclass:: cuda.bindings.driver.CUDA_MEMCPY3D_v2 +.. autoclass:: cuda.bindings.driver.CUDA_MEMCPY3D +.. autoclass:: cuda.bindings.driver.CUDA_MEMCPY3D_PEER_v1 +.. autoclass:: cuda.bindings.driver.CUDA_MEMCPY3D_PEER +.. autoclass:: cuda.bindings.driver.CUDA_MEMCPY_NODE_PARAMS +.. autoclass:: cuda.bindings.driver.CUDA_ARRAY_DESCRIPTOR_v2 +.. autoclass:: cuda.bindings.driver.CUDA_ARRAY_DESCRIPTOR +.. autoclass:: cuda.bindings.driver.CUDA_ARRAY3D_DESCRIPTOR_v2 +.. autoclass:: cuda.bindings.driver.CUDA_ARRAY3D_DESCRIPTOR +.. autoclass:: cuda.bindings.driver.CUDA_ARRAY_SPARSE_PROPERTIES_v1 +.. autoclass:: cuda.bindings.driver.CUDA_ARRAY_SPARSE_PROPERTIES +.. autoclass:: cuda.bindings.driver.CUDA_ARRAY_MEMORY_REQUIREMENTS_v1 +.. autoclass:: cuda.bindings.driver.CUDA_ARRAY_MEMORY_REQUIREMENTS +.. autoclass:: cuda.bindings.driver.CUDA_RESOURCE_DESC_v1 +.. autoclass:: cuda.bindings.driver.CUDA_RESOURCE_DESC +.. autoclass:: cuda.bindings.driver.CUDA_TEXTURE_DESC_v1 +.. autoclass:: cuda.bindings.driver.CUDA_TEXTURE_DESC +.. autoclass:: cuda.bindings.driver.CUDA_RESOURCE_VIEW_DESC_v1 +.. autoclass:: cuda.bindings.driver.CUDA_RESOURCE_VIEW_DESC +.. autoclass:: cuda.bindings.driver.CUtensorMap +.. autoclass:: cuda.bindings.driver.CUDA_POINTER_ATTRIBUTE_P2P_TOKENS_v1 +.. autoclass:: cuda.bindings.driver.CUDA_POINTER_ATTRIBUTE_P2P_TOKENS +.. autoclass:: cuda.bindings.driver.CUDA_LAUNCH_PARAMS_v1 +.. autoclass:: cuda.bindings.driver.CUDA_LAUNCH_PARAMS +.. autoclass:: cuda.bindings.driver.CUDA_EXTERNAL_MEMORY_HANDLE_DESC_v1 +.. autoclass:: cuda.bindings.driver.CUDA_EXTERNAL_MEMORY_HANDLE_DESC +.. autoclass:: cuda.bindings.driver.CUDA_EXTERNAL_MEMORY_BUFFER_DESC_v1 +.. autoclass:: cuda.bindings.driver.CUDA_EXTERNAL_MEMORY_BUFFER_DESC +.. autoclass:: cuda.bindings.driver.CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_v1 +.. autoclass:: cuda.bindings.driver.CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC +.. autoclass:: cuda.bindings.driver.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_v1 +.. autoclass:: cuda.bindings.driver.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC +.. autoclass:: cuda.bindings.driver.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_v1 +.. autoclass:: cuda.bindings.driver.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS +.. autoclass:: cuda.bindings.driver.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_v1 +.. autoclass:: cuda.bindings.driver.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS +.. autoclass:: cuda.bindings.driver.CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v1 +.. autoclass:: cuda.bindings.driver.CUDA_EXT_SEM_SIGNAL_NODE_PARAMS +.. autoclass:: cuda.bindings.driver.CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2 +.. autoclass:: cuda.bindings.driver.CUDA_EXT_SEM_WAIT_NODE_PARAMS_v1 +.. autoclass:: cuda.bindings.driver.CUDA_EXT_SEM_WAIT_NODE_PARAMS +.. autoclass:: cuda.bindings.driver.CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2 +.. autoclass:: cuda.bindings.driver.CUmemGenericAllocationHandle_v1 +.. autoclass:: cuda.bindings.driver.CUmemGenericAllocationHandle +.. autoclass:: cuda.bindings.driver.CUarrayMapInfo_v1 +.. autoclass:: cuda.bindings.driver.CUarrayMapInfo +.. autoclass:: cuda.bindings.driver.CUmemLocation_v1 +.. autoclass:: cuda.bindings.driver.CUmemLocation +.. autoclass:: cuda.bindings.driver.CUmemAllocationProp_v1 +.. autoclass:: cuda.bindings.driver.CUmemAllocationProp +.. autoclass:: cuda.bindings.driver.CUmulticastObjectProp_v1 +.. autoclass:: cuda.bindings.driver.CUmulticastObjectProp +.. autoclass:: cuda.bindings.driver.CUmemAccessDesc_v1 +.. autoclass:: cuda.bindings.driver.CUmemAccessDesc +.. autoclass:: cuda.bindings.driver.CUgraphExecUpdateResultInfo_v1 +.. autoclass:: cuda.bindings.driver.CUgraphExecUpdateResultInfo +.. autoclass:: cuda.bindings.driver.CUmemPoolProps_v1 +.. autoclass:: cuda.bindings.driver.CUmemPoolProps +.. autoclass:: cuda.bindings.driver.CUmemPoolPtrExportData_v1 +.. autoclass:: cuda.bindings.driver.CUmemPoolPtrExportData +.. autoclass:: cuda.bindings.driver.CUmemcpyAttributes_v1 +.. autoclass:: cuda.bindings.driver.CUmemcpyAttributes +.. autoclass:: cuda.bindings.driver.CUoffset3D_v1 +.. autoclass:: cuda.bindings.driver.CUoffset3D +.. autoclass:: cuda.bindings.driver.CUextent3D_v1 +.. autoclass:: cuda.bindings.driver.CUextent3D +.. autoclass:: cuda.bindings.driver.CUmemcpy3DOperand_v1 +.. autoclass:: cuda.bindings.driver.CUmemcpy3DOperand +.. autoclass:: cuda.bindings.driver.CUDA_MEMCPY3D_BATCH_OP_v1 +.. autoclass:: cuda.bindings.driver.CUDA_MEMCPY3D_BATCH_OP +.. autoclass:: cuda.bindings.driver.CUDA_MEM_ALLOC_NODE_PARAMS_v1 +.. autoclass:: cuda.bindings.driver.CUDA_MEM_ALLOC_NODE_PARAMS +.. autoclass:: cuda.bindings.driver.CUDA_MEM_ALLOC_NODE_PARAMS_v2 +.. autoclass:: cuda.bindings.driver.CUDA_MEM_FREE_NODE_PARAMS +.. autoclass:: cuda.bindings.driver.CUDA_CHILD_GRAPH_NODE_PARAMS +.. autoclass:: cuda.bindings.driver.CUDA_EVENT_RECORD_NODE_PARAMS +.. autoclass:: cuda.bindings.driver.CUDA_EVENT_WAIT_NODE_PARAMS +.. autoclass:: cuda.bindings.driver.CUgraphNodeParams +.. autoclass:: cuda.bindings.driver.CUcheckpointLockArgs +.. autoclass:: cuda.bindings.driver.CUcheckpointCheckpointArgs +.. autoclass:: cuda.bindings.driver.CUcheckpointGpuPair +.. autoclass:: cuda.bindings.driver.CUcheckpointRestoreArgs +.. autoclass:: cuda.bindings.driver.CUcheckpointUnlockArgs +.. autoclass:: cuda.bindings.driver.CUeglFrame_v1 +.. autoclass:: cuda.bindings.driver.CUeglFrame +.. autoclass:: cuda.bindings.driver.CUeglStreamConnection +.. autoattribute:: cuda.bindings.driver.CUDA_VERSION + + CUDA API version number + +.. autoattribute:: cuda.bindings.driver.CU_UUID_HAS_BEEN_DEFINED + + CUDA UUID types + +.. autoattribute:: cuda.bindings.driver.CU_IPC_HANDLE_SIZE + + CUDA IPC handle size + +.. autoattribute:: cuda.bindings.driver.CU_STREAM_LEGACY + + Legacy stream handle + + + + Stream handle that can be passed as a :py:obj:`~.CUstream` to use an implicit stream with legacy synchronization behavior. + + + + See details of the \link_sync_behavior + +.. autoattribute:: cuda.bindings.driver.CU_STREAM_PER_THREAD + + Per-thread stream handle + + + + Stream handle that can be passed as a :py:obj:`~.CUstream` to use an implicit stream with per-thread synchronization behavior. + + + + See details of the \link_sync_behavior + +.. autoattribute:: cuda.bindings.driver.CU_COMPUTE_ACCELERATED_TARGET_BASE +.. autoattribute:: cuda.bindings.driver.CU_COMPUTE_FAMILY_TARGET_BASE +.. autoattribute:: cuda.bindings.driver.CUDA_CB +.. autoattribute:: cuda.bindings.driver.CU_GRAPH_COND_ASSIGN_DEFAULT + + Conditional node handle flags Default value is applied when graph is launched. + +.. autoattribute:: cuda.bindings.driver.CU_GRAPH_KERNEL_NODE_PORT_DEFAULT + + This port activates when the kernel has finished executing. + +.. autoattribute:: cuda.bindings.driver.CU_GRAPH_KERNEL_NODE_PORT_PROGRAMMATIC + + This port activates when all blocks of the kernel have performed cudaTriggerProgrammaticLaunchCompletion() or have terminated. It must be used with edge type :py:obj:`~.CU_GRAPH_DEPENDENCY_TYPE_PROGRAMMATIC`. See also :py:obj:`~.CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_EVENT`. + +.. autoattribute:: cuda.bindings.driver.CU_GRAPH_KERNEL_NODE_PORT_LAUNCH_ORDER + + This port activates when all blocks of the kernel have begun execution. See also :py:obj:`~.CU_LAUNCH_ATTRIBUTE_LAUNCH_COMPLETION_EVENT`. + +.. autoattribute:: cuda.bindings.driver.CU_KERNEL_NODE_ATTRIBUTE_ACCESS_POLICY_WINDOW +.. autoattribute:: cuda.bindings.driver.CU_KERNEL_NODE_ATTRIBUTE_COOPERATIVE +.. autoattribute:: cuda.bindings.driver.CU_KERNEL_NODE_ATTRIBUTE_CLUSTER_DIMENSION +.. autoattribute:: cuda.bindings.driver.CU_KERNEL_NODE_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE +.. autoattribute:: cuda.bindings.driver.CU_KERNEL_NODE_ATTRIBUTE_PRIORITY +.. autoattribute:: cuda.bindings.driver.CU_KERNEL_NODE_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP +.. autoattribute:: cuda.bindings.driver.CU_KERNEL_NODE_ATTRIBUTE_MEM_SYNC_DOMAIN +.. autoattribute:: cuda.bindings.driver.CU_KERNEL_NODE_ATTRIBUTE_PREFERRED_CLUSTER_DIMENSION +.. autoattribute:: cuda.bindings.driver.CU_KERNEL_NODE_ATTRIBUTE_DEVICE_UPDATABLE_KERNEL_NODE +.. autoattribute:: cuda.bindings.driver.CU_KERNEL_NODE_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT +.. autoattribute:: cuda.bindings.driver.CU_STREAM_ATTRIBUTE_ACCESS_POLICY_WINDOW +.. autoattribute:: cuda.bindings.driver.CU_STREAM_ATTRIBUTE_SYNCHRONIZATION_POLICY +.. autoattribute:: cuda.bindings.driver.CU_STREAM_ATTRIBUTE_PRIORITY +.. autoattribute:: cuda.bindings.driver.CU_STREAM_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP +.. autoattribute:: cuda.bindings.driver.CU_STREAM_ATTRIBUTE_MEM_SYNC_DOMAIN +.. autoattribute:: cuda.bindings.driver.CU_MEMHOSTALLOC_PORTABLE + + If set, host memory is portable between CUDA contexts. Flag for :py:obj:`~.cuMemHostAlloc()` + +.. autoattribute:: cuda.bindings.driver.CU_MEMHOSTALLOC_DEVICEMAP + + If set, host memory is mapped into CUDA address space and :py:obj:`~.cuMemHostGetDevicePointer()` may be called on the host pointer. Flag for :py:obj:`~.cuMemHostAlloc()` + +.. autoattribute:: cuda.bindings.driver.CU_MEMHOSTALLOC_WRITECOMBINED + + If set, host memory is allocated as write-combined - fast to write, faster to DMA, slow to read except via SSE4 streaming load instruction (MOVNTDQA). Flag for :py:obj:`~.cuMemHostAlloc()` + +.. autoattribute:: cuda.bindings.driver.CU_MEMHOSTREGISTER_PORTABLE + + If set, host memory is portable between CUDA contexts. Flag for :py:obj:`~.cuMemHostRegister()` + +.. autoattribute:: cuda.bindings.driver.CU_MEMHOSTREGISTER_DEVICEMAP + + If set, host memory is mapped into CUDA address space and :py:obj:`~.cuMemHostGetDevicePointer()` may be called on the host pointer. Flag for :py:obj:`~.cuMemHostRegister()` + +.. autoattribute:: cuda.bindings.driver.CU_MEMHOSTREGISTER_IOMEMORY + + If set, the passed memory pointer is treated as pointing to some memory-mapped I/O space, e.g. belonging to a third-party PCIe device. On Windows the flag is a no-op. On Linux that memory is marked as non cache-coherent for the GPU and is expected to be physically contiguous. It may return :py:obj:`~.CUDA_ERROR_NOT_PERMITTED` if run as an unprivileged user, :py:obj:`~.CUDA_ERROR_NOT_SUPPORTED` on older Linux kernel versions. On all other platforms, it is not supported and :py:obj:`~.CUDA_ERROR_NOT_SUPPORTED` is returned. Flag for :py:obj:`~.cuMemHostRegister()` + +.. autoattribute:: cuda.bindings.driver.CU_MEMHOSTREGISTER_READ_ONLY + + If set, the passed memory pointer is treated as pointing to memory that is considered read-only by the device. On platforms without :py:obj:`~.CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS_USES_HOST_PAGE_TABLES`, this flag is required in order to register memory mapped to the CPU as read-only. Support for the use of this flag can be queried from the device attribute :py:obj:`~.CU_DEVICE_ATTRIBUTE_READ_ONLY_HOST_REGISTER_SUPPORTED`. Using this flag with a current context associated with a device that does not have this attribute set will cause :py:obj:`~.cuMemHostRegister` to error with :py:obj:`~.CUDA_ERROR_NOT_SUPPORTED`. + +.. autoattribute:: cuda.bindings.driver.CU_ARRAY_SPARSE_PROPERTIES_SINGLE_MIPTAIL + + Indicates that the layered sparse CUDA array or CUDA mipmapped array has a single mip tail region for all layers + +.. autoattribute:: cuda.bindings.driver.CU_TENSOR_MAP_NUM_QWORDS + + Size of tensor map descriptor + +.. autoattribute:: cuda.bindings.driver.CUDA_EXTERNAL_MEMORY_DEDICATED + + Indicates that the external memory object is a dedicated resource + +.. autoattribute:: cuda.bindings.driver.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_SKIP_NVSCIBUF_MEMSYNC + + When the ``flags`` parameter of :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS` contains this flag, it indicates that signaling an external semaphore object should skip performing appropriate memory synchronization operations over all the external memory objects that are imported as :py:obj:`~.CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF`, which otherwise are performed by default to ensure data coherency with other importers of the same NvSciBuf memory objects. + +.. autoattribute:: cuda.bindings.driver.CUDA_EXTERNAL_SEMAPHORE_WAIT_SKIP_NVSCIBUF_MEMSYNC + + When the ``flags`` parameter of :py:obj:`~.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS` contains this flag, it indicates that waiting on an external semaphore object should skip performing appropriate memory synchronization operations over all the external memory objects that are imported as :py:obj:`~.CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF`, which otherwise are performed by default to ensure data coherency with other importers of the same NvSciBuf memory objects. + +.. autoattribute:: cuda.bindings.driver.CUDA_NVSCISYNC_ATTR_SIGNAL + + When ``flags`` of :py:obj:`~.cuDeviceGetNvSciSyncAttributes` is set to this, it indicates that application needs signaler specific NvSciSyncAttr to be filled by :py:obj:`~.cuDeviceGetNvSciSyncAttributes`. + +.. autoattribute:: cuda.bindings.driver.CUDA_NVSCISYNC_ATTR_WAIT + + When ``flags`` of :py:obj:`~.cuDeviceGetNvSciSyncAttributes` is set to this, it indicates that application needs waiter specific NvSciSyncAttr to be filled by :py:obj:`~.cuDeviceGetNvSciSyncAttributes`. + +.. autoattribute:: cuda.bindings.driver.CU_MEM_CREATE_USAGE_TILE_POOL + + This flag if set indicates that the memory will be used as a tile pool. + +.. autoattribute:: cuda.bindings.driver.CU_MEM_CREATE_USAGE_HW_DECOMPRESS + + This flag, if set, indicates that the memory will be used as a buffer for hardware accelerated decompression. + +.. autoattribute:: cuda.bindings.driver.CU_MEM_POOL_CREATE_USAGE_HW_DECOMPRESS + + This flag, if set, indicates that the memory will be used as a buffer for hardware accelerated decompression. + +.. autoattribute:: cuda.bindings.driver.CUDA_COOPERATIVE_LAUNCH_MULTI_DEVICE_NO_PRE_LAUNCH_SYNC + + If set, each kernel launched as part of :py:obj:`~.cuLaunchCooperativeKernelMultiDevice` only waits for prior work in the stream corresponding to that GPU to complete before the kernel begins execution. + +.. autoattribute:: cuda.bindings.driver.CUDA_COOPERATIVE_LAUNCH_MULTI_DEVICE_NO_POST_LAUNCH_SYNC + + If set, any subsequent work pushed in a stream that participated in a call to :py:obj:`~.cuLaunchCooperativeKernelMultiDevice` will only wait for the kernel launched on the GPU corresponding to that stream to complete before it begins execution. + +.. autoattribute:: cuda.bindings.driver.CUDA_ARRAY3D_LAYERED + + If set, the CUDA array is a collection of layers, where each layer is either a 1D or a 2D array and the Depth member of :py:obj:`~.CUDA_ARRAY3D_DESCRIPTOR` specifies the number of layers, not the depth of a 3D array. + +.. autoattribute:: cuda.bindings.driver.CUDA_ARRAY3D_2DARRAY + + Deprecated, use CUDA_ARRAY3D_LAYERED + +.. autoattribute:: cuda.bindings.driver.CUDA_ARRAY3D_SURFACE_LDST + + This flag must be set in order to bind a surface reference to the CUDA array + +.. autoattribute:: cuda.bindings.driver.CUDA_ARRAY3D_CUBEMAP + + If set, the CUDA array is a collection of six 2D arrays, representing faces of a cube. The width of such a CUDA array must be equal to its height, and Depth must be six. If :py:obj:`~.CUDA_ARRAY3D_LAYERED` flag is also set, then the CUDA array is a collection of cubemaps and Depth must be a multiple of six. + +.. autoattribute:: cuda.bindings.driver.CUDA_ARRAY3D_TEXTURE_GATHER + + This flag must be set in order to perform texture gather operations on a CUDA array. + +.. autoattribute:: cuda.bindings.driver.CUDA_ARRAY3D_DEPTH_TEXTURE + + This flag if set indicates that the CUDA array is a DEPTH_TEXTURE. + +.. autoattribute:: cuda.bindings.driver.CUDA_ARRAY3D_COLOR_ATTACHMENT + + This flag indicates that the CUDA array may be bound as a color target in an external graphics API + +.. autoattribute:: cuda.bindings.driver.CUDA_ARRAY3D_SPARSE + + This flag if set indicates that the CUDA array or CUDA mipmapped array is a sparse CUDA array or CUDA mipmapped array respectively + +.. autoattribute:: cuda.bindings.driver.CUDA_ARRAY3D_DEFERRED_MAPPING + + This flag if set indicates that the CUDA array or CUDA mipmapped array will allow deferred memory mapping + +.. autoattribute:: cuda.bindings.driver.CUDA_ARRAY3D_VIDEO_ENCODE_DECODE + + This flag indicates that the CUDA array will be used for hardware accelerated video encode/decode operations. + +.. autoattribute:: cuda.bindings.driver.CU_TRSA_OVERRIDE_FORMAT + + Override the texref format with a format inferred from the array. Flag for :py:obj:`~.cuTexRefSetArray()` + +.. autoattribute:: cuda.bindings.driver.CU_TRSF_READ_AS_INTEGER + + Read the texture as integers rather than promoting the values to floats in the range [0,1]. Flag for :py:obj:`~.cuTexRefSetFlags()` and :py:obj:`~.cuTexObjectCreate()` + +.. autoattribute:: cuda.bindings.driver.CU_TRSF_NORMALIZED_COORDINATES + + Use normalized texture coordinates in the range [0,1) instead of [0,dim). Flag for :py:obj:`~.cuTexRefSetFlags()` and :py:obj:`~.cuTexObjectCreate()` + +.. autoattribute:: cuda.bindings.driver.CU_TRSF_SRGB + + Perform sRGB->linear conversion during texture read. Flag for :py:obj:`~.cuTexRefSetFlags()` and :py:obj:`~.cuTexObjectCreate()` + +.. autoattribute:: cuda.bindings.driver.CU_TRSF_DISABLE_TRILINEAR_OPTIMIZATION + + Disable any trilinear filtering optimizations. Flag for :py:obj:`~.cuTexRefSetFlags()` and :py:obj:`~.cuTexObjectCreate()` + +.. autoattribute:: cuda.bindings.driver.CU_TRSF_SEAMLESS_CUBEMAP + + Enable seamless cube map filtering. Flag for :py:obj:`~.cuTexObjectCreate()` + +.. autoattribute:: cuda.bindings.driver.CU_LAUNCH_KERNEL_REQUIRED_BLOCK_DIM + + Launch with the required block dimension. + +.. autoattribute:: cuda.bindings.driver.CU_LAUNCH_PARAM_END_AS_INT + + C++ compile time constant for CU_LAUNCH_PARAM_END + +.. autoattribute:: cuda.bindings.driver.CU_LAUNCH_PARAM_END + + End of array terminator for the ``extra`` parameter to :py:obj:`~.cuLaunchKernel` + +.. autoattribute:: cuda.bindings.driver.CU_LAUNCH_PARAM_BUFFER_POINTER_AS_INT + + C++ compile time constant for CU_LAUNCH_PARAM_BUFFER_POINTER + +.. autoattribute:: cuda.bindings.driver.CU_LAUNCH_PARAM_BUFFER_POINTER + + Indicator that the next value in the ``extra`` parameter to :py:obj:`~.cuLaunchKernel` will be a pointer to a buffer containing all kernel parameters used for launching kernel ``f``. This buffer needs to honor all alignment/padding requirements of the individual parameters. If :py:obj:`~.CU_LAUNCH_PARAM_BUFFER_SIZE` is not also specified in the ``extra`` array, then :py:obj:`~.CU_LAUNCH_PARAM_BUFFER_POINTER` will have no effect. + +.. autoattribute:: cuda.bindings.driver.CU_LAUNCH_PARAM_BUFFER_SIZE_AS_INT + + C++ compile time constant for CU_LAUNCH_PARAM_BUFFER_SIZE + +.. autoattribute:: cuda.bindings.driver.CU_LAUNCH_PARAM_BUFFER_SIZE + + Indicator that the next value in the ``extra`` parameter to :py:obj:`~.cuLaunchKernel` will be a pointer to a size_t which contains the size of the buffer specified with :py:obj:`~.CU_LAUNCH_PARAM_BUFFER_POINTER`. It is required that :py:obj:`~.CU_LAUNCH_PARAM_BUFFER_POINTER` also be specified in the ``extra`` array if the value associated with :py:obj:`~.CU_LAUNCH_PARAM_BUFFER_SIZE` is not zero. + +.. autoattribute:: cuda.bindings.driver.CU_PARAM_TR_DEFAULT + + For texture references loaded into the module, use default texunit from texture reference. + +.. autoattribute:: cuda.bindings.driver.CU_DEVICE_CPU + + Device that represents the CPU + +.. autoattribute:: cuda.bindings.driver.CU_DEVICE_INVALID + + Device that represents an invalid device + +.. autoattribute:: cuda.bindings.driver.MAX_PLANES + + Maximum number of planes per frame + +.. autoattribute:: cuda.bindings.driver.CUDA_EGL_INFINITE_TIMEOUT + + Indicates that timeout for :py:obj:`~.cuEGLStreamConsumerAcquireFrame` is infinite. + + +Error Handling +-------------- + +MANBRIEF error handling functions of the low-level CUDA driver API (CURRENT_FILE) ENDMANBRIEF + + + +This section describes the error handling functions of the low-level CUDA driver application programming interface. + +.. autofunction:: cuda.bindings.driver.cuGetErrorString +.. autofunction:: cuda.bindings.driver.cuGetErrorName + +Initialization +-------------- + +MANBRIEF initialization functions of the low-level CUDA driver API (CURRENT_FILE) ENDMANBRIEF + + + +This section describes the initialization functions of the low-level CUDA driver application programming interface. + +.. autofunction:: cuda.bindings.driver.cuInit + +Version Management +------------------ + +MANBRIEF version management functions of the low-level CUDA driver API (CURRENT_FILE) ENDMANBRIEF + + + +This section describes the version management functions of the low-level CUDA driver application programming interface. + +.. autofunction:: cuda.bindings.driver.cuDriverGetVersion + +Device Management +----------------- + +MANBRIEF device management functions of the low-level CUDA driver API (CURRENT_FILE) ENDMANBRIEF + + + +This section describes the device management functions of the low-level CUDA driver application programming interface. + +.. autofunction:: cuda.bindings.driver.cuDeviceGet +.. autofunction:: cuda.bindings.driver.cuDeviceGetCount +.. autofunction:: cuda.bindings.driver.cuDeviceGetName +.. autofunction:: cuda.bindings.driver.cuDeviceGetUuid +.. autofunction:: cuda.bindings.driver.cuDeviceGetLuid +.. autofunction:: cuda.bindings.driver.cuDeviceTotalMem +.. autofunction:: cuda.bindings.driver.cuDeviceGetTexture1DLinearMaxWidth +.. autofunction:: cuda.bindings.driver.cuDeviceGetAttribute +.. autofunction:: cuda.bindings.driver.cuDeviceGetHostAtomicCapabilities +.. autofunction:: cuda.bindings.driver.cuDeviceGetNvSciSyncAttributes +.. autofunction:: cuda.bindings.driver.cuDeviceSetMemPool +.. autofunction:: cuda.bindings.driver.cuDeviceGetMemPool +.. autofunction:: cuda.bindings.driver.cuDeviceGetDefaultMemPool +.. autofunction:: cuda.bindings.driver.cuDeviceGetExecAffinitySupport +.. autofunction:: cuda.bindings.driver.cuFlushGPUDirectRDMAWrites + +Primary Context Management +-------------------------- + +MANBRIEF primary context management functions of the low-level CUDA driver API (CURRENT_FILE) ENDMANBRIEF + + + +This section describes the primary context management functions of the low-level CUDA driver application programming interface. + + + +The primary context is unique per device and shared with the CUDA runtime API. These functions allow integration with other libraries using CUDA. + +.. autofunction:: cuda.bindings.driver.cuDevicePrimaryCtxRetain +.. autofunction:: cuda.bindings.driver.cuDevicePrimaryCtxRelease +.. autofunction:: cuda.bindings.driver.cuDevicePrimaryCtxSetFlags +.. autofunction:: cuda.bindings.driver.cuDevicePrimaryCtxGetState +.. autofunction:: cuda.bindings.driver.cuDevicePrimaryCtxReset + +Context Management +------------------ + +MANBRIEF context management functions of the low-level CUDA driver API (CURRENT_FILE) ENDMANBRIEF + + + +This section describes the context management functions of the low-level CUDA driver application programming interface. + + + +Please note that some functions are described in Primary Context Management section. + +.. autofunction:: cuda.bindings.driver.cuCtxCreate +.. autofunction:: cuda.bindings.driver.cuCtxDestroy +.. autofunction:: cuda.bindings.driver.cuCtxPushCurrent +.. autofunction:: cuda.bindings.driver.cuCtxPopCurrent +.. autofunction:: cuda.bindings.driver.cuCtxSetCurrent +.. autofunction:: cuda.bindings.driver.cuCtxGetCurrent +.. autofunction:: cuda.bindings.driver.cuCtxGetDevice +.. autofunction:: cuda.bindings.driver.cuCtxGetDevice_v2 +.. autofunction:: cuda.bindings.driver.cuCtxGetFlags +.. autofunction:: cuda.bindings.driver.cuCtxSetFlags +.. autofunction:: cuda.bindings.driver.cuCtxGetId +.. autofunction:: cuda.bindings.driver.cuCtxSynchronize +.. autofunction:: cuda.bindings.driver.cuCtxSynchronize_v2 +.. autofunction:: cuda.bindings.driver.cuCtxSetLimit +.. autofunction:: cuda.bindings.driver.cuCtxGetLimit +.. autofunction:: cuda.bindings.driver.cuCtxGetCacheConfig +.. autofunction:: cuda.bindings.driver.cuCtxSetCacheConfig +.. autofunction:: cuda.bindings.driver.cuCtxGetApiVersion +.. autofunction:: cuda.bindings.driver.cuCtxGetStreamPriorityRange +.. autofunction:: cuda.bindings.driver.cuCtxResetPersistingL2Cache +.. autofunction:: cuda.bindings.driver.cuCtxGetExecAffinity +.. autofunction:: cuda.bindings.driver.cuCtxRecordEvent +.. autofunction:: cuda.bindings.driver.cuCtxWaitEvent + +Module Management +----------------- + +MANBRIEF module management functions of the low-level CUDA driver API (CURRENT_FILE) ENDMANBRIEF + + + +This section describes the module management functions of the low-level CUDA driver application programming interface. + +.. autoclass:: cuda.bindings.driver.CUmoduleLoadingMode + + .. autoattribute:: cuda.bindings.driver.CUmoduleLoadingMode.CU_MODULE_EAGER_LOADING + + + Lazy Kernel Loading is not enabled + + + .. autoattribute:: cuda.bindings.driver.CUmoduleLoadingMode.CU_MODULE_LAZY_LOADING + + + Lazy Kernel Loading is enabled + +.. autofunction:: cuda.bindings.driver.cuModuleLoad +.. autofunction:: cuda.bindings.driver.cuModuleLoadData +.. autofunction:: cuda.bindings.driver.cuModuleLoadDataEx +.. autofunction:: cuda.bindings.driver.cuModuleLoadFatBinary +.. autofunction:: cuda.bindings.driver.cuModuleUnload +.. autofunction:: cuda.bindings.driver.cuModuleGetLoadingMode +.. autofunction:: cuda.bindings.driver.cuModuleGetFunction +.. autofunction:: cuda.bindings.driver.cuModuleGetFunctionCount +.. autofunction:: cuda.bindings.driver.cuModuleEnumerateFunctions +.. autofunction:: cuda.bindings.driver.cuModuleGetGlobal +.. autofunction:: cuda.bindings.driver.cuLinkCreate +.. autofunction:: cuda.bindings.driver.cuLinkAddData +.. autofunction:: cuda.bindings.driver.cuLinkAddFile +.. autofunction:: cuda.bindings.driver.cuLinkComplete +.. autofunction:: cuda.bindings.driver.cuLinkDestroy + +Library Management +------------------ + +MANBRIEF library management functions of the low-level CUDA driver API (CURRENT_FILE) ENDMANBRIEF + + + +This section describes the library management functions of the low-level CUDA driver application programming interface. + +.. autofunction:: cuda.bindings.driver.cuLibraryLoadData +.. autofunction:: cuda.bindings.driver.cuLibraryLoadFromFile +.. autofunction:: cuda.bindings.driver.cuLibraryUnload +.. autofunction:: cuda.bindings.driver.cuLibraryGetKernel +.. autofunction:: cuda.bindings.driver.cuLibraryGetKernelCount +.. autofunction:: cuda.bindings.driver.cuLibraryEnumerateKernels +.. autofunction:: cuda.bindings.driver.cuLibraryGetModule +.. autofunction:: cuda.bindings.driver.cuKernelGetFunction +.. autofunction:: cuda.bindings.driver.cuKernelGetLibrary +.. autofunction:: cuda.bindings.driver.cuLibraryGetGlobal +.. autofunction:: cuda.bindings.driver.cuLibraryGetManaged +.. autofunction:: cuda.bindings.driver.cuLibraryGetUnifiedFunction +.. autofunction:: cuda.bindings.driver.cuKernelGetAttribute +.. autofunction:: cuda.bindings.driver.cuKernelSetAttribute +.. autofunction:: cuda.bindings.driver.cuKernelSetCacheConfig +.. autofunction:: cuda.bindings.driver.cuKernelGetName +.. autofunction:: cuda.bindings.driver.cuKernelGetParamInfo +.. autofunction:: cuda.bindings.driver.cuKernelGetParamCount + +Memory Management +----------------- + +MANBRIEF memory management functions of the low-level CUDA driver API (CURRENT_FILE) ENDMANBRIEF + + + +This section describes the memory management functions of the low-level CUDA driver application programming interface. + +.. autoclass:: cuda.bindings.driver.CUmemDecompressParams_st +.. autoclass:: cuda.bindings.driver.CUmemDecompressAlgorithm + + .. autoattribute:: cuda.bindings.driver.CUmemDecompressAlgorithm.CU_MEM_DECOMPRESS_UNSUPPORTED + + + Decompression is unsupported. + + + .. autoattribute:: cuda.bindings.driver.CUmemDecompressAlgorithm.CU_MEM_DECOMPRESS_ALGORITHM_DEFLATE + + + Deflate is supported. + + + .. autoattribute:: cuda.bindings.driver.CUmemDecompressAlgorithm.CU_MEM_DECOMPRESS_ALGORITHM_SNAPPY + + + Snappy is supported. + + + .. autoattribute:: cuda.bindings.driver.CUmemDecompressAlgorithm.CU_MEM_DECOMPRESS_ALGORITHM_LZ4 + + + LZ4 is supported. + +.. autoclass:: cuda.bindings.driver.CUmemDecompressParams +.. autofunction:: cuda.bindings.driver.cuMemGetInfo +.. autofunction:: cuda.bindings.driver.cuMemAlloc +.. autofunction:: cuda.bindings.driver.cuMemAllocPitch +.. autofunction:: cuda.bindings.driver.cuMemFree +.. autofunction:: cuda.bindings.driver.cuMemGetAddressRange +.. autofunction:: cuda.bindings.driver.cuMemAllocHost +.. autofunction:: cuda.bindings.driver.cuMemFreeHost +.. autofunction:: cuda.bindings.driver.cuMemHostAlloc +.. autofunction:: cuda.bindings.driver.cuMemHostGetDevicePointer +.. autofunction:: cuda.bindings.driver.cuMemHostGetFlags +.. autofunction:: cuda.bindings.driver.cuMemAllocManaged +.. autofunction:: cuda.bindings.driver.cuDeviceRegisterAsyncNotification +.. autofunction:: cuda.bindings.driver.cuDeviceUnregisterAsyncNotification +.. autofunction:: cuda.bindings.driver.cuDeviceGetByPCIBusId +.. autofunction:: cuda.bindings.driver.cuDeviceGetPCIBusId +.. autofunction:: cuda.bindings.driver.cuIpcGetEventHandle +.. autofunction:: cuda.bindings.driver.cuIpcOpenEventHandle +.. autofunction:: cuda.bindings.driver.cuIpcGetMemHandle +.. autofunction:: cuda.bindings.driver.cuIpcOpenMemHandle +.. autofunction:: cuda.bindings.driver.cuIpcCloseMemHandle +.. autofunction:: cuda.bindings.driver.cuMemHostRegister +.. autofunction:: cuda.bindings.driver.cuMemHostUnregister +.. autofunction:: cuda.bindings.driver.cuMemcpy +.. autofunction:: cuda.bindings.driver.cuMemcpyPeer +.. autofunction:: cuda.bindings.driver.cuMemcpyHtoD +.. autofunction:: cuda.bindings.driver.cuMemcpyDtoH +.. autofunction:: cuda.bindings.driver.cuMemcpyDtoD +.. autofunction:: cuda.bindings.driver.cuMemcpyDtoA +.. autofunction:: cuda.bindings.driver.cuMemcpyAtoD +.. autofunction:: cuda.bindings.driver.cuMemcpyHtoA +.. autofunction:: cuda.bindings.driver.cuMemcpyAtoH +.. autofunction:: cuda.bindings.driver.cuMemcpyAtoA +.. autofunction:: cuda.bindings.driver.cuMemcpy2D +.. autofunction:: cuda.bindings.driver.cuMemcpy2DUnaligned +.. autofunction:: cuda.bindings.driver.cuMemcpy3D +.. autofunction:: cuda.bindings.driver.cuMemcpy3DPeer +.. autofunction:: cuda.bindings.driver.cuMemcpyAsync +.. autofunction:: cuda.bindings.driver.cuMemcpyPeerAsync +.. autofunction:: cuda.bindings.driver.cuMemcpyHtoDAsync +.. autofunction:: cuda.bindings.driver.cuMemcpyDtoHAsync +.. autofunction:: cuda.bindings.driver.cuMemcpyDtoDAsync +.. autofunction:: cuda.bindings.driver.cuMemcpyHtoAAsync +.. autofunction:: cuda.bindings.driver.cuMemcpyAtoHAsync +.. autofunction:: cuda.bindings.driver.cuMemcpy2DAsync +.. autofunction:: cuda.bindings.driver.cuMemcpy3DAsync +.. autofunction:: cuda.bindings.driver.cuMemcpy3DPeerAsync +.. autofunction:: cuda.bindings.driver.cuMemcpyBatchAsync +.. autofunction:: cuda.bindings.driver.cuMemcpy3DBatchAsync +.. autofunction:: cuda.bindings.driver.cuMemcpyWithAttributesAsync +.. autofunction:: cuda.bindings.driver.cuMemcpy3DWithAttributesAsync +.. autofunction:: cuda.bindings.driver.cuMemsetD8 +.. autofunction:: cuda.bindings.driver.cuMemsetD16 +.. autofunction:: cuda.bindings.driver.cuMemsetD32 +.. autofunction:: cuda.bindings.driver.cuMemsetD2D8 +.. autofunction:: cuda.bindings.driver.cuMemsetD2D16 +.. autofunction:: cuda.bindings.driver.cuMemsetD2D32 +.. autofunction:: cuda.bindings.driver.cuMemsetD8Async +.. autofunction:: cuda.bindings.driver.cuMemsetD16Async +.. autofunction:: cuda.bindings.driver.cuMemsetD32Async +.. autofunction:: cuda.bindings.driver.cuMemsetD2D8Async +.. autofunction:: cuda.bindings.driver.cuMemsetD2D16Async +.. autofunction:: cuda.bindings.driver.cuMemsetD2D32Async +.. autofunction:: cuda.bindings.driver.cuArrayCreate +.. autofunction:: cuda.bindings.driver.cuArrayGetDescriptor +.. autofunction:: cuda.bindings.driver.cuArrayGetSparseProperties +.. autofunction:: cuda.bindings.driver.cuMipmappedArrayGetSparseProperties +.. autofunction:: cuda.bindings.driver.cuArrayGetMemoryRequirements +.. autofunction:: cuda.bindings.driver.cuMipmappedArrayGetMemoryRequirements +.. autofunction:: cuda.bindings.driver.cuArrayGetPlane +.. autofunction:: cuda.bindings.driver.cuArrayDestroy +.. autofunction:: cuda.bindings.driver.cuArray3DCreate +.. autofunction:: cuda.bindings.driver.cuArray3DGetDescriptor +.. autofunction:: cuda.bindings.driver.cuMipmappedArrayCreate +.. autofunction:: cuda.bindings.driver.cuMipmappedArrayGetLevel +.. autofunction:: cuda.bindings.driver.cuMipmappedArrayDestroy +.. autofunction:: cuda.bindings.driver.cuMemGetHandleForAddressRange +.. autofunction:: cuda.bindings.driver.cuMemBatchDecompressAsync + +Virtual Memory Management +------------------------- + +MANBRIEF virtual memory management functions of the low-level CUDA driver API (CURRENT_FILE) ENDMANBRIEF + + + +This section describes the virtual memory management functions of the low-level CUDA driver application programming interface. + +.. autofunction:: cuda.bindings.driver.cuMemAddressReserve +.. autofunction:: cuda.bindings.driver.cuMemAddressFree +.. autofunction:: cuda.bindings.driver.cuMemCreate +.. autofunction:: cuda.bindings.driver.cuMemRelease +.. autofunction:: cuda.bindings.driver.cuMemMap +.. autofunction:: cuda.bindings.driver.cuMemMapArrayAsync +.. autofunction:: cuda.bindings.driver.cuMemUnmap +.. autofunction:: cuda.bindings.driver.cuMemSetAccess +.. autofunction:: cuda.bindings.driver.cuMemGetAccess +.. autofunction:: cuda.bindings.driver.cuMemExportToShareableHandle +.. autofunction:: cuda.bindings.driver.cuMemImportFromShareableHandle +.. autofunction:: cuda.bindings.driver.cuMemGetAllocationGranularity +.. autofunction:: cuda.bindings.driver.cuMemGetAllocationPropertiesFromHandle +.. autofunction:: cuda.bindings.driver.cuMemRetainAllocationHandle + +Stream Ordered Memory Allocator +------------------------------- + +MANBRIEF Functions for performing allocation and free operations in stream order. Functions for controlling the behavior of the underlying allocator. (CURRENT_FILE) ENDMANBRIEF + + + +This section describes the stream ordered memory allocator exposed by the low-level CUDA driver application programming interface. + + + + + +**overview** + +The asynchronous allocator allows the user to allocate and free in stream order. All asynchronous accesses of the allocation must happen between the stream executions of the allocation and the free. If the memory is accessed outside of the promised stream order, a use before allocation / use after free error will cause undefined behavior. + +The allocator is free to reallocate the memory as long as it can guarantee that compliant memory accesses will not overlap temporally. The allocator may refer to internal stream ordering as well as inter-stream dependencies (such as CUDA events and null stream dependencies) when establishing the temporal guarantee. The allocator may also insert inter-stream dependencies to establish the temporal guarantee. + + + + + +**Supported Platforms** + +Whether or not a device supports the integrated stream ordered memory allocator may be queried by calling cuDeviceGetAttribute() with the device attribute CU_DEVICE_ATTRIBUTE_MEMORY_POOLS_SUPPORTED + +.. autofunction:: cuda.bindings.driver.cuMemFreeAsync +.. autofunction:: cuda.bindings.driver.cuMemAllocAsync +.. autofunction:: cuda.bindings.driver.cuMemPoolTrimTo +.. autofunction:: cuda.bindings.driver.cuMemPoolSetAttribute +.. autofunction:: cuda.bindings.driver.cuMemPoolGetAttribute +.. autofunction:: cuda.bindings.driver.cuMemPoolSetAccess +.. autofunction:: cuda.bindings.driver.cuMemPoolGetAccess +.. autofunction:: cuda.bindings.driver.cuMemPoolCreate +.. autofunction:: cuda.bindings.driver.cuMemPoolDestroy +.. autofunction:: cuda.bindings.driver.cuMemGetDefaultMemPool +.. autofunction:: cuda.bindings.driver.cuMemGetMemPool +.. autofunction:: cuda.bindings.driver.cuMemSetMemPool +.. autofunction:: cuda.bindings.driver.cuMemAllocFromPoolAsync +.. autofunction:: cuda.bindings.driver.cuMemPoolExportToShareableHandle +.. autofunction:: cuda.bindings.driver.cuMemPoolImportFromShareableHandle +.. autofunction:: cuda.bindings.driver.cuMemPoolExportPointer +.. autofunction:: cuda.bindings.driver.cuMemPoolImportPointer + +Multicast Object Management +--------------------------- + +MANBRIEF Functions for creating multicast objects, adding devices to them and binding/unbinding memory (CURRENT_FILE) ENDMANBRIEF + + + +This section describes the CUDA multicast object operations exposed by the low-level CUDA driver application programming interface. + + + + + +**overview** + +A multicast object created via cuMulticastCreate enables certain memory operations to be broadcast to a team of devices. Devices can be added to a multicast object via cuMulticastAddDevice. Memory can be bound on each participating device via cuMulticastBindMem, cuMulticastBindMem_v2, cuMulticastBindAddr, or cuMulticastBindAddr_v2. Multicast objects can be mapped into a device's virtual address space using the virtual memmory management APIs (see cuMemMap and cuMemSetAccess). + + + + + +**Supported Platforms** + +Support for multicast on a specific device can be queried using the device attribute CU_DEVICE_ATTRIBUTE_MULTICAST_SUPPORTED + +.. autofunction:: cuda.bindings.driver.cuMulticastCreate +.. autofunction:: cuda.bindings.driver.cuMulticastAddDevice +.. autofunction:: cuda.bindings.driver.cuMulticastBindMem +.. autofunction:: cuda.bindings.driver.cuMulticastBindMem_v2 +.. autofunction:: cuda.bindings.driver.cuMulticastBindAddr +.. autofunction:: cuda.bindings.driver.cuMulticastBindAddr_v2 +.. autofunction:: cuda.bindings.driver.cuMulticastUnbind +.. autofunction:: cuda.bindings.driver.cuMulticastGetGranularity + +Logical Endpoint +---------------- + +MANBRIEF logical endpoint functions of the low-level CUDA driver API (CURRENT_FILE) ENDMANBRIEF + + + +This section describes the logical endpoint functions of the low-level CUDA driver application programming interface. + +.. autoclass:: cuda.bindings.driver.CUlogicalEndpointFabricHandle_st +.. autoclass:: cuda.bindings.driver.CUlogicalEndpointProp_struct +.. autoclass:: cuda.bindings.driver.CUlogicalEndpointIpcHandleType + + .. autoattribute:: cuda.bindings.driver.CUlogicalEndpointIpcHandleType.CU_LOGICAL_ENDPOINT_IPC_HANDLE_TYPE_NONE + + + .. autoattribute:: cuda.bindings.driver.CUlogicalEndpointIpcHandleType.CU_LOGICAL_ENDPOINT_IPC_HANDLE_TYPE_FABRIC + +.. autoclass:: cuda.bindings.driver.CUlogicalEndpointType + + .. autoattribute:: cuda.bindings.driver.CUlogicalEndpointType.CU_LOGICAL_ENDPOINT_TYPE_INVALID + + + .. autoattribute:: cuda.bindings.driver.CUlogicalEndpointType.CU_LOGICAL_ENDPOINT_TYPE_UNICAST + + + .. autoattribute:: cuda.bindings.driver.CUlogicalEndpointType.CU_LOGICAL_ENDPOINT_TYPE_MULTICAST + +.. autoclass:: cuda.bindings.driver.CUlogicalEndpointFlag + + .. autoattribute:: cuda.bindings.driver.CUlogicalEndpointFlag.CU_LOGICAL_ENDPOINT_FLAG_NONE + + + Default flag for logical endpoint construction + + + .. autoattribute:: cuda.bindings.driver.CUlogicalEndpointFlag.CU_LOGICAL_ENDPOINT_FLAG_COUNTED_OPS + + + Indicate the programmer's intention to use counted operations with the logical endpoint + +.. autoclass:: cuda.bindings.driver.CUlogicalEndpointId +.. autoclass:: cuda.bindings.driver.CUlogicalEndpointFabricHandle +.. autoclass:: cuda.bindings.driver.CUlogicalEndpointProp +.. autofunction:: cuda.bindings.driver.cuLogicalEndpointIdReserve +.. autofunction:: cuda.bindings.driver.cuLogicalEndpointIdRelease +.. autofunction:: cuda.bindings.driver.cuLogicalEndpointCreate +.. autofunction:: cuda.bindings.driver.cuLogicalEndpointAddDevice +.. autofunction:: cuda.bindings.driver.cuLogicalEndpointDestroy +.. autofunction:: cuda.bindings.driver.cuLogicalEndpointBindAddr +.. autofunction:: cuda.bindings.driver.cuLogicalEndpointBindMem +.. autofunction:: cuda.bindings.driver.cuLogicalEndpointUnbind +.. autofunction:: cuda.bindings.driver.cuLogicalEndpointExport +.. autofunction:: cuda.bindings.driver.cuLogicalEndpointImport +.. autofunction:: cuda.bindings.driver.cuLogicalEndpointGetLimits +.. autofunction:: cuda.bindings.driver.cuLogicalEndpointQuery + +Unified Addressing +------------------ + +MANBRIEF unified addressing functions of the low-level CUDA driver API (CURRENT_FILE) ENDMANBRIEF + + + +This section describes the unified addressing functions of the low-level CUDA driver application programming interface. + + + + + +**Overview** + +CUDA devices can share a unified address space with the host. For these devices there is no distinction between a device pointer and a host pointer -- the same pointer value may be used to access memory from the host program and from a kernel running on the device (with exceptions enumerated below). + + + + + +**Supported Platforms** + +Whether or not a device supports unified addressing may be queried by calling cuDeviceGetAttribute() with the device attribute CU_DEVICE_ATTRIBUTE_UNIFIED_ADDRESSING. + +Unified addressing is automatically enabled in 64-bit processes + + + + + +**Looking Up Information from Pointer Values** + +It is possible to look up information about the memory which backs a pointer value. For instance, one may want to know if a pointer points to host or device memory. As another example, in the case of device memory, one may want to know on which CUDA device the memory resides. These properties may be queried using the function cuPointerGetAttribute() + +Since pointers are unique, it is not necessary to specify information about the pointers specified to the various copy functions in the CUDA API. The function cuMemcpy() may be used to perform a copy between two pointers, ignoring whether they point to host or device memory (making cuMemcpyHtoD(), cuMemcpyDtoD(), and cuMemcpyDtoH() unnecessary for devices supporting unified addressing). For multidimensional copies, the memory type CU_MEMORYTYPE_UNIFIED may be used to specify that the CUDA driver should infer the location of the pointer from its value. + + + + + +**Automatic Mapping of Host Allocated Host Memory** + +All host memory allocated in all contexts using cuMemAllocHost() and cuMemHostAlloc() is always directly accessible from all contexts on all devices that support unified addressing. This is the case regardless of whether or not the flags CU_MEMHOSTALLOC_PORTABLE and CU_MEMHOSTALLOC_DEVICEMAP are specified. + +The pointer value through which allocated host memory may be accessed in kernels on all devices that support unified addressing is the same as the pointer value through which that memory is accessed on the host, so it is not necessary to call cuMemHostGetDevicePointer() to get the device pointer for these allocations. + +Note that this is not the case for memory allocated using the flag CU_MEMHOSTALLOC_WRITECOMBINED, as discussed below. + + + + + +**Automatic Registration of Peer Memory** + +Upon enabling direct access from a context that supports unified addressing to another peer context that supports unified addressing using cuCtxEnablePeerAccess() all memory allocated in the peer context using cuMemAlloc() and cuMemAllocPitch() will immediately be accessible by the current context. The device pointer value through which any peer memory may be accessed in the current context is the same pointer value through which that memory may be accessed in the peer context. + + + + + +**Exceptions, Disjoint Addressing** + +Not all memory may be accessed on devices through the same pointer value through which they are accessed on the host. These exceptions are host memory registered using cuMemHostRegister() and host memory allocated using the flag CU_MEMHOSTALLOC_WRITECOMBINED. For these exceptions, there exists a distinct host and device address for the memory. The device address is guaranteed to not overlap any valid host pointer range and is guaranteed to have the same value across all contexts that support unified addressing. + +This device address may be queried using cuMemHostGetDevicePointer() when a context using unified addressing is current. Either the host or the unified device pointer value may be used to refer to this memory through cuMemcpy() and similar functions using the CU_MEMORYTYPE_UNIFIED memory type. + +.. autofunction:: cuda.bindings.driver.cuPointerGetAttribute +.. autofunction:: cuda.bindings.driver.cuMemPrefetchAsync +.. autofunction:: cuda.bindings.driver.cuMemAdvise +.. autofunction:: cuda.bindings.driver.cuMemPrefetchBatchAsync +.. autofunction:: cuda.bindings.driver.cuMemDiscardBatchAsync +.. autofunction:: cuda.bindings.driver.cuMemDiscardAndPrefetchBatchAsync +.. autofunction:: cuda.bindings.driver.cuMemRangeGetAttribute +.. autofunction:: cuda.bindings.driver.cuMemRangeGetAttributes +.. autofunction:: cuda.bindings.driver.cuPointerSetAttribute +.. autofunction:: cuda.bindings.driver.cuPointerGetAttributes + +Stream Management +----------------- + +MANBRIEF stream management functions of the low-level CUDA driver API (CURRENT_FILE) ENDMANBRIEF + + + +This section describes the stream management functions of the low-level CUDA driver application programming interface. + +.. autoclass:: cuda.bindings.driver.CUgraphRecaptureStatus + + .. autoattribute:: cuda.bindings.driver.CUgraphRecaptureStatus.CU_GRAPH_RECAPTURE_ELIGIBLE_FOR_UPDATE + + + Node is eligible for update in an instantiated graph. + + + .. autoattribute:: cuda.bindings.driver.CUgraphRecaptureStatus.CU_GRAPH_RECAPTURE_INELIGIBLE_FOR_UPDATE + + + Parameter changes in the node cannot be applied to an instantiated graph. + + + .. autoattribute:: cuda.bindings.driver.CUgraphRecaptureStatus.CU_GRAPH_RECAPTURE_ERROR + + + Error while attempting to recapture the node. The recapture will be ended regardless of the return value from the callback. + +.. autoclass:: cuda.bindings.driver.CUgraphRecaptureCallback +.. autofunction:: cuda.bindings.driver.cuStreamCreate +.. autofunction:: cuda.bindings.driver.cuStreamCreateWithPriority +.. autofunction:: cuda.bindings.driver.cuStreamBeginCaptureToCig +.. autofunction:: cuda.bindings.driver.cuStreamEndCaptureToCig +.. autofunction:: cuda.bindings.driver.cuStreamGetPriority +.. autofunction:: cuda.bindings.driver.cuStreamGetDevice +.. autofunction:: cuda.bindings.driver.cuStreamGetFlags +.. autofunction:: cuda.bindings.driver.cuStreamGetId +.. autofunction:: cuda.bindings.driver.cuStreamGetCtx +.. autofunction:: cuda.bindings.driver.cuStreamGetCtx_v2 +.. autofunction:: cuda.bindings.driver.cuStreamWaitEvent +.. autofunction:: cuda.bindings.driver.cuStreamAddCallback +.. autofunction:: cuda.bindings.driver.cuStreamBeginCapture +.. autofunction:: cuda.bindings.driver.cuStreamBeginRecaptureToGraph +.. autofunction:: cuda.bindings.driver.cuStreamBeginCaptureToGraph +.. autofunction:: cuda.bindings.driver.cuThreadExchangeStreamCaptureMode +.. autofunction:: cuda.bindings.driver.cuStreamEndCapture +.. autofunction:: cuda.bindings.driver.cuStreamIsCapturing +.. autofunction:: cuda.bindings.driver.cuStreamGetCaptureInfo +.. autofunction:: cuda.bindings.driver.cuStreamUpdateCaptureDependencies +.. autofunction:: cuda.bindings.driver.cuStreamAttachMemAsync +.. autofunction:: cuda.bindings.driver.cuStreamQuery +.. autofunction:: cuda.bindings.driver.cuStreamSynchronize +.. autofunction:: cuda.bindings.driver.cuStreamDestroy +.. autofunction:: cuda.bindings.driver.cuStreamCopyAttributes +.. autofunction:: cuda.bindings.driver.cuStreamGetAttribute +.. autofunction:: cuda.bindings.driver.cuStreamSetAttribute + +Event Management +---------------- + +MANBRIEF event management functions of the low-level CUDA driver API (CURRENT_FILE) ENDMANBRIEF + + + +This section describes the event management functions of the low-level CUDA driver application programming interface. + +.. autofunction:: cuda.bindings.driver.cuEventCreate +.. autofunction:: cuda.bindings.driver.cuEventRecord +.. autofunction:: cuda.bindings.driver.cuEventRecordWithFlags +.. autofunction:: cuda.bindings.driver.cuEventQuery +.. autofunction:: cuda.bindings.driver.cuEventSynchronize +.. autofunction:: cuda.bindings.driver.cuEventDestroy +.. autofunction:: cuda.bindings.driver.cuEventElapsedTime + +External Resource Interoperability +---------------------------------- + +MANBRIEF External resource interoperability functions of the low-level CUDA driver API (CURRENT_FILE) ENDMANBRIEF + + + +This section describes the external resource interoperability functions of the low-level CUDA driver application programming interface. + +.. autofunction:: cuda.bindings.driver.cuImportExternalMemory +.. autofunction:: cuda.bindings.driver.cuExternalMemoryGetMappedBuffer +.. autofunction:: cuda.bindings.driver.cuExternalMemoryGetMappedMipmappedArray +.. autofunction:: cuda.bindings.driver.cuDestroyExternalMemory +.. autofunction:: cuda.bindings.driver.cuImportExternalSemaphore +.. autofunction:: cuda.bindings.driver.cuSignalExternalSemaphoresAsync +.. autofunction:: cuda.bindings.driver.cuWaitExternalSemaphoresAsync +.. autofunction:: cuda.bindings.driver.cuDestroyExternalSemaphore + +Stream Memory Operations +------------------------ + +MANBRIEF Stream memory operations of the low-level CUDA driver API (CURRENT_FILE) ENDMANBRIEF + + + +This section describes the stream memory operations of the low-level CUDA driver application programming interface. + + + +Support for the CU_STREAM_WAIT_VALUE_NOR flag can be queried with ::CU_DEVICE_ATTRIBUTE_CAN_USE_STREAM_WAIT_VALUE_NOR_V2. + + + +Support for the cuStreamWriteValue64() and cuStreamWaitValue64() functions, as well as for the CU_STREAM_MEM_OP_WAIT_VALUE_64 and CU_STREAM_MEM_OP_WRITE_VALUE_64 flags, can be queried with CU_DEVICE_ATTRIBUTE_CAN_USE_64_BIT_STREAM_MEM_OPS. + + + +Support for both CU_STREAM_WAIT_VALUE_FLUSH and CU_STREAM_MEM_OP_FLUSH_REMOTE_WRITES requires dedicated platform hardware features and can be queried with cuDeviceGetAttribute() and CU_DEVICE_ATTRIBUTE_CAN_FLUSH_REMOTE_WRITES. + + + +Note that all memory pointers passed as parameters to these operations are device pointers. Where necessary a device pointer should be obtained, for example with cuMemHostGetDevicePointer(). + + + +None of the operations accepts pointers to managed memory buffers (cuMemAllocManaged). + + + +Warning: Improper use of these APIs may deadlock the application. Synchronization ordering established through these APIs is not visible to CUDA. CUDA tasks that are (even indirectly) ordered by these APIs should also have that order expressed with CUDA-visible dependencies such as events. This ensures that the scheduler does not serialize them in an improper order. + +.. autofunction:: cuda.bindings.driver.cuStreamWaitValue32 +.. autofunction:: cuda.bindings.driver.cuStreamWaitValue64 +.. autofunction:: cuda.bindings.driver.cuStreamWriteValue32 +.. autofunction:: cuda.bindings.driver.cuStreamWriteValue64 +.. autofunction:: cuda.bindings.driver.cuStreamBatchMemOp + +Execution Control +----------------- + +MANBRIEF execution control functions of the low-level CUDA driver API (CURRENT_FILE) ENDMANBRIEF + + + +This section describes the execution control functions of the low-level CUDA driver application programming interface. + +.. autoclass:: cuda.bindings.driver.CUfunctionLoadingState + + .. autoattribute:: cuda.bindings.driver.CUfunctionLoadingState.CU_FUNCTION_LOADING_STATE_UNLOADED + + + .. autoattribute:: cuda.bindings.driver.CUfunctionLoadingState.CU_FUNCTION_LOADING_STATE_LOADED + + + .. autoattribute:: cuda.bindings.driver.CUfunctionLoadingState.CU_FUNCTION_LOADING_STATE_MAX + +.. autofunction:: cuda.bindings.driver.cuFuncGetAttribute +.. autofunction:: cuda.bindings.driver.cuFuncSetAttribute +.. autofunction:: cuda.bindings.driver.cuFuncSetCacheConfig +.. autofunction:: cuda.bindings.driver.cuFuncGetModule +.. autofunction:: cuda.bindings.driver.cuFuncGetName +.. autofunction:: cuda.bindings.driver.cuFuncGetParamInfo +.. autofunction:: cuda.bindings.driver.cuFuncGetParamCount +.. autofunction:: cuda.bindings.driver.cuFuncIsLoaded +.. autofunction:: cuda.bindings.driver.cuFuncLoad +.. autofunction:: cuda.bindings.driver.cuLaunchKernel +.. autofunction:: cuda.bindings.driver.cuLaunchKernelEx +.. autofunction:: cuda.bindings.driver.cuLaunchCooperativeKernel +.. autofunction:: cuda.bindings.driver.cuLaunchHostFunc +.. autofunction:: cuda.bindings.driver.cuLaunchHostFunc_v2 + +Graph Management +---------------- + +MANBRIEF graph management functions of the low-level CUDA driver API (CURRENT_FILE) ENDMANBRIEF + + + +This section describes the graph management functions of the low-level CUDA driver application programming interface. + +.. autofunction:: cuda.bindings.driver.cuGraphCreate +.. autofunction:: cuda.bindings.driver.cuGraphAddKernelNode +.. autofunction:: cuda.bindings.driver.cuGraphKernelNodeGetParams +.. autofunction:: cuda.bindings.driver.cuGraphKernelNodeSetParams +.. autofunction:: cuda.bindings.driver.cuGraphAddMemcpyNode +.. autofunction:: cuda.bindings.driver.cuGraphMemcpyNodeGetParams +.. autofunction:: cuda.bindings.driver.cuGraphMemcpyNodeSetParams +.. autofunction:: cuda.bindings.driver.cuGraphAddMemsetNode +.. autofunction:: cuda.bindings.driver.cuGraphMemsetNodeGetParams +.. autofunction:: cuda.bindings.driver.cuGraphMemsetNodeSetParams +.. autofunction:: cuda.bindings.driver.cuGraphAddHostNode +.. autofunction:: cuda.bindings.driver.cuGraphHostNodeGetParams +.. autofunction:: cuda.bindings.driver.cuGraphHostNodeSetParams +.. autofunction:: cuda.bindings.driver.cuGraphAddChildGraphNode +.. autofunction:: cuda.bindings.driver.cuGraphChildGraphNodeGetGraph +.. autofunction:: cuda.bindings.driver.cuGraphAddEmptyNode +.. autofunction:: cuda.bindings.driver.cuGraphAddEventRecordNode +.. autofunction:: cuda.bindings.driver.cuGraphEventRecordNodeGetEvent +.. autofunction:: cuda.bindings.driver.cuGraphEventRecordNodeSetEvent +.. autofunction:: cuda.bindings.driver.cuGraphAddEventWaitNode +.. autofunction:: cuda.bindings.driver.cuGraphEventWaitNodeGetEvent +.. autofunction:: cuda.bindings.driver.cuGraphEventWaitNodeSetEvent +.. autofunction:: cuda.bindings.driver.cuGraphAddExternalSemaphoresSignalNode +.. autofunction:: cuda.bindings.driver.cuGraphExternalSemaphoresSignalNodeGetParams +.. autofunction:: cuda.bindings.driver.cuGraphExternalSemaphoresSignalNodeSetParams +.. autofunction:: cuda.bindings.driver.cuGraphAddExternalSemaphoresWaitNode +.. autofunction:: cuda.bindings.driver.cuGraphExternalSemaphoresWaitNodeGetParams +.. autofunction:: cuda.bindings.driver.cuGraphExternalSemaphoresWaitNodeSetParams +.. autofunction:: cuda.bindings.driver.cuGraphAddBatchMemOpNode +.. autofunction:: cuda.bindings.driver.cuGraphBatchMemOpNodeGetParams +.. autofunction:: cuda.bindings.driver.cuGraphBatchMemOpNodeSetParams +.. autofunction:: cuda.bindings.driver.cuGraphExecBatchMemOpNodeSetParams +.. autofunction:: cuda.bindings.driver.cuGraphAddMemAllocNode +.. autofunction:: cuda.bindings.driver.cuGraphMemAllocNodeGetParams +.. autofunction:: cuda.bindings.driver.cuGraphAddMemFreeNode +.. autofunction:: cuda.bindings.driver.cuGraphMemFreeNodeGetParams +.. autofunction:: cuda.bindings.driver.cuDeviceGraphMemTrim +.. autofunction:: cuda.bindings.driver.cuDeviceGetGraphMemAttribute +.. autofunction:: cuda.bindings.driver.cuDeviceSetGraphMemAttribute +.. autofunction:: cuda.bindings.driver.cuGraphClone +.. autofunction:: cuda.bindings.driver.cuGraphNodeFindInClone +.. autofunction:: cuda.bindings.driver.cuGraphNodeGetType +.. autofunction:: cuda.bindings.driver.cuGraphNodeGetContainingGraph +.. autofunction:: cuda.bindings.driver.cuGraphNodeGetLocalId +.. autofunction:: cuda.bindings.driver.cuGraphNodeGetToolsId +.. autofunction:: cuda.bindings.driver.cuGraphGetId +.. autofunction:: cuda.bindings.driver.cuGraphExecGetId +.. autofunction:: cuda.bindings.driver.cuGraphGetNodes +.. autofunction:: cuda.bindings.driver.cuGraphGetRootNodes +.. autofunction:: cuda.bindings.driver.cuGraphGetEdges +.. autofunction:: cuda.bindings.driver.cuGraphNodeGetDependencies +.. autofunction:: cuda.bindings.driver.cuGraphNodeGetDependentNodes +.. autofunction:: cuda.bindings.driver.cuGraphAddDependencies +.. autofunction:: cuda.bindings.driver.cuGraphRemoveDependencies +.. autofunction:: cuda.bindings.driver.cuGraphDestroyNode +.. autofunction:: cuda.bindings.driver.cuGraphInstantiate +.. autofunction:: cuda.bindings.driver.cuGraphInstantiateWithParams +.. autofunction:: cuda.bindings.driver.cuGraphExecGetFlags +.. autofunction:: cuda.bindings.driver.cuGraphExecKernelNodeSetParams +.. autofunction:: cuda.bindings.driver.cuGraphExecMemcpyNodeSetParams +.. autofunction:: cuda.bindings.driver.cuGraphExecMemsetNodeSetParams +.. autofunction:: cuda.bindings.driver.cuGraphExecHostNodeSetParams +.. autofunction:: cuda.bindings.driver.cuGraphExecChildGraphNodeSetParams +.. autofunction:: cuda.bindings.driver.cuGraphExecEventRecordNodeSetEvent +.. autofunction:: cuda.bindings.driver.cuGraphExecEventWaitNodeSetEvent +.. autofunction:: cuda.bindings.driver.cuGraphExecExternalSemaphoresSignalNodeSetParams +.. autofunction:: cuda.bindings.driver.cuGraphExecExternalSemaphoresWaitNodeSetParams +.. autofunction:: cuda.bindings.driver.cuGraphNodeSetEnabled +.. autofunction:: cuda.bindings.driver.cuGraphNodeGetEnabled +.. autofunction:: cuda.bindings.driver.cuGraphUpload +.. autofunction:: cuda.bindings.driver.cuGraphLaunch +.. autofunction:: cuda.bindings.driver.cuGraphExecDestroy +.. autofunction:: cuda.bindings.driver.cuGraphDestroy +.. autofunction:: cuda.bindings.driver.cuGraphExecUpdate +.. autofunction:: cuda.bindings.driver.cuGraphKernelNodeCopyAttributes +.. autofunction:: cuda.bindings.driver.cuGraphKernelNodeGetAttribute +.. autofunction:: cuda.bindings.driver.cuGraphKernelNodeSetAttribute +.. autofunction:: cuda.bindings.driver.cuGraphDebugDotPrint +.. autofunction:: cuda.bindings.driver.cuUserObjectCreate +.. autofunction:: cuda.bindings.driver.cuUserObjectRetain +.. autofunction:: cuda.bindings.driver.cuUserObjectRelease +.. autofunction:: cuda.bindings.driver.cuGraphRetainUserObject +.. autofunction:: cuda.bindings.driver.cuGraphReleaseUserObject +.. autofunction:: cuda.bindings.driver.cuGraphAddNode +.. autofunction:: cuda.bindings.driver.cuGraphNodeSetParams +.. autofunction:: cuda.bindings.driver.cuGraphNodeGetParams +.. autofunction:: cuda.bindings.driver.cuGraphExecNodeSetParams +.. autofunction:: cuda.bindings.driver.cuGraphConditionalHandleCreate + +Occupancy +--------- + +MANBRIEF occupancy calculation functions of the low-level CUDA driver API (CURRENT_FILE) ENDMANBRIEF + + + +This section describes the occupancy calculation functions of the low-level CUDA driver application programming interface. + +.. autofunction:: cuda.bindings.driver.cuOccupancyMaxActiveBlocksPerMultiprocessor +.. autofunction:: cuda.bindings.driver.cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags +.. autofunction:: cuda.bindings.driver.cuOccupancyMaxPotentialBlockSize +.. autofunction:: cuda.bindings.driver.cuOccupancyMaxPotentialBlockSizeWithFlags +.. autofunction:: cuda.bindings.driver.cuOccupancyAvailableDynamicSMemPerBlock +.. autofunction:: cuda.bindings.driver.cuOccupancyMaxPotentialClusterSize +.. autofunction:: cuda.bindings.driver.cuOccupancyMaxActiveClusters + +Texture Object Management +------------------------- + +MANBRIEF texture object management functions of the low-level CUDA driver API (CURRENT_FILE) ENDMANBRIEF + + + +This section describes the texture object management functions of the low-level CUDA driver application programming interface. The texture object API is only supported on devices of compute capability 3.0 or higher. + +.. autofunction:: cuda.bindings.driver.cuTexObjectCreate +.. autofunction:: cuda.bindings.driver.cuTexObjectDestroy +.. autofunction:: cuda.bindings.driver.cuTexObjectGetResourceDesc +.. autofunction:: cuda.bindings.driver.cuTexObjectGetTextureDesc +.. autofunction:: cuda.bindings.driver.cuTexObjectGetResourceViewDesc + +Surface Object Management +------------------------- + +MANBRIEF surface object management functions of the low-level CUDA driver API (CURRENT_FILE) ENDMANBRIEF + + + +This section describes the surface object management functions of the low-level CUDA driver application programming interface. The surface object API is only supported on devices of compute capability 3.0 or higher. + +.. autofunction:: cuda.bindings.driver.cuSurfObjectCreate +.. autofunction:: cuda.bindings.driver.cuSurfObjectDestroy +.. autofunction:: cuda.bindings.driver.cuSurfObjectGetResourceDesc + +Tensor Map Object Managment +--------------------------- + +MANBRIEF tensor map object management functions of the low-level CUDA driver API (CURRENT_FILE) ENDMANBRIEF + + + +This section describes the tensor map object management functions of the low-level CUDA driver application programming interface. The tensor core API is only supported on devices of compute capability 9.0 or higher. + +.. autofunction:: cuda.bindings.driver.cuTensorMapEncodeTiled +.. autofunction:: cuda.bindings.driver.cuTensorMapEncodeIm2col +.. autofunction:: cuda.bindings.driver.cuTensorMapEncodeIm2colWide +.. autofunction:: cuda.bindings.driver.cuTensorMapReplaceAddress + +Peer Context Memory Access +-------------------------- + +MANBRIEF direct peer context memory access functions of the low-level CUDA driver API (CURRENT_FILE) ENDMANBRIEF + + + +This section describes the direct peer context memory access functions of the low-level CUDA driver application programming interface. + +.. autofunction:: cuda.bindings.driver.cuDeviceCanAccessPeer +.. autofunction:: cuda.bindings.driver.cuCtxEnablePeerAccess +.. autofunction:: cuda.bindings.driver.cuCtxDisablePeerAccess +.. autofunction:: cuda.bindings.driver.cuDeviceGetP2PAttribute +.. autofunction:: cuda.bindings.driver.cuDeviceGetP2PAtomicCapabilities + +Graphics Interoperability +------------------------- + +MANBRIEF graphics interoperability functions of the low-level CUDA driver API (CURRENT_FILE) ENDMANBRIEF + + + +This section describes the graphics interoperability functions of the low-level CUDA driver application programming interface. + +.. autofunction:: cuda.bindings.driver.cuGraphicsUnregisterResource +.. autofunction:: cuda.bindings.driver.cuGraphicsSubResourceGetMappedArray +.. autofunction:: cuda.bindings.driver.cuGraphicsResourceGetMappedMipmappedArray +.. autofunction:: cuda.bindings.driver.cuGraphicsResourceGetMappedPointer +.. autofunction:: cuda.bindings.driver.cuGraphicsResourceSetMapFlags +.. autofunction:: cuda.bindings.driver.cuGraphicsMapResources +.. autofunction:: cuda.bindings.driver.cuGraphicsUnmapResources + +Driver Entry Point Access +------------------------- + +MANBRIEF driver entry point access functions of the low-level CUDA driver API (CURRENT_FILE) ENDMANBRIEF + + + +This section describes the driver entry point access functions of the low-level CUDA driver application programming interface. + +.. autofunction:: cuda.bindings.driver.cuGetProcAddress + +Coredump Attributes Control API +------------------------------- + +MANBRIEF coredump attribute control functions for the low-level CUDA API (CURRENT_FILE) ENDMANBRIEF + + + +This section describes the coredump attribute control functions of the low-level CUDA driver application programming interface. + +.. autoclass:: cuda.bindings.driver.CUcoredumpSettings + + .. autoattribute:: cuda.bindings.driver.CUcoredumpSettings.CU_COREDUMP_ENABLE_ON_EXCEPTION + + + .. autoattribute:: cuda.bindings.driver.CUcoredumpSettings.CU_COREDUMP_TRIGGER_HOST + + + .. autoattribute:: cuda.bindings.driver.CUcoredumpSettings.CU_COREDUMP_LIGHTWEIGHT + + + .. autoattribute:: cuda.bindings.driver.CUcoredumpSettings.CU_COREDUMP_ENABLE_USER_TRIGGER + + + .. autoattribute:: cuda.bindings.driver.CUcoredumpSettings.CU_COREDUMP_FILE + + + .. autoattribute:: cuda.bindings.driver.CUcoredumpSettings.CU_COREDUMP_PIPE + + + .. autoattribute:: cuda.bindings.driver.CUcoredumpSettings.CU_COREDUMP_GENERATION_FLAGS + + + .. autoattribute:: cuda.bindings.driver.CUcoredumpSettings.CU_COREDUMP_MAX + +.. autoclass:: cuda.bindings.driver.CUCoredumpGenerationFlags + + .. autoattribute:: cuda.bindings.driver.CUCoredumpGenerationFlags.CU_COREDUMP_DEFAULT_FLAGS + + + .. autoattribute:: cuda.bindings.driver.CUCoredumpGenerationFlags.CU_COREDUMP_SKIP_NONRELOCATED_ELF_IMAGES + + + .. autoattribute:: cuda.bindings.driver.CUCoredumpGenerationFlags.CU_COREDUMP_SKIP_GLOBAL_MEMORY + + + .. autoattribute:: cuda.bindings.driver.CUCoredumpGenerationFlags.CU_COREDUMP_SKIP_SHARED_MEMORY + + + .. autoattribute:: cuda.bindings.driver.CUCoredumpGenerationFlags.CU_COREDUMP_SKIP_LOCAL_MEMORY + + + .. autoattribute:: cuda.bindings.driver.CUCoredumpGenerationFlags.CU_COREDUMP_SKIP_ABORT + + + .. autoattribute:: cuda.bindings.driver.CUCoredumpGenerationFlags.CU_COREDUMP_SKIP_CONSTBANK_MEMORY + + + .. autoattribute:: cuda.bindings.driver.CUCoredumpGenerationFlags.CU_COREDUMP_GZIP_COMPRESS + + + .. autoattribute:: cuda.bindings.driver.CUCoredumpGenerationFlags.CU_COREDUMP_FAULTED_CONTEXTS_ONLY + + + .. autoattribute:: cuda.bindings.driver.CUCoredumpGenerationFlags.CU_COREDUMP_NO_ERRBAR_AT_EXIT + + + .. autoattribute:: cuda.bindings.driver.CUCoredumpGenerationFlags.CU_COREDUMP_LOG_ONLY + + + .. autoattribute:: cuda.bindings.driver.CUCoredumpGenerationFlags.CU_COREDUMP_LIGHTWEIGHT_FLAGS + +.. autoclass:: cuda.bindings.driver.CUcoredumpCallbackHandle +.. autoclass:: cuda.bindings.driver.CUcoredumpStatusCallback +.. autofunction:: cuda.bindings.driver.cuCoredumpGetAttribute +.. autofunction:: cuda.bindings.driver.cuCoredumpGetAttributeGlobal +.. autofunction:: cuda.bindings.driver.cuCoredumpSetAttribute +.. autofunction:: cuda.bindings.driver.cuCoredumpSetAttributeGlobal +.. autofunction:: cuda.bindings.driver.cuCoredumpRegisterStartCallback +.. autofunction:: cuda.bindings.driver.cuCoredumpRegisterCompleteCallback +.. autofunction:: cuda.bindings.driver.cuCoredumpDeregisterStartCallback +.. autofunction:: cuda.bindings.driver.cuCoredumpDeregisterCompleteCallback + +Green Contexts +-------------- + +MANBRIEF Driver level API for creation and manipulation of green contexts (CURRENT_FILE) ENDMANBRIEF + + + +This section describes the APIs for creation and manipulation of green contexts in the CUDA driver. Green contexts are a lightweight alternative to traditional contexts, that can be used to select a subset of device resources. This allows the developer to, for example, select SMs from distinct spatial partitions of the GPU and target them via CUDA stream operations, kernel launches, etc. + + + +Here are the broad initial steps to follow to get started: + +- (1) Start with an initial set of resources. For SM resources, they can be fetched via cuDeviceGetDevResource. In case of workqueues, a new configuration can be used or an existing one queried via the cuDeviceGetDevResource API. + + + + + + + +- (2) Modify these resources by either partitioning them (in case of SMs) or changing the configuration (in case of workqueues). To partition SMs, we recommend cuDevSmResourceSplit. Changing the workqueue configuration can be done directly in place. + + + + + + + +- (3) Finalize the specification of resources by creating a descriptor via cuDevResourceGenerateDesc. + + + + + + + +- (4) Create a green context via cuGreenCtxCreate. This provisions the resource, such as workqueues (until this step it was only a configuration specification). + + + + + + + +- (5) Create a stream via cuGreenCtxStreamCreate, and use it throughout your application. + + + + + + + + + + + + + +SMs + + + + + +There are two possible partition operations - with cuDevSmResourceSplitByCount the partitions created have to follow default SM count granularity requirements, so it will often be rounded up and aligned to a default value. On the other hand, cuDevSmResourceSplit is explicit and allows for creation of non-equal groups. It will not round up automatically - instead it is the developer’s responsibility to query and set the correct values. These requirements can be queried with cuDeviceGetDevResource to determine the alignment granularity (sm.smCoscheduledAlignment). A general guideline on the default values for each compute architecture: + +- On Compute Architecture 7.X, 8.X, and all Tegra SoC: + + + + + + - The smCount must be a multiple of 2. + + + + + + + + - The alignment (and default value of coscheduledSmCount) is 2. + + + + + + + + + +- On Compute Architecture 9.0+: + + + + + + - The smCount must be a multiple of 8, or coscheduledSmCount if provided. + + + + + + + + - The alignment (and default value of coscheduledSmCount) is 8. While the maximum value for coscheduled SM count is 32 on all Compute Architecture 9.0+, it's recommended to follow cluster size requirements. The portable cluster size and the max cluster size should be used in order to benefit from this co-scheduling. + + + + + + + + + + + + + + + +Workqueues + + + + + +For ``CU_DEV_RESOURCE_TYPE_WORKQUEUE_CONFIG``, the resource specifies the expected maximum number of concurrent stream-ordered workloads via the ``wqConcurrencyLimit`` field. The ``sharingScope`` field determines how workqueue resources are shared: + +- ``CU_WORKQUEUE_SCOPE_DEVICE_CTX:`` Use all shared workqueue resources across all contexts (default driver behavior). + + + + + + + +- ``CU_WORKQUEUE_SCOPE_GREEN_CTX_BALANCED:`` When possible, use non-overlapping workqueue resources with other balanced green contexts. + + + + + + + + + + + +The maximum concurrency limit depends on ::CUDA_DEVICE_MAX_CONNECTIONS and can be queried from the primary context via cuCtxGetDevResource. Configurations may exceed this concurrency limit, but the driver will not guarantee that work submission remains non-overlapping. + + + +For ``CU_DEV_RESOURCE_TYPE_WORKQUEUE``, the resource represents a pre-existing workqueue that can be retrieved from existing contexts or green contexts. This allows reusing workqueue resources across different green contexts. + + + + + +On Concurrency + + + + + +Even if the green contexts have disjoint SM partitions, it is not guaranteed that the kernels launched in them will run concurrently or have forward progress guarantees. This is due to other resources that could cause a dependency. Using a combination of disjoint SMs and CU_WORKQUEUE_SCOPE_GREEN_CTX_BALANCED workqueue configurations can provide the best chance of avoiding interference. More resources will be added in the future to provide stronger guarantees. + + + +Additionally, there are two known scenarios, where its possible for the workload to run on more SMs than was provisioned (but never less). + +- On Volta+ MPS: When ``CUDA_MPS_ACTIVE_THREAD_PERCENTAGE`` is used, the set of SMs that are used for running kernels can be scaled up to the value of SMs used for the MPS client. + + + + + + + +- On Compute Architecture 9.x: When a module with dynamic parallelism (CDP) is loaded, all future kernels running under green contexts may use and share an additional set of 2 SMs. + +.. autoclass:: cuda.bindings.driver.CUdevSmResource_st +.. autoclass:: cuda.bindings.driver.CUdevWorkqueueConfigResource_st +.. autoclass:: cuda.bindings.driver.CUdevWorkqueueResource_st +.. autoclass:: cuda.bindings.driver.CU_DEV_SM_RESOURCE_GROUP_PARAMS_st +.. autoclass:: cuda.bindings.driver.CUdevResource_st +.. autoclass:: cuda.bindings.driver.CUdevSmResource +.. autoclass:: cuda.bindings.driver.CUdevWorkqueueConfigResource +.. autoclass:: cuda.bindings.driver.CUdevWorkqueueResource +.. autoclass:: cuda.bindings.driver.CU_DEV_SM_RESOURCE_GROUP_PARAMS +.. autoclass:: cuda.bindings.driver.CUdevResource +.. autoclass:: cuda.bindings.driver.CUgreenCtxCreate_flags + + .. autoattribute:: cuda.bindings.driver.CUgreenCtxCreate_flags.CU_GREEN_CTX_NONE + + + .. autoattribute:: cuda.bindings.driver.CUgreenCtxCreate_flags.CU_GREEN_CTX_DEFAULT_STREAM + + + Creates a default stream to use inside the green context + +.. autoclass:: cuda.bindings.driver.CUdevSmResourceGroup_flags + + .. autoattribute:: cuda.bindings.driver.CUdevSmResourceGroup_flags.CU_DEV_SM_RESOURCE_GROUP_DEFAULT + + + .. autoattribute:: cuda.bindings.driver.CUdevSmResourceGroup_flags.CU_DEV_SM_RESOURCE_GROUP_BACKFILL + +.. autoclass:: cuda.bindings.driver.CUdevSmResourceSplitByCount_flags + + .. autoattribute:: cuda.bindings.driver.CUdevSmResourceSplitByCount_flags.CU_DEV_SM_RESOURCE_SPLIT_IGNORE_SM_COSCHEDULING + + + .. autoattribute:: cuda.bindings.driver.CUdevSmResourceSplitByCount_flags.CU_DEV_SM_RESOURCE_SPLIT_MAX_POTENTIAL_CLUSTER_SIZE + +.. autoclass:: cuda.bindings.driver.CUdevResourceType + + .. autoattribute:: cuda.bindings.driver.CUdevResourceType.CU_DEV_RESOURCE_TYPE_INVALID + + + .. autoattribute:: cuda.bindings.driver.CUdevResourceType.CU_DEV_RESOURCE_TYPE_SM + + + Streaming multiprocessors related information + + + .. autoattribute:: cuda.bindings.driver.CUdevResourceType.CU_DEV_RESOURCE_TYPE_WORKQUEUE_CONFIG + + + Workqueue configuration related information + + + .. autoattribute:: cuda.bindings.driver.CUdevResourceType.CU_DEV_RESOURCE_TYPE_WORKQUEUE + + + Pre-existing workqueue related information + +.. autoclass:: cuda.bindings.driver.CUdevWorkqueueConfigScope + + .. autoattribute:: cuda.bindings.driver.CUdevWorkqueueConfigScope.CU_WORKQUEUE_SCOPE_DEVICE_CTX + + + Use all shared workqueue resources across all contexts. Default driver behaviour. + + + .. autoattribute:: cuda.bindings.driver.CUdevWorkqueueConfigScope.CU_WORKQUEUE_SCOPE_GREEN_CTX_BALANCED + + + When possible, use non-overlapping workqueue resources with other balanced green contexts. + +.. autoclass:: cuda.bindings.driver.CUdevResourceDesc +.. autoclass:: cuda.bindings.driver.CUdevSmResource +.. autoclass:: cuda.bindings.driver.CUdevWorkqueueConfigResource +.. autoclass:: cuda.bindings.driver.CUdevWorkqueueResource +.. autoclass:: cuda.bindings.driver.CU_DEV_SM_RESOURCE_GROUP_PARAMS +.. autofunction:: cuda.bindings.driver._CONCAT_OUTER +.. autofunction:: cuda.bindings.driver.cuGreenCtxCreate +.. autofunction:: cuda.bindings.driver.cuGreenCtxDestroy +.. autofunction:: cuda.bindings.driver.cuCtxFromGreenCtx +.. autofunction:: cuda.bindings.driver.cuDeviceGetDevResource +.. autofunction:: cuda.bindings.driver.cuCtxGetDevResource +.. autofunction:: cuda.bindings.driver.cuGreenCtxGetDevResource +.. autofunction:: cuda.bindings.driver.cuDevSmResourceSplitByCount +.. autofunction:: cuda.bindings.driver.cuDevSmResourceSplit +.. autofunction:: cuda.bindings.driver.cuDevResourceGenerateDesc +.. autofunction:: cuda.bindings.driver.cuGreenCtxRecordEvent +.. autofunction:: cuda.bindings.driver.cuGreenCtxWaitEvent +.. autofunction:: cuda.bindings.driver.cuStreamGetGreenCtx +.. autofunction:: cuda.bindings.driver.cuGreenCtxStreamCreate +.. autofunction:: cuda.bindings.driver.cuGreenCtxGetId +.. autofunction:: cuda.bindings.driver.cuStreamGetDevResource +.. autoattribute:: cuda.bindings.driver.RESOURCE_ABI_VERSION +.. autoattribute:: cuda.bindings.driver.RESOURCE_ABI_BYTES +.. autoattribute:: cuda.bindings.driver._CONCAT_INNER +.. autoattribute:: cuda.bindings.driver._CONCAT_OUTER + +Error Log Management Functions +------------------------------ + +MANBRIEF error log management functions for the low-level CUDA API (CURRENT_FILE) ENDMANBRIEF + + + +This section describes the error log management functions of the low-level CUDA driver application programming interface. + +.. autoclass:: cuda.bindings.driver.CUlogLevel + + .. autoattribute:: cuda.bindings.driver.CUlogLevel.CU_LOG_LEVEL_ERROR + + + .. autoattribute:: cuda.bindings.driver.CUlogLevel.CU_LOG_LEVEL_WARNING + +.. autoclass:: cuda.bindings.driver.CUlogsCallbackHandle +.. autoclass:: cuda.bindings.driver.CUlogsCallback +.. autoclass:: cuda.bindings.driver.CUlogIterator +.. autofunction:: cuda.bindings.driver.cuLogsRegisterCallback +.. autofunction:: cuda.bindings.driver.cuLogsUnregisterCallback +.. autofunction:: cuda.bindings.driver.cuLogsCurrent +.. autofunction:: cuda.bindings.driver.cuLogsDumpToFile +.. autofunction:: cuda.bindings.driver.cuLogsDumpToMemory + +CUDA Checkpointing +------------------ + +CUDA API versioning support + + + +MANBRIEF CUDA checkpoint and restore functionality of the low-level CUDA driver API (CURRENT_FILE) ENDMANBRIEF + + + +This sections describes the checkpoint and restore functions of the low-level CUDA driver application programming interface. + + + +The CUDA checkpoint and restore API's provide a way to save and restore GPU state for full process checkpoints when used with CPU side process checkpointing solutions. They can also be used to pause GPU work and suspend a CUDA process to allow other applications to make use of GPU resources. + + + +Checkpoint and restore capabilities are currently restricted to Linux. + +.. autofunction:: cuda.bindings.driver.cuCheckpointProcessGetRestoreThreadId +.. autofunction:: cuda.bindings.driver.cuCheckpointProcessGetState +.. autofunction:: cuda.bindings.driver.cuCheckpointProcessLock +.. autofunction:: cuda.bindings.driver.cuCheckpointProcessCheckpoint +.. autofunction:: cuda.bindings.driver.cuCheckpointProcessRestore +.. autofunction:: cuda.bindings.driver.cuCheckpointProcessUnlock + +Profiler Control +---------------- + +MANBRIEF profiler control functions of the low-level CUDA driver API (CURRENT_FILE) ENDMANBRIEF + + + +This section describes the profiler control functions of the low-level CUDA driver application programming interface. + +.. autofunction:: cuda.bindings.driver.cuProfilerStart +.. autofunction:: cuda.bindings.driver.cuProfilerStop + +EGL Interoperability +-------------------- + +MANBRIEF EGL interoperability functions of the low-level CUDA driver API (CURRENT_FILE) ENDMANBRIEF + + + +This section describes the EGL interoperability functions of the low-level CUDA driver application programming interface. + +.. autofunction:: cuda.bindings.driver.cuGraphicsEGLRegisterImage +.. autofunction:: cuda.bindings.driver.cuEGLStreamConsumerConnect +.. autofunction:: cuda.bindings.driver.cuEGLStreamConsumerConnectWithFlags +.. autofunction:: cuda.bindings.driver.cuEGLStreamConsumerDisconnect +.. autofunction:: cuda.bindings.driver.cuEGLStreamConsumerAcquireFrame +.. autofunction:: cuda.bindings.driver.cuEGLStreamConsumerReleaseFrame +.. autofunction:: cuda.bindings.driver.cuEGLStreamProducerConnect +.. autofunction:: cuda.bindings.driver.cuEGLStreamProducerDisconnect +.. autofunction:: cuda.bindings.driver.cuEGLStreamProducerPresentFrame +.. autofunction:: cuda.bindings.driver.cuEGLStreamProducerReturnFrame +.. autofunction:: cuda.bindings.driver.cuGraphicsResourceGetMappedEglFrame +.. autofunction:: cuda.bindings.driver.cuEventCreateFromEGLSync + +OpenGL Interoperability +----------------------- + +MANBRIEF OpenGL interoperability functions of the low-level CUDA driver API (CURRENT_FILE) ENDMANBRIEF + + + +This section describes the OpenGL interoperability functions of the low-level CUDA driver application programming interface. Note that mapping of OpenGL resources is performed with the graphics API agnostic, resource mapping interface described in Graphics Interoperability. + +.. autoclass:: cuda.bindings.driver.CUGLDeviceList + + .. autoattribute:: cuda.bindings.driver.CUGLDeviceList.CU_GL_DEVICE_LIST_ALL + + + The CUDA devices for all GPUs used by the current OpenGL context + + + .. autoattribute:: cuda.bindings.driver.CUGLDeviceList.CU_GL_DEVICE_LIST_CURRENT_FRAME + + + The CUDA devices for the GPUs used by the current OpenGL context in its currently rendering frame + + + .. autoattribute:: cuda.bindings.driver.CUGLDeviceList.CU_GL_DEVICE_LIST_NEXT_FRAME + + + The CUDA devices for the GPUs to be used by the current OpenGL context in the next frame + +.. autofunction:: cuda.bindings.driver.cuGraphicsGLRegisterBuffer +.. autofunction:: cuda.bindings.driver.cuGraphicsGLRegisterImage +.. autofunction:: cuda.bindings.driver.cuGLGetDevices + +VDPAU Interoperability +---------------------- + +MANBRIEF VDPAU interoperability functions of the low-level CUDA driver API (CURRENT_FILE) ENDMANBRIEF + + + +This section describes the VDPAU interoperability functions of the low-level CUDA driver application programming interface. + +.. autofunction:: cuda.bindings.driver.cuVDPAUGetDevice +.. autofunction:: cuda.bindings.driver.cuVDPAUCtxCreate +.. autofunction:: cuda.bindings.driver.cuGraphicsVDPAURegisterVideoSurface +.. autofunction:: cuda.bindings.driver.cuGraphicsVDPAURegisterOutputSurface diff --git a/cuda_bindings/docs/source/module/nvfatbin.rst b/cuda_bindings/docs/source/module/nvfatbin.rst new file mode 100644 index 00000000000..1455cf6ba50 --- /dev/null +++ b/cuda_bindings/docs/source/module/nvfatbin.rst @@ -0,0 +1,89 @@ +.. SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +.. default-role:: cpp:any + +nvfatbin +======== + +Note +---- + +The nvfatbin bindings are not supported on nvFatbin installations <12.4. Ensure the installed CUDA toolkit's nvFatbin version is >=12.4. + +The Tile IR API (:func:`cuda.bindings.nvfatbin.add_tile_ir`) is only available in CUDA 13.1+. + +Functions +--------- + +NvFatbin defines the following functions for creating and populating fatbinaries. + +.. autofunction:: cuda.bindings.nvfatbin.create +.. autofunction:: cuda.bindings.nvfatbin.destroy +.. autofunction:: cuda.bindings.nvfatbin.add_ptx +.. autofunction:: cuda.bindings.nvfatbin.add_cubin +.. autofunction:: cuda.bindings.nvfatbin.add_ltoir +.. autofunction:: cuda.bindings.nvfatbin.add_reloc +.. autofunction:: cuda.bindings.nvfatbin.add_tile_ir +.. autofunction:: cuda.bindings.nvfatbin.size +.. autofunction:: cuda.bindings.nvfatbin.get +.. autofunction:: cuda.bindings.nvfatbin.get_error_string +.. autofunction:: cuda.bindings.nvfatbin.version + +Types +--------- +.. autoclass:: cuda.bindings.nvfatbin.Result + + .. autoattribute:: cuda.bindings.nvfatbin.Result.SUCCESS + + + .. autoattribute:: cuda.bindings.nvfatbin.Result.ERROR_INTERNAL + + + .. autoattribute:: cuda.bindings.nvfatbin.Result.ERROR_ELF_ARCH_MISMATCH + + + .. autoattribute:: cuda.bindings.nvfatbin.Result.ERROR_ELF_SIZE_MISMATCH + + + .. autoattribute:: cuda.bindings.nvfatbin.Result.ERROR_MISSING_PTX_VERSION + + + .. autoattribute:: cuda.bindings.nvfatbin.Result.ERROR_NULL_POINTER + + + .. autoattribute:: cuda.bindings.nvfatbin.Result.ERROR_COMPRESSION_FAILED + + + .. autoattribute:: cuda.bindings.nvfatbin.Result.ERROR_COMPRESSED_SIZE_EXCEEDED + + + .. autoattribute:: cuda.bindings.nvfatbin.Result.ERROR_UNRECOGNIZED_OPTION + + + .. autoattribute:: cuda.bindings.nvfatbin.Result.ERROR_INVALID_ARCH + + + .. autoattribute:: cuda.bindings.nvfatbin.Result.ERROR_INVALID_NVVM + + + .. autoattribute:: cuda.bindings.nvfatbin.Result.ERROR_EMPTY_INPUT + + + .. autoattribute:: cuda.bindings.nvfatbin.Result.ERROR_MISSING_PTX_ARCH + + + .. autoattribute:: cuda.bindings.nvfatbin.Result.ERROR_PTX_ARCH_MISMATCH + + + .. autoattribute:: cuda.bindings.nvfatbin.Result.ERROR_MISSING_FATBIN + + + .. autoattribute:: cuda.bindings.nvfatbin.Result.ERROR_INVALID_INDEX + + + .. autoattribute:: cuda.bindings.nvfatbin.Result.ERROR_IDENTIFIER_REUSE + + + .. autoattribute:: cuda.bindings.nvfatbin.Result.ERROR_INTERNAL_PTX_OPTION + diff --git a/cuda_bindings/docs/source/module/nvjitlink.rst b/cuda_bindings/docs/source/module/nvjitlink.rst new file mode 100644 index 00000000000..ba1700a8aab --- /dev/null +++ b/cuda_bindings/docs/source/module/nvjitlink.rst @@ -0,0 +1,123 @@ +.. SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +.. default-role:: cpp:any + +nvjitlink +========= + +Note +---- + +The nvjitlink bindings are not supported on nvJitLink installations <12.3. Ensure the installed CUDA toolkit's nvJitLink version is >=12.3. + +Functions +--------- + +NvJitLink defines the following functions for linking code objects and querying the info and error logs. + +.. autofunction:: cuda.bindings.nvjitlink.create +.. autofunction:: cuda.bindings.nvjitlink.destroy +.. autofunction:: cuda.bindings.nvjitlink.add_data +.. autofunction:: cuda.bindings.nvjitlink.add_file +.. autofunction:: cuda.bindings.nvjitlink.complete +.. autofunction:: cuda.bindings.nvjitlink.get_linked_cubin_size +.. autofunction:: cuda.bindings.nvjitlink.get_linked_cubin +.. autofunction:: cuda.bindings.nvjitlink.get_linked_ptx_size +.. autofunction:: cuda.bindings.nvjitlink.get_linked_ptx +.. autofunction:: cuda.bindings.nvjitlink.get_linked_ltoir_size +.. autofunction:: cuda.bindings.nvjitlink.get_linked_ltoir +.. autofunction:: cuda.bindings.nvjitlink.get_error_log_size +.. autofunction:: cuda.bindings.nvjitlink.get_error_log +.. autofunction:: cuda.bindings.nvjitlink.get_info_log_size +.. autofunction:: cuda.bindings.nvjitlink.get_info_log +.. autofunction:: cuda.bindings.nvjitlink.version + +Types +--------- +.. autoclass:: cuda.bindings.nvjitlink.Result + + .. autoattribute:: cuda.bindings.nvjitlink.Result.SUCCESS + + + .. autoattribute:: cuda.bindings.nvjitlink.Result.ERROR_UNRECOGNIZED_OPTION + + + .. autoattribute:: cuda.bindings.nvjitlink.Result.ERROR_MISSING_ARCH + + + .. autoattribute:: cuda.bindings.nvjitlink.Result.ERROR_INVALID_INPUT + + + .. autoattribute:: cuda.bindings.nvjitlink.Result.ERROR_PTX_COMPILE + + + .. autoattribute:: cuda.bindings.nvjitlink.Result.ERROR_NVVM_COMPILE + + + .. autoattribute:: cuda.bindings.nvjitlink.Result.ERROR_INTERNAL + + + .. autoattribute:: cuda.bindings.nvjitlink.Result.ERROR_THREADPOOL + + + .. autoattribute:: cuda.bindings.nvjitlink.Result.ERROR_UNRECOGNIZED_INPUT + + + .. autoattribute:: cuda.bindings.nvjitlink.Result.ERROR_FINALIZE + + + .. autoattribute:: cuda.bindings.nvjitlink.Result.ERROR_NULL_INPUT + + + .. autoattribute:: cuda.bindings.nvjitlink.Result.ERROR_INCOMPATIBLE_OPTIONS + + + .. autoattribute:: cuda.bindings.nvjitlink.Result.ERROR_INCORRECT_INPUT_TYPE + + + .. autoattribute:: cuda.bindings.nvjitlink.Result.ERROR_ARCH_MISMATCH + + + .. autoattribute:: cuda.bindings.nvjitlink.Result.ERROR_OUTDATED_LIBRARY + + + .. autoattribute:: cuda.bindings.nvjitlink.Result.ERROR_MISSING_FATBIN + + + .. autoattribute:: cuda.bindings.nvjitlink.Result.ERROR_UNRECOGNIZED_ARCH + + + .. autoattribute:: cuda.bindings.nvjitlink.Result.ERROR_UNSUPPORTED_ARCH + + + .. autoattribute:: cuda.bindings.nvjitlink.Result.ERROR_LTO_NOT_ENABLED + + +.. autoclass:: cuda.bindings.nvjitlink.InputType + + .. autoattribute:: cuda.bindings.nvjitlink.InputType.NONE + + + .. autoattribute:: cuda.bindings.nvjitlink.InputType.CUBIN + + + .. autoattribute:: cuda.bindings.nvjitlink.InputType.PTX + + + .. autoattribute:: cuda.bindings.nvjitlink.InputType.LTOIR + + + .. autoattribute:: cuda.bindings.nvjitlink.InputType.FATBIN + + + .. autoattribute:: cuda.bindings.nvjitlink.InputType.OBJECT + + + .. autoattribute:: cuda.bindings.nvjitlink.InputType.LIBRARY + + + .. autoattribute:: cuda.bindings.nvjitlink.InputType.INDEX + + + .. autoattribute:: cuda.bindings.nvjitlink.InputType.ANY diff --git a/cuda_bindings/docs/source/module/nvml.rst b/cuda_bindings/docs/source/module/nvml.rst new file mode 100644 index 00000000000..c5d47ad1670 --- /dev/null +++ b/cuda_bindings/docs/source/module/nvml.rst @@ -0,0 +1,627 @@ +.. SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +.. default-role:: cpp:any +.. module:: cuda.bindings.nvml + +nvml +==== + +The ``cuda.bindings.nvml`` Python module wraps the +`NVIDIA Management Library (NVML) APIs `_. + +Functions +--------- + +.. autosummary:: + :toctree: generated/ + + compute_instance_destroy + compute_instance_get_info_v2 + device_clear_accounting_pids + device_clear_cpu_affinity + device_clear_ecc_error_counts + device_clear_field_values + device_create_gpu_instance + device_create_gpu_instance_with_placement + device_discover_gpus + device_get_accounting_buffer_size + device_get_accounting_mode + device_get_accounting_pids + device_get_accounting_stats + device_get_active_vgpus + device_get_adaptive_clock_info_status + device_get_addressing_mode + device_get_api_restriction + device_get_architecture + device_get_attributes_v2 + device_get_auto_boosted_clocks_enabled + device_get_bar1_memory_info + device_get_board_id + device_get_board_part_number + device_get_brand + device_get_bridge_chip_info + device_get_bus_type + device_get_c2c_mode_info_v + device_get_capabilities + device_get_clk_mon_status + device_get_clock + device_get_clock_info + device_get_clock_offsets + device_get_compute_instance_id + device_get_compute_mode + device_get_compute_running_processes_v3 + device_get_conf_compute_gpu_attestation_report + device_get_conf_compute_gpu_certificate + device_get_conf_compute_mem_size_info + device_get_conf_compute_protected_memory_usage + device_get_cooler_info + device_get_count_v2 + device_get_cpu_affinity + device_get_cpu_affinity_within_scope + device_get_creatable_vgpus + device_get_cuda_compute_capability + device_get_curr_pcie_link_generation + device_get_curr_pcie_link_width + device_get_current_clock_freqs + device_get_current_clocks_event_reasons + device_get_decoder_utilization + device_get_default_ecc_mode + device_get_device_handle_from_mig_device_handle + device_get_display_active + device_get_display_mode + device_get_dram_encryption_mode + device_get_driver_model_v2 + device_get_dynamic_pstates_info + device_get_ecc_mode + device_get_encoder_capacity + device_get_encoder_sessions + device_get_encoder_stats + device_get_encoder_utilization + device_get_enforced_power_limit + device_get_fan_control_policy_v2 + device_get_fan_speed + device_get_fan_speed_rpm + device_get_fan_speed_v2 + device_get_fbc_sessions + device_get_fbc_stats + device_get_field_values + device_get_gpc_clk_min_max_vf_offset + device_get_gpc_clk_vf_offset + device_get_gpu_fabric_info_v + device_get_gpu_instance_by_id + device_get_gpu_instance_id + device_get_gpu_instance_possible_placements_v2 + device_get_gpu_instance_profile_info_by_id_v + device_get_gpu_instance_profile_info_v + device_get_gpu_instance_remaining_capacity + device_get_gpu_instances + device_get_gpu_max_pcie_link_generation + device_get_gpu_operation_mode + device_get_grid_licensable_features_v4 + device_get_gsp_firmware_mode + device_get_gsp_firmware_version + device_get_handle_by_index_v2 + device_get_handle_by_pci_bus_id_v2 + device_get_handle_by_serial + device_get_handle_by_uuid + device_get_handle_by_uuidv + device_get_host_vgpu_mode + device_get_hostname_v1 + device_get_index + device_get_inforom_configuration_checksum + device_get_inforom_image_version + device_get_inforom_version + device_get_irq_num + device_get_jpg_utilization + device_get_last_bbx_flush_time + device_get_margin_temperature + device_get_max_clock_info + device_get_max_customer_boost_clock + device_get_max_mig_device_count + device_get_max_pcie_link_generation + device_get_max_pcie_link_width + device_get_mem_clk_min_max_vf_offset + device_get_mem_clk_vf_offset + device_get_memory_affinity + device_get_memory_bus_width + device_get_memory_error_counter + device_get_memory_info_v2 + device_get_mig_device_handle_by_index + device_get_mig_mode + device_get_min_max_clock_of_p_state + device_get_min_max_fan_speed + device_get_minor_number + device_get_module_id + device_get_mps_compute_running_processes_v3 + device_get_multi_gpu_board + device_get_name + device_get_num_fans + device_get_num_gpu_cores + device_get_numa_node_id + device_get_nvlink_bw_mode + device_get_nvlink_capability + device_get_nvlink_error_counter + device_get_nvlink_info + device_get_nvlink_remote_device_type + device_get_nvlink_remote_pci_info_v2 + device_get_nvlink_state + device_get_nvlink_supported_bw_modes + device_get_nvlink_version + device_get_ofa_utilization + device_get_p2p_status + device_get_pci_info_ext + device_get_pci_info_v3 + device_get_pcie_link_max_speed + device_get_pcie_replay_counter + device_get_pcie_speed + device_get_pcie_throughput + device_get_pdi + device_get_performance_modes + device_get_performance_state + device_get_persistence_mode + device_get_pgpu_metadata_string + device_get_platform_info + device_get_power_management_default_limit + device_get_power_management_limit + device_get_power_management_limit_constraints + device_get_power_mizer_mode_v1 + device_get_power_source + device_get_power_state + device_get_power_usage + device_get_process_utilization + device_get_processes_utilization_info + device_get_remapped_rows + device_get_repair_status + device_get_retired_pages + device_get_retired_pages_pending_status + device_get_retired_pages_v2 + device_get_row_remapper_histogram + device_get_running_process_detail_list + device_get_samples + device_get_serial + device_get_sram_ecc_error_status + device_get_sram_unique_uncorrected_ecc_error_counts + device_get_supported_clocks_event_reasons + device_get_supported_event_types + device_get_supported_graphics_clocks + device_get_supported_memory_clocks + device_get_supported_performance_states + device_get_supported_vgpus + device_get_target_fan_speed + device_get_temperature_threshold + device_get_temperature_v + device_get_thermal_settings + device_get_topology_common_ancestor + device_get_topology_nearest_gpus + device_get_total_ecc_errors + device_get_total_energy_consumption + device_get_unrepairable_memory_flag_v1 + device_get_utilization_rates + device_get_uuid + device_get_vbios_version + device_get_vgpu_capabilities + device_get_vgpu_heterogeneous_mode + device_get_vgpu_instances_utilization_info + device_get_vgpu_metadata + device_get_vgpu_process_utilization + device_get_vgpu_processes_utilization_info + device_get_vgpu_scheduler_capabilities + device_get_vgpu_scheduler_log + device_get_vgpu_scheduler_state + device_get_vgpu_type_creatable_placements + device_get_vgpu_type_supported_placements + device_get_vgpu_utilization + device_get_virtualization_mode + device_is_mig_device_handle + device_modify_drain_state + device_on_same_board + device_power_smoothing_activate_preset_profile + device_power_smoothing_set_state + device_power_smoothing_update_preset_profile_param + device_query_drain_state + device_read_prm_counters_v1 + device_read_write_prm_v1 + device_register_events + device_remove_gpu_v2 + device_reset_gpu_locked_clocks + device_reset_memory_locked_clocks + device_reset_nvlink_error_counters + device_set_accounting_mode + device_set_api_restriction + device_set_auto_boosted_clocks_enabled + device_set_clock_offsets + device_set_compute_mode + device_set_conf_compute_unprotected_mem_size + device_set_cpu_affinity + device_set_default_auto_boosted_clocks_enabled + device_set_default_fan_speed_v2 + device_set_dram_encryption_mode + device_set_driver_model + device_set_ecc_mode + device_set_fan_control_policy + device_set_fan_speed_v2 + device_set_gpu_locked_clocks + device_set_gpu_operation_mode + device_set_hostname_v1 + device_set_memory_locked_clocks + device_set_mig_mode + device_set_nvlink_bw_mode + device_set_nvlink_device_low_power_threshold + device_set_persistence_mode + device_set_power_management_limit_v2 + device_set_power_mizer_mode_v1 + device_set_rusd_settings_v1 + device_set_temperature_threshold + device_set_vgpu_capabilities + device_set_vgpu_heterogeneous_mode + device_set_vgpu_scheduler_state + device_set_virtualization_mode + device_validate_inforom + error_string + event_set_create + event_set_free + event_set_wait_v2 + get_excluded_device_count + get_excluded_device_info_by_index + get_vgpu_compatibility + get_vgpu_driver_capabilities + get_vgpu_version + gpu_instance_create_compute_instance + gpu_instance_create_compute_instance_with_placement + gpu_instance_destroy + gpu_instance_get_active_vgpus + gpu_instance_get_compute_instance_by_id + gpu_instance_get_compute_instance_possible_placements + gpu_instance_get_compute_instance_profile_info_v + gpu_instance_get_compute_instance_remaining_capacity + gpu_instance_get_compute_instances + gpu_instance_get_creatable_vgpus + gpu_instance_get_info + gpu_instance_get_vgpu_heterogeneous_mode + gpu_instance_get_vgpu_scheduler_log + gpu_instance_get_vgpu_scheduler_state + gpu_instance_get_vgpu_type_creatable_placements + gpu_instance_set_vgpu_heterogeneous_mode + gpu_instance_set_vgpu_scheduler_state + init_v2 + init_with_flags + set_vgpu_version + shutdown + system_event_set_create + system_event_set_free + system_event_set_wait + system_get_conf_compute_capabilities + system_get_conf_compute_gpus_ready_state + system_get_conf_compute_key_rotation_threshold_info + system_get_conf_compute_settings + system_get_conf_compute_state + system_get_cuda_driver_version + system_get_cuda_driver_version_v2 + system_get_driver_branch + system_get_driver_version + system_get_hic_version + system_get_nvlink_bw_mode + system_get_nvml_version + system_get_process_name + system_get_topology_gpu_set + system_register_events + system_set_conf_compute_gpus_ready_state + system_set_conf_compute_key_rotation_threshold_info + system_set_nvlink_bw_mode + unit_get_count + unit_get_devices + unit_get_fan_speed_info + unit_get_handle_by_index + unit_get_led_state + unit_get_psu_info + unit_get_temperature + unit_get_unit_info + unit_set_led_state + vgpu_instance_clear_accounting_pids + vgpu_instance_get_accounting_mode + vgpu_instance_get_accounting_pids + vgpu_instance_get_accounting_stats + vgpu_instance_get_ecc_mode + vgpu_instance_get_encoder_capacity + vgpu_instance_get_encoder_sessions + vgpu_instance_get_encoder_stats + vgpu_instance_get_fb_usage + vgpu_instance_get_fbc_sessions + vgpu_instance_get_fbc_stats + vgpu_instance_get_frame_rate_limit + vgpu_instance_get_gpu_instance_id + vgpu_instance_get_gpu_pci_id + vgpu_instance_get_license_info_v2 + vgpu_instance_get_license_status + vgpu_instance_get_mdev_uuid + vgpu_instance_get_metadata + vgpu_instance_get_placement_id + vgpu_instance_get_runtime_state_size + vgpu_instance_get_type + vgpu_instance_get_uuid + vgpu_instance_get_vm_driver_version + vgpu_instance_get_vm_id + vgpu_instance_set_encoder_capacity + vgpu_type_get_bar1_info + vgpu_type_get_capabilities + vgpu_type_get_class + vgpu_type_get_device_id + vgpu_type_get_fb_reservation + vgpu_type_get_frame_rate_limit + vgpu_type_get_framebuffer_size + vgpu_type_get_gpu_instance_profile_id + vgpu_type_get_gsp_heap_size + vgpu_type_get_license + vgpu_type_get_max_instances + vgpu_type_get_max_instances_per_gpu_instance + vgpu_type_get_max_instances_per_vm + vgpu_type_get_name + vgpu_type_get_num_display_heads + vgpu_type_get_resolution + +Enums +----- + +.. autosummary:: + :toctree: generated/ + + AdaptiveClockingInfoStatus + AffinityScope + BrandType + BridgeChipType + BusType + C2CPowerState + CCAcceptingClientRequests + CCSystemCpuCaps + CCSystemDevtoolsMode + CCSystemEnvironment + CCSystemFeature + CCSystemGpus + CCSystemMultiGpu + ClockId + ClockLimitId + ClocksEventReasons + ClockType + ComputeInstanceEngineProfile + ComputeInstanceProfile + ComputeInstanceProfileCaps + ComputeMode + CoolerControl + CoolerTarget + DetachGpuState + DeviceAddressingModeType + DeviceArch + DeviceGpuRecoveryAction + DeviceMig + DeviceVgpuCapability + DriverModel + EccCounterType + EnableState + EncoderQuery + EncoderType + EventType + FanControlPolicy + FanState + FBCSessionType + FieldId + GpmMetricId + GpuFabricHealthMaskAccessTimeout + GpuFabricHealthMaskDegradedBw + GpuFabricHealthMaskIncorrectConfiguration + GpuFabricHealthMaskRouteRecovery + GpuFabricHealthMaskRouteUnhealthy + GpuFabricHealthSummary + GpuFabricState + GpuInstanceProfile + GpuInstanceProfileCaps + GpuOperationMode + GpuP2PCapsIndex + GpuP2PStatus + GpuTopologyLevel + GpuUtilizationDomainId + GpuVirtualizationMode + GridLicenseExpiryEnum + GridLicenseFeatureCode + GridLicenseState + HostVgpuMode + InforomObject + InitFlag + IntNvLinkDeviceType + LedColor + MemoryErrorType + MemoryLocation + NvFBCSessionFlag + NvLinkCapability + NvLinkErrorCounter + NvlinkFirmwareUcodeType + NvlinkLowPowerThreshold + NvlinkLowPowerThresholdUnit + NvlinkPowerState + NvlinkState + NvLinkUtilizationCountPktTypes + NvLinkUtilizationCountUnits + NvlinkVersion + PageRetirementCause + PcieAtomicsCap + PcieLinkMaxSpeed + PcieLinkState + PcieUtilCounter + PerfPolicyType + PowerMizerMode + PowerProfileOperation + PowerProfileType + PowerScope + PowerSmoothingProfileParam + PowerSource + PRMCounterId + Pstates + RestrictedAPI + Return + RUSD + SamplingType + SystemEventType + TemperatureSensors + TemperatureThresholds + ThermalController + ThermalTarget + UUIDType + ValueType + VgpuCapability + VgpuDriverCapability + VgpuGuestInfoState + VgpuPgpu + VgpuPgpuCompatibilityLimitCode + VgpuPgpuVirtualizationCapMigration + VgpuSchedulerArr + VgpuSchedulerEngineType + VgpuSchedulerPolicy + VgpuVirtualizationCapMigration + VgpuVmCompatibility + VgpuVmIdType + +Types +----- + +.. autosummary:: + :toctree: generated/ + + AccountingStats + ActiveVgpuInstanceInfo_v1 + BAR1Memory + BridgeChipHierarchy + BridgeChipInfo + C2cModeInfo_v1 + ClkMonFaultInfo + ClkMonStatus + ClockOffset_v1 + ComputeInstanceInfo + ComputeInstancePlacement + ComputeInstanceProfileInfo_v2 + ComputeInstanceProfileInfo_v3 + ConfComputeGpuAttestationReport + ConfComputeGpuCertificate + ConfComputeMemSizeInfo + ConfComputeSystemCaps + ConfComputeSystemState + CoolerInfo_v1 + DeviceAddressingMode_v1 + DeviceAttributes + DevicePowerMizerModes_v1 + EccSramErrorStatus_v1 + EccSramUniqueUncorrectedErrorCounts_v1 + EccSramUniqueUncorrectedErrorEntry_v1 + EncoderSessionInfo + EventData + ExcludedDeviceInfo + FBCSessionInfo + FBCStats + FieldValue + GpuDynamicPstatesInfo + GpuFabricInfo_v2 + GpuFabricInfo_v3 + GpuInstanceInfo + GpuInstancePlacement + GpuInstanceProfileInfo_v3 + GpuThermalSettings + GridLicensableFeature + GridLicensableFeatures + GridLicenseExpiry + HwbcEntry + LedState + Memory + Memory_v2 + NvlinkFirmwareInfo + NvlinkFirmwareVersion + NvlinkGetBwMode_v1 + NvLinkInfo_v1 + NvLinkInfo_v2 + NvlinkSetBwMode_v1 + NvlinkSupportedBwModes_v1 + PciInfo + PciInfoExt_v1 + PlatformInfo_v1 + PlatformInfo_v2 + PRMCounter_v1 + PRMCounterInput_v1 + PRMCounterValue_v1 + ProcessDetail_v1 + ProcessDetailList_v1 + ProcessesUtilizationInfo_v1 + ProcessInfo + ProcessUtilizationInfo_v1 + ProcessUtilizationSample + PSUInfo + RepairStatus_v1 + RowRemapperHistogramValues + Sample + SystemConfComputeSettings_v1 + SystemEventData_v1 + UnitFanInfo + UnitFanSpeeds + UnitInfo + Utilization + Value + VgpuCreatablePlacementInfo_v1 + VgpuInstancesUtilizationInfo_v1 + VgpuInstanceUtilizationInfo_v1 + VgpuInstanceUtilizationSample + VgpuLicenseExpiry + VgpuLicenseInfo + VgpuMetadata + VgpuPgpuCompatibility + VgpuPgpuMetadata + VgpuPlacementList_v2 + VgpuProcessesUtilizationInfo_v1 + VgpuProcessUtilizationInfo_v1 + VgpuSchedulerCapabilities + VgpuSchedulerGetState + VgpuSchedulerLog + VgpuSchedulerLogEntry + VgpuSchedulerLogInfo_v1 + VgpuSchedulerParams + VgpuSchedulerSetParams + VgpuSchedulerState_v1 + VgpuSchedulerStateInfo_v1 + VgpuTypeBar1Info_v1 + VgpuTypeIdInfo_v1 + VgpuVersion + +Exceptions +---------- + +.. autosummary:: + :toctree: generated/ + + NvmlError + UninitializedError + InvalidArgumentError + NotSupportedError + NoPermissionError + AlreadyInitializedError + NotFoundError + InsufficientSizeError + InsufficientPowerError + DriverNotLoadedError + TimeoutError + IrqIssueError + LibraryNotFoundError + FunctionNotFoundError + CorruptedInforomError + GpuIsLostError + ResetRequiredError + OperatingSystemError + LibRmVersionMismatchError + InUseError + MemoryError + NoDataError + VgpuEccNotSupportedError + InsufficientResourcesError + FreqNotSupportedError + ArgumentVersionMismatchError + DeprecatedError + NotReadyError + GpuNotFoundError + InvalidStateError + ResetTypeNotSupportedError + UnknownError diff --git a/cuda_bindings/docs/source/module/nvrtc.rst b/cuda_bindings/docs/source/module/nvrtc.rst new file mode 100644 index 00000000000..c879f49dc88 --- /dev/null +++ b/cuda_bindings/docs/source/module/nvrtc.rst @@ -0,0 +1,904 @@ +.. SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +.. CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=9f44170e12fd85fa04fcd599a18d0b6474ec7920be8f28a5c097000eb3ccb0e0 +----- +nvrtc +----- + +Error Handling +-------------- + +NVRTC defines the following enumeration type and function for API call error handling. + +.. autoclass:: cuda.bindings.nvrtc.nvrtcResult + + .. autoattribute:: cuda.bindings.nvrtc.nvrtcResult.NVRTC_SUCCESS + + + .. autoattribute:: cuda.bindings.nvrtc.nvrtcResult.NVRTC_ERROR_OUT_OF_MEMORY + + + .. autoattribute:: cuda.bindings.nvrtc.nvrtcResult.NVRTC_ERROR_PROGRAM_CREATION_FAILURE + + + .. autoattribute:: cuda.bindings.nvrtc.nvrtcResult.NVRTC_ERROR_INVALID_INPUT + + + .. autoattribute:: cuda.bindings.nvrtc.nvrtcResult.NVRTC_ERROR_INVALID_PROGRAM + + + .. autoattribute:: cuda.bindings.nvrtc.nvrtcResult.NVRTC_ERROR_INVALID_OPTION + + + .. autoattribute:: cuda.bindings.nvrtc.nvrtcResult.NVRTC_ERROR_COMPILATION + + + .. autoattribute:: cuda.bindings.nvrtc.nvrtcResult.NVRTC_ERROR_BUILTIN_OPERATION_FAILURE + + + .. autoattribute:: cuda.bindings.nvrtc.nvrtcResult.NVRTC_ERROR_NO_NAME_EXPRESSIONS_AFTER_COMPILATION + + + .. autoattribute:: cuda.bindings.nvrtc.nvrtcResult.NVRTC_ERROR_NO_LOWERED_NAMES_BEFORE_COMPILATION + + + .. autoattribute:: cuda.bindings.nvrtc.nvrtcResult.NVRTC_ERROR_NAME_EXPRESSION_NOT_VALID + + + .. autoattribute:: cuda.bindings.nvrtc.nvrtcResult.NVRTC_ERROR_INTERNAL_ERROR + + + .. autoattribute:: cuda.bindings.nvrtc.nvrtcResult.NVRTC_ERROR_TIME_FILE_WRITE_FAILED + + + .. autoattribute:: cuda.bindings.nvrtc.nvrtcResult.NVRTC_ERROR_NO_PCH_CREATE_ATTEMPTED + + + .. autoattribute:: cuda.bindings.nvrtc.nvrtcResult.NVRTC_ERROR_PCH_CREATE_HEAP_EXHAUSTED + + + .. autoattribute:: cuda.bindings.nvrtc.nvrtcResult.NVRTC_ERROR_PCH_CREATE + + + .. autoattribute:: cuda.bindings.nvrtc.nvrtcResult.NVRTC_ERROR_CANCELLED + + + .. autoattribute:: cuda.bindings.nvrtc.nvrtcResult.NVRTC_ERROR_TIME_TRACE_FILE_WRITE_FAILED + + + .. autoattribute:: cuda.bindings.nvrtc.nvrtcResult.NVRTC_ERROR_BUSY + +.. autofunction:: cuda.bindings.nvrtc.nvrtcGetErrorString + +General Information Query +------------------------- + +NVRTC defines the following function for general information query. + +.. autofunction:: cuda.bindings.nvrtc.nvrtcVersion +.. autofunction:: cuda.bindings.nvrtc.nvrtcGetNumSupportedArchs +.. autofunction:: cuda.bindings.nvrtc.nvrtcGetSupportedArchs + +Compilation +----------- + +NVRTC defines the following type and functions for actual compilation. + +.. autoclass:: cuda.bindings.nvrtc.nvrtcProgram +.. autofunction:: cuda.bindings.nvrtc.nvrtcCreateProgram +.. autofunction:: cuda.bindings.nvrtc.nvrtcDestroyProgram +.. autofunction:: cuda.bindings.nvrtc.nvrtcCompileProgram +.. autofunction:: cuda.bindings.nvrtc.nvrtcGetPTXSize +.. autofunction:: cuda.bindings.nvrtc.nvrtcGetPTX +.. autofunction:: cuda.bindings.nvrtc.nvrtcGetCUBINSize +.. autofunction:: cuda.bindings.nvrtc.nvrtcGetCUBIN +.. autofunction:: cuda.bindings.nvrtc.nvrtcGetLTOIRSize +.. autofunction:: cuda.bindings.nvrtc.nvrtcGetLTOIR +.. autofunction:: cuda.bindings.nvrtc.nvrtcGetOptiXIRSize +.. autofunction:: cuda.bindings.nvrtc.nvrtcGetOptiXIR +.. autofunction:: cuda.bindings.nvrtc.nvrtcGetProgramLogSize +.. autofunction:: cuda.bindings.nvrtc.nvrtcGetProgramLog +.. autofunction:: cuda.bindings.nvrtc.nvrtcAddNameExpression +.. autofunction:: cuda.bindings.nvrtc.nvrtcGetLoweredName +.. autofunction:: cuda.bindings.nvrtc.nvrtcSetFlowCallback +.. autofunction:: cuda.bindings.nvrtc.nvrtcGetTileIRSize +.. autofunction:: cuda.bindings.nvrtc.nvrtcGetTileIR + +Precompiled header (PCH) (CUDA 12.8+) +------------------------------------- + +NVRTC defines the following function related to PCH. Also see PCH related flags passed to nvrtcCompileProgram. + +.. autofunction:: cuda.bindings.nvrtc.nvrtcGetPCHHeapSize +.. autofunction:: cuda.bindings.nvrtc.nvrtcSetPCHHeapSize +.. autofunction:: cuda.bindings.nvrtc.nvrtcGetPCHCreateStatus +.. autofunction:: cuda.bindings.nvrtc.nvrtcGetPCHHeapSizeRequired + +Bundled Headers Installation +---------------------------- + +NVRTC defines the following types and functions for bundled headers installation and management. + +.. autoclass:: cuda.bindings.nvrtc.nvrtcBundledHeadersInfo +.. autofunction:: cuda.bindings.nvrtc.nvrtcInstallBundledHeaders +.. autofunction:: cuda.bindings.nvrtc.nvrtcGetBundledHeadersInfo +.. autofunction:: cuda.bindings.nvrtc.nvrtcRemoveBundledHeaders +.. autoattribute:: cuda.bindings.nvrtc.NVRTC_INSTALL_HEADERS_SKIP_IF_EXISTS + + Flags for nvrtcInstallBundledHeaders.Skip installation if version marker exists and version matches. This is the default behavior when flags=0. + +.. autoattribute:: cuda.bindings.nvrtc.NVRTC_INSTALL_HEADERS_FORCE_OVERWRITE + + Clear existing directory contents before installation. Guarantees consistency by removing any existing files first. + +.. autoattribute:: cuda.bindings.nvrtc.NVRTC_INSTALL_HEADERS_NO_WAIT + + Return NVRTC_ERROR_BUSY immediately if installation is in progress by another process, instead of waiting for the lock. Can be combined with FORCE_OVERWRITE using bitwise OR. + + +Supported Compile Options +------------------------- + +NVRTC supports the compile options below. Option names with two preceding dashs (``--``) are long option names and option names with one preceding dash (``-``) are short option names. Short option names can be used instead of long option names. When a compile option takes an argument, an assignment operator (``=``) is used to separate the compile option argument from the compile option name, e.g., ``"--gpu-architecture=compute_100"``. Alternatively, the compile option name and the argument can be specified in separate strings without an assignment operator, .e.g, ``"--gpu-architecture"`` ``"compute_100"``. Single-character short option names, such as ``-D``, ``-U``, and ``-I``, do not require an assignment operator, and the compile option name and the argument can be present in the same string with or without spaces between them. For instance, ``"-D="``, ``"-D"``, and ``"-D "`` are all supported. + + + +The valid compiler options are: + + + + + +- Compilation targets + + + + + + - ``--gpu-architecture=`` (``-arch``) + +Specify the name of the class of GPU architectures for which the input must be compiled. + + + + + + + + + + + +- Separate compilation / whole-program compilation + + + + + + - ``--device-c`` (``-dc``) + +Generate relocatable code that can be linked with other relocatable device code. It is equivalent to ``--relocatable-device-code=true``. + + + + + + + + - ``--device-w`` (``-dw``) + +Generate non-relocatable code. It is equivalent to ``--relocatable-device-code=false``. + + + + + + + + - ``--relocatable-device-code={true|false}`` (``-rdc``) + +Enable (disable) the generation of relocatable device code. + + + + + + + + - ``--extensible-whole-program`` (``-ewp``) + +Do extensible whole program compilation of device code. + + + + + + + + + +- Tile compilation + + + + + + - ``--enable-tile`` (``-enable-tile``) + +Enable support for Tile constructs (e.g. ``__tile__`` ) and define the macro ``__CUDACC_TILE__`` . + + + + + + + + - ``--tile-only`` (``-tile-only``) + +Enable support for parsing Tile constructs and define the macro ``__CUDACC_TILE__``, but omit code generation for non-Tile code (e.g. ``__global__`` function). + + + + + + + + - ``--simt-only`` (``-simt-only``) + +Enable support for parsing Tile constructs and define the macro ``__CUDACC_TILE__``, but omit code generation for Tile code (e.g. ``__tile_global__`` function). + + + + + + + + - ``--default-tile`` (``--default-tile``) + +Consider an unannotated function or static storage duration variable as having an implicit ``__tile__`` annotation. If the static storage duration variable violates Tile restrictions (e.g. cannot be of pointer type), then the implicit annotation is silently omitted by default; use ``-diagnose-implicit-tile-var`` to enable compiler diagnostics for such cases. + +``-default-tile`` can be used in conjunction with ``-default-device``. If both flags are specified, the unannotated function and/or static storage duration variable will be considered to have both ``__tile__`` and ``__device__`` implict annotations. There will be a separate copy of the function/variable in the generated SIMT and cuda_tile programs, at present. + + + + + + + + - ``--diagnose-implicit-tile-var`` (``-diagnose-implicit-tile-var``) + +When combined with ``-default-tile``, diagnose static storage duration variables that could not be implicitly annotated with the ``__tile__`` memory space specifier (e.g., due to pointer type restrictions). + + + + + + + + + +- Debugging support + + + + + + - ``--device-debug`` (``-G``) + +Generate debug information. If ``--dopt`` is not specified, then turns off all optimizations. + + + + + + + + - ``--generate-line-info`` (``-lineinfo``) + +Generate line-number information. + + + + + + + + + +- Code generation + + + + + + - ``--dopt`` ``on`` (``-dopt``) + + + + + + + + - ``--dopt=on`` + +Enable device code optimization. When specified along with ``-G``, enables limited debug information generation for optimized device code (currently, only line number information). When ``-G`` is not specified, ``-dopt=on`` is implicit. + + + + + + + + - ``--Ofast-compile={0|min|mid|max}`` (``-Ofc``) + +Specify the fast-compile level for device code, which controls the tradeoff between compilation speed and runtime performance by disabling certain optimizations at varying levels. + + + + + + + + - ``--ptxas-options`` (``-Xptxas``) + + + + + + + + - ``--ptxas-options=`` + +Specify options directly to ptxas, the PTX optimizing assembler. + + + + + + + + - ``--maxrregcount=`` (``-maxrregcount``) + +Specify the maximum amount of registers that GPU functions can use. Until a function-specific limit, a higher value will generally increase the performance of individual GPU threads that execute this function. However, because thread registers are allocated from a global register pool on each GPU, a higher value of this option will also reduce the maximum thread block size, thereby reducing the amount of thread parallelism. Hence, a good maxrregcount value is the result of a trade-off. If this option is not specified, then no maximum is assumed. Value less than the minimum registers required by ABI will be bumped up by the compiler to ABI minimum limit. + + + + + + + + - ``--ftz={true|false}`` (``-ftz``) + +When performing single-precision floating-point operations, flush denormal values to zero or preserve denormal values. + +``--use_fast_math`` implies ``--ftz=true``. + + + + + + + + - ``--prec-sqrt={true|false}`` (``-prec-sqrt``) + +For single-precision floating-point square root, use IEEE round-to-nearest mode or use a faster approximation. ``--use_fast_math`` implies ``--prec-sqrt=false``. + + + + + + + + - ``--prec-div={true|false}`` (``-prec-div``) For single-precision floating-point division and reciprocals, use IEEE round-to-nearest mode or use a faster approximation. ``--use_fast_math`` implies ``--prec-div=false``. + + + + + + - Default: ``true`` + + + + + + + + + + - ``--fmad={true|false}`` (``-fmad``) + +Enables (disables) the contraction of floating-point multiplies and adds/subtracts into floating-point multiply-add operations (FMAD, FFMA, or DFMA). ``--use_fast_math`` implies ``--fmad=true``. + + + + + + + + - ``--use_fast_math`` (``-use_fast_math``) + +Make use of fast math operations. ``--use_fast_math`` implies ``--ftz=true`` ``--prec-div=false`` ``--prec-sqrt=false`` ``--fmad=true``. + + + + + + + + - ``--extra-device-vectorization`` (``-extra-device-vectorization``) + +Enables more aggressive device code vectorization in the NVVM optimizer. + + + + + + + + - ``--modify-stack-limit={true|false}`` (``-modify-stack-limit``) + +On Linux, during compilation, use ``setrlimit()`` to increase stack size to maximum allowed. The limit is reset to the previous value at the end of compilation. Note: ``setrlimit()`` changes the value for the entire process. + + + + + + + + - ``--dlink-time-opt`` (``-dlto``) + +Generate intermediate code for later link-time optimization. It implies ``-rdc=true``. Note: when this option is used the ``nvrtcGetLTOIR`` API should be used, as PTX or Cubin will not be generated. + + + + + + + + - ``--gen-opt-lto`` (``-gen-opt-lto``) + +Run the optimizer passes before generating the LTO IR. + + + + + + + + - ``--optix-ir`` (``-optix-ir``) + +Generate OptiX IR. The Optix IR is only intended for consumption by OptiX through appropriate APIs. This feature is not supported with link-time-optimization (``-dlto``). + +Note: when this option is used the nvrtcGetOptiX API should be used, as PTX or Cubin will not be generated. + + + + + + + + - ``--jump-table-density=``\[0-101] (``-jtd``) + +Specify the case density percentage in switch statements, and use it as a minimal threshold to determine whether jump table(brx.idx instruction) will be used to implement a switch statement. Default value is 101. The percentage ranges from 0 to 101 inclusively. + + + + + + + + - ``--device-stack-protector={true|false}`` (``-device-stack-protector``) + +Enable (disable) the generation of stack canaries in device code. + + + + + + + + - ``--no-cache`` (``-no-cache``) + +Disable the use of cache for both ptx and cubin code generation. + + + + + + + + - ``--frandom-seed`` (``-frandom-seed``) + +The user specified random seed will be used to replace random numbers used in generating symbol names and variable names. The option can be used to generate deterministically identical ptx and object files. If the input value is a valid number (decimal, octal, or hex), it will be used directly as the random seed. Otherwise, the CRC value of the passed string will be used instead. + + + + + + + + + +- Preprocessing + + + + + + - ``--define-macro=`` (``-D``) + +```` can be either ```` or ````. + + + + + + + + - ``--undefine-macro=`` (``-U``) + +Cancel any previous definition of ````. + + + + + + + + - ``--include-path=`` (``-I``) + +Add the directory ```` to the list of directories to be searched for headers. These paths are searched after the list of headers given to nvrtcCreateProgram. + + + + + + + + - ``--use-bundled-headers=`` + +Install bundled CUDA headers to ```` and add include paths. This is a convenience flag that combines calling nvrtcInstallBundledHeaders and adding ``-I`` and ``-I/cccl`` to the include search path. Headers are installed only if they don't already exist at the specified location. + + + + + + + + - ``--pre-include=
`` (``-include``) + +Preinclude ``
`` during preprocessing. + + + + + + + + - ``--no-source-include`` (``-no-source-include``) + +The preprocessor by default adds the directory of each input sources to the include path. This option disables this feature and only considers the path specified explicitly. + + + + + + + + + +- Language Dialect + + + + + + - ``--std={c++03|c++11|c++14|c++17|c++20}`` (``-std``) + +Set language dialect to C++03, C++11, C++14, C++17 or C++20 + + + + + + + + - ``--builtin-move-forward={true|false}`` (``-builtin-move-forward``) + +Provide builtin definitions of ``std::move`` and ``std::forward``, when C++11 or later language dialect is selected. + + + + + + + + - ``--builtin-initializer-list={true|false}`` (``-builtin-initializer-list``) + +Provide builtin definitions of ``std::initializer_list`` class and member functions when C++11 or later language dialect is selected. + + + + + + + + + +- Precompiled header support (CUDA 12.8+) + + + + + + - ``--pch`` (``-pch``) + +Enable automatic PCH processing. + + + + + + + + - ``--create-pch=`` (``-create-pch``) + +Create a PCH file. + + + + + + + + - ``--use-pch=`` (``-use-pch``) + +Use the specified PCH file. + + + + + + + + - ``--pch-dir=`` (``-pch-dir``) + +When using automatic PCH (``-pch``), look for and create PCH files in the specified directory. When using explicit PCH (``-create-pch`` or ``-use-pch``), the directory name is prefixed before the specified file name, unless the file name is an absolute path name. + + + + + + + + - ``--pch-verbose={true|false}`` (``-pch-verbose``) + +In automatic PCH mode, for each PCH file that could not be used in current compilation, print the reason in the compilation log. + + + + + + + + - ``--pch-messages={true|false}`` (``-pch-messages``) + +Print a message in the compilation log, if a PCH file was created or used in the current compilation. + + + + + + + + - ``--instantiate-templates-in-pch={true|false}`` (``-instantiate-templates-in-pch``) + +Enable or disable instantiatiation of templates before PCH creation. Instantiating templates may increase the size of the PCH file, while reducing the compilation cost when using the PCH file (since some template instantiations can be skipped). + + + + + + + + + +- Misc. + + + + + + - ``--disable-warnings`` (``-w``) + +Inhibit all warning messages. + + + + + + + + - ``--Wreorder`` (``-Wreorder``) + +Generate warnings when member initializers are reordered. + + + + + + + + - ``--warning-as-error=`` ,... (``-Werror``) + +Make warnings of the specified kinds into errors. The following is the list of warning kinds accepted by this option: + + + + + + + + - ``--restrict`` (``-restrict``) + +Programmer assertion that all kernel pointer parameters are restrict pointers. + + + + + + + + - ``--device-as-default-execution-space`` (``-default-device``) + +Treat entities with no execution space annotation as ``__device__`` entities. + + + + + + + + - ``--device-int128`` (``-device-int128``) + +Allow the ``__int128`` type in device code. Also causes the macro ``__CUDACC_RTC_INT128__`` to be defined. + + + + + + + + - ``--device-float128`` (``-device-float128``) + +Allow the ``__float128`` and ``_Float128`` types in device code. Also causes the macro ``D__CUDACC_RTC_FLOAT128__`` to be defined. + + + + + + + + - ``--optimization-info=`` (``-opt-info``) + +Provide optimization reports for the specified kind of optimization. The following kind tags are supported: + + + + + + + + - ``--display-error-number`` (``-err-no``) + +Display diagnostic number for warning messages. (Default) + + + + + + + + - ``--no-display-error-number`` (``-no-err-no``) + +Disables the display of a diagnostic number for warning messages. + + + + + + + + - ``--diag-error=``,... (``-diag-error``) + +Emit error for specified diagnostic message number(s). Message numbers can be separated by comma. + + + + + + + + - ``--diag-suppress=``,... (``-diag-suppress``) + +Suppress specified diagnostic message number(s). Message numbers can be separated by comma. + + + + + + + + - ``--diag-warn=``,... (``-diag-warn``) + +Emit warning for specified diagnostic message number(s). Message numbers can be separated by comma. + + + + + + + + - ``--brief-diagnostics={true|false}`` (``-brief-diag``) + +This option disables or enables showing source line and column info in a diagnostic. The ``--brief-diagnostics=true`` will not show the source line and column info. + + + + + + + + - ``--time=`` (``-time``) + +Generate a comma separated value table with the time taken by each compilation phase, and append it at the end of the file given as the option argument. If the file does not exist, the column headings are generated in the first row of the table. If the file name is '-', the timing data is written to the compilation log. + + + + + + + + - ``--split-compile=`` (``-split-compile=``) + +Perform compiler optimizations in parallel. Split compilation attempts to reduce compile time by enabling the compiler to run certain optimization passes concurrently. This option accepts a numerical value that specifies the maximum number of threads the compiler can use. One can also allow the compiler to use the maximum threads available on the system by setting ``--split-compile=0``. Setting ``--split-compile=1`` will cause this option to be ignored. + + + + + + + + - ``--fdevice-syntax-only`` (``-fdevice-syntax-only``) + +Ends device compilation after front-end syntax checking. This option does not generate valid device code. + + + + + + + + - ``--minimal`` (``-minimal``) + +Omit certain language features to reduce compile time for small programs. In particular, the following are omitted: + + + + + + + + - ``--device-stack-protector`` (``-device-stack-protector``) + +Enable stack canaries in device code. Stack canaries make it more difficult to exploit certain types of memory safety bugs involving stack-local variables. The compiler uses heuristics to assess the risk of such a bug in each function. Only those functions which are deemed high-risk make use of a stack canary. + + + + + + + + - ``--fdevice-time-trace=`` (``-fdevice-time-trace=``) Enables the time profiler, outputting a JSON file based on given . Results can be analyzed on chrome://tracing for a flamegraph visualization. + diff --git a/cuda_bindings/docs/source/module/nvvm.rst b/cuda_bindings/docs/source/module/nvvm.rst new file mode 100644 index 00000000000..9c0f00abdd3 --- /dev/null +++ b/cuda_bindings/docs/source/module/nvvm.rst @@ -0,0 +1,55 @@ +.. SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +.. default-role:: cpp:any + +nvvm +==== + +The ``cuda.bindings.nvvm`` Python module wraps the +`libNVVM C API `_. + +Functions +--------- + +.. autofunction:: cuda.bindings.nvvm.version +.. autofunction:: cuda.bindings.nvvm.ir_version +.. autofunction:: cuda.bindings.nvvm.create_program +.. autofunction:: cuda.bindings.nvvm.add_module_to_program +.. autofunction:: cuda.bindings.nvvm.lazy_add_module_to_program +.. autofunction:: cuda.bindings.nvvm.compile_program +.. autofunction:: cuda.bindings.nvvm.verify_program +.. autofunction:: cuda.bindings.nvvm.get_compiled_result_size +.. autofunction:: cuda.bindings.nvvm.get_compiled_result +.. autofunction:: cuda.bindings.nvvm.get_program_log_size +.. autofunction:: cuda.bindings.nvvm.get_program_log + +Types +----- + +.. + The empty lines below are important! + +.. autoclass:: cuda.bindings.nvvm.Result + + .. autoattribute:: cuda.bindings.nvvm.Result.SUCCESS + + .. autoattribute:: cuda.bindings.nvvm.Result.ERROR_OUT_OF_MEMORY + + .. autoattribute:: cuda.bindings.nvvm.Result.ERROR_PROGRAM_CREATION_FAILURE + + .. autoattribute:: cuda.bindings.nvvm.Result.ERROR_IR_VERSION_MISMATCH + + .. autoattribute:: cuda.bindings.nvvm.Result.ERROR_INVALID_INPUT + + .. autoattribute:: cuda.bindings.nvvm.Result.ERROR_INVALID_PROGRAM + + .. autoattribute:: cuda.bindings.nvvm.Result.ERROR_INVALID_IR + + .. autoattribute:: cuda.bindings.nvvm.Result.ERROR_INVALID_OPTION + + .. autoattribute:: cuda.bindings.nvvm.Result.ERROR_NO_MODULE_IN_PROGRAM + + .. autoattribute:: cuda.bindings.nvvm.Result.ERROR_COMPILATION + + .. autoattribute:: cuda.bindings.nvvm.Result.ERROR_CANCELLED diff --git a/cuda_bindings/docs/source/module/runtime.rst b/cuda_bindings/docs/source/module/runtime.rst new file mode 100644 index 00000000000..80b11f16644 --- /dev/null +++ b/cuda_bindings/docs/source/module/runtime.rst @@ -0,0 +1,6539 @@ +.. SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +.. CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=0eccd5db44f7406acb693f5dd95ad2fa17c787c11659578cf54e116eb0b06e01 +------- +runtime +------- + +Data types used by CUDA Runtime +------------------------------- + + + +.. autoclass:: cuda.bindings.runtime.cudaChannelFormatDesc +.. autoclass:: cuda.bindings.runtime.cudaArraySparseProperties +.. autoclass:: cuda.bindings.runtime.cudaArrayMemoryRequirements +.. autoclass:: cuda.bindings.runtime.cudaPitchedPtr +.. autoclass:: cuda.bindings.runtime.cudaExtent +.. autoclass:: cuda.bindings.runtime.cudaPos +.. autoclass:: cuda.bindings.runtime.cudaMemcpy3DParms +.. autoclass:: cuda.bindings.runtime.cudaMemcpyNodeParams +.. autoclass:: cuda.bindings.runtime.cudaMemcpy3DPeerParms +.. autoclass:: cuda.bindings.runtime.cudaMemsetParams +.. autoclass:: cuda.bindings.runtime.cudaMemsetParamsV2 +.. autoclass:: cuda.bindings.runtime.cudaAccessPolicyWindow +.. autoclass:: cuda.bindings.runtime.cudaHostNodeParams +.. autoclass:: cuda.bindings.runtime.cudaHostNodeParamsV2 +.. autoclass:: cuda.bindings.runtime.cudaResourceDesc +.. autoclass:: cuda.bindings.runtime.cudaResourceViewDesc +.. autoclass:: cuda.bindings.runtime.cudaPointerAttributes +.. autoclass:: cuda.bindings.runtime.cudaFuncAttributes +.. autoclass:: cuda.bindings.runtime.cudaMemLocation +.. autoclass:: cuda.bindings.runtime.cudaMemAccessDesc +.. autoclass:: cuda.bindings.runtime.cudaMemPoolProps +.. autoclass:: cuda.bindings.runtime.cudaMemPoolPtrExportData +.. autoclass:: cuda.bindings.runtime.cudaMemAllocNodeParams +.. autoclass:: cuda.bindings.runtime.cudaMemAllocNodeParamsV2 +.. autoclass:: cuda.bindings.runtime.cudaMemFreeNodeParams +.. autoclass:: cuda.bindings.runtime.cudaMemcpyAttributes +.. autoclass:: cuda.bindings.runtime.cudaOffset3D +.. autoclass:: cuda.bindings.runtime.cudaMemcpy3DOperand +.. autoclass:: cuda.bindings.runtime.cudaMemcpy3DBatchOp +.. autoclass:: cuda.bindings.runtime.CUuuid_st +.. autoclass:: cuda.bindings.runtime.cudaDeviceProp +.. autoclass:: cuda.bindings.runtime.cudaIpcEventHandle_st +.. autoclass:: cuda.bindings.runtime.cudaIpcMemHandle_st +.. autoclass:: cuda.bindings.runtime.cudaMemFabricHandle_st +.. autoclass:: cuda.bindings.runtime.cudaExternalMemoryHandleDesc +.. autoclass:: cuda.bindings.runtime.cudaExternalMemoryBufferDesc +.. autoclass:: cuda.bindings.runtime.cudaExternalMemoryMipmappedArrayDesc +.. autoclass:: cuda.bindings.runtime.cudaExternalSemaphoreHandleDesc +.. autoclass:: cuda.bindings.runtime.cudaExternalSemaphoreSignalParams +.. autoclass:: cuda.bindings.runtime.cudaExternalSemaphoreWaitParams +.. autoclass:: cuda.bindings.runtime.cudaDevSmResource +.. autoclass:: cuda.bindings.runtime.cudaDevWorkqueueConfigResource +.. autoclass:: cuda.bindings.runtime.cudaDevWorkqueueResource +.. autoclass:: cuda.bindings.runtime.cudaDevSmResourceGroupParams_st +.. autoclass:: cuda.bindings.runtime.cudaDevResource_st +.. autoclass:: cuda.bindings.runtime.cudalibraryHostUniversalFunctionAndDataTable +.. autoclass:: cuda.bindings.runtime.cudaKernelNodeParams +.. autoclass:: cuda.bindings.runtime.cudaKernelNodeParamsV2 +.. autoclass:: cuda.bindings.runtime.cudaExternalSemaphoreSignalNodeParams +.. autoclass:: cuda.bindings.runtime.cudaExternalSemaphoreSignalNodeParamsV2 +.. autoclass:: cuda.bindings.runtime.cudaExternalSemaphoreWaitNodeParams +.. autoclass:: cuda.bindings.runtime.cudaExternalSemaphoreWaitNodeParamsV2 +.. autoclass:: cuda.bindings.runtime.cudaConditionalNodeParams +.. autoclass:: cuda.bindings.runtime.cudaChildGraphNodeParams +.. autoclass:: cuda.bindings.runtime.cudaEventRecordNodeParams +.. autoclass:: cuda.bindings.runtime.cudaEventWaitNodeParams +.. autoclass:: cuda.bindings.runtime.cudaGraphNodeParams +.. autoclass:: cuda.bindings.runtime.cudaGraphEdgeData_st +.. autoclass:: cuda.bindings.runtime.cudaGraphInstantiateParams_st +.. autoclass:: cuda.bindings.runtime.cudaGraphExecUpdateResultInfo_st +.. autoclass:: cuda.bindings.runtime.cudaGraphKernelNodeUpdate +.. autoclass:: cuda.bindings.runtime.cudaLaunchMemSyncDomainMap_st +.. autoclass:: cuda.bindings.runtime.cudaLaunchAttributeValue +.. autoclass:: cuda.bindings.runtime.cudaLaunchAttribute_st +.. autoclass:: cuda.bindings.runtime.cudaAsyncNotificationInfo +.. autoclass:: cuda.bindings.runtime.cudaTextureDesc +.. autoclass:: cuda.bindings.runtime.cudaEglPlaneDesc_st +.. autoclass:: cuda.bindings.runtime.cudaEglFrame_st +.. autoclass:: cuda.bindings.runtime.cudaError_t + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaSuccess + + + The API call returned with no errors. In the case of query calls, this also means that the operation being queried is complete (see :py:obj:`~.cudaEventQuery()` and :py:obj:`~.cudaStreamQuery()`). + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorInvalidValue + + + This indicates that one or more of the parameters passed to the API call is not within an acceptable range of values. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorMemoryAllocation + + + The API call failed because it was unable to allocate enough memory or other resources to perform the requested operation. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorInitializationError + + + The API call failed because the CUDA driver and runtime could not be initialized. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorCudartUnloading + + + This indicates that a CUDA Runtime API call cannot be executed because it is being called during process shut down, at a point in time after CUDA driver has been unloaded. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorProfilerDisabled + + + This indicates profiler is not initialized for this run. This can happen when the application is running with external profiling tools like visual profiler. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorProfilerNotInitialized + + + [Deprecated] + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorProfilerAlreadyStarted + + + [Deprecated] + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorProfilerAlreadyStopped + + + [Deprecated] + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorInvalidConfiguration + + + This indicates that a kernel launch is requesting resources that can never be satisfied by the current device. Requesting more shared memory per block than the device supports will trigger this error, as will requesting too many threads or blocks. See :py:obj:`~.cudaDeviceProp` for more device limitations. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorVersionTranslation + + + This indicates that the driver is newer than the runtime version and returned graph node parameter information that the runtime does not understand and is unable to translate. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorInvalidPitchValue + + + This indicates that one or more of the pitch-related parameters passed to the API call is not within the acceptable range for pitch. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorInvalidSymbol + + + This indicates that the symbol name/identifier passed to the API call is not a valid name or identifier. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorInvalidHostPointer + + + This indicates that at least one host pointer passed to the API call is not a valid host pointer. + + [Deprecated] + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorInvalidDevicePointer + + + This indicates that at least one device pointer passed to the API call is not a valid device pointer. + + [Deprecated] + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorInvalidTexture + + + This indicates that the texture passed to the API call is not a valid texture. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorInvalidTextureBinding + + + This indicates that the texture binding is not valid. This occurs if you call :py:obj:`~.cudaGetTextureAlignmentOffset()` with an unbound texture. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorInvalidChannelDescriptor + + + This indicates that the channel descriptor passed to the API call is not valid. This occurs if the format is not one of the formats specified by :py:obj:`~.cudaChannelFormatKind`, or if one of the dimensions is invalid. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorInvalidMemcpyDirection + + + This indicates that the direction of the memcpy passed to the API call is not one of the types specified by :py:obj:`~.cudaMemcpyKind`. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorAddressOfConstant + + + This indicated that the user has taken the address of a constant variable, which was forbidden up until the CUDA 3.1 release. + + [Deprecated] + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorTextureFetchFailed + + + This indicated that a texture fetch was not able to be performed. This was previously used for device emulation of texture operations. + + [Deprecated] + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorTextureNotBound + + + This indicated that a texture was not bound for access. This was previously used for device emulation of texture operations. + + [Deprecated] + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorSynchronizationError + + + This indicated that a synchronization operation had failed. This was previously used for some device emulation functions. + + [Deprecated] + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorInvalidFilterSetting + + + This indicates that a non-float texture was being accessed with linear filtering. This is not supported by CUDA. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorInvalidNormSetting + + + This indicates that an attempt was made to read an unsupported data type as a normalized float. This is not supported by CUDA. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorMixedDeviceExecution + + + Mixing of device and device emulation code was not allowed. + + [Deprecated] + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorNotYetImplemented + + + This indicates that the API call is not yet implemented. Production releases of CUDA will never return this error. + + [Deprecated] + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorMemoryValueTooLarge + + + This indicated that an emulated device pointer exceeded the 32-bit address range. + + [Deprecated] + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorStubLibrary + + + This indicates that the CUDA driver that the application has loaded is a stub library. Applications that run with the stub rather than a real driver loaded will result in CUDA API returning this error. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorInsufficientDriver + + + This indicates that the installed NVIDIA CUDA driver is older than the CUDA runtime library. This is not a supported configuration. Users should install an updated NVIDIA display driver to allow the application to run. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorCallRequiresNewerDriver + + + This indicates that the API call requires a newer CUDA driver than the one currently installed. Users should install an updated NVIDIA CUDA driver to allow the API call to succeed. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorInvalidSurface + + + This indicates that the surface passed to the API call is not a valid surface. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorDuplicateVariableName + + + This indicates that multiple global or constant variables (across separate CUDA source files in the application) share the same string name. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorDuplicateTextureName + + + This indicates that multiple textures (across separate CUDA source files in the application) share the same string name. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorDuplicateSurfaceName + + + This indicates that multiple surfaces (across separate CUDA source files in the application) share the same string name. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorDevicesUnavailable + + + This indicates that all CUDA devices are busy or unavailable at the current time. Devices are often busy/unavailable due to use of :py:obj:`~.cudaComputeModeProhibited`, :py:obj:`~.cudaComputeModeExclusiveProcess`, or when long running CUDA kernels have filled up the GPU and are blocking new work from starting. They can also be unavailable due to memory constraints on a device that already has active CUDA work being performed. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorIncompatibleDriverContext + + + This indicates that the current context is not compatible with this the CUDA Runtime. This can only occur if you are using CUDA Runtime/Driver interoperability and have created an existing Driver context using the driver API. The Driver context may be incompatible either because the Driver context was created using an older version of the API, because the Runtime API call expects a primary driver context and the Driver context is not primary, or because the Driver context has been destroyed. Please see :py:obj:`~.Interactions with the CUDA Driver API` for more information. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorMissingConfiguration + + + The device function being invoked (usually via :py:obj:`~.cudaLaunchKernel()`) was not previously configured via the :py:obj:`~.cudaConfigureCall()` function. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorPriorLaunchFailure + + + This indicated that a previous kernel launch failed. This was previously used for device emulation of kernel launches. + + [Deprecated] + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorLaunchMaxDepthExceeded + + + This error indicates that a device runtime grid launch did not occur because the depth of the child grid would exceed the maximum supported number of nested grid launches. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorLaunchFileScopedTex + + + This error indicates that a grid launch did not occur because the kernel uses file-scoped textures which are unsupported by the device runtime. Kernels launched via the device runtime only support textures created with the Texture Object API's. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorLaunchFileScopedSurf + + + This error indicates that a grid launch did not occur because the kernel uses file-scoped surfaces which are unsupported by the device runtime. Kernels launched via the device runtime only support surfaces created with the Surface Object API's. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorSyncDepthExceeded + + + This error indicates that a call to :py:obj:`~.cudaDeviceSynchronize` made from the device runtime failed because the call was made at grid depth greater than than either the default (2 levels of grids) or user specified device limit :py:obj:`~.cudaLimitDevRuntimeSyncDepth`. To be able to synchronize on launched grids at a greater depth successfully, the maximum nested depth at which :py:obj:`~.cudaDeviceSynchronize` will be called must be specified with the :py:obj:`~.cudaLimitDevRuntimeSyncDepth` limit to the :py:obj:`~.cudaDeviceSetLimit` api before the host-side launch of a kernel using the device runtime. Keep in mind that additional levels of sync depth require the runtime to reserve large amounts of device memory that cannot be used for user allocations. Note that :py:obj:`~.cudaDeviceSynchronize` made from device runtime is only supported on devices of compute capability < 9.0. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorLaunchPendingCountExceeded + + + This error indicates that a device runtime grid launch failed because the launch would exceed the limit :py:obj:`~.cudaLimitDevRuntimePendingLaunchCount`. For this launch to proceed successfully, :py:obj:`~.cudaDeviceSetLimit` must be called to set the :py:obj:`~.cudaLimitDevRuntimePendingLaunchCount` to be higher than the upper bound of outstanding launches that can be issued to the device runtime. Keep in mind that raising the limit of pending device runtime launches will require the runtime to reserve device memory that cannot be used for user allocations. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorInvalidDeviceFunction + + + The requested device function does not exist or is not compiled for the proper device architecture. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorNoDevice + + + This indicates that no CUDA-capable devices were detected by the installed CUDA driver. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorInvalidDevice + + + This indicates that the device ordinal supplied by the user does not correspond to a valid CUDA device or that the action requested is invalid for the specified device. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorDeviceNotLicensed + + + This indicates that the device doesn't have a valid Grid License. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorSoftwareValidityNotEstablished + + + By default, the CUDA runtime may perform a minimal set of self-tests, as well as CUDA driver tests, to establish the validity of both. Introduced in CUDA 11.2, this error return indicates that at least one of these tests has failed and the validity of either the runtime or the driver could not be established. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorStartupFailure + + + This indicates an internal startup failure in the CUDA runtime. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorInvalidKernelImage + + + This indicates that the device kernel image is invalid. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorDeviceUninitialized + + + This most frequently indicates that there is no context bound to the current thread. This can also be returned if the context passed to an API call is not a valid handle (such as a context that has had :py:obj:`~.cuCtxDestroy()` invoked on it). This can also be returned if a user mixes different API versions (i.e. 3010 context with 3020 API calls). See :py:obj:`~.cuCtxGetApiVersion()` for more details. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorMapBufferObjectFailed + + + This indicates that the buffer object could not be mapped. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorUnmapBufferObjectFailed + + + This indicates that the buffer object could not be unmapped. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorArrayIsMapped + + + This indicates that the specified array is currently mapped and thus cannot be destroyed. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorAlreadyMapped + + + This indicates that the resource is already mapped. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorNoKernelImageForDevice + + + This indicates that there is no kernel image available that is suitable for the device. This can occur when a user specifies code generation options for a particular CUDA source file that do not include the corresponding device configuration. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorAlreadyAcquired + + + This indicates that a resource has already been acquired. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorNotMapped + + + This indicates that a resource is not mapped. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorNotMappedAsArray + + + This indicates that a mapped resource is not available for access as an array. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorNotMappedAsPointer + + + This indicates that a mapped resource is not available for access as a pointer. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorECCUncorrectable + + + This indicates that an uncorrectable ECC error was detected during execution. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorUnsupportedLimit + + + This indicates that the :py:obj:`~.cudaLimit` passed to the API call is not supported by the active device. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorDeviceAlreadyInUse + + + This indicates that a call tried to access an exclusive-thread device that is already in use by a different thread. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorPeerAccessUnsupported + + + This error indicates that P2P access is not supported across the given devices. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorInvalidPtx + + + A PTX compilation failed. The runtime may fall back to compiling PTX if an application does not contain a suitable binary for the current device. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorInvalidGraphicsContext + + + This indicates an error with the OpenGL or DirectX context. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorNvlinkUncorrectable + + + This indicates that an uncorrectable NVLink error was detected during the execution. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorJitCompilerNotFound + + + This indicates that the PTX JIT compiler library was not found. The JIT Compiler library is used for PTX compilation. The runtime may fall back to compiling PTX if an application does not contain a suitable binary for the current device. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorUnsupportedPtxVersion + + + This indicates that the provided PTX was compiled with an unsupported toolchain. The most common reason for this, is the PTX was generated by a compiler newer than what is supported by the CUDA driver and PTX JIT compiler. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorJitCompilationDisabled + + + This indicates that the JIT compilation was disabled. The JIT compilation compiles PTX. The runtime may fall back to compiling PTX if an application does not contain a suitable binary for the current device. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorUnsupportedExecAffinity + + + This indicates that the provided execution affinity is not supported by the device. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorUnsupportedDevSideSync + + + This indicates that the code to be compiled by the PTX JIT contains unsupported call to cudaDeviceSynchronize. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorContained + + + This indicates that an exception occurred on the device that is now contained by the GPU's error containment capability. Common causes are - a. Certain types of invalid accesses of peer GPU memory over nvlink b. Certain classes of hardware errors This leaves the process in an inconsistent state and any further CUDA work will return the same error. To continue using CUDA, the process must be terminated and relaunched. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorInvalidSource + + + This indicates that the device kernel source is invalid. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorFileNotFound + + + This indicates that the file specified was not found. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorSharedObjectSymbolNotFound + + + This indicates that a link to a shared object failed to resolve. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorSharedObjectInitFailed + + + This indicates that initialization of a shared object failed. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorOperatingSystem + + + This error indicates that an OS call failed. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorInvalidResourceHandle + + + This indicates that a resource handle passed to the API call was not valid. Resource handles are opaque types like :py:obj:`~.cudaStream_t` and :py:obj:`~.cudaEvent_t`. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorIllegalState + + + This indicates that a resource required by the API call is not in a valid state to perform the requested operation. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorLossyQuery + + + This indicates an attempt was made to introspect an object in a way that would discard semantically important information. This is either due to the object using funtionality newer than the API version used to introspect it or omission of optional return arguments. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorSymbolNotFound + + + This indicates that a named symbol was not found. Examples of symbols are global/constant variable names, driver function names, texture names, and surface names. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorNotReady + + + This indicates that asynchronous operations issued previously have not completed yet. This result is not actually an error, but must be indicated differently than :py:obj:`~.cudaSuccess` (which indicates completion). Calls that may return this value include :py:obj:`~.cudaEventQuery()` and :py:obj:`~.cudaStreamQuery()`. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorIllegalAddress + + + The device encountered a load or store instruction on an invalid memory address. This leaves the process in an inconsistent state and any further CUDA work will return the same error. To continue using CUDA, the process must be terminated and relaunched. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorLaunchOutOfResources + + + This indicates that a launch did not occur because it did not have appropriate resources. Although this error is similar to :py:obj:`~.cudaErrorInvalidConfiguration`, this error usually indicates that the user has attempted to pass too many arguments to the device kernel, or the kernel launch specifies too many threads for the kernel's register count. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorLaunchTimeout + + + This indicates that the device kernel took too long to execute. This can only occur if timeouts are enabled - see the device attribute :py:obj:`~.cudaDevAttrKernelExecTimeout` for more information. This leaves the process in an inconsistent state and any further CUDA work will return the same error. To continue using CUDA, the process must be terminated and relaunched. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorLaunchIncompatibleTexturing + + + This error indicates a kernel launch that uses an incompatible texturing mode. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorPeerAccessAlreadyEnabled + + + This error indicates that a call to :py:obj:`~.cudaDeviceEnablePeerAccess()` is trying to re-enable peer addressing on from a context which has already had peer addressing enabled. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorPeerAccessNotEnabled + + + This error indicates that :py:obj:`~.cudaDeviceDisablePeerAccess()` is trying to disable peer addressing which has not been enabled yet via :py:obj:`~.cudaDeviceEnablePeerAccess()`. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorSetOnActiveProcess + + + This indicates that the user has called :py:obj:`~.cudaSetValidDevices()`, :py:obj:`~.cudaSetDeviceFlags()`, :py:obj:`~.cudaD3D9SetDirect3DDevice()`, :py:obj:`~.cudaD3D10SetDirect3DDevice`, :py:obj:`~.cudaD3D11SetDirect3DDevice()`, or :py:obj:`~.cudaVDPAUSetVDPAUDevice()` after initializing the CUDA runtime by calling non-device management operations (allocating memory and launching kernels are examples of non-device management operations). This error can also be returned if using runtime/driver interoperability and there is an existing :py:obj:`~.CUcontext` active on the host thread. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorContextIsDestroyed + + + This error indicates that the context current to the calling thread has been destroyed using :py:obj:`~.cuCtxDestroy`, or is a primary context which has not yet been initialized. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorAssert + + + An assert triggered in device code during kernel execution. The device cannot be used again. All existing allocations are invalid. To continue using CUDA, the process must be terminated and relaunched. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorTooManyPeers + + + This error indicates that the hardware resources required to enable peer access have been exhausted for one or more of the devices passed to :py:obj:`~.cudaEnablePeerAccess()`. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorHostMemoryAlreadyRegistered + + + This error indicates that the memory range passed to :py:obj:`~.cudaHostRegister()` has already been registered. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorHostMemoryNotRegistered + + + This error indicates that the pointer passed to :py:obj:`~.cudaHostUnregister()` does not correspond to any currently registered memory region. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorHardwareStackError + + + Device encountered an error in the call stack during kernel execution, possibly due to stack corruption or exceeding the stack size limit. This leaves the process in an inconsistent state and any further CUDA work will return the same error. To continue using CUDA, the process must be terminated and relaunched. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorIllegalInstruction + + + The device encountered an illegal instruction during kernel execution This leaves the process in an inconsistent state and any further CUDA work will return the same error. To continue using CUDA, the process must be terminated and relaunched. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorMisalignedAddress + + + The device encountered a load or store instruction on a memory address which is not aligned. This leaves the process in an inconsistent state and any further CUDA work will return the same error. To continue using CUDA, the process must be terminated and relaunched. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorInvalidAddressSpace + + + While executing a kernel, the device encountered an instruction which can only operate on memory locations in certain address spaces (global, shared, or local), but was supplied a memory address not belonging to an allowed address space. This leaves the process in an inconsistent state and any further CUDA work will return the same error. To continue using CUDA, the process must be terminated and relaunched. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorInvalidPc + + + The device encountered an invalid program counter. This leaves the process in an inconsistent state and any further CUDA work will return the same error. To continue using CUDA, the process must be terminated and relaunched. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorLaunchFailure + + + An exception occurred on the device while executing a kernel. Common causes include dereferencing an invalid device pointer and accessing out of bounds shared memory. Less common cases can be system specific - more information about these cases can be found in the system specific user guide. This leaves the process in an inconsistent state and any further CUDA work will return the same error. To continue using CUDA, the process must be terminated and relaunched. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorCooperativeLaunchTooLarge + + + This error indicates that the number of blocks launched per grid for a kernel that was launched via either :py:obj:`~.cudaLaunchCooperativeKernel` exceeds the maximum number of blocks as allowed by :py:obj:`~.cudaOccupancyMaxActiveBlocksPerMultiprocessor` or :py:obj:`~.cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags` times the number of multiprocessors as specified by the device attribute :py:obj:`~.cudaDevAttrMultiProcessorCount`. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorTensorMemoryLeak + + + An exception occurred on the device while exiting a kernel using tensor memory: the tensor memory was not completely deallocated. This leaves the process in an inconsistent state and any further CUDA work will return the same error. To continue using CUDA, the process must be terminated and relaunched. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorNotPermitted + + + This error indicates the attempted operation is not permitted. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorNotSupported + + + This error indicates the attempted operation is not supported on the current system or device. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorSystemNotReady + + + This error indicates that the system is not yet ready to start any CUDA work. To continue using CUDA, verify the system configuration is in a valid state and all required driver daemons are actively running. More information about this error can be found in the system specific user guide. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorSystemDriverMismatch + + + This error indicates that there is a mismatch between the versions of the display driver and the CUDA driver. Refer to the compatibility documentation for supported versions. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorCompatNotSupportedOnDevice + + + This error indicates that the system was upgraded to run with forward compatibility but the visible hardware detected by CUDA does not support this configuration. Refer to the compatibility documentation for the supported hardware matrix or ensure that only supported hardware is visible during initialization via the CUDA_VISIBLE_DEVICES environment variable. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorMpsConnectionFailed + + + This error indicates that the MPS client failed to connect to the MPS control daemon or the MPS server. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorMpsRpcFailure + + + This error indicates that the remote procedural call between the MPS server and the MPS client failed. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorMpsServerNotReady + + + This error indicates that the MPS server is not ready to accept new MPS client requests. This error can be returned when the MPS server is in the process of recovering from a fatal failure. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorMpsMaxClientsReached + + + This error indicates that the hardware resources required to create MPS client have been exhausted. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorMpsMaxConnectionsReached + + + This error indicates the the hardware resources required to device connections have been exhausted. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorMpsClientTerminated + + + This error indicates that the MPS client has been terminated by the server. To continue using CUDA, the process must be terminated and relaunched. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorCdpNotSupported + + + This error indicates, that the program is using CUDA Dynamic Parallelism, but the current configuration, like MPS, does not support it. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorCdpVersionMismatch + + + This error indicates, that the program contains an unsupported interaction between different versions of CUDA Dynamic Parallelism. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorStreamCaptureUnsupported + + + The operation is not permitted when the stream is capturing. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorStreamCaptureInvalidated + + + The current capture sequence on the stream has been invalidated due to a previous error. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorStreamCaptureMerge + + + The operation would have resulted in a merge of two independent capture sequences. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorStreamCaptureUnmatched + + + The capture was not initiated in this stream. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorStreamCaptureUnjoined + + + The capture sequence contains a fork that was not joined to the primary stream. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorStreamCaptureIsolation + + + A dependency would have been created which crosses the capture sequence boundary. Only implicit in-stream ordering dependencies are allowed to cross the boundary. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorStreamCaptureImplicit + + + The operation would have resulted in a disallowed implicit dependency on a current capture sequence from cudaStreamLegacy. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorCapturedEvent + + + The operation is not permitted on an event which was last recorded in a capturing stream. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorStreamCaptureWrongThread + + + A stream capture sequence not initiated with the :py:obj:`~.cudaStreamCaptureModeRelaxed` argument to :py:obj:`~.cudaStreamBeginCapture` was passed to :py:obj:`~.cudaStreamEndCapture` in a different thread. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorTimeout + + + This indicates that the wait operation has timed out. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorGraphExecUpdateFailure + + + This error indicates that the graph update was not performed because it included changes which violated constraints specific to instantiated graph update. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorExternalDevice + + + This indicates that an error has occurred in a device outside of GPU. It can be a synchronous error w.r.t. CUDA API or an asynchronous error from the external device. In case of asynchronous error, it means that if cuda was waiting for an external device's signal before consuming shared data, the external device signaled an error indicating that the data is not valid for consumption. This leaves the process in an inconsistent state and any further CUDA work will return the same error. To continue using CUDA, the process must be terminated and relaunched. In case of synchronous error, it means that one or more external devices have encountered an error and cannot complete the operation. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorInvalidClusterSize + + + This indicates that a kernel launch error has occurred due to cluster misconfiguration. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorFunctionNotLoaded + + + Indiciates a function handle is not loaded when calling an API that requires a loaded function. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorInvalidResourceType + + + This error indicates one or more resources passed in are not valid resource types for the operation. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorInvalidResourceConfiguration + + + This error indicates one or more resources are insufficient or non-applicable for the operation. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorStreamDetached + + + This error indicates that the requested operation is not permitted because the stream is in a detached state. This can occur if the green context associated with the stream has been destroyed, limiting the stream's operational capabilities. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorGraphRecaptureFailure + + + This error indicates that a graph recapture failed and had to be terminated. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorUnknown + + + This indicates that an unknown internal error has occurred. + + + .. autoattribute:: cuda.bindings.runtime.cudaError_t.cudaErrorApiFailureBase + +.. autoclass:: cuda.bindings.runtime.cudaChannelFormatKind + + .. autoattribute:: cuda.bindings.runtime.cudaChannelFormatKind.cudaChannelFormatKindSigned + + + Signed channel format + + + .. autoattribute:: cuda.bindings.runtime.cudaChannelFormatKind.cudaChannelFormatKindUnsigned + + + Unsigned channel format + + + .. autoattribute:: cuda.bindings.runtime.cudaChannelFormatKind.cudaChannelFormatKindFloat + + + Float channel format + + + .. autoattribute:: cuda.bindings.runtime.cudaChannelFormatKind.cudaChannelFormatKindNone + + + No channel format + + + .. autoattribute:: cuda.bindings.runtime.cudaChannelFormatKind.cudaChannelFormatKindNV12 + + + Unsigned 8-bit integers, planar 4:2:0 YUV format + + + .. autoattribute:: cuda.bindings.runtime.cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized8X1 + + + 1 channel unsigned 8-bit normalized integer + + + .. autoattribute:: cuda.bindings.runtime.cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized8X2 + + + 2 channel unsigned 8-bit normalized integer + + + .. autoattribute:: cuda.bindings.runtime.cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized8X4 + + + 4 channel unsigned 8-bit normalized integer + + + .. autoattribute:: cuda.bindings.runtime.cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized16X1 + + + 1 channel unsigned 16-bit normalized integer + + + .. autoattribute:: cuda.bindings.runtime.cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized16X2 + + + 2 channel unsigned 16-bit normalized integer + + + .. autoattribute:: cuda.bindings.runtime.cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized16X4 + + + 4 channel unsigned 16-bit normalized integer + + + .. autoattribute:: cuda.bindings.runtime.cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized8X1 + + + 1 channel signed 8-bit normalized integer + + + .. autoattribute:: cuda.bindings.runtime.cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized8X2 + + + 2 channel signed 8-bit normalized integer + + + .. autoattribute:: cuda.bindings.runtime.cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized8X4 + + + 4 channel signed 8-bit normalized integer + + + .. autoattribute:: cuda.bindings.runtime.cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized16X1 + + + 1 channel signed 16-bit normalized integer + + + .. autoattribute:: cuda.bindings.runtime.cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized16X2 + + + 2 channel signed 16-bit normalized integer + + + .. autoattribute:: cuda.bindings.runtime.cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized16X4 + + + 4 channel signed 16-bit normalized integer + + + .. autoattribute:: cuda.bindings.runtime.cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed1 + + + 4 channel unsigned normalized block-compressed (BC1 compression) format + + + .. autoattribute:: cuda.bindings.runtime.cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed1SRGB + + + 4 channel unsigned normalized block-compressed (BC1 compression) format with sRGB encoding + + + .. autoattribute:: cuda.bindings.runtime.cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed2 + + + 4 channel unsigned normalized block-compressed (BC2 compression) format + + + .. autoattribute:: cuda.bindings.runtime.cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed2SRGB + + + 4 channel unsigned normalized block-compressed (BC2 compression) format with sRGB encoding + + + .. autoattribute:: cuda.bindings.runtime.cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed3 + + + 4 channel unsigned normalized block-compressed (BC3 compression) format + + + .. autoattribute:: cuda.bindings.runtime.cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed3SRGB + + + 4 channel unsigned normalized block-compressed (BC3 compression) format with sRGB encoding + + + .. autoattribute:: cuda.bindings.runtime.cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed4 + + + 1 channel unsigned normalized block-compressed (BC4 compression) format + + + .. autoattribute:: cuda.bindings.runtime.cudaChannelFormatKind.cudaChannelFormatKindSignedBlockCompressed4 + + + 1 channel signed normalized block-compressed (BC4 compression) format + + + .. autoattribute:: cuda.bindings.runtime.cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed5 + + + 2 channel unsigned normalized block-compressed (BC5 compression) format + + + .. autoattribute:: cuda.bindings.runtime.cudaChannelFormatKind.cudaChannelFormatKindSignedBlockCompressed5 + + + 2 channel signed normalized block-compressed (BC5 compression) format + + + .. autoattribute:: cuda.bindings.runtime.cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed6H + + + 3 channel unsigned half-float block-compressed (BC6H compression) format + + + .. autoattribute:: cuda.bindings.runtime.cudaChannelFormatKind.cudaChannelFormatKindSignedBlockCompressed6H + + + 3 channel signed half-float block-compressed (BC6H compression) format + + + .. autoattribute:: cuda.bindings.runtime.cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed7 + + + 4 channel unsigned normalized block-compressed (BC7 compression) format + + + .. autoattribute:: cuda.bindings.runtime.cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed7SRGB + + + 4 channel unsigned normalized block-compressed (BC7 compression) format with sRGB encoding + + + .. autoattribute:: cuda.bindings.runtime.cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized1010102 + + + 4 channel unsigned normalized (10-bit, 10-bit, 10-bit, 2-bit) format + + + .. autoattribute:: cuda.bindings.runtime.cudaChannelFormatKind.cudaChannelFormatKindUnsigned8Packed422 + + + 4 channel unsigned 8-bit packed format, with 4:2:2 sampling + + + .. autoattribute:: cuda.bindings.runtime.cudaChannelFormatKind.cudaChannelFormatKindUnsigned8Packed444 + + + 4 channel unsigned 8-bit packed format, with 4:4:4 sampling + + + .. autoattribute:: cuda.bindings.runtime.cudaChannelFormatKind.cudaChannelFormatKindUnsigned8SemiPlanar420 + + + 3 channel unsigned 8-bit semi-planar format, with 4:2:0 sampling + + + .. autoattribute:: cuda.bindings.runtime.cudaChannelFormatKind.cudaChannelFormatKindUnsigned16SemiPlanar420 + + + 3 channel unsigned 16-bit semi-planar format, with 4:2:0 sampling + + + .. autoattribute:: cuda.bindings.runtime.cudaChannelFormatKind.cudaChannelFormatKindUnsigned8SemiPlanar422 + + + 3 channel unsigned 8-bit semi-planar format, with 4:2:2 sampling + + + .. autoattribute:: cuda.bindings.runtime.cudaChannelFormatKind.cudaChannelFormatKindUnsigned16SemiPlanar422 + + + 3 channel unsigned 16-bit semi-planar format, with 4:2:2 sampling + + + .. autoattribute:: cuda.bindings.runtime.cudaChannelFormatKind.cudaChannelFormatKindUnsigned8SemiPlanar444 + + + 3 channel unsigned 8-bit semi-planar format, with 4:4:4 sampling + + + .. autoattribute:: cuda.bindings.runtime.cudaChannelFormatKind.cudaChannelFormatKindUnsigned16SemiPlanar444 + + + 3 channel unsigned 16-bit semi-planar format, with 4:4:4 sampling + + + .. autoattribute:: cuda.bindings.runtime.cudaChannelFormatKind.cudaChannelFormatKindUnsigned8Planar420 + + + 3 channel unsigned 8-bit planar format, with 4:2:0 sampling + + + .. autoattribute:: cuda.bindings.runtime.cudaChannelFormatKind.cudaChannelFormatKindUnsigned16Planar420 + + + 3 channel unsigned 16-bit planar format, with 4:2:0 sampling + + + .. autoattribute:: cuda.bindings.runtime.cudaChannelFormatKind.cudaChannelFormatKindUnsigned8Planar422 + + + 3 channel unsigned 8-bit planar format, with 4:2:2 sampling + + + .. autoattribute:: cuda.bindings.runtime.cudaChannelFormatKind.cudaChannelFormatKindUnsigned16Planar422 + + + 3 channel unsigned 16-bit planar format, with 4:2:2 sampling + + + .. autoattribute:: cuda.bindings.runtime.cudaChannelFormatKind.cudaChannelFormatKindUnsigned8Planar444 + + + 3 channel unsigned 8-bit planar format, with 4:4:4 sampling + + + .. autoattribute:: cuda.bindings.runtime.cudaChannelFormatKind.cudaChannelFormatKindUnsigned16Planar444 + + + 3 channel unsigned 16-bit planar format, with 4:4:4 sampling + +.. autoclass:: cuda.bindings.runtime.cudaMemoryType + + .. autoattribute:: cuda.bindings.runtime.cudaMemoryType.cudaMemoryTypeUnregistered + + + Unregistered memory + + + .. autoattribute:: cuda.bindings.runtime.cudaMemoryType.cudaMemoryTypeHost + + + Host memory + + + .. autoattribute:: cuda.bindings.runtime.cudaMemoryType.cudaMemoryTypeDevice + + + Device memory + + + .. autoattribute:: cuda.bindings.runtime.cudaMemoryType.cudaMemoryTypeManaged + + + Managed memory + +.. autoclass:: cuda.bindings.runtime.cudaMemcpyKind + + .. autoattribute:: cuda.bindings.runtime.cudaMemcpyKind.cudaMemcpyHostToHost + + + Host -> Host + + + .. autoattribute:: cuda.bindings.runtime.cudaMemcpyKind.cudaMemcpyHostToDevice + + + Host -> Device + + + .. autoattribute:: cuda.bindings.runtime.cudaMemcpyKind.cudaMemcpyDeviceToHost + + + Device -> Host + + + .. autoattribute:: cuda.bindings.runtime.cudaMemcpyKind.cudaMemcpyDeviceToDevice + + + Device -> Device + + + .. autoattribute:: cuda.bindings.runtime.cudaMemcpyKind.cudaMemcpyDefault + + + Direction of the transfer is inferred from the pointer values. Requires unified virtual addressing + +.. autoclass:: cuda.bindings.runtime.cudaAccessProperty + + .. autoattribute:: cuda.bindings.runtime.cudaAccessProperty.cudaAccessPropertyNormal + + + Normal cache persistence. + + + .. autoattribute:: cuda.bindings.runtime.cudaAccessProperty.cudaAccessPropertyStreaming + + + Streaming access is less likely to persit from cache. + + + .. autoattribute:: cuda.bindings.runtime.cudaAccessProperty.cudaAccessPropertyPersisting + + + Persisting access is more likely to persist in cache. + +.. autoclass:: cuda.bindings.runtime.cudaStreamCaptureStatus + + .. autoattribute:: cuda.bindings.runtime.cudaStreamCaptureStatus.cudaStreamCaptureStatusNone + + + Stream is not capturing + + + .. autoattribute:: cuda.bindings.runtime.cudaStreamCaptureStatus.cudaStreamCaptureStatusActive + + + Stream is actively capturing + + + .. autoattribute:: cuda.bindings.runtime.cudaStreamCaptureStatus.cudaStreamCaptureStatusInvalidated + + + Stream is part of a capture sequence that has been invalidated, but not terminated + +.. autoclass:: cuda.bindings.runtime.cudaGraphRecaptureStatus + + .. autoattribute:: cuda.bindings.runtime.cudaGraphRecaptureStatus.cudaGraphRecaptureEligibleForUpdate + + + Node is eligible for update in an instantiated graph. + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphRecaptureStatus.cudaGraphRecaptureIneligibleForUpdate + + + Parameter changes in the node cannot be applied to an instantiated graph. + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphRecaptureStatus.cudaGraphRecaptureError + + + Error while attempting to recapture the node. The recapture will be ended regardless of the return value from the callback. + +.. autoclass:: cuda.bindings.runtime.cudaStreamCaptureMode + + .. autoattribute:: cuda.bindings.runtime.cudaStreamCaptureMode.cudaStreamCaptureModeGlobal + + + .. autoattribute:: cuda.bindings.runtime.cudaStreamCaptureMode.cudaStreamCaptureModeThreadLocal + + + .. autoattribute:: cuda.bindings.runtime.cudaStreamCaptureMode.cudaStreamCaptureModeRelaxed + +.. autoclass:: cuda.bindings.runtime.cudaSynchronizationPolicy + + .. autoattribute:: cuda.bindings.runtime.cudaSynchronizationPolicy.cudaSyncPolicyAuto + + + .. autoattribute:: cuda.bindings.runtime.cudaSynchronizationPolicy.cudaSyncPolicySpin + + + .. autoattribute:: cuda.bindings.runtime.cudaSynchronizationPolicy.cudaSyncPolicyYield + + + .. autoattribute:: cuda.bindings.runtime.cudaSynchronizationPolicy.cudaSyncPolicyBlockingSync + +.. autoclass:: cuda.bindings.runtime.cudaClusterSchedulingPolicy + + .. autoattribute:: cuda.bindings.runtime.cudaClusterSchedulingPolicy.cudaClusterSchedulingPolicyDefault + + + the default policy + + + .. autoattribute:: cuda.bindings.runtime.cudaClusterSchedulingPolicy.cudaClusterSchedulingPolicySpread + + + spread the blocks within a cluster to the SMs + + + .. autoattribute:: cuda.bindings.runtime.cudaClusterSchedulingPolicy.cudaClusterSchedulingPolicyLoadBalancing + + + allow the hardware to load-balance the blocks in a cluster to the SMs + +.. autoclass:: cuda.bindings.runtime.cudaStreamUpdateCaptureDependenciesFlags + + .. autoattribute:: cuda.bindings.runtime.cudaStreamUpdateCaptureDependenciesFlags.cudaStreamAddCaptureDependencies + + + Add new nodes to the dependency set + + + .. autoattribute:: cuda.bindings.runtime.cudaStreamUpdateCaptureDependenciesFlags.cudaStreamSetCaptureDependencies + + + Replace the dependency set with the new nodes + +.. autoclass:: cuda.bindings.runtime.cudaUserObjectFlags + + .. autoattribute:: cuda.bindings.runtime.cudaUserObjectFlags.cudaUserObjectNoDestructorSync + + + Indicates the destructor execution is not synchronized by any CUDA handle. + +.. autoclass:: cuda.bindings.runtime.cudaUserObjectRetainFlags + + .. autoattribute:: cuda.bindings.runtime.cudaUserObjectRetainFlags.cudaGraphUserObjectMove + + + Transfer references from the caller rather than creating new references. + +.. autoclass:: cuda.bindings.runtime.cudaHostTaskSyncMode + + .. autoattribute:: cuda.bindings.runtime.cudaHostTaskSyncMode.cudaHostTaskBlocking + + + .. autoattribute:: cuda.bindings.runtime.cudaHostTaskSyncMode.cudaHostTaskSpinWait + +.. autoclass:: cuda.bindings.runtime.cudaGraphicsRegisterFlags + + .. autoattribute:: cuda.bindings.runtime.cudaGraphicsRegisterFlags.cudaGraphicsRegisterFlagsNone + + + Default + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphicsRegisterFlags.cudaGraphicsRegisterFlagsReadOnly + + + CUDA will not write to this resource + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphicsRegisterFlags.cudaGraphicsRegisterFlagsWriteDiscard + + + CUDA will only write to and will not read from this resource + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphicsRegisterFlags.cudaGraphicsRegisterFlagsSurfaceLoadStore + + + CUDA will bind this resource to a surface reference + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphicsRegisterFlags.cudaGraphicsRegisterFlagsTextureGather + + + CUDA will perform texture gather operations on this resource + +.. autoclass:: cuda.bindings.runtime.cudaGraphicsMapFlags + + .. autoattribute:: cuda.bindings.runtime.cudaGraphicsMapFlags.cudaGraphicsMapFlagsNone + + + Default; Assume resource can be read/written + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphicsMapFlags.cudaGraphicsMapFlagsReadOnly + + + CUDA will not write to this resource + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphicsMapFlags.cudaGraphicsMapFlagsWriteDiscard + + + CUDA will only write to and will not read from this resource + +.. autoclass:: cuda.bindings.runtime.cudaGraphicsCubeFace + + .. autoattribute:: cuda.bindings.runtime.cudaGraphicsCubeFace.cudaGraphicsCubeFacePositiveX + + + Positive X face of cubemap + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphicsCubeFace.cudaGraphicsCubeFaceNegativeX + + + Negative X face of cubemap + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphicsCubeFace.cudaGraphicsCubeFacePositiveY + + + Positive Y face of cubemap + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphicsCubeFace.cudaGraphicsCubeFaceNegativeY + + + Negative Y face of cubemap + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphicsCubeFace.cudaGraphicsCubeFacePositiveZ + + + Positive Z face of cubemap + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphicsCubeFace.cudaGraphicsCubeFaceNegativeZ + + + Negative Z face of cubemap + +.. autoclass:: cuda.bindings.runtime.cudaResourceType + + .. autoattribute:: cuda.bindings.runtime.cudaResourceType.cudaResourceTypeArray + + + Array resource + + + .. autoattribute:: cuda.bindings.runtime.cudaResourceType.cudaResourceTypeMipmappedArray + + + Mipmapped array resource + + + .. autoattribute:: cuda.bindings.runtime.cudaResourceType.cudaResourceTypeLinear + + + Linear resource + + + .. autoattribute:: cuda.bindings.runtime.cudaResourceType.cudaResourceTypePitch2D + + + Pitch 2D resource + +.. autoclass:: cuda.bindings.runtime.cudaResourceViewFormat + + .. autoattribute:: cuda.bindings.runtime.cudaResourceViewFormat.cudaResViewFormatNone + + + No resource view format (use underlying resource format) + + + .. autoattribute:: cuda.bindings.runtime.cudaResourceViewFormat.cudaResViewFormatUnsignedChar1 + + + 1 channel unsigned 8-bit integers + + + .. autoattribute:: cuda.bindings.runtime.cudaResourceViewFormat.cudaResViewFormatUnsignedChar2 + + + 2 channel unsigned 8-bit integers + + + .. autoattribute:: cuda.bindings.runtime.cudaResourceViewFormat.cudaResViewFormatUnsignedChar4 + + + 4 channel unsigned 8-bit integers + + + .. autoattribute:: cuda.bindings.runtime.cudaResourceViewFormat.cudaResViewFormatSignedChar1 + + + 1 channel signed 8-bit integers + + + .. autoattribute:: cuda.bindings.runtime.cudaResourceViewFormat.cudaResViewFormatSignedChar2 + + + 2 channel signed 8-bit integers + + + .. autoattribute:: cuda.bindings.runtime.cudaResourceViewFormat.cudaResViewFormatSignedChar4 + + + 4 channel signed 8-bit integers + + + .. autoattribute:: cuda.bindings.runtime.cudaResourceViewFormat.cudaResViewFormatUnsignedShort1 + + + 1 channel unsigned 16-bit integers + + + .. autoattribute:: cuda.bindings.runtime.cudaResourceViewFormat.cudaResViewFormatUnsignedShort2 + + + 2 channel unsigned 16-bit integers + + + .. autoattribute:: cuda.bindings.runtime.cudaResourceViewFormat.cudaResViewFormatUnsignedShort4 + + + 4 channel unsigned 16-bit integers + + + .. autoattribute:: cuda.bindings.runtime.cudaResourceViewFormat.cudaResViewFormatSignedShort1 + + + 1 channel signed 16-bit integers + + + .. autoattribute:: cuda.bindings.runtime.cudaResourceViewFormat.cudaResViewFormatSignedShort2 + + + 2 channel signed 16-bit integers + + + .. autoattribute:: cuda.bindings.runtime.cudaResourceViewFormat.cudaResViewFormatSignedShort4 + + + 4 channel signed 16-bit integers + + + .. autoattribute:: cuda.bindings.runtime.cudaResourceViewFormat.cudaResViewFormatUnsignedInt1 + + + 1 channel unsigned 32-bit integers + + + .. autoattribute:: cuda.bindings.runtime.cudaResourceViewFormat.cudaResViewFormatUnsignedInt2 + + + 2 channel unsigned 32-bit integers + + + .. autoattribute:: cuda.bindings.runtime.cudaResourceViewFormat.cudaResViewFormatUnsignedInt4 + + + 4 channel unsigned 32-bit integers + + + .. autoattribute:: cuda.bindings.runtime.cudaResourceViewFormat.cudaResViewFormatSignedInt1 + + + 1 channel signed 32-bit integers + + + .. autoattribute:: cuda.bindings.runtime.cudaResourceViewFormat.cudaResViewFormatSignedInt2 + + + 2 channel signed 32-bit integers + + + .. autoattribute:: cuda.bindings.runtime.cudaResourceViewFormat.cudaResViewFormatSignedInt4 + + + 4 channel signed 32-bit integers + + + .. autoattribute:: cuda.bindings.runtime.cudaResourceViewFormat.cudaResViewFormatHalf1 + + + 1 channel 16-bit floating point + + + .. autoattribute:: cuda.bindings.runtime.cudaResourceViewFormat.cudaResViewFormatHalf2 + + + 2 channel 16-bit floating point + + + .. autoattribute:: cuda.bindings.runtime.cudaResourceViewFormat.cudaResViewFormatHalf4 + + + 4 channel 16-bit floating point + + + .. autoattribute:: cuda.bindings.runtime.cudaResourceViewFormat.cudaResViewFormatFloat1 + + + 1 channel 32-bit floating point + + + .. autoattribute:: cuda.bindings.runtime.cudaResourceViewFormat.cudaResViewFormatFloat2 + + + 2 channel 32-bit floating point + + + .. autoattribute:: cuda.bindings.runtime.cudaResourceViewFormat.cudaResViewFormatFloat4 + + + 4 channel 32-bit floating point + + + .. autoattribute:: cuda.bindings.runtime.cudaResourceViewFormat.cudaResViewFormatUnsignedBlockCompressed1 + + + Block compressed 1 + + + .. autoattribute:: cuda.bindings.runtime.cudaResourceViewFormat.cudaResViewFormatUnsignedBlockCompressed2 + + + Block compressed 2 + + + .. autoattribute:: cuda.bindings.runtime.cudaResourceViewFormat.cudaResViewFormatUnsignedBlockCompressed3 + + + Block compressed 3 + + + .. autoattribute:: cuda.bindings.runtime.cudaResourceViewFormat.cudaResViewFormatUnsignedBlockCompressed4 + + + Block compressed 4 unsigned + + + .. autoattribute:: cuda.bindings.runtime.cudaResourceViewFormat.cudaResViewFormatSignedBlockCompressed4 + + + Block compressed 4 signed + + + .. autoattribute:: cuda.bindings.runtime.cudaResourceViewFormat.cudaResViewFormatUnsignedBlockCompressed5 + + + Block compressed 5 unsigned + + + .. autoattribute:: cuda.bindings.runtime.cudaResourceViewFormat.cudaResViewFormatSignedBlockCompressed5 + + + Block compressed 5 signed + + + .. autoattribute:: cuda.bindings.runtime.cudaResourceViewFormat.cudaResViewFormatUnsignedBlockCompressed6H + + + Block compressed 6 unsigned half-float + + + .. autoattribute:: cuda.bindings.runtime.cudaResourceViewFormat.cudaResViewFormatSignedBlockCompressed6H + + + Block compressed 6 signed half-float + + + .. autoattribute:: cuda.bindings.runtime.cudaResourceViewFormat.cudaResViewFormatUnsignedBlockCompressed7 + + + Block compressed 7 + +.. autoclass:: cuda.bindings.runtime.cudaSharedMemoryMode + + .. autoattribute:: cuda.bindings.runtime.cudaSharedMemoryMode.cudaSharedMemoryModeDefault + + + The default to use for allowing non-portable shared memory size on launch - uses current function attributes for :py:obj:`~.cudaFuncAttributeMaxDynamicSharedMemorySize` + + + .. autoattribute:: cuda.bindings.runtime.cudaSharedMemoryMode.cudaSharedMemoryModeRequirePortable + + + Specifies that the shared memory size requested must be a portable size within :py:obj:`~.cudaDevAttrMaxSharedMemoryPerBlock` + + + .. autoattribute:: cuda.bindings.runtime.cudaSharedMemoryMode.cudaSharedMemoryModeAllowNonPortable + + + Specifies that the shared memory size requested may be a non-portable size up to :py:obj:`~.cudaDevAttrMaxSharedMemoryPerBlockOptin` + +.. autoclass:: cuda.bindings.runtime.cudaFuncAttribute + + .. autoattribute:: cuda.bindings.runtime.cudaFuncAttribute.cudaFuncAttributeMaxDynamicSharedMemorySize + + + Maximum dynamic shared memory size + + + .. autoattribute:: cuda.bindings.runtime.cudaFuncAttribute.cudaFuncAttributePreferredSharedMemoryCarveout + + + Preferred shared memory-L1 cache split + + + .. autoattribute:: cuda.bindings.runtime.cudaFuncAttribute.cudaFuncAttributeClusterDimMustBeSet + + + Indicator to enforce valid cluster dimension specification on kernel launch + + + .. autoattribute:: cuda.bindings.runtime.cudaFuncAttribute.cudaFuncAttributeRequiredClusterWidth + + + Required cluster width + + + .. autoattribute:: cuda.bindings.runtime.cudaFuncAttribute.cudaFuncAttributeRequiredClusterHeight + + + Required cluster height + + + .. autoattribute:: cuda.bindings.runtime.cudaFuncAttribute.cudaFuncAttributeRequiredClusterDepth + + + Required cluster depth + + + .. autoattribute:: cuda.bindings.runtime.cudaFuncAttribute.cudaFuncAttributeNonPortableClusterSizeAllowed + + + Whether non-portable cluster scheduling policy is supported + + + .. autoattribute:: cuda.bindings.runtime.cudaFuncAttribute.cudaFuncAttributeClusterSchedulingPolicyPreference + + + Required cluster scheduling policy preference + + + .. autoattribute:: cuda.bindings.runtime.cudaFuncAttribute.cudaFuncAttributeMax + +.. autoclass:: cuda.bindings.runtime.cudaFuncCache + + .. autoattribute:: cuda.bindings.runtime.cudaFuncCache.cudaFuncCachePreferNone + + + Default function cache configuration, no preference + + + .. autoattribute:: cuda.bindings.runtime.cudaFuncCache.cudaFuncCachePreferShared + + + Prefer larger shared memory and smaller L1 cache + + + .. autoattribute:: cuda.bindings.runtime.cudaFuncCache.cudaFuncCachePreferL1 + + + Prefer larger L1 cache and smaller shared memory + + + .. autoattribute:: cuda.bindings.runtime.cudaFuncCache.cudaFuncCachePreferEqual + + + Prefer equal size L1 cache and shared memory + +.. autoclass:: cuda.bindings.runtime.cudaSharedMemConfig + + .. autoattribute:: cuda.bindings.runtime.cudaSharedMemConfig.cudaSharedMemBankSizeDefault + + + .. autoattribute:: cuda.bindings.runtime.cudaSharedMemConfig.cudaSharedMemBankSizeFourByte + + + .. autoattribute:: cuda.bindings.runtime.cudaSharedMemConfig.cudaSharedMemBankSizeEightByte + +.. autoclass:: cuda.bindings.runtime.cudaSharedCarveout + + .. autoattribute:: cuda.bindings.runtime.cudaSharedCarveout.cudaSharedmemCarveoutDefault + + + No preference for shared memory or L1 (default) + + + .. autoattribute:: cuda.bindings.runtime.cudaSharedCarveout.cudaSharedmemCarveoutMaxShared + + + Prefer maximum available shared memory, minimum L1 cache + + + .. autoattribute:: cuda.bindings.runtime.cudaSharedCarveout.cudaSharedmemCarveoutMaxL1 + + + Prefer maximum available L1 cache, minimum shared memory + +.. autoclass:: cuda.bindings.runtime.cudaComputeMode + + .. autoattribute:: cuda.bindings.runtime.cudaComputeMode.cudaComputeModeDefault + + + Default compute mode (Multiple threads can use :py:obj:`~.cudaSetDevice()` with this device) + + + .. autoattribute:: cuda.bindings.runtime.cudaComputeMode.cudaComputeModeExclusive + + + Compute-exclusive-thread mode (Only one thread in one process will be able to use :py:obj:`~.cudaSetDevice()` with this device) + + + .. autoattribute:: cuda.bindings.runtime.cudaComputeMode.cudaComputeModeProhibited + + + Compute-prohibited mode (No threads can use :py:obj:`~.cudaSetDevice()` with this device) + + + .. autoattribute:: cuda.bindings.runtime.cudaComputeMode.cudaComputeModeExclusiveProcess + + + Compute-exclusive-process mode (Many threads in one process will be able to use :py:obj:`~.cudaSetDevice()` with this device) + +.. autoclass:: cuda.bindings.runtime.cudaLimit + + .. autoattribute:: cuda.bindings.runtime.cudaLimit.cudaLimitStackSize + + + GPU thread stack size + + + .. autoattribute:: cuda.bindings.runtime.cudaLimit.cudaLimitPrintfFifoSize + + + GPU printf FIFO size + + + .. autoattribute:: cuda.bindings.runtime.cudaLimit.cudaLimitMallocHeapSize + + + GPU malloc heap size + + + .. autoattribute:: cuda.bindings.runtime.cudaLimit.cudaLimitDevRuntimeSyncDepth + + + GPU device runtime synchronize depth + + + .. autoattribute:: cuda.bindings.runtime.cudaLimit.cudaLimitDevRuntimePendingLaunchCount + + + GPU device runtime pending launch count + + + .. autoattribute:: cuda.bindings.runtime.cudaLimit.cudaLimitMaxL2FetchGranularity + + + A value between 0 and 128 that indicates the maximum fetch granularity of L2 (in Bytes). This is a hint + + + .. autoattribute:: cuda.bindings.runtime.cudaLimit.cudaLimitPersistingL2CacheSize + + + A size in bytes for L2 persisting lines cache size + +.. autoclass:: cuda.bindings.runtime.cudaMemoryAdvise + + .. autoattribute:: cuda.bindings.runtime.cudaMemoryAdvise.cudaMemAdviseSetReadMostly + + + Data will mostly be read and only occassionally be written to + + + .. autoattribute:: cuda.bindings.runtime.cudaMemoryAdvise.cudaMemAdviseUnsetReadMostly + + + Undo the effect of :py:obj:`~.cudaMemAdviseSetReadMostly` + + + .. autoattribute:: cuda.bindings.runtime.cudaMemoryAdvise.cudaMemAdviseSetPreferredLocation + + + Set the preferred location for the data as the specified device + + + .. autoattribute:: cuda.bindings.runtime.cudaMemoryAdvise.cudaMemAdviseUnsetPreferredLocation + + + Clear the preferred location for the data + + + .. autoattribute:: cuda.bindings.runtime.cudaMemoryAdvise.cudaMemAdviseSetAccessedBy + + + Data will be accessed by the specified device, so prevent page faults as much as possible + + + .. autoattribute:: cuda.bindings.runtime.cudaMemoryAdvise.cudaMemAdviseUnsetAccessedBy + + + Let the Unified Memory subsystem decide on the page faulting policy for the specified device + +.. autoclass:: cuda.bindings.runtime.cudaMemRangeAttribute + + .. autoattribute:: cuda.bindings.runtime.cudaMemRangeAttribute.cudaMemRangeAttributeReadMostly + + + Whether the range will mostly be read and only occassionally be written to + + + .. autoattribute:: cuda.bindings.runtime.cudaMemRangeAttribute.cudaMemRangeAttributePreferredLocation + + + The preferred location of the range + + + .. autoattribute:: cuda.bindings.runtime.cudaMemRangeAttribute.cudaMemRangeAttributeAccessedBy + + + Memory range has :py:obj:`~.cudaMemAdviseSetAccessedBy` set for specified device + + + .. autoattribute:: cuda.bindings.runtime.cudaMemRangeAttribute.cudaMemRangeAttributeLastPrefetchLocation + + + The last location to which the range was prefetched + + + .. autoattribute:: cuda.bindings.runtime.cudaMemRangeAttribute.cudaMemRangeAttributePreferredLocationType + + + The preferred location type of the range + + + .. autoattribute:: cuda.bindings.runtime.cudaMemRangeAttribute.cudaMemRangeAttributePreferredLocationId + + + The preferred location id of the range + + + .. autoattribute:: cuda.bindings.runtime.cudaMemRangeAttribute.cudaMemRangeAttributeLastPrefetchLocationType + + + The last location type to which the range was prefetched + + + .. autoattribute:: cuda.bindings.runtime.cudaMemRangeAttribute.cudaMemRangeAttributeLastPrefetchLocationId + + + The last location id to which the range was prefetched + +.. autoclass:: cuda.bindings.runtime.cudaFlushGPUDirectRDMAWritesOptions + + .. autoattribute:: cuda.bindings.runtime.cudaFlushGPUDirectRDMAWritesOptions.cudaFlushGPUDirectRDMAWritesOptionHost + + + :py:obj:`~.cudaDeviceFlushGPUDirectRDMAWrites()` and its CUDA Driver API counterpart are supported on the device. + + + .. autoattribute:: cuda.bindings.runtime.cudaFlushGPUDirectRDMAWritesOptions.cudaFlushGPUDirectRDMAWritesOptionMemOps + + + The :py:obj:`~.CU_STREAM_WAIT_VALUE_FLUSH` flag and the :py:obj:`~.CU_STREAM_MEM_OP_FLUSH_REMOTE_WRITES` MemOp are supported on the CUDA device. + +.. autoclass:: cuda.bindings.runtime.cudaGPUDirectRDMAWritesOrdering + + .. autoattribute:: cuda.bindings.runtime.cudaGPUDirectRDMAWritesOrdering.cudaGPUDirectRDMAWritesOrderingNone + + + The device does not natively support ordering of GPUDirect RDMA writes. :py:obj:`~.cudaFlushGPUDirectRDMAWrites()` can be leveraged if supported. + + + .. autoattribute:: cuda.bindings.runtime.cudaGPUDirectRDMAWritesOrdering.cudaGPUDirectRDMAWritesOrderingOwner + + + Natively, the device can consistently consume GPUDirect RDMA writes, although other CUDA devices may not. + + + .. autoattribute:: cuda.bindings.runtime.cudaGPUDirectRDMAWritesOrdering.cudaGPUDirectRDMAWritesOrderingAllDevices + + + Any CUDA device in the system can consistently consume GPUDirect RDMA writes to this device. + +.. autoclass:: cuda.bindings.runtime.cudaFlushGPUDirectRDMAWritesScope + + .. autoattribute:: cuda.bindings.runtime.cudaFlushGPUDirectRDMAWritesScope.cudaFlushGPUDirectRDMAWritesToOwner + + + Blocks until remote writes are visible to the CUDA device context owning the data. + + + .. autoattribute:: cuda.bindings.runtime.cudaFlushGPUDirectRDMAWritesScope.cudaFlushGPUDirectRDMAWritesToAllDevices + + + Blocks until remote writes are visible to all CUDA device contexts. + +.. autoclass:: cuda.bindings.runtime.cudaFlushGPUDirectRDMAWritesTarget + + .. autoattribute:: cuda.bindings.runtime.cudaFlushGPUDirectRDMAWritesTarget.cudaFlushGPUDirectRDMAWritesTargetCurrentDevice + + + Sets the target for :py:obj:`~.cudaDeviceFlushGPUDirectRDMAWrites()` to the currently active CUDA device context. + +.. autoclass:: cuda.bindings.runtime.cudaDeviceAttr + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMaxThreadsPerBlock + + + Maximum number of threads per block + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMaxBlockDimX + + + Maximum block dimension X + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMaxBlockDimY + + + Maximum block dimension Y + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMaxBlockDimZ + + + Maximum block dimension Z + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMaxGridDimX + + + Maximum grid dimension X + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMaxGridDimY + + + Maximum grid dimension Y + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMaxGridDimZ + + + Maximum grid dimension Z + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMaxSharedMemoryPerBlock + + + Maximum shared memory available per block in bytes + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrTotalConstantMemory + + + Memory available on device for constant variables in a CUDA C kernel in bytes + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrWarpSize + + + Warp size in threads + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMaxPitch + + + Maximum pitch in bytes allowed by memory copies + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMaxRegistersPerBlock + + + Maximum number of 32-bit registers available per block + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrClockRate + + + Peak clock frequency in kilohertz + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrTextureAlignment + + + Alignment requirement for textures + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrGpuOverlap + + + Device can possibly copy memory and execute a kernel concurrently + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMultiProcessorCount + + + Number of multiprocessors on device + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrKernelExecTimeout + + + Specifies whether there is a run time limit on kernels + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrIntegrated + + + Device is integrated with host memory + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrCanMapHostMemory + + + Device can map host memory into CUDA address space + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrComputeMode + + + Compute mode (See :py:obj:`~.cudaComputeMode` for details) + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMaxTexture1DWidth + + + Maximum 1D texture width + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMaxTexture2DWidth + + + Maximum 2D texture width + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMaxTexture2DHeight + + + Maximum 2D texture height + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMaxTexture3DWidth + + + Maximum 3D texture width + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMaxTexture3DHeight + + + Maximum 3D texture height + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMaxTexture3DDepth + + + Maximum 3D texture depth + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMaxTexture2DLayeredWidth + + + Maximum 2D layered texture width + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMaxTexture2DLayeredHeight + + + Maximum 2D layered texture height + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMaxTexture2DLayeredLayers + + + Maximum layers in a 2D layered texture + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrSurfaceAlignment + + + Alignment requirement for surfaces + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrConcurrentKernels + + + Device can possibly execute multiple kernels concurrently + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrEccEnabled + + + Device has ECC support enabled + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrPciBusId + + + PCI bus ID of the device + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrPciDeviceId + + + PCI device ID of the device + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrTccDriver + + + Device is using TCC driver model + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMemoryClockRate + + + Peak memory clock frequency in kilohertz + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrGlobalMemoryBusWidth + + + Global memory bus width in bits + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrL2CacheSize + + + Size of L2 cache in bytes + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMaxThreadsPerMultiProcessor + + + Maximum resident threads per multiprocessor + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrAsyncEngineCount + + + Number of asynchronous engines + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrUnifiedAddressing + + + Device shares a unified address space with the host + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMaxTexture1DLayeredWidth + + + Maximum 1D layered texture width + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMaxTexture1DLayeredLayers + + + Maximum layers in a 1D layered texture + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMaxTexture2DGatherWidth + + + Maximum 2D texture width if cudaArrayTextureGather is set + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMaxTexture2DGatherHeight + + + Maximum 2D texture height if cudaArrayTextureGather is set + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMaxTexture3DWidthAlt + + + Alternate maximum 3D texture width + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMaxTexture3DHeightAlt + + + Alternate maximum 3D texture height + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMaxTexture3DDepthAlt + + + Alternate maximum 3D texture depth + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrPciDomainId + + + PCI domain ID of the device + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrTexturePitchAlignment + + + Pitch alignment requirement for textures + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMaxTextureCubemapWidth + + + Maximum cubemap texture width/height + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMaxTextureCubemapLayeredWidth + + + Maximum cubemap layered texture width/height + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMaxTextureCubemapLayeredLayers + + + Maximum layers in a cubemap layered texture + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMaxSurface1DWidth + + + Maximum 1D surface width + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMaxSurface2DWidth + + + Maximum 2D surface width + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMaxSurface2DHeight + + + Maximum 2D surface height + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMaxSurface3DWidth + + + Maximum 3D surface width + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMaxSurface3DHeight + + + Maximum 3D surface height + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMaxSurface3DDepth + + + Maximum 3D surface depth + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMaxSurface1DLayeredWidth + + + Maximum 1D layered surface width + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMaxSurface1DLayeredLayers + + + Maximum layers in a 1D layered surface + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMaxSurface2DLayeredWidth + + + Maximum 2D layered surface width + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMaxSurface2DLayeredHeight + + + Maximum 2D layered surface height + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMaxSurface2DLayeredLayers + + + Maximum layers in a 2D layered surface + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMaxSurfaceCubemapWidth + + + Maximum cubemap surface width + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMaxSurfaceCubemapLayeredWidth + + + Maximum cubemap layered surface width + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMaxSurfaceCubemapLayeredLayers + + + Maximum layers in a cubemap layered surface + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMaxTexture1DLinearWidth + + + Maximum 1D linear texture width + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMaxTexture2DLinearWidth + + + Maximum 2D linear texture width + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMaxTexture2DLinearHeight + + + Maximum 2D linear texture height + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMaxTexture2DLinearPitch + + + Maximum 2D linear texture pitch in bytes + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMaxTexture2DMipmappedWidth + + + Maximum mipmapped 2D texture width + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMaxTexture2DMipmappedHeight + + + Maximum mipmapped 2D texture height + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrComputeCapabilityMajor + + + Major compute capability version number + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrComputeCapabilityMinor + + + Minor compute capability version number + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMaxTexture1DMipmappedWidth + + + Maximum mipmapped 1D texture width + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrStreamPrioritiesSupported + + + Device supports stream priorities + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrGlobalL1CacheSupported + + + Device supports caching globals in L1 + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrLocalL1CacheSupported + + + Device supports caching locals in L1 + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMaxSharedMemoryPerMultiprocessor + + + Maximum shared memory available per multiprocessor in bytes + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMaxRegistersPerMultiprocessor + + + Maximum number of 32-bit registers available per multiprocessor + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrManagedMemory + + + Device can allocate managed memory on this system + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrIsMultiGpuBoard + + + Device is on a multi-GPU board + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMultiGpuBoardGroupID + + + Unique identifier for a group of devices on the same multi-GPU board + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrHostNativeAtomicSupported + + + Link between the device and the host supports native atomic operations + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrSingleToDoublePrecisionPerfRatio + + + Ratio of single precision performance (in floating-point operations per second) to double precision performance + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrPageableMemoryAccess + + + Device supports coherently accessing pageable memory without calling cudaHostRegister on it + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrConcurrentManagedAccess + + + Device can coherently access managed memory concurrently with the CPU + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrComputePreemptionSupported + + + Device supports Compute Preemption + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrCanUseHostPointerForRegisteredMem + + + Device can access host registered memory at the same virtual address as the CPU + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrReserved92 + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrReserved93 + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrReserved94 + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrCooperativeLaunch + + + Device supports launching cooperative kernels via :py:obj:`~.cudaLaunchCooperativeKernel` + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrReserved96 + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMaxSharedMemoryPerBlockOptin + + + The maximum optin shared memory per block. This value may vary by chip. See :py:obj:`~.cudaFuncSetAttribute` + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrCanFlushRemoteWrites + + + Device supports flushing of outstanding remote writes. + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrHostRegisterSupported + + + Device supports host memory registration via :py:obj:`~.cudaHostRegister`. + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrPageableMemoryAccessUsesHostPageTables + + + Device accesses pageable memory via the host's page tables. + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrDirectManagedMemAccessFromHost + + + Host can directly access managed memory on the device without migration. + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMaxBlocksPerMultiprocessor + + + Maximum number of blocks per multiprocessor + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMaxPersistingL2CacheSize + + + Maximum L2 persisting lines capacity setting in bytes. + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMaxAccessPolicyWindowSize + + + Maximum value of :py:obj:`~.cudaAccessPolicyWindow.num_bytes`. + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrReservedSharedMemoryPerBlock + + + Shared memory reserved by CUDA driver per block in bytes + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrSparseCudaArraySupported + + + Device supports sparse CUDA arrays and sparse CUDA mipmapped arrays + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrHostRegisterReadOnlySupported + + + Device supports using the :py:obj:`~.cudaHostRegister` flag cudaHostRegisterReadOnly to register memory that must be mapped as read-only to the GPU + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrTimelineSemaphoreInteropSupported + + + External timeline semaphore interop is supported on the device + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMemoryPoolsSupported + + + Device supports using the :py:obj:`~.cudaMallocAsync` and :py:obj:`~.cudaMemPool` family of APIs + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrGPUDirectRDMASupported + + + Device supports GPUDirect RDMA APIs, like nvidia_p2p_get_pages (see https://docs.nvidia.com/cuda/gpudirect-rdma for more information) + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrGPUDirectRDMAFlushWritesOptions + + + The returned attribute shall be interpreted as a bitmask, where the individual bits are listed in the :py:obj:`~.cudaFlushGPUDirectRDMAWritesOptions` enum + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrGPUDirectRDMAWritesOrdering + + + GPUDirect RDMA writes to the device do not need to be flushed for consumers within the scope indicated by the returned attribute. See :py:obj:`~.cudaGPUDirectRDMAWritesOrdering` for the numerical values returned here. + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMemoryPoolSupportedHandleTypes + + + Handle types supported with mempool based IPC + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrClusterLaunch + + + Indicates device supports cluster launch + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrDeferredMappingCudaArraySupported + + + Device supports deferred mapping CUDA arrays and CUDA mipmapped arrays + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrReserved122 + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrReserved123 + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrReserved124 + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrIpcEventSupport + + + Device supports IPC Events. + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMemSyncDomainCount + + + Number of memory synchronization domains the device supports. + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrReserved127 + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrReserved128 + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrReserved129 + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrNumaConfig + + + NUMA configuration of a device: value is of type :py:obj:`~.cudaDeviceNumaConfig` enum + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrNumaId + + + NUMA node ID of the GPU memory + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrReserved132 + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMpsEnabled + + + Contexts created on this device will be shared via MPS + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrHostNumaId + + + NUMA ID of the host node closest to the device or -1 when system does not support NUMA + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrD3D12CigSupported + + + Device supports CIG with D3D12. + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrVulkanCigSupported + + + Device supports CIG with Vulkan. + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrGpuPciDeviceId + + + The combined 16-bit PCI device ID and 16-bit PCI vendor ID. + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrGpuPciSubsystemId + + + The combined 16-bit PCI subsystem ID and 16-bit PCI subsystem vendor ID. + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrReserved141 + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrHostNumaMemoryPoolsSupported + + + Device supports HOST_NUMA location with the :py:obj:`~.cudaMallocAsync` and :py:obj:`~.cudaMemPool` family of APIs + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrHostNumaMultinodeIpcSupported + + + Device supports HostNuma location IPC between nodes in a multi-node system. + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrHostMemoryPoolsSupported + + + Device suports HOST location with the :py:obj:`~.cuMemAllocAsync` and :py:obj:`~.cuMemPool` family of APIs + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrReserved145 + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrOnlyPartialHostNativeAtomicSupported + + + Link between the device and the host supports only some native atomic operations + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrAtomicReductionSupported + + + Device supports atomic reduction operations in stream batch memory operations + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrCigStreamsSupported + + + Device supports CIG streams + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceAttr.cudaDevAttrMax + +.. autoclass:: cuda.bindings.runtime.cudaMemPoolAttr + + .. autoattribute:: cuda.bindings.runtime.cudaMemPoolAttr.cudaMemPoolReuseFollowEventDependencies + + + (value type = int) Allow cuMemAllocAsync to use memory asynchronously freed in another streams as long as a stream ordering dependency of the allocating stream on the free action exists. Cuda events and null stream interactions can create the required stream ordered dependencies. (default enabled) + + + .. autoattribute:: cuda.bindings.runtime.cudaMemPoolAttr.cudaMemPoolReuseAllowOpportunistic + + + (value type = int) Allow reuse of already completed frees when there is no dependency between the free and allocation. (default enabled) + + + .. autoattribute:: cuda.bindings.runtime.cudaMemPoolAttr.cudaMemPoolReuseAllowInternalDependencies + + + (value type = int) Allow cuMemAllocAsync to insert new stream dependencies in order to establish the stream ordering required to reuse a piece of memory released by cuFreeAsync (default enabled). + + + .. autoattribute:: cuda.bindings.runtime.cudaMemPoolAttr.cudaMemPoolAttrReleaseThreshold + + + (value type = cuuint64_t) Amount of reserved memory in bytes to hold onto before trying to release memory back to the OS. When more than the release threshold bytes of memory are held by the memory pool, the allocator will try to release memory back to the OS on the next call to stream, event or context synchronize. (default 0) + + + .. autoattribute:: cuda.bindings.runtime.cudaMemPoolAttr.cudaMemPoolAttrReservedMemCurrent + + + (value type = cuuint64_t) Amount of backing memory currently allocated for the mempool. + + + .. autoattribute:: cuda.bindings.runtime.cudaMemPoolAttr.cudaMemPoolAttrReservedMemHigh + + + (value type = cuuint64_t) High watermark of backing memory allocated for the mempool since the last time it was reset. High watermark can only be reset to zero. + + + .. autoattribute:: cuda.bindings.runtime.cudaMemPoolAttr.cudaMemPoolAttrUsedMemCurrent + + + (value type = cuuint64_t) Amount of memory from the pool that is currently in use by the application. + + + .. autoattribute:: cuda.bindings.runtime.cudaMemPoolAttr.cudaMemPoolAttrUsedMemHigh + + + (value type = cuuint64_t) High watermark of the amount of memory from the pool that was in use by the application since the last time it was reset. High watermark can only be reset to zero. + + + .. autoattribute:: cuda.bindings.runtime.cudaMemPoolAttr.cudaMemPoolAttrAllocationType + + + (value type = :py:obj:`~.cudaMemAllocationType`) The allocation type of the mempool + + + .. autoattribute:: cuda.bindings.runtime.cudaMemPoolAttr.cudaMemPoolAttrExportHandleTypes + + + (value type = :py:obj:`~.cudaMemAllocationHandleType`) Available export handle types for the mempool. For imported pools this value is always cudaMemHandleTypeNone as an imported pool cannot be re-exported + + + .. autoattribute:: cuda.bindings.runtime.cudaMemPoolAttr.cudaMemPoolAttrLocationId + + + (value type = int) The location id for the mempool. If the location type for this pool is cudaMemLocationTypeInvisible then ID will be cudaInvalidDeviceId + + + .. autoattribute:: cuda.bindings.runtime.cudaMemPoolAttr.cudaMemPoolAttrLocationType + + + (value type = :py:obj:`~.cudaMemLocationType`) The location type for the mempool. For imported memory pools where the device is not directly visible to the importing process or pools imported via fabric handles across nodes this will be cudaMemLocationTypeInvisible + + + .. autoattribute:: cuda.bindings.runtime.cudaMemPoolAttr.cudaMemPoolAttrMaxPoolSize + + + (value type = cuuint64_t) Maximum size of the pool in bytes, this value may be higher than what was initially passed to cudaMemPoolCreate due to alignment requirements. A value of 0 indicates no maximum size. For cudaMemAllocationTypeManaged and IPC imported pools this value will be system dependent. + + + .. autoattribute:: cuda.bindings.runtime.cudaMemPoolAttr.cudaMemPoolAttrHwDecompressEnabled + + + (value type = int) Indicates whether the pool has hardware compresssion enabled + +.. autoclass:: cuda.bindings.runtime.cudaMemLocationType + + .. autoattribute:: cuda.bindings.runtime.cudaMemLocationType.cudaMemLocationTypeInvalid + + + .. autoattribute:: cuda.bindings.runtime.cudaMemLocationType.cudaMemLocationTypeNone + + + Location is unspecified. This is used when creating a managed memory pool to indicate no preferred location for the pool + + + .. autoattribute:: cuda.bindings.runtime.cudaMemLocationType.cudaMemLocationTypeDevice + + + Location is a device location, thus id is a device ordinal + + + .. autoattribute:: cuda.bindings.runtime.cudaMemLocationType.cudaMemLocationTypeHost + + + Location is host, id is ignored + + + .. autoattribute:: cuda.bindings.runtime.cudaMemLocationType.cudaMemLocationTypeHostNuma + + + Location is a host NUMA node, thus id is a host NUMA node id + + + .. autoattribute:: cuda.bindings.runtime.cudaMemLocationType.cudaMemLocationTypeHostNumaCurrent + + + Location is the host NUMA node closest to the current thread's CPU, id is ignored + + + .. autoattribute:: cuda.bindings.runtime.cudaMemLocationType.cudaMemLocationTypeInvisible + + + Location is not visible but device is accessible, id is always cudaInvalidDeviceId + +.. autoclass:: cuda.bindings.runtime.cudaMemAccessFlags + + .. autoattribute:: cuda.bindings.runtime.cudaMemAccessFlags.cudaMemAccessFlagsProtNone + + + Default, make the address range not accessible + + + .. autoattribute:: cuda.bindings.runtime.cudaMemAccessFlags.cudaMemAccessFlagsProtRead + + + Make the address range read accessible + + + .. autoattribute:: cuda.bindings.runtime.cudaMemAccessFlags.cudaMemAccessFlagsProtReadWrite + + + Make the address range read-write accessible + +.. autoclass:: cuda.bindings.runtime.cudaMemAllocationType + + .. autoattribute:: cuda.bindings.runtime.cudaMemAllocationType.cudaMemAllocationTypeInvalid + + + .. autoattribute:: cuda.bindings.runtime.cudaMemAllocationType.cudaMemAllocationTypePinned + + + This allocation type is 'pinned', i.e. cannot migrate from its current location while the application is actively using it + + + .. autoattribute:: cuda.bindings.runtime.cudaMemAllocationType.cudaMemAllocationTypeManaged + + + This allocation type is managed memory + + + .. autoattribute:: cuda.bindings.runtime.cudaMemAllocationType.cudaMemAllocationTypeMax + +.. autoclass:: cuda.bindings.runtime.cudaMemAllocationHandleType + + .. autoattribute:: cuda.bindings.runtime.cudaMemAllocationHandleType.cudaMemHandleTypeNone + + + Does not allow any export mechanism. > + + + .. autoattribute:: cuda.bindings.runtime.cudaMemAllocationHandleType.cudaMemHandleTypePosixFileDescriptor + + + Allows a file descriptor to be used for exporting. Permitted only on POSIX systems. (int) + + + .. autoattribute:: cuda.bindings.runtime.cudaMemAllocationHandleType.cudaMemHandleTypeWin32 + + + Allows a Win32 NT handle to be used for exporting. (HANDLE) + + + .. autoattribute:: cuda.bindings.runtime.cudaMemAllocationHandleType.cudaMemHandleTypeWin32Kmt + + + Allows a Win32 KMT handle to be used for exporting. (D3DKMT_HANDLE) + + + .. autoattribute:: cuda.bindings.runtime.cudaMemAllocationHandleType.cudaMemHandleTypeFabric + + + Allows a fabric handle to be used for exporting. (:py:obj:`~.cudaMemFabricHandle_t`) + +.. autoclass:: cuda.bindings.runtime.cudaGraphMemAttributeType + + .. autoattribute:: cuda.bindings.runtime.cudaGraphMemAttributeType.cudaGraphMemAttrUsedMemCurrent + + + (value type = cuuint64_t) Amount of memory, in bytes, currently associated with graphs. + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphMemAttributeType.cudaGraphMemAttrUsedMemHigh + + + (value type = cuuint64_t) High watermark of memory, in bytes, associated with graphs since the last time it was reset. High watermark can only be reset to zero. + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphMemAttributeType.cudaGraphMemAttrReservedMemCurrent + + + (value type = cuuint64_t) Amount of memory, in bytes, currently allocated for use by the CUDA graphs asynchronous allocator. + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphMemAttributeType.cudaGraphMemAttrReservedMemHigh + + + (value type = cuuint64_t) High watermark of memory, in bytes, currently allocated for use by the CUDA graphs asynchronous allocator. + +.. autoclass:: cuda.bindings.runtime.cudaMemcpyFlags + + .. autoattribute:: cuda.bindings.runtime.cudaMemcpyFlags.cudaMemcpyFlagDefault + + + .. autoattribute:: cuda.bindings.runtime.cudaMemcpyFlags.cudaMemcpyFlagPreferOverlapWithCompute + + + Hint to the driver to try and overlap the copy with compute work on the SMs. + +.. autoclass:: cuda.bindings.runtime.cudaMemcpySrcAccessOrder + + .. autoattribute:: cuda.bindings.runtime.cudaMemcpySrcAccessOrder.cudaMemcpySrcAccessOrderInvalid + + + Default invalid. + + + .. autoattribute:: cuda.bindings.runtime.cudaMemcpySrcAccessOrder.cudaMemcpySrcAccessOrderStream + + + Indicates that access to the source pointer must be in stream order. + + + .. autoattribute:: cuda.bindings.runtime.cudaMemcpySrcAccessOrder.cudaMemcpySrcAccessOrderDuringApiCall + + + Indicates that access to the source pointer can be out of stream order and all accesses must be complete before the API call returns. This flag is suited for ephemeral sources (ex., stack variables) when it's known that no prior operations in the stream can be accessing the memory and also that the lifetime of the memory is limited to the scope that the source variable was declared in. Specifying this flag allows the driver to optimize the copy and removes the need for the user to synchronize the stream after the API call. + + + .. autoattribute:: cuda.bindings.runtime.cudaMemcpySrcAccessOrder.cudaMemcpySrcAccessOrderAny + + + Indicates that access to the source pointer can be out of stream order and the accesses can happen even after the API call returns. This flag is suited for host pointers allocated outside CUDA (ex., via malloc) when it's known that no prior operations in the stream can be accessing the memory. Specifying this flag allows the driver to optimize the copy on certain platforms. + + + .. autoattribute:: cuda.bindings.runtime.cudaMemcpySrcAccessOrder.cudaMemcpySrcAccessOrderMax + +.. autoclass:: cuda.bindings.runtime.cudaMemcpy3DOperandType + + .. autoattribute:: cuda.bindings.runtime.cudaMemcpy3DOperandType.cudaMemcpyOperandTypePointer + + + Memcpy operand is a valid pointer. + + + .. autoattribute:: cuda.bindings.runtime.cudaMemcpy3DOperandType.cudaMemcpyOperandTypeArray + + + Memcpy operand is a CUarray. + + + .. autoattribute:: cuda.bindings.runtime.cudaMemcpy3DOperandType.cudaMemcpyOperandTypeMax + +.. autoclass:: cuda.bindings.runtime.cudaDeviceP2PAttr + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceP2PAttr.cudaDevP2PAttrPerformanceRank + + + A relative value indicating the performance of the link between two devices + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceP2PAttr.cudaDevP2PAttrAccessSupported + + + Peer access is enabled + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceP2PAttr.cudaDevP2PAttrNativeAtomicSupported + + + Native atomic operation over the link supported + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceP2PAttr.cudaDevP2PAttrCudaArrayAccessSupported + + + Accessing CUDA arrays over the link supported + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceP2PAttr.cudaDevP2PAttrOnlyPartialNativeAtomicSupported + + + Only some CUDA-valid atomic operations over the link are supported. + +.. autoclass:: cuda.bindings.runtime.cudaAtomicOperation + + .. autoattribute:: cuda.bindings.runtime.cudaAtomicOperation.cudaAtomicOperationIntegerAdd + + + .. autoattribute:: cuda.bindings.runtime.cudaAtomicOperation.cudaAtomicOperationIntegerMin + + + .. autoattribute:: cuda.bindings.runtime.cudaAtomicOperation.cudaAtomicOperationIntegerMax + + + .. autoattribute:: cuda.bindings.runtime.cudaAtomicOperation.cudaAtomicOperationIntegerIncrement + + + .. autoattribute:: cuda.bindings.runtime.cudaAtomicOperation.cudaAtomicOperationIntegerDecrement + + + .. autoattribute:: cuda.bindings.runtime.cudaAtomicOperation.cudaAtomicOperationAnd + + + .. autoattribute:: cuda.bindings.runtime.cudaAtomicOperation.cudaAtomicOperationOr + + + .. autoattribute:: cuda.bindings.runtime.cudaAtomicOperation.cudaAtomicOperationXOR + + + .. autoattribute:: cuda.bindings.runtime.cudaAtomicOperation.cudaAtomicOperationExchange + + + .. autoattribute:: cuda.bindings.runtime.cudaAtomicOperation.cudaAtomicOperationCAS + + + .. autoattribute:: cuda.bindings.runtime.cudaAtomicOperation.cudaAtomicOperationFloatAdd + + + .. autoattribute:: cuda.bindings.runtime.cudaAtomicOperation.cudaAtomicOperationFloatMin + + + .. autoattribute:: cuda.bindings.runtime.cudaAtomicOperation.cudaAtomicOperationFloatMax + +.. autoclass:: cuda.bindings.runtime.cudaAtomicOperationCapability + + .. autoattribute:: cuda.bindings.runtime.cudaAtomicOperationCapability.cudaAtomicCapabilitySigned + + + .. autoattribute:: cuda.bindings.runtime.cudaAtomicOperationCapability.cudaAtomicCapabilityUnsigned + + + .. autoattribute:: cuda.bindings.runtime.cudaAtomicOperationCapability.cudaAtomicCapabilityReduction + + + .. autoattribute:: cuda.bindings.runtime.cudaAtomicOperationCapability.cudaAtomicCapabilityScalar32 + + + .. autoattribute:: cuda.bindings.runtime.cudaAtomicOperationCapability.cudaAtomicCapabilityScalar64 + + + .. autoattribute:: cuda.bindings.runtime.cudaAtomicOperationCapability.cudaAtomicCapabilityScalar128 + + + .. autoattribute:: cuda.bindings.runtime.cudaAtomicOperationCapability.cudaAtomicCapabilityVector32x4 + +.. autoclass:: cuda.bindings.runtime.cudaExternalMemoryHandleType + + .. autoattribute:: cuda.bindings.runtime.cudaExternalMemoryHandleType.cudaExternalMemoryHandleTypeOpaqueFd + + + Handle is an opaque file descriptor + + + .. autoattribute:: cuda.bindings.runtime.cudaExternalMemoryHandleType.cudaExternalMemoryHandleTypeOpaqueWin32 + + + Handle is an opaque shared NT handle + + + .. autoattribute:: cuda.bindings.runtime.cudaExternalMemoryHandleType.cudaExternalMemoryHandleTypeOpaqueWin32Kmt + + + Handle is an opaque, globally shared handle + + + .. autoattribute:: cuda.bindings.runtime.cudaExternalMemoryHandleType.cudaExternalMemoryHandleTypeD3D12Heap + + + Handle is a D3D12 heap object + + + .. autoattribute:: cuda.bindings.runtime.cudaExternalMemoryHandleType.cudaExternalMemoryHandleTypeD3D12Resource + + + Handle is a D3D12 committed resource + + + .. autoattribute:: cuda.bindings.runtime.cudaExternalMemoryHandleType.cudaExternalMemoryHandleTypeD3D11Resource + + + Handle is a shared NT handle to a D3D11 resource + + + .. autoattribute:: cuda.bindings.runtime.cudaExternalMemoryHandleType.cudaExternalMemoryHandleTypeD3D11ResourceKmt + + + Handle is a globally shared handle to a D3D11 resource + + + .. autoattribute:: cuda.bindings.runtime.cudaExternalMemoryHandleType.cudaExternalMemoryHandleTypeNvSciBuf + + + Handle is an NvSciBuf object + +.. autoclass:: cuda.bindings.runtime.cudaExternalSemaphoreHandleType + + .. autoattribute:: cuda.bindings.runtime.cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeOpaqueFd + + + Handle is an opaque file descriptor + + + .. autoattribute:: cuda.bindings.runtime.cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeOpaqueWin32 + + + Handle is an opaque shared NT handle + + + .. autoattribute:: cuda.bindings.runtime.cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeOpaqueWin32Kmt + + + Handle is an opaque, globally shared handle + + + .. autoattribute:: cuda.bindings.runtime.cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeD3D12Fence + + + Handle is a shared NT handle referencing a D3D12 fence object + + + .. autoattribute:: cuda.bindings.runtime.cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeD3D11Fence + + + Handle is a shared NT handle referencing a D3D11 fence object + + + .. autoattribute:: cuda.bindings.runtime.cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeNvSciSync + + + Opaque handle to NvSciSync Object + + + .. autoattribute:: cuda.bindings.runtime.cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeKeyedMutex + + + Handle is a shared NT handle referencing a D3D11 keyed mutex object + + + .. autoattribute:: cuda.bindings.runtime.cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeKeyedMutexKmt + + + Handle is a shared KMT handle referencing a D3D11 keyed mutex object + + + .. autoattribute:: cuda.bindings.runtime.cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeTimelineSemaphoreFd + + + Handle is an opaque handle file descriptor referencing a timeline semaphore + + + .. autoattribute:: cuda.bindings.runtime.cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeTimelineSemaphoreWin32 + + + Handle is an opaque handle file descriptor referencing a timeline semaphore + +.. autoclass:: cuda.bindings.runtime.cudaDevSmResourceGroup_flags + + .. autoattribute:: cuda.bindings.runtime.cudaDevSmResourceGroup_flags.cudaDevSmResourceGroupDefault + + + .. autoattribute:: cuda.bindings.runtime.cudaDevSmResourceGroup_flags.cudaDevSmResourceGroupBackfill + + + Lets smCount be a non-multiple of minCoscheduledCount, filling the difference with other SMs. + +.. autoclass:: cuda.bindings.runtime.cudaDevSmResourceSplitByCount_flags + + .. autoattribute:: cuda.bindings.runtime.cudaDevSmResourceSplitByCount_flags.cudaDevSmResourceSplitIgnoreSmCoscheduling + + + .. autoattribute:: cuda.bindings.runtime.cudaDevSmResourceSplitByCount_flags.cudaDevSmResourceSplitMaxPotentialClusterSize + +.. autoclass:: cuda.bindings.runtime.cudaDevResourceType + + .. autoattribute:: cuda.bindings.runtime.cudaDevResourceType.cudaDevResourceTypeInvalid + + + .. autoattribute:: cuda.bindings.runtime.cudaDevResourceType.cudaDevResourceTypeSm + + + Streaming multiprocessors related information + + + .. autoattribute:: cuda.bindings.runtime.cudaDevResourceType.cudaDevResourceTypeWorkqueueConfig + + + Workqueue configuration related information + + + .. autoattribute:: cuda.bindings.runtime.cudaDevResourceType.cudaDevResourceTypeWorkqueue + + + Pre-existing workqueue related information + +.. autoclass:: cuda.bindings.runtime.cudaDevWorkqueueConfigScope + + .. autoattribute:: cuda.bindings.runtime.cudaDevWorkqueueConfigScope.cudaDevWorkqueueConfigScopeDeviceCtx + + + Use all shared workqueue resources on the device. Default driver behaviour. + + + .. autoattribute:: cuda.bindings.runtime.cudaDevWorkqueueConfigScope.cudaDevWorkqueueConfigScopeGreenCtxBalanced + + + When possible, use non-overlapping workqueue resources with other balanced green contexts. + +.. autoclass:: cuda.bindings.runtime.cudaJitOption + + .. autoattribute:: cuda.bindings.runtime.cudaJitOption.cudaJitMaxRegisters + + + Max number of registers that a thread may use. + + Option type: unsigned int + + Applies to: compiler only + + + .. autoattribute:: cuda.bindings.runtime.cudaJitOption.cudaJitThreadsPerBlock + + + IN: Specifies minimum number of threads per block to target compilation for + + OUT: Returns the number of threads the compiler actually targeted. This restricts the resource utilization of the compiler (e.g. max registers) such that a block with the given number of threads should be able to launch based on register limitations. Note, this option does not currently take into account any other resource limitations, such as shared memory utilization. + + Option type: unsigned int + + Applies to: compiler only + + + .. autoattribute:: cuda.bindings.runtime.cudaJitOption.cudaJitWallTime + + + Overwrites the option value with the total wall clock time, in milliseconds, spent in the compiler and linker + + Option type: float + + Applies to: compiler and linker + + + .. autoattribute:: cuda.bindings.runtime.cudaJitOption.cudaJitInfoLogBuffer + + + Pointer to a buffer in which to print any log messages that are informational in nature (the buffer size is specified via option :py:obj:`~.cudaJitInfoLogBufferSizeBytes`) + + Option type: char \* + + Applies to: compiler and linker + + + .. autoattribute:: cuda.bindings.runtime.cudaJitOption.cudaJitInfoLogBufferSizeBytes + + + IN: Log buffer size in bytes. Log messages will be capped at this size (including null terminator) + + OUT: Amount of log buffer filled with messages + + Option type: unsigned int + + Applies to: compiler and linker + + + .. autoattribute:: cuda.bindings.runtime.cudaJitOption.cudaJitErrorLogBuffer + + + Pointer to a buffer in which to print any log messages that reflect errors (the buffer size is specified via option :py:obj:`~.cudaJitErrorLogBufferSizeBytes`) + + Option type: char \* + + Applies to: compiler and linker + + + .. autoattribute:: cuda.bindings.runtime.cudaJitOption.cudaJitErrorLogBufferSizeBytes + + + IN: Log buffer size in bytes. Log messages will be capped at this size (including null terminator) + + OUT: Amount of log buffer filled with messages + + Option type: unsigned int + + Applies to: compiler and linker + + + .. autoattribute:: cuda.bindings.runtime.cudaJitOption.cudaJitOptimizationLevel + + + Level of optimizations to apply to generated code (0 - 4), with 4 being the default and highest level of optimizations. + + Option type: unsigned int + + Applies to: compiler only + + + .. autoattribute:: cuda.bindings.runtime.cudaJitOption.cudaJitFallbackStrategy + + + Specifies choice of fallback strategy if matching cubin is not found. Choice is based on supplied :py:obj:`~.cudaJit_Fallback`. Option type: unsigned int for enumerated type :py:obj:`~.cudaJit_Fallback` + + Applies to: compiler only + + + .. autoattribute:: cuda.bindings.runtime.cudaJitOption.cudaJitGenerateDebugInfo + + + Specifies whether to create debug information in output (-g) (0: false, default) + + Option type: int + + Applies to: compiler and linker + + + .. autoattribute:: cuda.bindings.runtime.cudaJitOption.cudaJitLogVerbose + + + Generate verbose log messages (0: false, default) + + Option type: int + + Applies to: compiler and linker + + + .. autoattribute:: cuda.bindings.runtime.cudaJitOption.cudaJitGenerateLineInfo + + + Generate line number information (-lineinfo) (0: false, default) + + Option type: int + + Applies to: compiler only + + + .. autoattribute:: cuda.bindings.runtime.cudaJitOption.cudaJitCacheMode + + + Specifies whether to enable caching explicitly (-dlcm) + + Choice is based on supplied :py:obj:`~.cudaJit_CacheMode`. + + Option type: unsigned int for enumerated type :py:obj:`~.cudaJit_CacheMode` + + Applies to: compiler only + + + .. autoattribute:: cuda.bindings.runtime.cudaJitOption.cudaJitPositionIndependentCode + + + Generate position independent code (0: false) + + Option type: int + + Applies to: compiler only + + + .. autoattribute:: cuda.bindings.runtime.cudaJitOption.cudaJitMinCtaPerSm + + + This option hints to the JIT compiler the minimum number of CTAs from the kernel’s grid to be mapped to a SM. This option is ignored when used together with :py:obj:`~.cudaJitMaxRegisters` or :py:obj:`~.cudaJitThreadsPerBlock`. Optimizations based on this option need :py:obj:`~.cudaJitMaxThreadsPerBlock` to be specified as well. For kernels already using PTX directive .minnctapersm, this option will be ignored by default. Use :py:obj:`~.cudaJitOverrideDirectiveValues` to let this option take precedence over the PTX directive. Option type: unsigned int + + Applies to: compiler only + + + .. autoattribute:: cuda.bindings.runtime.cudaJitOption.cudaJitMaxThreadsPerBlock + + + Maximum number threads in a thread block, computed as the product of the maximum extent specifed for each dimension of the block. This limit is guaranteed not to be exeeded in any invocation of the kernel. Exceeding the the maximum number of threads results in runtime error or kernel launch failure. For kernels already using PTX directive .maxntid, this option will be ignored by default. Use :py:obj:`~.cudaJitOverrideDirectiveValues` to let this option take precedence over the PTX directive. Option type: int + + Applies to: compiler only + + + .. autoattribute:: cuda.bindings.runtime.cudaJitOption.cudaJitOverrideDirectiveValues + + + This option lets the values specified using :py:obj:`~.cudaJitMaxRegisters`, :py:obj:`~.cudaJitThreadsPerBlock`, :py:obj:`~.cudaJitMaxThreadsPerBlock` and :py:obj:`~.cudaJitMinCtaPerSm` take precedence over any PTX directives. (0: Disable, default; 1: Enable) Option type: int + + Applies to: compiler only + +.. autoclass:: cuda.bindings.runtime.cudaLibraryOption + + .. autoattribute:: cuda.bindings.runtime.cudaLibraryOption.cudaLibraryHostUniversalFunctionAndDataTable + + + .. autoattribute:: cuda.bindings.runtime.cudaLibraryOption.cudaLibraryBinaryIsPreserved + + + Specifes that the argument ``code`` passed to :py:obj:`~.cudaLibraryLoadData()` will be preserved. Specifying this option will let the driver know that ``code`` can be accessed at any point until :py:obj:`~.cudaLibraryUnload()`. The default behavior is for the driver to allocate and maintain its own copy of ``code``. Note that this is only a memory usage optimization hint and the driver can choose to ignore it if required. Specifying this option with :py:obj:`~.cudaLibraryLoadFromFile()` is invalid and will return :py:obj:`~.cudaErrorInvalidValue`. + +.. autoclass:: cuda.bindings.runtime.cudaJit_CacheMode + + .. autoattribute:: cuda.bindings.runtime.cudaJit_CacheMode.cudaJitCacheOptionNone + + + Compile with no -dlcm flag specified + + + .. autoattribute:: cuda.bindings.runtime.cudaJit_CacheMode.cudaJitCacheOptionCG + + + Compile with L1 cache disabled + + + .. autoattribute:: cuda.bindings.runtime.cudaJit_CacheMode.cudaJitCacheOptionCA + + + Compile with L1 cache enabled + +.. autoclass:: cuda.bindings.runtime.cudaJit_Fallback + + .. autoattribute:: cuda.bindings.runtime.cudaJit_Fallback.cudaPreferPtx + + + Prefer to compile ptx if exact binary match not found + + + .. autoattribute:: cuda.bindings.runtime.cudaJit_Fallback.cudaPreferBinary + + + Prefer to fall back to compatible binary code if exact match not found + +.. autoclass:: cuda.bindings.runtime.cudaCGScope + + .. autoattribute:: cuda.bindings.runtime.cudaCGScope.cudaCGScopeInvalid + + + Invalid cooperative group scope + + + .. autoattribute:: cuda.bindings.runtime.cudaCGScope.cudaCGScopeGrid + + + Scope represented by a grid_group + + + .. autoattribute:: cuda.bindings.runtime.cudaCGScope.cudaCGScopeReserved + + + Reserved + +.. autoclass:: cuda.bindings.runtime.cudaKernelFunctionType + + .. autoattribute:: cuda.bindings.runtime.cudaKernelFunctionType.cudaKernelFunctionTypeUnspecified + + + CUDA will attempt to deduce the type of the function handle + + + .. autoattribute:: cuda.bindings.runtime.cudaKernelFunctionType.cudaKernelFunctionTypeDeviceEntry + + + Function handle is a device-entry function pointer(i.e. global function pointer) + + + .. autoattribute:: cuda.bindings.runtime.cudaKernelFunctionType.cudaKernelFunctionTypeKernel + + + Function handle is a :py:obj:`~.cudaKernel_t` + + + .. autoattribute:: cuda.bindings.runtime.cudaKernelFunctionType.cudaKernelFunctionTypeFunction + + + Function handle is a :py:obj:`~.cudaFunction_t` + +.. autoclass:: cuda.bindings.runtime.cudaGraphConditionalHandleFlags + + .. autoattribute:: cuda.bindings.runtime.cudaGraphConditionalHandleFlags.cudaGraphCondAssignDefault + + + Apply default handle value when graph is launched. + +.. autoclass:: cuda.bindings.runtime.cudaGraphConditionalNodeType + + .. autoattribute:: cuda.bindings.runtime.cudaGraphConditionalNodeType.cudaGraphCondTypeIf + + + Conditional 'if/else' Node. Body[0] executed if condition is non-zero. If ``size`` == 2, an optional ELSE graph is created and this is executed if the condition is zero. + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphConditionalNodeType.cudaGraphCondTypeWhile + + + Conditional 'while' Node. Body executed repeatedly while condition value is non-zero. + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphConditionalNodeType.cudaGraphCondTypeSwitch + + + Conditional 'switch' Node. Body[n] is executed once, where 'n' is the value of the condition. If the condition does not match a body index, no body is launched. + +.. autoclass:: cuda.bindings.runtime.cudaGraphNodeType + + .. autoattribute:: cuda.bindings.runtime.cudaGraphNodeType.cudaGraphNodeTypeKernel + + + GPU kernel node + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphNodeType.cudaGraphNodeTypeMemcpy + + + Memcpy node + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphNodeType.cudaGraphNodeTypeMemset + + + Memset node + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphNodeType.cudaGraphNodeTypeHost + + + Host (executable) node + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphNodeType.cudaGraphNodeTypeGraph + + + Node which executes an embedded graph + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphNodeType.cudaGraphNodeTypeEmpty + + + Empty (no-op) node + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphNodeType.cudaGraphNodeTypeWaitEvent + + + External event wait node + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphNodeType.cudaGraphNodeTypeEventRecord + + + External event record node + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphNodeType.cudaGraphNodeTypeExtSemaphoreSignal + + + External semaphore signal node + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphNodeType.cudaGraphNodeTypeExtSemaphoreWait + + + External semaphore wait node + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphNodeType.cudaGraphNodeTypeMemAlloc + + + Memory allocation node + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphNodeType.cudaGraphNodeTypeMemFree + + + Memory free node + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphNodeType.cudaGraphNodeTypeConditional + + + Conditional node May be used to implement a conditional execution path or loop + + inside of a graph. The graph(s) contained within the body of the conditional node + + can be selectively executed or iterated upon based on the value of a conditional + + variable. + + + + Handles must be created in advance of creating the node + + using :py:obj:`~.cudaGraphConditionalHandleCreate`. + + + + The following restrictions apply to graphs which contain conditional nodes: + + The graph cannot be used in a child node. + + Only one instantiation of the graph may exist at any point in time. + + The graph cannot be cloned. + + + + To set the control value, supply a default value when creating the handle and/or + + call :py:obj:`~.cudaGraphSetConditional` from device code. + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphNodeType.cudaGraphNodeTypeReserved16 + + + Reserved. + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphNodeType.cudaGraphNodeTypeCount + +.. autoclass:: cuda.bindings.runtime.cudaGraphChildGraphNodeOwnership + + .. autoattribute:: cuda.bindings.runtime.cudaGraphChildGraphNodeOwnership.cudaGraphChildGraphOwnershipClone + + + Default behavior for a child graph node. Child graph is cloned into the parent and memory allocation/free nodes can't be present in the child graph. + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphChildGraphNodeOwnership.cudaGraphChildGraphOwnershipMove + + + The child graph is moved to the parent. The handle to the child graph is owned by the parent and will be destroyed when the parent is destroyed. + + + + The following restrictions apply to child graphs after they have been moved: Cannot be independently instantiated or destroyed; Cannot be added as a child graph of a separate parent graph; Cannot be used as an argument to cudaGraphExecUpdate; Cannot have additional memory allocation or free nodes added. + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphChildGraphNodeOwnership.cudaGraphChildGraphOwnershipInvalid + + + Invalid ownership flag. Set when params are queried to prevent accidentally reusing the driver-owned graph object + +.. autoclass:: cuda.bindings.runtime.cudaGraphDependencyType + + .. autoattribute:: cuda.bindings.runtime.cudaGraphDependencyType.cudaGraphDependencyTypeDefault + + + This is an ordinary dependency. + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphDependencyType.cudaGraphDependencyTypeProgrammatic + + + This dependency type allows the downstream node to use ``cudaGridDependencySynchronize()``. It may only be used between kernel nodes, and must be used with either the :py:obj:`~.cudaGraphKernelNodePortProgrammatic` or :py:obj:`~.cudaGraphKernelNodePortLaunchCompletion` outgoing port. + +.. autoclass:: cuda.bindings.runtime.cudaGraphExecUpdateResult + + .. autoattribute:: cuda.bindings.runtime.cudaGraphExecUpdateResult.cudaGraphExecUpdateSuccess + + + The update succeeded + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphExecUpdateResult.cudaGraphExecUpdateError + + + The update failed for an unexpected reason which is described in the return value of the function + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphExecUpdateResult.cudaGraphExecUpdateErrorTopologyChanged + + + The update failed because the topology changed + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphExecUpdateResult.cudaGraphExecUpdateErrorNodeTypeChanged + + + The update failed because a node type changed + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphExecUpdateResult.cudaGraphExecUpdateErrorFunctionChanged + + + The update failed because the function of a kernel node changed (CUDA driver < 11.2) + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphExecUpdateResult.cudaGraphExecUpdateErrorParametersChanged + + + The update failed because the parameters changed in a way that is not supported + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphExecUpdateResult.cudaGraphExecUpdateErrorNotSupported + + + The update failed because something about the node is not supported + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphExecUpdateResult.cudaGraphExecUpdateErrorUnsupportedFunctionChange + + + The update failed because the function of a kernel node changed in an unsupported way + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphExecUpdateResult.cudaGraphExecUpdateErrorAttributesChanged + + + The update failed because the node attributes changed in a way that is not supported + +.. autoclass:: cuda.bindings.runtime.cudaGraphInstantiateResult + + .. autoattribute:: cuda.bindings.runtime.cudaGraphInstantiateResult.cudaGraphInstantiateSuccess + + + Instantiation succeeded + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphInstantiateResult.cudaGraphInstantiateError + + + Instantiation failed for an unexpected reason which is described in the return value of the function + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphInstantiateResult.cudaGraphInstantiateInvalidStructure + + + Instantiation failed due to invalid structure, such as cycles + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphInstantiateResult.cudaGraphInstantiateNodeOperationNotSupported + + + Instantiation for device launch failed because the graph contained an unsupported operation + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphInstantiateResult.cudaGraphInstantiateMultipleDevicesNotSupported + + + Instantiation for device launch failed due to the nodes belonging to different contexts + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphInstantiateResult.cudaGraphInstantiateConditionalHandleUnused + + + One or more conditional handles are not associated with conditional nodes + +.. autoclass:: cuda.bindings.runtime.cudaGraphKernelNodeField + + .. autoattribute:: cuda.bindings.runtime.cudaGraphKernelNodeField.cudaGraphKernelNodeFieldInvalid + + + Invalid field + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphKernelNodeField.cudaGraphKernelNodeFieldGridDim + + + Grid dimension update + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphKernelNodeField.cudaGraphKernelNodeFieldParam + + + Kernel parameter update + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphKernelNodeField.cudaGraphKernelNodeFieldEnabled + + + Node enable/disable + +.. autoclass:: cuda.bindings.runtime.cudaGetDriverEntryPointFlags + + .. autoattribute:: cuda.bindings.runtime.cudaGetDriverEntryPointFlags.cudaEnableDefault + + + Default search mode for driver symbols. + + + .. autoattribute:: cuda.bindings.runtime.cudaGetDriverEntryPointFlags.cudaEnableLegacyStream + + + Search for legacy versions of driver symbols. + + + .. autoattribute:: cuda.bindings.runtime.cudaGetDriverEntryPointFlags.cudaEnablePerThreadDefaultStream + + + Search for per-thread versions of driver symbols. + +.. autoclass:: cuda.bindings.runtime.cudaDriverEntryPointQueryResult + + .. autoattribute:: cuda.bindings.runtime.cudaDriverEntryPointQueryResult.cudaDriverEntryPointSuccess + + + Search for symbol found a match + + + .. autoattribute:: cuda.bindings.runtime.cudaDriverEntryPointQueryResult.cudaDriverEntryPointSymbolNotFound + + + Search for symbol was not found + + + .. autoattribute:: cuda.bindings.runtime.cudaDriverEntryPointQueryResult.cudaDriverEntryPointVersionNotSufficent + + + Search for symbol was found but version wasn't great enough + +.. autoclass:: cuda.bindings.runtime.cudaGraphDebugDotFlags + + .. autoattribute:: cuda.bindings.runtime.cudaGraphDebugDotFlags.cudaGraphDebugDotFlagsVerbose + + + Output all debug data as if every debug flag is enabled + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphDebugDotFlags.cudaGraphDebugDotFlagsKernelNodeParams + + + Adds :py:obj:`~.cudaKernelNodeParams` to output + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphDebugDotFlags.cudaGraphDebugDotFlagsMemcpyNodeParams + + + Adds :py:obj:`~.cudaMemcpy3DParms` to output + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphDebugDotFlags.cudaGraphDebugDotFlagsMemsetNodeParams + + + Adds :py:obj:`~.cudaMemsetParams` to output + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphDebugDotFlags.cudaGraphDebugDotFlagsHostNodeParams + + + Adds :py:obj:`~.cudaHostNodeParams` to output + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphDebugDotFlags.cudaGraphDebugDotFlagsEventNodeParams + + + Adds :py:obj:`~.cudaEvent_t` handle from record and wait nodes to output + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphDebugDotFlags.cudaGraphDebugDotFlagsExtSemasSignalNodeParams + + + Adds :py:obj:`~.cudaExternalSemaphoreSignalNodeParams` values to output + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphDebugDotFlags.cudaGraphDebugDotFlagsExtSemasWaitNodeParams + + + Adds :py:obj:`~.cudaExternalSemaphoreWaitNodeParams` to output + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphDebugDotFlags.cudaGraphDebugDotFlagsKernelNodeAttributes + + + Adds cudaKernelNodeAttrID values to output + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphDebugDotFlags.cudaGraphDebugDotFlagsHandles + + + Adds node handles and every kernel function handle to output + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphDebugDotFlags.cudaGraphDebugDotFlagsConditionalNodeParams + + + Adds :py:obj:`~.cudaConditionalNodeParams` to output + +.. autoclass:: cuda.bindings.runtime.cudaGraphInstantiateFlags + + .. autoattribute:: cuda.bindings.runtime.cudaGraphInstantiateFlags.cudaGraphInstantiateFlagAutoFreeOnLaunch + + + Automatically free memory allocated in a graph before relaunching. + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphInstantiateFlags.cudaGraphInstantiateFlagUpload + + + Automatically upload the graph after instantiation. Only supported by + + :py:obj:`~.cudaGraphInstantiateWithParams`. The upload will be performed using the + + stream provided in ``instantiateParams``. + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphInstantiateFlags.cudaGraphInstantiateFlagDeviceLaunch + + + Instantiate the graph to be launchable from the device. This flag can only + + be used on platforms which support unified addressing. This flag cannot be + + used in conjunction with cudaGraphInstantiateFlagAutoFreeOnLaunch. + + + .. autoattribute:: cuda.bindings.runtime.cudaGraphInstantiateFlags.cudaGraphInstantiateFlagUseNodePriority + + + Run the graph using the per-node priority attributes rather than the priority of the stream it is launched into. + +.. autoclass:: cuda.bindings.runtime.cudaLaunchMemSyncDomain + + .. autoattribute:: cuda.bindings.runtime.cudaLaunchMemSyncDomain.cudaLaunchMemSyncDomainDefault + + + Launch kernels in the default domain + + + .. autoattribute:: cuda.bindings.runtime.cudaLaunchMemSyncDomain.cudaLaunchMemSyncDomainRemote + + + Launch kernels in the remote domain + +.. autoclass:: cuda.bindings.runtime.cudaLaunchAttributePortableClusterMode + + .. autoattribute:: cuda.bindings.runtime.cudaLaunchAttributePortableClusterMode.cudaLaunchPortableClusterModeDefault + + + The default to use for allowing non-portable cluster size on launch - uses current function attribute for :py:obj:`~.cudaFuncAttributeNonPortableClusterSizeAllowed` + + + .. autoattribute:: cuda.bindings.runtime.cudaLaunchAttributePortableClusterMode.cudaLaunchPortableClusterModeRequirePortable + + + Specifies that the cluster size requested must be a portable size + + + .. autoattribute:: cuda.bindings.runtime.cudaLaunchAttributePortableClusterMode.cudaLaunchPortableClusterModeAllowNonPortable + + + Specifies that the cluster size requested may be a non-portable size + +.. autoclass:: cuda.bindings.runtime.cudaLaunchAttributeID + + .. autoattribute:: cuda.bindings.runtime.cudaLaunchAttributeID.cudaLaunchAttributeIgnore + + + Ignored entry, for convenient composition + + + .. autoattribute:: cuda.bindings.runtime.cudaLaunchAttributeID.cudaLaunchAttributeAccessPolicyWindow + + + Valid for streams, graph nodes, launches. See :py:obj:`~.cudaLaunchAttributeValue.accessPolicyWindow`. + + + .. autoattribute:: cuda.bindings.runtime.cudaLaunchAttributeID.cudaLaunchAttributeCooperative + + + Valid for graph nodes, launches. See :py:obj:`~.cudaLaunchAttributeValue.cooperative`. + + + .. autoattribute:: cuda.bindings.runtime.cudaLaunchAttributeID.cudaLaunchAttributeSynchronizationPolicy + + + Valid for streams. See :py:obj:`~.cudaLaunchAttributeValue.syncPolicy`. + + + .. autoattribute:: cuda.bindings.runtime.cudaLaunchAttributeID.cudaLaunchAttributeClusterDimension + + + Valid for graph nodes, launches. See :py:obj:`~.cudaLaunchAttributeValue.clusterDim`. + + + .. autoattribute:: cuda.bindings.runtime.cudaLaunchAttributeID.cudaLaunchAttributeClusterSchedulingPolicyPreference + + + Valid for graph nodes, launches. See :py:obj:`~.cudaLaunchAttributeValue.clusterSchedulingPolicyPreference`. + + + .. autoattribute:: cuda.bindings.runtime.cudaLaunchAttributeID.cudaLaunchAttributeProgrammaticStreamSerialization + + + Valid for launches. Setting :py:obj:`~.cudaLaunchAttributeValue.programmaticStreamSerializationAllowed` to non-0 signals that the kernel will use programmatic means to resolve its stream dependency, so that the CUDA runtime should opportunistically allow the grid's execution to overlap with the previous kernel in the stream, if that kernel requests the overlap. The dependent launches can choose to wait on the dependency using the programmatic sync (cudaGridDependencySynchronize() or equivalent PTX instructions). + + + .. autoattribute:: cuda.bindings.runtime.cudaLaunchAttributeID.cudaLaunchAttributeProgrammaticEvent + + + Valid for launches. Set :py:obj:`~.cudaLaunchAttributeValue.programmaticEvent` to record the event. Event recorded through this launch attribute is guaranteed to only trigger after all block in the associated kernel trigger the event. A block can trigger the event programmatically in a future CUDA release. A trigger can also be inserted at the beginning of each block's execution if triggerAtBlockStart is set to non-0. The dependent launches can choose to wait on the dependency using the programmatic sync (cudaGridDependencySynchronize() or equivalent PTX instructions). Note that dependents (including the CPU thread calling :py:obj:`~.cudaEventSynchronize()`) are not guaranteed to observe the release precisely when it is released. For example, :py:obj:`~.cudaEventSynchronize()` may only observe the event trigger long after the associated kernel has completed. This recording type is primarily meant for establishing programmatic dependency between device tasks. Note also this type of dependency allows, but does not guarantee, concurrent execution of tasks. + + The event supplied must not be an interprocess or interop event. The event must disable timing (i.e. must be created with the :py:obj:`~.cudaEventDisableTiming` flag set). + + + .. autoattribute:: cuda.bindings.runtime.cudaLaunchAttributeID.cudaLaunchAttributePriority + + + Valid for streams, graph nodes, launches. See :py:obj:`~.cudaLaunchAttributeValue.priority`. + + + .. autoattribute:: cuda.bindings.runtime.cudaLaunchAttributeID.cudaLaunchAttributeMemSyncDomainMap + + + Valid for streams, graph nodes, launches. See :py:obj:`~.cudaLaunchAttributeValue.memSyncDomainMap`. + + + .. autoattribute:: cuda.bindings.runtime.cudaLaunchAttributeID.cudaLaunchAttributeMemSyncDomain + + + Valid for streams, graph nodes, launches. See :py:obj:`~.cudaLaunchAttributeValue.memSyncDomain`. + + + .. autoattribute:: cuda.bindings.runtime.cudaLaunchAttributeID.cudaLaunchAttributePreferredClusterDimension + + + Valid for graph nodes and launches. Set :py:obj:`~.cudaLaunchAttributeValue.preferredClusterDim` to allow the kernel launch to specify a preferred substitute cluster dimension. Blocks may be grouped according to either the dimensions specified with this attribute (grouped into a "preferred substitute cluster"), or the one specified with :py:obj:`~.cudaLaunchAttributeClusterDimension` attribute (grouped into a "regular cluster"). The cluster dimensions of a "preferred substitute cluster" shall be an integer multiple greater than zero of the regular cluster dimensions. The device will attempt - on a best-effort basis - to group thread blocks into preferred clusters over grouping them into regular clusters. When it deems necessary (primarily when the device temporarily runs out of physical resources to launch the larger preferred clusters), the device may switch to launch the regular clusters instead to attempt to utilize as much of the physical device resources as possible. + + Each type of cluster will have its enumeration / coordinate setup as if the grid consists solely of its type of cluster. For example, if the preferred substitute cluster dimensions double the regular cluster dimensions, there might be simultaneously a regular cluster indexed at (1,0,0), and a preferred cluster indexed at (1,0,0). In this example, the preferred substitute cluster (1,0,0) replaces regular clusters (2,0,0) and (3,0,0) and groups their blocks. + + This attribute will only take effect when a regular cluster dimension has been specified. The preferred substitute cluster dimension must be an integer multiple greater than zero of the regular cluster dimension and must divide the grid. It must also be no more than ``maxBlocksPerCluster``, if it is set in the kernel's ``__launch_bounds__``. Otherwise it must be less than the maximum value the driver can support. Otherwise, setting this attribute to a value physically unable to fit on any particular device is permitted. + + + .. autoattribute:: cuda.bindings.runtime.cudaLaunchAttributeID.cudaLaunchAttributeLaunchCompletionEvent + + + Valid for launches. Set :py:obj:`~.cudaLaunchAttributeValue.launchCompletionEvent` to record the event. + + Nominally, the event is triggered once all blocks of the kernel have begun execution. Currently this is a best effort. If a kernel B has a launch completion dependency on a kernel A, B may wait until A is complete. Alternatively, blocks of B may begin before all blocks of A have begun, for example if B can claim execution resources unavailable to A (e.g. they run on different GPUs) or if B is a higher priority than A. Exercise caution if such an ordering inversion could lead to deadlock. + + A launch completion event is nominally similar to a programmatic event with ``triggerAtBlockStart`` set except that it is not visible to ``cudaGridDependencySynchronize()`` and can be used with compute capability less than 9.0. + + The event supplied must not be an interprocess or interop event. The event must disable timing (i.e. must be created with the :py:obj:`~.cudaEventDisableTiming` flag set). + + + .. autoattribute:: cuda.bindings.runtime.cudaLaunchAttributeID.cudaLaunchAttributeDeviceUpdatableKernelNode + + + Valid for graph nodes, launches. This attribute is graphs-only, and passing it to a launch in a non-capturing stream will result in an error. + + :cudaLaunchAttributeValue::deviceUpdatableKernelNode::deviceUpdatable can only be set to 0 or 1. Setting the field to 1 indicates that the corresponding kernel node should be device-updatable. On success, a handle will be returned via :py:obj:`~.cudaLaunchAttributeValue.deviceUpdatableKernelNode.devNode` which can be passed to the various device-side update functions to update the node's kernel parameters from within another kernel. For more information on the types of device updates that can be made, as well as the relevant limitations thereof, see :py:obj:`~.cudaGraphKernelNodeUpdatesApply`. + + Nodes which are device-updatable have additional restrictions compared to regular kernel nodes. Firstly, device-updatable nodes cannot be removed from their graph via :py:obj:`~.cudaGraphDestroyNode`. Additionally, once opted-in to this functionality, a node cannot opt out, and any attempt to set the deviceUpdatable attribute to 0 will result in an error. Device-updatable kernel nodes also cannot have their attributes copied to/from another kernel node via :py:obj:`~.cudaGraphKernelNodeCopyAttributes`. Graphs containing one or more device-updatable nodes also do not allow multiple instantiation, and neither the graph nor its instantiated version can be passed to :py:obj:`~.cudaGraphExecUpdate`. + + If a graph contains device-updatable nodes and updates those nodes from the device from within the graph, the graph must be uploaded with :py:obj:`~.cuGraphUpload` before it is launched. For such a graph, if host-side executable graph updates are made to the device-updatable nodes, the graph must be uploaded before it is launched again. + + + .. autoattribute:: cuda.bindings.runtime.cudaLaunchAttributeID.cudaLaunchAttributePreferredSharedMemoryCarveout + + + Valid for launches. On devices where the L1 cache and shared memory use the same hardware resources, setting :py:obj:`~.cudaLaunchAttributeValue.sharedMemCarveout` to a percentage between 0-100 signals sets the shared memory carveout preference in percent of the total shared memory for that kernel launch. This attribute takes precedence over :py:obj:`~.cudaFuncAttributePreferredSharedMemoryCarveout`. This is only a hint, and the driver can choose a different configuration if required for the launch. + + + .. autoattribute:: cuda.bindings.runtime.cudaLaunchAttributeID.cudaLaunchAttributeNvlinkUtilCentricScheduling + + + Valid for streams, graph nodes, launches. This attribute is a hint to the CUDA runtime that the launch should attempt to make the kernel maximize its NVLINK utilization. + + + + When possible to honor this hint, CUDA will assume each block in the grid launch will carry out an even amount of NVLINK traffic, and make a best-effort attempt to adjust the kernel launch based on that assumption. + + This attribute is a hint only. CUDA makes no functional or performance guarantee. Its applicability can be affected by many different factors, including driver version (i.e. CUDA doesn't guarantee the performance characteristics will be maintained between driver versions or a driver update could alter or regress previously observed perf characteristics.) It also doesn't guarantee a successful result, i.e. applying the attribute may not improve the performance of either the targeted kernel or the encapsulating application. + + Valid values for :py:obj:`~.cudaLaunchAttributeValue.nvlinkUtilCentricScheduling` are 0 (disabled) and 1 (enabled). + + + .. autoattribute:: cuda.bindings.runtime.cudaLaunchAttributeID.cudaLaunchAttributePortableClusterSizeMode + + + Valid for graph nodes, launches. This indicates whether the kernel launch is allowed to use a non-portable cluster size. Valid values for :py:obj:`~.cudaLaunchAttributeValue.portableClusterSizeMode` are values for :py:obj:`~.cudaLaunchAttributePortableClusterMode` Any other value will return :py:obj:`~.cudaErrorInvalidValue` + + + .. autoattribute:: cuda.bindings.runtime.cudaLaunchAttributeID.cudaLaunchAttributeSharedMemoryMode + + + Valid for graph nodes, launches. This indicates that the kernel launch is allowed to use a non-portable shared memory mode. + +.. autoclass:: cuda.bindings.runtime.cudaDeviceNumaConfig + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceNumaConfig.cudaDeviceNumaConfigNone + + + The GPU is not a NUMA node + + + .. autoattribute:: cuda.bindings.runtime.cudaDeviceNumaConfig.cudaDeviceNumaConfigNumaNode + + + The GPU is a NUMA node, cudaDevAttrNumaId contains its NUMA ID + +.. autoclass:: cuda.bindings.runtime.cudaAsyncNotificationType + + .. autoattribute:: cuda.bindings.runtime.cudaAsyncNotificationType.cudaAsyncNotificationTypeOverBudget + + + Sent when the process has exceeded its device memory budget + +.. autoclass:: cuda.bindings.runtime.cudaLogLevel + + .. autoattribute:: cuda.bindings.runtime.cudaLogLevel.cudaLogLevelError + + + .. autoattribute:: cuda.bindings.runtime.cudaLogLevel.cudaLogLevelWarning + +.. autoclass:: cuda.bindings.runtime.cudaFabricOpStatusSource + + .. autoattribute:: cuda.bindings.runtime.cudaFabricOpStatusSource.cudaFabricOpStatusSourceMbarrierV1 + + + 1B-aligned 1B-wide status from an mbarrier.layout::v1 + + + .. autoattribute:: cuda.bindings.runtime.cudaFabricOpStatusSource.cudaFabricOpStatusSourceMax + +.. autoclass:: cuda.bindings.runtime.cudaFabricOpStatusInfo + + .. autoattribute:: cuda.bindings.runtime.cudaFabricOpStatusInfo.cudaFabricOpStatusInfoSuccess + + + .. autoattribute:: cuda.bindings.runtime.cudaFabricOpStatusInfo.cudaFabricOpStatusInfoLast + + + .. autoattribute:: cuda.bindings.runtime.cudaFabricOpStatusInfo.cudaFabricOpStatusInfoMax + +.. autoclass:: cuda.bindings.runtime.cudaSurfaceBoundaryMode + + .. autoattribute:: cuda.bindings.runtime.cudaSurfaceBoundaryMode.cudaBoundaryModeZero + + + Zero boundary mode + + + .. autoattribute:: cuda.bindings.runtime.cudaSurfaceBoundaryMode.cudaBoundaryModeClamp + + + Clamp boundary mode + + + .. autoattribute:: cuda.bindings.runtime.cudaSurfaceBoundaryMode.cudaBoundaryModeTrap + + + Trap boundary mode + +.. autoclass:: cuda.bindings.runtime.cudaSurfaceFormatMode + + .. autoattribute:: cuda.bindings.runtime.cudaSurfaceFormatMode.cudaFormatModeForced + + + Forced format mode + + + .. autoattribute:: cuda.bindings.runtime.cudaSurfaceFormatMode.cudaFormatModeAuto + + + Auto format mode + +.. autoclass:: cuda.bindings.runtime.cudaTextureAddressMode + + .. autoattribute:: cuda.bindings.runtime.cudaTextureAddressMode.cudaAddressModeWrap + + + Wrapping address mode + + + .. autoattribute:: cuda.bindings.runtime.cudaTextureAddressMode.cudaAddressModeClamp + + + Clamp to edge address mode + + + .. autoattribute:: cuda.bindings.runtime.cudaTextureAddressMode.cudaAddressModeMirror + + + Mirror address mode + + + .. autoattribute:: cuda.bindings.runtime.cudaTextureAddressMode.cudaAddressModeBorder + + + Border address mode + +.. autoclass:: cuda.bindings.runtime.cudaTextureFilterMode + + .. autoattribute:: cuda.bindings.runtime.cudaTextureFilterMode.cudaFilterModePoint + + + Point filter mode + + + .. autoattribute:: cuda.bindings.runtime.cudaTextureFilterMode.cudaFilterModeLinear + + + Linear filter mode + +.. autoclass:: cuda.bindings.runtime.cudaTextureReadMode + + .. autoattribute:: cuda.bindings.runtime.cudaTextureReadMode.cudaReadModeElementType + + + Read texture as specified element type + + + .. autoattribute:: cuda.bindings.runtime.cudaTextureReadMode.cudaReadModeNormalizedFloat + + + Read texture as normalized float + +.. autoclass:: cuda.bindings.runtime.cudaEglFrameType + + .. autoattribute:: cuda.bindings.runtime.cudaEglFrameType.cudaEglFrameTypeArray + + + Frame type CUDA array + + + .. autoattribute:: cuda.bindings.runtime.cudaEglFrameType.cudaEglFrameTypePitch + + + Frame type CUDA pointer + +.. autoclass:: cuda.bindings.runtime.cudaEglResourceLocationFlags + + .. autoattribute:: cuda.bindings.runtime.cudaEglResourceLocationFlags.cudaEglResourceLocationSysmem + + + Resource location sysmem + + + .. autoattribute:: cuda.bindings.runtime.cudaEglResourceLocationFlags.cudaEglResourceLocationVidmem + + + Resource location vidmem + +.. autoclass:: cuda.bindings.runtime.cudaEglColorFormat + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatYUV420Planar + + + Y, U, V in three surfaces, each in a separate surface, U/V width = 1/2 Y width, U/V height = 1/2 Y height. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatYUV420SemiPlanar + + + Y, UV in two surfaces (UV as one surface) with VU byte ordering, width, height ratio same as YUV420Planar. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatYUV422Planar + + + Y, U, V each in a separate surface, U/V width = 1/2 Y width, U/V height = Y height. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatYUV422SemiPlanar + + + Y, UV in two surfaces with VU byte ordering, width, height ratio same as YUV422Planar. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatARGB + + + R/G/B/A four channels in one surface with BGRA byte ordering. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatRGBA + + + R/G/B/A four channels in one surface with ABGR byte ordering. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatL + + + single luminance channel in one surface. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatR + + + single color channel in one surface. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatYUV444Planar + + + Y, U, V in three surfaces, each in a separate surface, U/V width = Y width, U/V height = Y height. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatYUV444SemiPlanar + + + Y, UV in two surfaces (UV as one surface) with VU byte ordering, width, height ratio same as YUV444Planar. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatYUYV422 + + + Y, U, V in one surface, interleaved as UYVY in one channel. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatUYVY422 + + + Y, U, V in one surface, interleaved as YUYV in one channel. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatABGR + + + R/G/B/A four channels in one surface with RGBA byte ordering. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatBGRA + + + R/G/B/A four channels in one surface with ARGB byte ordering. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatA + + + Alpha color format - one channel in one surface. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatRG + + + R/G color format - two channels in one surface with GR byte ordering + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatAYUV + + + Y, U, V, A four channels in one surface, interleaved as VUYA. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatYVU444SemiPlanar + + + Y, VU in two surfaces (VU as one surface) with UV byte ordering, U/V width = Y width, U/V height = Y height. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatYVU422SemiPlanar + + + Y, VU in two surfaces (VU as one surface) with UV byte ordering, U/V width = 1/2 Y width, U/V height = Y height. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatYVU420SemiPlanar + + + Y, VU in two surfaces (VU as one surface) with UV byte ordering, U/V width = 1/2 Y width, U/V height = 1/2 Y height. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatY10V10U10_444SemiPlanar + + + Y10, V10U10 in two surfaces (VU as one surface) with UV byte ordering, U/V width = Y width, U/V height = Y height. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatY10V10U10_420SemiPlanar + + + Y10, V10U10 in two surfaces (VU as one surface) with UV byte ordering, U/V width = 1/2 Y width, U/V height = 1/2 Y height. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatY12V12U12_444SemiPlanar + + + Y12, V12U12 in two surfaces (VU as one surface) with UV byte ordering, U/V width = Y width, U/V height = Y height. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatY12V12U12_420SemiPlanar + + + Y12, V12U12 in two surfaces (VU as one surface) with UV byte ordering, U/V width = 1/2 Y width, U/V height = 1/2 Y height. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatVYUY_ER + + + Extended Range Y, U, V in one surface, interleaved as YVYU in one channel. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatUYVY_ER + + + Extended Range Y, U, V in one surface, interleaved as YUYV in one channel. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatYUYV_ER + + + Extended Range Y, U, V in one surface, interleaved as UYVY in one channel. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatYVYU_ER + + + Extended Range Y, U, V in one surface, interleaved as VYUY in one channel. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatYUVA_ER + + + Extended Range Y, U, V, A four channels in one surface, interleaved as AVUY. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatAYUV_ER + + + Extended Range Y, U, V, A four channels in one surface, interleaved as VUYA. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatYUV444Planar_ER + + + Extended Range Y, U, V in three surfaces, U/V width = Y width, U/V height = Y height. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatYUV422Planar_ER + + + Extended Range Y, U, V in three surfaces, U/V width = 1/2 Y width, U/V height = Y height. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatYUV420Planar_ER + + + Extended Range Y, U, V in three surfaces, U/V width = 1/2 Y width, U/V height = 1/2 Y height. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatYUV444SemiPlanar_ER + + + Extended Range Y, UV in two surfaces (UV as one surface) with VU byte ordering, U/V width = Y width, U/V height = Y height. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatYUV422SemiPlanar_ER + + + Extended Range Y, UV in two surfaces (UV as one surface) with VU byte ordering, U/V width = 1/2 Y width, U/V height = Y height. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatYUV420SemiPlanar_ER + + + Extended Range Y, UV in two surfaces (UV as one surface) with VU byte ordering, U/V width = 1/2 Y width, U/V height = 1/2 Y height. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatYVU444Planar_ER + + + Extended Range Y, V, U in three surfaces, U/V width = Y width, U/V height = Y height. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatYVU422Planar_ER + + + Extended Range Y, V, U in three surfaces, U/V width = 1/2 Y width, U/V height = Y height. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatYVU420Planar_ER + + + Extended Range Y, V, U in three surfaces, U/V width = 1/2 Y width, U/V height = 1/2 Y height. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatYVU444SemiPlanar_ER + + + Extended Range Y, VU in two surfaces (VU as one surface) with UV byte ordering, U/V width = Y width, U/V height = Y height. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatYVU422SemiPlanar_ER + + + Extended Range Y, VU in two surfaces (VU as one surface) with UV byte ordering, U/V width = 1/2 Y width, U/V height = Y height. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatYVU420SemiPlanar_ER + + + Extended Range Y, VU in two surfaces (VU as one surface) with UV byte ordering, U/V width = 1/2 Y width, U/V height = 1/2 Y height. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatBayerRGGB + + + Bayer format - one channel in one surface with interleaved RGGB ordering. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatBayerBGGR + + + Bayer format - one channel in one surface with interleaved BGGR ordering. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatBayerGRBG + + + Bayer format - one channel in one surface with interleaved GRBG ordering. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatBayerGBRG + + + Bayer format - one channel in one surface with interleaved GBRG ordering. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatBayer10RGGB + + + Bayer10 format - one channel in one surface with interleaved RGGB ordering. Out of 16 bits, 10 bits used 6 bits No-op. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatBayer10BGGR + + + Bayer10 format - one channel in one surface with interleaved BGGR ordering. Out of 16 bits, 10 bits used 6 bits No-op. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatBayer10GRBG + + + Bayer10 format - one channel in one surface with interleaved GRBG ordering. Out of 16 bits, 10 bits used 6 bits No-op. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatBayer10GBRG + + + Bayer10 format - one channel in one surface with interleaved GBRG ordering. Out of 16 bits, 10 bits used 6 bits No-op. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatBayer12RGGB + + + Bayer12 format - one channel in one surface with interleaved RGGB ordering. Out of 16 bits, 12 bits used 4 bits No-op. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatBayer12BGGR + + + Bayer12 format - one channel in one surface with interleaved BGGR ordering. Out of 16 bits, 12 bits used 4 bits No-op. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatBayer12GRBG + + + Bayer12 format - one channel in one surface with interleaved GRBG ordering. Out of 16 bits, 12 bits used 4 bits No-op. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatBayer12GBRG + + + Bayer12 format - one channel in one surface with interleaved GBRG ordering. Out of 16 bits, 12 bits used 4 bits No-op. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatBayer14RGGB + + + Bayer14 format - one channel in one surface with interleaved RGGB ordering. Out of 16 bits, 14 bits used 2 bits No-op. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatBayer14BGGR + + + Bayer14 format - one channel in one surface with interleaved BGGR ordering. Out of 16 bits, 14 bits used 2 bits No-op. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatBayer14GRBG + + + Bayer14 format - one channel in one surface with interleaved GRBG ordering. Out of 16 bits, 14 bits used 2 bits No-op. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatBayer14GBRG + + + Bayer14 format - one channel in one surface with interleaved GBRG ordering. Out of 16 bits, 14 bits used 2 bits No-op. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatBayer20RGGB + + + Bayer20 format - one channel in one surface with interleaved RGGB ordering. Out of 32 bits, 20 bits used 12 bits No-op. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatBayer20BGGR + + + Bayer20 format - one channel in one surface with interleaved BGGR ordering. Out of 32 bits, 20 bits used 12 bits No-op. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatBayer20GRBG + + + Bayer20 format - one channel in one surface with interleaved GRBG ordering. Out of 32 bits, 20 bits used 12 bits No-op. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatBayer20GBRG + + + Bayer20 format - one channel in one surface with interleaved GBRG ordering. Out of 32 bits, 20 bits used 12 bits No-op. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatYVU444Planar + + + Y, V, U in three surfaces, each in a separate surface, U/V width = Y width, U/V height = Y height. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatYVU422Planar + + + Y, V, U in three surfaces, each in a separate surface, U/V width = 1/2 Y width, U/V height = Y height. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatYVU420Planar + + + Y, V, U in three surfaces, each in a separate surface, U/V width = 1/2 Y width, U/V height = 1/2 Y height. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatBayerIspRGGB + + + Nvidia proprietary Bayer ISP format - one channel in one surface with interleaved RGGB ordering and mapped to opaque integer datatype. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatBayerIspBGGR + + + Nvidia proprietary Bayer ISP format - one channel in one surface with interleaved BGGR ordering and mapped to opaque integer datatype. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatBayerIspGRBG + + + Nvidia proprietary Bayer ISP format - one channel in one surface with interleaved GRBG ordering and mapped to opaque integer datatype. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatBayerIspGBRG + + + Nvidia proprietary Bayer ISP format - one channel in one surface with interleaved GBRG ordering and mapped to opaque integer datatype. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatBayerBCCR + + + Bayer format - one channel in one surface with interleaved BCCR ordering. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatBayerRCCB + + + Bayer format - one channel in one surface with interleaved RCCB ordering. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatBayerCRBC + + + Bayer format - one channel in one surface with interleaved CRBC ordering. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatBayerCBRC + + + Bayer format - one channel in one surface with interleaved CBRC ordering. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatBayer10CCCC + + + Bayer10 format - one channel in one surface with interleaved CCCC ordering. Out of 16 bits, 10 bits used 6 bits No-op. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatBayer12BCCR + + + Bayer12 format - one channel in one surface with interleaved BCCR ordering. Out of 16 bits, 12 bits used 4 bits No-op. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatBayer12RCCB + + + Bayer12 format - one channel in one surface with interleaved RCCB ordering. Out of 16 bits, 12 bits used 4 bits No-op. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatBayer12CRBC + + + Bayer12 format - one channel in one surface with interleaved CRBC ordering. Out of 16 bits, 12 bits used 4 bits No-op. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatBayer12CBRC + + + Bayer12 format - one channel in one surface with interleaved CBRC ordering. Out of 16 bits, 12 bits used 4 bits No-op. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatBayer12CCCC + + + Bayer12 format - one channel in one surface with interleaved CCCC ordering. Out of 16 bits, 12 bits used 4 bits No-op. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatY + + + Color format for single Y plane. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatYUV420SemiPlanar_2020 + + + Y, UV in two surfaces (UV as one surface) U/V width = 1/2 Y width, U/V height = 1/2 Y height. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatYVU420SemiPlanar_2020 + + + Y, VU in two surfaces (VU as one surface) U/V width = 1/2 Y width, U/V height = 1/2 Y height. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatYUV420Planar_2020 + + + Y, U, V in three surfaces, each in a separate surface, U/V width = 1/2 Y width, U/V height = 1/2 Y height. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatYVU420Planar_2020 + + + Y, V, U in three surfaces, each in a separate surface, U/V width = 1/2 Y width, U/V height = 1/2 Y height. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatYUV420SemiPlanar_709 + + + Y, UV in two surfaces (UV as one surface) U/V width = 1/2 Y width, U/V height = 1/2 Y height. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatYVU420SemiPlanar_709 + + + Y, VU in two surfaces (VU as one surface) U/V width = 1/2 Y width, U/V height = 1/2 Y height. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatYUV420Planar_709 + + + Y, U, V in three surfaces, each in a separate surface, U/V width = 1/2 Y width, U/V height = 1/2 Y height. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatYVU420Planar_709 + + + Y, V, U in three surfaces, each in a separate surface, U/V width = 1/2 Y width, U/V height = 1/2 Y height. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatY10V10U10_420SemiPlanar_709 + + + Y10, V10U10 in two surfaces (VU as one surface) U/V width = 1/2 Y width, U/V height = 1/2 Y height. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatY10V10U10_420SemiPlanar_2020 + + + Y10, V10U10 in two surfaces (VU as one surface) U/V width = 1/2 Y width, U/V height = 1/2 Y height. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatY10V10U10_422SemiPlanar_2020 + + + Y10, V10U10 in two surfaces (VU as one surface) U/V width = 1/2 Y width, U/V height = Y height. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatY10V10U10_422SemiPlanar + + + Y10, V10U10 in two surfaces (VU as one surface) U/V width = 1/2 Y width, U/V height = Y height. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatY10V10U10_422SemiPlanar_709 + + + Y10, V10U10 in two surfaces (VU as one surface) U/V width = 1/2 Y width, U/V height = Y height. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatY_ER + + + Extended Range Color format for single Y plane. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatY_709_ER + + + Extended Range Color format for single Y plane. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatY10_ER + + + Extended Range Color format for single Y10 plane. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatY10_709_ER + + + Extended Range Color format for single Y10 plane. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatY12_ER + + + Extended Range Color format for single Y12 plane. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatY12_709_ER + + + Extended Range Color format for single Y12 plane. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatYUVA + + + Y, U, V, A four channels in one surface, interleaved as AVUY. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatYVYU + + + Y, U, V in one surface, interleaved as YVYU in one channel. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatVYUY + + + Y, U, V in one surface, interleaved as VYUY in one channel. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatY10V10U10_420SemiPlanar_ER + + + Extended Range Y10, V10U10 in two surfaces (VU as one surface) U/V width = 1/2 Y width, U/V height = 1/2 Y height. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatY10V10U10_420SemiPlanar_709_ER + + + Extended Range Y10, V10U10 in two surfaces (VU as one surface) U/V width = 1/2 Y width, U/V height = 1/2 Y height. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatY10V10U10_444SemiPlanar_ER + + + Extended Range Y10, V10U10 in two surfaces (VU as one surface) U/V width = Y width, U/V height = Y height. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatY10V10U10_444SemiPlanar_709_ER + + + Extended Range Y10, V10U10 in two surfaces (VU as one surface) U/V width = Y width, U/V height = Y height. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatY12V12U12_420SemiPlanar_ER + + + Extended Range Y12, V12U12 in two surfaces (VU as one surface) U/V width = 1/2 Y width, U/V height = 1/2 Y height. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatY12V12U12_420SemiPlanar_709_ER + + + Extended Range Y12, V12U12 in two surfaces (VU as one surface) U/V width = 1/2 Y width, U/V height = 1/2 Y height. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatY12V12U12_444SemiPlanar_ER + + + Extended Range Y12, V12U12 in two surfaces (VU as one surface) U/V width = Y width, U/V height = Y height. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatY12V12U12_444SemiPlanar_709_ER + + + Extended Range Y12, V12U12 in two surfaces (VU as one surface) U/V width = Y width, U/V height = Y height. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatUYVY709 + + + Y, U, V in one surface, interleaved as UYVY in one channel. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatUYVY709_ER + + + Extended Range Y, U, V in one surface, interleaved as UYVY in one channel. + + + .. autoattribute:: cuda.bindings.runtime.cudaEglColorFormat.cudaEglColorFormatUYVY2020 + + + Y, U, V in one surface, interleaved as UYVY in one channel. + +.. autoclass:: cuda.bindings.runtime.cudaDevResourceDesc_t +.. autoclass:: cuda.bindings.runtime.cudaExecutionContext_t +.. autoclass:: cuda.bindings.runtime.cudaArray_t +.. autoclass:: cuda.bindings.runtime.cudaArray_const_t +.. autoclass:: cuda.bindings.runtime.cudaMipmappedArray_t +.. autoclass:: cuda.bindings.runtime.cudaMipmappedArray_const_t +.. autoclass:: cuda.bindings.runtime.cudaHostFn_t +.. autoclass:: cuda.bindings.runtime.CUuuid +.. autoclass:: cuda.bindings.runtime.cudaUUID_t +.. autoclass:: cuda.bindings.runtime.cudaIpcEventHandle_t +.. autoclass:: cuda.bindings.runtime.cudaIpcMemHandle_t +.. autoclass:: cuda.bindings.runtime.cudaMemFabricHandle_t +.. autoclass:: cuda.bindings.runtime.cudaDevSmResourceGroupParams +.. autoclass:: cuda.bindings.runtime.cudaDevResource +.. autoclass:: cuda.bindings.runtime.cudaStream_t +.. autoclass:: cuda.bindings.runtime.cudaEvent_t +.. autoclass:: cuda.bindings.runtime.cudaGraphicsResource_t +.. autoclass:: cuda.bindings.runtime.cudaExternalMemory_t +.. autoclass:: cuda.bindings.runtime.cudaExternalSemaphore_t +.. autoclass:: cuda.bindings.runtime.cudaGraph_t +.. autoclass:: cuda.bindings.runtime.cudaGraphNode_t +.. autoclass:: cuda.bindings.runtime.cudaUserObject_t +.. autoclass:: cuda.bindings.runtime.cudaGraphConditionalHandle +.. autoclass:: cuda.bindings.runtime.cudaFunction_t +.. autoclass:: cuda.bindings.runtime.cudaKernel_t +.. autoclass:: cuda.bindings.runtime.cudaLibrary_t +.. autoclass:: cuda.bindings.runtime.cudaMemPool_t +.. autoclass:: cuda.bindings.runtime.cudaGraphEdgeData +.. autoclass:: cuda.bindings.runtime.cudaGraphExec_t +.. autoclass:: cuda.bindings.runtime.cudaGraphInstantiateParams +.. autoclass:: cuda.bindings.runtime.cudaGraphExecUpdateResultInfo +.. autoclass:: cuda.bindings.runtime.cudaGraphDeviceNode_t +.. autoclass:: cuda.bindings.runtime.cudaLaunchMemSyncDomainMap +.. autoclass:: cuda.bindings.runtime.cudaLaunchAttributeValue +.. autoclass:: cuda.bindings.runtime.cudaLaunchAttribute +.. autoclass:: cuda.bindings.runtime.cudaAsyncCallbackHandle_t +.. autoclass:: cuda.bindings.runtime.cudaAsyncNotificationInfo_t +.. autoclass:: cuda.bindings.runtime.cudaAsyncCallback +.. autoclass:: cuda.bindings.runtime.cudaLogsCallbackHandle +.. autoclass:: cuda.bindings.runtime.cudaLogIterator +.. autoclass:: cuda.bindings.runtime.cudaSurfaceObject_t +.. autoclass:: cuda.bindings.runtime.cudaTextureObject_t +.. autoclass:: cuda.bindings.runtime.cudaEglPlaneDesc +.. autoclass:: cuda.bindings.runtime.cudaEglFrame +.. autoclass:: cuda.bindings.runtime.cudaEglStreamConnection +.. autoattribute:: cuda.bindings.runtime.cudaHostAllocDefault + + Default page-locked allocation flag + +.. autoattribute:: cuda.bindings.runtime.cudaHostAllocPortable + + Pinned memory accessible by all CUDA contexts + +.. autoattribute:: cuda.bindings.runtime.cudaHostAllocMapped + + Map allocation into device space + +.. autoattribute:: cuda.bindings.runtime.cudaHostAllocWriteCombined + + Write-combined memory + +.. autoattribute:: cuda.bindings.runtime.cudaHostRegisterDefault + + Default host memory registration flag + +.. autoattribute:: cuda.bindings.runtime.cudaHostRegisterPortable + + Pinned memory accessible by all CUDA contexts + +.. autoattribute:: cuda.bindings.runtime.cudaHostRegisterMapped + + Map registered memory into device space + +.. autoattribute:: cuda.bindings.runtime.cudaHostRegisterIoMemory + + Memory-mapped I/O space + +.. autoattribute:: cuda.bindings.runtime.cudaHostRegisterReadOnly + + Memory-mapped read-only + +.. autoattribute:: cuda.bindings.runtime.cudaPeerAccessDefault + + Default peer addressing enable flag + +.. autoattribute:: cuda.bindings.runtime.cudaStreamDefault + + Default stream flag + +.. autoattribute:: cuda.bindings.runtime.cudaStreamNonBlocking + + Stream does not synchronize with stream 0 (the NULL stream) + +.. autoattribute:: cuda.bindings.runtime.cudaStreamLegacy + + Legacy stream handle + + + + Stream handle that can be passed as a :py:obj:`~.cudaStream_t` to use an implicit stream with legacy synchronization behavior. + + + + See details of the \link_sync_behavior + +.. autoattribute:: cuda.bindings.runtime.cudaStreamPerThread + + Per-thread stream handle + + + + Stream handle that can be passed as a :py:obj:`~.cudaStream_t` to use an implicit stream with per-thread synchronization behavior. + + + + See details of the \link_sync_behavior + +.. autoattribute:: cuda.bindings.runtime.cudaEventDefault + + Default event flag + +.. autoattribute:: cuda.bindings.runtime.cudaEventBlockingSync + + Event uses blocking synchronization + +.. autoattribute:: cuda.bindings.runtime.cudaEventDisableTiming + + Event will not record timing data + +.. autoattribute:: cuda.bindings.runtime.cudaEventInterprocess + + Event is suitable for interprocess use. cudaEventDisableTiming must be set + +.. autoattribute:: cuda.bindings.runtime.cudaEventRecordDefault + + Default event record flag + +.. autoattribute:: cuda.bindings.runtime.cudaEventRecordExternal + + Event is captured in the graph as an external event node when performing stream capture + +.. autoattribute:: cuda.bindings.runtime.cudaEventWaitDefault + + Default event wait flag + +.. autoattribute:: cuda.bindings.runtime.cudaEventWaitExternal + + Event is captured in the graph as an external event node when performing stream capture + +.. autoattribute:: cuda.bindings.runtime.cudaDeviceScheduleAuto + + Device flag - Automatic scheduling + +.. autoattribute:: cuda.bindings.runtime.cudaDeviceScheduleSpin + + Device flag - Spin default scheduling + +.. autoattribute:: cuda.bindings.runtime.cudaDeviceScheduleYield + + Device flag - Yield default scheduling + +.. autoattribute:: cuda.bindings.runtime.cudaDeviceScheduleBlockingSync + + Device flag - Use blocking synchronization + +.. autoattribute:: cuda.bindings.runtime.cudaDeviceBlockingSync + + Device flag - Use blocking synchronization + + [Deprecated] + +.. autoattribute:: cuda.bindings.runtime.cudaDeviceScheduleMask + + Device schedule flags mask + +.. autoattribute:: cuda.bindings.runtime.cudaDeviceMapHost + + Device flag - Support mapped pinned allocations + +.. autoattribute:: cuda.bindings.runtime.cudaDeviceLmemResizeToMax + + Device flag - Keep local memory allocation after launch + +.. autoattribute:: cuda.bindings.runtime.cudaDeviceSyncMemops + + Device flag - Ensure synchronous memory operations on this context will synchronize + +.. autoattribute:: cuda.bindings.runtime.cudaDeviceMask + + Device flags mask + +.. autoattribute:: cuda.bindings.runtime.cudaArrayDefault + + Default CUDA array allocation flag + +.. autoattribute:: cuda.bindings.runtime.cudaArrayLayered + + Must be set in cudaMalloc3DArray to create a layered CUDA array + +.. autoattribute:: cuda.bindings.runtime.cudaArraySurfaceLoadStore + + Must be set in cudaMallocArray or cudaMalloc3DArray in order to bind surfaces to the CUDA array + +.. autoattribute:: cuda.bindings.runtime.cudaArrayCubemap + + Must be set in cudaMalloc3DArray to create a cubemap CUDA array + +.. autoattribute:: cuda.bindings.runtime.cudaArrayTextureGather + + Must be set in cudaMallocArray or cudaMalloc3DArray in order to perform texture gather operations on the CUDA array + +.. autoattribute:: cuda.bindings.runtime.cudaArrayColorAttachment + + Must be set in cudaExternalMemoryGetMappedMipmappedArray if the mipmapped array is used as a color target in a graphics API + +.. autoattribute:: cuda.bindings.runtime.cudaArraySparse + + Must be set in cudaMallocArray, cudaMalloc3DArray or cudaMallocMipmappedArray in order to create a sparse CUDA array or CUDA mipmapped array + +.. autoattribute:: cuda.bindings.runtime.cudaArrayDeferredMapping + + Must be set in cudaMallocArray, cudaMalloc3DArray or cudaMallocMipmappedArray in order to create a deferred mapping CUDA array or CUDA mipmapped array + +.. autoattribute:: cuda.bindings.runtime.cudaIpcMemLazyEnablePeerAccess + + Automatically enable peer access between remote devices as needed + +.. autoattribute:: cuda.bindings.runtime.cudaMemAttachGlobal + + Memory can be accessed by any stream on any device + +.. autoattribute:: cuda.bindings.runtime.cudaMemAttachHost + + Memory cannot be accessed by any stream on any device + +.. autoattribute:: cuda.bindings.runtime.cudaMemAttachSingle + + Memory can only be accessed by a single stream on the associated device + +.. autoattribute:: cuda.bindings.runtime.cudaOccupancyDefault + + Default behavior + +.. autoattribute:: cuda.bindings.runtime.cudaOccupancyDisableCachingOverride + + Assume global caching is enabled and cannot be automatically turned off + +.. autoattribute:: cuda.bindings.runtime.cudaCpuDeviceId + + Device id that represents the CPU + +.. autoattribute:: cuda.bindings.runtime.cudaInvalidDeviceId + + Device id that represents an invalid device + +.. autoattribute:: cuda.bindings.runtime.cudaInitDeviceFlagsAreValid + + Tell the CUDA runtime that DeviceFlags is being set in cudaInitDevice call + +.. autoattribute:: cuda.bindings.runtime.cudaArraySparsePropertiesSingleMipTail + + Indicates that the layered sparse CUDA array or CUDA mipmapped array has a single mip tail region for all layers + +.. autoattribute:: cuda.bindings.runtime.CUDART_CB +.. autoattribute:: cuda.bindings.runtime.cudaMemPoolCreateUsageHwDecompress + + This flag, if set, indicates that the memory will be used as a buffer for hardware accelerated decompression. + +.. autoattribute:: cuda.bindings.runtime.CU_UUID_HAS_BEEN_DEFINED + + CUDA UUID types + +.. autoattribute:: cuda.bindings.runtime.CUDA_IPC_HANDLE_SIZE + + CUDA IPC Handle Size + +.. autoattribute:: cuda.bindings.runtime.cudaExternalMemoryDedicated + + Indicates that the external memory object is a dedicated resource + +.. autoattribute:: cuda.bindings.runtime.cudaExternalSemaphoreSignalSkipNvSciBufMemSync + + When the /p flags parameter of :py:obj:`~.cudaExternalSemaphoreSignalParams` contains this flag, it indicates that signaling an external semaphore object should skip performing appropriate memory synchronization operations over all the external memory objects that are imported as :py:obj:`~.cudaExternalMemoryHandleTypeNvSciBuf`, which otherwise are performed by default to ensure data coherency with other importers of the same NvSciBuf memory objects. + +.. autoattribute:: cuda.bindings.runtime.cudaExternalSemaphoreWaitSkipNvSciBufMemSync + + When the /p flags parameter of :py:obj:`~.cudaExternalSemaphoreWaitParams` contains this flag, it indicates that waiting an external semaphore object should skip performing appropriate memory synchronization operations over all the external memory objects that are imported as :py:obj:`~.cudaExternalMemoryHandleTypeNvSciBuf`, which otherwise are performed by default to ensure data coherency with other importers of the same NvSciBuf memory objects. + +.. autoattribute:: cuda.bindings.runtime.cudaNvSciSyncAttrSignal + + When /p flags of :py:obj:`~.cudaDeviceGetNvSciSyncAttributes` is set to this, it indicates that application need signaler specific NvSciSyncAttr to be filled by :py:obj:`~.cudaDeviceGetNvSciSyncAttributes`. + +.. autoattribute:: cuda.bindings.runtime.cudaNvSciSyncAttrWait + + When /p flags of :py:obj:`~.cudaDeviceGetNvSciSyncAttributes` is set to this, it indicates that application need waiter specific NvSciSyncAttr to be filled by :py:obj:`~.cudaDeviceGetNvSciSyncAttributes`. + +.. autoattribute:: cuda.bindings.runtime.RESOURCE_ABI_BYTES +.. autoattribute:: cuda.bindings.runtime.cudaGraphKernelNodePortDefault + + This port activates when the kernel has finished executing. + +.. autoattribute:: cuda.bindings.runtime.cudaGraphKernelNodePortProgrammatic + + This port activates when all blocks of the kernel have performed cudaTriggerProgrammaticLaunchCompletion() or have terminated. It must be used with edge type :py:obj:`~.cudaGraphDependencyTypeProgrammatic`. See also :py:obj:`~.cudaLaunchAttributeProgrammaticEvent`. + +.. autoattribute:: cuda.bindings.runtime.cudaGraphKernelNodePortLaunchCompletion + + This port activates when all blocks of the kernel have begun execution. See also :py:obj:`~.cudaLaunchAttributeLaunchCompletionEvent`. + +.. autoattribute:: cuda.bindings.runtime.cudaStreamAttrID +.. autoattribute:: cuda.bindings.runtime.cudaStreamAttributeAccessPolicyWindow +.. autoattribute:: cuda.bindings.runtime.cudaStreamAttributeSynchronizationPolicy +.. autoattribute:: cuda.bindings.runtime.cudaStreamAttributeMemSyncDomainMap +.. autoattribute:: cuda.bindings.runtime.cudaStreamAttributeMemSyncDomain +.. autoattribute:: cuda.bindings.runtime.cudaStreamAttributePriority +.. autoattribute:: cuda.bindings.runtime.cudaStreamAttrValue +.. autoattribute:: cuda.bindings.runtime.cudaKernelNodeAttrID +.. autoattribute:: cuda.bindings.runtime.cudaKernelNodeAttributeAccessPolicyWindow +.. autoattribute:: cuda.bindings.runtime.cudaKernelNodeAttributeCooperative +.. autoattribute:: cuda.bindings.runtime.cudaKernelNodeAttributePriority +.. autoattribute:: cuda.bindings.runtime.cudaKernelNodeAttributeClusterDimension +.. autoattribute:: cuda.bindings.runtime.cudaKernelNodeAttributeClusterSchedulingPolicyPreference +.. autoattribute:: cuda.bindings.runtime.cudaKernelNodeAttributeMemSyncDomainMap +.. autoattribute:: cuda.bindings.runtime.cudaKernelNodeAttributeMemSyncDomain +.. autoattribute:: cuda.bindings.runtime.cudaKernelNodeAttributePreferredSharedMemoryCarveout +.. autoattribute:: cuda.bindings.runtime.cudaKernelNodeAttributeDeviceUpdatableKernelNode +.. autoattribute:: cuda.bindings.runtime.cudaKernelNodeAttributeNvlinkUtilCentricScheduling +.. autoattribute:: cuda.bindings.runtime.cudaKernelNodeAttrValue +.. autoattribute:: cuda.bindings.runtime.cudaSurfaceType1D +.. autoattribute:: cuda.bindings.runtime.cudaSurfaceType2D +.. autoattribute:: cuda.bindings.runtime.cudaSurfaceType3D +.. autoattribute:: cuda.bindings.runtime.cudaSurfaceTypeCubemap +.. autoattribute:: cuda.bindings.runtime.cudaSurfaceType1DLayered +.. autoattribute:: cuda.bindings.runtime.cudaSurfaceType2DLayered +.. autoattribute:: cuda.bindings.runtime.cudaSurfaceTypeCubemapLayered +.. autoattribute:: cuda.bindings.runtime.cudaTextureType1D +.. autoattribute:: cuda.bindings.runtime.cudaTextureType2D +.. autoattribute:: cuda.bindings.runtime.cudaTextureType3D +.. autoattribute:: cuda.bindings.runtime.cudaTextureTypeCubemap +.. autoattribute:: cuda.bindings.runtime.cudaTextureType1DLayered +.. autoattribute:: cuda.bindings.runtime.cudaTextureType2DLayered +.. autoattribute:: cuda.bindings.runtime.cudaTextureTypeCubemapLayered +.. autoattribute:: cuda.bindings.runtime.CUDA_EGL_MAX_PLANES + + Maximum number of planes per frame + + +Device Management +----------------- + +impl_private + + + +MANBRIEF device management functions of the CUDA runtime API (CURRENT_FILE) ENDMANBRIEF + + + +This section describes the device management functions of the CUDA runtime application programming interface. + +.. autofunction:: cuda.bindings.runtime.cudaDeviceReset +.. autofunction:: cuda.bindings.runtime.cudaDeviceSynchronize +.. autofunction:: cuda.bindings.runtime.cudaDeviceSetLimit +.. autofunction:: cuda.bindings.runtime.cudaDeviceGetLimit +.. autofunction:: cuda.bindings.runtime.cudaDeviceGetTexture1DLinearMaxWidth +.. autofunction:: cuda.bindings.runtime.cudaDeviceGetCacheConfig +.. autofunction:: cuda.bindings.runtime.cudaDeviceGetStreamPriorityRange +.. autofunction:: cuda.bindings.runtime.cudaDeviceSetCacheConfig +.. autofunction:: cuda.bindings.runtime.cudaDeviceGetByPCIBusId +.. autofunction:: cuda.bindings.runtime.cudaDeviceGetPCIBusId +.. autofunction:: cuda.bindings.runtime.cudaIpcGetEventHandle +.. autofunction:: cuda.bindings.runtime.cudaIpcOpenEventHandle +.. autofunction:: cuda.bindings.runtime.cudaIpcGetMemHandle +.. autofunction:: cuda.bindings.runtime.cudaIpcOpenMemHandle +.. autofunction:: cuda.bindings.runtime.cudaIpcCloseMemHandle +.. autofunction:: cuda.bindings.runtime.cudaDeviceFlushGPUDirectRDMAWrites +.. autofunction:: cuda.bindings.runtime.cudaDeviceRegisterAsyncNotification +.. autofunction:: cuda.bindings.runtime.cudaDeviceUnregisterAsyncNotification +.. autofunction:: cuda.bindings.runtime.cudaGetDeviceCount +.. autofunction:: cuda.bindings.runtime.cudaGetDeviceProperties +.. autofunction:: cuda.bindings.runtime.cudaDeviceGetAttribute +.. autofunction:: cuda.bindings.runtime.cudaDeviceGetHostAtomicCapabilities +.. autofunction:: cuda.bindings.runtime.cudaDeviceGetDefaultMemPool +.. autofunction:: cuda.bindings.runtime.cudaDeviceSetMemPool +.. autofunction:: cuda.bindings.runtime.cudaDeviceGetMemPool +.. autofunction:: cuda.bindings.runtime.cudaDeviceGetNvSciSyncAttributes +.. autofunction:: cuda.bindings.runtime.cudaDeviceGetP2PAttribute +.. autofunction:: cuda.bindings.runtime.cudaDeviceGetP2PAtomicCapabilities +.. autofunction:: cuda.bindings.runtime.cudaChooseDevice +.. autofunction:: cuda.bindings.runtime.cudaInitDevice +.. autofunction:: cuda.bindings.runtime.cudaSetDevice +.. autofunction:: cuda.bindings.runtime.cudaGetDevice +.. autofunction:: cuda.bindings.runtime.cudaSetDeviceFlags +.. autofunction:: cuda.bindings.runtime.cudaGetDeviceFlags + +Error Handling +-------------- + +MANBRIEF error handling functions of the CUDA runtime API (CURRENT_FILE) ENDMANBRIEF + + + +This section describes the error handling functions of the CUDA runtime application programming interface. + +.. autofunction:: cuda.bindings.runtime.cudaGetLastError +.. autofunction:: cuda.bindings.runtime.cudaPeekAtLastError +.. autofunction:: cuda.bindings.runtime.cudaGetErrorName +.. autofunction:: cuda.bindings.runtime.cudaGetErrorString + +Stream Management +----------------- + +MANBRIEF stream management functions of the CUDA runtime API (CURRENT_FILE) ENDMANBRIEF + + + +This section describes the stream management functions of the CUDA runtime application programming interface. + +.. autoclass:: cuda.bindings.runtime.cudaGraphRecaptureCallbackData +.. autoclass:: cuda.bindings.runtime.cudaStreamCallback_t +.. autoclass:: cuda.bindings.runtime.cudaGraphRecaptureCallback_t +.. autofunction:: cuda.bindings.runtime.cudaStreamCreate +.. autofunction:: cuda.bindings.runtime.cudaStreamCreateWithFlags +.. autofunction:: cuda.bindings.runtime.cudaStreamCreateWithPriority +.. autofunction:: cuda.bindings.runtime.cudaStreamGetPriority +.. autofunction:: cuda.bindings.runtime.cudaStreamGetFlags +.. autofunction:: cuda.bindings.runtime.cudaStreamGetId +.. autofunction:: cuda.bindings.runtime.cudaStreamGetDevice +.. autofunction:: cuda.bindings.runtime.cudaCtxResetPersistingL2Cache +.. autofunction:: cuda.bindings.runtime.cudaStreamCopyAttributes +.. autofunction:: cuda.bindings.runtime.cudaStreamGetAttribute +.. autofunction:: cuda.bindings.runtime.cudaStreamSetAttribute +.. autofunction:: cuda.bindings.runtime.cudaStreamDestroy +.. autofunction:: cuda.bindings.runtime.cudaStreamWaitEvent +.. autofunction:: cuda.bindings.runtime.cudaStreamAddCallback +.. autofunction:: cuda.bindings.runtime.cudaStreamSynchronize +.. autofunction:: cuda.bindings.runtime.cudaStreamQuery +.. autofunction:: cuda.bindings.runtime.cudaStreamAttachMemAsync +.. autofunction:: cuda.bindings.runtime.cudaStreamBeginCapture +.. autofunction:: cuda.bindings.runtime.cudaStreamBeginRecaptureToGraph +.. autofunction:: cuda.bindings.runtime.cudaStreamBeginCaptureToGraph +.. autofunction:: cuda.bindings.runtime.cudaThreadExchangeStreamCaptureMode +.. autofunction:: cuda.bindings.runtime.cudaStreamEndCapture +.. autofunction:: cuda.bindings.runtime.cudaStreamIsCapturing +.. autofunction:: cuda.bindings.runtime.cudaStreamGetCaptureInfo +.. autofunction:: cuda.bindings.runtime.cudaStreamUpdateCaptureDependencies + +Event Management +---------------- + +MANBRIEF event management functions of the CUDA runtime API (CURRENT_FILE) ENDMANBRIEF + + + +This section describes the event management functions of the CUDA runtime application programming interface. + +.. autofunction:: cuda.bindings.runtime.cudaEventCreate +.. autofunction:: cuda.bindings.runtime.cudaEventCreateWithFlags +.. autofunction:: cuda.bindings.runtime.cudaEventRecord +.. autofunction:: cuda.bindings.runtime.cudaEventRecordWithFlags +.. autofunction:: cuda.bindings.runtime.cudaEventQuery +.. autofunction:: cuda.bindings.runtime.cudaEventSynchronize +.. autofunction:: cuda.bindings.runtime.cudaEventDestroy +.. autofunction:: cuda.bindings.runtime.cudaEventElapsedTime + +External Resource Interoperability +---------------------------------- + +MANBRIEF External resource interoperability functions of the CUDA runtime API (CURRENT_FILE) ENDMANBRIEF + + + +This section describes the external resource interoperability functions of the CUDA runtime application programming interface. + +.. autofunction:: cuda.bindings.runtime.cudaImportExternalMemory +.. autofunction:: cuda.bindings.runtime.cudaExternalMemoryGetMappedBuffer +.. autofunction:: cuda.bindings.runtime.cudaExternalMemoryGetMappedMipmappedArray +.. autofunction:: cuda.bindings.runtime.cudaDestroyExternalMemory +.. autofunction:: cuda.bindings.runtime.cudaImportExternalSemaphore +.. autofunction:: cuda.bindings.runtime.cudaSignalExternalSemaphoresAsync +.. autofunction:: cuda.bindings.runtime.cudaWaitExternalSemaphoresAsync +.. autofunction:: cuda.bindings.runtime.cudaDestroyExternalSemaphore + +Execution Control +----------------- + +MANBRIEF execution control functions of the CUDA runtime API (CURRENT_FILE) ENDMANBRIEF + + + +This section describes the execution control functions of the CUDA runtime application programming interface. + + + +Some functions have overloaded C++ API template versions documented separately in the C++ API Routines module. + +.. autofunction:: cuda.bindings.runtime.cudaFuncSetCacheConfig +.. autofunction:: cuda.bindings.runtime.cudaFuncGetAttributes +.. autofunction:: cuda.bindings.runtime.cudaFuncSetAttribute +.. autofunction:: cuda.bindings.runtime.cudaFuncGetParamCount +.. autofunction:: cuda.bindings.runtime.cudaLaunchHostFunc +.. autofunction:: cuda.bindings.runtime.cudaLaunchHostFunc_v2 + +Occupancy +--------- + +MANBRIEF occupancy calculation functions of the CUDA runtime API (CURRENT_FILE) ENDMANBRIEF + + + +This section describes the occupancy calculation functions of the CUDA runtime application programming interface. + + + +Besides the occupancy calculator functions (cudaOccupancyMaxActiveBlocksPerMultiprocessor and cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags), there are also C++ only occupancy-based launch configuration functions documented in C++ API Routines module. + + + +See cudaOccupancyMaxPotentialBlockSize (C++ API), cudaOccupancyMaxPotentialBlockSize (C++ API), cudaOccupancyMaxPotentialBlockSizeVariableSMem (C++ API), cudaOccupancyMaxPotentialBlockSizeVariableSMem (C++ API) cudaOccupancyAvailableDynamicSMemPerBlock (C++ API), + +.. autofunction:: cuda.bindings.runtime.cudaOccupancyMaxActiveBlocksPerMultiprocessor +.. autofunction:: cuda.bindings.runtime.cudaOccupancyAvailableDynamicSMemPerBlock +.. autofunction:: cuda.bindings.runtime.cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags + +Memory Management +----------------- + +MANBRIEF memory management functions of the CUDA runtime API (CURRENT_FILE) ENDMANBRIEF + + + +This section describes the memory management functions of the CUDA runtime application programming interface. + + + +Some functions have overloaded C++ API template versions documented separately in the C++ API Routines module. + +.. autofunction:: cuda.bindings.runtime.cudaMallocManaged +.. autofunction:: cuda.bindings.runtime.cudaMalloc +.. autofunction:: cuda.bindings.runtime.cudaMallocHost +.. autofunction:: cuda.bindings.runtime.cudaMallocPitch +.. autofunction:: cuda.bindings.runtime.cudaMallocArray +.. autofunction:: cuda.bindings.runtime.cudaFree +.. autofunction:: cuda.bindings.runtime.cudaFreeHost +.. autofunction:: cuda.bindings.runtime.cudaFreeArray +.. autofunction:: cuda.bindings.runtime.cudaFreeMipmappedArray +.. autofunction:: cuda.bindings.runtime.cudaHostAlloc +.. autofunction:: cuda.bindings.runtime.cudaHostRegister +.. autofunction:: cuda.bindings.runtime.cudaHostUnregister +.. autofunction:: cuda.bindings.runtime.cudaHostGetDevicePointer +.. autofunction:: cuda.bindings.runtime.cudaHostGetFlags +.. autofunction:: cuda.bindings.runtime.cudaMalloc3D +.. autofunction:: cuda.bindings.runtime.cudaMalloc3DArray +.. autofunction:: cuda.bindings.runtime.cudaMallocMipmappedArray +.. autofunction:: cuda.bindings.runtime.cudaGetMipmappedArrayLevel +.. autofunction:: cuda.bindings.runtime.cudaMemcpy3D +.. autofunction:: cuda.bindings.runtime.cudaMemcpy3DPeer +.. autofunction:: cuda.bindings.runtime.cudaMemcpy3DAsync +.. autofunction:: cuda.bindings.runtime.cudaMemcpy3DPeerAsync +.. autofunction:: cuda.bindings.runtime.cudaMemGetInfo +.. autofunction:: cuda.bindings.runtime.cudaArrayGetInfo +.. autofunction:: cuda.bindings.runtime.cudaArrayGetPlane +.. autofunction:: cuda.bindings.runtime.cudaArrayGetMemoryRequirements +.. autofunction:: cuda.bindings.runtime.cudaMipmappedArrayGetMemoryRequirements +.. autofunction:: cuda.bindings.runtime.cudaArrayGetSparseProperties +.. autofunction:: cuda.bindings.runtime.cudaMipmappedArrayGetSparseProperties +.. autofunction:: cuda.bindings.runtime.cudaMemcpy +.. autofunction:: cuda.bindings.runtime.cudaMemcpyPeer +.. autofunction:: cuda.bindings.runtime.cudaMemcpy2D +.. autofunction:: cuda.bindings.runtime.cudaMemcpy2DToArray +.. autofunction:: cuda.bindings.runtime.cudaMemcpy2DFromArray +.. autofunction:: cuda.bindings.runtime.cudaMemcpy2DArrayToArray +.. autofunction:: cuda.bindings.runtime.cudaMemcpyAsync +.. autofunction:: cuda.bindings.runtime.cudaMemcpyPeerAsync +.. autofunction:: cuda.bindings.runtime.cudaMemcpyBatchAsync +.. autofunction:: cuda.bindings.runtime.cudaMemcpy3DBatchAsync +.. autofunction:: cuda.bindings.runtime.cudaMemcpyWithAttributesAsync +.. autofunction:: cuda.bindings.runtime.cudaMemcpy3DWithAttributesAsync +.. autofunction:: cuda.bindings.runtime.cudaMemcpy2DAsync +.. autofunction:: cuda.bindings.runtime.cudaMemcpy2DToArrayAsync +.. autofunction:: cuda.bindings.runtime.cudaMemcpy2DFromArrayAsync +.. autofunction:: cuda.bindings.runtime.cudaMemset +.. autofunction:: cuda.bindings.runtime.cudaMemset2D +.. autofunction:: cuda.bindings.runtime.cudaMemset3D +.. autofunction:: cuda.bindings.runtime.cudaMemsetAsync +.. autofunction:: cuda.bindings.runtime.cudaMemset2DAsync +.. autofunction:: cuda.bindings.runtime.cudaMemset3DAsync +.. autofunction:: cuda.bindings.runtime.cudaMemPrefetchAsync +.. autofunction:: cuda.bindings.runtime.cudaMemPrefetchBatchAsync +.. autofunction:: cuda.bindings.runtime.cudaMemDiscardBatchAsync +.. autofunction:: cuda.bindings.runtime.cudaMemDiscardAndPrefetchBatchAsync +.. autofunction:: cuda.bindings.runtime.cudaMemAdvise +.. autofunction:: cuda.bindings.runtime.cudaMemRangeGetAttribute +.. autofunction:: cuda.bindings.runtime.cudaMemRangeGetAttributes +.. autofunction:: cuda.bindings.runtime.make_cudaPitchedPtr +.. autofunction:: cuda.bindings.runtime.make_cudaPos +.. autofunction:: cuda.bindings.runtime.make_cudaExtent + +Stream Ordered Memory Allocator +------------------------------- + +MANBRIEF Functions for performing allocation and free operations in stream order. Functions for controlling the behavior of the underlying allocator. (CURRENT_FILE) ENDMANBRIEF + + + + + +**overview** + +The asynchronous allocator allows the user to allocate and free in stream order. All asynchronous accesses of the allocation must happen between the stream executions of the allocation and the free. If the memory is accessed outside of the promised stream order, a use before allocation / use after free error will cause undefined behavior. + +The allocator is free to reallocate the memory as long as it can guarantee that compliant memory accesses will not overlap temporally. The allocator may refer to internal stream ordering as well as inter-stream dependencies (such as CUDA events and null stream dependencies) when establishing the temporal guarantee. The allocator may also insert inter-stream dependencies to establish the temporal guarantee. + + + + + +**Supported Platforms** + +Whether or not a device supports the integrated stream ordered memory allocator may be queried by calling cudaDeviceGetAttribute() with the device attribute cudaDevAttrMemoryPoolsSupported. + +.. autofunction:: cuda.bindings.runtime.cudaMallocAsync +.. autofunction:: cuda.bindings.runtime.cudaFreeAsync +.. autofunction:: cuda.bindings.runtime.cudaMemPoolTrimTo +.. autofunction:: cuda.bindings.runtime.cudaMemPoolSetAttribute +.. autofunction:: cuda.bindings.runtime.cudaMemPoolGetAttribute +.. autofunction:: cuda.bindings.runtime.cudaMemPoolSetAccess +.. autofunction:: cuda.bindings.runtime.cudaMemPoolGetAccess +.. autofunction:: cuda.bindings.runtime.cudaMemPoolCreate +.. autofunction:: cuda.bindings.runtime.cudaMemPoolDestroy +.. autofunction:: cuda.bindings.runtime.cudaMemGetDefaultMemPool +.. autofunction:: cuda.bindings.runtime.cudaMemGetMemPool +.. autofunction:: cuda.bindings.runtime.cudaMemSetMemPool +.. autofunction:: cuda.bindings.runtime.cudaMallocFromPoolAsync +.. autofunction:: cuda.bindings.runtime.cudaMemPoolExportToShareableHandle +.. autofunction:: cuda.bindings.runtime.cudaMemPoolImportFromShareableHandle +.. autofunction:: cuda.bindings.runtime.cudaMemPoolExportPointer +.. autofunction:: cuda.bindings.runtime.cudaMemPoolImportPointer + +Unified Addressing +------------------ + +MANBRIEF unified addressing functions of the CUDA runtime API (CURRENT_FILE) ENDMANBRIEF + + + +This section describes the unified addressing functions of the CUDA runtime application programming interface. + + + + + +**Overview** + +CUDA devices can share a unified address space with the host. + + For these devices there is no distinction between a device pointer and a host pointer -- the same pointer value may be used to access memory from the host program and from a kernel running on the device (with exceptions enumerated below). + + + + + +**Supported Platforms** + +Whether or not a device supports unified addressing may be queried by calling cudaGetDeviceProperties() with the device property cudaDeviceProp::unifiedAddressing. + +Unified addressing is automatically enabled in 64-bit processes . + + + + + +**Looking Up Information from Pointer Values** + +It is possible to look up information about the memory which backs a pointer value. For instance, one may want to know if a pointer points to host or device memory. As another example, in the case of device memory, one may want to know on which CUDA device the memory resides. These properties may be queried using the function cudaPointerGetAttributes() + +Since pointers are unique, it is not necessary to specify information about the pointers specified to cudaMemcpy() and other copy functions. + + The copy direction cudaMemcpyDefault may be used to specify that the CUDA runtime should infer the location of the pointer from its value. + + + + + +**Automatic Mapping of Host Allocated Host Memory** + +All host memory allocated through all devices using cudaMallocHost() and cudaHostAlloc() is always directly accessible from all devices that support unified addressing. This is the case regardless of whether or not the flags cudaHostAllocPortable and cudaHostAllocMapped are specified. + +The pointer value through which allocated host memory may be accessed in kernels on all devices that support unified addressing is the same as the pointer value through which that memory is accessed on the host. It is not necessary to call cudaHostGetDevicePointer() to get the device pointer for these allocations. + + + +Note that this is not the case for memory allocated using the flag cudaHostAllocWriteCombined, as discussed below. + + + + + +**Direct Access of Peer Memory** + +Upon enabling direct access from a device that supports unified addressing to another peer device that supports unified addressing using cudaDeviceEnablePeerAccess() all memory allocated in the peer device using cudaMalloc() and cudaMallocPitch() will immediately be accessible by the current device. The device pointer value through which any peer's memory may be accessed in the current device is the same pointer value through which that memory may be accessed from the peer device. + + + + + +**Exceptions, Disjoint Addressing** + +Not all memory may be accessed on devices through the same pointer value through which they are accessed on the host. These exceptions are host memory registered using cudaHostRegister() and host memory allocated using the flag cudaHostAllocWriteCombined. For these exceptions, there exists a distinct host and device address for the memory. The device address is guaranteed to not overlap any valid host pointer range and is guaranteed to have the same value across all devices that support unified addressing. + + + +This device address may be queried using cudaHostGetDevicePointer() when a device using unified addressing is current. Either the host or the unified device pointer value may be used to refer to this memory in cudaMemcpy() and similar functions using the cudaMemcpyDefault memory direction. + +.. autofunction:: cuda.bindings.runtime.cudaPointerGetAttributes + +Peer Device Memory Access +------------------------- + +MANBRIEF peer device memory access functions of the CUDA runtime API (CURRENT_FILE) ENDMANBRIEF + + + +This section describes the peer device memory access functions of the CUDA runtime application programming interface. + +.. autofunction:: cuda.bindings.runtime.cudaDeviceCanAccessPeer +.. autofunction:: cuda.bindings.runtime.cudaDeviceEnablePeerAccess +.. autofunction:: cuda.bindings.runtime.cudaDeviceDisablePeerAccess + +OpenGL Interoperability +----------------------- + +impl_private + + + +This section describes the OpenGL interoperability functions of the CUDA runtime application programming interface. Note that mapping of OpenGL resources is performed with the graphics API agnostic, resource mapping interface described in Graphics Interopability. + +.. autoclass:: cuda.bindings.runtime.cudaGLDeviceList + + .. autoattribute:: cuda.bindings.runtime.cudaGLDeviceList.cudaGLDeviceListAll + + + The CUDA devices for all GPUs used by the current OpenGL context + + + .. autoattribute:: cuda.bindings.runtime.cudaGLDeviceList.cudaGLDeviceListCurrentFrame + + + The CUDA devices for the GPUs used by the current OpenGL context in its currently rendering frame + + + .. autoattribute:: cuda.bindings.runtime.cudaGLDeviceList.cudaGLDeviceListNextFrame + + + The CUDA devices for the GPUs to be used by the current OpenGL context in the next frame + +.. autofunction:: cuda.bindings.runtime.cudaGLGetDevices +.. autofunction:: cuda.bindings.runtime.cudaGraphicsGLRegisterImage +.. autofunction:: cuda.bindings.runtime.cudaGraphicsGLRegisterBuffer + +Direct3D 9 Interoperability +--------------------------- + + + + +Direct3D 10 Interoperability +---------------------------- + + + + +Direct3D 11 Interoperability +---------------------------- + + + + +VDPAU Interoperability +---------------------- + +This section describes the VDPAU interoperability functions of the CUDA runtime application programming interface. + +.. autofunction:: cuda.bindings.runtime.cudaVDPAUGetDevice +.. autofunction:: cuda.bindings.runtime.cudaVDPAUSetVDPAUDevice +.. autofunction:: cuda.bindings.runtime.cudaGraphicsVDPAURegisterVideoSurface +.. autofunction:: cuda.bindings.runtime.cudaGraphicsVDPAURegisterOutputSurface + +EGL Interoperability +-------------------- + +This section describes the EGL interoperability functions of the CUDA runtime application programming interface. + +.. autofunction:: cuda.bindings.runtime.cudaGraphicsEGLRegisterImage +.. autofunction:: cuda.bindings.runtime.cudaEGLStreamConsumerConnect +.. autofunction:: cuda.bindings.runtime.cudaEGLStreamConsumerConnectWithFlags +.. autofunction:: cuda.bindings.runtime.cudaEGLStreamConsumerDisconnect +.. autofunction:: cuda.bindings.runtime.cudaEGLStreamConsumerAcquireFrame +.. autofunction:: cuda.bindings.runtime.cudaEGLStreamConsumerReleaseFrame +.. autofunction:: cuda.bindings.runtime.cudaEGLStreamProducerConnect +.. autofunction:: cuda.bindings.runtime.cudaEGLStreamProducerDisconnect +.. autofunction:: cuda.bindings.runtime.cudaEGLStreamProducerPresentFrame +.. autofunction:: cuda.bindings.runtime.cudaEGLStreamProducerReturnFrame +.. autofunction:: cuda.bindings.runtime.cudaGraphicsResourceGetMappedEglFrame +.. autofunction:: cuda.bindings.runtime.cudaEventCreateFromEGLSync + +Graphics Interoperability +------------------------- + +MANBRIEF graphics interoperability functions of the CUDA runtime API (CURRENT_FILE) ENDMANBRIEF + + + +This section describes the graphics interoperability functions of the CUDA runtime application programming interface. + +.. autofunction:: cuda.bindings.runtime.cudaGraphicsUnregisterResource +.. autofunction:: cuda.bindings.runtime.cudaGraphicsResourceSetMapFlags +.. autofunction:: cuda.bindings.runtime.cudaGraphicsMapResources +.. autofunction:: cuda.bindings.runtime.cudaGraphicsUnmapResources +.. autofunction:: cuda.bindings.runtime.cudaGraphicsResourceGetMappedPointer +.. autofunction:: cuda.bindings.runtime.cudaGraphicsSubResourceGetMappedArray +.. autofunction:: cuda.bindings.runtime.cudaGraphicsResourceGetMappedMipmappedArray + +Texture Object Management +------------------------- + +MANBRIEF texture object management functions of the CUDA runtime API (CURRENT_FILE) ENDMANBRIEF + + + +This section describes the low level texture object management functions of the CUDA runtime application programming interface. The texture object API is only supported on devices of compute capability 3.0 or higher. + +.. autofunction:: cuda.bindings.runtime.cudaGetChannelDesc +.. autofunction:: cuda.bindings.runtime.cudaCreateChannelDesc +.. autofunction:: cuda.bindings.runtime.cudaCreateTextureObject +.. autofunction:: cuda.bindings.runtime.cudaDestroyTextureObject +.. autofunction:: cuda.bindings.runtime.cudaGetTextureObjectResourceDesc +.. autofunction:: cuda.bindings.runtime.cudaGetTextureObjectTextureDesc +.. autofunction:: cuda.bindings.runtime.cudaGetTextureObjectResourceViewDesc + +Surface Object Management +------------------------- + +MANBRIEF surface object management functions of the CUDA runtime API (CURRENT_FILE) ENDMANBRIEF + + + +This section describes the low level texture object management functions of the CUDA runtime application programming interface. The surface object API is only supported on devices of compute capability 3.0 or higher. + +.. autofunction:: cuda.bindings.runtime.cudaCreateSurfaceObject +.. autofunction:: cuda.bindings.runtime.cudaDestroySurfaceObject +.. autofunction:: cuda.bindings.runtime.cudaGetSurfaceObjectResourceDesc + +Version Management +------------------ + + + +.. autofunction:: cuda.bindings.runtime.cudaDriverGetVersion +.. autofunction:: cuda.bindings.runtime.cudaRuntimeGetVersion +.. autofunction:: cuda.bindings.runtime.getLocalRuntimeVersion + +Error Log Management Functions +------------------------------ + +MANBRIEF error log management interface for the CUDA Runtime and Driver (CURRENT_FILE) ENDMANBRIEF + + + +This section describes the error log management functions of the CUDA runtime application programming interface. The Error Log Management interface will operate on both the CUDA Driver and CUDA Runtime. + +.. autoclass:: cuda.bindings.runtime.cudaLogsCallback_t +.. autofunction:: cuda.bindings.runtime.cudaLogsRegisterCallback +.. autofunction:: cuda.bindings.runtime.cudaLogsUnregisterCallback +.. autofunction:: cuda.bindings.runtime.cudaLogsCurrent +.. autofunction:: cuda.bindings.runtime.cudaLogsDumpToFile +.. autofunction:: cuda.bindings.runtime.cudaLogsDumpToMemory + +Graph Management +---------------- + +MANBRIEF graph management functions of the CUDA runtime API (CURRENT_FILE) ENDMANBRIEF + + + +This section describes the graph management functions of CUDA runtime application programming interface. + +.. autofunction:: cuda.bindings.runtime.cudaGraphCreate +.. autofunction:: cuda.bindings.runtime.cudaGraphAddKernelNode +.. autofunction:: cuda.bindings.runtime.cudaGraphKernelNodeGetParams +.. autofunction:: cuda.bindings.runtime.cudaGraphKernelNodeSetParams +.. autofunction:: cuda.bindings.runtime.cudaGraphKernelNodeCopyAttributes +.. autofunction:: cuda.bindings.runtime.cudaGraphKernelNodeGetAttribute +.. autofunction:: cuda.bindings.runtime.cudaGraphKernelNodeSetAttribute +.. autofunction:: cuda.bindings.runtime.cudaGraphAddMemcpyNode +.. autofunction:: cuda.bindings.runtime.cudaGraphAddMemcpyNode1D +.. autofunction:: cuda.bindings.runtime.cudaGraphMemcpyNodeGetParams +.. autofunction:: cuda.bindings.runtime.cudaGraphMemcpyNodeSetParams +.. autofunction:: cuda.bindings.runtime.cudaGraphMemcpyNodeSetParams1D +.. autofunction:: cuda.bindings.runtime.cudaGraphAddMemsetNode +.. autofunction:: cuda.bindings.runtime.cudaGraphMemsetNodeGetParams +.. autofunction:: cuda.bindings.runtime.cudaGraphMemsetNodeSetParams +.. autofunction:: cuda.bindings.runtime.cudaGraphAddHostNode +.. autofunction:: cuda.bindings.runtime.cudaGraphHostNodeGetParams +.. autofunction:: cuda.bindings.runtime.cudaGraphHostNodeSetParams +.. autofunction:: cuda.bindings.runtime.cudaGraphAddChildGraphNode +.. autofunction:: cuda.bindings.runtime.cudaGraphChildGraphNodeGetGraph +.. autofunction:: cuda.bindings.runtime.cudaGraphAddEmptyNode +.. autofunction:: cuda.bindings.runtime.cudaGraphAddEventRecordNode +.. autofunction:: cuda.bindings.runtime.cudaGraphEventRecordNodeGetEvent +.. autofunction:: cuda.bindings.runtime.cudaGraphEventRecordNodeSetEvent +.. autofunction:: cuda.bindings.runtime.cudaGraphAddEventWaitNode +.. autofunction:: cuda.bindings.runtime.cudaGraphEventWaitNodeGetEvent +.. autofunction:: cuda.bindings.runtime.cudaGraphEventWaitNodeSetEvent +.. autofunction:: cuda.bindings.runtime.cudaGraphAddExternalSemaphoresSignalNode +.. autofunction:: cuda.bindings.runtime.cudaGraphExternalSemaphoresSignalNodeGetParams +.. autofunction:: cuda.bindings.runtime.cudaGraphExternalSemaphoresSignalNodeSetParams +.. autofunction:: cuda.bindings.runtime.cudaGraphAddExternalSemaphoresWaitNode +.. autofunction:: cuda.bindings.runtime.cudaGraphExternalSemaphoresWaitNodeGetParams +.. autofunction:: cuda.bindings.runtime.cudaGraphExternalSemaphoresWaitNodeSetParams +.. autofunction:: cuda.bindings.runtime.cudaGraphAddMemAllocNode +.. autofunction:: cuda.bindings.runtime.cudaGraphMemAllocNodeGetParams +.. autofunction:: cuda.bindings.runtime.cudaGraphAddMemFreeNode +.. autofunction:: cuda.bindings.runtime.cudaGraphMemFreeNodeGetParams +.. autofunction:: cuda.bindings.runtime.cudaDeviceGraphMemTrim +.. autofunction:: cuda.bindings.runtime.cudaDeviceGetGraphMemAttribute +.. autofunction:: cuda.bindings.runtime.cudaDeviceSetGraphMemAttribute +.. autofunction:: cuda.bindings.runtime.cudaGraphClone +.. autofunction:: cuda.bindings.runtime.cudaGraphNodeFindInClone +.. autofunction:: cuda.bindings.runtime.cudaGraphNodeGetType +.. autofunction:: cuda.bindings.runtime.cudaGraphNodeGetContainingGraph +.. autofunction:: cuda.bindings.runtime.cudaGraphNodeGetLocalId +.. autofunction:: cuda.bindings.runtime.cudaGraphNodeGetToolsId +.. autofunction:: cuda.bindings.runtime.cudaGraphGetId +.. autofunction:: cuda.bindings.runtime.cudaGraphExecGetId +.. autofunction:: cuda.bindings.runtime.cudaGraphGetNodes +.. autofunction:: cuda.bindings.runtime.cudaGraphGetRootNodes +.. autofunction:: cuda.bindings.runtime.cudaGraphGetEdges +.. autofunction:: cuda.bindings.runtime.cudaGraphNodeGetDependencies +.. autofunction:: cuda.bindings.runtime.cudaGraphNodeGetDependentNodes +.. autofunction:: cuda.bindings.runtime.cudaGraphAddDependencies +.. autofunction:: cuda.bindings.runtime.cudaGraphRemoveDependencies +.. autofunction:: cuda.bindings.runtime.cudaGraphDestroyNode +.. autofunction:: cuda.bindings.runtime.cudaGraphInstantiate +.. autofunction:: cuda.bindings.runtime.cudaGraphInstantiateWithFlags +.. autofunction:: cuda.bindings.runtime.cudaGraphInstantiateWithParams +.. autofunction:: cuda.bindings.runtime.cudaGraphExecGetFlags +.. autofunction:: cuda.bindings.runtime.cudaGraphExecKernelNodeSetParams +.. autofunction:: cuda.bindings.runtime.cudaGraphExecMemcpyNodeSetParams +.. autofunction:: cuda.bindings.runtime.cudaGraphExecMemcpyNodeSetParams1D +.. autofunction:: cuda.bindings.runtime.cudaGraphExecMemsetNodeSetParams +.. autofunction:: cuda.bindings.runtime.cudaGraphExecHostNodeSetParams +.. autofunction:: cuda.bindings.runtime.cudaGraphExecChildGraphNodeSetParams +.. autofunction:: cuda.bindings.runtime.cudaGraphExecEventRecordNodeSetEvent +.. autofunction:: cuda.bindings.runtime.cudaGraphExecEventWaitNodeSetEvent +.. autofunction:: cuda.bindings.runtime.cudaGraphExecExternalSemaphoresSignalNodeSetParams +.. autofunction:: cuda.bindings.runtime.cudaGraphExecExternalSemaphoresWaitNodeSetParams +.. autofunction:: cuda.bindings.runtime.cudaGraphNodeSetEnabled +.. autofunction:: cuda.bindings.runtime.cudaGraphNodeGetEnabled +.. autofunction:: cuda.bindings.runtime.cudaGraphExecUpdate +.. autofunction:: cuda.bindings.runtime.cudaGraphUpload +.. autofunction:: cuda.bindings.runtime.cudaGraphLaunch +.. autofunction:: cuda.bindings.runtime.cudaGraphExecDestroy +.. autofunction:: cuda.bindings.runtime.cudaGraphDestroy +.. autofunction:: cuda.bindings.runtime.cudaGraphDebugDotPrint +.. autofunction:: cuda.bindings.runtime.cudaUserObjectCreate +.. autofunction:: cuda.bindings.runtime.cudaUserObjectRetain +.. autofunction:: cuda.bindings.runtime.cudaUserObjectRelease +.. autofunction:: cuda.bindings.runtime.cudaGraphRetainUserObject +.. autofunction:: cuda.bindings.runtime.cudaGraphReleaseUserObject +.. autofunction:: cuda.bindings.runtime.cudaGraphAddNode +.. autofunction:: cuda.bindings.runtime.cudaGraphNodeSetParams +.. autofunction:: cuda.bindings.runtime.cudaGraphNodeGetParams +.. autofunction:: cuda.bindings.runtime.cudaGraphExecNodeSetParams +.. autofunction:: cuda.bindings.runtime.cudaGraphConditionalHandleCreate +.. autofunction:: cuda.bindings.runtime.cudaGraphConditionalHandleCreate_v2 + +Driver Entry Point Access +------------------------- + +MANBRIEF driver entry point access functions of the CUDA runtime API (CURRENT_FILE) ENDMANBRIEF + + + +This section describes the driver entry point access functions of CUDA runtime application programming interface. + +.. autofunction:: cuda.bindings.runtime.cudaGetDriverEntryPoint +.. autofunction:: cuda.bindings.runtime.cudaGetDriverEntryPointByVersion + +Library Management +------------------ + +MANBRIEF library management functions of the CUDA runtime API (CURRENT_FILE) ENDMANBRIEF + + + +This section describes the library management functions of the CUDA runtime application programming interface. + +.. autofunction:: cuda.bindings.runtime.cudaLibraryLoadData +.. autofunction:: cuda.bindings.runtime.cudaLibraryLoadFromFile +.. autofunction:: cuda.bindings.runtime.cudaLibraryUnload +.. autofunction:: cuda.bindings.runtime.cudaLibraryGetKernel +.. autofunction:: cuda.bindings.runtime.cudaLibraryGetGlobal +.. autofunction:: cuda.bindings.runtime.cudaLibraryGetManaged +.. autofunction:: cuda.bindings.runtime.cudaLibraryGetUnifiedFunction +.. autofunction:: cuda.bindings.runtime.cudaLibraryGetKernelCount +.. autofunction:: cuda.bindings.runtime.cudaLibraryEnumerateKernels +.. autofunction:: cuda.bindings.runtime.cudaKernelSetAttributeForDevice + +Execution Context Management +---------------------------- + +MANBRIEF execution context management functions of the CUDA runtime API (CURRENT_FILE) ENDMANBRIEF + + + +This section describes the execution context management functions of the CUDA runtime application programming interface. + + + + + +**Overview** + +A CUDA execution context cudaExecutionContext_t serves as an abstraction for the contexts exposed by the CUDA Runtime, specifically green contexts and the primary context, and provides a unified programming model and API interface for contexts in the Runtime. + +There are two primary ways today to obtain an execution context: + +- cudaDeviceGetExecutionCtx: Returns the execution context that corresponds to the primary context of the specified device. + + + + + + + +- cudaGreenCtxCreate: Creates a green context with the specified resources and returns an execution context. + + + + + + + + + +Once you have an execution context at hand, you can perform context-level operations via the CUDA Runtime APIs. This includes: + +- Submitting work via streams created with cudaExecutionCtxStreamCreate. + + + + + + + +- Querying context via cudaExecutionCtxGetDevResource, cudaExecutionCtxGetDevice, etc. + + + + + + + +- Synchronizing and tracking context-level operations via cudaExecutionCtxSynchronize, cudaExecutionCtxRecordEvent, cudaExecutionCtxWaitEvent. + + + + + + + +- Performing context-level graph node operations via cudaGraphAddNode by specifying the context in ``nodeParams``. Note that individual node creation APIs, such as cudaGraphAddKernelNode, do not support specifying an execution context. + + + + + + + + + +Note: The above APIs take in an explicit cudaExecutionContext_t handle and ignores the context that is current to the calling thread. This enables explicit context-based programming without relying on thread-local state. If no context is specified, the APIs return cudaErrorInvalidValue. + +Note: Developers should treat cudaExecutionContext_t as an opaque handle and avoid assumptions about its underlying representation. The CUDA Runtime does not provide a way to convert this handle into driver-level contexts, such as ::CUcontext or ::CUgreenCtx. + + + + + +**Lifetime of CUDA Resources** + +The lifetime of CUDA resources (memory, streams, events, modules, etc) is not tied to the lifetime of the execution context. Their lifetime is tied to the device against which they were created. As such, usage of cudaDeviceReset() should be avoided to persist the lifetime of these resources. + + + + + +**APIs Operating on Current Context** + +The CUDA runtime does not provide a way to set an execution context as current. Since, the majority of the runtime APIs operate on the current context, we document below how the developer can work with these APIs. + + + +**APIs Operating on Device Resources** + +To work with these APIs (for example, cudaMalloc, cudaEventCreate, etc), developers are expected to call cudaSetDevice() prior to invoking them. Doing so does not impact functional correctness as these APIs operate on resources that are device-wide. If users have a context handle at hand, they can get the device handle from the context handle using cudaExecutionCtxGetDevice(). + + + + + +**APIs Operating on Context Resources** + +These APIs (for example, cudaLaunchKernel, cudaMemcpyAsync, cudaMemsetAsync, etc) take in a stream and resources are inferred from the context bound to the stream at creation. See cudaExecutionCtxStreamCreate for more details. Developers are expected to use the stream-based APIs for context awareness and always pass an explicit stream handle to ensure context-awareness, and avoid reliance on the default NULL stream, which implicitly binds to the current context. + + + + + + + +**Green Contexts** + +Green contexts are a lightweight alternative to traditional contexts, that can be used to select a subset of device resources. This allows the developer to, for example, select SMs from distinct spatial partitions of the GPU and target them via CUDA stream operations, kernel launches, etc. + +Here are the broad initial steps to follow to get started: + +- (1) Start with an initial set of resources. For SM resources, they can be fetched via cudaDeviceGetDevResource. In case of workqueues, a new configuration can be used or an existing one queried via the cudaDeviceGetDevResource API. + + + + + + + +- (2) Modify these resources by either partitioning them (in case of SMs) or changing the configuration (in case of workqueues). To partition SMs, we recommend cudaDevSmResourceSplit. Changing the workqueue configuration can be done directly in place. + + + + + + + +- (3) Finalize the specification of resources by creating a descriptor via cudaDevResourceGenerateDesc. + + + + + + + +- (4) Create a green context via cudaGreenCtxCreate. This provisions the resource, such as workqueues (until this step it was only a configuration specification). + + + + + + + +- (5) Create a stream via cudaExecutionCtxStreamCreate, and use it throughout your application. + + + + + + + + + +SMs + +There are two possible partition operations - with cudaDevSmResourceSplitByCount the partitions created have to follow default SM count granularity requirements, so it will often be rounded up and aligned to a default value. On the other hand, cudaDevSmResourceSplit is explicit and allows for creation of non-equal groups. It will not round up automatically - instead it is the developer’s responsibility to query and set the correct values. These requirements can be queried with cudaDeviceGetDevResource to determine the alignment granularity (sm.smCoscheduledAlignment). A general guideline on the default values for each compute architecture: + +- On Compute Architecture 7.X, 8.X, and all Tegra SoC: + + + + + + - The smCount must be a multiple of 2. + + + + + + + + - The alignment (and default value of coscheduledSmCount) is 2. + + + + + + + + + +- On Compute Architecture 9.0+: + + + + + + - The smCount must be a multiple of 8, or coscheduledSmCount if provided. + + + + + + + + - The alignment (and default value of coscheduledSmCount) is 8. While the maximum value for coscheduled SM count is 32 on all Compute Architecture 9.0+, it's recommended to follow cluster size requirements. The portable cluster size and the max cluster size should be used in order to benefit from this co-scheduling. + + + + + + + + + + + +Workqueues + +For ``cudaDevResourceTypeWorkqueueConfig``, the resource specifies the expected maximum number of concurrent stream-ordered workloads via the ``wqConcurrencyLimit`` field. The ``sharingScope`` field determines how workqueue resources are shared: + +- ``cudaDevWorkqueueConfigScopeDeviceCtx:`` Use all shared workqueue resources across all contexts (default driver behavior). + + + + + + + +- ``cudaDevWorkqueueConfigScopeGreenCtxBalanced:`` When possible, use non-overlapping workqueue resources with other balanced green contexts. + + + + + + + + + +The maximum concurrency limit depends on ::CUDA_DEVICE_MAX_CONNECTIONS and can be queried from the device via cudaDeviceGetDevResource. Configurations may exceed this concurrency limit, but the driver will not guarantee that work submission remains non-overlapping. + +For ``cudaDevResourceTypeWorkqueue``, the resource represents a pre-existing workqueue that can be retrieved from existing execution contexts. This allows reusing workqueue resources across different execution contexts. + +On Concurrency + +Even if the green contexts have disjoint SM partitions, it is not guaranteed that the kernels launched in them will run concurrently or have forward progress guarantees. This is due to other resources that could cause a dependency. Using a combination of disjoint SMs and ``cudaDevWorkqueueConfigScopeGreenCtxBalanced`` workqueue configurations can provide the best chance of avoiding interference. More resources will be added in the future to provide stronger guarantees. + +Additionally, there are two known scenarios, where its possible for the workload to run on more SMs than was provisioned (but never less). + + + +- On Volta+ MPS: When ``CUDA_MPS_ACTIVE_THREAD_PERCENTAGE`` is used, the set of SMs that are used for running kernels can be scaled up to the value of SMs used for the MPS client. + + + + + + + +- On Compute Architecture 9.x: When a module with dynamic parallelism (CDP) is loaded, all future kernels running under green contexts may use and share an additional set of 2 SMs. + +.. autofunction:: cuda.bindings.runtime.cudaDeviceGetDevResource +.. autofunction:: cuda.bindings.runtime.cudaDevSmResourceSplitByCount +.. autofunction:: cuda.bindings.runtime.cudaDevSmResourceSplit +.. autofunction:: cuda.bindings.runtime.cudaDevResourceGenerateDesc +.. autofunction:: cuda.bindings.runtime.cudaGreenCtxCreate +.. autofunction:: cuda.bindings.runtime.cudaExecutionCtxDestroy +.. autofunction:: cuda.bindings.runtime.cudaExecutionCtxGetDevResource +.. autofunction:: cuda.bindings.runtime.cudaExecutionCtxGetDevice +.. autofunction:: cuda.bindings.runtime.cudaExecutionCtxGetId +.. autofunction:: cuda.bindings.runtime.cudaExecutionCtxStreamCreate +.. autofunction:: cuda.bindings.runtime.cudaExecutionCtxSynchronize +.. autofunction:: cuda.bindings.runtime.cudaStreamGetDevResource +.. autofunction:: cuda.bindings.runtime.cudaExecutionCtxRecordEvent +.. autofunction:: cuda.bindings.runtime.cudaExecutionCtxWaitEvent +.. autofunction:: cuda.bindings.runtime.cudaDeviceGetExecutionCtx + +C++ API Routines +---------------- +C++-style interface built on top of CUDA runtime API. +impl_private + + + +MANBRIEF C++ high level API functions of the CUDA runtime API (CURRENT_FILE) ENDMANBRIEF + + + +This section describes the C++ high level API functions of the CUDA runtime application programming interface. To use these functions, your application needs to be compiled with the ``nvcc`` compiler. + + +Interactions with the CUDA Driver API +------------------------------------- + +MANBRIEF interactions between CUDA Driver API and CUDA Runtime API (CURRENT_FILE) ENDMANBRIEF + + + +This section describes the interactions between the CUDA Driver API and the CUDA Runtime API + + + + + +**Execution Contexts** + +The CUDA Runtime provides cudaExecutionContext_t as an abstraction over driver-level contexts—specifically, green contexts and the primary context. + +There are two primary ways to obtain an execution context: + +- cudaDeviceGetExecutionCtx: Returns the execution context that corresponds to the primary context of the specified device. + + + + + + + +- cudaGreenCtxCreate: Creates a green context with the specified resources and returns an execution context. + + + + + + + + + +Note: Developers should treat cudaExecutionContext_t as an opaque handle and avoid assumptions about its underlying representation. The CUDA Runtime does not provide a way to convert this handle into a ::CUcontext or ::CUgreenCtx. + + + + + +**Primary Context (aka Device Execution Context)** + +The primary context is the default execution context associated with a device in the Runtime. It can be obtained via a call to cudaDeviceGetExecutionCtx(). There is a one-to-one mapping between CUDA devices in the runtime and their primary contexts within a process. + +From the CUDA Runtime’s perspective, a device and its primary context are functionally synonymous. + +Unless explicitly overridden, either by making a different context current via the Driver API (e.g., ::cuCtxSetCurrent()) or by using an explicit execution context handle, the Runtime will implicitly initialize and use the primary context for API calls as needed. + + + + + +**Initialization and Tear-Down** + +Unless an explicit execution context is specified (see “Execution Context Management” for APIs), CUDA Runtime API calls operate on the CUDA Driver ::CUcontext which is current to the calling host thread. If no ::CUcontext is current to the calling thread when a CUDA Runtime API call which requires an active context is made, then the primary context (device execution context) for a device will be selected, made current to the calling thread, and initialized. The context will be initialized using the parameters specified by the CUDA Runtime API functions cudaSetDeviceFlags(), ::cudaD3D9SetDirect3DDevice(), ::cudaD3D10SetDirect3DDevice(), ::cudaD3D11SetDirect3DDevice(), cudaGLSetGLDevice(), and cudaVDPAUSetVDPAUDevice(). Note that these functions will fail with cudaErrorSetOnActiveProcess if they are called when the primary context for the specified device has already been initialized, except for cudaSetDeviceFlags() which will simply overwrite the previous settings. + +The function cudaInitDevice() ensures that the primary context is initialized for the requested device but does not make it current to the calling thread. + +The function cudaSetDevice() initializes the primary context for the specified device and makes it current to the calling thread by calling ::cuCtxSetCurrent(). + +Primary contexts will remain active until they are explicitly deinitialized using cudaDeviceReset(). The function cudaDeviceReset() will deinitialize the primary context for the calling thread's current device immediately. The context will remain current to all of the threads that it was current to. The next CUDA Runtime API call on any thread which requires an active context will trigger the reinitialization of that device's primary context. + +Note that primary contexts are shared resources. It is recommended that the primary context not be reset except just before exit or to recover from an unspecified launch failure. + + + + + +**CUcontext Interoperability** + +Note that the use of multiple ::CUcontext s per device within a single process will substantially degrade performance and is strongly discouraged. Instead, it is highly recommended to either use execution contexts cudaExecutionContext_t or the implicit one-to-one device-to-primary context mapping for the process provided by the CUDA Runtime API. + +If a non-primary ::CUcontext created by the CUDA Driver API is current to a thread then the CUDA Runtime API calls to that thread will operate on that ::CUcontext, with some exceptions listed below. Interoperability between data types is discussed in the following sections. + +The function cudaDeviceEnablePeerAccess() and the rest of the peer access API may not be called when a non-primary CUcontext is current. To use the peer access APIs with a context created using the CUDA Driver API, it is necessary that the CUDA Driver API be used to access these features. + +All CUDA Runtime API state (e.g, global variables' addresses and values) travels with its underlying ::CUcontext. In particular, if a ::CUcontext is moved from one thread to another then all CUDA Runtime API state will move to that thread as well. + +Please note that attaching to legacy CUcontext (those with a version of 3010 as returned by ::cuCtxGetApiVersion()) is not possible. The CUDA Runtime will return cudaErrorIncompatibleDriverContext in such cases. + + + + + +**Interactions between CUstream and cudaStream_t** + +The types ::CUstream and cudaStream_t are identical and may be used interchangeably. + + + + + +**Interactions between CUevent and cudaEvent_t** + +The types ::CUevent and cudaEvent_t are identical and may be used interchangeably. + + + + + +**Interactions between CUarray and cudaArray_t** + +The types ::CUarray and struct ::cudaArray \* represent the same data type and may be used interchangeably by casting the two types between each other. + +In order to use a ::CUarray in a CUDA Runtime API function which takes a struct ::cudaArray \*, it is necessary to explicitly cast the ::CUarray to a struct ::cudaArray \*. + +In order to use a struct ::cudaArray \* in a CUDA Driver API function which takes a ::CUarray, it is necessary to explicitly cast the struct ::cudaArray \* to a ::CUarray . + + + + + +**Interactions between CUgraphicsResource and cudaGraphicsResource_t** + +The types ::CUgraphicsResource and cudaGraphicsResource_t represent the same data type and may be used interchangeably by casting the two types between each other. + +In order to use a ::CUgraphicsResource in a CUDA Runtime API function which takes a cudaGraphicsResource_t, it is necessary to explicitly cast the ::CUgraphicsResource to a cudaGraphicsResource_t. + +In order to use a cudaGraphicsResource_t in a CUDA Driver API function which takes a ::CUgraphicsResource, it is necessary to explicitly cast the cudaGraphicsResource_t to a ::CUgraphicsResource. + + + + + +**Interactions between CUtexObject and cudaTextureObject_t** + +The types ::CUtexObject and cudaTextureObject_t represent the same data type and may be used interchangeably by casting the two types between each other. + +In order to use a ::CUtexObject in a CUDA Runtime API function which takes a cudaTextureObject_t, it is necessary to explicitly cast the ::CUtexObject to a cudaTextureObject_t. + +In order to use a cudaTextureObject_t in a CUDA Driver API function which takes a ::CUtexObject, it is necessary to explicitly cast the cudaTextureObject_t to a ::CUtexObject. + + + + + +**Interactions between CUsurfObject and cudaSurfaceObject_t** + +The types ::CUsurfObject and cudaSurfaceObject_t represent the same data type and may be used interchangeably by casting the two types between each other. + +In order to use a ::CUsurfObject in a CUDA Runtime API function which takes a cudaSurfaceObject_t, it is necessary to explicitly cast the ::CUsurfObject to a cudaSurfaceObject_t. + +In order to use a cudaSurfaceObject_t in a CUDA Driver API function which takes a ::CUsurfObject, it is necessary to explicitly cast the cudaSurfaceObject_t to a ::CUsurfObject. + + + + + +**Interactions between CUfunction and cudaFunction_t** + +The types ::CUfunction and cudaFunction_t represent the same data type and may be used interchangeably by casting the two types between each other. + +In order to use a cudaFunction_t in a CUDA Driver API function which takes a ::CUfunction, it is necessary to explicitly cast the cudaFunction_t to a ::CUfunction. + + + + + +**Interactions between CUkernel and cudaKernel_t** + +The types ::CUkernel and cudaKernel_t represent the same data type and may be used interchangeably by casting the two types between each other. + +In order to use a cudaKernel_t in a CUDA Driver API function which takes a ::CUkernel, it is necessary to explicitly cast the cudaKernel_t to a ::CUkernel. + +.. autofunction:: cuda.bindings.runtime.cudaGetKernel + +Profiler Control +---------------- + +MANBRIEF profiler control functions of the CUDA runtime API (CURRENT_FILE) ENDMANBRIEF + + + +This section describes the profiler control functions of the CUDA runtime application programming interface. + +.. autofunction:: cuda.bindings.runtime.cudaProfilerStart +.. autofunction:: cuda.bindings.runtime.cudaProfilerStop diff --git a/cuda_bindings/docs/source/module/utils.rst b/cuda_bindings/docs/source/module/utils.rst new file mode 100644 index 00000000000..7673b742b59 --- /dev/null +++ b/cuda_bindings/docs/source/module/utils.rst @@ -0,0 +1,17 @@ +.. SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +.. module:: cuda.bindings.utils + +utils +===== + +Functions +--------- + +.. autosummary:: + :toctree: generated/ + + get_cuda_native_handle + get_minimal_required_cuda_ver_from_ptx_ver + get_ptx_ver diff --git a/docs/_sources/motivation.md.txt b/cuda_bindings/docs/source/motivation.rst similarity index 70% rename from docs/_sources/motivation.md.txt rename to cuda_bindings/docs/source/motivation.rst index 5b8879f2bc5..0236299bf7d 100644 --- a/docs/_sources/motivation.md.txt +++ b/cuda_bindings/docs/source/motivation.rst @@ -1,36 +1,42 @@ -# Motivation -## What is CUDA Python? +.. SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 -NVIDIA’s CUDA Python provides [Cython](https://cython.org/) bindings and Python +Motivation +========== +What is CUDA Python? +-------------------- + +NVIDIA’s CUDA Python provides `Cython `_ bindings and Python wrappers for the driver and runtime API for existing toolkits and libraries to simplify GPU-based accelerated processing. Python is one of the most popular -programming languages for science, engineering, data analytics, and deep +programming languages for science, engineering, data analytics, and deep learning applications. The goal of CUDA Python is to unify the Python ecosystem with a single set of interfaces that provide full coverage of and access to the CUDA host APIs from Python. -## Why CUDA Python? +Why CUDA Python? +---------------- CUDA Python provides uniform APIs and bindings for inclusion into existing toolkits and libraries to simplify GPU-based parallel processing for HPC, data science, and AI. -[Numba](https://numba.pydata.org/), a Python compiler from -[Anaconda](https://www.anaconda.com/) that can compile Python code for execution +`Numba `_, a Python compiler from +`Anaconda `_ that can compile Python code for execution on CUDA-capable GPUs, provides Python developers with an easy entry into GPU-accelerated computing and a path for using increasingly sophisticated CUDA -code with a minimum of new syntax and jargon. Numba has its own CUDA driver API -bindings that can now be replaced with CUDA Python. With CUDA Python and Numba, +code with a minimum of new syntax and jargon. Numba has its own CUDA driver API +bindings that can now be replaced with CUDA Python. With CUDA Python and Numba, you get the best of both worlds: rapid iterative development with Python and the speed of a compiled language targeting both CPUs and NVIDIA GPUs. -[CuPy](https://cupy.dev/) is a -[NumPy](https://numpy.org/)/[SciPy](https://www.scipy.org/) compatible Array -library, from [Preferred Networks](https://www.preferred.jp/en/), for -GPU-accelerated computing with Python. CUDA Python simplifies the CuPy build -and allows for a faster and smaller memory footprint when importing the CuPy -Python module. In the future, when more CUDA Toolkit libraries are supported, -CuPy will have a lighter maintenance overhead and have fewer wheels to +`CuPy `_ is a +`NumPy `_/`SciPy `_ compatible Array +library, from `Preferred Networks `_, for +GPU-accelerated computing with Python. CUDA Python simplifies the CuPy build +and allows for a faster and smaller memory footprint when importing the CuPy +Python module. In the future, when more CUDA Toolkit libraries are supported, +CuPy will have a lighter maintenance overhead and have fewer wheels to release. Users benefit from a faster CUDA runtime! Our goal is to help unify the Python CUDA ecosystem with a single standard set diff --git a/cuda_bindings/docs/source/overview.rst b/cuda_bindings/docs/source/overview.rst new file mode 100644 index 00000000000..14c068c2af5 --- /dev/null +++ b/cuda_bindings/docs/source/overview.rst @@ -0,0 +1,573 @@ +.. SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +Overview +======== + +Python plays a key role within the science, engineering, data analytics, and +deep learning application ecosystem. NVIDIA has long been committed to helping +the Python ecosystem leverage the accelerated massively parallel performance of +GPUs to deliver standardized libraries, tools, and applications. Today, we're +introducing another step towards simplification of the developer experience with +improved Python code portability and compatibility. + +Our goal is to help unify the Python CUDA ecosystem with a single standard set +of low-level interfaces, providing full coverage and access to the CUDA host +APIs from Python. We want to provide an ecosystem foundation to allow +interoperability among different accelerated libraries. Most importantly, it +should be easy for Python developers to use NVIDIA GPUs. + +``cuda.bindings`` workflow +--------------------------- + +Because Python is an interpreted language, you need a way to compile the device +code into +`PTX `_ and +then extract the function to be called at a later point in the application. You +construct your device code in the form of a string and compile it with +`NVRTC `_, a runtime compilation +library for CUDA C++. Using the NVIDIA `Driver +API `_, manually create a +CUDA context and all required resources on the GPU, then launch the compiled +CUDA C++ code and retrieve the results from the GPU. Now that you have an +overview, jump into a commonly used example for parallel programming: +`SAXPY `_. For more +end-to-end samples, see the :doc:`examples` page. + +The first thing to do is import the `Driver +API `_ and +`NVRTC `_ modules from the ``cuda.bindings`` +package. Next, we consider how to store host data and pass it to the device. Different +approaches can be used to accomplish this and are described in +:ref:`Preparing kernel arguments `. +In this example, we will use NumPy to store host data and pass it to the device, so let's +import this dependency as well. + +.. code-block:: python + + from cuda.bindings import driver, nvrtc + import numpy as np + +Error checking is a fundamental best practice when working with low-level interfaces. +The following code snippet lets us validate each API call and raise exceptions in case of error: + +.. code-block:: python + + def _cudaGetErrorEnum(error): + if isinstance(error, driver.CUresult): + err, name = driver.cuGetErrorName(error) + return name if err == driver.CUresult.CUDA_SUCCESS else "" + elif isinstance(error, nvrtc.nvrtcResult): + return nvrtc.nvrtcGetErrorString(error)[1] + else: + raise RuntimeError('Unknown error type: {}'.format(error)) + + def checkCudaErrors(result): + if result[0].value: + raise RuntimeError("CUDA error code={}({})".format(result[0].value, _cudaGetErrorEnum(result[0]))) + if len(result) == 1: + return None + elif len(result) == 2: + return result[1] + else: + return result[1:] + +It's common practice to write CUDA kernels near the top of a translation unit, +so write it next. The entire kernel is wrapped in triple quotes to form a +string. The string is compiled later using NVRTC. This is the only part of CUDA +Python that requires some understanding of CUDA C++. For more information, see +`An Even Easier Introduction to +CUDA `_. + +.. code-block:: python + + saxpy = """\ + extern "C" __global__ + void saxpy(float a, float *x, float *y, float *out, size_t n) + { + size_t tid = blockIdx.x * blockDim.x + threadIdx.x; + if (tid < n) { + out[tid] = a * x[tid] + y[tid]; + } + } + """ + +Go ahead and compile the kernel into PTX. Remember that this is executed at runtime using NVRTC. There are three basic steps to NVRTC: + +- Create a program from the string. +- Compile the program. +- Extract PTX from the compiled program. + +In the following code example, the Driver API is initialized so that the NVIDIA driver +and GPU are accessible. Next, the GPU is queried for their compute capability. Finally, +the program is compiled to target our local compute capability architecture with FMAD disabled: + +.. code-block:: python + + # Initialize CUDA Driver API + checkCudaErrors(driver.cuInit(0)) + + # Retrieve handle for device 0 + cuDevice = checkCudaErrors(driver.cuDeviceGet(0)) + + # Derive target architecture for device 0 + major = checkCudaErrors(driver.cuDeviceGetAttribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR, cuDevice)) + minor = checkCudaErrors(driver.cuDeviceGetAttribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR, cuDevice)) + arch_arg = bytes(f'--gpu-architecture=compute_{major}{minor}', 'ascii') + + # Create program + prog = checkCudaErrors(nvrtc.nvrtcCreateProgram(str.encode(saxpy), b"saxpy.cu", 0, [], [])) + + # Compile program + opts = [b"--fmad=false", arch_arg] + checkCudaErrors(nvrtc.nvrtcCompileProgram(prog, 2, opts)) + + # Get PTX from compilation + ptxSize = checkCudaErrors(nvrtc.nvrtcGetPTXSize(prog)) + ptx = b" " * ptxSize + checkCudaErrors(nvrtc.nvrtcGetPTX(prog, ptx)) + +Before you can use the PTX or do any work on the GPU, you must create a CUDA +context. CUDA contexts are analogous to host processes for the device. In the +following code example, a handle for compute device 0 is passed to +``cuCtxCreate`` to designate that GPU for context creation: + +.. code-block:: python + + # Create context + context = checkCudaErrors(driver.cuCtxCreate(0, cuDevice)) + +With a CUDA context created on device 0, load the PTX generated earlier into a +module. A module is analogous to dynamically loaded libraries for the device. +After loading into the module, extract a specific kernel with +``cuModuleGetFunction``. It is not uncommon for multiple kernels to reside in PTX: + +.. code-block:: python + + # Load PTX as module data and retrieve function + ptx = np.char.array(ptx) + # Note: Incompatible --gpu-architecture would be detected here + module = checkCudaErrors(driver.cuModuleLoadData(ptx.ctypes.data)) + kernel = checkCudaErrors(driver.cuModuleGetFunction(module, b"saxpy")) + +Next, get all your data prepared and transferred to the GPU. For increased +application performance, you can input data on the device to eliminate data +transfers. For completeness, this example shows how you would transfer data to +and from the device: + +.. code-block:: python + + NUM_THREADS = 512 # Threads per block + NUM_BLOCKS = 32768 # Blocks per grid + + a = np.array([2.0], dtype=np.float32) + n = np.array(NUM_THREADS * NUM_BLOCKS, dtype=np.uint32) + bufferSize = n * a.itemsize + + hX = np.random.rand(n).astype(dtype=np.float32) + hY = np.random.rand(n).astype(dtype=np.float32) + hOut = np.zeros(n).astype(dtype=np.float32) + +With the input data ``a``, ``x``, and ``y`` created for the SAXPY transform device, +resources must be allocated to store the data using ``cuMemAlloc``. To allow for +more overlap between compute and data movement, use the asynchronous function +``cuMemcpyHtoDAsync``. It returns control to the CPU immediately following command +execution. + +Python doesn't have a natural concept of pointers, yet ``cuMemcpyHtoDAsync`` expects +``void*``. This is where we leverage NumPy's data types to retrieve each host data pointer +by calling ``XX.ctypes.data`` for the associated XX: + +.. code-block:: python + + dXclass = checkCudaErrors(driver.cuMemAlloc(bufferSize)) + dYclass = checkCudaErrors(driver.cuMemAlloc(bufferSize)) + dOutclass = checkCudaErrors(driver.cuMemAlloc(bufferSize)) + + stream = checkCudaErrors(driver.cuStreamCreate(0)) + + checkCudaErrors(driver.cuMemcpyHtoDAsync( + dXclass, hX.ctypes.data, bufferSize, stream + )) + checkCudaErrors(driver.cuMemcpyHtoDAsync( + dYclass, hY.ctypes.data, bufferSize, stream + )) + +With data prep and resources allocation finished, the kernel is ready to be +launched. To pass the location of the data on the device to the kernel execution +configuration, you must retrieve the device pointer. In the following code +example, we call ``int(XXclass)`` to retrieve the device pointer value for the +associated XXclass as a Python ``int`` and wrap it in a ``np.array`` type: + +.. code-block:: python + + dX = np.array([int(dXclass)], dtype=np.uint64) + dY = np.array([int(dYclass)], dtype=np.uint64) + dOut = np.array([int(dOutclass)], dtype=np.uint64) + +The launch API ``cuLaunchKernel`` also expects a pointer input for the argument list +but this time it's of type ``void**``. What this means is that our argument list needs to +be a contiguous array of ``void*`` elements, where each element is the pointer to a kernel +argument on either host or device. Since we already prepared each of our arguments into a ``np.array`` type, the +construction of our final contiguous array is done by retrieving the ``XX.ctypes.data`` +of each kernel argument: + +.. code-block:: python + + args = [a, dX, dY, dOut, n] + args = np.array([arg.ctypes.data for arg in args], dtype=np.uint64) + +Now the kernel can be launched: + +.. code-block:: python + + checkCudaErrors(driver.cuLaunchKernel( + kernel, + NUM_BLOCKS, # grid x dim + 1, # grid y dim + 1, # grid z dim + NUM_THREADS, # block x dim + 1, # block y dim + 1, # block z dim + 0, # dynamic shared memory + stream, # stream + args.ctypes.data, # kernel arguments + 0, # extra (ignore) + )) + + checkCudaErrors(driver.cuMemcpyDtoHAsync( + hOut.ctypes.data, dOutclass, bufferSize, stream + )) + checkCudaErrors(driver.cuStreamSynchronize(stream)) + +The ``cuLaunchKernel`` function takes the compiled module kernel and execution +configuration parameters. The device code is launched in the same stream as the +data transfers. That ensures that the kernel's compute is performed only after +the data has finished transfer, as all API calls and kernel launches within a +stream are serialized. After the call to transfer data back to the host is +executed, ``cuStreamSynchronize`` is used to halt CPU execution until all operations +in the designated stream are finished: + +.. code-block:: python + + # Assert values are same after running kernel + hZ = a * hX + hY + if not np.allclose(hOut, hZ): + raise ValueError("Error outside tolerance for host-device vectors") + +Perform verification of the data to ensure correctness and finish the code with +memory clean up: + +.. code-block:: python + + checkCudaErrors(driver.cuStreamDestroy(stream)) + checkCudaErrors(driver.cuMemFree(dXclass)) + checkCudaErrors(driver.cuMemFree(dYclass)) + checkCudaErrors(driver.cuMemFree(dOutclass)) + checkCudaErrors(driver.cuModuleUnload(module)) + checkCudaErrors(driver.cuCtxDestroy(context)) + +Performance +----------- + +Performance is a primary driver in targeting GPUs in your application. So, how +does the above code compare to its C++ version? Table 1 shows that the results +are nearly identical. `NVIDIA NSight +Systems `_ was used to retrieve +kernel performance and `CUDA +Events `_ +was used for application performance. + +The following command was used to profile the applications: + +.. code-block:: shell + + nsys profile -s none -t cuda --stats=true + +.. list-table:: Kernel and application performance comparison. + :header-rows: 1 + + * - + - C++ + - Python + * - Kernel execution + - 352µs + - 352µs + * - Application execution + - 1076ms + - 1080ms + +``cuda.bindings`` is also compatible with `NVIDIA Nsight +Compute `_, which is an +interactive kernel profiler for CUDA applications. It allows you to have +detailed insights into kernel performance. This is useful when you're trying to +maximize performance ({numref}``Figure 1``). + +.. figure:: _static/images/Nsight-Compute-CLI-625x473.png + :name: Figure 1 + + Screenshot of Nsight Compute CLI output of ``cuda.bindings`` example. + +.. _preparing-kernel-arguments: + +Preparing kernel arguments +-------------------------- + +The ``cuLaunchKernel`` API bindings retain low-level CUDA argument preparation requirements: + +* Each kernel argument is a ``void*`` (i.e. pointer to the argument) +* ``kernelParams`` is a ``void**`` (i.e. pointer to a list of kernel arguments) +* ``kernelParams`` arguments are in contiguous memory + +These requirements can be met with two different approaches, using either NumPy or ctypes. + +Using NumPy +^^^^^^^^^^^ + +NumPy `Array objects `_ can be used to fulfill each of these conditions directly. + +Let's use the following kernel definition as an example: + +.. code-block:: python + + kernel_string = """ + typedef struct { + int value; + } testStruct; + + extern "C" __global__ + void testkernel(int i, int *pi, + float f, float *pf, + testStruct s, testStruct *ps) + { + *pi = i; + *pf = f; + ps->value = s.value; + } + """ + +The first step is to create array objects with types corresponding to your kernel arguments. Primitive NumPy types have the following corresponding kernel types: + +.. list-table:: Correspondence between NumPy types and kernel types. + :header-rows: 1 + + * - NumPy type + - Corresponding kernel types + - itemsize (bytes) + * - bool + - bool + - 1 + * - int8 + - char, signed char, int8_t + - 1 + * - int16 + - short, signed short, int16_t + - 2 + * - int32 + - int, signed int, int32_t + - 4 + * - int64 + - long long, signed long long, int64_t + - 8 + * - uint8 + - unsigned char, uint8_t + - 1 + * - uint16 + - unsigned short, uint16_t + - 2 + * - uint32 + - unsigned int, uint32_t + - 4 + * - uint64 + - unsigned long long, uint64_t + - 8 + * - float16 + - half + - 2 + * - float32 + - float + - 4 + * - float64 + - double + - 8 + * - complex64 + - float2, cuFloatComplex, complex<float> + - 8 + * - complex128 + - double2, cuDoubleComplex, complex<double> + - 16 + +Furthermore, custom NumPy types can be used to support both platform-dependent types and user-defined structures as kernel arguments. + +This example uses the following types: +* ``int`` is ``np.uint32`` +* ``float`` is ``np.float32`` +* ``int*``, ``float*`` and ``testStruct*`` are ``np.intp`` +* ``testStruct`` is a custom user type ``np.dtype([("value", np.int32)], align=True)`` + +Note how all three pointers are ``np.intp`` since the pointer values are always a representation of an address space. + +Putting it all together: + +.. code-block:: python + + # Define a custom type + testStruct = np.dtype([("value", np.int32)], align=True) + + # Allocate device memory + pInt = checkCudaErrors(cudart.cudaMalloc(np.dtype(np.int32).itemsize)) + pFloat = checkCudaErrors(cudart.cudaMalloc(np.dtype(np.float32).itemsize)) + pStruct = checkCudaErrors(cudart.cudaMalloc(testStruct.itemsize)) + + # Collect all input kernel arguments into a single tuple for further processing + kernelValues = ( + np.array(1, dtype=np.uint32), + np.array([pInt], dtype=np.intp), + np.array(123.456, dtype=np.float32), + np.array([pFloat], dtype=np.intp), + np.array([5], testStruct), + np.array([pStruct], dtype=np.intp), + ) + +The final step is to construct a ``kernelParams`` argument that fulfills all of the launch API conditions. This is made easy because each array object comes +with NumPy's `ctypes data attribute `_ that returns the underlying ``void*`` pointer value. + +By having the final array object contain all pointers, we fulfill the contiguous array requirement: + +.. code-block:: python + + kernelParams = np.array([arg.ctypes.data for arg in kernelValues], dtype=np.intp) + +The launch API supports `Buffer Protocol `_ objects, therefore we can pass the array object directly: + +.. code-block:: python + + checkCudaErrors(cuda.cuLaunchKernel( + kernel, + 1, 1, 1, # grid dim + 1, 1, 1, # block dim + 0, stream, # shared mem and stream + kernelParams=kernelParams, + extra=0, + )) + +Using ctypes +^^^^^^^^^^^^ + +The `ctypes `_ approach relaxes the parameter preparation requirement by delegating the contiguous memory requirement to the API launch call. + +Let's use the same kernel definition as the previous section for the example. + +The ctypes approach treats the ``kernelParams`` argument as a pair of two tuples: ``kernel_values`` and ``kernel_types``. + +* ``kernel_values`` contain Python values to be used as an input to your kernel +* ``kernel_types`` contain the data types that your kernel_values should be converted into + +The ctypes `fundamental data types `_ documentation describes the compatibility between different Python types and C types. +Furthermore, `custom data types `_ can be used to support kernels with custom types. + +For this example the result becomes: + +.. code-block:: python + + # Define a custom type + class testStruct(ctypes.Structure): + _fields_ = [("value", ctypes.c_int)] + + # Allocate device memory + pInt = checkCudaErrors(cudart.cudaMalloc(ctypes.sizeof(ctypes.c_int))) + pFloat = checkCudaErrors(cudart.cudaMalloc(ctypes.sizeof(ctypes.c_float))) + pStruct = checkCudaErrors(cudart.cudaMalloc(ctypes.sizeof(testStruct))) + + # Collect all input kernel arguments into a single tuple for further processing + kernelValues = ( + 1, + pInt, + 123.456, + pFloat, + testStruct(5), + pStruct, + ) + kernelTypes = ( + ctypes.c_int, + ctypes.c_void_p, + ctypes.c_float, + ctypes.c_void_p, + None, + ctypes.c_void_p, + ) + +Values that are set to ``None`` have a special meaning: + +1. The value supports a callable ``getPtr`` that returns the pointer address of the underlining C object address (e.g. all CUDA C types that are exposed to Python as Python classes) +2. The value is an instance of ``ctypes.Structure`` +3. The value is an ``Enum`` + +In all three cases, the API call will fetch the underlying pointer value and construct a contiguous array with other kernel parameters. + +With the setup complete, the kernel can be launched: + +.. code-block:: python + + checkCudaErrors(cuda.cuLaunchKernel( + kernel, + 1, 1, 1, # grid dim + 1, 1, 1, # block dim + 0, stream, # shared mem and stream + kernelParams=(kernelValues, kernelTypes), + extra=0, + )) + +CUDA objects +^^^^^^^^^^^^ + +Certain CUDA kernels use native CUDA types as their parameters such as ``cudaTextureObject_t``. These types require special handling since they're neither a primitive ctype nor a custom user type. Since ``cuda.bindings`` exposes each of them as Python classes, they each implement ``getPtr()`` and ``__int__()``. These two callables used to support the NumPy and ctypes approach. The difference between each call is further described under `Tips and Tricks `_. + +For this example, lets use the ``transformKernel`` from +:cuda-bindings-example:`simple_cubemap_texture.py <0_Introduction/simple_cubemap_texture.py>`. +The :doc:`examples` page links to more samples covering textures, graphs, +memory mapping, and multi-GPU workflows. + +.. code-block:: python + + simpleCubemapTexture = """\ + extern "C" + __global__ void transformKernel(float *g_odata, int width, cudaTextureObject_t tex) + { + ... + } + """ + + def main(): + ... + d_data = checkCudaErrors(cudart.cudaMalloc(size)) + width = 64 + tex = checkCudaErrors(cudart.cudaCreateTextureObject(texRes, texDescr, None)) + ... + +For NumPy, we can convert these CUDA types by leveraging the ``__int__()`` call to fetch the address of the underlying ``cudaTextureObject_t`` C object and wrapping it in a NumPy object array of type ``np.intp``: + +.. code-block:: python + + kernelValues = ( + np.array([d_data], dtype=np.intp), + np.array(width, dtype=np.uint32), + np.array([int(tex)], dtype=np.intp), + ) + kernelArgs = np.array([arg.ctypes.data for arg in kernelValues], dtype=np.intp) + +For ctypes, we leverage the special handling of ``None`` type since each Python class already implements ``getPtr()``: + +.. code-block:: python + + kernelValues = ( + d_data, + width, + tex, + ) + kernelTypes = ( + ctypes.c_void_p, + ctypes.c_int, + None, + ) + kernelArgs = (kernelValues, kernelTypes) diff --git a/cuda_bindings/docs/source/release.rst b/cuda_bindings/docs/source/release.rst new file mode 100644 index 00000000000..f844bfc251d --- /dev/null +++ b/cuda_bindings/docs/source/release.rst @@ -0,0 +1,11 @@ +.. SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +Release Notes +============= + +.. toctree:: + :maxdepth: 3 + :glob: + + release/*[0-9]-notes diff --git a/docs_src/source/release/11.4.0-notes.md b/cuda_bindings/docs/source/release/11.4.0-notes.rst similarity index 74% rename from docs_src/source/release/11.4.0-notes.md rename to cuda_bindings/docs/source/release/11.4.0-notes.rst index f7611688939..afb723b33a2 100644 --- a/docs_src/source/release/11.4.0-notes.md +++ b/cuda_bindings/docs/source/release/11.4.0-notes.rst @@ -1,18 +1,25 @@ -# CUDA Python 11.4.0 Release notes +.. SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +CUDA Python 11.4.0 Release notes +================================ Released on August 16, 2021 -## Hightlights +Highlights +---------- - Initial EA release for CUDA Python - Supports all platforms that CUDA is supported - Supports all CUDA 11.x releases - Low-level CUDA Cython bindings and Python wrappers -## Limitations +Limitations +----------- - Source code release only; Python packages coming in a future release. -### CUDA Functions Not Supported in this Release +CUDA Functions Not Supported in this Release +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - cudaGetTextureReference - cudaGetSurfaceReference diff --git a/docs/_sources/release/11.5.0-notes.md.txt b/cuda_bindings/docs/source/release/11.5.0-notes.rst similarity index 89% rename from docs/_sources/release/11.5.0-notes.md.txt rename to cuda_bindings/docs/source/release/11.5.0-notes.rst index a7f8fddca49..172c3d94e20 100644 --- a/docs/_sources/release/11.5.0-notes.md.txt +++ b/cuda_bindings/docs/source/release/11.5.0-notes.rst @@ -1,8 +1,13 @@ -# CUDA Python 11.5.0 Release notes +.. SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +CUDA Python 11.5.0 Release notes +================================ Released on October 18, 2021 -## Hightlights +Highlights +---------- - PyPi support - Conda support - GA release for CUDA Python @@ -10,11 +15,13 @@ Released on October 18, 2021 - Supports all CUDA 11.x releases - Low-level CUDA Cython bindings and Python wrappers -## Limitations +Limitations +----------- - Changing default stream not supported; coming in future release -### CUDA Functions Not Supported in this Release +CUDA Functions Not Supported in this Release +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - cudaGetTextureReference - cudaGetSurfaceReference diff --git a/docs/_sources/release/11.6.0-notes.md.txt b/cuda_bindings/docs/source/release/11.6.0-notes.rst similarity index 50% rename from docs/_sources/release/11.6.0-notes.md.txt rename to cuda_bindings/docs/source/release/11.6.0-notes.rst index 60a9d9205bd..ec7fbfdc4fa 100644 --- a/docs/_sources/release/11.6.0-notes.md.txt +++ b/cuda_bindings/docs/source/release/11.6.0-notes.rst @@ -1,52 +1,61 @@ -# CUDA Python 11.6.0 Release notes +.. SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +CUDA Python 11.6.0 Release notes +================================ Released on Januray 12, 2022 -## Hightlights +Highlights +---------- - Support CUDA Toolkit 11.6 - Support Profiler APIs - Support Graphic APIs (EGL, GL, VDPAU) - Support changing default stream - Relaxed primitive interoperability -### Default stream +Default stream +^^^^^^^^^^^^^^ Changing default stream to Per-Thread-Default-Stream (PTDS) is done through environment variable before execution: -```{code-block} shell -export CUDA_PYTHON_CUDA_PER_THREAD_DEFAULT_STREAM=1 -``` +.. code-block:: shell + + export CUDA_PYTHON_CUDA_PER_THREAD_DEFAULT_STREAM=1 -When set to 1, the default stream is the per-thread default stream. When set to 0, the default stream is the legacy default stream. This defaults to 0, for the legacy default stream. See [Stream Synchronization Behavior](https://docs.nvidia.com/cuda/cuda-runtime-api/stream-sync-behavior.html) for an explanation of the legacy and per-thread default streams. +When set to 1, the default stream is the per-thread default stream. When set to 0, the default stream is the legacy default stream. This defaults to 0, for the legacy default stream. See `Stream Synchronization Behavior `_ for an explanation of the legacy and per-thread default streams. -### Primitive interoperability +Primitive interoperability +^^^^^^^^^^^^^^^^^^^^^^^^^^ APIs accepting classes that wrap a primitive value are now interoperable with the underlining value. Example 1: Structure member handles interoperability. -```{code-block} python ->>> waitParams = cuda.CUstreamMemOpWaitValueParams_st() ->>> waitParams.value64 = 1 ->>> waitParams.value64 - ->>> waitParams.value64 = cuda.cuuint64_t(2) ->>> waitParams.value64 - -``` +.. code-block:: python + + >>> waitParams = cuda.CUstreamMemOpWaitValueParams_st() + >>> waitParams.value64 = 1 + >>> waitParams.value64 + + >>> waitParams.value64 = cuda.cuuint64_t(2) + >>> waitParams.value64 + Example 2: Function signature handles interoperability. -```{code-block} python ->>> cudart.cudaStreamQuery(cudart.cudaStreamNonBlocking) -(,) ->>> cudart.cudaStreamQuery(cudart.cudaStream_t(cudart.cudaStreamNonBlocking)) -(,) -``` +.. code-block:: python + + >>> cudart.cudaStreamQuery(cudart.cudaStreamNonBlocking) + (,) + >>> cudart.cudaStreamQuery(cudart.cudaStream_t(cudart.cudaStreamNonBlocking)) + (,) -## Limitations +Limitations +----------- -### CUDA Functions Not Supported in this Release +CUDA Functions Not Supported in this Release +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - Symbol APIs - cudaGraphExecMemcpyNodeSetParamsFromSymbol @@ -69,5 +78,4 @@ Example 2: Function signature handles interoperability. - cudaSetValidDevices - cudaVDPAUSetVDPAUDevice -```{note} Deprecated APIs are removed from tracking -``` +.. note:: Deprecated APIs are removed from tracking diff --git a/docs/_sources/release/11.6.1-notes.md.txt b/cuda_bindings/docs/source/release/11.6.1-notes.rst similarity index 67% rename from docs/_sources/release/11.6.1-notes.md.txt rename to cuda_bindings/docs/source/release/11.6.1-notes.rst index bc2ba3293d5..b30ad115b93 100644 --- a/docs/_sources/release/11.6.1-notes.md.txt +++ b/cuda_bindings/docs/source/release/11.6.1-notes.rst @@ -1,13 +1,20 @@ -# CUDA Python 11.6.1 Release notes +.. SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +CUDA Python 11.6.1 Release notes +================================ Released on March 18, 2022 -## Hightlights +Highlights +---------- - Fix string decomposition for WSL library load -## Limitations +Limitations +----------- -### CUDA Functions Not Supported in this Release +CUDA Functions Not Supported in this Release +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - Symbol APIs - cudaGraphExecMemcpyNodeSetParamsFromSymbol diff --git a/docs_src/source/release/11.7.0-notes.md b/cuda_bindings/docs/source/release/11.7.0-notes.rst similarity index 66% rename from docs_src/source/release/11.7.0-notes.md rename to cuda_bindings/docs/source/release/11.7.0-notes.rst index 91ab215e0d0..6a85be2e051 100644 --- a/docs_src/source/release/11.7.0-notes.md +++ b/cuda_bindings/docs/source/release/11.7.0-notes.rst @@ -1,13 +1,20 @@ -# CUDA Python 11.7.0 Release notes +.. SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +CUDA Python 11.7.0 Release notes +================================ Released on May 11, 2022 -## Hightlights +Highlights +---------- - Support CUDA Toolkit 11.7 -## Limitations +Limitations +----------- -### CUDA Functions Not Supported in this Release +CUDA Functions Not Supported in this Release +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - Symbol APIs - cudaGraphExecMemcpyNodeSetParamsFromSymbol diff --git a/docs_src/source/release/11.7.1-notes.md b/cuda_bindings/docs/source/release/11.7.1-notes.rst similarity index 63% rename from docs_src/source/release/11.7.1-notes.md rename to cuda_bindings/docs/source/release/11.7.1-notes.rst index 8d07b19df56..f381ef19c5f 100644 --- a/docs_src/source/release/11.7.1-notes.md +++ b/cuda_bindings/docs/source/release/11.7.1-notes.rst @@ -1,20 +1,29 @@ -# CUDA Python 11.7.1 Release notes +.. SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +CUDA Python 11.7.1 Release notes +================================ Released on June 29, 2022 -## Hightlights +Highlights +---------- - Fix error propagation in CUDA Runtime bindings -- Resolves [issue #22](https://github.com/NVIDIA/cuda-python/issues/22) +- Resolves `issue #22 `_ + +Limitations +----------- -## Limitations +.. _cuda-bindings-11-7-1-source-builds: -### Source builds +Source builds +^^^^^^^^^^^^^ CUDA Python no longer re-declares CUDA types, instead it uses the types from CUDA C headers. As such source builds now need to access to latest CTK headers. In particular: 1. "$CUDA_HOME/include" has latest CTK headers 2. CTK headers have all types defined -(2) Certain CUDA types are not declared on mobile platforms and may face a "has not been declared" error during source builds. A temporary workaround is to use the headers found in [https://gitlab.com/nvidia/headers/cuda](https://gitlab.com/nvidia/headers/cuda). In particular CUDA Python needs the following headers and their dependencies: +(2) Certain CUDA types are not declared on mobile platforms and may face a "has not been declared" error during source builds. A temporary workaround is to use the headers found in `https://gitlab.com/nvidia/headers/cuda `_. In particular CUDA Python needs the following headers and their dependencies: - cuda.h - cudaProfiler.h - driver_types.h @@ -23,7 +32,8 @@ CUDA Python no longer re-declares CUDA types, instead it uses the types from CUD This a short-term limitation and will be relaxed in a future release. -### CUDA Functions Not Supported in this Release +CUDA Functions Not Supported in this Release +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - Symbol APIs - cudaGraphExecMemcpyNodeSetParamsFromSymbol diff --git a/docs_src/source/release/11.8.0-notes.md b/cuda_bindings/docs/source/release/11.8.0-notes.rst similarity index 64% rename from docs_src/source/release/11.8.0-notes.md rename to cuda_bindings/docs/source/release/11.8.0-notes.rst index f860e5fb610..c3837f18a68 100644 --- a/docs_src/source/release/11.8.0-notes.md +++ b/cuda_bindings/docs/source/release/11.8.0-notes.rst @@ -1,22 +1,30 @@ -# CUDA Python 11.8.0 Release notes +.. SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +CUDA Python 11.8.0 Release notes +================================ Released on October 3, 2022 -## Hightlights +Highlights +---------- - Support CUDA Toolkit 11.8 - Source builds allow for missing types and APIs - Resolves source builds for mobile platforms -- Resolves [issue #24](https://github.com/NVIDIA/cuda-python/issues/24) +- Resolves `issue #24 `_ -### Source Builds +Source Builds +^^^^^^^^^^^^^ -CUDA Python source builds now parse CUDA headers located in $CUDA_HOME directory, enabling/disabling types and APIs if defined. Therefore this removes the need for CTK headers to have all types defined. By allowing minor variations, previous [11.7.1 mobile platform workaround](https://nvidia.github.io/cuda-python/release/11.7.1-notes.html#source-builds) is no longer needed. +CUDA Python source builds now parse CUDA headers located in $CUDA_HOME directory, enabling/disabling types and APIs if defined. Therefore this removes the need for CTK headers to have all types defined. By allowing minor variations, previous :ref:`11.7.1 mobile platform workaround ` is no longer needed. It's still required that source builds use the latest CTK headers (i.e. “$CUDA_HOME/include” has latest CTK headers). -## Limitations +Limitations +----------- -### CUDA Functions Not Supported in this Release +CUDA Functions Not Supported in this Release +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - Symbol APIs - cudaGraphExecMemcpyNodeSetParamsFromSymbol diff --git a/docs/_sources/release/11.8.1-notes.md.txt b/cuda_bindings/docs/source/release/11.8.1-notes.rst similarity index 62% rename from docs/_sources/release/11.8.1-notes.md.txt rename to cuda_bindings/docs/source/release/11.8.1-notes.rst index 94565355cce..0c6b7351ef0 100644 --- a/docs/_sources/release/11.8.1-notes.md.txt +++ b/cuda_bindings/docs/source/release/11.8.1-notes.rst @@ -1,14 +1,21 @@ -# CUDA Python 11.8.1 Release notes +.. SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +CUDA Python 11.8.1 Release notes +================================ Released on November 4, 2022 -## Hightlights -- Resolves [issue #27](https://github.com/NVIDIA/cuda-python/issues/27) +Highlights +---------- +- Resolves `issue #27 `_ - Update install instructions to use latest CTK -## Limitations +Limitations +----------- -### CUDA Functions Not Supported in this Release +CUDA Functions Not Supported in this Release +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - Symbol APIs - cudaGraphExecMemcpyNodeSetParamsFromSymbol diff --git a/docs_src/source/release/11.8.2-notes.md b/cuda_bindings/docs/source/release/11.8.2-notes.rst similarity index 66% rename from docs_src/source/release/11.8.2-notes.md rename to cuda_bindings/docs/source/release/11.8.2-notes.rst index 84d781b5fdc..b5d5e768657 100644 --- a/docs_src/source/release/11.8.2-notes.md +++ b/cuda_bindings/docs/source/release/11.8.2-notes.rst @@ -1,13 +1,20 @@ -# CUDA Python 11.8.2 Release notes +.. SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +CUDA Python 11.8.2 Release notes +================================ Released on May 18, 2023 -## Hightlights +Highlights +---------- - Open libcuda.so.1 instead of libcuda.so -## Limitations +Limitations +----------- -### CUDA Functions Not Supported in this Release +CUDA Functions Not Supported in this Release +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - Symbol APIs - cudaGraphExecMemcpyNodeSetParamsFromSymbol diff --git a/docs/_sources/release/11.8.3-notes.md.txt b/cuda_bindings/docs/source/release/11.8.3-notes.rst similarity index 68% rename from docs/_sources/release/11.8.3-notes.md.txt rename to cuda_bindings/docs/source/release/11.8.3-notes.rst index 91bbc491486..cb642daadb8 100644 --- a/docs/_sources/release/11.8.3-notes.md.txt +++ b/cuda_bindings/docs/source/release/11.8.3-notes.rst @@ -1,15 +1,22 @@ -# CUDA Python 11.8.3 Release notes +.. SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +CUDA Python 11.8.3 Release notes +================================ Released on October 23, 2023 -## Hightlights +Highlights +---------- - Compatability with Cython 3 - New API cudart.getLocalRuntimeVersion() - Modernize build config -## Limitations +Limitations +----------- -### CUDA Functions Not Supported in this Release +CUDA Functions Not Supported in this Release +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - Symbol APIs - cudaGraphExecMemcpyNodeSetParamsFromSymbol diff --git a/cuda_bindings/docs/source/release/11.8.4-notes.rst b/cuda_bindings/docs/source/release/11.8.4-notes.rst new file mode 100644 index 00000000000..a0360bc1e93 --- /dev/null +++ b/cuda_bindings/docs/source/release/11.8.4-notes.rst @@ -0,0 +1,62 @@ +.. SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +CUDA Python 11.8.4 Release notes +================================ + +Released on October 7, 2024 + +Highlights +---------- +- Resolve `Issue #89 `_: Fix getLocalRuntimeVersion searching for wrong libcudart version +- Resolve `Issue #90 `_: Use new layout in preperation for cuda-python becoming a metapackage + +CUDA namespace cleanup with a new module layout +----------------------------------------------- + +`Issue #75 `_ explains in detail what the new module layout is, what problem it fixes and how it impacts the users. However for the sake of completeness, this release notes will highlight key points of this change. + +Before this change, ``cuda-python`` was tightly coupled to CUDA Toolkit releases and all new features would inherit this coupling regardless of their applicability. As we develop new features, this coupling was becoming overly restrictive and motivated a new solution: Convert ``cuda-python`` into a metapackage where we use ``cuda`` as a namespace with existing bindings code moved to a ``cuda_bindings`` subpackage. + +This patch release applies the new module layout for the bindings as follows: +- ``cuda.cuda`` -> ``cuda.bindings.driver`` +- ``cuda.ccuda`` -> ``cuda.bindings.cydriver`` +- ``cuda.cudart`` -> ``cuda.bindings.runtime`` +- ``cuda.ccudart`` -> ``cuda.bindings.cyruntime`` +- ``cuda.nvrtc`` -> ``cuda.bindings.nvrtc`` +- ``cuda.cnvrtc`` -> ``cuda.bindings.cynvrtc`` + +Deprecation warnings are turned on as a notice to switch to the new module layout. + +.. note:: This is non-breaking, backwards compatible change. All old module path will continue work as they "forward" user calls towards the new layout. + +Limitations +----------- + +Know issues +^^^^^^^^^^^ +- `Issue #215 `_ + +CUDA Functions Not Supported in this Release +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +- Symbol APIs + - cudaGraphExecMemcpyNodeSetParamsFromSymbol + - cudaGraphExecMemcpyNodeSetParamsToSymbol + - cudaGraphAddMemcpyNodeToSymbol + - cudaGraphAddMemcpyNodeFromSymbol + - cudaGraphMemcpyNodeSetParamsToSymbol + - cudaGraphMemcpyNodeSetParamsFromSymbol + - cudaMemcpyToSymbol + - cudaMemcpyFromSymbol + - cudaMemcpyToSymbolAsync + - cudaMemcpyFromSymbolAsync + - cudaGetSymbolAddress + - cudaGetSymbolSize + - cudaGetFuncBySymbol +- Launch Options + - cudaLaunchKernel + - cudaLaunchCooperativeKernel + - cudaLaunchCooperativeKernelMultiDevice +- cudaSetValidDevices +- cudaVDPAUSetVDPAUDevice diff --git a/cuda_bindings/docs/source/release/11.8.5-notes.rst b/cuda_bindings/docs/source/release/11.8.5-notes.rst new file mode 100644 index 00000000000..54a4de15906 --- /dev/null +++ b/cuda_bindings/docs/source/release/11.8.5-notes.rst @@ -0,0 +1,39 @@ +.. SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +CUDA Python 11.8.5 Release notes +================================ + +Released on November 5, 2024. Post 1 rebuild released on November 12, 2024. + +Highlights +---------- +- Resolve `Issue #215 `_: module ``cuda.ccudart`` has no attribute ``__pyx_capi__`` +- Resolve `Issue #226 `_: top-level Cython source files not packaged + +Limitations +----------- + +CUDA Functions Not Supported in this Release +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +- Symbol APIs + - cudaGraphExecMemcpyNodeSetParamsFromSymbol + - cudaGraphExecMemcpyNodeSetParamsToSymbol + - cudaGraphAddMemcpyNodeToSymbol + - cudaGraphAddMemcpyNodeFromSymbol + - cudaGraphMemcpyNodeSetParamsToSymbol + - cudaGraphMemcpyNodeSetParamsFromSymbol + - cudaMemcpyToSymbol + - cudaMemcpyFromSymbol + - cudaMemcpyToSymbolAsync + - cudaMemcpyFromSymbolAsync + - cudaGetSymbolAddress + - cudaGetSymbolSize + - cudaGetFuncBySymbol +- Launch Options + - cudaLaunchKernel + - cudaLaunchCooperativeKernel + - cudaLaunchCooperativeKernelMultiDevice +- cudaSetValidDevices +- cudaVDPAUSetVDPAUDevice diff --git a/cuda_bindings/docs/source/release/11.8.6-notes.rst b/cuda_bindings/docs/source/release/11.8.6-notes.rst new file mode 100644 index 00000000000..9d3acc4122f --- /dev/null +++ b/cuda_bindings/docs/source/release/11.8.6-notes.rst @@ -0,0 +1,35 @@ +.. SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +``cuda-bindings`` 11.8.6 Release notes +========================================== + +Released on January 24, 2025. + +Highlights +---------- + +- Support Python 3.13 +- Add an optional dependency on the CUDA NVRTC wheel +- Enable discovery and loading of shared libraries from CUDA wheels +- ``cuda-python`` is now a meta package, currently depending only on ``cuda-bindings`` (`see RFC `_) + +Wheels support for optional dependencies +---------------------------------------- + +Optional dependencies are added for packages: + +- nvidia-cuda-nvrtc-cu12 + +Installing these dependencies with ``cuda-python`` can be done using: + +.. code-block:: shell + + pip install cuda-python[all] + +Same applies to ``cuda-bindings``. + +Discovery and loading of shared library dependencies from wheels +---------------------------------------------------------------- + +Shared library search paths for wheel builds are now extended to check site-packages. This allows ``cuda-python``/``cuda-bindings`` to seamlessly use the aforementioned CUDA Toolkit wheels installed in the user's Python environment. diff --git a/cuda_bindings/docs/source/release/11.8.7-notes.rst b/cuda_bindings/docs/source/release/11.8.7-notes.rst new file mode 100644 index 00000000000..ab38253ceeb --- /dev/null +++ b/cuda_bindings/docs/source/release/11.8.7-notes.rst @@ -0,0 +1,27 @@ +.. SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +``cuda-bindings`` 11.8.7 Release notes +====================================== + +Released on May 5, 2025. + + +Highlights +---------- + +* The ``cuda.bindings.nvvm`` Python module was added, wrapping the + `libNVVM C API `_. + + +Bug fixes +--------- + +* Fix segfault when converting char* NULL to bytes + + +Known issues +------------ + +* Compute-sanitizer may report ``CUDA_ERROR_INVALID_CONTEXT`` when calling certain CUDA + runtime APIs such as ``cudaGetDevice()``. This is fixed in ``cuda-bindings`` 12.9.0. diff --git a/docs/_sources/release/12.0.0-notes.md.txt b/cuda_bindings/docs/source/release/12.0.0-notes.rst similarity index 58% rename from docs/_sources/release/12.0.0-notes.md.txt rename to cuda_bindings/docs/source/release/12.0.0-notes.rst index df1bf1f90d0..75ac832083b 100644 --- a/docs/_sources/release/12.0.0-notes.md.txt +++ b/cuda_bindings/docs/source/release/12.0.0-notes.rst @@ -1,15 +1,22 @@ -# CUDA Python 12.0.0 Release notes +.. SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +CUDA Python 12.0.0 Release notes +================================ Released on December 8, 2022 -## Hightlights +Highlights +---------- - Rebase to CUDA Toolkit 12.0 -- Fix example from [MR28](https://github.com/NVIDIA/cuda-python/pull/28) -- Apply [MR35](https://github.com/NVIDIA/cuda-python/pull/35) +- Fix example from `MR28 `_ +- Apply `MR35 `_ -## Limitations +Limitations +----------- -### CUDA Functions Not Supported in this Release +CUDA Functions Not Supported in this Release +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - Symbol APIs - cudaGraphExecMemcpyNodeSetParamsFromSymbol diff --git a/docs/_sources/release/12.1.0-notes.md.txt b/cuda_bindings/docs/source/release/12.1.0-notes.rst similarity index 51% rename from docs/_sources/release/12.1.0-notes.md.txt rename to cuda_bindings/docs/source/release/12.1.0-notes.rst index aec56999e6e..371d943b3fd 100644 --- a/docs/_sources/release/12.1.0-notes.md.txt +++ b/cuda_bindings/docs/source/release/12.1.0-notes.rst @@ -1,16 +1,23 @@ -# CUDA Python 12.1.0 Release notes +.. SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +CUDA Python 12.1.0 Release notes +================================ Released on February 28, 2023 -## Hightlights +Highlights +---------- - Rebase to CUDA Toolkit 12.1 -- Resolve [Issue #41](https://github.com/NVIDIA/cuda-python/issues/41): Add support for Python 3.11 -- Resolve [Issue #42](https://github.com/NVIDIA/cuda-python/issues/42): Dropping Python 3.7 -- Resolve [Issue #43](https://github.com/NVIDIA/cuda-python/issues/43): Trim Conda package dependencies +- Resolve `Issue #41 `_: Add support for Python 3.11 +- Resolve `Issue #42 `_: Dropping Python 3.7 +- Resolve `Issue #43 `_: Trim Conda package dependencies -## Limitations +Limitations +----------- -### CUDA Functions Not Supported in this Release +CUDA Functions Not Supported in this Release +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - Symbol APIs - cudaGraphExecMemcpyNodeSetParamsFromSymbol diff --git a/docs/_sources/release/12.2.0-notes.md.txt b/cuda_bindings/docs/source/release/12.2.0-notes.rst similarity index 53% rename from docs/_sources/release/12.2.0-notes.md.txt rename to cuda_bindings/docs/source/release/12.2.0-notes.rst index d6bd6675169..e39bdb3402c 100644 --- a/docs/_sources/release/12.2.0-notes.md.txt +++ b/cuda_bindings/docs/source/release/12.2.0-notes.rst @@ -1,15 +1,22 @@ -# CUDA Python 12.2.0 Release notes +.. SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +CUDA Python 12.2.0 Release notes +================================ Released on June 28, 2023 -## Hightlights +Highlights +---------- - Rebase to CUDA Toolkit 12.2 -- Resolve [Issue #44](https://github.com/NVIDIA/cuda-python/issues/44): nogil must be at the end of the function signature line -- Resolve [Issue #45](https://github.com/NVIDIA/cuda-python/issues/45): Error with pyparsing when no CUDA is found +- Resolve `Issue #44 `_: nogil must be at the end of the function signature line +- Resolve `Issue #45 `_: Error with pyparsing when no CUDA is found -## Limitations +Limitations +----------- -### CUDA Functions Not Supported in this Release +CUDA Functions Not Supported in this Release +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - Symbol APIs - cudaGraphExecMemcpyNodeSetParamsFromSymbol diff --git a/docs/_sources/release/12.2.1-notes.md.txt b/cuda_bindings/docs/source/release/12.2.1-notes.rst similarity index 66% rename from docs/_sources/release/12.2.1-notes.md.txt rename to cuda_bindings/docs/source/release/12.2.1-notes.rst index 41704a56676..6a004d93445 100644 --- a/docs/_sources/release/12.2.1-notes.md.txt +++ b/cuda_bindings/docs/source/release/12.2.1-notes.rst @@ -1,13 +1,20 @@ -# CUDA Python 12.2.1 Release notes +.. SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +CUDA Python 12.2.1 Release notes +================================ Released on January 8, 2024 -## Hightlights +Highlights +---------- - Compatibility with Cython 3 -## Limitations +Limitations +----------- -### CUDA Functions Not Supported in this Release +CUDA Functions Not Supported in this Release +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - Symbol APIs - cudaGraphExecMemcpyNodeSetParamsFromSymbol diff --git a/docs_src/source/release/12.3.0-notes.md b/cuda_bindings/docs/source/release/12.3.0-notes.rst similarity index 50% rename from docs_src/source/release/12.3.0-notes.md rename to cuda_bindings/docs/source/release/12.3.0-notes.rst index 016ee0dec2b..b917965a90b 100644 --- a/docs_src/source/release/12.3.0-notes.md +++ b/cuda_bindings/docs/source/release/12.3.0-notes.rst @@ -1,17 +1,24 @@ -# CUDA Python 12.3.0 Release notes +.. SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +CUDA Python 12.3.0 Release notes +================================ Released on October 19, 2023 -## Hightlights +Highlights +---------- - Rebase to CUDA Toolkit 12.3 -- Resolve [Issue #16](https://github.com/NVIDIA/cuda-python/issues/16): cuda.cudart.cudaRuntimeGetVersion() hard-codes the runtime version, rather than querying the runtime +- Resolve `Issue #16 `_: cuda.cudart.cudaRuntimeGetVersion() hard-codes the runtime version, rather than querying the runtime - New API cudart.getLocalRuntimeVersion() -- Resolve [Issue #48](https://github.com/NVIDIA/cuda-python/issues/48): Dropping Python 3.8 -- Resolve [Issue #51](https://github.com/NVIDIA/cuda-python/issues/51): Dropping package releases for ppc64 on PYPI and conda-nvidia channel +- Resolve `Issue #48 `_: Dropping Python 3.8 +- Resolve `Issue #51 `_: Dropping package releases for ppc64 on PYPI and conda-nvidia channel -## Limitations +Limitations +----------- -### CUDA Functions Not Supported in this Release +CUDA Functions Not Supported in this Release +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - Symbol APIs - cudaGraphExecMemcpyNodeSetParamsFromSymbol diff --git a/docs/_sources/release/12.4.0-notes.md.txt b/cuda_bindings/docs/source/release/12.4.0-notes.rst similarity index 69% rename from docs/_sources/release/12.4.0-notes.md.txt rename to cuda_bindings/docs/source/release/12.4.0-notes.rst index 6daedb209ea..8c9d91c60f3 100644 --- a/docs/_sources/release/12.4.0-notes.md.txt +++ b/cuda_bindings/docs/source/release/12.4.0-notes.rst @@ -1,14 +1,21 @@ -# CUDA Python 12.4.0 Release notes +.. SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +CUDA Python 12.4.0 Release notes +================================ Released on March 5, 2024 -## Hightlights +Highlights +---------- - Rebase to CUDA Toolkit 12.4 - Add PyPI/Conda support for Python 12 -## Limitations +Limitations +----------- -### CUDA Functions Not Supported in this Release +CUDA Functions Not Supported in this Release +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - Symbol APIs - cudaGraphExecMemcpyNodeSetParamsFromSymbol diff --git a/docs/_sources/release/12.5.0-notes.md.txt b/cuda_bindings/docs/source/release/12.5.0-notes.rst similarity index 61% rename from docs/_sources/release/12.5.0-notes.md.txt rename to cuda_bindings/docs/source/release/12.5.0-notes.rst index 701f0320ab3..8259af1ebe7 100644 --- a/docs/_sources/release/12.5.0-notes.md.txt +++ b/cuda_bindings/docs/source/release/12.5.0-notes.rst @@ -1,14 +1,21 @@ -# CUDA Python 12.5.0 Release notes +.. SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +CUDA Python 12.5.0 Release notes +================================ Released on May 21, 2024 -## Hightlights +Highlights +---------- - Rebase to CUDA Toolkit 12.5 -- Resolve [Issue #58](https://github.com/NVIDIA/cuda-python/issues/58): Interop between CUdeviceptr and Runtime +- Resolve `Issue #58 `_: Interop between CUdeviceptr and Runtime -## Limitations +Limitations +----------- -### CUDA Functions Not Supported in this Release +CUDA Functions Not Supported in this Release +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - Symbol APIs - cudaGraphExecMemcpyNodeSetParamsFromSymbol diff --git a/cuda_bindings/docs/source/release/12.6.0-notes.rst b/cuda_bindings/docs/source/release/12.6.0-notes.rst new file mode 100644 index 00000000000..10e336aae46 --- /dev/null +++ b/cuda_bindings/docs/source/release/12.6.0-notes.rst @@ -0,0 +1,43 @@ +.. SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +CUDA Python 12.6.0 Release notes +================================ + +Released on August 1, 2024 + +Highlights +---------- +- Rebase to CUDA Toolkit 12.6 +- Resolve `Issue #32 `_: Add 'pywin32' as Windows requirement +- Resolve `Issue #72 `_: Allow both lists and tuples as parameter +- Resolve `Issue #73 `_: Fix 'cuLibraryLoadData' processing of parameters + +Limitations +----------- + +CUDA Functions Not Supported in this Release +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +- Symbol APIs + - cudaGraphExecMemcpyNodeSetParamsFromSymbol + - cudaGraphExecMemcpyNodeSetParamsToSymbol + - cudaGraphAddMemcpyNodeToSymbol + - cudaGraphAddMemcpyNodeFromSymbol + - cudaGraphMemcpyNodeSetParamsToSymbol + - cudaGraphMemcpyNodeSetParamsFromSymbol + - cudaMemcpyToSymbol + - cudaMemcpyFromSymbol + - cudaMemcpyToSymbolAsync + - cudaMemcpyFromSymbolAsync + - cudaGetSymbolAddress + - cudaGetSymbolSize + - cudaGetFuncBySymbol +- Launch Options + - cudaLaunchKernel + - cudaLaunchCooperativeKernel + - cudaLaunchCooperativeKernelMultiDevice +- cudaSetValidDevices +- cudaVDPAUSetVDPAUDevice +- cudaFuncGetName +- cudaFuncGetParamInfo diff --git a/cuda_bindings/docs/source/release/12.6.1-notes.rst b/cuda_bindings/docs/source/release/12.6.1-notes.rst new file mode 100644 index 00000000000..8ca01b605f9 --- /dev/null +++ b/cuda_bindings/docs/source/release/12.6.1-notes.rst @@ -0,0 +1,64 @@ +.. SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +CUDA Python 12.6.1 Release notes +================================ + +Released on October 7, 2024 + +Highlights +---------- +- Resolve `Issue #90 `_: Use new layout in preparation for cuda-python becoming a metapackage +- Resolve `Issue #75 `_: CUDA namespace cleanup + +CUDA namespace cleanup with a new module layout +----------------------------------------------- + +`Issue #75 `_ explains in detail what the new module layout is, what problem it fixes and how it impacts the users. However for the sake of completeness, this release notes will highlight key points of this change. + +Before this change, ``cuda-python`` was tightly coupled to CUDA Toolkit releases and all new features would inherit this coupling regardless of their applicability. As we develop new features, this coupling was becoming overly restrictive and motivated a new solution: Convert ``cuda-python`` into a metapackage where we use ``cuda`` as a namespace with existing bindings code moved to a ``cuda_bindings`` subpackage. + +This patch release applies the new module layout for the bindings as follows: +- ``cuda.cuda`` -> ``cuda.bindings.driver`` +- ``cuda.ccuda`` -> ``cuda.bindings.cydriver`` +- ``cuda.cudart`` -> ``cuda.bindings.runtime`` +- ``cuda.ccudart`` -> ``cuda.bindings.cyruntime`` +- ``cuda.nvrtc`` -> ``cuda.bindings.nvrtc`` +- ``cuda.cnvrtc`` -> ``cuda.bindings.cynvrtc`` + +Deprecation warnings are turned on as a notice to switch to the new module layout. + +.. note:: This is non-breaking, backwards compatible change. All old module path will continue work as they "forward" user calls towards the new layout. + +Limitations +----------- + +Know issues +^^^^^^^^^^^ +- `Issue #215 `_ + +CUDA Functions Not Supported in this Release +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +- Symbol APIs + - cudaGraphExecMemcpyNodeSetParamsFromSymbol + - cudaGraphExecMemcpyNodeSetParamsToSymbol + - cudaGraphAddMemcpyNodeToSymbol + - cudaGraphAddMemcpyNodeFromSymbol + - cudaGraphMemcpyNodeSetParamsToSymbol + - cudaGraphMemcpyNodeSetParamsFromSymbol + - cudaMemcpyToSymbol + - cudaMemcpyFromSymbol + - cudaMemcpyToSymbolAsync + - cudaMemcpyFromSymbolAsync + - cudaGetSymbolAddress + - cudaGetSymbolSize + - cudaGetFuncBySymbol +- Launch Options + - cudaLaunchKernel + - cudaLaunchCooperativeKernel + - cudaLaunchCooperativeKernelMultiDevice +- cudaSetValidDevices +- cudaVDPAUSetVDPAUDevice +- cudaFuncGetName +- cudaFuncGetParamInfo diff --git a/docs_src/source/release/12.4.0-notes.md b/cuda_bindings/docs/source/release/12.6.2-notes.rst similarity index 50% rename from docs_src/source/release/12.4.0-notes.md rename to cuda_bindings/docs/source/release/12.6.2-notes.rst index 6daedb209ea..8dc9aebcf03 100644 --- a/docs_src/source/release/12.4.0-notes.md +++ b/cuda_bindings/docs/source/release/12.6.2-notes.rst @@ -1,14 +1,21 @@ -# CUDA Python 12.4.0 Release notes +.. SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 -Released on March 5, 2024 +CUDA Python 12.6.2 Release notes +================================ -## Hightlights -- Rebase to CUDA Toolkit 12.4 -- Add PyPI/Conda support for Python 12 +Released on November 5, 2024. Post 1 rebuild released on November 12, 2024. -## Limitations +Highlights +---------- +- Resolve `Issue #215 `_: module ``cuda.ccudart`` has no attribute ``__pyx_capi__`` +- Resolve `Issue #226 `_: top-level Cython source files not packaged -### CUDA Functions Not Supported in this Release +Limitations +----------- + +CUDA Functions Not Supported in this Release +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - Symbol APIs - cudaGraphExecMemcpyNodeSetParamsFromSymbol diff --git a/cuda_bindings/docs/source/release/12.8.0-notes.rst b/cuda_bindings/docs/source/release/12.8.0-notes.rst new file mode 100644 index 00000000000..41c2cb930ea --- /dev/null +++ b/cuda_bindings/docs/source/release/12.8.0-notes.rst @@ -0,0 +1,42 @@ +.. SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +``cuda-bindings`` 12.8.0 Release notes +========================================== + +Released on January 24, 2025. + +Highlights +---------- + +- Support Python 3.13 +- Add bindings for nvJitLink (requires nvJitLink from CUDA 12.3 or above) +- Add optional dependencies on CUDA NVRTC and nvJitLink wheels +- Enable discovery and loading of shared libraries from CUDA wheels +- ``cuda-python`` is now a meta package, currently depending only on ``cuda-bindings`` (`see RFC `_) + +Wheels support for optional dependencies +---------------------------------------- + +Optional dependencies are added for packages: + +- nvidia-cuda-nvrtc-cu12 +- nvidia-nvjitlink-cu12 + +Installing these dependencies with ``cuda-python`` can be done using: + +.. code-block:: shell + + pip install cuda-python[all] + +Same applies to ``cuda-bindings``. + +Discovery and loading of shared library dependencies from wheels +---------------------------------------------------------------- + +Shared library search paths for wheel builds are now extended to check site-packages. This allows ``cuda-python``/``cuda-bindings`` to seamlessly use the aforementioned CUDA Toolkit wheels installed in the user's Python environment. + +Known issues +------------ + +- Updating from older versions (v12.6.2.post1 and below) via ``pip install -U cuda-python`` might not work. Please do a clean re-installation by uninstalling ``pip uninstall -y cuda-python`` followed by installing ``pip install cuda-python``. diff --git a/cuda_bindings/docs/source/release/12.9.0-notes.rst b/cuda_bindings/docs/source/release/12.9.0-notes.rst new file mode 100644 index 00000000000..40b6c0ac853 --- /dev/null +++ b/cuda_bindings/docs/source/release/12.9.0-notes.rst @@ -0,0 +1,42 @@ +.. SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +``cuda-bindings`` 12.9.0 Release notes +====================================== + +Released on May 5, 2025 + + +Highlights +---------- + +* The ``cuda.bindings.nvvm`` Python module was added, wrapping the + `libNVVM C API `_ +* Source build error checking added for missing required headers +* Statically link CUDA Runtime instead of reimplementing it +* Move stream callback wrappers to the Python layer +* Return code construction is made faster + + +Bug fixes +--------- + +* Fix segfault when converting char* NULL to bytes +* Failed API calls return None for non error code tuple elements +* Compute-sanitizer may report ``CUDA_ERROR_INVALID_CONTEXT`` when calling certain CUDA + runtime APIs such as ``cudaGetDevice()`` + + +Miscellaneous +------------- + +* Benchmark suite is updated +* Improvements in the introductory code samples +* Fix performance hint warnings raised by Cython 3 +* Improvements in the Overview page + + +Known issues +------------ + +* Updating from older versions (v12.6.2.post1 and below) via ``pip install -U cuda-python`` might not work. Please do a clean re-installation by uninstalling ``pip uninstall -y cuda-python`` followed by installing ``pip install cuda-python``. diff --git a/cuda_bindings/docs/source/release/12.9.1-notes.rst b/cuda_bindings/docs/source/release/12.9.1-notes.rst new file mode 100644 index 00000000000..bb536b8a135 --- /dev/null +++ b/cuda_bindings/docs/source/release/12.9.1-notes.rst @@ -0,0 +1,51 @@ +.. SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +.. module:: cuda.bindings + +``cuda-bindings`` 12.9.1 Release notes +====================================== + +Released on Aug 6, 2025 + + +Highlights +---------- + +* A utility module :mod:`cuda.bindings.utils` is added + + * Using ``int(cuda_obj)`` to retrieve the underlying address of a CUDA object is deprecated and + subject to future removal. Please switch to use :func:`~cuda.bindings.utils.get_cuda_native_handle` + instead. + +* The ``cuda.bindings.cufile`` Python module was added, wrapping the + `cuFile C APIs `_. + Supported on Linux only. + + * Currently using this module requires NumPy to be present. Any recent NumPy 1.x or 2.x should work. + +* Python bindings in every module, including ``driver``, ``runtime``, and ``nvrtc``, now have the GIL + released before calling the underlying C APIs. + + +Bug fixes +--------- + +* Fix a library loading bug that preferred shared libraries without a SOVERSION. + + +Miscellaneous +------------- + +* All Python bindings now have the GIL released when calling into the underlying C APIs. +* Added PTX utilities including :func:`~utils.get_minimal_required_cuda_ver_from_ptx_ver` and :func:`~utils.get_ptx_ver`. +* Common CUDA objects such as :class:`~runtime.cudaStream_t` now compare equal if the underlying address is the same. +* Add a binding to ``nvvmGetErrorString()``. +* Build the bindings with Cython profile hooks disabled. +* The internal pathfinder module is now isolated to a standalone package ``cuda-pathfinder`` and made as a required dependency. + + +Known issues +------------ + +* Updating from older versions (v12.6.2.post1 and below) via ``pip install -U cuda-python`` might not work. Please do a clean re-installation by uninstalling ``pip uninstall -y cuda-python`` followed by installing ``pip install cuda-python``. diff --git a/cuda_bindings/docs/source/release/12.9.2-notes.rst b/cuda_bindings/docs/source/release/12.9.2-notes.rst new file mode 100644 index 00000000000..11d3bf0af31 --- /dev/null +++ b/cuda_bindings/docs/source/release/12.9.2-notes.rst @@ -0,0 +1,21 @@ +.. SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +.. module:: cuda.bindings + +``cuda-bindings`` 12.9.2 Release notes +====================================== + +Released on Aug 18, 2025 + + +Highlights +---------- + +* Make populating the internal symbol table thread-safe. + + +Known issues +------------ + +* Updating from older versions (v12.6.2.post1 and below) via ``pip install -U cuda-python`` might not work. Please do a clean re-installation by uninstalling ``pip uninstall -y cuda-python`` followed by installing ``pip install cuda-python``. diff --git a/cuda_bindings/docs/source/release/12.9.3-notes.rst b/cuda_bindings/docs/source/release/12.9.3-notes.rst new file mode 100644 index 00000000000..66876a7f3eb --- /dev/null +++ b/cuda_bindings/docs/source/release/12.9.3-notes.rst @@ -0,0 +1,29 @@ +.. SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +.. module:: cuda.bindings + +``cuda-bindings`` 12.9.3 Release notes +====================================== + +Released on Oct 9, 2025 + + +Highlights +---------- + +* This is the last release that officially supports Python 3.9. +* Python 3.14 is supported. +* **Experimental** free-threaded builds for Python 3.13/3.14 are made available. Any bugs can be reported to `our GitHub repo `_. More details are available in our :ref:`support` docs. +* Automatic CUDA library path detection based on ``CUDA_HOME``, eliminating the need to manually set ``LIBRARY_PATH`` environment variables for installation. +* The Python overhead of calling functions in CUDA bindings in ``driver``, ``runtime`` and ``nvrtc`` has been reduced by approximately 30%. +* On Windows, the ``pywin32`` dependency has been removed. The necessary Windows API functions are now accessed directly. +* Updated the ``cuda.bindings.runtime`` module to statically link against the CUDA Runtime library from CUDA Toolkit 12.9.1. +* ``cyruntime.getLocalRuntimeVersion`` now uses pathfinder to find the CUDA runtime. + + +Known issues +------------ + +* Updating from older versions (v12.6.2.post1 and below) via ``pip install -U cuda-python`` might not work. Please do a clean re-installation by uninstalling ``pip uninstall -y cuda-python`` followed by installing ``pip install cuda-python``. +* The graphics APIs in ``cuda.bindings.runtime`` are inadvertently disabled in 12.9.3. Users needing these APIs should update to 12.9.4. diff --git a/cuda_bindings/docs/source/release/12.9.4-notes.rst b/cuda_bindings/docs/source/release/12.9.4-notes.rst new file mode 100644 index 00000000000..79abcd35dba --- /dev/null +++ b/cuda_bindings/docs/source/release/12.9.4-notes.rst @@ -0,0 +1,23 @@ +.. SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +.. module:: cuda.bindings + +``cuda-bindings`` 12.9.4 Release notes +====================================== + + + +Highlights +---------- + + +Bug fixes +--------- + +* The graphics APIs in ``cuda.bindings.runtime`` were inadvertently disabled in 12.9.3. This has been fixed. + +Known issues +------------ + +* Updating from older versions (v12.6.2.post1 and below) via ``pip install -U cuda-python`` might not work. Please do a clean re-installation by uninstalling ``pip uninstall -y cuda-python`` followed by installing ``pip install cuda-python``. diff --git a/cuda_bindings/docs/source/release/12.9.5-notes.rst b/cuda_bindings/docs/source/release/12.9.5-notes.rst new file mode 100644 index 00000000000..13c49394a29 --- /dev/null +++ b/cuda_bindings/docs/source/release/12.9.5-notes.rst @@ -0,0 +1,29 @@ +.. SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +.. module:: cuda.bindings + +``cuda-bindings`` 12.9.5 Release notes +====================================== + +Highlights +---------- + +* Added ``__cuda_stream__`` protocol support to ``driver.CUStream`` class, enabling better interoperability with libraries that expect this protocol. +* Python 3.9 support was dropped (end of life). + +Bug fixes +--------- + +* Fixed ``cuStreamBeginCaptureToGraph`` to allow the ``dependencyData`` argument to be optional, matching the underlying CUDA API behavior. + +Experimental +------------ + +* Experimental NVML bindings were added under ``cuda.bindings._nvml``. + +Known issues +------------ + +* Updating from older versions (v12.6.2.post1 and below) via ``pip install -U cuda-python`` might not work. Please do a clean re-installation by uninstalling ``pip uninstall -y cuda-python`` followed by installing ``pip install cuda-python``. +* The graphics APIs in ``cuda.bindings.runtime`` are inadvertently disabled in 12.9.3. Users needing these APIs should update to 12.9.4 or higher. diff --git a/cuda_bindings/docs/source/release/12.9.6-notes.rst b/cuda_bindings/docs/source/release/12.9.6-notes.rst new file mode 100644 index 00000000000..1589796ed9a --- /dev/null +++ b/cuda_bindings/docs/source/release/12.9.6-notes.rst @@ -0,0 +1,64 @@ +.. SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +.. module:: cuda.bindings + +``cuda-bindings`` 12.9.6 Release notes +====================================== + +Highlights +---------- + +* ``cuda.bindings.nvml`` has graduated from experimental (``cuda.bindings._nvml``) + to a fully supported public module with extensive handwritten Pythonic API + coverage spanning ~170 functions across system queries, device discovery, + memory, power, clocks, utilization, thermals, NVLink, and device configuration. + (`PR #1524 `_, + `PR #1548 `_) +* Add ``nvFatbin`` bindings. + (`PR #1467 `_) +* Performance improvement: ``cuda.bindings`` now uses a faster ``enum`` + implementation, rather than the standard library's ``enum.IntEnum``. + This leads to much faster import times, and slightly faster attribute access + times. + (`PR #1581 `_) +* Multiple performance improvements cumulatively reducing Python-to-C call + overhead through faster ``void *`` conversion, faster result returning, + optimized enum-to-vector conversion, and stack-allocated small arrays. + +Bugfixes +-------- + +* Fixed an issue where the ``CU_POINTER_ATTRIBUTE_DEVICE_ORDINAL`` attribute was + retrieved as an unsigned int, rather than a signed int. + (`PR #1451 `_) +* Fixed a use-after-free in ``_HelperInputVoidPtr`` properties when backed by + Python buffer objects. + (`PR #1629 `_) + +Miscellaneous +------------- + +* Faster ``void *`` conversion using stack-allocated buffers instead of heap + allocation. + (`PR #1616 `_) +* Faster returning of results from driver, runtime, and NVRTC bindings. + (`PR #1647 `_, + `PR #1656 `_) +* Faster conversion of enum sequences to vectors by eliminating temporary + Python objects. + (`PR #1667 `_) +* Stack-allocated small numeric arrays in driver bindings, reducing heap + allocation overhead. + (`PR #1545 `_) +* NVML bindings now use ``cuda_pathfinder`` for library discovery, consistent + with other CUDA libraries. + (`PR #1661 `_) +* ``CUDA_HOME`` is no longer required at metadata resolution time (e.g. + ``pip install --dry-run``, ``uv lock``); it is only needed at actual build time. + (`PR #1652 `_) + +Known issues +------------ + +* Updating from older versions (v12.6.2.post1 and below) via ``pip install -U cuda-python`` might not work. Please do a clean re-installation by uninstalling ``pip uninstall -y cuda-python`` followed by installing ``pip install cuda-python``. diff --git a/cuda_bindings/docs/source/release/12.9.7-notes.rst b/cuda_bindings/docs/source/release/12.9.7-notes.rst new file mode 100644 index 00000000000..842f1f3923e --- /dev/null +++ b/cuda_bindings/docs/source/release/12.9.7-notes.rst @@ -0,0 +1,53 @@ +.. SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +.. module:: cuda.bindings + +``cuda-bindings`` 12.9.7 Release notes +====================================== + +Bugfixes +-------- + +* Fixed ``CUDA_PYTHON_CUDA_PER_THREAD_DEFAULT_STREAM=0`` incorrectly enabling + per-thread default stream mode. + (`PR #2110 `_) + +* Fixed a use-after-free in ``cudaGraphGetEdges``, ``cudaGraphNodeGetDependencies``, + ``cudaGraphNodeGetDependentNodes``, ``cudaStreamGetCaptureInfo``, and their + driver-API counterparts (``cuGraphGetEdges``, ``cuGraphNodeGetDependencies``, + ``cuGraphNodeGetDependentNodes``, ``cuStreamGetCaptureInfo``). The returned + ``cudaGraphEdgeData``/``CUgraphEdgeData`` wrappers were backed by a scratch + buffer that was freed before the call returned, leaving every wrapper holding + a dangling pointer. The returned wrappers now own deep copies of the edge + data. + (`Issue #1804 `_, + `PR #2110 `_) + +* Fixed a double-free in the generated setters for list-valued struct members + (e.g. ``CUlaunchConfig.attrs``, ``CUDA_MEM_ALLOC_NODE_PARAMS.accessDescs``, + external-semaphore and batch-mem-op node parameter arrays, and their runtime + counterparts). Assigning an empty list freed the internal buffer but left + the cached pointer non-NULL, so a subsequent assignment or ``__dealloc__`` + would call ``free()`` again on the dangling pointer. + (`PR #2115 `_) + +Miscellaneous +------------- + +* NVRTC bindings now use pre-generated Cython files and no longer require + pyclibrary header parsing at build time. + (`PR #1957 `_) + +* Improved generated documentation and argument names, including the ``ind_ex`` + argument naming bug. + (`PR #1928 `_, + `PR #2110 `_) + +* Source archives now include git archival metadata for setuptools-scm. + (`PR #1756 `_) + +Known issues +------------ + +* Updating from older versions (v12.6.2.post1 and below) via ``pip install -U cuda-python`` might not work. Please do a clean re-installation by uninstalling ``pip uninstall -y cuda-python`` followed by installing ``pip install cuda-python``. diff --git a/cuda_bindings/docs/source/release/13.0.0-notes.rst b/cuda_bindings/docs/source/release/13.0.0-notes.rst new file mode 100644 index 00000000000..7f0ea720a6e --- /dev/null +++ b/cuda_bindings/docs/source/release/13.0.0-notes.rst @@ -0,0 +1,60 @@ +.. SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +.. module:: cuda.bindings + +``cuda-bindings`` 13.0.0 Release notes +====================================== + +Released on Aug 6, 2025 + + +Highlights +---------- + +* Support CUDA 13.0. + +* A utility module :mod:`cuda.bindings.utils` is added + + * Using ``int(cuda_obj)`` to retrieve the underlying address of a CUDA object is deprecated and + subject to future removal. Please switch to use :func:`~cuda.bindings.utils.get_cuda_native_handle` + instead. + +* The ``cuda.bindings.cufile`` Python module was added, wrapping the + `cuFile C APIs `_. + Supported on Linux only. + + * Currently using this module requires NumPy to be present. Any recent NumPy 1.x or 2.x should work. + +* Python bindings in every module, including ``driver``, ``runtime``, and ``nvrtc``, now have the GIL + released before calling the underlying C APIs. + + +Breaking changes +---------------- + +* For breaking changes in the CUDA APIs, please see the `CUDA 13.0 release notes `_. +* The trampoline modules ``cuda.{cuda,cudart,nvrtc}`` are now removed. Users should switch to use ``cuda.bindings.{driver,runtime,nvrtc}`` instead. + + +Bug fixes +--------- + +* Fix a library loading bug that preferred shared libraries without a SOVERSION. + + +Miscellaneous +------------- + +* All Python bindings now have the GIL released when calling into the underlying C APIs. +* Added PTX utilities including :func:`~utils.get_minimal_required_cuda_ver_from_ptx_ver` and :func:`~utils.get_ptx_ver`. +* Common CUDA objects such as :class:`~runtime.cudaStream_t` now compare equal if the underlying address is the same. +* Add a binding to ``nvvmGetErrorString()``. +* Build the bindings with Cython profile hooks disabled. +* The internal pathfinder module is now isolated to a standalone package ``cuda-pathfinder`` and made as a required dependency. + + +Known issues +------------ + +* Updating from older versions (v12.6.2.post1 and below) via ``pip install -U cuda-python`` might not work. Please do a clean re-installation by uninstalling ``pip uninstall -y cuda-python`` followed by installing ``pip install cuda-python``. diff --git a/cuda_bindings/docs/source/release/13.0.1-notes.rst b/cuda_bindings/docs/source/release/13.0.1-notes.rst new file mode 100644 index 00000000000..545d72642ac --- /dev/null +++ b/cuda_bindings/docs/source/release/13.0.1-notes.rst @@ -0,0 +1,21 @@ +.. SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +.. module:: cuda.bindings + +``cuda-bindings`` 13.0.1 Release notes +====================================== + +Released on Aug 18, 2025 + + +Highlights +---------- + +* Make populating the internal symbol table thread-safe. + + +Known issues +------------ + +* Updating from older versions (v12.6.2.post1 and below) via ``pip install -U cuda-python`` might not work. Please do a clean re-installation by uninstalling ``pip uninstall -y cuda-python`` followed by installing ``pip install cuda-python``. diff --git a/cuda_bindings/docs/source/release/13.0.2-notes.rst b/cuda_bindings/docs/source/release/13.0.2-notes.rst new file mode 100644 index 00000000000..0e34f0bef8d --- /dev/null +++ b/cuda_bindings/docs/source/release/13.0.2-notes.rst @@ -0,0 +1,37 @@ +.. SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +.. module:: cuda.bindings + +``cuda-bindings`` 13.0.2 Release notes +====================================== + +Released on Oct 9, 2025 + + +Highlights +---------- + +* This is the last release that officially supports Python 3.9. +* Python 3.14 is supported. +* **Experimental** free-threaded builds for Python 3.13/3.14 are made available. Any bugs can be reported to `our GitHub repo `_. More details are available in our :ref:`support` docs. +* Migrated wheel dependencies from individual NVIDIA packages to the ``cuda-toolkit`` metapackage for improved dependency resolution and version constraints. +* Automatic CUDA library path detection based on ``CUDA_HOME``, eliminating the need to manually set ``LIBRARY_PATH`` environment variables for installation. +* The ``[all]`` optional dependencies now use ``cuda-toolkit`` with appropriate extras instead of individual packages. The NVCC compiler is no longer automatically installed with ``pip install cuda-python[all]`` as it was previously included only to access the NVVM library, which now has its own dedicated wheel. Users who need the NVCC compiler should explicitly install it with ``pip install cuda-toolkit[nvcc]==X.Y`` with the appropriate version for their needs. +* The Python overhead of calling functions in CUDA bindings in ``driver``, ``runtime`` and ``nvrtc`` has been reduced by approximately 30%. +* On Windows, the ``pywin32`` dependency has been removed. The necessary Windows API functions are now accessed directly. +* Updated the ``cuda.bindings.runtime`` module to statically link against the CUDA Runtime library from CUDA Toolkit 13.0.1. +* ``cyruntime.getLocalRuntimeVersion`` now uses pathfinder to find the CUDA runtime. + + +Bug fixes +--------- + +* Restoring the :func:`~driver.cuCheckpointProcessRestore` API removed by mistake. + + +Known issues +------------ + +* Updating from older versions (v12.6.2.post1 and below) via ``pip install -U cuda-python`` might not work. Please do a clean re-installation by uninstalling ``pip uninstall -y cuda-python`` followed by installing ``pip install cuda-python``. +* The graphics APIs in ``cuda.bindings.runtime`` are inadvertently disabled in 13.0.2. Users needing these APIs should update to 13.0.3. diff --git a/cuda_bindings/docs/source/release/13.0.3-notes.rst b/cuda_bindings/docs/source/release/13.0.3-notes.rst new file mode 100644 index 00000000000..244289067ac --- /dev/null +++ b/cuda_bindings/docs/source/release/13.0.3-notes.rst @@ -0,0 +1,25 @@ +.. SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +.. module:: cuda.bindings + +``cuda-bindings`` 13.0.3 Release notes +====================================== + + + +Highlights +---------- + +* Updated the ``cuda.bindings.runtime`` module to statically link against the CUDA Runtime library from CUDA Toolkit 13.0.2. +* The cuFile bindings have been updated to include new bindings available in CTK 13.0. + +Bug fixes +--------- + +* The graphics APIs in ``cuda.bindings.runtime`` were inadvertently disabled in 13.0.2. This has been fixed. + +Known issues +------------ + +* Updating from older versions (v12.6.2.post1 and below) via ``pip install -U cuda-python`` might not work. Please do a clean re-installation by uninstalling ``pip uninstall -y cuda-python`` followed by installing ``pip install cuda-python``. diff --git a/cuda_bindings/docs/source/release/13.1.0-notes.rst b/cuda_bindings/docs/source/release/13.1.0-notes.rst new file mode 100644 index 00000000000..741830842c6 --- /dev/null +++ b/cuda_bindings/docs/source/release/13.1.0-notes.rst @@ -0,0 +1,36 @@ +.. SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +.. module:: cuda.bindings + +``cuda-bindings`` 13.1.0 Release notes +====================================== + +Released on Dec 4, 2025 + + +Highlights +---------- + +* Add support for new APIs introduced in CUDA 13.1. +* The ``cufile.read`` and ``cufile.write`` functions now return the number of bytes read or written (``ssize_t``) instead of returning ``None``, providing better feedback on I/O operations. +* Improved performance of cuFile bindings with approximately 60x faster construction and member access for generated low-level classes. +* Added ``__cuda_stream__`` protocol support to ``driver.CUStream`` class, enabling better interoperability with libraries that expect this protocol. +* Upgraded Cython dependency to version 3.2. +* Python 3.9 support was dropped (end of life). + +Bug fixes +--------- + +* Fixed ``cuStreamBeginCaptureToGraph`` to allow the ``dependencyData`` argument to be optional, matching the underlying CUDA API behavior. + +Backward incompatible changes +----------------------------- + +Additionally, ``cufile.StatsLevel3.per_gpu_stats`` no longer returns a singleton that must be manually converted to a Numpy array, instead it returns a ``cufile.PerGpuStats`` array which is directly addressable. + +Known issues +------------ + +* Updating from older versions (v12.6.2.post1 and below) via ``pip install -U cuda-python`` might not work. Please do a clean re-installation by uninstalling ``pip uninstall -y cuda-python`` followed by installing ``pip install cuda-python``. +* The graphics APIs in ``cuda.bindings.runtime`` are inadvertently disabled in 13.0.2. Users needing these APIs should update to 13.0.3. diff --git a/cuda_bindings/docs/source/release/13.1.1-notes.rst b/cuda_bindings/docs/source/release/13.1.1-notes.rst new file mode 100644 index 00000000000..97139642d06 --- /dev/null +++ b/cuda_bindings/docs/source/release/13.1.1-notes.rst @@ -0,0 +1,27 @@ +.. SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +.. module:: cuda.bindings + +``cuda-bindings`` 13.1.1 Release notes +====================================== + +Released on Dec 9, 2025 + +Highlights +---------- + +* Add missing driver & runtime bindings for functions new in CTK 13.1.0 + (`PR #1337 `_) + +Experimental +------------ + +* Experimental NVML bindings were added under ``cuda.bindings._nvml`` + (`PR #1284 `_) + +Known issues +------------ + +* Updating from older versions (v12.6.2.post1 and below) via ``pip install -U cuda-python`` might not work. Please do a clean re-installation by uninstalling ``pip uninstall -y cuda-python`` followed by installing ``pip install cuda-python``. +* The graphics APIs in ``cuda.bindings.runtime`` are inadvertently disabled in 13.0.2. Users needing these APIs should update to 13.0.3. diff --git a/cuda_bindings/docs/source/release/13.2.0-notes.rst b/cuda_bindings/docs/source/release/13.2.0-notes.rst new file mode 100644 index 00000000000..7f807d372a3 --- /dev/null +++ b/cuda_bindings/docs/source/release/13.2.0-notes.rst @@ -0,0 +1,83 @@ +.. SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +.. module:: cuda.bindings + +``cuda-bindings`` 13.2.0 Release notes +====================================== + +Highlights +---------- + +* Support for new APIs introduced in CUDA 13.2, including new driver functions + (``cuKernelGetParamCount``, ``cuMemcpyWithAttributesAsync``, + ``cuStreamBeginCaptureToCig``, ``cuLaunchHostFunc_v2``, + ``cuGraphNodeGetParams``, coredump callback registration, and more) and their + runtime counterparts. +* ``cuda.bindings.nvml`` has graduated from experimental + (``cuda.bindings._nvml``) to a fully supported public module with coverage + spanning 378 functions. `PR #1524 + `_, `PR #1548 + `_) +* Add ``nvFatbin`` bindings. + (`PR #1467 `_) +* Performance improvement: ``cuda.bindings`` now uses a faster ``enum`` + implementation, rather than the standard library's ``enum.IntEnum``. + This leads to much faster import times, and slightly faster attribute access + times. + (`PR #1581 `_) +* Multiple performance improvements cumulatively reducing Python-to-C call + overhead through faster ``void *`` conversion, faster result returning, + optimized enum-to-vector conversion, and stack-allocated small arrays. +* Added CUDA version compatibility check that warns when the installed driver + does not support the CUDA major version that ``cuda-bindings`` was built for. + Can be disabled with ``CUDA_PYTHON_DISABLE_VERSION_CHECK=1``. + (`PR #1412 `_) + +Bugfixes +-------- + +* Fixed an issue where the ``CU_POINTER_ATTRIBUTE_DEVICE_ORDINAL`` attribute was + retrieved as an unsigned int, rather than a signed int. + (`PR #1451 `_) +* Fixed ABI incompatibility bugs in cuFILE bindings introduced in v13.1.0. + (`PR #1468 `_) +* Fixed a use-after-free in ``_HelperInputVoidPtr`` properties when backed by + Python buffer objects. + (`PR #1629 `_) + +Miscellaneous +------------- + +* Faster ``void *`` conversion using stack-allocated buffers instead of heap + allocation. + (`PR #1616 `_) +* Faster returning of results from driver, runtime, and NVRTC bindings. + (`PR #1647 `_, + `PR #1656 `_) +* Faster conversion of enum sequences to vectors by eliminating temporary + Python objects. + (`PR #1667 `_) +* Stack-allocated small numeric arrays in driver bindings, reducing heap + allocation overhead. + (`PR #1545 `_) +* Wheel and installed package sizes significantly reduced (e.g., on a typical Linux x86_64 + build, wheel from ~16.6 MB to ~5.7 MB and installed from ~152 MB to ~23 MB) by excluding + Cython source files, generated C++ files, and template files from distribution packages. +* NVML bindings now use ``cuda_pathfinder`` for library discovery, consistent + with other CUDA libraries. + (`PR #1661 `_) +* Added ``get_c_compiler()`` function to report the C compiler used to build + ``cuda.bindings``. + (`PR #1591 `_) +* ``cuda-bindings`` now builds cleanly with ``clang``. + (`PR #1658 `_) +* ``CUDA_HOME`` is no longer required at metadata resolution time (e.g. + ``pip install --dry-run``, ``uv lock``); it is only needed at actual build time. + (`PR #1652 `_) + +Known issues +------------ + +* Updating from older versions (v12.6.2.post1 and below) via ``pip install -U cuda-python`` might not work. Please do a clean re-installation by uninstalling ``pip uninstall -y cuda-python`` followed by installing ``pip install cuda-python``. +* ``nvml.system_get_process_name`` on WSL can return incorrect values. To work around this, set the locale to "C" before calling ``nvml.device_get_compute_running_processes_v3`` (which sets the process names) and before calling ``nvml.system_get_process_name``. ``cuda_core`` does this automatically, but users of the raw NVML API will need to do this manually. diff --git a/cuda_bindings/docs/source/release/13.3.0-notes.rst b/cuda_bindings/docs/source/release/13.3.0-notes.rst new file mode 100644 index 00000000000..88a7ea1c332 --- /dev/null +++ b/cuda_bindings/docs/source/release/13.3.0-notes.rst @@ -0,0 +1,92 @@ +.. SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +.. module:: cuda.bindings + +``cuda-bindings`` 13.3.0 Release notes +====================================== + +Highlights +---------- + +* Support for new APIs introduced in CUDA 13.3, including driver logical + endpoint APIs, graph recapture APIs, NVRTC Tile IR and bundled-header APIs, + and related runtime graph/event APIs. + (`PR #2139 `_) + +* Add ``cuda.bindings.cudla`` bindings. + (`PR #2034 `_) + +* Add the ``nvvmLLVMVersion`` binding. + (`PR #1774 `_) + +* Add additional NVML APIs introduced in CUDA 13.2. + (`PR #1830 `_) + +Bugfixes +-------- + +* Fixed the ``cuDevSmResourceSplit`` and ``cudaDevSmResourceSplit`` binding + signatures so ``groupParams`` is accepted as a sequence matching the CUDA API. + (`PR #1766 `_) + +* Fixed nested resource pointer handling to accept both ``str`` and ``bytes`` + inputs. + (`PR #1698 `_) + +* Fixed ``nvmlDeviceGetFieldValues`` and ``nvmlDeviceClearFieldValues`` handling + of empty field lists so they return empty results instead of raising + ``NVML_ERROR_INVALID_ARGUMENT``. + (`PR #1982 `_) + +* Fixed ``CUDA_PYTHON_CUDA_PER_THREAD_DEFAULT_STREAM=0`` incorrectly enabling + per-thread default stream mode. + (`PR #2076 `_) + +* Fixed a use-after-free in ``cudaGraphGetEdges``, ``cudaGraphNodeGetDependencies``, + ``cudaGraphNodeGetDependentNodes``, ``cudaStreamGetCaptureInfo``, and their + driver-API counterparts (``cuGraphGetEdges``, ``cuGraphNodeGetDependencies``, + ``cuGraphNodeGetDependentNodes``, ``cuStreamGetCaptureInfo``). The returned + ``cudaGraphEdgeData``/``CUgraphEdgeData`` wrappers were backed by a scratch + buffer that was freed before the call returned, leaving every wrapper holding + a dangling pointer. The returned wrappers now own deep copies of the edge + data. + (`Issue #1804 `_, + `PR #2083 `_) + +* Fixed a double-free in the generated setters for list-valued struct members + (e.g. ``CUlaunchConfig.attrs``, ``CUDA_MEM_ALLOC_NODE_PARAMS.accessDescs``, + external-semaphore and batch-mem-op node parameter arrays, and their runtime + counterparts). Assigning an empty list freed the internal buffer but left + the cached pointer non-NULL, so a subsequent assignment or ``__dealloc__`` + would call ``free()`` again on the dangling pointer. + (`PR #2112 `_) + +Miscellaneous +------------- + +* Add ``cuda.bindings.utils.check_nvvm_compiler_options()`` to check whether a + set of NVVM compiler options is supported by the installed NVVM library. + (`PR #1837 `_) + +* NVRTC bindings now use pre-generated Cython files and no longer require + pyclibrary header parsing at build time. + (`PR #1900 `_) + +* Improved generated documentation and argument names, including the ``ind_ex`` + argument naming bug. + (`PR #1927 `_, + `PR #2082 `_) + +* Fixed ``cuda-bindings`` debug builds. + (`PR #1890 `_) + +* Declare ``cuda-pathfinder`` as a host dependency for pixi path-dependency + builds of ``cuda-bindings``. + (`PR #1926 `_) + +Known issues +------------ + +* Updating from older versions (v12.6.2.post1 and below) via ``pip install -U cuda-python`` might not work. Please do a clean re-installation by uninstalling ``pip uninstall -y cuda-python`` followed by installing ``pip install cuda-python``. +* ``nvml.system_get_process_name`` on WSL can return incorrect values. To work around this, set the locale to "C" before calling ``nvml.device_get_compute_running_processes_v3`` (which sets the process names) and before calling ``nvml.system_get_process_name``. ``cuda_core`` does this automatically, but users of the raw NVML API will need to do this manually. diff --git a/cuda_bindings/docs/source/release/13.3.1-notes.rst b/cuda_bindings/docs/source/release/13.3.1-notes.rst new file mode 100644 index 00000000000..5dbceb43fbc --- /dev/null +++ b/cuda_bindings/docs/source/release/13.3.1-notes.rst @@ -0,0 +1,26 @@ +.. SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +.. module:: cuda.bindings + +``cuda-bindings`` 13.3.1 Release notes +====================================== + +Bugfixes +-------- + +* Restored the ``CUcheckpointRestoreArgs`` and ``CUcheckpointRestoreArgs_st`` + driver bindings for CUDA 13.3. CUDA 13.3 changed the checkpoint restore + argument layout in a way that caused header parsing to omit the restore + argument struct and typedef during generation. + (`PR #2144 `_) + +* Fixed generated CUDA 13.3 driver API documentation for checkpoint restore + arguments and related references. + (`PR #2144 `_) + +Known issues +------------ + +* Updating from older versions (v12.6.2.post1 and below) via ``pip install -U cuda-python`` might not work. Please do a clean re-installation by uninstalling ``pip uninstall -y cuda-python`` followed by installing ``pip install cuda-python``. +* ``nvml.system_get_process_name`` on WSL can return incorrect values. To work around this, set the locale to "C" before calling ``nvml.device_get_compute_running_processes_v3`` (which sets the process names) and before calling ``nvml.system_get_process_name``. ``cuda_core`` does this automatically, but users of the raw NVML API will need to do this manually. diff --git a/cuda_bindings/docs/source/support.rst b/cuda_bindings/docs/source/support.rst new file mode 100644 index 00000000000..5c292eb5cb5 --- /dev/null +++ b/cuda_bindings/docs/source/support.rst @@ -0,0 +1,44 @@ +.. SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +.. _support: + +``cuda.bindings`` Support Policy +================================ + +The ``cuda.bindings`` module has the following support policy: + +1. The module shares the same ``major.minor`` version with the CUDA Toolkit. The patch version (the + third number in the version string), however, is reserved to reflect Python-only changes and + is out of sync with the Toolkit patch version. +2. The module is actively maintained to support the latest CUDA major version and its prior major + version. For example, as of writing the bindings for CUDA 12 & 13 are maintained. Any fix in the + latest bindings would be backported to the prior major version. +3. The module supports `CUDA minor version compatibility`_, meaning that ``cuda.bindings`` 12.x + supports any Toolkit 12.y. (Whether or not a binding API would actually correctly function + depends on the underlying driver and the Toolkit versions, as described in the compatibility + documentation.) +4. The module supports all Python versions following the `CPython EOL schedule`_. As of writing + Python 3.10 - 3.14 are supported. +5. The module exposes a Cython layer from which types and functions could be ``cimport``'d. While + we strive to keep this layer stable, due to Cython limitations a new *minor* release of this + module could require Cython layer users to rebuild their projects and update their pinning to + this module. + +Free-threading Build Support +---------------------------- +As of cuda-bindings 13.0.2/12.9.3, wheels for the `free-threaded interpreter`_ are shipped to PyPI. + +1. Support for these builds is best effort, due to heavy use of `built-in + modules that are known to be thread-unsafe`_, such as ``ctypes``. +2. For now, you are responsible for making sure that calls into ``cuda-bindings`` + libraries are thread-safe. This is subject to change. + +The NVIDIA CUDA Python team reserves rights to amend the above support policy. Any major changes, +however, will be announced to the users in advance. + + +.. _CUDA minor version compatibility: https://docs.nvidia.com/deploy/cuda-compatibility/minor-version-compatibility.html +.. _CPython EOL schedule: https://devguide.python.org/versions/ +.. _built-in modules that are known to be thread-unsafe: https://github.com/python/cpython/issues/116738 +.. _free-threaded interpreter: https://docs.python.org/3/howto/free-threading-python.html diff --git a/cuda_bindings/docs/source/tips_and_tricks.rst b/cuda_bindings/docs/source/tips_and_tricks.rst new file mode 100644 index 00000000000..adedb14eeb4 --- /dev/null +++ b/cuda_bindings/docs/source/tips_and_tricks.rst @@ -0,0 +1,47 @@ +.. SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +Tips and Tricks +--------------- + +Getting the address of underlying C objects from the low-level bindings +======================================================================= + +.. warning:: + + Using ``int(cuda_obj)`` to retrieve the underlying address of a CUDA object is deprecated and + subject to future removal. Please switch to use :func:`~cuda.bindings.utils.get_cuda_native_handle` + instead. + +All CUDA C types are exposed to Python as Python classes. For example, the :class:`~cuda.bindings.driver.CUstream` type is exposed as a class with methods :meth:`~cuda.bindings.driver.CUstream.getPtr()` and :meth:`~cuda.bindings.driver.CUstream.__int__()` implemented. + +There is an important distinction between the ``getPtr()`` method and the behaviour of ``__int__()``. Since a ``CUstream`` is itself just a pointer, calling ``instance_of_CUstream.getPtr()`` returns the pointer *to* the pointer, instead of the value of the ``CUstream`` C object that is the pointer to the underlying stream handle. ``int(instance_of_CUstream)`` returns the value of the ``CUstream`` converted to a Python int and is the actual address of the underlying handle. + + +Lifetime management of the CUDA objects +======================================= + +All of the Python classes do not manage the lifetime of the underlying CUDA C objects. It is the user's responsibility to use the appropriate APIs to explicitly destruct the objects following the CUDA Programming Guide. + + +Getting and setting attributes of extension types +================================================= + +While the bindings outwardly present the attributes of extension types in a pythonic way, they can't always be interacted with in a Pythonic style. Often the getters/setters (__getitem__(), __setitem__()) are actually a translation step to convert values between Python and C. For example, in some cases, attempting to modify an attribute in place, will lead to unexpected behavior due to the design of the underlying implementation. For this reason, users should use the getters and setters directly when interacting with extension types. + +An example of this is the :class:`~cuda.bindings.driver.CULaunchConfig` type. + +.. code-block:: python + + cfg = cuda.CUlaunchConfig() + + cfg.numAttrs += 1 + attr = cuda.CUlaunchAttribute() + + ... + + # This works. We are passing the new attribute to the setter + drv_cfg.attrs = [attr] + + # This does not work. We are only modifying the returned attribute in place + drv_cfg.attrs.append(attr) diff --git a/cuda_bindings/docs/versions.json b/cuda_bindings/docs/versions.json new file mode 100644 index 00000000000..76c66eca88a --- /dev/null +++ b/cuda_bindings/docs/versions.json @@ -0,0 +1,9 @@ +{ + "latest" : "latest", + "13.0.1" : "13.0.1", + "13.0.0" : "13.0.0", + "12.9.0" : "12.9.0", + "12.8.0" : "12.8.0", + "12.6.2" : "12.6.2", + "12.6.1" : "12.6.1" +} diff --git a/cuda_bindings/examples/0_Introduction/clock_nvrtc.py b/cuda_bindings/examples/0_Introduction/clock_nvrtc.py new file mode 100644 index 00000000000..14572469e79 --- /dev/null +++ b/cuda_bindings/examples/0_Introduction/clock_nvrtc.py @@ -0,0 +1,128 @@ +# Copyright 2021-2026 NVIDIA Corporation. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +# ################################################################################ +# +# This example demonstrates using the device clock for kernel timing via +# NVRTC-compiled CUDA code. +# +# ################################################################################ + +# /// script +# dependencies = ["cuda_bindings>13.2.1", "numpy"] +# /// + +import platform + +import numpy as np + +from cuda.bindings import driver as cuda +from cuda.bindings._example_helpers import KernelHelper, check_cuda_errors, find_cuda_device, requirement_not_met + +clock_nvrtc = """\ +extern "C" __global__ void timedReduction(const float *hinput, float *output, clock_t *timer) +{ + // __shared__ float shared[2 * blockDim.x]; + extern __shared__ float shared[]; + + const int tid = threadIdx.x; + const int bid = blockIdx.x; + + if (tid == 0) timer[bid] = clock(); + + // Copy hinput. + shared[tid] = hinput[tid]; + shared[tid + blockDim.x] = hinput[tid + blockDim.x]; + + // Perform reduction to find minimum. + for (int d = blockDim.x; d > 0; d /= 2) + { + __syncthreads(); + + if (tid < d) + { + float f0 = shared[tid]; + float f1 = shared[tid + d]; + + if (f1 < f0) + { + shared[tid] = f1; + } + } + } + + // Write result. + if (tid == 0) output[bid] = shared[0]; + + __syncthreads(); + + if (tid == 0) timer[bid+gridDim.x] = clock(); +} +""" + +num_blocks = 64 +num_threads = 256 + + +def elems_to_bytes(nelems, dt): + return nelems * np.dtype(dt).itemsize + + +def check_requirements(): + if platform.machine() == "armv7l": + requirement_not_met("clock_nvrtc is not supported on ARMv7") + + +def main(): + check_requirements() + + timer = np.empty(num_blocks * 2, dtype="int64") + hinput = np.empty(num_threads * 2, dtype="float32") + + for i in range(num_threads * 2): + hinput[i] = i + + dev_id = find_cuda_device() + kernel_helper = KernelHelper(clock_nvrtc, dev_id) + kernel_addr = kernel_helper.get_function(b"timedReduction") + + dinput = check_cuda_errors(cuda.cuMemAlloc(hinput.nbytes)) + doutput = check_cuda_errors(cuda.cuMemAlloc(elems_to_bytes(num_blocks, np.float32))) + dtimer = check_cuda_errors(cuda.cuMemAlloc(timer.nbytes)) + check_cuda_errors(cuda.cuMemcpyHtoD(dinput, hinput, hinput.nbytes)) + + args = ((dinput, doutput, dtimer), (None, None, None)) + shared_memory_nbytes = elems_to_bytes(2 * num_threads, np.float32) + + grid_dims = (num_blocks, 1, 1) + block_dims = (num_threads, 1, 1) + + check_cuda_errors( + cuda.cuLaunchKernel( + kernel_addr, + *grid_dims, # grid dim + *block_dims, # block dim + shared_memory_nbytes, + 0, # shared mem, stream + args, + 0, + ) + ) # arguments + + check_cuda_errors(cuda.cuCtxSynchronize()) + check_cuda_errors(cuda.cuMemcpyDtoH(timer, dtimer, timer.nbytes)) + check_cuda_errors(cuda.cuMemFree(dinput)) + check_cuda_errors(cuda.cuMemFree(doutput)) + check_cuda_errors(cuda.cuMemFree(dtimer)) + + avg_elapsed_clocks = 0.0 + + for i in range(num_blocks): + avg_elapsed_clocks += timer[i + num_blocks] - timer[i] + + avg_elapsed_clocks = avg_elapsed_clocks / num_blocks + print(f"Average clocks/block = {avg_elapsed_clocks}") + + +if __name__ == "__main__": + main() diff --git a/cuda_bindings/examples/0_Introduction/simple_cubemap_texture.py b/cuda_bindings/examples/0_Introduction/simple_cubemap_texture.py new file mode 100644 index 00000000000..cad35990e91 --- /dev/null +++ b/cuda_bindings/examples/0_Introduction/simple_cubemap_texture.py @@ -0,0 +1,229 @@ +# Copyright 2021-2026 NVIDIA Corporation. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +# ################################################################################ +# +# This example demonstrates cubemap texture sampling and transformation. +# +# ################################################################################ + + +# /// script +# dependencies = ["cuda_bindings>13.2.1", "numpy"] +# /// + + +import ctypes +import sys +import time + +import numpy as np + +from cuda.bindings import driver as cuda +from cuda.bindings import runtime as cudart +from cuda.bindings._example_helpers import KernelHelper, check_cuda_errors, find_cuda_device, requirement_not_met + +simple_cubemap_texture = """\ +extern "C" +__global__ void transformKernel(float *g_odata, int width, cudaTextureObject_t tex) +{ + // calculate this thread's data point + unsigned int x = blockIdx.x*blockDim.x + threadIdx.x; + unsigned int y = blockIdx.y*blockDim.y + threadIdx.y; + + // 0.5f offset and division are necessary to access the original data points + // in the texture (such that bilinear interpolation will not be activated). + // For details, see also CUDA Programming Guide, Appendix D + + float u = ((x+0.5f) / (float) width) * 2.f - 1.f; + float v = ((y+0.5f) / (float) width) * 2.f - 1.f; + + float cx, cy, cz; + + for (unsigned int face = 0; face < 6; face ++) + { + //Layer 0 is positive X face + if (face == 0) + { + cx = 1; + cy = -v; + cz = -u; + } + //Layer 1 is negative X face + else if (face == 1) + { + cx = -1; + cy = -v; + cz = u; + } + //Layer 2 is positive Y face + else if (face == 2) + { + cx = u; + cy = 1; + cz = v; + } + //Layer 3 is negative Y face + else if (face == 3) + { + cx = u; + cy = -1; + cz = -v; + } + //Layer 4 is positive Z face + else if (face == 4) + { + cx = u; + cy = -v; + cz = 1; + } + //Layer 4 is negative Z face + else if (face == 5) + { + cx = -u; + cy = -v; + cz = -1; + } + + // read from texture, do expected transformation and write to global memory + g_odata[face*width*width + y*width + x] = -texCubemap(tex, cx, cy, cz); + } +} +""" + + +def main(): + # Use command-line specified CUDA device, otherwise use device with highest Gflops/s + dev_id = find_cuda_device() + + # Get number of SMs on this GPU + device_props = check_cuda_errors(cudart.cudaGetDeviceProperties(dev_id)) + print( + f"CUDA device [{device_props.name}] has {device_props.multiProcessorCount} Multi-Processors SM {device_props.major}.{device_props.minor}" + ) + if device_props.major < 2: + requirement_not_met("Test requires SM 2.0 or higher for support of Texture Arrays.") + + # Generate input data for layered texture + width = 64 + num_faces = 6 + num_layers = 1 + cubemap_size = width * width * num_faces + h_data = np.arange(cubemap_size * num_layers, dtype="float32") + size = h_data.nbytes + + # This is the expected transformation of the input data (the expected output) + h_data_ref = np.repeat(np.arange(num_layers, dtype=h_data.dtype), cubemap_size) - h_data + + # Allocate device memory for result + d_data = check_cuda_errors(cudart.cudaMalloc(size)) + + # Allocate array and copy image data + channel_desc = check_cuda_errors( + cudart.cudaCreateChannelDesc(32, 0, 0, 0, cudart.cudaChannelFormatKind.cudaChannelFormatKindFloat) + ) + cu_3darray = check_cuda_errors( + cudart.cudaMalloc3DArray( + channel_desc, + cudart.make_cudaExtent(width, width, num_faces), + cudart.cudaArrayCubemap, + ) + ) + width_nbytes = h_data[:width].nbytes + myparms = cudart.cudaMemcpy3DParms() + myparms.srcPos = cudart.make_cudaPos(0, 0, 0) + myparms.dstPos = cudart.make_cudaPos(0, 0, 0) + myparms.srcPtr = cudart.make_cudaPitchedPtr(h_data, width_nbytes, width, width) + myparms.dstArray = cu_3darray + myparms.extent = cudart.make_cudaExtent(width, width, num_faces) + myparms.kind = cudart.cudaMemcpyKind.cudaMemcpyHostToDevice + check_cuda_errors(cudart.cudaMemcpy3D(myparms)) + + tex_res = cudart.cudaResourceDesc() + tex_res.resType = cudart.cudaResourceType.cudaResourceTypeArray + tex_res.res.array.array = cu_3darray + + tex_descr = cudart.cudaTextureDesc() + tex_descr.normalizedCoords = True + tex_descr.filterMode = cudart.cudaTextureFilterMode.cudaFilterModeLinear + tex_descr.addressMode[0] = cudart.cudaTextureAddressMode.cudaAddressModeWrap + tex_descr.addressMode[1] = cudart.cudaTextureAddressMode.cudaAddressModeWrap + tex_descr.addressMode[2] = cudart.cudaTextureAddressMode.cudaAddressModeWrap + tex_descr.readMode = cudart.cudaTextureReadMode.cudaReadModeElementType + + tex = check_cuda_errors(cudart.cudaCreateTextureObject(tex_res, tex_descr, None)) + dim_block = cudart.dim3() + dim_block.x = 8 + dim_block.y = 8 + dim_block.z = 1 + dim_grid = cudart.dim3() + dim_grid.x = width / dim_block.x + dim_grid.y = width / dim_block.y + dim_grid.z = 1 + + print( + f"Covering Cubemap data array of {width}~3 x {num_layers}: Grid size is {dim_grid.x} x {dim_grid.y}, each block has 8 x 8 threads" + ) + + kernel_helper = KernelHelper(simple_cubemap_texture, dev_id) + _transform_kernel = kernel_helper.get_function(b"transformKernel") + kernel_args = ((d_data, width, tex), (ctypes.c_void_p, ctypes.c_int, None)) + check_cuda_errors( + cuda.cuLaunchKernel( + _transform_kernel, + dim_grid.x, + dim_grid.y, + dim_grid.z, # grid dim + dim_block.x, + dim_block.y, + dim_block.z, # block dim + 0, + 0, # shared mem and stream + kernel_args, + 0, + ) + ) # arguments + + check_cuda_errors(cudart.cudaDeviceSynchronize()) + + start = time.time() + + # Execute the kernel + check_cuda_errors( + cuda.cuLaunchKernel( + _transform_kernel, + dim_grid.x, + dim_grid.y, + dim_grid.z, # grid dim + dim_block.x, + dim_block.y, + dim_block.z, # block dim + 0, + 0, # shared mem and stream + kernel_args, + 0, + ) + ) # arguments + + check_cuda_errors(cudart.cudaDeviceSynchronize()) + stop = time.time() + print(f"Processing time: {stop - start:.3f} msec") + print(f"{cubemap_size / ((stop - start + 1) / 1000.0) / 1e6:.2f} Mtexlookups/sec") + + # Allocate mem for the result on host side + h_odata = np.empty_like(h_data) + # Copy result from device to host + check_cuda_errors(cudart.cudaMemcpy(h_odata, d_data, size, cudart.cudaMemcpyKind.cudaMemcpyDeviceToHost)) + + check_cuda_errors(cudart.cudaDestroyTextureObject(tex)) + check_cuda_errors(cudart.cudaFree(d_data)) + check_cuda_errors(cudart.cudaFreeArray(cu_3darray)) + + min_epsilon_error = 5.0e-3 + if np.max(np.abs(h_odata - h_data_ref)) > min_epsilon_error: + print("Failed", file=sys.stderr) + sys.exit(1) + + +if __name__ == "__main__": + main() diff --git a/cuda_bindings/examples/0_Introduction/simple_p2p.py b/cuda_bindings/examples/0_Introduction/simple_p2p.py new file mode 100644 index 00000000000..0c6700bc8df --- /dev/null +++ b/cuda_bindings/examples/0_Introduction/simple_p2p.py @@ -0,0 +1,249 @@ +# Copyright 2021-2026 NVIDIA Corporation. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +# ################################################################################ +# +# This example demonstrates peer-to-peer memory access and data transfer +# between multiple GPUs. +# +# ################################################################################ + +# /// script +# dependencies = ["cuda_bindings>13.2.1", "numpy"] +# /// + +import ctypes +import platform +import sys + +import numpy as np + +from cuda.bindings import driver as cuda +from cuda.bindings import runtime as cudart +from cuda.bindings._example_helpers import KernelHelper, check_cuda_errors, requirement_not_met + +simplep2p = """\ +extern "C" +__global__ void SimpleKernel(float *src, float *dst) +{ + // Just a dummy kernel, doing enough for us to verify that everything + // worked + const int idx = blockIdx.x * blockDim.x + threadIdx.x; + dst[idx] = src[idx] * 2.0f; +} +""" + + +def main(): + if platform.system() == "Darwin": + requirement_not_met("simpleP2P is not supported on Mac OSX") + + if platform.machine() == "armv7l": + requirement_not_met("simpleP2P is not supported on ARMv7") + + if platform.machine() == "aarch64": + requirement_not_met("simpleP2P is not supported on aarch64") + + if platform.machine() == "sbsa": + requirement_not_met("simpleP2P is not supported on sbsa") + + # Number of GPUs + print("Checking for multiple GPUs...") + gpu_n = check_cuda_errors(cudart.cudaGetDeviceCount()) + print(f"CUDA-capable device count: {gpu_n}") + + if gpu_n < 2: + requirement_not_met("Two or more GPUs with Peer-to-Peer access capability are required") + + prop = [check_cuda_errors(cudart.cudaGetDeviceProperties(i)) for i in range(gpu_n)] + # Check possibility for peer access + print("\nChecking GPU(s) for support of peer to peer memory access...") + + p2p_capable_gp_us = [-1, -1] + for i in range(gpu_n): + p2p_capable_gp_us[0] = i + for j in range(gpu_n): + if i == j: + continue + i_access_j = check_cuda_errors(cudart.cudaDeviceCanAccessPeer(i, j)) + j_access_i = check_cuda_errors(cudart.cudaDeviceCanAccessPeer(j, i)) + print( + "> Peer access from {} (GPU{}) -> {} (GPU{}) : {}\n".format( + prop[i].name, i, prop[j].name, j, "Yes" if i_access_j else "No" + ) + ) + print( + "> Peer access from {} (GPU{}) -> {} (GPU{}) : {}\n".format( + prop[j].name, j, prop[i].name, i, "Yes" if j_access_i else "No" + ) + ) + if i_access_j and j_access_i: + p2p_capable_gp_us[1] = j + break + if p2p_capable_gp_us[1] != -1: + break + + if p2p_capable_gp_us[0] == -1 or p2p_capable_gp_us[1] == -1: + requirement_not_met("Peer to Peer access is not available amongst GPUs in the system") + + # Use first pair of p2p capable GPUs detected + gpuid = [p2p_capable_gp_us[0], p2p_capable_gp_us[1]] + + # Enable peer access + print(f"Enabling peer access between GPU{gpuid[0]} and GPU{gpuid[1]}...") + check_cuda_errors(cudart.cudaSetDevice(gpuid[0])) + check_cuda_errors(cudart.cudaDeviceEnablePeerAccess(gpuid[1], 0)) + check_cuda_errors(cudart.cudaSetDevice(gpuid[1])) + check_cuda_errors(cudart.cudaDeviceEnablePeerAccess(gpuid[0], 0)) + + # Allocate buffers + buf_size = 1024 * 1024 * 16 * np.dtype(np.float32).itemsize + print(f"Allocating buffers ({int(buf_size / 1024 / 1024)}MB on GPU{gpuid[0]}, GPU{gpuid[1]} and CPU Host)...") + check_cuda_errors(cudart.cudaSetDevice(gpuid[0])) + g0 = check_cuda_errors(cudart.cudaMalloc(buf_size)) + check_cuda_errors(cudart.cudaSetDevice(gpuid[1])) + g1 = check_cuda_errors(cudart.cudaMalloc(buf_size)) + h0 = check_cuda_errors(cudart.cudaMallocHost(buf_size)) # Automatically portable with UVA + + # Create CUDA event handles + print("Creating event handles...") + eventflags = cudart.cudaEventBlockingSync + start_event = check_cuda_errors(cudart.cudaEventCreateWithFlags(eventflags)) + stop_event = check_cuda_errors(cudart.cudaEventCreateWithFlags(eventflags)) + + # P2P memcopy() benchmark + check_cuda_errors(cudart.cudaEventRecord(start_event, cudart.cudaStream_t(0))) + + for i in range(100): + # With UVA we don't need to specify source and target devices, the + # runtime figures this out by itself from the pointers + # Ping-pong copy between GPUs + if i % 2 == 0: + check_cuda_errors(cudart.cudaMemcpy(g1, g0, buf_size, cudart.cudaMemcpyKind.cudaMemcpyDefault)) + else: + check_cuda_errors(cudart.cudaMemcpy(g0, g1, buf_size, cudart.cudaMemcpyKind.cudaMemcpyDefault)) + + check_cuda_errors(cudart.cudaEventRecord(stop_event, cudart.cudaStream_t(0))) + check_cuda_errors(cudart.cudaEventSynchronize(stop_event)) + time_memcpy = check_cuda_errors(cudart.cudaEventElapsedTime(start_event, stop_event)) + print( + f"cudaMemcpyPeer / cudaMemcpy between GPU{gpuid[0]} and GPU{gpuid[1]}: {(1.0 / (time_memcpy / 1000.0)) * (100.0 * buf_size) / 1024.0 / 1024.0 / 1024.0:.2f}GB/s" + ) + + # Prepare host buffer and copy to GPU 0 + print(f"Preparing host buffer and memcpy to GPU{gpuid[0]}...") + + h0_local = (ctypes.c_float * int(buf_size / np.dtype(np.float32).itemsize)).from_address(h0) + for i in range(int(buf_size / np.dtype(np.float32).itemsize)): + h0_local[i] = i % 4096 + + check_cuda_errors(cudart.cudaSetDevice(gpuid[0])) + check_cuda_errors(cudart.cudaMemcpy(g0, h0, buf_size, cudart.cudaMemcpyKind.cudaMemcpyDefault)) + + # Kernel launch configuration + threads = cudart.dim3() + threads.x = 512 + threads.y = 1 + threads.z = 1 + blocks = cudart.dim3() + blocks.x = (buf_size / np.dtype(np.float32).itemsize) / threads.x + blocks.y = 1 + blocks.z = 1 + + # Run kernel on GPU 1, reading input from the GPU 0 buffer, writing + # output to the GPU 1 buffer + print(f"Run kernel on GPU{gpuid[1]}, taking source data from GPU{gpuid[0]} and writing to GPU{gpuid[1]}...") + check_cuda_errors(cudart.cudaSetDevice(gpuid[1])) + + kernel_helper = [None] * 2 + _simple_kernel = [None] * 2 + kernel_args = [None] * 2 + + kernel_helper[1] = KernelHelper(simplep2p, gpuid[1]) + _simple_kernel[1] = kernel_helper[1].get_function(b"SimpleKernel") + kernel_args[1] = ((g0, g1), (ctypes.c_void_p, ctypes.c_void_p)) + check_cuda_errors( + cuda.cuLaunchKernel( + _simple_kernel[1], + blocks.x, + blocks.y, + blocks.z, + threads.x, + threads.y, + threads.z, + 0, + 0, + kernel_args[1], + 0, + ) + ) + + check_cuda_errors(cudart.cudaDeviceSynchronize()) + + # Run kernel on GPU 0, reading input from the GPU 1 buffer, writing + # output to the GPU 0 buffer + print(f"Run kernel on GPU{gpuid[0]}, taking source data from GPU{gpuid[1]} and writing to GPU{gpuid[0]}...") + check_cuda_errors(cudart.cudaSetDevice(gpuid[0])) + kernel_helper[0] = KernelHelper(simplep2p, gpuid[0]) + _simple_kernel[0] = kernel_helper[0].get_function(b"SimpleKernel") + kernel_args[0] = ((g1, g0), (ctypes.c_void_p, ctypes.c_void_p)) + check_cuda_errors( + cuda.cuLaunchKernel( + _simple_kernel[0], + blocks.x, + blocks.y, + blocks.z, + threads.x, + threads.y, + threads.z, + 0, + 0, + kernel_args[0], + 0, + ) + ) + + check_cuda_errors(cudart.cudaDeviceSynchronize()) + + # Copy data back to host and verify + print(f"Copy data back to host from GPU{gpuid[0]} and verify results...") + check_cuda_errors(cudart.cudaMemcpy(h0, g0, buf_size, cudart.cudaMemcpyKind.cudaMemcpyDefault)) + + error_count = 0 + + for i in range(int(buf_size / np.dtype(np.float32).itemsize)): + # Re-generate input data and apply 2x '* 2.0f' computation of both + # kernel runs + if h0_local[i] != float(i % 4096) * 2.0 * 2.0: + print(f"Verification error @ element {i}: val = {h0_local[i]}, ref = {float(i % 4096) * 2.0 * 2.0}\n") + error_count += 1 + if error_count > 10: + break + + # Disable peer access (also unregisters memory for non-UVA cases) + print("Disabling peer access...") + check_cuda_errors(cudart.cudaSetDevice(gpuid[0])) + check_cuda_errors(cudart.cudaDeviceDisablePeerAccess(gpuid[1])) + check_cuda_errors(cudart.cudaSetDevice(gpuid[1])) + check_cuda_errors(cudart.cudaDeviceDisablePeerAccess(gpuid[0])) + + # Cleanup and shutdown + print("Shutting down...") + check_cuda_errors(cudart.cudaEventDestroy(start_event)) + check_cuda_errors(cudart.cudaEventDestroy(stop_event)) + check_cuda_errors(cudart.cudaSetDevice(gpuid[0])) + check_cuda_errors(cudart.cudaFree(g0)) + check_cuda_errors(cudart.cudaSetDevice(gpuid[1])) + check_cuda_errors(cudart.cudaFree(g1)) + check_cuda_errors(cudart.cudaFreeHost(h0)) + + for i in range(gpu_n): + check_cuda_errors(cudart.cudaSetDevice(i)) + + if error_count != 0: + print("Test failed!", file=sys.stderr) + sys.exit(1) + + +if __name__ == "__main__": + main() diff --git a/cuda_bindings/examples/0_Introduction/simple_zero_copy.py b/cuda_bindings/examples/0_Introduction/simple_zero_copy.py new file mode 100644 index 00000000000..72c5fe8b701 --- /dev/null +++ b/cuda_bindings/examples/0_Introduction/simple_zero_copy.py @@ -0,0 +1,196 @@ +# Copyright 2021-2026 NVIDIA Corporation. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +# ################################################################################ +# +# This example demonstrates vector addition using zero-copy (mapped) host +# memory, allowing the GPU to access CPU memory directly. +# +# ################################################################################ + +# /// script +# dependencies = ["cuda_bindings>13.2.1", "numpy"] +# /// + +import ctypes +import math +import platform +import random as rnd +import sys + +import numpy as np + +from cuda.bindings import driver as cuda +from cuda.bindings import runtime as cudart +from cuda.bindings._example_helpers import ( + KernelHelper, + check_cmd_line_flag, + check_cuda_errors, + get_cmd_line_argument_int, + requirement_not_met, +) + +simple_zero_copy = """\ +extern "C" +__global__ void vectorAddGPU(float *a, float *b, float *c, int N) +{ + int idx = blockIdx.x*blockDim.x + threadIdx.x; + + if (idx < N) + { + c[idx] = a[idx] + b[idx]; + } +} +""" + + +def main(): + idev = 0 + b_pin_generic_memory = False + + if platform.system() == "Darwin": + requirement_not_met("simpleZeroCopy is not supported on Mac OSX") + + if platform.machine() == "armv7l": + requirement_not_met("simpleZeroCopy is not supported on ARMv7") + + if platform.machine() == "aarch64": + requirement_not_met("simpleZeroCopy is not supported on aarch64") + + if platform.machine() == "sbsa": + requirement_not_met("simpleZeroCopy is not supported on sbsa") + + if check_cmd_line_flag("help"): + print("Usage: simpleZeroCopy [OPTION]\n", file=sys.stderr) + print("Options:", file=sys.stderr) + print(" device=[device #] Specify the device to be used", file=sys.stderr) + print(" use_generic_memory (optional) use generic page-aligned for system memory", file=sys.stderr) + sys.exit(1) + + # Get the device selected by the user or default to 0, and then set it. + if check_cmd_line_flag("device="): + device_count = cudart.cudaGetDeviceCount() + idev = int(get_cmd_line_argument_int("device=")) + + if idev >= device_count or idev < 0: + print(f"Device number {idev} is invalid, will use default CUDA device 0.") + idev = 0 + + if check_cmd_line_flag("use_generic_memory"): + b_pin_generic_memory = True + + if b_pin_generic_memory: + print("> Using Generic System Paged Memory (malloc)") + else: + print("> Using CUDA Host Allocated (cudaHostAlloc)") + + check_cuda_errors(cudart.cudaSetDevice(idev)) + + # Verify the selected device supports mapped memory and set the device flags for mapping host memory. + device_prop = check_cuda_errors(cudart.cudaGetDeviceProperties(idev)) + + if not device_prop.canMapHostMemory: + requirement_not_met(f"Device {idev} does not support mapping CPU host memory!") + + check_cuda_errors(cudart.cudaSetDeviceFlags(cudart.cudaDeviceMapHost)) + + # Allocate mapped CPU memory + + nelem = 1048576 + num_bytes = nelem * np.dtype(np.float32).itemsize + + if b_pin_generic_memory: + a = np.empty(nelem, dtype=np.float32) + b = np.empty(nelem, dtype=np.float32) + c = np.empty(nelem, dtype=np.float32) + + check_cuda_errors(cudart.cudaHostRegister(a, num_bytes, cudart.cudaHostRegisterMapped)) + check_cuda_errors(cudart.cudaHostRegister(b, num_bytes, cudart.cudaHostRegisterMapped)) + check_cuda_errors(cudart.cudaHostRegister(c, num_bytes, cudart.cudaHostRegisterMapped)) + else: + flags = cudart.cudaHostAllocMapped + a_ptr = check_cuda_errors(cudart.cudaHostAlloc(num_bytes, flags)) + b_ptr = check_cuda_errors(cudart.cudaHostAlloc(num_bytes, flags)) + c_ptr = check_cuda_errors(cudart.cudaHostAlloc(num_bytes, flags)) + + a = (ctypes.c_float * nelem).from_address(a_ptr) + b = (ctypes.c_float * nelem).from_address(b_ptr) + c = (ctypes.c_float * nelem).from_address(c_ptr) + + # Initialize the vectors + for n in range(nelem): + a[n] = rnd.random() + b[n] = rnd.random() + + # Get the device pointers for the pinned CPU memory mapped into the GPU memory space + d_a = check_cuda_errors(cudart.cudaHostGetDevicePointer(a, 0)) + d_b = check_cuda_errors(cudart.cudaHostGetDevicePointer(b, 0)) + d_c = check_cuda_errors(cudart.cudaHostGetDevicePointer(c, 0)) + + # Call the GPU kernel using the CPU pointers residing in CPU mapped memory + print("> vectorAddGPU kernel will add vectors using mapped CPU memory...") + block = cudart.dim3() + block.x = 256 + block.y = 1 + block.z = 1 + grid = cudart.dim3() + grid.x = math.ceil(nelem / float(block.x)) + grid.y = 1 + grid.z = 1 + kernel_helper = KernelHelper(simple_zero_copy, idev) + _vector_add_gpu = kernel_helper.get_function(b"vectorAddGPU") + kernel_args = ( + (d_a, d_b, d_c, nelem), + (ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_int), + ) + check_cuda_errors( + cuda.cuLaunchKernel( + _vector_add_gpu, + grid.x, + grid.y, + grid.z, + block.x, + block.y, + block.z, + 0, + cuda.CU_STREAM_LEGACY, + kernel_args, + 0, + ) + ) + check_cuda_errors(cudart.cudaDeviceSynchronize()) + + print("> Checking the results from vectorAddGPU() ...") + # Compare the results + error_norm = 0.0 + ref_norm = 0.0 + + for n in range(nelem): + ref = a[n] + b[n] + diff = c[n] - ref + error_norm += diff * diff + ref_norm += ref * ref + + error_norm = math.sqrt(error_norm) + ref_norm = math.sqrt(ref_norm) + + # Memory clean up + + print("Releasing CPU memory...") + + if b_pin_generic_memory: + check_cuda_errors(cudart.cudaHostUnregister(a)) + check_cuda_errors(cudart.cudaHostUnregister(b)) + check_cuda_errors(cudart.cudaHostUnregister(c)) + else: + check_cuda_errors(cudart.cudaFreeHost(a)) + check_cuda_errors(cudart.cudaFreeHost(b)) + check_cuda_errors(cudart.cudaFreeHost(c)) + + if error_norm / ref_norm >= 1.0e-7: + print("FAILED", file=sys.stderr) + sys.exit(1) + + +if __name__ == "__main__": + main() diff --git a/examples/0_Introduction/systemWideAtomics_test.py b/cuda_bindings/examples/0_Introduction/system_wide_atomics.py similarity index 52% rename from examples/0_Introduction/systemWideAtomics_test.py rename to cuda_bindings/examples/0_Introduction/system_wide_atomics.py index feeb0631df6..fde3e67ad8f 100644 --- a/examples/0_Introduction/systemWideAtomics_test.py +++ b/cuda_bindings/examples/0_Introduction/system_wide_atomics.py @@ -1,19 +1,27 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. +# Copyright 2021-2026 NVIDIA Corporation. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +# ################################################################################ +# +# This example demonstrates system-wide atomic operations on managed memory. # -# Please refer to the NVIDIA end user license agreement (EULA) associated -# with this source code for terms and conditions that govern your use of -# this software. Any use, reproduction, disclosure, or distribution of -# this software and related documentation outside the terms of the EULA -# is strictly prohibited. +# ################################################################################ + +# /// script +# dependencies = ["cuda_bindings>13.2.1", "numpy"] +# /// + import ctypes -import numpy as np -import sys import os -from cuda import cuda, cudart -from examples.common import common -from examples.common.helper_cuda import checkCudaErrors, findCudaDevice +import sys + +import numpy as np + +from cuda.bindings import driver as cuda +from cuda.bindings import runtime as cudart +from cuda.bindings._example_helpers import KernelHelper, check_cuda_errors, find_cuda_device, requirement_not_met -systemWideAtomics = '''\ +system_wide_atomics = """\ #define LOOP_NUM 50 extern "C" @@ -54,35 +62,36 @@ atomicXor_system(&atom_arr[9], tid); } } -''' +""" + +LOOP_NUM = 50 -LOOP_NUM = 50 #! Compute reference data set #! Each element is multiplied with the number of threads / array length #! @param reference reference data, computed but preallocated #! @param idata input data as provided to device #! @param len number of elements in reference / idata -def verify(testData, length): +def verify(test_data, length): val = 0 for i in range(length * LOOP_NUM): val += 10 - if val != testData[0]: - print(f"atomicAdd failed val = {val} testData = {testData[0]}") - return False + if val != test_data[0]: + print(f"atomicAdd failed val = {val} test_data = {test_data[0]}") + return False val = 0 found = False for i in range(length): # second element should be a member of [0, len) - if i == testData[1]: + if i == test_data[1]: found = True break if not found: - print("atomicExch failed") + print("atomicExch failed") return False val = -(1 << 8) @@ -91,7 +100,7 @@ def verify(testData, length): # third element should be len-1 val = max(val, i) - if val != testData[2]: + if val != test_data[2]: print("atomicMax failed") return False @@ -100,7 +109,7 @@ def verify(testData, length): for i in range(length): val = min(val, i) - if val != testData[3]: + if val != test_data[3]: print("atomicMin failed") return False @@ -110,7 +119,7 @@ def verify(testData, length): for i in range(length * LOOP_NUM): val = 0 if val >= limit else val + 1 - if val != testData[4]: + if val != test_data[4]: print("atomicInc failed") return False @@ -120,7 +129,7 @@ def verify(testData, length): for i in range(length * LOOP_NUM): val = limit if (val == 0) or (val > limit) else val - 1 - if val != testData[5]: + if val != test_data[5]: print("atomicDec failed") return False @@ -128,7 +137,7 @@ def verify(testData, length): for i in range(length): # seventh element should be a member of [0, len) - if i == testData[6]: + if i == test_data[6]: found = True break @@ -136,101 +145,111 @@ def verify(testData, length): print("atomicCAS failed") return False - val = 0xff + val = 0xFF for i in range(length): # 8th element should be 1 - val &= (2 * i + 7) + val &= 2 * i + 7 - if val != testData[7]: + if val != test_data[7]: print("atomicAnd failed") return False # 9th element should be 0xff val = -1 - if val != testData[8]: + if val != test_data[8]: print("atomicOr failed") return False - val = 0xff + val = 0xFF for i in range(length): # 11th element should be 0xff - val ^= i; + val ^= i - if val != testData[9]: + if val != test_data[9]: print("atomicXor failed") return False return True + def main(): - if os.name == 'nt': - print("Atomics not supported on Windows") - return + if os.name == "nt": + requirement_not_met("Atomics not supported on Windows") # set device - dev_id = findCudaDevice() - device_prop = checkCudaErrors(cudart.cudaGetDeviceProperties(dev_id)) + dev_id = find_cuda_device() + device_prop = check_cuda_errors(cudart.cudaGetDeviceProperties(dev_id)) if not device_prop.managedMemory: - # This samples requires being run on a device that supports Unified Memory - print("Unified Memory not supported on this device") - return - - if device_prop.computeMode == cudart.cudaComputeMode.cudaComputeModeProhibited: - # This sample requires being run with a default or process exclusive mode - print("This sample requires a device in either default or process exclusive mode") - return - + requirement_not_met("Unified Memory not supported on this device") + + compute_mode = check_cuda_errors( + cudart.cudaDeviceGetAttribute(cudart.cudaDeviceAttr.cudaDevAttrComputeMode, dev_id) + ) + if compute_mode == cudart.cudaComputeMode.cudaComputeModeProhibited: + requirement_not_met("This sample requires a device in either default or process exclusive mode") + if device_prop.major < 6: - print("Requires a minimum CUDA compute 6.0 capability, waiving testing.") - return + requirement_not_met("Requires a minimum CUDA compute 6.0 capability") - numThreads = 256 - numBlocks = 64 - numData = 10 + num_threads = 256 + num_blocks = 64 + num_data = 10 if device_prop.pageableMemoryAccess: print("CAN access pageable memory") - atom_arr_h = (ctypes.c_int * numData)(0) + atom_arr_h = (ctypes.c_int * num_data)(0) atom_arr = ctypes.addressof(atom_arr_h) else: print("CANNOT access pageable memory") - atom_arr = checkCudaErrors(cudart.cudaMallocManaged(np.dtype(np.int32).itemsize * numData, cudart.cudaMemAttachGlobal)) - atom_arr_h = (ctypes.c_int * numData).from_address(atom_arr) + atom_arr = check_cuda_errors( + cudart.cudaMallocManaged(np.dtype(np.int32).itemsize * num_data, cudart.cudaMemAttachGlobal) + ) + atom_arr_h = (ctypes.c_int * num_data).from_address(atom_arr) - for i in range(numData): + for i in range(num_data): atom_arr_h[i] = 0 # To make the AND and XOR tests generate something other than 0... - atom_arr_h[7] = atom_arr_h[9] = 0xff - - kernelHelper = common.KernelHelper(systemWideAtomics, dev_id) - _atomicKernel = kernelHelper.getFunction(b'atomicKernel') - kernelArgs = ((atom_arr,), - (ctypes.c_void_p,)) - checkCudaErrors(cuda.cuLaunchKernel(_atomicKernel, - numBlocks, 1, 1, # grid dim - numThreads, 1, 1, # block dim - 0, cuda.CU_STREAM_LEGACY, # shared mem and stream - kernelArgs, 0)) # arguments + atom_arr_h[7] = atom_arr_h[9] = 0xFF + + kernel_helper = KernelHelper(system_wide_atomics, dev_id) + _atomic_kernel = kernel_helper.get_function(b"atomicKernel") + kernel_args = ((atom_arr,), (ctypes.c_void_p,)) + check_cuda_errors( + cuda.cuLaunchKernel( + _atomic_kernel, + num_blocks, + 1, + 1, # grid dim + num_threads, + 1, + 1, # block dim + 0, + cuda.CU_STREAM_LEGACY, # shared mem and stream + kernel_args, + 0, + ) + ) # arguments # NOTE: Python doesn't have an equivalent system atomic operations # atomicKernel_CPU(atom_arr_h, numBlocks * numThreads) - checkCudaErrors(cudart.cudaDeviceSynchronize()) + check_cuda_errors(cudart.cudaDeviceSynchronize()) # Compute & verify reference solution - testResult = verify(atom_arr_h, numThreads * numBlocks) + test_result = verify(atom_arr_h, num_threads * num_blocks) if device_prop.pageableMemoryAccess: pass else: - checkCudaErrors(cudart.cudaFree(atom_arr)) + check_cuda_errors(cudart.cudaFree(atom_arr)) + + if not test_result: + print("systemWideAtomics completed with errors", file=sys.stderr) + sys.exit(1) - print("systemWideAtomics completed, returned {}".format("OK" if testResult else "ERROR!")) - if not testResult: - sys.exit(-1) -if __name__=="__main__": +if __name__ == "__main__": main() diff --git a/cuda_bindings/examples/0_Introduction/vector_add_drv.py b/cuda_bindings/examples/0_Introduction/vector_add_drv.py new file mode 100644 index 00000000000..d2356c0d3a1 --- /dev/null +++ b/cuda_bindings/examples/0_Introduction/vector_add_drv.py @@ -0,0 +1,121 @@ +# Copyright 2021-2026 NVIDIA Corporation. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +# ################################################################################ +# +# This example demonstrates vector addition using the CUDA Driver API with +# unified virtual addressing. +# +# ################################################################################ + +# /// script +# dependencies = ["cuda_bindings>13.2.1", "numpy"] +# /// + +import ctypes +import math +import sys + +import numpy as np + +from cuda.bindings import driver as cuda +from cuda.bindings._example_helpers import KernelHelper, check_cuda_errors, find_cuda_device_drv, requirement_not_met + +vector_add_drv = """\ +/* Vector addition: C = A + B. + * + * This sample is a very basic sample that implements element by element + * vector addition. It is the same as the sample illustrating Chapter 3 + * of the programming guide with some additions like error checking. + * + */ + +// Device code +extern "C" __global__ void VecAdd_kernel(const float *A, const float *B, float *C, int N) +{ + int i = blockDim.x * blockIdx.x + threadIdx.x; + + if (i < N) + C[i] = A[i] + B[i]; +} +""" + + +def main(): + n = 50000 + nbytes = n * np.dtype(np.float32).itemsize + + # Initialize + check_cuda_errors(cuda.cuInit(0)) + cu_device = find_cuda_device_drv() + # Create context + cu_context = check_cuda_errors(cuda.cuCtxCreate(None, 0, cu_device)) + + uva_supported = check_cuda_errors( + cuda.cuDeviceGetAttribute(cuda.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_UNIFIED_ADDRESSING, cu_device) + ) + if not uva_supported: + requirement_not_met("Accessing pageable memory directly requires UVA") + + kernel_helper = KernelHelper(vector_add_drv, int(cu_device)) + _vec_add_kernel = kernel_helper.get_function(b"VecAdd_kernel") + + # Allocate input vectors h_A and h_B in host memory + h_a = np.random.rand(n).astype(dtype=np.float32) + h_b = np.random.rand(n).astype(dtype=np.float32) + h_c = np.random.rand(n).astype(dtype=np.float32) + + # Allocate vectors in device memory + d_a = check_cuda_errors(cuda.cuMemAlloc(nbytes)) + d_b = check_cuda_errors(cuda.cuMemAlloc(nbytes)) + d_c = check_cuda_errors(cuda.cuMemAlloc(nbytes)) + + # Copy vectors from host memory to device memory + check_cuda_errors(cuda.cuMemcpyHtoD(d_a, h_a, nbytes)) + check_cuda_errors(cuda.cuMemcpyHtoD(d_b, h_b, nbytes)) + + # Grid/Block configuration + threads_per_block = 256 + blocks_per_grid = (n + threads_per_block - 1) / threads_per_block + + kernel_args = ((d_a, d_b, d_c, n), (None, None, None, ctypes.c_int)) + + # Launch the CUDA kernel + check_cuda_errors( + cuda.cuLaunchKernel( + _vec_add_kernel, + blocks_per_grid, + 1, + 1, + threads_per_block, + 1, + 1, + 0, + 0, + kernel_args, + 0, + ) + ) + + # Copy result from device memory to host memory + # h_C contains the result in host memory + check_cuda_errors(cuda.cuMemcpyDtoH(h_c, d_c, nbytes)) + + for i in range(n): + sum_all = h_a[i] + h_b[i] + if math.fabs(h_c[i] - sum_all) > 1e-7: + break + + # Free device memory + check_cuda_errors(cuda.cuMemFree(d_a)) + check_cuda_errors(cuda.cuMemFree(d_b)) + check_cuda_errors(cuda.cuMemFree(d_c)) + + check_cuda_errors(cuda.cuCtxDestroy(cu_context)) + if i + 1 != n: + print("Result = FAIL", file=sys.stderr) + sys.exit(1) + + +if __name__ == "__main__": + main() diff --git a/examples/0_Introduction/vectorAddMMAP_test.py b/cuda_bindings/examples/0_Introduction/vector_add_mmap.py similarity index 53% rename from examples/0_Introduction/vectorAddMMAP_test.py rename to cuda_bindings/examples/0_Introduction/vector_add_mmap.py index 18e549a069b..9faa45bedb8 100644 --- a/examples/0_Introduction/vectorAddMMAP_test.py +++ b/cuda_bindings/examples/0_Introduction/vector_add_mmap.py @@ -1,19 +1,28 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. +# Copyright 2021-2026 NVIDIA Corporation. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +# ################################################################################ +# +# This example demonstrates vector addition using multi-device memory +# mapping (cuMemCreate, cuMemMap) with virtual address management. # -# Please refer to the NVIDIA end user license agreement (EULA) associated -# with this source code for terms and conditions that govern your use of -# this software. Any use, reproduction, disclosure, or distribution of -# this software and related documentation outside the terms of the EULA -# is strictly prohibited. +# ################################################################################ + +# /// script +# dependencies = ["cuda_bindings>13.2.1", "numpy"] +# /// + import ctypes import math -import numpy as np +import platform import sys -from cuda import cuda -from examples.common import common -from examples.common.helper_cuda import checkCudaErrors, findCudaDeviceDRV -vectorAddMMAP = '''\ +import numpy as np + +from cuda.bindings import driver as cuda +from cuda.bindings._example_helpers import KernelHelper, check_cuda_errors, find_cuda_device_drv, requirement_not_met + +vector_add_mmap = """\ /* Vector addition: C = A + B. * * This sample is a very basic sample that implements element by element @@ -30,36 +39,42 @@ if (i < N) C[i] = A[i] + B[i]; } -''' +""" + def round_up(x, y): - return int((x - 1)/y + 1) * y + return int((x - 1) / y + 1) * y + -def getBackingDevices(cuDevice): - num_devices = checkCudaErrors(cuda.cuDeviceGetCount()) +def get_backing_devices(cu_device): + num_devices = check_cuda_errors(cuda.cuDeviceGetCount()) - backingDevices = [cuDevice] + backing_devices = [cu_device] for dev in range(num_devices): # The mapping device is already in the backingDevices vector - if int(dev) == int(cuDevice): + if int(dev) == int(cu_device): continue # Only peer capable devices can map each others memory - capable = checkCudaErrors(cuda.cuDeviceCanAccessPeer(cuDevice, dev)) + capable = check_cuda_errors(cuda.cuDeviceCanAccessPeer(cu_device, dev)) if not capable: continue # The device needs to support virtual address management for the required apis to work - attributeVal = checkCudaErrors(cuda.cuDeviceGetAttribute( - cuda.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_VIRTUAL_ADDRESS_MANAGEMENT_SUPPORTED, - cuDevice)) - if attributeVal == 0: + attribute_val = check_cuda_errors( + cuda.cuDeviceGetAttribute( + cuda.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_VIRTUAL_ADDRESS_MANAGEMENT_SUPPORTED, + cu_device, + ) + ) + if attribute_val == 0: continue - backingDevices.append(cuda.CUdevice(dev)) - return backingDevices + backing_devices.append(cuda.CUdevice(dev)) + return backing_devices -def simpleMallocMultiDeviceMmap(size, residentDevices, mappingDevices, align = 0): + +def simple_malloc_multi_device_mmap(size, resident_devices, mapping_devices, align=0): min_granularity = 0 # Setup the properties common for all the chunks @@ -72,9 +87,11 @@ def simpleMallocMultiDeviceMmap(size, residentDevices, mappingDevices, align = 0 # Get the minimum granularity needed for the resident devices # (the max of the minimum granularity of each participating device) - for device in residentDevices: + for device in resident_devices: prop.location.id = device - status, granularity = cuda.cuMemGetAllocationGranularity(prop, cuda.CUmemAllocationGranularity_flags.CU_MEM_ALLOC_GRANULARITY_MINIMUM) + status, granularity = cuda.cuMemGetAllocationGranularity( + prop, cuda.CUmemAllocationGranularity_flags.CU_MEM_ALLOC_GRANULARITY_MINIMUM + ) if status != cuda.CUresult.CUDA_SUCCESS: return status, None, None if min_granularity < granularity: @@ -82,9 +99,11 @@ def simpleMallocMultiDeviceMmap(size, residentDevices, mappingDevices, align = 0 # Get the minimum granularity needed for the accessing devices # (the max of the minimum granularity of each participating device) - for device in mappingDevices: + for device in mapping_devices: prop.location.id = device - status, granularity = cuda.cuMemGetAllocationGranularity(prop, cuda.CUmemAllocationGranularity_flags.CU_MEM_ALLOC_GRANULARITY_MINIMUM) + status, granularity = cuda.cuMemGetAllocationGranularity( + prop, cuda.CUmemAllocationGranularity_flags.CU_MEM_ALLOC_GRANULARITY_MINIMUM + ) if status != cuda.CUresult.CUDA_SUCCESS: return status, None, None if min_granularity < granularity: @@ -94,28 +113,28 @@ def simpleMallocMultiDeviceMmap(size, residentDevices, mappingDevices, align = 0 # Essentially size = N * residentDevices.size() * min_granularity is the requirement, # since each piece of the allocation will be stripeSize = N * min_granularity # and the min_granularity requirement applies to each stripeSize piece of the allocation. - size = round_up(size, len(residentDevices) * min_granularity) - stripeSize = size / len(residentDevices) + size = round_up(size, len(resident_devices) * min_granularity) + stripe_size = size / len(resident_devices) # Return the rounded up size to the caller for use in the free - allocationSize = size + allocation_size = size # Reserve the required contiguous VA space for the allocations status, dptr = cuda.cuMemAddressReserve(size, align, cuda.CUdeviceptr(0), 0) if status != cuda.CUresult.CUDA_SUCCESS: - simpleFreeMultiDeviceMmap(dptr, size) + simple_free_multi_device_mmap(dptr, size) return status, None, None # Create and map the backings on each gpu # note: reusing CUmemAllocationProp prop from earlier with prop.type & prop.location.type already specified. - for idx in range(len(residentDevices)): + for idx in range(len(resident_devices)): # Set the location for this chunk to this device - prop.location.id = residentDevices[idx] + prop.location.id = resident_devices[idx] # Create the allocation as a pinned allocation on this device - status, allocationHandle = cuda.cuMemCreate(stripeSize, prop, 0) + status, allocation_handle = cuda.cuMemCreate(stripe_size, prop, 0) if status != cuda.CUresult.CUDA_SUCCESS: - simpleFreeMultiDeviceMmap(dptr, size) + simple_free_multi_device_mmap(dptr, size) return status, None, None # Assign the chunk to the appropriate VA range and release the handle. @@ -123,10 +142,10 @@ def simpleMallocMultiDeviceMmap(size, residentDevices, mappingDevices, align = 0 # Since we do not need to make any other mappings of this memory or export it, # we no longer need and can release the allocationHandle. # The allocation will be kept live until it is unmapped. - status, = cuda.cuMemMap(int(dptr) + (stripeSize * idx), stripeSize, 0, allocationHandle, 0) - + (status,) = cuda.cuMemMap(int(dptr) + (stripe_size * idx), stripe_size, 0, allocation_handle, 0) + # the handle needs to be released even if the mapping failed. - status2, = cuda.cuMemRelease(allocationHandle) + (status2,) = cuda.cuMemRelease(allocation_handle) if status != cuda.CUresult.CUDA_SUCCESS: # cuMemRelease should not have failed here # as the handle was just allocated successfully @@ -135,37 +154,38 @@ def simpleMallocMultiDeviceMmap(size, residentDevices, mappingDevices, align = 0 # Cleanup in case of any mapping failures. if status != cuda.CUresult.CUDA_SUCCESS: - simpleFreeMultiDeviceMmap(dptr, size) + simple_free_multi_device_mmap(dptr, size) return status, None, None # Each accessDescriptor will describe the mapping requirement for a single device - accessDescriptors = [cuda.CUmemAccessDesc()] * len(mappingDevices) + access_descriptors = [cuda.CUmemAccessDesc()] * len(mapping_devices) # Prepare the access descriptor array indicating where and how the backings should be visible. - for idx in range(len(mappingDevices)): + for idx in range(len(mapping_devices)): # Specify which device we are adding mappings for. - accessDescriptors[idx].location.type = cuda.CUmemLocationType.CU_MEM_LOCATION_TYPE_DEVICE - accessDescriptors[idx].location.id = mappingDevices[idx] + access_descriptors[idx].location.type = cuda.CUmemLocationType.CU_MEM_LOCATION_TYPE_DEVICE + access_descriptors[idx].location.id = mapping_devices[idx] # Specify both read and write access. - accessDescriptors[idx].flags = cuda.CUmemAccess_flags.CU_MEM_ACCESS_FLAGS_PROT_READWRITE + access_descriptors[idx].flags = cuda.CUmemAccess_flags.CU_MEM_ACCESS_FLAGS_PROT_READWRITE # Apply the access descriptors to the whole VA range. - status, = cuda.cuMemSetAccess(dptr, size, accessDescriptors, len(accessDescriptors)) + (status,) = cuda.cuMemSetAccess(dptr, size, access_descriptors, len(access_descriptors)) if status != cuda.CUresult.CUDA_SUCCESS: - simpleFreeMultiDeviceMmap(dptr, size) + simple_free_multi_device_mmap(dptr, size) return status, None, None - return (status, dptr, allocationSize) + return (status, dptr, allocation_size) + -def simpleFreeMultiDeviceMmap(dptr, size): +def simple_free_multi_device_mmap(dptr, size): # Unmap the mapped virtual memory region # Since the handles to the mapped backing stores have already been released # by cuMemRelease, and these are the only/last mappings referencing them, # The backing stores will be freed. # Since the memory has been unmapped after this call, accessing the specified # va range will result in a fault (unitll it is remapped). - status = cuda.cuMemUnmap(dptr, size); + status = cuda.cuMemUnmap(dptr, size) if status[0] != cuda.CUresult.CUDA_SUCCESS: return status @@ -178,41 +198,55 @@ def simpleFreeMultiDeviceMmap(dptr, size): return status return status + def main(): - print("Vector Addition (Driver API)") - N = 50000 - size = N * np.dtype(np.float32).itemsize + if platform.system() == "Darwin": + requirement_not_met("vectorAddMMAP is not supported on Mac OSX") + + if platform.machine() == "armv7l": + requirement_not_met("vectorAddMMAP is not supported on ARMv7") + + if platform.machine() == "aarch64": + requirement_not_met("vectorAddMMAP is not supported on aarch64") + + if platform.machine() == "sbsa": + requirement_not_met("vectorAddMMAP is not supported on sbsa") + + n = 50000 + size = n * np.dtype(np.float32).itemsize # Initialize - checkCudaErrors(cuda.cuInit(0)) + check_cuda_errors(cuda.cuInit(0)) - cuDevice = findCudaDeviceDRV() + cu_device = find_cuda_device_drv() # Check that the selected device supports virtual address management - attributeVal = checkCudaErrors(cuda.cuDeviceGetAttribute( - cuda.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_VIRTUAL_ADDRESS_MANAGEMENT_SUPPORTED, - cuDevice)) - print("Device {} VIRTUAL ADDRESS MANAGEMENT SUPPORTED = {}.".format(cuDevice, attributeVal)) - if not attributeVal: - print("Device {} doesn't support VIRTUAL ADDRESS MANAGEMENT.".format(cuDevice)) - return + attribute_val = check_cuda_errors( + cuda.cuDeviceGetAttribute( + cuda.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_VIRTUAL_ADDRESS_MANAGEMENT_SUPPORTED, + cu_device, + ) + ) + print(f"Device {cu_device} VIRTUAL ADDRESS MANAGEMENT SUPPORTED = {attribute_val}.") + if not attribute_val: + requirement_not_met(f"Device {cu_device} doesn't support VIRTUAL ADDRESS MANAGEMENT.") # The vector addition happens on cuDevice, so the allocations need to be mapped there. - mappingDevices = [cuDevice] + mapping_devices = [cu_device] # Collect devices accessible by the mapping device (cuDevice) into the backingDevices vector. - backingDevices = getBackingDevices(cuDevice) + backing_devices = get_backing_devices(cu_device) # Create context - cuContext = checkCudaErrors(cuda.cuCtxCreate(0, cuDevice)) + cu_context = check_cuda_errors(cuda.cuCtxCreate(None, 0, cu_device)) - kernelHelper = common.KernelHelper(vectorAddMMAP, int(cuDevice)) - _VecAdd_kernel = kernelHelper.getFunction(b'VecAdd_kernel') + kernel_helper = KernelHelper(vector_add_mmap, int(cu_device)) + _vec_add_kernel = kernel_helper.get_function(b"VecAdd_kernel") # Allocate input vectors h_A and h_B in host memory - h_A = np.random.rand(size).astype(dtype=np.float32) - h_B = np.random.rand(size).astype(dtype=np.float32) - h_C = np.random.rand(size).astype(dtype=np.float32) + h_a = np.random.rand(size).astype(dtype=np.float32) + h_b = np.random.rand(size).astype(dtype=np.float32) + h_c = np.random.rand(size).astype(dtype=np.float32) # Allocate vectors in device memory # note that a call to cuCtxEnablePeerAccess is not needed even though @@ -221,47 +255,57 @@ def main(): # the cross device mapping. # cuMemSetAccess is still subject to the constraints of cuDeviceCanAccessPeer # for cross device mappings (hence why we checked cuDeviceCanAccessPeer earlier). - d_A, allocationSize = checkCudaErrors(simpleMallocMultiDeviceMmap(size, backingDevices, mappingDevices)) - d_B, _ = checkCudaErrors(simpleMallocMultiDeviceMmap(size, backingDevices, mappingDevices)) - d_C, _ = checkCudaErrors(simpleMallocMultiDeviceMmap(size, backingDevices, mappingDevices)) + d_a, allocation_size = check_cuda_errors(simple_malloc_multi_device_mmap(size, backing_devices, mapping_devices)) + d_b, _ = check_cuda_errors(simple_malloc_multi_device_mmap(size, backing_devices, mapping_devices)) + d_c, _ = check_cuda_errors(simple_malloc_multi_device_mmap(size, backing_devices, mapping_devices)) # Copy vectors from host memory to device memory - checkCudaErrors(cuda.cuMemcpyHtoD(d_A, h_A, size)) - checkCudaErrors(cuda.cuMemcpyHtoD(d_B, h_B, size)) + check_cuda_errors(cuda.cuMemcpyHtoD(d_a, h_a, size)) + check_cuda_errors(cuda.cuMemcpyHtoD(d_b, h_b, size)) # Grid/Block configuration - threadsPerBlock = 256 - blocksPerGrid = (N + threadsPerBlock - 1) / threadsPerBlock + threads_per_block = 256 + blocks_per_grid = (n + threads_per_block - 1) / threads_per_block - kernelArgs = ((d_A, d_B, d_C, N), - (None, None, None, ctypes.c_int)) + kernel_args = ((d_a, d_b, d_c, n), (None, None, None, ctypes.c_int)) # Launch the CUDA kernel - checkCudaErrors(cuda.cuLaunchKernel(_VecAdd_kernel, - blocksPerGrid, 1, 1, - threadsPerBlock, 1, 1, - 0, 0, - kernelArgs, 0)) + check_cuda_errors( + cuda.cuLaunchKernel( + _vec_add_kernel, + blocks_per_grid, + 1, + 1, + threads_per_block, + 1, + 1, + 0, + 0, + kernel_args, + 0, + ) + ) # Copy result from device memory to host memory # h_C contains the result in host memory - checkCudaErrors(cuda.cuMemcpyDtoH(h_C, d_C, size)) + check_cuda_errors(cuda.cuMemcpyDtoH(h_c, d_c, size)) # Verify result - for i in range(N): - sum_all = h_A[i] + h_B[i] - if math.fabs(h_C[i] - sum_all) > 1e-7: + for i in range(n): + sum_all = h_a[i] + h_b[i] + if math.fabs(h_c[i] - sum_all) > 1e-7: break - checkCudaErrors(simpleFreeMultiDeviceMmap(d_A, allocationSize)) - checkCudaErrors(simpleFreeMultiDeviceMmap(d_B, allocationSize)) - checkCudaErrors(simpleFreeMultiDeviceMmap(d_C, allocationSize)) + check_cuda_errors(simple_free_multi_device_mmap(d_a, allocation_size)) + check_cuda_errors(simple_free_multi_device_mmap(d_b, allocation_size)) + check_cuda_errors(simple_free_multi_device_mmap(d_c, allocation_size)) + + check_cuda_errors(cuda.cuCtxDestroy(cu_context)) - checkCudaErrors(cuda.cuCtxDestroy(cuContext)) + if i + 1 != n: + print("Result = FAIL", file=sys.stderr) + sys.exit(1) - print("{}".format("Result = PASS" if i+1 == N else "Result = FAIL")) - if i+1 != N: - sys.exit(-1) if __name__ == "__main__": main() diff --git a/cuda_bindings/examples/2_Concepts_and_Techniques/stream_ordered_allocation.py b/cuda_bindings/examples/2_Concepts_and_Techniques/stream_ordered_allocation.py new file mode 100644 index 00000000000..b45f11f317b --- /dev/null +++ b/cuda_bindings/examples/2_Concepts_and_Techniques/stream_ordered_allocation.py @@ -0,0 +1,262 @@ +# Copyright 2021-2026 NVIDIA Corporation. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +# ################################################################################ +# +# This example demonstrates stream-ordered memory allocation (cudaMallocAsync +# / cudaFreeAsync) and memory pool release thresholds. +# +# ################################################################################ + +# /// script +# dependencies = ["cuda_bindings>13.2.1", "numpy"] +# /// + +import ctypes +import math +import platform +import random as rnd +import sys + +import numpy as np + +from cuda.bindings import driver as cuda +from cuda.bindings import runtime as cudart +from cuda.bindings._example_helpers import ( + KernelHelper, + check_cmd_line_flag, + check_cuda_errors, + find_cuda_device, + requirement_not_met, +) + +stream_ordered_allocation = """\ +/* Add two vectors on the GPU */ +extern "C" +__global__ void vectorAddGPU(const float *a, const float *b, float *c, int N) +{ + int idx = blockIdx.x*blockDim.x + threadIdx.x; + + if (idx < N) { + c[idx] = a[idx] + b[idx]; + } +} +""" + +MAX_ITER = 20 + + +def basic_stream_ordered_allocation(dev, nelem, a, b, c): + num_bytes = nelem * np.dtype(np.float32).itemsize + + print("Starting basicStreamOrderedAllocation()") + check_cuda_errors(cudart.cudaSetDevice(dev)) + stream = check_cuda_errors(cudart.cudaStreamCreateWithFlags(cudart.cudaStreamNonBlocking)) + + d_a = check_cuda_errors(cudart.cudaMallocAsync(num_bytes, stream)) + d_b = check_cuda_errors(cudart.cudaMallocAsync(num_bytes, stream)) + d_c = check_cuda_errors(cudart.cudaMallocAsync(num_bytes, stream)) + check_cuda_errors(cudart.cudaMemcpyAsync(d_a, a, num_bytes, cudart.cudaMemcpyKind.cudaMemcpyHostToDevice, stream)) + check_cuda_errors(cudart.cudaMemcpyAsync(d_b, b, num_bytes, cudart.cudaMemcpyKind.cudaMemcpyHostToDevice, stream)) + + block = cudart.dim3() + block.x = 256 + block.y = 1 + block.z = 1 + grid = cudart.dim3() + grid.x = math.ceil(nelem / float(block.x)) + grid.y = 1 + grid.z = 1 + + kernel_args = ( + (d_a, d_b, d_c, nelem), + (ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_int), + ) + check_cuda_errors( + cuda.cuLaunchKernel( + _vector_add_gpu, + grid.x, + grid.y, + grid.z, # grid dim + block.x, + block.y, + block.z, # block dim + 0, + stream, # shared mem and stream + kernel_args, + 0, + ) + ) # arguments + + check_cuda_errors(cudart.cudaFreeAsync(d_a, stream)) + check_cuda_errors(cudart.cudaFreeAsync(d_b, stream)) + check_cuda_errors(cudart.cudaMemcpyAsync(c, d_c, num_bytes, cudart.cudaMemcpyKind.cudaMemcpyDeviceToHost, stream)) + check_cuda_errors(cudart.cudaFreeAsync(d_c, stream)) + check_cuda_errors(cudart.cudaStreamSynchronize(stream)) + + # Compare the results + print("> Checking the results from vectorAddGPU() ...") + error_norm = 0.0 + ref_norm = 0.0 + + for n in range(nelem): + ref = a[n] + b[n] + diff = c[n] - ref + error_norm += diff * diff + ref_norm += ref * ref + + error_norm = math.sqrt(error_norm) + ref_norm = math.sqrt(ref_norm) + + check_cuda_errors(cudart.cudaStreamDestroy(stream)) + + return error_norm / ref_norm < 1.0e-6 + + +# streamOrderedAllocationPostSync(): demonstrates If the application wants the memory to persist in the pool beyond +# synchronization, then it sets the release threshold on the pool. This way, when the application reaches the "steady state", +# it is no longer allocating/freeing memory from the OS. +def stream_ordered_allocation_post_sync(dev, nelem, a, b, c): + num_bytes = nelem * np.dtype(np.float32).itemsize + + print("Starting streamOrderedAllocationPostSync()") + check_cuda_errors(cudart.cudaSetDevice(dev)) + stream = check_cuda_errors(cudart.cudaStreamCreateWithFlags(cudart.cudaStreamNonBlocking)) + start = check_cuda_errors(cudart.cudaEventCreate()) + end = check_cuda_errors(cudart.cudaEventCreate()) + + mem_pool = check_cuda_errors(cudart.cudaDeviceGetDefaultMemPool(dev)) + threshold_val = cuda.cuuint64_t(ctypes.c_uint64(-1).value) + # Set high release threshold on the default pool so that cudaFreeAsync will not actually release memory to the system. + # By default, the release threshold for a memory pool is set to zero. This implies that the CUDA driver is + # allowed to release a memory chunk back to the system as long as it does not contain any active suballocations. + check_cuda_errors( + cudart.cudaMemPoolSetAttribute( + mem_pool, + cudart.cudaMemPoolAttr.cudaMemPoolAttrReleaseThreshold, + threshold_val, + ) + ) + # Record the start event + check_cuda_errors(cudart.cudaEventRecord(start, stream)) + for _i in range(MAX_ITER): + d_a = check_cuda_errors(cudart.cudaMallocAsync(num_bytes, stream)) + d_b = check_cuda_errors(cudart.cudaMallocAsync(num_bytes, stream)) + d_c = check_cuda_errors(cudart.cudaMallocAsync(num_bytes, stream)) + check_cuda_errors( + cudart.cudaMemcpyAsync(d_a, a, num_bytes, cudart.cudaMemcpyKind.cudaMemcpyHostToDevice, stream) + ) + check_cuda_errors( + cudart.cudaMemcpyAsync(d_b, b, num_bytes, cudart.cudaMemcpyKind.cudaMemcpyHostToDevice, stream) + ) + + block = cudart.dim3() + block.x = 256 + block.y = 1 + block.z = 1 + grid = cudart.dim3() + grid.x = math.ceil(nelem / float(block.x)) + grid.y = 1 + grid.z = 1 + + kernel_args = ( + (d_a, d_b, d_c, nelem), + (ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_int), + ) + check_cuda_errors( + cuda.cuLaunchKernel( + _vector_add_gpu, + grid.x, + grid.y, + grid.z, # grid dim + block.x, + block.y, + block.z, # block dim + 0, + stream, # shared mem and stream + kernel_args, + 0, + ) + ) # arguments + + check_cuda_errors(cudart.cudaFreeAsync(d_a, stream)) + check_cuda_errors(cudart.cudaFreeAsync(d_b, stream)) + check_cuda_errors( + cudart.cudaMemcpyAsync(c, d_c, num_bytes, cudart.cudaMemcpyKind.cudaMemcpyDeviceToHost, stream) + ) + check_cuda_errors(cudart.cudaFreeAsync(d_c, stream)) + check_cuda_errors(cudart.cudaStreamSynchronize(stream)) + check_cuda_errors(cudart.cudaEventRecord(end, stream)) + # Wait for the end event to complete + check_cuda_errors(cudart.cudaEventSynchronize(end)) + + msec_total = check_cuda_errors(cudart.cudaEventElapsedTime(start, end)) + print(f"Total elapsed time = {msec_total} ms over {MAX_ITER} iterations") + + # Compare the results + print("> Checking the results from vectorAddGPU() ...") + error_norm = 0.0 + ref_norm = 0.0 + + for n in range(nelem): + ref = a[n] + b[n] + diff = c[n] - ref + error_norm += diff * diff + ref_norm += ref * ref + + error_norm = math.sqrt(error_norm) + ref_norm = math.sqrt(ref_norm) + + check_cuda_errors(cudart.cudaStreamDestroy(stream)) + + return error_norm / ref_norm < 1.0e-6 + + +def main(): + if platform.system() == "Darwin": + requirement_not_met("streamOrderedAllocation is not supported on Mac OSX") + + cuda.cuInit(0) + if check_cmd_line_flag("help"): + print("Usage: streamOrderedAllocation [OPTION]\n", file=sys.stderr) + print("Options:", file=sys.stderr) + print(" device=[device #] Specify the device to be used", file=sys.stderr) + sys.exit(1) + + dev = find_cuda_device() + + version = check_cuda_errors(cudart.cudaDriverGetVersion()) + if version < 11030: + is_mem_pool_supported = False + else: + is_mem_pool_supported = check_cuda_errors( + cudart.cudaDeviceGetAttribute(cuda.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MEMORY_POOLS_SUPPORTED, dev) + ) + if not is_mem_pool_supported: + requirement_not_met("Waiving execution as device does not support Memory Pools") + + global _vector_add_gpu + kernel_helper = KernelHelper(stream_ordered_allocation, dev) + _vector_add_gpu = kernel_helper.get_function(b"vectorAddGPU") + + # Allocate CPU memory + nelem = 1048576 + nelem * np.dtype(np.float32).itemsize + + a = np.zeros(nelem, dtype="float32") + b = np.zeros(nelem, dtype="float32") + c = np.zeros(nelem, dtype="float32") + # Initialize the vectors + for i in range(nelem): + a[i] = rnd.random() + b[i] = rnd.random() + + ret1 = basic_stream_ordered_allocation(dev, nelem, a, b, c) + ret2 = stream_ordered_allocation_post_sync(dev, nelem, a, b, c) + + if not ret1 or not ret2: + sys.exit(1) + + +if __name__ == "__main__": + main() diff --git a/examples/3_CUDA_Features/globalToShmemAsyncCopy_test.py b/cuda_bindings/examples/3_CUDA_Features/global_to_shmem_async_copy.py similarity index 60% rename from examples/3_CUDA_Features/globalToShmemAsyncCopy_test.py rename to cuda_bindings/examples/3_CUDA_Features/global_to_shmem_async_copy.py index 3fcfdde5c83..9a2ec3dec3b 100644 --- a/examples/3_CUDA_Features/globalToShmemAsyncCopy_test.py +++ b/cuda_bindings/examples/3_CUDA_Features/global_to_shmem_async_copy.py @@ -1,37 +1,63 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. +# Copyright 2021-2026 NVIDIA Corporation. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +# ################################################################################ +# +# This example demonstrates asynchronous copy from global to shared memory +# (memcpy_async) in matrix multiplication kernels. # -# Please refer to the NVIDIA end user license agreement (EULA) associated -# with this source code for terms and conditions that govern your use of -# this software. Any use, reproduction, disclosure, or distribution of -# this software and related documentation outside the terms of the EULA -# is strictly prohibited. +# ################################################################################ + +# /// script +# dependencies = ["cuda_bindings>13.2.1", "numpy"] +# /// + import ctypes import math -import numpy as np +import platform import sys -import pytest -from cuda import cuda, cudart from enum import Enum -from examples.common import common -from examples.common.helper_cuda import checkCudaErrors, findCudaDevice -from examples.common.helper_string import checkCmdLineFlag, getCmdLineArgumentInt - -blockSize = 16 -class kernels(Enum): - AsyncCopyMultiStageLargeChunk = 0 - AsyncCopyLargeChunk = 1 - AsyncCopyLargeChunkAWBarrier = 2 + +import numpy as np + +from cuda.bindings import driver as cuda +from cuda.bindings import runtime as cudart +from cuda.bindings._example_helpers import ( + KernelHelper, + check_cmd_line_flag, + check_compute_capability_too_low, + check_cuda_errors, + find_cuda_device, + get_cmd_line_argument_int, + requirement_not_met, +) + +block_size = 16 + + +class Kernels(Enum): + AsyncCopyMultiStageLargeChunk = 0 + AsyncCopyLargeChunk = 1 + AsyncCopyLargeChunkAWBarrier = 2 AsyncCopyMultiStageSharedState = 3 - AsyncCopyMultiStage = 4 - AsyncCopySingleStage = 5 - Naive = 6 - NaiveLargeChunk = 7 - -kernelNames = ["AsyncCopyMultiStageLargeChunk", "AsyncCopyLargeChunk", - "AsyncCopyLargeChunkAWBarrier", "AsyncCopyMultiStageSharedState", - "AsyncCopyMultiStage", "AsyncCopySingleStage", "Naive", "NaiveLargeChunk"] - -globalToShmemAsyncCopy = '''\ + AsyncCopyMultiStage = 4 + AsyncCopySingleStage = 5 + Naive = 6 + NaiveLargeChunk = 7 + + +kernel_names = [ + "AsyncCopyMultiStageLargeChunk", + "AsyncCopyLargeChunk", + "AsyncCopyLargeChunkAWBarrier", + "AsyncCopyMultiStageSharedState", + "AsyncCopyMultiStage", + "AsyncCopySingleStage", + "Naive", + "NaiveLargeChunk", +] + +global_to_shmem_async_copy = """\ #line __LINE__ #if __CUDA_ARCH__ >= 700 #include @@ -41,16 +67,16 @@ class kernels(Enum): #include namespace cg = cooperative_groups; -#define BLOCK_SIZE 16 +#define BLOCK_SIZE 16 #define BLOCK_SIZE_X 16 // Multi Stage memcpy_async pipeline with large chunk copy extern "C" -__global__ void MatrixMulAsyncCopyMultiStageLargeChunk(float* __restrict__ C, +__global__ void MatrixMulAsyncCopyMultiStageLargeChunk(float* __restrict__ C, const float* __restrict__ A, const float* __restrict__ B, int wA, int wB) { - // Requires BLOCK_SIZE % 4 == 0 + // Requires BLOCK_SIZE % 4 == 0 // Multi-stage pipeline version constexpr size_t maxPipelineStages = 4; @@ -125,17 +151,17 @@ class kernels(Enum): // Write the block sub-matrix to device memory; // each thread writes four element - int c = wB * BLOCK_SIZE * blockIdx.y + BLOCK_SIZE * blockIdx.x; + int c = wB * BLOCK_SIZE * blockIdx.y + BLOCK_SIZE * blockIdx.x; C[c + wB * threadIdx.y + threadIdx.x] = Csub; } // Single Stage memcpy_async pipeline with Large copy chunk (float4) extern "C" -__global__ void MatrixMulAsyncCopyLargeChunk(float* __restrict__ C, +__global__ void MatrixMulAsyncCopyLargeChunk(float* __restrict__ C, const float* __restrict__ A, const float* __restrict__ B, int wA, int wB) { - // Requires BLOCK_SIZE % 4 == 0 + // Requires BLOCK_SIZE % 4 == 0 // Declaration of the shared memory array As used to // store the sub-matrix of A @@ -170,7 +196,7 @@ class kernels(Enum): // Loop over all the sub-matrices of A and B // required to compute the block sub-matrix for (int a = aBegin, b = bBegin; a <= aEnd; a += aStep, b += bStep) { - // Load the matrices from device memory to shared memory; + // Load the matrices from device memory to shared memory; // a subset of threads loads a contiguous chunk of elements. // Previously, per-thread: @@ -216,13 +242,13 @@ class kernels(Enum): // Single Stage memcpy_async pipeline with Large copy chunk (float4) using arrive-wait barrier extern "C" -__global__ void MatrixMulAsyncCopyLargeChunkAWBarrier(float* __restrict__ C, +__global__ void MatrixMulAsyncCopyLargeChunkAWBarrier(float* __restrict__ C, const float* __restrict__ A, const float* __restrict__ B, int wA, int wB) { #if __CUDA_ARCH__ >= 700 #pragma diag_suppress static_var_with_dynamic_init - // Requires BLOCK_SIZE % 4 == 0 + // Requires BLOCK_SIZE % 4 == 0 __shared__ cuda::barrier bar; @@ -261,7 +287,7 @@ class kernels(Enum): // Loop over all the sub-matrices of A and B // required to compute the block sub-matrix for (int a = aBegin, b = bBegin; a <= aEnd; a += aStep, b += bStep) { - // Load the matrices from device memory to shared memory; + // Load the matrices from device memory to shared memory; // a subset of threads loads a contiguous chunk of elements. // Now, one fourth of the threads load four elements of each matrix @@ -375,7 +401,7 @@ class kernels(Enum): // Multi Stage memcpy_async thread_scope_thread pipeline with single-element async-copy extern "C" -__global__ void MatrixMulAsyncCopyMultiStage(float* __restrict__ C, +__global__ void MatrixMulAsyncCopyMultiStage(float* __restrict__ C, const float* __restrict__ A, const float* __restrict__ B, int wA, int wB) { @@ -461,7 +487,7 @@ class kernels(Enum): // group which issues memcpy_async operations and rest all warps are part of // consumer group which perform gemm computation on the loaded matrices by producer. extern "C" -__global__ void MatrixMulAsyncCopyMultiStageSharedState(float* __restrict__ C, +__global__ void MatrixMulAsyncCopyMultiStageSharedState(float* __restrict__ C, const float* __restrict__ A, const float* __restrict__ B, int wA, int wB) { @@ -510,7 +536,7 @@ class kernels(Enum): a <= aEnd; a += aStep, b += bStep, ++i) { if (threadIdx.y >= consumer_row_count) { // this is a whole producer warp because threadIdx.y >= 16 where 16 == consumer_row_count, - // which loads the matrices from device memory to shared memory; + // which loads the matrices from device memory to shared memory; for (; aStage <= a + aStep * maxPipelineStages; aStage += aStep, bStage += bStep, ++iStage) { if (aStage <= aEnd) { // Rotating buffer @@ -518,7 +544,7 @@ class kernels(Enum): const int strideRows = (blockDim.y - consumer_row_count); pipe.producer_acquire(); for (int rowId = threadIdx.y - consumer_row_count; rowId < BLOCK_SIZE_X; rowId += strideRows) { - cuda::memcpy_async(&As[j][rowId][threadIdx.x], + cuda::memcpy_async(&As[j][rowId][threadIdx.x], &A[aStage + wA * rowId + threadIdx.x], shape1, pipe); cuda::memcpy_async(&Bs[j][rowId][threadIdx.x], &B[bStage + wB * rowId + threadIdx.x], shape1, pipe); @@ -529,7 +555,7 @@ class kernels(Enum): } else { // this is a whole set of consumer group because threadIdx.y < consumer_row_count where consumer_row_count == 16, - // which computes gemm operation on matrices loaded in shared memory by producer warp. + // which computes gemm operation on matrices loaded in shared memory by producer warp. const int j = i % maxPipelineStages; // Synchronize consumer group to make sure the matrices are loaded by producer group. pipe.consumer_wait(); @@ -663,7 +689,7 @@ class kernels(Enum): a += aStep, b += bStep) { // Load the matrices from device memory - // to shared memory; + // to shared memory; // One fourth of the threads load four elements of each matrix if ( t4x < BLOCK_SIZE ) { @@ -697,356 +723,501 @@ class kernels(Enum): int c = wB * BLOCK_SIZE * blockIdx.y + BLOCK_SIZE * blockIdx.x; C[c + wB * threadIdx.y + threadIdx.x] = Csub; } -''' +""" + -def ConstantInit(data, size, val): +def constant_init(data, size, val): p_data = (ctypes.c_float * size).from_address(data) for i in range(size): p_data[i] = val + # # Run matrix multiplication using CUDA # -def MatrixMultiply(dimsA, dimsB, kernel_number): +def matrix_multiply(dims_a, dims_b, kernel_number): # Allocate host memory for matricies A and B - size_A = dimsA.x * dimsA.y - mem_size_A = np.dtype(np.float32).itemsize * size_A - h_A = checkCudaErrors(cudart.cudaMallocHost(mem_size_A)) - size_B = dimsB.x * dimsB.y - mem_size_B = np.dtype(np.float32).itemsize * size_B - h_B = checkCudaErrors(cudart.cudaMallocHost(mem_size_B)) + size_a = dims_a.x * dims_a.y + mem_size_a = np.dtype(np.float32).itemsize * size_a + h_a = check_cuda_errors(cudart.cudaMallocHost(mem_size_a)) + size_b = dims_b.x * dims_b.y + mem_size_b = np.dtype(np.float32).itemsize * size_b + h_b = check_cuda_errors(cudart.cudaMallocHost(mem_size_b)) # Initialize host memory - valB = 2.10 - ConstantInit(h_A, size_A, 1.0) - ConstantInit(h_B, size_B, valB) + val_b = 2.10 + constant_init(h_a, size_a, 1.0) + constant_init(h_b, size_b, val_b) # Allocate Device Memory # Allocate host matrix C - dimsC = cudart.dim3() - dimsC.x = dimsB.x - dimsC.y = dimsA.y - dimsC.z = 1 - mem_size_C = dimsC.x * dimsC.y * np.dtype(np.float32).itemsize - h_C = checkCudaErrors(cudart.cudaMallocHost(mem_size_C)) - - if h_C == 0: - print("Failed to allocate host matri C!") - exit(-1) - - d_A = checkCudaErrors(cudart.cudaMalloc(mem_size_A)) - d_B = checkCudaErrors(cudart.cudaMalloc(mem_size_B)) - d_C = checkCudaErrors(cudart.cudaMalloc(mem_size_C)) + dims_c = cudart.dim3() + dims_c.x = dims_b.x + dims_c.y = dims_a.y + dims_c.z = 1 + mem_size_c = dims_c.x * dims_c.y * np.dtype(np.float32).itemsize + h_c = check_cuda_errors(cudart.cudaMallocHost(mem_size_c)) + + if h_c == 0: + print("Failed to allocate host matrix C!", file=sys.stderr) + sys.exit(1) + + d_a = check_cuda_errors(cudart.cudaMalloc(mem_size_a)) + d_b = check_cuda_errors(cudart.cudaMalloc(mem_size_b)) + d_c = check_cuda_errors(cudart.cudaMalloc(mem_size_c)) # Allocate CUDA events that we'll use for timing - start = checkCudaErrors(cudart.cudaEventCreate()) - stop = checkCudaErrors(cudart.cudaEventCreate()) + start = check_cuda_errors(cudart.cudaEventCreate()) + stop = check_cuda_errors(cudart.cudaEventCreate()) - stream = checkCudaErrors(cudart.cudaStreamCreateWithFlags(cudart.cudaStreamNonBlocking)) + stream = check_cuda_errors(cudart.cudaStreamCreateWithFlags(cudart.cudaStreamNonBlocking)) # Copy host memory to device - checkCudaErrors(cudart.cudaMemcpyAsync(d_A, h_A, mem_size_A, cudart.cudaMemcpyKind.cudaMemcpyHostToDevice, stream)) - checkCudaErrors(cudart.cudaMemcpyAsync(d_B, h_B, mem_size_B, cudart.cudaMemcpyKind.cudaMemcpyHostToDevice, stream)) - checkCudaErrors(cudart.cudaMemsetAsync(d_C, 0, mem_size_C, stream)) + check_cuda_errors( + cudart.cudaMemcpyAsync(d_a, h_a, mem_size_a, cudart.cudaMemcpyKind.cudaMemcpyHostToDevice, stream) + ) + check_cuda_errors( + cudart.cudaMemcpyAsync(d_b, h_b, mem_size_b, cudart.cudaMemcpyKind.cudaMemcpyHostToDevice, stream) + ) + check_cuda_errors(cudart.cudaMemsetAsync(d_c, 0, mem_size_c, stream)) # Setup execution parameters threads = cudart.dim3() - threads.x = threads.y = blockSize + threads.x = threads.y = block_size threads.z = 1 grid = cudart.dim3() - grid.x = dimsB.x / threads.x - grid.y = dimsA.y / threads.y + grid.x = dims_b.x / threads.x + grid.y = dims_a.y / threads.y grid.z = 1 # Here the block size is 16x18, where first 16 rows are consumer thread group # and last 2 rows (1 warp) is producer thread group - threadsSharedStateKernel = cudart.dim3() - threadsSharedStateKernel.x = blockSize - threadsSharedStateKernel.y = blockSize + 2 - threadsSharedStateKernel.z = 1 - gridSharedStateKernel = cudart.dim3() - gridSharedStateKernel.x = dimsB.x / threadsSharedStateKernel.x - gridSharedStateKernel.y = dimsA.y / threadsSharedStateKernel.x - - print("Running kernel = {} - {}".format(kernel_number, kernelNames[kernel_number.value])) + threads_shared_state_kernel = cudart.dim3() + threads_shared_state_kernel.x = block_size + threads_shared_state_kernel.y = block_size + 2 + threads_shared_state_kernel.z = 1 + grid_shared_state_kernel = cudart.dim3() + grid_shared_state_kernel.x = dims_b.x / threads_shared_state_kernel.x + grid_shared_state_kernel.y = dims_a.y / threads_shared_state_kernel.x + + print(f"Running kernel = {kernel_number} - {kernel_names[kernel_number.value]}") # Create and start timer print("Computing result using CUDA Kernel...") # Performs warmup operation using matrixMul CUDA kernel - kernelArguments = ((d_C, d_A, d_B, dimsA.x, dimsB.x), - (ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_int, ctypes.c_int)) - if kernel_number == kernels.AsyncCopyMultiStageLargeChunk: - checkCudaErrors(cuda.cuLaunchKernel(_MatrixMulAsyncCopyMultiStageLargeChunk, - grid.x, grid.y, grid.z, # grid dim - threads.x, threads.y, threads.z, # block dim - 0, # shared mem - stream, # stream - kernelArguments, 0)) # arguments - elif kernel_number == kernels.AsyncCopyLargeChunk: - checkCudaErrors(cuda.cuLaunchKernel(_MatrixMulAsyncCopyLargeChunk, - grid.x, grid.y, grid.z, # grid dim - threads.x, threads.y, threads.z, # block dim - 0, # shared mem - stream, # stream - kernelArguments, 0)) # arguments - elif kernel_number == kernels.AsyncCopyLargeChunkAWBarrier: - checkCudaErrors(cuda.cuLaunchKernel(_MatrixMulAsyncCopyLargeChunkAWBarrier, - grid.x, grid.y, grid.z, # grid dim - threads.x, threads.y, threads.z, # block dim - 0, # shared mem - stream, # stream - kernelArguments, 0)) # arguments - elif kernel_number == kernels.AsyncCopyMultiStageSharedState: - checkCudaErrors(cuda.cuLaunchKernel(_MatrixMulAsyncCopyMultiStageSharedState, - gridSharedStateKernel.x, gridSharedStateKernel.y, gridSharedStateKernel.z, # grid dim - threadsSharedStateKernel.x, threadsSharedStateKernel.y, threadsSharedStateKernel.z, # block dim - 0, # shared mem - stream, # stream - kernelArguments, 0)) # arguments - elif kernel_number == kernels.AsyncCopyMultiStage: - checkCudaErrors(cuda.cuLaunchKernel(_MatrixMulAsyncCopyMultiStage, - grid.x, grid.y, grid.z, # grid dim - threads.x, threads.y, threads.z, # block dim - 0, # shared mem - stream, # stream - kernelArguments, 0)) # arguments - elif kernel_number == kernels.AsyncCopySingleStage: - checkCudaErrors(cuda.cuLaunchKernel(_MatrixMulAsyncCopySingleStage, - grid.x, grid.y, grid.z, # grid dim - threads.x, threads.y, threads.z, # block dim - 0, # shared mem - stream, # stream - kernelArguments, 0)) # arguments - elif kernel_number == kernels.Naive: - checkCudaErrors(cuda.cuLaunchKernel(_MatrixMulNaive, - grid.x, grid.y, grid.z, # grid dim - threads.x, threads.y, threads.z, # block dim - 0, # shared mem - stream, # stream - kernelArguments, 0)) # arguments - elif kernel_number == kernels.NaiveLargeChunk: - checkCudaErrors(cuda.cuLaunchKernel(_MatrixMulNaiveLargeChunk, - grid.x, grid.y, grid.z, # grid dim - threads.x, threads.y, threads.z, # block dim - 0, # shared mem - stream, # stream - kernelArguments, 0)) # arguments - - print('done') - checkCudaErrors(cudart.cudaStreamSynchronize(stream)) - + kernel_arguments = ( + (d_c, d_a, d_b, dims_a.x, dims_b.x), + (ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_int, ctypes.c_int), + ) + if kernel_number == Kernels.AsyncCopyMultiStageLargeChunk: + check_cuda_errors( + cuda.cuLaunchKernel( + _MatrixMulAsyncCopyMultiStageLargeChunk, + grid.x, + grid.y, + grid.z, # grid dim + threads.x, + threads.y, + threads.z, # block dim + 0, # shared mem + stream, # stream + kernel_arguments, + 0, + ) + ) # arguments + elif kernel_number == Kernels.AsyncCopyLargeChunk: + check_cuda_errors( + cuda.cuLaunchKernel( + _MatrixMulAsyncCopyLargeChunk, + grid.x, + grid.y, + grid.z, # grid dim + threads.x, + threads.y, + threads.z, # block dim + 0, # shared mem + stream, # stream + kernel_arguments, + 0, + ) + ) # arguments + elif kernel_number == Kernels.AsyncCopyLargeChunkAWBarrier: + check_cuda_errors( + cuda.cuLaunchKernel( + _MatrixMulAsyncCopyLargeChunkAWBarrier, + grid.x, + grid.y, + grid.z, # grid dim + threads.x, + threads.y, + threads.z, # block dim + 0, # shared mem + stream, # stream + kernel_arguments, + 0, + ) + ) # arguments + elif kernel_number == Kernels.AsyncCopyMultiStageSharedState: + check_cuda_errors( + cuda.cuLaunchKernel( + _MatrixMulAsyncCopyMultiStageSharedState, + grid_shared_state_kernel.x, + grid_shared_state_kernel.y, + grid_shared_state_kernel.z, # grid dim + threads_shared_state_kernel.x, + threads_shared_state_kernel.y, + threads_shared_state_kernel.z, # block dim + 0, # shared mem + stream, # stream + kernel_arguments, + 0, + ) + ) # arguments + elif kernel_number == Kernels.AsyncCopyMultiStage: + check_cuda_errors( + cuda.cuLaunchKernel( + _MatrixMulAsyncCopyMultiStage, + grid.x, + grid.y, + grid.z, # grid dim + threads.x, + threads.y, + threads.z, # block dim + 0, # shared mem + stream, # stream + kernel_arguments, + 0, + ) + ) # arguments + elif kernel_number == Kernels.AsyncCopySingleStage: + check_cuda_errors( + cuda.cuLaunchKernel( + _MatrixMulAsyncCopySingleStage, + grid.x, + grid.y, + grid.z, # grid dim + threads.x, + threads.y, + threads.z, # block dim + 0, # shared mem + stream, # stream + kernel_arguments, + 0, + ) + ) # arguments + elif kernel_number == Kernels.Naive: + check_cuda_errors( + cuda.cuLaunchKernel( + _MatrixMulNaive, + grid.x, + grid.y, + grid.z, # grid dim + threads.x, + threads.y, + threads.z, # block dim + 0, # shared mem + stream, # stream + kernel_arguments, + 0, + ) + ) # arguments + elif kernel_number == Kernels.NaiveLargeChunk: + check_cuda_errors( + cuda.cuLaunchKernel( + _MatrixMulNaiveLargeChunk, + grid.x, + grid.y, + grid.z, # grid dim + threads.x, + threads.y, + threads.z, # block dim + 0, # shared mem + stream, # stream + kernel_arguments, + 0, + ) + ) # arguments + + check_cuda_errors(cudart.cudaStreamSynchronize(stream)) # Execute the kernel - nIter = 100 + n_iter = 100 # Record the start event - checkCudaErrors(cudart.cudaEventRecord(start, stream)) - - if kernel_number == kernels.AsyncCopyMultiStageLargeChunk: - checkCudaErrors(cuda.cuLaunchKernel(_MatrixMulAsyncCopyMultiStageLargeChunk, - grid.x, grid.y, grid.z, # grid dim - threads.x, threads.y, threads.z, # block dim - 0, # shared mem - stream, # stream - kernelArguments, 0)) # arguments - elif kernel_number == kernels.AsyncCopyLargeChunk: - checkCudaErrors(cuda.cuLaunchKernel(_MatrixMulAsyncCopyLargeChunk, - grid.x, grid.y, grid.z, # grid dim - threads.x, threads.y, threads.z, # block dim - 0, # shared mem - stream, # stream - kernelArguments, 0)) # arguments - elif kernel_number == kernels.AsyncCopyLargeChunkAWBarrier: - checkCudaErrors(cuda.cuLaunchKernel(_MatrixMulAsyncCopyLargeChunkAWBarrier, - grid.x, grid.y, grid.z, # grid dim - threads.x, threads.y, threads.z, # block dim - 0, # shared mem - stream, # stream - kernelArguments, 0)) # arguments - elif kernel_number == kernels.AsyncCopyMultiStageSharedState: - checkCudaErrors(cuda.cuLaunchKernel(_MatrixMulAsyncCopyMultiStageSharedState, - gridSharedStateKernel.x, gridSharedStateKernel.y, gridSharedStateKernel.z, # grid dim - threadsSharedStateKernel.x, threadsSharedStateKernel.y, threadsSharedStateKernel.z, # block dim - 0, # shared mem - stream, # stream - kernelArguments, 0)) # arguments - elif kernel_number == kernels.AsyncCopyMultiStage: - checkCudaErrors(cuda.cuLaunchKernel(_MatrixMulAsyncCopyMultiStage, - grid.x, grid.y, grid.z, # grid dim - threads.x, threads.y, threads.z, # block dim - 0, # shared mem - stream, # stream - kernelArguments, 0)) # arguments - elif kernel_number == kernels.AsyncCopySingleStage: - checkCudaErrors(cuda.cuLaunchKernel(_MatrixMulAsyncCopySingleStage, - grid.x, grid.y, grid.z, # grid dim - threads.x, threads.y, threads.z, # block dim - 0, # shared mem - stream, # stream - kernelArguments, 0)) # arguments - elif kernel_number == kernels.Naive: - checkCudaErrors(cuda.cuLaunchKernel(_MatrixMulNaive, - grid.x, grid.y, grid.z, # grid dim - threads.x, threads.y, threads.z, # block dim - 0, # shared mem - stream, # stream - kernelArguments, 0)) # arguments - elif kernel_number == kernels.NaiveLargeChunk: - checkCudaErrors(cuda.cuLaunchKernel(_MatrixMulNaiveLargeChunk, - grid.x, grid.y, grid.z, # grid dim - threads.x, threads.y, threads.z, # block dim - 0, # shared mem - stream, # stream - kernelArguments, 0)) # arguments + check_cuda_errors(cudart.cudaEventRecord(start, stream)) + + if kernel_number == Kernels.AsyncCopyMultiStageLargeChunk: + check_cuda_errors( + cuda.cuLaunchKernel( + _MatrixMulAsyncCopyMultiStageLargeChunk, + grid.x, + grid.y, + grid.z, # grid dim + threads.x, + threads.y, + threads.z, # block dim + 0, # shared mem + stream, # stream + kernel_arguments, + 0, + ) + ) # arguments + elif kernel_number == Kernels.AsyncCopyLargeChunk: + check_cuda_errors( + cuda.cuLaunchKernel( + _MatrixMulAsyncCopyLargeChunk, + grid.x, + grid.y, + grid.z, # grid dim + threads.x, + threads.y, + threads.z, # block dim + 0, # shared mem + stream, # stream + kernel_arguments, + 0, + ) + ) # arguments + elif kernel_number == Kernels.AsyncCopyLargeChunkAWBarrier: + check_cuda_errors( + cuda.cuLaunchKernel( + _MatrixMulAsyncCopyLargeChunkAWBarrier, + grid.x, + grid.y, + grid.z, # grid dim + threads.x, + threads.y, + threads.z, # block dim + 0, # shared mem + stream, # stream + kernel_arguments, + 0, + ) + ) # arguments + elif kernel_number == Kernels.AsyncCopyMultiStageSharedState: + check_cuda_errors( + cuda.cuLaunchKernel( + _MatrixMulAsyncCopyMultiStageSharedState, + grid_shared_state_kernel.x, + grid_shared_state_kernel.y, + grid_shared_state_kernel.z, # grid dim + threads_shared_state_kernel.x, + threads_shared_state_kernel.y, + threads_shared_state_kernel.z, # block dim + 0, # shared mem + stream, # stream + kernel_arguments, + 0, + ) + ) # arguments + elif kernel_number == Kernels.AsyncCopyMultiStage: + check_cuda_errors( + cuda.cuLaunchKernel( + _MatrixMulAsyncCopyMultiStage, + grid.x, + grid.y, + grid.z, # grid dim + threads.x, + threads.y, + threads.z, # block dim + 0, # shared mem + stream, # stream + kernel_arguments, + 0, + ) + ) # arguments + elif kernel_number == Kernels.AsyncCopySingleStage: + check_cuda_errors( + cuda.cuLaunchKernel( + _MatrixMulAsyncCopySingleStage, + grid.x, + grid.y, + grid.z, # grid dim + threads.x, + threads.y, + threads.z, # block dim + 0, # shared mem + stream, # stream + kernel_arguments, + 0, + ) + ) # arguments + elif kernel_number == Kernels.Naive: + check_cuda_errors( + cuda.cuLaunchKernel( + _MatrixMulNaive, + grid.x, + grid.y, + grid.z, # grid dim + threads.x, + threads.y, + threads.z, # block dim + 0, # shared mem + stream, # stream + kernel_arguments, + 0, + ) + ) # arguments + elif kernel_number == Kernels.NaiveLargeChunk: + check_cuda_errors( + cuda.cuLaunchKernel( + _MatrixMulNaiveLargeChunk, + grid.x, + grid.y, + grid.z, # grid dim + threads.x, + threads.y, + threads.z, # block dim + 0, # shared mem + stream, # stream + kernel_arguments, + 0, + ) + ) # arguments # Record the stop event - checkCudaErrors(cudart.cudaEventRecord(stop, stream)) + check_cuda_errors(cudart.cudaEventRecord(stop, stream)) # Wait for the stop event to complete - checkCudaErrors(cudart.cudaEventSynchronize(stop)) + check_cuda_errors(cudart.cudaEventSynchronize(stop)) - msecTotal = checkCudaErrors(cudart.cudaEventElapsedTime(start, stop)) + msec_total = check_cuda_errors(cudart.cudaEventElapsedTime(start, stop)) # Compute and print the performance - msecPerMatrixMul = msecTotal / nIter - flopsPerMatrixMul = 2.0 * dimsA.x * dimsA.y * dimsB.x - gigaFlops = (flopsPerMatrixMul * 1.0e-9) / (msecPerMatrixMul / 1000.0) + msec_per_matrix_mul = msec_total / n_iter + flops_per_matrix_mul = 2.0 * dims_a.x * dims_a.y * dims_b.x + giga_flops = (flops_per_matrix_mul * 1.0e-9) / (msec_per_matrix_mul / 1000.0) - print("Performance= {:.2f} GFlop/s, Time= {:.2f} msec, Size= {:.0f} Ops, WorkgroupSize= {} threads/block".format( - gigaFlops, - msecPerMatrixMul, - flopsPerMatrixMul, - threads.x * threads.y)) + print( + f"Performance= {giga_flops:.2f} GFlop/s, Time= {msec_per_matrix_mul:.2f} msec, Size= {flops_per_matrix_mul:.0f} Ops, WorkgroupSize= {threads.x * threads.y} threads/block" + ) # Copy result from device to host - checkCudaErrors(cudart.cudaMemcpyAsync(h_C, d_C, mem_size_C, cudart.cudaMemcpyKind.cudaMemcpyDeviceToHost, stream)) - checkCudaErrors(cudart.cudaStreamSynchronize(stream)) + check_cuda_errors( + cudart.cudaMemcpyAsync(h_c, d_c, mem_size_c, cudart.cudaMemcpyKind.cudaMemcpyDeviceToHost, stream) + ) + check_cuda_errors(cudart.cudaStreamSynchronize(stream)) - print("Checking computed result for correctness: ") correct = True # test relative error by the formula # |_cpu - _gpu|/<|x|, |y|> < eps - eps = 1.e-6 + eps = 1.0e-6 - h_C_local = (ctypes.c_float * (dimsC.x * dimsC.y)).from_address(h_C) - for i in range(dimsC.x * dimsC.y): - abs_err = math.fabs(h_C_local[i] - (dimsA.x * valB)) - dot_length = dimsA.x - abs_val = math.fabs(h_C_local[i]) + h_c_local = (ctypes.c_float * (dims_c.x * dims_c.y)).from_address(h_c) + for i in range(dims_c.x * dims_c.y): + abs_err = math.fabs(h_c_local[i] - (dims_a.x * val_b)) + dot_length = dims_a.x + abs_val = math.fabs(h_c_local[i]) rel_err = abs_err / abs_val / dot_length if rel_err > eps: - print("Error! Matrix[{:.5f}]={:.8f} ref={:.8f} err term is > {}".format(i, h_C_local[i], dimsA.x * valB, rel_err)) + print( + f"Error! Matrix[{i:.5f}]={h_c_local[i]:.8f} ref={dims_a.x * val_b:.8f} err term is > {rel_err}", + file=sys.stderr, + ) correct = False - print("Result = PASS" if correct else "Result = FAIL") + if not correct: + print("Result = FAIL", file=sys.stderr) # Clean up memory - checkCudaErrors(cudart.cudaFreeHost(h_A)) - checkCudaErrors(cudart.cudaFreeHost(h_B)) - checkCudaErrors(cudart.cudaFreeHost(h_C)) - checkCudaErrors(cudart.cudaFree(d_A)) - checkCudaErrors(cudart.cudaFree(d_B)) - checkCudaErrors(cudart.cudaFree(d_C)) - checkCudaErrors(cudart.cudaEventDestroy(start)) - checkCudaErrors(cudart.cudaEventDestroy(stop)) - print("\nNOTE: The CUDA Samples are not meant for performance "\ - "measurements. Results may vary when GPU Boost is enabled."); - + check_cuda_errors(cudart.cudaFreeHost(h_a)) + check_cuda_errors(cudart.cudaFreeHost(h_b)) + check_cuda_errors(cudart.cudaFreeHost(h_c)) + check_cuda_errors(cudart.cudaFree(d_a)) + check_cuda_errors(cudart.cudaFree(d_b)) + check_cuda_errors(cudart.cudaFree(d_c)) + check_cuda_errors(cudart.cudaEventDestroy(start)) + check_cuda_errors(cudart.cudaEventDestroy(stop)) + print( + "\nNOTE: The CUDA Samples are not meant for performance " + "measurements. Results may vary when GPU Boost is enabled." + ) if correct: return 0 return -1 -def checkKernelCompiles(): - kernel_headers = '''\ - #line __LINE__ - #if __CUDA_ARCH__ >= 700 - #include - #endif - #include - #include - #include - ''' - try: - common.KernelHelper(kernel_headers, findCudaDevice()) - except: - # Filters out test from automation for two reasons - # 1. Headers are not found - # 2. Incompatible device - return False - return True - -@pytest.mark.skipif(not checkKernelCompiles(), reason="Automation filter against incompatible kernel") + def main(): - print("[globalToShmemAsyncCopy] - Starting...") + check_compute_capability_too_low(find_cuda_device(), (7, 0)) - version = checkCudaErrors(cuda.cuDriverGetVersion()) + if platform.system() == "QNX": + requirement_not_met("globalToShmemAsyncCopy is not supported on QNX") + + version = check_cuda_errors(cuda.cuDriverGetVersion()) if version < 11010: - print("CUDA Toolkit 11.1 or greater is required") - return - - if (checkCmdLineFlag("help") or checkCmdLineFlag("?")): - print("Usage device=n (n >= 0 for deviceID)") - print(" wA=WidthA hA=HeightA (Width x Height of Matrix A)") - print(" wB=WidthB hB=HeightB (Width x Height of Matrix B)") - print(" kernel=kernel_number (0 - AsyncCopyMultiStageLargeChunk; 1 - AsyncCopyLargeChunk)") - print(" (2 - AsyncCopyLargeChunkAWBarrier; 3 - AsyncCopyMultiStageSharedState)") - print(" (4 - AsyncCopyMultiStage; 5 - AsyncCopySingleStage; 6 - Naive without memcpy_async)") - print(" (7 - NaiveLargeChunk without memcpy_async)") - print(" Note: Outer matrix dimensions of A & B matrices must be equal.") - return + requirement_not_met("CUDA Toolkit 11.1 or greater is required") + + if check_cmd_line_flag("help") or check_cmd_line_flag("?"): + print("Usage device=n (n >= 0 for deviceID)", file=sys.stderr) + print(" wA=WidthA hA=HeightA (Width x Height of Matrix A)", file=sys.stderr) + print(" wB=WidthB hB=HeightB (Width x Height of Matrix B)", file=sys.stderr) + print( + " kernel=kernel_number (0 - AsyncCopyMultiStageLargeChunk; 1 - AsyncCopyLargeChunk)", file=sys.stderr + ) + print( + " (2 - AsyncCopyLargeChunkAWBarrier; 3 - AsyncCopyMultiStageSharedState)", + file=sys.stderr, + ) + print( + " (4 - AsyncCopyMultiStage; 5 - AsyncCopySingleStage; 6 - Naive without memcpy_async)", + file=sys.stderr, + ) + print(" (7 - NaiveLargeChunk without memcpy_async)", file=sys.stderr) + print(" Note: Outer matrix dimensions of A & B matrices must be equal.", file=sys.stderr) + sys.exit(1) # This will pick the best possible CUDA capable device, otherwise # override the device ID based on input provided at the command line - devID = findCudaDevice() + dev_id = find_cuda_device() - matrixBlock = 32 - dimsA = cudart.dim3() - dimsA.x = dimsA.y = 10 * 4 * matrixBlock - dimsA.z = 1 - dimsB = cudart.dim3() - dimsB.x = dimsB.y = 10 * 4 * matrixBlock - dimsB.z = 1 + matrix_block = 32 + dims_a = cudart.dim3() + dims_a.x = dims_a.y = 10 * 4 * matrix_block + dims_a.z = 1 + dims_b = cudart.dim3() + dims_b.x = dims_b.y = 10 * 4 * matrix_block + dims_b.z = 1 # width of Matrix A - if checkCmdLineFlag("wA="): - dimsA.x = int(getCmdLineArgumentInt("wA=")) + if check_cmd_line_flag("wA="): + dims_a.x = int(get_cmd_line_argument_int("wA=")) # height of Matrix A - if checkCmdLineFlag("hA="): - dimsA.y = int(getCmdLineArgumentInt("hA=")) + if check_cmd_line_flag("hA="): + dims_a.y = int(get_cmd_line_argument_int("hA=")) # width of Matrix B - if checkCmdLineFlag("wB="): - dimsB.x = int(getCmdLineArgumentInt("wB=")) + if check_cmd_line_flag("wB="): + dims_b.x = int(get_cmd_line_argument_int("wB=")) # height of Matrix B - if checkCmdLineFlag("hB="): - dimsB.y = int(getCmdLineArgumentInt("hB=")) + if check_cmd_line_flag("hB="): + dims_b.y = int(get_cmd_line_argument_int("hB=")) - if dimsA.x != dimsB.y: - print("Error: outer matrix dimensions must be equal. ({} != {})".format(dimsA.x, dimsB.y)) - sys.exit(-1) + if dims_a.x != dims_b.y: + print(f"Error: outer matrix dimensions must be equal. ({dims_a.x} != {dims_b.y})", file=sys.stderr) + sys.exit(1) - selected_kernel = kernels.AsyncCopyMultiStageLargeChunk + selected_kernel = Kernels.AsyncCopyMultiStageLargeChunk # kernel to run - default (AsyncCopyMultiStageLargeChunk == 0) - if checkCmdLineFlag("kernel="): - kernel_number = int(getCmdLineArgumentInt("kernel=")) + if check_cmd_line_flag("kernel="): + kernel_number = int(get_cmd_line_argument_int("kernel=")) if kernel_number < 8: - selected_kernel = kernels(kernel_number) + selected_kernel = Kernels(kernel_number) else: - print("Error: kernel number should be between 0 to 7, you have entered %d".format(kernel_number)) - sys.exit(-1) + print("Error: kernel number should be between 0 to 7", file=sys.stderr) + sys.exit(1) - major = checkCudaErrors(cudart.cudaDeviceGetAttribute(cudart.cudaDeviceAttr.cudaDevAttrComputeCapabilityMajor, devID)) + major = check_cuda_errors( + cudart.cudaDeviceGetAttribute(cudart.cudaDeviceAttr.cudaDevAttrComputeCapabilityMajor, dev_id) + ) if major < 7: - print("globalToShmemAsyncCopy requires SM 7.0 or higher. Exiting...") - return + requirement_not_met("globalToShmemAsyncCopy requires SM 7.0 or higher.") - print("MatrixA({},{}), MatrixB({},{})".format(dimsA.x, dimsA.y, - dimsB.x, dimsB.y)) + print(f"MatrixA({dims_a.x},{dims_a.y}), MatrixB({dims_b.x},{dims_b.y})") global _MatrixMulAsyncCopyMultiStageLargeChunk global _MatrixMulAsyncCopyLargeChunk @@ -1056,20 +1227,21 @@ def main(): global _MatrixMulAsyncCopySingleStage global _MatrixMulNaive global _MatrixMulNaiveLargeChunk - kernelHelper = common.KernelHelper(globalToShmemAsyncCopy, devID) - _MatrixMulAsyncCopyMultiStageLargeChunk = kernelHelper.getFunction(b'MatrixMulAsyncCopyMultiStageLargeChunk') - _MatrixMulAsyncCopyLargeChunk = kernelHelper.getFunction(b'MatrixMulAsyncCopyLargeChunk') - _MatrixMulAsyncCopyLargeChunkAWBarrier = kernelHelper.getFunction(b'MatrixMulAsyncCopyLargeChunkAWBarrier') - _MatrixMulAsyncCopyMultiStageSharedState = kernelHelper.getFunction(b'MatrixMulAsyncCopyMultiStageSharedState') - _MatrixMulAsyncCopyMultiStage = kernelHelper.getFunction(b'MatrixMulAsyncCopyMultiStage') - _MatrixMulAsyncCopySingleStage = kernelHelper.getFunction(b'MatrixMulAsyncCopySingleStage') - _MatrixMulNaive = kernelHelper.getFunction(b'MatrixMulNaive') - _MatrixMulNaiveLargeChunk = kernelHelper.getFunction(b'MatrixMulNaiveLargeChunk') - - matrix_result = MatrixMultiply(dimsA, dimsB, selected_kernel) + kernel_helper = KernelHelper(global_to_shmem_async_copy, dev_id) + _MatrixMulAsyncCopyMultiStageLargeChunk = kernel_helper.get_function(b"MatrixMulAsyncCopyMultiStageLargeChunk") + _MatrixMulAsyncCopyLargeChunk = kernel_helper.get_function(b"MatrixMulAsyncCopyLargeChunk") + _MatrixMulAsyncCopyLargeChunkAWBarrier = kernel_helper.get_function(b"MatrixMulAsyncCopyLargeChunkAWBarrier") + _MatrixMulAsyncCopyMultiStageSharedState = kernel_helper.get_function(b"MatrixMulAsyncCopyMultiStageSharedState") + _MatrixMulAsyncCopyMultiStage = kernel_helper.get_function(b"MatrixMulAsyncCopyMultiStage") + _MatrixMulAsyncCopySingleStage = kernel_helper.get_function(b"MatrixMulAsyncCopySingleStage") + _MatrixMulNaive = kernel_helper.get_function(b"MatrixMulNaive") + _MatrixMulNaiveLargeChunk = kernel_helper.get_function(b"MatrixMulNaiveLargeChunk") + + matrix_result = matrix_multiply(dims_a, dims_b, selected_kernel) if matrix_result != 0: - sys.exit(-1) + sys.exit(1) + if __name__ == "__main__": main() diff --git a/cuda_bindings/examples/3_CUDA_Features/simple_cuda_graphs.py b/cuda_bindings/examples/3_CUDA_Features/simple_cuda_graphs.py new file mode 100644 index 00000000000..317a774d5df --- /dev/null +++ b/cuda_bindings/examples/3_CUDA_Features/simple_cuda_graphs.py @@ -0,0 +1,413 @@ +# Copyright 2021-2026 NVIDIA Corporation. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +# ################################################################################ +# +# This example demonstrates CUDA Graphs for capture and replay of GPU +# workloads, including manual graph construction and stream capture. +# +# ################################################################################ + +# /// script +# dependencies = ["cuda_bindings>13.2.1", "numpy"] +# /// + +import ctypes +import random as rnd + +import numpy as np + +from cuda.bindings import driver as cuda +from cuda.bindings import runtime as cudart +from cuda.bindings._example_helpers import ( + KernelHelper, + check_cuda_errors, + find_cuda_device, +) + +THREADS_PER_BLOCK = 512 +GRAPH_LAUNCH_ITERATIONS = 3 + +simple_cuda_graphs = """\ +#include +#include + +namespace cg = cooperative_groups; + +#define THREADS_PER_BLOCK 512 +#define GRAPH_LAUNCH_ITERATIONS 3 + +extern "C" +__global__ void reduce(float *inputVec, double *outputVec, size_t inputSize, + size_t outputSize) { + __shared__ double tmp[THREADS_PER_BLOCK]; + + cg::thread_block cta = cg::this_thread_block(); + size_t globaltid = blockIdx.x * blockDim.x + threadIdx.x; + + double temp_sum = 0.0; + for (int i = globaltid; i < inputSize; i += gridDim.x * blockDim.x) { + temp_sum += (double)inputVec[i]; + } + tmp[cta.thread_rank()] = temp_sum; + + cg::sync(cta); + + cg::thread_block_tile<32> tile32 = cg::tiled_partition<32>(cta); + + double beta = temp_sum; + double temp; + + for (int i = tile32.size() / 2; i > 0; i >>= 1) { + if (tile32.thread_rank() < i) { + temp = tmp[cta.thread_rank() + i]; + beta += temp; + tmp[cta.thread_rank()] = beta; + } + cg::sync(tile32); + } + cg::sync(cta); + + if (cta.thread_rank() == 0 && blockIdx.x < outputSize) { + beta = 0.0; + for (int i = 0; i < cta.size(); i += tile32.size()) { + beta += tmp[i]; + } + outputVec[blockIdx.x] = beta; + } +} + +extern "C" +__global__ void reduceFinal(double *inputVec, double *result, + size_t inputSize) { + __shared__ double tmp[THREADS_PER_BLOCK]; + + cg::thread_block cta = cg::this_thread_block(); + size_t globaltid = blockIdx.x * blockDim.x + threadIdx.x; + + double temp_sum = 0.0; + for (int i = globaltid; i < inputSize; i += gridDim.x * blockDim.x) { + temp_sum += (double)inputVec[i]; + } + tmp[cta.thread_rank()] = temp_sum; + + cg::sync(cta); + + cg::thread_block_tile<32> tile32 = cg::tiled_partition<32>(cta); + + // do reduction in shared mem + if ((blockDim.x >= 512) && (cta.thread_rank() < 256)) { + tmp[cta.thread_rank()] = temp_sum = temp_sum + tmp[cta.thread_rank() + 256]; + } + + cg::sync(cta); + + if ((blockDim.x >= 256) && (cta.thread_rank() < 128)) { + tmp[cta.thread_rank()] = temp_sum = temp_sum + tmp[cta.thread_rank() + 128]; + } + + cg::sync(cta); + + if ((blockDim.x >= 128) && (cta.thread_rank() < 64)) { + tmp[cta.thread_rank()] = temp_sum = temp_sum + tmp[cta.thread_rank() + 64]; + } + + cg::sync(cta); + + if (cta.thread_rank() < 32) { + // Fetch final intermediate sum from 2nd warp + if (blockDim.x >= 64) temp_sum += tmp[cta.thread_rank() + 32]; + // Reduce final warp using shuffle + for (int offset = tile32.size() / 2; offset > 0; offset /= 2) { + temp_sum += tile32.shfl_down(temp_sum, offset); + } + } + // write result for this block to global mem + if (cta.thread_rank() == 0) result[0] = temp_sum; +} +""" + + +def init_input(a, size): + ctypes.c_float.from_address(a) + a_list = ctypes.pointer(ctypes.c_float.from_address(a)) + for i in range(size): + a_list[i] = rnd.random() + + +def cuda_graphs_manual(input_vec_h, input_vec_d, output_vec_d, result_d, input_size, num_of_blocks): + result_h = ctypes.c_double(0.0) + node_dependencies = [] + + stream_for_graph = check_cuda_errors(cudart.cudaStreamCreate()) + + kernel_node_params = cuda.CUDA_KERNEL_NODE_PARAMS() + memcpy_params = cudart.cudaMemcpy3DParms() + memset_params = cudart.cudaMemsetParams() + + memcpy_params.srcArray = None + memcpy_params.srcPos = cudart.make_cudaPos(0, 0, 0) + memcpy_params.srcPtr = cudart.make_cudaPitchedPtr( + input_vec_h, np.dtype(np.float32).itemsize * input_size, input_size, 1 + ) + memcpy_params.dstArray = None + memcpy_params.dstPos = cudart.make_cudaPos(0, 0, 0) + memcpy_params.dstPtr = cudart.make_cudaPitchedPtr( + input_vec_d, np.dtype(np.float32).itemsize * input_size, input_size, 1 + ) + memcpy_params.extent = cudart.make_cudaExtent(np.dtype(np.float32).itemsize * input_size, 1, 1) + memcpy_params.kind = cudart.cudaMemcpyKind.cudaMemcpyHostToDevice + + memset_params.dst = output_vec_d + memset_params.value = 0 + memset_params.pitch = 0 + memset_params.elementSize = np.dtype(np.float32).itemsize # elementSize can be max 4 bytes + memset_params.width = num_of_blocks * 2 + memset_params.height = 1 + + graph = check_cuda_errors(cudart.cudaGraphCreate(0)) + + memcpy_node = check_cuda_errors(cudart.cudaGraphAddMemcpyNode(graph, None, 0, memcpy_params)) + memset_node = check_cuda_errors(cudart.cudaGraphAddMemsetNode(graph, None, 0, memset_params)) + + node_dependencies.append(memset_node) + node_dependencies.append(memcpy_node) + + kernel_args = ( + (input_vec_d, output_vec_d, input_size, num_of_blocks), + (ctypes.c_void_p, ctypes.c_void_p, ctypes.c_size_t, ctypes.c_uint), + ) + + kernel_node_params.func = _reduce + kernel_node_params.gridDimX = num_of_blocks + kernel_node_params.gridDimY = kernel_node_params.gridDimZ = 1 + kernel_node_params.blockDimX = THREADS_PER_BLOCK + kernel_node_params.blockDimY = kernel_node_params.blockDimZ = 1 + kernel_node_params.sharedMemBytes = 0 + kernel_node_params.kernelParams = kernel_args + # kernelNodeParams.extra = None + + kernel_node = check_cuda_errors( + cuda.cuGraphAddKernelNode(graph, node_dependencies, len(node_dependencies), kernel_node_params) + ) + + node_dependencies.clear() + node_dependencies.append(kernel_node) + + memset_params = cudart.cudaMemsetParams() + memset_params.dst = result_d + memset_params.value = 0 + memset_params.elementSize = np.dtype(np.float32).itemsize + memset_params.width = 2 + memset_params.height = 1 + memset_node = check_cuda_errors(cudart.cudaGraphAddMemsetNode(graph, None, 0, memset_params)) + + node_dependencies.append(memset_node) + + kernel_node_params = cuda.CUDA_KERNEL_NODE_PARAMS() + kernel_node_params.func = _reduceFinal + kernel_node_params.gridDimX = kernel_node_params.gridDimY = kernel_node_params.gridDimZ = 1 + kernel_node_params.blockDimX = THREADS_PER_BLOCK + kernel_node_params.blockDimY = kernel_node_params.blockDimZ = 1 + kernel_node_params.sharedMemBytes = 0 + kernel_args2 = ( + (output_vec_d, result_d, num_of_blocks), + (ctypes.c_void_p, ctypes.c_void_p, ctypes.c_uint), + ) + kernel_node_params.kernelParams = kernel_args2 + # kernelNodeParams.extra = None + + kernel_node = check_cuda_errors( + cuda.cuGraphAddKernelNode(graph, node_dependencies, len(node_dependencies), kernel_node_params) + ) + + node_dependencies.clear() + node_dependencies.append(kernel_node) + + memcpy_params = cudart.cudaMemcpy3DParms() + + memcpy_params.srcArray = None + memcpy_params.srcPos = cudart.make_cudaPos(0, 0, 0) + memcpy_params.srcPtr = cudart.make_cudaPitchedPtr(result_d, np.dtype(np.float64).itemsize, 1, 1) + memcpy_params.dstArray = None + memcpy_params.dstPos = cudart.make_cudaPos(0, 0, 0) + memcpy_params.dstPtr = cudart.make_cudaPitchedPtr(result_h, np.dtype(np.float64).itemsize, 1, 1) + memcpy_params.extent = cudart.make_cudaExtent(np.dtype(np.float64).itemsize, 1, 1) + memcpy_params.kind = cudart.cudaMemcpyKind.cudaMemcpyDeviceToHost + memcpy_node = check_cuda_errors( + cudart.cudaGraphAddMemcpyNode(graph, node_dependencies, len(node_dependencies), memcpy_params) + ) + + node_dependencies.clear() + node_dependencies.append(memcpy_node) + + # WIP: Host nodes + + nodes, num_nodes = check_cuda_errors(cudart.cudaGraphGetNodes(graph)) + print(f"\nNum of nodes in the graph created manually = {num_nodes}") + + graph_exec = check_cuda_errors(cudart.cudaGraphInstantiate(graph, 0)) + + cloned_graph = check_cuda_errors(cudart.cudaGraphClone(graph)) + cloned_graph_exec = check_cuda_errors(cudart.cudaGraphInstantiate(cloned_graph, 0)) + + for _i in range(GRAPH_LAUNCH_ITERATIONS): + check_cuda_errors(cudart.cudaGraphLaunch(graph_exec, stream_for_graph)) + + check_cuda_errors(cudart.cudaStreamSynchronize(stream_for_graph)) + + print("Cloned Graph Output..") + for _i in range(GRAPH_LAUNCH_ITERATIONS): + check_cuda_errors(cudart.cudaGraphLaunch(cloned_graph_exec, stream_for_graph)) + + check_cuda_errors(cudart.cudaStreamSynchronize(stream_for_graph)) + + check_cuda_errors(cudart.cudaGraphExecDestroy(graph_exec)) + check_cuda_errors(cudart.cudaGraphExecDestroy(cloned_graph_exec)) + check_cuda_errors(cudart.cudaGraphDestroy(graph)) + check_cuda_errors(cudart.cudaGraphDestroy(cloned_graph)) + check_cuda_errors(cudart.cudaStreamDestroy(stream_for_graph)) + + +def cuda_graphs_using_stream_capture(input_vec_h, input_vec_d, output_vec_d, result_d, input_size, num_of_blocks): + result_h = ctypes.c_double(0.0) + + stream1 = check_cuda_errors(cudart.cudaStreamCreate()) + stream2 = check_cuda_errors(cudart.cudaStreamCreate()) + stream3 = check_cuda_errors(cudart.cudaStreamCreate()) + stream_for_graph = check_cuda_errors(cudart.cudaStreamCreate()) + + fork_stream_event = check_cuda_errors(cudart.cudaEventCreate()) + memset_event1 = check_cuda_errors(cudart.cudaEventCreate()) + memset_event2 = check_cuda_errors(cudart.cudaEventCreate()) + + check_cuda_errors(cudart.cudaStreamBeginCapture(stream1, cudart.cudaStreamCaptureMode.cudaStreamCaptureModeGlobal)) + + check_cuda_errors(cudart.cudaEventRecord(fork_stream_event, stream1)) + check_cuda_errors(cudart.cudaStreamWaitEvent(stream2, fork_stream_event, 0)) + check_cuda_errors(cudart.cudaStreamWaitEvent(stream3, fork_stream_event, 0)) + + check_cuda_errors( + cudart.cudaMemcpyAsync( + input_vec_d, + input_vec_h, + np.dtype(np.float32).itemsize * input_size, + cudart.cudaMemcpyKind.cudaMemcpyDefault, + stream1, + ) + ) + + check_cuda_errors(cudart.cudaMemsetAsync(output_vec_d, 0, np.dtype(np.float64).itemsize * num_of_blocks, stream2)) + + check_cuda_errors(cudart.cudaEventRecord(memset_event1, stream2)) + + check_cuda_errors(cudart.cudaMemsetAsync(result_d, 0, np.dtype(np.float64).itemsize, stream3)) + check_cuda_errors(cudart.cudaEventRecord(memset_event2, stream3)) + + check_cuda_errors(cudart.cudaStreamWaitEvent(stream1, memset_event1, 0)) + + kernel_args = ( + (input_vec_d, output_vec_d, input_size, num_of_blocks), + (ctypes.c_void_p, ctypes.c_void_p, ctypes.c_size_t, ctypes.c_uint), + ) + check_cuda_errors( + cuda.cuLaunchKernel( + _reduce, + num_of_blocks, + 1, + 1, + THREADS_PER_BLOCK, + 1, + 1, + 0, + stream1, + kernel_args, + 0, + ) + ) + + check_cuda_errors(cudart.cudaStreamWaitEvent(stream1, memset_event2, 0)) + + kernel_args2 = ( + (output_vec_d, result_d, num_of_blocks), + (ctypes.c_void_p, ctypes.c_void_p, ctypes.c_uint), + ) + check_cuda_errors(cuda.cuLaunchKernel(_reduceFinal, 1, 1, 1, THREADS_PER_BLOCK, 1, 1, 0, stream1, kernel_args2, 0)) + + check_cuda_errors( + cudart.cudaMemcpyAsync( + result_h, + result_d, + np.dtype(np.float64).itemsize, + cudart.cudaMemcpyKind.cudaMemcpyDefault, + stream1, + ) + ) + + # WIP: Host nodes + + graph = check_cuda_errors(cudart.cudaStreamEndCapture(stream1)) + + nodes, num_nodes = check_cuda_errors(cudart.cudaGraphGetNodes(graph)) + print(f"\nNum of nodes in the graph created using stream capture API = {num_nodes}") + + graph_exec = check_cuda_errors(cudart.cudaGraphInstantiate(graph, 0)) + + cloned_graph = check_cuda_errors(cudart.cudaGraphClone(graph)) + cloned_graph_exec = check_cuda_errors(cudart.cudaGraphInstantiate(cloned_graph, 0)) + + for _i in range(GRAPH_LAUNCH_ITERATIONS): + check_cuda_errors(cudart.cudaGraphLaunch(graph_exec, stream_for_graph)) + + check_cuda_errors(cudart.cudaStreamSynchronize(stream_for_graph)) + + print("Cloned Graph Output..") + for _i in range(GRAPH_LAUNCH_ITERATIONS): + check_cuda_errors(cudart.cudaGraphLaunch(cloned_graph_exec, stream_for_graph)) + + check_cuda_errors(cudart.cudaStreamSynchronize(stream_for_graph)) + + check_cuda_errors(cudart.cudaGraphExecDestroy(graph_exec)) + check_cuda_errors(cudart.cudaGraphExecDestroy(cloned_graph_exec)) + check_cuda_errors(cudart.cudaGraphDestroy(graph)) + check_cuda_errors(cudart.cudaGraphDestroy(cloned_graph)) + check_cuda_errors(cudart.cudaStreamDestroy(stream1)) + check_cuda_errors(cudart.cudaStreamDestroy(stream2)) + check_cuda_errors(cudart.cudaStreamDestroy(stream_for_graph)) + + +def main(): + size = 1 << 24 # number of elements to reduce + max_blocks = 512 + + # This will pick the best possible CUDA capable device + dev_id = find_cuda_device() + + global _reduce + global _reduceFinal + kernel_helper = KernelHelper(simple_cuda_graphs, dev_id) + _reduce = kernel_helper.get_function(b"reduce") + _reduceFinal = kernel_helper.get_function(b"reduceFinal") + + print(f"{size} elements") + print(f"threads per block = {THREADS_PER_BLOCK}") + print(f"Graph Launch iterations = {GRAPH_LAUNCH_ITERATIONS}") + + input_vec_h = check_cuda_errors(cudart.cudaMallocHost(size * np.dtype(np.float32).itemsize)) + input_vec_d = check_cuda_errors(cudart.cudaMalloc(size * np.dtype(np.float32).itemsize)) + output_vec_d = check_cuda_errors(cudart.cudaMalloc(max_blocks * np.dtype(np.float64).itemsize)) + result_d = check_cuda_errors(cudart.cudaMalloc(np.dtype(np.float64).itemsize)) + + init_input(input_vec_h, size) + + cuda_graphs_manual(input_vec_h, input_vec_d, output_vec_d, result_d, size, max_blocks) + cuda_graphs_using_stream_capture(input_vec_h, input_vec_d, output_vec_d, result_d, size, max_blocks) + + check_cuda_errors(cudart.cudaFree(input_vec_d)) + check_cuda_errors(cudart.cudaFree(output_vec_d)) + check_cuda_errors(cudart.cudaFree(result_d)) + check_cuda_errors(cudart.cudaFreeHost(input_vec_h)) + + +if __name__ == "__main__": + main() diff --git a/cuda_bindings/examples/4_CUDA_Libraries/conjugate_gradient_multi_block_cg.py b/cuda_bindings/examples/4_CUDA_Libraries/conjugate_gradient_multi_block_cg.py new file mode 100644 index 00000000000..83d359b1e93 --- /dev/null +++ b/cuda_bindings/examples/4_CUDA_Libraries/conjugate_gradient_multi_block_cg.py @@ -0,0 +1,369 @@ +# Copyright 2021-2026 NVIDIA Corporation. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +# ################################################################################ +# +# This example demonstrates a conjugate gradient solver using cooperative +# groups and multi-block grid synchronization. +# +# ################################################################################ + +# /// script +# dependencies = ["cuda_bindings>13.2.1", "numpy"] +# /// + +import ctypes +import math +import platform +import sys +from random import random + +import numpy as np + +from cuda.bindings import driver as cuda +from cuda.bindings import runtime as cudart +from cuda.bindings._example_helpers import ( + KernelHelper, + check_cuda_errors, + find_cuda_device, + requirement_not_met, +) + +conjugate_gradient_multi_block_cg = """\ +#line __LINE__ +#include +#include +namespace cg = cooperative_groups; + + +__device__ void gpuSpMV(int *I, int *J, float *val, int nnz, int num_rows, + float alpha, float *inputVecX, float *outputVecY, + cg::thread_block &cta, const cg::grid_group &grid) { + for (int i = grid.thread_rank(); i < num_rows; i += grid.size()) { + int row_elem = I[i]; + int next_row_elem = I[i + 1]; + int num_elems_this_row = next_row_elem - row_elem; + + float output = 0.0; + for (int j = 0; j < num_elems_this_row; j++) { + // I or J or val arrays - can be put in shared memory + // as the access is random and reused in next calls of gpuSpMV function. + output += alpha * val[row_elem + j] * inputVecX[J[row_elem + j]]; + } + + outputVecY[i] = output; + } +} + +__device__ void gpuSaxpy(float *x, float *y, float a, int size, + const cg::grid_group &grid) { + for (int i = grid.thread_rank(); i < size; i += grid.size()) { + y[i] = a * x[i] + y[i]; + } +} + +__device__ void gpuDotProduct(float *vecA, float *vecB, double *result, + int size, const cg::thread_block &cta, + const cg::grid_group &grid) { + extern __shared__ double tmp[]; + + double temp_sum = 0.0; + for (int i = grid.thread_rank(); i < size; i += grid.size()) { + temp_sum += static_cast(vecA[i] * vecB[i]); + } + + cg::thread_block_tile<32> tile32 = cg::tiled_partition<32>(cta); + + temp_sum = cg::reduce(tile32, temp_sum, cg::plus()); + + if (tile32.thread_rank() == 0) { + tmp[tile32.meta_group_rank()] = temp_sum; + } + + cg::sync(cta); + + if (tile32.meta_group_rank() == 0) { + temp_sum = tile32.thread_rank() < tile32.meta_group_size() ? tmp[tile32.thread_rank()] : 0.0; + temp_sum = cg::reduce(tile32, temp_sum, cg::plus()); + + if (tile32.thread_rank() == 0) { + atomicAdd(result, temp_sum); + } + } +} + +__device__ void gpuCopyVector(float *srcA, float *destB, int size, + const cg::grid_group &grid) { + for (int i = grid.thread_rank(); i < size; i += grid.size()) { + destB[i] = srcA[i]; + } +} + +__device__ void gpuScaleVectorAndSaxpy(const float *x, float *y, float a, float scale, int size, + const cg::grid_group &grid) { + for (int i = grid.thread_rank(); i < size; i += grid.size()) { + y[i] = a * x[i] + scale * y[i]; + } +} + +extern "C" __global__ void gpuConjugateGradient(int *I, int *J, float *val, + float *x, float *Ax, float *p, + float *r, double *dot_result, + int nnz, int N, float tol) { + cg::thread_block cta = cg::this_thread_block(); + cg::grid_group grid = cg::this_grid(); + + int max_iter = 10000; + + float alpha = 1.0; + float alpham1 = -1.0; + float r0 = 0.0, r1, b, a, na; + + gpuSpMV(I, J, val, nnz, N, alpha, x, Ax, cta, grid); + + cg::sync(grid); + + gpuSaxpy(Ax, r, alpham1, N, grid); + + cg::sync(grid); + + gpuDotProduct(r, r, dot_result, N, cta, grid); + + cg::sync(grid); + + r1 = *dot_result; + + int k = 1; + while (r1 > tol * tol && k <= max_iter) { + if (k > 1) { + b = r1 / r0; + gpuScaleVectorAndSaxpy(r, p, alpha, b, N, grid); + } else { + gpuCopyVector(r, p, N, grid); + } + + cg::sync(grid); + + gpuSpMV(I, J, val, nnz, N, alpha, p, Ax, cta, grid); + + if (threadIdx.x == 0 && blockIdx.x == 0) *dot_result = 0.0; + + cg::sync(grid); + + gpuDotProduct(p, Ax, dot_result, N, cta, grid); + + cg::sync(grid); + + a = r1 / *dot_result; + + gpuSaxpy(p, x, a, N, grid); + na = -a; + gpuSaxpy(Ax, r, na, N, grid); + + r0 = r1; + + cg::sync(grid); + if (threadIdx.x == 0 && blockIdx.x == 0) *dot_result = 0.0; + + cg::sync(grid); + + gpuDotProduct(r, r, dot_result, N, cta, grid); + + cg::sync(grid); + + r1 = *dot_result; + k++; + } +} +""" + + +def gen_tridiag(row_offsets, col_indices, values, n, nz): + row_offsets[0] = 0 + col_indices[0] = 0 + col_indices[1] = 0 + + values[0] = float(random()) + 10.0 + values[1] = float(random()) + + for row_idx in range(1, n): + if row_idx > 1: + row_offsets[row_idx] = row_offsets[row_idx - 1] + 3 + else: + row_offsets[1] = 2 + + start = (row_idx - 1) * 3 + 2 + col_indices[start] = row_idx - 1 + col_indices[start + 1] = row_idx + + if row_idx < n - 1: + col_indices[start + 2] = row_idx + 1 + + values[start] = values[start - 1] + values[start + 1] = float(random()) + 10.0 + + if row_idx < n - 1: + values[start + 2] = float(random()) + row_offsets[n] = nz + + +THREADS_PER_BLOCK = 512 +s_sd_kname = "conjugateGradientMultiBlockCG" +UNSUPPORTED_SYSTEMS = {"Darwin", "QNX"} +UNSUPPORTED_MACHINES = {"armv7l"} + + +def main(): + tol = 1e-5 + + system_name = platform.system() + if system_name in UNSUPPORTED_SYSTEMS: + requirement_not_met(f"{s_sd_kname} is not supported on {system_name}") + + machine_name = platform.machine() + if machine_name in UNSUPPORTED_MACHINES: + requirement_not_met(f"{s_sd_kname} is not supported on {machine_name}") + + # This will pick the best possible CUDA capable device + dev_id = find_cuda_device() + device_prop = check_cuda_errors(cudart.cudaGetDeviceProperties(dev_id)) + + if not device_prop.managedMemory: + requirement_not_met("Unified Memory not supported on this device") + + # This sample requires being run on a device that supports Cooperative Kernel + # Launch + if not device_prop.cooperativeLaunch: + requirement_not_met(f"Selected GPU {dev_id} does not support Cooperative Kernel Launch") + + # Statistics about the GPU device + print( + f"> GPU device has {device_prop.multiProcessorCount} Multi-Processors, " + f"SM {device_prop.major}.{device_prop.minor} compute capabilities\n" + ) + + # Get kernel + kernel_helper = KernelHelper(conjugate_gradient_multi_block_cg, dev_id) + _gpu_conjugate_gradient = kernel_helper.get_function(b"gpuConjugateGradient") + + # Generate a random tridiagonal symmetric matrix in CSR format + n = 1048576 + nz = (n - 2) * 3 + 4 + + i = check_cuda_errors(cudart.cudaMallocManaged(np.dtype(np.int32).itemsize * (n + 1), cudart.cudaMemAttachGlobal)) + j = check_cuda_errors(cudart.cudaMallocManaged(np.dtype(np.int32).itemsize * nz, cudart.cudaMemAttachGlobal)) + val = check_cuda_errors(cudart.cudaMallocManaged(np.dtype(np.float32).itemsize * nz, cudart.cudaMemAttachGlobal)) + i_local = (ctypes.c_int * (n + 1)).from_address(i) + j_local = (ctypes.c_int * nz).from_address(j) + val_local = (ctypes.c_float * nz).from_address(val) + + gen_tridiag(i_local, j_local, val_local, n, nz) + + x = check_cuda_errors(cudart.cudaMallocManaged(np.dtype(np.float32).itemsize * n, cudart.cudaMemAttachGlobal)) + rhs = check_cuda_errors(cudart.cudaMallocManaged(np.dtype(np.float32).itemsize * n, cudart.cudaMemAttachGlobal)) + dot_result = check_cuda_errors(cudart.cudaMallocManaged(np.dtype(np.float64).itemsize, cudart.cudaMemAttachGlobal)) + x_local = (ctypes.c_float * n).from_address(x) + rhs_local = (ctypes.c_float * n).from_address(rhs) + dot_result_local = (ctypes.c_double).from_address(dot_result) + dot_result_local.value = 0.0 + + # temp memory for CG + r = check_cuda_errors(cudart.cudaMallocManaged(np.dtype(np.float32).itemsize * n, cudart.cudaMemAttachGlobal)) + p = check_cuda_errors(cudart.cudaMallocManaged(np.dtype(np.float32).itemsize * n, cudart.cudaMemAttachGlobal)) + ax = check_cuda_errors(cudart.cudaMallocManaged(np.dtype(np.float32).itemsize * n, cudart.cudaMemAttachGlobal)) + r_local = (ctypes.c_float * n).from_address(r) + + check_cuda_errors(cudart.cudaDeviceSynchronize()) + + start = check_cuda_errors(cudart.cudaEventCreate()) + stop = check_cuda_errors(cudart.cudaEventCreate()) + + for idx in range(n): + r_local[idx] = rhs_local[idx] = 1.0 + x_local[idx] = 0.0 + + kernel_args_value = (i, j, val, x, ax, p, r, dot_result, nz, n, tol) + kernel_args_types = ( + ctypes.c_void_p, + ctypes.c_void_p, + ctypes.c_void_p, + ctypes.c_void_p, + ctypes.c_void_p, + ctypes.c_void_p, + ctypes.c_void_p, + ctypes.c_void_p, + ctypes.c_int, + ctypes.c_int, + ctypes.c_float, + ) + kernel_args = (kernel_args_value, kernel_args_types) + + s_mem_size = np.dtype(np.float64).itemsize * ((THREADS_PER_BLOCK // 32) + 1) + num_threads = THREADS_PER_BLOCK + num_blocks_per_sm = check_cuda_errors( + cuda.cuOccupancyMaxActiveBlocksPerMultiprocessor(_gpu_conjugate_gradient, num_threads, s_mem_size) + ) + num_sms = device_prop.multiProcessorCount + dim_grid = cudart.dim3() + dim_grid.x = num_sms * num_blocks_per_sm + dim_grid.y = 1 + dim_grid.z = 1 + dim_block = cudart.dim3() + dim_block.x = THREADS_PER_BLOCK + dim_block.y = 1 + dim_block.z = 1 + + check_cuda_errors(cudart.cudaEventRecord(start, 0)) + check_cuda_errors( + cuda.cuLaunchCooperativeKernel( + _gpu_conjugate_gradient, + dim_grid.x, + dim_grid.y, + dim_grid.z, + dim_block.x, + dim_block.y, + dim_block.z, + s_mem_size, + 0, + kernel_args, + ) + ) + check_cuda_errors(cudart.cudaEventRecord(stop, 0)) + check_cuda_errors(cudart.cudaDeviceSynchronize()) + + time = check_cuda_errors(cudart.cudaEventElapsedTime(start, stop)) + residual = math.sqrt(dot_result_local.value) + print(f"GPU Final, residual = {residual:e}, kernel execution time = {time:f} ms") + + err = 0.0 + for row_idx in range(n): + rsum = 0.0 + + for elem_idx in range(i_local[row_idx], i_local[row_idx + 1]): + rsum += val_local[elem_idx] * x_local[j_local[elem_idx]] + + diff = math.fabs(rsum - rhs_local[row_idx]) + + if diff > err: + err = diff + + check_cuda_errors(cudart.cudaFree(i)) + check_cuda_errors(cudart.cudaFree(j)) + check_cuda_errors(cudart.cudaFree(val)) + check_cuda_errors(cudart.cudaFree(x)) + check_cuda_errors(cudart.cudaFree(rhs)) + check_cuda_errors(cudart.cudaFree(r)) + check_cuda_errors(cudart.cudaFree(p)) + check_cuda_errors(cudart.cudaFree(ax)) + check_cuda_errors(cudart.cudaFree(dot_result)) + check_cuda_errors(cudart.cudaEventDestroy(start)) + check_cuda_errors(cudart.cudaEventDestroy(stop)) + + print(f"Test Summary: Error amount = {err:f}") + if residual >= tol: + print("conjugateGradientMultiBlockCG FAILED", file=sys.stderr) + sys.exit(1) + + +if __name__ == "__main__": + main() diff --git a/cuda_bindings/examples/4_CUDA_Libraries/nvidia_smi.py b/cuda_bindings/examples/4_CUDA_Libraries/nvidia_smi.py new file mode 100644 index 00000000000..459022784b3 --- /dev/null +++ b/cuda_bindings/examples/4_CUDA_Libraries/nvidia_smi.py @@ -0,0 +1,245 @@ +# Copyright 2026 NVIDIA Corporation. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + + +# ################################################################################ +# +# This example demonstrates the core cuda.bindings.nvml functionality by +# implementing a subset of the NVIDIA System Management Interface (nvidia-smi) +# command line tool in Python. +# +# ################################################################################ + + +# /// script +# dependencies = ["cuda_bindings>13.2.1"] +# /// + +import sys + +from cuda.bindings import nvml + +################################################################################## +# FORMATTING HELPERS + +# Utilities to help format the output table. See below for NVML usage. + + +def format_size(bytes_val: int) -> str: + """Formats bytes to MiB.""" + return f"{bytes_val / (1024 * 1024):.0f}MiB" + + +LINES = [[[4, 27, 6], [18, 3], [20]], [[4, 6, 13, 13], [22], [9, 10]]] + + +class TableFormatter: + def __init__(self, lines): + self.formats, self.sizes, self.counts = zip(*[self._create_line_format(line) for line in lines]) + + def _create_line_format(self, descriptor): + parts = [] + sizes = [] + for section in descriptor: + parts.append("| ") + sizes.append(1) + for i, align in enumerate(section): + if i == len(section) - 1: + direct = ">" + else: + direct = "<" + parts.append(f"{{:{direct}{align}}} ") + sizes[-1] += align + 1 + parts.append("|") + return "".join(parts), sizes, sum(len(x) for x in descriptor) + + def print_line(self, char="-"): + parts = ["+"] + for size in self.sizes[0]: + parts.append(char * size) + parts.append("+") + print("".join(parts)) + + def print_values(self, *args): + for line_format, count in zip(self.formats, self.counts): + print(line_format.format(*args[:count])) + args = args[count:] + + +def print_table(metadata, devices): + formatter = TableFormatter(LINES) + + print("+-----------------------------------------------------------------------------------------+") + print( + f"| NVIDIA-MINI-SMI {metadata['driver_version']:<16} Driver Version: {metadata['driver_version']:<15} CUDA Version: {metadata['cuda_version']:<9}|" + ) + formatter.print_line() + print("| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |") + print("| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |") + formatter.print_line("=") + + for device in devices: + formatter.print_values( + str(device["index"]), + device["name"], + device["persistence"], + device["bus_id"], + device["display_active"], + device["ecc_mode"], + device["fan_speed"], + device["temperature"], + device["performance_state"], + device["power"], + device["memory"], + device["utilization"], + device["compute_mode"], + ) + formatter.print_line() + + +################################################################################## +# NVML USAGE EXAMPLES + + +def collect_info(): + metadata = {} + metadata["driver_version"] = nvml.system_get_driver_version() + cuda_version_int = nvml.system_get_cuda_driver_version() + cuda_major = cuda_version_int // 1000 + cuda_minor = (cuda_version_int % 1000) // 10 + metadata["cuda_version"] = f"{cuda_major}.{cuda_minor}" + + devices = [] + + device_count = nvml.device_get_count_v2() + + for i in range(device_count): + device = {} + device["index"] = i + + handle = nvml.device_get_handle_by_index_v2(i) + + name = nvml.device_get_name(handle) + device["name"] = name + + try: + persistence = nvml.device_get_persistence_mode(handle) + persistence_str = "On" if persistence == nvml.EnableState.FEATURE_ENABLED else "Off" + except nvml.NvmlError: + persistence_str = "N/A" + device["persistence"] = persistence_str + + try: + pci_info = nvml.device_get_pci_info_v3(handle) + bus_id = pci_info.bus_id + except nvml.NvmlError: + bus_id = "N/A" + device["bus_id"] = bus_id + + try: + display_active = nvml.device_get_display_active(handle) + disp_str = "On" if display_active == nvml.EnableState.FEATURE_ENABLED else "Off" + except nvml.NvmlError: + disp_str = "N/A" + device["display_active"] = disp_str + + try: + current, _ = nvml.device_get_ecc_mode(handle) + ecc_str = "On" if current == nvml.EnableState.FEATURE_ENABLED else "Off" + except nvml.NvmlError: + ecc_str = "N/A" + device["ecc_mode"] = ecc_str + + try: + fan = nvml.device_get_fan_speed(handle) + fan_str = f"{fan: >3}%" + except nvml.NvmlError: + fan_str = "N/A" + device["fan_speed"] = fan_str + + try: + temp = nvml.device_get_temperature_v(handle, nvml.TemperatureSensors.TEMPERATURE_GPU) + temp_str = f"{temp}C" + except nvml.NvmlError: + temp_str = "N/A" + device["temperature"] = temp_str + + try: + perf_state = nvml.device_get_performance_state(handle) + perf_str = f"P{perf_state}" + except nvml.NvmlError: + perf_str = "N/A" + device["performance_state"] = perf_str + + try: + power_usage = nvml.device_get_power_usage(handle) # mW + usage_str = f"{power_usage // 1000}W" + except nvml.NvmlError: + usage_str = "N/A" + + try: + power_cap = nvml.device_get_power_management_limit(handle) # mW + cap_str = f"{power_cap // 1000}W" + except nvml.NvmlError: + cap_str = "N/A" + + pwr_str = f"{usage_str} / {cap_str}" + device["power"] = pwr_str + + try: + mem_info = nvml.device_get_memory_info_v2(handle) + except nvml.NvmlError: + mem_str = "N/A" + else: + mem_used = format_size(mem_info.used) + mem_total = format_size(mem_info.total) + mem_str = f"{mem_used} / {mem_total}" + + device["memory"] = mem_str + + try: + util_rates = nvml.device_get_utilization_rates(handle) + except nvml.NvmlError: + util_str = "N/A" + else: + gpu_util = util_rates.gpu + util_str = f"{gpu_util: >3}%" + + device["utilization"] = util_str + + try: + compute_mode = nvml.device_get_compute_mode(handle) + except nvml.NvmlError: + comp_str = "N/A" + else: + if compute_mode == nvml.ComputeMode.COMPUTEMODE_DEFAULT: + comp_str = "Default" + elif compute_mode == nvml.ComputeMode.COMPUTEMODE_EXCLUSIVE_PROCESS: + comp_str = "E. Process" + elif compute_mode == nvml.ComputeMode.COMPUTEMODE_PROHIBITED: + comp_str = "Prohibited" + else: + comp_str = "Unknown" + device["compute_mode"] = comp_str + + devices.append(device) + + return metadata, devices + + +def main(): + try: + nvml.init_v2() + except nvml.NvmlError as e: + print(f"Failed to initialize NVML: {e}") + sys.exit(1) + + try: + metadata, devices = collect_info() + print_table(metadata, devices) + finally: + nvml.shutdown() + + +if __name__ == "__main__": + main() diff --git a/cuda_bindings/examples/extra/iso_fd_modelling.py b/cuda_bindings/examples/extra/iso_fd_modelling.py new file mode 100644 index 00000000000..9fe9432862c --- /dev/null +++ b/cuda_bindings/examples/extra/iso_fd_modelling.py @@ -0,0 +1,798 @@ +# Copyright 2021-2026 NVIDIA Corporation. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +# ################################################################################ +# +# This example demonstrates isotropic finite-difference wave propagation +# modelling across multiple GPUs with peer-to-peer halo exchange. +# +# ################################################################################ + +# /// script +# dependencies = ["cuda_bindings>13.2.1", "numpy", "matplotlib"] +# /// + +import time + +import numpy as np + +from cuda.bindings import driver as cuda +from cuda.bindings import runtime as cudart +from cuda.bindings._example_helpers import KernelHelper, check_cuda_errors, requirement_not_met + +iso_propagator = """\ +extern "C" +__global__ void injectSource(float *__restrict__ in, float *__restrict__ src, int it) +{ + if (threadIdx.x == 0) + in[0] = src[it]; +} + +extern "C" +__global__ void createVelocity(float *__restrict__ vel, float vmult, int nz, int nx, int stride) +{ + int ix = blockIdx.x * blockDim.x + threadIdx.x; + int iy = blockIdx.y * blockDim.y + threadIdx.y; + + int idx_out = iy * nx + ix; + for (int iz = 0; iz < nz ; iz++) { + vel[idx_out] = 3.0f * 3.0f * vmult; + idx_out += stride; + } +} + +extern "C" +__global__ void createSource(float *__restrict__ x, float dt, float freq, int nt) +{ + int istart = (int) (60.0f/dt); // start max at 30 ms + float pi2 = 2.0f * 3.141592654f; + float agauss = 0.5f * freq; + + for ( int i=threadIdx.x; i < nt; ++ i) { + float arg = 1.0e-3 * fabsf(i - istart) * agauss; + x[i] = 1000.0f * expf(-2.0f * arg * arg) * cosf(pi2 * arg); + } +} + +extern "C" +__global__ void fwd_3D_orderX2k(float *g_curr_1, float *g_prev_1, float *g_vsq_1, + int nz, int dimx, int stride); + +#define radius 4 +#define diameter (2*radius+1) +#define BDIMX 32 +#define BDIMY 16 + +inline __device__ void advance(float2 *field, const int num_points) { + #pragma unroll + for (int i = 0; i < num_points; i++) + field[i] = field[i + 1]; +} + +__global__ void fwd_3D_orderX2k(float *g_curr_1, float *g_prev_1, float *g_vsq_1, + int nz, int nx, int stride) { + stride = stride / 2; + nx = nx / 2; + const float c_coeff[5] = {-3.0f * 2.847222222f, + 1.600000f, + -0.200000f, + 0.025396825f, + -0.001785f}; + + float2 *g_prev = (float2 *)g_prev_1; + float2 *g_curr = (float2 *)g_curr_1; + float2 *g_vsq = (float2 *)g_vsq_1; + __shared__ float s_data[BDIMY + 2 * radius][2 * BDIMX + 2 * (radius + (radius % 2))]; + + int ix = blockIdx.x * blockDim.x + threadIdx.x; + int iy = blockIdx.y * blockDim.y + threadIdx.y; + + int offset = -radius * stride; + + int idx_out = iy * nx + ix; + int idx_in = idx_out + offset; + + float2 local_input[diameter], tmp1, tmp2; + + int tx = 2 * threadIdx.x + radius + (radius % 2); + int ty = threadIdx.y + radius; + + #pragma unroll + for (int i = 1; i < diameter; i++) { + local_input[i] = g_curr[idx_in]; + idx_in += stride; + } + + for (int iz = 0; iz < nz ; iz++) { + advance(local_input, diameter - 1); + local_input[diameter - 1] = g_curr[idx_in]; + + // update the data slice in smem + s_data[ty][tx] = local_input[radius].x; + s_data[ty][tx + 1] = local_input[radius].y; + + // halo above/below + if (threadIdx.y < radius) { + tmp1 = (g_curr[idx_out - radius * nx]); + s_data[threadIdx.y][tx] = tmp1.x; + s_data[threadIdx.y][tx + 1] = tmp1.y; + } + + if (threadIdx.y >= radius && threadIdx.y < 2 * radius) { + tmp1 = (g_curr[idx_out + (BDIMY - radius) * nx]); + s_data[threadIdx.y + BDIMY][tx] = tmp1.x; + s_data[threadIdx.y + BDIMY][tx + 1] = tmp1.y; + } + + // halo left/right + if (threadIdx.x < (radius + 1) / 2) { + tmp1 = (g_curr[idx_out - (radius + 1) / 2]); + s_data[ty][tx - radius - (radius % 2)] = tmp1.x; + s_data[ty][tx - radius - (radius % 2) + 1] = tmp1.y; + + tmp2 = (g_curr[idx_out + BDIMX]); + s_data[ty][tx + 2 * BDIMX] = tmp2.x; + s_data[ty][tx + 2 * BDIMX + 1] = tmp2.y; + } + __syncthreads(); + + // compute the output values + float2 temp, div; + + temp.x = 2.f * local_input[radius].x - g_prev[idx_out].x; + temp.y = 2.f * local_input[radius].y - g_prev[idx_out].y; + + div.x = c_coeff[0] * local_input[radius].x; + div.y = c_coeff[0] * local_input[radius].y; + + #pragma unroll + for (int d = 1; d <= radius; d++) { + div.x += c_coeff[d] * (local_input[radius + d].x + local_input[radius - d].x + s_data[ty - d][tx] + + s_data[ty + d][tx] + s_data[ty][tx - d] + s_data[ty][tx + d]); + div.y += c_coeff[d] * (local_input[radius + d].y + local_input[radius - d].y + s_data[ty - d][tx + 1] + + s_data[ty + d][tx + 1] + s_data[ty][tx - d + 1] + s_data[ty][tx + d + 1]); + } + + g_prev[idx_out].x = temp.x + div.x * g_vsq[idx_out].x; + g_prev[idx_out].y = temp.y + div.y * g_vsq[idx_out].y; + + __syncthreads(); + + idx_out += stride; + idx_in += stride; + } +} +""" + +display_graph = False +verbose_prints = False + + +def align_nx(nx, blk, nops): + n_align = (int)((nx - 1) / blk) + 1 + n_align *= blk + n_align += 2 * nops + n_align = (int)((n_align - 1) / 64) + 1 + n_align *= 64 + return (int)(n_align) + + +def align_ny(ny, blk, nops): + n_align = (int)((ny - 1) / blk) + 1 + n_align *= blk + n_align += 2 * nops + return (int)(n_align) + + +# +# this class contains the input params +# +class Params: + def __init__(self): + self.BDIMX = 32 # tiles x y for fd operators + self.BDIMY = 16 + self.FD_ORDER = 4 + self.lead = 64 - self.FD_ORDER + self.nx = align_nx(700, 2 * self.BDIMX, self.FD_ORDER) + self.ny = align_ny(600, self.BDIMY, self.FD_ORDER) + self.blkx = (int)((self.nx - 2 * self.FD_ORDER) / (2 * self.BDIMX)) + self.blky = (int)((self.ny - 2 * self.FD_ORDER) / self.BDIMY) + + self.nz = 200 + self.delta = 25.0 + self.dt = 0.3 * 1000.0 * self.delta / 4500.0 + self.tmax_propag = 1000.0 + self.nt = int(self.tmax_propag / self.dt) + self.freqMax = 3.5 * 1000.0 / (4.0 * self.delta) + print( + "dt= ", + self.dt, + " delta= ", + self.delta, + " nt= ", + self.nt, + " freq max= ", + self.freqMax, + ) + + +# +# this class contains all the kernels to be used bu propagator +# +class CudaKernels: + def __init__(self, cntx): + check_cuda_errors(cuda.cuInit(0)) + check_cuda_errors(cuda.cuCtxSetCurrent(cntx)) + dev = check_cuda_errors(cuda.cuCtxGetDevice()) + + self.kernel_helper = KernelHelper(iso_propagator, int(dev)) + + # kernel to create a source fnction with some max frequency + self.creatSource = self.kernel_helper.get_function(b"createSource") + # create a velocity to try things: just a sphere on the middle 4500 m/s and 2500 m/s all around + self.create_velocity = self.kernel_helper.get_function(b"createVelocity") + + # kernel to propagate the wavefield by 1 step in time + self.fdPropag = self.kernel_helper.get_function(b"fwd_3D_orderX2k") + + # kernel to propagate the wavefield by 1 step in time + self.inject_source = self.kernel_helper.get_function(b"injectSource") + + +# +# this class contains: propagator, source creation, velocity creation +# injection of data and domain exchange +# +class Propagator: + def __init__(self, params, _dev): + print("init object for device ", _dev) + self.dev = _dev + + check_cuda_errors(cuda.cuInit(0)) + self.cu_device = check_cuda_errors(cuda.cuDeviceGet(_dev)) + self.context = check_cuda_errors(cuda.cuCtxCreate(None, 0, self.cu_device)) + self.waveOut = 0 + self.waveIn = 0 + self.streamCenter = check_cuda_errors(cuda.cuStreamCreate(0)) + self.streamHalo = check_cuda_errors(cuda.cuStreamCreate(0)) + self.Params = params + + def __del__(self): + check_cuda_errors(cuda.cuCtxSetCurrent(self.context)) + check_cuda_errors(cuda.cuStreamDestroy(self.streamHalo)) + check_cuda_errors(cuda.cuStreamDestroy(self.streamCenter)) + if self.waveIn != 0: + check_cuda_errors(cuda.cuMemFree(self.waveIn)) + if self.waveOut != 0: + check_cuda_errors(cuda.cuMemFree(self.waveOut)) + check_cuda_errors(cuda.cuCtxDestroy(self.context)) + + # + # swap waveIn with waveOut + # + def swap(self): + if verbose_prints: + print("swap in out ", int(self.waveIn), " ", int(self.waveOut)) + i = int(self.waveIn) + j = int(self.waveOut) + a = i + i = j + j = a + self.waveIn = cuda.CUdeviceptr(i) + self.waveOut = cuda.CUdeviceptr(j) + + # + # allocate the device memory + # + def allocate(self): + nel = self.Params.nx * self.Params.ny * self.Params.nz + n = np.array(nel, dtype=np.uint32) + + buffer_size = n * np.dtype(np.float32).itemsize + check_cuda_errors(cuda.cuCtxSetCurrent(self.context)) + + self.velocity = check_cuda_errors(cuda.cuMemAlloc(buffer_size)) + check_cuda_errors(cuda.cuMemsetD32(self.velocity, 0, n)) + + nel += self.Params.lead + n = np.array(nel, dtype=np.uint32) ## we need to align at the beginning of the tile + + buffer_size = n * np.dtype(np.float32).itemsize + self.waveIn = check_cuda_errors(cuda.cuMemAlloc(buffer_size)) + check_cuda_errors(cuda.cuMemsetD32(self.waveIn, 0, n)) + + self.waveOut = check_cuda_errors(cuda.cuMemAlloc(buffer_size)) + check_cuda_errors(cuda.cuMemsetD32(self.waveOut, 0, n)) + + n = np.array(self.Params.nt, dtype=np.uint32) + buffer_size = n * np.dtype(np.float32).itemsize + self.source = check_cuda_errors(cuda.cuMemAlloc(buffer_size)) + check_cuda_errors(cuda.cuMemsetD32(self.source, 0, n)) + + # + # create source data + # + def create_source(self, kernel): + print("creating source on device ", self.dev) + + buf = np.array([int(self.source)], dtype=np.uint64) + nt = np.array(self.Params.nt, dtype=np.uint32) + dt = np.array(self.Params.dt, dtype=np.float32) + freq = np.array(self.Params.freqMax, dtype=np.float32) + + args = [buf, dt, freq, nt] + argsp = np.array([arg.ctypes.data for arg in args], dtype=np.uint64) + check_cuda_errors(cuda.cuCtxSetCurrent(self.context)) + check_cuda_errors( + cuda.cuLaunchKernel( + kernel.creatSource, + 1, + 1, + 1, # grid dim + 1024, + 1, + 1, # block dim + 0, + self.streamHalo, # shared mem and stream + argsp.ctypes.data, + 0, + ) + ) # arguments + check_cuda_errors(cuda.cuStreamSynchronize(self.streamHalo)) + + # + # inject source function: ony on the domain 0 + # + def inject_source(self, kernel, iter): + check_cuda_errors(cuda.cuCtxSetCurrent(self.context)) + + if self.dev != 0: + return + + wavein = np.array([int(self.waveIn)], dtype=np.uint64) + src = np.array([int(self.source)], dtype=np.uint64) + offset_source_inject = ( + self.Params.lead + + (int)(self.Params.nz / 2) * self.Params.nx * self.Params.ny + + (int)(self.Params.ny / 2) * self.Params.nx + + (int)(self.Params.nx / 2) + ) + offset_source_inject *= np.dtype(np.float32).itemsize + + np_it = np.array(iter, dtype=np.uint32) + + args = [wavein + offset_source_inject, src, np_it] + argsp = np.array([arg.ctypes.data for arg in args], dtype=np.uint64) + check_cuda_errors( + cuda.cuLaunchKernel( + kernel.inject_source, + 1, + 1, + 1, # grid dim + 1, + 1, + 1, # block dim + 0, + self.streamHalo, # shared mem and stream + argsp.ctypes.data, + 0, + ) + ) # arguments + + # + # create velocity + # + def create_velocity(self, kernel): + print("running create velocity on device ", self.dev) + + offset_velocity = ( + self.Params.FD_ORDER * self.Params.nx * self.Params.ny + + self.Params.FD_ORDER * self.Params.nx + + self.Params.FD_ORDER + ) + offset_velocity *= np.dtype(np.float32).itemsize + + vel = np.array([int(self.velocity)], dtype=np.uint64) + dx_dt2 = (self.Params.dt * self.Params.dt) / (self.Params.delta * self.Params.delta) + + stride = self.Params.nx * self.Params.ny + np_dx_dt2 = np.array(dx_dt2, dtype=np.float32) + np_nz = np.array((self.Params.nz - 2 * self.Params.FD_ORDER), dtype=np.uint32) + np_nx = np.array(self.Params.nx, dtype=np.uint32) + np_stride = np.array(stride, dtype=np.uint32) + + args = [vel + offset_velocity, np_dx_dt2, np_nz, np_nx, np_stride] + argsp = np.array([arg.ctypes.data for arg in args], dtype=np.uint64) + + check_cuda_errors(cuda.cuCtxSetCurrent(self.context)) + + # do halo up + check_cuda_errors( + cuda.cuLaunchKernel( + kernel.create_velocity, + self.Params.blkx, + self.Params.blky, + 1, # grid dim + 2 * self.Params.BDIMX, + self.Params.BDIMY, + 1, # block dim + 0, + self.streamHalo, # shared mem and stream + argsp.ctypes.data, + 0, + ) + ) # arguments + check_cuda_errors(cuda.cuStreamSynchronize(self.streamHalo)) + + # + # execute the center part of propagation + # + def execute_center(self, kernel): + if verbose_prints: + print("running center on device ", self.dev) + check_cuda_errors(cuda.cuCtxSetCurrent(self.context)) + offset_velocity = ( + 2 * self.Params.FD_ORDER * self.Params.nx * self.Params.ny + + self.Params.FD_ORDER * self.Params.nx + + self.Params.FD_ORDER + ) + + offset_wave = self.Params.lead + offset_velocity + + offset_wave *= np.dtype(np.float32).itemsize + offset_velocity *= np.dtype(np.float32).itemsize + + wavein = np.array([int(self.waveIn)], dtype=np.uint64) + waveout = np.array([int(self.waveOut)], dtype=np.uint64) + + vel = np.array([int(self.velocity)], dtype=np.uint64) + stride = self.Params.nx * self.Params.ny + np_nz = np.array(self.Params.nz - 4 * self.Params.FD_ORDER, dtype=np.uint32) + np_nx = np.array(self.Params.nx, dtype=np.uint32) + np_stride = np.array(stride, dtype=np.uint32) + + args = [ + wavein + offset_wave, + waveout + offset_wave, + vel + offset_velocity, + np_nz, + np_nx, + np_stride, + ] + argsp = np.array([arg.ctypes.data for arg in args], dtype=np.uint64) + + # do center propagation from 2 * fd_order to nz - 2 * fd_order + check_cuda_errors( + cuda.cuLaunchKernel( + kernel.fdPropag, + self.Params.blkx, + self.Params.blky, + 1, # grid dim + self.Params.BDIMX, + self.Params.BDIMY, + 1, # block dim + 0, + self.streamCenter, # shared mem and stream + argsp.ctypes.data, + 0, + ) + ) # arguments + + # + # execute the halo part of propagation + # + def execute_halo(self, kernel): + if verbose_prints: + print("running halos on device ", self.dev) + check_cuda_errors(cuda.cuCtxSetCurrent(self.context)) + + offset_velocity = ( + self.Params.FD_ORDER * self.Params.nx * self.Params.ny + + self.Params.FD_ORDER * self.Params.nx + + self.Params.FD_ORDER + ) + + offset_wave = self.Params.lead + offset_velocity + + offset_wave *= np.dtype(np.float32).itemsize + offset_velocity *= np.dtype(np.float32).itemsize + + wavein = np.array([int(self.waveIn)], dtype=np.uint64) + waveout = np.array([int(self.waveOut)], dtype=np.uint64) + + vel = np.array([int(self.velocity)], dtype=np.uint64) + stride = self.Params.nx * self.Params.ny + np_nz = np.array(self.Params.FD_ORDER, dtype=np.uint32) + np_nx = np.array(self.Params.nx, dtype=np.uint32) + np_stride = np.array(stride, dtype=np.uint32) + + args = [ + wavein + offset_wave, + waveout + offset_wave, + vel + offset_velocity, + np_nz, + np_nx, + np_stride, + ] + argsp = np.array([arg.ctypes.data for arg in args], dtype=np.uint64) + + # do halo up + check_cuda_errors( + cuda.cuLaunchKernel( + kernel.fdPropag, + self.Params.blkx, + self.Params.blky, + 1, # grid dim + self.Params.BDIMX, + self.Params.BDIMY, + 1, # block dim + 0, + self.streamHalo, # shared mem and stream + argsp.ctypes.data, + 0, + ) + ) # arguments + + # do halo down + offset_velocity = ( + (self.Params.nz - 2 * self.Params.FD_ORDER) * self.Params.nx * self.Params.ny + + self.Params.FD_ORDER * self.Params.nx + + self.Params.FD_ORDER + ) + offset_wave = self.Params.lead + offset_velocity + + offset_wave *= np.dtype(np.float32).itemsize + offset_velocity *= np.dtype(np.float32).itemsize + + args = [ + wavein + offset_wave, + waveout + offset_wave, + vel + offset_velocity, + np_nz, + np_nx, + np_stride, + ] + argsp = np.array([arg.ctypes.data for arg in args], dtype=np.uint64) + check_cuda_errors( + cuda.cuLaunchKernel( + kernel.fdPropag, + self.Params.blkx, + self.Params.blky, + 1, # grid dim + self.Params.BDIMX, + self.Params.BDIMY, + 1, # block dim + 0, + self.streamHalo, # shared mem and stream + argsp.ctypes.data, + 0, + ) + ) # arguments + + # + # exchange the halos + # + def exchange_halo(self, propag): + if verbose_prints: + print("exchange halos on device ", self.dev, "with dev ", propag.dev) + check_cuda_errors(cuda.cuCtxSetCurrent(self.context)) + + # + # the following variables don't change + # + nstride = self.Params.nx * self.Params.ny + + dev_s = self.context + dev_d = propag.context + + n_exch = self.Params.FD_ORDER * nstride + n_exch *= np.dtype(np.float32).itemsize + + if self.dev < propag.dev: + # exchange up + offset_s = self.Params.lead + (self.Params.nz - 2 * self.Params.FD_ORDER) * nstride + offset_d = propag.Params.lead + + offset_s *= np.dtype(np.float32).itemsize + offset_d *= np.dtype(np.float32).itemsize + + wave_d = cuda.CUdeviceptr(int(propag.waveOut) + offset_d) + wave_s = cuda.CUdeviceptr(int(self.waveOut) + offset_s) + + check_cuda_errors(cuda.cuMemcpyPeerAsync(wave_d, dev_d, wave_s, dev_s, n_exch, self.streamHalo)) + else: + # exchange down + offset_s = self.Params.lead + self.Params.FD_ORDER * nstride + offset_d = propag.Params.lead + (propag.Params.nz - propag.Params.FD_ORDER) * nstride + + offset_s *= np.dtype(np.float32).itemsize + offset_d *= np.dtype(np.float32).itemsize + + wave_d = cuda.CUdeviceptr(int(propag.waveOut) + offset_d) + wave_s = cuda.CUdeviceptr(int(self.waveOut) + offset_s) + + check_cuda_errors(cuda.cuMemcpyPeerAsync(wave_d, dev_d, wave_s, dev_s, n_exch, self.streamHalo)) + + # + # sync stream + # + def sync_stream(self, stream): + check_cuda_errors(cuda.cuCtxSetCurrent(self.context)) + check_cuda_errors(cuda.cuStreamSynchronize(stream)) + + +def main(): + check_cuda_errors(cuda.cuInit(0)) + + # Number of GPUs + print("Checking for multiple GPUs...") + gpu_n = check_cuda_errors(cuda.cuDeviceGetCount()) + print(f"CUDA-capable device count: {gpu_n}") + + if gpu_n < 2: + requirement_not_met("Two or more GPUs with Peer-to-Peer access capability are required") + + prop = [check_cuda_errors(cudart.cudaGetDeviceProperties(i)) for i in range(gpu_n)] + # Check possibility for peer access + print("\nChecking GPU(s) for support of peer to peer memory access...") + + p2p_capable_gp_us = [-1, -1] + for i in range(gpu_n): + p2p_capable_gp_us[0] = i + for j in range(gpu_n): + if i == j: + continue + i_access_j = check_cuda_errors(cudart.cudaDeviceCanAccessPeer(i, j)) + j_access_i = check_cuda_errors(cudart.cudaDeviceCanAccessPeer(j, i)) + print( + "> Peer access from {} (GPU{}) -> {} (GPU{}) : {}\n".format( + prop[i].name, i, prop[j].name, j, "Yes" if i_access_j else "No" + ) + ) + print( + "> Peer access from {} (GPU{}) -> {} (GPU{}) : {}\n".format( + prop[j].name, j, prop[i].name, i, "Yes" if j_access_i else "No" + ) + ) + if i_access_j and j_access_i: + p2p_capable_gp_us[1] = j + break + if p2p_capable_gp_us[1] != -1: + break + + if p2p_capable_gp_us[0] == -1 or p2p_capable_gp_us[1] == -1: + requirement_not_met("Two or more GPUs with Peer-to-Peer access capability are required") + + # Use first pair of p2p capable GPUs detected + gpuid = [p2p_capable_gp_us[0], p2p_capable_gp_us[1]] + + # + # init device + # + pars = Params() + + # + # create propagators + # + propags = [] + kerns = [] + + # + # create kernels and propagators that are going to be used on device + # + for i in gpuid: + p = Propagator(pars, i) + k = CudaKernels(p.context) + propags.append(p) + kerns.append(k) + + # allocate resources in device + for propag, kern in zip(propags, kerns): + propag.allocate() + propag.create_source(kern) + propag.create_velocity(kern) + + # + # loop over time iterations + # + start = time.time() + for it in range(pars.nt): + for propag in propags: + propag.sync_stream(propag.streamHalo) + + for propag, kern in zip(propags, kerns): + propag.inject_source(kern, it) + + for propag, kern in zip(propags, kerns): + propag.execute_halo(kern) + + for propag in propags: + propag.sync_stream(propag.streamHalo) + + propags[1].exchange_halo(propags[0]) + + propags[0].exchange_halo(propags[1]) + + for propag, kern in zip(propags, kerns): + propag.execute_center(kern) + + for propag in propags: + propag.sync_stream(propag.streamCenter) + + for propag in propags: + propag.swap() + + end = time.time() + npoints = (pars.nz - 2 * pars.FD_ORDER) * (pars.blkx * 2 * pars.BDIMX) * (pars.blky * pars.BDIMY) + + nops = 1.0e-9 * pars.nt * npoints / (end - start) + + print("this code generates ", nops, " GPoints/sec / device ") + + # + # get the result out of gpu + # + nz = 2 * (int)(pars.nz - 2 * pars.FD_ORDER) + print(" nz= ", nz, " nx= ", pars.nx) + h_out = np.zeros((nz, pars.nx), dtype="float32") + + istart = 0 + for propag in propags: + check_cuda_errors(cuda.cuCtxSetCurrent(propag.context)) + offset = pars.lead + pars.FD_ORDER * pars.nx * pars.ny + (int)(pars.ny / 2) * pars.nx + + for j in range(pars.nz - 2 * pars.FD_ORDER): + ptr = cuda.CUdeviceptr(int(propag.waveOut) + offset * 4) + + check_cuda_errors( + cuda.cuMemcpyDtoH( + h_out[istart].ctypes.data, + ptr, + pars.nx * np.dtype(np.float32).itemsize, + ) + ) + offset += pars.nx * pars.ny + istart += 1 + + # + # delete kernels and propagatrs + # + for propag in propags: + del propag + + if display_graph: + nrows = nz + ncols = pars.nx + dbz = h_out + dbz = np.reshape(dbz, (nrows, ncols)) + + ## + ## those are to plot results + ## + import matplotlib.pyplot as plt + + fig, ax = plt.subplots() + title = "test fd kernels up to " + str(pars.tmax_propag) + " ms " + plt.title(title, fontsize=20) + im = ax.imshow( + dbz, + interpolation="bilinear", + cmap=plt.get_cmap("Greys"), + aspect="auto", + origin="upper", + extent=[1, pars.nx, nz, 1], + vmax=abs(dbz).max(), + vmin=-abs(dbz).max(), + ) + + fig.colorbar(im, ax=ax) + + plt.show() + + print("Done") + + +if __name__ == "__main__": + display_graph = True + verbose_prints = True + main() diff --git a/cuda_bindings/examples/extra/jit_program.py b/cuda_bindings/examples/extra/jit_program.py new file mode 100644 index 00000000000..7f55b2243ed --- /dev/null +++ b/cuda_bindings/examples/extra/jit_program.py @@ -0,0 +1,191 @@ +# Copyright 2021-2026 NVIDIA Corporation. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +# ################################################################################ +# +# This example demonstrates JIT compilation of CUDA kernels using NVRTC +# and the Driver API (saxpy kernel). +# +# ################################################################################ + +# /// script +# dependencies = ["cuda_bindings>13.2.1", "numpy"] +# /// + +import ctypes + +import numpy as np + +from cuda.bindings import driver as cuda +from cuda.bindings import nvrtc + + +def assert_drv(err): + if isinstance(err, cuda.CUresult): + if err != cuda.CUresult.CUDA_SUCCESS: + raise RuntimeError(f"Cuda Error: {err}") + elif isinstance(err, nvrtc.nvrtcResult): + if err != nvrtc.nvrtcResult.NVRTC_SUCCESS: + raise RuntimeError(f"Nvrtc Error: {err}") + else: + raise RuntimeError(f"Unknown error type: {err}") + + +saxpy = """\ +extern "C" __global__ +void saxpy(float a, float *x, float *y, float *out, size_t n) +{ + size_t tid = blockIdx.x * blockDim.x + threadIdx.x; + if (tid < n) { + out[tid] = a * x[tid] + y[tid]; + } +} +""" + + +def main(): + # Init + (err,) = cuda.cuInit(0) + assert_drv(err) + + # Device + err, cu_device = cuda.cuDeviceGet(0) + assert_drv(err) + + # Ctx + err, context = cuda.cuCtxCreate(None, 0, cu_device) + assert_drv(err) + + # Create program + err, prog = nvrtc.nvrtcCreateProgram(str.encode(saxpy), b"saxpy.cu", 0, None, None) + assert_drv(err) + + # Get target architecture + err, major = cuda.cuDeviceGetAttribute( + cuda.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR, cu_device + ) + assert_drv(err) + err, minor = cuda.cuDeviceGetAttribute( + cuda.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR, cu_device + ) + assert_drv(err) + err, nvrtc_major, nvrtc_minor = nvrtc.nvrtcVersion() + assert_drv(err) + use_cubin = nvrtc_minor >= 1 + prefix = "sm" if use_cubin else "compute" + arch_arg = bytes(f"--gpu-architecture={prefix}_{major}{minor}", "ascii") + + # Compile program + opts = [b"--fmad=false", arch_arg] + (err,) = nvrtc.nvrtcCompileProgram(prog, len(opts), opts) + assert_drv(err) + + # Get log from compilation + err, log_size = nvrtc.nvrtcGetProgramLogSize(prog) + assert_drv(err) + log = b" " * log_size + (err,) = nvrtc.nvrtcGetProgramLog(prog, log) + assert_drv(err) + print(log.decode()) + + # Get data from compilation + if use_cubin: + err, data_size = nvrtc.nvrtcGetCUBINSize(prog) + assert_drv(err) + data = b" " * data_size + (err,) = nvrtc.nvrtcGetCUBIN(prog, data) + assert_drv(err) + else: + err, data_size = nvrtc.nvrtcGetPTXSize(prog) + assert_drv(err) + data = b" " * data_size + (err,) = nvrtc.nvrtcGetPTX(prog, data) + assert_drv(err) + + # Load data as module data and retrieve function + data = np.char.array(data) + err, module = cuda.cuModuleLoadData(data) + assert_drv(err) + err, kernel = cuda.cuModuleGetFunction(module, b"saxpy") + assert_drv(err) + + # Test the kernel + num_threads = 128 + num_blocks = 32 + + a = np.float32(2.0) + n = np.array(num_threads * num_blocks, dtype=np.uint32) + buffer_size = n * a.itemsize + + err, d_x = cuda.cuMemAlloc(buffer_size) + assert_drv(err) + err, d_y = cuda.cuMemAlloc(buffer_size) + assert_drv(err) + err, d_out = cuda.cuMemAlloc(buffer_size) + assert_drv(err) + + h_x = np.random.rand(n).astype(dtype=np.float32) + h_y = np.random.rand(n).astype(dtype=np.float32) + h_out = np.zeros(n).astype(dtype=np.float32) + + err, stream = cuda.cuStreamCreate(0) + assert_drv(err) + + (err,) = cuda.cuMemcpyHtoDAsync(d_x, h_x, buffer_size, stream) + assert_drv(err) + (err,) = cuda.cuMemcpyHtoDAsync(d_y, h_y, buffer_size, stream) + assert_drv(err) + + (err,) = cuda.cuStreamSynchronize(stream) + assert_drv(err) + + # Assert values are different before running kernel + h_z = a * h_x + h_y + if np.allclose(h_out, h_z): + raise ValueError("Error inside tolerence for host-device vectors") + + arg_values = (a, d_x, d_y, d_out, n) + arg_types = (ctypes.c_float, None, None, None, ctypes.c_size_t) + (err,) = cuda.cuLaunchKernel( + kernel, + num_blocks, + 1, + 1, # grid dim + num_threads, + 1, + 1, # block dim + 0, + stream, # shared mem and stream + (arg_values, arg_types), + 0, + ) # arguments + assert_drv(err) + + (err,) = cuda.cuMemcpyDtoHAsync(h_out, d_out, buffer_size, stream) + assert_drv(err) + (err,) = cuda.cuStreamSynchronize(stream) + assert_drv(err) + + # Assert values are same after running kernel + h_z = a * h_x + h_y + if not np.allclose(h_out, h_z): + raise ValueError("Error outside tolerence for host-device vectors") + + (err,) = cuda.cuStreamDestroy(stream) + assert_drv(err) + + (err,) = cuda.cuMemFree(d_x) + assert_drv(err) + (err,) = cuda.cuMemFree(d_y) + assert_drv(err) + (err,) = cuda.cuMemFree(d_out) + assert_drv(err) + + (err,) = cuda.cuModuleUnload(module) + assert_drv(err) + (err,) = cuda.cuCtxDestroy(context) + assert_drv(err) + + +if __name__ == "__main__": + main() diff --git a/cuda_bindings/pixi.lock b/cuda_bindings/pixi.lock new file mode 100644 index 00000000000..b3493db3209 --- /dev/null +++ b/cuda_bindings/pixi.lock @@ -0,0 +1,15106 @@ +version: 6 +environments: + cu12: + channels: + - url: https://conda.anaconda.org/conda-forge/ + options: + pypi-prerelease-mode: if-necessary-or-explicit + packages: + linux-64: + - conda: https://conda.anaconda.org/conda-forge/linux-64/_openmp_mutex-4.5-20_gnu.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/alsa-lib-1.2.15.3-hb03c661_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/aom-3.9.1-hac33072_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/attr-2.5.2-h39aace5_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/binutils_impl_linux-64-2.45.1-default_hfdba357_101.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/bzip2-1.0.8-hda65f42_9.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/ca-certificates-2026.2.25-hbd8a1cb_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cairo-1.18.4-he90730b_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/colorama-0.4.6-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cccl_linux-64-12.9.27-ha770c72_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-crt-dev_linux-64-12.9.86-ha770c72_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-cudart-12.9.79-h5888daf_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-cudart-dev-12.9.79-h5888daf_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart-dev_linux-64-12.9.79-h3f2d84a_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-cudart-static-12.9.79-h5888daf_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart-static_linux-64-12.9.79-h3f2d84a_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart_linux-64-12.9.79-h3f2d84a_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-nvrtc-12.9.86-hecca717_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-nvvm-12.9.86-h69a702a_6.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-nvvm-dev_linux-64-12.9.86-ha770c72_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-nvvm-impl-12.9.86-h4bc722e_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-nvvm-tools-12.9.86-h4bc722e_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-profiler-api-12.9.79-h7938cbb_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-version-12.9-h4f385c5_3.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cython-3.2.4-py314h1807b08_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/dav1d-1.2.1-hd590300_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/dbus-1.16.2-h24cb091_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/exceptiongroup-1.3.1-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/ffmpeg-8.0.1-gpl_hcddb375_914.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/font-ttf-dejavu-sans-mono-2.37-hab24e00_0.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/noarch/font-ttf-inconsolata-3.000-h77eed37_0.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/noarch/font-ttf-source-code-pro-2.038-h77eed37_0.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/noarch/font-ttf-ubuntu-0.83-h77eed37_3.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/fontconfig-2.17.1-h27c8c51_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/fonts-conda-ecosystem-1-0.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/noarch/fonts-conda-forge-1-hc364b38_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/freetype-2.14.2-ha770c72_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/fribidi-1.0.16-hb03c661_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/gcc-15.2.0-h6f77f03_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/gcc_impl_linux-64-15.2.0-he420e7e_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/gdk-pixbuf-2.44.5-h2b0a6b4_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/glslang-16.2.0-h96af755_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/gmp-6.3.0-hac33072_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/graphite2-1.3.14-hecca717_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/gxx-15.2.0-h76987e4_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/gxx_impl_linux-64-15.2.0-hda75c37_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/harfbuzz-13.1.0-h6083320_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/icu-78.2-h33c6efd_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/importlib-metadata-8.7.0-pyhe01879c_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/iniconfig-2.3.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/intel-gmmlib-22.9.0-hb700be7_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/intel-media-driver-26.1.4-hecca717_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/kernel-headers_linux-64-4.18.0-he073ed8_9.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/lame-3.100-h166bdaf_1003.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/linux-64/ld_impl_linux-64-2.45.1-default_hbd61a6d_101.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/lerc-4.1.0-hdb68285_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/level-zero-1.28.2-hb700be7_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libabseil-20260107.1-cxx17_h7b12aa8_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libass-0.17.4-h96ad9f0_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libblas-3.11.0-5_h4a7cf45_openblas.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libbrotlicommon-1.2.0-hb03c661_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libbrotlidec-1.2.0-hb03c661_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libbrotlienc-1.2.0-hb03c661_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libcap-2.77-h3ff7636_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libcblas-3.11.0-5_h0358290_openblas.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libcufile-1.14.1.1-hbc026e6_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libdeflate-1.25-h17f619e_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libdrm-2.4.125-hb03c661_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libegl-1.7.0-ha4b6fd6_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libexpat-2.7.4-hecca717_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libffi-3.5.2-h3435931_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libflac-1.5.0-he200343_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libfreetype-2.14.2-ha770c72_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libfreetype6-2.14.2-h73754d4_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libgcc-15.2.0-he0feb66_18.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/libgcc-devel_linux-64-15.2.0-hcc6f6b0_118.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libgcc-ng-15.2.0-h69a702a_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libgfortran-15.2.0-h69a702a_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libgfortran5-15.2.0-h68bc16d_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libgl-1.7.0-ha4b6fd6_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libglib-2.86.4-h6548e54_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libglvnd-1.7.0-ha4b6fd6_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libglx-1.7.0-ha4b6fd6_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libgomp-15.2.0-he0feb66_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libhwloc-2.12.2-default_hafda6a7_1000.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libhwy-1.3.0-h4c17acf_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libiconv-1.18-h3b78370_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libjpeg-turbo-3.1.2-hb03c661_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libjxl-0.11.2-ha09017c_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/liblapack-3.11.0-5_h47877c9_openblas.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/liblzma-5.8.2-hb03c661_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libmpdec-4.0.0-hb03c661_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libnl-3.11.0-hb9d3cd8_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libnvfatbin-12.9.82-hecca717_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libnvjitlink-12.9.86-hecca717_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libogg-1.3.5-hd0c01bc_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libopenblas-0.3.30-pthreads_h94d23a6_4.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-2026.0.0-hb56ce9e_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-auto-batch-plugin-2026.0.0-hd85de46_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-auto-plugin-2026.0.0-hd85de46_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-hetero-plugin-2026.0.0-hd41364c_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-intel-cpu-plugin-2026.0.0-hb56ce9e_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-intel-gpu-plugin-2026.0.0-hb56ce9e_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-intel-npu-plugin-2026.0.0-hb56ce9e_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-ir-frontend-2026.0.0-hd41364c_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-onnx-frontend-2026.0.0-h7a07914_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-paddle-frontend-2026.0.0-h7a07914_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-pytorch-frontend-2026.0.0-hecca717_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-tensorflow-frontend-2026.0.0-h78e8023_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-tensorflow-lite-frontend-2026.0.0-hecca717_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libopus-1.6.1-h280c20c_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libpciaccess-0.18-hb9d3cd8_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libpng-1.6.55-h421ea60_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libprotobuf-6.33.5-h2b00c02_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/librsvg-2.60.2-h61e6d4b_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libsanitizer-15.2.0-h90f66d4_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libsndfile-1.2.2-hc7d488a_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libsqlite-3.52.0-hf4e2dac_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libstdcxx-15.2.0-h934c35e_18.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/libstdcxx-devel_linux-64-15.2.0-hd446a21_118.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libstdcxx-ng-15.2.0-hdf11a46_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libsystemd0-257.10-hd0affe5_4.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libtiff-4.7.1-h9d88235_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libudev1-257.10-hd0affe5_4.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libunwind-1.8.3-h65a8314_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/liburing-2.14-hb700be7_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libusb-1.0.29-h73b1eb8_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libuuid-2.41.3-h5347b49_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libva-2.23.0-he1eb515_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libvorbis-1.3.7-h54a6638_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libvpl-2.16.0-h54a6638_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libvpx-1.15.2-hecca717_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libvulkan-loader-1.4.341.0-h5279c79_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libwebp-base-1.6.0-hd42ef1d_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libxcb-1.17.0-h8a09558_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libxkbcommon-1.13.1-hca5e8e5_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libxml2-16-2.15.2-hca6bf5a_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libxml2-2.15.2-he237659_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libzlib-1.3.1-hb9d3cd8_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/mpg123-1.32.9-hc50e24c_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/ncurses-6.5-h2d0b736_3.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/numpy-2.4.2-py314h2b28147_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/ocl-icd-2.3.3-hb9d3cd8_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/opencl-headers-2025.06.13-h5888daf_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/openh264-2.6.0-hc22cd8d_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/openssl-3.6.1-h35e630c_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/packaging-26.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/pango-1.56.4-hadf4263_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/pcre2-10.47-haa7fec5_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/pixman-0.46.4-h54a6638_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pluggy-1.6.0-pyhf9edf01_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/pthread-stubs-0.4-hb9d3cd8_1002.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/pugixml-1.15-h3f63f65_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/pulseaudio-client-17.0-h9a6aba3_3.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/py-cpuinfo-9.0.0-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pyglet-2.1.13-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pygments-2.19.2-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pytest-9.0.2-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pytest-benchmark-5.2.3-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pytest-randomly-3.15.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pytest-repeat-0.9.4-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/python-3.14.3-h32b2ec7_101_cp314.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/python_abi-3.14-8_cp314.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/rdma-core-61.0-h192683f_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/readline-8.3-h853b02a_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/sdl2-2.32.56-h54a6638_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/sdl3-3.4.2-hdeec2a5_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/setuptools-82.0.1-pyh332efcf_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/shaderc-2025.5-h718be3e_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/snappy-1.2.2-h03e3b7b_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/spirv-tools-2026.1-hb700be7_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/svt-av1-4.0.1-hecca717_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/sysroot_linux-64-2.28-h4ee821c_9.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/tbb-2022.3.0-hb700be7_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/tk-8.6.13-noxft_h366c992_103.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/tomli-2.4.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/typing_extensions-4.15.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/tzdata-2025c-hc9c84f9_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/wayland-1.24.0-hd6090a7_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/wayland-protocols-1.47-hd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/x264-1!164.3095-h166bdaf_2.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/linux-64/x265-3.5-h924138e_3.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/linux-64/xkeyboard-config-2.47-hb03c661_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/xorg-libice-1.1.2-hb9d3cd8_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/xorg-libsm-1.2.6-he73a12e_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/xorg-libx11-1.8.13-he1eb515_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/xorg-libxau-1.0.12-hb03c661_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/xorg-libxcursor-1.2.3-hb9d3cd8_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/xorg-libxdmcp-1.1.5-hb03c661_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/xorg-libxext-1.3.7-hb03c661_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/xorg-libxfixes-6.0.2-hb03c661_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/xorg-libxi-1.8.2-hb9d3cd8_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/xorg-libxrandr-1.5.5-hb03c661_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/xorg-libxrender-0.9.12-hb9d3cd8_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/xorg-libxscrnsaver-1.2.4-hb9d3cd8_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/xorg-libxtst-1.2.5-hb9d3cd8_3.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/zipp-3.23.0-pyhcf101f3_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/zstd-1.5.7-hb78ec9c_6.conda + - conda: . + build: py314ha6d028f_0 + - conda: ../cuda_pathfinder + linux-aarch64: + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/_openmp_mutex-4.5-20_gnu.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/alsa-lib-1.2.15.3-he30d5cf_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/aom-3.9.1-hcccb83c_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/arm-variant-1.2.0-sbsa.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/attr-2.5.1-h4e544f5_1.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/binutils_impl_linux-aarch64-2.45.1-default_h5f4c503_101.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/bzip2-1.0.8-h4777abc_9.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/ca-certificates-2026.2.25-hbd8a1cb_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/cairo-1.18.4-h0b6afd8_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/colorama-0.4.6-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cccl_linux-aarch64-12.9.27-h579c4fd_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-crt-dev_linux-aarch64-12.9.86-h579c4fd_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/cuda-cudart-12.9.79-h3ae8b8a_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/cuda-cudart-dev-12.9.79-h3ae8b8a_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart-dev_linux-aarch64-12.9.79-h3ae8b8a_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/cuda-cudart-static-12.9.79-h3ae8b8a_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart-static_linux-aarch64-12.9.79-h3ae8b8a_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart_linux-aarch64-12.9.79-h3ae8b8a_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/cuda-nvrtc-12.9.86-h8f3c8d4_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/cuda-nvvm-12.9.86-he9431aa_106.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-nvvm-dev_linux-aarch64-12.9.86-h579c4fd_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/cuda-nvvm-impl-12.9.86-h7b14b0b_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/cuda-nvvm-tools-12.9.86-h7b14b0b_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/cuda-profiler-api-12.9.79-h16bee8c_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-version-12.9-h4f385c5_3.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/cython-3.2.4-py314h4c416a3_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/dav1d-1.2.1-h31becfc_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/dbus-1.16.2-h70963c4_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/exceptiongroup-1.3.1-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/ffmpeg-8.0.1-gpl_h62efc85_914.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/font-ttf-dejavu-sans-mono-2.37-hab24e00_0.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/noarch/font-ttf-inconsolata-3.000-h77eed37_0.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/noarch/font-ttf-source-code-pro-2.038-h77eed37_0.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/noarch/font-ttf-ubuntu-0.83-h77eed37_3.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/fontconfig-2.17.1-hba86a56_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/fonts-conda-ecosystem-1-0.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/noarch/fonts-conda-forge-1-hc364b38_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/freetype-2.14.2-h8af1aa0_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/fribidi-1.0.16-he30d5cf_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/gcc-15.2.0-h24a549f_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/gcc_impl_linux-aarch64-15.2.0-hcedddb3_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/gdk-pixbuf-2.44.5-h90308e0_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/glslang-16.2.0-h124e036_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/gmp-6.3.0-h0a1ffab_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/graphite2-1.3.14-hfae3067_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/gxx-15.2.0-ha384071_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/gxx_impl_linux-aarch64-15.2.0-h03e2352_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/harfbuzz-13.1.0-h1134a53_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/icu-78.2-hcab7f73_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/importlib-metadata-8.7.0-pyhe01879c_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/iniconfig-2.3.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/kernel-headers_linux-aarch64-4.18.0-h05a177a_9.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/lame-3.100-h4e544f5_1003.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/ld_impl_linux-aarch64-2.45.1-default_h1979696_101.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/lerc-4.1.0-h52b7260_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libabseil-20260107.1-cxx17_h6983b43_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libass-0.17.4-hcfe818d_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libblas-3.11.0-5_haddc8a3_openblas.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libbrotlicommon-1.2.0-he30d5cf_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libbrotlidec-1.2.0-he30d5cf_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libbrotlienc-1.2.0-he30d5cf_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libcap-2.77-h68e9139_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libcblas-3.11.0-5_hd72aa62_openblas.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libcufile-1.14.1.1-had8bf56_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libdeflate-1.25-h1af38f5_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libdrm-2.4.125-he30d5cf_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libegl-1.7.0-hd24410f_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libexpat-2.7.4-hfae3067_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libffi-3.5.2-h376a255_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libflac-1.5.0-he9c94f4_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libfreetype-2.14.2-h8af1aa0_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libfreetype6-2.14.2-hdae7a39_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libgcc-15.2.0-h8acb6b2_18.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/libgcc-devel_linux-aarch64-15.2.0-h55c397f_118.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libgcc-ng-15.2.0-he9431aa_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libgfortran-15.2.0-he9431aa_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libgfortran5-15.2.0-h1b7bec0_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libgl-1.7.0-hd24410f_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libglib-2.86.4-hf53f6bf_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libglvnd-1.7.0-hd24410f_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libglx-1.7.0-hd24410f_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libgomp-15.2.0-h8acb6b2_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libhwloc-2.12.2-default_ha470c98_1000.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libhwy-1.3.0-h81d0cf9_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libiconv-1.18-h90929bb_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libjpeg-turbo-3.1.2-he30d5cf_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libjxl-0.11.2-h71be66a_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/liblapack-3.11.0-5_h88aeb00_openblas.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/liblzma-5.8.2-he30d5cf_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libmpdec-4.0.0-he30d5cf_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libnl-3.11.0-h86ecc28_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libnvfatbin-12.9.82-h8f3c8d4_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libnvjitlink-12.9.86-h8f3c8d4_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libogg-1.3.5-h86ecc28_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenblas-0.3.30-pthreads_h9d3fd7e_4.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenvino-2026.0.0-h1915271_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenvino-arm-cpu-plugin-2026.0.0-h1915271_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenvino-auto-batch-plugin-2026.0.0-h3d5001d_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenvino-auto-plugin-2026.0.0-h3d5001d_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenvino-hetero-plugin-2026.0.0-he07c6df_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenvino-ir-frontend-2026.0.0-he07c6df_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenvino-onnx-frontend-2026.0.0-h558496d_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenvino-paddle-frontend-2026.0.0-h558496d_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenvino-pytorch-frontend-2026.0.0-hfae3067_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenvino-tensorflow-frontend-2026.0.0-h2cb6e3c_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenvino-tensorflow-lite-frontend-2026.0.0-hfae3067_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopus-1.6.1-h80f16a2_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libpciaccess-0.18-h86ecc28_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libpng-1.6.55-h1abf092_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libprotobuf-6.33.5-h1f88751_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/librsvg-2.60.2-h8171147_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libsanitizer-15.2.0-he19c465_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libsndfile-1.2.2-h30591a0_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libsqlite-3.52.0-h10b116e_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libstdcxx-15.2.0-hef695bb_18.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/libstdcxx-devel_linux-aarch64-15.2.0-ha7b1723_118.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libstdcxx-ng-15.2.0-hdbbeba8_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libsystemd0-257.10-hf9559e3_4.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libtiff-4.7.1-hdb009f0_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libudev1-257.10-hf9559e3_4.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libunwind-1.8.3-h6470e1d_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/liburing-2.14-hfefdfc9_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libusb-1.0.29-h06eaf92_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libuuid-2.41.3-h1022ec0_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libvorbis-1.3.7-h7ac5ae9_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libvpx-1.15.2-hfae3067_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libvulkan-loader-1.4.341.0-h8b8848b_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libwebp-base-1.6.0-ha2e29f5_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libxcb-1.17.0-h262b8f6_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libxkbcommon-1.13.1-h3c6a4c8_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libxml2-16-2.15.2-h79dcc73_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libxml2-2.15.2-h825857f_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libzlib-1.3.1-h86ecc28_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/mpg123-1.32.9-h65af167_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/ncurses-6.5-ha32ae93_3.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/numpy-2.4.2-py314haac167e_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/openh264-2.6.0-h0564a2a_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/openssl-3.6.1-h546c87b_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/packaging-26.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/pango-1.56.4-he55ef5b_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/pcre2-10.47-hf841c20_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/pixman-0.46.4-h7ac5ae9_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pluggy-1.6.0-pyhf9edf01_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/pthread-stubs-0.4-h86ecc28_1002.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/pugixml-1.15-h6ef32b0_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/pulseaudio-client-17.0-hcf98165_3.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/py-cpuinfo-9.0.0-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pyglet-2.1.13-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pygments-2.19.2-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pytest-9.0.2-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pytest-benchmark-5.2.3-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pytest-randomly-3.15.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pytest-repeat-0.9.4-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/python-3.14.3-hb06a95a_101_cp314.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/python_abi-3.14-8_cp314.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/rdma-core-61.0-h1f0f388_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/readline-8.3-hb682ff5_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/sdl2-2.32.56-h7ac5ae9_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/sdl3-3.4.2-had2c13b_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/setuptools-82.0.1-pyh332efcf_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/shaderc-2025.5-hfeb5c2c_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/snappy-1.2.2-he774c54_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/spirv-tools-2026.1-hfefdfc9_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/svt-av1-4.0.1-hfae3067_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/sysroot_linux-aarch64-2.28-h585391f_9.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/tbb-2022.3.0-hfefdfc9_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/tk-8.6.13-noxft_h0dc03b3_103.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/tomli-2.4.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/typing_extensions-4.15.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/tzdata-2025c-hc9c84f9_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/wayland-1.24.0-h4f8a99f_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/x264-1!164.3095-h4e544f5_2.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/x265-3.5-hdd96247_3.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/xkeyboard-config-2.47-he30d5cf_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/xorg-libice-1.1.2-h86ecc28_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/xorg-libsm-1.2.6-h0808dbd_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/xorg-libx11-1.8.13-h63a1b12_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/xorg-libxau-1.0.12-he30d5cf_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/xorg-libxcursor-1.2.3-h86ecc28_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/xorg-libxdmcp-1.1.5-he30d5cf_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/xorg-libxext-1.3.7-he30d5cf_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/xorg-libxfixes-6.0.2-he30d5cf_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/xorg-libxi-1.8.2-h57736b2_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/xorg-libxrandr-1.5.5-he30d5cf_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/xorg-libxrender-0.9.12-h86ecc28_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/xorg-libxscrnsaver-1.2.4-h86ecc28_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/xorg-libxtst-1.2.5-h57736b2_3.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/zipp-3.23.0-pyhcf101f3_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/zstd-1.5.7-h85ac4a6_6.conda + - conda: . + build: py314he8946ed_0 + - conda: ../cuda_pathfinder + win-64: + - conda: https://conda.anaconda.org/conda-forge/win-64/_openmp_mutex-4.5-20_gnu.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/aom-3.9.1-he0c23c2_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/binutils_impl_win-64-2.45.1-default_ha84baeb_101.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/bzip2-1.0.8-h0ad9c76_9.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/ca-certificates-2026.2.25-h4c7d964_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/cairo-1.18.4-h477c42c_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/colorama-0.4.6-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/conda-gcc-specs-15.2.0-hd546029_18.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cccl_win-64-12.9.27-h57928b3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-crt-dev_win-64-12.9.86-h57928b3_2.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/cuda-cudart-12.9.79-he0c23c2_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/cuda-cudart-dev-12.9.79-he0c23c2_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart-dev_win-64-12.9.79-he0c23c2_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/cuda-cudart-static-12.9.79-he0c23c2_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart-static_win-64-12.9.79-he0c23c2_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart_win-64-12.9.79-he0c23c2_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/cuda-nvrtc-12.9.86-hac47afa_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/cuda-nvvm-12.9.86-h719f0c7_6.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-nvvm-dev_win-64-12.9.86-h57928b3_2.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/cuda-nvvm-impl-12.9.86-h2466b09_2.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/cuda-nvvm-tools-12.9.86-h2466b09_2.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/cuda-profiler-api-12.9.79-h57928b3_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-version-12.9-h4f385c5_3.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/cython-3.2.4-py314h344ed54_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/dav1d-1.2.1-hcfcfb64_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/exceptiongroup-1.3.1-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/ffmpeg-8.0.1-gpl_hb2d76f6_914.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/font-ttf-dejavu-sans-mono-2.37-hab24e00_0.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/noarch/font-ttf-inconsolata-3.000-h77eed37_0.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/noarch/font-ttf-source-code-pro-2.038-h77eed37_0.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/noarch/font-ttf-ubuntu-0.83-h77eed37_3.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/fontconfig-2.17.1-hd47e2ca_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/fonts-conda-ecosystem-1-0.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/noarch/fonts-conda-forge-1-hc364b38_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/freetype-2.14.2-h57928b3_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/fribidi-1.0.16-hfd05255_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/gcc-15.2.0-hd556455_18.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/gcc_impl_win-64-15.2.0-ha526d7c_18.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/gdk-pixbuf-2.44.5-h1f5b9c4_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/glslang-16.2.0-h294ba9c_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/graphite2-1.3.14-hac47afa_2.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/gxx-15.2.0-hf1b5d6d_18.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/gxx_impl_win-64-15.2.0-h22fd5bf_18.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/harfbuzz-13.1.0-h5a1b470_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/icu-78.2-h637d24d_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/importlib-metadata-8.7.0-pyhe01879c_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/iniconfig-2.3.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/lame-3.100-hcfcfb64_1003.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/win-64/ld_impl_win-64-2.45.1-default_hfd38196_101.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/lerc-4.1.0-hd936e49_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libblas-3.11.0-5_hf2e6a31_mkl.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libbrotlicommon-1.2.0-hfd05255_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libbrotlidec-1.2.0-hfd05255_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libbrotlienc-1.2.0-hfd05255_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libcblas-3.11.0-5_h2a3cdd5_mkl.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libdeflate-1.25-h51727cc_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libexpat-2.7.4-hac47afa_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libffi-3.5.2-h3d046cb_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libfreetype-2.14.2-h57928b3_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libfreetype6-2.14.2-hdbac1cb_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libgcc-15.2.0-h8ee18e1_18.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/libgcc-devel_win-64-15.2.0-hbb59886_118.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libglib-2.86.4-h0c9aed9_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libgomp-15.2.0-h8ee18e1_18.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libhwloc-2.12.2-default_h4379cf1_1000.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libhwy-1.3.0-ha71e874_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libiconv-1.18-hc1393d2_2.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libintl-0.22.5-h5728263_3.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libjpeg-turbo-3.1.2-hfd05255_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libjxl-0.11.2-hf3f85d1_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/liblapack-3.11.0-5_hf9ab0e9_mkl.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/liblzma-5.8.2-hfd05255_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libmpdec-4.0.0-hfd05255_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libnvfatbin-12.9.82-hac47afa_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libnvjitlink-12.9.86-hac47afa_2.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libogg-1.3.5-h2466b09_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libopus-1.6.1-h6a83c73_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libpng-1.6.55-h7351971_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/librsvg-2.60.0-hd5e4115_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libsqlite-3.52.0-hf5d6505_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libstdcxx-15.2.0-hae5796f_18.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/libstdcxx-devel_win-64-15.2.0-h0a72980_118.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libtiff-4.7.1-h8f73337_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libusb-1.0.29-h1839187_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libvorbis-1.3.7-h5112557_2.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libvulkan-loader-1.4.341.0-h477610d_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libwebp-base-1.6.0-h4d5522a_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libwinpthread-12.0.0.r4.gg4f2fc60ca-h57928b3_10.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libxml2-16-2.15.2-h3cfd58e_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libxml2-2.15.2-h779ef1b_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libzlib-1.3.1-h2466b09_2.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/llvm-openmp-22.1.0-h4fa8253_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/m2-conda-epoch-20250515-0_x86_64.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/m2w64-sysroot_win-64-12.0.0.r4.gg4f2fc60ca-hd8ed1ab_10.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/mingw-w64-ucrt-x86_64-crt-git-12.0.0.r4.gg4f2fc60ca-hd8ed1ab_10.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/mingw-w64-ucrt-x86_64-headers-git-12.0.0.r4.gg4f2fc60ca-hd8ed1ab_10.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/mingw-w64-ucrt-x86_64-windows-default-manifest-6.4-he206cdd_7.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/mingw-w64-ucrt-x86_64-winpthreads-git-12.0.0.r4.gg4f2fc60ca-hd8ed1ab_10.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/mkl-2025.3.0-hac47afa_455.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/numpy-2.4.2-py314h06c3c77_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/openh264-2.6.0-hb17fa0b_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/openssl-3.6.1-hf411b9b_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/packaging-26.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/pango-1.56.4-h03d888a_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/pcre2-10.47-hd2b5f0e_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/pixman-0.46.4-h5112557_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pluggy-1.6.0-pyhf9edf01_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/py-cpuinfo-9.0.0-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pyglet-2.1.13-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pygments-2.19.2-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pytest-9.0.2-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pytest-benchmark-5.2.3-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pytest-randomly-3.15.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pytest-repeat-0.9.4-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/python-3.14.3-h4b44e0e_101_cp314.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/python_abi-3.14-8_cp314.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/sdl2-2.32.56-h5112557_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/sdl3-3.4.2-h5112557_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/setuptools-82.0.1-pyh332efcf_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/shaderc-2025.5-h8fa7867_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/spirv-tools-2026.1-h49e36cd_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/svt-av1-4.0.1-hac47afa_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/tbb-2022.3.0-h3155e25_2.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/tk-8.6.13-h6ed50ae_3.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/tomli-2.4.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/typing_extensions-4.15.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/tzdata-2025c-hc9c84f9_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/ucrt-10.0.26100.0-h57928b3_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/vc-14.3-h41ae7f8_34.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/vc14_runtime-14.44.35208-h818238b_34.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/vcomp14-14.44.35208-h818238b_34.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/vs2015_runtime-14.44.35208-h38c0c73_34.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/x264-1!164.3095-h8ffe710_2.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/win-64/x265-3.5-h2d74725_3.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/noarch/zipp-3.23.0-pyhcf101f3_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/zstd-1.5.7-h534d264_6.conda + - conda: . + build: py314h5e6f764_0 + - conda: ../cuda_pathfinder + cu13: + channels: + - url: https://conda.anaconda.org/conda-forge/ + options: + pypi-prerelease-mode: if-necessary-or-explicit + packages: + linux-64: + - conda: https://conda.anaconda.org/conda-forge/linux-64/_libgcc_mutex-0.1-conda_forge.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/linux-64/_openmp_mutex-4.5-2_gnu.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/linux-64/alsa-lib-1.2.15.1-hb03c661_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/aom-3.9.1-hac33072_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/attr-2.5.2-h39aace5_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/binutils_impl_linux-64-2.45-default_hfdba357_105.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/bzip2-1.0.8-hda65f42_8.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/ca-certificates-2026.1.4-hbd8a1cb_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cairo-1.18.4-he90730b_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/colorama-0.4.6-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/conda-gcc-specs-15.2.0-h53410ce_16.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cccl_linux-64-13.3.3.3.1-ha770c72_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-crt-dev_linux-64-13.3.33-ha770c72_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-cudart-13.3.29-hecca717_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-cudart-dev-13.3.29-hecca717_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart-dev_linux-64-13.3.29-h376f20c_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-cudart-static-13.3.29-hecca717_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart-static_linux-64-13.3.29-h376f20c_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart_linux-64-13.3.29-h376f20c_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-nvrtc-13.3.33-hecca717_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-nvvm-13.3.33-h69a702a_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-nvvm-dev_linux-64-13.3.33-ha770c72_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-nvvm-impl-13.3.33-h4bc722e_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-nvvm-tools-13.3.33-h4bc722e_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-profiler-api-13.3.27-h7938cbb_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-version-13.3-hcbadf70_3.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cython-3.2.4-py314h1807b08_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/dav1d-1.2.1-hd590300_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/dbus-1.16.2-h24cb091_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/exceptiongroup-1.3.1-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/ffmpeg-8.0.1-gpl_hb3f9226_906.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/font-ttf-dejavu-sans-mono-2.37-hab24e00_0.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/noarch/font-ttf-inconsolata-3.000-h77eed37_0.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/noarch/font-ttf-source-code-pro-2.038-h77eed37_0.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/noarch/font-ttf-ubuntu-0.83-h77eed37_3.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/fontconfig-2.15.0-h7e30c49_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/fonts-conda-ecosystem-1-0.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/noarch/fonts-conda-forge-1-hc364b38_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/freetype-2.14.1-ha770c72_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/fribidi-1.0.16-hb03c661_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/gcc-15.2.0-h0dff253_16.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/gcc_impl_linux-64-15.2.0-hc5723f1_16.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/gdk-pixbuf-2.44.4-h2b0a6b4_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/glslang-16.1.0-hfd11570_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/gmp-6.3.0-hac33072_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/graphite2-1.3.14-hecca717_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/gxx-15.2.0-h76987e4_16.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/gxx_impl_linux-64-15.2.0-hda75c37_16.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/harfbuzz-12.3.0-h6083320_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/icu-78.1-h33c6efd_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/importlib-metadata-8.7.0-pyhe01879c_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/iniconfig-2.3.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/intel-gmmlib-22.9.0-hb700be7_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/intel-media-driver-25.3.4-hecca717_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/kernel-headers_linux-64-4.18.0-he073ed8_9.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/lame-3.100-h166bdaf_1003.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/linux-64/ld_impl_linux-64-2.45-default_hbd61a6d_105.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/lerc-4.0.0-h0aef613_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/level-zero-1.26.3-hb700be7_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libabseil-20250512.1-cxx17_hba17884_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libass-0.17.4-h96ad9f0_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libblas-3.11.0-5_h4a7cf45_openblas.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libcap-2.77-h3ff7636_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libcblas-3.11.0-5_h0358290_openblas.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libcufile-1.18.0.66-h85c024f_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libdeflate-1.25-h17f619e_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libdrm-2.4.125-hb03c661_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libegl-1.7.0-ha4b6fd6_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libexpat-2.7.3-hecca717_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libffi-3.5.2-h9ec8514_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libflac-1.5.0-he200343_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libfreetype-2.14.1-ha770c72_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libfreetype6-2.14.1-h73754d4_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libgcc-15.2.0-he0feb66_16.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/libgcc-devel_linux-64-15.2.0-hcc6f6b0_116.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libgcc-ng-15.2.0-h69a702a_16.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libgfortran-15.2.0-h69a702a_16.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libgfortran5-15.2.0-h68bc16d_16.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libgl-1.7.0-ha4b6fd6_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libglib-2.86.3-h6548e54_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libglvnd-1.7.0-ha4b6fd6_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libglx-1.7.0-ha4b6fd6_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libgomp-15.2.0-he0feb66_16.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libhwloc-2.12.1-default_hafda6a7_1003.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libiconv-1.18-h3b78370_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libjpeg-turbo-3.1.2-hb03c661_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/liblapack-3.11.0-5_h47877c9_openblas.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/liblzma-5.8.1-hb9d3cd8_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libmpdec-4.0.0-hb9d3cd8_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libnl-3.11.0-hb9d3cd8_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libnvfatbin-13.3.29-hecca717_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libnvjitlink-13.3.33-hecca717_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libogg-1.3.5-hd0c01bc_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libopenblas-0.3.30-pthreads_h94d23a6_4.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-2025.2.0-hb617929_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-auto-batch-plugin-2025.2.0-hed573e4_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-auto-plugin-2025.2.0-hed573e4_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-hetero-plugin-2025.2.0-hd41364c_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-intel-cpu-plugin-2025.2.0-hb617929_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-intel-gpu-plugin-2025.2.0-hb617929_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-intel-npu-plugin-2025.2.0-hb617929_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-ir-frontend-2025.2.0-hd41364c_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-onnx-frontend-2025.2.0-h1862bb8_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-paddle-frontend-2025.2.0-h1862bb8_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-pytorch-frontend-2025.2.0-hecca717_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-tensorflow-frontend-2025.2.0-h0767aad_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-tensorflow-lite-frontend-2025.2.0-hecca717_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libopus-1.5.2-hd0c01bc_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libpciaccess-0.18-hb9d3cd8_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libpng-1.6.53-h421ea60_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libprotobuf-6.31.1-h49aed37_4.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/librsvg-2.60.0-h61e6d4b_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libsanitizer-15.2.0-h90f66d4_16.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libsndfile-1.2.2-hc7d488a_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libsqlite-3.51.1-hf4e2dac_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libstdcxx-15.2.0-h934c35e_16.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/libstdcxx-devel_linux-64-15.2.0-hd446a21_116.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libstdcxx-ng-15.2.0-hdf11a46_16.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libsystemd0-257.10-hd0affe5_3.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libtiff-4.7.1-h9d88235_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libudev1-257.10-hd0affe5_3.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libunwind-1.8.3-h65a8314_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/liburing-2.13-hb700be7_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libusb-1.0.29-h73b1eb8_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libuuid-2.41.3-h5347b49_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libva-2.23.0-he1eb515_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libvorbis-1.3.7-h54a6638_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libvpl-2.15.0-h54a6638_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libvpx-1.15.2-hecca717_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libvulkan-loader-1.4.328.1-h5279c79_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libwebp-base-1.6.0-hd42ef1d_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libxcb-1.17.0-h8a09558_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libxkbcommon-1.13.1-hca5e8e5_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libxml2-16-2.15.1-hca6bf5a_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libxml2-2.15.1-he237659_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libzlib-1.3.1-hb9d3cd8_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/mpg123-1.32.9-hc50e24c_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/ncurses-6.5-h2d0b736_3.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/numpy-2.4.0-py314h2b28147_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/ocl-icd-2.3.3-hb9d3cd8_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/opencl-headers-2025.06.13-h5888daf_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/openh264-2.6.0-hc22cd8d_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/openssl-3.6.0-h26f9b46_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/packaging-25.0-pyh29332c3_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/pango-1.56.4-hadf4263_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/pcre2-10.47-haa7fec5_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/pixman-0.46.4-h54a6638_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pluggy-1.6.0-pyhf9edf01_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/pthread-stubs-0.4-hb9d3cd8_1002.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/pugixml-1.15-h3f63f65_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/pulseaudio-client-17.0-h9a6aba3_3.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/py-cpuinfo-9.0.0-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pyglet-2.1.11-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pygments-2.19.2-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pytest-9.0.2-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pytest-benchmark-5.2.3-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pytest-randomly-3.15.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pytest-repeat-0.9.4-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/python-3.14.2-h32b2ec7_100_cp314.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/python_abi-3.14-8_cp314.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/rdma-core-61.0-h192683f_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/readline-8.3-h853b02a_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/sdl2-2.32.56-h54a6638_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/sdl3-3.2.30-h3b84278_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/setuptools-80.9.0-pyhff2d567_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/shaderc-2025.5-h3e344bc_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/snappy-1.2.2-h03e3b7b_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/spirv-tools-2025.4-hb700be7_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/svt-av1-3.1.2-hecca717_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/sysroot_linux-64-2.28-h4ee821c_9.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/tbb-2022.3.0-h8d10470_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/tk-8.6.13-noxft_ha0e22de_103.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/tomli-2.3.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/typing_extensions-4.15.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/tzdata-2025c-hc9c84f9_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/wayland-1.24.0-hd6090a7_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/wayland-protocols-1.47-hd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/x264-1!164.3095-h166bdaf_2.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/linux-64/x265-3.5-h924138e_3.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/linux-64/xkeyboard-config-2.46-hb03c661_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/xorg-libice-1.1.2-hb9d3cd8_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/xorg-libsm-1.2.6-he73a12e_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/xorg-libx11-1.8.12-h4f16b4b_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/xorg-libxau-1.0.12-hb03c661_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/xorg-libxcursor-1.2.3-hb9d3cd8_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/xorg-libxdmcp-1.1.5-hb03c661_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/xorg-libxext-1.3.6-hb9d3cd8_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/xorg-libxfixes-6.0.2-hb03c661_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/xorg-libxrandr-1.5.4-hb9d3cd8_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/xorg-libxrender-0.9.12-hb9d3cd8_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/xorg-libxscrnsaver-1.2.4-hb9d3cd8_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/zipp-3.23.0-pyhcf101f3_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/zstd-1.5.7-hb78ec9c_6.conda + - conda: . + build: py314hd3a1e81_0 + - conda: ../cuda_pathfinder + linux-aarch64: + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/_openmp_mutex-4.5-2_gnu.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/alsa-lib-1.2.15.1-he30d5cf_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/aom-3.9.1-hcccb83c_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/arm-variant-1.2.0-sbsa.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/attr-2.5.1-h4e544f5_1.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/binutils_impl_linux-aarch64-2.45-default_h5f4c503_105.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/bzip2-1.0.8-h4777abc_8.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/ca-certificates-2026.1.4-hbd8a1cb_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/cairo-1.18.4-h0b6afd8_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/colorama-0.4.6-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cccl_linux-aarch64-13.3.3.3.1-h579c4fd_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-crt-dev_linux-aarch64-13.3.33-h579c4fd_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/cuda-cudart-13.3.29-h8f3c8d4_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/cuda-cudart-dev-13.3.29-h8f3c8d4_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart-dev_linux-aarch64-13.3.29-h8f3c8d4_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/cuda-cudart-static-13.3.29-h8f3c8d4_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart-static_linux-aarch64-13.3.29-h8f3c8d4_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart_linux-aarch64-13.3.29-h8f3c8d4_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/cuda-nvrtc-13.3.33-h8f3c8d4_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/cuda-nvvm-13.3.33-he9431aa_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-nvvm-dev_linux-aarch64-13.3.33-h579c4fd_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/cuda-nvvm-impl-13.3.33-h7b14b0b_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/cuda-nvvm-tools-13.3.33-h7b14b0b_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/cuda-profiler-api-13.3.27-h16bee8c_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-version-13.3-hcbadf70_3.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/cython-3.2.4-py314h4c416a3_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/dav1d-1.2.1-h31becfc_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/dbus-1.16.2-h70963c4_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/exceptiongroup-1.3.1-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/ffmpeg-8.0.1-gpl_h936a714_906.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/font-ttf-dejavu-sans-mono-2.37-hab24e00_0.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/noarch/font-ttf-inconsolata-3.000-h77eed37_0.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/noarch/font-ttf-source-code-pro-2.038-h77eed37_0.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/noarch/font-ttf-ubuntu-0.83-h77eed37_3.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/fontconfig-2.15.0-h8dda3cd_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/fonts-conda-ecosystem-1-0.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/noarch/fonts-conda-forge-1-hc364b38_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/freetype-2.14.1-h8af1aa0_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/fribidi-1.0.16-he30d5cf_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/gcc-15.2.0-h24a549f_16.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/gcc_impl_linux-aarch64-15.2.0-habb1d5c_16.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/gdk-pixbuf-2.44.4-h90308e0_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/glslang-16.1.0-hd1da3a6_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/gmp-6.3.0-h0a1ffab_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/graphite2-1.3.14-hfae3067_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/gxx-15.2.0-ha384071_16.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/gxx_impl_linux-aarch64-15.2.0-h03e2352_16.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/harfbuzz-12.3.0-h1134a53_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/icu-78.1-hb1525cb_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/importlib-metadata-8.7.0-pyhe01879c_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/iniconfig-2.3.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/kernel-headers_linux-aarch64-4.18.0-h05a177a_9.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/lame-3.100-h4e544f5_1003.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/ld_impl_linux-aarch64-2.45-default_h1979696_105.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/lerc-4.0.0-hfdc4d58_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libabseil-20250512.1-cxx17_h201e9ed_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libass-0.17.4-hcfe818d_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libblas-3.11.0-5_haddc8a3_openblas.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libcap-2.77-h68e9139_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libcblas-3.11.0-5_hd72aa62_openblas.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libcufile-1.18.0.66-h4243460_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libdeflate-1.25-h1af38f5_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libdrm-2.4.125-he30d5cf_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libegl-1.7.0-hd24410f_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libexpat-2.7.3-hfae3067_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libffi-3.5.2-hd65408f_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libflac-1.5.0-he9c94f4_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libfreetype-2.14.1-h8af1aa0_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libfreetype6-2.14.1-hdae7a39_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libgcc-15.2.0-h8acb6b2_16.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/libgcc-devel_linux-aarch64-15.2.0-h55c397f_116.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libgcc-ng-15.2.0-he9431aa_16.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libgfortran-15.2.0-he9431aa_16.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libgfortran5-15.2.0-h1b7bec0_16.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libgl-1.7.0-hd24410f_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libglib-2.86.3-hf53f6bf_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libglvnd-1.7.0-hd24410f_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libglx-1.7.0-hd24410f_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libgomp-15.2.0-h8acb6b2_16.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libhwloc-2.12.1-default_ha470c98_1003.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libiconv-1.18-h90929bb_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libjpeg-turbo-3.1.2-he30d5cf_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/liblapack-3.11.0-5_h88aeb00_openblas.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/liblzma-5.8.1-h86ecc28_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libmpdec-4.0.0-h86ecc28_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libnl-3.11.0-h86ecc28_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libnvfatbin-13.3.29-h8f3c8d4_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libnvjitlink-13.3.33-h8f3c8d4_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libogg-1.3.5-h86ecc28_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenblas-0.3.30-pthreads_h9d3fd7e_4.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenvino-2025.2.0-hcd21e76_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenvino-arm-cpu-plugin-2025.2.0-hcd21e76_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenvino-auto-batch-plugin-2025.2.0-h3890994_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenvino-auto-plugin-2025.2.0-h3890994_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenvino-hetero-plugin-2025.2.0-he07c6df_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenvino-ir-frontend-2025.2.0-he07c6df_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenvino-onnx-frontend-2025.2.0-h07d5dce_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenvino-paddle-frontend-2025.2.0-h07d5dce_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenvino-pytorch-frontend-2025.2.0-hfae3067_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenvino-tensorflow-frontend-2025.2.0-h38473e3_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenvino-tensorflow-lite-frontend-2025.2.0-hfae3067_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopus-1.5.2-h86ecc28_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libpciaccess-0.18-h86ecc28_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libpng-1.6.53-h1abf092_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libprotobuf-6.31.1-h2cf3c76_4.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/librsvg-2.60.0-h8171147_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libsanitizer-15.2.0-he19c465_16.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libsndfile-1.2.2-h30591a0_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libsqlite-3.51.1-h10b116e_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libstdcxx-15.2.0-hef695bb_16.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/libstdcxx-devel_linux-aarch64-15.2.0-ha7b1723_116.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libstdcxx-ng-15.2.0-hdbbeba8_16.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libsystemd0-257.10-hf9559e3_3.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libtiff-4.7.1-hdb009f0_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libudev1-257.10-hf9559e3_3.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libunwind-1.8.3-h6470e1d_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/liburing-2.13-hfefdfc9_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libusb-1.0.29-h06eaf92_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libuuid-2.41.3-h1022ec0_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libvorbis-1.3.7-h7ac5ae9_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libvpx-1.15.2-hfae3067_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libvulkan-loader-1.4.328.1-h8b8848b_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libwebp-base-1.6.0-ha2e29f5_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libxcb-1.17.0-h262b8f6_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libxkbcommon-1.13.1-h3c6a4c8_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libxml2-16-2.15.1-h79dcc73_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libxml2-2.15.1-h825857f_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libzlib-1.3.1-h86ecc28_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/mpg123-1.32.9-h65af167_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/ncurses-6.5-ha32ae93_3.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/numpy-2.4.0-py314haac167e_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/openh264-2.6.0-h0564a2a_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/openssl-3.6.0-h8e36d6e_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/packaging-25.0-pyh29332c3_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/pango-1.56.4-he55ef5b_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/pcre2-10.47-hf841c20_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/pixman-0.46.4-h7ac5ae9_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pluggy-1.6.0-pyhf9edf01_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/pthread-stubs-0.4-h86ecc28_1002.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/pugixml-1.15-h6ef32b0_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/pulseaudio-client-17.0-hcf98165_3.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/py-cpuinfo-9.0.0-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pyglet-2.1.11-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pygments-2.19.2-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pytest-9.0.2-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pytest-benchmark-5.2.3-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pytest-randomly-3.15.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pytest-repeat-0.9.4-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/python-3.14.2-hb06a95a_100_cp314.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/python_abi-3.14-8_cp314.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/rdma-core-61.0-h1f0f388_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/readline-8.3-hb682ff5_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/sdl2-2.32.56-h7ac5ae9_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/sdl3-3.2.30-h3d544e7_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/setuptools-80.9.0-pyhff2d567_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/shaderc-2025.5-h8c88b8f_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/snappy-1.2.2-he774c54_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/spirv-tools-2025.4-hfefdfc9_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/svt-av1-3.1.2-hfae3067_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/sysroot_linux-aarch64-2.28-h585391f_9.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/tbb-2022.3.0-h0eac15c_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/tk-8.6.13-noxft_h561c983_103.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/tomli-2.3.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/typing_extensions-4.15.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/tzdata-2025c-hc9c84f9_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/wayland-1.24.0-h4f8a99f_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/x264-1!164.3095-h4e544f5_2.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/x265-3.5-hdd96247_3.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/xkeyboard-config-2.46-he30d5cf_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/xorg-libice-1.1.2-h86ecc28_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/xorg-libsm-1.2.6-h0808dbd_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/xorg-libx11-1.8.12-hca56bd8_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/xorg-libxau-1.0.12-he30d5cf_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/xorg-libxcursor-1.2.3-h86ecc28_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/xorg-libxdmcp-1.1.5-he30d5cf_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/xorg-libxext-1.3.6-h57736b2_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/xorg-libxfixes-6.0.2-he30d5cf_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/xorg-libxrandr-1.5.4-h86ecc28_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/xorg-libxrender-0.9.12-h86ecc28_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/zipp-3.23.0-pyhcf101f3_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/zstd-1.5.7-h85ac4a6_6.conda + - conda: . + build: py314h3ff45e1_0 + - conda: ../cuda_pathfinder + win-64: + - conda: https://conda.anaconda.org/conda-forge/win-64/_openmp_mutex-4.5-2_gnu.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/aom-3.9.1-he0c23c2_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/binutils_impl_win-64-2.45-default_ha84baeb_105.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/bzip2-1.0.8-h0ad9c76_8.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/ca-certificates-2026.1.4-h4c7d964_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/cairo-1.18.4-h477c42c_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/colorama-0.4.6-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/conda-gcc-specs-15.2.0-hd546029_16.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cccl_win-64-13.3.3.3.1-h57928b3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-crt-dev_win-64-13.3.33-h57928b3_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/cuda-cudart-13.3.29-hac47afa_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/cuda-cudart-dev-13.3.29-hac47afa_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart-dev_win-64-13.3.29-hac47afa_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/cuda-cudart-static-13.3.29-hac47afa_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart-static_win-64-13.3.29-hac47afa_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart_win-64-13.3.29-hac47afa_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/cuda-nvrtc-13.3.33-hac47afa_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/cuda-nvvm-13.3.33-h719f0c7_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-nvvm-dev_win-64-13.3.33-h57928b3_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/cuda-nvvm-impl-13.3.33-h2466b09_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/cuda-nvvm-tools-13.3.33-h2466b09_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/cuda-profiler-api-13.3.27-h57928b3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-version-13.3-hcbadf70_3.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/cython-3.2.4-py314h344ed54_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/dav1d-1.2.1-hcfcfb64_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/exceptiongroup-1.3.1-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/ffmpeg-8.0.1-gpl_h74fd8f1_908.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/font-ttf-dejavu-sans-mono-2.37-hab24e00_0.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/noarch/font-ttf-inconsolata-3.000-h77eed37_0.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/noarch/font-ttf-source-code-pro-2.038-h77eed37_0.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/noarch/font-ttf-ubuntu-0.83-h77eed37_3.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/fontconfig-2.15.0-h765892d_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/fonts-conda-ecosystem-1-0.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/noarch/fonts-conda-forge-1-hc364b38_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/freetype-2.14.1-h57928b3_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/fribidi-1.0.16-hfd05255_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/gcc-15.2.0-hd556455_16.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/gcc_impl_win-64-15.2.0-h79c4613_16.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/gdk-pixbuf-2.44.4-h1f5b9c4_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/glslang-16.1.0-h5b34520_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/graphite2-1.3.14-hac47afa_2.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/gxx-15.2.0-hf1b5d6d_16.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/gxx_impl_win-64-15.2.0-h22fd5bf_16.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/harfbuzz-12.3.0-h5a1b470_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/icu-78.1-h637d24d_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/importlib-metadata-8.7.0-pyhe01879c_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/iniconfig-2.3.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/lame-3.100-hcfcfb64_1003.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/win-64/ld_impl_win-64-2.45-default_hfd38196_105.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/lerc-4.0.0-h6470a55_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libblas-3.11.0-5_hf2e6a31_mkl.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libcblas-3.11.0-5_h2a3cdd5_mkl.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libdeflate-1.25-h51727cc_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libexpat-2.7.3-hac47afa_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libffi-3.5.2-h52bdfb6_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libfreetype-2.14.1-h57928b3_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libfreetype6-2.14.1-hdbac1cb_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libgcc-15.2.0-h8ee18e1_16.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/libgcc-devel_win-64-15.2.0-hbb59886_116.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libglib-2.86.3-h0c9aed9_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libgomp-15.2.0-h8ee18e1_16.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libhwloc-2.12.1-default_h4379cf1_1003.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libiconv-1.18-hc1393d2_2.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libintl-0.22.5-h5728263_3.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libjpeg-turbo-3.1.2-hfd05255_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/liblapack-3.11.0-5_hf9ab0e9_mkl.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/liblzma-5.8.1-h2466b09_2.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libmpdec-4.0.0-h2466b09_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libnvfatbin-13.3.29-hac47afa_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libnvjitlink-13.3.33-hac47afa_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libogg-1.3.5-h2466b09_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libopus-1.6-h6a83c73_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libpng-1.6.53-h7351971_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/librsvg-2.60.0-hd5e4115_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libsqlite-3.51.1-hf5d6505_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libstdcxx-15.2.0-hae5796f_16.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/libstdcxx-devel_win-64-15.2.0-h0a72980_116.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libtiff-4.7.1-h8f73337_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libusb-1.0.29-h1839187_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libvorbis-1.3.7-h5112557_2.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libvulkan-loader-1.4.328.1-h477610d_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libwinpthread-12.0.0.r4.gg4f2fc60ca-h57928b3_10.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libxml2-16-2.15.1-h3cfd58e_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libxml2-2.15.1-h779ef1b_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libzlib-1.3.1-h2466b09_2.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/llvm-openmp-21.1.8-h4fa8253_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/m2-conda-epoch-20250515-0_x86_64.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/m2w64-sysroot_win-64-12.0.0.r4.gg4f2fc60ca-hd8ed1ab_10.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/mingw-w64-ucrt-x86_64-crt-git-12.0.0.r4.gg4f2fc60ca-hd8ed1ab_10.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/mingw-w64-ucrt-x86_64-headers-git-12.0.0.r4.gg4f2fc60ca-hd8ed1ab_10.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/mingw-w64-ucrt-x86_64-windows-default-manifest-6.4-he206cdd_7.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/mingw-w64-ucrt-x86_64-winpthreads-git-12.0.0.r4.gg4f2fc60ca-hd8ed1ab_10.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/mkl-2025.3.0-hac47afa_455.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/numpy-2.4.0-py314h06c3c77_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/openh264-2.6.0-hb17fa0b_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/openssl-3.6.0-h725018a_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/packaging-25.0-pyh29332c3_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/pango-1.56.4-h03d888a_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/pcre2-10.47-hd2b5f0e_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/pixman-0.46.4-h5112557_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pluggy-1.6.0-pyhf9edf01_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/py-cpuinfo-9.0.0-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pyglet-2.1.11-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pygments-2.19.2-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pytest-9.0.2-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pytest-benchmark-5.2.3-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pytest-randomly-3.15.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pytest-repeat-0.9.4-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/python-3.14.2-h4b44e0e_100_cp314.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/python_abi-3.14-8_cp314.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/sdl2-2.32.56-h5112557_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/sdl3-3.2.30-h5112557_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/setuptools-80.9.0-pyhff2d567_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/shaderc-2025.5-haa9a63f_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/spirv-tools-2025.4-h49e36cd_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/svt-av1-3.1.2-hac47afa_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/tbb-2022.3.0-hd094cb3_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/tk-8.6.13-h2c6b04d_3.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/tomli-2.3.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/typing_extensions-4.15.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/tzdata-2025c-hc9c84f9_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/ucrt-10.0.26100.0-h57928b3_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/vc-14.3-h41ae7f8_34.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/vc14_runtime-14.44.35208-h818238b_34.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/vcomp14-14.44.35208-h818238b_34.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/vs2015_runtime-14.44.35208-h38c0c73_34.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/x264-1!164.3095-h8ffe710_2.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/win-64/x265-3.5-h2d74725_3.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/noarch/zipp-3.23.0-pyhcf101f3_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/zstd-1.5.7-h534d264_6.conda + - conda: . + build: py314hd7f1909_0 + - conda: ../cuda_pathfinder + default: + channels: + - url: https://conda.anaconda.org/conda-forge/ + options: + pypi-prerelease-mode: if-necessary-or-explicit + packages: + linux-64: + - conda: https://conda.anaconda.org/conda-forge/linux-64/_libgcc_mutex-0.1-conda_forge.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/linux-64/_openmp_mutex-4.5-2_gnu.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/linux-64/alsa-lib-1.2.15.1-hb03c661_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/aom-3.9.1-hac33072_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/attr-2.5.2-h39aace5_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/binutils_impl_linux-64-2.45-default_hfdba357_104.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/bzip2-1.0.8-hda65f42_8.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/ca-certificates-2025.11.12-hbd8a1cb_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cairo-1.18.4-h3394656_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/colorama-0.4.6-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/conda-gcc-specs-15.2.0-h53410ce_16.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cccl_linux-64-12.9.27-ha770c72_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-crt-dev_linux-64-12.9.86-ha770c72_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-cudart-12.9.79-h5888daf_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-cudart-dev-12.9.79-h5888daf_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart-dev_linux-64-12.9.79-h3f2d84a_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-cudart-static-12.9.79-h5888daf_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart-static_linux-64-12.9.79-h3f2d84a_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart_linux-64-12.9.79-h3f2d84a_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-nvrtc-12.9.86-hecca717_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-nvvm-12.9.86-h69a702a_6.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-nvvm-dev_linux-64-12.9.86-ha770c72_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-nvvm-impl-12.9.86-h4bc722e_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-nvvm-tools-12.9.86-h4bc722e_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-profiler-api-12.9.79-h7938cbb_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-version-12.9-h4f385c5_3.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cython-3.2.3-py314h1807b08_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/dav1d-1.2.1-hd590300_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/dbus-1.16.2-h24cb091_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/exceptiongroup-1.3.1-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/ffmpeg-8.0.1-gpl_hb3f9226_906.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/font-ttf-dejavu-sans-mono-2.37-hab24e00_0.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/noarch/font-ttf-inconsolata-3.000-h77eed37_0.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/noarch/font-ttf-source-code-pro-2.038-h77eed37_0.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/noarch/font-ttf-ubuntu-0.83-h77eed37_3.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/fontconfig-2.15.0-h7e30c49_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/fonts-conda-ecosystem-1-0.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/noarch/fonts-conda-forge-1-hc364b38_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/freetype-2.14.1-ha770c72_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/fribidi-1.0.16-hb03c661_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/gcc-15.2.0-h0dff253_16.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/gcc_impl_linux-64-15.2.0-hc5723f1_16.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/gdk-pixbuf-2.44.4-h2b0a6b4_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/glslang-16.1.0-hfd11570_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/gmp-6.3.0-hac33072_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/graphite2-1.3.14-hecca717_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/gxx-15.2.0-h76987e4_16.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/gxx_impl_linux-64-15.2.0-hda75c37_16.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/harfbuzz-12.2.0-h15599e2_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/icu-75.1-he02047a_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/importlib-metadata-8.7.0-pyhe01879c_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/iniconfig-2.3.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/intel-gmmlib-22.9.0-hb700be7_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/intel-media-driver-25.3.4-hecca717_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/kernel-headers_linux-64-4.18.0-he073ed8_9.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/lame-3.100-h166bdaf_1003.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/linux-64/ld_impl_linux-64-2.45-default_hbd61a6d_104.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/lerc-4.0.0-h0aef613_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/level-zero-1.26.2-hb700be7_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libabseil-20250512.1-cxx17_hba17884_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libass-0.17.4-h96ad9f0_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libblas-3.11.0-5_h4a7cf45_openblas.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libcap-2.77-h3ff7636_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libcblas-3.11.0-5_h0358290_openblas.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libcufile-1.14.1.1-hbc026e6_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libdeflate-1.25-h17f619e_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libdrm-2.4.125-hb03c661_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libegl-1.7.0-ha4b6fd6_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libexpat-2.7.3-hecca717_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libffi-3.5.2-h9ec8514_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libflac-1.5.0-he200343_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libfreetype-2.14.1-ha770c72_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libfreetype6-2.14.1-h73754d4_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libgcc-15.2.0-he0feb66_15.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/libgcc-devel_linux-64-15.2.0-hcc6f6b0_116.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libgcc-ng-15.2.0-h69a702a_15.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libgfortran-15.2.0-h69a702a_16.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libgfortran5-15.2.0-h68bc16d_16.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libgl-1.7.0-ha4b6fd6_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libglib-2.86.3-h6548e54_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libglvnd-1.7.0-ha4b6fd6_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libglx-1.7.0-ha4b6fd6_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libgomp-15.2.0-he0feb66_15.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libhwloc-2.12.1-default_hafda6a7_1003.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libiconv-1.18-h3b78370_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libjpeg-turbo-3.1.2-hb03c661_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/liblapack-3.11.0-5_h47877c9_openblas.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/liblzma-5.8.1-hb9d3cd8_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libmpdec-4.0.0-hb9d3cd8_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libnl-3.11.0-hb9d3cd8_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libnvfatbin-12.9.82-hecca717_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libnvjitlink-12.9.86-hecca717_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libogg-1.3.5-hd0c01bc_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libopenblas-0.3.30-pthreads_h94d23a6_4.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-2025.2.0-hb617929_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-auto-batch-plugin-2025.2.0-hed573e4_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-auto-plugin-2025.2.0-hed573e4_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-hetero-plugin-2025.2.0-hd41364c_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-intel-cpu-plugin-2025.2.0-hb617929_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-intel-gpu-plugin-2025.2.0-hb617929_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-intel-npu-plugin-2025.2.0-hb617929_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-ir-frontend-2025.2.0-hd41364c_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-onnx-frontend-2025.2.0-h1862bb8_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-paddle-frontend-2025.2.0-h1862bb8_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-pytorch-frontend-2025.2.0-hecca717_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-tensorflow-frontend-2025.2.0-h0767aad_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-tensorflow-lite-frontend-2025.2.0-hecca717_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libopus-1.5.2-hd0c01bc_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libpciaccess-0.18-hb9d3cd8_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libpng-1.6.53-h421ea60_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libprotobuf-6.31.1-h49aed37_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/librsvg-2.60.0-h61e6d4b_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libsanitizer-15.2.0-h90f66d4_16.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libsndfile-1.2.2-hc7d488a_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libsqlite-3.51.1-h0c1763c_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libstdcxx-15.2.0-h934c35e_15.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/libstdcxx-devel_linux-64-15.2.0-hd446a21_116.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libstdcxx-ng-15.2.0-hdf11a46_15.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libsystemd0-257.10-hd0affe5_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libtiff-4.7.1-h9d88235_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libudev1-257.10-hd0affe5_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libunwind-1.8.3-h65a8314_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/liburing-2.12-hb700be7_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libusb-1.0.29-h73b1eb8_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libuuid-2.41.2-h5347b49_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libva-2.23.0-he1eb515_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libvorbis-1.3.7-h54a6638_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libvpl-2.15.0-h54a6638_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libvpx-1.15.2-hecca717_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libvulkan-loader-1.4.328.1-h5279c79_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libwebp-base-1.6.0-hd42ef1d_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libxcb-1.17.0-h8a09558_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libxkbcommon-1.13.1-hca5e8e5_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libxml2-16-2.15.1-ha9997c6_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libxml2-2.15.1-h26afc86_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libzlib-1.3.1-hb9d3cd8_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/mpg123-1.32.9-hc50e24c_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/ncurses-6.5-h2d0b736_3.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/numpy-2.3.5-py314h2b28147_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/ocl-icd-2.3.3-hb9d3cd8_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/opencl-headers-2025.06.13-h5888daf_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/openh264-2.6.0-hc22cd8d_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/openssl-3.6.0-h26f9b46_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/packaging-25.0-pyh29332c3_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/pango-1.56.4-hadf4263_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/pcre2-10.47-haa7fec5_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/pixman-0.46.4-h54a6638_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pluggy-1.6.0-pyhf9edf01_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/pthread-stubs-0.4-hb9d3cd8_1002.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/pugixml-1.15-h3f63f65_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/pulseaudio-client-17.0-h9a6aba3_3.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/py-cpuinfo-9.0.0-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pyglet-2.1.11-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pygments-2.19.2-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pytest-9.0.2-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pytest-benchmark-5.2.3-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pytest-randomly-3.15.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pytest-repeat-0.9.4-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/python-3.14.1-h32b2ec7_100_cp314.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/python_abi-3.14-8_cp314.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/rdma-core-61.0-h192683f_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/readline-8.2-h8c095d6_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/sdl2-2.32.56-h54a6638_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/sdl3-3.2.28-h3b84278_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/setuptools-80.9.0-pyhff2d567_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/shaderc-2025.5-h3e344bc_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/snappy-1.2.2-h03e3b7b_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/spirv-tools-2025.4-hb700be7_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/svt-av1-3.1.2-hecca717_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/sysroot_linux-64-2.28-h4ee821c_9.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/tbb-2022.3.0-h8d10470_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/tk-8.6.13-noxft_ha0e22de_103.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/tomli-2.3.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/typing_extensions-4.15.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/tzdata-2025b-h78e105d_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/wayland-1.24.0-hd6090a7_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/wayland-protocols-1.47-hd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/x264-1!164.3095-h166bdaf_2.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/linux-64/x265-3.5-h924138e_3.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/linux-64/xkeyboard-config-2.46-hb03c661_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/xorg-libice-1.1.2-hb9d3cd8_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/xorg-libsm-1.2.6-he73a12e_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/xorg-libx11-1.8.12-h4f16b4b_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/xorg-libxau-1.0.12-hb03c661_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/xorg-libxcursor-1.2.3-hb9d3cd8_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/xorg-libxdmcp-1.1.5-hb03c661_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/xorg-libxext-1.3.6-hb9d3cd8_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/xorg-libxfixes-6.0.2-hb03c661_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/xorg-libxrandr-1.5.4-hb9d3cd8_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/xorg-libxrender-0.9.12-hb9d3cd8_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/xorg-libxscrnsaver-1.2.4-hb9d3cd8_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/zipp-3.23.0-pyhcf101f3_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/zstd-1.5.7-hb78ec9c_6.conda + - conda: . + build: py314ha6d028f_0 + - conda: ../cuda_pathfinder + linux-aarch64: + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/_openmp_mutex-4.5-2_gnu.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/alsa-lib-1.2.15.1-he30d5cf_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/aom-3.9.1-hcccb83c_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/arm-variant-1.2.0-sbsa.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/attr-2.5.1-h4e544f5_1.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/binutils_impl_linux-aarch64-2.45-default_h5f4c503_104.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/bzip2-1.0.8-h4777abc_8.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/ca-certificates-2025.11.12-hbd8a1cb_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/cairo-1.18.4-h83712da_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/colorama-0.4.6-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cccl_linux-aarch64-12.9.27-h579c4fd_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-crt-dev_linux-aarch64-12.9.86-h579c4fd_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/cuda-cudart-12.9.79-h3ae8b8a_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/cuda-cudart-dev-12.9.79-h3ae8b8a_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart-dev_linux-aarch64-12.9.79-h3ae8b8a_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/cuda-cudart-static-12.9.79-h3ae8b8a_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart-static_linux-aarch64-12.9.79-h3ae8b8a_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart_linux-aarch64-12.9.79-h3ae8b8a_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/cuda-nvrtc-12.9.86-h8f3c8d4_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/cuda-nvvm-12.9.86-he9431aa_106.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-nvvm-dev_linux-aarch64-12.9.86-h579c4fd_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/cuda-nvvm-impl-12.9.86-h7b14b0b_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/cuda-nvvm-tools-12.9.86-h7b14b0b_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/cuda-profiler-api-12.9.79-h16bee8c_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-version-12.9-h4f385c5_3.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/cython-3.2.3-py314h4c416a3_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/dav1d-1.2.1-h31becfc_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/dbus-1.16.2-h70963c4_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/exceptiongroup-1.3.1-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/ffmpeg-8.0.1-gpl_h936a714_906.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/font-ttf-dejavu-sans-mono-2.37-hab24e00_0.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/noarch/font-ttf-inconsolata-3.000-h77eed37_0.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/noarch/font-ttf-source-code-pro-2.038-h77eed37_0.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/noarch/font-ttf-ubuntu-0.83-h77eed37_3.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/fontconfig-2.15.0-h8dda3cd_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/fonts-conda-ecosystem-1-0.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/noarch/fonts-conda-forge-1-hc364b38_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/freetype-2.14.1-h8af1aa0_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/fribidi-1.0.16-he30d5cf_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/gcc-15.2.0-h24a549f_16.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/gcc_impl_linux-aarch64-15.2.0-habb1d5c_16.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/gdk-pixbuf-2.44.4-h90308e0_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/glslang-16.1.0-hd1da3a6_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/gmp-6.3.0-h0a1ffab_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/graphite2-1.3.14-hfae3067_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/gxx-15.2.0-ha384071_16.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/gxx_impl_linux-aarch64-15.2.0-h03e2352_16.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/harfbuzz-12.2.0-he4899c9_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/icu-75.1-hf9b3779_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/importlib-metadata-8.7.0-pyhe01879c_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/iniconfig-2.3.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/kernel-headers_linux-aarch64-4.18.0-h05a177a_9.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/lame-3.100-h4e544f5_1003.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/ld_impl_linux-aarch64-2.45-default_h1979696_104.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/lerc-4.0.0-hfdc4d58_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libabseil-20250512.1-cxx17_h201e9ed_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libass-0.17.4-hcfe818d_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libblas-3.11.0-5_haddc8a3_openblas.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libcap-2.77-h68e9139_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libcblas-3.11.0-5_hd72aa62_openblas.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libcufile-1.14.1.1-had8bf56_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libdeflate-1.25-h1af38f5_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libdrm-2.4.125-he30d5cf_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libegl-1.7.0-hd24410f_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libexpat-2.7.3-hfae3067_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libffi-3.5.2-hd65408f_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libflac-1.5.0-he9c94f4_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libfreetype-2.14.1-h8af1aa0_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libfreetype6-2.14.1-hdae7a39_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libgcc-15.2.0-h8acb6b2_15.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/libgcc-devel_linux-aarch64-15.2.0-h55c397f_116.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libgcc-ng-15.2.0-he9431aa_15.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libgfortran-15.2.0-he9431aa_16.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libgfortran5-15.2.0-h1b7bec0_16.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libgl-1.7.0-hd24410f_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libglib-2.86.3-hf53f6bf_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libglvnd-1.7.0-hd24410f_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libglx-1.7.0-hd24410f_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libgomp-15.2.0-h8acb6b2_15.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libhwloc-2.12.1-default_ha470c98_1003.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libiconv-1.18-h90929bb_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libjpeg-turbo-3.1.2-he30d5cf_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/liblapack-3.11.0-5_h88aeb00_openblas.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/liblzma-5.8.1-h86ecc28_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libmpdec-4.0.0-h86ecc28_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libnl-3.11.0-h86ecc28_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libnvfatbin-12.9.82-h8f3c8d4_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libnvjitlink-12.9.86-h8f3c8d4_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libogg-1.3.5-h86ecc28_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenblas-0.3.30-pthreads_h9d3fd7e_4.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenvino-2025.2.0-hcd21e76_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenvino-arm-cpu-plugin-2025.2.0-hcd21e76_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenvino-auto-batch-plugin-2025.2.0-h3890994_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenvino-auto-plugin-2025.2.0-h3890994_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenvino-hetero-plugin-2025.2.0-he07c6df_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenvino-ir-frontend-2025.2.0-he07c6df_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenvino-onnx-frontend-2025.2.0-h07d5dce_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenvino-paddle-frontend-2025.2.0-h07d5dce_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenvino-pytorch-frontend-2025.2.0-hfae3067_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenvino-tensorflow-frontend-2025.2.0-h38473e3_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenvino-tensorflow-lite-frontend-2025.2.0-hfae3067_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopus-1.5.2-h86ecc28_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libpciaccess-0.18-h86ecc28_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libpng-1.6.53-h1abf092_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libprotobuf-6.31.1-h2cf3c76_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/librsvg-2.60.0-h8171147_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libsanitizer-15.2.0-he19c465_16.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libsndfile-1.2.2-h30591a0_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libsqlite-3.51.1-h022381a_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libstdcxx-15.2.0-hef695bb_15.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/libstdcxx-devel_linux-aarch64-15.2.0-ha7b1723_116.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libstdcxx-ng-15.2.0-hdbbeba8_15.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libsystemd0-257.10-hf9559e3_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libtiff-4.7.1-hdb009f0_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libudev1-257.10-hf9559e3_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libunwind-1.8.3-h6470e1d_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/liburing-2.12-hfefdfc9_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libusb-1.0.29-h06eaf92_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libuuid-2.41.2-h1022ec0_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libvorbis-1.3.7-h7ac5ae9_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libvpx-1.15.2-hfae3067_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libvulkan-loader-1.4.328.1-h8b8848b_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libwebp-base-1.6.0-ha2e29f5_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libxcb-1.17.0-h262b8f6_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libxkbcommon-1.13.1-h3c6a4c8_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libxml2-16-2.15.1-h8591a01_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libxml2-2.15.1-h788dabe_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libzlib-1.3.1-h86ecc28_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/mpg123-1.32.9-h65af167_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/ncurses-6.5-ha32ae93_3.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/numpy-2.3.5-py314haac167e_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/openh264-2.6.0-h0564a2a_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/openssl-3.6.0-h8e36d6e_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/packaging-25.0-pyh29332c3_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/pango-1.56.4-he55ef5b_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/pcre2-10.47-hf841c20_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/pixman-0.46.4-h7ac5ae9_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pluggy-1.6.0-pyhf9edf01_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/pthread-stubs-0.4-h86ecc28_1002.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/pugixml-1.15-h6ef32b0_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/pulseaudio-client-17.0-hcf98165_3.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/py-cpuinfo-9.0.0-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pyglet-2.1.11-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pygments-2.19.2-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pytest-9.0.2-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pytest-benchmark-5.2.3-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pytest-randomly-3.15.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pytest-repeat-0.9.4-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/python-3.14.1-hb06a95a_100_cp314.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/python_abi-3.14-8_cp314.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/rdma-core-61.0-h1f0f388_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/readline-8.2-h8382b9d_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/sdl2-2.32.56-h7ac5ae9_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/sdl3-3.2.28-h3d544e7_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/setuptools-80.9.0-pyhff2d567_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/shaderc-2025.5-h8c88b8f_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/snappy-1.2.2-he774c54_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/spirv-tools-2025.4-hfefdfc9_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/svt-av1-3.1.2-hfae3067_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/sysroot_linux-aarch64-2.28-h585391f_9.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/tbb-2022.3.0-h0eac15c_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/tk-8.6.13-noxft_h561c983_103.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/tomli-2.3.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/typing_extensions-4.15.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/tzdata-2025b-h78e105d_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/wayland-1.24.0-h4f8a99f_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/x264-1!164.3095-h4e544f5_2.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/x265-3.5-hdd96247_3.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/xkeyboard-config-2.46-he30d5cf_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/xorg-libice-1.1.2-h86ecc28_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/xorg-libsm-1.2.6-h0808dbd_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/xorg-libx11-1.8.12-hca56bd8_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/xorg-libxau-1.0.12-he30d5cf_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/xorg-libxcursor-1.2.3-h86ecc28_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/xorg-libxdmcp-1.1.5-he30d5cf_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/xorg-libxext-1.3.6-h57736b2_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/xorg-libxfixes-6.0.2-he30d5cf_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/xorg-libxrandr-1.5.4-h86ecc28_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/xorg-libxrender-0.9.12-h86ecc28_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/zipp-3.23.0-pyhcf101f3_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/zstd-1.5.7-h85ac4a6_6.conda + - conda: . + build: py314he8946ed_0 + - conda: ../cuda_pathfinder + win-64: + - conda: https://conda.anaconda.org/conda-forge/win-64/_openmp_mutex-4.5-2_gnu.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/aom-3.9.1-he0c23c2_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/binutils_impl_win-64-2.45-default_ha84baeb_104.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/bzip2-1.0.8-h0ad9c76_8.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/ca-certificates-2025.11.12-h4c7d964_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/cairo-1.18.4-h5782bbf_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/colorama-0.4.6-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/conda-gcc-specs-15.2.0-hd546029_16.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cccl_win-64-13.3.3.3.1-h57928b3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-crt-dev_win-64-13.3.33-h57928b3_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/cuda-cudart-13.3.29-hac47afa_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/cuda-cudart-dev-13.3.29-hac47afa_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart-dev_win-64-13.3.29-hac47afa_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/cuda-cudart-static-13.3.29-hac47afa_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart-static_win-64-13.3.29-hac47afa_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart_win-64-13.3.29-hac47afa_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/cuda-nvrtc-13.3.33-hac47afa_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/cuda-nvvm-13.3.33-h719f0c7_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-nvvm-dev_win-64-13.3.33-h57928b3_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/cuda-nvvm-impl-13.3.33-h2466b09_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/cuda-nvvm-tools-13.3.33-h2466b09_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/cuda-profiler-api-13.3.27-h57928b3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-version-13.3-hcbadf70_3.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/cython-3.2.3-py314h344ed54_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/dav1d-1.2.1-hcfcfb64_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/exceptiongroup-1.3.1-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/ffmpeg-8.0.1-gpl_h74fd8f1_907.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/font-ttf-dejavu-sans-mono-2.37-hab24e00_0.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/noarch/font-ttf-inconsolata-3.000-h77eed37_0.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/noarch/font-ttf-source-code-pro-2.038-h77eed37_0.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/noarch/font-ttf-ubuntu-0.83-h77eed37_3.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/fontconfig-2.15.0-h765892d_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/fonts-conda-ecosystem-1-0.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/noarch/fonts-conda-forge-1-hc364b38_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/freetype-2.14.1-h57928b3_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/fribidi-1.0.16-hfd05255_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/gcc-15.2.0-hd556455_16.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/gcc_impl_win-64-15.2.0-h79c4613_16.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/gdk-pixbuf-2.44.4-h1f5b9c4_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/glslang-16.1.0-h5b34520_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/graphite2-1.3.14-hac47afa_2.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/gxx-15.2.0-hf1b5d6d_16.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/gxx_impl_win-64-15.2.0-h22fd5bf_16.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/harfbuzz-12.2.0-h5f2951f_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/icu-75.1-he0c23c2_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/importlib-metadata-8.7.0-pyhe01879c_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/iniconfig-2.3.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/lame-3.100-hcfcfb64_1003.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/win-64/ld_impl_win-64-2.45-default_hfd38196_104.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/lerc-4.0.0-h6470a55_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libblas-3.11.0-5_hf2e6a31_mkl.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libcblas-3.11.0-5_h2a3cdd5_mkl.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libdeflate-1.25-h51727cc_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libexpat-2.7.3-hac47afa_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libffi-3.5.2-h52bdfb6_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libfreetype-2.14.1-h57928b3_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libfreetype6-2.14.1-hdbac1cb_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libgcc-15.2.0-h8ee18e1_16.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/libgcc-devel_win-64-15.2.0-hbb59886_116.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libglib-2.86.3-h0c9aed9_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libgomp-15.2.0-h8ee18e1_16.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libhwloc-2.12.1-default_h4379cf1_1003.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libiconv-1.18-hc1393d2_2.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libintl-0.22.5-h5728263_3.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libjpeg-turbo-3.1.2-hfd05255_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/liblapack-3.11.0-5_hf9ab0e9_mkl.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/liblzma-5.8.1-h2466b09_2.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libmpdec-4.0.0-h2466b09_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libnvfatbin-13.3.29-hac47afa_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libnvjitlink-13.3.33-hac47afa_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libogg-1.3.5-h2466b09_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libopus-1.6-h6a83c73_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libpng-1.6.53-h7351971_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/librsvg-2.60.0-hd5e4115_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libsqlite-3.51.1-hf5d6505_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libstdcxx-15.2.0-hae5796f_16.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/libstdcxx-devel_win-64-15.2.0-h0a72980_116.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libtiff-4.7.1-h8f73337_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libusb-1.0.29-h1839187_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libvorbis-1.3.7-h5112557_2.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libvulkan-loader-1.4.328.1-h477610d_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libwinpthread-12.0.0.r4.gg4f2fc60ca-h57928b3_10.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libxml2-16-2.15.1-h06f855e_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libxml2-2.15.1-ha29bfb0_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libzlib-1.3.1-h2466b09_2.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/llvm-openmp-21.1.8-h4fa8253_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/m2-conda-epoch-20250515-0_x86_64.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/m2w64-sysroot_win-64-12.0.0.r4.gg4f2fc60ca-hd8ed1ab_10.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/mingw-w64-ucrt-x86_64-crt-git-12.0.0.r4.gg4f2fc60ca-hd8ed1ab_10.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/mingw-w64-ucrt-x86_64-headers-git-12.0.0.r4.gg4f2fc60ca-hd8ed1ab_10.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/mingw-w64-ucrt-x86_64-windows-default-manifest-6.4-he206cdd_7.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/mingw-w64-ucrt-x86_64-winpthreads-git-12.0.0.r4.gg4f2fc60ca-hd8ed1ab_10.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/mkl-2025.3.0-hac47afa_454.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/numpy-2.3.5-py314h06c3c77_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/openh264-2.6.0-hb17fa0b_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/openssl-3.6.0-h725018a_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/packaging-25.0-pyh29332c3_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/pango-1.56.4-h03d888a_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/pcre2-10.47-hd2b5f0e_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/pixman-0.46.4-h5112557_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pluggy-1.6.0-pyhf9edf01_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/py-cpuinfo-9.0.0-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pyglet-2.1.11-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pygments-2.19.2-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pytest-9.0.2-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pytest-benchmark-5.2.3-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pytest-randomly-3.15.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pytest-repeat-0.9.4-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/python-3.14.1-h4b44e0e_100_cp314.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/python_abi-3.14-8_cp314.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/sdl2-2.32.56-h5112557_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/sdl3-3.2.28-h5112557_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/setuptools-80.9.0-pyhff2d567_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/shaderc-2025.5-haa9a63f_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/spirv-tools-2025.4-h49e36cd_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/svt-av1-3.1.2-hac47afa_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/tbb-2022.3.0-hd094cb3_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/tk-8.6.13-h2c6b04d_3.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/tomli-2.3.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/typing_extensions-4.15.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/tzdata-2025b-h78e105d_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/ucrt-10.0.26100.0-h57928b3_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/vc-14.3-h2b53caa_32.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/vc14_runtime-14.44.35208-h818238b_32.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/vcomp14-14.44.35208-h818238b_32.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/vs2015_runtime-14.44.35208-h38c0c73_32.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/x264-1!164.3095-h8ffe710_2.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/win-64/x265-3.5-h2d74725_3.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/noarch/zipp-3.23.0-pyhcf101f3_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/zstd-1.5.7-h534d264_6.conda + - conda: . + build: py314hd7f1909_0 + - conda: ../cuda_pathfinder + docs: + channels: + - url: https://conda.anaconda.org/conda-forge/ + indexes: + - https://pypi.org/simple + options: + pypi-prerelease-mode: if-necessary-or-explicit + packages: + linux-64: + - conda: https://conda.anaconda.org/conda-forge/linux-64/_openmp_mutex-4.5-20_gnu.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/_python_abi3_support-1.0-hd8ed1ab_2.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/accessible-pygments-0.0.5-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/alabaster-1.0.0-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/apeye-1.4.1-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/apeye-core-1.1.5-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/asttokens-3.0.1-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/attrs-26.1.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/autodocsumm-0.2.15-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/babel-2.18.0-pyhcf101f3_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/backports.zstd-1.3.0-py312h90b7ffd_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/beautifulsoup4-4.14.3-pyha770c72_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/brotli-python-1.2.0-py312hdb49522_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/bzip2-1.0.8-hda65f42_9.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/ca-certificates-2026.2.25-hbd8a1cb_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cachecontrol-0.14.3-pyha770c72_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/certifi-2026.2.25-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/charset-normalizer-3.4.7-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/click-8.3.1-pyh8f84b5b_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/colorama-0.4.6-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/comm-0.2.3-pyhe01879c_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cpython-3.12.13-py312hd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cssutils-2.11.1-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-bindings-13.2.0-py312hf79963d_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-nvrtc-13.3.33-hecca717_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-nvvm-impl-13.3.33-h4bc722e_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-pathfinder-1.5.2-pyhc364b38_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-version-13.3-hcbadf70_3.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/cython-3.2.4-py312h68e6be4_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/debugpy-1.8.20-py312h8285ef7_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/decorator-5.2.1-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/dict2css-0.3.0.post1-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/docutils-0.21.2-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/domdf-python-tools-3.10.0-pyhff2d567_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/enum_tools-0.13.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/exceptiongroup-1.3.1-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/executing-2.2.1-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/filelock-3.25.2-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/greenlet-3.3.2-py312h8285ef7_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/h2-4.3.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/hpack-4.1.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/html5lib-1.1-pyhd8ed1ab_2.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/hyperframe-6.1.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/icu-78.3-h33c6efd_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/idna-3.11-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/imagesize-2.0.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/importlib-metadata-8.8.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/importlib-resources-6.5.2-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/importlib_resources-6.5.2-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/iniconfig-2.3.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/ipykernel-7.2.0-pyha191276_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/ipython-9.12.0-pyhecfbec7_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/ipython_pygments_lexers-1.1.1-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/jedi-0.19.2-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/jinja2-3.1.6-pyhcf101f3_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/jsonschema-4.26.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/jsonschema-specifications-2025.9.1-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/jupyter-cache-1.0.1-pyhff2d567_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/jupyter_client-8.8.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/jupyter_core-5.9.1-pyhc90fa1f_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/keyutils-1.6.3-hb9d3cd8_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/krb5-1.22.2-ha1258a1_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/ld_impl_linux-64-2.45.1-default_hbd61a6d_102.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libblas-3.11.0-6_h4a7cf45_openblas.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libcap-2.77-hd0affe5_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libcblas-3.11.0-6_h0358290_openblas.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libcufile-1.18.0.66-h85c024f_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libedit-3.1.20250104-pl5321h7949ede_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libexpat-2.7.5-hecca717_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libffi-3.5.2-h3435931_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libgcc-15.2.0-he0feb66_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libgcc-ng-15.2.0-h69a702a_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libgfortran-15.2.0-h69a702a_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libgfortran5-15.2.0-h68bc16d_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libgomp-15.2.0-he0feb66_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/liblapack-3.11.0-6_h47877c9_openblas.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/liblzma-5.8.2-hb03c661_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libnl-3.11.0-hb9d3cd8_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libnsl-2.0.1-hb9d3cd8_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libnvjitlink-13.3.33-hecca717_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libopenblas-0.3.32-pthreads_h94d23a6_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libsodium-1.0.21-h280c20c_3.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libsqlite-3.52.0-hf4e2dac_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libstdcxx-15.2.0-h934c35e_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libsystemd0-257.13-hd0affe5_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libudev1-257.13-hd0affe5_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libuuid-2.42-h5347b49_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libxcrypt-4.4.36-hd590300_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libzlib-1.3.2-h25fd6f3_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/make-4.4.1-hb9d3cd8_2.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/markdown-it-py-4.0.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/markupsafe-3.0.3-py312h8a5da7c_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/matplotlib-inline-0.2.1-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/mdit-py-plugins-0.5.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/mdurl-0.1.2-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/more-itertools-11.0.1-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/msgpack-python-1.1.2-py312hd9148b4_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/mypy_extensions-1.1.0-pyha770c72_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/myst-nb-1.4.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/myst-parser-5.0.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/natsort-8.4.0-pyhcf101f3_2.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/nbclient-0.10.4-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/nbformat-5.10.4-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/ncurses-6.5-h2d0b736_3.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/nest-asyncio-1.6.0-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/numpy-2.4.3-py312h33ff503_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/numpydoc-1.10.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/openssl-3.6.1-h35e630c_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/packaging-26.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/parso-0.8.6-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pexpect-4.9.0-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pip-26.0.1-pyh8b19718_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/platformdirs-4.9.4-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pluggy-1.6.0-pyhf9edf01_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/prompt-toolkit-3.0.52-pyha770c72_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/psutil-7.2.2-py312h5253ce2_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/ptyprocess-0.7.0-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pure_eval-0.2.3-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pyclibrary-0.2.2-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pydata-sphinx-theme-0.17.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pygments-2.20.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pyparsing-3.3.2-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pysocks-1.7.1-pyha55dd90_7.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pytest-9.0.2-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/python-3.12.13-hd63d673_0_cpython.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/python-dateutil-2.9.0.post0-pyhe01879c_2.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/python-fastjsonschema-2.21.2-pyhe01879c_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/python-gil-3.12.13-hd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/python_abi-3.12-8_cp312.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/pyyaml-6.0.3-py312h8a5da7c_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/pyzmq-27.1.0-py312hda471dd_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/rdma-core-61.0-h192683f_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/readline-8.3-h853b02a_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/referencing-0.37.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/requests-2.33.1-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/rpds-py-0.30.0-py312h868fb18_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/ruamel.yaml-0.19.1-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/ruamel.yaml.clib-0.2.15-py312h5253ce2_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/scipy-1.17.1-py312h54fa4ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/setuptools-82.0.1-pyh332efcf_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/six-1.17.0-pyhe01879c_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/snowballstemmer-3.0.1-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/soupsieve-2.8.3-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/sphinx-8.1.3-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/sphinx-autodoc-typehints-3.0.1-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/sphinx-copybutton-0.5.2-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/sphinx-jinja2-compat-0.4.1-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/sphinx-prompt-1.10.1-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/sphinx-tabs-3.4.1-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/sphinx-toolbox-4.1.2-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/sphinxcontrib-applehelp-2.0.0-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/sphinxcontrib-devhelp-2.0.0-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/sphinxcontrib-htmlhelp-2.1.0-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/sphinxcontrib-jsmath-1.0.1-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/sphinxcontrib-qthelp-2.0.0-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/sphinxcontrib-serializinghtml-1.1.10-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/sqlalchemy-2.0.49-py312h5253ce2_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/stack_data-0.6.3-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/tabulate-0.10.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/tk-8.6.13-noxft_h366c992_103.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/tomli-2.4.1-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/tornado-6.5.5-py312h4c3975b_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/traitlets-5.14.3-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/typing-extensions-4.15.0-h396c80c_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/typing_extensions-4.15.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/typing_inspect-0.9.0-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/tzdata-2025c-hc9c84f9_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/urllib3-2.6.3-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/wcwidth-0.6.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/webencodings-0.5.1-pyhd8ed1ab_3.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/wheel-0.46.3-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/yaml-0.2.5-h280c20c_3.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/zeromq-4.3.5-h41580af_10.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/zipp-3.23.0-pyhcf101f3_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/zstd-1.5.7-hb78ec9c_6.conda + - pypi: https://files.pythonhosted.org/packages/8c/79/017fab2f7167a9a9795665f894d04f77aafceca80821b51589bb4b23ff5c/nvidia_sphinx_theme-0.0.9.post1-py3-none-any.whl + linux-aarch64: + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/_openmp_mutex-4.5-20_gnu.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/_python_abi3_support-1.0-hd8ed1ab_2.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/accessible-pygments-0.0.5-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/alabaster-1.0.0-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/apeye-1.4.1-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/apeye-core-1.1.5-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/arm-variant-1.2.0-sbsa.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/asttokens-3.0.1-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/attrs-26.1.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/autodocsumm-0.2.15-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/babel-2.18.0-pyhcf101f3_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/backports.zstd-1.3.0-py312h3d8e7d4_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/beautifulsoup4-4.14.3-pyha770c72_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/brotli-python-1.2.0-py312hac7b6a9_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/bzip2-1.0.8-h4777abc_9.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/ca-certificates-2026.2.25-hbd8a1cb_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cachecontrol-0.14.3-pyha770c72_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/certifi-2026.2.25-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/charset-normalizer-3.4.7-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/click-8.3.1-pyh8f84b5b_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/colorama-0.4.6-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/comm-0.2.3-pyhe01879c_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cpython-3.12.13-py312hd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cssutils-2.11.1-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/cuda-bindings-13.2.0-py312hdc0efb6_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/cuda-nvrtc-13.3.33-h8f3c8d4_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/cuda-nvvm-impl-13.3.33-h7b14b0b_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-pathfinder-1.5.2-pyhc364b38_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-version-13.3-hcbadf70_3.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/cython-3.2.4-py312he940de5_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/debugpy-1.8.20-py312hf55c4e8_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/decorator-5.2.1-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/dict2css-0.3.0.post1-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/docutils-0.21.2-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/domdf-python-tools-3.10.0-pyhff2d567_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/enum_tools-0.13.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/exceptiongroup-1.3.1-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/executing-2.2.1-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/filelock-3.25.2-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/greenlet-3.3.2-py312hf55c4e8_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/h2-4.3.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/hpack-4.1.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/html5lib-1.1-pyhd8ed1ab_2.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/hyperframe-6.1.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/icu-78.3-hcab7f73_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/idna-3.11-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/imagesize-2.0.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/importlib-metadata-8.8.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/importlib-resources-6.5.2-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/importlib_resources-6.5.2-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/iniconfig-2.3.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/ipykernel-7.2.0-pyha191276_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/ipython-9.12.0-pyhecfbec7_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/ipython_pygments_lexers-1.1.1-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/jedi-0.19.2-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/jinja2-3.1.6-pyhcf101f3_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/jsonschema-4.26.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/jsonschema-specifications-2025.9.1-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/jupyter-cache-1.0.1-pyhff2d567_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/jupyter_client-8.8.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/jupyter_core-5.9.1-pyhc90fa1f_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/keyutils-1.6.3-h86ecc28_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/krb5-1.22.2-hfd895c2_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/ld_impl_linux-aarch64-2.45.1-default_h1979696_102.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libblas-3.11.0-6_haddc8a3_openblas.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libcap-2.77-hf9559e3_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libcblas-3.11.0-6_hd72aa62_openblas.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libcufile-1.18.0.66-h4243460_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libedit-3.1.20250104-pl5321h976ea20_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libexpat-2.7.5-hfae3067_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libffi-3.5.2-h376a255_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libgcc-15.2.0-h8acb6b2_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libgcc-ng-15.2.0-he9431aa_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libgfortran-15.2.0-he9431aa_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libgfortran5-15.2.0-h1b7bec0_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libgomp-15.2.0-h8acb6b2_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/liblapack-3.11.0-6_h88aeb00_openblas.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/liblzma-5.8.2-he30d5cf_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libnl-3.11.0-h86ecc28_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libnsl-2.0.1-h86ecc28_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libnvjitlink-13.3.33-h8f3c8d4_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenblas-0.3.32-pthreads_h9d3fd7e_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libsodium-1.0.21-h80f16a2_3.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libsqlite-3.52.0-h10b116e_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libstdcxx-15.2.0-hef695bb_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libsystemd0-257.13-hf9559e3_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libudev1-257.13-hf9559e3_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libuuid-2.42-h1022ec0_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libxcrypt-4.4.36-h31becfc_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libzlib-1.3.2-hdc9db2a_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/make-4.4.1-h2a6d0cb_2.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/markdown-it-py-4.0.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/markupsafe-3.0.3-py312hd077ced_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/matplotlib-inline-0.2.1-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/mdit-py-plugins-0.5.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/mdurl-0.1.2-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/more-itertools-11.0.1-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/msgpack-python-1.1.2-py312h4f740d2_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/mypy_extensions-1.1.0-pyha770c72_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/myst-nb-1.4.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/myst-parser-5.0.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/natsort-8.4.0-pyhcf101f3_2.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/nbclient-0.10.4-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/nbformat-5.10.4-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/ncurses-6.5-ha32ae93_3.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/nest-asyncio-1.6.0-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/numpy-2.4.3-py312h6615c27_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/numpydoc-1.10.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/openssl-3.6.1-h546c87b_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/packaging-26.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/parso-0.8.6-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pexpect-4.9.0-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pip-26.0.1-pyh8b19718_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/platformdirs-4.9.4-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pluggy-1.6.0-pyhf9edf01_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/prompt-toolkit-3.0.52-pyha770c72_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/psutil-7.2.2-py312hd41f8a7_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/ptyprocess-0.7.0-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pure_eval-0.2.3-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pyclibrary-0.2.2-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pydata-sphinx-theme-0.17.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pygments-2.20.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pyparsing-3.3.2-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pysocks-1.7.1-pyha55dd90_7.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pytest-9.0.2-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/python-3.12.13-h91f4b29_0_cpython.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/python-dateutil-2.9.0.post0-pyhe01879c_2.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/python-fastjsonschema-2.21.2-pyhe01879c_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/python-gil-3.12.13-hd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/python_abi-3.12-8_cp312.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/pyyaml-6.0.3-py312ha4530ae_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/pyzmq-27.1.0-py312hdf0a211_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/rdma-core-61.0-h1f0f388_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/readline-8.3-hb682ff5_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/referencing-0.37.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/requests-2.33.1-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/rpds-py-0.30.0-py312h75d7d99_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/ruamel.yaml-0.19.1-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/ruamel.yaml.clib-0.2.15-py312hd41f8a7_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/scipy-1.17.1-py312he5b0e10_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/setuptools-82.0.1-pyh332efcf_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/six-1.17.0-pyhe01879c_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/snowballstemmer-3.0.1-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/soupsieve-2.8.3-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/sphinx-8.1.3-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/sphinx-autodoc-typehints-3.0.1-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/sphinx-copybutton-0.5.2-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/sphinx-jinja2-compat-0.4.1-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/sphinx-prompt-1.10.1-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/sphinx-tabs-3.4.1-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/sphinx-toolbox-4.1.2-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/sphinxcontrib-applehelp-2.0.0-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/sphinxcontrib-devhelp-2.0.0-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/sphinxcontrib-htmlhelp-2.1.0-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/sphinxcontrib-jsmath-1.0.1-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/sphinxcontrib-qthelp-2.0.0-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/sphinxcontrib-serializinghtml-1.1.10-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/sqlalchemy-2.0.49-py312h2fc9c67_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/stack_data-0.6.3-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/tabulate-0.10.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/tk-8.6.13-noxft_h0dc03b3_103.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/tomli-2.4.1-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/tornado-6.5.5-py312hefbd42c_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/traitlets-5.14.3-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/typing-extensions-4.15.0-h396c80c_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/typing_extensions-4.15.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/typing_inspect-0.9.0-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/tzdata-2025c-hc9c84f9_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/urllib3-2.6.3-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/wcwidth-0.6.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/webencodings-0.5.1-pyhd8ed1ab_3.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/wheel-0.46.3-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/yaml-0.2.5-h80f16a2_3.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/zeromq-4.3.5-hc0523f8_10.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/zipp-3.23.0-pyhcf101f3_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/zstd-1.5.7-h85ac4a6_6.conda + - pypi: https://files.pythonhosted.org/packages/8c/79/017fab2f7167a9a9795665f894d04f77aafceca80821b51589bb4b23ff5c/nvidia_sphinx_theme-0.0.9.post1-py3-none-any.whl + win-64: + - conda: https://conda.anaconda.org/conda-forge/win-64/_openmp_mutex-4.5-20_gnu.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/_python_abi3_support-1.0-hd8ed1ab_2.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/accessible-pygments-0.0.5-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/alabaster-1.0.0-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/apeye-1.4.1-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/apeye-core-1.1.5-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/asttokens-3.0.1-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/attrs-26.1.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/autodocsumm-0.2.15-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/babel-2.18.0-pyhcf101f3_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/backports.zstd-1.3.0-py312h06d0912_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/beautifulsoup4-4.14.3-pyha770c72_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/brotli-python-1.2.0-py312hc6d9e41_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/bzip2-1.0.8-h0ad9c76_9.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/ca-certificates-2026.2.25-h4c7d964_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cachecontrol-0.14.3-pyha770c72_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/certifi-2026.2.25-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/charset-normalizer-3.4.7-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/click-8.3.1-pyha7b4d00_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/colorama-0.4.6-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/comm-0.2.3-pyhe01879c_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cpython-3.12.13-py312hd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cssutils-2.11.1-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/cuda-bindings-13.2.0-py312hc128f0a_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/cuda-nvrtc-13.3.33-hac47afa_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/cuda-nvvm-impl-13.3.33-h2466b09_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-pathfinder-1.5.2-pyhc364b38_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/cuda-version-13.3-hcbadf70_3.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/cython-3.2.4-py312hd245ac3_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/debugpy-1.8.20-py312ha1a9051_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/decorator-5.2.1-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/dict2css-0.3.0.post1-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/docutils-0.21.2-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/domdf-python-tools-3.10.0-pyhff2d567_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/enum_tools-0.13.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/exceptiongroup-1.3.1-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/executing-2.2.1-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/filelock-3.25.2-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/greenlet-3.3.2-py312ha1a9051_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/h2-4.3.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/hpack-4.1.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/html5lib-1.1-pyhd8ed1ab_2.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/hyperframe-6.1.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/idna-3.11-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/imagesize-2.0.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/importlib-metadata-8.8.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/importlib-resources-6.5.2-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/importlib_resources-6.5.2-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/iniconfig-2.3.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/ipykernel-7.2.0-pyh6dadd2b_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/ipython-9.12.0-pyhccfa634_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/ipython_pygments_lexers-1.1.1-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/jedi-0.19.2-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/jinja2-3.1.6-pyhcf101f3_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/jsonschema-4.26.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/jsonschema-specifications-2025.9.1-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/jupyter-cache-1.0.1-pyhff2d567_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/jupyter_client-8.8.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/jupyter_core-5.9.1-pyh6dadd2b_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/krb5-1.22.2-h0ea6238_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libblas-3.11.0-6_hf2e6a31_mkl.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libcblas-3.11.0-6_h2a3cdd5_mkl.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libexpat-2.7.5-hac47afa_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libffi-3.5.2-h3d046cb_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libgcc-15.2.0-h8ee18e1_18.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libgomp-15.2.0-h8ee18e1_18.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libhwloc-2.12.2-default_h4379cf1_1000.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libiconv-1.18-hc1393d2_2.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/liblapack-3.11.0-6_hf9ab0e9_mkl.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/liblzma-5.8.2-hfd05255_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libnvjitlink-13.3.33-hac47afa_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libsodium-1.0.21-h6a83c73_3.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libsqlite-3.52.0-hf5d6505_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libwinpthread-12.0.0.r4.gg4f2fc60ca-h57928b3_10.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libxml2-16-2.15.2-h692994f_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libxml2-2.15.2-h5d26750_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libzlib-1.3.2-hfd05255_2.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/llvm-openmp-22.1.2-h4fa8253_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/make-4.4.1-h0e40799_2.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/markdown-it-py-4.0.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/markupsafe-3.0.3-py312h05f76fc_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/matplotlib-inline-0.2.1-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/mdit-py-plugins-0.5.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/mdurl-0.1.2-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/mkl-2025.3.1-hac47afa_11.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/more-itertools-11.0.1-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/msgpack-python-1.1.2-py312hf90b1b7_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/mypy_extensions-1.1.0-pyha770c72_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/myst-nb-1.4.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/myst-parser-5.0.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/natsort-8.4.0-pyhcf101f3_2.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/nbclient-0.10.4-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/nbformat-5.10.4-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/nest-asyncio-1.6.0-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/numpy-2.4.3-py312ha3f287d_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/numpydoc-1.10.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/openssl-3.6.1-hf411b9b_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/packaging-26.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/parso-0.8.6-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pip-26.0.1-pyh8b19718_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/platformdirs-4.9.4-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pluggy-1.6.0-pyhf9edf01_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/prompt-toolkit-3.0.52-pyha770c72_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/psutil-7.2.2-py312he5662c2_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pure_eval-0.2.3-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pyclibrary-0.2.2-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pydata-sphinx-theme-0.17.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pygments-2.20.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pyparsing-3.3.2-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pysocks-1.7.1-pyh09c184e_7.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pytest-9.0.2-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/python-3.12.13-h0159041_0_cpython.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/python-dateutil-2.9.0.post0-pyhe01879c_2.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/python-fastjsonschema-2.21.2-pyhe01879c_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/python-gil-3.12.13-hd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/python_abi-3.12-8_cp312.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/pywin32-311-py312h829343e_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/pyyaml-6.0.3-py312h05f76fc_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/pyzmq-27.1.0-py312h343a6d4_2.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/referencing-0.37.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/requests-2.33.1-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/rpds-py-0.30.0-py312hdabe01f_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/ruamel.yaml-0.19.1-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/ruamel.yaml.clib-0.2.15-py312he5662c2_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/scipy-1.17.1-py312h9b3c559_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/setuptools-82.0.1-pyh332efcf_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/six-1.17.0-pyhe01879c_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/snowballstemmer-3.0.1-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/soupsieve-2.8.3-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/sphinx-8.1.3-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/sphinx-autodoc-typehints-3.0.1-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/sphinx-copybutton-0.5.2-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/sphinx-jinja2-compat-0.4.1-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/sphinx-prompt-1.10.1-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/sphinx-tabs-3.4.1-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/sphinx-toolbox-4.1.2-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/sphinxcontrib-applehelp-2.0.0-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/sphinxcontrib-devhelp-2.0.0-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/sphinxcontrib-htmlhelp-2.1.0-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/sphinxcontrib-jsmath-1.0.1-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/sphinxcontrib-qthelp-2.0.0-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/sphinxcontrib-serializinghtml-1.1.10-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/sqlalchemy-2.0.49-py312he5662c2_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/stack_data-0.6.3-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/tabulate-0.10.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/tbb-2022.3.0-h3155e25_2.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/tk-8.6.13-h6ed50ae_3.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/tomli-2.4.1-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/tornado-6.5.5-py312he06e257_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/traitlets-5.14.3-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/typing-extensions-4.15.0-h396c80c_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/typing_extensions-4.15.0-pyhcf101f3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/typing_inspect-0.9.0-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/tzdata-2025c-hc9c84f9_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/ucrt-10.0.26100.0-h57928b3_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/urllib3-2.6.3-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/vc-14.3-h41ae7f8_34.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/vc14_runtime-14.44.35208-h818238b_34.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/vcomp14-14.44.35208-h818238b_34.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/wcwidth-0.6.0-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/webencodings-0.5.1-pyhd8ed1ab_3.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/wheel-0.46.3-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/win_inet_pton-1.1.0-pyh7428d3b_8.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/yaml-0.2.5-h6a83c73_3.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/zeromq-4.3.5-h507cc87_10.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/zipp-3.23.0-pyhcf101f3_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/zstd-1.5.7-h534d264_6.conda + - pypi: https://files.pythonhosted.org/packages/8c/79/017fab2f7167a9a9795665f894d04f77aafceca80821b51589bb4b23ff5c/nvidia_sphinx_theme-0.0.9.post1-py3-none-any.whl +packages: +- conda: https://conda.anaconda.org/conda-forge/linux-64/_libgcc_mutex-0.1-conda_forge.tar.bz2 + sha256: fe51de6107f9edc7aa4f786a70f4a883943bc9d39b3bb7307c04c41410990726 + md5: d7c89558ba9fa0495403155b64376d81 + license: None + size: 2562 + timestamp: 1578324546067 +- conda: https://conda.anaconda.org/conda-forge/linux-64/_openmp_mutex-4.5-20_gnu.conda + build_number: 20 + sha256: 1dd3fffd892081df9726d7eb7e0dea6198962ba775bd88842135a4ddb4deb3c9 + md5: a9f577daf3de00bca7c3c76c0ecbd1de + depends: + - __glibc >=2.17,<3.0.a0 + - libgomp >=7.5.0 + constrains: + - openmp_impl <0.0a0 + license: BSD-3-Clause + license_family: BSD + purls: [] + size: 28948 + timestamp: 1770939786096 +- conda: https://conda.anaconda.org/conda-forge/linux-64/_openmp_mutex-4.5-2_gnu.tar.bz2 + build_number: 16 + sha256: fbe2c5e56a653bebb982eda4876a9178aedfc2b545f25d0ce9c4c0b508253d22 + md5: 73aaf86a425cc6e73fcf236a5a46396d + depends: + - _libgcc_mutex 0.1 conda_forge + - libgomp >=7.5.0 + constrains: + - openmp_impl 9999 + license: BSD-3-Clause + license_family: BSD + size: 23621 + timestamp: 1650670423406 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/_openmp_mutex-4.5-20_gnu.conda + build_number: 20 + sha256: a2527b1d81792a0ccd2c05850960df119c2b6d8f5fdec97f2db7d25dc23b1068 + md5: 468fd3bb9e1f671d36c2cbc677e56f1d + depends: + - libgomp >=7.5.0 + constrains: + - openmp_impl <0.0a0 + license: BSD-3-Clause + license_family: BSD + purls: [] + size: 28926 + timestamp: 1770939656741 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/_openmp_mutex-4.5-2_gnu.tar.bz2 + build_number: 16 + sha256: 3702bef2f0a4d38bd8288bbe54aace623602a1343c2cfbefd3fa188e015bebf0 + md5: 6168d71addc746e8f2b8d57dfd2edcea + depends: + - libgomp >=7.5.0 + constrains: + - openmp_impl 9999 + license: BSD-3-Clause + license_family: BSD + size: 23712 + timestamp: 1650670790230 +- conda: https://conda.anaconda.org/conda-forge/win-64/_openmp_mutex-4.5-20_gnu.conda + build_number: 20 + sha256: 8a1cee28bd0ee7451ada1cd50b64720e57e17ff994fc62dd8329bef570d382e4 + md5: 1626967b574d1784b578b52eaeb071e7 + depends: + - libgomp >=7.5.0 + - libwinpthread >=12.0.0.r4.gg4f2fc60ca + constrains: + - openmp_impl <0.0a0 + - msys2-conda-epoch <0.0a0 + license: BSD-3-Clause + license_family: BSD + purls: [] + size: 52252 + timestamp: 1770943776666 +- conda: https://conda.anaconda.org/conda-forge/win-64/_openmp_mutex-4.5-2_gnu.conda + build_number: 8 + sha256: 1a62cd1f215fe0902e7004089693a78347a30ad687781dfda2289cab000e652d + md5: 37e16618af5c4851a3f3d66dd0e11141 + depends: + - libgomp >=7.5.0 + - libwinpthread >=12.0.0.r2.ggc561118da + constrains: + - openmp_impl 9999 + - msys2-conda-epoch <0.0a0 + license: BSD-3-Clause + license_family: BSD + size: 49468 + timestamp: 1718213032772 +- conda: https://conda.anaconda.org/conda-forge/noarch/_python_abi3_support-1.0-hd8ed1ab_2.conda + sha256: a3967b937b9abf0f2a99f3173fa4630293979bd1644709d89580e7c62a544661 + md5: aaa2a381ccc56eac91d63b6c1240312f + depends: + - cpython + - python-gil + license: MIT + license_family: MIT + purls: [] + size: 8191 + timestamp: 1744137672556 +- conda: https://conda.anaconda.org/conda-forge/noarch/accessible-pygments-0.0.5-pyhd8ed1ab_1.conda + sha256: 1307719f0d8ee694fc923579a39c0621c23fdaa14ccdf9278a5aac5665ac58e9 + md5: 74ac5069774cdbc53910ec4d631a3999 + depends: + - pygments + - python >=3.9 + license: BSD-3-Clause + license_family: BSD + purls: + - pkg:pypi/accessible-pygments?source=hash-mapping + size: 1326096 + timestamp: 1734956217254 +- conda: https://conda.anaconda.org/conda-forge/noarch/alabaster-1.0.0-pyhd8ed1ab_1.conda + sha256: 6c4456a138919dae9edd3ac1a74b6fbe5fd66c05675f54df2f8ab8c8d0cc6cea + md5: 1fd9696649f65fd6611fcdb4ffec738a + depends: + - python >=3.10 + license: BSD-3-Clause + license_family: BSD + purls: + - pkg:pypi/alabaster?source=hash-mapping + size: 18684 + timestamp: 1733750512696 +- conda: https://conda.anaconda.org/conda-forge/linux-64/alsa-lib-1.2.15.1-hb03c661_0.conda + sha256: 224f1a55a9ba7e877bce980f14fc3e3c0f0fb6d3cbf3c5f1a8f5dd8391ce8bba + md5: bba37fb066adb90e1d876dff0fd5d09d + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + license: LGPL-2.1-or-later + license_family: GPL + size: 585491 + timestamp: 1766155792553 +- conda: https://conda.anaconda.org/conda-forge/linux-64/alsa-lib-1.2.15.3-hb03c661_0.conda + sha256: d88aa7ae766cf584e180996e92fef2aa7d8e0a0a5ab1d4d49c32390c1b5fff31 + md5: dcdc58c15961dbf17a0621312b01f5cb + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + license: LGPL-2.1-or-later + license_family: GPL + size: 584660 + timestamp: 1768327524772 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/alsa-lib-1.2.15.1-he30d5cf_0.conda + sha256: cb8c79ff99e2e36958e088278971cfec4aeed8e44084e968c906b7bbc3cd8de1 + md5: 50a88426e78ae8eb7d52072ba2e8db21 + depends: + - libgcc >=14 + license: LGPL-2.1-or-later + license_family: GPL + size: 615491 + timestamp: 1766156819056 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/alsa-lib-1.2.15.3-he30d5cf_0.conda + sha256: ea2233e2db9908c2e5f29d3ca420a546b4583253f4f70abb5494cdd676866d42 + md5: 4a98cbc4ade694520227402ff8880630 + depends: + - libgcc >=14 + license: LGPL-2.1-or-later + license_family: GPL + size: 615729 + timestamp: 1768327548407 +- conda: https://conda.anaconda.org/conda-forge/linux-64/aom-3.9.1-hac33072_0.conda + sha256: b08ef033817b5f9f76ce62dfcac7694e7b6b4006420372de22494503decac855 + md5: 346722a0be40f6edc53f12640d301338 + depends: + - libgcc-ng >=12 + - libstdcxx-ng >=12 + license: BSD-2-Clause + license_family: BSD + size: 2706396 + timestamp: 1718551242397 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/aom-3.9.1-hcccb83c_0.conda + sha256: ac438ce5d3d3673a9188b535fc7cda413b479f0d52536aeeac1bd82faa656ea0 + md5: cc744ac4efe5bcaa8cca51ff5b850df0 + depends: + - libgcc-ng >=12 + - libstdcxx-ng >=12 + license: BSD-2-Clause + license_family: BSD + size: 3250813 + timestamp: 1718551360260 +- conda: https://conda.anaconda.org/conda-forge/win-64/aom-3.9.1-he0c23c2_0.conda + sha256: 0524d0c0b61dacd0c22ac7a8067f977b1d52380210933b04141f5099c5b6fec7 + md5: 3d7c14285d3eb3239a76ff79063f27a5 + depends: + - ucrt >=10.0.20348.0 + - vc >=14.2,<15 + - vc14_runtime >=14.29.30139 + license: BSD-2-Clause + license_family: BSD + size: 1958151 + timestamp: 1718551737234 +- conda: https://conda.anaconda.org/conda-forge/noarch/apeye-1.4.1-pyhd8ed1ab_1.conda + sha256: b554d2d2fc869a5955ebb3e5c8aea5e13ec49363b782b08e1802e29c91beaebf + md5: 0f2a7ba1dfc3b6117cfd864d25fa86ce + depends: + - apeye-core >=1.0.0b2 + - domdf-python-tools >=2.6.0 + - platformdirs >=2.3.0 + - python >=3.9 + - requests >=2.24.0 + constrains: + - cachecontrol >=0.12.6 + license: LGPL-3.0-or-later + license_family: LGPL + purls: + - pkg:pypi/apeye?source=hash-mapping + size: 95690 + timestamp: 1738250335247 +- conda: https://conda.anaconda.org/conda-forge/noarch/apeye-core-1.1.5-pyhd8ed1ab_1.conda + sha256: 3ee9787c3876c2ffb4b3c77ac73c0b28d67d18a376f4c952643cac95020a2a14 + md5: b60c08c6a0cbb505016075bb9e484e56 + depends: + - domdf-python-tools >=2.6.0 + - idna >=2.5 + - python >=3.9 + license: BSD-3-Clause + license_family: BSD + purls: + - pkg:pypi/apeye-core?source=hash-mapping + size: 94258 + timestamp: 1738681346787 +- conda: https://conda.anaconda.org/conda-forge/noarch/arm-variant-1.2.0-sbsa.conda + sha256: 0658cac65071ace5beded633851681e6f0b381040c8ce313bbe2a0ab410c5072 + md5: b7d6244b9c7a660f10336645e73c2cd2 + license: BSD-3-Clause + license_family: BSD + purls: [] + size: 7126 + timestamp: 1742928603302 +- conda: https://conda.anaconda.org/conda-forge/noarch/asttokens-3.0.1-pyhd8ed1ab_0.conda + sha256: ee4da0f3fe9d59439798ee399ef3e482791e48784873d546e706d0935f9ff010 + md5: 9673a61a297b00016442e022d689faa6 + depends: + - python >=3.10 + constrains: + - astroid >=2,<5 + license: Apache-2.0 + license_family: Apache + purls: + - pkg:pypi/asttokens?source=hash-mapping + size: 28797 + timestamp: 1763410017955 +- conda: https://conda.anaconda.org/conda-forge/linux-64/attr-2.5.2-h39aace5_0.conda + sha256: a9c114cbfeda42a226e2db1809a538929d2f118ef855372293bd188f71711c48 + md5: 791365c5f65975051e4e017b5da3abf5 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=13 + license: GPL-2.0-or-later + license_family: GPL + size: 68072 + timestamp: 1756738968573 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/attr-2.5.1-h4e544f5_1.tar.bz2 + sha256: 2c793b48e835a8fac93f1664c706442972a0206963bf8ca202e83f7f4d29a7d7 + md5: 1ef6c06fec1b6f5ee99ffe2152e53568 + depends: + - libgcc-ng >=12 + license: GPL-2.0-or-later + license_family: GPL + size: 74992 + timestamp: 1660065534958 +- conda: https://conda.anaconda.org/conda-forge/noarch/attrs-26.1.0-pyhcf101f3_0.conda + sha256: 1b6124230bb4e571b1b9401537ecff575b7b109cc3a21ee019f65e083b8399ab + md5: c6b0543676ecb1fb2d7643941fe375f2 + depends: + - python >=3.10 + - python + license: MIT + license_family: MIT + purls: + - pkg:pypi/attrs?source=hash-mapping + size: 64927 + timestamp: 1773935801332 +- conda: https://conda.anaconda.org/conda-forge/noarch/autodocsumm-0.2.15-pyhd8ed1ab_0.conda + sha256: 21cb40c7c5f47bf54d2722b1ab3c91f747ef2b80ba16ece058755371e5c6385b + md5: e51977d5fe34698e26a20950b8b449e6 + depends: + - python >=3.7 + - sphinx >=2.2,<10.0 + license: Apache-2.0 + license_family: APACHE + purls: + - pkg:pypi/autodocsumm?source=hash-mapping + size: 20495 + timestamp: 1774600916594 +- conda: https://conda.anaconda.org/conda-forge/noarch/babel-2.18.0-pyhcf101f3_1.conda + sha256: a14a9ad02101aab25570543a59c5193043b73dc311a25650134ed9e6cb691770 + md5: f1976ce927373500cc19d3c0b2c85177 + depends: + - python >=3.10 + - python + constrains: + - pytz >=2015.7 + license: BSD-3-Clause + license_family: BSD + purls: + - pkg:pypi/babel?source=compressed-mapping + size: 7684321 + timestamp: 1772555330347 +- conda: https://conda.anaconda.org/conda-forge/linux-64/backports.zstd-1.3.0-py312h90b7ffd_0.conda + sha256: d77a24be15e283d83214121428290dbe55632a6e458378205b39c550afa008cf + md5: 5b8c55fed2e576dde4b0b33693a4fdb1 + depends: + - python + - libgcc >=14 + - __glibc >=2.17,<3.0.a0 + - python_abi 3.12.* *_cp312 + - zstd >=1.5.7,<1.6.0a0 + license: BSD-3-Clause AND MIT AND EPL-2.0 + purls: + - pkg:pypi/backports-zstd?source=hash-mapping + size: 237970 + timestamp: 1767045004512 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/backports.zstd-1.3.0-py312h3d8e7d4_0.conda + sha256: 15ca235863f67ebbfa5a3c1cf1eb3f448ad4bafa9e9d1660996d90b406c2f5ca + md5: 342f2741b222094a78db95893ecc42f9 + depends: + - python + - libgcc >=14 + - python 3.12.* *_cpython + - zstd >=1.5.7,<1.6.0a0 + - python_abi 3.12.* *_cp312 + license: BSD-3-Clause AND MIT AND EPL-2.0 + purls: + - pkg:pypi/backports-zstd?source=hash-mapping + size: 243175 + timestamp: 1767044998908 +- conda: https://conda.anaconda.org/conda-forge/win-64/backports.zstd-1.3.0-py312h06d0912_0.conda + sha256: c9c97cd644faa6c4fb38017c5ecfd082f56a3126af5925d246364fa4a22b2a74 + md5: 2db2b356f08f19ce4309a79a9ee6b9d8 + depends: + - python + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + - ucrt >=10.0.20348.0 + - python_abi 3.12.* *_cp312 + - zstd >=1.5.7,<1.6.0a0 + license: BSD-3-Clause AND MIT AND EPL-2.0 + purls: + - pkg:pypi/backports-zstd?source=hash-mapping + size: 236635 + timestamp: 1767045021157 +- conda: https://conda.anaconda.org/conda-forge/noarch/beautifulsoup4-4.14.3-pyha770c72_0.conda + sha256: bf1e71c3c0a5b024e44ff928225a0874fc3c3356ec1a0b6fe719108e6d1288f6 + md5: 5267bef8efea4127aacd1f4e1f149b6e + depends: + - python >=3.10 + - soupsieve >=1.2 + - typing-extensions + license: MIT + license_family: MIT + purls: + - pkg:pypi/beautifulsoup4?source=hash-mapping + size: 90399 + timestamp: 1764520638652 +- conda: https://conda.anaconda.org/conda-forge/linux-64/binutils_impl_linux-64-2.45-default_hfdba357_104.conda + sha256: 054a77ccab631071a803737ea8e5d04b5b18e57db5b0826a04495bd3fdf39a7c + md5: a7a67bf132a4a2dea92a7cb498cdc5b1 + depends: + - ld_impl_linux-64 2.45 default_hbd61a6d_104 + - sysroot_linux-64 + - zstd >=1.5.7,<1.6.0a0 + license: GPL-3.0-only + license_family: GPL + size: 3747046 + timestamp: 1764007847963 +- conda: https://conda.anaconda.org/conda-forge/linux-64/binutils_impl_linux-64-2.45-default_hfdba357_105.conda + sha256: 17fbb32191430310d3eb8309f80a8df54f0d66eda9cf84b2ae5113e6d74e24d8 + md5: e410a8f80e22eb6d840e39ac6a34bd0e + depends: + - ld_impl_linux-64 2.45 default_hbd61a6d_105 + - sysroot_linux-64 + - zstd >=1.5.7,<1.6.0a0 + license: GPL-3.0-only + license_family: GPL + size: 3719982 + timestamp: 1766513109980 +- conda: https://conda.anaconda.org/conda-forge/linux-64/binutils_impl_linux-64-2.45.1-default_hfdba357_101.conda + sha256: 74341b26a2b9475dc14ba3cf12432fcd10a23af285101883e720216d81d44676 + md5: 83aa53cb3f5fc849851a84d777a60551 + depends: + - ld_impl_linux-64 2.45.1 default_hbd61a6d_101 + - sysroot_linux-64 + - zstd >=1.5.7,<1.6.0a0 + license: GPL-3.0-only + license_family: GPL + size: 3744895 + timestamp: 1770267152681 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/binutils_impl_linux-aarch64-2.45-default_h5f4c503_104.conda + sha256: b7694c53943941a5234406b77b168e28d92227f8e69c697edda3faf436dd26c1 + md5: 8107322440b07ab4234815368d1785a9 + depends: + - ld_impl_linux-aarch64 2.45 default_h1979696_104 + - sysroot_linux-aarch64 + - zstd >=1.5.7,<1.6.0a0 + license: GPL-3.0-only + license_family: GPL + size: 4850743 + timestamp: 1764007931341 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/binutils_impl_linux-aarch64-2.45-default_h5f4c503_105.conda + sha256: 7398706fe428530777a7b1e69925c94e46cd45182c52f8a84f34cd601c8d2584 + md5: 3cee44d70779b513523a9a46146da3f9 + depends: + - ld_impl_linux-aarch64 2.45 default_h1979696_105 + - sysroot_linux-aarch64 + - zstd >=1.5.7,<1.6.0a0 + license: GPL-3.0-only + license_family: GPL + size: 4848132 + timestamp: 1766513201703 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/binutils_impl_linux-aarch64-2.45.1-default_h5f4c503_101.conda + sha256: e90ab42a5225dc1eaa6e4e7201cd7b8ed52dad6ec46814be7e5a4039433ae85c + md5: df6e1dc38cbe5642350fa09d4a1d546b + depends: + - ld_impl_linux-aarch64 2.45.1 default_h1979696_101 + - sysroot_linux-aarch64 + - zstd >=1.5.7,<1.6.0a0 + license: GPL-3.0-only + license_family: GPL + size: 4741684 + timestamp: 1770267224406 +- conda: https://conda.anaconda.org/conda-forge/win-64/binutils_impl_win-64-2.45-default_ha84baeb_104.conda + sha256: 78922b9eca51e828b4626b35e6893861728f284cc8253e0922469971a63e6295 + md5: ea7736f58de65900a5420f4485d73eaf + depends: + - ld_impl_win-64 2.45 default_hfd38196_104 + - m2w64-sysroot_win-64 >=12.0.0.r0 + - zstd >=1.5.7,<1.6.0a0 + license: GPL-3.0-only + license_family: GPL + size: 5997864 + timestamp: 1764007778611 +- conda: https://conda.anaconda.org/conda-forge/win-64/binutils_impl_win-64-2.45-default_ha84baeb_105.conda + sha256: 0caf8210512b7ae6db752264897384cfb8c87ab8584b14ec07df3c0bff0bba51 + md5: fe34d00e7c9e92559ec8b5a927d06e57 + depends: + - ld_impl_win-64 2.45 default_hfd38196_105 + - m2w64-sysroot_win-64 >=12.0.0.r0 + - zstd >=1.5.7,<1.6.0a0 + license: GPL-3.0-only + license_family: GPL + size: 6096221 + timestamp: 1766513640880 +- conda: https://conda.anaconda.org/conda-forge/win-64/binutils_impl_win-64-2.45.1-default_ha84baeb_101.conda + sha256: 31211bd89e77203f731f31871ff13b5828fbd99f02ae2fc56ae15fcd568c4466 + md5: 84d2e3fd656b05705b7cfe7a92a8c840 + depends: + - ld_impl_win-64 2.45.1 default_hfd38196_101 + - m2w64-sysroot_win-64 >=12.0.0.r0 + - zstd >=1.5.7,<1.6.0a0 + license: GPL-3.0-only + license_family: GPL + size: 5830940 + timestamp: 1770267725685 +- conda: https://conda.anaconda.org/conda-forge/linux-64/brotli-python-1.2.0-py312hdb49522_1.conda + sha256: 49df13a1bb5e388ca0e4e87022260f9501ed4192656d23dc9d9a1b4bf3787918 + md5: 64088dffd7413a2dd557ce837b4cbbdb + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libstdcxx >=14 + - python >=3.12,<3.13.0a0 + - python_abi 3.12.* *_cp312 + constrains: + - libbrotlicommon 1.2.0 hb03c661_1 + license: MIT + license_family: MIT + purls: + - pkg:pypi/brotli?source=compressed-mapping + size: 368300 + timestamp: 1764017300621 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/brotli-python-1.2.0-py312hac7b6a9_1.conda + sha256: aa14d1f26a1d4ed3a735281beb20129b9ba4670fed688045ac71f4119aeed7e6 + md5: d64147176625536a8024e26577c5e894 + depends: + - libgcc >=14 + - libstdcxx >=14 + - python >=3.12,<3.13.0a0 + - python >=3.12,<3.13.0a0 *_cpython + - python_abi 3.12.* *_cp312 + constrains: + - libbrotlicommon 1.2.0 he30d5cf_1 + license: MIT + license_family: MIT + purls: + - pkg:pypi/brotli?source=hash-mapping + size: 373800 + timestamp: 1764017545385 +- conda: https://conda.anaconda.org/conda-forge/win-64/brotli-python-1.2.0-py312hc6d9e41_1.conda + sha256: 2bb6f384a51929ef2d5d6039fcf6c294874f20aaab2f63ca768cbe462ed4b379 + md5: e8e7a6346a9e50d19b4daf41f367366f + depends: + - python >=3.12,<3.13.0a0 + - python_abi 3.12.* *_cp312 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + constrains: + - libbrotlicommon 1.2.0 hfd05255_1 + license: MIT + license_family: MIT + purls: + - pkg:pypi/brotli?source=hash-mapping + size: 335482 + timestamp: 1764018063640 +- conda: https://conda.anaconda.org/conda-forge/linux-64/bzip2-1.0.8-hda65f42_8.conda + sha256: c30daba32ddebbb7ded490f0e371eae90f51e72db620554089103b4a6934b0d5 + md5: 51a19bba1b8ebfb60df25cde030b7ebc + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + license: bzip2-1.0.6 + license_family: BSD + size: 260341 + timestamp: 1757437258798 +- conda: https://conda.anaconda.org/conda-forge/linux-64/bzip2-1.0.8-hda65f42_9.conda + sha256: 0b75d45f0bba3e95dc693336fa51f40ea28c980131fec438afb7ce6118ed05f6 + md5: d2ffd7602c02f2b316fd921d39876885 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + license: bzip2-1.0.6 + license_family: BSD + purls: [] + size: 260182 + timestamp: 1771350215188 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/bzip2-1.0.8-h4777abc_8.conda + sha256: d2a296aa0b5f38ed9c264def6cf775c0ccb0f110ae156fcde322f3eccebf2e01 + md5: 2921ac0b541bf37c69e66bd6d9a43bca + depends: + - libgcc >=14 + license: bzip2-1.0.6 + license_family: BSD + size: 192536 + timestamp: 1757437302703 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/bzip2-1.0.8-h4777abc_9.conda + sha256: b3495077889dde6bb370938e7db82be545c73e8589696ad0843a32221520ad4c + md5: 840d8fc0d7b3209be93080bc20e07f2d + depends: + - libgcc >=14 + license: bzip2-1.0.6 + license_family: BSD + purls: [] + size: 192412 + timestamp: 1771350241232 +- conda: https://conda.anaconda.org/conda-forge/win-64/bzip2-1.0.8-h0ad9c76_8.conda + sha256: d882712855624641f48aa9dc3f5feea2ed6b4e6004585d3616386a18186fe692 + md5: 1077e9333c41ff0be8edd1a5ec0ddace + depends: + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: bzip2-1.0.6 + license_family: BSD + size: 55977 + timestamp: 1757437738856 +- conda: https://conda.anaconda.org/conda-forge/win-64/bzip2-1.0.8-h0ad9c76_9.conda + sha256: 76dfb71df5e8d1c4eded2dbb5ba15bb8fb2e2b0fe42d94145d5eed4c75c35902 + md5: 4cb8e6b48f67de0b018719cdf1136306 + depends: + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: bzip2-1.0.6 + license_family: BSD + purls: [] + size: 56115 + timestamp: 1771350256444 +- conda: https://conda.anaconda.org/conda-forge/noarch/ca-certificates-2025.11.12-h4c7d964_0.conda + sha256: 686a13bd2d4024fc99a22c1e0e68a7356af3ed3304a8d3ff6bb56249ad4e82f0 + md5: f98fb7db808b94bc1ec5b0e62f9f1069 + depends: + - __win + license: ISC + size: 152827 + timestamp: 1762967310929 +- conda: https://conda.anaconda.org/conda-forge/noarch/ca-certificates-2025.11.12-hbd8a1cb_0.conda + sha256: b986ba796d42c9d3265602bc038f6f5264095702dd546c14bc684e60c385e773 + md5: f0991f0f84902f6b6009b4d2350a83aa + depends: + - __unix + license: ISC + size: 152432 + timestamp: 1762967197890 +- conda: https://conda.anaconda.org/conda-forge/noarch/ca-certificates-2026.1.4-h4c7d964_0.conda + sha256: 4ddcb01be03f85d3db9d881407fb13a673372f1b9fac9c836ea441893390e049 + md5: 84d389c9eee640dda3d26fc5335c67d8 + depends: + - __win + license: ISC + size: 147139 + timestamp: 1767500904211 +- conda: https://conda.anaconda.org/conda-forge/noarch/ca-certificates-2026.1.4-hbd8a1cb_0.conda + sha256: b5974ec9b50e3c514a382335efa81ed02b05906849827a34061c496f4defa0b2 + md5: bddacf101bb4dd0e51811cb69c7790e2 + depends: + - __unix + license: ISC + size: 146519 + timestamp: 1767500828366 +- conda: https://conda.anaconda.org/conda-forge/noarch/ca-certificates-2026.2.25-h4c7d964_0.conda + sha256: 37950019c59b99585cee5d30dbc2cc9696ed4e11f5742606a4db1621ed8f94d6 + md5: f001e6e220355b7f87403a4d0e5bf1ca + depends: + - __win + license: ISC + purls: [] + size: 147734 + timestamp: 1772006322223 +- conda: https://conda.anaconda.org/conda-forge/noarch/ca-certificates-2026.2.25-hbd8a1cb_0.conda + sha256: 67cc7101b36421c5913a1687ef1b99f85b5d6868da3abbf6ec1a4181e79782fc + md5: 4492fd26db29495f0ba23f146cd5638d + depends: + - __unix + license: ISC + purls: [] + size: 147413 + timestamp: 1772006283803 +- conda: https://conda.anaconda.org/conda-forge/noarch/cachecontrol-0.14.3-pyha770c72_0.conda + sha256: ec791bb6f1ef504411f87b28946a7ae63ed1f3681cefc462cf1dfdaf0790b6a9 + md5: 241ef6e3db47a143ac34c21bfba510f1 + depends: + - msgpack-python >=0.5.2,<2.0.0 + - python >=3.9 + - requests >=2.16.0 + license: Apache-2.0 + license_family: Apache + purls: + - pkg:pypi/cachecontrol?source=hash-mapping + size: 23868 + timestamp: 1746103006628 +- conda: https://conda.anaconda.org/conda-forge/linux-64/cairo-1.18.4-h3394656_0.conda + sha256: 3bd6a391ad60e471de76c0e9db34986c4b5058587fbf2efa5a7f54645e28c2c7 + md5: 09262e66b19567aff4f592fb53b28760 + depends: + - __glibc >=2.17,<3.0.a0 + - fontconfig >=2.15.0,<3.0a0 + - fonts-conda-ecosystem + - freetype >=2.12.1,<3.0a0 + - icu >=75.1,<76.0a0 + - libexpat >=2.6.4,<3.0a0 + - libgcc >=13 + - libglib >=2.82.2,<3.0a0 + - libpng >=1.6.47,<1.7.0a0 + - libstdcxx >=13 + - libxcb >=1.17.0,<2.0a0 + - libzlib >=1.3.1,<2.0a0 + - pixman >=0.44.2,<1.0a0 + - xorg-libice >=1.1.2,<2.0a0 + - xorg-libsm >=1.2.5,<2.0a0 + - xorg-libx11 >=1.8.11,<2.0a0 + - xorg-libxext >=1.3.6,<2.0a0 + - xorg-libxrender >=0.9.12,<0.10.0a0 + license: LGPL-2.1-only or MPL-1.1 + size: 978114 + timestamp: 1741554591855 +- conda: https://conda.anaconda.org/conda-forge/linux-64/cairo-1.18.4-he90730b_1.conda + sha256: 06525fa0c4e4f56e771a3b986d0fdf0f0fc5a3270830ee47e127a5105bde1b9a + md5: bb6c4808bfa69d6f7f6b07e5846ced37 + depends: + - __glibc >=2.17,<3.0.a0 + - fontconfig >=2.15.0,<3.0a0 + - fonts-conda-ecosystem + - icu >=78.1,<79.0a0 + - libexpat >=2.7.3,<3.0a0 + - libfreetype >=2.14.1 + - libfreetype6 >=2.14.1 + - libgcc >=14 + - libglib >=2.86.3,<3.0a0 + - libpng >=1.6.53,<1.7.0a0 + - libstdcxx >=14 + - libxcb >=1.17.0,<2.0a0 + - libzlib >=1.3.1,<2.0a0 + - pixman >=0.46.4,<1.0a0 + - xorg-libice >=1.1.2,<2.0a0 + - xorg-libsm >=1.2.6,<2.0a0 + - xorg-libx11 >=1.8.12,<2.0a0 + - xorg-libxext >=1.3.6,<2.0a0 + - xorg-libxrender >=0.9.12,<0.10.0a0 + license: LGPL-2.1-only or MPL-1.1 + size: 989514 + timestamp: 1766415934926 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/cairo-1.18.4-h0b6afd8_1.conda + sha256: 675db823f3d6fb6bf747fab3b0170ba99b269a07cf6df1e49fff2f9972be9cd1 + md5: 043c13ed3a18396994be9b4fab6572ad + depends: + - fontconfig >=2.15.0,<3.0a0 + - fonts-conda-ecosystem + - icu >=78.1,<79.0a0 + - libexpat >=2.7.3,<3.0a0 + - libfreetype >=2.14.1 + - libfreetype6 >=2.14.1 + - libgcc >=14 + - libglib >=2.86.3,<3.0a0 + - libpng >=1.6.53,<1.7.0a0 + - libstdcxx >=14 + - libxcb >=1.17.0,<2.0a0 + - libzlib >=1.3.1,<2.0a0 + - pixman >=0.46.4,<1.0a0 + - xorg-libice >=1.1.2,<2.0a0 + - xorg-libsm >=1.2.6,<2.0a0 + - xorg-libx11 >=1.8.12,<2.0a0 + - xorg-libxext >=1.3.6,<2.0a0 + - xorg-libxrender >=0.9.12,<0.10.0a0 + license: LGPL-2.1-only or MPL-1.1 + size: 927045 + timestamp: 1766416003626 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/cairo-1.18.4-h83712da_0.conda + sha256: 37cfff940d2d02259afdab75eb2dbac42cf830adadee78d3733d160a1de2cc66 + md5: cd55953a67ec727db5dc32b167201aa6 + depends: + - fontconfig >=2.15.0,<3.0a0 + - fonts-conda-ecosystem + - freetype >=2.12.1,<3.0a0 + - icu >=75.1,<76.0a0 + - libexpat >=2.6.4,<3.0a0 + - libgcc >=13 + - libglib >=2.82.2,<3.0a0 + - libpng >=1.6.47,<1.7.0a0 + - libstdcxx >=13 + - libxcb >=1.17.0,<2.0a0 + - libzlib >=1.3.1,<2.0a0 + - pixman >=0.44.2,<1.0a0 + - xorg-libice >=1.1.2,<2.0a0 + - xorg-libsm >=1.2.5,<2.0a0 + - xorg-libx11 >=1.8.11,<2.0a0 + - xorg-libxext >=1.3.6,<2.0a0 + - xorg-libxrender >=0.9.12,<0.10.0a0 + license: LGPL-2.1-only or MPL-1.1 + size: 966667 + timestamp: 1741554768968 +- conda: https://conda.anaconda.org/conda-forge/win-64/cairo-1.18.4-h477c42c_1.conda + sha256: 9ee4ad706c5d3e1c6c469785d60e3c2b263eec569be0eac7be33fbaef978bccc + md5: 52ea1beba35b69852d210242dd20f97d + depends: + - fontconfig >=2.15.0,<3.0a0 + - fonts-conda-ecosystem + - icu >=78.1,<79.0a0 + - libexpat >=2.7.3,<3.0a0 + - libfreetype >=2.14.1 + - libfreetype6 >=2.14.1 + - libglib >=2.86.3,<3.0a0 + - libpng >=1.6.53,<1.7.0a0 + - libzlib >=1.3.1,<2.0a0 + - pixman >=0.46.4,<1.0a0 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: LGPL-2.1-only or MPL-1.1 + size: 1537783 + timestamp: 1766416059188 +- conda: https://conda.anaconda.org/conda-forge/win-64/cairo-1.18.4-h5782bbf_0.conda + sha256: b9f577bddb033dba4533e851853924bfe7b7c1623d0697df382eef177308a917 + md5: 20e32ced54300292aff690a69c5e7b97 + depends: + - fontconfig >=2.15.0,<3.0a0 + - fonts-conda-ecosystem + - freetype >=2.12.1,<3.0a0 + - icu >=75.1,<76.0a0 + - libexpat >=2.6.4,<3.0a0 + - libglib >=2.82.2,<3.0a0 + - libpng >=1.6.47,<1.7.0a0 + - libzlib >=1.3.1,<2.0a0 + - pixman >=0.44.2,<1.0a0 + - ucrt >=10.0.20348.0 + - vc >=14.2,<15 + - vc14_runtime >=14.29.30139 + license: LGPL-2.1-only or MPL-1.1 + size: 1524254 + timestamp: 1741555212198 +- conda: https://conda.anaconda.org/conda-forge/noarch/certifi-2026.2.25-pyhd8ed1ab_0.conda + sha256: a6b118fd1ed6099dc4fc03f9c492b88882a780fadaef4ed4f93dc70757713656 + md5: 765c4d97e877cdbbb88ff33152b86125 + depends: + - python >=3.10 + license: ISC + purls: + - pkg:pypi/certifi?source=compressed-mapping + size: 151445 + timestamp: 1772001170301 +- conda: https://conda.anaconda.org/conda-forge/noarch/charset-normalizer-3.4.7-pyhd8ed1ab_0.conda + sha256: 3f9483d62ce24ecd063f8a5a714448445dc8d9e201147c46699fc0033e824457 + md5: a9167b9571f3baa9d448faa2139d1089 + depends: + - python >=3.10 + license: MIT + license_family: MIT + purls: + - pkg:pypi/charset-normalizer?source=compressed-mapping + size: 58872 + timestamp: 1775127203018 +- conda: https://conda.anaconda.org/conda-forge/noarch/click-8.3.1-pyh8f84b5b_1.conda + sha256: 38cfe1ee75b21a8361c8824f5544c3866f303af1762693a178266d7f198e8715 + md5: ea8a6c3256897cc31263de9f455e25d9 + depends: + - python >=3.10 + - __unix + - python + license: BSD-3-Clause + license_family: BSD + purls: + - pkg:pypi/click?source=hash-mapping + size: 97676 + timestamp: 1764518652276 +- conda: https://conda.anaconda.org/conda-forge/noarch/click-8.3.1-pyha7b4d00_1.conda + sha256: c3bc9a49930fa1c3383a1485948b914823290efac859a2587ca57a270a652e08 + md5: 6cd3ccc98bacfcc92b2bd7f236f01a7e + depends: + - python >=3.10 + - colorama + - __win + - python + license: BSD-3-Clause + license_family: BSD + purls: + - pkg:pypi/click?source=hash-mapping + size: 96620 + timestamp: 1764518654675 +- conda: https://conda.anaconda.org/conda-forge/noarch/colorama-0.4.6-pyhd8ed1ab_1.conda + sha256: ab29d57dc70786c1269633ba3dff20288b81664d3ff8d21af995742e2bb03287 + md5: 962b9857ee8e7018c22f2776ffa0b2d7 + depends: + - python >=3.9 + license: BSD-3-Clause + license_family: BSD + purls: + - pkg:pypi/colorama?source=hash-mapping + size: 27011 + timestamp: 1733218222191 +- conda: https://conda.anaconda.org/conda-forge/noarch/comm-0.2.3-pyhe01879c_0.conda + sha256: 576a44729314ad9e4e5ebe055fbf48beb8116b60e58f9070278985b2b634f212 + md5: 2da13f2b299d8e1995bafbbe9689a2f7 + depends: + - python >=3.9 + - python + license: BSD-3-Clause + license_family: BSD + purls: + - pkg:pypi/comm?source=hash-mapping + size: 14690 + timestamp: 1753453984907 +- conda: https://conda.anaconda.org/conda-forge/linux-64/conda-gcc-specs-15.2.0-h53410ce_16.conda + sha256: 0e3a6497ccfad65246f9ca8225f290b10ee3be7712e6f7585f1585f72074ecff + md5: 7d1e5e99f086b25a8aeace8f35962fe7 + depends: + - gcc_impl_linux-64 >=15.2.0,<15.2.1.0a0 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 31290 + timestamp: 1765257044086 +- conda: https://conda.anaconda.org/conda-forge/win-64/conda-gcc-specs-15.2.0-hd546029_16.conda + sha256: d4a75332dbe12c326dfb68e71fd44d489c0141a166bc2d7bab85d062eb79babe + md5: b8c66fe4f0dcd3ec9d5a9a739df3e365 + depends: + - gcc_impl_win-64 >=15.2.0,<15.2.1.0a0 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 54364 + timestamp: 1765260662854 +- conda: https://conda.anaconda.org/conda-forge/win-64/conda-gcc-specs-15.2.0-hd546029_18.conda + sha256: 21062850a891e5a82b7a473de0a2fa4bfafff6fcba9455a619604343018c9f99 + md5: 071dbd17ed598f723c5f48624ae455f9 + depends: + - gcc_impl_win-64 >=15.2.0,<15.2.1.0a0 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 54725 + timestamp: 1771382417485 +- conda: https://conda.anaconda.org/conda-forge/noarch/cpython-3.12.13-py312hd8ed1ab_0.conda + noarch: generic + sha256: d3e9bbd7340199527f28bbacf947702368f31de60c433a16446767d3c6aaf6fe + md5: f54c1ffb8ecedb85a8b7fcde3a187212 + depends: + - python >=3.12,<3.13.0a0 + - python_abi * *_cp312 + license: Python-2.0 + purls: [] + size: 46463 + timestamp: 1772728929620 +- conda: https://conda.anaconda.org/conda-forge/noarch/cssutils-2.11.1-pyhd8ed1ab_0.conda + sha256: b9006cbd28ed63a6461717cb9234e1d1f39441d9db0493f55ee0ca72f3577833 + md5: 99cf98eea444365238fb6ee8f518ef19 + depends: + - more-itertools + - python >=3.9 + license: LGPL-3.0-only + license_family: LGPL + purls: + - pkg:pypi/cssutils?source=hash-mapping + size: 284664 + timestamp: 1747322864144 +- conda: . + name: cuda-bindings + version: 13.2.0 + build: py314h3ff45e1_0 + subdir: linux-aarch64 + variants: + cuda_version: 13.3.* + python: 3.14.* + target_platform: linux-aarch64 + depends: + - python + - cuda-version + - cuda-pathfinder + - libnvjitlink + - cuda-nvrtc + - cuda-nvrtc >=13.3.33,<14.0a0 + - cuda-nvvm + - libnvfatbin + - libcufile + - libcufile >=1.18.0.66,<2.0a0 + - libgcc >=15 + - libgcc >=15 + - libstdcxx >=15 + - python_abi 3.14.* *_cp314 + license: Apache-2.0 + sources: + cuda-pathfinder: + path: ../cuda_pathfinder +- conda: . + name: cuda-bindings + version: 13.2.0 + build: py314h5e6f764_0 + subdir: win-64 + variants: + c_compiler: vs2022 + cuda_version: 12.* + cxx_compiler: vs2022 + python: 3.14.* + target_platform: win-64 + depends: + - python + - cuda-version + - cuda-pathfinder + - libnvjitlink + - cuda-nvrtc + - cuda-nvrtc >=12.9.86,<13.0a0 + - cuda-nvvm + - libnvfatbin + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + - ucrt >=10.0.20348.0 + - python_abi 3.14.* *_cp314 + license: Apache-2.0 + sources: + cuda-pathfinder: + path: ../cuda_pathfinder +- conda: . + name: cuda-bindings + version: 13.2.0 + build: py314ha6d028f_0 + subdir: linux-64 + variants: + cuda_version: 12.* + python: 3.14.* + target_platform: linux-64 + depends: + - python + - cuda-version + - cuda-pathfinder + - libnvjitlink + - cuda-nvrtc + - cuda-nvrtc >=12.9.86,<13.0a0 + - cuda-nvvm + - libnvfatbin + - libcufile + - libcufile >=1.14.1.1,<2.0a0 + - libgcc >=15 + - libgcc >=15 + - libstdcxx >=15 + - python_abi 3.14.* *_cp314 + license: Apache-2.0 + sources: + cuda-pathfinder: + path: ../cuda_pathfinder +- conda: . + name: cuda-bindings + version: 13.2.0 + build: py314hd3a1e81_0 + subdir: linux-64 + variants: + cuda_version: 13.3.* + python: 3.14.* + target_platform: linux-64 + depends: + - python + - cuda-version + - cuda-pathfinder + - libnvjitlink + - cuda-nvrtc + - cuda-nvrtc >=13.3.33,<14.0a0 + - cuda-nvvm + - libnvfatbin + - libcufile + - libcufile >=1.18.0.66,<2.0a0 + - libgcc >=15 + - libgcc >=15 + - libstdcxx >=15 + - python_abi 3.14.* *_cp314 + license: Apache-2.0 + sources: + cuda-pathfinder: + path: ../cuda_pathfinder +- conda: . + name: cuda-bindings + version: 13.2.0 + build: py314hd7f1909_0 + subdir: win-64 + variants: + c_compiler: vs2022 + cuda_version: 13.3.* + cxx_compiler: vs2022 + python: 3.14.* + target_platform: win-64 + depends: + - python + - cuda-version + - cuda-pathfinder + - libnvjitlink + - cuda-nvrtc + - cuda-nvrtc >=13.3.33,<14.0a0 + - cuda-nvvm + - libnvfatbin + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + - ucrt >=10.0.20348.0 + - python_abi 3.14.* *_cp314 + license: Apache-2.0 + sources: + cuda-pathfinder: + path: ../cuda_pathfinder +- conda: . + name: cuda-bindings + version: 13.2.0 + build: py314he8946ed_0 + subdir: linux-aarch64 + variants: + cuda_version: 12.* + python: 3.14.* + target_platform: linux-aarch64 + depends: + - python + - cuda-version + - cuda-pathfinder + - libnvjitlink + - cuda-nvrtc + - cuda-nvrtc >=12.9.86,<13.0a0 + - cuda-nvvm + - libnvfatbin + - libcufile + - libcufile >=1.14.1.1,<2.0a0 + - libgcc >=15 + - libgcc >=15 + - libstdcxx >=15 + - python_abi 3.14.* *_cp314 + license: Apache-2.0 + sources: + cuda-pathfinder: + path: ../cuda_pathfinder +- conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-bindings-13.2.0-py312hf79963d_0.conda + sha256: 3234a03d1c491edb7d24ce995dd271dab038bc58eee5dffbaab8253a8042ac4a + md5: cf07366d06fc39a555feb7e288de2dfe + depends: + - __glibc >=2.17,<3.0.a0 + - cuda-nvrtc >=13,<14.0a0 + - cuda-nvvm-impl >=13,<14.0a0 + - cuda-pathfinder >=1.1.0,<2 + - cuda-version >=13,<14.0a0 + - libcufile >=1,<2.0a0 + - libgcc >=14 + - libnvjitlink >=13.0,<14.0a0 + - libstdcxx >=14 + - python >=3.12,<3.13.0a0 + - python_abi 3.12.* *_cp312 + constrains: + - cuda-python >=13.2.0,<13.3.0a0 + - cuda-cudart >=13,<14.0a0 + license: LicenseRef-NVIDIA-SOFTWARE-LICENSE + purls: + - pkg:pypi/cuda-bindings?source=hash-mapping + size: 4018993 + timestamp: 1773284505127 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/cuda-bindings-13.2.0-py312hdc0efb6_0.conda + sha256: 609e783783f4bb44643115665923ce225619ec5f5534099ce19a312119714fc4 + md5: 89d9c83a2a367fc5dad80bb134302d9c + depends: + - cuda-nvrtc >=13,<14.0a0 + - cuda-nvvm-impl >=13,<14.0a0 + - cuda-pathfinder >=1.1.0,<2 + - cuda-version >=13,<14.0a0 + - libcufile >=1,<2.0a0 + - libgcc >=14 + - libnvjitlink >=13.0,<14.0a0 + - libstdcxx >=14 + - python >=3.12,<3.13.0a0 + - python >=3.12,<3.13.0a0 *_cpython + - python_abi 3.12.* *_cp312 + constrains: + - cuda-cudart >=13,<14.0a0 + - cuda-python >=13.2.0,<13.3.0a0 + license: LicenseRef-NVIDIA-SOFTWARE-LICENSE + purls: + - pkg:pypi/cuda-bindings?source=hash-mapping + size: 3714646 + timestamp: 1773284747607 +- conda: https://conda.anaconda.org/conda-forge/win-64/cuda-bindings-13.2.0-py312hc128f0a_0.conda + sha256: 04a8aafd54d5a42f8587706f1458e5a7491775292e3361a66ddd7fd5c517d407 + md5: 38204c165a2af6c58dfa1f59eb5e1f64 + depends: + - cuda-nvrtc >=13,<14.0a0 + - cuda-nvvm-impl >=13,<14.0a0 + - cuda-pathfinder >=1.1.0,<2 + - cuda-version >=13,<14.0a0 + - libnvjitlink >=13.0,<14.0a0 + - python >=3.12,<3.13.0a0 + - python_abi 3.12.* *_cp312 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + constrains: + - cuda-cudart >=13,<14.0a0 + - cuda-python >=13.2.0,<13.3.0a0 + license: LicenseRef-NVIDIA-SOFTWARE-LICENSE + purls: + - pkg:pypi/cuda-bindings?source=hash-mapping + size: 3575293 + timestamp: 1773284355109 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cccl_linux-64-12.9.27-ha770c72_0.conda + sha256: 2ee3b9564ca326226e5cda41d11b251482df8e7c757e333d28ec75213c75d126 + md5: 87ff6381e33b76e5b9b179a2cdd005ec + depends: + - cuda-version >=12.9,<12.10.0a0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 1150650 + timestamp: 1746189825236 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cccl_linux-64-13.3.3.3.1-ha770c72_0.conda + sha256: 66d95390d49b989f550ede42dfb3f6e82b6b729493f0843e13cd041a91682730 + md5: 56501e8a53d75afef7a2e3ca723d7569 + depends: + - cuda-version >=13.3,<13.4.0a0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 1472271 + timestamp: 1779895496841 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cccl_linux-aarch64-12.9.27-h579c4fd_0.conda + sha256: b4efaee8fa95b9ec97a462dc343914a138ece704895e33caa52ac55968f7adfa + md5: 71e4d87a72bf003bd05f05a502288b2a + depends: + - arm-variant * sbsa + - cuda-version >=12.9,<12.10.0a0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 1149299 + timestamp: 1746189919921 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cccl_linux-aarch64-13.3.3.3.1-h579c4fd_0.conda + sha256: f35385d6e5aca20274ae3d97f7859dae903b61ed5353ed68595d234beb774dfe + md5: e4cee0d90174186e1bdc9e01d6c66b90 + depends: + - arm-variant * sbsa + - cuda-version >=13.3,<13.4.0a0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 1481900 + timestamp: 1779895522474 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cccl_win-64-12.9.27-h57928b3_0.conda + sha256: 681eb1d9afd596e04329a82b04734c0e37c6ecb94b3380f3a378d61983e2a8cc + md5: 8f897dca7111f3bb4ded97ba6947b186 + depends: + - cuda-version >=12.9,<12.10.0a0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 1139649 + timestamp: 1746189858434 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cccl_win-64-13.3.3.3.1-h57928b3_0.conda + sha256: d730af2f1553511eab97a43522cae5c71ed618c65821084571a2d0655a426f4b + md5: 48f0b2f8be52ff044598069b4753f5bc + depends: + - cuda-version >=13.3,<13.4.0a0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 1462453 + timestamp: 1779895589763 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-crt-dev_linux-64-12.9.86-ha770c72_2.conda + sha256: e6257534c4b4b6b8a1192f84191c34906ab9968c92680fa09f639e7846a87304 + md5: 79d280de61e18010df5997daea4743df + depends: + - cuda-version >=12.9,<12.10.0a0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 94239 + timestamp: 1753975242354 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-crt-dev_linux-64-13.3.33-ha770c72_0.conda + sha256: bd3381629964d1d00245ae9e4a7918c35e4967d216a34aad013f0ce387065b05 + md5: 0c95fd4e823baffe0f8885f4eef00ce7 + depends: + - cuda-version >=13.3,<13.4.0a0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 116655 + timestamp: 1779905079263 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-crt-dev_linux-aarch64-12.9.86-h579c4fd_2.conda + sha256: 1db1f3ff4b0f445ce4064eb323733f7612ce28bc879dd6849e162b1504b7474a + md5: 86be43a4154301b74f823bc6fe476629 + depends: + - arm-variant * sbsa + - cuda-version >=12.9,<12.10.0a0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 94794 + timestamp: 1753975199249 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-crt-dev_linux-aarch64-13.3.33-h579c4fd_0.conda + sha256: 129008eb8a49e1c0edbb4ba33855f46aab879b975fc427c5990c945fd371d89e + md5: b865ed5c0162925511f48e5a425e42bb + depends: + - arm-variant * sbsa + - cuda-version >=13.3,<13.4.0a0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 116665 + timestamp: 1779905122757 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-crt-dev_win-64-12.9.86-h57928b3_2.conda + sha256: 2fccde18cafec3cdb6697f37c576567ac623dc69531e2a81bbc83d8a86a82d1f + md5: 569c55bd368307e48191a2ed54c64428 + depends: + - cuda-version >=12.9,<12.10.0a0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 95452 + timestamp: 1753975640812 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-crt-dev_win-64-13.3.33-h57928b3_0.conda + sha256: ed73e5072b9f4e603bb43f30988dde675174c38e45ce8120a39e6125283b3563 + md5: 7207fca55f102141c1e038577a153c1e + depends: + - cuda-version >=13.3,<13.4.0a0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 117452 + timestamp: 1779905164275 +- conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-cudart-12.9.79-h5888daf_0.conda + sha256: 57d1294ecfaf9dc8cdb5fc4be3e63ebc7614538bddb5de53cfd9b1b7de43aed5 + md5: cb15315d19b58bd9cd424084e58ad081 + depends: + - __glibc >=2.17,<3.0.a0 + - cuda-cudart_linux-64 12.9.79 h3f2d84a_0 + - cuda-version >=12.9,<12.10.0a0 + - libgcc >=13 + - libstdcxx >=13 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 23242 + timestamp: 1749218416505 +- conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-cudart-13.3.29-hecca717_0.conda + sha256: 3d74819f261d77a410e8f8ddbd973446c312ec76605d60619d9b85113eca9632 + md5: 3fc21c99786b908fd7f32ea279fc9780 + depends: + - __glibc >=2.17,<3.0.a0 + - cuda-cudart_linux-64 13.3.29 h376f20c_0 + - cuda-version >=13.3,<13.4.0a0 + - libgcc >=14 + - libstdcxx >=14 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 24659 + timestamp: 1779898425780 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/cuda-cudart-12.9.79-h3ae8b8a_0.conda + sha256: 3d6699fc27ffabf28a9d359b48e7b88437e4d945844718a58608627998db5d1b + md5: df78e19e5fe656631d1470aa0fcf6ced + depends: + - arm-variant * sbsa + - cuda-cudart_linux-aarch64 12.9.79 h3ae8b8a_0 + - cuda-version >=12.9,<12.10.0a0 + - libgcc >=13 + - libstdcxx >=13 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 23466 + timestamp: 1749218349235 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/cuda-cudart-13.3.29-h8f3c8d4_0.conda + sha256: 7b02fe40d6a503f42e4ffe83bf2512876c7e4eb5374199b03045b0e17e14ec6f + md5: 8daff8683cfa57366f88b5a980d4bd03 + depends: + - arm-variant * sbsa + - cuda-cudart_linux-aarch64 13.3.29 h8f3c8d4_0 + - cuda-version >=13.3,<13.4.0a0 + - libgcc >=14 + - libstdcxx >=14 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 24782 + timestamp: 1779898439985 +- conda: https://conda.anaconda.org/conda-forge/win-64/cuda-cudart-12.9.79-he0c23c2_0.conda + sha256: a30cd9adf3a70d069d4d87c5728ec16778b77071629612ca5d8513cd92d89c09 + md5: 0a243d4f000a0d2f51dd94ee9132b234 + depends: + - cuda-cudart_win-64 12.9.79 he0c23c2_0 + - cuda-version >=12.9,<12.10.0a0 + - ucrt >=10.0.20348.0 + - vc >=14.2,<15 + - vc14_runtime >=14.29.30139 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 170799 + timestamp: 1749218946117 +- conda: https://conda.anaconda.org/conda-forge/win-64/cuda-cudart-13.3.29-hac47afa_0.conda + sha256: c1d2727ec436cdc324d4c3e5d8256ea8bc0f9a8793773033021e5476533de719 + md5: a527f7cd2eec390cc8700a0e1878a954 + depends: + - cuda-cudart_win-64 13.3.29 hac47afa_0 + - cuda-version >=13.3,<13.4.0a0 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 215494 + timestamp: 1779898489923 +- conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-cudart-dev-12.9.79-h5888daf_0.conda + sha256: 04d8235cb3cb3510c0492c3515a9d1a6053b50ef39be42b60cafb05044b5f4c6 + md5: ba38a7c3b4c14625de45784b773f0c71 + depends: + - __glibc >=2.17,<3.0.a0 + - cuda-cudart 12.9.79 h5888daf_0 + - cuda-cudart-dev_linux-64 12.9.79 h3f2d84a_0 + - cuda-cudart-static 12.9.79 h5888daf_0 + - cuda-version >=12.9,<12.10.0a0 + - libgcc >=13 + - libstdcxx >=13 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 23687 + timestamp: 1749218464010 +- conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-cudart-dev-13.3.29-hecca717_0.conda + sha256: 050ac942737f501b5dee21c0bbfa77f4617c52269f188ab66a5e2b8b7acd0f22 + md5: e21171cc900f202b2af82f1afddbdfcf + depends: + - __glibc >=2.17,<3.0.a0 + - cuda-cudart 13.3.29 hecca717_0 + - cuda-cudart-dev_linux-64 13.3.29 h376f20c_0 + - cuda-cudart-static 13.3.29 hecca717_0 + - cuda-version >=13.3,<13.4.0a0 + - libgcc >=14 + - libstdcxx >=14 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 25129 + timestamp: 1779898446163 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/cuda-cudart-dev-12.9.79-h3ae8b8a_0.conda + sha256: d70f85411992e03494f2fe94a9852d79f366a92f40ba791611eda5551044afe9 + md5: d58cc487273764a11637456c06399ff0 + depends: + - arm-variant * sbsa + - cuda-cudart 12.9.79 h3ae8b8a_0 + - cuda-cudart-dev_linux-aarch64 12.9.79 h3ae8b8a_0 + - cuda-cudart-static 12.9.79 h3ae8b8a_0 + - cuda-version >=12.9,<12.10.0a0 + - libgcc >=13 + - libstdcxx >=13 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 23911 + timestamp: 1749218369632 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/cuda-cudart-dev-13.3.29-h8f3c8d4_0.conda + sha256: 3ac23580a5152826def6f4ef8767ad24f38433ff47d85d8d971b9b67ee192e02 + md5: ce781c2e7b35de72a2b002d58f2e0d8f + depends: + - arm-variant * sbsa + - cuda-cudart 13.3.29 h8f3c8d4_0 + - cuda-cudart-dev_linux-aarch64 13.3.29 h8f3c8d4_0 + - cuda-cudart-static 13.3.29 h8f3c8d4_0 + - cuda-version >=13.3,<13.4.0a0 + - libgcc >=14 + - libstdcxx >=14 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 25269 + timestamp: 1779898455527 +- conda: https://conda.anaconda.org/conda-forge/win-64/cuda-cudart-dev-12.9.79-he0c23c2_0.conda + sha256: 1ee68f0ffd37889f0fc438d4da7124054b124632e1c3bc15950b9851b002473e + md5: e5bb074108bc2501f8374e80748aa181 + depends: + - cuda-cudart 12.9.79 he0c23c2_0 + - cuda-cudart-dev_win-64 12.9.79 he0c23c2_0 + - cuda-cudart-static 12.9.79 he0c23c2_0 + - cuda-version >=12.9,<12.10.0a0 + - ucrt >=10.0.20348.0 + - vc >=14.2,<15 + - vc14_runtime >=14.29.30139 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 23222 + timestamp: 1749219022963 +- conda: https://conda.anaconda.org/conda-forge/win-64/cuda-cudart-dev-13.3.29-hac47afa_0.conda + sha256: 035d753771cb6736724ae08d0f4f1bb2886c590d7e06f303eb3ef47c15d39e7e + md5: b654d915abbee1382e58e49db9884f8e + depends: + - cuda-cudart 13.3.29 hac47afa_0 + - cuda-cudart-dev_win-64 13.3.29 hac47afa_0 + - cuda-cudart-static 13.3.29 hac47afa_0 + - cuda-version >=13.3,<13.4.0a0 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 24489 + timestamp: 1779898504358 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart-dev_linux-64-12.9.79-h3f2d84a_0.conda + sha256: ffe86ed0144315b276f18020d836c8ef05bf971054cf7c3eb167af92494080d5 + md5: 86e40eb67d83f1a58bdafdd44e5a77c6 + depends: + - cuda-cccl_linux-64 + - cuda-cudart-static_linux-64 + - cuda-cudart_linux-64 + - cuda-version >=12.9,<12.10.0a0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 389140 + timestamp: 1749218427266 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart-dev_linux-64-13.3.29-h376f20c_0.conda + sha256: d95f1b404119e3f72edb7ac5dbd4443e2d7d040f7d68c3905c0dd7ad78f11311 + md5: 4165013e8d24dd61774458e6f2e36c32 + depends: + - cuda-cccl_linux-64 + - cuda-cudart-static_linux-64 + - cuda-cudart_linux-64 + - cuda-version >=13.3,<13.4.0a0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 405020 + timestamp: 1779898430134 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart-dev_linux-aarch64-12.9.79-h3ae8b8a_0.conda + sha256: ad64a1ecfc933172dbc6407d71b1abb78dc7ffcd5cc871baee238350307a7c0c + md5: 60e07c05a51d5549bec1e7ee38849feb + depends: + - arm-variant * sbsa + - cuda-cccl_linux-aarch64 + - cuda-cudart-static_linux-aarch64 + - cuda-cudart_linux-aarch64 + - cuda-version >=12.9,<12.10.0a0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 388797 + timestamp: 1749218354725 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart-dev_linux-aarch64-13.3.29-h8f3c8d4_0.conda + sha256: 4e15b3a139285d1e86691d5987e7bf4b9e8cbce1df0af206e0c95299a8015644 + md5: f3855f0a74455604f9950bf91ce6d846 + depends: + - arm-variant * sbsa + - cuda-cccl_linux-aarch64 + - cuda-cudart-static_linux-aarch64 + - cuda-cudart_linux-aarch64 + - cuda-version >=13.3,<13.4.0a0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 403650 + timestamp: 1779898443931 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart-dev_win-64-12.9.79-he0c23c2_0.conda + sha256: e022d36a333420130faf6473c49f8dab54bf976cf320577ffb06db0a0797b734 + md5: 3c3e2f6b5455783fd332a072d632ea78 + depends: + - cuda-cccl_win-64 + - cuda-cudart-static_win-64 + - cuda-cudart_win-64 + - cuda-version >=12.9,<12.10.0a0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 1190184 + timestamp: 1749218971019 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart-dev_win-64-13.3.29-hac47afa_0.conda + sha256: f77605b230a88d089e4294b9b4d650dd4ec4841a0bec9f528b6b4a736299dcb1 + md5: d387bc63f2d520cb434489e41a33614d + depends: + - cuda-cccl_win-64 + - cuda-cudart-static_win-64 + - cuda-cudart_win-64 + - cuda-version >=13.3,<13.4.0a0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 1548117 + timestamp: 1779898493787 +- conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-cudart-static-12.9.79-h5888daf_0.conda + sha256: 6261e1d9af80e1ec308e3e5e2ff825d189ef922d24093beaf6efca12e67ce060 + md5: d3c4ac48f4967f09dd910d9c15d40c81 + depends: + - __glibc >=2.17,<3.0.a0 + - cuda-cudart-static_linux-64 12.9.79 h3f2d84a_0 + - cuda-version >=12.9,<12.10.0a0 + - libgcc >=13 + - libstdcxx >=13 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 23283 + timestamp: 1749218442382 +- conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-cudart-static-13.3.29-hecca717_0.conda + sha256: e2596138baef66e9b7fa08329e944d3ef8cca7c3d2da28d32bc37ff7e4801d1a + md5: 3a99ba2e09c508fd8b8b0eaf6d37a376 + depends: + - __glibc >=2.17,<3.0.a0 + - cuda-cudart-static_linux-64 13.3.29 h376f20c_0 + - cuda-version >=13.3,<13.4.0a0 + - libgcc >=14 + - libstdcxx >=14 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 24626 + timestamp: 1779898435744 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/cuda-cudart-static-12.9.79-h3ae8b8a_0.conda + sha256: dac33edcebbf557563a41521f67961039186efbc276903d937b32243ef3be937 + md5: 365adcddf99b81eb323698fda31d507c + depends: + - arm-variant * sbsa + - cuda-cudart-static_linux-aarch64 12.9.79 h3ae8b8a_0 + - cuda-version >=12.9,<12.10.0a0 + - libgcc >=13 + - libstdcxx >=13 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 23507 + timestamp: 1749218358755 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/cuda-cudart-static-13.3.29-h8f3c8d4_0.conda + sha256: 8f83d5e859f3ef949589b4ef2bf1eb0a99d02ad2941c6f9c0a802b96a1d65c25 + md5: a40f6427160d6394dfa189276386be91 + depends: + - arm-variant * sbsa + - cuda-cudart-static_linux-aarch64 13.3.29 h8f3c8d4_0 + - cuda-version >=13.3,<13.4.0a0 + - libgcc >=14 + - libstdcxx >=14 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 24786 + timestamp: 1779898447855 +- conda: https://conda.anaconda.org/conda-forge/win-64/cuda-cudart-static-12.9.79-he0c23c2_0.conda + sha256: 02d3ff9ec59c7f59132ffe9398746ad9422a75706e7cad19acc6c30a5c0fc763 + md5: 718879691b8119c893f587f46c734fca + depends: + - cuda-cudart-static_win-64 12.9.79 he0c23c2_0 + - cuda-version >=12.9,<12.10.0a0 + - ucrt >=10.0.20348.0 + - vc >=14.2,<15 + - vc14_runtime >=14.29.30139 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 23249 + timestamp: 1749218998822 +- conda: https://conda.anaconda.org/conda-forge/win-64/cuda-cudart-static-13.3.29-hac47afa_0.conda + sha256: 685533b8d9b7a65810fd86da7d2c605ddb4ba1270591d7137be995c0dbf4661b + md5: a5a881ac16787902dc51e5d7b6c870c1 + depends: + - cuda-cudart-static_win-64 13.3.29 hac47afa_0 + - cuda-version >=13.3,<13.4.0a0 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 24488 + timestamp: 1779898500699 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart-static_linux-64-12.9.79-h3f2d84a_0.conda + sha256: d435f8a19b59b52ce460ee3a6bfd877288a0d1d645119a6ba60f1c3627dc5032 + md5: b87bf315d81218dd63eb46cc1eaef775 + depends: + - cuda-version >=12.9,<12.10.0a0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 1148889 + timestamp: 1749218381225 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart-static_linux-64-13.3.29-h376f20c_0.conda + sha256: fa920f2c2154ea2ace2d55457e43af8e7bfc2c94fa5ec7276792ad411d1011d1 + md5: 7d4fe2a79d971522b3ad68b772c197eb + depends: + - cuda-version >=13.3,<13.4.0a0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 1126340 + timestamp: 1779898412056 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart-static_linux-aarch64-12.9.79-h3ae8b8a_0.conda + sha256: d4be038bad9abf0eac1e88dc57c8db6a469db8eb5d7c281085dfbb018ef84212 + md5: 52498fedeb43bbd4c45f84a0fb722d21 + depends: + - arm-variant * sbsa + - cuda-version >=12.9,<12.10.0a0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 1152498 + timestamp: 1749218333554 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart-static_linux-aarch64-13.3.29-h8f3c8d4_0.conda + sha256: efccfa33242cc65deb11312f46244da2e07ba8332352d31f0565e8243215fe09 + md5: 464a04d3d8ffcba349f4e21553dfbcdd + depends: + - arm-variant * sbsa + - cuda-version >=13.3,<13.4.0a0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 1133087 + timestamp: 1779898428591 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart-static_win-64-12.9.79-he0c23c2_0.conda + sha256: 6a3410cd7ce07955cb705801055ef129ebee1cd6390c6fe9e5f607b67c3dba36 + md5: 0dd152a1493d90356037604a865f050f + depends: + - cuda-version >=12.9,<12.10.0a0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 354611 + timestamp: 1749218544740 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart-static_win-64-13.3.29-hac47afa_0.conda + sha256: c837c4eaadbca4426f93ff99b4a0f05ca199f0fb43ec0eac4bd30a2cec4257d0 + md5: 999b16444442cf6d914cecef070d13de + depends: + - cuda-version >=13.3,<13.4.0a0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 83026 + timestamp: 1779898478182 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart_linux-64-12.9.79-h3f2d84a_0.conda + sha256: 6cde0ace2b995b49d0db2eefb7bc30bf00ffc06bb98ef7113632dec8f8907475 + md5: 64508631775fbbf9eca83c84b1df0cae + depends: + - cuda-version >=12.9,<12.10.0a0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 197249 + timestamp: 1749218394213 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart_linux-64-13.3.29-h376f20c_0.conda + sha256: a86028f94acf37b17ca2280734ae9dcc407cdf68a9c400102d323a3b15e52f0b + md5: 10949c6dfe9157fedb19170bd6e0b835 + depends: + - cuda-version >=13.3,<13.4.0a0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 206064 + timestamp: 1779898416941 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart_linux-aarch64-12.9.79-h3ae8b8a_0.conda + sha256: 4900ff2f000a4f8a70a7bc8576469640aa6590618fa9e73c84e066e025dcb760 + md5: cc2459ad427431e089d78d760cf24437 + depends: + - arm-variant * sbsa + - cuda-version >=12.9,<12.10.0a0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 212993 + timestamp: 1749218341193 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart_linux-aarch64-13.3.29-h8f3c8d4_0.conda + sha256: 15f0614bd0ae66c43148539d1c7cd4bbbd1b13aa14045a2339df5737e3d6e36e + md5: 4a7f98cadd8be6b7dcce34764fb38997 + depends: + - arm-variant * sbsa + - cuda-version >=13.3,<13.4.0a0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 222441 + timestamp: 1779898433566 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart_win-64-12.9.79-he0c23c2_0.conda + sha256: 6a89a53cdbcfafa0bb55abee1b58492c6a9a28e688abe04f48f0d01649c5f3e4 + md5: 71c9c2ab52226f990f268164381d8494 + depends: + - cuda-version >=12.9,<12.10.0a0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 23260 + timestamp: 1749218569458 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-cudart_win-64-13.3.29-hac47afa_0.conda + sha256: 3b858e8593d00fa36a6786d1c3d981369f84ae68d3700349dba4c1e4d779c904 + md5: f0253958e16223aabcc8b5561a6f98a7 + depends: + - cuda-version >=13.3,<13.4.0a0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 24659 + timestamp: 1779898481919 +- conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-nvrtc-12.9.86-hecca717_1.conda + sha256: 68f81268c25befa9b70dc49af469ab0eb131960e3700b9a4edb46a32da343a28 + md5: 53f0062e2243b26e43ddac0b5267c6a3 + depends: + - __glibc >=2.17,<3.0.a0 + - cuda-version >=12.9,<12.10.0a0 + - libgcc >=14 + - libstdcxx >=14 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 67168282 + timestamp: 1760723629347 +- conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-nvrtc-13.3.33-hecca717_0.conda + sha256: a70641e7d81694f57c7df46a17b657594393082dad667532c29df9540b7f99ca + md5: 57124a775cb937bb2bfd10f09a230430 + depends: + - __glibc >=2.17,<3.0.a0 + - cuda-version >=13.3,<13.4.0a0 + - libgcc >=14 + - libstdcxx >=14 + license: LicenseRef-NVIDIA-End-User-License-Agreement + purls: [] + size: 39254802 + timestamp: 1779897349474 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/cuda-nvrtc-12.9.86-h8f3c8d4_1.conda + sha256: e7f8d835d7bf993dcad9fba6db5af89c35b2b4f0282799b729bf6ad2c3bd896d + md5: 48187c09673a42f9930764e8170b8787 + depends: + - arm-variant * sbsa + - cuda-version >=12.9,<12.10.0a0 + - libgcc >=14 + - libstdcxx >=14 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 33382016 + timestamp: 1760723722396 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/cuda-nvrtc-13.3.33-h8f3c8d4_0.conda + sha256: cd16532e362662c88f6bc3b009457b3d36b33ca990f0deabece6def7d44aaa72 + md5: 7147a017b16d0d7c93c53d261e0ef0b6 + depends: + - arm-variant * sbsa + - cuda-version >=13.3,<13.4.0a0 + - libgcc >=14 + - libstdcxx >=14 + license: LicenseRef-NVIDIA-End-User-License-Agreement + purls: [] + size: 37806494 + timestamp: 1779897383028 +- conda: https://conda.anaconda.org/conda-forge/win-64/cuda-nvrtc-12.9.86-hac47afa_1.conda + sha256: d90ef446ac859db26286a5d39d39333c4e4cee31ba5042b5c7922bd25de531f6 + md5: d68b5d96a53c80dc3dbbd8f7c3b8106d + depends: + - cuda-version >=12.9,<12.10.0a0 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 58467504 + timestamp: 1760723834711 +- conda: https://conda.anaconda.org/conda-forge/win-64/cuda-nvrtc-13.3.33-hac47afa_0.conda + sha256: 7306b27c3a70cf1c35d4d200c1936037c9d6484322a39fac1967439a20585003 + md5: ab010d7a1be0e140b65f6bf8473180fb + depends: + - cuda-version >=13.3,<13.4.0a0 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: LicenseRef-NVIDIA-End-User-License-Agreement + purls: [] + size: 35152509 + timestamp: 1779897499641 +- conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-nvvm-12.9.86-h69a702a_6.conda + sha256: 5c70d91e6d30eb6000ea036558a20fd0b1bc13cdd2c04fd5dbf94d9caa0a7fbc + md5: 704956f67e44ddf046565ead01f9efcd + depends: + - cuda-nvvm-dev_linux-64 12.9.86.* + - cuda-nvvm-impl 12.9.86.* + - cuda-nvvm-tools 12.9.86.* + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 25475 + timestamp: 1771619493286 +- conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-nvvm-13.3.33-h69a702a_0.conda + sha256: 5a379ec765df86fa34c253033fff9e916b3b8a01fc6a8ab2ec451e2ac7b57a2c + md5: 6dc6ffa1da0abc6d1fa4f5385aa93040 + depends: + - cuda-nvvm-dev_linux-64 13.3.33.* + - cuda-nvvm-impl 13.3.33.* + - cuda-nvvm-tools 13.3.33.* + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 25697 + timestamp: 1779909800589 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/cuda-nvvm-12.9.86-he9431aa_106.conda + sha256: 97bf1688e3847090d1c4193c39ca575a67e2183d0c20ddf8bcedc0f9d9528bbc + md5: 8ace2a8121a5f733a902822290aae11c + depends: + - cuda-nvvm-dev_linux-aarch64 12.9.86.* + - cuda-nvvm-impl 12.9.86.* + - cuda-nvvm-tools 12.9.86.* + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 25585 + timestamp: 1771619514901 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/cuda-nvvm-13.3.33-he9431aa_0.conda + sha256: cf2ee921c3e8bb70872b0e146f7809d02f45c894e12bf93537fc0523ecc370a8 + md5: b69f69843b228a650173716b23b1d834 + depends: + - cuda-nvvm-dev_linux-aarch64 13.3.33.* + - cuda-nvvm-impl 13.3.33.* + - cuda-nvvm-tools 13.3.33.* + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 25733 + timestamp: 1779909827964 +- conda: https://conda.anaconda.org/conda-forge/win-64/cuda-nvvm-12.9.86-h719f0c7_6.conda + sha256: 020a5bb67a35654f391d21b170ba763f95b7f133fec5678d69e676559dcd5653 + md5: b162c7fb8b19f9102bd5f801d7f58ca2 + depends: + - cuda-nvvm-dev_win-64 12.9.86.* + - cuda-nvvm-impl 12.9.86.* + - cuda-nvvm-tools 12.9.86.* + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 26007 + timestamp: 1771619504675 +- conda: https://conda.anaconda.org/conda-forge/win-64/cuda-nvvm-13.3.33-h719f0c7_0.conda + sha256: d63d8a093e2390976ef5732996248fe683f153764553a98f5096de7252fb31bb + md5: 28b7994501f69efa53dbf1ebe9f9b350 + depends: + - cuda-nvvm-dev_win-64 13.3.33.* + - cuda-nvvm-impl 13.3.33.* + - cuda-nvvm-tools 13.3.33.* + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 26223 + timestamp: 1779909907942 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-nvvm-dev_linux-64-12.9.86-ha770c72_2.conda + sha256: 522722dcaffd133e0c7500c69dc70e21ac34d6762dcbaabfe847439f944028f0 + md5: 7b386291414c7eea113d25ac28a33772 + depends: + - cuda-version >=12.9,<12.10.0a0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 27096 + timestamp: 1753975261562 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-nvvm-dev_linux-64-13.3.33-ha770c72_0.conda + sha256: a7eada853603adf6bed7022384b2b4ddb6d27b348a23a271f75caefa141ea954 + md5: b1b8dcad428089c6ddc16e0f4ac2631d + depends: + - cuda-version >=13.3,<13.4.0a0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 28476 + timestamp: 1779905085657 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-nvvm-dev_linux-aarch64-12.9.86-h579c4fd_2.conda + sha256: 5f27299818ecef44d6cf46a99465671744f6074c14618b5f8491a03a62942a7f + md5: c59b036058d7bf78ac0a99618c321e85 + depends: + - arm-variant * sbsa + - cuda-version >=12.9,<12.10.0a0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 27218 + timestamp: 1753975206503 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-nvvm-dev_linux-aarch64-13.3.33-h579c4fd_0.conda + sha256: 68c76156498287e1fcffd5d0fb2a83b99b570e3efacf2e9416dfc9a356384738 + md5: 89a0f306085d404e6e774edc5d812679 + depends: + - arm-variant * sbsa + - cuda-version >=13.3,<13.4.0a0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 28720 + timestamp: 1779905125664 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-nvvm-dev_win-64-12.9.86-h57928b3_2.conda + sha256: 455dbf0ec81efdbd40c0387d82c77689721f6d34b6e7694ca0d51bad9392eddc + md5: 23f7e70c03eabd2139b5e659c8e188b4 + depends: + - cuda-version >=12.9,<12.10.0a0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 27284 + timestamp: 1753975714790 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-nvvm-dev_win-64-13.3.33-h57928b3_0.conda + sha256: 295a4555e021ec3d4a35009a46b9a190c24e33f27e54e2575472c332fd52f204 + md5: c437c34990ce67cd1defa7f98a674417 + depends: + - cuda-version >=13.3,<13.4.0a0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 28779 + timestamp: 1779905174253 +- conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-nvvm-impl-12.9.86-h4bc722e_2.conda + sha256: f4d34556174e4faa9d374ba2244707082870e1bbc1bb441ad3d9d2cea37da6af + md5: 82125dd3c0c4aa009faa00e2829b93d8 + depends: + - __glibc >=2.17,<3.0.a0 + - cuda-version >=12.9,<12.10.0a0 + - libgcc >=12 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 21425520 + timestamp: 1753975283188 +- conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-nvvm-impl-13.3.33-h4bc722e_0.conda + sha256: 1ea87e853ba917c14b222da1bff5179a3aa490ca5fd64e9ff1b865d2ca62e569 + md5: 3cdad839773c71e550927c626f8ba5fa + depends: + - __glibc >=2.17,<3.0.a0 + - cuda-version >=13.3,<13.4.0a0 + - libgcc >=12 + license: LicenseRef-NVIDIA-End-User-License-Agreement + purls: [] + size: 22428462 + timestamp: 1779905092854 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/cuda-nvvm-impl-12.9.86-h7b14b0b_2.conda + sha256: 100accfc6f608004ddef4b9004ee5179eddbac19e7d5c4c7bd5e6e8b71bd7c5d + md5: 8e9fceb7b677be7107cc9c20f8d71d86 + depends: + - arm-variant * sbsa + - cuda-version >=12.9,<12.10.0a0 + - libgcc >=12 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 21601172 + timestamp: 1753975236344 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/cuda-nvvm-impl-13.3.33-h7b14b0b_0.conda + sha256: e90b28ba3cac0f00acb5090693f7aaca46884ed9bd2d6fabec2b2c2c753be795 + md5: aee27037173867115c798567ba92c876 + depends: + - arm-variant * sbsa + - cuda-version >=13.3,<13.4.0a0 + - libgcc >=12 + license: LicenseRef-NVIDIA-End-User-License-Agreement + purls: [] + size: 21556608 + timestamp: 1779905144993 +- conda: https://conda.anaconda.org/conda-forge/win-64/cuda-nvvm-impl-12.9.86-h2466b09_2.conda + sha256: 7b995ea653816b129bae6e4ee92898824a39fe82227472537bf75ac6ece7e955 + md5: d8cea7bc32045bde718d0b1ceb595445 + depends: + - cuda-version >=12.9,<12.10.0a0 + - ucrt >=10.0.20348.0 + - vc >=14.2,<15 + - vc14_runtime >=14.29.30139 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 31168 + timestamp: 1753975780038 +- conda: https://conda.anaconda.org/conda-forge/win-64/cuda-nvvm-impl-13.3.33-h2466b09_0.conda + sha256: 64393c62eb39d09b1be9cecddd6721fa018f67f1d598d89ff63a36d4d1dac221 + md5: 0aa6111a0d7a368cc75e261d020a2c07 + depends: + - cuda-version >=13.3,<13.4.0a0 + - ucrt >=10.0.20348.0 + - vc >=14.2,<15 + - vc14_runtime >=14.29.30139 + license: LicenseRef-NVIDIA-End-User-License-Agreement + purls: [] + size: 32862 + timestamp: 1779905180272 +- conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-nvvm-tools-12.9.86-h4bc722e_2.conda + sha256: 45f5e881ed0d973132a5475a0b5c066db6e748ef3a831a14dba8374b252e0067 + md5: f9af26e4079adcd72688a8e8dbecb229 + depends: + - __glibc >=2.17,<3.0.a0 + - cuda-version >=12.9,<12.10.0a0 + - libgcc >=12 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 24246736 + timestamp: 1753975332907 +- conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-nvvm-tools-13.3.33-h4bc722e_0.conda + sha256: 3fc9d3ba08b4a3b5fd0065f048e8c6007a8ca1c8df07b3538f4b61435ecbc2ac + md5: 99365fca01f05b4255c79180e6e86a43 + depends: + - __glibc >=2.17,<3.0.a0 + - cuda-version >=13.3,<13.4.0a0 + - libgcc >=12 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 29720382 + timestamp: 1779905121216 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/cuda-nvvm-tools-12.9.86-h7b14b0b_2.conda + sha256: f5cf91e491e150e37cd224fa648c07f6b1cd2cbfee5affba10625df7ba0b0425 + md5: 9a35dcda5573a713183f5159ec282364 + depends: + - arm-variant * sbsa + - cuda-version >=12.9,<12.10.0a0 + - libgcc >=12 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 24411824 + timestamp: 1753975273689 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/cuda-nvvm-tools-13.3.33-h7b14b0b_0.conda + sha256: cce5ef4c36f3db60909fc5bbbe138dfbf51d237d880cea77e366db33d97cac56 + md5: 6c981201b590365bbe2fd8af4f8a1675 + depends: + - arm-variant * sbsa + - cuda-version >=13.3,<13.4.0a0 + - libgcc >=12 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 29031580 + timestamp: 1779905175228 +- conda: https://conda.anaconda.org/conda-forge/win-64/cuda-nvvm-tools-12.9.86-h2466b09_2.conda + sha256: 5692a559206420f77e376a598329db966da762ad574866f9cc80a447d26ac49c + md5: 25e269101d3eb39715a48998bc04289e + depends: + - cuda-version >=12.9,<12.10.0a0 + - ucrt >=10.0.20348.0 + - vc >=14.2,<15 + - vc14_runtime >=14.29.30139 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 40286977 + timestamp: 1753975898550 +- conda: https://conda.anaconda.org/conda-forge/win-64/cuda-nvvm-tools-13.3.33-h2466b09_0.conda + sha256: aac4f4ddb2d612350269e58364b5aa1142612838d429d493e2816a1626e41883 + md5: 394839d70f28114ece1f2e4efac66523 + depends: + - cuda-version >=13.3,<13.4.0a0 + - ucrt >=10.0.20348.0 + - vc >=14.2,<15 + - vc14_runtime >=14.29.30139 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 45453672 + timestamp: 1779905194696 +- conda: ../cuda_pathfinder + name: cuda-pathfinder + version: 1.3.4a0 + build: pyh4616a5c_0 + subdir: noarch + variants: + target_platform: noarch + depends: + - python >=3.10 + - python * + license: Apache-2.0 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-pathfinder-1.5.2-pyhc364b38_0.conda + sha256: 8d1c8a686dd0b1b131eb6dd91aaf35b9cd9c256e26bfebe702683c32bee82798 + md5: 63c7ba46fbfc291fab512005c1753041 + depends: + - python >=3.10 + - cuda-version >=12.0,<14 + - python + license: Apache-2.0 + purls: + - pkg:pypi/cuda-pathfinder?source=hash-mapping + size: 44855 + timestamp: 1775517790256 +- conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-profiler-api-12.9.79-h7938cbb_1.conda + sha256: 4f679dfbf2bf2d17abb507f31b0176c0e3572337b5005b9e36179948a53988ac + md5: 90d09865fb37d11d510444e34ebe6a09 + depends: + - cuda-cudart-dev + - cuda-version >=12.9,<12.10.0a0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 23668 + timestamp: 1761098836058 +- conda: https://conda.anaconda.org/conda-forge/linux-64/cuda-profiler-api-13.3.27-h7938cbb_0.conda + sha256: 716eb13fe58332ed1d5079edae720177da0aeb3bb51cb5a05072385faa8dd704 + md5: a251ae89c6c9a7f5e8a39adc9a3041bd + depends: + - cuda-cudart-dev + - cuda-version >=13.3,<13.4.0a0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 25007 + timestamp: 1779913616712 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/cuda-profiler-api-12.9.79-h16bee8c_1.conda + sha256: 6fa8a4d4548b114acd3c9849b65b5d9fcf1ca8f39cd2b792ce5167a51955100c + md5: 875bfddc9855f12e9f518ef8e44c2d85 + depends: + - arm-variant * sbsa + - cuda-cudart-dev + - cuda-version >=12.9,<12.10.0a0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 23784 + timestamp: 1761098779882 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/cuda-profiler-api-13.3.27-h16bee8c_0.conda + sha256: edee9a24047014874cb0b324702967f7a99c0b209bee96544eb84de8714a3306 + md5: a2ea427fd6a0c3fc57d32e541b13f912 + depends: + - arm-variant * sbsa + - cuda-cudart-dev + - cuda-version >=13.3,<13.4.0a0 + constrains: + - arm-variant * sbsa + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 25101 + timestamp: 1779913642980 +- conda: https://conda.anaconda.org/conda-forge/win-64/cuda-profiler-api-12.9.79-h57928b3_1.conda + sha256: e2ea70bfd20decd9e8401b5388693e1fd8e25a120580338a22b8b890f4933520 + md5: 57d6f85f552878de71f8136cc6d2ab16 + depends: + - cuda-cudart-dev + - cuda-version >=12.9,<12.10.0a0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 24150 + timestamp: 1761098813665 +- conda: https://conda.anaconda.org/conda-forge/win-64/cuda-profiler-api-13.3.27-h57928b3_0.conda + sha256: 51e619f0151a0b109671abfc6daa7761e17054f7d570c2e50dc7141745dd633c + md5: 024766ae1ca6cbe87200bf11d9643039 + depends: + - cuda-cudart-dev + - cuda-version >=13.3,<13.4.0a0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 25690 + timestamp: 1779913686281 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-version-12.9-h4f385c5_3.conda + sha256: 5f5f428031933f117ff9f7fcc650e6ea1b3fef5936cf84aa24af79167513b656 + md5: b6d5d7f1c171cbd228ea06b556cfa859 + constrains: + - cudatoolkit 12.9|12.9.* + - __cuda >=12 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 21578 + timestamp: 1746134436166 +- conda: https://conda.anaconda.org/conda-forge/noarch/cuda-version-13.3-hcbadf70_3.conda + sha256: bd8ee668f416bdd0f6548b2413550ae83d3834665a5be869a2daf99233ec526e + md5: 0fd72afdcc74560b80eb74b78767c454 + constrains: + - __cuda >=13 + - cudatoolkit 13.3|13.3.* + license: LicenseRef-NVIDIA-End-User-License-Agreement + purls: [] + size: 22083 + timestamp: 1779891651771 +- conda: https://conda.anaconda.org/conda-forge/linux-64/cython-3.2.3-py314h1807b08_0.conda + sha256: a0e2ed0efefb82278e0fd1d455d10d1095d951a896591838b30674aa872300c4 + md5: f0658a93053b13335be941289d7d6160 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libstdcxx >=14 + - python >=3.14,<3.15.0a0 + - python_abi 3.14.* *_cp314 + license: Apache-2.0 + license_family: APACHE + size: 3797747 + timestamp: 1765651158436 +- conda: https://conda.anaconda.org/conda-forge/linux-64/cython-3.2.4-py312h68e6be4_0.conda + sha256: 01b815091e0c534a5f32a830b514e31c150dc2f539b7ba1d5c70b6d095a5ebcf + md5: 14f638dad5953c83443a2c4f011f1c9e + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libstdcxx >=14 + - python >=3.12,<3.13.0a0 + - python_abi 3.12.* *_cp312 + license: Apache-2.0 + license_family: APACHE + purls: + - pkg:pypi/cython?source=hash-mapping + size: 3738170 + timestamp: 1767577770165 +- conda: https://conda.anaconda.org/conda-forge/linux-64/cython-3.2.4-py314h1807b08_0.conda + sha256: f700d10c2a794710a1656a6fdb8908fb04f3c7812ac4f17187777646ede1a3d9 + md5: 866fd3d25b767bccb4adc8476f4035cd + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libstdcxx >=14 + - python >=3.14,<3.15.0a0 + - python_abi 3.14.* *_cp314 + license: Apache-2.0 + license_family: APACHE + size: 3806945 + timestamp: 1767576996860 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/cython-3.2.3-py314h4c416a3_0.conda + sha256: 431042164f0f50ce173be72d96f6a9ec069d1a4846f19ff8cf616ea98678a090 + md5: e641cbdecc93a5e243af87d198edc716 + depends: + - libgcc >=14 + - libstdcxx >=14 + - python >=3.14,<3.15.0a0 + - python >=3.14,<3.15.0a0 *_cp314 + - python_abi 3.14.* *_cp314 + license: Apache-2.0 + license_family: APACHE + size: 3701570 + timestamp: 1765651306767 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/cython-3.2.4-py312he940de5_0.conda + sha256: 30bfb6445b8ae8022996283faa2d918393b1f0f78e37014995e1733e50df4303 + md5: 2f50ec4afc8e9f402b9041e9cee62744 + depends: + - libgcc >=14 + - libstdcxx >=14 + - python >=3.12,<3.13.0a0 + - python >=3.12,<3.13.0a0 *_cpython + - python_abi 3.12.* *_cp312 + license: Apache-2.0 + license_family: APACHE + purls: + - pkg:pypi/cython?source=hash-mapping + size: 3629503 + timestamp: 1767577211661 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/cython-3.2.4-py314h4c416a3_0.conda + sha256: 1369b5b23d9451ae3ef678cb68678778a6ea164186bc8ebe6539a1d6fa803da8 + md5: 822c83a4ba5a12101695ba39607c338f + depends: + - libgcc >=14 + - libstdcxx >=14 + - python >=3.14,<3.15.0a0 + - python >=3.14,<3.15.0a0 *_cp314 + - python_abi 3.14.* *_cp314 + license: Apache-2.0 + license_family: APACHE + size: 3707806 + timestamp: 1767577060898 +- conda: https://conda.anaconda.org/conda-forge/win-64/cython-3.2.3-py314h344ed54_0.conda + sha256: 6406b67af71dc477f891e6380eb6021d012ea467635c432017f08f954fa2b98d + md5: 91e2ed41320f5c89cc6d77ef47a820cd + depends: + - python >=3.14,<3.15.0a0 + - python_abi 3.14.* *_cp314 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: Apache-2.0 + license_family: APACHE + size: 3336844 + timestamp: 1765651351516 +- conda: https://conda.anaconda.org/conda-forge/win-64/cython-3.2.4-py312hd245ac3_0.conda + sha256: 68e921fad16accb32e86c7c73abaea7d49c9346e078924d0a593f821672a5a0c + md5: 575ebca0d973015c21087b800bc48515 + depends: + - python >=3.12,<3.13.0a0 + - python_abi 3.12.* *_cp312 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: Apache-2.0 + license_family: APACHE + purls: + - pkg:pypi/cython?source=hash-mapping + size: 3285032 + timestamp: 1767577225362 +- conda: https://conda.anaconda.org/conda-forge/win-64/cython-3.2.4-py314h344ed54_0.conda + sha256: c2e08246f2e6f38b5793ebc8d36de32704e4f152ed959ab0558d529580610e0e + md5: 545afbc1940d8a81f114b9c14eecf2ca + depends: + - python >=3.14,<3.15.0a0 + - python_abi 3.14.* *_cp314 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: Apache-2.0 + license_family: APACHE + size: 3332872 + timestamp: 1767577440799 +- conda: https://conda.anaconda.org/conda-forge/linux-64/dav1d-1.2.1-hd590300_0.conda + sha256: 22053a5842ca8ee1cf8e1a817138cdb5e647eb2c46979f84153f6ad7bde73020 + md5: 418c6ca5929a611cbd69204907a83995 + depends: + - libgcc-ng >=12 + license: BSD-2-Clause + license_family: BSD + size: 760229 + timestamp: 1685695754230 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/dav1d-1.2.1-h31becfc_0.conda + sha256: 33fe66d025cf5bac7745196d1a3dd7a437abcf2dbce66043e9745218169f7e17 + md5: 6e5a87182d66b2d1328a96b61ca43a62 + depends: + - libgcc-ng >=12 + license: BSD-2-Clause + license_family: BSD + size: 347363 + timestamp: 1685696690003 +- conda: https://conda.anaconda.org/conda-forge/win-64/dav1d-1.2.1-hcfcfb64_0.conda + sha256: 2aa2083c9c186da7d6f975ccfbef654ed54fff27f4bc321dbcd12cee932ec2c4 + md5: ed2c27bda330e3f0ab41577cf8b9b585 + depends: + - ucrt >=10.0.20348.0 + - vc >=14.2,<15 + - vc14_runtime >=14.29.30139 + license: BSD-2-Clause + license_family: BSD + size: 618643 + timestamp: 1685696352968 +- conda: https://conda.anaconda.org/conda-forge/linux-64/dbus-1.16.2-h24cb091_1.conda + sha256: 8bb557af1b2b7983cf56292336a1a1853f26555d9c6cecf1e5b2b96838c9da87 + md5: ce96f2f470d39bd96ce03945af92e280 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libstdcxx >=14 + - libzlib >=1.3.1,<2.0a0 + - libglib >=2.86.2,<3.0a0 + - libexpat >=2.7.3,<3.0a0 + license: AFL-2.1 OR GPL-2.0-or-later + size: 447649 + timestamp: 1764536047944 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/dbus-1.16.2-h70963c4_1.conda + sha256: 3af801577431af47c0b72a82bb93c654f03072dece0a2a6f92df8a6802f52a22 + md5: a4b6b82427d15f0489cef0df2d82f926 + depends: + - libstdcxx >=14 + - libgcc >=14 + - libglib >=2.86.2,<3.0a0 + - libzlib >=1.3.1,<2.0a0 + - libexpat >=2.7.3,<3.0a0 + license: AFL-2.1 OR GPL-2.0-or-later + size: 480416 + timestamp: 1764536098891 +- conda: https://conda.anaconda.org/conda-forge/linux-64/debugpy-1.8.20-py312h8285ef7_0.conda + sha256: f20121b67149ff80bf951ccae7442756586d8789204cd08ade59397b22bfd098 + md5: ee1b48795ceb07311dd3e665dd4f5f33 + depends: + - python + - libgcc >=14 + - libstdcxx >=14 + - __glibc >=2.17,<3.0.a0 + - python_abi 3.12.* *_cp312 + license: MIT + license_family: MIT + purls: + - pkg:pypi/debugpy?source=hash-mapping + size: 2858582 + timestamp: 1769744978783 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/debugpy-1.8.20-py312hf55c4e8_0.conda + sha256: c041ed2da3fd1e237972a360cb0f532a0caf66f571fdc9ec2cc07ccb48b8c665 + md5: d7ee86593223e812e41612678c26a10d + depends: + - python + - libstdcxx >=14 + - libgcc >=14 + - python 3.12.* *_cpython + - python_abi 3.12.* *_cp312 + license: MIT + license_family: MIT + purls: + - pkg:pypi/debugpy?source=hash-mapping + size: 2820348 + timestamp: 1769745006474 +- conda: https://conda.anaconda.org/conda-forge/win-64/debugpy-1.8.20-py312ha1a9051_0.conda + sha256: 5a886b1af3c66bf58213c7f3d802ea60fe8218313d9072bc1c9e8f7840548ba0 + md5: 032746a0b0663920f0afb18cec61062b + depends: + - python + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + - ucrt >=10.0.20348.0 + - python_abi 3.12.* *_cp312 + license: MIT + license_family: MIT + purls: + - pkg:pypi/debugpy?source=hash-mapping + size: 3996113 + timestamp: 1769745013982 +- conda: https://conda.anaconda.org/conda-forge/noarch/decorator-5.2.1-pyhd8ed1ab_0.conda + sha256: c17c6b9937c08ad63cb20a26f403a3234088e57d4455600974a0ce865cb14017 + md5: 9ce473d1d1be1cc3810856a48b3fab32 + depends: + - python >=3.9 + license: BSD-2-Clause + license_family: BSD + purls: + - pkg:pypi/decorator?source=hash-mapping + size: 14129 + timestamp: 1740385067843 +- conda: https://conda.anaconda.org/conda-forge/noarch/dict2css-0.3.0.post1-pyhd8ed1ab_1.conda + sha256: 3aa044441dcea3afb935a48a075b59ed14dabb7ee6e019a757ff68d6b13c0a36 + md5: 103dc54172d3083adcda6bf8f1addcf3 + depends: + - cssutils >=2.2.0 + - domdf-python-tools >=2.2.0 + - python >=3.9 + license: MIT + license_family: MIT + purls: + - pkg:pypi/dict2css?source=hash-mapping + size: 13700 + timestamp: 1738250096666 +- conda: https://conda.anaconda.org/conda-forge/noarch/docutils-0.21.2-pyhd8ed1ab_1.conda + sha256: fa5966bb1718bbf6967a85075e30e4547901410cc7cb7b16daf68942e9a94823 + md5: 24c1ca34138ee57de72a943237cde4cc + depends: + - python >=3.9 + license: CC-PDDC AND BSD-3-Clause AND BSD-2-Clause AND ZPL-2.1 + purls: + - pkg:pypi/docutils?source=hash-mapping + size: 402700 + timestamp: 1733217860944 +- conda: https://conda.anaconda.org/conda-forge/noarch/domdf-python-tools-3.10.0-pyhff2d567_0.conda + sha256: e7a7121de51caa332e73a0a7345d78fb514a8460311347be5d8eba0738c66c31 + md5: 0254332c3957f0ae09a58670c2d7ea01 + depends: + - importlib-metadata >=3.6.0 + - importlib-resources >=3.0.0 + - natsort >=7.0.1 + - python >=3.9 + - typing-extensions >=3.7.4.1 + license: MIT + license_family: MIT + purls: + - pkg:pypi/domdf-python-tools?source=hash-mapping + size: 96253 + timestamp: 1739444562482 +- conda: https://conda.anaconda.org/conda-forge/noarch/enum_tools-0.13.0-pyhd8ed1ab_0.conda + sha256: 07f06106f9c15d36dff4694d1191e7c0f42273f175ad8d7abbffd347dfe33d4c + md5: 8b259cc3194c36e0235f873c6dae9eef + depends: + - pygments >=2.6.1 + - python >=3.9 + - typing-extensions >=3.7.4.3 + constrains: + - sphinx >=3.4.0 + - sphinx-toolbox >=2.16.0 + license: LGPL-3.0-or-later + license_family: LGPL + purls: + - pkg:pypi/enum-tools?source=hash-mapping + size: 24762 + timestamp: 1744913087216 +- conda: https://conda.anaconda.org/conda-forge/noarch/exceptiongroup-1.3.1-pyhd8ed1ab_0.conda + sha256: ee6cf346d017d954255bbcbdb424cddea4d14e4ed7e9813e429db1d795d01144 + md5: 8e662bd460bda79b1ea39194e3c4c9ab + depends: + - python >=3.10 + - typing_extensions >=4.6.0 + license: MIT and PSF-2.0 + purls: + - pkg:pypi/exceptiongroup?source=hash-mapping + size: 21333 + timestamp: 1763918099466 +- conda: https://conda.anaconda.org/conda-forge/noarch/executing-2.2.1-pyhd8ed1ab_0.conda + sha256: 210c8165a58fdbf16e626aac93cc4c14dbd551a01d1516be5ecad795d2422cad + md5: ff9efb7f7469aed3c4a8106ffa29593c + depends: + - python >=3.10 + license: MIT + license_family: MIT + purls: + - pkg:pypi/executing?source=hash-mapping + size: 30753 + timestamp: 1756729456476 +- conda: https://conda.anaconda.org/conda-forge/linux-64/ffmpeg-8.0.1-gpl_hb3f9226_906.conda + sha256: 7992f272a45d90731771b36db0acd3565f22ebc285829385262900e59f75db12 + md5: 48787f2eab82ef1d90ccd9c24b64981e + depends: + - __glibc >=2.17,<3.0.a0 + - alsa-lib >=1.2.14,<1.3.0a0 + - aom >=3.9.1,<3.10.0a0 + - bzip2 >=1.0.8,<2.0a0 + - dav1d >=1.2.1,<1.2.2.0a0 + - fontconfig >=2.15.0,<3.0a0 + - fonts-conda-ecosystem + - gmp >=6.3.0,<7.0a0 + - harfbuzz >=12.2.0 + - lame >=3.100,<3.101.0a0 + - libass >=0.17.4,<0.17.5.0a0 + - libexpat >=2.7.3,<3.0a0 + - libfreetype >=2.14.1 + - libfreetype6 >=2.14.1 + - libgcc >=14 + - libiconv >=1.18,<2.0a0 + - liblzma >=5.8.1,<6.0a0 + - libopenvino >=2025.2.0,<2025.2.1.0a0 + - libopenvino-auto-batch-plugin >=2025.2.0,<2025.2.1.0a0 + - libopenvino-auto-plugin >=2025.2.0,<2025.2.1.0a0 + - libopenvino-hetero-plugin >=2025.2.0,<2025.2.1.0a0 + - libopenvino-intel-cpu-plugin >=2025.2.0,<2025.2.1.0a0 + - libopenvino-intel-gpu-plugin >=2025.2.0,<2025.2.1.0a0 + - libopenvino-intel-npu-plugin >=2025.2.0,<2025.2.1.0a0 + - libopenvino-ir-frontend >=2025.2.0,<2025.2.1.0a0 + - libopenvino-onnx-frontend >=2025.2.0,<2025.2.1.0a0 + - libopenvino-paddle-frontend >=2025.2.0,<2025.2.1.0a0 + - libopenvino-pytorch-frontend >=2025.2.0,<2025.2.1.0a0 + - libopenvino-tensorflow-frontend >=2025.2.0,<2025.2.1.0a0 + - libopenvino-tensorflow-lite-frontend >=2025.2.0,<2025.2.1.0a0 + - libopus >=1.5.2,<2.0a0 + - librsvg >=2.60.0,<3.0a0 + - libstdcxx >=14 + - libva >=2.22.0,<3.0a0 + - libvorbis >=1.3.7,<1.4.0a0 + - libvpl >=2.15.0,<2.16.0a0 + - libvpx >=1.15.2,<1.16.0a0 + - libvulkan-loader >=1.4.328.1,<2.0a0 + - libxcb >=1.17.0,<2.0a0 + - libxml2 + - libxml2-16 >=2.14.6 + - libzlib >=1.3.1,<2.0a0 + - openh264 >=2.6.0,<2.6.1.0a0 + - openssl >=3.5.4,<4.0a0 + - pulseaudio-client >=17.0,<17.1.0a0 + - sdl2 >=2.32.56,<3.0a0 + - shaderc >=2025.5,<2025.6.0a0 + - svt-av1 >=3.1.2,<3.1.3.0a0 + - x264 >=1!164.3095,<1!165 + - x265 >=3.5,<3.6.0a0 + - xorg-libx11 >=1.8.12,<2.0a0 + constrains: + - __cuda >=12.8 + license: GPL-2.0-or-later + license_family: GPL + size: 12482468 + timestamp: 1765653517558 +- conda: https://conda.anaconda.org/conda-forge/linux-64/ffmpeg-8.0.1-gpl_hcddb375_914.conda + sha256: 0d465b145eb7166d6a3989f0befe790789624604945f53de767b169b1832c088 + md5: f0e9f1452786e2b32907e8d9a6b3c752 + depends: + - __glibc >=2.17,<3.0.a0 + - alsa-lib >=1.2.15.3,<1.3.0a0 + - aom >=3.9.1,<3.10.0a0 + - bzip2 >=1.0.8,<2.0a0 + - dav1d >=1.2.1,<1.2.2.0a0 + - fontconfig >=2.17.1,<3.0a0 + - fonts-conda-ecosystem + - gmp >=6.3.0,<7.0a0 + - harfbuzz >=12.3.2 + - lame >=3.100,<3.101.0a0 + - libass >=0.17.4,<0.17.5.0a0 + - libexpat >=2.7.4,<3.0a0 + - libfreetype >=2.14.2 + - libfreetype6 >=2.14.2 + - libgcc >=14 + - libiconv >=1.18,<2.0a0 + - libjxl >=0.11,<1.0a0 + - liblzma >=5.8.2,<6.0a0 + - libopenvino >=2026.0.0,<2026.0.1.0a0 + - libopenvino-auto-batch-plugin >=2026.0.0,<2026.0.1.0a0 + - libopenvino-auto-plugin >=2026.0.0,<2026.0.1.0a0 + - libopenvino-hetero-plugin >=2026.0.0,<2026.0.1.0a0 + - libopenvino-intel-cpu-plugin >=2026.0.0,<2026.0.1.0a0 + - libopenvino-intel-gpu-plugin >=2026.0.0,<2026.0.1.0a0 + - libopenvino-intel-npu-plugin >=2026.0.0,<2026.0.1.0a0 + - libopenvino-ir-frontend >=2026.0.0,<2026.0.1.0a0 + - libopenvino-onnx-frontend >=2026.0.0,<2026.0.1.0a0 + - libopenvino-paddle-frontend >=2026.0.0,<2026.0.1.0a0 + - libopenvino-pytorch-frontend >=2026.0.0,<2026.0.1.0a0 + - libopenvino-tensorflow-frontend >=2026.0.0,<2026.0.1.0a0 + - libopenvino-tensorflow-lite-frontend >=2026.0.0,<2026.0.1.0a0 + - libopus >=1.6.1,<2.0a0 + - librsvg >=2.60.2,<3.0a0 + - libstdcxx >=14 + - libva >=2.23.0,<3.0a0 + - libvorbis >=1.3.7,<1.4.0a0 + - libvpl >=2.16.0,<2.17.0a0 + - libvpx >=1.15.2,<1.16.0a0 + - libvulkan-loader >=1.4.341.0,<2.0a0 + - libwebp-base >=1.6.0,<2.0a0 + - libxcb >=1.17.0,<2.0a0 + - libxml2 + - libxml2-16 >=2.14.6 + - libzlib >=1.3.1,<2.0a0 + - openh264 >=2.6.0,<2.6.1.0a0 + - openssl >=3.5.5,<4.0a0 + - pulseaudio-client >=17.0,<17.1.0a0 + - sdl2 >=2.32.56,<3.0a0 + - shaderc >=2025.5,<2025.6.0a0 + - svt-av1 >=4.0.1,<4.0.2.0a0 + - x264 >=1!164.3095,<1!165 + - x265 >=3.5,<3.6.0a0 + - xorg-libx11 >=1.8.13,<2.0a0 + constrains: + - __cuda >=12.8 + license: GPL-2.0-or-later + license_family: GPL + size: 12485347 + timestamp: 1773008832077 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/ffmpeg-8.0.1-gpl_h62efc85_914.conda + sha256: a2816bcef9d7b072597192fcb15b851eaee1ef358c0a3890ab255070d41b64cb + md5: e9f109db13b0fad0c1f2f92d9770c8c3 + depends: + - alsa-lib >=1.2.15.3,<1.3.0a0 + - aom >=3.9.1,<3.10.0a0 + - bzip2 >=1.0.8,<2.0a0 + - dav1d >=1.2.1,<1.2.2.0a0 + - fontconfig >=2.17.1,<3.0a0 + - fonts-conda-ecosystem + - gmp >=6.3.0,<7.0a0 + - harfbuzz >=12.3.2 + - lame >=3.100,<3.101.0a0 + - libass >=0.17.4,<0.17.5.0a0 + - libexpat >=2.7.4,<3.0a0 + - libfreetype >=2.14.2 + - libfreetype6 >=2.14.2 + - libgcc >=14 + - libiconv >=1.18,<2.0a0 + - libjxl >=0.11,<1.0a0 + - liblzma >=5.8.2,<6.0a0 + - libopenvino >=2026.0.0,<2026.0.1.0a0 + - libopenvino-arm-cpu-plugin >=2026.0.0,<2026.0.1.0a0 + - libopenvino-auto-batch-plugin >=2026.0.0,<2026.0.1.0a0 + - libopenvino-auto-plugin >=2026.0.0,<2026.0.1.0a0 + - libopenvino-hetero-plugin >=2026.0.0,<2026.0.1.0a0 + - libopenvino-ir-frontend >=2026.0.0,<2026.0.1.0a0 + - libopenvino-onnx-frontend >=2026.0.0,<2026.0.1.0a0 + - libopenvino-paddle-frontend >=2026.0.0,<2026.0.1.0a0 + - libopenvino-pytorch-frontend >=2026.0.0,<2026.0.1.0a0 + - libopenvino-tensorflow-frontend >=2026.0.0,<2026.0.1.0a0 + - libopenvino-tensorflow-lite-frontend >=2026.0.0,<2026.0.1.0a0 + - libopus >=1.6.1,<2.0a0 + - librsvg >=2.60.2,<3.0a0 + - libstdcxx >=14 + - libvorbis >=1.3.7,<1.4.0a0 + - libvpx >=1.15.2,<1.16.0a0 + - libvulkan-loader >=1.4.341.0,<2.0a0 + - libwebp-base >=1.6.0,<2.0a0 + - libxcb >=1.17.0,<2.0a0 + - libxml2 + - libxml2-16 >=2.14.6 + - libzlib >=1.3.1,<2.0a0 + - openh264 >=2.6.0,<2.6.1.0a0 + - openssl >=3.5.5,<4.0a0 + - pulseaudio-client >=17.0,<17.1.0a0 + - sdl2 >=2.32.56,<3.0a0 + - shaderc >=2025.5,<2025.6.0a0 + - svt-av1 >=4.0.1,<4.0.2.0a0 + - x264 >=1!164.3095,<1!165 + - x265 >=3.5,<3.6.0a0 + - xorg-libx11 >=1.8.13,<2.0a0 + constrains: + - __cuda >=12.8 + license: GPL-2.0-or-later + license_family: GPL + size: 12035194 + timestamp: 1773008913159 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/ffmpeg-8.0.1-gpl_h936a714_906.conda + sha256: b9c6d3698809316fc278f9df373b4ec3a016f6f3b9b0ccbedb0d3a828c7572a1 + md5: 2a521f179f7aa9a820fa3441e0cb2a50 + depends: + - alsa-lib >=1.2.14,<1.3.0a0 + - aom >=3.9.1,<3.10.0a0 + - bzip2 >=1.0.8,<2.0a0 + - dav1d >=1.2.1,<1.2.2.0a0 + - fontconfig >=2.15.0,<3.0a0 + - fonts-conda-ecosystem + - gmp >=6.3.0,<7.0a0 + - harfbuzz >=12.2.0 + - lame >=3.100,<3.101.0a0 + - libass >=0.17.4,<0.17.5.0a0 + - libexpat >=2.7.3,<3.0a0 + - libfreetype >=2.14.1 + - libfreetype6 >=2.14.1 + - libgcc >=14 + - libiconv >=1.18,<2.0a0 + - liblzma >=5.8.1,<6.0a0 + - libopenvino >=2025.2.0,<2025.2.1.0a0 + - libopenvino-arm-cpu-plugin >=2025.2.0,<2025.2.1.0a0 + - libopenvino-auto-batch-plugin >=2025.2.0,<2025.2.1.0a0 + - libopenvino-auto-plugin >=2025.2.0,<2025.2.1.0a0 + - libopenvino-hetero-plugin >=2025.2.0,<2025.2.1.0a0 + - libopenvino-ir-frontend >=2025.2.0,<2025.2.1.0a0 + - libopenvino-onnx-frontend >=2025.2.0,<2025.2.1.0a0 + - libopenvino-paddle-frontend >=2025.2.0,<2025.2.1.0a0 + - libopenvino-pytorch-frontend >=2025.2.0,<2025.2.1.0a0 + - libopenvino-tensorflow-frontend >=2025.2.0,<2025.2.1.0a0 + - libopenvino-tensorflow-lite-frontend >=2025.2.0,<2025.2.1.0a0 + - libopus >=1.5.2,<2.0a0 + - librsvg >=2.60.0,<3.0a0 + - libstdcxx >=14 + - libvorbis >=1.3.7,<1.4.0a0 + - libvpx >=1.15.2,<1.16.0a0 + - libvulkan-loader >=1.4.328.1,<2.0a0 + - libxcb >=1.17.0,<2.0a0 + - libxml2 + - libxml2-16 >=2.14.6 + - libzlib >=1.3.1,<2.0a0 + - openh264 >=2.6.0,<2.6.1.0a0 + - openssl >=3.5.4,<4.0a0 + - pulseaudio-client >=17.0,<17.1.0a0 + - sdl2 >=2.32.56,<3.0a0 + - shaderc >=2025.5,<2025.6.0a0 + - svt-av1 >=3.1.2,<3.1.3.0a0 + - x264 >=1!164.3095,<1!165 + - x265 >=3.5,<3.6.0a0 + - xorg-libx11 >=1.8.12,<2.0a0 + constrains: + - __cuda >=12.8 + license: GPL-2.0-or-later + license_family: GPL + size: 12009838 + timestamp: 1765653483363 +- conda: https://conda.anaconda.org/conda-forge/win-64/ffmpeg-8.0.1-gpl_h74fd8f1_907.conda + sha256: d2fd4f6ccb01270a59b2f9277b938b8795201d3e44547fa3b7d228ce66c67050 + md5: 9062e8bce38eee2540db36e35947adf7 + depends: + - aom >=3.9.1,<3.10.0a0 + - bzip2 >=1.0.8,<2.0a0 + - dav1d >=1.2.1,<1.2.2.0a0 + - fontconfig >=2.15.0,<3.0a0 + - fonts-conda-ecosystem + - harfbuzz >=12.2.0 + - lame >=3.100,<3.101.0a0 + - libexpat >=2.7.3,<3.0a0 + - libfreetype >=2.14.1 + - libfreetype6 >=2.14.1 + - libiconv >=1.18,<2.0a0 + - liblzma >=5.8.1,<6.0a0 + - libopus >=1.6,<2.0a0 + - librsvg >=2.60.0,<3.0a0 + - libvorbis >=1.3.7,<1.4.0a0 + - libvulkan-loader >=1.4.328.1,<2.0a0 + - libxml2 + - libxml2-16 >=2.14.6 + - libzlib >=1.3.1,<2.0a0 + - openh264 >=2.6.0,<2.6.1.0a0 + - openssl >=3.5.4,<4.0a0 + - sdl2 >=2.32.56,<3.0a0 + - shaderc >=2025.5,<2025.6.0a0 + - svt-av1 >=3.1.2,<3.1.3.0a0 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + - x264 >=1!164.3095,<1!165 + - x265 >=3.5,<3.6.0a0 + constrains: + - __cuda >=12.8 + license: GPL-2.0-or-later + license_family: GPL + size: 10420698 + timestamp: 1765873656019 +- conda: https://conda.anaconda.org/conda-forge/win-64/ffmpeg-8.0.1-gpl_h74fd8f1_908.conda + sha256: 28b398848c1389d474557a19e9963c778ab76e0e3a02c1cabdb94a3067cad82b + md5: e08d05ea85b8b24fabb8afa1d0d79362 + depends: + - aom >=3.9.1,<3.10.0a0 + - bzip2 >=1.0.8,<2.0a0 + - dav1d >=1.2.1,<1.2.2.0a0 + - fontconfig >=2.15.0,<3.0a0 + - fonts-conda-ecosystem + - harfbuzz >=12.2.0 + - lame >=3.100,<3.101.0a0 + - libexpat >=2.7.3,<3.0a0 + - libfreetype >=2.14.1 + - libfreetype6 >=2.14.1 + - libiconv >=1.18,<2.0a0 + - liblzma >=5.8.1,<6.0a0 + - libopus >=1.6,<2.0a0 + - librsvg >=2.60.0,<3.0a0 + - libvorbis >=1.3.7,<1.4.0a0 + - libvulkan-loader >=1.4.328.1,<2.0a0 + - libxml2 + - libxml2-16 >=2.14.6 + - libzlib >=1.3.1,<2.0a0 + - openh264 >=2.6.0,<2.6.1.0a0 + - openssl >=3.5.4,<4.0a0 + - sdl2 >=2.32.56,<3.0a0 + - shaderc >=2025.5,<2025.6.0a0 + - svt-av1 >=3.1.2,<3.1.3.0a0 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + - x264 >=1!164.3095,<1!165 + - x265 >=3.5,<3.6.0a0 + constrains: + - __cuda >=12.8 + license: GPL-2.0-or-later + license_family: GPL + size: 10416746 + timestamp: 1766461370784 +- conda: https://conda.anaconda.org/conda-forge/win-64/ffmpeg-8.0.1-gpl_hb2d76f6_914.conda + sha256: fbe7916ed95bdc9650c9906865ab21cc04fb337548fdffec94f64a547ba3644d + md5: 7cffff39ee349bddb81e1de24c780f34 + depends: + - aom >=3.9.1,<3.10.0a0 + - bzip2 >=1.0.8,<2.0a0 + - dav1d >=1.2.1,<1.2.2.0a0 + - fontconfig >=2.17.1,<3.0a0 + - fonts-conda-ecosystem + - harfbuzz >=12.3.2 + - lame >=3.100,<3.101.0a0 + - libexpat >=2.7.4,<3.0a0 + - libfreetype >=2.14.2 + - libfreetype6 >=2.14.2 + - libiconv >=1.18,<2.0a0 + - libjxl >=0.11,<1.0a0 + - liblzma >=5.8.2,<6.0a0 + - libopus >=1.6.1,<2.0a0 + - librsvg >=2.60.0,<3.0a0 + - libvorbis >=1.3.7,<1.4.0a0 + - libvulkan-loader >=1.4.341.0,<2.0a0 + - libwebp-base >=1.6.0,<2.0a0 + - libxml2 + - libxml2-16 >=2.14.6 + - libzlib >=1.3.1,<2.0a0 + - openh264 >=2.6.0,<2.6.1.0a0 + - openssl >=3.5.5,<4.0a0 + - sdl2 >=2.32.56,<3.0a0 + - shaderc >=2025.5,<2025.6.0a0 + - svt-av1 >=4.0.1,<4.0.2.0a0 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + - x264 >=1!164.3095,<1!165 + - x265 >=3.5,<3.6.0a0 + constrains: + - __cuda >=12.8 + license: GPL-2.0-or-later + license_family: GPL + size: 10417843 + timestamp: 1773010275486 +- conda: https://conda.anaconda.org/conda-forge/noarch/filelock-3.25.2-pyhd8ed1ab_0.conda + sha256: dddea9ec53d5e179de82c24569d41198f98db93314f0adae6b15195085d5567f + md5: f58064cec97b12a7136ebb8a6f8a129b + depends: + - python >=3.10 + license: Unlicense + purls: + - pkg:pypi/filelock?source=compressed-mapping + size: 25845 + timestamp: 1773314012590 +- conda: https://conda.anaconda.org/conda-forge/noarch/font-ttf-dejavu-sans-mono-2.37-hab24e00_0.tar.bz2 + sha256: 58d7f40d2940dd0a8aa28651239adbf5613254df0f75789919c4e6762054403b + md5: 0c96522c6bdaed4b1566d11387caaf45 + license: BSD-3-Clause + license_family: BSD + size: 397370 + timestamp: 1566932522327 +- conda: https://conda.anaconda.org/conda-forge/noarch/font-ttf-inconsolata-3.000-h77eed37_0.tar.bz2 + sha256: c52a29fdac682c20d252facc50f01e7c2e7ceac52aa9817aaf0bb83f7559ec5c + md5: 34893075a5c9e55cdafac56607368fc6 + license: OFL-1.1 + license_family: Other + size: 96530 + timestamp: 1620479909603 +- conda: https://conda.anaconda.org/conda-forge/noarch/font-ttf-source-code-pro-2.038-h77eed37_0.tar.bz2 + sha256: 00925c8c055a2275614b4d983e1df637245e19058d79fc7dd1a93b8d9fb4b139 + md5: 4d59c254e01d9cde7957100457e2d5fb + license: OFL-1.1 + license_family: Other + size: 700814 + timestamp: 1620479612257 +- conda: https://conda.anaconda.org/conda-forge/noarch/font-ttf-ubuntu-0.83-h77eed37_3.conda + sha256: 2821ec1dc454bd8b9a31d0ed22a7ce22422c0aef163c59f49dfdf915d0f0ca14 + md5: 49023d73832ef61042f6a237cb2687e7 + license: LicenseRef-Ubuntu-Font-Licence-Version-1.0 + license_family: Other + size: 1620504 + timestamp: 1727511233259 +- conda: https://conda.anaconda.org/conda-forge/linux-64/fontconfig-2.15.0-h7e30c49_1.conda + sha256: 7093aa19d6df5ccb6ca50329ef8510c6acb6b0d8001191909397368b65b02113 + md5: 8f5b0b297b59e1ac160ad4beec99dbee + depends: + - __glibc >=2.17,<3.0.a0 + - freetype >=2.12.1,<3.0a0 + - libexpat >=2.6.3,<3.0a0 + - libgcc >=13 + - libuuid >=2.38.1,<3.0a0 + - libzlib >=1.3.1,<2.0a0 + license: MIT + license_family: MIT + size: 265599 + timestamp: 1730283881107 +- conda: https://conda.anaconda.org/conda-forge/linux-64/fontconfig-2.17.1-h27c8c51_0.conda + sha256: aa4a44dba97151221100a637c7f4bde619567afade9c0265f8e1c8eed8d7bd8c + md5: 867127763fbe935bab59815b6e0b7b5c + depends: + - __glibc >=2.17,<3.0.a0 + - libexpat >=2.7.4,<3.0a0 + - libfreetype >=2.14.1 + - libfreetype6 >=2.14.1 + - libgcc >=14 + - libuuid >=2.41.3,<3.0a0 + - libzlib >=1.3.1,<2.0a0 + license: MIT + license_family: MIT + size: 270705 + timestamp: 1771382710863 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/fontconfig-2.15.0-h8dda3cd_1.conda + sha256: fe023bb8917c8a3138af86ef537b70c8c5d60c44f93946a87d1e8bb1a6634b55 + md5: 112b71b6af28b47c624bcbeefeea685b + depends: + - freetype >=2.12.1,<3.0a0 + - libexpat >=2.6.3,<3.0a0 + - libgcc >=13 + - libuuid >=2.38.1,<3.0a0 + - libzlib >=1.3.1,<2.0a0 + license: MIT + license_family: MIT + size: 277832 + timestamp: 1730284967179 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/fontconfig-2.17.1-hba86a56_0.conda + sha256: 835aff8615dd8d8fff377679710ce81b8a2c47b6404e21a92fb349fda193a15c + md5: 0fed1ff55f4938a65907f3ecf62609db + depends: + - libexpat >=2.7.4,<3.0a0 + - libfreetype >=2.14.1 + - libfreetype6 >=2.14.1 + - libgcc >=14 + - libuuid >=2.41.3,<3.0a0 + - libzlib >=1.3.1,<2.0a0 + license: MIT + license_family: MIT + size: 279044 + timestamp: 1771382728182 +- conda: https://conda.anaconda.org/conda-forge/win-64/fontconfig-2.15.0-h765892d_1.conda + sha256: ed122fc858fb95768ca9ca77e73c8d9ddc21d4b2e13aaab5281e27593e840691 + md5: 9bb0026a2131b09404c59c4290c697cd + depends: + - freetype >=2.12.1,<3.0a0 + - libexpat >=2.6.3,<3.0a0 + - libiconv >=1.17,<2.0a0 + - libzlib >=1.3.1,<2.0a0 + - ucrt >=10.0.20348.0 + - vc >=14.2,<15 + - vc14_runtime >=14.29.30139 + license: MIT + license_family: MIT + size: 192355 + timestamp: 1730284147944 +- conda: https://conda.anaconda.org/conda-forge/win-64/fontconfig-2.17.1-hd47e2ca_0.conda + sha256: ff2db9d305711854de430f946dc59bd40167940a1de38db29c5a78659f219d9c + md5: a0b1b87e871011ca3b783bbf410bc39f + depends: + - libexpat >=2.7.4,<3.0a0 + - libfreetype >=2.14.1 + - libfreetype6 >=2.14.1 + - libiconv >=1.18,<2.0a0 + - libzlib >=1.3.1,<2.0a0 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: MIT + license_family: MIT + size: 195332 + timestamp: 1771382820659 +- conda: https://conda.anaconda.org/conda-forge/noarch/fonts-conda-ecosystem-1-0.tar.bz2 + sha256: a997f2f1921bb9c9d76e6fa2f6b408b7fa549edd349a77639c9fe7a23ea93e61 + md5: fee5683a3f04bd15cbd8318b096a27ab + depends: + - fonts-conda-forge + license: BSD-3-Clause + license_family: BSD + size: 3667 + timestamp: 1566974674465 +- conda: https://conda.anaconda.org/conda-forge/noarch/fonts-conda-forge-1-hc364b38_1.conda + sha256: 54eea8469786bc2291cc40bca5f46438d3e062a399e8f53f013b6a9f50e98333 + md5: a7970cd949a077b7cb9696379d338681 + depends: + - font-ttf-ubuntu + - font-ttf-inconsolata + - font-ttf-dejavu-sans-mono + - font-ttf-source-code-pro + license: BSD-3-Clause + license_family: BSD + size: 4059 + timestamp: 1762351264405 +- conda: https://conda.anaconda.org/conda-forge/linux-64/freetype-2.14.1-ha770c72_0.conda + sha256: bf8e4dffe46f7d25dc06f31038cacb01672c47b9f45201f065b0f4d00ab0a83e + md5: 4afc585cd97ba8a23809406cd8a9eda8 + depends: + - libfreetype 2.14.1 ha770c72_0 + - libfreetype6 2.14.1 h73754d4_0 + license: GPL-2.0-only OR FTL + size: 173114 + timestamp: 1757945422243 +- conda: https://conda.anaconda.org/conda-forge/linux-64/freetype-2.14.2-ha770c72_0.conda + sha256: 36857701b46828b6760c3c1652414ee504e7fc12740261ac6fcff3959b72bd7a + md5: eeec961fec28e747e1e1dc0446277452 + depends: + - libfreetype 2.14.2 ha770c72_0 + - libfreetype6 2.14.2 h73754d4_0 + license: GPL-2.0-only OR FTL + size: 174292 + timestamp: 1772757205296 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/freetype-2.14.1-h8af1aa0_0.conda + sha256: 9f8de35e95ce301cecfe01bc9d539c7cc045146ffba55efe9733ff77ad1cfb21 + md5: 0c8f36ebd3678eed1685f0fc93fc2175 + depends: + - libfreetype 2.14.1 h8af1aa0_0 + - libfreetype6 2.14.1 hdae7a39_0 + license: GPL-2.0-only OR FTL + size: 173174 + timestamp: 1757945489158 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/freetype-2.14.2-h8af1aa0_0.conda + sha256: ecbe6e811574fba5194b29ac3a2badea5eaa060bd9fe7f5bd48a70d16ef38e5a + md5: 9cb47d7bbb36646c44d7cf1cb8047887 + depends: + - libfreetype 2.14.2 h8af1aa0_0 + - libfreetype6 2.14.2 hdae7a39_0 + license: GPL-2.0-only OR FTL + size: 173437 + timestamp: 1772756019067 +- conda: https://conda.anaconda.org/conda-forge/win-64/freetype-2.14.1-h57928b3_0.conda + sha256: a9b3313edea0bf14ea6147ea43a1059d0bf78771a1336d2c8282891efc57709a + md5: d69c21967f35eb2ce7f1f85d6b6022d3 + depends: + - libfreetype 2.14.1 h57928b3_0 + - libfreetype6 2.14.1 hdbac1cb_0 + license: GPL-2.0-only OR FTL + size: 184553 + timestamp: 1757946164012 +- conda: https://conda.anaconda.org/conda-forge/win-64/freetype-2.14.2-h57928b3_0.conda + sha256: 6dd4bb3862ea3d07015331059504cf3b6af1a11a6909e7a9b6e04a20e253da28 + md5: c360b467564b875a9f5dc481b8726cee + depends: + - libfreetype 2.14.2 h57928b3_0 + - libfreetype6 2.14.2 hdbac1cb_0 + license: GPL-2.0-only OR FTL + size: 185633 + timestamp: 1772756186241 +- conda: https://conda.anaconda.org/conda-forge/linux-64/fribidi-1.0.16-hb03c661_0.conda + sha256: 858283ff33d4c033f4971bf440cebff217d5552a5222ba994c49be990dacd40d + md5: f9f81ea472684d75b9dd8d0b328cf655 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + license: LGPL-2.1-or-later + size: 61244 + timestamp: 1757438574066 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/fribidi-1.0.16-he30d5cf_0.conda + sha256: 1bfcd715bcb49a0b22d5d1899a22c6ff884b06f8e141eb746f3949752469a422 + md5: f3ac54914f7d3e1d68cb8d891765e5f9 + depends: + - libgcc >=14 + license: LGPL-2.1-or-later + size: 62909 + timestamp: 1757438620177 +- conda: https://conda.anaconda.org/conda-forge/win-64/fribidi-1.0.16-hfd05255_0.conda + sha256: 15011071ee56c216ffe276c8d734427f1f893f275ef733f728d13f610ed89e6e + md5: c27bd87e70f970010c1c6db104b88b18 + depends: + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: LGPL-2.1-or-later + size: 64394 + timestamp: 1757438741305 +- conda: https://conda.anaconda.org/conda-forge/linux-64/gcc-15.2.0-h0dff253_16.conda + sha256: f7d74b470dbaaaf715bf0c29a8e5786b41c5be38b8fd2b703cdbe8c3ac9a4061 + md5: d65a413999f5e84b95cc56145f7dc8ae + depends: + - conda-gcc-specs + - gcc_impl_linux-64 15.2.0 hc5723f1_16 + license: BSD-3-Clause + license_family: BSD + size: 28938 + timestamp: 1765257209407 +- conda: https://conda.anaconda.org/conda-forge/linux-64/gcc-15.2.0-h6f77f03_18.conda + sha256: d120a7616f8b2717fc2a9d0246b53f69ce3fb33e565d22dba44e3d6827ee4f12 + md5: 094638a454410aa77586ffcc9a403aef + depends: + - gcc_impl_linux-64 15.2.0 he420e7e_18 + track_features: + - gcc_no_conda_specs + license: BSD-3-Clause + license_family: BSD + size: 29453 + timestamp: 1771378662937 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/gcc-15.2.0-h24a549f_16.conda + sha256: 7124670911087be385d372979a31afd1e37a9d0e6de3e56efc6b8447aae31c75 + md5: 4f8b33ee4999031fc336eb0d1853a439 + depends: + - gcc_impl_linux-aarch64 15.2.0 habb1d5c_16 + track_features: + - gcc_no_conda_specs + license: BSD-3-Clause + license_family: BSD + size: 29174 + timestamp: 1765257473532 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/gcc-15.2.0-h24a549f_18.conda + sha256: 0bd812fcf81d866d75eca0fd759b001f0f39601d0f8ea9b7a888b47719491de9 + md5: e4c2c2d15fc780407d7012a529aa7d23 + depends: + - gcc_impl_linux-aarch64 15.2.0 hcedddb3_18 + track_features: + - gcc_no_conda_specs + license: BSD-3-Clause + license_family: BSD + size: 29408 + timestamp: 1771378529822 +- conda: https://conda.anaconda.org/conda-forge/win-64/gcc-15.2.0-hd556455_16.conda + sha256: 47e615d15323e8e5713079d6a364c29e622c1351a1bbae25a4b2b29a8a65176e + md5: 75be5b3f44f3f939e2c3cdb041d12a44 + depends: + - conda-gcc-specs + - gcc_impl_win-64 15.2.0 h79c4613_16 + license: BSD-3-Clause + license_family: BSD + size: 1202509 + timestamp: 1765260844098 +- conda: https://conda.anaconda.org/conda-forge/win-64/gcc-15.2.0-hd556455_18.conda + sha256: 349dd70890b3bb51d8f7a7976f53711f4606c076a659ee7fdc7c32e2ffa019a1 + md5: 0f295318682c2fbefbe293399fae135f + depends: + - conda-gcc-specs + - gcc_impl_win-64 15.2.0 ha526d7c_18 + license: BSD-3-Clause + license_family: BSD + size: 1198343 + timestamp: 1771382604468 +- conda: https://conda.anaconda.org/conda-forge/linux-64/gcc_impl_linux-64-15.2.0-hc5723f1_16.conda + sha256: dfd180b9df441b57aa539dfcfcc416c804638b3bc5ec9dbb5d7bdbc009eba497 + md5: 83c672f0e373c37436953413b2272a42 + depends: + - binutils_impl_linux-64 >=2.45 + - libgcc >=15.2.0 + - libgcc-devel_linux-64 15.2.0 hcc6f6b0_116 + - libgomp >=15.2.0 + - libsanitizer 15.2.0 h90f66d4_16 + - libstdcxx >=15.2.0 + - libstdcxx-devel_linux-64 15.2.0 hd446a21_116 + - sysroot_linux-64 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 80309755 + timestamp: 1765256937267 +- conda: https://conda.anaconda.org/conda-forge/linux-64/gcc_impl_linux-64-15.2.0-he420e7e_18.conda + sha256: a088cfd3ae6fa83815faa8703bc9d21cc915f17bd1b51aac9c16ddf678da21e4 + md5: cf56b6d74f580b91fd527e10d9a2e324 + depends: + - binutils_impl_linux-64 >=2.45 + - libgcc >=15.2.0 + - libgcc-devel_linux-64 15.2.0 hcc6f6b0_118 + - libgomp >=15.2.0 + - libsanitizer 15.2.0 h90f66d4_18 + - libstdcxx >=15.2.0 + - libstdcxx-devel_linux-64 15.2.0 hd446a21_118 + - sysroot_linux-64 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 81814135 + timestamp: 1771378369317 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/gcc_impl_linux-aarch64-15.2.0-habb1d5c_16.conda + sha256: 9b7e56534fa3029e0caf6dbbf4daa2d567e630672f977f01ad0c356933fb1b0d + md5: af391ca6347927b4e067a8be221d1b3a + depends: + - binutils_impl_linux-aarch64 >=2.45 + - libgcc >=15.2.0 + - libgcc-devel_linux-aarch64 15.2.0 h55c397f_116 + - libgomp >=15.2.0 + - libsanitizer 15.2.0 he19c465_16 + - libstdcxx >=15.2.0 + - libstdcxx-devel_linux-aarch64 15.2.0 ha7b1723_116 + - sysroot_linux-aarch64 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 74461928 + timestamp: 1765257095042 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/gcc_impl_linux-aarch64-15.2.0-hcedddb3_18.conda + sha256: 12919d985a6c6787872699c7a3c295dad07f4084f2d850e9c7fe592ee0a6806b + md5: 761a75d8c098913bc1186b26588051e0 + depends: + - binutils_impl_linux-aarch64 >=2.45 + - libgcc >=15.2.0 + - libgcc-devel_linux-aarch64 15.2.0 h55c397f_118 + - libgomp >=15.2.0 + - libsanitizer 15.2.0 he19c465_18 + - libstdcxx >=15.2.0 + - libstdcxx-devel_linux-aarch64 15.2.0 ha7b1723_118 + - sysroot_linux-aarch64 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 73516504 + timestamp: 1771378256368 +- conda: https://conda.anaconda.org/conda-forge/win-64/gcc_impl_win-64-15.2.0-h79c4613_16.conda + sha256: 73489f4fe29f8a80a2514ff21285226aafed37693099c5d48460a780608a6ee2 + md5: c545222077e50b9cdc7dfb2c80ba8cfa + depends: + - binutils_impl_win-64 >=2.45 + - libgcc >=15.2.0 + - libgcc-devel_win-64 15.2.0 hbb59886_116 + - libgomp >=15.2.0 + - libstdcxx >=15.2.0 + - libstdcxx-devel_win-64 15.2.0 h0a72980_116 + - m2w64-sysroot_win-64 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 62325084 + timestamp: 1765260533999 +- conda: https://conda.anaconda.org/conda-forge/win-64/gcc_impl_win-64-15.2.0-ha526d7c_18.conda + sha256: 70db065b687f52e64b942af8daf33e244e17128158ced9dc019924c4f79d3b82 + md5: 7568471e78e882712c3d3715624a54c8 + depends: + - binutils_impl_win-64 >=2.45 + - libgcc >=15.2.0 + - libgcc-devel_win-64 15.2.0 hbb59886_118 + - libgomp >=15.2.0 + - libstdcxx >=15.2.0 + - libstdcxx-devel_win-64 15.2.0 h0a72980_118 + - m2w64-sysroot_win-64 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 62510234 + timestamp: 1771382289787 +- conda: https://conda.anaconda.org/conda-forge/linux-64/gdk-pixbuf-2.44.4-h2b0a6b4_0.conda + sha256: f47222f58839bcc77c15f11a8814c1d8cb8080c5ca6ba83398a12b640fd3c85c + md5: c379d67c686fb83475c1a6ed41cc41ff + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libglib >=2.86.0,<3.0a0 + - libjpeg-turbo >=3.1.0,<4.0a0 + - liblzma >=5.8.1,<6.0a0 + - libpng >=1.6.50,<1.7.0a0 + - libtiff >=4.7.1,<4.8.0a0 + license: LGPL-2.1-or-later + license_family: LGPL + size: 572093 + timestamp: 1761082340749 +- conda: https://conda.anaconda.org/conda-forge/linux-64/gdk-pixbuf-2.44.5-h2b0a6b4_1.conda + sha256: b2a6fb56b8f2d576a3ae5e6c57b2dbab91d52d1f1658bf1b258747ae25bb9fde + md5: 7eb4977dd6f60b3aaab0715a0ea76f11 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libglib >=2.86.4,<3.0a0 + - libjpeg-turbo >=3.1.2,<4.0a0 + - liblzma >=5.8.2,<6.0a0 + - libpng >=1.6.55,<1.7.0a0 + - libtiff >=4.7.1,<4.8.0a0 + license: LGPL-2.1-or-later + license_family: LGPL + size: 575109 + timestamp: 1771530561157 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/gdk-pixbuf-2.44.4-h90308e0_0.conda + sha256: 78a1d69c3d0da73b4d54a35001abd4e273605180d21365b4f31e9a241d9fb715 + md5: 4c8c0d2f7620467869d41f29304362dc + depends: + - libgcc >=14 + - libglib >=2.86.0,<3.0a0 + - libjpeg-turbo >=3.1.0,<4.0a0 + - liblzma >=5.8.1,<6.0a0 + - libpng >=1.6.50,<1.7.0a0 + - libtiff >=4.7.1,<4.8.0a0 + license: LGPL-2.1-or-later + license_family: LGPL + size: 580454 + timestamp: 1761083738779 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/gdk-pixbuf-2.44.5-h90308e0_1.conda + sha256: aa95b37da0750fb93c5eeef79073b9b0d50976fa0dc02ed0301ff7bbbfc7ff36 + md5: c75ae103325db056719dd51d6525e1cd + depends: + - libgcc >=14 + - libglib >=2.86.4,<3.0a0 + - libjpeg-turbo >=3.1.2,<4.0a0 + - liblzma >=5.8.2,<6.0a0 + - libpng >=1.6.55,<1.7.0a0 + - libtiff >=4.7.1,<4.8.0a0 + license: LGPL-2.1-or-later + license_family: LGPL + size: 584221 + timestamp: 1771532437279 +- conda: https://conda.anaconda.org/conda-forge/win-64/gdk-pixbuf-2.44.4-h1f5b9c4_0.conda + sha256: 24189e4615a0aa574ab2bd5c270fff999da6951e3cd391f1e807c7e4fafd5cdc + md5: 0ce8e4983a4c60a5b75a9a5b5f227447 + depends: + - libglib >=2.86.0,<3.0a0 + - libintl >=0.22.5,<1.0a0 + - libjpeg-turbo >=3.1.0,<4.0a0 + - liblzma >=5.8.1,<6.0a0 + - libpng >=1.6.50,<1.7.0a0 + - libtiff >=4.7.1,<4.8.0a0 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: LGPL-2.1-or-later + license_family: LGPL + size: 573466 + timestamp: 1761082560321 +- conda: https://conda.anaconda.org/conda-forge/win-64/gdk-pixbuf-2.44.5-h1f5b9c4_1.conda + sha256: 82c725a67098c7c43dfc33ba292a48e68530135b94a8703f20566d90574acdfd + md5: 4059b4975e2de5894286dbe6bd6728fb + depends: + - libglib >=2.86.4,<3.0a0 + - libintl >=0.22.5,<1.0a0 + - libjpeg-turbo >=3.1.2,<4.0a0 + - liblzma >=5.8.2,<6.0a0 + - libpng >=1.6.55,<1.7.0a0 + - libtiff >=4.7.1,<4.8.0a0 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: LGPL-2.1-or-later + license_family: LGPL + size: 574950 + timestamp: 1771530717329 +- conda: https://conda.anaconda.org/conda-forge/linux-64/glslang-16.1.0-hfd11570_0.conda + sha256: 595c87f69145f8228202578d45b876ae9befbd941e0f551c586f7230a86789d4 + md5: 67ad188ef4f3311ff3d447a698a03a0d + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libstdcxx >=14 + - spirv-tools >=2025,<2026.0a0 + license: BSD-3-Clause + license_family: BSD + size: 1312583 + timestamp: 1764720535916 +- conda: https://conda.anaconda.org/conda-forge/linux-64/glslang-16.2.0-h96af755_1.conda + sha256: 88a5ad3571948bde22957d08ab01328b8a7eb04fdee66268b3125cc322dbde8b + md5: ba5b655d827f263090ad2dc514810328 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libstdcxx >=14 + - spirv-tools >=2026,<2027.0a0 + license: BSD-3-Clause + license_family: BSD + size: 1353008 + timestamp: 1770195199411 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/glslang-16.1.0-hd1da3a6_0.conda + sha256: 1c26a898409377b4dcd0d5e26c2a5735b0178b2adcc543aeef3550d4e56a08ea + md5: 4b5eeb76eee40ba958b8f2e97088aaa7 + depends: + - libgcc >=14 + - libstdcxx >=14 + - spirv-tools >=2025,<2026.0a0 + license: BSD-3-Clause + license_family: BSD + size: 1308404 + timestamp: 1764720598114 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/glslang-16.2.0-h124e036_1.conda + sha256: a1c0db6c226b9d80e74bdd49f604eece637489c8c71e6ae63ada8db9e2359944 + md5: 3ead7f968b529f76f972621558ed2f68 + depends: + - libgcc >=14 + - libstdcxx >=14 + - spirv-tools >=2026,<2027.0a0 + license: BSD-3-Clause + license_family: BSD + size: 1348415 + timestamp: 1770195275881 +- conda: https://conda.anaconda.org/conda-forge/win-64/glslang-16.1.0-h5b34520_0.conda + sha256: ab8cca5c5b8aba98f83d8732a3fca71a246a05525d00dce7e528089348cd64ec + md5: e3cf749f8cc50a6e636fb90c9d4f0c58 + depends: + - spirv-tools >=2025,<2026.0a0 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: BSD-3-Clause + license_family: BSD + size: 6241332 + timestamp: 1764720816129 +- conda: https://conda.anaconda.org/conda-forge/win-64/glslang-16.2.0-h294ba9c_1.conda + sha256: c46afa4a43b7709e07a69d0a2d70b10f59f22e96dbf9ec80e53a42cc6551111c + md5: 4b5f576265df0a05d4e47e48c50bb4e6 + depends: + - spirv-tools >=2026,<2027.0a0 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: BSD-3-Clause + license_family: BSD + size: 4929181 + timestamp: 1770195251565 +- conda: https://conda.anaconda.org/conda-forge/linux-64/gmp-6.3.0-hac33072_2.conda + sha256: 309cf4f04fec0c31b6771a5809a1909b4b3154a2208f52351e1ada006f4c750c + md5: c94a5994ef49749880a8139cf9afcbe1 + depends: + - libgcc-ng >=12 + - libstdcxx-ng >=12 + license: GPL-2.0-or-later OR LGPL-3.0-or-later + size: 460055 + timestamp: 1718980856608 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/gmp-6.3.0-h0a1ffab_2.conda + sha256: a5e341cbf797c65d2477b27d99091393edbaa5178c7d69b7463bb105b0488e69 + md5: 7cbfb3a8bb1b78a7f5518654ac6725ad + depends: + - libgcc-ng >=12 + - libstdcxx-ng >=12 + license: GPL-2.0-or-later OR LGPL-3.0-or-later + size: 417323 + timestamp: 1718980707330 +- conda: https://conda.anaconda.org/conda-forge/linux-64/graphite2-1.3.14-hecca717_2.conda + sha256: 25ba37da5c39697a77fce2c9a15e48cf0a84f1464ad2aafbe53d8357a9f6cc8c + md5: 2cd94587f3a401ae05e03a6caf09539d + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libstdcxx >=14 + license: LGPL-2.0-or-later + license_family: LGPL + size: 99596 + timestamp: 1755102025473 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/graphite2-1.3.14-hfae3067_2.conda + sha256: c9b1781fe329e0b77c5addd741e58600f50bef39321cae75eba72f2f381374b7 + md5: 4aa540e9541cc9d6581ab23ff2043f13 + depends: + - libgcc >=14 + - libstdcxx >=14 + license: LGPL-2.0-or-later + license_family: LGPL + size: 102400 + timestamp: 1755102000043 +- conda: https://conda.anaconda.org/conda-forge/win-64/graphite2-1.3.14-hac47afa_2.conda + sha256: 5f1714b07252f885a62521b625898326ade6ca25fbc20727cfe9a88f68a54bfd + md5: b785694dd3ec77a011ccf0c24725382b + depends: + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: LGPL-2.0-or-later + license_family: LGPL + size: 96336 + timestamp: 1755102441729 +- conda: https://conda.anaconda.org/conda-forge/linux-64/greenlet-3.3.2-py312h8285ef7_0.conda + sha256: 03c8d065ef1e07053252412c541b5f1af70bc5fa2f974f129128d90fbdc47fe5 + md5: db6bba1610e5c4256d2892ec2997c425 + depends: + - python + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libstdcxx >=14 + - python_abi 3.12.* *_cp312 + license: MIT + license_family: MIT + purls: + - pkg:pypi/greenlet?source=hash-mapping + size: 253793 + timestamp: 1771658391409 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/greenlet-3.3.2-py312hf55c4e8_0.conda + sha256: 0680f4359f6ae4eecd78f07f460b9bc284789df6859967d64a4eca0c25140b0b + md5: 2af59fcde8a95b7eb9f4f101ec3d3fcd + depends: + - python + - libgcc >=14 + - libstdcxx >=14 + - python 3.12.* *_cpython + - python_abi 3.12.* *_cp312 + license: MIT + license_family: MIT + purls: + - pkg:pypi/greenlet?source=hash-mapping + size: 259597 + timestamp: 1771658392329 +- conda: https://conda.anaconda.org/conda-forge/win-64/greenlet-3.3.2-py312ha1a9051_0.conda + sha256: cbc6f4c63c779f1b5fce7c22bb737c87daa14083134990c9673ef15ed0a85572 + md5: 0f200f3d8424d0ace61b9c2c0cfe99d4 + depends: + - python + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + - ucrt >=10.0.20348.0 + - python_abi 3.12.* *_cp312 + license: MIT + license_family: MIT + purls: + - pkg:pypi/greenlet?source=hash-mapping + size: 235335 + timestamp: 1771658408666 +- conda: https://conda.anaconda.org/conda-forge/linux-64/gxx-15.2.0-h76987e4_16.conda + sha256: 850c1662b9fdfea118c7632f928adb4b9c4f2f3edce166fbce02bfb9633ead85 + md5: 7acc57b08553cf6f682c9b70e6fe6b8f + depends: + - gcc 15.2.0 h0dff253_16 + - gxx_impl_linux-64 15.2.0 hda75c37_16 + license: BSD-3-Clause + license_family: BSD + size: 28467 + timestamp: 1765257244273 +- conda: https://conda.anaconda.org/conda-forge/linux-64/gxx-15.2.0-h76987e4_18.conda + sha256: 2d0f5eb8b2dce1e799e5bd70e874d6dfc62bed76f3f6aef21eba711db8c1b95b + md5: d2858ce79166e9afc367bd064d73e112 + depends: + - gcc 15.2.0 h6f77f03_18 + - gxx_impl_linux-64 15.2.0 hda75c37_18 + license: BSD-3-Clause + license_family: BSD + size: 28723 + timestamp: 1771378698305 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/gxx-15.2.0-ha384071_16.conda + sha256: 9cc1f68089e1ffd2a38999db424ea41dc25f1c00c09ddd4416a83e80564f2aef + md5: 1fe2507cac92f7b68a77ad8478a4be7a + depends: + - gcc 15.2.0 h24a549f_16 + - gxx_impl_linux-aarch64 15.2.0 h03e2352_16 + license: BSD-3-Clause + license_family: BSD + size: 28544 + timestamp: 1765257509084 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/gxx-15.2.0-ha384071_18.conda + sha256: 98dbcbe55acce3bbd2a3f05d053f4b78530b44dc5595809d97c0c01315dd9df3 + md5: 838a8d3cc9ba3711bfcc831e64a19e1f + depends: + - gcc 15.2.0 h24a549f_18 + - gxx_impl_linux-aarch64 15.2.0 h03e2352_18 + license: BSD-3-Clause + license_family: BSD + size: 28780 + timestamp: 1771378557194 +- conda: https://conda.anaconda.org/conda-forge/win-64/gxx-15.2.0-hf1b5d6d_16.conda + sha256: f35ec06b150948f14e759a1b6eff930af02c70122707cd3d4d37f4d31f11098e + md5: 81c3675d46be2233a433eee4471bfbea + depends: + - gcc 15.2.0 hd556455_16 + - gxx_impl_win-64 15.2.0 h22fd5bf_16 + license: BSD-3-Clause + license_family: BSD + size: 823880 + timestamp: 1765260877461 +- conda: https://conda.anaconda.org/conda-forge/win-64/gxx-15.2.0-hf1b5d6d_18.conda + sha256: e85f25cee7618096463f426ec4c6ddd7c93058ed71c94d894c17dcb3269d867e + md5: 882c461155d96001e0611b70ab620e9b + depends: + - gcc 15.2.0 hd556455_18 + - gxx_impl_win-64 15.2.0 h22fd5bf_18 + license: BSD-3-Clause + license_family: BSD + size: 824078 + timestamp: 1771382638258 +- conda: https://conda.anaconda.org/conda-forge/linux-64/gxx_impl_linux-64-15.2.0-hda75c37_16.conda + sha256: 9ea9ec1595e163adb7d86828f638c70b7ff0b809093e34b1bee858bf0c80589a + md5: 779495181670ef15f80c3e33eea6f61a + depends: + - gcc_impl_linux-64 15.2.0 hc5723f1_16 + - libstdcxx-devel_linux-64 15.2.0 hd446a21_116 + - sysroot_linux-64 + - tzdata + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 16357678 + timestamp: 1765257161133 +- conda: https://conda.anaconda.org/conda-forge/linux-64/gxx_impl_linux-64-15.2.0-hda75c37_18.conda + sha256: 48946f1f43d699b68123fb39329ef5acf3d9cbf8f96bdb8fb14b6197f5402825 + md5: e39123ab71f2e4cf989aa6aa5fafdaaf + depends: + - gcc_impl_linux-64 15.2.0 he420e7e_18 + - libstdcxx-devel_linux-64 15.2.0 hd446a21_118 + - sysroot_linux-64 + - tzdata + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 15587873 + timestamp: 1771378609722 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/gxx_impl_linux-aarch64-15.2.0-h03e2352_16.conda + sha256: 64eb3ff50a4c5a3f85c62aeb289d897a411ef5f5fdd5784dede18f52426155c2 + md5: f1f0e9c2459ee137fd2d0280f08d7e93 + depends: + - gcc_impl_linux-aarch64 15.2.0 habb1d5c_16 + - libstdcxx-devel_linux-aarch64 15.2.0 ha7b1723_116 + - sysroot_linux-aarch64 + - tzdata + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 14627102 + timestamp: 1765257416069 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/gxx_impl_linux-aarch64-15.2.0-h03e2352_18.conda + sha256: 1f3a0ce17bd6f9549fbbb154f18b06af705d5cb6acc876b21cd9a538e501ff82 + md5: d2b287619afd562f882f2fccfd0be03a + depends: + - gcc_impl_linux-aarch64 15.2.0 hcedddb3_18 + - libstdcxx-devel_linux-aarch64 15.2.0 ha7b1723_118 + - sysroot_linux-aarch64 + - tzdata + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 15371317 + timestamp: 1771378487467 +- conda: https://conda.anaconda.org/conda-forge/win-64/gxx_impl_win-64-15.2.0-h22fd5bf_16.conda + sha256: c9f210fb9b5d36b874530d050e29dad1b2bbb1c55e1fcc8e48f25a7043cad3a7 + md5: 5bdc82063e89a2158d9ee8cb70d746dd + depends: + - gcc_impl_win-64 15.2.0 h79c4613_16 + - libstdcxx-devel_win-64 15.2.0 h0a72980_116 + - m2w64-sysroot_win-64 + - tzdata + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 14533037 + timestamp: 1765260794852 +- conda: https://conda.anaconda.org/conda-forge/win-64/gxx_impl_win-64-15.2.0-h22fd5bf_18.conda + sha256: 55a524b1910bf26952d08aeb89b0496d423110378e991b5ff6ef2c662b884760 + md5: 88379befc88f4efb16733dae4b96dac4 + depends: + - gcc_impl_win-64 15.2.0 ha526d7c_18 + - libstdcxx-devel_win-64 15.2.0 h0a72980_118 + - m2w64-sysroot_win-64 + - tzdata + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 14533744 + timestamp: 1771382555150 +- conda: https://conda.anaconda.org/conda-forge/noarch/h2-4.3.0-pyhcf101f3_0.conda + sha256: 84c64443368f84b600bfecc529a1194a3b14c3656ee2e832d15a20e0329b6da3 + md5: 164fc43f0b53b6e3a7bc7dce5e4f1dc9 + depends: + - python >=3.10 + - hyperframe >=6.1,<7 + - hpack >=4.1,<5 + - python + license: MIT + license_family: MIT + purls: + - pkg:pypi/h2?source=hash-mapping + size: 95967 + timestamp: 1756364871835 +- conda: https://conda.anaconda.org/conda-forge/linux-64/harfbuzz-12.2.0-h15599e2_0.conda + sha256: 6bd8b22beb7d40562b2889dc68232c589ff0d11a5ad3addd41a8570d11f039d9 + md5: b8690f53007e9b5ee2c2178dd4ac778c + depends: + - __glibc >=2.17,<3.0.a0 + - cairo >=1.18.4,<2.0a0 + - graphite2 >=1.3.14,<2.0a0 + - icu >=75.1,<76.0a0 + - libexpat >=2.7.1,<3.0a0 + - libfreetype >=2.14.1 + - libfreetype6 >=2.14.1 + - libgcc >=14 + - libglib >=2.86.1,<3.0a0 + - libstdcxx >=14 + - libzlib >=1.3.1,<2.0a0 + license: MIT + license_family: MIT + size: 2411408 + timestamp: 1762372726141 +- conda: https://conda.anaconda.org/conda-forge/linux-64/harfbuzz-12.3.0-h6083320_0.conda + sha256: eb0ff4632c76d5840ad8f509dc55694f79d9ac9bea5529944640e28e490361b0 + md5: 1ea5ed29aea252072b975a232b195146 + depends: + - __glibc >=2.17,<3.0.a0 + - cairo >=1.18.4,<2.0a0 + - graphite2 >=1.3.14,<2.0a0 + - icu >=78.1,<79.0a0 + - libexpat >=2.7.3,<3.0a0 + - libfreetype >=2.14.1 + - libfreetype6 >=2.14.1 + - libgcc >=14 + - libglib >=2.86.3,<3.0a0 + - libstdcxx >=14 + - libzlib >=1.3.1,<2.0a0 + license: MIT + license_family: MIT + size: 2062122 + timestamp: 1766937132307 +- conda: https://conda.anaconda.org/conda-forge/linux-64/harfbuzz-13.1.0-h6083320_0.conda + sha256: 08dc098dcc5c3445331a834f46602b927cb65d2768189f3f032a6e4643f15cd9 + md5: 5baf48da05855be929c5a50f4377794d + depends: + - __glibc >=2.17,<3.0.a0 + - cairo >=1.18.4,<2.0a0 + - graphite2 >=1.3.14,<2.0a0 + - icu >=78.2,<79.0a0 + - libexpat >=2.7.4,<3.0a0 + - libfreetype >=2.14.2 + - libfreetype6 >=2.14.2 + - libgcc >=14 + - libglib >=2.86.4,<3.0a0 + - libstdcxx >=14 + - libzlib >=1.3.1,<2.0a0 + license: MIT + license_family: MIT + size: 2615630 + timestamp: 1773217509651 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/harfbuzz-12.2.0-he4899c9_0.conda + sha256: 5cfd74a3fbce0921af5beff93a3fe7edc5b1344d9b9668b2de1c1be932b54993 + md5: 1437bf9690976948f90175a65407b65f + depends: + - cairo >=1.18.4,<2.0a0 + - graphite2 >=1.3.14,<2.0a0 + - icu >=75.1,<76.0a0 + - libexpat >=2.7.1,<3.0a0 + - libfreetype >=2.14.1 + - libfreetype6 >=2.14.1 + - libgcc >=14 + - libglib >=2.86.1,<3.0a0 + - libstdcxx >=14 + - libzlib >=1.3.1,<2.0a0 + license: MIT + license_family: MIT + size: 2156041 + timestamp: 1762376447693 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/harfbuzz-12.3.0-h1134a53_0.conda + sha256: c44b58ee4dc453469a1659c5e4c4fe306a0da65d4f7247e6df6de1cf4e607342 + md5: 60d635185d9c39e6c8dbd1771e6c7267 + depends: + - cairo >=1.18.4,<2.0a0 + - graphite2 >=1.3.14,<2.0a0 + - icu >=78.1,<79.0a0 + - libexpat >=2.7.3,<3.0a0 + - libfreetype >=2.14.1 + - libfreetype6 >=2.14.1 + - libgcc >=14 + - libglib >=2.86.3,<3.0a0 + - libstdcxx >=14 + - libzlib >=1.3.1,<2.0a0 + license: MIT + license_family: MIT + size: 2454001 + timestamp: 1766941218362 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/harfbuzz-13.1.0-h1134a53_0.conda + sha256: 49074457bdc624c0c0f39bb4b9b7689ec6334127ed7d5312484908f48e9a8e20 + md5: 811bb5384d92870a3492fab4de4ff3f6 + depends: + - cairo >=1.18.4,<2.0a0 + - graphite2 >=1.3.14,<2.0a0 + - icu >=78.2,<79.0a0 + - libexpat >=2.7.4,<3.0a0 + - libfreetype >=2.14.2 + - libfreetype6 >=2.14.2 + - libgcc >=14 + - libglib >=2.86.4,<3.0a0 + - libstdcxx >=14 + - libzlib >=1.3.1,<2.0a0 + license: MIT + license_family: MIT + size: 2346492 + timestamp: 1773222371375 +- conda: https://conda.anaconda.org/conda-forge/win-64/harfbuzz-12.2.0-h5f2951f_0.conda + sha256: db73714c7f7e0c47b3b9db9302a83f2deb6f8d6081716d35710ef3c6756af6c3 + md5: e798ef748fc564e42f381d3d276850f0 + depends: + - cairo >=1.18.4,<2.0a0 + - graphite2 >=1.3.14,<2.0a0 + - icu >=75.1,<76.0a0 + - libexpat >=2.7.1,<3.0a0 + - libfreetype >=2.14.1 + - libfreetype6 >=2.14.1 + - libglib >=2.86.1,<3.0a0 + - libzlib >=1.3.1,<2.0a0 + - ucrt >=10.0.20348.0 + - vc >=14.2,<15 + - vc14_runtime >=14.29.30139 + license: MIT + license_family: MIT + size: 1138900 + timestamp: 1762373626704 +- conda: https://conda.anaconda.org/conda-forge/win-64/harfbuzz-12.3.0-h5a1b470_0.conda + sha256: 158ebfb3ae932162e794da869505761d2d32677a3b80377abef1a3e3499d0c61 + md5: 0eb57e84ceeb62c0189827fe7966bdc5 + depends: + - cairo >=1.18.4,<2.0a0 + - graphite2 >=1.3.14,<2.0a0 + - icu >=78.1,<79.0a0 + - libexpat >=2.7.3,<3.0a0 + - libfreetype >=2.14.1 + - libfreetype6 >=2.14.1 + - libglib >=2.86.3,<3.0a0 + - libzlib >=1.3.1,<2.0a0 + - ucrt >=10.0.20348.0 + - vc >=14.2,<15 + - vc14_runtime >=14.29.30139 + license: MIT + license_family: MIT + size: 1143524 + timestamp: 1766937684751 +- conda: https://conda.anaconda.org/conda-forge/win-64/harfbuzz-13.1.0-h5a1b470_0.conda + sha256: 27acd845926048481a831b7321674b3f92accde49869fb95438f0a35ea89419b + md5: b3a4ff5d1e21d58090cd87060eb54c2d + depends: + - cairo >=1.18.4,<2.0a0 + - graphite2 >=1.3.14,<2.0a0 + - icu >=78.2,<79.0a0 + - libexpat >=2.7.4,<3.0a0 + - libfreetype >=2.14.2 + - libfreetype6 >=2.14.2 + - libglib >=2.86.4,<3.0a0 + - libzlib >=1.3.1,<2.0a0 + - ucrt >=10.0.20348.0 + - vc >=14.2,<15 + - vc14_runtime >=14.29.30139 + license: MIT + license_family: MIT + size: 1285640 + timestamp: 1773217788574 +- conda: https://conda.anaconda.org/conda-forge/noarch/hpack-4.1.0-pyhd8ed1ab_0.conda + sha256: 6ad78a180576c706aabeb5b4c8ceb97c0cb25f1e112d76495bff23e3779948ba + md5: 0a802cb9888dd14eeefc611f05c40b6e + depends: + - python >=3.9 + license: MIT + license_family: MIT + purls: + - pkg:pypi/hpack?source=hash-mapping + size: 30731 + timestamp: 1737618390337 +- conda: https://conda.anaconda.org/conda-forge/noarch/html5lib-1.1-pyhd8ed1ab_2.conda + sha256: 8027e436ad59e2a7392f6036392ef9d6c223798d8a1f4f12d5926362def02367 + md5: cf25bfddbd3bc275f3d3f9936cee1dd3 + depends: + - python >=3.9 + - six >=1.9 + - webencodings + license: MIT + license_family: MIT + purls: + - pkg:pypi/html5lib?source=hash-mapping + size: 94853 + timestamp: 1734075276288 +- conda: https://conda.anaconda.org/conda-forge/noarch/hyperframe-6.1.0-pyhd8ed1ab_0.conda + sha256: 77af6f5fe8b62ca07d09ac60127a30d9069fdc3c68d6b256754d0ffb1f7779f8 + md5: 8e6923fc12f1fe8f8c4e5c9f343256ac + depends: + - python >=3.9 + license: MIT + license_family: MIT + purls: + - pkg:pypi/hyperframe?source=hash-mapping + size: 17397 + timestamp: 1737618427549 +- conda: https://conda.anaconda.org/conda-forge/linux-64/icu-75.1-he02047a_0.conda + sha256: 71e750d509f5fa3421087ba88ef9a7b9be11c53174af3aa4d06aff4c18b38e8e + md5: 8b189310083baabfb622af68fd9d3ae3 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc-ng >=12 + - libstdcxx-ng >=12 + license: MIT + license_family: MIT + size: 12129203 + timestamp: 1720853576813 +- conda: https://conda.anaconda.org/conda-forge/linux-64/icu-78.1-h33c6efd_0.conda + sha256: 7d6463d0be5092b2ae8f2fad34dc84de83eab8bd44cc0d4be8931881c973c48f + md5: 518e9bbbc3e3486d6a4519192ba690f8 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libstdcxx >=14 + license: MIT + license_family: MIT + size: 12722920 + timestamp: 1766299101259 +- conda: https://conda.anaconda.org/conda-forge/linux-64/icu-78.2-h33c6efd_0.conda + sha256: 142a722072fa96cf16ff98eaaf641f54ab84744af81754c292cb81e0881c0329 + md5: 186a18e3ba246eccfc7cff00cd19a870 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libstdcxx >=14 + license: MIT + license_family: MIT + size: 12728445 + timestamp: 1767969922681 +- conda: https://conda.anaconda.org/conda-forge/linux-64/icu-78.3-h33c6efd_0.conda + sha256: fbf86c4a59c2ed05bbffb2ba25c7ed94f6185ec30ecb691615d42342baa1a16a + md5: c80d8a3b84358cb967fa81e7075fbc8a + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libstdcxx >=14 + license: MIT + license_family: MIT + purls: [] + size: 12723451 + timestamp: 1773822285671 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/icu-75.1-hf9b3779_0.conda + sha256: 813298f2e54ef087dbfc9cc2e56e08ded41de65cff34c639cc8ba4e27e4540c9 + md5: 268203e8b983fddb6412b36f2024e75c + depends: + - libgcc-ng >=12 + - libstdcxx-ng >=12 + license: MIT + license_family: MIT + size: 12282786 + timestamp: 1720853454991 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/icu-78.1-hb1525cb_0.conda + sha256: 550c581d08eefe420f9ed14148f1c1d59a3e33de78806a1b8d610d207d06374c + md5: 5eba836ceb0cccf969d9518ca884de2a + depends: + - libgcc >=14 + - libstdcxx >=14 + license: MIT + license_family: MIT + size: 12835377 + timestamp: 1766304007889 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/icu-78.2-hcab7f73_0.conda + sha256: dcbaa3042084ac58685e3ef4547e4c4be9d37dc52b92ea18581288af95e48b52 + md5: 998ee7d53e32f7ab57fc35707285527e + depends: + - libgcc >=14 + - libstdcxx >=14 + license: MIT + license_family: MIT + size: 12851689 + timestamp: 1772208964788 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/icu-78.3-hcab7f73_0.conda + sha256: 49ba6aed2c6b482bb0ba41078057555d29764299bc947b990708617712ef6406 + md5: 546da38c2fa9efacf203e2ad3f987c59 + depends: + - libgcc >=14 + - libstdcxx >=14 + license: MIT + license_family: MIT + purls: [] + size: 12837286 + timestamp: 1773822650615 +- conda: https://conda.anaconda.org/conda-forge/win-64/icu-75.1-he0c23c2_0.conda + sha256: 1d04369a1860a1e9e371b9fc82dd0092b616adcf057d6c88371856669280e920 + md5: 8579b6bb8d18be7c0b27fb08adeeeb40 + depends: + - ucrt >=10.0.20348.0 + - vc >=14.2,<15 + - vc14_runtime >=14.29.30139 + license: MIT + license_family: MIT + size: 14544252 + timestamp: 1720853966338 +- conda: https://conda.anaconda.org/conda-forge/win-64/icu-78.1-h637d24d_0.conda + sha256: bee083d5a0f05c380fcec1f30a71ef5518b23563aeb0a21f6b60b792645f9689 + md5: cb8048bed35ef01431184d6a88e46b3e + depends: + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: MIT + license_family: MIT + size: 13849749 + timestamp: 1766299627069 +- conda: https://conda.anaconda.org/conda-forge/win-64/icu-78.2-h637d24d_0.conda + sha256: 5a41fb28971342e293769fc968b3414253a2f8d9e30ed7c31517a15b4887246a + md5: 0ee3bb487600d5e71ab7d28951b2016a + depends: + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: MIT + license_family: MIT + size: 13222158 + timestamp: 1767970128854 +- conda: https://conda.anaconda.org/conda-forge/noarch/idna-3.11-pyhd8ed1ab_0.conda + sha256: ae89d0299ada2a3162c2614a9d26557a92aa6a77120ce142f8e0109bbf0342b0 + md5: 53abe63df7e10a6ba605dc5f9f961d36 + depends: + - python >=3.10 + license: BSD-3-Clause + license_family: BSD + purls: + - pkg:pypi/idna?source=hash-mapping + size: 50721 + timestamp: 1760286526795 +- conda: https://conda.anaconda.org/conda-forge/noarch/imagesize-2.0.0-pyhd8ed1ab_0.conda + sha256: 5a047f9eac290e679b4e6f6f4cbfcc5acdfbf031a4f06824d4ddb590cdbb850b + md5: 92617c2ba2847cca7a6ed813b6f4ab79 + depends: + - python >=3.10 + license: MIT + license_family: MIT + purls: + - pkg:pypi/imagesize?source=hash-mapping + size: 15729 + timestamp: 1773752188889 +- conda: https://conda.anaconda.org/conda-forge/noarch/importlib-metadata-8.7.0-pyhe01879c_1.conda + sha256: c18ab120a0613ada4391b15981d86ff777b5690ca461ea7e9e49531e8f374745 + md5: 63ccfdc3a3ce25b027b8767eb722fca8 + depends: + - python >=3.9 + - zipp >=3.20 + - python + license: Apache-2.0 + license_family: APACHE + size: 34641 + timestamp: 1747934053147 +- conda: https://conda.anaconda.org/conda-forge/noarch/importlib-metadata-8.8.0-pyhcf101f3_0.conda + sha256: 82ab2a0d91ca1e7e63ab6a4939356667ef683905dea631bc2121aa534d347b16 + md5: 080594bf4493e6bae2607e65390c520a + depends: + - python >=3.10 + - zipp >=3.20 + - python + license: Apache-2.0 + license_family: APACHE + purls: + - pkg:pypi/importlib-metadata?source=compressed-mapping + size: 34387 + timestamp: 1773931568510 +- conda: https://conda.anaconda.org/conda-forge/noarch/importlib-resources-6.5.2-pyhd8ed1ab_0.conda + sha256: a99a3dafdfff2bb648d2b10637c704400295cb2ba6dc929e2d814870cf9f6ae5 + md5: e376ea42e9ae40f3278b0f79c9bf9826 + depends: + - importlib_resources >=6.5.2,<6.5.3.0a0 + - python >=3.9 + license: Apache-2.0 + license_family: APACHE + purls: [] + size: 9724 + timestamp: 1736252443859 +- conda: https://conda.anaconda.org/conda-forge/noarch/importlib_resources-6.5.2-pyhd8ed1ab_0.conda + sha256: acc1d991837c0afb67c75b77fdc72b4bf022aac71fedd8b9ea45918ac9b08a80 + md5: c85c76dc67d75619a92f51dfbce06992 + depends: + - python >=3.9 + - zipp >=3.1.0 + constrains: + - importlib-resources >=6.5.2,<6.5.3.0a0 + license: Apache-2.0 + license_family: APACHE + purls: + - pkg:pypi/importlib-resources?source=hash-mapping + size: 33781 + timestamp: 1736252433366 +- conda: https://conda.anaconda.org/conda-forge/noarch/iniconfig-2.3.0-pyhd8ed1ab_0.conda + sha256: e1a9e3b1c8fe62dc3932a616c284b5d8cbe3124bbfbedcf4ce5c828cb166ee19 + md5: 9614359868482abba1bd15ce465e3c42 + depends: + - python >=3.10 + license: MIT + license_family: MIT + purls: + - pkg:pypi/iniconfig?source=hash-mapping + size: 13387 + timestamp: 1760831448842 +- conda: https://conda.anaconda.org/conda-forge/linux-64/intel-gmmlib-22.9.0-hb700be7_0.conda + sha256: edad668db79c6c4899d46e1cd4a331f5d008f9ed8f7d2e39e1dfe1a2d81acec0 + md5: 26311c5112b5c713f472bdfbb5ec5aa3 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libstdcxx >=14 + license: MIT + license_family: MIT + size: 1009795 + timestamp: 1765886047465 +- conda: https://conda.anaconda.org/conda-forge/linux-64/intel-media-driver-25.3.4-hecca717_0.conda + sha256: 286679d4c175e8db2d047be766d1629f1ea5828bff9fe7e6aac2e6f0fad2b427 + md5: 7ae2034a0e2e24eb07468f1a50cdf0bb + depends: + - __glibc >=2.17,<3.0.a0 + - intel-gmmlib >=22.8.1,<23.0a0 + - libgcc >=14 + - libstdcxx >=14 + - libva >=2.22.0,<3.0a0 + license: MIT + license_family: MIT + size: 8424610 + timestamp: 1757591682198 +- conda: https://conda.anaconda.org/conda-forge/linux-64/intel-media-driver-26.1.4-hecca717_0.conda + sha256: 425388f6dcddf438d15ea5050656ba854aef9025712e61bafb23ed34aff22e88 + md5: 85e32c66a890d4eb25bbe95ae4747466 + depends: + - __glibc >=2.17,<3.0.a0 + - intel-gmmlib >=22.9.0,<23.0a0 + - libgcc >=14 + - libstdcxx >=14 + - libva >=2.23.0,<3.0a0 + license: MIT + license_family: MIT + size: 8783533 + timestamp: 1773230300873 +- conda: https://conda.anaconda.org/conda-forge/noarch/ipykernel-7.2.0-pyh6dadd2b_1.conda + sha256: 9cdadaeef5abadca4113f92f5589db19f8b7df5e1b81cb0225f7024a3aedefa3 + md5: b3a7d5842f857414d9ae831a799444dd + depends: + - __win + - comm >=0.1.1 + - debugpy >=1.6.5 + - ipython >=7.23.1 + - jupyter_client >=8.8.0 + - jupyter_core >=5.1,!=6.0.* + - matplotlib-inline >=0.1 + - nest-asyncio >=1.4 + - packaging >=22 + - psutil >=5.7 + - python >=3.10 + - pyzmq >=25 + - tornado >=6.4.1 + - traitlets >=5.4.0 + - python + constrains: + - appnope >=0.1.2 + license: BSD-3-Clause + license_family: BSD + purls: + - pkg:pypi/ipykernel?source=hash-mapping + size: 132382 + timestamp: 1770566174387 +- conda: https://conda.anaconda.org/conda-forge/noarch/ipykernel-7.2.0-pyha191276_1.conda + sha256: b77ed58eb235e5ad80e742b03caeed4bbc2a2ef064cb9a2deee3b75dfae91b2a + md5: 8b267f517b81c13594ed68d646fd5dcb + depends: + - __linux + - comm >=0.1.1 + - debugpy >=1.6.5 + - ipython >=7.23.1 + - jupyter_client >=8.8.0 + - jupyter_core >=5.1,!=6.0.* + - matplotlib-inline >=0.1 + - nest-asyncio >=1.4 + - packaging >=22 + - psutil >=5.7 + - python >=3.10 + - pyzmq >=25 + - tornado >=6.4.1 + - traitlets >=5.4.0 + - python + constrains: + - appnope >=0.1.2 + license: BSD-3-Clause + license_family: BSD + purls: + - pkg:pypi/ipykernel?source=hash-mapping + size: 133644 + timestamp: 1770566133040 +- conda: https://conda.anaconda.org/conda-forge/noarch/ipython-9.12.0-pyhccfa634_0.conda + sha256: a0d3e4c8e4d7b3801377a03de32951f68d77dd1bfe25082c7915f4e6b0aaa463 + md5: 3734e3b6618ea6e04ad08678d8ed7a45 + depends: + - __win + - decorator >=5.1.0 + - ipython_pygments_lexers >=1.0.0 + - jedi >=0.18.2 + - matplotlib-inline >=0.1.6 + - prompt-toolkit >=3.0.41,<3.1.0 + - pygments >=2.14.0 + - python >=3.12 + - stack_data >=0.6.0 + - traitlets >=5.13.0 + - colorama >=0.4.4 + - python + license: BSD-3-Clause + license_family: BSD + purls: + - pkg:pypi/ipython?source=compressed-mapping + size: 648954 + timestamp: 1774610078420 +- conda: https://conda.anaconda.org/conda-forge/noarch/ipython-9.12.0-pyhecfbec7_0.conda + sha256: 932044bd893f7adce6c9b384b96a72fd3804cc381e76789398c2fae900f21df7 + md5: b293210beb192c3024683bf6a998a0b8 + depends: + - __unix + - decorator >=5.1.0 + - ipython_pygments_lexers >=1.0.0 + - jedi >=0.18.2 + - matplotlib-inline >=0.1.6 + - prompt-toolkit >=3.0.41,<3.1.0 + - pygments >=2.14.0 + - python >=3.12 + - stack_data >=0.6.0 + - traitlets >=5.13.0 + - pexpect >4.6 + - python + license: BSD-3-Clause + license_family: BSD + purls: + - pkg:pypi/ipython?source=compressed-mapping + size: 649967 + timestamp: 1774609994657 +- conda: https://conda.anaconda.org/conda-forge/noarch/ipython_pygments_lexers-1.1.1-pyhd8ed1ab_0.conda + sha256: 894682a42a7d659ae12878dbcb274516a7031bbea9104e92f8e88c1f2765a104 + md5: bd80ba060603cc228d9d81c257093119 + depends: + - pygments + - python >=3.9 + license: BSD-3-Clause + license_family: BSD + purls: + - pkg:pypi/ipython-pygments-lexers?source=hash-mapping + size: 13993 + timestamp: 1737123723464 +- conda: https://conda.anaconda.org/conda-forge/noarch/jedi-0.19.2-pyhd8ed1ab_1.conda + sha256: 92c4d217e2dc68983f724aa983cca5464dcb929c566627b26a2511159667dba8 + md5: a4f4c5dc9b80bc50e0d3dc4e6e8f1bd9 + depends: + - parso >=0.8.3,<0.9.0 + - python >=3.9 + license: Apache-2.0 AND MIT + purls: + - pkg:pypi/jedi?source=hash-mapping + size: 843646 + timestamp: 1733300981994 +- conda: https://conda.anaconda.org/conda-forge/noarch/jinja2-3.1.6-pyhcf101f3_1.conda + sha256: fc9ca7348a4f25fed2079f2153ecdcf5f9cf2a0bc36c4172420ca09e1849df7b + md5: 04558c96691bed63104678757beb4f8d + depends: + - markupsafe >=2.0 + - python >=3.10 + - python + license: BSD-3-Clause + license_family: BSD + purls: + - pkg:pypi/jinja2?source=compressed-mapping + size: 120685 + timestamp: 1764517220861 +- conda: https://conda.anaconda.org/conda-forge/noarch/jsonschema-4.26.0-pyhcf101f3_0.conda + sha256: db973a37d75db8e19b5f44bbbdaead0c68dde745407f281e2a7fe4db74ec51d7 + md5: ada41c863af263cc4c5fcbaff7c3e4dc + depends: + - attrs >=22.2.0 + - jsonschema-specifications >=2023.3.6 + - python >=3.10 + - referencing >=0.28.4 + - rpds-py >=0.25.0 + - python + license: MIT + license_family: MIT + purls: + - pkg:pypi/jsonschema?source=hash-mapping + size: 82356 + timestamp: 1767839954256 +- conda: https://conda.anaconda.org/conda-forge/noarch/jsonschema-specifications-2025.9.1-pyhcf101f3_0.conda + sha256: 0a4f3b132f0faca10c89fdf3b60e15abb62ded6fa80aebfc007d05965192aa04 + md5: 439cd0f567d697b20a8f45cb70a1005a + depends: + - python >=3.10 + - referencing >=0.31.0 + - python + license: MIT + license_family: MIT + purls: + - pkg:pypi/jsonschema-specifications?source=hash-mapping + size: 19236 + timestamp: 1757335715225 +- conda: https://conda.anaconda.org/conda-forge/noarch/jupyter-cache-1.0.1-pyhff2d567_0.conda + sha256: 054d397dd45ed08bffb0976702e553dfb0d0b0a477da9cff36e2ea702e928f48 + md5: b0ee650829b8974202a7abe7f8b81e5a + depends: + - attrs + - click + - importlib-metadata + - nbclient >=0.2 + - nbformat + - python >=3.9 + - pyyaml + - sqlalchemy >=1.3.12,<3 + - tabulate + license: MIT + license_family: MIT + purls: + - pkg:pypi/jupyter-cache?source=hash-mapping + size: 31236 + timestamp: 1731777189586 +- conda: https://conda.anaconda.org/conda-forge/noarch/jupyter_client-8.8.0-pyhcf101f3_0.conda + sha256: e402bd119720862a33229624ec23645916a7d47f30e1711a4af9e005162b84f3 + md5: 8a3d6d0523f66cf004e563a50d9392b3 + depends: + - jupyter_core >=5.1 + - python >=3.10 + - python-dateutil >=2.8.2 + - pyzmq >=25.0 + - tornado >=6.4.1 + - traitlets >=5.3 + - python + license: BSD-3-Clause + license_family: BSD + purls: + - pkg:pypi/jupyter-client?source=compressed-mapping + size: 112785 + timestamp: 1767954655912 +- conda: https://conda.anaconda.org/conda-forge/noarch/jupyter_core-5.9.1-pyh6dadd2b_0.conda + sha256: ed709a6c25b731e01563521ef338b93986cd14b5bc17f35e9382000864872ccc + md5: a8db462b01221e9f5135be466faeb3e0 + depends: + - __win + - pywin32 + - platformdirs >=2.5 + - python >=3.10 + - traitlets >=5.3 + - python + constrains: + - pywin32 >=300 + license: BSD-3-Clause + license_family: BSD + purls: + - pkg:pypi/jupyter-core?source=hash-mapping + size: 64679 + timestamp: 1760643889625 +- conda: https://conda.anaconda.org/conda-forge/noarch/jupyter_core-5.9.1-pyhc90fa1f_0.conda + sha256: 1d34b80e5bfcd5323f104dbf99a2aafc0e5d823019d626d0dce5d3d356a2a52a + md5: b38fe4e78ee75def7e599843ef4c1ab0 + depends: + - __unix + - python + - platformdirs >=2.5 + - python >=3.10 + - traitlets >=5.3 + - python + constrains: + - pywin32 >=300 + license: BSD-3-Clause + license_family: BSD + purls: + - pkg:pypi/jupyter-core?source=hash-mapping + size: 65503 + timestamp: 1760643864586 +- conda: https://conda.anaconda.org/conda-forge/noarch/kernel-headers_linux-64-4.18.0-he073ed8_9.conda + sha256: 41557eeadf641de6aeae49486cef30d02a6912d8da98585d687894afd65b356a + md5: 86d9cba083cd041bfbf242a01a7a1999 + constrains: + - sysroot_linux-64 ==2.28 + license: LGPL-2.0-or-later AND LGPL-2.0-or-later WITH exceptions AND GPL-2.0-or-later + license_family: GPL + size: 1278712 + timestamp: 1765578681495 +- conda: https://conda.anaconda.org/conda-forge/noarch/kernel-headers_linux-aarch64-4.18.0-h05a177a_9.conda + sha256: 5d224bf4df9bac24e69de41897c53756108c5271a0e5d2d2f66fd4e2fbc1d84b + md5: bb3b7cad9005f2cbf9d169fb30263f3e + constrains: + - sysroot_linux-aarch64 ==2.28 + license: LGPL-2.0-or-later AND LGPL-2.0-or-later WITH exceptions AND GPL-2.0-or-later + license_family: GPL + size: 1248134 + timestamp: 1765578613607 +- conda: https://conda.anaconda.org/conda-forge/linux-64/keyutils-1.6.3-hb9d3cd8_0.conda + sha256: 0960d06048a7185d3542d850986d807c6e37ca2e644342dd0c72feefcf26c2a4 + md5: b38117a3c920364aff79f870c984b4a3 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=13 + license: LGPL-2.1-or-later + purls: [] + size: 134088 + timestamp: 1754905959823 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/keyutils-1.6.3-h86ecc28_0.conda + sha256: 5ce830ca274b67de11a7075430a72020c1fb7d486161a82839be15c2b84e9988 + md5: e7df0aab10b9cbb73ab2a467ebfaf8c7 + depends: + - libgcc >=13 + license: LGPL-2.1-or-later + purls: [] + size: 129048 + timestamp: 1754906002667 +- conda: https://conda.anaconda.org/conda-forge/linux-64/krb5-1.22.2-ha1258a1_0.conda + sha256: 3e307628ca3527448dd1cb14ad7bb9d04d1d28c7d4c5f97ba196ae984571dd25 + md5: fb53fb07ce46a575c5d004bbc96032c2 + depends: + - __glibc >=2.17,<3.0.a0 + - keyutils >=1.6.3,<2.0a0 + - libedit >=3.1.20250104,<3.2.0a0 + - libedit >=3.1.20250104,<4.0a0 + - libgcc >=14 + - libstdcxx >=14 + - openssl >=3.5.5,<4.0a0 + license: MIT + license_family: MIT + purls: [] + size: 1386730 + timestamp: 1769769569681 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/krb5-1.22.2-hfd895c2_0.conda + sha256: b53999d888dda53c506b264e8c02b5f5c8e022c781eda0718f007339e6bc90ba + md5: d9ca108bd680ea86a963104b6b3e95ca + depends: + - keyutils >=1.6.3,<2.0a0 + - libedit >=3.1.20250104,<3.2.0a0 + - libedit >=3.1.20250104,<4.0a0 + - libgcc >=14 + - libstdcxx >=14 + - openssl >=3.5.5,<4.0a0 + license: MIT + license_family: MIT + purls: [] + size: 1517436 + timestamp: 1769773395215 +- conda: https://conda.anaconda.org/conda-forge/win-64/krb5-1.22.2-h0ea6238_0.conda + sha256: eb60f1ad8b597bcf95dee11bc11fe71a8325bc1204cf51d2bb1f2120ffd77761 + md5: 4432f52dc0c8eb6a7a6abc00a037d93c + depends: + - openssl >=3.5.5,<4.0a0 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: MIT + license_family: MIT + purls: [] + size: 751055 + timestamp: 1769769688841 +- conda: https://conda.anaconda.org/conda-forge/linux-64/lame-3.100-h166bdaf_1003.tar.bz2 + sha256: aad2a703b9d7b038c0f745b853c6bb5f122988fe1a7a096e0e606d9cbec4eaab + md5: a8832b479f93521a9e7b5b743803be51 + depends: + - libgcc-ng >=12 + license: LGPL-2.0-only + license_family: LGPL + size: 508258 + timestamp: 1664996250081 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/lame-3.100-h4e544f5_1003.tar.bz2 + sha256: 2502904a42df6d94bd743f7b73915415391dd6d31d5f50cb57c0a54a108e7b0a + md5: ab05bcf82d8509b4243f07e93bada144 + depends: + - libgcc-ng >=12 + license: LGPL-2.0-only + license_family: LGPL + size: 604863 + timestamp: 1664997611416 +- conda: https://conda.anaconda.org/conda-forge/win-64/lame-3.100-hcfcfb64_1003.tar.bz2 + sha256: 824988a396b97bb9138823a1b3aabd8326e06da5834b3011253d72bb45fd3a88 + md5: d92e64077c44c9e32c72d4b5799d47e4 + depends: + - ucrt >=10.0.20348.0 + - vc >=14.2,<15 + - vs2015_runtime >=14.29.30139 + license: LGPL-2.0-only + license_family: LGPL + size: 570583 + timestamp: 1664996824680 +- conda: https://conda.anaconda.org/conda-forge/linux-64/ld_impl_linux-64-2.45-default_hbd61a6d_104.conda + sha256: 9e191baf2426a19507f1d0a17be0fdb7aa155cdf0f61d5a09c808e0a69464312 + md5: a6abd2796fc332536735f68ba23f7901 + depends: + - __glibc >=2.17,<3.0.a0 + - zstd >=1.5.7,<1.6.0a0 + constrains: + - binutils_impl_linux-64 2.45 + license: GPL-3.0-only + license_family: GPL + size: 725545 + timestamp: 1764007826689 +- conda: https://conda.anaconda.org/conda-forge/linux-64/ld_impl_linux-64-2.45-default_hbd61a6d_105.conda + sha256: 1027bd8aa0d5144e954e426ab6218fd5c14e54a98f571985675468b339c808ca + md5: 3ec0aa5037d39b06554109a01e6fb0c6 + depends: + - __glibc >=2.17,<3.0.a0 + - zstd >=1.5.7,<1.6.0a0 + constrains: + - binutils_impl_linux-64 2.45 + license: GPL-3.0-only + license_family: GPL + size: 730831 + timestamp: 1766513089214 +- conda: https://conda.anaconda.org/conda-forge/linux-64/ld_impl_linux-64-2.45.1-default_hbd61a6d_101.conda + sha256: 565941ac1f8b0d2f2e8f02827cbca648f4d18cd461afc31f15604cd291b5c5f3 + md5: 12bd9a3f089ee6c9266a37dab82afabd + depends: + - __glibc >=2.17,<3.0.a0 + - zstd >=1.5.7,<1.6.0a0 + constrains: + - binutils_impl_linux-64 2.45.1 + license: GPL-3.0-only + license_family: GPL + size: 725507 + timestamp: 1770267139900 +- conda: https://conda.anaconda.org/conda-forge/linux-64/ld_impl_linux-64-2.45.1-default_hbd61a6d_102.conda + sha256: 3d584956604909ff5df353767f3a2a2f60e07d070b328d109f30ac40cd62df6c + md5: 18335a698559cdbcd86150a48bf54ba6 + depends: + - __glibc >=2.17,<3.0.a0 + - zstd >=1.5.7,<1.6.0a0 + constrains: + - binutils_impl_linux-64 2.45.1 + license: GPL-3.0-only + license_family: GPL + purls: [] + size: 728002 + timestamp: 1774197446916 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/ld_impl_linux-aarch64-2.45-default_h1979696_104.conda + sha256: 7a13072581fa23f658a04f62f62c4677c57d3c9696fbc01cc954a88fc354b44d + md5: 28035705fe0c977ea33963489cd008ad + depends: + - zstd >=1.5.7,<1.6.0a0 + constrains: + - binutils_impl_linux-aarch64 2.45 + license: GPL-3.0-only + license_family: GPL + size: 875534 + timestamp: 1764007911054 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/ld_impl_linux-aarch64-2.45-default_h1979696_105.conda + sha256: 12e7341b89e9ea319a3b4de03d02cd988fa02b8a678f4e46779515009b5e475c + md5: 849c4cbbf8dd1d71e66c13afed1d2f12 + depends: + - zstd >=1.5.7,<1.6.0a0 + constrains: + - binutils_impl_linux-aarch64 2.45 + license: GPL-3.0-only + license_family: GPL + size: 876257 + timestamp: 1766513180236 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/ld_impl_linux-aarch64-2.45.1-default_h1979696_101.conda + sha256: 44527364aa333be631913451c32eb0cae1e09343827e9ce3ccabd8d962584226 + md5: 35b2ae7fadf364b8e5fb8185aaeb80e5 + depends: + - zstd >=1.5.7,<1.6.0a0 + constrains: + - binutils_impl_linux-aarch64 2.45.1 + license: GPL-3.0-only + license_family: GPL + size: 875924 + timestamp: 1770267209884 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/ld_impl_linux-aarch64-2.45.1-default_h1979696_102.conda + sha256: 7abd913d81a9bf00abb699e8987966baa2065f5132e37e815f92d90fc6bba530 + md5: a21644fc4a83da26452a718dc9468d5f + depends: + - zstd >=1.5.7,<1.6.0a0 + constrains: + - binutils_impl_linux-aarch64 2.45.1 + license: GPL-3.0-only + license_family: GPL + purls: [] + size: 875596 + timestamp: 1774197520746 +- conda: https://conda.anaconda.org/conda-forge/win-64/ld_impl_win-64-2.45-default_hfd38196_104.conda + sha256: 14f0c7487f0567ce4e0af3a4f0c4378597d0db4798b0786d6acc8d9498c8ed5a + md5: 53e0006599159c099d051eaa08316403 + depends: + - zstd >=1.5.7,<1.6.0a0 + constrains: + - binutils_impl_win-64 2.45 + license: GPL-3.0-only + license_family: GPL + size: 876777 + timestamp: 1764007762541 +- conda: https://conda.anaconda.org/conda-forge/win-64/ld_impl_win-64-2.45-default_hfd38196_105.conda + sha256: fd7827e813bdb1f255cedf1e9d003c8be431c52f455a74d1455527e688a6b34b + md5: cd7c6627fc038d00421f9d2970587fa9 + depends: + - zstd >=1.5.7,<1.6.0a0 + constrains: + - binutils_impl_win-64 2.45 + license: GPL-3.0-only + license_family: GPL + size: 876611 + timestamp: 1766513627408 +- conda: https://conda.anaconda.org/conda-forge/win-64/ld_impl_win-64-2.45.1-default_hfd38196_101.conda + sha256: 6e0294b26a796436c0e449cc55d45ec518904c6e666ca882a74000407f25aed5 + md5: 6e84306d2deb7e69d0bc90a6b36d5ebb + depends: + - zstd >=1.5.7,<1.6.0a0 + constrains: + - binutils_impl_win-64 2.45.1 + license: GPL-3.0-only + license_family: GPL + size: 876736 + timestamp: 1770267709635 +- conda: https://conda.anaconda.org/conda-forge/linux-64/lerc-4.0.0-h0aef613_1.conda + sha256: 412381a43d5ff9bbed82cd52a0bbca5b90623f62e41007c9c42d3870c60945ff + md5: 9344155d33912347b37f0ae6c410a835 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=13 + - libstdcxx >=13 + license: Apache-2.0 + license_family: Apache + size: 264243 + timestamp: 1745264221534 +- conda: https://conda.anaconda.org/conda-forge/linux-64/lerc-4.1.0-hdb68285_0.conda + sha256: f84cb54782f7e9cea95e810ea8fef186e0652d0fa73d3009914fa2c1262594e1 + md5: a752488c68f2e7c456bcbd8f16eec275 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libstdcxx >=14 + license: Apache-2.0 + license_family: Apache + size: 261513 + timestamp: 1773113328888 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/lerc-4.0.0-hfdc4d58_1.conda + sha256: f01df5bbf97783fac9b89be602b4d02f94353f5221acfd80c424ec1c9a8d276c + md5: 60dceb7e876f4d74a9cbd42bbbc6b9cf + depends: + - libgcc >=13 + - libstdcxx >=13 + license: Apache-2.0 + license_family: Apache + size: 227184 + timestamp: 1745265544057 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/lerc-4.1.0-h52b7260_0.conda + sha256: 8957fd460c1c132c8031f65fd5f56ec3807fd71b7cab2c5e2b0937b13404ab36 + md5: d13423b06447113a90b5b1366d4da171 + depends: + - libgcc >=14 + - libstdcxx >=14 + license: Apache-2.0 + license_family: Apache + size: 240444 + timestamp: 1773114901155 +- conda: https://conda.anaconda.org/conda-forge/win-64/lerc-4.0.0-h6470a55_1.conda + sha256: 868a3dff758cc676fa1286d3f36c3e0101cca56730f7be531ab84dc91ec58e9d + md5: c1b81da6d29a14b542da14a36c9fbf3f + depends: + - ucrt >=10.0.20348.0 + - vc >=14.2,<15 + - vc14_runtime >=14.29.30139 + license: Apache-2.0 + license_family: Apache + size: 164701 + timestamp: 1745264384716 +- conda: https://conda.anaconda.org/conda-forge/win-64/lerc-4.1.0-hd936e49_0.conda + sha256: 45df58fca800b552b17c3914cc9ab0d55a82c5172d72b5c44a59c710c06c5473 + md5: 54b231d595bc1ff9bff668dd443ee012 + depends: + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: Apache-2.0 + license_family: Apache + size: 172395 + timestamp: 1773113455582 +- conda: https://conda.anaconda.org/conda-forge/linux-64/level-zero-1.26.2-hb700be7_0.conda + sha256: 1a756a2b8d58d2789223bc63971ffef714a8d5fadeb565dd82239c2395fbc858 + md5: c0fd9999cacbe6c0156459080635b2d6 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libstdcxx >=14 + license: MIT + license_family: MIT + size: 667315 + timestamp: 1765910088541 +- conda: https://conda.anaconda.org/conda-forge/linux-64/level-zero-1.26.3-hb700be7_0.conda + sha256: 5dfff8a79f1e6433d84ea924ef71ae472980c2e7248c44e6e171c4eaa4db5c68 + md5: 8dea0df062e53c80274a09150f0c2941 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libstdcxx >=14 + license: MIT + license_family: MIT + size: 667437 + timestamp: 1766226025812 +- conda: https://conda.anaconda.org/conda-forge/linux-64/level-zero-1.28.2-hb700be7_0.conda + sha256: 5384380213daffbd7fe4d568b2cf2ab9f2476f7a5f228a3d70280e98333eaf0f + md5: 4323e07abff8366503b97a0f17924b76 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libstdcxx >=14 + license: MIT + license_family: MIT + size: 858387 + timestamp: 1772045965844 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libabseil-20250512.1-cxx17_hba17884_0.conda + sha256: dcd1429a1782864c452057a6c5bc1860f2b637dc20a2b7e6eacd57395bbceff8 + md5: 83b160d4da3e1e847bf044997621ed63 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=13 + - libstdcxx >=13 + constrains: + - libabseil-static =20250512.1=cxx17* + - abseil-cpp =20250512.1 + license: Apache-2.0 + license_family: Apache + size: 1310612 + timestamp: 1750194198254 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libabseil-20260107.1-cxx17_h7b12aa8_0.conda + sha256: a7a4481a4d217a3eadea0ec489826a69070fcc3153f00443aa491ed21527d239 + md5: 6f7b4302263347698fd24565fbf11310 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libstdcxx >=14 + constrains: + - libabseil-static =20260107.1=cxx17* + - abseil-cpp =20260107.1 + license: Apache-2.0 + license_family: Apache + size: 1384817 + timestamp: 1770863194876 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libabseil-20250512.1-cxx17_h201e9ed_0.conda + sha256: 28bb0a5f3177bb3b45a89d309b93bef65645671d1c97ae7bbcfa74481bf33f3c + md5: 4db30fe7ba05e2ce66595ed646064861 + depends: + - libgcc >=13 + - libstdcxx >=13 + constrains: + - abseil-cpp =20250512.1 + - libabseil-static =20250512.1=cxx17* + license: Apache-2.0 + license_family: Apache + size: 1327580 + timestamp: 1750194149128 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libabseil-20260107.1-cxx17_h6983b43_0.conda + sha256: 37675140819e10235a8ff342cb09f688f843ac390b64856d8e230700bbd7d5aa + md5: 2a19160c13e688710dd200812fc9a6d3 + depends: + - libgcc >=14 + - libstdcxx >=14 + constrains: + - abseil-cpp =20260107.1 + - libabseil-static =20260107.1=cxx17* + license: Apache-2.0 + license_family: Apache + size: 1401836 + timestamp: 1770863223557 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libass-0.17.4-h96ad9f0_0.conda + sha256: 035eb8b54e03e72e42ef707420f9979c7427776ea99e0f1e3c969f92eb573f19 + md5: d3be7b2870bf7aff45b12ea53165babd + depends: + - libgcc >=13 + - __glibc >=2.17,<3.0.a0 + - libzlib >=1.3.1,<2.0a0 + - libfreetype >=2.13.3 + - libfreetype6 >=2.13.3 + - fribidi >=1.0.10,<2.0a0 + - libiconv >=1.18,<2.0a0 + - fontconfig >=2.15.0,<3.0a0 + - fonts-conda-ecosystem + - harfbuzz >=11.0.1 + license: ISC + size: 152179 + timestamp: 1749328931930 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libass-0.17.4-hcfe818d_0.conda + sha256: cb19ad0b8f9cb469c78d26af9c49c790e5f746bb8a348ec10b681a98f05d1dc7 + md5: 8df67d209c9f7e8d40281a4ebf8ffd6d + depends: + - libgcc >=13 + - libiconv >=1.18,<2.0a0 + - harfbuzz >=11.0.1 + - fontconfig >=2.15.0,<3.0a0 + - fonts-conda-ecosystem + - fribidi >=1.0.10,<2.0a0 + - libfreetype >=2.13.3 + - libfreetype6 >=2.13.3 + - libzlib >=1.3.1,<2.0a0 + license: ISC + size: 171287 + timestamp: 1749328949722 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libblas-3.11.0-5_h4a7cf45_openblas.conda + build_number: 5 + sha256: 18c72545080b86739352482ba14ba2c4815e19e26a7417ca21a95b76ec8da24c + md5: c160954f7418d7b6e87eaf05a8913fa9 + depends: + - libopenblas >=0.3.30,<0.3.31.0a0 + - libopenblas >=0.3.30,<1.0a0 + constrains: + - mkl <2026 + - liblapack 3.11.0 5*_openblas + - libcblas 3.11.0 5*_openblas + - blas 2.305 openblas + - liblapacke 3.11.0 5*_openblas + license: BSD-3-Clause + license_family: BSD + size: 18213 + timestamp: 1765818813880 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libblas-3.11.0-6_h4a7cf45_openblas.conda + build_number: 6 + sha256: 7bfe936dbb5db04820cf300a9cc1f5ee8d5302fc896c2d66e30f1ee2f20fbfd6 + md5: 6d6d225559bfa6e2f3c90ee9c03d4e2e + depends: + - libopenblas >=0.3.32,<0.3.33.0a0 + - libopenblas >=0.3.32,<1.0a0 + constrains: + - blas 2.306 openblas + - liblapack 3.11.0 6*_openblas + - liblapacke 3.11.0 6*_openblas + - libcblas 3.11.0 6*_openblas + - mkl <2026 + license: BSD-3-Clause + license_family: BSD + purls: [] + size: 18621 + timestamp: 1774503034895 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libblas-3.11.0-5_haddc8a3_openblas.conda + build_number: 5 + sha256: 700f3c03d0fba8e687a345404a45fbabe781c1cf92242382f62cef2948745ec4 + md5: 5afcea37a46f76ec1322943b3c4dfdc0 + depends: + - libopenblas >=0.3.30,<0.3.31.0a0 + - libopenblas >=0.3.30,<1.0a0 + constrains: + - mkl <2026 + - libcblas 3.11.0 5*_openblas + - liblapack 3.11.0 5*_openblas + - liblapacke 3.11.0 5*_openblas + - blas 2.305 openblas + license: BSD-3-Clause + license_family: BSD + size: 18369 + timestamp: 1765818610617 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libblas-3.11.0-6_haddc8a3_openblas.conda + build_number: 6 + sha256: 7374c744c37786bfa4cfd30bbbad13469882e5d9f32ed792922b447b7e369554 + md5: 652bb20bb4618cacd11e17ae070f47ce + depends: + - libopenblas >=0.3.32,<0.3.33.0a0 + - libopenblas >=0.3.32,<1.0a0 + constrains: + - blas 2.306 openblas + - mkl <2026 + - liblapack 3.11.0 6*_openblas + - liblapacke 3.11.0 6*_openblas + - libcblas 3.11.0 6*_openblas + license: BSD-3-Clause + license_family: BSD + purls: [] + size: 18682 + timestamp: 1774503047392 +- conda: https://conda.anaconda.org/conda-forge/win-64/libblas-3.11.0-5_hf2e6a31_mkl.conda + build_number: 5 + sha256: f0cb7b2697461a306341f7ff32d5b361bb84f3e94478464c1e27ee01fc8f276b + md5: f9decf88743af85c9c9e05556a4c47c0 + depends: + - mkl >=2025.3.0,<2026.0a0 + constrains: + - liblapack 3.11.0 5*_mkl + - libcblas 3.11.0 5*_mkl + - blas 2.305 mkl + - liblapacke 3.11.0 5*_mkl + license: BSD-3-Clause + license_family: BSD + size: 67438 + timestamp: 1765819100043 +- conda: https://conda.anaconda.org/conda-forge/win-64/libblas-3.11.0-6_hf2e6a31_mkl.conda + build_number: 6 + sha256: 10c8054f007adca8c780cd8bb9335fa5d990f0494b825158d3157983a25b1ea2 + md5: 95543eec964b4a4a7ca3c4c9be481aa1 + depends: + - mkl >=2025.3.1,<2026.0a0 + constrains: + - blas 2.306 mkl + - liblapacke 3.11.0 6*_mkl + - liblapack 3.11.0 6*_mkl + - libcblas 3.11.0 6*_mkl + license: BSD-3-Clause + license_family: BSD + purls: [] + size: 68082 + timestamp: 1774503684284 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libbrotlicommon-1.2.0-hb03c661_1.conda + sha256: 318f36bd49ca8ad85e6478bd8506c88d82454cc008c1ac1c6bf00a3c42fa610e + md5: 72c8fd1af66bd67bf580645b426513ed + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + license: MIT + license_family: MIT + size: 79965 + timestamp: 1764017188531 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libbrotlicommon-1.2.0-he30d5cf_1.conda + sha256: 5fa8c163c8d776503aa68cdaf798ff9440c76a0a1c3ea84e0c43dbf1ece8af4d + md5: 8ec1d03f3000108899d1799d9964f281 + depends: + - libgcc >=14 + license: MIT + license_family: MIT + size: 80030 + timestamp: 1764017273715 +- conda: https://conda.anaconda.org/conda-forge/win-64/libbrotlicommon-1.2.0-hfd05255_1.conda + sha256: 5097303c2fc8ebf9f9ea9731520aa5ce4847d0be41764edd7f6dee2100b82986 + md5: 444b0a45bbd1cb24f82eedb56721b9c4 + depends: + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: MIT + license_family: MIT + size: 82042 + timestamp: 1764017799966 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libbrotlidec-1.2.0-hb03c661_1.conda + sha256: 12fff21d38f98bc446d82baa890e01fd82e3b750378fedc720ff93522ffb752b + md5: 366b40a69f0ad6072561c1d09301c886 + depends: + - __glibc >=2.17,<3.0.a0 + - libbrotlicommon 1.2.0 hb03c661_1 + - libgcc >=14 + license: MIT + license_family: MIT + size: 34632 + timestamp: 1764017199083 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libbrotlidec-1.2.0-he30d5cf_1.conda + sha256: 494365e8f58799ea95a6e82334ef696e9c2120aecd6626121694b30a15033301 + md5: 47e5b71b77bb8b47b4ecf9659492977f + depends: + - libbrotlicommon 1.2.0 he30d5cf_1 + - libgcc >=14 + license: MIT + license_family: MIT + size: 33166 + timestamp: 1764017282936 +- conda: https://conda.anaconda.org/conda-forge/win-64/libbrotlidec-1.2.0-hfd05255_1.conda + sha256: 3239ce545cf1c32af6fffb7fc7c75cb1ef5b6ea8221c66c85416bb2d46f5cccb + md5: 450e3ae947fc46b60f1d8f8f318b40d4 + depends: + - libbrotlicommon 1.2.0 hfd05255_1 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: MIT + license_family: MIT + size: 34449 + timestamp: 1764017851337 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libbrotlienc-1.2.0-hb03c661_1.conda + sha256: a0c15c79997820bbd3fbc8ecf146f4fe0eca36cc60b62b63ac6cf78857f1dd0d + md5: 4ffbb341c8b616aa2494b6afb26a0c5f + depends: + - __glibc >=2.17,<3.0.a0 + - libbrotlicommon 1.2.0 hb03c661_1 + - libgcc >=14 + license: MIT + license_family: MIT + size: 298378 + timestamp: 1764017210931 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libbrotlienc-1.2.0-he30d5cf_1.conda + sha256: f998c03257b9aa1f7464446af2cf424862f0e54258a2a588309853e45ae771df + md5: 6553a5d017fe14859ea8a4e6ea5def8f + depends: + - libbrotlicommon 1.2.0 he30d5cf_1 + - libgcc >=14 + license: MIT + license_family: MIT + size: 309304 + timestamp: 1764017292044 +- conda: https://conda.anaconda.org/conda-forge/win-64/libbrotlienc-1.2.0-hfd05255_1.conda + sha256: 3226df6b7df98734440739f75527d585d42ca2bfe912fbe8d1954c512f75341a + md5: ccd93cfa8e54fd9df4e83dbe55ff6e8c + depends: + - libbrotlicommon 1.2.0 hfd05255_1 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: MIT + license_family: MIT + size: 252903 + timestamp: 1764017901735 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libcap-2.77-h3ff7636_0.conda + sha256: 9517cce5193144af0fcbf19b7bd67db0a329c2cc2618f28ffecaa921a1cbe9d3 + md5: 09c264d40c67b82b49a3f3b89037bd2e + depends: + - __glibc >=2.17,<3.0.a0 + - attr >=2.5.2,<2.6.0a0 + - libgcc >=14 + license: BSD-3-Clause + license_family: BSD + size: 121429 + timestamp: 1762349484074 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libcap-2.77-hd0affe5_1.conda + sha256: 37c41b1024d0c75da76822e3c079aabaf121618a32fe05e53a897b35a88008fc + md5: 499cd8e2d4358986dbe3b30e8fe1bf6a + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + license: BSD-3-Clause + license_family: BSD + purls: [] + size: 124432 + timestamp: 1774333989027 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libcap-2.77-h68e9139_0.conda + sha256: 154eefd8f94010d89ba76a057949b9b1f75c7379bd0d19d4657c952bedcf5904 + md5: 10fe36ec0a9f7b1caae0331c9ba50f61 + depends: + - attr >=2.5.1,<2.6.0a0 + - libgcc >=14 + license: BSD-3-Clause + license_family: BSD + size: 108542 + timestamp: 1762350753349 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libcap-2.77-hf9559e3_1.conda + sha256: e04f0c4287362ea2033421c1b516d7d83c308084bcc9483b2e6038ec7c711e0a + md5: bdda58ab0358b0e9ff45fd2503b38410 + depends: + - libgcc >=14 + license: BSD-3-Clause + license_family: BSD + purls: [] + size: 109458 + timestamp: 1774335293336 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libcblas-3.11.0-5_h0358290_openblas.conda + build_number: 5 + sha256: 0cbdcc67901e02dc17f1d19e1f9170610bd828100dc207de4d5b6b8ad1ae7ad8 + md5: 6636a2b6f1a87572df2970d3ebc87cc0 + depends: + - libblas 3.11.0 5_h4a7cf45_openblas + constrains: + - liblapacke 3.11.0 5*_openblas + - blas 2.305 openblas + - liblapack 3.11.0 5*_openblas + license: BSD-3-Clause + license_family: BSD + size: 18194 + timestamp: 1765818837135 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libcblas-3.11.0-6_h0358290_openblas.conda + build_number: 6 + sha256: 57edafa7796f6fa3ebbd5367692dd4c7f552be42109c2dd1a7c89b55089bf374 + md5: 36ae340a916635b97ac8a0655ace2a35 + depends: + - libblas 3.11.0 6_h4a7cf45_openblas + constrains: + - blas 2.306 openblas + - liblapack 3.11.0 6*_openblas + - liblapacke 3.11.0 6*_openblas + license: BSD-3-Clause + license_family: BSD + purls: [] + size: 18622 + timestamp: 1774503050205 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libcblas-3.11.0-5_hd72aa62_openblas.conda + build_number: 5 + sha256: 3fad5c9de161dccb4e42c8b1ae8eccb33f4ed56bccbcced9cbb0956ae7869e61 + md5: 0b2f1143ae2d0aa4c991959d0daaf256 + depends: + - libblas 3.11.0 5_haddc8a3_openblas + constrains: + - liblapack 3.11.0 5*_openblas + - liblapacke 3.11.0 5*_openblas + - blas 2.305 openblas + license: BSD-3-Clause + license_family: BSD + size: 18371 + timestamp: 1765818618899 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libcblas-3.11.0-6_hd72aa62_openblas.conda + build_number: 6 + sha256: 5dd9e872cf8ebd632f31cd3a5ca6d3cb331f4d3a90bfafbe572093afeb77632b + md5: 939e300b110db241a96a1bed438c315b + depends: + - libblas 3.11.0 6_haddc8a3_openblas + constrains: + - blas 2.306 openblas + - liblapack 3.11.0 6*_openblas + - liblapacke 3.11.0 6*_openblas + license: BSD-3-Clause + license_family: BSD + purls: [] + size: 18689 + timestamp: 1774503058069 +- conda: https://conda.anaconda.org/conda-forge/win-64/libcblas-3.11.0-5_h2a3cdd5_mkl.conda + build_number: 5 + sha256: 49dc59d8e58360920314b8d276dd80da7866a1484a9abae4ee2760bc68f3e68d + md5: b3fa8e8b55310ba8ef0060103afb02b5 + depends: + - libblas 3.11.0 5_hf2e6a31_mkl + constrains: + - liblapack 3.11.0 5*_mkl + - liblapacke 3.11.0 5*_mkl + - blas 2.305 mkl + license: BSD-3-Clause + license_family: BSD + size: 68079 + timestamp: 1765819124349 +- conda: https://conda.anaconda.org/conda-forge/win-64/libcblas-3.11.0-6_h2a3cdd5_mkl.conda + build_number: 6 + sha256: 02b2a2225f4899c6aaa1dc723e06b3f7a4903d2129988f91fc1527409b07b0a5 + md5: 9e4bf521c07f4d423cba9296b7927e3c + depends: + - libblas 3.11.0 6_hf2e6a31_mkl + constrains: + - blas 2.306 mkl + - liblapacke 3.11.0 6*_mkl + - liblapack 3.11.0 6*_mkl + license: BSD-3-Clause + license_family: BSD + purls: [] + size: 68221 + timestamp: 1774503722413 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libcufile-1.14.1.1-hbc026e6_1.conda + sha256: 5fa43e8a8d335fc0c3a6aeb2e7b0debc7d8495b8a60a56ac30f23b0e852ab74a + md5: cab1818eada3952ed09c8dcbb7c26af7 + depends: + - __glibc >=2.17,<3.0.a0 + - cuda-version >=12.9,<12.10.0a0 + - libgcc >=14 + - libstdcxx >=14 + - rdma-core >=59.0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 969845 + timestamp: 1761098818759 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libcufile-1.18.0.66-h85c024f_0.conda + sha256: aa2ce3784f756fabde147be6dc606f93a6e6be5e0a146697b57454e9f4adc264 + md5: f760d9e2103a43d25f930cd3706c0cab + depends: + - __glibc >=2.28,<3.0.a0 + - cuda-version >=13.3,<13.4.0a0 + - libgcc >=14 + - libstdcxx >=14 + - rdma-core >=61.0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + purls: [] + size: 1115061 + timestamp: 1779897561291 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libcufile-1.14.1.1-had8bf56_1.conda + sha256: fbc1fa6b3ddf946b2999c9820310682739505df71e1e2ac513a72efb951fa3e5 + md5: ee136db5a5409dddc78eaf7658fccffe + depends: + - __glibc >=2.28,<3.0.a0 + - arm-variant * sbsa + - cuda-version >=12.9,<12.10.0a0 + - libgcc >=14 + - libstdcxx >=14 + - rdma-core >=59.0 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 909365 + timestamp: 1761098964619 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libcufile-1.18.0.66-h4243460_0.conda + sha256: 46bd414aaac6274db9118965459a173f8339529c6d0fda53d2e167579cee1ce0 + md5: cc1766bf438c27f357c37bf0869686f1 + depends: + - __glibc >=2.28,<3.0.a0 + - arm-variant * sbsa + - cuda-version >=13.3,<13.4.0a0 + - libgcc >=14 + - libstdcxx >=14 + - rdma-core >=61.0 + constrains: + - arm-variant * sbsa + license: LicenseRef-NVIDIA-End-User-License-Agreement + purls: [] + size: 998160 + timestamp: 1779897582676 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libdeflate-1.25-h17f619e_0.conda + sha256: aa8e8c4be9a2e81610ddf574e05b64ee131fab5e0e3693210c9d6d2fba32c680 + md5: 6c77a605a7a689d17d4819c0f8ac9a00 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + license: MIT + license_family: MIT + size: 73490 + timestamp: 1761979956660 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libdeflate-1.25-h1af38f5_0.conda + sha256: 48814b73bd462da6eed2e697e30c060ae16af21e9fbed30d64feaf0aad9da392 + md5: a9138815598fe6b91a1d6782ca657b0c + depends: + - libgcc >=14 + license: MIT + license_family: MIT + size: 71117 + timestamp: 1761979776756 +- conda: https://conda.anaconda.org/conda-forge/win-64/libdeflate-1.25-h51727cc_0.conda + sha256: 834e4881a18b690d5ec36f44852facd38e13afe599e369be62d29bd675f107ee + md5: e77030e67343e28b084fabd7db0ce43e + depends: + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: MIT + license_family: MIT + size: 156818 + timestamp: 1761979842440 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libdrm-2.4.125-hb03c661_1.conda + sha256: c076a213bd3676cc1ef22eeff91588826273513ccc6040d9bea68bccdc849501 + md5: 9314bc5a1fe7d1044dc9dfd3ef400535 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libpciaccess >=0.18,<0.19.0a0 + license: MIT + license_family: MIT + size: 310785 + timestamp: 1757212153962 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libdrm-2.4.125-he30d5cf_1.conda + sha256: 4e6cdb5dd37db794b88bec714b4418a0435b04d14e9f7afc8cc32f2a3ced12f2 + md5: 2079727b538f6dd16f3fa579d4c3c53f + depends: + - libgcc >=14 + - libpciaccess >=0.18,<0.19.0a0 + license: MIT + license_family: MIT + size: 344548 + timestamp: 1757212128414 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libedit-3.1.20250104-pl5321h7949ede_0.conda + sha256: d789471216e7aba3c184cd054ed61ce3f6dac6f87a50ec69291b9297f8c18724 + md5: c277e0a4d549b03ac1e9d6cbbe3d017b + depends: + - ncurses + - __glibc >=2.17,<3.0.a0 + - libgcc >=13 + - ncurses >=6.5,<7.0a0 + license: BSD-2-Clause + license_family: BSD + purls: [] + size: 134676 + timestamp: 1738479519902 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libedit-3.1.20250104-pl5321h976ea20_0.conda + sha256: c0b27546aa3a23d47919226b3a1635fccdb4f24b94e72e206a751b33f46fd8d6 + md5: fb640d776fc92b682a14e001980825b1 + depends: + - ncurses + - libgcc >=13 + - ncurses >=6.5,<7.0a0 + license: BSD-2-Clause + license_family: BSD + purls: [] + size: 148125 + timestamp: 1738479808948 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libegl-1.7.0-ha4b6fd6_2.conda + sha256: 7fd5408d359d05a969133e47af580183fbf38e2235b562193d427bb9dad79723 + md5: c151d5eb730e9b7480e6d48c0fc44048 + depends: + - __glibc >=2.17,<3.0.a0 + - libglvnd 1.7.0 ha4b6fd6_2 + license: LicenseRef-libglvnd + size: 44840 + timestamp: 1731330973553 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libegl-1.7.0-hd24410f_2.conda + sha256: 8962abf38a58c235611ce356b9899f6caeb0352a8bce631b0bcc59352fda455e + md5: cf105bce884e4ef8c8ccdca9fe6695e7 + depends: + - libglvnd 1.7.0 hd24410f_2 + license: LicenseRef-libglvnd + size: 53551 + timestamp: 1731330990477 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libexpat-2.7.3-hecca717_0.conda + sha256: 1e1b08f6211629cbc2efe7a5bca5953f8f6b3cae0eeb04ca4dacee1bd4e2db2f + md5: 8b09ae86839581147ef2e5c5e229d164 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + constrains: + - expat 2.7.3.* + license: MIT + license_family: MIT + size: 76643 + timestamp: 1763549731408 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libexpat-2.7.4-hecca717_0.conda + sha256: d78f1d3bea8c031d2f032b760f36676d87929b18146351c4464c66b0869df3f5 + md5: e7f7ce06ec24cfcfb9e36d28cf82ba57 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + constrains: + - expat 2.7.4.* + license: MIT + license_family: MIT + size: 76798 + timestamp: 1771259418166 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libexpat-2.7.5-hecca717_0.conda + sha256: e8c2b57f6aacabdf2f1b0924bd4831ce5071ba080baa4a9e8c0d720588b6794c + md5: 49f570f3bc4c874a06ea69b7225753af + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + constrains: + - expat 2.7.5.* + license: MIT + license_family: MIT + purls: [] + size: 76624 + timestamp: 1774719175983 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libexpat-2.7.3-hfae3067_0.conda + sha256: cc2581a78315418cc2e0bb2a273d37363203e79cefe78ba6d282fed546262239 + md5: b414e36fbb7ca122030276c75fa9c34a + depends: + - libgcc >=14 + constrains: + - expat 2.7.3.* + license: MIT + license_family: MIT + size: 76201 + timestamp: 1763549910086 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libexpat-2.7.4-hfae3067_0.conda + sha256: 995ce3ad96d0f4b5ed6296b051a0d7b6377718f325bc0e792fbb96b0e369dad7 + md5: 57f3b3da02a50a1be2a6fe847515417d + depends: + - libgcc >=14 + constrains: + - expat 2.7.4.* + license: MIT + license_family: MIT + size: 76564 + timestamp: 1771259530958 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libexpat-2.7.5-hfae3067_0.conda + sha256: 6d438fc0bfdb263c24654fe49c09b31f06ec78eb709eb386392d2499af105f85 + md5: 05d1e0b30acd816a192c03dc6e164f4d + depends: + - libgcc >=14 + constrains: + - expat 2.7.5.* + license: MIT + license_family: MIT + purls: [] + size: 76523 + timestamp: 1774719129371 +- conda: https://conda.anaconda.org/conda-forge/win-64/libexpat-2.7.3-hac47afa_0.conda + sha256: 844ab708594bdfbd7b35e1a67c379861bcd180d6efe57b654f482ae2f7f5c21e + md5: 8c9e4f1a0e688eef2e95711178061a0f + depends: + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + constrains: + - expat 2.7.3.* + license: MIT + license_family: MIT + size: 70137 + timestamp: 1763550049107 +- conda: https://conda.anaconda.org/conda-forge/win-64/libexpat-2.7.4-hac47afa_0.conda + sha256: b31f6fb629c4e17885aaf2082fb30384156d16b48b264e454de4a06a313b533d + md5: 1c1ced969021592407f16ada4573586d + depends: + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + constrains: + - expat 2.7.4.* + license: MIT + license_family: MIT + size: 70323 + timestamp: 1771259521393 +- conda: https://conda.anaconda.org/conda-forge/win-64/libexpat-2.7.5-hac47afa_0.conda + sha256: 6850c3a4d5dc215b86f58518cfb8752998533d6569b08da8df1da72e7c68e571 + md5: bfb43f52f13b7c56e7677aa7a8efdf0c + depends: + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + constrains: + - expat 2.7.5.* + license: MIT + license_family: MIT + purls: [] + size: 70609 + timestamp: 1774719377850 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libffi-3.5.2-h3435931_0.conda + sha256: 31f19b6a88ce40ebc0d5a992c131f57d919f73c0b92cd1617a5bec83f6e961e6 + md5: a360c33a5abe61c07959e449fa1453eb + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + license: MIT + license_family: MIT + purls: [] + size: 58592 + timestamp: 1769456073053 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libffi-3.5.2-h9ec8514_0.conda + sha256: 25cbdfa65580cfab1b8d15ee90b4c9f1e0d72128f1661449c9a999d341377d54 + md5: 35f29eec58405aaf55e01cb470d8c26a + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + license: MIT + license_family: MIT + size: 57821 + timestamp: 1760295480630 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libffi-3.5.2-h376a255_0.conda + sha256: 3df4c539449aabc3443bbe8c492c01d401eea894603087fca2917aa4e1c2dea9 + md5: 2f364feefb6a7c00423e80dcb12db62a + depends: + - libgcc >=14 + license: MIT + license_family: MIT + purls: [] + size: 55952 + timestamp: 1769456078358 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libffi-3.5.2-hd65408f_0.conda + sha256: 6c3332e78a975e092e54f87771611db81dcb5515a3847a3641021621de76caea + md5: 0c5ad486dcfb188885e3cf8ba209b97b + depends: + - libgcc >=14 + license: MIT + license_family: MIT + size: 55586 + timestamp: 1760295405021 +- conda: https://conda.anaconda.org/conda-forge/win-64/libffi-3.5.2-h3d046cb_0.conda + sha256: 59d01f2dfa8b77491b5888a5ab88ff4e1574c9359f7e229da254cdfe27ddc190 + md5: 720b39f5ec0610457b725eb3f396219a + depends: + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: MIT + license_family: MIT + purls: [] + size: 45831 + timestamp: 1769456418774 +- conda: https://conda.anaconda.org/conda-forge/win-64/libffi-3.5.2-h52bdfb6_0.conda + sha256: ddff25aaa4f0aa535413f5d831b04073789522890a4d8626366e43ecde1534a3 + md5: ba4ad812d2afc22b9a34ce8327a0930f + depends: + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: MIT + license_family: MIT + size: 44866 + timestamp: 1760295760649 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libflac-1.5.0-he200343_1.conda + sha256: e755e234236bdda3d265ae82e5b0581d259a9279e3e5b31d745dc43251ad64fb + md5: 47595b9d53054907a00d95e4d47af1d6 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libiconv >=1.18,<2.0a0 + - libogg >=1.3.5,<1.4.0a0 + - libstdcxx >=14 + license: BSD-3-Clause + license_family: BSD + size: 424563 + timestamp: 1764526740626 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libflac-1.5.0-he9c94f4_1.conda + sha256: 175cdc1865c3d6becc87e96bf44010a8e14f3021600ddad59417ed36e677b1ea + md5: cbe37f1d15f60b5e5272955b55b65325 + depends: + - libgcc >=14 + - libiconv >=1.18,<2.0a0 + - libogg >=1.3.5,<1.4.0a0 + - libstdcxx >=14 + license: BSD-3-Clause + license_family: BSD + size: 397272 + timestamp: 1764526699497 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libfreetype-2.14.1-ha770c72_0.conda + sha256: 4641d37faeb97cf8a121efafd6afd040904d4bca8c46798122f417c31d5dfbec + md5: f4084e4e6577797150f9b04a4560ceb0 + depends: + - libfreetype6 >=2.14.1 + license: GPL-2.0-only OR FTL + size: 7664 + timestamp: 1757945417134 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libfreetype-2.14.2-ha770c72_0.conda + sha256: 2e1bfe1e856eb707d258f669ef6851af583ceaffab5e64821b503b0f7cd09e9e + md5: 26c746d14402a3b6c684d045b23b9437 + depends: + - libfreetype6 >=2.14.2 + license: GPL-2.0-only OR FTL + size: 8035 + timestamp: 1772757210108 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libfreetype-2.14.1-h8af1aa0_0.conda + sha256: 342c07e4be3d09d04b531c889182a11a488e7e9ba4b75f642040e4681c1e9b98 + md5: 1e61fb236ccd3d6ccaf9e91cb2d7e12d + depends: + - libfreetype6 >=2.14.1 + license: GPL-2.0-only OR FTL + size: 7753 + timestamp: 1757945484817 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libfreetype-2.14.2-h8af1aa0_0.conda + sha256: 23cdb94528bb4328b6f7550906dee5080952354445d8bd96241fa7d059c4af95 + md5: 93bce8dee6a0a4906331db294ec250fe + depends: + - libfreetype6 >=2.14.2 + license: GPL-2.0-only OR FTL + size: 8108 + timestamp: 1772756012710 +- conda: https://conda.anaconda.org/conda-forge/win-64/libfreetype-2.14.1-h57928b3_0.conda + sha256: 2029702ec55e968ce18ec38cc8cf29f4c8c4989a0d51797164dab4f794349a64 + md5: 3235024fe48d4087721797ebd6c9d28c + depends: + - libfreetype6 >=2.14.1 + license: GPL-2.0-only OR FTL + size: 8109 + timestamp: 1757946135015 +- conda: https://conda.anaconda.org/conda-forge/win-64/libfreetype-2.14.2-h57928b3_0.conda + sha256: 427c3072b311e65bd3eae3fcb78f6847b15b2dbb173a8546424de56550b2abfb + md5: 153d52fd0e4ba2a5bd5bb4f4afa41417 + depends: + - libfreetype6 >=2.14.2 + license: GPL-2.0-only OR FTL + size: 8404 + timestamp: 1772756167212 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libfreetype6-2.14.1-h73754d4_0.conda + sha256: 4a7af818a3179fafb6c91111752954e29d3a2a950259c14a2fc7ba40a8b03652 + md5: 8e7251989bca326a28f4a5ffbd74557a + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libpng >=1.6.50,<1.7.0a0 + - libzlib >=1.3.1,<2.0a0 + constrains: + - freetype >=2.14.1 + license: GPL-2.0-only OR FTL + size: 386739 + timestamp: 1757945416744 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libfreetype6-2.14.2-h73754d4_0.conda + sha256: aba65b94bdbed52de17ec3d0c6f2ebac2ef77071ad22d6900d1614d0dd702a0c + md5: 8eaba3d1a4d7525c6814e861614457fd + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libpng >=1.6.55,<1.7.0a0 + - libzlib >=1.3.1,<2.0a0 + constrains: + - freetype >=2.14.2 + license: GPL-2.0-only OR FTL + size: 386316 + timestamp: 1772757193822 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libfreetype6-2.14.1-hdae7a39_0.conda + sha256: cedc83d9733363aca353872c3bfed2e188aa7caf57b57842ba0c6d2765652b7c + md5: 9c2f56b6e011c6d8010ff43b796aab2f + depends: + - libgcc >=14 + - libpng >=1.6.50,<1.7.0a0 + - libzlib >=1.3.1,<2.0a0 + constrains: + - freetype >=2.14.1 + license: GPL-2.0-only OR FTL + size: 423210 + timestamp: 1757945484108 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libfreetype6-2.14.2-hdae7a39_0.conda + sha256: a2e9efb033f7519bbc0a54558d7c9bb96252adc22c6e09df2daee7615265fbb1 + md5: 69d1cdfdabb66464cbde17890e8be3b9 + depends: + - libgcc >=14 + - libpng >=1.6.55,<1.7.0a0 + - libzlib >=1.3.1,<2.0a0 + constrains: + - freetype >=2.14.2 + license: GPL-2.0-only OR FTL + size: 423372 + timestamp: 1772756012086 +- conda: https://conda.anaconda.org/conda-forge/win-64/libfreetype6-2.14.1-hdbac1cb_0.conda + sha256: 223710600b1a5567163f7d66545817f2f144e4ef8f84e99e90f6b8a4e19cb7ad + md5: 6e7c5c5ab485057b5d07fd8188ba5c28 + depends: + - libpng >=1.6.50,<1.7.0a0 + - libzlib >=1.3.1,<2.0a0 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + constrains: + - freetype >=2.14.1 + license: GPL-2.0-only OR FTL + size: 340264 + timestamp: 1757946133889 +- conda: https://conda.anaconda.org/conda-forge/win-64/libfreetype6-2.14.2-hdbac1cb_0.conda + sha256: 1e80e01e5662bd3a0c0e094fbeaec449dbb2288949ca55ca80345e7812904e67 + md5: c21a474a38982cdb56b3454cf4f78389 + depends: + - libpng >=1.6.55,<1.7.0a0 + - libzlib >=1.3.1,<2.0a0 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + constrains: + - freetype >=2.14.2 + license: GPL-2.0-only OR FTL + size: 340155 + timestamp: 1772756166648 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libgcc-15.2.0-he0feb66_15.conda + sha256: 37f2edde2f8281672987c63f13c85a57d04d889dc929ce38204426d5eb2059cc + md5: a5d86b0496174a412d531eac03af9174 + depends: + - __glibc >=2.17,<3.0.a0 + - _openmp_mutex >=4.5 + constrains: + - libgomp 15.2.0 he0feb66_15 + - libgcc-ng ==15.2.0=*_15 + license: GPL-3.0-only WITH GCC-exception-3.1 + size: 1041379 + timestamp: 1764836112865 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libgcc-15.2.0-he0feb66_16.conda + sha256: 6eed58051c2e12b804d53ceff5994a350c61baf117ec83f5f10c953a3f311451 + md5: 6d0363467e6ed84f11435eb309f2ff06 + depends: + - __glibc >=2.17,<3.0.a0 + - _openmp_mutex >=4.5 + constrains: + - libgcc-ng ==15.2.0=*_16 + - libgomp 15.2.0 he0feb66_16 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 1042798 + timestamp: 1765256792743 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libgcc-15.2.0-he0feb66_18.conda + sha256: faf7d2017b4d718951e3a59d081eb09759152f93038479b768e3d612688f83f5 + md5: 0aa00f03f9e39fb9876085dee11a85d4 + depends: + - __glibc >=2.17,<3.0.a0 + - _openmp_mutex >=4.5 + constrains: + - libgcc-ng ==15.2.0=*_18 + - libgomp 15.2.0 he0feb66_18 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + purls: [] + size: 1041788 + timestamp: 1771378212382 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libgcc-15.2.0-h8acb6b2_15.conda + sha256: ff184dbe54493b663eab2d62fa0b5a689eb84bec6401fcaeb44265c7f31ae4c6 + md5: cfdf8700e69902a113f2611e3cc09b55 + depends: + - _openmp_mutex >=4.5 + constrains: + - libgcc-ng ==15.2.0=*_15 + - libgomp 15.2.0 h8acb6b2_15 + license: GPL-3.0-only WITH GCC-exception-3.1 + size: 621200 + timestamp: 1764836146613 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libgcc-15.2.0-h8acb6b2_16.conda + sha256: 44bfc6fe16236babb271e0c693fe7fd978f336542e23c9c30e700483796ed30b + md5: cf9cd6739a3b694dcf551d898e112331 + depends: + - _openmp_mutex >=4.5 + constrains: + - libgomp 15.2.0 h8acb6b2_16 + - libgcc-ng ==15.2.0=*_16 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 620637 + timestamp: 1765256938043 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libgcc-15.2.0-h8acb6b2_18.conda + sha256: 43df385bedc1cab11993c4369e1f3b04b4ca5d0ea16cba6a0e7f18dbc129fcc9 + md5: 552567ea2b61e3a3035759b2fdb3f9a6 + depends: + - _openmp_mutex >=4.5 + constrains: + - libgcc-ng ==15.2.0=*_18 + - libgomp 15.2.0 h8acb6b2_18 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + purls: [] + size: 622900 + timestamp: 1771378128706 +- conda: https://conda.anaconda.org/conda-forge/win-64/libgcc-15.2.0-h8ee18e1_16.conda + sha256: 24984e1e768440ba73021f08a1da0c1ec957b30d7071b9a89b877a273d17cae8 + md5: 1edb8bd8e093ebd31558008e9cb23b47 + depends: + - _openmp_mutex >=4.5 + - libwinpthread >=12.0.0.r4.gg4f2fc60ca + constrains: + - libgomp 15.2.0 h8ee18e1_16 + - libgcc-ng ==15.2.0=*_16 + - msys2-conda-epoch <0.0a0 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 819696 + timestamp: 1765260437409 +- conda: https://conda.anaconda.org/conda-forge/win-64/libgcc-15.2.0-h8ee18e1_18.conda + sha256: da2c96563c76b8c601746f03e03ac75d2b4640fa2ee017cb23d6c9fc31f1b2c6 + md5: b085746891cca3bd2704a450a7b4b5ce + depends: + - _openmp_mutex >=4.5 + - libwinpthread >=12.0.0.r4.gg4f2fc60ca + constrains: + - libgcc-ng ==15.2.0=*_18 + - msys2-conda-epoch <0.0a0 + - libgomp 15.2.0 h8ee18e1_18 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + purls: [] + size: 820022 + timestamp: 1771382190160 +- conda: https://conda.anaconda.org/conda-forge/noarch/libgcc-devel_linux-64-15.2.0-hcc6f6b0_116.conda + sha256: 48d7d8dded34100d9065d1c0df86a11ab2cd8ddfd1590512b304527ed25b6d93 + md5: e67832fdbf2382757205bb4b38800643 + depends: + - __unix + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 3094906 + timestamp: 1765256682321 +- conda: https://conda.anaconda.org/conda-forge/noarch/libgcc-devel_linux-64-15.2.0-hcc6f6b0_118.conda + sha256: af69fc5852908d26e5b630b270982ac792506551dd6af1614bf0370dd5ab5746 + md5: 5d3a96d55f1be45fef88ee23155effd9 + depends: + - __unix + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 3085932 + timestamp: 1771378098166 +- conda: https://conda.anaconda.org/conda-forge/noarch/libgcc-devel_linux-aarch64-15.2.0-h55c397f_116.conda + sha256: 594e4f22a4b6aae1bca5e22ea3a075c070642ca4c27c53e0c0973926ca711e09 + md5: 8ba6e9b5866b6a5429ca5d9fa12bc964 + depends: + - __unix + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 2343262 + timestamp: 1765256811670 +- conda: https://conda.anaconda.org/conda-forge/noarch/libgcc-devel_linux-aarch64-15.2.0-h55c397f_118.conda + sha256: 661e29553769ceb5874eb1ed6c00263fcd36fac9f5fe0fee65d5e5cac3187ff3 + md5: 42284981c315916d916fb3156b8d5b9e + depends: + - __unix + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 2364690 + timestamp: 1771378032404 +- conda: https://conda.anaconda.org/conda-forge/noarch/libgcc-devel_win-64-15.2.0-hbb59886_116.conda + sha256: ffffa7c4e12ea0bb70d188eb003809c0579be974c721f0b53345e4e466857fa8 + md5: 83cd21fa27411b91a3ec02ceb9f4d0ca + depends: + - m2-conda-epoch + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 2420086 + timestamp: 1765260357692 +- conda: https://conda.anaconda.org/conda-forge/noarch/libgcc-devel_win-64-15.2.0-hbb59886_118.conda + sha256: e43ffa48a88a7d77a0dc0d3ccfa3acc55702e9d964e8564e86927f5a389a6c51 + md5: 1e020780767f809769807a442f5d6f6a + depends: + - m2-conda-epoch + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 2422242 + timestamp: 1771382108271 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libgcc-ng-15.2.0-h69a702a_15.conda + sha256: 497d8cdba0da8fa154613d1c15f585674cadc194964ed1b4fe7c2809938dc41f + md5: 7b742943660c5173bb6a5c823021c9a0 + depends: + - libgcc 15.2.0 he0feb66_15 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 26834 + timestamp: 1764836127111 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libgcc-ng-15.2.0-h69a702a_16.conda + sha256: 5f07f9317f596a201cc6e095e5fc92621afca64829785e483738d935f8cab361 + md5: 5a68259fac2da8f2ee6f7bfe49c9eb8b + depends: + - libgcc 15.2.0 he0feb66_16 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 27256 + timestamp: 1765256804124 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libgcc-ng-15.2.0-h69a702a_18.conda + sha256: e318a711400f536c81123e753d4c797a821021fb38970cebfb3f454126016893 + md5: d5e96b1ed75ca01906b3d2469b4ce493 + depends: + - libgcc 15.2.0 he0feb66_18 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + purls: [] + size: 27526 + timestamp: 1771378224552 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libgcc-ng-15.2.0-he9431aa_15.conda + sha256: 80e6135b5b0083ad6f0f00b8368d666fb148923fe2d3ab7d8cdca3eaf575eeff + md5: ad92990dc6f608f412a01540a7c9510e + depends: + - libgcc 15.2.0 h8acb6b2_15 + license: GPL-3.0-only WITH GCC-exception-3.1 + size: 26927 + timestamp: 1764836155568 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libgcc-ng-15.2.0-he9431aa_16.conda + sha256: 22d7e63a00c880bd14fbbc514ec6f553b9325d705f08582e9076c7e73c93a2e1 + md5: 3e54a6d0f2ff0172903c0acfda9efc0e + depends: + - libgcc 15.2.0 h8acb6b2_16 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 27356 + timestamp: 1765256948637 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libgcc-ng-15.2.0-he9431aa_18.conda + sha256: 83bb0415f59634dccfa8335d4163d1f6db00a27b36666736f9842b650b92cf2f + md5: 4feebd0fbf61075a1a9c2e9b3936c257 + depends: + - libgcc 15.2.0 h8acb6b2_18 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + purls: [] + size: 27568 + timestamp: 1771378136019 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libgfortran-15.2.0-h69a702a_16.conda + sha256: 8a7b01e1ee1c462ad243524d76099e7174ebdd94ff045fe3e9b1e58db196463b + md5: 40d9b534410403c821ff64f00d0adc22 + depends: + - libgfortran5 15.2.0 h68bc16d_16 + constrains: + - libgfortran-ng ==15.2.0=*_16 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 27215 + timestamp: 1765256845586 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libgfortran-15.2.0-h69a702a_18.conda + sha256: d2c9fad338fd85e4487424865da8e74006ab2e2475bd788f624d7a39b2a72aee + md5: 9063115da5bc35fdc3e1002e69b9ef6e + depends: + - libgfortran5 15.2.0 h68bc16d_18 + constrains: + - libgfortran-ng ==15.2.0=*_18 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + purls: [] + size: 27523 + timestamp: 1771378269450 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libgfortran-15.2.0-he9431aa_16.conda + sha256: 02fa489a333ee4bb5483ae6bf221386b67c25d318f2f856237821a7c9333d5be + md5: 776cca322459d09aad229a49761c0654 + depends: + - libgfortran5 15.2.0 h1b7bec0_16 + constrains: + - libgfortran-ng ==15.2.0=*_16 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 27314 + timestamp: 1765256989755 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libgfortran-15.2.0-he9431aa_18.conda + sha256: 7dcd7dff2505d56fd5272a6e712ec912f50a46bf07dc6873a7e853694304e6e4 + md5: 41f261f5e4e2e8cbd236c2f1f15dae1b + depends: + - libgfortran5 15.2.0 h1b7bec0_18 + constrains: + - libgfortran-ng ==15.2.0=*_18 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + purls: [] + size: 27587 + timestamp: 1771378169244 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libgfortran5-15.2.0-h68bc16d_16.conda + sha256: d0e974ebc937c67ae37f07a28edace978e01dc0f44ee02f29ab8a16004b8148b + md5: 39183d4e0c05609fd65f130633194e37 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=15.2.0 + constrains: + - libgfortran 15.2.0 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 2480559 + timestamp: 1765256819588 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libgfortran5-15.2.0-h68bc16d_18.conda + sha256: 539b57cf50ec85509a94ba9949b7e30717839e4d694bc94f30d41c9d34de2d12 + md5: 646855f357199a12f02a87382d429b75 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=15.2.0 + constrains: + - libgfortran 15.2.0 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + purls: [] + size: 2482475 + timestamp: 1771378241063 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libgfortran5-15.2.0-h1b7bec0_16.conda + sha256: bde541944566254147aab746e66014682e37a259c9a57a0516cf5d05ec343d14 + md5: 87b4ffedaba8b4d675479313af74f612 + depends: + - libgcc >=15.2.0 + constrains: + - libgfortran 15.2.0 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 1485817 + timestamp: 1765256963205 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libgfortran5-15.2.0-h1b7bec0_18.conda + sha256: 85347670dfb4a8d4c13cd7cae54138dcf2b1606b6bede42eef5507bf5f9660c6 + md5: 574d88ce3348331e962cfa5ed451b247 + depends: + - libgcc >=15.2.0 + constrains: + - libgfortran 15.2.0 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + purls: [] + size: 1486341 + timestamp: 1771378148102 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libgl-1.7.0-ha4b6fd6_2.conda + sha256: dc2752241fa3d9e40ce552c1942d0a4b5eeb93740c9723873f6fcf8d39ef8d2d + md5: 928b8be80851f5d8ffb016f9c81dae7a + depends: + - __glibc >=2.17,<3.0.a0 + - libglvnd 1.7.0 ha4b6fd6_2 + - libglx 1.7.0 ha4b6fd6_2 + license: LicenseRef-libglvnd + size: 134712 + timestamp: 1731330998354 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libgl-1.7.0-hd24410f_2.conda + sha256: 3e954380f16255d1c8ae5da3bd3044d3576a0e1ac2e3c3ff2fe8f2f1ad2e467a + md5: 0d00176464ebb25af83d40736a2cd3bb + depends: + - libglvnd 1.7.0 hd24410f_2 + - libglx 1.7.0 hd24410f_2 + license: LicenseRef-libglvnd + size: 145442 + timestamp: 1731331005019 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libglib-2.86.3-h6548e54_0.conda + sha256: 82d6c2ee9f548c84220fb30fb1b231c64a53561d6e485447394f0a0eeeffe0e6 + md5: 034bea55a4feef51c98e8449938e9cee + depends: + - __glibc >=2.17,<3.0.a0 + - libffi >=3.5.2,<3.6.0a0 + - libgcc >=14 + - libiconv >=1.18,<2.0a0 + - libzlib >=1.3.1,<2.0a0 + - pcre2 >=10.47,<10.48.0a0 + constrains: + - glib 2.86.3 *_0 + license: LGPL-2.1-or-later + size: 3946542 + timestamp: 1765221858705 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libglib-2.86.4-h6548e54_1.conda + sha256: a27e44168a1240b15659888ce0d9b938ed4bdb49e9ea68a7c1ff27bcea8b55ce + md5: bb26456332b07f68bf3b7622ed71c0da + depends: + - __glibc >=2.17,<3.0.a0 + - libffi >=3.5.2,<3.6.0a0 + - libgcc >=14 + - libiconv >=1.18,<2.0a0 + - libzlib >=1.3.1,<2.0a0 + - pcre2 >=10.47,<10.48.0a0 + constrains: + - glib 2.86.4 *_1 + license: LGPL-2.1-or-later + size: 4398701 + timestamp: 1771863239578 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libglib-2.86.3-hf53f6bf_0.conda + sha256: 35f4262131e4d42514787fdc3d45c836e060e18fcb2441abd9dd8ecd386214f4 + md5: f226b9798c6c176d2a94eea1350b3b6b + depends: + - libffi >=3.5.2,<3.6.0a0 + - libgcc >=14 + - libiconv >=1.18,<2.0a0 + - libzlib >=1.3.1,<2.0a0 + - pcre2 >=10.47,<10.48.0a0 + constrains: + - glib 2.86.3 *_0 + license: LGPL-2.1-or-later + size: 4041779 + timestamp: 1765221790843 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libglib-2.86.4-hf53f6bf_1.conda + sha256: afc503dbd04a5bf2709aa9d8318a03a8c4edb389f661ff280c3494bfef4341ec + md5: 4ac4372fc4d7f20630a91314cdac8afd + depends: + - libffi >=3.5.2,<3.6.0a0 + - libgcc >=14 + - libiconv >=1.18,<2.0a0 + - libzlib >=1.3.1,<2.0a0 + - pcre2 >=10.47,<10.48.0a0 + constrains: + - glib 2.86.4 *_1 + license: LGPL-2.1-or-later + size: 4512186 + timestamp: 1771863220969 +- conda: https://conda.anaconda.org/conda-forge/win-64/libglib-2.86.3-h0c9aed9_0.conda + sha256: 84b74fc81fff745f3d21a26c317ace44269a563a42ead3500034c27e407e1021 + md5: c2d5b6b790ef21abac0b5331094ccb56 + depends: + - libffi >=3.5.2,<3.6.0a0 + - libiconv >=1.18,<2.0a0 + - libintl >=0.22.5,<1.0a0 + - libzlib >=1.3.1,<2.0a0 + - pcre2 >=10.47,<10.48.0a0 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + constrains: + - glib 2.86.3 *_0 + license: LGPL-2.1-or-later + size: 3818991 + timestamp: 1765222145992 +- conda: https://conda.anaconda.org/conda-forge/win-64/libglib-2.86.4-h0c9aed9_1.conda + sha256: f035fb25f8858f201e0055c719ef91022e9465cd51fe803304b781863286fb10 + md5: 0329a7e92c8c8b61fcaaf7ad44642a96 + depends: + - libffi >=3.5.2,<3.6.0a0 + - libiconv >=1.18,<2.0a0 + - libintl >=0.22.5,<1.0a0 + - libzlib >=1.3.1,<2.0a0 + - pcre2 >=10.47,<10.48.0a0 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + constrains: + - glib 2.86.4 *_1 + license: LGPL-2.1-or-later + size: 4095369 + timestamp: 1771863229701 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libglvnd-1.7.0-ha4b6fd6_2.conda + sha256: 1175f8a7a0c68b7f81962699751bb6574e6f07db4c9f72825f978e3016f46850 + md5: 434ca7e50e40f4918ab701e3facd59a0 + depends: + - __glibc >=2.17,<3.0.a0 + license: LicenseRef-libglvnd + size: 132463 + timestamp: 1731330968309 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libglvnd-1.7.0-hd24410f_2.conda + sha256: 57ec3898a923d4bcc064669e90e8abfc4d1d945a13639470ba5f3748bd3090da + md5: 9e115653741810778c9a915a2f8439e7 + license: LicenseRef-libglvnd + size: 152135 + timestamp: 1731330986070 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libglx-1.7.0-ha4b6fd6_2.conda + sha256: 2d35a679624a93ce5b3e9dd301fff92343db609b79f0363e6d0ceb3a6478bfa7 + md5: c8013e438185f33b13814c5c488acd5c + depends: + - __glibc >=2.17,<3.0.a0 + - libglvnd 1.7.0 ha4b6fd6_2 + - xorg-libx11 >=1.8.10,<2.0a0 + license: LicenseRef-libglvnd + size: 75504 + timestamp: 1731330988898 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libglx-1.7.0-hd24410f_2.conda + sha256: 6591af640cb05a399fab47646025f8b1e1a06a0d4bbb4d2e320d6629b47a1c61 + md5: 1d4269e233636148696a67e2d30dad2a + depends: + - libglvnd 1.7.0 hd24410f_2 + - xorg-libx11 >=1.8.9,<2.0a0 + license: LicenseRef-libglvnd + size: 77736 + timestamp: 1731330998960 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libgomp-15.2.0-he0feb66_15.conda + sha256: b3c4e39be7aba6f5a8695d428362c5c918b96a281ce0a7037f1e889dfc340615 + md5: a90d6983da0757f4c09bb8fcfaf34e71 + depends: + - __glibc >=2.17,<3.0.a0 + license: GPL-3.0-only WITH GCC-exception-3.1 + size: 602978 + timestamp: 1764836011147 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libgomp-15.2.0-he0feb66_16.conda + sha256: 5b3e5e4e9270ecfcd48f47e3a68f037f5ab0f529ccb223e8e5d5ac75a58fc687 + md5: 26c46f90d0e727e95c6c9498a33a09f3 + depends: + - __glibc >=2.17,<3.0.a0 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 603284 + timestamp: 1765256703881 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libgomp-15.2.0-he0feb66_18.conda + sha256: 21337ab58e5e0649d869ab168d4e609b033509de22521de1bfed0c031bfc5110 + md5: 239c5e9546c38a1e884d69effcf4c882 + depends: + - __glibc >=2.17,<3.0.a0 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + purls: [] + size: 603262 + timestamp: 1771378117851 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libgomp-15.2.0-h8acb6b2_15.conda + sha256: d76cbb7e76af310828c74396a78c59a3b305431da25c9337e420bb441d2e8ca0 + md5: 0719da240fd6086c34c4c30080329806 + license: GPL-3.0-only WITH GCC-exception-3.1 + size: 587301 + timestamp: 1764836050907 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libgomp-15.2.0-h8acb6b2_16.conda + sha256: 0a9d77c920db691eb42b78c734d70c5a1d00b3110c0867cfff18e9dd69bc3c29 + md5: 4d2f224e8186e7881d53e3aead912f6c + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 587924 + timestamp: 1765256821307 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libgomp-15.2.0-h8acb6b2_18.conda + sha256: fc716f11a6a8525e27a5d332ef6a689210b0d2a4dd1133edc0f530659aa9faa6 + md5: 4faa39bf919939602e594253bd673958 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + purls: [] + size: 588060 + timestamp: 1771378040807 +- conda: https://conda.anaconda.org/conda-forge/win-64/libgomp-15.2.0-h8ee18e1_16.conda + sha256: 9c86aadc1bd9740f2aca291da8052152c32dd1c617d5d4fd0f334214960649bb + md5: ab8189163748f95d4cb18ea1952943c3 + depends: + - libwinpthread >=12.0.0.r4.gg4f2fc60ca + constrains: + - msys2-conda-epoch <0.0a0 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 663567 + timestamp: 1765260367147 +- conda: https://conda.anaconda.org/conda-forge/win-64/libgomp-15.2.0-h8ee18e1_18.conda + sha256: 94981bc2e42374c737750895c6fdcfc43b7126c4fc788cad0ecc7281745931da + md5: 939fb173e2a4d4e980ef689e99b35223 + depends: + - libwinpthread >=12.0.0.r4.gg4f2fc60ca + constrains: + - msys2-conda-epoch <0.0a0 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + purls: [] + size: 663864 + timestamp: 1771382118742 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libhwloc-2.12.1-default_hafda6a7_1003.conda + sha256: b9e6340da35245d5f3b7b044b4070b4980809d340bddf16c942a97a83f146aa4 + md5: 4fe840c6d6b3719b4231ed89d389bb17 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libstdcxx >=14 + - libxml2 + - libxml2-16 >=2.14.6 + license: BSD-3-Clause + license_family: BSD + size: 2449346 + timestamp: 1765089858592 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libhwloc-2.12.2-default_hafda6a7_1000.conda + sha256: 2cf160794dda62cf93539adf16d26cfd31092829f2a2757dbdd562984c1b110a + md5: 0ed3aa3e3e6bc85050d38881673a692f + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libstdcxx >=14 + - libxml2 + - libxml2-16 >=2.14.6 + license: BSD-3-Clause + license_family: BSD + size: 2449916 + timestamp: 1765103845133 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libhwloc-2.12.1-default_ha470c98_1003.conda + sha256: f0d2fdf4480bac454ac4585fbb8283dde72b8140e6767f9f0009bbf4aedd2db6 + md5: da82e5681665613cd336ee8a7b7b87de + depends: + - libgcc >=14 + - libstdcxx >=14 + - libxml2 + - libxml2-16 >=2.14.6 + license: BSD-3-Clause + license_family: BSD + size: 2465783 + timestamp: 1765090029212 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libhwloc-2.12.2-default_ha470c98_1000.conda + sha256: e87cf64d87c7706403507df7329f5b597c3b487f4c72ef53ef899e38983ea70e + md5: c8b05c85ae962a993d9b7d6c9d10571e + depends: + - libgcc >=14 + - libstdcxx >=14 + - libxml2 + - libxml2-16 >=2.14.6 + license: BSD-3-Clause + license_family: BSD + size: 2467105 + timestamp: 1765103804193 +- conda: https://conda.anaconda.org/conda-forge/win-64/libhwloc-2.12.1-default_h4379cf1_1003.conda + sha256: 2d534c09f92966b885acb3f4a838f7055cea043165a03079a539b06c54e20a49 + md5: d1699ce4fe195a9f61264a1c29b87035 + depends: + - libwinpthread >=12.0.0.r4.gg4f2fc60ca + - libxml2 + - libxml2-16 >=2.14.6 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: BSD-3-Clause + license_family: BSD + size: 2412642 + timestamp: 1765090345611 +- conda: https://conda.anaconda.org/conda-forge/win-64/libhwloc-2.12.2-default_h4379cf1_1000.conda + sha256: 8cdf11333a81085468d9aa536ebb155abd74adc293576f6013fc0c85a7a90da3 + md5: 3b576f6860f838f950c570f4433b086e + depends: + - libwinpthread >=12.0.0.r4.gg4f2fc60ca + - libxml2 + - libxml2-16 >=2.14.6 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: BSD-3-Clause + license_family: BSD + purls: [] + size: 2411241 + timestamp: 1765104337762 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libhwy-1.3.0-h4c17acf_1.conda + sha256: 2bdd1cdd677b119abc5e83069bec2e28fe6bfb21ebaea3cd07acee67f38ea274 + md5: c2a0c1d0120520e979685034e0b79859 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libstdcxx >=14 + license: Apache-2.0 OR BSD-3-Clause + size: 1448617 + timestamp: 1758894401402 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libhwy-1.3.0-h81d0cf9_1.conda + sha256: a6a441692b27606f8ef64ee9e6a0c72c615c2e25b01c282ee080ee8f97861943 + md5: d5b93534e24e7c15792b3f336c52af07 + depends: + - libgcc >=14 + - libstdcxx >=14 + license: Apache-2.0 OR BSD-3-Clause + size: 1180000 + timestamp: 1758894754411 +- conda: https://conda.anaconda.org/conda-forge/win-64/libhwy-1.3.0-ha71e874_1.conda + sha256: c722a04f065656b988a46dee87303ff0bf037179c50e2e76704b693def7f9a96 + md5: f4649d4b6bf40d616eda57d6255d2333 + depends: + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: Apache-2.0 OR BSD-3-Clause + size: 536186 + timestamp: 1758894243956 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libiconv-1.18-h3b78370_2.conda + sha256: c467851a7312765447155e071752d7bf9bf44d610a5687e32706f480aad2833f + md5: 915f5995e94f60e9a4826e0b0920ee88 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + license: LGPL-2.1-only + size: 790176 + timestamp: 1754908768807 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libiconv-1.18-h90929bb_2.conda + sha256: 1473451cd282b48d24515795a595801c9b65b567fe399d7e12d50b2d6cdb04d9 + md5: 5a86bf847b9b926f3a4f203339748d78 + depends: + - libgcc >=14 + license: LGPL-2.1-only + size: 791226 + timestamp: 1754910975665 +- conda: https://conda.anaconda.org/conda-forge/win-64/libiconv-1.18-hc1393d2_2.conda + sha256: 0dcdb1a5f01863ac4e8ba006a8b0dc1a02d2221ec3319b5915a1863254d7efa7 + md5: 64571d1dd6cdcfa25d0664a5950fdaa2 + depends: + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: LGPL-2.1-only + purls: [] + size: 696926 + timestamp: 1754909290005 +- conda: https://conda.anaconda.org/conda-forge/win-64/libintl-0.22.5-h5728263_3.conda + sha256: c7e4600f28bcada8ea81456a6530c2329312519efcf0c886030ada38976b0511 + md5: 2cf0cf76cc15d360dfa2f17fd6cf9772 + depends: + - libiconv >=1.17,<2.0a0 + license: LGPL-2.1-or-later + size: 95568 + timestamp: 1723629479451 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libjpeg-turbo-3.1.2-hb03c661_0.conda + sha256: cc9aba923eea0af8e30e0f94f2ad7156e2984d80d1e8e7fe6be5a1f257f0eb32 + md5: 8397539e3a0bbd1695584fb4f927485a + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + constrains: + - jpeg <0.0.0a + license: IJG AND BSD-3-Clause AND Zlib + size: 633710 + timestamp: 1762094827865 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libjpeg-turbo-3.1.2-he30d5cf_0.conda + sha256: 84064c7c53a64291a585d7215fe95ec42df74203a5bf7615d33d49a3b0f08bb6 + md5: 5109d7f837a3dfdf5c60f60e311b041f + depends: + - libgcc >=14 + constrains: + - jpeg <0.0.0a + license: IJG AND BSD-3-Clause AND Zlib + size: 691818 + timestamp: 1762094728337 +- conda: https://conda.anaconda.org/conda-forge/win-64/libjpeg-turbo-3.1.2-hfd05255_0.conda + sha256: 795e2d4feb2f7fc4a2c6e921871575feb32b8082b5760726791f080d1e2c2597 + md5: 56a686f92ac0273c0f6af58858a3f013 + depends: + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + constrains: + - jpeg <0.0.0a + license: IJG AND BSD-3-Clause AND Zlib + size: 841783 + timestamp: 1762094814336 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libjxl-0.11.2-ha09017c_0.conda + sha256: 0c2399cef02953b719afe6591223fb11d287d5a108ef8bb9a02dd509a0f738d7 + md5: 1df8c1b1d6665642107883685db6cf37 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libstdcxx >=14 + - libhwy >=1.3.0,<1.4.0a0 + - libbrotlienc >=1.2.0,<1.3.0a0 + - libbrotlidec >=1.2.0,<1.3.0a0 + license: BSD-3-Clause + license_family: BSD + size: 1883476 + timestamp: 1770801977654 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libjxl-0.11.2-h71be66a_0.conda + sha256: 880d6a176e0fed5f3a8b1db034f6ee59dab1622d0ab03ea1298ddd9d42f6fa5d + md5: 0f640337bf465aa7b663a6ba399d4fc4 + depends: + - libgcc >=14 + - libstdcxx >=14 + - libbrotlienc >=1.2.0,<1.3.0a0 + - libbrotlidec >=1.2.0,<1.3.0a0 + - libhwy >=1.3.0,<1.4.0a0 + license: BSD-3-Clause + license_family: BSD + size: 1489440 + timestamp: 1770801995062 +- conda: https://conda.anaconda.org/conda-forge/win-64/libjxl-0.11.2-hf3f85d1_0.conda + sha256: 525c5382eb32a43e7baf45b452079bf23daf8f8bf19fee7c8dafa8c731ada8bd + md5: 869e71fcf2135212c51a96f7f7dbd00d + depends: + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + - ucrt >=10.0.20348.0 + - libbrotlienc >=1.2.0,<1.3.0a0 + - libbrotlidec >=1.2.0,<1.3.0a0 + - libhwy >=1.3.0,<1.4.0a0 + license: BSD-3-Clause + license_family: BSD + size: 1317916 + timestamp: 1770801992810 +- conda: https://conda.anaconda.org/conda-forge/linux-64/liblapack-3.11.0-5_h47877c9_openblas.conda + build_number: 5 + sha256: c723b6599fcd4c6c75dee728359ef418307280fa3e2ee376e14e85e5bbdda053 + md5: b38076eb5c8e40d0106beda6f95d7609 + depends: + - libblas 3.11.0 5_h4a7cf45_openblas + constrains: + - blas 2.305 openblas + - liblapacke 3.11.0 5*_openblas + - libcblas 3.11.0 5*_openblas + license: BSD-3-Clause + license_family: BSD + size: 18200 + timestamp: 1765818857876 +- conda: https://conda.anaconda.org/conda-forge/linux-64/liblapack-3.11.0-6_h47877c9_openblas.conda + build_number: 6 + sha256: 371f517eb7010b21c6cc882c7606daccebb943307cb9a3bf2c70456a5c024f7d + md5: 881d801569b201c2e753f03c84b85e15 + depends: + - libblas 3.11.0 6_h4a7cf45_openblas + constrains: + - blas 2.306 openblas + - liblapacke 3.11.0 6*_openblas + - libcblas 3.11.0 6*_openblas + license: BSD-3-Clause + license_family: BSD + purls: [] + size: 18624 + timestamp: 1774503065378 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/liblapack-3.11.0-5_h88aeb00_openblas.conda + build_number: 5 + sha256: 692222d186d3ffbc99eaf04b5b20181fd26aee1edec1106435a0a755c57cce86 + md5: 88d1e4133d1182522b403e9ba7435f04 + depends: + - libblas 3.11.0 5_haddc8a3_openblas + constrains: + - liblapacke 3.11.0 5*_openblas + - blas 2.305 openblas + - libcblas 3.11.0 5*_openblas + license: BSD-3-Clause + license_family: BSD + size: 18392 + timestamp: 1765818627104 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/liblapack-3.11.0-6_h88aeb00_openblas.conda + build_number: 6 + sha256: 67472a3cb761ff95527387ea0367883a22f9fbda1283b9880e5ad644fafd0735 + md5: e23a27b52fb320687239e2c5ae4d7540 + depends: + - libblas 3.11.0 6_haddc8a3_openblas + constrains: + - blas 2.306 openblas + - liblapacke 3.11.0 6*_openblas + - libcblas 3.11.0 6*_openblas + license: BSD-3-Clause + license_family: BSD + purls: [] + size: 18702 + timestamp: 1774503068721 +- conda: https://conda.anaconda.org/conda-forge/win-64/liblapack-3.11.0-5_hf9ab0e9_mkl.conda + build_number: 5 + sha256: a2d33f5cc2b8a9042f2af6981c6733ab1a661463823eaa56595a9c58c0ab77e1 + md5: e62c42a4196dee97d20400612afcb2b1 + depends: + - libblas 3.11.0 5_hf2e6a31_mkl + constrains: + - libcblas 3.11.0 5*_mkl + - blas 2.305 mkl + - liblapacke 3.11.0 5*_mkl + license: BSD-3-Clause + license_family: BSD + size: 80225 + timestamp: 1765819148014 +- conda: https://conda.anaconda.org/conda-forge/win-64/liblapack-3.11.0-6_hf9ab0e9_mkl.conda + build_number: 6 + sha256: 2e6ac39e456ba13ec8f02fc0787b8a22c89780e24bd5556eaf642177463ffb36 + md5: 7e9cdaf6f302142bc363bbab3b5e7074 + depends: + - libblas 3.11.0 6_hf2e6a31_mkl + constrains: + - blas 2.306 mkl + - liblapacke 3.11.0 6*_mkl + - libcblas 3.11.0 6*_mkl + license: BSD-3-Clause + license_family: BSD + purls: [] + size: 80571 + timestamp: 1774503757128 +- conda: https://conda.anaconda.org/conda-forge/linux-64/liblzma-5.8.1-hb9d3cd8_2.conda + sha256: f2591c0069447bbe28d4d696b7fcb0c5bd0b4ac582769b89addbcf26fb3430d8 + md5: 1a580f7796c7bf6393fddb8bbbde58dc + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=13 + constrains: + - xz 5.8.1.* + license: 0BSD + size: 112894 + timestamp: 1749230047870 +- conda: https://conda.anaconda.org/conda-forge/linux-64/liblzma-5.8.2-hb03c661_0.conda + sha256: 755c55ebab181d678c12e49cced893598f2bab22d582fbbf4d8b83c18be207eb + md5: c7c83eecbb72d88b940c249af56c8b17 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + constrains: + - xz 5.8.2.* + license: 0BSD + purls: [] + size: 113207 + timestamp: 1768752626120 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/liblzma-5.8.1-h86ecc28_2.conda + sha256: 498ea4b29155df69d7f20990a7028d75d91dbea24d04b2eb8a3d6ef328806849 + md5: 7d362346a479256857ab338588190da0 + depends: + - libgcc >=13 + constrains: + - xz 5.8.1.* + license: 0BSD + size: 125103 + timestamp: 1749232230009 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/liblzma-5.8.2-he30d5cf_0.conda + sha256: 843c46e20519651a3e357a8928352b16c5b94f4cd3d5481acc48be2e93e8f6a3 + md5: 96944e3c92386a12755b94619bae0b35 + depends: + - libgcc >=14 + constrains: + - xz 5.8.2.* + license: 0BSD + purls: [] + size: 125916 + timestamp: 1768754941722 +- conda: https://conda.anaconda.org/conda-forge/win-64/liblzma-5.8.1-h2466b09_2.conda + sha256: 55764956eb9179b98de7cc0e55696f2eff8f7b83fc3ebff5e696ca358bca28cc + md5: c15148b2e18da456f5108ccb5e411446 + depends: + - ucrt >=10.0.20348.0 + - vc >=14.2,<15 + - vc14_runtime >=14.29.30139 + constrains: + - xz 5.8.1.* + license: 0BSD + size: 104935 + timestamp: 1749230611612 +- conda: https://conda.anaconda.org/conda-forge/win-64/liblzma-5.8.2-hfd05255_0.conda + sha256: f25bf293f550c8ed2e0c7145eb404324611cfccff37660869d97abf526eb957c + md5: ba0bfd4c3cf73f299ffe46ff0eaeb8e3 + depends: + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + constrains: + - xz 5.8.2.* + license: 0BSD + purls: [] + size: 106169 + timestamp: 1768752763559 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libmpdec-4.0.0-hb03c661_1.conda + sha256: fe171ed5cf5959993d43ff72de7596e8ac2853e9021dec0344e583734f1e0843 + md5: 2c21e66f50753a083cbe6b80f38268fa + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + license: BSD-2-Clause + license_family: BSD + size: 92400 + timestamp: 1769482286018 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libmpdec-4.0.0-hb9d3cd8_0.conda + sha256: 3aa92d4074d4063f2a162cd8ecb45dccac93e543e565c01a787e16a43501f7ee + md5: c7e925f37e3b40d893459e625f6a53f1 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=13 + license: BSD-2-Clause + license_family: BSD + size: 91183 + timestamp: 1748393666725 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libmpdec-4.0.0-h86ecc28_0.conda + sha256: ef8697f934c80b347bf9d7ed45650928079e303bad01bd064995b0e3166d6e7a + md5: 78cfed3f76d6f3f279736789d319af76 + depends: + - libgcc >=13 + license: BSD-2-Clause + license_family: BSD + size: 114064 + timestamp: 1748393729243 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libmpdec-4.0.0-he30d5cf_1.conda + sha256: 57c0dd12d506e84541c4e877898bd2a59cca141df493d34036f18b2751e0a453 + md5: 7b9813e885482e3ccb1fa212b86d7fd0 + depends: + - libgcc >=14 + license: BSD-2-Clause + license_family: BSD + size: 114056 + timestamp: 1769482343003 +- conda: https://conda.anaconda.org/conda-forge/win-64/libmpdec-4.0.0-h2466b09_0.conda + sha256: fc529fc82c7caf51202cc5cec5bb1c2e8d90edbac6d0a4602c966366efe3c7bf + md5: 74860100b2029e2523cf480804c76b9b + depends: + - ucrt >=10.0.20348.0 + - vc >=14.2,<15 + - vc14_runtime >=14.29.30139 + license: BSD-2-Clause + license_family: BSD + size: 88657 + timestamp: 1723861474602 +- conda: https://conda.anaconda.org/conda-forge/win-64/libmpdec-4.0.0-hfd05255_1.conda + sha256: 40dcd0b9522a6e0af72a9db0ced619176e7cfdb114855c7a64f278e73f8a7514 + md5: e4a9fc2bba3b022dad998c78856afe47 + depends: + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: BSD-2-Clause + license_family: BSD + size: 89411 + timestamp: 1769482314283 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libnl-3.11.0-hb9d3cd8_0.conda + sha256: ba7c5d294e3d80f08ac5a39564217702d1a752e352e486210faff794ac5001b4 + md5: db63358239cbe1ff86242406d440e44a + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=13 + license: LGPL-2.1-or-later + license_family: LGPL + purls: [] + size: 741323 + timestamp: 1731846827427 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libnl-3.11.0-h86ecc28_0.conda + sha256: 2e603bf640738511faf80de284daa031f0e67de66b77bed7d0da1045ef062abf + md5: bb24d3dd7d028b70f0bb5f6d6e1329c0 + depends: + - libgcc >=13 + license: LGPL-2.1-or-later + license_family: LGPL + purls: [] + size: 768716 + timestamp: 1731846931826 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libnsl-2.0.1-hb9d3cd8_1.conda + sha256: 927fe72b054277cde6cb82597d0fcf6baf127dcbce2e0a9d8925a68f1265eef5 + md5: d864d34357c3b65a4b731f78c0801dc4 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=13 + license: LGPL-2.1-only + license_family: GPL + purls: [] + size: 33731 + timestamp: 1750274110928 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libnsl-2.0.1-h86ecc28_1.conda + sha256: c0dc4d84198e3eef1f37321299e48e2754ca83fd12e6284754e3cb231357c3a5 + md5: d5d58b2dc3e57073fe22303f5fed4db7 + depends: + - libgcc >=13 + license: LGPL-2.1-only + license_family: GPL + purls: [] + size: 34831 + timestamp: 1750274211 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libnvfatbin-12.9.82-hecca717_1.conda + sha256: 4404948624cbddb8dd1bf52d259fe0c1ef24f30e3ff8ce887b002b395796acc7 + md5: 2deb1bea8f1d9cd44d0b29390fd33017 + depends: + - __glibc >=2.17,<3.0.a0 + - cuda-version >=12.9,<12.10.0a0 + - libgcc >=14 + - libstdcxx >=14 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 818615 + timestamp: 1761098926897 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libnvfatbin-13.3.29-hecca717_0.conda + sha256: 3de6aed48ca7a705aa22444b54ad7236f0e1f9dc7f41ec3e2273e6cb991be213 + md5: 1f9be211f7ec5c88b1d2d561aee7884d + depends: + - __glibc >=2.17,<3.0.a0 + - cuda-version >=13.3,<13.4.0a0 + - libgcc >=14 + - libstdcxx >=14 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 472135 + timestamp: 1779897596590 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libnvfatbin-12.9.82-h8f3c8d4_1.conda + sha256: 049ef83fb49c800369a410a9b27287aca2364ebdb6263d553db09f0b45aac3b5 + md5: f7ebe6ae68c9722674d3474110eae245 + depends: + - arm-variant * sbsa + - cuda-version >=12.9,<12.10.0a0 + - libgcc >=14 + - libstdcxx >=14 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 770989 + timestamp: 1761098866337 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libnvfatbin-13.3.29-h8f3c8d4_0.conda + sha256: a811726bc62a3e1952672aa0917166f8123e0ff2c182b9346384f8e962184530 + md5: 3ace0e6476f8c17381dc3b391c3c5049 + depends: + - arm-variant * sbsa + - cuda-version >=13.3,<13.4.0a0 + - libgcc >=14 + - libstdcxx >=14 + constrains: + - arm-variant * sbsa + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 459700 + timestamp: 1779897643320 +- conda: https://conda.anaconda.org/conda-forge/win-64/libnvfatbin-12.9.82-hac47afa_1.conda + sha256: 0020038f897ddc83ed2cf5b128239c073e8db15dc661951bd674c4865f295f1b + md5: cd0c30f6b1f93ea0ebac830fad30c100 + depends: + - cuda-version >=12.9,<12.10.0a0 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 345320 + timestamp: 1761099100395 +- conda: https://conda.anaconda.org/conda-forge/win-64/libnvfatbin-13.3.29-hac47afa_0.conda + sha256: 665c371c11211fb767e9b04e921fd6aed4148072df189039f48d732d28bb9dce + md5: 3391d24d389bc2230da0b534e79c1d69 + depends: + - cuda-version >=13.3,<13.4.0a0 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 361081 + timestamp: 1779897659188 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libnvjitlink-12.9.86-hecca717_2.conda + sha256: 3b1c851f4fc42d347ce1c1606bdd195343a47f121e0fceb7a1f1e5aa1d497da9 + md5: 3461b0f2d5cbb7973d361f9e85241d98 + depends: + - __glibc >=2.17,<3.0.a0 + - cuda-version >=12,<12.10.0a0 + - libgcc >=14 + - libstdcxx >=14 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 30515495 + timestamp: 1760723776293 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libnvjitlink-13.3.33-hecca717_0.conda + sha256: f5d0aed3cfb504239fac6e03e994f36c34725acba5382adc516cbfdd6993a959 + md5: 2795538ca415afd5d35aec7c6cd2e385 + depends: + - __glibc >=2.17,<3.0.a0 + - cuda-version >=13,<13.4.0a0 + - libgcc >=14 + - libstdcxx >=14 + license: LicenseRef-NVIDIA-End-User-License-Agreement + purls: [] + size: 31168008 + timestamp: 1779897778168 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libnvjitlink-12.9.86-h8f3c8d4_2.conda + sha256: d5ff36f46250069a23b18d557052c6656f40a002333885e8c5332071e873b48e + md5: e318a6573fea150226d5f417d1c0807a + depends: + - arm-variant * sbsa + - cuda-version >=12,<12.10.0a0 + - libgcc >=14 + - libstdcxx >=14 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 30323952 + timestamp: 1760723774770 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libnvjitlink-13.3.33-h8f3c8d4_0.conda + sha256: 4b1519898eceba923e11b5ae3588af886ce57a7ba3336ffd900320dfe156e457 + md5: cb19b7f9f8c0b6ee98e8a390b54c5a92 + depends: + - arm-variant * sbsa + - cuda-version >=13,<13.4.0a0 + - libgcc >=14 + - libstdcxx >=14 + constrains: + - arm-variant * sbsa + license: LicenseRef-NVIDIA-End-User-License-Agreement + purls: [] + size: 29975854 + timestamp: 1779897817336 +- conda: https://conda.anaconda.org/conda-forge/win-64/libnvjitlink-12.9.86-hac47afa_2.conda + sha256: adf35938c9ecd77d27c87ef870f7710ee422933ad95d1aac136ff39e7af0551f + md5: feaee6b1ab0e7ed9152dc88e1b0eeddd + depends: + - cuda-version >=12,<12.10.0a0 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: LicenseRef-NVIDIA-End-User-License-Agreement + size: 27343190 + timestamp: 1760724535115 +- conda: https://conda.anaconda.org/conda-forge/win-64/libnvjitlink-13.3.33-hac47afa_0.conda + sha256: 90d9e0eec8aca30a7592d137c68f755bf743e1be43b38657751beadb06b443c2 + md5: a1067e24336c586bf64b47206c5bd8b5 + depends: + - cuda-version >=13,<13.4.0a0 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: LicenseRef-NVIDIA-End-User-License-Agreement + purls: [] + size: 28928043 + timestamp: 1779897886674 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libogg-1.3.5-hd0c01bc_1.conda + sha256: ffb066ddf2e76953f92e06677021c73c85536098f1c21fcd15360dbc859e22e4 + md5: 68e52064ed3897463c0e958ab5c8f91b + depends: + - libgcc >=13 + - __glibc >=2.17,<3.0.a0 + license: BSD-3-Clause + license_family: BSD + size: 218500 + timestamp: 1745825989535 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libogg-1.3.5-h86ecc28_1.conda + sha256: 2c1b7c59badc2fd6c19b6926eabfce906c996068d38c2972bd1cfbe943c07420 + md5: 319df383ae401c40970ee4e9bc836c7a + depends: + - libgcc >=13 + license: BSD-3-Clause + license_family: BSD + size: 220653 + timestamp: 1745826021156 +- conda: https://conda.anaconda.org/conda-forge/win-64/libogg-1.3.5-h2466b09_1.conda + sha256: c63e5fb169dbd192aacdcee6e37235407f106b8ca9c9036942a25e0366cbc73c + md5: b67ed8c9ca072695ff482e50d888a523 + depends: + - vc >=14.2,<15 + - vc14_runtime >=14.29.30139 + - ucrt >=10.0.20348.0 + - vc >=14.2,<15 + - vc14_runtime >=14.29.30139 + - ucrt >=10.0.20348.0 + license: BSD-3-Clause + license_family: BSD + size: 35040 + timestamp: 1745826086628 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libopenblas-0.3.30-pthreads_h94d23a6_4.conda + sha256: 199d79c237afb0d4780ccd2fbf829cea80743df60df4705202558675e07dd2c5 + md5: be43915efc66345cccb3c310b6ed0374 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libgfortran + - libgfortran5 >=14.3.0 + constrains: + - openblas >=0.3.30,<0.3.31.0a0 + license: BSD-3-Clause + license_family: BSD + size: 5927939 + timestamp: 1763114673331 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libopenblas-0.3.32-pthreads_h94d23a6_0.conda + sha256: 6dc30b28f32737a1c52dada10c8f3a41bc9e021854215efca04a7f00487d09d9 + md5: 89d61bc91d3f39fda0ca10fcd3c68594 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libgfortran + - libgfortran5 >=14.3.0 + constrains: + - openblas >=0.3.32,<0.3.33.0a0 + license: BSD-3-Clause + license_family: BSD + purls: [] + size: 5928890 + timestamp: 1774471724897 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenblas-0.3.30-pthreads_h9d3fd7e_4.conda + sha256: 794a7270ea049ec931537874cd8d2de0ef4b3cef71c055cfd8b4be6d2f4228b0 + md5: 11d7d57b7bdd01da745bbf2b67020b2e + depends: + - libgcc >=14 + - libgfortran + - libgfortran5 >=14.3.0 + constrains: + - openblas >=0.3.30,<0.3.31.0a0 + license: BSD-3-Clause + license_family: BSD + size: 4959359 + timestamp: 1763114173544 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenblas-0.3.32-pthreads_h9d3fd7e_0.conda + sha256: 51fcf5eb1fc43bfeca5bf3aa3f51546e92e5a92047ba47146dcea555142e30f8 + md5: 5d2ce5cf40443d055ec6d33840192265 + depends: + - libgcc >=14 + - libgfortran + - libgfortran5 >=14.3.0 + constrains: + - openblas >=0.3.32,<0.3.33.0a0 + license: BSD-3-Clause + license_family: BSD + purls: [] + size: 5122134 + timestamp: 1774471612323 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-2025.2.0-hb617929_1.conda + sha256: 235e7d474c90ad9d8955401b8a91dbe373aa1dc65db3c8232a5e22e4eaf41976 + md5: 1da20cc4ff32dc74424dec68ec087dba + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libstdcxx >=14 + - pugixml >=1.15,<1.16.0a0 + - tbb >=2021.13.0 + size: 6244771 + timestamp: 1753211097492 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-2026.0.0-hb56ce9e_1.conda + sha256: a396a2d1aa267f21c98717ac097138b32e41e4c40ae501729bded3801476eeb5 + md5: 9f0596e995efe372c470ff45c93131cb + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libstdcxx >=14 + - pugixml >=1.15,<1.16.0a0 + - tbb >=2022.3.0 + license: Apache-2.0 + license_family: APACHE + size: 6582302 + timestamp: 1772727204779 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenvino-2025.2.0-hcd21e76_1.conda + sha256: f5c7a24d9918b1f637ca11a7c0b5594e14469ccc5b1f3bafcd248df252d2bdfb + md5: 76baf6bb7a63e310210d91595e245d24 + depends: + - libgcc >=14 + - libstdcxx >=14 + - pugixml >=1.15,<1.16.0a0 + - tbb >=2021.13.0 + size: 5535917 + timestamp: 1753203182299 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenvino-2026.0.0-h1915271_1.conda + sha256: 6f8558cc4ee4d490db88640e71d3f79fa7552701d91c09ad6f1371dadb9bd3f1 + md5: c8ff442d02723939711a726d9ff71eac + depends: + - libgcc >=14 + - libstdcxx >=14 + - pugixml >=1.15,<1.16.0a0 + - tbb >=2022.3.0 + license: Apache-2.0 + license_family: APACHE + size: 5742222 + timestamp: 1772721263739 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenvino-arm-cpu-plugin-2025.2.0-hcd21e76_1.conda + sha256: 018a0ea563bc2e91efee8a07f7b2ff769cd66d03d1c466c8bb7407075023ac85 + md5: 794c3f49774bd710aec2b0602ae38313 + depends: + - libgcc >=14 + - libopenvino 2025.2.0 hcd21e76_1 + - libstdcxx >=14 + - pugixml >=1.15,<1.16.0a0 + - tbb >=2021.13.0 + size: 9257629 + timestamp: 1753203203327 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenvino-arm-cpu-plugin-2026.0.0-h1915271_1.conda + sha256: 8fff4375f324bdf8a3fe20c489710b692340007b7af2da1d14f6832990c24891 + md5: ef26404d824453138bf0a12a8bb033df + depends: + - libgcc >=14 + - libopenvino 2026.0.0 h1915271_1 + - libstdcxx >=14 + - pugixml >=1.15,<1.16.0a0 + - tbb >=2022.3.0 + license: Apache-2.0 + license_family: APACHE + size: 10237615 + timestamp: 1772721303162 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-auto-batch-plugin-2025.2.0-hed573e4_1.conda + sha256: 193f760e828b0dd5168dd1d28580d4bf429c5f14a4eee5e0c02ff4c6d4cf8093 + md5: 94f9d17be1d658213b66b22f63cc6578 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libopenvino 2025.2.0 hb617929_1 + - libstdcxx >=14 + - tbb >=2021.13.0 + size: 114760 + timestamp: 1753211116381 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-auto-batch-plugin-2026.0.0-hd85de46_1.conda + sha256: 286de85805dc69ce0bd25367ae2a20c8096ddef35eb2483474eb246dacd5387e + md5: ee41df976413676f794af2785b291b0c + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libopenvino 2026.0.0 hb56ce9e_1 + - libstdcxx >=14 + - tbb >=2022.3.0 + license: Apache-2.0 + license_family: APACHE + size: 114431 + timestamp: 1772727230331 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenvino-auto-batch-plugin-2025.2.0-h3890994_1.conda + sha256: 59a159c547fca34e8a0c600fcca428793da2ad4ecef0f47b58f1ea16d756c521 + md5: ad9768777a654205fa46aed8a829bd7e + depends: + - libgcc >=14 + - libopenvino 2025.2.0 hcd21e76_1 + - libstdcxx >=14 + - tbb >=2021.13.0 + size: 111599 + timestamp: 1753203233477 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenvino-auto-batch-plugin-2026.0.0-h3d5001d_1.conda + sha256: da7926f66318e539c9f20c2f5f3719a5ba663c6b9d5471e5223d290450219748 + md5: 5e984d6405a8f8529d7429f28a7f285e + depends: + - libgcc >=14 + - libopenvino 2026.0.0 h1915271_1 + - libstdcxx >=14 + - tbb >=2022.3.0 + license: Apache-2.0 + license_family: APACHE + size: 111064 + timestamp: 1772721336786 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-auto-plugin-2025.2.0-hed573e4_1.conda + sha256: a6f9f996e64e6d2f295f017a833eda7018ff58b6894503272d72f0002dfd6f33 + md5: 071b3a82342715a411f216d379ab6205 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libopenvino 2025.2.0 hb617929_1 + - libstdcxx >=14 + - tbb >=2021.13.0 + size: 250500 + timestamp: 1753211127339 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-auto-plugin-2026.0.0-hd85de46_1.conda + sha256: 9988ed6339a5eb044ae8d079e2b22f5a310c41e49a0cf716057f30b21ef9cec2 + md5: ca025fa5c42ba94453636a2ae333de6b + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libopenvino 2026.0.0 hb56ce9e_1 + - libstdcxx >=14 + - tbb >=2022.3.0 + license: Apache-2.0 + license_family: APACHE + size: 249056 + timestamp: 1772727247597 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenvino-auto-plugin-2025.2.0-h3890994_1.conda + sha256: 3353f616cf72dad02d974698a74fa89eb5ff1beeaa64cebcdd1f87c52d2a0516 + md5: 4cec7bb2362ece08d0d1799f1ed4fbe7 + depends: + - libgcc >=14 + - libopenvino 2025.2.0 hcd21e76_1 + - libstdcxx >=14 + - tbb >=2021.13.0 + size: 235379 + timestamp: 1753203244808 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenvino-auto-plugin-2026.0.0-h3d5001d_1.conda + sha256: 20f1958e160c64f3d207f1dbdb6960cc5642070a472bebffc0d587b2f6429033 + md5: 573b3f5ec3963e0153501a2676660ee4 + depends: + - libgcc >=14 + - libopenvino 2026.0.0 h1915271_1 + - libstdcxx >=14 + - tbb >=2022.3.0 + license: Apache-2.0 + license_family: APACHE + size: 236010 + timestamp: 1772721351244 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-hetero-plugin-2025.2.0-hd41364c_1.conda + sha256: f43f9049338ef9735b6815bac3f483d1e3adddecbfdeb13be365bc3f601fe156 + md5: 77c0c7028a8110076d40314dc7b1fa98 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libopenvino 2025.2.0 hb617929_1 + - libstdcxx >=14 + - pugixml >=1.15,<1.16.0a0 + size: 194815 + timestamp: 1753211138624 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-hetero-plugin-2026.0.0-hd41364c_1.conda + sha256: c7db498aeda5b0f36b347f4211b93b66ba108faaf54157a08bae8fa3c3af5f81 + md5: 07a23e96db38f63d9763f666b2db66aa + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libopenvino 2026.0.0 hb56ce9e_1 + - libstdcxx >=14 + - pugixml >=1.15,<1.16.0a0 + license: Apache-2.0 + license_family: APACHE + size: 211582 + timestamp: 1772727264950 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenvino-hetero-plugin-2025.2.0-he07c6df_1.conda + sha256: 97f6a555d73d96efe26521527ce4e4c6ea49e46d5e5fd07a5e535e7de34bb6b5 + md5: 00d0206cb4358182c856700e1c1dae8b + depends: + - libgcc >=14 + - libopenvino 2025.2.0 hcd21e76_1 + - libstdcxx >=14 + - pugixml >=1.15,<1.16.0a0 + size: 187747 + timestamp: 1753203256494 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenvino-hetero-plugin-2026.0.0-he07c6df_1.conda + sha256: 3778ea3887c9a9300761e3f39ce86976746a35aa1392a4b76e4e4d3ce9e095b4 + md5: 74bd299545a1fe23439bf6e071ed9710 + depends: + - libgcc >=14 + - libopenvino 2026.0.0 h1915271_1 + - libstdcxx >=14 + - pugixml >=1.15,<1.16.0a0 + license: Apache-2.0 + license_family: APACHE + size: 202574 + timestamp: 1772721365749 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-intel-cpu-plugin-2025.2.0-hb617929_1.conda + sha256: a4a1cd320fa010a45d01f438dc3431b7a60271ee19188a901f884399fe744268 + md5: e4cc6db5bdc8b554c06bf569de57f85f + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libopenvino 2025.2.0 hb617929_1 + - libstdcxx >=14 + - pugixml >=1.15,<1.16.0a0 + - tbb >=2021.13.0 + size: 12377488 + timestamp: 1753211149903 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-intel-cpu-plugin-2026.0.0-hb56ce9e_1.conda + sha256: 01a28c0bd1f205b3800e7759e30bc8e8a75836e0d5a73a745b4da42837bbb174 + md5: b43b96578573ddbcc8d084ae6e44c964 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libopenvino 2026.0.0 hb56ce9e_1 + - libstdcxx >=14 + - pugixml >=1.15,<1.16.0a0 + - tbb >=2022.3.0 + license: Apache-2.0 + license_family: APACHE + size: 13173323 + timestamp: 1772727282718 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-intel-gpu-plugin-2025.2.0-hb617929_1.conda + sha256: 03ebf700586775144ca5913f401393a386b9a1d7a7cfcba4494830063ca5eb92 + md5: b846fe6c158ca417e246122172d68d3a + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libopenvino 2025.2.0 hb617929_1 + - libstdcxx >=14 + - ocl-icd >=2.3.3,<3.0a0 + - pugixml >=1.15,<1.16.0a0 + - tbb >=2021.13.0 + size: 10815480 + timestamp: 1753211182626 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-intel-gpu-plugin-2026.0.0-hb56ce9e_1.conda + sha256: 720b87e1d5f1a10c577e040d4bf425072a978e925c6dfab8b1551bc848007c94 + md5: 26e8e92c90d1a22af6eac8e9507d9b8f + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libopenvino 2026.0.0 hb56ce9e_1 + - libstdcxx >=14 + - ocl-icd >=2.3.3,<3.0a0 + - pugixml >=1.15,<1.16.0a0 + - tbb >=2022.3.0 + license: Apache-2.0 + license_family: APACHE + size: 11402462 + timestamp: 1772727323957 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-intel-npu-plugin-2025.2.0-hb617929_1.conda + sha256: b6dbc342293d6ce0c7b37c9f29f734b3e1856cff9405a02fb33cedd1b36528e6 + md5: 86fd4c25f6accaf646c86adf0f1382d3 + depends: + - __glibc >=2.17,<3.0.a0 + - level-zero >=1.23.1,<2.0a0 + - libgcc >=14 + - libopenvino 2025.2.0 hb617929_1 + - libstdcxx >=14 + - pugixml >=1.15,<1.16.0a0 + - tbb >=2021.13.0 + size: 1261488 + timestamp: 1753211212823 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-intel-npu-plugin-2026.0.0-hb56ce9e_1.conda + sha256: df7eb2b23a1af38f2cd2281353309f2e2a04da1374ecedc7c6745c2a67ba617c + md5: 01ba8b179ac45b2b37fe2d4225dddcc7 + depends: + - __glibc >=2.17,<3.0.a0 + - level-zero >=1.28.2,<2.0a0 + - libgcc >=14 + - libopenvino 2026.0.0 hb56ce9e_1 + - libstdcxx >=14 + - pugixml >=1.15,<1.16.0a0 + - tbb >=2022.3.0 + license: Apache-2.0 + license_family: APACHE + size: 1994640 + timestamp: 1772727360780 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-ir-frontend-2025.2.0-hd41364c_1.conda + sha256: 334733396d4c9a9b2b2d7d7d850e8ee8deca1f9becd0368d106010076ceb20ca + md5: 75e595d9f2019a60f6dcb500266da615 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libopenvino 2025.2.0 hb617929_1 + - libstdcxx >=14 + - pugixml >=1.15,<1.16.0a0 + size: 204890 + timestamp: 1753211224567 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-ir-frontend-2026.0.0-hd41364c_1.conda + sha256: 8e7356b0b80b3f180615e264694d6811d388b210155d419553ff64e42f78ffa0 + md5: aa002c4d343b01cdcc458c95cd071d1b + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libopenvino 2026.0.0 hb56ce9e_1 + - libstdcxx >=14 + - pugixml >=1.15,<1.16.0a0 + license: Apache-2.0 + license_family: APACHE + size: 192778 + timestamp: 1772727380069 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenvino-ir-frontend-2025.2.0-he07c6df_1.conda + sha256: 935341a98e129d3fd792609de5e85b959c3b31661d1a95c2a655771611383a05 + md5: f86c16f077043c9b1e87dbc07bf5ec42 + depends: + - libgcc >=14 + - libopenvino 2025.2.0 hcd21e76_1 + - libstdcxx >=14 + - pugixml >=1.15,<1.16.0a0 + size: 195451 + timestamp: 1753203267888 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenvino-ir-frontend-2026.0.0-he07c6df_1.conda + sha256: 5d191b9d29fb2bbaca95bcd7325fbc3329c1049eccda4b84cfd79c64d4b6dc83 + md5: 0946447f9717222c95c24f958d73dba9 + depends: + - libgcc >=14 + - libopenvino 2026.0.0 h1915271_1 + - libstdcxx >=14 + - pugixml >=1.15,<1.16.0a0 + license: Apache-2.0 + license_family: APACHE + size: 185648 + timestamp: 1772721380070 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-onnx-frontend-2025.2.0-h1862bb8_1.conda + sha256: 3937b028e7192ed3805581ac0ea171725843056c8544537754fad45a1791e864 + md5: 68f5ad9d8e3979362bb9dfc9388980aa + depends: + - __glibc >=2.17,<3.0.a0 + - libabseil * cxx17* + - libabseil >=20250512.1,<20250513.0a0 + - libgcc >=14 + - libopenvino 2025.2.0 hb617929_1 + - libprotobuf >=6.31.1,<6.31.2.0a0 + - libstdcxx >=14 + size: 1724503 + timestamp: 1753211235981 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-onnx-frontend-2026.0.0-h7a07914_1.conda + sha256: 35a68214201e807bd9a31f94e618cb6a5385198e89eef46dde6c122cff77da58 + md5: 218084544c2e7e78e4b8877ec37b8cdb + depends: + - __glibc >=2.17,<3.0.a0 + - libabseil * cxx17* + - libabseil >=20260107.1,<20260108.0a0 + - libgcc >=14 + - libopenvino 2026.0.0 hb56ce9e_1 + - libprotobuf >=6.33.5,<6.33.6.0a0 + - libstdcxx >=14 + license: Apache-2.0 + license_family: APACHE + size: 1860687 + timestamp: 1772727397981 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenvino-onnx-frontend-2025.2.0-h07d5dce_1.conda + sha256: 576c1ba122fb58d1c0ea6540d5480809196a884d3e56c05ab49b97ccc99e2c90 + md5: f8d90a982f95366614c568eac3157a90 + depends: + - libabseil * cxx17* + - libabseil >=20250512.1,<20250513.0a0 + - libgcc >=14 + - libopenvino 2025.2.0 hcd21e76_1 + - libprotobuf >=6.31.1,<6.31.2.0a0 + - libstdcxx >=14 + size: 1530030 + timestamp: 1753203281815 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenvino-onnx-frontend-2026.0.0-h558496d_1.conda + sha256: 9496ef9b24c3dcf3dda58a11360095fdd427d828d33705a1d9b90a4f1a5783c3 + md5: 55e11d3e2f930299df66be96928e432d + depends: + - libabseil * cxx17* + - libabseil >=20260107.1,<20260108.0a0 + - libgcc >=14 + - libopenvino 2026.0.0 h1915271_1 + - libprotobuf >=6.33.5,<6.33.6.0a0 + - libstdcxx >=14 + license: Apache-2.0 + license_family: APACHE + size: 1665115 + timestamp: 1772721394860 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-paddle-frontend-2025.2.0-h1862bb8_1.conda + sha256: c7ac3d4187323ab37ef62ec0896a41c8ca7da426c7f587494c72fe74852269e5 + md5: a032d03468dee9fb5b8eaf635b4571c2 + depends: + - __glibc >=2.17,<3.0.a0 + - libabseil * cxx17* + - libabseil >=20250512.1,<20250513.0a0 + - libgcc >=14 + - libopenvino 2025.2.0 hb617929_1 + - libprotobuf >=6.31.1,<6.31.2.0a0 + - libstdcxx >=14 + size: 744746 + timestamp: 1753211248776 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-paddle-frontend-2026.0.0-h7a07914_1.conda + sha256: cb37b717480207a66443a93d4342cf88210a74c0820fc0edd70e4fc791a64779 + md5: 74915e5e271ef76a89f711eff5959a75 + depends: + - __glibc >=2.17,<3.0.a0 + - libabseil * cxx17* + - libabseil >=20260107.1,<20260108.0a0 + - libgcc >=14 + - libopenvino 2026.0.0 hb56ce9e_1 + - libprotobuf >=6.33.5,<6.33.6.0a0 + - libstdcxx >=14 + license: Apache-2.0 + license_family: APACHE + size: 684224 + timestamp: 1772727417276 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenvino-paddle-frontend-2025.2.0-h07d5dce_1.conda + sha256: b080ca352d8d4526b73815bdbdb12ba5caf5de4621c10e9ad41eac73a7a6a713 + md5: 098597aa6f19b2851f295f47c7105658 + depends: + - libabseil * cxx17* + - libabseil >=20250512.1,<20250513.0a0 + - libgcc >=14 + - libopenvino 2025.2.0 hcd21e76_1 + - libprotobuf >=6.31.1,<6.31.2.0a0 + - libstdcxx >=14 + size: 674194 + timestamp: 1753203295461 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenvino-paddle-frontend-2026.0.0-h558496d_1.conda + sha256: 9e04b6c6b370e46bee7306afc9bc76e725042e981102f4c7b6b697b061c7324a + md5: d26f5d445e0545ce674b11f496dba1a0 + depends: + - libabseil * cxx17* + - libabseil >=20260107.1,<20260108.0a0 + - libgcc >=14 + - libopenvino 2026.0.0 h1915271_1 + - libprotobuf >=6.33.5,<6.33.6.0a0 + - libstdcxx >=14 + license: Apache-2.0 + license_family: APACHE + size: 631754 + timestamp: 1772721411589 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-pytorch-frontend-2025.2.0-hecca717_1.conda + sha256: 2d4a680a16509b8dd06ccd7a236655e46cc7c242bb5b6e88b83a834b891658db + md5: cd40cf2d10a3279654c9769f3bc8caf5 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libopenvino 2025.2.0 hb617929_1 + - libstdcxx >=14 + size: 1243134 + timestamp: 1753211260154 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-pytorch-frontend-2026.0.0-hecca717_1.conda + sha256: 086469e5cd8bfde48975fe8641a7d6924e3da00d75dd06c99e03a78df03a0568 + md5: 559ef86008749861a53025f669004f18 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libopenvino 2026.0.0 hb56ce9e_1 + - libstdcxx >=14 + license: Apache-2.0 + license_family: APACHE + size: 1185558 + timestamp: 1772727435039 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenvino-pytorch-frontend-2025.2.0-hfae3067_1.conda + sha256: 0dddd3e274c156a2b8ced3009444d99c04d75ab50a748968b94d3890b6dfab65 + md5: d00d92fbb31f8f9dc2cfb78f44286925 + depends: + - libgcc >=14 + - libopenvino 2025.2.0 hcd21e76_1 + - libstdcxx >=14 + size: 1123835 + timestamp: 1753203307507 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenvino-pytorch-frontend-2026.0.0-hfae3067_1.conda + sha256: e62d016274d9aeae8033a37cd742162637ca37cd10a5d436934c2709c58240f2 + md5: 0fd361e9e722e741146d818284feca74 + depends: + - libgcc >=14 + - libopenvino 2026.0.0 h1915271_1 + - libstdcxx >=14 + license: Apache-2.0 + license_family: APACHE + size: 1091266 + timestamp: 1772721428223 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-tensorflow-frontend-2025.2.0-h0767aad_1.conda + sha256: 311ec1118448a28e76f0359c4393c7f7f5e64761c48ac7b169bf928a391eae77 + md5: f71c6b4e342b560cc40687063ef62c50 + depends: + - __glibc >=2.17,<3.0.a0 + - libabseil * cxx17* + - libabseil >=20250512.1,<20250513.0a0 + - libgcc >=14 + - libopenvino 2025.2.0 hb617929_1 + - libprotobuf >=6.31.1,<6.31.2.0a0 + - libstdcxx >=14 + - snappy >=1.2.2,<1.3.0a0 + size: 1325059 + timestamp: 1753211272484 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-tensorflow-frontend-2026.0.0-h78e8023_1.conda + sha256: 3a9a404bc9fd39e7395d49f4bd8facb58a01a31aeceabe8723a9d4f8eb5cc381 + md5: fb20f4234bc0e29af1baa13d35e36785 + depends: + - __glibc >=2.17,<3.0.a0 + - libabseil * cxx17* + - libabseil >=20260107.1,<20260108.0a0 + - libgcc >=14 + - libopenvino 2026.0.0 hb56ce9e_1 + - libprotobuf >=6.33.5,<6.33.6.0a0 + - libstdcxx >=14 + - snappy >=1.2.2,<1.3.0a0 + license: Apache-2.0 + license_family: APACHE + size: 1257870 + timestamp: 1772727453738 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenvino-tensorflow-frontend-2025.2.0-h38473e3_1.conda + sha256: fcdb5623415c9f5d8c8635f579e5706647e2c97b543ebba621b5b31df096de3d + md5: b42a48c1052c5b576170212c2a834614 + depends: + - libabseil * cxx17* + - libabseil >=20250512.1,<20250513.0a0 + - libgcc >=14 + - libopenvino 2025.2.0 hcd21e76_1 + - libprotobuf >=6.31.1,<6.31.2.0a0 + - libstdcxx >=14 + - snappy >=1.2.2,<1.3.0a0 + size: 1224816 + timestamp: 1753203320621 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenvino-tensorflow-frontend-2026.0.0-h2cb6e3c_1.conda + sha256: f4ecfddd9583fa475e2e637ac9226b6ae20482abda53bf4339a29407e6c05cb3 + md5: f2c28f19267bfcdf9ec9ed4406a89d0b + depends: + - libabseil * cxx17* + - libabseil >=20260107.1,<20260108.0a0 + - libgcc >=14 + - libopenvino 2026.0.0 h1915271_1 + - libprotobuf >=6.33.5,<6.33.6.0a0 + - libstdcxx >=14 + - snappy >=1.2.2,<1.3.0a0 + license: Apache-2.0 + license_family: APACHE + size: 1184078 + timestamp: 1772721443833 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-tensorflow-lite-frontend-2025.2.0-hecca717_1.conda + sha256: 581f4951e645e820c4a6ffe40fb0174b56d6e31fb1fefd2d64913fea01f8f69e + md5: fd9dacd7101f80ff1110ea6b76adb95d + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libopenvino 2025.2.0 hb617929_1 + - libstdcxx >=14 + size: 497047 + timestamp: 1753211285617 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libopenvino-tensorflow-lite-frontend-2026.0.0-hecca717_1.conda + sha256: e7cee37c92ed0b62c0458c13937b6ad66319f1879f236a31c3a67391a999f429 + md5: 0f0281435478b981f672a44d0029018c + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libopenvino 2026.0.0 hb56ce9e_1 + - libstdcxx >=14 + license: Apache-2.0 + license_family: APACHE + size: 456585 + timestamp: 1772727473378 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenvino-tensorflow-lite-frontend-2025.2.0-hfae3067_1.conda + sha256: cd4651c37e45fe6779a32ebfb3000fb3e9742409cd9bd0ac141c130b2f8f8d56 + md5: 274b11e7ed763c4964a6b6d2130ec1cb + depends: + - libgcc >=14 + - libopenvino 2025.2.0 hcd21e76_1 + - libstdcxx >=14 + size: 456714 + timestamp: 1753203333676 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopenvino-tensorflow-lite-frontend-2026.0.0-hfae3067_1.conda + sha256: b0f32488fd11cd8ed563ad01934360df383f720a2adecf6d36aa3ea2565baab7 + md5: 0a160f00a4050e3bf4749129750d0303 + depends: + - libgcc >=14 + - libopenvino 2026.0.0 h1915271_1 + - libstdcxx >=14 + license: Apache-2.0 + license_family: APACHE + size: 428895 + timestamp: 1772721459028 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libopus-1.5.2-hd0c01bc_0.conda + sha256: 786d43678d6d1dc5f88a6bad2d02830cfd5a0184e84a8caa45694049f0e3ea5f + md5: b64523fb87ac6f87f0790f324ad43046 + depends: + - libgcc >=13 + - __glibc >=2.17,<3.0.a0 + license: BSD-3-Clause + license_family: BSD + size: 312472 + timestamp: 1744330953241 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libopus-1.6.1-h280c20c_0.conda + sha256: f1061a26213b9653bbb8372bfa3f291787ca091a9a3060a10df4d5297aad74fd + md5: 2446ac1fe030c2aa6141386c1f5a6aed + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + license: BSD-3-Clause + license_family: BSD + size: 324993 + timestamp: 1768497114401 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopus-1.5.2-h86ecc28_0.conda + sha256: c887543068308fb0fd50175183a3513f60cd8eb1defc23adc3c89769fde80d48 + md5: 44b2cfec6e1b94723a960f8a5e6206ae + depends: + - libgcc >=13 + license: BSD-3-Clause + license_family: BSD + size: 357115 + timestamp: 1744331282621 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libopus-1.6.1-h80f16a2_0.conda + sha256: 059214f037fa5e51080f5aced39466993b2311a01d871086bd6d2a59bfbf59b5 + md5: c781f98ca7b987f968369bc768b2cd55 + depends: + - libgcc >=14 + license: BSD-3-Clause + license_family: BSD + size: 383586 + timestamp: 1768497303687 +- conda: https://conda.anaconda.org/conda-forge/win-64/libopus-1.6-h6a83c73_0.conda + sha256: 53ead19c11a1182f05d30a15352a05cc1fdf8cbd03e8f57b75ae34b570953d4a + md5: 1ff86b588aaa12462f320cc27e77bc6d + depends: + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + - ucrt >=10.0.20348.0 + license: BSD-3-Clause + license_family: BSD + size: 307249 + timestamp: 1765847775174 +- conda: https://conda.anaconda.org/conda-forge/win-64/libopus-1.6.1-h6a83c73_0.conda + sha256: c3678f111866235b44fa65265966abae7d90b6387178f1459afaedcee8b4a997 + md5: 0ed21da5b6e3a0393e05762b3cce2878 + depends: + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + - ucrt >=10.0.20348.0 + license: BSD-3-Clause + license_family: BSD + size: 307373 + timestamp: 1768497136248 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libpciaccess-0.18-hb9d3cd8_0.conda + sha256: 0bd91de9b447a2991e666f284ae8c722ffb1d84acb594dbd0c031bd656fa32b2 + md5: 70e3400cbbfa03e96dcde7fc13e38c7b + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=13 + license: MIT + license_family: MIT + size: 28424 + timestamp: 1749901812541 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libpciaccess-0.18-h86ecc28_0.conda + sha256: 7641dfdfe9bda7069ae94379e9924892f0b6604c1a016a3f76b230433bb280f2 + md5: 5044e160c5306968d956c2a0a2a440d6 + depends: + - libgcc >=13 + license: MIT + license_family: MIT + size: 29512 + timestamp: 1749901899881 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libpng-1.6.53-h421ea60_0.conda + sha256: 8acdeb9a7e3d2630176ba8e947caf6bf4985a5148dec69b801e5eb797856688b + md5: 00d4e66b1f746cb14944cad23fffb405 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libzlib >=1.3.1,<2.0a0 + license: zlib-acknowledgement + size: 317748 + timestamp: 1764981060755 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libpng-1.6.55-h421ea60_0.conda + sha256: 36ade759122cdf0f16e2a2562a19746d96cf9c863ffaa812f2f5071ebbe9c03c + md5: 5f13ffc7d30ffec87864e678df9957b4 + depends: + - libgcc >=14 + - __glibc >=2.17,<3.0.a0 + - libzlib >=1.3.1,<2.0a0 + license: zlib-acknowledgement + size: 317669 + timestamp: 1770691470744 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libpng-1.6.53-h1abf092_0.conda + sha256: 31c2b22aa4cb2b8d1456ad5aa92d1b95a8db234572cd29772c58e0b0c5be8823 + md5: 7591d867dbcba9eb7fb5e88a5f756591 + depends: + - libgcc >=14 + - libzlib >=1.3.1,<2.0a0 + license: zlib-acknowledgement + size: 340043 + timestamp: 1764981067899 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libpng-1.6.55-h1abf092_0.conda + sha256: c7378c6b79de4d571d00ad1caf0a4c19d43c9c94077a761abb6ead44d891f907 + md5: be4088903b94ea297975689b3c3aeb27 + depends: + - libgcc >=14 + - libzlib >=1.3.1,<2.0a0 + license: zlib-acknowledgement + size: 340156 + timestamp: 1770691477245 +- conda: https://conda.anaconda.org/conda-forge/win-64/libpng-1.6.53-h7351971_0.conda + sha256: e5d061e7bdb2b97227b6955d1aa700a58a5703b5150ab0467cc37de609f277b6 + md5: fb6f43f6f08ca100cb24cff125ab0d9e + depends: + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + - ucrt >=10.0.20348.0 + - libzlib >=1.3.1,<2.0a0 + license: zlib-acknowledgement + size: 383702 + timestamp: 1764981078732 +- conda: https://conda.anaconda.org/conda-forge/win-64/libpng-1.6.55-h7351971_0.conda + sha256: db23f281fa80597a0dc0445b18318346862602d7081ed76244df8cc4418d6d68 + md5: 43f47a9151b9b8fc100aeefcf350d1a0 + depends: + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + - ucrt >=10.0.20348.0 + - libzlib >=1.3.1,<2.0a0 + license: zlib-acknowledgement + size: 383155 + timestamp: 1770691504832 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libprotobuf-6.31.1-h49aed37_2.conda + sha256: 1679f16c593d769f3dab219adb1117cbaaddb019080c5a59f79393dc9f45b84f + md5: 94cb88daa0892171457d9fdc69f43eca + depends: + - __glibc >=2.17,<3.0.a0 + - libabseil * cxx17* + - libabseil >=20250512.1,<20250513.0a0 + - libgcc >=14 + - libstdcxx >=14 + - libzlib >=1.3.1,<2.0a0 + license: BSD-3-Clause + license_family: BSD + size: 4645876 + timestamp: 1760550892361 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libprotobuf-6.31.1-h49aed37_4.conda + sha256: 0ef142ac31e6fd59b4af89ac800acb6deb3fbd9cc4ccf070c03cc2c784dc7296 + md5: 07479fc04ba3ddd5d9f760ef1635cfa7 + depends: + - __glibc >=2.17,<3.0.a0 + - libabseil * cxx17* + - libabseil >=20250512.1,<20250513.0a0 + - libgcc >=14 + - libstdcxx >=14 + - libzlib >=1.3.1,<2.0a0 + license: BSD-3-Clause + license_family: BSD + size: 4372578 + timestamp: 1766316228461 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libprotobuf-6.33.5-h2b00c02_0.conda + sha256: afbf195443269ae10a940372c1d37cda749355d2bd96ef9587a962abd87f2429 + md5: 11ac478fa72cf12c214199b8a96523f4 + depends: + - __glibc >=2.17,<3.0.a0 + - libabseil * cxx17* + - libabseil >=20260107.0,<20260108.0a0 + - libgcc >=14 + - libstdcxx >=14 + - libzlib >=1.3.1,<2.0a0 + license: BSD-3-Clause + license_family: BSD + size: 3638698 + timestamp: 1769749419271 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libprotobuf-6.31.1-h2cf3c76_2.conda + sha256: e1bfa4ee03ddfa3a5e347d6796757a373878b2f277ed48dbc32412b05e16e776 + md5: 8eb7b485dcbb81166e340a07ccb40e67 + depends: + - libabseil * cxx17* + - libabseil >=20250512.1,<20250513.0a0 + - libgcc >=14 + - libstdcxx >=14 + - libzlib >=1.3.1,<2.0a0 + license: BSD-3-Clause + license_family: BSD + size: 4465754 + timestamp: 1760550264433 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libprotobuf-6.31.1-h2cf3c76_4.conda + sha256: 27c496b35b0a40fba1cc0cf836f313e4a302975cce81d7997f76f66894f276d9 + md5: d6e6b7bbbe4f3b5348322afc928ffbeb + depends: + - libabseil * cxx17* + - libabseil >=20250512.1,<20250513.0a0 + - libgcc >=14 + - libstdcxx >=14 + - libzlib >=1.3.1,<2.0a0 + license: BSD-3-Clause + license_family: BSD + size: 4218080 + timestamp: 1766315327959 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libprotobuf-6.33.5-h1f88751_0.conda + sha256: f68780642c215b93f4991c43d88ab0af8a08e66826e68affc65b8905cc21d86b + md5: 7f4a589ae616399b7e375053e82a3b12 + depends: + - libabseil * cxx17* + - libabseil >=20260107.0,<20260108.0a0 + - libgcc >=14 + - libstdcxx >=14 + - libzlib >=1.3.1,<2.0a0 + license: BSD-3-Clause + license_family: BSD + size: 3465308 + timestamp: 1769748410724 +- conda: https://conda.anaconda.org/conda-forge/linux-64/librsvg-2.60.0-h61e6d4b_0.conda + sha256: 960b137673b2b8293e2a12d194add72967b3bf12fcdf691e7ad8bd5c8318cec3 + md5: 91e6d4d684e237fba31b9815c4b40edf + depends: + - __glibc >=2.17,<3.0.a0 + - cairo >=1.18.4,<2.0a0 + - gdk-pixbuf >=2.44.3,<3.0a0 + - libgcc >=14 + - libglib >=2.86.0,<3.0a0 + - libxml2-16 >=2.14.6 + - pango >=1.56.4,<2.0a0 + constrains: + - __glibc >=2.17 + license: LGPL-2.1-or-later + size: 3421977 + timestamp: 1759327942156 +- conda: https://conda.anaconda.org/conda-forge/linux-64/librsvg-2.60.2-h61e6d4b_0.conda + sha256: 38b3189cf246f7265e06917f32d046ac375117c88834d045efe73ec48ceacc59 + md5: d62da3d560992bfa2feb611d7be813b8 + depends: + - __glibc >=2.17,<3.0.a0 + - cairo >=1.18.4,<2.0a0 + - gdk-pixbuf >=2.44.5,<3.0a0 + - libgcc >=14 + - libglib >=2.86.4,<3.0a0 + - libxml2-16 >=2.14.6 + - pango >=1.56.4,<2.0a0 + constrains: + - __glibc >=2.17 + license: LGPL-2.1-or-later + size: 4011590 + timestamp: 1771399906142 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/librsvg-2.60.0-h8171147_0.conda + sha256: b6cb38e95a447a04e624b6070981899e18c03f71915476fe024dadf384f48f15 + md5: 7e4a8318e73ba685615f90bff926bfe4 + depends: + - cairo >=1.18.4,<2.0a0 + - gdk-pixbuf >=2.44.3,<3.0a0 + - libgcc >=14 + - libglib >=2.86.0,<3.0a0 + - libxml2-16 >=2.14.6 + - pango >=1.56.4,<2.0a0 + constrains: + - __glibc >=2.17 + license: LGPL-2.1-or-later + size: 2995492 + timestamp: 1759335330016 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/librsvg-2.60.2-h8171147_0.conda + sha256: d02d3b23aa58d7767b820289b5b50653e73d70ae32f6ee5b88f63c5c5d96c2de + md5: 1d6f1aff501c8104f7292ab787d65f15 + depends: + - cairo >=1.18.4,<2.0a0 + - gdk-pixbuf >=2.44.5,<3.0a0 + - libgcc >=14 + - libglib >=2.86.4,<3.0a0 + - libxml2-16 >=2.14.6 + - pango >=1.56.4,<2.0a0 + constrains: + - __glibc >=2.17 + license: LGPL-2.1-or-later + size: 4016799 + timestamp: 1771406266442 +- conda: https://conda.anaconda.org/conda-forge/win-64/librsvg-2.60.0-hd5e4115_0.conda + sha256: a0e8d89c36e555149f3ba2d58bb96f1b77e8ed7924db8a242ee0b0fb613c588d + md5: 5b38f886aa0548d6f6f5d1a30b3ae0ca + depends: + - cairo >=1.18.4,<2.0a0 + - gdk-pixbuf >=2.44.3,<3.0a0 + - libglib >=2.86.0,<3.0a0 + - libxml2-16 >=2.14.6 + - pango >=1.56.4,<2.0a0 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: LGPL-2.1-or-later + size: 3336793 + timestamp: 1759328441569 +- conda: https://conda.anaconda.org/conda-forge/win-64/librsvg-2.60.0-hd5e4115_1.conda + sha256: 3d06becb70212a7ed609eea07728b6545ddcff4889844290fed14a5d2fc18cd9 + md5: a105938a4fae24539c89de6e7671d279 + depends: + - cairo >=1.18.4,<2.0a0 + - gdk-pixbuf >=2.44.5,<3.0a0 + - libglib >=2.86.4,<3.0a0 + - libxml2-16 >=2.14.6 + - pango >=1.56.4,<2.0a0 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: LGPL-2.1-or-later + size: 2877820 + timestamp: 1771301866036 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libsanitizer-15.2.0-h90f66d4_16.conda + sha256: 50d8082749e760454fb1489c2a47c6fa80cbf3893ec1c1a085747d46484ffd7f + md5: 0841a98bda756af037eb07d36cacada5 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=15.2.0 + - libstdcxx >=15.2.0 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 7660762 + timestamp: 1765256861607 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libsanitizer-15.2.0-h90f66d4_18.conda + sha256: 0329e23d54a567c259adc962a62172eaa55e6ca33c105ef67b4f3cdb4ef70eaa + md5: ff754fbe790d4e70cf38aea3668c3cb3 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=15.2.0 + - libstdcxx >=15.2.0 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 8095113 + timestamp: 1771378289674 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libsanitizer-15.2.0-he19c465_16.conda + sha256: 71be6819f928574caf929aa4764a69e3df0429d686a4c5d6a8985b4c2c14b965 + md5: 4e30740acf8527cc06ca6a8d81432536 + depends: + - libgcc >=15.2.0 + - libstdcxx >=15.2.0 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 7460968 + timestamp: 1765257008136 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libsanitizer-15.2.0-he19c465_18.conda + sha256: 10c42c4e12972088cf0d5f57393f83e6727ad31bdb38ae46935641861f394698 + md5: 589c6fc3e744df871bbbf703f1e6ce98 + depends: + - libgcc >=15.2.0 + - libstdcxx >=15.2.0 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 7164557 + timestamp: 1771378185265 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libsndfile-1.2.2-hc7d488a_2.conda + sha256: 57cb5f92110324c04498b96563211a1bca6a74b2918b1e8df578bfed03cc32e4 + md5: 067590f061c9f6ea7e61e3b2112ed6b3 + depends: + - __glibc >=2.17,<3.0.a0 + - lame >=3.100,<3.101.0a0 + - libflac >=1.5.0,<1.6.0a0 + - libgcc >=14 + - libogg >=1.3.5,<1.4.0a0 + - libopus >=1.5.2,<2.0a0 + - libstdcxx >=14 + - libvorbis >=1.3.7,<1.4.0a0 + - mpg123 >=1.32.9,<1.33.0a0 + license: LGPL-2.1-or-later + license_family: LGPL + size: 355619 + timestamp: 1765181778282 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libsndfile-1.2.2-h30591a0_2.conda + sha256: f0b6844c09cdec608ca504bd97c5d64a5596a25f66ad806381f9d63dfc89e432 + md5: 362bc94148039b77c6a42b1f7e7ef537 + depends: + - lame >=3.100,<3.101.0a0 + - libflac >=1.5.0,<1.6.0a0 + - libgcc >=14 + - libogg >=1.3.5,<1.4.0a0 + - libopus >=1.5.2,<2.0a0 + - libstdcxx >=14 + - libvorbis >=1.3.7,<1.4.0a0 + - mpg123 >=1.32.9,<1.33.0a0 + license: LGPL-2.1-or-later + license_family: LGPL + size: 406978 + timestamp: 1765181892661 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libsodium-1.0.21-h280c20c_3.conda + sha256: 64e5c80cbce4680a2d25179949739a6def695d72c40ca28f010711764e372d97 + md5: 7af961ef4aa2c1136e11dd43ded245ab + depends: + - libgcc >=14 + - __glibc >=2.17,<3.0.a0 + license: ISC + purls: [] + size: 277661 + timestamp: 1772479381288 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libsodium-1.0.21-h80f16a2_3.conda + sha256: d6112f3a7e7ffcd726ce653724f979b528cb8a19675fc06016a5d360ef94e9a4 + md5: 9e1fe4202543fa5b6ab58dbf12d34ced + depends: + - libgcc >=14 + license: ISC + purls: [] + size: 272649 + timestamp: 1772479384085 +- conda: https://conda.anaconda.org/conda-forge/win-64/libsodium-1.0.21-h6a83c73_3.conda + sha256: d915f4fa8ebbf237c7a6e511ed458f2cfdc7c76843a924740318a15d0dd33d6d + md5: da2aa614d16a795b3007b6f4a1318a81 + depends: + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + - ucrt >=10.0.20348.0 + license: ISC + purls: [] + size: 276860 + timestamp: 1772479407566 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libsqlite-3.51.1-h0c1763c_0.conda + sha256: 6f0e8a812e8e33a4d8b7a0e595efe28373080d27b78ee4828aa4f6649a088454 + md5: 2e1b84d273b01835256e53fd938de355 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libzlib >=1.3.1,<2.0a0 + license: blessing + size: 938979 + timestamp: 1764359444435 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libsqlite-3.51.1-hf4e2dac_1.conda + sha256: d614540c55f22ad555633f75e174089018ddfc65c49f447f7bbdbc3c3013bec1 + md5: b1f35e70f047918b49fb4b181e40300e + depends: + - __glibc >=2.17,<3.0.a0 + - icu >=78.1,<79.0a0 + - libgcc >=14 + - libzlib >=1.3.1,<2.0a0 + license: blessing + size: 943451 + timestamp: 1766319676469 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libsqlite-3.52.0-hf4e2dac_0.conda + sha256: d716847b7deca293d2e49ed1c8ab9e4b9e04b9d780aea49a97c26925b28a7993 + md5: fd893f6a3002a635b5e50ceb9dd2c0f4 + depends: + - __glibc >=2.17,<3.0.a0 + - icu >=78.2,<79.0a0 + - libgcc >=14 + - libzlib >=1.3.1,<2.0a0 + license: blessing + purls: [] + size: 951405 + timestamp: 1772818874251 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libsqlite-3.51.1-h022381a_0.conda + sha256: e394dd772b71dbcd653d078f3aacf6e26e3478bd6736a687ab86e463a2f153a8 + md5: 233efdd411317d2dc5fde72464b3df7a + depends: + - libgcc >=14 + - libzlib >=1.3.1,<2.0a0 + license: blessing + size: 939207 + timestamp: 1764359457549 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libsqlite-3.51.1-h10b116e_1.conda + sha256: f80893874d5ba5ac754b2d65ec392c46841bfe57bd89499aa0e1965c720babbd + md5: 9fd37e702b4e7c85462fe79baf13974d + depends: + - icu >=78.1,<79.0a0 + - libgcc >=14 + - libzlib >=1.3.1,<2.0a0 + license: blessing + size: 943924 + timestamp: 1766319577347 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libsqlite-3.52.0-h10b116e_0.conda + sha256: 1ddaf91b44fae83856276f4cb7ce544ffe41d4b55c1e346b504c6b45f19098d6 + md5: 77891484f18eca74b8ad83694da9815e + depends: + - icu >=78.2,<79.0a0 + - libgcc >=14 + - libzlib >=1.3.1,<2.0a0 + license: blessing + purls: [] + size: 952296 + timestamp: 1772818881550 +- conda: https://conda.anaconda.org/conda-forge/win-64/libsqlite-3.51.1-hf5d6505_0.conda + sha256: a976c8b455d9023b83878609bd68c3b035b9839d592bd6c7be7552c523773b62 + md5: f92bef2f8e523bb0eabe60099683617a + depends: + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: blessing + size: 1291059 + timestamp: 1764359545703 +- conda: https://conda.anaconda.org/conda-forge/win-64/libsqlite-3.51.1-hf5d6505_1.conda + sha256: d6d86715a1afe11f626b7509935e9d2e14a4946632c0ac474526e20fc6c55f99 + md5: be65be5f758709fc01b01626152e96b0 + depends: + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: blessing + size: 1292859 + timestamp: 1766319616777 +- conda: https://conda.anaconda.org/conda-forge/win-64/libsqlite-3.52.0-hf5d6505_0.conda + sha256: 5fccf1e4e4062f8b9a554abf4f9735a98e70f82e2865d0bfdb47b9de94887583 + md5: 8830689d537fda55f990620680934bb1 + depends: + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: blessing + purls: [] + size: 1297302 + timestamp: 1772818899033 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libstdcxx-15.2.0-h934c35e_15.conda + sha256: 2648485aa2dcd5ca385423841a728f262458aec5d814a79da5ab75098e223e3f + md5: fccfb26375ec5e4a2192dee6604b6d02 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc 15.2.0 he0feb66_15 + constrains: + - libstdcxx-ng ==15.2.0=*_15 + license: GPL-3.0-only WITH GCC-exception-3.1 + size: 5856371 + timestamp: 1764836166363 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libstdcxx-15.2.0-h934c35e_16.conda + sha256: 813427918316a00c904723f1dfc3da1bbc1974c5cfe1ed1e704c6f4e0798cbc6 + md5: 68f68355000ec3f1d6f26ea13e8f525f + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc 15.2.0 he0feb66_16 + constrains: + - libstdcxx-ng ==15.2.0=*_16 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 5856456 + timestamp: 1765256838573 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libstdcxx-15.2.0-h934c35e_18.conda + sha256: 78668020064fdaa27e9ab65cd2997e2c837b564ab26ce3bf0e58a2ce1a525c6e + md5: 1b08cd684f34175e4514474793d44bcb + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc 15.2.0 he0feb66_18 + constrains: + - libstdcxx-ng ==15.2.0=*_18 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + purls: [] + size: 5852330 + timestamp: 1771378262446 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libstdcxx-15.2.0-hef695bb_15.conda + sha256: f6347ce1d1a8a9ecfa16fc118594b0a5cab9194a8dcc7e79cd02a7497822d1d2 + md5: 2873f805cdabcf33b880b19077cf6180 + depends: + - libgcc 15.2.0 h8acb6b2_15 + constrains: + - libstdcxx-ng ==15.2.0=*_15 + license: GPL-3.0-only WITH GCC-exception-3.1 + size: 5540090 + timestamp: 1764836183565 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libstdcxx-15.2.0-hef695bb_16.conda + sha256: 4db11a903707068ae37aa6909511c68e9af6a2e97890d1b73b0a8d87cb74aba9 + md5: 52d9df8055af3f1665ba471cce77da48 + depends: + - libgcc 15.2.0 h8acb6b2_16 + constrains: + - libstdcxx-ng ==15.2.0=*_16 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 5541149 + timestamp: 1765256980783 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libstdcxx-15.2.0-hef695bb_18.conda + sha256: 31fdb9ffafad106a213192d8319b9f810e05abca9c5436b60e507afb35a6bc40 + md5: f56573d05e3b735cb03efeb64a15f388 + depends: + - libgcc 15.2.0 h8acb6b2_18 + constrains: + - libstdcxx-ng ==15.2.0=*_18 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + purls: [] + size: 5541411 + timestamp: 1771378162499 +- conda: https://conda.anaconda.org/conda-forge/win-64/libstdcxx-15.2.0-hae5796f_16.conda + sha256: 6d4b74aa2b668ea3927615055ff7557c50628f073a00a504d3fbedbb6eccca43 + md5: 7ca89b8b412282e8b8b644f55056279e + depends: + - libgcc 15.2.0 h8ee18e1_16 + - libwinpthread >=12.0.0.r4.gg4f2fc60ca + constrains: + - libstdcxx-ng ==15.2.0=*_16 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 6461950 + timestamp: 1765260469617 +- conda: https://conda.anaconda.org/conda-forge/win-64/libstdcxx-15.2.0-hae5796f_18.conda + sha256: 7134b90a850f0e14f15bd0f0218fd728f19cd5c58420a90c2f561f58272b8519 + md5: 7c09facd8f5aced6b4c146e1c4053e50 + depends: + - libgcc 15.2.0 h8ee18e1_18 + - libwinpthread >=12.0.0.r4.gg4f2fc60ca + constrains: + - libstdcxx-ng ==15.2.0=*_18 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 6462596 + timestamp: 1771382223989 +- conda: https://conda.anaconda.org/conda-forge/noarch/libstdcxx-devel_linux-64-15.2.0-hd446a21_116.conda + sha256: cb331c51739cc68257c7d7eef0e29c355b46b2d72f630854506dbc99240057c1 + md5: 2730e07e576ffbd7bf13f8de34835d41 + depends: + - __unix + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 20763949 + timestamp: 1765256724565 +- conda: https://conda.anaconda.org/conda-forge/noarch/libstdcxx-devel_linux-64-15.2.0-hd446a21_118.conda + sha256: 138ee40ba770abf4556ee9981879da9e33299f406a450831b48c1c397d7d0833 + md5: a50630d1810916fc252b2152f1dc9d6d + depends: + - __unix + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 20669511 + timestamp: 1771378139786 +- conda: https://conda.anaconda.org/conda-forge/noarch/libstdcxx-devel_linux-aarch64-15.2.0-ha7b1723_116.conda + sha256: 06be0d20cb3784e1d625f316f26962085dd14f74e166bd668ee9c089b5fa3efa + md5: 48cfd02ec4f1308109e5daaccb99aa30 + depends: + - __unix + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 17639950 + timestamp: 1765256847600 +- conda: https://conda.anaconda.org/conda-forge/noarch/libstdcxx-devel_linux-aarch64-15.2.0-ha7b1723_118.conda + sha256: 52afca5e24e0bbc840cf9c28b440dea2cebc4500e97084a38cdd27fdc8a3e57c + md5: 99ea26f70c5e380294e760e8bdbaddff + depends: + - __unix + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 17628403 + timestamp: 1771378058765 +- conda: https://conda.anaconda.org/conda-forge/noarch/libstdcxx-devel_win-64-15.2.0-h0a72980_116.conda + sha256: 40fce07ecab2b8d4777021e22fbae2f8ab39b5d1713ae3999efae225cd19c5ba + md5: 53a797061ae48ff2bd1956c7abc20776 + depends: + - m2-conda-epoch + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 12310259 + timestamp: 1765260383723 +- conda: https://conda.anaconda.org/conda-forge/noarch/libstdcxx-devel_win-64-15.2.0-h0a72980_118.conda + sha256: 0b27331f127c6c10017442cc98c483aa868298102e98aae70ad86b9a5ae0029e + md5: b7a331c07d140e476fee0c70c9696e87 + depends: + - m2-conda-epoch + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 11729036 + timestamp: 1771382135681 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libstdcxx-ng-15.2.0-hdf11a46_15.conda + sha256: 2ffaec42c561f53dcc025277043aa02e2557dc0db62bc009be4c7559a7f19f09 + md5: 20a8584ff8677ac9d724345b9d4eb757 + depends: + - libstdcxx 15.2.0 h934c35e_15 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 26905 + timestamp: 1764836222826 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libstdcxx-ng-15.2.0-hdf11a46_16.conda + sha256: 81f2f246c7533b41c5e0c274172d607829019621c4a0823b5c0b4a8c7028ee84 + md5: 1b3152694d236cf233b76b8c56bf0eae + depends: + - libstdcxx 15.2.0 h934c35e_16 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 27300 + timestamp: 1765256885128 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libstdcxx-ng-15.2.0-hdf11a46_18.conda + sha256: 3c902ffd673cb3c6ddde624cdb80f870b6c835f8bf28384b0016e7d444dd0145 + md5: 6235adb93d064ecdf3d44faee6f468de + depends: + - libstdcxx 15.2.0 h934c35e_18 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 27575 + timestamp: 1771378314494 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libstdcxx-ng-15.2.0-hdbbeba8_15.conda + sha256: 73d026540bd2ec75186bc82c164fbfa51cbe44c4c27ed64b57bf52b10f6f3d63 + md5: 7a99de7c14096347968d1fd574b46bb2 + depends: + - libstdcxx 15.2.0 hef695bb_15 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 26977 + timestamp: 1764836231696 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libstdcxx-ng-15.2.0-hdbbeba8_16.conda + sha256: dd5c813ae5a4dac6fa946352674e0c21b1847994a717ef67bd6cc77bc15920be + md5: 20b7f96f58ccbe8931c3a20778fb3b32 + depends: + - libstdcxx 15.2.0 hef695bb_16 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 27376 + timestamp: 1765257033344 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libstdcxx-ng-15.2.0-hdbbeba8_18.conda + sha256: 035a31cde134e706e30029a837a31f729ad32b7c5bca023271dfe91a8ba6c896 + md5: 699d294376fe18d80b7ce7876c3a875d + depends: + - libstdcxx 15.2.0 hef695bb_18 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 27645 + timestamp: 1771378204663 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libsystemd0-257.10-hd0affe5_2.conda + sha256: b30c06f60f03c2cf101afeb3452f48f12a2553b4cb631c9460c8a8ccf0813ae5 + md5: b04e0a2163a72588a40cde1afd6f2d18 + depends: + - __glibc >=2.17,<3.0.a0 + - libcap >=2.77,<2.78.0a0 + - libgcc >=14 + license: LGPL-2.1-or-later + size: 491211 + timestamp: 1763011323224 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libsystemd0-257.10-hd0affe5_3.conda + sha256: b3a7f89462dc95c1bba9f663210d20ff3ac5f7db458684e0f3a7ae5784f8c132 + md5: 70d1de6301b58ed99fea01490a9802a3 + depends: + - __glibc >=2.17,<3.0.a0 + - libcap >=2.77,<2.78.0a0 + - libgcc >=14 + license: LGPL-2.1-or-later + size: 491268 + timestamp: 1765552759709 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libsystemd0-257.10-hd0affe5_4.conda + sha256: f0356bb344a684e7616fc84675cfca6401140320594e8686be30e8ac7547aed2 + md5: 1d4c18d75c51ed9d00092a891a547a7d + depends: + - __glibc >=2.17,<3.0.a0 + - libcap >=2.77,<2.78.0a0 + - libgcc >=14 + license: LGPL-2.1-or-later + size: 491953 + timestamp: 1770738638119 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libsystemd0-257.13-hd0affe5_0.conda + sha256: c5008b602cb5c819f7b52d418b3ed17e1818cbbf6705b189e7ab36bb70cce3d8 + md5: 8ee3cb7f64be0e8c4787f3a4dbe024e6 + depends: + - __glibc >=2.17,<3.0.a0 + - libcap >=2.77,<2.78.0a0 + - libgcc >=14 + license: LGPL-2.1-or-later + purls: [] + size: 492799 + timestamp: 1773797095649 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libsystemd0-257.10-hf9559e3_2.conda + sha256: 22e5bc2b72eb4a104927d34d06954573dbbdef1981fd7f73520f2ca82f0b7101 + md5: e7a86e3cdea9c37bf12005778d490148 + depends: + - libcap >=2.77,<2.78.0a0 + - libgcc >=14 + license: LGPL-2.1-or-later + size: 517490 + timestamp: 1763011526609 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libsystemd0-257.10-hf9559e3_3.conda + sha256: 57fe7a9f0c289e4f2fdf5200271848adc9f102921056d5904173942628b472cd + md5: 254474a19793a5f06de7cf3e3e2359fb + depends: + - libcap >=2.77,<2.78.0a0 + - libgcc >=14 + license: LGPL-2.1-or-later + size: 517687 + timestamp: 1765552618501 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libsystemd0-257.10-hf9559e3_4.conda + sha256: 95bb4c430e8ca666a4c67b7951f03fbee5a5258b1d29c2a26bf56c86fe32c010 + md5: 96e731e9cf876fb2d8882093c0f24630 + depends: + - libcap >=2.77,<2.78.0a0 + - libgcc >=14 + license: LGPL-2.1-or-later + size: 517911 + timestamp: 1770738680829 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libsystemd0-257.13-hf9559e3_0.conda + sha256: b38e9777b3231dfda62f2d127aac8091d990b5c45814a2b9d2e382f42f73a895 + md5: ffd5411606e65767354fe153371cc63a + depends: + - libcap >=2.77,<2.78.0a0 + - libgcc >=14 + license: LGPL-2.1-or-later + purls: [] + size: 516600 + timestamp: 1773797150163 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libtiff-4.7.1-h9d88235_1.conda + sha256: e5f8c38625aa6d567809733ae04bb71c161a42e44a9fa8227abe61fa5c60ebe0 + md5: cd5a90476766d53e901500df9215e927 + depends: + - __glibc >=2.17,<3.0.a0 + - lerc >=4.0.0,<5.0a0 + - libdeflate >=1.25,<1.26.0a0 + - libgcc >=14 + - libjpeg-turbo >=3.1.0,<4.0a0 + - liblzma >=5.8.1,<6.0a0 + - libstdcxx >=14 + - libwebp-base >=1.6.0,<2.0a0 + - libzlib >=1.3.1,<2.0a0 + - zstd >=1.5.7,<1.6.0a0 + license: HPND + size: 435273 + timestamp: 1762022005702 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libtiff-4.7.1-hdb009f0_1.conda + sha256: 7ff79470db39e803e21b8185bc8f19c460666d5557b1378d1b1e857d929c6b39 + md5: 8c6fd84f9c87ac00636007c6131e457d + depends: + - lerc >=4.0.0,<5.0a0 + - libdeflate >=1.25,<1.26.0a0 + - libgcc >=14 + - libjpeg-turbo >=3.1.0,<4.0a0 + - liblzma >=5.8.1,<6.0a0 + - libstdcxx >=14 + - libwebp-base >=1.6.0,<2.0a0 + - libzlib >=1.3.1,<2.0a0 + - zstd >=1.5.7,<1.6.0a0 + license: HPND + size: 488407 + timestamp: 1762022048105 +- conda: https://conda.anaconda.org/conda-forge/win-64/libtiff-4.7.1-h8f73337_1.conda + sha256: f1b8cccaaeea38a28b9cd496694b2e3d372bb5be0e9377c9e3d14b330d1cba8a + md5: 549845d5133100142452812feb9ba2e8 + depends: + - lerc >=4.0.0,<5.0a0 + - libdeflate >=1.25,<1.26.0a0 + - libjpeg-turbo >=3.1.0,<4.0a0 + - liblzma >=5.8.1,<6.0a0 + - libzlib >=1.3.1,<2.0a0 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + - zstd >=1.5.7,<1.6.0a0 + license: HPND + size: 993166 + timestamp: 1762022118895 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libudev1-257.10-hd0affe5_2.conda + sha256: 751cf346f0f56cc9bfa43f7b5c9c30df2fcec8d84d164ac0cd74a27a3af79f30 + md5: 2f6b30acaa0d6e231d01166549108e2c + depends: + - __glibc >=2.17,<3.0.a0 + - libcap >=2.77,<2.78.0a0 + - libgcc >=14 + license: LGPL-2.1-or-later + size: 144395 + timestamp: 1763011330153 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libudev1-257.10-hd0affe5_3.conda + sha256: 977e7e4955ea1581e441e429c2c1b498bc915767f1cac77a97b283c469d5298c + md5: 3934f4cf65a06100d526b33395fb9cd2 + depends: + - __glibc >=2.17,<3.0.a0 + - libcap >=2.77,<2.78.0a0 + - libgcc >=14 + license: LGPL-2.1-or-later + size: 145023 + timestamp: 1765552781358 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libudev1-257.10-hd0affe5_4.conda + sha256: ed4d2c01fbeb1330f112f7e399408634db277d3dfb2dec1d0395f56feaa24351 + md5: 6c74fba677b61a0842cbf0f63eee683b + depends: + - __glibc >=2.17,<3.0.a0 + - libcap >=2.77,<2.78.0a0 + - libgcc >=14 + license: LGPL-2.1-or-later + size: 144654 + timestamp: 1770738650966 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libudev1-257.13-hd0affe5_0.conda + sha256: 1a1e367c04d66030aa93b4d33905f7f6fbb59cfc292e816fe3e9c1e8b3f4d1e2 + md5: 2c2270f93d6f9073cbf72d821dfc7d72 + depends: + - __glibc >=2.17,<3.0.a0 + - libcap >=2.77,<2.78.0a0 + - libgcc >=14 + license: LGPL-2.1-or-later + purls: [] + size: 145087 + timestamp: 1773797108513 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libudev1-257.10-hf9559e3_2.conda + sha256: dd1ec27fef9f74ebdd0211ad875ba037f924931c81be164e7ff756b5d86ffc72 + md5: 4fc935d5bebd8e6e070a861544a71a34 + depends: + - libcap >=2.77,<2.78.0a0 + - libgcc >=14 + license: LGPL-2.1-or-later + size: 156835 + timestamp: 1763011535779 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libudev1-257.10-hf9559e3_3.conda + sha256: 39bdad22998d1ef5b366d9c557b5ca8a2ee2bea1f05eab9e1b20fbfef9d6d7a4 + md5: 8da19c1b9138b2f0a57012c31e3ad81d + depends: + - libcap >=2.77,<2.78.0a0 + - libgcc >=14 + license: LGPL-2.1-or-later + size: 156695 + timestamp: 1765552629955 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libudev1-257.10-hf9559e3_4.conda + sha256: 18098716de78ab49566c862a5bf1f89e0e064a4fc0f31ad08b60b7774cfdb60e + md5: a9bcd3f70036640538e8187e4c594cbf + depends: + - libcap >=2.77,<2.78.0a0 + - libgcc >=14 + license: LGPL-2.1-or-later + size: 157130 + timestamp: 1770738690431 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libudev1-257.13-hf9559e3_0.conda + sha256: 4946526f7723cb0f5a4dc830381ea48f455f9aebd456655cac99df70cd0d9567 + md5: b3a73b94483260f38dcbb489ee20c6d9 + depends: + - libcap >=2.77,<2.78.0a0 + - libgcc >=14 + license: LGPL-2.1-or-later + purls: [] + size: 156357 + timestamp: 1773797159424 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libunwind-1.8.3-h65a8314_0.conda + sha256: 71c8b9d5c72473752a0bb6e91b01dd209a03916cb71f36cc6a564e3a2a132d7a + md5: e179a69edd30d75c0144d7a380b88f28 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libstdcxx >=14 + license: MIT + license_family: MIT + size: 75995 + timestamp: 1757032240102 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libunwind-1.8.3-h6470e1d_0.conda + sha256: 86c013d522975b76e16a74341bfcb22f6ec2e9b8b87ec3e15380f46c435eaa7b + md5: 5d8191a950e492a06dc29b491dd5f7c5 + depends: + - libgcc >=14 + - libstdcxx >=14 + license: MIT + license_family: MIT + size: 94555 + timestamp: 1757032278900 +- conda: https://conda.anaconda.org/conda-forge/linux-64/liburing-2.12-hb700be7_0.conda + sha256: 880b1f76b24814c9f07b33402e82fa66d5ae14738a35a943c21c4434eef2403d + md5: f0531fc1ebc0902555670e9cb0127758 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libstdcxx >=14 + license: MIT + license_family: MIT + size: 127967 + timestamp: 1756125594973 +- conda: https://conda.anaconda.org/conda-forge/linux-64/liburing-2.13-hb700be7_0.conda + sha256: 5e4863d8cc9ccba7884f68d5b3c4b4f44a5a836ad7d3b332ac9aaaef0c0b9d45 + md5: 60adb61326a4a0072ed238f460b02029 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libstdcxx >=14 + license: MIT + license_family: MIT + size: 132334 + timestamp: 1765872504784 +- conda: https://conda.anaconda.org/conda-forge/linux-64/liburing-2.14-hb700be7_0.conda + sha256: 3d17b7aa90610afc65356e9e6149aeac0b2df19deda73a51f0a09cf04fd89286 + md5: 56f65185b520e016d29d01657ac02c0d + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libstdcxx >=14 + license: MIT + license_family: MIT + size: 154203 + timestamp: 1770566529700 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/liburing-2.12-hfefdfc9_0.conda + sha256: 43daf21754c0d8618c2fcc1ac1cad8740f9a107358cc31d8619554463f366609 + md5: 63a654dceff75b84fe8ff32ddb66b7fe + depends: + - libgcc >=14 + - libstdcxx >=14 + license: MIT + license_family: MIT + size: 129619 + timestamp: 1756126369793 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/liburing-2.13-hfefdfc9_0.conda + sha256: 3f4fa6a4972884ee6f09d14fb17773cd936646dc6d9e197f58e45421b2566e5f + md5: 74a5a557d5e8f60afaaa083f717105a8 + depends: + - libgcc >=14 + - libstdcxx >=14 + license: MIT + license_family: MIT + size: 134026 + timestamp: 1765873930570 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/liburing-2.14-hfefdfc9_0.conda + sha256: 7584dc478a34e50c5dc0e0ceac4cb9819ff352bc3a5d0cbb001b974dab9a0967 + md5: 9d32167817a5a85724e8524436559229 + depends: + - libgcc >=14 + - libstdcxx >=14 + license: MIT + license_family: MIT + size: 155011 + timestamp: 1770567701524 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libusb-1.0.29-h73b1eb8_0.conda + sha256: 89c84f5b26028a9d0f5c4014330703e7dff73ba0c98f90103e9cef6b43a5323c + md5: d17e3fb595a9f24fa9e149239a33475d + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=13 + - libudev1 >=257.4 + license: LGPL-2.1-or-later + size: 89551 + timestamp: 1748856210075 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libusb-1.0.29-h06eaf92_0.conda + sha256: a60aae6b529cd7caa7842f9781ef95b93014e618f71fb005e404af434d76a33f + md5: 9a86e7473e16fe25c5c47f6c1376ac82 + depends: + - libgcc >=13 + - libudev1 >=257.4 + license: LGPL-2.1-or-later + size: 93129 + timestamp: 1748856228398 +- conda: https://conda.anaconda.org/conda-forge/win-64/libusb-1.0.29-h1839187_0.conda + sha256: 9837f8e8de20b6c9c033561cd33b4554cd551b217e3b8d2862b353ed2c23d8b8 + md5: a656b2c367405cd24988cf67ff2675aa + depends: + - vc >=14.2,<15 + - vc14_runtime >=14.29.30139 + - ucrt >=10.0.20348.0 + - vc >=14.2,<15 + - vc14_runtime >=14.29.30139 + - ucrt >=10.0.20348.0 + license: LGPL-2.1-or-later + size: 118204 + timestamp: 1748856290542 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libuuid-2.41.2-h5347b49_1.conda + sha256: 030447cf827c471abd37092ab9714fde82b8222106f22fde94bc7a64e2704c40 + md5: 41f5c09a211985c3ce642d60721e7c3e + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + license: BSD-3-Clause + size: 40235 + timestamp: 1764790744114 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libuuid-2.41.3-h5347b49_0.conda + sha256: 1a7539cfa7df00714e8943e18de0b06cceef6778e420a5ee3a2a145773758aee + md5: db409b7c1720428638e7c0d509d3e1b5 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + license: BSD-3-Clause + license_family: BSD + size: 40311 + timestamp: 1766271528534 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libuuid-2.42-h5347b49_0.conda + sha256: bc1b08c92626c91500fd9f26f2c797f3eb153b627d53e9c13cd167f1e12b2829 + md5: 38ffe67b78c9d4de527be8315e5ada2c + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + license: BSD-3-Clause + license_family: BSD + purls: [] + size: 40297 + timestamp: 1775052476770 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libuuid-2.41.2-h1022ec0_1.conda + sha256: 3113c857e36779d94cf9a18236a710ceca0e94230b3bfeba0d134f33ee8c9ecd + md5: 15b2cc72b9b05bcb141810b1bada654f + depends: + - libgcc >=14 + license: BSD-3-Clause + size: 43415 + timestamp: 1764790752623 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libuuid-2.41.3-h1022ec0_0.conda + sha256: c37a8e89b700646f3252608f8368e7eb8e2a44886b92776e57ad7601fc402a11 + md5: cf2861212053d05f27ec49c3784ff8bb + depends: + - libgcc >=14 + license: BSD-3-Clause + license_family: BSD + size: 43453 + timestamp: 1766271546875 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libuuid-2.42-h1022ec0_0.conda + sha256: 7d427edf58c702c337bf62bc90f355b7fc374a65fd9f70ea7a490f13bb76b1b9 + md5: a0b5de740d01c390bdbb46d7503c9fab + depends: + - libgcc >=14 + license: BSD-3-Clause + license_family: BSD + purls: [] + size: 43567 + timestamp: 1775052485727 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libva-2.23.0-he1eb515_0.conda + sha256: 255c7d00b54e26f19fad9340db080716bced1d8539606e2b8396c57abd40007c + md5: 25813fe38b3e541fc40007592f12bae5 + depends: + - __glibc >=2.17,<3.0.a0 + - libdrm >=2.4.125,<2.5.0a0 + - libegl >=1.7.0,<2.0a0 + - libgcc >=14 + - libgl >=1.7.0,<2.0a0 + - libglx >=1.7.0,<2.0a0 + - libxcb >=1.17.0,<2.0a0 + - wayland >=1.24.0,<2.0a0 + - wayland-protocols + - xorg-libx11 >=1.8.12,<2.0a0 + - xorg-libxext >=1.3.6,<2.0a0 + - xorg-libxfixes >=6.0.2,<7.0a0 + license: MIT + license_family: MIT + size: 221308 + timestamp: 1765652453244 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libvorbis-1.3.7-h54a6638_2.conda + sha256: ca494c99c7e5ecc1b4cd2f72b5584cef3d4ce631d23511184411abcbb90a21a5 + md5: b4ecbefe517ed0157c37f8182768271c + depends: + - libogg + - libgcc >=14 + - __glibc >=2.17,<3.0.a0 + - libstdcxx >=14 + - libgcc >=14 + - libogg >=1.3.5,<1.4.0a0 + license: BSD-3-Clause + license_family: BSD + size: 285894 + timestamp: 1753879378005 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libvorbis-1.3.7-h7ac5ae9_2.conda + sha256: 066708ca7179a1c6e5639d015de7ed6e432b93ad50525843db67d57eb1ba1faf + md5: 9d099329070afe52d797462ca7bf35f3 + depends: + - libogg + - libstdcxx >=14 + - libgcc >=14 + - libogg >=1.3.5,<1.4.0a0 + license: BSD-3-Clause + license_family: BSD + size: 289391 + timestamp: 1753879417231 +- conda: https://conda.anaconda.org/conda-forge/win-64/libvorbis-1.3.7-h5112557_2.conda + sha256: 429124709c73b2e8fae5570bdc6b42f5418a7551ba72e591bb960b752e87b365 + md5: 42a8a56c60882da5d451aa95b8455111 + depends: + - libogg + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + - ucrt >=10.0.20348.0 + - libogg >=1.3.5,<1.4.0a0 + license: BSD-3-Clause + license_family: BSD + size: 243401 + timestamp: 1753879416570 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libvpl-2.15.0-h54a6638_1.conda + sha256: bf0010d93f5b154c59bd9d3cc32168698c1d24f2904729f4693917cce5b27a9f + md5: a41a299c157cc6d0eff05e5fc298cc45 + depends: + - libstdcxx >=14 + - libgcc >=14 + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - intel-media-driver >=25.3.3,<25.4.0a0 + - libva >=2.22.0,<3.0a0 + license: MIT + license_family: MIT + size: 287944 + timestamp: 1757278954789 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libvpl-2.16.0-h54a6638_0.conda + sha256: 38850657dd6835613ef16b34895a54bea98bc7639db6a649c886b331635714fc + md5: 9f6b0090c3902b2c763a16f7dace7b6e + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libstdcxx >=14 + - intel-media-driver >=26.1.2,<26.2.0a0 + - libva >=2.23.0,<3.0a0 + license: MIT + license_family: MIT + size: 287992 + timestamp: 1772980546550 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libvpx-1.15.2-hecca717_0.conda + sha256: 8e1119977f235b488ab32d540c018d3fd1eccefc3dd3859921a0ff555d8c10d2 + md5: 10f5008f1c89a40b09711b5a9cdbd229 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libstdcxx >=14 + license: BSD-3-Clause + license_family: BSD + size: 1070048 + timestamp: 1762010217363 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libvpx-1.15.2-hfae3067_0.conda + sha256: 4b60838eee9bda276f4b75906745d8f98f74c4b40d741050e07b2a96fcaf753f + md5: dd61430bfc5499c75422afdd0fe0a1bb + depends: + - libgcc >=14 + - libstdcxx >=14 + license: BSD-3-Clause + license_family: BSD + size: 1296382 + timestamp: 1762012332100 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libvulkan-loader-1.4.328.1-h5279c79_0.conda + sha256: bbabc5c48b63ff03f440940a11d4648296f5af81bb7630d98485405cd32ac1ce + md5: 372a62464d47d9e966b630ffae3abe73 + depends: + - __glibc >=2.17,<3.0.a0 + - libstdcxx >=14 + - libgcc >=14 + - xorg-libx11 >=1.8.12,<2.0a0 + - xorg-libxrandr >=1.5.4,<2.0a0 + constrains: + - libvulkan-headers 1.4.328.1.* + license: Apache-2.0 + license_family: APACHE + size: 197672 + timestamp: 1759972155030 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libvulkan-loader-1.4.341.0-h5279c79_0.conda + sha256: a68280d57dfd29e3d53400409a39d67c4b9515097eba733aa6fe00c880620e2b + md5: 31ad065eda3c2d88f8215b1289df9c89 + depends: + - __glibc >=2.17,<3.0.a0 + - libstdcxx >=14 + - libgcc >=14 + - xorg-libx11 >=1.8.12,<2.0a0 + - xorg-libxrandr >=1.5.5,<2.0a0 + constrains: + - libvulkan-headers 1.4.341.0.* + license: Apache-2.0 + license_family: APACHE + size: 199795 + timestamp: 1770077125520 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libvulkan-loader-1.4.328.1-h8b8848b_0.conda + sha256: f1b32481c65008087c64dec21cc141dec9b80921ff2a3f5571c24c8f531b18ea + md5: e5a3ff3a266b68398bd28ed1d4363e65 + depends: + - libstdcxx >=14 + - libgcc >=14 + - xorg-libxrandr >=1.5.4,<2.0a0 + - xorg-libx11 >=1.8.12,<2.0a0 + constrains: + - libvulkan-headers 1.4.328.1.* + license: Apache-2.0 + license_family: APACHE + size: 214593 + timestamp: 1759972148472 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libvulkan-loader-1.4.341.0-h8b8848b_0.conda + sha256: 92a92589f4f787201bc5091990001f61515fa794fa4f0fb15f0ca50f3cc330cc + md5: 06bb91a87fb97ea09398d2e121e00c39 + depends: + - libstdcxx >=14 + - libgcc >=14 + - xorg-libxrandr >=1.5.5,<2.0a0 + - xorg-libx11 >=1.8.12,<2.0a0 + constrains: + - libvulkan-headers 1.4.341.0.* + license: Apache-2.0 + license_family: APACHE + size: 217655 + timestamp: 1770077141862 +- conda: https://conda.anaconda.org/conda-forge/win-64/libvulkan-loader-1.4.328.1-h477610d_0.conda + sha256: 934d676c445c1ea010753dfa98680b36a72f28bec87d15652f013c91a1d8d171 + md5: 4403eae6c81f448d63a7f66c0b330536 + depends: + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + - ucrt >=10.0.20348.0 + constrains: + - libvulkan-headers 1.4.328.1.* + license: Apache-2.0 + license_family: APACHE + size: 280488 + timestamp: 1759972163692 +- conda: https://conda.anaconda.org/conda-forge/win-64/libvulkan-loader-1.4.341.0-h477610d_0.conda + sha256: 0f0965edca8b255187604fc7712c53fe9064b31a1845a7dfb2b63bf660de84a7 + md5: 804880b2674119b84277d6c16b01677d + depends: + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + - ucrt >=10.0.20348.0 + constrains: + - libvulkan-headers 1.4.341.0.* + license: Apache-2.0 + license_family: APACHE + size: 282251 + timestamp: 1770077165680 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libwebp-base-1.6.0-hd42ef1d_0.conda + sha256: 3aed21ab28eddffdaf7f804f49be7a7d701e8f0e46c856d801270b470820a37b + md5: aea31d2e5b1091feca96fcfe945c3cf9 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + constrains: + - libwebp 1.6.0 + license: BSD-3-Clause + license_family: BSD + size: 429011 + timestamp: 1752159441324 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libwebp-base-1.6.0-ha2e29f5_0.conda + sha256: b03700a1f741554e8e5712f9b06dd67e76f5301292958cd3cb1ac8c6fdd9ed25 + md5: 24e92d0942c799db387f5c9d7b81f1af + depends: + - libgcc >=14 + constrains: + - libwebp 1.6.0 + license: BSD-3-Clause + license_family: BSD + size: 359496 + timestamp: 1752160685488 +- conda: https://conda.anaconda.org/conda-forge/win-64/libwebp-base-1.6.0-h4d5522a_0.conda + sha256: 7b6316abfea1007e100922760e9b8c820d6fc19df3f42fb5aca684cfacb31843 + md5: f9bbae5e2537e3b06e0f7310ba76c893 + depends: + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + constrains: + - libwebp 1.6.0 + license: BSD-3-Clause + license_family: BSD + size: 279176 + timestamp: 1752159543911 +- conda: https://conda.anaconda.org/conda-forge/win-64/libwinpthread-12.0.0.r4.gg4f2fc60ca-h57928b3_10.conda + sha256: 0fccf2d17026255b6e10ace1f191d0a2a18f2d65088fd02430be17c701f8ffe0 + md5: 8a86073cf3b343b87d03f41790d8b4e5 + depends: + - ucrt + constrains: + - pthreads-win32 <0.0a0 + - msys2-conda-epoch <0.0a0 + license: MIT AND BSD-3-Clause-Clear + purls: [] + size: 36621 + timestamp: 1759768399557 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libxcb-1.17.0-h8a09558_0.conda + sha256: 666c0c431b23c6cec6e492840b176dde533d48b7e6fb8883f5071223433776aa + md5: 92ed62436b625154323d40d5f2f11dd7 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=13 + - pthread-stubs + - xorg-libxau >=1.0.11,<2.0a0 + - xorg-libxdmcp + license: MIT + license_family: MIT + size: 395888 + timestamp: 1727278577118 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libxcb-1.17.0-h262b8f6_0.conda + sha256: 461cab3d5650ac6db73a367de5c8eca50363966e862dcf60181d693236b1ae7b + md5: cd14ee5cca2464a425b1dbfc24d90db2 + depends: + - libgcc >=13 + - pthread-stubs + - xorg-libxau >=1.0.11,<2.0a0 + - xorg-libxdmcp + license: MIT + license_family: MIT + size: 397493 + timestamp: 1727280745441 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libxcrypt-4.4.36-hd590300_1.conda + sha256: 6ae68e0b86423ef188196fff6207ed0c8195dd84273cb5623b85aa08033a410c + md5: 5aa797f8787fe7a17d1b0821485b5adc + depends: + - libgcc-ng >=12 + license: LGPL-2.1-or-later + purls: [] + size: 100393 + timestamp: 1702724383534 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libxcrypt-4.4.36-h31becfc_1.conda + sha256: 6b46c397644091b8a26a3048636d10b989b1bf266d4be5e9474bf763f828f41f + md5: b4df5d7d4b63579d081fd3a4cf99740e + depends: + - libgcc-ng >=12 + license: LGPL-2.1-or-later + purls: [] + size: 114269 + timestamp: 1702724369203 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libxkbcommon-1.13.1-hca5e8e5_0.conda + sha256: d2195b5fbcb0af1ff7b345efdf89290c279b8d1d74f325ae0ac98148c375863c + md5: 2bca1fbb221d9c3c8e3a155784bbc2e9 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libstdcxx >=14 + - libxcb >=1.17.0,<2.0a0 + - libxml2 + - libxml2-16 >=2.14.6 + - xkeyboard-config + - xorg-libxau >=1.0.12,<2.0a0 + license: MIT/X11 Derivative + license_family: MIT + size: 837922 + timestamp: 1764794163823 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libxkbcommon-1.13.1-h3c6a4c8_0.conda + sha256: 37e4aa45b71c35095a01835bd42fa37c08218fec44eb2c6bf4b9e2826b0351d4 + md5: 22c1ce28d481e490f3635c1b6a2bb23f + depends: + - libgcc >=14 + - libstdcxx >=14 + - libxcb >=1.17.0,<2.0a0 + - libxml2 + - libxml2-16 >=2.14.6 + - xkeyboard-config + - xorg-libxau >=1.0.12,<2.0a0 + license: MIT/X11 Derivative + license_family: MIT + size: 863646 + timestamp: 1764794352540 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libxml2-2.15.1-h26afc86_0.conda + sha256: ec0735ae56c3549149eebd7dc22c0bed91fd50c02eaa77ff418613ddda190aa8 + md5: e512be7dc1f84966d50959e900ca121f + depends: + - __glibc >=2.17,<3.0.a0 + - icu >=75.1,<76.0a0 + - libgcc >=14 + - libiconv >=1.18,<2.0a0 + - liblzma >=5.8.1,<6.0a0 + - libxml2-16 2.15.1 ha9997c6_0 + - libzlib >=1.3.1,<2.0a0 + license: MIT + license_family: MIT + size: 45283 + timestamp: 1761015644057 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libxml2-2.15.1-he237659_1.conda + sha256: 047be059033c394bd32ae5de66ce389824352120b3a7c0eff980195f7ed80357 + md5: 417955234eccd8f252b86a265ccdab7f + depends: + - __glibc >=2.17,<3.0.a0 + - icu >=78.1,<79.0a0 + - libgcc >=14 + - libiconv >=1.18,<2.0a0 + - liblzma >=5.8.1,<6.0a0 + - libxml2-16 2.15.1 hca6bf5a_1 + - libzlib >=1.3.1,<2.0a0 + license: MIT + license_family: MIT + size: 45402 + timestamp: 1766327161688 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libxml2-2.15.2-he237659_0.conda + sha256: 275c324f87bda1a3b67d2f4fcc3555eeff9e228a37655aa001284a7ceb6b0392 + md5: e49238a1609f9a4a844b09d9926f2c3d + depends: + - __glibc >=2.17,<3.0.a0 + - icu >=78.2,<79.0a0 + - libgcc >=14 + - libiconv >=1.18,<2.0a0 + - liblzma >=5.8.2,<6.0a0 + - libxml2-16 2.15.2 hca6bf5a_0 + - libzlib >=1.3.1,<2.0a0 + license: MIT + license_family: MIT + size: 45968 + timestamp: 1772704614539 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libxml2-2.15.1-h788dabe_0.conda + sha256: db0a568e0853ee38b7a4db1cb4ee76e57fe7c32ccb1d5b75f6618a1041d3c6e4 + md5: a0e7779b7625b88e37df9bd73f0638dc + depends: + - icu >=75.1,<76.0a0 + - libgcc >=14 + - libiconv >=1.18,<2.0a0 + - liblzma >=5.8.1,<6.0a0 + - libxml2-16 2.15.1 h8591a01_0 + - libzlib >=1.3.1,<2.0a0 + license: MIT + license_family: MIT + size: 47192 + timestamp: 1761015739999 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libxml2-2.15.1-h825857f_1.conda + sha256: 9fe997c3e5a8207161d093a5d73f586ae46dc319cb054220086395e150dd1469 + md5: eb4665cdf78fd02d4abc4edf8c15b7b9 + depends: + - icu >=78.1,<79.0a0 + - libgcc >=14 + - libiconv >=1.18,<2.0a0 + - liblzma >=5.8.1,<6.0a0 + - libxml2-16 2.15.1 h79dcc73_1 + - libzlib >=1.3.1,<2.0a0 + license: MIT + license_family: MIT + size: 47725 + timestamp: 1766327143205 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libxml2-2.15.2-h825857f_0.conda + sha256: 3e51e1952cb60c8107094b6b78473d91ff49d428ad4bef6806124b383e8fe29c + md5: 19de96909ee1198e2853acd8aba89f6c + depends: + - icu >=78.2,<79.0a0 + - libgcc >=14 + - libiconv >=1.18,<2.0a0 + - liblzma >=5.8.2,<6.0a0 + - libxml2-16 2.15.2 h79dcc73_0 + - libzlib >=1.3.1,<2.0a0 + license: MIT + license_family: MIT + size: 47837 + timestamp: 1772704681112 +- conda: https://conda.anaconda.org/conda-forge/win-64/libxml2-2.15.1-h779ef1b_1.conda + sha256: 8b47d5fb00a6ccc0f495d16787ab5f37a434d51965584d6000966252efecf56d + md5: 68dc154b8d415176c07b6995bd3a65d9 + depends: + - icu >=78.1,<79.0a0 + - libiconv >=1.18,<2.0a0 + - liblzma >=5.8.1,<6.0a0 + - libxml2-16 2.15.1 h3cfd58e_1 + - libzlib >=1.3.1,<2.0a0 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: MIT + license_family: MIT + size: 43387 + timestamp: 1766327259710 +- conda: https://conda.anaconda.org/conda-forge/win-64/libxml2-2.15.1-ha29bfb0_0.conda + sha256: fb51b91a01eac9ee5e26c67f4e081f09f970c18a3da5231b8172919a1e1b3b6b + md5: 87116b9de9c1825c3fd4ef92c984877b + depends: + - icu >=75.1,<76.0a0 + - libiconv >=1.18,<2.0a0 + - liblzma >=5.8.1,<6.0a0 + - libxml2-16 2.15.1 h06f855e_0 + - libzlib >=1.3.1,<2.0a0 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: MIT + license_family: MIT + size: 43042 + timestamp: 1761016261024 +- conda: https://conda.anaconda.org/conda-forge/win-64/libxml2-2.15.2-h5d26750_0.conda + sha256: f905eb7046987c336122121759e7f09144729f6898f48cd06df2a945b86998d8 + md5: 1007e1bfe181a2aee214779ee7f13d30 + depends: + - libiconv >=1.18,<2.0a0 + - liblzma >=5.8.2,<6.0a0 + - libxml2-16 2.15.2 h692994f_0 + - libzlib >=1.3.1,<2.0a0 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + constrains: + - icu <0.0a0 + license: MIT + license_family: MIT + purls: [] + size: 43681 + timestamp: 1772704748950 +- conda: https://conda.anaconda.org/conda-forge/win-64/libxml2-2.15.2-h779ef1b_0.conda + sha256: 2131e25d4fb21be66d7ef685e1b2d66f04aa08e70b37322d557824389d0a4c2a + md5: be3843e412c9f9d697958aa68c72d09d + depends: + - icu >=78.2,<79.0a0 + - libiconv >=1.18,<2.0a0 + - liblzma >=5.8.2,<6.0a0 + - libxml2-16 2.15.2 h3cfd58e_0 + - libzlib >=1.3.1,<2.0a0 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: MIT + license_family: MIT + size: 43866 + timestamp: 1772704745691 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libxml2-16-2.15.1-ha9997c6_0.conda + sha256: 71436e72a286ef8b57d6f4287626ff91991eb03c7bdbe835280521791efd1434 + md5: e7733bc6785ec009e47a224a71917e84 + depends: + - __glibc >=2.17,<3.0.a0 + - icu >=75.1,<76.0a0 + - libgcc >=14 + - libiconv >=1.18,<2.0a0 + - liblzma >=5.8.1,<6.0a0 + - libzlib >=1.3.1,<2.0a0 + constrains: + - libxml2 2.15.1 + license: MIT + license_family: MIT + size: 556302 + timestamp: 1761015637262 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libxml2-16-2.15.1-hca6bf5a_1.conda + sha256: 8331284bf9ae641b70cdc0e5866502dd80055fc3b9350979c74bb1d192e8e09e + md5: 3fdd8d99683da9fe279c2f4cecd1e048 + depends: + - __glibc >=2.17,<3.0.a0 + - icu >=78.1,<79.0a0 + - libgcc >=14 + - libiconv >=1.18,<2.0a0 + - liblzma >=5.8.1,<6.0a0 + - libzlib >=1.3.1,<2.0a0 + constrains: + - libxml2 2.15.1 + license: MIT + license_family: MIT + size: 555747 + timestamp: 1766327145986 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libxml2-16-2.15.2-hca6bf5a_0.conda + sha256: 08d2b34b49bec9613784f868209bb7c3bb8840d6cf835ff692e036b09745188c + md5: f3bc152cb4f86babe30f3a4bf0dbef69 + depends: + - __glibc >=2.17,<3.0.a0 + - icu >=78.2,<79.0a0 + - libgcc >=14 + - libiconv >=1.18,<2.0a0 + - liblzma >=5.8.2,<6.0a0 + - libzlib >=1.3.1,<2.0a0 + constrains: + - libxml2 2.15.2 + license: MIT + license_family: MIT + size: 557492 + timestamp: 1772704601644 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libxml2-16-2.15.1-h79dcc73_1.conda + sha256: c76951407554d69dd348151f91cc2dc164efbd679b4f4e77deb2f9aa6eba3c12 + md5: e42758e7b065c34fd1b0e5143752f970 + depends: + - icu >=78.1,<79.0a0 + - libgcc >=14 + - libiconv >=1.18,<2.0a0 + - liblzma >=5.8.1,<6.0a0 + - libzlib >=1.3.1,<2.0a0 + constrains: + - libxml2 2.15.1 + license: MIT + license_family: MIT + size: 599721 + timestamp: 1766327134458 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libxml2-16-2.15.1-h8591a01_0.conda + sha256: 7a13450bce2eeba8f8fb691868b79bf0891377b707493a527bd930d64d9b98af + md5: e7177c6fbbf815da7b215b4cc3e70208 + depends: + - icu >=75.1,<76.0a0 + - libgcc >=14 + - libiconv >=1.18,<2.0a0 + - liblzma >=5.8.1,<6.0a0 + - libzlib >=1.3.1,<2.0a0 + constrains: + - libxml2 2.15.1 + license: MIT + license_family: MIT + size: 597078 + timestamp: 1761015734476 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libxml2-16-2.15.2-h79dcc73_0.conda + sha256: da6b2ebbcecc158200d90be39514e4e902971628029b35b7f6ad57270659c5d9 + md5: e3ec9079759d35b875097d6a9a69e744 + depends: + - icu >=78.2,<79.0a0 + - libgcc >=14 + - libiconv >=1.18,<2.0a0 + - liblzma >=5.8.2,<6.0a0 + - libzlib >=1.3.1,<2.0a0 + constrains: + - libxml2 2.15.2 + license: MIT + license_family: MIT + size: 598438 + timestamp: 1772704671710 +- conda: https://conda.anaconda.org/conda-forge/win-64/libxml2-16-2.15.1-h06f855e_0.conda + sha256: 3f65ea0f04c7738116e74ca87d6e40f8ba55b3df31ef42b8cb4d78dd96645e90 + md5: 4a5ea6ec2055ab0dfd09fd0c498f834a + depends: + - icu >=75.1,<76.0a0 + - libiconv >=1.18,<2.0a0 + - liblzma >=5.8.1,<6.0a0 + - libzlib >=1.3.1,<2.0a0 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + constrains: + - libxml2 2.15.1 + license: MIT + license_family: MIT + size: 518616 + timestamp: 1761016240185 +- conda: https://conda.anaconda.org/conda-forge/win-64/libxml2-16-2.15.1-h3cfd58e_1.conda + sha256: a857e941156b7f462063e34e086d212c6ccbc1521ebdf75b9ed66bd90add57dc + md5: 07d73826fde28e7dbaec52a3297d7d26 + depends: + - icu >=78.1,<79.0a0 + - libiconv >=1.18,<2.0a0 + - liblzma >=5.8.1,<6.0a0 + - libzlib >=1.3.1,<2.0a0 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + constrains: + - libxml2 2.15.1 + license: MIT + license_family: MIT + size: 518964 + timestamp: 1766327232819 +- conda: https://conda.anaconda.org/conda-forge/win-64/libxml2-16-2.15.2-h3cfd58e_0.conda + sha256: d6d792f8f1d6786b9144adfa62c33a04aeec3d76682351b353ca1224fc1a74f3 + md5: f6dd496a1f2b66951110a3a0817f699b + depends: + - icu >=78.2,<79.0a0 + - libiconv >=1.18,<2.0a0 + - liblzma >=5.8.2,<6.0a0 + - libzlib >=1.3.1,<2.0a0 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + constrains: + - libxml2 2.15.2 + license: MIT + license_family: MIT + size: 520731 + timestamp: 1772704723763 +- conda: https://conda.anaconda.org/conda-forge/win-64/libxml2-16-2.15.2-h692994f_0.conda + sha256: b8c71b3b609c7cfe17f3f2a47c75394d7b30acfb8b34ad7a049ea8757b4d33df + md5: e365238134188e42ed36ee996159d482 + depends: + - libiconv >=1.18,<2.0a0 + - liblzma >=5.8.2,<6.0a0 + - libzlib >=1.3.1,<2.0a0 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + constrains: + - libxml2 2.15.2 + - icu <0.0a0 + license: MIT + license_family: MIT + purls: [] + size: 520078 + timestamp: 1772704728534 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libzlib-1.3.1-hb9d3cd8_2.conda + sha256: d4bfe88d7cb447768e31650f06257995601f89076080e76df55e3112d4e47dc4 + md5: edb0dca6bc32e4f4789199455a1dbeb8 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=13 + constrains: + - zlib 1.3.1 *_2 + license: Zlib + license_family: Other + size: 60963 + timestamp: 1727963148474 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libzlib-1.3.2-h25fd6f3_2.conda + sha256: 55044c403570f0dc26e6364de4dc5368e5f3fc7ff103e867c487e2b5ab2bcda9 + md5: d87ff7921124eccd67248aa483c23fec + depends: + - __glibc >=2.17,<3.0.a0 + constrains: + - zlib 1.3.2 *_2 + license: Zlib + license_family: Other + purls: [] + size: 63629 + timestamp: 1774072609062 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libzlib-1.3.1-h86ecc28_2.conda + sha256: 5a2c1eeef69342e88a98d1d95bff1603727ab1ff4ee0e421522acd8813439b84 + md5: 08aad7cbe9f5a6b460d0976076b6ae64 + depends: + - libgcc >=13 + constrains: + - zlib 1.3.1 *_2 + license: Zlib + license_family: Other + size: 66657 + timestamp: 1727963199518 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libzlib-1.3.2-hdc9db2a_2.conda + sha256: eb111e32e5a7313a5bf799c7fb2419051fa2fe7eff74769fac8d5a448b309f7f + md5: 502006882cf5461adced436e410046d1 + constrains: + - zlib 1.3.2 *_2 + license: Zlib + license_family: Other + purls: [] + size: 69833 + timestamp: 1774072605429 +- conda: https://conda.anaconda.org/conda-forge/win-64/libzlib-1.3.1-h2466b09_2.conda + sha256: ba945c6493449bed0e6e29883c4943817f7c79cbff52b83360f7b341277c6402 + md5: 41fbfac52c601159df6c01f875de31b9 + depends: + - ucrt >=10.0.20348.0 + - vc >=14.2,<15 + - vc14_runtime >=14.29.30139 + constrains: + - zlib 1.3.1 *_2 + license: Zlib + license_family: Other + size: 55476 + timestamp: 1727963768015 +- conda: https://conda.anaconda.org/conda-forge/win-64/libzlib-1.3.2-hfd05255_2.conda + sha256: 88609816e0cc7452bac637aaf65783e5edf4fee8a9f8e22bdc3a75882c536061 + md5: dbabbd6234dea34040e631f87676292f + depends: + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + constrains: + - zlib 1.3.2 *_2 + license: Zlib + license_family: Other + purls: [] + size: 58347 + timestamp: 1774072851498 +- conda: https://conda.anaconda.org/conda-forge/win-64/llvm-openmp-21.1.8-h4fa8253_0.conda + sha256: 145c4370abe870f10987efa9fc15a8383f1dab09abbc9ad4ff15a55d45658f7b + md5: 0d8b425ac862bcf17e4b28802c9351cb + depends: + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + constrains: + - intel-openmp <0.0a0 + - openmp 21.1.8|21.1.8.* + license: Apache-2.0 WITH LLVM-exception + license_family: APACHE + size: 347566 + timestamp: 1765964942856 +- conda: https://conda.anaconda.org/conda-forge/win-64/llvm-openmp-22.1.0-h4fa8253_0.conda + sha256: bb55a3736380759d338f87aac68df4fd7d845ae090b94400525f5d21a55eea31 + md5: e5505e0b7d6ef5c19d5c0c1884a2f494 + depends: + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + constrains: + - openmp 22.1.0|22.1.0.* + - intel-openmp <0.0a0 + license: Apache-2.0 WITH LLVM-exception + license_family: APACHE + size: 347404 + timestamp: 1772025050288 +- conda: https://conda.anaconda.org/conda-forge/win-64/llvm-openmp-22.1.2-h4fa8253_0.conda + sha256: fa8bd542624507309cbdfc620bdfe546ed823d418e6ba878977d48da7a0f6212 + md5: 29407a30bd93dc8c11c03ca60249a340 + depends: + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + constrains: + - intel-openmp <0.0a0 + - openmp 22.1.2|22.1.2.* + license: Apache-2.0 WITH LLVM-exception + license_family: APACHE + purls: [] + size: 348400 + timestamp: 1774733045609 +- conda: https://conda.anaconda.org/conda-forge/win-64/m2-conda-epoch-20250515-0_x86_64.conda + build_number: 0 + sha256: 51e9214548f177db9c3fe70424e3774c95bf19cd69e0e56e83abe2e393228ba1 + md5: 7d60fb16df2cd07fbc3dbff1c9df4244 + constrains: + - msys2-conda-epoch <0.0a0 + license: BSD-3-Clause + license_family: BSD + size: 7539 + timestamp: 1747330852019 +- conda: https://conda.anaconda.org/conda-forge/noarch/m2w64-sysroot_win-64-12.0.0.r4.gg4f2fc60ca-hd8ed1ab_10.conda + sha256: fb0ffe6b3c25189038c29abbd1fac2522d87fe2775a09e5f5088e5542dc3309b + md5: 9676d2a30fa3ffa4e5350041d0993758 + depends: + - m2-conda-epoch + - mingw-w64-ucrt-x86_64-crt-git 12.0.0.r4.gg4f2fc60ca hd8ed1ab_10 + - mingw-w64-ucrt-x86_64-headers-git 12.0.0.r4.gg4f2fc60ca hd8ed1ab_10 + - mingw-w64-ucrt-x86_64-windows-default-manifest + - mingw-w64-ucrt-x86_64-winpthreads-git 12.0.0.r4.gg4f2fc60ca hd8ed1ab_10 + - ucrt + size: 8421 + timestamp: 1759768559974 +- conda: https://conda.anaconda.org/conda-forge/linux-64/make-4.4.1-hb9d3cd8_2.conda + sha256: d652c7bd4d3b6f82b0f6d063b0d8df6f54cc47531092d7ff008e780f3261bdda + md5: 33405d2a66b1411db9f7242c8b97c9e7 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=13 + license: GPL-3.0-or-later + license_family: GPL + purls: [] + size: 513088 + timestamp: 1727801714848 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/make-4.4.1-h2a6d0cb_2.conda + sha256: d243aea768e6fa360b7eda598340f43d2a41c9fc169d9f97f505410be68815f8 + md5: 5983ffb12d09efc45c4a3b74cd890137 + depends: + - libgcc >=13 + license: GPL-3.0-or-later + license_family: GPL + purls: [] + size: 528318 + timestamp: 1727801707353 +- conda: https://conda.anaconda.org/conda-forge/win-64/make-4.4.1-h0e40799_2.conda + sha256: a810cdca3d5fa50d562cda23c0c1195b45ff5f9b0c41e0d4c8c2dd3c043ff4f2 + md5: 77ff648ad9fec660f261aa8ab0949f62 + depends: + - libgcc >=13 + - libwinpthread >=12.0.0.r4.gg4f2fc60ca + - ucrt >=10.0.20348.0 + license: GPL-3.0-or-later + license_family: GPL + purls: [] + size: 2176937 + timestamp: 1727802346950 +- conda: https://conda.anaconda.org/conda-forge/noarch/markdown-it-py-4.0.0-pyhd8ed1ab_0.conda + sha256: 7b1da4b5c40385791dbc3cc85ceea9fad5da680a27d5d3cb8bfaa185e304a89e + md5: 5b5203189eb668f042ac2b0826244964 + depends: + - mdurl >=0.1,<1 + - python >=3.10 + license: MIT + license_family: MIT + purls: + - pkg:pypi/markdown-it-py?source=hash-mapping + size: 64736 + timestamp: 1754951288511 +- conda: https://conda.anaconda.org/conda-forge/linux-64/markupsafe-3.0.3-py312h8a5da7c_1.conda + sha256: 5f3aad1f3a685ed0b591faad335957dbdb1b73abfd6fc731a0d42718e0653b33 + md5: 93a4752d42b12943a355b682ee43285b + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - python >=3.12,<3.13.0a0 + - python_abi 3.12.* *_cp312 + constrains: + - jinja2 >=3.0.0 + license: BSD-3-Clause + license_family: BSD + purls: + - pkg:pypi/markupsafe?source=compressed-mapping + size: 26057 + timestamp: 1772445297924 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/markupsafe-3.0.3-py312hd077ced_1.conda + sha256: 5919bf53e9f74ee1c6ce35ce13a7cd92741d45385c2d0b3eae48b01c0f11f41a + md5: 1fecdd103b37427ba6041b9b03d657ea + depends: + - libgcc >=14 + - python >=3.12,<3.13.0a0 + - python_abi 3.12.* *_cp312 + constrains: + - jinja2 >=3.0.0 + license: BSD-3-Clause + license_family: BSD + purls: + - pkg:pypi/markupsafe?source=hash-mapping + size: 26305 + timestamp: 1772446326927 +- conda: https://conda.anaconda.org/conda-forge/win-64/markupsafe-3.0.3-py312h05f76fc_1.conda + sha256: b744287a780211ac4595126ef96a44309c791f155d4724021ef99092bae4aace + md5: a73298d225c7852f97403ca105d10a13 + depends: + - python >=3.12,<3.13.0a0 + - python_abi 3.12.* *_cp312 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + constrains: + - jinja2 >=3.0.0 + license: BSD-3-Clause + license_family: BSD + purls: + - pkg:pypi/markupsafe?source=compressed-mapping + size: 28510 + timestamp: 1772445175216 +- conda: https://conda.anaconda.org/conda-forge/noarch/matplotlib-inline-0.2.1-pyhd8ed1ab_0.conda + sha256: 9d690334de0cd1d22c51bc28420663f4277cfa60d34fa5cad1ce284a13f1d603 + md5: 00e120ce3e40bad7bfc78861ce3c4a25 + depends: + - python >=3.10 + - traitlets + license: BSD-3-Clause + license_family: BSD + purls: + - pkg:pypi/matplotlib-inline?source=hash-mapping + size: 15175 + timestamp: 1761214578417 +- conda: https://conda.anaconda.org/conda-forge/noarch/mdit-py-plugins-0.5.0-pyhd8ed1ab_0.conda + sha256: 123cc004e2946879708cdb6a9eff24acbbb054990d6131bb94bca7a374ebebfc + md5: 1997a083ef0b4c9331f9191564be275e + depends: + - markdown-it-py >=2.0.0,<5.0.0 + - python >=3.10 + license: MIT + license_family: MIT + purls: + - pkg:pypi/mdit-py-plugins?source=hash-mapping + size: 43805 + timestamp: 1754946862113 +- conda: https://conda.anaconda.org/conda-forge/noarch/mdurl-0.1.2-pyhd8ed1ab_1.conda + sha256: 78c1bbe1723449c52b7a9df1af2ee5f005209f67e40b6e1d3c7619127c43b1c7 + md5: 592132998493b3ff25fd7479396e8351 + depends: + - python >=3.9 + license: MIT + license_family: MIT + purls: + - pkg:pypi/mdurl?source=hash-mapping + size: 14465 + timestamp: 1733255681319 +- conda: https://conda.anaconda.org/conda-forge/noarch/mingw-w64-ucrt-x86_64-crt-git-12.0.0.r4.gg4f2fc60ca-hd8ed1ab_10.conda + sha256: de3e42149b498c16bfb485b7729f4ca0fe392be576a2a10ff702d661799b1df3 + md5: 44ffa6d68699ec9321f6d48d75bdc726 + depends: + - m2-conda-epoch + - mingw-w64-ucrt-x86_64-headers-git 12.0.0.r4.gg4f2fc60ca hd8ed1ab_10 + constrains: + - mingw-w64-ucrt-x86_64-winpthreads-git 12.0.0.r4.gg4f2fc60ca.* + license: ZPL-2.1 + size: 5663635 + timestamp: 1759768458961 +- conda: https://conda.anaconda.org/conda-forge/noarch/mingw-w64-ucrt-x86_64-headers-git-12.0.0.r4.gg4f2fc60ca-hd8ed1ab_10.conda + sha256: 1add86481f35163215e7076e6f06f22aa9f1f9345a5fff5cb07bc846c13fbec7 + md5: cab7b807024204893ef5bb1860d91408 + depends: + - m2-conda-epoch + constrains: + - mingw-w64-ucrt-x86_64-crt-git 12.0.0.r4.gg4f2fc60ca.* + - mingw-w64-ucrt-x86_64-winpthreads-git 12.0.0.r4.gg4f2fc60ca.* + license: ZPL-2.1 AND LGPL-2.1-or-later + size: 7089846 + timestamp: 1759768412123 +- conda: https://conda.anaconda.org/conda-forge/noarch/mingw-w64-ucrt-x86_64-windows-default-manifest-6.4-he206cdd_7.conda + sha256: 5b0df4e0ba8487ffd59f60c34c5dbb9e001ecd2c5d2c66ba88eada40bfa3ecb8 + md5: 1d6b5c96d7e3cce773519d7d1a4482f0 + depends: + - __win + constrains: + - m2w64-sysroot_win-64 >=12.0.0.r0 + license: FSFAP + size: 7412 + timestamp: 1717486007140 +- conda: https://conda.anaconda.org/conda-forge/noarch/mingw-w64-ucrt-x86_64-winpthreads-git-12.0.0.r4.gg4f2fc60ca-hd8ed1ab_10.conda + sha256: 828abb111286940473c4c665fc8ab300d28920f5af83b32295e8bf2256a8f342 + md5: ba0eeff6a5c62b83c771bb392e22dbb4 + depends: + - m2-conda-epoch + - mingw-w64-ucrt-x86_64-headers-git 12.0.0.r4.gg4f2fc60ca hd8ed1ab_10 + constrains: + - mingw-w64-ucrt-x86_64-crt-git 12.0.0.r4.gg4f2fc60ca.* + license: MIT AND BSD-3-Clause-Clear + size: 123916 + timestamp: 1759768539535 +- conda: https://conda.anaconda.org/conda-forge/win-64/mkl-2025.3.0-hac47afa_454.conda + sha256: 3c432e77720726c6bd83e9ee37ac8d0e3dd7c4cf9b4c5805e1d384025f9e9ab6 + md5: c83ec81713512467dfe1b496a8292544 + depends: + - llvm-openmp >=21.1.4 + - tbb >=2022.2.0 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: LicenseRef-IntelSimplifiedSoftwareOct2022 + license_family: Proprietary + size: 99909095 + timestamp: 1761668703167 +- conda: https://conda.anaconda.org/conda-forge/win-64/mkl-2025.3.0-hac47afa_455.conda + sha256: b2b4c84b95210760e4d12319416c60ab66e03674ccdcbd14aeb59f82ebb1318d + md5: fd05d1e894497b012d05a804232254ed + depends: + - llvm-openmp >=21.1.8 + - tbb >=2022.3.0 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: LicenseRef-IntelSimplifiedSoftwareOct2022 + license_family: Proprietary + size: 100224829 + timestamp: 1767634557029 +- conda: https://conda.anaconda.org/conda-forge/win-64/mkl-2025.3.1-hac47afa_11.conda + sha256: f2c2b2a3c2e7d08d78c10bef7c135a4262c80d1d48c85fb5902ca30d61d645f4 + md5: 3fd3009cef89c36e9898a6feeb0f5530 + depends: + - llvm-openmp >=22.1.1 + - tbb >=2022.3.0 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: LicenseRef-IntelSimplifiedSoftwareOct2022 + license_family: Proprietary + purls: [] + size: 99997309 + timestamp: 1774449747739 +- conda: https://conda.anaconda.org/conda-forge/noarch/more-itertools-11.0.1-pyhcf101f3_0.conda + sha256: af8f30fb9542f48167fedbe1ab14230bfb82245cd4338b70c30dd55729714472 + md5: 6fbedd565de86ec83bc96531ee3ab856 + depends: + - python >=3.10 + - python + license: MIT + license_family: MIT + purls: + - pkg:pypi/more-itertools?source=compressed-mapping + size: 71354 + timestamp: 1775153285920 +- conda: https://conda.anaconda.org/conda-forge/linux-64/mpg123-1.32.9-hc50e24c_0.conda + sha256: 39c4700fb3fbe403a77d8cc27352fa72ba744db487559d5d44bf8411bb4ea200 + md5: c7f302fd11eeb0987a6a5e1f3aed6a21 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=13 + - libstdcxx >=13 + license: LGPL-2.1-only + license_family: LGPL + size: 491140 + timestamp: 1730581373280 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/mpg123-1.32.9-h65af167_0.conda + sha256: d65d5a00278544639ba4f99887154be00a1f57afb0b34d80b08e5cba40a17072 + md5: cdf140c7690ab0132106d3bc48bce47d + depends: + - libgcc >=13 + - libstdcxx >=13 + license: LGPL-2.1-only + license_family: LGPL + size: 558708 + timestamp: 1730581372400 +- conda: https://conda.anaconda.org/conda-forge/linux-64/msgpack-python-1.1.2-py312hd9148b4_1.conda + sha256: 94068fd39d1a672f8799e3146a18ba4ef553f0fcccefddb3c07fbdabfd73667a + md5: 2e489969e38f0b428c39492619b5e6e5 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libstdcxx >=14 + - python >=3.12,<3.13.0a0 + - python_abi 3.12.* *_cp312 + license: Apache-2.0 + license_family: Apache + purls: + - pkg:pypi/msgpack?source=hash-mapping + size: 102525 + timestamp: 1762504116832 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/msgpack-python-1.1.2-py312h4f740d2_1.conda + sha256: 54d29951b12731bbcd01b914f101566fc00da060151e11c295b8eb698d219897 + md5: fa2dab79048dfea842cb4f6eac8301fb + depends: + - libgcc >=14 + - libstdcxx >=14 + - python >=3.12,<3.13.0a0 + - python >=3.12,<3.13.0a0 *_cpython + - python_abi 3.12.* *_cp312 + license: Apache-2.0 + license_family: Apache + purls: + - pkg:pypi/msgpack?source=hash-mapping + size: 99305 + timestamp: 1762504246142 +- conda: https://conda.anaconda.org/conda-forge/win-64/msgpack-python-1.1.2-py312hf90b1b7_1.conda + sha256: 0408cc0868e0963922c76940d618266df88518a7b58b5d28da8378911916b998 + md5: 3272249c8d0f9cb7693e189611b9943f + depends: + - python >=3.12,<3.13.0a0 + - python_abi 3.12.* *_cp312 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: Apache-2.0 + license_family: Apache + purls: + - pkg:pypi/msgpack?source=hash-mapping + size: 87478 + timestamp: 1762504274037 +- conda: https://conda.anaconda.org/conda-forge/noarch/mypy_extensions-1.1.0-pyha770c72_0.conda + sha256: 6ed158e4e5dd8f6a10ad9e525631e35cee8557718f83de7a4e3966b1f772c4b1 + md5: e9c622e0d00fa24a6292279af3ab6d06 + depends: + - python >=3.9 + license: MIT + license_family: MIT + purls: + - pkg:pypi/mypy-extensions?source=hash-mapping + size: 11766 + timestamp: 1745776666688 +- conda: https://conda.anaconda.org/conda-forge/noarch/myst-nb-1.4.0-pyhcf101f3_0.conda + sha256: c81d0c8c74c3da66808f8da09d8e48f2af2d173d357d45239defaf466838edba + md5: da07c7b1588ad0a44118d28aeb31b6a6 + depends: + - importlib-metadata + - ipykernel + - ipython + - jupyter-cache >=0.5 + - myst-parser >=1.0.0 + - nbclient + - nbformat >=5.0 + - python >=3.10 + - pyyaml + - sphinx >=5 + - typing_extensions + - python + license: BSD-3-Clause + license_family: BSD + purls: + - pkg:pypi/myst-nb?source=hash-mapping + size: 68766 + timestamp: 1772587444587 +- conda: https://conda.anaconda.org/conda-forge/noarch/myst-parser-5.0.0-pyhd8ed1ab_0.conda + sha256: f352d594d968acd31052c5f894ae70718be56481ffa9c304fdfcbe78ddf66eb1 + md5: a65e2c3c764766f0b28a3ac5052502a6 + depends: + - docutils >=0.20,<0.23 + - jinja2 + - markdown-it-py >=4.0.0,<4.1.0 + - mdit-py-plugins >=0.5,<0.6 + - python >=3.11 + - pyyaml + - sphinx >=8,<10 + license: MIT + license_family: MIT + purls: + - pkg:pypi/myst-parser?source=hash-mapping + size: 73535 + timestamp: 1768942892170 +- conda: https://conda.anaconda.org/conda-forge/noarch/natsort-8.4.0-pyhcf101f3_2.conda + sha256: aeb1548eb72e4f198e72f19d242fb695b35add2ac7b2c00e0d83687052867680 + md5: e941e85e273121222580723010bd4fa2 + depends: + - python >=3.9 + - python + license: MIT + license_family: MIT + purls: + - pkg:pypi/natsort?source=hash-mapping + size: 39262 + timestamp: 1770905275632 +- conda: https://conda.anaconda.org/conda-forge/noarch/nbclient-0.10.4-pyhd8ed1ab_0.conda + sha256: 1b66960ee06874ddceeebe375d5f17fb5f393d025a09e15b830ad0c4fffb585b + md5: 00f5b8dafa842e0c27c1cd7296aa4875 + depends: + - jupyter_client >=6.1.12 + - jupyter_core >=4.12,!=5.0.* + - nbformat >=5.1 + - python >=3.8 + - traitlets >=5.4 + license: BSD-3-Clause + license_family: BSD + purls: + - pkg:pypi/nbclient?source=compressed-mapping + size: 28473 + timestamp: 1766485646962 +- conda: https://conda.anaconda.org/conda-forge/noarch/nbformat-5.10.4-pyhd8ed1ab_1.conda + sha256: 7a5bd30a2e7ddd7b85031a5e2e14f290898098dc85bea5b3a5bf147c25122838 + md5: bbe1963f1e47f594070ffe87cdf612ea + depends: + - jsonschema >=2.6 + - jupyter_core >=4.12,!=5.0.* + - python >=3.9 + - python-fastjsonschema >=2.15 + - traitlets >=5.1 + license: BSD-3-Clause + license_family: BSD + purls: + - pkg:pypi/nbformat?source=hash-mapping + size: 100945 + timestamp: 1733402844974 +- conda: https://conda.anaconda.org/conda-forge/linux-64/ncurses-6.5-h2d0b736_3.conda + sha256: 3fde293232fa3fca98635e1167de6b7c7fda83caf24b9d6c91ec9eefb4f4d586 + md5: 47e340acb35de30501a76c7c799c41d7 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=13 + license: X11 AND BSD-3-Clause + purls: [] + size: 891641 + timestamp: 1738195959188 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/ncurses-6.5-ha32ae93_3.conda + sha256: 91cfb655a68b0353b2833521dc919188db3d8a7f4c64bea2c6a7557b24747468 + md5: 182afabe009dc78d8b73100255ee6868 + depends: + - libgcc >=13 + license: X11 AND BSD-3-Clause + purls: [] + size: 926034 + timestamp: 1738196018799 +- conda: https://conda.anaconda.org/conda-forge/noarch/nest-asyncio-1.6.0-pyhd8ed1ab_1.conda + sha256: bb7b21d7fd0445ddc0631f64e66d91a179de4ba920b8381f29b9d006a42788c0 + md5: 598fd7d4d0de2455fb74f56063969a97 + depends: + - python >=3.9 + license: BSD-2-Clause + license_family: BSD + purls: + - pkg:pypi/nest-asyncio?source=hash-mapping + size: 11543 + timestamp: 1733325673691 +- conda: https://conda.anaconda.org/conda-forge/linux-64/numpy-2.3.5-py314h2b28147_0.conda + sha256: 4fa3b8b80dd848a70f679b31d74d6fb28f9c4de9cd81086aa8e10256e9de20d1 + md5: 6d2cff81447b8fe424645d7dd3bde8bf + depends: + - python + - libstdcxx >=14 + - libgcc >=14 + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libblas >=3.9.0,<4.0a0 + - liblapack >=3.9.0,<4.0a0 + - libcblas >=3.9.0,<4.0a0 + - python_abi 3.14.* *_cp314 + constrains: + - numpy-base <0a0 + license: BSD-3-Clause + license_family: BSD + size: 8983459 + timestamp: 1763350996398 +- conda: https://conda.anaconda.org/conda-forge/linux-64/numpy-2.4.0-py314h2b28147_0.conda + sha256: 8a27bba4c9015dd116761480fa7ff193747dfc13fd6748ac69fdb162fcc223dc + md5: 1052857fc9d80253d2e47025cb2fab0a + depends: + - python + - libstdcxx >=14 + - libgcc >=14 + - __glibc >=2.17,<3.0.a0 + - libcblas >=3.9.0,<4.0a0 + - libblas >=3.9.0,<4.0a0 + - python_abi 3.14.* *_cp314 + - liblapack >=3.9.0,<4.0a0 + constrains: + - numpy-base <0a0 + license: BSD-3-Clause + license_family: BSD + size: 8917806 + timestamp: 1766373894725 +- conda: https://conda.anaconda.org/conda-forge/linux-64/numpy-2.4.2-py314h2b28147_1.conda + sha256: 1d8377c8001c15ed12c2713b723213474b435706ab9d34ede69795d64af9e94d + md5: 4ea6b620fdf24a1a0bc4f1c7134dfafb + depends: + - python + - libstdcxx >=14 + - libgcc >=14 + - __glibc >=2.17,<3.0.a0 + - libcblas >=3.9.0,<4.0a0 + - python_abi 3.14.* *_cp314 + - libblas >=3.9.0,<4.0a0 + - liblapack >=3.9.0,<4.0a0 + constrains: + - numpy-base <0a0 + license: BSD-3-Clause + license_family: BSD + size: 8926994 + timestamp: 1770098474394 +- conda: https://conda.anaconda.org/conda-forge/linux-64/numpy-2.4.3-py312h33ff503_0.conda + sha256: 1aab7ba963affa572956b1bd8d239df52a9c7bc799c560f98bc658ab70224e10 + md5: 5930ee8a175a242b4f001b1e9e72024f + depends: + - python + - libgcc >=14 + - libstdcxx >=14 + - __glibc >=2.17,<3.0.a0 + - liblapack >=3.9.0,<4.0a0 + - libblas >=3.9.0,<4.0a0 + - python_abi 3.12.* *_cp312 + - libcblas >=3.9.0,<4.0a0 + constrains: + - numpy-base <0a0 + license: BSD-3-Clause + license_family: BSD + purls: + - pkg:pypi/numpy?source=compressed-mapping + size: 8757569 + timestamp: 1773839284329 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/numpy-2.3.5-py314haac167e_0.conda + sha256: e7015a79fb2d8d0573ae1b55db71792292285a86111ccf2683872db848734db8 + md5: ea4652f80053fb52748bc10e0b401b2f + depends: + - python + - libgcc >=14 + - python 3.14.* *_cp314 + - libstdcxx >=14 + - libgcc >=14 + - python_abi 3.14.* *_cp314 + - liblapack >=3.9.0,<4.0a0 + - libcblas >=3.9.0,<4.0a0 + - libblas >=3.9.0,<4.0a0 + constrains: + - numpy-base <0a0 + license: BSD-3-Clause + license_family: BSD + size: 7815328 + timestamp: 1763351321550 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/numpy-2.4.0-py314haac167e_0.conda + sha256: ce4e1758c8c5130fc0041dc3a128963927b73d90032baf4c87d4260c2b6dae07 + md5: 52129e44a0e5a8e1b388ce5cb03e8027 + depends: + - python + - libstdcxx >=14 + - libgcc >=14 + - python 3.14.* *_cp314 + - liblapack >=3.9.0,<4.0a0 + - libcblas >=3.9.0,<4.0a0 + - libblas >=3.9.0,<4.0a0 + - python_abi 3.14.* *_cp314 + constrains: + - numpy-base <0a0 + license: BSD-3-Clause + license_family: BSD + size: 8001251 + timestamp: 1766373967611 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/numpy-2.4.2-py314haac167e_1.conda + sha256: 1e1366e700156cbddc4daae0fec34a72b74105ba45f9c144f777120552924747 + md5: 98ef547c85356475adb2197965c716b6 + depends: + - python + - python 3.14.* *_cp314 + - libstdcxx >=14 + - libgcc >=14 + - libcblas >=3.9.0,<4.0a0 + - python_abi 3.14.* *_cp314 + - libblas >=3.9.0,<4.0a0 + - liblapack >=3.9.0,<4.0a0 + constrains: + - numpy-base <0a0 + license: BSD-3-Clause + license_family: BSD + size: 8006259 + timestamp: 1770098510476 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/numpy-2.4.3-py312h6615c27_0.conda + sha256: 9e30d173e3a16714c009957aa69f2ec982b603585be6adabdedc51a213f8c308 + md5: c5b98ed4e80a53e18cd67f7cbbb2e091 + depends: + - python + - libstdcxx >=14 + - libgcc >=14 + - python 3.12.* *_cpython + - liblapack >=3.9.0,<4.0a0 + - libblas >=3.9.0,<4.0a0 + - libcblas >=3.9.0,<4.0a0 + - python_abi 3.12.* *_cp312 + constrains: + - numpy-base <0a0 + license: BSD-3-Clause + license_family: BSD + purls: + - pkg:pypi/numpy?source=compressed-mapping + size: 7841597 + timestamp: 1773839274579 +- conda: https://conda.anaconda.org/conda-forge/win-64/numpy-2.3.5-py314h06c3c77_0.conda + sha256: e64d4c049c9c69ef02d924ac1750b32e08f57732cbc6a3fe11794f3169b59d14 + md5: ddc6687a8f402695bd22229aaf69fb26 + depends: + - python + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + - ucrt >=10.0.20348.0 + - liblapack >=3.9.0,<4.0a0 + - python_abi 3.14.* *_cp314 + - libcblas >=3.9.0,<4.0a0 + - libblas >=3.9.0,<4.0a0 + constrains: + - numpy-base <0a0 + license: BSD-3-Clause + license_family: BSD + size: 7588219 + timestamp: 1763350950306 +- conda: https://conda.anaconda.org/conda-forge/win-64/numpy-2.4.0-py314h06c3c77_0.conda + sha256: 07394e53e529c52fddc80a46f16cdad12eb9df4b3b7af1a47b5b2e7d6a7b7905 + md5: 59127d48b291f13c06a53dd335876b62 + depends: + - python + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + - ucrt >=10.0.20348.0 + - python_abi 3.14.* *_cp314 + - libblas >=3.9.0,<4.0a0 + - libcblas >=3.9.0,<4.0a0 + - liblapack >=3.9.0,<4.0a0 + constrains: + - numpy-base <0a0 + license: BSD-3-Clause + license_family: BSD + size: 7301600 + timestamp: 1766373809921 +- conda: https://conda.anaconda.org/conda-forge/win-64/numpy-2.4.2-py314h06c3c77_1.conda + sha256: 34fc25b81cfa987e1825586ddb1a4ac76a246fdef343c9171109017674ad6503 + md5: 2fccd2c4e9feb4e4c2a90043015525d6 + depends: + - python + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + - ucrt >=10.0.20348.0 + - python_abi 3.14.* *_cp314 + - libcblas >=3.9.0,<4.0a0 + - liblapack >=3.9.0,<4.0a0 + - libblas >=3.9.0,<4.0a0 + constrains: + - numpy-base <0a0 + license: BSD-3-Clause + license_family: BSD + size: 7309134 + timestamp: 1770098414535 +- conda: https://conda.anaconda.org/conda-forge/win-64/numpy-2.4.3-py312ha3f287d_0.conda + sha256: f0b92b9f58406ce21c7d0f037e58cb62380daffb9232c7cb31ab5edc217527e6 + md5: 6169671e14dc7c36eebfd9870446f11c + depends: + - python + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + - ucrt >=10.0.20348.0 + - libcblas >=3.9.0,<4.0a0 + - liblapack >=3.9.0,<4.0a0 + - libblas >=3.9.0,<4.0a0 + - python_abi 3.12.* *_cp312 + constrains: + - numpy-base <0a0 + license: BSD-3-Clause + license_family: BSD + purls: + - pkg:pypi/numpy?source=compressed-mapping + size: 7166412 + timestamp: 1773839142889 +- conda: https://conda.anaconda.org/conda-forge/noarch/numpydoc-1.10.0-pyhcf101f3_0.conda + sha256: 482d94fce136c4352b18c6397b9faf0a3149bfb12499ab1ffebad8db0cb6678f + md5: 3aa4b625f20f55cf68e92df5e5bf3c39 + depends: + - python >=3.10 + - sphinx >=6 + - tomli >=1.1.0 + - python + license: BSD-3-Clause + license_family: BSD + purls: + - pkg:pypi/numpydoc?source=hash-mapping + size: 65801 + timestamp: 1764715638266 +- pypi: https://files.pythonhosted.org/packages/8c/79/017fab2f7167a9a9795665f894d04f77aafceca80821b51589bb4b23ff5c/nvidia_sphinx_theme-0.0.9.post1-py3-none-any.whl + name: nvidia-sphinx-theme + version: 0.0.9.post1 + sha256: 21ca60206dff2f380d7783d64bbaf71a5b9cacae53c7d0686f089c16b5a3d45a + requires_dist: + - sphinx>=7.1 + - pydata-sphinx-theme>=0.15 + requires_python: '>=3.10' +- conda: https://conda.anaconda.org/conda-forge/linux-64/ocl-icd-2.3.3-hb9d3cd8_0.conda + sha256: 2254dae821b286fb57c61895f2b40e3571a070910fdab79a948ff703e1ea807b + md5: 56f8947aa9d5cf37b0b3d43b83f34192 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=13 + - opencl-headers >=2024.10.24 + license: BSD-2-Clause + license_family: BSD + size: 106742 + timestamp: 1743700382939 +- conda: https://conda.anaconda.org/conda-forge/linux-64/opencl-headers-2025.06.13-h5888daf_0.conda + sha256: 2b6ce54174ec19110e1b3c37455f7cd138d0e228a75727a9bba443427da30a36 + md5: 45c3d2c224002d6d0d7769142b29f986 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=13 + - libstdcxx >=13 + license: Apache-2.0 + license_family: APACHE + size: 55357 + timestamp: 1749853464518 +- conda: https://conda.anaconda.org/conda-forge/linux-64/openh264-2.6.0-hc22cd8d_0.conda + sha256: 3f231f2747a37a58471c82a9a8a80d92b7fece9f3fce10901a5ac888ce00b747 + md5: b28cf020fd2dead0ca6d113608683842 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=13 + - libstdcxx >=13 + license: BSD-2-Clause + license_family: BSD + size: 731471 + timestamp: 1739400677213 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/openh264-2.6.0-h0564a2a_0.conda + sha256: 3b7a519e3b7d7721a0536f6cba7f1909b878c71962ee67f02242958314748341 + md5: 0abed5d78c07a64e85c54f705ba14d30 + depends: + - libgcc >=13 + - libstdcxx >=13 + license: BSD-2-Clause + license_family: BSD + size: 774512 + timestamp: 1739400731652 +- conda: https://conda.anaconda.org/conda-forge/win-64/openh264-2.6.0-hb17fa0b_0.conda + sha256: 914702d9a64325ff3afb072c8bc0f8cbea3f19955a8395a8c190e45604f83c76 + md5: ad4cac6ceb9e4c8e01802e3f15e87bb2 + depends: + - ucrt >=10.0.20348.0 + - vc >=14.2,<15 + - vc14_runtime >=14.29.30139 + license: BSD-2-Clause + license_family: BSD + size: 411269 + timestamp: 1739401120354 +- conda: https://conda.anaconda.org/conda-forge/linux-64/openssl-3.6.0-h26f9b46_0.conda + sha256: a47271202f4518a484956968335b2521409c8173e123ab381e775c358c67fe6d + md5: 9ee58d5c534af06558933af3c845a780 + depends: + - __glibc >=2.17,<3.0.a0 + - ca-certificates + - libgcc >=14 + license: Apache-2.0 + license_family: Apache + size: 3165399 + timestamp: 1762839186699 +- conda: https://conda.anaconda.org/conda-forge/linux-64/openssl-3.6.1-h35e630c_1.conda + sha256: 44c877f8af015332a5d12f5ff0fb20ca32f896526a7d0cdb30c769df1144fb5c + md5: f61eb8cd60ff9057122a3d338b99c00f + depends: + - __glibc >=2.17,<3.0.a0 + - ca-certificates + - libgcc >=14 + license: Apache-2.0 + license_family: Apache + purls: [] + size: 3164551 + timestamp: 1769555830639 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/openssl-3.6.0-h8e36d6e_0.conda + sha256: 8dd3b4c31fe176a3e51c5729b2c7f4c836a2ce3bd5c82082dc2a503ba9ee0af3 + md5: 7624c6e01aecba942e9115e0f5a2af9d + depends: + - ca-certificates + - libgcc >=14 + license: Apache-2.0 + license_family: Apache + size: 3705625 + timestamp: 1762841024958 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/openssl-3.6.1-h546c87b_1.conda + sha256: 7f8048c0e75b2620254218d72b4ae7f14136f1981c5eb555ef61645a9344505f + md5: 25f5885f11e8b1f075bccf4a2da91c60 + depends: + - ca-certificates + - libgcc >=14 + license: Apache-2.0 + license_family: Apache + purls: [] + size: 3692030 + timestamp: 1769557678657 +- conda: https://conda.anaconda.org/conda-forge/win-64/openssl-3.6.0-h725018a_0.conda + sha256: 6d72d6f766293d4f2aa60c28c244c8efed6946c430814175f959ffe8cab899b3 + md5: 84f8fb4afd1157f59098f618cd2437e4 + depends: + - ca-certificates + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: Apache-2.0 + license_family: Apache + size: 9440812 + timestamp: 1762841722179 +- conda: https://conda.anaconda.org/conda-forge/win-64/openssl-3.6.1-hf411b9b_1.conda + sha256: 53a5ad2e5553b8157a91bb8aa375f78c5958f77cb80e9d2ce59471ea8e5c0bd6 + md5: eb585509b815415bc964b2c7e11c7eb3 + depends: + - ca-certificates + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: Apache-2.0 + license_family: Apache + purls: [] + size: 9343023 + timestamp: 1769557547888 +- conda: https://conda.anaconda.org/conda-forge/noarch/packaging-25.0-pyh29332c3_1.conda + sha256: 289861ed0c13a15d7bbb408796af4de72c2fe67e2bcb0de98f4c3fce259d7991 + md5: 58335b26c38bf4a20f399384c33cbcf9 + depends: + - python >=3.8 + - python + license: Apache-2.0 + license_family: APACHE + size: 62477 + timestamp: 1745345660407 +- conda: https://conda.anaconda.org/conda-forge/noarch/packaging-26.0-pyhcf101f3_0.conda + sha256: c1fc0f953048f743385d31c468b4a678b3ad20caffdeaa94bed85ba63049fd58 + md5: b76541e68fea4d511b1ac46a28dcd2c6 + depends: + - python >=3.8 + - python + license: Apache-2.0 + license_family: APACHE + purls: + - pkg:pypi/packaging?source=compressed-mapping + size: 72010 + timestamp: 1769093650580 +- conda: https://conda.anaconda.org/conda-forge/linux-64/pango-1.56.4-hadf4263_0.conda + sha256: 3613774ad27e48503a3a6a9d72017087ea70f1426f6e5541dbdb59a3b626eaaf + md5: 79f71230c069a287efe3a8614069ddf1 + depends: + - __glibc >=2.17,<3.0.a0 + - cairo >=1.18.4,<2.0a0 + - fontconfig >=2.15.0,<3.0a0 + - fonts-conda-ecosystem + - fribidi >=1.0.10,<2.0a0 + - harfbuzz >=11.0.1 + - libexpat >=2.7.0,<3.0a0 + - libfreetype >=2.13.3 + - libfreetype6 >=2.13.3 + - libgcc >=13 + - libglib >=2.84.2,<3.0a0 + - libpng >=1.6.49,<1.7.0a0 + - libzlib >=1.3.1,<2.0a0 + license: LGPL-2.1-or-later + size: 455420 + timestamp: 1751292466873 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/pango-1.56.4-he55ef5b_0.conda + sha256: dd36cd5b6bc1c2988291a6db9fa4eb8acade9b487f6f1da4eaa65a1eebb0a12d + md5: a22cc88bf6059c9bcc158c94c9aab5b8 + depends: + - cairo >=1.18.4,<2.0a0 + - fontconfig >=2.15.0,<3.0a0 + - fonts-conda-ecosystem + - fribidi >=1.0.10,<2.0a0 + - harfbuzz >=11.0.1 + - libexpat >=2.7.0,<3.0a0 + - libfreetype >=2.13.3 + - libfreetype6 >=2.13.3 + - libgcc >=13 + - libglib >=2.84.2,<3.0a0 + - libpng >=1.6.49,<1.7.0a0 + - libzlib >=1.3.1,<2.0a0 + license: LGPL-2.1-or-later + size: 468811 + timestamp: 1751293869070 +- conda: https://conda.anaconda.org/conda-forge/win-64/pango-1.56.4-h03d888a_0.conda + sha256: dcda7e9bedc1c87f51ceef7632a5901e26081a1f74a89799a3e50dbdc801c0bd + md5: 452d6d3b409edead3bd90fc6317cd6d4 + depends: + - cairo >=1.18.4,<2.0a0 + - fontconfig >=2.15.0,<3.0a0 + - fonts-conda-ecosystem + - fribidi >=1.0.10,<2.0a0 + - harfbuzz >=11.0.1 + - libexpat >=2.7.0,<3.0a0 + - libfreetype >=2.13.3 + - libfreetype6 >=2.13.3 + - libglib >=2.84.2,<3.0a0 + - libpng >=1.6.49,<1.7.0a0 + - libzlib >=1.3.1,<2.0a0 + - ucrt >=10.0.20348.0 + - vc >=14.2,<15 + - vc14_runtime >=14.29.30139 + license: LGPL-2.1-or-later + size: 454854 + timestamp: 1751292618315 +- conda: https://conda.anaconda.org/conda-forge/noarch/parso-0.8.6-pyhcf101f3_0.conda + sha256: 42b2d77ccea60752f3aa929a6413a7835aaacdbbde679f2f5870a744fa836b94 + md5: 97c1ce2fffa1209e7afb432810ec6e12 + depends: + - python >=3.10 + - python + license: MIT + license_family: MIT + purls: + - pkg:pypi/parso?source=hash-mapping + size: 82287 + timestamp: 1770676243987 +- conda: https://conda.anaconda.org/conda-forge/linux-64/pcre2-10.47-haa7fec5_0.conda + sha256: 5e6f7d161356fefd981948bea5139c5aa0436767751a6930cb1ca801ebb113ff + md5: 7a3bff861a6583f1889021facefc08b1 + depends: + - __glibc >=2.17,<3.0.a0 + - bzip2 >=1.0.8,<2.0a0 + - libgcc >=14 + - libzlib >=1.3.1,<2.0a0 + license: BSD-3-Clause + license_family: BSD + size: 1222481 + timestamp: 1763655398280 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/pcre2-10.47-hf841c20_0.conda + sha256: 04df2cee95feba440387f33f878e9f655521e69f4be33a0cd637f07d3d81f0f9 + md5: 1a30c42e32ca0ea216bd0bfe6f842f0b + depends: + - bzip2 >=1.0.8,<2.0a0 + - libgcc >=14 + - libzlib >=1.3.1,<2.0a0 + license: BSD-3-Clause + license_family: BSD + size: 1166552 + timestamp: 1763655534263 +- conda: https://conda.anaconda.org/conda-forge/win-64/pcre2-10.47-hd2b5f0e_0.conda + sha256: 3e9e02174edf02cb4bcdd75668ad7b74b8061791a3bc8bdb8a52ae336761ba3e + md5: 77eaf2336f3ae749e712f63e36b0f0a1 + depends: + - bzip2 >=1.0.8,<2.0a0 + - libzlib >=1.3.1,<2.0a0 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: BSD-3-Clause + license_family: BSD + size: 995992 + timestamp: 1763655708300 +- conda: https://conda.anaconda.org/conda-forge/noarch/pexpect-4.9.0-pyhd8ed1ab_1.conda + sha256: 202af1de83b585d36445dc1fda94266697341994d1a3328fabde4989e1b3d07a + md5: d0d408b1f18883a944376da5cf8101ea + depends: + - ptyprocess >=0.5 + - python >=3.9 + license: ISC + purls: + - pkg:pypi/pexpect?source=hash-mapping + size: 53561 + timestamp: 1733302019362 +- conda: https://conda.anaconda.org/conda-forge/noarch/pip-26.0.1-pyh8b19718_0.conda + sha256: 8e1497814a9997654ed7990a79c054ea5a42545679407acbc6f7e809c73c9120 + md5: 67bdec43082fd8a9cffb9484420b39a2 + depends: + - python >=3.10,<3.13.0a0 + - setuptools + - wheel + license: MIT + license_family: MIT + purls: + - pkg:pypi/pip?source=compressed-mapping + size: 1181790 + timestamp: 1770270305795 +- conda: https://conda.anaconda.org/conda-forge/linux-64/pixman-0.46.4-h54a6638_1.conda + sha256: 43d37bc9ca3b257c5dd7bf76a8426addbdec381f6786ff441dc90b1a49143b6a + md5: c01af13bdc553d1a8fbfff6e8db075f0 + depends: + - libgcc >=14 + - libstdcxx >=14 + - libgcc >=14 + - __glibc >=2.17,<3.0.a0 + license: MIT + license_family: MIT + size: 450960 + timestamp: 1754665235234 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/pixman-0.46.4-h7ac5ae9_1.conda + sha256: e6b0846a998f2263629cfeac7bca73565c35af13251969f45d385db537a514e4 + md5: 1587081d537bd4ae77d1c0635d465ba5 + depends: + - libgcc >=14 + - libstdcxx >=14 + - libgcc >=14 + license: MIT + license_family: MIT + size: 357913 + timestamp: 1754665583353 +- conda: https://conda.anaconda.org/conda-forge/win-64/pixman-0.46.4-h5112557_1.conda + sha256: 246fce4706b3f8b247a7d6142ba8d732c95263d3c96e212b9d63d6a4ab4aff35 + md5: 08c8fa3b419df480d985e304f7884d35 + depends: + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + - ucrt >=10.0.20348.0 + license: MIT + license_family: MIT + size: 542795 + timestamp: 1754665193489 +- conda: https://conda.anaconda.org/conda-forge/noarch/platformdirs-4.9.4-pyhcf101f3_0.conda + sha256: 0289f0a38337ee201d984f8f31f11f6ef076cfbbfd0ab9181d12d9d1d099bf46 + md5: 82c1787f2a65c0155ef9652466ee98d6 + depends: + - python >=3.10 + - python + license: MIT + license_family: MIT + purls: + - pkg:pypi/platformdirs?source=compressed-mapping + size: 25646 + timestamp: 1773199142345 +- conda: https://conda.anaconda.org/conda-forge/noarch/pluggy-1.6.0-pyhf9edf01_1.conda + sha256: e14aafa63efa0528ca99ba568eaf506eb55a0371d12e6250aaaa61718d2eb62e + md5: d7585b6550ad04c8c5e21097ada2888e + depends: + - python >=3.9 + - python + license: MIT + license_family: MIT + purls: + - pkg:pypi/pluggy?source=hash-mapping + size: 25877 + timestamp: 1764896838868 +- conda: https://conda.anaconda.org/conda-forge/noarch/prompt-toolkit-3.0.52-pyha770c72_0.conda + sha256: 4817651a276016f3838957bfdf963386438c70761e9faec7749d411635979bae + md5: edb16f14d920fb3faf17f5ce582942d6 + depends: + - python >=3.10 + - wcwidth + constrains: + - prompt_toolkit 3.0.52 + license: BSD-3-Clause + license_family: BSD + purls: + - pkg:pypi/prompt-toolkit?source=hash-mapping + size: 273927 + timestamp: 1756321848365 +- conda: https://conda.anaconda.org/conda-forge/linux-64/psutil-7.2.2-py312h5253ce2_0.conda + sha256: d834fd656133c9e4eaf63ffe9a117c7d0917d86d89f7d64073f4e3a0020bd8a7 + md5: dd94c506b119130aef5a9382aed648e7 + depends: + - python + - libgcc >=14 + - __glibc >=2.17,<3.0.a0 + - python_abi 3.12.* *_cp312 + license: BSD-3-Clause + license_family: BSD + purls: + - pkg:pypi/psutil?source=compressed-mapping + size: 225545 + timestamp: 1769678155334 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/psutil-7.2.2-py312hd41f8a7_0.conda + sha256: ea2f332dde5f428c506816d39063705c40767a350f54c22fde89b74aac878355 + md5: 4efa924b35ea429f3ded10ddae9d5fb3 + depends: + - python + - python 3.12.* *_cpython + - libgcc >=14 + - python_abi 3.12.* *_cp312 + license: BSD-3-Clause + license_family: BSD + purls: + - pkg:pypi/psutil?source=hash-mapping + size: 230283 + timestamp: 1769678159757 +- conda: https://conda.anaconda.org/conda-forge/win-64/psutil-7.2.2-py312he5662c2_0.conda + sha256: edffc84c001a05b996b5f8607c8164432754e86ec9224e831cd00ebabdec04e7 + md5: a2724c93b745fc7861948eb8b9f6679a + depends: + - python + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + - ucrt >=10.0.20348.0 + - python_abi 3.12.* *_cp312 + license: BSD-3-Clause + license_family: BSD + purls: + - pkg:pypi/psutil?source=hash-mapping + size: 242769 + timestamp: 1769678170631 +- conda: https://conda.anaconda.org/conda-forge/linux-64/pthread-stubs-0.4-hb9d3cd8_1002.conda + sha256: 9c88f8c64590e9567c6c80823f0328e58d3b1efb0e1c539c0315ceca764e0973 + md5: b3c17d95b5a10c6e64a21fa17573e70e + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=13 + license: MIT + license_family: MIT + size: 8252 + timestamp: 1726802366959 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/pthread-stubs-0.4-h86ecc28_1002.conda + sha256: 977dfb0cb3935d748521dd80262fe7169ab82920afd38ed14b7fee2ea5ec01ba + md5: bb5a90c93e3bac3d5690acf76b4a6386 + depends: + - libgcc >=13 + license: MIT + license_family: MIT + size: 8342 + timestamp: 1726803319942 +- conda: https://conda.anaconda.org/conda-forge/noarch/ptyprocess-0.7.0-pyhd8ed1ab_1.conda + sha256: a7713dfe30faf17508ec359e0bc7e0983f5d94682492469bd462cdaae9c64d83 + md5: 7d9daffbb8d8e0af0f769dbbcd173a54 + depends: + - python >=3.9 + license: ISC + purls: + - pkg:pypi/ptyprocess?source=hash-mapping + size: 19457 + timestamp: 1733302371990 +- conda: https://conda.anaconda.org/conda-forge/linux-64/pugixml-1.15-h3f63f65_0.conda + sha256: 23c98a5000356e173568dc5c5770b53393879f946f3ace716bbdefac2a8b23d2 + md5: b11a4c6bf6f6f44e5e143f759ffa2087 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=13 + - libstdcxx >=13 + license: MIT + license_family: MIT + size: 118488 + timestamp: 1736601364156 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/pugixml-1.15-h6ef32b0_0.conda + sha256: adc17205a87e064508d809fe5542b7cf49f9b9a458418f8448e2fc895fcd04f3 + md5: 53e14f45d38558aa2b9a15b07416e472 + depends: + - libgcc >=13 + - libstdcxx >=13 + license: MIT + license_family: MIT + size: 113424 + timestamp: 1737355438448 +- conda: https://conda.anaconda.org/conda-forge/linux-64/pulseaudio-client-17.0-h9a6aba3_3.conda + sha256: 0a0858c59805d627d02bdceee965dd84fde0aceab03a2f984325eec08d822096 + md5: b8ea447fdf62e3597cb8d2fae4eb1a90 + depends: + - __glibc >=2.17,<3.0.a0 + - dbus >=1.16.2,<2.0a0 + - libgcc >=14 + - libglib >=2.86.1,<3.0a0 + - libiconv >=1.18,<2.0a0 + - libsndfile >=1.2.2,<1.3.0a0 + - libsystemd0 >=257.10 + - libxcb >=1.17.0,<2.0a0 + constrains: + - pulseaudio 17.0 *_3 + license: LGPL-2.1-or-later + license_family: LGPL + size: 750785 + timestamp: 1763148198088 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/pulseaudio-client-17.0-hcf98165_3.conda + sha256: bb55db0dfe120f6063ad3ac74524b37c0bf92c6002cc059c31a5506f96a67f22 + md5: 8d73cfc699cd0a5ed2ea04bfb73eee0a + depends: + - dbus >=1.16.2,<2.0a0 + - libgcc >=14 + - libglib >=2.86.1,<3.0a0 + - libiconv >=1.18,<2.0a0 + - libsndfile >=1.2.2,<1.3.0a0 + - libsystemd0 >=257.10 + - libxcb >=1.17.0,<2.0a0 + constrains: + - pulseaudio 17.0 *_3 + license: LGPL-2.1-or-later + license_family: LGPL + size: 760306 + timestamp: 1763148231117 +- conda: https://conda.anaconda.org/conda-forge/noarch/pure_eval-0.2.3-pyhd8ed1ab_1.conda + sha256: 71bd24600d14bb171a6321d523486f6a06f855e75e547fa0cb2a0953b02047f0 + md5: 3bfdfb8dbcdc4af1ae3f9a8eb3948f04 + depends: + - python >=3.9 + license: MIT + license_family: MIT + purls: + - pkg:pypi/pure-eval?source=hash-mapping + size: 16668 + timestamp: 1733569518868 +- conda: https://conda.anaconda.org/conda-forge/noarch/py-cpuinfo-9.0.0-pyhd8ed1ab_1.conda + sha256: 6d8f03c13d085a569fde931892cded813474acbef2e03381a1a87f420c7da035 + md5: 46830ee16925d5ed250850503b5dc3a8 + depends: + - python >=3.9 + license: MIT + license_family: MIT + size: 25766 + timestamp: 1733236452235 +- conda: https://conda.anaconda.org/conda-forge/noarch/pyclibrary-0.2.2-pyhd8ed1ab_1.conda + sha256: 210a7beee6dce5e57d4d4166b6fd93693ede3e213510efa7373103f10c18d057 + md5: 0cda5dbfd261b08292fcf16429662b0a + depends: + - pyparsing >=2.3.1,<4 + - python >=3.9 + license: MIT + license_family: MIT + purls: + - pkg:pypi/pyclibrary?source=hash-mapping + size: 437505 + timestamp: 1734953615203 +- conda: https://conda.anaconda.org/conda-forge/noarch/pydata-sphinx-theme-0.17.0-pyhcf101f3_0.conda + sha256: 03ae7063dd18f070cf28a441dd86ea476c20ff7fc174d8365a476a650a6ae20f + md5: c09bb5f9960ff1cd334c5573b5ad79c2 + depends: + - accessible-pygments + - babel + - beautifulsoup4 + - docutils !=0.17.0 + - pygments >=2.7 + - python >=3.10 + - sphinx >=7.0 + - typing_extensions + - python + license: BSD-3-Clause + license_family: BSD + purls: + - pkg:pypi/pydata-sphinx-theme?source=hash-mapping + size: 1655347 + timestamp: 1775308781489 +- conda: https://conda.anaconda.org/conda-forge/noarch/pyglet-2.1.11-pyhd8ed1ab_0.conda + sha256: 471cc2e244e5ffdd909d4c46219d59b3ba1e7fe9bd7e99c6c64382d4939f63a3 + md5: 1cf39bf57f0b038b12dffce5a4b27e14 + depends: + - ffmpeg >=4.0.0 + - freetype + - python >=3.10 + license: BSD-3-Clause + license_family: BSD + size: 724353 + timestamp: 1762495207513 +- conda: https://conda.anaconda.org/conda-forge/noarch/pyglet-2.1.13-pyhd8ed1ab_0.conda + sha256: 638d74a3a5f62f0c2deca8edb796835c1a5f14f0f1771aad63e3b3b7f65993b4 + md5: 98c2b80f5741f63f6ca5b6119c56eeaf + depends: + - ffmpeg >=4.0.0 + - freetype + - python >=3.10 + license: BSD-3-Clause + license_family: BSD + size: 725938 + timestamp: 1770169149613 +- conda: https://conda.anaconda.org/conda-forge/noarch/pygments-2.19.2-pyhd8ed1ab_0.conda + sha256: 5577623b9f6685ece2697c6eb7511b4c9ac5fb607c9babc2646c811b428fd46a + md5: 6b6ece66ebcae2d5f326c77ef2c5a066 + depends: + - python >=3.9 + license: BSD-2-Clause + license_family: BSD + size: 889287 + timestamp: 1750615908735 +- conda: https://conda.anaconda.org/conda-forge/noarch/pygments-2.20.0-pyhd8ed1ab_0.conda + sha256: cf70b2f5ad9ae472b71235e5c8a736c9316df3705746de419b59d442e8348e86 + md5: 16c18772b340887160c79a6acc022db0 + depends: + - python >=3.10 + license: BSD-2-Clause + license_family: BSD + purls: + - pkg:pypi/pygments?source=compressed-mapping + size: 893031 + timestamp: 1774796815820 +- conda: https://conda.anaconda.org/conda-forge/noarch/pyparsing-3.3.2-pyhcf101f3_0.conda + sha256: 417fba4783e528ee732afa82999300859b065dc59927344b4859c64aae7182de + md5: 3687cc0b82a8b4c17e1f0eb7e47163d5 + depends: + - python >=3.10 + - python + license: MIT + license_family: MIT + purls: + - pkg:pypi/pyparsing?source=hash-mapping + size: 110893 + timestamp: 1769003998136 +- conda: https://conda.anaconda.org/conda-forge/noarch/pysocks-1.7.1-pyh09c184e_7.conda + sha256: d016e04b0e12063fbee4a2d5fbb9b39a8d191b5a0042f0b8459188aedeabb0ca + md5: e2fd202833c4a981ce8a65974fe4abd1 + depends: + - __win + - python >=3.9 + - win_inet_pton + license: BSD-3-Clause + license_family: BSD + purls: + - pkg:pypi/pysocks?source=hash-mapping + size: 21784 + timestamp: 1733217448189 +- conda: https://conda.anaconda.org/conda-forge/noarch/pysocks-1.7.1-pyha55dd90_7.conda + sha256: ba3b032fa52709ce0d9fd388f63d330a026754587a2f461117cac9ab73d8d0d8 + md5: 461219d1a5bd61342293efa2c0c90eac + depends: + - __unix + - python >=3.9 + license: BSD-3-Clause + license_family: BSD + purls: + - pkg:pypi/pysocks?source=hash-mapping + size: 21085 + timestamp: 1733217331982 +- conda: https://conda.anaconda.org/conda-forge/noarch/pytest-9.0.2-pyhcf101f3_0.conda + sha256: 9e749fb465a8bedf0184d8b8996992a38de351f7c64e967031944978de03a520 + md5: 2b694bad8a50dc2f712f5368de866480 + depends: + - pygments >=2.7.2 + - python >=3.10 + - iniconfig >=1.0.1 + - packaging >=22 + - pluggy >=1.5,<2 + - tomli >=1 + - colorama >=0.4 + - exceptiongroup >=1 + - python + constrains: + - pytest-faulthandler >=2 + license: MIT + license_family: MIT + purls: + - pkg:pypi/pytest?source=hash-mapping + size: 299581 + timestamp: 1765062031645 +- conda: https://conda.anaconda.org/conda-forge/noarch/pytest-benchmark-5.2.3-pyhd8ed1ab_0.conda + sha256: 2f2229415a6e5387c1faaedf442ea8c07471cb2bf5ad1007b9cfb83ea85ca29a + md5: 0e7294ed4af8b833fcd2c101d647c3da + depends: + - py-cpuinfo + - pytest >=8.1 + - python >=3.10 + license: BSD-2-Clause + license_family: BSD + size: 43976 + timestamp: 1762716480208 +- conda: https://conda.anaconda.org/conda-forge/noarch/pytest-randomly-3.15.0-pyhd8ed1ab_0.conda + sha256: bd1953e4bc20ffd52cfee41b27b3a781ca6e281004d0dd59e2dd60b0192c7a86 + md5: 203b5d3f85a47940f7ec6b6e1747786e + depends: + - importlib-metadata >=3.6.0 + - pytest + - python >=3.6 + license: MIT + license_family: MIT + size: 14133 + timestamp: 1692131735622 +- conda: https://conda.anaconda.org/conda-forge/noarch/pytest-repeat-0.9.4-pyhd8ed1ab_0.conda + sha256: cea7b0555c22a734d732f98a3b256646f3d82d926a35fa2bfd16f11395abd83b + md5: 9e8871313f26d8b6f0232522b3bc47a5 + depends: + - pytest >=5 + - python >=3.9 + license: MPL-2.0 + license_family: MOZILLA + size: 10537 + timestamp: 1744061283541 +- conda: https://conda.anaconda.org/conda-forge/linux-64/python-3.12.13-hd63d673_0_cpython.conda + sha256: a44655c1c3e1d43ed8704890a91e12afd68130414ea2c0872e154e5633a13d7e + md5: 7eccb41177e15cc672e1babe9056018e + depends: + - __glibc >=2.17,<3.0.a0 + - bzip2 >=1.0.8,<2.0a0 + - ld_impl_linux-64 >=2.36.1 + - libexpat >=2.7.4,<3.0a0 + - libffi >=3.5.2,<3.6.0a0 + - libgcc >=14 + - liblzma >=5.8.2,<6.0a0 + - libnsl >=2.0.1,<2.1.0a0 + - libsqlite >=3.51.2,<4.0a0 + - libuuid >=2.41.3,<3.0a0 + - libxcrypt >=4.4.36 + - libzlib >=1.3.1,<2.0a0 + - ncurses >=6.5,<7.0a0 + - openssl >=3.5.5,<4.0a0 + - readline >=8.3,<9.0a0 + - tk >=8.6.13,<8.7.0a0 + - tzdata + constrains: + - python_abi 3.12.* *_cp312 + license: Python-2.0 + purls: [] + size: 31608571 + timestamp: 1772730708989 +- conda: https://conda.anaconda.org/conda-forge/linux-64/python-3.14.1-h32b2ec7_100_cp314.conda + build_number: 100 + sha256: 30d9c0997cec58298b4de04b44b4acc2bd16860ecbb8f6e623256c71820918ed + md5: b6e8431a0badd5f3e9426d0258b32e81 + depends: + - __glibc >=2.17,<3.0.a0 + - bzip2 >=1.0.8,<2.0a0 + - ld_impl_linux-64 >=2.36.1 + - libexpat >=2.7.3,<3.0a0 + - libffi >=3.5.2,<3.6.0a0 + - libgcc >=14 + - liblzma >=5.8.1,<6.0a0 + - libmpdec >=4.0.0,<5.0a0 + - libsqlite >=3.51.1,<4.0a0 + - libuuid >=2.41.2,<3.0a0 + - libzlib >=1.3.1,<2.0a0 + - ncurses >=6.5,<7.0a0 + - openssl >=3.5.4,<4.0a0 + - python_abi 3.14.* *_cp314 + - readline >=8.2,<9.0a0 + - tk >=8.6.13,<8.7.0a0 + - tzdata + - zstd >=1.5.7,<1.6.0a0 + license: Python-2.0 + size: 36768932 + timestamp: 1764758363259 + python_site_packages_path: lib/python3.14/site-packages +- conda: https://conda.anaconda.org/conda-forge/linux-64/python-3.14.2-h32b2ec7_100_cp314.conda + build_number: 100 + sha256: a120fb2da4e4d51dd32918c149b04a08815fd2bd52099dad1334647984bb07f1 + md5: 1cef1236a05c3a98f68c33ae9425f656 + depends: + - __glibc >=2.17,<3.0.a0 + - bzip2 >=1.0.8,<2.0a0 + - ld_impl_linux-64 >=2.36.1 + - libexpat >=2.7.3,<3.0a0 + - libffi >=3.5.2,<3.6.0a0 + - libgcc >=14 + - liblzma >=5.8.1,<6.0a0 + - libmpdec >=4.0.0,<5.0a0 + - libsqlite >=3.51.1,<4.0a0 + - libuuid >=2.41.2,<3.0a0 + - libzlib >=1.3.1,<2.0a0 + - ncurses >=6.5,<7.0a0 + - openssl >=3.5.4,<4.0a0 + - python_abi 3.14.* *_cp314 + - readline >=8.2,<9.0a0 + - tk >=8.6.13,<8.7.0a0 + - tzdata + - zstd >=1.5.7,<1.6.0a0 + license: Python-2.0 + size: 36790521 + timestamp: 1765021515427 + python_site_packages_path: lib/python3.14/site-packages +- conda: https://conda.anaconda.org/conda-forge/linux-64/python-3.14.3-h32b2ec7_101_cp314.conda + build_number: 101 + sha256: cb0628c5f1732f889f53a877484da98f5a0e0f47326622671396fb4f2b0cd6bd + md5: c014ad06e60441661737121d3eae8a60 + depends: + - __glibc >=2.17,<3.0.a0 + - bzip2 >=1.0.8,<2.0a0 + - ld_impl_linux-64 >=2.36.1 + - libexpat >=2.7.3,<3.0a0 + - libffi >=3.5.2,<3.6.0a0 + - libgcc >=14 + - liblzma >=5.8.2,<6.0a0 + - libmpdec >=4.0.0,<5.0a0 + - libsqlite >=3.51.2,<4.0a0 + - libuuid >=2.41.3,<3.0a0 + - libzlib >=1.3.1,<2.0a0 + - ncurses >=6.5,<7.0a0 + - openssl >=3.5.5,<4.0a0 + - python_abi 3.14.* *_cp314 + - readline >=8.3,<9.0a0 + - tk >=8.6.13,<8.7.0a0 + - tzdata + - zstd >=1.5.7,<1.6.0a0 + license: Python-2.0 + size: 36702440 + timestamp: 1770675584356 + python_site_packages_path: lib/python3.14/site-packages +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/python-3.12.13-h91f4b29_0_cpython.conda + sha256: 61933478813f5fd96c89a00dd964201b0266d71d2e3bc4dd5679354056e46948 + md5: 8aed8fdbbc03a5c9f455d20ce75a9dce + depends: + - bzip2 >=1.0.8,<2.0a0 + - ld_impl_linux-aarch64 >=2.36.1 + - libexpat >=2.7.4,<3.0a0 + - libffi >=3.5.2,<3.6.0a0 + - libgcc >=14 + - liblzma >=5.8.2,<6.0a0 + - libnsl >=2.0.1,<2.1.0a0 + - libsqlite >=3.51.2,<4.0a0 + - libuuid >=2.41.3,<3.0a0 + - libxcrypt >=4.4.36 + - libzlib >=1.3.1,<2.0a0 + - ncurses >=6.5,<7.0a0 + - openssl >=3.5.5,<4.0a0 + - readline >=8.3,<9.0a0 + - tk >=8.6.13,<8.7.0a0 + - tzdata + constrains: + - python_abi 3.12.* *_cp312 + license: Python-2.0 + purls: [] + size: 13757191 + timestamp: 1772728951853 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/python-3.14.1-hb06a95a_100_cp314.conda + build_number: 100 + sha256: 482bc557d2a5b13a854a2fb8abdcfcef527640720fabdccb9421fa109e4cb4b8 + md5: 440084d3af1aab4e196a4198988d3c24 + depends: + - bzip2 >=1.0.8,<2.0a0 + - ld_impl_linux-aarch64 >=2.36.1 + - libexpat >=2.7.3,<3.0a0 + - libffi >=3.5.2,<3.6.0a0 + - libgcc >=14 + - liblzma >=5.8.1,<6.0a0 + - libmpdec >=4.0.0,<5.0a0 + - libsqlite >=3.51.1,<4.0a0 + - libuuid >=2.41.2,<3.0a0 + - libzlib >=1.3.1,<2.0a0 + - ncurses >=6.5,<7.0a0 + - openssl >=3.5.4,<4.0a0 + - python_abi 3.14.* *_cp314 + - readline >=8.2,<9.0a0 + - tk >=8.6.13,<8.7.0a0 + - tzdata + - zstd >=1.5.7,<1.6.0a0 + license: Python-2.0 + size: 37149339 + timestamp: 1764757159033 + python_site_packages_path: lib/python3.14/site-packages +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/python-3.14.2-hb06a95a_100_cp314.conda + build_number: 100 + sha256: 41adf6ee7a953ef4f35551a4a910a196b0a75e1ded458df5e73ef321863cb3f2 + md5: 432459e6961a5bc4cfe7cd080aee721a + depends: + - bzip2 >=1.0.8,<2.0a0 + - ld_impl_linux-aarch64 >=2.36.1 + - libexpat >=2.7.3,<3.0a0 + - libffi >=3.5.2,<3.6.0a0 + - libgcc >=14 + - liblzma >=5.8.1,<6.0a0 + - libmpdec >=4.0.0,<5.0a0 + - libsqlite >=3.51.1,<4.0a0 + - libuuid >=2.41.2,<3.0a0 + - libzlib >=1.3.1,<2.0a0 + - ncurses >=6.5,<7.0a0 + - openssl >=3.5.4,<4.0a0 + - python_abi 3.14.* *_cp314 + - readline >=8.2,<9.0a0 + - tk >=8.6.13,<8.7.0a0 + - tzdata + - zstd >=1.5.7,<1.6.0a0 + license: Python-2.0 + size: 37217543 + timestamp: 1765020325291 + python_site_packages_path: lib/python3.14/site-packages +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/python-3.14.3-hb06a95a_101_cp314.conda + build_number: 101 + sha256: 87e9dff5646aba87cecfbc08789634c855871a7325169299d749040b0923a356 + md5: 205011b36899ff0edf41b3db0eda5a44 + depends: + - bzip2 >=1.0.8,<2.0a0 + - ld_impl_linux-aarch64 >=2.36.1 + - libexpat >=2.7.3,<3.0a0 + - libffi >=3.5.2,<3.6.0a0 + - libgcc >=14 + - liblzma >=5.8.2,<6.0a0 + - libmpdec >=4.0.0,<5.0a0 + - libsqlite >=3.51.2,<4.0a0 + - libuuid >=2.41.3,<3.0a0 + - libzlib >=1.3.1,<2.0a0 + - ncurses >=6.5,<7.0a0 + - openssl >=3.5.5,<4.0a0 + - python_abi 3.14.* *_cp314 + - readline >=8.3,<9.0a0 + - tk >=8.6.13,<8.7.0a0 + - tzdata + - zstd >=1.5.7,<1.6.0a0 + license: Python-2.0 + size: 37305578 + timestamp: 1770674395875 + python_site_packages_path: lib/python3.14/site-packages +- conda: https://conda.anaconda.org/conda-forge/win-64/python-3.12.13-h0159041_0_cpython.conda + sha256: a02b446d8b7b167b61733a3de3be5de1342250403e72a63b18dac89e99e6180e + md5: 2956dff38eb9f8332ad4caeba941cfe7 + depends: + - bzip2 >=1.0.8,<2.0a0 + - libexpat >=2.7.4,<3.0a0 + - libffi >=3.5.2,<3.6.0a0 + - liblzma >=5.8.2,<6.0a0 + - libsqlite >=3.51.2,<4.0a0 + - libzlib >=1.3.1,<2.0a0 + - openssl >=3.5.5,<4.0a0 + - tk >=8.6.13,<8.7.0a0 + - tzdata + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + constrains: + - python_abi 3.12.* *_cp312 + license: Python-2.0 + purls: [] + size: 15840187 + timestamp: 1772728877265 +- conda: https://conda.anaconda.org/conda-forge/win-64/python-3.14.1-h4b44e0e_100_cp314.conda + build_number: 100 + sha256: 21feeb6ee92abd17bf73e063dbcfe0b00ccb5e67f291379dee7183294413a01f + md5: 3d23736b5ad17ea24fcd4d6f23663f0d + depends: + - bzip2 >=1.0.8,<2.0a0 + - libexpat >=2.7.3,<3.0a0 + - libffi >=3.5.2,<3.6.0a0 + - liblzma >=5.8.1,<6.0a0 + - libmpdec >=4.0.0,<5.0a0 + - libsqlite >=3.51.1,<4.0a0 + - libzlib >=1.3.1,<2.0a0 + - openssl >=3.5.4,<4.0a0 + - python_abi 3.14.* *_cp314 + - tk >=8.6.13,<8.7.0a0 + - tzdata + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + - zstd >=1.5.7,<1.6.0a0 + license: Python-2.0 + size: 16934169 + timestamp: 1764756783162 + python_site_packages_path: Lib/site-packages +- conda: https://conda.anaconda.org/conda-forge/win-64/python-3.14.2-h4b44e0e_100_cp314.conda + build_number: 100 + sha256: 6857d7c97cc71fe9ba298dcb1d3b66cc7df425132ab801babd655faa3df48f32 + md5: c3c73414d5ae3f543c531c978d9cc8b8 + depends: + - bzip2 >=1.0.8,<2.0a0 + - libexpat >=2.7.3,<3.0a0 + - libffi >=3.5.2,<3.6.0a0 + - liblzma >=5.8.1,<6.0a0 + - libmpdec >=4.0.0,<5.0a0 + - libsqlite >=3.51.1,<4.0a0 + - libzlib >=1.3.1,<2.0a0 + - openssl >=3.5.4,<4.0a0 + - python_abi 3.14.* *_cp314 + - tk >=8.6.13,<8.7.0a0 + - tzdata + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + - zstd >=1.5.7,<1.6.0a0 + license: Python-2.0 + size: 16833248 + timestamp: 1765020224759 + python_site_packages_path: Lib/site-packages +- conda: https://conda.anaconda.org/conda-forge/win-64/python-3.14.3-h4b44e0e_101_cp314.conda + build_number: 101 + sha256: 3f99d83bfd95b9bdae64a42a1e4bf5131dc20b724be5ac8a9a7e1ac2c0f006d7 + md5: 7ec2be7eaf59f83f3e5617665f3fbb2e + depends: + - bzip2 >=1.0.8,<2.0a0 + - libexpat >=2.7.3,<3.0a0 + - libffi >=3.5.2,<3.6.0a0 + - liblzma >=5.8.2,<6.0a0 + - libmpdec >=4.0.0,<5.0a0 + - libsqlite >=3.51.2,<4.0a0 + - libzlib >=1.3.1,<2.0a0 + - openssl >=3.5.5,<4.0a0 + - python_abi 3.14.* *_cp314 + - tk >=8.6.13,<8.7.0a0 + - tzdata + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + - zstd >=1.5.7,<1.6.0a0 + license: Python-2.0 + size: 18273230 + timestamp: 1770675442998 + python_site_packages_path: Lib/site-packages +- conda: https://conda.anaconda.org/conda-forge/noarch/python-dateutil-2.9.0.post0-pyhe01879c_2.conda + sha256: d6a17ece93bbd5139e02d2bd7dbfa80bee1a4261dced63f65f679121686bf664 + md5: 5b8d21249ff20967101ffa321cab24e8 + depends: + - python >=3.9 + - six >=1.5 + - python + license: Apache-2.0 + license_family: APACHE + purls: + - pkg:pypi/python-dateutil?source=hash-mapping + size: 233310 + timestamp: 1751104122689 +- conda: https://conda.anaconda.org/conda-forge/noarch/python-fastjsonschema-2.21.2-pyhe01879c_0.conda + sha256: df9aa74e9e28e8d1309274648aac08ec447a92512c33f61a8de0afa9ce32ebe8 + md5: 23029aae904a2ba587daba708208012f + depends: + - python >=3.9 + - python + license: BSD-3-Clause + license_family: BSD + purls: + - pkg:pypi/fastjsonschema?source=hash-mapping + size: 244628 + timestamp: 1755304154927 +- conda: https://conda.anaconda.org/conda-forge/noarch/python-gil-3.12.13-hd8ed1ab_0.conda + sha256: 97327b9509ae3aae28d27217a5d7bd31aff0ab61a02041e9c6f98c11d8a53b29 + md5: 32780d6794b8056b78602103a04e90ef + depends: + - cpython 3.12.13.* + - python_abi * *_cp312 + license: Python-2.0 + purls: [] + size: 46449 + timestamp: 1772728979370 +- conda: https://conda.anaconda.org/conda-forge/noarch/python_abi-3.12-8_cp312.conda + build_number: 8 + sha256: 80677180dd3c22deb7426ca89d6203f1c7f1f256f2d5a94dc210f6e758229809 + md5: c3efd25ac4d74b1584d2f7a57195ddf1 + constrains: + - python 3.12.* *_cpython + license: BSD-3-Clause + license_family: BSD + purls: [] + size: 6958 + timestamp: 1752805918820 +- conda: https://conda.anaconda.org/conda-forge/noarch/python_abi-3.14-8_cp314.conda + build_number: 8 + sha256: ad6d2e9ac39751cc0529dd1566a26751a0bf2542adb0c232533d32e176e21db5 + md5: 0539938c55b6b1a59b560e843ad864a4 + constrains: + - python 3.14.* *_cp314 + license: BSD-3-Clause + license_family: BSD + size: 6989 + timestamp: 1752805904792 +- conda: https://conda.anaconda.org/conda-forge/win-64/pywin32-311-py312h829343e_1.conda + sha256: a7505522048dad63940d06623f07eb357b9b65510a8d23ff32b99add05aac3a1 + md5: 64cbe4ecbebe185a2261d3f298a60cde + depends: + - python + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + - ucrt >=10.0.20348.0 + - python_abi 3.12.* *_cp312 + license: PSF-2.0 + license_family: PSF + purls: + - pkg:pypi/pywin32?source=hash-mapping + size: 6684490 + timestamp: 1756487136116 +- conda: https://conda.anaconda.org/conda-forge/linux-64/pyyaml-6.0.3-py312h8a5da7c_1.conda + sha256: cb142bfd92f6e55749365ddc244294fa7b64db6d08c45b018ff1c658907bfcbf + md5: 15878599a87992e44c059731771591cb + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - python >=3.12,<3.13.0a0 + - python_abi 3.12.* *_cp312 + - yaml >=0.2.5,<0.3.0a0 + license: MIT + license_family: MIT + purls: + - pkg:pypi/pyyaml?source=hash-mapping + size: 198293 + timestamp: 1770223620706 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/pyyaml-6.0.3-py312ha4530ae_1.conda + sha256: 0ba02720b470150a8c6261a86ea4db01dcf121e16a3e3978a84e965d3fe9c39a + md5: 47018c13dbb26186b577fd8bd1823a44 + depends: + - libgcc >=14 + - python >=3.12,<3.13.0a0 + - python >=3.12,<3.13.0a0 *_cpython + - python_abi 3.12.* *_cp312 + - yaml >=0.2.5,<0.3.0a0 + license: MIT + license_family: MIT + purls: + - pkg:pypi/pyyaml?source=hash-mapping + size: 192182 + timestamp: 1770223431156 +- conda: https://conda.anaconda.org/conda-forge/win-64/pyyaml-6.0.3-py312h05f76fc_1.conda + sha256: 1cab6cbd6042b2a1d8ee4d6b4ec7f36637a41f57d2f5c5cf0c12b7c4ce6a62f6 + md5: 9f6ebef672522cb9d9a6257215ca5743 + depends: + - python >=3.12,<3.13.0a0 + - python_abi 3.12.* *_cp312 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + - yaml >=0.2.5,<0.3.0a0 + license: MIT + license_family: MIT + purls: + - pkg:pypi/pyyaml?source=hash-mapping + size: 179738 + timestamp: 1770223468771 +- conda: https://conda.anaconda.org/conda-forge/linux-64/pyzmq-27.1.0-py312hda471dd_2.conda + noarch: python + sha256: be66c1f85c3b48137200d62c12d918f4f8ad329423daef04fed292818efd3c28 + md5: 082985717303dab433c976986c674b35 + depends: + - python + - libgcc >=14 + - libstdcxx >=14 + - __glibc >=2.17,<3.0.a0 + - zeromq >=4.3.5,<4.4.0a0 + - _python_abi3_support 1.* + - cpython >=3.12 + license: BSD-3-Clause + license_family: BSD + purls: + - pkg:pypi/pyzmq?source=hash-mapping + size: 211567 + timestamp: 1771716961404 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/pyzmq-27.1.0-py312hdf0a211_2.conda + noarch: python + sha256: afdff66cb54e22d0d2c682731e08bb8f319dfd93f3cdcff4a4640cb5a8ae2460 + md5: 130d781798bb24a0b86290e65acd50d8 + depends: + - python + - libstdcxx >=14 + - libgcc >=14 + - zeromq >=4.3.5,<4.4.0a0 + - _python_abi3_support 1.* + - cpython >=3.12 + license: BSD-3-Clause + license_family: BSD + purls: + - pkg:pypi/pyzmq?source=hash-mapping + size: 212585 + timestamp: 1771716963309 +- conda: https://conda.anaconda.org/conda-forge/win-64/pyzmq-27.1.0-py312h343a6d4_2.conda + noarch: python + sha256: d84bcc19a945ca03d1fd794be3e9896ab6afc9f691d58d9c2da514abe584d4df + md5: eb1ec67a70b4d479f7dd76e6c8fe7575 + depends: + - python + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + - ucrt >=10.0.20348.0 + - zeromq >=4.3.5,<4.3.6.0a0 + - _python_abi3_support 1.* + - cpython >=3.12 + license: BSD-3-Clause + license_family: BSD + purls: + - pkg:pypi/pyzmq?source=hash-mapping + size: 183235 + timestamp: 1771716967192 +- conda: https://conda.anaconda.org/conda-forge/linux-64/rdma-core-61.0-h192683f_0.conda + sha256: 8e0b7962cf8bec9a016cd91a6c6dc1f9ebc8e7e316b1d572f7b9047d0de54717 + md5: d487d93d170e332ab39803e05912a762 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libnl >=3.11.0,<4.0a0 + - libstdcxx >=14 + - libsystemd0 >=257.10 + - libudev1 >=257.10 + license: Linux-OpenIB + license_family: BSD + purls: [] + size: 1268666 + timestamp: 1769154883613 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/rdma-core-61.0-h1f0f388_0.conda + sha256: 1c69fab2e833080d48f24d5ac06ea6745c470a8ef779d526bd1edd846184da7e + md5: 58f1eb9b507e3e098091840c6f1f9c11 + depends: + - libgcc >=14 + - libnl >=3.11.0,<4.0a0 + - libstdcxx >=14 + - libsystemd0 >=257.10 + - libudev1 >=257.10 + license: Linux-OpenIB + license_family: BSD + purls: [] + size: 1341616 + timestamp: 1769154919140 +- conda: https://conda.anaconda.org/conda-forge/linux-64/readline-8.2-h8c095d6_2.conda + sha256: 2d6d0c026902561ed77cd646b5021aef2d4db22e57a5b0178dfc669231e06d2c + md5: 283b96675859b20a825f8fa30f311446 + depends: + - libgcc >=13 + - ncurses >=6.5,<7.0a0 + license: GPL-3.0-only + license_family: GPL + size: 282480 + timestamp: 1740379431762 +- conda: https://conda.anaconda.org/conda-forge/linux-64/readline-8.3-h853b02a_0.conda + sha256: 12ffde5a6f958e285aa22c191ca01bbd3d6e710aa852e00618fa6ddc59149002 + md5: d7d95fc8287ea7bf33e0e7116d2b95ec + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - ncurses >=6.5,<7.0a0 + license: GPL-3.0-only + license_family: GPL + purls: [] + size: 345073 + timestamp: 1765813471974 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/readline-8.2-h8382b9d_2.conda + sha256: 54bed3a3041befaa9f5acde4a37b1a02f44705b7796689574bcf9d7beaad2959 + md5: c0f08fc2737967edde1a272d4bf41ed9 + depends: + - libgcc >=13 + - ncurses >=6.5,<7.0a0 + license: GPL-3.0-only + license_family: GPL + size: 291806 + timestamp: 1740380591358 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/readline-8.3-hb682ff5_0.conda + sha256: fe695f9d215e9a2e3dd0ca7f56435ab4df24f5504b83865e3d295df36e88d216 + md5: 3d49cad61f829f4f0e0611547a9cda12 + depends: + - libgcc >=14 + - ncurses >=6.5,<7.0a0 + license: GPL-3.0-only + license_family: GPL + purls: [] + size: 357597 + timestamp: 1765815673644 +- conda: https://conda.anaconda.org/conda-forge/noarch/referencing-0.37.0-pyhcf101f3_0.conda + sha256: 0577eedfb347ff94d0f2fa6c052c502989b028216996b45c7f21236f25864414 + md5: 870293df500ca7e18bedefa5838a22ab + depends: + - attrs >=22.2.0 + - python >=3.10 + - rpds-py >=0.7.0 + - typing_extensions >=4.4.0 + - python + license: MIT + license_family: MIT + purls: + - pkg:pypi/referencing?source=hash-mapping + size: 51788 + timestamp: 1760379115194 +- conda: https://conda.anaconda.org/conda-forge/noarch/requests-2.33.1-pyhcf101f3_0.conda + sha256: c0249bc4bf4c0e8e06d0e7b4d117a5d593cc4ab2144d5006d6d47c83cb0af18e + md5: 10afbb4dbf06ff959ad25a92ccee6e59 + depends: + - python >=3.10 + - certifi >=2023.5.7 + - charset-normalizer >=2,<4 + - idna >=2.5,<4 + - urllib3 >=1.26,<3 + - python + constrains: + - chardet >=3.0.2,<6 + license: Apache-2.0 + license_family: APACHE + purls: + - pkg:pypi/requests?source=compressed-mapping + size: 63712 + timestamp: 1774894783063 +- conda: https://conda.anaconda.org/conda-forge/linux-64/rpds-py-0.30.0-py312h868fb18_0.conda + sha256: 62f46e85caaba30b459da7dfcf3e5488ca24fd11675c33ce4367163ab191a42c + md5: 3ffc5a3572db8751c2f15bacf6a0e937 + depends: + - python + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - python_abi 3.12.* *_cp312 + constrains: + - __glibc >=2.17 + license: MIT + license_family: MIT + purls: + - pkg:pypi/rpds-py?source=hash-mapping + size: 383750 + timestamp: 1764543174231 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/rpds-py-0.30.0-py312h75d7d99_0.conda + sha256: 51e7d33b71b30ac5ceab09cc35521eccdaf4e3897ca4c6eda1059fb82a91b285 + md5: 85212b0e327723285cc36efddd25e03d + depends: + - python + - libgcc >=14 + - python_abi 3.12.* *_cp312 + constrains: + - __glibc >=2.17 + license: MIT + license_family: MIT + purls: + - pkg:pypi/rpds-py?source=hash-mapping + size: 380599 + timestamp: 1764543504405 +- conda: https://conda.anaconda.org/conda-forge/win-64/rpds-py-0.30.0-py312hdabe01f_0.conda + sha256: faad05e6df2fc15e3ae06fdd71a36e17ff25364777aa4c40f2ec588740d64091 + md5: 2c51baeda0a355b0a5e7b6acb28cf02d + depends: + - python + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + - ucrt >=10.0.20348.0 + - python_abi 3.12.* *_cp312 + license: MIT + license_family: MIT + purls: + - pkg:pypi/rpds-py?source=hash-mapping + size: 243577 + timestamp: 1764543069837 +- conda: https://conda.anaconda.org/conda-forge/noarch/ruamel.yaml-0.19.1-pyhcf101f3_0.conda + sha256: b48bebe297a63ae60f52e50be328262e880702db4d9b4e86731473ada459c2a1 + md5: 06ad944772941d5dae1e0d09848d8e49 + depends: + - python >=3.10 + - ruamel.yaml.clib >=0.2.15 + - python + license: MIT + license_family: MIT + purls: + - pkg:pypi/ruamel-yaml?source=hash-mapping + size: 98448 + timestamp: 1767538149184 +- conda: https://conda.anaconda.org/conda-forge/linux-64/ruamel.yaml.clib-0.2.15-py312h5253ce2_1.conda + sha256: dc520329bdfd356e2f464393f8ad9b8450fd5a269699907b2b8d629300c2c068 + md5: 84aa470567e2211a2f8e5c8491cdd78c + depends: + - python + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - python_abi 3.12.* *_cp312 + license: MIT + license_family: MIT + purls: + - pkg:pypi/ruamel-yaml-clib?source=hash-mapping + size: 148221 + timestamp: 1766159515069 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/ruamel.yaml.clib-0.2.15-py312hd41f8a7_1.conda + sha256: 0183f9c738abe70a9e292342877932eefc6a60dcfad7c58d6b0df77236052e17 + md5: 1c284baa9b7c47ccca48d776c7c93893 + depends: + - python + - libgcc >=14 + - python 3.12.* *_cpython + - python_abi 3.12.* *_cp312 + license: MIT + license_family: MIT + purls: + - pkg:pypi/ruamel-yaml-clib?source=hash-mapping + size: 147242 + timestamp: 1766159546485 +- conda: https://conda.anaconda.org/conda-forge/win-64/ruamel.yaml.clib-0.2.15-py312he5662c2_1.conda + sha256: a28bd33ef3380c44632d6ead75a6ec170e135f18941f4b1d77f1cc1b24c1dc02 + md5: cc0977464335ea5c2e5ee3d00458e0c2 + depends: + - python + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + - ucrt >=10.0.20348.0 + - python_abi 3.12.* *_cp312 + license: MIT + license_family: MIT + purls: + - pkg:pypi/ruamel-yaml-clib?source=hash-mapping + size: 105961 + timestamp: 1766159551536 +- conda: https://conda.anaconda.org/conda-forge/linux-64/scipy-1.17.1-py312h54fa4ab_0.conda + sha256: e3ad577361d67f6c078a6a7a3898bf0617b937d44dc4ccd57aa3336f2b5778dd + md5: 3e38daeb1fb05a95656ff5af089d2e4c + depends: + - __glibc >=2.17,<3.0.a0 + - libblas >=3.9.0,<4.0a0 + - libcblas >=3.9.0,<4.0a0 + - libgcc >=14 + - libgfortran + - libgfortran5 >=14.3.0 + - liblapack >=3.9.0,<4.0a0 + - libstdcxx >=14 + - numpy <2.7 + - numpy >=1.23,<3 + - numpy >=1.25.2 + - python >=3.12,<3.13.0a0 + - python_abi 3.12.* *_cp312 + license: BSD-3-Clause + license_family: BSD + purls: + - pkg:pypi/scipy?source=compressed-mapping + size: 17109648 + timestamp: 1771880675810 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/scipy-1.17.1-py312he5b0e10_0.conda + sha256: 24e608c0c94865f40df5201175b921068a297663bcc56e538970003ddf964b59 + md5: bc10849473fe9b8c95f1a07a396baf26 + depends: + - libblas >=3.9.0,<4.0a0 + - libcblas >=3.9.0,<4.0a0 + - libgcc >=14 + - libgfortran + - libgfortran5 >=14.3.0 + - liblapack >=3.9.0,<4.0a0 + - libstdcxx >=14 + - numpy <2.7 + - numpy >=1.23,<3 + - numpy >=1.25.2 + - python >=3.12,<3.13.0a0 + - python >=3.12,<3.13.0a0 *_cpython + - python_abi 3.12.* *_cp312 + license: BSD-3-Clause + license_family: BSD + purls: + - pkg:pypi/scipy?source=hash-mapping + size: 16675045 + timestamp: 1771881005471 +- conda: https://conda.anaconda.org/conda-forge/win-64/scipy-1.17.1-py312h9b3c559_0.conda + sha256: bdb2437aa5db3a00c5e69808f9d1a695bbe74b4758ffdf2e79777c8e11680443 + md5: bf4d70d225c530053128bae8d2531516 + depends: + - libblas >=3.9.0,<4.0a0 + - libcblas >=3.9.0,<4.0a0 + - liblapack >=3.9.0,<4.0a0 + - numpy <2.7 + - numpy >=1.23,<3 + - numpy >=1.25.2 + - python >=3.12,<3.13.0a0 + - python_abi 3.12.* *_cp312 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: BSD-3-Clause + license_family: BSD + purls: + - pkg:pypi/scipy?source=hash-mapping + size: 15009886 + timestamp: 1771881635432 +- conda: https://conda.anaconda.org/conda-forge/linux-64/sdl2-2.32.56-h54a6638_0.conda + sha256: 987ad072939fdd51c92ea8d3544b286bb240aefda329f9b03a51d9b7e777f9de + md5: cdd138897d94dc07d99afe7113a07bec + depends: + - libstdcxx >=14 + - libgcc >=14 + - __glibc >=2.17,<3.0.a0 + - libgl >=1.7.0,<2.0a0 + - sdl3 >=3.2.22,<4.0a0 + - libegl >=1.7.0,<2.0a0 + license: Zlib + size: 589145 + timestamp: 1757842881 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/sdl2-2.32.56-h7ac5ae9_0.conda + sha256: 47f4ef4cd2313906840f146b18fee95c2a3a4fa9bd0afdb2d519e6c0aa8ca2ed + md5: 54747a3f3c468c5f446c78974c8c1234 + depends: + - libstdcxx >=14 + - libgcc >=14 + - sdl3 >=3.2.22,<4.0a0 + - libgl >=1.7.0,<2.0a0 + - libegl >=1.7.0,<2.0a0 + license: Zlib + size: 597756 + timestamp: 1757842928996 +- conda: https://conda.anaconda.org/conda-forge/win-64/sdl2-2.32.56-h5112557_0.conda + sha256: d17da21386bdbf32bce5daba5142916feb95eed63ef92b285808c765705bbfd2 + md5: 4cffbfebb6614a1bff3fc666527c25c7 + depends: + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + - ucrt >=10.0.20348.0 + - sdl3 >=3.2.22,<4.0a0 + license: Zlib + size: 572101 + timestamp: 1757842925694 +- conda: https://conda.anaconda.org/conda-forge/linux-64/sdl3-3.2.28-h3b84278_0.conda + sha256: 654c8a0b37f4b235cdabdd8f9ac201a73daffcda1280e0f23b53d6f9accff34b + md5: 19960bb44796feb66363ad9597242237 + depends: + - __glibc >=2.17,<3.0.a0 + - libstdcxx >=14 + - libgcc >=14 + - dbus >=1.16.2,<2.0a0 + - libgl >=1.7.0,<2.0a0 + - xorg-libxcursor >=1.2.3,<2.0a0 + - pulseaudio-client >=17.0,<17.1.0a0 + - xorg-libx11 >=1.8.12,<2.0a0 + - xorg-libxscrnsaver >=1.2.4,<2.0a0 + - xorg-libxfixes >=6.0.2,<7.0a0 + - wayland >=1.24.0,<2.0a0 + - libvulkan-loader >=1.4.328.1,<2.0a0 + - libdrm >=2.4.125,<2.5.0a0 + - liburing >=2.12,<2.13.0a0 + - libudev1 >=257.10 + - libunwind >=1.8.3,<1.9.0a0 + - libusb >=1.0.29,<2.0a0 + - xorg-libxext >=1.3.6,<2.0a0 + - libxkbcommon >=1.13.0,<2.0a0 + - libegl >=1.7.0,<2.0a0 + license: Zlib + size: 1939082 + timestamp: 1764713273386 +- conda: https://conda.anaconda.org/conda-forge/linux-64/sdl3-3.2.30-h3b84278_0.conda + sha256: baff0dc170b83d2633093e25878d51db65a5d68200f1242db894fcd64e73a9f6 + md5: e275a47f63cca221ba9da6441c976ae2 + depends: + - libgcc >=14 + - libstdcxx >=14 + - __glibc >=2.17,<3.0.a0 + - libudev1 >=257.10 + - xorg-libxext >=1.3.6,<2.0a0 + - libxkbcommon >=1.13.1,<2.0a0 + - wayland >=1.24.0,<2.0a0 + - libegl >=1.7.0,<2.0a0 + - dbus >=1.16.2,<2.0a0 + - xorg-libxfixes >=6.0.2,<7.0a0 + - libunwind >=1.8.3,<1.9.0a0 + - libvulkan-loader >=1.4.328.1,<2.0a0 + - xorg-libxcursor >=1.2.3,<2.0a0 + - libdrm >=2.4.125,<2.5.0a0 + - pulseaudio-client >=17.0,<17.1.0a0 + - xorg-libxscrnsaver >=1.2.4,<2.0a0 + - liburing >=2.13,<2.14.0a0 + - xorg-libx11 >=1.8.12,<2.0a0 + - libgl >=1.7.0,<2.0a0 + - libusb >=1.0.29,<2.0a0 + license: Zlib + size: 1938719 + timestamp: 1767236277588 +- conda: https://conda.anaconda.org/conda-forge/linux-64/sdl3-3.4.2-hdeec2a5_0.conda + sha256: 64b982664550e01c25f8f09333c0ee54d4764a80fe8636b8aaf881fe6e8a0dbe + md5: 88a69db027a8ff59dab972a09d69a1ab + depends: + - __glibc >=2.17,<3.0.a0 + - libstdcxx >=14 + - libgcc >=14 + - xorg-libxscrnsaver >=1.2.4,<2.0a0 + - libdrm >=2.4.125,<2.5.0a0 + - xorg-libxfixes >=6.0.2,<7.0a0 + - libudev1 >=257.10 + - pulseaudio-client >=17.0,<17.1.0a0 + - xorg-libxtst >=1.2.5,<2.0a0 + - libegl >=1.7.0,<2.0a0 + - libvulkan-loader >=1.4.341.0,<2.0a0 + - xorg-libxcursor >=1.2.3,<2.0a0 + - xorg-libx11 >=1.8.13,<2.0a0 + - liburing >=2.14,<2.15.0a0 + - libxkbcommon >=1.13.1,<2.0a0 + - libunwind >=1.8.3,<1.9.0a0 + - libusb >=1.0.29,<2.0a0 + - dbus >=1.16.2,<2.0a0 + - xorg-libxext >=1.3.7,<2.0a0 + - libgl >=1.7.0,<2.0a0 + - xorg-libxi >=1.8.2,<2.0a0 + - wayland >=1.24.0,<2.0a0 + license: Zlib + size: 2138749 + timestamp: 1771668185803 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/sdl3-3.2.28-h3d544e7_0.conda + sha256: 0074820265c6210833bad8d1961f78286e0d614eb0965d70f91094209ad3e8ad + md5: 2ceab22e66c471475aa8f04af986d55a + depends: + - libstdcxx >=14 + - libgcc >=14 + - libxkbcommon >=1.13.0,<2.0a0 + - libegl >=1.7.0,<2.0a0 + - libudev1 >=257.10 + - xorg-libx11 >=1.8.12,<2.0a0 + - xorg-libxfixes >=6.0.2,<7.0a0 + - dbus >=1.16.2,<2.0a0 + - xorg-libxcursor >=1.2.3,<2.0a0 + - libdrm >=2.4.125,<2.5.0a0 + - libgl >=1.7.0,<2.0a0 + - xorg-libxext >=1.3.6,<2.0a0 + - libvulkan-loader >=1.4.328.1,<2.0a0 + - libusb >=1.0.29,<2.0a0 + - wayland >=1.24.0,<2.0a0 + - liburing >=2.12,<2.13.0a0 + - libunwind >=1.8.3,<1.9.0a0 + - pulseaudio-client >=17.0,<17.1.0a0 + license: Zlib + size: 1929093 + timestamp: 1764713313724 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/sdl3-3.2.30-h3d544e7_0.conda + sha256: 64011fb1b88a16bb36bc520acdcf408a8c94a3a6ebf1b3efed16a8f173027e92 + md5: a9dec18b073d69a966793c1b8e39127c + depends: + - libstdcxx >=14 + - libgcc >=14 + - libvulkan-loader >=1.4.328.1,<2.0a0 + - xorg-libxcursor >=1.2.3,<2.0a0 + - libxkbcommon >=1.13.1,<2.0a0 + - libusb >=1.0.29,<2.0a0 + - libegl >=1.7.0,<2.0a0 + - xorg-libxext >=1.3.6,<2.0a0 + - xorg-libxfixes >=6.0.2,<7.0a0 + - libunwind >=1.8.3,<1.9.0a0 + - pulseaudio-client >=17.0,<17.1.0a0 + - libdrm >=2.4.125,<2.5.0a0 + - wayland >=1.24.0,<2.0a0 + - dbus >=1.16.2,<2.0a0 + - liburing >=2.13,<2.14.0a0 + - libudev1 >=257.10 + - libgl >=1.7.0,<2.0a0 + - xorg-libx11 >=1.8.12,<2.0a0 + license: Zlib + size: 1928569 + timestamp: 1767236340915 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/sdl3-3.4.2-had2c13b_0.conda + sha256: 17aad2e3439d6d778bf995134f37e442a8420adc740457f43d647d4dbf0b10fe + md5: c667298eebd2296ace8cb07dbbba95c0 + depends: + - libgcc >=14 + - libstdcxx >=14 + - xorg-libxi >=1.8.2,<2.0a0 + - libvulkan-loader >=1.4.341.0,<2.0a0 + - libxkbcommon >=1.13.1,<2.0a0 + - wayland >=1.24.0,<2.0a0 + - libegl >=1.7.0,<2.0a0 + - xorg-libxext >=1.3.7,<2.0a0 + - libgl >=1.7.0,<2.0a0 + - xorg-libxtst >=1.2.5,<2.0a0 + - libudev1 >=257.10 + - pulseaudio-client >=17.0,<17.1.0a0 + - libusb >=1.0.29,<2.0a0 + - xorg-libxcursor >=1.2.3,<2.0a0 + - libdrm >=2.4.125,<2.5.0a0 + - xorg-libxscrnsaver >=1.2.4,<2.0a0 + - xorg-libxfixes >=6.0.2,<7.0a0 + - libunwind >=1.8.3,<1.9.0a0 + - liburing >=2.14,<2.15.0a0 + - dbus >=1.16.2,<2.0a0 + - xorg-libx11 >=1.8.13,<2.0a0 + license: Zlib + size: 2136476 + timestamp: 1771668207211 +- conda: https://conda.anaconda.org/conda-forge/win-64/sdl3-3.2.28-h5112557_0.conda + sha256: d4e0d53652a8087d2aa2607491c6ed8689b0fb72e1e66e1c012ef8e01f579e64 + md5: 713c8c89953e4a3a17e751746e372032 + depends: + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + - ucrt >=10.0.20348.0 + - libusb >=1.0.29,<2.0a0 + - libvulkan-loader >=1.4.328.1,<2.0a0 + license: Zlib + size: 1520902 + timestamp: 1764713305315 +- conda: https://conda.anaconda.org/conda-forge/win-64/sdl3-3.2.30-h5112557_0.conda + sha256: 6b02bf3f1924bcf3d984a0535528e0b39ba99c5edc758f0d167b39cd33545479 + md5: 79242ec5d52eee72a224c252c294db62 + depends: + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + - ucrt >=10.0.20348.0 + - libusb >=1.0.29,<2.0a0 + - libvulkan-loader >=1.4.328.1,<2.0a0 + license: Zlib + size: 1521101 + timestamp: 1767236315915 +- conda: https://conda.anaconda.org/conda-forge/win-64/sdl3-3.4.2-h5112557_0.conda + sha256: a4677774a9d542c6f4bac8779a2d7105748d38d8b7d56c8d02f36d14fba471b9 + md5: a0256884d35489e520360267e67ce3fc + depends: + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + - ucrt >=10.0.20348.0 + - libvulkan-loader >=1.4.341.0,<2.0a0 + - libusb >=1.0.29,<2.0a0 + license: Zlib + size: 1669623 + timestamp: 1771668231217 +- conda: https://conda.anaconda.org/conda-forge/noarch/setuptools-80.9.0-pyhff2d567_0.conda + sha256: 972560fcf9657058e3e1f97186cc94389144b46dbdf58c807ce62e83f977e863 + md5: 4de79c071274a53dcaf2a8c749d1499e + depends: + - python >=3.9 + license: MIT + license_family: MIT + size: 748788 + timestamp: 1748804951958 +- conda: https://conda.anaconda.org/conda-forge/noarch/setuptools-82.0.1-pyh332efcf_0.conda + sha256: 82088a6e4daa33329a30bc26dc19a98c7c1d3f05c0f73ce9845d4eab4924e9e1 + md5: 8e194e7b992f99a5015edbd4ebd38efd + depends: + - python >=3.10 + license: MIT + license_family: MIT + purls: + - pkg:pypi/setuptools?source=hash-mapping + size: 639697 + timestamp: 1773074868565 +- conda: https://conda.anaconda.org/conda-forge/linux-64/shaderc-2025.5-h3e344bc_0.conda + sha256: fd4d20f8b74c473e3579f181c40687697777be7ac617ee62866a2fe3199745d9 + md5: 6455b7f6e2c8caeb87b83cab7163bcb8 + depends: + - __glibc >=2.17,<3.0.a0 + - glslang >=16,<17.0a0 + - libgcc >=14 + - libstdcxx >=14 + - spirv-tools >=2025,<2026.0a0 + license: Apache-2.0 + license_family: Apache + size: 113361 + timestamp: 1764287965059 +- conda: https://conda.anaconda.org/conda-forge/linux-64/shaderc-2025.5-h718be3e_1.conda + sha256: 0c2d6f24ee2b614ee1da4d7d99cc9944ea1ace65455a47d48d8c1f726317168a + md5: 8dc8dda113c4c568256bdd486b6e842e + depends: + - __glibc >=2.17,<3.0.a0 + - glslang >=16,<17.0a0 + - libgcc >=14 + - libstdcxx >=14 + - spirv-tools >=2026,<2027.0a0 + license: Apache-2.0 + license_family: Apache + size: 113513 + timestamp: 1770208767759 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/shaderc-2025.5-h8c88b8f_0.conda + sha256: a8d6b35ecae1d9605e7944b6b5562b5d857355cc7be493b13fee550f7169fb40 + md5: 3a720e8647ebfff1322d81beb8a8be95 + depends: + - glslang >=16,<17.0a0 + - libgcc >=14 + - libstdcxx >=14 + - spirv-tools >=2025,<2026.0a0 + license: Apache-2.0 + license_family: Apache + size: 115395 + timestamp: 1764287938541 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/shaderc-2025.5-hfeb5c2c_1.conda + sha256: bf3f47847832e33acbcb7a1aba948f3b574979ad2a91f2ebdc9fc685c09433db + md5: 8268bdcd82d8f9abcb7f0fd6a9568ba4 + depends: + - glslang >=16,<17.0a0 + - libgcc >=14 + - libstdcxx >=14 + - spirv-tools >=2026,<2027.0a0 + license: Apache-2.0 + license_family: Apache + size: 115498 + timestamp: 1770208786806 +- conda: https://conda.anaconda.org/conda-forge/win-64/shaderc-2025.5-h8fa7867_1.conda + sha256: b2f6e199df47ca314294ad393818d6b499fd544703abcede0f19007b8f8f10e4 + md5: 04d62bc008ee442843e2f24f603ea1a6 + depends: + - glslang >=16,<17.0a0 + - spirv-tools >=2026,<2027.0a0 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: Apache-2.0 + license_family: Apache + size: 1558909 + timestamp: 1770208850155 +- conda: https://conda.anaconda.org/conda-forge/win-64/shaderc-2025.5-haa9a63f_0.conda + sha256: ed369ab2775ed7ff0476cedf8926a326d8d93068ee9c3e5f0e8836393390d5b0 + md5: c7159a672b77c38a0e8f88491ca9e9b2 + depends: + - glslang >=16,<17.0a0 + - spirv-tools >=2025,<2026.0a0 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: Apache-2.0 + license_family: Apache + size: 1516952 + timestamp: 1764288127996 +- conda: https://conda.anaconda.org/conda-forge/noarch/six-1.17.0-pyhe01879c_1.conda + sha256: 458227f759d5e3fcec5d9b7acce54e10c9e1f4f4b7ec978f3bfd54ce4ee9853d + md5: 3339e3b65d58accf4ca4fb8748ab16b3 + depends: + - python >=3.9 + - python + license: MIT + license_family: MIT + purls: + - pkg:pypi/six?source=hash-mapping + size: 18455 + timestamp: 1753199211006 +- conda: https://conda.anaconda.org/conda-forge/linux-64/snappy-1.2.2-h03e3b7b_1.conda + sha256: 48f3f6a76c34b2cfe80de9ce7f2283ecb55d5ed47367ba91e8bb8104e12b8f11 + md5: 98b6c9dc80eb87b2519b97bcf7e578dd + depends: + - libgcc >=14 + - __glibc >=2.17,<3.0.a0 + - libstdcxx >=14 + - libgcc >=14 + license: BSD-3-Clause + license_family: BSD + size: 45829 + timestamp: 1762948049098 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/snappy-1.2.2-he774c54_1.conda + sha256: a8a79c53852fb07286407907402caa5a96b6e22b518c4f010be40647f9ee3726 + md5: 3dec912091fb88614afa0af2712c1362 + depends: + - libgcc >=14 + - libstdcxx >=14 + - libgcc >=14 + license: BSD-3-Clause + license_family: BSD + size: 47096 + timestamp: 1762948094646 +- conda: https://conda.anaconda.org/conda-forge/noarch/snowballstemmer-3.0.1-pyhd8ed1ab_0.conda + sha256: 17007a4cfbc564dc3e7310dcbe4932c6ecb21593d4fec3c68610720f19e73fb2 + md5: 755cf22df8693aa0d1aec1c123fa5863 + depends: + - python >=3.9 + license: BSD-3-Clause + license_family: BSD + purls: + - pkg:pypi/snowballstemmer?source=hash-mapping + size: 73009 + timestamp: 1747749529809 +- conda: https://conda.anaconda.org/conda-forge/noarch/soupsieve-2.8.3-pyhd8ed1ab_0.conda + sha256: 23b71ecf089967d2900126920e7f9ff18cdcef82dbff3e2f54ffa360243a17ac + md5: 18de09b20462742fe093ba39185d9bac + depends: + - python >=3.10 + license: MIT + license_family: MIT + purls: + - pkg:pypi/soupsieve?source=hash-mapping + size: 38187 + timestamp: 1769034509657 +- conda: https://conda.anaconda.org/conda-forge/noarch/sphinx-8.1.3-pyhd8ed1ab_1.conda + sha256: 3228eb332ce159f031d4b7d2e08117df973b0ba3ddcb8f5dbb7f429f71d27ea1 + md5: 1a3281a0dc355c02b5506d87db2d78ac + depends: + - alabaster >=0.7.14 + - babel >=2.13 + - colorama >=0.4.6 + - docutils >=0.20,<0.22 + - imagesize >=1.3 + - jinja2 >=3.1 + - packaging >=23.0 + - pygments >=2.17 + - python >=3.10 + - requests >=2.30.0 + - snowballstemmer >=2.2 + - sphinxcontrib-applehelp >=1.0.7 + - sphinxcontrib-devhelp >=1.0.6 + - sphinxcontrib-htmlhelp >=2.0.6 + - sphinxcontrib-jsmath >=1.0.1 + - sphinxcontrib-qthelp >=1.0.6 + - sphinxcontrib-serializinghtml >=1.1.9 + - tomli >=2.0 + license: BSD-2-Clause + license_family: BSD + purls: + - pkg:pypi/sphinx?source=hash-mapping + size: 1387076 + timestamp: 1733754175386 +- conda: https://conda.anaconda.org/conda-forge/noarch/sphinx-autodoc-typehints-3.0.1-pyhd8ed1ab_0.conda + sha256: 0f93bb75a41918433abc8d8d80ef99d7fd8658d5ba34da3c5d8f707cb6bb3f46 + md5: 6ad405d62c8de3792608a27b7e085e15 + depends: + - python >=3.10 + - sphinx >=8.1.3 + license: MIT + license_family: MIT + purls: + - pkg:pypi/sphinx-autodoc-typehints?source=hash-mapping + size: 24055 + timestamp: 1737099757820 +- conda: https://conda.anaconda.org/conda-forge/noarch/sphinx-copybutton-0.5.2-pyhd8ed1ab_1.conda + sha256: 8cd892e49cb4d00501bc4439fb0c73ca44905f01a65b2b7fa05ba0e8f3924f19 + md5: bf22cb9c439572760316ce0748af3713 + depends: + - python >=3.9 + - sphinx >=1.8 + license: MIT + license_family: MIT + purls: + - pkg:pypi/sphinx-copybutton?source=hash-mapping + size: 17893 + timestamp: 1734573117732 +- conda: https://conda.anaconda.org/conda-forge/noarch/sphinx-jinja2-compat-0.4.1-pyhd8ed1ab_0.conda + sha256: 115f4306ace812d90b4ffab5ac27cc01c2fac13df67c5dcc37931130c8ebea13 + md5: 7ecc82915cd2c4654fa26ddc4d3650f7 + depends: + - jinja2 >=2.10 + - markupsafe >=1 + - python >=3.9 + license: MIT + license_family: MIT + purls: + - pkg:pypi/sphinx-jinja2-compat?source=hash-mapping + size: 12320 + timestamp: 1754550385132 +- conda: https://conda.anaconda.org/conda-forge/noarch/sphinx-prompt-1.10.1-pyhd8ed1ab_0.conda + sha256: 3d2e0d961b38f66ea3e7decd04917bf69104b6683dae778e4d3ef5291c04b861 + md5: bfc047865de18ef2657bd8a95d7b8b49 + depends: + - pygments + - python >=3.11 + - sphinx + license: BSD-3-Clause + license_family: BSD + purls: + - pkg:pypi/sphinx-prompt?source=hash-mapping + size: 12214 + timestamp: 1758128174284 +- conda: https://conda.anaconda.org/conda-forge/noarch/sphinx-tabs-3.4.1-pyhd8ed1ab_1.conda + sha256: 43c343edc9ea11ffd947d97fa60bf6347a404700e2cde81fb954e60b7e6a42c1 + md5: 8b8362d876396fd967cbb5f404def907 + depends: + - docutils >=0.18.0 + - pygments + - python >=3.6 + - sphinx >=2 + license: MIT + license_family: MIT + purls: + - pkg:pypi/sphinx-tabs?source=hash-mapping + size: 15026 + timestamp: 1675342588275 +- conda: https://conda.anaconda.org/conda-forge/noarch/sphinx-toolbox-4.1.2-pyhd8ed1ab_0.conda + sha256: 63d5b2d672499191d26f3ad2ed57a39c5fc691086a28fd41caec4689b6fa901a + md5: 8f0cb58909ab8ef6d76f03dac2a4a6d0 + depends: + - apeye >=0.4.0 + - autodocsumm >=0.2.0 + - beautifulsoup4 >=4.9.1 + - cachecontrol >=0.13.0 + - dict2css >=0.2.3 + - docutils >=0.16 + - domdf-python-tools >=2.9.0 + - filelock >=3.8.0 + - html5lib >=1.1 + - python >=3.10 + - ruamel.yaml >=0.16.12 + - sphinx >=3.2.0 + - sphinx-autodoc-typehints >=1.11.1 + - sphinx-jinja2-compat >=0.1.0 + - sphinx-prompt >=1.1.0 + - sphinx-tabs <3.5.0,>=1.2.1 + - tabulate >=0.8.7 + - typing-extensions !=3.10.0.1,>=3.7.4.3 + - typing_inspect >=0.6.0 + license: MIT + license_family: MIT + purls: + - pkg:pypi/sphinx-toolbox?source=hash-mapping + size: 98891 + timestamp: 1768566379359 +- conda: https://conda.anaconda.org/conda-forge/noarch/sphinxcontrib-applehelp-2.0.0-pyhd8ed1ab_1.conda + sha256: d7433a344a9ad32a680b881c81b0034bc61618d12c39dd6e3309abeffa9577ba + md5: 16e3f039c0aa6446513e94ab18a8784b + depends: + - python >=3.9 + - sphinx >=5 + license: BSD-2-Clause + license_family: BSD + purls: + - pkg:pypi/sphinxcontrib-applehelp?source=hash-mapping + size: 29752 + timestamp: 1733754216334 +- conda: https://conda.anaconda.org/conda-forge/noarch/sphinxcontrib-devhelp-2.0.0-pyhd8ed1ab_1.conda + sha256: 55d5076005d20b84b20bee7844e686b7e60eb9f683af04492e598a622b12d53d + md5: 910f28a05c178feba832f842155cbfff + depends: + - python >=3.9 + - sphinx >=5 + license: BSD-2-Clause + license_family: BSD + purls: + - pkg:pypi/sphinxcontrib-devhelp?source=hash-mapping + size: 24536 + timestamp: 1733754232002 +- conda: https://conda.anaconda.org/conda-forge/noarch/sphinxcontrib-htmlhelp-2.1.0-pyhd8ed1ab_1.conda + sha256: c1492c0262ccf16694bdcd3bb62aa4627878ea8782d5cd3876614ffeb62b3996 + md5: e9fb3fe8a5b758b4aff187d434f94f03 + depends: + - python >=3.9 + - sphinx >=5 + license: BSD-2-Clause + license_family: BSD + purls: + - pkg:pypi/sphinxcontrib-htmlhelp?source=hash-mapping + size: 32895 + timestamp: 1733754385092 +- conda: https://conda.anaconda.org/conda-forge/noarch/sphinxcontrib-jsmath-1.0.1-pyhd8ed1ab_1.conda + sha256: 578bef5ec630e5b2b8810d898bbbf79b9ae66d49b7938bcc3efc364e679f2a62 + md5: fa839b5ff59e192f411ccc7dae6588bb + depends: + - python >=3.9 + license: BSD-2-Clause + license_family: BSD + purls: + - pkg:pypi/sphinxcontrib-jsmath?source=hash-mapping + size: 10462 + timestamp: 1733753857224 +- conda: https://conda.anaconda.org/conda-forge/noarch/sphinxcontrib-qthelp-2.0.0-pyhd8ed1ab_1.conda + sha256: c664fefae4acdb5fae973bdde25836faf451f41d04342b64a358f9a7753c92ca + md5: 00534ebcc0375929b45c3039b5ba7636 + depends: + - python >=3.9 + - sphinx >=5 + license: BSD-2-Clause + license_family: BSD + purls: + - pkg:pypi/sphinxcontrib-qthelp?source=hash-mapping + size: 26959 + timestamp: 1733753505008 +- conda: https://conda.anaconda.org/conda-forge/noarch/sphinxcontrib-serializinghtml-1.1.10-pyhd8ed1ab_1.conda + sha256: 64d89ecc0264347486971a94487cb8d7c65bfc0176750cf7502b8a272f4ab557 + md5: 3bc61f7161d28137797e038263c04c54 + depends: + - python >=3.9 + - sphinx >=5 + license: BSD-2-Clause + license_family: BSD + purls: + - pkg:pypi/sphinxcontrib-serializinghtml?source=hash-mapping + size: 28669 + timestamp: 1733750596111 +- conda: https://conda.anaconda.org/conda-forge/linux-64/spirv-tools-2025.4-hb700be7_0.conda + sha256: aa0f0fc41646ef5a825d5725a2d06659df1c1084f15155936319e1909ac9cd16 + md5: aace50912e0f7361d0d223e7f7cfa6e5 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libstdcxx >=14 + constrains: + - spirv-headers >=1.4.328.0,<1.4.328.1.0a0 + license: Apache-2.0 + license_family: APACHE + size: 2248062 + timestamp: 1759805790709 +- conda: https://conda.anaconda.org/conda-forge/linux-64/spirv-tools-2026.1-hb700be7_0.conda + sha256: 003180b3a2e0c6490b1f3461cf9e0ed740b1bbf88ee4b73ee177b94bea0dc95d + md5: 8809e0bd5ec279bfe4bb6651c3ed2730 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libstdcxx >=14 + constrains: + - spirv-headers >=1.4.341.0,<1.4.341.1.0a0 + license: Apache-2.0 + license_family: APACHE + size: 2296977 + timestamp: 1770089626195 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/spirv-tools-2025.4-hfefdfc9_0.conda + sha256: 8132f3e06572896a4d9f672c5cb989c08bda2855e45eac95eed7012cfc5e5428 + md5: 6cbec31663722c23b6b4b217f6846e3c + depends: + - libgcc >=14 + - libstdcxx >=14 + constrains: + - spirv-headers >=1.4.328.0,<1.4.328.1.0a0 + license: Apache-2.0 + license_family: APACHE + size: 2511309 + timestamp: 1759805874123 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/spirv-tools-2026.1-hfefdfc9_0.conda + sha256: 841a7df4b73a13a148410e677b1bf07ed81bd181cc686278d64d65e033f4a06a + md5: ad8208c6618a543687d754dc57876091 + depends: + - libgcc >=14 + - libstdcxx >=14 + constrains: + - spirv-headers >=1.4.341.0,<1.4.341.1.0a0 + license: Apache-2.0 + license_family: APACHE + size: 2255599 + timestamp: 1770089690097 +- conda: https://conda.anaconda.org/conda-forge/win-64/spirv-tools-2025.4-h49e36cd_0.conda + sha256: 952a88cb050d8b21c020c03181af4ae8d89dd586631438cefbe66be6c15d6b92 + md5: 6e7df59eec517187e48699b298e750a2 + depends: + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + constrains: + - spirv-headers >=1.4.328.0,<1.4.328.1.0a0 + license: Apache-2.0 + license_family: APACHE + size: 14158518 + timestamp: 1759806206089 +- conda: https://conda.anaconda.org/conda-forge/win-64/spirv-tools-2026.1-h49e36cd_0.conda + sha256: 9976eeaf650d43833c110447ba264a72f470928d8a8fa5d1cfbadcd2a276184c + md5: bf5a4eb05c8b38dbc4e32ce17ab36389 + depends: + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + constrains: + - spirv-headers >=1.4.341.0,<1.4.341.1.0a0 + license: Apache-2.0 + license_family: APACHE + size: 13881533 + timestamp: 1770089875437 +- conda: https://conda.anaconda.org/conda-forge/linux-64/sqlalchemy-2.0.49-py312h5253ce2_0.conda + sha256: ab3445a03e1fe99093cac00a4f923c25e1f438cc7f7b64d254b7e4f06e52693e + md5: 0662f9f9ffb7ae91f2c095c77f18b9a5 + depends: + - python + - greenlet !=0.4.17 + - typing-extensions >=4.6.0 + - libgcc >=14 + - __glibc >=2.17,<3.0.a0 + - python_abi 3.12.* *_cp312 + license: MIT + license_family: MIT + purls: + - pkg:pypi/sqlalchemy?source=compressed-mapping + size: 3707065 + timestamp: 1775241332871 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/sqlalchemy-2.0.49-py312h2fc9c67_0.conda + sha256: ded6744a827bef2644547ebb30453dfb367e76b9b38d70be5934cee586aad5a0 + md5: a4bfb5442cfc73af95ff3b61ee5a880d + depends: + - python + - greenlet !=0.4.17 + - typing-extensions >=4.6.0 + - libgcc >=14 + - python_abi 3.12.* *_cp312 + license: MIT + license_family: MIT + purls: + - pkg:pypi/sqlalchemy?source=compressed-mapping + size: 3711633 + timestamp: 1775241583240 +- conda: https://conda.anaconda.org/conda-forge/win-64/sqlalchemy-2.0.49-py312he5662c2_0.conda + sha256: ee7289c97b4892fac2752d71fc773603210bf3b671c886499c7dbacad9b4c08a + md5: d42e4d5316b68fc70bdf09e5fccf3eb0 + depends: + - python + - greenlet !=0.4.17 + - typing-extensions >=4.6.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + - ucrt >=10.0.20348.0 + - python_abi 3.12.* *_cp312 + license: MIT + license_family: MIT + purls: + - pkg:pypi/sqlalchemy?source=compressed-mapping + size: 3665426 + timestamp: 1775241406935 +- conda: https://conda.anaconda.org/conda-forge/noarch/stack_data-0.6.3-pyhd8ed1ab_1.conda + sha256: 570da295d421661af487f1595045760526964f41471021056e993e73089e9c41 + md5: b1b505328da7a6b246787df4b5a49fbc + depends: + - asttokens + - executing + - pure_eval + - python >=3.9 + license: MIT + license_family: MIT + purls: + - pkg:pypi/stack-data?source=hash-mapping + size: 26988 + timestamp: 1733569565672 +- conda: https://conda.anaconda.org/conda-forge/linux-64/svt-av1-3.1.2-hecca717_0.conda + sha256: 34e2e9c505cd25dba0a9311eb332381b15147cf599d972322a7c197aedfc8ce2 + md5: 9859766c658e78fec9afa4a54891d920 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libstdcxx >=14 + license: BSD-2-Clause + license_family: BSD + size: 2741200 + timestamp: 1756086702093 +- conda: https://conda.anaconda.org/conda-forge/linux-64/svt-av1-4.0.1-hecca717_0.conda + sha256: 4a1d2005153b9454fc21c9bad1b539df189905be49e851ec62a6212c2e045381 + md5: 2a2170a3e5c9a354d09e4be718c43235 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libstdcxx >=14 + license: BSD-2-Clause + license_family: BSD + size: 2619743 + timestamp: 1769664536467 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/svt-av1-3.1.2-hfae3067_0.conda + sha256: e4b482062da7cf259f21465274a0f3613d1dbd8ea649aca6072625f5038ac40d + md5: 7602d3004ed53b3f8e5e0e04e5de4de7 + depends: + - libgcc >=14 + - libstdcxx >=14 + license: BSD-2-Clause + license_family: BSD + size: 2106252 + timestamp: 1756090698097 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/svt-av1-4.0.1-hfae3067_0.conda + sha256: 6518e4575e83e38b07460f504b6467124f9a16e4d368af42ca54a69603002078 + md5: 943fcd76194904358b2587d627ee6388 + depends: + - libgcc >=14 + - libstdcxx >=14 + license: BSD-2-Clause + license_family: BSD + size: 2042800 + timestamp: 1769668627820 +- conda: https://conda.anaconda.org/conda-forge/win-64/svt-av1-3.1.2-hac47afa_0.conda + sha256: 444c94a9c1fcb2cdf78b260472451990257733bcf89ed80c73db36b5047d3134 + md5: 91866412570c922f55178855deb0f952 + depends: + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: BSD-2-Clause + license_family: BSD + size: 1862756 + timestamp: 1756086862067 +- conda: https://conda.anaconda.org/conda-forge/win-64/svt-av1-4.0.1-hac47afa_0.conda + sha256: 4d77eec06ee4c5de38d330fb7dfd6dac2f867ec007123acb901be9942e12c08a + md5: d9714a97bc69f98fd5032f675ae1b0b5 + depends: + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: BSD-2-Clause + license_family: BSD + size: 1808810 + timestamp: 1769664619287 +- conda: https://conda.anaconda.org/conda-forge/noarch/sysroot_linux-64-2.28-h4ee821c_9.conda + sha256: c47299fe37aebb0fcf674b3be588e67e4afb86225be4b0d452c7eb75c086b851 + md5: 13dc3adbc692664cd3beabd216434749 + depends: + - __glibc >=2.28 + - kernel-headers_linux-64 4.18.0 he073ed8_9 + - tzdata + license: LGPL-2.0-or-later AND LGPL-2.0-or-later WITH exceptions AND GPL-2.0-or-later + license_family: GPL + size: 24008591 + timestamp: 1765578833462 +- conda: https://conda.anaconda.org/conda-forge/noarch/sysroot_linux-aarch64-2.28-h585391f_9.conda + sha256: 1bd2db6b2e451247bab103e4a0128cf6c7595dd72cb26d70f7fadd9edd1d1bc3 + md5: fdf07ab944a222ff28c754914fdb0740 + depends: + - __glibc >=2.28 + - kernel-headers_linux-aarch64 4.18.0 h05a177a_9 + - tzdata + license: LGPL-2.0-or-later AND LGPL-2.0-or-later WITH exceptions AND GPL-2.0-or-later + license_family: GPL + size: 23644746 + timestamp: 1765578629426 +- conda: https://conda.anaconda.org/conda-forge/noarch/tabulate-0.10.0-pyhcf101f3_0.conda + sha256: 3f661e98a09f976775a494488beb3d35ebb00f535b169c6bd891f2e280d55783 + md5: 3b887b7b3468b0f494b4fad40178b043 + depends: + - python >=3.10 + - python + license: MIT + license_family: MIT + purls: + - pkg:pypi/tabulate?source=compressed-mapping + size: 43964 + timestamp: 1772732795746 +- conda: https://conda.anaconda.org/conda-forge/linux-64/tbb-2022.3.0-h8d10470_1.conda + sha256: 2e3238234ae094d5a5f7c559410ea8875351b6bac0d9d0e576bf64b732b8029e + md5: e3259be3341da4bc06c5b7a78c8bf1bd + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libhwloc >=2.12.1,<2.12.2.0a0 + - libstdcxx >=14 + license: Apache-2.0 + license_family: APACHE + size: 181262 + timestamp: 1762509955687 +- conda: https://conda.anaconda.org/conda-forge/linux-64/tbb-2022.3.0-hb700be7_2.conda + sha256: 975710e4b7f1b13c3c30b7fbf21e22f50abe0463b6b47a231582fdedcc45c961 + md5: 8f7278ca5f7456a974992a8b34284737 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libhwloc >=2.12.2,<2.12.3.0a0 + - libstdcxx >=14 + license: Apache-2.0 + license_family: APACHE + size: 181329 + timestamp: 1767886632911 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/tbb-2022.3.0-h0eac15c_1.conda + sha256: 3fd3d1ba6b81c5edee8d8fa0d2757f7ba3bf4d4a8ecc68f515c90e737eaa02e4 + md5: eda1e9439d903e3fdd7ff9e086da2018 + depends: + - libgcc >=14 + - libhwloc >=2.12.1,<2.12.2.0a0 + - libstdcxx >=14 + license: Apache-2.0 + license_family: APACHE + size: 144223 + timestamp: 1762511489745 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/tbb-2022.3.0-hfefdfc9_2.conda + sha256: 2e875ba342c2cde6301b088cd6471f67e44d961bd292abcdfa6ba3fc32506935 + md5: 4d424acd246a5ba42512c097139ed0a0 + depends: + - libgcc >=14 + - libhwloc >=2.12.2,<2.12.3.0a0 + - libstdcxx >=14 + license: Apache-2.0 + license_family: APACHE + size: 144746 + timestamp: 1767888618836 +- conda: https://conda.anaconda.org/conda-forge/win-64/tbb-2022.3.0-h3155e25_2.conda + sha256: abd9a489f059fba85c8ffa1abdaa4d515d6de6a3325238b8e81203b913cf65a9 + md5: 0f9817ffbe25f9e69ceba5ea70c52606 + depends: + - libhwloc >=2.12.2,<2.12.3.0a0 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: Apache-2.0 + license_family: APACHE + purls: [] + size: 155869 + timestamp: 1767886839029 +- conda: https://conda.anaconda.org/conda-forge/win-64/tbb-2022.3.0-hd094cb3_1.conda + sha256: c31cac57913a699745d124cdc016a63e31c5749f16f60b3202414d071fc50573 + md5: 17c38aaf14c640b85c4617ccb59c1146 + depends: + - libhwloc >=2.12.1,<2.12.2.0a0 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: Apache-2.0 + license_family: APACHE + size: 155714 + timestamp: 1762510341121 +- conda: https://conda.anaconda.org/conda-forge/linux-64/tk-8.6.13-noxft_h366c992_103.conda + sha256: cafeec44494f842ffeca27e9c8b0c27ed714f93ac77ddadc6aaf726b5554ebac + md5: cffd3bdd58090148f4cfcd831f4b26ab + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libzlib >=1.3.1,<2.0a0 + constrains: + - xorg-libx11 >=1.8.12,<2.0a0 + license: TCL + license_family: BSD + purls: [] + size: 3301196 + timestamp: 1769460227866 +- conda: https://conda.anaconda.org/conda-forge/linux-64/tk-8.6.13-noxft_ha0e22de_103.conda + sha256: 1544760538a40bcd8ace2b1d8ebe3eb5807ac268641f8acdc18c69c5ebfeaf64 + md5: 86bc20552bf46075e3d92b67f089172d + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=13 + - libzlib >=1.3.1,<2.0a0 + constrains: + - xorg-libx11 >=1.8.12,<2.0a0 + license: TCL + license_family: BSD + size: 3284905 + timestamp: 1763054914403 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/tk-8.6.13-noxft_h0dc03b3_103.conda + sha256: e25c314b52764219f842b41aea2c98a059f06437392268f09b03561e4f6e5309 + md5: 7fc6affb9b01e567d2ef1d05b84aa6ed + depends: + - libgcc >=14 + - libzlib >=1.3.1,<2.0a0 + constrains: + - xorg-libx11 >=1.8.12,<2.0a0 + license: TCL + license_family: BSD + purls: [] + size: 3368666 + timestamp: 1769464148928 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/tk-8.6.13-noxft_h561c983_103.conda + sha256: 154e73f6269f92ad5257aa2039278b083998fd19d371e150f307483fb93c07ae + md5: 631db4799bc2bfe4daccf80bb3cbc433 + depends: + - libgcc >=13 + - libzlib >=1.3.1,<2.0a0 + constrains: + - xorg-libx11 >=1.8.12,<2.0a0 + license: TCL + license_family: BSD + size: 3333495 + timestamp: 1763059192223 +- conda: https://conda.anaconda.org/conda-forge/win-64/tk-8.6.13-h2c6b04d_3.conda + sha256: 4581f4ffb432fefa1ac4f85c5682cc27014bcd66e7beaa0ee330e927a7858790 + md5: 7cb36e506a7dba4817970f8adb6396f9 + depends: + - ucrt >=10.0.20348.0 + - vc >=14.2,<15 + - vc14_runtime >=14.29.30139 + license: TCL + license_family: BSD + size: 3472313 + timestamp: 1763055164278 +- conda: https://conda.anaconda.org/conda-forge/win-64/tk-8.6.13-h6ed50ae_3.conda + sha256: 0e79810fae28f3b69fe7391b0d43f5474d6bd91d451d5f2bde02f55ae481d5e3 + md5: 0481bfd9814bf525bd4b3ee4b51494c4 + depends: + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: TCL + license_family: BSD + purls: [] + size: 3526350 + timestamp: 1769460339384 +- conda: https://conda.anaconda.org/conda-forge/noarch/tomli-2.3.0-pyhcf101f3_0.conda + sha256: cb77c660b646c00a48ef942a9e1721ee46e90230c7c570cdeb5a893b5cce9bff + md5: d2732eb636c264dc9aa4cbee404b1a53 + depends: + - python >=3.10 + - python + license: MIT + license_family: MIT + size: 20973 + timestamp: 1760014679845 +- conda: https://conda.anaconda.org/conda-forge/noarch/tomli-2.4.0-pyhcf101f3_0.conda + sha256: 62940c563de45790ba0f076b9f2085a842a65662268b02dd136a8e9b1eaf47a8 + md5: 72e780e9aa2d0a3295f59b1874e3768b + depends: + - python >=3.10 + - python + license: MIT + license_family: MIT + size: 21453 + timestamp: 1768146676791 +- conda: https://conda.anaconda.org/conda-forge/noarch/tomli-2.4.1-pyhcf101f3_0.conda + sha256: 91cafdb64268e43e0e10d30bd1bef5af392e69f00edd34dfaf909f69ab2da6bd + md5: b5325cf06a000c5b14970462ff5e4d58 + depends: + - python >=3.10 + - python + license: MIT + license_family: MIT + purls: + - pkg:pypi/tomli?source=compressed-mapping + size: 21561 + timestamp: 1774492402955 +- conda: https://conda.anaconda.org/conda-forge/linux-64/tornado-6.5.5-py312h4c3975b_0.conda + sha256: 4629b1c9139858fb08bb357df917ffc12e4d284c57ff389806bb3ae476ef4e0a + md5: 2b37798adbc54fd9e591d24679d2133a + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - python >=3.12,<3.13.0a0 + - python_abi 3.12.* *_cp312 + license: Apache-2.0 + license_family: Apache + purls: + - pkg:pypi/tornado?source=compressed-mapping + size: 859665 + timestamp: 1774358032165 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/tornado-6.5.5-py312hefbd42c_0.conda + sha256: 36c363ba31390875a7b024899077268b7fd55fe35e8f9190b5154c4f5032a99b + md5: 9bd0a2e992f86149013b0a5c50a912c9 + depends: + - libgcc >=14 + - python >=3.12,<3.13.0a0 + - python_abi 3.12.* *_cp312 + license: Apache-2.0 + license_family: Apache + purls: + - pkg:pypi/tornado?source=hash-mapping + size: 859168 + timestamp: 1774359394755 +- conda: https://conda.anaconda.org/conda-forge/win-64/tornado-6.5.5-py312he06e257_0.conda + sha256: 1220c986664e9e8662e660dc64dd97ed823926b1ba05175771408cf1d6a46dd2 + md5: c6c66a64da3d2953c83ed2789a7f4bdb + depends: + - python >=3.12,<3.13.0a0 + - python_abi 3.12.* *_cp312 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: Apache-2.0 + license_family: Apache + purls: + - pkg:pypi/tornado?source=compressed-mapping + size: 859726 + timestamp: 1774358173994 +- conda: https://conda.anaconda.org/conda-forge/noarch/traitlets-5.14.3-pyhd8ed1ab_1.conda + sha256: f39a5620c6e8e9e98357507262a7869de2ae8cc07da8b7f84e517c9fd6c2b959 + md5: 019a7385be9af33791c989871317e1ed + depends: + - python >=3.9 + license: BSD-3-Clause + license_family: BSD + purls: + - pkg:pypi/traitlets?source=hash-mapping + size: 110051 + timestamp: 1733367480074 +- conda: https://conda.anaconda.org/conda-forge/noarch/typing-extensions-4.15.0-h396c80c_0.conda + sha256: 7c2df5721c742c2a47b2c8f960e718c930031663ac1174da67c1ed5999f7938c + md5: edd329d7d3a4ab45dcf905899a7a6115 + depends: + - typing_extensions ==4.15.0 pyhcf101f3_0 + license: PSF-2.0 + license_family: PSF + purls: [] + size: 91383 + timestamp: 1756220668932 +- conda: https://conda.anaconda.org/conda-forge/noarch/typing_extensions-4.15.0-pyhcf101f3_0.conda + sha256: 032271135bca55aeb156cee361c81350c6f3fb203f57d024d7e5a1fc9ef18731 + md5: 0caa1af407ecff61170c9437a808404d + depends: + - python >=3.10 + - python + license: PSF-2.0 + license_family: PSF + purls: + - pkg:pypi/typing-extensions?source=hash-mapping + size: 51692 + timestamp: 1756220668932 +- conda: https://conda.anaconda.org/conda-forge/noarch/typing_inspect-0.9.0-pyhd8ed1ab_1.conda + sha256: a3fbdd31b509ff16c7314e8d01c41d9146504df632a360ab30dbc1d3ca79b7c0 + md5: fa31df4d4193aabccaf09ce78a187faf + depends: + - mypy_extensions >=0.3.0 + - python >=3.9 + - typing_extensions >=3.7.4 + license: MIT + license_family: MIT + purls: + - pkg:pypi/typing-inspect?source=hash-mapping + size: 14919 + timestamp: 1733845966415 +- conda: https://conda.anaconda.org/conda-forge/noarch/tzdata-2025b-h78e105d_0.conda + sha256: 5aaa366385d716557e365f0a4e9c3fca43ba196872abbbe3d56bb610d131e192 + md5: 4222072737ccff51314b5ece9c7d6f5a + license: LicenseRef-Public-Domain + size: 122968 + timestamp: 1742727099393 +- conda: https://conda.anaconda.org/conda-forge/noarch/tzdata-2025c-hc9c84f9_1.conda + sha256: 1d30098909076af33a35017eed6f2953af1c769e273a0626a04722ac4acaba3c + md5: ad659d0a2b3e47e38d829aa8cad2d610 + license: LicenseRef-Public-Domain + purls: [] + size: 119135 + timestamp: 1767016325805 +- conda: https://conda.anaconda.org/conda-forge/win-64/ucrt-10.0.26100.0-h57928b3_0.conda + sha256: 3005729dce6f3d3f5ec91dfc49fc75a0095f9cd23bab49efb899657297ac91a5 + md5: 71b24316859acd00bdb8b38f5e2ce328 + constrains: + - vc14_runtime >=14.29.30037 + - vs2015_runtime >=14.29.30037 + license: LicenseRef-MicrosoftWindowsSDK10 + purls: [] + size: 694692 + timestamp: 1756385147981 +- conda: https://conda.anaconda.org/conda-forge/noarch/urllib3-2.6.3-pyhd8ed1ab_0.conda + sha256: af641ca7ab0c64525a96fd9ad3081b0f5bcf5d1cbb091afb3f6ed5a9eee6111a + md5: 9272daa869e03efe68833e3dc7a02130 + depends: + - backports.zstd >=1.0.0 + - brotli-python >=1.2.0 + - h2 >=4,<5 + - pysocks >=1.5.6,<2.0,!=1.5.7 + - python >=3.10 + license: MIT + license_family: MIT + purls: + - pkg:pypi/urllib3?source=hash-mapping + size: 103172 + timestamp: 1767817860341 +- conda: https://conda.anaconda.org/conda-forge/win-64/vc-14.3-h2b53caa_32.conda + sha256: 82250af59af9ff3c6a635dd4c4764c631d854feb334d6747d356d949af44d7cf + md5: ef02bbe151253a72b8eda264a935db66 + depends: + - vc14_runtime >=14.42.34433 + track_features: + - vc14 + license: BSD-3-Clause + license_family: BSD + size: 18861 + timestamp: 1760418772353 +- conda: https://conda.anaconda.org/conda-forge/win-64/vc-14.3-h41ae7f8_34.conda + sha256: 9dc40c2610a6e6727d635c62cced5ef30b7b30123f5ef67d6139e23d21744b3a + md5: 1e610f2416b6acdd231c5f573d754a0f + depends: + - vc14_runtime >=14.44.35208 + track_features: + - vc14 + license: BSD-3-Clause + license_family: BSD + purls: [] + size: 19356 + timestamp: 1767320221521 +- conda: https://conda.anaconda.org/conda-forge/win-64/vc14_runtime-14.44.35208-h818238b_32.conda + sha256: e3a3656b70d1202e0d042811ceb743bd0d9f7e00e2acdf824d231b044ef6c0fd + md5: 378d5dcec45eaea8d303da6f00447ac0 + depends: + - ucrt >=10.0.20348.0 + - vcomp14 14.44.35208 h818238b_32 + constrains: + - vs2015_runtime 14.44.35208.* *_32 + license: LicenseRef-MicrosoftVisualCpp2015-2022Runtime + license_family: Proprietary + size: 682706 + timestamp: 1760418629729 +- conda: https://conda.anaconda.org/conda-forge/win-64/vc14_runtime-14.44.35208-h818238b_34.conda + sha256: 02732f953292cce179de9b633e74928037fa3741eb5ef91c3f8bae4f761d32a5 + md5: 37eb311485d2d8b2c419449582046a42 + depends: + - ucrt >=10.0.20348.0 + - vcomp14 14.44.35208 h818238b_34 + constrains: + - vs2015_runtime 14.44.35208.* *_34 + license: LicenseRef-MicrosoftVisualCpp2015-2022Runtime + license_family: Proprietary + purls: [] + size: 683233 + timestamp: 1767320219644 +- conda: https://conda.anaconda.org/conda-forge/win-64/vcomp14-14.44.35208-h818238b_32.conda + sha256: f3790c88fbbdc55874f41de81a4237b1b91eab75e05d0e58661518ff04d2a8a1 + md5: 58f67b437acbf2764317ba273d731f1d + depends: + - ucrt >=10.0.20348.0 + constrains: + - vs2015_runtime 14.44.35208.* *_32 + license: LicenseRef-MicrosoftVisualCpp2015-2022Runtime + license_family: Proprietary + size: 114846 + timestamp: 1760418593847 +- conda: https://conda.anaconda.org/conda-forge/win-64/vcomp14-14.44.35208-h818238b_34.conda + sha256: 878d5d10318b119bd98ed3ed874bd467acbe21996e1d81597a1dbf8030ea0ce6 + md5: 242d9f25d2ae60c76b38a5e42858e51d + depends: + - ucrt >=10.0.20348.0 + constrains: + - vs2015_runtime 14.44.35208.* *_34 + license: LicenseRef-MicrosoftVisualCpp2015-2022Runtime + license_family: Proprietary + purls: [] + size: 115235 + timestamp: 1767320173250 +- conda: https://conda.anaconda.org/conda-forge/win-64/vs2015_runtime-14.44.35208-h38c0c73_32.conda + sha256: 65cea43f4de99bc81d589e746c538908b2e95aead9042fecfbc56a4d14684a87 + md5: dfc1e5bbf1ecb0024a78e4e8bd45239d + depends: + - vc14_runtime >=14.44.35208 + license: BSD-3-Clause + license_family: BSD + size: 18919 + timestamp: 1760418632059 +- conda: https://conda.anaconda.org/conda-forge/win-64/vs2015_runtime-14.44.35208-h38c0c73_34.conda + sha256: 63ff4ec6e5833f768d402f5e95e03497ce211ded5b6f492e660e2bfc726ad24d + md5: f276d1de4553e8fca1dfb6988551ebb4 + depends: + - vc14_runtime >=14.44.35208 + license: BSD-3-Clause + license_family: BSD + size: 19347 + timestamp: 1767320221943 +- conda: https://conda.anaconda.org/conda-forge/linux-64/wayland-1.24.0-hd6090a7_1.conda + sha256: 3aa04ae8e9521d9b56b562376d944c3e52b69f9d2a0667f77b8953464822e125 + md5: 035da2e4f5770f036ff704fa17aace24 + depends: + - __glibc >=2.17,<3.0.a0 + - libexpat >=2.7.1,<3.0a0 + - libffi >=3.5.2,<3.6.0a0 + - libgcc >=14 + - libstdcxx >=14 + license: MIT + license_family: MIT + size: 329779 + timestamp: 1761174273487 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/wayland-1.24.0-h4f8a99f_1.conda + sha256: d94af8f287db764327ac7b48f6c0cd5c40da6ea2606afd34ac30671b7c85d8ee + md5: f6966cb1f000c230359ae98c29e37d87 + depends: + - libexpat >=2.7.1,<3.0a0 + - libffi >=3.5.2,<3.6.0a0 + - libgcc >=14 + - libstdcxx >=14 + license: MIT + license_family: MIT + size: 331480 + timestamp: 1761174368396 +- conda: https://conda.anaconda.org/conda-forge/noarch/wayland-protocols-1.47-hd8ed1ab_0.conda + sha256: 9ab2c12053ea8984228dd573114ffc6d63df42c501d59fda3bf3aeb1eaa1d23e + md5: 7da1571f560d4ba3343f7f4c48a79c76 + license: MIT + license_family: MIT + size: 140476 + timestamp: 1765821981856 +- conda: https://conda.anaconda.org/conda-forge/noarch/wcwidth-0.6.0-pyhd8ed1ab_0.conda + sha256: e298b508b2473c4227206800dfb14c39e4b14fd79d4636132e9e1e4244cdf4aa + md5: c3197f8c0d5b955c904616b716aca093 + depends: + - python >=3.10 + license: MIT + license_family: MIT + purls: + - pkg:pypi/wcwidth?source=compressed-mapping + size: 71550 + timestamp: 1770634638503 +- conda: https://conda.anaconda.org/conda-forge/noarch/webencodings-0.5.1-pyhd8ed1ab_3.conda + sha256: 19ff205e138bb056a46f9e3839935a2e60bd1cf01c8241a5e172a422fed4f9c6 + md5: 2841eb5bfc75ce15e9a0054b98dcd64d + depends: + - python >=3.9 + license: BSD-3-Clause + license_family: BSD + purls: + - pkg:pypi/webencodings?source=hash-mapping + size: 15496 + timestamp: 1733236131358 +- conda: https://conda.anaconda.org/conda-forge/noarch/wheel-0.46.3-pyhd8ed1ab_0.conda + sha256: d6cf2f0ebd5e09120c28ecba450556ce553752652d91795442f0e70f837126ae + md5: bdbd7385b4a67025ac2dba4ef8cb6a8f + depends: + - packaging >=24.0 + - python >=3.10 + license: MIT + license_family: MIT + purls: + - pkg:pypi/wheel?source=hash-mapping + size: 31858 + timestamp: 1769139207397 +- conda: https://conda.anaconda.org/conda-forge/noarch/win_inet_pton-1.1.0-pyh7428d3b_8.conda + sha256: 93807369ab91f230cf9e6e2a237eaa812492fe00face5b38068735858fba954f + md5: 46e441ba871f524e2b067929da3051c2 + depends: + - __win + - python >=3.9 + license: LicenseRef-Public-Domain + purls: + - pkg:pypi/win-inet-pton?source=hash-mapping + size: 9555 + timestamp: 1733130678956 +- conda: https://conda.anaconda.org/conda-forge/linux-64/x264-1!164.3095-h166bdaf_2.tar.bz2 + sha256: 175315eb3d6ea1f64a6ce470be00fa2ee59980108f246d3072ab8b977cb048a5 + md5: 6c99772d483f566d59e25037fea2c4b1 + depends: + - libgcc-ng >=12 + license: GPL-2.0-or-later + license_family: GPL + size: 897548 + timestamp: 1660323080555 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/x264-1!164.3095-h4e544f5_2.tar.bz2 + sha256: b48f150db8c052c197691c9d76f59e252d3a7f01de123753d51ebf2eed1cf057 + md5: 0efaf807a0b5844ce5f605bd9b668281 + depends: + - libgcc-ng >=12 + license: GPL-2.0-or-later + license_family: GPL + size: 1000661 + timestamp: 1660324722559 +- conda: https://conda.anaconda.org/conda-forge/win-64/x264-1!164.3095-h8ffe710_2.tar.bz2 + sha256: 97166b318f8c68ffe4d50b2f4bd36e415219eeaef233e7d41c54244dc6108249 + md5: 19e39905184459760ccb8cf5c75f148b + depends: + - vc >=14.1,<15 + - vs2015_runtime >=14.16.27033 + license: GPL-2.0-or-later + license_family: GPL + size: 1041889 + timestamp: 1660323726084 +- conda: https://conda.anaconda.org/conda-forge/linux-64/x265-3.5-h924138e_3.tar.bz2 + sha256: 76c7405bcf2af639971150f342550484efac18219c0203c5ee2e38b8956fe2a0 + md5: e7f6ed84d4623d52ee581325c1587a6b + depends: + - libgcc-ng >=10.3.0 + - libstdcxx-ng >=10.3.0 + license: GPL-2.0-or-later + license_family: GPL + size: 3357188 + timestamp: 1646609687141 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/x265-3.5-hdd96247_3.tar.bz2 + sha256: cb2227f2441499900bdc0168eb423d7b2056c8fd5a3541df4e2d05509a88c668 + md5: 786853760099c74a1d4f0da98dd67aea + depends: + - libgcc-ng >=10.3.0 + - libstdcxx-ng >=10.3.0 + license: GPL-2.0-or-later + license_family: GPL + size: 1018181 + timestamp: 1646610147365 +- conda: https://conda.anaconda.org/conda-forge/win-64/x265-3.5-h2d74725_3.tar.bz2 + sha256: 02b9874049112f2b7335c9a3e880ac05d99a08d9a98160c5a98898b2b3ac42b2 + md5: ca7129a334198f08347fb19ac98a2de9 + depends: + - vc >=14.1,<15 + - vs2015_runtime >=14.16.27033 + license: GPL-2.0-or-later + license_family: GPL + size: 5517425 + timestamp: 1646611941216 +- conda: https://conda.anaconda.org/conda-forge/linux-64/xkeyboard-config-2.46-hb03c661_0.conda + sha256: aa03b49f402959751ccc6e21932d69db96a65a67343765672f7862332aa32834 + md5: 71ae752a748962161b4740eaff510258 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - xorg-libx11 >=1.8.12,<2.0a0 + license: MIT + license_family: MIT + size: 396975 + timestamp: 1759543819846 +- conda: https://conda.anaconda.org/conda-forge/linux-64/xkeyboard-config-2.47-hb03c661_0.conda + sha256: 19c2bb14bec84b0e995b56b752369775c75f1589314b43733948bb5f471a6915 + md5: b56e0c8432b56decafae7e78c5f29ba5 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - xorg-libx11 >=1.8.13,<2.0a0 + license: MIT + license_family: MIT + size: 399291 + timestamp: 1772021302485 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/xkeyboard-config-2.46-he30d5cf_0.conda + sha256: c440a757d210e84c7f315ac3b034266980a8b4c986600649d296b9198b5b4f5e + md5: 9524f30d9dea7dd5d6ead43a8823b6c2 + depends: + - libgcc >=14 + - xorg-libx11 >=1.8.12,<2.0a0 + license: MIT + license_family: MIT + size: 396706 + timestamp: 1759543850920 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/xkeyboard-config-2.47-he30d5cf_0.conda + sha256: ec7ff9dffbd41faa31a30fa0724699f05bca000d57c745a195ecdb56888a8605 + md5: 4ac707a4279972357712af099cd1ae50 + depends: + - libgcc >=14 + - xorg-libx11 >=1.8.13,<2.0a0 + license: MIT + license_family: MIT + size: 399629 + timestamp: 1772021320967 +- conda: https://conda.anaconda.org/conda-forge/linux-64/xorg-libice-1.1.2-hb9d3cd8_0.conda + sha256: c12396aabb21244c212e488bbdc4abcdef0b7404b15761d9329f5a4a39113c4b + md5: fb901ff28063514abb6046c9ec2c4a45 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=13 + license: MIT + license_family: MIT + size: 58628 + timestamp: 1734227592886 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/xorg-libice-1.1.2-h86ecc28_0.conda + sha256: a2ba1864403c7eb4194dacbfe2777acf3d596feae43aada8d1b478617ce45031 + md5: c8d8ec3e00cd0fd8a231789b91a7c5b7 + depends: + - libgcc >=13 + license: MIT + license_family: MIT + size: 60433 + timestamp: 1734229908988 +- conda: https://conda.anaconda.org/conda-forge/linux-64/xorg-libsm-1.2.6-he73a12e_0.conda + sha256: 277841c43a39f738927145930ff963c5ce4c4dacf66637a3d95d802a64173250 + md5: 1c74ff8c35dcadf952a16f752ca5aa49 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=13 + - libuuid >=2.38.1,<3.0a0 + - xorg-libice >=1.1.2,<2.0a0 + license: MIT + license_family: MIT + size: 27590 + timestamp: 1741896361728 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/xorg-libsm-1.2.6-h0808dbd_0.conda + sha256: b86a819cd16f90c01d9d81892155126d01555a20dabd5f3091da59d6309afd0a + md5: 2d1409c50882819cb1af2de82e2b7208 + depends: + - libgcc >=13 + - libuuid >=2.38.1,<3.0a0 + - xorg-libice >=1.1.2,<2.0a0 + license: MIT + license_family: MIT + size: 28701 + timestamp: 1741897678254 +- conda: https://conda.anaconda.org/conda-forge/linux-64/xorg-libx11-1.8.12-h4f16b4b_0.conda + sha256: 51909270b1a6c5474ed3978628b341b4d4472cd22610e5f22b506855a5e20f67 + md5: db038ce880f100acc74dba10302b5630 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=13 + - libxcb >=1.17.0,<2.0a0 + license: MIT + license_family: MIT + size: 835896 + timestamp: 1741901112627 +- conda: https://conda.anaconda.org/conda-forge/linux-64/xorg-libx11-1.8.13-he1eb515_0.conda + sha256: 516d4060139dbb4de49a4dcdc6317a9353fb39ebd47789c14e6fe52de0deee42 + md5: 861fb6ccbc677bb9a9fb2468430b9c6a + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libxcb >=1.17.0,<2.0a0 + license: MIT + license_family: MIT + size: 839652 + timestamp: 1770819209719 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/xorg-libx11-1.8.12-hca56bd8_0.conda + sha256: 452977d8ad96f04ec668ba74f46e70a53e00f99c0e0307956aeca75894c8131d + md5: 3df132f0048b9639bc091ef22937c111 + depends: + - libgcc >=13 + - libxcb >=1.17.0,<2.0a0 + license: MIT + license_family: MIT + size: 864850 + timestamp: 1741901264068 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/xorg-libx11-1.8.13-h63a1b12_0.conda + sha256: cf886160e2ff580d77f7eb8ec1a77c41c2c5b05343e329bc35f0ddf40b8d92ab + md5: 22dd10425ef181e80e130db50675d615 + depends: + - libgcc >=14 + - libxcb >=1.17.0,<2.0a0 + license: MIT + license_family: MIT + size: 869058 + timestamp: 1770819244991 +- conda: https://conda.anaconda.org/conda-forge/linux-64/xorg-libxau-1.0.12-hb03c661_1.conda + sha256: 6bc6ab7a90a5d8ac94c7e300cc10beb0500eeba4b99822768ca2f2ef356f731b + md5: b2895afaf55bf96a8c8282a2e47a5de0 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + license: MIT + license_family: MIT + size: 15321 + timestamp: 1762976464266 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/xorg-libxau-1.0.12-he30d5cf_1.conda + sha256: e9f6e931feeb2f40e1fdbafe41d3b665f1ab6cb39c5880a1fcf9f79a3f3c84a5 + md5: 1c246e1105000c3660558459e2fd6d43 + depends: + - libgcc >=14 + license: MIT + license_family: MIT + size: 16317 + timestamp: 1762977521691 +- conda: https://conda.anaconda.org/conda-forge/linux-64/xorg-libxcursor-1.2.3-hb9d3cd8_0.conda + sha256: 832f538ade441b1eee863c8c91af9e69b356cd3e9e1350fff4fe36cc573fc91a + md5: 2ccd714aa2242315acaf0a67faea780b + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=13 + - xorg-libx11 >=1.8.10,<2.0a0 + - xorg-libxfixes >=6.0.1,<7.0a0 + - xorg-libxrender >=0.9.11,<0.10.0a0 + license: MIT + license_family: MIT + size: 32533 + timestamp: 1730908305254 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/xorg-libxcursor-1.2.3-h86ecc28_0.conda + sha256: c5d3692520762322a9598e7448492309f5ee9d8f3aff72d787cf06e77c42507f + md5: f2054759c2203d12d0007005e1f1296d + depends: + - libgcc >=13 + - xorg-libx11 >=1.8.9,<2.0a0 + - xorg-libxfixes >=6.0.1,<7.0a0 + - xorg-libxrender >=0.9.11,<0.10.0a0 + license: MIT + license_family: MIT + size: 34596 + timestamp: 1730908388714 +- conda: https://conda.anaconda.org/conda-forge/linux-64/xorg-libxdmcp-1.1.5-hb03c661_1.conda + sha256: 25d255fb2eef929d21ff660a0c687d38a6d2ccfbcbf0cc6aa738b12af6e9d142 + md5: 1dafce8548e38671bea82e3f5c6ce22f + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + license: MIT + license_family: MIT + size: 20591 + timestamp: 1762976546182 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/xorg-libxdmcp-1.1.5-he30d5cf_1.conda + sha256: 128d72f36bcc8d2b4cdbec07507542e437c7d67f677b7d77b71ed9eeac7d6df1 + md5: bff06dcde4a707339d66d45d96ceb2e2 + depends: + - libgcc >=14 + license: MIT + license_family: MIT + size: 21039 + timestamp: 1762979038025 +- conda: https://conda.anaconda.org/conda-forge/linux-64/xorg-libxext-1.3.6-hb9d3cd8_0.conda + sha256: da5dc921c017c05f38a38bd75245017463104457b63a1ce633ed41f214159c14 + md5: febbab7d15033c913d53c7a2c102309d + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=13 + - xorg-libx11 >=1.8.10,<2.0a0 + license: MIT + license_family: MIT + size: 50060 + timestamp: 1727752228921 +- conda: https://conda.anaconda.org/conda-forge/linux-64/xorg-libxext-1.3.7-hb03c661_0.conda + sha256: 79c60fc6acfd3d713d6340d3b4e296836a0f8c51602327b32794625826bd052f + md5: 34e54f03dfea3e7a2dcf1453a85f1085 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - xorg-libx11 >=1.8.12,<2.0a0 + license: MIT + license_family: MIT + size: 50326 + timestamp: 1769445253162 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/xorg-libxext-1.3.6-h57736b2_0.conda + sha256: 8e216b024f52e367463b4173f237af97cf7053c77d9ce3e958bc62473a053f71 + md5: bd1e86dd8aa3afd78a4bfdb4ef918165 + depends: + - libgcc >=13 + - xorg-libx11 >=1.8.9,<2.0a0 + license: MIT + license_family: MIT + size: 50746 + timestamp: 1727754268156 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/xorg-libxext-1.3.7-he30d5cf_0.conda + sha256: db2188bc0d844d4e9747bac7f6c1d067e390bd769c5ad897c93f1df759dc5dba + md5: fb42b683034619915863d68dd9df03a3 + depends: + - libgcc >=14 + - xorg-libx11 >=1.8.12,<2.0a0 + license: MIT + license_family: MIT + size: 52409 + timestamp: 1769446753771 +- conda: https://conda.anaconda.org/conda-forge/linux-64/xorg-libxfixes-6.0.2-hb03c661_0.conda + sha256: 83c4c99d60b8784a611351220452a0a85b080668188dce5dfa394b723d7b64f4 + md5: ba231da7fccf9ea1e768caf5c7099b84 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - xorg-libx11 >=1.8.12,<2.0a0 + license: MIT + license_family: MIT + size: 20071 + timestamp: 1759282564045 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/xorg-libxfixes-6.0.2-he30d5cf_0.conda + sha256: 8cb9c88e25c57e47419e98f04f9ef3154ad96b9f858c88c570c7b91216a64d0e + md5: e8b4056544341daf1d415eaeae7a040c + depends: + - libgcc >=14 + - xorg-libx11 >=1.8.12,<2.0a0 + license: MIT + license_family: MIT + size: 20704 + timestamp: 1759284028146 +- conda: https://conda.anaconda.org/conda-forge/linux-64/xorg-libxi-1.8.2-hb9d3cd8_0.conda + sha256: 1a724b47d98d7880f26da40e45f01728e7638e6ec69f35a3e11f92acd05f9e7a + md5: 17dcc85db3c7886650b8908b183d6876 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=13 + - xorg-libx11 >=1.8.10,<2.0a0 + - xorg-libxext >=1.3.6,<2.0a0 + - xorg-libxfixes >=6.0.1,<7.0a0 + license: MIT + license_family: MIT + size: 47179 + timestamp: 1727799254088 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/xorg-libxi-1.8.2-h57736b2_0.conda + sha256: 7b587407ecb9ccd2bbaf0fb94c5dbdde4d015346df063e9502dc0ce2b682fb5e + md5: eeee3bdb31c6acde2b81ad1b8c287087 + depends: + - libgcc >=13 + - xorg-libx11 >=1.8.9,<2.0a0 + - xorg-libxext >=1.3.6,<2.0a0 + - xorg-libxfixes >=6.0.1,<7.0a0 + license: MIT + license_family: MIT + size: 48197 + timestamp: 1727801059062 +- conda: https://conda.anaconda.org/conda-forge/linux-64/xorg-libxrandr-1.5.4-hb9d3cd8_0.conda + sha256: ac0f037e0791a620a69980914a77cb6bb40308e26db11698029d6708f5aa8e0d + md5: 2de7f99d6581a4a7adbff607b5c278ca + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=13 + - xorg-libx11 >=1.8.10,<2.0a0 + - xorg-libxext >=1.3.6,<2.0a0 + - xorg-libxrender >=0.9.11,<0.10.0a0 + license: MIT + license_family: MIT + size: 29599 + timestamp: 1727794874300 +- conda: https://conda.anaconda.org/conda-forge/linux-64/xorg-libxrandr-1.5.5-hb03c661_0.conda + sha256: 80ed047a5cb30632c3dc5804c7716131d767089f65877813d4ae855ee5c9d343 + md5: e192019153591938acf7322b6459d36e + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - xorg-libx11 >=1.8.12,<2.0a0 + - xorg-libxext >=1.3.6,<2.0a0 + - xorg-libxrender >=0.9.12,<0.10.0a0 + license: MIT + license_family: MIT + size: 30456 + timestamp: 1769445263457 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/xorg-libxrandr-1.5.4-h86ecc28_0.conda + sha256: b2588a2b101d1b0a4e852532c8b9c92c59ef584fc762dd700567bdbf8cd00650 + md5: dd3e74283a082381aa3860312e3c721e + depends: + - libgcc >=13 + - xorg-libx11 >=1.8.9,<2.0a0 + - xorg-libxext >=1.3.6,<2.0a0 + - xorg-libxrender >=0.9.11,<0.10.0a0 + license: MIT + license_family: MIT + size: 30197 + timestamp: 1727794957221 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/xorg-libxrandr-1.5.5-he30d5cf_0.conda + sha256: 9f5196665a8d72f4f119c40dcc4bafeb0b540b102cc7b8b299c2abf599e7919f + md5: 1f64c613f0b8d67e9fb0e165d898fb6b + depends: + - libgcc >=14 + - xorg-libx11 >=1.8.12,<2.0a0 + - xorg-libxext >=1.3.6,<2.0a0 + - xorg-libxrender >=0.9.12,<0.10.0a0 + license: MIT + license_family: MIT + size: 31122 + timestamp: 1769445286951 +- conda: https://conda.anaconda.org/conda-forge/linux-64/xorg-libxrender-0.9.12-hb9d3cd8_0.conda + sha256: 044c7b3153c224c6cedd4484dd91b389d2d7fd9c776ad0f4a34f099b3389f4a1 + md5: 96d57aba173e878a2089d5638016dc5e + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=13 + - xorg-libx11 >=1.8.10,<2.0a0 + license: MIT + license_family: MIT + size: 33005 + timestamp: 1734229037766 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/xorg-libxrender-0.9.12-h86ecc28_0.conda + sha256: ffd77ee860c9635a28cfda46163dcfe9224dc6248c62404c544ae6b564a0be1f + md5: ae2c2dd0e2d38d249887727db2af960e + depends: + - libgcc >=13 + - xorg-libx11 >=1.8.10,<2.0a0 + license: MIT + license_family: MIT + size: 33649 + timestamp: 1734229123157 +- conda: https://conda.anaconda.org/conda-forge/linux-64/xorg-libxscrnsaver-1.2.4-hb9d3cd8_0.conda + sha256: 58e8fc1687534124832d22e102f098b5401173212ac69eb9fd96b16a3e2c8cb2 + md5: 303f7a0e9e0cd7d250bb6b952cecda90 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=13 + - xorg-libx11 >=1.8.10,<2.0a0 + - xorg-libxext >=1.3.6,<2.0a0 + license: MIT + license_family: MIT + size: 14412 + timestamp: 1727899730073 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/xorg-libxscrnsaver-1.2.4-h86ecc28_0.conda + sha256: ab88b1533e7498baeb00cbda50c899a6fe73eaee14df32c57b8ad3f2a0b3cc26 + md5: 7a0a04defd4399a93936f06fcfac5531 + depends: + - libgcc >=13 + - xorg-libx11 >=1.8.12,<2.0a0 + - xorg-libxext >=1.3.6,<2.0a0 + license: MIT + license_family: MIT + size: 15720 + timestamp: 1750007336692 +- conda: https://conda.anaconda.org/conda-forge/linux-64/xorg-libxtst-1.2.5-hb9d3cd8_3.conda + sha256: 752fdaac5d58ed863bbf685bb6f98092fe1a488ea8ebb7ed7b606ccfce08637a + md5: 7bbe9a0cc0df0ac5f5a8ad6d6a11af2f + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=13 + - xorg-libx11 >=1.8.10,<2.0a0 + - xorg-libxext >=1.3.6,<2.0a0 + - xorg-libxi >=1.7.10,<2.0a0 + license: MIT + license_family: MIT + size: 32808 + timestamp: 1727964811275 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/xorg-libxtst-1.2.5-h57736b2_3.conda + sha256: 6eaffce5a34fc0a16a21ddeaefb597e792a263b1b0c387c1ce46b0a967d558e1 + md5: c05698071b5c8e0da82a282085845860 + depends: + - libgcc >=13 + - xorg-libx11 >=1.8.9,<2.0a0 + - xorg-libxext >=1.3.6,<2.0a0 + - xorg-libxi >=1.7.10,<2.0a0 + license: MIT + license_family: MIT + size: 33786 + timestamp: 1727964907993 +- conda: https://conda.anaconda.org/conda-forge/linux-64/yaml-0.2.5-h280c20c_3.conda + sha256: 6d9ea2f731e284e9316d95fa61869fe7bbba33df7929f82693c121022810f4ad + md5: a77f85f77be52ff59391544bfe73390a + depends: + - libgcc >=14 + - __glibc >=2.17,<3.0.a0 + license: MIT + license_family: MIT + purls: [] + size: 85189 + timestamp: 1753484064210 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/yaml-0.2.5-h80f16a2_3.conda + sha256: 66265e943f32ce02396ad214e27cb35f5b0490b3bd4f064446390f9d67fa5d88 + md5: 032d8030e4a24fe1f72c74423a46fb88 + depends: + - libgcc >=14 + license: MIT + license_family: MIT + purls: [] + size: 88088 + timestamp: 1753484092643 +- conda: https://conda.anaconda.org/conda-forge/win-64/yaml-0.2.5-h6a83c73_3.conda + sha256: 80ee68c1e7683a35295232ea79bcc87279d31ffeda04a1665efdb43cbd50a309 + md5: 433699cba6602098ae8957a323da2664 + depends: + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + - ucrt >=10.0.20348.0 + license: MIT + license_family: MIT + purls: [] + size: 63944 + timestamp: 1753484092156 +- conda: https://conda.anaconda.org/conda-forge/linux-64/zeromq-4.3.5-h41580af_10.conda + sha256: 325d370b28e2b9cc1f765c5b4cdb394c91a5d958fbd15da1a14607a28fee09f6 + md5: 755b096086851e1193f3b10347415d7c + depends: + - libgcc >=14 + - __glibc >=2.17,<3.0.a0 + - libstdcxx >=14 + - krb5 >=1.22.2,<1.23.0a0 + - libsodium >=1.0.21,<1.0.22.0a0 + license: MPL-2.0 + license_family: MOZILLA + purls: [] + size: 311150 + timestamp: 1772476812121 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/zeromq-4.3.5-hc0523f8_10.conda + sha256: 32f77d565687a8241ebfb66fe630dcb197efc84f6a8b59df8260b1191b7deb2c + md5: ac79d51c73c8fbe6ef6e9067191b7f1a + depends: + - libgcc >=14 + - libstdcxx >=14 + - libsodium >=1.0.21,<1.0.22.0a0 + - krb5 >=1.22.2,<1.23.0a0 + license: MPL-2.0 + license_family: MOZILLA + purls: [] + size: 350773 + timestamp: 1772476818466 +- conda: https://conda.anaconda.org/conda-forge/win-64/zeromq-4.3.5-h507cc87_10.conda + sha256: b8568dfde46edf3455458912ea6ffb760e4456db8230a0cf34ecbc557d3c275f + md5: 1ab0237036bfb14e923d6107473b0021 + depends: + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + - ucrt >=10.0.20348.0 + - libsodium >=1.0.21,<1.0.22.0a0 + - krb5 >=1.22.2,<1.23.0a0 + license: MPL-2.0 + license_family: MOZILLA + purls: [] + size: 265665 + timestamp: 1772476832995 +- conda: https://conda.anaconda.org/conda-forge/noarch/zipp-3.23.0-pyhcf101f3_1.conda + sha256: b4533f7d9efc976511a73ef7d4a2473406d7f4c750884be8e8620b0ce70f4dae + md5: 30cd29cb87d819caead4d55184c1d115 + depends: + - python >=3.10 + - python + license: MIT + license_family: MIT + purls: + - pkg:pypi/zipp?source=hash-mapping + size: 24194 + timestamp: 1764460141901 +- conda: https://conda.anaconda.org/conda-forge/linux-64/zstd-1.5.7-hb78ec9c_6.conda + sha256: 68f0206ca6e98fea941e5717cec780ed2873ffabc0e1ed34428c061e2c6268c7 + md5: 4a13eeac0b5c8e5b8ab496e6c4ddd829 + depends: + - __glibc >=2.17,<3.0.a0 + - libzlib >=1.3.1,<2.0a0 + license: BSD-3-Clause + purls: [] + size: 601375 + timestamp: 1764777111296 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/zstd-1.5.7-h85ac4a6_6.conda + sha256: 569990cf12e46f9df540275146da567d9c618c1e9c7a0bc9d9cfefadaed20b75 + md5: c3655f82dcea2aa179b291e7099c1fcc + depends: + - libzlib >=1.3.1,<2.0a0 + license: BSD-3-Clause + purls: [] + size: 614429 + timestamp: 1764777145593 +- conda: https://conda.anaconda.org/conda-forge/win-64/zstd-1.5.7-h534d264_6.conda + sha256: 368d8628424966fd8f9c8018326a9c779e06913dd39e646cf331226acc90e5b2 + md5: 053b84beec00b71ea8ff7a4f84b55207 + depends: + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + - ucrt >=10.0.20348.0 + - libzlib >=1.3.1,<2.0a0 + license: BSD-3-Clause + purls: [] + size: 388453 + timestamp: 1764777142545 diff --git a/cuda_bindings/pixi.toml b/cuda_bindings/pixi.toml new file mode 100644 index 00000000000..943d57e11bb --- /dev/null +++ b/cuda_bindings/pixi.toml @@ -0,0 +1,178 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +[workspace] +channels = ["conda-forge"] +platforms = ["linux-64", "linux-aarch64", "win-64"] +preview = ["pixi-build"] + +[workspace.build-variants] +python = ["3.10.*", "3.11.*", "3.12.*", "3.13.*", "3.14.*"] +# Keep source-package metadata aligned with the consuming environment's CUDA major. +cuda-version = ["12.*", "13.3.*"] + +[feature.test.dependencies] +cuda-bindings = { path = "." } +pytest = ">=6.2.4" +pytest-benchmark = ">=3.4.1" +pytest-randomly = "*" +pytest-repeat = "*" +pyglet = ">=2.1.9" +numpy = "*" + +# Keep this dependency set aligned with cuda_python/docs/environment-docs.yml. +[feature.docs.dependencies] +cuda-bindings = "13.2.*" +python = "3.12.*" +cython = "*" +enum_tools = "*" +make = "*" +myst-nb = "*" +myst-parser = "*" +numpy = "*" +numpydoc = "*" +pip = "*" +pydata-sphinx-theme = "*" +pytest = "*" +scipy = "*" +sphinx = "<8.2.0" +sphinx-copybutton = "*" +sphinx-toolbox = "*" + +[feature.cython-tests.dependencies] +cython = ">=3.2,<3.3" # for tests that exercise APIs from cython +setuptools = "*" # for distutils +gxx = "*" # to compile the generated code +# These are necessary because running the Cython tests requires compiling +# *after* the package is built, and the Cython tests depend on CUDA headers +# transitively (through cuda-bindings) +cuda-cudart-dev = "*" +cuda-profiler-api = "*" + +[feature.cython-tests.target.linux-64.dependencies] +cuda-crt-dev_linux-64 = "*" + +[feature.cython-tests.target.linux-aarch64.dependencies] +cuda-crt-dev_linux-aarch64 = "*" + +[feature.cython-tests.target.win-64.dependencies] +cuda-crt-dev_win-64 = "*" + +# For finding headers when building the Cython tests +[feature.cython-tests.target.linux-64.activation.env] +CUDA_HOME = "$CONDA_PREFIX/targets/x86_64-linux" + +[feature.cython-tests.target.linux-aarch64.activation.env] +CUDA_HOME = "$CONDA_PREFIX/targets/sbsa-linux" + +[feature.cython-tests.target.win-64.activation.env] +CUDA_HOME = "$CONDA_PREFIX/Library" + +[feature.cu12.dependencies] +cuda-version = "12.*" + +[feature.cu13.dependencies] +cuda-version = "13.3.*" + +[environments] +default = { features = ["test", "cython-tests"], solve-group = "default" } +cu13 = { features = ["cu13", "test", "cython-tests"], solve-group = "cu13" } +cu12 = { features = ["cu12", "test", "cython-tests"], solve-group = "cu12" } +docs = { features = ["cu13", "docs"], solve-group = "docs" } + +[feature.docs.pypi-dependencies] +nvidia-sphinx-theme = "*" + +# TODO: check if these can be extracted from pyproject.toml +[package] +name = "cuda-bindings" +version = "13.2.0" + +[package.build] +backend = { name = "pixi-build-python", version = "*" } + +[package.build.config] +compilers = ["c", "cxx"] + +[package.build.target.linux-64.config.env] +CUDA_HOME = "$PREFIX/targets/x86_64-linux" +CUDA_PYTHON_PARALLEL_LEVEL = "$(nproc)" + +[package.build.target.linux-aarch64.config.env] +CUDA_HOME = "$PREFIX/targets/sbsa-linux" +CUDA_PYTHON_PARALLEL_LEVEL = "$(nproc)" + +[package.build.target.win-64.config.env] +CUDA_HOME = "$PREFIX/Library" + +# TODO: revisit this +# [package.build-dependencies] +# ccache = "*" + +[package.host-dependencies] +python = "*" +cuda-version = "*" +setuptools = ">=80" +setuptools-scm = ">=8" +cython = ">=3.2,<3.3" +cuda-pathfinder = { path = "../cuda_pathfinder" } +cuda-cudart-static = "*" +cuda-nvrtc-dev = "*" +cuda-profiler-api = "*" +cuda-nvvm = "*" + +[package.target.linux.host-dependencies] +libcufile-dev = "*" + +[package.target.linux-64.host-dependencies] +cuda-crt-dev_linux-64 = "*" + +[package.target.linux-aarch64.host-dependencies] +cuda-crt-dev_linux-aarch64 = "*" + +[package.target.win-64.host-dependencies] +cuda-crt-dev_win-64 = "*" + +[package.run-dependencies] +python = "*" +cuda-version = "*" +cuda-pathfinder = { path = "../cuda_pathfinder" } +libnvjitlink = "*" +cuda-nvrtc = "*" +cuda-nvvm = "*" +libnvfatbin = "*" + +[package.target.linux.run-dependencies] +libcufile = "*" + +[target.linux.tasks.build-cython-tests] +cmd = ["$PIXI_PROJECT_ROOT/tests/cython/build_tests.sh"] + +[target.win-64.tasks.build-cython-tests] +cmd = ["$PIXI_PROJECT_ROOT/tests/cython/build_tests.bat"] + +[target.linux.tasks.test] +cmd = [ + "pytest", + "$PIXI_PROJECT_ROOT", + "--override-ini", + "norecursedirs=examples", # include cython tests (ignore by default config) +] +depends-on = [{ task = "build-cython-tests" }] + +[target.linux.tasks.build-docs] +cmd = [ + "bash", + "-lc", + "rm -rf \"$PIXI_PROJECT_ROOT/docs/build\" \"$PIXI_PROJECT_ROOT/docs/source/generated\" && cd \"$PIXI_PROJECT_ROOT/docs\" && ./build_docs.sh", +] + +[target.win-64.tasks.test] +cmd = [ + "pytest", + "$PIXI_PROJECT_ROOT", + "--override-ini", + "norecursedirs=examples", # include cython tests (ignore by default config) +] +depends-on = [{ task = "build-cython-tests" }] diff --git a/cuda_bindings/pyproject.toml b/cuda_bindings/pyproject.toml new file mode 100644 index 00000000000..9744a0a009b --- /dev/null +++ b/cuda_bindings/pyproject.toml @@ -0,0 +1,107 @@ +# SPDX-FileCopyrightText: Copyright (c) 2023-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 +[build-system] +requires = [ + "setuptools>=80.0.0", + "setuptools_scm[simple]>=8,!=10.1", + "cython>=3.2,<3.3", + "cuda-pathfinder>=1.5", +] +build-backend = "build_hooks" +backend-path = ["."] + +[project] +name = "cuda-bindings" +description = "Python bindings for CUDA" +authors = [ + { name = "NVIDIA Corporation", email = "cuda-python-conduct@nvidia.com" }, +] +license = "Apache-2.0" +license-files = ["LICENSE"] +requires-python = ">=3.10" +classifiers = [ + "Intended Audience :: Developers", + "Topic :: Database", + "Topic :: Scientific/Engineering", + "Programming Language :: Python", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", + "Environment :: GPU :: NVIDIA CUDA", +] +dynamic = ["version", "readme"] +dependencies = ["cuda-pathfinder >=1.4.2"] + +[project.optional-dependencies] +all = [ + "cuda-toolkit[nvrtc,nvjitlink,nvvm,nvfatbin]==13.*", + "cuda-toolkit[cufile]==13.*; sys_platform == 'linux'", + "cuda-toolkit==13.*", + "nvidia-cudla==13.*; platform_system == 'Linux' and platform_machine == 'aarch64'", +] + +[dependency-groups] +test = [ + "cython>=3.2,<3.3", + "setuptools>=80.0.0", + # TODO: remove the Python 3.15 guard once 3.15 is officially supported + "matplotlib>=3.5.0,<=3.10.9; python_version < '3.15'", + "numpy>=1.21.1,<=2.5.0", + "pytest==9.1.0", + "pytest-benchmark==5.2.3", + "pytest-repeat==0.9.4", + "pytest-randomly==4.1.0", + "pyglet==2.1.14", +] + +[project.urls] +Repository = "https://github.com/NVIDIA/cuda-python" +Documentation = "https://nvidia.github.io/cuda-python/" + +[tool.setuptools.packages.find] +include = ["cuda*"] + +[tool.setuptools] +include-package-data = false + +[tool.setuptools.package-data] +"*" = ["*.pxd", "*.pxi"] +"cuda.bindings._bindings" = ["*.h"] +"cuda.bindings._lib" = ["*.h"] + +[tool.setuptools.dynamic] +readme = { file = ["DESCRIPTION.rst"], content-type = "text/x-rst" } + +[tool.cibuildwheel] +skip = "*-musllinux_*" +build-verbosity = 1 + +[tool.cibuildwheel.linux] +archs = "native" + +[tool.cibuildwheel.windows] +archs = "AMD64" +before-build = "pip install delvewheel" +repair-wheel-command = "delvewheel repair --namespace-pkg cuda -w {dest_dir} {wheel}" + +[tool.pytest.ini_options] +required_plugins = "pytest-benchmark" +addopts = "--benchmark-disable --showlocals" +norecursedirs = ["tests/cython", "examples"] +xfail_strict = true +# Keep this authorship marker registry in sync across all pytest config roots. +# Search for "agent_authored(model)" before editing. +markers = [ + "agent_authored(model): agent-authored test not yet materially human-reviewed", + "human_reviewed: agent-authored test materially reviewed or rewritten by a human", + "human_authored: test authored primarily by a human", +] + +[tool.setuptools_scm] +root = ".." +version_file = "cuda/bindings/_version.py" +# Preserve a/b pre-release suffixes, but intentionally strip rc suffixes. +tag_regex = "^(?Pv\\d+\\.\\d+\\.\\d+(?:[ab]\\d+)?)" +git_describe_command = ["git", "describe", "--dirty", "--tags", "--long", "--match", "v*[0-9]*"] diff --git a/cuda_bindings/setup.py b/cuda_bindings/setup.py new file mode 100644 index 00000000000..4cfffcf6e1a --- /dev/null +++ b/cuda_bindings/setup.py @@ -0,0 +1,67 @@ +# SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +import functools +import os +import subprocess +from warnings import warn + +import build_hooks +from setuptools import setup +from setuptools.command.build_ext import build_ext as _build_ext +from setuptools.command.build_py import build_py as _build_py + +if os.environ.get("PARALLEL_LEVEL") is not None: + warn( + "Environment variable PARALLEL_LEVEL is deprecated. Use CUDA_PYTHON_PARALLEL_LEVEL instead", + DeprecationWarning, + stacklevel=1, + ) + nthreads = int(os.environ.get("PARALLEL_LEVEL", "0")) +else: + nthreads = int(os.environ.get("CUDA_PYTHON_PARALLEL_LEVEL", "0") or "0") + +coverage_mode = bool(int(os.environ.get("CUDA_PYTHON_COVERAGE", "0"))) + + +def _is_clang(compiler): + @functools.lru_cache + def _check(compiler_cxx): + try: + output = subprocess.check_output([*compiler_cxx, "--version"]) # noqa: S603 + except subprocess.CalledProcessError: + return False + lines = output.decode().splitlines() + return len(lines) > 0 and "clang" in lines[0] + + if not hasattr(compiler, "compiler_cxx"): + return False + return _check(tuple(compiler.compiler_cxx)) + + +class build_ext(_build_ext): + def build_extensions(self): + if nthreads > 0: + self.parallel = nthreads + if _is_clang(self.compiler): + for ext in self.extensions: + ext.extra_compile_args = [a for a in ext.extra_compile_args if a != "-fno-var-tracking-assignments"] + super().build_extensions() + + +class build_py(_build_py): + def finalize_options(self): + super().finalize_options() + if coverage_mode: + self.package_data.setdefault("", []) + self.package_data[""] += ["*.pyx", "*.cpp"] + + +setup( + ext_modules=build_hooks._extensions, + cmdclass={ + "build_ext": build_ext, + "build_py": build_py, + }, + zip_safe=False, +) diff --git a/cuda_bindings/tests/conftest.py b/cuda_bindings/tests/conftest.py new file mode 100644 index 00000000000..1618d63a133 --- /dev/null +++ b/cuda_bindings/tests/conftest.py @@ -0,0 +1,125 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +import functools +import inspect +import pathlib +import sys +from contextlib import contextmanager +from importlib.metadata import PackageNotFoundError, distribution + +import pytest + +import cuda.bindings.driver as cuda + +# Import shared test helpers for tests across subprojects. +# PLEASE KEEP IN SYNC with copies in other conftest.py in this repo. +_test_helpers_root = pathlib.Path(__file__).resolve().parents[2] / "cuda_python_test_helpers" +try: + distribution("cuda-python-test-helpers") +except PackageNotFoundError as exc: + if not _test_helpers_root.is_dir(): + raise RuntimeError( + f"cuda-python-test-helpers not installed; expected checkout path {_test_helpers_root}" + ) from exc + + test_helpers_root = str(_test_helpers_root) + if test_helpers_root not in sys.path: + sys.path.insert(0, test_helpers_root) + + +def pytest_configure(config): + # When using `parallel-threads` set up mini-plugin to ensure each thread has a CUDA context + parallel_threads = getattr(config.option, "parallel_threads", 0) + if parallel_threads == "auto" or int(parallel_threads) > 1: + config.pluginmanager.register(_CudaBindingsParallelPlugin(), name="_cuda_bindings_parallel_plugin") + + +@contextmanager +def _thread_context(): + # Context setting up `device` and `ctx` for individual threads on + # pytest-run-parallel + err, device = cuda.cuDeviceGet(0) + assert err == cuda.CUresult.CUDA_SUCCESS + err, ctx = cuda.cuCtxCreate(None, 0, device) + assert err == cuda.CUresult.CUDA_SUCCESS + try: + yield device, ctx + finally: + (err,) = cuda.cuCtxDestroy(ctx) + assert err == cuda.CUresult.CUDA_SUCCESS + + +def _wrap_worker_cuda_test(func): + if getattr(func, "_cuda_bindings_worker_cuda_wrapped", False): + return func + + sig = inspect.signature(func) + wants_device = "device" in sig.parameters + wants_ctx = "ctx" in sig.parameters + + @functools.wraps(func) + def wrapper(*args, **kwargs): + kwargs = dict(kwargs) # copy before mutating + with _thread_context() as (device, ctx): + # device is None when reusing an existing context (defensive path); + # keep whatever the fixture provided in kwargs as-is. + if wants_device and device is not None: + kwargs["device"] = device + if wants_ctx: + kwargs["ctx"] = ctx + return func(*args, **kwargs) + + wrapper._cuda_bindings_worker_cuda_wrapped = True + return wrapper + + +def _item_needs_thread_ctx(item): + fixturenames = getattr(item, "fixturenames", ()) + # The 'device' fixture is the main fixture to set up a CUDA context. + # 'driver' is specific to the cufile tests and used there instead. + return "device" in fixturenames or "driver" in fixturenames + + +class _CudaBindingsParallelPlugin: + """A mini pytest plugin used only for pytest-run-parallel testing. + pytest-run-parallel spawns new threads for each test and we need to + initialize and pass the correct CUDA context for each these. + + This plugin looks for context specific fixtures and replaces them + new context specific fixtures may have to be added. + + + This plugin approach is not ideal, it would be nicer to introduce hooks + into pytest-run-parallel. Once that issue is closed this would be good + to refactor: https://github.com/Quansight-Labs/pytest-run-parallel/issues/189 + """ + + @pytest.hookimpl() + def pytest_collection_modifyitems(self, config, items): + for item in items: + if _item_needs_thread_ctx(item): + item.obj = _wrap_worker_cuda_test(item.obj) + + +@pytest.fixture(scope="module") +def cuda_driver(): + (err,) = cuda.cuInit(0) + assert err == cuda.CUresult.CUDA_SUCCESS + + +@pytest.fixture(scope="module") +def device(cuda_driver): + err, device = cuda.cuDeviceGet(0) + assert err == cuda.CUresult.CUDA_SUCCESS + return device + + +@pytest.fixture(scope="module", autouse=True) +def ctx(device): + # Construct context + err, ctx = cuda.cuCtxCreate(None, 0, device) + assert err == cuda.CUresult.CUDA_SUCCESS + yield ctx + (err,) = cuda.cuCtxDestroy(ctx) + assert err == cuda.CUresult.CUDA_SUCCESS diff --git a/cuda_bindings/tests/cudla/conftest.py b/cuda_bindings/tests/cudla/conftest.py new file mode 100644 index 00000000000..aa277bf9a9d --- /dev/null +++ b/cuda_bindings/tests/cudla/conftest.py @@ -0,0 +1,13 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +import pytest + + +@pytest.fixture(scope="module", autouse=True) +def ctx(): + """Override the parent conftest's ``ctx`` fixture which creates a CUDA + context. cuDLA tests do not require a CUDA context, so this no-op + prevents ``cuInit`` / ``cuCtxCreate`` from running (and failing on + machines without a CUDA-capable GPU).""" + return None diff --git a/cuda_bindings/tests/cudla/test_cudla_bindings.py b/cuda_bindings/tests/cudla/test_cudla_bindings.py new file mode 100644 index 00000000000..b95283fac84 --- /dev/null +++ b/cuda_bindings/tests/cudla/test_cudla_bindings.py @@ -0,0 +1,231 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +import pytest + +cudla = pytest.importorskip("cuda.bindings.cudla") + + +# --------------------------------------------------------------------------- +# Enum tests (always run -- no library needed) +# --------------------------------------------------------------------------- + + +class TestEnums: + def test_status_values(self): + assert cudla.Status.Success == 0 + assert cudla.Status.ErrorInvalidParam == 1 + assert cudla.Status.ErrorOutOfResources == 2 + assert cudla.Status.ErrorCreationFailed == 3 + assert cudla.Status.ErrorInvalidAddress == 4 + assert cudla.Status.ErrorOs == 5 + assert cudla.Status.ErrorCuda == 6 + assert cudla.Status.ErrorUmd == 7 + assert cudla.Status.ErrorInvalidDevice == 8 + assert cudla.Status.ErrorInvalidAttribute == 9 + assert cudla.Status.ErrorIncompatibleDlaSWVersion == 10 + assert cudla.Status.ErrorMemoryRegistered == 11 + assert cudla.Status.ErrorInvalidModule == 12 + assert cudla.Status.ErrorUnsupportedOperation == 13 + assert cudla.Status.ErrorNvSci == 14 + assert cudla.Status.ErrorDlaErrInvalidInput == 0x40000001 + assert cudla.Status.ErrorDlaErrInvalidPreAction == 0x40000002 + assert cudla.Status.ErrorDlaErrNoMem == 0x40000003 + assert cudla.Status.ErrorDlaErrProcessorBusy == 0x40000004 + assert cudla.Status.ErrorDlaErrTaskStatusMismatch == 0x40000005 + assert cudla.Status.ErrorDlaErrEngineTimeout == 0x40000006 + assert cudla.Status.ErrorDlaErrDataMismatch == 0x40000007 + assert cudla.Status.ErrorUnknown == 0x7FFFFFFF + + def test_status_member_count(self): + assert len(cudla.Status) == 24 + + def test_mode_values(self): + assert cudla.Mode.CUDA_DLA == 0 + assert cudla.Mode.STANDALONE == 1 + + def test_module_attribute_type_values(self): + assert cudla.ModuleAttributeType.NUM_INPUT_TENSORS == 0 + assert cudla.ModuleAttributeType.NUM_OUTPUT_TENSORS == 1 + assert cudla.ModuleAttributeType.INPUT_TENSOR_DESCRIPTORS == 2 + assert cudla.ModuleAttributeType.OUTPUT_TENSOR_DESCRIPTORS == 3 + assert cudla.ModuleAttributeType.NUM_OUTPUT_TASK_STATISTICS == 4 + assert cudla.ModuleAttributeType.OUTPUT_TASK_STATISTICS_DESCRIPTORS == 5 + + def test_fence_type_values(self): + assert cudla.FenceType.NVSCISYNC_FENCE == 1 + assert cudla.FenceType.NVSCISYNC_FENCE_SOF == 2 + + def test_module_load_flags(self): + assert cudla.ModuleLoadFlags.MODULE_DEFAULT == 0 + assert cudla.ModuleLoadFlags.MODULE_ENABLE_FAULT_DIAGNOSTICS == 1 + + def test_submission_flags(self): + assert cudla.SubmissionFlags.SUBMIT_NOOP == 1 + assert cudla.SubmissionFlags.SUBMIT_SKIP_LOCK_ACQUIRE == 2 + assert cudla.SubmissionFlags.SUBMIT_DIAGNOSTICS_TASK == 4 + + def test_access_permission_flags(self): + assert cudla.AccessPermissionFlags.READ_WRITE_PERM == 0 + assert cudla.AccessPermissionFlags.READ_ONLY_PERM == 1 + assert cudla.AccessPermissionFlags.TASK_STATISTICS == 2 + + def test_dev_attribute_type(self): + assert cudla.DevAttributeType.UNIFIED_ADDRESSING == 0 + assert cudla.DevAttributeType.DEVICE_VERSION == 1 + + +# --------------------------------------------------------------------------- +# POD type tests (always run -- no library needed) +# --------------------------------------------------------------------------- + + +class TestPodTypes: + def test_external_memory_handle_desc(self): + desc = cudla.ExternalMemoryHandleDesc() + desc.size_ = 4096 + assert desc.size_ == 4096 + desc.ext_buf_object = 0xABCD + assert desc.ext_buf_object == 0xABCD + + def test_external_semaphore_handle_desc(self): + desc = cudla.ExternalSemaphoreHandleDesc() + desc.ext_sync_object = 0x1234 + assert desc.ext_sync_object == 0x1234 + + def test_module_tensor_descriptor_fields(self): + desc = cudla.ModuleTensorDescriptor() + assert desc.size_ == 0 + assert desc.n == 0 + assert desc.c == 0 + assert desc.h == 0 + assert desc.w == 0 + assert desc.data_format == 0 + assert desc.data_type == 0 + assert desc.data_category == 0 + assert desc.pixel_format == 0 + assert desc.pixel_mapping == 0 + + def test_module_tensor_descriptor_name(self): + desc = cudla.ModuleTensorDescriptor() + name = desc.name + assert isinstance(name, (str, bytes)) + + def test_module_tensor_descriptor_stride(self): + desc = cudla.ModuleTensorDescriptor() + stride = desc.stride + assert len(stride) == 8 + + def test_fence(self): + fence = cudla.Fence() + fence.fence = 0xBEEF + assert fence.fence == 0xBEEF + fence.type = int(cudla.FenceType.NVSCISYNC_FENCE) + assert fence.type == 1 + + def test_dev_attribute(self): + attr = cudla.DevAttribute() + assert attr.unified_addressing_supported == 0 + assert attr.device_version == 0 + attr.unified_addressing_supported = 1 + assert attr.unified_addressing_supported == 1 + attr.device_version = 0x20 + assert attr.device_version == 0x20 + + def test_module_attribute(self): + attr = cudla.ModuleAttribute() + assert attr.num_input_tensors == 0 + assert attr.num_output_tensors == 0 + attr.num_input_tensors = 3 + assert attr.num_input_tensors == 3 + attr.num_output_tensors = 1 + assert attr.num_output_tensors == 1 + + def test_wait_events(self): + we = cudla.WaitEvents() + assert we.pre_fences == [] + + def test_signal_events(self): + se = cudla.SignalEvents() + assert se.eof_fences == [] + + def test_task_construction(self): + task = cudla.Task() + task.module_handle = 0xDEAD + assert task.module_handle == 0xDEAD + + def test_task_input_tensor_auto_size(self): + task = cudla.Task() + task.input_tensor = [0x1000, 0x2000, 0x3000] + assert len(task.input_tensor) == 3 + + def test_task_output_tensor_auto_size(self): + task = cudla.Task() + task.output_tensor = [0x4000] + assert len(task.output_tensor) == 1 + + def test_task_combined(self): + task = cudla.Task() + task.module_handle = 0xABCD + task.input_tensor = [0x1000, 0x2000] + task.output_tensor = [0x3000] + task.wait_events = 0 + task.signal_events = 0 + assert task.module_handle == 0xABCD + assert len(task.input_tensor) == 2 + assert len(task.output_tensor) == 1 + + def test_pod_ptr_is_nonzero(self): + """Verify that int(pod) returns a nonzero pointer (memory is allocated).""" + task = cudla.Task() + assert int(task) != 0 + desc = cudla.ModuleTensorDescriptor() + assert int(desc) != 0 + + +# --------------------------------------------------------------------------- +# Error type tests (always run -- no library needed) +# --------------------------------------------------------------------------- + + +class TestErrorType: + def test_cudla_error_is_exception(self): + assert issubclass(cudla.CudlaError, Exception) + + def test_cudla_error_stores_status(self): + err = cudla.CudlaError(int(cudla.Status.ErrorInvalidParam)) + assert err.status == int(cudla.Status.ErrorInvalidParam) + + def test_cudla_error_str(self): + err = cudla.CudlaError(int(cudla.Status.ErrorInvalidParam)) + assert "ErrorInvalidParam" in str(err) + + +# --------------------------------------------------------------------------- +# API surface tests (always run -- no library needed) +# --------------------------------------------------------------------------- + + +class TestApiSurface: + """Verify that all expected functions exist as callable attributes.""" + + @pytest.mark.parametrize( + "func_name", + [ + "get_version", + "device_get_count", + "create_device", + "destroy_device", + "mem_register", + "mem_unregister", + "module_load_from_memory", + "module_get_attributes", + "module_unload", + "submit_task", + "device_get_attribute", + "get_last_error", + "set_task_timeout_in_ms", + ], + ) + def test_function_exists(self, func_name): + assert callable(getattr(cudla, func_name)) diff --git a/cuda_bindings/tests/cufile.json b/cuda_bindings/tests/cufile.json new file mode 100644 index 00000000000..21ab1f3b6bb --- /dev/null +++ b/cuda_bindings/tests/cufile.json @@ -0,0 +1,22 @@ +{ + // NOTE : Application can override custom configuration via export CUFILE_ENV_PATH_JSON= + // e.g : export CUFILE_ENV_PATH_JSON="/home//cufile.json" + + + "properties" : { + "allow_compat_mode" : true + }, + + "execution" : { + // max number of workitems in the queue; + "max_io_queue_depth": 128, + // max number of host threads per gpu to spawn for parallel IO + "max_io_threads" : 4, + // enable support for parallel IO + "parallel_io" : true, + // minimum IO threshold before splitting the IO + "min_io_threshold_size_kb" : 8192, + // maximum parallelism for a single request + "max_request_parallelism" : 4 + } +} diff --git a/cuda_bindings/tests/cython/build_tests.bat b/cuda_bindings/tests/cython/build_tests.bat new file mode 100644 index 00000000000..a59bcf53d05 --- /dev/null +++ b/cuda_bindings/tests/cython/build_tests.bat @@ -0,0 +1,10 @@ +@echo off + +REM SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +REM SPDX-License-Identifier: Apache-2.0 + +setlocal + set CL=%CL% /I"%CUDA_HOME%\include" + REM Use -j 1 to side-step any process-pool issues and ensure deterministic single-threaded builds + cythonize -3 -j 1 -i -Xfreethreading_compatible=True %~dp0test_*.pyx +endlocal diff --git a/cuda_bindings/tests/cython/build_tests.py b/cuda_bindings/tests/cython/build_tests.py new file mode 100644 index 00000000000..ac22e1fd962 --- /dev/null +++ b/cuda_bindings/tests/cython/build_tests.py @@ -0,0 +1,61 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 +"""Build cuda_bindings Cython test extensions in-place. + +pixi-build's editable install exposes the `cuda` namespace package via a +PEP 660 finder hook. Python's import machinery honors the hook, but +Cython's filesystem .pxd resolver only walks real directories on sys.path, +so `cimport cuda.bindings.*` fails to locate the .pxd files. We resolve +the namespace package's source root from `cuda.bindings.__file__` and pass +it via `include_path=` so cythonize finds the .pxd tree on every platform. +""" + +from __future__ import annotations + +import os +import sys +from pathlib import Path + +from Cython.Build import cythonize +from setuptools import setup + +import cuda.bindings + + +def _bindings_source_root() -> Path: + # cuda.bindings.__file__ -> ...//cuda/bindings/__init__.py + root = Path(cuda.bindings.__file__).resolve().parents[2] + if not (root / "cuda" / "bindings").is_dir(): + raise RuntimeError( + f"cuda.bindings source tree not found at {root}; pixi-build editable install layout may have changed." + ) + return root + + +def main() -> None: + script_dir = Path(__file__).resolve().parent + pyx_files = sorted(str(p) for p in script_dir.glob("test_*.pyx")) + if not pyx_files: + raise SystemExit(f"no test_*.pyx files under {script_dir}") + + ext_modules = cythonize( + pyx_files, + language_level=3, + nthreads=1, + include_path=[str(_bindings_source_root())], + compiler_directives={"freethreading_compatible": True}, + ) + + # `build_ext --inplace` places the compiled .so relative to the current + # working directory, but pixi runs this task from the project root. pytest + # imports each extension by bare module name (see test_cython.py), which + # only resolves when the .so sits in tests/cython (the dir pytest puts on + # sys.path). chdir here so the .so lands next to its .pyx regardless of the + # invoking cwd. + os.chdir(script_dir) + sys.argv = [sys.argv[0], "build_ext", "--inplace"] + setup(name="cuda_bindings_cython_tests", ext_modules=ext_modules) + + +if __name__ == "__main__": + main() diff --git a/cuda_bindings/tests/cython/build_tests.sh b/cuda_bindings/tests/cython/build_tests.sh new file mode 100755 index 00000000000..0ca0745d2b4 --- /dev/null +++ b/cuda_bindings/tests/cython/build_tests.sh @@ -0,0 +1,23 @@ +#!/bin/bash +set -eo pipefail + +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +UNAME=$(uname) +if [ "$UNAME" == "Linux" ] ; then + SCRIPTPATH=$(dirname $(realpath "$0")) + export CPLUS_INCLUDE_PATH=$CUDA_HOME/include:${CPLUS_INCLUDE_PATH:-} +elif [[ "$UNAME" == CYGWIN* || "$UNAME" == MINGW* || "$UNAME" == MSYS* ]] ; then + SCRIPTPATH="$(dirname $(cygpath -w $(realpath "$0")))" + export CL="/I\"${CUDA_HOME}\\include\" ${CL:-}" +else + exit 1 +fi + +# Use a Python driver so the cuda.bindings source root is resolved at +# runtime and passed via Cython's include_path -- avoids platform-specific +# PYTHONPATH separator handling and surfaces import errors as exceptions. +# nthreads=1 inside the driver mirrors the previous `-j 1` to side-step +# any process-pool issues and keep builds deterministic. +python "${SCRIPTPATH}/build_tests.py" diff --git a/cuda/tests/test_ccuda.pyx b/cuda_bindings/tests/cython/test_ccuda.pyx similarity index 67% rename from cuda/tests/test_ccuda.pyx rename to cuda_bindings/tests/cython/test_ccuda.pyx index 9bd08650544..4af8a84ba75 100644 --- a/cuda/tests/test_ccuda.pyx +++ b/cuda_bindings/tests/cython/test_ccuda.pyx @@ -1,15 +1,12 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. -# -# Please refer to the NVIDIA end user license agreement (EULA) associated -# with this source code for terms and conditions that govern your use of -# this software. Any use, reproduction, disclosure, or distribution of -# this software and related documentation outside the terms of the EULA -# is strictly prohibited. +# SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +# distutils: language=c++ from libc.string cimport ( memset, memcmp ) -cimport cuda.ccuda as ccuda +cimport cuda.bindings.cydriver as ccuda def test_ccuda_memcpy(): # Init CUDA @@ -23,7 +20,7 @@ def test_ccuda_memcpy(): # Construct context cdef ccuda.CUcontext ctx - err = ccuda.cuCtxCreate(&ctx, 0, device) + err = ccuda.cuCtxCreate(&ctx, NULL, 0, device) assert(err == 0) # Allocate dev memory @@ -53,4 +50,4 @@ def test_ccuda_memcpy(): err = ccuda.cuMemFree(dptr) assert(err == 0) err = ccuda.cuCtxDestroy(ctx) - assert(err == 0) \ No newline at end of file + assert(err == 0) diff --git a/cuda/tests/test_ccudart.pyx b/cuda_bindings/tests/cython/test_ccudart.pyx similarity index 79% rename from cuda/tests/test_ccudart.pyx rename to cuda_bindings/tests/cython/test_ccudart.pyx index a871fa6f6a4..4460ceb618a 100644 --- a/cuda/tests/test_ccudart.pyx +++ b/cuda_bindings/tests/cython/test_ccudart.pyx @@ -1,15 +1,12 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. -# -# Please refer to the NVIDIA end user license agreement (EULA) associated -# with this source code for terms and conditions that govern your use of -# this software. Any use, reproduction, disclosure, or distribution of -# this software and related documentation outside the terms of the EULA -# is strictly prohibited. +# SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +# distutils: language=c++ from libc.string cimport ( memset, memcmp ) -cimport cuda.ccudart as ccudart +cimport cuda.bindings.cyruntime as ccudart def test_ccudart_memcpy(): # Allocate dev memory @@ -39,9 +36,9 @@ def test_ccudart_memcpy(): err = ccudart.cudaFree(dptr) assert(err == ccudart.cudaSuccess) -from cuda.ccudart cimport dim3 -from cuda.ccudart cimport cudaMemAllocationHandleType -from cuda.ccudart cimport CUuuid, cudaUUID_t +from cuda.bindings.cyruntime cimport dim3 +from cuda.bindings.cyruntime cimport cudaMemAllocationHandleType +from cuda.bindings.cyruntime cimport CUuuid, cudaUUID_t cdef extern from *: """ diff --git a/cuda_bindings/tests/cython/test_cython.py b/cuda_bindings/tests/cython/test_cython.py new file mode 100644 index 00000000000..a6f8133909e --- /dev/null +++ b/cuda_bindings/tests/cython/test_cython.py @@ -0,0 +1,36 @@ +# SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +import functools +import importlib +import sys + + +def py_func(func): + """ + Wraps func in a plain Python function. + """ + + @functools.wraps(func) + def wrapped(*args, **kwargs): + return func(*args, **kwargs) + + return wrapped + + +cython_test_modules = ["test_ccuda", "test_ccudart", "test_interoperability_cython"] + + +for mod in cython_test_modules: + try: + # For each callable in `mod` with name `test_*`, + # wrap the callable in a plain Python function + # and set the result as an attribute of this module. + mod = importlib.import_module(mod) + for name in dir(mod): + item = getattr(mod, name) + if callable(item) and name.startswith("test_"): + item = py_func(item) + setattr(sys.modules[__name__], name, item) + except ImportError: + raise diff --git a/cuda/tests/test_interoperability_cython.pyx b/cuda_bindings/tests/cython/test_interoperability_cython.pyx similarity index 90% rename from cuda/tests/test_interoperability_cython.pyx rename to cuda_bindings/tests/cython/test_interoperability_cython.pyx index 96b50ce5bb0..5278a10e38a 100644 --- a/cuda/tests/test_interoperability_cython.pyx +++ b/cuda_bindings/tests/cython/test_interoperability_cython.pyx @@ -1,18 +1,15 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. -# -# Please refer to the NVIDIA end user license agreement (EULA) associated -# with this source code for terms and conditions that govern your use of -# this software. Any use, reproduction, disclosure, or distribution of -# this software and related documentation outside the terms of the EULA -# is strictly prohibited. -import pytest -import cuda.cuda as cuda -import cuda.cudart as cudart -import numpy as np +# SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 -cimport cuda.ccuda as ccuda -cimport cuda.ccudart as ccudart +# distutils: language=c++ from libc.stdlib cimport calloc, free +import cuda.bindings.driver as cuda +import cuda.bindings.runtime as cudart +import numpy as np +import pytest + +cimport cuda.bindings.cydriver as ccuda +cimport cuda.bindings.cyruntime as ccudart def supportsMemoryPool(): @@ -25,7 +22,7 @@ def test_interop_stream(): assert(err_dr == cuda.CUresult.CUDA_SUCCESS) err_dr, device = cuda.cuDeviceGet(0) assert(err_dr == cuda.CUresult.CUDA_SUCCESS) - err_dr, ctx = cuda.cuCtxCreate(0, device) + err_dr, ctx = cuda.cuCtxCreate(None, 0, device) assert(err_dr == cuda.CUresult.CUDA_SUCCESS) # DRV to RT @@ -53,7 +50,7 @@ def test_interop_event(): assert(err_dr == cuda.CUresult.CUDA_SUCCESS) err_dr, device = cuda.cuDeviceGet(0) assert(err_dr == cuda.CUresult.CUDA_SUCCESS) - err_dr, ctx = cuda.cuCtxCreate(0, device) + err_dr, ctx = cuda.cuCtxCreate(None, 0, device) assert(err_dr == cuda.CUresult.CUDA_SUCCESS) # DRV to RT @@ -81,7 +78,7 @@ def test_interop_graph(): assert(err_dr == cuda.CUresult.CUDA_SUCCESS) err_dr, device = cuda.cuDeviceGet(0) assert(err_dr == cuda.CUresult.CUDA_SUCCESS) - err_dr, ctx = cuda.cuCtxCreate(0, device) + err_dr, ctx = cuda.cuCtxCreate(None, 0, device) assert(err_dr == cuda.CUresult.CUDA_SUCCESS) # DRV to RT @@ -109,7 +106,7 @@ def test_interop_graphNode(): assert(err_dr == cuda.CUresult.CUDA_SUCCESS) err_dr, device = cuda.cuDeviceGet(0) assert(err_dr == cuda.CUresult.CUDA_SUCCESS) - err_dr, ctx = cuda.cuCtxCreate(0, device) + err_dr, ctx = cuda.cuCtxCreate(None, 0, device) assert(err_dr == cuda.CUresult.CUDA_SUCCESS) # DRV to RT @@ -147,7 +144,7 @@ def test_interop_memPool(): assert(err_dr == cuda.CUresult.CUDA_SUCCESS) err_dr, device = cuda.cuDeviceGet(0) assert(err_dr == cuda.CUresult.CUDA_SUCCESS) - err_dr, ctx = cuda.cuCtxCreate(0, device) + err_dr, ctx = cuda.cuCtxCreate(None, 0, device) assert(err_dr == cuda.CUresult.CUDA_SUCCESS) # DRV to RT @@ -176,7 +173,7 @@ def test_interop_graphExec(): assert(err_dr == cuda.CUresult.CUDA_SUCCESS) err_dr, device = cuda.cuDeviceGet(0) assert(err_dr == cuda.CUresult.CUDA_SUCCESS) - err_dr, ctx = cuda.cuCtxCreate(0, device) + err_dr, ctx = cuda.cuCtxCreate(None, 0, device) assert(err_dr == cuda.CUresult.CUDA_SUCCESS) cdef ccuda.CUgraph* graph_dr = calloc(1, sizeof(ccuda.CUgraph)) diff --git a/cuda/_lib/ccudart/__init__.py b/cuda_bindings/tests/nvml/README.md similarity index 100% rename from cuda/_lib/ccudart/__init__.py rename to cuda_bindings/tests/nvml/README.md diff --git a/cuda_bindings/tests/nvml/__init__.py b/cuda_bindings/tests/nvml/__init__.py new file mode 100644 index 00000000000..c746f897d2d --- /dev/null +++ b/cuda_bindings/tests/nvml/__init__.py @@ -0,0 +1,10 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + + +import pytest + +from cuda.bindings._test_helpers.arch_check import hardware_supports_nvml + +if not hardware_supports_nvml(): + pytest.skip("NVML not supported on this platform", allow_module_level=True) diff --git a/cuda_bindings/tests/nvml/conftest.py b/cuda_bindings/tests/nvml/conftest.py new file mode 100644 index 00000000000..9897420e38d --- /dev/null +++ b/cuda_bindings/tests/nvml/conftest.py @@ -0,0 +1,147 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +from collections import namedtuple + +import pytest + +from cuda.bindings import nvml +from cuda.bindings._test_helpers.arch_check import unsupported_before # noqa: F401 + + +class NVMLInitializer: + def __init__(self): + pass + + def __enter__(self): + nvml.init_v2() + + def __exit__(self, exception_type, exception, trace): + nvml.shutdown() + + +@pytest.fixture +def nvml_init(): + with NVMLInitializer(): + yield + + +@pytest.fixture(scope="session", autouse=True) +def device_info(): + dev_count = None + bus_id_to_board_details = {} + + with NVMLInitializer(): + dev_count = nvml.device_get_count_v2() + + # Store some details for each device now when we know NVML is in known state + for i in range(dev_count): + try: + dev = nvml.device_get_handle_by_index_v2(i) + except nvml.NoPermissionError: + continue + pci_info = nvml.device_get_pci_info_v3(dev) + + name = nvml.device_get_name(dev) + # Get architecture name ex: Ampere, Kepler + arch_id = nvml.device_get_architecture(dev) + + BoardCfg = namedtuple("BoardCfg", "name, ids_arr") + board = BoardCfg(name, ids_arr=[(pci_info.pci_device_id, pci_info.pci_sub_system_id)]) + + try: + serial = nvml.device_get_serial(dev) + except nvml.NvmlError: + serial = None + + bus_id = pci_info.bus_id + device_id = pci_info.device_ + uuid = nvml.device_get_uuid(dev) + + BoardDetails = namedtuple("BoardDetails", "name, board, arch_id, bus_id, device_id, serial") + bus_id_to_board_details[uuid] = BoardDetails(name, board, arch_id, bus_id, device_id, serial) + + return bus_id_to_board_details + + +def get_devices(device_info): + for uuid in list(device_info.keys()): + try: + yield nvml.device_get_handle_by_uuid(uuid) + except nvml.NoPermissionError: + continue # ignore devices that can't be accessed + + +@pytest.fixture +def all_devices(device_info): + with NVMLInitializer(): + yield sorted(set(get_devices(device_info))) + + +@pytest.fixture +def driver(nvml_init, request): + driver_vsn = nvml.system_get_driver_version() + # Return "major" version only + return int(driver_vsn.split(".")[0]) + + +@pytest.fixture +def ngpus(nvml_init): + result = nvml.device_get_count_v2() + assert result > 0 + return result + + +@pytest.fixture +def handles(ngpus): + handles = [nvml.device_get_handle_by_index_v2(i) for i in range(ngpus)] + assert len(handles) == ngpus + return handles + + +@pytest.fixture +def nmigs(handles): + return nvml.device_get_max_mig_device_count(handles[0]) + + +@pytest.fixture +def mig_handles(nmigs): + handles = [] + with NVMLInitializer(): + dev_count = nvml.device_get_count_v2() + + for dev_idx in range(dev_count): + try: + dev = nvml.device_get_handle_by_index_v2(dev_idx) + except nvml.NoPermissionError: + continue + for mig_idx in range(nmigs): + try: + mig = nvml.device_get_mig_device_handle_by_index(dev, mig_idx) + except nvml.NotFoundError: + # Not all MIG devices may be available + continue + else: + handles.append(mig) + return handles + + +@pytest.fixture +def serials(ngpus, handles): + serials = [nvml.device_get_serial(handles[i]) for i in range(ngpus)] + assert len(serials) == ngpus + return serials + + +@pytest.fixture +def uuids(ngpus, handles): + uuids = [nvml.device_get_uuid(handles[i]) for i in range(ngpus)] + assert len(uuids) == ngpus + return uuids + + +@pytest.fixture +def pci_info(ngpus, handles): + pci_info = [nvml.device_get_pci_info_v3(handles[i]) for i in range(ngpus)] + assert len(pci_info) == ngpus + return pci_info diff --git a/cuda_bindings/tests/nvml/test_compute_mode.py b/cuda_bindings/tests/nvml/test_compute_mode.py new file mode 100644 index 00000000000..83c7827f53a --- /dev/null +++ b/cuda_bindings/tests/nvml/test_compute_mode.py @@ -0,0 +1,32 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + + +import sys + +import pytest + +from cuda.bindings import nvml + +from .conftest import unsupported_before + +COMPUTE_MODES = [ + nvml.ComputeMode.COMPUTEMODE_DEFAULT, + nvml.ComputeMode.COMPUTEMODE_PROHIBITED, + nvml.ComputeMode.COMPUTEMODE_EXCLUSIVE_PROCESS, +] + + +@pytest.mark.skipif(sys.platform == "win32", reason="Test not supported on Windows") +def test_compute_mode_supported_nonroot(all_devices): + for device in all_devices: + with unsupported_before(device, None): + original_compute_mode = nvml.device_get_compute_mode(device) + + for cm in COMPUTE_MODES: + try: + nvml.device_set_compute_mode(device, cm) + except nvml.NoPermissionError: + pytest.skip("Insufficient permissions to set compute mode") + nvml.device_set_compute_mode(device, original_compute_mode) + assert original_compute_mode == nvml.device_get_compute_mode(device), "Compute mode shouldn't have changed" diff --git a/cuda_bindings/tests/nvml/test_cuda.py b/cuda_bindings/tests/nvml/test_cuda.py new file mode 100644 index 00000000000..7a782e7403c --- /dev/null +++ b/cuda_bindings/tests/nvml/test_cuda.py @@ -0,0 +1,73 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +import os + +import pytest + +import cuda.bindings.driver as cuda +from cuda.bindings import nvml + +from .conftest import NVMLInitializer + + +def get_nvml_device_names(): + result = [] + with NVMLInitializer(): + # uses NVML Library to get the device count, device id and device pci id + num_devices = nvml.device_get_count_v2() + for idx in range(num_devices): + handle = nvml.device_get_handle_by_index_v2(idx) + name = nvml.device_get_name(handle) + info = nvml.device_get_pci_info_v3(handle) + assert isinstance(info.bus, int) + assert isinstance(name, str) + result.append({"name": name, "id": info.bus}) + + return result + + +def get_cuda_device_names(sort_by_bus_id=True): + result = [] + + (err,) = cuda.cuInit(0) + assert err == cuda.CUresult.CUDA_SUCCESS + + err, device_count = cuda.cuDeviceGetCount() + assert err == cuda.CUresult.CUDA_SUCCESS + + for dev in range(device_count): + size = 256 + err, name = cuda.cuDeviceGetName(size, dev) + name = name.split(b"\x00")[0].decode() + assert err == cuda.CUresult.CUDA_SUCCESS + + err, pci_bus_id = cuda.cuDeviceGetAttribute(cuda.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_PCI_BUS_ID, dev) + assert err == cuda.CUresult.CUDA_SUCCESS + assert isinstance(pci_bus_id, int) + + result.append({"name": name, "id": pci_bus_id}) + + if sort_by_bus_id: + result = sorted(result, key=lambda k: k["id"]) + + return result + + +def test_cuda_device_order(): + cuda_devices = get_cuda_device_names() + nvml_devices = get_nvml_device_names() + + if any("Thor" in device["name"] for device in nvml_devices): + pytest.skip("Skipping test on Thor, which has non-standard device naming") + return + + if "CUDA_VISIBLE_DEVICES" not in os.environ: + # If that environment variable isn't set, the device lists should match exactly + assert cuda_devices == nvml_devices, "CUDA and NVML device lists do not match" + else: + # If the environment variable is set, there may possibly be fewer CUDA devices, + # and each of them should still be found in NVML devices. + assert len(cuda_devices) <= len(nvml_devices) + for cuda_device in cuda_devices: + assert cuda_device in nvml_devices, f"CUDA device {cuda_device} not found in NVML device list" diff --git a/cuda_bindings/tests/nvml/test_device.py b/cuda_bindings/tests/nvml/test_device.py new file mode 100644 index 00000000000..301bfca59d3 --- /dev/null +++ b/cuda_bindings/tests/nvml/test_device.py @@ -0,0 +1,169 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + + +from functools import cache + +import numpy as np +import pytest + +from cuda.bindings import nvml + +from .conftest import unsupported_before + + +@cache +def get_cuda_version(): + nvml.init_v2() + try: + version = nvml.system_get_cuda_driver_version() + finally: + nvml.shutdown() + return version + + +def cuda_version_less_than(target): + return get_cuda_version() < target + + +def test_device_capabilities(all_devices): + for device in all_devices: + capabilities = nvml.device_get_capabilities(device) + assert isinstance(capabilities, int) + + +def test_clk_mon_status_t(): + obj = nvml.ClkMonStatus() + assert len(obj.clk_mon_list) == 0 + assert not hasattr(obj, "clk_mon_list_size") + + +def test_current_clock_freqs(all_devices): + for device in all_devices: + with unsupported_before(device, None): + clk_freqs = nvml.device_get_current_clock_freqs(device) + assert isinstance(clk_freqs, str) + + +def test_grid_licensable_features(all_devices): + for device in all_devices: + features = nvml.device_get_grid_licensable_features_v4(device) + assert isinstance(features, nvml.GridLicensableFeatures) + # #define NVML_GRID_LICENSE_FEATURE_MAX_COUNT 3 + assert len(features.grid_licensable_features) <= 3 + assert not hasattr(features, "licensable_features_count") + + for feature in features.grid_licensable_features: + nvml.GridLicenseFeatureCode(feature.feature_code) + assert isinstance(feature.feature_state, int) + assert isinstance(feature.license_info, str) + assert isinstance(feature.product_name, str) + assert isinstance(feature.feature_enabled, int) + nvml.GridLicenseExpiry(feature.license_expiry) + + +def test_get_handle_by_uuidv(all_devices): + for device in all_devices: + uuid = nvml.device_get_uuid(device) + new_handle = nvml.device_get_handle_by_uuidv(nvml.UUIDType.ASCII, uuid.encode("ascii")) + assert new_handle == device + + +def test_get_nv_link_supported_bw_modes(all_devices): + for device in all_devices: + with unsupported_before(device, None): + modes = nvml.device_get_nvlink_supported_bw_modes(device) + assert isinstance(modes, nvml.NvlinkSupportedBwModes_v1) + # #define NVML_NVLINK_TOTAL_SUPPORTED_BW_MODES 23 + assert len(modes.bw_modes) <= 23 + assert not hasattr(modes, "total_bw_modes") + + for mode in modes.bw_modes: + assert isinstance(mode, np.uint8) + + +def test_device_get_pdi(all_devices): + for device in all_devices: + pdi = nvml.device_get_pdi(device) + assert isinstance(pdi, int) + + +def test_device_get_performance_modes(all_devices): + for device in all_devices: + with unsupported_before(device, None): + modes = nvml.device_get_performance_modes(device) + assert isinstance(modes, str) + + +@pytest.mark.skipif(cuda_version_less_than(13010), reason="Introduced in 13.1") +def test_device_get_unrepairable_memory_flag(all_devices): + for device in all_devices: + with unsupported_before(device, None): + status = nvml.device_get_unrepairable_memory_flag_v1(device) + assert isinstance(status, int) + + +def test_device_vgpu_get_heterogeneous_mode(all_devices): + for device in all_devices: + with unsupported_before(device, None): + mode = nvml.device_get_vgpu_heterogeneous_mode(device) + assert isinstance(mode, int) + + +@pytest.mark.skipif(cuda_version_less_than(13010), reason="Introduced in 13.1") +def test_read_prm_counters(all_devices): + for device in all_devices: + counters = nvml.PRMCounter_v1(5) + with unsupported_before(device, None): + read_counters = nvml.device_read_prm_counters_v1(device, counters) + assert counters is read_counters + assert len(read_counters) == 5 + + +@pytest.mark.thread_unsafe(reason="API appears to be thread-unsafe (2026-06)") +def test_read_write_prm(all_devices): + for device in all_devices: + # Docs say supported in BLACKWELL or later + with unsupported_before(device, None): + try: + result = nvml.device_read_write_prm_v1(device, b"012345678") + except nvml.NoPermissionError: + pytest.skip("No permission to read/write PRM") + assert isinstance(result, tuple) + assert isinstance(result[0], int) + assert isinstance(result[1], bytes) + + +def test_get_power_management_limit(all_devices): + for device in all_devices: + # Docs say supported on KEPLER or later + with unsupported_before(device, None): + nvml.device_get_power_management_limit(device) + + +def test_set_power_management_limit(all_devices): + for device in all_devices: + with unsupported_before(device, nvml.DeviceArch.KEPLER): + try: + nvml.device_set_power_management_limit_v2(device, nvml.PowerScope.GPU, 10000) + except nvml.NoPermissionError: + pytest.skip("No permission to set power management limit") + except nvml.InvalidArgumentError: + pytest.skip("Invalid argument when setting power management limit -- probably unsupported") + + +def test_set_temperature_threshold(all_devices): + for device in all_devices: + # Docs say supported on MAXWELL or newer + with unsupported_before(device, None): + temp = nvml.device_get_temperature_threshold( + device, nvml.TemperatureThresholds.TEMPERATURE_THRESHOLD_ACOUSTIC_CURR + ) + try: + nvml.device_set_temperature_threshold( + device, nvml.TemperatureThresholds.TEMPERATURE_THRESHOLD_ACOUSTIC_CURR, temp + ) + except nvml.NoPermissionError: + pytest.skip("No permission to set temperature threshold") + except nvml.InvalidArgumentError: + pytest.skip("Invalid argument when setting temperature threshold -- this is probably the temp type") diff --git a/cuda_bindings/tests/nvml/test_gpu.py b/cuda_bindings/tests/nvml/test_gpu.py new file mode 100644 index 00000000000..6757e4760f1 --- /dev/null +++ b/cuda_bindings/tests/nvml/test_gpu.py @@ -0,0 +1,82 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +import numpy as np +import pytest + +from cuda.bindings import nvml + +from . import util +from .conftest import unsupported_before + + +def test_gpu_get_module_id(nvml_init): + # Unique module IDs cannot exceed the number of GPUs on the system + device_count = nvml.device_get_count_v2() + + for i in range(device_count): + device = nvml.device_get_handle_by_index_v2(i) + uuid = nvml.device_get_uuid(device) + + if util.is_vgpu(device): + continue + + with unsupported_before(device, None): + module_id = nvml.device_get_module_id(device) + assert isinstance(module_id, int) + + +def test_gpu_get_platform_info(all_devices): + for device in all_devices: + if util.is_vgpu(device): + pytest.skip(f"Not supported on vGPU device {device}") + + # Documentation says Blackwell or newer only, but this does seem to pass + # on some newer GPUs. + + with unsupported_before(device, None): + platform_info = nvml.device_get_platform_info(device) + + assert isinstance(platform_info, (nvml.PlatformInfo_v1, nvml.PlatformInfo_v2)) + + +# TODO: Test APIs related to GPU instances, which require specific hardware and root + +# def test_gpu_instance(all_devices): +# for device in all_devices: +# # Requires root +# gpu_instance = nvml.device_create_gpu_instance(device, nvml.GpuInstanceProfile.PROFILE_1_SLICE) + + +def test_conf_compute_attestation_report_t(all_devices): + report = nvml.ConfComputeGpuAttestationReport() + assert not hasattr(report, "attestation_report_size") + assert len(report.attestation_report) == 0 + assert not hasattr(report, "cec_attestation_report_size") + assert len(report.cec_attestation_report) == 0 + assert len(report.nonce) == 32 + assert report.nonce.dtype == np.uint8 + + +def test_gpu_conf_compute_attestation_report(all_devices): + for device in all_devices: + # Documentation says AMPERE or newer + with unsupported_before(device, None), pytest.raises(nvml.UnknownError): + # The nonce string is nonsensical, so if this "works", we expect an UnknownError + nvml.device_get_conf_compute_gpu_attestation_report(device, nonce=b"12345678") + + +def test_conf_compute_gpu_certificate_t(): + cert = nvml.ConfComputeGpuCertificate() + assert not hasattr(cert, "cert_chain_size") + assert len(cert.cert_chain) == 0 + assert not hasattr(cert, "attestation_cert_chain_size") + assert len(cert.attestation_cert_chain) == 0 + + +def test_conf_compute_gpu_certificate(all_devices): + for device in all_devices: + # Documentation says AMPERE or newer + with unsupported_before(device, None), pytest.raises(nvml.UnknownError): + # This is expected to fail if the device doesn't have a proper certificate + nvml.device_get_conf_compute_gpu_certificate(device) diff --git a/cuda_bindings/tests/nvml/test_init.py b/cuda_bindings/tests/nvml/test_init.py new file mode 100644 index 00000000000..a47af24dc6a --- /dev/null +++ b/cuda_bindings/tests/nvml/test_init.py @@ -0,0 +1,79 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +import sys +import warnings + +import pytest + +from cuda.bindings import nvml + + +def assert_nvml_is_initialized(): + assert nvml.device_get_count_v2() > 0 + + +def assert_nvml_is_uninitialized(): + with pytest.raises(nvml.UninitializedError): + nvml.device_get_count_v2() + + +def test_devices_are_the_same_architecture(all_devices): + # The tests in this directory that use `unsupported_before` will generally + # skip the entire test after the first device that isn't supported is found. + # This means that if subsequent devices are of a different architecture, + # they won't be tested properly. This tests for the (hopefully rare) case + # where a system has devices of different architectures and produces a warning. + + def get_architecture_name(arch): + try: + return nvml.DeviceArch(arch).name + except ValueError: + return f"UNKNOWN_ARCH_ID({arch})" + + all_arches = {nvml.device_get_architecture(device) for device in all_devices} + + if len(all_arches) > 1: + warnings.warn( + f"System has devices of multiple architectures ({', '.join(get_architecture_name(x) for x in all_arches)}). " + f" Some tests may be skipped unexpectedly", + UserWarning, + ) + + +@pytest.mark.skipif(sys.platform == "win32", reason="Test not supported on Windows") +@pytest.mark.thread_unsafe(reason="nvml init affects other threads") +def test_init_ref_count(): + """ + Verifies that we can call NVML shutdown and init(2) multiple times, and that ref counting works + """ + with pytest.raises(nvml.UninitializedError): + nvml.shutdown() + + assert_nvml_is_uninitialized() + + for i in range(3): + # Init 5 times + for j in range(5): + nvml.init_v2() + assert_nvml_is_initialized() + + # Shutdown 4 times, NVML should remain initailized + for j in range(4): + nvml.shutdown() + assert_nvml_is_initialized() + + # Shutdown the final time + nvml.shutdown() + assert_nvml_is_uninitialized() + + +def test_init_check_index(nvml_init): + """ + Verifies that the index from nvmlDeviceGetIndex is correct + """ + dev_count = nvml.device_get_count_v2() + for idx in range(dev_count): + handle = nvml.device_get_handle_by_index_v2(idx) + # Verify that the index matches + assert idx == nvml.device_get_index(handle) diff --git a/cuda_bindings/tests/nvml/test_nvlink.py b/cuda_bindings/tests/nvml/test_nvlink.py new file mode 100644 index 00000000000..04bc8eaae4c --- /dev/null +++ b/cuda_bindings/tests/nvml/test_nvlink.py @@ -0,0 +1,34 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + + +from cuda.bindings import nvml + + +def test_nvlink_get_link_count(all_devices): + """ + Checks that the link count of the device is same. + """ + for device in all_devices: + fields = nvml.FieldValue(0) + assert len(nvml.device_get_field_values(device, fields)) == 0 + + assert len(nvml.device_get_field_values(device, [])) == 0 + + fields = nvml.FieldValue(1) + fields[0].field_id = nvml.FieldId.DEV_NVLINK_LINK_COUNT + value = nvml.device_get_field_values(device, fields)[0] + assert value.nvml_return == nvml.Return.SUCCESS or value.nvml_return == nvml.Return.ERROR_NOT_SUPPORTED, ( + f"Unexpected return {value.nvml_return} for link count field query" + ) + + # Use the alternative argument to device_get_field_values + value = nvml.device_get_field_values(device, [nvml.FieldId.DEV_NVLINK_LINK_COUNT])[0] + assert value.nvml_return == nvml.Return.SUCCESS or value.nvml_return == nvml.Return.ERROR_NOT_SUPPORTED, ( + f"Unexpected return {value.nvml_return} for link count field query" + ) + + # The feature_nvlink_supported detection is not robust, so we + # can't be more specific about how many links we should find. + if value.nvml_return == nvml.Return.SUCCESS: + assert value.value.ui_val[0] <= nvml.NVLINK_MAX_LINKS, f"Unexpected link count {value.value.ui_val[0]}" diff --git a/cuda_bindings/tests/nvml/test_page_retirement.py b/cuda_bindings/tests/nvml/test_page_retirement.py new file mode 100644 index 00000000000..34c6cf78625 --- /dev/null +++ b/cuda_bindings/tests/nvml/test_page_retirement.py @@ -0,0 +1,75 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +import pytest + +from cuda.bindings import nvml + +from . import util + +PAGE_RETIREMENT_PUBLIC_CAUSE_TYPES = list(range(nvml.PageRetirementCause.COUNT)) + + +def supports_page_retirement(device): + try: + for source in range(nvml.PageRetirementCause.COUNT): + nvml.device_get_retired_pages(device, source) + return True + except nvml.NotSupportedError as e: + return False + except nvml.FunctionNotFoundError as e: + return False + + +def test_page_retirement_notsupported(all_devices): + """ + Verifies that on platforms that don't supports page retirement, APIs will return Not Supported + """ + skip_reasons = set() + + for device in all_devices: + if supports_page_retirement(device): + skip_reasons.add(f"page_retirement is supported for {device}") + continue + + if not util.supports_ecc(device): + skip_reasons.add(f"device doesn't support ECC for {device}") + continue + + with pytest.raises(nvml.NotSupportedError): + for source in PAGE_RETIREMENT_PUBLIC_CAUSE_TYPES: + nvml.device_get_retired_pages(device, source) + + with pytest.raises(nvml.NotSupportedError): + nvml.device_get_retired_pages_pending_status(device) + + if skip_reasons: + pytest.skip(" ; ".join(skip_reasons)) + + +def test_page_retirement_supported(all_devices): + """ + Verifies that on platforms that support page_retirement, APIs will return success + """ + skip_reasons = set() + + for device in all_devices: + if not supports_page_retirement(device): + skip_reasons.add(f"page_retirement not supported for {device}") + continue + + if not util.supports_ecc(device): + skip_reasons.add(f"device doesn't support ECC for {device}") + continue + + try: + for source in PAGE_RETIREMENT_PUBLIC_CAUSE_TYPES: + nvml.device_get_retired_pages(device, source) + except nvml.NotSupportedError: + skip_reasons.add(f"Exception case: Page retirement is not supported in this GPU {device}") + continue + + nvml.device_get_retired_pages_pending_status(device) + + if skip_reasons: + pytest.skip(" ; ".join(skip_reasons)) diff --git a/cuda_bindings/tests/nvml/test_pci.py b/cuda_bindings/tests/nvml/test_pci.py new file mode 100644 index 00000000000..74c7a65a655 --- /dev/null +++ b/cuda_bindings/tests/nvml/test_pci.py @@ -0,0 +1,35 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + + +import contextlib + +from cuda.bindings import nvml + +from .conftest import unsupported_before + + +def test_discover_gpus(all_devices): + for device in all_devices: + pci_info = nvml.device_get_pci_info_v3(device) + # Docs say this should be supported on PASCAL and later + with unsupported_before(device, None), contextlib.suppress(nvml.OperatingSystemError): + nvml.device_discover_gpus(pci_info.ptr) + + +def test_bridge_chip_hierarchy_t(): + hierarchy = nvml.BridgeChipHierarchy() + assert len(hierarchy.bridge_chip_info) == 0 + assert not hasattr(hierarchy, "bridge_count") + assert isinstance(hierarchy.bridge_chip_info, nvml.BridgeChipInfo) + + +def test_bridge_chip_info(all_devices): + for device in all_devices: + with unsupported_before(device, None): + info = nvml.device_get_bridge_chip_info(device) + assert isinstance(info, nvml.BridgeChipHierarchy) + for entry in info.bridge_chip_info: + assert isinstance(entry, nvml.BridgeChipInfo) + assert isinstance(entry.type, int) + assert isinstance(entry.fw_version, int) diff --git a/cuda_bindings/tests/nvml/test_pynvml.py b/cuda_bindings/tests/nvml/test_pynvml.py new file mode 100644 index 00000000000..2d1029e9d9b --- /dev/null +++ b/cuda_bindings/tests/nvml/test_pynvml.py @@ -0,0 +1,296 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +# A set of tests ported from https://github.com/gpuopenanalytics/pynvml/blob/11.5.3/pynvml/tests/test_nvml.py + +import os +import time + +import pytest + +from cuda.bindings import nvml + +from . import util +from .conftest import unsupported_before + +XFAIL_LEGACY_NVLINK_MSG = "Legacy NVLink test expected to fail." + + +def test_system_get_nvml_version(nvml_init): + vsn = nvml.system_get_nvml_version() + assert isinstance(vsn, str) + assert tuple(int(x) for x in vsn.split(".")[:2]) > (0, 0) + + +def test_system_get_cuda_driver_version(nvml_init): + vsn = nvml.system_get_cuda_driver_version() + assert vsn != 0.0 + + +def test_nvml_system_get_process_name(nvml_init): + try: + procname = nvml.system_get_process_name(os.getpid()) + except nvml.NotFoundError: + pytest.skip("Process not found") + return + assert procname is not None + + +def test_system_get_driver_version(nvml_init): + vsn = nvml.system_get_driver_version() + assert isinstance(vsn, str) + assert tuple(int(x) for x in vsn.split(".")[:2]) > (0, 0) + + +def test_device_get_attributes(mig_handles): + # nvmlDeviceGetAttributes requires MIG device handle + + if mig_handles: + for handle in mig_handles: + att = nvml.device_get_attributes_v2(handle) + assert att is not None + else: + pytest.skip("No MIG devices found") + + +def test_device_get_handle_by_uuid(ngpus, uuids): + handles = [nvml.device_get_handle_by_uuid(uuids[i]) for i in range(ngpus)] + assert len(handles) == ngpus + + +def test_device_get_handle_by_pci_bus_id(ngpus, pci_info): + handles = [nvml.device_get_handle_by_pci_bus_id_v2(pci_info[i].bus_id) for i in range(ngpus)] + assert len(handles) == ngpus + + +@pytest.mark.parametrize("scope", [nvml.AffinityScope.NODE, nvml.AffinityScope.SOCKET]) +@pytest.mark.skipif(util.is_wsl() or util.is_windows(), reason="Not supported on WSL or Windows") +def test_device_get_memory_affinity(handles, scope): + size = 1024 + for handle in handles: + with unsupported_before(handle, nvml.DeviceArch.KEPLER): + node_set = nvml.device_get_memory_affinity(handle, size, scope) + assert node_set is not None + assert len(node_set) == size + + +@pytest.mark.parametrize("scope", [nvml.AffinityScope.NODE, nvml.AffinityScope.SOCKET]) +@pytest.mark.skipif(util.is_wsl() or util.is_windows(), reason="Not supported on WSL or Windows") +def test_device_get_cpu_affinity_within_scope(handles, scope): + size = 1024 + for handle in handles: + with unsupported_before(handle, nvml.DeviceArch.KEPLER): + cpu_set = nvml.device_get_cpu_affinity_within_scope(handle, size, scope) + assert cpu_set is not None + assert len(cpu_set) == size + + +@pytest.mark.parametrize( + "index", + [ + nvml.GpuP2PCapsIndex.P2P_CAPS_INDEX_WRITE, + nvml.GpuP2PCapsIndex.P2P_CAPS_INDEX_NVLINK, + nvml.GpuP2PCapsIndex.P2P_CAPS_INDEX_WRITE, + nvml.GpuP2PCapsIndex.P2P_CAPS_INDEX_NVLINK, + nvml.GpuP2PCapsIndex.P2P_CAPS_INDEX_ATOMICS, + nvml.GpuP2PCapsIndex.P2P_CAPS_INDEX_PROP, + nvml.GpuP2PCapsIndex.P2P_CAPS_INDEX_UNKNOWN, + ], +) +def test_device_get_p2p_status(handles, index): + for h1 in handles: + for h2 in handles: + if h1 is not h2: + status = nvml.device_get_p2p_status(h1, h2, index) + assert nvml.GpuP2PStatus.P2P_STATUS_OK <= status <= nvml.GpuP2PStatus.P2P_STATUS_UNKNOWN + + +# [Skipping] pynvml.nvmlDeviceGetName +# [Skipping] pynvml.nvmlDeviceGetBoardId +# [Skipping] pynvml.nvmlDeviceGetMultiGpuBoard +# [Skipping] pynvml.nvmlDeviceGetBrand +# [Skipping] pynvml.nvmlDeviceGetCpuAffinity +# [Skipping] pynvml.nvmlDeviceSetCpuAffinity +# [Skipping] pynvml.nvmlDeviceClearCpuAffinity +# [Skipping] pynvml.nvmlDeviceGetMinorNumber +# [Skipping] pynvml.nvmlDeviceGetUUID +# [Skipping] pynvml.nvmlDeviceGetInforomVersion +# [Skipping] pynvml.nvmlDeviceGetInforomImageVersion +# [Skipping] pynvml.nvmlDeviceGetInforomConfigurationChecksum +# [Skipping] pynvml.nvmlDeviceValidateInforom +# [Skipping] pynvml.nvmlDeviceGetDisplayMode +# [Skipping] pynvml.nvmlDeviceGetPersistenceMode +# [Skipping] pynvml.nvmlDeviceGetClockInfo +# [Skipping] pynvml.nvmlDeviceGetMaxClockInfo +# [Skipping] pynvml.nvmlDeviceGetApplicationsCloc +# [Skipping] pynvml.nvmlDeviceGetDefaultApplicationsClock +# [Skipping] pynvml.nvmlDeviceGetSupportedMemoryClocks +# [Skipping] pynvml.nvmlDeviceGetSupportedGraphicsClocks +# [Skipping] pynvml.nvmlDeviceGetFanSpeed +# [Skipping] pynvml.nvmlDeviceGetTemperature +# [Skipping] pynvml.nvmlDeviceGetTemperatureThreshold +# [Skipping] pynvml.nvmlDeviceGetPowerState +# [Skipping] pynvml.nvmlDeviceGetPerformanceState +# [Skipping] pynvml.nvmlDeviceGetPowerManagementMode +# [Skipping] pynvml.nvmlDeviceGetPowerManagementLimit +# [Skipping] pynvml.nvmlDeviceGetPowerManagementLimitConstraints +# [Skipping] pynvml.nvmlDeviceGetPowerManagementDefaultLimit +# [Skipping] pynvml.nvmlDeviceGetEnforcedPowerLimit + + +def test_device_get_power_usage(ngpus, handles): + for i in range(ngpus): + # Note: documentation says this is supported on Fermi or newer, + # but in practice it fails on some later architectures. + with unsupported_before(handles[i], None): + power_mwatts = nvml.device_get_power_usage(handles[i]) + assert power_mwatts >= 0.0 + + +def test_device_get_total_energy_consumption(ngpus, handles): + for i in range(ngpus): + with unsupported_before(handles[i], None): + energy_mjoules1 = nvml.device_get_total_energy_consumption(handles[i]) + + for j in range(10): # idle for 150 ms + time.sleep(0.015) # and check for increase every 15 ms + with unsupported_before(handles[i], None): + energy_mjoules2 = nvml.device_get_total_energy_consumption(handles[i]) + assert energy_mjoules2 >= energy_mjoules1 + if energy_mjoules2 > energy_mjoules1: + break + else: + raise AssertionError("energy did not increase across 150 ms interval") + + +# [Skipping] pynvml.nvmlDeviceGetGpuOperationMode +# [Skipping] pynvml.nvmlDeviceGetCurrentGpuOperationMode +# [Skipping] pynvml.nvmlDeviceGetPendingGpuOperationMode + + +def test_device_get_memory_info(ngpus, handles): + for i in range(ngpus): + with unsupported_before(handles[i], None): + meminfo = nvml.device_get_memory_info_v2(handles[i]) + assert (meminfo.used <= meminfo.total) and (meminfo.free <= meminfo.total) + + +# [Skipping] pynvml.nvmlDeviceGetBAR1MemoryInfo +# [Skipping] pynvml.nvmlDeviceGetComputeMode +# [Skipping] pynvml.nvmlDeviceGetEccMode +# [Skipping] pynvml.nvmlDeviceGetCurrentEccMode (Python API Addition) +# [Skipping] pynvml.nvmlDeviceGetPendingEccMode (Python API Addition) +# [Skipping] pynvml.nvmlDeviceGetTotalEccErrors +# [Skipping] pynvml.nvmlDeviceGetDetailedEccErrors +# [Skipping] pynvml.nvmlDeviceGetMemoryErrorCounter + + +def test_device_get_utilization_rates(ngpus, handles): + for i in range(ngpus): + with unsupported_before(handles[i], None): + urate = nvml.device_get_utilization_rates(handles[i]) + assert urate.gpu >= 0 + assert urate.memory >= 0 + + +# [Skipping] pynvml.nvmlDeviceGetEncoderUtilization +# [Skipping] pynvml.nvmlDeviceGetDecoderUtilization +# [Skipping] pynvml.nvmlDeviceGetPcieReplayCounter +# [Skipping] pynvml.nvmlDeviceGetDriverModel +# [Skipping] pynvml.nvmlDeviceGetCurrentDriverModel +# [Skipping] pynvml.nvmlDeviceGetPendingDriverModel +# [Skipping] pynvml.nvmlDeviceGetVbiosVersion +# [Skipping] pynvml.nvmlDeviceGetComputeRunningProcesses +# [Skipping] pynvml.nvmlDeviceGetGraphicsRunningProcesses +# [Skipping] pynvml.nvmlDeviceGetAutoBoostedClocksEnabled +# [Skipping] nvmlUnitSetLedState +# [Skipping] pynvml.nvmlDeviceSetPersistenceMode +# [Skipping] pynvml.nvmlDeviceSetComputeMode +# [Skipping] pynvml.nvmlDeviceSetEccMode +# [Skipping] pynvml.nvmlDeviceClearEccErrorCounts +# [Skipping] pynvml.nvmlDeviceSetDriverModel +# [Skipping] pynvml.nvmlDeviceSetAutoBoostedClocksEnabled +# [Skipping] pynvml.nvmlDeviceSetDefaultAutoBoostedClocksEnabled +# [Skipping] pynvml.nvmlDeviceSetApplicationsClocks +# [Skipping] pynvml.nvmlDeviceResetApplicationsClocks +# [Skipping] pynvml.nvmlDeviceSetPowerManagementLimit +# [Skipping] pynvml.nvmlDeviceSetGpuOperationMode +# [Skipping] nvmlEventSetCreate +# [Skipping] pynvml.nvmlDeviceRegisterEvents +# [Skipping] pynvml.nvmlDeviceGetSupportedEventTypes +# [Skipping] nvmlEventSetWait +# [Skipping] nvmlEventSetFree +# [Skipping] pynvml.nvmlDeviceOnSameBoard +# [Skipping] pynvml.nvmlDeviceGetCurrPcieLinkGeneration +# [Skipping] pynvml.nvmlDeviceGetMaxPcieLinkGeneration +# [Skipping] pynvml.nvmlDeviceGetCurrPcieLinkWidth +# [Skipping] pynvml.nvmlDeviceGetMaxPcieLinkWidth +# [Skipping] pynvml.nvmlDeviceGetSupportedClocksThrottleReasons +# [Skipping] pynvml.nvmlDeviceGetCurrentClocksThrottleReasons +# [Skipping] pynvml.nvmlDeviceGetIndex +# [Skipping] pynvml.nvmlDeviceGetAccountingMode +# [Skipping] pynvml.nvmlDeviceSetAccountingMode +# [Skipping] pynvml.nvmlDeviceClearAccountingPids +# [Skipping] pynvml.nvmlDeviceGetAccountingStats +# [Skipping] pynvml.nvmlDeviceGetAccountingPids +# [Skipping] pynvml.nvmlDeviceGetAccountingBufferSize +# [Skipping] pynvml.nvmlDeviceGetRetiredPages +# [Skipping] pynvml.nvmlDeviceGetRetiredPagesPendingStatus +# [Skipping] pynvml.nvmlDeviceGetAPIRestriction +# [Skipping] pynvml.nvmlDeviceSetAPIRestriction +# [Skipping] pynvml.nvmlDeviceGetBridgeChipInfo +# [Skipping] pynvml.nvmlDeviceGetSamples +# [Skipping] pynvml.nvmlDeviceGetViolationStatus + + +def test_device_get_pcie_throughput(ngpus, handles): + for i in range(ngpus): + with unsupported_before(handles[i], None): + tx_bytes_tp = nvml.device_get_pcie_throughput(handles[i], nvml.PcieUtilCounter.PCIE_UTIL_TX_BYTES) + assert tx_bytes_tp >= 0 + with unsupported_before(handles[i], None): + rx_bytes_tp = nvml.device_get_pcie_throughput(handles[i], nvml.PcieUtilCounter.PCIE_UTIL_RX_BYTES) + assert rx_bytes_tp >= 0 + + # with pytest.raises(nvml.InvalidArgumentError): + # nvml.device_get_pcie_throughput(handles[i], nvml.PcieUtilCounter.PCIE_UTIL_COUNT) + + +# [Skipping] pynvml.nvmlSystemGetTopologyGpuSet +# [Skipping] pynvml.nvmlDeviceGetTopologyNearestGpus +# [Skipping] pynvml.nvmlDeviceGetTopologyCommonAncestor + +# Test pynvml.nvmlDeviceGetNvLinkVersion +# Test pynvml.nvmlDeviceGetNvLinkState +# Test pynvml.nvmlDeviceGetNvLinkRemotePciInfo + + +@pytest.mark.parametrize( + "cap_type", + [ + nvml.NvLinkCapability.NVLINK_CAP_P2P_SUPPORTED, # P2P over NVLink is supported + nvml.NvLinkCapability.NVLINK_CAP_SYSMEM_ACCESS, # Access to system memory is supported + nvml.NvLinkCapability.NVLINK_CAP_P2P_ATOMICS, # P2P atomics are supported + nvml.NvLinkCapability.NVLINK_CAP_SYSMEM_ATOMICS, # System memory atomics are supported + nvml.NvLinkCapability.NVLINK_CAP_SLI_BRIDGE, # SLI is supported over this link + nvml.NvLinkCapability.NVLINK_CAP_VALID, + ], +) # Link is supported on this device +def test_device_get_nvlink_capability(ngpus, handles, cap_type): + for i in range(ngpus): + for j in range(nvml.NVLINK_MAX_LINKS): + # By the documentation, this should be supported on PASCAL or newer, + # but this also seems to fail on newer. + with unsupported_before(handles[i], None): + cap = nvml.device_get_nvlink_capability(handles[i], j, cap_type) + assert cap >= 0 + + +# Test pynvml.nvmlDeviceResetNvLinkUtilizationCounter +# Test pynvml.nvmlDeviceSetNvLinkUtilizationControl +# Test pynvml.nvmlDeviceGetNvLinkUtilizationCounter +# Test pynvml.nvmlDeviceGetNvLinkUtilizationControl +# Test pynvml.nvmlDeviceFreezeNvLinkUtilizationCounter + +# Test pynvml.nvmlDeviceResetNvLinkErrorCounters +# Test pynvml.nvmlDeviceGetNvLinkErrorCounter diff --git a/cuda_bindings/tests/nvml/test_unit.py b/cuda_bindings/tests/nvml/test_unit.py new file mode 100644 index 00000000000..fb8c2552839 --- /dev/null +++ b/cuda_bindings/tests/nvml/test_unit.py @@ -0,0 +1,32 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +import pytest + +from cuda.bindings import nvml + + +@pytest.fixture +def unit_handles(nvml_init): + """Yield all unit handles, or skip if no units are present.""" + count = nvml.unit_get_count() + if count == 0: + pytest.skip("No NVML units present on this system") + return [nvml.unit_get_handle_by_index(i) for i in range(count)] + + +@pytest.mark.agent_authored(model="claude-sonnet-4-6") +def test_unit_get_devices_returns_array(unit_handles): + """Regression test: unit_get_devices must not crash due to double-pointer cast. + + Previously nvmlUnitGetDevices was called with unit instead of + unit, causing undefined behaviour because nvmlUnit_t is itself an + opaque pointer handle. + """ + for unit in unit_handles: + devices = nvml.unit_get_devices(unit) + # Result is a memoryview / cython array of intptr_t device handles. + assert hasattr(devices, "__len__") + # Each element must be a non-zero pointer (valid device handle). + for dev in devices: + assert dev != 0 diff --git a/cuda_bindings/tests/nvml/util.py b/cuda_bindings/tests/nvml/util.py new file mode 100644 index 00000000000..038fe58d8be --- /dev/null +++ b/cuda_bindings/tests/nvml/util.py @@ -0,0 +1,47 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + + +import functools +import platform +from pathlib import Path + +from cuda.bindings import nvml + +current_os = platform.system() +if current_os == "VMkernel": + current_os = "Linux" # Treat VMkernel as Linux + + +def is_windows(os=current_os): + return os == "Windows" + + +def is_linux(os=current_os): + return os == "Linux" + + +@functools.cache +def is_wsl(os=current_os): + return os == "Linux" and "microsoft" in Path("/proc/version").read_text().lower() + + +def is_vgpu(device): + """ + Returns True if device in vGPU virtualization mode + """ + return nvml.device_get_virtualization_mode(device) == nvml.GpuVirtualizationMode.VGPU + + +def supports_ecc(device): + try: + (cur_ecc, pend_ecc) = nvml.device_get_ecc_mode(device) + return cur_ecc != nvml.EnableState.FEATURE_DISABLED + except nvml.NotSupportedError as e: + return False + + +def supports_nvlink(device): + fields = nvml.FieldValue(1) + fields[0].field_id = nvml.FI.DEV_NVLINK_GET_STATE + return nvml.device_get_field_values(device, fields)[0].nvml_return == nvml.Return.SUCCESS diff --git a/cuda_bindings/tests/test_basics.py b/cuda_bindings/tests/test_basics.py new file mode 100644 index 00000000000..bbb11fddbb7 --- /dev/null +++ b/cuda_bindings/tests/test_basics.py @@ -0,0 +1,90 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +import enum +import sys + +import pytest + +from cuda.bindings._internal import _fast_enum + +# Test both with the FastEnum implementation and the stdlib enum.IntEnum (even +# though we don't use the latter) to make sure that the two APIs are identical + + +class MyFastEnum(_fast_enum.FastEnum): + RED = 0 + GREEN = 1 + BLUE = 2 + + +class MyIntEnum(enum.IntEnum): + RED = 0 + GREEN = 1 + BLUE = 2 + + +@pytest.mark.parametrize("MyEnum", [MyFastEnum, MyIntEnum]) +def test_enum(MyEnum): + container = MyEnum + + val = container.GREEN + + assert isinstance(val, MyEnum) + + assert container(1) is val + + with pytest.raises(ValueError): + container(3) + + # Different Python versions raise different error types here from + # stdlib.enum.IntEnum + with pytest.raises((ValueError, TypeError)): + container(1, 2, 3) + + with pytest.raises(TypeError): + container(foo=1) + + assert val == 1 + assert val.value == 1 + assert isinstance(val.value, int) + assert val.name == "GREEN" + assert isinstance(val.name, str) + + assert container.GREEN | container.BLUE == 3 + assert repr(container.GREEN | container.BLUE) == "3" + assert type(container.GREEN | container.BLUE) is int + assert container.GREEN.BLUE is container.BLUE + + assert repr(container) == f"" + assert repr(val) == f"<{container.__name__}.GREEN: 1>" + + assert len(container) == 3 + + for item in container: + assert isinstance(item, container) + assert item in container + if sys.version_info >= (3, 12): + assert item.value in container + assert item.name in dir(container) + for item2 in container: + assert hasattr(item, item2.name) + if sys.version_info >= (3, 11): + assert item2.name in dir(item) + assert getattr(item, item2.name) is item2 + + for name, val in container.__members__.items(): + assert isinstance(val, container) + assert isinstance(name, str) + assert name == val.name + + +def test_enum_doc(): + class MyFastEnumDoc(_fast_enum.FastEnum): + RED = (0, "The color red") + GREEN = (1, "The color green") + BLUE = (2, "The color blue") + + assert MyFastEnumDoc.RED.__doc__ == "The color red" + assert MyFastEnumDoc.GREEN.__doc__ == "The color green" + assert MyFastEnumDoc.BLUE.__doc__ == "The color blue" diff --git a/cuda_bindings/tests/test_cuda.py b/cuda_bindings/tests/test_cuda.py new file mode 100644 index 00000000000..192ad0f72fe --- /dev/null +++ b/cuda_bindings/tests/test_cuda.py @@ -0,0 +1,1357 @@ +# SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +import ctypes +import os.path +import shutil +import subprocess +import sys +import textwrap + +import numpy as np +import pytest + +import cuda.bindings.driver as cuda +import cuda.bindings.runtime as cudart +from cuda.bindings import driver +from cuda.bindings._test_helpers.mempool import xfail_if_mempool_oom + + +def driverVersionLessThan(target): + (err,) = cuda.cuInit(0) + assert err == cuda.CUresult.CUDA_SUCCESS + err, version = cuda.cuDriverGetVersion() + assert err == cuda.CUresult.CUDA_SUCCESS + return version < target + + +def supportsMemoryPool(): + err, isSupported = cudart.cudaDeviceGetAttribute(cudart.cudaDeviceAttr.cudaDevAttrMemoryPoolsSupported, 0) + return err == cudart.cudaError_t.cudaSuccess and isSupported + + +def supportsManagedMemory(): + err, isSupported = cudart.cudaDeviceGetAttribute(cudart.cudaDeviceAttr.cudaDevAttrManagedMemory, 0) + return err == cudart.cudaError_t.cudaSuccess and isSupported + + +def supportsCudaAPI(name): + return name in dir(cuda) + + +def callableBinary(name): + return shutil.which(name) is not None + + +@pytest.mark.skipif(True, reason="Always skip!") +def test_always_skip(): + pass + + +def test_cuda_memcpy(): + # Get device + + # Allocate dev memory + size = int(1024 * np.uint8().itemsize) + err, dptr = cuda.cuMemAlloc(size) + assert err == cuda.CUresult.CUDA_SUCCESS + + # Set h1 and h2 memory to be different + h1 = np.full(size, 1).astype(np.uint8) + h2 = np.full(size, 2).astype(np.uint8) + assert np.array_equal(h1, h2) is False + + # h1 to D + (err,) = cuda.cuMemcpyHtoD(dptr, h1, size) + assert err == cuda.CUresult.CUDA_SUCCESS + + # D to h2 + (err,) = cuda.cuMemcpyDtoH(h2, dptr, size) + assert err == cuda.CUresult.CUDA_SUCCESS + + # Validate h1 == h2 + assert np.array_equal(h1, h2) + + # Cleanup + (err,) = cuda.cuMemFree(dptr) + assert err == cuda.CUresult.CUDA_SUCCESS + + +def test_cuda_array(): + # No context created + desc = cuda.CUDA_ARRAY_DESCRIPTOR() + err, arr = cuda.cuArrayCreate(desc) + assert err == cuda.CUresult.CUDA_ERROR_INVALID_CONTEXT or err == cuda.CUresult.CUDA_ERROR_INVALID_VALUE + + # Desciption not filled + err, arr = cuda.cuArrayCreate(desc) + assert err == cuda.CUresult.CUDA_ERROR_INVALID_VALUE + + # Pass + desc.Format = cuda.CUarray_format.CU_AD_FORMAT_SIGNED_INT8 + desc.NumChannels = 1 + desc.Width = 1 + err, arr = cuda.cuArrayCreate(desc) + assert err == cuda.CUresult.CUDA_SUCCESS + + (err,) = cuda.cuArrayDestroy(arr) + assert err == cuda.CUresult.CUDA_SUCCESS + + +def test_cuda_repr_primitive(device, ctx): + assert str(device) == "" + assert int(device) == 0 + + assert str(ctx).startswith(" 0 + assert hex(ctx) == hex(int(ctx)) + + # CUdeviceptr + err, dptr = cuda.cuMemAlloc(1024 * np.uint8().itemsize) + assert err == cuda.CUresult.CUDA_SUCCESS + assert str(dptr).startswith(" 0 + (err,) = cuda.cuMemFree(dptr) + size = 7 + dptr = cuda.CUdeviceptr(size) + assert str(dptr) == f"" + assert int(dptr) == size + size = 4294967295 + dptr = cuda.CUdeviceptr(size) + assert str(dptr) == f"" + assert int(dptr) == size + size = 18446744073709551615 + dptr = cuda.CUdeviceptr(size) + assert str(dptr) == f"" + assert int(dptr) == size + + # cuuint32_t + size = 7 + int32 = cuda.cuuint32_t(size) + assert str(int32) == f"" + assert int(int32) == size + size = 4294967295 + int32 = cuda.cuuint32_t(size) + assert str(int32) == f"" + assert int(int32) == size + size = 18446744073709551615 + try: + int32 = cuda.cuuint32_t(size) + raise RuntimeError("int32 = cuda.cuuint32_t(18446744073709551615) did not fail") + except OverflowError as err: + pass + + # cuuint64_t + size = 7 + int64 = cuda.cuuint64_t(size) + assert str(int64) == f"" + assert int(int64) == size + size = 4294967295 + int64 = cuda.cuuint64_t(size) + assert str(int64) == f"" + assert int(int64) == size + size = 18446744073709551615 + int64 = cuda.cuuint64_t(size) + assert str(int64) == f"" + assert int(int64) == size + + +def test_cuda_repr_pointer(ctx): + # Test 1: Classes representing pointers + assert str(ctx).startswith(" 0 + assert hex(ctx) == hex(int(ctx)) + randomCtxPointer = 12345 + randomCtx = cuda.CUcontext(randomCtxPointer) + assert str(randomCtx) == f"" + assert int(randomCtx) == randomCtxPointer + assert hex(randomCtx) == hex(randomCtxPointer) + + # Test 2: Function pointers + func = 12345 + b2d_cb = cuda.CUoccupancyB2DSize(func) + assert str(b2d_cb) == f"" + assert int(b2d_cb) == func + assert hex(b2d_cb) == hex(func) + + +def test_cuda_uuid_list_access(device): + err, uuid = cuda.cuDeviceGetUuid(device) + assert err == cuda.CUresult.CUDA_SUCCESS + assert len(uuid.bytes) <= 16 + + jit_option = cuda.CUjit_option + options = { + jit_option.CU_JIT_INFO_LOG_BUFFER: 1, + jit_option.CU_JIT_INFO_LOG_BUFFER_SIZE_BYTES: 2, + jit_option.CU_JIT_ERROR_LOG_BUFFER: 3, + jit_option.CU_JIT_ERROR_LOG_BUFFER_SIZE_BYTES: 4, + jit_option.CU_JIT_LOG_VERBOSE: 5, + } + + +def test_cuda_cuModuleLoadDataEx(): + option_keys = [ + cuda.CUjit_option.CU_JIT_INFO_LOG_BUFFER, + cuda.CUjit_option.CU_JIT_INFO_LOG_BUFFER_SIZE_BYTES, + cuda.CUjit_option.CU_JIT_ERROR_LOG_BUFFER, + cuda.CUjit_option.CU_JIT_ERROR_LOG_BUFFER_SIZE_BYTES, + cuda.CUjit_option.CU_JIT_LOG_VERBOSE, + ] + # FIXME: This function call raises CUDA_ERROR_INVALID_VALUE + err, mod = cuda.cuModuleLoadDataEx(0, 0, option_keys, []) + + +def test_cuda_repr(): + actual = cuda.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS() + assert isinstance(actual, cuda.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS) + + actual_repr = actual.__repr__() + expected_repr = textwrap.dedent(""" + params : + fence : + value : 0 + nvSciSync : + fence : 0x0 + reserved : 0 + keyedMutex : + key : 0 + reserved : [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] +flags : 0 +reserved : [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] +""") + assert actual_repr.split() == expected_repr.split() + + actual_repr = cuda.CUDA_KERNEL_NODE_PARAMS_st().__repr__() + expected_repr = textwrap.dedent(""" + func : +gridDimX : 0 +gridDimY : 0 +gridDimZ : 0 +blockDimX : 0 +blockDimY : 0 +blockDimZ : 0 +sharedMemBytes : 0 +kernelParams : 0 +extra : 0 +""") + assert actual_repr.split() == expected_repr.split() + + +def test_cuda_struct_list_of_enums(): + desc = cuda.CUDA_TEXTURE_DESC_st() + desc.addressMode = [ + cuda.CUaddress_mode.CU_TR_ADDRESS_MODE_WRAP, + cuda.CUaddress_mode.CU_TR_ADDRESS_MODE_CLAMP, + cuda.CUaddress_mode.CU_TR_ADDRESS_MODE_MIRROR, + ] + + # # Too many args + # desc.addressMode = [cuda.CUaddress_mode.CU_TR_ADDRESS_MODE_WRAP, + # cuda.CUaddress_mode.CU_TR_ADDRESS_MODE_CLAMP, + # cuda.CUaddress_mode.CU_TR_ADDRESS_MODE_MIRROR, + # cuda.CUaddress_mode.CU_TR_ADDRESS_MODE_BORDER] + + # # Too little args + # desc.addressMode = [cuda.CUaddress_mode.CU_TR_ADDRESS_MODE_WRAP, + # cuda.CUaddress_mode.CU_TR_ADDRESS_MODE_CLAMP] + + +def test_cuda_CUstreamBatchMemOpParams(): + params = cuda.CUstreamBatchMemOpParams() + params.operation = cuda.CUstreamBatchMemOpType.CU_STREAM_MEM_OP_WAIT_VALUE_32 + params.waitValue.operation = cuda.CUstreamBatchMemOpType.CU_STREAM_MEM_OP_WAIT_VALUE_32 + params.writeValue.operation = cuda.CUstreamBatchMemOpType.CU_STREAM_MEM_OP_WAIT_VALUE_32 + params.flushRemoteWrites.operation = cuda.CUstreamBatchMemOpType.CU_STREAM_MEM_OP_WAIT_VALUE_32 + params.waitValue.value64 = 666 + assert int(params.waitValue.value64) == 666 + + +@pytest.mark.skipif( + driverVersionLessThan(11030) or not supportsMemoryPool(), reason="When new attributes were introduced" +) +def test_cuda_memPool_attr(): + poolProps = cuda.CUmemPoolProps() + poolProps.allocType = cuda.CUmemAllocationType.CU_MEM_ALLOCATION_TYPE_PINNED + poolProps.location.id = 0 + poolProps.location.type = cuda.CUmemLocationType.CU_MEM_LOCATION_TYPE_DEVICE + + attr_list = [None] * 8 + err, pool = cuda.cuMemPoolCreate(poolProps) + xfail_if_mempool_oom(err, "cuMemPoolCreate", poolProps.location.id) + assert err == cuda.CUresult.CUDA_SUCCESS + + for idx, attr in enumerate( + [ + cuda.CUmemPool_attribute.CU_MEMPOOL_ATTR_REUSE_FOLLOW_EVENT_DEPENDENCIES, + cuda.CUmemPool_attribute.CU_MEMPOOL_ATTR_REUSE_ALLOW_OPPORTUNISTIC, + cuda.CUmemPool_attribute.CU_MEMPOOL_ATTR_REUSE_ALLOW_INTERNAL_DEPENDENCIES, + cuda.CUmemPool_attribute.CU_MEMPOOL_ATTR_RELEASE_THRESHOLD, + cuda.CUmemPool_attribute.CU_MEMPOOL_ATTR_RESERVED_MEM_CURRENT, + cuda.CUmemPool_attribute.CU_MEMPOOL_ATTR_RESERVED_MEM_HIGH, + cuda.CUmemPool_attribute.CU_MEMPOOL_ATTR_USED_MEM_CURRENT, + cuda.CUmemPool_attribute.CU_MEMPOOL_ATTR_USED_MEM_HIGH, + ] + ): + err, attr_tmp = cuda.cuMemPoolGetAttribute(pool, attr) + assert err == cuda.CUresult.CUDA_SUCCESS + attr_list[idx] = attr_tmp + + for idxA, attr in enumerate( + [ + cuda.CUmemPool_attribute.CU_MEMPOOL_ATTR_REUSE_FOLLOW_EVENT_DEPENDENCIES, + cuda.CUmemPool_attribute.CU_MEMPOOL_ATTR_REUSE_ALLOW_OPPORTUNISTIC, + cuda.CUmemPool_attribute.CU_MEMPOOL_ATTR_REUSE_ALLOW_INTERNAL_DEPENDENCIES, + ] + ): + (err,) = cuda.cuMemPoolSetAttribute(pool, attr, 0) + assert err == cuda.CUresult.CUDA_SUCCESS + for idx, attr in enumerate([cuda.CUmemPool_attribute.CU_MEMPOOL_ATTR_RELEASE_THRESHOLD]): + (err,) = cuda.cuMemPoolSetAttribute(pool, attr, cuda.cuuint64_t(9)) + assert err == cuda.CUresult.CUDA_SUCCESS + + for idx, attr in enumerate( + [ + cuda.CUmemPool_attribute.CU_MEMPOOL_ATTR_REUSE_FOLLOW_EVENT_DEPENDENCIES, + cuda.CUmemPool_attribute.CU_MEMPOOL_ATTR_REUSE_ALLOW_OPPORTUNISTIC, + cuda.CUmemPool_attribute.CU_MEMPOOL_ATTR_REUSE_ALLOW_INTERNAL_DEPENDENCIES, + cuda.CUmemPool_attribute.CU_MEMPOOL_ATTR_RELEASE_THRESHOLD, + ] + ): + err, attr_tmp = cuda.cuMemPoolGetAttribute(pool, attr) + assert err == cuda.CUresult.CUDA_SUCCESS + attr_list[idx] = attr_tmp + assert attr_list[0] == 0 + assert attr_list[1] == 0 + assert attr_list[2] == 0 + assert int(attr_list[3]) == 9 + + (err,) = cuda.cuMemPoolDestroy(pool) + assert err == cuda.CUresult.CUDA_SUCCESS + + +@pytest.mark.skipif( + driverVersionLessThan(11030) or not supportsManagedMemory(), reason="When new attributes were introduced" +) +def test_cuda_pointer_attr(): + err, ptr = cuda.cuMemAllocManaged(0x1000, cuda.CUmemAttach_flags.CU_MEM_ATTACH_GLOBAL.value) + assert err == cuda.CUresult.CUDA_SUCCESS + + # Individual version + attr_type_list = [ + cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_CONTEXT, + cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_MEMORY_TYPE, + cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_DEVICE_POINTER, + cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_HOST_POINTER, + # cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_P2P_TOKENS, # TODO: Can I somehow test this? + cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_SYNC_MEMOPS, + cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_BUFFER_ID, + cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_IS_MANAGED, + cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_DEVICE_ORDINAL, + cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_IS_LEGACY_CUDA_IPC_CAPABLE, + cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_RANGE_START_ADDR, + cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_RANGE_SIZE, + cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_MAPPED, + cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_ALLOWED_HANDLE_TYPES, + cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_IS_GPU_DIRECT_RDMA_CAPABLE, + cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_ACCESS_FLAGS, + cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_MEMPOOL_HANDLE, + ] + attr_value_list = [None] * len(attr_type_list) + for idx, attr in enumerate(attr_type_list): + err, attr_tmp = cuda.cuPointerGetAttribute(attr, ptr) + assert err == cuda.CUresult.CUDA_SUCCESS + attr_value_list[idx] = attr_tmp + + # List version + err, attr_value_list_v2 = cuda.cuPointerGetAttributes(len(attr_type_list), attr_type_list, ptr) + assert err == cuda.CUresult.CUDA_SUCCESS + for attr1, attr2 in zip(attr_value_list, attr_value_list_v2): + assert str(attr1) == str(attr2) + + # Test setting values + for val in (True, False): + (err,) = cuda.cuPointerSetAttribute(val, cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_SYNC_MEMOPS, ptr) + assert err == cuda.CUresult.CUDA_SUCCESS + err, attr_tmp = cuda.cuPointerGetAttribute(cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_SYNC_MEMOPS, ptr) + assert err == cuda.CUresult.CUDA_SUCCESS + assert attr_tmp == val + + (err,) = cuda.cuMemFree(ptr) + assert err == cuda.CUresult.CUDA_SUCCESS + + +@pytest.mark.skipif( + driverVersionLessThan(11030) or not supportsManagedMemory(), reason="When new attributes were introduced" +) +def test_pointer_get_attributes_device_ordinal(): + attributes = [ + cuda.CUpointer_attribute.CU_POINTER_ATTRIBUTE_DEVICE_ORDINAL, + ] + + attrs = cuda.cuPointerGetAttributes(len(attributes), attributes, 0) + + # device ordinals are always small numbers. A large number would indicate + # an overflow error. + + assert abs(attrs[1][0]) < 256 + + +@pytest.mark.skipif(not supportsManagedMemory(), reason="When new attributes were introduced") +def test_cuda_mem_range_attr(device): + size = 0x1000 + location_device = cuda.CUmemLocation() + location_device.type = cuda.CUmemLocationType.CU_MEM_LOCATION_TYPE_DEVICE + location_device.id = int(device) + location_cpu = cuda.CUmemLocation() + location_cpu.type = cuda.CUmemLocationType.CU_MEM_LOCATION_TYPE_HOST + location_cpu.id = int(cuda.CU_DEVICE_CPU) + + err, ptr = cuda.cuMemAllocManaged(size, cuda.CUmemAttach_flags.CU_MEM_ATTACH_GLOBAL.value) + assert err == cuda.CUresult.CUDA_SUCCESS + (err,) = cuda.cuMemAdvise(ptr, size, cuda.CUmem_advise.CU_MEM_ADVISE_SET_READ_MOSTLY, location_device) + assert err == cuda.CUresult.CUDA_SUCCESS + (err,) = cuda.cuMemAdvise(ptr, size, cuda.CUmem_advise.CU_MEM_ADVISE_SET_PREFERRED_LOCATION, location_cpu) + assert err == cuda.CUresult.CUDA_SUCCESS + (err,) = cuda.cuMemAdvise(ptr, size, cuda.CUmem_advise.CU_MEM_ADVISE_SET_ACCESSED_BY, location_cpu) + assert err == cuda.CUresult.CUDA_SUCCESS + err, concurrentSupported = cuda.cuDeviceGetAttribute( + cuda.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS, device + ) + assert err == cuda.CUresult.CUDA_SUCCESS + if concurrentSupported: + (err,) = cuda.cuMemAdvise(ptr, size, cuda.CUmem_advise.CU_MEM_ADVISE_SET_ACCESSED_BY, location_device) + assert err == cuda.CUresult.CUDA_SUCCESS + expected_values_list = ([1, -1, [0, -1, -2], -2],) + else: + expected_values_list = ([1, -1, [-1, -2, -2], -2], [0, -2, [-2, -2, -2], -2]) + + # Individual version + attr_type_list = [ + cuda.CUmem_range_attribute.CU_MEM_RANGE_ATTRIBUTE_READ_MOSTLY, + cuda.CUmem_range_attribute.CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION, + cuda.CUmem_range_attribute.CU_MEM_RANGE_ATTRIBUTE_ACCESSED_BY, + cuda.CUmem_range_attribute.CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION, + ] + attr_type_size_list = [4, 4, 12, 4] + attr_value_list = [None] * len(attr_type_list) + for idx in range(len(attr_type_list)): + err, attr_tmp = cuda.cuMemRangeGetAttribute(attr_type_size_list[idx], attr_type_list[idx], ptr, size) + assert err == cuda.CUresult.CUDA_SUCCESS + attr_value_list[idx] = attr_tmp + + matched = False + for expected_values in expected_values_list: + if expected_values == attr_value_list: + matched = True + break + if not matched: + raise RuntimeError(f"attr_value_list {attr_value_list} did not match any {expected_values_list}") + + # List version + err, attr_value_list_v2 = cuda.cuMemRangeGetAttributes( + attr_type_size_list, attr_type_list, len(attr_type_list), ptr, size + ) + assert err == cuda.CUresult.CUDA_SUCCESS + for attr1, attr2 in zip(attr_value_list, attr_value_list_v2): + assert str(attr1) == str(attr2) + + (err,) = cuda.cuMemFree(ptr) + assert err == cuda.CUresult.CUDA_SUCCESS + + +@pytest.mark.skipif(driverVersionLessThan(11040) or not supportsMemoryPool(), reason="Mempool for graphs not supported") +@pytest.mark.thread_unsafe(reason="used high memory can be higher if threaded.") +def test_cuda_graphMem_attr(device): + err, stream = cuda.cuStreamCreate(0) + assert err == cuda.CUresult.CUDA_SUCCESS + + err, graph = cuda.cuGraphCreate(0) + assert err == cuda.CUresult.CUDA_SUCCESS + + allocSize = 1 + + params = cuda.CUDA_MEM_ALLOC_NODE_PARAMS() + params.poolProps.location.type = cuda.CUmemLocationType.CU_MEM_LOCATION_TYPE_DEVICE + params.poolProps.location.id = device + params.poolProps.allocType = cuda.CUmemAllocationType.CU_MEM_ALLOCATION_TYPE_PINNED + params.bytesize = allocSize + + err, allocNode = cuda.cuGraphAddMemAllocNode(graph, None, 0, params) + if err == cuda.CUresult.CUDA_ERROR_OUT_OF_MEMORY: + (destroy_err,) = cuda.cuGraphDestroy(graph) + assert destroy_err == cuda.CUresult.CUDA_SUCCESS + (destroy_err,) = cuda.cuStreamDestroy(stream) + assert destroy_err == cuda.CUresult.CUDA_SUCCESS + xfail_if_mempool_oom(err, "cuGraphAddMemAllocNode", device) + assert err == cuda.CUresult.CUDA_SUCCESS + err, freeNode = cuda.cuGraphAddMemFreeNode(graph, [allocNode], 1, params.dptr) + assert err == cuda.CUresult.CUDA_SUCCESS + + err, graphExec = cuda.cuGraphInstantiate(graph, 0) + assert err == cuda.CUresult.CUDA_SUCCESS + + (err,) = cuda.cuGraphLaunch(graphExec, stream) + assert err == cuda.CUresult.CUDA_SUCCESS + + err, used = cuda.cuDeviceGetGraphMemAttribute(device, cuda.CUgraphMem_attribute.CU_GRAPH_MEM_ATTR_USED_MEM_CURRENT) + assert err == cuda.CUresult.CUDA_SUCCESS + err, usedHigh = cuda.cuDeviceGetGraphMemAttribute(device, cuda.CUgraphMem_attribute.CU_GRAPH_MEM_ATTR_USED_MEM_HIGH) + assert err == cuda.CUresult.CUDA_SUCCESS + err, reserved = cuda.cuDeviceGetGraphMemAttribute( + device, cuda.CUgraphMem_attribute.CU_GRAPH_MEM_ATTR_RESERVED_MEM_CURRENT + ) + assert err == cuda.CUresult.CUDA_SUCCESS + err, reservedHigh = cuda.cuDeviceGetGraphMemAttribute( + device, cuda.CUgraphMem_attribute.CU_GRAPH_MEM_ATTR_RESERVED_MEM_HIGH + ) + assert err == cuda.CUresult.CUDA_SUCCESS + + assert int(used) >= allocSize + assert int(usedHigh) == int(used) + assert int(reserved) == int(usedHigh) + assert int(reservedHigh) == int(reserved) + + (err,) = cuda.cuGraphDestroy(graph) + assert err == cuda.CUresult.CUDA_SUCCESS + (err,) = cuda.cuStreamDestroy(stream) + assert err == cuda.CUresult.CUDA_SUCCESS + + +@pytest.mark.skipif( + driverVersionLessThan(12010) + or not supportsCudaAPI("cuCoredumpSetAttributeGlobal") + or not supportsCudaAPI("cuCoredumpGetAttributeGlobal"), + reason="Coredump API not present", +) +def test_cuda_coredump_attr(): + attr_list = [None] * 6 + + (err,) = cuda.cuCoredumpSetAttributeGlobal(cuda.CUcoredumpSettings.CU_COREDUMP_TRIGGER_HOST, False) + assert err == cuda.CUresult.CUDA_SUCCESS + (err,) = cuda.cuCoredumpSetAttributeGlobal(cuda.CUcoredumpSettings.CU_COREDUMP_FILE, b"corefile") + assert err == cuda.CUresult.CUDA_SUCCESS + (err,) = cuda.cuCoredumpSetAttributeGlobal(cuda.CUcoredumpSettings.CU_COREDUMP_PIPE, b"corepipe") + assert err == cuda.CUresult.CUDA_SUCCESS + (err,) = cuda.cuCoredumpSetAttributeGlobal(cuda.CUcoredumpSettings.CU_COREDUMP_LIGHTWEIGHT, True) + assert err == cuda.CUresult.CUDA_SUCCESS + + for idx, attr in enumerate( + [ + cuda.CUcoredumpSettings.CU_COREDUMP_TRIGGER_HOST, + cuda.CUcoredumpSettings.CU_COREDUMP_FILE, + cuda.CUcoredumpSettings.CU_COREDUMP_PIPE, + cuda.CUcoredumpSettings.CU_COREDUMP_LIGHTWEIGHT, + ] + ): + err, attr_tmp = cuda.cuCoredumpGetAttributeGlobal(attr) + assert err == cuda.CUresult.CUDA_SUCCESS + attr_list[idx] = attr_tmp + + assert attr_list[0] is False + assert attr_list[1] == b"corefile" + assert attr_list[2] == b"corepipe" + assert attr_list[3] is True + + +def test_get_error_name_and_string(): + err, device = cuda.cuDeviceGet(0) + _, s = cuda.cuGetErrorString(err) + assert s == b"no error" + _, s = cuda.cuGetErrorName(err) + assert s == b"CUDA_SUCCESS" + + err, device = cuda.cuDeviceGet(-1) + _, s = cuda.cuGetErrorString(err) + assert s == b"invalid device ordinal" + _, s = cuda.cuGetErrorName(err) + assert s == b"CUDA_ERROR_INVALID_DEVICE" + + +# TODO: cuStreamGetCaptureInfo_v2 +@pytest.mark.skipif(driverVersionLessThan(11030), reason="Driver too old for cuStreamGetCaptureInfo_v2") +def test_stream_capture(): + pass + + +def test_profiler(): + (err,) = cuda.cuProfilerStart() + assert err == cuda.CUresult.CUDA_SUCCESS + (err,) = cuda.cuProfilerStop() + assert err == cuda.CUresult.CUDA_SUCCESS + + +def test_eglFrame(): + val = cuda.CUeglFrame() + # [, , ] + assert int(val.frame.pArray[0]) == 0 + assert int(val.frame.pArray[1]) == 0 + assert int(val.frame.pArray[2]) == 0 + val.frame.pArray = [1, 2, 3] + # [, , ] + assert int(val.frame.pArray[0]) == 1 + assert int(val.frame.pArray[1]) == 2 + assert int(val.frame.pArray[2]) == 3 + val.frame.pArray = [cuda.CUarray(4), 2, 3] + # [, , ] + assert int(val.frame.pArray[0]) == 4 + assert int(val.frame.pArray[1]) == 2 + assert int(val.frame.pArray[2]) == 3 + val.frame.pPitch = [4, 2, 3] + # [4, 2, 3] + assert int(val.frame.pPitch[0]) == 4 + assert int(val.frame.pPitch[1]) == 2 + assert int(val.frame.pPitch[2]) == 3 + val.frame.pPitch = [1, 2, 3] + assert int(val.frame.pPitch[0]) == 1 + assert int(val.frame.pPitch[1]) == 2 + assert int(val.frame.pPitch[2]) == 3 + + +def test_char_range(): + val = cuda.CUipcMemHandle_st() + for x in range(-128, 0): + val.reserved = [x] * 64 + assert val.reserved[0] == 256 + x + for x in range(256): + val.reserved = [x] * 64 + assert val.reserved[0] == x + + +def test_anon_assign(): + val1 = cuda.CUexecAffinityParam_st() + val2 = cuda.CUexecAffinityParam_st() + + assert val1.param.smCount.val == 0 + val1.param.smCount.val = 5 + assert val1.param.smCount.val == 5 + val2.param.smCount.val = 11 + assert val2.param.smCount.val == 11 + + val1.param = val2.param + assert val1.param.smCount.val == 11 + + +def test_union_assign(): + val = cuda.CUlaunchAttributeValue() + val.clusterDim.x, val.clusterDim.y, val.clusterDim.z = 9, 9, 9 + attr = cuda.CUlaunchAttribute() + attr.value = val + + assert val.clusterDim.x == 9 + assert val.clusterDim.y == 9 + assert val.clusterDim.z == 9 + + +def test_invalid_repr_attribute(): + val = cuda.CUlaunchAttributeValue() + string = str(val) + + +@pytest.mark.skipif( + driverVersionLessThan(12020) + or not supportsCudaAPI("cuGraphAddNode") + or not supportsCudaAPI("cuGraphNodeSetParams") + or not supportsCudaAPI("cuGraphExecNodeSetParams"), + reason="Polymorphic graph APIs required", +) +def test_graph_poly(): + err, stream = cuda.cuStreamCreate(0) + assert err == cuda.CUresult.CUDA_SUCCESS + + # cuGraphAddNode + + # Create 2 buffers + size = int(1024 * np.uint8().itemsize) + buffers = [] + for _ in range(2): + err, dptr = cuda.cuMemAlloc(size) + assert err == cuda.CUresult.CUDA_SUCCESS + buffers += [(np.full(size, 2).astype(np.uint8), dptr)] + + # Update dev buffers + for host, device in buffers: + (err,) = cuda.cuMemcpyHtoD(device, host, size) + assert err == cuda.CUresult.CUDA_SUCCESS + + # Create graph + nodes = [] + err, graph = cuda.cuGraphCreate(0) + assert err == cuda.CUresult.CUDA_SUCCESS + + # Memset + host, device = buffers[0] + memsetParams = cuda.CUgraphNodeParams() + memsetParams.type = cuda.CUgraphNodeType.CU_GRAPH_NODE_TYPE_MEMSET + memsetParams.memset.elementSize = np.uint8().itemsize + memsetParams.memset.width = size + memsetParams.memset.height = 1 + memsetParams.memset.dst = device + memsetParams.memset.value = 1 + err, node = cuda.cuGraphAddNode(graph, None, None, 0, memsetParams) + assert err == cuda.CUresult.CUDA_SUCCESS + nodes += [node] + + # Memcpy + host, device = buffers[1] + memcpyParams = cuda.CUgraphNodeParams() + memcpyParams.type = cuda.CUgraphNodeType.CU_GRAPH_NODE_TYPE_MEMCPY + memcpyParams.memcpy.copyParams.srcMemoryType = cuda.CUmemorytype.CU_MEMORYTYPE_DEVICE + memcpyParams.memcpy.copyParams.srcDevice = device + memcpyParams.memcpy.copyParams.dstMemoryType = cuda.CUmemorytype.CU_MEMORYTYPE_HOST + memcpyParams.memcpy.copyParams.dstHost = host + memcpyParams.memcpy.copyParams.WidthInBytes = size + memcpyParams.memcpy.copyParams.Height = 1 + memcpyParams.memcpy.copyParams.Depth = 1 + err, node = cuda.cuGraphAddNode(graph, None, None, 0, memcpyParams) + assert err == cuda.CUresult.CUDA_SUCCESS + nodes += [node] + + # Instantiate, execute, validate + err, graphExec = cuda.cuGraphInstantiate(graph, 0) + assert err == cuda.CUresult.CUDA_SUCCESS + (err,) = cuda.cuGraphLaunch(graphExec, stream) + assert err == cuda.CUresult.CUDA_SUCCESS + (err,) = cuda.cuStreamSynchronize(stream) + assert err == cuda.CUresult.CUDA_SUCCESS + + # Validate + for host, device in buffers: + (err,) = cuda.cuMemcpyDtoH(host, device, size) + assert err == cuda.CUresult.CUDA_SUCCESS + assert np.array_equal(buffers[0][0], np.full(size, 1).astype(np.uint8)) + assert np.array_equal(buffers[1][0], np.full(size, 2).astype(np.uint8)) + + # cuGraphNodeSetParams + host, device = buffers[1] + err, memcpyParamsCopy = cuda.cuGraphMemcpyNodeGetParams(nodes[1]) + assert err == cuda.CUresult.CUDA_SUCCESS + assert int(memcpyParamsCopy.srcDevice) == int(device) + host, device = buffers[0] + memcpyParams.memcpy.copyParams.srcDevice = device + (err,) = cuda.cuGraphNodeSetParams(nodes[1], memcpyParams) + assert err == cuda.CUresult.CUDA_SUCCESS + err, memcpyParamsCopy = cuda.cuGraphMemcpyNodeGetParams(nodes[1]) + assert err == cuda.CUresult.CUDA_SUCCESS + assert int(memcpyParamsCopy.srcDevice) == int(device) + + # cuGraphExecNodeSetParams + memsetParams.memset.value = 11 + (err,) = cuda.cuGraphExecNodeSetParams(graphExec, nodes[0], memsetParams) + assert err == cuda.CUresult.CUDA_SUCCESS + (err,) = cuda.cuGraphLaunch(graphExec, stream) + assert err == cuda.CUresult.CUDA_SUCCESS + (err,) = cuda.cuStreamSynchronize(stream) + assert err == cuda.CUresult.CUDA_SUCCESS + (err,) = cuda.cuMemcpyDtoH(buffers[0][0], buffers[0][1], size) + assert err == cuda.CUresult.CUDA_SUCCESS + assert np.array_equal(buffers[0][0], np.full(size, 11).astype(np.uint8)) + + # Cleanup + (err,) = cuda.cuMemFree(buffers[0][1]) + assert err == cuda.CUresult.CUDA_SUCCESS + (err,) = cuda.cuMemFree(buffers[1][1]) + assert err == cuda.CUresult.CUDA_SUCCESS + (err,) = cuda.cuGraphExecDestroy(graphExec) + assert err == cuda.CUresult.CUDA_SUCCESS + (err,) = cuda.cuGraphDestroy(graph) + assert err == cuda.CUresult.CUDA_SUCCESS + (err,) = cuda.cuStreamDestroy(stream) + assert err == cuda.CUresult.CUDA_SUCCESS + + +@pytest.mark.skipif( + driverVersionLessThan(12040) or not supportsCudaAPI("cuDeviceGetDevResource"), + reason="Polymorphic graph APIs required", +) +def test_cuDeviceGetDevResource(device): + err, resource_in = cuda.cuDeviceGetDevResource(device, cuda.CUdevResourceType.CU_DEV_RESOURCE_TYPE_SM) + + err, res, count, rem = cuda.cuDevSmResourceSplitByCount(0, resource_in, 0, 2) + assert err == cuda.CUresult.CUDA_SUCCESS + assert count != 0 + assert len(res) == 0 + err, res, count_same, rem = cuda.cuDevSmResourceSplitByCount(count, resource_in, 0, 2) + assert err == cuda.CUresult.CUDA_SUCCESS + assert count == count_same + assert len(res) == count + err, res, count, rem = cuda.cuDevSmResourceSplitByCount(3, resource_in, 0, 2) + assert err == cuda.CUresult.CUDA_SUCCESS + assert len(res) == 3 + + +@pytest.mark.skipif( + driverVersionLessThan(12030) or not supportsCudaAPI("cuGraphConditionalHandleCreate"), + reason="Conditional graph APIs required", +) +def test_conditional(ctx): + err, graph = cuda.cuGraphCreate(0) + assert err == cuda.CUresult.CUDA_SUCCESS + err, handle = cuda.cuGraphConditionalHandleCreate(graph, ctx, 0, 0) + assert err == cuda.CUresult.CUDA_SUCCESS + + params = cuda.CUgraphNodeParams() + params.type = cuda.CUgraphNodeType.CU_GRAPH_NODE_TYPE_CONDITIONAL + params.conditional.handle = handle + params.conditional.type = cuda.CUgraphConditionalNodeType.CU_GRAPH_COND_TYPE_IF + params.conditional.size = 1 + params.conditional.ctx = ctx + + assert len(params.conditional.phGraph_out) == 1 + assert int(params.conditional.phGraph_out[0]) == 0 + err, node = cuda.cuGraphAddNode(graph, None, None, 0, params) + assert err == cuda.CUresult.CUDA_SUCCESS + + assert len(params.conditional.phGraph_out) == 1 + assert int(params.conditional.phGraph_out[0]) != 0 + + +def test_CUmemDecompressParams_st(): + desc = cuda.CUmemDecompressParams_st() + assert int(desc.dstActBytes) == 0 + + +def test_all_CUresult_codes(): + max_code = int(max(cuda.CUresult)) + # Smoke test. CUDA_ERROR_UNKNOWN = 999, but intentionally using literal value. + assert max_code >= 999 + num_good = 0 + for code in range(max_code + 2): # One past max_code + try: + error = cuda.CUresult(code) + except ValueError: + pass # cython-generated enum does not exist for this code + else: + err_name, name = cuda.cuGetErrorName(error) + if err_name == cuda.CUresult.CUDA_SUCCESS: + assert name + err_desc, desc = cuda.cuGetErrorString(error) + assert err_desc == cuda.CUresult.CUDA_SUCCESS + assert desc + num_good += 1 + else: + # cython-generated enum exists but is not known to an older driver + # (example: cuda-bindings built with CTK 12.8, driver from CTK 12.0) + assert name is None + assert err_name == cuda.CUresult.CUDA_ERROR_INVALID_VALUE + err_desc, desc = cuda.cuGetErrorString(error) + assert err_desc == cuda.CUresult.CUDA_ERROR_INVALID_VALUE + assert desc is None + # Smoke test: Do we have at least some "good" codes? + # The number will increase over time as new enums are added and support for + # old CTKs is dropped, but it is not critical that this number is updated. + assert num_good >= 76 # CTK 11.0.3_450.51.06 + + +@pytest.mark.skipif(driverVersionLessThan(12030), reason="Driver too old for cuKernelGetName") +def test_cuKernelGetName_failure(): + err, name = cuda.cuKernelGetName(0) + assert err == cuda.CUresult.CUDA_ERROR_INVALID_VALUE + assert name is None + + +@pytest.mark.skipif(driverVersionLessThan(12030), reason="Driver too old for cuFuncGetName") +def test_cuFuncGetName_failure(): + err, name = cuda.cuFuncGetName(0) + assert err == cuda.CUresult.CUDA_ERROR_INVALID_VALUE + assert name is None + + +@pytest.mark.skipif( + driverVersionLessThan(12080) or not supportsCudaAPI("cuCheckpointProcessGetState"), + reason="When API was introduced", +) +def test_cuCheckpointProcessGetState_failure(): + err, state = cuda.cuCheckpointProcessGetState(123434) + assert err != cuda.CUresult.CUDA_SUCCESS + assert state is None + + +def test_private_function_pointer_inspector(): + from cuda.bindings._internal.driver import _inspect_function_pointer + + assert _inspect_function_pointer("__cuGetErrorString") != 0 + + +@pytest.mark.parametrize( + "target", + ( + driver.CUcontext, + driver.CUstream, + driver.CUevent, + driver.CUmodule, + driver.CUlibrary, + driver.CUfunction, + driver.CUkernel, + driver.CUgraph, + driver.CUgraphNode, + driver.CUgraphExec, + driver.CUmemoryPool, + ), +) +def test_struct_pointer_comparison(target): + a = target(123) + b = target(123) + assert a == b + assert hash(a) == hash(b) + c = target(456) + assert a != c + assert hash(a) != hash(c) + + +@pytest.mark.skipif( + driverVersionLessThan(13010) or not supportsCudaAPI("cuGraphGetId"), + reason="Requires CUDA 13.1+", +) +def test_cuGraphGetId(device, ctx): + """Test cuGraphGetId - get graph ID.""" + err, graph = cuda.cuGraphCreate(0) + assert err == cuda.CUresult.CUDA_SUCCESS + + err, graph_id = cuda.cuGraphGetId(graph) + assert err == cuda.CUresult.CUDA_SUCCESS + assert isinstance(graph_id, int) + assert graph_id > 0 + + # Create another graph and verify it has a different ID + err, graph2 = cuda.cuGraphCreate(0) + assert err == cuda.CUresult.CUDA_SUCCESS + err, graph_id2 = cuda.cuGraphGetId(graph2) + assert err == cuda.CUresult.CUDA_SUCCESS + assert graph_id2 != graph_id + + (err,) = cuda.cuGraphDestroy(graph) + assert err == cuda.CUresult.CUDA_SUCCESS + (err,) = cuda.cuGraphDestroy(graph2) + assert err == cuda.CUresult.CUDA_SUCCESS + + +@pytest.mark.skipif( + driverVersionLessThan(13010) or not supportsCudaAPI("cuGraphExecGetId"), + reason="Requires CUDA 13.1+", +) +def test_cuGraphExecGetId(device, ctx): + """Test cuGraphExecGetId - get graph exec ID.""" + err, stream = cuda.cuStreamCreate(0) + assert err == cuda.CUresult.CUDA_SUCCESS + + err, graph = cuda.cuGraphCreate(0) + assert err == cuda.CUresult.CUDA_SUCCESS + + # Add an empty node to make the graph valid + err, node = cuda.cuGraphAddEmptyNode(graph, None, 0) + assert err == cuda.CUresult.CUDA_SUCCESS + + err, graphExec = cuda.cuGraphInstantiate(graph, 0) + assert err == cuda.CUresult.CUDA_SUCCESS + + err, graph_exec_id = cuda.cuGraphExecGetId(graphExec) + assert err == cuda.CUresult.CUDA_SUCCESS + assert isinstance(graph_exec_id, int) + assert graph_exec_id > 0 + + # Create another graph exec and verify it has a different ID + err, graph2 = cuda.cuGraphCreate(0) + assert err == cuda.CUresult.CUDA_SUCCESS + err, node2 = cuda.cuGraphAddEmptyNode(graph2, None, 0) + assert err == cuda.CUresult.CUDA_SUCCESS + err, graphExec2 = cuda.cuGraphInstantiate(graph2, 0) + assert err == cuda.CUresult.CUDA_SUCCESS + err, graph_exec_id2 = cuda.cuGraphExecGetId(graphExec2) + assert err == cuda.CUresult.CUDA_SUCCESS + assert graph_exec_id2 != graph_exec_id + + (err,) = cuda.cuGraphExecDestroy(graphExec) + assert err == cuda.CUresult.CUDA_SUCCESS + (err,) = cuda.cuGraphExecDestroy(graphExec2) + assert err == cuda.CUresult.CUDA_SUCCESS + (err,) = cuda.cuGraphDestroy(graph) + assert err == cuda.CUresult.CUDA_SUCCESS + (err,) = cuda.cuGraphDestroy(graph2) + assert err == cuda.CUresult.CUDA_SUCCESS + (err,) = cuda.cuStreamDestroy(stream) + assert err == cuda.CUresult.CUDA_SUCCESS + + +def test_cuGraphGetEdges_edgeData_outlives_call(device, ctx): + # Regression test for https://github.com/NVIDIA/cuda-python/issues/1804 + # cuGraphGetEdges previously returned CUgraphEdgeData wrappers backed by + # a scratch buffer that was freed before the call returned, leaving the + # wrappers pointing at freed memory. Ensure the returned objects remain + # readable after the call and after subsequent allocations. + err, graph = cuda.cuGraphCreate(0) + assert err == cuda.CUresult.CUDA_SUCCESS + try: + err, n0 = cuda.cuGraphAddEmptyNode(graph, None, 0) + assert err == cuda.CUresult.CUDA_SUCCESS + err, n1 = cuda.cuGraphAddEmptyNode(graph, [n0], 1) + assert err == cuda.CUresult.CUDA_SUCCESS + err, n2 = cuda.cuGraphAddEmptyNode(graph, [n0, n1], 2) + assert err == cuda.CUresult.CUDA_SUCCESS + + err, _, _, _, num_edges = cuda.cuGraphGetEdges(graph) + assert err == cuda.CUresult.CUDA_SUCCESS + assert num_edges == 3 + err, from_nodes, to_nodes, edge_data, num_edges = cuda.cuGraphGetEdges(graph, num_edges) + assert err == cuda.CUresult.CUDA_SUCCESS + assert len(edge_data) == num_edges == 3 + + # Stir the heap to make a use-after-free more likely to surface. + for _ in range(64): + err, _, _, _, _ = cuda.cuGraphGetEdges(graph, num_edges) + assert err == cuda.CUresult.CUDA_SUCCESS + err, _, _, _ = cuda.cuGraphNodeGetDependencies(n1, 1) + assert err == cuda.CUresult.CUDA_SUCCESS + + # Each wrapper must still own its data. + for ed in edge_data: + assert ed.from_port == 0 + assert ed.to_port == 0 + assert int(ed.type) == 0 + assert ed.reserved == b"\x00" * 5 + finally: + (err,) = cuda.cuGraphDestroy(graph) + assert err == cuda.CUresult.CUDA_SUCCESS + + +def test_cuGraphNodeGetDependencies_edgeData_outlives_call(device, ctx): + # Companion regression test for #1804 covering the dependency-query path. + err, graph = cuda.cuGraphCreate(0) + assert err == cuda.CUresult.CUDA_SUCCESS + try: + err, n0 = cuda.cuGraphAddEmptyNode(graph, None, 0) + assert err == cuda.CUresult.CUDA_SUCCESS + err, n1 = cuda.cuGraphAddEmptyNode(graph, [n0], 1) + assert err == cuda.CUresult.CUDA_SUCCESS + + err, _, _, num_deps = cuda.cuGraphNodeGetDependencies(n1) + assert err == cuda.CUresult.CUDA_SUCCESS + assert num_deps == 1 + err, deps, edge_data, num_deps = cuda.cuGraphNodeGetDependencies(n1, num_deps) + assert err == cuda.CUresult.CUDA_SUCCESS + assert len(edge_data) == num_deps == 1 + + err, _, _, num_dependents = cuda.cuGraphNodeGetDependentNodes(n0) + assert err == cuda.CUresult.CUDA_SUCCESS + assert num_dependents == 1 + err, dependents, dep_edge_data, num_dependents = cuda.cuGraphNodeGetDependentNodes(n0, num_dependents) + assert err == cuda.CUresult.CUDA_SUCCESS + assert len(dep_edge_data) == num_dependents == 1 + + for _ in range(64): + err, _, _, _ = cuda.cuGraphNodeGetDependencies(n1, num_deps) + assert err == cuda.CUresult.CUDA_SUCCESS + err, _, _, _ = cuda.cuGraphNodeGetDependentNodes(n0, num_dependents) + assert err == cuda.CUresult.CUDA_SUCCESS + + for ed in edge_data + dep_edge_data: + assert ed.from_port == 0 + assert ed.to_port == 0 + assert int(ed.type) == 0 + assert ed.reserved == b"\x00" * 5 + finally: + (err,) = cuda.cuGraphDestroy(graph) + assert err == cuda.CUresult.CUDA_SUCCESS + + +@pytest.mark.skipif( + driverVersionLessThan(13010) or not supportsCudaAPI("cuGraphNodeGetLocalId"), + reason="Requires CUDA 13.1+", +) +def test_cuGraphNodeGetLocalId(device, ctx): + """Test cuGraphNodeGetLocalId - get node local ID.""" + err, graph = cuda.cuGraphCreate(0) + assert err == cuda.CUresult.CUDA_SUCCESS + + # Add multiple nodes + err, node1 = cuda.cuGraphAddEmptyNode(graph, None, 0) + assert err == cuda.CUresult.CUDA_SUCCESS + + err, node2 = cuda.cuGraphAddEmptyNode(graph, [node1], 1) + assert err == cuda.CUresult.CUDA_SUCCESS + + err, node3 = cuda.cuGraphAddEmptyNode(graph, [node1, node2], 2) + assert err == cuda.CUresult.CUDA_SUCCESS + + # Get local IDs for each node + err, node_id1 = cuda.cuGraphNodeGetLocalId(node1) + assert err == cuda.CUresult.CUDA_SUCCESS + assert isinstance(node_id1, int) + assert node_id1 >= 0 + + err, node_id2 = cuda.cuGraphNodeGetLocalId(node2) + assert err == cuda.CUresult.CUDA_SUCCESS + assert isinstance(node_id2, int) + assert node_id2 >= 0 + assert node_id2 != node_id1 + + err, node_id3 = cuda.cuGraphNodeGetLocalId(node3) + assert err == cuda.CUresult.CUDA_SUCCESS + assert isinstance(node_id3, int) + assert node_id3 >= 0 + assert node_id3 != node_id1 + assert node_id3 != node_id2 + + (err,) = cuda.cuGraphDestroy(graph) + assert err == cuda.CUresult.CUDA_SUCCESS + + +@pytest.mark.skipif( + driverVersionLessThan(13010) or not supportsCudaAPI("cuGraphNodeGetToolsId"), + reason="Requires CUDA 13.1+", +) +def test_cuGraphNodeGetToolsId(device, ctx): + """Test cuGraphNodeGetToolsId - get node tools ID.""" + err, graph = cuda.cuGraphCreate(0) + assert err == cuda.CUresult.CUDA_SUCCESS + + err, node = cuda.cuGraphAddEmptyNode(graph, None, 0) + assert err == cuda.CUresult.CUDA_SUCCESS + + err, tools_node_id = cuda.cuGraphNodeGetToolsId(node) + assert err == cuda.CUresult.CUDA_SUCCESS + assert isinstance(tools_node_id, int) + # toolsNodeId is unsigned long long, so it can be any non-negative value + assert tools_node_id >= 0 + + # Add another node and verify it has a different tools ID + err, node2 = cuda.cuGraphAddEmptyNode(graph, [node], 1) + assert err == cuda.CUresult.CUDA_SUCCESS + err, tools_node_id2 = cuda.cuGraphNodeGetToolsId(node2) + assert err == cuda.CUresult.CUDA_SUCCESS + assert tools_node_id2 != tools_node_id + + (err,) = cuda.cuGraphDestroy(graph) + assert err == cuda.CUresult.CUDA_SUCCESS + + +@pytest.mark.skipif( + driverVersionLessThan(13010) or not supportsCudaAPI("cuGraphNodeGetContainingGraph"), + reason="Requires CUDA 13.1+", +) +def test_cuGraphNodeGetContainingGraph(device, ctx): + """Test cuGraphNodeGetContainingGraph - get graph containing a node.""" + err, graph = cuda.cuGraphCreate(0) + assert err == cuda.CUresult.CUDA_SUCCESS + + err, node = cuda.cuGraphAddEmptyNode(graph, None, 0) + assert err == cuda.CUresult.CUDA_SUCCESS + + # Get the containing graph + err, containing_graph = cuda.cuGraphNodeGetContainingGraph(node) + assert err == cuda.CUresult.CUDA_SUCCESS + # Verify it's the same graph + assert int(containing_graph) == int(graph) + + # Test with a child graph node (if supported) + # Create a child graph node + err, child_graph = cuda.cuGraphCreate(0) + assert err == cuda.CUresult.CUDA_SUCCESS + err, child_node = cuda.cuGraphAddEmptyNode(child_graph, None, 0) + assert err == cuda.CUresult.CUDA_SUCCESS + + # Add child graph node to parent graph + childGraphNodeParams = cuda.CUgraphNodeParams() + childGraphNodeParams.type = cuda.CUgraphNodeType.CU_GRAPH_NODE_TYPE_GRAPH + childGraphNodeParams.graph.graph = child_graph + err, child_graph_node = cuda.cuGraphAddNode(graph, None, None, 0, childGraphNodeParams) + if err == cuda.CUresult.CUDA_SUCCESS: + # Get containing graph for the child graph node + err, containing_graph_for_child = cuda.cuGraphNodeGetContainingGraph(child_graph_node) + assert err == cuda.CUresult.CUDA_SUCCESS + assert int(containing_graph_for_child) == int(graph) + + # Get containing graph for node inside child graph + err, containing_graph_for_nested = cuda.cuGraphNodeGetContainingGraph(child_node) + assert err == cuda.CUresult.CUDA_SUCCESS + assert int(containing_graph_for_nested) == int(child_graph) + + (err,) = cuda.cuGraphDestroy(graph) + assert err == cuda.CUresult.CUDA_SUCCESS + (err,) = cuda.cuGraphDestroy(child_graph) + assert err == cuda.CUresult.CUDA_SUCCESS + + +@pytest.mark.skipif( + driverVersionLessThan(13010) or not supportsCudaAPI("cuStreamGetDevResource"), + reason="Requires CUDA 13.1+", +) +def test_cuStreamGetDevResource(device, ctx): + """Test cuStreamGetDevResource - get device resource from stream.""" + err, stream = cuda.cuStreamCreate(0) + assert err == cuda.CUresult.CUDA_SUCCESS + + # Get SM resource from stream + err, resource = cuda.cuStreamGetDevResource(stream, cuda.CUdevResourceType.CU_DEV_RESOURCE_TYPE_SM) + assert err == cuda.CUresult.CUDA_SUCCESS + # Verify resource is valid (non-None) + assert resource is not None + + (err,) = cuda.cuStreamDestroy(stream) + assert err == cuda.CUresult.CUDA_SUCCESS + + +@pytest.mark.skipif( + driverVersionLessThan(13010) or not supportsCudaAPI("cuDevSmResourceSplit"), + reason="Requires CUDA 13.1+", +) +def test_cuDevSmResourceSplit(device, ctx): + """Test cuDevSmResourceSplit - split SM resource into structured groups.""" + err, resource_in = cuda.cuDeviceGetDevResource(device, cuda.CUdevResourceType.CU_DEV_RESOURCE_TYPE_SM) + assert err == cuda.CUresult.CUDA_SUCCESS + + # Test case 1: Split into 1 group + nb_groups = 1 + group_params = [cuda.CU_DEV_SM_RESOURCE_GROUP_PARAMS()] + # Set up group: request 4 SMs with coscheduled count of 2 + group_params[0].smCount = 4 + group_params[0].coscheduledSmCount = 2 + + err, res, rem = cuda.cuDevSmResourceSplit(nb_groups, resource_in, 0, group_params) + assert err == cuda.CUresult.CUDA_SUCCESS + assert len(res) == nb_groups + assert rem is not None or len(res) > 0 + + # Test case 2: Split into 2 groups (if device has enough SMs) + # First, get the device resource again for a fresh split + err, resource_in = cuda.cuDeviceGetDevResource(device, cuda.CUdevResourceType.CU_DEV_RESOURCE_TYPE_SM) + assert err == cuda.CUresult.CUDA_SUCCESS + + nb_groups = 2 + group_params = [ + cuda.CU_DEV_SM_RESOURCE_GROUP_PARAMS(), + cuda.CU_DEV_SM_RESOURCE_GROUP_PARAMS(), + ] + # First group: request 4 SMs with coscheduled count of 2 + group_params[0].smCount = 4 + group_params[0].coscheduledSmCount = 2 + # Second group: request 4 SMs with coscheduled count of 2 + group_params[1].smCount = 4 + group_params[1].coscheduledSmCount = 2 + + err, res, rem = cuda.cuDevSmResourceSplit(nb_groups, resource_in, 0, group_params) + # This may succeed or fail depending on device SM count, but should handle gracefully + if err == cuda.CUresult.CUDA_SUCCESS: + assert len(res) == nb_groups + assert rem is not None or len(res) > 0 + else: + # If it fails, it should be due to insufficient resources, not a binding error + assert err in ( + cuda.CUresult.CUDA_ERROR_INVALID_RESOURCE_CONFIGURATION, + cuda.CUresult.CUDA_ERROR_INVALID_VALUE, + ) + + # Test case 3: Empty list (0 groups) - should handle gracefully + # Note: According to CUDA docs, nbGroups specifies number of groups, so 0 might not be valid + # But we test that the binding accepts an empty list without crashing + nb_groups = 0 + group_params = [] + + err, res, rem = cuda.cuDevSmResourceSplit(nb_groups, resource_in, 0, group_params) + # With 0 groups, result should be empty + if err == cuda.CUresult.CUDA_SUCCESS: + assert len(res) == 0 + else: + # If it fails, it should be a valid CUDA error, not a Python binding error + assert err in ( + cuda.CUresult.CUDA_ERROR_INVALID_VALUE, + cuda.CUresult.CUDA_ERROR_INVALID_RESOURCE_CONFIGURATION, + ) + + +def test_buffer_reference(): + # Create a host buffer + size = int(1024 * np.uint8().itemsize) + host = np.full(size, 2).astype(np.uint8) + + # Set the buffer to a struct member + memcpyParams = cuda.CUgraphNodeParams() + memcpyParams.memcpy.copyParams.dstHost = host + + # Delete the local reference to the host buffer. The reference in the + # struct should keep it alive. + del host + + # Create a new numpy array from the pointer and make sure the memory is + # intact and hasn't been freed. If the reference counting in + # copyParams.dstHost is incorrect, we will either see over-written memory or + # a segmentation fault here. + ptr = ctypes.cast(memcpyParams.memcpy.copyParams.dstHost, ctypes.POINTER(ctypes.c_uint8)) + x = np.ctypeslib.as_array(ptr, shape=(size,)) + assert np.all(x == 2) + + +def test_array_setter_no_double_free_after_clearing_with_empty_list(): + # Regression test for a double-free in the generated setters for + # list-valued struct members (e.g. CUlaunchConfig.attrs, + # CUDA_MEM_ALLOC_NODE_PARAMS.accessDescs, ...). Assigning an empty list + # used to free the internal buffer but leave the cached pointer non-NULL; + # the next assignment (or __dealloc__) would call free() on that dangling + # pointer, causing a double-free that glibc aborts via SIGABRT. + # + # CUlaunchConfig.attrs is exercised here as one representative instance; + # the same pattern was applied across many setters in driver.pyx.in and + # runtime.pyx.in. + # + # The reproducer runs in a subprocess so that a glibc abort surfaces as + # a non-zero return code instead of tearing down the pytest process. + code = textwrap.dedent( + """ + import cuda.bindings.driver as cuda + + params = cuda.CUlaunchConfig() + # Allocate the internal buffer. + params.attrs = [cuda.CUlaunchAttribute() for _ in range(4)] + # Free it. Pre-fix, self._attrs is left pointing at freed memory. + params.attrs = [] + # Length mismatch (0 vs 8) takes the else branch and calls free() + # again on the dangling pointer. + params.attrs = [cuda.CUlaunchAttribute() for _ in range(8)] + """ + ) + proc = subprocess.run([sys.executable, "-c", code], capture_output=True, cwd=os.path.dirname(__file__)) # noqa: S603 + assert proc.returncode == 0, ( + f"reproducer subprocess exited with code {proc.returncode}; stderr: {proc.stderr.decode(errors='replace')}" + ) + + +def test_dealloc_clears_array_field_in_external_struct(): + # Regression test for the externally-owned-memory case of the same bug. + # + # When a wrapper aliases an externally-owned struct (constructed with + # `_ptr=...`), `__dealloc__` used to free its internal buffer but leave + # `self._pvt_ptr[0].` pointing at the freed memory. Anyone still + # holding the external struct (the owning wrapper, a parent struct, or + # the CUDA driver itself) would see a dangling pointer. + # + # CUlaunchConfig.attrs is exercised here as one representative instance; + # the same pattern was applied across the `__dealloc__` methods in + # driver.pyx.in and runtime.pyx.in. + outer = cuda.CUlaunchConfig() + # `inner` aliases the same underlying struct as `outer`. + inner = cuda.CUlaunchConfig(_ptr=outer.getPtr()) + # Allocates a buffer and writes its pointer into the shared struct's + # `attrs` field. + inner.attrs = [cuda.CUlaunchAttribute() for _ in range(4)] + + # Locate `attrs` in the C struct by scanning for the just-written + # pointer. The struct is small and only `attrs` is non-NULL. + struct_addr = outer.getPtr() + word_size = ctypes.sizeof(ctypes.c_void_p) + scan_words = 128 // word_size + words = (ctypes.c_void_p * scan_words).from_address(struct_addr) + attrs_offset = next( + (i * word_size for i, p in enumerate(words) if p), + None, + ) + assert attrs_offset is not None, "attrs pointer was not written into the C struct" + + # Destroy the wrapper. With the fix, __dealloc__ also clears the field + # in the externally-owned struct; without it, the field remains dangling. + del inner + + attrs_after = ctypes.c_void_p.from_address(struct_addr + attrs_offset).value + assert attrs_after is None, ( + f"external struct still holds a dangling pointer ({attrs_after:#x}) " + "where attrs was, after the aliasing wrapper was destroyed" + ) diff --git a/cuda_bindings/tests/test_cudart.py b/cuda_bindings/tests/test_cudart.py new file mode 100644 index 00000000000..ddb4448499b --- /dev/null +++ b/cuda_bindings/tests/test_cudart.py @@ -0,0 +1,1979 @@ +# SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +import ctypes +import math + +import numpy as np +import pytest + +import cuda.bindings.driver as cuda +import cuda.bindings.runtime as cudart +from cuda import pathfinder +from cuda.bindings import runtime +from cuda.bindings._test_helpers.mempool import xfail_if_mempool_oom + + +def isSuccess(err): + return err == cudart.cudaError_t.cudaSuccess + + +def assertSuccess(err): + assert isSuccess(err) + + +def driverVersionLessThan(target): + err, version = cudart.cudaDriverGetVersion() + assertSuccess(err) + return version < target + + +def supportsMemoryPool(): + err, isSupported = cudart.cudaDeviceGetAttribute(cudart.cudaDeviceAttr.cudaDevAttrMemoryPoolsSupported, 0) + return isSuccess(err) and isSupported + + +def supportsSparseTexturesDeviceFilter(): + err, isSupported = cudart.cudaDeviceGetAttribute(cudart.cudaDeviceAttr.cudaDevAttrSparseCudaArraySupported, 0) + return isSuccess(err) and isSupported + + +def supportsCudaAPI(name): + return name in dir(cuda) or dir(cudart) + + +def test_cudart_memcpy(): + # Allocate dev memory + size = 1024 * np.uint8().itemsize + err, dptr = cudart.cudaMalloc(size) + assertSuccess(err) + + # Set h1 and h2 memory to be different + h1 = np.full(size, 1).astype(np.uint8) + h2 = np.full(size, 2).astype(np.uint8) + assert np.array_equal(h1, h2) is False + + # h1 to D + (err,) = cudart.cudaMemcpy(dptr, h1, size, cudart.cudaMemcpyKind.cudaMemcpyHostToDevice) + assertSuccess(err) + + # D to h2 + (err,) = cudart.cudaMemcpy(h2, dptr, size, cudart.cudaMemcpyKind.cudaMemcpyDeviceToHost) + assertSuccess(err) + + # Validate h1 == h2 + assert np.array_equal(h1, h2) + + # Cleanup + (err,) = cudart.cudaFree(dptr) + assertSuccess(err) + + +def test_cudart_hostRegister(): + # Use hostRegister API to check for correct enum return values + page_size = 80 + addr_host = np.full(page_size * 3, 1).astype(np.uint8) + addr = addr_host.ctypes.data + + size_0 = (16 * page_size) / 8 + addr_0 = addr + int((0 * page_size) / 8) + size_1 = (16 * page_size) / 8 + addr_1 = addr + int((8 * page_size) / 8) + + (err,) = cudart.cudaHostRegister(addr_0, size_0, 3) + assertSuccess(err) + (err,) = cudart.cudaHostRegister(addr_1, size_1, 3) + assert err == cudart.cudaError_t.cudaErrorHostMemoryAlreadyRegistered + + (err,) = cudart.cudaHostUnregister(addr_1) + assert err == cudart.cudaError_t.cudaErrorInvalidValue + (err,) = cudart.cudaHostUnregister(addr_0) + assertSuccess(err) + + +def test_cudart_class_reference(): + offset = 1 + width = 4 + height = 5 + depth = 6 + flags = 0 + numMipLevels = 1 + + extent = cudart.cudaExtent() + formatDesc = cudart.cudaChannelFormatDesc() + externalMemoryMipmappedArrayDesc = cudart.cudaExternalMemoryMipmappedArrayDesc() + + # Get/set class attributes + extent.width = width + extent.height = height + extent.depth = depth + + formatDesc.x = 8 + formatDesc.y = 0 + formatDesc.z = 0 + formatDesc.w = 0 + formatDesc.f = cudart.cudaChannelFormatKind.cudaChannelFormatKindSigned + + externalMemoryMipmappedArrayDesc.offset = offset + externalMemoryMipmappedArrayDesc.formatDesc = formatDesc + externalMemoryMipmappedArrayDesc.extent = extent + externalMemoryMipmappedArrayDesc.flags = flags + externalMemoryMipmappedArrayDesc.numLevels = numMipLevels + + # Can manipulate child structure values directly + externalMemoryMipmappedArrayDesc.extent.width = width + 1 + externalMemoryMipmappedArrayDesc.extent.height = height + 1 + externalMemoryMipmappedArrayDesc.extent.depth = depth + 1 + assert externalMemoryMipmappedArrayDesc.extent.width == width + 1 + assert externalMemoryMipmappedArrayDesc.extent.height == height + 1 + assert externalMemoryMipmappedArrayDesc.extent.depth == depth + 1 + + externalMemoryMipmappedArrayDesc.formatDesc.x = 20 + externalMemoryMipmappedArrayDesc.formatDesc.y = 21 + externalMemoryMipmappedArrayDesc.formatDesc.z = 22 + externalMemoryMipmappedArrayDesc.formatDesc.w = 23 + externalMemoryMipmappedArrayDesc.formatDesc.f = cudart.cudaChannelFormatKind.cudaChannelFormatKindFloat + assert externalMemoryMipmappedArrayDesc.formatDesc.x == 20 + assert externalMemoryMipmappedArrayDesc.formatDesc.y == 21 + assert externalMemoryMipmappedArrayDesc.formatDesc.z == 22 + assert externalMemoryMipmappedArrayDesc.formatDesc.w == 23 + assert externalMemoryMipmappedArrayDesc.formatDesc.f == cudart.cudaChannelFormatKind.cudaChannelFormatKindFloat + + # Can copy classes over + externalMemoryMipmappedArrayDesc.extent = extent + assert externalMemoryMipmappedArrayDesc.extent.width == width + assert externalMemoryMipmappedArrayDesc.extent.height == height + assert externalMemoryMipmappedArrayDesc.extent.depth == depth + + externalMemoryMipmappedArrayDesc.formatDesc = formatDesc + assert externalMemoryMipmappedArrayDesc.formatDesc.x == 8 + assert externalMemoryMipmappedArrayDesc.formatDesc.y == 0 + assert externalMemoryMipmappedArrayDesc.formatDesc.z == 0 + assert externalMemoryMipmappedArrayDesc.formatDesc.w == 0 + assert externalMemoryMipmappedArrayDesc.formatDesc.f == cudart.cudaChannelFormatKind.cudaChannelFormatKindSigned + + +@pytest.mark.skipif(not supportsSparseTexturesDeviceFilter(), reason="Sparse Texture Device Filter") +def test_cudart_class_inline(): + extent = cudart.cudaExtent() + extent.width = 1000 + extent.height = 500 + extent.depth = 0 + + desc = cudart.cudaChannelFormatDesc() + desc.x = 32 + desc.y = 32 + desc.z = 32 + desc.w = 32 + desc.f = cudart.cudaChannelFormatKind.cudaChannelFormatKindFloat + + numChannels = 4 + numBytesPerChannel = desc.x / 8 + numBytesPerTexel = numChannels * numBytesPerChannel + + flags = cudart.cudaArraySparse + maxDim = max(extent.width, extent.height) + numLevels = int(1.0 + math.log(maxDim, 2)) + + err, mipmap = cudart.cudaMallocMipmappedArray(desc, extent, numLevels, flags) + assertSuccess(err) + + err, sparseProp = cudart.cudaMipmappedArrayGetSparseProperties(mipmap) + assertSuccess(err) + + # tileExtent + # TODO: Will these values always be this same? Maybe need a more stable test? + # TODO: Are these values even correct? Need to research the function some more.. Maybe need an easier API test + assert sparseProp.tileExtent.width == 64 + assert sparseProp.tileExtent.height == 64 + assert sparseProp.tileExtent.depth == 1 + + sparsePropNew = cudart.cudaArraySparseProperties() + sparsePropNew.tileExtent.width = 15 + sparsePropNew.tileExtent.height = 16 + sparsePropNew.tileExtent.depth = 17 + + # Check that we can copy inner structs + sparseProp.tileExtent = sparsePropNew.tileExtent + assert sparseProp.tileExtent.width == 15 + assert sparseProp.tileExtent.height == 16 + assert sparseProp.tileExtent.depth == 17 + + assert sparseProp.miptailFirstLevel == 3 + assert sparseProp.miptailSize == 196608 + assert sparseProp.flags == 0 + + (err,) = cudart.cudaFreeMipmappedArray(mipmap) + assertSuccess(err) + + # TODO + example = cudart.cudaExternalSemaphoreSignalNodeParams() + example.extSemArray = [ + cudart.cudaExternalSemaphore_t(0), + cudart.cudaExternalSemaphore_t(123), + cudart.cudaExternalSemaphore_t(999), + ] + a1 = cudart.cudaExternalSemaphoreSignalParams() + a1.params.fence.value = 7 + a1.params.nvSciSync.fence = 999 + a1.params.keyedMutex.key = 9 + a1.flags = 1 + a2 = cudart.cudaExternalSemaphoreSignalParams() + a2.params.fence.value = 7 + a2.params.nvSciSync.fence = 999 + a2.params.keyedMutex.key = 9 + a2.flags = 2 + a3 = cudart.cudaExternalSemaphoreSignalParams() + a3.params.fence.value = 7 + a3.params.nvSciSync.fence = 999 + a3.params.keyedMutex.key = 9 + a3.flags = 3 + example.paramsArray = [a1] + # Note: Setting is a pass by value. Changing the object does not reflect internal value + a3.params.fence.value = 4 + a3.params.nvSciSync.fence = 4 + a3.params.keyedMutex.key = 4 + a3.flags = 4 + example.numExtSems = 3 + + +def test_cudart_graphs(): + err, graph = cudart.cudaGraphCreate(0) + assertSuccess(err) + + err, pGraphNode0 = cudart.cudaGraphAddEmptyNode(graph, None, 0) + assertSuccess(err) + err, pGraphNode1 = cudart.cudaGraphAddEmptyNode(graph, [pGraphNode0], 1) + assertSuccess(err) + err, pGraphNode2 = cudart.cudaGraphAddEmptyNode(graph, [pGraphNode0, pGraphNode1], 2) + assertSuccess(err) + + err, nodes, numNodes = cudart.cudaGraphGetNodes(graph) + err, nodes, numNodes = cudart.cudaGraphGetNodes(graph, numNodes) + + stream_legacy = cudart.cudaStream_t(cudart.cudaStreamLegacy) + stream_per_thread = cudart.cudaStream_t(cudart.cudaStreamPerThread) + err, stream_with_flags = cudart.cudaStreamCreateWithFlags(cudart.cudaStreamNonBlocking) + assertSuccess(err) + + +def test_cudart_cudaGraphGetEdges_edgeData_outlives_call(): + # Regression test for https://github.com/NVIDIA/cuda-python/issues/1804 + # cudaGraphGetEdges previously returned cudaGraphEdgeData wrappers backed + # by a scratch buffer that was freed before the call returned, leaving + # the wrappers pointing at freed memory. Ensure the returned objects + # remain readable after the call and after subsequent allocations. + err, graph = cudart.cudaGraphCreate(0) + assertSuccess(err) + try: + err, n0 = cudart.cudaGraphAddEmptyNode(graph, None, 0) + assertSuccess(err) + err, n1 = cudart.cudaGraphAddEmptyNode(graph, [n0], 1) + assertSuccess(err) + err, n2 = cudart.cudaGraphAddEmptyNode(graph, [n0, n1], 2) + assertSuccess(err) + + err, _, _, _, num_edges = cudart.cudaGraphGetEdges(graph) + assertSuccess(err) + assert num_edges == 3 + err, from_nodes, to_nodes, edge_data, num_edges = cudart.cudaGraphGetEdges(graph, num_edges) + assertSuccess(err) + assert len(edge_data) == num_edges == 3 + + # Stir the heap to make a use-after-free more likely to surface + # by reallocating the same-sized scratch buffer many times. + for _ in range(64): + err, _, _, _, _ = cudart.cudaGraphGetEdges(graph, num_edges) + assertSuccess(err) + + # Each wrapper must still own its data. Default-edge values are zero; + # if the wrapper were holding a dangling pointer, attribute access + # would be undefined behavior. We at minimum require it to not crash + # and to report the documented defaults. + for ed in edge_data: + assert ed.from_port == 0 + assert ed.to_port == 0 + assert int(ed.type) == 0 + assert ed.reserved == b"\x00" * 5 + finally: + (err,) = cudart.cudaGraphDestroy(graph) + assertSuccess(err) + + +def test_cudart_cudaGraphNodeGetDependencies_edgeData_outlives_call(): + # Companion regression test for #1804 covering the dependency-query path. + err, graph = cudart.cudaGraphCreate(0) + assertSuccess(err) + try: + err, n0 = cudart.cudaGraphAddEmptyNode(graph, None, 0) + assertSuccess(err) + err, n1 = cudart.cudaGraphAddEmptyNode(graph, [n0], 1) + assertSuccess(err) + + err, _, _, num_deps = cudart.cudaGraphNodeGetDependencies(n1) + assertSuccess(err) + assert num_deps == 1 + err, deps, edge_data, num_deps = cudart.cudaGraphNodeGetDependencies(n1, num_deps) + assertSuccess(err) + assert len(edge_data) == num_deps == 1 + + err, _, _, num_dependents = cudart.cudaGraphNodeGetDependentNodes(n0) + assertSuccess(err) + assert num_dependents == 1 + err, dependents, dep_edge_data, num_dependents = cudart.cudaGraphNodeGetDependentNodes(n0, num_dependents) + assertSuccess(err) + assert len(dep_edge_data) == num_dependents == 1 + + for _ in range(64): + err, _, _, _ = cudart.cudaGraphNodeGetDependencies(n1, num_deps) + assertSuccess(err) + err, _, _, _ = cudart.cudaGraphNodeGetDependentNodes(n0, num_dependents) + assertSuccess(err) + + for ed in edge_data + dep_edge_data: + assert ed.from_port == 0 + assert ed.to_port == 0 + assert int(ed.type) == 0 + assert ed.reserved == b"\x00" * 5 + finally: + (err,) = cudart.cudaGraphDestroy(graph) + assertSuccess(err) + + +def test_cudart_list_access(): + err, prop = cudart.cudaGetDeviceProperties(0) + prop.name = prop.name + b" " * (256 - len(prop.name)) + + +def test_cudart_class_setters(): + dim = cudart.dim3() + + dim.x = 1 + dim.y = 2 + dim.z = 3 + + assert dim.x == 1 + assert dim.y == 2 + assert dim.z == 3 + + +def test_cudart_both_type(): + err, mode = cudart.cudaThreadExchangeStreamCaptureMode(cudart.cudaStreamCaptureMode.cudaStreamCaptureModeGlobal) + assertSuccess(err) + err, mode = cudart.cudaThreadExchangeStreamCaptureMode(cudart.cudaStreamCaptureMode.cudaStreamCaptureModeRelaxed) + assertSuccess(err) + assert mode == cudart.cudaStreamCaptureMode.cudaStreamCaptureModeGlobal + err, mode = cudart.cudaThreadExchangeStreamCaptureMode( + cudart.cudaStreamCaptureMode.cudaStreamCaptureModeThreadLocal + ) + assertSuccess(err) + assert mode == cudart.cudaStreamCaptureMode.cudaStreamCaptureModeRelaxed + err, mode = cudart.cudaThreadExchangeStreamCaptureMode(cudart.cudaStreamCaptureMode.cudaStreamCaptureModeGlobal) + assertSuccess(err) + assert mode == cudart.cudaStreamCaptureMode.cudaStreamCaptureModeThreadLocal + + +def test_cudart_cudaGetDeviceProperties(): + err, prop = cudart.cudaGetDeviceProperties(0) + assertSuccess(err) + attrs = [ + "name", + "uuid", + "luid", + "luidDeviceNodeMask", + "totalGlobalMem", + "sharedMemPerBlock", + "regsPerBlock", + "warpSize", + "memPitch", + "maxThreadsPerBlock", + "maxThreadsDim", + "maxGridSize", + "totalConstMem", + "major", + "minor", + "textureAlignment", + "texturePitchAlignment", + "multiProcessorCount", + "integrated", + "canMapHostMemory", + "maxTexture1D", + "maxTexture1DMipmap", + "maxTexture2D", + "maxTexture2DMipmap", + "maxTexture2DLinear", + "maxTexture2DGather", + "maxTexture3D", + "maxTexture3DAlt", + "maxTextureCubemap", + "maxTexture1DLayered", + "maxTexture2DLayered", + "maxTextureCubemapLayered", + "maxSurface1D", + "maxSurface2D", + "maxSurface3D", + "maxSurface1DLayered", + "maxSurface2DLayered", + "maxSurfaceCubemap", + "maxSurfaceCubemapLayered", + "surfaceAlignment", + "concurrentKernels", + "ECCEnabled", + "pciBusID", + "pciDeviceID", + "pciDomainID", + "tccDriver", + "asyncEngineCount", + "unifiedAddressing", + "memoryBusWidth", + "l2CacheSize", + "persistingL2CacheMaxSize", + "maxThreadsPerMultiProcessor", + "streamPrioritiesSupported", + "globalL1CacheSupported", + "localL1CacheSupported", + "sharedMemPerMultiprocessor", + "regsPerMultiprocessor", + "managedMemory", + "isMultiGpuBoard", + "multiGpuBoardGroupID", + "hostNativeAtomicSupported", + "pageableMemoryAccess", + "concurrentManagedAccess", + "computePreemptionSupported", + "canUseHostPointerForRegisteredMem", + "cooperativeLaunch", + "sharedMemPerBlockOptin", + "pageableMemoryAccessUsesHostPageTables", + "directManagedMemAccessFromHost", + "maxBlocksPerMultiProcessor", + "accessPolicyMaxWindowSize", + "reservedSharedMemPerBlock", + "hostRegisterSupported", + "sparseCudaArraySupported", + "hostRegisterReadOnlySupported", + "timelineSemaphoreInteropSupported", + "memoryPoolsSupported", + "gpuDirectRDMASupported", + "gpuDirectRDMAFlushWritesOptions", + "gpuDirectRDMAWritesOrdering", + "memoryPoolSupportedHandleTypes", + "deferredMappingCudaArraySupported", + "ipcEventSupported", + "clusterLaunch", + "unifiedFunctionPointers", + "deviceNumaConfig", + "deviceNumaId", + "mpsEnabled", + "hostNumaId", + "gpuPciDeviceID", + "gpuPciSubsystemID", + "hostNumaMultinodeIpcSupported", + ] + for attr in attrs: + assert hasattr(prop, attr) + assert len(prop.name.decode("utf-8")) != 0 + assert len(prop.uuid.bytes.hex()) != 0 + + example = cudart.cudaExternalSemaphoreSignalNodeParams() + example.extSemArray = [ + cudart.cudaExternalSemaphore_t(0), + cudart.cudaExternalSemaphore_t(123), + cudart.cudaExternalSemaphore_t(999), + ] + a1 = cudart.cudaExternalSemaphoreSignalParams() + a1.params.fence.value = 7 + a1.params.nvSciSync.fence = 999 + a1.params.keyedMutex.key = 9 + a1.flags = 1 + a2 = cudart.cudaExternalSemaphoreSignalParams() + a2.params.fence.value = 7 + a2.params.nvSciSync.fence = 999 + a2.params.keyedMutex.key = 9 + a2.flags = 2 + a3 = cudart.cudaExternalSemaphoreSignalParams() + a3.params.fence.value = 7 + a3.params.nvSciSync.fence = 999 + a3.params.keyedMutex.key = 9 + a3.flags = 3 + example.paramsArray = [a1] + # Note: Setting is a pass by value. Changing the object does not reflect internal value + a3.params.fence.value = 4 + a3.params.nvSciSync.fence = 4 + a3.params.keyedMutex.key = 4 + a3.flags = 4 + example.numExtSems = 3 + + +@pytest.mark.skipif( + driverVersionLessThan(11030) or not supportsMemoryPool(), reason="When new attributes were introduced" +) +def test_cudart_MemPool_attr(): + poolProps = cudart.cudaMemPoolProps() + poolProps.allocType = cudart.cudaMemAllocationType.cudaMemAllocationTypePinned + poolProps.location.id = 0 + poolProps.location.type = cudart.cudaMemLocationType.cudaMemLocationTypeDevice + + attr_list = [None] * 8 + err, pool = cudart.cudaMemPoolCreate(poolProps) + xfail_if_mempool_oom(err, "cudaMemPoolCreate", poolProps.location.id) + assertSuccess(err) + + for idx, attr in enumerate( + [ + cudart.cudaMemPoolAttr.cudaMemPoolReuseFollowEventDependencies, + cudart.cudaMemPoolAttr.cudaMemPoolReuseAllowOpportunistic, + cudart.cudaMemPoolAttr.cudaMemPoolReuseAllowInternalDependencies, + cudart.cudaMemPoolAttr.cudaMemPoolAttrReleaseThreshold, + cudart.cudaMemPoolAttr.cudaMemPoolAttrReservedMemCurrent, + cudart.cudaMemPoolAttr.cudaMemPoolAttrReservedMemHigh, + cudart.cudaMemPoolAttr.cudaMemPoolAttrUsedMemCurrent, + cudart.cudaMemPoolAttr.cudaMemPoolAttrUsedMemHigh, + ] + ): + err, attr_tmp = cudart.cudaMemPoolGetAttribute(pool, attr) + assertSuccess(err) + attr_list[idx] = attr_tmp + + for idxA, attr in enumerate( + [ + cudart.cudaMemPoolAttr.cudaMemPoolReuseFollowEventDependencies, + cudart.cudaMemPoolAttr.cudaMemPoolReuseAllowOpportunistic, + cudart.cudaMemPoolAttr.cudaMemPoolReuseAllowInternalDependencies, + ] + ): + (err,) = cudart.cudaMemPoolSetAttribute(pool, attr, 0) + assertSuccess(err) + for idx, attr in enumerate([cudart.cudaMemPoolAttr.cudaMemPoolAttrReleaseThreshold]): + (err,) = cudart.cudaMemPoolSetAttribute(pool, attr, cuda.cuuint64_t(9)) + assertSuccess(err) + + for idx, attr in enumerate( + [ + cudart.cudaMemPoolAttr.cudaMemPoolReuseFollowEventDependencies, + cudart.cudaMemPoolAttr.cudaMemPoolReuseAllowOpportunistic, + cudart.cudaMemPoolAttr.cudaMemPoolReuseAllowInternalDependencies, + cudart.cudaMemPoolAttr.cudaMemPoolAttrReleaseThreshold, + ] + ): + err, attr_tmp = cudart.cudaMemPoolGetAttribute(pool, attr) + assertSuccess(err) + attr_list[idx] = attr_tmp + assert attr_list[0] == 0 + assert attr_list[1] == 0 + assert attr_list[2] == 0 + assert int(attr_list[3]) == 9 + + (err,) = cudart.cudaMemPoolDestroy(pool) + assertSuccess(err) + + +def test_cudart_make_api(): + err, channelDesc = cudart.cudaCreateChannelDesc( + 32, 0, 0, 0, cudart.cudaChannelFormatKind.cudaChannelFormatKindFloat + ) + assertSuccess(err) + assert channelDesc.x == 32 + assert channelDesc.y == 0 + assert channelDesc.z == 0 + assert channelDesc.w == 0 + assert channelDesc.f == cudart.cudaChannelFormatKind.cudaChannelFormatKindFloat + + # make_cudaPitchedPtr + cudaPitchedPtr = cudart.make_cudaPitchedPtr(1, 2, 3, 4) + assert cudaPitchedPtr.ptr == 1 + assert cudaPitchedPtr.pitch == 2 + assert cudaPitchedPtr.xsize == 3 + assert cudaPitchedPtr.ysize == 4 + + # make_cudaPos + cudaPos = cudart.make_cudaPos(1, 2, 3) + assert cudaPos.x == 1 + assert cudaPos.y == 2 + assert cudaPos.z == 3 + + # make_cudaExtent + cudaExtent = cudart.make_cudaExtent(1, 2, 3) + assert cudaExtent.width == 1 + assert cudaExtent.height == 2 + assert cudaExtent.depth == 3 + + +def test_cudart_cudaStreamGetCaptureInfo(): + # create stream + err, stream = cudart.cudaStreamCreate() + assertSuccess(err) + + # validate that stream is not capturing + err, status, *info = cudart.cudaStreamGetCaptureInfo(stream) + assertSuccess(err) + assert status == cudart.cudaStreamCaptureStatus.cudaStreamCaptureStatusNone + + # start capture + (err,) = cudart.cudaStreamBeginCapture(stream, cudart.cudaStreamCaptureMode.cudaStreamCaptureModeGlobal) + assertSuccess(err) + + # validate that stream is capturing now + err, status, *info = cudart.cudaStreamGetCaptureInfo(stream) + assertSuccess(err) + assert status == cudart.cudaStreamCaptureStatus.cudaStreamCaptureStatusActive + + # clean up + err, pgraph = cudart.cudaStreamEndCapture(stream) + assertSuccess(err) + + +def test_cudart_cudaArrayGetInfo(): + # create channel descriptor + x, y, z, w = 8, 0, 0, 0 + f = cudart.cudaChannelFormatKind.cudaChannelFormatKindUnsigned + err, desc = cudart.cudaCreateChannelDesc(x, y, z, w, f) + assertSuccess(err) + + # allocate device array + width = 10 + height = 0 + inFlags = 0 + err, arr = cudart.cudaMallocArray(desc, width, height, inFlags) + assertSuccess(err) + + # get device array info + err, desc, extent, outFlags = cudart.cudaArrayGetInfo(arr) + assertSuccess(err) + + # validate descriptor, extent, flags + assert desc.x == x + assert desc.y == y + assert desc.z == z + assert desc.w == w + assert desc.f == f + assert extent.width == width + assert extent.height == height + assert inFlags == outFlags + + # clean up + (err,) = cudart.cudaFreeArray(arr) + assertSuccess(err) + + +def test_cudart_cudaMemcpy2DToArray(): + # create host arrays + size = int(1024 * np.uint8().itemsize) + h1 = np.full(size, 1).astype(np.uint8) + h2 = np.full(size, 2).astype(np.uint8) + assert np.array_equal(h1, h2) is False + + # create channel descriptor + err, desc = cudart.cudaCreateChannelDesc(8, 0, 0, 0, cudart.cudaChannelFormatKind.cudaChannelFormatKindUnsigned) + assertSuccess(err) + + # allocate device array + err, arr = cudart.cudaMallocArray(desc, size, 0, 0) + assertSuccess(err) + + # h1 to arr + (err,) = cudart.cudaMemcpy2DToArray(arr, 0, 0, h1, size, size, 1, cudart.cudaMemcpyKind.cudaMemcpyHostToDevice) + assertSuccess(err) + + # arr to h2 + (err,) = cudart.cudaMemcpy2DFromArray(h2, size, arr, 0, 0, size, 1, cudart.cudaMemcpyKind.cudaMemcpyDeviceToHost) + assertSuccess(err) + + # validate h1 == h2 + assert np.array_equal(h1, h2) + + # clean up + (err,) = cudart.cudaFreeArray(arr) + assertSuccess(err) + + +def test_cudart_cudaMemcpy2DToArray_DtoD(): + # allocate device memory + size = 1024 * np.uint8().itemsize + err, d1 = cudart.cudaMalloc(size) + assertSuccess(err) + err, d2 = cudart.cudaMalloc(size) + assertSuccess(err) + + # create host arrays + h1 = np.full(size, 1).astype(np.uint8) + h2 = np.full(size, 2).astype(np.uint8) + assert np.array_equal(h1, h2) is False + + # create channel descriptor + err, desc = cudart.cudaCreateChannelDesc(8, 0, 0, 0, cudart.cudaChannelFormatKind.cudaChannelFormatKindUnsigned) + assertSuccess(err) + + # allocate device array + err, arr = cudart.cudaMallocArray(desc, size, 0, 0) + assertSuccess(err) + + # h1 to d1 + (err,) = cudart.cudaMemcpy(d1, h1, size, cudart.cudaMemcpyKind.cudaMemcpyHostToDevice) + assertSuccess(err) + + # d1 to arr + (err,) = cudart.cudaMemcpy2DToArray(arr, 0, 0, d1, size, size, 1, cudart.cudaMemcpyKind.cudaMemcpyDeviceToDevice) + assertSuccess(err) + + # arr to d2 + (err,) = cudart.cudaMemcpy2DFromArray(d2, size, arr, 0, 0, size, 1, cudart.cudaMemcpyKind.cudaMemcpyDeviceToDevice) + assertSuccess(err) + + # d2 to h2 + (err,) = cudart.cudaMemcpy(h2, d2, size, cudart.cudaMemcpyKind.cudaMemcpyDeviceToHost) + assertSuccess(err) + + # validate h1 == h2 + assert np.array_equal(h1, h2) + + # clean up + (err,) = cudart.cudaFreeArray(arr) + assertSuccess(err) + (err,) = cudart.cudaFree(d2) + assertSuccess(err) + (err,) = cudart.cudaFree(d1) + assertSuccess(err) + + +def test_cudart_cudaMemcpy2DArrayToArray(): + # create host arrays + size = 1024 * np.uint8().itemsize + h1 = np.full(size, 1).astype(np.uint8) + h2 = np.full(size, 2).astype(np.uint8) + assert np.array_equal(h1, h2) is False + + # create channel descriptor + err, desc = cudart.cudaCreateChannelDesc(8, 0, 0, 0, cudart.cudaChannelFormatKind.cudaChannelFormatKindUnsigned) + assertSuccess(err) + + # allocate device arrays + err, a1 = cudart.cudaMallocArray(desc, size, 0, 0) + assertSuccess(err) + err, a2 = cudart.cudaMallocArray(desc, size, 0, 0) + assertSuccess(err) + + # h1 to a1 + (err,) = cudart.cudaMemcpy2DToArray(a1, 0, 0, h1, size, size, 1, cudart.cudaMemcpyKind.cudaMemcpyHostToDevice) + assertSuccess(err) + + # a1 to a2 + (err,) = cudart.cudaMemcpy2DArrayToArray( + a2, 0, 0, a1, 0, 0, size, 1, cudart.cudaMemcpyKind.cudaMemcpyDeviceToDevice + ) + assertSuccess(err) + + # a2 to h2 + (err,) = cudart.cudaMemcpy2DFromArray(h2, size, a2, 0, 0, size, 1, cudart.cudaMemcpyKind.cudaMemcpyDeviceToHost) + assertSuccess(err) + + # validate h1 == h2 + assert np.array_equal(h1, h2) + + # clean up + (err,) = cudart.cudaFreeArray(a2) + assertSuccess(err) + (err,) = cudart.cudaFreeArray(a1) + assertSuccess(err) + + +def test_cudart_cudaMemcpyArrayToArray(): + # create host arrays + size = 1024 * np.uint8().itemsize + h1 = np.full(size, 1).astype(np.uint8) + h2 = np.full(size, 2).astype(np.uint8) + assert np.array_equal(h1, h2) is False + + # create channel descriptor + err, desc = cudart.cudaCreateChannelDesc(8, 0, 0, 0, cudart.cudaChannelFormatKind.cudaChannelFormatKindUnsigned) + assertSuccess(err) + + # allocate device arrays + err, a1 = cudart.cudaMallocArray(desc, size, 0, 0) + assertSuccess(err) + err, a2 = cudart.cudaMallocArray(desc, size, 0, 0) + assertSuccess(err) + + # h1 to a1 + (err,) = cudart.cudaMemcpy2DToArray(a1, 0, 0, h1, size, size, 1, cudart.cudaMemcpyKind.cudaMemcpyHostToDevice) + assertSuccess(err) + + # a1 to a2 + (err,) = cudart.cudaMemcpyArrayToArray(a2, 0, 0, a1, 0, 0, size, cudart.cudaMemcpyKind.cudaMemcpyDeviceToDevice) + assertSuccess(err) + + # a2 to h2 + (err,) = cudart.cudaMemcpy2DFromArray(h2, size, a2, 0, 0, size, 1, cudart.cudaMemcpyKind.cudaMemcpyDeviceToHost) + assertSuccess(err) + + # validate h1 == h2 + assert np.array_equal(h1, h2) + + # clean up + (err,) = cudart.cudaFreeArray(a2) + assertSuccess(err) + (err,) = cudart.cudaFreeArray(a1) + assertSuccess(err) + + +def test_cudart_cudaGetChannelDesc(): + # create channel descriptor + x, y, z, w = 8, 0, 0, 0 + f = cudart.cudaChannelFormatKind.cudaChannelFormatKindUnsigned + err, desc = cudart.cudaCreateChannelDesc(x, y, z, w, f) + assertSuccess(err) + + # allocate device array + width = 10 + height = 0 + flags = 0 + err, arr = cudart.cudaMallocArray(desc, width, height, flags) + assertSuccess(err) + + # get channel descriptor from array + err, desc = cudart.cudaGetChannelDesc(arr) + assertSuccess(err) + + # validate array channel descriptor + assert desc.x == x + assert desc.y == y + assert desc.z == z + assert desc.w == w + assert desc.f == f + + # clean up + (err,) = cudart.cudaFreeArray(arr) + assertSuccess(err) + + +def test_cudart_cudaGetTextureObjectTextureDesc(): + # create channel descriptor + err, channelDesc = cudart.cudaCreateChannelDesc( + 8, 0, 0, 0, cudart.cudaChannelFormatKind.cudaChannelFormatKindUnsigned + ) + assertSuccess(err) + + # allocate device arrays + err, arr = cudart.cudaMallocArray(channelDesc, 1024, 0, 0) + assertSuccess(err) + + # create descriptors for texture object + resDesc = cudart.cudaResourceDesc() + resDesc.res.array.array = arr + inTexDesc = cudart.cudaTextureDesc() + + # create texture object + err, texObject = cudart.cudaCreateTextureObject(resDesc, inTexDesc, None) + assertSuccess(err) + + # get texture descriptor + err, outTexDesc = cudart.cudaGetTextureObjectTextureDesc(texObject) + assertSuccess(err) + + # validate texture descriptor + for attr in dir(outTexDesc): + if attr in ["borderColor", "getPtr"]: + continue + if not attr.startswith("_"): + assert getattr(outTexDesc, attr) == getattr(inTexDesc, attr) + + # clean up + (err,) = cudart.cudaDestroyTextureObject(texObject) + assertSuccess(err) + + +def test_cudart_cudaMemset3D(): + # create host arrays + size = 1024 * np.uint8().itemsize + h1 = np.full(size, 1).astype(np.uint8) + h2 = np.full(size, 2).astype(np.uint8) + assert np.array_equal(h1, h2) is False + + # allocate device memory + devExtent = cudart.make_cudaExtent(32, 32, 1) + err, devPitchedPtr = cudart.cudaMalloc3D(devExtent) + assertSuccess(err) + + # set memory + memExtent = cudart.make_cudaExtent(devPitchedPtr.pitch, devPitchedPtr.ysize, 1) + (err,) = cudart.cudaMemset3D(devPitchedPtr, 1, memExtent) + assertSuccess(err) + + # D to h2 + (err,) = cudart.cudaMemcpy(h2, devPitchedPtr.ptr, size, cudart.cudaMemcpyKind.cudaMemcpyDeviceToHost) + + # validate h1 == h2 + assert np.array_equal(h1, h2) + + # clean up + (err,) = cudart.cudaFree(devPitchedPtr.ptr) + assertSuccess(err) + + +def test_cudart_cudaMemset3D_2D(): + # create host arrays + size = 512 * np.uint8().itemsize + h1 = np.full(size, 1).astype(np.uint8) + h2 = np.full(size, 2).astype(np.uint8) + assert np.array_equal(h1, h2) is False + + # allocate device memory + devExtent = cudart.make_cudaExtent(1024, 1, 1) + err, devPitchedPtr = cudart.cudaMalloc3D(devExtent) + assertSuccess(err) + + # set memory + memExtent = cudart.make_cudaExtent(size, devPitchedPtr.ysize, 1) + (err,) = cudart.cudaMemset3D(devPitchedPtr, 1, memExtent) + assertSuccess(err) + + # D to h2 + (err,) = cudart.cudaMemcpy(h2, devPitchedPtr.ptr, size, cudart.cudaMemcpyKind.cudaMemcpyDeviceToHost) + + # validate h1 == h2 + assert np.array_equal(h1, h2) + + # clean up + (err,) = cudart.cudaFree(devPitchedPtr.ptr) + assertSuccess(err) + + +def test_cudart_cudaMemcpyToArray(): + # create host arrays + size = 1024 * np.uint8().itemsize + h1 = np.full(size, 1).astype(np.uint8) + h2 = np.full(size, 2).astype(np.uint8) + assert np.array_equal(h1, h2) is False + + # create channel descriptor + err, desc = cudart.cudaCreateChannelDesc(8, 0, 0, 0, cudart.cudaChannelFormatKind.cudaChannelFormatKindUnsigned) + assertSuccess(err) + + # allocate device array + err, arr = cudart.cudaMallocArray(desc, size, 0, 0) + assertSuccess(err) + + # h1 to arr + (err,) = cudart.cudaMemcpyToArray(arr, 0, 0, h1, size, cudart.cudaMemcpyKind.cudaMemcpyHostToDevice) + assertSuccess(err) + + # arr to h2 + (err,) = cudart.cudaMemcpyFromArray(h2, arr, 0, 0, size, cudart.cudaMemcpyKind.cudaMemcpyDeviceToHost) + assertSuccess(err) + + # validate h1 == h2 + assert np.array_equal(h1, h2) + + # clean up + (err,) = cudart.cudaFreeArray(arr) + assertSuccess(err) + + +def test_cudart_cudaMemcpyToArray_DtoD(): + # allocate device memory + size = int(1024 * np.uint8().itemsize) + err, d1 = cudart.cudaMalloc(size) + assertSuccess(err) + err, d2 = cudart.cudaMalloc(size) + assertSuccess(err) + + # create host arrays + h1 = np.full(size, 1).astype(np.uint8) + h2 = np.full(size, 2).astype(np.uint8) + assert np.array_equal(h1, h2) is False + + # create channel descriptor + err, desc = cudart.cudaCreateChannelDesc(8, 0, 0, 0, cudart.cudaChannelFormatKind.cudaChannelFormatKindUnsigned) + assertSuccess(err) + + # allocate device array + err, arr = cudart.cudaMallocArray(desc, size, 0, 0) + assertSuccess(err) + + # h1 to d1 + (err,) = cudart.cudaMemcpy(d1, h1, size, cudart.cudaMemcpyKind.cudaMemcpyHostToDevice) + assertSuccess(err) + + # d1 to arr + (err,) = cudart.cudaMemcpyToArray(arr, 0, 0, d1, size, cudart.cudaMemcpyKind.cudaMemcpyDeviceToDevice) + assertSuccess(err) + + # arr to d2 + (err,) = cudart.cudaMemcpyFromArray(d2, arr, 0, 0, size, cudart.cudaMemcpyKind.cudaMemcpyDeviceToDevice) + assertSuccess(err) + + # d2 to h2 + (err,) = cudart.cudaMemcpy(h2, d2, size, cudart.cudaMemcpyKind.cudaMemcpyDeviceToHost) + assertSuccess(err) + + # validate h1 == h2 + assert np.array_equal(h1, h2) + + # clean up + (err,) = cudart.cudaFreeArray(arr) + assertSuccess(err) + (err,) = cudart.cudaFree(d2) + assertSuccess(err) + (err,) = cudart.cudaFree(d1) + assertSuccess(err) + + +def test_cudart_cudaMemcpy3DAsync(): + # create host arrays + size = int(1024 * np.uint8().itemsize) + h1 = np.full(size, 1).astype(np.uint8) + h2 = np.full(size, 2).astype(np.uint8) + assert np.array_equal(h1, h2) is False + + # create channel descriptor + err, desc = cudart.cudaCreateChannelDesc(8, 0, 0, 0, cudart.cudaChannelFormatKind.cudaChannelFormatKindUnsigned) + assertSuccess(err) + + # allocate device array + err, arr = cudart.cudaMallocArray(desc, size, 0, 0) + assertSuccess(err) + + # create stream + err, stream = cudart.cudaStreamCreate() + assertSuccess(err) + + # create memcpy params + params = cudart.cudaMemcpy3DParms() + params.srcPtr = cudart.make_cudaPitchedPtr(h1, size, 1, 1) + params.dstArray = arr + params.extent = cudart.make_cudaExtent(size, 1, 1) + params.kind = cudart.cudaMemcpyKind.cudaMemcpyHostToDevice + + # h1 to arr + (err,) = cudart.cudaMemcpy3DAsync(params, stream) + assertSuccess(err) + + # await results + (err,) = cudart.cudaStreamSynchronize(stream) + assertSuccess(err) + + # arr to h2 + (err,) = cudart.cudaMemcpy2DFromArray(h2, size, arr, 0, 0, size, 1, cudart.cudaMemcpyKind.cudaMemcpyDeviceToHost) + assertSuccess(err) + + # validate h1 == h2 + assert np.array_equal(h1, h2) + + # clean up + (err,) = cudart.cudaFreeArray(arr) + assertSuccess(err) + + +def test_cudart_cudaGraphAddMemcpyNode1D(): + # allocate device memory + size = 1024 * np.uint8().itemsize + err, dptr = cudart.cudaMalloc(size) + assertSuccess(err) + + # create host arrays + h1 = np.full(size, 1).astype(np.uint8) + h2 = np.full(size, 2).astype(np.uint8) + assert np.array_equal(h1, h2) is False + + # build graph + err, graph = cudart.cudaGraphCreate(0) + assertSuccess(err) + + # add nodes + err, hToDNode = cudart.cudaGraphAddMemcpyNode1D( + graph, [], 0, dptr, h1, size, cudart.cudaMemcpyKind.cudaMemcpyHostToDevice + ) + assertSuccess(err) + err, dToHNode = cudart.cudaGraphAddMemcpyNode1D( + graph, [hToDNode], 1, h2, dptr, size, cudart.cudaMemcpyKind.cudaMemcpyDeviceToHost + ) + assertSuccess(err) + + # create stream + err, stream = cudart.cudaStreamCreate() + assertSuccess(err) + + # execute graph + err, execGraph = cudart.cudaGraphInstantiate(graph, 0) + assertSuccess(err) + (err,) = cudart.cudaGraphLaunch(execGraph, stream) + + # await results + (err,) = cudart.cudaStreamSynchronize(stream) + assertSuccess(err) + + # validate h1 == h2 + assert np.array_equal(h1, h2) + + # clean up + (err,) = cudart.cudaFree(dptr) + assertSuccess(err) + + +def test_cudart_cudaGraphAddMemsetNode(): + # allocate device memory + size = 1024 * np.uint8().itemsize + err, dptr = cudart.cudaMalloc(size) + assertSuccess(err) + + # create host arrays + h1 = np.full(size, 1).astype(np.uint8) + h2 = np.full(size, 2).astype(np.uint8) + assert np.array_equal(h1, h2) is False + + # build graph + err, graph = cudart.cudaGraphCreate(0) + assertSuccess(err) + + # set memset params + params = cudart.cudaMemsetParams() + params.dst = dptr + params.pitch = size + params.value = 1 + params.elementSize = 1 + params.width = size + params.height = 1 + + # add nodes + err, setNode = cudart.cudaGraphAddMemsetNode(graph, [], 0, params) + assertSuccess(err) + err, cpyNode = cudart.cudaGraphAddMemcpyNode1D( + graph, [setNode], 1, h2, dptr, size, cudart.cudaMemcpyKind.cudaMemcpyDeviceToHost + ) + assertSuccess(err) + + # create stream + err, stream = cudart.cudaStreamCreate() + assertSuccess(err) + + # execute graph + err, execGraph = cudart.cudaGraphInstantiate(graph, 0) + assertSuccess(err) + (err,) = cudart.cudaGraphLaunch(execGraph, stream) + assertSuccess(err) + + # await results + (err,) = cudart.cudaStreamSynchronize(stream) + assertSuccess(err) + + # validate h1 == h2 + assert np.array_equal(h1, h2) + + # clean up + (err,) = cudart.cudaFree(dptr) + assertSuccess(err) + + +def test_cudart_cudaMemcpy3DPeer(): + # allocate device memory + size = int(1024 * np.uint8().itemsize) + err, dptr = cudart.cudaMalloc(size) + assertSuccess(err) + + # create host arrays + h1 = np.full(size, 1).astype(np.uint8) + h2 = np.full(size, 2).astype(np.uint8) + assert np.array_equal(h1, h2) is False + + # create channel descriptor + err, desc = cudart.cudaCreateChannelDesc(8, 0, 0, 0, cudart.cudaChannelFormatKind.cudaChannelFormatKindUnsigned) + assertSuccess(err) + + # allocate device array + err, arr = cudart.cudaMallocArray(desc, size, 0, 0) + assertSuccess(err) + + # create memcpy params + params = cudart.cudaMemcpy3DPeerParms() + params.srcPtr = cudart.make_cudaPitchedPtr(dptr, size, 1, 1) + params.dstArray = arr + params.extent = cudart.make_cudaExtent(size, 1, 1) + + # h1 to D + (err,) = cudart.cudaMemcpy(dptr, h1, size, cudart.cudaMemcpyKind.cudaMemcpyHostToDevice) + assertSuccess(err) + + # D to arr + (err,) = cudart.cudaMemcpy3DPeer(params) + assertSuccess(err) + + # arr to h2 + (err,) = cudart.cudaMemcpy2DFromArray(h2, size, arr, 0, 0, size, 1, cudart.cudaMemcpyKind.cudaMemcpyDeviceToHost) + assertSuccess(err) + + # validate h1 == h2 + assert np.array_equal(h1, h2) + + # clean up + (err,) = cudart.cudaFreeArray(arr) + assertSuccess(err) + (err,) = cudart.cudaFree(dptr) + assertSuccess(err) + + +def test_cudart_cudaMemcpy3DPeerAsync(): + # allocate device memory + size = 1024 * np.uint8().itemsize + err, dptr = cudart.cudaMalloc(size) + assertSuccess(err) + + # create host arrays + h1 = np.full(size, 1).astype(np.uint8) + h2 = np.full(size, 2).astype(np.uint8) + assert np.array_equal(h1, h2) is False + + # create channel descriptor + err, desc = cudart.cudaCreateChannelDesc(8, 0, 0, 0, cudart.cudaChannelFormatKind.cudaChannelFormatKindUnsigned) + assertSuccess(err) + + # allocate device array + err, arr = cudart.cudaMallocArray(desc, size, 0, 0) + assertSuccess(err) + + # create stream + err, stream = cudart.cudaStreamCreate() + assertSuccess(err) + + # create memcpy params + params = cudart.cudaMemcpy3DPeerParms() + params.srcPtr = cudart.make_cudaPitchedPtr(dptr, size, 1, 1) + params.dstArray = arr + params.extent = cudart.make_cudaExtent(size, 1, 1) + + # h1 to D + (err,) = cudart.cudaMemcpy(dptr, h1, size, cudart.cudaMemcpyKind.cudaMemcpyHostToDevice) + assertSuccess(err) + + # ensure the DMA to device memory has completed + (err,) = cudart.cudaStreamSynchronize(0) + assertSuccess(err) + + # D to arr + (err,) = cudart.cudaMemcpy3DPeerAsync(params, stream) + assertSuccess(err) + + # await results + (err,) = cudart.cudaStreamSynchronize(stream) + assertSuccess(err) + + # arr to h2 + (err,) = cudart.cudaMemcpy2DFromArray(h2, size, arr, 0, 0, size, 1, cudart.cudaMemcpyKind.cudaMemcpyDeviceToHost) + assertSuccess(err) + + # validate h1 == h2 + assert np.array_equal(h1, h2) + + # clean up + (err,) = cudart.cudaFreeArray(arr) + assertSuccess(err) + (err,) = cudart.cudaFree(dptr) + assertSuccess(err) + + +def test_profiler(): + (err,) = cudart.cudaProfilerStart() + assertSuccess(err) + (err,) = cudart.cudaProfilerStop() + assertSuccess(err) + + +def test_cudart_eglFrame(): + frame = cudart.cudaEglFrame() + # [, , ] + assert int(frame.frame.pArray[0]) == 0 + assert int(frame.frame.pArray[1]) == 0 + assert int(frame.frame.pArray[2]) == 0 + frame.frame.pArray = [1, 2, 3] + # [, , ] + assert int(frame.frame.pArray[0]) == 1 + assert int(frame.frame.pArray[1]) == 2 + assert int(frame.frame.pArray[2]) == 3 + frame.frame.pArray = [1, 2, cudart.cudaArray_t(4)] + # [, , ] + assert int(frame.frame.pArray[0]) == 1 + assert int(frame.frame.pArray[1]) == 2 + assert int(frame.frame.pArray[2]) == 4 + # frame.frame.pPitch + # [ptr : 0x1 + # pitch : 2 + # xsize : 4 + # ysize : 0, ptr : 0x0 + # pitch : 0 + # xsize : 0 + # ysize : 0, ptr : 0x0 + # pitch : 0 + # xsize : 0 + # ysize : 0] + assert int(frame.frame.pPitch[0].ptr) == 1 + assert int(frame.frame.pPitch[0].pitch) == 2 + assert int(frame.frame.pPitch[0].xsize) == 4 + assert int(frame.frame.pPitch[0].ysize) == 0 + assert int(frame.frame.pPitch[1].ptr) == 0 + assert int(frame.frame.pPitch[1].pitch) == 0 + assert int(frame.frame.pPitch[1].xsize) == 0 + assert int(frame.frame.pPitch[1].ysize) == 0 + assert int(frame.frame.pPitch[2].ptr) == 0 + assert int(frame.frame.pPitch[2].pitch) == 0 + assert int(frame.frame.pPitch[2].xsize) == 0 + assert int(frame.frame.pPitch[2].ysize) == 0 + frame.frame.pPitch = [cudart.cudaPitchedPtr(), cudart.cudaPitchedPtr(), cudart.cudaPitchedPtr()] + # [ptr : 0x0 + # pitch : 0 + # xsize : 0 + # ysize : 0, ptr : 0x0 + # pitch : 0 + # xsize : 0 + # ysize : 0, ptr : 0x0 + # pitch : 0 + # xsize : 0 + # ysize : 0] + assert int(frame.frame.pPitch[0].ptr) == 0 + assert int(frame.frame.pPitch[0].pitch) == 0 + assert int(frame.frame.pPitch[0].xsize) == 0 + assert int(frame.frame.pPitch[0].ysize) == 0 + assert int(frame.frame.pPitch[1].ptr) == 0 + assert int(frame.frame.pPitch[1].pitch) == 0 + assert int(frame.frame.pPitch[1].xsize) == 0 + assert int(frame.frame.pPitch[1].ysize) == 0 + assert int(frame.frame.pPitch[2].ptr) == 0 + assert int(frame.frame.pPitch[2].pitch) == 0 + assert int(frame.frame.pPitch[2].xsize) == 0 + assert int(frame.frame.pPitch[2].ysize) == 0 + x = frame.frame.pPitch[0] + x.pitch = 123 + frame.frame.pPitch = [x, x, x] + # [ptr : 0x0 + # pitch : 123 + # xsize : 0 + # ysize : 0, ptr : 0x0 + # pitch : 123 + # xsize : 0 + # ysize : 0, ptr : 0x0 + # pitch : 123 + # xsize : 0 + # ysize : 0] + assert int(frame.frame.pPitch[0].ptr) == 0 + assert int(frame.frame.pPitch[0].pitch) == 123 + assert int(frame.frame.pPitch[0].xsize) == 0 + assert int(frame.frame.pPitch[0].ysize) == 0 + assert int(frame.frame.pPitch[1].ptr) == 0 + assert int(frame.frame.pPitch[1].pitch) == 123 + assert int(frame.frame.pPitch[1].xsize) == 0 + assert int(frame.frame.pPitch[1].ysize) == 0 + assert int(frame.frame.pPitch[2].ptr) == 0 + assert int(frame.frame.pPitch[2].pitch) == 123 + assert int(frame.frame.pPitch[2].xsize) == 0 + assert int(frame.frame.pPitch[2].ysize) == 0 + x.pitch = 1234 + # [ptr : 0x0 + # pitch : 123 + # xsize : 0 + # ysize : 0, ptr : 0x0 + # pitch : 123 + # xsize : 0 + # ysize : 0, ptr : 0x0 + # pitch : 123 + # xsize : 0 + # ysize : 0] + assert int(frame.frame.pPitch[0].ptr) == 0 + assert int(frame.frame.pPitch[0].pitch) == 123 + assert int(frame.frame.pPitch[0].xsize) == 0 + assert int(frame.frame.pPitch[0].ysize) == 0 + assert int(frame.frame.pPitch[1].ptr) == 0 + assert int(frame.frame.pPitch[1].pitch) == 123 + assert int(frame.frame.pPitch[1].xsize) == 0 + assert int(frame.frame.pPitch[1].ysize) == 0 + assert int(frame.frame.pPitch[2].ptr) == 0 + assert int(frame.frame.pPitch[2].pitch) == 123 + assert int(frame.frame.pPitch[2].xsize) == 0 + assert int(frame.frame.pPitch[2].ysize) == 0 + + +def cudart_func_stream_callback(use_host_api): + class testStruct(ctypes.Structure): + _fields_ = [ + ("a", ctypes.c_int), + ("b", ctypes.c_int), + ("c", ctypes.c_int), + ] + + def task_callback_host(userData): + data = testStruct.from_address(userData) + assert data.a == 1 + assert data.b == 2 + assert data.c == 3 + return 0 + + def task_callback_stream(stream, status, userData): + data = testStruct.from_address(userData) + assert data.a == 1 + assert data.b == 2 + assert data.c == 3 + return 0 + + if use_host_api: + callback_type = ctypes.PYFUNCTYPE(ctypes.c_int, ctypes.c_void_p) + target_task = task_callback_host + else: + callback_type = ctypes.PYFUNCTYPE(ctypes.c_int, ctypes.c_void_p, ctypes.c_int, ctypes.c_void_p) + target_task = task_callback_stream + + # Construct ctype data + c_callback = callback_type(target_task) + c_data = testStruct(1, 2, 3) + + # ctypes is managing the pointer value for us + if use_host_api: + callback = cudart.cudaHostFn_t(_ptr=ctypes.addressof(c_callback)) + else: + callback = cudart.cudaStreamCallback_t(_ptr=ctypes.addressof(c_callback)) + + # Run + err, stream = cudart.cudaStreamCreate() + assertSuccess(err) + if use_host_api: + (err,) = cudart.cudaLaunchHostFunc(stream, callback, ctypes.addressof(c_data)) + assertSuccess(err) + else: + (err,) = cudart.cudaStreamAddCallback(stream, callback, ctypes.addressof(c_data), 0) + assertSuccess(err) + (err,) = cudart.cudaDeviceSynchronize() + assertSuccess(err) + + +def test_cudart_func_callback(): + cudart_func_stream_callback(use_host_api=False) + cudart_func_stream_callback(use_host_api=True) + + +@pytest.mark.skipif( + driverVersionLessThan(12030) or not supportsCudaAPI("cudaGraphConditionalHandleCreate"), + reason="Conditional graph APIs required", +) +def test_cudart_conditional(): + err, graph = cudart.cudaGraphCreate(0) + assertSuccess(err) + err, handle = cudart.cudaGraphConditionalHandleCreate(graph, 0, 0) + assertSuccess(err) + + params = cudart.cudaGraphNodeParams() + params.type = cudart.cudaGraphNodeType.cudaGraphNodeTypeConditional + params.conditional.handle = handle + params.conditional.type = cudart.cudaGraphConditionalNodeType.cudaGraphCondTypeIf + params.conditional.size = 1 + + assert len(params.conditional.phGraph_out) == 1 + assert int(params.conditional.phGraph_out[0]) == 0 + err, node = cudart.cudaGraphAddNode(graph, None, None, 0, params) + assertSuccess(err) + + assert len(params.conditional.phGraph_out) == 1 + assert int(params.conditional.phGraph_out[0]) != 0 + + +@pytest.mark.parametrize( + "target", + ( + runtime.cudaStream_t, + runtime.cudaEvent_t, + runtime.cudaGraph_t, + runtime.cudaGraphNode_t, + runtime.cudaGraphExec_t, + runtime.cudaMemPool_t, + ), +) +def test_struct_pointer_comparison(target): + a = target(123) + b = target(123) + assert a == b + assert hash(a) == hash(b) + c = target(456) + assert a != c + assert hash(a) != hash(c) + + +def test_getLocalRuntimeVersion(): + # verify that successive calls do not segfault the interpreter + for _ in range(10): + try: + err, version = cudart.getLocalRuntimeVersion() + except pathfinder.DynamicLibNotFoundError: + pytest.skip("cudart dynamic lib not available") + else: + assertSuccess(err) + assert version >= 12000 # CUDA 12.0 + + +@pytest.mark.skipif( + driverVersionLessThan(13010) or not supportsCudaAPI("cudaGraphGetId"), + reason="Requires CUDA 13.1+", +) +def test_cudaGraphGetId(): + """Test cudaGraphGetId - get graph ID.""" + err, graph = cudart.cudaGraphCreate(0) + assertSuccess(err) + + err, graph_id = cudart.cudaGraphGetId(graph) + assertSuccess(err) + assert isinstance(graph_id, int) + assert graph_id > 0 + + # Create another graph and verify it has a different ID + err, graph2 = cudart.cudaGraphCreate(0) + assertSuccess(err) + err, graph_id2 = cudart.cudaGraphGetId(graph2) + assertSuccess(err) + assert graph_id2 != graph_id + + (err,) = cudart.cudaGraphDestroy(graph) + assertSuccess(err) + (err,) = cudart.cudaGraphDestroy(graph2) + assertSuccess(err) + + +@pytest.mark.skipif( + driverVersionLessThan(13010) or not supportsCudaAPI("cudaGraphExecGetId"), + reason="Requires CUDA 13.1+", +) +def test_cudaGraphExecGetId(): + """Test cudaGraphExecGetId - get graph exec ID.""" + err, stream = cudart.cudaStreamCreate() + assertSuccess(err) + + err, graph = cudart.cudaGraphCreate(0) + assertSuccess(err) + + # Add an empty node to make the graph valid + err, node = cudart.cudaGraphAddEmptyNode(graph, None, 0) + assertSuccess(err) + + err, graphExec = cudart.cudaGraphInstantiate(graph, 0) + assertSuccess(err) + + err, graph_exec_id = cudart.cudaGraphExecGetId(graphExec) + assertSuccess(err) + assert isinstance(graph_exec_id, int) + assert graph_exec_id > 0 + + # Create another graph exec and verify it has a different ID + err, graph2 = cudart.cudaGraphCreate(0) + assertSuccess(err) + err, node2 = cudart.cudaGraphAddEmptyNode(graph2, None, 0) + assertSuccess(err) + err, graphExec2 = cudart.cudaGraphInstantiate(graph2, 0) + assertSuccess(err) + err, graph_exec_id2 = cudart.cudaGraphExecGetId(graphExec2) + assertSuccess(err) + assert graph_exec_id2 != graph_exec_id + + (err,) = cudart.cudaGraphExecDestroy(graphExec) + assertSuccess(err) + (err,) = cudart.cudaGraphExecDestroy(graphExec2) + assertSuccess(err) + (err,) = cudart.cudaGraphDestroy(graph) + assertSuccess(err) + (err,) = cudart.cudaGraphDestroy(graph2) + assertSuccess(err) + (err,) = cudart.cudaStreamDestroy(stream) + assertSuccess(err) + + +@pytest.mark.skipif( + driverVersionLessThan(13010) or not supportsCudaAPI("cudaGraphNodeGetLocalId"), + reason="Requires CUDA 13.1+", +) +def test_cudaGraphNodeGetLocalId(): + """Test cudaGraphNodeGetLocalId - get node local ID.""" + err, graph = cudart.cudaGraphCreate(0) + assertSuccess(err) + + # Add multiple nodes + err, node1 = cudart.cudaGraphAddEmptyNode(graph, None, 0) + assertSuccess(err) + + err, node2 = cudart.cudaGraphAddEmptyNode(graph, [node1], 1) + assertSuccess(err) + + err, node3 = cudart.cudaGraphAddEmptyNode(graph, [node1, node2], 2) + assertSuccess(err) + + # Get local IDs for each node + err, node_id1 = cudart.cudaGraphNodeGetLocalId(node1) + assertSuccess(err) + assert isinstance(node_id1, int) + assert node_id1 >= 0 + + err, node_id2 = cudart.cudaGraphNodeGetLocalId(node2) + assertSuccess(err) + assert isinstance(node_id2, int) + assert node_id2 >= 0 + assert node_id2 != node_id1 + + err, node_id3 = cudart.cudaGraphNodeGetLocalId(node3) + assertSuccess(err) + assert isinstance(node_id3, int) + assert node_id3 >= 0 + assert node_id3 != node_id1 + assert node_id3 != node_id2 + + (err,) = cudart.cudaGraphDestroy(graph) + assertSuccess(err) + + +@pytest.mark.skipif( + driverVersionLessThan(13010) or not supportsCudaAPI("cudaGraphNodeGetToolsId"), + reason="Requires CUDA 13.1+", +) +def test_cudaGraphNodeGetToolsId(): + """Test cudaGraphNodeGetToolsId - get node tools ID.""" + err, graph = cudart.cudaGraphCreate(0) + assertSuccess(err) + + err, node = cudart.cudaGraphAddEmptyNode(graph, None, 0) + assertSuccess(err) + + err, tools_node_id = cudart.cudaGraphNodeGetToolsId(node) + assertSuccess(err) + assert isinstance(tools_node_id, int) + # toolsNodeId is unsigned long long, so it can be any non-negative value + assert tools_node_id >= 0 + + # Add another node and verify it has a different tools ID + err, node2 = cudart.cudaGraphAddEmptyNode(graph, [node], 1) + assertSuccess(err) + err, tools_node_id2 = cudart.cudaGraphNodeGetToolsId(node2) + assertSuccess(err) + assert tools_node_id2 != tools_node_id + + (err,) = cudart.cudaGraphDestroy(graph) + assertSuccess(err) + + +@pytest.mark.skipif( + driverVersionLessThan(13010) or not supportsCudaAPI("cudaGraphNodeGetContainingGraph"), + reason="Requires CUDA 13.1+", +) +def test_cudaGraphNodeGetContainingGraph(): + """Test cudaGraphNodeGetContainingGraph - get graph containing a node.""" + err, graph = cudart.cudaGraphCreate(0) + assertSuccess(err) + + err, node = cudart.cudaGraphAddEmptyNode(graph, None, 0) + assertSuccess(err) + + # Get the containing graph + err, containing_graph = cudart.cudaGraphNodeGetContainingGraph(node) + assertSuccess(err) + # Verify it's the same graph + assert int(containing_graph) == int(graph) + + # Test with a child graph node (if supported) + # Create a child graph + err, child_graph = cudart.cudaGraphCreate(0) + assertSuccess(err) + err, child_node = cudart.cudaGraphAddEmptyNode(child_graph, None, 0) + assertSuccess(err) + + # Add child graph node to parent graph + childGraphNodeParams = cudart.cudaGraphNodeParams() + childGraphNodeParams.type = cudart.cudaGraphNodeType.cudaGraphNodeTypeGraph + childGraphNodeParams.graph.graph = child_graph + err, child_graph_node = cudart.cudaGraphAddNode(graph, None, None, 0, childGraphNodeParams) + if isSuccess(err): + # Get containing graph for the child graph node + err, containing_graph_for_child = cudart.cudaGraphNodeGetContainingGraph(child_graph_node) + assertSuccess(err) + assert int(containing_graph_for_child) == int(graph) + + # Get containing graph for node inside child graph + err, containing_graph_for_nested = cudart.cudaGraphNodeGetContainingGraph(child_node) + assertSuccess(err) + assert int(containing_graph_for_nested) == int(child_graph) + + (err,) = cudart.cudaGraphDestroy(graph) + assertSuccess(err) + (err,) = cudart.cudaGraphDestroy(child_graph) + assertSuccess(err) + + +@pytest.mark.skipif( + driverVersionLessThan(13010) or not supportsCudaAPI("cudaStreamGetDevResource"), + reason="Requires CUDA 13.1+", +) +def test_cudaStreamGetDevResource(): + """Test cudaStreamGetDevResource - get device resource from stream.""" + err, stream = cudart.cudaStreamCreate() + assertSuccess(err) + + # Get SM resource from stream + err, resource = cudart.cudaStreamGetDevResource(stream, cudart.cudaDevResourceType.cudaDevResourceTypeSm) + assertSuccess(err) + # Verify resource is valid (non-None) + assert resource is not None + + (err,) = cudart.cudaStreamDestroy(stream) + assertSuccess(err) + + +@pytest.mark.skipif( + driverVersionLessThan(13010) or not supportsCudaAPI("cudaDeviceGetDevResource"), + reason="Requires CUDA 13.1+", +) +def test_cudaDeviceGetDevResource(): + """Test cudaDeviceGetDevResource - get device resource.""" + device = 0 + + # Get SM resource from device + err, resource = cudart.cudaDeviceGetDevResource(device, cudart.cudaDevResourceType.cudaDevResourceTypeSm) + assertSuccess(err) + # Verify resource is valid (non-None) + assert resource is not None + + +@pytest.mark.skipif( + driverVersionLessThan(13010) or not supportsCudaAPI("cudaDeviceGetExecutionCtx"), + reason="Requires CUDA 13.1+", +) +def test_cudaExecutionCtxGetDevResource(): + """Test cudaExecutionCtxGetDevResource - get device resource from execution context.""" + # Get execution context for device 0 (primary context) + err, exec_ctx = cudart.cudaDeviceGetExecutionCtx(0) + assertSuccess(err) + assert exec_ctx is not None + + # Get SM resource from execution context + err, resource = cudart.cudaExecutionCtxGetDevResource(exec_ctx, cudart.cudaDevResourceType.cudaDevResourceTypeSm) + assertSuccess(err) + # Verify resource is valid (non-None) + assert resource is not None + + +@pytest.mark.skipif( + driverVersionLessThan(13010) or not supportsCudaAPI("cudaDeviceGetExecutionCtx"), + reason="Requires CUDA 13.1+", +) +def test_cudaExecutionCtxGetDevice(): + """Test cudaExecutionCtxGetDevice - get device from execution context.""" + device = 0 + + # Get execution context for device + err, exec_ctx = cudart.cudaDeviceGetExecutionCtx(device) + assertSuccess(err) + assert exec_ctx is not None + + # Get device from execution context + err, device_from_ctx = cudart.cudaExecutionCtxGetDevice(exec_ctx) + assertSuccess(err) + # Verify it returns the same device + assert device_from_ctx == device + + +@pytest.mark.skipif( + driverVersionLessThan(13010) or not supportsCudaAPI("cudaDeviceGetExecutionCtx"), + reason="Requires CUDA 13.1+", +) +def test_cudaExecutionCtxGetId(): + """Test cudaExecutionCtxGetId - get unique ID from execution context.""" + # Get execution context for device 0 (primary context) + err, exec_ctx = cudart.cudaDeviceGetExecutionCtx(0) + assertSuccess(err) + assert exec_ctx is not None + + # Get unique ID from execution context + err, ctx_id = cudart.cudaExecutionCtxGetId(exec_ctx) + assertSuccess(err) + assert isinstance(ctx_id, int) + assert ctx_id > 0 + + # Get another execution context and verify it has a different ID + err, exec_ctx2 = cudart.cudaDeviceGetExecutionCtx(0) + assertSuccess(err) + # Should return the same context for the same device + assert int(exec_ctx2) == int(exec_ctx) + err, ctx_id2 = cudart.cudaExecutionCtxGetId(exec_ctx2) + assertSuccess(err) + # Should have the same ID since it's the same context + assert ctx_id2 == ctx_id + + +@pytest.mark.skipif( + driverVersionLessThan(13010) or not supportsCudaAPI("cudaDevSmResourceSplit"), + reason="Requires CUDA 13.1+", +) +def test_cudaDevSmResourceSplit(): + """Test cudaDevSmResourceSplit - split SM resource into structured groups.""" + device = 0 + err, resource_in = cudart.cudaDeviceGetDevResource(device, cudart.cudaDevResourceType.cudaDevResourceTypeSm) + assertSuccess(err) + + # Test case 1: Split into 1 group + nb_groups = 1 + group_params = [cudart.cudaDevSmResourceGroupParams()] + # Set up group: request 4 SMs with coscheduled count of 2 + group_params[0].smCount = 4 + group_params[0].coscheduledSmCount = 2 + + err, res, rem = cudart.cudaDevSmResourceSplit(nb_groups, resource_in, 0, group_params) + assertSuccess(err) + assert len(res) == nb_groups + assert rem is not None or len(res) > 0 + + # Test case 2: Split into 2 groups (if device has enough SMs) + # First, get the device resource again for a fresh split + err, resource_in = cudart.cudaDeviceGetDevResource(device, cudart.cudaDevResourceType.cudaDevResourceTypeSm) + assertSuccess(err) + + nb_groups = 2 + group_params = [ + cudart.cudaDevSmResourceGroupParams(), + cudart.cudaDevSmResourceGroupParams(), + ] + # First group: request 4 SMs with coscheduled count of 2 + group_params[0].smCount = 4 + group_params[0].coscheduledSmCount = 2 + # Second group: request 4 SMs with coscheduled count of 2 + group_params[1].smCount = 4 + group_params[1].coscheduledSmCount = 2 + + err, res, rem = cudart.cudaDevSmResourceSplit(nb_groups, resource_in, 0, group_params) + # This may succeed or fail depending on device SM count, but should handle gracefully + if err == cudart.cudaError_t.cudaSuccess: + assert len(res) == nb_groups + assert rem is not None or len(res) > 0 + else: + # If it fails, it should be due to insufficient resources, not a binding error + assert err in ( + cudart.cudaError_t.cudaErrorInvalidResourceConfiguration, + cudart.cudaError_t.cudaErrorInvalidValue, + ) + + # Test case 3: Empty list (0 groups) - should handle gracefully + # Note: According to CUDA docs, nbGroups specifies number of groups, so 0 might not be valid + # But we test that the binding accepts an empty list without crashing + nb_groups = 0 + group_params = [] + + err, res, rem = cudart.cudaDevSmResourceSplit(nb_groups, resource_in, 0, group_params) + # With 0 groups, result should be empty + if err == cudart.cudaError_t.cudaSuccess: + assert len(res) == 0 + else: + # If it fails, it should be a valid CUDA error, not a Python binding error + assert err in ( + cudart.cudaError_t.cudaErrorInvalidValue, + cudart.cudaError_t.cudaErrorInvalidResourceConfiguration, + ) + + +@pytest.mark.skipif( + driverVersionLessThan(13010) or not supportsCudaAPI("cudaDevSmResourceSplitByCount"), + reason="Requires CUDA 13.1+", +) +def test_cudaDevSmResourceSplitByCount(): + """Test cudaDevSmResourceSplitByCount - split SM resource by count.""" + device = 0 + err, resource_in = cudart.cudaDeviceGetDevResource(device, cudart.cudaDevResourceType.cudaDevResourceTypeSm) + assertSuccess(err) + + # First call: discovery mode (nbGroups = 0) to get count + err, res, count, rem = cudart.cudaDevSmResourceSplitByCount(0, resource_in, 0, 2) + assertSuccess(err) + assert count > 0 + assert len(res) == 0 # No results in discovery mode + + # Second call: actual split with the discovered count + err, res, count_same, rem = cudart.cudaDevSmResourceSplitByCount(count, resource_in, 0, 2) + assertSuccess(err) + assert count == count_same + assert len(res) == count + + +@pytest.mark.skipif( + driverVersionLessThan(13010) or not supportsCudaAPI("cudaDevResourceGenerateDesc"), + reason="Requires CUDA 13.1+", +) +def test_cudaDevResourceGenerateDesc(): + """Test cudaDevResourceGenerateDesc - generate resource descriptor.""" + device = 0 + err, resource = cudart.cudaDeviceGetDevResource(device, cudart.cudaDevResourceType.cudaDevResourceTypeSm) + assertSuccess(err) + + # Generate descriptor from a single resource + resources = [resource] + err, desc = cudart.cudaDevResourceGenerateDesc(resources, len(resources)) + assertSuccess(err) + assert desc is not None + + +@pytest.mark.skipif( + driverVersionLessThan(13010) or not supportsCudaAPI("cudaGreenCtxCreate"), + reason="Requires CUDA 13.1+", +) +def test_cudaGreenCtxCreate(): + """Test cudaGreenCtxCreate - create green context with resources.""" + device = 0 + + # Set device to ensure primary context is ready + (err,) = cudart.cudaSetDevice(device) + assertSuccess(err) + + # Get device resource + err, resource = cudart.cudaDeviceGetDevResource(device, cudart.cudaDevResourceType.cudaDevResourceTypeSm) + assertSuccess(err) + + # Generate descriptor + resources = [resource] + err, desc = cudart.cudaDevResourceGenerateDesc(resources, len(resources)) + assertSuccess(err) + + # Create green context + err, green_ctx = cudart.cudaGreenCtxCreate(desc, device, 0) + assertSuccess(err) + assert green_ctx is not None + + # Cleanup: destroy the green context + (err,) = cudart.cudaExecutionCtxDestroy(green_ctx) + assertSuccess(err) + + +@pytest.mark.skipif( + driverVersionLessThan(13010) or not supportsCudaAPI("cudaExecutionCtxStreamCreate"), + reason="Requires CUDA 13.1+", +) +def test_cudaExecutionCtxStreamCreate(): + """Test cudaExecutionCtxStreamCreate - create stream for execution context.""" + # Get execution context for device 0 (primary context) + err, exec_ctx = cudart.cudaDeviceGetExecutionCtx(0) + assertSuccess(err) + assert exec_ctx is not None + + # Create stream for the execution context + err, stream = cudart.cudaExecutionCtxStreamCreate(exec_ctx, 0, 0) + assertSuccess(err) + assert stream is not None + + # Cleanup: destroy the stream + (err,) = cudart.cudaStreamDestroy(stream) + assertSuccess(err) + + +@pytest.mark.skipif( + driverVersionLessThan(13010) or not supportsCudaAPI("cudaGraphConditionalHandleCreate_v2"), + reason="Requires CUDA 13.1+", +) +def test_cudaGraphConditionalHandleCreate_v2(): + """Test cudaGraphConditionalHandleCreate_v2 - create conditional handle with execution context.""" + err, graph = cudart.cudaGraphCreate(0) + assertSuccess(err) + + # Get execution context (can be None for v2) + err, exec_ctx = cudart.cudaDeviceGetExecutionCtx(0) + assertSuccess(err) + + # Create conditional handle with execution context + err, handle = cudart.cudaGraphConditionalHandleCreate_v2(graph, exec_ctx, 0, 0) + assertSuccess(err) + assert handle is not None + + (err,) = cudart.cudaGraphDestroy(graph) + assertSuccess(err) diff --git a/cuda_bindings/tests/test_cufile.py b/cuda_bindings/tests/test_cufile.py new file mode 100644 index 00000000000..46bd8429a62 --- /dev/null +++ b/cuda_bindings/tests/test_cufile.py @@ -0,0 +1,1915 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +import ctypes +import logging +import os +import pathlib +import platform +import subprocess +import tempfile +from contextlib import contextmanager, suppress +from functools import cache + +import pytest + +import cuda.bindings.driver as cuda + +cufile = pytest.importorskip("cuda.bindings.cufile") + +# Configure logging to show INFO level and above +logging.basicConfig( + level=logging.INFO, + format="%(levelname)s: %(message)s", + force=True, # Override any existing logging configuration +) + +cufile = pytest.importorskip("cuda.bindings.cufile", reason="skipping tests on Windows") + + +@contextmanager +def _cufile_driver_session(): + """Open the cuFile driver for a block; always close in a finally (mirrors try/finally).""" + cufile.driver_open() + try: + yield + finally: + cufile.driver_close() + + +@pytest.fixture +def cufile_env_json(monkeypatch): + """Set CUFILE_ENV_PATH_JSON environment variable for async tests.""" + # Get absolute path to cufile.json in the same directory as this test file + test_dir = os.path.dirname(os.path.abspath(__file__)) + config_path = os.path.join(test_dir, "cufile.json") + assert os.path.isfile(config_path) + monkeypatch.setenv("CUFILE_ENV_PATH_JSON", config_path) + logging.info(f"Using cuFile config: {config_path}") + + +@cache +def cufileLibraryAvailable(): + """Check if cuFile library is available on the system.""" + try: + # Try to get cuFile library version - this will fail if library is not available + version = cufile.get_version() + logging.info(f"cuFile library available, version: {version}") + return True + except Exception as e: + logging.warning(f"cuFile library not available: {e}") + return False + + +@cache +def cufileVersionLessThan(target): + """Check if cuFile library version is less than target version.""" + try: + # Get cuFile library version + version = cufile.get_version() + logging.info(f"cuFile library version: {version}") + # Check if version is less than target + if version < target: + logging.warning(f"cuFile library version {version} is less than required {target}") + return True + return False + except Exception as e: + logging.error(f"Error checking cuFile version: {e}") + return True # Assume old version if any error occurs + + +@cache +def isSupportedFilesystem(): + """Check if the current filesystem is supported (ext4 or xfs). + + This uses `findmnt` so the kernel's mount table logic owns the decoding of the filesystem type. + """ + fs_type = subprocess.check_output(["findmnt", "-no", "FSTYPE", "-T", os.getcwd()], text=True).strip() # noqa: S603, S607 + logging.info(f"Current filesystem type (findmnt): {fs_type}") + return fs_type in ("ext4", "xfs") + + +@cache +def get_tegra_kind(): + """Detect Tegra device kind (Orin/Thor) via nvidia-smi, or None if not Tegra.""" + if not pathlib.Path("/etc/nv_tegra_release").exists(): + return None + out = subprocess.check_output(["nvidia-smi"], text=True, stderr=subprocess.STDOUT) # noqa: S607 + tegra_kinds_found = [] + for kind in ("Orin", "Thor"): + if f" {kind} " in out: + tegra_kinds_found.append(kind) + assert len(tegra_kinds_found) == 1, f"UNEXPECTED nvidia-smi output:\n{out}" + return tegra_kinds_found[0] + + +# Global skip condition for all tests if cuFile library is not available +pytestmark = [ + pytest.mark.skipif(not cufileLibraryAvailable(), reason="cuFile library not available on this system"), + pytest.mark.skipif( + platform.system() == "Linux" and "microsoft" in pathlib.Path("/proc/version").read_text().lower(), + reason="skipping cuFile tests on WSL", + ), + pytest.mark.skipif(get_tegra_kind() == "Orin", reason="skipping cuFile tests on Orin (Tegra Linux)"), + pytest.mark.skipif( + get_tegra_kind() == "Thor" and cufileVersionLessThan(1160), + reason="skipping cuFile tests on Thor (Tegra Linux) with CTK < 13.1", + ), +] + + +def test_cufile_success_defined(): + """Check if CUFILE_SUCCESS is defined in OpError enum.""" + assert hasattr(cufile.OpError, "SUCCESS") + + +@pytest.fixture +def ctx(): + # Initialize CUDA + (err,) = cuda.cuInit(0) + assert err == cuda.CUresult.CUDA_SUCCESS + + err, device = cuda.cuDeviceGet(0) + assert err == cuda.CUresult.CUDA_SUCCESS + + err, ctx = cuda.cuDevicePrimaryCtxRetain(device) + assert err == cuda.CUresult.CUDA_SUCCESS + + (err,) = cuda.cuCtxSetCurrent(ctx) + assert err == cuda.CUresult.CUDA_SUCCESS + + yield + + cuda.cuDevicePrimaryCtxRelease(device) + + +@pytest.fixture(scope="module", autouse=True) +def _cufile_driver_prewarm(): + """Prime libcufile with one driver_open/close cycle before any test runs. + + The cuFile test module mixes two incompatible regimes: + + - Driver-open tests (buf_register_*, cufile_read_write, batch_io, stats, + etc.) need cuFileDriverOpen; they use the function-scope `driver` + fixture to open/close per test. + - Driver-closed tests (test_set_get_parameter_*, test_set_parameter_posix_*) + must run with the driver CLOSED — libcufile rejects parameter-set calls + when the driver is open (DRIVER_ALREADY_OPEN, 5026). + + Workaround for NVIDIA libcufile 1.17.1 bug: calling cuFileSetParameterSizeT + (or similar pre-open configuration APIs) BEFORE the first cuFileDriverOpen + leaves an internal version list uninitialized such that a later + cuFileDriverOpen SIGFPEs in CUFileDrv::ReadVersionInfo (div-by-zero). + Under random ordering, a driver-closed test can run before any + driver-open test, poisoning libcufile and tearing down pytest with a fatal + signal on the next driver_open. + + One open/close cycle up front primes libcufile's version list. After that, + both regimes work: the per-test `driver` fixture can open/close freely, + and parameter-set tests run against the (now properly initialized) closed + driver. + + Note: per-test driver_open/close is not ideal on throughput grounds, but + it is forced by the libcufile API — parameter-set tests cannot coexist + with a session-wide open driver. + """ + (err,) = cuda.cuInit(0) + assert err == cuda.CUresult.CUDA_SUCCESS + err, device = cuda.cuDeviceGet(0) + assert err == cuda.CUresult.CUDA_SUCCESS + err, dctx = cuda.cuDevicePrimaryCtxRetain(device) + assert err == cuda.CUresult.CUDA_SUCCESS + (err,) = cuda.cuCtxSetCurrent(dctx) + assert err == cuda.CUresult.CUDA_SUCCESS + try: + cufile.driver_open() + cufile.driver_close() + finally: + cuda.cuDevicePrimaryCtxRelease(device) + + +@pytest.fixture +def driver(ctx): + cufile.driver_open() + yield + cufile.driver_close() + + +@pytest.mark.skipif(not isSupportedFilesystem(), reason="cuFile handle_register requires ext4 or xfs filesystem") +@pytest.mark.usefixtures("driver") +def test_handle_register(tmpdir): + """Test file handle registration with cuFile.""" + # Create test file + file_path = tmpdir / "test_handle_register.bin" + + # Create file with POSIX operations + fd = os.open(file_path, os.O_CREAT | os.O_RDWR, 0o600) + + # Write test data using POSIX write + test_data = b"Test data for cuFile - POSIX write" + bytes_written = os.write(fd, test_data) + + # Sync to ensure data is on disk + os.fsync(fd) + + # Close and reopen with O_DIRECT for cuFile operations + os.close(fd) + + # Reopen with O_DIRECT + flags = os.O_RDWR | os.O_DIRECT + fd = os.open(file_path, flags) + + try: + # Create and initialize the descriptor + descr = cufile.Descr() + descr.type = cufile.FileHandleType.OPAQUE_FD + descr.handle.fd = fd + descr.fs_ops = 0 + + # Register the handle + handle = cufile.handle_register(descr.ptr) + + # Deregister the handle + cufile.handle_deregister(handle) + + finally: + os.close(fd) + + +@pytest.mark.usefixtures("driver") +def test_buf_register_simple(): + """Simple test for buffer registration with cuFile.""" + # Allocate CUDA memory + buffer_size = 4096 # 4KB, aligned to 4096 bytes + err, buf_ptr = cuda.cuMemAlloc(buffer_size) + assert err == cuda.CUresult.CUDA_SUCCESS + + try: + # Register the buffer with cuFile + flags = 0 + buf_ptr_int = int(buf_ptr) + cufile.buf_register(buf_ptr_int, buffer_size, flags) + + # Deregister the buffer + cufile.buf_deregister(buf_ptr_int) + + finally: + # Free CUDA memory + cuda.cuMemFree(buf_ptr) + + +@pytest.mark.usefixtures("driver") +def test_buf_register_host_memory(): + """Test buffer registration with host memory.""" + # Allocate host memory + buffer_size = 4096 # 4KB, aligned to 4096 bytes + err, buf_ptr = cuda.cuMemHostAlloc(buffer_size, 0) + assert err == cuda.CUresult.CUDA_SUCCESS + + try: + # Register the host buffer with cuFile + flags = 0 + buf_ptr_int = int(buf_ptr) + cufile.buf_register(buf_ptr_int, buffer_size, flags) + + # Deregister the buffer + cufile.buf_deregister(buf_ptr_int) + + finally: + # Free host memory + cuda.cuMemFreeHost(buf_ptr) + + +@pytest.mark.usefixtures("driver") +def test_buf_register_multiple_buffers(): + """Test registering multiple buffers.""" + # Allocate multiple CUDA buffers + buffer_sizes = [4096, 16384, 65536] # All aligned to 4096 bytes + buffers = [] + + for size in buffer_sizes: + err, buf_ptr = cuda.cuMemAlloc(size) + assert err == cuda.CUresult.CUDA_SUCCESS + buffers.append(buf_ptr) + + try: + # Register all buffers + flags = 0 + for buf_ptr, size in zip(buffers, buffer_sizes): + buf_ptr_int = int(buf_ptr) + cufile.buf_register(buf_ptr_int, size, flags) + + # Deregister all buffers + for buf_ptr in buffers: + buf_ptr_int = int(buf_ptr) + cufile.buf_deregister(buf_ptr_int) + + finally: + # Free all buffers + for buf_ptr in buffers: + cuda.cuMemFree(buf_ptr) + + +@pytest.mark.usefixtures("driver") +def test_buf_register_invalid_flags(): + """Test buffer registration with invalid flags.""" + # Allocate CUDA memory + buffer_size = 65536 + err, buf_ptr = cuda.cuMemAlloc(buffer_size) + assert err == cuda.CUresult.CUDA_SUCCESS + + try: + # Try to register with invalid flags + invalid_flags = 999 + buf_ptr_int = int(buf_ptr) + + with suppress(Exception): + cufile.buf_register(buf_ptr_int, buffer_size, invalid_flags) + # If we get here, deregister to clean up + cufile.buf_deregister(buf_ptr_int) + + finally: + # Free CUDA memory + cuda.cuMemFree(buf_ptr) + + +@pytest.mark.usefixtures("driver") +def test_buf_register_large_buffer(): + """Test buffer registration with a large buffer.""" + # Allocate large CUDA memory (1MB, aligned to 4096 bytes) + buffer_size = 1024 * 1024 # 1MB, aligned to 4096 bytes (1048576 % 4096 == 0) + err, buf_ptr = cuda.cuMemAlloc(buffer_size) + assert err == cuda.CUresult.CUDA_SUCCESS + + try: + # Register the large buffer with cuFile + flags = 0 + buf_ptr_int = int(buf_ptr) + cufile.buf_register(buf_ptr_int, buffer_size, flags) + + # Deregister the buffer + cufile.buf_deregister(buf_ptr_int) + + finally: + # Free CUDA memory + cuda.cuMemFree(buf_ptr) + + +@pytest.mark.usefixtures("driver") +def test_buf_register_already_registered(): + """Test that registering an already registered buffer fails.""" + # Allocate CUDA memory + buffer_size = 4096 # 4KB, aligned to 4096 bytes + err, buf_ptr = cuda.cuMemAlloc(buffer_size) + assert err == cuda.CUresult.CUDA_SUCCESS + + try: + # Register the buffer first time + flags = 0 + buf_ptr_int = int(buf_ptr) + cufile.buf_register(buf_ptr_int, buffer_size, flags) + + # Try to register the same buffer again + try: + cufile.buf_register(buf_ptr_int, buffer_size, flags) + # If we get here, deregister both times + cufile.buf_deregister(buf_ptr_int) + cufile.buf_deregister(buf_ptr_int) + except Exception: + # Expected error when registering buffer twice + # Deregister the first registration + cufile.buf_deregister(buf_ptr_int) + + finally: + # Free CUDA memory + cuda.cuMemFree(buf_ptr) + + +@pytest.mark.skipif(not isSupportedFilesystem(), reason="cuFile handle_register requires ext4 or xfs filesystem") +@pytest.mark.usefixtures("driver") +def test_cufile_read_write(tmpdir): + """Test cuFile read and write operations.""" + # Create test file + file_path = tmpdir / "test_cufile_rw.bin" + + # Allocate CUDA memory for write and read + write_size = 65536 # 64KB, aligned to 4096 bytes (65536 % 4096 == 0) + err, write_buf = cuda.cuMemAlloc(write_size) + assert err == cuda.CUresult.CUDA_SUCCESS + + err, read_buf = cuda.cuMemAlloc(write_size) + assert err == cuda.CUresult.CUDA_SUCCESS + + # Allocate host memory for data verification + host_buf = ctypes.create_string_buffer(write_size) + + try: + # Create file with O_DIRECT + fd = os.open(file_path, os.O_CREAT | os.O_RDWR | os.O_DIRECT, 0o600) + + # Register buffers with cuFile + write_buf_int = int(write_buf) + read_buf_int = int(read_buf) + + cufile.buf_register(write_buf_int, write_size, 0) + cufile.buf_register(read_buf_int, write_size, 0) + + # Create file descriptor + descr = cufile.Descr() + descr.type = cufile.FileHandleType.OPAQUE_FD + descr.handle.fd = fd + descr.fs_ops = 0 + + # Register file handle + handle = cufile.handle_register(descr.ptr) + + # Prepare test data + test_string = b"Hello cuFile! This is test data for read/write operations. " + test_string_len = len(test_string) + repetitions = write_size // test_string_len + test_data = test_string * repetitions + test_data = test_data[:write_size] # Ensure it fits exactly in buffer + host_buf = ctypes.create_string_buffer(test_data, write_size) + + # Copy test data to CUDA write buffer + cuda.cuMemcpyHtoDAsync(write_buf, host_buf, write_size, 0) + cuda.cuStreamSynchronize(0) + + # Write data using cuFile + bytes_written = cufile.write(handle, write_buf_int, write_size, 0, 0) + + # Read data back using cuFile + bytes_read = cufile.read(handle, read_buf_int, write_size, 0, 0) + + # Verify bytes written equals bytes read + assert bytes_written == write_size, f"Expected to write {write_size} bytes, but wrote {bytes_written}" + assert bytes_read == write_size, f"Expected to read {write_size} bytes, but read {bytes_read}" + assert bytes_written == bytes_read, f"Bytes written ({bytes_written}) doesn't match bytes read ({bytes_read})" + + # Copy read data back to host + cuda.cuMemcpyDtoHAsync(host_buf, read_buf, write_size, 0) + cuda.cuStreamSynchronize(0) + + # Verify the data + read_data = host_buf.value + assert read_data == test_data, "Read data doesn't match written data" + + # Deregister file handle + cufile.handle_deregister(handle) + + # Deregister buffers + cufile.buf_deregister(write_buf_int) + cufile.buf_deregister(read_buf_int) + + finally: + # Close file + os.close(fd) + # Free CUDA memory + cuda.cuMemFree(write_buf) + cuda.cuMemFree(read_buf) + + +@pytest.mark.skipif(not isSupportedFilesystem(), reason="cuFile handle_register requires ext4 or xfs filesystem") +@pytest.mark.usefixtures("driver") +def test_cufile_read_write_host_memory(tmpdir): + """Test cuFile read and write operations using host memory.""" + # Create test file + file_path = tmpdir / "test_cufile_rw_host.bin" + + # Allocate host memory for write and read + write_size = 65536 # 64KB, aligned to 4096 bytes (65536 % 4096 == 0) + err, write_buf = cuda.cuMemHostAlloc(write_size, 0) + assert err == cuda.CUresult.CUDA_SUCCESS + + err, read_buf = cuda.cuMemHostAlloc(write_size, 0) + assert err == cuda.CUresult.CUDA_SUCCESS + + try: + # Create file with O_DIRECT + fd = os.open(file_path, os.O_CREAT | os.O_RDWR | os.O_DIRECT, 0o600) + + # Register host buffers with cuFile + write_buf_int = int(write_buf) + read_buf_int = int(read_buf) + + cufile.buf_register(write_buf_int, write_size, 0) + cufile.buf_register(read_buf_int, write_size, 0) + + # Create file descriptor + descr = cufile.Descr() + descr.type = cufile.FileHandleType.OPAQUE_FD + descr.handle.fd = fd + descr.fs_ops = 0 + + # Register file handle + handle = cufile.handle_register(descr.ptr) + + # Prepare test data + test_string = b"Host memory test data for cuFile operations! " + test_string_len = len(test_string) + repetitions = write_size // test_string_len + test_data = test_string * repetitions + test_data = test_data[:write_size] # Ensure it fits exactly in buffer + + # Copy test data to host write buffer + host_buf = ctypes.create_string_buffer(test_data, write_size) + write_buf_content = ctypes.string_at(write_buf, write_size) + + # Write data using cuFile + bytes_written = cufile.write(handle, write_buf_int, write_size, 0, 0) + + # Sync to ensure data is on disk + os.fsync(fd) + + # Read data back using cuFile + bytes_read = cufile.read(handle, read_buf_int, write_size, 0, 0) + + # Verify bytes written equals bytes read + assert bytes_written == write_size, f"Expected to write {write_size} bytes, but wrote {bytes_written}" + assert bytes_read == write_size, f"Expected to read {write_size} bytes, but read {bytes_read}" + assert bytes_written == bytes_read, f"Bytes written ({bytes_written}) doesn't match bytes read ({bytes_read})" + + # Verify the data + read_data = ctypes.string_at(read_buf, write_size) + expected_data = write_buf_content + assert read_data == expected_data, "Read data doesn't match written data" + + # Deregister file handle + cufile.handle_deregister(handle) + + # Deregister buffers + cufile.buf_deregister(write_buf_int) + cufile.buf_deregister(read_buf_int) + + finally: + # Close file + os.close(fd) + # Free host memory + cuda.cuMemFreeHost(write_buf) + cuda.cuMemFreeHost(read_buf) + + +@pytest.mark.skipif(not isSupportedFilesystem(), reason="cuFile handle_register requires ext4 or xfs filesystem") +@pytest.mark.usefixtures("driver") +def test_cufile_read_write_large(tmpdir): + """Test cuFile read and write operations with large data.""" + # Create test file + file_path = tmpdir / "test_cufile_rw_large.bin" + + # Allocate large CUDA memory (1MB, aligned to 4096 bytes) + write_size = 1024 * 1024 # 1MB, aligned to 4096 bytes (1048576 % 4096 == 0) + err, write_buf = cuda.cuMemAlloc(write_size) + assert err == cuda.CUresult.CUDA_SUCCESS + + err, read_buf = cuda.cuMemAlloc(write_size) + assert err == cuda.CUresult.CUDA_SUCCESS + + # Allocate host memory for data verification + host_buf = ctypes.create_string_buffer(write_size) + + try: + # Create file with O_DIRECT + fd = os.open(file_path, os.O_CREAT | os.O_RDWR | os.O_DIRECT, 0o600) + + # Register buffers with cuFile + write_buf_int = int(write_buf) + read_buf_int = int(read_buf) + + cufile.buf_register(write_buf_int, write_size, 0) + cufile.buf_register(read_buf_int, write_size, 0) + + # Create file descriptor + descr = cufile.Descr() + descr.type = cufile.FileHandleType.OPAQUE_FD + descr.handle.fd = fd + descr.fs_ops = 0 + + # Register file handle + handle = cufile.handle_register(descr.ptr) + + # Generate large test data + import random + + test_data = bytes(random.getrandbits(8) for _ in range(write_size)) + host_buf = ctypes.create_string_buffer(test_data, write_size) + + # Copy test data to CUDA write buffer + cuda.cuMemcpyHtoDAsync(write_buf, host_buf, write_size, 0) + cuda.cuStreamSynchronize(0) + + # Get the actual data that was written to CUDA buffer + cuda.cuMemcpyDtoHAsync(host_buf, write_buf, write_size, 0) + cuda.cuStreamSynchronize(0) + expected_data = host_buf.value + + # Write data using cuFile + bytes_written = cufile.write(handle, write_buf_int, write_size, 0, 0) + + # Read data back using cuFile + bytes_read = cufile.read(handle, read_buf_int, write_size, 0, 0) + + # Verify bytes written equals bytes read + assert bytes_written == write_size, f"Expected to write {write_size} bytes, but wrote {bytes_written}" + assert bytes_read == write_size, f"Expected to read {write_size} bytes, but read {bytes_read}" + assert bytes_written == bytes_read, f"Bytes written ({bytes_written}) doesn't match bytes read ({bytes_read})" + + # Copy read data back to host + cuda.cuMemcpyDtoHAsync(host_buf, read_buf, write_size, 0) + cuda.cuStreamSynchronize(0) + + # Verify the data + read_data = host_buf.value + assert read_data == expected_data, "Large read data doesn't match written data" + + # Deregister file handle + cufile.handle_deregister(handle) + + # Deregister buffers + cufile.buf_deregister(write_buf_int) + cufile.buf_deregister(read_buf_int) + + finally: + # Close file + os.close(fd) + # Free CUDA memory + cuda.cuMemFree(write_buf) + cuda.cuMemFree(read_buf) + + +@pytest.mark.skipif(not isSupportedFilesystem(), reason="cuFile handle_register requires ext4 or xfs filesystem") +@pytest.mark.usefixtures("ctx", "cufile_env_json", "driver") +def test_cufile_write_async(tmpdir): + """Test cuFile asynchronous write operations.""" + # Create test file + file_path = tmpdir / "test_cufile_write_async.bin" + fd = os.open(file_path, os.O_CREAT | os.O_RDWR | os.O_DIRECT, 0o600) + + try: + # Register file handle + descr = cufile.Descr() + descr.type = cufile.FileHandleType.OPAQUE_FD + descr.handle.fd = fd + descr.fs_ops = 0 + handle = cufile.handle_register(descr.ptr) + + # Allocate and register device buffer + buf_size = 65536 # 64KB, aligned to 4096 bytes (65536 % 4096 == 0) + err, buf_ptr = cuda.cuMemAlloc(buf_size) + assert err == cuda.CUresult.CUDA_SUCCESS + cufile.buf_register(int(buf_ptr), buf_size, 0) + + # Create CUDA stream + err, stream = cuda.cuStreamCreate(0) + assert err == cuda.CUresult.CUDA_SUCCESS + + # Register stream with cuFile + cufile.stream_register(int(stream), 0) + + # Prepare test data in device buffer + test_string = b"Async write test data for cuFile!" + test_string_len = len(test_string) + repetitions = buf_size // test_string_len + test_data = test_string * repetitions + test_data = test_data[:buf_size] # Ensure it fits exactly in buffer + host_buf = ctypes.create_string_buffer(test_data, buf_size) + cuda.cuMemcpyHtoDAsync(buf_ptr, host_buf, buf_size, 0) + cuda.cuStreamSynchronize(0) + + # Create parameter arrays for async write + size_p = ctypes.c_size_t(buf_size) + file_offset_p = ctypes.c_int64(0) + buf_ptr_offset_p = ctypes.c_int64(0) + bytes_written_p = ctypes.c_ssize_t(0) + + # Perform async write + cufile.write_async( + int(handle), + int(buf_ptr), + ctypes.addressof(size_p), + ctypes.addressof(file_offset_p), + ctypes.addressof(buf_ptr_offset_p), + ctypes.addressof(bytes_written_p), + int(stream), + ) + + # Synchronize stream to wait for completion + cuda.cuStreamSynchronize(stream) + + # Verify bytes written + assert bytes_written_p.value == buf_size, f"Expected {buf_size} bytes written, got {bytes_written_p.value}" + + # Deregister stream + cufile.stream_deregister(int(stream)) + + # Deregister and cleanup + cufile.buf_deregister(int(buf_ptr)) + cufile.handle_deregister(handle) + cuda.cuStreamDestroy(stream) + cuda.cuMemFree(buf_ptr) + + finally: + os.close(fd) + + +@pytest.mark.skipif(not isSupportedFilesystem(), reason="cuFile handle_register requires ext4 or xfs filesystem") +@pytest.mark.usefixtures("ctx", "cufile_env_json", "driver") +def test_cufile_read_async(tmpdir): + """Test cuFile asynchronous read operations.""" + # Create test file + file_path = tmpdir / "test_cufile_read_async.bin" + + # First create and write test data without O_DIRECT + fd_temp = os.open(file_path, os.O_CREAT | os.O_RDWR, 0o600) + # Create test data that's aligned to 4096 bytes + test_string = b"Async read test data for cuFile!" + test_string_len = len(test_string) + buf_size = 65536 # 64KB, aligned to 4096 bytes + repetitions = buf_size // test_string_len + test_data = test_string * repetitions + test_data = test_data[:buf_size] # Ensure exact 64KB + os.write(fd_temp, test_data) + os.fsync(fd_temp) + os.close(fd_temp) + + # Now open with O_DIRECT for cuFile operations + fd = os.open(file_path, os.O_RDWR | os.O_DIRECT) + + try: + # Register file handle + descr = cufile.Descr() + descr.type = cufile.FileHandleType.OPAQUE_FD + descr.handle.fd = fd + descr.fs_ops = 0 + handle = cufile.handle_register(descr.ptr) + + # Allocate and register device buffer + buf_size = 65536 # 64KB, aligned to 4096 bytes (65536 % 4096 == 0) + err, buf_ptr = cuda.cuMemAlloc(buf_size) + assert err == cuda.CUresult.CUDA_SUCCESS + cufile.buf_register(int(buf_ptr), buf_size, 0) + + # Create CUDA stream + err, stream = cuda.cuStreamCreate(0) + assert err == cuda.CUresult.CUDA_SUCCESS + + # Register stream with cuFile + cufile.stream_register(int(stream), 0) + + # Create parameter arrays for async read + size_p = ctypes.c_size_t(buf_size) + file_offset_p = ctypes.c_int64(0) + buf_ptr_offset_p = ctypes.c_int64(0) + bytes_read_p = ctypes.c_ssize_t(0) + + # Perform async read + cufile.read_async( + int(handle), + int(buf_ptr), + ctypes.addressof(size_p), + ctypes.addressof(file_offset_p), + ctypes.addressof(buf_ptr_offset_p), + ctypes.addressof(bytes_read_p), + int(stream), + ) + + # Synchronize stream to wait for completion + cuda.cuStreamSynchronize(stream) + + # Verify bytes read + assert bytes_read_p.value > 0, f"Expected bytes read, got {bytes_read_p.value}" + + # Copy read data back to host and verify + host_buf = ctypes.create_string_buffer(buf_size) + cuda.cuMemcpyDtoHAsync(host_buf, buf_ptr, buf_size, 0) + cuda.cuStreamSynchronize(0) + read_data = host_buf.value[: bytes_read_p.value] + expected_data = test_data[: bytes_read_p.value] + assert read_data == expected_data, "Read data doesn't match written data" + + # Deregister stream + cufile.stream_deregister(int(stream)) + + # Deregister and cleanup + cufile.buf_deregister(int(buf_ptr)) + cufile.handle_deregister(handle) + cuda.cuStreamDestroy(stream) + cuda.cuMemFree(buf_ptr) + + finally: + os.close(fd) + + +@pytest.mark.skipif(not isSupportedFilesystem(), reason="cuFile handle_register requires ext4 or xfs filesystem") +@pytest.mark.usefixtures("ctx", "cufile_env_json", "driver") +def test_cufile_async_read_write(tmpdir): + """Test cuFile asynchronous read and write operations in sequence.""" + # Create test file + file_path = tmpdir / "test_cufile_async_rw.bin" + fd = os.open(file_path, os.O_CREAT | os.O_RDWR | os.O_DIRECT, 0o600) + + try: + # Register file handle + descr = cufile.Descr() + descr.type = cufile.FileHandleType.OPAQUE_FD + descr.handle.fd = fd + descr.fs_ops = 0 + handle = cufile.handle_register(descr.ptr) + + # Allocate and register device buffers + buf_size = 65536 # 64KB, aligned to 4096 bytes (65536 % 4096 == 0) + err, write_buf = cuda.cuMemAlloc(buf_size) + assert err == cuda.CUresult.CUDA_SUCCESS + cufile.buf_register(int(write_buf), buf_size, 0) + + err, read_buf = cuda.cuMemAlloc(buf_size) + assert err == cuda.CUresult.CUDA_SUCCESS + cufile.buf_register(int(read_buf), buf_size, 0) + + # Create CUDA stream + err, stream = cuda.cuStreamCreate(0) + assert err == cuda.CUresult.CUDA_SUCCESS + + # Register stream with cuFile + cufile.stream_register(int(stream), 0) + + # Prepare test data in write buffer + test_string = b"Async RW test data for cuFile!" + test_string_len = len(test_string) + repetitions = buf_size // test_string_len + test_data = test_string * repetitions + test_data = test_data[:buf_size] # Ensure it fits exactly in buffer + host_buf = ctypes.create_string_buffer(test_data, buf_size) + cuda.cuMemcpyHtoDAsync(write_buf, host_buf, buf_size, 0) + cuda.cuStreamSynchronize(0) + + # Create parameter arrays for async write + write_size_p = ctypes.c_size_t(buf_size) + write_file_offset_p = ctypes.c_int64(0) + write_buf_ptr_offset_p = ctypes.c_int64(0) + bytes_written_p = ctypes.c_ssize_t(0) + + # Perform async write + cufile.write_async( + int(handle), + int(write_buf), + ctypes.addressof(write_size_p), + ctypes.addressof(write_file_offset_p), + ctypes.addressof(write_buf_ptr_offset_p), + ctypes.addressof(bytes_written_p), + int(stream), + ) + + # Synchronize stream to wait for write completion + cuda.cuStreamSynchronize(stream) + + # Verify bytes written + assert bytes_written_p.value == buf_size, f"Expected {buf_size} bytes written, got {bytes_written_p.value}" + + # Create parameter arrays for async read + read_size_p = ctypes.c_size_t(buf_size) + read_file_offset_p = ctypes.c_int64(0) + read_buf_ptr_offset_p = ctypes.c_int64(0) + bytes_read_p = ctypes.c_ssize_t(0) + + # Perform async read + cufile.read_async( + int(handle), + int(read_buf), + ctypes.addressof(read_size_p), + ctypes.addressof(read_file_offset_p), + ctypes.addressof(read_buf_ptr_offset_p), + ctypes.addressof(bytes_read_p), + int(stream), + ) + + # Synchronize stream to wait for read completion + cuda.cuStreamSynchronize(stream) + + # Verify bytes read + assert bytes_read_p.value == buf_size, f"Expected {buf_size} bytes read, got {bytes_read_p.value}" + + # Copy read data back to host and verify + host_buf = ctypes.create_string_buffer(buf_size) + cuda.cuMemcpyDtoHAsync(host_buf, read_buf, buf_size, 0) + cuda.cuStreamSynchronize(0) + read_data = host_buf.value + assert read_data == test_data, "Read data doesn't match written data" + + # Deregister stream + cufile.stream_deregister(int(stream)) + + # Deregister and cleanup + cufile.buf_deregister(int(write_buf)) + cufile.buf_deregister(int(read_buf)) + cufile.handle_deregister(handle) + cuda.cuStreamDestroy(stream) + cuda.cuMemFree(write_buf) + cuda.cuMemFree(read_buf) + + finally: + os.close(fd) + + +@pytest.mark.skipif(not isSupportedFilesystem(), reason="cuFile handle_register requires ext4 or xfs filesystem") +@pytest.mark.usefixtures("driver") +def test_batch_io_basic(tmpdir): + """Test basic batch IO operations with multiple read/write operations.""" + # Create test file + file_path = tmpdir / "test_batch_io.bin" + + # Allocate CUDA memory for multiple operations + buf_size = 65536 # 64KB + num_operations = 4 + + buffers = [] + read_buffers = [] # Initialize read_buffers to avoid UnboundLocalError + + for i in range(num_operations): + err, buf = cuda.cuMemAlloc(buf_size) + assert err == cuda.CUresult.CUDA_SUCCESS + buffers.append(buf) + + # Allocate host memory for data verification + host_buf = ctypes.create_string_buffer(buf_size) + + try: + # Create file with O_DIRECT + fd = os.open(file_path, os.O_CREAT | os.O_RDWR | os.O_DIRECT, 0o600) + + # Register buffers with cuFile + for buf in buffers: + buf_int = int(buf) + cufile.buf_register(buf_int, buf_size, 0) + + # Create file descriptor + descr = cufile.Descr() + descr.type = cufile.FileHandleType.OPAQUE_FD + descr.handle.fd = fd + descr.fs_ops = 0 + + # Register file handle + handle = cufile.handle_register(descr.ptr) + + # Set up batch IO + batch_handle = cufile.batch_io_set_up(num_operations) + + # Create IOParams array for batch operations + io_params = cufile.IOParams(num_operations) + io_events = cufile.IOEvents(num_operations) + + # Prepare test data for each operation + test_strings = [ + b"Batch operation 1 data for testing cuFile! ", + b"Batch operation 2 data for testing cuFile! ", + b"Batch operation 3 data for testing cuFile! ", + b"Batch operation 4 data for testing cuFile! ", + ] + + # Set up write operations + for i in range(num_operations): + # Prepare test data + test_string = test_strings[i] + test_string_len = len(test_string) + repetitions = buf_size // test_string_len + test_data = test_string * repetitions + test_data = test_data[:buf_size] # Ensure it fits exactly in buffer + host_buf = ctypes.create_string_buffer(test_data, buf_size) + + # Copy test data to CUDA buffer + cuda.cuMemcpyHtoDAsync(buffers[i], host_buf, buf_size, 0) + cuda.cuStreamSynchronize(0) + + # Set up IOParams for this operation + io_params[i].mode = cufile.BatchMode.BATCH # Batch mode + io_params[i].fh = handle + io_params[i].opcode = cufile.Opcode.WRITE # Write opcode + io_params[i].cookie = i # Use index as cookie for identification + io_params[i].u.batch.dev_ptr_base = int(buffers[i]) + io_params[i].u.batch.file_offset = i * buf_size # Sequential file offsets + io_params[i].u.batch.dev_ptr_offset = 0 + io_params[i].u.batch.size_ = buf_size + + # Submit batch write operations + cufile.batch_io_submit(batch_handle, num_operations, io_params.ptr, 0) + + # Get batch status + min_nr = num_operations # Wait for all operations to complete + nr_completed = ctypes.c_uint(num_operations) # Initialize to max operations posted + timeout = ctypes.c_int(5000) # 5 second timeout + + cufile.batch_io_get_status( + batch_handle, min_nr, ctypes.addressof(nr_completed), io_events.ptr, ctypes.addressof(timeout) + ) + + # Verify all operations completed successfully + assert nr_completed.value == num_operations, f"Expected {num_operations} operations, got {nr_completed.value}" + + # Collect all returned cookies + returned_cookies = set() + for i in range(num_operations): + assert io_events[i].status == cufile.Status.COMPLETE, ( + f"Operation {i} failed with status {io_events[i].status}" + ) + assert io_events[i].ret == buf_size, f"Expected {buf_size} bytes, got {io_events[i].ret} for operation {i}" + returned_cookies.add(io_events[i].cookie) + + # Verify all expected cookies are present + expected_cookies = set(range(num_operations)) # cookies 0, 1, 2, 3 + assert returned_cookies == expected_cookies, ( + f"Cookie mismatch. Expected {expected_cookies}, got {returned_cookies}" + ) + + # Now test batch read operations + read_buffers = [] + for i in range(num_operations): + err, buf = cuda.cuMemAlloc(buf_size) + assert err == cuda.CUresult.CUDA_SUCCESS + read_buffers.append(buf) + buf_int = int(buf) + cufile.buf_register(buf_int, buf_size, 0) + + # Create fresh io_events array for read operations + io_events_read = cufile.IOEvents(num_operations) + + # Set up read operations + for i in range(num_operations): + io_params[i].mode = cufile.BatchMode.BATCH # Batch mode + io_params[i].fh = handle + io_params[i].opcode = cufile.Opcode.READ # Read opcode + io_params[i].cookie = i + 100 # Different cookie for reads + io_params[i].u.batch.dev_ptr_base = int(read_buffers[i]) + io_params[i].u.batch.file_offset = i * buf_size + io_params[i].u.batch.dev_ptr_offset = 0 + io_params[i].u.batch.size_ = buf_size + + # Submit batch read operations + cufile.batch_io_submit(batch_handle, num_operations, io_params.ptr, 0) + + # Get batch status for reads + cufile.batch_io_get_status( + batch_handle, min_nr, ctypes.addressof(nr_completed), io_events_read.ptr, ctypes.addressof(timeout) + ) + + # Verify read operations completed successfully + assert nr_completed.value == num_operations, ( + f"Expected {num_operations} read operations, got {nr_completed.value}" + ) + + # Collect all returned cookies for read operations + returned_cookies_read = set() + for i in range(num_operations): + assert io_events_read[i].status == cufile.Status.COMPLETE, ( + f"Operation {i} failed with status {io_events_read[i].status}" + ) + assert io_events_read[i].ret == buf_size, ( + f"Expected {buf_size} bytes read, got {io_events_read[i].ret} for operation {i}" + ) + returned_cookies_read.add(io_events_read[i].cookie) + + # Verify all expected cookies are present + expected_cookies_read = set(range(100, 100 + num_operations)) # cookies 100, 101, 102, 103 + assert returned_cookies_read == expected_cookies_read, ( + f"Cookie mismatch. Expected {expected_cookies_read}, got {returned_cookies_read}" + ) + + # Verify the read data matches the written data + for i in range(num_operations): + # Copy read data back to host + cuda.cuMemcpyDtoHAsync(host_buf, read_buffers[i], buf_size, 0) + cuda.cuStreamSynchronize(0) + read_data = host_buf.value + + # Prepare expected data + test_string = test_strings[i] + test_string_len = len(test_string) + repetitions = buf_size // test_string_len + expected_data = (test_string * repetitions)[:buf_size] + + assert read_data == expected_data, f"Read data doesn't match written data for operation {i}" + + # Clean up batch IO + cufile.batch_io_destroy(batch_handle) + + # Deregister file handle + cufile.handle_deregister(handle) + + # Deregister buffers + for buf in buffers + read_buffers: + buf_int = int(buf) + cufile.buf_deregister(buf_int) + + finally: + # Close file + os.close(fd) + # Free CUDA memory + for buf in buffers + read_buffers: + cuda.cuMemFree(buf) + + +@pytest.mark.skipif(not isSupportedFilesystem(), reason="cuFile handle_register requires ext4 or xfs filesystem") +@pytest.mark.usefixtures("driver") +def test_batch_io_cancel(tmpdir): + """Test batch IO cancellation.""" + # Create test file + file_path = tmpdir / "test_batch_cancel.bin" + + # Allocate CUDA memory + buf_size = 4096 # 4KB, aligned to 4096 bytes + num_operations = 2 + + buffers = [] + for i in range(num_operations): + err, buf = cuda.cuMemAlloc(buf_size) + assert err == cuda.CUresult.CUDA_SUCCESS + buffers.append(buf) + + try: + # Create file with O_DIRECT + fd = os.open(file_path, os.O_CREAT | os.O_RDWR | os.O_DIRECT, 0o600) + + # Register buffers with cuFile + for buf in buffers: + buf_int = int(buf) + cufile.buf_register(buf_int, buf_size, 0) + + # Create file descriptor + descr = cufile.Descr() + descr.type = cufile.FileHandleType.OPAQUE_FD + descr.handle.fd = fd + descr.fs_ops = 0 + + # Register file handle + handle = cufile.handle_register(descr.ptr) + + # Set up batch IO + batch_handle = cufile.batch_io_set_up(num_operations) + + # Create IOParams array for batch operations + io_params = cufile.IOParams(num_operations) + + # Set up write operations + for i in range(num_operations): + io_params[i].mode = cufile.BatchMode.BATCH # Batch mode + io_params[i].fh = handle + io_params[i].opcode = cufile.Opcode.WRITE # Write opcode + io_params[i].cookie = i + io_params[i].u.batch.dev_ptr_base = int(buffers[i]) + io_params[i].u.batch.file_offset = i * buf_size + io_params[i].u.batch.dev_ptr_offset = 0 + io_params[i].u.batch.size_ = buf_size + + # Submit batch operations + cufile.batch_io_submit(batch_handle, num_operations, io_params.ptr, 0) + + # Cancel the batch operations + cufile.batch_io_cancel(batch_handle) + + # Clean up batch IO + cufile.batch_io_destroy(batch_handle) + + # Deregister file handle + cufile.handle_deregister(handle) + + # Deregister buffers + for buf in buffers: + buf_int = int(buf) + cufile.buf_deregister(buf_int) + + finally: + # Close file + os.close(fd) + # Free CUDA memory + for buf in buffers: + cuda.cuMemFree(buf) + + +@pytest.mark.skipif(not isSupportedFilesystem(), reason="cuFile handle_register requires ext4 or xfs filesystem") +@pytest.mark.usefixtures("driver") +def test_batch_io_large_operations(tmpdir): + """Test batch IO with large buffer operations.""" + # Create test file + file_path = tmpdir / "test_batch_large.bin" + + # Allocate large CUDA memory (1MB, aligned to 4096 bytes) + buf_size = 1024 * 1024 # 1MB, aligned to 4096 bytes + num_operations = 2 + + write_buffers = [] + read_buffers = [] + all_buffers = [] # Initialize all_buffers to avoid UnboundLocalError + + for i in range(num_operations): + err, buf = cuda.cuMemAlloc(buf_size) + assert err == cuda.CUresult.CUDA_SUCCESS + write_buffers.append(buf) + + err, buf = cuda.cuMemAlloc(buf_size) + assert err == cuda.CUresult.CUDA_SUCCESS + read_buffers.append(buf) + + # Allocate host memory for data verification + host_buf = ctypes.create_string_buffer(buf_size) + + try: + # Create file with O_DIRECT + fd = os.open(file_path, os.O_CREAT | os.O_RDWR | os.O_DIRECT, 0o600) + + # Register all buffers with cuFile + all_buffers = write_buffers + read_buffers + for buf in all_buffers: + buf_int = int(buf) + cufile.buf_register(buf_int, buf_size, 0) + + # Create file descriptor + descr = cufile.Descr() + descr.type = cufile.FileHandleType.OPAQUE_FD + descr.handle.fd = fd + descr.fs_ops = 0 + + # Register file handle + handle = cufile.handle_register(descr.ptr) + + # Set up batch IO + batch_handle = cufile.batch_io_set_up(num_operations) # Only for writes + + # Create IOParams array for batch operations + io_params = cufile.IOParams(num_operations) + io_events = cufile.IOEvents(num_operations) + + # Prepare test data + test_strings = [ + b"Large batch operation 1 data for testing cuFile with 1MB buffers! ", + b"Large batch operation 2 data for testing cuFile with 1MB buffers! ", + ] + + # Prepare write data + for i in range(num_operations): + test_string = test_strings[i] + test_string_len = len(test_string) + repetitions = buf_size // test_string_len + test_data = test_string * repetitions + test_data = test_data[:buf_size] + host_buf = ctypes.create_string_buffer(test_data, buf_size) + cuda.cuMemcpyHtoDAsync(write_buffers[i], host_buf, buf_size, 0) + cuda.cuStreamSynchronize(0) + + # Set up write operations + for i in range(num_operations): + io_params[i].mode = cufile.BatchMode.BATCH # Batch mode + io_params[i].fh = handle + io_params[i].opcode = cufile.Opcode.WRITE # Write opcode + io_params[i].cookie = i + io_params[i].u.batch.dev_ptr_base = int(write_buffers[i]) + io_params[i].u.batch.file_offset = i * buf_size + io_params[i].u.batch.dev_ptr_offset = 0 + io_params[i].u.batch.size_ = buf_size + + # Submit writes + cufile.batch_io_submit(batch_handle, num_operations, io_params.ptr, 0) + + # Wait for writes to complete + nr_completed_writes = ctypes.c_uint(num_operations) + timeout = ctypes.c_int(10000) + cufile.batch_io_get_status( + batch_handle, + num_operations, + ctypes.addressof(nr_completed_writes), + io_events.ptr, + ctypes.addressof(timeout), + ) + + # Clean up write batch + cufile.batch_io_destroy(batch_handle) + + # Now submit reads separately + read_batch_handle = cufile.batch_io_set_up(num_operations) + read_io_params = cufile.IOParams(num_operations) + read_io_events = cufile.IOEvents(num_operations) + + # Set up read operations + for i in range(num_operations): + read_io_params[i].mode = cufile.BatchMode.BATCH + read_io_params[i].fh = handle + read_io_params[i].opcode = cufile.Opcode.READ + read_io_params[i].cookie = i + 100 + read_io_params[i].u.batch.dev_ptr_base = int(read_buffers[i]) + read_io_params[i].u.batch.file_offset = i * buf_size + read_io_params[i].u.batch.dev_ptr_offset = 0 + read_io_params[i].u.batch.size_ = buf_size + + # Submit reads + cufile.batch_io_submit(read_batch_handle, num_operations, read_io_params.ptr, 0) + + # Wait for reads + nr_completed = ctypes.c_uint(num_operations) + cufile.batch_io_get_status( + read_batch_handle, + num_operations, + ctypes.addressof(nr_completed), + read_io_events.ptr, + ctypes.addressof(timeout), + ) + + # Verify all operations completed successfully + assert nr_completed.value == num_operations, f"Expected {num_operations} operations, got {nr_completed.value}" + + # Collect all returned cookies + returned_cookies = set() + for i in range(num_operations): + assert read_io_events[i].status == cufile.Status.COMPLETE, ( + f"Operation {i} failed with status {read_io_events[i].status}" + ) + returned_cookies.add(read_io_events[i].cookie) + + # Verify all expected cookies are present + expected_cookies = set(range(100, 100 + num_operations)) + assert returned_cookies == expected_cookies, ( + f"Cookie mismatch. Expected {expected_cookies}, got {returned_cookies}" + ) + + # Verify the read data matches the written data + for i in range(num_operations): + # Copy read data back to host + cuda.cuMemcpyDtoHAsync(host_buf, read_buffers[i], buf_size, 0) + cuda.cuStreamSynchronize(0) + read_data = host_buf.value + + # Prepare expected data + test_string = test_strings[i] + test_string_len = len(test_string) + repetitions = buf_size // test_string_len + expected_data = (test_string * repetitions)[:buf_size] + + if read_data != expected_data: + n = 100 # Show first n bytes + raise RuntimeError( + f"Read data doesn't match written data for operation {i}: " + f"{len(read_data)=}, {len(expected_data)=}, " + f"first {n} bytes: read {read_data[:n]!r}, " + f"expected {expected_data[:n]!r}" + ) + + # Clean up batch IO + cufile.batch_io_destroy(read_batch_handle) + + # Deregister file handle + cufile.handle_deregister(handle) + + # Deregister buffers + for buf in all_buffers: + buf_int = int(buf) + cufile.buf_deregister(buf_int) + + finally: + # Close file + os.close(fd) + # Free CUDA memory + for buf in all_buffers: + cuda.cuMemFree(buf) + + +@pytest.mark.skipif( + cufileVersionLessThan(1140), reason="cuFile parameter APIs require cuFile library version 1.14.0 or later" +) +@pytest.mark.usefixtures("ctx", "cufile_env_json") +def test_set_get_parameter_size_t(): + """Test setting and getting size_t parameters with cuFile validation.""" + param_val_pairs = ( + (cufile.SizeTConfigParameter.POLLTHRESHOLD_SIZE_KB, 64), # 64KB threshold + (cufile.SizeTConfigParameter.PROPERTIES_MAX_DIRECT_IO_SIZE_KB, 1024), # 1MB max direct IO size + (cufile.SizeTConfigParameter.PROPERTIES_MAX_DEVICE_CACHE_SIZE_KB, 512), # 512KB max cache size + (cufile.SizeTConfigParameter.PROPERTIES_PER_BUFFER_CACHE_SIZE_KB, 128), # 128KB per buffer cache + (cufile.SizeTConfigParameter.PROPERTIES_MAX_DEVICE_PINNED_MEM_SIZE_KB, 2048), # 2MB max pinned memory + (cufile.SizeTConfigParameter.PROPERTIES_IO_BATCHSIZE, 16), # 16 operations per batch + (cufile.SizeTConfigParameter.PROPERTIES_BATCH_IO_TIMEOUT_MS, 5000), # 5 second timeout + (cufile.SizeTConfigParameter.EXECUTION_MAX_IO_QUEUE_DEPTH, 32), # Max 32 operations in queue + (cufile.SizeTConfigParameter.EXECUTION_MAX_IO_THREADS, 8), # Max 8 IO threads + (cufile.SizeTConfigParameter.EXECUTION_MIN_IO_THRESHOLD_SIZE_KB, 4), # 4KB minimum IO threshold + (cufile.SizeTConfigParameter.EXECUTION_MAX_REQUEST_PARALLELISM, 4), # Max 4 parallel requests + ) + + # Snapshot baselines after driver_open so getters reflect merged config (defaults + JSON), + # not pre-open pending state that could restore invalid values (e.g. 0 for per-buffer cache). + with _cufile_driver_session(): + originals = {param: cufile.get_parameter_size_t(param) for param, _ in param_val_pairs} + + def test_param(param, val): + orig_val = originals[param] + cufile.set_parameter_size_t(param, val) + retrieved_val = cufile.get_parameter_size_t(param) + assert retrieved_val == val + cufile.set_parameter_size_t(param, orig_val) + + # Test setting and getting various size_t parameters + for param, val in param_val_pairs: + test_param(param, val) + + +@pytest.mark.skipif( + cufileVersionLessThan(1140), reason="cuFile parameter APIs require cuFile library version 1.14.0 or later" +) +@pytest.mark.usefixtures("ctx", "cufile_env_json") +def test_set_get_parameter_bool(): + """Test setting and getting boolean parameters with cuFile validation.""" + # Load the compat-enabled test config before the first driver_open so the compat + # bool params can still be round-tripped on systems without nvidia-fs. + param_val_pairs = ( + (cufile.BoolConfigParameter.PROPERTIES_USE_POLL_MODE, True), + (cufile.BoolConfigParameter.PROPERTIES_ALLOW_COMPAT_MODE, False), + (cufile.BoolConfigParameter.FORCE_COMPAT_MODE, False), + (cufile.BoolConfigParameter.FS_MISC_API_CHECK_AGGRESSIVE, True), + (cufile.BoolConfigParameter.EXECUTION_PARALLEL_IO, True), + (cufile.BoolConfigParameter.PROFILE_NVTX, False), + (cufile.BoolConfigParameter.PROPERTIES_ALLOW_SYSTEM_MEMORY, True), + (cufile.BoolConfigParameter.USE_PCIP2PDMA, True), + (cufile.BoolConfigParameter.PREFER_IO_URING, False), + (cufile.BoolConfigParameter.FORCE_ODIRECT_MODE, True), + (cufile.BoolConfigParameter.SKIP_TOPOLOGY_DETECTION, False), + (cufile.BoolConfigParameter.STREAM_MEMOPS_BYPASS, True), + ) + # PROFILE_NVTX is deprecated (CTK 13.1.0+); cuFile >= 1.16 rejects bool getters for it. + if cufile.get_version() >= 1160: + param_val_pairs = tuple((p, v) for p, v in param_val_pairs if p is not cufile.BoolConfigParameter.PROFILE_NVTX) + + with _cufile_driver_session(): + originals = {param: cufile.get_parameter_bool(param) for param, _ in param_val_pairs} + + def test_param(param, val): + orig_val = originals[param] + cufile.set_parameter_bool(param, val) + retrieved_val = cufile.get_parameter_bool(param) + assert retrieved_val is val + cufile.set_parameter_bool(param, orig_val) + + # Test setting and getting various boolean parameters + for param, val in param_val_pairs: + test_param(param, val) + + +@pytest.mark.skipif( + cufileVersionLessThan(1140), reason="cuFile parameter APIs require cuFile library version 1.14.0 or later" +) +@pytest.mark.usefixtures("ctx", "cufile_env_json") +def test_set_get_parameter_string(tmp_path): + """Test setting and getting string parameters with cuFile validation.""" + temp_dir = tempfile.gettempdir() + # must be set to avoid getter error when testing ENV_LOGFILE_PATH... + os.environ["CUFILE_LOGFILE_PATH"] = "" + + param_val_pairs = ( + (cufile.StringConfigParameter.LOGGING_LEVEL, "INFO", "DEBUG"), # Test logging level + ( + cufile.StringConfigParameter.ENV_LOGFILE_PATH, + os.path.join(temp_dir, "cufile.log"), + str(tmp_path / "cufile.log"), + ), # Test environment log file path + ( + cufile.StringConfigParameter.LOG_DIR, + os.path.join(temp_dir, "cufile_logs"), + str(tmp_path), + ), # Test log directory + ) + + with _cufile_driver_session(): + originals = {param: cufile.get_parameter_string(param, 256) for param, _, _ in param_val_pairs} + + def test_param(param, val, default_val): + orig_val = originals[param] + + val_b = val.encode("utf-8") + val_buf = ctypes.create_string_buffer(val_b) + default_val_b = default_val.encode("utf-8") + defualt_val_buf = ctypes.create_string_buffer(default_val_b) + orig_val_b = orig_val.encode("utf-8") + orig_val_buf = ctypes.create_string_buffer(orig_val_b) + + # Round-trip test + cufile.set_parameter_string(param, int(ctypes.addressof(val_buf))) + retrieved_val = cufile.get_parameter_string(param, 256) + assert retrieved_val == val + + # Restore + try: + # Currently this line will raise, see below. + cufile.set_parameter_string(param, int(ctypes.addressof(orig_val_buf))) + except cufile.cuFileError: + # This block will always be reached because cuFILE could start with garbage default (empty string) + # that cannot be restored. In other words, cuFILE does honor the common sense that getter/setter + # should be round-tripable. + cufile.set_parameter_string(param, int(ctypes.addressof(defualt_val_buf))) + + try: + # Test setting and getting various string parameters + # Note: String parameter tests may have issues with the current implementation + for param, val, default_val in param_val_pairs: + test_param(param, val, default_val) + finally: + del os.environ["CUFILE_LOGFILE_PATH"] + + +@pytest.fixture +def stats(driver): + old_level = cufile.get_stats_level() + yield + # Reset cuFile statistics to clear all counters + cufile.stats_reset() + cufile.set_stats_level(old_level) + + +@pytest.mark.skipif( + cufileVersionLessThan(1150), reason="cuFile parameter APIs require cuFile library version 13.0 or later" +) +@pytest.mark.usefixtures("stats") +def test_set_stats_level(): + """Test cuFile statistics level configuration.""" + # Test setting different statistics levels + valid_levels = [0, 1, 2, 3] # 0=disabled, 1=basic, 2=detailed, 3=verbose + + for level in valid_levels: + cufile.set_stats_level(level) + + # Verify the level was set correctly + current_level = cufile.get_stats_level() + assert current_level == level, f"Expected stats level {level}, but got {current_level}" + + logging.info(f"Successfully set and verified stats level {level}") + + # Test invalid level (should raise an error) + try: + assert cufile.set_stats_level(-1) # Invalid negative level + except Exception as e: + logging.info(f"Correctly caught error for invalid stats level: {e}") + + try: + assert cufile.set_stats_level(4) # Invalid level > 3 + except Exception as e: + logging.info(f"Correctly caught error for invalid stats level: {e}") + + +@pytest.mark.skipif( + cufileVersionLessThan(1150), reason="cuFile parameter APIs require cuFile library version 13.0 or later" +) +@pytest.mark.usefixtures("driver") +def test_get_parameter_min_max_value(): + """Test getting minimum and maximum values for size_t parameters.""" + # Test with poll threshold parameter + param = cufile.SizeTConfigParameter.POLLTHRESHOLD_SIZE_KB + + # Get min/max values + min_value, max_value = cufile.get_parameter_min_max_value(param) + + # Verify that min <= max and both are reasonable values + assert min_value >= 0, f"Invalid min value: {min_value}" + assert max_value >= min_value, f"Max value {max_value} < min value {min_value}" + assert max_value > 0, f"Invalid max value: {max_value}" + + logging.info(f"POLLTHRESHOLD_SIZE_KB: min={min_value}, max={max_value}") + + +@pytest.mark.skipif( + cufileVersionLessThan(1150), reason="cuFile parameter APIs require cuFile library version 13.0 or later" +) +@pytest.mark.usefixtures("stats") +@pytest.mark.thread_unsafe(reason="not safe to stats_start() from multiple threads") +def test_stats_start_stop(): + """Test cuFile statistics collection stop.""" + # Set statistics level first (required before starting stats) + cufile.set_stats_level(1) # Level 1 = basic statistics + # Start collecting cuFile statistics first + cufile.stats_start() + + # Stop collecting cuFile statistics + cufile.stats_stop() + + +@pytest.mark.skipif( + cufileVersionLessThan(1150), reason="cuFile parameter APIs require cuFile library version 13.0 or later" +) +@pytest.mark.skipif(not isSupportedFilesystem(), reason="cuFile handle_register requires ext4 or xfs filesystem") +@pytest.mark.usefixtures("stats") +@pytest.mark.thread_unsafe(reason="cuFile stats counters and collection state are process-global") +def test_get_stats_l1(tmpdir): + """Test cuFile L1 statistics retrieval with file operations.""" + # Create test file directly with O_DIRECT + file_path = tmpdir / "test_stats_l1.bin" + fd = os.open(file_path, os.O_CREAT | os.O_RDWR | os.O_DIRECT, 0o600) + + try: + cufile.set_stats_level(1) # L1 = basic operation counts + # Start collecting cuFile statistics + cufile.stats_start() + + # Create and initialize the descriptor + descr = cufile.Descr() + descr.type = cufile.FileHandleType.OPAQUE_FD + descr.handle.fd = fd + descr.fs_ops = 0 + + # Register the handle + handle = cufile.handle_register(descr.ptr) + + # Allocate CUDA memory + buffer_size = 4096 # 4KB, aligned to 4096 bytes + err, buf_ptr = cuda.cuMemAlloc(buffer_size) + assert err == cuda.CUresult.CUDA_SUCCESS + + # Register the buffer with cuFile + buf_ptr_int = int(buf_ptr) + cufile.buf_register(buf_ptr_int, buffer_size, 0) + + # Prepare test data and copy to GPU buffer + test_data = b"cuFile L1 stats test data" * 100 # Fill buffer + test_data = test_data[:buffer_size] + host_buf = ctypes.create_string_buffer(test_data, buffer_size) + cuda.cuMemcpyHtoD(buf_ptr, host_buf, len(test_data)) + + # Perform cuFile operations to generate L1 statistics + cufile.write(handle, buf_ptr_int, buffer_size, 0, 0) + cufile.read(handle, buf_ptr_int, buffer_size, 0, 0) + + # Use the exposed StatsLevel1 class from cufile module + stats = cufile.StatsLevel1() + + # Get L1 statistics (basic operation counts) + cufile.get_stats_l1(stats.ptr) + + # Verify actual field values using OpCounter class for cleaner access + read_ops = cufile.OpCounter.from_data(stats.read_ops) + write_ops = cufile.OpCounter.from_data(stats.write_ops) + read_bytes = int(stats.read_bytes) + write_bytes = int(stats.write_bytes) + + assert read_ops.ok > 0, f"Expected read operations, got {read_ops.ok}" + assert write_ops.ok > 0, f"Expected write operations, got {write_ops.ok}" + assert read_bytes > 0, f"Expected read bytes, got {read_bytes}" + assert write_bytes > 0, f"Expected write bytes, got {write_bytes}" + + logging.info( + f"Stats: reads={read_ops.ok}, writes={write_ops.ok}, read_bytes={read_bytes}, write_bytes={write_bytes}" + ) + + # Stop statistics collection + cufile.stats_stop() + + # Clean up cuFile resources + cufile.buf_deregister(buf_ptr_int) + cufile.handle_deregister(handle) + cuda.cuMemFree(buf_ptr) + + finally: + os.close(fd) + + +@pytest.mark.skipif( + cufileVersionLessThan(1150), reason="cuFile parameter APIs require cuFile library version 13.0 or later" +) +@pytest.mark.skipif(not isSupportedFilesystem(), reason="cuFile handle_register requires ext4 or xfs filesystem") +@pytest.mark.usefixtures("stats") +@pytest.mark.thread_unsafe(reason="cuFile stats counters and collection state are process-global") +def test_get_stats_l2(tmpdir): + """Test cuFile L2 statistics retrieval with file operations.""" + # Create test file directly with O_DIRECT + file_path = tmpdir / "test_stats_l2.bin" + fd = os.open(file_path, os.O_CREAT | os.O_RDWR | os.O_DIRECT, 0o600) + + try: + cufile.set_stats_level(2) # L2 = detailed performance metrics + + # Start collecting cuFile statistics + cufile.stats_start() + + # Create and initialize the descriptor + descr = cufile.Descr() + descr.type = cufile.FileHandleType.OPAQUE_FD + descr.handle.fd = fd + descr.fs_ops = 0 + + # Register the handle + handle = cufile.handle_register(descr.ptr) + + # Allocate CUDA memory + buffer_size = 8192 # 8KB for more detailed stats + err, buf_ptr = cuda.cuMemAlloc(buffer_size) + assert err == cuda.CUresult.CUDA_SUCCESS + + # Register the buffer with cuFile + buf_ptr_int = int(buf_ptr) + cufile.buf_register(buf_ptr_int, buffer_size, 0) + + # Prepare test data and copy to GPU buffer + test_data = b"cuFile L2 detailed stats test data" * 150 # Fill buffer + test_data = test_data[:buffer_size] + host_buf = ctypes.create_string_buffer(test_data, buffer_size) + cuda.cuMemcpyHtoD(buf_ptr, host_buf, len(test_data)) + + # Perform multiple cuFile operations to generate detailed L2 statistics + cufile.write(handle, buf_ptr_int, buffer_size, 0, 0) + cufile.read(handle, buf_ptr_int, buffer_size, 0, 0) + cufile.write(handle, buf_ptr_int, buffer_size, buffer_size, 0) # Different offset + cufile.read(handle, buf_ptr_int, buffer_size, buffer_size, 0) + + # Use the exposed StatsLevel2 class from cufile module + stats = cufile.StatsLevel2() + + # Get L2 statistics (detailed performance metrics) + cufile.get_stats_l2(stats.ptr) + + # Verify L2 histogram fields contain data + # Access numpy array fields: histograms are numpy arrays + read_hist_total = int(stats.read_size_kb_hist.sum()) + write_hist_total = int(stats.write_size_kb_hist.sum()) + assert read_hist_total > 0 or write_hist_total > 0, "Expected L2 histogram data" + + # L2 also contains L1 basic stats - verify using OpCounter class + basic_stats = cufile.StatsLevel1.from_data(stats.basic) + read_ops = cufile.OpCounter.from_data(basic_stats.read_ops) + write_ops = cufile.OpCounter.from_data(basic_stats.write_ops) + + logging.info( + f"L2 Stats: read_hist_total={read_hist_total}, write_hist_total={write_hist_total}, " + f"basic_reads={read_ops.ok}, basic_writes={write_ops.ok}" + ) + + # Stop statistics collection + cufile.stats_stop() + + # Clean up cuFile resources + cufile.buf_deregister(buf_ptr_int) + cufile.handle_deregister(handle) + cuda.cuMemFree(buf_ptr) + + finally: + os.close(fd) + + +@pytest.mark.skipif( + cufileVersionLessThan(1150), reason="cuFile parameter APIs require cuFile library version 13.0 or later" +) +@pytest.mark.skipif(not isSupportedFilesystem(), reason="cuFile handle_register requires ext4 or xfs filesystem") +@pytest.mark.usefixtures("stats") +@pytest.mark.thread_unsafe(reason="cuFile stats counters and collection state are process-global") +def test_get_stats_l3(tmpdir): + """Test cuFile L3 statistics retrieval with file operations.""" + # Create test file directly with O_DIRECT + file_path = tmpdir / "test_stats_l3.bin" + fd = os.open(file_path, os.O_CREAT | os.O_RDWR | os.O_DIRECT, 0o600) + + try: + cufile.set_stats_level(3) # L3 = comprehensive diagnostic data + + # Start collecting cuFile statistics + cufile.stats_start() + + # Create and initialize the descriptor + descr = cufile.Descr() + descr.type = cufile.FileHandleType.OPAQUE_FD + descr.handle.fd = fd + descr.fs_ops = 0 + + # Register the handle + handle = cufile.handle_register(descr.ptr) + + # Allocate CUDA memory + buffer_size = 16384 # 16KB for comprehensive stats testing + err, buf_ptr = cuda.cuMemAlloc(buffer_size) + assert err == cuda.CUresult.CUDA_SUCCESS + + # Register the buffer with cuFile + buf_ptr_int = int(buf_ptr) + cufile.buf_register(buf_ptr_int, buffer_size, 0) + + # Prepare test data and copy to GPU buffer + test_data = b"cuFile L3 comprehensive stats test data" * 200 # Fill buffer + test_data = test_data[:buffer_size] + host_buf = ctypes.create_string_buffer(test_data, buffer_size) + cuda.cuMemcpyHtoD(buf_ptr, host_buf, len(test_data)) + + # Perform comprehensive cuFile operations to generate L3 statistics + # Multiple writes and reads at different offsets to generate rich stats + cufile.write(handle, buf_ptr_int, buffer_size, 0, 0) + cufile.read(handle, buf_ptr_int, buffer_size, 0, 0) + cufile.write(handle, buf_ptr_int, buffer_size, buffer_size, 0) # Different offset + cufile.read(handle, buf_ptr_int, buffer_size, buffer_size, 0) + cufile.write(handle, buf_ptr_int, buffer_size // 2, buffer_size * 2, 0) # Partial write + cufile.read(handle, buf_ptr_int, buffer_size // 2, buffer_size * 2, 0) # Partial read + + # Use the exposed StatsLevel3 class from cufile module + stats = cufile.StatsLevel3() + + # Get L3 statistics (comprehensive diagnostic data) + cufile.get_stats_l3(stats.ptr) + + # Verify L3-specific fields + num_gpus = int(stats.num_gpus) + assert num_gpus >= 0, f"Expected valid GPU count, got {num_gpus}" + + # Check if we have at least one GPU with stats using PerGpuStats class + gpu_with_data = False + for i in range(min(num_gpus, 16)): + # Access per-GPU stats using PerGpuStats class + # stats.per_gpu_stats has shape (1, 16), we need to get [0] first to get the (16,) array + # then slice [i:i+1] to get a 1-d array view (required by from_data) + gpu_stats = stats.per_gpu_stats[i] # Get the (16,) array + if gpu_stats.n_total_reads > 0 or gpu_stats.read_bytes > 0: + gpu_with_data = True + break + + # L3 also contains L2 detailed stats (which includes L1 basic stats) + detailed_stats = cufile.StatsLevel2.from_data(stats.detailed) + read_hist_total = int(detailed_stats.read_size_kb_hist.sum()) + + logging.info( + f"L3 Stats: num_gpus={num_gpus}, gpu_with_data={gpu_with_data}, detailed_read_hist={read_hist_total}" + ) + + # Stop statistics collection + cufile.stats_stop() + + # Clean up cuFile resources + cufile.buf_deregister(buf_ptr_int) + cufile.handle_deregister(handle) + cuda.cuMemFree(buf_ptr) + + finally: + os.close(fd) + + +@pytest.mark.skipif( + cufileVersionLessThan(1150), reason="cuFile parameter APIs require cuFile library version 13.0 or later" +) +@pytest.mark.usefixtures("driver") +def test_get_bar_size_in_kb(): + """Test cuFile BAR (Base Address Register) size retrieval.""" + # Get BAR size in kilobytes + try: + bar_size_kb = cufile.get_bar_size_in_kb(0) + except cufile.cuFileError as e: + if get_tegra_kind() != "Thor": + raise + pytest.xfail(f"TODO(#9999): Resolve Thor: cuFileError: {e!s}") + + # Verify BAR size is a reasonable value + assert isinstance(bar_size_kb, int), "BAR size should be an integer" + # Tegra devices may report 0 BAR size, which is acceptable + min_bar_size = 0 if get_tegra_kind() else 1 + assert bar_size_kb >= min_bar_size, f"BAR size should be >= {min_bar_size}" + + logging.info(f"GPU BAR size: {bar_size_kb} KB ({bar_size_kb / 1024 / 1024:.2f} GB)") + + +@pytest.fixture(scope="module") +def slab_sizes(): + """Define slab sizes for POSIX I/O pool (common I/O buffer sizes) - BEFORE driver open""" + return [ + 4096, # 4KB - small files + 65536, # 64KB - medium files + 1048576, # 1MB - large files + 16777216, # 16MB - very large files + ] + + +@pytest.fixture(scope="module") +def slab_counts(): + """Define counts for each slab size (number of buffers)""" + return [ + 10, # 10 buffers of 4KB + 5, # 5 buffers of 64KB + 3, # 3 buffers of 1MB + 2, # 2 buffers of 16MB + ] + + +@pytest.fixture +def driver_config(slab_sizes, slab_counts): + # Convert to ctypes arrays + size_array_type = ctypes.c_size_t * len(slab_sizes) + count_array_type = ctypes.c_size_t * len(slab_counts) + size_array = size_array_type(*slab_sizes) + count_array = count_array_type(*slab_counts) + + # Set POSIX pool slab array configuration BEFORE opening driver + cufile.set_parameter_posix_pool_slab_array( + ctypes.addressof(size_array), ctypes.addressof(count_array), len(slab_sizes) + ) + + +@pytest.mark.skipif( + cufileVersionLessThan(1150), reason="cuFile parameter APIs require cuFile library version 13.0 or later" +) +def test_set_parameter_posix_pool_slab_array(slab_sizes, slab_counts, driver_config, driver): + """Test cuFile POSIX pool slab array configuration.""" + # After setting parameters, retrieve them back to verify + n_slab_sizes = len(slab_sizes) + retrieved_sizes = (ctypes.c_size_t * n_slab_sizes)() + retrieved_counts = (ctypes.c_size_t * len(slab_counts))() + + retrieved_sizes_addr = ctypes.addressof(retrieved_sizes) + retrieved_counts_addr = ctypes.addressof(retrieved_counts) + + # Open cuFile driver AFTER setting parameters + with _cufile_driver_session(): + cufile.get_parameter_posix_pool_slab_array(retrieved_sizes_addr, retrieved_counts_addr, n_slab_sizes) + + # Verify they match what we set + assert list(retrieved_sizes) == slab_sizes + assert list(retrieved_counts) == slab_counts diff --git a/cuda_bindings/tests/test_examples.py b/cuda_bindings/tests/test_examples.py new file mode 100644 index 00000000000..63a56c78fb7 --- /dev/null +++ b/cuda_bindings/tests/test_examples.py @@ -0,0 +1,33 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +import glob +import os +import subprocess +import sys + +import pytest + +from cuda.bindings._test_helpers.pep723 import has_package_requirements_or_skip + +examples_path = os.path.join(os.path.dirname(__file__), "..", "examples") +examples_files = glob.glob(os.path.join(examples_path, "**/*.py"), recursive=True) + + +@pytest.mark.parametrize("example", examples_files) +def test_example(example): + has_package_requirements_or_skip(example) + + env = os.environ.copy() + env["CUDA_BINDINGS_SKIP_EXAMPLE"] = "100" + + process = subprocess.run([sys.executable, example], capture_output=True, env=env) # noqa: S603 + # returncode is a special value used in the examples to indicate that system requirements are not met. + if process.returncode == 100: + pytest.skip(process.stderr.decode(errors="replace").strip()) + elif process.returncode != 0: + if process.stdout: + print(process.stdout.decode(errors="replace")) + if process.stderr: + print(process.stderr.decode(errors="replace"), file=sys.stderr) + raise AssertionError(f"`{example}` failed ({process.returncode})") diff --git a/cuda_bindings/tests/test_graphics_apis.py b/cuda_bindings/tests/test_graphics_apis.py new file mode 100644 index 00000000000..8b74d8d2a1d --- /dev/null +++ b/cuda_bindings/tests/test_graphics_apis.py @@ -0,0 +1,117 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +import contextlib +import ctypes +import ctypes.util +import os +import sys + +import pytest + +from cuda.bindings import runtime as cudart + + +@contextlib.contextmanager +def _gl_context(): + """ + Yield a (tex_id, tex_target) with a current GL context. + Tries: + 1) Windows: hidden WGL window (no EGL) + 2) Linux with DISPLAY/wayland: hidden window + 3) Linux headless: EGL headless if available + Skips if none work. + """ + pyglet = pytest.importorskip("pyglet") + + # Prefer non-headless when a display is available; it's more portable and avoids EGL. + if sys.platform.startswith("linux") and not (os.environ.get("DISPLAY") or os.environ.get("WAYLAND_DISPLAY")): + if ctypes.util.find_library("EGL") is None: + pytest.skip("No DISPLAY and no EGL runtime available for headless context.") + pyglet.options["headless"] = True + + # Create a minimal offscreen/hidden context + win = None + try: + if not pyglet.options.get("headless"): + # Hidden window path (WGL on Windows, GLX/WLS on Linux) + from pyglet import gl + + config = gl.Config(double_buffer=False) + win = pyglet.window.Window(visible=False, config=config) + win.switch_to() + else: + # Headless EGL path; pyglet will arrange a pbuffer-like headless context + from pyglet.gl import headless # noqa: F401 + + # Make a tiny texture so we have a real GL object to register + from pyglet.gl import gl as _gl + + tex_id = _gl.GLuint(0) + _gl.glGenTextures(1, ctypes.byref(tex_id)) + target = _gl.GL_TEXTURE_2D + _gl.glBindTexture(target, tex_id.value) + _gl.glTexParameteri(target, _gl.GL_TEXTURE_MIN_FILTER, _gl.GL_NEAREST) + _gl.glTexParameteri(target, _gl.GL_TEXTURE_MAG_FILTER, _gl.GL_NEAREST) + width, height = 16, 16 + _gl.glTexImage2D(target, 0, _gl.GL_RGBA8, width, height, 0, _gl.GL_RGBA, _gl.GL_UNSIGNED_BYTE, None) + + yield int(tex_id.value), int(target) + + except Exception as e: + # Convert any pyglet/GL creation failure into a clean skip + pytest.skip(f"Could not create GL context/texture: {type(e).__name__}: {e}") + finally: + # Best-effort cleanup + try: + from pyglet.gl import gl as _gl + + if tex_id.value: + _gl.glDeleteTextures(1, ctypes.byref(tex_id)) + except Exception: # noqa: S110 + pass + try: + if win is not None: + win.close() + except Exception: # noqa: S110 + pass + + +@pytest.mark.parametrize( + "flags", + [ + cudart.cudaGraphicsRegisterFlags.cudaGraphicsRegisterFlagsNone, + cudart.cudaGraphicsRegisterFlags.cudaGraphicsRegisterFlagsWriteDiscard, + ], +) +def test_cuda_gl_register_image_smoketest(flags): + with _gl_context() as (tex_id, tex_target): + # Register + err, resource = cudart.cudaGraphicsGLRegisterImage(tex_id, tex_target, flags) + name = cudart.cudaGetErrorName(err)[1].decode() + + # Map error expectations by environment: + # - success: we actually exercised the API + # - operating-system: typical when the driver/runtime refuses interop (e.g., no GPU/driver in CI container) + acceptable = {"cudaSuccess", "cudaErrorOperatingSystem"} + + assert name in acceptable, f"cudaGraphicsGLRegisterImage returned {name}" + if name == "cudaSuccess": + assert int(resource) != 0 + # Unregister to be tidy + cudart.cudaGraphicsUnregisterResource(resource) + + +def test_cuda_register_image_invalid(): + """Exercise cudaGraphicsGLRegisterImage with dummy handle only using CUDA runtime API.""" + fake_gl_texture_id = 1 + fake_gl_target = 0x0DE1 + flags = cudart.cudaGraphicsRegisterFlags.cudaGraphicsRegisterFlagsWriteDiscard + + err, resource = cudart.cudaGraphicsGLRegisterImage(fake_gl_texture_id, fake_gl_target, flags) + err_name = cudart.cudaGetErrorName(err)[1].decode() + err_str = cudart.cudaGetErrorString(err)[1].decode() + + if err == 0: + cudart.cudaGraphicsUnregisterResource(resource) + raise AssertionError("Expected error from invalid GL texture ID") diff --git a/cuda_bindings/tests/test_interoperability.py b/cuda_bindings/tests/test_interoperability.py new file mode 100644 index 00000000000..18a37ec6b4e --- /dev/null +++ b/cuda_bindings/tests/test_interoperability.py @@ -0,0 +1,150 @@ +# SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +import numpy as np +import pytest + +import cuda.bindings.driver as cuda +import cuda.bindings.runtime as cudart +from cuda.bindings._test_helpers.mempool import xfail_if_mempool_oom + + +def supportsMemoryPool(): + err, isSupported = cudart.cudaDeviceGetAttribute(cudart.cudaDeviceAttr.cudaDevAttrMemoryPoolsSupported, 0) + return err == cudart.cudaError_t.cudaSuccess and isSupported + + +def test_interop_stream(): + # DRV to RT + err_dr, stream = cuda.cuStreamCreate(0) + assert err_dr == cuda.CUresult.CUDA_SUCCESS + (err_rt,) = cudart.cudaStreamDestroy(stream) + assert err_rt == cudart.cudaError_t.cudaSuccess + + # RT to DRV + err_rt, stream = cudart.cudaStreamCreate() + assert err_rt == cudart.cudaError_t.cudaSuccess + (err_dr,) = cuda.cuStreamDestroy(stream) + assert err_dr == cuda.CUresult.CUDA_SUCCESS + + +def test_interop_event(): + # DRV to RT + err_dr, event = cuda.cuEventCreate(0) + assert err_dr == cuda.CUresult.CUDA_SUCCESS + (err_rt,) = cudart.cudaEventDestroy(event) + assert err_rt == cudart.cudaError_t.cudaSuccess + + # RT to DRV + err_rt, event = cudart.cudaEventCreate() + assert err_rt == cudart.cudaError_t.cudaSuccess + (err_dr,) = cuda.cuEventDestroy(event) + assert err_dr == cuda.CUresult.CUDA_SUCCESS + + +def test_interop_graph(): + # DRV to RT + err_dr, graph = cuda.cuGraphCreate(0) + assert err_dr == cuda.CUresult.CUDA_SUCCESS + (err_rt,) = cudart.cudaGraphDestroy(graph) + assert err_rt == cudart.cudaError_t.cudaSuccess + + # RT to DRV + err_rt, graph = cudart.cudaGraphCreate(0) + assert err_rt == cudart.cudaError_t.cudaSuccess + (err_dr,) = cuda.cuGraphDestroy(graph) + assert err_dr == cuda.CUresult.CUDA_SUCCESS + + +def test_interop_graphNode(): + err_dr, graph = cuda.cuGraphCreate(0) + assert err_dr == cuda.CUresult.CUDA_SUCCESS + + # DRV to RT + err_dr, node = cuda.cuGraphAddEmptyNode(graph, [], 0) + assert err_dr == cuda.CUresult.CUDA_SUCCESS + (err_rt,) = cudart.cudaGraphDestroyNode(node) + assert err_rt == cudart.cudaError_t.cudaSuccess + + # RT to DRV + err_rt, node = cudart.cudaGraphAddEmptyNode(graph, [], 0) + assert err_rt == cudart.cudaError_t.cudaSuccess + (err_dr,) = cuda.cuGraphDestroyNode(node) + assert err_dr == cuda.CUresult.CUDA_SUCCESS + + (err_rt,) = cudart.cudaGraphDestroy(graph) + assert err_rt == cudart.cudaError_t.cudaSuccess + + +# cudaUserObject_t +# TODO + + +# cudaFunction_t +# TODO + + +@pytest.mark.skipif(not supportsMemoryPool(), reason="Requires mempool operations") +def test_interop_memPool(): + # DRV to RT + err_dr, pool = cuda.cuDeviceGetDefaultMemPool(0) + xfail_if_mempool_oom(err_dr, "cuDeviceGetDefaultMemPool", 0) + assert err_dr == cuda.CUresult.CUDA_SUCCESS + (err_rt,) = cudart.cudaDeviceSetMemPool(0, pool) + assert err_rt == cudart.cudaError_t.cudaSuccess + + # RT to DRV + err_rt, pool = cudart.cudaDeviceGetDefaultMemPool(0) + xfail_if_mempool_oom(err_rt, "cudaDeviceGetDefaultMemPool", 0) + assert err_rt == cudart.cudaError_t.cudaSuccess + (err_dr,) = cuda.cuDeviceSetMemPool(0, pool) + assert err_dr == cuda.CUresult.CUDA_SUCCESS + + +def test_interop_graphExec(): + err_dr, graph = cuda.cuGraphCreate(0) + assert err_dr == cuda.CUresult.CUDA_SUCCESS + err_dr, node = cuda.cuGraphAddEmptyNode(graph, [], 0) + assert err_dr == cuda.CUresult.CUDA_SUCCESS + + # DRV to RT + err_dr, graphExec = cuda.cuGraphInstantiate(graph, 0) + assert err_dr == cuda.CUresult.CUDA_SUCCESS + (err_rt,) = cudart.cudaGraphExecDestroy(graphExec) + assert err_rt == cudart.cudaError_t.cudaSuccess + + # RT to DRV + err_rt, graphExec = cudart.cudaGraphInstantiate(graph, 0) + assert err_rt == cudart.cudaError_t.cudaSuccess + (err_dr,) = cuda.cuGraphExecDestroy(graphExec) + assert err_dr == cuda.CUresult.CUDA_SUCCESS + + (err_rt,) = cudart.cudaGraphDestroy(graph) + assert err_rt == cudart.cudaError_t.cudaSuccess + + +def test_interop_deviceptr(): + # Allocate dev memory + size = 1024 * np.uint8().itemsize + err_dr, dptr = cuda.cuMemAlloc(size) + assert err_dr == cuda.CUresult.CUDA_SUCCESS + + # Allocate host memory + h1 = np.full(size, 1).astype(np.uint8) + h2 = np.full(size, 2).astype(np.uint8) + assert np.array_equal(h1, h2) is False + + # Initialize device memory + (err_rt,) = cudart.cudaMemset(dptr, 1, size) + assert err_rt == cudart.cudaError_t.cudaSuccess + + # D to h2 + (err_rt,) = cudart.cudaMemcpy(h2, dptr, size, cudart.cudaMemcpyKind.cudaMemcpyDeviceToHost) + assert err_rt == cudart.cudaError_t.cudaSuccess + + # Validate h1 == h2 + assert np.array_equal(h1, h2) + + # Cleanup + (err_dr,) = cuda.cuMemFree(dptr) + assert err_dr == cuda.CUresult.CUDA_SUCCESS diff --git a/cuda_bindings/tests/test_kernelParams.py b/cuda_bindings/tests/test_kernelParams.py new file mode 100644 index 00000000000..555d6a7284c --- /dev/null +++ b/cuda_bindings/tests/test_kernelParams.py @@ -0,0 +1,802 @@ +# SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +import ctypes + +import numpy as np +import pytest + +import cuda.bindings.driver as cuda +import cuda.bindings.nvrtc as nvrtc +import cuda.bindings.runtime as cudart + + +def ASSERT_DRV(err): + if isinstance(err, cuda.CUresult): + if err != cuda.CUresult.CUDA_SUCCESS: + raise RuntimeError(f"Cuda Error: {err}") + elif isinstance(err, cudart.cudaError_t): + if err != cudart.cudaError_t.cudaSuccess: + raise RuntimeError(f"Cudart Error: {err}") + elif isinstance(err, nvrtc.nvrtcResult): + if err != nvrtc.nvrtcResult.NVRTC_SUCCESS: + raise RuntimeError(f"Nvrtc Error: {err}") + else: + raise RuntimeError(f"Unknown error type: {err}") + + +def common_nvrtc(allKernelStrings, dev): + err, major = cuda.cuDeviceGetAttribute(cuda.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR, dev) + ASSERT_DRV(err) + err, minor = cuda.cuDeviceGetAttribute(cuda.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR, dev) + ASSERT_DRV(err) + err, _, nvrtc_minor = nvrtc.nvrtcVersion() + ASSERT_DRV(err) + use_cubin = nvrtc_minor >= 1 + prefix = "sm" if use_cubin else "compute" + arch_arg = bytes(f"--gpu-architecture={prefix}_{major}{minor}", "ascii") + + err, prog = nvrtc.nvrtcCreateProgram(str.encode(allKernelStrings), b"allKernelStrings.cu", 0, None, None) + ASSERT_DRV(err) + opts = (b"--fmad=false", arch_arg) + (err,) = nvrtc.nvrtcCompileProgram(prog, len(opts), opts) + + err_log, logSize = nvrtc.nvrtcGetProgramLogSize(prog) + ASSERT_DRV(err_log) + log = b" " * logSize + (err_log,) = nvrtc.nvrtcGetProgramLog(prog, log) + ASSERT_DRV(err_log) + result = log.decode() + if len(result) > 1: + print(result) + ASSERT_DRV(err) + + if use_cubin: + err, dataSize = nvrtc.nvrtcGetCUBINSize(prog) + ASSERT_DRV(err) + data = b" " * dataSize + (err,) = nvrtc.nvrtcGetCUBIN(prog, data) + ASSERT_DRV(err) + else: + err, dataSize = nvrtc.nvrtcGetPTXSize(prog) + ASSERT_DRV(err) + data = b" " * dataSize + (err,) = nvrtc.nvrtcGetPTX(prog, data) + ASSERT_DRV(err) + + err, module = cuda.cuModuleLoadData(np.char.array(data)) + ASSERT_DRV(err) + + return module + + +def test_kernelParams_empty(device): + kernelString = """\ + static __device__ bool isDone; + extern "C" __global__ + void empty_kernel() + { + isDone = true; + if (isDone) return; + } + """ + + module = common_nvrtc(kernelString, device) + + # cudaStructs kernel + err, kernel = cuda.cuModuleGetFunction(module, b"empty_kernel") + ASSERT_DRV(err) + + err, stream = cuda.cuStreamCreate(0) + ASSERT_DRV(err) + + (err,) = cuda.cuLaunchKernel( + kernel, + 1, + 1, + 1, # grid dim + 1, + 1, + 1, # block dim + 0, + stream, # shared mem and stream + ((), ()), + 0, + ) # arguments + ASSERT_DRV(err) + (err,) = cuda.cuLaunchKernel( + kernel, + 1, + 1, + 1, # grid dim + 1, + 1, + 1, # block dim + 0, + stream, # shared mem and stream + None, + 0, + ) # arguments + ASSERT_DRV(err) + + # Retrieve global and validate + isDone_host = ctypes.c_bool() + err, isDonePtr_device, isDonePtr_device_size = cuda.cuModuleGetGlobal(module, b"isDone") + ASSERT_DRV(err) + assert isDonePtr_device_size == ctypes.sizeof(ctypes.c_bool) + (err,) = cuda.cuMemcpyDtoHAsync(isDone_host, isDonePtr_device, ctypes.sizeof(ctypes.c_bool), stream) + ASSERT_DRV(err) + (err,) = cuda.cuStreamSynchronize(stream) + ASSERT_DRV(err) + assert isDone_host.value is True + + (err,) = cuda.cuStreamDestroy(stream) + ASSERT_DRV(err) + (err,) = cuda.cuModuleUnload(module) + ASSERT_DRV(err) + + +@pytest.mark.parametrize("use_ctypes_as_values", [False, True], ids=["no-ctypes", "ctypes"]) +def test_kernelParams(use_ctypes_as_values, device): + if use_ctypes_as_values: + assertValues_host = ( + ctypes.c_bool(True), + ctypes.c_char(b"Z"), + ctypes.c_wchar("Ā"), + ctypes.c_byte(-127), + ctypes.c_ubyte(255), + ctypes.c_short(1), + ctypes.c_ushort(1), + ctypes.c_int(2), + ctypes.c_uint(2), + ctypes.c_long(3), + ctypes.c_ulong(3), + ctypes.c_longlong(4), + ctypes.c_ulonglong(4), + ctypes.c_size_t(5), + ctypes.c_float(123.456), + ctypes.c_float(123.456), + ctypes.c_void_p(0xDEADBEEF), + ) + else: + assertValues_host = ( + True, + b"Z", + "Ā", + -127, + 255, + 90, + 72, + 85, + 82, + 66, + 65, + 86, + 90, + 33, + 123.456, + 123.456, + 0xDEADBEEF, + ) + assertTypes_host = ( + ctypes.c_bool, + ctypes.c_char, + ctypes.c_wchar, + ctypes.c_byte, + ctypes.c_ubyte, + ctypes.c_short, + ctypes.c_ushort, + ctypes.c_int, + ctypes.c_uint, + ctypes.c_long, + ctypes.c_ulong, + ctypes.c_longlong, + ctypes.c_ulonglong, + ctypes.c_size_t, + ctypes.c_float, + ctypes.c_double, + ctypes.c_void_p, + ) + + basicKernelString = """\ + extern "C" __global__ + void basic(bool b, + char c, wchar_t wc, + signed char byte, unsigned char ubyte, + short s, unsigned short us, + int i, unsigned int ui, + long l, unsigned long ul, + long long ll, unsigned long long ull, + size_t size, + float f, double d, + void *p, + bool *pb, + char *pc, wchar_t *pwc, + signed char *pbyte, unsigned char *pubyte, + short *ps, unsigned short *pus, + int *pi, unsigned int *pui, + long *pl, unsigned long *pul, + long long *pll, unsigned long long *pull, + size_t *psize, + float *pf, double *pd) + { + assert(b == {}); + assert(c == {}); + assert(wc == {}); + assert(byte == {}); + assert(ubyte == {}); + assert(s == {}); + assert(us == {}); + assert(i == {}); + assert(ui == {}); + assert(l == {}); + assert(ul == {}); + assert(ll == {}); + assert(ull == {}); + assert(size == {}); + assert(f == {}); + assert(d == {}); + assert(p == (void*){}); + *pb = b; + *pc = c; + *pwc = wc; + *pbyte = byte; + *pubyte = ubyte; + *ps = s; + *pus = us; + *pi = i; + *pui = ui; + *pl = l; + *pul = ul; + *pll = ll; + *pull = ull; + *psize = size; + *pf = f; + *pd = d; + } + """ + idx = 0 + while "{}" in basicKernelString: + val = assertValues_host[idx].value if use_ctypes_as_values else assertValues_host[idx] + if assertTypes_host[idx] == ctypes.c_float: + basicKernelString = basicKernelString.replace("{}", str(float(val)) + "f", 1) + elif assertTypes_host[idx] == ctypes.c_double: + basicKernelString = basicKernelString.replace("{}", str(float(val)), 1) + elif assertTypes_host[idx] == ctypes.c_char: + basicKernelString = basicKernelString.replace("{}", str(val)[1:], 1) + elif assertTypes_host[idx] == ctypes.c_wchar: + basicKernelString = basicKernelString.replace("{}", str(ord(val)), 1) + else: + basicKernelString = basicKernelString.replace("{}", str(int(val)), 1) + idx += 1 + + module = common_nvrtc(basicKernelString, device) + + err, kernel = cuda.cuModuleGetFunction(module, b"basic") + ASSERT_DRV(err) + + err, stream = cuda.cuStreamCreate(0) + ASSERT_DRV(err) + + # Prepare kernel + err, pb = cuda.cuMemAlloc(ctypes.sizeof(ctypes.c_bool)) + ASSERT_DRV(err) + err, pc = cuda.cuMemAlloc(ctypes.sizeof(ctypes.c_char)) + ASSERT_DRV(err) + err, pwc = cuda.cuMemAlloc(ctypes.sizeof(ctypes.c_wchar)) + ASSERT_DRV(err) + err, pbyte = cuda.cuMemAlloc(ctypes.sizeof(ctypes.c_byte)) + ASSERT_DRV(err) + err, pubyte = cuda.cuMemAlloc(ctypes.sizeof(ctypes.c_ubyte)) + ASSERT_DRV(err) + err, ps = cuda.cuMemAlloc(ctypes.sizeof(ctypes.c_short)) + ASSERT_DRV(err) + err, pus = cuda.cuMemAlloc(ctypes.sizeof(ctypes.c_ushort)) + ASSERT_DRV(err) + err, pi = cuda.cuMemAlloc(ctypes.sizeof(ctypes.c_int)) + ASSERT_DRV(err) + err, pui = cuda.cuMemAlloc(ctypes.sizeof(ctypes.c_uint)) + ASSERT_DRV(err) + err, pl = cuda.cuMemAlloc(ctypes.sizeof(ctypes.c_long)) + ASSERT_DRV(err) + err, pul = cuda.cuMemAlloc(ctypes.sizeof(ctypes.c_ulong)) + ASSERT_DRV(err) + err, pll = cuda.cuMemAlloc(ctypes.sizeof(ctypes.c_longlong)) + ASSERT_DRV(err) + err, pull = cuda.cuMemAlloc(ctypes.sizeof(ctypes.c_ulonglong)) + ASSERT_DRV(err) + err, psize = cuda.cuMemAlloc(ctypes.sizeof(ctypes.c_size_t)) + ASSERT_DRV(err) + err, pf = cuda.cuMemAlloc(ctypes.sizeof(ctypes.c_float)) + ASSERT_DRV(err) + err, pd = cuda.cuMemAlloc(ctypes.sizeof(ctypes.c_double)) + ASSERT_DRV(err) + + assertValues_device = (pb, pc, pwc, pbyte, pubyte, ps, pus, pi, pui, pl, pul, pll, pull, psize, pf, pd) + assertTypes_device = ( + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + ) + + basicKernelValues = assertValues_host + assertValues_device + basicKernelTypes = assertTypes_host + assertTypes_device + (err,) = cuda.cuLaunchKernel( + kernel, + 1, + 1, + 1, # grid dim + 1, + 1, + 1, # block dim + 0, + stream, # shared mem and stream + (basicKernelValues, basicKernelTypes), + 0, + ) # arguments + ASSERT_DRV(err) + + # Retrieve each dptr + host_params = tuple([valueType() for valueType in assertTypes_host[:-1]]) + for i in range(len(host_params)): + (err,) = cuda.cuMemcpyDtoHAsync( + host_params[i], assertValues_device[i], ctypes.sizeof(assertTypes_host[i]), stream + ) + ASSERT_DRV(err) + + # Validate retrieved values + (err,) = cuda.cuStreamSynchronize(stream) + ASSERT_DRV(err) + for i in range(len(host_params)): + val = basicKernelValues[i].value if use_ctypes_as_values else basicKernelValues[i] + if basicKernelTypes[i] == ctypes.c_float: + if use_ctypes_as_values: + assert val == host_params[i].value + else: + assert val == (int(host_params[i].value * 1000) / 1000) + else: + assert val == host_params[i].value + + (err,) = cuda.cuMemFree(pb) + ASSERT_DRV(err) + (err,) = cuda.cuMemFree(pc) + ASSERT_DRV(err) + (err,) = cuda.cuMemFree(pwc) + ASSERT_DRV(err) + (err,) = cuda.cuMemFree(pbyte) + ASSERT_DRV(err) + (err,) = cuda.cuMemFree(pubyte) + ASSERT_DRV(err) + (err,) = cuda.cuMemFree(ps) + ASSERT_DRV(err) + (err,) = cuda.cuMemFree(pus) + ASSERT_DRV(err) + (err,) = cuda.cuMemFree(pi) + ASSERT_DRV(err) + (err,) = cuda.cuMemFree(pui) + ASSERT_DRV(err) + (err,) = cuda.cuMemFree(pl) + ASSERT_DRV(err) + (err,) = cuda.cuMemFree(pul) + ASSERT_DRV(err) + (err,) = cuda.cuMemFree(pll) + ASSERT_DRV(err) + (err,) = cuda.cuMemFree(pull) + ASSERT_DRV(err) + (err,) = cuda.cuMemFree(psize) + ASSERT_DRV(err) + (err,) = cuda.cuMemFree(pf) + ASSERT_DRV(err) + (err,) = cuda.cuMemFree(pd) + ASSERT_DRV(err) + (err,) = cuda.cuStreamDestroy(stream) + ASSERT_DRV(err) + (err,) = cuda.cuModuleUnload(module) + ASSERT_DRV(err) + + +def test_kernelParams_types_cuda(device): + err, uvaSupported = cuda.cuDeviceGetAttribute( + cuda.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_UNIFIED_ADDRESSING, device + ) + ASSERT_DRV(err) + + err, perr = cudart.cudaMalloc(ctypes.sizeof(ctypes.c_int)) + ASSERT_DRV(err) + err, pSurface_host = cudart.cudaHostAlloc(cudart.sizeof(cudart.cudaSurfaceObject_t), cudart.cudaHostAllocMapped) + ASSERT_DRV(err) + err, pDim3_host = cudart.cudaHostAlloc(cudart.sizeof(cudart.dim3), cudart.cudaHostAllocMapped) + ASSERT_DRV(err) + + # Get device pointer if UVM is not enabled + if uvaSupported: + kernelValues = ( + cudart.cudaError_t.cudaErrorUnknown, + perr, # enums + cudart.cudaSurfaceObject_t(248), + cudart.cudaSurfaceObject_t(_ptr=pSurface_host), # typedef of primative + cudart.dim3(), + cudart.dim3(_ptr=pDim3_host), + ) # struct + else: + err, pSurface_device = cudart.cudaHostGetDevicePointer(pSurface_host, 0) + ASSERT_DRV(err) + err, pDim3_device = cudart.cudaHostGetDevicePointer(pDim3_host, 0) + ASSERT_DRV(err) + kernelValues = ( + cudart.cudaError_t.cudaErrorUnknown, + perr, # enums + cudart.cudaSurfaceObject_t(248), + cudart.cudaSurfaceObject_t(_ptr=pSurface_device), # typedef of primative + cudart.dim3(), + cudart.dim3(_ptr=pDim3_device), + ) # struct + kernelTypes = (None, ctypes.c_void_p, None, ctypes.c_void_p, None, ctypes.c_void_p) + kernelValues[4].x = 1 + kernelValues[4].y = 2 + kernelValues[4].z = 3 + + kernelString = """\ + extern "C" __global__ + void structsCuda(cudaError_t err, cudaError_t *perr, + cudaSurfaceObject_t surface, cudaSurfaceObject_t *pSurface, + dim3 dim, dim3* pdim) + { + *perr = err; + *pSurface = surface; + pdim->x = dim.x; + pdim->y = dim.y; + pdim->z = dim.z; + } + """ + + module = common_nvrtc(kernelString, device) + + # cudaStructs kernel + err, kernel = cuda.cuModuleGetFunction(module, b"structsCuda") + ASSERT_DRV(err) + + err, stream = cuda.cuStreamCreate(0) + ASSERT_DRV(err) + + (err,) = cuda.cuLaunchKernel( + kernel, + 1, + 1, + 1, # grid dim + 1, + 1, + 1, # block dim + 0, + stream, # shared mem and stream + (kernelValues, kernelTypes), + 0, + ) # arguments + ASSERT_DRV(err) + + # Retrieve each dptr + host_err = ctypes.c_int() + (err,) = cudart.cudaMemcpyAsync( + ctypes.addressof(host_err), + perr, + ctypes.sizeof(ctypes.c_int()), + cudart.cudaMemcpyKind.cudaMemcpyDeviceToHost, + stream, + ) + ASSERT_DRV(err) + + # Validate kernel values + (err,) = cuda.cuStreamSynchronize(stream) + ASSERT_DRV(err) + cuda_err = cudart.cudaError_t(host_err.value) + + if uvaSupported: + assert kernelValues[0] == cuda_err + assert int(kernelValues[2]) == int(kernelValues[3]) + assert kernelValues[4].x == kernelValues[5].x + assert kernelValues[4].y == kernelValues[5].y + assert kernelValues[4].z == kernelValues[5].z + else: + surface_host = cudart.cudaSurfaceObject_t(_ptr=pSurface_host) + dim3_host = cudart.dim3(_ptr=pDim3_host) + assert kernelValues[0] == cuda_err + assert int(kernelValues[2]) == int(surface_host) + assert kernelValues[4].x == dim3_host.x + assert kernelValues[4].y == dim3_host.y + assert kernelValues[4].z == dim3_host.z + + (err,) = cudart.cudaFree(perr) + ASSERT_DRV(err) + (err,) = cudart.cudaFreeHost(pSurface_host) + ASSERT_DRV(err) + (err,) = cudart.cudaFreeHost(pDim3_host) + ASSERT_DRV(err) + (err,) = cuda.cuStreamDestroy(stream) + ASSERT_DRV(err) + (err,) = cuda.cuModuleUnload(module) + ASSERT_DRV(err) + + +def test_kernelParams_struct_custom(device): + err, uvaSupported = cuda.cuDeviceGetAttribute( + cuda.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_UNIFIED_ADDRESSING, device + ) + ASSERT_DRV(err) + + kernelString = """\ + struct testStruct { + int value; + }; + + extern "C" __global__ + void structCustom(struct testStruct src, struct testStruct *dst) + { + dst->value = src.value; + } + """ + + module = common_nvrtc(kernelString, device) + + err, kernel = cuda.cuModuleGetFunction(module, b"structCustom") + ASSERT_DRV(err) + + err, stream = cuda.cuStreamCreate(0) + ASSERT_DRV(err) + + # structCustom kernel + class testStruct(ctypes.Structure): + _fields_ = [("value", ctypes.c_int)] + + err, pStruct_host = cudart.cudaHostAlloc(ctypes.sizeof(testStruct), cudart.cudaHostAllocMapped) + ASSERT_DRV(err) + + # Get device pointer if UVM is not enabled + if uvaSupported: + kernelValues = (testStruct(5), pStruct_host) + else: + err, pStruct_device = cudart.cudaHostGetDevicePointer(pStruct_host, 0) + ASSERT_DRV(err) + kernelValues = (testStruct(5), pStruct_device) + kernelTypes = (None, ctypes.c_void_p) + + (err,) = cuda.cuLaunchKernel( + kernel, + 1, + 1, + 1, # grid dim + 1, + 1, + 1, # block dim + 0, + stream, # shared mem and stream + (kernelValues, kernelTypes), + 0, + ) # arguments + ASSERT_DRV(err) + + # Validate kernel values + (err,) = cuda.cuStreamSynchronize(stream) + ASSERT_DRV(err) + struct_shared = testStruct.from_address(pStruct_host) + assert kernelValues[0].value == struct_shared.value + + (err,) = cudart.cudaFreeHost(pStruct_host) + ASSERT_DRV(err) + (err,) = cuda.cuStreamDestroy(stream) + ASSERT_DRV(err) + (err,) = cuda.cuModuleUnload(module) + ASSERT_DRV(err) + + +@pytest.mark.parametrize("pass_by_address", [False, True], ids=["by-address", "not-by-address"]) +def test_kernelParams_buffer_protocol(pass_by_address, device): + err, uvaSupported = cuda.cuDeviceGetAttribute( + cuda.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_UNIFIED_ADDRESSING, device + ) + ASSERT_DRV(err) + + kernelString = """\ + struct testStruct { + int value; + }; + extern "C" __global__ + void testkernel(int i, int *pi, + float f, float *pf, + struct testStruct s, struct testStruct *ps) + { + *pi = i; + *pf = f; + ps->value = s.value; + } + """ + + module = common_nvrtc(kernelString, device) + + err, kernel = cuda.cuModuleGetFunction(module, b"testkernel") + ASSERT_DRV(err) + + err, stream = cuda.cuStreamCreate(0) + ASSERT_DRV(err) + + # testkernel kernel + class testStruct(ctypes.Structure): + _fields_ = [("value", ctypes.c_int)] + + err, pInt_host = cudart.cudaHostAlloc(ctypes.sizeof(ctypes.c_int), cudart.cudaHostAllocMapped) + ASSERT_DRV(err) + err, pFloat_host = cudart.cudaHostAlloc(ctypes.sizeof(ctypes.c_float), cudart.cudaHostAllocMapped) + ASSERT_DRV(err) + err, pStruct_host = cudart.cudaHostAlloc(ctypes.sizeof(testStruct), cudart.cudaHostAllocMapped) + ASSERT_DRV(err) + + # Get device pointer if UVM is not enabled + if uvaSupported: + kernelValues = ( + ctypes.c_int(1), + ctypes.c_void_p(pInt_host), + ctypes.c_float(123.456), + ctypes.c_void_p(pFloat_host), + testStruct(5), + ctypes.c_void_p(pStruct_host), + ) + else: + err, pInt_device = cudart.cudaHostGetDevicePointer(pInt_host, 0) + ASSERT_DRV(err) + err, pFloat_device = cudart.cudaHostGetDevicePointer(pFloat_host, 0) + ASSERT_DRV(err) + err, pStruct_device = cudart.cudaHostGetDevicePointer(pStruct_host, 0) + ASSERT_DRV(err) + kernelValues = ( + ctypes.c_int(1), + ctypes.c_void_p(pInt_device), + ctypes.c_float(123.456), + ctypes.c_void_p(pFloat_device), + testStruct(5), + ctypes.c_void_p(pStruct_device), + ) + + packagedParams = (ctypes.c_void_p * len(kernelValues))() + for idx in range(len(packagedParams)): + packagedParams[idx] = ctypes.addressof(kernelValues[idx]) + (err,) = cuda.cuLaunchKernel( + kernel, + 1, + 1, + 1, # grid dim + 1, + 1, + 1, # block dim + 0, + stream, # shared mem and stream + ctypes.addressof(packagedParams) if pass_by_address else packagedParams, + 0, + ) # arguments + ASSERT_DRV(err) + + # Validate kernel values + (err,) = cuda.cuStreamSynchronize(stream) + ASSERT_DRV(err) + assert kernelValues[0].value == ctypes.c_int.from_address(pInt_host).value + assert kernelValues[2].value == ctypes.c_float.from_address(pFloat_host).value + assert kernelValues[4].value == testStruct.from_address(pStruct_host).value + + (err,) = cudart.cudaFreeHost(pStruct_host) + ASSERT_DRV(err) + (err,) = cuda.cuStreamDestroy(stream) + ASSERT_DRV(err) + (err,) = cuda.cuModuleUnload(module) + ASSERT_DRV(err) + + +def test_kernelParams_buffer_protocol_numpy(device): + err, uvaSupported = cuda.cuDeviceGetAttribute( + cuda.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_UNIFIED_ADDRESSING, device + ) + ASSERT_DRV(err) + + kernelString = """\ + struct testStruct { + int value; + }; + extern "C" __global__ + void testkernel(int i, int *pi, + float f, float *pf, + struct testStruct s, struct testStruct *ps) + { + *pi = i; + *pf = f; + ps->value = s.value; + } + """ + + module = common_nvrtc(kernelString, device) + + err, kernel = cuda.cuModuleGetFunction(module, b"testkernel") + ASSERT_DRV(err) + + err, stream = cuda.cuStreamCreate(0) + ASSERT_DRV(err) + + # testkernel kernel + testStruct = np.dtype([("value", np.int32)]) + + err, pInt_host = cudart.cudaHostAlloc(np.dtype(np.int32).itemsize, cudart.cudaHostAllocMapped) + ASSERT_DRV(err) + err, pFloat_host = cudart.cudaHostAlloc(np.dtype(np.float32).itemsize, cudart.cudaHostAllocMapped) + ASSERT_DRV(err) + err, pStruct_host = cudart.cudaHostAlloc(testStruct.itemsize, cudart.cudaHostAllocMapped) + ASSERT_DRV(err) + + # Get device pointer if UVM is not enabled + if uvaSupported: + kernelValues = ( + np.array(1, dtype=np.uint32), + np.array([pInt_host], dtype=np.uint64), + np.array(123.456, dtype=np.float32), + np.array([pFloat_host], dtype=np.uint64), + np.array([5], testStruct), + np.array([pStruct_host], dtype=np.uint64), + ) + else: + err, pInt_device = cudart.cudaHostGetDevicePointer(pInt_host, 0) + ASSERT_DRV(err) + err, pFloat_device = cudart.cudaHostGetDevicePointer(pFloat_host, 0) + ASSERT_DRV(err) + err, pStruct_device = cudart.cudaHostGetDevicePointer(pStruct_host, 0) + ASSERT_DRV(err) + kernelValues = ( + np.array(1, dtype=np.int32), + np.array([pInt_device], dtype=np.uint64), + np.array(123.456, dtype=np.float32), + np.array([pFloat_device], dtype=np.uint64), + np.array([5], testStruct), + np.array([pStruct_device], dtype=np.uint64), + ) + + packagedParams = np.array([arg.ctypes.data for arg in kernelValues], dtype=np.uint64) + (err,) = cuda.cuLaunchKernel( + kernel, + 1, + 1, + 1, # grid dim + 1, + 1, + 1, # block dim + 0, + stream, # shared mem and stream + packagedParams, + 0, + ) # arguments + ASSERT_DRV(err) + + # Validate kernel values + (err,) = cuda.cuStreamSynchronize(stream) + ASSERT_DRV(err) + + class numpy_address_wrapper: + def __init__(self, address, typestr): + self.__array_interface__ = {"data": (address, False), "typestr": typestr, "shape": (1,)} + + assert kernelValues[0] == np.array(numpy_address_wrapper(pInt_host, "; + .reg .b64 %rd<5>; + + + ld.param.u64 %rd1, [_Z6kernelPi_param_0]; + cvta.to.global.u64 %rd2, %rd1; + mov.u32 %r1, %tid.x; + mov.u32 %r2, %ctaid.x; + mov.u32 %r3, %ntid.x; + mad.lo.s32 %r4, %r2, %r3, %r1; + mul.wide.s32 %rd3, %r4, 4; + add.s64 %rd4, %rd2, %rd3; + ld.global.u32 %r5, [%rd4]; + add.s32 %r6, %r5, 1; + st.global.u32 [%rd4], %r6; + ret; + +}} +""" + +CODE = """ +int __device__ inc(int x) { + return x + 1; +} +""" + +# Base64 encoded TileIR generated by the toolshed/dump_cutile_b64.py script. +TILEIR_b64 = ( + "f1RpbGVJUgANAQAAgo0BCAECBgYBCwEECgCBAUQHBgQIEAAABgUMAQABBgUIEAALQwEICgEMAAYE" + "CBAAAwYFDAEABAYFCBAAD0MBCA4BEAAGBAgQAAYGBQwBAAcGBQgQABNDAQgSARQAMAUFBUIJDT4C" + "CgcEABkBFglCCRE+AgoHBAAcARYJAgoAABodQgkVZgEHBAAfIAEWCVwAAIQICADLy8vLy8vLg5oC" + "CMvLy8sBy8vLAAAAABfLy8vLy8vLBAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAEAAAA" + "AAAAAAQAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAQAAAAA" + "AAAABAAAAAAAAAAEAAAAAAAAAAUAAAAAAAAABgAAAAAAAAAGAAAAAAAAAAcAAAAAAAAABwAAAAAA" + "AAAIAAAAAAAAAAkAAAAAAAAACQAAAAAAAAAEAAAAAAAAAAnLy8sAAAAAAwAAAAUAAAAMAAAAEQAA" + "ABYAAAAbAAAAIAAAACUAAAACAAEBAQUBFwICAhcEAwMYBAQDAxkTBAMDGhEEAwMbEQQDAx0WBAMD" + "HgiFdATLy8sLy8vLAAAAAAEAAAACAAAAAwAAAAUAAAAIAAAACwAAABcAAAAYAAAALAAAADkAAAAA" + "AwcMAg0DAA0BABAJBAUFBAUFBAUFABEOAgEAAAAAAAAAgAEBAAAAAAAAAA8BEAAAAAgBAAAAAAAN" + "AgEQAAAAAAAAAIGIAQQFy8vLAAAAABIAAAAsAAAAPQAAAGoAAABkdW1wX2N1dGlsZV9iNjQucHkv" + "bG9jYWxob21lL2xvY2FsLXdhbmdtL3RveXZlY3Rvcl9hZGRfa2VybmVsL2xvY2FsaG9tZS9sb2Nh" + "bC13YW5nbS90b3kvZHVtcF9jdXRpbGVfYjY0LnB5c21fMTIwAA==" +) + + +def get_version() -> tuple[int, int]: + return nvfatbin.version() + + +@pytest.fixture(params=ARCHITECTURES) +def arch(request): + return request.param + + +@pytest.fixture(params=PTX_VERSIONS) +def ptx_version(request): + return request.param + + +@pytest.fixture +def PTX(arch, ptx_version): + return PTX_TEMPLATE.format(PTX_VERSION=ptx_version, ARCH=arch) + + +@pytest.fixture +def nvcc_smoke(tmpdir) -> str: + # TODO: Use cuda-pathfinder to locate nvcc on system. + nvcc = shutil.which("nvcc") + if nvcc is None: + pytest.skip("nvcc not found on PATH") + + # Smoke test: make sure nvcc is actually usable (toolkit + host compiler are set up), + # not merely present on PATH. + src = tmpdir / "nvcc_smoke.cu" + out = tmpdir / "nvcc_smoke.o" + with open(src, "w") as f: + f.write("") + try: + subprocess.run( # noqa: S603 + [nvcc, "-c", str(src), "-o", str(out)], + check=True, + capture_output=True, + ) + except subprocess.CalledProcessError as e: + stdout = (e.stdout or b"").decode(errors="replace") + stderr = (e.stderr or b"").decode(errors="replace") + pytest.skip( + "nvcc found on PATH but failed to compile a trivial input.\n" + f"command: {[nvcc, '-c', str(src), '-o', str(out)]!r}\n" + f"exit_code: {e.returncode}\n" + f"stdout:\n{stdout}\n" + f"stderr:\n{stderr}\n" + ) + + return nvcc + + +def _build_cubin(arch): + def CHECK_NVRTC(err): + if err != nvrtc.nvrtcResult.NVRTC_SUCCESS: + raise RuntimeError(repr(err)) + + err, program_handle = nvrtc.nvrtcCreateProgram(CODE.encode(), b"", 0, [], []) + CHECK_NVRTC(err) + err = nvrtc.nvrtcCompileProgram(program_handle, 1, [f"-arch={arch}".encode()])[0] + CHECK_NVRTC(err) + err, size = nvrtc.nvrtcGetCUBINSize(program_handle) + CHECK_NVRTC(err) + cubin = b" " * size + (err,) = nvrtc.nvrtcGetCUBIN(program_handle, cubin) + CHECK_NVRTC(err) + (err,) = nvrtc.nvrtcDestroyProgram(program_handle) + CHECK_NVRTC(err) + return cubin + + +@pytest.fixture +def CUBIN(arch): + return _build_cubin(arch) + + +# create a valid LTOIR input for testing +@pytest.fixture +def LTOIR(arch): + arch = arch.replace("sm", "compute") + + def CHECK_NVRTC(err): + if err != nvrtc.nvrtcResult.NVRTC_SUCCESS: + raise RuntimeError(repr(err)) + + empty_cplusplus_kernel = "__global__ void A() {}" + err, program_handle = nvrtc.nvrtcCreateProgram(empty_cplusplus_kernel.encode(), b"", 0, [], []) + CHECK_NVRTC(err) + err = nvrtc.nvrtcCompileProgram(program_handle, 1, [b"-dlto", f"-arch={arch}".encode()])[0] + CHECK_NVRTC(err) + err, size = nvrtc.nvrtcGetLTOIRSize(program_handle) + CHECK_NVRTC(err) + empty_kernel_ltoir = b" " * size + (err,) = nvrtc.nvrtcGetLTOIR(program_handle, empty_kernel_ltoir) + CHECK_NVRTC(err) + (err,) = nvrtc.nvrtcDestroyProgram(program_handle) + CHECK_NVRTC(err) + return empty_kernel_ltoir + + +@pytest.fixture +def OBJECT(arch, tmpdir, nvcc_smoke): + empty_cplusplus_kernel = "__global__ void A() {}" + with open(tmpdir / "object.cu", "w") as f: + f.write(empty_cplusplus_kernel) + + nvcc = nvcc_smoke + + # This is a test fixture that intentionally invokes a trusted tool (`nvcc`) to + # compile a temporary CUDA translation unit. + cmd = [nvcc, "-c", "-arch", arch, "-o", str(tmpdir / "object.o"), str(tmpdir / "object.cu")] + try: + subprocess.run( # noqa: S603 + cmd, + check=True, + capture_output=True, + ) + except subprocess.CalledProcessError as e: + stdout = (e.stdout or b"").decode(errors="replace") + stderr = (e.stderr or b"").decode(errors="replace") + raise RuntimeError( + "nvcc smoke test passed, but nvcc failed while compiling the test object.\n" + f"command: {cmd!r}\n" + f"exit_code: {e.returncode}\n" + f"stdout:\n{stdout}\n" + f"stderr:\n{stderr}\n" + ) from e + with open(tmpdir / "object.o", "rb") as f: + object = f.read() + + return object + + +@pytest.fixture +def TILEIR(tmpdir): + try: + binary_data = base64.b64decode(TILEIR_b64) + except binascii.Error as e: + raise ValueError( + "Base64 encoded TileIR is corrupted. Please regenerate the TileIR" + "by executing the toolshed/dump_cutile_b64.py script." + ) from e + return binary_data + + +@pytest.mark.parametrize("error_enum", nvfatbin.Result) +def test_get_error_string(error_enum): + es = nvfatbin.get_error_string(error_enum) + + if error_enum is nvfatbin.Result.SUCCESS: + assert es == "" + else: + assert es != "" + + +def test_nvfatbin_get_version(): + major, minor = nvfatbin.version() + assert major is not None + assert minor is not None + + +def test_nvfatbin_empty_create_and_destroy(): + handle = nvfatbin.create([], 0) + assert handle is not None + nvfatbin.destroy(handle) + + +def test_nvfatbin_invalid_input_create(): + with pytest.raises(nvfatbin.nvFatbinError, match="ERROR_UNRECOGNIZED_OPTION"): + nvfatbin.create(["--unsupported_option"], 1) + + +def test_nvfatbin_get_empty(): + handle = nvfatbin.create([], 0) + size = nvfatbin.size(handle) + + buffer = bytearray(size) + nvfatbin.get(handle, buffer) + + nvfatbin.destroy(handle) + + +def test_nvfatbin_add_ptx(PTX, arch): + arch_numeric = arch.split("_")[1] + + handle = nvfatbin.create([], 0) + nvfatbin.add_ptx(handle, PTX.encode(), len(PTX), arch_numeric, "add", f"-arch={arch}") + + buffer = bytearray(nvfatbin.size(handle)) + + nvfatbin.get(handle, buffer) + nvfatbin.destroy(handle) + + +def test_nvfatbin_add_cubin_ELF_SIZE_MISMATCH(): + cubin = _build_cubin("sm_80") + handle = nvfatbin.create([], 0) + with pytest.raises(nvfatbin.nvFatbinError, match="ERROR_ELF_ARCH_MISMATCH"): + nvfatbin.add_cubin(handle, cubin, len(cubin), "75", "inc") + + nvfatbin.destroy(handle) + + +def test_nvfatbin_add_cubin(CUBIN, arch): + arch_numeric = arch.split("_")[1] + + handle = nvfatbin.create([], 0) + nvfatbin.add_cubin(handle, CUBIN, len(CUBIN), arch_numeric, "inc") + + buffer = bytearray(nvfatbin.size(handle)) + + nvfatbin.get(handle, buffer) + nvfatbin.destroy(handle) + + +def test_nvfatbin_add_cubin_ELF_ARCH_MISMATCH(): + cubin = _build_cubin("sm_80") + handle = nvfatbin.create([], 0) + with pytest.raises(nvfatbin.nvFatbinError, match="ERROR_ELF_ARCH_MISMATCH"): + nvfatbin.add_cubin(handle, cubin, len(cubin), "75", "inc") + + nvfatbin.destroy(handle) + + +def test_nvdfatbin_add_ltoir(LTOIR, arch): + arch_numeric = arch.split("_")[1] + + handle = nvfatbin.create([], 0) + nvfatbin.add_ltoir(handle, LTOIR, len(LTOIR), arch_numeric, "inc", "") + + buffer = bytearray(nvfatbin.size(handle)) + + nvfatbin.get(handle, buffer) + nvfatbin.destroy(handle) + + +def test_nvfatbin_add_reloc(OBJECT): + handle = nvfatbin.create([], 0) + nvfatbin.add_reloc(handle, OBJECT, len(OBJECT)) + + buffer = bytearray(nvfatbin.size(handle)) + + nvfatbin.get(handle, buffer) + nvfatbin.destroy(handle) + + +@pytest.mark.skipif(get_version() < (13, 1), reason="TileIR API is not supported in CUDA < 13.1") +def test_nvfatbin_add_tile_ir(TILEIR): + handle = nvfatbin.create([], 0) + nvfatbin.add_tile_ir(handle, TILEIR, len(TILEIR), "VectorAdd", "") + + buffer = bytearray(nvfatbin.size(handle)) + + nvfatbin.get(handle, buffer) + nvfatbin.destroy(handle) diff --git a/cuda_bindings/tests/test_nvjitlink.py b/cuda_bindings/tests/test_nvjitlink.py new file mode 100644 index 00000000000..91d6ace1ce6 --- /dev/null +++ b/cuda_bindings/tests/test_nvjitlink.py @@ -0,0 +1,210 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +from contextlib import contextmanager + +import pytest + +from cuda.bindings import nvjitlink, nvrtc + + +@contextmanager +def nvjitlink_session(num_options, options): + """Create an nvJitLink handle and always destroy it (including on test failure).""" + handle = nvjitlink.create(num_options, options) + try: + yield handle + finally: + if handle != 0: + nvjitlink.destroy(handle) + + +# Establish a handful of compatible architectures and PTX versions to test with +ARCHITECTURES = ["sm_75", "sm_80", "sm_90", "sm_100"] +PTX_VERSIONS = ["6.4", "7.0", "8.5", "8.8"] + + +PTX_HEADER = """\ +.version {VERSION} +.target {ARCH} +.address_size 64 +""" + +PTX_KERNEL = """ +.visible .entry _Z6kernelPi( + .param .u64 _Z6kernelPi_param_0 +) +{ + .reg .pred %p<2>; + .reg .b32 %r<3>; + .reg .b64 %rd<3>; + + ld.param.u64 %rd1, [_Z6kernelPi_param_0]; + cvta.to.global.u64 %rd2, %rd1; + mov.u32 %r1, %tid.x; + st.global.u32 [%rd2+0], %r1; + ret; +} +""" + + +def _build_arch_ptx_parametrized_callable(): + av = tuple(zip(ARCHITECTURES, PTX_VERSIONS)) + return pytest.mark.parametrize( + ("arch", "ptx_bytes"), + [(a, (PTX_HEADER.format(VERSION=v, ARCH=a) + PTX_KERNEL).encode("utf-8")) for a, v in av], + ids=[f"{a}_{v}" for a, v in av], + ) + + +ARCH_PTX_PARAMETRIZED_CALLABLE = _build_arch_ptx_parametrized_callable() + + +def arch_ptx_parametrized(func): + return ARCH_PTX_PARAMETRIZED_CALLABLE(func) + + +def check_nvjitlink_usable(): + from cuda.bindings._internal import nvjitlink as inner_nvjitlink + + return inner_nvjitlink._inspect_function_pointer("__nvJitLinkVersion") != 0 + + +def check_nvjitlink_get_linked_ltoir_usable(): + from cuda.bindings._internal import nvjitlink as inner_nvjitlink + + return inner_nvjitlink._inspect_function_pointer("__nvJitLinkGetLinkedLTOIR") != 0 + + +pytestmark = pytest.mark.skipif( + not check_nvjitlink_usable(), reason="nvJitLink not usable, maybe not installed or too old (<12.3)" +) + + +# create a valid LTOIR input for testing +@pytest.fixture +def get_dummy_ltoir(): + def CHECK_NVRTC(err): + if err != nvrtc.nvrtcResult.NVRTC_SUCCESS: + raise RuntimeError(repr(err)) + + empty_cplusplus_kernel = "__global__ void A() {}" + err, program_handle = nvrtc.nvrtcCreateProgram(empty_cplusplus_kernel.encode(), b"", 0, [], []) + CHECK_NVRTC(err) + err = nvrtc.nvrtcCompileProgram(program_handle, 1, [b"-dlto"])[0] + CHECK_NVRTC(err) + err, size = nvrtc.nvrtcGetLTOIRSize(program_handle) + CHECK_NVRTC(err) + empty_kernel_ltoir = b" " * size + (err,) = nvrtc.nvrtcGetLTOIR(program_handle, empty_kernel_ltoir) + CHECK_NVRTC(err) + (err,) = nvrtc.nvrtcDestroyProgram(program_handle) + CHECK_NVRTC(err) + return empty_kernel_ltoir + + +def test_unrecognized_option_error(): + with pytest.raises(nvjitlink.nvJitLinkError, match="ERROR_UNRECOGNIZED_OPTION"): + nvjitlink.create(1, ["-fictitious_option"]) + + +def test_invalid_arch_error(): + with pytest.raises(nvjitlink.nvJitLinkError, match="ERROR_UNRECOGNIZED_OPTION"): + nvjitlink.create(1, ["-arch=sm_XX"]) + + +@pytest.mark.parametrize("option", ARCHITECTURES) +def test_create_and_destroy(option): + with nvjitlink_session(1, [f"-arch={option}"]) as handle: + assert handle != 0 + + +def test_create_and_destroy_bytes_options(): + with nvjitlink_session(1, [b"-arch=sm_80"]) as handle: + assert handle != 0 + + +@pytest.mark.parametrize("option", ARCHITECTURES) +def test_complete_empty(option): + with nvjitlink_session(1, [f"-arch={option}"]) as handle: + nvjitlink.complete(handle) + + +@arch_ptx_parametrized +def test_add_data(arch, ptx_bytes): + with nvjitlink_session(1, [f"-arch={arch}"]) as handle: + nvjitlink.add_data(handle, nvjitlink.InputType.ANY, ptx_bytes, len(ptx_bytes), "test_data") + nvjitlink.complete(handle) + + +@arch_ptx_parametrized +def test_add_file(arch, ptx_bytes, tmp_path): + with nvjitlink_session(1, [f"-arch={arch}"]) as handle: + file_path = tmp_path / "test_file.cubin" + file_path.write_bytes(ptx_bytes) + nvjitlink.add_file(handle, nvjitlink.InputType.ANY, str(file_path)) + nvjitlink.complete(handle) + + +@pytest.mark.parametrize("arch", ARCHITECTURES) +def test_get_error_log(arch): + with nvjitlink_session(1, [f"-arch={arch}"]) as handle: + nvjitlink.complete(handle) + log_size = nvjitlink.get_error_log_size(handle) + log = bytearray(log_size) + nvjitlink.get_error_log(handle, log) + assert len(log) == log_size + + +@arch_ptx_parametrized +def test_get_info_log(arch, ptx_bytes): + with nvjitlink_session(1, [f"-arch={arch}"]) as handle: + nvjitlink.add_data(handle, nvjitlink.InputType.ANY, ptx_bytes, len(ptx_bytes), "test_data") + nvjitlink.complete(handle) + log_size = nvjitlink.get_info_log_size(handle) + log = bytearray(log_size) + nvjitlink.get_info_log(handle, log) + assert len(log) == log_size + + +@arch_ptx_parametrized +def test_get_linked_cubin(arch, ptx_bytes): + with nvjitlink_session(1, [f"-arch={arch}"]) as handle: + nvjitlink.add_data(handle, nvjitlink.InputType.ANY, ptx_bytes, len(ptx_bytes), "test_data") + nvjitlink.complete(handle) + cubin_size = nvjitlink.get_linked_cubin_size(handle) + cubin = bytearray(cubin_size) + nvjitlink.get_linked_cubin(handle, cubin) + assert len(cubin) == cubin_size + + +@pytest.mark.parametrize("arch", ARCHITECTURES) +def test_get_linked_ptx(arch, get_dummy_ltoir): + with nvjitlink_session(3, [f"-arch={arch}", "-lto", "-ptx"]) as handle: + nvjitlink.add_data(handle, nvjitlink.InputType.LTOIR, get_dummy_ltoir, len(get_dummy_ltoir), "test_data") + nvjitlink.complete(handle) + ptx_size = nvjitlink.get_linked_ptx_size(handle) + ptx = bytearray(ptx_size) + nvjitlink.get_linked_ptx(handle, ptx) + assert len(ptx) == ptx_size + + +@pytest.mark.parametrize("arch", ARCHITECTURES) +@pytest.mark.skipif( + not check_nvjitlink_get_linked_ltoir_usable(), + reason="nvJitLinkGetLinkedLTOIR not available in installed nvJitLink", +) +def test_get_linked_ltoir(arch, get_dummy_ltoir): + with nvjitlink_session(2, [f"-arch={arch}", "-lto"]) as handle: + nvjitlink.add_data(handle, nvjitlink.InputType.LTOIR, get_dummy_ltoir, len(get_dummy_ltoir), "test_data") + nvjitlink.complete(handle) + ltoir_size = nvjitlink.get_linked_ltoir_size(handle) + ltoir = bytearray(ltoir_size) + nvjitlink.get_linked_ltoir(handle, ltoir) + assert len(ltoir) == ltoir_size + + +def test_package_version(): + ver = nvjitlink.version() + assert len(ver) == 2 + assert ver >= (12, 0) diff --git a/cuda_bindings/tests/test_nvrtc.py b/cuda_bindings/tests/test_nvrtc.py new file mode 100644 index 00000000000..90ff6766d41 --- /dev/null +++ b/cuda_bindings/tests/test_nvrtc.py @@ -0,0 +1,37 @@ +# SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +import pytest + +from cuda.bindings import nvrtc + + +def ASSERT_DRV(err): + if isinstance(err, nvrtc.nvrtcResult): + if err != nvrtc.nvrtcResult.NVRTC_SUCCESS: + raise RuntimeError(f"Nvrtc Error: {err}") + else: + raise RuntimeError(f"Unknown error type: {err}") + + +def nvrtcVersionLessThan(major, minor): + err, major_version, minor_version = nvrtc.nvrtcVersion() + ASSERT_DRV(err) + return major_version < major or (major == major_version and minor_version < minor) + + +@pytest.mark.skipif(nvrtcVersionLessThan(11, 3), reason="When nvrtcGetSupportedArchs was introduced") +def test_nvrtcGetSupportedArchs(): + err, supportedArchs = nvrtc.nvrtcGetSupportedArchs() + ASSERT_DRV(err) + assert len(supportedArchs) != 0 + + +@pytest.mark.skipif(nvrtcVersionLessThan(12, 1), reason="Preempt Segmentation Fault (see #499)") +def test_nvrtcGetLoweredName_failure(): + err, name = nvrtc.nvrtcGetLoweredName(None, b"I'm an elevated name!") + assert err == nvrtc.nvrtcResult.NVRTC_ERROR_INVALID_PROGRAM + assert name is None + err, name = nvrtc.nvrtcGetLoweredName(0, b"I'm another elevated name!") + assert err == nvrtc.nvrtcResult.NVRTC_ERROR_INVALID_PROGRAM + assert name is None diff --git a/cuda_bindings/tests/test_nvvm.py b/cuda_bindings/tests/test_nvvm.py new file mode 100644 index 00000000000..91b7d705d34 --- /dev/null +++ b/cuda_bindings/tests/test_nvvm.py @@ -0,0 +1,153 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +import re +from contextlib import contextmanager + +import pytest + +from cuda.bindings import nvvm +from cuda.bindings._internal.utils import FunctionNotFoundError + +pytest_plugins = ("cuda_python_test_helpers.nvvm_bitcode",) + + +@pytest.fixture(params=[nvvm.compile_program, nvvm.verify_program]) +def compile_or_verify(request): + return request.param + + +def match_exact(s): + return "^" + re.escape(s) + "$" + + +@contextmanager +def nvvm_program() -> int: + prog: int = nvvm.create_program() + try: + yield prog + finally: + nvvm.destroy_program(prog) + + +def get_program_log(prog): + buffer = bytearray(nvvm.get_program_log_size(prog)) + nvvm.get_program_log(prog, buffer) + return buffer.decode(errors="backslashreplace") + + +def test_get_error_string(): + num_success = 0 + num_errors = 0 + for enum_obj in nvvm.Result: + es = nvvm.get_error_string(enum_obj) + if enum_obj is nvvm.Result.SUCCESS: + num_success += 1 + else: + assert es.startswith("NVVM_ERROR") + num_errors += 1 + assert num_success == 1 + assert num_errors > 1 # smoke check is sufficient + + +def test_nvvm_version(): + ver = nvvm.version() + assert len(ver) == 2 + assert ver >= (1, 0) + + +def test_nvvm_ir_version(): + ver = nvvm.ir_version() + assert len(ver) == 4 + assert ver >= (1, 0, 0, 0) + + +def test_nvvm_llvm_version(): + try: + ver = nvvm.llvm_version("compute_75") + except FunctionNotFoundError: + pytest.skip("nvvmLLVMVersion not available in this NVVM version") + assert isinstance(ver, int) + assert ver >= 0 + + +def test_create_and_destroy(): + with nvvm_program() as prog: + assert isinstance(prog, int) + assert prog != 0 + + +@pytest.mark.parametrize("add_fn", [nvvm.add_module_to_program, nvvm.lazy_add_module_to_program]) +def test_add_module_to_program_fail(add_fn): + with nvvm_program() as prog, pytest.raises(ValueError): + # Passing a C NULL pointer generates "ERROR_INVALID_INPUT (4)", + # but that is not possible through our Python bindings. + # The ValueError originates from the cython bindings code. + add_fn(prog, None, 0, "FileNameHere.ll") + + +def test_c_or_v_program_fail_no_module(compile_or_verify): + with nvvm_program() as prog, pytest.raises(nvvm.nvvmError, match=match_exact("ERROR_NO_MODULE_IN_PROGRAM (8)")): + compile_or_verify(prog, 0, []) + + +def test_c_or_v_program_fail_invalid_ir(compile_or_verify): + expected_error = "ERROR_COMPILATION (9)" if compile_or_verify is nvvm.compile_program else "ERROR_INVALID_IR (6)" + nvvm_ll = b"This is not NVVM IR" + with nvvm_program() as prog: + nvvm.add_module_to_program(prog, nvvm_ll, len(nvvm_ll), "FileNameHere.ll") + with pytest.raises(nvvm.nvvmError, match=match_exact(expected_error)): + compile_or_verify(prog, 0, []) + assert get_program_log(prog) == "FileNameHere.ll (1, 0): parse expected top-level entity\x00" + + +def test_c_or_v_program_fail_bad_option(minimal_nvvmir, compile_or_verify): + with nvvm_program() as prog: + nvvm.add_module_to_program(prog, minimal_nvvmir, len(minimal_nvvmir), "FileNameHere.ll") + with pytest.raises(nvvm.nvvmError, match=match_exact("ERROR_INVALID_OPTION (7)")): + compile_or_verify(prog, 1, ["BadOption"]) + assert get_program_log(prog) == "libnvvm : error: BadOption is an unsupported option\x00" + + +@pytest.mark.parametrize( + ("get_size", "get_buffer"), + [ + (nvvm.get_compiled_result_size, nvvm.get_compiled_result), + (nvvm.get_program_log_size, nvvm.get_program_log), + ], +) +def test_get_buffer_empty(get_size, get_buffer): + with nvvm_program() as prog: + buffer_size = get_size(prog) + assert buffer_size == 1 + buffer = bytearray(buffer_size) + get_buffer(prog, buffer) + assert buffer == b"\x00" + + +@pytest.mark.parametrize("options", [[], ["-opt=0"], ["-opt=3", "-g"], [b"-opt=0"]]) +def test_compile_program_with_minimal_nvvm_ir(minimal_nvvmir, options): + with nvvm_program() as prog: + nvvm.add_module_to_program(prog, minimal_nvvmir, len(minimal_nvvmir), "FileNameHere.ll") + try: + nvvm.compile_program(prog, len(options), options) + except nvvm.nvvmError as e: + raise RuntimeError(get_program_log(prog)) from e + else: + log_size = nvvm.get_program_log_size(prog) + assert log_size == 1 + buffer = bytearray(log_size) + nvvm.get_program_log(prog, buffer) + assert buffer == b"\x00" + result_size = nvvm.get_compiled_result_size(prog) + buffer = bytearray(result_size) + nvvm.get_compiled_result(prog, buffer) + assert ".visible .entry kernel()" in buffer.decode() + + +@pytest.mark.parametrize("options", [[], ["-opt=0"], ["-opt=3", "-g"]]) +def test_verify_program_with_minimal_nvvm_ir(minimal_nvvmir, options): + with nvvm_program() as prog: + nvvm.add_module_to_program(prog, minimal_nvvmir, len(minimal_nvvmir), "FileNameHere.ll") + nvvm.verify_program(prog, len(options), options) diff --git a/cuda_bindings/tests/test_utils.py b/cuda_bindings/tests/test_utils.py new file mode 100644 index 00000000000..c767996bced --- /dev/null +++ b/cuda_bindings/tests/test_utils.py @@ -0,0 +1,171 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +import importlib +import random +import subprocess +import sys +from pathlib import Path + +import pytest + +from cuda.bindings import driver, runtime +from cuda.bindings._internal.utils import get_c_compiler +from cuda.bindings.utils import ( + check_nvvm_compiler_options, + get_cuda_native_handle, + get_minimal_required_cuda_ver_from_ptx_ver, + get_ptx_ver, +) + +have_cufile = importlib.util.find_spec("cuda.bindings.cufile") is not None + + +def _is_libnvvm_available() -> bool: + from cuda.bindings._internal.nvvm import _inspect_function_pointer + from cuda.pathfinder import DynamicLibNotFoundError + + try: + return _inspect_function_pointer("__nvvmCreateProgram") != 0 + except DynamicLibNotFoundError: + return False + + +_libnvvm_available = _is_libnvvm_available() +_skip_no_libnvvm = pytest.mark.skipif(not _libnvvm_available, reason="libNVVM not available") + +ptx_88_kernel = r""" +.version 8.8 +.target sm_75 +.address_size 64 + + // .globl empty_kernel + +.visible .entry empty_kernel() +{ + ret; +} +""" + + +ptx_72_kernel = r""" +.version 7.2 +.target sm_75 +.address_size 64 + + // .globl empty_kernel + +.visible .entry empty_kernel() +{ + ret; +} +""" + + +@pytest.mark.parametrize( + "kernel,actual_ptx_ver,min_cuda_ver", ((ptx_88_kernel, "8.8", 12090), (ptx_72_kernel, "7.2", 11020)) +) +def test_ptx_utils(kernel, actual_ptx_ver, min_cuda_ver): + ptx_ver = get_ptx_ver(kernel) + assert ptx_ver == actual_ptx_ver + cuda_ver = get_minimal_required_cuda_ver_from_ptx_ver(ptx_ver) + assert cuda_ver == min_cuda_ver + + +@pytest.mark.parametrize( + "target", + ( + driver.CUcontext, + driver.CUstream, + driver.CUevent, + driver.CUmodule, + driver.CUlibrary, + driver.CUfunction, + driver.CUkernel, + driver.CUgraph, + driver.CUgraphNode, + driver.CUgraphExec, + driver.CUmemoryPool, + runtime.cudaStream_t, + runtime.cudaEvent_t, + runtime.cudaGraph_t, + runtime.cudaGraphNode_t, + runtime.cudaGraphExec_t, + runtime.cudaMemPool_t, + ), +) +def test_get_handle(target): + ptr = random.randint(1, 1024) + obj = target(ptr) + handle = get_cuda_native_handle(obj) + assert handle == ptr + + +@pytest.mark.parametrize( + "target", + ( + (1, 2, 3, 4), + [5, 6], + {}, + None, + ), +) +def test_get_handle_error(target): + with pytest.raises(TypeError) as e: + handle = get_cuda_native_handle(target) + + +@pytest.mark.parametrize( + "module", + # Top-level modules for external Python use + [ + "driver", + "nvjitlink", + "nvrtc", + "nvvm", + "runtime", + *(["cufile"] if have_cufile else []), + ], +) +def test_cyclical_imports(module): + subprocess.check_call( # noqa: S603 + [sys.executable, Path(__file__).parent / "utils" / "check_cyclical_import.py", f"cuda.bindings.{module}"], + ) + + +def test_get_c_compiler(): + c_compiler = get_c_compiler() + prefix = ("GCC", "Clang", "MSVC", "Unknown") + assert sum(c_compiler.startswith(p) for p in prefix) == 1 + + +@_skip_no_libnvvm +def test_check_nvvm_compiler_options_valid(): + assert check_nvvm_compiler_options(["-arch=compute_90"]) is True + + +@_skip_no_libnvvm +def test_check_nvvm_compiler_options_invalid(): + assert check_nvvm_compiler_options(["--this-is-not-a-valid-option"]) is False + + +@_skip_no_libnvvm +def test_check_nvvm_compiler_options_empty(): + assert check_nvvm_compiler_options([]) is True + + +@_skip_no_libnvvm +def test_check_nvvm_compiler_options_multiple_valid(): + assert check_nvvm_compiler_options(["-arch=compute_90", "-opt=3", "-g"]) is True + + +@_skip_no_libnvvm +def test_check_nvvm_compiler_options_arch_detection(): + assert check_nvvm_compiler_options(["-arch=compute_90"]) is True + assert check_nvvm_compiler_options(["-arch=compute_99999"]) is False + + +def test_check_nvvm_compiler_options_no_libnvvm(): + if _libnvvm_available: + pytest.skip("libNVVM is available; this test targets the fallback path") + assert check_nvvm_compiler_options(["-arch=compute_90"]) is False diff --git a/cuda_bindings/tests/test_version_check.py b/cuda_bindings/tests/test_version_check.py new file mode 100644 index 00000000000..03c3d7d3c2c --- /dev/null +++ b/cuda_bindings/tests/test_version_check.py @@ -0,0 +1,96 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +import os +import warnings +from unittest import mock + +import pytest + +from cuda.bindings import driver +from cuda.bindings.utils import _version_check, warn_if_cuda_major_version_mismatch + + +class TestVersionCompatibilityCheck: + """Tests for CUDA major version mismatch warning function.""" + + @pytest.fixture(autouse=True) + def reset_version_check(self, monkeypatch): + """Reset the version compatibility check flag for each test, restoring after.""" + monkeypatch.setattr(_version_check, "_major_version_compatibility_checked", False) + + def test_no_warning_when_driver_newer(self): + """No warning should be issued when driver version >= compile version.""" + # Mock compile version 12.9 and driver version 13.0 + with ( + mock.patch.object(driver, "CUDA_VERSION", 12090), + mock.patch.object(driver, "cuDriverGetVersion", return_value=(driver.CUresult.CUDA_SUCCESS, 13000)), + warnings.catch_warnings(record=True) as w, + ): + warnings.simplefilter("always") + warn_if_cuda_major_version_mismatch() + assert len(w) == 0 + + def test_no_warning_when_same_major_version(self): + """No warning should be issued when major versions match.""" + # Mock compile version 12.9 and driver version 12.8 + with ( + mock.patch.object(driver, "CUDA_VERSION", 12090), + mock.patch.object(driver, "cuDriverGetVersion", return_value=(driver.CUresult.CUDA_SUCCESS, 12080)), + warnings.catch_warnings(record=True) as w, + ): + warnings.simplefilter("always") + warn_if_cuda_major_version_mismatch() + assert len(w) == 0 + + def test_warning_when_compile_major_newer(self): + """Warning should be issued when compile major version > driver major version.""" + # Mock compile version 13.0 and driver version 12.8 + with ( + mock.patch.object(driver, "CUDA_VERSION", 13000), + mock.patch.object(driver, "cuDriverGetVersion", return_value=(driver.CUresult.CUDA_SUCCESS, 12080)), + warnings.catch_warnings(record=True) as w, + ): + warnings.simplefilter("always") + warn_if_cuda_major_version_mismatch() + assert len(w) == 1 + assert issubclass(w[0].category, UserWarning) + assert "cuda-bindings was built for CUDA major version 13" in str(w[0].message) + assert "only supports up to CUDA 12" in str(w[0].message) + + def test_warning_only_issued_once(self): + """Warning should only be issued once per process.""" + with ( + mock.patch.object(driver, "CUDA_VERSION", 13000), + mock.patch.object(driver, "cuDriverGetVersion", return_value=(driver.CUresult.CUDA_SUCCESS, 12080)), + warnings.catch_warnings(record=True) as w, + ): + warnings.simplefilter("always") + warn_if_cuda_major_version_mismatch() + warn_if_cuda_major_version_mismatch() + warn_if_cuda_major_version_mismatch() + # Only one warning despite multiple calls + assert len(w) == 1 + + def test_warning_suppressed_by_env_var(self): + """Warning should be suppressed when CUDA_PYTHON_DISABLE_MAJOR_VERSION_WARNING is set.""" + with ( + mock.patch.object(driver, "CUDA_VERSION", 13000), + mock.patch.object(driver, "cuDriverGetVersion", return_value=(driver.CUresult.CUDA_SUCCESS, 12080)), + mock.patch.dict(os.environ, {"CUDA_PYTHON_DISABLE_MAJOR_VERSION_WARNING": "1"}), + warnings.catch_warnings(record=True) as w, + ): + warnings.simplefilter("always") + warn_if_cuda_major_version_mismatch() + assert len(w) == 0 + + def test_error_when_driver_version_fails(self): + """Should raise RuntimeError if cuDriverGetVersion fails.""" + with ( + mock.patch.object(driver, "CUDA_VERSION", 13000), + mock.patch.object( + driver, "cuDriverGetVersion", return_value=(driver.CUresult.CUDA_ERROR_NOT_INITIALIZED, 0) + ), + pytest.raises(RuntimeError, match="Failed to query CUDA driver version"), + ): + warn_if_cuda_major_version_mismatch() diff --git a/cuda_bindings/tests/utils/check_cyclical_import.py b/cuda_bindings/tests/utils/check_cyclical_import.py new file mode 100644 index 00000000000..5c2106612e3 --- /dev/null +++ b/cuda_bindings/tests/utils/check_cyclical_import.py @@ -0,0 +1,42 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +""" +Tests whether importing a specific module leads to cyclical imports. + +See https://github.com/NVIDIA/cuda-python/issues/789 for more info. +""" + +import argparse + +orig_import = __builtins__.__import__ + +import_stack = [] + + +def import_hook(name, globals=None, locals=None, fromlist=(), *args, **kwargs): + """Approximate a custom import system that does not allow import cycles.""" + + stack_entry = (tuple(fromlist) if fromlist is not None else None, name) + if stack_entry in import_stack and name.startswith("cuda.bindings."): + raise ImportError(f"Import cycle detected: {stack_entry}, stack: {import_stack}") + import_stack.append(stack_entry) + try: + res = orig_import(name, globals, locals, fromlist, *args, **kwargs) + finally: + import_stack.pop() + return res + + +__builtins__.__import__ = import_hook + + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument( + "module", + type=str, + ) + args = parser.parse_args() + + __import__(args.module) diff --git a/cuda_core/.git_archival.txt b/cuda_core/.git_archival.txt new file mode 120000 index 00000000000..d7a42b253d8 --- /dev/null +++ b/cuda_core/.git_archival.txt @@ -0,0 +1 @@ +../.git_archival.txt \ No newline at end of file diff --git a/cuda_core/AGENTS.md b/cuda_core/AGENTS.md new file mode 100644 index 00000000000..45fc2481042 --- /dev/null +++ b/cuda_core/AGENTS.md @@ -0,0 +1,146 @@ +This file describes `cuda_core`, the high-level Pythonic CUDA subpackage in the +`cuda-python` monorepo. + +## Scope and principles + +- **Role**: provide higher-level CUDA abstractions (`Device`, `Stream`, + `Program`, `Linker`, memory resources, graphs) on top of `cuda.bindings`. +- **API intent**: keep interfaces Pythonic while preserving explicit CUDA + behavior and error visibility. +- **Compatibility**: changes should remain compatible with supported + `cuda.bindings` major versions (12.x and 13.x). + +## Package architecture + +- **Main package**: `cuda/core/` contains most Cython modules (`*.pyx`, `*.pxd`) + implementing runtime behaviors and public objects. +- **Subsystems**: + - memory/resource stack: `cuda/core/_memory/` + - system-level APIs: `cuda/core/system/` + - compile/link path: `_program.pyx`, `_linker.pyx`, `_module.pyx` + - execution path: `_launcher.pyx`, `_launch_config.pyx`, `_stream.pyx` +- **C++ helpers**: module-specific C++ implementations live under + `cuda/core/_cpp/`. +- **Build backend**: `build_hooks.py` handles Cython extension setup and build + dependency wiring. + +## Build and version coupling + +- `build_hooks.py` determines CUDA major version from `CUDA_CORE_BUILD_MAJOR` + or CUDA headers (`CUDA_HOME`/`CUDA_PATH`) and uses it for build decisions. +- Source builds require CUDA headers available through `CUDA_HOME` or + `CUDA_PATH`. +- `cuda_core` expects `cuda.bindings` to be present and version-compatible. + +## Testing expectations + +- **Primary tests**: `pytest tests/` +- **Cython tests**: + - build: `tests/cython/build_tests.sh` (or platform equivalent) + - run: `pytest tests/cython/` +- **Examples**: validate affected examples in `examples/` when changing user + workflows or public APIs. + +## Runtime/build environment notes + +- Runtime env vars commonly relevant: + - `CUDA_PYTHON_CUDA_PER_THREAD_DEFAULT_STREAM` + - `CUDA_PYTHON_DISABLE_MAJOR_VERSION_WARNING` +- Build env vars commonly relevant: + - `CUDA_HOME` / `CUDA_PATH` + - `CUDA_CORE_BUILD_MAJOR` + - `CUDA_PYTHON_PARALLEL_LEVEL` + - `CUDA_PYTHON_COVERAGE` + +## Editing guidance + +- Keep user-facing behaviors coherent with docs and examples, especially around + stream semantics, memory ownership, and compile/link flows. +- Reuse existing shared utilities in `cuda/core/_utils/` before adding new + helpers. +- When changing Cython signatures or cimports, verify related `.pxd` and + call-site consistency. +- Prefer explicit error propagation over silent fallback paths. +- If you change public behavior, update tests and docs under `docs/source/`. + +## API design guidelines + +These are some API design guidelines we try to follow when adding new APIs to +`cuda.core`. These rules only apply to public APIs. Private implementation +details can violate these rules at any time. + +Public APIs are defined as symbols defined in `__all__` within modules or +subpackages that are not prefixed with `_`. + +In code reviews, any violations of this section should be considered +suggestions, not hard rules. Consistency with existing API design in this code +base is also important. + +### Unintentional exposure of symbols + +The following things should not be exposed as part of the public API: + +- Private symbols (prefixed with `_`) +- Symbols from a third-party module or the standard library +- Helper classes that can not be instantiated from Python + +### Naming + +As a blanket rule, we follow the naming guidelines for capitalization in PEP 8. + +Naming should be consistent. We should use the same English words for the same +concepts throughout the public API. When abbreviations are used, they should be +commonly understood, and they should also be used consistently across the public +API. + +For all attributes of a class: + +- Properties and member variables should be nouns +- Methods should be verbs +- Methods that take no arguments, are idempotent and cheap (O(1) or trivial), + and do not mutate observable state should be properties + +Make sure conceptual pairs match, e.g. add/remove, get/set, create/delete, +alloc/free. + +Free functions should be verbs. + +### Enumerations + +Enumerations from the underlying `cuda_bindings` should not be re-exposed. +Instead, a new `StrEnum` subclass should be used to define the values. Anywhere +a `StrEnum` is accepted as an argument, a `str` should also be acceptable. An +invalid value should raise an exception. When a function returns a `str` drawn +from a small number of values, return a `StrEnum` subclass instead. + +### Exception handling + +Raising exceptions is preferred over a C-style return code that must be checked +by the user. + +### Type annotations + +Python or Cython type annotations should be included for all public APIs. Avoid +the use of `Any` unless absolutely necessary. The argument and return types as +defined in the docstrings should match the type annotations. + +Python imports should generally be outside of an if typing.TYPE_CHECK: block, even if the imported object is only used in type annotations. Use if typing.TYPE_CHECK: only to avoid creating import cycles. (This guidance maximizes compatibility with the cross-reference mechanisms in Sphinx.) + +### Semantics + +APIs should exist for both manual resource management (such as `close()`) and +automatic resource management, using context managers or destructors where +appropriate. Context managers should be implemented with `__enter__` and +`__exit__`, not `contextlib.contextmanager`. For destructors use `__dealloc__` +where possible, otherwise `__del__`. + +### Documentation + +The entirety of the public API should be documented in `api.rst` or one of the +subpages linked from it. Classes that are not directly instantiable but which +may be returned through the public API should be documented in `api_private.rst` +so that they are documented but don't appear in the main index. + +### API stability + +Reviews should point out where existing public APIs are broken. diff --git a/cuda_core/CLAUDE.md b/cuda_core/CLAUDE.md new file mode 120000 index 00000000000..47dc3e3d863 --- /dev/null +++ b/cuda_core/CLAUDE.md @@ -0,0 +1 @@ +AGENTS.md \ No newline at end of file diff --git a/cuda_core/DESCRIPTION.rst b/cuda_core/DESCRIPTION.rst new file mode 100644 index 00000000000..148648cfef9 --- /dev/null +++ b/cuda_core/DESCRIPTION.rst @@ -0,0 +1,29 @@ +.. SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +******************************************************* +cuda-core: Pythonic access to CUDA core functionalities +******************************************************* + +.. image:: https://img.shields.io/badge/NVIDIA-black?logo=nvidia + :target: https://www.nvidia.com/ + :alt: NVIDIA + +`cuda.core `_ bridges Python's productivity with CUDA's performance through intuitive and pythonic APIs. The mission is to provide users full access to all of the core CUDA features in Python, such as runtime control, compiler and linker. + +* `Repository `_ +* `Documentation `_ +* `Examples `_ +* `Issue tracker `_ + +``cuda.core`` is currently under active development. Feedback and suggestions are welcome! + + +Installation +============ + +.. code-block:: bash + + pip install cuda-core[cu12] + +Please refer to the `installation instructions `_ for different ways of installing ``cuda.core``, including building from source. diff --git a/cuda_core/LICENSE b/cuda_core/LICENSE new file mode 100644 index 00000000000..d6f74778be8 --- /dev/null +++ b/cuda_core/LICENSE @@ -0,0 +1,178 @@ +Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS diff --git a/cuda_core/MANIFEST.in b/cuda_core/MANIFEST.in new file mode 100644 index 00000000000..f63b324cab7 --- /dev/null +++ b/cuda_core/MANIFEST.in @@ -0,0 +1,9 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +recursive-include cuda/core *.pyx *.pxd *.pxi *.pyi +recursive-include cuda/core/_cpp *.cpp *.h *.hpp +recursive-include cuda/core/_include *.h *.hpp +include cuda/core/py.typed +include NOTICE diff --git a/cuda_core/NOTICE b/cuda_core/NOTICE new file mode 100644 index 00000000000..c4625e23899 --- /dev/null +++ b/cuda_core/NOTICE @@ -0,0 +1,13 @@ +SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +SPDX-License-Identifier: Apache-2.0 + +CUDA Python - cuda.core +Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + +Third-party software notices +---------------------------- + +DLPack +Copyright (c) 2017 by Contributors +Licensed under the Apache License, Version 2.0. +Source: https://github.com/dmlc/dlpack diff --git a/cuda_core/README.md b/cuda_core/README.md new file mode 100644 index 00000000000..74b2b6638f7 --- /dev/null +++ b/cuda_core/README.md @@ -0,0 +1,36 @@ +# `cuda.core`: Pythonic CUDA module + +Currently under active development; see [the documentation](https://nvidia.github.io/cuda-python/cuda-core/latest/) for more details. + +## Installing + +Please refer to the [Installation page](https://nvidia.github.io/cuda-python/cuda-core/latest/install.html) for instructions and required/optional dependencies. + +## Developing + +This subpackage adheres to the developing practices described in the parent metapackage [CONTRIBUTING.md](https://github.com/NVIDIA/cuda-python/blob/main/CONTRIBUTING.md). + +## Debugging + +Pass the `pip` / `uv` configuration option `-C="debug=True"` or +`--config-settings="debug=True"` to explicitly to build debuggable binaries. +Debuggable binaries are built by default for editable builds. + +Debuggable builds are not supported on Windows. + +## Testing + +To run these tests: +* `python -m pytest tests/` with editable installations +* `pytest tests/` with installed packages + +### Cython Unit Tests + +Cython tests are located in `tests/cython` and need to be built. These builds have the same CUDA Toolkit header requirements as [those of cuda.bindings](https://nvidia.github.io/cuda-python/cuda-bindings/latest/install.html#requirements) where the major.minor version must match `cuda.bindings`. To build them: + +1. Set up environment variable `CUDA_PATH` (or `CUDA_HOME`) with the path to the CUDA Toolkit installation. Note: If both are set, `CUDA_PATH` takes precedence. +2. Run `build_tests` script located in `tests/cython` appropriate to your platform. This will both cythonize the tests and build them. + +To run these tests: +* `python -m pytest tests/cython/` with editable installations +* `pytest tests/cython/` with installed packages diff --git a/cuda_core/build_hooks.py b/cuda_core/build_hooks.py new file mode 100644 index 00000000000..dfd08d56733 --- /dev/null +++ b/cuda_core/build_hooks.py @@ -0,0 +1,339 @@ +# SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +# This module implements basic PEP 517 backend support, see e.g. +# - https://peps.python.org/pep-0517/ +# - https://setuptools.pypa.io/en/latest/build_meta.html#dynamic-build-dependencies-and-other-build-meta-tweaks +# Specifically, there are 5 APIs required to create a proper build backend, see below. + +import functools +import glob +import os +import re +import sys +import tempfile +import zipfile +from pathlib import Path + +from Cython.Build import cythonize +from setuptools import Extension +from setuptools import build_meta as _build_meta + +prepare_metadata_for_build_editable = _build_meta.prepare_metadata_for_build_editable +prepare_metadata_for_build_wheel = _build_meta.prepare_metadata_for_build_wheel +build_sdist = _build_meta.build_sdist +get_requires_for_build_sdist = _build_meta.get_requires_for_build_sdist + +COMPILE_FOR_COVERAGE = bool(int(os.environ.get("CUDA_PYTHON_COVERAGE", "0"))) + + +# Please keep in sync with the copy in cuda_bindings/build_hooks.py. +def _import_get_cuda_path_or_home(): + """Import get_cuda_path_or_home, working around PEP 517 namespace shadowing. + + See https://github.com/NVIDIA/cuda-python/issues/1824 for why this helper is needed. + """ + try: + import cuda.pathfinder + except ModuleNotFoundError as exc: + if exc.name not in ("cuda", "cuda.pathfinder"): + raise + try: + import cuda + except ModuleNotFoundError: + cuda = None + + for p in sys.path: + sp_cuda = os.path.join(p, "cuda") + if os.path.isdir(os.path.join(sp_cuda, "pathfinder")): + cuda.__path__ = list(cuda.__path__) + [sp_cuda] + break + else: + raise ModuleNotFoundError( + "cuda-pathfinder is not installed in the build environment. " + "Ensure 'cuda-pathfinder>=1.5' is in build-system.requires." + ) + import cuda.pathfinder + + return cuda.pathfinder.get_cuda_path_or_home + + +@functools.cache +def _get_cuda_path() -> str: + get_cuda_path_or_home = _import_get_cuda_path_or_home() + cuda_path = get_cuda_path_or_home() + if not cuda_path: + raise RuntimeError("Environment variable CUDA_PATH or CUDA_HOME is not set") + print("CUDA path:", cuda_path) + return cuda_path + + +@functools.cache +def _determine_cuda_major_version() -> str: + """Determine the CUDA major version for building cuda.core. + + This version is used for two purposes: + 1. Determining which cuda-bindings version to install as a build dependency + 2. Setting CUDA_CORE_BUILD_MAJOR for Cython compile-time conditionals + + The version is derived from (in order of priority): + 1. CUDA_CORE_BUILD_MAJOR environment variable (explicit override, e.g. in CI) + 2. CUDA_VERSION macro in cuda.h from CUDA_PATH or CUDA_HOME + + Since CUDA_PATH or CUDA_HOME is required for the build (to provide include + directories), the cuda.h header should always be available. + """ + # Explicit override, e.g. in CI. + cuda_major = os.environ.get("CUDA_CORE_BUILD_MAJOR") + if cuda_major is not None: + print("CUDA MAJOR VERSION:", cuda_major) + return cuda_major + + # Derive from the CUDA headers (the authoritative source for what we compile against). + cuda_path = _get_cuda_path() + cuda_h = os.path.join(cuda_path, "include", "cuda.h") + try: + with open(cuda_h, encoding="utf-8") as f: + for line in f: + m = re.match(r"^#\s*define\s+CUDA_VERSION\s+(\d+)\s*$", line) + if m: + v = int(m.group(1)) + # CUDA_VERSION is e.g. 12020 for 12.2. + cuda_major = str(v // 1000) + print("CUDA MAJOR VERSION:", cuda_major) + return cuda_major + except OSError: + pass + + # CUDA_PATH or CUDA_HOME is required for the build, so we should not reach here + # in normal circumstances. Raise an error to make the issue clear. + raise RuntimeError( + "Cannot determine CUDA major version. " + "Set CUDA_CORE_BUILD_MAJOR environment variable, or ensure CUDA_PATH or CUDA_HOME " + "points to a valid CUDA installation with include/cuda.h." + ) + + +# used later by setup() +_extensions = None + + +def _build_cuda_core(debug=False): + # Customizing the build hooks is needed because we must defer cythonization until cuda-bindings, + # now a required build-time dependency that's dynamically installed via the other hook below, + # is installed. Otherwise, cimport any cuda.bindings modules would fail! + # + # This function populates "_extensions". + global _extensions + + # Add cuda-bindings to sys.path so Cython can find .pxd files + # This is needed for editable installs where meta path finders don't work for Cython + # We need to add the directory containing the 'cuda' package so Cython can resolve + # "from cuda.bindings cimport cydriver" + try: + import cuda.bindings + + bindings_path = Path(cuda.bindings.__file__).parent # .../cuda/bindings/ + cuda_package_dir = bindings_path.parent.parent # .../cuda_bindings/ (contains cuda/) + if str(cuda_package_dir) not in sys.path: + sys.path.insert(0, str(cuda_package_dir)) + print(f"Added cuda-bindings parent path for Cython: {cuda_package_dir}", file=sys.stderr) + except ImportError: + # cuda-bindings not available in editable mode, will use installed version + pass + + _posix_only_modules = frozenset( + { + "_utils/_wsl_locale", + } + ) + + # It seems setuptools' wildcard support has problems for namespace packages, + # so we explicitly spell out all Extension instances. + def module_names(): + root_path = os.path.sep.join(["cuda", "core", ""]) + for filename in glob.glob(f"{root_path}/**/*.pyx", recursive=True): + mod = filename[len(root_path) : -4] + if sys.platform == "win32" and mod.replace(os.path.sep, "/") in _posix_only_modules: + continue + yield mod + + def get_sources(mod_name): + """Get source files for a module, including any .cpp files.""" + sources = [f"cuda/core/{mod_name}.pyx"] + + # Add module-specific .cpp file from _cpp/ directory if it exists + # Example: _resource_handles.pyx finds _cpp/resource_handles.cpp. + cpp_file = f"cuda/core/_cpp/{mod_name.lstrip('_')}.cpp" + if os.path.exists(cpp_file): + sources.append(cpp_file) + + return sources + + all_include_dirs = [os.path.join(_get_cuda_path(), "include")] + extra_compile_args = [] + extra_link_args = [] + extra_cythonize_kwargs = {} + if sys.platform == "win32": + extra_compile_args += ["/std:c++17"] + if debug: + raise RuntimeError("Debuggable builds are not supported on Windows.") + else: + extra_compile_args += ["-std=c++17"] + if debug: + extra_cythonize_kwargs["gdb_debug"] = True + extra_compile_args += ["-g", "-O0"] + extra_compile_args += ["-D _GLIBCXX_ASSERTIONS"] + else: + extra_compile_args += ["-O2"] + extra_link_args += ["-Wl,--strip-all"] + if COMPILE_FOR_COVERAGE: + # CYTHON_TRACE_NOGIL indicates to trace nogil functions. It is not + # related to free-threading builds. + extra_compile_args += ["-DCYTHON_TRACE_NOGIL=1", "-DCYTHON_USE_SYS_MONITORING=0"] + + ext_modules = tuple( + Extension( + f"cuda.core.{mod.replace(os.path.sep, '.')}", + sources=get_sources(mod), + include_dirs=[ + "cuda/core/_include", + "cuda/core/_cpp", + ] + + all_include_dirs, + language="c++", + extra_compile_args=extra_compile_args, + extra_link_args=extra_link_args, + ) + for mod in module_names() + ) + + nthreads = int(os.environ.get("CUDA_PYTHON_PARALLEL_LEVEL", os.cpu_count() // 2)) + compile_time_env = {"CUDA_CORE_BUILD_MAJOR": int(_determine_cuda_major_version())} + compiler_directives = {"embedsignature": True, "warn.deprecated.IF": False, "freethreading_compatible": True} + if COMPILE_FOR_COVERAGE: + compiler_directives["linetrace"] = True + _extensions = cythonize( + ext_modules, + verbose=True, + language_level=3, + build_dir="." if COMPILE_FOR_COVERAGE else "build/cython", + nthreads=nthreads, + compiler_directives=compiler_directives, + compile_time_env=compile_time_env, + **extra_cythonize_kwargs, + ) + + return + + +def _add_cython_include_paths_to_pth(wheel_path: str) -> None: + """ + Modify the .pth file in an editable install wheel to add Cython include paths. + + This is needed because Cython cannot find .pxd files through meta path finders, + it only looks in sys.path directories. By adding direct paths to the .pth file, + we enable Cython to find .pxd files from editable-installed cuda-bindings. + + See: https://github.com/scikit-build/scikit-build-core/pull/516 + See: https://github.com/cython/cython/issues/7326 + """ + # Find cuda-bindings location + # When building with pixi path dependencies, cuda-bindings should be importable + try: + import cuda.bindings + + bindings_path = Path(cuda.bindings.__file__).parent # .../cuda/bindings/ + # We need the directory containing the 'cuda' package for Cython imports + cuda_package_dir = bindings_path.parent.parent # .../cuda_bindings/ (contains cuda/) + print(f"Found cuda-bindings at: {bindings_path}", file=sys.stderr) + print(f"Will add to .pth for Cython: {cuda_package_dir}", file=sys.stderr) + except ImportError: + # If cuda-bindings isn't available yet, we can't add the path + # This might happen in some build scenarios, but it's okay - the + # wildcard dependency will work in those cases + print("cuda-bindings not found in current environment, skipping .pth modification") + return + + # Create a temporary directory for wheel manipulation + with tempfile.TemporaryDirectory() as tmpdir: + tmpdir_path = Path(tmpdir) + wheel_file = Path(wheel_path) + + # Extract the wheel + extract_dir = tmpdir_path / "extracted" + with zipfile.ZipFile(wheel_file, "r") as zf: + zf.extractall(extract_dir) + + # Find the .pth file (should be named something like __editable___cuda_core-*.pth) + pth_files = list(extract_dir.glob("**/*.pth")) + if not pth_files: + print("Warning: No .pth file found in editable wheel", file=sys.stderr) + return + + # Modify each .pth file (usually just one) + for pth_file in pth_files: + print(f"Modifying {pth_file.name} to add Cython include paths", file=sys.stderr) + + # Read existing content + content = pth_file.read_text() + + # Add the cuda-bindings source path to sys.path for Cython + # This allows Cython to find .pxd files via direct path lookup + # The path must be the directory containing the 'cuda' package + path_to_add = str(cuda_package_dir.absolute()) + + # Ensure content ends with newline before adding path + if not content.endswith("\n"): + content += "\n" + + # Append to the .pth file (after the import hook line) + if path_to_add not in content: + pth_file.write_text(content + path_to_add + "\n") + print(f"Added Cython include path: {cuda_package_dir}", file=sys.stderr) + + # Repackage the wheel + # Remove the old wheel first + wheel_file.unlink() + + # Create new wheel with same name + with zipfile.ZipFile(wheel_file, "w", zipfile.ZIP_DEFLATED) as zf: + for file_path in extract_dir.rglob("*"): + if file_path.is_file(): + arcname = file_path.relative_to(extract_dir) + zf.write(file_path, arcname) + + print(f"Successfully patched {wheel_file.name}", file=sys.stderr) + + +def build_editable(wheel_directory, config_settings=None, metadata_directory=None): + debug_default = sys.platform != "win32" # Debug builds not supported on Windows + debug = config_settings.get("debug", debug_default) if config_settings else debug_default + _build_cuda_core(debug=debug) + wheel_name = _build_meta.build_editable(wheel_directory, config_settings, metadata_directory) + + # Patch the .pth file to add Cython include paths + wheel_path = os.path.join(wheel_directory, wheel_name) + _add_cython_include_paths_to_pth(wheel_path) + + return wheel_name + + +def build_wheel(wheel_directory, config_settings=None, metadata_directory=None): + debug = config_settings.get("debug", False) if config_settings else False + _build_cuda_core(debug=debug) + return _build_meta.build_wheel(wheel_directory, config_settings, metadata_directory) + + +def _get_cuda_bindings_require(): + cuda_major = _determine_cuda_major_version() + return [f"cuda-bindings=={cuda_major}.*"] + + +def get_requires_for_build_editable(config_settings=None): + return _build_meta.get_requires_for_build_editable(config_settings) + _get_cuda_bindings_require() + + +def get_requires_for_build_wheel(config_settings=None): + return _build_meta.get_requires_for_build_wheel(config_settings) + _get_cuda_bindings_require() diff --git a/cuda/benchmarks/__init__.py b/cuda_core/cuda/core/__init__.pxd similarity index 100% rename from cuda/benchmarks/__init__.py rename to cuda_core/cuda/core/__init__.pxd diff --git a/cuda_core/cuda/core/__init__.py b/cuda_core/cuda/core/__init__.py new file mode 100644 index 00000000000..dc6fefdffea --- /dev/null +++ b/cuda_core/cuda/core/__init__.py @@ -0,0 +1,121 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from cuda.core._version import __version__ + + +def _import_versioned_module() -> None: + import importlib + + from cuda import bindings + + cuda_major = bindings.__version__.split(".")[0] + if cuda_major not in ("12", "13"): + raise ImportError("cuda.bindings 12.x or 13.x must be installed") + + subdir = f"cu{cuda_major}" + try: + versioned_mod = importlib.import_module(f".{subdir}", __package__) + # Import all symbols from the module + globals().update(versioned_mod.__dict__) + except ImportError: + # This is not a wheel build, but a conda or local build, do nothing + pass + + +_import_versioned_module() +del _import_versioned_module + + +def _patch_rlcompleter_for_cython_properties() -> None: + # TODO: This can be removed when Python 3.13 is our minimum-supported version: + # https://github.com/python/cpython/pull/149577 + + # Cython @property on cdef class compiles to a C-level getset_descriptor, + # which rlcompleter's narrow isinstance(..., property) check misses; the + # fallback getattr() then invokes the descriptor and any non-AttributeError + # it raises kills tab completion. Extend that isinstance check to also + # match getset_descriptor / member_descriptor. Only installed in + # interactive mode so library users running scripts see no global + # rlcompleter side effect. + import os + + if int(os.environ.get("CUDA_CORE_DONT_FIX_TAB_COMPLETION", "0")): + # Explicit opt-out for users who don't want the global rlcompleter + # side effect, even in an interactive session. + return + + import rlcompleter + from types import GetSetDescriptorType, MemberDescriptorType + + # This works by overriding the `property` built-in with a custom subclass of + # property, but only in the rlcompleter module. This subclass overrides the + # `__instancecheck__` method to also return True for getset_descriptor and + # member_descriptor types, which are what Cython uses for properties on cdef + # classes. + class _PatchedPropMeta(type): + def __instancecheck__(cls, inst: object) -> bool: + return isinstance(inst, (property, GetSetDescriptorType, MemberDescriptorType)) + + class _PatchedProperty(metaclass=_PatchedPropMeta): + pass + + rlcompleter.property = _PatchedProperty # type: ignore[attr-defined] + + +_patch_rlcompleter_for_cython_properties() +del _patch_rlcompleter_for_cython_properties + + +from cuda.core import checkpoint, system, utils +from cuda.core._context import Context, ContextOptions +from cuda.core._device import Device +from cuda.core._device_resources import ( + DeviceResources, + SMResource, + SMResourceOptions, + WorkqueueResource, + WorkqueueResourceOptions, +) +from cuda.core._event import Event, EventOptions +from cuda.core._graphics import GraphicsResource +from cuda.core._host import Host +from cuda.core._launch_config import LaunchConfig +from cuda.core._launcher import launch +from cuda.core._linker import Linker, LinkerOptions +from cuda.core._memory import ( + Buffer, + DeviceMemoryResource, + DeviceMemoryResourceOptions, + GraphMemoryResource, + LegacyPinnedMemoryResource, + ManagedBuffer, + ManagedMemoryResource, + ManagedMemoryResourceOptions, + MemoryResource, + PinnedMemoryResource, + PinnedMemoryResourceOptions, + VirtualMemoryResource, + VirtualMemoryResourceOptions, +) +from cuda.core._module import Kernel, ObjectCode +from cuda.core._program import Program, ProgramOptions +from cuda.core._stream import ( + LEGACY_DEFAULT_STREAM, + PER_THREAD_DEFAULT_STREAM, + Stream, + StreamOptions, +) +from cuda.core._tensor_map import TensorMapDescriptor, TensorMapDescriptorOptions + +# isort: split +# Texture/surface types live under the cuda.core.texture namespace (not the +# flat cuda.core namespace); import the subpackage so it is available as +# `cuda.core.texture` after `import cuda.core`. +# Must come after the cuda.core._* extension imports above: loading graph +# earlier interacts badly with the merged-wheel __path__ rewrite and leaves +# Graph/GraphBuilder/GraphCompleteOptions/GraphDebugPrintOptions missing from +# cuda.core.graph. +import cuda.core.graph +import cuda.core.texture diff --git a/cuda_core/cuda/core/_context.pxd b/cuda_core/cuda/core/_context.pxd new file mode 100644 index 00000000000..b0edf5a0674 --- /dev/null +++ b/cuda_core/cuda/core/_context.pxd @@ -0,0 +1,25 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from cuda.core._resource_handles cimport ContextHandle, GreenCtxHandle + +cdef class Context: + """Cython declaration for Context class. + + This class provides access to CUDA contexts. Context objects cannot be + instantiated directly - use factory methods or Device/Stream APIs. + """ + + cdef: + ContextHandle _h_context + int _device_id + object __weakref__ + + @staticmethod + cdef Context _from_handle(type cls, ContextHandle h_context, int device_id) + + @staticmethod + cdef Context _from_green_ctx(type cls, GreenCtxHandle h_green_ctx, int device_id) + + cpdef close(self) diff --git a/cuda_core/cuda/core/_context.pyi b/cuda_core/cuda/core/_context.pyi new file mode 100644 index 00000000000..afbc130882e --- /dev/null +++ b/cuda_core/cuda/core/_context.pyi @@ -0,0 +1,87 @@ +# This file was generated by stubgen-pyx v0.2.6 from cuda_core/cuda/core/_context.pyx + +from __future__ import annotations + +from collections.abc import Sequence +from dataclasses import dataclass + +import cuda.bindings.driver +from cuda.core._device_resources import (DeviceResources, SMResource, + WorkqueueResource) +from cuda.core._stream import Stream + + +class Context: + """CUDA context wrapper. + + Context objects represent CUDA contexts and cannot be instantiated directly. + Use Device or Stream APIs to obtain context objects. + """ + + def close(self): + """Release this context wrapper's underlying CUDA handles.""" + + def __init__(self, *args, **kwargs) -> None: + ... + + @property + def handle(self) -> cuda.bindings.driver.CUcontext | None: + """Return the underlying CUcontext handle.""" + + @property + def _handle(self) -> cuda.bindings.driver.CUcontext | None: + ... + + @property + def is_green(self) -> bool: + """True if this context was created from device resources.""" + + @property + def resources(self) -> DeviceResources: + """Query the hardware resources provisioned for this context. + + For green contexts, returns the resources this context was created + with (SM partition, workqueue config). For primary contexts, returns + the full device resources. + + Raises :class:`RuntimeError` if the context has been closed. + """ + + def create_stream(self, options: object=None) -> Stream: + """Create a new stream bound to this green context. + + This method is only available on green contexts. For primary + contexts, use :meth:`Device.create_stream` instead. + + Parameters + ---------- + options : :obj:`~_stream.StreamOptions`, optional + Customizable dataclass for stream creation options. + + Returns + ------- + :obj:`~_stream.Stream` + Newly created stream object. + """ + + def __eq__(self, other: object) -> bool: + ... + + def __hash__(self) -> int: + ... + + def __repr__(self) -> str: + ... + +@dataclass +class ContextOptions: + """Options for context creation. + + Attributes + ---------- + resources : :obj:`~cuda.core.typing.DeviceResourcesType` + Device resources used to create a green context. + """ + resources: DeviceResourcesType +__all__ = ['Context', 'ContextOptions'] +DeviceResourcesType = Sequence[SMResource | WorkqueueResource] \ No newline at end of file diff --git a/cuda_core/cuda/core/_context.pyx b/cuda_core/cuda/core/_context.pyx new file mode 100644 index 00000000000..6da72addb0d --- /dev/null +++ b/cuda_core/cuda/core/_context.pyx @@ -0,0 +1,159 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from __future__ import annotations + +from collections.abc import Sequence +from dataclasses import dataclass +from typing import TYPE_CHECKING + +from cuda.bindings cimport cydriver +from cuda.core._device_resources cimport DeviceResources, SMResource, WorkqueueResource +from cuda.core._device_resources import SMResource, WorkqueueResource +from cuda.core._resource_handles cimport ( + ContextHandle, + GreenCtxHandle, + as_cu, + create_context_handle_from_green_ctx, + get_context_green_ctx, + get_last_error, + as_intptr, + as_py, +) +from cuda.core._stream import Stream +from cuda.core._utils.cuda_utils cimport HANDLE_RETURN + +if TYPE_CHECKING: + import cuda.bindings.driver # no-cython-lint + + +__all__ = ['Context', 'ContextOptions'] + + +DeviceResourcesType = Sequence[SMResource | WorkqueueResource] + + +cdef class Context: + """CUDA context wrapper. + + Context objects represent CUDA contexts and cannot be instantiated directly. + Use Device or Stream APIs to obtain context objects. + """ + + def __init__(self, *args, **kwargs) -> None: + raise RuntimeError("Context objects cannot be instantiated directly. Please use Device or Stream APIs.") + + @staticmethod + cdef Context _from_handle(type cls, ContextHandle h_context, int device_id): + """Create Context from existing ContextHandle (cdef-only factory).""" + cdef Context ctx = cls.__new__(cls) + ctx._h_context = h_context + ctx._device_id = device_id + return ctx + + @staticmethod + cdef Context _from_green_ctx(type cls, GreenCtxHandle h_green_ctx, int device_id): + """Create Context from an owning green context handle.""" + cdef ContextHandle h_context = create_context_handle_from_green_ctx(h_green_ctx) + if not h_context: + HANDLE_RETURN(get_last_error()) + raise RuntimeError("Failed to create CUDA context view from green context") + return Context._from_handle(cls, h_context, device_id) + + @property + def handle(self) -> cuda.bindings.driver.CUcontext | None: + """Return the underlying CUcontext handle.""" + if not self._h_context: + return None + if as_cu(self._h_context) == NULL: + return None + return as_py(self._h_context) + + @property + def _handle(self) -> cuda.bindings.driver.CUcontext | None: + return self.handle + + @property + def is_green(self) -> bool: + """True if this context was created from device resources.""" + if not self._h_context: + return False + return get_context_green_ctx(self._h_context).get() != NULL + + @property + def resources(self) -> DeviceResources: + """Query the hardware resources provisioned for this context. + + For green contexts, returns the resources this context was created + with (SM partition, workqueue config). For primary contexts, returns + the full device resources. + + Raises :class:`RuntimeError` if the context has been closed. + """ + if not self._h_context: + raise RuntimeError("Cannot query resources on a closed context") + return DeviceResources._init_from_ctx(self._h_context, self._device_id) + + def create_stream(self, options: object = None) -> Stream: + """Create a new stream bound to this green context. + + This method is only available on green contexts. For primary + contexts, use :meth:`Device.create_stream` instead. + + Parameters + ---------- + options : :obj:`~_stream.StreamOptions`, optional + Customizable dataclass for stream creation options. + + Returns + ------- + :obj:`~_stream.Stream` + Newly created stream object. + """ + if not self._h_context: + raise RuntimeError("Cannot create a stream on a closed context") + if not self.is_green: + raise RuntimeError( + "Context.create_stream() is only supported on green contexts. " + "Use Device.create_stream() for primary contexts." + ) + + return Stream._init(options=options, device_id=self._device_id, ctx=self) + + cpdef close(self): + """Release this context wrapper's underlying CUDA handles.""" + cdef cydriver.CUcontext current_ctx + if self._h_context and as_cu(self._h_context) != NULL: + with nogil: + HANDLE_RETURN(cydriver.cuCtxGetCurrent(¤t_ctx)) + if current_ctx == as_cu(self._h_context): + raise RuntimeError( + "Cannot close a CUDA context while it is current. " + "Restore a previous context before closing this context." + ) + self._h_context.reset() + + def __eq__(self, other: object) -> bool: + if not isinstance(other, Context): + return NotImplemented + cdef Context _other = other + return as_intptr(self._h_context) == as_intptr(_other._h_context) + + def __hash__(self) -> int: + return hash(as_intptr(self._h_context)) + + def __repr__(self) -> str: + return f"" + + +@dataclass +cdef class ContextOptions: + """Options for context creation. + + Attributes + ---------- + resources : :obj:`~cuda.core.typing.DeviceResourcesType` + Device resources used to create a green context. + """ + resources: DeviceResourcesType diff --git a/cuda_core/cuda/core/_cpp/DESIGN.md b/cuda_core/cuda/core/_cpp/DESIGN.md new file mode 100644 index 00000000000..713d64e00fe --- /dev/null +++ b/cuda_core/cuda/core/_cpp/DESIGN.md @@ -0,0 +1,306 @@ +# Resource Handles Design + +This document describes the resource handle abstraction in cuda.core, which provides +robust lifetime management for CUDA resources. + +## Overview + +The cuda-core Python library provides a high-level interface to CUDA resources such as +Context, Device, Stream, and Event. These objects correspond to resources managed by +the CUDA Driver API, each having explicit creation and destruction routines. Several +of these CUDA resources also participate in non-trivial ownership hierarchies (e.g., +a stream belongs to a context), and releasing them may require additional arguments +or other resources (e.g., a device pointer freed through a specific stream). + +### Goals + +The goal of the handle abstraction is to provide a robust, explicit, and Python-agnostic +layer for ownership and lifetime management of CUDA resources. The intent is to use +handles as the backbone of the cuda-core resource hierarchy, enabling cuda-core Python +objects to manipulate handles rather than work directly with raw CUDA resources. + +While Python-facing objects expose convenient APIs and additional behaviors, the handle +layer isolates all concerns related to resource lifetime. By cleanly separating these +responsibilities, we achieve: + +- **Clearer architecture** with minimal cross-layer coupling +- **Safe transfer of resource ownership** between Python and other domains, including C++ +- **Ability to preserve resource validity** independent of Python +- **Well-specified semantics** for immutability, ownership, and reachability +- **Simplified reasoning about resource lifetimes**, especially with nested or dependent resources + +### Handle Semantics + +Resource handles provide **referentially transparent** wrappers around CUDA resources: + +- **No rebinding**: A handle always refers to the same resource. +- **No invalidation**: If a handle exists, its resource is valid. +- **Structural dependencies**: If resource A depends on resource B, A's handle + embeds B's handle, automatically extending B's lifetime. + +This eliminates global lifetime analysis. Correctness is enforced structurally—if you +have a handle, you have a valid resource. + +## Handle Types + +All handles are `std::shared_ptr` aliases that expose only the raw CUDA resource: + +```cpp +using ContextHandle = std::shared_ptr; +using StreamHandle = std::shared_ptr; +using EventHandle = std::shared_ptr; +using MemoryPoolHandle = std::shared_ptr; +using DevicePtrHandle = std::shared_ptr; +``` + +Internally, handles use **shared pointer aliasing**: the actual managed object is a +"box" containing the resource, its dependencies, and any state needed for destruction. +The public handle points only to the raw resource field, keeping the API minimal. + +### Why shared_ptr? + +- **Automatic reference counting**: Resources are released when the last reference + disappears. +- **Cross-language stability**: Works across Python/C++ boundaries without relying + on Python's garbage collector. +- **Interpreter independence**: Resources remain valid even during Python shutdown. +- **Type-erased deleters**: Destruction logic is captured at creation time, supporting + diverse lifetime strategies. + +## Accessing Handle Values + +Handles can be accessed in three ways via overloaded helper functions: + +| Function | Returns | Use Case | Notes +|----------|---------|----------|-------| +| `as_cu(h)` | Raw CUDA type (e.g., `CUstream`) | Passing to CUDA APIs | An attribute of `cuda.bindings.cydriver` | +| `as_intptr(h)` | `intptr_t` | Python interop, foreign code | | +| `as_py(h)` | Python wrapper object | Returning to Python callers | An attribute of `cuda.bindings.driver` + +These overloads exist because `std::shared_ptr` cannot have additional attributes. +Wrapping handles in Python objects would be superfluous overhead for internal use, +so we provide these helpers instead. + +Example usage from Cython: + +```cython +# Get raw handle for CUDA API calls +cdef CUstream raw_stream = as_cu(h_stream) # cuda.bindings.cydriver.CUstream + +# Get as integer for other use cases +return hash(as_intptr(h_stream)) + +# Get Python wrapper for returning to user +return as_py(h_stream) # cuda.bindings.driver.CUstream +``` + +## Code Structure + +### Directory Layout + +``` +cuda/core/ +├── _resource_handles.pyx # Cython module (compiles resource_handles.cpp) +├── _resource_handles.pxd # Cython declarations for consumer modules +└── _cpp/ + ├── resource_handles.hpp # C++ API declarations + └── resource_handles.cpp # C++ implementation +``` + +### Build Implications + +The `_cpp/` subdirectory contains C++ source files that are compiled into the +`_resource_handles` extension module. Other Cython modules in cuda.core do **not** +link against this code directly—they `cimport` functions from +`_resource_handles.pxd`, and calls go through `_resource_handles.so` at runtime. + +## Cross-Module Function Sharing + +**Problem**: Cython extension modules compile independently. If multiple modules +(`_memory.pyx`, `_ipc.pyx`, etc.) each linked `resource_handles.cpp`, they would +each have their own copies of: + +- Static driver function pointers +- Thread-local error state +- Other static data, including global caches + +**Solution**: Only `_resource_handles.so` links the C++ code. The `.pyx` file +uses `cdef extern from` to declare C++ functions with Cython-accessible names: + +```cython +# In _resource_handles.pyx +cdef extern from "_cpp/resource_handles.hpp" namespace "cuda_core": + StreamHandle create_stream_handle "cuda_core::create_stream_handle" ( + ContextHandle h_ctx, unsigned int flags, int priority) nogil + # ... other functions +``` + +The `.pxd` file declares these same functions so other modules can `cimport` them: + +```cython +# In _resource_handles.pxd +cdef StreamHandle create_stream_handle( + ContextHandle h_ctx, unsigned int flags, int priority) noexcept nogil +``` + +The `cdef extern from` declaration in the `.pyx` satisfies the `.pxd` declaration +directly—no wrapper functions are needed. When consumer modules `cimport` these +functions, Cython generates calls through `_resource_handles.so` at runtime. +This ensures all static and thread-local state lives in a single shared library, +avoiding the duplicate state problem. + +## CUDA Driver API Capsule (`_CUDA_DRIVER_API_V1`) + +**Problem**: cuda.core cannot directly call CUDA driver functions because: + +1. We don't want to link against `libcuda.so` at build time. +2. The driver symbols must be resolved dynamically through cuda-bindings. + +**Solution**: The C++ code declares extern function pointer variables: + +```cpp +// resource_handles.hpp +extern decltype(&cuStreamCreateWithPriority) p_cuStreamCreateWithPriority; +extern decltype(&cuMemPoolCreate) p_cuMemPoolCreate; +// ... etc +``` + +At module import time, `_resource_handles.pyx` populates these pointers by +extracting them from `cuda.bindings.cydriver.__pyx_capi__`: + +```cython +import cuda.bindings.cydriver as cydriver + +cdef void* _get_driver_fn(str name): + capsule = cydriver.__pyx_capi__[name] + return PyCapsule_GetPointer(capsule, PyCapsule_GetName(capsule)) + +p_cuStreamCreateWithPriority = _get_driver_fn("cuStreamCreateWithPriority") +``` + +The `__pyx_capi__` dictionary contains PyCapsules that Cython automatically +generates for each `cdef` function declared in a `.pxd` file. Each capsule's +name is the function's C signature; we query it with `PyCapsule_GetName()` +rather than hardcoding signatures. + +This approach: +- Avoids linking against `libcuda.so` at build time +- Works on CPU-only machines (capsule extraction succeeds; actual driver calls + will return errors like `CUDA_ERROR_NO_DEVICE`) +- Requires no custom capsule infrastructure—uses Cython's built-in mechanism + +## Key Implementation Details + +### Structural Dependencies + +When a resource depends on another, its handle embeds the dependency: + +```cpp +struct StreamBox { + CUstream resource; + ContextHandle h_context; // Keeps context alive +}; +``` + +The shared pointer's custom deleter captures any additional state needed for +destruction. This ensures resources are always destroyed in the correct order. + +### GIL Management + +Handle destructors may run from any thread. The implementation includes RAII guards +(`GILReleaseGuard`, `GILAcquireGuard`) that: + +- Release the GIL before calling CUDA APIs (for parallelism) +- Handle Python finalization gracefully (avoid GIL operations during shutdown) +- Ensure Python object manipulation happens with GIL held + +The handle API functions are safe to call with or without the GIL held. They +will release the GIL (if necessary) before calling CUDA driver API functions. + +### Static Initialization and Deadlock Hazards + +When writing C++ code that interacts with Python, a subtle deadlock can occur +when combining C++ static variable initialization with Python's GIL. This is +known as the "double locking" or "latent deadlock" problem. + +**The hazard**: C++11 guarantees thread-safe static initialization using an +implicit guard mutex. If a static initializer calls Python C API functions +(like `PyImport_ImportModule`), and those functions release and reacquire +the GIL internally, a deadlock can occur: + +1. Thread T1 holds GIL, enters static initialization (locks guard mutex) +2. T1's initializer releases GIL (may occur via any Python API call) +3. Thread T2 acquires GIL, tries to enter same static initialization +4. T2 blocks on guard mutex (held by T1) +5. T1 tries to reacquire GIL (held by T2) +6. **Deadlock**: T1 waits for GIL, T2 waits for guard mutex + +This is documented in detail by the pybind11 project: +https://github.com/pybind/pybind11/blob/master/docs/advanced/deadlock.md + +**General rule**: When holding the GIL, avoid acquiring any C++ lock (including +implicit ones like static initialization guards) if the critical section may +call Python C API functions. Many Python API calls can internally release and +reacquire the GIL, creating the second lock ordering that risks deadlock. + +### Error Handling + +Handle API functions do not raise Python exceptions. Instead, they return an empty +handle (null `shared_ptr`) on failure and store the error code in thread-local state. +Callers should check for failure and retrieve the error using `get_last_error()`: + +```cython +cdef StreamHandle h = create_stream_handle(h_ctx, flags, priority) +if not h: + # Handle creation failed - get the CUDA error code + cdef CUresult err = get_last_error() + # ... handle error (e.g., raise Python exception) +``` + +This design allows handle functions to be called from `nogil` blocks without requiring +GIL acquisition for exception handling on the success path. The error state is +thread-local, so concurrent calls from different threads do not interfere. + +Related functions: +- `get_last_error()`: Returns and clears the most recent error +- `peek_last_error()`: Returns the error without clearing it +- `clear_last_error()`: Clears the error state + +## Usage from Cython + +```cython +from cuda.core._resource_handles cimport ( + StreamHandle, + create_stream_handle, + as_cu, + as_intptr, + as_py, + get_last_error, +) + +# Create a stream +cdef StreamHandle h_stream = create_stream_handle(h_ctx, flags, priority) +if not h_stream: + HANDLE_RETURN(get_last_error()) + +# Use in CUDA API +cuStreamSynchronize(as_cu(h_stream)) + +# Return to Python +return as_py(h_stream) +``` + +## Summary + +The resource handle design: + +1. **Separates resource management** into its own layer, independent of Python objects. +2. **Encodes lifetimes structurally** via embedded handle dependencies. +3. **Uses Cython's `cimport` mechanism** to share C++ code across modules without + duplicate static/thread-local state. +4. **Uses a capsule** to resolve CUDA driver symbols dynamically through cuda-bindings. +5. **Provides overloaded accessors** (`as_cu`, `as_intptr`, `as_py`) since handles cannot + have attributes without unnecessary Python object wrappers. + +This architecture ensures CUDA resources are managed correctly regardless of Python +garbage collection timing, interpreter shutdown, or cross-language usage patterns. diff --git a/cuda_core/cuda/core/_cpp/REGISTRY_DESIGN.md b/cuda_core/cuda/core/_cpp/REGISTRY_DESIGN.md new file mode 100644 index 00000000000..089f98acd93 --- /dev/null +++ b/cuda_core/cuda/core/_cpp/REGISTRY_DESIGN.md @@ -0,0 +1,52 @@ +# Handle and Object Registries + +When Python-managed objects round-trip through the CUDA driver (e.g., +querying a graph's nodes and getting back raw `CUgraphNode` pointers), +we need to recover the original Python object rather than creating a +duplicate. + +This document describes the approach used to achieve this. The pattern +is driven mainly by needs arising in the context of CUDA graphs, but +it is general and can be extended to other object types as needs arise. + +This solves the same problem as pybind11's `registered_instances` map +and is sometimes called the Identity Map pattern. Two registries work +together to map a raw driver handle all the way back to the original +Python object. Both use weak references so they +do not prevent cleanup. Entries are removed either explicitly (via +`destroy()` or a Box destructor) or implicitly when the weak reference +expires. + +## Level 1: Driver Handle -> Resource Handle (C++) + +`HandleRegistry` in `resource_handles.cpp` maps a raw CUDA handle +(e.g., `CUevent`, `CUkernel`, `CUgraphNode`) to the `weak_ptr` that +owns it. When a `_ref` constructor receives a raw handle, it +checks the registry first. If found, it returns the existing +`shared_ptr`, preserving the Box and its metadata (e.g., `EventBox` +carries timing/IPC flags, `KernelBox` carries the library dependency). + +Without this level, a round-tripped handle would produce a new Box +with default metadata, losing information that was set at creation. + +Instances: `context_registry`, `stream_registry`, `event_registry`, +`kernel_registry`, `graph_node_registry`. + +## Level 2: Resource Handle -> Python Object (Cython) + +`_node_registry` in `_graph_node.pyx` is a `WeakValueDictionary` +mapping a resource address (`shared_ptr::get()`) to a Python +`GraphNode` object. When `GraphNode._create` receives a handle from +Level 1, it checks this registry. If found, it returns the existing +Python object. + +Without this level, each driver round-trip would produce a distinct +Python object for the same logical node, resulting in surprising +behavior: + +```python +a = g.empty() +a.succ = {b} +b2, = a.succ # queries driver, gets back CUgraphNode for b +assert b2 is b # fails without Level 2 registry +``` diff --git a/cuda_core/cuda/core/_cpp/resource_handles.cpp b/cuda_core/cuda/core/_cpp/resource_handles.cpp new file mode 100644 index 00000000000..b97b207d2a4 --- /dev/null +++ b/cuda_core/cuda/core/_cpp/resource_handles.cpp @@ -0,0 +1,1655 @@ +// SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +#include + +#include "resource_handles.hpp" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef _WIN32 +#include +#endif + +namespace cuda_core { + +// ============================================================================ +// CUDA driver function pointers +// +// These are populated by _resource_handles.pyx at module import time using +// function pointers extracted from cuda.bindings.cydriver.__pyx_capi__. +// ============================================================================ + +decltype(&cuDevicePrimaryCtxRetain) p_cuDevicePrimaryCtxRetain = nullptr; +decltype(&cuDevicePrimaryCtxRelease) p_cuDevicePrimaryCtxRelease = nullptr; +decltype(&cuCtxGetCurrent) p_cuCtxGetCurrent = nullptr; +decltype(&cuGreenCtxCreate) p_cuGreenCtxCreate = nullptr; +decltype(&cuGreenCtxDestroy) p_cuGreenCtxDestroy = nullptr; +decltype(&cuCtxFromGreenCtx) p_cuCtxFromGreenCtx = nullptr; +decltype(&cuDevResourceGenerateDesc) p_cuDevResourceGenerateDesc = nullptr; + +decltype(&cuGreenCtxStreamCreate) p_cuGreenCtxStreamCreate = nullptr; + +decltype(&cuStreamCreateWithPriority) p_cuStreamCreateWithPriority = nullptr; +decltype(&cuStreamDestroy) p_cuStreamDestroy = nullptr; + +decltype(&cuEventCreate) p_cuEventCreate = nullptr; +decltype(&cuEventDestroy) p_cuEventDestroy = nullptr; +decltype(&cuIpcOpenEventHandle) p_cuIpcOpenEventHandle = nullptr; + +decltype(&cuDeviceGetCount) p_cuDeviceGetCount = nullptr; + +decltype(&cuMemPoolSetAccess) p_cuMemPoolSetAccess = nullptr; +decltype(&cuMemPoolDestroy) p_cuMemPoolDestroy = nullptr; +decltype(&cuMemPoolCreate) p_cuMemPoolCreate = nullptr; +decltype(&cuDeviceGetMemPool) p_cuDeviceGetMemPool = nullptr; +decltype(&cuMemPoolImportFromShareableHandle) p_cuMemPoolImportFromShareableHandle = nullptr; + +decltype(&cuMemAllocFromPoolAsync) p_cuMemAllocFromPoolAsync = nullptr; +decltype(&cuMemAllocAsync) p_cuMemAllocAsync = nullptr; +decltype(&cuMemAlloc) p_cuMemAlloc = nullptr; +decltype(&cuMemAllocHost) p_cuMemAllocHost = nullptr; + +decltype(&cuMemFreeAsync) p_cuMemFreeAsync = nullptr; +decltype(&cuMemFree) p_cuMemFree = nullptr; +decltype(&cuMemFreeHost) p_cuMemFreeHost = nullptr; + +decltype(&cuMemPoolImportPointer) p_cuMemPoolImportPointer = nullptr; + +decltype(&cuLibraryLoadFromFile) p_cuLibraryLoadFromFile = nullptr; +decltype(&cuLibraryLoadData) p_cuLibraryLoadData = nullptr; +decltype(&cuLibraryUnload) p_cuLibraryUnload = nullptr; +decltype(&cuLibraryGetKernel) p_cuLibraryGetKernel = nullptr; + +// Graph +decltype(&cuGraphDestroy) p_cuGraphDestroy = nullptr; +decltype(&cuGraphExecDestroy) p_cuGraphExecDestroy = nullptr; +decltype(&cuUserObjectCreate) p_cuUserObjectCreate = nullptr; +decltype(&cuUserObjectRelease) p_cuUserObjectRelease = nullptr; +decltype(&cuGraphRetainUserObject) p_cuGraphRetainUserObject = nullptr; + +// Linker +decltype(&cuLinkDestroy) p_cuLinkDestroy = nullptr; + +// GL interop pointers +decltype(&cuGraphicsUnmapResources) p_cuGraphicsUnmapResources = nullptr; +decltype(&cuGraphicsUnregisterResource) p_cuGraphicsUnregisterResource = nullptr; + +decltype(&cuArray3DCreate) p_cuArray3DCreate = nullptr; +decltype(&cuArrayDestroy) p_cuArrayDestroy = nullptr; +decltype(&cuMipmappedArrayCreate) p_cuMipmappedArrayCreate = nullptr; +decltype(&cuMipmappedArrayDestroy) p_cuMipmappedArrayDestroy = nullptr; +decltype(&cuMipmappedArrayGetLevel) p_cuMipmappedArrayGetLevel = nullptr; +decltype(&cuTexObjectCreate) p_cuTexObjectCreate = nullptr; +decltype(&cuTexObjectDestroy) p_cuTexObjectDestroy = nullptr; +decltype(&cuSurfObjectCreate) p_cuSurfObjectCreate = nullptr; +decltype(&cuSurfObjectDestroy) p_cuSurfObjectDestroy = nullptr; + +// SM resource split (13.1+ — may be null on older drivers/bindings) +#if CUDA_VERSION >= 13010 +decltype(&cuDevSmResourceSplit) p_cuDevSmResourceSplit = nullptr; +#else +void* p_cuDevSmResourceSplit = nullptr; +#endif + +// NVRTC function pointers +decltype(&nvrtcDestroyProgram) p_nvrtcDestroyProgram = nullptr; + +// NVVM function pointers (may be null if NVVM is not available) +NvvmDestroyProgramFn p_nvvmDestroyProgram = nullptr; + +// nvJitLink function pointers (may be null if nvJitLink is not available) +NvJitLinkDestroyFn p_nvJitLinkDestroy = nullptr; + +// ============================================================================ +// GIL management helpers +// ============================================================================ + +namespace { + +// Helper to release the GIL while calling into the CUDA driver. +// This guard is *conditional*: if the caller already dropped the GIL, +// we avoid calling PyEval_SaveThread (which requires holding the GIL). +// It also handles the case where Python is finalizing and GIL operations +// are no longer safe. +class GILReleaseGuard { +public: + GILReleaseGuard() : tstate_(nullptr), released_(false) { + // Don't try to manipulate GIL if Python is finalizing + if (!Py_IsInitialized() || py_is_finalizing()) { + return; + } + // PyGILState_Check() returns 1 if the GIL is held by this thread. + if (PyGILState_Check()) { + tstate_ = PyEval_SaveThread(); + released_ = true; + } + // Note: If the GIL is not released (finalizing, or not held): + // - Reduces parallelism (other Python threads remain blocked) + // - No deadlock risk as long as the guarded code doesn't call back into Python + } + + ~GILReleaseGuard() { + if (released_) { + PyEval_RestoreThread(tstate_); + } + } + + // Non-copyable, non-movable + GILReleaseGuard(const GILReleaseGuard&) = delete; + GILReleaseGuard& operator=(const GILReleaseGuard&) = delete; + +private: + PyThreadState* tstate_; + bool released_; +}; + +// Helper to acquire the GIL when we might not hold it. +// Use in C++ destructors that need to manipulate Python objects. +class GILAcquireGuard { +public: + GILAcquireGuard() : acquired_(false) { + // Don't try to acquire GIL if Python is finalizing + if (!Py_IsInitialized() || py_is_finalizing()) { + return; + } + gstate_ = PyGILState_Ensure(); + acquired_ = true; + } + + ~GILAcquireGuard() { + if (acquired_) { + PyGILState_Release(gstate_); + } + } + + bool acquired() const { return acquired_; } + + // Non-copyable, non-movable + GILAcquireGuard(const GILAcquireGuard&) = delete; + GILAcquireGuard& operator=(const GILAcquireGuard&) = delete; + +private: + PyGILState_STATE gstate_; + bool acquired_; +}; + +} // namespace + +// ============================================================================ +// Handle reverse-lookup registry +// +// Maps raw CUDA handles (CUevent, CUkernel, etc.) back to their owning +// shared_ptr so that _ref constructors can recover full metadata. +// Uses weak_ptr to avoid preventing destruction. +// ============================================================================ + +template> +class HandleRegistry { +public: + using MapType = std::unordered_map, Hash>; + + void register_handle(const Key& key, const Handle& h) { + std::lock_guard lock(mutex_); + map_[key] = h; + } + + void unregister_handle(const Key& key) noexcept { + std::lock_guard lock(mutex_); + map_.erase(key); + } + + Handle lookup(const Key& key) { + std::lock_guard lock(mutex_); + auto it = map_.find(key); + if (it != map_.end()) { + if (auto h = it->second.lock()) { + return h; + } + map_.erase(it); + } + return {}; + } + +private: + std::mutex mutex_; + MapType map_; +}; + +// ============================================================================ +// Thread-local error handling +// ============================================================================ + +// Thread-local status of the most recent CUDA API call in this module. +static thread_local CUresult err = CUDA_SUCCESS; + +CUresult get_last_error() noexcept { + CUresult e = err; + err = CUDA_SUCCESS; + return e; +} + +CUresult peek_last_error() noexcept { + return err; +} + +void clear_last_error() noexcept { + err = CUDA_SUCCESS; +} + +// ============================================================================ +// Context Handles +// ============================================================================ + +namespace { +struct ContextBox { + CUcontext resource; + GreenCtxHandle h_green_ctx; +}; + +struct GreenCtxBox { + CUgreenCtx resource; +}; + +static const ContextBox* get_box(const ContextHandle& h) noexcept { + const CUcontext* p = h.get(); + return reinterpret_cast( + reinterpret_cast(p) - offsetof(ContextBox, resource) + ); +} + +// See REGISTRY_DESIGN.md (Level 1: Driver Handle -> Resource Handle) +static HandleRegistry context_registry; + +// Create a context handle reference, with optional green context as source. +ContextHandle create_context_handle_ref(CUcontext ctx, GreenCtxHandle h_green_ctx) { + if (!ctx) { + return {}; + } + if (auto h = context_registry.lookup(ctx)) { + return h; + } + auto box = std::shared_ptr( + new ContextBox{ctx, std::move(h_green_ctx)}, + [](const ContextBox* b) { + context_registry.unregister_handle(b->resource); + delete b; + } + ); + ContextHandle h(box, &box->resource); + context_registry.register_handle(ctx, h); + return h; +} +} // namespace + +ContextHandle create_context_handle_ref(CUcontext ctx) { + return create_context_handle_ref(ctx, {}); +} + +ContextHandle create_context_handle_from_green_ctx(const GreenCtxHandle& h_green_ctx) { + GILReleaseGuard gil; + if (!h_green_ctx) { + return {}; + } + if (!p_cuCtxFromGreenCtx) { + err = CUDA_ERROR_NOT_SUPPORTED; + return {}; + } + + CUcontext ctx = nullptr; + if (CUDA_SUCCESS != (err = p_cuCtxFromGreenCtx(&ctx, as_cu(h_green_ctx)))) { + return {}; + } + + return create_context_handle_ref(ctx, h_green_ctx); +} + +GreenCtxHandle get_context_green_ctx(const ContextHandle& h) noexcept { + if (!h) { + return {}; + } + return get_box(h)->h_green_ctx; +} + +GreenCtxHandle create_green_ctx_handle(CUdevResource* resources, unsigned int nbResources, + CUdevice dev, unsigned int flags) { + GILReleaseGuard gil; + if (!p_cuDevResourceGenerateDesc || !p_cuGreenCtxCreate || !p_cuGreenCtxDestroy) { + err = CUDA_ERROR_NOT_SUPPORTED; + return {}; + } + + CUdevResourceDesc desc = nullptr; + if (CUDA_SUCCESS != (err = p_cuDevResourceGenerateDesc(&desc, resources, nbResources))) { + return {}; + } + + CUgreenCtx green_ctx = nullptr; + if (CUDA_SUCCESS != (err = p_cuGreenCtxCreate(&green_ctx, desc, dev, flags))) { + return {}; + } + + auto box = std::shared_ptr( + new GreenCtxBox{green_ctx}, + [](const GreenCtxBox* b) { + GILReleaseGuard gil; + p_cuGreenCtxDestroy(b->resource); + delete b; + } + ); + return GreenCtxHandle(box, &box->resource); +} + +GreenCtxHandle create_green_ctx_handle_ref(CUgreenCtx green_ctx) { + if (!green_ctx) { + return {}; + } + auto box = std::make_shared(GreenCtxBox{green_ctx}); + return GreenCtxHandle(box, &box->resource); +} + +// Thread-local cache of primary contexts indexed by device ID +static thread_local std::vector primary_context_cache; + +ContextHandle get_primary_context(int device_id) { + // Check thread-local cache + if (static_cast(device_id) < primary_context_cache.size()) { + if (auto cached = primary_context_cache[device_id]) { + return cached; + } + } + + // Cache miss - acquire primary context from driver + GILReleaseGuard gil; + CUcontext ctx; + if (CUDA_SUCCESS != (err = p_cuDevicePrimaryCtxRetain(&ctx, device_id))) { + return {}; + } + + auto box = std::shared_ptr( + new ContextBox{ctx, {}}, + [device_id](const ContextBox* b) { + context_registry.unregister_handle(b->resource); + GILReleaseGuard gil; + p_cuDevicePrimaryCtxRelease(device_id); + delete b; + } + ); + auto h = ContextHandle(box, &box->resource); + context_registry.register_handle(ctx, h); + + // Update cache + if (static_cast(device_id) >= primary_context_cache.size()) { + primary_context_cache.resize(device_id + 1); + } + primary_context_cache[device_id] = h; + return h; +} + +ContextHandle get_current_context() { + GILReleaseGuard gil; + CUcontext ctx = nullptr; + if (CUDA_SUCCESS != (err = p_cuCtxGetCurrent(&ctx))) { + return {}; + } + if (!ctx) { + return {}; // No current context (not an error) + } + return create_context_handle_ref(ctx); +} + +// ============================================================================ +// Stream Handles +// ============================================================================ + +namespace { +struct StreamBox { + CUstream resource; + ContextHandle h_context; +}; + +static const StreamBox* get_box(const StreamHandle& h) noexcept { + const CUstream* p = h.get(); + return reinterpret_cast( + reinterpret_cast(p) - offsetof(StreamBox, resource) + ); +} + +// See REGISTRY_DESIGN.md (Level 1: Driver Handle -> Resource Handle) +static HandleRegistry stream_registry; +} // namespace + +StreamHandle create_stream_handle(const ContextHandle& h_ctx, unsigned int flags, int priority) { + GILReleaseGuard gil; + CUstream stream; + + // Dispatch: green context uses cuGreenCtxStreamCreate, primary uses cuStreamCreateWithPriority + GreenCtxHandle h_green = get_context_green_ctx(h_ctx); + if (h_green) { + if (!p_cuGreenCtxStreamCreate) { + err = CUDA_ERROR_NOT_SUPPORTED; + return {}; + } + if (CUDA_SUCCESS != (err = p_cuGreenCtxStreamCreate(&stream, as_cu(h_green), flags, priority))) { + return {}; + } + } else { + if (CUDA_SUCCESS != (err = p_cuStreamCreateWithPriority(&stream, flags, priority))) { + return {}; + } + } + + auto box = std::shared_ptr( + new StreamBox{stream, h_ctx}, + [](const StreamBox* b) { + stream_registry.unregister_handle(b->resource); + GILReleaseGuard gil; + p_cuStreamDestroy(b->resource); + delete b; + } + ); + StreamHandle h(box, &box->resource); + stream_registry.register_handle(stream, h); + return h; +} + +StreamHandle create_stream_handle_ref(CUstream stream) { + if (auto h = stream_registry.lookup(stream)) { + return h; + } + auto box = std::shared_ptr( + new StreamBox{stream, {}}, + [](const StreamBox* b) { + stream_registry.unregister_handle(b->resource); + delete b; + } + ); + StreamHandle h(box, &box->resource); + stream_registry.register_handle(stream, h); + return h; +} + +StreamHandle create_stream_handle_with_owner(CUstream stream, PyObject* owner) { + if (auto h = stream_registry.lookup(stream)) { + // Reuse handles that already carry structural context metadata, e.g. + // cuda-core-owned streams. + if (get_box(h)->h_context) { + return h; + } + } + if (!owner) { + return create_stream_handle_ref(stream); + } + // GIL required when owner is provided + GILAcquireGuard gil; + if (!gil.acquired()) { + // Python finalizing - fall back to ref version (no owner tracking) + return create_stream_handle_ref(stream); + } + Py_INCREF(owner); + // Owner-backed handles are NOT registered in the stream registry to avoid + // corruption when multiple owners wrap the same CUstream (each stacks its + // own Py_INCREF/Py_DECREF independently). + auto box = std::shared_ptr( + new StreamBox{stream, {}}, + [owner](const StreamBox* b) { + GILAcquireGuard gil; + if (gil.acquired()) { + Py_DECREF(owner); + } + delete b; + } + ); + return StreamHandle(box, &box->resource); +} + +void py_object_user_object_destroy(void* py_object) noexcept { + if (!py_object) { + return; + } + GILAcquireGuard gil; + if (!gil.acquired()) { + return; + } + Py_DECREF(reinterpret_cast(py_object)); +} + +ContextHandle get_stream_context(const StreamHandle& h) noexcept { + return h ? get_box(h)->h_context : ContextHandle{}; +} + +StreamHandle get_legacy_stream() { + static StreamHandle handle = create_stream_handle_ref(CU_STREAM_LEGACY); + return handle; +} + +StreamHandle get_per_thread_stream() { + static StreamHandle handle = create_stream_handle_ref(CU_STREAM_PER_THREAD); + return handle; +} + +// ============================================================================ +// Event Handles +// ============================================================================ + +namespace { +struct EventBox { + CUevent resource; + bool timing_enabled; + bool is_blocking_sync; + bool ipc_enabled; + int device_id; + ContextHandle h_context; +}; +} // namespace + +static const EventBox* get_box(const EventHandle& h) { + const CUevent* p = h.get(); + return reinterpret_cast( + reinterpret_cast(p) - offsetof(EventBox, resource) + ); +} + +bool get_event_timing_enabled(const EventHandle& h) noexcept { + return h ? get_box(h)->timing_enabled : false; +} + +bool get_event_is_blocking_sync(const EventHandle& h) noexcept { + return h ? get_box(h)->is_blocking_sync : false; +} + +bool get_event_ipc_enabled(const EventHandle& h) noexcept { + return h ? get_box(h)->ipc_enabled : false; +} + +int get_event_device_id(const EventHandle& h) noexcept { + return h ? get_box(h)->device_id : -1; +} + +ContextHandle get_event_context(const EventHandle& h) noexcept { + return h ? get_box(h)->h_context : ContextHandle{}; +} + +// See REGISTRY_DESIGN.md (Level 1: Driver Handle -> Resource Handle) +static HandleRegistry event_registry; + +EventHandle create_event_handle(const ContextHandle& h_ctx, unsigned int flags, + bool timing_enabled, bool is_blocking_sync, + bool ipc_enabled, int device_id) { + GILReleaseGuard gil; + CUevent event; + if (CUDA_SUCCESS != (err = p_cuEventCreate(&event, flags))) { + return {}; + } + + auto box = std::shared_ptr( + new EventBox{event, timing_enabled, is_blocking_sync, ipc_enabled, device_id, h_ctx}, + [h_ctx](const EventBox* b) { + event_registry.unregister_handle(b->resource); + GILReleaseGuard gil; + p_cuEventDestroy(b->resource); + delete b; + } + ); + EventHandle h(box, &box->resource); + event_registry.register_handle(event, h); + return h; +} + +EventHandle create_event_handle_noctx(unsigned int flags) { + return create_event_handle(ContextHandle{}, flags, false, false, false, -1); +} + +EventHandle create_event_handle_ref(CUevent event) { + if (auto h = event_registry.lookup(event)) { + return h; + } + auto box = std::make_shared(EventBox{event, false, false, false, -1, {}}); + return EventHandle(box, &box->resource); +} + +EventHandle create_event_handle_ipc(const CUipcEventHandle& ipc_handle, + bool is_blocking_sync) { + GILReleaseGuard gil; + CUevent event; + if (CUDA_SUCCESS != (err = p_cuIpcOpenEventHandle(&event, ipc_handle))) { + return {}; + } + + auto box = std::shared_ptr( + new EventBox{event, false, is_blocking_sync, true, -1, {}}, + [](const EventBox* b) { + event_registry.unregister_handle(b->resource); + GILReleaseGuard gil; + p_cuEventDestroy(b->resource); + delete b; + } + ); + EventHandle h(box, &box->resource); + event_registry.register_handle(event, h); + return h; +} + +// ============================================================================ +// Memory Pool Handles +// ============================================================================ + +namespace { +struct MemoryPoolBox { + CUmemoryPool resource; +}; +} // namespace + +// Helper to clear peer access before destroying a memory pool. +// Works around nvbug 5698116: recycled pool handles inherit peer access state. +// Must be noexcept since it's called from a shared_ptr deleter. +static void clear_mempool_peer_access(CUmemoryPool pool) noexcept { + try { + int device_count = 0; + if (p_cuDeviceGetCount(&device_count) != CUDA_SUCCESS || device_count <= 0) { + return; + } + + std::vector clear_access(device_count); + for (int i = 0; i < device_count; ++i) { + clear_access[i].location.type = CU_MEM_LOCATION_TYPE_DEVICE; + clear_access[i].location.id = i; + clear_access[i].flags = CU_MEM_ACCESS_FLAGS_PROT_NONE; + } + p_cuMemPoolSetAccess(pool, clear_access.data(), device_count); // Best effort + } catch (...) { + // Swallow exceptions - this is best-effort cleanup in destructor context + } +} + +static MemoryPoolHandle wrap_mempool_owned(CUmemoryPool pool) { + auto box = std::shared_ptr( + new MemoryPoolBox{pool}, + [](const MemoryPoolBox* b) { + GILReleaseGuard gil; + clear_mempool_peer_access(b->resource); + p_cuMemPoolDestroy(b->resource); + delete b; + } + ); + return MemoryPoolHandle(box, &box->resource); +} + +MemoryPoolHandle create_mempool_handle(const CUmemPoolProps& props) { + GILReleaseGuard gil; + CUmemoryPool pool; + if (CUDA_SUCCESS != (err = p_cuMemPoolCreate(&pool, &props))) { + return {}; + } + return wrap_mempool_owned(pool); +} + +MemoryPoolHandle create_mempool_handle_ref(CUmemoryPool pool) { + auto box = std::make_shared(MemoryPoolBox{pool}); + return MemoryPoolHandle(box, &box->resource); +} + +MemoryPoolHandle get_device_mempool(int device_id) { + GILReleaseGuard gil; + CUmemoryPool pool; + if (CUDA_SUCCESS != (err = p_cuDeviceGetMemPool(&pool, device_id))) { + return {}; + } + return create_mempool_handle_ref(pool); +} + +MemoryPoolHandle create_mempool_handle_ipc(int fd, CUmemAllocationHandleType handle_type) { + GILReleaseGuard gil; + CUmemoryPool pool; + auto handle_ptr = reinterpret_cast(static_cast(fd)); + if (CUDA_SUCCESS != (err = p_cuMemPoolImportFromShareableHandle(&pool, handle_ptr, handle_type, 0))) { + return {}; + } + return wrap_mempool_owned(pool); +} + +// ============================================================================ +// Device Pointer Handles +// ============================================================================ + +namespace { +struct DevicePtrBox { + CUdeviceptr resource; + // Mutable to allow set_deallocation_stream() to update the stream + // through a const DevicePtrHandle. The stream can be changed after + // allocation (e.g., to synchronize deallocation with a different stream). + mutable StreamHandle h_stream; +}; +} // namespace + +// Recovers the owning DevicePtrBox from the aliased CUdeviceptr pointer. +// This works because DevicePtrHandle is a shared_ptr alias pointing to +// &box->resource, so we can compute the containing struct using offsetof. +// The const_cast is safe because we only use this to access the mutable +// h_stream member or in the deleter (where the box is being destroyed). +static DevicePtrBox* get_box(const DevicePtrHandle& h) { + const CUdeviceptr* p = h.get(); + return reinterpret_cast( + reinterpret_cast(const_cast(p)) - offsetof(DevicePtrBox, resource) + ); +} + +StreamHandle deallocation_stream(const DevicePtrHandle& h) noexcept { + return get_box(h)->h_stream; +} + +void set_deallocation_stream(const DevicePtrHandle& h, const StreamHandle& h_stream) noexcept { + get_box(h)->h_stream = h_stream; +} + +DevicePtrHandle deviceptr_alloc_from_pool(size_t size, const MemoryPoolHandle& h_pool, const StreamHandle& h_stream) { + GILReleaseGuard gil; + CUdeviceptr ptr; + if (CUDA_SUCCESS != (err = p_cuMemAllocFromPoolAsync(&ptr, size, *h_pool, as_cu(h_stream)))) { + return {}; + } + + auto box = std::shared_ptr( + new DevicePtrBox{ptr, h_stream}, + [h_pool](DevicePtrBox* b) { + GILReleaseGuard gil; + p_cuMemFreeAsync(b->resource, as_cu(b->h_stream)); + delete b; + } + ); + return DevicePtrHandle(box, &box->resource); +} + +DevicePtrHandle deviceptr_alloc_async(size_t size, const StreamHandle& h_stream) { + GILReleaseGuard gil; + CUdeviceptr ptr; + if (CUDA_SUCCESS != (err = p_cuMemAllocAsync(&ptr, size, as_cu(h_stream)))) { + return {}; + } + + auto box = std::shared_ptr( + new DevicePtrBox{ptr, h_stream}, + [](DevicePtrBox* b) { + GILReleaseGuard gil; + p_cuMemFreeAsync(b->resource, as_cu(b->h_stream)); + delete b; + } + ); + return DevicePtrHandle(box, &box->resource); +} + +DevicePtrHandle deviceptr_alloc(size_t size) { + GILReleaseGuard gil; + CUdeviceptr ptr; + if (CUDA_SUCCESS != (err = p_cuMemAlloc(&ptr, size))) { + return {}; + } + + auto box = std::shared_ptr( + new DevicePtrBox{ptr, StreamHandle{}}, + [](DevicePtrBox* b) { + GILReleaseGuard gil; + p_cuMemFree(b->resource); + delete b; + } + ); + return DevicePtrHandle(box, &box->resource); +} + +DevicePtrHandle deviceptr_alloc_host(size_t size) { + GILReleaseGuard gil; + void* ptr; + if (CUDA_SUCCESS != (err = p_cuMemAllocHost(&ptr, size))) { + return {}; + } + + auto box = std::shared_ptr( + new DevicePtrBox{reinterpret_cast(ptr), StreamHandle{}}, + [](DevicePtrBox* b) { + GILReleaseGuard gil; + p_cuMemFreeHost(reinterpret_cast(b->resource)); + delete b; + } + ); + return DevicePtrHandle(box, &box->resource); +} + +DevicePtrHandle deviceptr_create_ref(CUdeviceptr ptr) { + auto box = std::make_shared(DevicePtrBox{ptr, StreamHandle{}}); + return DevicePtrHandle(box, &box->resource); +} + +DevicePtrHandle deviceptr_create_with_owner(CUdeviceptr ptr, PyObject* owner) { + if (!owner) { + return deviceptr_create_ref(ptr); + } + // GIL required when owner is provided + GILAcquireGuard gil; + if (!gil.acquired()) { + // Python finalizing - fall back to ref version (no owner tracking) + return deviceptr_create_ref(ptr); + } + Py_INCREF(owner); + auto box = std::shared_ptr( + new DevicePtrBox{ptr, StreamHandle{}}, + [owner](DevicePtrBox* b) { + GILAcquireGuard gil; + if (gil.acquired()) { + Py_DECREF(owner); + } + delete b; + } + ); + return DevicePtrHandle(box, &box->resource); +} + +DevicePtrHandle deviceptr_create_mapped_graphics( + CUdeviceptr ptr, + const GraphicsResourceHandle& h_resource, + const StreamHandle& h_stream +) { + auto box = std::shared_ptr( + new DevicePtrBox{ptr, h_stream}, + [h_resource](DevicePtrBox* b) { + GILReleaseGuard gil; + CUgraphicsResource resource = as_cu(h_resource); + p_cuGraphicsUnmapResources(1, &resource, as_cu(b->h_stream)); + delete b; + } + ); + return DevicePtrHandle(box, &box->resource); +} + +// ============================================================================ +// MemoryResource-owned Device Pointer Handles +// ============================================================================ + +static MRDeallocCallback mr_dealloc_cb = nullptr; + +void register_mr_dealloc_callback(MRDeallocCallback cb) { + mr_dealloc_cb = cb; +} + +DevicePtrHandle deviceptr_create_with_mr(CUdeviceptr ptr, size_t size, PyObject* mr) { + if (!mr) { + return deviceptr_create_ref(ptr); + } + // GIL required when mr is provided + GILAcquireGuard gil; + if (!gil.acquired()) { + return deviceptr_create_ref(ptr); + } + Py_INCREF(mr); + auto box = std::shared_ptr( + new DevicePtrBox{ptr, StreamHandle{}}, + [mr, size](DevicePtrBox* b) { + GILAcquireGuard gil; + if (gil.acquired()) { + if (mr_dealloc_cb) { + mr_dealloc_cb(mr, b->resource, size, b->h_stream); + } + Py_DECREF(mr); + } + delete b; + } + ); + return DevicePtrHandle(box, &box->resource); +} + +// ============================================================================ +// IPC Pointer Cache +// ============================================================================ +// This cache handles duplicate IPC imports, which behave differently depending +// on the memory type: +// +// 1. Memory pool allocations (DeviceMemoryResource): +// Multiple imports of the same allocation succeed and return duplicate +// pointers. However, the driver has a reference counting bug (nvbug 5570902) +// where the first cuMemFreeAsync incorrectly unmaps the memory even when +// imported multiple times. A driver fix is expected. +// +// 2. Pinned memory allocations (PinnedMemoryResource): +// Duplicate imports result in CUDA_ERROR_ALREADY_MAPPED. +// +// The cache solves both issues by checking the cache before calling +// cuMemPoolImportPointer and returning the existing handle for duplicate +// imports. This provides a consistent user experience where the same IPC +// descriptor can be imported multiple times regardless of memory type. +// +// The cache key is the export_data bytes (CUmemPoolPtrExportData), not the +// returned pointer, because we must check before calling the driver API. + + +// TODO: When driver fix for nvbug 5570902 is available, consider whether +// the cache is still needed for memory pool allocations (it will still be +// needed for pinned memory). +static bool use_ipc_ptr_cache() { + return true; +} + +namespace { +// Wrapper for CUmemPoolPtrExportData to use as map key +struct ExportDataKey { + CUmemPoolPtrExportData data; + + bool operator==(const ExportDataKey& other) const { + return std::memcmp(&data, &other.data, sizeof(data)) == 0; + } +}; + +struct ExportDataKeyHash { + std::size_t operator()(const ExportDataKey& key) const { + // Simple hash of the bytes + std::size_t h = 0; + const auto* bytes = reinterpret_cast(&key.data); + for (std::size_t i = 0; i < sizeof(key.data); ++i) { + h = h * 31 + bytes[i]; + } + return h; + } +}; + +} + +static HandleRegistry ipc_ptr_cache; +static std::mutex ipc_import_mutex; + +DevicePtrHandle deviceptr_import_ipc(const MemoryPoolHandle& h_pool, const void* export_data, const StreamHandle& h_stream) { + auto data = const_cast( + reinterpret_cast(export_data)); + + if (use_ipc_ptr_cache()) { + ExportDataKey key; + std::memcpy(&key.data, data, sizeof(key.data)); + + std::lock_guard lock(ipc_import_mutex); + + if (auto h = ipc_ptr_cache.lookup(key)) { + return h; + } + + GILReleaseGuard gil; + CUdeviceptr ptr; + if (CUDA_SUCCESS != (err = p_cuMemPoolImportPointer(&ptr, *h_pool, data))) { + return {}; + } + + auto box = std::shared_ptr( + new DevicePtrBox{ptr, h_stream}, + [h_pool, key](DevicePtrBox* b) { + ipc_ptr_cache.unregister_handle(key); + GILReleaseGuard gil; + p_cuMemFreeAsync(b->resource, as_cu(b->h_stream)); + delete b; + } + ); + DevicePtrHandle h(box, &box->resource); + ipc_ptr_cache.register_handle(key, h); + return h; + + } else { + GILReleaseGuard gil; + CUdeviceptr ptr; + if (CUDA_SUCCESS != (err = p_cuMemPoolImportPointer(&ptr, *h_pool, data))) { + return {}; + } + + auto box = std::shared_ptr( + new DevicePtrBox{ptr, h_stream}, + [h_pool](DevicePtrBox* b) { + GILReleaseGuard gil; + p_cuMemFreeAsync(b->resource, as_cu(b->h_stream)); + delete b; + } + ); + return DevicePtrHandle(box, &box->resource); + } +} + +// ============================================================================ +// Library Handles +// ============================================================================ + +namespace { +struct LibraryBox { + CUlibrary resource; +}; +} // namespace + +LibraryHandle create_library_handle_from_file(const char* path) { + GILReleaseGuard gil; + CUlibrary library; + if (CUDA_SUCCESS != (err = p_cuLibraryLoadFromFile(&library, path, nullptr, nullptr, 0, nullptr, nullptr, 0))) { + return {}; + } + + auto box = std::shared_ptr( + new LibraryBox{library}, + [](const LibraryBox* b) { + GILReleaseGuard gil; + // TODO: re-enable once LibraryBox tracks its owning context + // p_cuLibraryUnload(b->resource); + delete b; + } + ); + return LibraryHandle(box, &box->resource); +} + +LibraryHandle create_library_handle_from_data(const void* data) { + GILReleaseGuard gil; + CUlibrary library; + if (CUDA_SUCCESS != (err = p_cuLibraryLoadData(&library, data, nullptr, nullptr, 0, nullptr, nullptr, 0))) { + return {}; + } + + auto box = std::shared_ptr( + new LibraryBox{library}, + [](const LibraryBox* b) { + GILReleaseGuard gil; + // TODO: re-enable once LibraryBox tracks its owning context + // p_cuLibraryUnload(b->resource); + delete b; + } + ); + return LibraryHandle(box, &box->resource); +} + +LibraryHandle create_library_handle_ref(CUlibrary library) { + auto box = std::make_shared(LibraryBox{library}); + return LibraryHandle(box, &box->resource); +} + +// ============================================================================ +// Kernel Handles +// ============================================================================ + +namespace { +struct KernelBox { + CUkernel resource; + LibraryHandle h_library; +}; +} // namespace + +static const KernelBox* get_box(const KernelHandle& h) { + const CUkernel* p = h.get(); + return reinterpret_cast( + reinterpret_cast(p) - offsetof(KernelBox, resource) + ); +} + +// See REGISTRY_DESIGN.md (Level 1: Driver Handle -> Resource Handle) +static HandleRegistry kernel_registry; + +KernelHandle create_kernel_handle(const LibraryHandle& h_library, const char* name) { + GILReleaseGuard gil; + CUkernel kernel; + if (CUDA_SUCCESS != (err = p_cuLibraryGetKernel(&kernel, *h_library, name))) { + return {}; + } + + auto box = std::make_shared(KernelBox{kernel, h_library}); + KernelHandle h(box, &box->resource); + kernel_registry.register_handle(kernel, h); + return h; +} + +KernelHandle create_kernel_handle_ref(CUkernel kernel) { + if (auto h = kernel_registry.lookup(kernel)) { + return h; + } + auto box = std::make_shared(KernelBox{kernel, {}}); + return KernelHandle(box, &box->resource); +} + +LibraryHandle get_kernel_library(const KernelHandle& h) noexcept { + if (!h) return {}; + return get_box(h)->h_library; +} + +// ============================================================================ +// Graph Handles +// ============================================================================ + +namespace { + +// Slot table layout (internal). Each graph maps CUgraphNode -> a fixed-size +// array of type-erased owners. The width is the most any single node needs: a +// kernel node holds its kernel and its packed arguments; a host node holds its +// callback and the userData. The table is heap-allocated and retained on the +// graph as a user object, so the driver frees it -- and every owner in it -- +// when the graph is destroyed. +constexpr std::size_t SLOTS_PER_NODE = 2; +using NodeSlots = std::array; +using GraphSlotTable = std::map; + +// shared_ptr deleters for the payloads that need one. Typed handles convert to +// OpaqueHandle by assignment and reuse their own control block, so they need no +// deleter here. The Python deleter follows the owner-release pattern used by +// the stream/deviceptr handles above. +void py_deleter(const void* p) noexcept { + GILAcquireGuard gil; + if (gil.acquired()) { + Py_DECREF(const_cast(static_cast(p))); + } +} + +void free_deleter(const void* p) noexcept { + std::free(const_cast(p)); +} + +void destroy_graph_slot_table(void* table) noexcept { + delete static_cast(table); +} + +struct GraphBox { + CUgraph resource; + GraphHandle h_parent; // Keeps parent alive for child/branch graphs + mutable GraphSlotTable* slot_table = nullptr; // Lazily created; owned by the graph's user object +}; + +const GraphBox* get_box(const GraphHandle& h) { + const CUgraph* p = h.get(); + return reinterpret_cast( + reinterpret_cast(p) - offsetof(GraphBox, resource) + ); +} + +// Return box's slot table, creating it on first use. The table is retained on +// the graph as a user object (MOVE transfers our only reference into the +// graph), so it -- and every owner in it -- is freed when the graph is +// destroyed. Returns nullptr if the driver lacks user-object support or a +// driver call fails; the cached pointer is non-owning. +GraphSlotTable* ensure_slot_table(const GraphBox* box) { + if (box->slot_table) { + return box->slot_table; + } + if (!p_cuUserObjectCreate || !p_cuGraphRetainUserObject || !p_cuUserObjectRelease) { + return nullptr; + } + auto* table = new GraphSlotTable(); + CUuserObject user_obj = nullptr; + { + GILReleaseGuard gil; + if (p_cuUserObjectCreate(&user_obj, table, + reinterpret_cast(destroy_graph_slot_table), + 1, CU_USER_OBJECT_NO_DESTRUCTOR_SYNC) != CUDA_SUCCESS) { + delete table; // no user object created; nothing else owns the table + return nullptr; + } + if (p_cuGraphRetainUserObject(box->resource, user_obj, 1, + CU_GRAPH_USER_OBJECT_MOVE) != CUDA_SUCCESS) { + p_cuUserObjectRelease(user_obj, 1); // drops refcount to 0 -> frees table + return nullptr; + } + } + box->slot_table = table; // non-owning cache; the user object owns it + return table; +} + +} // namespace + +OpaqueHandle make_opaque_py(PyObject* obj) { + Py_INCREF(obj); + return OpaqueHandle(static_cast(obj), py_deleter); +} + +OpaqueHandle make_opaque_malloc(void* buf) { + return OpaqueHandle(static_cast(buf), free_deleter); +} + +GraphHandle create_graph_handle(CUgraph graph) { + auto box = std::shared_ptr( + new GraphBox{graph, {}}, + [](const GraphBox* b) { + GILReleaseGuard gil; + p_cuGraphDestroy(b->resource); + delete b; + } + ); + return GraphHandle(box, &box->resource); +} + +GraphHandle create_graph_handle_ref(CUgraph graph, const GraphHandle& h_parent) { + auto box = std::make_shared(GraphBox{graph, h_parent}); + return GraphHandle(box, &box->resource); +} + +CUresult graph_set_slot(const GraphHandle& h_graph, CUgraphNode node, + unsigned int slot, OpaqueHandle owner) { + if (!h_graph || slot >= SLOTS_PER_NODE) { + return CUDA_ERROR_INVALID_VALUE; + } + if (!owner) { + return CUDA_SUCCESS; // nothing to retain; don't force table creation + } + GraphSlotTable* table = ensure_slot_table(get_box(h_graph)); + if (!table) { + return CUDA_ERROR_NOT_SUPPORTED; + } + (*table)[node][slot] = std::move(owner); + return CUDA_SUCCESS; +} + +// ============================================================================ +// Graph Exec Handles +// ============================================================================ + +namespace { +struct GraphExecBox { + CUgraphExec resource; +}; +} // namespace + +GraphExecHandle create_graph_exec_handle(CUgraphExec graph_exec) { + auto box = std::shared_ptr( + new GraphExecBox{graph_exec}, + [](const GraphExecBox* b) { + GILReleaseGuard gil; + p_cuGraphExecDestroy(b->resource); + delete b; + } + ); + return GraphExecHandle(box, &box->resource); +} + +namespace { +struct GraphNodeBox { + mutable CUgraphNode resource; + GraphHandle h_graph; +}; +} // namespace + +static const GraphNodeBox* get_box(const GraphNodeHandle& h) { + const CUgraphNode* p = h.get(); + return reinterpret_cast( + reinterpret_cast(p) - offsetof(GraphNodeBox, resource) + ); +} + +// See REGISTRY_DESIGN.md (Level 1: Driver Handle -> Resource Handle) +static HandleRegistry graph_node_registry; + +GraphNodeHandle create_graph_node_handle(CUgraphNode node, const GraphHandle& h_graph) { + if (node) { + if (auto h = graph_node_registry.lookup(node)) { + return h; + } + } + auto box = std::make_shared(GraphNodeBox{node, h_graph}); + GraphNodeHandle h(box, &box->resource); + if (node) { + graph_node_registry.register_handle(node, h); + } + return h; +} + +GraphHandle graph_node_get_graph(const GraphNodeHandle& h) noexcept { + return h ? get_box(h)->h_graph : GraphHandle{}; +} + +void invalidate_graph_node(const GraphNodeHandle& h) noexcept { + if (h) { + CUgraphNode node = get_box(h)->resource; + if (node) { + graph_node_registry.unregister_handle(node); + } + get_box(h)->resource = nullptr; + } +} + +// ============================================================================ +// Graphics Resource Handles +// ============================================================================ + +namespace { +struct GraphicsResourceBox { + CUgraphicsResource resource; +}; +} // namespace + +GraphicsResourceHandle create_graphics_resource_handle(CUgraphicsResource resource) { + auto box = std::shared_ptr( + new GraphicsResourceBox{resource}, + [](const GraphicsResourceBox* b) { + GILReleaseGuard gil; + p_cuGraphicsUnregisterResource(b->resource); + delete b; + } + ); + return GraphicsResourceHandle(box, &box->resource); +} + +// ============================================================================ +// NVRTC Program Handles +// ============================================================================ + +namespace { +struct NvrtcProgramBox { + nvrtcProgram resource; +}; +} // namespace + +NvrtcProgramHandle create_nvrtc_program_handle(nvrtcProgram prog) { + auto box = std::shared_ptr( + new NvrtcProgramBox{prog}, + [](NvrtcProgramBox* b) { + // Note: nvrtcDestroyProgram takes nvrtcProgram* and nulls it, + // but we're deleting the box anyway so nulling is harmless. + // Errors are ignored (standard destructor practice). + p_nvrtcDestroyProgram(&b->resource); + delete b; + } + ); + return NvrtcProgramHandle(box, &box->resource); +} + +NvrtcProgramHandle create_nvrtc_program_handle_ref(nvrtcProgram prog) { + auto box = std::make_shared(NvrtcProgramBox{prog}); + return NvrtcProgramHandle(box, &box->resource); +} + +// ============================================================================ +// NVVM Program Handles +// ============================================================================ + +namespace { +struct NvvmProgramBox { + NvvmProgramValue resource; +}; +} // namespace + +NvvmProgramHandle create_nvvm_program_handle(nvvmProgram prog) { + auto box = std::shared_ptr( + new NvvmProgramBox{{prog}}, + [](NvvmProgramBox* b) { + // Note: nvvmDestroyProgram takes nvvmProgram* and nulls it, + // but we're deleting the box anyway so nulling is harmless. + // If NVVM is not available, the function pointer is null. + if (p_nvvmDestroyProgram) { + p_nvvmDestroyProgram(&b->resource.raw); + } + delete b; + } + ); + return NvvmProgramHandle(box, &box->resource); +} + +NvvmProgramHandle create_nvvm_program_handle_ref(nvvmProgram prog) { + auto box = std::make_shared(NvvmProgramBox{{prog}}); + return NvvmProgramHandle(box, &box->resource); +} + +// ============================================================================ +// nvJitLink Handles +// ============================================================================ + +namespace { +struct NvJitLinkBox { + NvJitLinkValue resource; +}; +} // namespace + +NvJitLinkHandle create_nvjitlink_handle(nvJitLink_t handle) { + auto box = std::shared_ptr( + new NvJitLinkBox{{handle}}, + [](NvJitLinkBox* b) { + // Note: nvJitLinkDestroy takes nvJitLinkHandle* and nulls it, + // but we're deleting the box anyway so nulling is harmless. + // If nvJitLink is not available, the function pointer is null. + if (p_nvJitLinkDestroy) { + p_nvJitLinkDestroy(&b->resource.raw); + } + delete b; + } + ); + return NvJitLinkHandle(box, &box->resource); +} + +NvJitLinkHandle create_nvjitlink_handle_ref(nvJitLink_t handle) { + auto box = std::make_shared(NvJitLinkBox{{handle}}); + return NvJitLinkHandle(box, &box->resource); +} + +// ============================================================================ +// cuLink Handles +// ============================================================================ + +namespace { +struct CuLinkBox { + CUlinkState resource; +}; +} // namespace + +CuLinkHandle create_culink_handle(CUlinkState state) { + auto box = std::shared_ptr( + new CuLinkBox{state}, + [](CuLinkBox* b) { + // cuLinkDestroy takes CUlinkState by value (not pointer). + // Errors are ignored (standard destructor practice). + if (p_cuLinkDestroy) { + p_cuLinkDestroy(b->resource); + } + delete b; + } + ); + return CuLinkHandle(box, &box->resource); +} + +CuLinkHandle create_culink_handle_ref(CUlinkState state) { + auto box = std::make_shared(CuLinkBox{state}); + return CuLinkHandle(box, &box->resource); +} + +// ============================================================================ +// File Descriptor Handles +// ============================================================================ + +FileDescriptorHandle create_fd_handle(int fd) { +#ifdef _WIN32 + throw std::runtime_error("create_fd_handle is not supported on Windows"); +#else + return FileDescriptorHandle( + new int(fd), + [](const int* p) { ::close(*p); delete p; } + ); +#endif +} + +FileDescriptorHandle create_fd_handle_ref(int fd) { +#ifdef _WIN32 + throw std::runtime_error("create_fd_handle_ref is not supported on Windows"); +#else + return std::make_shared(fd); +#endif +} + +// ============================================================================ +// Array / mipmapped-array / texture / surface handles (PR #467) +// ============================================================================ + +namespace { +struct ArrayBox { + CUarray resource; + // Non-null only for a mipmap-level view: keeps the parent mipmap (the real + // owner of the level's storage) alive for as long as the level is held. + MipmappedArrayHandle h_parent; +}; + +struct MipmappedArrayBox { + CUmipmappedArray resource; +}; + +struct TexObjectBox { + // Tagged so TexObjectHandle is a distinct C++ type from DevicePtrHandle / + // SurfObjectHandle (all wrap `unsigned long long`). + TexObjectValue resource; + // Type-erased backing dependency (OpaqueArrayHandle / MipmappedArrayHandle / + // DevicePtrHandle). The texture's resource is a union; we only need to keep + // whichever backing it was built from alive, never to dereference it. + std::shared_ptr h_backing; +}; + +struct SurfObjectBox { + SurfObjectValue resource; + OpaqueArrayHandle h_array; // surfaces are always array-backed +}; +} // namespace + +OpaqueArrayHandle create_array_handle(const CUDA_ARRAY3D_DESCRIPTOR& desc) { + GILReleaseGuard gil; + CUarray arr; + if (CUDA_SUCCESS != (err = p_cuArray3DCreate(&arr, &desc))) { + return {}; + } + // Allocation and adoption share the same owning lifetime; the only + // difference is who calls cuArray3DCreate. Delegate so the owning box and + // its destroy-on-last-ref deleter are defined in exactly one place. + return create_array_handle_owning(arr); +} + +OpaqueArrayHandle create_array_handle_ref(CUarray arr) { + if (!arr) { + return {}; + } + auto box = std::make_shared(ArrayBox{arr, {}}); + return OpaqueArrayHandle(box, &box->resource); +} + +OpaqueArrayHandle create_array_handle_owning(CUarray arr) { + if (!arr) { + return {}; + } + auto box = std::shared_ptr( + new ArrayBox{arr, {}}, + [](const ArrayBox* b) { + GILReleaseGuard gil; + p_cuArrayDestroy(b->resource); + delete b; + } + ); + return OpaqueArrayHandle(box, &box->resource); +} + +OpaqueArrayHandle create_array_level_handle(const MipmappedArrayHandle& h_mip, unsigned int level) { + GILReleaseGuard gil; + CUarray arr; + if (CUDA_SUCCESS != (err = p_cuMipmappedArrayGetLevel(&arr, as_cu(h_mip), level))) { + return {}; + } + // Non-owning level view: storage belongs to the mipmap. Embed the mipmap + // handle so the parent outlives this level; the deleter does not destroy. + auto box = std::shared_ptr( + new ArrayBox{arr, h_mip}, + [](const ArrayBox* b) { delete b; } + ); + return OpaqueArrayHandle(box, &box->resource); +} + +MipmappedArrayHandle create_mipmapped_array_handle(const CUDA_ARRAY3D_DESCRIPTOR& desc, + unsigned int num_levels) { + GILReleaseGuard gil; + CUmipmappedArray mip; + if (CUDA_SUCCESS != (err = p_cuMipmappedArrayCreate(&mip, &desc, num_levels))) { + return {}; + } + auto box = std::shared_ptr( + new MipmappedArrayBox{mip}, + [](const MipmappedArrayBox* b) { + GILReleaseGuard gil; + p_cuMipmappedArrayDestroy(b->resource); + delete b; + } + ); + return MipmappedArrayHandle(box, &box->resource); +} + +namespace { +TexObjectHandle make_tex_object_handle(const CUDA_RESOURCE_DESC& res, + const CUDA_TEXTURE_DESC& tex, + std::shared_ptr h_backing) { + GILReleaseGuard gil; + CUtexObject obj; + if (CUDA_SUCCESS != (err = p_cuTexObjectCreate(&obj, &res, &tex, nullptr))) { + return {}; + } + auto box = std::shared_ptr( + new TexObjectBox{TexObjectValue{obj}, std::move(h_backing)}, + [](const TexObjectBox* b) { + GILReleaseGuard gil; + p_cuTexObjectDestroy(b->resource.raw); + delete b; + } + ); + return TexObjectHandle(box, &box->resource); +} +} // namespace + +TexObjectHandle create_tex_object_handle_array(const CUDA_RESOURCE_DESC& res, + const CUDA_TEXTURE_DESC& tex, + const OpaqueArrayHandle& h_backing) { + return make_tex_object_handle(res, tex, h_backing); +} + +TexObjectHandle create_tex_object_handle_mipmap(const CUDA_RESOURCE_DESC& res, + const CUDA_TEXTURE_DESC& tex, + const MipmappedArrayHandle& h_backing) { + return make_tex_object_handle(res, tex, h_backing); +} + +TexObjectHandle create_tex_object_handle_linear(const CUDA_RESOURCE_DESC& res, + const CUDA_TEXTURE_DESC& tex, + const DevicePtrHandle& h_backing) { + return make_tex_object_handle(res, tex, h_backing); +} + +SurfObjectHandle create_surf_object_handle(const CUDA_RESOURCE_DESC& res, + const OpaqueArrayHandle& h_backing) { + GILReleaseGuard gil; + CUsurfObject obj; + if (CUDA_SUCCESS != (err = p_cuSurfObjectCreate(&obj, &res))) { + return {}; + } + auto box = std::shared_ptr( + new SurfObjectBox{SurfObjectValue{obj}, h_backing}, + [](const SurfObjectBox* b) { + GILReleaseGuard gil; + p_cuSurfObjectDestroy(b->resource.raw); + delete b; + } + ); + return SurfObjectHandle(box, &box->resource); +} + +// ============================================================================ +// SM resource split wrapper +// ============================================================================ + +CUresult sm_resource_split(CUdevResource* result, unsigned int nbGroups, + const CUdevResource* input, CUdevResource* remainder, + unsigned int flags, void* groupParams) { +#if CUDA_VERSION >= 13010 + if (!p_cuDevSmResourceSplit) { + return CUDA_ERROR_NOT_SUPPORTED; + } + return p_cuDevSmResourceSplit( + result, nbGroups, input, remainder, flags, + static_cast(groupParams)); +#else + return CUDA_ERROR_NOT_SUPPORTED; +#endif +} + +bool has_sm_resource_split() noexcept { + return p_cuDevSmResourceSplit != nullptr; +} + +} // namespace cuda_core diff --git a/cuda_core/cuda/core/_cpp/resource_handles.hpp b/cuda_core/cuda/core/_cpp/resource_handles.hpp new file mode 100644 index 00000000000..e8f4e83ecaf --- /dev/null +++ b/cuda_core/cuda/core/_cpp/resource_handles.hpp @@ -0,0 +1,983 @@ +// SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +#pragma once + +#include +#include +#include +#include +#include + +// Forward declaration for NVVM - avoids nvvm.h dependency +// Use void* to match cuda.bindings.cynvvm's typedef +using nvvmProgram = void*; + +// Forward declaration for nvJitLink - avoids nvJitLink.h dependency +// Use void* to match cuda.bindings.cynvjitlink's typedef +using nvJitLink_t = void*; + +namespace cuda_core { + +// ============================================================================ +// TaggedHandle - make void*-based handle types distinct for overloading +// +// Both nvvmProgram and nvJitLink_t are void*, so shared_ptr +// would be the same C++ type for both. TaggedHandle wraps the raw +// value with a unique tag type, making each shared_ptr type distinct. +// ============================================================================ + +template +struct TaggedHandle { + T raw; +}; + +using NvvmProgramValue = TaggedHandle; +using NvJitLinkValue = TaggedHandle; + +// CUtexObject, CUsurfObject and CUdeviceptr are all `unsigned long long`, so +// shared_ptr et al. would be the *same* C++ type as +// DevicePtrHandle (and each other), collapsing the as_cu/as_intptr/as_py +// overload sets. Tag them to keep each handle type distinct, exactly as the +// NVVM / nvJitLink handles above do. +using TexObjectValue = TaggedHandle; +using SurfObjectValue = TaggedHandle; + +// ============================================================================ +// Thread-local error handling +// ============================================================================ + +// Get and clear the last CUDA error (like cudaGetLastError) +CUresult get_last_error() noexcept; + +// Get the last CUDA error without clearing it (like cudaPeekAtLastError) +CUresult peek_last_error() noexcept; + +// Explicitly clear the last error +void clear_last_error() noexcept; + +// ============================================================================ +// CUDA driver function pointers +// +// These are populated by _resource_handles.pyx at module import time using +// function pointers extracted from cuda.bindings.cydriver.__pyx_capi__. +// ============================================================================ + +extern decltype(&cuDevicePrimaryCtxRetain) p_cuDevicePrimaryCtxRetain; +extern decltype(&cuDevicePrimaryCtxRelease) p_cuDevicePrimaryCtxRelease; +extern decltype(&cuCtxGetCurrent) p_cuCtxGetCurrent; +extern decltype(&cuGreenCtxCreate) p_cuGreenCtxCreate; +extern decltype(&cuGreenCtxDestroy) p_cuGreenCtxDestroy; +extern decltype(&cuCtxFromGreenCtx) p_cuCtxFromGreenCtx; +extern decltype(&cuDevResourceGenerateDesc) p_cuDevResourceGenerateDesc; + +extern decltype(&cuGreenCtxStreamCreate) p_cuGreenCtxStreamCreate; + +extern decltype(&cuStreamCreateWithPriority) p_cuStreamCreateWithPriority; +extern decltype(&cuStreamDestroy) p_cuStreamDestroy; + +extern decltype(&cuEventCreate) p_cuEventCreate; +extern decltype(&cuEventDestroy) p_cuEventDestroy; +extern decltype(&cuIpcOpenEventHandle) p_cuIpcOpenEventHandle; + +extern decltype(&cuDeviceGetCount) p_cuDeviceGetCount; + +extern decltype(&cuMemPoolSetAccess) p_cuMemPoolSetAccess; +extern decltype(&cuMemPoolDestroy) p_cuMemPoolDestroy; +extern decltype(&cuMemPoolCreate) p_cuMemPoolCreate; +extern decltype(&cuDeviceGetMemPool) p_cuDeviceGetMemPool; +extern decltype(&cuMemPoolImportFromShareableHandle) p_cuMemPoolImportFromShareableHandle; + +extern decltype(&cuMemAllocFromPoolAsync) p_cuMemAllocFromPoolAsync; +extern decltype(&cuMemAllocAsync) p_cuMemAllocAsync; +extern decltype(&cuMemAlloc) p_cuMemAlloc; +extern decltype(&cuMemAllocHost) p_cuMemAllocHost; + +extern decltype(&cuMemFreeAsync) p_cuMemFreeAsync; +extern decltype(&cuMemFree) p_cuMemFree; +extern decltype(&cuMemFreeHost) p_cuMemFreeHost; + +extern decltype(&cuMemPoolImportPointer) p_cuMemPoolImportPointer; + +// Library +extern decltype(&cuLibraryLoadFromFile) p_cuLibraryLoadFromFile; +extern decltype(&cuLibraryLoadData) p_cuLibraryLoadData; +extern decltype(&cuLibraryUnload) p_cuLibraryUnload; +extern decltype(&cuLibraryGetKernel) p_cuLibraryGetKernel; + +// Graph +extern decltype(&cuGraphDestroy) p_cuGraphDestroy; +extern decltype(&cuGraphExecDestroy) p_cuGraphExecDestroy; +extern decltype(&cuUserObjectCreate) p_cuUserObjectCreate; +extern decltype(&cuUserObjectRelease) p_cuUserObjectRelease; +extern decltype(&cuGraphRetainUserObject) p_cuGraphRetainUserObject; + +// Linker +extern decltype(&cuLinkDestroy) p_cuLinkDestroy; + +// Graphics interop +extern decltype(&cuGraphicsUnmapResources) p_cuGraphicsUnmapResources; +extern decltype(&cuGraphicsUnregisterResource) p_cuGraphicsUnregisterResource; + +// Texture / surface / array (PR #467) +extern decltype(&cuArray3DCreate) p_cuArray3DCreate; +extern decltype(&cuArrayDestroy) p_cuArrayDestroy; +extern decltype(&cuMipmappedArrayCreate) p_cuMipmappedArrayCreate; +extern decltype(&cuMipmappedArrayDestroy) p_cuMipmappedArrayDestroy; +extern decltype(&cuMipmappedArrayGetLevel) p_cuMipmappedArrayGetLevel; +extern decltype(&cuTexObjectCreate) p_cuTexObjectCreate; +extern decltype(&cuTexObjectDestroy) p_cuTexObjectDestroy; +extern decltype(&cuSurfObjectCreate) p_cuSurfObjectCreate; +extern decltype(&cuSurfObjectDestroy) p_cuSurfObjectDestroy; + +// SM resource split (13.1+ — may be null on older drivers/bindings) +#if CUDA_VERSION >= 13010 +extern decltype(&cuDevSmResourceSplit) p_cuDevSmResourceSplit; +#else +// cuDevSmResourceSplit doesn't exist in CUDA < 13.1 headers, so use a +// void* placeholder. The pointer is always null when built against 12.x. +extern void* p_cuDevSmResourceSplit; +#endif + +// ============================================================================ +// NVRTC function pointers +// +// These are populated by _resource_handles.pyx at module import time using +// function pointers extracted from cuda.bindings.cynvrtc.__pyx_capi__. +// ============================================================================ + +extern decltype(&nvrtcDestroyProgram) p_nvrtcDestroyProgram; + +// ============================================================================ +// NVVM function pointers +// +// These are populated by _resource_handles.pyx at module import time using +// function pointers extracted from cuda.bindings.cynvvm.__pyx_capi__. +// Note: May be null if NVVM is not available at runtime. +// ============================================================================ + +// Function pointer type for nvvmDestroyProgram (avoids nvvm.h dependency) +// Signature: nvvmResult nvvmDestroyProgram(nvvmProgram *prog) +using NvvmDestroyProgramFn = int (*)(nvvmProgram*); +extern NvvmDestroyProgramFn p_nvvmDestroyProgram; + +// ============================================================================ +// nvJitLink function pointers +// +// These are populated by _resource_handles.pyx at module import time using +// function pointers extracted from cuda.bindings.cynvjitlink.__pyx_capi__. +// Note: May be null if nvJitLink is not available at runtime. +// ============================================================================ + +// Function pointer type for nvJitLinkDestroy (avoids nvJitLink.h dependency) +// Signature: nvJitLinkResult nvJitLinkDestroy(nvJitLinkHandle *handle) +using NvJitLinkDestroyFn = int (*)(nvJitLink_t*); +extern NvJitLinkDestroyFn p_nvJitLinkDestroy; + +// ============================================================================ +// Handle type aliases - expose only the raw CUDA resource +// ============================================================================ + +using ContextHandle = std::shared_ptr; +using GreenCtxHandle = std::shared_ptr; +using StreamHandle = std::shared_ptr; +using EventHandle = std::shared_ptr; +using MemoryPoolHandle = std::shared_ptr; +using LibraryHandle = std::shared_ptr; +using KernelHandle = std::shared_ptr; +using GraphHandle = std::shared_ptr; +using GraphExecHandle = std::shared_ptr; +using GraphNodeHandle = std::shared_ptr; +using GraphicsResourceHandle = std::shared_ptr; +using NvrtcProgramHandle = std::shared_ptr; +using NvvmProgramHandle = std::shared_ptr; +using NvJitLinkHandle = std::shared_ptr; +using CuLinkHandle = std::shared_ptr; +using FileDescriptorHandle = std::shared_ptr; +using OpaqueArrayHandle = std::shared_ptr; +using MipmappedArrayHandle = std::shared_ptr; +using TexObjectHandle = std::shared_ptr; +using SurfObjectHandle = std::shared_ptr; + + +// ============================================================================ +// Context handle functions +// ============================================================================ + +// Function to create a non-owning context handle (references existing context). +ContextHandle create_context_handle_ref(CUcontext ctx); + +// Create a context handle for the CUcontext view of the provided green context. +// The returned ContextHandle keeps the green context alive, but the CUcontext +// view is non-owning and is not destroyed independently. +ContextHandle create_context_handle_from_green_ctx(const GreenCtxHandle& h_green_ctx); + +// Return the green context dependency associated with a ContextHandle, if any. +GreenCtxHandle get_context_green_ctx(const ContextHandle& h) noexcept; + +// Create an owning green context handle from a list of device resources. +GreenCtxHandle create_green_ctx_handle(CUdevResource* resources, unsigned int nbResources, + CUdevice dev, unsigned int flags); + +// Create a non-owning green context handle. +GreenCtxHandle create_green_ctx_handle_ref(CUgreenCtx ctx); + +// Get handle to the primary context for a device (with thread-local caching) +// Returns empty handle on error (caller must check) +ContextHandle get_primary_context(int device_id); + +// Get handle to the current CUDA context +// Returns empty handle if no context is current (caller must check) +ContextHandle get_current_context(); + +// ============================================================================ +// Stream handle functions +// ============================================================================ + +// Create an owning stream handle by calling cuStreamCreateWithPriority. +// The stream structurally depends on the provided context handle. +// When the last reference is released, cuStreamDestroy is called automatically. +// Returns empty handle on error (caller must check). +StreamHandle create_stream_handle(const ContextHandle& h_ctx, unsigned int flags, int priority); + +// Create a non-owning stream handle (references existing stream). +// Use for borrowed streams (from foreign code) or built-in streams. +// The stream will NOT be destroyed when the handle is released. +// Caller is responsible for keeping the stream's context alive. +StreamHandle create_stream_handle_ref(CUstream stream); + +// Create a non-owning stream handle that prevents a Python owner from being GC'd. +// The owner's refcount is incremented; decremented when handle is released. +// The owner is responsible for keeping the stream's context alive. +StreamHandle create_stream_handle_with_owner(CUstream stream, PyObject* owner); + +// Destroy a Python-backed CUDA user object by decref'ing it when safe. +// If Python is finalized or finalizing, the object is intentionally leaked. +void py_object_user_object_destroy(void* py_object) noexcept; + +// Return the context dependency associated with a stream handle, if any. +ContextHandle get_stream_context(const StreamHandle& h) noexcept; + +// Get non-owning handle to the legacy default stream (CU_STREAM_LEGACY) +// Note: Legacy stream has no specific context dependency. +StreamHandle get_legacy_stream(); + +// Get non-owning handle to the per-thread default stream (CU_STREAM_PER_THREAD) +// Note: Per-thread stream has no specific context dependency. +StreamHandle get_per_thread_stream(); + +// ============================================================================ +// Event handle functions +// ============================================================================ + +// Create an owning event handle by calling cuEventCreate. +// The event structurally depends on the provided context handle. +// Metadata fields are stored in the EventBox for later retrieval. +// When the last reference is released, cuEventDestroy is called automatically. +// Returns empty handle on error (caller must check). +EventHandle create_event_handle(const ContextHandle& h_ctx, unsigned int flags, + bool timing_enabled, bool is_blocking_sync, + bool ipc_enabled, int device_id); + +// Create an owning event handle without context dependency. +// Use for temporary events that are created and destroyed in the same scope. +// When the last reference is released, cuEventDestroy is called automatically. +// Returns empty handle on error (caller must check). +EventHandle create_event_handle_noctx(unsigned int flags); + +// Create an owning event handle from an IPC handle. +// The originating process owns the event and its context. +// When the last reference is released, cuEventDestroy is called automatically. +// Returns empty handle on error (caller must check). +EventHandle create_event_handle_ipc(const CUipcEventHandle& ipc_handle, + bool is_blocking_sync); + +// Create a non-owning event handle (references existing event). +// Use for events that are managed by the CUDA graph or another owner. +// The event will NOT be destroyed when the handle is released. +// Metadata defaults to unknown (timing_enabled=false, device_id=-1). +EventHandle create_event_handle_ref(CUevent event); + +// Event metadata accessors (read from EventBox via pointer arithmetic) +bool get_event_timing_enabled(const EventHandle& h) noexcept; +bool get_event_is_blocking_sync(const EventHandle& h) noexcept; +bool get_event_ipc_enabled(const EventHandle& h) noexcept; +int get_event_device_id(const EventHandle& h) noexcept; +ContextHandle get_event_context(const EventHandle& h) noexcept; + +// ============================================================================ +// Memory pool handle functions +// ============================================================================ + +// Create an owning memory pool handle by calling cuMemPoolCreate. +// Memory pools are device-scoped (not context-scoped). +// When the last reference is released, cuMemPoolDestroy is called automatically. +// Returns empty handle on error (caller must check). +MemoryPoolHandle create_mempool_handle(const CUmemPoolProps& props); + +// Create a non-owning memory pool handle (references existing pool). +// Use for device default/current pools that are managed by the driver. +// The pool will NOT be destroyed when the handle is released. +MemoryPoolHandle create_mempool_handle_ref(CUmemoryPool pool); + +// Get non-owning handle to the current memory pool for a device. +// Returns empty handle on error (caller must check). +MemoryPoolHandle get_device_mempool(int device_id); + +// Create an owning memory pool handle from an IPC import. +// The file descriptor is NOT owned by this handle (caller manages FD separately). +// When the last reference is released, cuMemPoolDestroy is called automatically. +// Returns empty handle on error (caller must check). +MemoryPoolHandle create_mempool_handle_ipc(int fd, CUmemAllocationHandleType handle_type); + +// ============================================================================ +// Device pointer handle functions +// ============================================================================ + +using DevicePtrHandle = std::shared_ptr; + +// Allocate device memory from a pool asynchronously via cuMemAllocFromPoolAsync. +// The pointer structurally depends on the provided pool handle (captured in deleter). +// When the last reference is released, cuMemFreeAsync is called on the stored stream. +// Returns empty handle on error (caller must check). +DevicePtrHandle deviceptr_alloc_from_pool( + size_t size, + const MemoryPoolHandle& h_pool, + const StreamHandle& h_stream); + +// Allocate device memory asynchronously via cuMemAllocAsync. +// When the last reference is released, cuMemFreeAsync is called on the stored stream. +// Returns empty handle on error (caller must check). +DevicePtrHandle deviceptr_alloc_async(size_t size, const StreamHandle& h_stream); + +// Allocate device memory synchronously via cuMemAlloc. +// When the last reference is released, cuMemFree is called. +// Returns empty handle on error (caller must check). +DevicePtrHandle deviceptr_alloc(size_t size); + +// Allocate pinned host memory via cuMemAllocHost. +// When the last reference is released, cuMemFreeHost is called. +// Returns empty handle on error (caller must check). +DevicePtrHandle deviceptr_alloc_host(size_t size); + +// Create a non-owning device pointer handle (references existing pointer). +// Use for foreign pointers (e.g., from external libraries). +// The pointer will NOT be freed when the handle is released. +DevicePtrHandle deviceptr_create_ref(CUdeviceptr ptr); + +// Create a non-owning device pointer handle that prevents a Python owner from being GC'd. +// The owner's refcount is incremented; decremented when handle is released. +// The pointer will NOT be freed when the handle is released. +// If owner is nullptr, equivalent to deviceptr_create_ref. +DevicePtrHandle deviceptr_create_with_owner(CUdeviceptr ptr, PyObject* owner); + +// Create a device pointer handle for a mapped graphics resource. +// The pointer structurally depends on the provided graphics resource handle. +// When the last reference is released, cuGraphicsUnmapResources is called on +// the stored stream, then the graphics resource may be unregistered when its +// own handle is released. +DevicePtrHandle deviceptr_create_mapped_graphics( + CUdeviceptr ptr, + const GraphicsResourceHandle& h_resource, + const StreamHandle& h_stream); + +// Callback type for MemoryResource deallocation. +// Called from the shared_ptr deleter when a handle created via +// deviceptr_create_with_mr is destroyed. The implementation is responsible +// for converting raw C types to Python objects and calling +// mr.deallocate(ptr, size, stream). +using MRDeallocCallback = void (*)(PyObject* mr, CUdeviceptr ptr, + size_t size, const StreamHandle& stream); + +// Register the MR deallocation callback. +void register_mr_dealloc_callback(MRDeallocCallback cb); + +// Create a device pointer handle whose destructor calls mr.deallocate() +// via the registered callback. The mr's refcount is incremented and +// decremented when the handle is released. +// If mr is nullptr, equivalent to deviceptr_create_ref. +DevicePtrHandle deviceptr_create_with_mr(CUdeviceptr ptr, size_t size, PyObject* mr); + +// Import a device pointer from IPC via cuMemPoolImportPointer. +// When the last reference is released, cuMemFreeAsync is called on the stored stream. +// Note: Does not yet implement reference counting for nvbug 5570902. +// On error, returns empty handle and sets thread-local error (use get_last_error()). +DevicePtrHandle deviceptr_import_ipc( + const MemoryPoolHandle& h_pool, + const void* export_data, + const StreamHandle& h_stream); + +// Access the deallocation stream for a device pointer handle (read-only). +// For non-owning handles, the stream is not used but can still be accessed. +StreamHandle deallocation_stream(const DevicePtrHandle& h) noexcept; + +// Set the deallocation stream for a device pointer handle. +void set_deallocation_stream(const DevicePtrHandle& h, const StreamHandle& h_stream) noexcept; + +// ============================================================================ +// Library handle functions +// ============================================================================ + +// Create an owning library handle by loading from a file path. +// When the last reference is released, cuLibraryUnload is called automatically. +// Returns empty handle on error (caller must check). +LibraryHandle create_library_handle_from_file(const char* path); + +// Create an owning library handle by loading from memory data. +// The driver makes an internal copy of the data; caller can free it after return. +// When the last reference is released, cuLibraryUnload is called automatically. +// Returns empty handle on error (caller must check). +LibraryHandle create_library_handle_from_data(const void* data); + +// Create a non-owning library handle (references existing library). +// Use for borrowed libraries (e.g., from foreign code). +// The library will NOT be unloaded when the handle is released. +LibraryHandle create_library_handle_ref(CUlibrary library); + +// ============================================================================ +// Kernel handle functions +// ============================================================================ + +// Get a kernel from a library by name. +// The kernel structurally depends on the provided library handle. +// Kernels have no explicit destroy - their lifetime is tied to the library. +// Returns empty handle on error (caller must check). +KernelHandle create_kernel_handle(const LibraryHandle& h_library, const char* name); + +// Create a kernel handle from a raw CUkernel. +// If the kernel is already managed (in the registry), returns the owning +// handle with library dependency. Otherwise returns a non-owning ref. +KernelHandle create_kernel_handle_ref(CUkernel kernel); + +// Get the library handle associated with a kernel (from KernelBox). +// Returns empty handle if the kernel has no library dependency. +LibraryHandle get_kernel_library(const KernelHandle& h) noexcept; + +// ============================================================================ +// Graph handle functions +// ============================================================================ + +// Wrap an externally-created CUgraph with RAII cleanup. +// When the last reference is released, cuGraphDestroy is called automatically. +// The caller must have already created the graph via cuGraphCreate. +GraphHandle create_graph_handle(CUgraph graph); + +// Create a non-owning graph handle that keeps h_parent alive. +// Use for graphs owned by a child/conditional node in a parent graph. +// The child graph will NOT be destroyed when this handle is released, +// but h_parent will be prevented from destruction while this handle exists. +GraphHandle create_graph_handle_ref(CUgraph graph, const GraphHandle& h_parent); + +// ============================================================================ +// Graph slot attachments +// +// A graph carries a side table that keeps resources used by its nodes (kernel +// arguments, host callbacks, events, ...) alive for as long as the graph can +// execute. The table is created on first use and retained on the CUgraph as a +// user object, so the driver releases it -- and everything attached through it +// -- when the graph is destroyed. The table layout is an internal detail; +// callers use the abstract API below. +// ============================================================================ + +// Type-erased shared owner of an attached resource. Typed handles such as +// EventHandle and KernelHandle convert to OpaqueHandle by assignment, reusing +// their existing control block; the helpers below build OpaqueHandles for the +// two cases that need a custom deleter. +using OpaqueHandle = std::shared_ptr; + +// Build an OpaqueHandle from a Python object: increments its refcount now and +// decrements it (under the GIL) on release. The caller must hold the GIL. +OpaqueHandle make_opaque_py(PyObject* obj); + +// Build an OpaqueHandle from a malloc'd buffer: std::free on release. +OpaqueHandle make_opaque_malloc(void* buf); + +// Attach owner to one of node's fixed slots on h_graph, replacing whatever was +// there. The graph's slot table is created on first use. A null owner is a +// no-op (returns CUDA_SUCCESS without creating the table), so callers need not +// guard optional owners. Returns CUDA_SUCCESS, or an error if slot is out of +// range or the graph cannot hold a table (e.g. the driver lacks user-object +// support). +CUresult graph_set_slot(const GraphHandle& h_graph, CUgraphNode node, + unsigned int slot, OpaqueHandle owner); + +// ============================================================================ +// Graph exec handle functions +// ============================================================================ + +// Wrap an externally-created CUgraphExec with RAII cleanup. +// When the last reference is released, cuGraphExecDestroy is called automatically. +GraphExecHandle create_graph_exec_handle(CUgraphExec graph_exec); + +// ============================================================================ +// Graph node handle functions +// ============================================================================ + +// Create a node handle. Nodes are owned by their parent graph (not +// independently destroyable). The GraphHandle dependency ensures the +// graph outlives any node reference. +GraphNodeHandle create_graph_node_handle(CUgraphNode node, const GraphHandle& h_graph); + +// Extract the owning graph handle from a node handle. +GraphHandle graph_node_get_graph(const GraphNodeHandle& h) noexcept; + +// Zero the CUgraphNode resource inside the handle, marking it invalid. +void invalidate_graph_node(const GraphNodeHandle& h) noexcept; + +// ============================================================================ +// Graphics resource handle functions +// ============================================================================ + +// Create an owning graphics resource handle. +// When the last reference is released, cuGraphicsUnregisterResource is called automatically. +// Use for CUgraphicsResource handles obtained from cuGraphicsGLRegisterBuffer etc. +GraphicsResourceHandle create_graphics_resource_handle(CUgraphicsResource resource); + +// ============================================================================ +// NVRTC Program handle functions +// ============================================================================ + +// Create an owning NVRTC program handle. +// When the last reference is released, nvrtcDestroyProgram is called. +// Use this to wrap a program created via nvrtcCreateProgram. +NvrtcProgramHandle create_nvrtc_program_handle(nvrtcProgram prog); + +// Create a non-owning NVRTC program handle (references existing program). +// The program will NOT be destroyed when the handle is released. +NvrtcProgramHandle create_nvrtc_program_handle_ref(nvrtcProgram prog); + +// ============================================================================ +// NVVM Program handle functions +// ============================================================================ + +// Create an owning NVVM program handle. +// When the last reference is released, nvvmDestroyProgram is called. +// Use this to wrap a program created via nvvmCreateProgram. +// Note: If NVVM is not available (p_nvvmDestroyProgram is null), the deleter is a no-op. +NvvmProgramHandle create_nvvm_program_handle(nvvmProgram prog); + +// Create a non-owning NVVM program handle (references existing program). +// The program will NOT be destroyed when the handle is released. +NvvmProgramHandle create_nvvm_program_handle_ref(nvvmProgram prog); + +// ============================================================================ +// nvJitLink handle functions +// ============================================================================ + +// Create an owning nvJitLink handle. +// When the last reference is released, nvJitLinkDestroy is called. +// Use this to wrap a handle created via nvJitLinkCreate. +// Note: If nvJitLink is not available (p_nvJitLinkDestroy is null), the deleter is a no-op. +NvJitLinkHandle create_nvjitlink_handle(nvJitLink_t handle); + +// Create a non-owning nvJitLink handle (references existing handle). +// The handle will NOT be destroyed when the last reference is released. +NvJitLinkHandle create_nvjitlink_handle_ref(nvJitLink_t handle); + +// ============================================================================ +// cuLink handle functions +// ============================================================================ + +// Create an owning cuLink handle. +// When the last reference is released, cuLinkDestroy is called. +// Use this to wrap a CUlinkState created via cuLinkCreate. +CuLinkHandle create_culink_handle(CUlinkState state); + +// Create a non-owning cuLink handle (references existing CUlinkState). +// The handle will NOT be destroyed when the last reference is released. +CuLinkHandle create_culink_handle_ref(CUlinkState state); + +// ============================================================================ +// File descriptor handle functions +// ============================================================================ + +// Create an owning file descriptor handle. +// When the last reference is released, POSIX close() is called. +FileDescriptorHandle create_fd_handle(int fd); + +// Create a non-owning file descriptor handle (caller manages the fd). +FileDescriptorHandle create_fd_handle_ref(int fd); + +// ============================================================================ +// Array / mipmapped-array / texture / surface handle functions (PR #467) +// +// These resources are managed exactly like every other cuda.core resource: +// the owning handle's deleter calls the matching cu*Destroy with the GIL +// released, structural dependencies are embedded in the box (so a backing +// resource always outlives a texture/surface/level built on it), and +// creation returns an empty handle + thread-local error on failure. +// ============================================================================ + +// Create an owning CUDA array via cuArray3DCreate. +// When the last reference is released, cuArrayDestroy is called automatically. +// Returns empty handle on error (caller must check). +OpaqueArrayHandle create_array_handle(const CUDA_ARRAY3D_DESCRIPTOR& desc); + +// Create a non-owning array handle (references an existing CUarray). +// Use for arrays owned elsewhere (e.g. graphics interop). Never destroyed here. +OpaqueArrayHandle create_array_handle_ref(CUarray arr); + +// Create an owning array handle adopting an existing CUarray. +// When the last reference is released, cuArrayDestroy is called automatically. +OpaqueArrayHandle create_array_handle_owning(CUarray arr); + +// Create a non-owning handle to a mipmap level via cuMipmappedArrayGetLevel. +// The level CUarray is owned by the mipmap; the parent MipmappedArrayHandle is +// embedded in the box so it outlives the level view. No destroy in the deleter. +// Returns empty handle on error (caller must check). +OpaqueArrayHandle create_array_level_handle(const MipmappedArrayHandle& h_mip, unsigned int level); + +// Create an owning mipmapped array via cuMipmappedArrayCreate. +// When the last reference is released, cuMipmappedArrayDestroy is called. +// Returns empty handle on error (caller must check). +MipmappedArrayHandle create_mipmapped_array_handle(const CUDA_ARRAY3D_DESCRIPTOR& desc, + unsigned int num_levels); + +// Create an owning texture object via cuTexObjectCreate, embedding the backing +// resource handle (array / mipmapped array / linear-or-pitch2d device pointer) +// so the backing always outlives the texture. cuTexObjectDestroy runs in the +// deleter. Returns empty handle on error (caller must check). +TexObjectHandle create_tex_object_handle_array(const CUDA_RESOURCE_DESC& res, + const CUDA_TEXTURE_DESC& tex, + const OpaqueArrayHandle& h_backing); +TexObjectHandle create_tex_object_handle_mipmap(const CUDA_RESOURCE_DESC& res, + const CUDA_TEXTURE_DESC& tex, + const MipmappedArrayHandle& h_backing); +TexObjectHandle create_tex_object_handle_linear(const CUDA_RESOURCE_DESC& res, + const CUDA_TEXTURE_DESC& tex, + const DevicePtrHandle& h_backing); + +// Create an owning surface object via cuSurfObjectCreate, embedding the backing +// array handle so it outlives the surface. cuSurfObjectDestroy runs in the +// deleter. Returns empty handle on error (caller must check). +SurfObjectHandle create_surf_object_handle(const CUDA_RESOURCE_DESC& res, + const OpaqueArrayHandle& h_backing); + +// ============================================================================ +// Overloaded helper functions to extract raw resources from handles +// ============================================================================ + +// as_cu() - extract the raw CUDA handle +inline CUcontext as_cu(const ContextHandle& h) noexcept { + return h ? *h : nullptr; +} + +inline CUgreenCtx as_cu(const GreenCtxHandle& h) noexcept { + return h ? *h : nullptr; +} + +inline CUstream as_cu(const StreamHandle& h) noexcept { + return h ? *h : nullptr; +} + +inline CUevent as_cu(const EventHandle& h) noexcept { + return h ? *h : nullptr; +} + +inline CUmemoryPool as_cu(const MemoryPoolHandle& h) noexcept { + return h ? *h : nullptr; +} + +inline CUdeviceptr as_cu(const DevicePtrHandle& h) noexcept { + return h ? *h : 0; +} + +inline CUlibrary as_cu(const LibraryHandle& h) noexcept { + return h ? *h : nullptr; +} + +inline CUkernel as_cu(const KernelHandle& h) noexcept { + return h ? *h : nullptr; +} + +inline CUgraph as_cu(const GraphHandle& h) noexcept { + return h ? *h : nullptr; +} + +inline CUgraphExec as_cu(const GraphExecHandle& h) noexcept { + return h ? *h : nullptr; +} + +inline CUgraphNode as_cu(const GraphNodeHandle& h) noexcept { + return h ? *h : nullptr; +} + +inline CUgraphicsResource as_cu(const GraphicsResourceHandle& h) noexcept { + return h ? *h : nullptr; +} + +inline nvrtcProgram as_cu(const NvrtcProgramHandle& h) noexcept { + return h ? *h : nullptr; +} + +inline nvvmProgram as_cu(const NvvmProgramHandle& h) noexcept { + return h ? h->raw : nullptr; +} + +inline nvJitLink_t as_cu(const NvJitLinkHandle& h) noexcept { + return h ? h->raw : nullptr; +} + +inline CUlinkState as_cu(const CuLinkHandle& h) noexcept { + return h ? *h : nullptr; +} + +inline CUarray as_cu(const OpaqueArrayHandle& h) noexcept { + return h ? *h : nullptr; +} + +inline CUmipmappedArray as_cu(const MipmappedArrayHandle& h) noexcept { + return h ? *h : nullptr; +} + +// CUtexObject / CUsurfObject are integer-valued (like CUdeviceptr); null is 0. +// The raw value lives in the tagged wrapper's `raw` field. +inline CUtexObject as_cu(const TexObjectHandle& h) noexcept { + return h ? h->raw : 0; +} + +inline CUsurfObject as_cu(const SurfObjectHandle& h) noexcept { + return h ? h->raw : 0; +} + +// as_intptr() - extract handle as intptr_t for Python interop +// Using signed intptr_t per C standard convention and issue #1342 +inline std::intptr_t as_intptr(const ContextHandle& h) noexcept { + return reinterpret_cast(as_cu(h)); +} + +inline std::intptr_t as_intptr(const GreenCtxHandle& h) noexcept { + return reinterpret_cast(as_cu(h)); +} + +inline std::intptr_t as_intptr(const StreamHandle& h) noexcept { + return reinterpret_cast(as_cu(h)); +} + +inline std::intptr_t as_intptr(const EventHandle& h) noexcept { + return reinterpret_cast(as_cu(h)); +} + +inline std::intptr_t as_intptr(const MemoryPoolHandle& h) noexcept { + return reinterpret_cast(as_cu(h)); +} + +inline std::intptr_t as_intptr(const DevicePtrHandle& h) noexcept { + return static_cast(as_cu(h)); +} + +inline std::intptr_t as_intptr(const LibraryHandle& h) noexcept { + return reinterpret_cast(as_cu(h)); +} + +inline std::intptr_t as_intptr(const KernelHandle& h) noexcept { + return reinterpret_cast(as_cu(h)); +} + +inline std::intptr_t as_intptr(const GraphHandle& h) noexcept { + return reinterpret_cast(as_cu(h)); +} + +inline std::intptr_t as_intptr(const GraphExecHandle& h) noexcept { + return reinterpret_cast(as_cu(h)); +} + +inline std::intptr_t as_intptr(const GraphNodeHandle& h) noexcept { + return reinterpret_cast(as_cu(h)); +} + +inline std::intptr_t as_intptr(const GraphicsResourceHandle& h) noexcept { + return reinterpret_cast(as_cu(h)); +} + +inline std::intptr_t as_intptr(const NvrtcProgramHandle& h) noexcept { + return reinterpret_cast(as_cu(h)); +} + +inline std::intptr_t as_intptr(const NvvmProgramHandle& h) noexcept { + return reinterpret_cast(as_cu(h)); +} + +inline std::intptr_t as_intptr(const NvJitLinkHandle& h) noexcept { + return reinterpret_cast(as_cu(h)); +} + +inline std::intptr_t as_intptr(const CuLinkHandle& h) noexcept { + return reinterpret_cast(as_cu(h)); +} + +inline std::intptr_t as_intptr(const FileDescriptorHandle& h) noexcept { + return h ? static_cast(*h) : -1; +} + +inline std::intptr_t as_intptr(const OpaqueArrayHandle& h) noexcept { + return reinterpret_cast(as_cu(h)); +} + +inline std::intptr_t as_intptr(const MipmappedArrayHandle& h) noexcept { + return reinterpret_cast(as_cu(h)); +} + +inline std::intptr_t as_intptr(const TexObjectHandle& h) noexcept { + return static_cast(as_cu(h)); +} + +inline std::intptr_t as_intptr(const SurfObjectHandle& h) noexcept { + return static_cast(as_cu(h)); +} + +// as_py() - convert handle to Python wrapper object (returns new reference) +#if PY_VERSION_HEX < 0x030D0000 +extern "C" int _Py_IsFinalizing(void); +#endif + +// Best-effort probe for interpreter shutdown. +// +// In CPython this is not a hard guarantee: finalization can begin after this +// returns false but before a later PyGILState_Ensure() or other Python C-API +// call. +// +// If that race is lost on a non-finalizer thread, CPython's behavior is +// version-dependent: on older supported versions (3.10-3.13) it may abruptly +// terminate the current thread (historically via PyThread_exit_thread(), +// without normal C++ unwinding), while on newer versions (3.14+) it may hang +// the thread until process exit. +// +// We still use this check because the policy in this layer is to avoid Python +// work once shutdown is underway and accept an intentional leak or skipped +// Python conversion in that edge case rather than add more complex deferral +// machinery. +inline bool py_is_finalizing() noexcept { +#if PY_VERSION_HEX >= 0x030D0000 + return Py_IsFinalizing(); +#else + return _Py_IsFinalizing() != 0; +#endif +} + +namespace detail { +// n.b. class lookup is not cached to avoid deadlock hazard, see DESIGN.md +inline PyObject* make_py(const char* module_name, const char* class_name, std::intptr_t value) noexcept { + if (py_is_finalizing()) { + Py_RETURN_NONE; + } + PyObject* mod = PyImport_ImportModule(module_name); + if (!mod) return nullptr; + PyObject* cls = PyObject_GetAttrString(mod, class_name); + Py_DECREF(mod); + if (!cls) return nullptr; + PyObject* result = PyObject_CallFunction(cls, "L", value); + Py_DECREF(cls); + return result; +} +} // namespace detail + +inline PyObject* as_py(const ContextHandle& h) noexcept { + return detail::make_py("cuda.bindings.driver", "CUcontext", as_intptr(h)); +} + +inline PyObject* as_py(const GreenCtxHandle& h) noexcept { + return detail::make_py("cuda.bindings.driver", "CUgreenCtx", as_intptr(h)); +} + +inline PyObject* as_py(const StreamHandle& h) noexcept { + return detail::make_py("cuda.bindings.driver", "CUstream", as_intptr(h)); +} + +inline PyObject* as_py(const EventHandle& h) noexcept { + return detail::make_py("cuda.bindings.driver", "CUevent", as_intptr(h)); +} + +inline PyObject* as_py(const MemoryPoolHandle& h) noexcept { + return detail::make_py("cuda.bindings.driver", "CUmemoryPool", as_intptr(h)); +} + +inline PyObject* as_py(const DevicePtrHandle& h) noexcept { + return detail::make_py("cuda.bindings.driver", "CUdeviceptr", as_intptr(h)); +} + +inline PyObject* as_py(const LibraryHandle& h) noexcept { + return detail::make_py("cuda.bindings.driver", "CUlibrary", as_intptr(h)); +} + +inline PyObject* as_py(const KernelHandle& h) noexcept { + return detail::make_py("cuda.bindings.driver", "CUkernel", as_intptr(h)); +} + +inline PyObject* as_py(const GraphHandle& h) noexcept { + return detail::make_py("cuda.bindings.driver", "CUgraph", as_intptr(h)); +} + +inline PyObject* as_py(const GraphExecHandle& h) noexcept { + return detail::make_py("cuda.bindings.driver", "CUgraphExec", as_intptr(h)); +} + +inline PyObject* as_py(const GraphNodeHandle& h) noexcept { + if (!as_intptr(h)) { + Py_RETURN_NONE; + } + return detail::make_py("cuda.bindings.driver", "CUgraphNode", as_intptr(h)); +} + +inline PyObject* as_py(const NvrtcProgramHandle& h) noexcept { + return detail::make_py("cuda.bindings.nvrtc", "nvrtcProgram", as_intptr(h)); +} + +inline PyObject* as_py(const NvvmProgramHandle& h) noexcept { + // NVVM bindings use raw integers, not wrapper classes + return PyLong_FromSsize_t(as_intptr(h)); +} + +inline PyObject* as_py(const NvJitLinkHandle& h) noexcept { + // nvJitLink bindings use raw integers, not wrapper classes + return PyLong_FromSsize_t(as_intptr(h)); +} + +inline PyObject* as_py(const CuLinkHandle& h) noexcept { + return detail::make_py("cuda.bindings.driver", "CUlinkState", as_intptr(h)); +} + +inline PyObject* as_py(const GraphicsResourceHandle& h) noexcept { + return detail::make_py("cuda.bindings.driver", "CUgraphicsResource", as_intptr(h)); +} + +inline PyObject* as_py(const FileDescriptorHandle& h) noexcept { + return PyLong_FromSsize_t(as_intptr(h)); +} + +inline PyObject* as_py(const OpaqueArrayHandle& h) noexcept { + return detail::make_py("cuda.bindings.driver", "CUarray", as_intptr(h)); +} + +inline PyObject* as_py(const MipmappedArrayHandle& h) noexcept { + return detail::make_py("cuda.bindings.driver", "CUmipmappedArray", as_intptr(h)); +} + +inline PyObject* as_py(const TexObjectHandle& h) noexcept { + return detail::make_py("cuda.bindings.driver", "CUtexObject", as_intptr(h)); +} + +inline PyObject* as_py(const SurfObjectHandle& h) noexcept { + return detail::make_py("cuda.bindings.driver", "CUsurfObject", as_intptr(h)); +} + +// ============================================================================ +// SM resource split wrapper (13.1+) +// +// Calls through p_cuDevSmResourceSplit if available, otherwise returns +// CUDA_ERROR_NOT_SUPPORTED. This avoids a direct Cython cimport of the +// cydriver cdef function, which would fail at module init on cuda-bindings +// < 13.1 (see https://github.com/NVIDIA/cuda-python/issues/2063). +// ============================================================================ + +// groupParams is void* so the Cython declaration doesn't reference +// CU_DEV_SM_RESOURCE_GROUP_PARAMS (absent from cuda-bindings 13.0 .pxd). +CUresult sm_resource_split(CUdevResource* result, unsigned int nbGroups, + const CUdevResource* input, CUdevResource* remainder, + unsigned int flags, void* groupParams); + +// Returns true if the cuDevSmResourceSplit function pointer is available. +bool has_sm_resource_split() noexcept; + +} // namespace cuda_core diff --git a/cuda_core/cuda/core/_cpp/tensor_map.cpp b/cuda_core/cuda/core/_cpp/tensor_map.cpp new file mode 100644 index 00000000000..df3f7654e54 --- /dev/null +++ b/cuda_core/cuda/core/_cpp/tensor_map.cpp @@ -0,0 +1,154 @@ +// SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +#include "tensor_map_cccl.h" + +#include + +#include +#include + +#if defined(__has_include) +// Older CTK releases do not ship . When it is unavailable we keep +// the CCCL helper compiled out and fall back to the direct driver path. +# if __has_include() +# include +# define CUDA_CORE_HAS_CUDA_TMA 1 +# else +# define CUDA_CORE_HAS_CUDA_TMA 0 +# endif +# if __has_include("dlpack.h") +# include "dlpack.h" +# define CUDA_CORE_HAS_DLPACK_H 1 +# elif __has_include() +# include +# define CUDA_CORE_HAS_DLPACK_H 1 +# else +# define CUDA_CORE_HAS_DLPACK_H 0 +# endif +#else +# define CUDA_CORE_HAS_CUDA_TMA 0 +# define CUDA_CORE_HAS_DLPACK_H 0 +#endif + +static inline void cuda_core_write_err(char* err, size_t cap, const char* msg) noexcept +{ + if (!err || cap == 0) + return; + if (!msg) + { + err[0] = '\0'; + return; + } + size_t n = ::strlen(msg); + if (n >= cap) + n = cap - 1; + ::memcpy(err, msg, n); + err[n] = '\0'; +} + +int cuda_core_cccl_make_tma_descriptor_tiled( + void* out_tensor_map, + void* data, + int device_type, + int device_id, + int ndim, + const int64_t* shape, + const int64_t* strides, + uint8_t dtype_code, + uint8_t dtype_bits, + uint16_t dtype_lanes, + const int* box_sizes, + const int* elem_strides, + int interleave_layout, + int swizzle, + int l2_fetch_size, + int oob_fill, + char* err, + size_t err_cap) noexcept +{ +#if !(CUDA_CORE_HAS_CUDA_TMA && CUDA_CORE_HAS_DLPACK_H) + (void)out_tensor_map; + (void)data; + (void)device_type; + (void)device_id; + (void)ndim; + (void)shape; + (void)strides; + (void)dtype_code; + (void)dtype_bits; + (void)dtype_lanes; + (void)box_sizes; + (void)elem_strides; + (void)interleave_layout; + (void)swizzle; + (void)l2_fetch_size; + (void)oob_fill; + cuda_core_write_err(err, err_cap, "CCCL and/or not available at build time"); + return 1; +#else + try + { + if (!out_tensor_map) + { + cuda_core_write_err(err, err_cap, "out_tensor_map is NULL"); + return 1; + } + if (!data) + { + cuda_core_write_err(err, err_cap, "tensor data pointer is NULL"); + return 1; + } + if (!shape || !box_sizes || ndim <= 0) + { + cuda_core_write_err(err, err_cap, "invalid rank/shape/box_sizes"); + return 1; + } + + DLTensor t{}; + t.data = data; + t.device = {static_cast(device_type), device_id}; + t.ndim = ndim; + t.dtype.code = dtype_code; + t.dtype.bits = dtype_bits; + t.dtype.lanes = dtype_lanes; + // CCCL promises not to mutate the arrays, but DLPack uses non-const pointers. + t.shape = const_cast(shape); + t.strides = const_cast(strides); + t.byte_offset = 0; + + const auto layout = static_cast(interleave_layout); + const auto swz = static_cast(swizzle); + const auto l2 = static_cast(l2_fetch_size); + const auto oob = static_cast(oob_fill); + + auto box = cuda::std::span(box_sizes, static_cast(ndim)); + + CUtensorMap desc{}; + if (elem_strides) + { + auto es = cuda::std::span(elem_strides, static_cast(ndim)); + desc = cuda::make_tma_descriptor(t, box, es, layout, swz, l2, oob); + } + else + { + desc = cuda::make_tma_descriptor(t, box, layout, swz, l2, oob); + } + + ::memcpy(out_tensor_map, &desc, sizeof(CUtensorMap)); + cuda_core_write_err(err, err_cap, nullptr); + return 0; + } + catch (const std::exception& e) + { + cuda_core_write_err(err, err_cap, e.what()); + return 1; + } + catch (...) + { + cuda_core_write_err(err, err_cap, "unknown error while building TMA descriptor"); + return 1; + } +#endif +} diff --git a/cuda_core/cuda/core/_cpp/tensor_map_cccl.h b/cuda_core/cuda/core/_cpp/tensor_map_cccl.h new file mode 100644 index 00000000000..37f0e0fd8d2 --- /dev/null +++ b/cuda_core/cuda/core/_cpp/tensor_map_cccl.h @@ -0,0 +1,45 @@ +// SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +#ifndef CUDA_CORE_TENSOR_MAP_CCCL_H_ +#define CUDA_CORE_TENSOR_MAP_CCCL_H_ + +#ifdef __cplusplus +#include +#include +extern "C" { +#else +#include +#include +#endif + +// Build a tiled CUtensorMap using CCCL's cuda::make_tma_descriptor (from ). +// +// Returns 0 on success; on failure returns non-zero and writes a best-effort +// human-readable message into (err, err_cap) if provided. +int cuda_core_cccl_make_tma_descriptor_tiled( + void* out_tensor_map, + void* data, + int device_type, + int device_id, + int ndim, + const int64_t* shape, // length ndim + const int64_t* strides, // length ndim, or NULL for contiguous + uint8_t dtype_code, + uint8_t dtype_bits, + uint16_t dtype_lanes, + const int* box_sizes, // length ndim + const int* elem_strides, // length ndim, or NULL for all-ones overload + int interleave_layout, + int swizzle, + int l2_fetch_size, + int oob_fill, + char* err, + size_t err_cap) noexcept; + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // CUDA_CORE_TENSOR_MAP_CCCL_H_ diff --git a/cuda_core/cuda/core/_device.pyi b/cuda_core/cuda/core/_device.pyi new file mode 100644 index 00000000000..14893fbd3c0 --- /dev/null +++ b/cuda_core/cuda/core/_device.pyi @@ -0,0 +1,1026 @@ +# This file was generated by stubgen-pyx v0.2.6 from cuda_core/cuda/core/_device.pyx + +from __future__ import annotations + +import threading + +import cuda.core.system +from cuda.core._context import Context, ContextOptions +from cuda.core._device_resources import DeviceResources +from cuda.core._event import Event, EventOptions +from cuda.core._memory._buffer import Buffer, MemoryResource +from cuda.core._stream import IsStreamType, Stream +from cuda.core._utils.cuda_utils import ComputeCapability +from cuda.core.graph import GraphBuilder +from cuda.core.texture import (MipmappedArray, MipmappedArrayOptions, + OpaqueArray, OpaqueArrayOptions, + ResourceDescriptor, SurfaceObject, + TextureObject, TextureObjectOptions) + + +class DeviceProperties: + """ + A class to query various attributes of a CUDA device. + + Attributes are read-only and provide information about the device. + """ + + def __init__(self, *args, **kwargs) -> None: + ... + + @classmethod + def _init(cls, handle: int) -> DeviceProperties: + ... + + @property + def max_threads_per_block(self) -> int: + """int: Maximum number of threads per block.""" + + @property + def max_block_dim_x(self) -> int: + """int: Maximum block dimension X.""" + + @property + def max_block_dim_y(self) -> int: + """int: Maximum block dimension Y.""" + + @property + def max_block_dim_z(self) -> int: + """int: Maximum block dimension Z.""" + + @property + def max_grid_dim_x(self) -> int: + """int: Maximum grid dimension X.""" + + @property + def max_grid_dim_y(self) -> int: + """int: Maximum grid dimension Y.""" + + @property + def max_grid_dim_z(self) -> int: + """int: Maximum grid dimension Z.""" + + @property + def max_shared_memory_per_block(self) -> int: + """int: Maximum shared memory available per block in bytes.""" + + @property + def total_constant_memory(self) -> int: + """int: Memory available on device for constant variables in a CUDA C kernel in bytes.""" + + @property + def warp_size(self) -> int: + """int: Warp size in threads.""" + + @property + def max_pitch(self) -> int: + """int: Maximum pitch in bytes allowed by memory copies.""" + + @property + def maximum_texture1d_width(self) -> int: + """int: Maximum 1D texture width.""" + + @property + def maximum_texture1d_linear_width(self) -> int: + """int: Maximum width for a 1D texture bound to linear memory.""" + + @property + def maximum_texture1d_mipmapped_width(self) -> int: + """int: Maximum mipmapped 1D texture width.""" + + @property + def maximum_texture2d_width(self) -> int: + """int: Maximum 2D texture width.""" + + @property + def maximum_texture2d_height(self) -> int: + """int: Maximum 2D texture height.""" + + @property + def maximum_texture2d_linear_width(self) -> int: + """int: Maximum width for a 2D texture bound to linear memory.""" + + @property + def maximum_texture2d_linear_height(self) -> int: + """int: Maximum height for a 2D texture bound to linear memory.""" + + @property + def maximum_texture2d_linear_pitch(self) -> int: + """int: Maximum pitch in bytes for a 2D texture bound to linear memory.""" + + @property + def maximum_texture2d_mipmapped_width(self) -> int: + """int: Maximum mipmapped 2D texture width.""" + + @property + def maximum_texture2d_mipmapped_height(self) -> int: + """int: Maximum mipmapped 2D texture height.""" + + @property + def maximum_texture3d_width(self) -> int: + """int: Maximum 3D texture width.""" + + @property + def maximum_texture3d_height(self) -> int: + """int: Maximum 3D texture height.""" + + @property + def maximum_texture3d_depth(self) -> int: + """int: Maximum 3D texture depth.""" + + @property + def maximum_texture3d_width_alternate(self) -> int: + """int: Alternate maximum 3D texture width, 0 if no alternate maximum 3D texture size is supported.""" + + @property + def maximum_texture3d_height_alternate(self) -> int: + """int: Alternate maximum 3D texture height, 0 if no alternate maximum 3D texture size is supported.""" + + @property + def maximum_texture3d_depth_alternate(self) -> int: + """int: Alternate maximum 3D texture depth, 0 if no alternate maximum 3D texture size is supported.""" + + @property + def maximum_texturecubemap_width(self) -> int: + """int: Maximum cubemap texture width or height.""" + + @property + def maximum_texture1d_layered_width(self) -> int: + """int: Maximum 1D layered texture width.""" + + @property + def maximum_texture1d_layered_layers(self) -> int: + """int: Maximum layers in a 1D layered texture.""" + + @property + def maximum_texture2d_layered_width(self) -> int: + """int: Maximum 2D layered texture width.""" + + @property + def maximum_texture2d_layered_height(self) -> int: + """int: Maximum 2D layered texture height.""" + + @property + def maximum_texture2d_layered_layers(self) -> int: + """int: Maximum layers in a 2D layered texture.""" + + @property + def maximum_texturecubemap_layered_width(self) -> int: + """int: Maximum cubemap layered texture width or height.""" + + @property + def maximum_texturecubemap_layered_layers(self) -> int: + """int: Maximum layers in a cubemap layered texture.""" + + @property + def maximum_surface1d_width(self) -> int: + """int: Maximum 1D surface width.""" + + @property + def maximum_surface2d_width(self) -> int: + """int: Maximum 2D surface width.""" + + @property + def maximum_surface2d_height(self) -> int: + """int: Maximum 2D surface height.""" + + @property + def maximum_surface3d_width(self) -> int: + """int: Maximum 3D surface width.""" + + @property + def maximum_surface3d_height(self) -> int: + """int: Maximum 3D surface height.""" + + @property + def maximum_surface3d_depth(self) -> int: + """int: Maximum 3D surface depth.""" + + @property + def maximum_surface1d_layered_width(self) -> int: + """int: Maximum 1D layered surface width.""" + + @property + def maximum_surface1d_layered_layers(self) -> int: + """int: Maximum layers in a 1D layered surface.""" + + @property + def maximum_surface2d_layered_width(self) -> int: + """int: Maximum 2D layered surface width.""" + + @property + def maximum_surface2d_layered_height(self) -> int: + """int: Maximum 2D layered surface height.""" + + @property + def maximum_surface2d_layered_layers(self) -> int: + """int: Maximum layers in a 2D layered surface.""" + + @property + def maximum_surfacecubemap_width(self) -> int: + """int: Maximum cubemap surface width.""" + + @property + def maximum_surfacecubemap_layered_width(self) -> int: + """int: Maximum cubemap layered surface width.""" + + @property + def maximum_surfacecubemap_layered_layers(self) -> int: + """int: Maximum layers in a cubemap layered surface.""" + + @property + def max_registers_per_block(self) -> int: + """int: Maximum number of 32-bit registers available to a thread block.""" + + @property + def clock_rate(self) -> int: + """int: Typical clock frequency in kilohertz.""" + + @property + def texture_alignment(self) -> int: + """int: Alignment requirement for textures.""" + + @property + def texture_pitch_alignment(self) -> int: + """int: Pitch alignment requirement for textures.""" + + @property + def gpu_overlap(self) -> bool: + """bool: Device can possibly copy memory and execute a kernel concurrently. Deprecated. Use :attr:`~DeviceProperties.async_engine_count` instead.""" + + @property + def multiprocessor_count(self) -> int: + """int: Number of multiprocessors on device.""" + + @property + def kernel_exec_timeout(self) -> bool: + """bool: Specifies whether there is a run time limit on kernels.""" + + @property + def integrated(self) -> bool: + """bool: Device is integrated with host memory.""" + + @property + def can_map_host_memory(self) -> bool: + """bool: Device can map host memory into CUDA address space.""" + + @property + def compute_mode(self) -> int: + """int: Compute mode (See CUcomputemode for details).""" + + @property + def concurrent_kernels(self) -> bool: + """bool: Device can possibly execute multiple kernels concurrently.""" + + @property + def ecc_enabled(self) -> bool: + """bool: Device has ECC support enabled.""" + + @property + def pci_bus_id(self) -> int: + """int: PCI bus ID of the device.""" + + @property + def pci_device_id(self) -> int: + """int: PCI device ID of the device.""" + + @property + def pci_domain_id(self) -> int: + """int: PCI domain ID of the device.""" + + @property + def tcc_driver(self) -> bool: + """bool: Device is using TCC driver model.""" + + @property + def memory_clock_rate(self) -> int: + """int: Peak memory clock frequency in kilohertz.""" + + @property + def global_memory_bus_width(self) -> int: + """int: Global memory bus width in bits.""" + + @property + def l2_cache_size(self) -> int: + """int: Size of L2 cache in bytes.""" + + @property + def max_threads_per_multiprocessor(self) -> int: + """int: Maximum resident threads per multiprocessor.""" + + @property + def unified_addressing(self) -> bool: + """bool: Device shares a unified address space with the host.""" + + @property + def compute_capability_major(self) -> int: + """int: Major compute capability version number.""" + + @property + def compute_capability_minor(self) -> int: + """int: Minor compute capability version number.""" + + @property + def global_l1_cache_supported(self) -> bool: + """bool: Device supports caching globals in L1.""" + + @property + def local_l1_cache_supported(self) -> bool: + """bool: Device supports caching locals in L1.""" + + @property + def max_shared_memory_per_multiprocessor(self) -> int: + """int: Maximum shared memory available per multiprocessor in bytes.""" + + @property + def max_registers_per_multiprocessor(self) -> int: + """int: Maximum number of 32-bit registers available per multiprocessor.""" + + @property + def managed_memory(self) -> bool: + """bool: Device can allocate managed memory on this system.""" + + @property + def multi_gpu_board(self) -> bool: + """bool: Device is on a multi-GPU board.""" + + @property + def multi_gpu_board_group_id(self) -> int: + """int: Unique id for a group of devices on the same multi-GPU board.""" + + @property + def host_native_atomic_supported(self) -> bool: + """bool: Link between the device and the host supports all native atomic operations.""" + + @property + def single_to_double_precision_perf_ratio(self) -> int: + """int: Ratio of single precision performance (in floating-point operations per second) to double precision performance.""" + + @property + def pageable_memory_access(self) -> bool: + """bool: Device supports coherently accessing pageable memory without calling cudaHostRegister on it.""" + + @property + def concurrent_managed_access(self) -> bool: + """bool: Device can coherently access managed memory concurrently with the CPU.""" + + @property + def compute_preemption_supported(self) -> bool: + """bool: Device supports compute preemption.""" + + @property + def can_use_host_pointer_for_registered_mem(self) -> bool: + """bool: Device can access host registered memory at the same virtual address as the CPU.""" + + @property + def cooperative_launch(self) -> bool: + """bool: Device supports launching cooperative kernels via cuLaunchCooperativeKernel.""" + + @property + def max_shared_memory_per_block_optin(self) -> int: + """int: Maximum optin shared memory per block.""" + + @property + def pageable_memory_access_uses_host_page_tables(self) -> bool: + """bool: Device accesses pageable memory via the host's page tables.""" + + @property + def direct_managed_mem_access_from_host(self) -> bool: + """bool: The host can directly access managed memory on the device without migration.""" + + @property + def virtual_memory_management_supported(self) -> bool: + """bool: Device supports virtual memory management APIs like cuMemAddressReserve, cuMemCreate, cuMemMap and related APIs.""" + + @property + def handle_type_posix_file_descriptor_supported(self) -> bool: + """bool: Device supports exporting memory to a posix file descriptor with cuMemExportToShareableHandle, if requested via cuMemCreate.""" + + @property + def handle_type_win32_handle_supported(self) -> bool: + """bool: Device supports exporting memory to a Win32 NT handle with cuMemExportToShareableHandle, if requested via cuMemCreate.""" + + @property + def handle_type_win32_kmt_handle_supported(self) -> bool: + """bool: Device supports exporting memory to a Win32 KMT handle with cuMemExportToShareableHandle, if requested via cuMemCreate.""" + + @property + def max_blocks_per_multiprocessor(self) -> int: + """int: Maximum number of blocks per multiprocessor.""" + + @property + def generic_compression_supported(self) -> bool: + """bool: Device supports compression of memory.""" + + @property + def max_persisting_l2_cache_size(self) -> int: + """int: Maximum L2 persisting lines capacity setting in bytes.""" + + @property + def max_access_policy_window_size(self) -> int: + """int: Maximum value of CUaccessPolicyWindow.num_bytes.""" + + @property + def gpu_direct_rdma_with_cuda_vmm_supported(self) -> bool: + """bool: Device supports specifying the GPUDirect RDMA flag with cuMemCreate.""" + + @property + def reserved_shared_memory_per_block(self) -> int: + """int: Shared memory reserved by CUDA driver per block in bytes.""" + + @property + def sparse_cuda_array_supported(self) -> bool: + """bool: Device supports sparse CUDA arrays and sparse CUDA mipmapped arrays.""" + + @property + def read_only_host_register_supported(self) -> bool: + """bool: True if device supports using the cuMemHostRegister flag CU_MEMHOSTREGISTER_READ_ONLY to register memory that must be mapped as read-only to the GPU, False if not.""" + + @property + def memory_pools_supported(self) -> bool: + """bool: Device supports using the cuMemAllocAsync and cuMemPool family of APIs.""" + + @property + def gpu_direct_rdma_supported(self) -> bool: + """bool: Device supports GPUDirect RDMA APIs, like nvidia_p2p_get_pages (see https://docs.nvidia.com/cuda/gpudirect-rdma for more information).""" + + @property + def gpu_direct_rdma_flush_writes_options(self) -> int: + """int: The returned attribute shall be interpreted as a bitmask, where the individual bits are described by the CUflushGPUDirectRDMAWritesOptions enum.""" + + @property + def gpu_direct_rdma_writes_ordering(self) -> int: + """int: GPUDirect RDMA writes to the device do not need to be flushed for consumers within the scope indicated by the returned attribute. See CUGPUDirectRDMAWritesOrdering for the numerical values returned here.""" + + @property + def mempool_supported_handle_types(self) -> int: + """int: Handle types supported with mempool based IPC.""" + + @property + def deferred_mapping_cuda_array_supported(self) -> bool: + """bool: Device supports deferred mapping CUDA arrays and CUDA mipmapped arrays.""" + + @property + def numa_config(self) -> int: + """int: NUMA configuration of a device: value is of type CUdeviceNumaConfig enum.""" + + @property + def numa_id(self) -> int: + """int: NUMA node ID of the GPU memory.""" + + @property + def multicast_supported(self) -> bool: + """bool: Device supports switch multicast and reduction operations.""" + + @property + def surface_alignment(self) -> int: + """int: Surface alignment requirement in bytes.""" + + @property + def async_engine_count(self) -> int: + """int: Number of asynchronous engines.""" + + @property + def can_tex2d_gather(self) -> bool: + """bool: True if device supports 2D texture gather operations, False if not.""" + + @property + def maximum_texture2d_gather_width(self) -> int: + """int: Maximum 2D texture gather width.""" + + @property + def maximum_texture2d_gather_height(self) -> int: + """int: Maximum 2D texture gather height.""" + + @property + def stream_priorities_supported(self) -> bool: + """bool: True if device supports stream priorities, False if not.""" + + @property + def can_flush_remote_writes(self) -> bool: + """bool: The CU_STREAM_WAIT_VALUE_FLUSH flag and the CU_STREAM_MEM_OP_FLUSH_REMOTE_WRITES MemOp are supported on the device. See Stream Memory Operations for additional details.""" + + @property + def host_register_supported(self) -> bool: + """bool: Device supports host memory registration via cudaHostRegister.""" + + @property + def timeline_semaphore_interop_supported(self) -> bool: + """bool: External timeline semaphore interop is supported on the device.""" + + @property + def cluster_launch(self) -> bool: + """bool: Indicates device supports cluster launch.""" + + @property + def can_use_64_bit_stream_mem_ops(self) -> bool: + """bool: 64-bit operations are supported in cuStreamBatchMemOp and related MemOp APIs.""" + + @property + def can_use_stream_wait_value_nor(self) -> bool: + """bool: CU_STREAM_WAIT_VALUE_NOR is supported by MemOp APIs.""" + + @property + def dma_buf_supported(self) -> bool: + """bool: Device supports buffer sharing with dma_buf mechanism.""" + + @property + def ipc_event_supported(self) -> bool: + """bool: Device supports IPC Events.""" + + @property + def mem_sync_domain_count(self) -> int: + """int: Number of memory domains the device supports.""" + + @property + def tensor_map_access_supported(self) -> bool: + """bool: Device supports accessing memory using Tensor Map.""" + + @property + def handle_type_fabric_supported(self) -> bool: + """bool: Device supports exporting memory to a fabric handle with cuMemExportToShareableHandle() or requested with cuMemCreate().""" + + @property + def unified_function_pointers(self) -> bool: + """bool: Device supports unified function pointers.""" + + @property + def mps_enabled(self) -> bool: + """bool: Indicates if contexts created on this device will be shared via MPS.""" + + @property + def host_numa_id(self) -> int: + """int: NUMA ID of the host node closest to the device. Returns -1 when system does not support NUMA.""" + + @property + def d3d12_cig_supported(self) -> bool: + """bool: Device supports CIG with D3D12.""" + + @property + def mem_decompress_algorithm_mask(self) -> int: + """int: The returned value shall be interpreted as a bitmask, where the individual bits are described by the CUmemDecompressAlgorithm enum.""" + + @property + def mem_decompress_maximum_length(self) -> int: + """int: The returned value is the maximum length in bytes of a single decompress operation that is allowed.""" + + @property + def vulkan_cig_supported(self) -> bool: + """bool: Device supports CIG with Vulkan.""" + + @property + def gpu_pci_device_id(self) -> int: + """int: The combined 16-bit PCI device ID and 16-bit PCI vendor ID. + + Returns 0 if the driver does not support this query. + """ + + @property + def gpu_pci_subsystem_id(self) -> int: + """int: The combined 16-bit PCI subsystem ID and 16-bit PCI subsystem vendor ID. + + Returns 0 if the driver does not support this query. + """ + + @property + def host_numa_virtual_memory_management_supported(self) -> bool: + """bool: Device supports HOST_NUMA location with the virtual memory management APIs like cuMemCreate, cuMemMap and related APIs.""" + + @property + def host_numa_memory_pools_supported(self) -> bool: + """bool: Device supports HOST_NUMA location with the cuMemAllocAsync and cuMemPool family of APIs.""" + + @property + def host_numa_multinode_ipc_supported(self) -> bool: + """bool: Device supports HOST_NUMA location IPC between nodes in a multi-node system.""" + + @property + def host_memory_pools_supported(self) -> bool: + """bool: Device supports HOST location with the cuMemAllocAsync and cuMemPool family of APIs.""" + + @property + def host_virtual_memory_management_supported(self) -> bool: + """bool: Device supports HOST location with the virtual memory management APIs like cuMemCreate, cuMemMap and related APIs.""" + + @property + def host_alloc_dma_buf_supported(self) -> bool: + """bool: Device supports page-locked host memory buffer sharing with dma_buf mechanism.""" + + @property + def only_partial_host_native_atomic_supported(self) -> bool: + """bool: Link between the device and the host supports only some native atomic operations.""" + +class Device: + """Represent a GPU and act as an entry point for cuda.core features. + + This is a singleton object that helps ensure interoperability + across multiple libraries imported in the process to both see + and use the same GPU device. + + While acting as the entry point, many other CUDA resources can be + allocated such as streams and buffers. Any :obj:`~_context.Context` dependent + resource created through this device, will continue to refer to + this device's context. + + Newly returned :obj:`~_device.Device` objects are thread-local singletons + for a specified device. + + Note + ---- + Will not initialize the GPU. + + Parameters + ---------- + device_id : int, optional + Device ordinal to return a :obj:`~_device.Device` object for. + Default value of `None` return the currently used device. + + """ + __slots__ = ('_device_id', '_memory_resource', '_has_inited', '_properties', '_resources', '_uuid', '_context', '__weakref__') + + def __new__(cls, device_id: Device | int | None=None) -> Device: + ... + + def _check_context_initialized(self) -> None: + ... + + @classmethod + def get_all_devices(cls) -> tuple[Device, ...]: + """ + Query the available device instances. + + Returns + ------- + tuple of Device + A tuple containing instances of available devices. + """ + + def to_system_device(self) -> 'cuda.core.system.Device': + """ + Get the corresponding :class:`cuda.core.system.Device` (which is used + for NVIDIA Management Library (NVML) access) for this + :class:`cuda.core.Device` (which is used for CUDA access). + + The devices are mapped to one another by their UUID. + + Returns + ------- + cuda.core.system.Device + The corresponding system-level device instance used for NVML access. + """ + + @property + def device_id(self) -> int: + """Return device ordinal.""" + + @property + def pci_bus_id(self) -> str: + """Return a PCI Bus Id string for this device.""" + + def can_access_peer(self, peer: Device | int) -> bool: + """Check if this device can access memory from the specified peer device. + + Queries whether peer-to-peer memory access is supported between this + device and the specified peer device. + + Parameters + ---------- + peer : Device | int + The peer device to check accessibility to. Can be a :obj:`~_device.Device` object or device ID. + """ + + @property + def uuid(self) -> str: + """Return a UUID for the device. + + Returns 16-octets identifying the device. If the device is in + MIG mode, returns its MIG UUID which uniquely identifies the + subscribed MIG compute instance. + + Note + ---- + MIG UUID is only returned when device is in MIG mode and the + driver is older than CUDA 11.4. + + The UUID is cached after first access to avoid repeated CUDA API calls. + + """ + + @property + def name(self) -> str: + """Return the device name.""" + + @property + def properties(self) -> DeviceProperties: + """Return a :obj:`~_device.DeviceProperties` class with information about the device.""" + + @property + def resources(self) -> DeviceResources: + """Return the hardware resource query namespace for this device.""" + + @property + def compute_capability(self) -> ComputeCapability: + """Return a named tuple with 2 fields: major and minor.""" + + @property + def arch(self) -> str: + """Return compute capability as a string (e.g., '75' for CC 7.5).""" + + @property + def context(self) -> Context: + """Return the :obj:`~_context.Context` associated with this device. + + Note + ---- + Device must be initialized. + + """ + + @property + def memory_resource(self) -> MemoryResource: + """Return :obj:`~_memory.MemoryResource` associated with this device.""" + + @memory_resource.setter + def memory_resource(self, mr: MemoryResource) -> None: + ... + + @property + def default_stream(self) -> Stream: + """Return default CUDA :obj:`~_stream.Stream` associated with this device. + + The type of default stream returned depends on if the environment + variable CUDA_PYTHON_CUDA_PER_THREAD_DEFAULT_STREAM is set. + + If set, returns a per-thread default stream. Otherwise returns + the legacy stream. + + """ + + def __int__(self) -> int: + """Return device_id.""" + + def __repr__(self) -> str: + ... + + def __hash__(self) -> int: + ... + + def __eq__(self, other: object) -> bool: + ... + + def __reduce__(self) -> tuple[object, ...]: + ... + + def set_current(self, ctx: Context | None=None) -> Context | None: + """Set device to be used for GPU executions. + + Initializes CUDA and sets the calling thread to a valid CUDA + context. By default the primary context is used, but optional `ctx` + parameter can be used to explicitly supply a :obj:`~_context.Context` object. + + Providing a `ctx` causes the previous set context to be popped and returned. + + Parameters + ---------- + ctx : :obj:`~_context.Context`, optional + Optional context to push onto this device's current thread stack. + + Returns + ------- + :obj:`~_context.Context`, optional + Popped context. + + Examples + -------- + Acts as an entry point of this object. Users always start a code by + calling this method, e.g. + + >>> from cuda.core import Device + >>> dev0 = Device(0) + >>> dev0.set_current() + >>> # ... do work on device 0 ... + + """ + + def create_context(self, options: ContextOptions | None=None) -> Context: + """Create a new :obj:`~_context.Context` object. + + Note + ---- + The newly created context will not be set as current. + + Parameters + ---------- + options : :obj:`~_context.ContextOptions`, optional + Customizable dataclass for context creation options. + + Returns + ------- + :obj:`~_context.Context` + Newly created context object. + + """ + + def create_stream(self, obj: IsStreamType | None=None, options: object=None) -> Stream: + """Create a :obj:`~_stream.Stream` object. + + New stream objects can be created in two different ways: + + 1) Create a new CUDA stream with customizable ``options``. + 2) Wrap an existing foreign `obj` supporting the ``__cuda_stream__`` protocol. + + Option (2) internally holds a reference to the foreign object + such that the lifetime is managed. + + Note + ---- + Device must be initialized. + + Parameters + ---------- + obj : :obj:`~_stream.IsStreamType`, optional + Any object supporting the ``__cuda_stream__`` protocol. + options : :obj:`~_stream.StreamOptions`, optional + Customizable dataclass for stream creation options. + + Returns + ------- + :obj:`~_stream.Stream` + Newly created stream object. + + """ + + def create_event(self, options: EventOptions | None=None) -> Event: + """Create an :obj:`~_event.Event` object without recording it to a :obj:`~_stream.Stream`. + + Note + ---- + Device must be initialized. + + Parameters + ---------- + options : :obj:`EventOptions`, optional + Customizable dataclass for event creation options. + + Returns + ------- + :obj:`~_event.Event` + Newly created event object. + + """ + + def allocate(self, size: int, *, stream: Stream | GraphBuilder) -> Buffer: + """Allocate device memory from a specified stream. + + Allocates device memory of `size` bytes on the specified `stream` + using the memory resource currently associated with this Device. + + Note + ---- + Device must be initialized. + + Parameters + ---------- + size : int + Number of bytes to allocate. + stream : :obj:`~_stream.Stream` | :obj:`~graph.GraphBuilder` + Keyword-only. The stream establishing the stream ordering semantic. + Must be passed explicitly; pass ``self.default_stream`` to use + the default stream. + + Returns + ------- + :obj:`~_memory.Buffer` + Newly created buffer object. + + """ + + def sync(self) -> None: + """Synchronize the device. + + Note + ---- + Device must be initialized. + + """ + + def create_graph_builder(self) -> GraphBuilder: + """Create a new :obj:`~graph.GraphBuilder` object. + + Returns + ------- + :obj:`~graph.GraphBuilder` + Newly created graph builder object. + + """ + + def create_opaque_array(self, options: OpaqueArrayOptions) -> OpaqueArray: + """Create an :obj:`~cuda.core.texture.OpaqueArray` on the current device. + + Allocates an opaque, hardware-laid-out CUDA array for texture/surface + access. The array is created in the current CUDA context, so make this + device current with :meth:`set_current` before calling (mirroring + :meth:`create_stream` / :meth:`create_event`). + + Note + ---- + Device must be initialized. + + Parameters + ---------- + options : :obj:`~cuda.core.texture.OpaqueArrayOptions` + Allocation options (shape, format, channels, surface flag). + + Returns + ------- + :obj:`~cuda.core.texture.OpaqueArray` + Newly created opaque array. + + .. versionadded:: 1.1.0 + """ + + def create_mipmapped_array(self, options: MipmappedArrayOptions) -> MipmappedArray: + """Create a :obj:`~cuda.core.texture.MipmappedArray` on the current device. + + Allocates a mipmapped CUDA array for texture/surface access across + levels. The array is created in the current CUDA context, so make this + device current with :meth:`set_current` before calling (mirroring + :meth:`create_stream` / :meth:`create_event`). + + Note + ---- + Device must be initialized. + + Parameters + ---------- + options : :obj:`~cuda.core.texture.MipmappedArrayOptions` + Allocation options (shape, format, channels, levels, surface flag). + + Returns + ------- + :obj:`~cuda.core.texture.MipmappedArray` + Newly created mipmapped array. + + .. versionadded:: 1.1.0 + """ + + def create_texture_object(self, *, resource: ResourceDescriptor, options: TextureObjectOptions | None=None) -> TextureObject: + """Create a :obj:`~cuda.core.texture.TextureObject` on the current device. + + Binds a resource (an :obj:`~cuda.core.texture.OpaqueArray` / + :obj:`~cuda.core.texture.MipmappedArray` / linear or pitch2d + :obj:`~cuda.core.Buffer`, wrapped in a + :obj:`~cuda.core.texture.ResourceDescriptor`) as a bindless texture for + kernel-side sampled reads. The object is created in the current CUDA + context, so make this device current with :meth:`set_current` before + calling (mirroring :meth:`create_stream` / :meth:`create_event`). + + Note + ---- + Device must be initialized. + + Parameters + ---------- + resource : :obj:`~cuda.core.texture.ResourceDescriptor` + The memory backing the texture. + options : :obj:`~cuda.core.texture.TextureObjectOptions` + Sampling state (address/filter/read modes, normalization, etc.). + + Returns + ------- + :obj:`~cuda.core.texture.TextureObject` + Newly created texture object. + + .. versionadded:: 1.1.0 + """ + + def create_surface_object(self, *, resource: ResourceDescriptor) -> SurfaceObject: + """Create a :obj:`~cuda.core.texture.SurfaceObject` on the current device. + + Binds an :obj:`~cuda.core.texture.OpaqueArray` (via a + :obj:`~cuda.core.texture.ResourceDescriptor`) as a bindless surface for + kernel-side typed load/store. The backing array must have been created + with ``is_surface_load_store=True``. The object is created in the + current CUDA context, so make this device current with + :meth:`set_current` before calling (mirroring :meth:`create_stream` / + :meth:`create_event`). + + Note + ---- + Device must be initialized. + + Parameters + ---------- + resource : :obj:`~cuda.core.texture.ResourceDescriptor` + Must wrap an :obj:`~cuda.core.texture.OpaqueArray` allocated with + ``is_surface_load_store=True``. + + Returns + ------- + :obj:`~cuda.core.texture.SurfaceObject` + Newly created surface object. + + .. versionadded:: 1.1.0 + """ +_tls = threading.local() +_lock = threading.Lock() \ No newline at end of file diff --git a/cuda_core/cuda/core/_device.pyx b/cuda_core/cuda/core/_device.pyx new file mode 100644 index 00000000000..ea5bb62cc1b --- /dev/null +++ b/cuda_core/cuda/core/_device.pyx @@ -0,0 +1,1654 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from __future__ import annotations + +cimport cpython + +from cuda.bindings cimport cydriver +from cuda.core._utils.cuda_utils cimport check_or_create_options, HANDLE_RETURN +from libcpp.vector cimport vector + +import threading + +from cuda.core._context cimport Context +from cuda.core._context import ContextOptions +from cuda.core._device_resources cimport DeviceResources, SMResource, WorkqueueResource +from cuda.core._event cimport Event as cyEvent +from cuda.core._event import Event, EventOptions +from cuda.core._memory._buffer cimport Buffer, MemoryResource +from cuda.core._resource_handles cimport ( + ContextHandle, + GreenCtxHandle, + create_context_handle_ref, + create_green_ctx_handle, + get_primary_context, + get_last_error, + as_cu, +) + +from cuda.core._stream import IsStreamType, Stream +from cuda.core._utils.clear_error_support import assert_type +from cuda.core._utils.cuda_utils import ( + ComputeCapability, + CUDAError, + driver, + handle_return, + runtime, +) +from cuda.core._stream cimport default_stream + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + import cuda.core.system # no-cython-lint + from cuda.core.graph import GraphBuilder + from cuda.core.texture import ( + MipmappedArray, + MipmappedArrayOptions, + OpaqueArray, + OpaqueArrayOptions, + ResourceDescriptor, + SurfaceObject, + TextureObject, + TextureObjectOptions, + ) + +# TODO: I prefer to type these as "cdef object" and avoid accessing them from within Python, +# but it seems it is very convenient to expose them for testing purposes... +_tls = threading.local() +_lock = threading.Lock() +cdef bint _is_cuInit = False + + +cdef class DeviceProperties: + """ + A class to query various attributes of a CUDA device. + + Attributes are read-only and provide information about the device. + """ + cdef: + int _handle + dict _cache + + def __init__(self, *args, **kwargs) -> None: + raise RuntimeError("DeviceProperties cannot be instantiated directly. Please use Device APIs.") + + @classmethod + def _init(cls, handle: int) -> DeviceProperties: + cdef DeviceProperties self = DeviceProperties.__new__(cls) + self._handle = handle + self._cache = {} + return self + + cdef inline int _get_attribute(self, cydriver.CUdevice_attribute attr, default=0) except? -2: + """Retrieve the attribute value directly from the driver.""" + cdef int val + cdef cydriver.CUresult err + with nogil: + err = cydriver.cuDeviceGetAttribute(&val, attr, self._handle) + if err == cydriver.CUresult.CUDA_ERROR_INVALID_VALUE and default is not None: + return default + HANDLE_RETURN(err) + return val + + cdef inline int _get_cached_attribute(self, attr, default=0) except? -2: + """Retrieve the attribute value, using cache if applicable.""" + cached = self._cache.get(attr) + if cached is not None: + return cached + cdef int value = self._get_attribute(attr, default) + self._cache[attr] = value # setdefault not needed for ints + return value + + @property + def max_threads_per_block(self) -> int: + """int: Maximum number of threads per block.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_BLOCK) + + @property + def max_block_dim_x(self) -> int: + """int: Maximum block dimension X.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_X) + + @property + def max_block_dim_y(self) -> int: + """int: Maximum block dimension Y.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Y) + + @property + def max_block_dim_z(self) -> int: + """int: Maximum block dimension Z.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Z) + + @property + def max_grid_dim_x(self) -> int: + """int: Maximum grid dimension X.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_X) + + @property + def max_grid_dim_y(self) -> int: + """int: Maximum grid dimension Y.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Y) + + @property + def max_grid_dim_z(self) -> int: + """int: Maximum grid dimension Z.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Z) + + @property + def max_shared_memory_per_block(self) -> int: + """int: Maximum shared memory available per block in bytes.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK) + + @property + def total_constant_memory(self) -> int: + """int: Memory available on device for constant variables in a CUDA C kernel in bytes.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_TOTAL_CONSTANT_MEMORY) + + @property + def warp_size(self) -> int: + """int: Warp size in threads.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_WARP_SIZE) + + @property + def max_pitch(self) -> int: + """int: Maximum pitch in bytes allowed by memory copies.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAX_PITCH) + + @property + def maximum_texture1d_width(self) -> int: + """int: Maximum 1D texture width.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_WIDTH) + + @property + def maximum_texture1d_linear_width(self) -> int: + """int: Maximum width for a 1D texture bound to linear memory.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LINEAR_WIDTH) + + @property + def maximum_texture1d_mipmapped_width(self) -> int: + """int: Maximum mipmapped 1D texture width.""" + return self._get_cached_attribute( + driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_MIPMAPPED_WIDTH + ) + + @property + def maximum_texture2d_width(self) -> int: + """int: Maximum 2D texture width.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_WIDTH) + + @property + def maximum_texture2d_height(self) -> int: + """int: Maximum 2D texture height.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_HEIGHT) + + @property + def maximum_texture2d_linear_width(self) -> int: + """int: Maximum width for a 2D texture bound to linear memory.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_WIDTH) + + @property + def maximum_texture2d_linear_height(self) -> int: + """int: Maximum height for a 2D texture bound to linear memory.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_HEIGHT) + + @property + def maximum_texture2d_linear_pitch(self) -> int: + """int: Maximum pitch in bytes for a 2D texture bound to linear memory.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_PITCH) + + @property + def maximum_texture2d_mipmapped_width(self) -> int: + """int: Maximum mipmapped 2D texture width.""" + return self._get_cached_attribute( + driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_MIPMAPPED_WIDTH + ) + + @property + def maximum_texture2d_mipmapped_height(self) -> int: + """int: Maximum mipmapped 2D texture height.""" + return self._get_cached_attribute( + driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_MIPMAPPED_HEIGHT + ) + + @property + def maximum_texture3d_width(self) -> int: + """int: Maximum 3D texture width.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_WIDTH) + + @property + def maximum_texture3d_height(self) -> int: + """int: Maximum 3D texture height.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_HEIGHT) + + @property + def maximum_texture3d_depth(self) -> int: + """int: Maximum 3D texture depth.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_DEPTH) + + @property + def maximum_texture3d_width_alternate(self) -> int: + """int: Alternate maximum 3D texture width, 0 if no alternate maximum 3D texture size is supported.""" + return self._get_cached_attribute( + driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_WIDTH_ALTERNATE + ) + + @property + def maximum_texture3d_height_alternate(self) -> int: + """int: Alternate maximum 3D texture height, 0 if no alternate maximum 3D texture size is supported.""" + return self._get_cached_attribute( + driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_HEIGHT_ALTERNATE + ) + + @property + def maximum_texture3d_depth_alternate(self) -> int: + """int: Alternate maximum 3D texture depth, 0 if no alternate maximum 3D texture size is supported.""" + return self._get_cached_attribute( + driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_DEPTH_ALTERNATE + ) + + @property + def maximum_texturecubemap_width(self) -> int: + """int: Maximum cubemap texture width or height.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_WIDTH) + + @property + def maximum_texture1d_layered_width(self) -> int: + """int: Maximum 1D layered texture width.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LAYERED_WIDTH) + + @property + def maximum_texture1d_layered_layers(self) -> int: + """int: Maximum layers in a 1D layered texture.""" + return self._get_cached_attribute( + driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LAYERED_LAYERS + ) + + @property + def maximum_texture2d_layered_width(self) -> int: + """int: Maximum 2D layered texture width.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_WIDTH) + + @property + def maximum_texture2d_layered_height(self) -> int: + """int: Maximum 2D layered texture height.""" + return self._get_cached_attribute( + driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_HEIGHT + ) + + @property + def maximum_texture2d_layered_layers(self) -> int: + """int: Maximum layers in a 2D layered texture.""" + return self._get_cached_attribute( + driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_LAYERS + ) + + @property + def maximum_texturecubemap_layered_width(self) -> int: + """int: Maximum cubemap layered texture width or height.""" + return self._get_cached_attribute( + driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_LAYERED_WIDTH + ) + + @property + def maximum_texturecubemap_layered_layers(self) -> int: + """int: Maximum layers in a cubemap layered texture.""" + return self._get_cached_attribute( + driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_LAYERED_LAYERS + ) + + @property + def maximum_surface1d_width(self) -> int: + """int: Maximum 1D surface width.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_WIDTH) + + @property + def maximum_surface2d_width(self) -> int: + """int: Maximum 2D surface width.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_WIDTH) + + @property + def maximum_surface2d_height(self) -> int: + """int: Maximum 2D surface height.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_HEIGHT) + + @property + def maximum_surface3d_width(self) -> int: + """int: Maximum 3D surface width.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_WIDTH) + + @property + def maximum_surface3d_height(self) -> int: + """int: Maximum 3D surface height.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_HEIGHT) + + @property + def maximum_surface3d_depth(self) -> int: + """int: Maximum 3D surface depth.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_DEPTH) + + @property + def maximum_surface1d_layered_width(self) -> int: + """int: Maximum 1D layered surface width.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_LAYERED_WIDTH) + + @property + def maximum_surface1d_layered_layers(self) -> int: + """int: Maximum layers in a 1D layered surface.""" + return self._get_cached_attribute( + driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_LAYERED_LAYERS + ) + + @property + def maximum_surface2d_layered_width(self) -> int: + """int: Maximum 2D layered surface width.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_WIDTH) + + @property + def maximum_surface2d_layered_height(self) -> int: + """int: Maximum 2D layered surface height.""" + return self._get_cached_attribute( + driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_HEIGHT + ) + + @property + def maximum_surface2d_layered_layers(self) -> int: + """int: Maximum layers in a 2D layered surface.""" + return self._get_cached_attribute( + driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_LAYERS + ) + + @property + def maximum_surfacecubemap_width(self) -> int: + """int: Maximum cubemap surface width.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_WIDTH) + + @property + def maximum_surfacecubemap_layered_width(self) -> int: + """int: Maximum cubemap layered surface width.""" + return self._get_cached_attribute( + driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_LAYERED_WIDTH + ) + + @property + def maximum_surfacecubemap_layered_layers(self) -> int: + """int: Maximum layers in a cubemap layered surface.""" + return self._get_cached_attribute( + driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_LAYERED_LAYERS + ) + + @property + def max_registers_per_block(self) -> int: + """int: Maximum number of 32-bit registers available to a thread block.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_BLOCK) + + @property + def clock_rate(self) -> int: + """int: Typical clock frequency in kilohertz.""" + return self._get_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_CLOCK_RATE) + + @property + def texture_alignment(self) -> int: + """int: Alignment requirement for textures.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_TEXTURE_ALIGNMENT) + + @property + def texture_pitch_alignment(self) -> int: + """int: Pitch alignment requirement for textures.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_TEXTURE_PITCH_ALIGNMENT) + + @property + def gpu_overlap(self) -> bool: + """bool: Device can possibly copy memory and execute a kernel concurrently. Deprecated. Use :attr:`~DeviceProperties.async_engine_count` instead.""" + return bool(self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_GPU_OVERLAP)) + + @property + def multiprocessor_count(self) -> int: + """int: Number of multiprocessors on device.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT) + + @property + def kernel_exec_timeout(self) -> bool: + """bool: Specifies whether there is a run time limit on kernels.""" + return bool(self._get_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_KERNEL_EXEC_TIMEOUT)) + + @property + def integrated(self) -> bool: + """bool: Device is integrated with host memory.""" + return bool(self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_INTEGRATED)) + + @property + def can_map_host_memory(self) -> bool: + """bool: Device can map host memory into CUDA address space.""" + return bool(self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_CAN_MAP_HOST_MEMORY)) + + @property + def compute_mode(self) -> int: + """int: Compute mode (See CUcomputemode for details).""" + return self._get_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_COMPUTE_MODE) + + @property + def concurrent_kernels(self) -> bool: + """bool: Device can possibly execute multiple kernels concurrently.""" + return bool(self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_CONCURRENT_KERNELS)) + + @property + def ecc_enabled(self) -> bool: + """bool: Device has ECC support enabled.""" + return bool(self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_ECC_ENABLED)) + + @property + def pci_bus_id(self) -> int: + """int: PCI bus ID of the device.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_PCI_BUS_ID) + + @property + def pci_device_id(self) -> int: + """int: PCI device ID of the device.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_PCI_DEVICE_ID) + + @property + def pci_domain_id(self) -> int: + """int: PCI domain ID of the device.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_PCI_DOMAIN_ID) + + @property + def tcc_driver(self) -> bool: + """bool: Device is using TCC driver model.""" + return bool(self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_TCC_DRIVER)) + + @property + def memory_clock_rate(self) -> int: + """int: Peak memory clock frequency in kilohertz.""" + return self._get_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MEMORY_CLOCK_RATE) + + @property + def global_memory_bus_width(self) -> int: + """int: Global memory bus width in bits.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_GLOBAL_MEMORY_BUS_WIDTH) + + @property + def l2_cache_size(self) -> int: + """int: Size of L2 cache in bytes.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_L2_CACHE_SIZE) + + @property + def max_threads_per_multiprocessor(self) -> int: + """int: Maximum resident threads per multiprocessor.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_MULTIPROCESSOR) + + @property + def unified_addressing(self) -> bool: + """bool: Device shares a unified address space with the host.""" + return bool(self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_UNIFIED_ADDRESSING)) + + @property + def compute_capability_major(self) -> int: + """int: Major compute capability version number.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR) + + @property + def compute_capability_minor(self) -> int: + """int: Minor compute capability version number.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR) + + @property + def global_l1_cache_supported(self) -> bool: + """bool: Device supports caching globals in L1.""" + return bool(self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_GLOBAL_L1_CACHE_SUPPORTED)) + + @property + def local_l1_cache_supported(self) -> bool: + """bool: Device supports caching locals in L1.""" + return bool(self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_LOCAL_L1_CACHE_SUPPORTED)) + + @property + def max_shared_memory_per_multiprocessor(self) -> int: + """int: Maximum shared memory available per multiprocessor in bytes.""" + return self._get_cached_attribute( + driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_MULTIPROCESSOR + ) + + @property + def max_registers_per_multiprocessor(self) -> int: + """int: Maximum number of 32-bit registers available per multiprocessor.""" + return self._get_cached_attribute( + driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_MULTIPROCESSOR + ) + + @property + def managed_memory(self) -> bool: + """bool: Device can allocate managed memory on this system.""" + return bool(self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MANAGED_MEMORY)) + + @property + def multi_gpu_board(self) -> bool: + """bool: Device is on a multi-GPU board.""" + return bool(self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MULTI_GPU_BOARD)) + + @property + def multi_gpu_board_group_id(self) -> int: + """int: Unique id for a group of devices on the same multi-GPU board.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MULTI_GPU_BOARD_GROUP_ID) + + @property + def host_native_atomic_supported(self) -> bool: + """bool: Link between the device and the host supports all native atomic operations.""" + return bool( + self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_HOST_NATIVE_ATOMIC_SUPPORTED) + ) + + @property + def single_to_double_precision_perf_ratio(self) -> int: + """int: Ratio of single precision performance (in floating-point operations per second) to double precision performance.""" + return self._get_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_SINGLE_TO_DOUBLE_PRECISION_PERF_RATIO) + + @property + def pageable_memory_access(self) -> bool: + """bool: Device supports coherently accessing pageable memory without calling cudaHostRegister on it.""" + return bool(self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS)) + + @property + def concurrent_managed_access(self) -> bool: + """bool: Device can coherently access managed memory concurrently with the CPU.""" + return bool(self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS)) + + @property + def compute_preemption_supported(self) -> bool: + """bool: Device supports compute preemption.""" + return bool( + self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_COMPUTE_PREEMPTION_SUPPORTED) + ) + + @property + def can_use_host_pointer_for_registered_mem(self) -> bool: + """bool: Device can access host registered memory at the same virtual address as the CPU.""" + return bool( + self._get_cached_attribute( + driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_CAN_USE_HOST_POINTER_FOR_REGISTERED_MEM + ) + ) + + # TODO: A few attrs are missing here (NVIDIA/cuda-python#675) + + @property + def cooperative_launch(self) -> bool: + """bool: Device supports launching cooperative kernels via cuLaunchCooperativeKernel.""" + return bool(self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_COOPERATIVE_LAUNCH)) + + # TODO: A few attrs are missing here (NVIDIA/cuda-python#675) + + @property + def max_shared_memory_per_block_optin(self) -> int: + """int: Maximum optin shared memory per block.""" + return self._get_cached_attribute( + driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK_OPTIN + ) + + @property + def pageable_memory_access_uses_host_page_tables(self) -> bool: + """bool: Device accesses pageable memory via the host's page tables.""" + return bool( + self._get_cached_attribute( + driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS_USES_HOST_PAGE_TABLES + ) + ) + + @property + def direct_managed_mem_access_from_host(self) -> bool: + """bool: The host can directly access managed memory on the device without migration.""" + return bool( + self._get_cached_attribute( + driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_DIRECT_MANAGED_MEM_ACCESS_FROM_HOST + ) + ) + + @property + def virtual_memory_management_supported(self) -> bool: + """bool: Device supports virtual memory management APIs like cuMemAddressReserve, cuMemCreate, cuMemMap and related APIs.""" + return bool( + self._get_cached_attribute( + driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_VIRTUAL_MEMORY_MANAGEMENT_SUPPORTED + ) + ) + + @property + def handle_type_posix_file_descriptor_supported(self) -> bool: + """bool: Device supports exporting memory to a posix file descriptor with cuMemExportToShareableHandle, if requested via cuMemCreate.""" + return bool( + self._get_cached_attribute( + driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_POSIX_FILE_DESCRIPTOR_SUPPORTED + ) + ) + + @property + def handle_type_win32_handle_supported(self) -> bool: + """bool: Device supports exporting memory to a Win32 NT handle with cuMemExportToShareableHandle, if requested via cuMemCreate.""" + return bool( + self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_WIN32_HANDLE_SUPPORTED) + ) + + @property + def handle_type_win32_kmt_handle_supported(self) -> bool: + """bool: Device supports exporting memory to a Win32 KMT handle with cuMemExportToShareableHandle, if requested via cuMemCreate.""" + return bool( + self._get_cached_attribute( + driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_WIN32_KMT_HANDLE_SUPPORTED + ) + ) + + @property + def max_blocks_per_multiprocessor(self) -> int: + """int: Maximum number of blocks per multiprocessor.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAX_BLOCKS_PER_MULTIPROCESSOR) + + @property + def generic_compression_supported(self) -> bool: + """bool: Device supports compression of memory.""" + return bool( + self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_GENERIC_COMPRESSION_SUPPORTED) + ) + + @property + def max_persisting_l2_cache_size(self) -> int: + """int: Maximum L2 persisting lines capacity setting in bytes.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAX_PERSISTING_L2_CACHE_SIZE) + + @property + def max_access_policy_window_size(self) -> int: + """int: Maximum value of CUaccessPolicyWindow.num_bytes.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAX_ACCESS_POLICY_WINDOW_SIZE) + + @property + def gpu_direct_rdma_with_cuda_vmm_supported(self) -> bool: + """bool: Device supports specifying the GPUDirect RDMA flag with cuMemCreate.""" + return bool( + self._get_cached_attribute( + driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_WITH_CUDA_VMM_SUPPORTED + ) + ) + + @property + def reserved_shared_memory_per_block(self) -> int: + """int: Shared memory reserved by CUDA driver per block in bytes.""" + return self._get_cached_attribute( + driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_RESERVED_SHARED_MEMORY_PER_BLOCK + ) + + @property + def sparse_cuda_array_supported(self) -> bool: + """bool: Device supports sparse CUDA arrays and sparse CUDA mipmapped arrays.""" + return bool( + self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_SPARSE_CUDA_ARRAY_SUPPORTED) + ) + + @property + def read_only_host_register_supported(self) -> bool: + """bool: True if device supports using the cuMemHostRegister flag CU_MEMHOSTREGISTER_READ_ONLY to register memory that must be mapped as read-only to the GPU, False if not.""" + return bool( + self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_READ_ONLY_HOST_REGISTER_SUPPORTED) + ) + + @property + def memory_pools_supported(self) -> bool: + """bool: Device supports using the cuMemAllocAsync and cuMemPool family of APIs.""" + return bool(self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MEMORY_POOLS_SUPPORTED)) + + @property + def gpu_direct_rdma_supported(self) -> bool: + """bool: Device supports GPUDirect RDMA APIs, like nvidia_p2p_get_pages (see https://docs.nvidia.com/cuda/gpudirect-rdma for more information).""" + return bool(self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_SUPPORTED)) + + @property + def gpu_direct_rdma_flush_writes_options(self) -> int: + """int: The returned attribute shall be interpreted as a bitmask, where the individual bits are described by the CUflushGPUDirectRDMAWritesOptions enum.""" + return self._get_cached_attribute( + driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_FLUSH_WRITES_OPTIONS + ) + + @property + def gpu_direct_rdma_writes_ordering(self) -> int: + """int: GPUDirect RDMA writes to the device do not need to be flushed for consumers within the scope indicated by the returned attribute. See CUGPUDirectRDMAWritesOrdering for the numerical values returned here.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_WRITES_ORDERING) + + @property + def mempool_supported_handle_types(self) -> int: + """int: Handle types supported with mempool based IPC.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MEMPOOL_SUPPORTED_HANDLE_TYPES) + + @property + def deferred_mapping_cuda_array_supported(self) -> bool: + """bool: Device supports deferred mapping CUDA arrays and CUDA mipmapped arrays.""" + return bool( + self._get_cached_attribute( + driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_DEFERRED_MAPPING_CUDA_ARRAY_SUPPORTED + ) + ) + + @property + def numa_config(self) -> int: + """int: NUMA configuration of a device: value is of type CUdeviceNumaConfig enum.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_NUMA_CONFIG) + + @property + def numa_id(self) -> int: + """int: NUMA node ID of the GPU memory.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_NUMA_ID) + + @property + def multicast_supported(self) -> bool: + """bool: Device supports switch multicast and reduction operations.""" + return bool(self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MULTICAST_SUPPORTED)) + + @property + def surface_alignment(self) -> int: + """int: Surface alignment requirement in bytes.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_SURFACE_ALIGNMENT) + + @property + def async_engine_count(self) -> int: + """int: Number of asynchronous engines.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_ASYNC_ENGINE_COUNT) + + @property + def can_tex2d_gather(self) -> bool: + """bool: True if device supports 2D texture gather operations, False if not.""" + return bool(self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_CAN_TEX2D_GATHER)) + + @property + def maximum_texture2d_gather_width(self) -> int: + """int: Maximum 2D texture gather width.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_GATHER_WIDTH) + + @property + def maximum_texture2d_gather_height(self) -> int: + """int: Maximum 2D texture gather height.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_GATHER_HEIGHT) + + @property + def stream_priorities_supported(self) -> bool: + """bool: True if device supports stream priorities, False if not.""" + return bool( + self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_STREAM_PRIORITIES_SUPPORTED) + ) + + @property + def can_flush_remote_writes(self) -> bool: + """bool: The CU_STREAM_WAIT_VALUE_FLUSH flag and the CU_STREAM_MEM_OP_FLUSH_REMOTE_WRITES MemOp are supported on the device. See Stream Memory Operations for additional details.""" + return bool(self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_CAN_FLUSH_REMOTE_WRITES)) + + @property + def host_register_supported(self) -> bool: + """bool: Device supports host memory registration via cudaHostRegister.""" + return bool(self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_HOST_REGISTER_SUPPORTED)) + + @property + def timeline_semaphore_interop_supported(self) -> bool: + """bool: External timeline semaphore interop is supported on the device.""" + return bool( + self._get_cached_attribute( + driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_TIMELINE_SEMAPHORE_INTEROP_SUPPORTED + ) + ) + + @property + def cluster_launch(self) -> bool: + """bool: Indicates device supports cluster launch.""" + return bool(self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_CLUSTER_LAUNCH)) + + @property + def can_use_64_bit_stream_mem_ops(self) -> bool: + """bool: 64-bit operations are supported in cuStreamBatchMemOp and related MemOp APIs.""" + return bool( + self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_CAN_USE_64_BIT_STREAM_MEM_OPS) + ) + + @property + def can_use_stream_wait_value_nor(self) -> bool: + """bool: CU_STREAM_WAIT_VALUE_NOR is supported by MemOp APIs.""" + return bool( + self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_CAN_USE_STREAM_WAIT_VALUE_NOR) + ) + + @property + def dma_buf_supported(self) -> bool: + """bool: Device supports buffer sharing with dma_buf mechanism.""" + return bool(self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_DMA_BUF_SUPPORTED)) + + # Start of CUDA 12 device attributes + + @property + def ipc_event_supported(self) -> bool: + """bool: Device supports IPC Events.""" + return bool(self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_IPC_EVENT_SUPPORTED)) + + @property + def mem_sync_domain_count(self) -> int: + """int: Number of memory domains the device supports.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MEM_SYNC_DOMAIN_COUNT, default=1) + + @property + def tensor_map_access_supported(self) -> bool: + """bool: Device supports accessing memory using Tensor Map.""" + return bool( + self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_TENSOR_MAP_ACCESS_SUPPORTED) + ) + + @property + def handle_type_fabric_supported(self) -> bool: + """bool: Device supports exporting memory to a fabric handle with cuMemExportToShareableHandle() or requested with cuMemCreate().""" + return bool( + self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_FABRIC_SUPPORTED) + ) + + @property + def unified_function_pointers(self) -> bool: + """bool: Device supports unified function pointers.""" + return bool(self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_UNIFIED_FUNCTION_POINTERS)) + + @property + def mps_enabled(self) -> bool: + """bool: Indicates if contexts created on this device will be shared via MPS.""" + return bool(self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MPS_ENABLED)) + + @property + def host_numa_id(self) -> int: + """int: NUMA ID of the host node closest to the device. Returns -1 when system does not support NUMA.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_HOST_NUMA_ID, default=-1) + + @property + def d3d12_cig_supported(self) -> bool: + """bool: Device supports CIG with D3D12.""" + return bool(self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_D3D12_CIG_SUPPORTED)) + + @property + def mem_decompress_algorithm_mask(self) -> int: + """int: The returned value shall be interpreted as a bitmask, where the individual bits are described by the CUmemDecompressAlgorithm enum.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MEM_DECOMPRESS_ALGORITHM_MASK) + + @property + def mem_decompress_maximum_length(self) -> int: + """int: The returned value is the maximum length in bytes of a single decompress operation that is allowed.""" + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MEM_DECOMPRESS_MAXIMUM_LENGTH) + + @property + def vulkan_cig_supported(self) -> bool: + """bool: Device supports CIG with Vulkan.""" + return bool(self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_VULKAN_CIG_SUPPORTED)) + + @property + def gpu_pci_device_id(self) -> int: + """int: The combined 16-bit PCI device ID and 16-bit PCI vendor ID. + + Returns 0 if the driver does not support this query. + """ + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_GPU_PCI_DEVICE_ID) + + @property + def gpu_pci_subsystem_id(self) -> int: + """int: The combined 16-bit PCI subsystem ID and 16-bit PCI subsystem vendor ID. + + Returns 0 if the driver does not support this query. + """ + return self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_GPU_PCI_SUBSYSTEM_ID) + + @property + def host_numa_virtual_memory_management_supported(self) -> bool: + """bool: Device supports HOST_NUMA location with the virtual memory management APIs like cuMemCreate, cuMemMap and related APIs.""" + return bool( + self._get_cached_attribute( + driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_HOST_NUMA_VIRTUAL_MEMORY_MANAGEMENT_SUPPORTED + ) + ) + + @property + def host_numa_memory_pools_supported(self) -> bool: + """bool: Device supports HOST_NUMA location with the cuMemAllocAsync and cuMemPool family of APIs.""" + return bool( + self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_HOST_NUMA_MEMORY_POOLS_SUPPORTED) + ) + + # Start of CUDA 13 device attributes + + @property + def host_numa_multinode_ipc_supported(self) -> bool: + """bool: Device supports HOST_NUMA location IPC between nodes in a multi-node system.""" + return bool( + self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_HOST_NUMA_MULTINODE_IPC_SUPPORTED) + ) + + @property + def host_memory_pools_supported(self) -> bool: + """bool: Device supports HOST location with the cuMemAllocAsync and cuMemPool family of APIs.""" + return bool( + self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_HOST_MEMORY_POOLS_SUPPORTED) + ) + + @property + def host_virtual_memory_management_supported(self) -> bool: + """bool: Device supports HOST location with the virtual memory management APIs like cuMemCreate, cuMemMap and related APIs.""" + return bool( + self._get_cached_attribute( + driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_HOST_VIRTUAL_MEMORY_MANAGEMENT_SUPPORTED + ) + ) + + @property + def host_alloc_dma_buf_supported(self) -> bool: + """bool: Device supports page-locked host memory buffer sharing with dma_buf mechanism.""" + return bool( + self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_HOST_ALLOC_DMA_BUF_SUPPORTED) + ) + + @property + def only_partial_host_native_atomic_supported(self) -> bool: + """bool: Link between the device and the host supports only some native atomic operations.""" + return bool( + self._get_cached_attribute( + driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_ONLY_PARTIAL_HOST_NATIVE_ATOMIC_SUPPORTED + ) + ) + + +class Device: + """Represent a GPU and act as an entry point for cuda.core features. + + This is a singleton object that helps ensure interoperability + across multiple libraries imported in the process to both see + and use the same GPU device. + + While acting as the entry point, many other CUDA resources can be + allocated such as streams and buffers. Any :obj:`~_context.Context` dependent + resource created through this device, will continue to refer to + this device's context. + + Newly returned :obj:`~_device.Device` objects are thread-local singletons + for a specified device. + + Note + ---- + Will not initialize the GPU. + + Parameters + ---------- + device_id : int, optional + Device ordinal to return a :obj:`~_device.Device` object for. + Default value of `None` return the currently used device. + + """ + __slots__ = ( + "_device_id", + "_memory_resource", + "_has_inited", + "_properties", + "_resources", + "_uuid", + "_context", + "__weakref__", + ) + + def __new__(cls, device_id: Device | int | None = None) -> Device: + if isinstance(device_id, Device): + return device_id + + Device_ensure_cuda_initialized() + device_id = Device_resolve_device_id(device_id) + devices = Device_ensure_tls_devices(cls) + + try: + return devices[device_id] + except IndexError: + raise ValueError(f"device_id must be within [0, {len(devices)}), got {device_id}") from None + + def _check_context_initialized(self) -> None: + if not self._has_inited: + raise CUDAError( + f"Device {self._device_id} is not yet initialized, perhaps you forgot to call .set_current() first?" + ) + + + @classmethod + def get_all_devices(cls) -> tuple[Device, ...]: + """ + Query the available device instances. + + Returns + ------- + tuple of Device + A tuple containing instances of available devices. + """ + from cuda.core import system + total = system.get_num_devices() + return tuple(cls(device_id) for device_id in range(total)) + + def to_system_device(self) -> 'cuda.core.system.Device': + """ + Get the corresponding :class:`cuda.core.system.Device` (which is used + for NVIDIA Management Library (NVML) access) for this + :class:`cuda.core.Device` (which is used for CUDA access). + + The devices are mapped to one another by their UUID. + + Returns + ------- + cuda.core.system.Device + The corresponding system-level device instance used for NVML access. + """ + from cuda.core.system._system import CUDA_BINDINGS_NVML_IS_COMPATIBLE + + if not CUDA_BINDINGS_NVML_IS_COMPATIBLE: + raise RuntimeError( + "cuda.core.system.Device requires cuda-bindings 12.9.6+ for CUDA 12.x, or cuda-bindings 13.2.0+ for CUDA 13.x" + ) + + from cuda.core.system import Device as SystemDevice + return SystemDevice(uuid=self.uuid) + + @property + def device_id(self) -> int: + """Return device ordinal.""" + return self._device_id + + @property + def pci_bus_id(self) -> str: + """Return a PCI Bus Id string for this device.""" + bus_id = handle_return(runtime.cudaDeviceGetPCIBusId(13, self._device_id)) + return bus_id[:12].decode() + + def can_access_peer(self, peer: Device | int) -> bool: + """Check if this device can access memory from the specified peer device. + + Queries whether peer-to-peer memory access is supported between this + device and the specified peer device. + + Parameters + ---------- + peer : Device | int + The peer device to check accessibility to. Can be a :obj:`~_device.Device` object or device ID. + """ + peer = Device(peer) + cdef int d1 = self.device_id + cdef int d2 = peer.device_id + if d1 == d2: + return True + cdef int value = 0 + with nogil: + HANDLE_RETURN(cydriver.cuDeviceCanAccessPeer(&value, d1, d2)) + return bool(value) + + @property + def uuid(self) -> str: + """Return a UUID for the device. + + Returns 16-octets identifying the device. If the device is in + MIG mode, returns its MIG UUID which uniquely identifies the + subscribed MIG compute instance. + + Note + ---- + MIG UUID is only returned when device is in MIG mode and the + driver is older than CUDA 11.4. + + The UUID is cached after first access to avoid repeated CUDA API calls. + + """ + cdef cydriver.CUuuid uuid + cdef cydriver.CUdevice dev + cdef bytes uuid_b + cdef str uuid_hex + + if self._uuid is None: + dev = self._device_id + with nogil: + IF CUDA_CORE_BUILD_MAJOR == 12: + HANDLE_RETURN(cydriver.cuDeviceGetUuid_v2(&uuid, dev)) + ELSE: # 13.0+ + HANDLE_RETURN(cydriver.cuDeviceGetUuid(&uuid, dev)) + uuid_b = cpython.PyBytes_FromStringAndSize(uuid.bytes, sizeof(uuid.bytes)) + uuid_hex = uuid_b.hex() + # 8-4-4-4-12 + self._uuid = f"{uuid_hex[:8]}-{uuid_hex[8:12]}-{uuid_hex[12:16]}-{uuid_hex[16:20]}-{uuid_hex[20:]}" + return self._uuid + + @property + def name(self) -> str: + """Return the device name.""" + # Use 256 characters to be consistent with CUDA Runtime + cdef int LENGTH = 256 + cdef bytes name = bytes(LENGTH) + cdef char* name_ptr = name + cdef cydriver.CUdevice this_dev = self._device_id + with nogil: + HANDLE_RETURN(cydriver.cuDeviceGetName(name_ptr, LENGTH, this_dev)) + name = name.split(b"\0")[0] + return name.decode() + + @property + def properties(self) -> DeviceProperties: + """Return a :obj:`~_device.DeviceProperties` class with information about the device.""" + if self._properties is None: + self._properties = DeviceProperties._init(self._device_id) + + return self._properties + + @property + def resources(self) -> DeviceResources: + """Return the hardware resource query namespace for this device.""" + if self._resources is None: + self._resources = DeviceResources._init(self._device_id) + return self._resources + + @property + def compute_capability(self) -> ComputeCapability: + """Return a named tuple with 2 fields: major and minor.""" + cdef DeviceProperties prop = self.properties + cached = prop._cache.get("compute_capability") + if cached is not None: + return cached + cc = ComputeCapability(prop.compute_capability_major, prop.compute_capability_minor) + return prop._cache.setdefault("compute_capability", cc) + + @property + def arch(self) -> str: + """Return compute capability as a string (e.g., '75' for CC 7.5).""" + return f"{self.compute_capability.major}{self.compute_capability.minor}" + + @property + def context(self) -> Context: + """Return the :obj:`~_context.Context` associated with this device. + + Note + ---- + Device must be initialized. + + """ + self._check_context_initialized() + return self._context + + @property + def memory_resource(self) -> MemoryResource: + """Return :obj:`~_memory.MemoryResource` associated with this device.""" + cdef int attr, device_id + if self._memory_resource is None: + # If the device is in TCC mode, or does not support memory pools for some other reason, + # use the SynchronousMemoryResource which does not use memory pools. + device_id = self._device_id + with nogil: + HANDLE_RETURN( + cydriver.cuDeviceGetAttribute( + &attr, cydriver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_MEMORY_POOLS_SUPPORTED, device_id + ) + ) + if attr == 1: + from cuda.core._memory import DeviceMemoryResource + self._memory_resource = DeviceMemoryResource(self._device_id) + else: + from cuda.core._memory._legacy import _SynchronousMemoryResource + self._memory_resource = _SynchronousMemoryResource(self._device_id) + + return self._memory_resource + + @memory_resource.setter + def memory_resource(self, mr: MemoryResource) -> None: + from cuda.core._memory import MemoryResource + assert_type(mr, MemoryResource) + self._memory_resource = mr + + @property + def default_stream(self) -> Stream: + """Return default CUDA :obj:`~_stream.Stream` associated with this device. + + The type of default stream returned depends on if the environment + variable CUDA_PYTHON_CUDA_PER_THREAD_DEFAULT_STREAM is set. + + If set, returns a per-thread default stream. Otherwise returns + the legacy stream. + + """ + return default_stream() + + def __int__(self) -> int: + """Return device_id.""" + return self._device_id + + def __repr__(self) -> str: + return f"" + + def __hash__(self) -> int: + return hash(self.uuid) + + def __eq__(self, other: object) -> bool: + if not isinstance(other, Device): + return NotImplemented + return self._device_id == other._device_id + + def __reduce__(self) -> tuple[object, ...]: + return Device, (self.device_id,) + + def set_current(self, ctx: Context | None = None) -> Context | None: + """Set device to be used for GPU executions. + + Initializes CUDA and sets the calling thread to a valid CUDA + context. By default the primary context is used, but optional `ctx` + parameter can be used to explicitly supply a :obj:`~_context.Context` object. + + Providing a `ctx` causes the previous set context to be popped and returned. + + Parameters + ---------- + ctx : :obj:`~_context.Context`, optional + Optional context to push onto this device's current thread stack. + + Returns + ------- + :obj:`~_context.Context`, optional + Popped context. + + Examples + -------- + Acts as an entry point of this object. Users always start a code by + calling this method, e.g. + + >>> from cuda.core import Device + >>> dev0 = Device(0) + >>> dev0.set_current() + >>> # ... do work on device 0 ... + + """ + cdef ContextHandle h_context + cdef cydriver.CUcontext prev_ctx, curr_ctx + cdef Context prev_owned = None + + if ctx is not None: + # TODO: revisit once Context is cythonized + assert_type(ctx, Context) + if ctx._device_id != self._device_id: + raise RuntimeError( + "the provided context was created on the device with" + f" id={ctx._device_id}, which is different from the target id={self._device_id}" + ) + if self._has_inited and self._context is not None: + prev_owned = self._context + # prev_ctx is the previous context + curr_ctx = as_cu(ctx._h_context) + prev_ctx = NULL + with nogil: + HANDLE_RETURN(cydriver.cuCtxPopCurrent(&prev_ctx)) + HANDLE_RETURN(cydriver.cuCtxPushCurrent(curr_ctx)) + self._has_inited = True + self._context = ctx # Store owning context reference + if prev_ctx != NULL: + if prev_owned is not None and as_cu(prev_owned._h_context) == prev_ctx: + return prev_owned + return Context._from_handle(Context, create_context_handle_ref(prev_ctx), self._device_id) + else: + # use primary ctx + h_context = get_primary_context(self._device_id) + if h_context.get() == NULL: + raise ValueError("Cannot set NULL context as current") + with nogil: + HANDLE_RETURN(cydriver.cuCtxSetCurrent(as_cu(h_context))) + self._has_inited = True + self._context = Context._from_handle(Context, h_context, self._device_id) # Store owning context + + def create_context(self, options: ContextOptions | None = None) -> Context: + """Create a new :obj:`~_context.Context` object. + + Note + ---- + The newly created context will not be set as current. + + Parameters + ---------- + options : :obj:`~_context.ContextOptions`, optional + Customizable dataclass for context creation options. + + Returns + ------- + :obj:`~_context.Context` + Newly created context object. + + """ + cdef int i + cdef object resources + cdef object res + cdef SMResource sm_res + cdef WorkqueueResource wq_res + cdef GreenCtxHandle h_green + + if options is None: + raise ValueError( + "options with device resources must be provided to create a green context" + ) + + options = check_or_create_options(ContextOptions, options, "Context options") + if options.resources is None: + raise ValueError( + "ContextOptions.resources must be provided to create a green context" + ) + + resources = tuple(options.resources) + if len(resources) == 0: + raise ValueError("ContextOptions.resources must not be empty") + + cdef vector[cydriver.CUdevResource] c_resources + c_resources.resize(len(resources)) + + for i, res in enumerate(resources): + if isinstance(res, SMResource): + sm_res = res + if not sm_res._is_usable: + raise ValueError("dry-run SMResource objects cannot be used to create a context") + c_resources[i] = sm_res._resource + elif isinstance(res, WorkqueueResource): + wq_res = res + c_resources[i] = wq_res._wq_config_resource + else: + raise TypeError(f"Unsupported context resource type: {type(res)}") + + h_green = create_green_ctx_handle( + c_resources.data(), + (c_resources.size()), + (self._device_id), + (cydriver.CUgreenCtxCreate_flags.CU_GREEN_CTX_DEFAULT_STREAM), + ) + if h_green.get() == NULL: + HANDLE_RETURN(get_last_error()) + raise RuntimeError("Failed to create CUDA green context") + + return Context._from_green_ctx(Context, h_green, self._device_id) + + def create_stream(self, obj: IsStreamType | None = None, options: object = None) -> Stream: + """Create a :obj:`~_stream.Stream` object. + + New stream objects can be created in two different ways: + + 1) Create a new CUDA stream with customizable ``options``. + 2) Wrap an existing foreign `obj` supporting the ``__cuda_stream__`` protocol. + + Option (2) internally holds a reference to the foreign object + such that the lifetime is managed. + + Note + ---- + Device must be initialized. + + Parameters + ---------- + obj : :obj:`~_stream.IsStreamType`, optional + Any object supporting the ``__cuda_stream__`` protocol. + options : :obj:`~_stream.StreamOptions`, optional + Customizable dataclass for stream creation options. + + Returns + ------- + :obj:`~_stream.Stream` + Newly created stream object. + + """ + self._check_context_initialized() + return Stream._init(obj=obj, options=options, device_id=self._device_id, ctx=self._context) + + def create_event(self, options: EventOptions | None = None) -> Event: + """Create an :obj:`~_event.Event` object without recording it to a :obj:`~_stream.Stream`. + + Note + ---- + Device must be initialized. + + Parameters + ---------- + options : :obj:`EventOptions`, optional + Customizable dataclass for event creation options. + + Returns + ------- + :obj:`~_event.Event` + Newly created event object. + + """ + self._check_context_initialized() + cdef Context ctx = self._context + return cyEvent._init(cyEvent, self._device_id, ctx._h_context, options, True) + + def allocate(self, size: int, *, stream: Stream | GraphBuilder) -> Buffer: + """Allocate device memory from a specified stream. + + Allocates device memory of `size` bytes on the specified `stream` + using the memory resource currently associated with this Device. + + Note + ---- + Device must be initialized. + + Parameters + ---------- + size : int + Number of bytes to allocate. + stream : :obj:`~_stream.Stream` | :obj:`~graph.GraphBuilder` + Keyword-only. The stream establishing the stream ordering semantic. + Must be passed explicitly; pass ``self.default_stream`` to use + the default stream. + + Returns + ------- + :obj:`~_memory.Buffer` + Newly created buffer object. + + """ + self._check_context_initialized() + return self.memory_resource.allocate(size, stream=stream) + + def sync(self) -> None: + """Synchronize the device. + + Note + ---- + Device must be initialized. + + """ + self._check_context_initialized() + handle_return(runtime.cudaDeviceSynchronize()) + + def create_graph_builder(self) -> GraphBuilder: + """Create a new :obj:`~graph.GraphBuilder` object. + + Returns + ------- + :obj:`~graph.GraphBuilder` + Newly created graph builder object. + + """ + from cuda.core.graph._graph_builder import GraphBuilder + + self._check_context_initialized() + return GraphBuilder._init(self.create_stream()) + + def create_opaque_array(self, options: OpaqueArrayOptions) -> OpaqueArray: + """Create an :obj:`~cuda.core.texture.OpaqueArray` on the current device. + + Allocates an opaque, hardware-laid-out CUDA array for texture/surface + access. The array is created in the current CUDA context, so make this + device current with :meth:`set_current` before calling (mirroring + :meth:`create_stream` / :meth:`create_event`). + + Note + ---- + Device must be initialized. + + Parameters + ---------- + options : :obj:`~cuda.core.texture.OpaqueArrayOptions` + Allocation options (shape, format, channels, surface flag). + + Returns + ------- + :obj:`~cuda.core.texture.OpaqueArray` + Newly created opaque array. + + .. versionadded:: 1.1.0 + """ + from cuda.core.texture._array import _create_opaque_array + + self._check_context_initialized() + return _create_opaque_array(options) + + def create_mipmapped_array(self, options: MipmappedArrayOptions) -> MipmappedArray: + """Create a :obj:`~cuda.core.texture.MipmappedArray` on the current device. + + Allocates a mipmapped CUDA array for texture/surface access across + levels. The array is created in the current CUDA context, so make this + device current with :meth:`set_current` before calling (mirroring + :meth:`create_stream` / :meth:`create_event`). + + Note + ---- + Device must be initialized. + + Parameters + ---------- + options : :obj:`~cuda.core.texture.MipmappedArrayOptions` + Allocation options (shape, format, channels, levels, surface flag). + + Returns + ------- + :obj:`~cuda.core.texture.MipmappedArray` + Newly created mipmapped array. + + .. versionadded:: 1.1.0 + """ + from cuda.core.texture._mipmapped_array import _create_mipmapped_array + + self._check_context_initialized() + return _create_mipmapped_array(options) + + def create_texture_object( + self, *, resource: ResourceDescriptor, options: TextureObjectOptions | None = None + ) -> TextureObject: + """Create a :obj:`~cuda.core.texture.TextureObject` on the current device. + + Binds a resource (an :obj:`~cuda.core.texture.OpaqueArray` / + :obj:`~cuda.core.texture.MipmappedArray` / linear or pitch2d + :obj:`~cuda.core.Buffer`, wrapped in a + :obj:`~cuda.core.texture.ResourceDescriptor`) as a bindless texture for + kernel-side sampled reads. The object is created in the current CUDA + context, so make this device current with :meth:`set_current` before + calling (mirroring :meth:`create_stream` / :meth:`create_event`). + + Note + ---- + Device must be initialized. + + Parameters + ---------- + resource : :obj:`~cuda.core.texture.ResourceDescriptor` + The memory backing the texture. + options : :obj:`~cuda.core.texture.TextureObjectOptions` + Sampling state (address/filter/read modes, normalization, etc.). + + Returns + ------- + :obj:`~cuda.core.texture.TextureObject` + Newly created texture object. + + .. versionadded:: 1.1.0 + """ + from cuda.core.texture._texture import _create_texture_object + + self._check_context_initialized() + return _create_texture_object(resource, options) + + def create_surface_object(self, *, resource: ResourceDescriptor) -> SurfaceObject: + """Create a :obj:`~cuda.core.texture.SurfaceObject` on the current device. + + Binds an :obj:`~cuda.core.texture.OpaqueArray` (via a + :obj:`~cuda.core.texture.ResourceDescriptor`) as a bindless surface for + kernel-side typed load/store. The backing array must have been created + with ``is_surface_load_store=True``. The object is created in the + current CUDA context, so make this device current with + :meth:`set_current` before calling (mirroring :meth:`create_stream` / + :meth:`create_event`). + + Note + ---- + Device must be initialized. + + Parameters + ---------- + resource : :obj:`~cuda.core.texture.ResourceDescriptor` + Must wrap an :obj:`~cuda.core.texture.OpaqueArray` allocated with + ``is_surface_load_store=True``. + + Returns + ------- + :obj:`~cuda.core.texture.SurfaceObject` + Newly created surface object. + + .. versionadded:: 1.1.0 + """ + from cuda.core.texture._surface import _create_surface_object + + self._check_context_initialized() + return _create_surface_object(resource) + + +cdef inline int Device_ensure_cuda_initialized() except? -1: + """Initialize CUDA driver and check version compatibility (once per process).""" + global _is_cuInit + if _is_cuInit is False: + with _lock, nogil: + HANDLE_RETURN(cydriver.cuInit(0)) + _is_cuInit = True + try: + from cuda.bindings.utils import warn_if_cuda_major_version_mismatch + except ImportError: + pass + else: + warn_if_cuda_major_version_mismatch() + return 0 + + +cdef inline int Device_resolve_device_id(device_id) except? -1: + """Resolve device_id, defaulting to current device or 0.""" + cdef cydriver.CUdevice dev + cdef cydriver.CUcontext ctx + cdef cydriver.CUresult err + if device_id is None: + with nogil: + err = cydriver.cuCtxGetDevice(&dev) + if err == cydriver.CUresult.CUDA_SUCCESS: + return int(dev) + elif err == cydriver.CUresult.CUDA_ERROR_INVALID_CONTEXT: + with nogil: + HANDLE_RETURN(cydriver.cuCtxGetCurrent(&ctx)) + assert (ctx) == NULL + return 0 # cudart behavior + else: + HANDLE_RETURN(err) + elif device_id < 0: + raise ValueError(f"device_id must be >= 0, got {device_id}") + return device_id + + +cdef inline list Device_ensure_tls_devices(cls): + """Ensure thread-local Device singletons exist, creating if needed.""" + cdef int total + try: + return _tls.devices + except AttributeError: + with nogil: + HANDLE_RETURN(cydriver.cuDeviceGetCount(&total)) + devices = _tls.devices = [] + for dev_id in range(total): + device = super(Device, cls).__new__(cls) + device._device_id = dev_id + device._memory_resource = None + device._has_inited = False + device._properties = None + device._resources = None + device._uuid = None + device._context = None + devices.append(device) + return devices diff --git a/cuda_core/cuda/core/_device_resources.pxd b/cuda_core/cuda/core/_device_resources.pxd new file mode 100644 index 00000000000..98f91ab4733 --- /dev/null +++ b/cuda_core/cuda/core/_device_resources.pxd @@ -0,0 +1,54 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +cimport cython + +from cuda.bindings cimport cydriver +from cuda.core._resource_handles cimport ContextHandle, GreenCtxHandle + + +cdef class SMResource: + cdef: + cydriver.CUdevResource _resource + unsigned int _sm_count + unsigned int _min_partition_size + unsigned int _coscheduled_alignment + unsigned int _flags + bint _is_usable + object __weakref__ + cython.pymutex _split_mutex + + @staticmethod + cdef SMResource _from_dev_resource(cydriver.CUdevResource res, int device_id) + + @staticmethod + cdef SMResource _from_split_resource(cydriver.CUdevResource res, SMResource parent, bint is_usable) + + +cdef class WorkqueueResource: + cdef: + cydriver.CUdevResource _wq_config_resource + cydriver.CUdevResource _wq_resource + object __weakref__ + + @staticmethod + cdef WorkqueueResource _from_dev_resources( + cydriver.CUdevResource wq_config, + cydriver.CUdevResource wq, + ) + + +cdef class DeviceResources: + cdef: + int _device_id + ContextHandle _h_context # NULL for device-level queries + object __weakref__ + + @staticmethod + cdef DeviceResources _init(int device_id) + + @staticmethod + cdef DeviceResources _init_from_ctx(ContextHandle h_context, int device_id) + + cdef inline int _query_sm(self, cydriver.CUdevResource* res) except?-1 nogil diff --git a/cuda_core/cuda/core/_device_resources.pyi b/cuda_core/cuda/core/_device_resources.pyi new file mode 100644 index 00000000000..7514f5a2f43 --- /dev/null +++ b/cuda_core/cuda/core/_device_resources.pyi @@ -0,0 +1,187 @@ +# This file was generated by stubgen-pyx v0.2.6 from cuda_core/cuda/core/_device_resources.pyx + +from __future__ import annotations + +from collections.abc import Sequence as SequenceABC +from dataclasses import dataclass + +from cuda.core._device import Device +from cuda.core.typing import WorkqueueSharingScopeType + + +@dataclass +class SMResourceOptions: + """Customizable :obj:`SMResource.split` options. + + Each field accepts a scalar (for a single group) or a ``Sequence`` + (for multiple groups). ``count`` drives the number of groups; other + ``Sequence`` fields must match its length. + + Attributes + ---------- + count : int or Sequence[int], optional + Requested SM count per group. ``None`` means discovery mode + (auto-detect). (Default to ``None``) + coscheduled_sm_count : int or Sequence[int], optional + Minimum number of SMs guaranteed to be co-scheduled in each + group. (Default to ``None``) + preferred_coscheduled_sm_count : int or Sequence[int], optional + Preferred co-scheduled SM count; the driver tries to satisfy + this but may fall back to ``coscheduled_sm_count``. + (Default to ``None``) + backfill : bool or Sequence[bool], optional + If ``True``, allow the driver to relax the co-scheduling + constraint when assigning SMs. This enables requesting + arbitrary aligned SM counts that the driver would otherwise + reject due to hardware topology constraints. + (Default to ``False``) + """ + count: int | SequenceABC[int] | None = None + coscheduled_sm_count: int | SequenceABC[int] | None = None + preferred_coscheduled_sm_count: int | SequenceABC[int] | None = None + backfill: bool | SequenceABC[bool] = False + +@dataclass +class WorkqueueResourceOptions: + """Customizable :obj:`WorkqueueResource.configure` options. + + Attributes + ---------- + sharing_scope : :class:`~cuda.core.typing.WorkqueueSharingScopeType` | str, optional + Workqueue sharing scope. Accepted values: ``"device_ctx"`` or + ``"green_ctx_balanced"``. + concurrency_limit : int, optional + Expected maximum number of concurrent stream-ordered + workloads. Must be ``>= 1`` when set. The effective + driver-side cap is ``CUDA_DEVICE_MAX_CONNECTIONS`` + (typically ``[1, 32]``); configurations may exceed + this cap, but the driver will not guarantee that work + submission remains non-overlapping. (Default to ``None``) + """ + sharing_scope: WorkqueueSharingScopeType | str | None = None + concurrency_limit: int | None = None + + def __post_init__(self): + ... + +class SMResource: + """Represent an SM (streaming multiprocessor) resource partition. + + Instances are returned by :obj:`DeviceResources.sm` or + :meth:`SMResource.split` and cannot be instantiated directly. + """ + + def __init__(self, *args, **kwargs): + ... + + @property + def handle(self) -> int: + """Return the address of the underlying ``CUdevResource`` struct.""" + + @property + def sm_count(self) -> int: + """Total SMs available in this resource.""" + + @property + def min_partition_size(self) -> int: + """Minimum SM count required to create a partition.""" + + @property + def coscheduled_alignment(self) -> int: + """Number of SMs guaranteed to be co-scheduled.""" + + @property + def flags(self) -> int: + """Raw flags from the underlying SM resource.""" + + def split(self, options: SMResourceOptions, *, dry_run: bool=False) -> tuple[list[SMResource], SMResource]: + """Split this SM resource into groups and a remainder. + + Parameters + ---------- + options : :obj:`SMResourceOptions` + Split configuration (count, co-scheduling constraints). + dry_run : bool, optional + If ``True``, return filled-in metadata without creating + usable resource objects. (Default to ``False``) + + Returns + ------- + tuple[list[:obj:`SMResource`], :obj:`SMResource`] + ``(groups, remainder)`` where each group holds a disjoint + SM partition and *remainder* holds any unassigned SMs. + """ + +class WorkqueueResource: + """Represent a workqueue resource for a device or green context. + + Merges ``CU_DEV_RESOURCE_TYPE_WORKQUEUE_CONFIG`` and + ``CU_DEV_RESOURCE_TYPE_WORKQUEUE`` under one user-facing type. + Instances are returned by :obj:`DeviceResources.workqueue` and + cannot be instantiated directly. + """ + + def __init__(self, *args, **kwargs) -> None: + ... + + @property + def handle(self) -> int: + """Return the address of the underlying config ``CUdevResource`` struct.""" + + @property + def sharing_scope(self) -> WorkqueueSharingScopeType: + """Current sharing scope of this workqueue resource. + + Returns the :class:`~cuda.core.typing.WorkqueueSharingScopeType` + member corresponding to the driver-populated + ``wqConfig.sharingScope`` field. It can be updated via + :meth:`configure` with + :attr:`WorkqueueResourceOptions.sharing_scope`. + """ + + @property + def concurrency_limit(self) -> int: + """Current expected maximum concurrent stream-ordered workloads. + + Reflects the driver-populated ``wqConfig.wqConcurrencyLimit`` field. + When first queried from a device, this matches the driver-reported + cap (typically ``CUDA_DEVICE_MAX_CONNECTIONS``). It can be updated + via :meth:`configure` with + :attr:`WorkqueueResourceOptions.concurrency_limit`. + """ + + @property + def device(self) -> Device: + """The :class:`~cuda.core.Device` this workqueue resource is available on.""" + + def configure(self, options: WorkqueueResourceOptions) -> None: + """Configure the workqueue resource in place. + + Parameters + ---------- + options : :obj:`WorkqueueResourceOptions` + Configuration options (sharing scope, concurrency limit). + """ + +class DeviceResources: + """Namespace for hardware resource queries. + + When obtained via :obj:`Device.resources`, queries return full device + resources. When obtained via :obj:`Context.resources` or + :obj:`Stream.resources`, queries return the resources provisioned for + that context. + + This class cannot be instantiated directly. + """ + + def __init__(self, *args, **kwargs) -> None: + ... + + @property + def sm(self) -> SMResource: + """Return the :obj:`SMResource` for this device or context.""" + + @property + def workqueue(self) -> WorkqueueResource: + """Return the :obj:`WorkqueueResource` for this device or context.""" +__all__ = ['DeviceResources', 'SMResource', 'SMResourceOptions', 'WorkqueueResource', 'WorkqueueResourceOptions'] \ No newline at end of file diff --git a/cuda_core/cuda/core/_device_resources.pyx b/cuda_core/cuda/core/_device_resources.pyx new file mode 100644 index 00000000000..26c8863e063 --- /dev/null +++ b/cuda_core/cuda/core/_device_resources.pyx @@ -0,0 +1,763 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from __future__ import annotations + +from collections.abc import Sequence as SequenceABC +from dataclasses import dataclass +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from cuda.core._device import Device + from cuda.core.typing import WorkqueueSharingScopeType + +from libc.stdint cimport intptr_t +from libc.stdlib cimport free, malloc +from libc.string cimport memset + +from cuda.bindings cimport cydriver +from cuda.core._resource_handles cimport ContextHandle, GreenCtxHandle, as_cu, get_context_green_ctx +from cuda.core._utils.cuda_utils cimport check_or_create_options, HANDLE_RETURN +from cuda.core._utils.cuda_utils import is_sequence +from cuda.core._utils.version cimport cy_binding_version, cy_driver_version +from cuda.core._utils.validators import check_str_enum + + +__all__ = [ + "DeviceResources", + "SMResource", + "SMResourceOptions", + "WorkqueueResource", + "WorkqueueResourceOptions", +] + + +# Module-level cached version checks (trinary: 0=unchecked, 1=supported, -1=unsupported) +cdef int _green_ctx_checked = 0 +cdef int _workqueue_checked = 0 +cdef str _green_ctx_err_msg = "" +cdef str _workqueue_err_msg = "" + + +cdef inline int _check_green_ctx_support() except?-1: + global _green_ctx_checked, _green_ctx_err_msg + if _green_ctx_checked == 1: + return 0 + if _green_ctx_checked == -1: + raise RuntimeError(_green_ctx_err_msg) + cdef tuple drv = cy_driver_version() + cdef tuple bind = cy_binding_version() + if drv < (12, 4, 0): + _green_ctx_err_msg = ( + "Green context support requires CUDA driver 12.4 or newer " + f"(current driver: {'.'.join(map(str, drv))})" + ) + _green_ctx_checked = -1 + raise RuntimeError(_green_ctx_err_msg) + if bind < (12, 4, 0): + _green_ctx_err_msg = ( + "Green context support requires cuda.bindings 12.4 or newer " + f"(current bindings: {'.'.join(map(str, bind))})" + ) + _green_ctx_checked = -1 + raise RuntimeError(_green_ctx_err_msg) + _green_ctx_checked = 1 + return 0 + + +cdef inline int _check_workqueue_support() except?-1: + global _workqueue_checked, _workqueue_err_msg + if _workqueue_checked == 1: + return 0 + if _workqueue_checked == -1: + raise RuntimeError(_workqueue_err_msg) + cdef tuple drv = cy_driver_version() + cdef tuple bind = cy_binding_version() + if drv < (13, 1, 0): + _workqueue_err_msg = ( + "WorkqueueResource requires CUDA driver 13.1 or newer " + f"(current driver: {'.'.join(map(str, drv))})" + ) + _workqueue_checked = -1 + raise RuntimeError(_workqueue_err_msg) + if bind < (13, 1, 0): + _workqueue_err_msg = ( + "WorkqueueResource requires cuda.bindings 13.1 or newer " + f"(current bindings: {'.'.join(map(str, bind))})" + ) + _workqueue_checked = -1 + raise RuntimeError(_workqueue_err_msg) + _workqueue_checked = 1 + return 0 + + +@dataclass +cdef class SMResourceOptions: + """Customizable :obj:`SMResource.split` options. + + Each field accepts a scalar (for a single group) or a ``Sequence`` + (for multiple groups). ``count`` drives the number of groups; other + ``Sequence`` fields must match its length. + + Attributes + ---------- + count : int or Sequence[int], optional + Requested SM count per group. ``None`` means discovery mode + (auto-detect). (Default to ``None``) + coscheduled_sm_count : int or Sequence[int], optional + Minimum number of SMs guaranteed to be co-scheduled in each + group. (Default to ``None``) + preferred_coscheduled_sm_count : int or Sequence[int], optional + Preferred co-scheduled SM count; the driver tries to satisfy + this but may fall back to ``coscheduled_sm_count``. + (Default to ``None``) + backfill : bool or Sequence[bool], optional + If ``True``, allow the driver to relax the co-scheduling + constraint when assigning SMs. This enables requesting + arbitrary aligned SM counts that the driver would otherwise + reject due to hardware topology constraints. + (Default to ``False``) + """ + + count: int | SequenceABC[int] | None = None + coscheduled_sm_count: int | SequenceABC[int] | None = None + preferred_coscheduled_sm_count: int | SequenceABC[int] | None = None + backfill: bool | SequenceABC[bool] = False + + +@dataclass +cdef class WorkqueueResourceOptions: + """Customizable :obj:`WorkqueueResource.configure` options. + + Attributes + ---------- + sharing_scope : :class:`~cuda.core.typing.WorkqueueSharingScopeType` | str, optional + Workqueue sharing scope. Accepted values: ``"device_ctx"`` or + ``"green_ctx_balanced"``. + concurrency_limit : int, optional + Expected maximum number of concurrent stream-ordered + workloads. Must be ``>= 1`` when set. The effective + driver-side cap is ``CUDA_DEVICE_MAX_CONNECTIONS`` + (typically ``[1, 32]``); configurations may exceed + this cap, but the driver will not guarantee that work + submission remains non-overlapping. (Default to ``None``) + """ + + sharing_scope: WorkqueueSharingScopeType | str | None = None + concurrency_limit: int | None = None + + def __post_init__(self): + from cuda.core.typing import WorkqueueSharingScopeType + check_str_enum(self.sharing_scope, WorkqueueSharingScopeType, allow_none=True) + if self.concurrency_limit is not None and self.concurrency_limit < 1: + raise ValueError( + f"concurrency_limit must be >= 1, got {self.concurrency_limit}" + ) + + +cdef inline int _validate_split_field_length( + object value, str field_name, int n_groups, bint count_is_scalar +) except?-1: + if count_is_scalar: + if is_sequence(value): + raise ValueError( + f"{field_name} is a Sequence but count is scalar; " + "count must be a Sequence to specify multiple groups" + ) + elif is_sequence(value) and len(value) != n_groups: + raise ValueError( + f"{field_name} has length {len(value)}, expected {n_groups} " + "(must match count)" + ) + return 0 + + +cdef inline int _resolve_group_count(SMResourceOptions options) except?-1: + cdef object count = options.count + cdef int n_groups + cdef bint count_is_scalar + + if count is None or isinstance(count, int): + n_groups = 1 + count_is_scalar = True + elif is_sequence(count): + n_groups = len(count) + if n_groups == 0: + raise ValueError("count sequence must not be empty") + count_is_scalar = False + else: + raise TypeError(f"count must be int, Sequence, or None, got {type(count)}") + + _validate_split_field_length( + options.coscheduled_sm_count, + "coscheduled_sm_count", + n_groups, + count_is_scalar, + ) + _validate_split_field_length( + options.preferred_coscheduled_sm_count, + "preferred_coscheduled_sm_count", + n_groups, + count_is_scalar, + ) + _validate_split_field_length( + options.backfill, + "backfill", + n_groups, + count_is_scalar, + ) + return n_groups + + +cdef inline object _broadcast_field(object value, int n_groups): + if is_sequence(value): + return list(value) + return [value] * n_groups + + +cdef inline unsigned int _to_sm_count(object value) except? 0: + """Convert a count value to unsigned int. None maps to 0 (discovery).""" + if value is None: + return 0 + if value < 0: + raise ValueError(f"count must be non-negative, got {value}") + return (value) + + +IF CUDA_CORE_BUILD_MAJOR >= 13: + from cuda.core._resource_handles cimport sm_resource_split, has_sm_resource_split + +cdef int _structured_split_checked = 0 + +cdef inline bint _can_use_structured_sm_split(): + """Check if cuDevSmResourceSplit (13.1+) is available. Cached.""" + global _structured_split_checked + if _structured_split_checked != 0: + return _structured_split_checked == 1 + IF CUDA_CORE_BUILD_MAJOR >= 13: + if (has_sm_resource_split() + and cy_driver_version() >= (13, 1, 0) + and cy_binding_version() >= (13, 1, 0)): + _structured_split_checked = 1 + return True + _structured_split_checked = -1 + return False + + +cdef object _resolve_split_by_count_request(SMResourceOptions options): + cdef int n_groups = _resolve_group_count(options) + cdef list counts = _broadcast_field(options.count, n_groups) + cdef object first = counts[0] + cdef object value + cdef unsigned int min_count + + if options.coscheduled_sm_count is not None: + raise RuntimeError( + "SMResourceOptions.coscheduled_sm_count requires the CUDA 13.1 " + "structured SM split API" + ) + if options.preferred_coscheduled_sm_count is not None: + raise RuntimeError( + "SMResourceOptions.preferred_coscheduled_sm_count requires the " + "CUDA 13.1 structured SM split API" + ) + + for value in counts[1:]: + if value != first: + raise RuntimeError( + "CUDA 12 SM splitting only supports homogeneous count values; " + "use CUDA 13.1 or newer for per-group counts" + ) + + min_count = _to_sm_count(first) + return n_groups, min_count + + +IF CUDA_CORE_BUILD_MAJOR >= 13: + cdef inline int _fill_group_params( + cydriver.CU_DEV_SM_RESOURCE_GROUP_PARAMS* params, + int n_groups, + SMResourceOptions options, + ) except?-1: + cdef list counts = _broadcast_field(options.count, n_groups) + cdef list coscheduled = _broadcast_field(options.coscheduled_sm_count, n_groups) + cdef list preferred = _broadcast_field(options.preferred_coscheduled_sm_count, n_groups) + cdef list backfills = _broadcast_field(options.backfill, n_groups) + cdef int i + + for i in range(n_groups): + memset(¶ms[i], 0, sizeof(cydriver.CU_DEV_SM_RESOURCE_GROUP_PARAMS)) + params[i].smCount = _to_sm_count(counts[i]) + if coscheduled[i] is not None: + params[i].coscheduledSmCount = (coscheduled[i]) + if preferred[i] is not None: + params[i].preferredCoscheduledSmCount = (preferred[i]) + params[i].flags = ( + cydriver.CUdevSmResourceGroup_flags.CU_DEV_SM_RESOURCE_GROUP_BACKFILL + if backfills[i] else 0 + ) + return 0 + + + cdef object _split_with_general_api(SMResource sm, SMResourceOptions options, bint dry_run): + cdef int n_groups = _resolve_group_count(options) + cdef cydriver.CUdevResource* result = NULL + cdef cydriver.CUdevResource remaining + cdef cydriver.CUdevResource synth + cdef cydriver.CU_DEV_SM_RESOURCE_GROUP_PARAMS* params = NULL + cdef list groups = [] + cdef int i + + params = malloc( + n_groups * sizeof(cydriver.CU_DEV_SM_RESOURCE_GROUP_PARAMS) + ) + if params == NULL: + raise MemoryError() + + try: + _fill_group_params(params, n_groups, options) + + if not dry_run: + result = malloc( + n_groups * sizeof(cydriver.CUdevResource) + ) + if result == NULL: + raise MemoryError() + + memset(&remaining, 0, sizeof(cydriver.CUdevResource)) + with nogil: + HANDLE_RETURN(sm_resource_split( + result, + (n_groups), + &sm._resource, + &remaining, + 0, + params, + )) + + if result != NULL: + for i in range(n_groups): + groups.append(SMResource._from_split_resource(result[i], sm, True)) + return groups, SMResource._from_split_resource(remaining, sm, True) + + for i in range(n_groups): + memset(&synth, 0, sizeof(cydriver.CUdevResource)) + synth.type = cydriver.CUdevResourceType.CU_DEV_RESOURCE_TYPE_SM + synth.sm.smCount = params[i].smCount + groups.append(SMResource._from_split_resource(synth, sm, False)) + return groups, SMResource._from_split_resource(remaining, sm, False) + finally: + if params != NULL: + free(params) + if result != NULL: + free(result) +ELSE: + cdef object _split_with_general_api(SMResource sm, SMResourceOptions options, bint dry_run): + raise RuntimeError( + "SMResource.split() requires cuda.core to be built with CUDA 13.x bindings" + ) + + +cdef object _split_with_count_api(SMResource sm, SMResourceOptions options, bint dry_run): + cdef object request = _resolve_split_by_count_request(options) + cdef unsigned int nb_groups = (request[0]) + cdef unsigned int min_count = (request[1]) + cdef unsigned int actual_groups = nb_groups + cdef cydriver.CUdevResource* result = NULL + cdef cydriver.CUdevResource remaining + cdef list groups = [] + cdef int i + + result = malloc(nb_groups * sizeof(cydriver.CUdevResource)) + if result == NULL: + raise MemoryError() + + try: + memset(&remaining, 0, sizeof(cydriver.CUdevResource)) + with nogil: + HANDLE_RETURN(cydriver.cuDevSmResourceSplitByCount( + result, + &actual_groups, + &sm._resource, + &remaining, + 0, + min_count, + )) + + for i in range(actual_groups): + if dry_run: + groups.append(SMResource._from_split_resource(result[i], sm, False)) + else: + groups.append(SMResource._from_split_resource(result[i], sm, True)) + if dry_run: + return groups, SMResource._from_split_resource(remaining, sm, False) + return groups, SMResource._from_split_resource(remaining, sm, True) + finally: + free(result) + + +cdef inline unsigned int _sm_resource_granularity(int device_id) except? 0: + cdef int major + + with nogil: + HANDLE_RETURN(cydriver.cuDeviceGetAttribute( + &major, + cydriver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR, + (device_id), + )) + if major >= 9: + return 8 + return 2 + + +cdef inline unsigned int _fallback_if_zero(unsigned int value, unsigned int fallback) noexcept: + if value != 0: + return value + return fallback + + +cdef class SMResource: + """Represent an SM (streaming multiprocessor) resource partition. + + Instances are returned by :obj:`DeviceResources.sm` or + :meth:`SMResource.split` and cannot be instantiated directly. + """ + + def __init__(self, *args, **kwargs): + raise RuntimeError( + "SMResource cannot be instantiated directly. " + "Use dev.resources.sm or SMResource.split()." + ) + + @staticmethod + cdef SMResource _from_dev_resource(cydriver.CUdevResource res, int device_id): + cdef SMResource self = SMResource.__new__(SMResource) + self._resource = res + self._sm_count = res.sm.smCount + IF CUDA_CORE_BUILD_MAJOR >= 13: + self._min_partition_size = res.sm.minSmPartitionSize + self._coscheduled_alignment = res.sm.smCoscheduledAlignment + self._flags = res.sm.flags + ELSE: + self._min_partition_size = _sm_resource_granularity(device_id) + self._coscheduled_alignment = self._min_partition_size + self._flags = 0 + self._is_usable = True + return self + + @staticmethod + cdef SMResource _from_split_resource(cydriver.CUdevResource res, SMResource parent, bint is_usable): + cdef SMResource self = SMResource.__new__(SMResource) + self._resource = res + self._sm_count = res.sm.smCount + IF CUDA_CORE_BUILD_MAJOR >= 13: + self._min_partition_size = _fallback_if_zero( + res.sm.minSmPartitionSize, + parent._min_partition_size, + ) + self._coscheduled_alignment = _fallback_if_zero( + res.sm.smCoscheduledAlignment, + parent._coscheduled_alignment, + ) + self._flags = res.sm.flags + ELSE: + self._min_partition_size = parent._min_partition_size + self._coscheduled_alignment = parent._coscheduled_alignment + self._flags = parent._flags + self._is_usable = is_usable + return self + + @property + def handle(self) -> int: + """Return the address of the underlying ``CUdevResource`` struct.""" + return (&self._resource) + + @property + def sm_count(self) -> int: + """Total SMs available in this resource.""" + return self._sm_count + + @property + def min_partition_size(self) -> int: + """Minimum SM count required to create a partition.""" + return self._min_partition_size + + @property + def coscheduled_alignment(self) -> int: + """Number of SMs guaranteed to be co-scheduled.""" + return self._coscheduled_alignment + + @property + def flags(self) -> int: + """Raw flags from the underlying SM resource.""" + return self._flags + + def split( + self, + options: SMResourceOptions, + *, + bint dry_run=False + ) -> tuple[list[SMResource], SMResource]: + """Split this SM resource into groups and a remainder. + + Parameters + ---------- + options : :obj:`SMResourceOptions` + Split configuration (count, co-scheduling constraints). + dry_run : bool, optional + If ``True``, return filled-in metadata without creating + usable resource objects. (Default to ``False``) + + Returns + ------- + tuple[list[:obj:`SMResource`], :obj:`SMResource`] + ``(groups, remainder)`` where each group holds a disjoint + SM partition and *remainder* holds any unassigned SMs. + """ + cdef SMResourceOptions opts = check_or_create_options( + SMResourceOptions, options, "SM resource options" + ) + _resolve_group_count(opts) + _check_green_ctx_support() + with self._split_mutex: + if _can_use_structured_sm_split(): + return _split_with_general_api(self, opts, dry_run) + # SplitByCount requires the same 12.4+ as green ctx support (already checked above) + return _split_with_count_api(self, opts, dry_run) + + +cdef class WorkqueueResource: + """Represent a workqueue resource for a device or green context. + + Merges ``CU_DEV_RESOURCE_TYPE_WORKQUEUE_CONFIG`` and + ``CU_DEV_RESOURCE_TYPE_WORKQUEUE`` under one user-facing type. + Instances are returned by :obj:`DeviceResources.workqueue` and + cannot be instantiated directly. + """ + + def __init__(self, *args, **kwargs) -> None: + raise RuntimeError( + "WorkqueueResource cannot be instantiated directly. " + "Use dev.resources.workqueue." + ) + + @staticmethod + cdef WorkqueueResource _from_dev_resources( + cydriver.CUdevResource wq_config, + cydriver.CUdevResource wq, + ): + cdef WorkqueueResource self = WorkqueueResource.__new__(WorkqueueResource) + self._wq_config_resource = wq_config + self._wq_resource = wq + return self + + @property + def handle(self) -> int: + """Return the address of the underlying config ``CUdevResource`` struct.""" + return (&self._wq_config_resource) + + @property + def sharing_scope(self) -> WorkqueueSharingScopeType: + """Current sharing scope of this workqueue resource. + + Returns the :class:`~cuda.core.typing.WorkqueueSharingScopeType` + member corresponding to the driver-populated + ``wqConfig.sharingScope`` field. It can be updated via + :meth:`configure` with + :attr:`WorkqueueResourceOptions.sharing_scope`. + """ + IF CUDA_CORE_BUILD_MAJOR >= 13: + from cuda.core.typing import WorkqueueSharingScopeType + cdef object scope = self._wq_config_resource.wqConfig.sharingScope + if scope == cydriver.CUdevWorkqueueConfigScope.CU_WORKQUEUE_SCOPE_DEVICE_CTX: + return WorkqueueSharingScopeType.DEVICE_CTX + elif scope == cydriver.CUdevWorkqueueConfigScope.CU_WORKQUEUE_SCOPE_GREEN_CTX_BALANCED: + return WorkqueueSharingScopeType.GREEN_CTX_BALANCED + raise RuntimeError(f"Unknown sharing scope enum value: {scope}") + ELSE: + raise RuntimeError( + "WorkqueueResource requires cuda.core to be built with CUDA 13.x bindings" + ) + + @property + def concurrency_limit(self) -> int: + """Current expected maximum concurrent stream-ordered workloads. + + Reflects the driver-populated ``wqConfig.wqConcurrencyLimit`` field. + When first queried from a device, this matches the driver-reported + cap (typically ``CUDA_DEVICE_MAX_CONNECTIONS``). It can be updated + via :meth:`configure` with + :attr:`WorkqueueResourceOptions.concurrency_limit`. + """ + IF CUDA_CORE_BUILD_MAJOR >= 13: + return self._wq_config_resource.wqConfig.wqConcurrencyLimit + ELSE: + raise RuntimeError( + "WorkqueueResource requires cuda.core to be built with CUDA 13.x bindings" + ) + + @property + def device(self) -> Device: + """The :class:`~cuda.core.Device` this workqueue resource is available on.""" + IF CUDA_CORE_BUILD_MAJOR >= 13: + from cuda.core._device import Device # avoid circular import + return Device(int(self._wq_config_resource.wqConfig.device)) + ELSE: + raise RuntimeError( + "WorkqueueResource requires cuda.core to be built with CUDA 13.x bindings" + ) + + def configure(self, options: WorkqueueResourceOptions) -> None: + """Configure the workqueue resource in place. + + Parameters + ---------- + options : :obj:`WorkqueueResourceOptions` + Configuration options (sharing scope, concurrency limit). + """ + cdef WorkqueueResourceOptions opts = check_or_create_options( + WorkqueueResourceOptions, options, "Workqueue resource options" + ) + _check_green_ctx_support() + _check_workqueue_support() + if opts.sharing_scope is None and opts.concurrency_limit is None: + return None + + IF CUDA_CORE_BUILD_MAJOR >= 13: + if opts.concurrency_limit is not None: + self._wq_config_resource.wqConfig.wqConcurrencyLimit = ( + opts.concurrency_limit + ) + if opts.sharing_scope == "device_ctx": + self._wq_config_resource.wqConfig.sharingScope = ( + cydriver.CUdevWorkqueueConfigScope.CU_WORKQUEUE_SCOPE_DEVICE_CTX + ) + elif opts.sharing_scope == "green_ctx_balanced": + self._wq_config_resource.wqConfig.sharingScope = ( + cydriver.CUdevWorkqueueConfigScope.CU_WORKQUEUE_SCOPE_GREEN_CTX_BALANCED + ) + ELSE: + raise RuntimeError( + "WorkqueueResource requires cuda.core to be built with CUDA 13.x bindings" + ) + + +cdef class DeviceResources: + """Namespace for hardware resource queries. + + When obtained via :obj:`Device.resources`, queries return full device + resources. When obtained via :obj:`Context.resources` or + :obj:`Stream.resources`, queries return the resources provisioned for + that context. + + This class cannot be instantiated directly. + """ + + def __init__(self, *args, **kwargs) -> None: + raise RuntimeError( + "DeviceResources cannot be instantiated directly. " + "Use dev.resources or ctx.resources." + ) + + @staticmethod + cdef DeviceResources _init(int device_id): + cdef DeviceResources self = DeviceResources.__new__(DeviceResources) + self._device_id = device_id + # _h_context is default empty — queries use cuDeviceGetDevResource + return self + + @staticmethod + cdef DeviceResources _init_from_ctx(ContextHandle h_context, int device_id): + cdef DeviceResources self = DeviceResources.__new__(DeviceResources) + self._device_id = device_id + self._h_context = h_context + return self + + cdef inline int _query_sm(self, cydriver.CUdevResource* res) except?-1 nogil: + """Query SM resource from either device or context.""" + cdef GreenCtxHandle h_green + if self._h_context: + h_green = get_context_green_ctx(self._h_context) + if h_green: + HANDLE_RETURN(cydriver.cuGreenCtxGetDevResource( + as_cu(h_green), res, + cydriver.CUdevResourceType.CU_DEV_RESOURCE_TYPE_SM, + )) + else: + HANDLE_RETURN(cydriver.cuCtxGetDevResource( + as_cu(self._h_context), res, + cydriver.CUdevResourceType.CU_DEV_RESOURCE_TYPE_SM, + )) + else: + HANDLE_RETURN(cydriver.cuDeviceGetDevResource( + (self._device_id), res, + cydriver.CUdevResourceType.CU_DEV_RESOURCE_TYPE_SM, + )) + return 0 + + @property + def sm(self) -> SMResource: + """Return the :obj:`SMResource` for this device or context.""" + _check_green_ctx_support() + cdef cydriver.CUdevResource res + with nogil: + self._query_sm(&res) + return SMResource._from_dev_resource(res, self._device_id) + + @property + def workqueue(self) -> WorkqueueResource: + """Return the :obj:`WorkqueueResource` for this device or context.""" + _check_green_ctx_support() + _check_workqueue_support() + cdef cydriver.CUdevResource _wq_config + cdef cydriver.CUdevResource _wq + + IF CUDA_CORE_BUILD_MAJOR >= 13: + cdef GreenCtxHandle h_green + if self._h_context: + h_green = get_context_green_ctx(self._h_context) + if h_green: + # Green context query + with nogil: + HANDLE_RETURN(cydriver.cuGreenCtxGetDevResource( + as_cu(h_green), + &_wq_config, + cydriver.CUdevResourceType.CU_DEV_RESOURCE_TYPE_WORKQUEUE_CONFIG, + )) + HANDLE_RETURN(cydriver.cuGreenCtxGetDevResource( + as_cu(h_green), + &_wq, + cydriver.CUdevResourceType.CU_DEV_RESOURCE_TYPE_WORKQUEUE, + )) + else: + # Primary context query + with nogil: + HANDLE_RETURN(cydriver.cuCtxGetDevResource( + as_cu(self._h_context), + &_wq_config, + cydriver.CUdevResourceType.CU_DEV_RESOURCE_TYPE_WORKQUEUE_CONFIG, + )) + HANDLE_RETURN(cydriver.cuCtxGetDevResource( + as_cu(self._h_context), + &_wq, + cydriver.CUdevResourceType.CU_DEV_RESOURCE_TYPE_WORKQUEUE, + )) + else: + # Device-level query + with nogil: + HANDLE_RETURN(cydriver.cuDeviceGetDevResource( + (self._device_id), + &_wq_config, + cydriver.CUdevResourceType.CU_DEV_RESOURCE_TYPE_WORKQUEUE_CONFIG, + )) + HANDLE_RETURN(cydriver.cuDeviceGetDevResource( + (self._device_id), + &_wq, + cydriver.CUdevResourceType.CU_DEV_RESOURCE_TYPE_WORKQUEUE, + )) + return WorkqueueResource._from_dev_resources(_wq_config, _wq) + ELSE: + raise RuntimeError( + "WorkqueueResource requires cuda.core to be built with CUDA 13.x bindings" + ) diff --git a/cuda_core/cuda/core/_dlpack.pxd b/cuda_core/cuda/core/_dlpack.pxd new file mode 100644 index 00000000000..328d98a4c2e --- /dev/null +++ b/cuda_core/cuda/core/_dlpack.pxd @@ -0,0 +1,124 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +cimport cpython + +from libc cimport stdlib +from libc.stdint cimport uint8_t +from libc.stdint cimport uint16_t +from libc.stdint cimport uint32_t +from libc.stdint cimport int32_t +from libc.stdint cimport int64_t +from libc.stdint cimport uint64_t +from libc.stdint cimport intptr_t + + +cdef extern from "_include/dlpack.h" nogil: + """ + #define DLPACK_TENSOR_UNUSED_NAME "dltensor" + #define DLPACK_VERSIONED_TENSOR_UNUSED_NAME "dltensor_versioned" + #define DLPACK_TENSOR_USED_NAME "used_dltensor" + #define DLPACK_VERSIONED_TENSOR_USED_NAME "used_dltensor_versioned" + """ + ctypedef enum _DLDeviceType "DLDeviceType": + _kDLCPU "kDLCPU" + _kDLCUDA "kDLCUDA" + _kDLCUDAHost "kDLCUDAHost" + _kDLCUDAManaged "kDLCUDAManaged" + _kDLTrn "kDLTrn" + + ctypedef struct DLDevice: + _DLDeviceType device_type + int32_t device_id + + cdef enum DLDataTypeCode: + kDLInt + kDLUInt + kDLFloat + kDLBfloat + kDLComplex + kDLBool + + ctypedef struct DLDataType: + uint8_t code + uint8_t bits + uint16_t lanes + + ctypedef struct DLTensor: + void* data + DLDevice device + int32_t ndim + DLDataType dtype + int64_t* shape + int64_t* strides + uint64_t byte_offset + + ctypedef struct DLManagedTensor: + DLTensor dl_tensor + void* manager_ctx + void (*deleter)(DLManagedTensor*) + + ctypedef struct DLPackVersion: + uint32_t major + uint32_t minor + + ctypedef struct DLManagedTensorVersioned: + DLPackVersion version + void* manager_ctx + void (*deleter)(DLManagedTensorVersioned*) + uint64_t flags + DLTensor dl_tensor + + int DLPACK_MAJOR_VERSION + int DLPACK_MINOR_VERSION + int DLPACK_FLAG_BITMASK_READ_ONLY + int DLPACK_FLAG_BITMASK_IS_COPIED + int DLPACK_FLAG_BITMASK_IS_SUBBYTE_TYPE_PADDED + + const char* DLPACK_TENSOR_UNUSED_NAME + const char* DLPACK_VERSIONED_TENSOR_UNUSED_NAME + const char* DLPACK_TENSOR_USED_NAME + const char* DLPACK_VERSIONED_TENSOR_USED_NAME + + +cdef extern from "_include/dlpack.h": + ctypedef int (*DLPackManagedTensorAllocator)( + DLTensor* prototype, + DLManagedTensorVersioned** out, + void* error_ctx, + void (*SetError)(void* error_ctx, const char* kind, const char* message) noexcept + ) + + ctypedef int (*DLPackManagedTensorFromPyObjectNoSync)( + void* py_object, + DLManagedTensorVersioned** out + ) + + ctypedef int (*DLPackManagedTensorToPyObjectNoSync)( + DLManagedTensorVersioned* tensor, + void** out_py_object + ) + + ctypedef int (*DLPackDLTensorFromPyObjectNoSync)( + void* py_object, + DLTensor* out + ) + + ctypedef int (*DLPackCurrentWorkStream)( + _DLDeviceType device_type, + int32_t device_id, + void** out_current_stream + ) + + ctypedef struct DLPackExchangeAPIHeader: + DLPackVersion version + DLPackExchangeAPIHeader* prev_api + + ctypedef struct DLPackExchangeAPI: + DLPackExchangeAPIHeader header + DLPackManagedTensorAllocator managed_tensor_allocator + DLPackManagedTensorFromPyObjectNoSync managed_tensor_from_py_object_no_sync + DLPackManagedTensorToPyObjectNoSync managed_tensor_to_py_object_no_sync + DLPackDLTensorFromPyObjectNoSync dltensor_from_py_object_no_sync + DLPackCurrentWorkStream current_work_stream diff --git a/cuda_core/cuda/core/_dlpack.pyi b/cuda_core/cuda/core/_dlpack.pyi new file mode 100644 index 00000000000..575d9ced8f5 --- /dev/null +++ b/cuda_core/cuda/core/_dlpack.pyi @@ -0,0 +1,24 @@ +# This file was generated by stubgen-pyx v0.2.6 from cuda_core/cuda/core/_dlpack.pyx + +from __future__ import annotations + +from enum import IntEnum + +_DLDeviceType = int +DLDataTypeCode = int + +class DLDeviceType(IntEnum): + kDLCPU = 1 + kDLCUDA = 2 + kDLCUDAHost = 3 + kDLCUDAManaged = 13 + +def make_py_capsule(buf: object, versioned: bool) -> object: + ... + +def classify_dl_device(buf: object) -> tuple[int, int]: + """Classify a buffer into a DLPack (device_type, device_id) pair. + + ``buf`` must expose ``is_device_accessible``, ``is_host_accessible``, + ``is_managed``, and ``device_id`` attributes. + """ \ No newline at end of file diff --git a/cuda_core/cuda/core/_dlpack.pyx b/cuda_core/cuda/core/_dlpack.pyx new file mode 100644 index 00000000000..0c251881d11 --- /dev/null +++ b/cuda_core/cuda/core/_dlpack.pyx @@ -0,0 +1,176 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + + +from enum import IntEnum + + +cdef void pycapsule_deleter(object capsule) noexcept: + cdef DLManagedTensor* dlm_tensor + cdef DLManagedTensorVersioned* dlm_tensor_ver + # Do not invoke the deleter on a used capsule. + if cpython.PyCapsule_IsValid( + capsule, DLPACK_TENSOR_UNUSED_NAME): + dlm_tensor = ( + cpython.PyCapsule_GetPointer( + capsule, DLPACK_TENSOR_UNUSED_NAME)) + if dlm_tensor.deleter: + dlm_tensor.deleter(dlm_tensor) + elif cpython.PyCapsule_IsValid( + capsule, DLPACK_VERSIONED_TENSOR_UNUSED_NAME): + dlm_tensor_ver = ( + cpython.PyCapsule_GetPointer( + capsule, DLPACK_VERSIONED_TENSOR_UNUSED_NAME)) + if dlm_tensor_ver.deleter: + dlm_tensor_ver.deleter(dlm_tensor_ver) + + +cdef void deleter(DLManagedTensor* tensor) noexcept with gil: + if tensor: + if tensor.dl_tensor.shape: + stdlib.free(tensor.dl_tensor.shape) + if tensor.manager_ctx: + cpython.Py_DECREF(tensor.manager_ctx) + tensor.manager_ctx = NULL + stdlib.free(tensor) + + +cdef void versioned_deleter(DLManagedTensorVersioned* tensor) noexcept with gil: + if tensor: + if tensor.dl_tensor.shape: + stdlib.free(tensor.dl_tensor.shape) + if tensor.manager_ctx: + cpython.Py_DECREF(tensor.manager_ctx) + tensor.manager_ctx = NULL + stdlib.free(tensor) + + +cdef inline DLManagedTensorVersioned* allocate_dlm_tensor_versioned() except? NULL: + cdef DLManagedTensorVersioned* dlm_tensor_ver = NULL + try: + dlm_tensor_ver = ( + stdlib.malloc(sizeof(DLManagedTensorVersioned))) + dlm_tensor_ver.dl_tensor.shape = NULL + dlm_tensor_ver.manager_ctx = NULL + return dlm_tensor_ver + except: + if dlm_tensor_ver: + stdlib.free(dlm_tensor_ver) + raise + + +cdef inline DLManagedTensor* allocate_dlm_tensor() except? NULL: + cdef DLManagedTensor* dlm_tensor = NULL + try: + dlm_tensor = ( + stdlib.malloc(sizeof(DLManagedTensor))) + dlm_tensor.dl_tensor.shape = NULL + dlm_tensor.manager_ctx = NULL + return dlm_tensor + except: + if dlm_tensor: + stdlib.free(dlm_tensor) + raise + + +cdef inline int setup_dl_tensor_layout(DLTensor* dl_tensor, object buf) except -1: + dl_tensor.ndim = 1 + cdef int64_t* shape_strides = \ + stdlib.malloc(sizeof(int64_t) * 2) + if shape_strides == NULL: + raise MemoryError() + # DLPack v1.2+ requires non-NULL strides for ndim != 0. + shape_strides[0] = buf.size + shape_strides[1] = 1 + dl_tensor.shape = shape_strides + dl_tensor.strides = shape_strides + 1 + dl_tensor.byte_offset = 0 + return 0 + + +def classify_dl_device(buf: object) -> tuple[int, int]: + """Classify a buffer into a DLPack (device_type, device_id) pair. + + ``buf`` must expose ``is_device_accessible``, ``is_host_accessible``, + ``is_managed``, and ``device_id`` attributes. + """ + cdef bint d = buf.is_device_accessible + cdef bint h = buf.is_host_accessible + if d and not h: + return (_kDLCUDA, buf.device_id) + if d and h: + return (_kDLCUDAManaged if buf.is_managed else _kDLCUDAHost, 0) + if not d and h: + return (_kDLCPU, 0) + raise BufferError("buffer is neither device-accessible nor host-accessible") + + +cdef inline int setup_dl_tensor_device(DLTensor* dl_tensor, object buf) except -1: + cdef DLDevice* device = &dl_tensor.device + dev_type, dev_id = classify_dl_device(buf) + device.device_type = <_DLDeviceType>dev_type + device.device_id = dev_id + return 0 + + +cdef inline int setup_dl_tensor_dtype(DLTensor* dl_tensor) except -1 nogil: + cdef DLDataType* dtype = &dl_tensor.dtype + dtype.code = kDLInt + dtype.lanes = 1 + dtype.bits = 8 + return 0 + + +cpdef object make_py_capsule(object buf, bint versioned): + cdef DLManagedTensor* dlm_tensor = NULL + cdef DLManagedTensorVersioned* dlm_tensor_ver = NULL + cdef DLTensor* dl_tensor + cdef void* tensor_ptr + cdef const char* capsule_name + cdef object ret = None + + try: + if versioned: + dlm_tensor_ver = allocate_dlm_tensor_versioned() + # Transfer the reference to manager_ctx + cpython.Py_INCREF(buf) + dlm_tensor_ver.manager_ctx = buf + dlm_tensor_ver.deleter = versioned_deleter + dlm_tensor_ver.version.major = DLPACK_MAJOR_VERSION + dlm_tensor_ver.version.minor = DLPACK_MINOR_VERSION + dlm_tensor_ver.flags = 0 + dl_tensor = &dlm_tensor_ver.dl_tensor + tensor_ptr = dlm_tensor_ver + capsule_name = DLPACK_VERSIONED_TENSOR_UNUSED_NAME + else: + dlm_tensor = allocate_dlm_tensor() + # Transfer the reference to manager_ctx + cpython.Py_INCREF(buf) + dlm_tensor.manager_ctx = buf + dlm_tensor.deleter = deleter + dl_tensor = &dlm_tensor.dl_tensor + tensor_ptr = dlm_tensor + capsule_name = DLPACK_TENSOR_UNUSED_NAME + + dl_tensor.data = (int(buf.handle)) + setup_dl_tensor_layout(dl_tensor, buf) + setup_dl_tensor_device(dl_tensor, buf) + setup_dl_tensor_dtype(dl_tensor) + ret = cpython.PyCapsule_New(tensor_ptr, capsule_name, pycapsule_deleter) + except: + if ret is None: + deleter(dlm_tensor) + versioned_deleter(dlm_tensor_ver) + raise + return ret + + +# Values are fixed by the DLPack spec; see _include/dlpack.h. They are +# hard-coded here (rather than referencing the cdef extern names) so that the +# generated .pyi stub doesn't reference Cython-only identifiers. +class DLDeviceType(IntEnum): + kDLCPU = 1 + kDLCUDA = 2 + kDLCUDAHost = 3 + kDLCUDAManaged = 13 diff --git a/cuda_core/cuda/core/_event.pxd b/cuda_core/cuda/core/_event.pxd new file mode 100644 index 00000000000..5710b13699b --- /dev/null +++ b/cuda_core/cuda/core/_event.pxd @@ -0,0 +1,22 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from cuda.bindings cimport cydriver +from cuda.core._resource_handles cimport ContextHandle, EventHandle + + +cdef class Event: + + cdef: + EventHandle _h_event + object _ipc_descriptor + object __weakref__ + + @staticmethod + cdef Event _init(type cls, int device_id, ContextHandle h_context, options, bint is_free) + + @staticmethod + cdef Event _from_handle(EventHandle h_event) + + cpdef close(self) diff --git a/cuda_core/cuda/core/_event.pyi b/cuda_core/cuda/core/_event.pyi new file mode 100644 index 00000000000..1ea91308bc1 --- /dev/null +++ b/cuda_core/cuda/core/_event.pyi @@ -0,0 +1,185 @@ +# This file was generated by stubgen-pyx v0.2.6 from cuda_core/cuda/core/_event.pyx + +from __future__ import annotations + +from dataclasses import dataclass + +import cuda.bindings.driver +import cython +from cuda.core._context import Context +from cuda.core._device import Device + + +@dataclass +class EventOptions: + """Customizable :obj:`~_event.Event` options. + + Attributes + ---------- + timing_enabled : bool, optional + Event will record timing data. (Default to False) + blocking_sync : bool, optional + If True, the event uses blocking synchronization: a CPU + thread that calls :meth:`Event.sync` blocks (yields) until + the event has completed. Otherwise (the default), the CPU + thread busy-waits until the event has completed. + (Default to False) + ipc_enabled : bool, optional + Event will be suitable for interprocess use. + Note that timing_enabled must be False. (Default to False) + + """ + timing_enabled: bool | None = False + blocking_sync: bool | None = False + ipc_enabled: bool | None = False + +class Event: + """Represent a record at a specific point of execution within a CUDA stream. + + Applications can asynchronously record events at any point in + the program. An event keeps a record of all previous work within + the last recorded stream. + + Events can be used to monitor device's progress, query completion + of work up to event's record, help establish dependencies + between GPU work submissions, and record the elapsed time (in milliseconds) + on GPU: + + .. code-block:: python + + # To create events and record the timing: + s = Device().create_stream() + e1 = Device().create_event({"timing_enabled": True}) + e2 = Device().create_event({"timing_enabled": True}) + s.record(e1) + # ... run some GPU works ... + s.record(e2) + e2.sync() + print(f"time = {e2 - e1} milliseconds") + + Directly creating an :obj:`~_event.Event` is not supported due to ambiguity, + and they should instead be created through a :obj:`~_stream.Stream` object. + + """ + + def close(self): + """Destroy the event. + + Releases the event handle. The underlying CUDA event is destroyed + when the last reference is released. + """ + + def __init__(self, *args, **kwargs) -> None: + ... + + def __isub__(self, other: object): + ... + + def __rsub__(self, other: object): + ... + + def __sub__(self, other: Event) -> float: + ... + + def __hash__(self) -> int: + ... + + def __eq__(self, other: object) -> bool: + ... + + def __repr__(self) -> str: + ... + + @property + def ipc_descriptor(self) -> IPCEventDescriptor: + """Descriptor for sharing this event with other processes.""" + + @classmethod + def from_ipc_descriptor(cls, ipc_descriptor: IPCEventDescriptor) -> Event: + """Import an event that was exported from another process. + + Parameters + ---------- + ipc_descriptor : :obj:`~_memory._ipc.IPCEventDescriptor` + The IPC descriptor obtained from :attr:`~Event.ipc_descriptor` in + another process. + + Returns + ------- + :obj:`~_event.Event` + A new event backed by the imported IPC handle. + + """ + + @property + def is_ipc_enabled(self) -> bool: + """Return True if the event can be shared across process boundaries, otherwise False.""" + + @property + def is_timing_enabled(self) -> bool: + """Return True if the event records timing data, otherwise False.""" + + @property + def is_blocking_sync(self) -> bool: + """Return True if the event uses blocking synchronization (the CPU + thread blocks on :meth:`sync` instead of busy-waiting), otherwise False. + """ + + def sync(self) -> None: + """Synchronize until the event completes. + + If the event was created with ``blocking_sync=True``, the + calling CPU thread blocks (yields) until the event has been + completed by the device. Otherwise (the default) the CPU + thread busy-waits until the event has completed. + + """ + + @property + def is_done(self) -> bool: + """Return True if all captured works have been completed, otherwise False.""" + + @property + def handle(self) -> cuda.bindings.driver.CUevent: + """Return the underlying CUevent object. + + .. caution:: + + This handle is a Python object. To get the memory address of the underlying C + handle, call ``int(Event.handle)``. + """ + + @property + def device(self) -> Device: + """Return the :obj:`~_device.Device` singleton associated with this event. + + Note + ---- + The current context on the device may differ from this + event's context. This case occurs when a different CUDA + context is set current after a event is created. + + """ + + @property + def context(self) -> Context: + """Return the :obj:`~_context.Context` associated with this event.""" + +class IPCEventDescriptor: + """Serializable object describing an event that can be shared between processes.""" + + def __init__(self, *arg, **kwargs) -> None: + ... + + @staticmethod + def _init(reserved: bytes, is_blocking_sync: cython.bint) -> IPCEventDescriptor: + ... + + def __eq__(self, other: object) -> bool: + ... + + def __reduce__(self) -> tuple[object, ...]: + ... + +def _reduce_event(event: Event) -> tuple[object, ...]: + ... \ No newline at end of file diff --git a/cuda_core/cuda/core/_event.pyx b/cuda_core/cuda/core/_event.pyx new file mode 100644 index 00000000000..e5cb81ac41e --- /dev/null +++ b/cuda_core/cuda/core/_event.pyx @@ -0,0 +1,360 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from __future__ import annotations + +cimport cpython +from libc.stddef cimport size_t +from libc.string cimport memcpy +from cuda.bindings cimport cydriver +from cuda.core._context cimport Context +from cuda.core._resource_handles cimport ( + ContextHandle, + EventHandle, + create_event_handle, + create_event_handle_ipc, + get_event_timing_enabled, + get_event_is_blocking_sync, + get_event_ipc_enabled, + get_event_device_id, + get_event_context, + as_intptr, + as_cu, + as_py, +) + +from cuda.core._utils.cuda_utils cimport ( + check_or_create_options, + HANDLE_RETURN +) + +import cython +from dataclasses import dataclass +import multiprocessing +from typing import TYPE_CHECKING + +from cuda.core._utils.cuda_utils import ( + CUDAError, + check_multiprocessing_start_method, +) + +if TYPE_CHECKING: + import cuda.bindings.driver # no-cython-lint + from cuda.core._device import Device + + +@dataclass +cdef class EventOptions: + """Customizable :obj:`~_event.Event` options. + + Attributes + ---------- + timing_enabled : bool, optional + Event will record timing data. (Default to False) + blocking_sync : bool, optional + If True, the event uses blocking synchronization: a CPU + thread that calls :meth:`Event.sync` blocks (yields) until + the event has completed. Otherwise (the default), the CPU + thread busy-waits until the event has completed. + (Default to False) + ipc_enabled : bool, optional + Event will be suitable for interprocess use. + Note that timing_enabled must be False. (Default to False) + + """ + + timing_enabled: bool | None = False + blocking_sync: bool | None = False + ipc_enabled: bool | None = False + + +cdef class Event: + """Represent a record at a specific point of execution within a CUDA stream. + + Applications can asynchronously record events at any point in + the program. An event keeps a record of all previous work within + the last recorded stream. + + Events can be used to monitor device's progress, query completion + of work up to event's record, help establish dependencies + between GPU work submissions, and record the elapsed time (in milliseconds) + on GPU: + + .. code-block:: python + + # To create events and record the timing: + s = Device().create_stream() + e1 = Device().create_event({"timing_enabled": True}) + e2 = Device().create_event({"timing_enabled": True}) + s.record(e1) + # ... run some GPU works ... + s.record(e2) + e2.sync() + print(f"time = {e2 - e1} milliseconds") + + Directly creating an :obj:`~_event.Event` is not supported due to ambiguity, + and they should instead be created through a :obj:`~_stream.Stream` object. + + """ + + def __init__(self, *args, **kwargs) -> None: + raise RuntimeError("Event objects cannot be instantiated directly. Please use Stream APIs (record).") + + @staticmethod + cdef Event _init(type cls, int device_id, ContextHandle h_context, options, bint is_free): + cdef Event self = cls.__new__(cls) + cdef EventOptions opts = check_or_create_options(EventOptions, options, "Event options") + cdef unsigned int flags = 0x0 + cdef bint timing_enabled = True + cdef bint is_blocking_sync = False + cdef bint ipc_enabled = False + self._ipc_descriptor = None + if not opts.timing_enabled: + flags |= cydriver.CUevent_flags.CU_EVENT_DISABLE_TIMING + timing_enabled = False + if opts.blocking_sync: + flags |= cydriver.CUevent_flags.CU_EVENT_BLOCKING_SYNC + is_blocking_sync = True + if opts.ipc_enabled: + if is_free: + raise TypeError( + "IPC-enabled events must be bound; use Stream.record for creation." + ) + flags |= cydriver.CUevent_flags.CU_EVENT_INTERPROCESS + ipc_enabled = True + if timing_enabled: + raise TypeError("IPC-enabled events cannot use timing.") + cdef EventHandle h_event = create_event_handle( + h_context, flags, timing_enabled, is_blocking_sync, ipc_enabled, device_id) + if not h_event: + raise RuntimeError("Failed to create CUDA event") + self._h_event = h_event + if ipc_enabled: + _ = self.ipc_descriptor # eagerly populate the descriptor cache + return self + + @staticmethod + cdef Event _from_handle(EventHandle h_event): + """Create an Event wrapping an existing EventHandle. + + Metadata (timing, blocking_sync, ipc, device_id) is read from + the EventBox via pointer arithmetic — no fields are cached on + Event. + """ + cdef Event self = Event.__new__(Event) + self._h_event = h_event + self._ipc_descriptor = None + return self + + cpdef close(self): + """Destroy the event. + + Releases the event handle. The underlying CUDA event is destroyed + when the last reference is released. + """ + self._h_event.reset() + + def __isub__(self, other: object): + return NotImplemented + + def __rsub__(self, other: object): + return NotImplemented + + def __sub__(self, other: Event) -> float: + # return self - other (in milliseconds) + cdef float timing + with nogil: + err = cydriver.cuEventElapsedTime(&timing, as_cu((other)._h_event), as_cu(self._h_event)) + if err == 0: + return timing + else: + if err == cydriver.CUresult.CUDA_ERROR_INVALID_HANDLE: + if not self.is_timing_enabled or not other.is_timing_enabled: + explanation = ( + "Both Events must be created with timing enabled in order to subtract them; " + "use EventOptions(timing_enabled=True) when creating both events." + ) + else: + explanation = ( + "Both Events must be recorded before they can be subtracted; " + "use Stream.record() to record both events to a stream." + ) + elif err == cydriver.CUresult.CUDA_ERROR_NOT_READY: + explanation = ( + "One or both events have not completed; " + "use Event.sync(), Stream.sync(), or Device.sync() to wait for the events to complete " + "before subtracting them." + ) + else: + raise CUDAError(err) + raise RuntimeError(explanation) + + def __hash__(self) -> int: + return hash(as_intptr(self._h_event)) + + def __eq__(self, other: object) -> bool: + # Note: using isinstance because `Event` can be subclassed. + if not isinstance(other, Event): + return NotImplemented + cdef Event _other = other + return as_intptr(self._h_event) == as_intptr(_other._h_event) + + def __repr__(self) -> str: + return f"" + + @property + def ipc_descriptor(self) -> IPCEventDescriptor: + """Descriptor for sharing this event with other processes.""" + if self._ipc_descriptor is not None: + return self._ipc_descriptor + if not self.is_ipc_enabled: + raise RuntimeError("Event is not IPC-enabled") + cdef cydriver.CUipcEventHandle data + with nogil: + HANDLE_RETURN(cydriver.cuIpcGetEventHandle(&data, as_cu(self._h_event))) + cdef bytes data_b = cpython.PyBytes_FromStringAndSize((data.reserved), sizeof(data.reserved)) + self._ipc_descriptor = IPCEventDescriptor._init(data_b, get_event_is_blocking_sync(self._h_event)) + return self._ipc_descriptor + + @classmethod + def from_ipc_descriptor(cls, ipc_descriptor: IPCEventDescriptor) -> Event: + """Import an event that was exported from another process. + + Parameters + ---------- + ipc_descriptor : :obj:`~_memory._ipc.IPCEventDescriptor` + The IPC descriptor obtained from :attr:`~Event.ipc_descriptor` in + another process. + + Returns + ------- + :obj:`~_event.Event` + A new event backed by the imported IPC handle. + + """ + cdef size_t reserved_size = len(ipc_descriptor._reserved) + cdef size_t expected_size = sizeof(cydriver.CUipcEventHandle) + if reserved_size < expected_size: + raise ValueError( + f"IPC event descriptor reserved field is {reserved_size} bytes; " + f"expected at least {expected_size}" + ) + cdef cydriver.CUipcEventHandle data + memcpy(data.reserved, (ipc_descriptor._reserved), sizeof(data.reserved)) + cdef Event self = Event.__new__(cls) + cdef EventHandle h_event = create_event_handle_ipc(data, ipc_descriptor._is_blocking_sync) + if not h_event: + raise RuntimeError("Failed to open IPC event handle") + self._h_event = h_event + self._ipc_descriptor = ipc_descriptor + return self + + @property + def is_ipc_enabled(self) -> bool: + """Return True if the event can be shared across process boundaries, otherwise False.""" + return get_event_ipc_enabled(self._h_event) + + @property + def is_timing_enabled(self) -> bool: + """Return True if the event records timing data, otherwise False.""" + return get_event_timing_enabled(self._h_event) + + @property + def is_blocking_sync(self) -> bool: + """Return True if the event uses blocking synchronization (the CPU + thread blocks on :meth:`sync` instead of busy-waiting), otherwise False. + """ + return get_event_is_blocking_sync(self._h_event) + + def sync(self) -> None: + """Synchronize until the event completes. + + If the event was created with ``blocking_sync=True``, the + calling CPU thread blocks (yields) until the event has been + completed by the device. Otherwise (the default) the CPU + thread busy-waits until the event has completed. + + """ + with nogil: + HANDLE_RETURN(cydriver.cuEventSynchronize(as_cu(self._h_event))) + + @property + def is_done(self) -> bool: + """Return True if all captured works have been completed, otherwise False.""" + with nogil: + result = cydriver.cuEventQuery(as_cu(self._h_event)) + if result == cydriver.CUresult.CUDA_SUCCESS: + return True + if result == cydriver.CUresult.CUDA_ERROR_NOT_READY: + return False + HANDLE_RETURN(result) + + @property + def handle(self) -> cuda.bindings.driver.CUevent: + """Return the underlying CUevent object. + + .. caution:: + + This handle is a Python object. To get the memory address of the underlying C + handle, call ``int(Event.handle)``. + """ + return as_py(self._h_event) + + @property + def device(self) -> Device: + """Return the :obj:`~_device.Device` singleton associated with this event. + + Note + ---- + The current context on the device may differ from this + event's context. This case occurs when a different CUDA + context is set current after a event is created. + + """ + cdef int dev_id = get_event_device_id(self._h_event) + if dev_id >= 0: + from ._device import Device # avoid circular import + return Device(dev_id) + + @property + def context(self) -> Context: + """Return the :obj:`~_context.Context` associated with this event.""" + cdef ContextHandle h_ctx = get_event_context(self._h_event) + cdef int dev_id = get_event_device_id(self._h_event) + if h_ctx and dev_id >= 0: + return Context._from_handle(Context, h_ctx, dev_id) + + +cdef class IPCEventDescriptor: + """Serializable object describing an event that can be shared between processes.""" + + cdef: + bytes _reserved + bint _is_blocking_sync + + def __init__(self, *arg, **kwargs) -> None: + raise RuntimeError("IPCEventDescriptor objects cannot be instantiated directly. Please use Event APIs.") + + @staticmethod + def _init(reserved: bytes, is_blocking_sync: cython.bint) -> IPCEventDescriptor: + cdef IPCEventDescriptor self = IPCEventDescriptor.__new__(IPCEventDescriptor) + self._reserved = reserved + self._is_blocking_sync = is_blocking_sync + return self + + def __eq__(self, other: object) -> bool: + if not isinstance(other, IPCEventDescriptor): + return NotImplemented + # No need to check self._is_blocking_sync. + return self._reserved == (other)._reserved + + def __reduce__(self) -> tuple[object, ...]: + return IPCEventDescriptor._init, (self._reserved, self._is_blocking_sync) + + +def _reduce_event(event: Event) -> tuple[object, ...]: + check_multiprocessing_start_method() + return event.from_ipc_descriptor, (event.ipc_descriptor,) + +multiprocessing.reduction.register(Event, _reduce_event) diff --git a/cuda_core/cuda/core/_graphics.pxd b/cuda_core/cuda/core/_graphics.pxd new file mode 100644 index 00000000000..520a366bbde --- /dev/null +++ b/cuda_core/cuda/core/_graphics.pxd @@ -0,0 +1,16 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from cuda.core._resource_handles cimport GraphicsResourceHandle + + +cdef class GraphicsResource: + + cdef: + GraphicsResourceHandle _handle + object _mapped_buffer + object _context_manager_stream + object _entered_buffer + + cpdef close(self, stream=*) diff --git a/cuda_core/cuda/core/_graphics.pyi b/cuda_core/cuda/core/_graphics.pyi new file mode 100644 index 00000000000..b7022e5a18a --- /dev/null +++ b/cuda_core/cuda/core/_graphics.pyi @@ -0,0 +1,226 @@ +# This file was generated by stubgen-pyx v0.2.6 from cuda_core/cuda/core/_graphics.pyx + +from __future__ import annotations + +from typing import Sequence + +from cuda.bindings import cydriver +from cuda.core._memory._buffer import Buffer +from cuda.core._stream import Stream + + +class GraphicsResource: + """RAII wrapper for a CUDA graphics resource (``CUgraphicsResource``). + + A :class:`GraphicsResource` represents an OpenGL buffer or image that has + been registered for access by CUDA. This enables zero-copy sharing of GPU + data between CUDA compute kernels and graphics renderers. + + Mapping the resource returns a :class:`~cuda.core.Buffer` whose lifetime + controls when the graphics resource is unmapped. This keeps stream-ordered + cleanup tied to the mapped pointer itself rather than to mutable state on + the :class:`GraphicsResource` object. + + The resource is automatically unregistered when :meth:`close` is called or + when the object is garbage collected. + + :class:`GraphicsResource` objects should not be instantiated directly. + Use the factory classmethods :meth:`from_gl_buffer` or :meth:`from_gl_image`. + + Examples + -------- + Register an OpenGL VBO, map it to get a buffer, and write to it from CUDA: + + .. code-block:: python + + resource = GraphicsResource.from_gl_buffer(vbo) + + with resource.map(stream=s) as buf: + view = StridedMemoryView.from_buffer(buf, shape=(256,), dtype=np.float32) + # view.ptr is a CUDA device pointer into the GL buffer + + Or scope registration separately from mapping: + + .. code-block:: python + + with GraphicsResource.from_gl_buffer(vbo) as resource: + with resource.map(stream=s) as buf: + # ... launch kernels using buf.handle, buf.size ... + pass + """ + + def close(self, stream: object=None): + """Unregister this graphics resource from CUDA. + + If the resource is currently mapped, it is unmapped first. After + closing, the resource cannot be used again. + + Parameters + ---------- + stream : :class:`~cuda.core.Stream`, optional + Optional override for the stream used to close the currently + mapped buffer, if one exists. + """ + + def __init__(self) -> None: + ... + + @classmethod + def from_gl_buffer(cls, gl_buffer: int, *, flags: str | tuple[str, ...] | list[str] | None=None, stream: Stream | None=None) -> GraphicsResource: + """Register an OpenGL buffer object for CUDA access. + + Parameters + ---------- + gl_buffer : int + The OpenGL buffer name (``GLuint``) to register. + flags : str or sequence of str, optional + Registration flags specifying intended usage. Accepted values: + ``"none"``, ``"read_only"``, ``"write_discard"``, + ``"surface_load_store"``, ``"texture_gather"``. + Multiple flags can be combined by passing a sequence + (e.g., ``("surface_load_store", "read_only")``). + Defaults to ``None`` (no flags). + stream : :class:`~cuda.core.Stream`, optional + If provided, the resource can be used directly as a context manager + and it will be mapped on entry:: + + with GraphicsResource.from_gl_buffer(vbo, stream=s) as buf: + view = StridedMemoryView.from_buffer(buf, shape=(256,), dtype=np.float32) + + If omitted, the returned resource can still be used as a context + manager to scope registration and automatic cleanup:: + + with GraphicsResource.from_gl_buffer(vbo) as resource: + with resource.map(stream=s) as buf: + ... + + Returns + ------- + GraphicsResource + A new graphics resource wrapping the registered GL buffer. + The returned resource can be used as a context manager. If + *stream* was given, entering maps the resource and yields a + :class:`~cuda.core.Buffer`; otherwise entering yields the + :class:`GraphicsResource` itself and closes it on exit. + + Raises + ------ + CUDAError + If the registration fails (e.g., no current GL context, invalid + buffer name, or operating system error). + ValueError + If an unknown flag string is provided. + """ + + @classmethod + def from_gl_image(cls, image: int, target: int, *, flags: str | tuple[str, ...] | list[str] | None=None) -> GraphicsResource: + """Register an OpenGL texture or renderbuffer for CUDA access. + + Parameters + ---------- + image : int + The OpenGL texture or renderbuffer name (``GLuint``) to register. + target : int + The OpenGL target type (e.g., ``GL_TEXTURE_2D``). + flags : str or sequence of str, optional + Registration flags specifying intended usage. Accepted values: + ``"none"``, ``"read_only"``, ``"write_discard"``, + ``"surface_load_store"``, ``"texture_gather"``. + Multiple flags can be combined by passing a sequence + (e.g., ``("surface_load_store", "read_only")``). + Defaults to ``None`` (no flags). + + Returns + ------- + GraphicsResource + A new graphics resource wrapping the registered GL image. + + Raises + ------ + CUDAError + If the registration fails. + ValueError + If an unknown flag string is provided. + """ + + def _get_mapped_buffer(self) -> object: + ... + + def map(self, *, stream: Stream) -> Buffer: + """Map this graphics resource for CUDA access. + + After mapping, a CUDA device pointer into the underlying graphics + memory is available as a :class:`~cuda.core.Buffer`. + + Can be used as a context manager for automatic unmapping:: + + with resource.map(stream=s) as buf: + # use buf.handle, buf.size, etc. + # automatically unmapped here + + Parameters + ---------- + stream : :class:`~cuda.core.Stream` + Keyword-only. The CUDA stream on which to perform the mapping. + Must be passed explicitly; pass ``device.default_stream`` to use + the default stream. + + Returns + ------- + Buffer + A buffer whose lifetime controls when the graphics resource is + unmapped. + + Raises + ------ + RuntimeError + If the resource is already mapped or has been closed. + CUDAError + If the mapping fails. + """ + + def unmap(self, *, stream: Stream | None=None) -> None: + """Unmap this graphics resource, releasing it back to the graphics API. + + After unmapping, the :class:`~cuda.core.Buffer` previously returned + by :meth:`map` must not be used. + + Parameters + ---------- + stream : :class:`~cuda.core.Stream`, optional + If provided, overrides the stream that will be used when the + mapped buffer is closed. Otherwise the mapping stream is reused. + + Raises + ------ + RuntimeError + If the resource is not currently mapped or has been closed. + CUDAError + If the unmapping fails. + """ + + def __enter__(self) -> object: + ... + + def __exit__(self, exc_type: type | None, exc_val: BaseException | None, exc_tb: object) -> bool: + ... + + @property + def is_mapped(self) -> bool: + """Whether the resource is currently mapped for CUDA access.""" + + @property + def handle(self) -> int: + """The raw ``CUgraphicsResource`` handle as a Python int.""" + + @property + def resource_handle(self) -> int: + """Alias for :attr:`handle`.""" + + def __repr__(self) -> str: + ... +__all__ = ['GraphicsResource'] +_REGISTER_FLAGS = {'none': cydriver.CU_GRAPHICS_REGISTER_FLAGS_NONE, 'read_only': cydriver.CU_GRAPHICS_REGISTER_FLAGS_READ_ONLY, 'write_discard': cydriver.CU_GRAPHICS_REGISTER_FLAGS_WRITE_DISCARD, 'surface_load_store': cydriver.CU_GRAPHICS_REGISTER_FLAGS_SURFACE_LDST, 'texture_gather': cydriver.CU_GRAPHICS_REGISTER_FLAGS_TEXTURE_GATHER} + +def _parse_register_flags(flags: str | Sequence[str] | None) -> int: + ... \ No newline at end of file diff --git a/cuda_core/cuda/core/_graphics.pyx b/cuda_core/cuda/core/_graphics.pyx new file mode 100644 index 00000000000..c5fc5c83ecc --- /dev/null +++ b/cuda_core/cuda/core/_graphics.pyx @@ -0,0 +1,366 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from __future__ import annotations + +from typing import Sequence + +from cuda.bindings cimport cydriver +from cuda.core._resource_handles cimport ( + create_graphics_resource_handle, + deviceptr_create_mapped_graphics, + as_cu, + as_intptr, +) +from cuda.core._memory._buffer cimport Buffer, Buffer_from_deviceptr_handle +from cuda.core._stream cimport Stream, Stream_accept +from cuda.core._utils.cuda_utils cimport HANDLE_RETURN + +__all__ = ['GraphicsResource'] + +_REGISTER_FLAGS = { + "none": cydriver.CU_GRAPHICS_REGISTER_FLAGS_NONE, + "read_only": cydriver.CU_GRAPHICS_REGISTER_FLAGS_READ_ONLY, + "write_discard": cydriver.CU_GRAPHICS_REGISTER_FLAGS_WRITE_DISCARD, + "surface_load_store": cydriver.CU_GRAPHICS_REGISTER_FLAGS_SURFACE_LDST, + "texture_gather": cydriver.CU_GRAPHICS_REGISTER_FLAGS_TEXTURE_GATHER, +} + + +def _parse_register_flags(flags: str | Sequence[str] | None) -> int: + if flags is None: + return 0 + if isinstance(flags, str): + flags = (flags,) + result = 0 + for f in flags: + try: + result |= _REGISTER_FLAGS[f] + except KeyError: + raise ValueError( + f"Unknown register flag {f!r}. " + f"Valid flags: {', '.join(sorted(_REGISTER_FLAGS))}" + ) from None + return result + + +cdef class GraphicsResource: + """RAII wrapper for a CUDA graphics resource (``CUgraphicsResource``). + + A :class:`GraphicsResource` represents an OpenGL buffer or image that has + been registered for access by CUDA. This enables zero-copy sharing of GPU + data between CUDA compute kernels and graphics renderers. + + Mapping the resource returns a :class:`~cuda.core.Buffer` whose lifetime + controls when the graphics resource is unmapped. This keeps stream-ordered + cleanup tied to the mapped pointer itself rather than to mutable state on + the :class:`GraphicsResource` object. + + The resource is automatically unregistered when :meth:`close` is called or + when the object is garbage collected. + + :class:`GraphicsResource` objects should not be instantiated directly. + Use the factory classmethods :meth:`from_gl_buffer` or :meth:`from_gl_image`. + + Examples + -------- + Register an OpenGL VBO, map it to get a buffer, and write to it from CUDA: + + .. code-block:: python + + resource = GraphicsResource.from_gl_buffer(vbo) + + with resource.map(stream=s) as buf: + view = StridedMemoryView.from_buffer(buf, shape=(256,), dtype=np.float32) + # view.ptr is a CUDA device pointer into the GL buffer + + Or scope registration separately from mapping: + + .. code-block:: python + + with GraphicsResource.from_gl_buffer(vbo) as resource: + with resource.map(stream=s) as buf: + # ... launch kernels using buf.handle, buf.size ... + pass + """ + + def __init__(self) -> None: + raise RuntimeError( + "GraphicsResource objects cannot be instantiated directly. " + "Use GraphicsResource.from_gl_buffer() or GraphicsResource.from_gl_image()." + ) + + @classmethod + def from_gl_buffer( + cls, + int gl_buffer, + *, + flags: str | tuple[str, ...] | list[str] | None = None, + stream: Stream | None = None + ) -> GraphicsResource: + """Register an OpenGL buffer object for CUDA access. + + Parameters + ---------- + gl_buffer : int + The OpenGL buffer name (``GLuint``) to register. + flags : str or sequence of str, optional + Registration flags specifying intended usage. Accepted values: + ``"none"``, ``"read_only"``, ``"write_discard"``, + ``"surface_load_store"``, ``"texture_gather"``. + Multiple flags can be combined by passing a sequence + (e.g., ``("surface_load_store", "read_only")``). + Defaults to ``None`` (no flags). + stream : :class:`~cuda.core.Stream`, optional + If provided, the resource can be used directly as a context manager + and it will be mapped on entry:: + + with GraphicsResource.from_gl_buffer(vbo, stream=s) as buf: + view = StridedMemoryView.from_buffer(buf, shape=(256,), dtype=np.float32) + + If omitted, the returned resource can still be used as a context + manager to scope registration and automatic cleanup:: + + with GraphicsResource.from_gl_buffer(vbo) as resource: + with resource.map(stream=s) as buf: + ... + + Returns + ------- + GraphicsResource + A new graphics resource wrapping the registered GL buffer. + The returned resource can be used as a context manager. If + *stream* was given, entering maps the resource and yields a + :class:`~cuda.core.Buffer`; otherwise entering yields the + :class:`GraphicsResource` itself and closes it on exit. + + Raises + ------ + CUDAError + If the registration fails (e.g., no current GL context, invalid + buffer name, or operating system error). + ValueError + If an unknown flag string is provided. + """ + cdef GraphicsResource self = GraphicsResource.__new__(cls) + cdef cydriver.CUgraphicsResource resource + cdef cydriver.GLuint cy_buffer = gl_buffer + cdef unsigned int cy_flags = _parse_register_flags(flags) + with nogil: + HANDLE_RETURN( + cydriver.cuGraphicsGLRegisterBuffer(&resource, cy_buffer, cy_flags) + ) + self._handle = create_graphics_resource_handle(resource) + self._mapped_buffer = None + self._context_manager_stream = stream + self._entered_buffer = None + return self + + @classmethod + def from_gl_image( + cls, + int image, + int target, + *, + flags: str | tuple[str, ...] | list[str] | None = None + ) -> GraphicsResource: + """Register an OpenGL texture or renderbuffer for CUDA access. + + Parameters + ---------- + image : int + The OpenGL texture or renderbuffer name (``GLuint``) to register. + target : int + The OpenGL target type (e.g., ``GL_TEXTURE_2D``). + flags : str or sequence of str, optional + Registration flags specifying intended usage. Accepted values: + ``"none"``, ``"read_only"``, ``"write_discard"``, + ``"surface_load_store"``, ``"texture_gather"``. + Multiple flags can be combined by passing a sequence + (e.g., ``("surface_load_store", "read_only")``). + Defaults to ``None`` (no flags). + + Returns + ------- + GraphicsResource + A new graphics resource wrapping the registered GL image. + + Raises + ------ + CUDAError + If the registration fails. + ValueError + If an unknown flag string is provided. + """ + cdef GraphicsResource self = GraphicsResource.__new__(cls) + cdef cydriver.CUgraphicsResource resource + cdef cydriver.GLuint cy_image = image + cdef cydriver.GLenum cy_target = target + cdef unsigned int cy_flags = _parse_register_flags(flags) + with nogil: + HANDLE_RETURN( + cydriver.cuGraphicsGLRegisterImage(&resource, cy_image, cy_target, cy_flags) + ) + self._handle = create_graphics_resource_handle(resource) + self._mapped_buffer = None + self._context_manager_stream = None + self._entered_buffer = None + return self + + def _get_mapped_buffer(self) -> object: + cdef Buffer buf + if self._mapped_buffer is None: + return None + buf = self._mapped_buffer + if not buf._h_ptr: + self._mapped_buffer = None + return None + return self._mapped_buffer + + def map(self, *, stream: Stream) -> Buffer: + """Map this graphics resource for CUDA access. + + After mapping, a CUDA device pointer into the underlying graphics + memory is available as a :class:`~cuda.core.Buffer`. + + Can be used as a context manager for automatic unmapping:: + + with resource.map(stream=s) as buf: + # use buf.handle, buf.size, etc. + # automatically unmapped here + + Parameters + ---------- + stream : :class:`~cuda.core.Stream` + Keyword-only. The CUDA stream on which to perform the mapping. + Must be passed explicitly; pass ``device.default_stream`` to use + the default stream. + + Returns + ------- + Buffer + A buffer whose lifetime controls when the graphics resource is + unmapped. + + Raises + ------ + RuntimeError + If the resource is already mapped or has been closed. + CUDAError + If the mapping fails. + """ + cdef Stream s_obj + cdef cydriver.CUgraphicsResource raw + cdef cydriver.CUstream cy_stream + cdef cydriver.CUdeviceptr dev_ptr = 0 + cdef size_t size = 0 + cdef Buffer buf + if not self._handle: + raise RuntimeError("GraphicsResource has been closed") + if self._get_mapped_buffer() is not None: + raise RuntimeError("GraphicsResource is already mapped") + + s_obj = Stream_accept(stream) + raw = as_cu(self._handle) + cy_stream = as_cu(s_obj._h_stream) + with nogil: + HANDLE_RETURN( + cydriver.cuGraphicsMapResources(1, &raw, cy_stream) + ) + HANDLE_RETURN( + cydriver.cuGraphicsResourceGetMappedPointer(&dev_ptr, &size, raw) + ) + buf = Buffer_from_deviceptr_handle( + deviceptr_create_mapped_graphics(dev_ptr, self._handle, s_obj._h_stream), + size, + None, + None, + ) + self._mapped_buffer = buf + return buf + + def unmap(self, *, stream: Stream | None = None) -> None: + """Unmap this graphics resource, releasing it back to the graphics API. + + After unmapping, the :class:`~cuda.core.Buffer` previously returned + by :meth:`map` must not be used. + + Parameters + ---------- + stream : :class:`~cuda.core.Stream`, optional + If provided, overrides the stream that will be used when the + mapped buffer is closed. Otherwise the mapping stream is reused. + + Raises + ------ + RuntimeError + If the resource is not currently mapped or has been closed. + CUDAError + If the unmapping fails. + """ + cdef object buf_obj + cdef Buffer buf + if not self._handle: + raise RuntimeError("GraphicsResource has been closed") + buf_obj = self._get_mapped_buffer() + if buf_obj is None: + raise RuntimeError("GraphicsResource is not mapped") + buf = buf_obj + buf.close(stream=stream) + self._mapped_buffer = None + + def __enter__(self) -> object: + if self._context_manager_stream is None: + return self + self._entered_buffer = self.map(stream=self._context_manager_stream) + return self._entered_buffer + + def __exit__(self, exc_type: type | None, exc_val: BaseException | None, exc_tb: object) -> bool: + self.close() + return False + + cpdef close(self, object stream=None): + """Unregister this graphics resource from CUDA. + + If the resource is currently mapped, it is unmapped first. After + closing, the resource cannot be used again. + + Parameters + ---------- + stream : :class:`~cuda.core.Stream`, optional + Optional override for the stream used to close the currently + mapped buffer, if one exists. + """ + cdef object buf_obj + cdef Buffer buf + if not self._handle: + return + buf_obj = self._get_mapped_buffer() + if buf_obj is not None: + buf = buf_obj + buf.close(stream=stream) + self._mapped_buffer = None + self._handle.reset() + self._context_manager_stream = None + self._entered_buffer = None + + @property + def is_mapped(self) -> bool: + """Whether the resource is currently mapped for CUDA access.""" + return self._get_mapped_buffer() is not None + + @property + def handle(self) -> int: + """The raw ``CUgraphicsResource`` handle as a Python int.""" + return as_intptr(self._handle) + + @property + def resource_handle(self) -> int: + """Alias for :attr:`handle`.""" + return self.handle + + def __repr__(self) -> str: + mapped_str = " mapped" if self.is_mapped else "" + closed_str = " closed" if not self._handle else "" + return f"" diff --git a/cuda_core/cuda/core/_host.py b/cuda_core/cuda/core/_host.py new file mode 100644 index 00000000000..e74743d493a --- /dev/null +++ b/cuda_core/cuda/core/_host.py @@ -0,0 +1,103 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +from __future__ import annotations + +import threading +from typing import ClassVar + + +class Host: + """Host (CPU) location for managed-memory operations. + + Use one of the following forms: + + * ``Host()`` — generic host (any NUMA node). + * ``Host(numa_id=N)`` — specific NUMA node ``N``. + * ``Host.numa_current()`` or ``Host(is_numa_current=True)`` — NUMA node + of the calling thread. ``numa_id`` and ``is_numa_current`` are + mutually exclusive. + + ``Host`` is the symmetric counterpart of :class:`~cuda.core.Device` + for managed-memory `prefetch`, `advise`, and `discard_prefetch` + targets. Pass either a ``Device`` or a ``Host`` to those operations + and to ``ManagedBuffer.preferred_location`` / ``accessed_by``. + + ``Host`` is a singleton class, mirroring :class:`~cuda.core.Device`: + constructor calls with the same arguments return the same instance, + so ``Host() is Host()`` and ``Host(numa_id=1) is Host(numa_id=1)``. + ``Host.numa_current()`` returns its own singleton, distinct from + ``Host()`` because it represents a thread-relative location rather + than a fixed one. + """ + + __slots__ = ("__weakref__", "_is_numa_current", "_numa_id") + + _numa_id: int | None + _is_numa_current: bool + + # Singleton cache keyed by (numa_id, is_numa_current). + _instances: ClassVar[dict[tuple[int | None, bool], Host]] = {} + _instances_lock: ClassVar[threading.Lock] = threading.Lock() + + def __new__(cls, numa_id: int | None = None, *, is_numa_current: bool = False) -> Host: + if is_numa_current and numa_id is not None: + raise ValueError("numa_id and is_numa_current are mutually exclusive") + if numa_id is not None and (isinstance(numa_id, bool) or not isinstance(numa_id, int) or numa_id < 0): + raise ValueError(f"numa_id must be a non-negative int, got {numa_id!r}") + return cls._get_or_create(numa_id, is_numa_current) + + @classmethod + def _get_or_create(cls, numa_id: int | None, is_numa_current: bool) -> Host: + key = (numa_id, is_numa_current) + cache = cls._instances + inst = cache.get(key) + if inst is not None: + return inst + with cls._instances_lock: + inst = cache.get(key) + if inst is None: + inst = object.__new__(cls) + inst._numa_id = numa_id + inst._is_numa_current = is_numa_current + cache[key] = inst + return inst + + @property + def numa_id(self) -> int | None: + """NUMA node ID, or ``None`` if not pinned to a specific NUMA node.""" + return self._numa_id + + @property + def is_numa_current(self) -> bool: + """``True`` if this ``Host`` represents the calling thread's NUMA node (constructed via :meth:`numa_current`).""" + return self._is_numa_current + + @classmethod + def numa_current(cls) -> Host: + """Construct a ``Host`` referring to the calling thread's NUMA node.""" + return cls(is_numa_current=True) + + def __eq__(self, other: object) -> bool: + if not isinstance(other, Host): + return NotImplemented + return self is other + + def __hash__(self) -> int: + return hash((Host, self._numa_id, self._is_numa_current)) + + def __reduce__(self) -> tuple[object, ...]: + if self._is_numa_current: + return (_reconstruct_numa_current, ()) + return (Host, (self._numa_id,)) + + def __repr__(self) -> str: + if self.is_numa_current: + return "Host.numa_current()" + if self.numa_id is None: + return "Host()" + return f"Host(numa_id={self.numa_id})" + + +def _reconstruct_numa_current() -> Host: + return Host.numa_current() diff --git a/cuda_core/cuda/core/_include/aoti_shim.def b/cuda_core/cuda/core/_include/aoti_shim.def new file mode 100644 index 00000000000..3cd1e31aeac --- /dev/null +++ b/cuda_core/cuda/core/_include/aoti_shim.def @@ -0,0 +1,36 @@ +; Stub import library definition for PyTorch's AOTI stable C ABI symbols. +; Used on Windows only: 'lib /DEF:aoti_shim.def /OUT:aoti_shim.lib /MACHINE:X64' +; generates a minimal import library that satisfies the MSVC linker. +; At runtime the symbols resolve from torch_cpu.dll (loaded by 'import torch'). +; +; IMPORTANT: Keep this export list in sync with the AOTI_SHIM_API declarations +; in aoti_shim.h. setup.py turns this file into the stub import library +; that MSVC uses to link _tensor_bridge, so any added/removed/renamed AOTI +; symbol must be updated in both files. +LIBRARY torch_cpu.dll +EXPORTS + aoti_torch_get_data_ptr + aoti_torch_get_dim + aoti_torch_get_sizes + aoti_torch_get_strides + aoti_torch_get_dtype + aoti_torch_dtype_float16 + aoti_torch_dtype_float32 + aoti_torch_dtype_float64 + aoti_torch_dtype_bfloat16 + aoti_torch_dtype_uint8 + aoti_torch_dtype_uint16 + aoti_torch_dtype_uint32 + aoti_torch_dtype_uint64 + aoti_torch_dtype_int8 + aoti_torch_dtype_int16 + aoti_torch_dtype_int32 + aoti_torch_dtype_int64 + aoti_torch_dtype_bool + aoti_torch_dtype_complex32 + aoti_torch_dtype_complex64 + aoti_torch_dtype_complex128 + aoti_torch_get_device_type + aoti_torch_get_device_index + aoti_torch_device_type_cpu + aoti_torch_device_type_cuda diff --git a/cuda_core/cuda/core/_include/aoti_shim.h b/cuda_core/cuda/core/_include/aoti_shim.h new file mode 100644 index 00000000000..bf8894d940a --- /dev/null +++ b/cuda_core/cuda/core/_include/aoti_shim.h @@ -0,0 +1,121 @@ +/* + * Vendored subset of PyTorch's AOT Inductor (AOTI) stable C ABI. + * Original: torch/csrc/inductor/aoti_torch/c/shim.h + * + * These are declarations only -- no definitions are provided. The actual + * symbols are exported by libtorch (loaded via torch._C with RTLD_GLOBAL) + * and resolved at runtime by the dynamic linker. This means PyTorch is + * NOT required at compile time. + * + * From PyTorch: + * + * Copyright (c) 2016- Facebook, Inc (Adam Paszke) + * Copyright (c) 2014- Facebook, Inc (Soumith Chintala) + * Copyright (c) 2011-2014 Idiap Research Institute (Ronan Collobert) + * Copyright (c) 2012-2014 Deepmind Technologies (Koray Kavukcuoglu) + * Copyright (c) 2011-2012 NEC Laboratories America (Koray Kavukcuoglu) + * Copyright (c) 2011-2013 NYU (Clement Farabet) + * Copyright (c) 2006-2010 NEC Laboratories America (Ronan Collobert, Leon Bottou, Iain Melvin, Jason Weston) + * Copyright (c) 2006 Idiap Research Institute (Samy Bengio) + * Copyright (c) 2001-2004 Idiap Research Institute (Ronan Collobert, Samy Bengio, Johnny Mariethoz) + * + * SPDX-License-Identifier: BSD-3-Clause + * See https://github.com/pytorch/pytorch/blob/main/LICENSE + */ + +#ifndef CUDA_CORE_AOTI_SHIM_H +#define CUDA_CORE_AOTI_SHIM_H + +#include + +/* + * On Windows the AOTI symbols live in torch_cpu.dll. We consume them + * via __declspec(dllimport) and a stub import library generated from + * aoti_shim.def at build time. On Linux/macOS the symbols are made + * visible at runtime through ctypes.CDLL(torch._C, RTLD_GLOBAL). + */ +#ifdef _WIN32 +# define AOTI_SHIM_API __declspec(dllimport) +#else +# define AOTI_SHIM_API +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +typedef int32_t AOTITorchError; + +/* Opaque tensor handle -- corresponds to at::Tensor on the C++ side. */ +struct AtenTensorOpaque; +typedef struct AtenTensorOpaque* AtenTensorHandle; + +/* + * IMPORTANT: Keep the AOTI_SHIM_API declaration list below in sync with + * aoti_shim.def. On Windows, setup.py generates that stub import library + * during build_ext so MSVC can link _tensor_bridge without making PyTorch a + * build-time dependency. If you add, remove, or rename an imported AOTI + * symbol here, update aoti_shim.def in the same change. + * + * Exception: aoti_torch_get_current_cuda_stream lives in torch_cuda (not + * torch_cpu) and is resolved lazily at runtime — see _tensor_bridge.pyx. + */ + +/* ---- tensor metadata --------------------------------------------------- */ + +AOTI_SHIM_API AOTITorchError aoti_torch_get_data_ptr( + AtenTensorHandle tensor, void** ret_data_ptr); + +AOTI_SHIM_API AOTITorchError aoti_torch_get_dim( + AtenTensorHandle tensor, int64_t* ret_dim); + +AOTI_SHIM_API AOTITorchError aoti_torch_get_sizes( + AtenTensorHandle tensor, int64_t** ret_sizes); + +AOTI_SHIM_API AOTITorchError aoti_torch_get_strides( + AtenTensorHandle tensor, int64_t** ret_strides); + +/* ---- dtype ------------------------------------------------------------- */ + +AOTI_SHIM_API AOTITorchError aoti_torch_get_dtype( + AtenTensorHandle tensor, int32_t* ret_dtype); + +AOTI_SHIM_API int32_t aoti_torch_dtype_float16(void); +AOTI_SHIM_API int32_t aoti_torch_dtype_float32(void); +AOTI_SHIM_API int32_t aoti_torch_dtype_float64(void); +AOTI_SHIM_API int32_t aoti_torch_dtype_bfloat16(void); +AOTI_SHIM_API int32_t aoti_torch_dtype_uint8(void); +AOTI_SHIM_API int32_t aoti_torch_dtype_uint16(void); +AOTI_SHIM_API int32_t aoti_torch_dtype_uint32(void); +AOTI_SHIM_API int32_t aoti_torch_dtype_uint64(void); +AOTI_SHIM_API int32_t aoti_torch_dtype_int8(void); +AOTI_SHIM_API int32_t aoti_torch_dtype_int16(void); +AOTI_SHIM_API int32_t aoti_torch_dtype_int32(void); +AOTI_SHIM_API int32_t aoti_torch_dtype_int64(void); +AOTI_SHIM_API int32_t aoti_torch_dtype_bool(void); +AOTI_SHIM_API int32_t aoti_torch_dtype_complex32(void); +AOTI_SHIM_API int32_t aoti_torch_dtype_complex64(void); +AOTI_SHIM_API int32_t aoti_torch_dtype_complex128(void); + +/* ---- device ------------------------------------------------------------ */ + +AOTI_SHIM_API AOTITorchError aoti_torch_get_device_type( + AtenTensorHandle tensor, int32_t* ret_device_type); + +AOTI_SHIM_API AOTITorchError aoti_torch_get_device_index( + AtenTensorHandle tensor, int32_t* ret_device_index); + +AOTI_SHIM_API int32_t aoti_torch_device_type_cpu(void); +AOTI_SHIM_API int32_t aoti_torch_device_type_cuda(void); + +/* ---- stream -------------------------------------------------------------- + * aoti_torch_get_current_cuda_stream is NOT declared here — it lives in + * torch_cuda (not torch_cpu) and is resolved at runtime. See the inline + * C helper _resolve_cuda_stream_fn() in _tensor_bridge.pyx. + * ---------------------------------------------------------------------- */ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* CUDA_CORE_AOTI_SHIM_H */ diff --git a/cuda_core/cuda/core/_include/dlpack.h b/cuda_core/cuda/core/_include/dlpack.h new file mode 100644 index 00000000000..a84dcb537f8 --- /dev/null +++ b/cuda_core/cuda/core/_include/dlpack.h @@ -0,0 +1,568 @@ +/*! + * Copyright (c) 2017 by Contributors + * \file dlpack.h + * \brief The common header of DLPack. + */ +#ifndef DLPACK_DLPACK_H_ +#define DLPACK_DLPACK_H_ + +/** + * \brief Compatibility with C++ + */ +#ifdef __cplusplus +#define DLPACK_EXTERN_C extern "C" +#else +#define DLPACK_EXTERN_C +#endif + +/*! \brief The current major version of dlpack */ +#define DLPACK_MAJOR_VERSION 1 + +/*! \brief The current minor version of dlpack */ +#define DLPACK_MINOR_VERSION 3 + +/*! \brief DLPACK_DLL prefix for windows */ +#ifdef _WIN32 +#ifdef DLPACK_EXPORTS +#define DLPACK_DLL __declspec(dllexport) +#else +#define DLPACK_DLL __declspec(dllimport) +#endif +#else +#define DLPACK_DLL +#endif + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/*! + * \brief The DLPack version. + * + * A change in major version indicates that we have changed the + * data layout of the ABI - DLManagedTensorVersioned. + * + * A change in minor version indicates that we have added new + * code, such as a new device type, but the ABI is kept the same. + * + * If an obtained DLPack tensor has a major version that disagrees + * with the version number specified in this header file + * (i.e. major != DLPACK_MAJOR_VERSION), the consumer must call the deleter + * (and it is safe to do so). It is not safe to access any other fields + * as the memory layout will have changed. + * + * In the case of a minor version mismatch, the tensor can be safely used as + * long as the consumer knows how to interpret all fields. Minor version + * updates indicate the addition of enumeration values. + */ +typedef struct { + /*! \brief DLPack major version. */ + uint32_t major; + /*! \brief DLPack minor version. */ + uint32_t minor; +} DLPackVersion; + +/*! + * \brief The device type in DLDevice. + */ +#ifdef __cplusplus +typedef enum : int32_t { +#else +typedef enum { +#endif + /*! \brief CPU device */ + kDLCPU = 1, + /*! \brief CUDA GPU device */ + kDLCUDA = 2, + /*! + * \brief Pinned CUDA CPU memory by cudaMallocHost + */ + kDLCUDAHost = 3, + /*! \brief OpenCL devices. */ + kDLOpenCL = 4, + /*! \brief Vulkan buffer for next generation graphics. */ + kDLVulkan = 7, + /*! \brief Metal for Apple GPU. */ + kDLMetal = 8, + /*! \brief Verilog simulator buffer */ + kDLVPI = 9, + /*! \brief ROCm GPUs for AMD GPUs */ + kDLROCM = 10, + /*! + * \brief Pinned ROCm CPU memory allocated by hipMallocHost + */ + kDLROCMHost = 11, + /*! + * \brief Reserved extension device type, + * used for quickly test extension device + * The semantics can differ depending on the implementation. + */ + kDLExtDev = 12, + /*! + * \brief CUDA managed/unified memory allocated by cudaMallocManaged + */ + kDLCUDAManaged = 13, + /*! + * \brief Unified shared memory allocated on a oneAPI non-partititioned + * device. Call to oneAPI runtime is required to determine the device + * type, the USM allocation type and the sycl context it is bound to. + * + */ + kDLOneAPI = 14, + /*! \brief GPU support for next generation WebGPU standard. */ + kDLWebGPU = 15, + /*! \brief Qualcomm Hexagon DSP */ + kDLHexagon = 16, + /*! \brief Microsoft MAIA devices */ + kDLMAIA = 17, + /*! \brief AWS Trainium */ + kDLTrn = 18, +} DLDeviceType; + +/*! + * \brief A Device for Tensor and operator. + */ +typedef struct { + /*! \brief The device type used in the device. */ + DLDeviceType device_type; + /*! + * \brief The device index. + * For vanilla CPU memory, pinned memory, or managed memory, this is set to 0. + */ + int32_t device_id; +} DLDevice; + +/*! + * \brief The type code options DLDataType. + */ +typedef enum { + /*! \brief signed integer */ + kDLInt = 0U, + /*! \brief unsigned integer */ + kDLUInt = 1U, + /*! \brief IEEE floating point */ + kDLFloat = 2U, + /*! + * \brief Opaque handle type, reserved for testing purposes. + * Frameworks need to agree on the handle data type for the exchange to be well-defined. + */ + kDLOpaqueHandle = 3U, + /*! \brief bfloat16 */ + kDLBfloat = 4U, + /*! + * \brief complex number + * (C/C++/Python layout: compact struct per complex number) + */ + kDLComplex = 5U, + /*! \brief boolean */ + kDLBool = 6U, + /*! \brief FP8 data types */ + kDLFloat8_e3m4 = 7U, + kDLFloat8_e4m3 = 8U, + kDLFloat8_e4m3b11fnuz = 9U, + kDLFloat8_e4m3fn = 10U, + kDLFloat8_e4m3fnuz = 11U, + kDLFloat8_e5m2 = 12U, + kDLFloat8_e5m2fnuz = 13U, + kDLFloat8_e8m0fnu = 14U, + /*! \brief FP6 data types + * Setting bits != 6 is currently unspecified, and the producer must ensure it is set + * while the consumer must stop importing if the value is unexpected. + */ + kDLFloat6_e2m3fn = 15U, + kDLFloat6_e3m2fn = 16U, + /*! \brief FP4 data types + * Setting bits != 4 is currently unspecified, and the producer must ensure it is set + * while the consumer must stop importing if the value is unexpected. + */ + kDLFloat4_e2m1fn = 17U, +} DLDataTypeCode; + +/*! + * \brief The data type the tensor can hold. The data type is assumed to follow the + * native endian-ness. An explicit error message should be raised when attempting to + * export an array with non-native endianness + * + * Examples + * - float: type_code = 2, bits = 32, lanes = 1 + * - float4(vectorized 4 float): type_code = 2, bits = 32, lanes = 4 + * - int8: type_code = 0, bits = 8, lanes = 1 + * - std::complex: type_code = 5, bits = 64, lanes = 1 + * - bool: type_code = 6, bits = 8, lanes = 1 (as per common array library convention, the underlying storage size of bool is 8 bits) + * - float8_e4m3: type_code = 8, bits = 8, lanes = 1 (packed in memory) + * - float6_e3m2fn: type_code = 16, bits = 6, lanes = 1 (packed in memory) + * - float4_e2m1fn: type_code = 17, bits = 4, lanes = 1 (packed in memory) + * + * When a sub-byte type is packed, DLPack requires the data to be in little bit-endian, i.e., + * for a packed data set D ((D >> (i * bits)) && bit_mask) stores the i-th element. + */ +typedef struct { + /*! + * \brief Type code of base types. + * We keep it uint8_t instead of DLDataTypeCode for minimal memory + * footprint, but the value should be one of DLDataTypeCode enum values. + * */ + uint8_t code; + /*! + * \brief Number of bits, common choices are 8, 16, 32. + */ + uint8_t bits; + /*! \brief Number of lanes in the type, used for vector types. */ + uint16_t lanes; +} DLDataType; + +/*! + * \brief Plain C Tensor object, does not manage memory. + */ +typedef struct { + /*! + * \brief The data pointer points to the allocated data. This will be CUDA + * device pointer or cl_mem handle in OpenCL. It may be opaque on some device + * types. This pointer is always aligned to 256 bytes as in CUDA. The + * `byte_offset` field should be used to point to the beginning of the data. + * + * Note that as of Nov 2021, multiple libraries (CuPy, PyTorch, TensorFlow, + * TVM, perhaps others) do not adhere to this 256 byte alignment requirement + * on CPU/CUDA/ROCm, and always use `byte_offset=0`. This must be fixed + * (after which this note will be updated); at the moment it is recommended + * to not rely on the data pointer being correctly aligned. + * + * For given DLTensor, the size of memory required to store the contents of + * data is calculated as follows: + * + * \code{.c} + * static inline size_t GetDataSize(const DLTensor* t) { + * size_t size = 1; + * for (tvm_index_t i = 0; i < t->ndim; ++i) { + * size *= t->shape[i]; + * } + * size *= (t->dtype.bits * t->dtype.lanes + 7) / 8; + * return size; + * } + * \endcode + * + * Note that if the tensor is of size zero, then the data pointer should be + * set to `NULL`. + */ + void* data; + /*! \brief The device of the tensor */ + DLDevice device; + /*! \brief Number of dimensions */ + int32_t ndim; + /*! \brief The data type of the pointer*/ + DLDataType dtype; + /*! + * \brief The shape of the tensor + * + * When ndim == 0, shape can be set to NULL. + */ + int64_t* shape; + /*! + * \brief strides of the tensor (in number of elements, not bytes), + * can not be NULL if ndim != 0, must points to + * an array of ndim elements that specifies the strides, + * so consumer can always rely on strides[dim] being valid for 0 <= dim < ndim. + * + * When ndim == 0, strides can be set to NULL. + * + * \note Before DLPack v1.2, strides can be NULL to indicate contiguous data. + * This is not allowed in DLPack v1.2 and later. The rationale + * is to simplify the consumer handling. + */ + int64_t* strides; + /*! \brief The offset in bytes to the beginning pointer to data */ + uint64_t byte_offset; +} DLTensor; + +/*! + * \brief C Tensor object, manage memory of DLTensor. This data structure is + * intended to facilitate the borrowing of DLTensor by another framework. It is + * not meant to transfer the tensor. When the borrowing framework doesn't need + * the tensor, it should call the deleter to notify the host that the resource + * is no longer needed. + * + * \note This data structure is used as Legacy DLManagedTensor + * in DLPack exchange and is deprecated after DLPack v0.8 + * Use DLManagedTensorVersioned instead. + * This data structure may get renamed or deleted in future versions. + * + * \sa DLManagedTensorVersioned + */ +typedef struct DLManagedTensor { + /*! \brief DLTensor which is being memory managed */ + DLTensor dl_tensor; + /*! \brief the context of the original host framework of DLManagedTensor in + * which DLManagedTensor is used in the framework. It can also be NULL. + */ + void * manager_ctx; + /*! + * \brief Destructor - this should be called + * to destruct the manager_ctx which backs the DLManagedTensor. It can be + * NULL if there is no way for the caller to provide a reasonable destructor. + * The destructor deletes the argument self as well. + */ + void (*deleter)(struct DLManagedTensor * self); +} DLManagedTensor; + +// bit masks used in the DLManagedTensorVersioned + +/*! \brief bit mask to indicate that the tensor is read only. */ +#define DLPACK_FLAG_BITMASK_READ_ONLY (1UL << 0UL) + +/*! + * \brief bit mask to indicate that the tensor is a copy made by the producer. + * + * If set, the tensor is considered solely owned throughout its lifetime by the + * consumer, until the producer-provided deleter is invoked. + */ +#define DLPACK_FLAG_BITMASK_IS_COPIED (1UL << 1UL) + +/*! + * \brief bit mask to indicate that whether a sub-byte type is packed or padded. + * + * The default for sub-byte types (ex: fp4/fp6) is assumed packed. This flag can + * be set by the producer to signal that a tensor of sub-byte type is padded. + */ +#define DLPACK_FLAG_BITMASK_IS_SUBBYTE_TYPE_PADDED (1UL << 2UL) + +/*! + * \brief A versioned and managed C Tensor object, manage memory of DLTensor. + * + * This data structure is intended to facilitate the borrowing of DLTensor by + * another framework. It is not meant to transfer the tensor. When the borrowing + * framework doesn't need the tensor, it should call the deleter to notify the + * host that the resource is no longer needed. + * + * \note This is the current standard DLPack exchange data structure. + */ +typedef struct DLManagedTensorVersioned { + /*! + * \brief The API and ABI version of the current managed Tensor + */ + DLPackVersion version; + /*! + * \brief the context of the original host framework. + * + * Stores DLManagedTensorVersioned is used in the + * framework. It can also be NULL. + */ + void *manager_ctx; + /*! + * \brief Destructor. + * + * This should be called to destruct manager_ctx which holds the DLManagedTensorVersioned. + * It can be NULL if there is no way for the caller to provide a reasonable + * destructor. The destructor deletes the argument self as well. + */ + void (*deleter)(struct DLManagedTensorVersioned *self); + /*! + * \brief Additional bitmask flags information about the tensor. + * + * By default the flags should be set to 0. + * + * \note Future ABI changes should keep everything until this field + * stable, to ensure that deleter can be correctly called. + * + * \sa DLPACK_FLAG_BITMASK_READ_ONLY + * \sa DLPACK_FLAG_BITMASK_IS_COPIED + */ + uint64_t flags; + /*! \brief DLTensor which is being memory managed */ + DLTensor dl_tensor; +} DLManagedTensorVersioned; + +//---------------------------------------------------------------------- +// DLPack `__dlpack_c_exchange_api__` fast exchange protocol definitions +//---------------------------------------------------------------------- +/*! + * \brief Request a producer library to create a new tensor. + * + * Create a new `DLManagedTensorVersioned` within the context of the producer + * library. The allocation is defined via the prototype DLTensor. + * + * This function is exposed by the framework through the DLPackExchangeAPI. + * + * \param prototype The prototype DLTensor. Only the dtype, ndim, shape, + * and device fields are used. + * \param out The output DLManagedTensorVersioned. + * \param error_ctx Context for `SetError`. + * \param SetError The function to set the error. + * \return 0 on success, -1 on failure. SetError is called exactly when + * -1 is returned (the implementer must ensure this). + * \note - As a C function, must not thrown C++ exceptions. + * - Error propagation via SetError to avoid any direct need + * of Python API. Due to this `SetError` may have to ensure the GIL is + * held since it will presumably set a Python error. + * + * \sa DLPackExchangeAPI + */ +typedef int (*DLPackManagedTensorAllocator)( + DLTensor* prototype, DLManagedTensorVersioned** out, void* error_ctx, + void (*SetError)(void* error_ctx, const char* kind, const char* message)); + +/*! + * \brief Exports a PyObject* Tensor/NDArray to a DLManagedTensorVersioned. + * + * This function does not perform any stream synchronization. The consumer should query + * DLPackCurrentWorkStream to get the current work stream and launch kernels on it. + * + * This function is exposed by the framework through the DLPackExchangeAPI. + * + * \param py_object The Python object to convert. Must have the same type + * as the one the `DLPackExchangeAPI` was discovered from. + * \param out The output DLManagedTensorVersioned. + * \return 0 on success, -1 on failure with a Python exception set. + * If the data cannot be described using DLPack this should be a BufferError if possible. + * \note - As a C function, must not thrown C++ exceptions. + * + * \sa DLPackExchangeAPI, DLPackCurrentWorkStream + */ +typedef int (*DLPackManagedTensorFromPyObjectNoSync)( + void* py_object, DLManagedTensorVersioned** out); + +/*! + * \brief Exports a PyObject* Tensor/NDArray to a provided DLTensor. + * + * This function provides a faster interface for temporary, non-owning, exchange. + * The producer (implementer) still owns the memory of data, strides, shape. + * The liveness of the DLTensor and the data it views is only guaranteed until + * control is returned. + * + * This function currently assumes that the producer (implementer) can fill + * in the DLTensor shape and strides without the need for temporary allocations. + * + * This function does not perform any stream synchronization. The consumer should query + * DLPackCurrentWorkStream to get the current work stream and launch kernels on it. + * + * This function is exposed by the framework through the DLPackExchangeAPI. + * + * \param py_object The Python object to convert. Must have the same type + * as the one the `DLPackExchangeAPI` was discovered from. + * \param out The output DLTensor, whose space is pre-allocated on stack. + * \return 0 on success, -1 on failure with a Python exception set. + * \note - As a C function, must not thrown C++ exceptions. + * + * \sa DLPackExchangeAPI, DLPackCurrentWorkStream + */ +typedef int (*DLPackDLTensorFromPyObjectNoSync)(void* py_object, DLTensor* out); + +/*! + * \brief Obtain the current work stream of a device. + * + * Obtain the current work stream of a device from the producer framework. + * For example, it should map to torch.cuda.current_stream in PyTorch. + * + * When device_type is kDLCPU, the consumer do not have to query the stream + * and the producer can simply return NULL when queried. + * The consumer do not have to do anything on stream sync or setting. + * So CPU only framework can just provide a dummy implementation that + * always set out_current_stream[0] to NULL. + * + * \param device_type The device type. + * \param device_id The device id. + * \param out_current_stream The output current work stream. + * + * \return 0 on success, -1 on failure with a Python exception set. + * \note - As a C function, must not thrown C++ exceptions. + * + * \sa DLPackExchangeAPI + */ +typedef int (*DLPackCurrentWorkStream)( + DLDeviceType device_type, int32_t device_id, void** out_current_stream); + +/*! + * \brief Imports a DLManagedTensorVersioned to a PyObject* Tensor/NDArray. + * + * Convert an owning DLManagedTensorVersioned* to the Python tensor of the + * producer (implementer) library with the correct type. + * + * This function does not perform any stream synchronization. + * + * This function is exposed by the framework through the DLPackExchangeAPI. + * + * \param tensor The DLManagedTensorVersioned to convert the ownership of the + * tensor is stolen. + * \param out_py_object The output Python object. + * \return 0 on success, -1 on failure with a Python exception set. + * + * \sa DLPackExchangeAPI + */ +typedef int (*DLPackManagedTensorToPyObjectNoSync)( + DLManagedTensorVersioned* tensor, void** out_py_object); + +/*! + * \brief DLPackExchangeAPI stable header. + * \sa DLPackExchangeAPI + */ +typedef struct DLPackExchangeAPIHeader { + /*! + * \brief The provided DLPack version the consumer must check major version + * compatibility before using this struct. + */ + DLPackVersion version; + /*! + * \brief Optional pointer to an older DLPackExchangeAPI in the chain. + * + * It must be NULL if the framework does not support older versions. + * If the current major version is larger than the one supported by the + * consumer, the consumer may walk this to find an earlier supported version. + * + * \sa DLPackExchangeAPI + */ + struct DLPackExchangeAPIHeader* prev_api; +} DLPackExchangeAPIHeader; + +/*! + * \brief Framework-specific function pointers table for DLPack exchange. + * + * Additionally to `__dlpack__()` we define a C function table sharable by + * Python implementations via `__dlpack_c_exchange_api__`. + * This attribute must be set on the type as a Python PyCapsule + * with name "dlpack_exchange_api". + * + * Note that this must be defined on the type. The consumer should look up the + * attribute on the type and may cache the result for each unique type. + * + * Array/Tensor libraries should statically create and initialize this structure + * then return a pointer to DLPackExchangeAPI as an int value in Tensor/Array. + * The DLPackExchangeAPI* must stay alive throughout the lifetime of the process. + */ +typedef struct DLPackExchangeAPI { + /*! + * \brief The header that remains stable across versions. + */ + DLPackExchangeAPIHeader header; + /*! + * \brief Producer function pointer for DLPackManagedTensorAllocator. + * This function must not be NULL. + */ + DLPackManagedTensorAllocator managed_tensor_allocator; + /*! + * \brief Producer function pointer for DLPackManagedTensorFromPyObjectNoSync. + * This function must not be NULL. + */ + DLPackManagedTensorFromPyObjectNoSync managed_tensor_from_py_object_no_sync; + /*! + * \brief Producer function pointer for DLPackManagedTensorToPyObjectNoSync. + * This function must not be NULL. + */ + DLPackManagedTensorToPyObjectNoSync managed_tensor_to_py_object_no_sync; + /*! + * \brief Producer function pointer for DLPackDLTensorFromPyObjectNoSync. + * This function can be NULL when the producer does not support this function. + */ + DLPackDLTensorFromPyObjectNoSync dltensor_from_py_object_no_sync; + /*! + * \brief Producer function pointer for DLPackCurrentWorkStream. + * This function must not be NULL. + */ + DLPackCurrentWorkStream current_work_stream; +} DLPackExchangeAPI; + +#ifdef __cplusplus +} // DLPACK_EXTERN_C +#endif +#endif // DLPACK_DLPACK_H_ diff --git a/cuda_core/cuda/core/_include/layout.hpp b/cuda_core/cuda/core/_include/layout.hpp new file mode 100644 index 00000000000..b5da219df34 --- /dev/null +++ b/cuda_core/cuda/core/_include/layout.hpp @@ -0,0 +1,46 @@ +// SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. +// All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +#ifndef CUDA_CORE_LAYOUT_HPP +#define CUDA_CORE_LAYOUT_HPP + +#include +#include +#include +#include + +#define STRIDED_LAYOUT_MAX_NDIM 64 +#define AXES_MASK_ALL 0xFFFFFFFFFFFFFFFEULL + +inline int64_t _c_abs(int64_t x) { return std::abs(x); } + +template +void _swap(T &a, T &b) noexcept { std::swap(a, b); } + +inline void _order_from_strides(std::vector &indices, const int64_t *shape, + const int64_t *strides, int ndim) +{ + indices.resize(ndim); + std::iota(indices.begin(), indices.end(), 0); + if (!strides) + { + return; + } + std::sort(indices.begin(), indices.end(), [&strides, &shape](int i, int j) + { + int64_t stride_i = _c_abs(strides[i]); + int64_t stride_j = _c_abs(strides[j]); + if (stride_i != stride_j) { + return stride_i > stride_j; + } + int64_t shape_i = shape[i]; + int64_t shape_j = shape[j]; + if (shape_i != shape_j) { + return shape_i > shape_j; + } + return i < j; }); +} + +#endif // CUDA_CORE_LAYOUT_HPP diff --git a/cuda_core/cuda/core/_include/utility.hpp b/cuda_core/cuda/core/_include/utility.hpp new file mode 100644 index 00000000000..64b357ac324 --- /dev/null +++ b/cuda_core/cuda/core/_include/utility.hpp @@ -0,0 +1,23 @@ +// SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +#pragma once + +#include + +// In cuda.bindings 12.8, the private member name was renamed from "_ptr" to "_pvt_ptr". +// We want to have the C++ layer supporting all past 12.x versions, so some tricks are needed. +// Since there's no std::has_member so we use SFINAE to create the same effect. + +template ::_pvt_ptr)>, int> = 0> +inline auto& get_cuda_native_handle(const T& obj) { + return *(obj->_pvt_ptr); +} + +template ::_ptr)>, int> = 0> +inline auto& get_cuda_native_handle(const T& obj) { + return *(obj->_ptr); +} diff --git a/cuda_core/cuda/core/_kernel_arg_handler.pxd b/cuda_core/cuda/core/_kernel_arg_handler.pxd new file mode 100644 index 00000000000..ac84743a305 --- /dev/null +++ b/cuda_core/cuda/core/_kernel_arg_handler.pxd @@ -0,0 +1,15 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from libc.stdint cimport intptr_t +from libcpp cimport vector + + +cdef class ParamHolder: + + cdef: + vector.vector[void*] data + vector.vector[void*] data_addresses + object kernel_args + readonly intptr_t ptr diff --git a/cuda_core/cuda/core/_kernel_arg_handler.pyi b/cuda_core/cuda/core/_kernel_arg_handler.pyi new file mode 100644 index 00000000000..0ebd2c0d0b6 --- /dev/null +++ b/cuda_core/cuda/core/_kernel_arg_handler.pyi @@ -0,0 +1,18 @@ +# This file was generated by stubgen-pyx v0.2.6 from cuda_core/cuda/core/_kernel_arg_handler.pyx + +from __future__ import annotations + +from typing import Any, Sequence + +from libcpp.complex import complex as cpp_complex + + +class ParamHolder: + + def __init__(self, kernel_args: Sequence[Any]) -> None: + ... + + def __dealloc__(self) -> None: + ... +cpp_single_complex = cpp_complex.complex +cpp_double_complex = cpp_complex.complex \ No newline at end of file diff --git a/cuda_core/cuda/core/_kernel_arg_handler.pyx b/cuda_core/cuda/core/_kernel_arg_handler.pyx new file mode 100644 index 00000000000..9fa5d47e336 --- /dev/null +++ b/cuda_core/cuda/core/_kernel_arg_handler.pyx @@ -0,0 +1,365 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from cpython.mem cimport PyMem_Malloc, PyMem_Free +from libc.stdint cimport (intptr_t, + int8_t, int16_t, int32_t, int64_t, + uint8_t, uint16_t, uint32_t, uint64_t,) +from libcpp cimport bool as cpp_bool +from libcpp.complex cimport complex as cpp_complex +from libcpp cimport nullptr +from libcpp cimport vector + +import ctypes +from typing import Sequence, Any + +import numpy + +from cuda.core._memory import Buffer +from cuda.core._tensor_map import TensorMapDescriptor as _TensorMapDescriptor_py +from cuda.core._tensor_map cimport TensorMapDescriptor +from cuda.core.graph._graph_definition cimport GraphCondition +from cuda.core._utils.cuda_utils import driver +from cuda.bindings cimport cydriver + + +ctypedef cpp_complex.complex[float] cpp_single_complex +ctypedef cpp_complex.complex[double] cpp_double_complex + + +# We need an identifier for fp16 for copying scalars on the host. This is a minimal +# implementation borrowed from cuda_fp16.h. +cdef extern from *: + """ + #if __cplusplus >= 201103L + #define __CUDA_ALIGN__(n) alignas(n) /* C++11 kindly gives us a keyword for this */ + #else + #if defined(__GNUC__) + #define __CUDA_ALIGN__(n) __attribute__ ((aligned(n))) + #elif defined(_MSC_VER) + #define __CUDA_ALIGN__(n) __declspec(align(n)) + #else + #define __CUDA_ALIGN__(n) + #endif /* defined(__GNUC__) */ + #endif /* __cplusplus >= 201103L */ + + typedef struct __CUDA_ALIGN__(2) { + /** + * Storage field contains bits representation of the \p half floating-point number. + */ + unsigned short x; + } __half_raw; + """ + ctypedef struct __half_raw: + unsigned short x + + +ctypedef fused supported_type: + cpp_bool + int8_t + int16_t + int32_t + int64_t + uint8_t + uint16_t + uint32_t + uint64_t + __half_raw + float + double + intptr_t + cpp_single_complex + cpp_double_complex + + +# cache ctypes/numpy type objects to avoid attribute access +cdef object ctypes_bool = ctypes.c_bool +cdef object ctypes_int8 = ctypes.c_int8 +cdef object ctypes_int16 = ctypes.c_int16 +cdef object ctypes_int32 = ctypes.c_int32 +cdef object ctypes_int64 = ctypes.c_int64 +cdef object ctypes_uint8 = ctypes.c_uint8 +cdef object ctypes_uint16 = ctypes.c_uint16 +cdef object ctypes_uint32 = ctypes.c_uint32 +cdef object ctypes_uint64 = ctypes.c_uint64 +cdef object ctypes_float = ctypes.c_float +cdef object ctypes_double = ctypes.c_double +cdef object numpy_bool = numpy.bool_ +cdef object numpy_int8 = numpy.int8 +cdef object numpy_int16 = numpy.int16 +cdef object numpy_int32 = numpy.int32 +cdef object numpy_int64 = numpy.int64 +cdef object numpy_uint8 = numpy.uint8 +cdef object numpy_uint16 = numpy.uint16 +cdef object numpy_uint32 = numpy.uint32 +cdef object numpy_uint64 = numpy.uint64 +cdef object numpy_float16 = numpy.float16 +cdef object numpy_float32 = numpy.float32 +cdef object numpy_float64 = numpy.float64 +cdef object numpy_complex64 = numpy.complex64 +cdef object numpy_complex128 = numpy.complex128 + + +cdef object tensor_map_descriptor_type = _TensorMapDescriptor_py + + +# limitation due to cython/cython#534 +ctypedef void* voidptr + + +# Cython can't infer the overload without at least one input argument with fused type +cdef inline int prepare_arg( + vector.vector[void*]& data, + vector.vector[void*]& data_addresses, + arg, # important: keep it a Python object and don't cast + const size_t idx, + const supported_type* __unused=NULL) except -1: + cdef void* ptr = PyMem_Malloc(sizeof(supported_type)) + # note: this should also work once ctypes has complex support: + # python/cpython#121248 + if supported_type is cpp_single_complex: + (ptr)[0] = cpp_complex.complex[float](arg.real, arg.imag) + elif supported_type is cpp_double_complex: + (ptr)[0] = cpp_complex.complex[double](arg.real, arg.imag) + elif supported_type is __half_raw: + (ptr).x = (arg.view(numpy_int16)) + else: + (ptr)[0] = (arg) + data_addresses[idx] = ptr # take the address to the scalar + data[idx] = ptr # for later dealloc + return 0 + + +cdef inline int prepare_tensor_map_arg( + vector.vector[void*]& data, + vector.vector[void*]& data_addresses, + TensorMapDescriptor arg, + const size_t idx) except -1: + # cuLaunchKernel copies argument bytes during launch, so a TensorMap + # descriptor can point directly at its internal CUtensorMap storage. + data_addresses[idx] = arg._get_data_ptr() + return 0 + + +cdef inline int prepare_ctypes_arg( + vector.vector[void*]& data, + vector.vector[void*]& data_addresses, + arg, + const size_t idx) except -1: + cdef object arg_type = type(arg) + if arg_type is ctypes_bool: + return prepare_arg[cpp_bool](data, data_addresses, arg.value, idx) + elif arg_type is ctypes_int8: + return prepare_arg[int8_t](data, data_addresses, arg.value, idx) + elif arg_type is ctypes_int16: + return prepare_arg[int16_t](data, data_addresses, arg.value, idx) + elif arg_type is ctypes_int32: + return prepare_arg[int32_t](data, data_addresses, arg.value, idx) + elif arg_type is ctypes_int64: + return prepare_arg[int64_t](data, data_addresses, arg.value, idx) + elif arg_type is ctypes_uint8: + return prepare_arg[uint8_t](data, data_addresses, arg.value, idx) + elif arg_type is ctypes_uint16: + return prepare_arg[uint16_t](data, data_addresses, arg.value, idx) + elif arg_type is ctypes_uint32: + return prepare_arg[uint32_t](data, data_addresses, arg.value, idx) + elif arg_type is ctypes_uint64: + return prepare_arg[uint64_t](data, data_addresses, arg.value, idx) + elif arg_type is ctypes_float: + return prepare_arg[float](data, data_addresses, arg.value, idx) + elif arg_type is ctypes_double: + return prepare_arg[double](data, data_addresses, arg.value, idx) + else: + # If no exact types are found, fallback to slower `isinstance` check + if isinstance(arg, ctypes_bool): + return prepare_arg[cpp_bool](data, data_addresses, arg.value, idx) + elif isinstance(arg, ctypes_int8): + return prepare_arg[int8_t](data, data_addresses, arg.value, idx) + elif isinstance(arg, ctypes_int16): + return prepare_arg[int16_t](data, data_addresses, arg.value, idx) + elif isinstance(arg, ctypes_int32): + return prepare_arg[int32_t](data, data_addresses, arg.value, idx) + elif isinstance(arg, ctypes_int64): + return prepare_arg[int64_t](data, data_addresses, arg.value, idx) + elif isinstance(arg, ctypes_uint8): + return prepare_arg[uint8_t](data, data_addresses, arg.value, idx) + elif isinstance(arg, ctypes_uint16): + return prepare_arg[uint16_t](data, data_addresses, arg.value, idx) + elif isinstance(arg, ctypes_uint32): + return prepare_arg[uint32_t](data, data_addresses, arg.value, idx) + elif isinstance(arg, ctypes_uint64): + return prepare_arg[uint64_t](data, data_addresses, arg.value, idx) + elif isinstance(arg, ctypes_float): + return prepare_arg[float](data, data_addresses, arg.value, idx) + elif isinstance(arg, ctypes_double): + return prepare_arg[double](data, data_addresses, arg.value, idx) + else: + return 1 + + +cdef inline int prepare_numpy_arg( + vector.vector[void*]& data, + vector.vector[void*]& data_addresses, + arg, + const size_t idx) except -1: + cdef object arg_type = type(arg) + if arg_type is numpy_bool: + return prepare_arg[cpp_bool](data, data_addresses, arg, idx) + elif arg_type is numpy_int8: + return prepare_arg[int8_t](data, data_addresses, arg, idx) + elif arg_type is numpy_int16: + return prepare_arg[int16_t](data, data_addresses, arg, idx) + elif arg_type is numpy_int32: + return prepare_arg[int32_t](data, data_addresses, arg, idx) + elif arg_type is numpy_int64: + return prepare_arg[int64_t](data, data_addresses, arg, idx) + elif arg_type is numpy_uint8: + return prepare_arg[uint8_t](data, data_addresses, arg, idx) + elif arg_type is numpy_uint16: + return prepare_arg[uint16_t](data, data_addresses, arg, idx) + elif arg_type is numpy_uint32: + return prepare_arg[uint32_t](data, data_addresses, arg, idx) + elif arg_type is numpy_uint64: + return prepare_arg[uint64_t](data, data_addresses, arg, idx) + elif arg_type is numpy_float16: + return prepare_arg[__half_raw](data, data_addresses, arg, idx) + elif arg_type is numpy_float32: + return prepare_arg[float](data, data_addresses, arg, idx) + elif arg_type is numpy_float64: + return prepare_arg[double](data, data_addresses, arg, idx) + elif arg_type is numpy_complex64: + return prepare_arg[cpp_single_complex](data, data_addresses, arg, idx) + elif arg_type is numpy_complex128: + return prepare_arg[cpp_double_complex](data, data_addresses, arg, idx) + else: + # If no exact types are found, fallback to slower `isinstance` check + if isinstance(arg, numpy_bool): + return prepare_arg[cpp_bool](data, data_addresses, arg, idx) + elif isinstance(arg, numpy_int8): + return prepare_arg[int8_t](data, data_addresses, arg, idx) + elif isinstance(arg, numpy_int16): + return prepare_arg[int16_t](data, data_addresses, arg, idx) + elif isinstance(arg, numpy_int32): + return prepare_arg[int32_t](data, data_addresses, arg, idx) + elif isinstance(arg, numpy_int64): + return prepare_arg[int64_t](data, data_addresses, arg, idx) + elif isinstance(arg, numpy_uint8): + return prepare_arg[uint8_t](data, data_addresses, arg, idx) + elif isinstance(arg, numpy_uint16): + return prepare_arg[uint16_t](data, data_addresses, arg, idx) + elif isinstance(arg, numpy_uint32): + return prepare_arg[uint32_t](data, data_addresses, arg, idx) + elif isinstance(arg, numpy_uint64): + return prepare_arg[uint64_t](data, data_addresses, arg, idx) + elif isinstance(arg, numpy_float16): + return prepare_arg[__half_raw](data, data_addresses, arg, idx) + elif isinstance(arg, numpy_float32): + return prepare_arg[float](data, data_addresses, arg, idx) + elif isinstance(arg, numpy_float64): + return prepare_arg[double](data, data_addresses, arg, idx) + elif isinstance(arg, numpy_complex64): + return prepare_arg[cpp_single_complex](data, data_addresses, arg, idx) + elif isinstance(arg, numpy_complex128): + return prepare_arg[cpp_double_complex](data, data_addresses, arg, idx) + else: + return 1 + + +cdef class ParamHolder: + + def __init__(self, kernel_args: Sequence[Any]) -> None: + if len(kernel_args) == 0: + self.ptr = 0 + return + + cdef size_t n_args = len(kernel_args) + cdef size_t i + cdef int not_prepared + cdef object arg_type + self.data = vector.vector[voidptr](n_args, nullptr) + self.data_addresses = vector.vector[voidptr](n_args) + for i, arg in enumerate(kernel_args): + arg_type = type(arg) + if arg_type is Buffer: + # we need the address of where the actual buffer address is stored + if type(arg.handle) is int: + # see note below on handling int arguments + prepare_arg[intptr_t](self.data, self.data_addresses, arg.handle, i) + continue + else: + # it's a CUdeviceptr: + self.data_addresses[i] = (arg.handle.getPtr()) + continue + elif arg_type is bool: + prepare_arg[cpp_bool](self.data, self.data_addresses, arg, i) + continue + elif arg_type is int: + # Here's the dilemma: We want to have a fast path to pass in Python + # integers as pointer addresses, but one could also (mistakenly) pass + # it with the intention of passing a scalar integer. It's a mistake + # bacause a Python int is ambiguous (arbitrary width). Our judgement + # call here is to treat it as a pointer address, without any warning! + prepare_arg[intptr_t](self.data, self.data_addresses, arg, i) + continue + elif arg_type is float: + prepare_arg[double](self.data, self.data_addresses, arg, i) + continue + elif arg_type is complex: + prepare_arg[cpp_double_complex](self.data, self.data_addresses, arg, i) + continue + elif arg_type is tensor_map_descriptor_type: + prepare_tensor_map_arg(self.data, self.data_addresses, arg, i) + continue + + not_prepared = prepare_numpy_arg(self.data, self.data_addresses, arg, i) + if not_prepared: + not_prepared = prepare_ctypes_arg(self.data, self.data_addresses, arg, i) + if not_prepared: + # TODO: revisit this treatment if we decide to cythonize cuda.core + if arg_type is driver.CUgraphConditionalHandle: + prepare_arg[cydriver.CUgraphConditionalHandle](self.data, self.data_addresses, int(arg), i) + continue + elif arg_type is GraphCondition: + prepare_arg[cydriver.CUgraphConditionalHandle]( + self.data, self.data_addresses, + (arg)._c_handle, i) + continue + # If no exact types are found, fallback to slower `isinstance` check + elif isinstance(arg, Buffer): + if isinstance(arg.handle, int): + prepare_arg[intptr_t](self.data, self.data_addresses, arg.handle, i) + continue + else: + self.data_addresses[i] = (arg.handle.getPtr()) + continue + elif isinstance(arg, bool): + prepare_arg[cpp_bool](self.data, self.data_addresses, arg, i) + continue + elif isinstance(arg, int): + prepare_arg[intptr_t](self.data, self.data_addresses, arg, i) + continue + elif isinstance(arg, float): + prepare_arg[double](self.data, self.data_addresses, arg, i) + continue + elif isinstance(arg, complex): + prepare_arg[cpp_double_complex](self.data, self.data_addresses, arg, i) + continue + elif isinstance(arg, driver.CUgraphConditionalHandle): + prepare_arg[cydriver.CUgraphConditionalHandle](self.data, self.data_addresses, arg, i) + continue + elif isinstance(arg, GraphCondition): + prepare_arg[cydriver.CUgraphConditionalHandle]( + self.data, self.data_addresses, + (arg)._c_handle, i) + continue + # TODO: support ctypes/numpy struct + raise TypeError("the argument is of unsupported type: " + str(type(arg))) + + self.kernel_args = kernel_args + self.ptr = self.data_addresses.data() + + def __dealloc__(self) -> None: + for data in self.data: + if data: + PyMem_Free(data) diff --git a/cuda_core/cuda/core/_launch_config.pxd b/cuda_core/cuda/core/_launch_config.pxd new file mode 100644 index 00000000000..112007b9cfd --- /dev/null +++ b/cuda_core/cuda/core/_launch_config.pxd @@ -0,0 +1,25 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from libcpp.vector cimport vector + +from cuda.bindings cimport cydriver + + +cdef class LaunchConfig: + """Customizable launch options.""" + cdef: + public tuple grid + public tuple cluster + public tuple block + public int shmem_size + public bint is_cooperative + + vector[cydriver.CUlaunchAttribute] _attrs + object __weakref__ + + cdef cydriver.CUlaunchConfig _to_native_launch_config(self) + + +cpdef object _to_native_launch_config(LaunchConfig config) diff --git a/cuda_core/cuda/core/_launch_config.pyi b/cuda_core/cuda/core/_launch_config.pyi new file mode 100644 index 00000000000..eac16c1878f --- /dev/null +++ b/cuda_core/cuda/core/_launch_config.pyi @@ -0,0 +1,82 @@ +# This file was generated by stubgen-pyx v0.2.6 from cuda_core/cuda/core/_launch_config.pyx + +from __future__ import annotations + +from typing import Any + + +class LaunchConfig: + """Customizable launch options. + + Note + ---- + When cluster is specified, the grid parameter represents the number of + clusters (not blocks). The hierarchy is: grid (clusters) -> cluster (blocks) -> + block (threads). Each dimension in grid specifies clusters in the grid, each dimension in + cluster specifies blocks per cluster, and each dimension in block specifies + threads per block. + + Attributes + ---------- + grid : Union[tuple, int] + Collection of threads that will execute a kernel function. When cluster + is not specified, this represents the number of blocks, otherwise + this represents the number of clusters. + cluster : Union[tuple, int] + Group of blocks (Thread Block Cluster) that will execute on the same + GPU Processing Cluster (GPC). Blocks within a cluster have access to + distributed shared memory and can be explicitly synchronized. + block : Union[tuple, int] + Group of threads (Thread Block) that will execute on the same + streaming multiprocessor (SM). Threads within a thread blocks have + access to shared memory and can be explicitly synchronized. + shmem_size : int, optional + Dynamic shared-memory size per thread block in bytes. + (Default to size 0) + is_cooperative : bool, optional + Whether this config can be used to launch a cooperative kernel. + """ + + def __init__(self, grid: int | tuple[int, ...] | None=None, cluster: int | tuple[int, ...] | None=None, block: int | tuple[int, ...] | None=None, shmem_size: int | None=None, is_cooperative: bool=False) -> None: + """Initialize LaunchConfig with validation. + + Parameters + ---------- + grid : Union[tuple, int], optional + Grid dimensions (number of blocks or clusters if cluster is specified) + cluster : Union[tuple, int], optional + Cluster dimensions (Thread Block Cluster) + block : Union[tuple, int], optional + Block dimensions (threads per block) + shmem_size : int, optional + Dynamic shared memory size in bytes (default: 0) + is_cooperative : bool, optional + Whether to launch as cooperative kernel (default: False) + """ + + def _identity(self) -> tuple[Any, ...]: + ... + + def __repr__(self) -> str: + """Return string representation of LaunchConfig.""" + + def __eq__(self, other: object) -> bool: + ... + + def __hash__(self) -> int: + ... +_LAUNCH_CONFIG_ATTRS = ('grid', 'cluster', 'block', 'shmem_size', 'is_cooperative') + +def _to_native_launch_config(config: LaunchConfig) -> object: + """Convert LaunchConfig to native driver CUlaunchConfig. + + Parameters + ---------- + config : LaunchConfig + High-level launch configuration + + Returns + ------- + driver.CUlaunchConfig + Native CUDA driver launch configuration + """ \ No newline at end of file diff --git a/cuda_core/cuda/core/_launch_config.pyx b/cuda_core/cuda/core/_launch_config.pyx new file mode 100644 index 00000000000..a92ecf1f9e3 --- /dev/null +++ b/cuda_core/cuda/core/_launch_config.pyx @@ -0,0 +1,208 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from libc.string cimport memset + +from typing import Any + +from cuda.core._device import Device +from cuda.core._utils.cuda_utils import ( + CUDAError, + cast_to_3_tuple, + driver, +) + +_LAUNCH_CONFIG_ATTRS = ('grid', 'cluster', 'block', 'shmem_size', 'is_cooperative') + + +cdef class LaunchConfig: + """Customizable launch options. + + Note + ---- + When cluster is specified, the grid parameter represents the number of + clusters (not blocks). The hierarchy is: grid (clusters) -> cluster (blocks) -> + block (threads). Each dimension in grid specifies clusters in the grid, each dimension in + cluster specifies blocks per cluster, and each dimension in block specifies + threads per block. + + Attributes + ---------- + grid : Union[tuple, int] + Collection of threads that will execute a kernel function. When cluster + is not specified, this represents the number of blocks, otherwise + this represents the number of clusters. + cluster : Union[tuple, int] + Group of blocks (Thread Block Cluster) that will execute on the same + GPU Processing Cluster (GPC). Blocks within a cluster have access to + distributed shared memory and can be explicitly synchronized. + block : Union[tuple, int] + Group of threads (Thread Block) that will execute on the same + streaming multiprocessor (SM). Threads within a thread blocks have + access to shared memory and can be explicitly synchronized. + shmem_size : int, optional + Dynamic shared-memory size per thread block in bytes. + (Default to size 0) + is_cooperative : bool, optional + Whether this config can be used to launch a cooperative kernel. + """ + + # TODO: expand LaunchConfig to include other attributes + # Note: attributes are declared in _launch_config.pxd + + def __init__( + self, + grid: int | tuple[int, ...] | None = None, + cluster: int | tuple[int, ...] | None = None, + block: int | tuple[int, ...] | None = None, + shmem_size: int | None = None, + is_cooperative: bool = False, + ) -> None: + """Initialize LaunchConfig with validation. + + Parameters + ---------- + grid : Union[tuple, int], optional + Grid dimensions (number of blocks or clusters if cluster is specified) + cluster : Union[tuple, int], optional + Cluster dimensions (Thread Block Cluster) + block : Union[tuple, int], optional + Block dimensions (threads per block) + shmem_size : int, optional + Dynamic shared memory size in bytes (default: 0) + is_cooperative : bool, optional + Whether to launch as cooperative kernel (default: False) + """ + # Convert and validate grid and block dimensions + self.grid = cast_to_3_tuple("LaunchConfig.grid", grid) + self.block = cast_to_3_tuple("LaunchConfig.block", block) + + # FIXME: Calling Device() strictly speaking is not quite right; we should instead + # look up the device from stream. We probably need to defer the checks related to + # device compute capability or attributes. + # thread block clusters are supported starting H100 + if cluster is not None: + cc = Device().compute_capability + if cc < (9, 0): + raise CUDAError( + f"thread block clusters are not supported on devices with compute capability < 9.0 (got {cc})" + ) + self.cluster = cast_to_3_tuple("LaunchConfig.cluster", cluster) + else: + self.cluster = None + + # Handle shmem_size default + if shmem_size is None: + self.shmem_size = 0 + else: + self.shmem_size = shmem_size + + self.is_cooperative = is_cooperative + + if self.is_cooperative and not Device().properties.cooperative_launch: + raise CUDAError("cooperative kernels are not supported on this device") + + def _identity(self) -> tuple[Any, ...]: + return tuple(getattr(self, attr) for attr in _LAUNCH_CONFIG_ATTRS) + + def __repr__(self) -> str: + """Return string representation of LaunchConfig.""" + parts = ', '.join(f'{attr}={getattr(self, attr)!r}' for attr in _LAUNCH_CONFIG_ATTRS) + return f"LaunchConfig({parts})" + + def __eq__(self, other: object) -> bool: + if not isinstance(other, LaunchConfig): + return NotImplemented + return self._identity() == (other)._identity() + + def __hash__(self) -> int: + return hash(self._identity()) + + cdef cydriver.CUlaunchConfig _to_native_launch_config(self): + cdef cydriver.CUlaunchConfig drv_cfg + cdef cydriver.CUlaunchAttribute attr + memset(&drv_cfg, 0, sizeof(drv_cfg)) + self._attrs.resize(0) + + # Handle grid dimensions and cluster configuration + if self.cluster is not None: + # Convert grid from cluster units to block units + drv_cfg.gridDimX = self.grid[0] * self.cluster[0] + drv_cfg.gridDimY = self.grid[1] * self.cluster[1] + drv_cfg.gridDimZ = self.grid[2] * self.cluster[2] + + # Set up cluster attribute + attr.id = cydriver.CUlaunchAttributeID.CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION + attr.value.clusterDim.x, attr.value.clusterDim.y, attr.value.clusterDim.z = self.cluster + self._attrs.push_back(attr) + else: + drv_cfg.gridDimX, drv_cfg.gridDimY, drv_cfg.gridDimZ = self.grid + + drv_cfg.blockDimX, drv_cfg.blockDimY, drv_cfg.blockDimZ = self.block + drv_cfg.sharedMemBytes = self.shmem_size + + if self.is_cooperative: + attr.id = cydriver.CUlaunchAttributeID.CU_LAUNCH_ATTRIBUTE_COOPERATIVE + attr.value.cooperative = 1 + self._attrs.push_back(attr) + + drv_cfg.numAttrs = self._attrs.size() + drv_cfg.attrs = self._attrs.data() + + return drv_cfg + + +# TODO: once all modules are cythonized, this function can be dropped in favor of the cdef method above +cpdef object _to_native_launch_config(LaunchConfig config): + """Convert LaunchConfig to native driver CUlaunchConfig. + + Parameters + ---------- + config : LaunchConfig + High-level launch configuration + + Returns + ------- + driver.CUlaunchConfig + Native CUDA driver launch configuration + """ + cdef object drv_cfg = driver.CUlaunchConfig() + cdef list attrs + cdef object attr + cdef object dim + cdef tuple grid_blocks + + # Handle grid dimensions and cluster configuration + if config.cluster is not None: + # Convert grid from cluster units to block units + grid_blocks = ( + config.grid[0] * config.cluster[0], + config.grid[1] * config.cluster[1], + config.grid[2] * config.cluster[2], + ) + drv_cfg.gridDimX, drv_cfg.gridDimY, drv_cfg.gridDimZ = grid_blocks + + # Set up cluster attribute + attr = driver.CUlaunchAttribute() + attr.id = driver.CUlaunchAttributeID.CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION + dim = attr.value.clusterDim + dim.x, dim.y, dim.z = config.cluster + attrs = [attr] + else: + drv_cfg.gridDimX, drv_cfg.gridDimY, drv_cfg.gridDimZ = config.grid + attrs = [] + + drv_cfg.blockDimX, drv_cfg.blockDimY, drv_cfg.blockDimZ = config.block + drv_cfg.sharedMemBytes = config.shmem_size + + if config.is_cooperative: + attr = driver.CUlaunchAttribute() + attr.id = driver.CUlaunchAttributeID.CU_LAUNCH_ATTRIBUTE_COOPERATIVE + attr.value.cooperative = 1 + attrs.append(attr) + + drv_cfg.numAttrs = len(attrs) + drv_cfg.attrs = attrs + + return drv_cfg diff --git a/cuda_core/cuda/core/_launcher.pyi b/cuda_core/cuda/core/_launcher.pyi new file mode 100644 index 00000000000..a292c3eec95 --- /dev/null +++ b/cuda_core/cuda/core/_launcher.pyi @@ -0,0 +1,30 @@ +# This file was generated by stubgen-pyx v0.2.6 from cuda_core/cuda/core/_launcher.pyx + +from __future__ import annotations + +from cuda.core._launch_config import LaunchConfig +from cuda.core._module import Kernel +from cuda.core._stream import Stream +from cuda.core.graph import GraphBuilder +from cuda.core.typing import IsStreamType + + +def launch(stream: Stream | GraphBuilder | IsStreamType, config: LaunchConfig, kernel: Kernel, *kernel_args) -> None: + """Launches a :obj:`~_module.Kernel` + object with launch-time configuration. + + Parameters + ---------- + stream : :obj:`~_stream.Stream` | :obj:`~graph.GraphBuilder` + The stream establishing the stream ordering semantic of a + launch. + config : :obj:`LaunchConfig` + Launch configurations inline with options provided by + :obj:`~_launcher.LaunchConfig` dataclass. + kernel : :obj:`~_module.Kernel` + Kernel to launch. + *kernel_args : Any + Variable length argument list that is provided to the + launching kernel. + + """ \ No newline at end of file diff --git a/cuda_core/cuda/core/_launcher.pyx b/cuda_core/cuda/core/_launcher.pyx new file mode 100644 index 00000000000..d5ddaff4d56 --- /dev/null +++ b/cuda_core/cuda/core/_launcher.pyx @@ -0,0 +1,81 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from libc.stdint cimport uintptr_t + +from cuda.bindings cimport cydriver + +from cuda.core._launch_config cimport LaunchConfig +from cuda.core._kernel_arg_handler cimport ParamHolder +from cuda.core._module cimport Kernel +from cuda.core._resource_handles cimport as_cu +from cuda.core._stream cimport Stream_accept, Stream +from cuda.core._utils.cuda_utils cimport ( + check_or_create_options, + HANDLE_RETURN, +) +from cuda.core._module import Kernel +from cuda.core._stream import Stream +from math import prod +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from cuda.core.graph import GraphBuilder + from cuda.core.typing import IsStreamType + + +def launch( + stream: Stream | GraphBuilder | IsStreamType, + config: LaunchConfig, + kernel: Kernel, + *kernel_args +) -> None: + """Launches a :obj:`~_module.Kernel` + object with launch-time configuration. + + Parameters + ---------- + stream : :obj:`~_stream.Stream` | :obj:`~graph.GraphBuilder` + The stream establishing the stream ordering semantic of a + launch. + config : :obj:`LaunchConfig` + Launch configurations inline with options provided by + :obj:`~_launcher.LaunchConfig` dataclass. + kernel : :obj:`~_module.Kernel` + Kernel to launch. + *kernel_args : Any + Variable length argument list that is provided to the + launching kernel. + + """ + cdef Stream s = Stream_accept(stream, allow_stream_protocol=True) + cdef LaunchConfig conf = check_or_create_options(LaunchConfig, config, "launch config") + + # TODO: can we ensure kernel_args is valid/safe to use here? + # TODO: merge with HelperKernelParams? + cdef ParamHolder ker_args = ParamHolder(kernel_args) + cdef void** args_ptr = (ker_args.ptr) + + cdef Kernel ker = kernel + cdef cydriver.CUfunction func_handle = as_cu(ker._h_kernel) + + drv_cfg = conf._to_native_launch_config() + drv_cfg.hStream = as_cu(s._h_stream) + if conf.is_cooperative: + _check_cooperative_launch(kernel, conf, s) + with nogil: + HANDLE_RETURN(cydriver.cuLaunchKernelEx(&drv_cfg, func_handle, args_ptr, NULL)) + + +cdef _check_cooperative_launch(kernel: Kernel, config: LaunchConfig, stream: Stream): + dev = stream.device + num_sm = dev.properties.multiprocessor_count + max_grid_size = ( + kernel.occupancy.max_active_blocks_per_multiprocessor(prod(config.block), config.shmem_size) * num_sm + ) + if prod(config.grid) > max_grid_size: + # For now let's try not to be smart and adjust the grid size behind users' back. + # We explicitly ask users to adjust. + x, y, z = config.grid + raise ValueError(f"The specified grid size ({x} * {y} * {z}) exceeds the limit ({max_grid_size})") diff --git a/cuda_core/cuda/core/_layout.pxd b/cuda_core/cuda/core/_layout.pxd new file mode 100644 index 00000000000..8e2ead82a64 --- /dev/null +++ b/cuda_core/cuda/core/_layout.pxd @@ -0,0 +1,685 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +cimport cython +from cython.operator cimport dereference as deref + +from libc.stdint cimport int64_t, int32_t, uint32_t, uint64_t, intptr_t +from libcpp cimport vector + +ctypedef int64_t extent_t +ctypedef int64_t stride_t +ctypedef int32_t axis_t + +ctypedef uint64_t axes_mask_t # MUST be exactly STRIDED_LAYOUT_MAX_NDIM bits wide +ctypedef uint32_t property_mask_t + +ctypedef vector.vector[stride_t] extents_strides_t +ctypedef vector.vector[axis_t] axis_vec_t + +from cuda.core._utils cimport cuda_utils + + +ctypedef fused integer_t: + int64_t + int32_t + + +cdef extern from "_include/layout.hpp": + + cdef int STRIDED_LAYOUT_MAX_NDIM + cdef axes_mask_t AXES_MASK_ALL + int64_t _c_abs(int64_t x) nogil + void _order_from_strides(axis_vec_t& indices, extent_t* extent_t, stride_t* stride_t, int ndim) except + nogil + void _swap(extents_strides_t &a, extents_strides_t &b) noexcept nogil + void _swap(int64_t* a, int64_t* b) noexcept nogil + void _swap(int a, int b) noexcept nogil + void _swap(axis_vec_t &a, axis_vec_t &b) noexcept nogil + + +cdef enum OrderFlag: + ORDER_NONE = 0 + ORDER_C = 1 + ORDER_F = 2 + ORDER_PERM = 3 + + +cdef enum Property: + PROP_IS_UNIQUE = 1 << 0 + PROP_IS_CONTIGUOUS_C = 1 << 1 + PROP_IS_CONTIGUOUS_F = 1 << 2 + PROP_IS_CONTIGUOUS_ANY = 1 << 3 + PROP_IS_DENSE = 1 << 4 + PROP_OFFSET_BOUNDS = 1 << 5 + PROP_REQUIRED_SIZE_IN_BYTES = 1 << 6 + PROP_SHAPE = 1 << 7 + PROP_STRIDES = 1 << 8 + PROP_STRIDES_IN_BYTES = 1 << 9 + PROP_STRIDE_ORDER = 1 << 10 + PROP_VOLUME = 1 << 11 + + +cdef struct BaseLayout: + # A struct holding the shape and strides for the layout. + # Use ``init_base_layout`` to initialize the layout, it will + # set the ``shape`` and ``strides`` pointers to point to + # ndim contigious integer arrays. + # The ``shape`` pointer must not be NULL, the ``strides`` can be + # set to NULL by the user to indicate C-contiguous layout. + # Uses single _mem allocation to reduce overhead + # (allocation and exceptions checks). + + extents_strides_t _mem + extent_t* shape + stride_t* strides + int ndim + + +@cython.final +cdef class _StridedLayout: + + # Definition + cdef: + BaseLayout base + + readonly: + int itemsize + stride_t slice_offset + + # Lazy properties computed from the defining values. + cdef: + # Set to 0 to invalidate all properties, + # whenever a defining value is changed + property_mask_t _prop_mask + + # C and Python properties + property_mask_t _boolean_props + int64_t _required_size_in_bytes + stride_t _min_offset + stride_t _max_offset + int64_t _volume + + # Python properties + tuple _py_shape + tuple _py_strides + tuple _py_strides_in_bytes + tuple _py_stride_order + + # ============================== + # Initialization + # ============================== + + cdef inline int _init(_StridedLayout self, BaseLayout& base, int itemsize, bint divide_strides=False) except -1 nogil: + if itemsize <= 0: + raise ValueError("itemsize must be positive") + + if base.strides != NULL and divide_strides: + _divide_strides(base, itemsize) + + self.itemsize = itemsize + self.slice_offset = 0 + + _swap_layout(self.base, base) + return 0 + + cdef inline stride_t _init_dense(_StridedLayout self, BaseLayout& base, int itemsize, OrderFlag order_flag, axis_vec_t* stride_order=NULL) except -1 nogil: + if itemsize <= 0: + raise ValueError("itemsize must be positive") + + cdef stride_t volume + if order_flag == ORDER_C: + volume = _dense_strides_c(base) + elif order_flag == ORDER_F: + volume = _dense_strides_f(base) + elif order_flag == ORDER_PERM: + if stride_order == NULL: + raise ValueError("stride_order is required for ORDER_PERM") + volume = _dense_strides_in_order(base, deref(stride_order)) + else: + raise ValueError("The stride_order must be 'C', 'F', or a permutation.") + + self.itemsize = itemsize + self.slice_offset = 0 + _swap_layout(self.base, base) + self._volume = volume + _mark_property_valid(self, PROP_VOLUME) + return 0 + + cdef inline int init_from_ptr(_StridedLayout self, int ndim, extent_t* shape, stride_t* strides, int itemsize, bint divide_strides=False) except -1 nogil: + cdef BaseLayout base + _init_base_layout_from_ptr(base, ndim, shape, strides) + return self._init(base, itemsize, divide_strides) + + cdef inline int init_dense_from_ptr(_StridedLayout self, int ndim, extent_t* shape, int itemsize, OrderFlag order_flag, axis_vec_t* stride_order=NULL) except -1 nogil: + cdef BaseLayout base + _init_base_layout_from_ptr(base, ndim, shape, NULL) + return self._init_dense(base, itemsize, order_flag, stride_order) + + cdef inline int init_from_tuple(_StridedLayout self, tuple shape, tuple strides, int itemsize, bint divide_strides=False) except -1: + cdef BaseLayout base + _init_base_layout_from_tuple(base, shape, strides) + return self._init(base, itemsize, divide_strides) + + cdef inline int init_dense_from_tuple(_StridedLayout self, tuple shape, int itemsize, object stride_order) except -1: + cdef axis_vec_t stride_order_vec + cdef OrderFlag order_flag = _stride_order2vec(stride_order_vec, stride_order) + + if order_flag == ORDER_NONE: + raise ValueError(f"The stride_order must be 'C', 'F', or a permutation tuple. Got: {stride_order}") + + cdef BaseLayout base + _init_base_layout_from_tuple(base, shape, None) + return self._init_dense(base, itemsize, order_flag, &stride_order_vec) + + # ============================== + # Properties + # ============================== + + cdef inline tuple get_shape_tuple(_StridedLayout self): + if not _has_valid_property(self, PROP_SHAPE): + self._py_shape = cuda_utils.carray_integer_t_to_tuple(self.base.shape, self.base.ndim) + _mark_property_valid(self, PROP_SHAPE) + return self._py_shape + + cdef inline tuple get_strides_tuple(_StridedLayout self): + if not _has_valid_property(self, PROP_STRIDES): + if self.base.strides == NULL: + self._py_strides = None + else: + self._py_strides = cuda_utils.carray_integer_t_to_tuple(self.base.strides, self.base.ndim) + _mark_property_valid(self, PROP_STRIDES) + return self._py_strides + + cdef inline int get_strides_in_bytes(_StridedLayout self, extents_strides_t& strides) except -1 nogil: + if self.base.strides != NULL: + strides.resize(self.base.ndim) + for i in range(self.base.ndim): + strides[i] = _overflow_checked_mul(self.base.strides[i], self.itemsize) + return 0 + + cdef inline tuple get_strides_in_bytes_tuple(_StridedLayout self): + if _has_valid_property(self, PROP_STRIDES_IN_BYTES): + return self._py_strides_in_bytes + cdef extents_strides_t strides + if self.base.strides == NULL: + self._py_strides_in_bytes = None + else: + self.get_strides_in_bytes(strides) + self._py_strides_in_bytes = cuda_utils.carray_integer_t_to_tuple(strides.data(), strides.size()) + _mark_property_valid(self, PROP_STRIDES_IN_BYTES) + return self._py_strides_in_bytes + + cdef inline int64_t get_volume(_StridedLayout self) except -1 nogil: + if not _has_valid_property(self, PROP_VOLUME): + self._volume = _volume(self.base) + _mark_property_valid(self, PROP_VOLUME) + return self._volume + + cdef inline int get_stride_order(_StridedLayout self, axis_vec_t& stride_order) except -1 nogil: + _order_from_strides(stride_order, self.base.shape, self.base.strides, self.base.ndim) + return 0 + + cdef inline tuple get_stride_order_tuple(_StridedLayout self): + if _has_valid_property(self, PROP_STRIDE_ORDER): + return self._py_stride_order + cdef axis_vec_t stride_order + self.get_stride_order(stride_order) + self._py_stride_order = cuda_utils.carray_integer_t_to_tuple(stride_order.data(), stride_order.size()) + _mark_property_valid(self, PROP_STRIDE_ORDER) + return self._py_stride_order + + cdef inline bint get_is_unique(_StridedLayout self) except -1 nogil: + if _has_valid_property(self, PROP_IS_UNIQUE): + return _boolean_property(self, PROP_IS_UNIQUE) + if self.base.strides == NULL or self.get_volume() == 0: + return _set_boolean_property(self, PROP_IS_UNIQUE, True) + cdef axis_vec_t stride_order + self.get_stride_order(stride_order) + return _set_boolean_property(self, PROP_IS_UNIQUE, _is_unique(self.base, stride_order)) + + cdef inline bint get_is_contiguous_c(_StridedLayout self) except -1 nogil: + if _has_valid_property(self, PROP_IS_CONTIGUOUS_C): + return _boolean_property(self, PROP_IS_CONTIGUOUS_C) + return _set_boolean_property(self, PROP_IS_CONTIGUOUS_C, _is_contiguous_c(self.get_volume(), self.base)) + + cdef inline bint get_is_contiguous_f(_StridedLayout self) except -1 nogil: + if _has_valid_property(self, PROP_IS_CONTIGUOUS_F): + return _boolean_property(self, PROP_IS_CONTIGUOUS_F) + return _set_boolean_property(self, PROP_IS_CONTIGUOUS_F, _is_contiguous_f(self.get_volume(), self.base)) + + cdef inline bint get_is_contiguous_any(_StridedLayout self) except -1 nogil: + if _has_valid_property(self, PROP_IS_CONTIGUOUS_ANY): + return _boolean_property(self, PROP_IS_CONTIGUOUS_ANY) + cdef axis_vec_t stride_order + self.get_stride_order(stride_order) + return _set_boolean_property(self, PROP_IS_CONTIGUOUS_ANY, _is_contiguous_any(self.get_volume(), self.base, stride_order)) + + cdef inline bint get_is_dense(_StridedLayout self) except -1 nogil: + if _has_valid_property(self, PROP_IS_DENSE): + return _boolean_property(self, PROP_IS_DENSE) + return _set_boolean_property(self, PROP_IS_DENSE, self.slice_offset == 0 and self.get_is_contiguous_any()) + + cdef inline int get_offset_bounds(_StridedLayout self, stride_t& min_offset, stride_t& max_offset) except -1 nogil: + if _has_valid_property(self, PROP_OFFSET_BOUNDS): + min_offset = self._min_offset + max_offset = self._max_offset + return 0 + cdef int ndim = self.base.ndim + cdef stride_t stride + cdef extent_t extent + min_offset = self.slice_offset + max_offset = self.slice_offset + if self.base.strides == NULL: + max_offset = _overflow_checked_sum(max_offset, self.get_volume() - 1) + else: + for i in range(ndim): + stride = self.base.strides[i] # can be negative + extent = self.base.shape[i] # must be non-negative + if extent == 0: + min_offset = 0 + max_offset = -1 # empty range + return 0 + if stride <= 0: + min_offset = _overflow_checked_sum(min_offset, _overflow_checked_mul(stride, (extent - 1))) + else: + max_offset = _overflow_checked_sum(max_offset, _overflow_checked_mul(stride, (extent - 1))) + self._min_offset = min_offset + self._max_offset = max_offset + _mark_property_valid(self, PROP_OFFSET_BOUNDS) + return 0 + + cdef inline int64_t get_required_size_in_bytes(_StridedLayout self) except? -1 nogil: + if _has_valid_property(self, PROP_REQUIRED_SIZE_IN_BYTES): + return self._required_size_in_bytes + cdef stride_t min_offset = 0 + cdef stride_t max_offset = 0 + self.get_offset_bounds(min_offset, max_offset) + if min_offset < 0: + raise ValueError( + f"Allocation size for a layout that maps elements " + f"to negative memory offsets is ambiguous. " + f"The layout's min_offset is {min_offset}." + ) + if max_offset < min_offset: + return 0 + cdef int64_t required_size_in_bytes = _overflow_checked_sum(max_offset, 1) + self._required_size_in_bytes = _overflow_checked_mul(required_size_in_bytes, self.itemsize) + _mark_property_valid(self, PROP_REQUIRED_SIZE_IN_BYTES) + return self._required_size_in_bytes + + cdef inline int64_t get_slice_offset_in_bytes(_StridedLayout self) except? -1 nogil: + return _overflow_checked_mul(self.slice_offset, self.itemsize) + + cdef axes_mask_t get_flattened_axis_mask(_StridedLayout self) except? -1 nogil + cdef int get_max_compatible_itemsize(_StridedLayout self, int max_itemsize, intptr_t data_ptr, int axis=*) except -1 nogil + + # ============================== + # Layout manipulation + # ============================== + + + cdef int reshape_into(_StridedLayout self, _StridedLayout out_layout, BaseLayout& new_shape) except -1 nogil + cdef int permute_into(_StridedLayout self, _StridedLayout out_layout, axis_vec_t& axis_order) except -1 nogil + + cdef int flatten_into(_StridedLayout self, _StridedLayout out_layout, axes_mask_t axis_mask) except -1 nogil + cdef int squeeze_into(_StridedLayout self, _StridedLayout out_layout) except -1 nogil + cdef int unsqueeze_into(_StridedLayout self, _StridedLayout out_layout, axis_vec_t& axis_vec) except -1 nogil + cdef int broadcast_into(_StridedLayout self, _StridedLayout out_layout, BaseLayout& broadcast) except -1 nogil + cdef int pack_into(_StridedLayout self, _StridedLayout out_layout, int itemsize, intptr_t data_ptr, bint keep_dim, int axis=*) except -1 nogil + cdef int unpack_into(_StridedLayout self, _StridedLayout out_layout, int itemsize, int axis=*) except -1 nogil + cdef int slice_into(_StridedLayout self, _StridedLayout out_layout, tuple slices) except -1 + +# ============================== +# Base layout helpers +# ============================== + + +cdef inline int init_base_layout(BaseLayout& layout, int ndim) except -1 nogil: + if ndim > STRIDED_LAYOUT_MAX_NDIM: + raise ValueError(f"Unsupported number of dimensions: {ndim}. Max supported ndim is {STRIDED_LAYOUT_MAX_NDIM}") + # resize(0) is no op, that results in _mem.data() being NULL, + # which would make it tricky to distinguish between strides == NULL + # and strides == tuple() + layout._mem.resize(2 * max(ndim, 1)) + layout.shape = layout._mem.data() + layout.strides = layout._mem.data() + ndim + layout.ndim = ndim + return 0 + + +cdef inline int trim_base_layout(BaseLayout& layout, int ndim) except -1 nogil: + if ndim > layout.ndim: + raise AssertionError(f"Cannot trim layout to {ndim} dimensions, it has {layout.ndim} dimensions") + layout.ndim = ndim + return 0 + + +cdef inline void _swap_layout(BaseLayout& a, BaseLayout& b) noexcept nogil: + _swap(a._mem, b._mem) + _swap(a.shape, b.shape) + _swap(a.strides, b.strides) + _swap(a.ndim, b.ndim) + + +cdef inline void _assure_strides_ptr(BaseLayout& base) noexcept nogil: + if base.strides == NULL: + base.strides = base._mem.data() + base._mem.size() // 2 + + +cdef inline stride_t *get_strides_ptr(BaseLayout& base) except? NULL nogil: + if base.strides != NULL: + return base.strides + cdef stride_t* tmp_strides = base._mem.data() + base._mem.size() // 2 + _dense_strides_c_ptrs(base.ndim, base.shape, tmp_strides) + return tmp_strides + + +cdef inline bint _base_layout_equal(BaseLayout& a, BaseLayout& b) noexcept nogil: + if a.ndim != b.ndim: + return False + for i in range(a.ndim): + if a.shape[i] != b.shape[i]: + return False + if a.strides != NULL or b.strides != NULL: + if a.strides == NULL or b.strides == NULL: + return False + for i in range(a.ndim): + if a.strides[i] != b.strides[i]: + return False + return True + + +@cython.overflowcheck(True) +cdef inline int64_t _volume(BaseLayout& base) except? -1 nogil: + cdef int64_t vol = 1 + for i in range(base.ndim): + vol *= base.shape[i] + return vol + + +cdef inline int _divide_strides(BaseLayout& base, int itemsize) except -1 nogil: + cdef stride_t stride + if base.strides == NULL: + raise ValueError("cannot divide strides, layout has no strides") + for i in range(base.ndim): + stride = base.strides[i] // itemsize + if stride * itemsize != base.strides[i]: + raise ValueError("strides must be divisible by itemsize") + base.strides[i] = stride + return 0 + + +cdef inline void _zero_strides_ptr(int ndim, stride_t* strides) noexcept nogil: + for i in range(ndim): + strides[i] = 0 + + +cdef inline void _zero_strides(BaseLayout& base) noexcept nogil: + _assure_strides_ptr(base) + _zero_strides_ptr(base.ndim, base.strides) + + +cdef inline stride_t _dense_strides_c_ptrs(int ndim, extent_t* shape, stride_t* strides) except? -1 nogil: + cdef stride_t stride = 1 + cdef int i = ndim - 1 + while i >= 0: + strides[i] = stride + stride = _overflow_checked_mul(stride, shape[i]) + i -= 1 + if stride == 0: + _zero_strides_ptr(ndim, strides) + return stride + + +cdef inline stride_t _dense_strides_c(BaseLayout& base) except? -1 nogil: + cdef int ndim = base.ndim + _assure_strides_ptr(base) + return _dense_strides_c_ptrs(ndim, base.shape, base.strides) + + +cdef inline stride_t _dense_strides_f(BaseLayout& base) except? -1 nogil: + cdef int ndim = base.ndim + _assure_strides_ptr(base) + cdef stride_t stride = 1 + cdef int i = 0 + while i < ndim: + base.strides[i] = stride + stride = _overflow_checked_mul(stride, base.shape[i]) + i += 1 + if stride == 0: + _zero_strides(base) + return stride + + +cdef inline stride_t _dense_strides_in_order(BaseLayout& base, axis_vec_t& stride_order) except? -1 nogil: + cdef int ndim = base.ndim + if ndim != stride_order.size(): + raise ValueError(f"stride_order must have the same length as shape. Shape has {ndim} dimensions, but stride_order has {stride_order.size()} elements.") + _assure_strides_ptr(base) + cdef stride_t stride = 1 + cdef int i = ndim - 1 + cdef axes_mask_t axis_order_mask = 0 + cdef axes_mask_t axis_mask + cdef axis_t axis + while i >= 0: + axis = stride_order[i] + if not _normalize_axis(axis, ndim): + raise ValueError(f"Invalid stride order: axis {axis} out of range for {ndim}D tensor") + axis_mask = _axis2mask(axis) + if axis_order_mask & axis_mask: + raise ValueError(f"The stride order must be a permutation. Axis {axis} appears multiple times.") + axis_order_mask |= axis_mask + base.strides[axis] = stride + stride = _overflow_checked_mul(stride, base.shape[axis]) + i -= 1 + if stride == 0: + _zero_strides(base) + return stride + + +cdef inline bint _is_contiguous_c(int64_t volume, BaseLayout& base) except -1 nogil: + if volume == 0 or base.strides == NULL: + return True + cdef int64_t stride = 1 + cdef int64_t j = base.ndim - 1 + cdef extent_t extent + while j >= 0: + extent = base.shape[j] + if extent != 1: + if base.strides[j] != stride: + return False + stride *= extent + j -= 1 + return True + + +cdef inline bint _is_contiguous_f(int64_t volume, BaseLayout& base) except -1 nogil: + if volume == 0: + return True + cdef int ndim = base.ndim + cdef int64_t j = 0 + if base.strides == NULL: + # find first non-singleton dimension + while j < ndim and base.shape[j] == 1: + j += 1 + # if any subsequent dimension is not a singleton, return False + for i in range(j + 1, ndim): + if base.shape[i] != 1: + return False + return True + cdef int64_t stride = 1 + cdef extent_t extent + while j < ndim: + extent = base.shape[j] + if extent != 1: + if base.strides[j] != stride: + return False + stride *= extent + j += 1 + return True + + +cdef inline bint _is_contiguous_any(int64_t volume, BaseLayout& base, axis_vec_t& axis_order) except -1 nogil: + if volume == 0 or base.strides == NULL: + return True + cdef int64_t stride = 1 + cdef int64_t j = base.ndim - 1 + cdef axis_t axis + cdef extent_t extent + while j >= 0: + axis = axis_order[j] + extent = base.shape[axis] + if extent != 1: + if base.strides[axis] != stride: + return False + stride *= extent + j -= 1 + return True + + +cdef inline int _validate_shape(BaseLayout& base) except -1 nogil: + for i in range(base.ndim): + if base.shape[i] < 0: + raise ValueError("Extents must be non-negative") + return 0 + + +cdef inline int _init_base_layout_from_tuple(BaseLayout& base, tuple shape, tuple strides) except -1: + cdef int ndim = len(shape) + init_base_layout(base, ndim) + for i in range(ndim): + base.shape[i] = shape[i] + _validate_shape(base) + + if strides is None: + base.strides = NULL + else: + if len(strides) != ndim: + raise ValueError(f"Strides, if provided, must have the same length as shape. Shape has {ndim} dimensions, but strides has {len(strides)} elements.") + for i in range(ndim): + base.strides[i] = strides[i] + return 0 + + +cdef inline int _init_base_layout_from_ptr(BaseLayout& base, int ndim, extent_t* shape, stride_t* strides) except -1 nogil: + init_base_layout(base, ndim) + for i in range(ndim): + base.shape[i] = shape[i] + _validate_shape(base) + + if strides == NULL: + base.strides = NULL + else: + for i in range(ndim): + base.strides[i] = strides[i] + return 0 + +# ============================== +# Strided layout helpers +# ============================== + + +cdef inline bint _has_valid_property(_StridedLayout self, Property prop) noexcept nogil: + return self._prop_mask & prop + + +cdef inline void _mark_property_valid(_StridedLayout self, Property prop) noexcept nogil: + self._prop_mask |= prop + + +cdef inline bint _boolean_property(_StridedLayout self, Property prop) noexcept nogil: + return self._boolean_props & prop + + +cdef inline bint _set_boolean_property(_StridedLayout self, Property prop, bint value) noexcept nogil: + if value: + self._boolean_props |= prop + else: + self._boolean_props &= ~prop + _mark_property_valid(self, prop) + return value + + +# ============================== +# Conversion, validation and normalization helpers +# ============================== + + +cdef inline axes_mask_t _axis2mask(axis_t axis) noexcept nogil: + return 1ULL << axis + + +cdef inline axes_mask_t flatten_all_axes_mask(int ndim) noexcept nogil: + if ndim == 0: + return 0 + elif ndim == STRIDED_LAYOUT_MAX_NDIM: + return AXES_MASK_ALL + return (1ULL << ndim) - 2 + + +cdef inline OrderFlag _stride_order2vec(axis_vec_t& stride_order_vec, object stride_order) except? ORDER_NONE: + if stride_order == 'C': + return ORDER_C + elif stride_order == 'F': + return ORDER_F + elif isinstance(stride_order, tuple | list): + _tuple2axis_vec(stride_order_vec, stride_order) + return ORDER_PERM + return ORDER_NONE + + +cdef inline int _tuple2axis_vec(axis_vec_t& vec, object t) except -1: + cdef int ndim = len(t) + vec.resize(ndim) + for i in range(ndim): + vec[i] = t[i] + return 0 + + +cdef inline bint _normalize_axis(integer_t& axis, integer_t extent) except -1 nogil: + if axis < -extent or axis >= extent: + return False + if axis < 0: + axis += extent + return True + + +cdef inline bint _is_unique(BaseLayout& base, axis_vec_t& stride_order) except -1 nogil: + if base.strides == NULL: + return True + cdef int64_t cur_max_offset = 0 + cdef int i = base.ndim - 1 + cdef int64_t stride + cdef axis_t axis + cdef extent_t extent + while i >= 0: + axis = stride_order[i] + extent = base.shape[axis] + if extent != 1: + stride = _c_abs(base.strides[axis]) + if cur_max_offset >= stride: + return False + cur_max_offset = _overflow_checked_sum(cur_max_offset, _overflow_checked_mul(stride, (extent - 1))) + i -= 1 + return True + + +@cython.overflowcheck(True) +cdef inline int64_t _overflow_checked_mul(int64_t a, int64_t b) except? -1 nogil: + return a * b + + +@cython.overflowcheck(True) +cdef inline int64_t _overflow_checked_diff(int64_t a, int64_t b) except? -1 nogil: + return a - b + + +@cython.overflowcheck(True) +cdef inline int64_t _overflow_checked_sum(int64_t a, int64_t b) except? -1 nogil: + return a + b + + +@cython.overflowcheck(True) +cdef inline int64_t _overflow_checked_div_ceil(int64_t a, int64_t b) except? -1 nogil: + return (a + b - 1) // b diff --git a/cuda_core/cuda/core/_layout.pyi b/cuda_core/cuda/core/_layout.pyi new file mode 100644 index 00000000000..1562a2bf76f --- /dev/null +++ b/cuda_core/cuda/core/_layout.pyi @@ -0,0 +1,581 @@ +# This file was generated by stubgen-pyx v0.2.6 from cuda_core/cuda/core/_layout.pyx + +from __future__ import annotations + +import cython +from libcpp import vector + +OrderFlag = int +Property = int + +@cython.final +class _StridedLayout: + """ + A class describing the layout of a multi-dimensional tensor + with a shape, strides and itemsize. + + Parameters + ---------- + shape : tuple + A tuple of non-negative integers. + strides : tuple, optional + If provided, must be a tuple of integers of the same length as ``shape``. + Otherwise, the strides are assumed to be implicitly C-contiguous and the resulting + layout's :attr:`strides` will be None. + itemsize : int + The number of bytes per single element (dtype size). + divide_strides : bool, optional + If True, the provided :attr:`strides` will be divided by the :attr:`itemsize`. + + + See also :meth:`dense`. + + + Attributes + ---------- + itemsize : int + The number of bytes per single element (dtype size). + slice_offset : int + The offset (as a number of elements, not bytes) of the element at + index ``(0,) * ndim``. See also :attr:`slice_offset_in_bytes`. + """ + + def __init__(self: _StridedLayout, shape: tuple[int, ...], strides: tuple[int, ...] | None, itemsize: int, divide_strides: bool=False) -> None: + ... + + @classmethod + def dense(cls, shape: tuple[int], itemsize: int, stride_order: str | tuple[int]='C') -> _StridedLayout: + """ + Creates a new _StridedLayout instance with dense strides. + + Parameters + ---------- + shape : tuple + A tuple of non-negative integers. + itemsize : int + The number of bytes per single element of the tensor. + stride_order : str or tuple, optional + The order of the strides: + * 'C' (default) - the strides are computed in C-order (increasing from the right to the left) + * 'F' - the strides are computed in F-order (increasing from the left to the right) + * A tuple - it must be a permutation of ``tuple(range(len(shape)))``. + The last element of the tuple is the axis with stride 1. + + See also :attr:`stride_order`. + + + .. highlight:: python + .. code-block:: python + + assert _StridedLayout.dense((5, 3, 7), 1, "C") == _StridedLayout((5, 3, 7), (21, 7, 1), 1) + assert _StridedLayout.dense((5, 3, 7), 1, "F") == _StridedLayout((5, 3, 7), (1, 5, 15), 1) + assert _StridedLayout.dense((5, 3, 7), 1, (2, 0, 1)) == _StridedLayout((5, 3, 7), (3, 1, 15), 1) + + """ + + @classmethod + def dense_like(cls, other: _StridedLayout, stride_order: str | tuple[int]='K') -> _StridedLayout: + """ + Creates a _StridedLayout with the same :attr:`shape` and :attr:`itemsize` as the other layout, + but with contiguous strides in the specified order and no slice offset. + + See also :attr:`is_dense`. + + Parameters + ---------- + other : _StridedLayout + The _StridedLayout to copy the :attr:`shape` and :attr:`itemsize` from. + stride_order : str or tuple, optional + The order of the strides: + * 'K' (default) - keeps the order of the strides as in the ``other`` layout. + * 'C' - the strides are computed in C-order (increasing from the right to the left) + * 'F' - the strides are computed in F-order (increasing from the left to the right) + * A tuple - it must be a permutation of ``tuple(range(len(shape)))``. + The last element of the tuple is the axis with stride 1. + + See also :attr:`stride_order`. + + + .. highlight:: python + .. code-block:: python + + layout = _StridedLayout.dense((5, 3, 7), 1).permuted((2, 0, 1)) + assert layout == _StridedLayout((7, 5, 3), (1, 21, 7), 1) + + # dense_like with the default "K" stride_order + # keeps the same order of strides as in the original layout + assert _StridedLayout.dense_like(layout) == layout + # "C", "F" recompute the strides accordingly + assert _StridedLayout.dense_like(layout, "C") == _StridedLayout((7, 5, 3), (15, 3, 1), 1) + assert _StridedLayout.dense_like(layout, "F") == _StridedLayout((7, 5, 3), (1, 7, 35), 1) + """ + + def __repr__(self: _StridedLayout) -> str: + ... + + def __eq__(self, other: object) -> bool: + ... + + @property + def ndim(self: _StridedLayout) -> int: + """ + The number of dimensions (length of the shape tuple). + + :type: int + """ + + @property + def shape(self: _StridedLayout) -> tuple[int, ...]: + """ + Shape of the tensor. + + :type: tuple[int] + """ + + @property + def strides(self: _StridedLayout) -> tuple[int, ...] | None: + """ + Strides of the tensor (in **counts**, not bytes). + If _StridedLayout was created with strides=None, the + returned value is None and layout is implicitly C-contiguous. + + :type: tuple[int] | None + """ + + @property + def strides_in_bytes(self: _StridedLayout) -> tuple[int, ...] | None: + """ + Strides of the tensor (in bytes). + + :type: tuple[int] | None + """ + + @property + def stride_order(self: _StridedLayout) -> tuple[int, ...]: + """ + A permutation of ``tuple(range(ndim))`` describing the + relative order of the strides. + + .. highlight:: python + .. code-block:: python + + # C-contiguous layout + assert _StridedLayout.dense((5, 3, 7), 1).stride_order == (0, 1, 2) + # F-contiguous layout + assert _StridedLayout.dense((5, 3, 7), 1, stride_order="F").stride_order == (2, 1, 0) + # Permuted layout + assert _StridedLayout.dense((5, 3, 7), 1, stride_order=(2, 0, 1)).stride_order == (2, 0, 1) + + :type: tuple[int] + """ + + @property + def volume(self: _StridedLayout) -> int: + """ + The number of elements in the tensor, i.e. the product of the shape tuple. + + :type: int + """ + + @property + def is_unique(self: _StridedLayout) -> bool: + """ + If True, each element of a tensor with this layout is mapped to + a unique memory offset. + + All contiguous layouts are unique and so are layouts that can be created + by permuting, slicing, flattening, squeezing, repacking, or reshaping + a contiguous layout. + Conversely, broadcast layouts (layouts with a 0 stride + for some extent greater than 1) are not unique. + + For layouts resulting from manual stride manipulations + (such as with ``numpy.lib.stride_tricks``), the check + may inaccurately report False, as the exact uniqueness + check may be expensive. + + :type: bool + """ + + @property + def is_contiguous_c(self: _StridedLayout) -> bool: + """ + True iff the layout is contiguous in C-order, i.e. + the rightmost stride is 1 and each subsequent + stride to the left is the product of the + extent and the stride to the right. + + .. highlight:: python + .. code-block:: python + + layout = _StridedLayout.dense((2, 5, 3), 1, "C") + assert layout == _StridedLayout((2, 5, 3), (15, 3, 1), 1) + assert layout.is_contiguous_c + + See also :attr:`is_contiguous_any`. + + :type: bool + """ + + @property + def is_contiguous_f(self: _StridedLayout) -> bool: + """ + True iff the layout is contiguous in F-order, i.e. + the leftmost stride is 1 and each subsequent + stride to the right is the product of the + stride and extent to the left. + + .. highlight:: python + .. code-block:: python + + layout = _StridedLayout.dense((2, 5, 3), 1, "F") + assert layout == _StridedLayout((2, 5, 3), (1, 2, 10), 1) + assert layout.is_contiguous_f + + See also :attr:`is_contiguous_any`. + + :type: bool + """ + + @property + def is_contiguous_any(self: _StridedLayout) -> bool: + """ + True iff the layout is contiguous in some axis order, i.e. + there exists a permutation of axes such that the layout + is C-contiguous. + + In a contiguous layout, the strides are non-negative and + the mapping of elements to the memory offset range + ``[min_offset, max_offset]`` is 1-to-1. + + .. highlight:: python + .. code-block:: python + + # dense defaults to C-contiguous + layout = _StridedLayout.dense((5, 3, 7), 1) + assert layout.is_contiguous_c and not layout.is_contiguous_f + assert layout.is_contiguous_any + + # reversing the order of axes gives F-contiguous layout + permuted = layout.permuted((2, 1, 0)) + assert not permuted.is_contiguous_c and permuted.is_contiguous_f + assert permuted.is_contiguous_any + + # neither C- nor F-order but still contiguous + permuted = layout.permuted((2, 0, 1)) + assert not permuted.is_contiguous_c and not permuted.is_contiguous_f + assert permuted.is_contiguous_any + + # slicing the right-most extent creates a gap in the + # offset_bounds range that is not reachable with any + # element in the sliced layout + sliced = layout[:, :, :-1] + assert not sliced.is_contiguous_c and not sliced.is_contiguous_f + assert not sliced.is_contiguous_any + + :type: bool + """ + + @property + def is_dense(self: _StridedLayout) -> bool: + """ + A dense layout is contiguous (:attr:`is_contiguous_any` is True) + and has no slice offset (:attr:`slice_offset_in_bytes` is 0). + + In a dense layout, elements are mapped 1-to-1 to the ``[0, volume - 1]`` + memory offset range. + + :type: bool + """ + + @property + def offset_bounds(self: _StridedLayout) -> tuple[int, int]: + """ + The memory offset range ``[min_offset, max_offset]`` (in element counts, not bytes) + that elements of a tensor with this layout are mapped to. + + If the layout is empty (i.e. ``volume == 0``), the returned tuple is ``(0, -1)``. + Otherwise, ``min_offset <= max_offset`` and all elements of the tensor with + this layout are mapped within the ``[min_offset, max_offset]`` range. + + .. highlight:: python + .. code-block:: python + + # Possible implementation of the offset_bounds + def offset_bounds(layout : _StridedLayout): + if layout.volume == 0: + return 0, -1 + ndim = layout.ndim + shape = layout.shape + strides = layout.strides + idx_min = [shape[i] - 1 if strides[i] < 0 else 0 for i in range(ndim)] + idx_max = [shape[i] - 1 if strides[i] > 0 else 0 for i in range(ndim)] + min_offset = sum(strides[i] * idx_min[i] for i in range(ndim)) + layout.slice_offset + max_offset = sum(strides[i] * idx_max[i] for i in range(ndim)) + layout.slice_offset + return min_offset, max_offset + + :type: tuple[int, int] + """ + + @property + def min_offset(self: _StridedLayout) -> int: + """ + See :attr:`offset_bounds` for details. + + :type: int + """ + + @property + def max_offset(self: _StridedLayout) -> int: + """ + See :attr:`offset_bounds` for details. + + :type: int + """ + + @property + def slice_offset_in_bytes(self: _StridedLayout) -> int: + """ + The memory offset (as a number of bytes) of the element at index ``(0,) * ndim``. + Equal to :attr:`itemsize` ``*`` :attr:`slice_offset`. + + .. note:: + The only way for the index ``(0,) * ndim`` to be mapped to a non-zero offset + is slicing with :meth:`sliced` method (or ``[]`` operator). + + :type: int + """ + + def required_size_in_bytes(self: _StridedLayout) -> int: + """ + The memory allocation size (in bytes) needed so that + all elements of a tensor with this layout can be mapped + within the allocated memory range. + + The function raises an error if ``min_offset < 0``. + Otherwise, the returned value is equal to + ``(max_offset + 1) * itemsize``. + + .. hint:: + For dense layouts, the function always succeeds and the + ``(max_offset + 1) * itemsize`` is equal to the ``volume * itemsize``. + + .. highlight:: python + .. code-block:: python + + # Allocating memory on a device to copy a host tensor + def device_tensor_like(a : numpy.ndarray, device : ccx.Device) -> StridedMemoryView: + a_view = StridedMemoryView(a, -1) + # get the original layout of ``a`` and convert it to a dense layout + # to avoid overallocating memory (e.g. if the ``a`` was sliced) + layout = a_view._layout.to_dense() + # get the required size in bytes to fit the tensor + required_size = layout.required_size_in_bytes() + # allocate the memory on the device + device.set_current() + mem = device.allocate(required_size, stream=device.default_stream) + # create a view on the newly allocated device memory + b_view = StridedMemoryView.from_buffer(mem, layout, a_view.dtype) + return b_view + """ + + def flattened_axis_mask(self: _StridedLayout) -> axes_mask_t: + """ + A mask describing which axes of this layout are mergeable + using the :meth:`flattened` method. + """ + + def to_dense(self: _StridedLayout, stride_order: object='K') -> _StridedLayout: + """ + Returns a dense layout with the same shape and itemsize, + but with dense strides in the specified order. + + See :meth:`dense_like` method documentation for details. + """ + + def reshaped(self: _StridedLayout, shape: tuple[int]) -> _StridedLayout: + """ + Returns a layout with the new shape, if the new shape is compatible + with the current layout. + + The new shape is compatible if: + * the new and old shapes have the same volume + * the old strides can be split or flattened to match the new shape, + assuming indices are iterated in C-order + + A single extent in the ``shape`` tuple can be set to -1 to indicate + it should be inferred from the old volume and the other extents. + + .. highlight:: python + .. code-block:: python + + layout = _StridedLayout.dense((5, 3, 4), 1) + assert layout.reshaped((20, 3)) == _StridedLayout.dense((20, 3), 1) + assert layout.reshaped((4, -1)) == _StridedLayout.dense((4, 15), 1) + assert layout.permuted((2, 0, 1)).reshaped((4, 15,)) == _StridedLayout((4, 15), (1, 4), 1) + # layout.permuted((2, 0, 1)).reshaped((20, 3)) -> error + """ + + def permuted(self: _StridedLayout, axis_order: tuple[int]) -> _StridedLayout: + """ + Returns a new layout where the shape and strides tuples are permuted + according to the specified permutation of axes. + """ + + def flattened(self: _StridedLayout, start_axis: int=0, end_axis: int=-1, mask: int | None=None) -> _StridedLayout: + """ + Merges consecutive extents into a single extent (equal to the product of merged extents) + if the corresponding strides can be replaced with a single stride + (assuming indices are iterated in C-order, i.e. the rightmost + axis is incremented first). + + .. highlight:: python + .. code-block:: python + + # the two extents can be merged into a single extent + # because layout.strides[0] == layout.strides[1] * layout.shape[1] + layout = _StridedLayout((3, 2), (2, 1), 1) + assert layout.flattened() == _StridedLayout((6,), (1,), 1) + + # the two extents cannot be merged into a single extent + # because layout.strides[0] != layout.strides[1] * layout.shape[1] + layout = _StridedLayout((3, 2), (1, 3), 1) + assert layout.flattened() == layout + + If ``start_axis`` and ``end_axis`` are provided, only the axes in the + inclusive range ``[start_axis, end_axis]`` are considered for flattening. + + Alternatively, a mask specifying which axes to consider can be provided. + A mask of mergeable extents can be obtained using the :meth:`flattened_axis_mask` method. + Masks for layouts with the same number of dimensions can be combined + using the logical ``&`` (bitwise AND) operator. + + .. highlight:: python + .. code-block:: python + + layout = _StridedLayout.dense((4, 5, 3), 4) + layout2 = _StridedLayout((4, 5, 3), (1, 12, 4), 4) + # Even though the two layouts have the same shape initially, + # their shapes differ after flattening. + assert layout.flattened() == _StridedLayout((60,), (1,), 4) + assert layout2.flattened() == _StridedLayout((4, 15), (1, 4), 4) + # With the mask, only extents that are mergeable in both layouts are flattened + # and the resulting shape is the same for both layouts. + mask = layout.flattened_axis_mask() & layout2.flattened_axis_mask() + assert layout.flattened(mask=mask) == _StridedLayout((4, 15), (15, 1), 4) + assert layout2.flattened(mask=mask) == _StridedLayout((4, 15), (1, 4), 4) + """ + + def squeezed(self: _StridedLayout) -> _StridedLayout: + """ + Returns a new layout where all the singleton dimensions (extents equal to 1) + are removed. Additionally, if the layout volume is 0, + the returned layout will be reduced to a 1-dim layout + with shape (0,) and strides (0,). + """ + + def unsqueezed(self: _StridedLayout, axis: int | tuple[int]) -> _StridedLayout: + """ + Returns a new layout where the specified axis or axes are added as singleton extents. + The ``axis`` can be either a single integer in range ``[0, ndim]`` + or a tuple of unique integers in range ``[0, ndim + len(axis) - 1]``. + """ + + def broadcast_to(self: _StridedLayout, shape: tuple[int]) -> _StridedLayout: + """ + Returns a layout with the new shape, if the old shape can be + broadcast to the new one. + + The shapes are compatible if: + * the new shape has the same or greater number of dimensions + * starting from the right, each extent in the old shape must be 1 or + equal to the corresponding extent in the new shape. + + Strides of the added or modified extents are set to 0, the remaining ones are unchanged. + If the shapes are not compatible, a ValueError is raised. + """ + + def repacked(self: _StridedLayout, itemsize: int, data_ptr: int=0, axis: int=-1, keep_dim: bool=True) -> _StridedLayout: + """ + Converts the layout to match the specified itemsize. + If ``new_itemsize < itemsize``, each element of the tensor is **unpacked** into multiple elements, + i.e. the extent at ``axis`` increases by the factor ``itemsize // new_itemsize``. + If ``new_itemsize > itemsize``, the consecutive elements in the tensor are **packed** into a single element, + i.e. the extent at ``axis`` decreases by the factor ``new_itemsize // itemsize``. + In either case, the ``volume * itemsize`` of the layout remains the same. + + The conversion is subject to the following constraints: + * The extent at ``axis`` must be a positive integer. + * The stride at ``axis`` must be 1. + + Moreover, if the ``new_itemsize > itemsize``: + * The extent at ``axis`` must be divisible by ``new_itemsize // itemsize``. + * All other strides must be divisible by ``new_itemsize // itemsize``. + * The ``slice_offset`` must be divisible by ``new_itemsize // itemsize``. + * If ``data_ptr`` is provided, it must be aligned to the new itemsize. + + The maximum itemsize that satisfies all the constraints + can be obtained using the :meth:`max_compatible_itemsize` method. + + If the ``keep_dim`` is False and the extent at ``axis`` would be reduced to 1, + it is omitted from the returned layout. + + .. highlight:: python + .. code-block:: python + + # Repacking the layout with itemsize = 4 bytes as 2, 8, and 16 sized layouts. + layout = _StridedLayout.dense((5, 4), 4) + assert layout.repacked(2) == _StridedLayout.dense((5, 8), 2) + assert layout.repacked(8) == _StridedLayout.dense((5, 2), 8) + assert layout.repacked(16) == _StridedLayout.dense((5, 1), 16) + assert layout.repacked(16, keep_dim=False) == _StridedLayout.dense((5,), 16) + + + .. highlight:: python + .. code-block:: python + + # Viewing (5, 6) float array as (5, 3) complex64 array. + a = numpy.ones((5, 6), dtype=numpy.float32) + float_view = StridedMemoryView(a, -1) + layout = float_view._layout + assert layout.shape == (5, 6) + assert layout.itemsize == 4 + complex_view = float_view.view(layout.repacked(8), numpy.complex64) + assert complex_view._layout.shape == (5, 3) + assert complex_view._layout.itemsize == 8 + b = numpy.from_dlpack(complex_view) + assert b.shape == (5, 3) + """ + + def max_compatible_itemsize(self: _StridedLayout, max_itemsize: int=16, data_ptr: int=0, axis: int=-1) -> int: + """ + Returns the maximum itemsize (but no greater than ``max_itemsize``) that can be used + with the :meth:`repacked` method for the current layout. + """ + + def sliced(self: _StridedLayout, slices: int | slice | tuple[int | slice]) -> _StridedLayout: + """ + Returns a sliced layout. + The ``slices`` parameter can be a single integer, a single :py:class:`slice` object + or a tuple of integers/slices. + + .. hint:: + For convenience, instead of calling this method directly, please rely + on the :py:meth:`~object.__getitem__` operator (i.e. bracket syntax), e.g.: + ``layout[:, start:end:step]``. + + .. note:: + Slicing is purely a layout transformation and does not involve + any data access. + + """ + + def __getitem__(self: _StridedLayout, slices: int | slice | tuple[int | slice]) -> _StridedLayout: + ... +extent_t = int +stride_t = int +axis_t = int +axes_mask_t = int +property_mask_t = int +extents_strides_t = vector.vector +axis_vec_t = vector.vector \ No newline at end of file diff --git a/cuda_core/cuda/core/_layout.pyx b/cuda_core/cuda/core/_layout.pyx new file mode 100644 index 00000000000..9996a75e640 --- /dev/null +++ b/cuda_core/cuda/core/_layout.pyx @@ -0,0 +1,1329 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +cimport cython + +from libc.stdint cimport int64_t, intptr_t + +from cpython.object cimport PyObject + + +cdef extern from "Python.h": + int _PySlice_Unpack "PySlice_Unpack" (PyObject *slice, Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step) except -1 + Py_ssize_t _PySlice_AdjustIndices "PySlice_AdjustIndices" (Py_ssize_t length, Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t step) noexcept nogil + + +@cython.final +cdef class _StridedLayout: + """ + A class describing the layout of a multi-dimensional tensor + with a shape, strides and itemsize. + + Parameters + ---------- + shape : tuple + A tuple of non-negative integers. + strides : tuple, optional + If provided, must be a tuple of integers of the same length as ``shape``. + Otherwise, the strides are assumed to be implicitly C-contiguous and the resulting + layout's :attr:`strides` will be None. + itemsize : int + The number of bytes per single element (dtype size). + divide_strides : bool, optional + If True, the provided :attr:`strides` will be divided by the :attr:`itemsize`. + + + See also :meth:`dense`. + + + Attributes + ---------- + itemsize : int + The number of bytes per single element (dtype size). + slice_offset : int + The offset (as a number of elements, not bytes) of the element at + index ``(0,) * ndim``. See also :attr:`slice_offset_in_bytes`. + """ + + def __init__( + self : _StridedLayout, + shape : tuple[int, ...], + strides : tuple[int, ...] | None, + itemsize : int, + divide_strides : bool = False + ) -> None: + self.init_from_tuple(shape, strides, itemsize, divide_strides) + + @classmethod + def dense( + cls, + shape : tuple[int], + itemsize : int, + stride_order : str | tuple[int] = 'C' + ) -> _StridedLayout: + """ + Creates a new _StridedLayout instance with dense strides. + + Parameters + ---------- + shape : tuple + A tuple of non-negative integers. + itemsize : int + The number of bytes per single element of the tensor. + stride_order : str or tuple, optional + The order of the strides: + * 'C' (default) - the strides are computed in C-order (increasing from the right to the left) + * 'F' - the strides are computed in F-order (increasing from the left to the right) + * A tuple - it must be a permutation of ``tuple(range(len(shape)))``. + The last element of the tuple is the axis with stride 1. + + See also :attr:`stride_order`. + + + .. highlight:: python + .. code-block:: python + + assert _StridedLayout.dense((5, 3, 7), 1, "C") == _StridedLayout((5, 3, 7), (21, 7, 1), 1) + assert _StridedLayout.dense((5, 3, 7), 1, "F") == _StridedLayout((5, 3, 7), (1, 5, 15), 1) + assert _StridedLayout.dense((5, 3, 7), 1, (2, 0, 1)) == _StridedLayout((5, 3, 7), (3, 1, 15), 1) + + """ + cdef _StridedLayout new_layout = _StridedLayout.__new__(cls) + new_layout.init_dense_from_tuple(shape, itemsize, stride_order) + return new_layout + + @classmethod + def dense_like( + cls, + other : _StridedLayout, + stride_order : str | tuple[int] = "K" + ) -> _StridedLayout: + """ + Creates a _StridedLayout with the same :attr:`shape` and :attr:`itemsize` as the other layout, + but with contiguous strides in the specified order and no slice offset. + + See also :attr:`is_dense`. + + Parameters + ---------- + other : _StridedLayout + The _StridedLayout to copy the :attr:`shape` and :attr:`itemsize` from. + stride_order : str or tuple, optional + The order of the strides: + * 'K' (default) - keeps the order of the strides as in the ``other`` layout. + * 'C' - the strides are computed in C-order (increasing from the right to the left) + * 'F' - the strides are computed in F-order (increasing from the left to the right) + * A tuple - it must be a permutation of ``tuple(range(len(shape)))``. + The last element of the tuple is the axis with stride 1. + + See also :attr:`stride_order`. + + + .. highlight:: python + .. code-block:: python + + layout = _StridedLayout.dense((5, 3, 7), 1).permuted((2, 0, 1)) + assert layout == _StridedLayout((7, 5, 3), (1, 21, 7), 1) + + # dense_like with the default "K" stride_order + # keeps the same order of strides as in the original layout + assert _StridedLayout.dense_like(layout) == layout + # "C", "F" recompute the strides accordingly + assert _StridedLayout.dense_like(layout, "C") == _StridedLayout((7, 5, 3), (15, 3, 1), 1) + assert _StridedLayout.dense_like(layout, "F") == _StridedLayout((7, 5, 3), (1, 7, 35), 1) + """ + cdef OrderFlag order_flag + cdef axis_vec_t stride_order_vec + cdef bint is_dense = other.get_is_dense() + + if stride_order == "K": + if is_dense: + return other + other.get_stride_order(stride_order_vec) + order_flag = ORDER_PERM + else: + order_flag = _stride_order2vec(stride_order_vec, stride_order) + if order_flag == ORDER_NONE: + raise ValueError( + f"The stride_order must be 'K', 'C', 'F', " + f"or a permutation tuple. Got: {stride_order}" + ) + elif order_flag == ORDER_C: + if is_dense and other.get_is_contiguous_c(): + return other + elif order_flag == ORDER_F: + if is_dense and other.get_is_contiguous_f(): + return other + + cdef _StridedLayout new_layout = _StridedLayout.__new__(cls) + new_layout.init_dense_from_ptr( + other.base.ndim, + other.base.shape, + other.itemsize, + order_flag, + &stride_order_vec + ) + return new_layout + + def __repr__(self : _StridedLayout) -> str: + if self.slice_offset == 0: + return ( + f"_StridedLayout(shape={self.shape}, strides={self.strides}, itemsize={self.itemsize})" + ) + else: + return ( + f"_StridedLayout(shape={self.shape}, strides={self.strides}, itemsize={self.itemsize}, _slice_offset={self.slice_offset})" + ) + + def __eq__(self, other: object) -> bool: + if not isinstance(other, _StridedLayout): + return NotImplemented + cdef _StridedLayout _other = <_StridedLayout>other + return ( + self.itemsize == _other.itemsize + and self.slice_offset == _other.slice_offset + and _base_layout_equal(self.base, _other.base) + ) + + @property + def ndim(self : _StridedLayout) -> int: + """ + The number of dimensions (length of the shape tuple). + + :type: int + """ + return self.base.ndim + + @property + def shape(self : _StridedLayout) -> tuple[int, ...]: + """ + Shape of the tensor. + + :type: tuple[int] + """ + return self.get_shape_tuple() + + @property + def strides(self : _StridedLayout) -> tuple[int, ...] | None: + """ + Strides of the tensor (in **counts**, not bytes). + If _StridedLayout was created with strides=None, the + returned value is None and layout is implicitly C-contiguous. + + :type: tuple[int] | None + """ + return self.get_strides_tuple() + + @property + def strides_in_bytes(self : _StridedLayout) -> tuple[int, ...] | None: + """ + Strides of the tensor (in bytes). + + :type: tuple[int] | None + """ + return self.get_strides_in_bytes_tuple() + + @property + def stride_order(self : _StridedLayout) -> tuple[int, ...]: + """ + A permutation of ``tuple(range(ndim))`` describing the + relative order of the strides. + + .. highlight:: python + .. code-block:: python + + # C-contiguous layout + assert _StridedLayout.dense((5, 3, 7), 1).stride_order == (0, 1, 2) + # F-contiguous layout + assert _StridedLayout.dense((5, 3, 7), 1, stride_order="F").stride_order == (2, 1, 0) + # Permuted layout + assert _StridedLayout.dense((5, 3, 7), 1, stride_order=(2, 0, 1)).stride_order == (2, 0, 1) + + :type: tuple[int] + """ + return self.get_stride_order_tuple() + + @property + def volume(self : _StridedLayout) -> int: + """ + The number of elements in the tensor, i.e. the product of the shape tuple. + + :type: int + """ + return self.get_volume() + + @property + def is_unique(self : _StridedLayout) -> bool: + """ + If True, each element of a tensor with this layout is mapped to + a unique memory offset. + + All contiguous layouts are unique and so are layouts that can be created + by permuting, slicing, flattening, squeezing, repacking, or reshaping + a contiguous layout. + Conversely, broadcast layouts (layouts with a 0 stride + for some extent greater than 1) are not unique. + + For layouts resulting from manual stride manipulations + (such as with ``numpy.lib.stride_tricks``), the check + may inaccurately report False, as the exact uniqueness + check may be expensive. + + :type: bool + """ + return self.get_is_unique() + + @property + def is_contiguous_c(self : _StridedLayout) -> bool: + """ + True iff the layout is contiguous in C-order, i.e. + the rightmost stride is 1 and each subsequent + stride to the left is the product of the + extent and the stride to the right. + + .. highlight:: python + .. code-block:: python + + layout = _StridedLayout.dense((2, 5, 3), 1, "C") + assert layout == _StridedLayout((2, 5, 3), (15, 3, 1), 1) + assert layout.is_contiguous_c + + See also :attr:`is_contiguous_any`. + + :type: bool + """ + return self.get_is_contiguous_c() + + @property + def is_contiguous_f(self : _StridedLayout) -> bool: + """ + True iff the layout is contiguous in F-order, i.e. + the leftmost stride is 1 and each subsequent + stride to the right is the product of the + stride and extent to the left. + + .. highlight:: python + .. code-block:: python + + layout = _StridedLayout.dense((2, 5, 3), 1, "F") + assert layout == _StridedLayout((2, 5, 3), (1, 2, 10), 1) + assert layout.is_contiguous_f + + See also :attr:`is_contiguous_any`. + + :type: bool + """ + return self.get_is_contiguous_f() + + @property + def is_contiguous_any(self : _StridedLayout) -> bool: + """ + True iff the layout is contiguous in some axis order, i.e. + there exists a permutation of axes such that the layout + is C-contiguous. + + In a contiguous layout, the strides are non-negative and + the mapping of elements to the memory offset range + ``[min_offset, max_offset]`` is 1-to-1. + + .. highlight:: python + .. code-block:: python + + # dense defaults to C-contiguous + layout = _StridedLayout.dense((5, 3, 7), 1) + assert layout.is_contiguous_c and not layout.is_contiguous_f + assert layout.is_contiguous_any + + # reversing the order of axes gives F-contiguous layout + permuted = layout.permuted((2, 1, 0)) + assert not permuted.is_contiguous_c and permuted.is_contiguous_f + assert permuted.is_contiguous_any + + # neither C- nor F-order but still contiguous + permuted = layout.permuted((2, 0, 1)) + assert not permuted.is_contiguous_c and not permuted.is_contiguous_f + assert permuted.is_contiguous_any + + # slicing the right-most extent creates a gap in the + # offset_bounds range that is not reachable with any + # element in the sliced layout + sliced = layout[:, :, :-1] + assert not sliced.is_contiguous_c and not sliced.is_contiguous_f + assert not sliced.is_contiguous_any + + :type: bool + """ + return self.get_is_contiguous_any() + + @property + def is_dense(self : _StridedLayout) -> bool: + """ + A dense layout is contiguous (:attr:`is_contiguous_any` is True) + and has no slice offset (:attr:`slice_offset_in_bytes` is 0). + + In a dense layout, elements are mapped 1-to-1 to the ``[0, volume - 1]`` + memory offset range. + + :type: bool + """ + return self.get_is_dense() + + @property + def offset_bounds(self : _StridedLayout) -> tuple[int, int]: + """ + The memory offset range ``[min_offset, max_offset]`` (in element counts, not bytes) + that elements of a tensor with this layout are mapped to. + + If the layout is empty (i.e. ``volume == 0``), the returned tuple is ``(0, -1)``. + Otherwise, ``min_offset <= max_offset`` and all elements of the tensor with + this layout are mapped within the ``[min_offset, max_offset]`` range. + + .. highlight:: python + .. code-block:: python + + # Possible implementation of the offset_bounds + def offset_bounds(layout : _StridedLayout): + if layout.volume == 0: + return 0, -1 + ndim = layout.ndim + shape = layout.shape + strides = layout.strides + idx_min = [shape[i] - 1 if strides[i] < 0 else 0 for i in range(ndim)] + idx_max = [shape[i] - 1 if strides[i] > 0 else 0 for i in range(ndim)] + min_offset = sum(strides[i] * idx_min[i] for i in range(ndim)) + layout.slice_offset + max_offset = sum(strides[i] * idx_max[i] for i in range(ndim)) + layout.slice_offset + return min_offset, max_offset + + :type: tuple[int, int] + """ + cdef stride_t min_offset = 0 + cdef stride_t max_offset = 0 + self.get_offset_bounds(min_offset, max_offset) + return min_offset, max_offset + + @property + def min_offset(self : _StridedLayout) -> int: + """ + See :attr:`offset_bounds` for details. + + :type: int + """ + cdef stride_t min_offset = 0 + cdef stride_t max_offset = 0 + self.get_offset_bounds(min_offset, max_offset) + return min_offset + + @property + def max_offset(self : _StridedLayout) -> int: + """ + See :attr:`offset_bounds` for details. + + :type: int + """ + cdef stride_t min_offset = 0 + cdef stride_t max_offset = 0 + self.get_offset_bounds(min_offset, max_offset) + return max_offset + + @property + def slice_offset_in_bytes(self : _StridedLayout) -> int: + """ + The memory offset (as a number of bytes) of the element at index ``(0,) * ndim``. + Equal to :attr:`itemsize` ``*`` :attr:`slice_offset`. + + .. note:: + The only way for the index ``(0,) * ndim`` to be mapped to a non-zero offset + is slicing with :meth:`sliced` method (or ``[]`` operator). + + :type: int + """ + return self.get_slice_offset_in_bytes() + + def required_size_in_bytes(self : _StridedLayout) -> int: + """ + The memory allocation size (in bytes) needed so that + all elements of a tensor with this layout can be mapped + within the allocated memory range. + + The function raises an error if ``min_offset < 0``. + Otherwise, the returned value is equal to + ``(max_offset + 1) * itemsize``. + + .. hint:: + For dense layouts, the function always succeeds and the + ``(max_offset + 1) * itemsize`` is equal to the ``volume * itemsize``. + + .. highlight:: python + .. code-block:: python + + # Allocating memory on a device to copy a host tensor + def device_tensor_like(a : numpy.ndarray, device : ccx.Device) -> StridedMemoryView: + a_view = StridedMemoryView(a, -1) + # get the original layout of ``a`` and convert it to a dense layout + # to avoid overallocating memory (e.g. if the ``a`` was sliced) + layout = a_view._layout.to_dense() + # get the required size in bytes to fit the tensor + required_size = layout.required_size_in_bytes() + # allocate the memory on the device + device.set_current() + mem = device.allocate(required_size, stream=device.default_stream) + # create a view on the newly allocated device memory + b_view = StridedMemoryView.from_buffer(mem, layout, a_view.dtype) + return b_view + """ + return self.get_required_size_in_bytes() + + def flattened_axis_mask(self : _StridedLayout) -> axes_mask_t: + """ + A mask describing which axes of this layout are mergeable + using the :meth:`flattened` method. + """ + return self.get_flattened_axis_mask() + + def to_dense(self : _StridedLayout, object stride_order="K") -> _StridedLayout: + """ + Returns a dense layout with the same shape and itemsize, + but with dense strides in the specified order. + + See :meth:`dense_like` method documentation for details. + """ + return _StridedLayout.dense_like(self, stride_order) + + def reshaped(self : _StridedLayout, shape : tuple[int]) -> _StridedLayout: + """ + Returns a layout with the new shape, if the new shape is compatible + with the current layout. + + The new shape is compatible if: + * the new and old shapes have the same volume + * the old strides can be split or flattened to match the new shape, + assuming indices are iterated in C-order + + A single extent in the ``shape`` tuple can be set to -1 to indicate + it should be inferred from the old volume and the other extents. + + .. highlight:: python + .. code-block:: python + + layout = _StridedLayout.dense((5, 3, 4), 1) + assert layout.reshaped((20, 3)) == _StridedLayout.dense((20, 3), 1) + assert layout.reshaped((4, -1)) == _StridedLayout.dense((4, 15), 1) + assert layout.permuted((2, 0, 1)).reshaped((4, 15,)) == _StridedLayout((4, 15), (1, 4), 1) + # layout.permuted((2, 0, 1)).reshaped((20, 3)) -> error + """ + cdef _StridedLayout new_layout = _StridedLayout.__new__(_StridedLayout) + cdef BaseLayout new_shape + init_base_layout(new_shape, len(shape)) + for i in range(len(shape)): + new_shape.shape[i] = shape[i] + self.reshape_into(new_layout, new_shape) + return new_layout + + def permuted(self : _StridedLayout, axis_order : tuple[int]) -> _StridedLayout: + """ + Returns a new layout where the shape and strides tuples are permuted + according to the specified permutation of axes. + """ + cdef _StridedLayout new_layout = _StridedLayout.__new__(_StridedLayout) + cdef axis_vec_t axis_order_vec + _tuple2axis_vec(axis_order_vec, axis_order) + self.permute_into(new_layout, axis_order_vec) + return new_layout + + def flattened(self : _StridedLayout, start_axis : int = 0, end_axis : int = -1, mask : int | None = None) -> _StridedLayout: + """ + Merges consecutive extents into a single extent (equal to the product of merged extents) + if the corresponding strides can be replaced with a single stride + (assuming indices are iterated in C-order, i.e. the rightmost + axis is incremented first). + + .. highlight:: python + .. code-block:: python + + # the two extents can be merged into a single extent + # because layout.strides[0] == layout.strides[1] * layout.shape[1] + layout = _StridedLayout((3, 2), (2, 1), 1) + assert layout.flattened() == _StridedLayout((6,), (1,), 1) + + # the two extents cannot be merged into a single extent + # because layout.strides[0] != layout.strides[1] * layout.shape[1] + layout = _StridedLayout((3, 2), (1, 3), 1) + assert layout.flattened() == layout + + If ``start_axis`` and ``end_axis`` are provided, only the axes in the + inclusive range ``[start_axis, end_axis]`` are considered for flattening. + + Alternatively, a mask specifying which axes to consider can be provided. + A mask of mergeable extents can be obtained using the :meth:`flattened_axis_mask` method. + Masks for layouts with the same number of dimensions can be combined + using the logical ``&`` (bitwise AND) operator. + + .. highlight:: python + .. code-block:: python + + layout = _StridedLayout.dense((4, 5, 3), 4) + layout2 = _StridedLayout((4, 5, 3), (1, 12, 4), 4) + # Even though the two layouts have the same shape initially, + # their shapes differ after flattening. + assert layout.flattened() == _StridedLayout((60,), (1,), 4) + assert layout2.flattened() == _StridedLayout((4, 15), (1, 4), 4) + # With the mask, only extents that are mergeable in both layouts are flattened + # and the resulting shape is the same for both layouts. + mask = layout.flattened_axis_mask() & layout2.flattened_axis_mask() + assert layout.flattened(mask=mask) == _StridedLayout((4, 15), (15, 1), 4) + assert layout2.flattened(mask=mask) == _StridedLayout((4, 15), (1, 4), 4) + """ + cdef _StridedLayout new_layout = _StridedLayout.__new__(_StridedLayout) + cdef axes_mask_t axis_mask + if mask is None: + axis_mask = axis_mask_from_range(self.ndim, start_axis, end_axis) + else: + axis_mask = mask + self.flatten_into(new_layout, axis_mask) + return new_layout + + def squeezed(self : _StridedLayout) -> _StridedLayout: + """ + Returns a new layout where all the singleton dimensions (extents equal to 1) + are removed. Additionally, if the layout volume is 0, + the returned layout will be reduced to a 1-dim layout + with shape (0,) and strides (0,). + """ + cdef _StridedLayout new_layout = _StridedLayout.__new__(_StridedLayout) + self.squeeze_into(new_layout) + return new_layout + + def unsqueezed(self : _StridedLayout, axis : int | tuple[int]) -> _StridedLayout: + """ + Returns a new layout where the specified axis or axes are added as singleton extents. + The ``axis`` can be either a single integer in range ``[0, ndim]`` + or a tuple of unique integers in range ``[0, ndim + len(axis) - 1]``. + """ + cdef axis_vec_t axis_vec + if isinstance(axis, int): + axis_vec.push_back(axis) + else: + _tuple2axis_vec(axis_vec, axis) + if axis_vec.size() == 0: + return self + cdef _StridedLayout new_layout = _StridedLayout.__new__(_StridedLayout) + self.unsqueeze_into(new_layout, axis_vec) + return new_layout + + def broadcast_to(self : _StridedLayout, shape : tuple[int]) -> _StridedLayout: + """ + Returns a layout with the new shape, if the old shape can be + broadcast to the new one. + + The shapes are compatible if: + * the new shape has the same or greater number of dimensions + * starting from the right, each extent in the old shape must be 1 or + equal to the corresponding extent in the new shape. + + Strides of the added or modified extents are set to 0, the remaining ones are unchanged. + If the shapes are not compatible, a ValueError is raised. + """ + cdef _StridedLayout new_layout = _StridedLayout.__new__(_StridedLayout) + cdef BaseLayout new_shape + cdef int new_ndim = len(shape) + init_base_layout(new_shape, new_ndim) + for i in range(new_ndim): + new_shape.shape[i] = shape[i] + self.broadcast_into(new_layout, new_shape) + return new_layout + + def repacked(self : _StridedLayout, itemsize : int, data_ptr : intptr_t = 0, axis : int = -1, keep_dim : bool = True) -> _StridedLayout: + """ + Converts the layout to match the specified itemsize. + If ``new_itemsize < itemsize``, each element of the tensor is **unpacked** into multiple elements, + i.e. the extent at ``axis`` increases by the factor ``itemsize // new_itemsize``. + If ``new_itemsize > itemsize``, the consecutive elements in the tensor are **packed** into a single element, + i.e. the extent at ``axis`` decreases by the factor ``new_itemsize // itemsize``. + In either case, the ``volume * itemsize`` of the layout remains the same. + + The conversion is subject to the following constraints: + * The extent at ``axis`` must be a positive integer. + * The stride at ``axis`` must be 1. + + Moreover, if the ``new_itemsize > itemsize``: + * The extent at ``axis`` must be divisible by ``new_itemsize // itemsize``. + * All other strides must be divisible by ``new_itemsize // itemsize``. + * The ``slice_offset`` must be divisible by ``new_itemsize // itemsize``. + * If ``data_ptr`` is provided, it must be aligned to the new itemsize. + + The maximum itemsize that satisfies all the constraints + can be obtained using the :meth:`max_compatible_itemsize` method. + + If the ``keep_dim`` is False and the extent at ``axis`` would be reduced to 1, + it is omitted from the returned layout. + + .. highlight:: python + .. code-block:: python + + # Repacking the layout with itemsize = 4 bytes as 2, 8, and 16 sized layouts. + layout = _StridedLayout.dense((5, 4), 4) + assert layout.repacked(2) == _StridedLayout.dense((5, 8), 2) + assert layout.repacked(8) == _StridedLayout.dense((5, 2), 8) + assert layout.repacked(16) == _StridedLayout.dense((5, 1), 16) + assert layout.repacked(16, keep_dim=False) == _StridedLayout.dense((5,), 16) + + + .. highlight:: python + .. code-block:: python + + # Viewing (5, 6) float array as (5, 3) complex64 array. + a = numpy.ones((5, 6), dtype=numpy.float32) + float_view = StridedMemoryView(a, -1) + layout = float_view._layout + assert layout.shape == (5, 6) + assert layout.itemsize == 4 + complex_view = float_view.view(layout.repacked(8), numpy.complex64) + assert complex_view._layout.shape == (5, 3) + assert complex_view._layout.itemsize == 8 + b = numpy.from_dlpack(complex_view) + assert b.shape == (5, 3) + """ + + if itemsize == self.itemsize: + return self + cdef _StridedLayout new_layout = _StridedLayout.__new__(_StridedLayout) + if itemsize > self.itemsize: + self.pack_into(new_layout, itemsize, data_ptr, keep_dim, axis) + else: + self.unpack_into(new_layout, itemsize, axis) + return new_layout + + def max_compatible_itemsize(self : _StridedLayout, max_itemsize : int = 16, data_ptr : intptr_t = 0, axis : int = -1) -> int: + """ + Returns the maximum itemsize (but no greater than ``max_itemsize``) that can be used + with the :meth:`repacked` method for the current layout. + """ + return self.get_max_compatible_itemsize(max_itemsize, data_ptr, axis) + + def sliced(self : _StridedLayout, slices : int | slice | tuple[int | slice]) -> _StridedLayout: + """ + Returns a sliced layout. + The ``slices`` parameter can be a single integer, a single :py:class:`slice` object + or a tuple of integers/slices. + + .. hint:: + For convenience, instead of calling this method directly, please rely + on the :py:meth:`~object.__getitem__` operator (i.e. bracket syntax), e.g.: + ``layout[:, start:end:step]``. + + .. note:: + Slicing is purely a layout transformation and does not involve + any data access. + + """ + if not isinstance(slices, tuple): + slices = (slices,) + cdef _StridedLayout new_layout = _StridedLayout.__new__(_StridedLayout) + self.slice_into(new_layout, slices) + return new_layout + + def __getitem__(self : _StridedLayout, slices : int | slice | tuple[int | slice]) -> _StridedLayout: + return self.sliced(slices) + + cdef axes_mask_t get_flattened_axis_mask(_StridedLayout self) except? -1 nogil: + return flattened_strides_in_c_index_order_mask(self.base) + + cdef int get_max_compatible_itemsize(_StridedLayout self, int max_itemsize, intptr_t data_ptr, int axis=-1) except -1 nogil: + return max_compatible_itemsize(self.base, self.slice_offset, self.itemsize, max_itemsize, data_ptr, axis) + + cdef int reshape_into(_StridedLayout self, _StridedLayout out_layout, BaseLayout& new_shape) except -1 nogil: + cdef int64_t old_volume = self.get_volume() + + validate_reshaped_shape(new_shape, old_volume) + _zero_strides(new_shape) + + cdef BaseLayout flattened + if old_volume != 0: + flatten_strides_in_c_index_order(flattened, self.base, axis_mask_from_range(self.base.ndim, 0, -1)) + if not split_strides_in_c_index_order(new_shape, flattened): + raise ValueError("Layout strides are incompatible with the new shape") + + # Reset all memoized properties + out_layout._prop_mask = 0 + + # Copy preserved attributes + out_layout.slice_offset = self.slice_offset + out_layout.itemsize = self.itemsize + maybe_copy_volume(out_layout, self) + + # Set new attributes + _swap_layout(out_layout.base, new_shape) + return 0 + + cdef int permute_into(_StridedLayout self, _StridedLayout out_layout, axis_vec_t& axis_order) except -1 nogil: + if axis_order.size() != self.base.ndim: + raise ValueError(f"Permutation must have the same length as the number of dimensions, got {axis_order.size()} for {self.ndim}D tensor.") + + cdef BaseLayout permuted + permute_extents(permuted, self.base, axis_order) + + # Reset all memoized properties + out_layout._prop_mask = 0 + + # Preserved attributes + out_layout.itemsize = self.itemsize + out_layout.slice_offset = self.slice_offset + maybe_copy_volume(out_layout, self) + + # Set new attributes + _swap_layout(out_layout.base, permuted) + return 0 + + cdef int flatten_into(_StridedLayout self, _StridedLayout out_layout, axes_mask_t axis_mask) except -1 nogil: + cdef BaseLayout flattened + cdef int ndim = flatten_strides_in_c_index_order(flattened, self.base, axis_mask) + + if out_layout is self and ndim == self.base.ndim: + return 0 + + # Reset all memoized properties + out_layout._prop_mask = 0 + + # Preserved attributes + out_layout.itemsize = self.itemsize + out_layout.slice_offset = self.slice_offset + maybe_copy_volume(out_layout, self) + + # Set new attributes + _swap_layout(out_layout.base, flattened) + return 0 + + cdef int squeeze_into(_StridedLayout self, _StridedLayout out_layout) except -1 nogil: + cdef BaseLayout squeezed + squeeze_extents(squeezed, self.base) + + if out_layout is self and squeezed.ndim == self.base.ndim: + return 0 + + # Reset all memoized properties + out_layout._prop_mask = 0 + + # Preserved attributes + out_layout.itemsize = self.itemsize + out_layout.slice_offset = self.slice_offset + maybe_copy_volume(out_layout, self) + + # Set new attributes + _swap_layout(out_layout.base, squeezed) + return 0 + + cdef int unsqueeze_into(_StridedLayout self, _StridedLayout out_layout, axis_vec_t& axis_vec) except -1 nogil: + if axis_vec.size() == 0 and self is out_layout: + return 0 + + cdef BaseLayout unsqueezed + unsqueeze_extents(unsqueezed, self.base, axis_vec) + + # Reset all memoized properties + out_layout._prop_mask = 0 + + # Preserved attributes + out_layout.itemsize = self.itemsize + out_layout.slice_offset = self.slice_offset + maybe_copy_volume(out_layout, self) + + # Set new attributes + _swap_layout(out_layout.base, unsqueezed) + return 0 + + cdef int broadcast_into(_StridedLayout self, _StridedLayout out_layout, BaseLayout& broadcast) except -1 nogil: + _validate_shape(broadcast) + broadcast_extents(broadcast, self.base) + + # Reset all memoized properties + out_layout._prop_mask = 0 + + # Preserved attributes + out_layout.itemsize = self.itemsize + out_layout.slice_offset = self.slice_offset + + # Set new attributes + _swap_layout(out_layout.base, broadcast) + return 0 + + cdef int pack_into(_StridedLayout self, _StridedLayout out_layout, int itemsize, intptr_t data_ptr, bint keep_dim, int axis=-1) except -1 nogil: + + cdef BaseLayout packed + cdef stride_t new_slice_offset = 0 + cdef int vec_size = pack_extents( + packed, + new_slice_offset, + self.base, + self.slice_offset, + self.itemsize, + itemsize, + data_ptr, + keep_dim, + axis + ) + + if vec_size == 1 and out_layout is self: + return 0 + + # Reset all memoized properties + out_layout._prop_mask = 0 + + # Set new attributes + out_layout.itemsize = itemsize + out_layout.slice_offset = new_slice_offset + _swap_layout(out_layout.base, packed) + return vec_size + + cdef int unpack_into(_StridedLayout self, _StridedLayout out_layout, int itemsize, int axis=-1) except -1 nogil: + cdef BaseLayout unpacked + cdef int vec_size = unpack_extents( + unpacked, + self.base, + self.itemsize, + itemsize, + axis + ) + if vec_size == 1 and out_layout is self: + return 0 + + cdef int64_t new_slice_offset = _overflow_checked_mul(self.slice_offset, vec_size) + + # Reset all memoized properties + out_layout._prop_mask = 0 + + # Set new attributes + out_layout.itemsize = itemsize + out_layout.slice_offset = new_slice_offset + _swap_layout(out_layout.base, unpacked) + return vec_size + + cdef int slice_into(_StridedLayout self, _StridedLayout out_layout, tuple slices) except -1: + cdef BaseLayout sliced + cdef stride_t slice_offset = slice_extents(sliced, self.base, slices) + cdef int64_t new_slice_offset = _overflow_checked_sum(self.slice_offset, slice_offset) + + # Reset all memoized properties + out_layout._prop_mask = 0 + + # Preserved attributes + out_layout.itemsize = self.itemsize + + # Set new attributes + _swap_layout(out_layout.base, sliced) + out_layout.slice_offset = new_slice_offset + return 0 + +cdef inline int maybe_copy_volume(_StridedLayout out_layout, _StridedLayout in_layout) except -1 nogil: + if _has_valid_property(in_layout, PROP_VOLUME): + out_layout._volume = in_layout.get_volume() + _mark_property_valid(out_layout, PROP_VOLUME) + return 0 + + +cdef inline int validate_reshaped_shape(BaseLayout& new_shape, int64_t old_volume) except -1 nogil: + cdef int ndim = new_shape.ndim + cdef int axis = -1 + cdef extent_t extent + for i in range(ndim): + extent = new_shape.shape[i] + if extent < -1: + raise ValueError("Extents must be non-negative") + elif extent == -1: + if axis == -1: + axis = i + else: + raise ValueError("There can be at most one -1 extent in a shape") + cdef int64_t new_volume = _c_abs(_volume(new_shape)) + if axis == -1: + if new_volume != old_volume: + raise ValueError(f"The original volume {old_volume} and the new volume {new_volume} must be equal.") + else: + if new_volume == 0: + raise ValueError("The -1 extent is ambiguous when the specified sub-volume is 0") + extent = old_volume // new_volume + if extent * new_volume != old_volume: + raise ValueError(f"The original volume {old_volume} must be divisible by the specified sub-volume {new_volume}.") + new_shape.shape[axis] = extent + return 0 + + +cdef inline axes_mask_t axis_mask_from_range(int ndim, int start_axis, int end_axis) except? -1 nogil: + cdef axes_mask_t axes_mask = flatten_all_axes_mask(ndim) + if start_axis == 0 and end_axis == -1: + return axes_mask + if not _normalize_axis(start_axis, ndim): + raise ValueError(f"Invalid start axis: {start_axis} out of range for {ndim}D tensor") + if not _normalize_axis(end_axis, ndim): + raise ValueError(f"Invalid end axis: {end_axis} out of range for {ndim}D tensor") + if start_axis > 0: + axes_mask &= (AXES_MASK_ALL << start_axis) + if end_axis < ndim: + axes_mask &= (AXES_MASK_ALL >> (STRIDED_LAYOUT_MAX_NDIM - end_axis - 1)) + return axes_mask + + +cdef inline int flatten_strides_in_c_index_order(BaseLayout& out_layout, BaseLayout& in_layout, axes_mask_t axis_mask) except -1 nogil: + cdef int ndim = in_layout.ndim + if ndim == 0: + init_base_layout(out_layout, 1) + out_layout.shape[0] = 1 + out_layout.strides[0] = 1 + return 1 + init_base_layout(out_layout, ndim) + cdef int group_start = 0 + cdef int group_end = 0 + cdef int64_t group_vol + cdef int64_t group_stride + cdef int out_i = 0 + cdef extent_t* in_shape = in_layout.shape + cdef stride_t* in_strides = get_strides_ptr(in_layout) + while group_start < ndim: + group_vol = in_shape[group_start] + group_stride = in_strides[group_start] + group_end = group_start + 1 + while ( + group_end < ndim + and (axis_mask & _axis2mask(group_end)) + and group_stride == _overflow_checked_mul(in_strides[group_end], in_shape[group_end]) + ): + group_vol = _overflow_checked_mul(group_vol, in_shape[group_end]) + group_stride = in_strides[group_end] + group_end += 1 + out_layout.shape[out_i] = group_vol + out_layout.strides[out_i] = group_stride + out_i += 1 + group_start = group_end + if out_i != ndim: + trim_base_layout(out_layout, out_i) + return out_i + + +cdef inline axes_mask_t flattened_strides_in_c_index_order_mask(BaseLayout& layout) except? -1 nogil: + if layout.strides == NULL: + return flatten_all_axes_mask(layout.ndim) + cdef axes_mask_t axis_mask = 0 + cdef int ndim = layout.ndim + cdef int group_start = 0 + cdef int group_end = 0 + cdef int64_t group_vol + cdef int64_t group_stride + while group_start < ndim: + group_vol = layout.shape[group_start] + group_stride = layout.strides[group_start] + group_end = group_start + 1 + while group_end < ndim and group_stride == layout.strides[group_end] * layout.shape[group_end]: + group_vol = _overflow_checked_mul(group_vol, layout.shape[group_end]) + group_stride = layout.strides[group_end] + axis_mask |= _axis2mask(group_end) + group_end += 1 + group_start = group_end + return axis_mask + + +cdef inline bint split_strides_in_c_index_order(BaseLayout& out_layout, BaseLayout& in_layout) except -1 nogil: + cdef int i = in_layout.ndim - 1 + cdef int new_i = out_layout.ndim - 1 + cdef extent_t extent + cdef extent_t new_extent + cdef extent_t group_vol + cdef stride_t group_stride + cdef extent_t* in_shape = in_layout.shape + cdef stride_t* in_strides = get_strides_ptr(in_layout) + if out_layout.strides == NULL: + _zero_strides(out_layout) + while i >= 0: + extent = in_shape[i] + group_stride = in_strides[i] + group_vol = 1 + while new_i >= 0: + new_extent = out_layout.shape[new_i] + if new_extent == 0: + return False + if new_extent == 1 or group_vol < extent: + out_layout.strides[new_i] = group_stride + group_stride = _overflow_checked_mul(group_stride, new_extent) + group_vol = _overflow_checked_mul(group_vol, new_extent) + new_i -= 1 + else: + break + if group_vol != extent: + return False + i -= 1 + return True + + +cdef inline int permute_extents(BaseLayout& out_layout, BaseLayout& in_layout, axis_vec_t& axis_order) except -1 nogil: + cdef int ndim = in_layout.ndim + init_base_layout(out_layout, ndim) + cdef axis_t axis + cdef axes_mask_t axis_mask + cdef axes_mask_t axis_order_mask = 0 + cdef extent_t* in_shape = in_layout.shape + cdef stride_t* in_strides = get_strides_ptr(in_layout) + + for i in range(ndim): + axis = axis_order[i] + if not _normalize_axis(axis, ndim): + raise ValueError(f"Invalid permutation: axis {axis} out of range for {ndim}D tensor") + axis_mask = _axis2mask(axis) + if axis_order_mask & axis_mask: + raise ValueError(f"Invalid permutation: axis {axis_order[i]} appears multiple times.") + axis_order_mask |= axis_mask + out_layout.shape[i] = in_shape[axis] + out_layout.strides[i] = in_strides[axis] + return 0 + + +cdef inline stride_t slice_extents(BaseLayout& out_layout, BaseLayout& in_layout, tuple slices) except? -1: + cdef int ndim = in_layout.ndim + cdef int num_slices = len(slices) + if num_slices > ndim: + raise ValueError(f"The number of slices ({num_slices}) is greater than the number of dimensions ({ndim}).") + init_base_layout(out_layout, ndim) + cdef extent_t* in_shape = in_layout.shape + cdef stride_t* in_strides = get_strides_ptr(in_layout) + cdef stride_t slice_offset = 0 + cdef Py_ssize_t start + cdef Py_ssize_t stop + cdef Py_ssize_t step + cdef extent_t new_extent + cdef object py_slice + cdef bint zero_slice = False + cdef int out_i = 0 + for i in range(num_slices): + py_slice = slices[i] + if isinstance(py_slice, int): + start = py_slice + if not _normalize_axis(start, in_shape[i]): + raise ValueError(f"Invalid index: {start} out of range for axis {i} with extent {in_shape[i]}") + # single element index removes extent from the shape, + # just increase the offset and skip the shape and stride + slice_offset = _overflow_checked_sum(slice_offset, _overflow_checked_mul(start, in_strides[i])) + elif isinstance(py_slice, slice): + _PySlice_Unpack(py_slice, &start, &stop, &step) + new_extent = _PySlice_AdjustIndices(in_shape[i], &start, &stop, step) + if new_extent > 0: + # out_extent > 0 implies start is in [0, extent - 1] range + slice_offset = _overflow_checked_sum(slice_offset, _overflow_checked_mul(start, in_strides[i])) + else: + zero_slice = True + out_layout.shape[out_i] = new_extent + out_layout.strides[out_i] = _overflow_checked_mul(in_strides[i], step) + out_i += 1 + else: + raise TypeError(f"Invalid slice: {py_slice}. Expected slice instance or integer.") + for i in range(num_slices, ndim): + out_layout.shape[out_i] = in_shape[i] + out_layout.strides[out_i] = in_strides[i] + out_i += 1 + if out_i != ndim: + trim_base_layout(out_layout, out_i) + if zero_slice: + _zero_strides(out_layout) + return slice_offset + + +cdef inline int squeeze_extents(BaseLayout& out_layout, BaseLayout& in_layout) except -1 nogil: + cdef int ndim = in_layout.ndim + init_base_layout(out_layout, ndim) + cdef extent_t* in_shape = in_layout.shape + cdef stride_t* in_strides = get_strides_ptr(in_layout) + cdef int out_i = 0 + cdef extent_t extent + for i in range(ndim): + extent = in_shape[i] + if extent == 0: + trim_base_layout(out_layout, 1) + out_layout.shape[0] = 0 + out_layout.strides[0] = 0 + return 1 + elif extent != 1: + out_layout.shape[out_i] = extent + out_layout.strides[out_i] = in_strides[i] + out_i += 1 + if out_i != ndim: + trim_base_layout(out_layout, out_i) + return out_i + + +cdef inline int unsqueeze_extents(BaseLayout& out_layout, BaseLayout& in_layout, axis_vec_t& axis_vec) except -1 nogil: + cdef int ndim = in_layout.ndim + cdef int num_new_axes = axis_vec.size() + cdef int out_ndim = ndim + num_new_axes + # init_base_layout validates out_ndim + init_base_layout(out_layout, out_ndim) + cdef extent_t* in_shape = in_layout.shape + cdef stride_t* in_strides = get_strides_ptr(in_layout) + cdef axes_mask_t out_shape_mask = 0 + cdef axes_mask_t axis_mask = 0 + cdef axis_t axis + for i in range(num_new_axes): + axis = axis_vec[i] + if not _normalize_axis(axis, out_ndim): + raise ValueError(f"Invalid axis: {axis} out of range for {out_ndim}D tensor") + axis_mask = _axis2mask(axis) + if out_shape_mask & axis_mask: + raise ValueError(f"Axis {axis} appears multiple times.") + out_shape_mask |= axis_mask + cdef int in_i = 0 + for i in range(out_ndim): + axis_mask = _axis2mask(i) + if out_shape_mask & axis_mask: + out_layout.shape[i] = 1 + if in_i < ndim: + out_layout.strides[i] = _overflow_checked_mul(in_shape[in_i], in_strides[in_i]) + else: + if ndim > 0: + out_layout.strides[i] = in_strides[ndim - 1] + else: + out_layout.strides[i] = 1 + else: + out_layout.shape[i] = in_shape[in_i] + out_layout.strides[i] = in_strides[in_i] + in_i += 1 + assert in_i == ndim + return 0 + + +cdef inline int broadcast_extents(BaseLayout& broadcast, BaseLayout& in_layout) except -1 nogil: + if broadcast.ndim < in_layout.ndim: + raise ValueError( + f"The broadcast shape ndim ({broadcast.ndim}) must be " + f"greater than or equal to the input shape " + f"ndim ({in_layout.ndim})." + ) + cdef int ndim_diff = broadcast.ndim - in_layout.ndim + _zero_strides(broadcast) + cdef extent_t* in_shape = in_layout.shape + cdef stride_t* in_strides = get_strides_ptr(in_layout) + cdef extent_t* broadcast_shape = broadcast.shape + ndim_diff + cdef stride_t* broadcast_strides = broadcast.strides + ndim_diff + for i in range(in_layout.ndim): + if in_shape[i] == broadcast_shape[i]: + broadcast_strides[i] = in_strides[i] + elif in_shape[i] != 1: + raise ValueError( + f"Shapes cannot be broadcast together: " + f"the original extent must be 1 or be equal to broadcast extent, " + f"got {in_shape[i]} and {broadcast_shape[i]} for axis {i}." + ) + # else -> in_extent == 1, the broadcast extent and zero stride are already set + return 0 + + +cdef inline int64_t gcd(int64_t a, int64_t b) except? -1 nogil: + while b != 0: + a, b = b, a % b + return a + + +cdef inline int pack_extents(BaseLayout& out_layout, stride_t& out_slice_offset, BaseLayout& in_layout, stride_t slice_offset, int itemsize, int new_itemsize, intptr_t data_ptr, bint keep_dim, int axis) except -1 nogil: + cdef int ndim = in_layout.ndim + if new_itemsize <= 0: + raise ValueError(f"new itemsize must be greater than zero, got {new_itemsize}.") + if itemsize <= 0: + raise ValueError(f"itemsize must be greater than zero, got {itemsize}.") + if new_itemsize <= itemsize: + if new_itemsize == itemsize: + return 1 + raise ValueError(f"new itemsize ({new_itemsize}) must be greater than or equal to itemsize ({itemsize}).") + if not _normalize_axis(axis, ndim): + raise ValueError(f"Invalid axis: {axis} out of range for {ndim}D tensor") + if data_ptr % new_itemsize != 0: + raise ValueError(f"The data pointer ({data_ptr}) must be aligned to the packed itemsize ({new_itemsize}).") + + cdef extent_t* shape = in_layout.shape + cdef stride_t* strides = get_strides_ptr(in_layout) + if strides[axis] != 1: + raise ValueError(f"The axis {axis} stride must be 1, got {strides[axis]}.") + + cdef int vec_size = new_itemsize // itemsize + cdef extent_t packed_extent = shape[axis] + if packed_extent == 0: + raise ValueError(f"The axis {axis} extent must be non-zero, got {shape[axis]}.") + packed_extent //= vec_size + if packed_extent * vec_size != shape[axis]: + raise ValueError(f"The axis {axis} extent ({shape[axis]}) must be divisible by {vec_size}.") + + cdef stride_t new_slice_offset = slice_offset // vec_size + if new_slice_offset * vec_size != slice_offset: + raise ValueError(f"The slice offset ({slice_offset}) must be divisible by {vec_size}.") + out_slice_offset = new_slice_offset + + init_base_layout(out_layout, ndim) + cdef stride_t packed_stride + cdef int out_i = 0 + for i in range(ndim): + if i == axis: + if keep_dim or packed_extent != 1: # omit the packed axis if it is reduced to 1 + out_layout.shape[out_i] = packed_extent + out_layout.strides[out_i] = 1 + out_i += 1 + else: + packed_stride = strides[i] // vec_size + if packed_stride * vec_size != strides[i]: + raise ValueError(f"The {i} axis stride ({strides[i]}) must be divisible by {vec_size}.") + out_layout.shape[out_i] = shape[i] + out_layout.strides[out_i] = packed_stride + out_i += 1 + if out_i != ndim: + trim_base_layout(out_layout, out_i) + return vec_size + + +cdef inline int unpack_extents(BaseLayout &out_layout, BaseLayout &in_layout, int itemsize, int new_itemsize, int axis) except -1 nogil: + cdef int ndim = in_layout.ndim + if not _normalize_axis(axis, ndim): + raise ValueError(f"Invalid axis: {axis} out of range for {ndim}D tensor") + if new_itemsize <= 0: + raise ValueError(f"new itemsize must be greater than zero, got {new_itemsize}.") + if itemsize <= 0: + raise ValueError(f"itemsize must be greater than zero, got {itemsize}.") + if new_itemsize >= itemsize: + if new_itemsize == itemsize: + return 1 + raise ValueError(f"new itemsize ({new_itemsize}) must be less than or equal to itemsize ({itemsize}).") + + cdef extent_t* shape = in_layout.shape + cdef stride_t* strides = get_strides_ptr(in_layout) + if shape[axis] == 0: + raise ValueError(f"The axis {axis} extent must be non-zero, got {shape[axis]}.") + if strides[axis] != 1: + raise ValueError(f"The axis {axis} stride must be 1, got {strides[axis]}.") + + cdef int vec_size = itemsize // new_itemsize + init_base_layout(out_layout, ndim) + out_layout.shape[axis] = _overflow_checked_mul(shape[axis], vec_size) + out_layout.strides[axis] = 1 + + for i in range(ndim): + if i == axis: + continue + out_layout.shape[i] = shape[i] + out_layout.strides[i] = _overflow_checked_mul(strides[i], vec_size) + return vec_size + + +cdef inline int max_compatible_itemsize(BaseLayout& layout, stride_t slice_offset, int itemsize, int max_itemsize, intptr_t data_ptr, int axis) except? -1 nogil: + cdef int ndim = layout.ndim + if max_itemsize <= 0: + raise ValueError(f"max_itemsize must be greater than zero, got {max_itemsize}.") + if itemsize <= 0: + raise ValueError(f"itemsize must be greater than zero, got {itemsize}.") + if not _normalize_axis(axis, ndim): + raise ValueError(f"Invalid axis: {axis} out of range for {ndim}D tensor") + if max_itemsize < itemsize: + raise ValueError(f"max_itemsize ({max_itemsize}) cannot be less than itemsize ({itemsize}).") + max_itemsize = gcd(max_itemsize, _c_abs(data_ptr)) + cdef extent_t* shape = layout.shape + cdef stride_t* strides = get_strides_ptr(layout) + if ndim < 1 or strides[axis] != 1 or shape[axis] == 0: + return itemsize + max_itemsize = gcd(max_itemsize, _overflow_checked_mul(slice_offset, itemsize)) + max_itemsize = gcd(max_itemsize, _overflow_checked_mul(shape[axis], itemsize)) + for i in range(ndim): + if i == axis: + continue + max_itemsize = gcd(max_itemsize, _overflow_checked_mul(_c_abs(strides[i]), itemsize)) + return max_itemsize diff --git a/cuda_core/cuda/core/_linker.pxd b/cuda_core/cuda/core/_linker.pxd new file mode 100644 index 00000000000..1b7d39fd1d4 --- /dev/null +++ b/cuda_core/cuda/core/_linker.pxd @@ -0,0 +1,25 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from libcpp.vector cimport vector + +from cuda.bindings cimport cydriver + +from ._resource_handles cimport NvJitLinkHandle, CuLinkHandle + + +cdef class Linker: + cdef: + NvJitLinkHandle _nvjitlink_handle + CuLinkHandle _culink_handle + # The driver retains these arrays until cuLinkDestroy. Declare them + # after the handle so their destructors run after cuLinkDestroy. + vector[cydriver.CUjit_option] _drv_jit_keys + vector[void*] _drv_jit_values + bint _use_nvjitlink + object _drv_log_bufs # formatted_options list (driver); None for nvjitlink + str _info_log # decoded log; None until link() or pre-link get_*_log() + str _error_log # decoded log; None until link() or pre-link get_*_log() + object _options # LinkerOptions + object __weakref__ diff --git a/cuda_core/cuda/core/_linker.pyi b/cuda_core/cuda/core/_linker.pyi new file mode 100644 index 00000000000..37e05fc7fe6 --- /dev/null +++ b/cuda_core/cuda/core/_linker.pyi @@ -0,0 +1,251 @@ +# This file was generated by stubgen-pyx v0.2.6 from cuda_core/cuda/core/_linker.pyx + +"""Linking machinery for combining object codes. + +This module provides :class:`Linker` for linking one or more +:class:`~cuda.core.ObjectCode` objects, with :class:`LinkerOptions` for +configuration. +""" +from __future__ import annotations + +from dataclasses import dataclass +from typing import Union + +import cuda.bindings.driver +import cuda.bindings.nvjitlink +from cuda.core._module import ObjectCode +from cuda.core.typing import CompilerBackendType, ObjectCodeFormatType + + +class Linker: + """Represent a linking machinery to link one or more object codes into + :class:`~cuda.core.ObjectCode`. + + This object provides a unified interface to multiple underlying + linker libraries (such as nvJitLink or cuLink* from the CUDA driver). + + Parameters + ---------- + object_codes : :class:`~cuda.core.ObjectCode` + One or more ObjectCode objects to be linked. + options : :class:`LinkerOptions`, optional + Options for the linker. If not provided, default options will be used. + """ + + def __init__(self, options: LinkerOptions | None=None, *object_codes: ObjectCode): + ... + + def link(self, target_type: ObjectCodeFormatType | str) -> ObjectCode: + """Link the provided object codes into a single output of the specified target type. + + Parameters + ---------- + target_type : ObjectCodeFormatType | str + The type of the target output. Must be either "cubin" or "ptx". + + Returns + ------- + :class:`~cuda.core.ObjectCode` + The linked object code of the specified target type. + + .. note:: + + Ensure that input object codes were compiled with appropriate + flags for linking (e.g., relocatable device code enabled). + """ + + def get_error_log(self) -> str: + """Get the error log generated by the linker. + + Returns + ------- + str + The error log. + """ + + def get_info_log(self) -> str: + """Get the info log generated by the linker. + + Returns + ------- + str + The info log. + """ + + def close(self) -> None: + """Destroy this linker.""" + + @property + def handle(self) -> LinkerHandleT: + """Return the underlying handle object. + + .. note:: + + The type of the returned object depends on the backend. + + .. caution:: + + This handle is a Python object. To get the memory address of the underlying C + handle, call ``int(Linker.handle)``. + """ + + @classmethod + def which_backend(cls) -> CompilerBackendType: + """Return which linking backend will be used. + + Returns :attr:`~CompilerBackendType.NVJITLINK` when the nvJitLink + library is available and meets the minimum version requirement, + otherwise :attr:`~CompilerBackendType.DRIVER`. + + .. note:: + + Prefer letting :class:`Linker` decide. Query ``which_backend()`` + only when you need to dispatch based on input format (for + example: choose PTX vs. LTOIR before constructing a + ``Linker``). The returned value names an implementation + detail whose support matrix may shift across CTK releases. + """ + +@dataclass +class LinkerOptions: + """Customizable options for configuring :class:`Linker`. + + Since the linker may choose to use nvJitLink or the driver APIs as the linking backend, + not all options are applicable. When the system's installed nvJitLink is too old (<12.3), + not installed, or older than the CUDA driver major version, the driver APIs (cuLink) + will be used instead. + + Attributes + ---------- + name : str, optional + Name of the linker. If the linking succeeds, the name is passed down to the generated :class:`ObjectCode`. + arch : str, optional + Pass the SM architecture value, such as ``sm_`` (for generating CUBIN) or + ``compute_`` (for generating PTX). If not provided, the current device's architecture + will be used. + max_register_count : int, optional + Maximum register count. + time : bool, optional + Print timing information to the info log. + Default: False. + verbose : bool, optional + Print verbose messages to the info log. + Default: False. + link_time_optimization : bool, optional + Perform link time optimization. + Default: False. + ptx : bool, optional + Emit PTX after linking instead of CUBIN; only supported with ``link_time_optimization=True``. + Default: False. + optimization_level : int, optional + Set optimization level. Only 0 and 3 are accepted. + debug : bool, optional + Generate debug information. + Default: False. + lineinfo : bool, optional + Generate line information. + Default: False. + ftz : bool, optional + Flush denormal values to zero. + Default: False. + prec_div : bool, optional + Use precise division. + Default: True. + prec_sqrt : bool, optional + Use precise square root. + Default: True. + fma : bool, optional + Use fast multiply-add. + Default: True. + kernels_used : [str | tuple[str] | list[str]], optional + Pass a kernel or sequence of kernels that are used; any not in the list can be removed. + variables_used : [str | tuple[str] | list[str]], optional + Pass a variable or sequence of variables that are used; any not in the list can be removed. + optimize_unused_variables : bool, optional + Assume that if a variable is not referenced in device code, it can be removed. + Default: False. + ptxas_options : [str | tuple[str] | list[str]], optional + Pass options to PTXAS. + split_compile : int, optional + Split compilation maximum thread count. Use 0 to use all available processors. Value of 1 disables split + compilation (default). + Default: 1. + split_compile_extended : int, optional + A more aggressive form of split compilation available in LTO mode only. Accepts a maximum thread count value. + Use 0 to use all available processors. Value of 1 disables extended split compilation (default). Note: This + option can potentially impact performance of the compiled binary. + Default: 1. + no_cache : bool, optional + Do not cache the intermediate steps of nvJitLink. + Default: False. + """ + name: str | None = '' + arch: str | None = None + max_register_count: int | None = None + time: bool | None = None + verbose: bool | None = None + link_time_optimization: bool | None = None + ptx: bool | None = None + optimization_level: int | None = None + debug: bool | None = None + lineinfo: bool | None = None + ftz: bool | None = None + prec_div: bool | None = None + prec_sqrt: bool | None = None + fma: bool | None = None + kernels_used: str | tuple[str] | list[str] | None = None + variables_used: str | tuple[str] | list[str] | None = None + optimize_unused_variables: bool | None = None + ptxas_options: str | tuple[str] | list[str] | None = None + split_compile: int | None = None + split_compile_extended: int | None = None + no_cache: bool | None = None + numba_debug: bool | None = None + + def __post_init__(self) -> None: + ... + + def _prepare_nvjitlink_options(self, as_bytes: bool=False) -> list[bytes] | list[str]: + ... + + def _prepare_driver_options(self) -> tuple[list[object], list[object]]: + ... + + def as_bytes(self, backend: str='nvjitlink') -> list[bytes]: + """Convert linker options to bytes format for the nvjitlink backend. + + Parameters + ---------- + backend : str, optional + The linker backend. Only "nvjitlink" is supported. Default is "nvjitlink". + + Returns + ------- + list[bytes] + List of option strings encoded as bytes. + + Raises + ------ + ValueError + If an unsupported backend is specified. + RuntimeError + If nvJitLink backend is not available. + """ +_keep_driver_in_stub: 'cuda.bindings.driver.CUlinkState' +_keep_nvjitlink_in_stub: 'cuda.bindings.nvjitlink.nvJitLinkHandle' +__all__ = ['Linker', 'LinkerOptions'] +LinkerHandleT = Union['cuda.bindings.nvjitlink.nvJitLinkHandle', 'cuda.bindings.driver.CUlinkState'] +_driver = None +_inited = False +_use_nvjitlink_backend = None +_nvjitlink_input_types = None +_driver_input_types = None + +def _nvjitlink_has_version_symbol(nvjitlink) -> bool: + ... + +def _decide_nvjitlink_or_driver() -> bool: + """Return True if falling back to the cuLink* driver APIs.""" + +def _lazy_init() -> None: + ... \ No newline at end of file diff --git a/cuda_core/cuda/core/_linker.pyx b/cuda_core/cuda/core/_linker.pyx new file mode 100644 index 00000000000..172b176c844 --- /dev/null +++ b/cuda_core/cuda/core/_linker.pyx @@ -0,0 +1,745 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +"""Linking machinery for combining object codes. + +This module provides :class:`Linker` for linking one or more +:class:`~cuda.core.ObjectCode` objects, with :class:`LinkerOptions` for +configuration. +""" + +from __future__ import annotations + +from cpython.bytearray cimport PyByteArray_AS_STRING +from libc.stdint cimport intptr_t, uint32_t +from libcpp.vector cimport vector +from cuda.bindings cimport cydriver +from cuda.bindings cimport cynvjitlink + +from ._resource_handles cimport ( + as_cu, + as_py, + create_culink_handle, + create_nvjitlink_handle, +) +from cuda.core._utils.cuda_utils cimport HANDLE_RETURN, HANDLE_RETURN_NVJITLINK + +import sys +from dataclasses import dataclass +from typing import TYPE_CHECKING, Union +from warnings import warn + +from cuda.pathfinder._optional_cuda_import import _optional_cuda_import +from cuda.core._device import Device +from cuda.core._module import ObjectCode +from cuda.core._utils.clear_error_support import assert_type +from cuda.core._utils.cuda_utils import ( + CUDAError, + check_or_create_options, + driver, + is_sequence, +) +from cuda.core._utils.version import driver_version +from cuda.core.typing import CompilerBackendType, ObjectCodeFormatType + +if TYPE_CHECKING: + import cuda.bindings.driver # no-cython-lint + import cuda.bindings.nvjitlink # no-cython-lint + +# Module-level annotations to ensure stubgen-pyx keeps the above imports in +# the generated `.pyi` so that the LinkerHandleT forward references resolve. +# These names are not assigned, so they only affect __annotations__. +_keep_driver_in_stub: "cuda.bindings.driver.CUlinkState" +_keep_nvjitlink_in_stub: "cuda.bindings.nvjitlink.nvJitLinkHandle" + +ctypedef const char* const_char_ptr + +__all__ = ["Linker", "LinkerOptions"] + +LinkerHandleT = Union["cuda.bindings.nvjitlink.nvJitLinkHandle", "cuda.bindings.driver.CUlinkState"] + + +# ============================================================================= +# Principal class +# ============================================================================= + +cdef class Linker: + """Represent a linking machinery to link one or more object codes into + :class:`~cuda.core.ObjectCode`. + + This object provides a unified interface to multiple underlying + linker libraries (such as nvJitLink or cuLink* from the CUDA driver). + + Parameters + ---------- + object_codes : :class:`~cuda.core.ObjectCode` + One or more ObjectCode objects to be linked. + options : :class:`LinkerOptions`, optional + Options for the linker. If not provided, default options will be used. + """ + + def __init__(self, *object_codes: ObjectCode, options: LinkerOptions | None = None): + Linker_init(self, object_codes, options) + + def link(self, target_type: ObjectCodeFormatType | str) -> ObjectCode: + """Link the provided object codes into a single output of the specified target type. + + Parameters + ---------- + target_type : ObjectCodeFormatType | str + The type of the target output. Must be either "cubin" or "ptx". + + Returns + ------- + :class:`~cuda.core.ObjectCode` + The linked object code of the specified target type. + + .. note:: + + Ensure that input object codes were compiled with appropriate + flags for linking (e.g., relocatable device code enabled). + """ + return Linker_link(self, str(target_type)) + + def get_error_log(self) -> str: + """Get the error log generated by the linker. + + Returns + ------- + str + The error log. + """ + # After link(), the decoded log is cached here. + if self._error_log is not None: + return self._error_log + cdef cynvjitlink.nvJitLinkHandle c_h + cdef size_t c_log_size = 0 + cdef char* c_log_ptr + if self._use_nvjitlink: + c_h = as_cu(self._nvjitlink_handle) + HANDLE_RETURN_NVJITLINK(c_h, cynvjitlink.nvJitLinkGetErrorLogSize(c_h, &c_log_size)) + log = bytearray(c_log_size) + if c_log_size > 0: + c_log_ptr = (log) + HANDLE_RETURN_NVJITLINK(c_h, cynvjitlink.nvJitLinkGetErrorLog(c_h, c_log_ptr)) + return log.decode("utf-8", errors="backslashreplace") + else: + return (self._drv_log_bufs[2]).decode( + "utf-8", errors="backslashreplace").rstrip('\x00') + + def get_info_log(self) -> str: + """Get the info log generated by the linker. + + Returns + ------- + str + The info log. + """ + # After link(), the decoded log is cached here. + if self._info_log is not None: + return self._info_log + cdef cynvjitlink.nvJitLinkHandle c_h + cdef size_t c_log_size = 0 + cdef char* c_log_ptr + if self._use_nvjitlink: + c_h = as_cu(self._nvjitlink_handle) + HANDLE_RETURN_NVJITLINK(c_h, cynvjitlink.nvJitLinkGetInfoLogSize(c_h, &c_log_size)) + log = bytearray(c_log_size) + if c_log_size > 0: + c_log_ptr = (log) + HANDLE_RETURN_NVJITLINK(c_h, cynvjitlink.nvJitLinkGetInfoLog(c_h, c_log_ptr)) + return log.decode("utf-8", errors="backslashreplace") + else: + return (self._drv_log_bufs[0]).decode( + "utf-8", errors="backslashreplace").rstrip('\x00') + + def close(self) -> None: + """Destroy this linker.""" + cdef vector[cydriver.CUjit_option] empty_keys + cdef vector[void*] empty_values + if self._use_nvjitlink: + self._nvjitlink_handle.reset() + else: + if self._drv_log_bufs is not None: + if self._info_log is None: + self._info_log = self.get_info_log() + if self._error_log is None: + self._error_log = self.get_error_log() + # Destroy the CUlinkState before releasing storage referenced by it. + self._culink_handle.reset() + self._drv_jit_keys.swap(empty_keys) + self._drv_jit_values.swap(empty_values) + self._drv_log_bufs = None + + @property + def handle(self) -> LinkerHandleT: + """Return the underlying handle object. + + .. note:: + + The type of the returned object depends on the backend. + + .. caution:: + + This handle is a Python object. To get the memory address of the underlying C + handle, call ``int(Linker.handle)``. + """ + if self._use_nvjitlink: + return as_py(self._nvjitlink_handle) + else: + return as_py(self._culink_handle) + + @classmethod + def which_backend(cls) -> CompilerBackendType: + """Return which linking backend will be used. + + Returns :attr:`~CompilerBackendType.NVJITLINK` when the nvJitLink + library is available and meets the minimum version requirement, + otherwise :attr:`~CompilerBackendType.DRIVER`. + + .. note:: + + Prefer letting :class:`Linker` decide. Query ``which_backend()`` + only when you need to dispatch based on input format (for + example: choose PTX vs. LTOIR before constructing a + ``Linker``). The returned value names an implementation + detail whose support matrix may shift across CTK releases. + """ + return CompilerBackendType.DRIVER if _decide_nvjitlink_or_driver() else CompilerBackendType.NVJITLINK + + +# ============================================================================= +# Supporting classes +# ============================================================================= + +@dataclass +class LinkerOptions: + """Customizable options for configuring :class:`Linker`. + + Since the linker may choose to use nvJitLink or the driver APIs as the linking backend, + not all options are applicable. When the system's installed nvJitLink is too old (<12.3), + not installed, or older than the CUDA driver major version, the driver APIs (cuLink) + will be used instead. + + Attributes + ---------- + name : str, optional + Name of the linker. If the linking succeeds, the name is passed down to the generated :class:`ObjectCode`. + arch : str, optional + Pass the SM architecture value, such as ``sm_`` (for generating CUBIN) or + ``compute_`` (for generating PTX). If not provided, the current device's architecture + will be used. + max_register_count : int, optional + Maximum register count. + time : bool, optional + Print timing information to the info log. + Default: False. + verbose : bool, optional + Print verbose messages to the info log. + Default: False. + link_time_optimization : bool, optional + Perform link time optimization. + Default: False. + ptx : bool, optional + Emit PTX after linking instead of CUBIN; only supported with ``link_time_optimization=True``. + Default: False. + optimization_level : int, optional + Set optimization level. Only 0 and 3 are accepted. + debug : bool, optional + Generate debug information. + Default: False. + lineinfo : bool, optional + Generate line information. + Default: False. + ftz : bool, optional + Flush denormal values to zero. + Default: False. + prec_div : bool, optional + Use precise division. + Default: True. + prec_sqrt : bool, optional + Use precise square root. + Default: True. + fma : bool, optional + Use fast multiply-add. + Default: True. + kernels_used : [str | tuple[str] | list[str]], optional + Pass a kernel or sequence of kernels that are used; any not in the list can be removed. + variables_used : [str | tuple[str] | list[str]], optional + Pass a variable or sequence of variables that are used; any not in the list can be removed. + optimize_unused_variables : bool, optional + Assume that if a variable is not referenced in device code, it can be removed. + Default: False. + ptxas_options : [str | tuple[str] | list[str]], optional + Pass options to PTXAS. + split_compile : int, optional + Split compilation maximum thread count. Use 0 to use all available processors. Value of 1 disables split + compilation (default). + Default: 1. + split_compile_extended : int, optional + A more aggressive form of split compilation available in LTO mode only. Accepts a maximum thread count value. + Use 0 to use all available processors. Value of 1 disables extended split compilation (default). Note: This + option can potentially impact performance of the compiled binary. + Default: 1. + no_cache : bool, optional + Do not cache the intermediate steps of nvJitLink. + Default: False. + """ + + name: str | None = "" + arch: str | None = None + max_register_count: int | None = None + time: bool | None = None + verbose: bool | None = None + link_time_optimization: bool | None = None + ptx: bool | None = None + optimization_level: int | None = None + debug: bool | None = None + lineinfo: bool | None = None + ftz: bool | None = None + prec_div: bool | None = None + prec_sqrt: bool | None = None + fma: bool | None = None + kernels_used: str | tuple[str] | list[str] | None = None + variables_used: str | tuple[str] | list[str] | None = None + optimize_unused_variables: bool | None = None + ptxas_options: str | tuple[str] | list[str] | None = None + split_compile: int | None = None + split_compile_extended: int | None = None + no_cache: bool | None = None + numba_debug: bool | None = None + + def __post_init__(self) -> None: + _lazy_init() + self._name = self.name.encode() + + def _prepare_nvjitlink_options(self, as_bytes: bool = False) -> list[bytes] | list[str]: + options = [] + + if self.arch is not None: + options.append(f"-arch={self.arch}") + else: + options.append("-arch=sm_" + "".join(f"{i}" for i in Device().compute_capability)) + if self.max_register_count is not None: + options.append(f"-maxrregcount={self.max_register_count}") + if self.time is not None: + options.append("-time") + if self.verbose: + options.append("-verbose") + if self.link_time_optimization: + options.append("-lto") + if self.ptx: + options.append("-ptx") + if self.optimization_level is not None: + options.append(f"-O{self.optimization_level}") + if self.debug: + options.append("-g") + if self.lineinfo: + options.append("-lineinfo") + if self.ftz is not None: + options.append(f"-ftz={'true' if self.ftz else 'false'}") + if self.prec_div is not None: + options.append(f"-prec-div={'true' if self.prec_div else 'false'}") + if self.prec_sqrt is not None: + options.append(f"-prec-sqrt={'true' if self.prec_sqrt else 'false'}") + if self.fma is not None: + options.append(f"-fma={'true' if self.fma else 'false'}") + if self.kernels_used is not None: + if isinstance(self.kernels_used, str): + options.append(f"-kernels-used={self.kernels_used}") + elif isinstance(self.kernels_used, list): + for kernel in self.kernels_used: + options.append(f"-kernels-used={kernel}") + if self.variables_used is not None: + if isinstance(self.variables_used, str): + options.append(f"-variables-used={self.variables_used}") + elif isinstance(self.variables_used, list): + for variable in self.variables_used: + options.append(f"-variables-used={variable}") + if self.optimize_unused_variables is not None: + options.append("-optimize-unused-variables") + if self.ptxas_options is not None: + if isinstance(self.ptxas_options, str): + options.append(f"-Xptxas={self.ptxas_options}") + elif is_sequence(self.ptxas_options): + for opt in self.ptxas_options: + options.append(f"-Xptxas={opt}") + if self.split_compile is not None: + options.append(f"-split-compile={self.split_compile}") + if self.split_compile_extended is not None: + options.append(f"-split-compile-extended={self.split_compile_extended}") + if self.no_cache is True: + options.append("-no-cache") + + if as_bytes: + return [o.encode() for o in options] + else: + return options + + def _prepare_driver_options(self) -> tuple[list[object], list[object]]: + formatted_options = [] + option_keys = [] + + # allocate a fixed-sized buffer for each info/error log + size = 4194304 + formatted_options.extend((bytearray(size), size, bytearray(size), size)) + option_keys.extend( + ( + _driver.CUjit_option.CU_JIT_INFO_LOG_BUFFER, + _driver.CUjit_option.CU_JIT_INFO_LOG_BUFFER_SIZE_BYTES, + _driver.CUjit_option.CU_JIT_ERROR_LOG_BUFFER, + _driver.CUjit_option.CU_JIT_ERROR_LOG_BUFFER_SIZE_BYTES, + ) + ) + + if self.arch is not None: + arch = self.arch.split("_")[-1].upper() + formatted_options.append(getattr(_driver.CUjit_target, f"CU_TARGET_COMPUTE_{arch}")) + option_keys.append(_driver.CUjit_option.CU_JIT_TARGET) + if self.max_register_count is not None: + formatted_options.append(self.max_register_count) + option_keys.append(_driver.CUjit_option.CU_JIT_MAX_REGISTERS) + if self.time is not None: + raise ValueError("time option is not supported by the driver API") + if self.verbose: + formatted_options.append(1) + option_keys.append(_driver.CUjit_option.CU_JIT_LOG_VERBOSE) + if self.link_time_optimization: + formatted_options.append(1) + option_keys.append(_driver.CUjit_option.CU_JIT_LTO) + if self.ptx: + raise ValueError("ptx option is not supported by the driver API") + if self.optimization_level is not None: + formatted_options.append(self.optimization_level) + option_keys.append(_driver.CUjit_option.CU_JIT_OPTIMIZATION_LEVEL) + if self.debug: + formatted_options.append(1) + option_keys.append(_driver.CUjit_option.CU_JIT_GENERATE_DEBUG_INFO) + if self.lineinfo: + formatted_options.append(1) + option_keys.append(_driver.CUjit_option.CU_JIT_GENERATE_LINE_INFO) + if self.ftz is not None: + warn("ftz option is deprecated in the driver API", DeprecationWarning, stacklevel=3) + if self.prec_div is not None: + warn("prec_div option is deprecated in the driver API", DeprecationWarning, stacklevel=3) + if self.prec_sqrt is not None: + warn("prec_sqrt option is deprecated in the driver API", DeprecationWarning, stacklevel=3) + if self.fma is not None: + warn("fma options is deprecated in the driver API", DeprecationWarning, stacklevel=3) + if self.kernels_used is not None: + warn("kernels_used is deprecated in the driver API", DeprecationWarning, stacklevel=3) + if self.variables_used is not None: + warn("variables_used is deprecated in the driver API", DeprecationWarning, stacklevel=3) + if self.optimize_unused_variables is not None: + warn("optimize_unused_variables is deprecated in the driver API", DeprecationWarning, stacklevel=3) + if self.ptxas_options is not None: + raise ValueError("ptxas_options option is not supported by the driver API") + if self.split_compile is not None: + raise ValueError("split_compile option is not supported by the driver API") + if self.split_compile_extended is not None: + raise ValueError("split_compile_extended option is not supported by the driver API") + if self.no_cache is True: + formatted_options.append(_driver.CUjit_cacheMode.CU_JIT_CACHE_OPTION_NONE) + option_keys.append(_driver.CUjit_option.CU_JIT_CACHE_MODE) + + return formatted_options, option_keys + + def as_bytes(self, backend: str = "nvjitlink") -> list[bytes]: + """Convert linker options to bytes format for the nvjitlink backend. + + Parameters + ---------- + backend : str, optional + The linker backend. Only "nvjitlink" is supported. Default is "nvjitlink". + + Returns + ------- + list[bytes] + List of option strings encoded as bytes. + + Raises + ------ + ValueError + If an unsupported backend is specified. + RuntimeError + If nvJitLink backend is not available. + """ + backend = backend.lower() + if backend != "nvjitlink": + raise ValueError(f"as_bytes() only supports 'nvjitlink' backend, got '{backend}'") + if not _use_nvjitlink_backend: + raise RuntimeError("nvJitLink backend is not available") + return self._prepare_nvjitlink_options(as_bytes=True) + + +# ============================================================================= +# Private implementation: cdef inline helpers +# ============================================================================= + +cdef inline int Linker_init(Linker self, tuple object_codes, object options) except -1: + """Initialize a Linker instance.""" + if len(object_codes) == 0: + raise ValueError("At least one ObjectCode object must be provided") + + cdef cynvjitlink.nvJitLinkHandle c_raw_nvjitlink + cdef cydriver.CUlinkState c_raw_culink + cdef Py_ssize_t c_num_opts, i + cdef vector[const_char_ptr] c_str_opts + cdef cydriver.CUjit_option* c_drv_jit_keys_ptr + cdef void** c_drv_jit_values_ptr + + self._options = options = check_or_create_options(LinkerOptions, options, "Linker options") + + if _use_nvjitlink_backend: + self._use_nvjitlink = True + options_bytes = options._prepare_nvjitlink_options(as_bytes=True) + c_num_opts = len(options_bytes) + c_str_opts.resize(c_num_opts) + for i in range(c_num_opts): + c_str_opts[i] = (options_bytes[i]) + with nogil: + HANDLE_RETURN_NVJITLINK(NULL, cynvjitlink.nvJitLinkCreate( + &c_raw_nvjitlink, c_num_opts, c_str_opts.data())) + self._nvjitlink_handle = create_nvjitlink_handle(c_raw_nvjitlink) + else: + self._use_nvjitlink = False + formatted_options, option_keys = options._prepare_driver_options() + # Keep the formatted_options list alive: it contains bytearrays that + # the driver writes into via raw pointers during linking operations. + self._drv_log_bufs = formatted_options + c_num_opts = len(option_keys) + self._drv_jit_keys.resize(c_num_opts) + self._drv_jit_values.resize(c_num_opts) + for i in range(c_num_opts): + self._drv_jit_keys[i] = option_keys[i] + val = formatted_options[i] + if isinstance(val, bytearray): + self._drv_jit_values[i] = PyByteArray_AS_STRING(val) + else: + self._drv_jit_values[i] = int(val) + c_drv_jit_keys_ptr = self._drv_jit_keys.data() + c_drv_jit_values_ptr = self._drv_jit_values.data() + try: + with nogil: + HANDLE_RETURN(cydriver.cuLinkCreate( + c_num_opts, + c_drv_jit_keys_ptr, + c_drv_jit_values_ptr, + &c_raw_culink)) + except CUDAError as e: + Linker_annotate_error_log(self, e) + raise + self._culink_handle = create_culink_handle(c_raw_culink) + + for code in object_codes: + assert_type(code, ObjectCode) + Linker_add_code_object(self, code) + return 0 + + +cdef inline void Linker_add_code_object(Linker self, object object_code) except *: + """Add a single ObjectCode to the linker.""" + data = object_code.code + cdef cynvjitlink.nvJitLinkHandle c_nvjitlink_h + cdef cydriver.CUlinkState c_culink_state + cdef cynvjitlink.nvJitLinkInputType c_nv_input_type + cdef cydriver.CUjitInputType c_drv_input_type + cdef const char* c_data_ptr + cdef size_t c_data_size + cdef const char* c_name_ptr + cdef const char* c_file_ptr + + name_bytes = f"{object_code.name}".encode() + c_name_ptr = name_bytes + + input_types = _nvjitlink_input_types if self._use_nvjitlink else _driver_input_types + py_input_type = input_types.get(object_code.code_type) + if py_input_type is None: + raise ValueError(f"Unknown code_type associated with ObjectCode: {object_code.code_type}") + + if self._use_nvjitlink: + c_nvjitlink_h = as_cu(self._nvjitlink_handle) + c_nv_input_type = py_input_type + if isinstance(data, bytes): + c_data_ptr = (data) + c_data_size = len(data) + with nogil: + HANDLE_RETURN_NVJITLINK(c_nvjitlink_h, cynvjitlink.nvJitLinkAddData( + c_nvjitlink_h, c_nv_input_type, c_data_ptr, c_data_size, c_name_ptr)) + elif isinstance(data, str): + file_bytes = data.encode() + c_file_ptr = file_bytes + with nogil: + HANDLE_RETURN_NVJITLINK(c_nvjitlink_h, cynvjitlink.nvJitLinkAddFile( + c_nvjitlink_h, c_nv_input_type, c_file_ptr)) + else: + raise TypeError(f"Expected bytes or str, but got {type(data).__name__}") + else: + c_culink_state = as_cu(self._culink_handle) + c_drv_input_type = py_input_type + try: + if isinstance(data, bytes): + c_data_ptr = (data) + c_data_size = len(data) + with nogil: + HANDLE_RETURN(cydriver.cuLinkAddData( + c_culink_state, c_drv_input_type, c_data_ptr, c_data_size, c_name_ptr, + 0, NULL, NULL)) + elif isinstance(data, str): + file_bytes = data.encode() + c_file_ptr = file_bytes + with nogil: + HANDLE_RETURN(cydriver.cuLinkAddFile( + c_culink_state, c_drv_input_type, c_file_ptr, 0, NULL, NULL)) + else: + raise TypeError(f"Expected bytes or str, but got {type(data).__name__}") + except CUDAError as e: + Linker_annotate_error_log(self, e) + raise + + +cdef inline object Linker_link(Linker self, str target_type): + """Complete linking and return the result as ObjectCode.""" + if target_type not in ("cubin", "ptx"): + raise ValueError(f"Unsupported target type: {target_type}") + + cdef cynvjitlink.nvJitLinkHandle c_nvjitlink_h + cdef cydriver.CUlinkState c_culink_state + cdef size_t c_output_size = 0 + cdef char* c_code_ptr + cdef void* c_cubin_out = NULL + + if self._use_nvjitlink: + c_nvjitlink_h = as_cu(self._nvjitlink_handle) + with nogil: + HANDLE_RETURN_NVJITLINK(c_nvjitlink_h, cynvjitlink.nvJitLinkComplete(c_nvjitlink_h)) + if target_type == "cubin": + HANDLE_RETURN_NVJITLINK(c_nvjitlink_h, + cynvjitlink.nvJitLinkGetLinkedCubinSize(c_nvjitlink_h, &c_output_size)) + code = bytearray(c_output_size) + c_code_ptr = (code) + with nogil: + HANDLE_RETURN_NVJITLINK(c_nvjitlink_h, + cynvjitlink.nvJitLinkGetLinkedCubin(c_nvjitlink_h, c_code_ptr)) + else: + HANDLE_RETURN_NVJITLINK(c_nvjitlink_h, + cynvjitlink.nvJitLinkGetLinkedPtxSize(c_nvjitlink_h, &c_output_size)) + code = bytearray(c_output_size) + c_code_ptr = (code) + with nogil: + HANDLE_RETURN_NVJITLINK(c_nvjitlink_h, + cynvjitlink.nvJitLinkGetLinkedPtx(c_nvjitlink_h, c_code_ptr)) + else: + c_culink_state = as_cu(self._culink_handle) + try: + with nogil: + HANDLE_RETURN(cydriver.cuLinkComplete(c_culink_state, &c_cubin_out, &c_output_size)) + except CUDAError as e: + Linker_annotate_error_log(self, e) + raise + code = (c_cubin_out)[:c_output_size] + + # Linking is complete; cache the decoded logs. cuLinkDestroy may still + # dereference the raw log-buffer pointers, so retain them until close(). + self._info_log = self.get_info_log() + self._error_log = self.get_error_log() + + return ObjectCode._init(bytes(code), target_type, name=self._options.name) + + +cdef inline void Linker_annotate_error_log(Linker self, object e): + """Annotate a CUDAError with the driver linker error log.""" + error_log = self.get_error_log() + if error_log: + e.args = (e.args[0] + f"\nLinker error log: {error_log}", *e.args[1:]) + + +# ============================================================================= +# Private implementation: module-level state and initialization +# ============================================================================= + +# TODO: revisit this treatment for py313t builds +_driver = None # populated if nvJitLink cannot be used +_inited = False +_use_nvjitlink_backend = None # set by _decide_nvjitlink_or_driver() + +# Input type mappings populated by _lazy_init() with C-level enum ints. +_nvjitlink_input_types = None +_driver_input_types = None + + +def _nvjitlink_has_version_symbol(nvjitlink) -> bool: + # This condition is equivalent to testing for version >= 12.3 + return bool(nvjitlink._inspect_function_pointer("__nvJitLinkVersion")) + + +# Note: this function is reused in the tests +def _decide_nvjitlink_or_driver() -> bool: + """Return True if falling back to the cuLink* driver APIs.""" + global _driver, _use_nvjitlink_backend + if _use_nvjitlink_backend is not None: + return not _use_nvjitlink_backend + + warn_txt_common = ( + "the driver APIs will be used instead, which do not support" + " minor version compatibility or linking LTO IRs." + " For best results, consider upgrading to a recent version of" + ) + + nvjitlink_module = _optional_cuda_import( + "cuda.bindings.nvjitlink", + probe_function=lambda module: module.version(), # probe triggers nvJitLink runtime load + ) + if nvjitlink_module is None: + warn_txt = f"cuda.bindings.nvjitlink is not available, therefore {warn_txt_common} cuda-bindings." + else: + from cuda.bindings._internal import nvjitlink + + if _nvjitlink_has_version_symbol(nvjitlink): + nvjitlink_version = nvjitlink_module.version() + driver_major = driver_version()[0] + if driver_major <= nvjitlink_version[0]: + _use_nvjitlink_backend = True + return False # Use nvjitlink + + warn_txt = ( + f"CUDA driver major version {driver_major} is newer than " + f"nvJitLink major version {nvjitlink_version[0]}; therefore " + f"{warn_txt_common} nvJitLink." + ) + else: + warn_txt = ( + f"{'nvJitLink*.dll' if sys.platform == 'win32' else 'libnvJitLink.so*'} is too old (<12.3)." + f" Therefore cuda.bindings.nvjitlink is not usable and {warn_txt_common} nvJitLink." + ) + + warn(warn_txt, stacklevel=2, category=RuntimeWarning) + _use_nvjitlink_backend = False + _driver = driver + return True + + +def _lazy_init() -> None: + global _inited, _nvjitlink_input_types, _driver_input_types + if _inited: + return + + _decide_nvjitlink_or_driver() + if _use_nvjitlink_backend: + _nvjitlink_input_types = { + "ptx": cynvjitlink.NVJITLINK_INPUT_PTX, + "cubin": cynvjitlink.NVJITLINK_INPUT_CUBIN, + "fatbin": cynvjitlink.NVJITLINK_INPUT_FATBIN, + "ltoir": cynvjitlink.NVJITLINK_INPUT_LTOIR, + "object": cynvjitlink.NVJITLINK_INPUT_OBJECT, + "library": cynvjitlink.NVJITLINK_INPUT_LIBRARY, + } + else: + _driver_input_types = { + "ptx": cydriver.CU_JIT_INPUT_PTX, + "cubin": cydriver.CU_JIT_INPUT_CUBIN, + "fatbin": cydriver.CU_JIT_INPUT_FATBINARY, + "object": cydriver.CU_JIT_INPUT_OBJECT, + "library": cydriver.CU_JIT_INPUT_LIBRARY, + } + _inited = True diff --git a/cuda/tests/__init__.py b/cuda_core/cuda/core/_memory/__init__.pxd similarity index 100% rename from cuda/tests/__init__.py rename to cuda_core/cuda/core/_memory/__init__.pxd diff --git a/cuda_core/cuda/core/_memory/__init__.py b/cuda_core/cuda/core/_memory/__init__.py new file mode 100644 index 00000000000..bf40a643f8c --- /dev/null +++ b/cuda_core/cuda/core/_memory/__init__.py @@ -0,0 +1,13 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from ._buffer import * +from ._device_memory_resource import * +from ._graph_memory_resource import * +from ._ipc import * +from ._legacy import * +from ._managed_buffer import ManagedBuffer +from ._managed_memory_resource import * +from ._pinned_memory_resource import * +from ._virtual_memory_resource import * diff --git a/cuda_core/cuda/core/_memory/_buffer.pxd b/cuda_core/cuda/core/_memory/_buffer.pxd new file mode 100644 index 00000000000..b552e69554d --- /dev/null +++ b/cuda_core/cuda/core/_memory/_buffer.pxd @@ -0,0 +1,46 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from libcpp cimport bool as cpp_bool +from libcpp.atomic cimport atomic as std_atomic + +from cuda.core._resource_handles cimport DevicePtrHandle + + +cdef struct _MemAttrs: + int device_id + bint is_device_accessible + bint is_host_accessible + bint is_managed + + +cdef class Buffer: + cdef: + DevicePtrHandle _h_ptr + MemoryResource _memory_resource + object _ipc_data + object _owner + _MemAttrs _mem_attrs + std_atomic[cpp_bool] _mem_attrs_inited + object __weakref__ + cdef public: + # Python code in _memory/_virtual_memory_resource.py needs to update + # this value, though it is technically private. + size_t _size + + +cdef class MemoryResource: + pass + + +# Helper function to create a Buffer from a DevicePtrHandle. +# `cls` lets callers materialize Buffer subclasses (e.g. ManagedBuffer for +# managed-memory allocations); defaults to Buffer. +cdef Buffer Buffer_from_deviceptr_handle( + DevicePtrHandle h_ptr, + size_t size, + MemoryResource mr, + object ipc_descriptor = *, + type cls = *, +) diff --git a/cuda_core/cuda/core/_memory/_buffer.pyi b/cuda_core/cuda/core/_memory/_buffer.pyi new file mode 100644 index 00000000000..1d824cf6fc0 --- /dev/null +++ b/cuda_core/cuda/core/_memory/_buffer.pyi @@ -0,0 +1,306 @@ +# This file was generated by stubgen-pyx v0.2.6 from cuda_core/cuda/core/_memory/_buffer.pyx + +from __future__ import annotations + +import cython +from cuda.core._memory._device_memory_resource import DeviceMemoryResource +from cuda.core._memory._ipc import IPCBufferDescriptor +from cuda.core._memory._pinned_memory_resource import PinnedMemoryResource +from cuda.core._stream import Stream +from cuda.core._utils.pycompat import BufferProtocol +from cuda.core.graph import GraphBuilder +from cuda.core.typing import DevicePointerType + + +class Buffer: + """Represent a handle to allocated memory. + + This generic object provides a unified representation for how + different memory resources are to give access to their memory + allocations. + + Support for data interchange mechanisms are provided by DLPack. + + Note + ---- + Pickling an IPC-enabled :class:`Buffer` embeds an + :class:`~_memory.IPCBufferDescriptor`. Unpickling reconstructs the buffer + by calling :meth:`from_ipc_descriptor` and therefore performs an IPC + import. Do not unpickle buffers from untrusted sources. + """ + + def __cinit__(self) -> None: + ... + + def _clear(self) -> None: + ... + + def __init__(self, *args, **kwargs) -> None: + ... + + @classmethod + def _init(cls, ptr: DevicePointerType, size: int, mr: MemoryResource | None=None, ipc_descriptor: IPCBufferDescriptor | None=None, owner: object | None=None) -> Buffer: + """Create a Buffer from a raw pointer. + + When ``mr`` is provided, the buffer takes ownership: ``mr.deallocate()`` + is called when the buffer is closed or garbage collected. When ``owner`` + is provided, the owner is kept alive but no deallocation is performed. + """ + + @staticmethod + def _reduce_helper(mr, ipc_descriptor): + ... + + def __reduce__(self) -> tuple[object, ...]: + ... + + @staticmethod + def from_handle(ptr: DevicePointerType, size: int, mr: MemoryResource | None=None, owner: object | None=None) -> Buffer: + """Create a new :class:`Buffer` object from a pointer. + + Parameters + ---------- + ptr : :obj:`~_memory.DevicePointerType` + Allocated buffer handle object + size : int + Memory size of the buffer + mr : :obj:`~_memory.MemoryResource`, optional + Memory resource associated with the buffer. When provided, + :meth:`MemoryResource.deallocate` is called when the buffer is + closed or garbage collected. + owner : object, optional + An object holding external allocation that the ``ptr`` points to. + The reference is kept as long as the buffer is alive. + The ``owner`` and ``mr`` cannot be specified together. + + Note + ---- + When neither ``mr`` nor ``owner`` is specified, this creates a + non-owning reference. The pointer will NOT be freed when the + :class:`Buffer` is closed or garbage collected. + """ + + @classmethod + def from_ipc_descriptor(cls, mr: DeviceMemoryResource | PinnedMemoryResource, ipc_descriptor: IPCBufferDescriptor, *, stream: Stream) -> Buffer: + """Import a buffer that was exported from another process. + + Parameters + ---------- + mr : :obj:`~_memory.DeviceMemoryResource` | :obj:`~_memory.PinnedMemoryResource` + The IPC-enabled memory resource matching the exporting process. + ipc_descriptor : :obj:`~_memory.IPCBufferDescriptor` + The descriptor exported from another process. + stream : :obj:`~_stream.Stream` + Keyword-only. The stream used for asynchronous deallocation when + the buffer is closed or garbage collected. + + Note + ---- + The descriptor payload and ``size`` are supplied by the exporting peer + and must be treated as untrusted input unless the peer is known to be + cooperating. + """ + + @property + @cython.critical_section + def ipc_descriptor(self) -> IPCBufferDescriptor: + """Descriptor for sharing this buffer with other processes.""" + + def close(self, stream: Stream | GraphBuilder | None=None) -> None: + """Deallocate this buffer asynchronously on the given stream. + + This buffer is released back to their memory resource + asynchronously on the given stream. + + Parameters + ---------- + stream : :obj:`~_stream.Stream` | :obj:`~graph.GraphBuilder`, optional + The stream object to use for asynchronous deallocation. If None, + the deallocation stream stored in the handle is used. + """ + + def __enter__(self): + ... + + def __exit__(self, exc_type, exc_val, exc_tb): + ... + + def copy_to(self, dst: Buffer | None=None, *, stream: Stream | GraphBuilder) -> Buffer: + """Copy from this buffer to the dst buffer asynchronously on the given stream. + + Copies the data from this buffer to the provided dst buffer. + If the dst buffer is not provided, then a new buffer is first + allocated using the associated memory resource before the copy. + + Parameters + ---------- + dst : :obj:`~_memory.Buffer`, optional + Destination buffer to copy data to. If not provided, a new buffer + is allocated using this buffer's memory resource. + stream : :obj:`~_stream.Stream` | :obj:`~graph.GraphBuilder` + Keyword argument specifying the stream for the + asynchronous copy + + """ + + def copy_from(self, src: Buffer, *, stream: Stream | GraphBuilder) -> None: + """Copy from the src buffer to this buffer asynchronously on the given stream. + + Parameters + ---------- + src : :obj:`~_memory.Buffer` + Source buffer to copy data from + stream : :obj:`~_stream.Stream` | :obj:`~graph.GraphBuilder` + Keyword argument specifying the stream for the + asynchronous copy + + """ + + def fill(self, value: int | BufferProtocol, *, stream: Stream | GraphBuilder) -> None: + """Fill this buffer with a repeating byte pattern. + + Parameters + ---------- + value : int | :obj:`collections.abc.Buffer` + - int: Must be in range [0, 256). Converted to 1 byte. + - :obj:`collections.abc.Buffer`: Must be 1, 2, or 4 bytes. + stream : :obj:`~_stream.Stream` | :obj:`~graph.GraphBuilder` + Stream for the asynchronous fill operation. + + Raises + ------ + TypeError + If value is not an int and does not support the buffer protocol. + ValueError + If value byte length is not 1, 2, or 4. + If buffer size is not divisible by value byte length. + OverflowError + If int value is outside [0, 256). + + """ + + def __dlpack__(self, *, stream: int | None=None, max_version: tuple[int, int] | None=None, dl_device: tuple[int, int] | None=None, copy: bool | None=None) -> object: + ... + + def __dlpack_device__(self) -> tuple[int, int]: + ... + + def __buffer__(self, flags: int, /) -> memoryview: + ... + + def __release_buffer__(self, buffer: memoryview, /) -> None: + ... + + @property + def device_id(self) -> int: + """Return the device ordinal of this buffer.""" + + @property + def handle(self) -> int: + """Return the buffer handle object. + + .. caution:: + + This handle is a Python object. To get the memory address of the underlying C + handle, call ``int(Buffer.handle)``. + """ + + def __eq__(self, other: object) -> bool: + ... + + def __hash__(self) -> int: + ... + + def __repr__(self) -> str: + ... + + @property + def is_device_accessible(self) -> bool: + """Return True if this buffer can be accessed by the GPU, otherwise False.""" + + @property + def is_host_accessible(self) -> bool: + """Return True if this buffer can be accessed by the CPU, otherwise False.""" + + @property + def is_managed(self) -> bool: + """Return True if this buffer is CUDA managed (unified) memory, otherwise False.""" + + @property + def is_mapped(self) -> bool: + """Return True if this buffer is mapped into the process via IPC.""" + + @property + def memory_resource(self) -> MemoryResource: + """Return the memory resource associated with this buffer.""" + + @property + def size(self) -> int: + """Return the memory size of this buffer.""" + + @property + def owner(self) -> object: + """Return the object holding external allocation.""" + +class MemoryResource: + """Abstract base class for memory resources that manage allocation and + deallocation of buffers. + + Subclasses must implement methods for allocating and deallocation, as well + as properties associated with this memory resource from which all allocated + buffers will inherit. (Since all :class:`Buffer` instances allocated and + returned by the :meth:`allocate` method would hold a reference to self, the + buffer properties are retrieved simply by looking up the underlying memory + resource's respective property.) + """ + + def allocate(self, size: int, *, stream: Stream | GraphBuilder) -> Buffer: + """Allocate a buffer of the requested size. + + Parameters + ---------- + size : int + The size of the buffer to allocate, in bytes. + stream : :obj:`~_stream.Stream` | :obj:`~graph.GraphBuilder` + Keyword-only. The stream on which to perform the allocation + asynchronously. Must be passed explicitly; pass + ``device.default_stream`` to use the default stream. + + Returns + ------- + Buffer + The allocated buffer object, which can be used for device or host operations + depending on the resource's properties. + """ + + def deallocate(self, ptr: DevicePointerType, size: int, *, stream: Stream | GraphBuilder) -> None: + """Deallocate a buffer previously allocated by this resource. + + Parameters + ---------- + ptr : :obj:`~_memory.DevicePointerType` + The pointer or handle to the buffer to deallocate. + size : int + The size of the buffer to deallocate, in bytes. + stream : :obj:`~_stream.Stream` | :obj:`~graph.GraphBuilder` + Keyword-only. The stream on which to perform the deallocation + asynchronously. Must be passed explicitly; pass + ``device.default_stream`` to use the default stream. + """ + + @property + def is_device_accessible(self) -> bool: + """Whether buffers allocated by this resource are device-accessible.""" + + @property + def is_host_accessible(self) -> bool: + """Whether buffers allocated by this resource are host-accessible.""" + + @property + def is_managed(self) -> bool: + """Whether buffers allocated by this resource are CUDA managed (unified) memory.""" + + @property + def device_id(self) -> int: + """Device ID associated with this memory resource, or -1 if not applicable.""" +__all__ = ['Buffer', 'MemoryResource'] \ No newline at end of file diff --git a/cuda_core/cuda/core/_memory/_buffer.pyx b/cuda_core/cuda/core/_memory/_buffer.pyx new file mode 100644 index 00000000000..97ef892547d --- /dev/null +++ b/cuda_core/cuda/core/_memory/_buffer.pyx @@ -0,0 +1,634 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from __future__ import annotations + +cimport cython +from libc.stdint cimport uintptr_t +from libcpp.atomic cimport memory_order_acquire, memory_order_release + +from cuda.bindings cimport cydriver +from cuda.core._memory._device_memory_resource import DeviceMemoryResource +from cuda.core._memory._pinned_memory_resource import PinnedMemoryResource +from cuda.core._memory._ipc cimport IPCBufferDescriptor, IPCDataForBuffer +from cuda.core._memory cimport _ipc +from cuda.core._resource_handles cimport ( + DevicePtrHandle, + StreamHandle, + deviceptr_create_with_owner, + deviceptr_create_with_mr, + register_mr_dealloc_callback, + as_intptr, + as_cu, + set_deallocation_stream, +) +from cuda.core.typing import DevicePointerType + +from cuda.core._stream cimport Stream, Stream_accept, default_stream +from cuda.core._utils.cuda_utils cimport HANDLE_RETURN, _parse_fill_value + +import sys +from typing import TYPE_CHECKING + +from cuda.core._utils.pycompat import BufferProtocol +from cuda.core._dlpack import classify_dl_device, make_py_capsule +from cuda.core._device import Device + +if TYPE_CHECKING: + from cuda.core.graph import GraphBuilder + + +# ============================================================================= +# MR deallocation callback (invoked from C++ shared_ptr deleter) +# ============================================================================= + +cdef void _mr_dealloc_callback( + object mr, + cydriver.CUdeviceptr ptr, + size_t size, + const StreamHandle& h_stream, +) noexcept: + """Called by the C++ deleter to deallocate via MemoryResource.deallocate. + + This is the C++ teardown path: there is no Python caller frame from + which to obtain a stream. If the device-pointer handle was created + without ``set_deallocation_stream`` being called (e.g. buffers minted + via ``Buffer.from_handle(ptr, size, mr=mr)`` from DLPack import, + third-party adapters, or other foreign sources), ``h_stream`` is + empty here. Stream-ordered MR ``deallocate`` overrides reject + ``stream=None`` (issue #2001), so without a fallback the destructor + would print a warning and leak the allocation. Fall back to the + legacy/per-thread default stream so the free still happens; this is + the unique exception to the "no implicit default-stream fallback" + policy because the teardown has no other source of truth. + """ + cdef Stream stream + try: + stream = Stream._from_handle(Stream, h_stream) if h_stream else default_stream() + mr.deallocate(int(ptr), size, stream=stream) + except Exception as exc: + print(f"Warning: mr.deallocate() failed during Buffer destruction: {exc}", + file=sys.stderr) + +register_mr_dealloc_callback(_mr_dealloc_callback) + + +__all__ = ['Buffer', 'MemoryResource'] + + +# Memory Attribute Query Helpers +# ------------------------------ +cdef inline int _query_memory_attrs( + _MemAttrs& out, + cydriver.CUdeviceptr ptr +) except -1 nogil: + """Query memory attributes for a device pointer.""" + cdef unsigned int memory_type = 0 + cdef int is_managed = 0 + cdef int device_id = 0 + cdef cydriver.CUpointer_attribute[3] attrs = [ + cydriver.CUpointer_attribute.CU_POINTER_ATTRIBUTE_MEMORY_TYPE, + cydriver.CUpointer_attribute.CU_POINTER_ATTRIBUTE_IS_MANAGED, + cydriver.CUpointer_attribute.CU_POINTER_ATTRIBUTE_DEVICE_ORDINAL, + ] + cdef uintptr_t[3] vals = [ + &memory_type, + &is_managed, + &device_id, + ] + + cdef cydriver.CUresult ret + ret = cydriver.cuPointerGetAttributes(3, attrs, vals, ptr) + if ret == cydriver.CUresult.CUDA_ERROR_NOT_INITIALIZED: + with cython.gil: + # Device class handles the cuInit call internally + Device() + ret = cydriver.cuPointerGetAttributes(3, attrs, vals, ptr) + HANDLE_RETURN(ret) + + # TODO: HMM/ATS-enabled sysmem should also report is_managed=True; the + # CU_POINTER_ATTRIBUTE_IS_MANAGED query does not capture that yet. + out.is_managed = is_managed != 0 + + if memory_type == 0: + # unregistered host pointer + out.is_host_accessible = True + out.is_device_accessible = False + out.device_id = -1 + elif ( + is_managed + or memory_type == cydriver.CUmemorytype.CU_MEMORYTYPE_HOST + ): + # Managed memory or pinned host memory + out.is_host_accessible = True + out.is_device_accessible = True + out.device_id = device_id + elif memory_type == cydriver.CUmemorytype.CU_MEMORYTYPE_DEVICE: + out.is_host_accessible = False + out.is_device_accessible = True + out.device_id = device_id + else: + with cython.gil: + raise ValueError(f"Unsupported memory type: {memory_type}") + return 0 + + +cdef inline void _init_memory_attrs(Buffer self): + """Initialize memory attributes by querying the pointer.""" + if not self._mem_attrs_inited.load(memory_order_acquire): + _query_memory_attrs(self._mem_attrs, as_cu(self._h_ptr)) + self._mem_attrs_inited.store(True, memory_order_release) + + +cdef class Buffer: + """Represent a handle to allocated memory. + + This generic object provides a unified representation for how + different memory resources are to give access to their memory + allocations. + + Support for data interchange mechanisms are provided by DLPack. + + Note + ---- + Pickling an IPC-enabled :class:`Buffer` embeds an + :class:`~_memory.IPCBufferDescriptor`. Unpickling reconstructs the buffer + by calling :meth:`from_ipc_descriptor` and therefore performs an IPC + import. Do not unpickle buffers from untrusted sources. + """ + def __cinit__(self) -> None: + self._clear() + + def _clear(self) -> None: + self._h_ptr.reset() # Release the handle + self._size = 0 + self._memory_resource = None + self._ipc_data = None + self._owner = None + self._mem_attrs_inited.store(False) + + def __init__(self, *args, **kwargs) -> None: + raise RuntimeError("Buffer objects cannot be instantiated directly. " + "Please use MemoryResource APIs.") + + @classmethod + def _init( + cls, ptr: DevicePointerType, size_t size, mr: MemoryResource | None = None, + ipc_descriptor: IPCBufferDescriptor | None = None, + owner : object | None = None + ) -> Buffer: + """Create a Buffer from a raw pointer. + + When ``mr`` is provided, the buffer takes ownership: ``mr.deallocate()`` + is called when the buffer is closed or garbage collected. When ``owner`` + is provided, the owner is kept alive but no deallocation is performed. + """ + if mr is not None and owner is not None: + raise ValueError("owner and memory resource cannot be both specified together") + cdef Buffer self = Buffer.__new__(cls) + cdef uintptr_t c_ptr = (int(ptr)) + if mr is not None: + self._h_ptr = deviceptr_create_with_mr(c_ptr, size, mr) + else: + self._h_ptr = deviceptr_create_with_owner(c_ptr, owner) + self._size = size + self._memory_resource = mr + self._ipc_data = IPCDataForBuffer(ipc_descriptor, True) if ipc_descriptor is not None else None + self._owner = owner + self._mem_attrs_inited.store(False) + return self + + @staticmethod + def _reduce_helper(mr, ipc_descriptor): + # The parent process's stream is not portable across processes, so the + # pickle path cannot thread an explicit stream through. Seed the + # imported buffer's deallocation with the current context's default + # stream; the receiver can override via buffer.close(stream). + return Buffer.from_ipc_descriptor(mr, ipc_descriptor, stream=default_stream()) + + def __reduce__(self) -> tuple[object, ...]: + # Unpickling performs a live CUDA IPC import from descriptor bytes in the + # pickle stream. Only deserialize Buffers from a trusted principal. + # Must not serialize the parent's stream! + return Buffer._reduce_helper, (self.memory_resource, self.ipc_descriptor) + + @staticmethod + def from_handle( + ptr: DevicePointerType, size_t size, mr: MemoryResource | None = None, + owner: object | None = None, + ) -> Buffer: + """Create a new :class:`Buffer` object from a pointer. + + Parameters + ---------- + ptr : :obj:`~_memory.DevicePointerType` + Allocated buffer handle object + size : int + Memory size of the buffer + mr : :obj:`~_memory.MemoryResource`, optional + Memory resource associated with the buffer. When provided, + :meth:`MemoryResource.deallocate` is called when the buffer is + closed or garbage collected. + owner : object, optional + An object holding external allocation that the ``ptr`` points to. + The reference is kept as long as the buffer is alive. + The ``owner`` and ``mr`` cannot be specified together. + + Note + ---- + When neither ``mr`` nor ``owner`` is specified, this creates a + non-owning reference. The pointer will NOT be freed when the + :class:`Buffer` is closed or garbage collected. + """ + return Buffer._init(ptr, size, mr=mr, owner=owner) + + @classmethod + def from_ipc_descriptor( + cls, mr: DeviceMemoryResource | PinnedMemoryResource, ipc_descriptor: IPCBufferDescriptor, + *, stream: Stream + ) -> Buffer: + """Import a buffer that was exported from another process. + + Parameters + ---------- + mr : :obj:`~_memory.DeviceMemoryResource` | :obj:`~_memory.PinnedMemoryResource` + The IPC-enabled memory resource matching the exporting process. + ipc_descriptor : :obj:`~_memory.IPCBufferDescriptor` + The descriptor exported from another process. + stream : :obj:`~_stream.Stream` + Keyword-only. The stream used for asynchronous deallocation when + the buffer is closed or garbage collected. + + Note + ---- + The descriptor payload and ``size`` are supplied by the exporting peer + and must be treated as untrusted input unless the peer is known to be + cooperating. + """ + return _ipc.Buffer_from_ipc_descriptor(cls, mr, ipc_descriptor, stream) + + @property + @cython.critical_section + def ipc_descriptor(self) -> IPCBufferDescriptor: + """Descriptor for sharing this buffer with other processes.""" + if self._ipc_data is None: + self._ipc_data = IPCDataForBuffer(_ipc.Buffer_get_ipc_descriptor(self), False) + return self._ipc_data.ipc_descriptor + + def close(self, stream: Stream | GraphBuilder | None = None) -> None: + """Deallocate this buffer asynchronously on the given stream. + + This buffer is released back to their memory resource + asynchronously on the given stream. + + Parameters + ---------- + stream : :obj:`~_stream.Stream` | :obj:`~graph.GraphBuilder`, optional + The stream object to use for asynchronous deallocation. If None, + the deallocation stream stored in the handle is used. + """ + Buffer_close(self, stream) + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_val, exc_tb): + self.close() + return False + + def copy_to(self, dst: Buffer | None = None, *, stream: Stream | GraphBuilder) -> Buffer: + """Copy from this buffer to the dst buffer asynchronously on the given stream. + + Copies the data from this buffer to the provided dst buffer. + If the dst buffer is not provided, then a new buffer is first + allocated using the associated memory resource before the copy. + + Parameters + ---------- + dst : :obj:`~_memory.Buffer`, optional + Destination buffer to copy data to. If not provided, a new buffer + is allocated using this buffer's memory resource. + stream : :obj:`~_stream.Stream` | :obj:`~graph.GraphBuilder` + Keyword argument specifying the stream for the + asynchronous copy + + """ + cdef Stream s = Stream_accept(stream) + cdef size_t src_size = self._size + + if dst is None: + if self._memory_resource is None: + raise ValueError("a destination buffer must be provided (this " + "buffer does not have a memory_resource)") + dst = self._memory_resource.allocate(src_size, stream=s) + + cdef size_t dst_size = dst._size + if dst_size != src_size: + raise ValueError( "buffer sizes mismatch between src and dst (sizes " + f"are: src={src_size}, dst={dst_size})" + ) + with nogil: + HANDLE_RETURN(cydriver.cuMemcpyAsync( + as_cu(dst._h_ptr), as_cu(self._h_ptr), src_size, as_cu(s._h_stream))) + return dst + + def copy_from(self, src: Buffer, *, stream: Stream | GraphBuilder) -> None: + """Copy from the src buffer to this buffer asynchronously on the given stream. + + Parameters + ---------- + src : :obj:`~_memory.Buffer` + Source buffer to copy data from + stream : :obj:`~_stream.Stream` | :obj:`~graph.GraphBuilder` + Keyword argument specifying the stream for the + asynchronous copy + + """ + cdef Stream s = Stream_accept(stream) + cdef size_t dst_size = self._size + cdef size_t src_size = src._size + + if src_size != dst_size: + raise ValueError( "buffer sizes mismatch between src and dst (sizes " + f"are: src={src_size}, dst={dst_size})" + ) + with nogil: + HANDLE_RETURN(cydriver.cuMemcpyAsync( + as_cu(self._h_ptr), as_cu(src._h_ptr), dst_size, as_cu(s._h_stream))) + + def fill(self, value: int | BufferProtocol, *, stream: Stream | GraphBuilder) -> None: + """Fill this buffer with a repeating byte pattern. + + Parameters + ---------- + value : int | :obj:`collections.abc.Buffer` + - int: Must be in range [0, 256). Converted to 1 byte. + - :obj:`collections.abc.Buffer`: Must be 1, 2, or 4 bytes. + stream : :obj:`~_stream.Stream` | :obj:`~graph.GraphBuilder` + Stream for the asynchronous fill operation. + + Raises + ------ + TypeError + If value is not an int and does not support the buffer protocol. + ValueError + If value byte length is not 1, 2, or 4. + If buffer size is not divisible by value byte length. + OverflowError + If int value is outside [0, 256). + + """ + cdef Stream s_stream = Stream_accept(stream) + cdef unsigned int val + cdef unsigned int elem_size + val, elem_size = _parse_fill_value(value) + + cdef size_t buffer_size = self._size + cdef cydriver.CUdeviceptr dst = as_cu(self._h_ptr) + cdef cydriver.CUstream s = as_cu(s_stream._h_stream) + + if elem_size == 1: + with nogil: + HANDLE_RETURN(cydriver.cuMemsetD8Async(dst, val, buffer_size, s)) + elif elem_size == 2: + if buffer_size & 0x1: + raise ValueError(f"buffer size ({buffer_size}) must be divisible by 2") + with nogil: + HANDLE_RETURN(cydriver.cuMemsetD16Async(dst, val, buffer_size // 2, s)) + elif elem_size == 4: + if buffer_size & 0x3: + raise ValueError(f"buffer size ({buffer_size}) must be divisible by 4") + with nogil: + HANDLE_RETURN(cydriver.cuMemsetD32Async(dst, val, buffer_size // 4, s)) + + def __dlpack__( + self, + *, + stream: int | None = None, + max_version: tuple[int, int] | None = None, + dl_device: tuple[int, int] | None = None, + copy: bool | None = None, + ) -> object: + # Note: we ignore the stream argument entirely (as if it is -1). + # It is the user's responsibility to maintain stream order. + if dl_device is not None: + raise BufferError("Sorry, not supported: dl_device other than None") + if copy is True: + raise BufferError("Sorry, not supported: copy=True") + if max_version is None: + versioned = False + else: + if not isinstance(max_version, tuple) or len(max_version) != 2: + raise BufferError(f"Expected max_version tuple[int, int], got {max_version}") + versioned = max_version >= (1, 0) + capsule = make_py_capsule(self, versioned) + return capsule + + def __dlpack_device__(self) -> tuple[int, int]: + return classify_dl_device(self) + + def __buffer__(self, flags: int, /) -> memoryview: + # Support for Python-level buffer protocol as per PEP 688. + # This raises a BufferError unless: + # 1. Python is 3.12+ + # 2. This Buffer object is host accessible + raise NotImplementedError("WIP: Buffer.__buffer__ hasn't been implemented yet.") + + def __release_buffer__(self, buffer: memoryview, /) -> None: + # Supporting method paired with __buffer__. + raise NotImplementedError("WIP: Buffer.__release_buffer__ hasn't been implemented yet.") + + @property + def device_id(self) -> int: + """Return the device ordinal of this buffer.""" + if self._memory_resource is not None: + return self._memory_resource.device_id + _init_memory_attrs(self) + return self._mem_attrs.device_id + + @property + def handle(self) -> int: + """Return the buffer handle object. + + .. caution:: + + This handle is a Python object. To get the memory address of the underlying C + handle, call ``int(Buffer.handle)``. + """ + # Return raw integer for compatibility with ctypes and other tools + # that expect a raw pointer value + return as_intptr(self._h_ptr) + + def __eq__(self, other: object) -> bool: + if not isinstance(other, Buffer): + return NotImplemented + cdef Buffer other_buf = other + return (as_intptr(self._h_ptr) == as_intptr(other_buf._h_ptr) and + self._size == other_buf._size) + + def __hash__(self) -> int: + return hash((as_intptr(self._h_ptr), self._size)) + + def __repr__(self) -> str: + maybe_is_mapped = " is_mapped=True" if self.is_mapped else "" + return f"" + + @property + def is_device_accessible(self) -> bool: + """Return True if this buffer can be accessed by the GPU, otherwise False.""" + if self._memory_resource is not None: + return self._memory_resource.is_device_accessible + _init_memory_attrs(self) + return self._mem_attrs.is_device_accessible + + @property + def is_host_accessible(self) -> bool: + """Return True if this buffer can be accessed by the CPU, otherwise False.""" + if self._memory_resource is not None: + return self._memory_resource.is_host_accessible + _init_memory_attrs(self) + return self._mem_attrs.is_host_accessible + + @property + def is_managed(self) -> bool: + """Return True if this buffer is CUDA managed (unified) memory, otherwise False.""" + _init_memory_attrs(self) + if self._mem_attrs.is_managed: + return True + # Pool-allocated managed memory does not set CU_POINTER_ATTRIBUTE_IS_MANAGED, + # so fall back to the memory resource when it advertises managed allocations. + return self._memory_resource is not None and self._memory_resource.is_managed + + @property + def is_mapped(self) -> bool: + """Return True if this buffer is mapped into the process via IPC.""" + return getattr(self._ipc_data, "is_mapped", False) + + + @property + def memory_resource(self) -> MemoryResource: + """Return the memory resource associated with this buffer.""" + return self._memory_resource + + @property + def size(self) -> int: + """Return the memory size of this buffer.""" + return self._size + + @property + def owner(self) -> object: + """Return the object holding external allocation.""" + return self._owner + + +cdef class MemoryResource: + """Abstract base class for memory resources that manage allocation and + deallocation of buffers. + + Subclasses must implement methods for allocating and deallocation, as well + as properties associated with this memory resource from which all allocated + buffers will inherit. (Since all :class:`Buffer` instances allocated and + returned by the :meth:`allocate` method would hold a reference to self, the + buffer properties are retrieved simply by looking up the underlying memory + resource's respective property.) + """ + + def allocate(self, size_t size, *, stream: Stream | GraphBuilder) -> Buffer: + """Allocate a buffer of the requested size. + + Parameters + ---------- + size : int + The size of the buffer to allocate, in bytes. + stream : :obj:`~_stream.Stream` | :obj:`~graph.GraphBuilder` + Keyword-only. The stream on which to perform the allocation + asynchronously. Must be passed explicitly; pass + ``device.default_stream`` to use the default stream. + + Returns + ------- + Buffer + The allocated buffer object, which can be used for device or host operations + depending on the resource's properties. + """ + raise TypeError("MemoryResource.allocate must be implemented by subclasses.") + + def deallocate( + self, + ptr: DevicePointerType, + size_t size, + *, + stream: Stream | GraphBuilder + ) -> None: + """Deallocate a buffer previously allocated by this resource. + + Parameters + ---------- + ptr : :obj:`~_memory.DevicePointerType` + The pointer or handle to the buffer to deallocate. + size : int + The size of the buffer to deallocate, in bytes. + stream : :obj:`~_stream.Stream` | :obj:`~graph.GraphBuilder` + Keyword-only. The stream on which to perform the deallocation + asynchronously. Must be passed explicitly; pass + ``device.default_stream`` to use the default stream. + """ + raise TypeError("MemoryResource.deallocate must be implemented by subclasses.") + + @property + def is_device_accessible(self) -> bool: + """Whether buffers allocated by this resource are device-accessible.""" + raise TypeError("MemoryResource.is_device_accessible must be implemented by subclasses.") + + @property + def is_host_accessible(self) -> bool: + """Whether buffers allocated by this resource are host-accessible.""" + raise TypeError("MemoryResource.is_host_accessible must be implemented by subclasses.") + + @property + def is_managed(self) -> bool: + """Whether buffers allocated by this resource are CUDA managed (unified) memory.""" + return False + + @property + def device_id(self) -> int: + """Device ID associated with this memory resource, or -1 if not applicable.""" + raise TypeError("MemoryResource.device_id must be implemented by subclasses.") + + +# Buffer Implementation Helpers +# ----------------------------- +cdef Buffer Buffer_from_deviceptr_handle( + DevicePtrHandle h_ptr, + size_t size, + MemoryResource mr, + object ipc_descriptor = None, + type cls = Buffer, +): + """Create a Buffer (or subclass instance) from an existing DevicePtrHandle.""" + cdef Buffer buf = cls.__new__(cls) + buf._h_ptr = h_ptr + buf._size = size + buf._memory_resource = mr + buf._ipc_data = IPCDataForBuffer(ipc_descriptor, True) if ipc_descriptor is not None else None + buf._owner = None + buf._mem_attrs_inited.store(False) + return buf + + +cdef inline void Buffer_close(Buffer self, object stream): + """Close a buffer, freeing its memory.""" + cdef Stream s + if not self._h_ptr: + return + # Update deallocation stream if provided + if stream is not None: + s = Stream_accept(stream) + set_deallocation_stream(self._h_ptr, s._h_stream) + # Reset handle - RAII deleter will free the memory (and release owner ref in C++) + self._h_ptr.reset() + self._size = 0 + self._memory_resource = None + self._ipc_data = None + self._owner = None diff --git a/cuda_core/cuda/core/_memory/_device_memory_resource.pxd b/cuda_core/cuda/core/_memory/_device_memory_resource.pxd new file mode 100644 index 00000000000..1c3134876eb --- /dev/null +++ b/cuda_core/cuda/core/_memory/_device_memory_resource.pxd @@ -0,0 +1,13 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from cuda.core._memory._memory_pool cimport _MemPool + + +cdef class DeviceMemoryResource(_MemPool): + cdef: + int _dev_id + + +cpdef str DMR_mempool_get_access(DeviceMemoryResource, int) diff --git a/cuda_core/cuda/core/_memory/_device_memory_resource.pyi b/cuda_core/cuda/core/_memory/_device_memory_resource.pyi new file mode 100644 index 00000000000..21862b32b7a --- /dev/null +++ b/cuda_core/cuda/core/_memory/_device_memory_resource.pyi @@ -0,0 +1,235 @@ +# This file was generated by stubgen-pyx v0.2.6 from cuda_core/cuda/core/_memory/_device_memory_resource.pyx + +from __future__ import annotations + +import uuid +from dataclasses import dataclass + +from cuda.core._device import Device +from cuda.core._memory._ipc import IPCAllocationHandle +from cuda.core._memory._memory_pool import _MemPool +from cuda.core._memory._peer_access_utils import PeerAccessibleBySetProxy + + +@dataclass +class DeviceMemoryResourceOptions: + """Customizable :obj:`~_memory.DeviceMemoryResource` options. + + Attributes + ---------- + ipc_enabled : bool, optional + Specifies whether to create an IPC-enabled memory pool. When set to + True, the memory pool and its allocations can be shared with other + processes. (Default to False) + + max_size : int, optional + Maximum pool size. When set to 0, defaults to a system-dependent value. + (Default to 0) + """ + ipc_enabled: bool = False + max_size: int = 0 + +class DeviceMemoryResource(_MemPool): + """ + A device memory resource managing a stream-ordered memory pool. + + Parameters + ---------- + device_id : Device | int + Device or Device ordinal for which a memory resource is constructed. + + options : DeviceMemoryResourceOptions + Memory resource creation options. + + If set to `None`, the memory resource uses the driver's current + stream-ordered memory pool for the specified `device_id`. If no memory + pool is set as current, the driver's default memory pool for the device + is used. + + If not set to `None`, a new memory pool is created, which is owned by + the memory resource. + + When using an existing (current or default) memory pool, the returned + device memory resource does not own the pool (`is_handle_owned` is + `False`), and closing the resource has no effect. + + Notes + ----- + To create an IPC-Enabled memory resource (MR) that is capable of sharing + allocations between processes, specify ``ipc_enabled=True`` in the initializer + option. Sharing an allocation is a two-step procedure that involves + mapping a memory resource and then mapping buffers owned by that resource. + These steps can be accomplished in several ways. + + An IPC-enabled memory resource can allocate memory buffers but cannot + receive shared buffers. Mapping an MR to another process creates a "mapped + memory resource" (MMR). An MMR cannot allocate memory buffers and can only + receive shared buffers. MRs and MMRs are both of type + :class:`DeviceMemoryResource` and can be distinguished via + :attr:`DeviceMemoryResource.is_mapped`. + + An MR is shared via an allocation handle accessed through the + :attr:`DeviceMemoryResource.allocation_handle` property. The allocation + handle has a platform-specific interpretation; however, memory IPC is + currently only supported for Linux, and in that case allocation handles + are file descriptors. After sending an allocation handle to another + process, it can be used to create an MMR by invoking + :meth:`DeviceMemoryResource.from_allocation_handle`. + + Buffers can be shared as serializable descriptors accessed through the + :attr:`Buffer.ipc_descriptor` property. In a receiving process, a shared + buffer is created by invoking :meth:`Buffer.from_ipc_descriptor` with an + MMR and buffer descriptor, where the MMR corresponds to the MR that + created the described buffer. + + To help manage the association between memory resources and buffers, a + registry is provided. Every MR has a unique identifier (UUID). MMRs can be + registered by calling :meth:`DeviceMemoryResource.register` with the UUID + of the corresponding MR. Registered MMRs can be looked up via + :meth:`DeviceMemoryResource.from_registry`. When registering MMRs in this + way, the use of buffer descriptors can be avoided. Instead, buffer objects + can themselves be serialized and transferred directly. Serialization embeds + the UUID, which is used to locate the correct MMR during reconstruction. + + IPC-enabled memory resources interoperate with the :mod:`multiprocessing` + module to provide a simplified interface. This approach can avoid direct + use of allocation handles, buffer descriptors, MMRs, and the registry. When + using :mod:`multiprocessing` to spawn processes or send objects through + communication channels such as :class:`multiprocessing.Queue`, + :class:`multiprocessing.Pipe`, or :class:`multiprocessing.Connection`, + :class:`Buffer` objects may be sent directly, and in such cases the process + for creating MMRs and mapping buffers will be handled automatically. + + For greater efficiency when transferring many buffers, one may also send + MRs and buffers separately. When an MR is sent via :mod:`multiprocessing`, + an MMR is created and registered in the receiving process. Subsequently, + buffers may be serialized and transferred using ordinary :mod:`pickle` + methods. The reconstruction procedure uses the registry to find the + associated MMR. Unpickling a :class:`Buffer` performs an IPC import from + the embedded descriptor; only unpickle buffers received from trusted peers. + + Warning + ------- + IPC descriptors and pickled buffers cross a trust boundary between + cooperating same-host processes. A malicious peer can supply crafted + descriptor fields. Use :meth:`Buffer.from_ipc_descriptor` only with + descriptors from trusted peers, and do not unpickle buffers from + untrusted sources. + """ + + def __cinit__(self, *args, **kwargs) -> None: + ... + + def __init__(self, device_id: Device | int, options: DeviceMemoryResourceOptions | dict[str, object] | None=None) -> None: + ... + + def __reduce__(self) -> tuple[object, ...]: + ... + + @staticmethod + def from_registry(uuid: uuid.UUID) -> DeviceMemoryResource: + """ + Obtain a registered mapped memory resource. + + Raises + ------ + RuntimeError + If no mapped memory resource is found in the registry. + """ + + def register(self, uuid: uuid.UUID) -> DeviceMemoryResource: + """ + Register a mapped memory resource. + + Returns + ------- + The registered mapped memory resource. If one was previously registered + with the given key, it is returned. + """ + + @classmethod + def from_allocation_handle(cls, device_id: Device | int, alloc_handle: int | IPCAllocationHandle) -> DeviceMemoryResource: + """Create a device memory resource from an allocation handle. + + Construct a new `DeviceMemoryResource` instance that imports a memory + pool from a shareable handle. The memory pool is marked as owned, and + the resource is associated with the specified `device_id`. + + Parameters + ---------- + device_id : int | Device + The ID of the device or a Device object for which the memory + resource is created. + + alloc_handle : int | IPCAllocationHandle + The shareable handle of the device memory resource to import. If an + integer is supplied, it must represent a valid platform-specific + handle. It is the caller's responsibility to close that handle. + + Returns + ------- + A new device memory resource instance with the imported handle. + """ + + @property + def allocation_handle(self) -> IPCAllocationHandle: + """Shareable handle for this memory pool (requires IPC). + + The handle can be used to share the memory pool with other processes. + The handle is cached in this `MemoryResource` and owned by it. + """ + + @property + def device_id(self) -> int: + """The associated device ordinal.""" + + @property + def peer_accessible_by(self) -> PeerAccessibleBySetProxy: + """ + Get or set the devices that can access allocations from this memory + pool. Access can be modified at any time and affects all allocations + from this memory pool. + + Returns a set-like proxy of :obj:`~_device.Device` objects that manages + peer access. Inputs are accepted as either :obj:`~_device.Device` + objects or device-ordinal :class:`int` values. + + Examples + -------- + >>> dmr = DeviceMemoryResource(0) + >>> dmr.peer_accessible_by = {1} # grant access to device 1 + >>> assert 1 in dmr.peer_accessible_by + >>> dmr.peer_accessible_by.add(2) # update access to include device 2 + >>> dmr.peer_accessible_by = [] # revoke peer access + """ + + @peer_accessible_by.setter + def peer_accessible_by(self, devices) -> None: + ... + + @property + def is_device_accessible(self) -> bool: + """Return True. This memory resource provides device-accessible buffers.""" + + @property + def is_host_accessible(self) -> bool: + """Return False. This memory resource does not provide host-accessible buffers.""" +__all__ = ['DeviceMemoryResource', 'DeviceMemoryResourceOptions'] + +def DMR_mempool_get_access(dmr: DeviceMemoryResource, device_id: int) -> str: + """ + Probes peer access from the given device using cuMemPoolGetAccess. + + Parameters + ---------- + device_id : int or Device + The device to query access for. + + Returns + ------- + str + Access permissions: "rw" for read-write, "r" for read-only, "" for no access. + """ + +def _deep_reduce_device_memory_resource(mr) -> tuple[object, ...]: + ... \ No newline at end of file diff --git a/cuda_core/cuda/core/_memory/_device_memory_resource.pyx b/cuda_core/cuda/core/_memory/_device_memory_resource.pyx new file mode 100644 index 00000000000..45d8d543ac4 --- /dev/null +++ b/cuda_core/cuda/core/_memory/_device_memory_resource.pyx @@ -0,0 +1,348 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from __future__ import annotations + +from cuda.bindings cimport cydriver +from cuda.core._memory._memory_pool cimport ( + _MemPool, MP_init_create_pool, MP_raise_release_threshold, +) +from cuda.core._memory cimport _ipc +from cuda.core._memory._ipc cimport IPCAllocationHandle +from cuda.core._resource_handles cimport ( + as_cu, + get_device_mempool, + get_last_error, +) +from cuda.core._utils.cuda_utils cimport ( + check_or_create_options, + HANDLE_RETURN, +) +from dataclasses import dataclass +import multiprocessing +import platform # no-cython-lint +import uuid + +from cuda.core._memory._peer_access_utils import PeerAccessibleBySetProxy, replace_peer_accessible_by +from cuda.core._utils.cuda_utils import check_multiprocessing_start_method + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from cuda.core._device import Device + +__all__ = ['DeviceMemoryResource', 'DeviceMemoryResourceOptions'] + + +@dataclass +cdef class DeviceMemoryResourceOptions: + """Customizable :obj:`~_memory.DeviceMemoryResource` options. + + Attributes + ---------- + ipc_enabled : bool, optional + Specifies whether to create an IPC-enabled memory pool. When set to + True, the memory pool and its allocations can be shared with other + processes. (Default to False) + + max_size : int, optional + Maximum pool size. When set to 0, defaults to a system-dependent value. + (Default to 0) + """ + ipc_enabled : bool = False + max_size : int = 0 + + +cdef class DeviceMemoryResource(_MemPool): + """ + A device memory resource managing a stream-ordered memory pool. + + Parameters + ---------- + device_id : Device | int + Device or Device ordinal for which a memory resource is constructed. + + options : DeviceMemoryResourceOptions + Memory resource creation options. + + If set to `None`, the memory resource uses the driver's current + stream-ordered memory pool for the specified `device_id`. If no memory + pool is set as current, the driver's default memory pool for the device + is used. + + If not set to `None`, a new memory pool is created, which is owned by + the memory resource. + + When using an existing (current or default) memory pool, the returned + device memory resource does not own the pool (`is_handle_owned` is + `False`), and closing the resource has no effect. + + Notes + ----- + To create an IPC-Enabled memory resource (MR) that is capable of sharing + allocations between processes, specify ``ipc_enabled=True`` in the initializer + option. Sharing an allocation is a two-step procedure that involves + mapping a memory resource and then mapping buffers owned by that resource. + These steps can be accomplished in several ways. + + An IPC-enabled memory resource can allocate memory buffers but cannot + receive shared buffers. Mapping an MR to another process creates a "mapped + memory resource" (MMR). An MMR cannot allocate memory buffers and can only + receive shared buffers. MRs and MMRs are both of type + :class:`DeviceMemoryResource` and can be distinguished via + :attr:`DeviceMemoryResource.is_mapped`. + + An MR is shared via an allocation handle accessed through the + :attr:`DeviceMemoryResource.allocation_handle` property. The allocation + handle has a platform-specific interpretation; however, memory IPC is + currently only supported for Linux, and in that case allocation handles + are file descriptors. After sending an allocation handle to another + process, it can be used to create an MMR by invoking + :meth:`DeviceMemoryResource.from_allocation_handle`. + + Buffers can be shared as serializable descriptors accessed through the + :attr:`Buffer.ipc_descriptor` property. In a receiving process, a shared + buffer is created by invoking :meth:`Buffer.from_ipc_descriptor` with an + MMR and buffer descriptor, where the MMR corresponds to the MR that + created the described buffer. + + To help manage the association between memory resources and buffers, a + registry is provided. Every MR has a unique identifier (UUID). MMRs can be + registered by calling :meth:`DeviceMemoryResource.register` with the UUID + of the corresponding MR. Registered MMRs can be looked up via + :meth:`DeviceMemoryResource.from_registry`. When registering MMRs in this + way, the use of buffer descriptors can be avoided. Instead, buffer objects + can themselves be serialized and transferred directly. Serialization embeds + the UUID, which is used to locate the correct MMR during reconstruction. + + IPC-enabled memory resources interoperate with the :mod:`multiprocessing` + module to provide a simplified interface. This approach can avoid direct + use of allocation handles, buffer descriptors, MMRs, and the registry. When + using :mod:`multiprocessing` to spawn processes or send objects through + communication channels such as :class:`multiprocessing.Queue`, + :class:`multiprocessing.Pipe`, or :class:`multiprocessing.Connection`, + :class:`Buffer` objects may be sent directly, and in such cases the process + for creating MMRs and mapping buffers will be handled automatically. + + For greater efficiency when transferring many buffers, one may also send + MRs and buffers separately. When an MR is sent via :mod:`multiprocessing`, + an MMR is created and registered in the receiving process. Subsequently, + buffers may be serialized and transferred using ordinary :mod:`pickle` + methods. The reconstruction procedure uses the registry to find the + associated MMR. Unpickling a :class:`Buffer` performs an IPC import from + the embedded descriptor; only unpickle buffers received from trusted peers. + + Warning + ------- + IPC descriptors and pickled buffers cross a trust boundary between + cooperating same-host processes. A malicious peer can supply crafted + descriptor fields. Use :meth:`Buffer.from_ipc_descriptor` only with + descriptors from trusted peers, and do not unpickle buffers from + untrusted sources. + """ + + def __cinit__(self, *args, **kwargs) -> None: + self._dev_id = cydriver.CU_DEVICE_INVALID + + def __init__( + self, + device_id: Device | int, + options: DeviceMemoryResourceOptions | dict[str, object] | None = None + ) -> None: + _DMR_init(self, device_id, options) + + def __reduce__(self) -> tuple[object, ...]: + return DeviceMemoryResource.from_registry, (self.uuid,) + + @staticmethod + def from_registry(uuid: uuid.UUID) -> DeviceMemoryResource: # no-cython-lint + """ + Obtain a registered mapped memory resource. + + Raises + ------ + RuntimeError + If no mapped memory resource is found in the registry. + """ + return (_ipc.MP_from_registry(uuid)) + + def register(self, uuid: uuid.UUID) -> DeviceMemoryResource: # no-cython-lint + """ + Register a mapped memory resource. + + Returns + ------- + The registered mapped memory resource. If one was previously registered + with the given key, it is returned. + """ + return (_ipc.MP_register(self, uuid)) + + @classmethod + def from_allocation_handle( + cls, device_id: Device | int, alloc_handle: int | IPCAllocationHandle + ) -> DeviceMemoryResource: + """Create a device memory resource from an allocation handle. + + Construct a new `DeviceMemoryResource` instance that imports a memory + pool from a shareable handle. The memory pool is marked as owned, and + the resource is associated with the specified `device_id`. + + Parameters + ---------- + device_id : int | Device + The ID of the device or a Device object for which the memory + resource is created. + + alloc_handle : int | IPCAllocationHandle + The shareable handle of the device memory resource to import. If an + integer is supplied, it must represent a valid platform-specific + handle. It is the caller's responsibility to close that handle. + + Returns + ------- + A new device memory resource instance with the imported handle. + """ + cdef DeviceMemoryResource mr = ( + _ipc.MP_from_allocation_handle(cls, alloc_handle)) + from .._device import Device + mr._dev_id = Device(device_id).device_id + return mr + + @property + def allocation_handle(self) -> IPCAllocationHandle: + """Shareable handle for this memory pool (requires IPC). + + The handle can be used to share the memory pool with other processes. + The handle is cached in this `MemoryResource` and owned by it. + """ + if not self.is_ipc_enabled: + raise RuntimeError("Memory resource is not IPC-enabled") + return self._ipc_data._alloc_handle + + @property + def device_id(self) -> int: + """The associated device ordinal.""" + return self._dev_id + + @property + def peer_accessible_by(self) -> PeerAccessibleBySetProxy: + """ + Get or set the devices that can access allocations from this memory + pool. Access can be modified at any time and affects all allocations + from this memory pool. + + Returns a set-like proxy of :obj:`~_device.Device` objects that manages + peer access. Inputs are accepted as either :obj:`~_device.Device` + objects or device-ordinal :class:`int` values. + + Examples + -------- + >>> dmr = DeviceMemoryResource(0) + >>> dmr.peer_accessible_by = {1} # grant access to device 1 + >>> assert 1 in dmr.peer_accessible_by + >>> dmr.peer_accessible_by.add(2) # update access to include device 2 + >>> dmr.peer_accessible_by = [] # revoke peer access + """ + return PeerAccessibleBySetProxy(self) + + @peer_accessible_by.setter + def peer_accessible_by(self, devices) -> None: + replace_peer_accessible_by(self, devices) + + @property + def is_device_accessible(self) -> bool: + """Return True. This memory resource provides device-accessible buffers.""" + return True + + @property + def is_host_accessible(self) -> bool: + """Return False. This memory resource does not provide host-accessible buffers.""" + return False + + +cdef inline _DMR_init(DeviceMemoryResource self, device_id, options): + from .._device import Device + cdef int dev_id = Device(device_id).device_id + cdef DeviceMemoryResourceOptions opts = check_or_create_options( + DeviceMemoryResourceOptions, options, "DeviceMemoryResource options", + keep_none=True + ) + cdef bint ipc_enabled = False + cdef size_t max_size = 0 + + self._dev_id = dev_id + + if opts is not None: + ipc_enabled = opts.ipc_enabled + if ipc_enabled and not _ipc.is_supported(): + raise RuntimeError(f"IPC is not available on {platform.system()}") + max_size = opts.max_size + + if opts is None: + self._h_pool = get_device_mempool(dev_id) + if not self._h_pool: + HANDLE_RETURN(get_last_error()) + raise RuntimeError( + f"Failed to initialize DeviceMemoryResource for device {dev_id}: " + "cuda-core returned an empty memory pool handle without recording a CUDA error. " + "This is an internal cuda-core error; please report it with your CUDA driver, " + "CUDA Toolkit, and cuda-python versions." + ) + self._mempool_owned = False + MP_raise_release_threshold(self) + else: + MP_init_create_pool( + self, + cydriver.CUmemLocationType.CU_MEM_LOCATION_TYPE_DEVICE, + dev_id, + cydriver.CUmemAllocationType.CU_MEM_ALLOCATION_TYPE_PINNED, + ipc_enabled, + max_size, + ) + + +# Note: this is referenced in instructions to debug nvbug 5698116. +cpdef str DMR_mempool_get_access(DeviceMemoryResource dmr, int device_id): + """ + Probes peer access from the given device using cuMemPoolGetAccess. + + Parameters + ---------- + device_id : int or Device + The device to query access for. + + Returns + ------- + str + Access permissions: "rw" for read-write, "r" for read-only, "" for no access. + """ + from .._device import Device + + cdef int dev_id = Device(device_id).device_id + cdef cydriver.CUmemAccess_flags flags + cdef cydriver.CUmemLocation location + + location.type = cydriver.CUmemLocationType.CU_MEM_LOCATION_TYPE_DEVICE + location.id = dev_id + + with nogil: + HANDLE_RETURN(cydriver.cuMemPoolGetAccess(&flags, as_cu(dmr._h_pool), &location)) + + if flags == cydriver.CUmemAccess_flags.CU_MEM_ACCESS_FLAGS_PROT_READWRITE: + return "rw" + elif flags == cydriver.CUmemAccess_flags.CU_MEM_ACCESS_FLAGS_PROT_READ: + return "r" + else: + return "" + + +def _deep_reduce_device_memory_resource(mr) -> tuple[object, ...]: + check_multiprocessing_start_method() + from .._device import Device + device = Device(mr.device_id) + alloc_handle = mr.allocation_handle + return mr.from_allocation_handle, (device, alloc_handle) + + +multiprocessing.reduction.register(DeviceMemoryResource, _deep_reduce_device_memory_resource) diff --git a/cuda_core/cuda/core/_memory/_graph_memory_resource.pxd b/cuda_core/cuda/core/_memory/_graph_memory_resource.pxd new file mode 100644 index 00000000000..492aa23cd3d --- /dev/null +++ b/cuda_core/cuda/core/_memory/_graph_memory_resource.pxd @@ -0,0 +1,10 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from cuda.core._memory._buffer cimport MemoryResource + + +cdef class cyGraphMemoryResource(MemoryResource): + cdef: + int _device_id diff --git a/cuda_core/cuda/core/_memory/_graph_memory_resource.pyi b/cuda_core/cuda/core/_memory/_graph_memory_resource.pyi new file mode 100644 index 00000000000..b34f968fdc9 --- /dev/null +++ b/cuda_core/cuda/core/_memory/_graph_memory_resource.pyi @@ -0,0 +1,116 @@ +# This file was generated by stubgen-pyx v0.2.6 from cuda_core/cuda/core/_memory/_graph_memory_resource.pyx + +from __future__ import annotations + +from cuda.core._device import Device +from cuda.core._memory._buffer import Buffer, MemoryResource +from cuda.core._stream import Stream +from cuda.core.graph import GraphBuilder +from cuda.core.typing import DevicePointerType + + +class GraphMemoryResourceAttributes: + + def __init__(self, *args, **kwargs) -> None: + ... + + @classmethod + def _init(cls, device_id: int) -> GraphMemoryResourceAttributes: + ... + + def __repr__(self) -> str: + ... + + @property + def reserved_mem_current(self) -> int: + """Current amount of backing memory allocated.""" + + @property + def reserved_mem_high(self) -> int: + """ + High watermark of backing memory allocated. It can be set to zero to + reset it to the current usage. + """ + + @reserved_mem_high.setter + def reserved_mem_high(self, value: int) -> None: + ... + + @property + def used_mem_current(self) -> int: + """Current amount of memory in use.""" + + @property + def used_mem_high(self) -> int: + """ + High watermark of memory in use. It can be set to zero to reset it to + the current usage. + """ + + @used_mem_high.setter + def used_mem_high(self, value: int) -> None: + ... + +class cyGraphMemoryResource(MemoryResource): + + def __cinit__(self, device_id: int) -> None: + ... + + def allocate(self, size: int, *, stream: Stream | GraphBuilder) -> Buffer: + """ + Allocate a buffer of the requested size. See documentation for :obj:`~_memory.MemoryResource`. + """ + + def deallocate(self, ptr: DevicePointerType, size: int, *, stream: Stream | GraphBuilder) -> None: + """ + Deallocate a buffer of the requested size. See documentation for :obj:`~_memory.MemoryResource`. + """ + + def close(self) -> None: + """No operation (provided for compatibility).""" + + def trim(self) -> None: + """Free unused memory that was cached on the specified device for use with graphs back to the OS.""" + + @property + def attributes(self) -> GraphMemoryResourceAttributes: + """Asynchronous allocation attributes related to graphs.""" + + @property + def device_id(self) -> int: + """The associated device ordinal.""" + + @property + def is_device_accessible(self) -> bool: + """Return True. This memory resource provides device-accessible buffers.""" + + @property + def is_host_accessible(self) -> bool: + """Return False. This memory resource does not provide host-accessible buffers.""" + +class GraphMemoryResource(cyGraphMemoryResource): + """ + A memory resource for memory related to graphs. + + The only supported operations are allocation, deallocation, and a limited + set of status queries. + + This memory resource should be used when building graphs. Using this when + graphs capture is not enabled will result in a runtime error. + + Conversely, allocating memory from a `DeviceMemoryResource` when graph + capturing is enabled results in a runtime error. + + Parameters + ---------- + device_id: int | Device + Device or Device ordinal for which a graph memory resource is obtained. + """ + + def __new__(cls, device_id: int | Device) -> GraphMemoryResource: + ... + + @classmethod + def _create(cls, device_id: int) -> GraphMemoryResource: + ... +__all__ = ['GraphMemoryResource'] \ No newline at end of file diff --git a/cuda_core/cuda/core/_memory/_graph_memory_resource.pyx b/cuda_core/cuda/core/_memory/_graph_memory_resource.pyx new file mode 100644 index 00000000000..e845a47b080 --- /dev/null +++ b/cuda_core/cuda/core/_memory/_graph_memory_resource.pyx @@ -0,0 +1,232 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from __future__ import annotations + +from libc.stdint cimport intptr_t + +from cuda.bindings cimport cydriver +from cuda.core._memory._buffer cimport Buffer, Buffer_from_deviceptr_handle, MemoryResource +from cuda.core._resource_handles cimport ( + DevicePtrHandle, + deviceptr_alloc_async, + get_last_error, + as_cu, +) + +from cuda.core._stream cimport Stream_accept, Stream +from cuda.core._utils.cuda_utils cimport HANDLE_RETURN + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from cuda.core._device import Device + from cuda.core.graph import GraphBuilder + from cuda.core.typing import DevicePointerType + +__all__ = ['GraphMemoryResource'] + + +cdef class GraphMemoryResourceAttributes: + cdef: + int _device_id + + def __init__(self, *args, **kwargs) -> None: + raise RuntimeError("GraphMemoryResourceAttributes cannot be instantiated directly. Please use MemoryResource APIs.") + + @classmethod + def _init(cls, device_id: int) -> GraphMemoryResourceAttributes: + cdef GraphMemoryResourceAttributes self = GraphMemoryResourceAttributes.__new__(cls) + self._device_id = device_id + return self + + def __repr__(self) -> str: + return f"{self.__class__.__name__}(%s)" % ", ".join( + f"{attr}={getattr(self, attr)}" for attr in dir(self) + if not attr.startswith("_") + ) + + cdef int _getattribute(self, cydriver.CUgraphMem_attribute attr_enum, void* value) except?-1: + with nogil: + HANDLE_RETURN(cydriver.cuDeviceGetGraphMemAttribute(self._device_id, attr_enum, value)) + return 0 + + cdef int _setattribute(self, cydriver.CUgraphMem_attribute attr_enum, void* value) except?-1: + with nogil: + HANDLE_RETURN(cydriver.cuDeviceSetGraphMemAttribute(self._device_id, attr_enum, value)) + return 0 + + @property + def reserved_mem_current(self) -> int: + """Current amount of backing memory allocated.""" + cdef cydriver.cuuint64_t value + self._getattribute(cydriver.CUgraphMem_attribute.CU_GRAPH_MEM_ATTR_RESERVED_MEM_CURRENT, &value) + return int(value) + + @property + def reserved_mem_high(self) -> int: + """ + High watermark of backing memory allocated. It can be set to zero to + reset it to the current usage. + """ + cdef cydriver.cuuint64_t value + self._getattribute(cydriver.CUgraphMem_attribute.CU_GRAPH_MEM_ATTR_RESERVED_MEM_HIGH, &value) + return int(value) + + @reserved_mem_high.setter + def reserved_mem_high(self, value: int) -> None: + if value != 0: + raise AttributeError(f"Attribute 'reserved_mem_high' may only be set to zero (got {value}).") + cdef cydriver.cuuint64_t zero = 0 + self._setattribute(cydriver.CUgraphMem_attribute.CU_GRAPH_MEM_ATTR_RESERVED_MEM_HIGH, &zero) + + @property + def used_mem_current(self) -> int: + """Current amount of memory in use.""" + cdef cydriver.cuuint64_t value + self._getattribute(cydriver.CUgraphMem_attribute.CU_GRAPH_MEM_ATTR_USED_MEM_CURRENT, &value) + return int(value) + + @property + def used_mem_high(self) -> int: + """ + High watermark of memory in use. It can be set to zero to reset it to + the current usage. + """ + cdef cydriver.cuuint64_t value + self._getattribute(cydriver.CUgraphMem_attribute.CU_GRAPH_MEM_ATTR_USED_MEM_HIGH, &value) + return int(value) + + @used_mem_high.setter + def used_mem_high(self, value: int) -> None: + if value != 0: + raise AttributeError(f"Attribute 'used_mem_high' may only be set to zero (got {value}).") + cdef cydriver.cuuint64_t zero = 0 + self._setattribute(cydriver.CUgraphMem_attribute.CU_GRAPH_MEM_ATTR_USED_MEM_HIGH, &zero) + + +cdef class cyGraphMemoryResource(MemoryResource): + def __cinit__(self, int device_id) -> None: + self._device_id = device_id + + def allocate(self, size_t size, *, stream: Stream | GraphBuilder) -> Buffer: + """ + Allocate a buffer of the requested size. See documentation for :obj:`~_memory.MemoryResource`. + """ + cdef Stream s = Stream_accept(stream) + return GMR_allocate(self, size, s) + + def deallocate( + self, + ptr: DevicePointerType, + size_t size, + *, + stream: Stream | GraphBuilder + ) -> None: + """ + Deallocate a buffer of the requested size. See documentation for :obj:`~_memory.MemoryResource`. + """ + cdef Stream s = Stream_accept(stream) + return GMR_deallocate(ptr, size, s) + + def close(self) -> None: + """No operation (provided for compatibility).""" + pass + + def trim(self) -> None: + """Free unused memory that was cached on the specified device for use with graphs back to the OS.""" + with nogil: + HANDLE_RETURN(cydriver.cuDeviceGraphMemTrim(self._device_id)) + + @property + def attributes(self) -> GraphMemoryResourceAttributes: + """Asynchronous allocation attributes related to graphs.""" + return GraphMemoryResourceAttributes._init(self._device_id) + + @property + def device_id(self) -> int: + """The associated device ordinal.""" + return self._device_id + + @property + def is_device_accessible(self) -> bool: + """Return True. This memory resource provides device-accessible buffers.""" + return True + + @property + def is_host_accessible(self) -> bool: + """Return False. This memory resource does not provide host-accessible buffers.""" + return False + + +cdef dict _mem_resource_cache = {} + +class GraphMemoryResource(cyGraphMemoryResource): + """ + A memory resource for memory related to graphs. + + The only supported operations are allocation, deallocation, and a limited + set of status queries. + + This memory resource should be used when building graphs. Using this when + graphs capture is not enabled will result in a runtime error. + + Conversely, allocating memory from a `DeviceMemoryResource` when graph + capturing is enabled results in a runtime error. + + Parameters + ---------- + device_id: int | Device + Device or Device ordinal for which a graph memory resource is obtained. + """ + + def __new__(cls, device_id: int | Device) -> GraphMemoryResource: + cdef int c_device_id = getattr(device_id, 'device_id', device_id) + return cls._create(c_device_id) + + @classmethod + def _create(cls, int device_id) -> GraphMemoryResource: + # we use a dict currently, because functools.cache is currently less + # thread-safe see also: https://github.com/python/cpython/issues/150708 + res = _mem_resource_cache.get(device_id) + if res is not None: + return res + + # create new instance, but in case of a race may return another: + new = cyGraphMemoryResource.__new__(cls, device_id) + return _mem_resource_cache.setdefault(device_id, new) + + +# Raise an exception if the given stream is capturing. +# A result of CU_STREAM_CAPTURE_STATUS_INVALIDATED is considered an error. +cdef inline int check_capturing(cydriver.CUstream s) except?-1 nogil: + cdef cydriver.CUstreamCaptureStatus capturing + HANDLE_RETURN(cydriver.cuStreamIsCapturing(s, &capturing)) + if capturing != cydriver.CUstreamCaptureStatus.CU_STREAM_CAPTURE_STATUS_ACTIVE: + raise RuntimeError("GraphMemoryResource cannot perform memory operations on " + "a non-capturing stream.") + + +cdef inline Buffer GMR_allocate(cyGraphMemoryResource self, size_t size, Stream stream): + cdef cydriver.CUstream s = as_cu(stream._h_stream) + cdef DevicePtrHandle h_ptr + with nogil: + check_capturing(s) + h_ptr = deviceptr_alloc_async(size, stream._h_stream) + if not h_ptr: + HANDLE_RETURN(get_last_error()) + raise RuntimeError( + f"Failed to allocate {size} bytes from GraphMemoryResource: " + "cuda-core returned an empty allocation handle without recording a CUDA error. " + "This is an internal cuda-core error; please report it with your CUDA driver, " + "CUDA Toolkit, and cuda-python versions." + ) + return Buffer_from_deviceptr_handle(h_ptr, size, self, None) + + +cdef inline void GMR_deallocate(intptr_t ptr, size_t size, Stream stream) noexcept: + cdef cydriver.CUstream s = as_cu(stream._h_stream) + cdef cydriver.CUdeviceptr devptr = ptr + with nogil: + HANDLE_RETURN(cydriver.cuMemFreeAsync(devptr, s)) diff --git a/cuda_core/cuda/core/_memory/_ipc.pxd b/cuda_core/cuda/core/_memory/_ipc.pxd new file mode 100644 index 00000000000..b912ace0035 --- /dev/null +++ b/cuda_core/cuda/core/_memory/_ipc.pxd @@ -0,0 +1,67 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from cuda.bindings cimport cydriver +from cuda.core._memory._buffer cimport Buffer +from cuda.core._memory._memory_pool cimport _MemPool +from cuda.core._resource_handles cimport FileDescriptorHandle + + +# Holds _MemPool objects imported by this process. This enables +# buffer serialization, as buffers can reduce to a pair comprising the memory +# resource UUID (the key into this registry) and the serialized buffer +# descriptor. +cdef object registry + + +# The IPC handle type for this platform. IPC is currently only supported on +# Linux. On other platforms, the IPC handle type is set equal to the no-IPC +# handle type. +cdef cydriver.CUmemAllocationHandleType IPC_HANDLE_TYPE + + +# Whether IPC is supported on this platform. +cdef is_supported() + + +cdef class IPCDataForBuffer: + cdef: + IPCBufferDescriptor _ipc_descriptor + bint _is_mapped + + +cdef class IPCDataForMR: + cdef: + IPCAllocationHandle _alloc_handle + bint _is_mapped + + +cdef class IPCBufferDescriptor: + cdef: + bytes _payload + size_t _size + + cdef const void* payload_ptr(self) noexcept + + +cdef class IPCAllocationHandle: + cdef: + FileDescriptorHandle _h_fd + object _uuid + + cpdef close(self) + + +# Buffer IPC Implementation +# ------------------------- +cdef IPCBufferDescriptor Buffer_get_ipc_descriptor(Buffer) +cdef Buffer Buffer_from_ipc_descriptor(cls, _MemPool, IPCBufferDescriptor, stream) + + +# _MemPool IPC Implementation +# --------------------------- +cdef _MemPool MP_from_allocation_handle(cls, alloc_handle) +cdef _MemPool MP_from_registry(uuid) +cdef _MemPool MP_register(_MemPool, uuid) +cdef IPCAllocationHandle MP_export_mempool(_MemPool) diff --git a/cuda_core/cuda/core/_memory/_ipc.pyi b/cuda_core/cuda/core/_memory/_ipc.pyi new file mode 100644 index 00000000000..0c912a567bd --- /dev/null +++ b/cuda_core/cuda/core/_memory/_ipc.pyi @@ -0,0 +1,93 @@ +# This file was generated by stubgen-pyx v0.2.6 from cuda_core/cuda/core/_memory/_ipc.pyx + +from __future__ import annotations + +import uuid + + +class IPCDataForBuffer: + """Data members related to sharing memory buffers via IPC.""" + + def __cinit__(self, ipc_descriptor: IPCBufferDescriptor, is_mapped: bool) -> None: + ... + + @property + def ipc_descriptor(self) -> IPCBufferDescriptor: + ... + + @property + def is_mapped(self) -> bool: + ... + +class IPCDataForMR: + """Data members related to sharing memory resources via IPC.""" + + def __cinit__(self, alloc_handle: IPCAllocationHandle, is_mapped: bool) -> None: + ... + + @property + def alloc_handle(self) -> IPCAllocationHandle: + ... + + @property + def is_mapped(self) -> bool: + ... + + @property + def uuid(self) -> uuid.UUID | None: + ... + +class IPCBufferDescriptor: + """Serializable object describing a buffer that can be shared between processes. + + Note + ---- + The payload and ``size`` fields are controlled by the exporting peer. + Receivers must treat them as untrusted and import only through + :meth:`Buffer.from_ipc_descriptor`. + """ + + def __init__(self, *arg, **kwargs) -> None: + ... + + @staticmethod + def _init(reserved: bytes, size: int) -> IPCBufferDescriptor: + ... + + def __reduce__(self) -> tuple[object, ...]: + ... + + @property + def size(self) -> int: + ... + +class IPCAllocationHandle: + """Shareable handle to an IPC-enabled device memory pool.""" + + def close(self): + """Close the handle.""" + + def __init__(self, *arg, **kwargs) -> None: + ... + + @classmethod + def _init(cls, handle: int, uuid: uuid.UUID | None) -> IPCAllocationHandle: + ... + + def __int__(self) -> int: + ... + + @property + def handle(self) -> int: + ... + + @property + def uuid(self) -> uuid.UUID: + ... +__all__ = ['IPCBufferDescriptor', 'IPCAllocationHandle'] + +def _reduce_allocation_handle(alloc_handle: IPCAllocationHandle) -> tuple[object, ...]: + ... + +def _reconstruct_allocation_handle(cls: type, df: object, uuid: uuid.UUID | None) -> IPCAllocationHandle: + ... \ No newline at end of file diff --git a/cuda_core/cuda/core/_memory/_ipc.pyx b/cuda_core/cuda/core/_memory/_ipc.pyx new file mode 100644 index 00000000000..d03f51a26ce --- /dev/null +++ b/cuda_core/cuda/core/_memory/_ipc.pyx @@ -0,0 +1,288 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +cimport cpython + +from libc.stddef cimport size_t +from cuda.bindings cimport cydriver +from cuda.core._memory._buffer cimport Buffer, Buffer_from_deviceptr_handle +from cuda.core._memory._memory_pool cimport _MemPool +from cuda.core._stream cimport Stream, Stream_accept +from cuda.core._resource_handles cimport ( + DevicePtrHandle, + create_fd_handle, + create_mempool_handle_ipc, + deviceptr_import_ipc, + get_last_error, + as_cu, + as_intptr, + as_py, +) + +from cuda.core._utils.cuda_utils cimport HANDLE_RETURN +from cuda.core._utils.cuda_utils import check_multiprocessing_start_method + +import multiprocessing +import os +import platform +import uuid +import weakref + +__all__ = ['IPCBufferDescriptor', 'IPCAllocationHandle'] + + +cdef object registry = weakref.WeakValueDictionary() + + +cdef cydriver.CUmemAllocationHandleType IPC_HANDLE_TYPE = \ + cydriver.CUmemAllocationHandleType.CU_MEM_HANDLE_TYPE_POSIX_FILE_DESCRIPTOR \ + if platform.system() == "Linux" else \ + cydriver.CUmemAllocationHandleType.CU_MEM_HANDLE_TYPE_NONE + +cdef is_supported(): + return IPC_HANDLE_TYPE != cydriver.CUmemAllocationHandleType.CU_MEM_HANDLE_TYPE_NONE + + +cdef class IPCDataForBuffer: + """Data members related to sharing memory buffers via IPC.""" + def __cinit__(self, IPCBufferDescriptor ipc_descriptor, bint is_mapped) -> None: + self._ipc_descriptor = ipc_descriptor + self._is_mapped = is_mapped + + @property + def ipc_descriptor(self) -> IPCBufferDescriptor: + return self._ipc_descriptor + + @property + def is_mapped(self) -> bool: + return self._is_mapped + + +cdef class IPCDataForMR: + """Data members related to sharing memory resources via IPC.""" + def __cinit__(self, IPCAllocationHandle alloc_handle, bint is_mapped) -> None: + self._alloc_handle = alloc_handle + self._is_mapped = is_mapped + + @property + def alloc_handle(self) -> IPCAllocationHandle: + return self._alloc_handle + + @property + def is_mapped(self) -> bool: + return self._is_mapped + + @property + def uuid(self) -> uuid.UUID | None: + return getattr(self._alloc_handle, 'uuid', None) + + +cdef class IPCBufferDescriptor: + """Serializable object describing a buffer that can be shared between processes. + + Note + ---- + The payload and ``size`` fields are controlled by the exporting peer. + Receivers must treat them as untrusted and import only through + :meth:`Buffer.from_ipc_descriptor`. + """ + + def __init__(self, *arg, **kwargs) -> None: + raise RuntimeError("IPCBufferDescriptor objects cannot be instantiated directly. Please use MemoryResource APIs.") + + @staticmethod + def _init(reserved: bytes, size: int) -> IPCBufferDescriptor: + cdef IPCBufferDescriptor self = IPCBufferDescriptor.__new__(IPCBufferDescriptor) + self._payload = reserved + self._size = size + return self + + def __reduce__(self) -> tuple[object, ...]: + return IPCBufferDescriptor._init, (self._payload, self._size) + + @property + def size(self) -> int: + return self._size + + cdef const void* payload_ptr(self) noexcept: + """Return the payload as a const void* for C API calls.""" + return (self._payload) + + +cdef class IPCAllocationHandle: + """Shareable handle to an IPC-enabled device memory pool.""" + + def __init__(self, *arg, **kwargs) -> None: + raise RuntimeError("IPCAllocationHandle objects cannot be instantiated directly. Please use MemoryResource APIs.") + + @classmethod + def _init(cls, handle: int, uuid: uuid.UUID | None) -> IPCAllocationHandle: # no-cython-lint + cdef IPCAllocationHandle self = IPCAllocationHandle.__new__(cls) + if handle < 0: + raise ValueError(f"Invalid allocation handle (fd) {handle}: must be non-negative") + self._h_fd = create_fd_handle(handle) + self._uuid = uuid + return self + + cpdef close(self): + """Close the handle.""" + self._h_fd.reset() + + def __int__(self) -> int: + if not self._h_fd or as_intptr(self._h_fd) < 0: + raise ValueError( + f"Cannot convert IPCAllocationHandle to int: the handle (id={id(self)}) is closed." + ) + return as_py(self._h_fd) + + @property + def handle(self) -> int: + return as_py(self._h_fd) + + @property + def uuid(self) -> uuid.UUID: + return self._uuid + + +def _reduce_allocation_handle(alloc_handle: IPCAllocationHandle) -> tuple[object, ...]: + check_multiprocessing_start_method() + df = multiprocessing.reduction.DupFd(alloc_handle.handle) + return _reconstruct_allocation_handle, (type(alloc_handle), df, alloc_handle.uuid) + + +def _reconstruct_allocation_handle(cls: type, df: object, uuid: uuid.UUID | None) -> IPCAllocationHandle: # no-cython-lint + return cls._init(df.detach(), uuid) + + +multiprocessing.reduction.register(IPCAllocationHandle, _reduce_allocation_handle) + + +# Buffer IPC Implementation +# ------------------------- +cdef IPCBufferDescriptor Buffer_get_ipc_descriptor(Buffer self): + if not self.memory_resource.is_ipc_enabled: + raise RuntimeError("Memory resource is not IPC-enabled") + cdef cydriver.CUmemPoolPtrExportData data + with nogil: + HANDLE_RETURN( + cydriver.cuMemPoolExportPointer(&data, as_cu(self._h_ptr)) + ) + cdef bytes data_b = cpython.PyBytes_FromStringAndSize( + (data.reserved), sizeof(data.reserved) + ) + return IPCBufferDescriptor._init(data_b, self.size) + +cdef Buffer Buffer_from_ipc_descriptor( + cls, _MemPool mr, IPCBufferDescriptor ipc_descriptor, stream +): + """Import a buffer that was exported from another process.""" + if not mr.is_ipc_enabled: + raise RuntimeError("Memory resource is not IPC-enabled") + cdef size_t payload_size = len(ipc_descriptor._payload) + cdef size_t expected_size = sizeof(cydriver.CUmemPoolPtrExportData) + if payload_size < expected_size: + raise ValueError( + f"IPC buffer descriptor payload is {payload_size} bytes; " + f"expected at least {expected_size}" + ) + cdef Stream s = Stream_accept(stream) + cdef DevicePtrHandle h_ptr = deviceptr_import_ipc( + mr._h_pool, + ipc_descriptor.payload_ptr(), + s._h_stream + ) + if not h_ptr: + HANDLE_RETURN(get_last_error()) + cdef size_t mapped_size = 0 + cdef size_t claimed_size = ipc_descriptor.size + with nogil: + HANDLE_RETURN(cydriver.cuPointerGetAttribute( + &mapped_size, + cydriver.CU_POINTER_ATTRIBUTE_RANGE_SIZE, + as_cu(h_ptr))) + if claimed_size > mapped_size: + h_ptr.reset() + raise ValueError( + f"IPC buffer descriptor size ({claimed_size}) exceeds " + f"mapped allocation extent ({mapped_size} bytes)" + ) + return Buffer_from_deviceptr_handle(h_ptr, claimed_size, mr, ipc_descriptor) + + +# _MemPool IPC Implementation +# --------------------------- + +cdef _MemPool MP_from_allocation_handle(cls, alloc_handle): + # Quick exit for registry hits. + uuid = getattr(alloc_handle, 'uuid', None) # no-cython-lint + mr = registry.get(uuid) + if mr is not None: + if not isinstance(mr, cls): + raise TypeError( + f"Registry contains a {type(mr).__name__} for uuid " + f"{uuid}, but {cls.__name__} was requested") + return mr + + # Ensure we have an allocation handle. Duplicate the file descriptor, if + # necessary. + if isinstance(alloc_handle, int): + fd = os.dup(alloc_handle) + try: + alloc_handle = IPCAllocationHandle._init(fd, None) + except: + os.close(fd) + raise + + # Construct a new mempool. + cdef _MemPool self = <_MemPool>(cls.__new__(cls)) + self._mempool_owned = True + cdef int ipc_fd = int(alloc_handle) + self._h_pool = create_mempool_handle_ipc(ipc_fd, IPC_HANDLE_TYPE) + if not self._h_pool: + HANDLE_RETURN(get_last_error()) + raise RuntimeError( + f"Failed to import {cls.__name__} from an allocation handle: " + "cuda-core returned an empty memory pool handle without recording a CUDA error. " + "This is an internal cuda-core error; please report it with your CUDA driver, " + "CUDA Toolkit, and cuda-python versions." + ) + self._ipc_data = IPCDataForMR(alloc_handle, True) + + # Register it. + if uuid is not None: + registered = self.register(uuid) + assert registered is self + + return self + + +cdef _MemPool MP_from_registry(uuid): + try: + return registry[uuid] + except KeyError: + raise RuntimeError(f"Memory resource {uuid} was not found") from None + + +cdef _MemPool MP_register(_MemPool self, uuid): + existing = registry.get(uuid) + if existing is not None: + return existing + assert self.uuid is None or self.uuid == uuid + registry[uuid] = self + self._ipc_data._alloc_handle._uuid = uuid + return self + + +cdef IPCAllocationHandle MP_export_mempool(_MemPool self): + # Note: This is Linux only (int for file descriptor) + cdef int fd + with nogil: + HANDLE_RETURN(cydriver.cuMemPoolExportToShareableHandle( + &fd, as_cu(self._h_pool), IPC_HANDLE_TYPE, 0) + ) + try: + return IPCAllocationHandle._init(fd, uuid.uuid4()) + except: + os.close(fd) + raise diff --git a/cuda_core/cuda/core/_memory/_legacy.py b/cuda_core/cuda/core/_memory/_legacy.py new file mode 100644 index 00000000000..4acbcb54e3a --- /dev/null +++ b/cuda_core/cuda/core/_memory/_legacy.py @@ -0,0 +1,142 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from __future__ import annotations + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from cuda.core._stream import Stream + from cuda.core.graph import GraphBuilder + from cuda.core.typing import DevicePointerType + +from cuda.core._memory._buffer import Buffer, MemoryResource +from cuda.core._utils.cuda_utils import ( + _check_driver_error as raise_if_driver_error, +) +from cuda.core._utils.cuda_utils import ( + driver, +) + +__all__ = ["LegacyPinnedMemoryResource"] + + +class LegacyPinnedMemoryResource(MemoryResource): + """Create a pinned memory resource that uses legacy cuMemAllocHost/cudaMallocHost + APIs. + """ + + # TODO: support creating this MR with flags that are later passed to cuMemHostAlloc? + + def allocate(self, size: int, *, stream: Stream | GraphBuilder | None = None) -> Buffer: + """Allocate a buffer of the requested size. + + ``cuMemAllocHost`` is synchronous, so this resource ignores any + supplied stream. The argument is accepted (and validated when + non-``None``) for interface conformance with stream-ordered + memory resources. + + Parameters + ---------- + size : int + The size of the buffer to allocate, in bytes. + stream : Stream, optional + Keyword-only. Validated when provided but otherwise unused. + + Returns + ------- + Buffer + The allocated buffer object, which is accessible on both host and device. + """ + from cuda.core._stream import Stream_accept + + if stream is not None: + Stream_accept(stream) + if size: + err, ptr = driver.cuMemAllocHost(size) + raise_if_driver_error(err) + else: + ptr = 0 + return Buffer._init(ptr, size, self) + + def deallocate(self, ptr: DevicePointerType, size: int, *, stream: Stream | GraphBuilder | None = None) -> None: + """Deallocate a buffer previously allocated by this resource. + + Parameters + ---------- + ptr : :obj:`~_memory.DevicePointerType` + The pointer or handle to the buffer to deallocate. + size : int + The size of the buffer to deallocate, in bytes. + stream : Stream, optional + Keyword-only. If provided, ``stream.sync()`` is called before the + host allocation is freed. ``None`` skips the sync. + """ + from cuda.core._stream import Stream_accept + + if stream is not None: + Stream_accept(stream).sync() + + if size: + (err,) = driver.cuMemFreeHost(ptr) + raise_if_driver_error(err) + + @property + def is_device_accessible(self) -> bool: + """bool: this memory resource provides device-accessible buffers.""" + return True + + @property + def is_host_accessible(self) -> bool: + """bool: this memory resource provides host-accessible buffers.""" + return True + + @property + def device_id(self) -> int: + """This memory resource is not bound to any GPU.""" + raise RuntimeError("a pinned memory resource is not bound to any GPU") + + +class _SynchronousMemoryResource(MemoryResource): + __slots__ = ("_device_id",) + + def __init__(self, device_id: int) -> None: + from .._device import Device + + self._device_id = Device(device_id).device_id + + def allocate(self, size: int, *, stream: Stream | GraphBuilder | None = None) -> Buffer: + # cuMemAlloc is synchronous; stream is accepted (and validated) + # for interface conformance but not used. + from cuda.core._stream import Stream_accept + + if stream is not None: + Stream_accept(stream) + if size: + err, ptr = driver.cuMemAlloc(size) + raise_if_driver_error(err) + else: + ptr = 0 + return Buffer._init(ptr, size, self) + + def deallocate(self, ptr: DevicePointerType, size: int, *, stream: Stream | GraphBuilder | None = None) -> None: + from cuda.core._stream import Stream_accept + + if stream is not None: + Stream_accept(stream).sync() + if size: + (err,) = driver.cuMemFree(ptr) + raise_if_driver_error(err) + + @property + def is_device_accessible(self) -> bool: + return True + + @property + def is_host_accessible(self) -> bool: + return False + + @property + def device_id(self) -> int: + return self._device_id diff --git a/cuda_core/cuda/core/_memory/_managed_buffer.py b/cuda_core/cuda/core/_memory/_managed_buffer.py new file mode 100644 index 00000000000..9a8333e7094 --- /dev/null +++ b/cuda_core/cuda/core/_memory/_managed_buffer.py @@ -0,0 +1,252 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +from __future__ import annotations + +from collections.abc import Iterable, Iterator, MutableSet +from typing import TYPE_CHECKING, Any + +from cuda.core._device import Device +from cuda.core._host import Host +from cuda.core._memory._buffer import Buffer +from cuda.core._memory._managed_location import _coerce_location +from cuda.core._memory._managed_memory_ops import ( + _advise_one, + _do_single_discard_prefetch_py, + _do_single_discard_py, + _do_single_prefetch_py, + _read_preferred_location_v2, +) +from cuda.core._utils.cuda_utils import driver, handle_return +from cuda.core._utils.version import binding_version, driver_version + +if TYPE_CHECKING: + from cuda.core._memory._buffer import MemoryResource + from cuda.core._stream import Stream + from cuda.core.graph import GraphBuilder + + +_INT_SIZE = 4 + +# Enum aliases — referenced once per property write, so cache the lookup. +_ADV = driver.CUmem_advise +_SET_READ_MOSTLY = _ADV.CU_MEM_ADVISE_SET_READ_MOSTLY +_UNSET_READ_MOSTLY = _ADV.CU_MEM_ADVISE_UNSET_READ_MOSTLY +_SET_PREFERRED = _ADV.CU_MEM_ADVISE_SET_PREFERRED_LOCATION +_UNSET_PREFERRED = _ADV.CU_MEM_ADVISE_UNSET_PREFERRED_LOCATION +_SET_ACCESSED_BY = _ADV.CU_MEM_ADVISE_SET_ACCESSED_BY +_UNSET_ACCESSED_BY = _ADV.CU_MEM_ADVISE_UNSET_ACCESSED_BY + +_RANGE = driver.CUmem_range_attribute +_ATTR_READ_MOSTLY = _RANGE.CU_MEM_RANGE_ATTRIBUTE_READ_MOSTLY +_ATTR_PREFERRED = _RANGE.CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION +_ATTR_ACCESSED_BY = _RANGE.CU_MEM_RANGE_ATTRIBUTE_ACCESSED_BY + + +def _get_int_attr(buf: Buffer, attribute: Any) -> int: + return int(handle_return(driver.cuMemRangeGetAttribute(_INT_SIZE, attribute, buf.handle, buf.size))) + + +def _query_accessed_by(buf: Buffer) -> list[Device | Host]: + """Read the live ``CU_MEM_RANGE_ATTRIBUTE_ACCESSED_BY`` list. + + Driver fills an int32 array: device id, ``-1`` = host, ``-2`` = empty. + Sized to ``cuDeviceGetCount() + 1`` (every visible device plus host). + """ + num_devices = handle_return(driver.cuDeviceGetCount()) + n = num_devices + 1 + raw = handle_return(driver.cuMemRangeGetAttribute(n * _INT_SIZE, _ATTR_ACCESSED_BY, buf.handle, buf.size)) + return [Host() if v == -1 else Device(v) for v in raw if v != -2] + + +class AccessedBySetProxy(MutableSet[Device | Host]): + """Live driver-backed view of ``set_accessed_by`` advice for a managed buffer. + + Reads (``__contains__``, ``__iter__``, ``len(...)``) call + ``cuMemRangeGetAttribute``; writes (``add``, ``discard``) call + ``cuMemAdvise``. There is no in-memory mirror, so the view always + reflects the current driver state. + + Note + ---- + The driver returns integer device ordinals (``-1`` for host); host + NUMA distinctions applied via ``Host(numa_id=...)`` collapse to a + generic ``Host()`` when iterating this set. + """ + + __slots__ = ("_buf",) + + def __init__(self, buf: ManagedBuffer): + self._buf = buf + + # Operators such as &|^ produce a plain set, not another proxy. + @classmethod + def _from_iterable(cls, it: Iterable[Any]) -> set[Device | Host]: # type: ignore[override] + return set(it) + + # --- abstract methods required by MutableSet --- + + def __contains__(self, location: object) -> bool: + if not isinstance(location, (Device, Host)): + return False + return location in _query_accessed_by(self._buf) + + def __iter__(self) -> Iterator[Device | Host]: + return iter(_query_accessed_by(self._buf)) + + def __len__(self) -> int: + return len(_query_accessed_by(self._buf)) + + def add(self, location: Device | Host) -> None: + """Apply ``set_accessed_by`` advice for ``location``.""" + if not isinstance(location, (Device, Host)): + raise TypeError(f"expected Device or Host, got {type(location).__name__}") + _advise_one(self._buf, _SET_ACCESSED_BY, location) + + def discard(self, location: Device | Host) -> None: + """Apply ``unset_accessed_by`` advice for ``location``. + + Per the ``MutableSet`` contract, ``discard`` is a no-op for elements + not in the set. ``set_accessed_by`` only accepts ``Device`` and the + generic ``Host()`` — NUMA-aware host variants (``Host(numa_id=...)``, + ``Host.numa_current()``) can never enter the set, so discarding them + is silently ignored rather than forwarded to the driver. + """ + if not isinstance(location, (Device, Host)): + return + if isinstance(location, Host) and (location.numa_id is not None or location.is_numa_current): + return + _advise_one(self._buf, _UNSET_ACCESSED_BY, location) + + def __repr__(self) -> str: + return f"AccessedBySetProxy({set(_query_accessed_by(self._buf))!r})" + + +class ManagedBuffer(Buffer): + """Managed (unified) memory buffer with a property-style advice API. + + Returned by :meth:`ManagedMemoryResource.allocate`, or wrap an + existing managed-memory pointer with :meth:`ManagedBuffer.from_handle`. + + Examples + -------- + >>> buf = mr.allocate(size) + >>> buf.read_mostly = True + >>> buf.preferred_location = Device(0) + >>> buf.accessed_by.add(Device(1)) + >>> buf.prefetch(Device(0), stream=stream) + + Note + ---- + On CUDA 13 builds, ``preferred_location`` round-trips full NUMA + information. On CUDA 12 builds, ``Host(numa_id=...)`` and + ``Host.numa_current()`` are rejected with ``TypeError`` at the call + boundary — only ``Device(...)`` and the generic ``Host()`` are + accepted. Use ``Host()`` to target the host on CUDA 12. + """ + + @classmethod + def from_handle( + cls, + ptr, + size: int, + mr: MemoryResource | None = None, + owner: object | None = None, + ) -> Buffer: + """Wrap an existing managed-memory pointer in a :class:`ManagedBuffer`. + + Use this when you have an externally-allocated managed pointer + and want the property-style advice API (:attr:`read_mostly`, + :attr:`preferred_location`, :attr:`accessed_by`). + + Parameters + ---------- + ptr : :obj:`~_memory.DevicePointerT` + Pointer to a managed allocation. + size : int + Allocation size in bytes. + mr : :obj:`~_memory.MemoryResource`, optional + Memory resource that owns ``ptr``. When provided, its + ``deallocate`` is called when the buffer is closed. + owner : object, optional + An object that keeps the underlying allocation alive. + ``owner`` and ``mr`` cannot both be specified. + """ + return cls._init(ptr, size, mr=mr, owner=owner) + + @property + def read_mostly(self) -> bool: + """Whether ``set_read_mostly`` advice is currently applied.""" + return _get_int_attr(self, _ATTR_READ_MOSTLY) != 0 + + @read_mostly.setter + def read_mostly(self, value: bool) -> None: + _advise_one(self, _SET_READ_MOSTLY if value else _UNSET_READ_MOSTLY, None) + + @property + def preferred_location(self) -> Device | Host | None: + """Currently applied ``set_preferred_location`` target, or ``None``. + + On CUDA 13 builds, fully round-trips ``Host(numa_id=N)``. On CUDA 12 + the legacy attribute carries only a device ordinal (or ``-1`` for + host), so ``Host(numa_id=N)`` set via the setter round-trips back + as ``Host()``. + """ + # The v2 path uses CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION_{TYPE,ID}, + # both added in CUDA 13. Require both bindings and the runtime driver + # to be 13.0+; otherwise fall back to the legacy device-ordinal path. + # See PR #2054 / #2064 for prior bindings-only-check regressions. + if binding_version() >= (13, 0, 0) and driver_version() >= (13, 0, 0): + return _read_preferred_location_v2(self) + # CUDA 12 legacy path (no NUMA info available; also taken when + # bindings are 13.x but the runtime driver is still 12.x). + loc_id = _get_int_attr(self, _ATTR_PREFERRED) + if loc_id == -2: + return None + if loc_id == -1: + return Host() + return Device(loc_id) + + @preferred_location.setter + def preferred_location(self, value: Device | Host | None) -> None: + if value is None: + _advise_one(self, _UNSET_PREFERRED, None) + else: + _advise_one(self, _SET_PREFERRED, value) + + @property + def accessed_by(self) -> AccessedBySetProxy: + """Live set-like view of ``set_accessed_by`` locations.""" + return AccessedBySetProxy(self) + + @accessed_by.setter + def accessed_by(self, locations: Iterable[Device | Host]) -> None: + # Validate every target before issuing any cuMemAdvise so an invalid + # element can't leave accessed_by partially mutated. + target: set[Device | Host] = set() + for loc in locations: + if not isinstance(loc, (Device, Host)): + raise TypeError(f"accessed_by entries must be Device or Host, got {type(loc).__name__}") + target.add(loc) + for loc in target: + spec = _coerce_location(loc) + assert spec is not None + if spec.kind not in ("device", "host"): + raise ValueError(f"advise {_SET_ACCESSED_BY.name} does not support location_type='{spec.kind}'") + current = set(_query_accessed_by(self)) + for loc in current - target: + _advise_one(self, _UNSET_ACCESSED_BY, loc) + for loc in target - current: + _advise_one(self, _SET_ACCESSED_BY, loc) + + def prefetch(self, location: Device | Host, *, stream: Stream | GraphBuilder) -> None: + """Prefetch this range to ``location`` on ``stream``.""" + _do_single_prefetch_py(self, location, stream) + + def discard(self, *, stream: Stream | GraphBuilder) -> None: + """Discard this range's resident pages on ``stream`` (CUDA 13+).""" + _do_single_discard_py(self, stream) + + def discard_prefetch(self, location: Device | Host, *, stream: Stream | GraphBuilder) -> None: + """Discard this range and prefetch to ``location`` on ``stream`` (CUDA 13+).""" + _do_single_discard_prefetch_py(self, location, stream) diff --git a/cuda_core/cuda/core/_memory/_managed_location.py b/cuda_core/cuda/core/_memory/_managed_location.py new file mode 100644 index 00000000000..336f09f2eee --- /dev/null +++ b/cuda_core/cuda/core/_memory/_managed_location.py @@ -0,0 +1,84 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +from __future__ import annotations + +from dataclasses import dataclass +from typing import TYPE_CHECKING, Literal + +from cuda.core._utils.version import binding_version, driver_version + +if TYPE_CHECKING: + from cuda.core._device import Device + from cuda.core._host import Host + +_LocationKind = Literal["device", "host", "host_numa", "host_numa_current"] + + +@dataclass(frozen=True) +class _LocSpec: + """Internal location record produced by :func:`_coerce_location`. + + Carries the discriminator (``kind``) and the integer payload (``id``) + that the Cython layer in ``_managed_memory_ops.pyx`` consumes when + building ``CUmemLocation`` structs (CUDA 13+) or legacy device + ordinals (CUDA 12). + """ + + kind: _LocationKind + id: int = 0 + + +def _reject_numa_host_on_cuda12(spec: _LocSpec) -> None: + """Reject NUMA-host kinds on CUDA 12 builds at the public boundary. + + The CUDA 12 ``cuMemPrefetchAsync`` / ``cuMemAdvise`` ABI takes a + plain device ordinal (``-1`` for host), so it cannot represent a + specific host NUMA node. Rather than letting the operation fail + deep inside the Cython layer with ``RuntimeError``, raise a + ``TypeError`` at the call boundary with actionable wording. + """ + # The host-NUMA kinds map to CU_MEM_LOCATION_TYPE_HOST_NUMA{,_CURRENT}, + # both added in CUDA 13. Require both bindings and the runtime driver to + # be 13.0+; bindings-only is insufficient (PR #2054 / #2064 precedent). + if binding_version() >= (13, 0, 0) and driver_version() >= (13, 0, 0): + return + if spec.kind in ("host_numa", "host_numa_current"): + raise TypeError( + "Host(numa_id=...) / Host.numa_current() require both cuda-bindings 13.0+ " + "and a CUDA 13+ runtime driver; use Host() instead" + ) + + +def _coerce_location(value: Device | Host | None, *, allow_none: bool = False) -> _LocSpec | None: + """Coerce :class:`Device` / :class:`Host` / ``None`` to ``_LocSpec``. + + ``Host()``, ``Host(numa_id=N)``, and ``Host.numa_current()`` map to + the corresponding NUMA-aware kinds. On a CUDA 12 build of + ``cuda.core``, NUMA-host inputs are rejected with ``TypeError`` + because the legacy ABI cannot represent them. + """ + # Local imports to avoid import cycles (Device pulls in CUDA init). + from cuda.core._device import Device + from cuda.core._host import Host + + if isinstance(value, _LocSpec): + _reject_numa_host_on_cuda12(value) + return value + if isinstance(value, Device): + return _LocSpec(kind="device", id=value.device_id) + if isinstance(value, Host): + if value.is_numa_current: + spec = _LocSpec(kind="host_numa_current") + _reject_numa_host_on_cuda12(spec) + return spec + if value.numa_id is not None: + spec = _LocSpec(kind="host_numa", id=value.numa_id) + _reject_numa_host_on_cuda12(spec) + return spec + return _LocSpec(kind="host") + if value is None: + if allow_none: + return None + raise ValueError("location is required") + raise TypeError(f"location must be a Device, Host, or None; got {type(value).__name__}") diff --git a/cuda_core/cuda/core/_memory/_managed_memory_ops.pyi b/cuda_core/cuda/core/_memory/_managed_memory_ops.pyi new file mode 100644 index 00000000000..ca29265f103 --- /dev/null +++ b/cuda_core/cuda/core/_memory/_managed_memory_ops.pyi @@ -0,0 +1,105 @@ +# This file was generated by stubgen-pyx v0.2.6 from cuda_core/cuda/core/_memory/_managed_memory_ops.pyx + +from __future__ import annotations + +from collections.abc import Sequence + +from cuda.core._device import Device +from cuda.core._graph import GraphBuilder +from cuda.core._host import Host +from cuda.core._memory._buffer import Buffer +from cuda.core._stream import Stream +from cuda.core._utils.cuda_utils import driver + + +def discard_batch(stream: Stream | GraphBuilder, buffers: Sequence[Buffer]) -> None: + """Discard a batch of managed-memory ranges. + + Requires CUDA 13+. For a single buffer, use + :meth:`ManagedBuffer.discard` instead. + + Parameters + ---------- + stream : :class:`~_stream.Stream` | :class:`~graph.GraphBuilder` + Stream for the asynchronous discard. First positional, required + (mirrors :func:`launch`). + buffers : Sequence[:class:`Buffer`] + Two or more managed allocations to discard. Resident pages are + released without prefetching new contents; subsequent access is + satisfied by lazy migration. + + Raises + ------ + NotImplementedError + On a CUDA 12 build of ``cuda.core``. + """ + +def _do_single_discard_py(buf: Buffer, stream: Stream | GraphBuilder | None) -> None: + """Internal: single-buffer discard for ManagedBuffer.discard().""" + +def _advise_one(buf: Buffer, advice: driver.CUmem_advise, location: Device | Host | None) -> None: + """Internal: apply managed-memory advice to a single buffer. + + Used by :class:`ManagedBuffer` property setters. Not part of the + public API. + """ + +def prefetch_batch(stream: Stream | GraphBuilder, buffers: Sequence[Buffer], locations: Device | Host | Sequence[Device | Host]) -> None: + """Prefetch a batch of managed-memory ranges to target locations. + + Requires CUDA 13+. For a single buffer, use + :meth:`ManagedBuffer.prefetch` instead. + + Parameters + ---------- + stream : :class:`~_stream.Stream` | :class:`~graph.GraphBuilder` + Stream for the asynchronous prefetch. First positional, required + (mirrors :func:`launch`). + buffers : Sequence[:class:`Buffer`] + Two or more managed allocations to operate on. + locations : :class:`~cuda.core.Device` | :class:`~cuda.core.Host` | Sequence[...] + Target location(s). A single location applies to all buffers; a + sequence must match ``len(buffers)``. + + Notes + ----- + On a CUDA 12 build, falls back to a Python-level loop calling + ``cuMemPrefetchAsync`` per buffer (no batched driver entry point on + CUDA 12). CUDA 13 builds use ``cuMemPrefetchBatchAsync`` directly. + """ + +def _do_single_prefetch_py(buf: Buffer, location: Device | Host | None, stream: Stream | GraphBuilder | None) -> None: + """Internal: single-buffer prefetch for ManagedBuffer.prefetch(). + + Uses cuMemPrefetchAsync (works on CUDA 12 and 13). + """ + +def _read_preferred_location_v2(buf: Buffer) -> Device | Host | None: + ... + +def discard_prefetch_batch(stream: Stream | GraphBuilder, buffers: Sequence[Buffer], locations: Device | Host | Sequence[Device | Host]) -> None: + """Discard a batch of managed-memory ranges and prefetch them to target locations. + + Requires CUDA 13+. For a single buffer, use + :meth:`ManagedBuffer.discard_prefetch` instead. + + Parameters + ---------- + stream : :class:`~_stream.Stream` | :class:`~graph.GraphBuilder` + Stream for the asynchronous operation. First positional, required + (mirrors :func:`launch`). + buffers : Sequence[:class:`Buffer`] + Two or more managed allocations to discard and re-prefetch. + locations : :class:`~cuda.core.Device` | :class:`~cuda.core.Host` | Sequence[...] + Target location(s). A single location applies to all buffers; + a sequence must match ``len(buffers)``. + + Raises + ------ + NotImplementedError + On a CUDA 12 build of ``cuda.core``. + """ + +def _do_single_discard_prefetch_py(buf: Buffer, location: Device | Host | None, stream: Stream | GraphBuilder | None) -> None: + """Internal: single-buffer discard+prefetch for + ManagedBuffer.discard_prefetch().""" \ No newline at end of file diff --git a/cuda_core/cuda/core/_memory/_managed_memory_ops.pyx b/cuda_core/cuda/core/_memory/_managed_memory_ops.pyx new file mode 100644 index 00000000000..c07fb719dd9 --- /dev/null +++ b/cuda_core/cuda/core/_memory/_managed_memory_ops.pyx @@ -0,0 +1,454 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from __future__ import annotations + +from collections.abc import Sequence +from typing import TYPE_CHECKING + +IF CUDA_CORE_BUILD_MAJOR >= 13: + from libcpp.vector cimport vector + +from cuda.bindings cimport cydriver +from cuda.core._memory._buffer cimport Buffer +from cuda.core._resource_handles cimport as_cu +from cuda.core._stream cimport Stream, Stream_accept +from cuda.core._utils.cuda_utils cimport HANDLE_RETURN + +from cuda.core._host import Host +from cuda.core._utils.cuda_utils import driver +from cuda.core._memory._managed_location import _coerce_location + +if TYPE_CHECKING: + from cuda.core._graph import GraphBuilder + from cuda.core._device import Device + +cdef frozenset _ALL_LOCATION_TYPES = frozenset(("device", "host", "host_numa", "host_numa_current")) +cdef frozenset _DEVICE_HOST_NUMA = frozenset(("device", "host", "host_numa")) +cdef frozenset _DEVICE_HOST_ONLY = frozenset(("device", "host")) + +cdef set _ADVICE_IGNORES_LOCATION = { + driver.CUmem_advise.CU_MEM_ADVISE_SET_READ_MOSTLY, + driver.CUmem_advise.CU_MEM_ADVISE_UNSET_READ_MOSTLY, + driver.CUmem_advise.CU_MEM_ADVISE_UNSET_PREFERRED_LOCATION, +} + +cdef dict _ADVICE_ALLOWED_LOCTYPES = { + driver.CUmem_advise.CU_MEM_ADVISE_SET_READ_MOSTLY: _DEVICE_HOST_NUMA, + driver.CUmem_advise.CU_MEM_ADVISE_UNSET_READ_MOSTLY: _DEVICE_HOST_NUMA, + driver.CUmem_advise.CU_MEM_ADVISE_SET_PREFERRED_LOCATION: _ALL_LOCATION_TYPES, + driver.CUmem_advise.CU_MEM_ADVISE_UNSET_PREFERRED_LOCATION: _DEVICE_HOST_NUMA, + driver.CUmem_advise.CU_MEM_ADVISE_SET_ACCESSED_BY: _DEVICE_HOST_ONLY, + driver.CUmem_advise.CU_MEM_ADVISE_UNSET_ACCESSED_BY: _DEVICE_HOST_ONLY, +} + + +cdef void _require_managed_buffer(Buffer self, str what): + # Buffer.is_managed handles both pointer-attribute and memory-resource + # paths (e.g. pool-allocated managed memory whose pointer attribute + # does not advertise CU_POINTER_ATTRIBUTE_IS_MANAGED). + if not self.is_managed: + raise ValueError(f"{what} requires a managed-memory allocation") + + +cdef tuple _coerce_batch_buffers(object buffers, str what): + """Coerce ``buffers`` to a tuple[Buffer, ...]; rejects a single Buffer. + + For single-buffer operations, use the corresponding ManagedBuffer + instance method instead. + """ + cdef Buffer buf + cdef list out + if isinstance(buffers, Buffer): + raise TypeError( + f"{what}: pass a sequence of Buffers; for a single buffer use " + f"the ManagedBuffer instance method" + ) + if isinstance(buffers, Sequence): + if not buffers: + raise ValueError(f"{what}: empty buffers sequence") + out = [] + for t in buffers: + buf = t + out.append(buf) + return tuple(out) + raise TypeError( + f"{what}: buffers must be a sequence of Buffer, " + f"got {type(buffers).__name__}" + ) + + +cdef tuple _broadcast_locations(object location, Py_ssize_t n, bint allow_none, str what): + cdef object coerced + if isinstance(location, Sequence): + if len(location) != n: + raise ValueError( + f"{what}: location length {len(location)} does not match " + f"targets length {n}" + ) + return tuple(_coerce_location(loc, allow_none=allow_none) for loc in location) + coerced = _coerce_location(location, allow_none=allow_none) + return tuple([coerced] * n) + + +IF CUDA_CORE_BUILD_MAJOR >= 13: + # Convert a _LocSpec dataclass to a cydriver.CUmemLocation struct. + cdef inline cydriver.CUmemLocation _to_cumemlocation(object loc): + cdef cydriver.CUmemLocation out + cdef str kind = loc.kind + if kind == "device": + out.type = cydriver.CUmemLocationType.CU_MEM_LOCATION_TYPE_DEVICE + out.id = loc.id + elif kind == "host": + out.type = cydriver.CUmemLocationType.CU_MEM_LOCATION_TYPE_HOST + out.id = 0 + elif kind == "host_numa": + out.type = cydriver.CUmemLocationType.CU_MEM_LOCATION_TYPE_HOST_NUMA + out.id = loc.id + else: # host_numa_current + out.type = cydriver.CUmemLocationType.CU_MEM_LOCATION_TYPE_HOST_NUMA_CURRENT + out.id = 0 + return out +ELSE: + # CUDA 12 cuMemPrefetchAsync takes a device ordinal (-1 = host). + cdef inline int _to_legacy_device(object loc) except? -2: + cdef str kind = loc.kind + if kind == "device": + return loc.id + if kind == "host": + return -1 + raise RuntimeError( + "Host(numa_id=...) / Host.numa_current() require both cuda-bindings 13.0+ " + "and a CUDA 13+ runtime driver; use Host() instead" + ) + + +def discard_batch(stream: Stream | GraphBuilder, buffers: Sequence[Buffer]) -> None: + """Discard a batch of managed-memory ranges. + + Requires CUDA 13+. For a single buffer, use + :meth:`ManagedBuffer.discard` instead. + + Parameters + ---------- + stream : :class:`~_stream.Stream` | :class:`~graph.GraphBuilder` + Stream for the asynchronous discard. First positional, required + (mirrors :func:`launch`). + buffers : Sequence[:class:`Buffer`] + Two or more managed allocations to discard. Resident pages are + released without prefetching new contents; subsequent access is + satisfied by lazy migration. + + Raises + ------ + NotImplementedError + On a CUDA 12 build of ``cuda.core``. + """ + cdef tuple bufs = _coerce_batch_buffers(buffers, "discard_batch") + cdef Stream s = Stream_accept(stream) + + cdef Buffer buf + for buf in bufs: + _require_managed_buffer(buf, "discard_batch") + + _do_batch_discard(bufs, s) + + +def _do_single_discard_py(Buffer buf, stream: Stream | GraphBuilder | None) -> None: + """Internal: single-buffer discard for ManagedBuffer.discard().""" + _require_managed_buffer(buf, "discard") + cdef Stream s = Stream_accept(stream) + # No single-range cuMemDiscard exists; route through the batched call + # with count=1. + cdef tuple bufs = (buf,) + _do_batch_discard(bufs, s) + + +cdef void _do_batch_discard(tuple bufs, Stream s): + IF CUDA_CORE_BUILD_MAJOR >= 13: + cdef Py_ssize_t n = len(bufs) + cdef cydriver.CUstream hstream = as_cu(s._h_stream) + cdef vector[cydriver.CUdeviceptr] ptrs + cdef vector[size_t] sizes + ptrs.resize(n) + sizes.resize(n) + cdef Buffer buf + cdef Py_ssize_t i + for i in range(n): + buf = bufs[i] + ptrs[i] = as_cu(buf._h_ptr) + sizes[i] = buf._size + with nogil: + HANDLE_RETURN(cydriver.cuMemDiscardBatchAsync( + ptrs.data(), sizes.data(), n, 0, hstream, + )) + ELSE: + raise NotImplementedError( + "discard requires a CUDA 13 build of cuda.core" + ) + + +def _advise_one(Buffer buf, advice: driver.CUmem_advise, location: Device | Host | None) -> None: + """Internal: apply managed-memory advice to a single buffer. + + Used by :class:`ManagedBuffer` property setters. Not part of the + public API. + """ + _require_managed_buffer(buf, "advise") + if not isinstance(advice, driver.CUmem_advise): + raise TypeError( + f"advice must be a cuda.bindings.driver.CUmem_advise value, " + f"got {type(advice).__name__}" + ) + cdef frozenset allowed_kinds = _ADVICE_ALLOWED_LOCTYPES.get(advice) + if allowed_kinds is None: + raise ValueError(f"Unsupported advice value: {advice!r}") + cdef bint allow_none = advice in _ADVICE_IGNORES_LOCATION + cdef object loc = _coerce_location(location, allow_none=allow_none) + if loc is not None and loc.kind not in allowed_kinds: + raise ValueError( + f"advise {advice.name} does not support location_type='{loc.kind}'" + ) + _do_single_advise(buf, advice, loc, allow_none) + + +cdef void _do_single_advise(Buffer buf, object advice_value, object loc, bint allow_none): + cdef cydriver.CUdeviceptr cu_ptr = as_cu(buf._h_ptr) + cdef size_t nbytes = buf._size + cdef cydriver.CUmem_advise advice_enum = (int(advice_value)) + IF CUDA_CORE_BUILD_MAJOR >= 13: + cdef cydriver.CUmemLocation cu_loc + if loc is None: + # Driver ignores location for read_mostly / unset_preferred_location + # advice values but still validates the CUmemLocation; pass a + # host placeholder. + cu_loc.type = cydriver.CUmemLocationType.CU_MEM_LOCATION_TYPE_HOST + cu_loc.id = 0 + else: + cu_loc = _to_cumemlocation(loc) + with nogil: + HANDLE_RETURN(cydriver.cuMemAdvise(cu_ptr, nbytes, advice_enum, cu_loc)) + ELSE: + cdef int dev_int = -1 if loc is None else _to_legacy_device(loc) + with nogil: + HANDLE_RETURN(cydriver.cuMemAdvise(cu_ptr, nbytes, advice_enum, dev_int)) + + +def prefetch_batch( + stream: Stream | GraphBuilder, + buffers: Sequence[Buffer], + locations: Device | Host | Sequence[Device | Host], +) -> None: + """Prefetch a batch of managed-memory ranges to target locations. + + Requires CUDA 13+. For a single buffer, use + :meth:`ManagedBuffer.prefetch` instead. + + Parameters + ---------- + stream : :class:`~_stream.Stream` | :class:`~graph.GraphBuilder` + Stream for the asynchronous prefetch. First positional, required + (mirrors :func:`launch`). + buffers : Sequence[:class:`Buffer`] + Two or more managed allocations to operate on. + locations : :class:`~cuda.core.Device` | :class:`~cuda.core.Host` | Sequence[...] + Target location(s). A single location applies to all buffers; a + sequence must match ``len(buffers)``. + + Notes + ----- + On a CUDA 12 build, falls back to a Python-level loop calling + ``cuMemPrefetchAsync`` per buffer (no batched driver entry point on + CUDA 12). CUDA 13 builds use ``cuMemPrefetchBatchAsync`` directly. + """ + cdef tuple bufs = _coerce_batch_buffers(buffers, "prefetch_batch") + cdef Py_ssize_t n = len(bufs) + cdef tuple locs = _broadcast_locations(locations, n, False, "prefetch_batch") + cdef Stream s = Stream_accept(stream) + + cdef Buffer buf + for buf in bufs: + _require_managed_buffer(buf, "prefetch_batch") + + _do_batch_prefetch(bufs, locs, s) + + +def _do_single_prefetch_py(Buffer buf, location: Device | Host | None, stream: Stream | GraphBuilder | None) -> None: + """Internal: single-buffer prefetch for ManagedBuffer.prefetch(). + + Uses cuMemPrefetchAsync (works on CUDA 12 and 13). + """ + _require_managed_buffer(buf, "prefetch") + cdef object loc = _coerce_location(location, allow_none=False) + cdef Stream s = Stream_accept(stream) + _do_single_prefetch(buf, loc, s) + + +cdef void _do_single_prefetch(Buffer buf, object loc, Stream s): + cdef cydriver.CUdeviceptr cu_ptr = as_cu(buf._h_ptr) + cdef size_t nbytes = buf._size + cdef cydriver.CUstream hstream = as_cu(s._h_stream) + IF CUDA_CORE_BUILD_MAJOR >= 13: + cdef cydriver.CUmemLocation cu_loc = _to_cumemlocation(loc) + with nogil: + HANDLE_RETURN(cydriver.cuMemPrefetchAsync(cu_ptr, nbytes, cu_loc, 0, hstream)) + ELSE: + cdef int dev_int = _to_legacy_device(loc) + with nogil: + HANDLE_RETURN(cydriver.cuMemPrefetchAsync(cu_ptr, nbytes, dev_int, hstream)) + + +IF CUDA_CORE_BUILD_MAJOR >= 13: + # Function-pointer type for cuMemPrefetchBatchAsync / + # cuMemDiscardAndPrefetchBatchAsync; both have identical signatures. + ctypedef cydriver.CUresult (*_BatchPrefetchFn)( + cydriver.CUdeviceptr*, size_t*, size_t, + cydriver.CUmemLocation*, size_t*, size_t, + unsigned long long, cydriver.CUstream, + ) except ?cydriver.CUDA_ERROR_NOT_FOUND nogil + + + def _read_preferred_location_v2(Buffer buf) -> Device | Host | None: + """Internal: read preferred_location with full NUMA detail. + + Bypasses cuda.bindings.driver.cuMemRangeGetAttribute (whose + attribute allowlist doesn't yet include the cu13 _TYPE / _ID + attributes) by calling cydriver directly. + + Returns Device | Host | None. + """ + cdef cydriver.CUdeviceptr cu_ptr = as_cu(buf._h_ptr) + cdef size_t nbytes = buf._size + cdef int loc_type = 0 + cdef int loc_id = 0 + with nogil: + HANDLE_RETURN(cydriver.cuMemRangeGetAttribute( + &loc_type, sizeof(int), + cydriver.CUmem_range_attribute.CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION_TYPE, + cu_ptr, nbytes, + )) + HANDLE_RETURN(cydriver.cuMemRangeGetAttribute( + &loc_id, sizeof(int), + cydriver.CUmem_range_attribute.CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION_ID, + cu_ptr, nbytes, + )) + if loc_type == cydriver.CUmemLocationType.CU_MEM_LOCATION_TYPE_DEVICE: + from cuda.core._device import Device + return Device(loc_id) + if loc_type == cydriver.CUmemLocationType.CU_MEM_LOCATION_TYPE_HOST: + return Host() + if loc_type == cydriver.CUmemLocationType.CU_MEM_LOCATION_TYPE_HOST_NUMA: + return Host(numa_id=loc_id) + if loc_type == cydriver.CUmemLocationType.CU_MEM_LOCATION_TYPE_HOST_NUMA_CURRENT: + return Host.numa_current() + return None # CU_MEM_LOCATION_TYPE_INVALID — no preferred location + + + cdef void _do_batch_prefetch_op(tuple bufs, tuple locs, Stream s, _BatchPrefetchFn fn): + """Shared body for batched prefetch / discard-and-prefetch.""" + cdef Py_ssize_t n = len(bufs) + cdef cydriver.CUstream hstream = as_cu(s._h_stream) + cdef vector[cydriver.CUdeviceptr] ptrs + cdef vector[size_t] sizes + cdef vector[cydriver.CUmemLocation] loc_arr + cdef vector[size_t] loc_indices + ptrs.resize(n) + sizes.resize(n) + loc_arr.resize(n) + loc_indices.resize(n) + cdef Buffer buf + cdef Py_ssize_t i + for i in range(n): + buf = bufs[i] + ptrs[i] = as_cu(buf._h_ptr) + sizes[i] = buf._size + loc_arr[i] = _to_cumemlocation(locs[i]) + loc_indices[i] = i + with nogil: + HANDLE_RETURN(fn( + ptrs.data(), sizes.data(), n, + loc_arr.data(), loc_indices.data(), n, + 0, hstream, + )) +ELSE: + def _read_preferred_location_v2(Buffer buf) -> Device | Host | None: + # Symbol exists so _managed_buffer.py can `from ... import + # _read_preferred_location_v2` unconditionally at module top. + # `ManagedBuffer.preferred_location` gates on both + # binding_version() and driver_version() >= (13, 0, 0) before + # calling, so this path is unreachable on a cu12 build. + raise NotImplementedError( + "_read_preferred_location_v2 requires a CUDA 13 build of cuda.core" + ) + + +cdef void _do_batch_prefetch(tuple bufs, tuple locs, Stream s): + IF CUDA_CORE_BUILD_MAJOR >= 13: + _do_batch_prefetch_op(bufs, locs, s, cydriver.cuMemPrefetchBatchAsync) + ELSE: + # cu12 has no cuMemPrefetchBatchAsync; loop per-range. + cdef Buffer buf + cdef Py_ssize_t i + cdef Py_ssize_t n = len(bufs) + for i in range(n): + buf = bufs[i] + _do_single_prefetch(buf, locs[i], s) + + +def discard_prefetch_batch( + stream: Stream | GraphBuilder, + buffers: Sequence[Buffer], + locations: Device | Host | Sequence[Device | Host], +) -> None: + """Discard a batch of managed-memory ranges and prefetch them to target locations. + + Requires CUDA 13+. For a single buffer, use + :meth:`ManagedBuffer.discard_prefetch` instead. + + Parameters + ---------- + stream : :class:`~_stream.Stream` | :class:`~graph.GraphBuilder` + Stream for the asynchronous operation. First positional, required + (mirrors :func:`launch`). + buffers : Sequence[:class:`Buffer`] + Two or more managed allocations to discard and re-prefetch. + locations : :class:`~cuda.core.Device` | :class:`~cuda.core.Host` | Sequence[...] + Target location(s). A single location applies to all buffers; + a sequence must match ``len(buffers)``. + + Raises + ------ + NotImplementedError + On a CUDA 12 build of ``cuda.core``. + """ + cdef tuple bufs = _coerce_batch_buffers(buffers, "discard_prefetch_batch") + cdef Py_ssize_t n = len(bufs) + cdef tuple locs = _broadcast_locations(locations, n, False, "discard_prefetch_batch") + cdef Stream s = Stream_accept(stream) + + cdef Buffer buf + for buf in bufs: + _require_managed_buffer(buf, "discard_prefetch_batch") + + _do_batch_discard_prefetch(bufs, locs, s) + + +def _do_single_discard_prefetch_py(Buffer buf, location: Device | Host | None, stream: Stream | GraphBuilder | None) -> None: + """Internal: single-buffer discard+prefetch for + ManagedBuffer.discard_prefetch().""" + _require_managed_buffer(buf, "discard_prefetch") + cdef object loc = _coerce_location(location, allow_none=False) + cdef Stream s = Stream_accept(stream) + cdef tuple bufs = (buf,) + cdef tuple locs = (loc,) + _do_batch_discard_prefetch(bufs, locs, s) + + +cdef void _do_batch_discard_prefetch(tuple bufs, tuple locs, Stream s): + IF CUDA_CORE_BUILD_MAJOR >= 13: + _do_batch_prefetch_op(bufs, locs, s, cydriver.cuMemDiscardAndPrefetchBatchAsync) + ELSE: + raise NotImplementedError( + "discard_prefetch requires a CUDA 13 build of cuda.core" + ) diff --git a/cuda_core/cuda/core/_memory/_managed_memory_resource.pxd b/cuda_core/cuda/core/_memory/_managed_memory_resource.pxd new file mode 100644 index 00000000000..8dd0bbbeb1d --- /dev/null +++ b/cuda_core/cuda/core/_memory/_managed_memory_resource.pxd @@ -0,0 +1,11 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from cuda.core._memory._memory_pool cimport _MemPool + + +cdef class ManagedMemoryResource(_MemPool): + cdef: + str _pref_loc_type + int _pref_loc_id diff --git a/cuda_core/cuda/core/_memory/_managed_memory_resource.pyi b/cuda_core/cuda/core/_memory/_managed_memory_resource.pyi new file mode 100644 index 00000000000..7f3f584e5ca --- /dev/null +++ b/cuda_core/cuda/core/_memory/_managed_memory_resource.pyi @@ -0,0 +1,133 @@ +# This file was generated by stubgen-pyx v0.2.6 from cuda_core/cuda/core/_memory/_managed_memory_resource.pyx + +from __future__ import annotations + +from dataclasses import dataclass + +from cuda.core._memory._managed_buffer import ManagedBuffer +from cuda.core._memory._memory_pool import _MemPool +from cuda.core._stream import Stream +from cuda.core.graph import GraphBuilder +from cuda.core.typing import ManagedMemoryLocationType + + +@dataclass +class ManagedMemoryResourceOptions: + """Customizable :obj:`~_memory.ManagedMemoryResource` options. + + Attributes + ---------- + preferred_location : int | None, optional + A location identifier (device ordinal or NUMA node ID) whose + meaning depends on ``preferred_location_type``. + (Default to ``None``) + + preferred_location_type : ManagedMemoryLocationType | str | None, optional + Controls how ``preferred_location`` is interpreted. + + When set to ``None`` (the default), legacy behavior is used: + ``preferred_location`` is interpreted as a device ordinal, + ``-1`` for host, or ``None`` for no preference. + + When set explicitly, the type determines both the kind of + preferred location and the valid values for + ``preferred_location``: + + - ``"device"``: prefer a specific GPU. ``preferred_location`` + must be a device ordinal (``>= 0``). + - ``"host"``: prefer host memory (OS-managed NUMA placement). + ``preferred_location`` must be ``None``. + - ``"host_numa"``: prefer a specific host NUMA node. + ``preferred_location`` must be a NUMA node ID (``>= 0``), + or ``None`` to derive the NUMA node from the current CUDA + device's ``host_numa_id`` attribute (requires an active + CUDA context). + + (Default to ``None``) + """ + preferred_location: int | None = None + preferred_location_type: ManagedMemoryLocationType | str | None = None + +class ManagedMemoryResource(_MemPool): + """ + A managed memory resource managing a stream-ordered memory pool. + + Managed memory is accessible from both the host and device, with automatic + migration between them as needed. + + Parameters + ---------- + options : ManagedMemoryResourceOptions + Memory resource creation options. + + If set to `None`, the memory resource uses the driver's current + stream-ordered memory pool. If no memory pool is set as current, + the driver's default memory pool is used. + + If not set to `None`, a new memory pool is created, which is owned by + the memory resource. + + When using an existing (current or default) memory pool, the returned + managed memory resource does not own the pool (`is_handle_owned` is + `False`), and closing the resource has no effect. + + Notes + ----- + IPC (Inter-Process Communication) is not currently supported for managed + memory pools. + """ + + def __init__(self, options: ManagedMemoryResourceOptions | dict[str, object] | None=None) -> None: + ... + + def allocate(self, size: int, *, stream: Stream | GraphBuilder) -> ManagedBuffer: + """Allocate a managed-memory buffer of the requested size. + + Parameters + ---------- + size : int + The size of the buffer to allocate, in bytes. + stream : :obj:`~_stream.Stream` + Keyword-only. The stream on which to perform the allocation + asynchronously. Must be passed explicitly; pass + ``device.default_stream`` to use the default stream. + + Returns + ------- + ManagedBuffer + A :class:`ManagedBuffer` (a :class:`Buffer` subclass) that + exposes the property-style advice API + (``read_mostly``, ``preferred_location``, ``accessed_by``) + and instance methods (``prefetch``, ``discard``, + ``discard_prefetch``). + """ + + @property + def device_id(self) -> int: + """The preferred device ordinal, or -1 if the preferred location is not a device.""" + + @property + def preferred_location(self) -> tuple[ManagedMemoryLocationType, int | None] | None: + """The preferred location for managed memory allocations. + + Returns ``None`` if no preferred location is set (driver decides), + or a tuple ``(type, id)`` where *type* is one of ``"device"``, + ``"host"``, or ``"host_numa"``, and *id* is the device ordinal, + ``None`` (for ``"host"``), or the NUMA node ID, respectively. + """ + + @property + def is_device_accessible(self) -> bool: + """Return True. This memory resource provides device-accessible buffers.""" + + @property + def is_host_accessible(self) -> bool: + """Return True. This memory resource provides host-accessible buffers.""" + + @property + def is_managed(self) -> bool: + """Return True. This memory resource provides managed (unified) memory buffers.""" +__all__ = ['ManagedMemoryResource', 'ManagedMemoryResourceOptions'] + +def reset_concurrent_access_warning() -> None: + """Reset the concurrent access warning flag for testing purposes.""" \ No newline at end of file diff --git a/cuda_core/cuda/core/_memory/_managed_memory_resource.pyx b/cuda_core/cuda/core/_memory/_managed_memory_resource.pyx new file mode 100644 index 00000000000..d5a637a7b50 --- /dev/null +++ b/cuda_core/cuda/core/_memory/_managed_memory_resource.pyx @@ -0,0 +1,340 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from __future__ import annotations + +from cuda.bindings cimport cydriver + +from cuda.core._memory._memory_pool cimport _MemPool, _MP_allocate +from cuda.core._memory._memory_pool cimport MP_init_create_pool, MP_init_current_pool # no-cython-lint +from cuda.core._stream cimport Stream, Stream_accept +from cuda.core._utils.cuda_utils cimport HANDLE_RETURN +from cuda.core._utils.cuda_utils cimport check_or_create_options # no-cython-lint +from cuda.core._utils.cuda_utils import CUDAError # no-cython-lint + +from dataclasses import dataclass +import threading +from typing import TYPE_CHECKING +import warnings + +from cuda.core._memory._managed_buffer import ManagedBuffer +from cuda.core.typing import ManagedMemoryLocationType + +IF CUDA_CORE_BUILD_MAJOR >= 13: + from cuda.core._utils.validators import check_str_enum + +if TYPE_CHECKING: + from cuda.core.graph import GraphBuilder + +__all__ = ['ManagedMemoryResource', 'ManagedMemoryResourceOptions'] + + +@dataclass +cdef class ManagedMemoryResourceOptions: + """Customizable :obj:`~_memory.ManagedMemoryResource` options. + + Attributes + ---------- + preferred_location : int | None, optional + A location identifier (device ordinal or NUMA node ID) whose + meaning depends on ``preferred_location_type``. + (Default to ``None``) + + preferred_location_type : ManagedMemoryLocationType | str | None, optional + Controls how ``preferred_location`` is interpreted. + + When set to ``None`` (the default), legacy behavior is used: + ``preferred_location`` is interpreted as a device ordinal, + ``-1`` for host, or ``None`` for no preference. + + When set explicitly, the type determines both the kind of + preferred location and the valid values for + ``preferred_location``: + + - ``"device"``: prefer a specific GPU. ``preferred_location`` + must be a device ordinal (``>= 0``). + - ``"host"``: prefer host memory (OS-managed NUMA placement). + ``preferred_location`` must be ``None``. + - ``"host_numa"``: prefer a specific host NUMA node. + ``preferred_location`` must be a NUMA node ID (``>= 0``), + or ``None`` to derive the NUMA node from the current CUDA + device's ``host_numa_id`` attribute (requires an active + CUDA context). + + (Default to ``None``) + """ + preferred_location: int | None = None + preferred_location_type: ManagedMemoryLocationType | str | None = None + + +cdef class ManagedMemoryResource(_MemPool): + """ + A managed memory resource managing a stream-ordered memory pool. + + Managed memory is accessible from both the host and device, with automatic + migration between them as needed. + + Parameters + ---------- + options : ManagedMemoryResourceOptions + Memory resource creation options. + + If set to `None`, the memory resource uses the driver's current + stream-ordered memory pool. If no memory pool is set as current, + the driver's default memory pool is used. + + If not set to `None`, a new memory pool is created, which is owned by + the memory resource. + + When using an existing (current or default) memory pool, the returned + managed memory resource does not own the pool (`is_handle_owned` is + `False`), and closing the resource has no effect. + + Notes + ----- + IPC (Inter-Process Communication) is not currently supported for managed + memory pools. + """ + + def __init__(self, options: ManagedMemoryResourceOptions | dict[str, object] | None = None) -> None: + _MMR_init(self, options) + + def allocate(self, size_t size, *, stream: Stream | GraphBuilder) -> ManagedBuffer: + """Allocate a managed-memory buffer of the requested size. + + Parameters + ---------- + size : int + The size of the buffer to allocate, in bytes. + stream : :obj:`~_stream.Stream` + Keyword-only. The stream on which to perform the allocation + asynchronously. Must be passed explicitly; pass + ``device.default_stream`` to use the default stream. + + Returns + ------- + ManagedBuffer + A :class:`ManagedBuffer` (a :class:`Buffer` subclass) that + exposes the property-style advice API + (``read_mostly``, ``preferred_location``, ``accessed_by``) + and instance methods (``prefetch``, ``discard``, + ``discard_prefetch``). + """ + assert isinstance(stream, Stream), "Only Stream is supported for managed memory allocations" + if self.is_mapped: + raise TypeError("Cannot allocate from a mapped IPC-enabled memory resource") + cdef Stream s = Stream_accept(stream) + return _MP_allocate(self, size, s, ManagedBuffer) + + @property + def device_id(self) -> int: + """The preferred device ordinal, or -1 if the preferred location is not a device.""" + if self._pref_loc_type == "device": + return self._pref_loc_id + return -1 + + @property + def preferred_location(self) -> tuple[ManagedMemoryLocationType, int | None] | None: + """The preferred location for managed memory allocations. + + Returns ``None`` if no preferred location is set (driver decides), + or a tuple ``(type, id)`` where *type* is one of ``"device"``, + ``"host"``, or ``"host_numa"``, and *id* is the device ordinal, + ``None`` (for ``"host"``), or the NUMA node ID, respectively. + """ + if self._pref_loc_type is None: + return None + if self._pref_loc_type == "host": + return (ManagedMemoryLocationType.HOST, None) + return (ManagedMemoryLocationType(self._pref_loc_type), self._pref_loc_id) + + @property + def is_device_accessible(self) -> bool: + """Return True. This memory resource provides device-accessible buffers.""" + return True + + @property + def is_host_accessible(self) -> bool: + """Return True. This memory resource provides host-accessible buffers.""" + return True + + @property + def is_managed(self) -> bool: + """Return True. This memory resource provides managed (unified) memory buffers.""" + return True + + +IF CUDA_CORE_BUILD_MAJOR >= 13: + cdef _resolve_preferred_location(ManagedMemoryResourceOptions opts): + """Resolve preferred location options into driver and stored values. + + Returns a 4-tuple: + (CUmemLocationType, loc_id, pref_loc_type_str, pref_loc_id) + """ + cdef object pref_loc = opts.preferred_location if opts is not None else None + cdef object pref_type = opts.preferred_location_type if opts is not None else None + + check_str_enum(pref_type, ManagedMemoryLocationType, allow_none=True) + + if pref_type is None: + # Legacy behavior + if pref_loc is None: + return ( + cydriver.CUmemLocationType.CU_MEM_LOCATION_TYPE_NONE, + -1, None, -1, + ) + if pref_loc == -1: + return ( + cydriver.CUmemLocationType.CU_MEM_LOCATION_TYPE_HOST, + -1, "host", -1, + ) + if pref_loc < 0: + raise ValueError( + f"preferred_location must be a device ordinal (>= 0), -1 for " + f"host, or None for no preference, got {pref_loc}" + ) + return ( + cydriver.CUmemLocationType.CU_MEM_LOCATION_TYPE_DEVICE, + pref_loc, "device", pref_loc, + ) + + if pref_type == "device": + if pref_loc is None or pref_loc < 0: + raise ValueError( + f"preferred_location must be a device ordinal (>= 0) when " + f"preferred_location_type is 'device', got {pref_loc!r}" + ) + return ( + cydriver.CUmemLocationType.CU_MEM_LOCATION_TYPE_DEVICE, + pref_loc, "device", pref_loc, + ) + + if pref_type == "host": + if pref_loc is not None: + raise ValueError( + f"preferred_location must be None when " + f"preferred_location_type is 'host', got {pref_loc!r}" + ) + return ( + cydriver.CUmemLocationType.CU_MEM_LOCATION_TYPE_HOST, + -1, "host", -1, + ) + + # pref_type == "host_numa" + if pref_loc is None: + from .._device import Device + dev = Device() + numa_id = dev.properties.host_numa_id + if numa_id < 0: + raise RuntimeError( + "Cannot determine host NUMA ID for the current CUDA device. " + "The system may not support NUMA, or no CUDA context is " + "active. Set preferred_location to an explicit NUMA node ID " + "or call Device.set_current() first." + ) + return ( + cydriver.CUmemLocationType.CU_MEM_LOCATION_TYPE_HOST_NUMA, + numa_id, "host_numa", numa_id, + ) + if pref_loc < 0: + raise ValueError( + f"preferred_location must be a NUMA node ID (>= 0) or None " + f"when preferred_location_type is 'host_numa', got {pref_loc}" + ) + return ( + cydriver.CUmemLocationType.CU_MEM_LOCATION_TYPE_HOST_NUMA, + pref_loc, "host_numa", pref_loc, + ) + + +cdef inline _MMR_init(ManagedMemoryResource self, options): + IF CUDA_CORE_BUILD_MAJOR >= 13: + cdef ManagedMemoryResourceOptions opts = check_or_create_options( + ManagedMemoryResourceOptions, options, "ManagedMemoryResource options", + keep_none=True + ) + cdef cydriver.CUmemLocationType loc_type + cdef int loc_id + + loc_type, loc_id, self._pref_loc_type, self._pref_loc_id = ( + _resolve_preferred_location(opts) + ) + + if opts is None: + try: + MP_init_current_pool( + self, + loc_type, + loc_id, + cydriver.CUmemAllocationType.CU_MEM_ALLOCATION_TYPE_MANAGED, + ) + except CUDAError as e: + if "CUDA_ERROR_NOT_SUPPORTED" in str(e): + from .._device import Device + if not Device().properties.concurrent_managed_access: + raise RuntimeError( + "The default memory pool on this device does not support " + "managed allocations (concurrent managed access is not " + "available). Use " + "ManagedMemoryResource(options=ManagedMemoryResourceOptions(...)) " + "to create a dedicated managed pool." + ) from e + raise + else: + MP_init_create_pool( + self, + loc_type, + loc_id, + cydriver.CUmemAllocationType.CU_MEM_ALLOCATION_TYPE_MANAGED, + False, + 0, + ) + + _check_concurrent_managed_access() + ELSE: + raise RuntimeError("ManagedMemoryResource requires CUDA 13.0 or later") + + +cdef bint _concurrent_access_warned = False +cdef object _concurrent_access_lock = threading.Lock() + + +cdef inline _check_concurrent_managed_access(): + """Warn once if the platform lacks concurrent managed memory access.""" + global _concurrent_access_warned + if _concurrent_access_warned: + return + + cdef int c_concurrent = 0 + with _concurrent_access_lock: + if _concurrent_access_warned: + return + + # concurrent_managed_access is a system-level attribute for sm_60 and + # later, so any device will do. + with nogil: + HANDLE_RETURN(cydriver.cuDeviceGetAttribute( + &c_concurrent, + cydriver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS, + 0)) + if not c_concurrent: + warnings.warn( + "This platform does not support concurrent managed memory access " + "(Device.properties.concurrent_managed_access is False). Host access to any managed " + "allocation is forbidden while any GPU kernel is in flight, even " + "if the kernel does not touch that allocation. Failing to " + "synchronize before host access will cause a segfault. " + "See: https://docs.nvidia.com/cuda/cuda-c-programming-guide/" + "index.html#gpu-exclusive-access-to-managed-memory", + UserWarning, + stacklevel=3 + ) + + _concurrent_access_warned = True + + +def reset_concurrent_access_warning() -> None: + """Reset the concurrent access warning flag for testing purposes.""" + global _concurrent_access_warned + _concurrent_access_warned = False diff --git a/cuda_core/cuda/core/_memory/_memory_pool.pxd b/cuda_core/cuda/core/_memory/_memory_pool.pxd new file mode 100644 index 00000000000..3a6c3107cfd --- /dev/null +++ b/cuda_core/cuda/core/_memory/_memory_pool.pxd @@ -0,0 +1,43 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from cuda.bindings cimport cydriver +from cuda.core._memory._buffer cimport Buffer, MemoryResource +from cuda.core._memory._ipc cimport IPCDataForMR +from cuda.core._resource_handles cimport MemoryPoolHandle +from cuda.core._stream cimport Stream + + +cdef class _MemPool(MemoryResource): + cdef: + MemoryPoolHandle _h_pool + bint _mempool_owned + IPCDataForMR _ipc_data + object _attributes + object __weakref__ + + +cdef int MP_init_create_pool( + _MemPool self, + cydriver.CUmemLocationType loc_type, + int loc_id, + cydriver.CUmemAllocationType alloc_type, + bint ipc_enabled, + size_t max_size, +) except? -1 + +cdef int MP_init_current_pool( + _MemPool self, + cydriver.CUmemLocationType loc_type, + int loc_id, + cydriver.CUmemAllocationType alloc_type, +) except? -1 + +cdef int MP_raise_release_threshold(_MemPool self) except? -1 + + +# Allocate from this pool, returning an instance of `cls` (defaulting to +# Buffer). Subclasses (e.g. ManagedMemoryResource) pass their own buffer +# subclass so their `allocate` returns the typed object. +cdef Buffer _MP_allocate(_MemPool self, size_t size, Stream stream, type cls = *) diff --git a/cuda_core/cuda/core/_memory/_memory_pool.pyi b/cuda_core/cuda/core/_memory/_memory_pool.pyi new file mode 100644 index 00000000000..7f8c64aedda --- /dev/null +++ b/cuda_core/cuda/core/_memory/_memory_pool.pyi @@ -0,0 +1,129 @@ +# This file was generated by stubgen-pyx v0.2.6 from cuda_core/cuda/core/_memory/_memory_pool.pyx + +from __future__ import annotations + +import uuid + +import cython +from cuda.core._memory._buffer import Buffer, MemoryResource +from cuda.core._stream import Stream +from cuda.core.graph import GraphBuilder +from cuda.core.typing import DevicePointerType + + +class _MemPoolAttributes: + """Provides access to memory pool attributes.""" + + def __init__(self, *args, **kwargs) -> None: + ... + + def __repr__(self) -> str: + ... + + @property + def reuse_follow_event_dependencies(self) -> bool: + """Allow memory to be reused when there are event dependencies between streams.""" + + @property + def reuse_allow_opportunistic(self) -> bool: + """Allow reuse of completed frees without dependencies.""" + + @property + def reuse_allow_internal_dependencies(self) -> bool: + """Allow insertion of new stream dependencies for memory reuse.""" + + @property + def release_threshold(self) -> int: + """Amount of reserved memory to hold before OS release.""" + + @property + def reserved_mem_current(self) -> int: + """Current amount of backing memory allocated.""" + + @property + def reserved_mem_high(self) -> int: + """High watermark of backing memory allocated.""" + + @property + def used_mem_current(self) -> int: + """Current amount of memory in use.""" + + @property + def used_mem_high(self) -> int: + """High watermark of memory in use.""" + +class _MemPool(MemoryResource): + + def __cinit__(self) -> None: + ... + + def close(self) -> None: + """ + Close the memory resource and destroy the associated memory pool + if owned. + """ + + def allocate(self, size: int, *, stream: Stream | GraphBuilder) -> Buffer: + """Allocate a buffer of the requested size. + + Parameters + ---------- + size : int + The size of the buffer to allocate, in bytes. + stream : :obj:`~_stream.Stream` | :obj:`~graph.GraphBuilder` + Keyword-only. The stream on which to perform the allocation + asynchronously. Must be passed explicitly; pass + ``device.default_stream`` to use the default stream. + + Returns + ------- + Buffer + The allocated buffer object, which is accessible on the device that this memory + resource was created for. + """ + + def deallocate(self, ptr: DevicePointerType, size: int, *, stream: Stream | GraphBuilder) -> None: + """Deallocate a buffer previously allocated by this resource. + + Parameters + ---------- + ptr : :obj:`~_memory.DevicePointerType` + The pointer or handle to the buffer to deallocate. + size : int + The size of the buffer to deallocate, in bytes. + stream : :obj:`~_stream.Stream` | :obj:`~graph.GraphBuilder` + Keyword-only. The stream on which to perform the deallocation + asynchronously. Must be passed explicitly; pass + ``device.default_stream`` to use the default stream. + """ + + @property + @cython.critical_section + def attributes(self) -> _MemPoolAttributes: + """Memory pool attributes.""" + + @property + def handle(self) -> object: + """Handle to the underlying memory pool.""" + + @property + def is_handle_owned(self) -> bool: + """Whether the memory resource handle is owned. If False, ``close`` has no effect.""" + + @property + def is_ipc_enabled(self) -> bool: + """Whether this memory resource has IPC enabled.""" + + @property + def is_mapped(self) -> bool: + """ + Whether this is a mapping of an IPC-enabled memory resource from + another process. If True, allocation is not permitted. + """ + + @property + def uuid(self) -> uuid.UUID | None: + """ + A universally unique identifier for this memory resource. Meaningful + only for IPC-enabled memory resources. + """ \ No newline at end of file diff --git a/cuda_core/cuda/core/_memory/_memory_pool.pyx b/cuda_core/cuda/core/_memory/_memory_pool.pyx new file mode 100644 index 00000000000..cf7c48068f1 --- /dev/null +++ b/cuda_core/cuda/core/_memory/_memory_pool.pyx @@ -0,0 +1,367 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from __future__ import annotations + +cimport cython +from libc.limits cimport ULLONG_MAX +from libc.stdint cimport uintptr_t +from libc.string cimport memset + +from cuda.bindings cimport cydriver +from cuda.core._memory._buffer cimport Buffer, Buffer_from_deviceptr_handle, MemoryResource +from cuda.core._memory cimport _ipc +from cuda.core._stream cimport Stream_accept, Stream +from cuda.core._resource_handles cimport ( + MemoryPoolHandle, + DevicePtrHandle, + create_mempool_handle, + deviceptr_alloc_from_pool, + get_last_error, + as_cu, + as_py, +) +from cuda.core._resource_handles cimport create_mempool_handle_ref # no-cython-lint + +from cuda.core._utils.cuda_utils cimport ( + HANDLE_RETURN, +) + +import uuid +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from cuda.core.graph import GraphBuilder + from cuda.core.typing import DevicePointerType + + +cdef class _MemPoolAttributes: + """Provides access to memory pool attributes.""" + cdef: + MemoryPoolHandle _h_pool + + def __init__(self, *args, **kwargs) -> None: + raise RuntimeError("_MemPoolAttributes cannot be instantiated directly. Please use MemoryResource APIs.") + + @staticmethod + cdef _MemPoolAttributes _init(MemoryPoolHandle h_pool): + cdef _MemPoolAttributes self = _MemPoolAttributes.__new__(_MemPoolAttributes) + self._h_pool = h_pool + return self + + def __repr__(self) -> str: + return f"{self.__class__.__name__}(%s)" % ", ".join( + f"{attr}={getattr(self, attr)}" for attr in dir(self) + if not attr.startswith("_") + ) + + cdef int _getattribute(self, cydriver.CUmemPool_attribute attr_enum, void* value) except?-1: + with nogil: + HANDLE_RETURN(cydriver.cuMemPoolGetAttribute(as_cu(self._h_pool), attr_enum, value)) + return 0 + + @property + def reuse_follow_event_dependencies(self) -> bool: + """Allow memory to be reused when there are event dependencies between streams.""" + cdef int value + self._getattribute(cydriver.CUmemPool_attribute.CU_MEMPOOL_ATTR_REUSE_FOLLOW_EVENT_DEPENDENCIES, &value) + return bool(value) + + @property + def reuse_allow_opportunistic(self) -> bool: + """Allow reuse of completed frees without dependencies.""" + cdef int value + self._getattribute(cydriver.CUmemPool_attribute.CU_MEMPOOL_ATTR_REUSE_ALLOW_OPPORTUNISTIC, &value) + return bool(value) + + @property + def reuse_allow_internal_dependencies(self) -> bool: + """Allow insertion of new stream dependencies for memory reuse.""" + cdef int value + self._getattribute(cydriver.CUmemPool_attribute.CU_MEMPOOL_ATTR_REUSE_ALLOW_INTERNAL_DEPENDENCIES, &value) + return bool(value) + + @property + def release_threshold(self) -> int: + """Amount of reserved memory to hold before OS release.""" + cdef cydriver.cuuint64_t value + self._getattribute(cydriver.CUmemPool_attribute.CU_MEMPOOL_ATTR_RELEASE_THRESHOLD, &value) + return int(value) + + @property + def reserved_mem_current(self) -> int: + """Current amount of backing memory allocated.""" + cdef cydriver.cuuint64_t value + self._getattribute(cydriver.CUmemPool_attribute.CU_MEMPOOL_ATTR_RESERVED_MEM_CURRENT, &value) + return int(value) + + @property + def reserved_mem_high(self) -> int: + """High watermark of backing memory allocated.""" + cdef cydriver.cuuint64_t value + self._getattribute(cydriver.CUmemPool_attribute.CU_MEMPOOL_ATTR_RESERVED_MEM_HIGH, &value) + return int(value) + + @property + def used_mem_current(self) -> int: + """Current amount of memory in use.""" + cdef cydriver.cuuint64_t value + self._getattribute(cydriver.CUmemPool_attribute.CU_MEMPOOL_ATTR_USED_MEM_CURRENT, &value) + return int(value) + + @property + def used_mem_high(self) -> int: + """High watermark of memory in use.""" + cdef cydriver.cuuint64_t value + self._getattribute(cydriver.CUmemPool_attribute.CU_MEMPOOL_ATTR_USED_MEM_HIGH, &value) + return int(value) + + +cdef class _MemPool(MemoryResource): + + def __cinit__(self) -> None: + # Note: subclasses use MP_init_create_pool or MP_init_current_pool to initialize. + self._mempool_owned = False + self._ipc_data = None + self._attributes = None + + def close(self) -> None: + """ + Close the memory resource and destroy the associated memory pool + if owned. + """ + _MP_close(self) + + def allocate(self, size_t size, *, stream: Stream | GraphBuilder) -> Buffer: + """Allocate a buffer of the requested size. + + Parameters + ---------- + size : int + The size of the buffer to allocate, in bytes. + stream : :obj:`~_stream.Stream` | :obj:`~graph.GraphBuilder` + Keyword-only. The stream on which to perform the allocation + asynchronously. Must be passed explicitly; pass + ``device.default_stream`` to use the default stream. + + Returns + ------- + Buffer + The allocated buffer object, which is accessible on the device that this memory + resource was created for. + """ + if self.is_mapped: + raise TypeError("Cannot allocate from a mapped IPC-enabled memory resource") + cdef Stream s = Stream_accept(stream) + return _MP_allocate(self, size, s) + + def deallocate( + self, + ptr: DevicePointerType, + size_t size, + *, + stream: Stream | GraphBuilder + ) -> None: + """Deallocate a buffer previously allocated by this resource. + + Parameters + ---------- + ptr : :obj:`~_memory.DevicePointerType` + The pointer or handle to the buffer to deallocate. + size : int + The size of the buffer to deallocate, in bytes. + stream : :obj:`~_stream.Stream` | :obj:`~graph.GraphBuilder` + Keyword-only. The stream on which to perform the deallocation + asynchronously. Must be passed explicitly; pass + ``device.default_stream`` to use the default stream. + """ + cdef Stream s = Stream_accept(stream) + _MP_deallocate(self, ptr, size, s) + + @property + @cython.critical_section + def attributes(self) -> _MemPoolAttributes: + """Memory pool attributes.""" + if self._attributes is None: + self._attributes = _MemPoolAttributes._init(self._h_pool) + return self._attributes + + @property + def handle(self) -> object: + """Handle to the underlying memory pool.""" + return as_py(self._h_pool) + + @property + def is_handle_owned(self) -> bool: + """Whether the memory resource handle is owned. If False, ``close`` has no effect.""" + return self._mempool_owned + + @property + def is_ipc_enabled(self) -> bool: + """Whether this memory resource has IPC enabled.""" + return self._ipc_data is not None + + @property + def is_mapped(self) -> bool: + """ + Whether this is a mapping of an IPC-enabled memory resource from + another process. If True, allocation is not permitted. + """ + return self._ipc_data is not None and self._ipc_data._is_mapped + + @property + def uuid(self) -> uuid.UUID | None: + """ + A universally unique identifier for this memory resource. Meaningful + only for IPC-enabled memory resources. + """ + return getattr(self._ipc_data, 'uuid', None) + + +cdef int MP_init_create_pool( + _MemPool self, + cydriver.CUmemLocationType loc_type, + int loc_id, + cydriver.CUmemAllocationType alloc_type, + bint ipc_enabled, + size_t max_size, +) except? -1: + """Initialize a _MemPool by creating a new memory pool with the given + parameters. + + Sets ``_h_pool`` (owning), ``_mempool_owned``, and ``_ipc_data``. + """ + cdef cydriver.CUmemPoolProps properties + memset(&properties, 0, sizeof(cydriver.CUmemPoolProps)) + + properties.allocType = alloc_type + properties.handleTypes = ( + _ipc.IPC_HANDLE_TYPE if ipc_enabled + else cydriver.CUmemAllocationHandleType.CU_MEM_HANDLE_TYPE_NONE + ) + properties.location.id = loc_id + properties.location.type = loc_type + properties.maxSize = max_size + + self._mempool_owned = True + self._h_pool = create_mempool_handle(properties) + if not self._h_pool: + HANDLE_RETURN(get_last_error()) + raise RuntimeError( + f"Failed to initialize {self.__class__.__name__}: " + "cuda-core returned an empty memory pool handle without recording a CUDA error. " + "This is an internal cuda-core error; please report it with your CUDA driver, " + "CUDA Toolkit, and cuda-python versions." + ) + + if ipc_enabled: + alloc_handle = _ipc.MP_export_mempool(self) + self._ipc_data = _ipc.IPCDataForMR(alloc_handle, False) + + return 0 + + +cdef int MP_init_current_pool( + _MemPool self, + cydriver.CUmemLocationType loc_type, + int loc_id, + cydriver.CUmemAllocationType alloc_type, +) except? -1: + """Initialize a _MemPool by getting the driver's current pool for a + location and allocation type. + + Sets ``_h_pool`` (non-owning) via ``cuMemGetMemPool``. + Requires CUDA 13+. + """ + IF CUDA_CORE_BUILD_MAJOR >= 13: + cdef cydriver.CUmemLocation loc + cdef cydriver.CUmemoryPool pool + loc.id = loc_id + loc.type = loc_type + with nogil: + HANDLE_RETURN(cydriver.cuMemGetMemPool(&pool, &loc, alloc_type)) + self._h_pool = create_mempool_handle_ref(pool) + self._mempool_owned = False + ELSE: + raise RuntimeError( + "Getting the current memory pool requires CUDA 13.0 or later" + ) + return 0 + + +cdef int MP_raise_release_threshold(_MemPool self) except? -1: + """Raise the pool's release threshold to ULLONG_MAX if currently zero. + + By default the release threshold is 0, meaning memory is returned to + the OS as soon as there are no active suballocations. Setting it to + ULLONG_MAX avoids repeated OS round-trips. + """ + cdef cydriver.cuuint64_t current_threshold + cdef cydriver.cuuint64_t max_threshold = ULLONG_MAX + with nogil: + HANDLE_RETURN( + cydriver.cuMemPoolGetAttribute( + as_cu(self._h_pool), + cydriver.CUmemPool_attribute.CU_MEMPOOL_ATTR_RELEASE_THRESHOLD, + ¤t_threshold + ) + ) + if current_threshold == 0: + HANDLE_RETURN(cydriver.cuMemPoolSetAttribute( + as_cu(self._h_pool), + cydriver.CUmemPool_attribute.CU_MEMPOOL_ATTR_RELEASE_THRESHOLD, + &max_threshold + )) + return 0 + + +# Raise an exception if the given stream is capturing. +# A result of CU_STREAM_CAPTURE_STATUS_INVALIDATED is considered an error. +cdef inline int check_not_capturing(cydriver.CUstream s) except?-1 nogil: + cdef cydriver.CUstreamCaptureStatus capturing + HANDLE_RETURN(cydriver.cuStreamIsCapturing(s, &capturing)) + if capturing != cydriver.CUstreamCaptureStatus.CU_STREAM_CAPTURE_STATUS_NONE: + raise RuntimeError("_MemPool cannot perform memory operations on " + "a capturing stream (consider using GraphMemoryResource).") + + +cdef Buffer _MP_allocate(_MemPool self, size_t size, Stream stream, type cls = Buffer): + cdef cydriver.CUstream s = as_cu(stream._h_stream) + cdef DevicePtrHandle h_ptr + with nogil: + check_not_capturing(s) + h_ptr = deviceptr_alloc_from_pool(size, self._h_pool, stream._h_stream) + if not h_ptr: + HANDLE_RETURN(get_last_error()) + raise RuntimeError( + f"Failed to allocate {size} bytes from {self.__class__.__name__}: " + "cuda-core returned an empty allocation handle without recording a CUDA error. " + "This is an internal cuda-core error; please report it with your CUDA driver, " + "CUDA Toolkit, and cuda-python versions." + ) + return Buffer_from_deviceptr_handle(h_ptr, size, self, None, cls) + + +cdef inline void _MP_deallocate( + _MemPool self, uintptr_t ptr, size_t size, Stream stream +) noexcept nogil: + cdef cydriver.CUstream s = as_cu(stream._h_stream) + cdef cydriver.CUdeviceptr devptr = ptr + cdef cydriver.CUresult r + with nogil: + r = cydriver.cuMemFreeAsync(devptr, s) + if r != cydriver.CUDA_ERROR_INVALID_CONTEXT: + HANDLE_RETURN(r) + + +cdef inline _MP_close(_MemPool self): + if not self._h_pool: + return + + # Reset members in declaration order. + # The RAII deleter calls cuMemPoolDestroy if this is an owning handle. + self._h_pool.reset() + self._mempool_owned = False + self._ipc_data = None + self._attributes = None diff --git a/cuda_core/cuda/core/_memory/_peer_access_utils.pyi b/cuda_core/cuda/core/_memory/_peer_access_utils.pyi new file mode 100644 index 00000000000..fa2b5c490a4 --- /dev/null +++ b/cuda_core/cuda/core/_memory/_peer_access_utils.pyi @@ -0,0 +1,138 @@ +# This file was generated by stubgen-pyx v0.2.6 from cuda_core/cuda/core/_memory/_peer_access_utils.pyx + +from __future__ import annotations + +from collections.abc import Callable, Iterable, Iterator, Set +from dataclasses import dataclass +from typing import Any + +from cuda.core._device import Device +from cuda.core._memory._device_memory_resource import DeviceMemoryResource + + +@dataclass(frozen=True) +class PeerAccessPlan: + """Normalized peer-access target state and the driver updates it requires.""" + target_ids: tuple[int, ...] + to_add: tuple[int, ...] + to_remove: tuple[int, ...] + +class PeerAccessibleBySetProxy: + """Live driver-backed view of the peer devices granted access to a memory pool. + + Reads (``__contains__``, ``__iter__``, ``len(...)``) call ``cuMemPoolGetAccess``; + writes (``add``, ``discard``, and bulk ops) call ``cuMemPoolSetAccess``. There + is no in-memory mirror, so the view always reflects the current driver state + and stays consistent across multiple wrappers around the same pool. + + Iteration yields :class:`~cuda.core.Device` objects. ``add``, ``discard``, and + ``__contains__`` accept either a :class:`~cuda.core.Device` or a device-ordinal + ``int``; the owner device is silently ignored when supplied. + + All bulk operations (``update``, ``|=``, ``&=``, ``-=``, ``^=``, ``clear``) + issue exactly one ``cuMemPoolSetAccess`` call. This matters: peer-access + transitions can take seconds per pool because every existing memory mapping + is updated, so coalescing into a single driver call lets the toolkit handle + the mappings in parallel. + """ + __slots__ = ('_mr',) + + def __init__(self, mr: DeviceMemoryResource) -> None: + ... + + @classmethod + def _from_iterable(cls, it: Iterable[Device]) -> set[Device]: + ... + + def __contains__(self, value: object) -> bool: + ... + + def __iter__(self) -> Iterator[Device]: + ... + + def __len__(self) -> int: + ... + + def add(self, value: Device | int) -> None: + """Grant peer access from ``value`` to allocations in this pool.""" + + def discard(self, value: Device | int) -> None: + """Revoke peer access from ``value`` to allocations in this pool.""" + + def clear(self) -> None: + """Revoke all peer access in a single driver call.""" + + def update(self, *others: Iterable[Device | int]) -> None: + """Grant peer access to every device in ``others`` in one driver call.""" + + def difference_update(self, *others: Iterable[Device | int]) -> None: + """Revoke peer access for every device in ``others`` in one driver call.""" + + def intersection_update(self, *others: Iterable[Device | int]) -> None: + """Restrict peer access to the intersection in a single driver call.""" + + def symmetric_difference_update(self, other: Iterable[Device | int]) -> None: + """Toggle peer access for every device in ``other`` in one driver call.""" + + def __ior__(self, other: Set[Any]) -> PeerAccessibleBySetProxy: + ... + + def __iand__(self, other: Set[Any]) -> PeerAccessibleBySetProxy: + ... + + def __isub__(self, other: Set[Any]) -> PeerAccessibleBySetProxy: + ... + + def __ixor__(self, other: Set[Any]) -> PeerAccessibleBySetProxy: + ... + + def __repr__(self) -> str: + ... + + def _apply(self, additions, removals) -> None: + """Compute the diff and issue a single ``cuMemPoolSetAccess``. + + ``additions`` and ``removals`` are user-supplied (``Device | int``); + only the owner device is filtered out. Adds are validated through + :meth:`Device.can_access_peer` via :func:`plan_peer_access_update`; + removals bypass that check (revoking is always permitted). + """ + +def replace_peer_accessible_by(mr: DeviceMemoryResource, devices: object) -> None: + """Replace the full peer-access set in a single batched driver call. + + Backs the ``mr.peer_accessible_by = [...]`` setter. Uses the same planner + as the proxy's bulk ops; the only difference is that adds and removes are + derived from the symmetric difference between current driver state and the + requested target set. + """ + +def normalize_peer_access_targets(owner_device_id: int, requested_devices: Iterable[object], *, resolve_device_id: Callable[[object], int]) -> tuple[int, ...]: + """Return sorted, unique peer device IDs, excluding the owner device.""" + +def plan_peer_access_update(owner_device_id: int, current_peer_ids: Iterable[int], requested_devices: Iterable[object], *, resolve_device_id: Callable[[object], int], can_access_peer: Callable[[int], bool]) -> PeerAccessPlan: + """Compute the peer-access target state and add/remove deltas.""" + +def _resolve_peer_device_id(value: Device | int | None) -> int: + """Coerce ``Device | int`` into a device-ordinal int.""" + +def _set_pool_access(mr: object, to_add: tuple[int, ...], to_remove: tuple[int, ...]) -> None: + """Issue one ``cuMemPoolSetAccess`` for the given add/remove deltas. + + The thin Python-callable layer that wraps the actual driver call: building + the ``CUmemAccessDesc`` array and invoking ``cuMemPoolSetAccess`` happens + in here. Tests monkeypatch this on the module to spy on real driver work + without intercepting earlier no-op paths. + + Preconditions: ``len(to_add) + len(to_remove) > 0`` (the caller is + responsible for skipping empty diffs). + """ + +def _apply_peer_access_diff(mr: DeviceMemoryResource, to_add: Iterable[int], to_remove: Iterable[int]) -> None: + """Apply a peer-access diff in at most one driver call. + + Every write path on :class:`PeerAccessibleBySetProxy` and the + ``peer_accessible_by`` setter routes through this function. Empty diffs + short-circuit here so the driver-level helper :func:`_set_pool_access` is + only invoked when there is actual work for ``cuMemPoolSetAccess`` to do. + """ \ No newline at end of file diff --git a/cuda_core/cuda/core/_memory/_peer_access_utils.pyx b/cuda_core/cuda/core/_memory/_peer_access_utils.pyx new file mode 100644 index 00000000000..9a035378ecf --- /dev/null +++ b/cuda_core/cuda/core/_memory/_peer_access_utils.pyx @@ -0,0 +1,406 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from __future__ import annotations + +from collections.abc import Callable, Iterable, Iterator, MutableSet, Set +from dataclasses import dataclass +from typing import TYPE_CHECKING, Any + +from cuda.bindings cimport cydriver +from cuda.core._memory._device_memory_resource cimport DeviceMemoryResource +from cuda.core._resource_handles cimport as_cu +from cuda.core._utils.cuda_utils cimport HANDLE_RETURN +from cpython.mem cimport PyMem_Malloc, PyMem_Free +from libcpp.vector cimport vector + +if TYPE_CHECKING: + from cuda.core._device import Device + + +@dataclass(frozen=True) +class PeerAccessPlan: + """Normalized peer-access target state and the driver updates it requires.""" + + target_ids: tuple[int, ...] + to_add: tuple[int, ...] + to_remove: tuple[int, ...] + + +def normalize_peer_access_targets( + owner_device_id: int, + requested_devices: Iterable[object], + *, + resolve_device_id: Callable[[object], int], +) -> tuple[int, ...]: + """Return sorted, unique peer device IDs, excluding the owner device.""" + + target_ids = {resolve_device_id(device) for device in requested_devices} + target_ids.discard(owner_device_id) + return tuple(sorted(target_ids)) + + +def plan_peer_access_update( + owner_device_id: int, + current_peer_ids: Iterable[int], + requested_devices: Iterable[object], + *, + resolve_device_id: Callable[[object], int], + can_access_peer: Callable[[int], bool], +) -> PeerAccessPlan: + """Compute the peer-access target state and add/remove deltas.""" + + target_ids = normalize_peer_access_targets( + owner_device_id, + requested_devices, + resolve_device_id=resolve_device_id, + ) + bad = tuple(dev_id for dev_id in target_ids if not can_access_peer(dev_id)) + if bad: + bad_ids = ", ".join(str(dev_id) for dev_id in bad) + raise ValueError(f"Device {owner_device_id} cannot access peer(s): {bad_ids}") + + current_ids = set(current_peer_ids) + target_id_set = set(target_ids) + return PeerAccessPlan( + target_ids=target_ids, + to_add=tuple(sorted(target_id_set - current_ids)), + to_remove=tuple(sorted(current_ids - target_id_set)), + ) + + +def _resolve_peer_device_id(value: Device | int | None) -> int: + """Coerce ``Device | int`` into a device-ordinal int.""" + from cuda.core._device import Device + + return Device(value).device_id + + +# ---- driver-touching helpers (cdef inline, called from .pyx code) ----------- + +cdef inline tuple _query_peer_access_ids(DeviceMemoryResource mr): + """Return the current peer device IDs as a sorted tuple of ints. + + The full driver loop runs inside a single ``nogil`` block. Because + ``range(total)`` ascends, the result is already sorted. + """ + cdef int total + cdef int dev_id + cdef int owner_id = mr._dev_id + cdef cydriver.CUmemAccess_flags flags + cdef cydriver.CUmemLocation location + cdef cydriver.CUmemoryPool h_pool = as_cu(mr._h_pool) + cdef vector[int] peers + cdef size_t i, n + + location.type = cydriver.CUmemLocationType.CU_MEM_LOCATION_TYPE_DEVICE + + with nogil: + HANDLE_RETURN(cydriver.cuDeviceGetCount(&total)) + for dev_id in range(total): + if dev_id == owner_id: + continue + location.id = dev_id + HANDLE_RETURN(cydriver.cuMemPoolGetAccess(&flags, h_pool, &location)) + if flags == cydriver.CUmemAccess_flags.CU_MEM_ACCESS_FLAGS_PROT_READWRITE: + peers.push_back(dev_id) + + n = peers.size() + return tuple(peers[i] for i in range(n)) + + +cdef inline bint _peer_access_includes(DeviceMemoryResource mr, int dev_id): + """Return True if peer access from ``dev_id`` is currently granted.""" + cdef cydriver.CUmemAccess_flags flags + cdef cydriver.CUmemLocation location + + location.type = cydriver.CUmemLocationType.CU_MEM_LOCATION_TYPE_DEVICE + location.id = dev_id + with nogil: + HANDLE_RETURN(cydriver.cuMemPoolGetAccess(&flags, as_cu(mr._h_pool), &location)) + return flags == cydriver.CUmemAccess_flags.CU_MEM_ACCESS_FLAGS_PROT_READWRITE + + +def _set_pool_access(mr: object, to_add: tuple[int, ...], to_remove: tuple[int, ...]) -> None: + """Issue one ``cuMemPoolSetAccess`` for the given add/remove deltas. + + The thin Python-callable layer that wraps the actual driver call: building + the ``CUmemAccessDesc`` array and invoking ``cuMemPoolSetAccess`` happens + in here. Tests monkeypatch this on the module to spy on real driver work + without intercepting earlier no-op paths. + + Preconditions: ``len(to_add) + len(to_remove) > 0`` (the caller is + responsible for skipping empty diffs). + """ + cdef DeviceMemoryResource mr_typed = mr + cdef size_t count = len(to_add) + len(to_remove) + cdef cydriver.CUmemAccessDesc* access_desc = NULL + cdef size_t i = 0 + + access_desc = PyMem_Malloc(count * sizeof(cydriver.CUmemAccessDesc)) + if access_desc == NULL: + raise MemoryError("Failed to allocate memory for access descriptors") + + try: + for dev_id in to_add: + access_desc[i].flags = cydriver.CUmemAccess_flags.CU_MEM_ACCESS_FLAGS_PROT_READWRITE + access_desc[i].location.type = cydriver.CUmemLocationType.CU_MEM_LOCATION_TYPE_DEVICE + access_desc[i].location.id = dev_id + i += 1 + for dev_id in to_remove: + access_desc[i].flags = cydriver.CUmemAccess_flags.CU_MEM_ACCESS_FLAGS_PROT_NONE + access_desc[i].location.type = cydriver.CUmemLocationType.CU_MEM_LOCATION_TYPE_DEVICE + access_desc[i].location.id = dev_id + i += 1 + + with nogil: + HANDLE_RETURN(cydriver.cuMemPoolSetAccess(as_cu(mr_typed._h_pool), access_desc, count)) + finally: + if access_desc != NULL: + PyMem_Free(access_desc) + + +def _apply_peer_access_diff(mr: DeviceMemoryResource, to_add: Iterable[int], to_remove: Iterable[int]) -> None: + """Apply a peer-access diff in at most one driver call. + + Every write path on :class:`PeerAccessibleBySetProxy` and the + ``peer_accessible_by`` setter routes through this function. Empty diffs + short-circuit here so the driver-level helper :func:`_set_pool_access` is + only invoked when there is actual work for ``cuMemPoolSetAccess`` to do. + """ + add_tuple = tuple(to_add) + remove_tuple = tuple(to_remove) + if not add_tuple and not remove_tuple: + return + _set_pool_access(mr, add_tuple, remove_tuple) + + +cpdef void replace_peer_accessible_by(DeviceMemoryResource mr, object devices): + """Replace the full peer-access set in a single batched driver call. + + Backs the ``mr.peer_accessible_by = [...]`` setter. Uses the same planner + as the proxy's bulk ops; the only difference is that adds and removes are + derived from the symmetric difference between current driver state and the + requested target set. + """ + from cuda.core._device import Device + + this_dev = Device(mr._dev_id) + plan = plan_peer_access_update( + owner_device_id=mr._dev_id, + current_peer_ids=_query_peer_access_ids(mr), + requested_devices=devices, + resolve_device_id=_resolve_peer_device_id, + can_access_peer=this_dev.can_access_peer, + ) + _apply_peer_access_diff(mr, plan.to_add, plan.to_remove) + + +# ---- Python MutableSet proxy ------------------------------------------------ + +class PeerAccessibleBySetProxy(MutableSet["Device"]): + """Live driver-backed view of the peer devices granted access to a memory pool. + + Reads (``__contains__``, ``__iter__``, ``len(...)``) call ``cuMemPoolGetAccess``; + writes (``add``, ``discard``, and bulk ops) call ``cuMemPoolSetAccess``. There + is no in-memory mirror, so the view always reflects the current driver state + and stays consistent across multiple wrappers around the same pool. + + Iteration yields :class:`~cuda.core.Device` objects. ``add``, ``discard``, and + ``__contains__`` accept either a :class:`~cuda.core.Device` or a device-ordinal + ``int``; the owner device is silently ignored when supplied. + + All bulk operations (``update``, ``|=``, ``&=``, ``-=``, ``^=``, ``clear``) + issue exactly one ``cuMemPoolSetAccess`` call. This matters: peer-access + transitions can take seconds per pool because every existing memory mapping + is updated, so coalescing into a single driver call lets the toolkit handle + the mappings in parallel. + """ + + __slots__ = ("_mr",) + + def __init__(self, mr: DeviceMemoryResource) -> None: + self._mr = mr + + @classmethod + def _from_iterable(cls, it: Iterable[Device]) -> set[Device]: # type: ignore[override] + # Binary set operators (&, |, -, ^) collect their result through + # _from_iterable. Returning a plain set lets the user reason about + # the result independently of any pool's driver state. + return set(it) + + # --- abstract MutableSet methods --- + + def __contains__(self, value: object) -> bool: + try: + dev_id = _resolve_peer_device_id(value) + except (TypeError, ValueError): + return False + cdef DeviceMemoryResource mr = self._mr + if dev_id == mr._dev_id: + return False + return _peer_access_includes(mr, dev_id) + + def __iter__(self) -> Iterator[Device]: + from cuda.core._device import Device + + return iter(Device(dev_id) for dev_id in _query_peer_access_ids(self._mr)) + + def __len__(self) -> int: + return len(_query_peer_access_ids(self._mr)) + + def add(self, value: Device | int) -> None: + """Grant peer access from ``value`` to allocations in this pool.""" + dev_id = _resolve_peer_device_id(value) + cdef DeviceMemoryResource mr = self._mr + if dev_id == mr._dev_id: + return + if _peer_access_includes(mr, dev_id): + return + from cuda.core._device import Device + if not Device(mr._dev_id).can_access_peer(dev_id): + raise ValueError(f"Device {mr._dev_id} cannot access peer: {dev_id}") + _apply_peer_access_diff(mr, (dev_id,), ()) + + def discard(self, value: Device | int) -> None: + """Revoke peer access from ``value`` to allocations in this pool.""" + try: + dev_id = _resolve_peer_device_id(value) + except (TypeError, ValueError): + return + cdef DeviceMemoryResource mr = self._mr + if dev_id == mr._dev_id: + return + if not _peer_access_includes(mr, dev_id): + return + _apply_peer_access_diff(mr, (), (dev_id,)) + + # --- bulk overrides: one driver call per op --- + + def clear(self) -> None: + """Revoke all peer access in a single driver call.""" + self._apply((), _query_peer_access_ids(self._mr)) + + def update(self, *others: Iterable[Device | int]) -> None: + """Grant peer access to every device in ``others`` in one driver call.""" + to_add = [] + for other in others: + to_add.extend(other) + if to_add: + self._apply(to_add, ()) + + def difference_update(self, *others: Iterable[Device | int]) -> None: + """Revoke peer access for every device in ``others`` in one driver call.""" + revoke_ids = set() + for other in others: + for value in other: + try: + revoke_ids.add(_resolve_peer_device_id(value)) + except (TypeError, ValueError): + continue + current = set(_query_peer_access_ids(self._mr)) + to_remove = revoke_ids & current + if to_remove: + self._apply((), to_remove) + + def intersection_update(self, *others: Iterable[Device | int]) -> None: + """Restrict peer access to the intersection in a single driver call.""" + keep_ids = None + for other in others: + ids = set() + for value in other: + try: + ids.add(_resolve_peer_device_id(value)) + except (TypeError, ValueError): + continue + keep_ids = ids if keep_ids is None else keep_ids & ids + if keep_ids is None: + return # ``set.intersection_update()`` with no args is a no-op + current = set(_query_peer_access_ids(self._mr)) + to_remove = current - keep_ids + if to_remove: + self._apply((), to_remove) + + def symmetric_difference_update(self, other: Iterable[Device | int]) -> None: + """Toggle peer access for every device in ``other`` in one driver call.""" + toggle_ids = set() + for value in other: + try: + toggle_ids.add(_resolve_peer_device_id(value)) + except (TypeError, ValueError): + continue + current = set(_query_peer_access_ids(self._mr)) + to_add = toggle_ids - current + to_remove = toggle_ids & current + if to_add or to_remove: + self._apply(to_add, to_remove) + + def __ior__(self, other: Set[Any]) -> PeerAccessibleBySetProxy: + self.update(other) + return self + + def __iand__(self, other: Set[Any]) -> PeerAccessibleBySetProxy: + self.intersection_update(other) + return self + + def __isub__(self, other: Set[Any]) -> PeerAccessibleBySetProxy: + if other is self: + self.clear() + else: + self.difference_update(other) + return self + + def __ixor__(self, other: Set[Any]) -> PeerAccessibleBySetProxy: + self.symmetric_difference_update(other) + return self + + def __repr__(self) -> str: + return f"PeerAccessibleBySetProxy({set(self)!r})" + + # --- internal: route every write through one batched driver call --- + + def _apply(self, additions, removals) -> None: + """Compute the diff and issue a single ``cuMemPoolSetAccess``. + + ``additions`` and ``removals`` are user-supplied (``Device | int``); + only the owner device is filtered out. Adds are validated through + :meth:`Device.can_access_peer` via :func:`plan_peer_access_update`; + removals bypass that check (revoking is always permitted). + """ + from cuda.core._device import Device + + cdef DeviceMemoryResource mr = self._mr + owner_id = mr._dev_id + owner = Device(owner_id) + current = _query_peer_access_ids(mr) + + # Plan additions through the existing helper (validates can_access_peer). + plan = plan_peer_access_update( + owner_device_id=owner_id, + current_peer_ids=current, + # union of (current set + requested adds) so the planner emits + # exactly the to_add deltas for these additions, no removals. + requested_devices=[*current, *additions], + resolve_device_id=_resolve_peer_device_id, + can_access_peer=owner.can_access_peer, + ) + to_add = plan.to_add + + # Removals: resolve, drop owner and unknowns, intersect with current. + current_set = set(current) + revoke_ids = set() + for value in removals: + try: + dev_id = _resolve_peer_device_id(value) + except (TypeError, ValueError): + continue + if dev_id == owner_id: + continue + if dev_id in current_set: + revoke_ids.add(dev_id) + to_remove = tuple(sorted(revoke_ids)) + + if not to_add and not to_remove: + return + _apply_peer_access_diff(mr, to_add, to_remove) diff --git a/cuda_core/cuda/core/_memory/_pinned_memory_resource.pxd b/cuda_core/cuda/core/_memory/_pinned_memory_resource.pxd new file mode 100644 index 00000000000..41336d4f61a --- /dev/null +++ b/cuda_core/cuda/core/_memory/_pinned_memory_resource.pxd @@ -0,0 +1,9 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from cuda.core._memory._memory_pool cimport _MemPool + + +cdef class PinnedMemoryResource(_MemPool): + cdef int _numa_id diff --git a/cuda_core/cuda/core/_memory/_pinned_memory_resource.pyi b/cuda_core/cuda/core/_memory/_pinned_memory_resource.pyi new file mode 100644 index 00000000000..a83cd8ea581 --- /dev/null +++ b/cuda_core/cuda/core/_memory/_pinned_memory_resource.pyi @@ -0,0 +1,148 @@ +# This file was generated by stubgen-pyx v0.2.6 from cuda_core/cuda/core/_memory/_pinned_memory_resource.pyx + +from __future__ import annotations + +import uuid +from dataclasses import dataclass + +from cuda.core._memory._ipc import IPCAllocationHandle +from cuda.core._memory._memory_pool import _MemPool + + +@dataclass +class PinnedMemoryResourceOptions: + """Customizable :obj:`~_memory.PinnedMemoryResource` options. + + Attributes + ---------- + ipc_enabled : bool, optional + Specifies whether to create an IPC-enabled memory pool. When set to + True, the memory pool and its allocations can be shared with other + processes. (Default to False) + + max_size : int, optional + Maximum pool size. When set to 0, defaults to a system-dependent value. + (Default to 0) + + numa_id : int or None, optional + Host NUMA node ID for pool placement. When set to None (the default), + the behavior depends on ``ipc_enabled``: + + - ``ipc_enabled=False``: OS-managed placement (location type HOST). + - ``ipc_enabled=True``: automatically derived from the current CUDA + device's ``host_numa_id`` attribute, requiring an active CUDA + context. + + When set to a non-negative integer, that NUMA node is used explicitly + regardless of ``ipc_enabled`` (location type HOST_NUMA). + """ + ipc_enabled: bool = False + max_size: int = 0 + numa_id: int | None = None + +class PinnedMemoryResource(_MemPool): + """ + A host-pinned memory resource managing a stream-ordered memory pool. + + Parameters + ---------- + options : PinnedMemoryResourceOptions + Memory resource creation options. + + If set to `None`, the memory resource uses the driver's current + stream-ordered memory pool. If no memory + pool is set as current, the driver's default memory pool + is used. + + If not set to `None`, a new memory pool is created, which is owned by + the memory resource. + + When using an existing (current or default) memory pool, the returned + host-pinned memory resource does not own the pool (`is_handle_owned` is + `False`), and closing the resource has no effect. + + Notes + ----- + To create an IPC-Enabled memory resource (MR) that is capable of sharing + allocations between processes, specify ``ipc_enabled=True`` in the initializer + option. When IPC is enabled and ``numa_id`` is not specified, the NUMA node + is automatically derived from the current CUDA device's ``host_numa_id`` + attribute, which requires an active CUDA context. If ``numa_id`` is + explicitly set, that value is used regardless of ``ipc_enabled``. + + See :class:`DeviceMemoryResource` for more details on IPC usage patterns. + """ + + def __init__(self, options: PinnedMemoryResourceOptions | dict[str, object] | None=None) -> None: + ... + + def __reduce__(self) -> tuple[object, ...]: + ... + + @staticmethod + def from_registry(uuid: uuid.UUID) -> PinnedMemoryResource: + """ + Obtain a registered mapped memory resource. + + Raises + ------ + RuntimeError + If no mapped memory resource is found in the registry. + """ + + def register(self, uuid: uuid.UUID) -> PinnedMemoryResource: + """ + Register a mapped memory resource. + + Returns + ------- + The registered mapped memory resource. If one was previously registered + with the given key, it is returned. + """ + + @classmethod + def from_allocation_handle(cls, alloc_handle: int | IPCAllocationHandle) -> PinnedMemoryResource: + """Create a host-pinned memory resource from an allocation handle. + + Construct a new `PinnedMemoryResource` instance that imports a memory + pool from a shareable handle. The memory pool is marked as owned. + + Parameters + ---------- + alloc_handle : int | IPCAllocationHandle + The shareable handle of the host-pinned memory resource to import. If an + integer is supplied, it must represent a valid platform-specific + handle. It is the caller's responsibility to close that handle. + + Returns + ------- + A new host-pinned memory resource instance with the imported handle. + """ + + @property + def allocation_handle(self) -> IPCAllocationHandle: + """Shareable handle for this memory pool (requires IPC). + + The handle can be used to share the memory pool with other processes. + The handle is cached in this `MemoryResource` and owned by it. + """ + + @property + def device_id(self) -> int: + """Return -1. Pinned memory is host memory and is not associated with a specific device.""" + + @property + def numa_id(self) -> int: + """The host NUMA node ID used for pool placement, or -1 for OS-managed placement.""" + + @property + def is_device_accessible(self) -> bool: + """Return True. This memory resource provides device-accessible buffers.""" + + @property + def is_host_accessible(self) -> bool: + """Return True. This memory resource provides host-accessible buffers.""" +__all__ = ['PinnedMemoryResource', 'PinnedMemoryResourceOptions'] + +def _deep_reduce_pinned_memory_resource(mr: object) -> tuple[object, ...]: + ... \ No newline at end of file diff --git a/cuda_core/cuda/core/_memory/_pinned_memory_resource.pyx b/cuda_core/cuda/core/_memory/_pinned_memory_resource.pyx new file mode 100644 index 00000000000..4335fbb41c2 --- /dev/null +++ b/cuda_core/cuda/core/_memory/_pinned_memory_resource.pyx @@ -0,0 +1,246 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from __future__ import annotations + +from cuda.bindings cimport cydriver +from cuda.core._memory._memory_pool cimport _MemPool, MP_init_create_pool, MP_init_current_pool +from cuda.core._memory cimport _ipc +from cuda.core._memory._ipc cimport IPCAllocationHandle +from cuda.core._utils.cuda_utils cimport ( + check_or_create_options, + HANDLE_RETURN, +) + +from dataclasses import dataclass +import multiprocessing +import platform # no-cython-lint +import uuid + +from cuda.core._utils.cuda_utils import check_multiprocessing_start_method + +__all__ = ['PinnedMemoryResource', 'PinnedMemoryResourceOptions'] + + +@dataclass +cdef class PinnedMemoryResourceOptions: + """Customizable :obj:`~_memory.PinnedMemoryResource` options. + + Attributes + ---------- + ipc_enabled : bool, optional + Specifies whether to create an IPC-enabled memory pool. When set to + True, the memory pool and its allocations can be shared with other + processes. (Default to False) + + max_size : int, optional + Maximum pool size. When set to 0, defaults to a system-dependent value. + (Default to 0) + + numa_id : int or None, optional + Host NUMA node ID for pool placement. When set to None (the default), + the behavior depends on ``ipc_enabled``: + + - ``ipc_enabled=False``: OS-managed placement (location type HOST). + - ``ipc_enabled=True``: automatically derived from the current CUDA + device's ``host_numa_id`` attribute, requiring an active CUDA + context. + + When set to a non-negative integer, that NUMA node is used explicitly + regardless of ``ipc_enabled`` (location type HOST_NUMA). + """ + ipc_enabled : bool = False + max_size : int = 0 + numa_id : int | None = None + + +cdef class PinnedMemoryResource(_MemPool): + """ + A host-pinned memory resource managing a stream-ordered memory pool. + + Parameters + ---------- + options : PinnedMemoryResourceOptions + Memory resource creation options. + + If set to `None`, the memory resource uses the driver's current + stream-ordered memory pool. If no memory + pool is set as current, the driver's default memory pool + is used. + + If not set to `None`, a new memory pool is created, which is owned by + the memory resource. + + When using an existing (current or default) memory pool, the returned + host-pinned memory resource does not own the pool (`is_handle_owned` is + `False`), and closing the resource has no effect. + + Notes + ----- + To create an IPC-Enabled memory resource (MR) that is capable of sharing + allocations between processes, specify ``ipc_enabled=True`` in the initializer + option. When IPC is enabled and ``numa_id`` is not specified, the NUMA node + is automatically derived from the current CUDA device's ``host_numa_id`` + attribute, which requires an active CUDA context. If ``numa_id`` is + explicitly set, that value is used regardless of ``ipc_enabled``. + + See :class:`DeviceMemoryResource` for more details on IPC usage patterns. + """ + + def __init__(self, options: PinnedMemoryResourceOptions | dict[str, object] | None = None) -> None: + _PMR_init(self, options) + + def __reduce__(self) -> tuple[object, ...]: + return PinnedMemoryResource.from_registry, (self.uuid,) + + @staticmethod + def from_registry(uuid: uuid.UUID) -> PinnedMemoryResource: # no-cython-lint + """ + Obtain a registered mapped memory resource. + + Raises + ------ + RuntimeError + If no mapped memory resource is found in the registry. + """ + return (_ipc.MP_from_registry(uuid)) + + def register(self, uuid: uuid.UUID) -> PinnedMemoryResource: # no-cython-lint + """ + Register a mapped memory resource. + + Returns + ------- + The registered mapped memory resource. If one was previously registered + with the given key, it is returned. + """ + return (_ipc.MP_register(self, uuid)) + + @classmethod + def from_allocation_handle( + cls, alloc_handle: int | IPCAllocationHandle + ) -> PinnedMemoryResource: + """Create a host-pinned memory resource from an allocation handle. + + Construct a new `PinnedMemoryResource` instance that imports a memory + pool from a shareable handle. The memory pool is marked as owned. + + Parameters + ---------- + alloc_handle : int | IPCAllocationHandle + The shareable handle of the host-pinned memory resource to import. If an + integer is supplied, it must represent a valid platform-specific + handle. It is the caller's responsibility to close that handle. + + Returns + ------- + A new host-pinned memory resource instance with the imported handle. + """ + # cuMemPoolImportFromShareableHandle requires CUDA to be initialized, but in + # a child process CUDA may not be initialized yet. For DeviceMemoryResource, + # this is not a concern because most likely when retrieving the device_id the + # user would have already initialized CUDA. But since PinnedMemoryResource is + # not device-specific it is unlikelt the case. + HANDLE_RETURN(cydriver.cuInit(0)) + + cdef PinnedMemoryResource mr = ( + _ipc.MP_from_allocation_handle(cls, alloc_handle)) + return mr + + @property + def allocation_handle(self) -> IPCAllocationHandle: + """Shareable handle for this memory pool (requires IPC). + + The handle can be used to share the memory pool with other processes. + The handle is cached in this `MemoryResource` and owned by it. + """ + if not self.is_ipc_enabled: + raise RuntimeError("Memory resource is not IPC-enabled") + return self._ipc_data._alloc_handle + + @property + def device_id(self) -> int: + """Return -1. Pinned memory is host memory and is not associated with a specific device.""" + return -1 + + @property + def numa_id(self) -> int: + """The host NUMA node ID used for pool placement, or -1 for OS-managed placement.""" + return self._numa_id + + @property + def is_device_accessible(self) -> bool: + """Return True. This memory resource provides device-accessible buffers.""" + return True + + @property + def is_host_accessible(self) -> bool: + """Return True. This memory resource provides host-accessible buffers.""" + return True + + +cdef inline _PMR_init(PinnedMemoryResource self, options): + from .._device import Device + + cdef PinnedMemoryResourceOptions opts = check_or_create_options( + PinnedMemoryResourceOptions, options, "PinnedMemoryResource options", + keep_none=True + ) + cdef bint ipc_enabled = False + cdef size_t max_size = 0 + cdef cydriver.CUmemLocationType loc_type + cdef int numa_id = -1 + + if opts is not None: + ipc_enabled = opts.ipc_enabled + if ipc_enabled and not _ipc.is_supported(): + raise RuntimeError(f"IPC is not available on {platform.system()}") + max_size = opts.max_size + + if opts.numa_id is not None: + numa_id = opts.numa_id + if numa_id < 0: + raise ValueError(f"numa_id must be >= 0, got {numa_id}") + elif ipc_enabled: + dev = Device() + numa_id = dev.properties.host_numa_id + if numa_id < 0: + raise RuntimeError( + "Cannot determine host NUMA ID for IPC-enabled pinned " + "memory pool. The system may not support NUMA, or no " + "CUDA context is active. Set numa_id explicitly or " + "call Device.set_current() first.") + + if numa_id >= 0: + loc_type = cydriver.CUmemLocationType.CU_MEM_LOCATION_TYPE_HOST_NUMA + else: + loc_type = cydriver.CUmemLocationType.CU_MEM_LOCATION_TYPE_HOST + + self._numa_id = numa_id + + if opts is None: + MP_init_current_pool( + self, + loc_type, + numa_id, + cydriver.CUmemAllocationType.CU_MEM_ALLOCATION_TYPE_PINNED, + ) + else: + MP_init_create_pool( + self, + loc_type, + numa_id, + cydriver.CUmemAllocationType.CU_MEM_ALLOCATION_TYPE_PINNED, + ipc_enabled, + max_size, + ) + + +def _deep_reduce_pinned_memory_resource(mr: object) -> tuple[object, ...]: + check_multiprocessing_start_method() + alloc_handle = mr.allocation_handle + return mr.from_allocation_handle, (alloc_handle,) + + +multiprocessing.reduction.register(PinnedMemoryResource, _deep_reduce_pinned_memory_resource) diff --git a/cuda_core/cuda/core/_memory/_virtual_memory_resource.py b/cuda_core/cuda/core/_memory/_virtual_memory_resource.py new file mode 100644 index 00000000000..f30e6e3838d --- /dev/null +++ b/cuda_core/cuda/core/_memory/_virtual_memory_resource.py @@ -0,0 +1,632 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from __future__ import annotations + +from dataclasses import dataclass, field +from typing import TYPE_CHECKING, Iterable + +if TYPE_CHECKING: + from cuda.core._stream import Stream + from cuda.core.graph import GraphBuilder + +from cuda.core._device import Device +from cuda.core._memory._buffer import Buffer, MemoryResource +from cuda.core._utils.cuda_utils import ( + Transaction, + check_or_create_options, + driver, +) +from cuda.core._utils.cuda_utils import ( + _check_driver_error as raise_if_driver_error, +) +from cuda.core._utils.version import binding_version +from cuda.core.typing import ( + DevicePointerType, + VirtualMemoryAccessType, + VirtualMemoryAllocationType, + VirtualMemoryGranularityType, + VirtualMemoryHandleType, + VirtualMemoryLocationType, +) + +__all__ = ["VirtualMemoryResource", "VirtualMemoryResourceOptions"] + + +@dataclass +class VirtualMemoryResourceOptions: + """A configuration object for the VirtualMemoryResource + Stores configuration information which tells the resource how to use the CUDA VMM APIs + + Attributes + ---------- + allocation_type: :obj:`~_memory.VirtualMemoryAllocationType` | str + Controls the type of allocation. + location_type: :obj:`~_memory.VirtualMemoryLocationType` | str + Controls the location of the allocation. + handle_type: :obj:`~_memory.VirtualMemoryHandleType` | str + Export handle type for the physical allocation. Use + ``"posix_fd"`` on Linux if you plan to + import/export the allocation (required for cuMemRetainAllocationHandle). + Use `None` if you don't need an exportable handle. + gpu_direct_rdma: bool + Hint that the allocation should be GDR-capable (if supported). + granularity: :obj:`~_memory.VirtualMemoryGranularityType` | str + Controls granularity query and size rounding. + addr_hint: int + A (optional) virtual address hint to try to reserve at. Setting it to 0 lets the CUDA driver decide. + addr_align: int + Alignment for the VA reservation. If `None`, use the queried granularity. + peers: Iterable[int] + Extra device IDs that should be granted access in addition to ``device``. + self_access: :obj:`~_memory.VirtualMemoryAccessType` | None | str + Access flags for the owning device. + peer_access: :obj:`~_memory.VirtualMemoryAccessType` | None | str + Access flags for peers. + """ + + allocation_type: VirtualMemoryAllocationType = VirtualMemoryAllocationType.PINNED + location_type: VirtualMemoryLocationType = VirtualMemoryLocationType.DEVICE + handle_type: VirtualMemoryHandleType = VirtualMemoryHandleType.POSIX_FD + granularity: VirtualMemoryGranularityType = VirtualMemoryGranularityType.RECOMMENDED + gpu_direct_rdma: bool = False + addr_hint: int | None = 0 + addr_align: int | None = None + peers: Iterable[int] = field(default_factory=tuple) + self_access: VirtualMemoryAccessType = VirtualMemoryAccessType.READ_WRITE + peer_access: VirtualMemoryAccessType = VirtualMemoryAccessType.READ_WRITE + + _a = driver.CUmemAccess_flags + _access_flags = { # noqa: RUF012 + VirtualMemoryAccessType.READ_WRITE: _a.CU_MEM_ACCESS_FLAGS_PROT_READWRITE, + VirtualMemoryAccessType.READ: _a.CU_MEM_ACCESS_FLAGS_PROT_READ, + None: 0, + } + _h = driver.CUmemAllocationHandleType + _handle_types = { # noqa: RUF012 + None: _h.CU_MEM_HANDLE_TYPE_NONE, + VirtualMemoryHandleType.POSIX_FD: _h.CU_MEM_HANDLE_TYPE_POSIX_FILE_DESCRIPTOR, + VirtualMemoryHandleType.WIN32_KMT: _h.CU_MEM_HANDLE_TYPE_WIN32_KMT, + VirtualMemoryHandleType.FABRIC: _h.CU_MEM_HANDLE_TYPE_FABRIC, + } + _g = driver.CUmemAllocationGranularity_flags + _granularity = { # noqa: RUF012 + VirtualMemoryGranularityType.RECOMMENDED: _g.CU_MEM_ALLOC_GRANULARITY_RECOMMENDED, + VirtualMemoryGranularityType.MINIMUM: _g.CU_MEM_ALLOC_GRANULARITY_MINIMUM, + } + _l = driver.CUmemLocationType + _location_type = { # noqa: RUF012 + VirtualMemoryLocationType.DEVICE: _l.CU_MEM_LOCATION_TYPE_DEVICE, + VirtualMemoryLocationType.HOST: _l.CU_MEM_LOCATION_TYPE_HOST, + VirtualMemoryLocationType.HOST_NUMA: _l.CU_MEM_LOCATION_TYPE_HOST_NUMA, + VirtualMemoryLocationType.HOST_NUMA_CURRENT: _l.CU_MEM_LOCATION_TYPE_HOST_NUMA_CURRENT, + } + _t = driver.CUmemAllocationType + # CUDA 13+ exposes MANAGED in CUmemAllocationType; older 12.x does not + _allocation_type = {VirtualMemoryAllocationType.PINNED: _t.CU_MEM_ALLOCATION_TYPE_PINNED} # noqa: RUF012 + if binding_version() >= (13, 0, 0): + _allocation_type[VirtualMemoryAllocationType.MANAGED] = _t.CU_MEM_ALLOCATION_TYPE_MANAGED + + @staticmethod + def _access_to_flags(spec: VirtualMemoryAccessType | None) -> int: + flags = VirtualMemoryResourceOptions._access_flags.get(spec) + if flags is None: + raise ValueError(f"Unknown access spec: {spec!r}") + return flags # type: ignore[no-any-return] + + @staticmethod + def _allocation_type_to_driver(spec: VirtualMemoryAllocationType) -> int: + alloc_type = VirtualMemoryResourceOptions._allocation_type.get(spec) + if alloc_type is None: + raise ValueError(f"Unsupported allocation_type: {spec!r}") + return alloc_type # type: ignore[no-any-return] + + @staticmethod + def _location_type_to_driver(spec: VirtualMemoryLocationType) -> int: + loc_type = VirtualMemoryResourceOptions._location_type.get(spec) + if loc_type is None: + raise ValueError(f"Unsupported location_type: {spec!r}") + return loc_type # type: ignore[no-any-return] + + @staticmethod + def _handle_type_to_driver(spec: VirtualMemoryHandleType | None) -> int: + if spec == "win32": + raise NotImplementedError("win32 is currently not supported, please reach out to the CUDA Python team") + handle_type = VirtualMemoryResourceOptions._handle_types.get(spec) + if handle_type is None: + raise ValueError(f"Unsupported handle_type: {spec!r}") + return handle_type # type: ignore[no-any-return] + + @staticmethod + def _granularity_to_driver(spec: VirtualMemoryGranularityType) -> int: + granularity = VirtualMemoryResourceOptions._granularity.get(spec) + if granularity is None: + raise ValueError(f"Unsupported granularity: {spec!r}") + return granularity # type: ignore[no-any-return] + + +class VirtualMemoryResource(MemoryResource): + """Create a device memory resource that uses the CUDA VMM APIs to allocate memory. + + Parameters + ---------- + device_id : Device | int + Device for which a memory resource is constructed. + + config : VirtualMemoryResourceOptions, optional + A configuration object for the VirtualMemoryResource + + + Warning + ------- + This is a low-level API that is provided only for convenience. Make sure you fully understand + how CUDA Virtual Memory Management works before using this. Other MemoryResource subclasses + in cuda.core should already meet the common needs. + """ + + def __init__(self, device_id: Device | int, config: VirtualMemoryResourceOptions | None = None) -> None: + self.device: Device | None = Device(device_id) + self.config: VirtualMemoryResourceOptions = check_or_create_options( # type: ignore[assignment] + VirtualMemoryResourceOptions, config, "VirtualMemoryResource options", keep_none=False + ) + # Matches ("host", "host_numa", "host_numa_current") + if "host" in self.config.location_type: + self.device = None + + if not self.device and self.config.location_type == "device": + raise RuntimeError("VirtualMemoryResource requires a device for device memory allocations") + + if self.device and not self.device.properties.virtual_memory_management_supported: + raise RuntimeError("VirtualMemoryResource requires CUDA VMM API support") + + # Validate RDMA support if requested + if ( + self.config.gpu_direct_rdma + and self.device is not None + and not self.device.properties.gpu_direct_rdma_supported + ): + raise RuntimeError("GPU Direct RDMA is not supported on this device") + + @staticmethod + def _align_up(size: int, gran: int) -> int: + """ + Align a size up to the nearest multiple of a granularity. + """ + return (size + gran - 1) & ~(gran - 1) + + def modify_allocation( + self, buf: Buffer, new_size: int, config: VirtualMemoryResourceOptions | None = None + ) -> Buffer: + """ + Grow an existing allocation using CUDA VMM, with a configurable policy. + + This implements true growing allocations that preserve the base pointer + by extending the virtual address range and mapping additional physical memory. + + This function uses transactional allocation: if any step fails, the original buffer is not modified and + all steps the function took are rolled back so a new allocation is not created. + + Parameters + ---------- + buf : Buffer + The existing buffer to grow + new_size : int + The new total size for the allocation + config : VirtualMemoryResourceOptions, optional + Configuration for the new physical memory chunks. If None, uses current config. + + Returns + ------- + Buffer + The same buffer with updated size and properties, preserving the original pointer + """ + if config is not None: + self.config = config + + # Build allocation properties for new chunks + prop = driver.CUmemAllocationProp() + prop.type = VirtualMemoryResourceOptions._allocation_type_to_driver(self.config.allocation_type) + prop.location.type = VirtualMemoryResourceOptions._location_type_to_driver(self.config.location_type) + # Caller must not invoke modify_allocation on a host-located resource; + # we rely on the dataclass invariant that self.device is non-None for + # device-located resources (it's only None when location is host). + assert self.device is not None, "modify_allocation requires a device-located resource" + prop.location.id = self.device.device_id + prop.allocFlags.gpuDirectRDMACapable = 1 if self.config.gpu_direct_rdma else 0 + prop.requestedHandleTypes = VirtualMemoryResourceOptions._handle_type_to_driver(self.config.handle_type) + prop.win32HandleMetaData = 0 + + # Query granularity + gran_flag = VirtualMemoryResourceOptions._granularity_to_driver(self.config.granularity) + res, gran = driver.cuMemGetAllocationGranularity(prop, gran_flag) + raise_if_driver_error(res) + + # Calculate sizes + additional_size = new_size - buf.size + if additional_size <= 0: + # Same size: only update access policy if needed; avoid zero-sized driver calls + descs = self._build_access_descriptors(prop) + if descs: + (res,) = driver.cuMemSetAccess(int(buf.handle), buf.size, descs, len(descs)) + raise_if_driver_error(res) + return buf + + aligned_additional_size = VirtualMemoryResource._align_up(additional_size, gran) + total_aligned_size = VirtualMemoryResource._align_up(new_size, gran) + aligned_prev_size = total_aligned_size - aligned_additional_size + addr_align = self.config.addr_align or gran + + # Try to extend the existing VA range first + res, new_ptr = driver.cuMemAddressReserve( + aligned_additional_size, + addr_align, + int(buf.handle) + aligned_prev_size, # fixedAddr hint - aligned end of current range + 0, + ) + + if res != driver.CUresult.CUDA_SUCCESS or new_ptr != (int(buf.handle) + aligned_prev_size): + # Check for specific errors that are not recoverable with the slow path + if res in ( + driver.CUresult.CUDA_ERROR_INVALID_VALUE, + driver.CUresult.CUDA_ERROR_NOT_PERMITTED, + driver.CUresult.CUDA_ERROR_NOT_INITIALIZED, + driver.CUresult.CUDA_ERROR_NOT_SUPPORTED, + ): + raise_if_driver_error(res) + (res2,) = driver.cuMemAddressFree(new_ptr, aligned_additional_size) + raise_if_driver_error(res2) + # Fallback: couldn't extend contiguously, need full remapping + return self._grow_allocation_slow_path( + buf, new_size, prop, aligned_additional_size, total_aligned_size, addr_align + ) + else: + # Success! We can extend the VA range contiguously + return self._grow_allocation_fast_path(buf, new_size, prop, aligned_additional_size, new_ptr) + + def _grow_allocation_fast_path( + self, buf: Buffer, new_size: int, prop: driver.CUmemAllocationProp, aligned_additional_size: int, new_ptr: int + ) -> Buffer: + """ + Fast path for growing a virtual memory allocation when the new region can be + reserved contiguously after the existing buffer. + + This function creates and maps new physical memory for the additional size, + sets access permissions, and updates the buffer size in place (the pointer + remains unchanged). + + Args: + buf (Buffer): + The buffer to grow. + + new_size (int): + The new total size in bytes. + + prop (driver.CUmemAllocationProp): + Allocation properties for the new memory. + + aligned_additional_size (int): + The size of the new region to allocate, aligned to granularity. + + new_ptr (int): + The address of the newly reserved contiguous VA region (should + be at the end of the current buffer). + + Returns: + Buffer: The same buffer object with its size updated to `new_size`. + """ + with Transaction() as trans: + # Create new physical memory for the additional size + trans.append( + lambda np=new_ptr, s=aligned_additional_size: raise_if_driver_error(driver.cuMemAddressFree(np, s)[0]) + ) + res, new_handle = driver.cuMemCreate(aligned_additional_size, prop, 0) + raise_if_driver_error(res) + # Register undo for creation + trans.append(lambda h=new_handle: raise_if_driver_error(driver.cuMemRelease(h)[0])) + + # Map the new physical memory to the extended VA range + (res,) = driver.cuMemMap(new_ptr, aligned_additional_size, 0, new_handle, 0) + raise_if_driver_error(res) + # Register undo for mapping + trans.append( + lambda np=new_ptr, s=aligned_additional_size: raise_if_driver_error(driver.cuMemUnmap(np, s)[0]) + ) + + # Set access permissions for the new portion + descs = self._build_access_descriptors(prop) + if descs: + (res,) = driver.cuMemSetAccess(new_ptr, aligned_additional_size, descs, len(descs)) + raise_if_driver_error(res) + + # All succeeded, cancel undo actions + trans.commit() + + # Update the buffer size (pointer stays the same) + # TODO: #2049 This is a real bug, accessing _size which doesn't exist. + # Fix bug and remove the "type: ignore[attr-defined]" comment. + buf._size = new_size # type: ignore[attr-defined] + return buf + + def _grow_allocation_slow_path( + self, + buf: Buffer, + new_size: int, + prop: driver.CUmemAllocationProp, + aligned_additional_size: int, + total_aligned_size: int, + addr_align: int, + ) -> Buffer: + """ + Slow path for growing a virtual memory allocation when the new region cannot be + reserved contiguously after the existing buffer. + + This function reserves a new, larger virtual address (VA) range, remaps the old + physical memory to the beginning of the new VA range, creates and maps new physical + memory for the additional size, sets access permissions, and updates the buffer's + pointer and size. + + Args: + buf (Buffer): The buffer to grow. + new_size (int): The new total size in bytes. + prop (driver.CUmemAllocationProp): Allocation properties for the new memory. + aligned_additional_size (int): The size of the new region to allocate, aligned to granularity. + total_aligned_size (int): The total new size to reserve, aligned to granularity. + addr_align (int): The required address alignment for the new VA range. + + Returns: + Buffer: The buffer object updated with the new pointer and size. + """ + with Transaction() as trans: + # Reserve a completely new, larger VA range + res, new_ptr = driver.cuMemAddressReserve(total_aligned_size, addr_align, 0, 0) + raise_if_driver_error(res) + # Register undo for VA reservation + trans.append( + lambda np=new_ptr, s=total_aligned_size: raise_if_driver_error(driver.cuMemAddressFree(np, s)[0]) + ) + + # Get the old allocation handle for remapping + result, old_handle = driver.cuMemRetainAllocationHandle(buf.handle) + raise_if_driver_error(result) + # Register undo for old_handle + trans.append(lambda h=old_handle: raise_if_driver_error(driver.cuMemRelease(h)[0])) + + # Unmap the old VA range (aligned previous size) + aligned_prev_size = total_aligned_size - aligned_additional_size + (result,) = driver.cuMemUnmap(int(buf.handle), aligned_prev_size) + raise_if_driver_error(result) + + def _remap_old() -> None: + # Try to remap the old physical memory back to the original VA range + try: + (res,) = driver.cuMemMap(int(buf.handle), aligned_prev_size, 0, old_handle, 0) + raise_if_driver_error(res) + except Exception: # noqa: S110 + # TODO: consider logging this exception + pass + + trans.append(_remap_old) + + # Remap the old physical memory to the new VA range (aligned previous size) + (res,) = driver.cuMemMap(int(new_ptr), aligned_prev_size, 0, old_handle, 0) + raise_if_driver_error(res) + + # Register undo for mapping + trans.append(lambda np=new_ptr, s=aligned_prev_size: raise_if_driver_error(driver.cuMemUnmap(np, s)[0])) + + # Create new physical memory for the additional size + res, new_handle = driver.cuMemCreate(aligned_additional_size, prop, 0) + raise_if_driver_error(res) + + # Register undo for new physical memory + trans.append(lambda h=new_handle: raise_if_driver_error(driver.cuMemRelease(h)[0])) + + # Map the new physical memory to the extended portion (aligned offset) + (res,) = driver.cuMemMap(int(new_ptr) + aligned_prev_size, aligned_additional_size, 0, new_handle, 0) + raise_if_driver_error(res) + + # Register undo for mapping + trans.append( + lambda base=int(new_ptr), offs=aligned_prev_size, s=aligned_additional_size: raise_if_driver_error( + driver.cuMemUnmap(base + offs, s)[0] + ) + ) + + # Set access permissions for the entire new range + descs = self._build_access_descriptors(prop) + if descs: + (res,) = driver.cuMemSetAccess(new_ptr, total_aligned_size, descs, len(descs)) + raise_if_driver_error(res) + + # All succeeded, cancel undo actions + trans.commit() + + # Free the old VA range (aligned previous size) + (res2,) = driver.cuMemAddressFree(int(buf.handle), aligned_prev_size) + raise_if_driver_error(res2) + + # Invalidate the old buffer so its destructor won't try to free again + buf._clear() + + # Return a new Buffer for the new mapping + return Buffer.from_handle(ptr=new_ptr, size=new_size, mr=self) + + def _build_access_descriptors(self, prop: driver.CUmemAllocationProp) -> list[driver.CUmemAccessDesc]: + """ + Build access descriptors for memory access permissions. + + Returns + ------- + list + List of CUmemAccessDesc objects for setting memory access + """ + descs = [] + + # Owner access + owner_flags = VirtualMemoryResourceOptions._access_to_flags(self.config.self_access) + if owner_flags: + d = driver.CUmemAccessDesc() + d.location.type = prop.location.type + d.location.id = prop.location.id + d.flags = owner_flags + descs.append(d) + + # Peer device access + peer_flags = VirtualMemoryResourceOptions._access_to_flags(self.config.peer_access) + if peer_flags: + for peer_dev in self.config.peers: + d = driver.CUmemAccessDesc() + d.location.type = driver.CUmemLocationType.CU_MEM_LOCATION_TYPE_DEVICE + d.location.id = int(peer_dev) + d.flags = peer_flags + descs.append(d) + + return descs + + def allocate(self, size: int, *, stream: Stream | GraphBuilder | None = None) -> Buffer: + """ + Allocate a buffer of the given size using CUDA virtual memory. + + Parameters + ---------- + size : int + The size in bytes of the buffer to allocate. + stream : Stream, optional + Keyword-only. Unused because virtual memory operations are + synchronous. + + Returns + ------- + Buffer + A Buffer object representing the allocated virtual memory. + + Raises + ------ + CUDAError + If any CUDA driver API call fails during allocation. + + Notes + ----- + This method uses transactional allocation: if any step fails, all resources + allocated so far are automatically cleaned up. The allocation is performed + with the configured granularity, access permissions, and peer access as + specified in the resource's configuration. + """ + if stream is not None: + from cuda.core._stream import Stream_accept + + Stream_accept(stream) + + config = self.config + # ---- Build allocation properties ---- + prop = driver.CUmemAllocationProp() + prop.type = VirtualMemoryResourceOptions._allocation_type_to_driver(config.allocation_type) + prop.location.type = VirtualMemoryResourceOptions._location_type_to_driver(config.location_type) + prop.location.id = self.device.device_id if self.device is not None else -1 + prop.allocFlags.gpuDirectRDMACapable = 1 if config.gpu_direct_rdma else 0 + prop.requestedHandleTypes = VirtualMemoryResourceOptions._handle_type_to_driver(config.handle_type) + prop.win32HandleMetaData = 0 + + # ---- Query and apply granularity ---- + # Choose min vs recommended granularity per config + gran_flag = VirtualMemoryResourceOptions._granularity_to_driver(config.granularity) + res, gran = driver.cuMemGetAllocationGranularity(prop, gran_flag) + raise_if_driver_error(res) + + aligned_size = VirtualMemoryResource._align_up(size, gran) + addr_align = config.addr_align or gran + + # ---- Transactional allocation ---- + with Transaction() as trans: + # ---- Create physical memory ---- + res, handle = driver.cuMemCreate(aligned_size, prop, 0) + raise_if_driver_error(res) + # Register undo for physical memory + trans.append(lambda h=handle: raise_if_driver_error(driver.cuMemRelease(h)[0])) + + # ---- Reserve VA space ---- + # Potentially, use a separate size for the VA reservation from the physical allocation size + res, ptr = driver.cuMemAddressReserve(aligned_size, addr_align, config.addr_hint, 0) + raise_if_driver_error(res) + # Register undo for VA reservation + trans.append(lambda p=ptr, s=aligned_size: raise_if_driver_error(driver.cuMemAddressFree(p, s)[0])) + + # ---- Map physical memory into VA ---- + (res,) = driver.cuMemMap(ptr, aligned_size, 0, handle, 0) + trans.append(lambda p=ptr, s=aligned_size: raise_if_driver_error(driver.cuMemUnmap(p, s)[0])) + raise_if_driver_error(res) + + # ---- Set access for owner + peers ---- + descs = self._build_access_descriptors(prop) + if descs: + (res,) = driver.cuMemSetAccess(ptr, aligned_size, descs, len(descs)) + raise_if_driver_error(res) + + trans.commit() + + # Done — return a Buffer that tracks this VA range + buf = Buffer.from_handle(ptr=ptr, size=aligned_size, mr=self) + return buf + + def deallocate(self, ptr: DevicePointerType, size: int, *, stream: Stream | GraphBuilder | None = None) -> None: + """ + Deallocate memory on the device using CUDA VMM APIs. + + Parameters + ---------- + ptr : DevicePointerType + The pointer to the memory to deallocate. + size : int + The size in bytes of the memory to deallocate. + stream : Stream, optional + Keyword-only. Unused because virtual memory operations are + synchronous. + """ + ptr = 0 if ptr is None else int(ptr) + + if stream is not None: + from cuda.core._stream import Stream_accept + + Stream_accept(stream) + result, handle = driver.cuMemRetainAllocationHandle(ptr) + raise_if_driver_error(result) + (result,) = driver.cuMemUnmap(ptr, size) + raise_if_driver_error(result) + (result,) = driver.cuMemAddressFree(ptr, size) + raise_if_driver_error(result) + (result,) = driver.cuMemRelease(handle) + raise_if_driver_error(result) + + @property + def is_device_accessible(self) -> bool: + """ + Indicates whether the allocated memory is accessible from the device. + """ + return self.config.location_type == "device" + + @property + def is_host_accessible(self) -> bool: + """ + Indicates whether the allocated memory is accessible from the host. + """ + return self.config.location_type == "host" + + @property + def device_id(self) -> int: + """ + Get the device ID associated with this memory resource. + + Returns: + int: CUDA device ID. -1 if the memory resource allocates host memory + """ + return self.device.device_id if self.device is not None else -1 + + def __repr__(self) -> str: + """ + Return a string representation of the VirtualMemoryResource. + + Returns: + str: A string describing the object + """ + return f"" diff --git a/cuda_core/cuda/core/_memoryview.pxd b/cuda_core/cuda/core/_memoryview.pxd new file mode 100644 index 00000000000..5b50ae6dc71 --- /dev/null +++ b/cuda_core/cuda/core/_memoryview.pxd @@ -0,0 +1,28 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from libc.stdint cimport intptr_t + +from cuda.core._dlpack cimport DLTensor +from cuda.core._layout cimport _StridedLayout + + +cdef class StridedMemoryView: + cdef readonly: + intptr_t ptr + int device_id + bint is_device_accessible + bint readonly + object exporting_obj + + cdef: + object metadata + DLTensor* dl_tensor + _StridedLayout _layout + object _buffer + object _dtype + + cdef inline _StridedLayout get_layout(self) + cdef inline object get_buffer(self) + cdef inline object get_dtype(self) diff --git a/cuda_core/cuda/core/_memoryview.pyi b/cuda_core/cuda/core/_memoryview.pyi new file mode 100644 index 00000000000..e0ed0d3cf0d --- /dev/null +++ b/cuda_core/cuda/core/_memoryview.pyi @@ -0,0 +1,307 @@ +# This file was generated by stubgen-pyx v0.2.6 from cuda_core/cuda/core/_memoryview.pyx + +from __future__ import annotations + +import functools +from collections.abc import Callable +from typing import Any + +import numpy +from cuda.core._layout import _StridedLayout +from cuda.core._memory import Buffer +from cuda.core._stream import Stream + +from ._dlpack import * + + +class StridedMemoryView: + """A class holding metadata of a strided dense array/tensor. + + A :obj:`StridedMemoryView` instance can be created in three ways: + + 1. Using the :obj:`args_viewable_as_strided_memory` decorator (recommended) + 2. Explicit construction relying on DLPack or CUDA Array Interface, see below. + 3. From :obj:`~_memory.Buffer` and shape and size tuples (see + :meth:`from_buffer` classmethod) + + ``StridedMemoryView(obj, stream_ptr)`` can be used to create a view from + objects supporting either DLPack (up to v1.0) or CUDA Array Interface + (CAI) v3. When wrapping an arbitrary object it will try the DLPack protocol + first, then the CAI protocol. A :obj:`BufferError` is raised if neither is + supported. + + Since either way would take a consumer stream, for DLPack it is passed to + ``obj.__dlpack__()`` as-is (except for :obj:`None`, see below); for CAI, a + stream order will be established between the consumer stream and the + producer stream (from ``obj.__cuda_array_interface__()["stream"]``), as if + ``cudaStreamWaitEvent`` is called by this method. + + To opt-out of the stream ordering operation in either DLPack or CAI, + please pass ``stream_ptr=-1``. Note that this deviates (on purpose) + from the semantics of ``obj.__dlpack__(stream=None, ...)`` since ``cuda.core`` + does not encourage using the (legacy) default/null stream, but is + consistent with the CAI's semantics. For DLPack, ``stream=-1`` will be + internally passed to ``obj.__dlpack__()`` instead. + + Parameters + ---------- + obj : Any + Any objects that supports either DLPack (up to v1.0) or CUDA Array + Interface (v3). + stream_ptr: int + The pointer address (as Python `int`) to the **consumer** stream. + Stream ordering will be properly established unless ``-1`` is passed. + + + Attributes + ----------- + ptr : int + Pointer to the tensor buffer (as a Python `int`). + device_id : int + The device ID for where the tensor is located. It is -1 for CPU tensors + (meaning those only accessible from the host). + is_device_accessible : bool + Whether the tensor data can be accessed on the GPU. + readonly: bool + Whether the tensor data can be modified in place. + exporting_obj : Any + A reference to the original tensor object that is being viewed. + If the view is created with :meth:`from_buffer`, + it will be the Buffer instance passed to the method. + + """ + + def __init__(self, obj: object=None, stream_ptr: int | None=None) -> None: + ... + + @classmethod + def from_dlpack(cls, obj: object, stream_ptr: int | None=None) -> StridedMemoryView: + """Create a view from an object supporting the `DLPack `_ protocol. + + Parameters + ---------- + obj : object + An object implementing the `DLPack `_ protocol + (via ``__dlpack__``). + stream_ptr : int, optional + Stream pointer for synchronization. If ``None``, no synchronization is performed. + """ + + @classmethod + def from_cuda_array_interface(cls, obj: object, stream_ptr: int | None=None) -> StridedMemoryView: + """Create a view from an object supporting the `__cuda_array_interface__ `_ protocol. + + Parameters + ---------- + obj : object + An object implementing the `__cuda_array_interface__ `_ protocol. + stream_ptr : int, optional + Stream pointer for synchronization. If ``None``, no synchronization is performed. + """ + + @classmethod + def from_array_interface(cls, obj: object) -> StridedMemoryView: + """Create a view from an object supporting the `__array_interface__ `_ protocol. + + Parameters + ---------- + obj : object + An object implementing the `__array_interface__ `_ protocol (e.g., a numpy array). + """ + + @classmethod + def from_any_interface(cls, obj: object, stream_ptr: int | None=None) -> StridedMemoryView: + """Create a view by automatically selecting the best available protocol. + + Tries `DLPack `_ first, then falls back to + `__cuda_array_interface__ `_. + ``torch.Tensor`` objects are transparently handled via a fast AOTI path + regardless of which protocol is selected. + + Parameters + ---------- + obj : object + An object implementing `DLPack `_ or + `__cuda_array_interface__ `_. + stream_ptr : int, optional + Stream pointer for synchronization. If ``None``, no synchronization is performed. + """ + + @classmethod + def from_buffer(cls, buffer: Buffer, shape: tuple[int, ...], strides: tuple[int, ...] | None=None, *, itemsize: int | None=None, dtype: numpy.dtype | None=None, is_readonly: bool=False) -> StridedMemoryView: + """ + Creates a :obj:`StridedMemoryView` instance from a :obj:`~_memory.Buffer` and shape and strides tuples. + The Buffer can be either allocation coming from a :obj:`MemoryResource` or an external allocation + wrapped in a :obj:`~_memory.Buffer` object with ``Buffer.from_handle(ptr, size, owner=...)``. + + .. caution:: + When creating a :obj:`StridedMemoryView` from a :obj:`~_memory.Buffer`, + no synchronization is performed. It is the user's responsibility to ensure + the data in ``buffer`` is properly synchronized when consuming the view. + + Parameters + ---------- + buffer : :obj:`~_memory.Buffer` + The buffer to create the view from. + shape : :obj:`tuple` + The layout describing the shape, strides and itemsize of the elements in + the buffer. + strides : :obj:`tuple` + The layout describing the shape, strides and itemsize of the elements in + the buffer. + dtype : :obj:`numpy.dtype` + Optional dtype. + If specified, the dtype's itemsize must match the layout's itemsize. + is_readonly : bool, optional + Whether the mark the view as readonly. + """ + + def __dealloc__(self) -> None: + ... + + def view(self, layout: _StridedLayout | None=None, dtype: numpy.dtype | None=None) -> StridedMemoryView: + """ + Creates a new view with adjusted layout and dtype. + Same as calling :meth:`from_buffer` with the current buffer. + """ + + def as_tensor_map(self, box_dim: tuple[int, ...] | None=None, *, options: object=None, element_strides: tuple[int, ...] | None=None, data_type: object=None, interleave: object=None, swizzle: object=None, l2_promotion: object=None, oob_fill: object=None) -> object: + """Create a tiled :obj:`TensorMapDescriptor` from this view. + + This is the public entry point for creating tiled tensor map + descriptors in ``cuda.core``. Pass either ``box_dim`` and the + individual keyword arguments directly, or provide bundled tiled + options via ``options=``. + """ + + def copy_from(self, other: StridedMemoryView, stream: Stream, allocator: object=None, blocking: bool | None=None) -> None: + """ + Copies the data from the other view into this view. + + The copy can be performed between following memory spaces: + host-to-device, device-to-host, device-to-device (on the same device). + + Parameters + ---------- + other : StridedMemoryView + The view to copy data from. + stream : Stream | None, optional + The stream to schedule the copy on. + allocator : MemoryResource | None, optional + If temporary buffers are needed, the specified memory resources + will be used to allocate the memory. If not specified, default + resources will be used. + blocking : bool | None, optional + Whether the call should block until the copy is complete. + * ``True``: the ``stream`` is synchronized with the host at the end of the call, + blocking until the copy is complete. + * ``False``: if possible, the call returns immediately once the copy is scheduled. + However, in some cases of host-to-device or device-to-host copies, the call may + still synchronize with the host if necessary. + * ``None`` (default): + * for device-to-device, it defaults to ``False`` (non-blocking), + * for host-to-device or device-to-host, it defaults to ``True`` (blocking). + """ + + def copy_to(self, other: StridedMemoryView, stream: Stream | None=None, allocator: object=None, blocking: bool | None=None) -> None: + """ + Copies the data from this view into the ``other`` view. + + For details, see :meth:`copy_from`. + """ + + def __dlpack__(self, *, stream: int | None=None, max_version: tuple[int, int] | None=None, dl_device: tuple[int, int] | None=None, copy: bool | None=None) -> object: + ... + + def __dlpack_device__(self) -> tuple[int, int]: + ... + + @property + def _layout(self) -> _StridedLayout: + """ + The layout of the tensor. For StridedMemoryView created from DLPack or CAI, + the layout is inferred from the tensor object's metadata. + """ + + @property + def size(self) -> int: + ... + + @property + def shape(self) -> tuple[int, ...]: + """ + Shape of the tensor. + """ + + @property + def strides(self) -> tuple[int, ...] | None: + """ + Strides of the tensor (in **counts**, not bytes). + """ + + @property + def dtype(self) -> numpy.dtype | None: + """ + Data type of the tensor. + + Supports standard NumPy dtypes as well as narrow data types (e.g., ``bfloat16``) + when the optional `ml_dtypes `_ package is + installed. If ``ml_dtypes`` is not available and such a tensor is encountered, + a :obj:`NotImplementedError` will be raised. + """ + + def __repr__(self) -> str: + ... + +class _StridedMemoryViewProxy: + + def view(self, stream_ptr=None) -> StridedMemoryView: + ... + + def __init__(self, obj: object) -> None: + ... +_SMV_DLPACK_EXCHANGE_API_CAPSULE = ... + +def view_as_cai(obj, stream_ptr, view=None) -> StridedMemoryView: + ... + +def view_as_array_interface(obj, view=None) -> StridedMemoryView: + ... + +@functools.lru_cache +def _typestr2dtype(typestr: str) -> numpy.dtype: + ... + +@functools.lru_cache +def _typestr2itemsize(typestr: str) -> int: + ... + +def args_viewable_as_strided_memory(arg_indices: tuple[int, ...]) -> Callable[[Callable[..., Any]], Callable[..., Any]]: + """ + Decorator to create proxy objects to :obj:`StridedMemoryView` for the + specified positional arguments. + + This allows array/tensor attributes to be accessed inside the function + implementation, while keeping the function body array-library-agnostic (if + desired). + + Inside the decorated function, the specified arguments become instances + of an (undocumented) proxy type, regardless of its original source. A + :obj:`StridedMemoryView` instance can be obtained by passing the (consumer) + stream pointer (as a Python `int`) to the proxies's ``view()`` method. For + example: + + .. code-block:: python + + @args_viewable_as_strided_memory((1,)) + def my_func(arg0, arg1, arg2, stream: Stream): + # arg1 can be any object supporting DLPack or CUDA Array Interface + view = arg1.view(stream.handle) + assert isinstance(view, StridedMemoryView) + ... + + Parameters + ---------- + arg_indices : tuple + The indices of the target positional arguments. + """ \ No newline at end of file diff --git a/cuda_core/cuda/core/_memoryview.pyx b/cuda_core/cuda/core/_memoryview.pyx new file mode 100644 index 00000000000..260980c1daf --- /dev/null +++ b/cuda_core/cuda/core/_memoryview.pyx @@ -0,0 +1,1355 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from __future__ import annotations + +cimport cython +from ._dlpack cimport * +from ._dlpack import classify_dl_device +from libc.stdint cimport intptr_t +from cuda.core._layout cimport _StridedLayout, get_strides_ptr +from cuda.core._stream import Stream + +import ctypes +import functools +import sys +import warnings +from collections.abc import Callable # no-cython-lint # used in string annotations below +from typing import Any # no-cython-lint # used in string annotations below + +import numpy + +from cuda.bindings cimport cydriver +from cuda.core._resource_handles cimport ( + EventHandle, + create_event_handle_noctx, + as_cu, +) + +from cuda.core._utils.cuda_utils import handle_return, driver +from cuda.core._utils.cuda_utils cimport HANDLE_RETURN + + +from cuda.core._memory import Buffer + + +# --------------------------------------------------------------------------- +# Lazy tensor bridge (avoids loading _tensor_bridge.so until torch is used) +# --------------------------------------------------------------------------- + +cdef object _tensor_bridge = None +# Cache: type(obj) -> True/False for the torch tensor check. +# Once a type is seen, we never re-check. +cdef dict _torch_type_cache = {} +# Tri-state: None = not checked, True/False = result of version check +cdef object _torch_version_ok = None + +cdef inline bint _torch_version_check(): + """Return True if 2.3 <= torch <= 2.12 (known AOTI ABI range). Memoized. + + Lower bound: AOTI functions we use were introduced in PyTorch 2.3. + Upper bound: the ``pyobj_to_aten_handle`` trick relies on the + THPVariable struct layout (PyObject_HEAD followed by at::Tensor cdata) + and the identity ``AtenTensorHandle == at::Tensor*``. Both are + undocumented internals that could change in a future PyTorch version. + We cap at the latest version we have tested against; unknown versions + fall back to the standard DLPack/CAI paths. Bump the upper bound + after verifying a new PyTorch release. + """ + global _torch_version_ok + if _torch_version_ok is not None: + return _torch_version_ok + torch = sys.modules.get("torch") + if torch is None: + _torch_version_ok = False + return False + try: + major, minor = int(torch.__version__.split(".")[0]), \ + int(torch.__version__.split(".")[1]) + _torch_version_ok = (2, 3) <= (major, minor) <= (2, 12) + except (ValueError, IndexError): + _torch_version_ok = False + return _torch_version_ok + + +cdef inline bint _is_torch_tensor(object obj): + cdef type tp = type(obj) + cdef object cached = _torch_type_cache.get(tp) + if cached is not None: + return cached + cdef str mod = tp.__module__ or "" + cdef bint result = mod.startswith("torch") and hasattr(obj, "data_ptr") \ + and _torch_version_check() + _torch_type_cache[tp] = result # setdefault not needed for bools + return result + + +cdef object _get_tensor_bridge(): + """Bootstrap AOTI symbols, then import _tensor_bridge on first use.""" + global _tensor_bridge + if _tensor_bridge is not None: + return _tensor_bridge + torch_C = sys.modules.get("torch._C") + if torch_C is None: + raise RuntimeError( + "torch._C is not loaded; cannot initialise the tensor bridge. " + "Make sure PyTorch is imported before passing a torch.Tensor.") + ctypes.CDLL(torch_C.__file__, mode=ctypes.RTLD_GLOBAL) + from cuda.core import _tensor_bridge as tb + _tensor_bridge = tb + return _tensor_bridge + + +try: + from ml_dtypes import bfloat16 +except ImportError: + bfloat16 = None + +# TODO(leofang): support NumPy structured dtypes + + +cdef extern from "Python.h": + ctypedef struct PyTypeObject: + void* tp_dict + void PyType_Modified(PyTypeObject*) + + +cdef DLPackExchangeAPI _SMV_DLPACK_EXCHANGE_API +cdef bint _SMV_DLPACK_EXCHANGE_API_INITED = False +_SMV_DLPACK_EXCHANGE_API_CAPSULE = cpython.PyCapsule_New( + &_SMV_DLPACK_EXCHANGE_API, + b"dlpack_exchange_api", + NULL, +) + + +cdef class StridedMemoryView: + """A class holding metadata of a strided dense array/tensor. + + A :obj:`StridedMemoryView` instance can be created in three ways: + + 1. Using the :obj:`args_viewable_as_strided_memory` decorator (recommended) + 2. Explicit construction relying on DLPack or CUDA Array Interface, see below. + 3. From :obj:`~_memory.Buffer` and shape and size tuples (see + :meth:`from_buffer` classmethod) + + ``StridedMemoryView(obj, stream_ptr)`` can be used to create a view from + objects supporting either DLPack (up to v1.0) or CUDA Array Interface + (CAI) v3. When wrapping an arbitrary object it will try the DLPack protocol + first, then the CAI protocol. A :obj:`BufferError` is raised if neither is + supported. + + Since either way would take a consumer stream, for DLPack it is passed to + ``obj.__dlpack__()`` as-is (except for :obj:`None`, see below); for CAI, a + stream order will be established between the consumer stream and the + producer stream (from ``obj.__cuda_array_interface__()["stream"]``), as if + ``cudaStreamWaitEvent`` is called by this method. + + To opt-out of the stream ordering operation in either DLPack or CAI, + please pass ``stream_ptr=-1``. Note that this deviates (on purpose) + from the semantics of ``obj.__dlpack__(stream=None, ...)`` since ``cuda.core`` + does not encourage using the (legacy) default/null stream, but is + consistent with the CAI's semantics. For DLPack, ``stream=-1`` will be + internally passed to ``obj.__dlpack__()`` instead. + + Parameters + ---------- + obj : Any + Any objects that supports either DLPack (up to v1.0) or CUDA Array + Interface (v3). + stream_ptr: int + The pointer address (as Python `int`) to the **consumer** stream. + Stream ordering will be properly established unless ``-1`` is passed. + + + Attributes + ----------- + ptr : int + Pointer to the tensor buffer (as a Python `int`). + device_id : int + The device ID for where the tensor is located. It is -1 for CPU tensors + (meaning those only accessible from the host). + is_device_accessible : bool + Whether the tensor data can be accessed on the GPU. + readonly: bool + Whether the tensor data can be modified in place. + exporting_obj : Any + A reference to the original tensor object that is being viewed. + If the view is created with :meth:`from_buffer`, + it will be the Buffer instance passed to the method. + + """ + def __init__(self, obj: object = None, stream_ptr: int | None = None) -> None: + cdef str clsname = self.__class__.__name__ + if obj is not None: + # populate self's attributes + if check_has_dlpack(obj): + warnings.warn( + f"Constructing a {clsname} directly from a DLPack-supporting object is deprecated; " + "Use `StridedMemoryView.from_dlpack` or `StridedMemoryView.from_any_interface` instead.", + DeprecationWarning, + stacklevel=2, + ) + view_as_dlpack(obj, stream_ptr, self) + else: + warnings.warn( + f"Constructing a {clsname} directly from a CUDA-array-interface-supporting object is deprecated; " + "Use `StridedMemoryView.from_cuda_array_interface` or `StridedMemoryView.from_any_interface` instead.", + DeprecationWarning, + stacklevel=2, + ) + view_as_cai(obj, stream_ptr, self) + else: + warnings.warn( + f"Constructing an empty {clsname} is deprecated; " + "use one of the classmethods `from_dlpack`, `from_cuda_array_interface` or `from_any_interface` " + "to construct a StridedMemoryView from an object", + DeprecationWarning, + stacklevel=2, + ) + + @classmethod + def from_dlpack(cls, obj: object, stream_ptr: int | None=None) -> StridedMemoryView: + """Create a view from an object supporting the `DLPack `_ protocol. + + Parameters + ---------- + obj : object + An object implementing the `DLPack `_ protocol + (via ``__dlpack__``). + stream_ptr : int, optional + Stream pointer for synchronization. If ``None``, no synchronization is performed. + """ + cdef StridedMemoryView buf = StridedMemoryView.__new__(cls) + if _is_torch_tensor(obj): + _get_tensor_bridge().view_as_torch_tensor(obj, stream_ptr, buf) + return buf + view_as_dlpack(obj, stream_ptr, buf) + return buf + + @classmethod + def from_cuda_array_interface(cls, obj: object, stream_ptr: int | None=None) -> StridedMemoryView: + """Create a view from an object supporting the `__cuda_array_interface__ `_ protocol. + + Parameters + ---------- + obj : object + An object implementing the `__cuda_array_interface__ `_ protocol. + stream_ptr : int, optional + Stream pointer for synchronization. If ``None``, no synchronization is performed. + """ + cdef StridedMemoryView buf = StridedMemoryView.__new__(cls) + if _is_torch_tensor(obj): + _get_tensor_bridge().view_as_torch_tensor(obj, stream_ptr, buf) + return buf + view_as_cai(obj, stream_ptr, buf) + return buf + + @classmethod + def from_array_interface(cls, obj: object) -> StridedMemoryView: + """Create a view from an object supporting the `__array_interface__ `_ protocol. + + Parameters + ---------- + obj : object + An object implementing the `__array_interface__ `_ protocol (e.g., a numpy array). + """ + cdef StridedMemoryView buf = StridedMemoryView.__new__(cls) + if _is_torch_tensor(obj): + _get_tensor_bridge().view_as_torch_tensor(obj, None, buf) + return buf + view_as_array_interface(obj, buf) + return buf + + @classmethod + def from_any_interface(cls, obj: object, stream_ptr: int | None = None) -> StridedMemoryView: + """Create a view by automatically selecting the best available protocol. + + Tries `DLPack `_ first, then falls back to + `__cuda_array_interface__ `_. + ``torch.Tensor`` objects are transparently handled via a fast AOTI path + regardless of which protocol is selected. + + Parameters + ---------- + obj : object + An object implementing `DLPack `_ or + `__cuda_array_interface__ `_. + stream_ptr : int, optional + Stream pointer for synchronization. If ``None``, no synchronization is performed. + """ + if check_has_dlpack(obj): + return cls.from_dlpack(obj, stream_ptr) + return cls.from_cuda_array_interface(obj, stream_ptr) + + @classmethod + def from_buffer( + cls, + buffer : Buffer, + shape : tuple[int, ...], + strides : tuple[int, ...] | None = None, + *, + itemsize : int | None = None, + dtype : numpy.dtype | None = None, + is_readonly : bool = False + ) -> StridedMemoryView: + """ + Creates a :obj:`StridedMemoryView` instance from a :obj:`~_memory.Buffer` and shape and strides tuples. + The Buffer can be either allocation coming from a :obj:`MemoryResource` or an external allocation + wrapped in a :obj:`~_memory.Buffer` object with ``Buffer.from_handle(ptr, size, owner=...)``. + + .. caution:: + When creating a :obj:`StridedMemoryView` from a :obj:`~_memory.Buffer`, + no synchronization is performed. It is the user's responsibility to ensure + the data in ``buffer`` is properly synchronized when consuming the view. + + Parameters + ---------- + buffer : :obj:`~_memory.Buffer` + The buffer to create the view from. + shape : :obj:`tuple` + The layout describing the shape, strides and itemsize of the elements in + the buffer. + strides : :obj:`tuple` + The layout describing the shape, strides and itemsize of the elements in + the buffer. + dtype : :obj:`numpy.dtype` + Optional dtype. + If specified, the dtype's itemsize must match the layout's itemsize. + is_readonly : bool, optional + Whether the mark the view as readonly. + """ + cdef StridedMemoryView view = StridedMemoryView.__new__(cls) + if itemsize is None and dtype is None: + raise ValueError("Either itemsize or dtype must be specified") + if itemsize is not None and dtype is not None and itemsize != dtype.itemsize: + raise ValueError( + f"itemsize ({itemsize}) does not match dtype.itemsize ({dtype.itemsize})" + ) + # (itemsize is None XOR dtype is None) OR they are equal + view_buffer_strided( + view, + buffer, + _StridedLayout(shape=shape, strides=strides, itemsize=getattr(dtype, "itemsize", itemsize)), + dtype, + is_readonly, + ) + return view + + def __dealloc__(self) -> None: + if self.dl_tensor == NULL: + return + + if cpython.PyCapsule_IsValid( + self.metadata, DLPACK_VERSIONED_TENSOR_USED_NAME): + data = cpython.PyCapsule_GetPointer( + self.metadata, DLPACK_VERSIONED_TENSOR_USED_NAME) + dlm_tensor_ver = data + dlm_tensor_ver.deleter(dlm_tensor_ver) + elif cpython.PyCapsule_IsValid( + self.metadata, DLPACK_TENSOR_USED_NAME): + data = cpython.PyCapsule_GetPointer( + self.metadata, DLPACK_TENSOR_USED_NAME) + dlm_tensor = data + dlm_tensor.deleter(dlm_tensor) + + def view( + self, layout : _StridedLayout | None = None, dtype : numpy.dtype | None = None + ) -> StridedMemoryView: + """ + Creates a new view with adjusted layout and dtype. + Same as calling :meth:`from_buffer` with the current buffer. + """ + cdef StridedMemoryView view = StridedMemoryView.__new__(self.__class__) + if layout is None and dtype is None: + return self + if layout is None: + layout = self.get_layout() + if dtype is None: + dtype = self.get_dtype() + view_buffer_strided(view, self.get_buffer(), layout, dtype, self.readonly) + return view + + def as_tensor_map( + self, + box_dim: tuple[int, ...] | None = None, + *, + options: object = None, + element_strides: tuple[int, ...] | None = None, + data_type: object = None, + interleave: object = None, + swizzle: object = None, + l2_promotion: object = None, + oob_fill: object = None, + ) -> object: + """Create a tiled :obj:`TensorMapDescriptor` from this view. + + This is the public entry point for creating tiled tensor map + descriptors in ``cuda.core``. Pass either ``box_dim`` and the + individual keyword arguments directly, or provide bundled tiled + options via ``options=``. + """ + from cuda.core._tensor_map import TensorMapDescriptor + + kwargs = {} + if options is not None: + kwargs["options"] = options + if element_strides is not None: + kwargs["element_strides"] = element_strides + if data_type is not None: + kwargs["data_type"] = data_type + if interleave is not None: + kwargs["interleave"] = interleave + if swizzle is not None: + kwargs["swizzle"] = swizzle + if l2_promotion is not None: + kwargs["l2_promotion"] = l2_promotion + if oob_fill is not None: + kwargs["oob_fill"] = oob_fill + return TensorMapDescriptor._from_tiled(self, box_dim, **kwargs) + + def copy_from( + self, + other: StridedMemoryView, + stream: Stream, + allocator: object = None, + blocking: bool | None = None, + ) -> None: + """ + Copies the data from the other view into this view. + + The copy can be performed between following memory spaces: + host-to-device, device-to-host, device-to-device (on the same device). + + Parameters + ---------- + other : StridedMemoryView + The view to copy data from. + stream : Stream | None, optional + The stream to schedule the copy on. + allocator : MemoryResource | None, optional + If temporary buffers are needed, the specified memory resources + will be used to allocate the memory. If not specified, default + resources will be used. + blocking : bool | None, optional + Whether the call should block until the copy is complete. + * ``True``: the ``stream`` is synchronized with the host at the end of the call, + blocking until the copy is complete. + * ``False``: if possible, the call returns immediately once the copy is scheduled. + However, in some cases of host-to-device or device-to-host copies, the call may + still synchronize with the host if necessary. + * ``None`` (default): + * for device-to-device, it defaults to ``False`` (non-blocking), + * for host-to-device or device-to-host, it defaults to ``True`` (blocking). + """ + raise NotImplementedError("Sorry, not supported: copy_from") + + def copy_to( + self, + other: StridedMemoryView, + stream: Stream | None = None, + allocator: object = None, + blocking: bool | None = None, + ) -> None: + """ + Copies the data from this view into the ``other`` view. + + For details, see :meth:`copy_from`. + """ + raise NotImplementedError("Sorry, not supported: copy_to") + + def __dlpack__( + self, + *, + stream: int | None = None, + max_version: tuple[int, int] | None = None, + dl_device: tuple[int, int] | None = None, + copy: bool | None = None, + ) -> object: + # Similar to Buffer.__dlpack__: no implicit synchronization is performed. + if dl_device is not None: + raise BufferError("Sorry, not supported: dl_device other than None") + if copy is True: + raise BufferError("Sorry, not supported: copy=True") + + cdef bint versioned + if max_version is None: + versioned = False + else: + if not isinstance(max_version, tuple) or len(max_version) != 2: + raise BufferError(f"Expected max_version tuple[int, int], got {max_version}") + versioned = max_version >= (1, 0) + + # NOTE: stream is accepted for protocol compatibility but not used. + cdef object capsule = _smv_make_py_capsule(self, versioned) + return capsule + + def __dlpack_device__(self) -> tuple[int, int]: + cdef _DLDeviceType device_type + cdef int32_t device_id + _smv_get_dl_device(self, &device_type, &device_id) + return (device_type, int(device_id)) + + @property + def _layout(self) -> _StridedLayout: + """ + The layout of the tensor. For StridedMemoryView created from DLPack or CAI, + the layout is inferred from the tensor object's metadata. + """ + return self.get_layout() + + @property + def size(self) -> int: + return self.get_layout().get_volume() + + @property + def shape(self) -> tuple[int, ...]: + """ + Shape of the tensor. + """ + return self.get_layout().get_shape_tuple() + + @property + def strides(self) -> tuple[int, ...] | None: + """ + Strides of the tensor (in **counts**, not bytes). + """ + return self.get_layout().get_strides_tuple() + + @property + def dtype(self) -> numpy.dtype | None: + """ + Data type of the tensor. + + Supports standard NumPy dtypes as well as narrow data types (e.g., ``bfloat16``) + when the optional `ml_dtypes `_ package is + installed. If ``ml_dtypes`` is not available and such a tensor is encountered, + a :obj:`NotImplementedError` will be raised. + """ + return self.get_dtype() + + def __repr__(self) -> str: + return (f"StridedMemoryView(ptr={self.ptr},\n" + + f" shape={self.shape},\n" + + f" strides={self.strides},\n" + + f" itemsize={self._layout.itemsize},\n" + + f" dtype={get_simple_repr(self.dtype)},\n" + + f" device_id={self.device_id},\n" + + f" is_device_accessible={self.is_device_accessible},\n" + + f" readonly={self.readonly},\n" + + f" exporting_obj={get_simple_repr(self.exporting_obj)})") + + @cython.critical_section + cdef inline _StridedLayout get_layout(self): + if self._layout is None: + if self.dl_tensor: + self._layout = layout_from_dlpack(self.dl_tensor) + elif self.metadata is not None: + self._layout = layout_from_cai(self.metadata) + else: + raise ValueError("Cannot infer layout from the exporting object") + return self._layout + + @cython.critical_section + cdef inline object get_buffer(self): + """ + Returns Buffer instance with the underlying data. + If the SMV was created from a Buffer, it will return the same Buffer instance. + Otherwise, it will create a new instance with owner set to the exporting object. + """ + if self._buffer is None: + if isinstance(self.exporting_obj, Buffer): + self._buffer = self.exporting_obj + else: + self._buffer = Buffer.from_handle(self.ptr, 0, owner=self.exporting_obj) + return self._buffer + + @cython.critical_section + cdef inline object get_dtype(self): + if self._dtype is None: + if self.dl_tensor != NULL: + self._dtype = dtype_dlpack_to_numpy(&self.dl_tensor.dtype) + elif isinstance(self.metadata, int): + # AOTI dtype code stored by the torch tensor bridge + self._dtype = _get_tensor_bridge().resolve_aoti_dtype( + self.metadata) + elif self.metadata is not None: + self._dtype = _typestr2dtype(self.metadata["typestr"]) + return self._dtype + + +cdef void _smv_pycapsule_deleter(object capsule) noexcept: + cdef DLManagedTensor* dlm_tensor + cdef DLManagedTensorVersioned* dlm_tensor_ver + # Do not invoke the deleter on a used capsule. + if cpython.PyCapsule_IsValid(capsule, DLPACK_TENSOR_UNUSED_NAME): + dlm_tensor = ( + cpython.PyCapsule_GetPointer(capsule, DLPACK_TENSOR_UNUSED_NAME) + ) + if dlm_tensor.deleter: + dlm_tensor.deleter(dlm_tensor) + elif cpython.PyCapsule_IsValid(capsule, DLPACK_VERSIONED_TENSOR_UNUSED_NAME): + dlm_tensor_ver = ( + cpython.PyCapsule_GetPointer(capsule, DLPACK_VERSIONED_TENSOR_UNUSED_NAME) + ) + if dlm_tensor_ver.deleter: + dlm_tensor_ver.deleter(dlm_tensor_ver) + + +cdef inline void _smv_release_export_resources(void* manager_ctx, int64_t* shape_ptr) noexcept with gil: + if shape_ptr: + stdlib.free(shape_ptr) + if manager_ctx: + cpython.Py_DECREF(manager_ctx) + + +cdef void _smv_deleter(DLManagedTensor* tensor) noexcept with gil: + if tensor: + _smv_release_export_resources(tensor.manager_ctx, tensor.dl_tensor.shape) + tensor.manager_ctx = NULL + stdlib.free(tensor) + + +cdef void _smv_versioned_deleter(DLManagedTensorVersioned* tensor) noexcept with gil: + if tensor: + _smv_release_export_resources(tensor.manager_ctx, tensor.dl_tensor.shape) + tensor.manager_ctx = NULL + stdlib.free(tensor) + + +cdef inline DLManagedTensorVersioned* _smv_allocate_dlm_tensor_versioned() except? NULL: + cdef DLManagedTensorVersioned* dlm_tensor_ver = NULL + dlm_tensor_ver = stdlib.malloc(sizeof(DLManagedTensorVersioned)) + if dlm_tensor_ver == NULL: + raise MemoryError() + dlm_tensor_ver.dl_tensor.shape = NULL + dlm_tensor_ver.manager_ctx = NULL + return dlm_tensor_ver + + +cdef inline DLManagedTensor* _smv_allocate_dlm_tensor() except? NULL: + cdef DLManagedTensor* dlm_tensor = NULL + dlm_tensor = stdlib.malloc(sizeof(DLManagedTensor)) + if dlm_tensor == NULL: + raise MemoryError() + dlm_tensor.dl_tensor.shape = NULL + dlm_tensor.manager_ctx = NULL + return dlm_tensor + + +cdef inline int _smv_dtype_numpy_to_dlpack(object dtype_obj, DLDataType* out_dtype) except -1: + cdef object np_dtype = numpy.dtype(dtype_obj) + if np_dtype.fields is not None: + raise BufferError("Structured dtypes are not supported for DLPack export") + if not np_dtype.isnative and np_dtype.byteorder not in ("=", "|"): + raise BufferError("Non-native-endian dtypes are not supported for DLPack export") + + cdef str kind = np_dtype.kind + cdef int bits = np_dtype.itemsize * 8 + cdef uint8_t code + if kind == "b": + if bits != 8: + raise BufferError(f"Unsupported bool dtype itemsize: {np_dtype.itemsize}") + code = kDLBool + elif kind == "i": + if bits not in (8, 16, 32, 64): + raise BufferError(f"Unsupported signed integer dtype: {np_dtype}") + code = kDLInt + elif kind == "u": + if bits not in (8, 16, 32, 64): + raise BufferError(f"Unsupported unsigned integer dtype: {np_dtype}") + code = kDLUInt + elif kind == "f": + if bits not in (16, 32, 64): + raise BufferError(f"Unsupported floating dtype: {np_dtype}") + code = kDLFloat + elif kind == "c": + if bits not in (64, 128): + raise BufferError(f"Unsupported complex dtype: {np_dtype}") + code = kDLComplex + else: + raise BufferError(f"Unsupported dtype for DLPack export: {np_dtype}") + + out_dtype.code = code + out_dtype.bits = bits + out_dtype.lanes = 1 + return 0 + + +cdef inline int _smv_get_dl_device( + StridedMemoryView view, + _DLDeviceType* out_device_type, + int32_t* out_device_id, +) except -1: + cdef _DLDeviceType device_type + cdef int32_t device_id + cdef object buf + if view.dl_tensor != NULL: + device_type = view.dl_tensor.device.device_type + if device_type == _kDLCUDA: + device_id = view.dl_tensor.device.device_id + else: + # CPU, CUDAHost, and CUDAManaged use device_id=0 in DLPack. + device_id = 0 + elif view.is_device_accessible: + buf = view.get_buffer() + dev_type, dev_id = classify_dl_device(buf) + device_type = <_DLDeviceType>dev_type + device_id = dev_id + else: + device_type = _kDLCPU + device_id = 0 + + out_device_type[0] = device_type + out_device_id[0] = device_id + return 0 + + +cdef inline int _smv_setup_dl_tensor_common( + DLTensor* dl_tensor, + StridedMemoryView view, + _StridedLayout layout, +) except -1: + cdef object dtype_obj = view.get_dtype() + if dtype_obj is None: + raise BufferError( + "Cannot export StridedMemoryView via DLPack without dtype information; " + "create the view with dtype specified." + ) + _smv_dtype_numpy_to_dlpack(dtype_obj, &dl_tensor.dtype) + _smv_get_dl_device(view, &dl_tensor.device.device_type, &dl_tensor.device.device_id) + + cdef int ndim = layout.base.ndim + dl_tensor.ndim = ndim + if layout.get_volume() == 0: + dl_tensor.data = NULL + else: + dl_tensor.data = view.ptr + dl_tensor.byte_offset = 0 + return 0 + + +cdef inline int _smv_setup_dl_tensor(DLTensor* dl_tensor, StridedMemoryView view) except -1: + cdef _StridedLayout layout = view.get_layout() + _smv_setup_dl_tensor_common(dl_tensor, view, layout) + + cdef int i + cdef int64_t* shape_strides = NULL + cdef int64_t* strides_src = NULL + cdef int ndim = dl_tensor.ndim + if ndim == 0: + dl_tensor.shape = NULL + dl_tensor.strides = NULL + else: + # DLPack v1.2+ requires non-NULL strides for ndim != 0. + shape_strides = stdlib.malloc(sizeof(int64_t) * 2 * ndim) + if shape_strides == NULL: + raise MemoryError() + try: + strides_src = get_strides_ptr(layout.base) + for i in range(ndim): + shape_strides[i] = layout.base.shape[i] + shape_strides[i + ndim] = strides_src[i] + except Exception: + stdlib.free(shape_strides) + raise + dl_tensor.shape = shape_strides + dl_tensor.strides = shape_strides + ndim + return 0 + + +cdef inline int _smv_setup_dltensor_borrowed(DLTensor* dl_tensor, StridedMemoryView view) except -1: + cdef _StridedLayout layout = view.get_layout() + _smv_setup_dl_tensor_common(dl_tensor, view, layout) + + if dl_tensor.ndim == 0: + dl_tensor.shape = NULL + dl_tensor.strides = NULL + else: + dl_tensor.shape = layout.base.shape + # For temporary/non-owning exchange we provide explicit strides. + dl_tensor.strides = get_strides_ptr(layout.base) + return 0 + + +cdef inline int _smv_fill_managed_tensor_versioned( + DLManagedTensorVersioned* dlm_tensor_ver, + StridedMemoryView view, +) except -1: + cpython.Py_INCREF(view) + dlm_tensor_ver.manager_ctx = view + dlm_tensor_ver.deleter = _smv_versioned_deleter + dlm_tensor_ver.version.major = DLPACK_MAJOR_VERSION + dlm_tensor_ver.version.minor = DLPACK_MINOR_VERSION + dlm_tensor_ver.flags = DLPACK_FLAG_BITMASK_READ_ONLY if view.readonly else 0 + _smv_setup_dl_tensor(&dlm_tensor_ver.dl_tensor, view) + return 0 + + +cdef inline int _smv_fill_managed_tensor( + DLManagedTensor* dlm_tensor, + StridedMemoryView view, +) except -1: + cpython.Py_INCREF(view) + dlm_tensor.manager_ctx = view + dlm_tensor.deleter = _smv_deleter + _smv_setup_dl_tensor(&dlm_tensor.dl_tensor, view) + return 0 + + +cdef object _smv_make_py_capsule(StridedMemoryView view, bint versioned): + cdef DLManagedTensor* dlm_tensor = NULL + cdef DLManagedTensorVersioned* dlm_tensor_ver = NULL + cdef object capsule = None + cdef void* tensor_ptr = NULL + cdef const char* capsule_name + try: + if versioned: + dlm_tensor_ver = _smv_allocate_dlm_tensor_versioned() + _smv_fill_managed_tensor_versioned(dlm_tensor_ver, view) + tensor_ptr = dlm_tensor_ver + capsule_name = DLPACK_VERSIONED_TENSOR_UNUSED_NAME + else: + dlm_tensor = _smv_allocate_dlm_tensor() + _smv_fill_managed_tensor(dlm_tensor, view) + tensor_ptr = dlm_tensor + capsule_name = DLPACK_TENSOR_UNUSED_NAME + capsule = cpython.PyCapsule_New(tensor_ptr, capsule_name, _smv_pycapsule_deleter) + except Exception: + if capsule is None: + _smv_deleter(dlm_tensor) + _smv_versioned_deleter(dlm_tensor_ver) + raise + return capsule + + +cdef inline StridedMemoryView _smv_from_dlpack_capsule(object capsule, object exporting_obj): + cdef void* data = NULL + cdef DLTensor* dl_tensor = NULL + cdef DLManagedTensorVersioned* dlm_tensor_ver = NULL + cdef DLManagedTensor* dlm_tensor = NULL + cdef bint is_readonly = False + cdef const char* used_name = NULL + if cpython.PyCapsule_IsValid(capsule, DLPACK_VERSIONED_TENSOR_UNUSED_NAME): + data = cpython.PyCapsule_GetPointer(capsule, DLPACK_VERSIONED_TENSOR_UNUSED_NAME) + dlm_tensor_ver = data + dl_tensor = &dlm_tensor_ver.dl_tensor + is_readonly = bool((dlm_tensor_ver.flags & DLPACK_FLAG_BITMASK_READ_ONLY) != 0) + used_name = DLPACK_VERSIONED_TENSOR_USED_NAME + elif cpython.PyCapsule_IsValid(capsule, DLPACK_TENSOR_UNUSED_NAME): + data = cpython.PyCapsule_GetPointer(capsule, DLPACK_TENSOR_UNUSED_NAME) + dlm_tensor = data + dl_tensor = &dlm_tensor.dl_tensor + is_readonly = False + used_name = DLPACK_TENSOR_USED_NAME + else: + raise BufferError("Invalid DLPack capsule") + + cpython.PyCapsule_SetName(capsule, used_name) + + cdef StridedMemoryView view = StridedMemoryView.__new__(StridedMemoryView) + view.dl_tensor = dl_tensor + view.metadata = capsule + view.ptr = (dl_tensor.data) + (dl_tensor.byte_offset) + view.readonly = is_readonly + view.exporting_obj = exporting_obj + if dl_tensor.device.device_type == _kDLCPU: + view.device_id = -1 + view.is_device_accessible = False + elif dl_tensor.device.device_type in (_kDLCUDA, _kDLCUDAHost, _kDLCUDAManaged): + view.device_id = dl_tensor.device.device_id + view.is_device_accessible = True + else: + raise BufferError("device not supported") + return view + + +cdef int _smv_managed_tensor_allocator( + DLTensor* prototype, + DLManagedTensorVersioned** out, + void* error_ctx, + void (*SetError)(void* error_ctx, const char* kind, const char* message) noexcept, +) noexcept with gil: + if out != NULL: + out[0] = NULL + if SetError != NULL: + SetError(error_ctx, b"NotImplementedError", b"managed_tensor_allocator is not supported by StridedMemoryView") + cpython.PyErr_SetString(NotImplementedError, b"managed_tensor_allocator is not supported by StridedMemoryView") + return -1 + + +cdef int _smv_managed_tensor_from_py_object_no_sync( + void* py_object, + DLManagedTensorVersioned** out, +) noexcept with gil: + cdef DLManagedTensorVersioned* dlm_tensor_ver = NULL + if out == NULL: + cpython.PyErr_SetString(RuntimeError, b"out cannot be NULL") + return -1 + out[0] = NULL + cdef object obj = py_object + if not isinstance(obj, StridedMemoryView): + cpython.PyErr_SetString(TypeError, b"py_object must be a StridedMemoryView") + return -1 + try: + dlm_tensor_ver = _smv_allocate_dlm_tensor_versioned() + _smv_fill_managed_tensor_versioned(dlm_tensor_ver, obj) + except Exception: + _smv_versioned_deleter(dlm_tensor_ver) + return -1 + out[0] = dlm_tensor_ver + return 0 + + +cdef int _smv_managed_tensor_to_py_object_no_sync( + DLManagedTensorVersioned* tensor, + void** out_py_object, +) noexcept with gil: + cdef object capsule + cdef object py_view + if out_py_object == NULL: + cpython.PyErr_SetString(RuntimeError, b"out_py_object cannot be NULL") + return -1 + out_py_object[0] = NULL + if tensor == NULL: + cpython.PyErr_SetString(RuntimeError, b"tensor cannot be NULL") + return -1 + try: + capsule = cpython.PyCapsule_New( + tensor, + DLPACK_VERSIONED_TENSOR_UNUSED_NAME, + _smv_pycapsule_deleter, + ) + py_view = _smv_from_dlpack_capsule(capsule, capsule) + cpython.Py_INCREF(py_view) + out_py_object[0] = py_view + except Exception: + return -1 + return 0 + + +cdef int _smv_dltensor_from_py_object_no_sync( + void* py_object, + DLTensor* out, +) noexcept with gil: + if out == NULL: + cpython.PyErr_SetString(RuntimeError, b"out cannot be NULL") + return -1 + cdef object obj = py_object + if not isinstance(obj, StridedMemoryView): + cpython.PyErr_SetString(TypeError, b"py_object must be a StridedMemoryView") + return -1 + try: + _smv_setup_dltensor_borrowed(out, obj) + except Exception: + return -1 + return 0 + + +cdef int _smv_current_work_stream( + _DLDeviceType device_type, + int32_t device_id, + void** out_current_stream, +) noexcept with gil: + if out_current_stream == NULL: + cpython.PyErr_SetString(RuntimeError, b"out_current_stream cannot be NULL") + return -1 + # cuda.core has no global/current stream state today. + out_current_stream[0] = NULL + return 0 + + +cdef void _init_smv_dlpack_exchange_api(): + global _SMV_DLPACK_EXCHANGE_API_INITED + if _SMV_DLPACK_EXCHANGE_API_INITED: + return + _SMV_DLPACK_EXCHANGE_API.header.version.major = DLPACK_MAJOR_VERSION + _SMV_DLPACK_EXCHANGE_API.header.version.minor = DLPACK_MINOR_VERSION + _SMV_DLPACK_EXCHANGE_API.header.prev_api = NULL + _SMV_DLPACK_EXCHANGE_API.managed_tensor_allocator = _smv_managed_tensor_allocator + _SMV_DLPACK_EXCHANGE_API.managed_tensor_from_py_object_no_sync = _smv_managed_tensor_from_py_object_no_sync + _SMV_DLPACK_EXCHANGE_API.managed_tensor_to_py_object_no_sync = _smv_managed_tensor_to_py_object_no_sync + _SMV_DLPACK_EXCHANGE_API.dltensor_from_py_object_no_sync = _smv_dltensor_from_py_object_no_sync + _SMV_DLPACK_EXCHANGE_API.current_work_stream = _smv_current_work_stream + _SMV_DLPACK_EXCHANGE_API_INITED = True + + +_init_smv_dlpack_exchange_api() +# cdef classes are immutable types in Cython 3, so inject these attributes +# directly into the type dict. +((StridedMemoryView).tp_dict)["__dlpack_c_exchange_api__"] = _SMV_DLPACK_EXCHANGE_API_CAPSULE +((StridedMemoryView).tp_dict)["__c_dlpack_exchange_api__"] = _SMV_DLPACK_EXCHANGE_API_CAPSULE +PyType_Modified(StridedMemoryView) + + +cdef str get_simple_repr(obj): + # TODO: better handling in np.dtype objects + cdef object obj_class + cdef str obj_repr + if isinstance(obj, type): + obj_class = obj + else: + obj_class = obj.__class__ + if obj_class.__module__ in (None, "builtins"): + obj_repr = obj_class.__name__ + else: + obj_repr = f"{obj_class.__module__}.{obj_class.__name__}" + return obj_repr + + + +cdef bint check_has_dlpack(obj) except*: + cdef bint has_dlpack + if hasattr(obj, "__dlpack__") and hasattr(obj, "__dlpack_device__"): + has_dlpack = True + elif hasattr(obj, "__cuda_array_interface__"): + has_dlpack = False + else: + raise BufferError( + "the input object does not support any data exchange protocol") + return has_dlpack + + +cdef class _StridedMemoryViewProxy: + cdef readonly: + object obj + bint has_dlpack + + def __init__(self, obj: object) -> None: + self.obj = obj + self.has_dlpack = check_has_dlpack(obj) + + cpdef StridedMemoryView view(self, stream_ptr=None): + if self.has_dlpack: + return StridedMemoryView.from_dlpack(self.obj, stream_ptr) + else: + return StridedMemoryView.from_cuda_array_interface(self.obj, stream_ptr) + + +cdef StridedMemoryView view_as_dlpack(obj, stream_ptr, view=None): + cdef int dldevice, device_id + cdef bint is_device_accessible, is_readonly + is_device_accessible = False + dldevice, device_id = obj.__dlpack_device__() + if dldevice == _kDLCPU: + assert device_id == 0 + device_id = -1 + if stream_ptr is None: + raise BufferError("stream=None is ambiguous with view()") + elif stream_ptr == -1: + stream_ptr = None + elif dldevice == _kDLCUDA: + assert device_id >= 0 + is_device_accessible = True + # no need to check other stream values, it's a pass-through + if stream_ptr is None: + raise BufferError("stream=None is ambiguous with view()") + elif dldevice in (_kDLCUDAHost, _kDLCUDAManaged): + is_device_accessible = True + # just do a pass-through without any checks, as pinned/managed memory can be + # accessed on both host and device + else: + raise BufferError("device not supported") + + cdef object capsule + try: + capsule = obj.__dlpack__( + stream=int(stream_ptr) if stream_ptr else None, + max_version=(DLPACK_MAJOR_VERSION, DLPACK_MINOR_VERSION)) + except TypeError: + capsule = obj.__dlpack__( + stream=int(stream_ptr) if stream_ptr else None) + + cdef void* data = NULL + cdef DLTensor* dl_tensor + cdef DLManagedTensorVersioned* dlm_tensor_ver + cdef DLManagedTensor* dlm_tensor + cdef const char *used_name + if cpython.PyCapsule_IsValid( + capsule, DLPACK_VERSIONED_TENSOR_UNUSED_NAME): + data = cpython.PyCapsule_GetPointer( + capsule, DLPACK_VERSIONED_TENSOR_UNUSED_NAME) + dlm_tensor_ver = data + dl_tensor = &dlm_tensor_ver.dl_tensor + is_readonly = bool((dlm_tensor_ver.flags & DLPACK_FLAG_BITMASK_READ_ONLY) != 0) + used_name = DLPACK_VERSIONED_TENSOR_USED_NAME + elif cpython.PyCapsule_IsValid( + capsule, DLPACK_TENSOR_UNUSED_NAME): + data = cpython.PyCapsule_GetPointer( + capsule, DLPACK_TENSOR_UNUSED_NAME) + dlm_tensor = data + dl_tensor = &dlm_tensor.dl_tensor + is_readonly = False + used_name = DLPACK_TENSOR_USED_NAME + else: + assert False + + cpython.PyCapsule_SetName(capsule, used_name) + + cdef StridedMemoryView buf = StridedMemoryView() if view is None else view + buf.dl_tensor = dl_tensor + buf.metadata = capsule + buf.ptr = (dl_tensor.data) + buf.device_id = device_id + buf.is_device_accessible = is_device_accessible + buf.readonly = is_readonly + buf.exporting_obj = obj + + return buf + + +@functools.lru_cache +def _typestr2dtype(str typestr) -> numpy.dtype: + return numpy.dtype(typestr) + + +@functools.lru_cache +def _typestr2itemsize(str typestr) -> int: + return _typestr2dtype(typestr).itemsize + + +cdef object dtype_dlpack_to_numpy(DLDataType* dtype): + cdef int bits = dtype.bits + if dtype.lanes != 1: + # TODO: return a NumPy structured dtype? + raise NotImplementedError( + f'vector dtypes (lanes={dtype.lanes}) is not supported') + if dtype.code == kDLUInt: + if bits == 8: + np_dtype = numpy.uint8 + elif bits == 16: + np_dtype = numpy.uint16 + elif bits == 32: + np_dtype = numpy.uint32 + elif bits == 64: + np_dtype = numpy.uint64 + else: + raise TypeError('uint{} is not supported.'.format(bits)) + elif dtype.code == kDLInt: + if bits == 8: + np_dtype = numpy.int8 + elif bits == 16: + np_dtype = numpy.int16 + elif bits == 32: + np_dtype = numpy.int32 + elif bits == 64: + np_dtype = numpy.int64 + else: + raise TypeError('int{} is not supported.'.format(bits)) + elif dtype.code == kDLFloat: + if bits == 16: + np_dtype = numpy.float16 + elif bits == 32: + np_dtype = numpy.float32 + elif bits == 64: + np_dtype = numpy.float64 + else: + raise TypeError('float{} is not supported.'.format(bits)) + elif dtype.code == kDLComplex: + # TODO(leofang): support complex32 + if bits == 64: + np_dtype = numpy.complex64 + elif bits == 128: + np_dtype = numpy.complex128 + else: + raise TypeError('complex{} is not supported.'.format(bits)) + elif dtype.code == kDLBool: + if bits == 8: + np_dtype = numpy.bool_ + else: + raise TypeError(f'{bits}-bit bool is not supported') + elif dtype.code == kDLBfloat: + if bfloat16 is not None: + np_dtype = numpy.dtype("bfloat16") + else: + raise NotImplementedError( + 'Support for bfloat16 within cuda-core requires `ml_dtypes`' + 'to be installed.' + ) + else: + raise TypeError('Unsupported dtype. dtype code: {}'.format(dtype.code)) + + # We want the dtype object not just the type object + return numpy.dtype(np_dtype) + + +cpdef StridedMemoryView view_as_cai(obj, stream_ptr, view=None): + cdef dict cai_data = obj.__cuda_array_interface__ + if cai_data["version"] < 3: + raise BufferError("only CUDA Array Interface v3 or above is supported") + if cai_data.get("mask") is not None: + raise BufferError("mask is not supported") + if stream_ptr is None: + raise BufferError("stream=None is ambiguous with view()") + + cdef StridedMemoryView buf = StridedMemoryView() if view is None else view + buf.exporting_obj = obj + buf.metadata = cai_data + buf.dl_tensor = NULL + # Validate shape/strides/typestr eagerly so constructor paths fail fast. + buf.get_layout() + buf.ptr, buf.readonly = cai_data["data"] + buf.is_device_accessible = True + if buf.ptr != 0: + buf.device_id = handle_return( + driver.cuPointerGetAttribute( + driver.CUpointer_attribute.CU_POINTER_ATTRIBUTE_DEVICE_ORDINAL, + buf.ptr)) + else: + buf.device_id = handle_return(driver.cuCtxGetDevice()) + + cdef intptr_t producer_s, consumer_s + cdef EventHandle h_event + stream_ptr = int(stream_ptr) + if stream_ptr != -1: + stream = cai_data.get("stream") + if stream is not None: + producer_s = (stream) + consumer_s = (stream_ptr) + assert producer_s > 0 + # establish stream order + if producer_s != consumer_s: + with nogil: + h_event = create_event_handle_noctx(cydriver.CUevent_flags.CU_EVENT_DISABLE_TIMING) + HANDLE_RETURN(cydriver.cuEventRecord( + as_cu(h_event), producer_s)) + HANDLE_RETURN(cydriver.cuStreamWaitEvent( + consumer_s, as_cu(h_event), 0)) + elif _is_torch_tensor(obj): + # PyTorch's __cuda_array_interface__ reports version 2 and + # omits the "stream" field, so the standard CAI sync path + # above is a no-op for torch tensors. This is unsafe: the + # consumer has no guarantee that the producer's work is + # visible. We fix this by querying PyTorch's current CUDA + # stream via the AOTI stable C ABI and performing the same + # event-based stream ordering. + _get_tensor_bridge().sync_torch_stream( + buf.device_id, (stream_ptr)) + + return buf + + +cpdef StridedMemoryView view_as_array_interface(obj, view=None): + cdef dict data = obj.__array_interface__ + if data["version"] < 3: + raise BufferError("only NumPy Array Interface v3 or above is supported") + if data.get("mask") is not None: + raise BufferError("mask is not supported") + + cdef StridedMemoryView buf = StridedMemoryView() if view is None else view + buf.exporting_obj = obj + buf.metadata = data + buf.dl_tensor = NULL + # Validate shape/strides/typestr eagerly so constructor paths fail fast. + buf.get_layout() + buf.ptr, buf.readonly = data["data"] + buf.is_device_accessible = False + buf.device_id = handle_return(driver.cuCtxGetDevice()) + return buf + + +def args_viewable_as_strided_memory(arg_indices: tuple[int, ...]) -> Callable[[Callable[..., Any]], Callable[..., Any]]: + """ + Decorator to create proxy objects to :obj:`StridedMemoryView` for the + specified positional arguments. + + This allows array/tensor attributes to be accessed inside the function + implementation, while keeping the function body array-library-agnostic (if + desired). + + Inside the decorated function, the specified arguments become instances + of an (undocumented) proxy type, regardless of its original source. A + :obj:`StridedMemoryView` instance can be obtained by passing the (consumer) + stream pointer (as a Python `int`) to the proxies's ``view()`` method. For + example: + + .. code-block:: python + + @args_viewable_as_strided_memory((1,)) + def my_func(arg0, arg1, arg2, stream: Stream): + # arg1 can be any object supporting DLPack or CUDA Array Interface + view = arg1.view(stream.handle) + assert isinstance(view, StridedMemoryView) + ... + + Parameters + ---------- + arg_indices : tuple + The indices of the target positional arguments. + """ + def wrapped_func_with_indices(func: "Callable") -> "Callable": + @functools.wraps(func) + def wrapped_func(*args, **kwargs) -> object: + args = list(args) + cdef int idx + for idx in arg_indices: + args[idx] = _StridedMemoryViewProxy(args[idx]) + return func(*args, **kwargs) + return wrapped_func + return wrapped_func_with_indices + + +cdef inline _StridedLayout layout_from_dlpack(DLTensor* dl_tensor): + cdef _StridedLayout layout = _StridedLayout.__new__(_StridedLayout) + cdef int nbits = dl_tensor.dtype.bits * dl_tensor.dtype.lanes + cdef int itemsize = nbits >> 3 + if (itemsize << 3) != nbits: + raise ValueError("dl_tensor.dtype.bits must be a multiple of 8") + layout.init_from_ptr(dl_tensor.ndim, dl_tensor.shape, dl_tensor.strides, itemsize) + return layout + + +cdef _StridedLayout layout_from_cai(object metadata): + cdef _StridedLayout layout = _StridedLayout.__new__(_StridedLayout) + cdef object shape = metadata["shape"] + cdef object strides = metadata.get("strides") + cdef int itemsize = _typestr2itemsize(metadata["typestr"]) + layout.init_from_tuple(shape, strides, itemsize, True) + return layout + + +cdef inline intptr_t get_data_ptr(object buffer, _StridedLayout layout) except? 0: + return (int(buffer.handle)) + layout.get_slice_offset_in_bytes() + + +cdef inline int view_buffer_strided( + StridedMemoryView view, + object buffer, + _StridedLayout layout, + object dtype, + bint is_readonly, +) except -1: + if dtype is not None: + dtype = numpy.dtype(dtype) + if dtype.itemsize != layout.itemsize: + raise ValueError( + f"The dtype's itemsize ({dtype.itemsize}) does not match the layout's " + f"itemsize ({layout.itemsize})." + ) + # Check the layout's offset range [min_offset, max_offset] fits + # within the [0, buffer.size - 1] range. + # The required_size_in_bytes fails if min_offset < 0. + # NB. For external memory, both positive and negative offsets can be valid, + # but for a proper check we'd need to know both size and data offset, + # while neither is reported by the packages. + cdef bint is_allocated = buffer.memory_resource is not None + if is_allocated and buffer.size < layout.get_required_size_in_bytes(): + raise ValueError( + f"Buffer size is too small for the layout. " + f"Expected at least {layout.get_required_size_in_bytes()} bytes, " + f"got {buffer.size} bytes." + ) + # set the public attributes + view.ptr = get_data_ptr(buffer, layout) + view.device_id = buffer.device_id + view.is_device_accessible = buffer.is_device_accessible + view.readonly = is_readonly + view.exporting_obj = view._buffer = buffer + # no dlpack/cai metadata + view.dl_tensor = NULL + view.metadata = None + # we get the layout from the caller + view._layout = layout + view._dtype = dtype + return 0 diff --git a/cuda_core/cuda/core/_module.pxd b/cuda_core/cuda/core/_module.pxd new file mode 100644 index 00000000000..78f871b5ba2 --- /dev/null +++ b/cuda_core/cuda/core/_module.pxd @@ -0,0 +1,63 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from cuda.bindings cimport cydriver +from cuda.core._resource_handles cimport LibraryHandle, KernelHandle + +cdef class ObjectCode +cdef class Kernel +cdef class KernelOccupancy +cdef class KernelAttributes + + +cdef class Kernel: + cdef: + KernelHandle _h_kernel + KernelAttributes _attributes # lazy + KernelOccupancy _occupancy # lazy + object _keepalive + object __weakref__ + + @staticmethod + cdef Kernel _from_handle(KernelHandle h_kernel) + + cdef tuple _get_arguments_info(self, bint param_info=*) + + +cdef class ObjectCode: + cdef: + LibraryHandle _h_library + str _code_type + object _module # bytes/str source + dict _sym_map + str _name + object __weakref__ + + cdef int _lazy_load_module(self) except -1 + + +cdef class KernelOccupancy: + cdef: + KernelHandle _h_kernel + + @staticmethod + cdef KernelOccupancy _init(KernelHandle h_kernel) + + +cdef class KernelAttributes: + cdef: + KernelHandle _h_kernel + # _device_id == -1 means "current device" (resolved per access). + # _device_id >= 0 means this view is bound to that specific device. + int _device_id + # Cache is shared across views for the same Kernel: the per-device + # view returned by __getitem__ inherits the parent's dict. + dict _cache + + @staticmethod + cdef KernelAttributes _init(KernelHandle h_kernel) + + cdef KernelAttributes _view_for_device(self, int device_id) + cdef inline int _effective_device_id(self) except? -1 + cdef int _get_cached_attribute(self, int device_id, cydriver.CUfunction_attribute attribute) except? -1 diff --git a/cuda_core/cuda/core/_module.pyi b/cuda_core/cuda/core/_module.pyi new file mode 100644 index 00000000000..5125b99131a --- /dev/null +++ b/cuda_core/cuda/core/_module.pyi @@ -0,0 +1,498 @@ +# This file was generated by stubgen-pyx v0.2.6 from cuda_core/cuda/core/_module.pyx + +from __future__ import annotations + +from collections import namedtuple +from os import PathLike + +import cython +from cuda.core._device import Device +from cuda.core._launch_config import LaunchConfig +from cuda.core._stream import Stream +from cuda.core._utils.cuda_utils import driver + + +class KernelAttributes: + """Read-only view of a kernel's per-device attributes. + + The default view returned by :attr:`Kernel.attributes` is bound to + the current device, resolved at attribute-access time. Use + ``kernel.attributes[device]`` to obtain a view bound to a specific + device (an :class:`int` device ordinal or :class:`Device`). Per-device + views share the underlying cache so a value queried through one view + is visible through the others. + """ + + def __init__(self, *args, **kwargs) -> None: + ... + + def __getitem__(self, device: Device | int) -> KernelAttributes: + """Return a view of these attributes bound to a specific device. + + Parameters + ---------- + device : Device or int + The device whose attributes to query. Accepts a :class:`Device` + or a device ordinal (:class:`int`). + + Returns + ------- + KernelAttributes + A view bound to ``device`` that shares the underlying cache + with this view. + """ + + @property + def max_threads_per_block(self) -> int: + """int : The maximum number of threads per block. + This attribute is read-only.""" + + @property + def shared_size_bytes(self) -> int: + """int : The size in bytes of statically-allocated shared memory required by this function. + This attribute is read-only.""" + + @property + def const_size_bytes(self) -> int: + """int : The size in bytes of user-allocated constant memory required by this function. + This attribute is read-only.""" + + @property + def local_size_bytes(self) -> int: + """int : The size in bytes of local memory used by each thread of this function. + This attribute is read-only.""" + + @property + def num_regs(self) -> int: + """int : The number of registers used by each thread of this function. + This attribute is read-only.""" + + @property + def ptx_version(self) -> int: + """int : The PTX virtual architecture version for which the function was compiled. + This attribute is read-only.""" + + @property + def binary_version(self) -> int: + """int : The binary architecture version for which the function was compiled. + This attribute is read-only.""" + + @property + def cache_mode_ca(self) -> bool: + """bool : Whether the function has been compiled with user specified option "-Xptxas --dlcm=ca" set. + This attribute is read-only.""" + + @property + def max_dynamic_shared_size_bytes(self) -> int: + """int : The maximum size in bytes of dynamically-allocated shared memory that can be used + by this function.""" + + @property + def preferred_shared_memory_carveout(self) -> int: + """int : The shared memory carveout preference, in percent of the total shared memory.""" + + @property + def cluster_size_must_be_set(self) -> bool: + """bool : The kernel must launch with a valid cluster size specified. + This attribute is read-only.""" + + @property + def required_cluster_width(self) -> int: + """int : The required cluster width in blocks.""" + + @property + def required_cluster_height(self) -> int: + """int : The required cluster height in blocks.""" + + @property + def required_cluster_depth(self) -> int: + """int : The required cluster depth in blocks.""" + + @property + def non_portable_cluster_size_allowed(self) -> bool: + """bool : Whether the function can be launched with non-portable cluster size.""" + + @property + def cluster_scheduling_policy_preference(self) -> int: + """int : The block scheduling policy of a function.""" + +class KernelOccupancy: + """This class offers methods to query occupancy metrics that help determine optimal + launch parameters such as block size, grid size, and shared memory usage. + """ + + def __init__(self, *args, **kwargs) -> None: + ... + + def max_active_blocks_per_multiprocessor(self, block_size: int, dynamic_shared_memory_size: int) -> int: + """Occupancy of the kernel. + + Returns the maximum number of active blocks per multiprocessor for this kernel. + + Parameters + ---------- + block_size: int + Block size parameter used to launch this kernel. + dynamic_shared_memory_size: int + The amount of dynamic shared memory in bytes needed by block. + Use `0` if block does not need shared memory. + + Returns + ------- + int + The maximum number of active blocks per multiprocessor. + + Note + ---- + The fraction of the product of maximum number of active blocks per multiprocessor + and the block size to the maximum number of threads per multiprocessor is known as + theoretical multiprocessor utilization (occupancy). + + """ + + def max_potential_block_size(self, dynamic_shared_memory_needed: int | driver.CUoccupancyB2DSize, block_size_limit: int) -> MaxPotentialBlockSizeOccupancyResult: + """MaxPotentialBlockSizeOccupancyResult: Suggested launch configuration for reasonable occupancy. + + Returns the minimum grid size needed to achieve the maximum occupancy and + the maximum block size that can achieve the maximum occupancy. + + Parameters + ---------- + dynamic_shared_memory_needed: Union[int, driver.CUoccupancyB2DSize] + The amount of dynamic shared memory in bytes needed by block. + Use `0` if block does not need shared memory. Use C-callable + represented by :obj:`~driver.CUoccupancyB2DSize` to encode + amount of needed dynamic shared memory which varies depending + on tne block size. + block_size_limit: int + Known upper limit on the kernel block size. Use `0` to indicate + the maximum block size permitted by the device / kernel instead + + Returns + ------- + :obj:`~MaxPotentialBlockSizeOccupancyResult` + An object with `min_grid_size` and `max_block_size` attributes encoding + the suggested launch configuration. + + Note + ---- + Please be advised that use of C-callable that requires Python Global + Interpreter Lock may lead to deadlocks. + + """ + + def available_dynamic_shared_memory_per_block(self, num_blocks_per_multiprocessor: int, block_size: int) -> int: + """Dynamic shared memory available per block for given launch configuration. + + The amount of dynamic shared memory per block, in bytes, for given kernel launch configuration. + + Parameters + ---------- + num_blocks_per_multiprocessor: int + Number of blocks to be concurrently executing on a multiprocessor. + block_size: int + Block size parameter used to launch this kernel. + + Returns + ------- + int + Dynamic shared memory available per block for given launch configuration. + """ + + def max_potential_cluster_size(self, config: LaunchConfig, *, stream: Stream) -> int: + """Maximum potential cluster size. + + The maximum potential cluster size for this kernel and given launch configuration. + + Parameters + ---------- + config: :obj:`~_launch_config.LaunchConfig` + Kernel launch configuration. Cluster dimensions in the configuration are ignored. + stream: :obj:`~Stream` + Keyword-only. The stream on which this kernel is to be launched. + Must be passed explicitly; pass ``device.default_stream`` to + use the default stream. + + Returns + ------- + int + The maximum cluster size that can be launched for this kernel and launch configuration. + """ + + def max_active_clusters(self, config: LaunchConfig, *, stream: Stream) -> int: + """Maximum number of active clusters on the target device. + + The maximum number of clusters that could concurrently execute on the target device. + + Parameters + ---------- + config: :obj:`~_launch_config.LaunchConfig` + Kernel launch configuration. + stream: :obj:`~Stream` + Keyword-only. The stream on which this kernel is to be launched. + Must be passed explicitly; pass ``device.default_stream`` to + use the default stream. + + Returns + ------- + int + The maximum number of clusters that could co-exist on the target device. + """ + +class Kernel: + """Represent a compiled kernel that had been loaded onto the device. + + Kernel instances can execution when passed directly into the + :func:`~launch` function. + + Directly creating a :obj:`~_module.Kernel` is not supported, and they + should instead be created through a :obj:`~_module.ObjectCode` object. + + """ + + def __init__(self, *args, **kwargs) -> None: + ... + + @property + @cython.critical_section + def attributes(self) -> KernelAttributes: + """Get the read-only attributes of this kernel.""" + + @property + def num_arguments(self) -> int: + """int : The number of arguments of this function""" + + @property + def arguments_info(self) -> list[ParamInfo]: + """list[ParamInfo]: (offset, size) for each argument of this function""" + + @property + @cython.critical_section + def occupancy(self) -> KernelOccupancy: + """Get the occupancy information for launching this kernel.""" + + @property + def handle(self) -> object: + """Return the underlying kernel handle object. + + .. caution:: + + This handle is a Python object. To get the memory address of the underlying C + handle, call ``int(Kernel.handle)``. + """ + + @property + def _handle(self) -> object: + ... + + @staticmethod + def from_handle(handle, mod: ObjectCode | None=None) -> Kernel: + """Creates a new :obj:`Kernel` object from a kernel handle. + + Parameters + ---------- + handle : int + Kernel handle representing the address of a foreign + kernel object (CUkernel). + mod : :obj:`ObjectCode`, optional + The ObjectCode object associated with this kernel. Provides + library lifetime for foreign kernels not created by + cuda.core. + """ + + def __eq__(self, other: object) -> bool: + ... + + def __hash__(self) -> int: + ... + + def __repr__(self) -> str: + ... + +class ObjectCode: + """Represent a compiled program to be loaded onto the device. + + This object provides a unified interface for different types of + compiled programs that will be loaded onto the device. + + Note + ---- + This class has no default constructor. If you already have a cubin that you would + like to load, use the :meth:`from_cubin` alternative constructor. Constructing directly + from all other possible code types should be avoided in favor of compilation through + :class:`~cuda.core.Program` + """ + + def __init__(self, *args, **kwargs) -> None: + ... + + @classmethod + def _init(cls, module, code_type, *, name: str='', symbol_mapping: dict[str, str] | None=None) -> ObjectCode: + ... + + @staticmethod + def _reduce_helper(module, code_type, name, symbol_mapping): + ... + + def __reduce__(self) -> tuple[object, ...]: + ... + + @staticmethod + def from_cubin(module: bytes | str | PathLike[str], *, name: str='', symbol_mapping: dict[str, str] | None=None) -> ObjectCode: + """Create an :class:`ObjectCode` instance from an existing cubin. + + Parameters + ---------- + module : Union[bytes, str, os.PathLike] + Either a bytes object containing the in-memory cubin to load, or + a file path object (or its string representation) pointing to the + on-disk cubin to load. + name : Optional[str] + A human-readable identifier representing this code object. + symbol_mapping : Optional[dict] + A dictionary specifying how the unmangled symbol names (as keys) + should be mapped to the mangled names before trying to retrieve + them (default to no mappings). + """ + + @staticmethod + def from_ptx(module: bytes | str | PathLike[str], *, name: str='', symbol_mapping: dict[str, str] | None=None) -> ObjectCode: + """Create an :class:`ObjectCode` instance from an existing PTX. + + Parameters + ---------- + module : Union[bytes, str, os.PathLike] + Either a bytes object containing the in-memory ptx code to load, or + a file path object (or its string representation) pointing to the + on-disk ptx file to load. + name : Optional[str] + A human-readable identifier representing this code object. + symbol_mapping : Optional[dict] + A dictionary specifying how the unmangled symbol names (as keys) + should be mapped to the mangled names before trying to retrieve + them (default to no mappings). + """ + + @staticmethod + def from_ltoir(module: bytes | str | PathLike[str], *, name: str='', symbol_mapping: dict[str, str] | None=None) -> ObjectCode: + """Create an :class:`ObjectCode` instance from an existing LTOIR. + + Parameters + ---------- + module : Union[bytes, str, os.PathLike] + Either a bytes object containing the in-memory ltoir code to load, + or a file path object (or its string representation) pointing to the + on-disk ltoir file to load. + name : Optional[str] + A human-readable identifier representing this code object. + symbol_mapping : Optional[dict] + A dictionary specifying how the unmangled symbol names (as keys) + should be mapped to the mangled names before trying to retrieve + them (default to no mappings). + """ + + @staticmethod + def from_fatbin(module: bytes | str | PathLike[str], *, name: str='', symbol_mapping: dict[str, str] | None=None) -> ObjectCode: + """Create an :class:`ObjectCode` instance from an existing fatbin. + + Parameters + ---------- + module : Union[bytes, str, os.PathLike] + Either a bytes object containing the in-memory fatbin to load, or + or a file path object (or its string representation) pointing to the + on-disk fatbin to load. + name : Optional[str] + A human-readable identifier representing this code object. + symbol_mapping : Optional[dict] + A dictionary specifying how the unmangled symbol names (as keys) + should be mapped to the mangled names before trying to retrieve + them (default to no mappings). + """ + + @staticmethod + def from_object(module: bytes | str, *, name: str='', symbol_mapping: dict[str, str] | None=None) -> ObjectCode: + """Create an :class:`ObjectCode` instance from an existing object code. + + Parameters + ---------- + module : Union[bytes, str] + Either a bytes object containing the in-memory object code to load, or + a file path string pointing to the on-disk object code to load. + name : Optional[str] + A human-readable identifier representing this code object. + symbol_mapping : Optional[dict] + A dictionary specifying how the unmangled symbol names (as keys) + should be mapped to the mangled names before trying to retrieve + them (default to no mappings). + """ + + @staticmethod + def from_library(module: bytes | str, *, name: str='', symbol_mapping: dict[str, str] | None=None) -> ObjectCode: + """Create an :class:`ObjectCode` instance from an existing library. + + Parameters + ---------- + module : Union[bytes, str] + Either a bytes object containing the in-memory library to load, or + a file path string pointing to the on-disk library to load. + name : Optional[str] + A human-readable identifier representing this code object. + symbol_mapping : Optional[dict] + A dictionary specifying how the unmangled symbol names (as keys) + should be mapped to the mangled names before trying to retrieve + them (default to no mappings). + """ + + def get_kernel(self, name: str | bytes) -> Kernel: + """Return the :obj:`~_module.Kernel` of a specified name from this object code. + + Parameters + ---------- + name : str | bytes + Name of the kernel to retrieve. + + Returns + ------- + :obj:`~_module.Kernel` + Newly created kernel object. + + """ + + @property + def code(self) -> CodeTypeT: + """Return the underlying code object.""" + + @property + def name(self) -> str: + """Return a human-readable name of this code object.""" + + @property + def code_type(self) -> str: + """Return the type of the underlying code object.""" + + @property + def symbol_mapping(self) -> dict[str, str]: + """Return a copy of the symbol mapping dictionary.""" + + @property + def handle(self) -> object: + """Return the underlying handle object. + + .. caution:: + + This handle is a Python object. To get the memory address of the underlying C + handle, call ``int(ObjectCode.handle)``. + """ + + def __eq__(self, other: object) -> bool: + ... + + def __hash__(self) -> int: + ... + + def __repr__(self) -> str: + ... +__all__ = ['Kernel', 'ObjectCode'] +MaxPotentialBlockSizeOccupancyResult = namedtuple('MaxPotentialBlockSizeOccupancyResult', ('min_grid_size', 'max_block_size')) +ParamInfo = namedtuple('ParamInfo', ['offset', 'size']) +CodeTypeT = bytes | bytearray | str \ No newline at end of file diff --git a/cuda_core/cuda/core/_module.pyx b/cuda_core/cuda/core/_module.pyx new file mode 100644 index 00000000000..91c8ad43895 --- /dev/null +++ b/cuda_core/cuda/core/_module.pyx @@ -0,0 +1,847 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from __future__ import annotations + +cimport cython +from libc.stddef cimport size_t + +from collections import namedtuple +from os import fsencode, fspath, PathLike + +from cuda.core._device import Device +from cuda.core._launch_config cimport LaunchConfig +from cuda.core._launch_config import LaunchConfig +from cuda.core._stream cimport Stream, Stream_accept +from cuda.core._program import ObjectCodeFormatType +from cuda.core._resource_handles cimport ( + LibraryHandle, + KernelHandle, + create_library_handle_from_file, + create_library_handle_from_data, + create_kernel_handle, + create_kernel_handle_ref, + get_kernel_library, + get_last_error, + as_cu, + as_py, + as_intptr, +) +from cuda.core._stream import Stream +from cuda.core._utils.clear_error_support import ( + assert_type_str_or_bytes_like, + raise_code_path_meant_to_be_unreachable, +) +from cuda.core._utils.cuda_utils cimport HANDLE_RETURN +from cuda.core._utils.version cimport cy_binding_version, cy_driver_version +from cuda.core._utils.cuda_utils import driver +from cuda.bindings cimport cydriver + +__all__ = ["Kernel", "ObjectCode"] + + +cdef class KernelAttributes: + """Read-only view of a kernel's per-device attributes. + + The default view returned by :attr:`Kernel.attributes` is bound to + the current device, resolved at attribute-access time. Use + ``kernel.attributes[device]`` to obtain a view bound to a specific + device (an :class:`int` device ordinal or :class:`Device`). Per-device + views share the underlying cache so a value queried through one view + is visible through the others. + """ + + def __init__(self, *args, **kwargs) -> None: + raise RuntimeError("KernelAttributes cannot be instantiated directly. Please use Kernel APIs.") + + @staticmethod + cdef KernelAttributes _init(KernelHandle h_kernel): + cdef KernelAttributes self = KernelAttributes.__new__(KernelAttributes) + self._h_kernel = h_kernel + self._device_id = -1 + self._cache = {} + return self + + cdef KernelAttributes _view_for_device(self, int device_id): + cdef KernelAttributes view = KernelAttributes.__new__(KernelAttributes) + view._h_kernel = self._h_kernel + view._device_id = device_id + view._cache = self._cache + return view + + cdef inline int _effective_device_id(self) except? -1: + if self._device_id >= 0: + return self._device_id + return Device().device_id + + cdef int _get_cached_attribute(self, int device_id, cydriver.CUfunction_attribute attribute) except? -1: + """Helper function to get a cached attribute or fetch and cache it if not present.""" + cdef tuple cache_key = (device_id, attribute) + cached = self._cache.get(cache_key, cache_key) + if cached is not cache_key: + return cached + cdef int result + with nogil: + HANDLE_RETURN(cydriver.cuKernelGetAttribute(&result, attribute, as_cu(self._h_kernel), device_id)) + self._cache[cache_key] = result # setdefault not needed for ints + return result + + def __getitem__(self, device: Device | int) -> KernelAttributes: + """Return a view of these attributes bound to a specific device. + + Parameters + ---------- + device : Device or int + The device whose attributes to query. Accepts a :class:`Device` + or a device ordinal (:class:`int`). + + Returns + ------- + KernelAttributes + A view bound to ``device`` that shares the underlying cache + with this view. + """ + return self._view_for_device(Device(device).device_id) + + @property + def max_threads_per_block(self) -> int: + """int : The maximum number of threads per block. + This attribute is read-only.""" + return self._get_cached_attribute( + self._effective_device_id(), cydriver.CU_FUNC_ATTRIBUTE_MAX_THREADS_PER_BLOCK + ) + + @property + def shared_size_bytes(self) -> int: + """int : The size in bytes of statically-allocated shared memory required by this function. + This attribute is read-only.""" + return self._get_cached_attribute( + self._effective_device_id(), cydriver.CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES + ) + + @property + def const_size_bytes(self) -> int: + """int : The size in bytes of user-allocated constant memory required by this function. + This attribute is read-only.""" + return self._get_cached_attribute( + self._effective_device_id(), cydriver.CU_FUNC_ATTRIBUTE_CONST_SIZE_BYTES + ) + + @property + def local_size_bytes(self) -> int: + """int : The size in bytes of local memory used by each thread of this function. + This attribute is read-only.""" + return self._get_cached_attribute( + self._effective_device_id(), cydriver.CU_FUNC_ATTRIBUTE_LOCAL_SIZE_BYTES + ) + + @property + def num_regs(self) -> int: + """int : The number of registers used by each thread of this function. + This attribute is read-only.""" + return self._get_cached_attribute( + self._effective_device_id(), cydriver.CU_FUNC_ATTRIBUTE_NUM_REGS + ) + + @property + def ptx_version(self) -> int: + """int : The PTX virtual architecture version for which the function was compiled. + This attribute is read-only.""" + return self._get_cached_attribute( + self._effective_device_id(), cydriver.CU_FUNC_ATTRIBUTE_PTX_VERSION + ) + + @property + def binary_version(self) -> int: + """int : The binary architecture version for which the function was compiled. + This attribute is read-only.""" + return self._get_cached_attribute( + self._effective_device_id(), cydriver.CU_FUNC_ATTRIBUTE_BINARY_VERSION + ) + + @property + def cache_mode_ca(self) -> bool: + """bool : Whether the function has been compiled with user specified option "-Xptxas --dlcm=ca" set. + This attribute is read-only.""" + return bool( + self._get_cached_attribute( + self._effective_device_id(), cydriver.CU_FUNC_ATTRIBUTE_CACHE_MODE_CA + ) + ) + + @property + def max_dynamic_shared_size_bytes(self) -> int: + """int : The maximum size in bytes of dynamically-allocated shared memory that can be used + by this function.""" + return self._get_cached_attribute( + self._effective_device_id(), cydriver.CU_FUNC_ATTRIBUTE_MAX_DYNAMIC_SHARED_SIZE_BYTES + ) + + @property + def preferred_shared_memory_carveout(self) -> int: + """int : The shared memory carveout preference, in percent of the total shared memory.""" + return self._get_cached_attribute( + self._effective_device_id(), cydriver.CU_FUNC_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT + ) + + @property + def cluster_size_must_be_set(self) -> bool: + """bool : The kernel must launch with a valid cluster size specified. + This attribute is read-only.""" + return bool( + self._get_cached_attribute( + self._effective_device_id(), cydriver.CU_FUNC_ATTRIBUTE_CLUSTER_SIZE_MUST_BE_SET + ) + ) + + @property + def required_cluster_width(self) -> int: + """int : The required cluster width in blocks.""" + return self._get_cached_attribute( + self._effective_device_id(), cydriver.CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_WIDTH + ) + + @property + def required_cluster_height(self) -> int: + """int : The required cluster height in blocks.""" + return self._get_cached_attribute( + self._effective_device_id(), cydriver.CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_HEIGHT + ) + + @property + def required_cluster_depth(self) -> int: + """int : The required cluster depth in blocks.""" + return self._get_cached_attribute( + self._effective_device_id(), cydriver.CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_DEPTH + ) + + @property + def non_portable_cluster_size_allowed(self) -> bool: + """bool : Whether the function can be launched with non-portable cluster size.""" + return bool( + self._get_cached_attribute( + self._effective_device_id(), + cydriver.CU_FUNC_ATTRIBUTE_NON_PORTABLE_CLUSTER_SIZE_ALLOWED, + ) + ) + + @property + def cluster_scheduling_policy_preference(self) -> int: + """int : The block scheduling policy of a function.""" + return self._get_cached_attribute( + self._effective_device_id(), + cydriver.CU_FUNC_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE, + ) + + +MaxPotentialBlockSizeOccupancyResult = namedtuple( + "MaxPotentialBlockSizeOccupancyResult", ("min_grid_size", "max_block_size") +) + + +cdef class KernelOccupancy: + """This class offers methods to query occupancy metrics that help determine optimal + launch parameters such as block size, grid size, and shared memory usage. + """ + + def __init__(self, *args, **kwargs) -> None: + raise RuntimeError("KernelOccupancy cannot be instantiated directly. Please use Kernel APIs.") + + @staticmethod + cdef KernelOccupancy _init(KernelHandle h_kernel): + cdef KernelOccupancy self = KernelOccupancy.__new__(KernelOccupancy) + self._h_kernel = h_kernel + return self + + def max_active_blocks_per_multiprocessor(self, block_size: int, dynamic_shared_memory_size: int) -> int: + """Occupancy of the kernel. + + Returns the maximum number of active blocks per multiprocessor for this kernel. + + Parameters + ---------- + block_size: int + Block size parameter used to launch this kernel. + dynamic_shared_memory_size: int + The amount of dynamic shared memory in bytes needed by block. + Use `0` if block does not need shared memory. + + Returns + ------- + int + The maximum number of active blocks per multiprocessor. + + Note + ---- + The fraction of the product of maximum number of active blocks per multiprocessor + and the block size to the maximum number of threads per multiprocessor is known as + theoretical multiprocessor utilization (occupancy). + + """ + cdef int num_blocks + cdef int c_block_size = block_size + cdef size_t c_shmem_size = dynamic_shared_memory_size + cdef cydriver.CUfunction func = as_cu(self._h_kernel) + with nogil: + HANDLE_RETURN(cydriver.cuOccupancyMaxActiveBlocksPerMultiprocessor( + &num_blocks, func, c_block_size, c_shmem_size + )) + return num_blocks + + def max_potential_block_size( + self, dynamic_shared_memory_needed: int | driver.CUoccupancyB2DSize, block_size_limit: int + ) -> MaxPotentialBlockSizeOccupancyResult: + """MaxPotentialBlockSizeOccupancyResult: Suggested launch configuration for reasonable occupancy. + + Returns the minimum grid size needed to achieve the maximum occupancy and + the maximum block size that can achieve the maximum occupancy. + + Parameters + ---------- + dynamic_shared_memory_needed: Union[int, driver.CUoccupancyB2DSize] + The amount of dynamic shared memory in bytes needed by block. + Use `0` if block does not need shared memory. Use C-callable + represented by :obj:`~driver.CUoccupancyB2DSize` to encode + amount of needed dynamic shared memory which varies depending + on tne block size. + block_size_limit: int + Known upper limit on the kernel block size. Use `0` to indicate + the maximum block size permitted by the device / kernel instead + + Returns + ------- + :obj:`~MaxPotentialBlockSizeOccupancyResult` + An object with `min_grid_size` and `max_block_size` attributes encoding + the suggested launch configuration. + + Note + ---- + Please be advised that use of C-callable that requires Python Global + Interpreter Lock may lead to deadlocks. + + """ + cdef int min_grid_size, max_block_size + cdef cydriver.CUfunction func = as_cu(self._h_kernel) + cdef cydriver.CUoccupancyB2DSize callback + cdef size_t c_shmem_size + cdef int c_block_size_limit = block_size_limit + if isinstance(dynamic_shared_memory_needed, int): + c_shmem_size = dynamic_shared_memory_needed + with nogil: + HANDLE_RETURN(cydriver.cuOccupancyMaxPotentialBlockSize( + &min_grid_size, &max_block_size, func, NULL, c_shmem_size, c_block_size_limit + )) + elif isinstance(dynamic_shared_memory_needed, driver.CUoccupancyB2DSize): + # Callback may require GIL, so don't use nogil here + callback = dynamic_shared_memory_needed.getPtr() + HANDLE_RETURN(cydriver.cuOccupancyMaxPotentialBlockSize( + &min_grid_size, &max_block_size, func, callback, 0, c_block_size_limit + )) + else: + raise TypeError( + "dynamic_shared_memory_needed expected to have type int, or CUoccupancyB2DSize, " + f"got {type(dynamic_shared_memory_needed)}" + ) + return MaxPotentialBlockSizeOccupancyResult(min_grid_size=min_grid_size, max_block_size=max_block_size) + + def available_dynamic_shared_memory_per_block(self, num_blocks_per_multiprocessor: int, block_size: int) -> int: + """Dynamic shared memory available per block for given launch configuration. + + The amount of dynamic shared memory per block, in bytes, for given kernel launch configuration. + + Parameters + ---------- + num_blocks_per_multiprocessor: int + Number of blocks to be concurrently executing on a multiprocessor. + block_size: int + Block size parameter used to launch this kernel. + + Returns + ------- + int + Dynamic shared memory available per block for given launch configuration. + """ + cdef size_t dynamic_smem_size + cdef int c_num_blocks = num_blocks_per_multiprocessor + cdef int c_block_size = block_size + cdef cydriver.CUfunction func = as_cu(self._h_kernel) + with nogil: + HANDLE_RETURN(cydriver.cuOccupancyAvailableDynamicSMemPerBlock( + &dynamic_smem_size, func, c_num_blocks, c_block_size + )) + return dynamic_smem_size + + def max_potential_cluster_size(self, config: LaunchConfig, *, stream: Stream) -> int: + """Maximum potential cluster size. + + The maximum potential cluster size for this kernel and given launch configuration. + + Parameters + ---------- + config: :obj:`~_launch_config.LaunchConfig` + Kernel launch configuration. Cluster dimensions in the configuration are ignored. + stream: :obj:`~Stream` + Keyword-only. The stream on which this kernel is to be launched. + Must be passed explicitly; pass ``device.default_stream`` to + use the default stream. + + Returns + ------- + int + The maximum cluster size that can be launched for this kernel and launch configuration. + """ + cdef cydriver.CUlaunchConfig drv_cfg = (config)._to_native_launch_config() + cdef Stream s = Stream_accept(stream) + drv_cfg.hStream = as_cu(s._h_stream) + cdef int cluster_size + cdef cydriver.CUfunction func = as_cu(self._h_kernel) + with nogil: + HANDLE_RETURN(cydriver.cuOccupancyMaxPotentialClusterSize(&cluster_size, func, &drv_cfg)) + return cluster_size + + def max_active_clusters(self, config: LaunchConfig, *, stream: Stream) -> int: + """Maximum number of active clusters on the target device. + + The maximum number of clusters that could concurrently execute on the target device. + + Parameters + ---------- + config: :obj:`~_launch_config.LaunchConfig` + Kernel launch configuration. + stream: :obj:`~Stream` + Keyword-only. The stream on which this kernel is to be launched. + Must be passed explicitly; pass ``device.default_stream`` to + use the default stream. + + Returns + ------- + int + The maximum number of clusters that could co-exist on the target device. + """ + cdef cydriver.CUlaunchConfig drv_cfg = (config)._to_native_launch_config() + cdef Stream s = Stream_accept(stream) + drv_cfg.hStream = as_cu(s._h_stream) + cdef int num_clusters + cdef cydriver.CUfunction func = as_cu(self._h_kernel) + with nogil: + HANDLE_RETURN(cydriver.cuOccupancyMaxActiveClusters(&num_clusters, func, &drv_cfg)) + return num_clusters + + +ParamInfo = namedtuple("ParamInfo", ["offset", "size"]) + + +cdef class Kernel: + """Represent a compiled kernel that had been loaded onto the device. + + Kernel instances can execution when passed directly into the + :func:`~launch` function. + + Directly creating a :obj:`~_module.Kernel` is not supported, and they + should instead be created through a :obj:`~_module.ObjectCode` object. + + """ + + def __init__(self, *args, **kwargs) -> None: + raise RuntimeError("Kernel objects cannot be instantiated directly. Please use ObjectCode APIs.") + + @staticmethod + cdef Kernel _from_handle(KernelHandle h_kernel): + cdef Kernel ker = Kernel.__new__(Kernel) + ker._h_kernel = h_kernel + ker._attributes = None + ker._occupancy = None + return ker + + @property + @cython.critical_section + def attributes(self) -> KernelAttributes: + """Get the read-only attributes of this kernel.""" + if self._attributes is None: + self._attributes = KernelAttributes._init(self._h_kernel) + return self._attributes + + cdef tuple _get_arguments_info(self, bint param_info=False): + if cy_driver_version() < (12, 4, 0): + raise NotImplementedError( + "Driver version 12.4 or newer is required for this function. " + f"Using driver version {'.'.join(map(str, cy_driver_version()))}" + ) + if cy_binding_version() < (12, 4, 0): + raise NotImplementedError( + "cuda.bindings 12.4 or newer is required for this function. " + f"Using binding version {'.'.join(map(str, cy_binding_version()))}" + ) + cdef size_t arg_pos = 0 + cdef list param_info_data = [] + cdef cydriver.CUkernel cu_kernel = as_cu(self._h_kernel) + cdef size_t param_offset, param_size + cdef cydriver.CUresult err + while True: + with nogil: + err = cydriver.cuKernelGetParamInfo(cu_kernel, arg_pos, ¶m_offset, ¶m_size) + if err != cydriver.CUDA_SUCCESS: + break + if param_info: + param_info_data.append(ParamInfo(offset=param_offset, size=param_size)) + arg_pos = arg_pos + 1 + if err != cydriver.CUDA_ERROR_INVALID_VALUE: + HANDLE_RETURN(err) + return arg_pos, param_info_data + + @property + def num_arguments(self) -> int: + """int : The number of arguments of this function""" + num_args, _ = self._get_arguments_info() + return num_args + + @property + def arguments_info(self) -> list[ParamInfo]: + """list[ParamInfo]: (offset, size) for each argument of this function""" + _, param_info = self._get_arguments_info(param_info=True) + return param_info + + @property + @cython.critical_section + def occupancy(self) -> KernelOccupancy: + """Get the occupancy information for launching this kernel.""" + if self._occupancy is None: + self._occupancy = KernelOccupancy._init(self._h_kernel) + return self._occupancy + + @property + def handle(self) -> object: + """Return the underlying kernel handle object. + + .. caution:: + + This handle is a Python object. To get the memory address of the underlying C + handle, call ``int(Kernel.handle)``. + """ + return as_py(self._h_kernel) + + @property + def _handle(self) -> object: + return self.handle + + @staticmethod + def from_handle(handle, mod: ObjectCode | None = None) -> Kernel: + """Creates a new :obj:`Kernel` object from a kernel handle. + + Parameters + ---------- + handle : int + Kernel handle representing the address of a foreign + kernel object (CUkernel). + mod : :obj:`ObjectCode`, optional + The ObjectCode object associated with this kernel. Provides + library lifetime for foreign kernels not created by + cuda.core. + """ + + if not isinstance(handle, int): + raise TypeError(f"handle must be an integer, got {type(handle).__name__}") + + cdef cydriver.CUkernel cu_kernel = handle + cdef KernelHandle h_kernel = create_kernel_handle_ref(cu_kernel) + if not h_kernel: + HANDLE_RETURN(get_last_error()) + + cdef LibraryHandle h_existing_lib = get_kernel_library(h_kernel) + cdef LibraryHandle h_caller_lib + + if mod is not None: + h_caller_lib = (mod)._h_library + if h_existing_lib and h_caller_lib: + if as_cu(h_existing_lib) != as_cu(h_caller_lib): + import warnings + warnings.warn( + "The library from the provided ObjectCode does not match " + "the library associated with this kernel.", + stacklevel=2, + ) + + cdef Kernel k = Kernel._from_handle(h_kernel) + if mod is not None and not h_existing_lib: + k._keepalive = mod + return k + + def __eq__(self, other: object) -> bool: + if not isinstance(other, Kernel): + return NotImplemented + return as_intptr(self._h_kernel) == as_intptr((other)._h_kernel) + + def __hash__(self) -> int: + return hash(as_intptr(self._h_kernel)) + + def __repr__(self) -> str: + return f"" + + +CodeTypeT = bytes | bytearray | str + +cdef tuple _supported_code_type = tuple(ObjectCodeFormatType.__members__.values()) + +cdef class ObjectCode: + """Represent a compiled program to be loaded onto the device. + + This object provides a unified interface for different types of + compiled programs that will be loaded onto the device. + + Note + ---- + This class has no default constructor. If you already have a cubin that you would + like to load, use the :meth:`from_cubin` alternative constructor. Constructing directly + from all other possible code types should be avoided in favor of compilation through + :class:`~cuda.core.Program` + """ + + def __init__(self, *args, **kwargs) -> None: + raise RuntimeError( + "ObjectCode objects cannot be instantiated directly. " + "Please use ObjectCode APIs (from_cubin, from_ptx) or Program APIs (compile)." + ) + + @classmethod + def _init(cls, module, code_type, *, name: str = "", symbol_mapping: dict[str, str] | None = None) -> ObjectCode: + assert code_type in _supported_code_type, f"{code_type=} is not supported" + cdef ObjectCode self = ObjectCode.__new__(ObjectCode) + + # _h_library is assigned during _lazy_load_module + self._h_library = LibraryHandle() # Empty handle + + self._code_type = str(code_type) + + if isinstance(module, (str, bytes, bytearray)): + self._module = module + elif isinstance(module, PathLike): + self._module = fspath(module) + else: + self._module = module + self._sym_map = {} if symbol_mapping is None else symbol_mapping + self._name = name if name else "" + + return self + + @staticmethod + def _reduce_helper(module, code_type, name, symbol_mapping): + return ObjectCode._init(module, code_type, name=name if name else "", symbol_mapping=symbol_mapping) + + def __reduce__(self) -> tuple[object, ...]: + return ObjectCode._reduce_helper, (self._module, self._code_type, self._name, self._sym_map) + + @staticmethod + def from_cubin(module: bytes | str | PathLike[str], *, name: str = "", symbol_mapping: dict[str, str] | None = None) -> ObjectCode: + """Create an :class:`ObjectCode` instance from an existing cubin. + + Parameters + ---------- + module : Union[bytes, str, os.PathLike] + Either a bytes object containing the in-memory cubin to load, or + a file path object (or its string representation) pointing to the + on-disk cubin to load. + name : Optional[str] + A human-readable identifier representing this code object. + symbol_mapping : Optional[dict] + A dictionary specifying how the unmangled symbol names (as keys) + should be mapped to the mangled names before trying to retrieve + them (default to no mappings). + """ + return ObjectCode._init(module, ObjectCodeFormatType.CUBIN, name=name, symbol_mapping=symbol_mapping) + + @staticmethod + def from_ptx(module: bytes | str | PathLike[str], *, name: str = "", symbol_mapping: dict[str, str] | None = None) -> ObjectCode: + """Create an :class:`ObjectCode` instance from an existing PTX. + + Parameters + ---------- + module : Union[bytes, str, os.PathLike] + Either a bytes object containing the in-memory ptx code to load, or + a file path object (or its string representation) pointing to the + on-disk ptx file to load. + name : Optional[str] + A human-readable identifier representing this code object. + symbol_mapping : Optional[dict] + A dictionary specifying how the unmangled symbol names (as keys) + should be mapped to the mangled names before trying to retrieve + them (default to no mappings). + """ + return ObjectCode._init(module, ObjectCodeFormatType.PTX, name=name, symbol_mapping=symbol_mapping) + + @staticmethod + def from_ltoir(module: bytes | str | PathLike[str], *, name: str = "", symbol_mapping: dict[str, str] | None = None) -> ObjectCode: + """Create an :class:`ObjectCode` instance from an existing LTOIR. + + Parameters + ---------- + module : Union[bytes, str, os.PathLike] + Either a bytes object containing the in-memory ltoir code to load, + or a file path object (or its string representation) pointing to the + on-disk ltoir file to load. + name : Optional[str] + A human-readable identifier representing this code object. + symbol_mapping : Optional[dict] + A dictionary specifying how the unmangled symbol names (as keys) + should be mapped to the mangled names before trying to retrieve + them (default to no mappings). + """ + return ObjectCode._init(module, ObjectCodeFormatType.LTOIR, name=name, symbol_mapping=symbol_mapping) + + @staticmethod + def from_fatbin(module: bytes | str | PathLike[str], *, name: str = "", symbol_mapping: dict[str, str] | None = None) -> ObjectCode: + """Create an :class:`ObjectCode` instance from an existing fatbin. + + Parameters + ---------- + module : Union[bytes, str, os.PathLike] + Either a bytes object containing the in-memory fatbin to load, or + or a file path object (or its string representation) pointing to the + on-disk fatbin to load. + name : Optional[str] + A human-readable identifier representing this code object. + symbol_mapping : Optional[dict] + A dictionary specifying how the unmangled symbol names (as keys) + should be mapped to the mangled names before trying to retrieve + them (default to no mappings). + """ + return ObjectCode._init(module, ObjectCodeFormatType.FATBIN, name=name, symbol_mapping=symbol_mapping) + + @staticmethod + def from_object(module: bytes | str, *, name: str = "", symbol_mapping: dict[str, str] | None = None) -> ObjectCode: + """Create an :class:`ObjectCode` instance from an existing object code. + + Parameters + ---------- + module : Union[bytes, str] + Either a bytes object containing the in-memory object code to load, or + a file path string pointing to the on-disk object code to load. + name : Optional[str] + A human-readable identifier representing this code object. + symbol_mapping : Optional[dict] + A dictionary specifying how the unmangled symbol names (as keys) + should be mapped to the mangled names before trying to retrieve + them (default to no mappings). + """ + return ObjectCode._init(module, ObjectCodeFormatType.OBJECT, name=name, symbol_mapping=symbol_mapping) + + @staticmethod + def from_library(module: bytes | str, *, name: str = "", symbol_mapping: dict[str, str] | None = None) -> ObjectCode: + """Create an :class:`ObjectCode` instance from an existing library. + + Parameters + ---------- + module : Union[bytes, str] + Either a bytes object containing the in-memory library to load, or + a file path string pointing to the on-disk library to load. + name : Optional[str] + A human-readable identifier representing this code object. + symbol_mapping : Optional[dict] + A dictionary specifying how the unmangled symbol names (as keys) + should be mapped to the mangled names before trying to retrieve + them (default to no mappings). + """ + return ObjectCode._init(module, ObjectCodeFormatType.LIBRARY, name=name, symbol_mapping=symbol_mapping) + + # TODO: do we want to unload in a finalizer? Probably not.. + + @cython.critical_section + cdef int _lazy_load_module(self) except -1: + if self._h_library: + return 0 + module = self._module + cdef bytes path_bytes + if isinstance(module, str): + path_bytes = module.encode() + self._h_library = create_library_handle_from_file(path_bytes) + elif isinstance(module, (bytes, bytearray)): + self._h_library = create_library_handle_from_data(module) + elif isinstance(module, PathLike): + path_bytes = fsencode(module) + self._h_library = create_library_handle_from_file(path_bytes) + else: + assert_type_str_or_bytes_like(module) + raise_code_path_meant_to_be_unreachable() + return -1 + if not self._h_library: + HANDLE_RETURN(get_last_error()) + return 0 + + def get_kernel(self, name: str | bytes) -> Kernel: + """Return the :obj:`~_module.Kernel` of a specified name from this object code. + + Parameters + ---------- + name : str | bytes + Name of the kernel to retrieve. + + Returns + ------- + :obj:`~_module.Kernel` + Newly created kernel object. + + """ + self._lazy_load_module() + supported_code_types = (ObjectCodeFormatType.CUBIN, ObjectCodeFormatType.PTX, ObjectCodeFormatType.FATBIN) + if self._code_type not in supported_code_types: + raise RuntimeError(f'Unsupported code type "{self._code_type}" ({supported_code_types=})') + try: + name = self._sym_map[name] + except KeyError: + if isinstance(name, str): + name = name.encode() + + cdef KernelHandle h_kernel = create_kernel_handle(self._h_library, name) + if not h_kernel: + HANDLE_RETURN(get_last_error()) + return Kernel._from_handle(h_kernel) + + @property + def code(self) -> CodeTypeT: + """Return the underlying code object.""" + return self._module + + @property + def name(self) -> str: + """Return a human-readable name of this code object.""" + return self._name + + @property + def code_type(self) -> str: + """Return the type of the underlying code object.""" + return self._code_type + + @property + def symbol_mapping(self) -> dict[str, str]: + """Return a copy of the symbol mapping dictionary.""" + return dict(self._sym_map) + + @property + def handle(self) -> object: + """Return the underlying handle object. + + .. caution:: + + This handle is a Python object. To get the memory address of the underlying C + handle, call ``int(ObjectCode.handle)``. + """ + self._lazy_load_module() + return as_py(self._h_library) + + def __eq__(self, other: object) -> bool: + if not isinstance(other, ObjectCode): + return NotImplemented + # Trigger lazy load for both objects to compare handles + self._lazy_load_module() + (other)._lazy_load_module() + return as_intptr(self._h_library) == as_intptr((other)._h_library) + + def __hash__(self) -> int: + # Trigger lazy load to get the handle + self._lazy_load_module() + return hash(as_intptr(self._h_library)) + + def __repr__(self) -> str: + # Trigger lazy load to get the handle + self._lazy_load_module() + return f"" diff --git a/cuda_core/cuda/core/_program.pxd b/cuda_core/cuda/core/_program.pxd new file mode 100644 index 00000000000..cea430c3f20 --- /dev/null +++ b/cuda_core/cuda/core/_program.pxd @@ -0,0 +1,22 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from ._linker cimport Linker +from ._resource_handles cimport NvrtcProgramHandle, NvvmProgramHandle + + +cdef class Program: + cdef: + NvrtcProgramHandle _h_nvrtc + NvvmProgramHandle _h_nvvm + str _backend + Linker _linker + object _options # ProgramOptions + object __weakref__ + object _compile_lock # Per-instance lock for compile-time mutation + bint _use_libdevice # Flag for libdevice loading + bint _libdevice_added + bytes _code # Source code as bytes: used for key derivation and NVRTC PCH retry + str _code_type # Normalised code_type ("c++", "ptx", "nvvm") + str _pch_status # PCH creation outcome after compile diff --git a/cuda_core/cuda/core/_program.pyi b/cuda_core/cuda/core/_program.pyi new file mode 100644 index 00000000000..df7ed66446a --- /dev/null +++ b/cuda_core/cuda/core/_program.pyi @@ -0,0 +1,440 @@ +# This file was generated by stubgen-pyx v0.2.6 from cuda_core/cuda/core/_program.pyx + +"""Compilation machinery for CUDA programs. + +This module provides :class:`Program` for compiling source code into +:class:`~cuda.core.ObjectCode`, with :class:`ProgramOptions` for configuration. +""" +from __future__ import annotations + +from dataclasses import dataclass + +from cuda.bindings import nvrtc +from cuda.core._linker import LinkerHandleT +from cuda.core._module import ObjectCode +from cuda.core.typing import (CompilerBackendType, ObjectCodeFormatType, + PCHStatusType, SourceCodeType) +from cuda.core.utils._program_cache import ProgramCacheResource + + +class Program: + """Represent a compilation machinery to process programs into + :class:`~cuda.core.ObjectCode`. + + This object provides a unified interface to multiple underlying + compiler libraries. Compilation support is enabled for a wide + range of code types and compilation types. + + Parameters + ---------- + code : str | bytes | bytearray + The source code to compile. For C++ and PTX, must be a string. + For NVVM IR, can be str, bytes, or bytearray. + code_type : SourceCodeType | str + The type of source code. Must be one of ``"c++"``, ``"ptx"``, or ``"nvvm"``. + options : :class:`ProgramOptions`, optional + Options to customize the compilation process. + """ + + def __init__(self, code: str | bytes | bytearray, code_type: SourceCodeType | str, options: ProgramOptions | None=None): + ... + + def close(self) -> None: + """Destroy this program.""" + + def compile(self, target_type: ObjectCodeFormatType | str, name_expressions: tuple[str, ...] | list[str]=..., logs: object=None, *, cache: ProgramCacheResource | None=None) -> ObjectCode: + """Compile the program to the specified target type. + + Parameters + ---------- + target_type : ObjectCodeFormatType | str + The compilation target. Must be one of ``"ptx"``, ``"cubin"``, or ``"ltoir"``. + name_expressions : tuple | list, optional + Sequence of name expressions to make accessible in the compiled code. + Used for template instantiation and similar cases. + logs : object, optional + Object with a ``write`` method to receive compilation logs. + On a cache hit no compilation runs and ``logs`` receives + nothing -- callers that rely on log output to confirm a + compile happened should compile without ``cache=``. + cache : :class:`~cuda.core.utils.ProgramCacheResource`, optional + If provided, the compiled binary is looked up in ``cache`` via a + key derived from the program's code, options, and ``target_type``. + On a hit the cached bytes are wrapped in a fresh + :class:`~cuda.core.ObjectCode` (with the same ``target_type`` + and ``ProgramOptions.name``) and returned without re-compiling; + on a miss the compile output is stored as raw bytes (the cache + extracts ``bytes(object_code.code)``). Passing a non-empty + ``name_expressions`` together with ``cache=`` raises + ``ValueError``: NVRTC populates + ``ObjectCode.symbol_mapping`` at compile time and that mapping + is not carried in the binary the cache stores, so cache hits + would silently miss ``get_kernel(name_expression)`` lookups. + Options that require an ``extra_digest`` (``include_path``, + ``pre_include``, ``pch``, ``use_pch``, ``pch_dir``, NVVM + ``use_libdevice=True``, or NVRTC ``options.name`` with a + directory component) raise ``ValueError`` via + :func:`~cuda.core.utils.make_program_cache_key`; for those + compiles, use the manual ``make_program_cache_key(...)`` + pattern directly. + + ``cache=`` is independent of ``ProgramOptions.no_cache``: the + former controls this program-level cache (compiled-output + reuse across calls), while ``no_cache`` is forwarded to the + Linker to disable its in-process JIT cache for cuLink/nvJitLink. + Setting ``options.no_cache=True`` does not bypass ``cache=``, + and vice-versa. + + Returns + ------- + :class:`~cuda.core.ObjectCode` + The compiled object code. + """ + + @property + def pch_status(self) -> PCHStatusType | None: + """PCH creation outcome from the most recent :meth:`compile` call. + + Possible values: + + * ``"created"`` — PCH file was written successfully. + * ``"not_attempted"`` — PCH creation was not attempted (e.g. the + compiler decided not to, or automatic PCH processing skipped it). + * ``"failed"`` — an error prevented PCH creation. + * ``None`` — PCH was not requested, the program has not been + compiled yet, the backend is not NVRTC (e.g. PTX or NVVM), + or the NVRTC bindings are too old to report status. + + When ``create_pch`` is set in :class:`ProgramOptions` and the PCH + heap is too small, :meth:`compile` automatically resizes the heap + and retries, so ``"created"`` should be the common outcome. + + .. note:: + + PCH is only supported for ``code_type="c++"`` programs that + use the NVRTC backend. For PTX and NVVM programs this property + always returns ``None``. + """ + + @property + def backend(self) -> CompilerBackendType: + """Return this Program instance's underlying :class:`CompilerBackendType`.""" + + @property + def handle(self) -> ProgramHandleT: + """Return the underlying handle object. + + .. note:: + + The type of the returned object depends on the backend. + + .. caution:: + + This handle is a Python object. To get the memory address of the underlying C + handle, call ``int(Program.handle)``. + """ + + def __repr__(self) -> str: + ... + +@dataclass +class ProgramOptions: + """Customizable options for configuring :class:`Program`. + + Attributes + ---------- + name : str, optional + Name of the program. If the compilation succeeds, the name is passed down to the generated :class:`ObjectCode`. + arch : str, optional + Pass the SM architecture value, such as ``sm_`` (for generating CUBIN) or + ``compute_`` (for generating PTX). If not provided, the current device's architecture + will be used. + relocatable_device_code : bool, optional + Enable (disable) the generation of relocatable device code. + Default: False + extensible_whole_program : bool, optional + Do extensible whole program compilation of device code. + Default: False + debug : bool, optional + Generate debug information. If --dopt is not specified, then turns off all optimizations. + Default: False + lineinfo: bool, optional + Generate line-number information. + Default: False + device_code_optimize : bool, optional + Enable device code optimization. When specified along with '-G', enables limited debug information generation + for optimized device code. + Default: None + ptxas_options : Union[str, list[str]], optional + Specify one or more options directly to ptxas, the PTX optimizing assembler. Options should be strings. + For example ["-v", "-O2"]. + Default: None + max_register_count : int, optional + Specify the maximum amount of registers that GPU functions can use. + Default: None + ftz : bool, optional + When performing single-precision floating-point operations, flush denormal values to zero or preserve denormal + values. + Default: False + prec_sqrt : bool, optional + For single-precision floating-point square root, use IEEE round-to-nearest mode or use a faster approximation. + Default: True + prec_div : bool, optional + For single-precision floating-point division and reciprocals, use IEEE round-to-nearest mode or use a faster + approximation. + Default: True + fma : bool, optional + Enables (disables) the contraction of floating-point multiplies and adds/subtracts into floating-point + multiply-add operations. + Default: True + use_fast_math : bool, optional + Make use of fast math operations. + Default: False + extra_device_vectorization : bool, optional + Enables more aggressive device code vectorization in the NVVM optimizer. + Default: False + link_time_optimization : bool, optional + Generate intermediate code for later link-time optimization. + Default: False + gen_opt_lto : bool, optional + Run the optimizer passes before generating the LTO IR. + Default: False + define_macro : Union[str, tuple[str, str], list[Union[str, tuple[str, str]]]], optional + Predefine a macro. Can be either a string, in which case that macro will be set to 1, a 2 element tuple of + strings, in which case the first element is defined as the second, or a list of strings or tuples. + Default: None + undefine_macro : Union[str, list[str]], optional + Cancel any previous definition of a macro, or list of macros. + Default: None + include_path : Union[str, list[str]], optional + Add the directory or directories to the list of directories to be searched for headers. + Default: None + pre_include : Union[str, list[str]], optional + Preinclude one or more headers during preprocessing. Can be either a string or a list of strings. + Default: None + no_source_include : bool, optional + Disable the default behavior of adding the directory of each input source to the include path. + Default: False + std : str, optional + Set language dialect to C++03, C++11, C++14, C++17 or C++20. + Default: c++17 + builtin_move_forward : bool, optional + Provide builtin definitions of std::move and std::forward. + Default: True + builtin_initializer_list : bool, optional + Provide builtin definitions of std::initializer_list class and member functions. + Default: True + disable_warnings : bool, optional + Inhibit all warning messages. + Default: False + restrict : bool, optional + Programmer assertion that all kernel pointer parameters are restrict pointers. + Default: False + device_as_default_execution_space : bool, optional + Treat entities with no execution space annotation as __device__ entities. + Default: False + device_int128 : bool, optional + Allow the __int128 type in device code. + Default: False + optimization_info : str, optional + Provide optimization reports for the specified kind of optimization. + Default: None + no_display_error_number : bool, optional + Disable the display of a diagnostic number for warning messages. + Default: False + diag_error : Union[int, list[int]], optional + Emit error for a specified diagnostic message number or comma-separated list of numbers. + Default: None + diag_suppress : Union[int, list[int]], optional + Suppress a specified diagnostic message number or comma-separated list of numbers. + Default: None + diag_warn : Union[int, list[int]], optional + Emit warning for a specified diagnostic message number or comma-separated list of numbers. + Default: None + brief_diagnostics : bool, optional + Disable or enable showing source line and column info in a diagnostic. + Default: False + time : str, optional + Generate a CSV table with the time taken by each compilation phase. + Default: None + split_compile : int, optional + Perform compiler optimizations in parallel. + Default: 1 + fdevice_syntax_only : bool, optional + Ends device compilation after front-end syntax checking. + Default: False + minimal : bool, optional + Omit certain language features to reduce compile time for small programs. + Default: False + no_cache : bool, optional + Disable compiler caching. + Default: False + fdevice_time_trace : str, optional + Generate time trace JSON for profiling compilation (NVRTC only). + Default: None + device_float128 : bool, optional + Allow __float128 type in device code (NVRTC only). + Default: False + frandom_seed : str, optional + Set random seed for randomized optimizations (NVRTC only). + Default: None + ofast_compile : str, optional + Fast compilation mode: "0", "min", "mid", or "max" (NVRTC only). + Default: None + pch : bool, optional + Use default precompiled header (NVRTC only, CUDA 12.8+). + Default: False + create_pch : str, optional + Create precompiled header file (NVRTC only, CUDA 12.8+). + Default: None + use_pch : str, optional + Use specific precompiled header file (NVRTC only, CUDA 12.8+). + Default: None + pch_dir : str, optional + PCH directory location (NVRTC only, CUDA 12.8+). + Default: None + pch_verbose : bool, optional + Verbose PCH output (NVRTC only, CUDA 12.8+). + Default: False + pch_messages : bool, optional + Control PCH diagnostic messages (NVRTC only, CUDA 12.8+). + Default: False + instantiate_templates_in_pch : bool, optional + Control template instantiation in PCH (NVRTC only, CUDA 12.8+). + Default: False + extra_sources : list of 2-tuples or tuple of 2-tuples, optional + Additional NVVM IR modules to compile together with the main program, specified as + ``((name1, source1), (name2, source2), ...)``. Each name is a string identifier used + in diagnostic messages. Each source can be a string (textual LLVM IR) or bytes/bytearray + (LLVM bitcode). Only supported for the NVVM backend. + Default: None + use_libdevice : bool, optional + Load NVIDIA's `libdevice `_ + math builtins library. Only supported for the NVVM backend. + Default: False + """ + name: str | None = 'default_program' + arch: str | None = None + relocatable_device_code: bool | None = None + extensible_whole_program: bool | None = None + debug: bool | None = None + lineinfo: bool | None = None + device_code_optimize: bool | None = None + ptxas_options: str | list[str] | tuple[str] | None = None + max_register_count: int | None = None + ftz: bool | None = None + prec_sqrt: bool | None = None + prec_div: bool | None = None + fma: bool | None = None + use_fast_math: bool | None = None + extra_device_vectorization: bool | None = None + link_time_optimization: bool | None = None + gen_opt_lto: bool | None = None + define_macro: str | tuple[str, str] | list[str | tuple[str, str]] | tuple[str | tuple[str, str], ...] | None = None + undefine_macro: str | list[str] | tuple[str] | None = None + include_path: str | list[str] | tuple[str] | None = None + pre_include: str | list[str] | tuple[str] | None = None + no_source_include: bool | None = None + std: str | None = None + builtin_move_forward: bool | None = None + builtin_initializer_list: bool | None = None + disable_warnings: bool | None = None + restrict: bool | None = None + device_as_default_execution_space: bool | None = None + device_int128: bool | None = None + optimization_info: str | None = None + no_display_error_number: bool | None = None + diag_error: int | list[int] | tuple[int] | None = None + diag_suppress: int | list[int] | tuple[int] | None = None + diag_warn: int | list[int] | tuple[int] | None = None + brief_diagnostics: bool | None = None + time: str | None = None + split_compile: int | None = None + fdevice_syntax_only: bool | None = None + minimal: bool | None = None + no_cache: bool | None = None + fdevice_time_trace: str | None = None + device_float128: bool | None = None + frandom_seed: str | None = None + ofast_compile: str | None = None + pch: bool | None = None + create_pch: str | None = None + use_pch: str | None = None + pch_dir: str | None = None + pch_verbose: bool | None = None + pch_messages: bool | None = None + instantiate_templates_in_pch: bool | None = None + extra_sources: list[tuple[str, str | bytes | bytearray]] | tuple[tuple[str, str | bytes | bytearray], ...] | None = None + use_libdevice: bool | None = None + numba_debug: bool | None = None + + def __post_init__(self) -> None: + ... + + def _prepare_nvrtc_options(self) -> list[bytes]: + ... + + def _prepare_nvvm_options(self, as_bytes: bool=True) -> list[bytes] | list[str]: + ... + + def as_bytes(self, backend: CompilerBackendType | str, target_type: ObjectCodeFormatType | str | None=None) -> list[bytes]: + """Convert program options to bytes format for the specified backend. + + This method transforms the program options into a format suitable for the + specified compiler backend. Different backends may use different option names + and formats even for the same conceptual options. + + Parameters + ---------- + backend : CompilerBackendType | str + The compiler backend to prepare options for. Must be either "nvrtc" or "nvvm". + target_type : ObjectCodeFormatType | str, optional + The compilation target type (e.g., "ptx", "cubin", "ltoir"). Some backends + require additional options based on the target type. + + Returns + ------- + list[bytes] + List of option strings encoded as bytes. + + Raises + ------ + ValueError + If an unknown backend is specified. + CUDAError + If an option incompatible with the specified backend is set. + + Examples + -------- + >>> options = ProgramOptions(arch="sm_80", debug=True) + >>> nvrtc_options = options.as_bytes("nvrtc") + """ + + def __repr__(self) -> str: + ... + + def _prepare_extra_sources_bytes(self) -> list[tuple[bytes, bytes]] | None: + """Convert extra_sources to bytes format for NVVM.""" +__all__ = ['Program', 'ProgramOptions'] +ProgramHandleT = nvrtc.nvrtcProgram | int | LinkerHandleT +_nvvm_module = None +_nvvm_import_attempted = False + +def _can_load_generated_ptx() -> bool: + """Check if the driver can load PTX generated by the current NVRTC version.""" + +def _program_compile_uncached(program, target_type, name_expressions, logs): + """Run ``Program_compile`` without the cache wrapper. + + Module-level Python function so tests can monkeypatch it from + ``cuda.core._program`` to avoid invoking NVRTC when exercising the cache + wrapper in :meth:`Program.compile`. ``Program`` itself is a ``cdef class`` + and its methods cannot be reassigned from Python, so the seam must live + outside the class. + """ + +def _get_nvvm_module() -> object: + """Get the NVVM module, importing it lazily with availability checks.""" + +def _find_libdevice_path() -> object: + """Find libdevice*.bc for NVVM compilation using cuda.pathfinder.""" \ No newline at end of file diff --git a/cuda_core/cuda/core/_program.pyx b/cuda_core/cuda/core/_program.pyx new file mode 100644 index 00000000000..2b2e5262a2c --- /dev/null +++ b/cuda_core/cuda/core/_program.pyx @@ -0,0 +1,1315 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +"""Compilation machinery for CUDA programs. + +This module provides :class:`Program` for compiling source code into +:class:`~cuda.core.ObjectCode`, with :class:`ProgramOptions` for configuration. +""" + +from __future__ import annotations + +from dataclasses import dataclass +import threading +from typing import TYPE_CHECKING +from warnings import warn + +if TYPE_CHECKING: + from cuda.core.utils._program_cache import ProgramCacheResource # no-cython-lint + +from cuda.bindings import nvrtc +from cuda.pathfinder._optional_cuda_import import _optional_cuda_import + +from libcpp.vector cimport vector + +from ._resource_handles cimport ( + as_cu, + as_py, + create_nvrtc_program_handle, + create_nvvm_program_handle, +) +from cuda.bindings cimport cynvrtc, cynvvm +from cuda.core._utils.cuda_utils cimport HANDLE_RETURN_NVRTC, HANDLE_RETURN_NVVM +from cuda.core._device import Device +from cuda.core._linker import Linker, LinkerHandleT, LinkerOptions +from cuda.core._module import ObjectCode +from cuda.core._utils.clear_error_support import assert_type +from cuda.core._utils.cuda_utils import ( + CUDAError, + _handle_boolean_option, + check_or_create_options, + handle_return, + is_nested_sequence, + is_sequence, +) +from cuda.core._utils.version import binding_version, driver_version +from cuda.core.typing import ObjectCodeFormatType, CompilerBackendType, PCHStatusType, SourceCodeType + +__all__ = ["Program", "ProgramOptions"] + +ProgramHandleT = nvrtc.nvrtcProgram | int | LinkerHandleT +"""Type alias for program handle types across different backends. + +The ``int`` type covers NVVM handles, which don't have a wrapper class. +""" + + +# ============================================================================= +# Principal Class +# ============================================================================= + + +cdef class Program: + """Represent a compilation machinery to process programs into + :class:`~cuda.core.ObjectCode`. + + This object provides a unified interface to multiple underlying + compiler libraries. Compilation support is enabled for a wide + range of code types and compilation types. + + Parameters + ---------- + code : str | bytes | bytearray + The source code to compile. For C++ and PTX, must be a string. + For NVVM IR, can be str, bytes, or bytearray. + code_type : SourceCodeType | str + The type of source code. Must be one of ``"c++"``, ``"ptx"``, or ``"nvvm"``. + options : :class:`ProgramOptions`, optional + Options to customize the compilation process. + """ + def __init__(self, code: str | bytes | bytearray, code_type: SourceCodeType | str, options: ProgramOptions | None = None): + Program_init(self, code, str(code_type), options) + + def close(self) -> None: + """Destroy this program.""" + if self._linker: + self._linker.close() + # Reset handles - the C++ shared_ptr destructor handles cleanup + self._h_nvrtc.reset() + self._h_nvvm.reset() + + def compile( + self, + target_type: ObjectCodeFormatType | str, + name_expressions: tuple[str, ...] | list[str] = (), + logs: object = None, + *, + cache: ProgramCacheResource | None = None, + ) -> ObjectCode: + """Compile the program to the specified target type. + + Parameters + ---------- + target_type : ObjectCodeFormatType | str + The compilation target. Must be one of ``"ptx"``, ``"cubin"``, or ``"ltoir"``. + name_expressions : tuple | list, optional + Sequence of name expressions to make accessible in the compiled code. + Used for template instantiation and similar cases. + logs : object, optional + Object with a ``write`` method to receive compilation logs. + On a cache hit no compilation runs and ``logs`` receives + nothing -- callers that rely on log output to confirm a + compile happened should compile without ``cache=``. + cache : :class:`~cuda.core.utils.ProgramCacheResource`, optional + If provided, the compiled binary is looked up in ``cache`` via a + key derived from the program's code, options, and ``target_type``. + On a hit the cached bytes are wrapped in a fresh + :class:`~cuda.core.ObjectCode` (with the same ``target_type`` + and ``ProgramOptions.name``) and returned without re-compiling; + on a miss the compile output is stored as raw bytes (the cache + extracts ``bytes(object_code.code)``). Passing a non-empty + ``name_expressions`` together with ``cache=`` raises + ``ValueError``: NVRTC populates + ``ObjectCode.symbol_mapping`` at compile time and that mapping + is not carried in the binary the cache stores, so cache hits + would silently miss ``get_kernel(name_expression)`` lookups. + Options that require an ``extra_digest`` (``include_path``, + ``pre_include``, ``pch``, ``use_pch``, ``pch_dir``, NVVM + ``use_libdevice=True``, or NVRTC ``options.name`` with a + directory component) raise ``ValueError`` via + :func:`~cuda.core.utils.make_program_cache_key`; for those + compiles, use the manual ``make_program_cache_key(...)`` + pattern directly. + + ``cache=`` is independent of ``ProgramOptions.no_cache``: the + former controls this program-level cache (compiled-output + reuse across calls), while ``no_cache`` is forwarded to the + Linker to disable its in-process JIT cache for cuLink/nvJitLink. + Setting ``options.no_cache=True`` does not bypass ``cache=``, + and vice-versa. + + Returns + ------- + :class:`~cuda.core.ObjectCode` + The compiled object code. + """ + # Mirror Program_init's code_type normalization so callers can pass + # ``ObjectCodeFormatType.PTX`` or ``"PTX"`` and get the same routing + # / cache key as the lowercase string. ``Program_compile_nvrtc`` + # keys on lowercase ``target_type`` and ``make_program_cache_key`` + # lowercases too. + target_type = str(target_type).lower() + + if cache is None: + return _program_compile_uncached(self, target_type, name_expressions, logs) + + # Deferred import to avoid a circular import between _program and + # cuda.core.utils._program_cache (the cache module already imports + # ProgramOptions from this module). Import from the leaf module so + # tests that monkeypatch make_program_cache_key via that path + # intercept reliably. + from cuda.core.utils._program_cache import ( + ProgramCacheResource, + make_program_cache_key, + ) + + if not isinstance(cache, ProgramCacheResource): + raise TypeError( + "cache must be an instance of " + "cuda.core.utils.ProgramCacheResource; got " + f"{type(cache).__name__}" + ) + + # ``name_expressions`` is incompatible with the cache: NVRTC + # populates ``ObjectCode.symbol_mapping`` from name-expression + # mangling at compile time, and that mapping isn't carried in + # the binary bytes the cache stores. Without this guard the + # first call (cache miss) would return an ObjectCode with + # symbol_mapping populated, while every subsequent call (hit) + # would return one without -- silently breaking later + # ``get_kernel(name_expression)`` lookups that work on the + # uncached path. Fail loud here instead. + if name_expressions: + raise ValueError( + "Program.compile(cache=...) does not support name_expressions: " + "ObjectCode.symbol_mapping is populated by NVRTC at compile " + "time and is not preserved across a cache round-trip, so cache " + "hits would silently break get_kernel(name_expression) lookups " + "that the uncached path supports. Compile without cache= when " + "name_expressions are needed, or look up mangled symbols by " + "hand from the cached ObjectCode." + ) + + # ``self._code`` is always stored as bytes (see ``Program_init``), + # but ``make_program_cache_key`` only accepts bytes when + # ``code_type == "nvvm"`` -- c++/ptx must be ``str``. The bytes + # came from ``code.encode()`` on a ``str`` Program_init validated + # via ``assert_type(code, str)``, so this round-trip is always + # safe; no try/except needed. + code_for_key = self._code if self._code_type == "nvvm" else self._code.decode("utf-8") + + key = make_program_cache_key( + code=code_for_key, + code_type=self._code_type, + options=self._options, + target_type=target_type, + ) + hit_bytes = cache.get(key) + if hit_bytes is not None: + # The uncached NVRTC path warns when the active driver can't + # load freshly-generated PTX; that loadability is a property + # of the driver, not of how the bytes were produced, so the + # warning applies equally to cached PTX. Mirror it here so a + # cache hit doesn't silently hide an incompatibility that the + # uncached call would have surfaced. + if ( + self._backend == "NVRTC" + and target_type == "ptx" + and not _can_load_generated_ptx() + ): + warn( + "The CUDA driver version is older than the backend version. " + "The generated ptx will not be loadable by the current driver.", + stacklevel=2, + category=RuntimeWarning, + ) + return ObjectCode._init(hit_bytes, target_type, name=self._options.name) + compiled = _program_compile_uncached(self, target_type, name_expressions, logs) + cache[key] = compiled + return compiled + + @property + def pch_status(self) -> PCHStatusType | None: + """PCH creation outcome from the most recent :meth:`compile` call. + + Possible values: + + * ``"created"`` — PCH file was written successfully. + * ``"not_attempted"`` — PCH creation was not attempted (e.g. the + compiler decided not to, or automatic PCH processing skipped it). + * ``"failed"`` — an error prevented PCH creation. + * ``None`` — PCH was not requested, the program has not been + compiled yet, the backend is not NVRTC (e.g. PTX or NVVM), + or the NVRTC bindings are too old to report status. + + When ``create_pch`` is set in :class:`ProgramOptions` and the PCH + heap is too small, :meth:`compile` automatically resizes the heap + and retries, so ``"created"`` should be the common outcome. + + .. note:: + + PCH is only supported for ``code_type="c++"`` programs that + use the NVRTC backend. For PTX and NVVM programs this property + always returns ``None``. + """ + if self._pch_status is None: + return None + return PCHStatusType(self._pch_status) + + @property + def backend(self) -> CompilerBackendType: + """Return this Program instance's underlying :class:`CompilerBackendType`.""" + return CompilerBackendType(self._backend) + + @property + def handle(self) -> ProgramHandleT: + """Return the underlying handle object. + + .. note:: + + The type of the returned object depends on the backend. + + .. caution:: + + This handle is a Python object. To get the memory address of the underlying C + handle, call ``int(Program.handle)``. + """ + if self._backend == "NVRTC": + return as_py(self._h_nvrtc) + elif self._backend == "NVVM": + return as_py(self._h_nvvm) # returns int (NVVM uses raw integers) + else: + return self._linker.handle + + def __repr__(self) -> str: + return f"" + + +# ============================================================================= +# Other Public Classes +# ============================================================================= + + +@dataclass +class ProgramOptions: + """Customizable options for configuring :class:`Program`. + + Attributes + ---------- + name : str, optional + Name of the program. If the compilation succeeds, the name is passed down to the generated :class:`ObjectCode`. + arch : str, optional + Pass the SM architecture value, such as ``sm_`` (for generating CUBIN) or + ``compute_`` (for generating PTX). If not provided, the current device's architecture + will be used. + relocatable_device_code : bool, optional + Enable (disable) the generation of relocatable device code. + Default: False + extensible_whole_program : bool, optional + Do extensible whole program compilation of device code. + Default: False + debug : bool, optional + Generate debug information. If --dopt is not specified, then turns off all optimizations. + Default: False + lineinfo: bool, optional + Generate line-number information. + Default: False + device_code_optimize : bool, optional + Enable device code optimization. When specified along with '-G', enables limited debug information generation + for optimized device code. + Default: None + ptxas_options : Union[str, list[str]], optional + Specify one or more options directly to ptxas, the PTX optimizing assembler. Options should be strings. + For example ["-v", "-O2"]. + Default: None + max_register_count : int, optional + Specify the maximum amount of registers that GPU functions can use. + Default: None + ftz : bool, optional + When performing single-precision floating-point operations, flush denormal values to zero or preserve denormal + values. + Default: False + prec_sqrt : bool, optional + For single-precision floating-point square root, use IEEE round-to-nearest mode or use a faster approximation. + Default: True + prec_div : bool, optional + For single-precision floating-point division and reciprocals, use IEEE round-to-nearest mode or use a faster + approximation. + Default: True + fma : bool, optional + Enables (disables) the contraction of floating-point multiplies and adds/subtracts into floating-point + multiply-add operations. + Default: True + use_fast_math : bool, optional + Make use of fast math operations. + Default: False + extra_device_vectorization : bool, optional + Enables more aggressive device code vectorization in the NVVM optimizer. + Default: False + link_time_optimization : bool, optional + Generate intermediate code for later link-time optimization. + Default: False + gen_opt_lto : bool, optional + Run the optimizer passes before generating the LTO IR. + Default: False + define_macro : Union[str, tuple[str, str], list[Union[str, tuple[str, str]]]], optional + Predefine a macro. Can be either a string, in which case that macro will be set to 1, a 2 element tuple of + strings, in which case the first element is defined as the second, or a list of strings or tuples. + Default: None + undefine_macro : Union[str, list[str]], optional + Cancel any previous definition of a macro, or list of macros. + Default: None + include_path : Union[str, list[str]], optional + Add the directory or directories to the list of directories to be searched for headers. + Default: None + pre_include : Union[str, list[str]], optional + Preinclude one or more headers during preprocessing. Can be either a string or a list of strings. + Default: None + no_source_include : bool, optional + Disable the default behavior of adding the directory of each input source to the include path. + Default: False + std : str, optional + Set language dialect to C++03, C++11, C++14, C++17 or C++20. + Default: c++17 + builtin_move_forward : bool, optional + Provide builtin definitions of std::move and std::forward. + Default: True + builtin_initializer_list : bool, optional + Provide builtin definitions of std::initializer_list class and member functions. + Default: True + disable_warnings : bool, optional + Inhibit all warning messages. + Default: False + restrict : bool, optional + Programmer assertion that all kernel pointer parameters are restrict pointers. + Default: False + device_as_default_execution_space : bool, optional + Treat entities with no execution space annotation as __device__ entities. + Default: False + device_int128 : bool, optional + Allow the __int128 type in device code. + Default: False + optimization_info : str, optional + Provide optimization reports for the specified kind of optimization. + Default: None + no_display_error_number : bool, optional + Disable the display of a diagnostic number for warning messages. + Default: False + diag_error : Union[int, list[int]], optional + Emit error for a specified diagnostic message number or comma-separated list of numbers. + Default: None + diag_suppress : Union[int, list[int]], optional + Suppress a specified diagnostic message number or comma-separated list of numbers. + Default: None + diag_warn : Union[int, list[int]], optional + Emit warning for a specified diagnostic message number or comma-separated list of numbers. + Default: None + brief_diagnostics : bool, optional + Disable or enable showing source line and column info in a diagnostic. + Default: False + time : str, optional + Generate a CSV table with the time taken by each compilation phase. + Default: None + split_compile : int, optional + Perform compiler optimizations in parallel. + Default: 1 + fdevice_syntax_only : bool, optional + Ends device compilation after front-end syntax checking. + Default: False + minimal : bool, optional + Omit certain language features to reduce compile time for small programs. + Default: False + no_cache : bool, optional + Disable compiler caching. + Default: False + fdevice_time_trace : str, optional + Generate time trace JSON for profiling compilation (NVRTC only). + Default: None + device_float128 : bool, optional + Allow __float128 type in device code (NVRTC only). + Default: False + frandom_seed : str, optional + Set random seed for randomized optimizations (NVRTC only). + Default: None + ofast_compile : str, optional + Fast compilation mode: "0", "min", "mid", or "max" (NVRTC only). + Default: None + pch : bool, optional + Use default precompiled header (NVRTC only, CUDA 12.8+). + Default: False + create_pch : str, optional + Create precompiled header file (NVRTC only, CUDA 12.8+). + Default: None + use_pch : str, optional + Use specific precompiled header file (NVRTC only, CUDA 12.8+). + Default: None + pch_dir : str, optional + PCH directory location (NVRTC only, CUDA 12.8+). + Default: None + pch_verbose : bool, optional + Verbose PCH output (NVRTC only, CUDA 12.8+). + Default: False + pch_messages : bool, optional + Control PCH diagnostic messages (NVRTC only, CUDA 12.8+). + Default: False + instantiate_templates_in_pch : bool, optional + Control template instantiation in PCH (NVRTC only, CUDA 12.8+). + Default: False + extra_sources : list of 2-tuples or tuple of 2-tuples, optional + Additional NVVM IR modules to compile together with the main program, specified as + ``((name1, source1), (name2, source2), ...)``. Each name is a string identifier used + in diagnostic messages. Each source can be a string (textual LLVM IR) or bytes/bytearray + (LLVM bitcode). Only supported for the NVVM backend. + Default: None + use_libdevice : bool, optional + Load NVIDIA's `libdevice `_ + math builtins library. Only supported for the NVVM backend. + Default: False + """ + + name: str | None = "default_program" + arch: str | None = None + relocatable_device_code: bool | None = None + extensible_whole_program: bool | None = None + debug: bool | None = None + lineinfo: bool | None = None + device_code_optimize: bool | None = None + ptxas_options: str | list[str] | tuple[str] | None = None + max_register_count: int | None = None + ftz: bool | None = None + prec_sqrt: bool | None = None + prec_div: bool | None = None + fma: bool | None = None + use_fast_math: bool | None = None + extra_device_vectorization: bool | None = None + link_time_optimization: bool | None = None + gen_opt_lto: bool | None = None + define_macro: str | tuple[str, str] | list[str | tuple[str, str]] | tuple[str | tuple[str, str], ...] | None = None + undefine_macro: str | list[str] | tuple[str] | None = None + include_path: str | list[str] | tuple[str] | None = None + pre_include: str | list[str] | tuple[str] | None = None + no_source_include: bool | None = None + std: str | None = None + builtin_move_forward: bool | None = None + builtin_initializer_list: bool | None = None + disable_warnings: bool | None = None + restrict: bool | None = None + device_as_default_execution_space: bool | None = None + device_int128: bool | None = None + optimization_info: str | None = None + no_display_error_number: bool | None = None + diag_error: int | list[int] | tuple[int] | None = None + diag_suppress: int | list[int] | tuple[int] | None = None + diag_warn: int | list[int] | tuple[int] | None = None + brief_diagnostics: bool | None = None + time: str | None = None + split_compile: int | None = None + fdevice_syntax_only: bool | None = None + minimal: bool | None = None + no_cache: bool | None = None + fdevice_time_trace: str | None = None + device_float128: bool | None = None + frandom_seed: str | None = None + ofast_compile: str | None = None + pch: bool | None = None + create_pch: str | None = None + use_pch: str | None = None + pch_dir: str | None = None + pch_verbose: bool | None = None + pch_messages: bool | None = None + instantiate_templates_in_pch: bool | None = None + extra_sources: list[tuple[str, str | bytes | bytearray]] | tuple[tuple[str, str | bytes | bytearray], ...] | None = None + use_libdevice: bool | None = None # For libdevice execution + numba_debug: bool | None = None # Custom option for Numba debugging + + def __post_init__(self) -> None: + self._name = self.name.encode() + # Set arch to default if not provided + if self.arch is None: + self.arch = f"sm_{Device().arch}" + if self.extra_sources is not None: + if not is_sequence(self.extra_sources): + raise TypeError( + "extra_sources must be a sequence of 2-tuples: ((name1, source1), (name2, source2), ...)" + ) + for i, module in enumerate(self.extra_sources): + if not isinstance(module, tuple) or len(module) != 2: + raise TypeError( + f"Each extra module must be a 2-tuple (name, source)" + f", got {type(module).__name__} at index {i}" + ) + + module_name, module_source = module + + if not isinstance(module_name, str): + raise TypeError(f"Module name at index {i} must be a string, got {type(module_name).__name__}") + + if not isinstance(module_source, (str, bytes, bytearray)): + raise TypeError( + f"Module source at index {i} must be str (textual LLVM IR), bytes (textual LLVM IR or bitcode), " + f"or bytearray, got {type(module_source).__name__}" + ) + + if len(module_source) == 0: + raise ValueError(f"Module source for '{module_name}' (index {i}) cannot be empty") + + def _prepare_nvrtc_options(self) -> list[bytes]: + return _prepare_nvrtc_options_impl(self) + + def _prepare_nvvm_options(self, as_bytes: bool = True) -> list[bytes] | list[str]: + return _prepare_nvvm_options_impl(self, as_bytes) + + def as_bytes(self, backend: CompilerBackendType | str, target_type: ObjectCodeFormatType | str | None = None) -> list[bytes]: + """Convert program options to bytes format for the specified backend. + + This method transforms the program options into a format suitable for the + specified compiler backend. Different backends may use different option names + and formats even for the same conceptual options. + + Parameters + ---------- + backend : CompilerBackendType | str + The compiler backend to prepare options for. Must be either "nvrtc" or "nvvm". + target_type : ObjectCodeFormatType | str, optional + The compilation target type (e.g., "ptx", "cubin", "ltoir"). Some backends + require additional options based on the target type. + + Returns + ------- + list[bytes] + List of option strings encoded as bytes. + + Raises + ------ + ValueError + If an unknown backend is specified. + CUDAError + If an option incompatible with the specified backend is set. + + Examples + -------- + >>> options = ProgramOptions(arch="sm_80", debug=True) + >>> nvrtc_options = options.as_bytes("nvrtc") + """ + backend = str(backend).lower() + if backend == "nvrtc": + return self._prepare_nvrtc_options() + elif backend == "nvvm": + options = self._prepare_nvvm_options(as_bytes=True) + if target_type == "ltoir" and b"-gen-lto" not in options: + options.append(b"-gen-lto") + return options + else: + raise ValueError(f"Unknown backend '{backend}'. Must be one of: 'nvrtc', 'nvvm'") + + def __repr__(self) -> str: + return f"ProgramOptions(name={self.name!r}, arch={self.arch!r})" + + def _prepare_extra_sources_bytes(self) -> list[tuple[bytes, bytes]] | None: + """Convert extra_sources to bytes format for NVVM.""" + if self.extra_sources is None: + return None + + result = [] + for module_name, module_source in self.extra_sources: + name_bytes = module_name.encode("utf-8") + if isinstance(module_source, str): + source_bytes = module_source.encode("utf-8") + elif isinstance(module_source, bytearray): + source_bytes = bytes(module_source) + else: + source_bytes = module_source + result.append((name_bytes, source_bytes)) + return result + + +# ============================================================================= +# Private Classes and Helper Functions +# ============================================================================= + + +def _program_compile_uncached(program, target_type, name_expressions, logs): + """Run ``Program_compile`` without the cache wrapper. + + Module-level Python function so tests can monkeypatch it from + ``cuda.core._program`` to avoid invoking NVRTC when exercising the cache + wrapper in :meth:`Program.compile`. ``Program`` itself is a ``cdef class`` + and its methods cannot be reassigned from Python, so the seam must live + outside the class. + """ + return Program_compile(program, target_type, name_expressions, logs) + + +# Module-level state for NVVM lazy loading +_nvvm_module = None +_nvvm_import_attempted = False + + +def _get_nvvm_module() -> object: + """Get the NVVM module, importing it lazily with availability checks.""" + global _nvvm_module, _nvvm_import_attempted + + if _nvvm_import_attempted: + if _nvvm_module is None: + raise RuntimeError("NVVM module is not available (previous import attempt failed)") + return _nvvm_module + + _nvvm_import_attempted = True + + try: + version = binding_version() + if version < (12, 9, 0): + raise RuntimeError( + f"NVVM bindings require cuda-bindings >= 12.9.0, but found {'.'.join(map(str, version))}. " + "Please update cuda-bindings to use NVVM features." + ) + + nvvm = _optional_cuda_import( + "cuda.bindings.nvvm", + probe_function=lambda module: module.version(), # probe triggers libnvvm load + ) + if nvvm is None: + raise RuntimeError( + "NVVM support is unavailable: cuda.bindings.nvvm is missing or libnvvm cannot be loaded." + ) + + _nvvm_module = nvvm + return _nvvm_module + + except RuntimeError: + _nvvm_module = None + raise + +def _find_libdevice_path() -> object: + """Find libdevice*.bc for NVVM compilation using cuda.pathfinder.""" + from cuda.pathfinder import find_bitcode_lib + return find_bitcode_lib("device") + + + + +cdef inline bint _process_define_macro_inner(list options, object macro) except? -1: + """Process a single define macro, returning True if successful.""" + if isinstance(macro, str): + options.append(f"--define-macro={macro}") + return True + if isinstance(macro, tuple): + if len(macro) != 2 or any(not isinstance(val, str) for val in macro): + raise RuntimeError(f"Expected define_macro tuple[str, str], got {macro}") + options.append(f"--define-macro={macro[0]}={macro[1]}") + return True + return False + + +cdef inline void _process_define_macro(list options, object macro) except *: + """Process define_macro option which can be str, tuple, or list thereof.""" + union_type = "Union[str, tuple[str, str]]" + if _process_define_macro_inner(options, macro): + return + if is_nested_sequence(macro): + for seq_macro in macro: + if not _process_define_macro_inner(options, seq_macro): + raise RuntimeError(f"Expected define_macro {union_type}, got {seq_macro}") + return + raise RuntimeError(f"Expected define_macro {union_type}, list[{union_type}], got {macro}") + + +cpdef bint _can_load_generated_ptx() except? -1: + """Check if the driver can load PTX generated by the current NVRTC version.""" + drv = driver_version() + nvrtc_major, nvrtc_minor = handle_return(nvrtc.nvrtcVersion()) + return (nvrtc_major, nvrtc_minor, 0) <= drv + + +cdef inline object _translate_program_options(object options): + """Translate ProgramOptions to LinkerOptions for PTX compilation.""" + return LinkerOptions( + name=options.name, + arch=options.arch, + max_register_count=options.max_register_count, + time=options.time, + link_time_optimization=options.link_time_optimization, + debug=options.debug, + lineinfo=options.lineinfo, + ftz=options.ftz, + prec_div=options.prec_div, + prec_sqrt=options.prec_sqrt, + fma=options.fma, + split_compile=options.split_compile, + ptxas_options=options.ptxas_options, + no_cache=options.no_cache, + numba_debug = options.numba_debug + ) + + +cdef inline int Program_init(Program self, object code, str code_type, object options) except -1: + """Initialize a Program instance.""" + cdef cynvrtc.nvrtcProgram nvrtc_prog + cdef cynvvm.nvvmProgram nvvm_prog + cdef bytes code_bytes + cdef const char* code_ptr + cdef const char* name_ptr + cdef size_t code_len + cdef bytes module_bytes + cdef const char* module_ptr + cdef size_t module_len + + self._options = options = check_or_create_options(ProgramOptions, options, "Program options") + code_type = code_type.lower() + self._code_type = code_type + self._compile_lock = threading.Lock() + self._use_libdevice = False + self._libdevice_added = False + + self._pch_status = None + + if code_type == "c++": + assert_type(code, str) + if options.extra_sources is not None: + raise ValueError("extra_sources is not supported by the NVRTC backend (C++ code_type)") + + # TODO: support pre-loaded headers & include names + code_bytes = code.encode() + code_ptr = code_bytes + name_ptr = options._name + + with nogil: + HANDLE_RETURN_NVRTC(NULL, cynvrtc.nvrtcCreateProgram( + &nvrtc_prog, code_ptr, name_ptr, 0, NULL, NULL)) + self._h_nvrtc = create_nvrtc_program_handle(nvrtc_prog) + self._code = code_bytes + self._backend = str(CompilerBackendType.NVRTC) + self._linker = None + + elif code_type == "ptx": + assert_type(code, str) + if options.extra_sources is not None: + raise ValueError("extra_sources is not supported by the PTX backend.") + code_bytes = code.encode() + self._code = code_bytes + self._linker = Linker( + ObjectCode._init(code_bytes, code_type), options=_translate_program_options(options) + ) + self._backend = str(Linker.which_backend()) + + elif code_type == "nvvm": + _get_nvvm_module() # Validate NVVM availability + if isinstance(code, str): + code = code.encode("utf-8") + elif not isinstance(code, (bytes, bytearray)): + raise TypeError("NVVM IR code must be provided as str, bytes, or bytearray") + self._code = bytes(code) # Coerce bytearray -> bytes so retention type is stable + + # Use self._code (strictly bytes) for the C pointer so a bytearray + # input doesn't trip the `code` cast at runtime. + code_ptr = self._code + name_ptr = options._name + code_len = len(self._code) + + with nogil: + HANDLE_RETURN_NVVM(NULL, cynvvm.nvvmCreateProgram(&nvvm_prog)) + self._h_nvvm = create_nvvm_program_handle(nvvm_prog) # RAII from here + with nogil: + HANDLE_RETURN_NVVM(nvvm_prog, cynvvm.nvvmAddModuleToProgram(nvvm_prog, code_ptr, code_len, name_ptr)) + + # Add extra modules if provided + if options.extra_sources is not None: + extra_sources_bytes = options._prepare_extra_sources_bytes() + for module_name_bytes, module_bytes in extra_sources_bytes: + module_ptr = module_bytes + module_len = len(module_bytes) + module_name_ptr = module_name_bytes + with nogil: + HANDLE_RETURN_NVVM(nvvm_prog, cynvvm.nvvmAddModuleToProgram( + nvvm_prog, module_ptr, module_len, module_name_ptr)) + + # Store use_libdevice flag + if options.use_libdevice: + self._use_libdevice = True + + self._backend = str(CompilerBackendType.NVVM) + self._linker = None + + else: + supported_code_types = tuple(x.value for x in SourceCodeType) + if options.use_libdevice: + raise ValueError("use_libdevice is only supported by the NVVM backend") + raise RuntimeError(f"Unsupported {code_type=} ({supported_code_types=})") + + return 0 + + +cdef object _nvrtc_compile_and_extract( + cynvrtc.nvrtcProgram prog, str target_type, object name_expressions, + object logs, list options_list, str name, +): + """Run nvrtcCompileProgram on *prog* and extract the output. + + This is the inner compile+extract loop, factored out so the PCH + auto-retry path can call it on a fresh program handle. + """ + cdef size_t output_size = 0 + cdef size_t logsize = 0 + cdef vector[const char*] options_vec + cdef char* data_ptr = NULL + cdef bytes name_bytes + cdef const char* name_ptr = NULL + cdef const char* lowered_name = NULL + cdef dict symbol_mapping = {} + + # Add name expressions before compilation + if name_expressions: + for n in name_expressions: + name_bytes = n.encode() if isinstance(n, str) else n + name_ptr = name_bytes + HANDLE_RETURN_NVRTC(prog, cynvrtc.nvrtcAddNameExpression(prog, name_ptr)) + + # Build options array + options_vec.resize(len(options_list)) + for i in range(len(options_list)): + options_vec[i] = (options_list[i]) + + # Compile + with nogil: + HANDLE_RETURN_NVRTC(prog, cynvrtc.nvrtcCompileProgram(prog, options_vec.size(), options_vec.data())) + + # Get compiled output based on target type + if target_type == "ptx": + HANDLE_RETURN_NVRTC(prog, cynvrtc.nvrtcGetPTXSize(prog, &output_size)) + data = bytearray(output_size) + data_ptr = (data) + with nogil: + HANDLE_RETURN_NVRTC(prog, cynvrtc.nvrtcGetPTX(prog, data_ptr)) + elif target_type == "cubin": + HANDLE_RETURN_NVRTC(prog, cynvrtc.nvrtcGetCUBINSize(prog, &output_size)) + data = bytearray(output_size) + data_ptr = (data) + with nogil: + HANDLE_RETURN_NVRTC(prog, cynvrtc.nvrtcGetCUBIN(prog, data_ptr)) + else: # ltoir + HANDLE_RETURN_NVRTC(prog, cynvrtc.nvrtcGetLTOIRSize(prog, &output_size)) + data = bytearray(output_size) + data_ptr = (data) + with nogil: + HANDLE_RETURN_NVRTC(prog, cynvrtc.nvrtcGetLTOIR(prog, data_ptr)) + + # Get lowered names after compilation + if name_expressions: + for n in name_expressions: + name_bytes = n.encode() if isinstance(n, str) else n + name_ptr = name_bytes + HANDLE_RETURN_NVRTC(prog, cynvrtc.nvrtcGetLoweredName(prog, name_ptr, &lowered_name)) + symbol_mapping[n] = lowered_name if lowered_name != NULL else None + + # Get compilation log if requested + if logs is not None: + HANDLE_RETURN_NVRTC(prog, cynvrtc.nvrtcGetProgramLogSize(prog, &logsize)) + if logsize > 1: + log = bytearray(logsize) + data_ptr = (log) + with nogil: + HANDLE_RETURN_NVRTC(prog, cynvrtc.nvrtcGetProgramLog(prog, data_ptr)) + logs.write(log.decode("utf-8", errors="backslashreplace")) + + return ObjectCode._init(bytes(data), target_type, symbol_mapping=symbol_mapping, name=name) + + +cdef int _nvrtc_pch_apis_cached = -1 # -1 = unchecked + +cdef bint _has_nvrtc_pch_apis(): + global _nvrtc_pch_apis_cached + if _nvrtc_pch_apis_cached < 0: + _nvrtc_pch_apis_cached = hasattr(nvrtc, "nvrtcGetPCHCreateStatus") + return _nvrtc_pch_apis_cached + + +cdef object _read_pch_status(cynvrtc.nvrtcProgram prog): + """Query nvrtcGetPCHCreateStatus and translate to a high-level string.""" + cdef cynvrtc.nvrtcResult err + with nogil: + err = cynvrtc.nvrtcGetPCHCreateStatus(prog) + if err == cynvrtc.nvrtcResult.NVRTC_SUCCESS: + return PCHStatusType.CREATED + if err == cynvrtc.nvrtcResult.NVRTC_ERROR_PCH_CREATE_HEAP_EXHAUSTED: + return None # sentinel: caller should auto-retry + if err == cynvrtc.nvrtcResult.NVRTC_ERROR_NO_PCH_CREATE_ATTEMPTED: + return PCHStatusType.NOT_ATTEMPTED + return PCHStatusType.FAILED + + +cdef object Program_compile_nvrtc(Program self, str target_type, object name_expressions, object logs): + """Compile using NVRTC backend and return ObjectCode.""" + cdef cynvrtc.nvrtcProgram prog = as_cu(self._h_nvrtc) + cdef list options_list = self._options.as_bytes("nvrtc", target_type) + + result = _nvrtc_compile_and_extract( + prog, target_type, name_expressions, logs, options_list, self._options.name, + ) + + cdef bint pch_creation_possible = self._options.create_pch or self._options.pch + if not pch_creation_possible or not _has_nvrtc_pch_apis(): + self._pch_status = None + return result + + try: + status = _read_pch_status(prog) + except RuntimeError as e: + raise RuntimeError( + "PCH was requested but the runtime libnvrtc does not support " + "PCH APIs. Update to CUDA toolkit 12.8 or newer." + ) from e + + if status is not None: + self._pch_status = str(status) + return result + + # Heap exhausted — auto-resize and retry with a fresh program + cdef size_t required = 0 + with nogil: + HANDLE_RETURN_NVRTC(prog, cynvrtc.nvrtcGetPCHHeapSizeRequired(prog, &required)) + HANDLE_RETURN_NVRTC(NULL, cynvrtc.nvrtcSetPCHHeapSize(required)) + + cdef cynvrtc.nvrtcProgram retry_prog + cdef const char* code_ptr = self._code + cdef const char* name_ptr = self._options._name + with nogil: + HANDLE_RETURN_NVRTC(NULL, cynvrtc.nvrtcCreateProgram( + &retry_prog, code_ptr, name_ptr, 0, NULL, NULL)) + self._h_nvrtc = create_nvrtc_program_handle(retry_prog) + + result = _nvrtc_compile_and_extract( + retry_prog, target_type, name_expressions, logs, options_list, self._options.name, + ) + + status = _read_pch_status(retry_prog) + self._pch_status = status if status is not None else str(PCHStatusType.FAILED) + return result + + +cdef object Program_compile_nvvm(Program self, str target_type, object logs): + """Compile using NVVM backend and return ObjectCode.""" + cdef cynvvm.nvvmProgram prog = as_cu(self._h_nvvm) + cdef size_t output_size = 0 + cdef size_t logsize = 0 + cdef vector[const char*] options_vec + cdef char* data_ptr = NULL + cdef bytes libdevice_bytes + cdef const char* libdevice_ptr + cdef size_t libdevice_len + # Build options array + options_list = self._options.as_bytes("nvvm", target_type) + options_vec.resize(len(options_list)) + for i in range(len(options_list)): + options_vec[i] = (options_list[i]) + + # Serialize NVVM program mutation/use per Program instance. + with self._compile_lock: + with nogil: + HANDLE_RETURN_NVVM(prog, cynvvm.nvvmVerifyProgram(prog, options_vec.size(), options_vec.data())) + + # Load libdevice if requested - following numba-cuda. + if self._use_libdevice and not self._libdevice_added: + libdevice_path = _find_libdevice_path() + with open(libdevice_path, "rb") as f: + libdevice_bytes = f.read() + libdevice_ptr = libdevice_bytes + libdevice_len = len(libdevice_bytes) + with nogil: + HANDLE_RETURN_NVVM(prog, cynvvm.nvvmLazyAddModuleToProgram( + prog, libdevice_ptr, libdevice_len, NULL)) + self._libdevice_added = True + + with nogil: + HANDLE_RETURN_NVVM(prog, cynvvm.nvvmCompileProgram(prog, options_vec.size(), options_vec.data())) + + HANDLE_RETURN_NVVM(prog, cynvvm.nvvmGetCompiledResultSize(prog, &output_size)) + data = bytearray(output_size) + data_ptr = (data) + with nogil: + HANDLE_RETURN_NVVM(prog, cynvvm.nvvmGetCompiledResult(prog, data_ptr)) + + # Get compilation log if requested + if logs is not None: + HANDLE_RETURN_NVVM(prog, cynvvm.nvvmGetProgramLogSize(prog, &logsize)) + if logsize > 1: + log = bytearray(logsize) + data_ptr = (log) + with nogil: + HANDLE_RETURN_NVVM(prog, cynvvm.nvvmGetProgramLog(prog, data_ptr)) + logs.write(log.decode("utf-8", errors="backslashreplace")) + + return ObjectCode._init(bytes(data), target_type, name=self._options.name) + +# Supported target types per backend +cdef dict SUPPORTED_TARGETS = { + CompilerBackendType.NVRTC: (ObjectCodeFormatType.PTX, ObjectCodeFormatType.CUBIN, ObjectCodeFormatType.LTOIR), + CompilerBackendType.NVVM: (ObjectCodeFormatType.PTX, ObjectCodeFormatType.LTOIR), + CompilerBackendType.NVJITLINK: (ObjectCodeFormatType.CUBIN, ObjectCodeFormatType.PTX), + CompilerBackendType.DRIVER: (ObjectCodeFormatType.CUBIN, ObjectCodeFormatType.PTX), +} + + +cdef object Program_compile(Program self, str target_type, object name_expressions, object logs): + """Compile the program to the specified target type.""" + # Validate target_type for this backend + supported = SUPPORTED_TARGETS.get(self._backend) + if supported is None: + raise ValueError(f'Unknown backend="{self._backend}"') + if target_type not in supported: + raise ValueError( + f'Unsupported target_type="{target_type}" for {self._backend} ' + f'(supported: {", ".join(repr(t) for t in supported)})' + ) + + if self._backend == "NVRTC": + if target_type == "ptx" and not _can_load_generated_ptx(): + warn( + "The CUDA driver version is older than the backend version. " + "The generated ptx will not be loadable by the current driver.", + stacklevel=2, + category=RuntimeWarning, + ) + return Program_compile_nvrtc(self, target_type, name_expressions, logs) + + elif self._backend == "NVVM": + return Program_compile_nvvm(self, target_type, logs) + + else: + return self._linker.link(target_type) + + +cdef inline list _prepare_nvrtc_options_impl(object opts): + """Build NVRTC-specific compiler options.""" + options = [f"-arch={opts.arch}"] + if opts.relocatable_device_code is not None: + options.append(f"--relocatable-device-code={_handle_boolean_option(opts.relocatable_device_code)}") + if opts.extensible_whole_program is not None and opts.extensible_whole_program: + options.append("--extensible-whole-program") + if opts.debug is not None and opts.debug: + options.append("--device-debug") + if opts.lineinfo is not None and opts.lineinfo: + options.append("--generate-line-info") + if opts.device_code_optimize is not None and opts.device_code_optimize: + options.append("--dopt=on") + if opts.ptxas_options is not None: + opt_name = "--ptxas-options" + if isinstance(opts.ptxas_options, str): + options.append(f"{opt_name}={opts.ptxas_options}") + elif is_sequence(opts.ptxas_options): + for opt_value in opts.ptxas_options: + options.append(f"{opt_name}={opt_value}") + if opts.max_register_count is not None: + options.append(f"--maxrregcount={opts.max_register_count}") + if opts.ftz is not None: + options.append(f"--ftz={_handle_boolean_option(opts.ftz)}") + if opts.prec_sqrt is not None: + options.append(f"--prec-sqrt={_handle_boolean_option(opts.prec_sqrt)}") + if opts.prec_div is not None: + options.append(f"--prec-div={_handle_boolean_option(opts.prec_div)}") + if opts.fma is not None: + options.append(f"--fmad={_handle_boolean_option(opts.fma)}") + if opts.use_fast_math is not None and opts.use_fast_math: + options.append("--use_fast_math") + if opts.extra_device_vectorization is not None and opts.extra_device_vectorization: + options.append("--extra-device-vectorization") + if opts.link_time_optimization is not None and opts.link_time_optimization: + options.append("--dlink-time-opt") + if opts.gen_opt_lto is not None and opts.gen_opt_lto: + options.append("--gen-opt-lto") + if opts.define_macro is not None: + _process_define_macro(options, opts.define_macro) + if opts.undefine_macro is not None: + if isinstance(opts.undefine_macro, str): + options.append(f"--undefine-macro={opts.undefine_macro}") + elif is_sequence(opts.undefine_macro): + for macro in opts.undefine_macro: + options.append(f"--undefine-macro={macro}") + if opts.include_path is not None: + if isinstance(opts.include_path, str): + options.append(f"--include-path={opts.include_path}") + elif is_sequence(opts.include_path): + for path in opts.include_path: + options.append(f"--include-path={path}") + if opts.pre_include is not None: + if isinstance(opts.pre_include, str): + options.append(f"--pre-include={opts.pre_include}") + elif is_sequence(opts.pre_include): + for header in opts.pre_include: + options.append(f"--pre-include={header}") + if opts.no_source_include is not None and opts.no_source_include: + options.append("--no-source-include") + if opts.std is not None: + options.append(f"--std={opts.std}") + if opts.builtin_move_forward is not None: + options.append(f"--builtin-move-forward={_handle_boolean_option(opts.builtin_move_forward)}") + if opts.builtin_initializer_list is not None: + options.append(f"--builtin-initializer-list={_handle_boolean_option(opts.builtin_initializer_list)}") + if opts.disable_warnings is not None and opts.disable_warnings: + options.append("--disable-warnings") + if opts.restrict is not None and opts.restrict: + options.append("--restrict") + if opts.device_as_default_execution_space is not None and opts.device_as_default_execution_space: + options.append("--device-as-default-execution-space") + if opts.device_int128 is not None and opts.device_int128: + options.append("--device-int128") + if opts.device_float128 is not None and opts.device_float128: + options.append("--device-float128") + if opts.optimization_info is not None: + options.append(f"--optimization-info={opts.optimization_info}") + if opts.no_display_error_number is not None and opts.no_display_error_number: + options.append("--no-display-error-number") + if opts.diag_error is not None: + if isinstance(opts.diag_error, int): + options.append(f"--diag-error={opts.diag_error}") + elif is_sequence(opts.diag_error): + for error in opts.diag_error: + options.append(f"--diag-error={error}") + if opts.diag_suppress is not None: + if isinstance(opts.diag_suppress, int): + options.append(f"--diag-suppress={opts.diag_suppress}") + elif is_sequence(opts.diag_suppress): + for suppress in opts.diag_suppress: + options.append(f"--diag-suppress={suppress}") + if opts.diag_warn is not None: + if isinstance(opts.diag_warn, int): + options.append(f"--diag-warn={opts.diag_warn}") + elif is_sequence(opts.diag_warn): + for w in opts.diag_warn: + options.append(f"--diag-warn={w}") + if opts.brief_diagnostics is not None: + options.append(f"--brief-diagnostics={_handle_boolean_option(opts.brief_diagnostics)}") + if opts.time is not None: + options.append(f"--time={opts.time}") + if opts.split_compile is not None: + options.append(f"--split-compile={opts.split_compile}") + if opts.fdevice_syntax_only is not None and opts.fdevice_syntax_only: + options.append("--fdevice-syntax-only") + if opts.minimal is not None and opts.minimal: + options.append("--minimal") + if opts.no_cache is not None and opts.no_cache: + options.append("--no-cache") + if opts.fdevice_time_trace is not None: + options.append(f"--fdevice-time-trace={opts.fdevice_time_trace}") + if opts.frandom_seed is not None: + options.append(f"--frandom-seed={opts.frandom_seed}") + if opts.ofast_compile is not None: + options.append(f"--Ofast-compile={opts.ofast_compile}") + # PCH options (CUDA 12.8+) + if opts.pch is not None and opts.pch: + options.append("--pch") + if opts.create_pch is not None: + options.append(f"--create-pch={opts.create_pch}") + if opts.use_pch is not None: + options.append(f"--use-pch={opts.use_pch}") + if opts.pch_dir is not None: + options.append(f"--pch-dir={opts.pch_dir}") + if opts.pch_verbose is not None: + options.append(f"--pch-verbose={_handle_boolean_option(opts.pch_verbose)}") + if opts.pch_messages is not None: + options.append(f"--pch-messages={_handle_boolean_option(opts.pch_messages)}") + if opts.instantiate_templates_in_pch is not None: + options.append( + f"--instantiate-templates-in-pch={_handle_boolean_option(opts.instantiate_templates_in_pch)}" + ) + if opts.numba_debug: + options.append("--numba-debug") + return [o.encode() for o in options] + + +cdef inline object _prepare_nvvm_options_impl(object opts, bint as_bytes): + """Build NVVM-specific compiler options.""" + options = [] + + # Options supported by NVVM + assert opts.arch is not None + arch = opts.arch + if arch.startswith("sm_"): + arch = f"compute_{arch[3:]}" + options.append(f"-arch={arch}") + if opts.debug is not None and opts.debug: + options.append("-g") + if opts.numba_debug: + options.append("--numba-debug") + if opts.device_code_optimize is False: + options.append("-opt=0") + elif opts.device_code_optimize is True: + options.append("-opt=3") + # NVVM uses 0/1 instead of true/false for boolean options + if opts.ftz is not None: + options.append(f"-ftz={'1' if opts.ftz else '0'}") + if opts.prec_sqrt is not None: + options.append(f"-prec-sqrt={'1' if opts.prec_sqrt else '0'}") + if opts.prec_div is not None: + options.append(f"-prec-div={'1' if opts.prec_div else '0'}") + if opts.fma is not None: + options.append(f"-fma={'1' if opts.fma else '0'}") + + # Check for unsupported options and raise error if they are set + unsupported = [] + if opts.relocatable_device_code is not None: + unsupported.append("relocatable_device_code") + if opts.extensible_whole_program is not None and opts.extensible_whole_program: + unsupported.append("extensible_whole_program") + if opts.lineinfo is not None and opts.lineinfo: + unsupported.append("lineinfo") + if opts.ptxas_options is not None: + unsupported.append("ptxas_options") + if opts.max_register_count is not None: + unsupported.append("max_register_count") + if opts.use_fast_math is not None and opts.use_fast_math: + unsupported.append("use_fast_math") + if opts.extra_device_vectorization is not None and opts.extra_device_vectorization: + unsupported.append("extra_device_vectorization") + if opts.gen_opt_lto is not None and opts.gen_opt_lto: + unsupported.append("gen_opt_lto") + if opts.define_macro is not None: + unsupported.append("define_macro") + if opts.undefine_macro is not None: + unsupported.append("undefine_macro") + if opts.include_path is not None: + unsupported.append("include_path") + if opts.pre_include is not None: + unsupported.append("pre_include") + if opts.no_source_include is not None and opts.no_source_include: + unsupported.append("no_source_include") + if opts.std is not None: + unsupported.append("std") + if opts.builtin_move_forward is not None: + unsupported.append("builtin_move_forward") + if opts.builtin_initializer_list is not None: + unsupported.append("builtin_initializer_list") + if opts.disable_warnings is not None and opts.disable_warnings: + unsupported.append("disable_warnings") + if opts.restrict is not None and opts.restrict: + unsupported.append("restrict") + if opts.device_as_default_execution_space is not None and opts.device_as_default_execution_space: + unsupported.append("device_as_default_execution_space") + if opts.device_int128 is not None and opts.device_int128: + unsupported.append("device_int128") + if opts.optimization_info is not None: + unsupported.append("optimization_info") + if opts.no_display_error_number is not None and opts.no_display_error_number: + unsupported.append("no_display_error_number") + if opts.diag_error is not None: + unsupported.append("diag_error") + if opts.diag_suppress is not None: + unsupported.append("diag_suppress") + if opts.diag_warn is not None: + unsupported.append("diag_warn") + if opts.brief_diagnostics is not None: + unsupported.append("brief_diagnostics") + if opts.time is not None: + unsupported.append("time") + if opts.split_compile is not None: + unsupported.append("split_compile") + if opts.fdevice_syntax_only is not None and opts.fdevice_syntax_only: + unsupported.append("fdevice_syntax_only") + if opts.minimal is not None and opts.minimal: + unsupported.append("minimal") + if unsupported: + raise CUDAError(f"The following options are not supported by NVVM backend: {', '.join(unsupported)}") + + if as_bytes: + return [o.encode() for o in options] + else: + return options diff --git a/cuda_core/cuda/core/_resource_handles.pxd b/cuda_core/cuda/core/_resource_handles.pxd new file mode 100644 index 00000000000..aaf3e75222e --- /dev/null +++ b/cuda_core/cuda/core/_resource_handles.pxd @@ -0,0 +1,297 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from libc.stddef cimport size_t +from libc.stdint cimport intptr_t + +from libcpp.memory cimport shared_ptr + +from cuda.bindings cimport cydriver +from cuda.bindings cimport cynvrtc +from cuda.bindings cimport cynvvm +from cuda.bindings cimport cynvjitlink + + +# ============================================================================= +# Handle type aliases and inline helpers (declared from C++ header) +# ============================================================================= + +cdef extern from "_cpp/resource_handles.hpp" namespace "cuda_core": + # Handle types + ctypedef shared_ptr[const cydriver.CUcontext] ContextHandle + ctypedef shared_ptr[const cydriver.CUgreenCtx] GreenCtxHandle + ctypedef shared_ptr[const cydriver.CUstream] StreamHandle + ctypedef shared_ptr[const cydriver.CUevent] EventHandle + ctypedef shared_ptr[const cydriver.CUmemoryPool] MemoryPoolHandle + ctypedef shared_ptr[const cydriver.CUdeviceptr] DevicePtrHandle + ctypedef shared_ptr[const cydriver.CUlibrary] LibraryHandle + ctypedef shared_ptr[const cydriver.CUkernel] KernelHandle + ctypedef shared_ptr[const cydriver.CUgraph] GraphHandle + ctypedef shared_ptr[const cydriver.CUgraphExec] GraphExecHandle + ctypedef shared_ptr[const cydriver.CUgraphNode] GraphNodeHandle + ctypedef shared_ptr[const cydriver.CUgraphicsResource] GraphicsResourceHandle + ctypedef shared_ptr[const cynvrtc.nvrtcProgram] NvrtcProgramHandle + + # NvvmProgramValue and NvJitLinkValue are TaggedHandle + # instantiations that make each shared_ptr type distinct for overloading. + cppclass NvvmProgramValue "cuda_core::NvvmProgramValue": + pass + cppclass NvJitLinkValue "cuda_core::NvJitLinkValue": + pass + ctypedef shared_ptr[const NvvmProgramValue] NvvmProgramHandle + ctypedef shared_ptr[const NvJitLinkValue] NvJitLinkHandle + + ctypedef shared_ptr[const cydriver.CUlinkState] CuLinkHandle + ctypedef shared_ptr[const int] FileDescriptorHandle + ctypedef shared_ptr[const cydriver.CUarray] OpaqueArrayHandle + ctypedef shared_ptr[const cydriver.CUmipmappedArray] MipmappedArrayHandle + + # CUtexObject / CUsurfObject are both `unsigned long long` (as is CUdeviceptr), + # so they are wrapped in distinct tagged value types to keep each handle's + # as_cu/as_intptr/as_py overloads distinct. + cppclass TexObjectValue "cuda_core::TexObjectValue": + pass + cppclass SurfObjectValue "cuda_core::SurfObjectValue": + pass + ctypedef shared_ptr[const TexObjectValue] TexObjectHandle + ctypedef shared_ptr[const SurfObjectValue] SurfObjectHandle + + # Type-erased shared owner for resources attached to graph node slots. + # Typed handles above assign directly to an OpaqueHandle (shared control + # block); make_opaque_py / make_opaque_malloc cover the two cases needing a + # custom deleter. + ctypedef shared_ptr[const void] OpaqueHandle + + # as_cu() - extract the raw CUDA handle (inline C++) + cydriver.CUcontext as_cu(ContextHandle h) noexcept nogil + cydriver.CUgreenCtx as_cu(GreenCtxHandle h) noexcept nogil + cydriver.CUstream as_cu(StreamHandle h) noexcept nogil + cydriver.CUevent as_cu(EventHandle h) noexcept nogil + cydriver.CUmemoryPool as_cu(MemoryPoolHandle h) noexcept nogil + cydriver.CUdeviceptr as_cu(DevicePtrHandle h) noexcept nogil + cydriver.CUlibrary as_cu(LibraryHandle h) noexcept nogil + cydriver.CUkernel as_cu(KernelHandle h) noexcept nogil + cydriver.CUgraph as_cu(GraphHandle h) noexcept nogil + cydriver.CUgraphExec as_cu(GraphExecHandle h) noexcept nogil + cydriver.CUgraphNode as_cu(GraphNodeHandle h) noexcept nogil + cydriver.CUgraphicsResource as_cu(GraphicsResourceHandle h) noexcept nogil + cynvrtc.nvrtcProgram as_cu(NvrtcProgramHandle h) noexcept nogil + cynvvm.nvvmProgram as_cu(NvvmProgramHandle h) noexcept nogil + cynvjitlink.nvJitLinkHandle as_cu(NvJitLinkHandle h) noexcept nogil + cydriver.CUlinkState as_cu(CuLinkHandle h) noexcept nogil + cydriver.CUarray as_cu(OpaqueArrayHandle h) noexcept nogil + cydriver.CUmipmappedArray as_cu(MipmappedArrayHandle h) noexcept nogil + cydriver.CUtexObject as_cu(TexObjectHandle h) noexcept nogil + cydriver.CUsurfObject as_cu(SurfObjectHandle h) noexcept nogil + + # as_intptr() - extract handle as intptr_t for Python interop (inline C++) + intptr_t as_intptr(ContextHandle h) noexcept nogil + intptr_t as_intptr(GreenCtxHandle h) noexcept nogil + intptr_t as_intptr(StreamHandle h) noexcept nogil + intptr_t as_intptr(EventHandle h) noexcept nogil + intptr_t as_intptr(MemoryPoolHandle h) noexcept nogil + intptr_t as_intptr(DevicePtrHandle h) noexcept nogil + intptr_t as_intptr(LibraryHandle h) noexcept nogil + intptr_t as_intptr(KernelHandle h) noexcept nogil + intptr_t as_intptr(GraphHandle h) noexcept nogil + intptr_t as_intptr(GraphExecHandle h) noexcept nogil + intptr_t as_intptr(GraphNodeHandle h) noexcept nogil + intptr_t as_intptr(GraphicsResourceHandle h) noexcept nogil + intptr_t as_intptr(NvrtcProgramHandle h) noexcept nogil + intptr_t as_intptr(NvvmProgramHandle h) noexcept nogil + intptr_t as_intptr(NvJitLinkHandle h) noexcept nogil + intptr_t as_intptr(CuLinkHandle h) noexcept nogil + intptr_t as_intptr(FileDescriptorHandle h) noexcept nogil + intptr_t as_intptr(OpaqueArrayHandle h) noexcept nogil + intptr_t as_intptr(MipmappedArrayHandle h) noexcept nogil + intptr_t as_intptr(TexObjectHandle h) noexcept nogil + intptr_t as_intptr(SurfObjectHandle h) noexcept nogil + + # as_py() - convert handle to Python wrapper object (inline C++; requires GIL) + object as_py(ContextHandle h) + object as_py(GreenCtxHandle h) + object as_py(StreamHandle h) + object as_py(EventHandle h) + object as_py(MemoryPoolHandle h) + object as_py(DevicePtrHandle h) + object as_py(LibraryHandle h) + object as_py(KernelHandle h) + object as_py(GraphHandle h) + object as_py(GraphExecHandle h) + object as_py(GraphNodeHandle h) + object as_py(GraphicsResourceHandle h) + object as_py(NvrtcProgramHandle h) + object as_py(NvvmProgramHandle h) + object as_py(NvJitLinkHandle h) + object as_py(CuLinkHandle h) + object as_py(FileDescriptorHandle h) + object as_py(OpaqueArrayHandle h) + object as_py(MipmappedArrayHandle h) + object as_py(TexObjectHandle h) + object as_py(SurfObjectHandle h) + + +# ============================================================================= +# Wrapper function declarations (implemented in _resource_handles.pyx) +# +# Consumer modules cimport these. Calls go through _resource_handles.so. +# ============================================================================= + +# Thread-local error handling +cdef cydriver.CUresult get_last_error() noexcept nogil +cdef cydriver.CUresult peek_last_error() noexcept nogil +cdef void clear_last_error() noexcept nogil + +# Context handles +cdef ContextHandle create_context_handle_ref(cydriver.CUcontext ctx) except+ nogil +cdef ContextHandle create_context_handle_from_green_ctx(const GreenCtxHandle& h_green_ctx) except+ nogil +cdef GreenCtxHandle get_context_green_ctx(const ContextHandle& h) noexcept nogil +cdef GreenCtxHandle create_green_ctx_handle( + cydriver.CUdevResource* resources, unsigned int nbResources, + cydriver.CUdevice dev, unsigned int flags) except+ nogil +cdef GreenCtxHandle create_green_ctx_handle_ref(cydriver.CUgreenCtx ctx) except+ nogil +cdef ContextHandle get_primary_context(int device_id) except+ nogil +cdef ContextHandle get_current_context() except+ nogil + +# Stream handles +cdef StreamHandle create_stream_handle( + const ContextHandle& h_ctx, unsigned int flags, int priority) except+ nogil +cdef StreamHandle create_stream_handle_ref(cydriver.CUstream stream) except+ nogil +cdef StreamHandle create_stream_handle_with_owner(cydriver.CUstream stream, object owner) except+ nogil +cdef void py_object_user_object_destroy(void* py_object) noexcept nogil +cdef ContextHandle get_stream_context(const StreamHandle& h) noexcept nogil +cdef StreamHandle get_legacy_stream() except+ nogil +cdef StreamHandle get_per_thread_stream() except+ nogil + +# Event handles +cdef EventHandle create_event_handle( + const ContextHandle& h_ctx, unsigned int flags, + bint timing_enabled, bint is_blocking_sync, + bint ipc_enabled, int device_id) except+ nogil +cdef EventHandle create_event_handle_noctx(unsigned int flags) except+ nogil +cdef EventHandle create_event_handle_ref(cydriver.CUevent event) except+ nogil +cdef EventHandle create_event_handle_ipc( + const cydriver.CUipcEventHandle& ipc_handle, bint is_blocking_sync) except+ nogil + +# Event metadata getters +cdef bint get_event_timing_enabled(const EventHandle& h) noexcept nogil +cdef bint get_event_is_blocking_sync(const EventHandle& h) noexcept nogil +cdef bint get_event_ipc_enabled(const EventHandle& h) noexcept nogil +cdef int get_event_device_id(const EventHandle& h) noexcept nogil +cdef ContextHandle get_event_context(const EventHandle& h) noexcept nogil + +# Memory pool handles +cdef MemoryPoolHandle create_mempool_handle( + const cydriver.CUmemPoolProps& props) except+ nogil +cdef MemoryPoolHandle create_mempool_handle_ref(cydriver.CUmemoryPool pool) except+ nogil +cdef MemoryPoolHandle get_device_mempool(int device_id) except+ nogil +cdef MemoryPoolHandle create_mempool_handle_ipc( + int fd, cydriver.CUmemAllocationHandleType handle_type) except+ nogil + +# Device pointer handles +cdef DevicePtrHandle deviceptr_alloc_from_pool( + size_t size, const MemoryPoolHandle& h_pool, const StreamHandle& h_stream) except+ nogil +cdef DevicePtrHandle deviceptr_alloc_async(size_t size, const StreamHandle& h_stream) except+ nogil +cdef DevicePtrHandle deviceptr_alloc(size_t size) except+ nogil +cdef DevicePtrHandle deviceptr_alloc_host(size_t size) except+ nogil +cdef DevicePtrHandle deviceptr_create_ref(cydriver.CUdeviceptr ptr) except+ nogil +cdef DevicePtrHandle deviceptr_create_with_owner(cydriver.CUdeviceptr ptr, object owner) except+ nogil +cdef DevicePtrHandle deviceptr_create_mapped_graphics( + cydriver.CUdeviceptr ptr, + const GraphicsResourceHandle& h_resource, + const StreamHandle& h_stream) except+ nogil +cdef DevicePtrHandle deviceptr_create_with_mr( + cydriver.CUdeviceptr ptr, size_t size, object mr) except+ nogil + +# MR deallocation callback type and registration +ctypedef void (*MRDeallocCallback)( + object mr, cydriver.CUdeviceptr ptr, size_t size, + const StreamHandle& stream) noexcept +cdef void register_mr_dealloc_callback(MRDeallocCallback cb) noexcept + +cdef DevicePtrHandle deviceptr_import_ipc( + const MemoryPoolHandle& h_pool, const void* export_data, const StreamHandle& h_stream) except+ nogil +cdef StreamHandle deallocation_stream(const DevicePtrHandle& h) noexcept nogil +cdef void set_deallocation_stream(const DevicePtrHandle& h, const StreamHandle& h_stream) noexcept nogil + +# Library handles +cdef LibraryHandle create_library_handle_from_file(const char* path) except+ nogil +cdef LibraryHandle create_library_handle_from_data(const void* data) except+ nogil +cdef LibraryHandle create_library_handle_ref(cydriver.CUlibrary library) except+ nogil + +# Kernel handles +cdef KernelHandle create_kernel_handle(const LibraryHandle& h_library, const char* name) except+ nogil +cdef KernelHandle create_kernel_handle_ref(cydriver.CUkernel kernel) except+ nogil +cdef LibraryHandle get_kernel_library(const KernelHandle& h) noexcept nogil + +# Graph handles +cdef GraphHandle create_graph_handle(cydriver.CUgraph graph) except+ nogil +cdef GraphHandle create_graph_handle_ref(cydriver.CUgraph graph, const GraphHandle& h_parent) except+ nogil + +# Graph slot attachments +cdef OpaqueHandle make_opaque_py(object obj) except+ +cdef OpaqueHandle make_opaque_malloc(void* buf) except+ +cdef cydriver.CUresult graph_set_slot( + const GraphHandle& h_graph, cydriver.CUgraphNode node, + unsigned int slot, OpaqueHandle owner) except+ + +# Graph exec handles +cdef GraphExecHandle create_graph_exec_handle(cydriver.CUgraphExec graph_exec) except+ nogil + +# Graph node handles +cdef GraphNodeHandle create_graph_node_handle(cydriver.CUgraphNode node, const GraphHandle& h_graph) except+ nogil +cdef GraphHandle graph_node_get_graph(const GraphNodeHandle& h) noexcept nogil +cdef void invalidate_graph_node(const GraphNodeHandle& h) noexcept nogil + +# Graphics resource handles +cdef GraphicsResourceHandle create_graphics_resource_handle( + cydriver.CUgraphicsResource resource) except+ nogil + +# NVRTC Program handles +cdef NvrtcProgramHandle create_nvrtc_program_handle(cynvrtc.nvrtcProgram prog) except+ nogil +cdef NvrtcProgramHandle create_nvrtc_program_handle_ref(cynvrtc.nvrtcProgram prog) except+ nogil + +# NVVM Program handles +cdef NvvmProgramHandle create_nvvm_program_handle(cynvvm.nvvmProgram prog) except+ nogil +cdef NvvmProgramHandle create_nvvm_program_handle_ref(cynvvm.nvvmProgram prog) except+ nogil + +# nvJitLink handles +cdef NvJitLinkHandle create_nvjitlink_handle(cynvjitlink.nvJitLinkHandle handle) except+ nogil +cdef NvJitLinkHandle create_nvjitlink_handle_ref(cynvjitlink.nvJitLinkHandle handle) except+ nogil + +# cuLink handles +cdef CuLinkHandle create_culink_handle(cydriver.CUlinkState state) except+ nogil +cdef CuLinkHandle create_culink_handle_ref(cydriver.CUlinkState state) except+ nogil + +# File descriptor handles +cdef FileDescriptorHandle create_fd_handle(int fd) except+ nogil +cdef FileDescriptorHandle create_fd_handle_ref(int fd) except+ nogil + +# Array / mipmapped-array / texture / surface handles (PR #467) +cdef OpaqueArrayHandle create_array_handle(const cydriver.CUDA_ARRAY3D_DESCRIPTOR& desc) except+ nogil +cdef OpaqueArrayHandle create_array_handle_ref(cydriver.CUarray arr) except+ nogil +cdef OpaqueArrayHandle create_array_handle_owning(cydriver.CUarray arr) except+ nogil +cdef OpaqueArrayHandle create_array_level_handle(const MipmappedArrayHandle& h_mip, unsigned int level) except+ nogil +cdef MipmappedArrayHandle create_mipmapped_array_handle( + const cydriver.CUDA_ARRAY3D_DESCRIPTOR& desc, unsigned int num_levels) except+ nogil +cdef TexObjectHandle create_tex_object_handle_array( + const cydriver.CUDA_RESOURCE_DESC& res, const cydriver.CUDA_TEXTURE_DESC& tex, + const OpaqueArrayHandle& h_backing) except+ nogil +cdef TexObjectHandle create_tex_object_handle_mipmap( + const cydriver.CUDA_RESOURCE_DESC& res, const cydriver.CUDA_TEXTURE_DESC& tex, + const MipmappedArrayHandle& h_backing) except+ nogil +cdef TexObjectHandle create_tex_object_handle_linear( + const cydriver.CUDA_RESOURCE_DESC& res, const cydriver.CUDA_TEXTURE_DESC& tex, + const DevicePtrHandle& h_backing) except+ nogil +cdef SurfObjectHandle create_surf_object_handle( + const cydriver.CUDA_RESOURCE_DESC& res, const OpaqueArrayHandle& h_backing) except+ nogil + +# SM resource split (13.1+ — calls through function pointer, safe on older bindings) +# groupParams is void* here to avoid referencing CU_DEV_SM_RESOURCE_GROUP_PARAMS +# (which doesn't exist in cuda-bindings 13.0 .pxd). The C++ side casts it. +cdef cydriver.CUresult sm_resource_split( + cydriver.CUdevResource* result, unsigned int nbGroups, + const cydriver.CUdevResource* input, cydriver.CUdevResource* remainder, + unsigned int flags, void* groupParams) nogil +cdef bint has_sm_resource_split() noexcept nogil diff --git a/cuda_core/cuda/core/_resource_handles.pyi b/cuda_core/cuda/core/_resource_handles.pyi new file mode 100644 index 00000000000..4236df5d6e9 --- /dev/null +++ b/cuda_core/cuda/core/_resource_handles.pyi @@ -0,0 +1,28 @@ +# This file was generated by stubgen-pyx v0.2.6 from cuda_core/cuda/core/_resource_handles.pyx + +from __future__ import annotations + +from libcpp.memory import shared_ptr + +ContextHandle = shared_ptr +GreenCtxHandle = shared_ptr +StreamHandle = shared_ptr +EventHandle = shared_ptr +MemoryPoolHandle = shared_ptr +DevicePtrHandle = shared_ptr +LibraryHandle = shared_ptr +KernelHandle = shared_ptr +GraphHandle = shared_ptr +GraphExecHandle = shared_ptr +GraphNodeHandle = shared_ptr +GraphicsResourceHandle = shared_ptr +NvrtcProgramHandle = shared_ptr +NvvmProgramHandle = shared_ptr +NvJitLinkHandle = shared_ptr +CuLinkHandle = shared_ptr +FileDescriptorHandle = shared_ptr +OpaqueArrayHandle = shared_ptr +MipmappedArrayHandle = shared_ptr +TexObjectHandle = shared_ptr +SurfObjectHandle = shared_ptr +OpaqueHandle = shared_ptr \ No newline at end of file diff --git a/cuda_core/cuda/core/_resource_handles.pyx b/cuda_core/cuda/core/_resource_handles.pyx new file mode 100644 index 00000000000..9867f5cdcb4 --- /dev/null +++ b/cuda_core/cuda/core/_resource_handles.pyx @@ -0,0 +1,511 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +# This module compiles _cpp/resource_handles.cpp into a shared library. +# Consumer modules cimport the functions declared in _resource_handles.pxd. +# Since there is only one copy of the C++ code (in this .so), all static and +# thread-local state is shared correctly across all consumer modules. +# +# The cdef extern from declarations below satisfy the .pxd declarations directly, +# without needing separate wrapper functions. + +from cpython.pycapsule cimport PyCapsule_GetName, PyCapsule_GetPointer +from libc.stddef cimport size_t + +from cuda.bindings cimport cydriver +from cuda.bindings cimport cynvrtc +from cuda.bindings cimport cynvvm +from cuda.bindings cimport cynvjitlink + +import cuda.bindings.cydriver as cydriver +import cuda.bindings.cynvrtc as cynvrtc +import cuda.bindings.cynvvm as cynvvm +import cuda.bindings.cynvjitlink as cynvjitlink + +# ============================================================================= +# C++ function declarations (non-inline, implemented in resource_handles.cpp) +# +# These declarations satisfy the cdef function declarations in _resource_handles.pxd. +# Consumer modules cimport these functions and calls go through this .so. +# ============================================================================= + +cdef extern from "_cpp/resource_handles.hpp" namespace "cuda_core": + # Thread-local error handling + cydriver.CUresult get_last_error "cuda_core::get_last_error" () noexcept nogil + cydriver.CUresult peek_last_error "cuda_core::peek_last_error" () noexcept nogil + void clear_last_error "cuda_core::clear_last_error" () noexcept nogil + + # Context handles + ContextHandle create_context_handle_ref "cuda_core::create_context_handle_ref" ( + cydriver.CUcontext ctx) except+ nogil + ContextHandle create_context_handle_from_green_ctx "cuda_core::create_context_handle_from_green_ctx" ( + const GreenCtxHandle& h_green_ctx) except+ nogil + GreenCtxHandle get_context_green_ctx "cuda_core::get_context_green_ctx" ( + const ContextHandle& h) noexcept nogil + GreenCtxHandle create_green_ctx_handle "cuda_core::create_green_ctx_handle" ( + cydriver.CUdevResource* resources, unsigned int nbResources, + cydriver.CUdevice dev, unsigned int flags) except+ nogil + GreenCtxHandle create_green_ctx_handle_ref "cuda_core::create_green_ctx_handle_ref" ( + cydriver.CUgreenCtx ctx) except+ nogil + ContextHandle get_primary_context "cuda_core::get_primary_context" ( + int device_id) except+ nogil + ContextHandle get_current_context "cuda_core::get_current_context" () except+ nogil + + # Stream handles + StreamHandle create_stream_handle "cuda_core::create_stream_handle" ( + const ContextHandle& h_ctx, unsigned int flags, int priority) except+ nogil + StreamHandle create_stream_handle_ref "cuda_core::create_stream_handle_ref" ( + cydriver.CUstream stream) except+ nogil + StreamHandle create_stream_handle_with_owner "cuda_core::create_stream_handle_with_owner" ( + cydriver.CUstream stream, object owner) except+ nogil + void py_object_user_object_destroy "cuda_core::py_object_user_object_destroy" ( + void* py_object) noexcept nogil + ContextHandle get_stream_context "cuda_core::get_stream_context" ( + const StreamHandle& h) noexcept nogil + StreamHandle get_legacy_stream "cuda_core::get_legacy_stream" () except+ nogil + StreamHandle get_per_thread_stream "cuda_core::get_per_thread_stream" () except+ nogil + + # Event handles (note: _create_event_handle* are internal due to C++ overloading) + EventHandle create_event_handle "cuda_core::create_event_handle" ( + const ContextHandle& h_ctx, unsigned int flags, + bint timing_enabled, bint is_blocking_sync, + bint ipc_enabled, int device_id) except+ nogil + EventHandle create_event_handle_noctx "cuda_core::create_event_handle_noctx" ( + unsigned int flags) except+ nogil + EventHandle create_event_handle_ref "cuda_core::create_event_handle_ref" ( + cydriver.CUevent event) except+ nogil + EventHandle create_event_handle_ipc "cuda_core::create_event_handle_ipc" ( + const cydriver.CUipcEventHandle& ipc_handle, bint is_blocking_sync) except+ nogil + + # Event metadata getters + bint get_event_timing_enabled "cuda_core::get_event_timing_enabled" ( + const EventHandle& h) noexcept nogil + bint get_event_is_blocking_sync "cuda_core::get_event_is_blocking_sync" ( + const EventHandle& h) noexcept nogil + bint get_event_ipc_enabled "cuda_core::get_event_ipc_enabled" ( + const EventHandle& h) noexcept nogil + int get_event_device_id "cuda_core::get_event_device_id" ( + const EventHandle& h) noexcept nogil + ContextHandle get_event_context "cuda_core::get_event_context" ( + const EventHandle& h) noexcept nogil + + # Memory pool handles + MemoryPoolHandle create_mempool_handle "cuda_core::create_mempool_handle" ( + const cydriver.CUmemPoolProps& props) except+ nogil + MemoryPoolHandle create_mempool_handle_ref "cuda_core::create_mempool_handle_ref" ( + cydriver.CUmemoryPool pool) except+ nogil + MemoryPoolHandle get_device_mempool "cuda_core::get_device_mempool" ( + int device_id) except+ nogil + MemoryPoolHandle create_mempool_handle_ipc "cuda_core::create_mempool_handle_ipc" ( + int fd, cydriver.CUmemAllocationHandleType handle_type) except+ nogil + + # Device pointer handles + DevicePtrHandle deviceptr_alloc_from_pool "cuda_core::deviceptr_alloc_from_pool" ( + size_t size, const MemoryPoolHandle& h_pool, const StreamHandle& h_stream) except+ nogil + DevicePtrHandle deviceptr_alloc_async "cuda_core::deviceptr_alloc_async" ( + size_t size, const StreamHandle& h_stream) except+ nogil + DevicePtrHandle deviceptr_alloc "cuda_core::deviceptr_alloc" (size_t size) except+ nogil + DevicePtrHandle deviceptr_alloc_host "cuda_core::deviceptr_alloc_host" (size_t size) except+ nogil + DevicePtrHandle deviceptr_create_ref "cuda_core::deviceptr_create_ref" ( + cydriver.CUdeviceptr ptr) except+ nogil + DevicePtrHandle deviceptr_create_with_owner "cuda_core::deviceptr_create_with_owner" ( + cydriver.CUdeviceptr ptr, object owner) except+ nogil + DevicePtrHandle deviceptr_create_mapped_graphics "cuda_core::deviceptr_create_mapped_graphics" ( + cydriver.CUdeviceptr ptr, + const GraphicsResourceHandle& h_resource, + const StreamHandle& h_stream) except+ nogil + + # MR deallocation callback + void register_mr_dealloc_callback "cuda_core::register_mr_dealloc_callback" ( + MRDeallocCallback cb) noexcept + DevicePtrHandle deviceptr_create_with_mr "cuda_core::deviceptr_create_with_mr" ( + cydriver.CUdeviceptr ptr, size_t size, object mr) except+ nogil + + DevicePtrHandle deviceptr_import_ipc "cuda_core::deviceptr_import_ipc" ( + const MemoryPoolHandle& h_pool, const void* export_data, const StreamHandle& h_stream) except+ nogil + StreamHandle deallocation_stream "cuda_core::deallocation_stream" ( + const DevicePtrHandle& h) noexcept nogil + void set_deallocation_stream "cuda_core::set_deallocation_stream" ( + const DevicePtrHandle& h, const StreamHandle& h_stream) noexcept nogil + + # Library handles + LibraryHandle create_library_handle_from_file "cuda_core::create_library_handle_from_file" ( + const char* path) except+ nogil + LibraryHandle create_library_handle_from_data "cuda_core::create_library_handle_from_data" ( + const void* data) except+ nogil + LibraryHandle create_library_handle_ref "cuda_core::create_library_handle_ref" ( + cydriver.CUlibrary library) except+ nogil + + # Kernel handles + KernelHandle create_kernel_handle "cuda_core::create_kernel_handle" ( + const LibraryHandle& h_library, const char* name) except+ nogil + KernelHandle create_kernel_handle_ref "cuda_core::create_kernel_handle_ref" ( + cydriver.CUkernel kernel) except+ nogil + LibraryHandle get_kernel_library "cuda_core::get_kernel_library" ( + const KernelHandle& h) noexcept nogil + + # Graph handles + GraphHandle create_graph_handle "cuda_core::create_graph_handle" ( + cydriver.CUgraph graph) except+ nogil + GraphHandle create_graph_handle_ref "cuda_core::create_graph_handle_ref" ( + cydriver.CUgraph graph, const GraphHandle& h_parent) except+ nogil + + # Graph slot attachments + OpaqueHandle make_opaque_py "cuda_core::make_opaque_py" (object obj) except+ + OpaqueHandle make_opaque_malloc "cuda_core::make_opaque_malloc" (void* buf) except+ + cydriver.CUresult graph_set_slot "cuda_core::graph_set_slot" ( + const GraphHandle& h_graph, cydriver.CUgraphNode node, + unsigned int slot, OpaqueHandle owner) except+ + + # Graph exec handles + GraphExecHandle create_graph_exec_handle "cuda_core::create_graph_exec_handle" ( + cydriver.CUgraphExec graph_exec) except+ nogil + + # Graph node handles + GraphNodeHandle create_graph_node_handle "cuda_core::create_graph_node_handle" ( + cydriver.CUgraphNode node, const GraphHandle& h_graph) except+ nogil + GraphHandle graph_node_get_graph "cuda_core::graph_node_get_graph" ( + const GraphNodeHandle& h) noexcept nogil + void invalidate_graph_node "cuda_core::invalidate_graph_node" ( + const GraphNodeHandle& h) noexcept nogil + + # Graphics resource handles + GraphicsResourceHandle create_graphics_resource_handle "cuda_core::create_graphics_resource_handle" ( + cydriver.CUgraphicsResource resource) except+ nogil + + # NVRTC Program handles + NvrtcProgramHandle create_nvrtc_program_handle "cuda_core::create_nvrtc_program_handle" ( + cynvrtc.nvrtcProgram prog) except+ nogil + NvrtcProgramHandle create_nvrtc_program_handle_ref "cuda_core::create_nvrtc_program_handle_ref" ( + cynvrtc.nvrtcProgram prog) except+ nogil + + # NVVM Program handles + NvvmProgramHandle create_nvvm_program_handle "cuda_core::create_nvvm_program_handle" ( + cynvvm.nvvmProgram prog) except+ nogil + NvvmProgramHandle create_nvvm_program_handle_ref "cuda_core::create_nvvm_program_handle_ref" ( + cynvvm.nvvmProgram prog) except+ nogil + + # nvJitLink handles + NvJitLinkHandle create_nvjitlink_handle "cuda_core::create_nvjitlink_handle" ( + cynvjitlink.nvJitLinkHandle handle) except+ nogil + NvJitLinkHandle create_nvjitlink_handle_ref "cuda_core::create_nvjitlink_handle_ref" ( + cynvjitlink.nvJitLinkHandle handle) except+ nogil + + # cuLink handles + CuLinkHandle create_culink_handle "cuda_core::create_culink_handle" ( + cydriver.CUlinkState state) except+ nogil + CuLinkHandle create_culink_handle_ref "cuda_core::create_culink_handle_ref" ( + cydriver.CUlinkState state) except+ nogil + + # File descriptor handles + FileDescriptorHandle create_fd_handle "cuda_core::create_fd_handle" ( + int fd) except+ nogil + FileDescriptorHandle create_fd_handle_ref "cuda_core::create_fd_handle_ref" ( + int fd) except+ nogil + + # SM resource split (13.1+ wrapper — avoids direct cydriver cimport) + # groupParams is void* to avoid referencing CU_DEV_SM_RESOURCE_GROUP_PARAMS + # (which doesn't exist in cuda-bindings 13.0 .pxd). The C++ side casts it. + cydriver.CUresult sm_resource_split "cuda_core::sm_resource_split" ( + cydriver.CUdevResource* result, unsigned int nbGroups, + const cydriver.CUdevResource* input, cydriver.CUdevResource* remainder, + unsigned int flags, void* groupParams) nogil + bint has_sm_resource_split "cuda_core::has_sm_resource_split" () noexcept nogil + + # Array / mipmapped-array / texture / surface handles (PR #467) + OpaqueArrayHandle create_array_handle "cuda_core::create_array_handle" ( + const cydriver.CUDA_ARRAY3D_DESCRIPTOR& desc) except+ nogil + OpaqueArrayHandle create_array_handle_ref "cuda_core::create_array_handle_ref" ( + cydriver.CUarray arr) except+ nogil + OpaqueArrayHandle create_array_handle_owning "cuda_core::create_array_handle_owning" ( + cydriver.CUarray arr) except+ nogil + OpaqueArrayHandle create_array_level_handle "cuda_core::create_array_level_handle" ( + const MipmappedArrayHandle& h_mip, unsigned int level) except+ nogil + MipmappedArrayHandle create_mipmapped_array_handle "cuda_core::create_mipmapped_array_handle" ( + const cydriver.CUDA_ARRAY3D_DESCRIPTOR& desc, unsigned int num_levels) except+ nogil + TexObjectHandle create_tex_object_handle_array "cuda_core::create_tex_object_handle_array" ( + const cydriver.CUDA_RESOURCE_DESC& res, const cydriver.CUDA_TEXTURE_DESC& tex, + const OpaqueArrayHandle& h_backing) except+ nogil + TexObjectHandle create_tex_object_handle_mipmap "cuda_core::create_tex_object_handle_mipmap" ( + const cydriver.CUDA_RESOURCE_DESC& res, const cydriver.CUDA_TEXTURE_DESC& tex, + const MipmappedArrayHandle& h_backing) except+ nogil + TexObjectHandle create_tex_object_handle_linear "cuda_core::create_tex_object_handle_linear" ( + const cydriver.CUDA_RESOURCE_DESC& res, const cydriver.CUDA_TEXTURE_DESC& tex, + const DevicePtrHandle& h_backing) except+ nogil + SurfObjectHandle create_surf_object_handle "cuda_core::create_surf_object_handle" ( + const cydriver.CUDA_RESOURCE_DESC& res, const OpaqueArrayHandle& h_backing) except+ nogil + + +# ============================================================================= +# CUDA Driver API capsule +# +# This provides resolved CUDA driver function pointers to the C++ code. +# ============================================================================= + +cdef const char* _CUDA_DRIVER_API_V1_NAME = b"cuda.core._resource_handles._CUDA_DRIVER_API_V1" + + +# ============================================================================= +# CUDA driver function pointer initialization +# +# The C++ code declares extern function pointers (p_cuXxx) that need to be +# populated before any handle creation functions are called. We extract these +# from cuda.bindings.cydriver.__pyx_capi__ at module import time. +# +# The Cython string substitution (e.g., "reinterpret_cast(...)") +# allows us to assign void* values to typed function pointer variables. +# ============================================================================= + +# Declare extern variables with reinterpret_cast to allow void* assignment +cdef extern from "_cpp/resource_handles.hpp" namespace "cuda_core": + # Context + void* p_cuDevicePrimaryCtxRetain "reinterpret_cast(cuda_core::p_cuDevicePrimaryCtxRetain)" + void* p_cuDevicePrimaryCtxRelease "reinterpret_cast(cuda_core::p_cuDevicePrimaryCtxRelease)" + void* p_cuCtxGetCurrent "reinterpret_cast(cuda_core::p_cuCtxGetCurrent)" + void* p_cuGreenCtxCreate "reinterpret_cast(cuda_core::p_cuGreenCtxCreate)" + void* p_cuGreenCtxDestroy "reinterpret_cast(cuda_core::p_cuGreenCtxDestroy)" + void* p_cuCtxFromGreenCtx "reinterpret_cast(cuda_core::p_cuCtxFromGreenCtx)" + void* p_cuDevResourceGenerateDesc "reinterpret_cast(cuda_core::p_cuDevResourceGenerateDesc)" + void* p_cuGreenCtxStreamCreate "reinterpret_cast(cuda_core::p_cuGreenCtxStreamCreate)" + + # Stream + void* p_cuStreamCreateWithPriority "reinterpret_cast(cuda_core::p_cuStreamCreateWithPriority)" + void* p_cuStreamDestroy "reinterpret_cast(cuda_core::p_cuStreamDestroy)" + + # Event + void* p_cuEventCreate "reinterpret_cast(cuda_core::p_cuEventCreate)" + void* p_cuEventDestroy "reinterpret_cast(cuda_core::p_cuEventDestroy)" + void* p_cuIpcOpenEventHandle "reinterpret_cast(cuda_core::p_cuIpcOpenEventHandle)" + + # Device + void* p_cuDeviceGetCount "reinterpret_cast(cuda_core::p_cuDeviceGetCount)" + + # Memory pool + void* p_cuMemPoolSetAccess "reinterpret_cast(cuda_core::p_cuMemPoolSetAccess)" + void* p_cuMemPoolDestroy "reinterpret_cast(cuda_core::p_cuMemPoolDestroy)" + void* p_cuMemPoolCreate "reinterpret_cast(cuda_core::p_cuMemPoolCreate)" + void* p_cuDeviceGetMemPool "reinterpret_cast(cuda_core::p_cuDeviceGetMemPool)" + void* p_cuMemPoolImportFromShareableHandle "reinterpret_cast(cuda_core::p_cuMemPoolImportFromShareableHandle)" + + # Memory allocation + void* p_cuMemAllocFromPoolAsync "reinterpret_cast(cuda_core::p_cuMemAllocFromPoolAsync)" + void* p_cuMemAllocAsync "reinterpret_cast(cuda_core::p_cuMemAllocAsync)" + void* p_cuMemAlloc "reinterpret_cast(cuda_core::p_cuMemAlloc)" + void* p_cuMemAllocHost "reinterpret_cast(cuda_core::p_cuMemAllocHost)" + + # Memory deallocation + void* p_cuMemFreeAsync "reinterpret_cast(cuda_core::p_cuMemFreeAsync)" + void* p_cuMemFree "reinterpret_cast(cuda_core::p_cuMemFree)" + void* p_cuMemFreeHost "reinterpret_cast(cuda_core::p_cuMemFreeHost)" + + # IPC + void* p_cuMemPoolImportPointer "reinterpret_cast(cuda_core::p_cuMemPoolImportPointer)" + + # Library + void* p_cuLibraryLoadFromFile "reinterpret_cast(cuda_core::p_cuLibraryLoadFromFile)" + void* p_cuLibraryLoadData "reinterpret_cast(cuda_core::p_cuLibraryLoadData)" + void* p_cuLibraryUnload "reinterpret_cast(cuda_core::p_cuLibraryUnload)" + void* p_cuLibraryGetKernel "reinterpret_cast(cuda_core::p_cuLibraryGetKernel)" + + # Graph + void* p_cuGraphDestroy "reinterpret_cast(cuda_core::p_cuGraphDestroy)" + void* p_cuGraphExecDestroy "reinterpret_cast(cuda_core::p_cuGraphExecDestroy)" + void* p_cuUserObjectCreate "reinterpret_cast(cuda_core::p_cuUserObjectCreate)" + void* p_cuUserObjectRelease "reinterpret_cast(cuda_core::p_cuUserObjectRelease)" + void* p_cuGraphRetainUserObject "reinterpret_cast(cuda_core::p_cuGraphRetainUserObject)" + + # Linker + void* p_cuLinkDestroy "reinterpret_cast(cuda_core::p_cuLinkDestroy)" + + # Graphics interop + void* p_cuGraphicsUnmapResources "reinterpret_cast(cuda_core::p_cuGraphicsUnmapResources)" + void* p_cuGraphicsUnregisterResource "reinterpret_cast(cuda_core::p_cuGraphicsUnregisterResource)" + + # Texture / surface / array (PR #467) + void* p_cuArray3DCreate "reinterpret_cast(cuda_core::p_cuArray3DCreate)" + void* p_cuArrayDestroy "reinterpret_cast(cuda_core::p_cuArrayDestroy)" + void* p_cuMipmappedArrayCreate "reinterpret_cast(cuda_core::p_cuMipmappedArrayCreate)" + void* p_cuMipmappedArrayDestroy "reinterpret_cast(cuda_core::p_cuMipmappedArrayDestroy)" + void* p_cuMipmappedArrayGetLevel "reinterpret_cast(cuda_core::p_cuMipmappedArrayGetLevel)" + void* p_cuTexObjectCreate "reinterpret_cast(cuda_core::p_cuTexObjectCreate)" + void* p_cuTexObjectDestroy "reinterpret_cast(cuda_core::p_cuTexObjectDestroy)" + void* p_cuSurfObjectCreate "reinterpret_cast(cuda_core::p_cuSurfObjectCreate)" + void* p_cuSurfObjectDestroy "reinterpret_cast(cuda_core::p_cuSurfObjectDestroy)" + + # SM resource split (13.1+) + void* p_cuDevSmResourceSplit "reinterpret_cast(cuda_core::p_cuDevSmResourceSplit)" + + # NVRTC + void* p_nvrtcDestroyProgram "reinterpret_cast(cuda_core::p_nvrtcDestroyProgram)" + + # NVVM + void* p_nvvmDestroyProgram "reinterpret_cast(cuda_core::p_nvvmDestroyProgram)" + + # nvJitLink + void* p_nvJitLinkDestroy "reinterpret_cast(cuda_core::p_nvJitLinkDestroy)" + + +# Initialize driver function pointers from cydriver.__pyx_capi__ at module load +cdef void* _get_driver_fn(str name): + capsule = cydriver.__pyx_capi__[name] + return PyCapsule_GetPointer(capsule, PyCapsule_GetName(capsule)) + + +cdef void* _get_optional_driver_fn(str name): + try: + capsule = cydriver.__pyx_capi__[name] + except KeyError: + return NULL + return PyCapsule_GetPointer(capsule, PyCapsule_GetName(capsule)) + + +cdef void _init_driver_fn_pointers() noexcept: + global p_cuDevicePrimaryCtxRetain, p_cuDevicePrimaryCtxRelease, p_cuCtxGetCurrent + global p_cuGreenCtxCreate, p_cuGreenCtxDestroy, p_cuCtxFromGreenCtx + global p_cuDevResourceGenerateDesc, p_cuGreenCtxStreamCreate + global p_cuStreamCreateWithPriority, p_cuStreamDestroy + global p_cuEventCreate, p_cuEventDestroy, p_cuIpcOpenEventHandle + global p_cuDeviceGetCount + global p_cuMemPoolSetAccess, p_cuMemPoolDestroy, p_cuMemPoolCreate + global p_cuDeviceGetMemPool, p_cuMemPoolImportFromShareableHandle + global p_cuMemAllocFromPoolAsync, p_cuMemAllocAsync, p_cuMemAlloc, p_cuMemAllocHost + global p_cuMemFreeAsync, p_cuMemFree, p_cuMemFreeHost + global p_cuMemPoolImportPointer + global p_cuLibraryLoadFromFile, p_cuLibraryLoadData, p_cuLibraryUnload, p_cuLibraryGetKernel + global p_cuGraphDestroy, p_cuGraphExecDestroy + global p_cuUserObjectCreate, p_cuUserObjectRelease, p_cuGraphRetainUserObject + global p_cuLinkDestroy + global p_cuGraphicsUnmapResources, p_cuGraphicsUnregisterResource + global p_cuDevSmResourceSplit + global p_cuArray3DCreate, p_cuArrayDestroy + global p_cuMipmappedArrayCreate, p_cuMipmappedArrayDestroy, p_cuMipmappedArrayGetLevel + global p_cuTexObjectCreate, p_cuTexObjectDestroy + global p_cuSurfObjectCreate, p_cuSurfObjectDestroy + + # Context + p_cuDevicePrimaryCtxRetain = _get_driver_fn("cuDevicePrimaryCtxRetain") + p_cuDevicePrimaryCtxRelease = _get_driver_fn("cuDevicePrimaryCtxRelease") + p_cuCtxGetCurrent = _get_driver_fn("cuCtxGetCurrent") + p_cuGreenCtxCreate = _get_optional_driver_fn("cuGreenCtxCreate") + p_cuGreenCtxDestroy = _get_optional_driver_fn("cuGreenCtxDestroy") + p_cuCtxFromGreenCtx = _get_optional_driver_fn("cuCtxFromGreenCtx") + p_cuDevResourceGenerateDesc = _get_optional_driver_fn("cuDevResourceGenerateDesc") + p_cuGreenCtxStreamCreate = _get_optional_driver_fn("cuGreenCtxStreamCreate") + + # Stream + p_cuStreamCreateWithPriority = _get_driver_fn("cuStreamCreateWithPriority") + p_cuStreamDestroy = _get_driver_fn("cuStreamDestroy") + + # Event + p_cuEventCreate = _get_driver_fn("cuEventCreate") + p_cuEventDestroy = _get_driver_fn("cuEventDestroy") + p_cuIpcOpenEventHandle = _get_driver_fn("cuIpcOpenEventHandle") + + # Device + p_cuDeviceGetCount = _get_driver_fn("cuDeviceGetCount") + + # Memory pool + p_cuMemPoolSetAccess = _get_driver_fn("cuMemPoolSetAccess") + p_cuMemPoolDestroy = _get_driver_fn("cuMemPoolDestroy") + p_cuMemPoolCreate = _get_driver_fn("cuMemPoolCreate") + p_cuDeviceGetMemPool = _get_driver_fn("cuDeviceGetMemPool") + p_cuMemPoolImportFromShareableHandle = _get_driver_fn("cuMemPoolImportFromShareableHandle") + + # Memory allocation + p_cuMemAllocFromPoolAsync = _get_driver_fn("cuMemAllocFromPoolAsync") + p_cuMemAllocAsync = _get_driver_fn("cuMemAllocAsync") + p_cuMemAlloc = _get_driver_fn("cuMemAlloc") + p_cuMemAllocHost = _get_driver_fn("cuMemAllocHost") + + # Memory deallocation + p_cuMemFreeAsync = _get_driver_fn("cuMemFreeAsync") + p_cuMemFree = _get_driver_fn("cuMemFree") + p_cuMemFreeHost = _get_driver_fn("cuMemFreeHost") + + # IPC + p_cuMemPoolImportPointer = _get_driver_fn("cuMemPoolImportPointer") + + # Library + p_cuLibraryLoadFromFile = _get_driver_fn("cuLibraryLoadFromFile") + p_cuLibraryLoadData = _get_driver_fn("cuLibraryLoadData") + p_cuLibraryUnload = _get_driver_fn("cuLibraryUnload") + p_cuLibraryGetKernel = _get_driver_fn("cuLibraryGetKernel") + + # Graph + p_cuGraphDestroy = _get_driver_fn("cuGraphDestroy") + p_cuGraphExecDestroy = _get_driver_fn("cuGraphExecDestroy") + p_cuUserObjectCreate = _get_driver_fn("cuUserObjectCreate") + p_cuUserObjectRelease = _get_driver_fn("cuUserObjectRelease") + p_cuGraphRetainUserObject = _get_driver_fn("cuGraphRetainUserObject") + + # Linker + p_cuLinkDestroy = _get_driver_fn("cuLinkDestroy") + + # Graphics interop + p_cuGraphicsUnmapResources = _get_driver_fn("cuGraphicsUnmapResources") + p_cuGraphicsUnregisterResource = _get_driver_fn("cuGraphicsUnregisterResource") + + # Texture / surface / array (PR #467) + p_cuArray3DCreate = _get_driver_fn("cuArray3DCreate") + p_cuArrayDestroy = _get_driver_fn("cuArrayDestroy") + p_cuMipmappedArrayCreate = _get_driver_fn("cuMipmappedArrayCreate") + p_cuMipmappedArrayDestroy = _get_driver_fn("cuMipmappedArrayDestroy") + p_cuMipmappedArrayGetLevel = _get_driver_fn("cuMipmappedArrayGetLevel") + p_cuTexObjectCreate = _get_driver_fn("cuTexObjectCreate") + p_cuTexObjectDestroy = _get_driver_fn("cuTexObjectDestroy") + p_cuSurfObjectCreate = _get_driver_fn("cuSurfObjectCreate") + p_cuSurfObjectDestroy = _get_driver_fn("cuSurfObjectDestroy") + + # SM resource split (13.1+ — may not exist in older cuda-bindings) + p_cuDevSmResourceSplit = _get_optional_driver_fn("cuDevSmResourceSplit") + +_init_driver_fn_pointers() + +# ============================================================================= +# NVRTC function pointer initialization +# ============================================================================= + +cdef void* _get_nvrtc_fn(str name): + capsule = cynvrtc.__pyx_capi__[name] + return PyCapsule_GetPointer(capsule, PyCapsule_GetName(capsule)) + +cdef void _init_nvrtc_fn_pointers() noexcept: + global p_nvrtcDestroyProgram + p_nvrtcDestroyProgram = _get_nvrtc_fn("nvrtcDestroyProgram") + +_init_nvrtc_fn_pointers() + +# ============================================================================= +# NVVM function pointer initialization +# +# NVVM may not be available at runtime, so we handle missing function pointers +# gracefully. The C++ deleter checks for null before calling. +# ============================================================================= + +cdef void* _get_nvvm_fn(str name): + capsule = cynvvm.__pyx_capi__[name] + return PyCapsule_GetPointer(capsule, PyCapsule_GetName(capsule)) + +cdef void _init_nvvm_fn_pointers() noexcept: + global p_nvvmDestroyProgram + p_nvvmDestroyProgram = _get_nvvm_fn("nvvmDestroyProgram") + +_init_nvvm_fn_pointers() + +# ============================================================================= +# nvJitLink function pointer initialization +# +# nvJitLink may not be available at runtime, so we handle missing function +# pointers gracefully. The C++ deleter checks for null before calling. +# ============================================================================= + +cdef void* _get_nvjitlink_fn(str name): + capsule = cynvjitlink.__pyx_capi__[name] + return PyCapsule_GetPointer(capsule, PyCapsule_GetName(capsule)) + +cdef void _init_nvjitlink_fn_pointers() noexcept: + global p_nvJitLinkDestroy + p_nvJitLinkDestroy = _get_nvjitlink_fn("nvJitLinkDestroy") + +_init_nvjitlink_fn_pointers() diff --git a/cuda_core/cuda/core/_stream.pxd b/cuda_core/cuda/core/_stream.pxd new file mode 100644 index 00000000000..de16b84bde2 --- /dev/null +++ b/cuda_core/cuda/core/_stream.pxd @@ -0,0 +1,25 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from cuda.core._resource_handles cimport ContextHandle, StreamHandle + + +cdef class Stream: + + cdef: + StreamHandle _h_stream + ContextHandle _h_context + int _device_id + int _nonblocking + int _priority + object __weakref__ + + @staticmethod + cdef Stream _from_handle(type cls, StreamHandle h_stream) + + cpdef close(self) + + +cpdef Stream default_stream() +cpdef Stream Stream_accept(arg, bint allow_stream_protocol=*) diff --git a/cuda_core/cuda/core/_stream.pyi b/cuda_core/cuda/core/_stream.pyi new file mode 100644 index 00000000000..f4d78982a1d --- /dev/null +++ b/cuda_core/cuda/core/_stream.pyi @@ -0,0 +1,230 @@ +# This file was generated by stubgen-pyx v0.2.6 from cuda_core/cuda/core/_stream.pyx + +from __future__ import annotations + +from dataclasses import dataclass +from typing import Protocol + +import cuda.bindings.driver +import cython +from cuda.core._context import Context +from cuda.core._device import Device +from cuda.core._device_resources import DeviceResources +from cuda.core._event import Event, EventOptions +from cuda.core.graph import GraphBuilder + + +@dataclass +class StreamOptions: + """Customizable :obj:`~_stream.Stream` options. + + Attributes + ---------- + nonblocking : bool, optional + Stream does not synchronize with the NULL stream. (Default to True) + priority : int, optional + Stream priority where lower number represents a + higher priority. (Default to lowest priority) + + """ + nonblocking: cython.bint = True + priority: int | None = None + +class IsStreamType(Protocol): + + def __cuda_stream__(self) -> tuple[int, int]: + """ + For any Python object that is meant to be interpreted as a CUDA stream, the intent + can be communicated by implementing this protocol that returns a 2-tuple: The protocol + version number (currently ``0``) and the address of ``cudaStream_t``. Both values + should be Python `int`. + """ + +class Stream: + """Represent a queue of GPU operations that are executed in a specific order. + + Applications use streams to control the order of execution for + GPU work. Work within a single stream are executed sequentially. + Whereas work across multiple streams can be further controlled + using stream priorities and :obj:`~_event.Event` managements. + + Advanced users can utilize default streams for enforce complex + implicit synchronization behaviors. + + Directly creating a :obj:`~_stream.Stream` is not supported due to ambiguity. + New streams should instead be created through a :obj:`~_device.Device` + object, or created directly through using an existing handle + using Stream.from_handle(). + """ + + def close(self): + """Destroy the stream. + + Releases the stream handle. For owned streams, this destroys the + underlying CUDA stream. For borrowed streams, this releases the + reference and allows the Python owner to be GC'd. + """ + + def __init__(self, *args, **kwargs) -> None: + ... + + @classmethod + def _legacy_default(cls) -> Stream: + """Return the legacy default stream (supports subclassing).""" + + @classmethod + def _per_thread_default(cls) -> Stream: + """Return the per-thread default stream (supports subclassing).""" + + @classmethod + def _init(cls, obj: IsStreamType | None=None, options: object=None, device_id: int | None=None, ctx: Context | None=None) -> Stream: + ... + + def __cuda_stream__(self) -> tuple[int, int]: + """Return an instance of a __cuda_stream__ protocol.""" + + def __hash__(self) -> int: + ... + + def __eq__(self, other: object) -> bool: + ... + + def __repr__(self) -> str: + ... + + @property + def handle(self) -> cuda.bindings.driver.CUstream: + """Return the underlying ``CUstream`` object. + + .. caution:: + + This handle is a Python object. To get the memory address of the underlying C + handle, call ``int(Stream.handle)``. + """ + + @property + def is_nonblocking(self) -> bool: + """Return True if this is a nonblocking stream, otherwise False.""" + + @property + def priority(self) -> int: + """Return the stream priority.""" + + def sync(self) -> None: + """Synchronize the stream.""" + + def record(self, event: Event | None=None, options: EventOptions | None=None) -> Event: + """Record an event onto the stream. + + Creates an :obj:`~_event.Event` object (or reuses the given one) by + recording on the stream. + + Parameters + ---------- + event : :obj:`~_event.Event`, optional + Optional event object to be reused for recording. + options : :obj:`EventOptions`, optional + Customizable dataclass for event creation options. + + Returns + ------- + :obj:`~_event.Event` + Newly created event object. + + """ + + def wait(self, event_or_stream: Event | Stream) -> None: + """Wait for a CUDA event or a CUDA stream. + + Waiting for an event or a stream establishes a stream order. + + If a :obj:`~_stream.Stream` is provided, then wait until the stream's + work is completed. This is done by recording a new :obj:`~_event.Event` + on the stream and then waiting on it. + + Parameters + ---------- + event_or_stream : :obj:`~_event.Event` | :obj:`~_stream.Stream` + The event or stream to wait for. Objects supporting the + ``__cuda_stream__`` protocol are also accepted and treated as + streams. + + """ + + @property + def device(self) -> Device: + """Return the :obj:`~_device.Device` singleton associated with this stream. + + Note + ---- + The current context on the device may differ from this + stream's context. This case occurs when a different CUDA + context is set current after a stream is created. + + """ + + @property + def context(self) -> Context: + """Return the :obj:`~_context.Context` associated with this stream.""" + + @property + def resources(self) -> DeviceResources: + """Query the hardware resources provisioned for this stream's context. + + For streams created from a green context, returns the resources + that context was provisioned with. For streams on the primary + context, returns the full device resources. + """ + + @staticmethod + def from_handle(handle) -> Stream: + """Create a new :obj:`~_stream.Stream` object from a foreign stream handle. + + Uses a cudaStream_t pointer address represented as a Python int + to create a new :obj:`~_stream.Stream` object. + + Note + ---- + Stream lifetime is not managed, foreign object must remain + alive while this stream is active. + + Parameters + ---------- + handle : int + Stream handle representing the address of a foreign + stream object. + + Returns + ------- + :obj:`~_stream.Stream` + Newly created stream object. + + """ + + def create_graph_builder(self) -> GraphBuilder: + """Create a new :obj:`~graph.GraphBuilder` object. + + The new graph builder will be associated with this stream. + + Returns + ------- + :obj:`~graph.GraphBuilder` + Newly created graph builder object. + + """ +LEGACY_DEFAULT_STREAM: Stream = Stream._legacy_default() +PER_THREAD_DEFAULT_STREAM: Stream = Stream._per_thread_default() + +def default_stream() -> Stream: + """Return the default CUDA :obj:`~_stream.Stream`. + + The type of default stream returned depends on if the environment + variable CUDA_PYTHON_CUDA_PER_THREAD_DEFAULT_STREAM is set. + + If set, returns a per-thread default stream. Otherwise returns + the legacy stream. + + """ + +def Stream_accept(arg, allow_stream_protocol: bool=False) -> Stream: + ... \ No newline at end of file diff --git a/cuda_core/cuda/core/_stream.pyx b/cuda_core/cuda/core/_stream.pyx new file mode 100644 index 00000000000..5212ec5c7de --- /dev/null +++ b/cuda_core/cuda/core/_stream.pyx @@ -0,0 +1,542 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from __future__ import annotations + +from libc.stdint cimport uintptr_t, INT32_MIN +from libc.stdlib cimport strtol, getenv + +from cuda.bindings cimport cydriver + +from cuda.core._event cimport Event as cyEvent +from cuda.core._utils.cuda_utils cimport ( + check_or_create_options, + HANDLE_RETURN, +) + +import cython +import warnings +from dataclasses import dataclass +from typing import Protocol, TYPE_CHECKING + +from cuda.core._context cimport Context +from cuda.core._device_resources cimport DeviceResources +from cuda.core._event import Event, EventOptions + +from cuda.core._resource_handles cimport ( + ContextHandle, + EventHandle, + StreamHandle, + create_context_handle_ref, + create_event_handle_noctx, + create_stream_handle, + create_stream_handle_with_owner, + get_current_context, + get_last_error, + get_legacy_stream, + get_per_thread_stream, + get_stream_context, + as_intptr, + as_cu, + as_py, +) + +if TYPE_CHECKING: + import cuda.bindings.driver # no-cython-lint + from cuda.core._device import Device + from cuda.core.graph import GraphBuilder + +@dataclass +cdef class StreamOptions: + """Customizable :obj:`~_stream.Stream` options. + + Attributes + ---------- + nonblocking : bool, optional + Stream does not synchronize with the NULL stream. (Default to True) + priority : int, optional + Stream priority where lower number represents a + higher priority. (Default to lowest priority) + + """ + + nonblocking : cython.bint = True + priority: int | None = None + + +class IsStreamType(Protocol): + def __cuda_stream__(self) -> tuple[int, int]: + """ + For any Python object that is meant to be interpreted as a CUDA stream, the intent + can be communicated by implementing this protocol that returns a 2-tuple: The protocol + version number (currently ``0``) and the address of ``cudaStream_t``. Both values + should be Python `int`. + """ + ... + + +cdef class Stream: + """Represent a queue of GPU operations that are executed in a specific order. + + Applications use streams to control the order of execution for + GPU work. Work within a single stream are executed sequentially. + Whereas work across multiple streams can be further controlled + using stream priorities and :obj:`~_event.Event` managements. + + Advanced users can utilize default streams for enforce complex + implicit synchronization behaviors. + + Directly creating a :obj:`~_stream.Stream` is not supported due to ambiguity. + New streams should instead be created through a :obj:`~_device.Device` + object, or created directly through using an existing handle + using Stream.from_handle(). + """ + def __init__(self, *args, **kwargs) -> None: + raise RuntimeError( + "Stream objects cannot be instantiated directly. " + "Please use Device APIs (create_stream) or other Stream APIs (from_handle)." + ) + + @staticmethod + cdef Stream _from_handle(type cls, StreamHandle h_stream): + """Create a Stream from an existing StreamHandle (cdef-only factory).""" + cdef Stream s = cls.__new__(cls) + s._h_stream = h_stream + s._h_context = get_stream_context(h_stream) + s._device_id = -1 # lazy init'd (invalid sentinel) + s._nonblocking = -1 # lazy init'd + s._priority = INT32_MIN # lazy init'd + return s + + @classmethod + def _legacy_default(cls) -> Stream: + """Return the legacy default stream (supports subclassing).""" + return Stream._from_handle(cls, get_legacy_stream()) + + @classmethod + def _per_thread_default(cls) -> Stream: + """Return the per-thread default stream (supports subclassing).""" + return Stream._from_handle(cls, get_per_thread_stream()) + + @classmethod + def _init(cls, obj: IsStreamType | None = None, options: object = None, + device_id: int | None = None, ctx: Context | None = None) -> Stream: + cdef StreamHandle h_stream + cdef cydriver.CUstream borrowed + cdef ContextHandle h_context + cdef Stream self + + # Extract context handle if provided + if ctx is not None: + h_context = (ctx)._h_context + + if obj is not None and options is not None: + raise ValueError("obj and options cannot be both specified") + if obj is not None: + # Borrowed stream from foreign object + # C++ handle prevents owner from being GC'd until handle is released + # Owner is responsible for keeping the stream's context alive + borrowed = _handle_from_stream_protocol(obj) + h_stream = create_stream_handle_with_owner(borrowed, obj) + return Stream._from_handle(cls, h_stream) + + cdef StreamOptions opts = check_or_create_options(StreamOptions, options, "Stream options") + nonblocking = opts.nonblocking + priority = opts.priority + + cdef unsigned int flags = (cydriver.CUstream_flags.CU_STREAM_NON_BLOCKING if nonblocking + else cydriver.CUstream_flags.CU_STREAM_DEFAULT) + # TODO: we might want to consider memoizing high/low per CUDA context and avoid this call + cdef int high, low + cdef cydriver.CUresult res_code + with nogil: + res_code = cydriver.cuCtxGetStreamPriorityRange(&high, &low) + if res_code != cydriver.CUresult.CUDA_SUCCESS: + if res_code == cydriver.CUresult.CUDA_ERROR_INVALID_CONTEXT: + raise RuntimeError( + "No current CUDA context. Call dev.set_current() before creating streams." + ) + HANDLE_RETURN(res_code) + cdef int prio + if priority is not None: + prio = priority + if not (low <= prio <= high): + raise ValueError(f"{priority=} is out of range {[low, high]}") + else: + prio = high + + # C++ creates the stream and returns owning handle with context dependency. + # For green contexts, the C++ layer auto-dispatches to cuGreenCtxStreamCreate. + h_stream = create_stream_handle(h_context, flags, prio) + if not h_stream: + res_code = get_last_error() + if not nonblocking and res_code == cydriver.CUresult.CUDA_ERROR_INVALID_VALUE: + # cuGreenCtxStreamCreate rejects CU_STREAM_DEFAULT; + # no need to check is_green since primary streams don't fail this way + raise ValueError( + "Green context streams must be non-blocking. " + "Use StreamOptions(nonblocking=True) or omit the option (True is the default)." + ) + elif res_code == cydriver.CUresult.CUDA_ERROR_NOT_SUPPORTED: + raise RuntimeError( + "cuGreenCtxStreamCreate is not available. " + "Green context stream creation requires CUDA 12.5 or newer." + ) + else: + HANDLE_RETURN(res_code) + self = Stream._from_handle(cls, h_stream) + self._nonblocking = int(nonblocking) + self._priority = prio + if device_id is not None: + self._device_id = device_id + return self + + cpdef close(self): + """Destroy the stream. + + Releases the stream handle. For owned streams, this destroys the + underlying CUDA stream. For borrowed streams, this releases the + reference and allows the Python owner to be GC'd. + """ + self._h_stream.reset() + + def __cuda_stream__(self) -> tuple[int, int]: + """Return an instance of a __cuda_stream__ protocol.""" + return (0, as_intptr(self._h_stream)) + + def __hash__(self) -> int: + return hash(as_intptr(self._h_stream)) + + def __eq__(self, other: object) -> bool: + if not isinstance(other, Stream): + return NotImplemented + return as_intptr(self._h_stream) == as_intptr((other)._h_stream) + + def __repr__(self) -> str: + Stream_ensure_ctx(self) + return f"" + + @property + def handle(self) -> cuda.bindings.driver.CUstream: + """Return the underlying ``CUstream`` object. + + .. caution:: + + This handle is a Python object. To get the memory address of the underlying C + handle, call ``int(Stream.handle)``. + """ + return as_py(self._h_stream) + + @property + def is_nonblocking(self) -> bool: + """Return True if this is a nonblocking stream, otherwise False.""" + cdef unsigned int flags + if self._nonblocking == -1: + with nogil: + HANDLE_RETURN(cydriver.cuStreamGetFlags(as_cu(self._h_stream), &flags)) + self._nonblocking = flags & cydriver.CUstream_flags.CU_STREAM_NON_BLOCKING + return bool(self._nonblocking) + + @property + def priority(self) -> int: + """Return the stream priority.""" + cdef int prio + if self._priority == INT32_MIN: + with nogil: + HANDLE_RETURN(cydriver.cuStreamGetPriority(as_cu(self._h_stream), &prio)) + self._priority = prio + return self._priority + + def sync(self) -> None: + """Synchronize the stream.""" + with nogil: + HANDLE_RETURN(cydriver.cuStreamSynchronize(as_cu(self._h_stream))) + + def record(self, event: Event | None = None, options: EventOptions | None = None) -> Event: + """Record an event onto the stream. + + Creates an :obj:`~_event.Event` object (or reuses the given one) by + recording on the stream. + + Parameters + ---------- + event : :obj:`~_event.Event`, optional + Optional event object to be reused for recording. + options : :obj:`EventOptions`, optional + Customizable dataclass for event creation options. + + Returns + ------- + :obj:`~_event.Event` + Newly created event object. + + """ + # Create an Event object (or reusing the given one) by recording + # on the stream. Event flags such as disabling timing, nonblocking, + # and CU_EVENT_RECORD_EXTERNAL, can be set in EventOptions. + if event is None: + Stream_ensure_ctx_device(self) + event = cyEvent._init(cyEvent, self._device_id, self._h_context, options, False) + elif event.is_ipc_enabled: + raise TypeError( + "IPC-enabled events should not be re-recorded, instead create a " + "new event by supplying options." + ) + + cdef cydriver.CUevent e = as_cu(((event))._h_event) + with nogil: + HANDLE_RETURN(cydriver.cuEventRecord(e, as_cu(self._h_stream))) + return event + + def wait(self, event_or_stream: Event | Stream) -> None: + """Wait for a CUDA event or a CUDA stream. + + Waiting for an event or a stream establishes a stream order. + + If a :obj:`~_stream.Stream` is provided, then wait until the stream's + work is completed. This is done by recording a new :obj:`~_event.Event` + on the stream and then waiting on it. + + Parameters + ---------- + event_or_stream : :obj:`~_event.Event` | :obj:`~_stream.Stream` + The event or stream to wait for. Objects supporting the + ``__cuda_stream__`` protocol are also accepted and treated as + streams. + + """ + cdef Stream stream + cdef EventHandle h_event + + # Handle Event directly + if isinstance(event_or_stream, Event): + with nogil: + # TODO: support flags other than 0? + HANDLE_RETURN(cydriver.cuStreamWaitEvent( + as_cu(self._h_stream), as_cu((event_or_stream)._h_event), 0)) + return + + # Convert to Stream if needed + if isinstance(event_or_stream, Stream): + stream = event_or_stream + else: + try: + stream = Stream._init(obj=event_or_stream) + except Exception as e: + raise ValueError( + "only an Event, Stream, or object supporting __cuda_stream__ can be waited," + f" got {type(event_or_stream)}" + ) from e + + # Wait on stream via temporary event + with nogil: + h_event = create_event_handle_noctx(cydriver.CUevent_flags.CU_EVENT_DISABLE_TIMING) + HANDLE_RETURN(cydriver.cuEventRecord(as_cu(h_event), as_cu(stream._h_stream))) + # TODO: support flags other than 0? + HANDLE_RETURN(cydriver.cuStreamWaitEvent(as_cu(self._h_stream), as_cu(h_event), 0)) + + @property + def device(self) -> Device: + """Return the :obj:`~_device.Device` singleton associated with this stream. + + Note + ---- + The current context on the device may differ from this + stream's context. This case occurs when a different CUDA + context is set current after a stream is created. + + """ + from cuda.core._device import Device # avoid circular import + Stream_ensure_ctx_device(self) + return Device(self._device_id) + + @property + def context(self) -> Context: + """Return the :obj:`~_context.Context` associated with this stream.""" + Stream_ensure_ctx(self) + Stream_ensure_ctx_device(self) + return Context._from_handle(Context, self._h_context, self._device_id) + + @property + def resources(self) -> DeviceResources: + """Query the hardware resources provisioned for this stream's context. + + For streams created from a green context, returns the resources + that context was provisioned with. For streams on the primary + context, returns the full device resources. + """ + Stream_ensure_ctx(self) + Stream_ensure_ctx_device(self) + return DeviceResources._init_from_ctx(self._h_context, self._device_id) + + @staticmethod + def from_handle(handle) -> Stream: + """Create a new :obj:`~_stream.Stream` object from a foreign stream handle. + + Uses a cudaStream_t pointer address represented as a Python int + to create a new :obj:`~_stream.Stream` object. + + Note + ---- + Stream lifetime is not managed, foreign object must remain + alive while this stream is active. + + Parameters + ---------- + handle : int + Stream handle representing the address of a foreign + stream object. + + Returns + ------- + :obj:`~_stream.Stream` + Newly created stream object. + + """ + + class _stream_holder: + def __cuda_stream__(self) -> tuple[int, int]: + return (0, handle) + + return Stream._init(obj=_stream_holder()) + + def create_graph_builder(self) -> GraphBuilder: + """Create a new :obj:`~graph.GraphBuilder` object. + + The new graph builder will be associated with this stream. + + Returns + ------- + :obj:`~graph.GraphBuilder` + Newly created graph builder object. + + """ + from cuda.core.graph._graph_builder import GraphBuilder + + return GraphBuilder._init(self) + + +LEGACY_DEFAULT_STREAM: Stream = Stream._legacy_default() +PER_THREAD_DEFAULT_STREAM: Stream = Stream._per_thread_default() + + +cpdef Stream default_stream(): + """Return the default CUDA :obj:`~_stream.Stream`. + + The type of default stream returned depends on if the environment + variable CUDA_PYTHON_CUDA_PER_THREAD_DEFAULT_STREAM is set. + + If set, returns a per-thread default stream. Otherwise returns + the legacy stream. + + """ + # TODO: flip the default + cdef const char* use_ptds_raw = getenv("CUDA_PYTHON_CUDA_PER_THREAD_DEFAULT_STREAM") + + cdef int use_ptds = 0 + if use_ptds_raw != NULL: + use_ptds = strtol(use_ptds_raw, NULL, 10) + + # value is non-zero, including for weird stuff like 123foo + if use_ptds: + return PER_THREAD_DEFAULT_STREAM + else: + return LEGACY_DEFAULT_STREAM + + +cdef inline int Stream_ensure_ctx(Stream self) except?-1 nogil: + """Ensure the stream's context handle is populated.""" + cdef cydriver.CUcontext ctx + if not self._h_context: + self._h_context = get_stream_context(self._h_stream) + if self._h_context: + return 0 + HANDLE_RETURN(cydriver.cuStreamGetCtx(as_cu(self._h_stream), &ctx)) + if ctx != NULL: + with gil: + self._h_context = create_context_handle_ref(ctx) + return 0 + + +cdef inline int Stream_ensure_ctx_device(Stream self) except?-1: + """Ensure the stream's context and device_id are populated.""" + cdef cydriver.CUcontext ctx + cdef cydriver.CUdevice target_dev + cdef ContextHandle current_context + cdef bint switch_context + + if self._device_id < 0: + with nogil: + # Get device ID from context, switching context temporarily if needed + Stream_ensure_ctx(self) + current_context = get_current_context() + switch_context = (as_cu(current_context) != as_cu(self._h_context)) + if switch_context: + HANDLE_RETURN(cydriver.cuCtxPushCurrent(as_cu(self._h_context))) + HANDLE_RETURN(cydriver.cuCtxGetDevice(&target_dev)) + if switch_context: + HANDLE_RETURN(cydriver.cuCtxPopCurrent(&ctx)) + self._device_id = target_dev + return 0 + + +cdef cydriver.CUstream _handle_from_stream_protocol(obj) except*: + if isinstance(obj, Stream): + return (obj.handle) + + try: + cuda_stream_attr = obj.__cuda_stream__ + except AttributeError: + raise TypeError(f"{type(obj)} object does not have a '__cuda_stream__' attribute") from None + + if callable(cuda_stream_attr): + info = cuda_stream_attr() + else: + info = cuda_stream_attr + warnings.simplefilter("once", DeprecationWarning) + warnings.warn( + "Implementing __cuda_stream__ as an attribute is deprecated; it must be implemented as a method", + stacklevel=3, + category=DeprecationWarning, + ) + + try: + len_info = len(info) + except TypeError as e: + raise RuntimeError(f"obj.__cuda_stream__ must return a sequence with 2 elements, got {type(info)}") from e + if len_info != 2: + raise RuntimeError(f"obj.__cuda_stream__ must return a sequence with 2 elements, got {len_info} elements") + if info[0] != 0: + raise RuntimeError( + f"The first element of the sequence returned by obj.__cuda_stream__ must be 0, got {repr(info[0])}" + ) + return (info[1]) + +# Helper for API functions that accept either Stream or GraphBuilder. Performs +# needed checks and returns the relevant stream. Rejects None so that callers +# cannot rely on an implicit fallback to the default stream; if the default +# stream is wanted, pass `device.default_stream` explicitly. +cpdef Stream Stream_accept(arg, bint allow_stream_protocol=False): + from cuda.core.graph._graph_builder import GraphBuilder + + if arg is None: + raise TypeError( + "stream is required and must not be None; " + "pass device.default_stream explicitly to use the default stream." + ) + if isinstance(arg, Stream): + return (arg) + elif isinstance(arg, GraphBuilder): + return (arg.stream) + elif allow_stream_protocol and hasattr(arg, "__cuda_stream__"): + stream = Stream._init(arg) + warnings.warn( + "Passing foreign stream objects to this function via the " + "stream protocol is deprecated. Convert the object explicitly " + "using Stream(obj) instead.", + stacklevel=2, + category=DeprecationWarning, + ) + return (stream) + raise TypeError(f"Stream or GraphBuilder expected, got {type(arg).__name__}") diff --git a/cuda_core/cuda/core/_tensor_bridge.pyi b/cuda_core/cuda/core/_tensor_bridge.pyi new file mode 100644 index 00000000000..22948d5b864 --- /dev/null +++ b/cuda_core/cuda/core/_tensor_bridge.pyi @@ -0,0 +1,85 @@ +# This file was generated by stubgen-pyx v0.2.6 from cuda_core/cuda/core/_tensor_bridge.pyx + +"""Tensor bridge: extract PyTorch tensor metadata via the AOTI stable C ABI. + +PyTorch is NOT required at build time. At runtime the AOTI symbols are +resolved from ``torch._C`` (which is loaded with ``RTLD_GLOBAL``). + +The ``pyobj_to_aten_handle`` trick exploits the internal layout of +``THPVariable`` (PyTorch's Python tensor wrapper). + +In PyTorch 2.10+ ``cdata`` is ``at::Tensor`` directly:: + + struct THPVariable { + PyObject_HEAD + at::Tensor cdata; // <-- &cdata is usable as AtenTensorHandle + ... + }; + +In PyTorch 2.3–2.9 ``cdata`` was ``c10::MaybeOwned``, +whose first member is ``bool isBorrowed_`` (padded to 8 bytes), +followed by the ``at::Tensor`` union member:: + + struct THPVariable { + PyObject_HEAD + c10::MaybeOwned cdata; + // MaybeOwned layout: { bool isBorrowed_ (8 bytes); at::Tensor own_; } + ... + }; + +In both cases the address of the ``at::Tensor`` inside ``cdata`` is +accepted by the AOTI stable C ABI functions as an ``AtenTensorHandle``. +The extra 8-byte skip for the ``isBorrowed_`` member is determined +at runtime from the PyTorch version (see ``_get_cdata_extra_offset``). + +Offsetting past ``PyObject_HEAD`` gives us the handle +without any Python attribute access or method calls (~14 ns for all +7 metadata queries). + +Credit: Emilio Castillo (ecastillo@nvidia.com) – original tensor-bridge POC. + +.. note:: + + This module must NOT be imported at ``cuda.core`` load time. It is + loaded lazily (by ``_memoryview.pyx``) only when the user actually + passes a ``torch.Tensor``. The caller must ensure that + ``torch._C`` has been re-opened with ``RTLD_GLOBAL`` *before* + importing this module so that the AOTI symbols are visible. +""" +from __future__ import annotations + +import numpy +from cuda.core._memoryview import StridedMemoryView + +AOTITorchError = int + +def sync_torch_stream(device_index: int, consumer_s: int) -> int: + """Establish stream ordering between PyTorch's current CUDA stream + and the given consumer stream. + + Records an event on PyTorch's current stream (the producer) and makes + the consumer stream wait on it. This is a no-op if both streams are + the same. + """ + +def resolve_aoti_dtype(dtype_code: int) -> numpy.dtype: + """Python-callable wrapper around _get_aoti_dtype (for lazy resolution).""" + +def view_as_torch_tensor(obj: object, stream_ptr: object, view: StridedMemoryView | None=None) -> StridedMemoryView: + """Create/populate a :class:`StridedMemoryView` from a ``torch.Tensor``. + + This is a fast path that avoids DLPack/CAI protocol overhead by + reading tensor metadata directly through the AOTI stable C ABI. + + Parameters + ---------- + obj : torch.Tensor + The source tensor. + stream_ptr : int or None + Consumer stream pointer. When not ``-1``, stream ordering is + established between PyTorch's current CUDA stream (the producer) + and the consumer stream, matching the DLPack contract. + view : StridedMemoryView, optional + If provided, populate this existing view in-place. Otherwise a + new instance is created. + """ \ No newline at end of file diff --git a/cuda_core/cuda/core/_tensor_bridge.pyx b/cuda_core/cuda/core/_tensor_bridge.pyx new file mode 100644 index 00000000000..dd41c77c051 --- /dev/null +++ b/cuda_core/cuda/core/_tensor_bridge.pyx @@ -0,0 +1,449 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +"""Tensor bridge: extract PyTorch tensor metadata via the AOTI stable C ABI. + +PyTorch is NOT required at build time. At runtime the AOTI symbols are +resolved from ``torch._C`` (which is loaded with ``RTLD_GLOBAL``). + +The ``pyobj_to_aten_handle`` trick exploits the internal layout of +``THPVariable`` (PyTorch's Python tensor wrapper). + +In PyTorch 2.10+ ``cdata`` is ``at::Tensor`` directly:: + + struct THPVariable { + PyObject_HEAD + at::Tensor cdata; // <-- &cdata is usable as AtenTensorHandle + ... + }; + +In PyTorch 2.3–2.9 ``cdata`` was ``c10::MaybeOwned``, +whose first member is ``bool isBorrowed_`` (padded to 8 bytes), +followed by the ``at::Tensor`` union member:: + + struct THPVariable { + PyObject_HEAD + c10::MaybeOwned cdata; + // MaybeOwned layout: { bool isBorrowed_ (8 bytes); at::Tensor own_; } + ... + }; + +In both cases the address of the ``at::Tensor`` inside ``cdata`` is +accepted by the AOTI stable C ABI functions as an ``AtenTensorHandle``. +The extra 8-byte skip for the ``isBorrowed_`` member is determined +at runtime from the PyTorch version (see ``_get_cdata_extra_offset``). + +Offsetting past ``PyObject_HEAD`` gives us the handle +without any Python attribute access or method calls (~14 ns for all +7 metadata queries). + +Credit: Emilio Castillo (ecastillo@nvidia.com) – original tensor-bridge POC. + +.. note:: + + This module must NOT be imported at ``cuda.core`` load time. It is + loaded lazily (by ``_memoryview.pyx``) only when the user actually + passes a ``torch.Tensor``. The caller must ensure that + ``torch._C`` has been re-opened with ``RTLD_GLOBAL`` *before* + importing this module so that the AOTI symbols are visible. +""" + +from libc.stdint cimport intptr_t, int8_t, int16_t, int32_t, int64_t, uint8_t + +from cuda.core._memoryview cimport StridedMemoryView +from cuda.core._layout cimport _StridedLayout +from cuda.bindings cimport cydriver +from cuda.core._resource_handles cimport ( + EventHandle, + create_event_handle_noctx, + as_cu, +) +from cuda.core._utils.cuda_utils cimport HANDLE_RETURN + +cdef extern from "Python.h": + ctypedef struct PyObject: + pass + +cdef extern from "_include/aoti_shim.h": + ctypedef int32_t AOTITorchError + + ctypedef struct AtenTensorOpaque: + pass + ctypedef AtenTensorOpaque* AtenTensorHandle + + # tensor metadata + AOTITorchError aoti_torch_get_data_ptr(AtenTensorHandle, void**) + AOTITorchError aoti_torch_get_dim(AtenTensorHandle, int64_t*) + AOTITorchError aoti_torch_get_sizes(AtenTensorHandle, int64_t**) + AOTITorchError aoti_torch_get_strides(AtenTensorHandle, int64_t**) + + # dtype + AOTITorchError aoti_torch_get_dtype(AtenTensorHandle, int32_t*) + int32_t aoti_torch_dtype_float16() + int32_t aoti_torch_dtype_float32() + int32_t aoti_torch_dtype_float64() + int32_t aoti_torch_dtype_bfloat16() + int32_t aoti_torch_dtype_uint8() + int32_t aoti_torch_dtype_uint16() + int32_t aoti_torch_dtype_uint32() + int32_t aoti_torch_dtype_uint64() + int32_t aoti_torch_dtype_int8() + int32_t aoti_torch_dtype_int16() + int32_t aoti_torch_dtype_int32() + int32_t aoti_torch_dtype_int64() + int32_t aoti_torch_dtype_bool() + int32_t aoti_torch_dtype_complex32() + int32_t aoti_torch_dtype_complex64() + int32_t aoti_torch_dtype_complex128() + + # device + AOTITorchError aoti_torch_get_device_type(AtenTensorHandle, int32_t*) + AOTITorchError aoti_torch_get_device_index(AtenTensorHandle, int32_t*) + int32_t aoti_torch_device_type_cpu() + int32_t aoti_torch_device_type_cuda() + + # Note: aoti_torch_get_current_cuda_stream is NOT declared here because + # it lives in torch_cuda.dll (not torch_cpu.dll). It is resolved lazily + # at runtime via dlsym / GetProcAddress — see _resolve_cuda_stream_fn(). + +# Runtime resolution for aoti_torch_get_current_cuda_stream. +# This symbol lives in torch_cuda.dll (Windows) / libtorch_cuda.so (Linux), +# NOT in torch_cpu. We resolve it lazily on first use so that the module +# can be imported even with CPU-only PyTorch. +ctypedef AOTITorchError (*_get_cuda_stream_fn_t)(int32_t, void**) nogil + +cdef extern from *: + """ + #ifdef _WIN32 + #include + static void* _resolve_cuda_stream_fn(void) { + HMODULE h = LoadLibraryA("torch_cuda.dll"); + if (!h) return NULL; + return (void*)GetProcAddress(h, "aoti_torch_get_current_cuda_stream"); + } + #else + #include + #ifndef RTLD_DEFAULT + #define RTLD_DEFAULT ((void*)0) + #endif + static void* _resolve_cuda_stream_fn(void) { + return dlsym(RTLD_DEFAULT, "aoti_torch_get_current_cuda_stream"); + } + #endif + """ + void* _resolve_cuda_stream_fn() nogil + +cdef _get_cuda_stream_fn_t _cached_get_cuda_stream = NULL + +import numpy +import sys + + +# --------------------------------------------------------------------------- +# Module-level state (initialised at import time — AOTI symbols are +# guaranteed visible because _memoryview bootstraps RTLD_GLOBAL before +# importing us) +# --------------------------------------------------------------------------- + +cdef int32_t _DEVICE_TYPE_CPU = aoti_torch_device_type_cpu() +cdef int32_t _DEVICE_TYPE_CUDA = aoti_torch_device_type_cuda() +cdef dict _aoti_dtype_map = None +cdef dict _aoti_itemsize_map = None + +# Extra byte offset to skip before reaching the at::Tensor inside +# THPVariable::cdata. See _get_cdata_extra_offset() for details. +# Tri-state: -1 = not yet probed, 0 or 8 = cached result. +cdef Py_ssize_t _cdata_extra_offset = -1 + + +cdef Py_ssize_t _get_cdata_extra_offset(): + """Return the extra byte offset caused by ``MaybeOwned``'s bool member. + + In PyTorch 2.3–2.9 ``THPVariable::cdata`` is + ``c10::MaybeOwned``, whose first member is + ``bool isBorrowed_`` (padded to pointer alignment = 8 bytes). + The actual ``at::Tensor`` sits *after* that bool, so we must + skip 8 extra bytes. + + From PyTorch 2.10 onward ``cdata`` is ``at::Tensor`` directly, + so no extra offset is needed. + """ + global _cdata_extra_offset + if _cdata_extra_offset >= 0: + return _cdata_extra_offset + torch = sys.modules.get("torch") + if torch is None: + raise RuntimeError("torch must be imported before _tensor_bridge") + try: + major = int(torch.__version__.split(".")[0]) + minor = int(torch.__version__.split(".")[1]) + except (ValueError, IndexError): + raise RuntimeError( + f"Cannot parse torch version: {torch.__version__!r}") + if (major, minor) < (2, 10): + _cdata_extra_offset = 8 # skip MaybeOwned::isBorrowed_ padding + else: + _cdata_extra_offset = 0 # at::Tensor directly at base + return _cdata_extra_offset + + +# --------------------------------------------------------------------------- +# pointer extraction +# --------------------------------------------------------------------------- + +cdef inline AtenTensorHandle pyobj_to_aten_handle(object obj): + """Extract AtenTensorHandle by offsetting past PyObject_HEAD. + + In PyTorch 2.3–2.9 the first field after PyObject_HEAD is + ``c10::MaybeOwned cdata``, whose ``isBorrowed_`` + bool member (padded to 8 bytes) precedes the actual + ``at::Tensor``. From 2.10 onward ``cdata`` is ``at::Tensor`` + directly. The extra offset is determined once by + :func:`_get_cdata_extra_offset` and cached. + """ + return ( + obj + sizeof(PyObject) + _get_cdata_extra_offset()) + + +cdef inline int check_aoti(AOTITorchError err, const char* name) except? -1: + """Raise RuntimeError if an AOTI call returned a non-zero error code.""" + if err != 0: + raise RuntimeError(f"{name.decode()} failed") + return 0 + + +# --------------------------------------------------------------------------- +# dtype mapping (AOTI int32 -> numpy dtype) +# --------------------------------------------------------------------------- + +cdef dict _build_dtype_map(): + try: + from ml_dtypes import bfloat16 as _bf16 # noqa: F811 + has_bfloat16 = True + except ImportError: + has_bfloat16 = False + + cdef dict m = { + aoti_torch_dtype_float16(): numpy.dtype(numpy.float16), + aoti_torch_dtype_float32(): numpy.dtype(numpy.float32), + aoti_torch_dtype_float64(): numpy.dtype(numpy.float64), + aoti_torch_dtype_uint8(): numpy.dtype(numpy.uint8), + aoti_torch_dtype_uint16(): numpy.dtype(numpy.uint16), + aoti_torch_dtype_uint32(): numpy.dtype(numpy.uint32), + aoti_torch_dtype_uint64(): numpy.dtype(numpy.uint64), + aoti_torch_dtype_int8(): numpy.dtype(numpy.int8), + aoti_torch_dtype_int16(): numpy.dtype(numpy.int16), + aoti_torch_dtype_int32(): numpy.dtype(numpy.int32), + aoti_torch_dtype_int64(): numpy.dtype(numpy.int64), + aoti_torch_dtype_bool(): numpy.dtype(numpy.bool_), + aoti_torch_dtype_complex64(): numpy.dtype(numpy.complex64), + aoti_torch_dtype_complex128(): numpy.dtype(numpy.complex128), + } + if has_bfloat16: + m[aoti_torch_dtype_bfloat16()] = numpy.dtype(_bf16) + return m + + +cdef object _get_aoti_dtype(int32_t dtype_code): + global _aoti_dtype_map + if _aoti_dtype_map is None: + _aoti_dtype_map = _build_dtype_map() + result = _aoti_dtype_map.get(dtype_code) + if result is None: + raise TypeError(f"Unsupported AOTI dtype code: {dtype_code}") + return result + + +def resolve_aoti_dtype(int32_t dtype_code) -> numpy.dtype: + """Python-callable wrapper around _get_aoti_dtype (for lazy resolution).""" + return _get_aoti_dtype(dtype_code) + + +cdef dict _build_itemsize_map(): + return { + aoti_torch_dtype_bool(): sizeof(uint8_t), + aoti_torch_dtype_uint8(): sizeof(uint8_t), + aoti_torch_dtype_uint16(): sizeof(int16_t), + aoti_torch_dtype_uint32(): sizeof(int32_t), + aoti_torch_dtype_uint64(): sizeof(int64_t), + aoti_torch_dtype_int8(): sizeof(int8_t), + aoti_torch_dtype_float16(): sizeof(int16_t), # no C float16 + aoti_torch_dtype_bfloat16(): sizeof(int16_t), # no C bfloat16 + aoti_torch_dtype_int16(): sizeof(int16_t), + aoti_torch_dtype_complex32(): 2 * sizeof(int16_t), # no C complex32 + aoti_torch_dtype_float32(): sizeof(float), + aoti_torch_dtype_int32(): sizeof(int32_t), + aoti_torch_dtype_complex64(): 2 * sizeof(float), + aoti_torch_dtype_float64(): sizeof(double), + aoti_torch_dtype_int64(): sizeof(int64_t), + aoti_torch_dtype_complex128(): 2 * sizeof(double), + } + + +cdef int _get_aoti_itemsize(int32_t dtype_code) except -1: + global _aoti_itemsize_map + if _aoti_itemsize_map is None: + _aoti_itemsize_map = _build_itemsize_map() + result = _aoti_itemsize_map.get(dtype_code) + if result is None: + raise TypeError(f"Unsupported AOTI dtype code: {dtype_code}") + return result + + +# --------------------------------------------------------------------------- +# Stream ordering helper +# --------------------------------------------------------------------------- + +cpdef int sync_torch_stream(int32_t device_index, + intptr_t consumer_s) except? -1: + """Establish stream ordering between PyTorch's current CUDA stream + and the given consumer stream. + + Records an event on PyTorch's current stream (the producer) and makes + the consumer stream wait on it. This is a no-op if both streams are + the same. + """ + global _cached_get_cuda_stream + cdef void* producer_s + cdef EventHandle h_event + + if _cached_get_cuda_stream == NULL: + _cached_get_cuda_stream = <_get_cuda_stream_fn_t>_resolve_cuda_stream_fn() + if _cached_get_cuda_stream == NULL: + raise RuntimeError( + "Cannot resolve aoti_torch_get_current_cuda_stream from " + "torch_cuda — is CUDA-enabled PyTorch installed?") + check_aoti(_cached_get_cuda_stream(device_index, &producer_s), + b"aoti_torch_get_current_cuda_stream") + if producer_s != consumer_s: + with nogil: + h_event = create_event_handle_noctx( + cydriver.CUevent_flags.CU_EVENT_DISABLE_TIMING) + HANDLE_RETURN(cydriver.cuEventRecord( + as_cu(h_event), producer_s)) + HANDLE_RETURN(cydriver.cuStreamWaitEvent( + consumer_s, as_cu(h_event), 0)) + return 0 + + +# --------------------------------------------------------------------------- +# Public API: construct StridedMemoryView from a torch.Tensor +# --------------------------------------------------------------------------- + +def view_as_torch_tensor( + object obj, + object stream_ptr, + view: StridedMemoryView | None = None +) -> StridedMemoryView: + """Create/populate a :class:`StridedMemoryView` from a ``torch.Tensor``. + + This is a fast path that avoids DLPack/CAI protocol overhead by + reading tensor metadata directly through the AOTI stable C ABI. + + Parameters + ---------- + obj : torch.Tensor + The source tensor. + stream_ptr : int or None + Consumer stream pointer. When not ``-1``, stream ordering is + established between PyTorch's current CUDA stream (the producer) + and the consumer stream, matching the DLPack contract. + view : StridedMemoryView, optional + If provided, populate this existing view in-place. Otherwise a + new instance is created. + """ + cdef AtenTensorHandle handle = pyobj_to_aten_handle(obj) + cdef void* data_ptr + cdef int64_t ndim + cdef int64_t* sizes_ptr + cdef int64_t* strides_ptr + cdef int32_t dtype_code + cdef int32_t device_type, device_index + cdef StridedMemoryView buf + cdef int itemsize + cdef intptr_t _stream_ptr_int + cdef _StridedLayout layout + + # Note: we intentionally skip PyTorch's Python-level __dlpack__ guards + # (requires_grad, is_conj, is_neg, non-strided layout, wrong-device) + # for the same reason PyTorch's own __dlpack_c_exchange_api__ C path + # skips them — the C-level exchange path is designed for performance- + # critical consumers. See DLTensorFromPyObjectNoSync in + # torch/csrc/Module.cpp which calls toDLPackNonOwning with zero checks. + + check_aoti(aoti_torch_get_data_ptr(handle, &data_ptr), + b"aoti_torch_get_data_ptr") + check_aoti(aoti_torch_get_dim(handle, &ndim), + b"aoti_torch_get_dim") + check_aoti(aoti_torch_get_sizes(handle, &sizes_ptr), + b"aoti_torch_get_sizes") + check_aoti(aoti_torch_get_strides(handle, &strides_ptr), + b"aoti_torch_get_strides") + check_aoti(aoti_torch_get_dtype(handle, &dtype_code), + b"aoti_torch_get_dtype") + check_aoti(aoti_torch_get_device_type(handle, &device_type), + b"aoti_torch_get_device_type") + check_aoti(aoti_torch_get_device_index(handle, &device_index), + b"aoti_torch_get_device_index") + + # -- populate StridedMemoryView -- + if view is not None: + buf = view + else: + buf = StridedMemoryView.__new__(StridedMemoryView) + + buf.ptr = data_ptr + buf._dtype = None # clear cached dtype (view may be reused) + # PyTorch always reports tensors as writable via both DLPack + # (flags=0, no DLPACK_FLAG_BITMASK_READ_ONLY) and CAI + # (__cuda_array_interface__["data"] = (ptr, False)). Tensors that + # cannot be safely exported (requires_grad, conjugate, non-strided) + # are rejected with BufferError rather than marked read-only. + # The AOTI C ABI has no readonly query either, so False is correct. + buf.readonly = False + buf.exporting_obj = obj + buf.dl_tensor = NULL + buf.metadata = None + buf._buffer = None + + if device_type == _DEVICE_TYPE_CPU: + buf.device_id = -1 + buf.is_device_accessible = False + elif device_type == _DEVICE_TYPE_CUDA: + buf.device_id = device_index + buf.is_device_accessible = True + + # -- stream ordering (matches the DLPack contract) -- + # stream_ptr=None is ambiguous for CUDA tensors — the caller must + # explicitly choose -1 (no sync) or a valid stream pointer. + if stream_ptr is None: + raise BufferError( + "stream_ptr=None is ambiguous for CUDA tensors; " + "pass stream_ptr=-1 to opt out of synchronization, " + "or pass a valid stream pointer") + _stream_ptr_int = int(stream_ptr) + if _stream_ptr_int != -1: + sync_torch_stream(device_index, _stream_ptr_int) + else: + raise BufferError( + f"Unsupported device type from torch tensor " + f"(AOTI device type id: {device_type})") + + # Defer full numpy dtype resolution until first .dtype access. + # Store the raw AOTI dtype code in metadata for lazy lookup. + buf.metadata = dtype_code + + # Build _StridedLayout. init_from_ptr copies shape/strides so we are + # safe even though they are borrowed pointers. + itemsize = _get_aoti_itemsize(dtype_code) + layout = _StridedLayout.__new__(_StridedLayout) + layout.init_from_ptr( + ndim, + sizes_ptr, + strides_ptr, + itemsize, + ) + buf._layout = layout + + return buf diff --git a/cuda_core/cuda/core/_tensor_map.pxd b/cuda_core/cuda/core/_tensor_map.pxd new file mode 100644 index 00000000000..25aef566261 --- /dev/null +++ b/cuda_core/cuda/core/_tensor_map.pxd @@ -0,0 +1,19 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from cuda.bindings cimport cydriver +from libc.stdint cimport intptr_t +from cuda.core._memoryview cimport StridedMemoryView + + +cdef class TensorMapDescriptor: + cdef cydriver.CUtensorMap _tensor_map + cdef int _device_id + cdef intptr_t _context + cdef object _source_ref + cdef StridedMemoryView _view_ref + cdef object _repr_info + + cdef int _check_context_compat(self) except -1 + cdef void* _get_data_ptr(self) diff --git a/cuda_core/cuda/core/_tensor_map.pyi b/cuda_core/cuda/core/_tensor_map.pyi new file mode 100644 index 00000000000..986ab41549f --- /dev/null +++ b/cuda_core/cuda/core/_tensor_map.pyi @@ -0,0 +1,336 @@ +# This file was generated by stubgen-pyx v0.2.6 from cuda_core/cuda/core/_tensor_map.pyx + +from __future__ import annotations + +from dataclasses import dataclass + +import numpy +from cuda.bindings import cydriver +from cuda.core._device import Device + + +class TensorMapDataType: + """Data types for tensor map descriptors. + + These correspond to the ``CUtensorMapDataType`` driver enum values. + """ + UINT8 = cydriver.CU_TENSOR_MAP_DATA_TYPE_UINT8 + UINT16 = cydriver.CU_TENSOR_MAP_DATA_TYPE_UINT16 + UINT32 = cydriver.CU_TENSOR_MAP_DATA_TYPE_UINT32 + INT32 = cydriver.CU_TENSOR_MAP_DATA_TYPE_INT32 + UINT64 = cydriver.CU_TENSOR_MAP_DATA_TYPE_UINT64 + INT64 = cydriver.CU_TENSOR_MAP_DATA_TYPE_INT64 + FLOAT16 = cydriver.CU_TENSOR_MAP_DATA_TYPE_FLOAT16 + FLOAT32 = cydriver.CU_TENSOR_MAP_DATA_TYPE_FLOAT32 + FLOAT64 = cydriver.CU_TENSOR_MAP_DATA_TYPE_FLOAT64 + BFLOAT16 = cydriver.CU_TENSOR_MAP_DATA_TYPE_BFLOAT16 + FLOAT32_FTZ = cydriver.CU_TENSOR_MAP_DATA_TYPE_FLOAT32_FTZ + TFLOAT32 = cydriver.CU_TENSOR_MAP_DATA_TYPE_TFLOAT32 + TFLOAT32_FTZ = cydriver.CU_TENSOR_MAP_DATA_TYPE_TFLOAT32_FTZ + +class TensorMapInterleave: + """Interleave layout for tensor map descriptors. + + These correspond to the ``CUtensorMapInterleave`` driver enum values. + """ + NONE = cydriver.CU_TENSOR_MAP_INTERLEAVE_NONE + INTERLEAVE_16B = cydriver.CU_TENSOR_MAP_INTERLEAVE_16B + INTERLEAVE_32B = cydriver.CU_TENSOR_MAP_INTERLEAVE_32B + +class TensorMapSwizzle: + """Swizzle mode for tensor map descriptors. + + These correspond to the ``CUtensorMapSwizzle`` driver enum values. + """ + NONE = cydriver.CU_TENSOR_MAP_SWIZZLE_NONE + SWIZZLE_32B = cydriver.CU_TENSOR_MAP_SWIZZLE_32B + SWIZZLE_64B = cydriver.CU_TENSOR_MAP_SWIZZLE_64B + SWIZZLE_128B = cydriver.CU_TENSOR_MAP_SWIZZLE_128B + +class TensorMapL2Promotion: + """L2 promotion mode for tensor map descriptors. + + These correspond to the ``CUtensorMapL2promotion`` driver enum values. + """ + NONE = cydriver.CU_TENSOR_MAP_L2_PROMOTION_NONE + L2_64B = cydriver.CU_TENSOR_MAP_L2_PROMOTION_L2_64B + L2_128B = cydriver.CU_TENSOR_MAP_L2_PROMOTION_L2_128B + L2_256B = cydriver.CU_TENSOR_MAP_L2_PROMOTION_L2_256B + +class TensorMapOOBFill: + """Out-of-bounds fill mode for tensor map descriptors. + + These correspond to the ``CUtensorMapFloatOOBfill`` driver enum values. + """ + NONE = cydriver.CU_TENSOR_MAP_FLOAT_OOB_FILL_NONE + NAN_REQUEST_ZERO_FMA = cydriver.CU_TENSOR_MAP_FLOAT_OOB_FILL_NAN_REQUEST_ZERO_FMA + +class TensorMapIm2ColWideMode: + """Im2col wide mode for tensor map descriptors. + + This enum is always defined for API stability, but the + :meth:`TensorMapDescriptor._from_im2col_wide` factory requires a CUDA 13+ + build and will raise otherwise. + """ + W = 0 + W128 = 1 + +@dataclass +class TensorMapDescriptorOptions: + """Options for :meth:`cuda.core.StridedMemoryView.as_tensor_map`. + + Attributes + ---------- + box_dim : tuple[int, ...] + Tile size for each tensor dimension, expressed in elements. + element_strides : tuple[int, ...], optional + Per-dimension element traversal strides. + data_type : object, optional + Explicit dtype override. Prefer NumPy or ``ml_dtypes`` dtype objects; + :class:`TensorMapDataType` remains accepted for compatibility. + interleave : TensorMapInterleave, optional + Interleave layout. Default ``NONE``. + swizzle : TensorMapSwizzle, optional + Swizzle mode. Default ``NONE``. + l2_promotion : TensorMapL2Promotion, optional + L2 promotion mode. Default ``NONE``. + oob_fill : TensorMapOOBFill, optional + Out-of-bounds fill mode. Default ``NONE``. + """ + box_dim: tuple[int, ...] + element_strides: tuple[int, ...] | None = None + data_type: object = None + interleave: TensorMapInterleave = TensorMapInterleave.NONE + swizzle: TensorMapSwizzle = TensorMapSwizzle.NONE + l2_promotion: TensorMapL2Promotion = TensorMapL2Promotion.NONE + oob_fill: TensorMapOOBFill = TensorMapOOBFill.NONE + + def __post_init__(self) -> None: + ... + +class TensorMapDescriptor: + """Describes a TMA (Tensor Memory Accelerator) tensor map for Hopper+ GPUs. + + A ``TensorMapDescriptor`` wraps the opaque 128-byte ``CUtensorMap`` struct + used by the hardware TMA unit for efficient bulk data movement between + global and shared memory. + + Public tiled descriptors are created via + :meth:`cuda.core.StridedMemoryView.as_tensor_map`. Specialized + ``_from_*`` helpers remain private while this API surface settles, and + descriptors can be passed directly to :func:`~cuda.core.launch` as a + kernel argument. + """ + + def __init__(self): + ... + + @property + def device(self) -> Device | None: + """Return the :obj:`~cuda.core.Device` associated with this descriptor.""" + + @classmethod + def _from_tiled(cls, view, box_dim=None, *, options=None, element_strides=None, data_type=None, interleave=..., swizzle=..., l2_promotion=..., oob_fill=...): + """Create a tiled TMA descriptor from a validated view. + + Parameters + ---------- + view : StridedMemoryView + A device-accessible view with a 16-byte-aligned pointer. + box_dim : tuple of int, optional + The size of each tile dimension (in elements). Must have the + same rank as the tensor and each value must be in [1, 256]. + Specified in the same (row-major) order as the tensor shape. + Required unless ``options`` is provided. + options : TensorMapDescriptorOptions or mapping, optional + Bundled tiled-descriptor options. When provided, do not also pass + ``box_dim`` or the individual option kwargs. + element_strides : tuple of int, optional + Per-dimension element traversal strides. Default is all 1s. + Specified in the same (row-major) order as the tensor shape. + data_type : dtype-like or TensorMapDataType, optional + Explicit dtype override. If ``None``, inferred from the tensor's + dtype. Prefer NumPy or ``ml_dtypes`` dtype objects; the enum is + accepted for compatibility. + interleave : TensorMapInterleave + Interleave layout. Default ``NONE``. + swizzle : TensorMapSwizzle + Swizzle mode. Default ``NONE``. + l2_promotion : TensorMapL2Promotion + L2 promotion mode. Default ``NONE``. + oob_fill : TensorMapOOBFill + Out-of-bounds fill mode. Default ``NONE``. + + Returns + ------- + TensorMapDescriptor + + Raises + ------ + ValueError + If the tensor rank is outside [1, 5], the pointer is not + 16-byte aligned, or dimension/stride constraints are violated. + """ + + @classmethod + def _from_im2col(cls, view, pixel_box_lower_corner, pixel_box_upper_corner, channels_per_pixel, pixels_per_column, *, element_strides=None, data_type=None, interleave=..., swizzle=..., l2_promotion=..., oob_fill=...): + """Create an im2col TMA descriptor from a validated view. + + Im2col layout is used for convolution-style data access patterns. + + Parameters + ---------- + view : StridedMemoryView + A device-accessible view with a 16-byte-aligned pointer. + pixel_box_lower_corner : tuple of int + Lower corner of the pixel bounding box for each spatial + dimension (rank - 2 elements). Specified in row-major order + matching the tensor's spatial dimensions. + pixel_box_upper_corner : tuple of int + Upper corner of the pixel bounding box for each spatial + dimension (rank - 2 elements). Specified in row-major order + matching the tensor's spatial dimensions. + channels_per_pixel : int + Number of channels per pixel. + pixels_per_column : int + Number of pixels per column. + element_strides : tuple of int, optional + Per-dimension element traversal strides. Default is all 1s. + data_type : dtype-like or TensorMapDataType, optional + Explicit dtype override. If ``None``, inferred from the tensor's + dtype. Prefer NumPy or ``ml_dtypes`` dtype objects; the enum is + accepted for compatibility. + interleave : TensorMapInterleave + Interleave layout. Default ``NONE``. + swizzle : TensorMapSwizzle + Swizzle mode. Default ``NONE``. + l2_promotion : TensorMapL2Promotion + L2 promotion mode. Default ``NONE``. + oob_fill : TensorMapOOBFill + Out-of-bounds fill mode. Default ``NONE``. + + Returns + ------- + TensorMapDescriptor + + Raises + ------ + ValueError + If the tensor rank is outside [3, 5], the pointer is not + 16-byte aligned, or other constraints are violated. + """ + + @classmethod + def _from_im2col_wide(cls, view, pixel_box_lower_corner_width, pixel_box_upper_corner_width, channels_per_pixel, pixels_per_column, *, element_strides=None, data_type=None, interleave=..., mode=..., swizzle=..., l2_promotion=..., oob_fill=...): + """Create an im2col-wide TMA descriptor from a validated view. + + Im2col-wide layout loads elements exclusively along the W (width) + dimension. This variant is supported on compute capability 10.0+ + (Blackwell and later). + + Parameters + ---------- + view : StridedMemoryView + A device-accessible view with a 16-byte-aligned pointer. + pixel_box_lower_corner_width : int + Lower corner of the pixel bounding box along the W dimension. + pixel_box_upper_corner_width : int + Upper corner of the pixel bounding box along the W dimension. + channels_per_pixel : int + Number of channels per pixel. + pixels_per_column : int + Number of pixels per column. + element_strides : tuple of int, optional + Per-dimension element traversal strides. Default is all 1s. + data_type : dtype-like or TensorMapDataType, optional + Explicit dtype override. If ``None``, inferred from the tensor's + dtype. Prefer NumPy or ``ml_dtypes`` dtype objects; the enum is + accepted for compatibility. + interleave : TensorMapInterleave + Interleave layout. Default ``NONE``. + mode : TensorMapIm2ColWideMode + Im2col wide mode. Default ``W``. + swizzle : TensorMapSwizzle + Swizzle mode. Default ``SWIZZLE_128B``. + l2_promotion : TensorMapL2Promotion + L2 promotion mode. Default ``NONE``. + oob_fill : TensorMapOOBFill + Out-of-bounds fill mode. Default ``NONE``. + + Returns + ------- + TensorMapDescriptor + + Raises + ------ + ValueError + If the tensor rank is outside [3, 5], the pointer is not + 16-byte aligned, or other constraints are violated. + """ + + def replace_address(self, tensor: object) -> None: + """Replace the global memory address in this tensor map descriptor. + + This is useful when the tensor data has been reallocated but the + shape, strides, and other parameters remain the same. + + Parameters + ---------- + tensor : object + Any object supporting DLPack or ``__cuda_array_interface__``, + or a :obj:`~cuda.core.StridedMemoryView`. Must refer to + device-accessible memory with a 16-byte-aligned pointer. + """ + + def __repr__(self) -> str: + ... +_TMA_DT_UINT8 = int(cydriver.CU_TENSOR_MAP_DATA_TYPE_UINT8) +_TMA_DT_UINT16 = int(cydriver.CU_TENSOR_MAP_DATA_TYPE_UINT16) +_TMA_DT_UINT32 = int(cydriver.CU_TENSOR_MAP_DATA_TYPE_UINT32) +_TMA_DT_INT32 = int(cydriver.CU_TENSOR_MAP_DATA_TYPE_INT32) +_TMA_DT_UINT64 = int(cydriver.CU_TENSOR_MAP_DATA_TYPE_UINT64) +_TMA_DT_INT64 = int(cydriver.CU_TENSOR_MAP_DATA_TYPE_INT64) +_TMA_DT_FLOAT16 = int(cydriver.CU_TENSOR_MAP_DATA_TYPE_FLOAT16) +_TMA_DT_FLOAT32 = int(cydriver.CU_TENSOR_MAP_DATA_TYPE_FLOAT32) +_TMA_DT_FLOAT64 = int(cydriver.CU_TENSOR_MAP_DATA_TYPE_FLOAT64) +_TMA_DT_BFLOAT16 = int(cydriver.CU_TENSOR_MAP_DATA_TYPE_BFLOAT16) +_TMA_DT_FLOAT32_FTZ = int(cydriver.CU_TENSOR_MAP_DATA_TYPE_FLOAT32_FTZ) +_TMA_DT_TFLOAT32 = int(cydriver.CU_TENSOR_MAP_DATA_TYPE_TFLOAT32) +_TMA_DT_TFLOAT32_FTZ = int(cydriver.CU_TENSOR_MAP_DATA_TYPE_TFLOAT32_FTZ) +_NUMPY_DTYPE_TO_TMA = {numpy.dtype(numpy.uint8): _TMA_DT_UINT8, numpy.dtype(numpy.uint16): _TMA_DT_UINT16, numpy.dtype(numpy.uint32): _TMA_DT_UINT32, numpy.dtype(numpy.int32): _TMA_DT_INT32, numpy.dtype(numpy.uint64): _TMA_DT_UINT64, numpy.dtype(numpy.int64): _TMA_DT_INT64, numpy.dtype(numpy.float16): _TMA_DT_FLOAT16, numpy.dtype(numpy.float32): _TMA_DT_FLOAT32, numpy.dtype(numpy.float64): _TMA_DT_FLOAT64} +_TMA_DATA_TYPE_SIZE = {_TMA_DT_UINT8: 1, _TMA_DT_UINT16: 2, _TMA_DT_UINT32: 4, _TMA_DT_INT32: 4, _TMA_DT_UINT64: 8, _TMA_DT_INT64: 8, _TMA_DT_FLOAT16: 2, _TMA_DT_FLOAT32: 4, _TMA_DT_FLOAT64: 8, _TMA_DT_BFLOAT16: 2, _TMA_DT_FLOAT32_FTZ: 4, _TMA_DT_TFLOAT32: 4, _TMA_DT_TFLOAT32_FTZ: 4} + +def _normalize_tensor_map_data_type(data_type): + ... + +def _normalize_tensor_map_sequence(name, values): + ... + +def _require_tensor_map_enum(name, value, enum_type): + ... + +def _coerce_tensor_map_descriptor_options(box_dim, options, *, element_strides, data_type, interleave, swizzle, l2_promotion, oob_fill): + ... + +def _resolve_data_type(view, data_type): + """Resolve the TMA data type from an explicit value or the view's dtype.""" + +def _get_validated_view(tensor): + """Obtain a device-accessible StridedMemoryView with a 16-byte-aligned pointer.""" + +def _require_view_device(view, expected_device_id, operation): + """Ensure device-local tensors match the current CUDA device. + + DLPack reports host/managed CUDA memory as ``kDLCUDAHost`` / + ``kDLCUDAManaged`` with ``device_id=0`` regardless of the current device, + so only true ``kDLCUDA`` tensors are rejected by device-id mismatch. + """ + +def _compute_byte_strides(shape, strides, elem_size): + """Compute byte strides from element strides or C-contiguous fallback. + + Returns a tuple of byte strides in row-major order. + """ + +def _validate_element_strides(element_strides, rank): + """Validate or default element_strides to all-ones.""" \ No newline at end of file diff --git a/cuda_core/cuda/core/_tensor_map.pyx b/cuda_core/cuda/core/_tensor_map.pyx new file mode 100644 index 00000000000..7e059fe7b98 --- /dev/null +++ b/cuda_core/cuda/core/_tensor_map.pyx @@ -0,0 +1,1104 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from libc.stdint cimport intptr_t, int64_t, uint8_t, uint16_t, uint32_t, uint64_t +from libc.stddef cimport size_t +from cuda.bindings cimport cydriver +from cuda.core._utils.cuda_utils cimport HANDLE_RETURN +from cuda.core._dlpack cimport kDLInt, kDLUInt, kDLFloat, kDLBfloat, _kDLCUDA + +import enum +from dataclasses import dataclass +from typing import TYPE_CHECKING + +import numpy + +from cuda.core._memoryview import StridedMemoryView +from cuda.core._utils.cuda_utils import check_or_create_options + +if TYPE_CHECKING: + from cuda.core._device import Device + +cdef extern from "_cpp/tensor_map_cccl.h": + int cuda_core_cccl_make_tma_descriptor_tiled( + void* out_tensor_map, + void* data, + int device_type, + int device_id, + int ndim, + const int64_t* shape, + const int64_t* strides, + uint8_t dtype_code, + uint8_t dtype_bits, + uint16_t dtype_lanes, + const int* box_sizes, + const int* elem_strides, + int interleave_layout, + int swizzle, + int l2_fetch_size, + int oob_fill, + char* err, + size_t err_cap) nogil + + +try: + from ml_dtypes import bfloat16 as ml_bfloat16 +except ImportError: + ml_bfloat16 = None + + +class TensorMapDataType(enum.IntEnum): + """Data types for tensor map descriptors. + + These correspond to the ``CUtensorMapDataType`` driver enum values. + """ + UINT8 = cydriver.CU_TENSOR_MAP_DATA_TYPE_UINT8 + UINT16 = cydriver.CU_TENSOR_MAP_DATA_TYPE_UINT16 + UINT32 = cydriver.CU_TENSOR_MAP_DATA_TYPE_UINT32 + INT32 = cydriver.CU_TENSOR_MAP_DATA_TYPE_INT32 + UINT64 = cydriver.CU_TENSOR_MAP_DATA_TYPE_UINT64 + INT64 = cydriver.CU_TENSOR_MAP_DATA_TYPE_INT64 + FLOAT16 = cydriver.CU_TENSOR_MAP_DATA_TYPE_FLOAT16 + FLOAT32 = cydriver.CU_TENSOR_MAP_DATA_TYPE_FLOAT32 + FLOAT64 = cydriver.CU_TENSOR_MAP_DATA_TYPE_FLOAT64 + BFLOAT16 = cydriver.CU_TENSOR_MAP_DATA_TYPE_BFLOAT16 + FLOAT32_FTZ = cydriver.CU_TENSOR_MAP_DATA_TYPE_FLOAT32_FTZ + TFLOAT32 = cydriver.CU_TENSOR_MAP_DATA_TYPE_TFLOAT32 + TFLOAT32_FTZ = cydriver.CU_TENSOR_MAP_DATA_TYPE_TFLOAT32_FTZ + + +class TensorMapInterleave(enum.IntEnum): + """Interleave layout for tensor map descriptors. + + These correspond to the ``CUtensorMapInterleave`` driver enum values. + """ + NONE = cydriver.CU_TENSOR_MAP_INTERLEAVE_NONE + INTERLEAVE_16B = cydriver.CU_TENSOR_MAP_INTERLEAVE_16B + INTERLEAVE_32B = cydriver.CU_TENSOR_MAP_INTERLEAVE_32B + + +class TensorMapSwizzle(enum.IntEnum): + """Swizzle mode for tensor map descriptors. + + These correspond to the ``CUtensorMapSwizzle`` driver enum values. + """ + NONE = cydriver.CU_TENSOR_MAP_SWIZZLE_NONE + SWIZZLE_32B = cydriver.CU_TENSOR_MAP_SWIZZLE_32B + SWIZZLE_64B = cydriver.CU_TENSOR_MAP_SWIZZLE_64B + SWIZZLE_128B = cydriver.CU_TENSOR_MAP_SWIZZLE_128B + + +class TensorMapL2Promotion(enum.IntEnum): + """L2 promotion mode for tensor map descriptors. + + These correspond to the ``CUtensorMapL2promotion`` driver enum values. + """ + NONE = cydriver.CU_TENSOR_MAP_L2_PROMOTION_NONE + L2_64B = cydriver.CU_TENSOR_MAP_L2_PROMOTION_L2_64B + L2_128B = cydriver.CU_TENSOR_MAP_L2_PROMOTION_L2_128B + L2_256B = cydriver.CU_TENSOR_MAP_L2_PROMOTION_L2_256B + + +class TensorMapOOBFill(enum.IntEnum): + """Out-of-bounds fill mode for tensor map descriptors. + + These correspond to the ``CUtensorMapFloatOOBfill`` driver enum values. + """ + NONE = cydriver.CU_TENSOR_MAP_FLOAT_OOB_FILL_NONE + NAN_REQUEST_ZERO_FMA = cydriver.CU_TENSOR_MAP_FLOAT_OOB_FILL_NAN_REQUEST_ZERO_FMA + + +IF CUDA_CORE_BUILD_MAJOR >= 13: + class TensorMapIm2ColWideMode(enum.IntEnum): + """Im2col wide mode for tensor map descriptors. + + These correspond to the ``CUtensorMapIm2ColWideMode`` driver enum values. + Supported on compute capability 10.0+. + """ + W = cydriver.CU_TENSOR_MAP_IM2COL_WIDE_MODE_W + W128 = cydriver.CU_TENSOR_MAP_IM2COL_WIDE_MODE_W128 +ELSE: + class TensorMapIm2ColWideMode(enum.IntEnum): + """Im2col wide mode for tensor map descriptors. + + This enum is always defined for API stability, but the + :meth:`TensorMapDescriptor._from_im2col_wide` factory requires a CUDA 13+ + build and will raise otherwise. + """ + W = 0 + W128 = 1 + + +_TMA_DT_UINT8 = int(cydriver.CU_TENSOR_MAP_DATA_TYPE_UINT8) +_TMA_DT_UINT16 = int(cydriver.CU_TENSOR_MAP_DATA_TYPE_UINT16) +_TMA_DT_UINT32 = int(cydriver.CU_TENSOR_MAP_DATA_TYPE_UINT32) +_TMA_DT_INT32 = int(cydriver.CU_TENSOR_MAP_DATA_TYPE_INT32) +_TMA_DT_UINT64 = int(cydriver.CU_TENSOR_MAP_DATA_TYPE_UINT64) +_TMA_DT_INT64 = int(cydriver.CU_TENSOR_MAP_DATA_TYPE_INT64) +_TMA_DT_FLOAT16 = int(cydriver.CU_TENSOR_MAP_DATA_TYPE_FLOAT16) +_TMA_DT_FLOAT32 = int(cydriver.CU_TENSOR_MAP_DATA_TYPE_FLOAT32) +_TMA_DT_FLOAT64 = int(cydriver.CU_TENSOR_MAP_DATA_TYPE_FLOAT64) +_TMA_DT_BFLOAT16 = int(cydriver.CU_TENSOR_MAP_DATA_TYPE_BFLOAT16) +_TMA_DT_FLOAT32_FTZ = int(cydriver.CU_TENSOR_MAP_DATA_TYPE_FLOAT32_FTZ) +_TMA_DT_TFLOAT32 = int(cydriver.CU_TENSOR_MAP_DATA_TYPE_TFLOAT32) +_TMA_DT_TFLOAT32_FTZ = int(cydriver.CU_TENSOR_MAP_DATA_TYPE_TFLOAT32_FTZ) + + +def _normalize_tensor_map_data_type(data_type): + if data_type is None or isinstance(data_type, TensorMapDataType): + return data_type + try: + return numpy.dtype(data_type) + except TypeError as e: + raise TypeError( + "data_type must be a TensorMapDataType or a numpy/ml_dtypes dtype, " + f"got {type(data_type)}") from e + + +def _normalize_tensor_map_sequence(name, values): + try: + values = tuple(values) + except TypeError as e: + raise TypeError(f"{name} must be a tuple of ints, got {type(values)}") from e + for i, value in enumerate(values): + if not isinstance(value, int): + raise TypeError(f"{name}[{i}] must be an int, got {type(value)}") + return values + + +def _require_tensor_map_enum(name, value, enum_type): + if not isinstance(value, enum_type): + raise TypeError(f"{name} must be a {enum_type.__name__}, got {type(value)}") + return value + + +@dataclass +class TensorMapDescriptorOptions: + """Options for :meth:`cuda.core.StridedMemoryView.as_tensor_map`. + + Attributes + ---------- + box_dim : tuple[int, ...] + Tile size for each tensor dimension, expressed in elements. + element_strides : tuple[int, ...], optional + Per-dimension element traversal strides. + data_type : object, optional + Explicit dtype override. Prefer NumPy or ``ml_dtypes`` dtype objects; + :class:`TensorMapDataType` remains accepted for compatibility. + interleave : TensorMapInterleave, optional + Interleave layout. Default ``NONE``. + swizzle : TensorMapSwizzle, optional + Swizzle mode. Default ``NONE``. + l2_promotion : TensorMapL2Promotion, optional + L2 promotion mode. Default ``NONE``. + oob_fill : TensorMapOOBFill, optional + Out-of-bounds fill mode. Default ``NONE``. + """ + + box_dim: tuple[int, ...] + element_strides: tuple[int, ...] | None = None + data_type: object = None + interleave: TensorMapInterleave = TensorMapInterleave.NONE + swizzle: TensorMapSwizzle = TensorMapSwizzle.NONE + l2_promotion: TensorMapL2Promotion = TensorMapL2Promotion.NONE + oob_fill: TensorMapOOBFill = TensorMapOOBFill.NONE + + def __post_init__(self) -> None: + self.box_dim = _normalize_tensor_map_sequence("box_dim", self.box_dim) + if self.element_strides is not None: + self.element_strides = _normalize_tensor_map_sequence("element_strides", self.element_strides) + self.data_type = _normalize_tensor_map_data_type(self.data_type) + self.interleave = _require_tensor_map_enum("interleave", self.interleave, TensorMapInterleave) + self.swizzle = _require_tensor_map_enum("swizzle", self.swizzle, TensorMapSwizzle) + self.l2_promotion = _require_tensor_map_enum("l2_promotion", self.l2_promotion, TensorMapL2Promotion) + self.oob_fill = _require_tensor_map_enum("oob_fill", self.oob_fill, TensorMapOOBFill) + + +def _coerce_tensor_map_descriptor_options( + box_dim, + options, + *, + element_strides, + data_type, + interleave, + swizzle, + l2_promotion, + oob_fill, +): + if options is not None: + if ( + box_dim is not None + or element_strides is not None + or data_type is not None + or interleave != TensorMapInterleave.NONE + or swizzle != TensorMapSwizzle.NONE + or l2_promotion != TensorMapL2Promotion.NONE + or oob_fill != TensorMapOOBFill.NONE + ): + raise TypeError( + "Specify either options or the individual tensor map arguments, not both") + return check_or_create_options( + TensorMapDescriptorOptions, + options, + "Tensor map descriptor options", + ) + + if box_dim is None: + raise TypeError("box_dim is required unless options is provided") + + return TensorMapDescriptorOptions( + box_dim=box_dim, + element_strides=element_strides, + data_type=data_type, + interleave=interleave, + swizzle=swizzle, + l2_promotion=l2_promotion, + oob_fill=oob_fill, + ) + + +# Mapping from numpy dtype to TMA data type +_NUMPY_DTYPE_TO_TMA = { + numpy.dtype(numpy.uint8): _TMA_DT_UINT8, + numpy.dtype(numpy.uint16): _TMA_DT_UINT16, + numpy.dtype(numpy.uint32): _TMA_DT_UINT32, + numpy.dtype(numpy.int32): _TMA_DT_INT32, + numpy.dtype(numpy.uint64): _TMA_DT_UINT64, + numpy.dtype(numpy.int64): _TMA_DT_INT64, + numpy.dtype(numpy.float16): _TMA_DT_FLOAT16, + numpy.dtype(numpy.float32): _TMA_DT_FLOAT32, + numpy.dtype(numpy.float64): _TMA_DT_FLOAT64, +} + +if ml_bfloat16 is not None: + _NUMPY_DTYPE_TO_TMA[numpy.dtype(ml_bfloat16)] = _TMA_DT_BFLOAT16 + + +# Mapping from TMA data type to element size in bytes +_TMA_DATA_TYPE_SIZE = { + _TMA_DT_UINT8: 1, + _TMA_DT_UINT16: 2, + _TMA_DT_UINT32: 4, + _TMA_DT_INT32: 4, + _TMA_DT_UINT64: 8, + _TMA_DT_INT64: 8, + _TMA_DT_FLOAT16: 2, + _TMA_DT_FLOAT32: 4, + _TMA_DT_FLOAT64: 8, + _TMA_DT_BFLOAT16: 2, + _TMA_DT_FLOAT32_FTZ: 4, + _TMA_DT_TFLOAT32: 4, + _TMA_DT_TFLOAT32_FTZ: 4, +} + + +def _resolve_data_type(view, data_type): + """Resolve the TMA data type from an explicit value or the view's dtype.""" + + if data_type is not None: + if isinstance(data_type, TensorMapDataType): + return int(data_type) + dt = _normalize_tensor_map_data_type(data_type) + tma_dt = _NUMPY_DTYPE_TO_TMA.get(dt) + if tma_dt is None: + raise ValueError( + f"Unsupported dtype {dt} for TMA; " + f"supported dtypes: {list(_NUMPY_DTYPE_TO_TMA.keys())}.") + return tma_dt + + dt = view.dtype + if dt is None: + raise ValueError( + "Cannot infer TMA data type from the tensor; " + "please specify data_type explicitly") + + tma_dt = _NUMPY_DTYPE_TO_TMA.get(dt) + if tma_dt is None: + raise ValueError( + f"Unsupported dtype {dt} for TMA; " + f"supported dtypes: {list(_NUMPY_DTYPE_TO_TMA.keys())}. " + "You may also specify data_type explicitly.") + + return tma_dt + + +cdef inline bint _tma_dtype_to_dlpack( + int tma_dt, + uint8_t* out_code, + uint8_t* out_bits, + uint16_t* out_lanes, +) noexcept: + if tma_dt == _TMA_DT_UINT8: + out_code[0] = kDLUInt + out_bits[0] = 8 + out_lanes[0] = 1 + return True + if tma_dt == _TMA_DT_UINT16: + out_code[0] = kDLUInt + out_bits[0] = 16 + out_lanes[0] = 1 + return True + if tma_dt == _TMA_DT_UINT32: + out_code[0] = kDLUInt + out_bits[0] = 32 + out_lanes[0] = 1 + return True + if tma_dt == _TMA_DT_UINT64: + out_code[0] = kDLUInt + out_bits[0] = 64 + out_lanes[0] = 1 + return True + if tma_dt == _TMA_DT_INT32: + out_code[0] = kDLInt + out_bits[0] = 32 + out_lanes[0] = 1 + return True + if tma_dt == _TMA_DT_INT64: + out_code[0] = kDLInt + out_bits[0] = 64 + out_lanes[0] = 1 + return True + if tma_dt == _TMA_DT_FLOAT16: + out_code[0] = kDLFloat + out_bits[0] = 16 + out_lanes[0] = 1 + return True + if tma_dt == _TMA_DT_FLOAT32: + out_code[0] = kDLFloat + out_bits[0] = 32 + out_lanes[0] = 1 + return True + if tma_dt == _TMA_DT_FLOAT64: + out_code[0] = kDLFloat + out_bits[0] = 64 + out_lanes[0] = 1 + return True + if tma_dt == _TMA_DT_BFLOAT16: + out_code[0] = kDLBfloat + out_bits[0] = 16 + out_lanes[0] = 1 + return True + return False + + +cdef inline int _validate_tensor_map_view(view) except -1: + if not view.is_device_accessible: + raise ValueError("The tensor must be device-accessible") + + if view.ptr % 16 != 0: + raise ValueError( + f"Global memory address must be 16-byte aligned, " + f"got address 0x{view.ptr:x}") + return 0 + + +def _get_validated_view(tensor): + """Obtain a device-accessible StridedMemoryView with a 16-byte-aligned pointer.""" + if isinstance(tensor, StridedMemoryView): + view = tensor + else: + # stream_ptr=-1: no stream synchronization needed because descriptor + # creation only reads tensor metadata, it does not move data. + view = StridedMemoryView.from_any_interface(tensor, stream_ptr=-1) + _validate_tensor_map_view(view) + return view + + +def _require_view_device(view, expected_device_id, operation): + """Ensure device-local tensors match the current CUDA device. + + DLPack reports host/managed CUDA memory as ``kDLCUDAHost`` / + ``kDLCUDAManaged`` with ``device_id=0`` regardless of the current device, + so only true ``kDLCUDA`` tensors are rejected by device-id mismatch. + """ + device_type, device_id = view.__dlpack_device__() + if device_type == _kDLCUDA and device_id != expected_device_id: + raise ValueError( + f"{operation} expects tensor on device {expected_device_id}, got {device_id}") +cdef inline intptr_t _get_current_context_ptr() except? 0: + cdef cydriver.CUcontext ctx + with nogil: + HANDLE_RETURN(cydriver.cuCtxGetCurrent(&ctx)) + if ctx == NULL: + raise RuntimeError("TensorMapDescriptor requires an active CUDA context") + return ctx + + +cdef inline int _get_current_device_id() except -1: + cdef cydriver.CUdevice dev + with nogil: + HANDLE_RETURN(cydriver.cuCtxGetDevice(&dev)) + return dev + +def _compute_byte_strides(shape, strides, elem_size): + """Compute byte strides from element strides or C-contiguous fallback. + + Returns a tuple of byte strides in row-major order. + """ + if strides is not None: + return tuple(s * elem_size for s in strides) + + # C-contiguous: compute byte strides from shape, innermost first + rank = len(shape) + byte_strides = [] + stride = elem_size + for i in range(rank - 1, -1, -1): + byte_strides.append(stride) + stride *= shape[i] + byte_strides.reverse() + return tuple(byte_strides) + + +def _validate_element_strides(element_strides, rank): + """Validate or default element_strides to all-ones.""" + if element_strides is not None: + if len(element_strides) != rank: + raise ValueError( + f"element_strides must have {rank} elements, got {len(element_strides)}") + return element_strides + return (1,) * rank + + +cdef class TensorMapDescriptor: + """Describes a TMA (Tensor Memory Accelerator) tensor map for Hopper+ GPUs. + + A ``TensorMapDescriptor`` wraps the opaque 128-byte ``CUtensorMap`` struct + used by the hardware TMA unit for efficient bulk data movement between + global and shared memory. + + Public tiled descriptors are created via + :meth:`cuda.core.StridedMemoryView.as_tensor_map`. Specialized + ``_from_*`` helpers remain private while this API surface settles, and + descriptors can be passed directly to :func:`~cuda.core.launch` as a + kernel argument. + """ + + def __init__(self): + raise RuntimeError( + "TensorMapDescriptor cannot be instantiated directly. " + "Use StridedMemoryView.as_tensor_map() instead.") + + cdef void* _get_data_ptr(self): + return &self._tensor_map + + cdef int _check_context_compat(self) except -1: + cdef cydriver.CUcontext current_ctx + cdef cydriver.CUdevice current_dev + cdef int current_dev_id + if self._context == 0 and self._device_id < 0: + return 0 + with nogil: + HANDLE_RETURN(cydriver.cuCtxGetCurrent(¤t_ctx)) + if current_ctx == NULL: + raise RuntimeError("TensorMapDescriptor requires an active CUDA context") + if self._context != 0 and current_ctx != self._context: + raise RuntimeError( + "TensorMapDescriptor was created in a different CUDA context") + with nogil: + HANDLE_RETURN(cydriver.cuCtxGetDevice(¤t_dev)) + current_dev_id = current_dev + if self._device_id >= 0 and current_dev_id != self._device_id: + raise RuntimeError( + f"TensorMapDescriptor belongs to device {self._device_id}, " + f"but current device is {current_dev_id}") + return 0 + + @property + def device(self) -> Device | None: + """Return the :obj:`~cuda.core.Device` associated with this descriptor.""" + if self._device_id >= 0: + from cuda.core._device import Device + return Device(self._device_id) + return None + + @classmethod + def _from_tiled(cls, view, box_dim=None, *, + options=None, + element_strides=None, + data_type=None, + interleave=TensorMapInterleave.NONE, + swizzle=TensorMapSwizzle.NONE, + l2_promotion=TensorMapL2Promotion.NONE, + oob_fill=TensorMapOOBFill.NONE): + """Create a tiled TMA descriptor from a validated view. + + Parameters + ---------- + view : StridedMemoryView + A device-accessible view with a 16-byte-aligned pointer. + box_dim : tuple of int, optional + The size of each tile dimension (in elements). Must have the + same rank as the tensor and each value must be in [1, 256]. + Specified in the same (row-major) order as the tensor shape. + Required unless ``options`` is provided. + options : TensorMapDescriptorOptions or mapping, optional + Bundled tiled-descriptor options. When provided, do not also pass + ``box_dim`` or the individual option kwargs. + element_strides : tuple of int, optional + Per-dimension element traversal strides. Default is all 1s. + Specified in the same (row-major) order as the tensor shape. + data_type : dtype-like or TensorMapDataType, optional + Explicit dtype override. If ``None``, inferred from the tensor's + dtype. Prefer NumPy or ``ml_dtypes`` dtype objects; the enum is + accepted for compatibility. + interleave : TensorMapInterleave + Interleave layout. Default ``NONE``. + swizzle : TensorMapSwizzle + Swizzle mode. Default ``NONE``. + l2_promotion : TensorMapL2Promotion + L2 promotion mode. Default ``NONE``. + oob_fill : TensorMapOOBFill + Out-of-bounds fill mode. Default ``NONE``. + + Returns + ------- + TensorMapDescriptor + + Raises + ------ + ValueError + If the tensor rank is outside [1, 5], the pointer is not + 16-byte aligned, or dimension/stride constraints are violated. + """ + cdef TensorMapDescriptor desc = cls.__new__(cls) + + opts = _coerce_tensor_map_descriptor_options( + box_dim, + options, + element_strides=element_strides, + data_type=data_type, + interleave=interleave, + swizzle=swizzle, + l2_promotion=l2_promotion, + oob_fill=oob_fill, + ) + box_dim = opts.box_dim + element_strides = opts.element_strides + data_type = opts.data_type + interleave = opts.interleave + swizzle = opts.swizzle + l2_promotion = opts.l2_promotion + oob_fill = opts.oob_fill + + _validate_tensor_map_view(view) + # Keep both the original tensor object and the validated view alive. + # For DLPack exporters, the view may hold the owning capsule whose + # deleter can free the backing allocation when released. + desc._source_ref = view.exporting_obj + desc._view_ref = view + desc._context = _get_current_context_ptr() + desc._device_id = _get_current_device_id() + _require_view_device(view, desc._device_id, "TensorMapDescriptor._from_tiled") + + tma_dt = _resolve_data_type(view, data_type) + cdef int c_data_type_int = tma_dt + cdef cydriver.CUtensorMapDataType c_data_type = c_data_type_int + + cdef intptr_t global_address = view.ptr + shape = view.shape + + cdef int rank = len(shape) + if rank < 1 or rank > 5: + raise ValueError( + f"Tensor rank must be between 1 and 5, got {rank}") + + if len(box_dim) != rank: + raise ValueError( + f"box_dim must have {rank} elements (same as tensor rank), " + f"got {len(box_dim)}") + + for i, bd in enumerate(box_dim): + if bd < 1 or bd > 256: + raise ValueError( + f"box_dim[{i}] must be in [1, 256], got {bd}") + + cdef bint elem_strides_provided = element_strides is not None + element_strides = _validate_element_strides(element_strides, rank) + + # Reuse CCCL/libcu++'s DLPack -> CUtensorMap conversion when possible. + # This avoids maintaining a second, independent validation/encoding implementation. + cdef uint8_t dl_code + cdef uint8_t dl_bits + cdef uint16_t dl_lanes + cdef int64_t c_shape[5] + cdef int64_t c_strides[5] + cdef int c_box_sizes[5] + cdef int c_elem_strides[5] + cdef const int64_t* c_strides_ptr + cdef const int* c_elem_strides_ptr + cdef char errbuf[512] + cdef int i_cccl + cdef int device_type + cdef int c_device_id + cdef int dl_device_type + cdef int dl_device_id + cdef int c_cccl_interleave_int + cdef int c_cccl_swizzle_int + cdef int c_cccl_l2_promotion_int + cdef int c_cccl_oob_fill_int + cdef int rc + if _tma_dtype_to_dlpack(tma_dt, &dl_code, &dl_bits, &dl_lanes): + c_strides_ptr = NULL + c_elem_strides_ptr = NULL + errbuf[0] = 0 + + for i_cccl in range(rank): + c_shape[i_cccl] = shape[i_cccl] + c_box_sizes[i_cccl] = box_dim[i_cccl] + if elem_strides_provided: + c_elem_strides[i_cccl] = element_strides[i_cccl] + + if view.strides is not None: + for i_cccl in range(rank): + c_strides[i_cccl] = view.strides[i_cccl] + c_strides_ptr = &c_strides[0] + + if elem_strides_provided: + c_elem_strides_ptr = &c_elem_strides[0] + + dl_device_type, dl_device_id = view.__dlpack_device__() + device_type = dl_device_type + c_device_id = dl_device_id + c_cccl_interleave_int = int(interleave) + c_cccl_swizzle_int = int(swizzle) + c_cccl_l2_promotion_int = int(l2_promotion) + c_cccl_oob_fill_int = int(oob_fill) + + with nogil: + rc = cuda_core_cccl_make_tma_descriptor_tiled( + &desc._tensor_map, + global_address, + device_type, + c_device_id, + rank, + &c_shape[0], + c_strides_ptr, + dl_code, + dl_bits, + dl_lanes, + &c_box_sizes[0], + c_elem_strides_ptr, + c_cccl_interleave_int, + c_cccl_swizzle_int, + c_cccl_l2_promotion_int, + c_cccl_oob_fill_int, + &errbuf[0], + sizeof(errbuf), + ) + + if rc == 0: + desc._repr_info = { + "method": "tiled", + "rank": rank, + "data_type": TensorMapDataType(tma_dt), + "swizzle": swizzle, + } + return desc + + msg = errbuf[:].split(b"\0", 1)[0].decode("utf-8", errors="replace") + # If CCCL isn't available at build time, fall back to the direct + # driver API path to preserve functionality on older toolchains. + if "not available at build time" not in msg: + raise ValueError(f"Failed to build TMA descriptor via CCCL: {msg}") + + cdef int elem_size = _TMA_DATA_TYPE_SIZE[tma_dt] + byte_strides = _compute_byte_strides(shape, view.strides, elem_size) + + # Reverse dimensions for column-major cuTensorMap convention + # Python/DLPack: row-major (dim 0 = outermost) + # cuTensorMap: column-major (dim 0 = innermost) + cdef uint64_t[5] c_global_dim + cdef uint64_t[4] c_global_strides # rank - 1 elements + cdef uint32_t[5] c_box_dim + cdef uint32_t[5] c_element_strides + cdef int i_c + + for i_c in range(rank): + # Reverse: Python dim i -> cuTensorMap dim (rank - 1 - i) + c_global_dim[i_c] = shape[rank - 1 - i_c] + c_box_dim[i_c] = box_dim[rank - 1 - i_c] + c_element_strides[i_c] = element_strides[rank - 1 - i_c] + + # globalStrides: rank-1 elements (byte strides for dims 1..N-1 in col-major order) + # The innermost stride (dim 0) is implicit = element size + for i_c in range(rank - 1): + c_global_strides[i_c] = byte_strides[rank - 2 - i_c] + + cdef uint32_t c_rank = rank + cdef int c_interleave_int = int(interleave) + cdef int c_swizzle_int = int(swizzle) + cdef int c_l2_promotion_int = int(l2_promotion) + cdef int c_oob_fill_int = int(oob_fill) + cdef cydriver.CUtensorMapInterleave c_interleave = c_interleave_int + cdef cydriver.CUtensorMapSwizzle c_swizzle = c_swizzle_int + cdef cydriver.CUtensorMapL2promotion c_l2_promotion = c_l2_promotion_int + cdef cydriver.CUtensorMapFloatOOBfill c_oob_fill = c_oob_fill_int + + with nogil: + HANDLE_RETURN(cydriver.cuTensorMapEncodeTiled( + &desc._tensor_map, + c_data_type, + c_rank, + global_address, + c_global_dim, + c_global_strides, + c_box_dim, + c_element_strides, + c_interleave, + c_swizzle, + c_l2_promotion, + c_oob_fill, + )) + + desc._repr_info = { + "method": "tiled", + "rank": rank, + "data_type": TensorMapDataType(tma_dt), + "swizzle": swizzle, + } + + return desc + + @classmethod + def _from_im2col(cls, view, pixel_box_lower_corner, pixel_box_upper_corner, + channels_per_pixel, pixels_per_column, *, + element_strides=None, + data_type=None, + interleave=TensorMapInterleave.NONE, + swizzle=TensorMapSwizzle.NONE, + l2_promotion=TensorMapL2Promotion.NONE, + oob_fill=TensorMapOOBFill.NONE): + """Create an im2col TMA descriptor from a validated view. + + Im2col layout is used for convolution-style data access patterns. + + Parameters + ---------- + view : StridedMemoryView + A device-accessible view with a 16-byte-aligned pointer. + pixel_box_lower_corner : tuple of int + Lower corner of the pixel bounding box for each spatial + dimension (rank - 2 elements). Specified in row-major order + matching the tensor's spatial dimensions. + pixel_box_upper_corner : tuple of int + Upper corner of the pixel bounding box for each spatial + dimension (rank - 2 elements). Specified in row-major order + matching the tensor's spatial dimensions. + channels_per_pixel : int + Number of channels per pixel. + pixels_per_column : int + Number of pixels per column. + element_strides : tuple of int, optional + Per-dimension element traversal strides. Default is all 1s. + data_type : dtype-like or TensorMapDataType, optional + Explicit dtype override. If ``None``, inferred from the tensor's + dtype. Prefer NumPy or ``ml_dtypes`` dtype objects; the enum is + accepted for compatibility. + interleave : TensorMapInterleave + Interleave layout. Default ``NONE``. + swizzle : TensorMapSwizzle + Swizzle mode. Default ``NONE``. + l2_promotion : TensorMapL2Promotion + L2 promotion mode. Default ``NONE``. + oob_fill : TensorMapOOBFill + Out-of-bounds fill mode. Default ``NONE``. + + Returns + ------- + TensorMapDescriptor + + Raises + ------ + ValueError + If the tensor rank is outside [3, 5], the pointer is not + 16-byte aligned, or other constraints are violated. + """ + cdef TensorMapDescriptor desc = cls.__new__(cls) + + _validate_tensor_map_view(view) + desc._source_ref = view.exporting_obj + desc._view_ref = view + desc._context = _get_current_context_ptr() + desc._device_id = _get_current_device_id() + _require_view_device(view, desc._device_id, "TensorMapDescriptor._from_im2col") + + tma_dt = _resolve_data_type(view, data_type) + cdef int c_data_type_int = tma_dt + cdef cydriver.CUtensorMapDataType c_data_type = c_data_type_int + + cdef intptr_t global_address = view.ptr + shape = view.shape + + cdef int rank = len(shape) + if rank < 3 or rank > 5: + raise ValueError( + f"Im2col tensor rank must be between 3 and 5, got {rank}") + + cdef int n_spatial = rank - 2 + if len(pixel_box_lower_corner) != n_spatial: + raise ValueError( + f"pixel_box_lower_corner must have {n_spatial} elements " + f"(rank - 2), got {len(pixel_box_lower_corner)}") + if len(pixel_box_upper_corner) != n_spatial: + raise ValueError( + f"pixel_box_upper_corner must have {n_spatial} elements " + f"(rank - 2), got {len(pixel_box_upper_corner)}") + + element_strides = _validate_element_strides(element_strides, rank) + + cdef int elem_size = _TMA_DATA_TYPE_SIZE[tma_dt] + byte_strides = _compute_byte_strides(shape, view.strides, elem_size) + + # Reverse all dimension arrays for column-major convention + cdef uint64_t[5] c_global_dim + cdef uint64_t[4] c_global_strides + cdef uint32_t[5] c_element_strides + cdef int[3] c_pixel_box_lower # max 3 spatial dims (rank 5 - 2) + cdef int[3] c_pixel_box_upper + cdef int i_c + + for i_c in range(3): + c_pixel_box_lower[i_c] = 0 + c_pixel_box_upper[i_c] = 0 + + for i_c in range(rank): + c_global_dim[i_c] = shape[rank - 1 - i_c] + c_element_strides[i_c] = element_strides[rank - 1 - i_c] + + for i_c in range(rank - 1): + c_global_strides[i_c] = byte_strides[rank - 2 - i_c] + + # Reverse spatial dimensions for lower/upper corners + for i_c in range(n_spatial): + c_pixel_box_lower[i_c] = pixel_box_lower_corner[n_spatial - 1 - i_c] + c_pixel_box_upper[i_c] = pixel_box_upper_corner[n_spatial - 1 - i_c] + + cdef uint32_t c_rank = rank + cdef uint32_t c_channels = channels_per_pixel + cdef uint32_t c_pixels = pixels_per_column + cdef int c_interleave_int = int(interleave) + cdef int c_swizzle_int = int(swizzle) + cdef int c_l2_promotion_int = int(l2_promotion) + cdef int c_oob_fill_int = int(oob_fill) + cdef cydriver.CUtensorMapInterleave c_interleave = c_interleave_int + cdef cydriver.CUtensorMapSwizzle c_swizzle = c_swizzle_int + cdef cydriver.CUtensorMapL2promotion c_l2_promotion = c_l2_promotion_int + cdef cydriver.CUtensorMapFloatOOBfill c_oob_fill = c_oob_fill_int + + with nogil: + HANDLE_RETURN(cydriver.cuTensorMapEncodeIm2col( + &desc._tensor_map, + c_data_type, + c_rank, + global_address, + c_global_dim, + c_global_strides, + c_pixel_box_lower, + c_pixel_box_upper, + c_channels, + c_pixels, + c_element_strides, + c_interleave, + c_swizzle, + c_l2_promotion, + c_oob_fill, + )) + + desc._repr_info = { + "method": "im2col", + "rank": rank, + "data_type": TensorMapDataType(tma_dt), + "swizzle": swizzle, + } + + return desc + + @classmethod + def _from_im2col_wide(cls, view, pixel_box_lower_corner_width, pixel_box_upper_corner_width, + channels_per_pixel, pixels_per_column, *, + element_strides=None, + data_type=None, + interleave=TensorMapInterleave.NONE, + mode=TensorMapIm2ColWideMode.W, + swizzle=TensorMapSwizzle.SWIZZLE_128B, + l2_promotion=TensorMapL2Promotion.NONE, + oob_fill=TensorMapOOBFill.NONE): + """Create an im2col-wide TMA descriptor from a validated view. + + Im2col-wide layout loads elements exclusively along the W (width) + dimension. This variant is supported on compute capability 10.0+ + (Blackwell and later). + + Parameters + ---------- + view : StridedMemoryView + A device-accessible view with a 16-byte-aligned pointer. + pixel_box_lower_corner_width : int + Lower corner of the pixel bounding box along the W dimension. + pixel_box_upper_corner_width : int + Upper corner of the pixel bounding box along the W dimension. + channels_per_pixel : int + Number of channels per pixel. + pixels_per_column : int + Number of pixels per column. + element_strides : tuple of int, optional + Per-dimension element traversal strides. Default is all 1s. + data_type : dtype-like or TensorMapDataType, optional + Explicit dtype override. If ``None``, inferred from the tensor's + dtype. Prefer NumPy or ``ml_dtypes`` dtype objects; the enum is + accepted for compatibility. + interleave : TensorMapInterleave + Interleave layout. Default ``NONE``. + mode : TensorMapIm2ColWideMode + Im2col wide mode. Default ``W``. + swizzle : TensorMapSwizzle + Swizzle mode. Default ``SWIZZLE_128B``. + l2_promotion : TensorMapL2Promotion + L2 promotion mode. Default ``NONE``. + oob_fill : TensorMapOOBFill + Out-of-bounds fill mode. Default ``NONE``. + + Returns + ------- + TensorMapDescriptor + + Raises + ------ + ValueError + If the tensor rank is outside [3, 5], the pointer is not + 16-byte aligned, or other constraints are violated. + """ + IF CUDA_CORE_BUILD_MAJOR < 13: + raise RuntimeError( + "TensorMapDescriptor._from_im2col_wide requires a CUDA 13+ build") + ELSE: + cdef TensorMapDescriptor desc = cls.__new__(cls) + + _validate_tensor_map_view(view) + desc._source_ref = view.exporting_obj + desc._view_ref = view + desc._context = _get_current_context_ptr() + desc._device_id = _get_current_device_id() + _require_view_device(view, desc._device_id, "TensorMapDescriptor._from_im2col_wide") + + tma_dt = _resolve_data_type(view, data_type) + cdef int c_data_type_int = tma_dt + cdef cydriver.CUtensorMapDataType c_data_type = c_data_type_int + + cdef intptr_t global_address = view.ptr + shape = view.shape + + cdef int rank = len(shape) + if rank < 3 or rank > 5: + raise ValueError( + f"Im2col-wide tensor rank must be between 3 and 5, got {rank}") + + element_strides = _validate_element_strides(element_strides, rank) + + cdef int elem_size = _TMA_DATA_TYPE_SIZE[tma_dt] + byte_strides = _compute_byte_strides(shape, view.strides, elem_size) + + # Reverse all dimension arrays for column-major convention + cdef uint64_t[5] c_global_dim + cdef uint64_t[4] c_global_strides + cdef uint32_t[5] c_element_strides + cdef int i_c + + for i_c in range(rank): + c_global_dim[i_c] = shape[rank - 1 - i_c] + c_element_strides[i_c] = element_strides[rank - 1 - i_c] + + for i_c in range(rank - 1): + c_global_strides[i_c] = byte_strides[rank - 2 - i_c] + + cdef uint32_t c_rank = rank + cdef int c_lower_w = pixel_box_lower_corner_width + cdef int c_upper_w = pixel_box_upper_corner_width + cdef uint32_t c_channels = channels_per_pixel + cdef uint32_t c_pixels = pixels_per_column + cdef int c_interleave_int = int(interleave) + cdef int c_mode_int = int(mode) + cdef int c_swizzle_int = int(swizzle) + cdef int c_l2_promotion_int = int(l2_promotion) + cdef int c_oob_fill_int = int(oob_fill) + cdef cydriver.CUtensorMapInterleave c_interleave = c_interleave_int + cdef cydriver.CUtensorMapIm2ColWideMode c_mode = c_mode_int + cdef cydriver.CUtensorMapSwizzle c_swizzle = c_swizzle_int + cdef cydriver.CUtensorMapL2promotion c_l2_promotion = c_l2_promotion_int + cdef cydriver.CUtensorMapFloatOOBfill c_oob_fill = c_oob_fill_int + + with nogil: + HANDLE_RETURN(cydriver.cuTensorMapEncodeIm2colWide( + &desc._tensor_map, + c_data_type, + c_rank, + global_address, + c_global_dim, + c_global_strides, + c_lower_w, + c_upper_w, + c_channels, + c_pixels, + c_element_strides, + c_interleave, + c_mode, + c_swizzle, + c_l2_promotion, + c_oob_fill, + )) + + desc._repr_info = { + "method": "im2col_wide", + "rank": rank, + "data_type": TensorMapDataType(tma_dt), + "swizzle": swizzle, + } + + return desc + + def replace_address(self, tensor: object) -> None: + """Replace the global memory address in this tensor map descriptor. + + This is useful when the tensor data has been reallocated but the + shape, strides, and other parameters remain the same. + + Parameters + ---------- + tensor : object + Any object supporting DLPack or ``__cuda_array_interface__``, + or a :obj:`~cuda.core.StridedMemoryView`. Must refer to + device-accessible memory with a 16-byte-aligned pointer. + """ + self._check_context_compat() + view = _get_validated_view(tensor) + _require_view_device(view, self._device_id, "replace_address") + + cdef intptr_t global_address = view.ptr + + with nogil: + HANDLE_RETURN(cydriver.cuTensorMapReplaceAddress( + &self._tensor_map, + global_address, + )) + + # Update the source reference only after the driver call succeeds, + # so we don't drop the old tensor (risking a dangling pointer in the + # CUtensorMap struct) if the call fails. + self._source_ref = view.exporting_obj + self._view_ref = view + + def __repr__(self) -> str: + info = self._repr_info + if info is None: + return "TensorMapDescriptor()" + parts = [] + if "method" in info: + parts.append(info["method"]) + if "rank" in info: + parts.append(f"rank={info['rank']}") + if "data_type" in info: + parts.append(f"dtype={info['data_type'].name}") + if "swizzle" in info: + parts.append(f"swizzle={info['swizzle'].name}") + return f"TensorMapDescriptor({', '.join(parts)})" diff --git a/docs/.buildinfo b/cuda_core/cuda/core/_utils/__init__.pxd similarity index 100% rename from docs/.buildinfo rename to cuda_core/cuda/core/_utils/__init__.pxd diff --git a/cuda_core/cuda/core/_utils/__init__.py b/cuda_core/cuda/core/_utils/__init__.py new file mode 100644 index 00000000000..79599c77db0 --- /dev/null +++ b/cuda_core/cuda/core/_utils/__init__.py @@ -0,0 +1,3 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 diff --git a/cuda_core/cuda/core/_utils/_weak_handles.pyi b/cuda_core/cuda/core/_utils/_weak_handles.pyi new file mode 100644 index 00000000000..3cf095d7b87 --- /dev/null +++ b/cuda_core/cuda/core/_utils/_weak_handles.pyi @@ -0,0 +1,55 @@ +# This file was generated by stubgen-pyx v0.2.6 from cuda_core/cuda/core/_utils/_weak_handles.pyx + +"""Test-only weak handles for resource-handle lifetime checks. + +This module is **not** part of the public ``cuda.core`` API. It is built into +the package (like other private ``_utils`` modules) purely so the test suite can +observe, deterministically, when the strong references that keep a CUDA resource +alive have all been released -- without relying on driver- or hardware-specific +side effects (for example, whether freed device memory happens to remain +readable). + +Every resource handle is owned by a C++ ``std::shared_ptr``. A **weak handle** +is a non-owning ``std::weak_ptr`` observer of that control block: truthy while +some strong owner remains, falsy once the last one is gone. Use :func:`weak_handle` +to obtain a weak handle from a supported front-end object. + +To support another type, add a ``cdef _weak_from_`` that reads its ``cdef`` +handle field (see ``*.pxd``), assigns to :ctype:`OpaqueHandle`, and extend the +``isinstance`` chain in :func:`weak_handle`. Types whose slots hold arbitrary +Python owners via ``make_opaque_py`` are not covered here -- use +:class:`weakref.ref` on a weak-referenceable owner object in tests instead. +""" +from __future__ import annotations + + +class WeakHandle: + """Non-owning weak handle for a resource's shared control block. + + Truthy while some strong owner of the underlying resource handle remains, + falsy once the last strong reference is released. Obtain instances via + :func:`weak_handle` rather than constructing directly. + """ + + def __bool__(self): + ... + + def expired(self): + """Return ``True`` once every strong owner of the handle is gone.""" + + def use_count(self): + """Number of strong owners currently sharing the handle.""" + +def weak_handle(obj): + """Return a :class:`WeakHandle` observing the resource behind ``obj``. + + Currently supports :class:`~cuda.core.Buffer` (device allocation handle). + See the module docstring for how to add more types. + + Raises + ------ + ValueError + If ``obj`` is a :class:`~cuda.core.Buffer` with no active allocation. + TypeError + If ``obj`` is not a supported type. + """ \ No newline at end of file diff --git a/cuda_core/cuda/core/_utils/_weak_handles.pyx b/cuda_core/cuda/core/_utils/_weak_handles.pyx new file mode 100644 index 00000000000..65737b958a6 --- /dev/null +++ b/cuda_core/cuda/core/_utils/_weak_handles.pyx @@ -0,0 +1,106 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +"""Test-only weak handles for resource-handle lifetime checks. + +This module is **not** part of the public ``cuda.core`` API. It is built into +the package (like other private ``_utils`` modules) purely so the test suite can +observe, deterministically, when the strong references that keep a CUDA resource +alive have all been released -- without relying on driver- or hardware-specific +side effects (for example, whether freed device memory happens to remain +readable). + +Every resource handle is owned by a C++ ``std::shared_ptr``. A **weak handle** +is a non-owning ``std::weak_ptr`` observer of that control block: truthy while +some strong owner remains, falsy once the last one is gone. Use :func:`weak_handle` +to obtain a weak handle from a supported front-end object. + +To support another type, add a ``cdef _weak_from_`` that reads its ``cdef`` +handle field (see ``*.pxd``), assigns to :ctype:`OpaqueHandle`, and extend the +``isinstance`` chain in :func:`weak_handle`. Types whose slots hold arbitrary +Python owners via ``make_opaque_py`` are not covered here -- use +:class:`weakref.ref` on a weak-referenceable owner object in tests instead. +""" + +from cuda.core._memory._buffer cimport Buffer +from cuda.core._resource_handles cimport OpaqueHandle + + +# Cython cannot spell ``weak_ptr[const void]`` inline (the ``const void`` +# template argument fails to parse), so the weak type and its one constructor +# are provided by a small inline C++ shim local to this test-only module. This +# keeps the production resource_handles translation units untouched. +cdef extern from *: + """ + #include + namespace cuda_core_test { + using OpaqueWeakHandle = std::weak_ptr; + static inline OpaqueWeakHandle make_weak(const std::shared_ptr& h) { + return OpaqueWeakHandle(h); + } + } // namespace cuda_core_test + """ + cppclass OpaqueWeakHandle "cuda_core_test::OpaqueWeakHandle": + OpaqueWeakHandle() + bint expired() + long use_count() + OpaqueWeakHandle make_weak "cuda_core_test::make_weak" (const OpaqueHandle& h) + + +cdef class WeakHandle: + """Non-owning weak handle for a resource's shared control block. + + Truthy while some strong owner of the underlying resource handle remains, + falsy once the last strong reference is released. Obtain instances via + :func:`weak_handle` rather than constructing directly. + """ + + cdef OpaqueWeakHandle _w + + def __bool__(self): + return not self._w.expired() + + def expired(self): + """Return ``True`` once every strong owner of the handle is gone.""" + return self._w.expired() + + def use_count(self): + """Number of strong owners currently sharing the handle.""" + return self._w.use_count() + + +cdef WeakHandle _weak_from_opaque(OpaqueHandle h): + # Build the weak handle from a (temporary) strong handle. The strong copy + # lives only for the duration of this call, so it does not perturb the + # reference count the weak handle later reports. + cdef WeakHandle wh = WeakHandle.__new__(WeakHandle) + wh._w = make_weak(h) + return wh + + +cdef WeakHandle _weak_from_buffer(Buffer buf): + cdef OpaqueHandle h = buf._h_ptr + if not h: + raise ValueError("Buffer has no active allocation") + return _weak_from_opaque(h) + + +def weak_handle(obj): + """Return a :class:`WeakHandle` observing the resource behind ``obj``. + + Currently supports :class:`~cuda.core.Buffer` (device allocation handle). + See the module docstring for how to add more types. + + Raises + ------ + ValueError + If ``obj`` is a :class:`~cuda.core.Buffer` with no active allocation. + TypeError + If ``obj`` is not a supported type. + """ + if isinstance(obj, Buffer): + return _weak_from_buffer(obj) + raise TypeError( + f"weak_handle() does not support {type(obj).__name__!r}; " + "supported types: Buffer" + ) diff --git a/cuda_core/cuda/core/_utils/_wsl_locale.pyi b/cuda_core/cuda/core/_utils/_wsl_locale.pyi new file mode 100644 index 00000000000..267bdf244f0 --- /dev/null +++ b/cuda_core/cuda/core/_utils/_wsl_locale.pyi @@ -0,0 +1,20 @@ +# This file was generated by stubgen-pyx v0.2.6 from cuda_core/cuda/core/_utils/_wsl_locale.pyx + +from __future__ import annotations + + +class c_locale_guard: + """Context manager that pins the calling thread to the "C" locale. + + Uses POSIX newlocale/uselocale/freelocale so other threads' view of the + locale is unaffected. Restores the previous thread locale on exit. + """ + + def __cinit__(self) -> None: + ... + + def __enter__(self): + ... + + def __exit__(self, exc_type, exc_val, exc_tb): + ... \ No newline at end of file diff --git a/cuda_core/cuda/core/_utils/_wsl_locale.pyx b/cuda_core/cuda/core/_utils/_wsl_locale.pyx new file mode 100644 index 00000000000..c5d087cd28c --- /dev/null +++ b/cuda_core/cuda/core/_utils/_wsl_locale.pyx @@ -0,0 +1,53 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + + +# WSL-specific locale guard, used by cuda.core.system.get_process_name() to +# work around a bug in NVML's WSL implementation where nvmlSystemGetProcessName +# returns mojibake when the calling thread is in a non-"C" locale. See +# get_process_name() for the full backstory. +# +# This module is only compiled on Linux (build_hooks.py excludes it on Windows) +# because it uses the POSIX per-thread locale APIs (newlocale/uselocale/ +# freelocale), which are not available on MSVC. Callers must guard imports of +# this module with try/except ImportError. + + +cdef extern from "locale.h" nogil: + ctypedef void *locale_t + int LC_ALL_MASK + locale_t newlocale(int category_mask, const char *locale, locale_t base) + locale_t uselocale(locale_t newloc) + void freelocale(locale_t locobj) + + +cdef class c_locale_guard: + """Context manager that pins the calling thread to the "C" locale. + + Uses POSIX newlocale/uselocale/freelocale so other threads' view of the + locale is unaffected. Restores the previous thread locale on exit. + """ + cdef locale_t _c_locale + cdef locale_t _prev_locale + cdef bint _active + + def __cinit__(self) -> None: + self._c_locale = 0 + self._prev_locale = 0 + self._active = False + + def __enter__(self): + self._c_locale = newlocale(LC_ALL_MASK, b"C", 0) + if self._c_locale == 0: + raise RuntimeError("Failed to create C locale") + self._prev_locale = uselocale(self._c_locale) + self._active = True + return self + + def __exit__(self, exc_type, exc_val, exc_tb): + if self._active: + uselocale(self._prev_locale) + freelocale(self._c_locale) + self._active = False + return False diff --git a/cuda_core/cuda/core/_utils/clear_error_support.py b/cuda_core/cuda/core/_utils/clear_error_support.py new file mode 100644 index 00000000000..a9e5af86f68 --- /dev/null +++ b/cuda_core/cuda/core/_utils/clear_error_support.py @@ -0,0 +1,23 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from __future__ import annotations + +from typing import NoReturn + + +def assert_type(obj: object, expected_type: type) -> None: + """Ensure obj is of expected_type, else raise AssertionError with a clear message.""" + if not isinstance(obj, expected_type): + raise TypeError(f"Expected type {expected_type.__name__}, but got {type(obj).__name__}") + + +def assert_type_str_or_bytes_like(obj: object) -> None: + """Ensure obj is of type str or bytes, else raise AssertionError with a clear message.""" + if not isinstance(obj, (str, bytes, bytearray)): + raise TypeError(f"Expected type str or bytes or bytearray, but got {type(obj).__name__}") + + +def raise_code_path_meant_to_be_unreachable() -> NoReturn: + raise RuntimeError("This code path is meant to be unreachable.") diff --git a/cuda_core/cuda/core/_utils/cuda_utils.pxd b/cuda_core/cuda/core/_utils/cuda_utils.pxd new file mode 100644 index 00000000000..11e464e6381 --- /dev/null +++ b/cuda_core/cuda/core/_utils/cuda_utils.pxd @@ -0,0 +1,57 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +cimport cpython +from cpython.object cimport PyObject +from libc.stdint cimport int64_t, int32_t, uint8_t, uint16_t, uint32_t + +from cuda.bindings cimport cydriver, cynvrtc, cynvvm, cynvjitlink + + +ctypedef fused integer_t: + int64_t + int32_t + + +# mimic CU_DEVICE_INVALID +cdef const cydriver.CUcontext CU_CONTEXT_INVALID = (-2) + + +cdef int HANDLE_RETURN(cydriver.CUresult err) except?-1 nogil +cdef int HANDLE_RETURN_NVRTC(cynvrtc.nvrtcProgram prog, cynvrtc.nvrtcResult err) except?-1 nogil +cdef int HANDLE_RETURN_NVVM(cynvvm.nvvmProgram prog, cynvvm.nvvmResult err) except?-1 nogil +cdef int HANDLE_RETURN_NVJITLINK( + cynvjitlink.nvJitLinkHandle handle, cynvjitlink.nvJitLinkResult err) except?-1 nogil + + +# Helper for retrieving the current CUDA device. Raises if no active context +# is bound to the calling thread. +cdef int _get_current_device_id() except? -1 + + +# TODO: stop exposing these within the codebase? +cpdef int _check_driver_error(cydriver.CUresult error) except?-1 nogil +cpdef int _check_runtime_error(error) except?-1 +cpdef int _check_nvrtc_error(error) except?-1 + + +cpdef check_or_create_options(type cls, options, str options_description=*, bint keep_none=*) + +cpdef tuple _parse_fill_value(value) + + +# Create low-level externs so Cython won't "helpfully" handle reference counting +# for us. Prefixing with an underscore to distinguish it from the definition in +# cpython.long. +cdef extern from "Python.h": + PyObject *_PyLong_FromLongLong "PyLong_FromLongLong" (long long val) except NULL + void _PyTuple_SET_ITEM "PyTuple_SET_ITEM" (object p, Py_ssize_t pos, PyObject *o) + + +cdef inline tuple carray_integer_t_to_tuple(integer_t *ptr, int length): + # Construct shape and strides tuples using the Python/C API for speed + cdef tuple result = cpython.PyTuple_New(length) + for i in range(length): + _PyTuple_SET_ITEM(result, i, _PyLong_FromLongLong(ptr[i])) + return result diff --git a/cuda_core/cuda/core/_utils/cuda_utils.pyi b/cuda_core/cuda/core/_utils/cuda_utils.pyi new file mode 100644 index 00000000000..87067927724 --- /dev/null +++ b/cuda_core/cuda/core/_utils/cuda_utils.pyi @@ -0,0 +1,144 @@ +# This file was generated by stubgen-pyx v0.2.6 from cuda_core/cuda/core/_utils/cuda_utils.pyx + +from __future__ import annotations + +from collections import namedtuple +from typing import Any, Callable + +from cuda.bindings import cydriver +from cuda.bindings import driver as driver +from cuda.bindings import nvrtc as nvrtc +from cuda.bindings import runtime as runtime + + +class CUDAError(Exception): + ... + +class NVRTCError(CUDAError): + ... + +class Transaction: + """ + A context manager for transactional operations with undo capability. + + The Transaction class allows you to register undo actions (callbacks) that will be executed + if the transaction is not committed before exiting the context. This is useful for managing + resources or operations that need to be rolled back in case of errors or early exits. + + Usage: + with Transaction() as txn: + txn.append(some_cleanup_function, arg1, arg2) + # ... perform operations ... + txn.commit() # Disarm undo actions; nothing will be rolled back on exit + + Methods: + append(fn, *args, **kwargs): Register an undo action to be called on rollback. + commit(): Disarm all undo actions; nothing will be rolled back on exit. + """ + + def __init__(self) -> None: + ... + + def __enter__(self): + ... + + def __exit__(self, exc_type, exc, tb): + ... + + def append(self, fn: Callable[..., Any], /, *args: Any, **kwargs) -> None: + """ + Register an undo action (runs if the with-block exits without commit()). + Values are bound now via partial so late mutations don't bite you. + """ + + def commit(self) -> None: + """ + Disarm all undo actions. After this, exiting the with-block does nothing. + """ +_keep_driver_in_stub: 'driver.CUresult' +_keep_nvrtc_in_stub: 'nvrtc.nvrtcResult' +_keep_runtime_in_stub: 'runtime.cudaError_t' +ComputeCapability = namedtuple('ComputeCapability', ('major', 'minor')) +_fork_warning_checked = False + +def _check_driver_error(error: cydriver.CUresult) -> int: + ... + +def _check_runtime_error(error) -> int: + ... + +def _check_nvrtc_error(error, handle=None) -> int: + ... + +def check_or_create_options(cls: type, options: object, options_description: str='', keep_none: bool=False) -> object: + """ + Create the specified options dataclass from a dictionary of options or None. + """ + +def _parse_fill_value(value) -> tuple: + """Parse a fill/memset value into (raw_value, element_size). + + Parameters + ---------- + value : int or buffer-protocol object + - int: Must be in range [0, 256). Treated as 1-byte fill. + - bytes or buffer-protocol: Must be 1, 2, or 4 bytes. + + Returns + ------- + tuple of (int, int) + (raw_value, element_size) where element_size is 1, 2, or 4. + + Raises + ------ + OverflowError + If int value is outside [0, 256). + TypeError + If value is not an int and does not support the buffer protocol. + ValueError + If value byte length is not 1, 2, or 4. + """ + +def cast_to_3_tuple(label: str, cfg: int | tuple[int, ...]) -> tuple[int, int, int]: + ... + +def handle_return(result: tuple[Any, ...], handle: object=None) -> Any: + ... + +def _handle_boolean_option(option: bool) -> str: + """ + Convert a boolean option to a string representation. + """ + +def precondition(checker: Callable[..., None], what: str='') -> Callable[..., Any]: + """ + A decorator that adds checks to ensure any preconditions are met. + + Args: + checker: The function to call to check whether the preconditions are met. It has + the same signature as the wrapped function with the addition of the keyword argument `what`. + what: A string that is passed in to `checker` to provide context information. + + Returns: + Callable: A decorator that creates the wrapping. + """ + +def is_sequence(obj: object) -> bool: + """ + Check if the given object is a sequence (list or tuple). + """ + +def is_nested_sequence(obj: object) -> bool: + """ + Check if the given object is a nested sequence (list or tuple with atleast one list or tuple element). + """ + +def reset_fork_warning() -> None: + """Reset the fork warning check flag for testing purposes. + + This function is intended for use in tests to allow multiple test runs + to check the warning behavior. + """ + +def check_multiprocessing_start_method() -> None: + """Check if multiprocessing start method is 'fork' and warn if so.""" \ No newline at end of file diff --git a/cuda_core/cuda/core/_utils/cuda_utils.pyx b/cuda_core/cuda/core/_utils/cuda_utils.pyx new file mode 100644 index 00000000000..318d4466bee --- /dev/null +++ b/cuda_core/cuda/core/_utils/cuda_utils.pyx @@ -0,0 +1,456 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +import functools +from functools import partial +import multiprocessing +import platform +import warnings +from collections import namedtuple +from collections.abc import Sequence +from contextlib import ExitStack +from typing import Any, Callable + +from cuda.bindings import driver as driver, nvrtc as nvrtc, runtime as runtime + +# Module-level annotations that reference `driver`, `nvrtc`, and `runtime` so +# that stubgen-pyx keeps these imports in the generated `.pyi` (it would +# otherwise trim them as unused). These names are not assigned, so they only +# affect __annotations__ and have no runtime cost. +_keep_driver_in_stub: 'driver.CUresult' +_keep_nvrtc_in_stub: 'nvrtc.nvrtcResult' +_keep_runtime_in_stub: 'runtime.cudaError_t' + +from cuda.bindings.nvvm import nvvmError +from cuda.bindings.nvjitlink import nvJitLinkError + +from cpython.buffer cimport PyObject_GetBuffer, PyBuffer_Release, Py_buffer, PyBUF_SIMPLE + +from cuda.bindings cimport cynvrtc, cynvvm, cynvjitlink + +from cuda.core._utils.driver_cu_result_explanations import DRIVER_CU_RESULT_EXPLANATIONS +from cuda.core._utils.runtime_cuda_error_explanations import RUNTIME_CUDA_ERROR_EXPLANATIONS + + +class CUDAError(Exception): + pass + + +class NVRTCError(CUDAError): + pass + + + +ComputeCapability = namedtuple("ComputeCapability", ("major", "minor")) + + +def cast_to_3_tuple(label: str, cfg: int | tuple[int, ...]) -> tuple[int, int, int]: + cfg_orig = cfg + if isinstance(cfg, int): + cfg = (cfg,) + else: + common = "must be an int, or a tuple with up to 3 ints" + if not isinstance(cfg, tuple): + raise ValueError(f"{label} {common} (got {type(cfg)})") + if len(cfg) > 3: + raise ValueError(f"{label} {common} (got tuple with length {len(cfg)})") + if any(not isinstance(val, int) for val in cfg): + raise ValueError(f"{label} {common} (got {cfg})") + if any(val < 1 for val in cfg): + plural_s = "" if len(cfg) == 1 else "s" + raise ValueError(f"{label} value{plural_s} must be >= 1 (got {cfg_orig})") + return cfg + (1,) * (3 - len(cfg)) + + +cdef int HANDLE_RETURN(cydriver.CUresult err) except?-1 nogil: + if err != cydriver.CUresult.CUDA_SUCCESS: + return _check_driver_error(err) + return 0 + + +cdef int _get_current_device_id() except? -1: + """Return the current thread's bound CUdevice ordinal.""" + cdef cydriver.CUdevice dev + with nogil: + HANDLE_RETURN(cydriver.cuCtxGetDevice(&dev)) + return dev + + +cdef int HANDLE_RETURN_NVRTC(cynvrtc.nvrtcProgram prog, cynvrtc.nvrtcResult err) except?-1 nogil: + """Handle NVRTC result codes, raising NVRTCError with program log on failure.""" + if err == cynvrtc.nvrtcResult.NVRTC_SUCCESS: + return 0 + with gil: + _raise_nvrtc_error(prog, err) + + +cdef int _raise_nvrtc_error(cynvrtc.nvrtcProgram prog, cynvrtc.nvrtcResult err) except -1: + """Build error message with program log and raise NVRTCError.""" + cdef const char* err_str = cynvrtc.nvrtcGetErrorString(err) + cdef size_t logsize = 0 + if prog != NULL: + cynvrtc.nvrtcGetProgramLogSize(prog, &logsize) + cdef bytes log_bytes + cdef str log_str = "" + if logsize > 1 and prog != NULL: + log_bytes = b" " * logsize + if cynvrtc.nvrtcGetProgramLog(prog, log_bytes) == cynvrtc.nvrtcResult.NVRTC_SUCCESS: + log_str = log_bytes.decode("utf-8", errors="backslashreplace") + err_msg = f"{err}: {err_str.decode()}" if err_str != NULL else f"NVRTC error {err}" + if log_str: + err_msg += f", compilation log:\n\n{log_str}" + raise NVRTCError(err_msg) + + +cdef int HANDLE_RETURN_NVVM(cynvvm.nvvmProgram prog, cynvvm.nvvmResult err) except?-1 nogil: + """Handle NVVM result codes, raising nvvmError with program log on failure.""" + if err == cynvvm.nvvmResult.NVVM_SUCCESS: + return 0 + with gil: + _raise_nvvm_error(prog, err) + + +cdef int _raise_nvvm_error(cynvvm.nvvmProgram prog, cynvvm.nvvmResult err) except -1: + """Raise nvvmError annotated with the program log.""" + cdef size_t logsize = 0 + if prog != NULL: + cynvvm.nvvmGetProgramLogSize(prog, &logsize) + cdef bytes log_bytes + cdef str log_str = "" + if logsize > 1 and prog != NULL: + log_bytes = b" " * logsize + if cynvvm.nvvmGetProgramLog(prog, log_bytes) == cynvvm.nvvmResult.NVVM_SUCCESS: + log_str = log_bytes.decode("utf-8", errors="backslashreplace") + cdef object exc = nvvmError(err) + if log_str: + exc.args = (exc.args[0] + f"\nNVVM program log: {log_str}", *exc.args[1:]) + raise exc + + +cdef int HANDLE_RETURN_NVJITLINK( + cynvjitlink.nvJitLinkHandle handle, cynvjitlink.nvJitLinkResult err) except?-1 nogil: + """Handle nvJitLink result codes, raising nvJitLinkError with error log on failure.""" + if err == cynvjitlink.nvJitLinkResult.NVJITLINK_SUCCESS: + return 0 + with gil: + _raise_nvjitlink_error(handle, err) + + +cdef int _raise_nvjitlink_error( + cynvjitlink.nvJitLinkHandle handle, cynvjitlink.nvJitLinkResult err) except -1: + """Raise nvJitLinkError annotated with the error log.""" + cdef size_t logsize = 0 + if handle != NULL: + cynvjitlink.nvJitLinkGetErrorLogSize(handle, &logsize) + cdef bytes log_bytes + cdef str log_str = "" + if logsize > 1 and handle != NULL: + log_bytes = b" " * logsize + if cynvjitlink.nvJitLinkGetErrorLog(handle, log_bytes) == \ + cynvjitlink.nvJitLinkResult.NVJITLINK_SUCCESS: + log_str = log_bytes.decode("utf-8", errors="backslashreplace") + cdef object exc = nvJitLinkError(err) + if log_str: + exc.args = (exc.args[0] + f"\nnvJitLink error log: {log_str}", *exc.args[1:]) + raise exc + + +cdef object _RUNTIME_SUCCESS = runtime.cudaError_t.cudaSuccess +cdef object _NVRTC_SUCCESS = nvrtc.nvrtcResult.NVRTC_SUCCESS + + +cpdef inline int _check_driver_error(cydriver.CUresult error) except?-1 nogil: + if error == cydriver.CUresult.CUDA_SUCCESS: + return 0 + cdef const char* name + name_err = cydriver.cuGetErrorName(error, &name) + if name_err != cydriver.CUresult.CUDA_SUCCESS: + raise CUDAError(f"UNEXPECTED ERROR CODE: {error}") + with gil: + # TODO: consider lower this to Cython + expl = DRIVER_CU_RESULT_EXPLANATIONS.get(int(error)) + if expl is not None: + raise CUDAError(f"{name.decode()}: {expl}") + cdef const char* desc + desc_err = cydriver.cuGetErrorString(error, &desc) + if desc_err != cydriver.CUresult.CUDA_SUCCESS: + raise CUDAError(f"{name.decode()}") + raise CUDAError(f"{name.decode()}: {desc.decode()}") + + +cpdef inline int _check_runtime_error(error) except?-1: + if error == _RUNTIME_SUCCESS: + return 0 + # `_check_error()` reaches this path only for `runtime.cudaError_t` values. + # Use the enum name directly because Windows hybrid cudart can lag that table. + name = error.name + expl = RUNTIME_CUDA_ERROR_EXPLANATIONS.get(int(error)) + if expl is not None: + raise CUDAError(f"{name}: {expl}") + desc_err, desc = runtime.cudaGetErrorString(error) + if desc_err != _RUNTIME_SUCCESS: + raise CUDAError(f"{name}") + desc = desc.decode() + raise CUDAError(f"{name}: {desc}") + + +cpdef inline int _check_nvrtc_error(error, handle=None) except?-1: + if error == _NVRTC_SUCCESS: + return 0 + err = f"{error}: {nvrtc.nvrtcGetErrorString(error)[1].decode()}" + if handle is not None: + _, logsize = nvrtc.nvrtcGetProgramLogSize(handle) + log = b" " * logsize + _ = nvrtc.nvrtcGetProgramLog(handle, log) + err += f", compilation log:\n\n{log.decode('utf-8', errors='backslashreplace')}" + raise NVRTCError(err) + + +cdef inline int _check_error(error, handle=None) except?-1: + if isinstance(error, driver.CUresult): + return _check_driver_error(error) + elif isinstance(error, runtime.cudaError_t): + return _check_runtime_error(error) + elif isinstance(error, nvrtc.nvrtcResult): + return _check_nvrtc_error(error, handle=handle) + else: + raise RuntimeError(f"Unknown error type: {error}") + + +def handle_return(result: tuple[Any, ...], handle: object = None) -> Any: + _check_error(result[0], handle=handle) + cdef int out_len = len(result) + if out_len == 1: + return + elif out_len == 2: + return result[1] + else: + return result[1:] + + +cpdef object check_or_create_options(type cls, object options, str options_description="", bint keep_none=False): + """ + Create the specified options dataclass from a dictionary of options or None. + """ + if options is None: + if keep_none: + return options + return cls() + elif isinstance(options, cls): + return options + elif isinstance(options, dict): + return cls(**options) + else: + raise TypeError( + f"The {options_description} must be provided as an object " + f"of type {cls.__name__} or as a dict with valid {options_description}. " + f"The provided object is '{options}'." + ) + + +def _handle_boolean_option(option: bool) -> str: + """ + Convert a boolean option to a string representation. + """ + return "true" if bool(option) else "false" + + +def precondition(checker: Callable[..., None], str what="") -> Callable[..., Any]: + """ + A decorator that adds checks to ensure any preconditions are met. + + Args: + checker: The function to call to check whether the preconditions are met. It has + the same signature as the wrapped function with the addition of the keyword argument `what`. + what: A string that is passed in to `checker` to provide context information. + + Returns: + Callable: A decorator that creates the wrapping. + """ + + def outer(wrapped_function: Callable) -> Callable: + """ + A decorator that actually wraps the function for checking preconditions. + """ + + @functools.wraps(wrapped_function) + def inner(*args, **kwargs) -> Any: + """ + Check preconditions and if they are met, call the wrapped function. + """ + checker(*args, **kwargs, what=what) + result = wrapped_function(*args, **kwargs) + + return result + + return inner + + return outer + + +def is_sequence(obj: object) -> bool: + """ + Check if the given object is a sequence (list or tuple). + """ + return isinstance(obj, Sequence) + + +def is_nested_sequence(obj: object) -> bool: + """ + Check if the given object is a nested sequence (list or tuple with atleast one list or tuple element). + """ + return is_sequence(obj) and any(is_sequence(elem) for elem in obj) + + + +class Transaction: + """ + A context manager for transactional operations with undo capability. + + The Transaction class allows you to register undo actions (callbacks) that will be executed + if the transaction is not committed before exiting the context. This is useful for managing + resources or operations that need to be rolled back in case of errors or early exits. + + Usage: + with Transaction() as txn: + txn.append(some_cleanup_function, arg1, arg2) + # ... perform operations ... + txn.commit() # Disarm undo actions; nothing will be rolled back on exit + + Methods: + append(fn, *args, **kwargs): Register an undo action to be called on rollback. + commit(): Disarm all undo actions; nothing will be rolled back on exit. + """ + def __init__(self) -> None: + self._stack = ExitStack() + self._entered = False + + def __enter__(self): + self._stack.__enter__() + self._entered = True + return self + + def __exit__(self, exc_type, exc, tb): + # If exit callbacks remain, they'll run in LIFO order. + self._entered = False + return self._stack.__exit__(exc_type, exc, tb) + + def append(self, fn: Callable[..., Any], /, *args: Any, **kwargs: Any) -> None: + """ + Register an undo action (runs if the with-block exits without commit()). + Values are bound now via partial so late mutations don't bite you. + """ + if not self._entered: + raise RuntimeError("Transaction must be entered before append()") + self._stack.callback(partial(fn, *args, **kwargs)) + + def commit(self) -> None: + """ + Disarm all undo actions. After this, exiting the with-block does nothing. + """ + # pop_all() empties this stack so no callbacks are triggered on exit. + self._stack.pop_all() + + +# Track whether we've already warned about fork method +_fork_warning_checked = False + + +def reset_fork_warning() -> None: + """Reset the fork warning check flag for testing purposes. + + This function is intended for use in tests to allow multiple test runs + to check the warning behavior. + """ + global _fork_warning_checked + _fork_warning_checked = False + + +cdef inline tuple _read_fill_ptr(const char* ptr, Py_ssize_t width): + """Extract (value, element_size) from a raw pointer of known width.""" + cdef unsigned int val + if width == 1: + val = (ptr)[0] + elif width == 2: + val = (ptr)[0] + elif width == 4: + val = (ptr)[0] + else: + raise ValueError(f"value must be 1, 2, or 4 bytes, got {width}") + return (val, width) + + +cpdef tuple _parse_fill_value(value): + """Parse a fill/memset value into (raw_value, element_size). + + Parameters + ---------- + value : int or buffer-protocol object + - int: Must be in range [0, 256). Treated as 1-byte fill. + - bytes or buffer-protocol: Must be 1, 2, or 4 bytes. + + Returns + ------- + tuple of (int, int) + (raw_value, element_size) where element_size is 1, 2, or 4. + + Raises + ------ + OverflowError + If int value is outside [0, 256). + TypeError + If value is not an int and does not support the buffer protocol. + ValueError + If value byte length is not 1, 2, or 4. + """ + cdef uint8_t byte_val + cdef Py_buffer buf + + if isinstance(value, int): + byte_val = value + return (byte_val, 1) + + if isinstance(value, bytes): + return _read_fill_ptr(value, len(value)) + + if PyObject_GetBuffer(value, &buf, PyBUF_SIMPLE) != 0: + raise TypeError( + f"value must be an int or support the buffer protocol, " + f"got {type(value).__name__}" + ) + try: + return _read_fill_ptr(buf.buf, buf.len) + finally: + PyBuffer_Release(&buf) + + +def check_multiprocessing_start_method() -> None: + """Check if multiprocessing start method is 'fork' and warn if so.""" + global _fork_warning_checked + if _fork_warning_checked: + return + _fork_warning_checked = True + + # Common warning message parts + common_message = ( + "CUDA does not support. Forked subprocesses exhibit undefined behavior, " + "including failure to initialize CUDA contexts and devices. Set the start method " + "to 'spawn' before creating processes that use CUDA. " + "Use: multiprocessing.set_start_method('spawn')" + ) + + try: + start_method = multiprocessing.get_start_method() + if start_method == "fork": + message = f"multiprocessing start method is 'fork', which {common_message}" + warnings.warn(message, UserWarning, stacklevel=3) + except RuntimeError: + # get_start_method() can raise RuntimeError if start method hasn't been set + # In this case, default is 'fork' on Linux, so we should warn + if platform.system() == "Linux": + message = ( + f"multiprocessing start method is not set and defaults to 'fork' on Linux, " + f"which {common_message}" + ) + warnings.warn(message, UserWarning, stacklevel=3) diff --git a/cuda_core/cuda/core/_utils/driver_cu_result_explanations.py b/cuda_core/cuda/core/_utils/driver_cu_result_explanations.py new file mode 100644 index 00000000000..d1e0a53bb00 --- /dev/null +++ b/cuda_core/cuda/core/_utils/driver_cu_result_explanations.py @@ -0,0 +1,16 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +from __future__ import annotations + +from cuda.bindings import driver +from cuda.core._utils.enum_explanations_helpers import get_best_available_explanations + + +def _load_fallback_explanations() -> dict[int, str | tuple[str, ...]]: + from cuda.core._utils.driver_cu_result_explanations_frozen import _FALLBACK_EXPLANATIONS + + return _FALLBACK_EXPLANATIONS # type: ignore[return-value] + + +DRIVER_CU_RESULT_EXPLANATIONS = get_best_available_explanations(driver.CUresult, _load_fallback_explanations) diff --git a/cuda_core/cuda/core/_utils/driver_cu_result_explanations_frozen.py b/cuda_core/cuda/core/_utils/driver_cu_result_explanations_frozen.py new file mode 100644 index 00000000000..567b9690380 --- /dev/null +++ b/cuda_core/cuda/core/_utils/driver_cu_result_explanations_frozen.py @@ -0,0 +1,350 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +# CUDA Toolkit v13.1.1 +_FALLBACK_EXPLANATIONS = { + 0: ( + "The API call returned with no errors. In the case of query calls, this" + " also means that the operation being queried is complete (see" + " ::cuEventQuery() and ::cuStreamQuery())." + ), + 1: ( + "This indicates that one or more of the parameters passed to the API call" + " is not within an acceptable range of values." + ), + 2: ( + "The API call failed because it was unable to allocate enough memory or" + " other resources to perform the requested operation." + ), + 3: ( + "This indicates that the CUDA driver has not been initialized with" + " ::cuInit() or that initialization has failed." + ), + 4: "This indicates that the CUDA driver is in the process of shutting down.", + 5: ( + "This indicates profiler is not initialized for this run. This can" + " happen when the application is running with external profiling tools" + " like visual profiler." + ), + 6: ( + "This error return is deprecated as of CUDA 5.0. It is no longer an error" + " to attempt to enable/disable the profiling via ::cuProfilerStart or" + " ::cuProfilerStop without initialization." + ), + 7: ( + "This error return is deprecated as of CUDA 5.0. It is no longer an error" + " to call cuProfilerStart() when profiling is already enabled." + ), + 8: ( + "This error return is deprecated as of CUDA 5.0. It is no longer an error" + " to call cuProfilerStop() when profiling is already disabled." + ), + 34: ( + "This indicates that the CUDA driver that the application has loaded is a" + " stub library. Applications that run with the stub rather than a real" + " driver loaded will result in CUDA API returning this error." + ), + 36: ( + "This indicates that the API call requires a newer CUDA driver than the one" + " currently installed. Users should install an updated NVIDIA CUDA driver" + " to allow the API call to succeed." + ), + 46: ( + "This indicates that requested CUDA device is unavailable at the current" + " time. Devices are often unavailable due to use of" + " ::CU_COMPUTEMODE_EXCLUSIVE_PROCESS or ::CU_COMPUTEMODE_PROHIBITED." + ), + 100: ("This indicates that no CUDA-capable devices were detected by the installed CUDA driver."), + 101: ( + "This indicates that the device ordinal supplied by the user does not" + " correspond to a valid CUDA device or that the action requested is" + " invalid for the specified device." + ), + 102: "This error indicates that the Grid license is not applied.", + 200: ("This indicates that the device kernel image is invalid. This can also indicate an invalid CUDA module."), + 201: ( + "This most frequently indicates that there is no context bound to the" + " current thread. This can also be returned if the context passed to an" + " API call is not a valid handle (such as a context that has had" + " ::cuCtxDestroy() invoked on it). This can also be returned if a user" + " mixes different API versions (i.e. 3010 context with 3020 API calls)." + " See ::cuCtxGetApiVersion() for more details." + " This can also be returned if the green context passed to an API call" + " was not converted to a ::CUcontext using ::cuCtxFromGreenCtx API." + ), + 202: ( + "This indicated that the context being supplied as a parameter to the" + " API call was already the active context." + " This error return is deprecated as of CUDA 3.2. It is no longer an" + " error to attempt to push the active context via ::cuCtxPushCurrent()." + ), + 205: "This indicates that a map or register operation has failed.", + 206: "This indicates that an unmap or unregister operation has failed.", + 207: ("This indicates that the specified array is currently mapped and thus cannot be destroyed."), + 208: "This indicates that the resource is already mapped.", + 209: ( + "This indicates that there is no kernel image available that is suitable" + " for the device. This can occur when a user specifies code generation" + " options for a particular CUDA source file that do not include the" + " corresponding device configuration." + ), + 210: "This indicates that a resource has already been acquired.", + 211: "This indicates that a resource is not mapped.", + 212: ("This indicates that a mapped resource is not available for access as an array."), + 213: ("This indicates that a mapped resource is not available for access as a pointer."), + 214: ("This indicates that an uncorrectable ECC error was detected during execution."), + 215: ("This indicates that the ::CUlimit passed to the API call is not supported by the active device."), + 216: ( + "This indicates that the ::CUcontext passed to the API call can" + " only be bound to a single CPU thread at a time but is already" + " bound to a CPU thread." + ), + 217: ("This indicates that peer access is not supported across the given devices."), + 218: "This indicates that a PTX JIT compilation failed.", + 219: "This indicates an error with OpenGL or DirectX context.", + 220: ("This indicates that an uncorrectable NVLink error was detected during the execution."), + 221: "This indicates that the PTX JIT compiler library was not found.", + 222: "This indicates that the provided PTX was compiled with an unsupported toolchain.", + 223: "This indicates that the PTX JIT compilation was disabled.", + 224: ("This indicates that the ::CUexecAffinityType passed to the API call is not supported by the active device."), + 225: ( + "This indicates that the code to be compiled by the PTX JIT contains unsupported call to cudaDeviceSynchronize." + ), + 226: ( + "This indicates that an exception occurred on the device that is now" + " contained by the GPU's error containment capability. Common causes are -" + " a. Certain types of invalid accesses of peer GPU memory over nvlink" + " b. Certain classes of hardware errors" + " This leaves the process in an inconsistent state and any further CUDA" + " work will return the same error. To continue using CUDA, the process must" + " be terminated and relaunched." + ), + 300: ( + "This indicates that the device kernel source is invalid. This includes" + " compilation/linker errors encountered in device code or user error." + ), + 301: "This indicates that the file specified was not found.", + 302: "This indicates that a link to a shared object failed to resolve.", + 303: "This indicates that initialization of a shared object failed.", + 304: "This indicates that an OS call failed.", + 400: ( + "This indicates that a resource handle passed to the API call was not" + " valid. Resource handles are opaque types like ::CUstream and ::CUevent." + ), + 401: ( + "This indicates that a resource required by the API call is not in a" + " valid state to perform the requested operation." + ), + 402: ( + "This indicates an attempt was made to introspect an object in a way that" + " would discard semantically important information. This is either due to" + " the object using funtionality newer than the API version used to" + " introspect it or omission of optional return arguments." + ), + 500: ( + "This indicates that a named symbol was not found. Examples of symbols" + " are global/constant variable names, driver function names, texture names," + " and surface names." + ), + 600: ( + "This indicates that asynchronous operations issued previously have not" + " completed yet. This result is not actually an error, but must be indicated" + " differently than ::CUDA_SUCCESS (which indicates completion). Calls that" + " may return this value include ::cuEventQuery() and ::cuStreamQuery()." + ), + 700: ( + "While executing a kernel, the device encountered a" + " load or store instruction on an invalid memory address." + " This leaves the process in an inconsistent state and any further CUDA work" + " will return the same error. To continue using CUDA, the process must be terminated" + " and relaunched." + ), + 701: ( + "This indicates that a launch did not occur because it did not have" + " appropriate resources. This error usually indicates that the user has" + " attempted to pass too many arguments to the device kernel, or the" + " kernel launch specifies too many threads for the kernel's register" + " count. Passing arguments of the wrong size (i.e. a 64-bit pointer" + " when a 32-bit int is expected) is equivalent to passing too many" + " arguments and can also result in this error." + ), + 702: ( + "This indicates that the device kernel took too long to execute. This can" + " only occur if timeouts are enabled - see the device attribute" + " ::CU_DEVICE_ATTRIBUTE_KERNEL_EXEC_TIMEOUT for more information." + " This leaves the process in an inconsistent state and any further CUDA work" + " will return the same error. To continue using CUDA, the process must be terminated" + " and relaunched." + ), + 703: ("This error indicates a kernel launch that uses an incompatible texturing mode."), + 704: ( + "This error indicates that a call to ::cuCtxEnablePeerAccess() is" + " trying to re-enable peer access to a context which has already" + " had peer access to it enabled." + ), + 705: ( + "This error indicates that ::cuCtxDisablePeerAccess() is" + " trying to disable peer access which has not been enabled yet" + " via ::cuCtxEnablePeerAccess()." + ), + 708: ("This error indicates that the primary context for the specified device has already been initialized."), + 709: ( + "This error indicates that the context current to the calling thread" + " has been destroyed using ::cuCtxDestroy, or is a primary context which" + " has not yet been initialized." + ), + 710: ( + "A device-side assert triggered during kernel execution. The context" + " cannot be used anymore, and must be destroyed. All existing device" + " memory allocations from this context are invalid and must be" + " reconstructed if the program is to continue using CUDA." + ), + 711: ( + "This error indicates that the hardware resources required to enable" + " peer access have been exhausted for one or more of the devices" + " passed to ::cuCtxEnablePeerAccess()." + ), + 712: ("This error indicates that the memory range passed to ::cuMemHostRegister() has already been registered."), + 713: ( + "This error indicates that the pointer passed to ::cuMemHostUnregister()" + " does not correspond to any currently registered memory region." + ), + 714: ( + "While executing a kernel, the device encountered a stack error." + " This can be due to stack corruption or exceeding the stack size limit." + " This leaves the process in an inconsistent state and any further CUDA work" + " will return the same error. To continue using CUDA, the process must be terminated" + " and relaunched." + ), + 715: ( + "While executing a kernel, the device encountered an illegal instruction." + " This leaves the process in an inconsistent state and any further CUDA work" + " will return the same error. To continue using CUDA, the process must be terminated" + " and relaunched." + ), + 716: ( + "While executing a kernel, the device encountered a load or store instruction" + " on a memory address which is not aligned." + " This leaves the process in an inconsistent state and any further CUDA work" + " will return the same error. To continue using CUDA, the process must be terminated" + " and relaunched." + ), + 717: ( + "While executing a kernel, the device encountered an instruction" + " which can only operate on memory locations in certain address spaces" + " (global, shared, or local), but was supplied a memory address not" + " belonging to an allowed address space." + " This leaves the process in an inconsistent state and any further CUDA work" + " will return the same error. To continue using CUDA, the process must be terminated" + " and relaunched." + ), + 718: ( + "While executing a kernel, the device program counter wrapped its address space." + " This leaves the process in an inconsistent state and any further CUDA work" + " will return the same error. To continue using CUDA, the process must be terminated" + " and relaunched." + ), + 719: ( + "An exception occurred on the device while executing a kernel. Common" + " causes include dereferencing an invalid device pointer and accessing" + " out of bounds shared memory. Less common cases can be system specific - more" + " information about these cases can be found in the system specific user guide." + " This leaves the process in an inconsistent state and any further CUDA work" + " will return the same error. To continue using CUDA, the process must be terminated" + " and relaunched." + ), + 720: ( + "This error indicates that the number of blocks launched per grid for a kernel that was" + " launched via either ::cuLaunchCooperativeKernel or ::cuLaunchCooperativeKernelMultiDevice" + " exceeds the maximum number of blocks as allowed by ::cuOccupancyMaxActiveBlocksPerMultiprocessor" + " or ::cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags times the number of multiprocessors" + " as specified by the device attribute ::CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT." + ), + 721: ( + "An exception occurred on the device while exiting a kernel using tensor memory: the" + " tensor memory was not completely deallocated. This leaves the process in an inconsistent" + " state and any further CUDA work will return the same error. To continue using CUDA, the" + " process must be terminated and relaunched." + ), + 800: "This error indicates that the attempted operation is not permitted.", + 801: ("This error indicates that the attempted operation is not supported on the current system or device."), + 802: ( + "This error indicates that the system is not yet ready to start any CUDA" + " work. To continue using CUDA, verify the system configuration is in a" + " valid state and all required driver daemons are actively running." + " More information about this error can be found in the system specific" + " user guide." + ), + 803: ( + "This error indicates that there is a mismatch between the versions of" + " the display driver and the CUDA driver. Refer to the compatibility documentation" + " for supported versions." + ), + 804: ( + "This error indicates that the system was upgraded to run with forward compatibility" + " but the visible hardware detected by CUDA does not support this configuration." + " Refer to the compatibility documentation for the supported hardware matrix or ensure" + " that only supported hardware is visible during initialization via the CUDA_VISIBLE_DEVICES" + " environment variable." + ), + 805: "This error indicates that the MPS client failed to connect to the MPS control daemon or the MPS server.", + 806: "This error indicates that the remote procedural call between the MPS server and the MPS client failed.", + 807: ( + "This error indicates that the MPS server is not ready to accept new MPS client requests." + " This error can be returned when the MPS server is in the process of recovering from a fatal failure." + ), + 808: "This error indicates that the hardware resources required to create MPS client have been exhausted.", + 809: "This error indicates the the hardware resources required to support device connections have been exhausted.", + 810: "This error indicates that the MPS client has been terminated by the server. To continue using CUDA, the process must be terminated and relaunched.", + 811: "This error indicates that the module is using CUDA Dynamic Parallelism, but the current configuration, like MPS, does not support it.", + 812: "This error indicates that a module contains an unsupported interaction between different versions of CUDA Dynamic Parallelism.", + 900: ("This error indicates that the operation is not permitted when the stream is capturing."), + 901: ( + "This error indicates that the current capture sequence on the stream" + " has been invalidated due to a previous error." + ), + 902: ( + "This error indicates that the operation would have resulted in a merge of two independent capture sequences." + ), + 903: "This error indicates that the capture was not initiated in this stream.", + 904: ("This error indicates that the capture sequence contains a fork that was not joined to the primary stream."), + 905: ( + "This error indicates that a dependency would have been created which" + " crosses the capture sequence boundary. Only implicit in-stream ordering" + " dependencies are allowed to cross the boundary." + ), + 906: ("This error indicates a disallowed implicit dependency on a current capture sequence from cudaStreamLegacy."), + 907: ( + "This error indicates that the operation is not permitted on an event which" + " was last recorded in a capturing stream." + ), + 908: ( + "A stream capture sequence not initiated with the ::CU_STREAM_CAPTURE_MODE_RELAXED" + " argument to ::cuStreamBeginCapture was passed to ::cuStreamEndCapture in a" + " different thread." + ), + 909: "This error indicates that the timeout specified for the wait operation has lapsed.", + 910: ( + "This error indicates that the graph update was not performed because it included" + " changes which violated constraints specific to instantiated graph update." + ), + 911: ( + "This indicates that an async error has occurred in a device outside of CUDA." + " If CUDA was waiting for an external device's signal before consuming shared data," + " the external device signaled an error indicating that the data is not valid for" + " consumption. This leaves the process in an inconsistent state and any further CUDA" + " work will return the same error. To continue using CUDA, the process must be" + " terminated and relaunched." + ), + 912: "Indicates a kernel launch error due to cluster misconfiguration.", + 913: ("Indiciates a function handle is not loaded when calling an API that requires a loaded function."), + 914: ("This error indicates one or more resources passed in are not valid resource types for the operation."), + 915: ("This error indicates one or more resources are insufficient or non-applicable for the operation."), + 916: ("This error indicates that an error happened during the key rotation sequence."), + 917: ( + "This error indicates that the requested operation is not permitted because the" + " stream is in a detached state. This can occur if the green context associated" + " with the stream has been destroyed, limiting the stream's operational capabilities." + ), + 999: "This indicates that an unknown internal error has occurred.", +} diff --git a/cuda_core/cuda/core/_utils/enum_explanations_helpers.py b/cuda_core/cuda/core/_utils/enum_explanations_helpers.py new file mode 100644 index 00000000000..0dbe6d6bb60 --- /dev/null +++ b/cuda_core/cuda/core/_utils/enum_explanations_helpers.py @@ -0,0 +1,133 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +"""Internal support for error-enum explanations. + +``cuda_core`` keeps frozen 13.1.1 fallback tables for older ``cuda-bindings`` +releases. Driver/runtime error enums carry usable ``__doc__`` text starting in +the 12.x backport line at ``cuda-bindings`` 12.9.6, and in the mainline 13.x +series at ``cuda-bindings`` 13.2.0. This module decides which source to use +and normalizes generated docstrings so user-facing ``CUDAError`` messages stay +presentable. + +The cleanup rules here were derived while validating generated enum docstrings +in PR #1805. Keep them narrow and remove them when codegen quirks or fallback +support are no longer needed. +""" + +from __future__ import annotations + +import importlib.metadata +import re +from collections.abc import Callable +from typing import Any + +_MIN_12X_BINDING_VERSION_FOR_ENUM_DOCSTRINGS = (12, 9, 6) +_MIN_13X_BINDING_VERSION_FOR_ENUM_DOCSTRINGS = (13, 2, 0) +_RST_INLINE_ROLE_RE = re.compile(r":(?:[a-z]+:)?[a-z]+:`([^`]+)`") +_WORDWRAP_HYPHEN_AFTER_RE = re.compile(r"(?<=[0-9A-Za-z_])- (?=[0-9A-Za-z_])") +_WORDWRAP_HYPHEN_BEFORE_RE = re.compile(r"(?<=[0-9A-Za-z_]) -(?=[0-9A-Za-z_])") +_ExplanationTable = dict[int, str | tuple[str, ...]] +_ExplanationTableLoader = Callable[[], _ExplanationTable] + + +# ``version.pyx`` cannot be reused here (circular import via ``cuda_utils``). +def _binding_version() -> tuple[int, int, int]: + """Return the installed ``cuda-bindings`` version, or a conservative old value.""" + try: + version = importlib.metadata.version("cuda-bindings") + except importlib.metadata.PackageNotFoundError: + return (0, 0, 0) # For very old versions of cuda-python + + parts = version.partition("+")[0].split(".")[:3] + parts_int = ([int(v) for v in parts] + [0, 0, 0])[:3] + return (parts_int[0], parts_int[1], parts_int[2]) + + +def _binding_version_has_usable_enum_docstrings(version: tuple[int, int, int]) -> bool: + """Whether released bindings are known to carry usable error-enum ``__doc__`` text.""" + return ( + _MIN_12X_BINDING_VERSION_FOR_ENUM_DOCSTRINGS <= version < (13, 0, 0) + or version >= _MIN_13X_BINDING_VERSION_FOR_ENUM_DOCSTRINGS + ) + + +def _fix_hyphenation_wordwrap_spacing(s: str) -> str: + """Remove spaces around hyphens introduced by line wrapping in generated ``__doc__`` text. + + This targets asymmetric wrap artifacts such as ``non- linear`` or + ``GPU- Direct`` while leaving intentional ``a - b`` separators alone. + """ + prev = None + while prev != s: + prev = s + s = _WORDWRAP_HYPHEN_AFTER_RE.sub("-", s) + s = _WORDWRAP_HYPHEN_BEFORE_RE.sub("-", s) + return s + + +def clean_enum_member_docstring(doc: str | None) -> str | None: + """Turn an enum member ``__doc__`` into plain text. + + The generated enum docstrings are already close to user-facing prose, but + they may contain Sphinx inline roles, line wrapping, or a small known + codegen defect. Normalize only those differences so the text is suitable + for error messages. + """ + if doc is None: + return None + s = doc + # Known codegen bug on cudaErrorIncompatibleDriverContext. Remove once fixed + # in cuda-bindings code generation. + s = s.replace("\n:py:obj:`~.Interactions`", ' "Interactions ') + # Drop a leading "~." or "." after removing the surrounding RST inline role. + s = _RST_INLINE_ROLE_RE.sub(lambda m: re.sub(r"^~?\.", "", m.group(1)), s) + # Strip simple bold emphasis markers. + s = re.sub(r"\*\*([^*]+)\*\*", r"\1", s) + # Strip simple italic emphasis markers. + s = re.sub(r"\*([^*]+)\*", r"\1", s) + # Collapse wrapped lines and repeated spaces. + s = re.sub(r"\s+", " ", s).strip() + s = _fix_hyphenation_wordwrap_spacing(s) + return s + + +class DocstringBackedExplanations: + """Compatibility shim exposing enum-member ``__doc__`` text via ``dict.get``. + + Keeps the existing ``.get(int(error))`` lookup shape used by ``cuda_utils.pyx``. + """ + + __slots__ = ("_enum_type",) + + def __init__(self, enum_type: Any) -> None: + self._enum_type = enum_type + + def get(self, code: int, default: str | None = None) -> str | None: + try: + member = self._enum_type(code) + except ValueError: + return default + + raw_doc = member.__doc__ + if raw_doc is None: + return default + + return clean_enum_member_docstring(raw_doc) + + +def get_best_available_explanations( + enum_type: Any, + fallback: _ExplanationTable | _ExplanationTableLoader, +) -> DocstringBackedExplanations | _ExplanationTable: + """Pick one explanation source per bindings version. + + Use enum-member ``__doc__`` only for bindings versions known to expose + usable per-member text (12.9.6+ in the 12.x backport line, 13.2.0+ in the + 13.x mainline). Otherwise keep using the frozen 13.1.1 fallback tables. + """ + if not _binding_version_has_usable_enum_docstrings(_binding_version()): + if callable(fallback): + return fallback() + return fallback + return DocstringBackedExplanations(enum_type) diff --git a/cuda_core/cuda/core/_utils/pycompat.py b/cuda_core/cuda/core/_utils/pycompat.py new file mode 100644 index 00000000000..5e685ed2db4 --- /dev/null +++ b/cuda_core/cuda/core/_utils/pycompat.py @@ -0,0 +1,23 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +""" +Compatibility shims for differences between supported Python versions. +""" + +import sys + +__all__ = ["BufferProtocol", "StrEnum"] + + +if sys.version_info >= (3, 11): + from enum import StrEnum +else: + from backports.strenum import StrEnum + + +if sys.version_info >= (3, 12): + from collections.abc import Buffer as BufferProtocol +else: + BufferProtocol = object diff --git a/cuda_core/cuda/core/_utils/runtime_cuda_error_explanations.py b/cuda_core/cuda/core/_utils/runtime_cuda_error_explanations.py new file mode 100644 index 00000000000..12a49d2ec96 --- /dev/null +++ b/cuda_core/cuda/core/_utils/runtime_cuda_error_explanations.py @@ -0,0 +1,16 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +from __future__ import annotations + +from cuda.bindings import runtime +from cuda.core._utils.enum_explanations_helpers import get_best_available_explanations + + +def _load_fallback_explanations() -> dict[int, str | tuple[str, ...]]: + from cuda.core._utils.runtime_cuda_error_explanations_frozen import _FALLBACK_EXPLANATIONS + + return _FALLBACK_EXPLANATIONS # type: ignore[return-value] + + +RUNTIME_CUDA_ERROR_EXPLANATIONS = get_best_available_explanations(runtime.cudaError_t, _load_fallback_explanations) diff --git a/cuda_core/cuda/core/_utils/runtime_cuda_error_explanations_frozen.py b/cuda_core/cuda/core/_utils/runtime_cuda_error_explanations_frozen.py new file mode 100644 index 00000000000..017c4087400 --- /dev/null +++ b/cuda_core/cuda/core/_utils/runtime_cuda_error_explanations_frozen.py @@ -0,0 +1,538 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +# CUDA Toolkit v13.1.1 +_FALLBACK_EXPLANATIONS = { + 0: ( + "The API call returned with no errors. In the case of query calls, this" + " also means that the operation being queried is complete (see" + " ::cudaEventQuery() and ::cudaStreamQuery())." + ), + 1: ( + "This indicates that one or more of the parameters passed to the API call" + " is not within an acceptable range of values." + ), + 2: ( + "The API call failed because it was unable to allocate enough memory or" + " other resources to perform the requested operation." + ), + 3: ("The API call failed because the CUDA driver and runtime could not be initialized."), + 4: ( + "This indicates that a CUDA Runtime API call cannot be executed because" + " it is being called during process shut down, at a point in time after" + " CUDA driver has been unloaded." + ), + 5: ( + "This indicates profiler is not initialized for this run. This can" + " happen when the application is running with external profiling tools" + " like visual profiler." + ), + 6: ( + "This error return is deprecated as of CUDA 5.0. It is no longer an error" + " to attempt to enable/disable the profiling via ::cudaProfilerStart or" + " ::cudaProfilerStop without initialization." + ), + 7: ( + "This error return is deprecated as of CUDA 5.0. It is no longer an error" + " to call cudaProfilerStart() when profiling is already enabled." + ), + 8: ( + "This error return is deprecated as of CUDA 5.0. It is no longer an error" + " to call cudaProfilerStop() when profiling is already disabled." + ), + 9: ( + "This indicates that a kernel launch is requesting resources that can" + " never be satisfied by the current device. Requesting more shared memory" + " per block than the device supports will trigger this error, as will" + " requesting too many threads or blocks. See ::cudaDeviceProp for more" + " device limitations." + ), + 12: ( + "This indicates that one or more of the pitch-related parameters passed" + " to the API call is not within the acceptable range for pitch." + ), + 13: ("This indicates that the symbol name/identifier passed to the API call is not a valid name or identifier."), + 16: ( + "This indicates that at least one host pointer passed to the API call is" + " not a valid host pointer." + " This error return is deprecated as of CUDA 10.1." + ), + 17: ( + "This indicates that at least one device pointer passed to the API call is" + " not a valid device pointer." + " This error return is deprecated as of CUDA 10.1." + ), + 18: ("This indicates that the texture passed to the API call is not a valid texture."), + 19: ( + "This indicates that the texture binding is not valid. This occurs if you" + " call ::cudaGetTextureAlignmentOffset() with an unbound texture." + ), + 20: ( + "This indicates that the channel descriptor passed to the API call is not" + " valid. This occurs if the format is not one of the formats specified by" + " ::cudaChannelFormatKind, or if one of the dimensions is invalid." + ), + 21: ( + "This indicates that the direction of the memcpy passed to the API call is" + " not one of the types specified by ::cudaMemcpyKind." + ), + 22: ( + "This indicated that the user has taken the address of a constant variable," + " which was forbidden up until the CUDA 3.1 release." + " This error return is deprecated as of CUDA 3.1. Variables in constant" + " memory may now have their address taken by the runtime via" + " ::cudaGetSymbolAddress()." + ), + 23: ( + "This indicated that a texture fetch was not able to be performed." + " This was previously used for device emulation of texture operations." + " This error return is deprecated as of CUDA 3.1. Device emulation mode was" + " removed with the CUDA 3.1 release." + ), + 24: ( + "This indicated that a texture was not bound for access." + " This was previously used for device emulation of texture operations." + " This error return is deprecated as of CUDA 3.1. Device emulation mode was" + " removed with the CUDA 3.1 release." + ), + 25: ( + "This indicated that a synchronization operation had failed." + " This was previously used for some device emulation functions." + " This error return is deprecated as of CUDA 3.1. Device emulation mode was" + " removed with the CUDA 3.1 release." + ), + 26: ( + "This indicates that a non-float texture was being accessed with linear" + " filtering. This is not supported by CUDA." + ), + 27: ( + "This indicates that an attempt was made to read an unsupported data type as a" + " normalized float. This is not supported by CUDA." + ), + 28: ( + "Mixing of device and device emulation code was not allowed." + " This error return is deprecated as of CUDA 3.1. Device emulation mode was" + " removed with the CUDA 3.1 release." + ), + 31: ( + "This indicates that the API call is not yet implemented. Production" + " releases of CUDA will never return this error." + " This error return is deprecated as of CUDA 4.1." + ), + 32: ( + "This indicated that an emulated device pointer exceeded the 32-bit address" + " range." + " This error return is deprecated as of CUDA 3.1. Device emulation mode was" + " removed with the CUDA 3.1 release." + ), + 34: ( + "This indicates that the CUDA driver that the application has loaded is a" + " stub library. Applications that run with the stub rather than a real" + " driver loaded will result in CUDA API returning this error." + ), + 35: ( + "This indicates that the installed NVIDIA CUDA driver is older than the" + " CUDA runtime library. This is not a supported configuration. Users should" + " install an updated NVIDIA display driver to allow the application to run." + ), + 36: ( + "This indicates that the API call requires a newer CUDA driver than the one" + " currently installed. Users should install an updated NVIDIA CUDA driver" + " to allow the API call to succeed." + ), + 37: ("This indicates that the surface passed to the API call is not a valid surface."), + 43: ( + "This indicates that multiple global or constant variables (across separate" + " CUDA source files in the application) share the same string name." + ), + 44: ( + "This indicates that multiple textures (across separate CUDA source" + " files in the application) share the same string name." + ), + 45: ( + "This indicates that multiple surfaces (across separate CUDA source" + " files in the application) share the same string name." + ), + 46: ( + "This indicates that all CUDA devices are busy or unavailable at the current" + " time. Devices are often busy/unavailable due to use of" + " ::cudaComputeModeProhibited, ::cudaComputeModeExclusiveProcess, or when long" + " running CUDA kernels have filled up the GPU and are blocking new work" + " from starting. They can also be unavailable due to memory constraints" + " on a device that already has active CUDA work being performed." + ), + 49: ( + "This indicates that the current context is not compatible with this" + " the CUDA Runtime. This can only occur if you are using CUDA" + " Runtime/Driver interoperability and have created an existing Driver" + " context using the driver API. The Driver context may be incompatible" + " either because the Driver context was created using an older version" + " of the API, because the Runtime API call expects a primary driver" + " context and the Driver context is not primary, or because the Driver" + ' context has been destroyed. Please see CUDART_DRIVER "Interactions' + ' with the CUDA Driver API" for more information.' + ), + 52: ( + "The device function being invoked (usually via ::cudaLaunchKernel()) was not" + " previously configured via the ::cudaConfigureCall() function." + ), + 53: ( + "This indicated that a previous kernel launch failed. This was previously" + " used for device emulation of kernel launches." + " This error return is deprecated as of CUDA 3.1. Device emulation mode was" + " removed with the CUDA 3.1 release." + ), + 65: ( + "This error indicates that a device runtime grid launch did not occur" + " because the depth of the child grid would exceed the maximum supported" + " number of nested grid launches." + ), + 66: ( + "This error indicates that a grid launch did not occur because the kernel" + " uses file-scoped textures which are unsupported by the device runtime." + " Kernels launched via the device runtime only support textures created with" + " the Texture Object API's." + ), + 67: ( + "This error indicates that a grid launch did not occur because the kernel" + " uses file-scoped surfaces which are unsupported by the device runtime." + " Kernels launched via the device runtime only support surfaces created with" + " the Surface Object API's." + ), + 68: ( + "This error indicates that a call to ::cudaDeviceSynchronize made from" + " the device runtime failed because the call was made at grid depth greater" + " than than either the default (2 levels of grids) or user specified device" + " limit ::cudaLimitDevRuntimeSyncDepth. To be able to synchronize on" + " launched grids at a greater depth successfully, the maximum nested" + " depth at which ::cudaDeviceSynchronize will be called must be specified" + " with the ::cudaLimitDevRuntimeSyncDepth limit to the ::cudaDeviceSetLimit" + " api before the host-side launch of a kernel using the device runtime." + " Keep in mind that additional levels of sync depth require the runtime" + " to reserve large amounts of device memory that cannot be used for" + " user allocations. Note that ::cudaDeviceSynchronize made from device" + " runtime is only supported on devices of compute capability < 9.0." + ), + 69: ( + "This error indicates that a device runtime grid launch failed because" + " the launch would exceed the limit ::cudaLimitDevRuntimePendingLaunchCount." + " For this launch to proceed successfully, ::cudaDeviceSetLimit must be" + " called to set the ::cudaLimitDevRuntimePendingLaunchCount to be higher" + " than the upper bound of outstanding launches that can be issued to the" + " device runtime. Keep in mind that raising the limit of pending device" + " runtime launches will require the runtime to reserve device memory that" + " cannot be used for user allocations." + ), + 98: ("The requested device function does not exist or is not compiled for the proper device architecture."), + 100: ("This indicates that no CUDA-capable devices were detected by the installed CUDA driver."), + 101: ( + "This indicates that the device ordinal supplied by the user does not" + " correspond to a valid CUDA device or that the action requested is" + " invalid for the specified device." + ), + 102: "This indicates that the device doesn't have a valid Grid License.", + 103: ( + "By default, the CUDA runtime may perform a minimal set of self-tests," + " as well as CUDA driver tests, to establish the validity of both." + " Introduced in CUDA 11.2, this error return indicates that at least one" + " of these tests has failed and the validity of either the runtime" + " or the driver could not be established." + ), + 127: "This indicates an internal startup failure in the CUDA runtime.", + 200: "This indicates that the device kernel image is invalid.", + 201: ( + "This most frequently indicates that there is no context bound to the" + " current thread. This can also be returned if the context passed to an" + " API call is not a valid handle (such as a context that has had" + " ::cuCtxDestroy() invoked on it). This can also be returned if a user" + " mixes different API versions (i.e. 3010 context with 3020 API calls)." + " See ::cuCtxGetApiVersion() for more details." + ), + 205: "This indicates that the buffer object could not be mapped.", + 206: "This indicates that the buffer object could not be unmapped.", + 207: ("This indicates that the specified array is currently mapped and thus cannot be destroyed."), + 208: "This indicates that the resource is already mapped.", + 209: ( + "This indicates that there is no kernel image available that is suitable" + " for the device. This can occur when a user specifies code generation" + " options for a particular CUDA source file that do not include the" + " corresponding device configuration." + ), + 210: "This indicates that a resource has already been acquired.", + 211: "This indicates that a resource is not mapped.", + 212: ("This indicates that a mapped resource is not available for access as an array."), + 213: ("This indicates that a mapped resource is not available for access as a pointer."), + 214: ("This indicates that an uncorrectable ECC error was detected during execution."), + 215: ("This indicates that the ::cudaLimit passed to the API call is not supported by the active device."), + 216: ( + "This indicates that a call tried to access an exclusive-thread device that" + " is already in use by a different thread." + ), + 217: ("This error indicates that P2P access is not supported across the given devices."), + 218: ( + "A PTX compilation failed. The runtime may fall back to compiling PTX if" + " an application does not contain a suitable binary for the current device." + ), + 219: "This indicates an error with the OpenGL or DirectX context.", + 220: ("This indicates that an uncorrectable NVLink error was detected during the execution."), + 221: ( + "This indicates that the PTX JIT compiler library was not found. The JIT Compiler" + " library is used for PTX compilation. The runtime may fall back to compiling PTX" + " if an application does not contain a suitable binary for the current device." + ), + 222: ( + "This indicates that the provided PTX was compiled with an unsupported toolchain." + " The most common reason for this, is the PTX was generated by a compiler newer" + " than what is supported by the CUDA driver and PTX JIT compiler." + ), + 223: ( + "This indicates that the JIT compilation was disabled. The JIT compilation compiles" + " PTX. The runtime may fall back to compiling PTX if an application does not contain" + " a suitable binary for the current device." + ), + 224: "This indicates that the provided execution affinity is not supported by the device.", + 225: ( + "This indicates that the code to be compiled by the PTX JIT contains unsupported call to cudaDeviceSynchronize." + ), + 226: ( + "This indicates that an exception occurred on the device that is now" + " contained by the GPU's error containment capability. Common causes are -" + " a. Certain types of invalid accesses of peer GPU memory over nvlink" + " b. Certain classes of hardware errors" + " This leaves the process in an inconsistent state and any further CUDA" + " work will return the same error. To continue using CUDA, the process must" + " be terminated and relaunched." + ), + 300: "This indicates that the device kernel source is invalid.", + 301: "This indicates that the file specified was not found.", + 302: "This indicates that a link to a shared object failed to resolve.", + 303: "This indicates that initialization of a shared object failed.", + 304: "This error indicates that an OS call failed.", + 400: ( + "This indicates that a resource handle passed to the API call was not" + " valid. Resource handles are opaque types like ::cudaStream_t and" + " ::cudaEvent_t." + ), + 401: ( + "This indicates that a resource required by the API call is not in a" + " valid state to perform the requested operation." + ), + 402: ( + "This indicates an attempt was made to introspect an object in a way that" + " would discard semantically important information. This is either due to" + " the object using funtionality newer than the API version used to" + " introspect it or omission of optional return arguments." + ), + 500: ( + "This indicates that a named symbol was not found. Examples of symbols" + " are global/constant variable names, driver function names, texture names," + " and surface names." + ), + 600: ( + "This indicates that asynchronous operations issued previously have not" + " completed yet. This result is not actually an error, but must be indicated" + " differently than ::cudaSuccess (which indicates completion). Calls that" + " may return this value include ::cudaEventQuery() and ::cudaStreamQuery()." + ), + 700: ( + "The device encountered a load or store instruction on an invalid memory address." + " This leaves the process in an inconsistent state and any further CUDA work" + " will return the same error. To continue using CUDA, the process must be terminated" + " and relaunched." + ), + 701: ( + "This indicates that a launch did not occur because it did not have" + " appropriate resources. Although this error is similar to" + " ::cudaErrorInvalidConfiguration, this error usually indicates that the" + " user has attempted to pass too many arguments to the device kernel, or the" + " kernel launch specifies too many threads for the kernel's register count." + ), + 702: ( + "This indicates that the device kernel took too long to execute. This can" + " only occur if timeouts are enabled - see the device attribute" + ' ::cudaDeviceAttr::cudaDevAttrKernelExecTimeout "cudaDevAttrKernelExecTimeout"' + " for more information." + " This leaves the process in an inconsistent state and any further CUDA work" + " will return the same error. To continue using CUDA, the process must be terminated" + " and relaunched." + ), + 703: ("This error indicates a kernel launch that uses an incompatible texturing mode."), + 704: ( + "This error indicates that a call to ::cudaDeviceEnablePeerAccess() is" + " trying to re-enable peer addressing on from a context which has already" + " had peer addressing enabled." + ), + 705: ( + "This error indicates that ::cudaDeviceDisablePeerAccess() is trying to" + " disable peer addressing which has not been enabled yet via" + " ::cudaDeviceEnablePeerAccess()." + ), + 708: ( + "This indicates that the user has called ::cudaSetValidDevices()," + " ::cudaSetDeviceFlags(), ::cudaD3D9SetDirect3DDevice()," + " ::cudaD3D10SetDirect3DDevice, ::cudaD3D11SetDirect3DDevice(), or" + " ::cudaVDPAUSetVDPAUDevice() after initializing the CUDA runtime by" + " calling non-device management operations (allocating memory and" + " launching kernels are examples of non-device management operations)." + " This error can also be returned if using runtime/driver" + " interoperability and there is an existing ::CUcontext active on the" + " host thread." + ), + 709: ( + "This error indicates that the context current to the calling thread" + " has been destroyed using ::cuCtxDestroy, or is a primary context which" + " has not yet been initialized." + ), + 710: ( + "An assert triggered in device code during kernel execution. The device" + " cannot be used again. All existing allocations are invalid. To continue" + " using CUDA, the process must be terminated and relaunched." + ), + 711: ( + "This error indicates that the hardware resources required to enable" + " peer access have been exhausted for one or more of the devices" + " passed to ::cudaEnablePeerAccess()." + ), + 712: ("This error indicates that the memory range passed to ::cudaHostRegister() has already been registered."), + 713: ( + "This error indicates that the pointer passed to ::cudaHostUnregister()" + " does not correspond to any currently registered memory region." + ), + 714: ( + "Device encountered an error in the call stack during kernel execution," + " possibly due to stack corruption or exceeding the stack size limit." + " This leaves the process in an inconsistent state and any further CUDA work" + " will return the same error. To continue using CUDA, the process must be terminated" + " and relaunched." + ), + 715: ( + "The device encountered an illegal instruction during kernel execution" + " This leaves the process in an inconsistent state and any further CUDA work" + " will return the same error. To continue using CUDA, the process must be terminated" + " and relaunched." + ), + 716: ( + "The device encountered a load or store instruction" + " on a memory address which is not aligned." + " This leaves the process in an inconsistent state and any further CUDA work" + " will return the same error. To continue using CUDA, the process must be terminated" + " and relaunched." + ), + 717: ( + "While executing a kernel, the device encountered an instruction" + " which can only operate on memory locations in certain address spaces" + " (global, shared, or local), but was supplied a memory address not" + " belonging to an allowed address space." + " This leaves the process in an inconsistent state and any further CUDA work" + " will return the same error. To continue using CUDA, the process must be terminated" + " and relaunched." + ), + 718: ( + "The device encountered an invalid program counter." + " This leaves the process in an inconsistent state and any further CUDA work" + " will return the same error. To continue using CUDA, the process must be terminated" + " and relaunched." + ), + 719: ( + "An exception occurred on the device while executing a kernel. Common" + " causes include dereferencing an invalid device pointer and accessing" + " out of bounds shared memory. Less common cases can be system specific - more" + " information about these cases can be found in the system specific user guide." + " This leaves the process in an inconsistent state and any further CUDA work" + " will return the same error. To continue using CUDA, the process must be terminated" + " and relaunched." + ), + 720: ( + "This error indicates that the number of blocks launched per grid for a kernel that was" + " launched via either ::cudaLaunchCooperativeKernel" + " exceeds the maximum number of blocks as allowed by ::cudaOccupancyMaxActiveBlocksPerMultiprocessor" + " or ::cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags times the number of multiprocessors" + " as specified by the device attribute ::cudaDevAttrMultiProcessorCount." + ), + 721: ( + "An exception occurred on the device while exiting a kernel using tensor memory: the" + " tensor memory was not completely deallocated. This leaves the process in an inconsistent" + " state and any further CUDA work will return the same error. To continue using CUDA, the" + " process must be terminated and relaunched." + ), + 800: "This error indicates the attempted operation is not permitted.", + 801: ("This error indicates the attempted operation is not supported on the current system or device."), + 802: ( + "This error indicates that the system is not yet ready to start any CUDA" + " work. To continue using CUDA, verify the system configuration is in a" + " valid state and all required driver daemons are actively running." + " More information about this error can be found in the system specific" + " user guide." + ), + 803: ( + "This error indicates that there is a mismatch between the versions of" + " the display driver and the CUDA driver. Refer to the compatibility documentation" + " for supported versions." + ), + 804: ( + "This error indicates that the system was upgraded to run with forward compatibility" + " but the visible hardware detected by CUDA does not support this configuration." + " Refer to the compatibility documentation for the supported hardware matrix or ensure" + " that only supported hardware is visible during initialization via the CUDA_VISIBLE_DEVICES" + " environment variable." + ), + 805: "This error indicates that the MPS client failed to connect to the MPS control daemon or the MPS server.", + 806: "This error indicates that the remote procedural call between the MPS server and the MPS client failed.", + 807: ( + "This error indicates that the MPS server is not ready to accept new MPS client requests." + " This error can be returned when the MPS server is in the process of recovering from a fatal failure." + ), + 808: "This error indicates that the hardware resources required to create MPS client have been exhausted.", + 809: "This error indicates the the hardware resources required to device connections have been exhausted.", + 810: "This error indicates that the MPS client has been terminated by the server. To continue using CUDA, the process must be terminated and relaunched.", + 811: "This error indicates, that the program is using CUDA Dynamic Parallelism, but the current configuration, like MPS, does not support it.", + 812: "This error indicates, that the program contains an unsupported interaction between different versions of CUDA Dynamic Parallelism.", + 900: "The operation is not permitted when the stream is capturing.", + 901: ("The current capture sequence on the stream has been invalidated due to a previous error."), + 902: ("The operation would have resulted in a merge of two independent capture sequences."), + 903: "The capture was not initiated in this stream.", + 904: ("The capture sequence contains a fork that was not joined to the primary stream."), + 905: ( + "A dependency would have been created which crosses the capture sequence" + " boundary. Only implicit in-stream ordering dependencies are allowed to" + " cross the boundary." + ), + 906: ( + "The operation would have resulted in a disallowed implicit dependency on" + " a current capture sequence from cudaStreamLegacy." + ), + 907: ("The operation is not permitted on an event which was last recorded in a capturing stream."), + 908: ( + "A stream capture sequence not initiated with the ::cudaStreamCaptureModeRelaxed" + " argument to ::cudaStreamBeginCapture was passed to ::cudaStreamEndCapture in a" + " different thread." + ), + 909: "This indicates that the wait operation has timed out.", + 910: ( + "This error indicates that the graph update was not performed because it included" + " changes which violated constraints specific to instantiated graph update." + ), + 911: ( + "This indicates that an async error has occurred in a device outside of CUDA." + " If CUDA was waiting for an external device's signal before consuming shared data," + " the external device signaled an error indicating that the data is not valid for" + " consumption. This leaves the process in an inconsistent state and any further CUDA" + " work will return the same error. To continue using CUDA, the process must be" + " terminated and relaunched." + ), + 912: ("This indicates that a kernel launch error has occurred due to cluster misconfiguration."), + 913: ("Indiciates a function handle is not loaded when calling an API that requires a loaded function."), + 914: ("This error indicates one or more resources passed in are not valid resource types for the operation."), + 915: ("This error indicates one or more resources are insufficient or non-applicable for the operation."), + 917: ( + "This error indicates that the requested operation is not permitted because the" + " stream is in a detached state. This can occur if the green context associated" + " with the stream has been destroyed, limiting the stream's operational capabilities." + ), + 999: "This indicates that an unknown internal error has occurred.", + 10000: ( + "Any unhandled CUDA driver error is added to this value and returned via" + " the runtime. Production releases of CUDA should not return such errors." + " This error return is deprecated as of CUDA 4.1." + ), +} diff --git a/cuda_core/cuda/core/_utils/validators.py b/cuda_core/cuda/core/_utils/validators.py new file mode 100644 index 00000000000..dac3d1c788e --- /dev/null +++ b/cuda_core/cuda/core/_utils/validators.py @@ -0,0 +1,35 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + + +def format_or_list(values): + """Format an iterable of values as a human-readable ``A, B or C`` string. + + Each value is passed through :func:`repr`. A single value is returned + as-is; two values are joined with ``" or "``; three or more use a + comma-separated list with ``" or "`` before the last item. + """ + reprs = [repr(v) for v in values] + if len(reprs) <= 1: + return reprs[0] if reprs else "" + *head, tail = reprs + return ", ".join(head) + " or " + tail + + +def check_str_enum(value, enum_class, *, allow_none=False): + """Raise ValueError if *value* is not a member of *enum_class*. + + Derives the list of acceptable values from the enum itself so callers + do not need to maintain a parallel copy of the valid strings. + + If *allow_none* is True, ``None`` is also accepted and included in the + error message when an invalid value is provided. + """ + if allow_none and value is None: + return + if value not in {m.value for m in enum_class}: + valid = sorted(m.value for m in enum_class) + if allow_none: + valid = [None, *valid] + raise ValueError(f"{value!r} is not a valid {enum_class.__name__}. Must be {format_or_list(valid)}") diff --git a/cuda_core/cuda/core/_utils/version.pxd b/cuda_core/cuda/core/_utils/version.pxd new file mode 100644 index 00000000000..2746d463dba --- /dev/null +++ b/cuda_core/cuda/core/_utils/version.pxd @@ -0,0 +1,6 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +cdef tuple cy_binding_version() +cdef tuple cy_driver_version() diff --git a/cuda_core/cuda/core/_utils/version.pyi b/cuda_core/cuda/core/_utils/version.pyi new file mode 100644 index 00000000000..bb7f0129917 --- /dev/null +++ b/cuda_core/cuda/core/_utils/version.pyi @@ -0,0 +1,14 @@ +# This file was generated by stubgen-pyx v0.2.6 from cuda_core/cuda/core/_utils/version.pyx + +from __future__ import annotations + +import functools + + +@functools.cache +def binding_version() -> tuple[int, int, int]: + """Return the cuda-bindings version as a (major, minor, patch) triple.""" + +@functools.cache +def driver_version() -> tuple[int, int, int]: + """Return the CUDA driver version as a (major, minor, patch) triple.""" \ No newline at end of file diff --git a/cuda_core/cuda/core/_utils/version.pyx b/cuda_core/cuda/core/_utils/version.pyx new file mode 100644 index 00000000000..09ea5852421 --- /dev/null +++ b/cuda_core/cuda/core/_utils/version.pyx @@ -0,0 +1,43 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +import functools +import importlib.metadata + +from cuda.core._utils.cuda_utils import driver, handle_return + + +@functools.cache +def binding_version() -> tuple[int, int, int]: + """Return the cuda-bindings version as a (major, minor, patch) triple.""" + try: + parts = importlib.metadata.version("cuda-bindings").split(".")[:3] + except importlib.metadata.PackageNotFoundError: + parts = importlib.metadata.version("cuda-python").split(".")[:3] + return tuple(int(v) for v in parts) + + +@functools.cache +def driver_version() -> tuple[int, int, int]: + """Return the CUDA driver version as a (major, minor, patch) triple.""" + cdef int ver = handle_return(driver.cuDriverGetVersion()) + return (ver // 1000, (ver // 10) % 100, ver % 10) + + +cdef tuple _cached_binding_version = None +cdef tuple _cached_driver_version = None + + +cdef tuple cy_binding_version(): + global _cached_binding_version + if _cached_binding_version is None: + _cached_binding_version = binding_version() + return _cached_binding_version + + +cdef tuple cy_driver_version(): + global _cached_driver_version + if _cached_driver_version is None: + _cached_driver_version = driver_version() + return _cached_driver_version diff --git a/cuda_core/cuda/core/checkpoint.py b/cuda_core/cuda/core/checkpoint.py new file mode 100644 index 00000000000..32fe7e26d83 --- /dev/null +++ b/cuda_core/cuda/core/checkpoint.py @@ -0,0 +1,256 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +import ctypes as _ctypes +from collections.abc import Mapping +from typing import Any + +from cuda.bindings import driver as _driver +from cuda.core._utils.cuda_utils import handle_return as _handle_cuda_return +from cuda.core._utils.version import binding_version as _binding_version +from cuda.core._utils.version import driver_version as _driver_version +from cuda.core.typing import ProcessStateType as _ProcessStateType + +_PROCESS_STATE_NAME_ATTRS: tuple[tuple[str, _ProcessStateType], ...] = ( + ("CU_PROCESS_STATE_RUNNING", "running"), + ("CU_PROCESS_STATE_LOCKED", "locked"), + ("CU_PROCESS_STATE_CHECKPOINTED", "checkpointed"), + ("CU_PROCESS_STATE_FAILED", "failed"), +) + +_REQUIRED_BINDING_ATTRS = ( + "cuCheckpointProcessCheckpoint", + "cuCheckpointProcessGetRestoreThreadId", + "cuCheckpointProcessGetState", + "cuCheckpointProcessLock", + "cuCheckpointProcessRestore", + "cuCheckpointProcessUnlock", + "CUcheckpointGpuPair", + "CUcheckpointLockArgs", + "CUprocessState", + "CUcheckpointRestoreArgs", +) +_REQUIRED_DRIVER_VERSION = (12, 8, 0) +_driver_capability_checked = False + + +class Process: + """ + CUDA process that can be locked, checkpointed, restored, and unlocked. + + Parameters + ---------- + pid : int + Process ID of the CUDA process. + """ + + __slots__ = ("_pid",) + + def __init__(self, pid: int): + self._pid = _check_pid(pid) + + @property + def pid(self) -> int: + """ + Process ID of the CUDA process. + """ + return self._pid + + @property + def state(self) -> _ProcessStateType: + """ + CUDA checkpoint state for this process. + """ + driver = _get_driver() + state = _call_driver(driver, driver.cuCheckpointProcessGetState, self._pid) + state_names = _get_process_state_names(driver) + try: + return state_names[state] + except KeyError as e: + state_value = int(state) + raise RuntimeError(f"Unknown CUDA checkpoint process state: {state_value}") from e + + @property + def restore_thread_id(self) -> int: + """ + CUDA restore thread ID for this process. + """ + driver = _get_driver() + return int(_call_driver(driver, driver.cuCheckpointProcessGetRestoreThreadId, self._pid)) + + def lock(self, timeout_ms: int = 0) -> None: + """ + Lock this process, blocking further CUDA API calls. + + Parameters + ---------- + timeout_ms : int, optional + Timeout in milliseconds. A value of 0 indicates no timeout. + """ + driver = _get_driver() + args = driver.CUcheckpointLockArgs() + args.timeoutMs = _check_timeout_ms(timeout_ms) + _call_driver(driver, driver.cuCheckpointProcessLock, self._pid, args) + + def checkpoint(self) -> None: + """ + Checkpoint the GPU memory contents of this locked process. + """ + driver = _get_driver() + _call_driver(driver, driver.cuCheckpointProcessCheckpoint, self._pid, None) + + def restore(self, gpu_mapping: Mapping[Any, Any] | None = None) -> None: + """ + Restore this checkpointed process. + + Parameters + ---------- + gpu_mapping : mapping, optional + GPU UUID remapping from each checkpointed GPU UUID to the GPU UUID + to restore onto. For migration workflows, provide mappings for + every GPU visible to the kernel-mode driver. User-space masking + such as ``CUDA_VISIBLE_DEVICES`` does not reduce this mapping + requirement. + """ + driver = _get_driver() + args = _make_restore_args(driver, gpu_mapping) + _call_driver(driver, driver.cuCheckpointProcessRestore, self._pid, args) + + def unlock(self) -> None: + """ + Unlock this locked process so it can resume CUDA API calls. + """ + driver = _get_driver() + _call_driver(driver, driver.cuCheckpointProcessUnlock, self._pid, None) + + +def _get_driver() -> Any: + global _driver_capability_checked + if _driver_capability_checked: + return _driver + + binding_ver = _binding_version() + if not _binding_version_supports_checkpoint(binding_ver): + raise RuntimeError( + "CUDA checkpointing requires cuda.bindings with CUDA checkpoint API support. " + f"Found cuda.bindings {'.'.join(str(part) for part in binding_ver[:3])}." + ) + + missing = [name for name in _REQUIRED_BINDING_ATTRS if not hasattr(_driver, name)] + if missing: + raise RuntimeError( + f"CUDA checkpointing requires cuda.bindings with CUDA checkpoint API support. Missing: {', '.join(missing)}" + ) + + driver_ver = _driver_version() + if driver_ver < _REQUIRED_DRIVER_VERSION: + raise RuntimeError( + "CUDA checkpointing is not supported by the installed NVIDIA driver. " + "Upgrade to a driver version with CUDA checkpoint API support." + ) + + _driver_capability_checked = True + return _driver + + +def _binding_version_supports_checkpoint(version: tuple[int, ...]) -> bool: + major, minor, patch = version[:3] + return (major == 12 and (minor, patch) >= (8, 0)) or (major == 13 and (minor, patch) >= (0, 2)) or major > 13 + + +def _get_process_state_names(driver: Any) -> dict[Any, _ProcessStateType]: + return {getattr(driver.CUprocessState, attr): state_name for attr, state_name in _PROCESS_STATE_NAME_ATTRS} + + +def _call_driver(driver: Any, func: Any, *args: Any) -> Any: + try: + result = func(*args) + except RuntimeError as e: + if "cuCheckpointProcess" in str(e) and "not found" in str(e): + raise RuntimeError( + "CUDA checkpointing is not supported by the installed NVIDIA driver. " + "Upgrade to a driver version with CUDA checkpoint API support." + ) from e + raise + + err = result[0] + not_supported_errors = ( + getattr(driver.CUresult, "CUDA_ERROR_NOT_FOUND", None), + getattr(driver.CUresult, "CUDA_ERROR_NOT_SUPPORTED", None), + ) + if err in not_supported_errors: + raise RuntimeError( + "CUDA checkpointing is not supported by the installed NVIDIA driver. " + "Upgrade to a driver version with CUDA checkpoint API support." + ) + + return _handle_cuda_return(result) + + +def _check_pid(pid: int) -> int: + if isinstance(pid, bool) or not isinstance(pid, int): + raise TypeError("pid must be an int") + if pid <= 0: + raise ValueError("pid must be a positive int") + return pid + + +def _check_timeout_ms(timeout_ms: int) -> int: + if isinstance(timeout_ms, bool) or not isinstance(timeout_ms, int): + raise TypeError("timeout_ms must be an int") + if timeout_ms < 0: + raise ValueError("timeout_ms must be >= 0") + return timeout_ms + + +def _make_restore_args(driver: Any, gpu_mapping: Mapping[Any, Any] | None) -> Any: + if gpu_mapping is None: + return None + if not isinstance(gpu_mapping, Mapping): + raise TypeError("gpu_mapping must be a mapping from checkpointed GPU UUID to restore GPU UUID") + + pairs = [] + for old_uuid, new_uuid in gpu_mapping.items(): + pair = driver.CUcheckpointGpuPair() + buffers: list[Any] = [] # holds ctypes string-buffer keepalives for the call below + pair.oldUuid = _as_cuuuid(driver, old_uuid, buffers) + pair.newUuid = _as_cuuuid(driver, new_uuid, buffers) + pairs.append(pair) + + if not pairs: + return None + + args = driver.CUcheckpointRestoreArgs() + args.gpuPairs = pairs + args.gpuPairsCount = len(pairs) + return args + + +def _as_cuuuid(driver: Any, value: Any, buffers: list[Any]) -> Any: + """Convert *value* to a ``CUuuid``. + + Accepts a ``CUuuid`` instance (returned as-is) or a UUID string in + the ``"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"`` format returned by + :attr:`Device.uuid`. + """ + if isinstance(value, driver.CUuuid): + return value + if isinstance(value, str): + try: + raw = bytes.fromhex(value.replace("-", "")) + except ValueError: + raise ValueError( + f"GPU UUID string must be 32 hex characters (with optional hyphens), got {value!r}" + ) from None + if len(raw) != 16: + raise ValueError(f"GPU UUID string must be 32 hex characters (with optional hyphens), got {value!r}") + buf = _ctypes.create_string_buffer(raw, 16) + buffers.append(buf) + return driver.CUuuid(_ctypes.addressof(buf)) + raise TypeError("GPU UUID values must be CUDA UUID objects or UUID strings") + + +__all__ = [ + "Process", +] diff --git a/cuda_core/cuda/core/graph/__init__.pxd b/cuda_core/cuda/core/graph/__init__.pxd new file mode 100644 index 00000000000..f367745acc1 --- /dev/null +++ b/cuda_core/cuda/core/graph/__init__.pxd @@ -0,0 +1,23 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from cuda.core.graph._graph_definition cimport GraphCondition, GraphDefinition +from cuda.core.graph._graph_node cimport GraphNode +from cuda.core.graph._subclasses cimport ( + AllocNode, + ChildGraphNode, + ConditionalNode, + EmptyNode, + EventRecordNode, + EventWaitNode, + FreeNode, + HostCallbackNode, + IfElseNode, + IfNode, + KernelNode, + MemcpyNode, + MemsetNode, + SwitchNode, + WhileNode, +) diff --git a/cuda_core/cuda/core/graph/__init__.py b/cuda_core/cuda/core/graph/__init__.py new file mode 100644 index 00000000000..e1091114368 --- /dev/null +++ b/cuda_core/cuda/core/graph/__init__.py @@ -0,0 +1,8 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from ._graph_builder import * +from ._graph_definition import * +from ._graph_node import * +from ._subclasses import * diff --git a/cuda_core/cuda/core/graph/_adjacency_set_proxy.pyi b/cuda_core/cuda/core/graph/_adjacency_set_proxy.pyi new file mode 100644 index 00000000000..742b3777b04 --- /dev/null +++ b/cuda_core/cuda/core/graph/_adjacency_set_proxy.pyi @@ -0,0 +1,58 @@ +# This file was generated by stubgen-pyx v0.2.6 from cuda_core/cuda/core/graph/_adjacency_set_proxy.pyx + +"""Mutable-set proxy for graph node predecessors and successors.""" +from __future__ import annotations + +from collections.abc import Iterator, Set +from typing import Any + +from cuda.core.graph._graph_node import GraphNode + + +class AdjacencySetProxy: + """Mutable set proxy for a node's predecessors or successors. Mutations + write through to the underlying CUDA graph.""" + __slots__ = ('_core',) + + def __init__(self, node: GraphNode, is_fwd: bool) -> None: + ... + + @classmethod + def _from_iterable(cls, it) -> set[GraphNode]: + ... + + def __contains__(self, x: object) -> bool: + ... + + def __iter__(self) -> Iterator[GraphNode]: + ... + + def __len__(self) -> int: + ... + + def add(self, value: GraphNode) -> None: + ... + + def discard(self, value: GraphNode) -> None: + ... + + def clear(self) -> None: + """Remove all edges in a single driver call.""" + + def __isub__(self, it: Set[Any]) -> 'AdjacencySetProxy': + """Remove edges to all nodes in *it* in a single driver call.""" + + def update(self, *others) -> None: + """Add edges to multiple nodes at once.""" + + def __ior__(self, it: Set[Any]) -> 'AdjacencySetProxy': + """Add edges to all nodes in *it* in a single driver call.""" + + def __repr__(self) -> str: + ... + +class _AdjacencySetCore: + """Cythonized core implementing AdjacencySetProxy""" + + def __init__(self, node: GraphNode, is_fwd: bool): + ... \ No newline at end of file diff --git a/cuda_core/cuda/core/graph/_adjacency_set_proxy.pyx b/cuda_core/cuda/core/graph/_adjacency_set_proxy.pyx new file mode 100644 index 00000000000..e1762321ce0 --- /dev/null +++ b/cuda_core/cuda/core/graph/_adjacency_set_proxy.pyx @@ -0,0 +1,279 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +"""Mutable-set proxy for graph node predecessors and successors.""" + +from libc.stddef cimport size_t +from libcpp.vector cimport vector +from cuda.bindings cimport cydriver +from cuda.core.graph._graph_node cimport GraphNode +from cuda.core._resource_handles cimport ( + GraphHandle, + GraphNodeHandle, + as_cu, + graph_node_get_graph, +) +from cuda.core._utils.cuda_utils cimport HANDLE_RETURN +from collections.abc import Iterator, MutableSet, Set +from typing import Any + + +# ---- Python MutableSet wrapper ---------------------------------------------- + +class AdjacencySetProxy(MutableSet[GraphNode]): + """Mutable set proxy for a node's predecessors or successors. Mutations + write through to the underlying CUDA graph.""" + + __slots__ = ("_core",) + + def __init__(self, node: GraphNode, bint is_fwd) -> None: + self._core = _AdjacencySetCore(node, is_fwd) + + # Used by operators such as &|^ to create non-proxy views when needed. + @classmethod + def _from_iterable(cls, it) -> set[GraphNode]: + return set(it) + + # --- abstract methods required by MutableSet --- + + def __contains__(self, x: object) -> bool: + if not isinstance(x, GraphNode): + return False + return (<_AdjacencySetCore>self._core).contains(x) + + def __iter__(self) -> Iterator[GraphNode]: + return iter((<_AdjacencySetCore>self._core).query()) + + def __len__(self) -> int: + return (<_AdjacencySetCore>self._core).count() + + def add(self, value: GraphNode) -> None: + if not isinstance(value, GraphNode): + raise TypeError( + f"expected GraphNode, got {type(value).__name__}") + if value in self: + return + (<_AdjacencySetCore>self._core).add_edge(value) + + def discard(self, value: GraphNode) -> None: + if not isinstance(value, GraphNode): + return + if value not in self: + return + (<_AdjacencySetCore>self._core).remove_edge(value) + + # --- override for bulk efficiency --- + + def clear(self) -> None: + """Remove all edges in a single driver call.""" + members = (<_AdjacencySetCore>self._core).query() + if members: + (<_AdjacencySetCore>self._core).remove_edges(members) + + def __isub__(self, it: Set[Any]) -> "AdjacencySetProxy": + """Remove edges to all nodes in *it* in a single driver call.""" + if it is self: + self.clear() + else: + to_remove = [v for v in it if isinstance(v, GraphNode) and v in self] + if to_remove: + (<_AdjacencySetCore>self._core).remove_edges(to_remove) + return self + + def update(self, *others) -> None: + """Add edges to multiple nodes at once.""" + nodes = [] + for other in others: + if isinstance(other, GraphNode): + nodes.append(other) + else: + for n in other: + if not isinstance(n, GraphNode): + raise TypeError( + f"expected GraphNode, got {type(n).__name__}") + nodes.append(n) + if not nodes: + return + new = [n for n in nodes if n not in self] + if new: + (<_AdjacencySetCore>self._core).add_edges(new) + + def __ior__(self, it: Set[Any]) -> "AdjacencySetProxy": + """Add edges to all nodes in *it* in a single driver call.""" + self.update(it) + return self + + def __repr__(self) -> str: + return "{" + ", ".join(repr(n) for n in self) + "}" + + +# ---- cdef core holding a function pointer ------------------------------------ + +# Signature shared by driver_get_preds and driver_get_succs. +ctypedef cydriver.CUresult (*_adj_fn_t)( + cydriver.CUgraphNode, cydriver.CUgraphNode*, size_t*) noexcept nogil + + +cdef class _AdjacencySetCore: + """Cythonized core implementing AdjacencySetProxy""" + cdef: + GraphNodeHandle _h_node + GraphHandle _h_graph + _adj_fn_t _query_fn + bint _is_fwd + + def __init__(self, GraphNode node, bint is_fwd): + self._h_node = node._h_node + self._h_graph = graph_node_get_graph(node._h_node) + self._is_fwd = is_fwd + self._query_fn = driver_get_succs if is_fwd else driver_get_preds + + cdef inline void _resolve_edge( + self, GraphNode other, + cydriver.CUgraphNode* c_from, + cydriver.CUgraphNode* c_to) noexcept: + if self._is_fwd: + c_from[0] = as_cu(self._h_node) + c_to[0] = as_cu(other._h_node) + else: + c_from[0] = as_cu(other._h_node) + c_to[0] = as_cu(self._h_node) + + cdef list query(self): + cdef cydriver.CUgraphNode c_node = as_cu(self._h_node) + if c_node == NULL: + return [] + cdef cydriver.CUgraphNode buf[16] + cdef size_t count = 16 + cdef size_t i + with nogil: + HANDLE_RETURN(self._query_fn(c_node, buf, &count)) + if count <= 16: + return [GraphNode._create(self._h_graph, buf[i]) + for i in range(count)] + cdef vector[cydriver.CUgraphNode] nodes_vec + nodes_vec.resize(count) + with nogil: + HANDLE_RETURN(self._query_fn( + c_node, nodes_vec.data(), &count)) + return [GraphNode._create(self._h_graph, nodes_vec[i]) + for i in range(count)] + + cdef bint contains(self, GraphNode other): + cdef cydriver.CUgraphNode c_node = as_cu(self._h_node) + cdef cydriver.CUgraphNode target = as_cu(other._h_node) + if c_node == NULL or target == NULL: + return False + cdef cydriver.CUgraphNode buf[16] + cdef size_t count = 16 + cdef size_t i + with nogil: + HANDLE_RETURN(self._query_fn(c_node, buf, &count)) + + # Fast path for small sets. + if count <= 16: + for i in range(count): + if buf[i] == target: + return True + return False + + # Fallback for large sets. + cdef vector[cydriver.CUgraphNode] nodes_vec + nodes_vec.resize(count) + with nogil: + HANDLE_RETURN(self._query_fn(c_node, nodes_vec.data(), &count)) + assert count == nodes_vec.size() + for i in range(count): + if nodes_vec[i] == target: + return True + return False + + cdef Py_ssize_t count(self): + cdef cydriver.CUgraphNode c_node = as_cu(self._h_node) + if c_node == NULL: + return 0 + cdef size_t n = 0 + with nogil: + HANDLE_RETURN(self._query_fn(c_node, NULL, &n)) + return n + + cdef void add_edge(self, GraphNode other): + cdef cydriver.CUgraphNode c_from, c_to + self._resolve_edge(other, &c_from, &c_to) + with nogil: + HANDLE_RETURN(driver_add_edges(as_cu(self._h_graph), &c_from, &c_to, 1)) + + cdef void add_edges(self, list nodes): + cdef size_t n = len(nodes) + cdef vector[cydriver.CUgraphNode] from_vec + cdef vector[cydriver.CUgraphNode] to_vec + from_vec.resize(n) + to_vec.resize(n) + cdef size_t i + for i in range(n): + self._resolve_edge(nodes[i], &from_vec[i], &to_vec[i]) + with nogil: + HANDLE_RETURN(driver_add_edges( + as_cu(self._h_graph), from_vec.data(), to_vec.data(), n)) + + cdef void remove_edge(self, GraphNode other): + cdef cydriver.CUgraphNode c_from, c_to + self._resolve_edge(other, &c_from, &c_to) + with nogil: + HANDLE_RETURN(driver_remove_edges(as_cu(self._h_graph), &c_from, &c_to, 1)) + + cdef void remove_edges(self, list nodes): + cdef size_t n = len(nodes) + cdef vector[cydriver.CUgraphNode] from_vec + cdef vector[cydriver.CUgraphNode] to_vec + from_vec.resize(n) + to_vec.resize(n) + cdef size_t i + for i in range(n): + self._resolve_edge(nodes[i], &from_vec[i], &to_vec[i]) + with nogil: + HANDLE_RETURN(driver_remove_edges( + as_cu(self._h_graph), from_vec.data(), to_vec.data(), n)) + + +# ---- driver wrappers: absorb CUDA version differences ---- + +cdef inline cydriver.CUresult driver_get_preds( + cydriver.CUgraphNode node, cydriver.CUgraphNode* out, + size_t* count) noexcept nogil: + IF CUDA_CORE_BUILD_MAJOR >= 13: + return cydriver.cuGraphNodeGetDependencies(node, out, NULL, count) + ELSE: + return cydriver.cuGraphNodeGetDependencies(node, out, count) + + +cdef inline cydriver.CUresult driver_get_succs( + cydriver.CUgraphNode node, cydriver.CUgraphNode* out, + size_t* count) noexcept nogil: + IF CUDA_CORE_BUILD_MAJOR >= 13: + return cydriver.cuGraphNodeGetDependentNodes(node, out, NULL, count) + ELSE: + return cydriver.cuGraphNodeGetDependentNodes(node, out, count) + + +cdef inline cydriver.CUresult driver_add_edges( + cydriver.CUgraph graph, cydriver.CUgraphNode* from_arr, + cydriver.CUgraphNode* to_arr, size_t count) noexcept nogil: + IF CUDA_CORE_BUILD_MAJOR >= 13: + return cydriver.cuGraphAddDependencies( + graph, from_arr, to_arr, NULL, count) + ELSE: + return cydriver.cuGraphAddDependencies( + graph, from_arr, to_arr, count) + + +cdef inline cydriver.CUresult driver_remove_edges( + cydriver.CUgraph graph, cydriver.CUgraphNode* from_arr, + cydriver.CUgraphNode* to_arr, size_t count) noexcept nogil: + IF CUDA_CORE_BUILD_MAJOR >= 13: + return cydriver.cuGraphRemoveDependencies( + graph, from_arr, to_arr, NULL, count) + ELSE: + return cydriver.cuGraphRemoveDependencies( + graph, from_arr, to_arr, count) diff --git a/cuda_core/cuda/core/graph/_graph_builder.pxd b/cuda_core/cuda/core/graph/_graph_builder.pxd new file mode 100644 index 00000000000..660ebe8ec7d --- /dev/null +++ b/cuda_core/cuda/core/graph/_graph_builder.pxd @@ -0,0 +1,27 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from cuda.bindings cimport cydriver + +from cuda.core._resource_handles cimport GraphExecHandle, GraphHandle, StreamHandle +from cuda.core._stream cimport Stream + + +cdef class GraphBuilder: + cdef: + GraphHandle _h_graph + StreamHandle _h_stream + int _kind + int _state + Stream _stream # cached to avoid reconstruction from _h_stream handle + object __weakref__ + + +cdef class Graph: + cdef: + GraphExecHandle _h_graph_exec + object __weakref__ + + @staticmethod + cdef Graph _init(cydriver.CUgraphExec graph_exec) diff --git a/cuda_core/cuda/core/graph/_graph_builder.pyi b/cuda_core/cuda/core/graph/_graph_builder.pyi new file mode 100644 index 00000000000..f19d4067eb2 --- /dev/null +++ b/cuda_core/cuda/core/graph/_graph_builder.pyi @@ -0,0 +1,493 @@ +# This file was generated by stubgen-pyx v0.2.6 from cuda_core/cuda/core/graph/_graph_builder.pyx + +from __future__ import annotations + +from dataclasses import dataclass + +from cuda.core._stream import Stream +from cuda.core._utils.cuda_utils import driver +from cuda.core.graph._graph_definition import GraphCondition, GraphDefinition + +_BuilderKind = int +_CaptureState = int + +@dataclass +class GraphDebugPrintOptions: + """Options for debug_dot_print(). + + Attributes + ---------- + verbose : bool + Output all debug data as if every debug flag is enabled (Default to False) + runtime_types : bool + Use CUDA Runtime structures for output (Default to False) + kernel_node_params : bool + Adds kernel parameter values to output (Default to False) + memcpy_node_params : bool + Adds memcpy parameter values to output (Default to False) + memset_node_params : bool + Adds memset parameter values to output (Default to False) + host_node_params : bool + Adds host parameter values to output (Default to False) + event_node_params : bool + Adds event parameter values to output (Default to False) + ext_semas_signal_node_params : bool + Adds external semaphore signal parameter values to output (Default to False) + ext_semas_wait_node_params : bool + Adds external semaphore wait parameter values to output (Default to False) + kernel_node_attributes : bool + Adds kernel node attributes to output (Default to False) + handles : bool + Adds node handles and every kernel function handle to output (Default to False) + mem_alloc_node_params : bool + Adds memory alloc parameter values to output (Default to False) + mem_free_node_params : bool + Adds memory free parameter values to output (Default to False) + batch_mem_op_node_params : bool + Adds batch mem op parameter values to output (Default to False) + extra_topo_info : bool + Adds edge numbering information (Default to False) + conditional_node_params : bool + Adds conditional node parameter values to output (Default to False) + + """ + verbose: bool = False + runtime_types: bool = False + kernel_node_params: bool = False + memcpy_node_params: bool = False + memset_node_params: bool = False + host_node_params: bool = False + event_node_params: bool = False + ext_semas_signal_node_params: bool = False + ext_semas_wait_node_params: bool = False + kernel_node_attributes: bool = False + handles: bool = False + mem_alloc_node_params: bool = False + mem_free_node_params: bool = False + batch_mem_op_node_params: bool = False + extra_topo_info: bool = False + conditional_node_params: bool = False + + def _to_flags(self) -> int: + """Convert options to CUDA driver API flags (internal use).""" + +@dataclass +class GraphCompleteOptions: + """Options for graph instantiation. + + Attributes + ---------- + auto_free_on_launch : bool, optional + Automatically free memory allocated in a graph before relaunching. (Default to False) + upload_stream : Stream, optional + Stream to use to automatically upload the graph after completion. (Default to None) + device_launch : bool, optional + Configure the graph to be launchable from the device. This flag can only + be used on platforms which support unified addressing. This flag cannot be + used in conjunction with auto_free_on_launch. (Default to False) + use_node_priority : bool, optional + Run the graph using the per-node priority attributes rather than the + priority of the stream it is launched into. (Default to False) + + """ + auto_free_on_launch: bool = False + upload_stream: Stream | None = None + device_launch: bool = False + use_node_priority: bool = False + +class GraphBuilder: + """A graph under construction by stream capture. + + A graph groups a set of CUDA kernels and other CUDA operations together and executes + them with a specified dependency tree. It speeds up the workflow by combining the + driver activities associated with CUDA kernel launches and CUDA API calls. + + Directly creating a :obj:`~graph.GraphBuilder` is not supported due + to ambiguity. New graph builders should instead be created through a + :obj:`~_device.Device`, or a :obj:`~_stream.stream` object. + + .. note:: + + Operations recorded during capture reference your memory but do not + take ownership of it. As with ordinary stream work, you must keep the + operands alive for as long as the completed graph may execute -- for + example, the :obj:`~_memory.Buffer` objects passed to :func:`~launch` + or :meth:`~_memory.Buffer.copy_to`. Host callbacks added with + :meth:`callback` are the exception: the callable (and any copied + ``user_data``) are retained for the graph's lifetime. This differs from + building a graph explicitly with :class:`~graph.GraphDefinition`, which + retains the operands it is given. + + """ + + def __init__(self): + ... + + def __dealloc__(self): + ... + + @staticmethod + def _init(stream: Stream): + ... + + def close(self): + """Destroy the graph builder.""" + + @property + def stream(self) -> Stream: + """Returns the stream associated with the graph builder.""" + + @property + def is_join_required(self) -> bool: + """Returns True if this graph builder must be joined before building is ended.""" + + @property + def graph_definition(self) -> GraphDefinition: + """The captured graph as an explicit :class:`~graph.GraphDefinition`. + + .. versionadded:: 1.1.0 + + The returned :class:`~graph.GraphDefinition` is a view of the same + graph this builder is producing: nodes added through it appear in + subsequent :meth:`complete` and :meth:`debug_dot_print` calls, and + the view stays valid even after the builder is closed. + + This lets you mix the capture and explicit APIs on a single graph, + for example to inspect what was captured, augment it with extra + nodes, or build a conditional body entirely with the explicit API. + + Availability: + + - **Primary builders** (created by :meth:`Device.create_graph_builder` + or :meth:`Stream.create_graph_builder`): only after + :meth:`end_building`. + + - **Conditional-body builders** (returned by :meth:`if_then`, + :meth:`if_else`, :meth:`while_loop`, :meth:`switch`): both before + :meth:`begin_building` and after :meth:`end_building`. The body + graph already exists when the conditional is created, so you may + populate it through this view without ever calling + :meth:`begin_building` on the body builder. + + - **Forked builders** (returned by :meth:`split`): never. Forked + builders share the primary builder's graph; access it through the + primary instead. + + Returns + ------- + GraphDefinition + A view of the graph being built. + + Raises + ------ + RuntimeError + If the builder is closed, forked, currently building, or (for + primary builders) has not started building yet. A + :class:`~graph.GraphDefinition` obtained before :meth:`close` + keeps working; only fresh access through this property is + rejected once the builder is closed. + """ + + def begin_building(self, mode: str | None='relaxed') -> GraphBuilder: + """Begins the building process. + + Build `mode` for controlling interaction with other API calls must be one of the following: + + - `global` : Prohibit potentially unsafe operations across all streams in the process. + - `thread_local` : Prohibit potentially unsafe operations in streams created by the current thread. + - `relaxed` : The local thread is not prohibited from potentially unsafe operations. + + Parameters + ---------- + mode : str, optional + Build mode to control the interaction with other API calls that are porentially unsafe. + Default set to use relaxed. + + """ + + @property + def is_building(self) -> bool: + """Returns True if the graph builder is currently building.""" + + def end_building(self) -> GraphBuilder: + """Ends the building process.""" + + def complete(self, options: GraphCompleteOptions | None=None) -> Graph: + """Completes the graph builder and returns the built :obj:`~graph.Graph` object. + + Parameters + ---------- + options : :obj:`~graph.GraphCompleteOptions`, optional + Customizable dataclass for the graph builder completion options. + + Returns + ------- + graph : :obj:`~graph.Graph` + The newly built graph. + + """ + + def debug_dot_print(self, path: str, options: GraphDebugPrintOptions | None=None) -> None: + """Generates a DOT debug file for the graph builder. + + Parameters + ---------- + path : str + File path to use for writting debug DOT output + options : :obj:`~graph.GraphDebugPrintOptions`, optional + Customizable dataclass for the debug print options. + + """ + + def split(self, count: int) -> tuple[GraphBuilder, ...]: + """Splits the original graph builder into multiple graph builders. + + The new builders inherit work dependencies from the original builder. + The original builder is reused for the split and is returned first in the tuple. + + Parameters + ---------- + count : int + The number of graph builders to split the graph builder into. + + Returns + ------- + graph_builders : tuple[:obj:`~graph.GraphBuilder`, ...] + A tuple of split graph builders. The first graph builder in the tuple + is always the original graph builder. + + """ + + @staticmethod + def join(*graph_builders: GraphBuilder) -> GraphBuilder: + """Joins multiple graph builders into a single graph builder. + + The returned builder inherits work dependencies from the provided builders. + + Parameters + ---------- + *graph_builders : :obj:`~graph.GraphBuilder` + The graph builders to join. + + Returns + ------- + graph_builder : :obj:`~graph.GraphBuilder` + The newly joined graph builder. + + """ + + def __cuda_stream__(self) -> tuple[int, int]: + """Return an instance of a __cuda_stream__ protocol.""" + + def _get_conditional_context(self) -> driver.CUcontext: + ... + + def create_condition(self, default_value: int | None=None) -> GraphCondition: + """Create a condition variable for use with conditional nodes. + + The returned :class:`GraphCondition` object is passed to conditional-node + builder methods (:meth:`if_then`, :meth:`if_else`, :meth:`while_loop`, + :meth:`switch`). Its value is controlled at runtime by device code via + ``cudaGraphSetConditional``. + + Parameters + ---------- + default_value : int, optional + The default value to assign to the condition. If None, no + default is assigned. + + Returns + ------- + GraphCondition + A condition variable for controlling conditional execution. + """ + + def if_then(self, condition: GraphCondition) -> GraphBuilder: + """Adds an if condition branch and returns a new graph builder for it. + + The resulting if graph will only execute the branch if the + condition evaluates to true at runtime. + + The new builder inherits work dependencies from the original builder. + + Parameters + ---------- + condition : :class:`~graph.GraphCondition` + The condition variable from :meth:`create_condition` controlling + whether the branch executes. + + Returns + ------- + graph_builder : :obj:`~graph.GraphBuilder` + The newly created conditional graph builder. + + """ + + def if_else(self, condition: GraphCondition) -> tuple[GraphBuilder, GraphBuilder]: + """Adds an if-else condition branch and returns new graph builders for both branches. + + The resulting if graph will execute the branch if the condition + evaluates to true at runtime, otherwise the else branch will execute. + + The new builders inherit work dependencies from the original builder. + + Parameters + ---------- + condition : :class:`~graph.GraphCondition` + The condition variable from :meth:`create_condition` controlling + which branch executes. + + Returns + ------- + graph_builders : tuple[:obj:`~graph.GraphBuilder`, :obj:`~graph.GraphBuilder`] + A tuple of two new graph builders, one for the if branch and one for the else branch. + + """ + + def switch(self, condition: GraphCondition, count: int) -> tuple[GraphBuilder, ...]: + """Adds a switch condition branch and returns new graph builders for all cases. + + The resulting switch graph will execute the branch whose case index + matches the value of the condition at runtime. If no match is found, no + branch will be executed. + + The new builders inherit work dependencies from the original builder. + + Parameters + ---------- + condition : :class:`~graph.GraphCondition` + The condition variable from :meth:`create_condition` selecting + which case executes. + count : int + The number of cases to add to the switch conditional. + + Returns + ------- + graph_builders : tuple[:obj:`~graph.GraphBuilder`, ...] + A tuple of new graph builders, one for each branch. + + """ + + def while_loop(self, condition: GraphCondition) -> GraphBuilder: + """Adds a while loop and returns a new graph builder for it. + + The resulting while loop graph will execute the branch repeatedly at runtime + until the condition evaluates to false. + + The new builder inherits work dependencies from the original builder. + + Parameters + ---------- + condition : :class:`~graph.GraphCondition` + The condition variable from :meth:`create_condition` controlling + loop continuation. + + Returns + ------- + graph_builder : :obj:`~graph.GraphBuilder` + The newly created while loop graph builder. + + """ + + def embed(self, child: GraphBuilder): + """Embed a previously-built :obj:`~graph.GraphBuilder` as a child node. + + Parameters + ---------- + child : :obj:`~graph.GraphBuilder` + The child graph builder. Must have finished building. + """ + + def callback(self, fn, *, user_data=None) -> None: + """Add a host callback to the graph during stream capture. + + The callback runs on the host CPU when the graph reaches this point + in execution. Two modes are supported: + + - **Python callable**: Pass any callable. The GIL is acquired + automatically. The callable must take no arguments; use closures + or ``functools.partial`` to bind state. + - **ctypes function pointer**: Pass a ``ctypes.CFUNCTYPE`` instance. + The function receives a single ``void*`` argument (the + ``user_data``). The caller must keep the ctypes wrapper alive + for the lifetime of the graph. + + .. warning:: + + Callbacks must not call CUDA API functions. Doing so may + deadlock or corrupt driver state. + + Parameters + ---------- + fn : callable or ctypes function pointer + The callback function. + user_data : int or bytes-like, optional + Only for ctypes function pointers. If ``int``, passed as a raw + pointer (caller manages lifetime). If bytes-like, the data is + copied and its lifetime is tied to the graph. + """ + +class Graph: + """An executable graph. + + A graph groups a set of CUDA kernels and other CUDA operations together and executes + them with a specified dependency tree. It speeds up the workflow by combining the + driver activities associated with CUDA kernel launches and CUDA API calls. + + Graphs must be built using a :obj:`~graph.GraphBuilder` object. + + """ + + def __init__(self): + ... + + def close(self) -> None: + """Destroy the graph.""" + + @property + def handle(self) -> driver.CUgraphExec: + """Return the underlying ``CUgraphExec`` object. + + .. caution:: + + This handle is a Python object. To get the memory address of the underlying C + handle, call ``int()`` on the returned object. + + """ + + def update(self, source: 'GraphBuilder | GraphDefinition') -> None: + """Update the graph using a new graph definition. + + The topology of the provided source must be identical to this graph. + + Parameters + ---------- + source : :obj:`~graph.GraphBuilder` or :obj:`~graph.GraphDefinition` + The graph definition to update from. A GraphBuilder must have + finished building. + + """ + + def upload(self, stream: Stream) -> None: + """Uploads the graph in a stream. + + Parameters + ---------- + stream : :obj:`~_stream.Stream` + The stream in which to upload the graph + + """ + + def launch(self, stream: Stream) -> None: + """Launches the graph in a stream. + + Parameters + ---------- + stream : :obj:`~_stream.Stream` + The stream in which to launch the graph. + + """ +__all__ = ['Graph', 'GraphBuilder', 'GraphCompleteOptions', 'GraphDebugPrintOptions'] + +def _instantiate_graph(h_graph, options: GraphCompleteOptions | None=None) -> Graph: + ... \ No newline at end of file diff --git a/cuda_core/cuda/core/graph/_graph_builder.pyx b/cuda_core/cuda/core/graph/_graph_builder.pyx new file mode 100644 index 00000000000..b1e6859f549 --- /dev/null +++ b/cuda_core/cuda/core/graph/_graph_builder.pyx @@ -0,0 +1,1089 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from dataclasses import dataclass +from typing import TYPE_CHECKING + +from libc.stdint cimport intptr_t + +from cuda.bindings cimport cydriver + +from cuda.core.graph._graph_definition cimport GraphCondition, GraphDefinition +from cuda.core.graph._host_callback cimport _attach_host_callback_owners, _resolve_host_callback +from cuda.core._resource_handles cimport ( + GraphHandle, + OpaqueHandle, + as_cu, as_py, + create_graph_exec_handle, create_graph_handle, create_graph_handle_ref, +) +from cuda.core._stream cimport Stream +from cuda.core._utils.cuda_utils cimport HANDLE_RETURN +from cuda.core._utils.version cimport cy_binding_version, cy_driver_version + +from cuda.core._utils.cuda_utils import ( + CUDAError, + driver, + handle_return, +) + +if TYPE_CHECKING: + from cuda.core.graph._graph_definition import GraphDefinition + +__all__ = ['Graph', 'GraphBuilder', 'GraphCompleteOptions', 'GraphDebugPrintOptions'] + + +@dataclass +class GraphDebugPrintOptions: + """Options for debug_dot_print(). + + Attributes + ---------- + verbose : bool + Output all debug data as if every debug flag is enabled (Default to False) + runtime_types : bool + Use CUDA Runtime structures for output (Default to False) + kernel_node_params : bool + Adds kernel parameter values to output (Default to False) + memcpy_node_params : bool + Adds memcpy parameter values to output (Default to False) + memset_node_params : bool + Adds memset parameter values to output (Default to False) + host_node_params : bool + Adds host parameter values to output (Default to False) + event_node_params : bool + Adds event parameter values to output (Default to False) + ext_semas_signal_node_params : bool + Adds external semaphore signal parameter values to output (Default to False) + ext_semas_wait_node_params : bool + Adds external semaphore wait parameter values to output (Default to False) + kernel_node_attributes : bool + Adds kernel node attributes to output (Default to False) + handles : bool + Adds node handles and every kernel function handle to output (Default to False) + mem_alloc_node_params : bool + Adds memory alloc parameter values to output (Default to False) + mem_free_node_params : bool + Adds memory free parameter values to output (Default to False) + batch_mem_op_node_params : bool + Adds batch mem op parameter values to output (Default to False) + extra_topo_info : bool + Adds edge numbering information (Default to False) + conditional_node_params : bool + Adds conditional node parameter values to output (Default to False) + + """ + + verbose: bool = False + runtime_types: bool = False + kernel_node_params: bool = False + memcpy_node_params: bool = False + memset_node_params: bool = False + host_node_params: bool = False + event_node_params: bool = False + ext_semas_signal_node_params: bool = False + ext_semas_wait_node_params: bool = False + kernel_node_attributes: bool = False + handles: bool = False + mem_alloc_node_params: bool = False + mem_free_node_params: bool = False + batch_mem_op_node_params: bool = False + extra_topo_info: bool = False + conditional_node_params: bool = False + + def _to_flags(self) -> int: + """Convert options to CUDA driver API flags (internal use).""" + flags = 0 + if self.verbose: + flags |= driver.CUgraphDebugDot_flags.CU_GRAPH_DEBUG_DOT_FLAGS_VERBOSE + if self.runtime_types: + flags |= driver.CUgraphDebugDot_flags.CU_GRAPH_DEBUG_DOT_FLAGS_RUNTIME_TYPES + if self.kernel_node_params: + flags |= driver.CUgraphDebugDot_flags.CU_GRAPH_DEBUG_DOT_FLAGS_KERNEL_NODE_PARAMS + if self.memcpy_node_params: + flags |= driver.CUgraphDebugDot_flags.CU_GRAPH_DEBUG_DOT_FLAGS_MEMCPY_NODE_PARAMS + if self.memset_node_params: + flags |= driver.CUgraphDebugDot_flags.CU_GRAPH_DEBUG_DOT_FLAGS_MEMSET_NODE_PARAMS + if self.host_node_params: + flags |= driver.CUgraphDebugDot_flags.CU_GRAPH_DEBUG_DOT_FLAGS_HOST_NODE_PARAMS + if self.event_node_params: + flags |= driver.CUgraphDebugDot_flags.CU_GRAPH_DEBUG_DOT_FLAGS_EVENT_NODE_PARAMS + if self.ext_semas_signal_node_params: + flags |= driver.CUgraphDebugDot_flags.CU_GRAPH_DEBUG_DOT_FLAGS_EXT_SEMAS_SIGNAL_NODE_PARAMS + if self.ext_semas_wait_node_params: + flags |= driver.CUgraphDebugDot_flags.CU_GRAPH_DEBUG_DOT_FLAGS_EXT_SEMAS_WAIT_NODE_PARAMS + if self.kernel_node_attributes: + flags |= driver.CUgraphDebugDot_flags.CU_GRAPH_DEBUG_DOT_FLAGS_KERNEL_NODE_ATTRIBUTES + if self.handles: + flags |= driver.CUgraphDebugDot_flags.CU_GRAPH_DEBUG_DOT_FLAGS_HANDLES + if self.mem_alloc_node_params: + flags |= driver.CUgraphDebugDot_flags.CU_GRAPH_DEBUG_DOT_FLAGS_MEM_ALLOC_NODE_PARAMS + if self.mem_free_node_params: + flags |= driver.CUgraphDebugDot_flags.CU_GRAPH_DEBUG_DOT_FLAGS_MEM_FREE_NODE_PARAMS + if self.batch_mem_op_node_params: + flags |= driver.CUgraphDebugDot_flags.CU_GRAPH_DEBUG_DOT_FLAGS_BATCH_MEM_OP_NODE_PARAMS + if self.extra_topo_info: + flags |= driver.CUgraphDebugDot_flags.CU_GRAPH_DEBUG_DOT_FLAGS_EXTRA_TOPO_INFO + if self.conditional_node_params: + flags |= driver.CUgraphDebugDot_flags.CU_GRAPH_DEBUG_DOT_FLAGS_CONDITIONAL_NODE_PARAMS + return flags + + +@dataclass +class GraphCompleteOptions: + """Options for graph instantiation. + + Attributes + ---------- + auto_free_on_launch : bool, optional + Automatically free memory allocated in a graph before relaunching. (Default to False) + upload_stream : Stream, optional + Stream to use to automatically upload the graph after completion. (Default to None) + device_launch : bool, optional + Configure the graph to be launchable from the device. This flag can only + be used on platforms which support unified addressing. This flag cannot be + used in conjunction with auto_free_on_launch. (Default to False) + use_node_priority : bool, optional + Run the graph using the per-node priority attributes rather than the + priority of the stream it is launched into. (Default to False) + + """ + + auto_free_on_launch: bool = False + upload_stream: Stream | None = None + device_launch: bool = False + use_node_priority: bool = False + + +def _instantiate_graph(h_graph, options: GraphCompleteOptions | None = None) -> Graph: + cdef cydriver.CUgraphExec c_exec + params = driver.CUDA_GRAPH_INSTANTIATE_PARAMS() + if options: + flags = 0 + if options.auto_free_on_launch: + flags |= driver.CUgraphInstantiate_flags.CUDA_GRAPH_INSTANTIATE_FLAG_AUTO_FREE_ON_LAUNCH + if options.upload_stream: + flags |= driver.CUgraphInstantiate_flags.CUDA_GRAPH_INSTANTIATE_FLAG_UPLOAD + params.hUploadStream = options.upload_stream.handle + if options.device_launch: + flags |= driver.CUgraphInstantiate_flags.CUDA_GRAPH_INSTANTIATE_FLAG_DEVICE_LAUNCH + if options.use_node_priority: + flags |= driver.CUgraphInstantiate_flags.CUDA_GRAPH_INSTANTIATE_FLAG_USE_NODE_PRIORITY + params.flags = flags + + py_exec = handle_return(driver.cuGraphInstantiateWithParams(h_graph, params)) + # Check result_out before wrapping the exec: on a non-SUCCESS result the exec + # may be invalid, and Graph._init's RAII deleter would call cuGraphExecDestroy + # on it during the exception unwind below. + if params.result_out == driver.CUgraphInstantiateResult.CUDA_GRAPH_INSTANTIATE_ERROR: + raise RuntimeError( + "Instantiation failed for an unexpected reason which is described in the return value of the function." + ) + elif params.result_out == driver.CUgraphInstantiateResult.CUDA_GRAPH_INSTANTIATE_INVALID_STRUCTURE: + raise RuntimeError("Instantiation failed due to invalid structure, such as cycles.") + elif params.result_out == driver.CUgraphInstantiateResult.CUDA_GRAPH_INSTANTIATE_NODE_OPERATION_NOT_SUPPORTED: + raise RuntimeError( + "Instantiation for device launch failed because the graph contained an unsupported operation." + ) + elif params.result_out == driver.CUgraphInstantiateResult.CUDA_GRAPH_INSTANTIATE_MULTIPLE_CTXS_NOT_SUPPORTED: + raise RuntimeError("Instantiation for device launch failed due to the nodes belonging to different contexts.") + elif ( + cy_binding_version() >= (12, 8, 0) + and params.result_out == driver.CUgraphInstantiateResult.CUDA_GRAPH_INSTANTIATE_CONDITIONAL_HANDLE_UNUSED + ): + raise RuntimeError("One or more conditional handles are not associated with conditional builders.") + elif params.result_out != driver.CUgraphInstantiateResult.CUDA_GRAPH_INSTANTIATE_SUCCESS: + raise RuntimeError(f"Graph instantiation failed with unexpected error code: {params.result_out}") + + c_exec = int(py_exec) + return Graph._init(c_exec) + + +# Distinguishes the three kinds of GraphBuilder, which differ in how they +# begin/end stream capture and whether they own the resulting CUgraph. +# Each kind progresses through _CaptureState as follows: +# +# PRIMARY: NOT_STARTED -> CAPTURING -> ENDED +# FORKED: CAPTURING (never transitions; joined and closed) +# CONDITIONAL_BODY: NOT_STARTED -> CAPTURING -> ENDED +# +cdef enum _BuilderKind: + # PRIMARY: The top-level builder created by Device or Stream. Owns the + # captured CUgraph via an owning GraphHandle. Progresses through all three + # capture states; responsible for ending capture if destroyed early. + PRIMARY = 0 + # FORKED: Created by split(). Captures on a private stream forked from the + # primary. Starts in CAPTURING state and never transitions; the user joins + # it back to the primary via join(), which closes the builder. Must NOT + # call cuStreamEndCapture (the driver requires all forked streams to be + # joined first). + FORKED = 1 + # CONDITIONAL_BODY: Created by if_then/if_else/switch/while_loop. Captures + # into a non-owned body graph via cuStreamBeginCaptureToGraph. The body + # graph's lifetime is tied to a parent graph. Progresses through all three + # capture states like PRIMARY. + CONDITIONAL_BODY = 2 + + +# Tracks the capture lifecycle of a GraphBuilder. +cdef enum _CaptureState: + CAPTURE_NOT_STARTED = 0 + CAPTURING = 1 + CAPTURE_ENDED = 2 # Finished, valid handle + CLOSED = 3 # No valid handle + + +cdef class GraphBuilder: + """A graph under construction by stream capture. + + A graph groups a set of CUDA kernels and other CUDA operations together and executes + them with a specified dependency tree. It speeds up the workflow by combining the + driver activities associated with CUDA kernel launches and CUDA API calls. + + Directly creating a :obj:`~graph.GraphBuilder` is not supported due + to ambiguity. New graph builders should instead be created through a + :obj:`~_device.Device`, or a :obj:`~_stream.stream` object. + + .. note:: + + Operations recorded during capture reference your memory but do not + take ownership of it. As with ordinary stream work, you must keep the + operands alive for as long as the completed graph may execute -- for + example, the :obj:`~_memory.Buffer` objects passed to :func:`~launch` + or :meth:`~_memory.Buffer.copy_to`. Host callbacks added with + :meth:`callback` are the exception: the callable (and any copied + ``user_data``) are retained for the graph's lifetime. This differs from + building a graph explicitly with :class:`~graph.GraphDefinition`, which + retains the operands it is given. + + """ + + def __init__(self): + raise NotImplementedError( + "directly creating a GraphBuilder object can be ambiguous. Please either " + "call Device.create_graph_builder() or stream.create_graph_builder()" + ) + + def __dealloc__(self): + GB_end_capture_if_needed(self, False) + + @staticmethod + def _init(Stream stream): + cdef GraphBuilder self = GraphBuilder.__new__(GraphBuilder) + # _h_graph set by begin_building + self._h_stream = stream._h_stream + self._kind = PRIMARY + self._state = CAPTURE_NOT_STARTED + self._stream = stream + return self + + def close(self): + """Destroy the graph builder.""" + GB_end_capture_if_needed(self, True) + self._h_graph.reset() + self._h_stream.reset() + self._state = CLOSED + self._stream = None + + @property + def stream(self) -> Stream: + """Returns the stream associated with the graph builder.""" + return self._stream + + @property + def is_join_required(self) -> bool: + """Returns True if this graph builder must be joined before building is ended.""" + return self._kind == FORKED + + @property + def graph_definition(self) -> GraphDefinition: + """The captured graph as an explicit :class:`~graph.GraphDefinition`. + + .. versionadded:: 1.1.0 + + The returned :class:`~graph.GraphDefinition` is a view of the same + graph this builder is producing: nodes added through it appear in + subsequent :meth:`complete` and :meth:`debug_dot_print` calls, and + the view stays valid even after the builder is closed. + + This lets you mix the capture and explicit APIs on a single graph, + for example to inspect what was captured, augment it with extra + nodes, or build a conditional body entirely with the explicit API. + + Availability: + + - **Primary builders** (created by :meth:`Device.create_graph_builder` + or :meth:`Stream.create_graph_builder`): only after + :meth:`end_building`. + + - **Conditional-body builders** (returned by :meth:`if_then`, + :meth:`if_else`, :meth:`while_loop`, :meth:`switch`): both before + :meth:`begin_building` and after :meth:`end_building`. The body + graph already exists when the conditional is created, so you may + populate it through this view without ever calling + :meth:`begin_building` on the body builder. + + - **Forked builders** (returned by :meth:`split`): never. Forked + builders share the primary builder's graph; access it through the + primary instead. + + Returns + ------- + GraphDefinition + A view of the graph being built. + + Raises + ------ + RuntimeError + If the builder is closed, forked, currently building, or (for + primary builders) has not started building yet. A + :class:`~graph.GraphDefinition` obtained before :meth:`close` + keeps working; only fresh access through this property is + rejected once the builder is closed. + """ + GB_check_open(self) + if self._kind == FORKED: + raise RuntimeError( + "graph_definition is unavailable on forked graph builders; " + "access it through the primary builder instead." + ) + elif self._state == CAPTURING: + raise RuntimeError( + "graph_definition is unavailable while capture is in " + "progress; call end_building() first." + ) + elif self._kind == PRIMARY: + if self._state == CAPTURE_NOT_STARTED: + raise RuntimeError( + "graph_definition is unavailable before begin_building() on " + "a primary builder; no graph has been created yet." + ) + return GraphDefinition._from_handle(self._h_graph) + + def begin_building(self, mode: str | None = "relaxed") -> GraphBuilder: + """Begins the building process. + + Build `mode` for controlling interaction with other API calls must be one of the following: + + - `global` : Prohibit potentially unsafe operations across all streams in the process. + - `thread_local` : Prohibit potentially unsafe operations in streams created by the current thread. + - `relaxed` : The local thread is not prohibited from potentially unsafe operations. + + Parameters + ---------- + mode : str, optional + Build mode to control the interaction with other API calls that are porentially unsafe. + Default set to use relaxed. + + """ + GB_check_open(self) + if self._state != CAPTURE_NOT_STARTED: + if self._state == CAPTURING: + raise RuntimeError("Graph builder is already building.") + else: + raise RuntimeError("Cannot resume building after building has ended.") + cdef cydriver.CUstreamCaptureMode c_mode + if mode == "global": + c_mode = cydriver.CU_STREAM_CAPTURE_MODE_GLOBAL + elif mode == "thread_local": + c_mode = cydriver.CU_STREAM_CAPTURE_MODE_THREAD_LOCAL + elif mode == "relaxed": + c_mode = cydriver.CU_STREAM_CAPTURE_MODE_RELAXED + else: + raise ValueError(f"Unsupported build mode: {mode}") + + cdef cydriver.CUstream c_stream = as_cu(self._h_stream) + cdef cydriver.CUgraph c_graph + cdef cydriver.CUstreamCaptureStatus c_status + if self._kind == CONDITIONAL_BODY: + c_graph = as_cu(self._h_graph) + with nogil: + HANDLE_RETURN(cydriver.cuStreamBeginCaptureToGraph( + c_stream, c_graph, NULL, NULL, 0, c_mode)) + self._state = CAPTURING + else: + with nogil: + HANDLE_RETURN(cydriver.cuStreamBeginCapture(c_stream, c_mode)) + # Capture is active now; set CAPTURING before the calls below so a + # failure in _get_capture_info/create_graph_handle still lets + # cleanup end the capture rather than leaving the stream poisoned. + self._state = CAPTURING + with nogil: + # The driver rejects a NULL captureStatus_out, so pass a + # stack-local even though we only want the graph handle. + _get_capture_info(c_stream, &c_status, &c_graph) + self._h_graph = create_graph_handle(c_graph) + return self + + @property + def is_building(self) -> bool: + """Returns True if the graph builder is currently building.""" + GB_check_open(self) + cdef cydriver.CUstream c_stream = as_cu(self._h_stream) + cdef cydriver.CUstreamCaptureStatus status + with nogil: + _get_capture_info(c_stream, &status, NULL) + if status == cydriver.CU_STREAM_CAPTURE_STATUS_NONE: + return False + elif status == cydriver.CU_STREAM_CAPTURE_STATUS_ACTIVE: + return True + elif status == cydriver.CU_STREAM_CAPTURE_STATUS_INVALIDATED: + raise RuntimeError( + "Build process encountered an error and has been invalidated. Build process must now be ended." + ) + else: + raise NotImplementedError(f"Unsupported capture status type received: {status}") + + def end_building(self) -> GraphBuilder: + """Ends the building process.""" + GB_check_open(self) + if not self.is_building: + raise RuntimeError("Graph builder is not building.") + cdef cydriver.CUstream c_stream = as_cu(self._h_stream) + cdef cydriver.CUgraph c_graph + with nogil: + HANDLE_RETURN(cydriver.cuStreamEndCapture(c_stream, &c_graph)) + + # TODO: Resolving https://github.com/NVIDIA/cuda-python/issues/617 would allow us to + # resume the build process after the first call to end_building() + self._state = CAPTURE_ENDED + return self + + def complete(self, options: GraphCompleteOptions | None = None) -> Graph: + """Completes the graph builder and returns the built :obj:`~graph.Graph` object. + + Parameters + ---------- + options : :obj:`~graph.GraphCompleteOptions`, optional + Customizable dataclass for the graph builder completion options. + + Returns + ------- + graph : :obj:`~graph.Graph` + The newly built graph. + + """ + GB_check_open(self) + if self._state != CAPTURE_ENDED: + raise RuntimeError("Graph has not finished building.") + + return _instantiate_graph(as_py(self._h_graph), options) + + def debug_dot_print(self, path: str, options: GraphDebugPrintOptions | None = None) -> None: + """Generates a DOT debug file for the graph builder. + + Parameters + ---------- + path : str + File path to use for writting debug DOT output + options : :obj:`~graph.GraphDebugPrintOptions`, optional + Customizable dataclass for the debug print options. + + """ + GB_check_open(self) + if self._state != CAPTURE_ENDED: + raise RuntimeError("Graph has not finished building.") + cdef unsigned int c_flags = options._to_flags() if options else 0 + cdef cydriver.CUgraph c_graph = as_cu(self._h_graph) + cdef bytes b_path = path.encode('utf-8') + cdef const char* c_path = b_path + with nogil: + HANDLE_RETURN(cydriver.cuGraphDebugDotPrint(c_graph, c_path, c_flags)) + + def split(self, count: int) -> tuple[GraphBuilder, ...]: + """Splits the original graph builder into multiple graph builders. + + The new builders inherit work dependencies from the original builder. + The original builder is reused for the split and is returned first in the tuple. + + Parameters + ---------- + count : int + The number of graph builders to split the graph builder into. + + Returns + ------- + graph_builders : tuple[:obj:`~graph.GraphBuilder`, ...] + A tuple of split graph builders. The first graph builder in the tuple + is always the original graph builder. + + """ + if count < 2: + raise ValueError(f"Invalid split count: expecting >= 2, got {count}") + GB_check_open(self) + if self._state != CAPTURING: + raise RuntimeError("Graph builder must be building before it can be split.") + + event = self._stream.record() + result = [self] + for i in range(count - 1): + stream = self._stream.device.create_stream() + stream.wait(event) + result.append(GB_init_forked(stream, self._h_graph)) + event.close() + return tuple(result) + + @staticmethod + def join(*graph_builders: GraphBuilder) -> GraphBuilder: + """Joins multiple graph builders into a single graph builder. + + The returned builder inherits work dependencies from the provided builders. + + Parameters + ---------- + *graph_builders : :obj:`~graph.GraphBuilder` + The graph builders to join. + + Returns + ------- + graph_builder : :obj:`~graph.GraphBuilder` + The newly joined graph builder. + + """ + if any(not isinstance(builder, GraphBuilder) for builder in graph_builders): + raise TypeError("All arguments must be GraphBuilder instances") + if len(graph_builders) < 2: + raise ValueError("Must join with at least two graph builders") + + # Discover the root builder others should join + root_idx = 0 + for i, builder in enumerate(graph_builders): + if not builder.is_join_required: + root_idx = i + break + + # Join all onto the root builder + root_bdr = graph_builders[root_idx] + for idx, builder in enumerate(graph_builders): + if idx == root_idx: + continue + root_bdr.stream.wait(builder.stream) + builder.close() + + return root_bdr + + def __cuda_stream__(self) -> tuple[int, int]: + """Return an instance of a __cuda_stream__ protocol.""" + GB_check_open(self) + return self.stream.__cuda_stream__() + + def _get_conditional_context(self) -> driver.CUcontext: + return self._stream.context.handle + + def create_condition(self, default_value: int | None = None) -> GraphCondition: + """Create a condition variable for use with conditional nodes. + + The returned :class:`GraphCondition` object is passed to conditional-node + builder methods (:meth:`if_then`, :meth:`if_else`, :meth:`while_loop`, + :meth:`switch`). Its value is controlled at runtime by device code via + ``cudaGraphSetConditional``. + + Parameters + ---------- + default_value : int, optional + The default value to assign to the condition. If None, no + default is assigned. + + Returns + ------- + GraphCondition + A condition variable for controlling conditional execution. + """ + GB_check_open(self) + if cy_driver_version() < (12, 3, 0): + raise RuntimeError(f"Driver version {'.'.join(map(str, cy_driver_version()))} does not support conditional handles") + if cy_binding_version() < (12, 3, 0): + raise RuntimeError(f"Binding version {'.'.join(map(str, cy_binding_version()))} does not support conditional handles") + if default_value is not None: + flags = driver.CU_GRAPH_COND_ASSIGN_DEFAULT + else: + default_value = 0 + flags = 0 + + status, _, graph, *_, _ = handle_return(driver.cuStreamGetCaptureInfo(self._stream.handle)) + if status != driver.CUstreamCaptureStatus.CU_STREAM_CAPTURE_STATUS_ACTIVE: + raise RuntimeError("Cannot create a condition when graph is not being built") + + raw_handle = handle_return( + driver.cuGraphConditionalHandleCreate(graph, self._get_conditional_context(), default_value, flags) + ) + return GraphCondition._from_handle(int(raw_handle)) + + def if_then(self, condition: GraphCondition) -> GraphBuilder: + """Adds an if condition branch and returns a new graph builder for it. + + The resulting if graph will only execute the branch if the + condition evaluates to true at runtime. + + The new builder inherits work dependencies from the original builder. + + Parameters + ---------- + condition : :class:`~graph.GraphCondition` + The condition variable from :meth:`create_condition` controlling + whether the branch executes. + + Returns + ------- + graph_builder : :obj:`~graph.GraphBuilder` + The newly created conditional graph builder. + + """ + GB_check_open(self) + if cy_driver_version() < (12, 3, 0): + raise RuntimeError(f"Driver version {'.'.join(map(str, cy_driver_version()))} does not support conditional if") + if cy_binding_version() < (12, 3, 0): + raise RuntimeError(f"Binding version {'.'.join(map(str, cy_binding_version()))} does not support conditional if") + if not isinstance(condition, GraphCondition): + raise TypeError( + f"condition must be a GraphCondition object (from " + f"GraphBuilder.create_condition()), got {type(condition).__name__}") + node_params = driver.CUgraphNodeParams() + node_params.type = driver.CUgraphNodeType.CU_GRAPH_NODE_TYPE_CONDITIONAL + node_params.conditional.handle = condition.handle + node_params.conditional.type = driver.CUgraphConditionalNodeType.CU_GRAPH_COND_TYPE_IF + node_params.conditional.size = 1 + node_params.conditional.ctx = self._get_conditional_context() + return GB_cond_with_params(self, node_params)[0] + + def if_else(self, condition: GraphCondition) -> tuple[GraphBuilder, GraphBuilder]: + """Adds an if-else condition branch and returns new graph builders for both branches. + + The resulting if graph will execute the branch if the condition + evaluates to true at runtime, otherwise the else branch will execute. + + The new builders inherit work dependencies from the original builder. + + Parameters + ---------- + condition : :class:`~graph.GraphCondition` + The condition variable from :meth:`create_condition` controlling + which branch executes. + + Returns + ------- + graph_builders : tuple[:obj:`~graph.GraphBuilder`, :obj:`~graph.GraphBuilder`] + A tuple of two new graph builders, one for the if branch and one for the else branch. + + """ + GB_check_open(self) + if cy_driver_version() < (12, 8, 0): + raise RuntimeError(f"Driver version {'.'.join(map(str, cy_driver_version()))} does not support conditional if-else") + if cy_binding_version() < (12, 8, 0): + raise RuntimeError(f"Binding version {'.'.join(map(str, cy_binding_version()))} does not support conditional if-else") + if not isinstance(condition, GraphCondition): + raise TypeError( + f"condition must be a GraphCondition object (from " + f"GraphBuilder.create_condition()), got {type(condition).__name__}") + node_params = driver.CUgraphNodeParams() + node_params.type = driver.CUgraphNodeType.CU_GRAPH_NODE_TYPE_CONDITIONAL + node_params.conditional.handle = condition.handle + node_params.conditional.type = driver.CUgraphConditionalNodeType.CU_GRAPH_COND_TYPE_IF + node_params.conditional.size = 2 + node_params.conditional.ctx = self._get_conditional_context() + return GB_cond_with_params(self, node_params) + + def switch(self, condition: GraphCondition, count: int) -> tuple[GraphBuilder, ...]: + """Adds a switch condition branch and returns new graph builders for all cases. + + The resulting switch graph will execute the branch whose case index + matches the value of the condition at runtime. If no match is found, no + branch will be executed. + + The new builders inherit work dependencies from the original builder. + + Parameters + ---------- + condition : :class:`~graph.GraphCondition` + The condition variable from :meth:`create_condition` selecting + which case executes. + count : int + The number of cases to add to the switch conditional. + + Returns + ------- + graph_builders : tuple[:obj:`~graph.GraphBuilder`, ...] + A tuple of new graph builders, one for each branch. + + """ + GB_check_open(self) + if cy_driver_version() < (12, 8, 0): + raise RuntimeError(f"Driver version {'.'.join(map(str, cy_driver_version()))} does not support conditional switch") + if cy_binding_version() < (12, 8, 0): + raise RuntimeError(f"Binding version {'.'.join(map(str, cy_binding_version()))} does not support conditional switch") + if not isinstance(condition, GraphCondition): + raise TypeError( + f"condition must be a GraphCondition object (from " + f"GraphBuilder.create_condition()), got {type(condition).__name__}") + node_params = driver.CUgraphNodeParams() + node_params.type = driver.CUgraphNodeType.CU_GRAPH_NODE_TYPE_CONDITIONAL + node_params.conditional.handle = condition.handle + node_params.conditional.type = driver.CUgraphConditionalNodeType.CU_GRAPH_COND_TYPE_SWITCH + node_params.conditional.size = count + node_params.conditional.ctx = self._get_conditional_context() + return GB_cond_with_params(self, node_params) + + def while_loop(self, condition: GraphCondition) -> GraphBuilder: + """Adds a while loop and returns a new graph builder for it. + + The resulting while loop graph will execute the branch repeatedly at runtime + until the condition evaluates to false. + + The new builder inherits work dependencies from the original builder. + + Parameters + ---------- + condition : :class:`~graph.GraphCondition` + The condition variable from :meth:`create_condition` controlling + loop continuation. + + Returns + ------- + graph_builder : :obj:`~graph.GraphBuilder` + The newly created while loop graph builder. + + """ + GB_check_open(self) + if cy_driver_version() < (12, 3, 0): + raise RuntimeError(f"Driver version {'.'.join(map(str, cy_driver_version()))} does not support conditional while loop") + if cy_binding_version() < (12, 3, 0): + raise RuntimeError(f"Binding version {'.'.join(map(str, cy_binding_version()))} does not support conditional while loop") + if not isinstance(condition, GraphCondition): + raise TypeError( + f"condition must be a GraphCondition object (from " + f"GraphBuilder.create_condition()), got {type(condition).__name__}") + node_params = driver.CUgraphNodeParams() + node_params.type = driver.CUgraphNodeType.CU_GRAPH_NODE_TYPE_CONDITIONAL + node_params.conditional.handle = condition.handle + node_params.conditional.type = driver.CUgraphConditionalNodeType.CU_GRAPH_COND_TYPE_WHILE + node_params.conditional.size = 1 + node_params.conditional.ctx = self._get_conditional_context() + return GB_cond_with_params(self, node_params)[0] + + def embed(self, GraphBuilder child): + """Embed a previously-built :obj:`~graph.GraphBuilder` as a child node. + + Parameters + ---------- + child : :obj:`~graph.GraphBuilder` + The child graph builder. Must have finished building. + """ + GB_check_open(self) + if child._state != CAPTURE_ENDED: + raise ValueError("Child graph has not finished building.") + + if not self.is_building: + raise ValueError("Parent graph is not being built.") + + stream_handle = self._stream.handle + _, _, graph_out, *deps_info_out, num_dependencies_out = handle_return( + driver.cuStreamGetCaptureInfo(stream_handle) + ) + + # See https://github.com/NVIDIA/cuda-python/pull/879#issuecomment-3211054159 + # for rationale + deps_info_trimmed = deps_info_out[:num_dependencies_out] + deps_info_update = [ + [ + handle_return( + driver.cuGraphAddChildGraphNode( + graph_out, *deps_info_trimmed, num_dependencies_out, as_py(child._h_graph) + ) + ) + ] + ] + [None] * (len(deps_info_out) - 1) + handle_return( + driver.cuStreamUpdateCaptureDependencies( + stream_handle, + *deps_info_update, # dependencies, edgeData + 1, + driver.CUstreamUpdateCaptureDependencies_flags.CU_STREAM_SET_CAPTURE_DEPENDENCIES, + ) + ) + + def callback(self, fn, *, user_data=None) -> None: + """Add a host callback to the graph during stream capture. + + The callback runs on the host CPU when the graph reaches this point + in execution. Two modes are supported: + + - **Python callable**: Pass any callable. The GIL is acquired + automatically. The callable must take no arguments; use closures + or ``functools.partial`` to bind state. + - **ctypes function pointer**: Pass a ``ctypes.CFUNCTYPE`` instance. + The function receives a single ``void*`` argument (the + ``user_data``). The caller must keep the ctypes wrapper alive + for the lifetime of the graph. + + .. warning:: + + Callbacks must not call CUDA API functions. Doing so may + deadlock or corrupt driver state. + + Parameters + ---------- + fn : callable or ctypes function pointer + The callback function. + user_data : int or bytes-like, optional + Only for ctypes function pointers. If ``int``, passed as a raw + pointer (caller manages lifetime). If bytes-like, the data is + copied and its lifetime is tied to the graph. + """ + GB_check_open(self) + cdef Stream stream = self._stream + cdef cydriver.CUstream c_stream = as_cu(stream._h_stream) + cdef cydriver.CUstreamCaptureStatus capture_status + + with nogil: + _get_capture_info(c_stream, &capture_status, NULL) + + if capture_status != cydriver.CU_STREAM_CAPTURE_STATUS_ACTIVE: + raise RuntimeError("Cannot add callback when graph is not being built") + + cdef cydriver.CUhostFn c_fn + cdef void* c_user_data = NULL + cdef OpaqueHandle fn_owner, data_owner + _resolve_host_callback(fn, user_data, &c_fn, &c_user_data, &fn_owner, &data_owner) + + with nogil: + HANDLE_RETURN(cydriver.cuLaunchHostFunc(c_stream, c_fn, c_user_data)) + + # Capturing the host function added a node to the graph; it is now the + # stream's sole capture dependency. Key the callback's owners to it so + # they live in the graph's slot table like any explicitly-added node. + cdef cydriver.CUgraphNode host_node = _capture_tail_node(c_stream) + _attach_host_callback_owners(self._h_graph, host_node, fn_owner, data_owner) + + +cdef inline int GB_check_open(GraphBuilder gb) except -1: + """Reject operations on a builder that has been closed. + + A CLOSED builder has reset its stream and graph handles, so any method + that dereferences them would read a null handle (or, for the cached + Stream, a None typed as cdef Stream). Guarding here yields a clear error + instead. + """ + if gb._state == CLOSED: + raise RuntimeError("Graph builder has been closed.") + return 0 + + +cdef inline int GB_end_capture_if_needed(GraphBuilder gb, bint check_status) except -1 nogil: + """End an in-progress capture if this builder owns it. + + Only a CAPTURING PRIMARY or CONDITIONAL_BODY builder owns the live + capture. A FORKED builder must not call cuStreamEndCapture: the driver + requires forked streams to be joined first. + + check_status=True checks the driver return (close()); False ignores it + (__dealloc__). + """ + cdef cydriver.CUgraph c_graph + cdef cydriver.CUresult err + cdef cydriver.CUstream c_stream + if gb._h_stream and gb._state == CAPTURING and gb._kind != FORKED: + c_stream = as_cu(gb._h_stream) + with nogil: + err = cydriver.cuStreamEndCapture(c_stream, &c_graph) + if check_status: + HANDLE_RETURN(err) + return 0 + + +cdef inline GraphBuilder GB_init_forked(Stream stream, GraphHandle h_primary_graph): + cdef GraphBuilder gb = GraphBuilder.__new__(GraphBuilder) + # A FORKED builder captures into the primary's CUgraph. It holds the + # primary's GraphHandle so conditional bodies created on it (via + # GB_init_conditional -> create_graph_handle_ref(cond_graph, parent._h_graph)) + # have a valid parent handle to pin. + gb._h_graph = h_primary_graph + gb._h_stream = stream._h_stream + gb._kind = FORKED + gb._state = CAPTURING + gb._stream = stream + return gb + + +cdef inline GraphBuilder GB_init_conditional(Stream stream, cydriver.CUgraph cond_graph, GraphBuilder parent): + cdef GraphBuilder gb = GraphBuilder.__new__(GraphBuilder) + gb._h_graph = create_graph_handle_ref(cond_graph, parent._h_graph) + gb._h_stream = stream._h_stream + gb._kind = CONDITIONAL_BODY + gb._state = CAPTURE_NOT_STARTED + gb._stream = stream + return gb + + +cdef inline int _get_capture_info( + cydriver.CUstream stream, + cydriver.CUstreamCaptureStatus* status, + cydriver.CUgraph* graph) except?-1 nogil: + """Thin wrapper around ``cuStreamGetCaptureInfo`` that papers over the + CUDA 12 vs 13 signature change. + + ``status`` must be non-NULL: the driver rejects ``captureStatus_out=NULL`` + with ``CUDA_ERROR_INVALID_VALUE``. ``graph`` may be NULL when the caller + does not need the graph handle. + """ + IF CUDA_CORE_BUILD_MAJOR >= 13: + return HANDLE_RETURN(cydriver.cuStreamGetCaptureInfo( + stream, status, NULL, graph, NULL, NULL, NULL)) + ELSE: + return HANDLE_RETURN(cydriver.cuStreamGetCaptureInfo( + stream, status, NULL, graph, NULL, NULL)) + + +cdef inline cydriver.CUgraphNode _capture_tail_node(cydriver.CUstream stream) except *: + """Return the node a freshly-captured single-node operation left as the + stream's sole capture dependency (e.g. the host node added by + ``cuLaunchHostFunc``). The driver advances the stream's dependency set to + the new node, so the next captured op would depend on it. + """ + cdef cydriver.CUstreamCaptureStatus status + cdef const cydriver.CUgraphNode* deps = NULL + cdef size_t num_deps = 0 + with nogil: + IF CUDA_CORE_BUILD_MAJOR >= 13: + HANDLE_RETURN(cydriver.cuStreamGetCaptureInfo( + stream, &status, NULL, NULL, &deps, NULL, &num_deps)) + ELSE: + HANDLE_RETURN(cydriver.cuStreamGetCaptureInfo( + stream, &status, NULL, NULL, &deps, &num_deps)) + if num_deps != 1: + raise RuntimeError( + f"expected exactly one capture dependency after a host callback, got {num_deps}") + return deps[0] + + +cdef inline tuple GB_cond_with_params(GraphBuilder gb, node_params): + status, _, graph, *deps_info, num_dependencies = handle_return( + driver.cuStreamGetCaptureInfo(gb._stream.handle) + ) + if status != driver.CUstreamCaptureStatus.CU_STREAM_CAPTURE_STATUS_ACTIVE: + raise RuntimeError("Cannot add conditional node when not actively capturing") + + deps_info_update = [ + [handle_return(driver.cuGraphAddNode(graph, *deps_info, num_dependencies, node_params))] + ] + [None] * (len(deps_info) - 1) + + handle_return( + driver.cuStreamUpdateCaptureDependencies( + gb._stream.handle, + *deps_info_update, # dependencies, edgeData + 1, # numDependencies + driver.CUstreamUpdateCaptureDependencies_flags.CU_STREAM_SET_CAPTURE_DEPENDENCIES, + ) + ) + + return tuple( + GB_init_conditional( + gb._stream.device.create_stream(), + int(node_params.conditional.phGraph_out[i]), + gb, + ) + for i in range(node_params.conditional.size) + ) + + +cdef class Graph: + """An executable graph. + + A graph groups a set of CUDA kernels and other CUDA operations together and executes + them with a specified dependency tree. It speeds up the workflow by combining the + driver activities associated with CUDA kernel launches and CUDA API calls. + + Graphs must be built using a :obj:`~graph.GraphBuilder` object. + + """ + + def __init__(self): + raise RuntimeError("directly constructing a Graph instance is not supported") + + @staticmethod + cdef Graph _init(cydriver.CUgraphExec graph_exec): + cdef Graph self = Graph.__new__(Graph) + self._h_graph_exec = create_graph_exec_handle(graph_exec) + return self + + def close(self) -> None: + """Destroy the graph.""" + self._h_graph_exec.reset() + + @property + def handle(self) -> driver.CUgraphExec: + """Return the underlying ``CUgraphExec`` object. + + .. caution:: + + This handle is a Python object. To get the memory address of the underlying C + handle, call ``int()`` on the returned object. + + """ + return as_py(self._h_graph_exec) + + def update(self, source: "GraphBuilder | GraphDefinition") -> None: + """Update the graph using a new graph definition. + + The topology of the provided source must be identical to this graph. + + Parameters + ---------- + source : :obj:`~graph.GraphBuilder` or :obj:`~graph.GraphDefinition` + The graph definition to update from. A GraphBuilder must have + finished building. + + """ + from cuda.core.graph import GraphDefinition + + cdef cydriver.CUgraph cu_graph + cdef cydriver.CUgraphExec cu_exec = as_cu(self._h_graph_exec) + + if isinstance(source, GraphBuilder): + if (source)._state == CLOSED: + raise ValueError("Source graph builder has been closed.") + if (source)._state != CAPTURE_ENDED: + raise ValueError("Graph has not finished building.") + cu_graph = as_cu((source)._h_graph) + elif isinstance(source, GraphDefinition): + cu_graph = int(source.handle) + else: + raise TypeError( + f"expected GraphBuilder or GraphDefinition, got {type(source).__name__}") + + cdef cydriver.CUgraphExecUpdateResultInfo result_info + cdef cydriver.CUresult err + with nogil: + err = cydriver.cuGraphExecUpdate(cu_exec, cu_graph, &result_info) + if err == cydriver.CUresult.CUDA_ERROR_GRAPH_EXEC_UPDATE_FAILURE: + reason = driver.CUgraphExecUpdateResult(result_info.result) + msg = f"Graph update failed: {reason.__doc__.strip()} ({reason.name})" + raise CUDAError(msg) + HANDLE_RETURN(err) + + def upload(self, stream: Stream) -> None: + """Uploads the graph in a stream. + + Parameters + ---------- + stream : :obj:`~_stream.Stream` + The stream in which to upload the graph + + """ + cdef cydriver.CUgraphExec c_exec = as_cu(self._h_graph_exec) + cdef cydriver.CUstream c_stream = int(stream.handle) + with nogil: + HANDLE_RETURN(cydriver.cuGraphUpload(c_exec, c_stream)) + + def launch(self, stream: Stream) -> None: + """Launches the graph in a stream. + + Parameters + ---------- + stream : :obj:`~_stream.Stream` + The stream in which to launch the graph. + + """ + cdef cydriver.CUgraphExec c_exec = as_cu(self._h_graph_exec) + cdef cydriver.CUstream c_stream = int(stream.handle) + with nogil: + HANDLE_RETURN(cydriver.cuGraphLaunch(c_exec, c_stream)) diff --git a/cuda_core/cuda/core/graph/_graph_definition.pxd b/cuda_core/cuda/core/graph/_graph_definition.pxd new file mode 100644 index 00000000000..6c15643c2fe --- /dev/null +++ b/cuda_core/cuda/core/graph/_graph_definition.pxd @@ -0,0 +1,24 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from cuda.bindings cimport cydriver +from cuda.core._resource_handles cimport GraphHandle + + +cdef class GraphCondition: + cdef: + cydriver.CUgraphConditionalHandle _c_handle + object __weakref__ + + @staticmethod + cdef GraphCondition _from_handle(cydriver.CUgraphConditionalHandle c_handle) + + +cdef class GraphDefinition: + cdef: + GraphHandle _h_graph + object __weakref__ + + @staticmethod + cdef GraphDefinition _from_handle(GraphHandle h_graph) diff --git a/cuda_core/cuda/core/graph/_graph_definition.pyi b/cuda_core/cuda/core/graph/_graph_definition.pyi new file mode 100644 index 00000000000..89652d879b0 --- /dev/null +++ b/cuda_core/cuda/core/graph/_graph_definition.pyi @@ -0,0 +1,244 @@ +# This file was generated by stubgen-pyx v0.2.6 from cuda_core/cuda/core/graph/_graph_definition.pyx + +"""GraphDefinition: explicit CUDA graph definition.""" +from __future__ import annotations + +from cuda.core._device import Device +from cuda.core._event import Event +from cuda.core._launch_config import LaunchConfig +from cuda.core._memory._buffer import Buffer +from cuda.core._module import Kernel +from cuda.core._utils.cuda_utils import driver +from cuda.core.graph._graph_builder import (Graph, GraphCompleteOptions, + GraphDebugPrintOptions) +from cuda.core.graph._graph_node import GraphNode +from cuda.core.graph._subclasses import (AllocNode, ChildGraphNode, EmptyNode, + EventRecordNode, EventWaitNode, + FreeNode, HostCallbackNode, + IfElseNode, IfNode, KernelNode, + MemcpyNode, MemsetNode, SwitchNode, + WhileNode) +from cuda.core.typing import GraphMemoryType + + +class GraphCondition: + """A condition variable for conditional graph nodes. + + Created by :meth:`GraphDefinition.create_condition` (or + :meth:`GraphBuilder.create_condition`) and passed to + conditional-node builder methods (:meth:`~GraphDefinition.if_then`, + :meth:`~GraphDefinition.if_else`, :meth:`~GraphDefinition.while_loop`, + :meth:`~GraphDefinition.switch`). The underlying value is set at + runtime by device code via ``cudaGraphSetConditional``. + + A :class:`GraphCondition` may be passed directly as a kernel + argument to ``launch()``: the launcher unwraps it to the underlying + ``CUgraphConditionalHandle`` value so device code can update the + condition. + """ + + def __repr__(self) -> str: + ... + + def __eq__(self, other: object) -> bool: + ... + + def __hash__(self) -> int: + ... + + @property + def handle(self) -> driver.CUgraphConditionalHandle: + """The raw CUgraphConditionalHandle as an int.""" + +class GraphDefinition: + """A graph definition. + + A GraphDefinition is used to construct a graph explicitly by adding nodes + and specifying dependencies. Once construction is complete, call + instantiate() to obtain an executable Graph. + """ + + def __init__(self): + """Create a new empty graph definition.""" + + def __repr__(self) -> str: + ... + + def __eq__(self, other: object) -> bool: + ... + + def __hash__(self) -> int: + ... + + @property + def _entry(self) -> GraphNode: + """Return the internal entry-point GraphNode (no dependencies).""" + + def allocate(self, size: int, *, device: Device | int | None=None, memory_type: GraphMemoryType=..., peer_access: list[Device | int] | None=None) -> AllocNode: + """Add an entry-point memory allocation node (no dependencies). + + See :meth:`GraphNode.allocate` for full documentation. + """ + + def deallocate(self, dptr: int) -> FreeNode: + """Add an entry-point memory free node (no dependencies). + + See :meth:`GraphNode.deallocate` for full documentation. + """ + + def memset(self, dst: Buffer | int, value, width: int, height: int=1, pitch: int=0, *, dst_owner=None) -> MemsetNode: + """Add an entry-point memset node (no dependencies). + + See :meth:`GraphNode.memset` for full documentation. + """ + + def launch(self, config: LaunchConfig, kernel: Kernel, *args) -> KernelNode: + """Add an entry-point kernel launch node (no dependencies). + + See :meth:`GraphNode.launch` for full documentation. + """ + + def empty(self) -> EmptyNode: + """Add an entry-point empty node (no dependencies). + + Returns + ------- + EmptyNode + A new EmptyNode with no dependencies. + """ + + def join(self, *nodes: GraphNode) -> EmptyNode: + """Create an empty node that depends on all given nodes. + + Parameters + ---------- + *nodes : GraphNode + Nodes to merge. + + Returns + ------- + EmptyNode + A new EmptyNode that depends on all input nodes. + """ + + def memcpy(self, dst: Buffer | int, src: Buffer | int, size: int, *, dst_owner=None, src_owner=None) -> MemcpyNode: + """Add an entry-point memcpy node (no dependencies). + + See :meth:`GraphNode.memcpy` for full documentation. + """ + + def embed(self, child: GraphDefinition) -> ChildGraphNode: + """Add an entry-point child graph node (no dependencies). + + See :meth:`GraphNode.embed` for full documentation. + """ + + def record(self, event: Event) -> EventRecordNode: + """Add an entry-point event record node (no dependencies). + + See :meth:`GraphNode.record` for full documentation. + """ + + def wait(self, event: Event) -> EventWaitNode: + """Add an entry-point event wait node (no dependencies). + + See :meth:`GraphNode.wait` for full documentation. + """ + + def callback(self, fn, *, user_data=None) -> HostCallbackNode: + """Add an entry-point host callback node (no dependencies). + + See :meth:`GraphNode.callback` for full documentation. + """ + + def create_condition(self, default_value: int | None=None) -> GraphCondition: + """Create a condition variable for use with conditional nodes. + + The returned :class:`GraphCondition` object is passed to conditional-node + builder methods. Its value is controlled at runtime by device code + via ``cudaGraphSetConditional``. + + Parameters + ---------- + default_value : int, optional + The default value to assign to the condition. + If None, no default is assigned. + + Returns + ------- + GraphCondition + A condition variable for controlling conditional execution. + """ + + def if_then(self, condition: GraphCondition) -> IfNode: + """Add an entry-point if-conditional node (no dependencies). + + See :meth:`GraphNode.if_then` for full documentation. + """ + + def if_else(self, condition: GraphCondition) -> IfElseNode: + """Add an entry-point if-else conditional node (no dependencies). + + See :meth:`GraphNode.if_else` for full documentation. + """ + + def while_loop(self, condition: GraphCondition) -> WhileNode: + """Add an entry-point while-loop conditional node (no dependencies). + + See :meth:`GraphNode.while_loop` for full documentation. + """ + + def switch(self, condition: GraphCondition, count: int) -> SwitchNode: + """Add an entry-point switch conditional node (no dependencies). + + See :meth:`GraphNode.switch` for full documentation. + """ + + def instantiate(self, options: GraphCompleteOptions | None=None) -> Graph: + """Instantiate the graph definition into an executable Graph. + + Parameters + ---------- + options : :obj:`~graph.GraphCompleteOptions`, optional + Customizable dataclass for graph instantiation options. + + Returns + ------- + Graph + An executable graph that can be launched on a stream. + """ + + def debug_dot_print(self, path: str, options: GraphDebugPrintOptions | None=None) -> None: + """Write a GraphViz DOT representation of the graph to a file. + + Parameters + ---------- + path : str + File path for the DOT output. + options : GraphDebugPrintOptions, optional + Customizable options for the debug print. + """ + + def nodes(self) -> set[GraphNode]: + """Return all nodes in the graph. + + Returns + ------- + set of GraphNode + All nodes in the graph. + """ + + def edges(self) -> set[tuple[GraphNode, GraphNode]]: + """Return all edges in the graph as (from_node, to_node) pairs. + + Returns + ------- + set of tuple + Each element is a (from_node, to_node) pair representing + a dependency edge in the graph. + """ + + @property + def handle(self) -> driver.CUgraph: + """Return the underlying driver CUgraph handle.""" +__all__ = ['GraphCondition', 'GraphDefinition'] \ No newline at end of file diff --git a/cuda_core/cuda/core/graph/_graph_definition.pyx b/cuda_core/cuda/core/graph/_graph_definition.pyx new file mode 100644 index 00000000000..0bd05318caf --- /dev/null +++ b/cuda_core/cuda/core/graph/_graph_definition.pyx @@ -0,0 +1,417 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +"""GraphDefinition: explicit CUDA graph definition.""" + +from __future__ import annotations + +from libc.stddef cimport size_t + +from libcpp.vector cimport vector + +from cuda.bindings cimport cydriver + +from cuda.core.graph._graph_node cimport GraphNode +from cuda.core._resource_handles cimport ( + GraphHandle, + as_cu, + as_intptr, + as_py, + create_graph_handle, + create_graph_node_handle, +) +from cuda.core._utils.cuda_utils cimport HANDLE_RETURN + +from typing import TYPE_CHECKING + +from cuda.core._utils.cuda_utils import driver + +from cuda.core.typing import GraphMemoryType + +if TYPE_CHECKING: + from cuda.core._device import Device + from cuda.core._event import Event + from cuda.core._launch_config import LaunchConfig + from cuda.core._memory._buffer import Buffer + from cuda.core._module import Kernel + from cuda.core.graph._graph_builder import ( + Graph, + GraphCompleteOptions, + GraphDebugPrintOptions, + ) + from cuda.core.graph._subclasses import ( + AllocNode, + ChildGraphNode, + EmptyNode, + EventRecordNode, + EventWaitNode, + FreeNode, + HostCallbackNode, + IfElseNode, + IfNode, + KernelNode, + MemcpyNode, + MemsetNode, + SwitchNode, + WhileNode, + ) + +__all__ = ['GraphCondition', 'GraphDefinition'] + + +cdef class GraphCondition: + """A condition variable for conditional graph nodes. + + Created by :meth:`GraphDefinition.create_condition` (or + :meth:`GraphBuilder.create_condition`) and passed to + conditional-node builder methods (:meth:`~GraphDefinition.if_then`, + :meth:`~GraphDefinition.if_else`, :meth:`~GraphDefinition.while_loop`, + :meth:`~GraphDefinition.switch`). The underlying value is set at + runtime by device code via ``cudaGraphSetConditional``. + + A :class:`GraphCondition` may be passed directly as a kernel + argument to ``launch()``: the launcher unwraps it to the underlying + ``CUgraphConditionalHandle`` value so device code can update the + condition. + """ + + @staticmethod + cdef GraphCondition _from_handle(cydriver.CUgraphConditionalHandle c_handle): + cdef GraphCondition self = GraphCondition.__new__(GraphCondition) + self._c_handle = c_handle + return self + + def __repr__(self) -> str: + return f"self._c_handle:x}>" + + def __eq__(self, other: object) -> bool: + if not isinstance(other, GraphCondition): + return NotImplemented + return self._c_handle == (other)._c_handle + + def __hash__(self) -> int: + return hash(self._c_handle) + + @property + def handle(self) -> driver.CUgraphConditionalHandle: + """The raw CUgraphConditionalHandle as an int.""" + return self._c_handle + + +cdef class GraphDefinition: + """A graph definition. + + A GraphDefinition is used to construct a graph explicitly by adding nodes + and specifying dependencies. Once construction is complete, call + instantiate() to obtain an executable Graph. + """ + + def __init__(self): + """Create a new empty graph definition.""" + cdef cydriver.CUgraph graph = NULL + with nogil: + HANDLE_RETURN(cydriver.cuGraphCreate(&graph, 0)) + self._h_graph = create_graph_handle(graph) + + @staticmethod + cdef GraphDefinition _from_handle(GraphHandle h_graph): + """Create a GraphDefinition from an existing GraphHandle (internal use).""" + cdef GraphDefinition g = GraphDefinition.__new__(GraphDefinition) + g._h_graph = h_graph + return g + + def __repr__(self) -> str: + return f"" + + def __eq__(self, other: object) -> bool: + if not isinstance(other, GraphDefinition): + return NotImplemented + return as_intptr(self._h_graph) == as_intptr((other)._h_graph) + + def __hash__(self) -> int: + return hash(as_intptr(self._h_graph)) + + @property + def _entry(self) -> GraphNode: + """Return the internal entry-point GraphNode (no dependencies).""" + cdef GraphNode n = GraphNode.__new__(GraphNode) + n._h_node = create_graph_node_handle(NULL, self._h_graph) + return n + + def allocate(self, size_t size, *, device: Device | int | None = None, + memory_type: GraphMemoryType = GraphMemoryType.DEVICE, + peer_access: list[Device | int] | None = None) -> AllocNode: + """Add an entry-point memory allocation node (no dependencies). + + See :meth:`GraphNode.allocate` for full documentation. + """ + return self._entry.allocate(size, device=device, memory_type=memory_type, peer_access=peer_access) + + def deallocate(self, dptr: int) -> FreeNode: + """Add an entry-point memory free node (no dependencies). + + See :meth:`GraphNode.deallocate` for full documentation. + """ + return self._entry.deallocate(dptr) + + def memset( + self, + dst: Buffer | int, + value, + size_t width, + size_t height=1, + size_t pitch=0, + *, + dst_owner=None, + ) -> MemsetNode: + """Add an entry-point memset node (no dependencies). + + See :meth:`GraphNode.memset` for full documentation. + """ + return self._entry.memset( + dst, value, width, height=height, pitch=pitch, dst_owner=dst_owner + ) + + def launch(self, config: LaunchConfig, kernel: Kernel, *args) -> KernelNode: + """Add an entry-point kernel launch node (no dependencies). + + See :meth:`GraphNode.launch` for full documentation. + """ + return self._entry.launch(config, kernel, *args) + + def empty(self) -> EmptyNode: + """Add an entry-point empty node (no dependencies). + + Returns + ------- + EmptyNode + A new EmptyNode with no dependencies. + """ + return self._entry.join() + + def join(self, *nodes: GraphNode) -> EmptyNode: + """Create an empty node that depends on all given nodes. + + Parameters + ---------- + *nodes : GraphNode + Nodes to merge. + + Returns + ------- + EmptyNode + A new EmptyNode that depends on all input nodes. + """ + return self._entry.join(*nodes) + + def memcpy(self, dst: Buffer | int, src: Buffer | int, size_t size, *, dst_owner=None, src_owner=None) -> MemcpyNode: + """Add an entry-point memcpy node (no dependencies). + + See :meth:`GraphNode.memcpy` for full documentation. + """ + return self._entry.memcpy(dst, src, size, dst_owner=dst_owner, src_owner=src_owner) + + def embed(self, child: GraphDefinition) -> ChildGraphNode: + """Add an entry-point child graph node (no dependencies). + + See :meth:`GraphNode.embed` for full documentation. + """ + return self._entry.embed(child) + + def record(self, event: Event) -> EventRecordNode: + """Add an entry-point event record node (no dependencies). + + See :meth:`GraphNode.record` for full documentation. + """ + return self._entry.record(event) + + def wait(self, event: Event) -> EventWaitNode: + """Add an entry-point event wait node (no dependencies). + + See :meth:`GraphNode.wait` for full documentation. + """ + return self._entry.wait(event) + + def callback(self, fn, *, user_data=None) -> HostCallbackNode: + """Add an entry-point host callback node (no dependencies). + + See :meth:`GraphNode.callback` for full documentation. + """ + return self._entry.callback(fn, user_data=user_data) + + def create_condition(self, default_value: int | None = None) -> GraphCondition: + """Create a condition variable for use with conditional nodes. + + The returned :class:`GraphCondition` object is passed to conditional-node + builder methods. Its value is controlled at runtime by device code + via ``cudaGraphSetConditional``. + + Parameters + ---------- + default_value : int, optional + The default value to assign to the condition. + If None, no default is assigned. + + Returns + ------- + GraphCondition + A condition variable for controlling conditional execution. + """ + cdef cydriver.CUgraphConditionalHandle c_handle + cdef unsigned int flags = 0 + cdef unsigned int default_val = 0 + + if default_value is not None: + default_val = default_value + flags = cydriver.CU_GRAPH_COND_ASSIGN_DEFAULT + + cdef cydriver.CUcontext ctx = NULL + with nogil: + HANDLE_RETURN(cydriver.cuCtxGetCurrent(&ctx)) + HANDLE_RETURN(cydriver.cuGraphConditionalHandleCreate( + &c_handle, as_cu(self._h_graph), ctx, default_val, flags)) + + return GraphCondition._from_handle(c_handle) + + def if_then(self, condition: GraphCondition) -> IfNode: + """Add an entry-point if-conditional node (no dependencies). + + See :meth:`GraphNode.if_then` for full documentation. + """ + return self._entry.if_then(condition) + + def if_else(self, condition: GraphCondition) -> IfElseNode: + """Add an entry-point if-else conditional node (no dependencies). + + See :meth:`GraphNode.if_else` for full documentation. + """ + return self._entry.if_else(condition) + + def while_loop(self, condition: GraphCondition) -> WhileNode: + """Add an entry-point while-loop conditional node (no dependencies). + + See :meth:`GraphNode.while_loop` for full documentation. + """ + return self._entry.while_loop(condition) + + def switch(self, condition: GraphCondition, unsigned int count) -> SwitchNode: + """Add an entry-point switch conditional node (no dependencies). + + See :meth:`GraphNode.switch` for full documentation. + """ + return self._entry.switch(condition, count) + + def instantiate(self, options: GraphCompleteOptions | None = None) -> Graph: + """Instantiate the graph definition into an executable Graph. + + Parameters + ---------- + options : :obj:`~graph.GraphCompleteOptions`, optional + Customizable dataclass for graph instantiation options. + + Returns + ------- + Graph + An executable graph that can be launched on a stream. + """ + from cuda.core.graph._graph_builder import _instantiate_graph + + return _instantiate_graph( + driver.CUgraph(as_intptr(self._h_graph)), options) + + def debug_dot_print(self, path: str, options: GraphDebugPrintOptions | None = None) -> None: + """Write a GraphViz DOT representation of the graph to a file. + + Parameters + ---------- + path : str + File path for the DOT output. + options : GraphDebugPrintOptions, optional + Customizable options for the debug print. + """ + from cuda.core.graph._graph_builder import GraphDebugPrintOptions + + cdef unsigned int flags = 0 + if options is not None: + if not isinstance(options, GraphDebugPrintOptions): + raise TypeError("options must be a GraphDebugPrintOptions instance") + flags = options._to_flags() + + cdef bytes path_bytes = path.encode('utf-8') + cdef const char* c_path = path_bytes + with nogil: + HANDLE_RETURN(cydriver.cuGraphDebugDotPrint(as_cu(self._h_graph), c_path, flags)) + + def nodes(self) -> set[GraphNode]: + """Return all nodes in the graph. + + Returns + ------- + set of GraphNode + All nodes in the graph. + """ + cdef vector[cydriver.CUgraphNode] nodes_vec + nodes_vec.resize(128) + cdef size_t num_nodes = 128 + + with nogil: + HANDLE_RETURN(cydriver.cuGraphGetNodes(as_cu(self._h_graph), nodes_vec.data(), &num_nodes)) + + if num_nodes == 0: + return set() + + if num_nodes > 128: + nodes_vec.resize(num_nodes) + with nogil: + HANDLE_RETURN(cydriver.cuGraphGetNodes(as_cu(self._h_graph), nodes_vec.data(), &num_nodes)) + + return {GraphNode._create(self._h_graph, nodes_vec[i]) for i in range(num_nodes)} + + def edges(self) -> set[tuple[GraphNode, GraphNode]]: + """Return all edges in the graph as (from_node, to_node) pairs. + + Returns + ------- + set of tuple + Each element is a (from_node, to_node) pair representing + a dependency edge in the graph. + """ + cdef vector[cydriver.CUgraphNode] from_nodes + cdef vector[cydriver.CUgraphNode] to_nodes + from_nodes.resize(128) + to_nodes.resize(128) + cdef size_t num_edges = 128 + + with nogil: + IF CUDA_CORE_BUILD_MAJOR >= 13: + HANDLE_RETURN(cydriver.cuGraphGetEdges( + as_cu(self._h_graph), from_nodes.data(), to_nodes.data(), NULL, &num_edges)) + ELSE: + HANDLE_RETURN(cydriver.cuGraphGetEdges( + as_cu(self._h_graph), from_nodes.data(), to_nodes.data(), &num_edges)) + + if num_edges == 0: + return set() + + if num_edges > 128: + from_nodes.resize(num_edges) + to_nodes.resize(num_edges) + with nogil: + IF CUDA_CORE_BUILD_MAJOR >= 13: + HANDLE_RETURN(cydriver.cuGraphGetEdges( + as_cu(self._h_graph), from_nodes.data(), to_nodes.data(), NULL, &num_edges)) + ELSE: + HANDLE_RETURN(cydriver.cuGraphGetEdges( + as_cu(self._h_graph), from_nodes.data(), to_nodes.data(), &num_edges)) + + return { + (GraphNode._create(self._h_graph, from_nodes[i]), + GraphNode._create(self._h_graph, to_nodes[i])) + for i in range(num_edges) + } + + @property + def handle(self) -> driver.CUgraph: + """Return the underlying driver CUgraph handle.""" + return as_py(self._h_graph) diff --git a/cuda_core/cuda/core/graph/_graph_node.pxd b/cuda_core/cuda/core/graph/_graph_node.pxd new file mode 100644 index 00000000000..0a87b70ad62 --- /dev/null +++ b/cuda_core/cuda/core/graph/_graph_node.pxd @@ -0,0 +1,15 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from cuda.bindings cimport cydriver +from cuda.core._resource_handles cimport GraphHandle, GraphNodeHandle + + +cdef class GraphNode: + cdef: + GraphNodeHandle _h_node + object __weakref__ + + @staticmethod + cdef GraphNode _create(GraphHandle h_graph, cydriver.CUgraphNode node) diff --git a/cuda_core/cuda/core/graph/_graph_node.pyi b/cuda_core/cuda/core/graph/_graph_node.pyi new file mode 100644 index 00000000000..962468924b4 --- /dev/null +++ b/cuda_core/cuda/core/graph/_graph_node.pyi @@ -0,0 +1,408 @@ +# This file was generated by stubgen-pyx v0.2.6 from cuda_core/cuda/core/graph/_graph_node.pyx + +"""GraphNode base class — factory, properties, and builder methods.""" +from __future__ import annotations + +import weakref +from collections.abc import Iterable + +from cuda.core._device import Device +from cuda.core._event import Event +from cuda.core._launch_config import LaunchConfig +from cuda.core._memory._buffer import Buffer +from cuda.core._module import Kernel +from cuda.core._utils.cuda_utils import driver +from cuda.core.graph._adjacency_set_proxy import AdjacencySetProxy +from cuda.core.graph._graph_definition import GraphCondition, GraphDefinition +from cuda.core.graph._subclasses import (AllocNode, ChildGraphNode, EmptyNode, + EventRecordNode, EventWaitNode, + FreeNode, IfElseNode, IfNode, + KernelNode, MemcpyNode, MemsetNode, + SwitchNode, WhileNode) +from cuda.core.typing import GraphMemoryType + + +class GraphNode: + """A node in a graph definition. + + Nodes are created by calling builder methods on GraphDefinition (for + entry-point nodes with no dependencies) or on other Nodes (for + nodes that depend on a predecessor). + """ + + def __repr__(self) -> str: + ... + + def __eq__(self, other: object) -> bool: + ... + + def __hash__(self) -> int: + ... + + @property + def type(self) -> driver.CUgraphNodeType | None: + """Return the CUDA graph node type. + + Returns + ------- + CUgraphNodeType or None + The node type enum value, or None for the entry node. + """ + + @property + def graph(self) -> GraphDefinition: + """Return the GraphDefinition this node belongs to.""" + + @property + def handle(self) -> driver.CUgraphNode: + """Return the underlying driver CUgraphNode handle. + + Returns None for the entry node. + """ + + @property + def is_valid(self) -> bool: + """Whether this node is valid (not destroyed). + + Returns ``False`` after :meth:`destroy` has been called. + """ + + def destroy(self) -> None: + """Destroy this node and remove all its edges from the parent graph. + + After this call, :attr:`is_valid` returns ``False`` and the node + cannot be re-added to any graph. Safe to call on an + already-destroyed node (no-op). + """ + + @property + def pred(self) -> AdjacencySetProxy: + """A mutable set-like view of this node's predecessors.""" + + @pred.setter + def pred(self, value: Iterable[GraphNode]) -> None: + ... + + @property + def succ(self) -> AdjacencySetProxy: + """A mutable set-like view of this node's successors.""" + + @succ.setter + def succ(self, value: Iterable[GraphNode]) -> None: + ... + + def launch(self, config: LaunchConfig, kernel: Kernel, *args) -> KernelNode: + """Add a kernel launch node depending on this node. + + Parameters + ---------- + config : LaunchConfig + Launch configuration (grid, block, shared memory, etc.) + kernel : Kernel + The kernel to launch. + *args + Kernel arguments. + + Returns + ------- + KernelNode + A new KernelNode representing the kernel launch. + """ + + def join(self, *nodes: GraphNode) -> EmptyNode: + """Create an empty node that depends on this node and all given nodes. + + This is used to synchronize multiple branches of execution. + + Parameters + ---------- + *nodes : GraphNode + Additional nodes to depend on. + + Returns + ------- + EmptyNode + A new EmptyNode that depends on all input nodes. + """ + + def allocate(self, size: int, *, device: Device | int | None=None, memory_type: GraphMemoryType=..., peer_access: list[Device | int] | None=None) -> AllocNode: + """Add a memory allocation node depending on this node. + + Parameters + ---------- + size : int + Number of bytes to allocate. + device : int or Device, optional + The device on which to allocate memory. If None (default), + uses the current CUDA context's device. + memory_type : GraphMemoryType or str, optional + Type of memory to allocate. One of: + + - ``GraphMemoryType.DEVICE`` (default): Pinned device memory, + optimal for GPU kernels. + - ``GraphMemoryType.HOST``: Pinned host memory, accessible from + both host and device. Useful for graphs containing host + callback nodes. Note: may not be supported on all + systems/drivers. + - ``GraphMemoryType.MANAGED``: Managed/unified memory that + automatically migrates between host and device. Useful for + mixed host/device access patterns. + + peer_access : list of int or Device, optional + List of devices that should have read-write access to the + allocated memory. If None (default), only the allocating + device has access. + + Returns + ------- + AllocNode + A new AllocNode representing the allocation. Access the allocated + device pointer via the dptr property. + + Notes + ----- + IPC (inter-process communication) is not supported for graph + memory allocation nodes per CUDA documentation. + """ + + def deallocate(self, dptr: int) -> FreeNode: + """Add a memory free node depending on this node. + + Parameters + ---------- + dptr : int + Device pointer to free (typically from AllocNode.dptr). + + Returns + ------- + FreeNode + A new FreeNode representing the free operation. + """ + + def memset(self, dst: Buffer | int, value, width: int, height: int=1, pitch: int=0, *, dst_owner=None) -> MemsetNode: + """Add a memset node depending on this node. + + Parameters + ---------- + dst : Buffer or int + Destination. When ``dst`` is a :class:`Buffer`, the underlying + allocation is retained for the graph's lifetime. A raw pointer + (``int``) is used as-is; the caller must keep the underlying memory + alive, or supply ``dst_owner`` to have the graph retain it. + value : int or buffer-protocol object + Fill value. int for 1-byte fill (range [0, 256)), + or buffer-protocol object of 1, 2, or 4 bytes. + width : int + Width of the row in elements. + height : int, optional + Number of rows (default 1). + pitch : int, optional + Pitch of destination in bytes (default 0, unused if height is 1). + dst_owner : object, optional + Object retained for the graph's lifetime when ``dst`` is a raw + pointer. A :class:`Buffer` owner retains its underlying allocation, + not the wrapper. Must not be passed when ``dst`` is a :class:`Buffer`. + + Returns + ------- + MemsetNode + A new MemsetNode representing the memset operation. + + Raises + ------ + ValueError + If ``dst_owner`` is given together with a :class:`Buffer` ``dst``. + """ + + def memcpy(self, dst: Buffer | int, src: Buffer | int, size: int, *, dst_owner=None, src_owner=None) -> MemcpyNode: + """Add a memcpy node depending on this node. + + Copies ``size`` bytes from ``src`` to ``dst``. Memory types are + auto-detected via the driver, so both device and pinned host + pointers are supported. + + Parameters + ---------- + dst : Buffer or int + Destination (device or pinned host). When a :class:`Buffer` is given, + the underlying allocation is retained for the graph's lifetime. A raw + pointer (``int``) is used as-is; the caller must keep the underlying + memory alive, or supply ``dst_owner`` to have the graph retain it. + src : Buffer or int + Source (device or pinned host). Same retention rules as ``dst``; + use ``src_owner`` for a raw pointer. + size : int + Number of bytes to copy. + dst_owner : object, optional + Object retained for the graph's lifetime when ``dst`` is a raw + pointer. A :class:`Buffer` owner retains its underlying allocation. + Must not be passed when ``dst`` is a :class:`Buffer`. + src_owner : object, optional + Object retained for the graph's lifetime when ``src`` is a raw + pointer. A :class:`Buffer` owner retains its underlying allocation. + Must not be passed when ``src`` is a :class:`Buffer`. + + Returns + ------- + MemcpyNode + A new MemcpyNode representing the copy operation. + + Raises + ------ + ValueError + If ``dst_owner`` or ``src_owner`` is given together with a + :class:`Buffer` ``dst`` or ``src`` respectively. + """ + + def embed(self, child: GraphDefinition) -> ChildGraphNode: + """Add a child graph node depending on this node. + + Embeds a clone of the given graph definition as a sub-graph node. + The child graph must not contain allocation, free, or conditional + nodes. + + Parameters + ---------- + child : GraphDefinition + The graph definition to embed (will be cloned). + + Returns + ------- + ChildGraphNode + A new ChildGraphNode representing the embedded sub-graph. + """ + + def record(self, event: Event) -> EventRecordNode: + """Add an event record node depending on this node. + + Parameters + ---------- + event : Event + The event to record. + + Returns + ------- + EventRecordNode + A new EventRecordNode representing the event record operation. + """ + + def wait(self, event: Event) -> EventWaitNode: + """Add an event wait node depending on this node. + + Parameters + ---------- + event : Event + The event to wait for. + + Returns + ------- + EventWaitNode + A new EventWaitNode representing the event wait operation. + """ + + def callback(self, fn, *, user_data=None) -> object: + """Add a host callback node depending on this node. + + The callback runs on the host CPU when the graph reaches this node. + Two modes are supported: + + - **Python callable**: Pass any callable. The GIL is acquired + automatically. The callable must take no arguments; use closures + or ``functools.partial`` to bind state. + - **ctypes function pointer**: Pass a ``ctypes.CFUNCTYPE`` instance. + The function receives a single ``void*`` argument (the + ``user_data``). The caller must keep the ctypes wrapper alive + for the lifetime of the graph. + + .. warning:: + + Callbacks must not call CUDA API functions. Doing so may + deadlock or corrupt driver state. + + Parameters + ---------- + fn : callable or ctypes function pointer + The callback function. + user_data : int or bytes-like, optional + Only for ctypes function pointers. If ``int``, passed as a raw + pointer (caller manages lifetime). If bytes-like, the data is + copied and its lifetime is tied to the graph. + + Returns + ------- + HostCallbackNode + A new HostCallbackNode representing the callback. + """ + + def if_then(self, condition: GraphCondition) -> IfNode: + """Add an if-conditional node depending on this node. + + The body graph executes only when the condition evaluates to + a non-zero value at runtime. + + Parameters + ---------- + condition : GraphCondition + GraphCondition from :meth:`GraphDefinition.create_condition`. + + Returns + ------- + IfNode + A new IfNode with one branch accessible via ``.then``. + """ + + def if_else(self, condition: GraphCondition) -> IfElseNode: + """Add an if-else conditional node depending on this node. + + Two body graphs: the first executes when the condition is + non-zero, the second when it is zero. + + Parameters + ---------- + condition : GraphCondition + GraphCondition from :meth:`GraphDefinition.create_condition`. + + Returns + ------- + IfElseNode + A new IfElseNode with branches accessible via + ``.then`` and ``.else_``. + """ + + def while_loop(self, condition: GraphCondition) -> WhileNode: + """Add a while-loop conditional node depending on this node. + + The body graph executes repeatedly while the condition + evaluates to a non-zero value. + + Parameters + ---------- + condition : GraphCondition + GraphCondition from :meth:`GraphDefinition.create_condition`. + + Returns + ------- + WhileNode + A new WhileNode with body accessible via ``.body``. + """ + + def switch(self, condition: GraphCondition, count: int) -> SwitchNode: + """Add a switch conditional node depending on this node. + + The condition value selects which branch to execute. If the + value is out of range, no branch executes. + + Parameters + ---------- + condition : GraphCondition + GraphCondition from :meth:`GraphDefinition.create_condition`. + count : int + Number of switch cases (branches). + + Returns + ------- + SwitchNode + A new SwitchNode with branches accessible via ``.branches``. + """ +__all__ = ['GraphNode'] +_node_registry: weakref.WeakValueDictionary[int, GraphNode] = weakref.WeakValueDictionary() \ No newline at end of file diff --git a/cuda_core/cuda/core/graph/_graph_node.pyx b/cuda_core/cuda/core/graph/_graph_node.pyx new file mode 100644 index 00000000000..0adf69ad4b4 --- /dev/null +++ b/cuda_core/cuda/core/graph/_graph_node.pyx @@ -0,0 +1,1114 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +"""GraphNode base class — factory, properties, and builder methods.""" + +from __future__ import annotations + +from collections.abc import Iterable +from typing import TYPE_CHECKING + +from libc.stddef cimport size_t +from libc.stdint cimport uintptr_t +from libc.string cimport memset as c_memset + +from libcpp.vector cimport vector + +from cuda.bindings cimport cydriver + +from cuda.core._event cimport Event +from cuda.core._kernel_arg_handler cimport ParamHolder +from cuda.core._launch_config cimport LaunchConfig +from cuda.core._memory._buffer cimport Buffer +from cuda.core._module cimport Kernel +from cuda.core.graph._graph_definition cimport GraphCondition, GraphDefinition +from cuda.core.graph._subclasses cimport ( + AllocNode, + ChildGraphNode, + ConditionalNode, + EmptyNode, + EventRecordNode, + EventWaitNode, + FreeNode, + HostCallbackNode, + IfElseNode, + IfNode, + KernelNode, + MemcpyNode, + MemsetNode, + SwitchNode, + WhileNode, +) +from cuda.core._resource_handles cimport ( + GraphHandle, + GraphNodeHandle, + OpaqueHandle, + as_cu, + as_intptr, + as_py, + create_graph_handle_ref, + create_graph_node_handle, + graph_node_get_graph, + graph_set_slot, + invalidate_graph_node, + make_opaque_py, +) +from cuda.core._utils.cuda_utils cimport HANDLE_RETURN, _parse_fill_value + +from cuda.core.graph._host_callback cimport ( + _attach_host_callback_owners, + _resolve_host_callback, +) + +import ctypes as ct +import weakref + +from cuda.core.graph._adjacency_set_proxy import AdjacencySetProxy +from cuda.core._utils.validators import check_str_enum +from cuda.core._utils.cuda_utils import driver +from cuda.core.typing import GraphMemoryType + +if TYPE_CHECKING: + from cuda.core._device import Device + +__all__ = ['GraphNode'] + +# See _cpp/REGISTRY_DESIGN.md (Level 2: Resource Handle -> Python Object) +_node_registry: weakref.WeakValueDictionary[int, GraphNode] = weakref.WeakValueDictionary() + + +cdef inline GraphNode _registered(GraphNode n): + return _node_registry.setdefault(n._h_node.get(), n) + + +cdef class GraphNode: + """A node in a graph definition. + + Nodes are created by calling builder methods on GraphDefinition (for + entry-point nodes with no dependencies) or on other Nodes (for + nodes that depend on a predecessor). + """ + + @staticmethod + cdef GraphNode _create(GraphHandle h_graph, cydriver.CUgraphNode node): + """Factory: dispatch to the right subclass based on node type.""" + return GN_create(h_graph, node) + + def __repr__(self) -> str: + cdef cydriver.CUgraphNode node = as_cu(self._h_node) + if node == NULL: + return "" + return f"node:x}>" + + def __eq__(self, other: object) -> bool: + if not isinstance(other, GraphNode): + return NotImplemented + cdef GraphNode o = other + cdef GraphHandle self_graph = graph_node_get_graph(self._h_node) + cdef GraphHandle other_graph = graph_node_get_graph(o._h_node) + return (as_intptr(self._h_node) == as_intptr(o._h_node) + and as_intptr(self_graph) == as_intptr(other_graph)) + + def __hash__(self) -> int: + cdef GraphHandle g = graph_node_get_graph(self._h_node) + return hash((as_intptr(self._h_node), as_intptr(g))) + + @property + def type(self) -> driver.CUgraphNodeType | None: + """Return the CUDA graph node type. + + Returns + ------- + CUgraphNodeType or None + The node type enum value, or None for the entry node. + """ + cdef cydriver.CUgraphNode node = as_cu(self._h_node) + if node == NULL: + return None + cdef cydriver.CUgraphNodeType node_type + with nogil: + HANDLE_RETURN(cydriver.cuGraphNodeGetType(node, &node_type)) + return driver.CUgraphNodeType(node_type) + + @property + def graph(self) -> GraphDefinition: + """Return the GraphDefinition this node belongs to.""" + return GraphDefinition._from_handle(graph_node_get_graph(self._h_node)) + + @property + def handle(self) -> driver.CUgraphNode: + """Return the underlying driver CUgraphNode handle. + + Returns None for the entry node. + """ + return as_py(self._h_node) + + @property + def is_valid(self) -> bool: + """Whether this node is valid (not destroyed). + + Returns ``False`` after :meth:`destroy` has been called. + """ + return as_intptr(self._h_node) != 0 + + def destroy(self) -> None: + """Destroy this node and remove all its edges from the parent graph. + + After this call, :attr:`is_valid` returns ``False`` and the node + cannot be re-added to any graph. Safe to call on an + already-destroyed node (no-op). + """ + cdef cydriver.CUgraphNode node = as_cu(self._h_node) + if node == NULL: + return + + _node_registry.pop(self._h_node.get(), None) + invalidate_graph_node(self._h_node) + with nogil: + HANDLE_RETURN(cydriver.cuGraphDestroyNode(node)) + + @property + def pred(self) -> AdjacencySetProxy: + """A mutable set-like view of this node's predecessors.""" + return AdjacencySetProxy(self, False) + + @pred.setter + def pred(self, value: Iterable[GraphNode]) -> None: + p = AdjacencySetProxy(self, False) + p.clear() + p.update(value) + + @property + def succ(self) -> AdjacencySetProxy: + """A mutable set-like view of this node's successors.""" + return AdjacencySetProxy(self, True) + + @succ.setter + def succ(self, value: Iterable[GraphNode]) -> None: + s = AdjacencySetProxy(self, True) + s.clear() + s.update(value) + + def launch(self, config: LaunchConfig, kernel: Kernel, *args) -> KernelNode: + """Add a kernel launch node depending on this node. + + Parameters + ---------- + config : LaunchConfig + Launch configuration (grid, block, shared memory, etc.) + kernel : Kernel + The kernel to launch. + *args + Kernel arguments. + + Returns + ------- + KernelNode + A new KernelNode representing the kernel launch. + """ + return GN_launch(self, config, kernel, ParamHolder(args)) + + def join(self, *nodes: GraphNode) -> EmptyNode: + """Create an empty node that depends on this node and all given nodes. + + This is used to synchronize multiple branches of execution. + + Parameters + ---------- + *nodes : GraphNode + Additional nodes to depend on. + + Returns + ------- + EmptyNode + A new EmptyNode that depends on all input nodes. + """ + return GN_join(self, nodes) + + def allocate(self, size_t size, *, device: Device | int | None = None, + memory_type: GraphMemoryType = GraphMemoryType.DEVICE, + peer_access: list[Device | int] | None = None) -> AllocNode: + """Add a memory allocation node depending on this node. + + Parameters + ---------- + size : int + Number of bytes to allocate. + device : int or Device, optional + The device on which to allocate memory. If None (default), + uses the current CUDA context's device. + memory_type : GraphMemoryType or str, optional + Type of memory to allocate. One of: + + - ``GraphMemoryType.DEVICE`` (default): Pinned device memory, + optimal for GPU kernels. + - ``GraphMemoryType.HOST``: Pinned host memory, accessible from + both host and device. Useful for graphs containing host + callback nodes. Note: may not be supported on all + systems/drivers. + - ``GraphMemoryType.MANAGED``: Managed/unified memory that + automatically migrates between host and device. Useful for + mixed host/device access patterns. + + peer_access : list of int or Device, optional + List of devices that should have read-write access to the + allocated memory. If None (default), only the allocating + device has access. + + Returns + ------- + AllocNode + A new AllocNode representing the allocation. Access the allocated + device pointer via the dptr property. + + Notes + ----- + IPC (inter-process communication) is not supported for graph + memory allocation nodes per CUDA documentation. + """ + return GN_alloc(self, size, device, memory_type, peer_access) + + def deallocate(self, dptr: int) -> FreeNode: + """Add a memory free node depending on this node. + + Parameters + ---------- + dptr : int + Device pointer to free (typically from AllocNode.dptr). + + Returns + ------- + FreeNode + A new FreeNode representing the free operation. + """ + return GN_free(self, dptr) + + def memset( + self, + dst: Buffer | int, + value, + size_t width, + size_t height=1, + size_t pitch=0, + *, + dst_owner=None, + ) -> MemsetNode: + """Add a memset node depending on this node. + + Parameters + ---------- + dst : Buffer or int + Destination. When ``dst`` is a :class:`Buffer`, the underlying + allocation is retained for the graph's lifetime. A raw pointer + (``int``) is used as-is; the caller must keep the underlying memory + alive, or supply ``dst_owner`` to have the graph retain it. + value : int or buffer-protocol object + Fill value. int for 1-byte fill (range [0, 256)), + or buffer-protocol object of 1, 2, or 4 bytes. + width : int + Width of the row in elements. + height : int, optional + Number of rows (default 1). + pitch : int, optional + Pitch of destination in bytes (default 0, unused if height is 1). + dst_owner : object, optional + Object retained for the graph's lifetime when ``dst`` is a raw + pointer. A :class:`Buffer` owner retains its underlying allocation, + not the wrapper. Must not be passed when ``dst`` is a :class:`Buffer`. + + Returns + ------- + MemsetNode + A new MemsetNode representing the memset operation. + + Raises + ------ + ValueError + If ``dst_owner`` is given together with a :class:`Buffer` ``dst``. + """ + cdef cydriver.CUdeviceptr c_dst + cdef unsigned int val + cdef unsigned int elem_size + cdef OpaqueHandle dst_slot_owner + dst_slot_owner = _resolve_memcpy_operand(dst, dst_owner, "dst", &c_dst) + val, elem_size = _parse_fill_value(value) + return GN_memset(self, c_dst, dst_slot_owner, val, elem_size, width, height, pitch) + + def memcpy( + self, + dst: Buffer | int, + src: Buffer | int, + size_t size, + *, + dst_owner=None, + src_owner=None, + ) -> MemcpyNode: + """Add a memcpy node depending on this node. + + Copies ``size`` bytes from ``src`` to ``dst``. Memory types are + auto-detected via the driver, so both device and pinned host + pointers are supported. + + Parameters + ---------- + dst : Buffer or int + Destination (device or pinned host). When a :class:`Buffer` is given, + the underlying allocation is retained for the graph's lifetime. A raw + pointer (``int``) is used as-is; the caller must keep the underlying + memory alive, or supply ``dst_owner`` to have the graph retain it. + src : Buffer or int + Source (device or pinned host). Same retention rules as ``dst``; + use ``src_owner`` for a raw pointer. + size : int + Number of bytes to copy. + dst_owner : object, optional + Object retained for the graph's lifetime when ``dst`` is a raw + pointer. A :class:`Buffer` owner retains its underlying allocation. + Must not be passed when ``dst`` is a :class:`Buffer`. + src_owner : object, optional + Object retained for the graph's lifetime when ``src`` is a raw + pointer. A :class:`Buffer` owner retains its underlying allocation. + Must not be passed when ``src`` is a :class:`Buffer`. + + Returns + ------- + MemcpyNode + A new MemcpyNode representing the copy operation. + + Raises + ------ + ValueError + If ``dst_owner`` or ``src_owner`` is given together with a + :class:`Buffer` ``dst`` or ``src`` respectively. + """ + cdef cydriver.CUdeviceptr c_dst + cdef cydriver.CUdeviceptr c_src + cdef OpaqueHandle dst_slot_owner, src_slot_owner + dst_slot_owner = _resolve_memcpy_operand(dst, dst_owner, "dst", &c_dst) + src_slot_owner = _resolve_memcpy_operand(src, src_owner, "src", &c_src) + return GN_memcpy(self, c_dst, dst_slot_owner, c_src, src_slot_owner, size) + + def embed(self, child: GraphDefinition) -> ChildGraphNode: + """Add a child graph node depending on this node. + + Embeds a clone of the given graph definition as a sub-graph node. + The child graph must not contain allocation, free, or conditional + nodes. + + Parameters + ---------- + child : GraphDefinition + The graph definition to embed (will be cloned). + + Returns + ------- + ChildGraphNode + A new ChildGraphNode representing the embedded sub-graph. + """ + return GN_embed(self, child) + + def record(self, event: Event) -> EventRecordNode: + """Add an event record node depending on this node. + + Parameters + ---------- + event : Event + The event to record. + + Returns + ------- + EventRecordNode + A new EventRecordNode representing the event record operation. + """ + return GN_record_event(self, event) + + def wait(self, event: Event) -> EventWaitNode: + """Add an event wait node depending on this node. + + Parameters + ---------- + event : Event + The event to wait for. + + Returns + ------- + EventWaitNode + A new EventWaitNode representing the event wait operation. + """ + return GN_wait_event(self, event) + + def callback(self, fn, *, user_data=None) -> object: + """Add a host callback node depending on this node. + + The callback runs on the host CPU when the graph reaches this node. + Two modes are supported: + + - **Python callable**: Pass any callable. The GIL is acquired + automatically. The callable must take no arguments; use closures + or ``functools.partial`` to bind state. + - **ctypes function pointer**: Pass a ``ctypes.CFUNCTYPE`` instance. + The function receives a single ``void*`` argument (the + ``user_data``). The caller must keep the ctypes wrapper alive + for the lifetime of the graph. + + .. warning:: + + Callbacks must not call CUDA API functions. Doing so may + deadlock or corrupt driver state. + + Parameters + ---------- + fn : callable or ctypes function pointer + The callback function. + user_data : int or bytes-like, optional + Only for ctypes function pointers. If ``int``, passed as a raw + pointer (caller manages lifetime). If bytes-like, the data is + copied and its lifetime is tied to the graph. + + Returns + ------- + HostCallbackNode + A new HostCallbackNode representing the callback. + """ + return GN_callback(self, fn, user_data) + + def if_then(self, condition: GraphCondition) -> IfNode: + """Add an if-conditional node depending on this node. + + The body graph executes only when the condition evaluates to + a non-zero value at runtime. + + Parameters + ---------- + condition : GraphCondition + GraphCondition from :meth:`GraphDefinition.create_condition`. + + Returns + ------- + IfNode + A new IfNode with one branch accessible via ``.then``. + """ + return _make_conditional_node( + self, condition, + cydriver.CU_GRAPH_COND_TYPE_IF, 1, IfNode) + + def if_else(self, condition: GraphCondition) -> IfElseNode: + """Add an if-else conditional node depending on this node. + + Two body graphs: the first executes when the condition is + non-zero, the second when it is zero. + + Parameters + ---------- + condition : GraphCondition + GraphCondition from :meth:`GraphDefinition.create_condition`. + + Returns + ------- + IfElseNode + A new IfElseNode with branches accessible via + ``.then`` and ``.else_``. + """ + return _make_conditional_node( + self, condition, + cydriver.CU_GRAPH_COND_TYPE_IF, 2, IfElseNode) + + def while_loop(self, condition: GraphCondition) -> WhileNode: + """Add a while-loop conditional node depending on this node. + + The body graph executes repeatedly while the condition + evaluates to a non-zero value. + + Parameters + ---------- + condition : GraphCondition + GraphCondition from :meth:`GraphDefinition.create_condition`. + + Returns + ------- + WhileNode + A new WhileNode with body accessible via ``.body``. + """ + return _make_conditional_node( + self, condition, + cydriver.CU_GRAPH_COND_TYPE_WHILE, 1, WhileNode) + + def switch(self, condition: GraphCondition, unsigned int count) -> SwitchNode: + """Add a switch conditional node depending on this node. + + The condition value selects which branch to execute. If the + value is out of range, no branch executes. + + Parameters + ---------- + condition : GraphCondition + GraphCondition from :meth:`GraphDefinition.create_condition`. + count : int + Number of switch cases (branches). + + Returns + ------- + SwitchNode + A new SwitchNode with branches accessible via ``.branches``. + """ + return _make_conditional_node( + self, condition, + cydriver.CU_GRAPH_COND_TYPE_SWITCH, count, SwitchNode) + + +cdef inline ConditionalNode _make_conditional_node( + GraphNode pred, + GraphCondition condition, + cydriver.CUgraphConditionalNodeType cond_type, + unsigned int size, + type node_cls): + if not isinstance(condition, GraphCondition): + raise TypeError( + f"condition must be a GraphCondition object (from " + f"GraphDefinition.create_condition()), got {type(condition).__name__}") + cdef cydriver.CUgraphNodeParams params + cdef cydriver.CUgraphNode new_node = NULL + + c_memset(¶ms, 0, sizeof(params)) + params.type = cydriver.CU_GRAPH_NODE_TYPE_CONDITIONAL + params.conditional.handle = condition._c_handle + params.conditional.type = cond_type + params.conditional.size = size + + cdef cydriver.CUcontext ctx = NULL + cdef GraphHandle h_graph = graph_node_get_graph(pred._h_node) + cdef cydriver.CUgraphNode pred_node = as_cu(pred._h_node) + cdef cydriver.CUgraphNode* deps = NULL + cdef size_t num_deps = 0 + + if pred_node != NULL: + deps = &pred_node + num_deps = 1 + + with nogil: + HANDLE_RETURN(cydriver.cuCtxGetCurrent(&ctx)) + params.conditional.ctx = ctx + + with nogil: + IF CUDA_CORE_BUILD_MAJOR >= 13: + HANDLE_RETURN(cydriver.cuGraphAddNode( + &new_node, as_cu(h_graph), deps, NULL, num_deps, ¶ms)) + ELSE: + HANDLE_RETURN(cydriver.cuGraphAddNode( + &new_node, as_cu(h_graph), deps, num_deps, ¶ms)) + + cdef list branch_list = [] + cdef unsigned int i + cdef cydriver.CUgraph bg + cdef GraphHandle h_branch + for i in range(size): + bg = params.conditional.phGraph_out[i] + h_branch = create_graph_handle_ref(bg, h_graph) + branch_list.append(GraphDefinition._from_handle(h_branch)) + cdef tuple branches = tuple(branch_list) + + cdef ConditionalNode n = node_cls.__new__(node_cls) + n._h_node = create_graph_node_handle(new_node, h_graph) + n._condition = condition + n._cond_type = cond_type + n._branches = branches + + return _registered(n) + +cdef inline GraphNode GN_create(GraphHandle h_graph, cydriver.CUgraphNode node): + cdef GraphNodeHandle h_node = create_graph_node_handle(node, h_graph) + + # Sentinel: virtual node to represent the graph entry point. + if node == NULL: + n = GraphNode.__new__(GraphNode) + (n)._h_node = h_node + return n + + # Return a registered object or create and register a new one. + registered = _node_registry.get(h_node.get()) + if registered is not None: + return registered + else: + return _registered(GN_create_impl(h_node)) + + +cdef inline GraphNode GN_create_impl(GraphNodeHandle h_node): + cdef cydriver.CUgraphNodeType node_type + with nogil: + HANDLE_RETURN(cydriver.cuGraphNodeGetType(as_cu(h_node), &node_type)) + + if node_type == cydriver.CU_GRAPH_NODE_TYPE_EMPTY: + return EmptyNode._create_impl(h_node) + elif node_type == cydriver.CU_GRAPH_NODE_TYPE_KERNEL: + return KernelNode._create_from_driver(h_node) + elif node_type == cydriver.CU_GRAPH_NODE_TYPE_MEM_ALLOC: + return AllocNode._create_from_driver(h_node) + elif node_type == cydriver.CU_GRAPH_NODE_TYPE_MEM_FREE: + return FreeNode._create_from_driver(h_node) + elif node_type == cydriver.CU_GRAPH_NODE_TYPE_MEMSET: + return MemsetNode._create_from_driver(h_node) + elif node_type == cydriver.CU_GRAPH_NODE_TYPE_MEMCPY: + return MemcpyNode._create_from_driver(h_node) + elif node_type == cydriver.CU_GRAPH_NODE_TYPE_GRAPH: + return ChildGraphNode._create_from_driver(h_node) + elif node_type == cydriver.CU_GRAPH_NODE_TYPE_EVENT_RECORD: + return EventRecordNode._create_from_driver(h_node) + elif node_type == cydriver.CU_GRAPH_NODE_TYPE_WAIT_EVENT: + return EventWaitNode._create_from_driver(h_node) + elif node_type == cydriver.CU_GRAPH_NODE_TYPE_HOST: + return HostCallbackNode._create_from_driver(h_node) + elif node_type == cydriver.CU_GRAPH_NODE_TYPE_CONDITIONAL: + return ConditionalNode._create_from_driver(h_node) + else: + n = GraphNode.__new__(GraphNode) + (n)._h_node = h_node + return n + + +cdef inline KernelNode GN_launch(GraphNode self, LaunchConfig conf, Kernel ker, ParamHolder ker_args): + cdef cydriver.CUDA_KERNEL_NODE_PARAMS node_params + cdef cydriver.CUgraphNode new_node = NULL + cdef GraphHandle h_graph = graph_node_get_graph(self._h_node) + cdef cydriver.CUgraphNode pred_node = as_cu(self._h_node) + cdef cydriver.CUgraphNode* deps = NULL + cdef size_t num_deps = 0 + cdef OpaqueHandle owner + + if pred_node != NULL: + deps = &pred_node + num_deps = 1 + + node_params.kern = as_cu(ker._h_kernel) + node_params.func = NULL + node_params.gridDimX = conf.grid[0] + node_params.gridDimY = conf.grid[1] + node_params.gridDimZ = conf.grid[2] + node_params.blockDimX = conf.block[0] + node_params.blockDimY = conf.block[1] + node_params.blockDimZ = conf.block[2] + node_params.sharedMemBytes = conf.shmem_size + node_params.kernelParams = (ker_args.ptr) + node_params.extra = NULL + node_params.ctx = NULL + + with nogil: + HANDLE_RETURN(cydriver.cuGraphAddKernelNode( + &new_node, as_cu(h_graph), deps, num_deps, &node_params)) + + # Slot 0 keeps the kernel loaded; slot 1 keeps the Python kernel-argument + # objects (notably device Buffers) alive for the graph's lifetime. The + # driver copies argument values into the node at add time but does not own + # the device memory they reference. + owner = ker._h_kernel + try: + HANDLE_RETURN(graph_set_slot(h_graph, new_node, 0, owner)) + kernel_args = ker_args.kernel_args + if kernel_args is not None: + owner = make_opaque_py(kernel_args) + HANDLE_RETURN(graph_set_slot(h_graph, new_node, 1, owner)) + except: + cydriver.cuGraphDestroyNode(new_node) # best effort + raise + + return _registered(KernelNode._create_with_params( + create_graph_node_handle(new_node, h_graph), + conf.grid, conf.block, conf.shmem_size, + ker._h_kernel)) + + +cdef inline EmptyNode GN_join(GraphNode self, tuple nodes): + cdef vector[cydriver.CUgraphNode] deps + cdef cydriver.CUgraphNode new_node = NULL + cdef GraphHandle h_graph = graph_node_get_graph(self._h_node) + cdef GraphNode other + cdef cydriver.CUgraphNode* deps_ptr = NULL + cdef size_t num_deps = 0 + cdef cydriver.CUgraphNode pred_node = as_cu(self._h_node) + + if pred_node != NULL: + deps.push_back(pred_node) + for other in nodes: + if as_cu((other)._h_node) != NULL: + deps.push_back(as_cu((other)._h_node)) + + num_deps = deps.size() + if num_deps > 0: + deps_ptr = deps.data() + + with nogil: + HANDLE_RETURN(cydriver.cuGraphAddEmptyNode( + &new_node, as_cu(h_graph), deps_ptr, num_deps)) + + return _registered(EmptyNode._create_impl(create_graph_node_handle(new_node, h_graph))) + + +cdef inline AllocNode GN_alloc(GraphNode self, size_t size, object device, + object memory_type, object peer_access): + cdef int device_id + cdef cydriver.CUdevice dev + + if device is None: + with nogil: + HANDLE_RETURN(cydriver.cuCtxGetDevice(&dev)) + device_id = dev + else: + device_id = getattr(device, 'device_id', device) + + cdef cydriver.CUDA_MEM_ALLOC_NODE_PARAMS alloc_params + cdef cydriver.CUgraphNode new_node = NULL + cdef GraphHandle h_graph = graph_node_get_graph(self._h_node) + cdef cydriver.CUgraphNode pred_node = as_cu(self._h_node) + cdef cydriver.CUgraphNode* deps = NULL + cdef size_t num_deps = 0 + + if pred_node != NULL: + deps = &pred_node + num_deps = 1 + + cdef vector[cydriver.CUmemAccessDesc] access_descs + cdef int peer_id + cdef list peer_ids = [] + + if peer_access is not None: + for peer_dev in peer_access: + peer_id = getattr(peer_dev, 'device_id', peer_dev) + peer_ids.append(peer_id) + access_descs.push_back(cydriver.CUmemAccessDesc_st( + cydriver.CUmemLocation_st( + cydriver.CUmemLocationType.CU_MEM_LOCATION_TYPE_DEVICE, + peer_id + ), + cydriver.CUmemAccess_flags.CU_MEM_ACCESS_FLAGS_PROT_READWRITE + )) + + cdef str memory_type_str = "device" if memory_type is None else str(memory_type) + + c_memset(&alloc_params, 0, sizeof(alloc_params)) + alloc_params.poolProps.handleTypes = cydriver.CUmemAllocationHandleType.CU_MEM_HANDLE_TYPE_NONE + alloc_params.bytesize = size + + check_str_enum(memory_type_str, GraphMemoryType) + if memory_type_str == "device": + alloc_params.poolProps.allocType = cydriver.CUmemAllocationType.CU_MEM_ALLOCATION_TYPE_PINNED + alloc_params.poolProps.location.type = cydriver.CUmemLocationType.CU_MEM_LOCATION_TYPE_DEVICE + alloc_params.poolProps.location.id = device_id + elif memory_type_str == "host": + alloc_params.poolProps.allocType = cydriver.CUmemAllocationType.CU_MEM_ALLOCATION_TYPE_PINNED + alloc_params.poolProps.location.type = cydriver.CUmemLocationType.CU_MEM_LOCATION_TYPE_HOST + alloc_params.poolProps.location.id = 0 + elif memory_type_str == "managed": + IF CUDA_CORE_BUILD_MAJOR >= 13: + alloc_params.poolProps.allocType = cydriver.CUmemAllocationType.CU_MEM_ALLOCATION_TYPE_MANAGED + alloc_params.poolProps.location.type = cydriver.CUmemLocationType.CU_MEM_LOCATION_TYPE_DEVICE + alloc_params.poolProps.location.id = device_id + ELSE: + raise ValueError("memory_type='managed' requires CUDA 13.0 or later") + + if access_descs.size() > 0: + alloc_params.accessDescs = access_descs.data() + alloc_params.accessDescCount = access_descs.size() + + with nogil: + HANDLE_RETURN(cydriver.cuGraphAddMemAllocNode( + &new_node, as_cu(h_graph), deps, num_deps, &alloc_params)) + + return _registered(AllocNode._create_with_params( + create_graph_node_handle(new_node, h_graph), alloc_params.dptr, size, + device_id, memory_type_str, tuple(peer_ids))) + + +cdef inline FreeNode GN_free(GraphNode self, cydriver.CUdeviceptr c_dptr): + cdef cydriver.CUgraphNode new_node = NULL + cdef GraphHandle h_graph = graph_node_get_graph(self._h_node) + cdef cydriver.CUgraphNode pred_node = as_cu(self._h_node) + cdef cydriver.CUgraphNode* deps = NULL + cdef size_t num_deps = 0 + + if pred_node != NULL: + deps = &pred_node + num_deps = 1 + + with nogil: + HANDLE_RETURN(cydriver.cuGraphAddMemFreeNode( + &new_node, as_cu(h_graph), deps, num_deps, c_dptr)) + + return _registered(FreeNode._create_with_params(create_graph_node_handle(new_node, h_graph), c_dptr)) + + +cdef inline OpaqueHandle _buffer_slot_owner(Buffer buf, str label): + """Copy a Buffer's device-pointer handle into a graph slot owner.""" + cdef OpaqueHandle slot_owner + if not buf._h_ptr: + raise ValueError(f"{label} Buffer has no active allocation") + slot_owner = buf._h_ptr + return slot_owner + + +cdef inline OpaqueHandle _resolve_memcpy_operand( + object operand, object owner, str side, cydriver.CUdeviceptr* out_ptr): + """Resolve a memcpy/memset operand to a pointer and optional slot owner. + + ``operand`` is a :class:`Buffer` or a raw integer address; its device + pointer is written to ``out_ptr``. For a :class:`Buffer` operand, returns an + owner that retains the underlying allocation (not the wrapper). For a raw + pointer, returns an owner built from ``owner`` (or an empty handle when + ``owner`` is ``None``). + + Raises + ------ + ValueError + If ``operand`` is a :class:`Buffer` and ``owner`` is not ``None``. + If a :class:`Buffer` operand or ``*_owner`` has no active allocation. + """ + cdef Buffer buf + + if isinstance(operand, Buffer): + if owner is not None: + raise ValueError( + f"{side}_owner cannot be used when {side} is a Buffer" + ) + buf = operand + slot_owner = _buffer_slot_owner(buf, side) + out_ptr[0] = as_cu(buf._h_ptr) + return slot_owner + out_ptr[0] = operand + if owner is None: + return OpaqueHandle() + if isinstance(owner, Buffer): + return _buffer_slot_owner(owner, f"{side}_owner") + return make_opaque_py(owner) + + +cdef inline MemsetNode GN_memset( + GraphNode self, cydriver.CUdeviceptr c_dst, OpaqueHandle dst_owner, + unsigned int val, unsigned int elem_size, + size_t width, size_t height, size_t pitch): + cdef cydriver.CUDA_MEMSET_NODE_PARAMS memset_params + cdef cydriver.CUgraphNode new_node = NULL + cdef GraphHandle h_graph = graph_node_get_graph(self._h_node) + cdef cydriver.CUgraphNode pred_node = as_cu(self._h_node) + cdef cydriver.CUgraphNode* deps = NULL + cdef size_t num_deps = 0 + + if pred_node != NULL: + deps = &pred_node + num_deps = 1 + + cdef cydriver.CUcontext ctx = NULL + with nogil: + HANDLE_RETURN(cydriver.cuCtxGetCurrent(&ctx)) + + c_memset(&memset_params, 0, sizeof(memset_params)) + memset_params.dst = c_dst + memset_params.value = val + memset_params.elementSize = elem_size + memset_params.width = width + memset_params.height = height + memset_params.pitch = pitch + + with nogil: + HANDLE_RETURN(cydriver.cuGraphAddMemsetNode( + &new_node, as_cu(h_graph), deps, num_deps, + &memset_params, ctx)) + + # Retain the destination allocation for the graph's lifetime (slot 0). Roll + # the node back if slot attachment fails, so it cannot outlive an + # unretained allocation. + if dst_owner: + try: + HANDLE_RETURN(graph_set_slot(h_graph, new_node, 0, dst_owner)) + except: + cydriver.cuGraphDestroyNode(new_node) # best effort + raise + + return _registered(MemsetNode._create_with_params( + create_graph_node_handle(new_node, h_graph), c_dst, + val, elem_size, width, height, pitch)) + + +cdef inline MemcpyNode GN_memcpy( + GraphNode self, cydriver.CUdeviceptr c_dst, OpaqueHandle dst_owner, + cydriver.CUdeviceptr c_src, OpaqueHandle src_owner, size_t size): + cdef unsigned int dst_mem_type = cydriver.CU_MEMORYTYPE_DEVICE + cdef unsigned int src_mem_type = cydriver.CU_MEMORYTYPE_DEVICE + cdef cydriver.CUresult ret + with nogil: + ret = cydriver.cuPointerGetAttribute( + &dst_mem_type, + cydriver.CU_POINTER_ATTRIBUTE_MEMORY_TYPE, + c_dst) + if ret != cydriver.CUDA_SUCCESS and ret != cydriver.CUDA_ERROR_INVALID_VALUE: + HANDLE_RETURN(ret) + ret = cydriver.cuPointerGetAttribute( + &src_mem_type, + cydriver.CU_POINTER_ATTRIBUTE_MEMORY_TYPE, + c_src) + if ret != cydriver.CUDA_SUCCESS and ret != cydriver.CUDA_ERROR_INVALID_VALUE: + HANDLE_RETURN(ret) + + cdef cydriver.CUmemorytype c_dst_type = dst_mem_type + cdef cydriver.CUmemorytype c_src_type = src_mem_type + + cdef cydriver.CUDA_MEMCPY3D params + c_memset(¶ms, 0, sizeof(params)) + + params.srcMemoryType = c_src_type + params.dstMemoryType = c_dst_type + if c_src_type == cydriver.CU_MEMORYTYPE_HOST: + params.srcHost = c_src + else: + params.srcDevice = c_src + if c_dst_type == cydriver.CU_MEMORYTYPE_HOST: + params.dstHost = c_dst + else: + params.dstDevice = c_dst + params.WidthInBytes = size + params.Height = 1 + params.Depth = 1 + + cdef cydriver.CUgraphNode new_node = NULL + cdef GraphHandle h_graph = graph_node_get_graph(self._h_node) + cdef cydriver.CUgraphNode pred_node = as_cu(self._h_node) + cdef cydriver.CUgraphNode* deps = NULL + cdef size_t num_deps = 0 + + if pred_node != NULL: + deps = &pred_node + num_deps = 1 + + cdef cydriver.CUcontext ctx = NULL + with nogil: + HANDLE_RETURN(cydriver.cuCtxGetCurrent(&ctx)) + HANDLE_RETURN(cydriver.cuGraphAddMemcpyNode( + &new_node, as_cu(h_graph), deps, num_deps, ¶ms, ctx)) + + # Retain operand allocations for the graph's lifetime (dst -> slot 0, src -> + # slot 1). Roll the node back if slot attachment fails. + try: + if dst_owner: + HANDLE_RETURN(graph_set_slot(h_graph, new_node, 0, dst_owner)) + if src_owner: + HANDLE_RETURN(graph_set_slot(h_graph, new_node, 1, src_owner)) + except: + cydriver.cuGraphDestroyNode(new_node) # best effort + raise + + return _registered(MemcpyNode._create_with_params( + create_graph_node_handle(new_node, h_graph), c_dst, c_src, size, + c_dst_type, c_src_type)) + + +cdef inline ChildGraphNode GN_embed(GraphNode self, GraphDefinition child_def): + cdef cydriver.CUgraphNode new_node = NULL + cdef GraphHandle h_graph = graph_node_get_graph(self._h_node) + cdef cydriver.CUgraphNode pred_node = as_cu(self._h_node) + cdef cydriver.CUgraphNode* deps = NULL + cdef size_t num_deps = 0 + + if pred_node != NULL: + deps = &pred_node + num_deps = 1 + + with nogil: + HANDLE_RETURN(cydriver.cuGraphAddChildGraphNode( + &new_node, as_cu(h_graph), deps, num_deps, as_cu(child_def._h_graph))) + + cdef cydriver.CUgraph embedded_graph = NULL + with nogil: + HANDLE_RETURN(cydriver.cuGraphChildGraphNodeGetGraph( + new_node, &embedded_graph)) + + cdef GraphHandle h_embedded = create_graph_handle_ref(embedded_graph, h_graph) + + return _registered(ChildGraphNode._create_with_params( + create_graph_node_handle(new_node, h_graph), h_embedded)) + + +cdef inline EventRecordNode GN_record_event(GraphNode self, Event ev): + cdef cydriver.CUgraphNode new_node = NULL + cdef GraphHandle h_graph = graph_node_get_graph(self._h_node) + cdef cydriver.CUgraphNode pred_node = as_cu(self._h_node) + cdef cydriver.CUgraphNode* deps = NULL + cdef size_t num_deps = 0 + cdef OpaqueHandle owner + + if pred_node != NULL: + deps = &pred_node + num_deps = 1 + + with nogil: + HANDLE_RETURN(cydriver.cuGraphAddEventRecordNode( + &new_node, as_cu(h_graph), deps, num_deps, as_cu(ev._h_event))) + + owner = ev._h_event + try: + HANDLE_RETURN(graph_set_slot(h_graph, new_node, 0, owner)) + except: + cydriver.cuGraphDestroyNode(new_node) # best effort + raise + + return _registered(EventRecordNode._create_with_params( + create_graph_node_handle(new_node, h_graph), ev._h_event)) + + +cdef inline EventWaitNode GN_wait_event(GraphNode self, Event ev): + cdef cydriver.CUgraphNode new_node = NULL + cdef GraphHandle h_graph = graph_node_get_graph(self._h_node) + cdef cydriver.CUgraphNode pred_node = as_cu(self._h_node) + cdef cydriver.CUgraphNode* deps = NULL + cdef size_t num_deps = 0 + cdef OpaqueHandle owner + + if pred_node != NULL: + deps = &pred_node + num_deps = 1 + + with nogil: + HANDLE_RETURN(cydriver.cuGraphAddEventWaitNode( + &new_node, as_cu(h_graph), deps, num_deps, as_cu(ev._h_event))) + + owner = ev._h_event + try: + HANDLE_RETURN(graph_set_slot(h_graph, new_node, 0, owner)) + except: + cydriver.cuGraphDestroyNode(new_node) # best effort + raise + + return _registered(EventWaitNode._create_with_params( + create_graph_node_handle(new_node, h_graph), ev._h_event)) + + +cdef inline HostCallbackNode GN_callback(GraphNode self, object fn, object user_data): + cdef cydriver.CUDA_HOST_NODE_PARAMS node_params + cdef cydriver.CUgraphNode new_node = NULL + cdef GraphHandle h_graph = graph_node_get_graph(self._h_node) + cdef cydriver.CUgraphNode pred_node = as_cu(self._h_node) + cdef cydriver.CUgraphNode* deps = NULL + cdef size_t num_deps = 0 + cdef OpaqueHandle fn_owner, data_owner + + if pred_node != NULL: + deps = &pred_node + num_deps = 1 + + _resolve_host_callback( + fn, user_data, &node_params.fn, &node_params.userData, + &fn_owner, &data_owner) + + with nogil: + HANDLE_RETURN(cydriver.cuGraphAddHostNode( + &new_node, as_cu(h_graph), deps, num_deps, &node_params)) + + # Roll the node back if owner attachment fails: an unretained host node + # leaves the driver holding a raw pointer into freed Python memory. + try: + _attach_host_callback_owners(h_graph, new_node, fn_owner, data_owner) + except: + cydriver.cuGraphDestroyNode(new_node) # best effort + raise + + cdef object callable_obj = fn if not isinstance(fn, ct._CFuncPtr) else None + return _registered(HostCallbackNode._create_with_params( + create_graph_node_handle(new_node, h_graph), callable_obj, + node_params.fn, node_params.userData)) diff --git a/cuda_core/cuda/core/graph/_host_callback.pxd b/cuda_core/cuda/core/graph/_host_callback.pxd new file mode 100644 index 00000000000..dac249c74ed --- /dev/null +++ b/cuda_core/cuda/core/graph/_host_callback.pxd @@ -0,0 +1,19 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from cuda.bindings cimport cydriver + +from cuda.core._resource_handles cimport GraphHandle, OpaqueHandle + + +cdef bint _is_py_host_trampoline(cydriver.CUhostFn fn) noexcept nogil + +cdef void _resolve_host_callback( + object fn, object user_data, + cydriver.CUhostFn* out_fn, void** out_user_data, + OpaqueHandle* out_fn_owner, OpaqueHandle* out_data_owner) except * + +cdef int _attach_host_callback_owners( + const GraphHandle& h_graph, cydriver.CUgraphNode node, + OpaqueHandle fn_owner, OpaqueHandle data_owner) except -1 diff --git a/cuda_core/cuda/core/graph/_host_callback.pyi b/cuda_core/cuda/core/graph/_host_callback.pyi new file mode 100644 index 00000000000..6c9d0ead317 --- /dev/null +++ b/cuda_core/cuda/core/graph/_host_callback.pyi @@ -0,0 +1,3 @@ +# This file was generated by stubgen-pyx v0.2.6 from cuda_core/cuda/core/graph/_host_callback.pyx + +from __future__ import annotations \ No newline at end of file diff --git a/cuda_core/cuda/core/graph/_host_callback.pyx b/cuda_core/cuda/core/graph/_host_callback.pyx new file mode 100644 index 00000000000..bed2d8152f5 --- /dev/null +++ b/cuda_core/cuda/core/graph/_host_callback.pyx @@ -0,0 +1,79 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from libc.stdint cimport uintptr_t +from libc.stdlib cimport malloc +from libc.string cimport memcpy as c_memcpy + +from cuda.bindings cimport cydriver + +from cuda.core._resource_handles cimport ( + GraphHandle, + OpaqueHandle, + graph_set_slot, + make_opaque_malloc, + make_opaque_py, +) +from cuda.core._utils.cuda_utils cimport HANDLE_RETURN + +import ctypes as ct + + +cdef void _py_host_trampoline(void* data) noexcept with gil: + (data)() + + +cdef bint _is_py_host_trampoline(cydriver.CUhostFn fn) noexcept nogil: + return fn == _py_host_trampoline + + +cdef void _resolve_host_callback( + object fn, object user_data, + cydriver.CUhostFn* out_fn, void** out_user_data, + OpaqueHandle* out_fn_owner, OpaqueHandle* out_data_owner) except *: + """Resolve a Python callable or ctypes CFuncPtr into a C callback pair and + the owners that keep it alive. + + On return ``*out_fn`` / ``*out_user_data`` are ready to pass to + ``cuGraphAddHostNode`` or ``cuLaunchHostFunc``. ``*out_fn_owner`` owns the + callback object; ``*out_data_owner`` owns a copied ``user_data`` buffer and + is left null otherwise. The caller attaches the owners to the node's graph + slots. + """ + if isinstance(fn, ct._CFuncPtr): + out_fn[0] = ct.cast(fn, ct.c_void_p).value + if user_data is None: + out_user_data[0] = NULL + elif isinstance(user_data, int): + out_user_data[0] = user_data + else: + buf = bytes(user_data) + if len(buf): + out_user_data[0] = malloc(len(buf)) + if out_user_data[0] == NULL: + raise MemoryError("failed to allocate user_data buffer") + c_memcpy(out_user_data[0], buf, len(buf)) + out_data_owner[0] = make_opaque_malloc(out_user_data[0]) + else: + out_user_data[0] = NULL + else: + if user_data is not None: + raise ValueError( + "user_data is only supported with ctypes function pointers") + out_fn[0] = _py_host_trampoline + out_user_data[0] = fn + + out_fn_owner[0] = make_opaque_py(fn) + + +cdef int _attach_host_callback_owners( + const GraphHandle& h_graph, cydriver.CUgraphNode node, + OpaqueHandle fn_owner, OpaqueHandle data_owner) except -1: + """Attach a resolved host callback's owners to its node's graph slots: the + callback in slot 0 and any copied ``user_data`` buffer in slot 1. + """ + HANDLE_RETURN(graph_set_slot(h_graph, node, 0, fn_owner)) + if data_owner: + HANDLE_RETURN(graph_set_slot(h_graph, node, 1, data_owner)) + return 0 diff --git a/cuda_core/cuda/core/graph/_subclasses.pxd b/cuda_core/cuda/core/graph/_subclasses.pxd new file mode 100644 index 00000000000..7f84b713429 --- /dev/null +++ b/cuda_core/cuda/core/graph/_subclasses.pxd @@ -0,0 +1,174 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from libc.stddef cimport size_t + +from cuda.bindings cimport cydriver +from cuda.core.graph._graph_definition cimport GraphCondition +from cuda.core.graph._graph_node cimport GraphNode +from cuda.core._resource_handles cimport EventHandle, GraphHandle, GraphNodeHandle, KernelHandle + + +cdef class EmptyNode(GraphNode): + @staticmethod + cdef EmptyNode _create_impl(GraphNodeHandle h_node) + + +cdef class KernelNode(GraphNode): + cdef: + tuple _grid + tuple _block + unsigned int _shmem_size + KernelHandle _h_kernel + + @staticmethod + cdef KernelNode _create_with_params(GraphNodeHandle h_node, + tuple grid, tuple block, unsigned int shmem_size, + KernelHandle h_kernel) + + @staticmethod + cdef KernelNode _create_from_driver(GraphNodeHandle h_node) + + +cdef class AllocNode(GraphNode): + cdef: + cydriver.CUdeviceptr _dptr + size_t _bytesize + int _device_id + str _memory_type + tuple _peer_access + + @staticmethod + cdef AllocNode _create_with_params(GraphNodeHandle h_node, + cydriver.CUdeviceptr dptr, size_t bytesize, + int device_id, str memory_type, tuple peer_access) + + @staticmethod + cdef AllocNode _create_from_driver(GraphNodeHandle h_node) + + +cdef class FreeNode(GraphNode): + cdef: + cydriver.CUdeviceptr _dptr + + @staticmethod + cdef FreeNode _create_with_params(GraphNodeHandle h_node, + cydriver.CUdeviceptr dptr) + + @staticmethod + cdef FreeNode _create_from_driver(GraphNodeHandle h_node) + + +cdef class MemsetNode(GraphNode): + cdef: + cydriver.CUdeviceptr _dptr + unsigned int _value + unsigned int _element_size + size_t _width + size_t _height + size_t _pitch + + @staticmethod + cdef MemsetNode _create_with_params(GraphNodeHandle h_node, + cydriver.CUdeviceptr dptr, unsigned int value, + unsigned int element_size, size_t width, + size_t height, size_t pitch) + + @staticmethod + cdef MemsetNode _create_from_driver(GraphNodeHandle h_node) + + +cdef class MemcpyNode(GraphNode): + cdef: + cydriver.CUdeviceptr _dst + cydriver.CUdeviceptr _src + size_t _size + cydriver.CUmemorytype _dst_type + cydriver.CUmemorytype _src_type + + @staticmethod + cdef MemcpyNode _create_with_params(GraphNodeHandle h_node, + cydriver.CUdeviceptr dst, cydriver.CUdeviceptr src, + size_t size, cydriver.CUmemorytype dst_type, + cydriver.CUmemorytype src_type) + + @staticmethod + cdef MemcpyNode _create_from_driver(GraphNodeHandle h_node) + + +cdef class ChildGraphNode(GraphNode): + cdef: + GraphHandle _h_child_graph + + @staticmethod + cdef ChildGraphNode _create_with_params(GraphNodeHandle h_node, + GraphHandle h_child_graph) + + @staticmethod + cdef ChildGraphNode _create_from_driver(GraphNodeHandle h_node) + + +cdef class EventRecordNode(GraphNode): + cdef: + EventHandle _h_event + + @staticmethod + cdef EventRecordNode _create_with_params(GraphNodeHandle h_node, + EventHandle h_event) + + @staticmethod + cdef EventRecordNode _create_from_driver(GraphNodeHandle h_node) + + +cdef class EventWaitNode(GraphNode): + cdef: + EventHandle _h_event + + @staticmethod + cdef EventWaitNode _create_with_params(GraphNodeHandle h_node, + EventHandle h_event) + + @staticmethod + cdef EventWaitNode _create_from_driver(GraphNodeHandle h_node) + + +cdef class HostCallbackNode(GraphNode): + cdef: + object _callable + cydriver.CUhostFn _fn + void* _user_data + + @staticmethod + cdef HostCallbackNode _create_with_params(GraphNodeHandle h_node, + object callable_obj, cydriver.CUhostFn fn, + void* user_data) + + @staticmethod + cdef HostCallbackNode _create_from_driver(GraphNodeHandle h_node) + + +cdef class ConditionalNode(GraphNode): + cdef: + GraphCondition _condition + cydriver.CUgraphConditionalNodeType _cond_type + tuple _branches + + @staticmethod + cdef ConditionalNode _create_from_driver(GraphNodeHandle h_node) + + +cdef class IfNode(ConditionalNode): + pass + + +cdef class IfElseNode(ConditionalNode): + pass + + +cdef class WhileNode(ConditionalNode): + pass + + +cdef class SwitchNode(ConditionalNode): + pass diff --git a/cuda_core/cuda/core/graph/_subclasses.pyi b/cuda_core/cuda/core/graph/_subclasses.pyi new file mode 100644 index 00000000000..345e6417c4d --- /dev/null +++ b/cuda_core/cuda/core/graph/_subclasses.pyi @@ -0,0 +1,339 @@ +# This file was generated by stubgen-pyx v0.2.6 from cuda_core/cuda/core/graph/_subclasses.pyx + +"""GraphNode subclasses — EmptyNode through SwitchNode.""" +from __future__ import annotations + +from cuda.core._event import Event +from cuda.core._launch_config import LaunchConfig +from cuda.core._module import Kernel +from cuda.core.graph._graph_definition import GraphCondition, GraphDefinition +from cuda.core.graph._graph_node import GraphNode +from cuda.core.typing import GraphConditionalType + + +class EmptyNode(GraphNode): + """An empty (synchronization) node.""" + + def __repr__(self) -> str: + ... + +class KernelNode(GraphNode): + """A kernel launch node. + + Properties + ---------- + grid : tuple of int + Grid dimensions (gridDimX, gridDimY, gridDimZ). + block : tuple of int + Block dimensions (blockDimX, blockDimY, blockDimZ). + shmem_size : int + Dynamic shared memory size in bytes. + kernel : Kernel + The kernel object for this launch node. + config : LaunchConfig + A LaunchConfig reconstructed from this node's parameters. + """ + + def __repr__(self) -> str: + ... + + @property + def grid(self) -> tuple[int, int, int]: + """Grid dimensions as a 3-tuple (gridDimX, gridDimY, gridDimZ).""" + + @property + def block(self) -> tuple[int, int, int]: + """Block dimensions as a 3-tuple (blockDimX, blockDimY, blockDimZ).""" + + @property + def shmem_size(self) -> int: + """Dynamic shared memory size in bytes.""" + + @property + def kernel(self) -> Kernel: + """The Kernel object for this launch node.""" + + @property + def config(self) -> LaunchConfig: + """A LaunchConfig reconstructed from this node's grid, block, and shmem_size. + + Note: cluster dimensions and is_cooperative are not preserved + by the CUDA driver's kernel node params, so they are not included. + """ + +class AllocNode(GraphNode): + """A memory allocation node. + + Properties + ---------- + dptr : int + The device pointer for the allocation. + bytesize : int + The number of bytes allocated. + device_id : int + The device on which the allocation was made. + memory_type : GraphMemoryType | str + The type of memory allocated. + peer_access : tuple of int + Device IDs that have read-write access to this allocation. + """ + + def __repr__(self) -> str: + ... + + @property + def dptr(self) -> int: + """The device pointer for the allocation.""" + + @property + def bytesize(self) -> int: + """The number of bytes allocated.""" + + @property + def device_id(self) -> int: + """The device on which the allocation was made.""" + + @property + def memory_type(self) -> str: + """The type of memory: ``"device"``, ``"host"``, or ``"managed"``.""" + + @property + def peer_access(self) -> tuple[int, ...]: + """Device IDs with read-write access to this allocation.""" + +class FreeNode(GraphNode): + """A memory deallocation node. + + Properties + ---------- + dptr : int + The device pointer being freed. + """ + + def __repr__(self) -> str: + ... + + @property + def dptr(self) -> int: + """The device pointer being freed.""" + +class MemsetNode(GraphNode): + """A memset node. + + Properties + ---------- + dptr : int + The destination device pointer. + value : int + The fill value. + element_size : int + Element size in bytes (1, 2, or 4). + width : int + Width of the row in elements. + height : int + Number of rows. + pitch : int + Pitch in bytes (unused if height is 1). + """ + + def __repr__(self) -> str: + ... + + @property + def dptr(self) -> int: + """The destination device pointer.""" + + @property + def value(self) -> int: + """The fill value.""" + + @property + def element_size(self) -> int: + """Element size in bytes (1, 2, or 4).""" + + @property + def width(self) -> int: + """Width of the row in elements.""" + + @property + def height(self) -> int: + """Number of rows.""" + + @property + def pitch(self) -> int: + """Pitch in bytes (unused if height is 1).""" + +class MemcpyNode(GraphNode): + """A memcpy node. + + Properties + ---------- + dst : int + The destination pointer. + src : int + The source pointer. + size : int + The number of bytes copied. + """ + + def __repr__(self) -> str: + ... + + @property + def dst(self) -> int: + """The destination pointer.""" + + @property + def src(self) -> int: + """The source pointer.""" + + @property + def size(self) -> int: + """The number of bytes copied.""" + +class ChildGraphNode(GraphNode): + """A child graph node. + + Properties + ---------- + child_graph : GraphDefinition + The embedded graph definition (non-owning wrapper). + """ + + def __repr__(self) -> str: + ... + + @property + def child_graph(self) -> GraphDefinition: + """The embedded graph definition (non-owning wrapper).""" + +class EventRecordNode(GraphNode): + """An event record node. + + Properties + ---------- + event : Event + The event being recorded. + """ + + def __repr__(self) -> str: + ... + + @property + def event(self) -> Event: + """The event being recorded.""" + +class EventWaitNode(GraphNode): + """An event wait node. + + Properties + ---------- + event : Event + The event being waited on. + """ + + def __repr__(self) -> str: + ... + + @property + def event(self) -> Event: + """The event being waited on.""" + +class HostCallbackNode(GraphNode): + """A host callback node. + + Properties + ---------- + callback : callable or None + The Python callable (None for ctypes function pointer callbacks). + """ + + def __repr__(self) -> str: + ... + + @property + def callback(self): + """The Python callable, or None for ctypes function pointer callbacks.""" + +class ConditionalNode(GraphNode): + """Base class for conditional nodes. + + When created via builder methods (if_then, if_else, while_loop, switch), + a specific subclass (IfNode, IfElseNode, WhileNode, SwitchNode) is + returned. When reconstructed from the driver on CUDA 13.2+, the + correct subclass is determined via cuGraphNodeGetParams. On older + drivers, this base class is used as a fallback. + + Properties + ---------- + condition : GraphCondition or None + The condition variable controlling execution (None pre-13.2). + cond_type : str or None + The conditional type ("if", "while", or "switch"; None pre-13.2). + branches : tuple of GraphDefinition + The body graphs for each branch (empty pre-13.2). + """ + + def __repr__(self) -> str: + ... + + @property + def condition(self) -> GraphCondition | None: + """The condition variable controlling execution.""" + + @property + def cond_type(self) -> GraphConditionalType | None: + """The conditional type: GraphConditionalType.IF, .WHILE, or .SWITCH + + Returns None when reconstructed from the driver pre-CUDA 13.2, + as the conditional type cannot be determined. + """ + + @property + def branches(self) -> tuple[GraphDefinition, ...]: + """The body graphs for each branch as a tuple of GraphDefinition. + + Returns an empty tuple when reconstructed from the driver + pre-CUDA 13.2. + """ + +class IfNode(ConditionalNode): + """An if-conditional node.""" + + def __repr__(self) -> str: + ... + + @property + def then(self) -> GraphDefinition: + """The 'then' branch graph.""" + +class IfElseNode(ConditionalNode): + """An if-else conditional node.""" + + def __repr__(self) -> str: + ... + + @property + def then(self) -> GraphDefinition: + """The ``then`` branch graph (executed when condition is non-zero).""" + + @property + def else_(self) -> GraphDefinition: + """The ``else`` branch graph (executed when condition is zero).""" + +class WhileNode(ConditionalNode): + """A while-loop conditional node.""" + + def __repr__(self) -> str: + ... + + @property + def body(self) -> GraphDefinition: + """The loop body graph.""" + +class SwitchNode(ConditionalNode): + """A switch conditional node.""" + + def __repr__(self) -> str: + ... +__all__ = ['AllocNode', 'ChildGraphNode', 'ConditionalNode', 'EmptyNode', 'EventRecordNode', 'EventWaitNode', 'FreeNode', 'HostCallbackNode', 'IfElseNode', 'IfNode', 'KernelNode', 'MemcpyNode', 'MemsetNode', 'SwitchNode', 'WhileNode'] \ No newline at end of file diff --git a/cuda_core/cuda/core/graph/_subclasses.pyx b/cuda_core/cuda/core/graph/_subclasses.pyx new file mode 100644 index 00000000000..a393dfff693 --- /dev/null +++ b/cuda_core/cuda/core/graph/_subclasses.pyx @@ -0,0 +1,766 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +"""GraphNode subclasses — EmptyNode through SwitchNode.""" + +from __future__ import annotations + +from libc.stddef cimport size_t +from libc.stdint cimport uintptr_t + +from cuda.bindings cimport cydriver + +from cuda.core._event cimport Event +from cuda.core._launch_config cimport LaunchConfig +from cuda.core._module cimport Kernel +from cuda.core.graph._graph_definition cimport GraphCondition, GraphDefinition +from cuda.core.graph._graph_node cimport GraphNode +from cuda.core._resource_handles cimport ( + EventHandle, + GraphHandle, + KernelHandle, + GraphNodeHandle, + as_cu, + as_intptr, + create_event_handle_ref, + create_graph_handle_ref, + create_kernel_handle_ref, + graph_node_get_graph, +) +from cuda.core._utils.cuda_utils cimport HANDLE_RETURN + +from cuda.core.graph._host_callback cimport _is_py_host_trampoline + +from cuda.core._utils.cuda_utils import driver, handle_return +from cuda.core.typing import GraphConditionalType + +__all__ = [ + 'AllocNode', + 'ChildGraphNode', + 'ConditionalNode', + 'EmptyNode', + 'EventRecordNode', + 'EventWaitNode', + 'FreeNode', + 'HostCallbackNode', + 'IfElseNode', + 'IfNode', + 'KernelNode', + 'MemcpyNode', + 'MemsetNode', + 'SwitchNode', + 'WhileNode', +] + + +cdef bint _has_cuGraphNodeGetParams = False +cdef bint _version_checked = False + +cdef bint _check_node_get_params(): + global _has_cuGraphNodeGetParams, _version_checked + if not _version_checked: + from cuda.core._utils.version import binding_version, driver_version + _has_cuGraphNodeGetParams = ( + driver_version() >= (13, 2, 0) and binding_version() >= (13, 2, 0) + ) + _version_checked = True + return _has_cuGraphNodeGetParams + + +cdef class EmptyNode(GraphNode): + """An empty (synchronization) node.""" + + @staticmethod + cdef EmptyNode _create_impl(GraphNodeHandle h_node): + cdef EmptyNode n = EmptyNode.__new__(EmptyNode) + n._h_node = h_node + return n + + def __repr__(self) -> str: + return f"" + + +cdef class KernelNode(GraphNode): + """A kernel launch node. + + Properties + ---------- + grid : tuple of int + Grid dimensions (gridDimX, gridDimY, gridDimZ). + block : tuple of int + Block dimensions (blockDimX, blockDimY, blockDimZ). + shmem_size : int + Dynamic shared memory size in bytes. + kernel : Kernel + The kernel object for this launch node. + config : LaunchConfig + A LaunchConfig reconstructed from this node's parameters. + """ + + @staticmethod + cdef KernelNode _create_with_params(GraphNodeHandle h_node, + tuple grid, tuple block, unsigned int shmem_size, + KernelHandle h_kernel): + """Create from known params (called by launch() builder).""" + cdef KernelNode n = KernelNode.__new__(KernelNode) + n._h_node = h_node + n._grid = grid + n._block = block + n._shmem_size = shmem_size + n._h_kernel = h_kernel + return n + + @staticmethod + cdef KernelNode _create_from_driver(GraphNodeHandle h_node): + """Create by fetching params from the driver (called by _create factory).""" + cdef cydriver.CUgraphNode node = as_cu(h_node) + cdef cydriver.CUDA_KERNEL_NODE_PARAMS params + with nogil: + HANDLE_RETURN(cydriver.cuGraphKernelNodeGetParams(node, ¶ms)) + cdef KernelHandle h_kernel = create_kernel_handle_ref(params.kern) + return KernelNode._create_with_params( + h_node, + (params.gridDimX, params.gridDimY, params.gridDimZ), + (params.blockDimX, params.blockDimY, params.blockDimZ), + params.sharedMemBytes, + h_kernel) + + def __repr__(self) -> str: + return (f"") + + @property + def grid(self) -> tuple[int, int, int]: + """Grid dimensions as a 3-tuple (gridDimX, gridDimY, gridDimZ).""" + return self._grid + + @property + def block(self) -> tuple[int, int, int]: + """Block dimensions as a 3-tuple (blockDimX, blockDimY, blockDimZ).""" + return self._block + + @property + def shmem_size(self) -> int: + """Dynamic shared memory size in bytes.""" + return self._shmem_size + + @property + def kernel(self) -> Kernel: + """The Kernel object for this launch node.""" + return Kernel._from_handle(self._h_kernel) + + @property + def config(self) -> LaunchConfig: + """A LaunchConfig reconstructed from this node's grid, block, and shmem_size. + + Note: cluster dimensions and is_cooperative are not preserved + by the CUDA driver's kernel node params, so they are not included. + """ + return LaunchConfig(grid=self._grid, block=self._block, + shmem_size=self._shmem_size) + + +cdef class AllocNode(GraphNode): + """A memory allocation node. + + Properties + ---------- + dptr : int + The device pointer for the allocation. + bytesize : int + The number of bytes allocated. + device_id : int + The device on which the allocation was made. + memory_type : GraphMemoryType | str + The type of memory allocated. + peer_access : tuple of int + Device IDs that have read-write access to this allocation. + """ + + @staticmethod + cdef AllocNode _create_with_params(GraphNodeHandle h_node, + cydriver.CUdeviceptr dptr, size_t bytesize, + int device_id, str memory_type, tuple peer_access): + """Create from known params (called by allocate() builder).""" + cdef AllocNode n = AllocNode.__new__(AllocNode) + n._h_node = h_node + n._dptr = dptr + n._bytesize = bytesize + n._device_id = device_id + n._memory_type = memory_type + n._peer_access = peer_access + return n + + @staticmethod + cdef AllocNode _create_from_driver(GraphNodeHandle h_node): + """Create by fetching params from the driver (called by _create factory).""" + cdef cydriver.CUgraphNode node = as_cu(h_node) + cdef cydriver.CUDA_MEM_ALLOC_NODE_PARAMS params + with nogil: + HANDLE_RETURN(cydriver.cuGraphMemAllocNodeGetParams(node, ¶ms)) + + cdef str memory_type + if params.poolProps.allocType == cydriver.CUmemAllocationType.CU_MEM_ALLOCATION_TYPE_PINNED: + if params.poolProps.location.type == cydriver.CUmemLocationType.CU_MEM_LOCATION_TYPE_HOST: + memory_type = "host" + else: + memory_type = "device" + else: + IF CUDA_CORE_BUILD_MAJOR >= 13: + if params.poolProps.allocType == cydriver.CUmemAllocationType.CU_MEM_ALLOCATION_TYPE_MANAGED: + memory_type = "managed" + else: + memory_type = "device" + ELSE: + memory_type = "device" + + cdef list peer_ids = [] + cdef size_t i + for i in range(params.accessDescCount): + peer_ids.append(params.accessDescs[i].location.id) + + return AllocNode._create_with_params( + h_node, params.dptr, params.bytesize, + params.poolProps.location.id, memory_type, tuple(peer_ids)) + + def __repr__(self) -> str: + return (f"") + + @property + def dptr(self) -> int: + """The device pointer for the allocation.""" + return self._dptr + + @property + def bytesize(self) -> int: + """The number of bytes allocated.""" + return self._bytesize + + @property + def device_id(self) -> int: + """The device on which the allocation was made.""" + return self._device_id + + @property + def memory_type(self) -> str: + """The type of memory: ``"device"``, ``"host"``, or ``"managed"``.""" + return self._memory_type + + @property + def peer_access(self) -> tuple[int, ...]: + """Device IDs with read-write access to this allocation.""" + return self._peer_access + + +cdef class FreeNode(GraphNode): + """A memory deallocation node. + + Properties + ---------- + dptr : int + The device pointer being freed. + """ + + @staticmethod + cdef FreeNode _create_with_params(GraphNodeHandle h_node, + cydriver.CUdeviceptr dptr): + """Create from known params (called by deallocate() builder).""" + cdef FreeNode n = FreeNode.__new__(FreeNode) + n._h_node = h_node + n._dptr = dptr + return n + + @staticmethod + cdef FreeNode _create_from_driver(GraphNodeHandle h_node): + """Create by fetching params from the driver (called by _create factory).""" + cdef cydriver.CUgraphNode node = as_cu(h_node) + cdef cydriver.CUdeviceptr dptr + with nogil: + HANDLE_RETURN(cydriver.cuGraphMemFreeNodeGetParams(node, &dptr)) + return FreeNode._create_with_params(h_node, dptr) + + def __repr__(self) -> str: + return f"" + + @property + def dptr(self) -> int: + """The device pointer being freed.""" + return self._dptr + + +cdef class MemsetNode(GraphNode): + """A memset node. + + Properties + ---------- + dptr : int + The destination device pointer. + value : int + The fill value. + element_size : int + Element size in bytes (1, 2, or 4). + width : int + Width of the row in elements. + height : int + Number of rows. + pitch : int + Pitch in bytes (unused if height is 1). + """ + + @staticmethod + cdef MemsetNode _create_with_params(GraphNodeHandle h_node, + cydriver.CUdeviceptr dptr, unsigned int value, + unsigned int element_size, size_t width, + size_t height, size_t pitch): + """Create from known params (called by memset() builder).""" + cdef MemsetNode n = MemsetNode.__new__(MemsetNode) + n._h_node = h_node + n._dptr = dptr + n._value = value + n._element_size = element_size + n._width = width + n._height = height + n._pitch = pitch + return n + + @staticmethod + cdef MemsetNode _create_from_driver(GraphNodeHandle h_node): + """Create by fetching params from the driver (called by _create factory).""" + cdef cydriver.CUgraphNode node = as_cu(h_node) + cdef cydriver.CUDA_MEMSET_NODE_PARAMS params + with nogil: + HANDLE_RETURN(cydriver.cuGraphMemsetNodeGetParams(node, ¶ms)) + return MemsetNode._create_with_params( + h_node, params.dst, params.value, + params.elementSize, params.width, params.height, params.pitch) + + def __repr__(self) -> str: + return (f"") + + @property + def dptr(self) -> int: + """The destination device pointer.""" + return self._dptr + + @property + def value(self) -> int: + """The fill value.""" + return self._value + + @property + def element_size(self) -> int: + """Element size in bytes (1, 2, or 4).""" + return self._element_size + + @property + def width(self) -> int: + """Width of the row in elements.""" + return self._width + + @property + def height(self) -> int: + """Number of rows.""" + return self._height + + @property + def pitch(self) -> int: + """Pitch in bytes (unused if height is 1).""" + return self._pitch + + +cdef class MemcpyNode(GraphNode): + """A memcpy node. + + Properties + ---------- + dst : int + The destination pointer. + src : int + The source pointer. + size : int + The number of bytes copied. + """ + + @staticmethod + cdef MemcpyNode _create_with_params(GraphNodeHandle h_node, + cydriver.CUdeviceptr dst, cydriver.CUdeviceptr src, + size_t size, cydriver.CUmemorytype dst_type, + cydriver.CUmemorytype src_type): + """Create from known params (called by memcpy() builder).""" + cdef MemcpyNode n = MemcpyNode.__new__(MemcpyNode) + n._h_node = h_node + n._dst = dst + n._src = src + n._size = size + n._dst_type = dst_type + n._src_type = src_type + return n + + @staticmethod + cdef MemcpyNode _create_from_driver(GraphNodeHandle h_node): + """Create by fetching params from the driver (called by _create factory).""" + cdef cydriver.CUgraphNode node = as_cu(h_node) + cdef cydriver.CUDA_MEMCPY3D params + with nogil: + HANDLE_RETURN(cydriver.cuGraphMemcpyNodeGetParams(node, ¶ms)) + + cdef cydriver.CUdeviceptr dst + cdef cydriver.CUdeviceptr src + if params.dstMemoryType == cydriver.CU_MEMORYTYPE_HOST: + dst = params.dstHost + else: + dst = params.dstDevice + if params.srcMemoryType == cydriver.CU_MEMORYTYPE_HOST: + src = params.srcHost + else: + src = params.srcDevice + + return MemcpyNode._create_with_params( + h_node, dst, src, params.WidthInBytes, + params.dstMemoryType, params.srcMemoryType) + + def __repr__(self) -> str: + cdef str dt = "H" if self._dst_type == cydriver.CU_MEMORYTYPE_HOST else "D" + cdef str st = "H" if self._src_type == cydriver.CU_MEMORYTYPE_HOST else "D" + return (f"") + + @property + def dst(self) -> int: + """The destination pointer.""" + return self._dst + + @property + def src(self) -> int: + """The source pointer.""" + return self._src + + @property + def size(self) -> int: + """The number of bytes copied.""" + return self._size + + +cdef class ChildGraphNode(GraphNode): + """A child graph node. + + Properties + ---------- + child_graph : GraphDefinition + The embedded graph definition (non-owning wrapper). + """ + + @staticmethod + cdef ChildGraphNode _create_with_params(GraphNodeHandle h_node, + GraphHandle h_child_graph): + """Create from known params (called by embed() builder).""" + cdef ChildGraphNode n = ChildGraphNode.__new__(ChildGraphNode) + n._h_node = h_node + n._h_child_graph = h_child_graph + return n + + @staticmethod + cdef ChildGraphNode _create_from_driver(GraphNodeHandle h_node): + """Create by fetching params from the driver (called by _create factory).""" + cdef cydriver.CUgraphNode node = as_cu(h_node) + cdef cydriver.CUgraph child_graph = NULL + with nogil: + HANDLE_RETURN(cydriver.cuGraphChildGraphNodeGetGraph(node, &child_graph)) + cdef GraphHandle h_graph = graph_node_get_graph(h_node) + cdef GraphHandle h_child = create_graph_handle_ref(child_graph, h_graph) + return ChildGraphNode._create_with_params(h_node, h_child) + + def __repr__(self) -> str: + return (f"") + + @property + def child_graph(self) -> GraphDefinition: + """The embedded graph definition (non-owning wrapper).""" + return GraphDefinition._from_handle(self._h_child_graph) + + +cdef class EventRecordNode(GraphNode): + """An event record node. + + Properties + ---------- + event : Event + The event being recorded. + """ + + @staticmethod + cdef EventRecordNode _create_with_params(GraphNodeHandle h_node, + EventHandle h_event): + """Create from known params (called by record() builder).""" + cdef EventRecordNode n = EventRecordNode.__new__(EventRecordNode) + n._h_node = h_node + n._h_event = h_event + return n + + @staticmethod + cdef EventRecordNode _create_from_driver(GraphNodeHandle h_node): + """Create by fetching params from the driver (called by _create factory).""" + cdef cydriver.CUgraphNode node = as_cu(h_node) + cdef cydriver.CUevent event + with nogil: + HANDLE_RETURN(cydriver.cuGraphEventRecordNodeGetEvent(node, &event)) + cdef EventHandle h_event = create_event_handle_ref(event) + return EventRecordNode._create_with_params(h_node, h_event) + + def __repr__(self) -> str: + return (f"") + + @property + def event(self) -> Event: + """The event being recorded.""" + return Event._from_handle(self._h_event) + + +cdef class EventWaitNode(GraphNode): + """An event wait node. + + Properties + ---------- + event : Event + The event being waited on. + """ + + @staticmethod + cdef EventWaitNode _create_with_params(GraphNodeHandle h_node, + EventHandle h_event): + """Create from known params (called by wait() builder).""" + cdef EventWaitNode n = EventWaitNode.__new__(EventWaitNode) + n._h_node = h_node + n._h_event = h_event + return n + + @staticmethod + cdef EventWaitNode _create_from_driver(GraphNodeHandle h_node): + """Create by fetching params from the driver (called by _create factory).""" + cdef cydriver.CUgraphNode node = as_cu(h_node) + cdef cydriver.CUevent event + with nogil: + HANDLE_RETURN(cydriver.cuGraphEventWaitNodeGetEvent(node, &event)) + cdef EventHandle h_event = create_event_handle_ref(event) + return EventWaitNode._create_with_params(h_node, h_event) + + def __repr__(self) -> str: + return (f"") + + @property + def event(self) -> Event: + """The event being waited on.""" + return Event._from_handle(self._h_event) + + +cdef class HostCallbackNode(GraphNode): + """A host callback node. + + Properties + ---------- + callback : callable or None + The Python callable (None for ctypes function pointer callbacks). + """ + + @staticmethod + cdef HostCallbackNode _create_with_params(GraphNodeHandle h_node, + object callable_obj, cydriver.CUhostFn fn, + void* user_data): + """Create from known params (called by callback() builder).""" + cdef HostCallbackNode n = HostCallbackNode.__new__(HostCallbackNode) + n._h_node = h_node + n._callable = callable_obj + n._fn = fn + n._user_data = user_data + return n + + @staticmethod + cdef HostCallbackNode _create_from_driver(GraphNodeHandle h_node): + """Create by fetching params from the driver (called by _create factory).""" + cdef cydriver.CUgraphNode node = as_cu(h_node) + cdef cydriver.CUDA_HOST_NODE_PARAMS params + with nogil: + HANDLE_RETURN(cydriver.cuGraphHostNodeGetParams(node, ¶ms)) + + cdef object callable_obj = None + if _is_py_host_trampoline(params.fn): + callable_obj = params.userData + + return HostCallbackNode._create_with_params( + h_node, callable_obj, params.fn, params.userData) + + def __repr__(self) -> str: + if self._callable is not None: + name = getattr(self._callable, '__name__', '?') + return (f"") + return (f"self._fn:x}>") + + @property + def callback(self): + """The Python callable, or None for ctypes function pointer callbacks.""" + return self._callable + + +cdef class ConditionalNode(GraphNode): + """Base class for conditional nodes. + + When created via builder methods (if_then, if_else, while_loop, switch), + a specific subclass (IfNode, IfElseNode, WhileNode, SwitchNode) is + returned. When reconstructed from the driver on CUDA 13.2+, the + correct subclass is determined via cuGraphNodeGetParams. On older + drivers, this base class is used as a fallback. + + Properties + ---------- + condition : GraphCondition or None + The condition variable controlling execution (None pre-13.2). + cond_type : str or None + The conditional type ("if", "while", or "switch"; None pre-13.2). + branches : tuple of GraphDefinition + The body graphs for each branch (empty pre-13.2). + """ + + @staticmethod + cdef ConditionalNode _create_from_driver(GraphNodeHandle h_node): + cdef ConditionalNode n + if not _check_node_get_params(): + n = ConditionalNode.__new__(ConditionalNode) + n._h_node = h_node + n._condition = None + n._cond_type = cydriver.CU_GRAPH_COND_TYPE_IF + n._branches = () + return n + + cdef cydriver.CUgraphNode node = as_cu(h_node) + params = handle_return(driver.cuGraphNodeGetParams( + node)) + cond_params = params.conditional + cdef int cond_type_int = int(cond_params.type) + cdef unsigned int size = int(cond_params.size) + + cdef GraphCondition condition = GraphCondition.__new__(GraphCondition) + condition._c_handle = ( + int(cond_params.handle)) + + cdef GraphHandle h_graph = graph_node_get_graph(h_node) + cdef list branch_list = [] + cdef unsigned int i + cdef GraphHandle h_branch + if cond_params.phGraph_out is not None: + for i in range(size): + h_branch = create_graph_handle_ref( + int(cond_params.phGraph_out[i]), + h_graph) + branch_list.append(GraphDefinition._from_handle(h_branch)) + cdef tuple branches = tuple(branch_list) + + cdef type cls + if cond_type_int == cydriver.CU_GRAPH_COND_TYPE_IF: + if size == 1: + cls = IfNode + else: + cls = IfElseNode + elif cond_type_int == cydriver.CU_GRAPH_COND_TYPE_WHILE: + cls = WhileNode + else: + cls = SwitchNode + + n = cls.__new__(cls) + n._h_node = h_node + n._condition = condition + n._cond_type = cond_type_int + n._branches = branches + return n + + def __repr__(self) -> str: + return f"" + + @property + def condition(self) -> GraphCondition | None: + """The condition variable controlling execution.""" + return self._condition + + @property + def cond_type(self) -> GraphConditionalType | None: + """The conditional type: GraphConditionalType.IF, .WHILE, or .SWITCH + + Returns None when reconstructed from the driver pre-CUDA 13.2, + as the conditional type cannot be determined. + """ + if self._condition is None: + return None + if self._cond_type == cydriver.CU_GRAPH_COND_TYPE_IF: + return GraphConditionalType("if") + elif self._cond_type == cydriver.CU_GRAPH_COND_TYPE_WHILE: + return GraphConditionalType("while") + else: + return GraphConditionalType("switch") + + @property + def branches(self) -> tuple[GraphDefinition, ...]: + """The body graphs for each branch as a tuple of GraphDefinition. + + Returns an empty tuple when reconstructed from the driver + pre-CUDA 13.2. + """ + return self._branches + + +cdef class IfNode(ConditionalNode): + """An if-conditional node.""" + + def __repr__(self) -> str: + return (f"self._condition._c_handle:x}>") + + @property + def then(self) -> GraphDefinition: + """The 'then' branch graph.""" + return self._branches[0] + + +cdef class IfElseNode(ConditionalNode): + """An if-else conditional node.""" + + def __repr__(self) -> str: + return (f"self._condition._c_handle:x}>") + + @property + def then(self) -> GraphDefinition: + """The ``then`` branch graph (executed when condition is non-zero).""" + return self._branches[0] + + @property + def else_(self) -> GraphDefinition: + """The ``else`` branch graph (executed when condition is zero).""" + return self._branches[1] + + +cdef class WhileNode(ConditionalNode): + """A while-loop conditional node.""" + + def __repr__(self) -> str: + return (f"self._condition._c_handle:x}>") + + @property + def body(self) -> GraphDefinition: + """The loop body graph.""" + return self._branches[0] + + +cdef class SwitchNode(ConditionalNode): + """A switch conditional node.""" + + def __repr__(self) -> str: + return (f"self._condition._c_handle:x}>") diff --git a/docs/.nojekyll b/cuda_core/cuda/core/py.typed similarity index 100% rename from docs/.nojekyll rename to cuda_core/cuda/core/py.typed diff --git a/cuda_core/cuda/core/system/__init__.py b/cuda_core/cuda/core/system/__init__.py new file mode 100644 index 00000000000..685519f9b80 --- /dev/null +++ b/cuda_core/cuda/core/system/__init__.py @@ -0,0 +1,46 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + + +# NOTE: We must maintain that it is always possible to import this module +# without CUDA being installed, and without CUDA being initialized or any +# contexts created, so that a user can use NVML to explore things about their +# system without loading CUDA. + +from typing import TYPE_CHECKING + +__all__ = [ + "CUDA_BINDINGS_NVML_IS_COMPATIBLE", + "get_kernel_mode_driver_version", + "get_num_devices", + "get_process_name", + "get_user_mode_driver_version", +] + + +from cuda.core.system import typing + +from ._system import * + +# The TYPE_CHECKING branch is split out from the runtime branch so that +# stubgen-pyx, which only recognizes the literal `if TYPE_CHECKING:` form, +# preserves these imports in the generated .pyi. When +# CUDA_BINDINGS_NVML_IS_COMPATIBLE is no longer necessary, this complexity can +# be removed. +if TYPE_CHECKING: + from ._device import * + from ._system_events import * + from .exceptions import * +elif CUDA_BINDINGS_NVML_IS_COMPATIBLE: + from ._device import * + from ._device import __all__ as _device_all + from ._system_events import * + from ._system_events import __all__ as _system_events_all + from .exceptions import * + from .exceptions import __all__ as _exceptions_all + + __all__.append("get_nvml_version") + __all__.extend(_device_all) + __all__.extend(_system_events_all) + __all__.extend(_exceptions_all) diff --git a/cuda_core/cuda/core/system/_clock.pxi b/cuda_core/cuda/core/system/_clock.pxi new file mode 100644 index 00000000000..56889e37d29 --- /dev/null +++ b/cuda_core/cuda/core/system/_clock.pxi @@ -0,0 +1,176 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + + +_CLOCK_ID_MAPPING = { + ClockId.CURRENT: nvml.ClockId.CURRENT, + ClockId.CUSTOMER_BOOST_MAX: nvml.ClockId.CUSTOMER_BOOST_MAX, +} + + +_CLOCKS_EVENT_REASONS_MAPPING = { + nvml.ClocksEventReasons.EVENT_REASON_NONE: ClocksEventReasons.NONE, + nvml.ClocksEventReasons.EVENT_REASON_GPU_IDLE: ClocksEventReasons.GPU_IDLE, + nvml.ClocksEventReasons.EVENT_REASON_APPLICATIONS_CLOCKS_SETTING: ClocksEventReasons.APPLICATIONS_CLOCKS_SETTING, + nvml.ClocksEventReasons.EVENT_REASON_SW_POWER_CAP: ClocksEventReasons.SW_POWER_CAP, + nvml.ClocksEventReasons.THROTTLE_REASON_HW_SLOWDOWN: ClocksEventReasons.HW_SLOWDOWN, + nvml.ClocksEventReasons.EVENT_REASON_SYNC_BOOST: ClocksEventReasons.SYNC_BOOST, + nvml.ClocksEventReasons.EVENT_REASON_SW_THERMAL_SLOWDOWN: ClocksEventReasons.SW_THERMAL_SLOWDOWN, + nvml.ClocksEventReasons.THROTTLE_REASON_HW_THERMAL_SLOWDOWN: ClocksEventReasons.HW_THERMAL_SLOWDOWN, + nvml.ClocksEventReasons.THROTTLE_REASON_HW_POWER_BRAKE_SLOWDOWN: ClocksEventReasons.HW_POWER_BRAKE_SLOWDOWN, + nvml.ClocksEventReasons.EVENT_REASON_DISPLAY_CLOCK_SETTING: ClocksEventReasons.DISPLAY_CLOCK_SETTING, +} + + +_CLOCK_TYPE_MAPPING = { + ClockType.GRAPHICS: nvml.ClockType.CLOCK_GRAPHICS, + ClockType.SM: nvml.ClockType.CLOCK_SM, + ClockType.MEMORY: nvml.ClockType.CLOCK_MEM, + ClockType.VIDEO: nvml.ClockType.CLOCK_VIDEO, +} + + +cdef class ClockOffsets: + """ + Contains clock offset information. + """ + + cdef object _clock_offset + + def __init__(self, clock_offset: nvml.ClockOffset): + self._clock_offset = clock_offset + + @property + def clock_offset_mhz(self) -> int: + """ + The current clock offset in MHz. + """ + return self._clock_offset.clock_offset_m_hz + + @property + def max_offset_mhz(self) -> int: + """ + The maximum clock offset in MHz. + """ + return self._clock_offset.max_clock_offset_m_hz + + @property + def min_offset_mhz(self) -> int: + """ + The minimum clock offset in MHz. + """ + return self._clock_offset.min_clock_offset_m_hz + + +cdef class ClockInfo: + """ + Accesses various clock information about a device. + """ + + cdef intptr_t _handle + cdef int _clock_type + + def __init__(self, handle: int, clock_type: ClockType | str): + self._handle = handle + try: + clock_type = _CLOCK_TYPE_MAPPING[clock_type] + except KeyError: + raise ValueError( + f"Invalid clock type: {clock_type}. " + f"Must be one of {list(ClockType.__members__.values())}" + ) from None + self._clock_type = int(clock_type) + + def get_current_mhz(self, clock_id: ClockId | str = ClockId.CURRENT) -> int: + """ + Get the current clock speed of a specific clock domain, in MHz. + + For Kepler™ or newer fully supported devices. + + Parameters + ---------- + clock_id: :class:`ClockId` | str + The clock ID to query. Defaults to the current clock value. + + Returns + ------- + int + The clock speed in MHz. + """ + try: + clock_id = _CLOCK_ID_MAPPING[clock_id] + except KeyError: + raise ValueError( + f"Invalid clock ID: {clock_id}. " + f"Must be one of {list(ClockId.__members__.values())}" + ) from None + return nvml.device_get_clock(self._handle, self._clock_type, clock_id) + + def get_max_mhz(self) -> int: + """ + Get the maximum clock speed of a specific clock domain, in MHz. + + For Fermi™ or newer fully supported devices. + + Current P0 clocks (reported by :meth:`get_current_mhz` can differ from + max clocks by a few MHz. + + Returns + ------- + int + The maximum clock speed in MHz. + """ + return nvml.device_get_max_clock_info(self._handle, self._clock_type) + + def get_max_customer_boost_mhz(self) -> int: + """ + Get the maximum customer boost clock speed of a specific clock, in MHz. + + For Pascal™ or newer fully supported devices. + + Returns + ------- + int + The maximum customer boost clock speed in MHz. + """ + return nvml.device_get_max_customer_boost_clock(self._handle, self._clock_type) + + def get_min_max_clock_of_pstate_mhz(self, pstate: int) -> tuple[int, int]: + """ + Get the minimum and maximum clock speeds for this clock domain + at a given performance state (Pstate), in MHz. + + Parameters + ---------- + pstate: int + The performance state to query. Must be an int between 0 and 15, + where 0 is the highest performance state (P0) and 15 is the lowest + (P15). + + Returns + ------- + tuple[int, int] + A tuple containing the minimum and maximum clock speeds in MHz. + """ + return nvml.device_get_min_max_clock_of_p_state(self._handle, self._clock_type, _pstate_to_enum(pstate)) + + def get_offsets(self, pstate: int) -> ClockOffsets: + """ + Retrieve min, max and current clock offset of some clock domain for a given Pstate. + + For Maxwell™ or newer fully supported devices. + + Parameters + ---------- + pstate: int + The performance state to query. Must be an int between 0 and 15, + where 0 is the highest performance state (P0) and 15 is the lowest + (P15). + + Returns + ------- + :obj:`~_device.ClockOffsets` + An object with the min, max and current clock offset. + """ + return ClockOffsets(nvml.device_get_clock_offsets(self._handle, self._clock_type, _pstate_to_enum(pstate))) diff --git a/cuda_core/cuda/core/system/_cooler.pxi b/cuda_core/cuda/core/system/_cooler.pxi new file mode 100644 index 00000000000..b24f9252822 --- /dev/null +++ b/cuda_core/cuda/core/system/_cooler.pxi @@ -0,0 +1,51 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + + +_COOLER_CONTROL_MAPPING = { + nvml.CoolerControl.THERMAL_COOLER_SIGNAL_TOGGLE: CoolerControl.TOGGLE, + nvml.CoolerControl.THERMAL_COOLER_SIGNAL_VARIABLE: CoolerControl.VARIABLE, +} + + +_COOLER_TARGET_MAPPING = { + nvml.CoolerTarget.THERMAL_NONE: CoolerTarget.NONE, + nvml.CoolerTarget.THERMAL_GPU: CoolerTarget.GPU, + nvml.CoolerTarget.THERMAL_MEMORY: CoolerTarget.MEMORY, + nvml.CoolerTarget.THERMAL_POWER_SUPPLY: CoolerTarget.POWER_SUPPLY, +} + + +cdef class CoolerInfo: + cdef object _cooler_info + + def __init__(self, cooler_info: nvml.CoolerInfo): + self._cooler_info = cooler_info + + @property + def signal_type(self) -> CoolerControl | None: + """ + The cooler's control signal characteristics. + + The possible types are variable and toggle. + """ + return _COOLER_CONTROL_MAPPING.get(self._cooler_info.signal_type, None) + + @property + def target(self) -> list[CoolerTarget]: + """ + The target that cooler controls. + + Targets may be GPU, Memory, Power Supply, or all of these. See + :class:`CoolerTarget` for details. + """ + cdef uint64_t[1] targets = [self._cooler_info.target] + output_targets = [] + for target in _unpack_bitmask(targets): + try: + output_target = _COOLER_TARGET_MAPPING[1 << target] + except KeyError: + raise ValueError(f"Unknown cooler target bit: {1 << target}") + output_targets.append(output_target) + return output_targets diff --git a/cuda_core/cuda/core/system/_device.pyi b/cuda_core/cuda/core/system/_device.pyi new file mode 100644 index 00000000000..0a51e5c9928 --- /dev/null +++ b/cuda_core/cuda/core/system/_device.pyi @@ -0,0 +1,1952 @@ +# This file was generated by stubgen-pyx v0.2.6 from cuda_core/cuda/core/system/_device.pyx + +from __future__ import annotations + +from typing import Iterable + +import cuda.core +from cuda.bindings import nvml +from cuda.core.system.typing import (AddressingMode, AffinityScope, ClockId, + ClocksEventReasons, ClockType, + CoolerControl, CoolerTarget, DeviceArch, + EventType, FanControlPolicy, FieldId, + GpuP2PCapsIndex, GpuP2PStatus, + GpuTopologyLevel, InforomObject, + TemperatureThresholds, ThermalController, + ThermalTarget) + + +class ClockOffsets: + """ + Contains clock offset information. + """ + + def __init__(self, clock_offset: nvml.ClockOffset): + ... + + @property + def clock_offset_mhz(self) -> int: + """ + The current clock offset in MHz. + """ + + @property + def max_offset_mhz(self) -> int: + """ + The maximum clock offset in MHz. + """ + + @property + def min_offset_mhz(self) -> int: + """ + The minimum clock offset in MHz. + """ + +class ClockInfo: + """ + Accesses various clock information about a device. + """ + + def __init__(self, handle: int, clock_type: ClockType | str): + ... + + def get_current_mhz(self, clock_id: ClockId | str=...) -> int: + """ + Get the current clock speed of a specific clock domain, in MHz. + + For Kepler™ or newer fully supported devices. + + Parameters + ---------- + clock_id: :class:`ClockId` | str + The clock ID to query. Defaults to the current clock value. + + Returns + ------- + int + The clock speed in MHz. + """ + + def get_max_mhz(self) -> int: + """ + Get the maximum clock speed of a specific clock domain, in MHz. + + For Fermi™ or newer fully supported devices. + + Current P0 clocks (reported by :meth:`get_current_mhz` can differ from + max clocks by a few MHz. + + Returns + ------- + int + The maximum clock speed in MHz. + """ + + def get_max_customer_boost_mhz(self) -> int: + """ + Get the maximum customer boost clock speed of a specific clock, in MHz. + + For Pascal™ or newer fully supported devices. + + Returns + ------- + int + The maximum customer boost clock speed in MHz. + """ + + def get_min_max_clock_of_pstate_mhz(self, pstate: int) -> tuple[int, int]: + """ + Get the minimum and maximum clock speeds for this clock domain + at a given performance state (Pstate), in MHz. + + Parameters + ---------- + pstate: int + The performance state to query. Must be an int between 0 and 15, + where 0 is the highest performance state (P0) and 15 is the lowest + (P15). + + Returns + ------- + tuple[int, int] + A tuple containing the minimum and maximum clock speeds in MHz. + """ + + def get_offsets(self, pstate: int) -> ClockOffsets: + """ + Retrieve min, max and current clock offset of some clock domain for a given Pstate. + + For Maxwell™ or newer fully supported devices. + + Parameters + ---------- + pstate: int + The performance state to query. Must be an int between 0 and 15, + where 0 is the highest performance state (P0) and 15 is the lowest + (P15). + + Returns + ------- + :obj:`~_device.ClockOffsets` + An object with the min, max and current clock offset. + """ + +class CoolerInfo: + + def __init__(self, cooler_info: nvml.CoolerInfo): + ... + + @property + def signal_type(self) -> CoolerControl | None: + """ + The cooler's control signal characteristics. + + The possible types are variable and toggle. + """ + + @property + def target(self) -> list[CoolerTarget]: + """ + The target that cooler controls. + + Targets may be GPU, Memory, Power Supply, or all of these. See + :class:`CoolerTarget` for details. + """ + +class DeviceAttributes: + """ + Various device attributes. + """ + + def __init__(self, attributes: nvml.DeviceAttributes): + ... + + @property + def multiprocessor_count(self) -> int: + """ + The streaming multiprocessor count + """ + + @property + def shared_copy_engine_count(self) -> int: + """ + The shared copy engine count + """ + + @property + def shared_decoder_count(self) -> int: + """ + The shared decoder engine count + """ + + @property + def shared_encoder_count(self) -> int: + """ + The shared encoder engine count + """ + + @property + def shared_jpeg_count(self) -> int: + """ + The shared JPEG engine count + """ + + @property + def shared_ofa_count(self) -> int: + """ + The shared optical flow accelerator (OFA) engine count + """ + + @property + def gpu_instance_slice_count(self) -> int: + """ + The GPU instance slice count + """ + + @property + def compute_instance_slice_count(self) -> int: + """ + The compute instance slice count + """ + + @property + def memory_size_mb(self) -> int: + """ + Device memory size in MiB + """ + +class EventData: + """ + Data about a single event. + """ + + def __init__(self, event_data: nvml.EventData): + ... + + @property + def device(self) -> Device: + """ + The device on which the event occurred. + """ + + @property + def event_type(self) -> EventType: + """ + The type of event that was triggered. + """ + + @property + def event_data(self) -> int: + """ + Returns Xid error for the device in the event of + :attr:`~cuda.core.system.EventType.XID_CRITICAL_ERROR`. + + Raises :class:`ValueError` for other event types. + """ + + @property + def gpu_instance_id(self) -> int: + """ + The GPU instance ID for MIG devices. + + Only valid for events of type :attr:`EventType.XID_CRITICAL_ERROR`. + + Raises :class:`ValueError` for other event types. + """ + + @property + def compute_instance_id(self) -> int: + """ + The Compute instance ID for MIG devices. + + Only valid for events of type :attr:`EventType.XID_CRITICAL_ERROR`. + + Raises :class:`ValueError` for other event types. + """ + +class DeviceEvents: + """ + Represents a set of events that can be waited on for a specific device. + """ + + def __init__(self, device_handle: int, events: EventType | str | list[EventType | str]): + ... + + def __dealloc__(self) -> None: + ... + + def wait(self, timeout_ms: int=0) -> EventData: + """ + Wait for events in the event set. + + For Fermi™ or newer fully supported devices. + + If some events are ready to be delivered at the time of the call, + function returns immediately. If there are no events ready to be + delivered, function sleeps until event arrives but not longer than + specified timeout. If timeout passes, a + :class:`cuda.core.system.TimeoutError` is raised. This function in + certain conditions can return before specified timeout passes (e.g. when + interrupt arrives). + + On Windows, in case of Xid error, the function returns the most recent + Xid error type seen by the system. If there are multiple Xid errors + generated before ``wait`` is invoked, then the last seen Xid + error type is returned for all Xid error events. + + On Linux, every Xid error event would return the associated event data + and other information if applicable. + + In MIG mode, if device handle is provided, the API reports all the + events for the available instances, only if the caller has appropriate + privileges. In absence of required privileges, only the events which + affect all the instances (i.e. whole device) are reported. + + This API does not currently support per-instance event reporting using + MIG device handles. + + Parameters + ---------- + timeout_ms: int + The timeout in milliseconds. A value of 0 means to wait indefinitely. + + Raises + ------ + :class:`cuda.core.system.TimeoutError` + If the timeout expires before an event is received. + :class:`cuda.core.system.GpuIsLostError` + If the GPU has fallen off the bus or is otherwise inaccessible. + """ + +class FanInfo: + """ + Manages information related to a specific fan on a specific device. + """ + + def __init__(self, handle: int, fan: int): + ... + + @property + def speed(self) -> int: + """ + Get/set the intended operating speed of the device's fan. + + For all discrete products with dedicated fans. + + Note: The reported speed is the intended fan speed. If the fan is + physically blocked and unable to spin, the output will not match the + actual fan speed. + + The fan speed is expressed as a percentage of the product's maximum + noise tolerance fan speed. This value may exceed 100% in certain cases. + """ + + @speed.setter + def speed(self, speed: int) -> None: + ... + + @property + def speed_rpm(self) -> int: + """ + The intended operating speed of the device's fan in rotations per minute + (RPM). + + For Maxwell™ or newer fully supported devices. + + For all discrete products with dedicated fans. + + Note: The reported speed is the intended fan speed. If the fan is + physically blocked and unable to spin, the output will not match the + actual fan speed. + """ + + @property + def target_speed(self) -> int: + """ + Retrieves the intended target speed of the device's specified fan. + + For all discrete products with dedicated fans. + + Normally, the driver dynamically adjusts the fan based on + the needs of the GPU. But when users set fan speed using ``speed``, + the driver will attempt to make the fan achieve that setting. + The actual current speed of the fan is reported in ``speed``. + + The fan speed is expressed as a percentage of the product's maximum + noise tolerance fan speed. This value may exceed 100% in certain cases. + """ + + @property + def min_max_speed(self) -> tuple[int, int]: + """ + Retrieves the minimum and maximum fan speed all of the device's fans. + + For all discrete products with dedicated fans. + + Returns + ------- + tuple[int, int] + A tuple of (min_speed, max_speed) + """ + + @property + def control_policy(self) -> FanControlPolicy: + """ + The current fan control policy. + + For Maxwell™ or newer fully supported devices. + + For all CUDA-capable discrete products with fans. + """ + + def set_default_speed(self) -> None: + """ + Set the speed of the fan control policy to default. + + For all CUDA-capable discrete products with fans. + """ + +class FieldValue: + """ + Represents the data from a single field value. + + Use :meth:`Device.get_field_values` to get multiple field values at once. + """ + + def __init__(self, field_value: nvml.FieldValue): + ... + + @property + def field_id(self) -> FieldId: + """ + The field ID. + """ + + @property + def scope_id(self) -> int: + """ + The scope ID. + """ + + @property + def timestamp(self) -> int: + """ + The CPU timestamp (in microseconds since 1970) at which the value was + sampled. + """ + + @property + def latency_usec(self) -> int: + """ + How long this field value took to update (in usec) within NVML. This may + be averaged across several fields that are serviced by the same driver + call. + """ + + @property + def value(self) -> int | float: + """ + The field value. + + Raises + ------ + :class:`cuda.core.system.NvmlError` + If there was an error retrieving the field value. + """ + +class FieldValues: + """ + Container of multiple field values. + """ + + def __init__(self, field_values: nvml.FieldValue): + ... + + def __getitem__(self, idx: int) -> FieldValue: + ... + + def __len__(self) -> int: + ... + + def validate(self) -> None: + """ + Validate that there are no issues in any of the contained field values. + + Raises an exception for the first issue found, if any. + + Raises + ------ + :class:`cuda.core.system.NvmlError` + If any of the contained field values has an associated exception. + """ + + def get_all_values(self) -> list[int | float]: + """ + Get all field values as a list. + + This will validate each of the values and include just the core value in + the list. + + Returns + ------- + list[int | float] + List of all field values. + + Raises + ------ + :class:`cuda.core.system.NvmlError` + If any of the contained field values has an associated exception. + """ + +class InforomInfo: + + def __init__(self, device: Device): + ... + + def get_version(self, inforom: InforomObject | str) -> str: + """ + Retrieves the InfoROM version for a given InfoROM object. + + For all products with an InfoROM. + + Fermi™ and higher parts have non-volatile on-board memory for persisting + device info, such as aggregate ECC counts. + + Parameters + ---------- + inforom: :class:`InforomObject` + The InfoROM object to query. + + Returns + ------- + str + The InfoROM version. + """ + + @property + def image_version(self) -> str: + """ + Retrieves the global InfoROM image version. + + For all products with an InfoROM. + + Image version just like VBIOS version uniquely describes the exact + version of the InfoROM flashed on the board in contrast to InfoROM + object version which is only an indicator of supported features. + + Returns + ------- + str + The InfoROM image version. + """ + + @property + def configuration_checksum(self) -> int: + """ + Retrieves the checksum of the configuration stored in the device's InfoROM. + + For all products with an InfoROM. + + Can be used to make sure that two GPUs have the exact same + configuration. Current checksum takes into account configuration stored + in PWR and ECC InfoROM objects. Checksum can change between driver + releases or when user changes configuration (e.g. disable/enable ECC) + + Returns + ------- + int + The InfoROM checksum. + """ + + def validate(self) -> None: + """ + Reads the InfoROM from the flash and verifies the checksums. + + For all products with an InfoROM. + + Raises + ------ + :class:`cuda.core.system.CorruptedInforomError` + If the device's InfoROM is corrupted. + """ + + @property + def bbx_flush_time(self) -> tuple[int, int]: + """ + Retrieves the timestamp and duration of the last flush of the BBX + (blackbox) InfoROM object during the current run. + + For all products with an InfoROM. + + Returns + ------- + tuple[int, int] + - timestamp: The start timestamp of the last BBX flush + - duration_us: The duration (in μs) of the last BBX flush + """ + + @property + def board_part_number(self) -> str: + """ + The device board part number which is programmed into the board's InfoROM. + """ + +class MemoryInfo: + """ + Memory allocation information for a device. + """ + + def __init__(self, memory_info: nvml.Memory_v2): + ... + + @property + def free(self) -> int: + """ + Unallocated device memory (in bytes) + """ + + @property + def total(self) -> int: + """ + Total physical device memory (in bytes) + """ + + @property + def used(self) -> int: + """ + Allocated device memory (in bytes) + """ + + @property + def reserved(self) -> int: + """ + Device memory (in bytes) reserved for system use (driver or firmware) + """ + +class BAR1MemoryInfo(MemoryInfo): + """ + BAR1 Memory allocation information for a device. + """ + + def __init__(self, memory_info: nvml.BAR1Memory): + ... + + @property + def free(self) -> int: + """ + Unallocated BAR1 memory (in bytes) + """ + + @property + def total(self) -> int: + """ + Total BAR1 memory (in bytes) + """ + + @property + def used(self) -> int: + """ + Allocated used memory (in bytes) + """ + +class MigInfo: + + def __init__(self, device: Device): + ... + + @property + def is_mig_device(self) -> bool: + """ + Whether this device is a MIG (Multi-Instance GPU) device. + + A MIG device handle is an NVML abstraction which maps to a MIG compute + instance. These overloaded references can be used (with some + restrictions) interchangeably with a GPU device handle to execute + queries at a per-compute instance granularity. + + For Ampere™ or newer fully supported devices. + """ + + @property + def mode(self) -> bool: + """ + Get current MIG mode for the device. + + For Ampere™ or newer fully supported devices. + + Changing MIG modes may require device unbind or reset. The "pending" MIG + mode refers to the target mode following the next activation trigger. + + Returns + ------- + bool + `True` if current MIG mode is enabled. + """ + + @mode.setter + def mode(self, mode: bool) -> None: + """ + Set the MIG mode for the device. + + For Ampere™ or newer fully supported devices. + + Changing MIG modes may require device unbind or reset. The "pending" MIG + mode refers to the target mode following the next activation trigger. + + Parameters + ---------- + mode: bool + `True` to enable MIG mode, `False` to disable MIG mode. + """ + + @property + def pending_mode(self) -> bool: + """ + Get pending MIG mode for the device. + + For Ampere™ or newer fully supported devices. + + Changing MIG modes may require device unbind or reset. The "pending" MIG + mode refers to the target mode following the next activation trigger. + + If the device is not a MIG device, returns `False`. + + Returns + ------- + bool + `True` if pending MIG mode is enabled. + """ + + @property + def device_count(self) -> int: + """ + Get the maximum number of MIG devices that can exist under this device. + + Returns zero if MIG is not supported or enabled. + + For Ampere™ or newer fully supported devices. + + Returns + ------- + int + The number of MIG devices (compute instances) on this GPU. + """ + + @property + def parent(self) -> Device: + """ + For MIG devices, get the parent GPU device. + + For Ampere™ or newer fully supported devices. + + Returns + ------- + Device + The parent GPU device for this MIG device. + """ + + def get_device_by_index(self, index: int) -> Device: + """ + Get MIG device for the given index under its parent device. + + If the compute instance is destroyed either explicitly or by destroying, + resetting or unbinding the parent GPU instance or the GPU device itself + the MIG device handle would remain invalid and must be requested again + using this API. Handles may be reused and their properties can change in + the process. + + For Ampere™ or newer fully supported devices. + + Parameters + ---------- + index: int + The index of the MIG device (compute instance) to retrieve. Must be + between 0 and the value returned by `device_count - 1`. + + Returns + ------- + Device + The MIG device corresponding to the given index. + """ + + def get_all_devices(self) -> Iterable[Device]: + """ + Get all MIG devices under its parent device. + + If the compute instance is destroyed either explicitly or by destroying, + resetting or unbinding the parent GPU instance or the GPU device itself + the MIG device handle would remain invalid and must be requested again + using this API. Handles may be reused and their properties can change in + the process. + + For Ampere™ or newer fully supported devices. + + Returns + ------- + list[Device] + A list of all MIG devices corresponding to this GPU. + """ + +class _NvlinkInfoMeta(type): + + @property + def max_links(cls): + """ + The statically-defined maximum number of Nvlinks available. Defined in + upstream NVML as ``NVML_NVLINK_MAX_LINKS``. + + To find the actual number of Nvlinks available on a device, use + :py:attr:`Device.get_nvlink_count`. + + .. version-deprecated:: 1.1.0 + This property is deprecated and will be removed in a future release. + Use :py:attr:`Device.get_nvlink_count` instead. + """ + +class _NvlinkInfo: + """ + Nvlink information for a device. + """ + + def __init__(self, device: Device, link: int): + ... + + @property + def version(self) -> tuple[int, int]: + """ + Retrieves the NvLink version for the device and link. + + For all products with NvLink support. + + Returns + ------- + tuple[int, int] + The Nvlink version as a tuple of (major, minor). + """ + + @property + def state(self) -> bool: + """ + Retrieves the state of the device's Nvlink for the device and link specified. + + For Pascal™ or newer fully supported devices. + + For all products with Nvlink support. + + Returns + ------- + bool + `True` if the Nvlink is active. + """ + +class NvlinkInfo(_NvlinkInfo, metaclass=_NvlinkInfoMeta): + ... + +class PciInfo: + """ + PCI information about a GPU device. + """ + + def __init__(self, pci_info_ext: nvml.PciInfoExt_v1, handle: int): + ... + + @property + def bus(self) -> int: + """ + The bus on which the device resides, 0 to 255 + """ + + @property + def bus_id(self) -> str: + """ + The tuple domain:bus:device.function PCI identifier string + """ + + @property + def device(self) -> int: + """ + The device's id on the bus, 0 to 31 + """ + + @property + def domain(self) -> int: + """ + The PCI domain on which the device's bus resides, 0 to 0xffffffff + """ + + @property + def vendor_id(self) -> int: + """ + The PCI vendor id of the device + """ + + @property + def device_id(self) -> int: + """ + The PCI device id of the device + """ + + @property + def subsystem_id(self) -> int: + """ + The subsystem device ID + """ + + @property + def base_class(self) -> int: + """ + The 8-bit PCI base class code + """ + + @property + def sub_class(self) -> int: + """ + The 8-bit PCI sub class code + """ + + @property + def link_generation(self) -> int: + """ + Retrieve the maximum PCIe link generation possible with this device and system. + + For Fermi™ or newer fully supported devices. + + For example, for a generation 2 PCIe device attached to a generation 1 + PCIe bus, the max link generation this function will report is + generation 1. + """ + + @property + def max_link_generation(self) -> int: + """ + Retrieve the maximum PCIe link generation supported by this GPU device. + + For Fermi™ or newer fully supported devices. + """ + + @property + def max_link_width(self) -> int: + """ + Retrieve the maximum PCIe link width possible with this device and system. + + For Fermi™ or newer fully supported devices. + + For example, for a device with a 16x PCIe bus width attached to a 8x + PCIe system bus this function will report + a max link width of 8. + """ + + @property + def current_link_generation(self) -> int: + """ + Retrieve the current PCIe link generation. + + For Fermi™ or newer fully supported devices. + """ + + @property + def current_link_width(self) -> int: + """ + Retrieve the current PCIe link width. + + For Fermi™ or newer fully supported devices. + """ + + @property + def rx_throughput(self) -> int: + """ + Retrieve PCIe reception throughput, in KB/s. + + This function is querying a byte counter over a 20ms interval, and thus + is the PCIe throughput over that interval. + + For Maxwell™ or newer fully supported devices. + + This method is not supported in virtual machines running virtual GPU + (vGPU). + """ + + @property + def tx_throughput(self) -> int: + """ + Retrieve PCIe transmission throughput, in KB/s. + + This function is querying a byte counter over a 20ms interval, and thus + is the PCIe throughput over that interval. + + For Maxwell™ or newer fully supported devices. + + This method is not supported in virtual machines running virtual GPU + (vGPU). + """ + + @property + def replay_counter(self) -> int: + """ + Retrieve the PCIe replay counter. + + For Kepler™ or newer fully supported devices. + """ + +class GpuDynamicPstatesUtilization: + + def __init__(self, ptr: int, owner: object): + ... + + @property + def is_present(self) -> bool: + """ + Set if the utilization domain is present on this GPU. + """ + + @property + def percentage(self) -> int: + """ + Percentage of time where the domain is considered busy in the last 1-second interval. + """ + + @property + def inc_threshold(self) -> int: + """ + Utilization threshold that can trigger a perf-increasing P-State change when crossed. + """ + + @property + def dec_threshold(self) -> int: + """ + Utilization threshold that can trigger a perf-decreasing P-State change when crossed. + """ + +class GpuDynamicPstatesInfo: + """ + Handles performance monitor samples from the device. + """ + + def __init__(self, gpu_dynamic_pstates_info: nvml.GpuDynamicPstatesInfo): + ... + + def __len__(self) -> int: + ... + + def __getitem__(self, idx: int) -> GpuDynamicPstatesUtilization: + ... + +class ProcessInfo: + """ + Information about running compute processes on the GPU. + """ + + def __init__(self, device: 'Device', process_info: nvml.ProcessInfo): + ... + + @property + def pid(self) -> int: + """ + The PID of the process. + """ + + @property + def used_gpu_memory(self) -> int: + """ + The amount of GPU memory (in bytes) used by the process. + """ + + @property + def gpu_instance_id(self) -> int: + """ + The GPU instance ID for MIG devices. + + Only valid for processes running on MIG devices. + """ + + @property + def compute_instance_id(self) -> int: + """ + The Compute instance ID for MIG devices. + + Only valid for processes running on MIG devices. + """ + +class RepairStatus: + """ + Repair status for TPC/Channel repair. + """ + + def __init__(self, handle: int): + ... + + @property + def channel_repair_pending(self) -> bool: + """ + `True` if a channel repair is pending. + """ + + @property + def tpc_repair_pending(self) -> bool: + """ + `True` if a TPC repair is pending. + """ + +class ThermalSensor: + + def __init__(self, ptr: int, owner: object): + ... + + @property + def controller(self) -> ThermalController: + ... + + @property + def default_min_temp(self) -> int: + ... + + @property + def default_max_temp(self) -> int: + ... + + @property + def current_temp(self) -> int: + ... + + @property + def target(self) -> ThermalTarget: + ... + +class ThermalSettings: + + def __init__(self, thermal_settings: nvml.ThermalSettings): + ... + + def __len__(self) -> int: + ... + + def __getitem__(self, idx: int) -> nvml.ThermalSensor: + ... + +class Temperature: + + def __init__(self, handle: int): + ... + + def get_sensor(self) -> int: + """ + Get the temperature reading from a specific sensor on the device, in + degrees Celsius. + + The only sensor currently supported is the GPU temperature sensor. + + Returns + ------- + int + The temperature in degrees Celsius. + """ + + def get_threshold(self, threshold_type: TemperatureThresholds | str) -> int: + """ + Retrieves the temperature threshold for this GPU with the specified + threshold type, in degrees Celsius. + + For Kepler™ or newer fully supported devices. + + See :class:`TemperatureThresholds` for possible threshold types. + + Note: This API is no longer the preferred interface for retrieving the + following temperature thresholds on Ada and later architectures: + ``NVML_TEMPERATURE_THRESHOLD_SHUTDOWN``, + ``NVML_TEMPERATURE_THRESHOLD_SLOWDOWN``, + ``NVML_TEMPERATURE_THRESHOLD_MEM_MAX`` and + ``NVML_TEMPERATURE_THRESHOLD_GPU_MAX``. + + Support for reading these temperature thresholds for Ada and later + architectures would be removed from this API in future releases. Please + use :meth:`get_field_values` with ``NVML_FI_DEV_TEMPERATURE_*`` fields + to retrieve temperature thresholds on these architectures. + """ + + @property + def margin(self) -> int: + """ + The thermal margin temperature (distance to nearest slowdown threshold) for the device. + """ + + def get_thermal_settings(self, sensor_index: ThermalTarget | str) -> ThermalSettings: + """ + Used to execute a list of thermal system instructions. + + Parameters + ---------- + sensor_index: ThermalTarget + The index of the thermal sensor. + + Returns + ------- + :obj:`~_device.ThermalSettings` + The thermal settings for the specified sensor. + """ + +class Utilization: + """ + Utilization rates for a device. + + For devices with compute capability 2.0 or higher. + """ + + def __init__(self, utilization: nvml.Utilization): + ... + + @property + def gpu(self) -> int: + """ + Percent of time over the past sample period during which one or more kernels was executing on the GPU. + """ + + @property + def memory(self) -> int: + """ + Percent of time over the past sample period during which global (device) memory was being read or written. + """ + +class Device: + """ + Representation of a device. + + :class:`cuda.core.system.Device` provides access to various pieces of metadata + about devices and their topology, as provided by the NVIDIA Management + Library (NVML). To use CUDA with a device, use :class:`cuda.core.Device`. + + Creating a device instance causes NVML to initialize the target GPU. + NVML may initialize additional GPUs if the target GPU is an SLI slave. + + Parameters + ---------- + index: int, optional + Integer representing the CUDA device index to get a handle to. Valid + values are between ``0`` and ``cuda.core.system.get_num_devices() - 1``. + + The order in which devices are enumerated has no guarantees of + consistency between reboots. For that reason, it is recommended that + devices are looked up by their PCI ids or UUID. + + uuid: bytes or str, optional + UUID of a CUDA device to get a handle to. + + pci_bus_id: bytes or str, optional + PCI bus ID of a CUDA device to get a handle to. + + Raises + ------ + ValueError + If anything other than a single `index`, `uuid` or `pci_bus_id` are specified. + """ + _handle: int + + def __init__(self, *, index: int | None=None, uuid: bytes | str | None=None, pci_bus_id: bytes | str | None=None) -> None: + ... + + @property + def index(self) -> int: + """ + The NVML index of this device. + + Valid indices are derived from the count returned by + :meth:`Device.get_device_count`. For example, if ``get_device_count()`` + returns 2, the valid indices are 0 and 1, corresponding to GPU 0 and GPU + 1. + + The order in which NVML enumerates devices has no guarantees of + consistency between reboots. For that reason, it is recommended that + devices be looked up by their PCI ids or GPU UUID. + + Note: The NVML index may not correlate with other APIs, such as the CUDA + device index. + """ + + @property + def uuid(self) -> str: + """ + Retrieves the globally unique immutable UUID associated with this + device, as a 5 part hexadecimal string, that augments the immutable, + board serial identifier. + + In the upstream NVML C++ API, the UUID includes a ``gpu-`` or ``mig-`` + prefix. If you need a `uuid` without that prefix (for example, to + interact with CUDA), use the `uuid_without_prefix` property. + """ + + @property + def uuid_without_prefix(self) -> str: + """ + Retrieves the globally unique immutable UUID associated with this + device, as a 5 part hexadecimal string, that augments the immutable, + board serial identifier. + + In the upstream NVML C++ API, the UUID includes a ``gpu-`` or ``mig-`` + prefix. This property returns it without the prefix, to match the UUIDs + used in CUDA. If you need the prefix, use the `uuid` property. + """ + + @property + def pci_bus_id(self) -> str: + """ + Retrieves the PCI bus ID of this device. + """ + + @property + def numa_node_id(self) -> int: + """ + The NUMA node of the given GPU device. + + This only applies to platforms where the GPUs are NUMA nodes. + """ + + @property + def arch(self) -> DeviceArch: + """ + :obj:`~DeviceArch` device architecture. + + For example, a Tesla V100 will report ``DeviceArchitecture.name == + "VOLTA"``, and RTX A6000 will report ``DeviceArchitecture.name == + "AMPERE"``. + """ + + @property + def name(self) -> str: + """ + Name of the device, e.g.: `"Tesla V100-SXM2-32GB"` + """ + + @property + def brand(self) -> str: + """ + The brand of the device. + + Returns "Unknown" if the brand is unknown. + """ + + @property + def serial(self) -> str: + """ + Retrieves the globally unique board serial number associated with this + device's board. + + For all products with an InfoROM. + """ + + @property + def module_id(self) -> int: + """ + Get a unique identifier for the device module on the baseboard. + + This API retrieves a unique identifier for each GPU module that exists + on a given baseboard. For non-baseboard products, this ID would always + be 0. + """ + + @property + def minor_number(self) -> int: + """ + The minor number of this device. + + For Linux only. + + The minor number is used by the Linux device driver to identify the + device node in ``/dev/nvidiaX``. + """ + + @property + def is_c2c_enabled(self) -> bool: + """ + Whether the C2C (Chip-to-Chip) mode is enabled for this device. + """ + + @property + def is_persistence_mode_enabled(self) -> bool: + """ + Whether persistence mode is enabled for this device. + + For Linux only. + """ + + @is_persistence_mode_enabled.setter + def is_persistence_mode_enabled(self, enabled: bool) -> None: + ... + + @property + def cuda_compute_capability(self) -> tuple[int, int]: + """ + CUDA compute capability of the device, e.g.: `(7, 0)` for a Tesla V100. + + Returns a tuple `(major, minor)`. + """ + + def to_cuda_device(self) -> 'cuda.core.Device': + """ + Get the corresponding :class:`cuda.core.Device` (which is used for CUDA + access) for this :class:`cuda.core.system.Device` (which is used for + NVIDIA Management Library (NVML) access). + + The devices are mapped to one another by their UUID. + + Returns + ------- + cuda.core.Device + The corresponding CUDA device. + + Raises + ------ + RuntimeError + No corresponding CUDA device is found for this NVML device. + + For example, on a MIG system, the physical GPU will not have an + available CUDA device, since it can not be used directly, even + though it can be enumerated from NVML. + """ + + @classmethod + def get_device_count(cls) -> int: + """ + Get the number of available devices. + + Returns + ------- + int + The number of available devices. + """ + + @classmethod + def get_all_devices(cls) -> Iterable[Device]: + """ + Query the available device instances. + + Returns + ------- + Iterator over :obj:`~Device` + An iterator over available devices. + """ + + @property + def addressing_mode(self) -> AddressingMode | None: + """ + Get the :obj:`~AddressingMode` of the device. + """ + + @property + def mig(self) -> MigInfo: + """ + Get :obj:`~MigInfo` accessor for MIG (Multi-Instance GPU) information. + + For Ampere™ or newer fully supported devices. + """ + + @classmethod + def get_all_devices_with_cpu_affinity(cls, cpu_index: int) -> Iterable[Device]: + """ + Retrieve the set of GPUs that have a CPU affinity with the given CPU number. + + Supported on Linux only. + + Parameters + ---------- + cpu_index: int + The CPU index. + + Returns + ------- + Iterator of :obj:`~Device` + An iterator over available devices. + """ + + def get_memory_affinity(self, scope: AffinityScope | str=...) -> list[int]: + """ + Retrieves a list of indices of NUMA nodes or CPU sockets with the ideal + memory affinity for the device. + + For Kepler™ or newer fully supported devices. + + Supported on Linux only. + + If requested scope is not applicable to the target topology, the API + will fall back to reporting the memory affinity for the immediate non-I/O + ancestor of the device. + + Parameters + ---------- + scope: AffinityScope | str, optional + The scope of the affinity query. Must be one of the values of + :class:`AffinityScope`. Default is :attr:`AffinityScope.NODE`. + + Returns + ------- + list[int] + A list of indices of NUMA nodes or CPU sockets with the ideal memory + affinity for the device. + """ + + def get_cpu_affinity(self, scope: AffinityScope | str=...) -> list[int]: + """ + Retrieves a list of indices of NUMA nodes or CPU sockets with the ideal + CPU affinity for the device. + + For Kepler™ or newer fully supported devices. + + Supported on Linux only. + + If requested scope is not applicable to the target topology, the API + will fall back to reporting the memory affinity for the immediate non-I/O + ancestor of the device. + + Parameters + ---------- + scope: AffinityScope | str, optional + The scope of the affinity query. Must be one of the values of + :class:`AffinityScope`. Default is :attr:`AffinityScope.NODE`. + + Returns + ------- + list[int] + A list of indices of NUMA nodes or CPU sockets with the ideal memory + affinity for the device. + """ + + def set_cpu_affinity(self) -> None: + """ + Sets the ideal affinity for the calling thread and device. + + For Kepler™ or newer fully supported devices. + + Supported on Linux only. + """ + + def clear_cpu_affinity(self) -> None: + """ + Clear all affinity bindings for the calling thread. + + For Kepler™ or newer fully supported devices. + + Supported on Linux only. + """ + + def get_clock(self, clock_type: ClockType | str) -> ClockInfo: + """ + :obj:`~_device.ClockInfo` object to get information about and manage a specific clock on a device. + """ + + @property + def is_auto_boosted_clocks_enabled(self) -> tuple[bool, bool]: + """ + Retrieve the current state of auto boosted clocks on a device. + + For Kepler™ or newer fully supported devices. + + Auto Boosted clocks are enabled by default on some hardware, allowing + the GPU to run at higher clock rates to maximize performance as thermal + limits allow. + + On Pascal™ and newer hardware, Auto Boosted clocks are controlled + through application clocks. Use :meth:`set_application_clocks` and + :meth:`reset_application_clocks` to control Auto Boost behavior. + + Returns + ------- + bool + The current state of Auto Boosted clocks + bool + The default Auto Boosted clocks behavior + + """ + + @property + def current_clock_event_reasons(self) -> list[ClocksEventReasons]: + """ + Retrieves the current :obj:`~ClocksEventReasons`. + + For all fully supported products. + """ + + @property + def supported_clock_event_reasons(self) -> list[ClocksEventReasons]: + """ + Retrieves supported :obj:`~ClocksEventReasons` that can be returned by + :meth:`get_current_clock_event_reasons`. + + For all fully supported products. + + This method is not supported in virtual machines running virtual GPU (vGPU). + """ + + @property + def cooler(self) -> CoolerInfo: + """ + :obj:`~_device.CoolerInfo` object with cooler information for the device. + """ + + @property + def attributes(self) -> DeviceAttributes: + """ + :obj:`~_device.DeviceAttributes` object with various device attributes. + + For Ampere™ or newer fully supported devices. Only available on Linux + systems. + """ + + @property + def is_display_connected(self) -> bool: + """ + The display mode for this device. + + Indicates whether a physical display (e.g. monitor) is currently connected to + any of the device's connectors. + """ + + @property + def is_display_active(self) -> bool: + """ + The display active status for this device. + + Indicates whether a display is initialized on the device. For example, + whether X Server is attached to this device and has allocated memory for + the screen. + + Display can be active even when no monitor is physically attached. + """ + + def register_events(self, events: EventType | str | list[EventType | str]) -> DeviceEvents: + """ + Starts recording events on this device. + + For Fermi™ or newer fully supported devices. For Linux only. + + ECC events are available only on ECC-enabled devices (see + :meth:`Device.get_total_ecc_errors`). Power capping events are + available only on Power Management enabled devices (see + :meth:`Device.get_power_management_mode`). + + This call starts recording of events on specific device. All events + that occurred before this call are not recorded. Wait for events using + the :meth:`DeviceEvents.wait` method on the result. + + Examples + -------- + >>> device = Device(index=0) + >>> events = device.register_events([ + ... EventType.XID_CRITICAL_ERROR, + ... ]) + >>> while event := events.wait(timeout_ms=10000): + ... print(f"Event {event.event_type} occurred on device {event.device.uuid}") + + Parameters + ---------- + events: EventType, str, or list of EventType or str + The event type or list of event types to register for this device. + + Returns + ------- + :obj:`~_device.DeviceEvents` + An object representing the registered events. Call + :meth:`~_device.DeviceEvents.wait` on this object to wait for events. + + Raises + ------ + :class:`cuda.core.system.NotSupportedError` + None of the requested event types are registered. + """ + + def get_supported_event_types(self) -> list[EventType]: + """ + Get the list of event types supported by this device. + + For Fermi™ or newer fully supported devices. For Linux only (returns an + empty list on Windows). + + Returns + ------- + list[EventType] + The list of supported event types. + """ + + def get_fan(self, fan: int=0) -> FanInfo: + """ + :obj:`~_device.FanInfo` object to get information and manage a specific fan on a device. + """ + + @property + def num_fans(self) -> int: + """ + The number of fans on the device. + """ + + def get_field_values(self, field_ids: list[int | tuple[int, int]]) -> FieldValues: + """ + Get multiple field values from the device. + + Each value specified can raise its own exception. That exception will + be raised when attempting to access the corresponding ``value`` from the + returned :obj:`~_device.FieldValues` container. + + To confirm that there are no exceptions in the entire container, call + :meth:`~_device.FieldValues.validate`. + + Parameters + ---------- + field_ids: list[int | tuple[int, int]] + List of field IDs to query. + + Each item may be either a single value from the :class:`FieldId` + enum, or a pair of (:class:`FieldId`, scope ID). + + Returns + ------- + :obj:`~_device.FieldValues` + Container of field values corresponding to the requested field IDs. + """ + + def clear_field_values(self, field_ids: list[int | tuple[int, int]]) -> None: + """ + Clear multiple field values from the device. + + Parameters + ---------- + field_ids: list[int | tuple[int, int]] + List of field IDs to clear. + + Each item may be either a single value from the :class:`FieldId` + enum, or a pair of (:class:`FieldId`, scope ID). + """ + + @property + def inforom(self) -> InforomInfo: + """ + :obj:`~_device.InforomInfo` object with InfoROM information. + + For all products with an InfoROM. + """ + + @property + def bar1_memory_info(self) -> BAR1MemoryInfo: + """ + :obj:`~_device.BAR1MemoryInfo` object with BAR1 memory information. + + BAR1 is used to map the FB (device memory) so that it can be directly + accessed by the CPU or by 3rd party devices (peer-to-peer on the PCIE + bus). + """ + + @property + def memory_info(self) -> MemoryInfo: + """ + :obj:`~_device.MemoryInfo` object with memory information. + """ + + def get_nvlink(self, link: int) -> NvlinkInfo: + """ + Get :obj:`~NvlinkInfo` about this device. + + For devices with NVLink support. + + .. version-changed:: 1.1.0 + Any link number not supported by this specific device will raise a `ValueError`. + """ + + def get_nvlink_count(self) -> int: + """ + Get the number of NVLink links on this device. + + For devices with NVLink support. + + .. version-added:: 1.1.0 + """ + + def get_nvlinks(self) -> Iterable[NvlinkInfo]: + """ + Get :obj:`~NvlinkInfo` about all NVLink links on this device. + + For devices with NVLink support. + + .. version-added:: 1.1.0 + """ + + @property + def pci_info(self) -> PciInfo: + """ + :obj:`~_device.PciInfo` object with the PCI attributes of this device. + + Non-physical devices, such as MIG devices, may not have PCI attributes. + In that case, this property will raise a `RuntimeError`. + """ + + @property + def performance_state(self) -> int | None: + """ + The current performance state of the device. + + For Fermi™ or newer fully supported devices. + + Returns + ------- + int | None + The current performance state of the device, as an integer between 0 and 15, + where 0 is maximum performance and higher numbers are lower performance. + Returns `None` if the performance state is unknown. + """ + + @property + def dynamic_pstates_info(self) -> GpuDynamicPstatesInfo: + """ + :obj:`~_device.GpuDynamicPstatesInfo` object with performance monitor samples from the associated subdevice. + """ + + @property + def supported_pstates(self) -> list[int]: + """ + Get all supported Performance States (P-States) for the device. + + The returned list contains a contiguous list of valid P-States supported by + the device. + + Return + ------ + list[int] + A list of supported performance state of the device, as an integer + between 0 and 15, where 0 is maximum performance and higher numbers + are lower performance. + """ + + @property + def compute_running_processes(self) -> list[ProcessInfo]: + """ + Get information about processes with a compute context on a device + + For Fermi™ or newer fully supported devices. + + This function returns information only about compute running processes + (e.g. CUDA application which have active context). Any graphics + applications (e.g. using OpenGL, DirectX) won't be listed by this + function. + + Keep in mind that information returned by this call is dynamic and the + number of elements might change in time. + + In MIG mode, if device handle is provided, the API returns aggregate + information, only if the caller has appropriate privileges. Per-instance + information can be queried by using specific MIG device handles. + Querying per-instance information using MIG device handles is not + supported if the device is in vGPU Host virtualization mode. + """ + + @property + def repair_status(self) -> RepairStatus: + """ + :obj:`~_device.RepairStatus` object with TPC/Channel repair status. + + For Ampere™ or newer fully supported devices. + """ + + @property + def temperature(self) -> Temperature: + """ + :obj:`~_device.Temperature` object with temperature information for the device. + """ + + def get_topology_nearest_gpus(self, level: GpuTopologyLevel | str) -> Iterable[Device]: + """ + Retrieve the GPUs that are nearest to this device at a specific interconnectivity level. + + Supported on Linux only. + + Parameters + ---------- + level: :class:`GpuTopologyLevel` + The topology level. + + Returns + ------- + Iterable of :class:`Device` + The nearest devices at the given topology level. + """ + + @property + def utilization(self) -> Utilization: + """ + Retrieves the current :obj:`~Utilization` rates for the device's major + subsystems. + + For Fermi™ or newer fully supported devices. + + Note: During driver initialization when ECC is enabled one can see high + GPU and Memory Utilization readings. This is caused by ECC Memory + Scrubbing mechanism that is performed during driver initialization. + + Note: On MIG-enabled GPUs, querying device utilization rates is not + currently supported. + + Returns + ------- + Utilization + An object containing the current utilization rates for the device. + """ +_CLOCK_ID_MAPPING = {ClockId.CURRENT: nvml.ClockId.CURRENT, ClockId.CUSTOMER_BOOST_MAX: nvml.ClockId.CUSTOMER_BOOST_MAX} +_CLOCKS_EVENT_REASONS_MAPPING = {nvml.ClocksEventReasons.EVENT_REASON_NONE: ClocksEventReasons.NONE, nvml.ClocksEventReasons.EVENT_REASON_GPU_IDLE: ClocksEventReasons.GPU_IDLE, nvml.ClocksEventReasons.EVENT_REASON_APPLICATIONS_CLOCKS_SETTING: ClocksEventReasons.APPLICATIONS_CLOCKS_SETTING, nvml.ClocksEventReasons.EVENT_REASON_SW_POWER_CAP: ClocksEventReasons.SW_POWER_CAP, nvml.ClocksEventReasons.THROTTLE_REASON_HW_SLOWDOWN: ClocksEventReasons.HW_SLOWDOWN, nvml.ClocksEventReasons.EVENT_REASON_SYNC_BOOST: ClocksEventReasons.SYNC_BOOST, nvml.ClocksEventReasons.EVENT_REASON_SW_THERMAL_SLOWDOWN: ClocksEventReasons.SW_THERMAL_SLOWDOWN, nvml.ClocksEventReasons.THROTTLE_REASON_HW_THERMAL_SLOWDOWN: ClocksEventReasons.HW_THERMAL_SLOWDOWN, nvml.ClocksEventReasons.THROTTLE_REASON_HW_POWER_BRAKE_SLOWDOWN: ClocksEventReasons.HW_POWER_BRAKE_SLOWDOWN, nvml.ClocksEventReasons.EVENT_REASON_DISPLAY_CLOCK_SETTING: ClocksEventReasons.DISPLAY_CLOCK_SETTING} +_CLOCK_TYPE_MAPPING = {ClockType.GRAPHICS: nvml.ClockType.CLOCK_GRAPHICS, ClockType.SM: nvml.ClockType.CLOCK_SM, ClockType.MEMORY: nvml.ClockType.CLOCK_MEM, ClockType.VIDEO: nvml.ClockType.CLOCK_VIDEO} +_COOLER_CONTROL_MAPPING = {nvml.CoolerControl.THERMAL_COOLER_SIGNAL_TOGGLE: CoolerControl.TOGGLE, nvml.CoolerControl.THERMAL_COOLER_SIGNAL_VARIABLE: CoolerControl.VARIABLE} +_COOLER_TARGET_MAPPING = {nvml.CoolerTarget.THERMAL_NONE: CoolerTarget.NONE, nvml.CoolerTarget.THERMAL_GPU: CoolerTarget.GPU, nvml.CoolerTarget.THERMAL_MEMORY: CoolerTarget.MEMORY, nvml.CoolerTarget.THERMAL_POWER_SUPPLY: CoolerTarget.POWER_SUPPLY} +_EVENT_TYPE_MAPPING = {nvml.EventType.NONE: EventType.NONE, nvml.EventType.SINGLE_BIT_ECC_ERROR: EventType.SINGLE_BIT_ECC_ERROR, nvml.EventType.DOUBLE_BIT_ECC_ERROR: EventType.DOUBLE_BIT_ECC_ERROR, nvml.EventType.PSTATE: EventType.PSTATE, nvml.EventType.XID_CRITICAL_ERROR: EventType.XID_CRITICAL_ERROR, nvml.EventType.CLOCK: EventType.CLOCK, nvml.EventType.POWER_SOURCE_CHANGE: EventType.POWER_SOURCE_CHANGE, nvml.EventType.MIG_CONFIG_CHANGE: EventType.MIG_CONFIG_CHANGE, nvml.EventType.SINGLE_BIT_ECC_ERROR_STORM: EventType.SINGLE_BIT_ECC_ERROR_STORM, nvml.EventType.DRAM_RETIREMENT_EVENT: EventType.DRAM_RETIREMENT_EVENT, nvml.EventType.DRAM_RETIREMENT_FAILURE: EventType.DRAM_RETIREMENT_FAILURE, nvml.EventType.NON_FATAL_POISON_ERROR: EventType.NON_FATAL_POISON_ERROR, nvml.EventType.FATAL_POISON_ERROR: EventType.FATAL_POISON_ERROR, nvml.EventType.GPU_UNAVAILABLE_ERROR: EventType.GPU_UNAVAILABLE_ERROR, nvml.EventType.GPU_RECOVERY_ACTION: EventType.GPU_RECOVERY_ACTION} +_EVENT_TYPE_INV_MAPPING = {v: k for k, v in _EVENT_TYPE_MAPPING.items()} +_FAN_CONTROL_POLICY_MAPPING = {nvml.FanControlPolicy.TEMPERATURE_CONTINUOUS_SW: FanControlPolicy.TEMPERATURE_CONTROLLED, nvml.FanControlPolicy.MANUAL: FanControlPolicy.MANUAL} +_INFOROM_OBJECT_MAPPING = {InforomObject.OEM: nvml.InforomObject.INFOROM_OEM, InforomObject.ECC: nvml.InforomObject.INFOROM_ECC, InforomObject.POWER: nvml.InforomObject.INFOROM_POWER, InforomObject.DEN: nvml.InforomObject.INFOROM_DEN} +_NVLINK_VERSION_MAPPING = {nvml.NvlinkVersion.VERSION_1_0: (1, 0), nvml.NvlinkVersion.VERSION_2_0: (2, 0), nvml.NvlinkVersion.VERSION_2_2: (2, 2), nvml.NvlinkVersion.VERSION_3_0: (3, 0), nvml.NvlinkVersion.VERSION_3_1: (3, 1), nvml.NvlinkVersion.VERSION_4_0: (4, 0), nvml.NvlinkVersion.VERSION_5_0: (5, 0)} +_NVLINK_VERSION_6_0 = getattr(nvml.NvlinkVersion, 'VERSION_6_0', None) +_TEMPERATURE_THRESHOLD_MAPPING = {TemperatureThresholds.SHUTDOWN: nvml.TemperatureThresholds.TEMPERATURE_THRESHOLD_SHUTDOWN, TemperatureThresholds.SLOWDOWN: nvml.TemperatureThresholds.TEMPERATURE_THRESHOLD_SLOWDOWN, TemperatureThresholds.MEM_MAX: nvml.TemperatureThresholds.TEMPERATURE_THRESHOLD_MEM_MAX, TemperatureThresholds.GPU_MAX: nvml.TemperatureThresholds.TEMPERATURE_THRESHOLD_GPU_MAX, TemperatureThresholds.ACOUSTIC_MIN: nvml.TemperatureThresholds.TEMPERATURE_THRESHOLD_ACOUSTIC_MIN, TemperatureThresholds.ACOUSTIC_CURR: nvml.TemperatureThresholds.TEMPERATURE_THRESHOLD_ACOUSTIC_CURR, TemperatureThresholds.ACOUSTIC_MAX: nvml.TemperatureThresholds.TEMPERATURE_THRESHOLD_ACOUSTIC_MAX, TemperatureThresholds.GPS_CURR: nvml.TemperatureThresholds.TEMPERATURE_THRESHOLD_GPS_CURR} +_THERMAL_CONTROLLER_MAPPING = {nvml.ThermalController.GPU_INTERNAL: ThermalController.GPU_INTERNAL, nvml.ThermalController.ADM1032: ThermalController.ADM1032, nvml.ThermalController.ADT7461: ThermalController.ADT7461, nvml.ThermalController.MAX6649: ThermalController.MAX6649, nvml.ThermalController.MAX1617: ThermalController.MAX1617, nvml.ThermalController.LM99: ThermalController.LM99, nvml.ThermalController.LM89: ThermalController.LM89, nvml.ThermalController.LM64: ThermalController.LM64, nvml.ThermalController.G781: ThermalController.G781, nvml.ThermalController.ADT7473: ThermalController.ADT7473, nvml.ThermalController.SBMAX6649: ThermalController.SBMAX6649, nvml.ThermalController.VBIOSEVT: ThermalController.VBIOSEVT, nvml.ThermalController.OS: ThermalController.OS, nvml.ThermalController.NVSYSCON_CANOAS: ThermalController.NVSYSCON_CANOAS, nvml.ThermalController.NVSYSCON_E551: ThermalController.NVSYSCON_E551, nvml.ThermalController.MAX6649R: ThermalController.MAX6649R, nvml.ThermalController.ADT7473S: ThermalController.ADT7473S, nvml.ThermalController.UNKNOWN: ThermalController.UNKNOWN} +_THERMAL_TARGET_MAPPING = {nvml.ThermalTarget.NONE: ThermalTarget.NONE, nvml.ThermalTarget.GPU: ThermalTarget.GPU, nvml.ThermalTarget.MEMORY: ThermalTarget.MEMORY, nvml.ThermalTarget.POWER_SUPPLY: ThermalTarget.POWER_SUPPLY, nvml.ThermalTarget.BOARD: ThermalTarget.BOARD, nvml.ThermalTarget.VCD_BOARD: ThermalTarget.VCD_BOARD, nvml.ThermalTarget.VCD_INLET: ThermalTarget.VCD_INLET, nvml.ThermalTarget.VCD_OUTLET: ThermalTarget.VCD_OUTLET, nvml.ThermalTarget.ALL: ThermalTarget.ALL} +_THERMAL_TARGET_INV_MAPPING = {v: k for k, v in _THERMAL_TARGET_MAPPING.items()} +_ADDRESSING_MODE_MAPPING = {nvml.DeviceAddressingModeType.DEVICE_ADDRESSING_MODE_HMM: AddressingMode.HMM, nvml.DeviceAddressingModeType.DEVICE_ADDRESSING_MODE_ATS: AddressingMode.ATS} +_AFFINITY_SCOPE_MAPPING = {AffinityScope.NODE: nvml.AffinityScope.NODE, AffinityScope.SOCKET: nvml.AffinityScope.SOCKET} +_BRAND_TYPE_MAPPING = {nvml.BrandType.BRAND_UNKNOWN: 'Unknown', nvml.BrandType.BRAND_QUADRO: 'Quadro', nvml.BrandType.BRAND_TESLA: 'Tesla', nvml.BrandType.BRAND_NVS: 'NVS', nvml.BrandType.BRAND_GRID: 'GRID', nvml.BrandType.BRAND_GEFORCE: 'GeForce', nvml.BrandType.BRAND_TITAN: 'Titan', nvml.BrandType.BRAND_NVIDIA_VAPPS: 'NVIDIA vApps', nvml.BrandType.BRAND_NVIDIA_VPC: 'NVIDIA VPC', nvml.BrandType.BRAND_NVIDIA_VCS: 'NVIDIA VCS', nvml.BrandType.BRAND_NVIDIA_VWS: 'NVIDIA VWS', nvml.BrandType.BRAND_NVIDIA_CLOUD_GAMING: 'NVIDIA Cloud Gaming', nvml.BrandType.BRAND_NVIDIA_VGAMING: 'NVIDIA vGaming', nvml.BrandType.BRAND_QUADRO_RTX: 'Quadro RTX', nvml.BrandType.BRAND_NVIDIA_RTX: 'NVIDIA RTX', nvml.BrandType.BRAND_NVIDIA: 'NVIDIA', nvml.BrandType.BRAND_GEFORCE_RTX: 'GeForce RTX', nvml.BrandType.BRAND_TITAN_RTX: 'Titan RTX'} +_GPU_P2P_CAPS_INDEX_MAPPING = {GpuP2PCapsIndex.READ: nvml.GpuP2PCapsIndex.P2P_CAPS_INDEX_READ, GpuP2PCapsIndex.WRITE: nvml.GpuP2PCapsIndex.P2P_CAPS_INDEX_WRITE, GpuP2PCapsIndex.NVLINK: nvml.GpuP2PCapsIndex.P2P_CAPS_INDEX_NVLINK, GpuP2PCapsIndex.ATOMICS: nvml.GpuP2PCapsIndex.P2P_CAPS_INDEX_ATOMICS, GpuP2PCapsIndex.PCI: nvml.GpuP2PCapsIndex.P2P_CAPS_INDEX_PCI, GpuP2PCapsIndex.PROP: nvml.GpuP2PCapsIndex.P2P_CAPS_INDEX_PROP, GpuP2PCapsIndex.UNKNOWN: nvml.GpuP2PCapsIndex.P2P_CAPS_INDEX_UNKNOWN} +_GPU_P2P_STATUS_MAPPING = {nvml.GpuP2PStatus.P2P_STATUS_OK: GpuP2PStatus.OK, nvml.GpuP2PStatus.P2P_STATUS_CHIPSET_NOT_SUPPORTED: GpuP2PStatus.CHIPSET_NOT_SUPPORTED, nvml.GpuP2PStatus.P2P_STATUS_GPU_NOT_SUPPORTED: GpuP2PStatus.GPU_NOT_SUPPORTED, nvml.GpuP2PStatus.P2P_STATUS_IOH_TOPOLOGY_NOT_SUPPORTED: GpuP2PStatus.IOH_TOPOLOGY_NOT_SUPPORTED, nvml.GpuP2PStatus.P2P_STATUS_DISABLED_BY_REGKEY: GpuP2PStatus.DISABLED_BY_REGKEY, nvml.GpuP2PStatus.P2P_STATUS_NOT_SUPPORTED: GpuP2PStatus.NOT_SUPPORTED, nvml.GpuP2PStatus.P2P_STATUS_UNKNOWN: GpuP2PStatus.UNKNOWN} +_GPU_TOPOLOGY_LEVEL_MAPPING = {GpuTopologyLevel.INTERNAL: nvml.GpuTopologyLevel.TOPOLOGY_INTERNAL, GpuTopologyLevel.SINGLE: nvml.GpuTopologyLevel.TOPOLOGY_SINGLE, GpuTopologyLevel.MULTIPLE: nvml.GpuTopologyLevel.TOPOLOGY_MULTIPLE, GpuTopologyLevel.HOSTBRIDGE: nvml.GpuTopologyLevel.TOPOLOGY_HOSTBRIDGE, GpuTopologyLevel.NODE: nvml.GpuTopologyLevel.TOPOLOGY_NODE, GpuTopologyLevel.SYSTEM: nvml.GpuTopologyLevel.TOPOLOGY_SYSTEM} +_GPU_TOPOLOGY_LEVEL_INV_MAPPING = {v: k for k, v in _GPU_TOPOLOGY_LEVEL_MAPPING.items()} +__all__ = ['Device', 'get_p2p_status', 'get_topology_common_ancestor', 'NvlinkInfo'] + +def _unpack_bitmask(arr: object) -> list[int]: + """ + Unpack a list of integers containing bitmasks. + """ + +def get_topology_common_ancestor(device1: Device, device2: Device) -> GpuTopologyLevel: + """ + Retrieve the common ancestor for two devices. + + For Linux only. + + Parameters + ---------- + device1: :class:`Device` + The first device. + device2: :class:`Device` + The second device. + + Returns + ------- + :class:`GpuTopologyLevel` + The common ancestor level of the two devices. + """ + +def get_p2p_status(device1: Device, device2: Device, index: GpuP2PCapsIndex | str) -> GpuP2PStatus: + """ + Retrieve the P2P status between two devices. + + Parameters + ---------- + device1: :class:`Device` + The first device. + device2: :class:`Device` + The second device. + index: :class:`GpuP2PCapsIndex` | str + The P2P capability index being looked for between ``device1`` and ``device2``. + + Returns + ------- + :class:`GpuP2PStatus` + The P2P status between the two devices. + """ \ No newline at end of file diff --git a/cuda_core/cuda/core/system/_device.pyx b/cuda_core/cuda/core/system/_device.pyx new file mode 100644 index 00000000000..73f51cad8e3 --- /dev/null +++ b/cuda_core/cuda/core/system/_device.pyx @@ -0,0 +1,1171 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from libc.stdint cimport intptr_t, uint64_t +from libc.math cimport ceil + +from multiprocessing import cpu_count +from typing import Iterable, TYPE_CHECKING +import warnings + +from cuda.bindings import nvml + +from ._nvml_context cimport initialize +from cuda.core.system.typing import ( + AddressingMode, + AffinityScope, + DeviceArch, + ClockId, + ClocksEventReasons, + ClockType, + CoolerControl, + CoolerTarget, + DeviceArch, + EventType, + FanControlPolicy, + FieldId, + GpuP2PCapsIndex, + GpuP2PStatus, + GpuTopologyLevel, + InforomObject, + TemperatureThresholds, + ThermalController, + ThermalTarget, +) + +if TYPE_CHECKING: + import cuda.core # no-cython-lint + + +cdef object _pstate_to_int(object pstate): + if pstate == nvml.Pstates.PSTATE_UNKNOWN: + return None + assert ( + int(pstate) >= 0 and int(pstate) <= 15 + ), f"Invalid P-state: {pstate}. Must be between 0 and 15 inclusive, or PSTATE_UNKNOWN." + return int(pstate) - int(nvml.Pstates.PSTATE_0) + + +cdef int _pstate_to_enum(int pstate): + if pstate < 0 or pstate > 15: + raise ValueError(f"Invalid P-state: {pstate}. Must be between 0 and 15 inclusive.") + return int(pstate) + int(nvml.Pstates.PSTATE_0) + + +include "_clock.pxi" +include "_cooler.pxi" +include "_device_attributes.pxi" +include "_device_utils.pxi" +include "_event.pxi" +include "_fan.pxi" +include "_field_values.pxi" +include "_inforom.pxi" +include "_memory.pxi" +include "_mig.pxi" +include "_nvlink.pxi" +include "_pci_info.pxi" +include "_performance.pxi" +include "_process.pxi" +include "_repair_status.pxi" +include "_temperature.pxi" +include "_utilization.pxi" + + +_ADDRESSING_MODE_MAPPING = { + nvml.DeviceAddressingModeType.DEVICE_ADDRESSING_MODE_HMM: AddressingMode.HMM, + nvml.DeviceAddressingModeType.DEVICE_ADDRESSING_MODE_ATS: AddressingMode.ATS, +} + + +_AFFINITY_SCOPE_MAPPING = { + AffinityScope.NODE: nvml.AffinityScope.NODE, + AffinityScope.SOCKET: nvml.AffinityScope.SOCKET, +} + + +_BRAND_TYPE_MAPPING = { + nvml.BrandType.BRAND_UNKNOWN: "Unknown", + nvml.BrandType.BRAND_QUADRO: "Quadro", + nvml.BrandType.BRAND_TESLA: "Tesla", + nvml.BrandType.BRAND_NVS: "NVS", + nvml.BrandType.BRAND_GRID: "GRID", + nvml.BrandType.BRAND_GEFORCE: "GeForce", + nvml.BrandType.BRAND_TITAN: "Titan", + nvml.BrandType.BRAND_NVIDIA_VAPPS: "NVIDIA vApps", + nvml.BrandType.BRAND_NVIDIA_VPC: "NVIDIA VPC", + nvml.BrandType.BRAND_NVIDIA_VCS: "NVIDIA VCS", + nvml.BrandType.BRAND_NVIDIA_VWS: "NVIDIA VWS", + nvml.BrandType.BRAND_NVIDIA_CLOUD_GAMING: "NVIDIA Cloud Gaming", + nvml.BrandType.BRAND_NVIDIA_VGAMING: "NVIDIA vGaming", + nvml.BrandType.BRAND_QUADRO_RTX: "Quadro RTX", + nvml.BrandType.BRAND_NVIDIA_RTX: "NVIDIA RTX", + nvml.BrandType.BRAND_NVIDIA: "NVIDIA", + nvml.BrandType.BRAND_GEFORCE_RTX: "GeForce RTX", + nvml.BrandType.BRAND_TITAN_RTX: "Titan RTX", +} + + +_GPU_P2P_CAPS_INDEX_MAPPING = { + GpuP2PCapsIndex.READ: nvml.GpuP2PCapsIndex.P2P_CAPS_INDEX_READ, + GpuP2PCapsIndex.WRITE: nvml.GpuP2PCapsIndex.P2P_CAPS_INDEX_WRITE, + GpuP2PCapsIndex.NVLINK: nvml.GpuP2PCapsIndex.P2P_CAPS_INDEX_NVLINK, + GpuP2PCapsIndex.ATOMICS: nvml.GpuP2PCapsIndex.P2P_CAPS_INDEX_ATOMICS, + GpuP2PCapsIndex.PCI: nvml.GpuP2PCapsIndex.P2P_CAPS_INDEX_PCI, + GpuP2PCapsIndex.PROP: nvml.GpuP2PCapsIndex.P2P_CAPS_INDEX_PROP, + GpuP2PCapsIndex.UNKNOWN: nvml.GpuP2PCapsIndex.P2P_CAPS_INDEX_UNKNOWN, +} + + +_GPU_P2P_STATUS_MAPPING = { + nvml.GpuP2PStatus.P2P_STATUS_OK: GpuP2PStatus.OK, + nvml.GpuP2PStatus.P2P_STATUS_CHIPSET_NOT_SUPPORTED: GpuP2PStatus.CHIPSET_NOT_SUPPORTED, + nvml.GpuP2PStatus.P2P_STATUS_GPU_NOT_SUPPORTED: GpuP2PStatus.GPU_NOT_SUPPORTED, + nvml.GpuP2PStatus.P2P_STATUS_IOH_TOPOLOGY_NOT_SUPPORTED: GpuP2PStatus.IOH_TOPOLOGY_NOT_SUPPORTED, + nvml.GpuP2PStatus.P2P_STATUS_DISABLED_BY_REGKEY: GpuP2PStatus.DISABLED_BY_REGKEY, + nvml.GpuP2PStatus.P2P_STATUS_NOT_SUPPORTED: GpuP2PStatus.NOT_SUPPORTED, + nvml.GpuP2PStatus.P2P_STATUS_UNKNOWN: GpuP2PStatus.UNKNOWN, +} + + +_GPU_TOPOLOGY_LEVEL_MAPPING = { + GpuTopologyLevel.INTERNAL: nvml.GpuTopologyLevel.TOPOLOGY_INTERNAL, + GpuTopologyLevel.SINGLE: nvml.GpuTopologyLevel.TOPOLOGY_SINGLE, + GpuTopologyLevel.MULTIPLE: nvml.GpuTopologyLevel.TOPOLOGY_MULTIPLE, + GpuTopologyLevel.HOSTBRIDGE: nvml.GpuTopologyLevel.TOPOLOGY_HOSTBRIDGE, + GpuTopologyLevel.NODE: nvml.GpuTopologyLevel.TOPOLOGY_NODE, + GpuTopologyLevel.SYSTEM: nvml.GpuTopologyLevel.TOPOLOGY_SYSTEM, +} + + +_GPU_TOPOLOGY_LEVEL_INV_MAPPING = {v: k for k, v in _GPU_TOPOLOGY_LEVEL_MAPPING.items()} + + + +cdef class Device: + """ + Representation of a device. + + :class:`cuda.core.system.Device` provides access to various pieces of metadata + about devices and their topology, as provided by the NVIDIA Management + Library (NVML). To use CUDA with a device, use :class:`cuda.core.Device`. + + Creating a device instance causes NVML to initialize the target GPU. + NVML may initialize additional GPUs if the target GPU is an SLI slave. + + Parameters + ---------- + index: int, optional + Integer representing the CUDA device index to get a handle to. Valid + values are between ``0`` and ``cuda.core.system.get_num_devices() - 1``. + + The order in which devices are enumerated has no guarantees of + consistency between reboots. For that reason, it is recommended that + devices are looked up by their PCI ids or UUID. + + uuid: bytes or str, optional + UUID of a CUDA device to get a handle to. + + pci_bus_id: bytes or str, optional + PCI bus ID of a CUDA device to get a handle to. + + Raises + ------ + ValueError + If anything other than a single `index`, `uuid` or `pci_bus_id` are specified. + """ + + # This is made public for testing purposes only + cdef public intptr_t _handle + + def __init__( + self, + *, + index: int | None = None, + uuid: bytes | str | None = None, + pci_bus_id: bytes | str | None = None, + ) -> None: + args = [index, uuid, pci_bus_id] + cdef int arg_count = sum(arg is not None for arg in args) + + if arg_count > 1: + raise ValueError("Handle requires only one of `index`, `uuid`, or `pci_bus_id`.") + if arg_count == 0: + raise ValueError("Handle requires either a device `index`, `uuid`, or `pci_bus_id`.") + + initialize() + + if index is not None: + self._handle = nvml.device_get_handle_by_index_v2(index) + elif uuid is not None: + if isinstance(uuid, bytes): + uuid = uuid.decode("ascii") + self._handle = nvml.device_get_handle_by_uuid(uuid) + elif pci_bus_id is not None: + if isinstance(pci_bus_id, bytes): + pci_bus_id = pci_bus_id.decode("ascii") + self._handle = nvml.device_get_handle_by_pci_bus_id_v2(pci_bus_id) + + ######################################################################### + # BASIC PROPERTIES + + @property + def index(self) -> int: + """ + The NVML index of this device. + + Valid indices are derived from the count returned by + :meth:`Device.get_device_count`. For example, if ``get_device_count()`` + returns 2, the valid indices are 0 and 1, corresponding to GPU 0 and GPU + 1. + + The order in which NVML enumerates devices has no guarantees of + consistency between reboots. For that reason, it is recommended that + devices be looked up by their PCI ids or GPU UUID. + + Note: The NVML index may not correlate with other APIs, such as the CUDA + device index. + """ + return nvml.device_get_index(self._handle) + + @property + def uuid(self) -> str: + """ + Retrieves the globally unique immutable UUID associated with this + device, as a 5 part hexadecimal string, that augments the immutable, + board serial identifier. + + In the upstream NVML C++ API, the UUID includes a ``gpu-`` or ``mig-`` + prefix. If you need a `uuid` without that prefix (for example, to + interact with CUDA), use the `uuid_without_prefix` property. + """ + return nvml.device_get_uuid(self._handle) + + @property + def uuid_without_prefix(self) -> str: + """ + Retrieves the globally unique immutable UUID associated with this + device, as a 5 part hexadecimal string, that augments the immutable, + board serial identifier. + + In the upstream NVML C++ API, the UUID includes a ``gpu-`` or ``mig-`` + prefix. This property returns it without the prefix, to match the UUIDs + used in CUDA. If you need the prefix, use the `uuid` property. + """ + # NVML UUIDs have a `gpu-` or `mig-` prefix. We remove that here. + return nvml.device_get_uuid(self._handle)[4:] + + @property + def pci_bus_id(self) -> str: + """ + Retrieves the PCI bus ID of this device. + """ + return self.pci_info.bus_id + + @property + def numa_node_id(self) -> int: + """ + The NUMA node of the given GPU device. + + This only applies to platforms where the GPUs are NUMA nodes. + """ + return nvml.device_get_numa_node_id(self._handle) + + @property + def arch(self) -> DeviceArch: + """ + :obj:`~DeviceArch` device architecture. + + For example, a Tesla V100 will report ``DeviceArchitecture.name == + "VOLTA"``, and RTX A6000 will report ``DeviceArchitecture.name == + "AMPERE"``. + """ + arch = nvml.device_get_architecture(self._handle) + try: + return DeviceArch(arch) + except ValueError: + return DeviceArch.UNKNOWN + + @property + def name(self) -> str: + """ + Name of the device, e.g.: `"Tesla V100-SXM2-32GB"` + """ + return nvml.device_get_name(self._handle) + + @property + def brand(self) -> str: + """ + The brand of the device. + + Returns "Unknown" if the brand is unknown. + """ + return _BRAND_TYPE_MAPPING.get(nvml.device_get_brand(self._handle), "Unknown") + + @property + def serial(self) -> str: + """ + Retrieves the globally unique board serial number associated with this + device's board. + + For all products with an InfoROM. + """ + return nvml.device_get_serial(self._handle) + + @property + def module_id(self) -> int: + """ + Get a unique identifier for the device module on the baseboard. + + This API retrieves a unique identifier for each GPU module that exists + on a given baseboard. For non-baseboard products, this ID would always + be 0. + """ + return nvml.device_get_module_id(self._handle) + + @property + def minor_number(self) -> int: + """ + The minor number of this device. + + For Linux only. + + The minor number is used by the Linux device driver to identify the + device node in ``/dev/nvidiaX``. + """ + return nvml.device_get_minor_number(self._handle) + + @property + def is_c2c_enabled(self) -> bool: + """ + Whether the C2C (Chip-to-Chip) mode is enabled for this device. + """ + return bool(nvml.device_get_c2c_mode_info_v(self._handle).is_c2c_enabled) + + @property + def is_persistence_mode_enabled(self) -> bool: + """ + Whether persistence mode is enabled for this device. + + For Linux only. + """ + return nvml.device_get_persistence_mode(self._handle) == nvml.EnableState.FEATURE_ENABLED + + @is_persistence_mode_enabled.setter + def is_persistence_mode_enabled(self, enabled: bool) -> None: + nvml.device_set_persistence_mode( + self._handle, + nvml.EnableState.FEATURE_ENABLED if enabled else nvml.EnableState.FEATURE_DISABLED + ) + + @property + def cuda_compute_capability(self) -> tuple[int, int]: + """ + CUDA compute capability of the device, e.g.: `(7, 0)` for a Tesla V100. + + Returns a tuple `(major, minor)`. + """ + return nvml.device_get_cuda_compute_capability(self._handle) + + def to_cuda_device(self) -> "cuda.core.Device": + """ + Get the corresponding :class:`cuda.core.Device` (which is used for CUDA + access) for this :class:`cuda.core.system.Device` (which is used for + NVIDIA Management Library (NVML) access). + + The devices are mapped to one another by their UUID. + + Returns + ------- + cuda.core.Device + The corresponding CUDA device. + + Raises + ------ + RuntimeError + No corresponding CUDA device is found for this NVML device. + + For example, on a MIG system, the physical GPU will not have an + available CUDA device, since it can not be used directly, even + though it can be enumerated from NVML. + """ + from cuda.core import Device as CudaDevice + + # CUDA does not have an API to get a device by its UUID, so we just + # search all the devices for one with a matching UUID. + + for cuda_device in CudaDevice.get_all_devices(): + if cuda_device.uuid == self.uuid_without_prefix: + return cuda_device + + raise RuntimeError("No corresponding CUDA device found for this NVML device.") + + @classmethod + def get_device_count(cls) -> int: + """ + Get the number of available devices. + + Returns + ------- + int + The number of available devices. + """ + initialize() + + return nvml.device_get_count_v2() + + @classmethod + def get_all_devices(cls) -> Iterable[Device]: + """ + Query the available device instances. + + Returns + ------- + Iterator over :obj:`~Device` + An iterator over available devices. + """ + initialize() + + for device_id in range(nvml.device_get_count_v2()): + yield cls(index=device_id) + + ######################################################################### + # ADDRESSING MODE + + @property + def addressing_mode(self) -> AddressingMode | None: + """ + Get the :obj:`~AddressingMode` of the device. + """ + return _ADDRESSING_MODE_MAPPING.get(nvml.device_get_addressing_mode(self._handle).value, None) + + ######################################################################### + # MIG (MULTI-INSTANCE GPU) DEVICES + + @property + def mig(self) -> MigInfo: + """ + Get :obj:`~MigInfo` accessor for MIG (Multi-Instance GPU) information. + + For Ampere™ or newer fully supported devices. + """ + return MigInfo(self) + + ######################################################################### + # AFFINITY + + @classmethod + def get_all_devices_with_cpu_affinity(cls, cpu_index: int) -> Iterable[Device]: + """ + Retrieve the set of GPUs that have a CPU affinity with the given CPU number. + + Supported on Linux only. + + Parameters + ---------- + cpu_index: int + The CPU index. + + Returns + ------- + Iterator of :obj:`~Device` + An iterator over available devices. + """ + cdef Device device + for handle in nvml.system_get_topology_gpu_set(cpu_index): + device = Device.__new__(Device) + device._handle = handle + yield device + + def get_memory_affinity(self, scope: AffinityScope | str=AffinityScope.NODE) -> list[int]: + """ + Retrieves a list of indices of NUMA nodes or CPU sockets with the ideal + memory affinity for the device. + + For Kepler™ or newer fully supported devices. + + Supported on Linux only. + + If requested scope is not applicable to the target topology, the API + will fall back to reporting the memory affinity for the immediate non-I/O + ancestor of the device. + + Parameters + ---------- + scope: AffinityScope | str, optional + The scope of the affinity query. Must be one of the values of + :class:`AffinityScope`. Default is :attr:`AffinityScope.NODE`. + + Returns + ------- + list[int] + A list of indices of NUMA nodes or CPU sockets with the ideal memory + affinity for the device. + """ + try: + scope = _AFFINITY_SCOPE_MAPPING[scope] + except KeyError: + raise ValueError( + f"Invalid affinity scope: {scope}. " + f"Must be one of {list(AffinityScope.__members__.values())}" + ) from None + return _unpack_bitmask( + nvml.device_get_memory_affinity( + self._handle, + ceil(cpu_count() / 64), + scope, + ) + ) + + def get_cpu_affinity(self, scope: AffinityScope | str=AffinityScope.NODE) -> list[int]: + """ + Retrieves a list of indices of NUMA nodes or CPU sockets with the ideal + CPU affinity for the device. + + For Kepler™ or newer fully supported devices. + + Supported on Linux only. + + If requested scope is not applicable to the target topology, the API + will fall back to reporting the memory affinity for the immediate non-I/O + ancestor of the device. + + Parameters + ---------- + scope: AffinityScope | str, optional + The scope of the affinity query. Must be one of the values of + :class:`AffinityScope`. Default is :attr:`AffinityScope.NODE`. + + Returns + ------- + list[int] + A list of indices of NUMA nodes or CPU sockets with the ideal memory + affinity for the device. + """ + try: + scope = _AFFINITY_SCOPE_MAPPING[scope] + except KeyError: + raise ValueError( + f"Invalid affinity scope: {scope}. " + f"Must be one of {list(AffinityScope.__members__.values())}" + ) from None + return _unpack_bitmask( + nvml.device_get_cpu_affinity_within_scope( + self._handle, + ceil(cpu_count() / 64), + scope, + ) + ) + + def set_cpu_affinity(self) -> None: + """ + Sets the ideal affinity for the calling thread and device. + + For Kepler™ or newer fully supported devices. + + Supported on Linux only. + """ + nvml.device_set_cpu_affinity(self._handle) + + def clear_cpu_affinity(self) -> None: + """ + Clear all affinity bindings for the calling thread. + + For Kepler™ or newer fully supported devices. + + Supported on Linux only. + """ + nvml.device_clear_cpu_affinity(self._handle) + + ######################################################################### + # CLOCK + # See external class definitions in _clock.pxi + + def get_clock(self, clock_type: ClockType | str) -> ClockInfo: + """ + :obj:`~_device.ClockInfo` object to get information about and manage a specific clock on a device. + """ + return ClockInfo(self._handle, clock_type) + + @property + def is_auto_boosted_clocks_enabled(self) -> tuple[bool, bool]: + """ + Retrieve the current state of auto boosted clocks on a device. + + For Kepler™ or newer fully supported devices. + + Auto Boosted clocks are enabled by default on some hardware, allowing + the GPU to run at higher clock rates to maximize performance as thermal + limits allow. + + On Pascal™ and newer hardware, Auto Boosted clocks are controlled + through application clocks. Use :meth:`set_application_clocks` and + :meth:`reset_application_clocks` to control Auto Boost behavior. + + Returns + ------- + bool + The current state of Auto Boosted clocks + bool + The default Auto Boosted clocks behavior + + """ + current, default = nvml.device_get_auto_boosted_clocks_enabled(self._handle) + return current == nvml.EnableState.FEATURE_ENABLED, default == nvml.EnableState.FEATURE_ENABLED + + @property + def current_clock_event_reasons(self) -> list[ClocksEventReasons]: + """ + Retrieves the current :obj:`~ClocksEventReasons`. + + For all fully supported products. + """ + cdef uint64_t[1] reasons + reasons[0] = nvml.device_get_current_clocks_event_reasons(self._handle) + output_reasons = [] + for reason in _unpack_bitmask(reasons): + try: + output_reason = _CLOCKS_EVENT_REASONS_MAPPING[1 << reason] + except KeyError: + raise ValueError(f"Unknown clock event reason bit: {1 << reason}") + output_reasons.append(output_reason) + return output_reasons + + @property + def supported_clock_event_reasons(self) -> list[ClocksEventReasons]: + """ + Retrieves supported :obj:`~ClocksEventReasons` that can be returned by + :meth:`get_current_clock_event_reasons`. + + For all fully supported products. + + This method is not supported in virtual machines running virtual GPU (vGPU). + """ + cdef uint64_t[1] reasons + reasons[0] = nvml.device_get_supported_clocks_event_reasons(self._handle) + output_reasons = [] + for reason in _unpack_bitmask(reasons): + try: + output_reason = _CLOCKS_EVENT_REASONS_MAPPING[1 << reason] + except KeyError: + raise ValueError(f"Unknown clock event reason bit: {1 << reason}") + output_reasons.append(output_reason) + return output_reasons + + ########################################################################## + # COOLER + # See external class definitions in _cooler.pxi + + @property + def cooler(self) -> CoolerInfo: + """ + :obj:`~_device.CoolerInfo` object with cooler information for the device. + """ + return CoolerInfo(nvml.device_get_cooler_info(self._handle)) + + ########################################################################## + # DEVICE ATTRIBUTES + # See external class definitions in _device_attributes.pxi + + @property + def attributes(self) -> DeviceAttributes: + """ + :obj:`~_device.DeviceAttributes` object with various device attributes. + + For Ampere™ or newer fully supported devices. Only available on Linux + systems. + """ + return DeviceAttributes(nvml.device_get_attributes_v2(self._handle)) + + ######################################################################### + # DISPLAY + + @property + def is_display_connected(self) -> bool: + """ + The display mode for this device. + + Indicates whether a physical display (e.g. monitor) is currently connected to + any of the device's connectors. + """ + return nvml.device_get_display_mode(self._handle) == nvml.EnableState.FEATURE_ENABLED + + @property + def is_display_active(self) -> bool: + """ + The display active status for this device. + + Indicates whether a display is initialized on the device. For example, + whether X Server is attached to this device and has allocated memory for + the screen. + + Display can be active even when no monitor is physically attached. + """ + return nvml.device_get_display_active(self._handle) == nvml.EnableState.FEATURE_ENABLED + + ########################################################################## + # EVENTS + # See external class definitions in _event.pxi + + def register_events(self, events: EventType | str | list[EventType | str]) -> DeviceEvents: + """ + Starts recording events on this device. + + For Fermi™ or newer fully supported devices. For Linux only. + + ECC events are available only on ECC-enabled devices (see + :meth:`Device.get_total_ecc_errors`). Power capping events are + available only on Power Management enabled devices (see + :meth:`Device.get_power_management_mode`). + + This call starts recording of events on specific device. All events + that occurred before this call are not recorded. Wait for events using + the :meth:`DeviceEvents.wait` method on the result. + + Examples + -------- + >>> device = Device(index=0) + >>> events = device.register_events([ + ... EventType.XID_CRITICAL_ERROR, + ... ]) + >>> while event := events.wait(timeout_ms=10000): + ... print(f"Event {event.event_type} occurred on device {event.device.uuid}") + + Parameters + ---------- + events: EventType, str, or list of EventType or str + The event type or list of event types to register for this device. + + Returns + ------- + :obj:`~_device.DeviceEvents` + An object representing the registered events. Call + :meth:`~_device.DeviceEvents.wait` on this object to wait for events. + + Raises + ------ + :class:`cuda.core.system.NotSupportedError` + None of the requested event types are registered. + """ + return DeviceEvents(self._handle, events) + + def get_supported_event_types(self) -> list[EventType]: + """ + Get the list of event types supported by this device. + + For Fermi™ or newer fully supported devices. For Linux only (returns an + empty list on Windows). + + Returns + ------- + list[EventType] + The list of supported event types. + """ + cdef uint64_t[1] bitmask + bitmask[0] = nvml.device_get_supported_event_types(self._handle) + events = [] + for ev in _unpack_bitmask(bitmask): + try: + ev_enum = _EVENT_TYPE_MAPPING[1 << ev] + except KeyError: + raise ValueError(f"Unknown event type bit: {1 << ev}") + events.append(ev_enum) + return events + + ########################################################################## + # FAN + # See external class definitions in _fan.pxi + + def get_fan(self, fan: int = 0) -> FanInfo: + """ + :obj:`~_device.FanInfo` object to get information and manage a specific fan on a device. + """ + if fan < 0 or fan >= self.num_fans: + raise ValueError(f"Fan index {fan} is out of range [0, {self.num_fans})") + return FanInfo(self._handle, fan) + + @property + def num_fans(self) -> int: + """ + The number of fans on the device. + """ + return nvml.device_get_num_fans(self._handle) + + ########################################################################## + # FIELD VALUES + # See external class definitions in _field_values.pxi + + def get_field_values(self, field_ids: list[int | tuple[int, int]]) -> FieldValues: + """ + Get multiple field values from the device. + + Each value specified can raise its own exception. That exception will + be raised when attempting to access the corresponding ``value`` from the + returned :obj:`~_device.FieldValues` container. + + To confirm that there are no exceptions in the entire container, call + :meth:`~_device.FieldValues.validate`. + + Parameters + ---------- + field_ids: list[int | tuple[int, int]] + List of field IDs to query. + + Each item may be either a single value from the :class:`FieldId` + enum, or a pair of (:class:`FieldId`, scope ID). + + Returns + ------- + :obj:`~_device.FieldValues` + Container of field values corresponding to the requested field IDs. + """ + # Passing a field_ids array of length 0 raises an InvalidArgumentError, + # so avoid that. + if len(field_ids) == 0: + return FieldValues(nvml.FieldValue(0)) + + return FieldValues(nvml.device_get_field_values(self._handle, field_ids)) + + def clear_field_values(self, field_ids: list[int | tuple[int, int]]) -> None: + """ + Clear multiple field values from the device. + + Parameters + ---------- + field_ids: list[int | tuple[int, int]] + List of field IDs to clear. + + Each item may be either a single value from the :class:`FieldId` + enum, or a pair of (:class:`FieldId`, scope ID). + """ + # Passing a field_ids array of length 0 raises an InvalidArgumentError, + # so avoid that. + if len(field_ids) == 0: + return + + nvml.device_clear_field_values(self._handle, field_ids) + + ########################################################################## + # INFOROM + # See external class definitions in _inforom.pxi + + @property + def inforom(self) -> InforomInfo: + """ + :obj:`~_device.InforomInfo` object with InfoROM information. + + For all products with an InfoROM. + """ + return InforomInfo(self) + + ########################################################################## + # MEMORY + # See external class definitions in _memory.pxi + + @property + def bar1_memory_info(self) -> BAR1MemoryInfo: + """ + :obj:`~_device.BAR1MemoryInfo` object with BAR1 memory information. + + BAR1 is used to map the FB (device memory) so that it can be directly + accessed by the CPU or by 3rd party devices (peer-to-peer on the PCIE + bus). + """ + return BAR1MemoryInfo(nvml.device_get_bar1_memory_info(self._handle)) + + @property + def memory_info(self) -> MemoryInfo: + """ + :obj:`~_device.MemoryInfo` object with memory information. + """ + return MemoryInfo(nvml.device_get_memory_info_v2(self._handle)) + + ########################################################################## + # NVLINK + # See external class definitions in _nvlink.pxi + + def get_nvlink(self, link: int) -> NvlinkInfo: + """ + Get :obj:`~NvlinkInfo` about this device. + + For devices with NVLink support. + + .. version-changed:: 1.1.0 + Any link number not supported by this specific device will raise a `ValueError`. + """ + link_count = self.get_nvlink_count() + if link < 0 or link >= link_count: + raise ValueError(f"Link index {link} is out of range [0, {link_count})") + return NvlinkInfo(self, link) + + def get_nvlink_count(self) -> int: + """ + Get the number of NVLink links on this device. + + For devices with NVLink support. + + .. version-added:: 1.1.0 + """ + return self.get_field_values([FieldId.DEV_NVLINK_LINK_COUNT])[0].value + + def get_nvlinks(self) -> Iterable[NvlinkInfo]: + """ + Get :obj:`~NvlinkInfo` about all NVLink links on this device. + + For devices with NVLink support. + + .. version-added:: 1.1.0 + """ + for link in range(self.get_nvlink_count()): + yield self.get_nvlink(link) + + ########################################################################## + # PCI INFO + # See external class definitions in _pci_info.pxi + + @property + def pci_info(self) -> PciInfo: + """ + :obj:`~_device.PciInfo` object with the PCI attributes of this device. + + Non-physical devices, such as MIG devices, may not have PCI attributes. + In that case, this property will raise a `RuntimeError`. + """ + try: + pci_info = nvml.device_get_pci_info_ext(self._handle) + except nvml.InvalidArgumentError: + raise RuntimeError("This device does not have PCI attributes") from None + else: + return PciInfo(pci_info, self._handle) + + ########################################################################## + # PERFORMANCE + # See external class definitions in _performance.pxi + + @property + def performance_state(self) -> int | None: + """ + The current performance state of the device. + + For Fermi™ or newer fully supported devices. + + Returns + ------- + int | None + The current performance state of the device, as an integer between 0 and 15, + where 0 is maximum performance and higher numbers are lower performance. + Returns `None` if the performance state is unknown. + """ + return _pstate_to_int(nvml.device_get_performance_state(self._handle)) + + @property + def dynamic_pstates_info(self) -> GpuDynamicPstatesInfo: + """ + :obj:`~_device.GpuDynamicPstatesInfo` object with performance monitor samples from the associated subdevice. + """ + return GpuDynamicPstatesInfo(nvml.device_get_dynamic_pstates_info(self._handle)) + + @property + def supported_pstates(self) -> list[int]: + """ + Get all supported Performance States (P-States) for the device. + + The returned list contains a contiguous list of valid P-States supported by + the device. + + Return + ------ + list[int] + A list of supported performance state of the device, as an integer + between 0 and 15, where 0 is maximum performance and higher numbers + are lower performance. + """ + # From nvml.h: + # The returned array would contain a contiguous list of valid P-States + # supported by the device. If the number of supported P-States is fewer + # than the size of the array supplied missing elements would contain \a + # NVML_PSTATE_UNKNOWN. + + pstates = [] + for pstate in nvml.device_get_supported_performance_states(self._handle): + pstate_value = _pstate_to_int(pstate) + if pstate_value is not None: + pstates.append(pstate_value) + return pstates + + ########################################################################## + # PROCESS + # See external class definitions in _process.pxi + + @property + def compute_running_processes(self) -> list[ProcessInfo]: + """ + Get information about processes with a compute context on a device + + For Fermi™ or newer fully supported devices. + + This function returns information only about compute running processes + (e.g. CUDA application which have active context). Any graphics + applications (e.g. using OpenGL, DirectX) won't be listed by this + function. + + Keep in mind that information returned by this call is dynamic and the + number of elements might change in time. + + In MIG mode, if device handle is provided, the API returns aggregate + information, only if the caller has appropriate privileges. Per-instance + information can be queried by using specific MIG device handles. + Querying per-instance information using MIG device handles is not + supported if the device is in vGPU Host virtualization mode. + """ + return [ProcessInfo(self, proc) for proc in nvml.device_get_compute_running_processes_v3(self._handle)] + + ########################################################################## + # REPAIR STATUS + # See external class definitions in _repair_status.pxi + + @property + def repair_status(self) -> RepairStatus: + """ + :obj:`~_device.RepairStatus` object with TPC/Channel repair status. + + For Ampere™ or newer fully supported devices. + """ + return RepairStatus(self._handle) + + ########################################################################## + # TEMPERATURE + # See external class definitions in _temperature.pxi + + @property + def temperature(self) -> Temperature: + """ + :obj:`~_device.Temperature` object with temperature information for the device. + """ + return Temperature(self._handle) + + ####################################################################### + # TOPOLOGY + + def get_topology_nearest_gpus(self, level: GpuTopologyLevel | str) -> Iterable[Device]: + """ + Retrieve the GPUs that are nearest to this device at a specific interconnectivity level. + + Supported on Linux only. + + Parameters + ---------- + level: :class:`GpuTopologyLevel` + The topology level. + + Returns + ------- + Iterable of :class:`Device` + The nearest devices at the given topology level. + """ + cdef Device device + try: + level = _GPU_TOPOLOGY_LEVEL_MAPPING[level] + except KeyError: + raise ValueError( + f"Invalid topology level: {level}. " + f"Must be one of {list(GpuTopologyLevel.__members__.values())}" + ) from None + for handle in nvml.device_get_topology_nearest_gpus(self._handle, level): + device = Device.__new__(Device) + device._handle = handle + yield device + + ####################################################################### + # UTILIZATION + + @property + def utilization(self) -> Utilization: + """ + Retrieves the current :obj:`~Utilization` rates for the device's major + subsystems. + + For Fermi™ or newer fully supported devices. + + Note: During driver initialization when ECC is enabled one can see high + GPU and Memory Utilization readings. This is caused by ECC Memory + Scrubbing mechanism that is performed during driver initialization. + + Note: On MIG-enabled GPUs, querying device utilization rates is not + currently supported. + + Returns + ------- + Utilization + An object containing the current utilization rates for the device. + """ + return Utilization(nvml.device_get_utilization_rates(self._handle)) + + +def get_topology_common_ancestor(device1: Device, device2: Device) -> GpuTopologyLevel: + """ + Retrieve the common ancestor for two devices. + + For Linux only. + + Parameters + ---------- + device1: :class:`Device` + The first device. + device2: :class:`Device` + The second device. + + Returns + ------- + :class:`GpuTopologyLevel` + The common ancestor level of the two devices. + """ + return _GPU_TOPOLOGY_LEVEL_INV_MAPPING[ + nvml.device_get_topology_common_ancestor( + device1._handle, + device2._handle, + ) + ] + + +def get_p2p_status(device1: Device, device2: Device, index: GpuP2PCapsIndex | str) -> GpuP2PStatus: + """ + Retrieve the P2P status between two devices. + + Parameters + ---------- + device1: :class:`Device` + The first device. + device2: :class:`Device` + The second device. + index: :class:`GpuP2PCapsIndex` | str + The P2P capability index being looked for between ``device1`` and ``device2``. + + Returns + ------- + :class:`GpuP2PStatus` + The P2P status between the two devices. + """ + try: + index_enum = _GPU_P2P_CAPS_INDEX_MAPPING[index] + except KeyError: + raise ValueError( + f"Invalid P2P caps index: {index}. " + f"Must be one of {list(GpuP2PCapsIndex.__members__.values())}" + ) from None + return _GPU_P2P_STATUS_MAPPING.get( + nvml.device_get_p2p_status( + device1._handle, + device2._handle, + index_enum, + ), + GpuP2PStatus.UNKNOWN + ) + + +__all__ = [ + "Device", + "get_p2p_status", + "get_topology_common_ancestor", + "NvlinkInfo", +] diff --git a/cuda_core/cuda/core/system/_device_attributes.pxi b/cuda_core/cuda/core/system/_device_attributes.pxi new file mode 100644 index 00000000000..c18a7be35df --- /dev/null +++ b/cuda_core/cuda/core/system/_device_attributes.pxi @@ -0,0 +1,74 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + + +cdef class DeviceAttributes: + """ + Various device attributes. + """ + def __init__(self, attributes: nvml.DeviceAttributes): + self._attributes = attributes + + @property + def multiprocessor_count(self) -> int: + """ + The streaming multiprocessor count + """ + return self._attributes.multiprocessor_count + + @property + def shared_copy_engine_count(self) -> int: + """ + The shared copy engine count + """ + return self._attributes.shared_copy_engine_count + + @property + def shared_decoder_count(self) -> int: + """ + The shared decoder engine count + """ + return self._attributes.shared_decoder_count + + @property + def shared_encoder_count(self) -> int: + """ + The shared encoder engine count + """ + return self._attributes.shared_encoder_count + + @property + def shared_jpeg_count(self) -> int: + """ + The shared JPEG engine count + """ + return self._attributes.shared_jpeg_count + + @property + def shared_ofa_count(self) -> int: + """ + The shared optical flow accelerator (OFA) engine count + """ + return self._attributes.shared_ofa_count + + @property + def gpu_instance_slice_count(self) -> int: + """ + The GPU instance slice count + """ + return self._attributes.gpu_instance_slice_count + + @property + def compute_instance_slice_count(self) -> int: + """ + The compute instance slice count + """ + return self._attributes.compute_instance_slice_count + + @property + def memory_size_mb(self) -> int: + """ + Device memory size in MiB + """ + return self._attributes.memory_size_mb diff --git a/cuda_core/cuda/core/system/_device_utils.pxi b/cuda_core/cuda/core/system/_device_utils.pxi new file mode 100644 index 00000000000..f7cf91a37c5 --- /dev/null +++ b/cuda_core/cuda/core/system/_device_utils.pxi @@ -0,0 +1,24 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from libc.stdint cimport uint64_t + + +def _unpack_bitmask(arr: object) -> list[int]: + """ + Unpack a list of integers containing bitmasks. + """ + cdef uint64_t i, j, idx + cdef int mask_bits = 64 + + res = [] + + for i in range(len(arr)): + cpu_offset = i * mask_bits + idx = 1 + for j in range(mask_bits): + if arr[i] & idx: + res.append(cpu_offset + j) + idx <<= 1 + return res diff --git a/cuda_core/cuda/core/system/_event.pxi b/cuda_core/cuda/core/system/_event.pxi new file mode 100644 index 00000000000..f81e5934aa7 --- /dev/null +++ b/cuda_core/cuda/core/system/_event.pxi @@ -0,0 +1,170 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + + +_EVENT_TYPE_MAPPING = { + nvml.EventType.NONE: EventType.NONE, + nvml.EventType.SINGLE_BIT_ECC_ERROR: EventType.SINGLE_BIT_ECC_ERROR, + nvml.EventType.DOUBLE_BIT_ECC_ERROR: EventType.DOUBLE_BIT_ECC_ERROR, + nvml.EventType.PSTATE: EventType.PSTATE, + nvml.EventType.XID_CRITICAL_ERROR: EventType.XID_CRITICAL_ERROR, + nvml.EventType.CLOCK: EventType.CLOCK, + nvml.EventType.POWER_SOURCE_CHANGE: EventType.POWER_SOURCE_CHANGE, + nvml.EventType.MIG_CONFIG_CHANGE: EventType.MIG_CONFIG_CHANGE, + nvml.EventType.SINGLE_BIT_ECC_ERROR_STORM: EventType.SINGLE_BIT_ECC_ERROR_STORM, + nvml.EventType.DRAM_RETIREMENT_EVENT: EventType.DRAM_RETIREMENT_EVENT, + nvml.EventType.DRAM_RETIREMENT_FAILURE: EventType.DRAM_RETIREMENT_FAILURE, + nvml.EventType.NON_FATAL_POISON_ERROR: EventType.NON_FATAL_POISON_ERROR, + nvml.EventType.FATAL_POISON_ERROR: EventType.FATAL_POISON_ERROR, + nvml.EventType.GPU_UNAVAILABLE_ERROR: EventType.GPU_UNAVAILABLE_ERROR, + nvml.EventType.GPU_RECOVERY_ACTION: EventType.GPU_RECOVERY_ACTION, +} + + +_EVENT_TYPE_INV_MAPPING = {v: k for k, v in _EVENT_TYPE_MAPPING.items()} + + +cdef class EventData: + """ + Data about a single event. + """ + def __init__(self, event_data: nvml.EventData): + self._event_data = event_data + + @property + def device(self) -> Device: + """ + The device on which the event occurred. + """ + device = Device.__new__(Device) + device._handle = self._event_data.device + return device + + @property + def event_type(self) -> EventType: + """ + The type of event that was triggered. + """ + return _EVENT_TYPE_MAPPING[self._event_data.event_type] + + @property + def event_data(self) -> int: + """ + Returns Xid error for the device in the event of + :attr:`~cuda.core.system.EventType.XID_CRITICAL_ERROR`. + + Raises :class:`ValueError` for other event types. + """ + if self._event_data.event_type != nvml.EventType.XID_CRITICAL_ERROR: + raise ValueError("event_data is only available for Xid critical error events.") + return self._event_data.event_data + + @property + def gpu_instance_id(self) -> int: + """ + The GPU instance ID for MIG devices. + + Only valid for events of type :attr:`EventType.XID_CRITICAL_ERROR`. + + Raises :class:`ValueError` for other event types. + """ + if self._event_data.event_type != nvml.EventType.XID_CRITICAL_ERROR: + raise ValueError("gpu_instance_id is only available for Xid critical error events.") + return self._event_data.gpu_instance_id + + @property + def compute_instance_id(self) -> int: + """ + The Compute instance ID for MIG devices. + + Only valid for events of type :attr:`EventType.XID_CRITICAL_ERROR`. + + Raises :class:`ValueError` for other event types. + """ + if self._event_data.event_type != nvml.EventType.XID_CRITICAL_ERROR: + raise ValueError("compute_instance_id is only available for Xid critical error events.") + return self._event_data.compute_instance_id + + +cdef class DeviceEvents: + """ + Represents a set of events that can be waited on for a specific device. + """ + cdef intptr_t _event_set + cdef intptr_t _device_handle + + def __init__(self, device_handle: intptr_t, events: EventType | str | list[EventType | str]): + self._event_set = 0 + + cdef unsigned long long event_bitmask + if isinstance(events, (str, EventType)): + events = [events] + + if isinstance(events, list): + event_bitmask = 0 + for ev in events: + try: + ev_enum = _EVENT_TYPE_INV_MAPPING[ev] + except KeyError: + raise ValueError( + f"Invalid event type: {ev}. " + f"Must be one of {list(EventType.__members__.values())}" + ) from None + event_bitmask |= int(ev_enum) + else: + raise TypeError("events must be an EventType, str, or list of EventType or str") + + self._device_handle = device_handle + self._event_set = nvml.event_set_create() + # If this raises, the event needs to be freed and this is handled by + # this class's __dealloc__ method. + nvml.device_register_events(self._device_handle, event_bitmask, self._event_set) + + def __dealloc__(self) -> None: + if self._event_set != 0: + nvml.event_set_free(self._event_set) + + def wait(self, timeout_ms: int = 0) -> EventData: + """ + Wait for events in the event set. + + For Fermi™ or newer fully supported devices. + + If some events are ready to be delivered at the time of the call, + function returns immediately. If there are no events ready to be + delivered, function sleeps until event arrives but not longer than + specified timeout. If timeout passes, a + :class:`cuda.core.system.TimeoutError` is raised. This function in + certain conditions can return before specified timeout passes (e.g. when + interrupt arrives). + + On Windows, in case of Xid error, the function returns the most recent + Xid error type seen by the system. If there are multiple Xid errors + generated before ``wait`` is invoked, then the last seen Xid + error type is returned for all Xid error events. + + On Linux, every Xid error event would return the associated event data + and other information if applicable. + + In MIG mode, if device handle is provided, the API reports all the + events for the available instances, only if the caller has appropriate + privileges. In absence of required privileges, only the events which + affect all the instances (i.e. whole device) are reported. + + This API does not currently support per-instance event reporting using + MIG device handles. + + Parameters + ---------- + timeout_ms: int + The timeout in milliseconds. A value of 0 means to wait indefinitely. + + Raises + ------ + :class:`cuda.core.system.TimeoutError` + If the timeout expires before an event is received. + :class:`cuda.core.system.GpuIsLostError` + If the GPU has fallen off the bus or is otherwise inaccessible. + """ + return EventData(nvml.event_set_wait_v2(self._event_set, timeout_ms)) diff --git a/cuda_core/cuda/core/system/_fan.pxi b/cuda_core/cuda/core/system/_fan.pxi new file mode 100644 index 00000000000..06fa4c1919b --- /dev/null +++ b/cuda_core/cuda/core/system/_fan.pxi @@ -0,0 +1,108 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + + +_FAN_CONTROL_POLICY_MAPPING = { + nvml.FanControlPolicy.TEMPERATURE_CONTINUOUS_SW: FanControlPolicy.TEMPERATURE_CONTROLLED, + nvml.FanControlPolicy.MANUAL: FanControlPolicy.MANUAL, +} + + +cdef class FanInfo: + """ + Manages information related to a specific fan on a specific device. + """ + + cdef intptr_t _handle + cdef int _fan + + def __init__(self, handle: int, fan: int): + self._handle = handle + self._fan = fan + + @property + def speed(self) -> int: + """ + Get/set the intended operating speed of the device's fan. + + For all discrete products with dedicated fans. + + Note: The reported speed is the intended fan speed. If the fan is + physically blocked and unable to spin, the output will not match the + actual fan speed. + + The fan speed is expressed as a percentage of the product's maximum + noise tolerance fan speed. This value may exceed 100% in certain cases. + """ + return nvml.device_get_fan_speed_v2(self._handle, self._fan) + + @speed.setter + def speed(self, speed: int) -> None: + nvml.device_set_fan_speed_v2(self._handle, self._fan, speed) + + @property + def speed_rpm(self) -> int: + """ + The intended operating speed of the device's fan in rotations per minute + (RPM). + + For Maxwell™ or newer fully supported devices. + + For all discrete products with dedicated fans. + + Note: The reported speed is the intended fan speed. If the fan is + physically blocked and unable to spin, the output will not match the + actual fan speed. + """ + return nvml.device_get_fan_speed_rpm(self._handle, self._fan) + + @property + def target_speed(self) -> int: + """ + Retrieves the intended target speed of the device's specified fan. + + For all discrete products with dedicated fans. + + Normally, the driver dynamically adjusts the fan based on + the needs of the GPU. But when users set fan speed using ``speed``, + the driver will attempt to make the fan achieve that setting. + The actual current speed of the fan is reported in ``speed``. + + The fan speed is expressed as a percentage of the product's maximum + noise tolerance fan speed. This value may exceed 100% in certain cases. + """ + return nvml.device_get_target_fan_speed(self._handle, self._fan) + + @property + def min_max_speed(self) -> tuple[int, int]: + """ + Retrieves the minimum and maximum fan speed all of the device's fans. + + For all discrete products with dedicated fans. + + Returns + ------- + tuple[int, int] + A tuple of (min_speed, max_speed) + """ + return nvml.device_get_min_max_fan_speed(self._handle) + + @property + def control_policy(self) -> FanControlPolicy: + """ + The current fan control policy. + + For Maxwell™ or newer fully supported devices. + + For all CUDA-capable discrete products with fans. + """ + return _FAN_CONTROL_POLICY_MAPPING[nvml.device_get_fan_control_policy_v2(self._handle, self._fan)] + + def set_default_speed(self) -> None: + """ + Set the speed of the fan control policy to default. + + For all CUDA-capable discrete products with fans. + """ + nvml.device_set_default_fan_speed_v2(self._handle, self._fan) diff --git a/cuda_core/cuda/core/system/_field_values.pxi b/cuda_core/cuda/core/system/_field_values.pxi new file mode 100644 index 00000000000..4a9e5cc748f --- /dev/null +++ b/cuda_core/cuda/core/system/_field_values.pxi @@ -0,0 +1,138 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + + +cdef class FieldValue: + """ + Represents the data from a single field value. + + Use :meth:`Device.get_field_values` to get multiple field values at once. + """ + cdef object _field_value + + def __init__(self, field_value: nvml.FieldValue): + assert len(field_value) == 1 + self._field_value = field_value + + @property + def field_id(self) -> FieldId: + """ + The field ID. + """ + return FieldId(self._field_value.field_id) + + @property + def scope_id(self) -> int: + """ + The scope ID. + """ + # Explicit int() cast required because this is a Numpy type + return int(self._field_value.scope_id) + + @property + def timestamp(self) -> int: + """ + The CPU timestamp (in microseconds since 1970) at which the value was + sampled. + """ + # Explicit int() cast required because this is a Numpy type + return int(self._field_value.timestamp) + + @property + def latency_usec(self) -> int: + """ + How long this field value took to update (in usec) within NVML. This may + be averaged across several fields that are serviced by the same driver + call. + """ + # Explicit int() cast required because this is a Numpy type + return int(self._field_value.latency_usec) + + @property + def value(self) -> int | float: + """ + The field value. + + Raises + ------ + :class:`cuda.core.system.NvmlError` + If there was an error retrieving the field value. + """ + nvml.check_status(self._field_value.nvml_return) + + cdef int value_type = self._field_value.value_type + value = self._field_value.value + + ValueType = nvml.ValueType + + if value_type == ValueType.DOUBLE: + return float(value.d_val[0]) + elif value_type == ValueType.UNSIGNED_INT: + return int(value.ui_val[0]) + elif value_type == ValueType.UNSIGNED_LONG: + return int(value.ul_val[0]) + elif value_type == ValueType.UNSIGNED_LONG_LONG: + return int(value.ull_val[0]) + elif value_type == ValueType.SIGNED_LONG_LONG: + return int(value.ll_val[0]) + elif value_type == ValueType.SIGNED_INT: + return int(value.si_val[0]) + elif value_type == ValueType.UNSIGNED_SHORT: + return int(value.us_val[0]) + else: + raise AssertionError("Unexpected value type") + + +cdef class FieldValues: + """ + Container of multiple field values. + """ + cdef object _field_values + + def __init__(self, field_values: nvml.FieldValue): + self._field_values = field_values + + def __getitem__(self, idx: int) -> FieldValue: + return FieldValue(self._field_values[idx]) + + def __len__(self) -> int: + return len(self._field_values) + + def validate(self) -> None: + """ + Validate that there are no issues in any of the contained field values. + + Raises an exception for the first issue found, if any. + + Raises + ------ + :class:`cuda.core.system.NvmlError` + If any of the contained field values has an associated exception. + """ + # TODO: This is a classic use case for an `ExceptionGroup`, but those + # are only available in Python 3.11+. + return_values = self._field_values.nvml_return + if len(self._field_values) == 1: + return_values = [return_values] + for return_value in return_values: + nvml.check_status(return_value) + + def get_all_values(self) -> list[int | float]: + """ + Get all field values as a list. + + This will validate each of the values and include just the core value in + the list. + + Returns + ------- + list[int | float] + List of all field values. + + Raises + ------ + :class:`cuda.core.system.NvmlError` + If any of the contained field values has an associated exception. + """ + return [x.value for x in self] diff --git a/cuda_core/cuda/core/system/_inforom.pxi b/cuda_core/cuda/core/system/_inforom.pxi new file mode 100644 index 00000000000..f5ab70408d2 --- /dev/null +++ b/cuda_core/cuda/core/system/_inforom.pxi @@ -0,0 +1,119 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + + +_INFOROM_OBJECT_MAPPING = { + InforomObject.OEM: nvml.InforomObject.INFOROM_OEM, + InforomObject.ECC: nvml.InforomObject.INFOROM_ECC, + InforomObject.POWER: nvml.InforomObject.INFOROM_POWER, + InforomObject.DEN: nvml.InforomObject.INFOROM_DEN, +} + + +cdef class InforomInfo: + cdef Device _device + + def __init__(self, device: Device): + self._device = device + + def get_version(self, inforom: InforomObject | str) -> str: + """ + Retrieves the InfoROM version for a given InfoROM object. + + For all products with an InfoROM. + + Fermi™ and higher parts have non-volatile on-board memory for persisting + device info, such as aggregate ECC counts. + + Parameters + ---------- + inforom: :class:`InforomObject` + The InfoROM object to query. + + Returns + ------- + str + The InfoROM version. + """ + try: + inforom_enum = _INFOROM_OBJECT_MAPPING[inforom] + except KeyError: + raise ValueError( + f"Invalid InfoROM object: {inforom}. " + f"Must be one of {list(InforomObject.__members__.values())}" + ) from None + return nvml.device_get_inforom_version(self._device._handle, inforom_enum) + + @property + def image_version(self) -> str: + """ + Retrieves the global InfoROM image version. + + For all products with an InfoROM. + + Image version just like VBIOS version uniquely describes the exact + version of the InfoROM flashed on the board in contrast to InfoROM + object version which is only an indicator of supported features. + + Returns + ------- + str + The InfoROM image version. + """ + return nvml.device_get_inforom_image_version(self._device._handle) + + @property + def configuration_checksum(self) -> int: + """ + Retrieves the checksum of the configuration stored in the device's InfoROM. + + For all products with an InfoROM. + + Can be used to make sure that two GPUs have the exact same + configuration. Current checksum takes into account configuration stored + in PWR and ECC InfoROM objects. Checksum can change between driver + releases or when user changes configuration (e.g. disable/enable ECC) + + Returns + ------- + int + The InfoROM checksum. + """ + return nvml.device_get_inforom_configuration_checksum(self._device._handle) + + def validate(self) -> None: + """ + Reads the InfoROM from the flash and verifies the checksums. + + For all products with an InfoROM. + + Raises + ------ + :class:`cuda.core.system.CorruptedInforomError` + If the device's InfoROM is corrupted. + """ + nvml.device_validate_inforom(self._device._handle) + + @property + def bbx_flush_time(self) -> tuple[int, int]: + """ + Retrieves the timestamp and duration of the last flush of the BBX + (blackbox) InfoROM object during the current run. + + For all products with an InfoROM. + + Returns + ------- + tuple[int, int] + - timestamp: The start timestamp of the last BBX flush + - duration_us: The duration (in μs) of the last BBX flush + """ + return nvml.device_get_last_bbx_flush_time(self._device._handle) + + @property + def board_part_number(self) -> str: + """ + The device board part number which is programmed into the board's InfoROM. + """ + return nvml.device_get_board_part_number(self._device._handle) diff --git a/cuda_core/cuda/core/system/_memory.pxi b/cuda_core/cuda/core/system/_memory.pxi new file mode 100644 index 00000000000..e9142a30ec4 --- /dev/null +++ b/cuda_core/cuda/core/system/_memory.pxi @@ -0,0 +1,72 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + + +cdef class MemoryInfo: + """ + Memory allocation information for a device. + """ + cdef object _memory_info + + def __init__(self, memory_info: nvml.Memory_v2): + self._memory_info = memory_info + + @property + def free(self) -> int: + """ + Unallocated device memory (in bytes) + """ + return self._memory_info.free + + @property + def total(self) -> int: + """ + Total physical device memory (in bytes) + """ + return self._memory_info.total + + @property + def used(self) -> int: + """ + Allocated device memory (in bytes) + """ + return self._memory_info.used + + @property + def reserved(self) -> int: + """ + Device memory (in bytes) reserved for system use (driver or firmware) + """ + return self._memory_info.reserved + + +cdef class BAR1MemoryInfo(MemoryInfo): + """ + BAR1 Memory allocation information for a device. + """ + cdef object _memory_info + + def __init__(self, memory_info: nvml.BAR1Memory): + self._memory_info = memory_info + + @property + def free(self) -> int: + """ + Unallocated BAR1 memory (in bytes) + """ + return self._memory_info.bar1_free + + @property + def total(self) -> int: + """ + Total BAR1 memory (in bytes) + """ + return self._memory_info.bar1_total + + @property + def used(self) -> int: + """ + Allocated used memory (in bytes) + """ + return self._memory_info.bar1_used diff --git a/cuda_core/cuda/core/system/_mig.pxi b/cuda_core/cuda/core/system/_mig.pxi new file mode 100644 index 00000000000..7a5d4e51058 --- /dev/null +++ b/cuda_core/cuda/core/system/_mig.pxi @@ -0,0 +1,170 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + + +from typing import Iterable + + +cdef class MigInfo: + cdef Device _device + + def __init__(self, device: Device): + self._device = device + + @property + def is_mig_device(self) -> bool: + """ + Whether this device is a MIG (Multi-Instance GPU) device. + + A MIG device handle is an NVML abstraction which maps to a MIG compute + instance. These overloaded references can be used (with some + restrictions) interchangeably with a GPU device handle to execute + queries at a per-compute instance granularity. + + For Ampere™ or newer fully supported devices. + """ + return bool(nvml.device_is_mig_device_handle(self._device._handle)) + + @property + def mode(self) -> bool: + """ + Get current MIG mode for the device. + + For Ampere™ or newer fully supported devices. + + Changing MIG modes may require device unbind or reset. The "pending" MIG + mode refers to the target mode following the next activation trigger. + + Returns + ------- + bool + `True` if current MIG mode is enabled. + """ + current, _ = nvml.device_get_mig_mode(self._device._handle) + return current == nvml.EnableState.FEATURE_ENABLED + + @mode.setter + def mode(self, mode: bool) -> None: + """ + Set the MIG mode for the device. + + For Ampere™ or newer fully supported devices. + + Changing MIG modes may require device unbind or reset. The "pending" MIG + mode refers to the target mode following the next activation trigger. + + Parameters + ---------- + mode: bool + `True` to enable MIG mode, `False` to disable MIG mode. + """ + nvml.device_set_mig_mode( + self._device._handle, + nvml.EnableState.FEATURE_ENABLED if mode else nvml.EnableState.FEATURE_DISABLED + ) + + @property + def pending_mode(self) -> bool: + """ + Get pending MIG mode for the device. + + For Ampere™ or newer fully supported devices. + + Changing MIG modes may require device unbind or reset. The "pending" MIG + mode refers to the target mode following the next activation trigger. + + If the device is not a MIG device, returns `False`. + + Returns + ------- + bool + `True` if pending MIG mode is enabled. + """ + _, pending = nvml.device_get_mig_mode(self._device._handle) + return pending == nvml.EnableState.FEATURE_ENABLED + + @property + def device_count(self) -> int: + """ + Get the maximum number of MIG devices that can exist under this device. + + Returns zero if MIG is not supported or enabled. + + For Ampere™ or newer fully supported devices. + + Returns + ------- + int + The number of MIG devices (compute instances) on this GPU. + """ + return nvml.device_get_max_mig_device_count(self._device._handle) + + @property + def parent(self) -> Device: + """ + For MIG devices, get the parent GPU device. + + For Ampere™ or newer fully supported devices. + + Returns + ------- + Device + The parent GPU device for this MIG device. + """ + parent_handle = nvml.device_get_device_handle_from_mig_device_handle(self._device._handle) + parent_device = Device.__new__(Device) + parent_device._handle = parent_handle + return parent_device + + def get_device_by_index(self, index: int) -> Device: + """ + Get MIG device for the given index under its parent device. + + If the compute instance is destroyed either explicitly or by destroying, + resetting or unbinding the parent GPU instance or the GPU device itself + the MIG device handle would remain invalid and must be requested again + using this API. Handles may be reused and their properties can change in + the process. + + For Ampere™ or newer fully supported devices. + + Parameters + ---------- + index: int + The index of the MIG device (compute instance) to retrieve. Must be + between 0 and the value returned by `device_count - 1`. + + Returns + ------- + Device + The MIG device corresponding to the given index. + """ + mig_device_handle = nvml.device_get_mig_device_handle_by_index(self._device._handle, index) + mig_device = Device.__new__(Device) + mig_device._handle = mig_device_handle + return mig_device + + def get_all_devices(self) -> Iterable[Device]: + """ + Get all MIG devices under its parent device. + + If the compute instance is destroyed either explicitly or by destroying, + resetting or unbinding the parent GPU instance or the GPU device itself + the MIG device handle would remain invalid and must be requested again + using this API. Handles may be reused and their properties can change in + the process. + + For Ampere™ or newer fully supported devices. + + Returns + ------- + list[Device] + A list of all MIG devices corresponding to this GPU. + """ + for i in range(self.device_count): + try: + yield self.get_device_by_index(i) + except nvml.NotFoundError: + # Not all MIG devices may be available + continue diff --git a/cuda_core/cuda/core/system/_nvlink.pxi b/cuda_core/cuda/core/system/_nvlink.pxi new file mode 100644 index 00000000000..49ac1b75ba1 --- /dev/null +++ b/cuda_core/cuda/core/system/_nvlink.pxi @@ -0,0 +1,96 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + + +_NVLINK_VERSION_MAPPING = { + nvml.NvlinkVersion.VERSION_1_0: (1, 0), + nvml.NvlinkVersion.VERSION_2_0: (2, 0), + nvml.NvlinkVersion.VERSION_2_2: (2, 2), + nvml.NvlinkVersion.VERSION_3_0: (3, 0), + nvml.NvlinkVersion.VERSION_3_1: (3, 1), + nvml.NvlinkVersion.VERSION_4_0: (4, 0), + nvml.NvlinkVersion.VERSION_5_0: (5, 0), +} + +_NVLINK_VERSION_6_0 = getattr(nvml.NvlinkVersion, "VERSION_6_0", None) +if _NVLINK_VERSION_6_0 is not None: + _NVLINK_VERSION_MAPPING[_NVLINK_VERSION_6_0] = (6, 0) + + +class _NvlinkInfoMeta(type): + @property + def max_links(cls): + """ + The statically-defined maximum number of Nvlinks available. Defined in + upstream NVML as ``NVML_NVLINK_MAX_LINKS``. + + To find the actual number of Nvlinks available on a device, use + :py:attr:`Device.get_nvlink_count`. + + .. version-deprecated:: 1.1.0 + This property is deprecated and will be removed in a future release. + Use :py:attr:`Device.get_nvlink_count` instead. + """ + warnings.warn( + "The `max_links` property is deprecated and will be removed in a future release. " + "Use `Device.get_nvlink_count` instead.", + DeprecationWarning, + ) + + # This will always return 18, even on CTK 13.3 where it should be 36. + return nvml.NVLINK_MAX_LINKS + + +cdef class _NvlinkInfo: + """ + Nvlink information for a device. + """ + cdef Device _device + cdef int _link + + def __init__(self, device: Device, link: int): + self._device = device + self._link = link + + @property + def version(self) -> tuple[int, int]: + """ + Retrieves the NvLink version for the device and link. + + For all products with NvLink support. + + Returns + ------- + tuple[int, int] + The Nvlink version as a tuple of (major, minor). + """ + version = nvml.device_get_nvlink_version(self._device._handle, self._link) + if version == nvml.NvlinkVersion.VERSION_INVALID: + raise RuntimeError("Invalid NvLink version returned for device") + try: + return _NVLINK_VERSION_MAPPING[version] + except KeyError: + raise RuntimeError(f"Unknown NvLink version {version} returned for device") from None + + @property + def state(self) -> bool: + """ + Retrieves the state of the device's Nvlink for the device and link specified. + + For Pascal™ or newer fully supported devices. + + For all products with Nvlink support. + + Returns + ------- + bool + `True` if the Nvlink is active. + """ + return ( + nvml.device_get_nvlink_state(self._device._handle, self._link) == nvml.EnableState.FEATURE_ENABLED + ) + + +class NvlinkInfo(_NvlinkInfo, metaclass=_NvlinkInfoMeta): + pass diff --git a/cuda_core/cuda/core/system/_nvml_context.pxd b/cuda_core/cuda/core/system/_nvml_context.pxd new file mode 100644 index 00000000000..dc8875bc4bc --- /dev/null +++ b/cuda_core/cuda/core/system/_nvml_context.pxd @@ -0,0 +1,58 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + + +cdef extern from *: + """ + #if defined(_WIN32) || defined(_WIN64) + #include + #else + #include + #endif + """ + int getpid() nogil + + +ctypedef enum _NVMLState: + UNINITIALIZED = 0 + INITIALIZED = 1 + DISABLED_LIBRARY_NOT_FOUND = 2 + + +# Initialisation must occur per-process, so an initialised state is a +# (state, pid) pair +cdef _NVMLState _NVML_STATE + + +cdef int _NVML_OWNER_PID + + +cpdef void _initialize() except * + + +cpdef inline initialize(): + """ + Initializes NVIDIA Management Library (NVML), ensuring it only happens once per process. + """ + if _NVML_STATE == _NVMLState.DISABLED_LIBRARY_NOT_FOUND or ( + _NVML_STATE == _NVMLState.INITIALIZED and getpid() == _NVML_OWNER_PID + ): + return + + _initialize() + + +cpdef inline bint is_initialized(): + """ + Check whether the NVML context is initialized on this process. + + Returns + ------- + result: bool + Whether the NVML context is initialized on this process. + """ + return _NVML_STATE == _NVMLState.INITIALIZED and getpid() == _NVML_OWNER_PID + + +cpdef void validate() except * diff --git a/cuda_core/cuda/core/system/_nvml_context.pyi b/cuda_core/cuda/core/system/_nvml_context.pyi new file mode 100644 index 00000000000..e52a803b346 --- /dev/null +++ b/cuda_core/cuda/core/system/_nvml_context.pyi @@ -0,0 +1,33 @@ +# This file was generated by stubgen-pyx v0.2.6 from cuda_core/cuda/core/system/_nvml_context.pyx + +from __future__ import annotations + +import threading + +_NVMLState = int +_lock = threading.Lock() + +def _initialize() -> None: + """ + Initializes NVIDIA Management Library (NVML), ensuring it only happens once per process. + """ + +def validate() -> None: + """ + Validate NVML state. + + Validate that NVML is initialized, functional and that the system has at + least one GPU available. + + Raises + ------ + nvml.UninitializedError + If NVML hasn't been initialized. + nvml.LibraryNotFoundError + If the NVML library could not be found. + nvml.GpuNotFoundError + If no GPUs are available. + """ + +def _get_nvml_state() -> _NVMLState: + ... \ No newline at end of file diff --git a/cuda_core/cuda/core/system/_nvml_context.pyx b/cuda_core/cuda/core/system/_nvml_context.pyx new file mode 100644 index 00000000000..66309049144 --- /dev/null +++ b/cuda_core/cuda/core/system/_nvml_context.pyx @@ -0,0 +1,79 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +import threading + +from cuda.bindings import nvml + +from cuda.core.system import exceptions + + +cdef _NVMLState _NVML_STATE = _NVMLState.UNINITIALIZED + + +cdef int _NVML_OWNER_PID = 0 + + +_lock = threading.Lock() + + +# For testing +def _get_nvml_state() -> _NVMLState: + return _NVML_STATE + + +cpdef void _initialize() except *: + """ + Initializes NVIDIA Management Library (NVML), ensuring it only happens once per process. + """ + global _NVML_STATE, _NVML_OWNER_PID + + with _lock: + # Double-check to make sure nothing has changed since acquiring the lock + if _NVML_STATE == _NVMLState.DISABLED_LIBRARY_NOT_FOUND or ( + _NVML_STATE == _NVMLState.INITIALIZED and getpid() == _NVML_OWNER_PID + ): + return + elif ( + _NVML_STATE == _NVMLState.INITIALIZED and getpid() != _NVML_OWNER_PID + ) or _NVML_STATE == _NVMLState.UNINITIALIZED: + try: + nvml.init_v2() + except ( + exceptions.LibraryNotFoundError, + exceptions.DriverNotLoadedError, + exceptions.UnknownError, + ): + _NVML_STATE = _NVMLState.DISABLED_LIBRARY_NOT_FOUND + return + + # initialization was successful + _NVML_STATE = _NVMLState.INITIALIZED + _NVML_OWNER_PID = getpid() + else: + raise RuntimeError(f"Unhandled initialisation state ({_NVML_STATE=}, {_NVML_OWNER_PID=})") + + +cpdef void validate() except *: + """ + Validate NVML state. + + Validate that NVML is initialized, functional and that the system has at + least one GPU available. + + Raises + ------ + nvml.UninitializedError + If NVML hasn't been initialized. + nvml.LibraryNotFoundError + If the NVML library could not be found. + nvml.GpuNotFoundError + If no GPUs are available. + """ + if _NVML_STATE == _NVMLState.DISABLED_LIBRARY_NOT_FOUND: + raise exceptions.LibraryNotFoundError() + elif not is_initialized(): + raise exceptions.UninitializedError() + elif nvml.device_get_count_v2() == 0: + raise exceptions.GpuNotFoundError() diff --git a/cuda_core/cuda/core/system/_pci_info.pxi b/cuda_core/cuda/core/system/_pci_info.pxi new file mode 100644 index 00000000000..55922b767ad --- /dev/null +++ b/cuda_core/cuda/core/system/_pci_info.pxi @@ -0,0 +1,171 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + + +cdef class PciInfo: + """ + PCI information about a GPU device. + """ + + cdef object _pci_info_ext + cdef intptr_t _handle + + def __init__(self, pci_info_ext: nvml.PciInfoExt_v1, handle: int): + self._pci_info_ext = pci_info_ext + self._handle = handle + + @property + def bus(self) -> int: + """ + The bus on which the device resides, 0 to 255 + """ + return self._pci_info_ext.bus + + @property + def bus_id(self) -> str: + """ + The tuple domain:bus:device.function PCI identifier string + """ + return self._pci_info_ext.bus_id + + @property + def device(self) -> int: + """ + The device's id on the bus, 0 to 31 + """ + return self._pci_info_ext.device_ + + @property + def domain(self) -> int: + """ + The PCI domain on which the device's bus resides, 0 to 0xffffffff + """ + return self._pci_info_ext.domain + + @property + def vendor_id(self) -> int: + """ + The PCI vendor id of the device + """ + return self._pci_info_ext.pci_device_id & 0xFFFF + + @property + def device_id(self) -> int: + """ + The PCI device id of the device + """ + return self._pci_info_ext.pci_device_id >> 16 + + @property + def subsystem_id(self) -> int: + """ + The subsystem device ID + """ + return self._pci_info_ext.pci_sub_system_id + + @property + def base_class(self) -> int: + """ + The 8-bit PCI base class code + """ + return self._pci_info_ext.base_class + + @property + def sub_class(self) -> int: + """ + The 8-bit PCI sub class code + """ + return self._pci_info_ext.sub_class + + @property + def link_generation(self) -> int: + """ + Retrieve the maximum PCIe link generation possible with this device and system. + + For Fermi™ or newer fully supported devices. + + For example, for a generation 2 PCIe device attached to a generation 1 + PCIe bus, the max link generation this function will report is + generation 1. + """ + return nvml.device_get_max_pcie_link_generation(self._handle) + + @property + def max_link_generation(self) -> int: + """ + Retrieve the maximum PCIe link generation supported by this GPU device. + + For Fermi™ or newer fully supported devices. + """ + return nvml.device_get_gpu_max_pcie_link_generation(self._handle) + + @property + def max_link_width(self) -> int: + """ + Retrieve the maximum PCIe link width possible with this device and system. + + For Fermi™ or newer fully supported devices. + + For example, for a device with a 16x PCIe bus width attached to a 8x + PCIe system bus this function will report + a max link width of 8. + """ + return nvml.device_get_max_pcie_link_width(self._handle) + + @property + def current_link_generation(self) -> int: + """ + Retrieve the current PCIe link generation. + + For Fermi™ or newer fully supported devices. + """ + return nvml.device_get_curr_pcie_link_generation(self._handle) + + @property + def current_link_width(self) -> int: + """ + Retrieve the current PCIe link width. + + For Fermi™ or newer fully supported devices. + """ + return nvml.device_get_curr_pcie_link_width(self._handle) + + @property + def rx_throughput(self) -> int: + """ + Retrieve PCIe reception throughput, in KB/s. + + This function is querying a byte counter over a 20ms interval, and thus + is the PCIe throughput over that interval. + + For Maxwell™ or newer fully supported devices. + + This method is not supported in virtual machines running virtual GPU + (vGPU). + """ + return nvml.device_get_pcie_throughput(self._handle, nvml.PcieUtilCounter.PCIE_UTIL_RX_BYTES) + + @property + def tx_throughput(self) -> int: + """ + Retrieve PCIe transmission throughput, in KB/s. + + This function is querying a byte counter over a 20ms interval, and thus + is the PCIe throughput over that interval. + + For Maxwell™ or newer fully supported devices. + + This method is not supported in virtual machines running virtual GPU + (vGPU). + """ + return nvml.device_get_pcie_throughput(self._handle, nvml.PcieUtilCounter.PCIE_UTIL_TX_BYTES) + + @property + def replay_counter(self) -> int: + """ + Retrieve the PCIe replay counter. + + For Kepler™ or newer fully supported devices. + """ + return nvml.device_get_pcie_replay_counter(self._handle) diff --git a/cuda_core/cuda/core/system/_performance.pxi b/cuda_core/cuda/core/system/_performance.pxi new file mode 100644 index 00000000000..ae045ccd1ea --- /dev/null +++ b/cuda_core/cuda/core/system/_performance.pxi @@ -0,0 +1,74 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + + +# In cuda.bindings.nvml, this is an anonymous struct inside nvmlGpuDynamicPstatesInfo_t. + + +ctypedef struct _GpuDynamicPstatesUtilization: + unsigned int bIsPresent + unsigned int percentage + unsigned int incThreshold + unsigned int decThreshold + + +cdef class GpuDynamicPstatesUtilization: + cdef: + _GpuDynamicPstatesUtilization *_ptr + object _owner + + def __init__(self, ptr: int, owner: object): + # ptr points to a part of the numpy buffer held by `_owner`, so we need + # to maintain a reference to `_owner` to keep it alive. + self._ptr = <_GpuDynamicPstatesUtilization *>ptr + self._owner = owner + + @property + def is_present(self) -> bool: + """ + Set if the utilization domain is present on this GPU. + """ + return bool(self._ptr[0].bIsPresent) + + @property + def percentage(self) -> int: + """ + Percentage of time where the domain is considered busy in the last 1-second interval. + """ + return self._ptr[0].percentage + + @property + def inc_threshold(self) -> int: + """ + Utilization threshold that can trigger a perf-increasing P-State change when crossed. + """ + return self._ptr[0].incThreshold + + @property + def dec_threshold(self) -> int: + """ + Utilization threshold that can trigger a perf-decreasing P-State change when crossed. + """ + return self._ptr[0].decThreshold + + +cdef class GpuDynamicPstatesInfo: + """ + Handles performance monitor samples from the device. + """ + cdef object _gpu_dynamic_pstates_info + + def __init__(self, gpu_dynamic_pstates_info: nvml.GpuDynamicPstatesInfo): + self._gpu_dynamic_pstates_info = gpu_dynamic_pstates_info + + def __len__(self) -> int: + return nvml.MAX_GPU_UTILIZATIONS + + def __getitem__(self, idx: int) -> GpuDynamicPstatesUtilization: + if idx < 0 or idx >= nvml.MAX_GPU_UTILIZATIONS: + raise IndexError("GPU dynamic P-states index out of range") + return GpuDynamicPstatesUtilization( + self._gpu_dynamic_pstates_info.utilization.ptr + idx * sizeof(_GpuDynamicPstatesUtilization), + self._gpu_dynamic_pstates_info + ) diff --git a/cuda_core/cuda/core/system/_process.pxi b/cuda_core/cuda/core/system/_process.pxi new file mode 100644 index 00000000000..019ebf5c323 --- /dev/null +++ b/cuda_core/cuda/core/system/_process.pxi @@ -0,0 +1,48 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + + +class ProcessInfo: + """ + Information about running compute processes on the GPU. + """ + def __init__(self, device: "Device", process_info: nvml.ProcessInfo): + self._device = device + self._process_info = process_info + + @property + def pid(self) -> int: + """ + The PID of the process. + """ + return self._process_info.pid + + @property + def used_gpu_memory(self) -> int: + """ + The amount of GPU memory (in bytes) used by the process. + """ + return self._process_info.used_gpu_memory + + @property + def gpu_instance_id(self) -> int: + """ + The GPU instance ID for MIG devices. + + Only valid for processes running on MIG devices. + """ + if not self._device.mig.is_mig_device: + raise nvml.NotSupportedError(nvml.Return.ERROR_NOT_SUPPORTED) + return self._process_info.gpu_instance_id + + @property + def compute_instance_id(self) -> int: + """ + The Compute instance ID for MIG devices. + + Only valid for processes running on MIG devices. + """ + if not self._device.mig.is_mig_device: + raise nvml.NotSupportedError(nvml.Return.ERROR_NOT_SUPPORTED) + return self._process_info.compute_instance_id diff --git a/cuda_core/cuda/core/system/_repair_status.pxi b/cuda_core/cuda/core/system/_repair_status.pxi new file mode 100644 index 00000000000..b7d7de765e6 --- /dev/null +++ b/cuda_core/cuda/core/system/_repair_status.pxi @@ -0,0 +1,27 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + + +cdef class RepairStatus: + """ + Repair status for TPC/Channel repair. + """ + cdef object _repair_status + + def __init__(self, handle: int): + self._repair_status = nvml.device_get_repair_status(handle) + + @property + def channel_repair_pending(self) -> bool: + """ + `True` if a channel repair is pending. + """ + return bool(self._repair_status.b_channel_repair_pending) + + @property + def tpc_repair_pending(self) -> bool: + """ + `True` if a TPC repair is pending. + """ + return bool(self._repair_status.b_tpc_repair_pending) diff --git a/cuda_core/cuda/core/system/_system.pyi b/cuda_core/cuda/core/system/_system.pyi new file mode 100644 index 00000000000..f25ce35be7f --- /dev/null +++ b/cuda_core/cuda/core/system/_system.pyi @@ -0,0 +1,75 @@ +# This file was generated by stubgen-pyx v0.2.6 from cuda_core/cuda/core/system/_system.pyx + +from __future__ import annotations + +CUDA_BINDINGS_NVML_IS_COMPATIBLE: bool +__all__ = ['get_driver_branch', 'get_kernel_mode_driver_version', 'get_user_mode_driver_version', 'get_nvml_version', 'get_num_devices', 'get_process_name', 'CUDA_BINDINGS_NVML_IS_COMPATIBLE'] + +def get_user_mode_driver_version() -> tuple[int, ...]: + """ + Get the user-mode (UMD / CUDA) driver version. + + This is the most commonly needed version when checking CUDA driver + compatibility. It works with all ``cuda-bindings`` versions. + + Returns + ------- + version : tuple[int, ...] + A 2-tuple ``(MAJOR, MINOR)``, e.g. ``(13, 0)`` for CUDA 13.0. + """ + +def get_kernel_mode_driver_version() -> tuple[int, ...]: + """ + Get the kernel-mode (KMD / GPU) driver version, e.g. 580.65.06. + + Returns + ------- + version : tuple[int, ...] + Typically a 3-tuple ``(MAJOR, MINOR, PATCH)`` + (2-tuple on WSL), e.g. ``(580, 65, 6)``. + + Raises + ------ + RuntimeError + If the NVML library is not available. + """ + +def get_nvml_version() -> tuple[int, ...]: + """ + The version of the NVML library. + + Returns + ------- + version: tuple[int, ...] + Tuple of integers representing the NVML version components. + """ + +def get_driver_branch() -> str: + """ + Retrieves the driver branch of the NVIDIA driver installed on the system. + + Returns + ------- + branch: str + The driver branch string (e.g., ``"560"``, ``"open"``, etc.). + """ + +def get_num_devices() -> int: + """ + Return the number of devices in the system. + """ + +def get_process_name(pid: int) -> str: + """ + The name of process with given PID. + + Parameters + ---------- + pid: int + The PID of the process for which to get the name. + + Returns + ------- + name: str + The process name. + """ \ No newline at end of file diff --git a/cuda_core/cuda/core/system/_system.pyx b/cuda_core/cuda/core/system/_system.pyx new file mode 100644 index 00000000000..2a6c8ffc23d --- /dev/null +++ b/cuda_core/cuda/core/system/_system.pyx @@ -0,0 +1,197 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + + +# This file needs to either use NVML exclusively, or when `cuda.bindings.nvml` +# isn't available, fall back to non-NVML-based methods for backward +# compatibility. + + +CUDA_BINDINGS_NVML_IS_COMPATIBLE: bool + + +# Please keep in sync with the equivalent implementation in +# cuda_python_test_helpers/cuda_python_test_helpers/__init__.py. +cdef bint _detect_wsl(): + try: + with open("/proc/sys/kernel/osrelease") as f: + data = f.read().lower() + except OSError: + return False + return "microsoft" in data or "wsl" in data + + +cdef bint _IS_WSL = _detect_wsl() + + +# The WSL locale guard lives in a separate module that is only compiled on +# Linux (build_hooks.py excludes it on Windows), because it relies on POSIX +# per-thread locale APIs that MSVC does not provide. On non-Linux platforms +# the import fails and we fall back to a no-op guard; _IS_WSL is then False +# so the guard is never entered anyway. +if _IS_WSL: + from cuda.core._utils._wsl_locale import c_locale_guard +else: + c_locale_guard = None + + +try: + from cuda.bindings._version import __version_tuple__ as _BINDINGS_VERSION +except ImportError: + CUDA_BINDINGS_NVML_IS_COMPATIBLE = False +else: + CUDA_BINDINGS_NVML_IS_COMPATIBLE = _BINDINGS_VERSION >= (13, 2, 0) or (_BINDINGS_VERSION[0] == 12 and _BINDINGS_VERSION[1:3] >= (9, 6)) + + +if CUDA_BINDINGS_NVML_IS_COMPATIBLE: + try: + from cuda.bindings import nvml + except ImportError: + CUDA_BINDINGS_NVML_IS_COMPATIBLE = False + + from cuda.core.system._nvml_context import initialize +else: + from cuda.core._utils.cuda_utils import driver, handle_return, runtime + + +def get_user_mode_driver_version() -> tuple[int, ...]: + """ + Get the user-mode (UMD / CUDA) driver version. + + This is the most commonly needed version when checking CUDA driver + compatibility. It works with all ``cuda-bindings`` versions. + + Returns + ------- + version : tuple[int, ...] + A 2-tuple ``(MAJOR, MINOR)``, e.g. ``(13, 0)`` for CUDA 13.0. + """ + cdef int v + if CUDA_BINDINGS_NVML_IS_COMPATIBLE: + initialize() + v = nvml.system_get_cuda_driver_version() + else: + v = handle_return(driver.cuDriverGetVersion()) + return (v // 1000, (v // 10) % 100) + + +def get_kernel_mode_driver_version() -> tuple[int, ...]: + """ + Get the kernel-mode (KMD / GPU) driver version, e.g. 580.65.06. + + Returns + ------- + version : tuple[int, ...] + Typically a 3-tuple ``(MAJOR, MINOR, PATCH)`` + (2-tuple on WSL), e.g. ``(580, 65, 6)``. + + Raises + ------ + RuntimeError + If the NVML library is not available. + """ + if not CUDA_BINDINGS_NVML_IS_COMPATIBLE: + raise RuntimeError( + "get_kernel_mode_driver_version requires NVML support" + ) + initialize() + return tuple(int(x) for x in nvml.system_get_driver_version().split(".")) + + +def get_nvml_version() -> tuple[int, ...]: + """ + The version of the NVML library. + + Returns + ------- + version: tuple[int, ...] + Tuple of integers representing the NVML version components. + """ + if not CUDA_BINDINGS_NVML_IS_COMPATIBLE: + raise RuntimeError("NVML library is not available") + return tuple(int(v) for v in nvml.system_get_nvml_version().split(".")) + + +def get_driver_branch() -> str: + """ + Retrieves the driver branch of the NVIDIA driver installed on the system. + + Returns + ------- + branch: str + The driver branch string (e.g., ``"560"``, ``"open"``, etc.). + """ + if not CUDA_BINDINGS_NVML_IS_COMPATIBLE: + raise RuntimeError("NVML library is not available") + initialize() + return nvml.system_get_driver_branch() + + +def get_num_devices() -> int: + """ + Return the number of devices in the system. + """ + if CUDA_BINDINGS_NVML_IS_COMPATIBLE: + initialize() + return nvml.device_get_count_v2() + else: + return handle_return(runtime.cudaGetDeviceCount()) + + +def get_process_name(pid: int) -> str: + """ + The name of process with given PID. + + Parameters + ---------- + pid: int + The PID of the process for which to get the name. + + Returns + ------- + name: str + The process name. + """ + def _get_process_name(pid) -> str: + # NVML caches process names on a per-PID basis when queried via + # nvmlSystemGetProcessName, and the cache is populated when enumerating + # running processes on devices. To ensure the name is cached for the + # requested PID, we walk all devices and query their running processes. + for i in range(nvml.device_get_count_v2()): + try: + dev_h = nvml.device_get_handle_by_index_v2(i) + nvml.device_get_compute_running_processes_v3(dev_h) + except nvml.NvmlError: + continue + return nvml.system_get_process_name(pid) + + initialize() + if not _IS_WSL: + return _get_process_name(pid) + + # WSL workaround: nvmlSystemGetProcessName on WSL takes a wide-char + # conversion path when the calling thread's locale is non-"C". That path + # walks a UTF-16LE source buffer with a 4-byte stride (as if it were + # UTF-32LE) and emits 5-byte UTF-8 sequences that look like garbage + # preceding the trailing basename of /proc//exe. CPython's startup + # unconditionally calls setlocale(LC_ALL, ""), so essentially every + # cuda.core caller hits this. The cached entry for the PID is set the + # first time NVML resolves it (typically inside + # nvmlDeviceGetComputeRunningProcesses_v3), so to recover a correct value + # we re-prime the cache under the "C" locale before reading the name. + # c_locale_guard uses POSIX per-thread locale APIs (see _wsl_locale.pyx) + # so other threads' view of the locale is unaffected. + with c_locale_guard(): # no-cython-lint + return _get_process_name(pid) + + +__all__ = [ + "get_driver_branch", + "get_kernel_mode_driver_version", + "get_user_mode_driver_version", + "get_nvml_version", + "get_num_devices", + "get_process_name", + "CUDA_BINDINGS_NVML_IS_COMPATIBLE", +] diff --git a/cuda_core/cuda/core/system/_system_events.pyi b/cuda_core/cuda/core/system/_system_events.pyi new file mode 100644 index 00000000000..5ae5b86bc57 --- /dev/null +++ b/cuda_core/cuda/core/system/_system_events.pyi @@ -0,0 +1,133 @@ +# This file was generated by stubgen-pyx v0.2.6 from cuda_core/cuda/core/system/_system_events.pyx + +from __future__ import annotations + +from cuda.bindings import nvml +from cuda.core.system.typing import SystemEventType + +from . import _device + + +class SystemEvent: + """ + Data about a collection of system events. + """ + + def __init__(self, event_data: nvml.SystemEventData_v1): + ... + + @property + def event_type(self) -> SystemEventType: + """ + The :obj:`~SystemEventType` that was triggered. + """ + + @property + def gpu_id(self) -> int: + """ + The GPU ID in PCI ID format. + """ + + @property + def device(self) -> _device.Device: + """ + The :obj:`~_device.Device` associated with this event. + """ + +class SystemEvents: + """ + Data about a collection of system events. + """ + + def __init__(self, event_data: nvml.SystemEventData_v1): + ... + + def __len__(self) -> int: + ... + + def __getitem__(self, idx: int) -> SystemEvent: + """ + Get the :obj:`~_system_events.SystemEvent` at the specified index. + """ + +class RegisteredSystemEvents: + """ + Represents a set of events that can be waited on for a specific device. + """ + + def __init__(self, events: SystemEventType | str | list[SystemEventType | str]): + ... + + def __dealloc__(self) -> None: + ... + + def wait(self, timeout_ms: int=0, buffer_size: int=1) -> SystemEvents: + """ + Wait for events in the system event set. + + For Fermi™ or newer fully supported devices. + + If some events are ready to be delivered at the time of the call, + function returns immediately. If there are no events ready to be + delivered, function sleeps till event arrives but not longer than + specified timeout. If timeout passes, a + :class:`cuda.core.system.TimeoutError` is raised. This function in + certain conditions can return before specified timeout passes (e.g. when + interrupt arrives) + + Parameters + ---------- + timeout_ms: int + The timeout in milliseconds. A value of 0 means to wait indefinitely. + buffer_size: int + The maximum number of events to retrieve. Must be at least 1. + + Returns + ------- + :obj:`~_system_events.SystemEvents` + A set of events that were received. The number of events returned may + be less than the specified buffer size if fewer events were available. + + Raises + ------ + :class:`cuda.core.system.TimeoutError` + If the timeout expires before an event is received. + :class:`cuda.core.system.GpuIsLostError` + If the GPU has fallen off the bus or is otherwise inaccessible. + """ +_SYSTEM_EVENT_TYPE_MAPPING = {nvml.SystemEventType.GPU_DRIVER_UNBIND: SystemEventType.UNBIND, nvml.SystemEventType.GPU_DRIVER_BIND: SystemEventType.BIND} +_SYSTEM_EVENT_TYPE_INV_MAPPING = {v: k for k, v in _SYSTEM_EVENT_TYPE_MAPPING.items()} +__all__ = ['register_events'] + +def register_events(events: SystemEventType | str | list[SystemEventType | str]) -> RegisteredSystemEvents: + """ + Starts recording of events on test system. + + For Linux only. + + All events that occurred before this call are not recorded. Wait for events + using the :meth:`RegisteredSystemEvents.wait` method on the result. + + Examples + -------- + >>> from cuda.core import system + >>> events = system.register_events([SystemEventType.UNBIND]) + >>> while event := events.wait(timeout_ms=10000): + ... print(f"Event {event.event_type} occurred.") + + Parameters + ---------- + events: SystemEventType, str, or list of SystemEventType or str + The event type or list of event types to register for this device. + + Returns + ------- + :obj:`~_system_events.RegisteredSystemEvents` + An object representing the registered events. Call + :meth:`~_system_events.RegisteredSystemEvents.wait` on this object to wait for events. + + Raises + ------ + :class:`cuda.core.system.NotSupportedError` + None of the requested event types are registered. + """ \ No newline at end of file diff --git a/cuda_core/cuda/core/system/_system_events.pyx b/cuda_core/cuda/core/system/_system_events.pyx new file mode 100644 index 00000000000..87a3dfcf1ef --- /dev/null +++ b/cuda_core/cuda/core/system/_system_events.pyx @@ -0,0 +1,183 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + + +from libc.stdint cimport intptr_t + +from cuda.bindings import nvml + +from ._nvml_context cimport initialize + +from . import _device +from cuda.core.system.typing import SystemEventType + + +_SYSTEM_EVENT_TYPE_MAPPING = { + nvml.SystemEventType.GPU_DRIVER_UNBIND: SystemEventType.UNBIND, + nvml.SystemEventType.GPU_DRIVER_BIND: SystemEventType.BIND, +} + + +_SYSTEM_EVENT_TYPE_INV_MAPPING = {v: k for k, v in _SYSTEM_EVENT_TYPE_MAPPING.items()} + + +cdef class SystemEvent: + """ + Data about a collection of system events. + """ + def __init__(self, event_data: nvml.SystemEventData_v1): + assert len(event_data) == 1 + self._event_data = event_data + + @property + def event_type(self) -> SystemEventType: + """ + The :obj:`~SystemEventType` that was triggered. + """ + return _SYSTEM_EVENT_TYPE_MAPPING[self._event_data.event_type] + + @property + def gpu_id(self) -> int: + """ + The GPU ID in PCI ID format. + """ + return self._event_data.gpu_id + + @property + def device(self) -> _device.Device: + """ + The :obj:`~_device.Device` associated with this event. + """ + return _device.Device(pci_bus_id=self.gpu_id) + + +cdef class SystemEvents: + """ + Data about a collection of system events. + """ + def __init__(self, event_data: nvml.SystemEventData_v1): + self._event_data = event_data + + def __len__(self) -> int: + return len(self._event_data) + + def __getitem__(self, idx: int) -> SystemEvent: + """ + Get the :obj:`~_system_events.SystemEvent` at the specified index. + """ + return SystemEvent(self._event_data[idx]) + + +cdef class RegisteredSystemEvents: + """ + Represents a set of events that can be waited on for a specific device. + """ + cdef intptr_t _event_set + + def __init__(self, events: SystemEventType | str | list[SystemEventType | str]): + cdef unsigned long long event_bitmask + if isinstance(events, (str, SystemEventType)): + events = [events] + + if isinstance(events, list): + event_bitmask = 0 + for ev in events: + try: + ev_enum = _SYSTEM_EVENT_TYPE_INV_MAPPING[ev] + except KeyError: + raise ValueError( + f"Invalid event type: {ev}. " + f"Must be one of {list(SystemEventType.__members__.values())}" + ) from None + event_bitmask |= int(ev_enum) + else: + raise TypeError("events must be an SystemEventType, str, or list of SystemEventType or str") + + initialize() + + self._event_set = 0 + self._event_set = nvml.system_event_set_create() + # If this raises, the event needs to be freed and this is handled by + # this class's __dealloc__ method. + nvml.system_register_events(event_bitmask, self._event_set) + + def __dealloc__(self) -> None: + if self._event_set != 0: + nvml.system_event_set_free(self._event_set) + + def wait(self, timeout_ms: int = 0, buffer_size: int = 1) -> SystemEvents: + """ + Wait for events in the system event set. + + For Fermi™ or newer fully supported devices. + + If some events are ready to be delivered at the time of the call, + function returns immediately. If there are no events ready to be + delivered, function sleeps till event arrives but not longer than + specified timeout. If timeout passes, a + :class:`cuda.core.system.TimeoutError` is raised. This function in + certain conditions can return before specified timeout passes (e.g. when + interrupt arrives) + + Parameters + ---------- + timeout_ms: int + The timeout in milliseconds. A value of 0 means to wait indefinitely. + buffer_size: int + The maximum number of events to retrieve. Must be at least 1. + + Returns + ------- + :obj:`~_system_events.SystemEvents` + A set of events that were received. The number of events returned may + be less than the specified buffer size if fewer events were available. + + Raises + ------ + :class:`cuda.core.system.TimeoutError` + If the timeout expires before an event is received. + :class:`cuda.core.system.GpuIsLostError` + If the GPU has fallen off the bus or is otherwise inaccessible. + """ + return SystemEvents(nvml.system_event_set_wait(self._event_set, timeout_ms, buffer_size)) + + +def register_events(events: SystemEventType | str | list[SystemEventType | str]) -> RegisteredSystemEvents: + """ + Starts recording of events on test system. + + For Linux only. + + All events that occurred before this call are not recorded. Wait for events + using the :meth:`RegisteredSystemEvents.wait` method on the result. + + Examples + -------- + >>> from cuda.core import system + >>> events = system.register_events([SystemEventType.UNBIND]) + >>> while event := events.wait(timeout_ms=10000): + ... print(f"Event {event.event_type} occurred.") + + Parameters + ---------- + events: SystemEventType, str, or list of SystemEventType or str + The event type or list of event types to register for this device. + + Returns + ------- + :obj:`~_system_events.RegisteredSystemEvents` + An object representing the registered events. Call + :meth:`~_system_events.RegisteredSystemEvents.wait` on this object to wait for events. + + Raises + ------ + :class:`cuda.core.system.NotSupportedError` + None of the requested event types are registered. + """ + return RegisteredSystemEvents(events) + + +__all__ = [ + "register_events", +] diff --git a/cuda_core/cuda/core/system/_temperature.pxi b/cuda_core/cuda/core/system/_temperature.pxi new file mode 100644 index 00000000000..f5eed73de2c --- /dev/null +++ b/cuda_core/cuda/core/system/_temperature.pxi @@ -0,0 +1,217 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + + +_TEMPERATURE_THRESHOLD_MAPPING = { + TemperatureThresholds.SHUTDOWN: nvml.TemperatureThresholds.TEMPERATURE_THRESHOLD_SHUTDOWN, + TemperatureThresholds.SLOWDOWN: nvml.TemperatureThresholds.TEMPERATURE_THRESHOLD_SLOWDOWN, + TemperatureThresholds.MEM_MAX: nvml.TemperatureThresholds.TEMPERATURE_THRESHOLD_MEM_MAX, + TemperatureThresholds.GPU_MAX: nvml.TemperatureThresholds.TEMPERATURE_THRESHOLD_GPU_MAX, + TemperatureThresholds.ACOUSTIC_MIN: nvml.TemperatureThresholds.TEMPERATURE_THRESHOLD_ACOUSTIC_MIN, + TemperatureThresholds.ACOUSTIC_CURR: nvml.TemperatureThresholds.TEMPERATURE_THRESHOLD_ACOUSTIC_CURR, + TemperatureThresholds.ACOUSTIC_MAX: nvml.TemperatureThresholds.TEMPERATURE_THRESHOLD_ACOUSTIC_MAX, + TemperatureThresholds.GPS_CURR: nvml.TemperatureThresholds.TEMPERATURE_THRESHOLD_GPS_CURR, +} + + +_THERMAL_CONTROLLER_MAPPING = { + nvml.ThermalController.GPU_INTERNAL: ThermalController.GPU_INTERNAL, + nvml.ThermalController.ADM1032: ThermalController.ADM1032, + nvml.ThermalController.ADT7461: ThermalController.ADT7461, + nvml.ThermalController.MAX6649: ThermalController.MAX6649, + nvml.ThermalController.MAX1617: ThermalController.MAX1617, + nvml.ThermalController.LM99: ThermalController.LM99, + nvml.ThermalController.LM89: ThermalController.LM89, + nvml.ThermalController.LM64: ThermalController.LM64, + nvml.ThermalController.G781: ThermalController.G781, + nvml.ThermalController.ADT7473: ThermalController.ADT7473, + nvml.ThermalController.SBMAX6649: ThermalController.SBMAX6649, + nvml.ThermalController.VBIOSEVT: ThermalController.VBIOSEVT, + nvml.ThermalController.OS: ThermalController.OS, + nvml.ThermalController.NVSYSCON_CANOAS: ThermalController.NVSYSCON_CANOAS, + nvml.ThermalController.NVSYSCON_E551: ThermalController.NVSYSCON_E551, + nvml.ThermalController.MAX6649R: ThermalController.MAX6649R, + nvml.ThermalController.ADT7473S: ThermalController.ADT7473S, + nvml.ThermalController.UNKNOWN: ThermalController.UNKNOWN, +} + + +_THERMAL_TARGET_MAPPING = { + nvml.ThermalTarget.NONE: ThermalTarget.NONE, + nvml.ThermalTarget.GPU: ThermalTarget.GPU, + nvml.ThermalTarget.MEMORY: ThermalTarget.MEMORY, + nvml.ThermalTarget.POWER_SUPPLY: ThermalTarget.POWER_SUPPLY, + nvml.ThermalTarget.BOARD: ThermalTarget.BOARD, + nvml.ThermalTarget.VCD_BOARD: ThermalTarget.VCD_BOARD, + nvml.ThermalTarget.VCD_INLET: ThermalTarget.VCD_INLET, + nvml.ThermalTarget.VCD_OUTLET: ThermalTarget.VCD_OUTLET, + nvml.ThermalTarget.ALL: ThermalTarget.ALL, +} + + +_THERMAL_TARGET_INV_MAPPING = {v: k for k, v in _THERMAL_TARGET_MAPPING.items()} + + +# In cuda.bindings.nvml, this is an anonymous struct inside nvmlThermalSettings_t. + + +ctypedef struct _ThermalSensor: + int controller + int defaultMinTemp + int defaultMaxTemp + int currentTemp + int target + + +cdef class ThermalSensor: + cdef: + _ThermalSensor *_ptr + object _owner + + def __init__(self, ptr: int, owner: object): + # ptr points to a part of the numpy buffer held by `_owner`, so we need + # to maintain a reference to `_owner` to keep it alive. + self._ptr = <_ThermalSensor *>ptr + self._owner = owner + + @property + def controller(self) -> ThermalController: + return _THERMAL_CONTROLLER_MAPPING.get(self._ptr[0].controller, ThermalController.UNKNOWN) + + @property + def default_min_temp(self) -> int: + return self._ptr[0].defaultMinTemp + + @property + def default_max_temp(self) -> int: + return self._ptr[0].defaultMaxTemp + + @property + def current_temp(self) -> int: + return self._ptr[0].currentTemp + + @property + def target(self) -> ThermalTarget: + return _THERMAL_TARGET_MAPPING.get(self._ptr[0].target, ThermalTarget.NONE) + + +cdef class ThermalSettings: + cdef object _thermal_settings + + def __init__(self, thermal_settings: nvml.ThermalSettings): + self._thermal_settings = thermal_settings + + def __len__(self) -> int: + # MAX_THERMAL_SENSORS_PER_GPU is 3 + return min(self._thermal_settings.count, 3) + + def __getitem__(self, idx: int) -> nvml.ThermalSensor: + if idx < 0 or idx >= len(self): + raise IndexError("Thermal sensor index out of range") + return ThermalSensor( + self._thermal_settings.sensor.ptr + idx * sizeof(_ThermalSensor), + self._thermal_settings + ) + + +cdef class Temperature: + cdef intptr_t _handle + + def __init__(self, handle: int): + self._handle = handle + + def get_sensor(self) -> int: + """ + Get the temperature reading from a specific sensor on the device, in + degrees Celsius. + + The only sensor currently supported is the GPU temperature sensor. + + Returns + ------- + int + The temperature in degrees Celsius. + """ + # NOTE: nvml.device_get_temperature_v takes a sensor type from the + # TemperatorSensors enum, but there is only one value in that enum. For + # future compatibility if there are other values for that enum, this is + # a method, not a property + return nvml.device_get_temperature_v(self._handle, nvml.TemperatureSensors.TEMPERATURE_GPU) + + def get_threshold(self, threshold_type: TemperatureThresholds | str) -> int: + """ + Retrieves the temperature threshold for this GPU with the specified + threshold type, in degrees Celsius. + + For Kepler™ or newer fully supported devices. + + See :class:`TemperatureThresholds` for possible threshold types. + + Note: This API is no longer the preferred interface for retrieving the + following temperature thresholds on Ada and later architectures: + ``NVML_TEMPERATURE_THRESHOLD_SHUTDOWN``, + ``NVML_TEMPERATURE_THRESHOLD_SLOWDOWN``, + ``NVML_TEMPERATURE_THRESHOLD_MEM_MAX`` and + ``NVML_TEMPERATURE_THRESHOLD_GPU_MAX``. + + Support for reading these temperature thresholds for Ada and later + architectures would be removed from this API in future releases. Please + use :meth:`get_field_values` with ``NVML_FI_DEV_TEMPERATURE_*`` fields + to retrieve temperature thresholds on these architectures. + """ + try: + threshold_type_enum = _TEMPERATURE_THRESHOLD_MAPPING[threshold_type] + except KeyError: + raise ValueError( + f"Invalid temperature threshold type: {threshold_type}. " + f"Must be one of {list(TemperatureThresholds.__members__.values())}" + ) from None + if threshold_type_enum in ( + nvml.TemperatureThresholds.TEMPERATURE_THRESHOLD_SHUTDOWN, + nvml.TemperatureThresholds.TEMPERATURE_THRESHOLD_SLOWDOWN, + nvml.TemperatureThresholds.TEMPERATURE_THRESHOLD_MEM_MAX, + nvml.TemperatureThresholds.TEMPERATURE_THRESHOLD_GPU_MAX + ): + device_arch = nvml.DeviceArch(nvml.device_get_architecture(self._handle)) + if device_arch >= nvml.DeviceArch.ADA: + warnings.warn( + f"{threshold_type} is no longer recommended for Ada and later architectures. " + "Use get_field_values with NVML_FI_DEV_TEMPERATURE_* fields to retrieve this " + "threshold on these architectures.", + DeprecationWarning, + stacklevel=2 + ) + return nvml.device_get_temperature_threshold(self._handle, threshold_type_enum) + + @property + def margin(self) -> int: + """ + The thermal margin temperature (distance to nearest slowdown threshold) for the device. + """ + return nvml.device_get_margin_temperature(self._handle) + + def get_thermal_settings(self, sensor_index: ThermalTarget | str) -> ThermalSettings: + """ + Used to execute a list of thermal system instructions. + + Parameters + ---------- + sensor_index: ThermalTarget + The index of the thermal sensor. + + Returns + ------- + :obj:`~_device.ThermalSettings` + The thermal settings for the specified sensor. + """ + # TODO: The above docstring is from the NVML header, but it doesn't seem to make sense. + try: + sensor_index_enum = _THERMAL_TARGET_INV_MAPPING[sensor_index] + except KeyError: + raise ValueError( + f"Invalid thermal sensor index: {sensor_index}. " + f"Must be one of {list(ThermalTarget.__members__.values())}" + ) from None + + return ThermalSettings(nvml.device_get_thermal_settings(self._handle, sensor_index_enum)) diff --git a/cuda_core/cuda/core/system/_utilization.pxi b/cuda_core/cuda/core/system/_utilization.pxi new file mode 100644 index 00000000000..689b7dc67f2 --- /dev/null +++ b/cuda_core/cuda/core/system/_utilization.pxi @@ -0,0 +1,29 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + + +cdef class Utilization: + """ + Utilization rates for a device. + + For devices with compute capability 2.0 or higher. + """ + cdef object _utilization + + def __init__(self, utilization: nvml.Utilization): + self._utilization = utilization + + @property + def gpu(self) -> int: + """ + Percent of time over the past sample period during which one or more kernels was executing on the GPU. + """ + return self._utilization.gpu + + @property + def memory(self) -> int: + """ + Percent of time over the past sample period during which global (device) memory was being read or written. + """ + return self._utilization.memory diff --git a/cuda_core/cuda/core/system/exceptions.py b/cuda_core/cuda/core/system/exceptions.py new file mode 100644 index 00000000000..21f258edb1f --- /dev/null +++ b/cuda_core/cuda/core/system/exceptions.py @@ -0,0 +1,75 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + + +from cuda.bindings import nvml + +NvmlError = nvml.NvmlError +UninitializedError = nvml.UninitializedError +InvalidArgumentError = nvml.InvalidArgumentError +NotSupportedError = nvml.NotSupportedError +NoPermissionError = nvml.NoPermissionError +AlreadyInitializedError = nvml.AlreadyInitializedError +NotFoundError = nvml.NotFoundError +InsufficientSizeError = nvml.InsufficientSizeError +InsufficientPowerError = nvml.InsufficientPowerError +DriverNotLoadedError = nvml.DriverNotLoadedError +TimeoutError = nvml.TimeoutError +IrqIssueError = nvml.IrqIssueError +LibraryNotFoundError = nvml.LibraryNotFoundError +FunctionNotFoundError = nvml.FunctionNotFoundError +CorruptedInforomError = nvml.CorruptedInforomError +GpuIsLostError = nvml.GpuIsLostError +ResetRequiredError = nvml.ResetRequiredError +OperatingSystemError = nvml.OperatingSystemError +LibRmVersionMismatchError = nvml.LibRmVersionMismatchError +InUseError = nvml.InUseError +MemoryError = nvml.MemoryError +NoDataError = nvml.NoDataError +VgpuEccNotSupportedError = nvml.VgpuEccNotSupportedError +InsufficientResourcesError = nvml.InsufficientResourcesError +FreqNotSupportedError = nvml.FreqNotSupportedError +ArgumentVersionMismatchError = nvml.ArgumentVersionMismatchError +DeprecatedError = nvml.DeprecatedError +NotReadyError = nvml.NotReadyError +GpuNotFoundError = nvml.GpuNotFoundError +InvalidStateError = nvml.InvalidStateError +ResetTypeNotSupportedError = nvml.ResetTypeNotSupportedError +UnknownError = nvml.UnknownError + + +__all__ = [ + "AlreadyInitializedError", + "ArgumentVersionMismatchError", + "CorruptedInforomError", + "DeprecatedError", + "DriverNotLoadedError", + "FreqNotSupportedError", + "FunctionNotFoundError", + "GpuIsLostError", + "GpuNotFoundError", + "InUseError", + "InsufficientPowerError", + "InsufficientResourcesError", + "InsufficientSizeError", + "InvalidArgumentError", + "InvalidStateError", + "IrqIssueError", + "LibRmVersionMismatchError", + "LibraryNotFoundError", + "MemoryError", + "NoDataError", + "NoPermissionError", + "NotFoundError", + "NotReadyError", + "NotSupportedError", + "NvmlError", + "OperatingSystemError", + "ResetRequiredError", + "ResetTypeNotSupportedError", + "TimeoutError", + "UninitializedError", + "UnknownError", + "VgpuEccNotSupportedError", +] diff --git a/cuda_core/cuda/core/system/typing.py b/cuda_core/cuda/core/system/typing.py new file mode 100644 index 00000000000..02246714a39 --- /dev/null +++ b/cuda_core/cuda/core/system/typing.py @@ -0,0 +1,361 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from cuda.core._utils.pycompat import StrEnum + +__all__ = [ + "AddressingMode", + "AffinityScope", + "ClockId", + "ClockType", + "ClocksEventReasons", + "CoolerControl", + "CoolerTarget", + "EventType", + "FanControlPolicy", + "GpuP2PCapsIndex", + "GpuP2PStatus", + "GpuTopologyLevel", + "InforomObject", + "SystemEventType", + "TemperatureThresholds", + "ThermalController", + "ThermalTarget", +] + + +class AddressingMode(StrEnum): + """ + Addressing mode of a device. + + For Kepler™ or newer fully supported devices. + """ + + HMM = "hmm" + ATS = "ats" + + +AddressingMode.HMM.__doc__ = """ + System allocated memory (``malloc``, ``mmap``) is addressable from the device + (GPU), via software-based mirroring of the CPU's page tables, on the GPU. +""" + +AddressingMode.ATS.__doc__ = """ + System allocated memory (``malloc``, ``mmap``) is addressable from the device + (GPU), via Address Translation Services. This means that there is (effectively) + a single set of page tables, and the CPU and GPU both use them. +""" + + +class AffinityScope(StrEnum): + """ + Scope for affinity queries. + """ + + NODE = "node" + SOCKET = "socket" + + +AffinityScope.NODE.__doc__ = """ +The NUMA node is the scope of the affinity query. This is the default scope. +""" + +AffinityScope.SOCKET.__doc__ = """ +The CPU socket is the scope of the affinity query. +""" + + +class ClockId(StrEnum): + """ + Clock Ids. These are used in combination with :class:`ClockType` to specify a single clock value. + """ + + CURRENT = "current" + CUSTOMER_BOOST_MAX = "customer_boost_max" + # APP_CLOCK_TARGET and APP_CLOCK_DEFAULT are deprecated so not included here + + +ClockId.CURRENT.__doc__ = "Current actual clock value." +ClockId.CUSTOMER_BOOST_MAX.__doc__ = "OEM-defined maximum clock rate" + + +class ClocksEventReasons(StrEnum): + """ + Reasons for a clocks event. These are used in combination with :class:`ClockType` to specify the reason + for a clocks event. + """ + + NONE = "none" + GPU_IDLE = "gpu_idle" + APPLICATIONS_CLOCKS_SETTING = "applications_clocks_setting" + SW_POWER_CAP = "sw_power_cap" + HW_SLOWDOWN = "hw_slowdown" + SYNC_BOOST = "sync_boost" + SW_THERMAL_SLOWDOWN = "sw_thermal_slowdown" + HW_THERMAL_SLOWDOWN = "hw_thermal_slowdown" + HW_POWER_BRAKE_SLOWDOWN = "hw_power_brake_slowdown" + DISPLAY_CLOCK_SETTING = "display_clock_setting" + + +class ClockType(StrEnum): + """ + Clock types. All speeds are in Mhz. + """ + + GRAPHICS = "graphics" + SM = "sm" + MEMORY = "memory" + VIDEO = "video" + + +class CoolerControl(StrEnum): + """ + Cooler control type. + """ + + TOGGLE = "toggle" + VARIABLE = "variable" + + +CoolerControl.TOGGLE.__doc__ = """ +This cooler can only be toggled either ON or OFF (e.g. a switch). +""" + +CoolerControl.VARIABLE.__doc__ = """ +This cooler's level can be adjusted from some minimum to some maximum (e.g. a knob). +""" + + +class CoolerTarget(StrEnum): + """ + Cooler target. + """ + + NONE = "none" + GPU = "gpu" + MEMORY = "memory" + POWER_SUPPLY = "power_supply" + # THERMAL_GPU_RELATED is a composite target, so it is omitted here and will + # get returned as 3 separate targets: GPU, MEMORY, and POWER_SUPPLY. + + +CoolerTarget.NONE.__doc__ = "This cooler controls nothing." +CoolerTarget.GPU.__doc__ = "This cooler can cool the GPU." +CoolerTarget.MEMORY.__doc__ = "This cooler can cool the memory." +CoolerTarget.POWER_SUPPLY.__doc__ = "This cooler can cool the power supply." + + +class EventType(StrEnum): + """ + Event types that can be waited on with :class:`DeviceEvents`. + """ + + NONE = "none" + SINGLE_BIT_ECC_ERROR = "single_bit_ecc_error" + DOUBLE_BIT_ECC_ERROR = "double_bit_ecc_error" + PSTATE = "pstate" + XID_CRITICAL_ERROR = "xid_critical_error" + CLOCK = "clock" + POWER_SOURCE_CHANGE = "power_source_change" + MIG_CONFIG_CHANGE = "mig_config_change" + SINGLE_BIT_ECC_ERROR_STORM = "single_bit_ecc_error_storm" + DRAM_RETIREMENT_EVENT = "dram_retirement_event" + DRAM_RETIREMENT_FAILURE = "dram_retirement_failure" + NON_FATAL_POISON_ERROR = "non_fatal_poison_error" + FATAL_POISON_ERROR = "fatal_poison_error" + GPU_UNAVAILABLE_ERROR = "gpu_unavailable_error" + GPU_RECOVERY_ACTION = "gpu_recovery_action" + + +EventType.PSTATE.__doc__ = """ +Event about PState changes + +On Fermi™ architecture, PState changes are also an indicator that GPU is throttling down due to +no work being executed on the GPU, power capping or thermal capping. In a typical situation, +Fermi-based GPU should stay in P0 for the duration of the execution of the compute process. +""" + + +class FanControlPolicy(StrEnum): + """ + Fan control policies. + """ + + TEMPERATURE_CONTROLLED = "temperature_controlled" + MANUAL = "manual" + + +class GpuP2PCapsIndex(StrEnum): + """ + GPU peer-to-peer capabilities index. + """ + + READ = "read" + WRITE = "write" + NVLINK = "nvlink" + ATOMICS = "atomics" + PCI = "pci" + PROP = "prop" + UNKNOWN = "unknown" + + +class GpuP2PStatus(StrEnum): + """ + GPU peer-to-peer status. + """ + + OK = "ok" + CHIPSET_NOT_SUPPORTED = "chipset not supported" + GPU_NOT_SUPPORTED = "GPU not supported" + IOH_TOPOLOGY_NOT_SUPPORTED = "IOH topology not supported" + DISABLED_BY_REGKEY = "disabled by regkey" + NOT_SUPPORTED = "not supported" + UNKNOWN = "unknown" + + +class GpuTopologyLevel(StrEnum): + """ + Represents level relationships within a system between two GPUs. + """ + + INTERNAL = "internal" + SINGLE = "single" + MULTIPLE = "multiple" + HOSTBRIDGE = "hostbridge" + NODE = "node" + SYSTEM = "system" + + +class InforomObject(StrEnum): + """ + InfoROM objects types. + """ + + OEM = "oem" + ECC = "ecc" + POWER = "power" + DEN = "den" + + +InforomObject.OEM.__doc__ = "An object defined by OEM." +InforomObject.ECC.__doc__ = "The ECC object determining the level of ECC support." +InforomObject.POWER.__doc__ = "The power management object." +InforomObject.DEN.__doc__ = "DRAM Encryption object." + + +class SystemEventType(StrEnum): + """ + System event types. + """ + + UNBIND = "unbind" + BIND = "bind" + + +class TemperatureThresholds(StrEnum): + """ + Temperature threshold types. + """ + + SHUTDOWN = "shutdown" + SLOWDOWN = "slowdown" + MEM_MAX = "mem_max" + GPU_MAX = "gpu_max" + ACOUSTIC_MIN = "acoustic_min" + ACOUSTIC_CURR = "acoustic_curr" + ACOUSTIC_MAX = "acoustic_max" + GPS_CURR = "gps_curr" + + +class ThermalController(StrEnum): + """ + Thermal controller types. + """ + + GPU_INTERNAL = "gpu_internal" + ADM1032 = "adm1032" + ADT7461 = "adt7461" + MAX6649 = "max6649" + MAX1617 = "max1617" + LM99 = "lm99" + LM89 = "lm89" + LM64 = "lm64" + G781 = "g781" + ADT7473 = "adt7473" + SBMAX6649 = "sbmax6649" + VBIOSEVT = "vbiosevt" + OS = "os" + NVSYSCON_CANOAS = "nvsyscon_canoas" + NVSYSCON_E551 = "nvsyscon_e551" + MAX6649R = "max6649r" + ADT7473S = "adt7473s" + UNKNOWN = "unknown" + + +class ThermalTarget(StrEnum): + """ + Thermal sensor targets. + """ + + NONE = "none" + GPU = "gpu" + MEMORY = "memory" + POWER_SUPPLY = "power_supply" + BOARD = "board" + VCD_BOARD = "vcd_board" + VCD_INLET = "vcd_inlet" + VCD_OUTLET = "vcd_outlet" + ALL = "all" + + +ThermalTarget.GPU.__doc__ = "GPU core temperature requires physical GPU handle." +ThermalTarget.MEMORY.__doc__ = "GPU memory temperature requires physical GPU handle." +ThermalTarget.POWER_SUPPLY.__doc__ = "GPU power supply temperature requires physical GPU handle." +ThermalTarget.BOARD.__doc__ = "GPU board ambient temperature requires physical GPU handle." +ThermalTarget.VCD_BOARD.__doc__ = "Visual Computing Device Board temperature requires visual computing device handle." +ThermalTarget.VCD_INLET.__doc__ = "Visual Computing Device Inlet temperature requires visual computing device handle." +ThermalTarget.VCD_OUTLET.__doc__ = "Visual Computing Device Outlet temperature requires visual computing device handle." + + +# DeviceArch values are derived from cuda.bindings.nvml at definition time, so +# the class can only be defined when nvml is importable. +try: + from cuda.bindings import nvml as _nvml + + try: + from cuda.bindings._internal._fast_enum import FastEnum as _FastEnum + except ImportError: + from enum import IntEnum as _FastEnum + + # This uses FastEnum instead of StrEnum because the ordering of the values is + # meaningful, e.g. Kepler "or later" + class DeviceArch(_FastEnum): + """ + Device architecture. + """ + + KEPLER = int(_nvml.DeviceArch.KEPLER) + MAXWELL = int(_nvml.DeviceArch.MAXWELL) + PASCAL = int(_nvml.DeviceArch.PASCAL) + VOLTA = int(_nvml.DeviceArch.VOLTA) + TURING = int(_nvml.DeviceArch.TURING) + AMPERE = int(_nvml.DeviceArch.AMPERE) + ADA = int(_nvml.DeviceArch.ADA) + HOPPER = int(_nvml.DeviceArch.HOPPER) + BLACKWELL = int(_nvml.DeviceArch.BLACKWELL) + UNKNOWN = int(_nvml.DeviceArch.UNKNOWN) + + __all__.append("DeviceArch") + + FieldId = _nvml.FieldId + + __all__.append("FieldId") + + del _nvml, _FastEnum + +except ImportError: + pass + + +del StrEnum diff --git a/cuda_core/cuda/core/texture/__init__.py b/cuda_core/cuda/core/texture/__init__.py new file mode 100644 index 00000000000..cd3e355f324 --- /dev/null +++ b/cuda_core/cuda/core/texture/__init__.py @@ -0,0 +1,40 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +"""Texture and surface APIs for ``cuda.core``. + +This subpackage groups the CUDA "Texture and Surface" object model — opaque +array storage and the bindless texture/surface handles built on it — under a +single namespace, mirroring how the CUDA driver documentation organizes them. + +Import these types from here, e.g.:: + + from cuda.core.texture import OpaqueArray, TextureObject, TextureObjectOptions + +The associated enumerations (:class:`~cuda.core.typing.ArrayFormatType`, +:class:`~cuda.core.typing.AddressModeType`, +:class:`~cuda.core.typing.FilterModeType`, +:class:`~cuda.core.typing.ReadModeType`) live in :mod:`cuda.core.typing` +alongside the other ``cuda.core`` enumerations. +""" + +from cuda.core.texture._array import OpaqueArray, OpaqueArrayOptions +from cuda.core.texture._mipmapped_array import MipmappedArray, MipmappedArrayOptions +from cuda.core.texture._surface import SurfaceObject +from cuda.core.texture._texture import ( + ResourceDescriptor, + TextureObject, + TextureObjectOptions, +) + +__all__ = [ + "MipmappedArray", + "MipmappedArrayOptions", + "OpaqueArray", + "OpaqueArrayOptions", + "ResourceDescriptor", + "SurfaceObject", + "TextureObject", + "TextureObjectOptions", +] diff --git a/cuda_core/cuda/core/texture/_array.pxd b/cuda_core/cuda/core/texture/_array.pxd new file mode 100644 index 00000000000..5e380c8885a --- /dev/null +++ b/cuda_core/cuda/core/texture/_array.pxd @@ -0,0 +1,27 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from cuda.bindings cimport cydriver +from cuda.core._resource_handles cimport OpaqueArrayHandle + + +cdef class OpaqueArray: + + cdef: + # Owning/non-owning + any parent (mipmap) dependency are encoded + # structurally in the C++ box behind this handle, not in Python state. + OpaqueArrayHandle _handle + tuple _shape # (w,), (w, h), or (w, h, d) + cydriver.CUarray_format _format + unsigned int _num_channels # 1, 2, or 4 + int _device_id + bint _surface_load_store + + cpdef close(self) + + +# Wrap an existing OpaqueArrayHandle as a OpaqueArray, querying the driver for the +# array's shape/format/channels/surface-flag metadata. Used by get_level and +# the graphics-interop _from_handle path. +cdef OpaqueArray _array_from_handle(OpaqueArrayHandle h, int device_id) diff --git a/cuda_core/cuda/core/texture/_array.pyi b/cuda_core/cuda/core/texture/_array.pyi new file mode 100644 index 00000000000..380c2fe1c10 --- /dev/null +++ b/cuda_core/cuda/core/texture/_array.pyi @@ -0,0 +1,196 @@ +# This file was generated by stubgen-pyx v0.2.6 from cuda_core/cuda/core/texture/_array.pyx + +from __future__ import annotations + +from dataclasses import dataclass + +import numpy +from cuda.bindings import cydriver +from cuda.core.typing import ArrayFormatType + + +@dataclass +class OpaqueArrayOptions: + """Options for :meth:`cuda.core.Device.create_opaque_array`. + + Attributes + ---------- + shape : tuple of int + ``(width,)``, ``(width, height)``, or ``(width, height, depth)`` in + elements. + format : ArrayFormatType, str, or numpy.dtype + Element format. Accepts an :class:`~cuda.core.typing.ArrayFormatType`, + a plain string (e.g. ``"float32"``), or a NumPy dtype object. + num_channels : int + Channels per element. Must be 1, 2, or 4. + is_surface_load_store : bool + If True, allocate with ``CUDA_ARRAY3D_SURFACE_LDST`` so the array can be + bound as a :class:`~cuda.core.texture.SurfaceObject` for kernel-side + writes. Default False. + + .. versionadded:: 1.1.0 + """ + shape: tuple[int, ...] + format: object + num_channels: int + is_surface_load_store: bool = False + + def __post_init__(self): + ... + +class OpaqueArray: + """An opaque, hardware-laid-out GPU allocation for texture/surface access. + + Distinct from :class:`Buffer`: a ``CUarray`` has no exposed device pointer + and can only be accessed from kernels through a :class:`TextureObject` or + :class:`SurfaceObject`. Its memory layout is chosen by the driver for 2D/3D + spatial locality. + + **Copy-only interop.** Because the layout is opaque and there is no linear + device pointer, a ``OpaqueArray`` cannot expose ``__cuda_array_interface__`` / + DLPack and cannot be shared zero-copy with NumPy, CuPy, numba-cuda, or + PyTorch. Moving data in or out is therefore always a copy: use + :meth:`copy_from` / :meth:`copy_to` against a linear :class:`Buffer` or a + host buffer-protocol object. There is no allocation helper — allocate the + linear :class:`Buffer` yourself (e.g. ``mr.allocate(arr.size_bytes, + stream=s)``) and copy. + + Construct via :meth:`cuda.core.Device.create_opaque_array`. Only plain + 1D/2D/3D allocations are supported in this initial version; layered/cubemap/ + sparse variants will follow once their shape semantics are settled. + + .. versionadded:: 1.1.0 + """ + + def close(self): + """Release this object's reference to the underlying ``CUarray``. + + Destruction (``cuArrayDestroy``) happens via the handle's deleter when + the last reference is dropped; for a non-owning handle (graphics interop + or a mipmap-level view) nothing is destroyed. Idempotent: a second call + (or destruction after ``close()``) is a no-op. + """ + + def __init__(self, *args, **kwargs): + ... + + @classmethod + def _from_handle(cls, handle: int, owning: bool, *, device_id=None): + """Wrap an externally-allocated ``CUarray``. + + Intended for graphics interop (``cuGraphicsSubResourceGetMappedArray``) + where the array is owned by the graphics API. With ``owning=False`` the + underlying ``CUarray`` is never destroyed by this object. Shape, format, + and channel count are queried from the driver. + """ + + @property + def handle(self): + """The underlying ``CUarray`` as an integer.""" + + @property + def shape(self): + """Allocation shape, in elements.""" + + @property + def format(self): + """The element :class:`~cuda.core.typing.ArrayFormatType`.""" + + @property + def num_channels(self): + """Channels per element (1, 2, or 4).""" + + @property + def element_bytes(self): + """Bytes per element (format size * channels).""" + + @property + def device(self): + """The :class:`Device` this array was allocated on.""" + + @property + def is_surface_load_store(self): + """True if this array was created with ``CUDA_ARRAY3D_SURFACE_LDST`` + and can be bound as a :class:`SurfaceObject`.""" + + def _extent_bytes(self): + """Return (width_bytes, height, depth) for cuMemcpy3D, with height/depth + normalized to >=1 for lower-rank arrays.""" + + def copy_from(self, src, *, stream) -> None: + """Copy a full-array's worth of data into this array. + + Parameters + ---------- + src : Buffer or buffer-protocol object + Source data. Must contain at least ``self.size_bytes`` bytes + of contiguous data. + stream : Stream or GraphBuilder + Stream to issue the copy on. A :class:`~cuda.core.graph.GraphBuilder` + is accepted so the copy can be captured into a graph. + """ + + def copy_to(self, dst, *, stream): + """Copy a full-array's worth of data out of this array. + + Parameters + ---------- + dst : Buffer or writable buffer-protocol object + Destination. Must have at least ``self.size_bytes`` bytes of + writable, contiguous space. + stream : Stream or GraphBuilder + Stream to issue the copy on. A :class:`~cuda.core.graph.GraphBuilder` + is accepted so the copy can be captured into a graph. + + Returns + ------- + The ``dst`` object, for parity with :meth:`Buffer.copy_to`. + """ + + @property + def size_bytes(self): + """Total bytes of array storage (``prod(shape) * element_bytes``).""" + + def __enter__(self): + ... + + def __exit__(self, exc_type, exc, tb): + ... + + def __repr__(self): + ... +_ARRAYFORMAT_TO_CU = {ArrayFormatType.UINT8: int(cydriver.CU_AD_FORMAT_UNSIGNED_INT8), ArrayFormatType.UINT16: int(cydriver.CU_AD_FORMAT_UNSIGNED_INT16), ArrayFormatType.UINT32: int(cydriver.CU_AD_FORMAT_UNSIGNED_INT32), ArrayFormatType.INT8: int(cydriver.CU_AD_FORMAT_SIGNED_INT8), ArrayFormatType.INT16: int(cydriver.CU_AD_FORMAT_SIGNED_INT16), ArrayFormatType.INT32: int(cydriver.CU_AD_FORMAT_SIGNED_INT32), ArrayFormatType.FLOAT16: int(cydriver.CU_AD_FORMAT_HALF), ArrayFormatType.FLOAT32: int(cydriver.CU_AD_FORMAT_FLOAT)} +_CU_TO_ARRAYFORMAT = {cu: fmt for fmt, cu in _ARRAYFORMAT_TO_CU.items()} +_NUMPY_DTYPE_TO_ARRAYFORMAT = {numpy.dtype(fmt.value): fmt for fmt in ArrayFormatType} +_FORMAT_ELEM_SIZE = {_ARRAYFORMAT_TO_CU[ArrayFormatType.UINT8]: 1, _ARRAYFORMAT_TO_CU[ArrayFormatType.INT8]: 1, _ARRAYFORMAT_TO_CU[ArrayFormatType.UINT16]: 2, _ARRAYFORMAT_TO_CU[ArrayFormatType.INT16]: 2, _ARRAYFORMAT_TO_CU[ArrayFormatType.FLOAT16]: 2, _ARRAYFORMAT_TO_CU[ArrayFormatType.UINT32]: 4, _ARRAYFORMAT_TO_CU[ArrayFormatType.INT32]: 4, _ARRAYFORMAT_TO_CU[ArrayFormatType.FLOAT32]: 4} + +def _normalize_array_format(format): + """Coerce ``format`` to an :class:`ArrayFormatType`. + + Accepts, in order of preference: + + * an :class:`ArrayFormatType`; + * a plain ``str`` naming one of its values (e.g. ``"float32"``); + * a NumPy dtype object (or anything ``numpy.dtype()`` accepts, such as + ``numpy.float32``) whose canonical dtype maps 1:1 to one of the eight + supported formats. + + Raises :class:`ValueError` on anything else.""" + +def _validate_format_channels(format, num_channels): + """Validate the ``(format, num_channels)`` pair shared by the array, + mipmap, and texture factories. Returns the normalized + :class:`ArrayFormatType`. Raises on an invalid combination.""" + +def _validate_array_shape(shape): + """Coerce ``shape`` to a tuple of ints and validate rank (1-3) and that + every extent is >= 1. Returns the normalized tuple.""" + +def _create_opaque_array(options): + """Allocate a new :class:`OpaqueArray` on the current device. + + Backs :meth:`cuda.core.Device.create_opaque_array`. ``options`` is an + :class:`OpaqueArrayOptions` (or a mapping accepted by it); it is validated + at construction, so ``shape`` is already a normalized tuple and ``format`` + an :class:`~cuda.core.typing.ArrayFormatType`. + """ \ No newline at end of file diff --git a/cuda_core/cuda/core/texture/_array.pyx b/cuda_core/cuda/core/texture/_array.pyx new file mode 100644 index 00000000000..0a1cb671daf --- /dev/null +++ b/cuda_core/cuda/core/texture/_array.pyx @@ -0,0 +1,552 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from __future__ import annotations + +cimport cpython +from libc.stdint cimport intptr_t +from libc.string cimport memset + +from cuda.bindings cimport cydriver +from cuda.core._memory._buffer cimport Buffer +from cuda.core._resource_handles cimport ( + OpaqueArrayHandle, + as_cu, + as_intptr, + create_array_handle, + create_array_handle_owning, + create_array_handle_ref, + get_last_error, +) +from cuda.core._stream cimport Stream, Stream_accept +from cuda.core._utils.cuda_utils cimport ( + HANDLE_RETURN, + _get_current_device_id, +) + +import numpy + +from dataclasses import dataclass + +from cuda.core._utils.cuda_utils import check_or_create_options +from cuda.core.typing import ArrayFormatType + + +# Bridge between the public ArrayFormatType StrEnum and the driver +# CUarray_format integer values. OpaqueArray stores the driver int internally +# (see ._format), so all conversions funnel through these two maps. +_ARRAYFORMAT_TO_CU = { + ArrayFormatType.UINT8: int(cydriver.CU_AD_FORMAT_UNSIGNED_INT8), + ArrayFormatType.UINT16: int(cydriver.CU_AD_FORMAT_UNSIGNED_INT16), + ArrayFormatType.UINT32: int(cydriver.CU_AD_FORMAT_UNSIGNED_INT32), + ArrayFormatType.INT8: int(cydriver.CU_AD_FORMAT_SIGNED_INT8), + ArrayFormatType.INT16: int(cydriver.CU_AD_FORMAT_SIGNED_INT16), + ArrayFormatType.INT32: int(cydriver.CU_AD_FORMAT_SIGNED_INT32), + ArrayFormatType.FLOAT16: int(cydriver.CU_AD_FORMAT_HALF), + ArrayFormatType.FLOAT32: int(cydriver.CU_AD_FORMAT_FLOAT), +} +_CU_TO_ARRAYFORMAT = {cu: fmt for fmt, cu in _ARRAYFORMAT_TO_CU.items()} + + +# Every ArrayFormatType value is spelled as a NumPy dtype name, so the eight +# formats map 1:1 to NumPy dtypes. This lets callers pass a dtype object (or +# anything numpy.dtype() accepts) instead of the enum, matching the precedent +# set by TensorMapDescriptorOptions.data_type. +_NUMPY_DTYPE_TO_ARRAYFORMAT = { + numpy.dtype(fmt.value): fmt for fmt in ArrayFormatType +} + + +# Bytes per element (single channel), keyed by the driver CUarray_format int. +_FORMAT_ELEM_SIZE = { + _ARRAYFORMAT_TO_CU[ArrayFormatType.UINT8]: 1, + _ARRAYFORMAT_TO_CU[ArrayFormatType.INT8]: 1, + _ARRAYFORMAT_TO_CU[ArrayFormatType.UINT16]: 2, + _ARRAYFORMAT_TO_CU[ArrayFormatType.INT16]: 2, + _ARRAYFORMAT_TO_CU[ArrayFormatType.FLOAT16]: 2, + _ARRAYFORMAT_TO_CU[ArrayFormatType.UINT32]: 4, + _ARRAYFORMAT_TO_CU[ArrayFormatType.INT32]: 4, + _ARRAYFORMAT_TO_CU[ArrayFormatType.FLOAT32]: 4, +} + + +def _normalize_array_format(format): + """Coerce ``format`` to an :class:`ArrayFormatType`. + + Accepts, in order of preference: + + * an :class:`ArrayFormatType`; + * a plain ``str`` naming one of its values (e.g. ``"float32"``); + * a NumPy dtype object (or anything ``numpy.dtype()`` accepts, such as + ``numpy.float32``) whose canonical dtype maps 1:1 to one of the eight + supported formats. + + Raises :class:`ValueError` on anything else.""" + if isinstance(format, ArrayFormatType): + return format + if isinstance(format, str): + try: + return ArrayFormatType(format) + except ValueError as e: + valid = ", ".join(repr(f.value) for f in ArrayFormatType) + raise ValueError( + f"format must be an ArrayFormatType or one of {{{valid}}}, got {format!r}" + ) from e + # Fall back to interpreting ``format`` as a NumPy dtype (dtype object, + # scalar type, etc.). Unknown dtypes are reported against the supported set. + try: + dt = numpy.dtype(format) + except TypeError as e: + raise ValueError( + f"format must be an ArrayFormatType, str, or NumPy dtype, got {format!r}" + ) from e + try: + return _NUMPY_DTYPE_TO_ARRAYFORMAT[dt] + except KeyError as e: + valid = ", ".join(repr(f.value) for f in ArrayFormatType) + raise ValueError( + f"NumPy dtype {dt!r} has no ArrayFormatType equivalent; " + f"supported formats: {{{valid}}}" + ) from e + + +def _validate_format_channels(format, num_channels): + """Validate the ``(format, num_channels)`` pair shared by the array, + mipmap, and texture factories. Returns the normalized + :class:`ArrayFormatType`. Raises on an invalid combination.""" + fmt = _normalize_array_format(format) + if isinstance(num_channels, bool) or num_channels not in (1, 2, 4): + raise ValueError(f"num_channels must be 1, 2, or 4, got {num_channels!r}") + return fmt + + +def _validate_array_shape(shape): + """Coerce ``shape`` to a tuple of ints and validate rank (1-3) and that + every extent is >= 1. Returns the normalized tuple.""" + try: + shape_t = tuple(int(s) for s in shape) + except TypeError as e: + raise TypeError(f"shape must be a tuple of ints, got {type(shape).__name__}") from e + if not 1 <= len(shape_t) <= 3: + raise ValueError(f"shape rank must be 1, 2, or 3, got {len(shape_t)}") + for i, dim in enumerate(shape_t): + if dim < 1: + raise ValueError(f"shape[{i}] must be >= 1, got {dim}") + return shape_t + + +@dataclass +class OpaqueArrayOptions: + """Options for :meth:`cuda.core.Device.create_opaque_array`. + + Attributes + ---------- + shape : tuple of int + ``(width,)``, ``(width, height)``, or ``(width, height, depth)`` in + elements. + format : ArrayFormatType, str, or numpy.dtype + Element format. Accepts an :class:`~cuda.core.typing.ArrayFormatType`, + a plain string (e.g. ``"float32"``), or a NumPy dtype object. + num_channels : int + Channels per element. Must be 1, 2, or 4. + is_surface_load_store : bool + If True, allocate with ``CUDA_ARRAY3D_SURFACE_LDST`` so the array can be + bound as a :class:`~cuda.core.texture.SurfaceObject` for kernel-side + writes. Default False. + + .. versionadded:: 1.1.0 + """ + + shape: tuple[int, ...] + format: object + num_channels: int + is_surface_load_store: bool = False + + def __post_init__(self): + self.format = _validate_format_channels(self.format, self.num_channels) + self.shape = _validate_array_shape(self.shape) + + +cdef void _fill_array_endpoint( + cydriver.CUDA_MEMCPY3D* p, OpaqueArray arr, bint is_src +) noexcept: + """Populate the src or dst array fields of a CUDA_MEMCPY3D struct.""" + if is_src: + p.srcMemoryType = cydriver.CU_MEMORYTYPE_ARRAY + p.srcArray = as_cu(arr._handle) + p.srcXInBytes = 0 + p.srcY = 0 + p.srcZ = 0 + else: + p.dstMemoryType = cydriver.CU_MEMORYTYPE_ARRAY + p.dstArray = as_cu(arr._handle) + p.dstXInBytes = 0 + p.dstY = 0 + p.dstZ = 0 + + +cdef int _fill_host_endpoint( + cydriver.CUDA_MEMCPY3D* p, + object obj, + bint is_src, + size_t width_bytes, + size_t height, + size_t required, + cpython.Py_buffer* pybuf_out, +) except -1: + """Populate src/dst host fields from a buffer-protocol ``obj``. + + Acquires a Py_buffer view; the caller is responsible for releasing it + (this function always returns with the view held when it returns 1). + """ + cdef int flags = cpython.PyBUF_SIMPLE + if not is_src: + flags |= cpython.PyBUF_WRITABLE + if cpython.PyObject_GetBuffer(obj, pybuf_out, flags) != 0: + raise TypeError( + f"Source/destination must be a Buffer or a contiguous " + f"buffer-protocol object, got {type(obj).__name__}" + ) + if pybuf_out.len < required: + cpython.PyBuffer_Release(pybuf_out) + raise ValueError( + f"Host buffer has {pybuf_out.len} bytes, smaller than the array " + f"extent ({required} bytes)" + ) + if is_src: + p.srcMemoryType = cydriver.CU_MEMORYTYPE_HOST + p.srcHost = pybuf_out.buf + p.srcPitch = width_bytes + p.srcHeight = height + p.srcXInBytes = 0 + p.srcY = 0 + p.srcZ = 0 + else: + p.dstMemoryType = cydriver.CU_MEMORYTYPE_HOST + p.dstHost = pybuf_out.buf + p.dstPitch = width_bytes + p.dstHeight = height + p.dstXInBytes = 0 + p.dstY = 0 + p.dstZ = 0 + return 1 + + +cdef int _fill_linear_endpoint( + cydriver.CUDA_MEMCPY3D* p, + object obj, + bint is_src, + size_t width_bytes, + size_t height, + size_t depth, + cpython.Py_buffer* pybuf_out, +) except -1: + """Populate the src or dst linear fields. Returns 1 if pybuf_out was + filled (caller must release it), 0 otherwise. + """ + cdef intptr_t ptr + cdef size_t required = width_bytes * height * depth + if isinstance(obj, Buffer): + if (obj).size < required: + raise ValueError( + f"Buffer size ({(obj).size} bytes) is smaller than " + f"the array extent ({required} bytes)" + ) + ptr = int((obj).handle) + if is_src: + p.srcMemoryType = cydriver.CU_MEMORYTYPE_DEVICE + p.srcDevice = ptr + p.srcPitch = width_bytes + p.srcHeight = height + p.srcXInBytes = 0 + p.srcY = 0 + p.srcZ = 0 + else: + p.dstMemoryType = cydriver.CU_MEMORYTYPE_DEVICE + p.dstDevice = ptr + p.dstPitch = width_bytes + p.dstHeight = height + p.dstXInBytes = 0 + p.dstY = 0 + p.dstZ = 0 + return 0 + return _fill_host_endpoint( + p, obj, is_src, width_bytes, height, required, pybuf_out + ) + + +cdef _copy3d(OpaqueArray arr, object other, Stream stream, bint to_array): + """Issue a full-array async 3D memcpy between ``arr`` and ``other``. + + Direction is determined by ``to_array``: True copies *into* arr, False + copies *out of* arr. ``stream`` must already be a concrete :class:`Stream` + (callers coerce via :func:`Stream_accept`). + """ + cdef cydriver.CUDA_MEMCPY3D params + cdef cpython.Py_buffer pybuf + cdef int got_buffer = 0 + cdef intptr_t stream_handle + cdef cydriver.CUstream c_stream + + memset(¶ms, 0, sizeof(params)) + width_bytes, height, depth = arr._extent_bytes() + params.WidthInBytes = width_bytes + params.Height = height + params.Depth = depth + + try: + if to_array: + got_buffer = _fill_linear_endpoint( + ¶ms, other, True, width_bytes, height, depth, &pybuf + ) + _fill_array_endpoint(¶ms, arr, False) + else: + _fill_array_endpoint(¶ms, arr, True) + got_buffer = _fill_linear_endpoint( + ¶ms, other, False, width_bytes, height, depth, &pybuf + ) + + stream_handle = int((stream).handle) + c_stream = stream_handle + with nogil: + HANDLE_RETURN(cydriver.cuMemcpy3DAsync(¶ms, c_stream)) + finally: + if got_buffer: + cpython.PyBuffer_Release(&pybuf) + + +cdef class OpaqueArray: + """An opaque, hardware-laid-out GPU allocation for texture/surface access. + + Distinct from :class:`Buffer`: a ``CUarray`` has no exposed device pointer + and can only be accessed from kernels through a :class:`TextureObject` or + :class:`SurfaceObject`. Its memory layout is chosen by the driver for 2D/3D + spatial locality. + + **Copy-only interop.** Because the layout is opaque and there is no linear + device pointer, a ``OpaqueArray`` cannot expose ``__cuda_array_interface__`` / + DLPack and cannot be shared zero-copy with NumPy, CuPy, numba-cuda, or + PyTorch. Moving data in or out is therefore always a copy: use + :meth:`copy_from` / :meth:`copy_to` against a linear :class:`Buffer` or a + host buffer-protocol object. There is no allocation helper — allocate the + linear :class:`Buffer` yourself (e.g. ``mr.allocate(arr.size_bytes, + stream=s)``) and copy. + + Construct via :meth:`cuda.core.Device.create_opaque_array`. Only plain + 1D/2D/3D allocations are supported in this initial version; layered/cubemap/ + sparse variants will follow once their shape semantics are settled. + + .. versionadded:: 1.1.0 + """ + + def __init__(self, *args, **kwargs): + raise RuntimeError( + "OpaqueArray cannot be instantiated directly. " + "Use Device.create_opaque_array()." + ) + + @classmethod + def _from_handle(cls, intptr_t handle, bint owning, *, device_id=None): + """Wrap an externally-allocated ``CUarray``. + + Intended for graphics interop (``cuGraphicsSubResourceGetMappedArray``) + where the array is owned by the graphics API. With ``owning=False`` the + underlying ``CUarray`` is never destroyed by this object. Shape, format, + and channel count are queried from the driver. + """ + cdef cydriver.CUarray raw = handle + cdef OpaqueArrayHandle h + if owning: + h = create_array_handle_owning(raw) + else: + h = create_array_handle_ref(raw) + cdef int dev = _get_current_device_id() if device_id is None else int(device_id) + return _array_from_handle(h, dev) + + @property + def handle(self): + """The underlying ``CUarray`` as an integer.""" + return as_intptr(self._handle) + + @property + def shape(self): + """Allocation shape, in elements.""" + return self._shape + + @property + def format(self): + """The element :class:`~cuda.core.typing.ArrayFormatType`.""" + return _CU_TO_ARRAYFORMAT[self._format] + + @property + def num_channels(self): + """Channels per element (1, 2, or 4).""" + return self._num_channels + + @property + def element_bytes(self): + """Bytes per element (format size * channels).""" + return _FORMAT_ELEM_SIZE[self._format] * self._num_channels + + @property + def device(self): + """The :class:`Device` this array was allocated on.""" + from cuda.core._device import Device + return Device(self._device_id) + + @property + def is_surface_load_store(self): + """True if this array was created with ``CUDA_ARRAY3D_SURFACE_LDST`` + and can be bound as a :class:`SurfaceObject`.""" + return self._surface_load_store + + def _extent_bytes(self): + """Return (width_bytes, height, depth) for cuMemcpy3D, with height/depth + normalized to >=1 for lower-rank arrays.""" + cdef int rank = len(self._shape) + cdef size_t w = self._shape[0] * ( + _FORMAT_ELEM_SIZE[self._format] * self._num_channels + ) + cdef size_t h = (self._shape[1] if rank >= 2 else 1) + cdef size_t d = (self._shape[2] if rank >= 3 else 1) + return w, h, d + + def copy_from(self, src, *, stream) -> None: + """Copy a full-array's worth of data into this array. + + Parameters + ---------- + src : Buffer or buffer-protocol object + Source data. Must contain at least ``self.size_bytes`` bytes + of contiguous data. + stream : Stream or GraphBuilder + Stream to issue the copy on. A :class:`~cuda.core.graph.GraphBuilder` + is accepted so the copy can be captured into a graph. + """ + _copy3d(self, src, Stream_accept(stream), to_array=True) + + def copy_to(self, dst, *, stream): + """Copy a full-array's worth of data out of this array. + + Parameters + ---------- + dst : Buffer or writable buffer-protocol object + Destination. Must have at least ``self.size_bytes`` bytes of + writable, contiguous space. + stream : Stream or GraphBuilder + Stream to issue the copy on. A :class:`~cuda.core.graph.GraphBuilder` + is accepted so the copy can be captured into a graph. + + Returns + ------- + The ``dst`` object, for parity with :meth:`Buffer.copy_to`. + """ + _copy3d(self, dst, Stream_accept(stream), to_array=False) + return dst + + @property + def size_bytes(self): + """Total bytes of array storage (``prod(shape) * element_bytes``).""" + cdef size_t n = 1 + for s in self._shape: + n *= s + return n * (_FORMAT_ELEM_SIZE[self._format] * self._num_channels) + + cpdef close(self): + """Release this object's reference to the underlying ``CUarray``. + + Destruction (``cuArrayDestroy``) happens via the handle's deleter when + the last reference is dropped; for a non-owning handle (graphics interop + or a mipmap-level view) nothing is destroyed. Idempotent: a second call + (or destruction after ``close()``) is a no-op. + """ + self._handle.reset() + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc, tb): + self.close() + + def __repr__(self): + return ( + f"OpaqueArray(shape={self._shape}, " + f"format={_CU_TO_ARRAYFORMAT[self._format].name}, " + f"num_channels={self._num_channels})" + ) + + +cdef OpaqueArray _array_from_handle(OpaqueArrayHandle h, int device_id): + """Wrap an existing OpaqueArrayHandle as a OpaqueArray, querying the driver for the + array's shape/format/channels/surface-flag metadata. + + Any owning/non-owning semantics and parent (mipmap) dependency are already + captured structurally inside ``h``'s C++ box. + """ + if not h: + HANDLE_RETURN(get_last_error()) + + cdef OpaqueArray self = OpaqueArray.__new__(OpaqueArray) + self._handle = h + self._device_id = device_id + + cdef cydriver.CUDA_ARRAY3D_DESCRIPTOR desc + cdef cydriver.CUarray raw = as_cu(h) + with nogil: + HANDLE_RETURN(cydriver.cuArray3DGetDescriptor(&desc, raw)) + + if desc.Depth > 0: + self._shape = (int(desc.Width), int(desc.Height), int(desc.Depth)) + elif desc.Height > 0: + self._shape = (int(desc.Width), int(desc.Height)) + else: + self._shape = (int(desc.Width),) + self._format = desc.Format + self._num_channels = desc.NumChannels + self._surface_load_store = bool(desc.Flags & cydriver.CUDA_ARRAY3D_SURFACE_LDST) + return self + + +def _create_opaque_array(options): + """Allocate a new :class:`OpaqueArray` on the current device. + + Backs :meth:`cuda.core.Device.create_opaque_array`. ``options`` is an + :class:`OpaqueArrayOptions` (or a mapping accepted by it); it is validated + at construction, so ``shape`` is already a normalized tuple and ``format`` + an :class:`~cuda.core.typing.ArrayFormatType`. + """ + cdef object opts = check_or_create_options( + OpaqueArrayOptions, options, "Opaque array options" + ) + shape_t = opts.shape + + cdef cydriver.CUarray_format c_format = _ARRAYFORMAT_TO_CU[opts.format] + cdef cydriver.CUDA_ARRAY3D_DESCRIPTOR desc3d + cdef int rank = len(shape_t) + cdef unsigned int flags = ( + cydriver.CUDA_ARRAY3D_SURFACE_LDST if opts.is_surface_load_store else 0 + ) + + # cuArray3DCreate handles 1D/2D/3D uniformly (Height/Depth 0 sentinels), + # so a single descriptor + create_array_handle covers every shape. + memset(&desc3d, 0, sizeof(desc3d)) + desc3d.Width = shape_t[0] + desc3d.Height = (shape_t[1] if rank >= 2 else 0) + desc3d.Depth = (shape_t[2] if rank >= 3 else 0) + desc3d.Format = c_format + desc3d.NumChannels = opts.num_channels + desc3d.Flags = flags + + cdef OpaqueArrayHandle h = create_array_handle(desc3d) + if not h: + HANDLE_RETURN(get_last_error()) + + cdef OpaqueArray self = OpaqueArray.__new__(OpaqueArray) + self._handle = h + self._shape = shape_t + self._format = c_format + self._num_channels = opts.num_channels + self._surface_load_store = bool(opts.is_surface_load_store) + self._device_id = _get_current_device_id() + return self diff --git a/cuda_core/cuda/core/texture/_mipmapped_array.pxd b/cuda_core/cuda/core/texture/_mipmapped_array.pxd new file mode 100644 index 00000000000..be0d8f00966 --- /dev/null +++ b/cuda_core/cuda/core/texture/_mipmapped_array.pxd @@ -0,0 +1,20 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from cuda.bindings cimport cydriver +from cuda.core._resource_handles cimport MipmappedArrayHandle + + +cdef class MipmappedArray: + + cdef: + MipmappedArrayHandle _handle + tuple _shape # (w,), (w, h), or (w, h, d) + cydriver.CUarray_format _format + unsigned int _num_channels # 1, 2, or 4 + unsigned int _num_levels + int _device_id + bint _surface_load_store + + cpdef close(self) diff --git a/cuda_core/cuda/core/texture/_mipmapped_array.pyi b/cuda_core/cuda/core/texture/_mipmapped_array.pyi new file mode 100644 index 00000000000..db4413dbaf4 --- /dev/null +++ b/cuda_core/cuda/core/texture/_mipmapped_array.pyi @@ -0,0 +1,131 @@ +# This file was generated by stubgen-pyx v0.2.6 from cuda_core/cuda/core/texture/_mipmapped_array.pyx + +from __future__ import annotations + +from dataclasses import dataclass + + +@dataclass +class MipmappedArrayOptions: + """Options for :meth:`cuda.core.Device.create_mipmapped_array`. + + Attributes + ---------- + shape : tuple of int + ``(width,)``, ``(width, height)``, or ``(width, height, depth)`` in + elements, for the base (level 0) mip. + format : ArrayFormatType, str, or numpy.dtype + Element format. Accepts an :class:`~cuda.core.typing.ArrayFormatType`, + a plain string (e.g. ``"float32"``), or a NumPy dtype object. + num_channels : int + Channels per element. Must be 1, 2, or 4. + num_levels : int + Number of mip levels to allocate; must be >= 1. The driver caps this at + the log2 of the largest dimension; passing a larger value yields a + driver error. + is_surface_load_store : bool + If True, allocate with ``CUDA_ARRAY3D_SURFACE_LDST`` so individual + levels (obtained via :meth:`MipmappedArray.get_level`) can be bound as + a :class:`~cuda.core.texture.SurfaceObject` for kernel-side writes. + Default False. + + .. versionadded:: 1.1.0 + """ + shape: tuple[int, ...] + format: object + num_channels: int + num_levels: int + is_surface_load_store: bool = False + + def __post_init__(self): + ... + +class MipmappedArray: + """A mipmapped CUDA array for texture/surface access across levels. + + Wraps ``CUmipmappedArray``. Each mip level is a distinct, hardware-laid-out + allocation accessible only via a :class:`TextureObject` (or by retrieving + the level's :class:`OpaqueArray` and binding it as a :class:`SurfaceObject`). + Destroying the :class:`MipmappedArray` destroys all level arrays + implicitly, so the :class:`OpaqueArray` instances returned by :meth:`get_level` + are non-owning and hold a strong reference back to their parent. + + Construct via :meth:`cuda.core.Device.create_mipmapped_array`. + + .. versionadded:: 1.1.0 + """ + + def close(self): + """Release this object's reference to the underlying ``CUmipmappedArray``. + + Destruction (``cuMipmappedArrayDestroy``) happens via the handle's + deleter when the last reference is dropped. A level :class:`OpaqueArray` + from :meth:`get_level` holds its own reference to this mipmap's storage, + so it stays valid until both it and this object are released. Idempotent. + """ + + def __init__(self, *args, **kwargs): + ... + + def get_level(self, level): + """Return a non-owning :class:`OpaqueArray` view of the given mip level. + + Parameters + ---------- + level : int + Mip level index in ``[0, num_levels)``. + + Returns + ------- + OpaqueArray + A non-owning :class:`OpaqueArray` wrapping the level's ``CUarray``. + The :class:`MipmappedArray` is kept alive for the lifetime of the + returned :class:`OpaqueArray`; the underlying storage is released only + when this :class:`MipmappedArray` is destroyed. + """ + + @property + def handle(self): + """The underlying ``CUmipmappedArray`` as an integer.""" + + @property + def shape(self): + """Base-level (level 0) allocation shape, in elements.""" + + @property + def format(self): + """The element :class:`~cuda.core.typing.ArrayFormatType`.""" + + @property + def num_channels(self): + """Channels per element (1, 2, or 4).""" + + @property + def num_levels(self): + """Number of mip levels.""" + + @property + def is_surface_load_store(self): + """True if this mipmap (and each of its levels) was created with + ``CUDA_ARRAY3D_SURFACE_LDST`` and can back a :class:`SurfaceObject`.""" + + @property + def device(self): + """The :class:`Device` this mipmap was allocated on.""" + + def __enter__(self): + ... + + def __exit__(self, exc_type, exc, tb): + ... + + def __repr__(self): + ... + +def _create_mipmapped_array(options): + """Allocate a new :class:`MipmappedArray` on the current device. + + Backs :meth:`cuda.core.Device.create_mipmapped_array`. ``options`` is a + :class:`MipmappedArrayOptions` (or a mapping accepted by it); its fields are + validated at construction. + """ \ No newline at end of file diff --git a/cuda_core/cuda/core/texture/_mipmapped_array.pyx b/cuda_core/cuda/core/texture/_mipmapped_array.pyx new file mode 100644 index 00000000000..3f151f7bb9f --- /dev/null +++ b/cuda_core/cuda/core/texture/_mipmapped_array.pyx @@ -0,0 +1,233 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from __future__ import annotations + +from libc.string cimport memset + +from cuda.bindings cimport cydriver +from cuda.core.texture._array cimport _array_from_handle +from cuda.core.texture._array import ( + _ARRAYFORMAT_TO_CU, + _CU_TO_ARRAYFORMAT, + _validate_array_shape, + _validate_format_channels, +) +from cuda.core._resource_handles cimport ( + OpaqueArrayHandle, + MipmappedArrayHandle, + as_intptr, + create_array_level_handle, + create_mipmapped_array_handle, + get_last_error, +) +from cuda.core._utils.cuda_utils cimport ( + HANDLE_RETURN, + _get_current_device_id, +) + +from dataclasses import dataclass + +from cuda.core._utils.cuda_utils import check_or_create_options + + +@dataclass +class MipmappedArrayOptions: + """Options for :meth:`cuda.core.Device.create_mipmapped_array`. + + Attributes + ---------- + shape : tuple of int + ``(width,)``, ``(width, height)``, or ``(width, height, depth)`` in + elements, for the base (level 0) mip. + format : ArrayFormatType, str, or numpy.dtype + Element format. Accepts an :class:`~cuda.core.typing.ArrayFormatType`, + a plain string (e.g. ``"float32"``), or a NumPy dtype object. + num_channels : int + Channels per element. Must be 1, 2, or 4. + num_levels : int + Number of mip levels to allocate; must be >= 1. The driver caps this at + the log2 of the largest dimension; passing a larger value yields a + driver error. + is_surface_load_store : bool + If True, allocate with ``CUDA_ARRAY3D_SURFACE_LDST`` so individual + levels (obtained via :meth:`MipmappedArray.get_level`) can be bound as + a :class:`~cuda.core.texture.SurfaceObject` for kernel-side writes. + Default False. + + .. versionadded:: 1.1.0 + """ + + shape: tuple[int, ...] + format: object + num_channels: int + num_levels: int + is_surface_load_store: bool = False + + def __post_init__(self): + self.format = _validate_format_channels(self.format, self.num_channels) + self.shape = _validate_array_shape(self.shape) + self.num_levels = int(self.num_levels) + if self.num_levels < 1: + raise ValueError(f"num_levels must be >= 1, got {self.num_levels}") + + +cdef class MipmappedArray: + """A mipmapped CUDA array for texture/surface access across levels. + + Wraps ``CUmipmappedArray``. Each mip level is a distinct, hardware-laid-out + allocation accessible only via a :class:`TextureObject` (or by retrieving + the level's :class:`OpaqueArray` and binding it as a :class:`SurfaceObject`). + Destroying the :class:`MipmappedArray` destroys all level arrays + implicitly, so the :class:`OpaqueArray` instances returned by :meth:`get_level` + are non-owning and hold a strong reference back to their parent. + + Construct via :meth:`cuda.core.Device.create_mipmapped_array`. + + .. versionadded:: 1.1.0 + """ + + def __init__(self, *args, **kwargs): + raise RuntimeError( + "MipmappedArray cannot be instantiated directly. " + "Use Device.create_mipmapped_array()." + ) + + def get_level(self, level): + """Return a non-owning :class:`OpaqueArray` view of the given mip level. + + Parameters + ---------- + level : int + Mip level index in ``[0, num_levels)``. + + Returns + ------- + OpaqueArray + A non-owning :class:`OpaqueArray` wrapping the level's ``CUarray``. + The :class:`MipmappedArray` is kept alive for the lifetime of the + returned :class:`OpaqueArray`; the underlying storage is released only + when this :class:`MipmappedArray` is destroyed. + """ + lvl = int(level) + if lvl < 0: + raise ValueError(f"level must be >= 0, got {lvl}") + if lvl >= self._num_levels: + raise ValueError( + f"level ({lvl}) must be < num_levels ({self._num_levels})" + ) + + cdef OpaqueArrayHandle h_level = create_array_level_handle(self._handle, lvl) + if not h_level: + HANDLE_RETURN(get_last_error()) + # The returned OpaqueArray is non-owning; its C++ box embeds this mipmap's + # handle, so the parent's storage structurally outlives the level view + # (no Python parent reference needed). + return _array_from_handle(h_level, self._device_id) + + @property + def handle(self): + """The underlying ``CUmipmappedArray`` as an integer.""" + return as_intptr(self._handle) + + @property + def shape(self): + """Base-level (level 0) allocation shape, in elements.""" + return self._shape + + @property + def format(self): + """The element :class:`~cuda.core.typing.ArrayFormatType`.""" + return _CU_TO_ARRAYFORMAT[self._format] + + @property + def num_channels(self): + """Channels per element (1, 2, or 4).""" + return self._num_channels + + @property + def num_levels(self): + """Number of mip levels.""" + return int(self._num_levels) + + @property + def is_surface_load_store(self): + """True if this mipmap (and each of its levels) was created with + ``CUDA_ARRAY3D_SURFACE_LDST`` and can back a :class:`SurfaceObject`.""" + return self._surface_load_store + + @property + def device(self): + """The :class:`Device` this mipmap was allocated on.""" + from cuda.core._device import Device + return Device(self._device_id) + + cpdef close(self): + """Release this object's reference to the underlying ``CUmipmappedArray``. + + Destruction (``cuMipmappedArrayDestroy``) happens via the handle's + deleter when the last reference is dropped. A level :class:`OpaqueArray` + from :meth:`get_level` holds its own reference to this mipmap's storage, + so it stays valid until both it and this object are released. Idempotent. + """ + self._handle.reset() + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc, tb): + self.close() + + def __repr__(self): + return ( + f"MipmappedArray(shape={self._shape}, " + f"format={_CU_TO_ARRAYFORMAT[self._format].name}, " + f"num_channels={self._num_channels}, " + f"num_levels={self._num_levels})" + ) + + +def _create_mipmapped_array(options): + """Allocate a new :class:`MipmappedArray` on the current device. + + Backs :meth:`cuda.core.Device.create_mipmapped_array`. ``options`` is a + :class:`MipmappedArrayOptions` (or a mapping accepted by it); its fields are + validated at construction. + """ + cdef object opts = check_or_create_options( + MipmappedArrayOptions, options, "Mipmapped array options" + ) + shape_t = opts.shape + + cdef cydriver.CUarray_format c_format = _ARRAYFORMAT_TO_CU[opts.format] + cdef cydriver.CUDA_ARRAY3D_DESCRIPTOR desc3d + cdef int rank = len(shape_t) + cdef unsigned int flags = ( + cydriver.CUDA_ARRAY3D_SURFACE_LDST if opts.is_surface_load_store else 0 + ) + cdef unsigned int c_levels = opts.num_levels + + # Mipmap creation uses the 3D descriptor regardless of rank; lower-rank + # shapes use Height=0/Depth=0 sentinels, matching cuArray3DCreate. + memset(&desc3d, 0, sizeof(desc3d)) + desc3d.Width = shape_t[0] + desc3d.Height = (shape_t[1] if rank >= 2 else 0) + desc3d.Depth = (shape_t[2] if rank >= 3 else 0) + desc3d.Format = c_format + desc3d.NumChannels = opts.num_channels + desc3d.Flags = flags + + cdef MipmappedArrayHandle h = create_mipmapped_array_handle(desc3d, c_levels) + if not h: + HANDLE_RETURN(get_last_error()) + + cdef MipmappedArray self = MipmappedArray.__new__(MipmappedArray) + self._handle = h + self._shape = shape_t + self._format = c_format + self._num_channels = opts.num_channels + self._num_levels = opts.num_levels + self._surface_load_store = bool(opts.is_surface_load_store) + self._device_id = _get_current_device_id() + return self diff --git a/cuda_core/cuda/core/texture/_surface.pxd b/cuda_core/cuda/core/texture/_surface.pxd new file mode 100644 index 00000000000..d6702061e79 --- /dev/null +++ b/cuda_core/cuda/core/texture/_surface.pxd @@ -0,0 +1,18 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from cuda.bindings cimport cydriver +from cuda.core._resource_handles cimport SurfObjectHandle + + +cdef class SurfaceObject: + + cdef: + # The backing OpaqueArray is kept alive structurally by the C++ box behind + # this handle, not by _source_ref. + SurfObjectHandle _handle + object _source_ref # ResourceDescriptor, retained for introspection + int _device_id + + cpdef close(self) diff --git a/cuda_core/cuda/core/texture/_surface.pyi b/cuda_core/cuda/core/texture/_surface.pyi new file mode 100644 index 00000000000..977268abd5f --- /dev/null +++ b/cuda_core/cuda/core/texture/_surface.pyi @@ -0,0 +1,62 @@ +# This file was generated by stubgen-pyx v0.2.6 from cuda_core/cuda/core/texture/_surface.pyx + +from __future__ import annotations + + +class SurfaceObject: + """A bindless surface handle for kernel-side typed load/store. + + Wraps ``cuSurfObjectCreate``. Unlike a :class:`TextureObject`, a surface + has no sampling state (no filtering, no addressing modes, no normalization); + kernels read and write through it using integer pixel coordinates. + + The backing :class:`OpaqueArray` must have been created with + ``is_surface_load_store=True`` and is kept alive for the lifetime of this + object to prevent dangling handles. + + Construct via :meth:`cuda.core.Device.create_surface_object`. Passes to + kernels as a 64-bit handle (via the ``handle`` property). + + .. versionadded:: 1.1.0 + """ + + def close(self): + """Release this object's reference to the underlying ``CUsurfObject``. + + Destruction (``cuSurfObjectDestroy``) and release of the backing array + happen via the handle's deleter when the last reference is dropped. + Idempotent. + """ + + def __init__(self, *args, **kwargs): + ... + + @property + def handle(self): + """The underlying ``CUsurfObject`` as an integer (64-bit kernel arg).""" + + @property + def resource(self): + """The :class:`ResourceDescriptor` this surface was built from.""" + + @property + def device(self): + ... + + def __enter__(self): + ... + + def __exit__(self, exc_type, exc, tb): + ... + + def __repr__(self): + ... + +def _create_surface_object(resource): + """Create a :class:`SurfaceObject` on the current device. + + Backs :meth:`cuda.core.Device.create_surface_object`. ``resource`` must be a + :class:`ResourceDescriptor` wrapping an :class:`OpaqueArray` allocated with + ``is_surface_load_store=True``; linear/pitch2d resources are not valid + surface backings. + """ \ No newline at end of file diff --git a/cuda_core/cuda/core/texture/_surface.pyx b/cuda_core/cuda/core/texture/_surface.pyx new file mode 100644 index 00000000000..ac61fddd357 --- /dev/null +++ b/cuda_core/cuda/core/texture/_surface.pyx @@ -0,0 +1,122 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from __future__ import annotations + +from libc.string cimport memset + +from cuda.bindings cimport cydriver +from cuda.core.texture._array cimport OpaqueArray +from cuda.core._resource_handles cimport ( + SurfObjectHandle, + as_cu, + as_intptr, + create_surf_object_handle, + get_last_error, +) +from cuda.core.texture._texture import ResourceDescriptor +from cuda.core._utils.cuda_utils cimport ( + HANDLE_RETURN, + _get_current_device_id, +) + + +cdef class SurfaceObject: + """A bindless surface handle for kernel-side typed load/store. + + Wraps ``cuSurfObjectCreate``. Unlike a :class:`TextureObject`, a surface + has no sampling state (no filtering, no addressing modes, no normalization); + kernels read and write through it using integer pixel coordinates. + + The backing :class:`OpaqueArray` must have been created with + ``is_surface_load_store=True`` and is kept alive for the lifetime of this + object to prevent dangling handles. + + Construct via :meth:`cuda.core.Device.create_surface_object`. Passes to + kernels as a 64-bit handle (via the ``handle`` property). + + .. versionadded:: 1.1.0 + """ + + def __init__(self, *args, **kwargs): + raise RuntimeError( + "SurfaceObject cannot be instantiated directly. " + "Use Device.create_surface_object()." + ) + + @property + def handle(self): + """The underlying ``CUsurfObject`` as an integer (64-bit kernel arg).""" + return as_intptr(self._handle) + + @property + def resource(self): + """The :class:`ResourceDescriptor` this surface was built from.""" + return self._source_ref + + @property + def device(self): + from cuda.core._device import Device + return Device(self._device_id) + + cpdef close(self): + """Release this object's reference to the underlying ``CUsurfObject``. + + Destruction (``cuSurfObjectDestroy``) and release of the backing array + happen via the handle's deleter when the last reference is dropped. + Idempotent. + """ + self._handle.reset() + self._source_ref = None + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc, tb): + self.close() + + def __repr__(self): + return f"SurfaceObject(handle=0x{as_intptr(self._handle):x})" + + +def _create_surface_object(resource): + """Create a :class:`SurfaceObject` on the current device. + + Backs :meth:`cuda.core.Device.create_surface_object`. ``resource`` must be a + :class:`ResourceDescriptor` wrapping an :class:`OpaqueArray` allocated with + ``is_surface_load_store=True``; linear/pitch2d resources are not valid + surface backings. + """ + if not isinstance(resource, ResourceDescriptor): + raise TypeError( + f"resource must be a ResourceDescriptor, got " + f"{type(resource).__name__}" + ) + if resource.kind != "array": + raise ValueError( + f"SurfaceObject requires an array-backed ResourceDescriptor, " + f"got kind={resource.kind!r}" + ) + + cdef OpaqueArray arr = resource.source + if not arr.is_surface_load_store: + raise ValueError( + "OpaqueArray must be created with is_surface_load_store=True to be " + "bound as a SurfaceObject" + ) + + cdef cydriver.CUDA_RESOURCE_DESC res_desc + memset(&res_desc, 0, sizeof(res_desc)) + res_desc.resType = cydriver.CU_RESOURCE_TYPE_ARRAY + res_desc.res.array.hArray = as_cu(arr._handle) + + cdef SurfObjectHandle h = create_surf_object_handle(res_desc, arr._handle) + if not h: + HANDLE_RETURN(get_last_error()) + + cdef SurfaceObject self = SurfaceObject.__new__(SurfaceObject) + self._handle = h + self._source_ref = resource + self._device_id = _get_current_device_id() + return self diff --git a/cuda_core/cuda/core/texture/_texture.pxd b/cuda_core/cuda/core/texture/_texture.pxd new file mode 100644 index 00000000000..6d0871fe848 --- /dev/null +++ b/cuda_core/cuda/core/texture/_texture.pxd @@ -0,0 +1,19 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from cuda.bindings cimport cydriver +from cuda.core._resource_handles cimport TexObjectHandle + + +cdef class TextureObject: + + cdef: + # The backing resource (array / mipmap / device pointer) is kept alive + # structurally by the C++ box behind this handle, not by _source_ref. + TexObjectHandle _handle + object _source_ref # ResourceDescriptor, retained for introspection + object _options # original TextureObjectOptions for introspection + int _device_id + + cpdef close(self) diff --git a/cuda_core/cuda/core/texture/_texture.pyi b/cuda_core/cuda/core/texture/_texture.pyi new file mode 100644 index 00000000000..7840585bb4d --- /dev/null +++ b/cuda_core/cuda/core/texture/_texture.pyi @@ -0,0 +1,257 @@ +# This file was generated by stubgen-pyx v0.2.6 from cuda_core/cuda/core/texture/_texture.pyx + +from __future__ import annotations + +from dataclasses import dataclass + +from cuda.bindings import cydriver +from cuda.core.typing import AddressModeType, FilterModeType, ReadModeType + + +class ResourceDescriptor: + """Describes the memory backing a :class:`TextureObject`. + + Construct via the ``from_*`` classmethods: + + - :meth:`from_opaque_array` wraps a :class:`OpaqueArray` (works for both + :class:`TextureObject` and :class:`SurfaceObject`). + - :meth:`from_mipmapped_array` wraps a :class:`MipmappedArray` for mipmapped + sampling (texture only, not surface). + - :meth:`from_linear` wraps a :class:`Buffer` as a typed 1D fetch. Texture + objects built from a linear resource do not support filtering, + normalized coordinates, or addressing modes. + - :meth:`from_pitch2d` wraps a :class:`Buffer` as a row-pitched 2D image. + Supports filtering and 2D addressing, but only 2D access. + + Linear and pitch2D resources cannot back a :class:`SurfaceObject` — those + require an :class:`OpaqueArray` allocated with ``is_surface_load_store=True``. + + .. versionadded:: 1.1.0 + """ + __slots__ = ('_kind', '_source', '_format', '_num_channels', '_size_bytes', '_width', '_height', '_pitch_bytes') + + def __init__(self): + ... + + @classmethod + def from_opaque_array(cls, array): + """Build a resource descriptor backed by a :class:`OpaqueArray`.""" + + @classmethod + def from_mipmapped_array(cls, mipmapped_array): + """Build a resource descriptor backed by a :class:`MipmappedArray`. + + Suitable for binding to a :class:`TextureObject` for mipmapped + sampling. Not valid as a :class:`SurfaceObject` backing: surfaces + require a single :class:`OpaqueArray` level (obtain via + :meth:`MipmappedArray.get_level`). + """ + + @classmethod + def from_linear(cls, buffer, *, format, num_channels, size_bytes=None): + """Build a resource descriptor for a linear (typed 1D) texture fetch. + + Parameters + ---------- + buffer : Buffer + Device-memory backing. Must remain alive for the lifetime of any + :class:`TextureObject` built from this descriptor. + format : ArrayFormatType, str, or numpy.dtype + Element format. Accepts an :class:`~cuda.core.typing.ArrayFormatType`, + a plain string (e.g. ``"float32"``), or a NumPy dtype object. + num_channels : int + Channels per element. Must be 1, 2, or 4. + size_bytes : int, optional + Bytes of ``buffer`` to bind. Defaults to ``buffer.size``. Must not + exceed it. + + Notes + ----- + Texture objects built from a linear resource ignore the + :class:`TextureObjectOptions` addressing/filtering fields — kernels read + through a typed 1D fetch with bounds checking only. + """ + + @classmethod + def from_pitch2d(cls, buffer, *, format, num_channels, width, height, pitch_bytes): + """Build a resource descriptor for a row-pitched 2D image. + + Parameters + ---------- + buffer : Buffer + Device-memory backing. Must remain alive for the lifetime of any + :class:`TextureObject` built from this descriptor. + format : ArrayFormatType, str, or numpy.dtype + Element format. Accepts an :class:`~cuda.core.typing.ArrayFormatType`, + a plain string (e.g. ``"float32"``), or a NumPy dtype object. + num_channels : int + Channels per element. Must be 1, 2, or 4. + width : int + Image width, in elements. + height : int + Image height, in rows. + pitch_bytes : int + Distance between consecutive rows, in bytes. Must be at least + ``width * format_size * num_channels`` and meet the driver's + ``CU_DEVICE_ATTRIBUTE_TEXTURE_PITCH_ALIGNMENT``. + """ + + @property + def kind(self): + ... + + @property + def source(self): + ... + + @property + def format(self): + """The element :class:`~cuda.core.typing.ArrayFormatType` (``None`` for array-backed).""" + + @property + def num_channels(self): + """Channels per element (``None`` for array-backed).""" + + @property + def size_bytes(self): + """Bytes bound for a linear resource (``None`` for other kinds).""" + + @property + def width(self): + """Pitch2D image width, in elements (``None`` for other kinds).""" + + @property + def height(self): + """Pitch2D image height, in rows (``None`` for other kinds).""" + + @property + def pitch_bytes(self): + """Pitch2D row pitch, in bytes (``None`` for other kinds).""" + + def __repr__(self): + ... + +@dataclass +class TextureObjectOptions: + """Sampling state for a :class:`TextureObject` (mirrors ``CUDA_TEXTURE_DESC``). + + Attributes + ---------- + address_mode : AddressModeType or tuple of AddressModeType + Boundary behavior per axis. May be a single + :class:`~cuda.core.typing.AddressModeType` (applied to all axes) or a + tuple of 1-3 entries (one per dimension). Plain strings are accepted. + filter_mode : FilterModeType + Texel sampling mode. Default ``POINT``. Plain strings are accepted. + read_mode : ReadModeType + How sampled integer values are returned. Default ``ELEMENT_TYPE``. + Plain strings are accepted. + normalized_coords : bool + If True, coordinates are in ``[0, 1]`` instead of pixel indices. + srgb : bool + If True, perform sRGB → linear conversion on read (8-bit formats only). + disable_trilinear_optimization : bool + If True, request exact trilinear filtering. + seamless_cubemap : bool + If True, enable seamless cubemap edge filtering. + max_anisotropy : int + Maximum anisotropy; 0 disables anisotropic filtering. + mipmap_filter_mode : FilterModeType + Filtering between mipmap levels. Default ``POINT``. Plain strings are + accepted. + mipmap_level_bias : float + min_mipmap_level_clamp : float + max_mipmap_level_clamp : float + border_color : tuple of float or None + 4-tuple used when ``address_mode`` includes ``BORDER``; ``None`` means + zero. + + .. versionadded:: 1.1.0 + """ + address_mode: AddressModeType | str | tuple[AddressModeType | str, ...] = AddressModeType.CLAMP + filter_mode: FilterModeType | str = FilterModeType.POINT + read_mode: ReadModeType | str = ReadModeType.ELEMENT_TYPE + normalized_coords: bool = False + srgb: bool = False + disable_trilinear_optimization: bool = False + seamless_cubemap: bool = False + max_anisotropy: int = 0 + mipmap_filter_mode: FilterModeType | str = FilterModeType.POINT + mipmap_level_bias: float = 0.0 + min_mipmap_level_clamp: float = 0.0 + max_mipmap_level_clamp: float = 0.0 + border_color: tuple[float, ...] | None = None + + def __post_init__(self): + ... + +class TextureObject: + """A bindless texture handle for kernel-side sampled reads. + + Wraps ``cuTexObjectCreate``. The underlying memory resource (e.g. the + :class:`OpaqueArray` referenced by the descriptor) is kept alive for the + lifetime of this object to prevent dangling handles. + + Construct via :meth:`cuda.core.Device.create_texture_object`. Passes to + kernels as a 64-bit handle (via the ``handle`` property). + + .. versionadded:: 1.1.0 + """ + + def close(self): + """Release this object's reference to the underlying ``CUtexObject``. + + Destruction (``cuTexObjectDestroy``) and release of the backing resource + happen via the handle's deleter when the last reference is dropped. + Idempotent. + """ + + def __init__(self, *args, **kwargs): + ... + + @property + def handle(self): + """The underlying ``CUtexObject`` as an integer (64-bit kernel arg).""" + + @property + def resource(self): + """The :class:`ResourceDescriptor` this texture was built from.""" + + @property + def options(self): + """The :class:`TextureObjectOptions` this texture was built from.""" + + @property + def device(self): + ... + + def __enter__(self): + ... + + def __exit__(self, exc_type, exc, tb): + ... + + def __repr__(self): + ... +_TRSF_READ_AS_INTEGER = 1 +_TRSF_NORMALIZED_COORDINATES = 2 +_TRSF_SRGB = 16 +_TRSF_DISABLE_TRILINEAR_OPTIMIZATION = 32 +_TRSF_SEAMLESS_CUBEMAP = 64 +_ADDRESSMODE_TO_CU = {AddressModeType.WRAP: int(cydriver.CU_TR_ADDRESS_MODE_WRAP), AddressModeType.CLAMP: int(cydriver.CU_TR_ADDRESS_MODE_CLAMP), AddressModeType.MIRROR: int(cydriver.CU_TR_ADDRESS_MODE_MIRROR), AddressModeType.BORDER: int(cydriver.CU_TR_ADDRESS_MODE_BORDER)} +_FILTERMODE_TO_CU = {FilterModeType.POINT: int(cydriver.CU_TR_FILTER_MODE_POINT), FilterModeType.LINEAR: int(cydriver.CU_TR_FILTER_MODE_LINEAR)} + +def _normalize_enum(name, value, enum_type): + """Coerce ``value`` to ``enum_type`` (a StrEnum), accepting a plain str.""" + +def _normalize_address_modes(address_mode): + """Return a 3-tuple of :class:`AddressModeType` values from a scalar or + 1-3 tuple. Individual entries may be plain strings.""" + +def _create_texture_object(resource, options): + """Create a :class:`TextureObject` on the current device. + + Backs :meth:`cuda.core.Device.create_texture_object`. ``resource`` is a + :class:`ResourceDescriptor`; ``options`` is a :class:`TextureObjectOptions` + (or a mapping accepted by it). + """ \ No newline at end of file diff --git a/cuda_core/cuda/core/texture/_texture.pyx b/cuda_core/cuda/core/texture/_texture.pyx new file mode 100644 index 00000000000..8d09c727c31 --- /dev/null +++ b/cuda_core/cuda/core/texture/_texture.pyx @@ -0,0 +1,588 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from __future__ import annotations + +from libc.stdint cimport intptr_t +from libc.string cimport memset + +from cuda.bindings cimport cydriver +from cuda.core.texture._array cimport OpaqueArray +from cuda.core.texture._array import ( + _ARRAYFORMAT_TO_CU, + _CU_TO_ARRAYFORMAT, + _FORMAT_ELEM_SIZE, + _validate_format_channels, +) +from cuda.core._memory._buffer cimport Buffer +from cuda.core.texture._mipmapped_array cimport MipmappedArray +from cuda.core.texture._mipmapped_array import MipmappedArray as _PyMipmappedArray +from cuda.core._resource_handles cimport ( + TexObjectHandle, + as_cu, + as_intptr, + create_tex_object_handle_array, + create_tex_object_handle_linear, + create_tex_object_handle_mipmap, + get_last_error, +) +from cuda.core._utils.cuda_utils cimport ( + HANDLE_RETURN, + _get_current_device_id, +) + +from cuda.core.typing import AddressModeType, FilterModeType, ReadModeType + +from dataclasses import dataclass + +from cuda.core._utils.cuda_utils import check_or_create_options + + +# Driver texture-descriptor flag bits (CU_TRSF_*). +_TRSF_READ_AS_INTEGER = 0x01 +_TRSF_NORMALIZED_COORDINATES = 0x02 +_TRSF_SRGB = 0x10 +_TRSF_DISABLE_TRILINEAR_OPTIMIZATION = 0x20 +_TRSF_SEAMLESS_CUBEMAP = 0x40 + + +# Bridge between the public sampling StrEnums and the driver integer values. +_ADDRESSMODE_TO_CU = { + AddressModeType.WRAP: int(cydriver.CU_TR_ADDRESS_MODE_WRAP), + AddressModeType.CLAMP: int(cydriver.CU_TR_ADDRESS_MODE_CLAMP), + AddressModeType.MIRROR: int(cydriver.CU_TR_ADDRESS_MODE_MIRROR), + AddressModeType.BORDER: int(cydriver.CU_TR_ADDRESS_MODE_BORDER), +} +_FILTERMODE_TO_CU = { + FilterModeType.POINT: int(cydriver.CU_TR_FILTER_MODE_POINT), + FilterModeType.LINEAR: int(cydriver.CU_TR_FILTER_MODE_LINEAR), +} + + +def _normalize_enum(name, value, enum_type): + """Coerce ``value`` to ``enum_type`` (a StrEnum), accepting a plain str.""" + if isinstance(value, enum_type): + return value + try: + return enum_type(value) + except ValueError as e: + valid = ", ".join(repr(m.value) for m in enum_type) + raise ValueError( + f"{name} must be a {enum_type.__name__} or one of {{{valid}}}, got {value!r}" + ) from e + + +class ResourceDescriptor: + """Describes the memory backing a :class:`TextureObject`. + + Construct via the ``from_*`` classmethods: + + - :meth:`from_opaque_array` wraps a :class:`OpaqueArray` (works for both + :class:`TextureObject` and :class:`SurfaceObject`). + - :meth:`from_mipmapped_array` wraps a :class:`MipmappedArray` for mipmapped + sampling (texture only, not surface). + - :meth:`from_linear` wraps a :class:`Buffer` as a typed 1D fetch. Texture + objects built from a linear resource do not support filtering, + normalized coordinates, or addressing modes. + - :meth:`from_pitch2d` wraps a :class:`Buffer` as a row-pitched 2D image. + Supports filtering and 2D addressing, but only 2D access. + + Linear and pitch2D resources cannot back a :class:`SurfaceObject` — those + require an :class:`OpaqueArray` allocated with ``is_surface_load_store=True``. + + .. versionadded:: 1.1.0 + """ + + __slots__ = ( + "_kind", "_source", + "_format", "_num_channels", + "_size_bytes", + "_width", "_height", "_pitch_bytes", + ) + + def __init__(self): + raise RuntimeError( + "ResourceDescriptor cannot be instantiated directly. " + "Use ResourceDescriptor.from_* factories." + ) + + @classmethod + def from_opaque_array(cls, array): + """Build a resource descriptor backed by a :class:`OpaqueArray`.""" + if not isinstance(array, OpaqueArray): + raise TypeError(f"array must be a OpaqueArray, got {type(array).__name__}") + self = cls.__new__(cls) + self._kind = "array" + self._source = array + self._format = None + self._num_channels = None + self._size_bytes = None + self._width = None + self._height = None + self._pitch_bytes = None + return self + + @classmethod + def from_mipmapped_array(cls, mipmapped_array): + """Build a resource descriptor backed by a :class:`MipmappedArray`. + + Suitable for binding to a :class:`TextureObject` for mipmapped + sampling. Not valid as a :class:`SurfaceObject` backing: surfaces + require a single :class:`OpaqueArray` level (obtain via + :meth:`MipmappedArray.get_level`). + """ + if not isinstance(mipmapped_array, _PyMipmappedArray): + raise TypeError( + f"mipmapped_array must be a MipmappedArray, got " + f"{type(mipmapped_array).__name__}" + ) + self = cls.__new__(cls) + self._kind = "mipmapped_array" + self._source = mipmapped_array + self._format = None + self._num_channels = None + self._size_bytes = None + self._width = None + self._height = None + self._pitch_bytes = None + return self + + @classmethod + def from_linear(cls, buffer, *, format, num_channels, size_bytes=None): + """Build a resource descriptor for a linear (typed 1D) texture fetch. + + Parameters + ---------- + buffer : Buffer + Device-memory backing. Must remain alive for the lifetime of any + :class:`TextureObject` built from this descriptor. + format : ArrayFormatType, str, or numpy.dtype + Element format. Accepts an :class:`~cuda.core.typing.ArrayFormatType`, + a plain string (e.g. ``"float32"``), or a NumPy dtype object. + num_channels : int + Channels per element. Must be 1, 2, or 4. + size_bytes : int, optional + Bytes of ``buffer`` to bind. Defaults to ``buffer.size``. Must not + exceed it. + + Notes + ----- + Texture objects built from a linear resource ignore the + :class:`TextureObjectOptions` addressing/filtering fields — kernels read + through a typed 1D fetch with bounds checking only. + """ + if not isinstance(buffer, Buffer): + raise TypeError(f"buffer must be a Buffer, got {type(buffer).__name__}") + fmt = _validate_format_channels(format, num_channels) + cu_format = _ARRAYFORMAT_TO_CU[fmt] + + buf_size = int(buffer.size) + elem = _FORMAT_ELEM_SIZE[cu_format] * int(num_channels) + if size_bytes is None: + size = buf_size + else: + size = int(size_bytes) + if size > buf_size: + raise ValueError( + f"size_bytes ({size}) exceeds buffer.size ({buf_size})" + ) + if size < elem: + raise ValueError( + f"size_bytes ({size}) must be at least one element ({elem} bytes)" + ) + if size % elem != 0: + raise ValueError( + f"size_bytes ({size}) must be a multiple of element size " + f"({elem} bytes for {fmt.name} x {num_channels})" + ) + + self = cls.__new__(cls) + self._kind = "linear" + self._source = buffer + self._format = cu_format + self._num_channels = int(num_channels) + self._size_bytes = size + self._width = None + self._height = None + self._pitch_bytes = None + return self + + @classmethod + def from_pitch2d( + cls, buffer, *, format, num_channels, width, height, pitch_bytes + ): + """Build a resource descriptor for a row-pitched 2D image. + + Parameters + ---------- + buffer : Buffer + Device-memory backing. Must remain alive for the lifetime of any + :class:`TextureObject` built from this descriptor. + format : ArrayFormatType, str, or numpy.dtype + Element format. Accepts an :class:`~cuda.core.typing.ArrayFormatType`, + a plain string (e.g. ``"float32"``), or a NumPy dtype object. + num_channels : int + Channels per element. Must be 1, 2, or 4. + width : int + Image width, in elements. + height : int + Image height, in rows. + pitch_bytes : int + Distance between consecutive rows, in bytes. Must be at least + ``width * format_size * num_channels`` and meet the driver's + ``CU_DEVICE_ATTRIBUTE_TEXTURE_PITCH_ALIGNMENT``. + """ + if not isinstance(buffer, Buffer): + raise TypeError(f"buffer must be a Buffer, got {type(buffer).__name__}") + fmt = _validate_format_channels(format, num_channels) + cu_format = _ARRAYFORMAT_TO_CU[fmt] + + w = int(width) + h = int(height) + p = int(pitch_bytes) + if w < 1: + raise ValueError(f"width must be >= 1, got {w}") + if h < 1: + raise ValueError(f"height must be >= 1, got {h}") + elem = _FORMAT_ELEM_SIZE[cu_format] * int(num_channels) + min_pitch = w * elem + if p < min_pitch: + raise ValueError( + f"pitch_bytes ({p}) must be >= width * element_bytes ({min_pitch})" + ) + if p * h > int(buffer.size): + raise ValueError( + f"pitch_bytes * height ({p * h}) exceeds buffer.size ({int(buffer.size)})" + ) + + self = cls.__new__(cls) + self._kind = "pitch2d" + self._source = buffer + self._format = cu_format + self._num_channels = int(num_channels) + self._size_bytes = None + self._width = w + self._height = h + self._pitch_bytes = p + return self + + @property + def kind(self): + return self._kind + + @property + def source(self): + return self._source + + @property + def format(self): + """The element :class:`~cuda.core.typing.ArrayFormatType` (``None`` for array-backed).""" + return None if self._format is None else _CU_TO_ARRAYFORMAT[self._format] + + @property + def num_channels(self): + """Channels per element (``None`` for array-backed).""" + return self._num_channels + + @property + def size_bytes(self): + """Bytes bound for a linear resource (``None`` for other kinds).""" + return self._size_bytes + + @property + def width(self): + """Pitch2D image width, in elements (``None`` for other kinds).""" + return self._width + + @property + def height(self): + """Pitch2D image height, in rows (``None`` for other kinds).""" + return self._height + + @property + def pitch_bytes(self): + """Pitch2D row pitch, in bytes (``None`` for other kinds).""" + return self._pitch_bytes + + def __repr__(self): + if self._kind == "linear": + return ( + f"ResourceDescriptor(kind='linear', format={self.format.name}, " + f"num_channels={self._num_channels}, size_bytes={self._size_bytes})" + ) + if self._kind == "pitch2d": + return ( + f"ResourceDescriptor(kind='pitch2d', format={self.format.name}, " + f"num_channels={self._num_channels}, " + f"width={self._width}, height={self._height}, " + f"pitch_bytes={self._pitch_bytes})" + ) + return f"ResourceDescriptor(kind={self._kind!r})" + + +@dataclass +class TextureObjectOptions: + """Sampling state for a :class:`TextureObject` (mirrors ``CUDA_TEXTURE_DESC``). + + Attributes + ---------- + address_mode : AddressModeType or tuple of AddressModeType + Boundary behavior per axis. May be a single + :class:`~cuda.core.typing.AddressModeType` (applied to all axes) or a + tuple of 1-3 entries (one per dimension). Plain strings are accepted. + filter_mode : FilterModeType + Texel sampling mode. Default ``POINT``. Plain strings are accepted. + read_mode : ReadModeType + How sampled integer values are returned. Default ``ELEMENT_TYPE``. + Plain strings are accepted. + normalized_coords : bool + If True, coordinates are in ``[0, 1]`` instead of pixel indices. + srgb : bool + If True, perform sRGB → linear conversion on read (8-bit formats only). + disable_trilinear_optimization : bool + If True, request exact trilinear filtering. + seamless_cubemap : bool + If True, enable seamless cubemap edge filtering. + max_anisotropy : int + Maximum anisotropy; 0 disables anisotropic filtering. + mipmap_filter_mode : FilterModeType + Filtering between mipmap levels. Default ``POINT``. Plain strings are + accepted. + mipmap_level_bias : float + min_mipmap_level_clamp : float + max_mipmap_level_clamp : float + border_color : tuple of float or None + 4-tuple used when ``address_mode`` includes ``BORDER``; ``None`` means + zero. + + .. versionadded:: 1.1.0 + """ + + address_mode: AddressModeType | str | tuple[AddressModeType | str, ...] = AddressModeType.CLAMP + filter_mode: FilterModeType | str = FilterModeType.POINT + read_mode: ReadModeType | str = ReadModeType.ELEMENT_TYPE + normalized_coords: bool = False + srgb: bool = False + disable_trilinear_optimization: bool = False + seamless_cubemap: bool = False + max_anisotropy: int = 0 + mipmap_filter_mode: FilterModeType | str = FilterModeType.POINT + mipmap_level_bias: float = 0.0 + min_mipmap_level_clamp: float = 0.0 + max_mipmap_level_clamp: float = 0.0 + border_color: tuple[float, ...] | None = None + + def __post_init__(self): + self.filter_mode = _normalize_enum("filter_mode", self.filter_mode, FilterModeType) + self.read_mode = _normalize_enum("read_mode", self.read_mode, ReadModeType) + self.mipmap_filter_mode = _normalize_enum( + "mipmap_filter_mode", self.mipmap_filter_mode, FilterModeType + ) + + +def _normalize_address_modes(address_mode): + """Return a 3-tuple of :class:`AddressModeType` values from a scalar or + 1-3 tuple. Individual entries may be plain strings.""" + if isinstance(address_mode, (AddressModeType, str)): + m = _normalize_enum("address_mode", address_mode, AddressModeType) + return (m, m, m) + try: + modes = tuple(address_mode) + except TypeError as e: + raise TypeError( + "address_mode must be an AddressModeType or a tuple of AddressModeType" + ) from e + if not 1 <= len(modes) <= 3: + raise ValueError( + f"address_mode tuple must have 1-3 entries, got {len(modes)}" + ) + modes = tuple( + _normalize_enum(f"address_mode[{i}]", m, AddressModeType) + for i, m in enumerate(modes) + ) + # Pad to 3 entries by repeating the last one. + padded = list(modes) + [modes[-1]] * (3 - len(modes)) + return tuple(padded) + + +cdef class TextureObject: + """A bindless texture handle for kernel-side sampled reads. + + Wraps ``cuTexObjectCreate``. The underlying memory resource (e.g. the + :class:`OpaqueArray` referenced by the descriptor) is kept alive for the + lifetime of this object to prevent dangling handles. + + Construct via :meth:`cuda.core.Device.create_texture_object`. Passes to + kernels as a 64-bit handle (via the ``handle`` property). + + .. versionadded:: 1.1.0 + """ + + def __init__(self, *args, **kwargs): + raise RuntimeError( + "TextureObject cannot be instantiated directly. " + "Use Device.create_texture_object()." + ) + + @property + def handle(self): + """The underlying ``CUtexObject`` as an integer (64-bit kernel arg).""" + return as_intptr(self._handle) + + @property + def resource(self): + """The :class:`ResourceDescriptor` this texture was built from.""" + return self._source_ref + + @property + def options(self): + """The :class:`TextureObjectOptions` this texture was built from.""" + return self._options + + @property + def device(self): + from cuda.core._device import Device + return Device(self._device_id) + + cpdef close(self): + """Release this object's reference to the underlying ``CUtexObject``. + + Destruction (``cuTexObjectDestroy``) and release of the backing resource + happen via the handle's deleter when the last reference is dropped. + Idempotent. + """ + self._handle.reset() + self._source_ref = None + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc, tb): + self.close() + + def __repr__(self): + return f"TextureObject(handle=0x{as_intptr(self._handle):x})" + + +def _create_texture_object(resource, options): + """Create a :class:`TextureObject` on the current device. + + Backs :meth:`cuda.core.Device.create_texture_object`. ``resource`` is a + :class:`ResourceDescriptor`; ``options`` is a :class:`TextureObjectOptions` + (or a mapping accepted by it). + """ + if not isinstance(resource, ResourceDescriptor): + raise TypeError( + f"resource must be a ResourceDescriptor, got " + f"{type(resource).__name__}" + ) + cdef object opts = check_or_create_options( + TextureObjectOptions, options, "Texture object options" + ) + + cdef cydriver.CUDA_RESOURCE_DESC res_desc + cdef cydriver.CUDA_TEXTURE_DESC tex_desc + memset(&res_desc, 0, sizeof(res_desc)) + memset(&tex_desc, 0, sizeof(tex_desc)) + + # --- Resource descriptor --- + cdef OpaqueArray arr + cdef MipmappedArray mip + cdef Buffer buf + cdef intptr_t devptr + if resource.kind == "array": + arr = resource.source + res_desc.resType = cydriver.CU_RESOURCE_TYPE_ARRAY + res_desc.res.array.hArray = as_cu(arr._handle) + elif resource.kind == "mipmapped_array": + mip = resource.source + res_desc.resType = cydriver.CU_RESOURCE_TYPE_MIPMAPPED_ARRAY + res_desc.res.mipmap.hMipmappedArray = as_cu(mip._handle) + elif resource.kind == "linear": + buf = resource.source + devptr = int(buf.handle) + res_desc.resType = cydriver.CU_RESOURCE_TYPE_LINEAR + res_desc.res.linear.devPtr = devptr + res_desc.res.linear.format = resource._format + res_desc.res.linear.numChannels = resource._num_channels + res_desc.res.linear.sizeInBytes = resource._size_bytes + elif resource.kind == "pitch2d": + buf = resource.source + devptr = int(buf.handle) + res_desc.resType = cydriver.CU_RESOURCE_TYPE_PITCH2D + res_desc.res.pitch2D.devPtr = devptr + res_desc.res.pitch2D.format = resource._format + res_desc.res.pitch2D.numChannels = resource._num_channels + res_desc.res.pitch2D.width = resource._width + res_desc.res.pitch2D.height = resource._height + res_desc.res.pitch2D.pitchInBytes = resource._pitch_bytes + else: + raise NotImplementedError( + f"ResourceDescriptor kind {resource.kind!r} is not yet supported" + ) + + # --- Texture descriptor --- + # filter_mode/read_mode/mipmap_filter_mode are normalized to their + # StrEnum types by TextureObjectOptions.__post_init__; address_mode is + # normalized (and str-coerced) here. + modes = _normalize_address_modes(opts.address_mode) + tex_desc.addressMode[0] = _ADDRESSMODE_TO_CU[modes[0]] + tex_desc.addressMode[1] = _ADDRESSMODE_TO_CU[modes[1]] + tex_desc.addressMode[2] = _ADDRESSMODE_TO_CU[modes[2]] + + tex_desc.filterMode = _FILTERMODE_TO_CU[opts.filter_mode] + + cdef unsigned int flags = 0 + # CU_TRSF_READ_AS_INTEGER suppresses normalization, so it maps to + # ReadModeType.ELEMENT_TYPE. + if opts.read_mode == ReadModeType.ELEMENT_TYPE: + flags |= _TRSF_READ_AS_INTEGER + if opts.normalized_coords: + flags |= _TRSF_NORMALIZED_COORDINATES + if opts.srgb: + flags |= _TRSF_SRGB + if opts.disable_trilinear_optimization: + flags |= _TRSF_DISABLE_TRILINEAR_OPTIMIZATION + if opts.seamless_cubemap: + flags |= _TRSF_SEAMLESS_CUBEMAP + tex_desc.flags = flags + + if opts.max_anisotropy < 0: + raise ValueError("max_anisotropy must be >= 0") + tex_desc.maxAnisotropy = opts.max_anisotropy + + tex_desc.mipmapFilterMode = _FILTERMODE_TO_CU[opts.mipmap_filter_mode] + tex_desc.mipmapLevelBias = opts.mipmap_level_bias + tex_desc.minMipmapLevelClamp = opts.min_mipmap_level_clamp + tex_desc.maxMipmapLevelClamp = opts.max_mipmap_level_clamp + + cdef int i + if opts.border_color is None: + for i in range(4): + tex_desc.borderColor[i] = 0.0 + else: + bc = tuple(opts.border_color) + if len(bc) != 4: + raise ValueError( + f"border_color must have 4 elements, got {len(bc)}" + ) + for i in range(4): + tex_desc.borderColor[i] = bc[i] + + cdef TexObjectHandle h + if resource.kind == "array": + h = create_tex_object_handle_array(res_desc, tex_desc, arr._handle) + elif resource.kind == "mipmapped_array": + h = create_tex_object_handle_mipmap(res_desc, tex_desc, mip._handle) + else: # linear or pitch2d — both backed by a device Buffer + h = create_tex_object_handle_linear(res_desc, tex_desc, buf._h_ptr) + if not h: + HANDLE_RETURN(get_last_error()) + + cdef TextureObject self = TextureObject.__new__(TextureObject) + self._handle = h + self._source_ref = resource + self._options = opts + self._device_id = _get_current_device_id() + return self diff --git a/cuda_core/cuda/core/typing.py b/cuda_core/cuda/core/typing.py new file mode 100644 index 00000000000..1bf9bb7c0d2 --- /dev/null +++ b/cuda_core/cuda/core/typing.py @@ -0,0 +1,315 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +"""Public type aliases, protocols, and enumerations used in cuda.core API signatures.""" + +import sys +from typing import TYPE_CHECKING +from typing import Literal as _Literal +from typing import TypeAlias as _TypeAlias + +if TYPE_CHECKING: + # `backports.strenum` ships no type stubs and typeshed conditionally gates + # `enum.StrEnum` behind `sys.version_info >= (3, 11)`. Declaring a minimal + # local shape here (mirroring typeshed's 3.11 StrEnum) lets mypy at + # `python_version = "3.10"` infer subclass members as `Literal[Foo.MEMBER]` + # rather than bare `str`. + from enum import Enum + + class StrEnum(str, Enum): + _value_: str + + +if not TYPE_CHECKING: + if sys.version_info >= (3, 11): + from enum import StrEnum + else: + from backports.strenum import StrEnum + +from cuda.core._context import DeviceResourcesType +from cuda.core._stream import IsStreamType +from cuda.core._utils.cuda_utils import driver + +__all__ = [ + "AddressModeType", + "ArrayFormatType", + "CompilerBackendType", + "DevicePointerType", + "DeviceResourcesType", + "FilterModeType", + "GraphConditionalType", + "GraphMemoryType", + "IsStreamType", + "ManagedMemoryLocationType", + "ObjectCodeFormatType", + "PCHStatusType", + "ProcessStateType", + "ReadModeType", + "SourceCodeType", + "VirtualMemoryAccessType", + "VirtualMemoryAllocationType", + "VirtualMemoryGranularityType", + "VirtualMemoryHandleType", + "VirtualMemoryLocationType", + "WorkqueueSharingScopeType", +] + + +# A type union of :obj:`~driver.CUdeviceptr`, `int` and `None` for hinting +# :attr:`Buffer.handle`. +DevicePointerType: _TypeAlias = driver.CUdeviceptr | int | None + + +ProcessStateType = _Literal["running", "locked", "checkpointed", "failed"] + + +class SourceCodeType(StrEnum): + """Source language passed to :class:`~cuda.core.Program`. + + * ``CXX`` — CUDA C++ source. + * ``PTX`` — PTX assembly text. + * ``NVVM`` — NVVM IR (LLVM bitcode). + """ + + CXX = "c++" + PTX = "ptx" + NVVM = "nvvm" + + +class ObjectCodeFormatType(StrEnum): + """Output format for :meth:`~cuda.core.Program.compile`, :meth:`~cuda.core.Linker.link`, and :meth:`~cuda.core.Program.as_bytes`. + + * ``PTX`` — PTX assembly text. + * ``CUBIN`` — device-native CUDA binary. + * ``LTOIR`` — LTO (link-time optimization) IR for later linking. + * ``FATBIN`` — fat binary bundling multiple device images. + * ``OBJECT`` — relocatable device object. + * ``LIBRARY`` — device code library. + """ + + PTX = "ptx" + CUBIN = "cubin" + LTOIR = "ltoir" + FATBIN = "fatbin" + OBJECT = "object" + LIBRARY = "library" + + +class CompilerBackendType(StrEnum): + """Compiler backend inferred from the program's code type and exposed on :attr:`~cuda.core.Program.backend`. + + * ``NVRTC`` — NVIDIA Runtime Compilation. + * ``NVVM`` — NVVM LLVM backend. + * ``NVJITLINK`` — nvJitLink device-side linker. + * ``DRIVER`` — CUDA driver PTX JIT compiler. + """ + + NVRTC = "NVRTC" + NVVM = "NVVM" + NVJITLINK = "nvJitLink" + DRIVER = "driver" + + +class PCHStatusType(StrEnum): + """Precompiled-header (PCH) outcome reported by :meth:`~cuda.core.Program.compile`. + + * ``CREATED`` — PCH was successfully written. + * ``NOT_ATTEMPTED`` — PCH creation was skipped (backend does not support it or the option was not requested). + * ``FAILED`` — PCH creation was attempted but failed. + """ + + CREATED = "created" + NOT_ATTEMPTED = "not_attempted" + FAILED = "failed" + + +class GraphConditionalType(StrEnum): + """Conditional node flavor for :class:`~cuda.core.graph.GraphBuilder`. + + * ``IF`` — body graph executes at most once based on a condition. + * ``WHILE`` — body graph loops while the condition is true. + * ``SWITCH`` — selects one child graph by an integer index. + """ + + IF = "if" + WHILE = "while" + SWITCH = "switch" + + +class GraphMemoryType(StrEnum): + """Memory space for a graph memory-allocation or free node. + + * ``DEVICE`` — GPU device memory. + * ``HOST`` — pinned host memory. + * ``MANAGED`` — CUDA managed (unified) memory. + """ + + DEVICE = "device" + HOST = "host" + MANAGED = "managed" + + +class ManagedMemoryLocationType(StrEnum): + """Destination type for managed-memory prefetch and advise operations. + + * ``DEVICE`` — target a GPU device. + * ``HOST`` — target the CPU host (any NUMA node). + * ``HOST_NUMA`` — target a specific host NUMA node. + """ + + DEVICE = "device" + HOST = "host" + HOST_NUMA = "host_numa" + + +class VirtualMemoryHandleType(StrEnum): + """OS handle type for exporting virtual memory allocations across processes. + + * ``POSIX_FD`` — POSIX file descriptor (Linux). + * ``WIN32_KMT`` — Win32 kernel-mode handle (Windows). + * ``FABRIC`` — NVLink/NVSwitch fabric handle for multi-node topologies. + """ + + POSIX_FD = "posix_fd" + WIN32_KMT = "win32_kmt" + FABRIC = "fabric" + + +class VirtualMemoryLocationType(StrEnum): + """Physical backing location for a virtual memory allocation. + + * ``DEVICE`` — GPU device memory. + * ``HOST`` — pinned host memory. + * ``HOST_NUMA`` — host memory pinned to a specific NUMA node. + * ``HOST_NUMA_CURRENT`` — host memory on the calling thread's NUMA node. + """ + + DEVICE = "device" + HOST = "host" + HOST_NUMA = "host_numa" + HOST_NUMA_CURRENT = "host_numa_current" + + +class VirtualMemoryGranularityType(StrEnum): + """Granularity query type for virtual memory allocations. + + * ``MINIMUM`` — smallest allocation size supported by the device. + * ``RECOMMENDED`` — granularity that yields best performance on the device. + """ + + MINIMUM = "minimum" + RECOMMENDED = "recommended" + + +class VirtualMemoryAccessType(StrEnum): + """Access permissions for a virtual memory mapping. + + * ``READ_WRITE`` — both read and write access. + * ``READ`` — read-only access. + """ + + READ_WRITE = "rw" + READ = "r" + + +class VirtualMemoryAllocationType(StrEnum): + """Physical memory type for a virtual memory backing allocation. + + * ``PINNED`` — pinned/non-migratable physical allocation (placement via :class:`VirtualMemoryLocationType`). + * ``MANAGED`` — CUDA managed (unified) memory (CUDA 13+ only). + """ + + PINNED = "pinned" + MANAGED = "managed" + + +class ArrayFormatType(StrEnum): + """Element format for an :class:`~cuda.core.texture.OpaqueArray` allocation. + + Corresponds to ``CUarray_format`` from the CUDA driver API. Each value maps + 1:1 to a NumPy dtype; the enum is retained as an explicit escape hatch. + + * ``UINT8`` / ``UINT16`` / ``UINT32`` — unsigned integer elements. + * ``INT8`` / ``INT16`` / ``INT32`` — signed integer elements. + * ``FLOAT16`` / ``FLOAT32`` — half- and single-precision float elements. + + .. versionadded:: 1.1.0 + """ + + UINT8 = "uint8" + UINT16 = "uint16" + UINT32 = "uint32" + INT8 = "int8" + INT16 = "int16" + INT32 = "int32" + FLOAT16 = "float16" + FLOAT32 = "float32" + + +class AddressModeType(StrEnum): + """Boundary behavior for out-of-range texture coordinates. + + Corresponds to ``CUaddress_mode`` from the CUDA driver API. + + * ``WRAP`` — wrap coordinates around (tiling). + * ``CLAMP`` — clamp to the edge texel. + * ``MIRROR`` — reflect coordinates at the boundary. + * ``BORDER`` — return the configured border color. + + .. versionadded:: 1.1.0 + """ + + WRAP = "wrap" + CLAMP = "clamp" + MIRROR = "mirror" + BORDER = "border" + + +class FilterModeType(StrEnum): + """Texel sampling mode for a :class:`~cuda.core.texture.TextureObject`. + + Corresponds to ``CUfilter_mode`` from the CUDA driver API. + + * ``POINT`` — nearest-texel sampling. + * ``LINEAR`` — (bi/tri)linear interpolation. + + .. versionadded:: 1.1.0 + """ + + POINT = "point" + LINEAR = "linear" + + +class ReadModeType(StrEnum): + """How sampled values are returned to the kernel. + + * ``ELEMENT_TYPE`` — return the raw element value (integer formats stay + integer, float stays float). + * ``NORMALIZED_FLOAT`` — integer formats are promoted to a normalized + ``float`` in ``[0, 1]`` (unsigned) or ``[-1, 1]`` (signed). Float + formats are unaffected. + + .. versionadded:: 1.1.0 + """ + + ELEMENT_TYPE = "element_type" + NORMALIZED_FLOAT = "normalized_float" + + +class WorkqueueSharingScopeType(StrEnum): + """Sharing scope for :class:`~cuda.core.WorkqueueResource`. + + * ``DEVICE_CTX`` — use all shared workqueue resources across all + contexts (default driver behavior). + * ``GREEN_CTX_BALANCED`` — when possible, use non-overlapping + workqueue resources with other balanced green contexts. + + .. versionadded:: 1.1.0 + """ + + DEVICE_CTX = "device_ctx" + GREEN_CTX_BALANCED = "green_ctx_balanced" + + +del StrEnum diff --git a/cuda_core/cuda/core/utils/__init__.py b/cuda_core/cuda/core/utils/__init__.py new file mode 100644 index 00000000000..93a4c14c083 --- /dev/null +++ b/cuda_core/cuda/core/utils/__init__.py @@ -0,0 +1,31 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +from cuda.core._memory._managed_memory_ops import ( + discard_batch, + discard_prefetch_batch, + prefetch_batch, +) +from cuda.core._memoryview import ( + StridedMemoryView, + args_viewable_as_strided_memory, +) +from cuda.core.utils._program_cache import ( + FileStreamProgramCache, + InMemoryProgramCache, + ProgramCacheResource, + make_program_cache_key, +) + +__all__ = [ + "FileStreamProgramCache", + "InMemoryProgramCache", + "ProgramCacheResource", + "StridedMemoryView", + "args_viewable_as_strided_memory", + "discard_batch", + "discard_prefetch_batch", + "make_program_cache_key", + "prefetch_batch", +] diff --git a/cuda_core/cuda/core/utils/_program_cache/__init__.py b/cuda_core/cuda/core/utils/_program_cache/__init__.py new file mode 100644 index 00000000000..a233ad31ad5 --- /dev/null +++ b/cuda_core/cuda/core/utils/_program_cache/__init__.py @@ -0,0 +1,36 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +"""Persistent program cache for cuda.core. + +Public surface: + +* :class:`ProgramCacheResource` -- bytes-in / bytes-out ABC. +* :class:`InMemoryProgramCache` -- thread-safe LRU dict-backed cache. +* :class:`FileStreamProgramCache` -- atomic, multi-process directory cache. +* :func:`make_program_cache_key` -- key derivation for arbitrary + ``Program`` configurations. + +The package is split into submodules by concern. Tests that need to +monkeypatch internals (Windows flag, version probes, helpers, ...) +should reach into the owning submodule (e.g. +``_program_cache._file_stream._IS_WINDOWS``, +``_program_cache._keys._linker_backend_and_version``) rather than the +package object: the symbols re-exported here are only convenience +aliases and don't intercept calls within the submodules. +""" + +from __future__ import annotations + +from ._abc import ProgramCacheResource +from ._file_stream import FileStreamProgramCache +from ._in_memory import InMemoryProgramCache +from ._keys import make_program_cache_key + +__all__ = [ + "FileStreamProgramCache", + "InMemoryProgramCache", + "ProgramCacheResource", + "make_program_cache_key", +] diff --git a/cuda_core/cuda/core/utils/_program_cache/_abc.py b/cuda_core/cuda/core/utils/_program_cache/_abc.py new file mode 100644 index 00000000000..82233540eb3 --- /dev/null +++ b/cuda_core/cuda/core/utils/_program_cache/_abc.py @@ -0,0 +1,204 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +"""Abstract base class and value-coercion helpers shared by every cache backend.""" + +from __future__ import annotations + +import abc +import collections.abc +from pathlib import Path + +from cuda.core._module import ObjectCode + + +def _extract_bytes(value: object) -> bytes: + """Return the raw binary bytes to store on disk. + + Accepts ``bytes``, ``bytearray``, ``memoryview``, or any + :class:`ObjectCode`. Path-backed ``ObjectCode`` (created via + ``ObjectCode.from_cubin('/path')`` etc.) is read from the filesystem + at write time so the cached entry is the binary content itself, not + a path that could later be moved or modified. + """ + if isinstance(value, (bytes, bytearray, memoryview)): + return bytes(value) + if isinstance(value, ObjectCode): + code = value.code + if isinstance(code, str): + try: + return Path(code).read_bytes() + except FileNotFoundError: + # Avoid ``{code!r}``: on Windows it doubles every backslash in + # the path, which breaks naive ``str(path) in str(exc)`` checks + # callers (and tests) write against the raw filesystem string. + raise FileNotFoundError( + f"cannot store path-backed ObjectCode in cache: {code} no longer exists" + ) from None + return bytes(code) + raise TypeError(f"cache values must be bytes-like or ObjectCode, got {type(value).__name__}") + + +def _as_key_bytes(key: object) -> bytes: + if isinstance(key, (bytes, bytearray)): + return bytes(key) + if isinstance(key, str): + return key.encode("utf-8") + raise TypeError(f"cache keys must be bytes or str, got {type(key).__name__}") + + +class ProgramCacheResource(abc.ABC): + """Abstract base class for compiled-program caches. + + Concrete implementations store and retrieve **raw binary bytes** keyed + by ``bytes`` or ``str``. A ``str`` key is encoded as UTF-8 before + being used, so ``"k"`` and ``b"k"`` refer to the same entry. A typical + key is produced by :func:`make_program_cache_key`, which returns + ``bytes``. + + The values written are the compiled program bytes themselves -- + cubin, PTX, LTO-IR, etc. Reads return raw bytes so cache files + remain consumable by external NVIDIA tools (``cuobjdump``, + ``nvdisasm``, ``cuda-gdb``, ...). + + Most callers don't interact with this object directly. The + recommended usage is :meth:`cuda.core.Program.compile`'s ``cache=`` + keyword, which derives the key, returns a fresh + :class:`~cuda.core.ObjectCode` on hit, and stores the compile + result on miss:: + + with FileStreamProgramCache() as cache: + obj = program.compile("cubin", cache=cache) + + The escape hatch -- only needed when the compile inputs require an + ``extra_digest`` (header / PCH content fingerprints, NVVM + libdevice) -- is to call :func:`make_program_cache_key` yourself + and use the cache as a plain ``bytes`` mapping:: + + from cuda.core import ObjectCode + + key = make_program_cache_key( + code=source, + code_type="c++", + options=options, + target_type="cubin", + extra_digest=header_fingerprint(), + ) + data = cache.get(key) + if data is None: + obj = program.compile("cubin") + cache[key] = obj # extracts bytes(obj.code) + else: + obj = ObjectCode.from_cubin(data) + + The cache layer does no payload validation; bytes go in and come + back out unchanged. Symbol-mapping metadata that + :class:`~cuda.core.ObjectCode` carries when produced with NVRTC + name expressions is **not** preserved across a cache round-trip -- + the binary alone is stored. Callers that need ``symbol_mapping`` + for ``get_kernel(name_expression)`` should compile fresh, or look + the mangled symbol up by hand. + + .. note:: **Concurrent-access idiom.** + + Use :meth:`get` (or ``data = cache[key]`` inside a ``try / + except KeyError``) for lookups. There is intentionally no + ``__contains__``: the obvious ``if key in cache: data = + cache[key]`` idiom is racy across processes (another writer + can ``os.replace`` over the entry, or eviction can unlink + it, between the check and the read), and exposing + ``__contains__`` invites that pattern. ``get`` answers + both questions in one filesystem-level operation, so a + successful return always carries the bytes. + """ + + @abc.abstractmethod + def __getitem__(self, key: bytes | str) -> bytes: + """Retrieve the cached binary bytes. + + Raises + ------ + KeyError + If ``key`` is not in the cache. + """ + + @abc.abstractmethod + def __setitem__(self, key: bytes | str, value: bytes | bytearray | memoryview | ObjectCode) -> None: + """Store ``value`` under ``key``. + + Path-backed :class:`~cuda.core.ObjectCode` is read from disk at + write time so the cached entry holds the bytes, not a path. + """ + + @abc.abstractmethod + def __delitem__(self, key: bytes | str) -> None: + """Remove the entry associated with ``key``. + + Raises + ------ + KeyError + If ``key`` is not in the cache. + """ + + @abc.abstractmethod + def __len__(self) -> int: + """Return the number of entries currently in the cache. + + Implementations that store entries on disk by hashed key may + count orphaned files (entries from a previous + ``_KEY_SCHEMA_VERSION`` that are still on disk but no longer + reachable by post-bump lookups) until eviction reaps them. + Callers that need an exact count of live entries should not + rely on ``__len__`` across schema bumps. + """ + + @abc.abstractmethod + def clear(self) -> None: + """Remove every entry from the cache.""" + + def get(self, key: bytes | str, default: bytes | None = None) -> bytes | None: + """Return ``self[key]`` or ``default`` if absent.""" + try: + return self[key] + except KeyError: + return default + + def update( + self, + items: ( + collections.abc.Mapping[bytes | str, bytes | bytearray | memoryview | ObjectCode] + | collections.abc.Iterable[tuple[bytes | str, bytes | bytearray | memoryview | ObjectCode]] + ), + /, + ) -> None: + """Bulk ``__setitem__``. + + Accepts a mapping or an iterable of ``(key, value)`` pairs. Each + write goes through ``__setitem__`` so backend-specific value + coercion (e.g. extracting bytes from an :class:`~cuda.core.ObjectCode`) + and size-cap enforcement run on every entry. Not transactional -- + a failure mid-iteration leaves earlier writes committed. + """ + if isinstance(items, collections.abc.Mapping): + items = items.items() + for key, value in items: + self[key] = value + + def close(self) -> None: # noqa: B027 + """Release backend resources. + + The default implementation does nothing. Subclasses that hold + long-lived state (open file handles, database connections, + network sockets, ...) should override this to release them. + + Callers should use the context-manager form (``with cache:``) + or call :meth:`close` explicitly when finished, so code stays + portable across backends that do hold resources. + """ + + def __enter__(self) -> ProgramCacheResource: + return self + + def __exit__(self, exc_type, exc_value, traceback) -> None: + self.close() diff --git a/cuda_core/cuda/core/utils/_program_cache/_file_stream.py b/cuda_core/cuda/core/utils/_program_cache/_file_stream.py new file mode 100644 index 00000000000..1e22a739ae0 --- /dev/null +++ b/cuda_core/cuda/core/utils/_program_cache/_file_stream.py @@ -0,0 +1,759 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +"""On-disk bytes-in / bytes-out program cache. + +Atomic writes via :func:`os.replace`. Concurrent readers see either the +old entry or the new one, never a partial file. Each entry is the raw +compiled binary so files are directly consumable by external NVIDIA +tools (``cuobjdump``, ``nvdisasm``, ``cuda-gdb``). +""" + +from __future__ import annotations + +import contextlib +import errno +import hashlib +import os +import tempfile +import threading +import time +from pathlib import Path +from typing import Any, Callable, Iterable + +from cuda.core._module import ObjectCode + +from ._abc import ProgramCacheResource, _as_key_bytes, _extract_bytes + +_ENTRIES_SUBDIR = "entries" +_TMP_SUBDIR = "tmp" +# Temp files older than this are assumed to belong to a crashed writer and +# are eligible for cleanup. Picked large enough that no real ``os.replace`` +# write should still be in flight (writes are bounded by mkstemp + write + +# fsync + replace, all fast on healthy disks). +_TMP_STALE_AGE_SECONDS = 3600 + + +_SHARING_VIOLATION_WINERRORS = (5, 32, 33) # ERROR_ACCESS_DENIED, ERROR_SHARING_VIOLATION, ERROR_LOCK_VIOLATION +_REPLACE_RETRY_DELAYS = (0.0, 0.005, 0.010, 0.020, 0.050, 0.100) # ~185ms budget + + +# Exposed as a module-level flag so tests can toggle it without monkeypatching +# ``os.name`` itself (pathlib reads ``os.name`` at instantiation time). +_IS_WINDOWS = os.name == "nt" + + +def _stat_key(st: os.stat_result) -> tuple[int, int, int]: + """Stat fingerprint used by every stat-guarded path. + + ``(st_ino, st_size, st_mtime_ns)`` is the smallest triple that + distinguishes "same file" from "file replaced under us": ``st_ino`` + catches replacement, ``st_size`` and ``st_mtime_ns`` catch a write + that happens to land on the same inode (e.g. truncate-and-write in + place). Centralised so all four readers compare the same fields. + """ + return (st.st_ino, st.st_size, st.st_mtime_ns) + + +def _default_cache_dir() -> Path: + """OS-conventional default location for the file-stream cache. + + Resolves to the user-cache root for the calling user, with a + ``program-cache`` leaf so future tooling can place sibling caches + under the same ``cuda-python`` vendor directory: + + * Linux: ``$XDG_CACHE_HOME/cuda-python/program-cache`` + (default ``~/.cache/cuda-python/program-cache`` per the XDG Base + Directory spec). + * Windows: ``%LOCALAPPDATA%\\cuda-python\\program-cache`` + (Windows uses local AppData -- caches don't roam; falls back to + ``~/AppData/Local`` if the env var is unset). + + CUDA does not support macOS, so no macOS branch is provided. + """ + if _IS_WINDOWS: + local_app_data = os.environ.get("LOCALAPPDATA") + root = Path(local_app_data) if local_app_data else Path.home() / "AppData" / "Local" + else: + xdg = os.environ.get("XDG_CACHE_HOME") + root = Path(xdg) if xdg else Path.home() / ".cache" + return root / "cuda-python" / "program-cache" + + +def _with_sharing_retry( + op: Callable[..., Any], *args: Any, on_exhausted: Callable[..., Any] | None = None, **kwargs: Any +) -> Any: + """Run ``op(*args, **kwargs)`` retrying transient Windows sharing + violations under the bounded ``_REPLACE_RETRY_DELAYS`` budget. + + On Windows, ``os.replace``/``read_bytes``/``unlink`` can surface + winerror 5/32/33 (or bare EACCES via ``_is_windows_sharing_violation``) + while another process briefly holds the file open without share-delete + rights. The retry hides that contention. Other ``PermissionError``s + (real ACLs, unexpected winerror) propagate immediately. + + Successful returns and any non-``PermissionError`` exceptions + (including ``FileNotFoundError``) bubble up unchanged. After the + budget is exhausted, the helper either calls ``on_exhausted(last_exc)`` + if provided, or re-raises the last sharing-violation exception. + """ + last_exc: PermissionError | None = None + for delay in _REPLACE_RETRY_DELAYS: + if delay: + time.sleep(delay) + try: + return op(*args, **kwargs) + except PermissionError as exc: + if not _is_windows_sharing_violation(exc): + raise + last_exc = exc + if on_exhausted is not None: + return on_exhausted(last_exc) + assert last_exc is not None # at least one iteration ran and caught a PermissionError + raise last_exc + + +def _replace_with_sharing_retry(tmp_path: Path, target: Path) -> bool: + """Atomic rename with Windows-specific retry on sharing/lock violations. + + Returns True on success. Returns False only after the retry budget is + exhausted on Windows with a genuine sharing violation -- the caller then + treats the cache write as dropped. Any other ``PermissionError`` (ACLs, + read-only dir, unexpected winerror, or any POSIX failure) propagates. + + ``ERROR_ACCESS_DENIED`` (winerror 5) is treated as a sharing violation + because Windows surfaces it when a file is held open without + ``FILE_SHARE_WRITE`` (Python's default for ``open(p, "wb")``) or while + a previous unlink is in ``PENDING_DELETE`` -- both are transient. + """ + + def _do_replace() -> bool: + os.replace(tmp_path, target) + return True + + return bool(_with_sharing_retry(_do_replace, on_exhausted=lambda _exc: False)) + + +def _stat_and_read_with_sharing_retry(path: Path) -> tuple[os.stat_result, bytes]: + """Snapshot stat and read bytes, retrying briefly on Windows transient + sharing-violation ``PermissionError``. + + Reads race the rewriter's ``os.replace``: on Windows, the destination + can be momentarily inaccessible (winerror 5/32/33) while the rename + completes. Mirroring ``_replace_with_sharing_retry``'s budget keeps + transient contention from being mistaken for a real read failure. + + Raises ``FileNotFoundError`` on miss or after exhausting the Windows + sharing-retry budget. Non-Windows ``PermissionError`` propagates. + + On Windows, EACCES (errno 13) is treated as transient too: ``io.open`` + sometimes surfaces a pending-delete or share-mode mismatch as bare + EACCES with no ``winerror`` attribute, indistinguishable here from + a true sharing violation. Real ACL problems on a path the cache owns + would surface consistently; the bounded retry budget keeps the cost + of treating them as transient negligible. + """ + + def _do_stat_and_read() -> tuple[os.stat_result, bytes]: + return path.stat(), path.read_bytes() + + def _exhausted(last_exc: PermissionError) -> None: + raise FileNotFoundError(path) from last_exc + + return _with_sharing_retry(_do_stat_and_read, on_exhausted=_exhausted) # type: ignore[no-any-return] + + +_UTIME_SUPPORTS_FD = os.utime in os.supports_fd + + +def _touch_atime(path: Path, st_before: os.stat_result) -> None: + """Bump ``path``'s atime to "now", preserving its mtime, iff the + file's stat still matches ``st_before``. + + Eviction sorts by ``st_atime`` so reads must reliably refresh atime + regardless of OS or filesystem default behavior: + + * Linux ``relatime`` (default) only updates atime when the existing + atime is older than mtime, which would skew LRU once an entry has + been read once. + * NTFS on Windows Vista+ disables atime updates by default + (``NtfsDisableLastAccessUpdate``) and most modern installations + keep that off, so a bare read never bumps atime. + * ``noatime``-mounted filesystems disable updates entirely. + + Calling ``os.utime`` with explicit times bypasses all of the above + and writes atime directly. The stat-guard is critical: if another + process ``os.replace``-d a fresh entry into ``path`` between the + read and this touch, blindly applying ``st_before.st_mtime_ns`` + would roll the new entry's mtime back to the old value and confuse + the eviction stat-guard (which checks ``(ino, size, mtime_ns)``) + into deleting a freshly-committed file. + + Where ``os.utime`` supports file descriptors (Linux, macOS), the + fstat-then-utime pair runs against the same open fd: even if another + writer replaces the path between our ``os.open`` and the ``fstat``, + the fd still refers to the file we opened, so the comparison and the + utime both target the same inode. This closes the residual TOCTOU + window that a path-based stat + path-based utime would have. + + On Windows, ``os.utime`` is path-only; the fallback re-stats the + path and accepts a small TOCTOU window between the second stat and + the utime. That window is microseconds and the worst-case outcome + is the racing writer's mtime being rolled back by a few hundred + nanoseconds -- the eviction stat-guard would then refuse to evict + the slightly-stale entry, costing one cache miss (recompile) but + not a corrupt eviction. + + Best-effort: any ``OSError`` (read-only mount, restrictive ACLs, + ...) is swallowed -- size enforcement still bounds the cache, but + eviction degrades toward FIFO. + """ + new_atime_ns = time.time_ns() + if _UTIME_SUPPORTS_FD: + try: + fd = os.open(path, os.O_RDONLY) + except OSError: + return + try: + try: + st_now = os.fstat(fd) + except OSError: + return + if _stat_key(st_now) != _stat_key(st_before): + return + with contextlib.suppress(OSError): + os.utime(fd, ns=(new_atime_ns, st_before.st_mtime_ns)) + finally: + os.close(fd) + return + + # Path-based fallback (Windows). Best-effort -- residual TOCTOU window + # documented above. + try: + st_now = path.stat() + except OSError: + return + if _stat_key(st_now) != _stat_key(st_before): + return + with contextlib.suppress(OSError): + os.utime(path, ns=(new_atime_ns, st_before.st_mtime_ns)) + + +def _is_windows_sharing_violation(exc: BaseException) -> bool: + """Return True if ``exc`` is a Windows sharing/lock violation that + :func:`_unlink_with_sharing_retry` would have retried. + + Used by best-effort callers to filter out the exhausted-retry case + while letting other ``PermissionError`` instances (POSIX ACL + issues, Windows non-sharing winerrors) propagate -- those are real + configuration problems, not transient contention. + + The ``EACCES`` fallback only fires when ``winerror`` is absent: a + bare ``EACCES`` (no winerror attached) is the way ``io.open`` + surfaces a pending-delete or share-mode mismatch on Windows. When + ``winerror`` IS set but is NOT in the sharing set, the OS told us + exactly what failed and it isn't a sharing violation -- treating it + as transient would silently swallow real errors like a corrupt + ACL. + """ + if not _IS_WINDOWS: + return False + if not isinstance(exc, PermissionError): + return False + winerror = getattr(exc, "winerror", None) + if winerror in _SHARING_VIOLATION_WINERRORS: + return True + return winerror is None and exc.errno == errno.EACCES + + +def _unlink_with_sharing_retry(path: Path) -> None: + """Unlink with Windows-specific retry on sharing/lock violations. + + On Windows, ``Path.unlink`` raises ``PermissionError`` (winerror 5, + 32, or 33; sometimes bare ``EACCES``) when another process holds + the file open without ``FILE_SHARE_DELETE``. Python's default + ``open(p, "rb")`` does not pass that flag, so a reader from another + process briefly blocks our unlink while it reads. Retry with the + same backoff budget as :func:`_replace_with_sharing_retry` so + transient contention is not turned into a propagated error. + + Raises ``FileNotFoundError`` if the file is absent; the last + ``PermissionError`` if the Windows retry budget is exhausted; and + propagates any non-sharing ``PermissionError`` (or any non-Windows + ``PermissionError``) immediately. Best-effort callers should use + :func:`_is_windows_sharing_violation` to filter the exhausted-retry + case and re-raise any other ``PermissionError``. + """ + _with_sharing_retry(path.unlink) + + +def _prune_if_stat_unchanged(path: Path, st_before: os.stat_result) -> None: + """Unlink ``path`` iff its stat still matches ``st_before``. + + Guards against a cross-process race: a reader that sees a corrupt + record can have it atomically replaced (via ``os.replace``) by a + writer before the reader decides to prune. Comparing + ``(ino, size, mtime_ns)`` before and after rules out that case -- + any mismatch means someone else wrote a new file and we must not + delete their work. The residual TOCTOU window between stat and + unlink is narrow; worst case, a very-recently-written entry is + removed and the next read recompiles. + + Best-effort: a Windows sharing violation that survives the retry + budget leaves the file in place. The caller is in an eviction or + cleanup pass, so re-trying on the next pass is the right outcome. + """ + try: + st_now = path.stat() + except FileNotFoundError: + return + if _stat_key(st_before) != _stat_key(st_now): + return + try: + _unlink_with_sharing_retry(path) + except FileNotFoundError: + pass + except PermissionError as exc: + # Swallow only the exhausted-Windows-sharing case. POSIX ACL + # errors and Windows non-sharing winerrors are real configuration + # problems and must surface, not be silently lost during a prune. + if not _is_windows_sharing_violation(exc): + raise + + +class FileStreamProgramCache(ProgramCacheResource): + """Persistent program cache backed by a directory of atomic files. + + Designed for multi-process use: writes stage a temporary file and then + :func:`os.replace` it into place, so concurrent readers never observe a + partially-written entry. Each entry on disk is the raw compiled binary + -- cubin / PTX / LTO-IR -- with no header, framing, or pickle wrapper, + so the files are directly consumable by external NVIDIA tools + (``cuobjdump``, ``nvdisasm``, ``cuda-gdb``). + + Eviction is by least-recently-*read* time: every successful read bumps + the entry's ``atime``, and the size enforcer evicts oldest atime + first. + + .. note:: **Best-effort writes.** + + On Windows, ``os.replace`` raises ``PermissionError`` (winerror + 32 / 33) when another process holds the target file open. This + backend retries with bounded backoff (~185 ms) and, if still + failing, drops the cache write silently and returns success-shaped + control flow. The next call will see no entry and recompile. POSIX + and other ``PermissionError`` codes propagate. + + .. note:: **Atomic for readers, not crash-durable.** + + Each entry's temp file is ``fsync``-ed before ``os.replace``, but + the containing directory is **not** ``fsync``-ed. A host crash + between write and the next directory commit may lose recently + added entries; surviving entries remain consistent. + + .. note:: **Cross-version sharing.** + + The cache is safe to share across ``cuda.core`` patch releases: + every key produced by :func:`make_program_cache_key` encodes the + relevant backend/compiler/runtime fingerprints for its + compilation path (NVRTC entries pin the NVRTC version, NVVM + entries pin the libNVVM library and IR versions, PTX/linker + entries pin the chosen linker backend and its version -- and, + when the cuLink/driver backend is selected, the driver version + too; nvJitLink-backed PTX entries are deliberately + driver-version independent). Bumping ``_KEY_SCHEMA_VERSION`` + (mixed into the digest by ``make_program_cache_key``) produces + new keys that don't collide with old entries: post-bump + lookups miss the old on-disk paths, and the orphaned files + are reaped on the next size-cap eviction pass. Entries are + stored verbatim as the compiled binary, so cross-patch sharing + only requires that the compiler-pinning surface above stays + stable -- there is no Python-pickle compatibility involved. + + Parameters + ---------- + path: + Directory that owns the cache. Created if missing. If omitted, + the OS-conventional user cache directory is used: + ``$XDG_CACHE_HOME/cuda-python/program-cache`` (Linux, defaulting + to ``~/.cache/cuda-python/program-cache``) or + ``%LOCALAPPDATA%\\cuda-python\\program-cache`` (Windows). + max_size_bytes: + Optional soft cap on total on-disk size. Enforced opportunistically + on writes; concurrent writers may briefly exceed it. Eviction is by + least-recently-read time (oldest ``st_atime`` first). + """ + + def __init__( + self, + path: str | os.PathLike[str] | None = None, + *, + max_size_bytes: int | None = None, + ) -> None: + if max_size_bytes is not None and max_size_bytes <= 0: + raise ValueError("max_size_bytes must be positive or None (0 would evict every write)") + self._root = Path(path) if path is not None else _default_cache_dir() + self._entries = self._root / _ENTRIES_SUBDIR + self._tmp = self._root / _TMP_SUBDIR + self._max_size_bytes = max_size_bytes + self._root.mkdir(parents=True, exist_ok=True) + self._entries.mkdir(exist_ok=True) + self._tmp.mkdir(exist_ok=True) + # Opportunistic startup sweep of orphaned temp files left by any + # crashed writers. Age-based so concurrent in-flight writes from + # other processes are preserved. + self._sweep_stale_tmp_files() + # Incremental size tracker. Without it every ``__setitem__`` would + # walk ``entries/`` + ``tmp/`` to compute the total -- O(n) per + # write. With it: writes update the tracker by the net delta in O(1) + # and only walk on eviction (which already needs the scan to sort + # entries by atime). The tracker is seeded by one full scan at open + # time and refreshed on every eviction pass; cross-process drift + # (other writers/deleters) self-corrects the next time eviction + # fires. The lock guards mutations so multi-threaded writers in + # the same process don't interleave the read-modify-write on the + # int. Skipped entirely when ``max_size_bytes is None`` -- without + # a cap the tracker is dead weight. + self._size_lock = threading.Lock() + self._tracked_size_bytes = self._compute_total_size() if max_size_bytes is not None else 0 + + # -- key-to-path helpers ------------------------------------------------- + + def _path_for_key(self, key: object) -> Path: + k = _as_key_bytes(key) + # Hash the key to a fixed-length identifier so arbitrary-length user + # keys never exceed per-component filename limits (typically 255 on + # ext4 / NTFS). + # + # FIPS: must use a FIPS-approved hash algorithm. FIPS-enforcing + # systems can disable non-approved hashlib algorithms (for example + # blake2b) at the OpenSSL level. See #2043. + # + # With a 256-bit SHA-256 digest, the cache relies on collision + # resistance for key uniqueness -- two distinct keys hashing to the + # same path is astronomically unlikely (~2^128 practical collision + # work). + digest = hashlib.sha256(k, usedforsecurity=False).hexdigest() + return self._entries / digest[:2] / digest[2:] + + # -- mapping API --------------------------------------------------------- + + def __getitem__(self, key: object) -> bytes: + path = self._path_for_key(key) + try: + # The helper retries on Windows transient sharing-violation + # PermissionErrors so a racing rewriter doesn't turn a hit + # into a spurious propagated error. + st, data = _stat_and_read_with_sharing_retry(path) + except FileNotFoundError: + raise KeyError(key) from None + # Bump atime to "now" so eviction (which sorts by st_atime) treats + # this read as the entry's most recent use. Best-effort: filesystems + # mounted ``noatime`` or with restrictive ACLs may refuse, in which + # case the cap still bounds size but eviction degrades toward FIFO + # rather than true LRU. + _touch_atime(path, st) + return data + + def __setitem__(self, key: object, value: bytes | bytearray | memoryview | ObjectCode) -> None: + data = _extract_bytes(value) + target = self._path_for_key(key) + target.parent.mkdir(parents=True, exist_ok=True) + # Re-create ``tmp/`` if something deleted it after ``__init__`` + # (operators clearing the cache by hand, ``rm -rf cache_dir/tmp``, + # another process's overzealous wipe). Cheap and idempotent; + # without it, every subsequent write would crash with + # FileNotFoundError even though we could trivially recover. + self._tmp.mkdir(parents=True, exist_ok=True) + + # Stat the existing entry (if any) BEFORE the replace so we can + # update the tracker by the net delta. A racing writer that lands + # an ``os.replace`` between this stat and our own makes ``old_size`` + # slightly off; the next ``_enforce_size_cap`` reconciles by + # re-scanning. Skipped when ``max_size_bytes is None`` (no tracker). + old_size = 0 + if self._max_size_bytes is not None: + try: + old_size = target.stat().st_size + except FileNotFoundError: + old_size = 0 + + fd, tmp_name = tempfile.mkstemp(prefix="entry-", dir=self._tmp) + tmp_path = Path(tmp_name) + try: + with os.fdopen(fd, "wb") as fh: + fh.write(data) + fh.flush() + os.fsync(fh.fileno()) + # Retry os.replace under Windows sharing/lock violations; only + # give up (and drop the cache write) after a bounded backoff, so + # transient contention is not turned into a silent miss. + # Non-sharing PermissionErrors and all POSIX PermissionErrors + # propagate immediately (real config problem). + if not _replace_with_sharing_retry(tmp_path, target): + with contextlib.suppress(FileNotFoundError): + tmp_path.unlink() + return + except BaseException: + with contextlib.suppress(FileNotFoundError): + tmp_path.unlink() + raise + + if self._max_size_bytes is None: + return + + # O(1) tracker update. Only run the scan-heavy ``_enforce_size_cap`` + # when this write actually pushes the running total above the cap. + new_size = len(data) + with self._size_lock: + self._tracked_size_bytes += new_size - old_size + over_cap = self._tracked_size_bytes > self._max_size_bytes + if over_cap: + self._enforce_size_cap() + + def __delitem__(self, key: object) -> None: + path = self._path_for_key(key) + # Stat before unlink so we can decrement the tracker by the actual + # on-disk size. Best-effort: if the file vanishes between stat and + # unlink (concurrent eviction), we treat the delete as a miss -- + # matching the behaviour callers expect (KeyError) and leaving the + # tracker untouched (the racing eviction already accounted for it). + size = 0 + if self._max_size_bytes is not None: + try: + size = path.stat().st_size + except FileNotFoundError: + raise KeyError(key) from None + try: + _unlink_with_sharing_retry(path) + except FileNotFoundError: + raise KeyError(key) from None + if self._max_size_bytes is not None: + with self._size_lock: + # Clamp at zero. A racing ``_enforce_size_cap`` can re-seed the + # tracker between our stat and our subtract; if its scan ran + # AFTER we unlinked, its reseed value didn't include ``size``, + # so subtracting ``size`` again here would undercount reality + # by ``size``. Repeated under contention, an unclamped subtract + # walks the tracker negative -- and once negative, the + # ``tracker > cap`` check that gates ``_enforce_size_cap`` + # never fires, so eviction dies silently and there is no + # self-healing path (the only reseed point is the function + # that no longer runs). Clamping leaves us at worst + # undercounting (the next reseed corrects it) instead of + # entering the permanently-broken negative state. + self._tracked_size_bytes = max(0, self._tracked_size_bytes - size) + + def __len__(self) -> int: + """Return the number of files currently in ``entries/``. + + This is a count of on-disk files, not of keys reachable through + ``make_program_cache_key``. After a ``_KEY_SCHEMA_VERSION`` bump + old entries become unreachable by lookup but remain on disk + until eviction reaps them; ``__len__`` keeps counting them + until then. The same is true for entries written by callers + using arbitrary user keys -- the backend has no way to tell a + live entry from an orphan without knowing the caller's keying + scheme. + """ + # ``_iter_entry_paths`` already filters with ``entry.is_file()``, + # so don't stat each path a second time here. + return sum(1 for _ in self._iter_entry_paths()) + + def clear(self) -> None: + # Snapshot stat alongside path so we can refuse to unlink an entry + # that was concurrently replaced by another process between the + # snapshot scan and the unlink. Same stat-guard contract as + # ``_prune_if_stat_unchanged`` and ``_enforce_size_cap``. + snapshot = [] + for path in self._iter_entry_paths(): + try: + snapshot.append((path, path.stat())) + except FileNotFoundError: + continue + for path, st_before in snapshot: + _prune_if_stat_unchanged(path, st_before) + # Sweep ONLY stale temp files. Deleting a young temp would race with + # another process between ``mkstemp`` and ``os.replace`` and turn its + # write into ``FileNotFoundError`` instead of a successful commit. + self._sweep_stale_tmp_files() + # Remove empty subdirs (best-effort; concurrent writers may re-create). + if self._entries.exists(): + for sub in sorted(self._entries.iterdir(), reverse=True): + if sub.is_dir(): + with contextlib.suppress(OSError): + sub.rmdir() + # The directory is now (almost) empty -- but a concurrent writer may + # have landed a fresh entry between the snapshot and the unlink, and + # young temp files were intentionally preserved. Re-derive the + # tracker from the post-clear state instead of zeroing blindly. + if self._max_size_bytes is not None: + actual = self._compute_total_size() + with self._size_lock: + self._tracked_size_bytes = actual + + # -- internals ----------------------------------------------------------- + + def _iter_entry_paths(self) -> Iterable[Path]: + # ``os.scandir`` returns ``DirEntry`` objects whose ``is_dir`` / + # ``is_file`` methods consult the cached dirent type from the + # ``readdir`` result on filesystems that report it (ext4, NTFS, ...), + # avoiding a per-entry ``stat`` syscall. ``Path.iterdir`` also wraps + # ``scandir`` but discards the cached type, forcing a separate + # ``stat`` for every ``Path.is_dir`` / ``Path.is_file``. The ``with`` + # blocks release the underlying directory handle deterministically + # when the consumer stops early -- otherwise a leaked handle blocks + # deletes/renames on Windows until GC. + try: + with os.scandir(self._entries) as outer: + for sub in outer: + if not sub.is_dir(follow_symlinks=False): + continue + try: + with os.scandir(sub.path) as inner: + yield from (Path(entry.path) for entry in inner if entry.is_file(follow_symlinks=False)) + except FileNotFoundError: + continue + except FileNotFoundError: + return + + def _compute_total_size(self) -> int: + """Walk ``entries/`` + ``tmp/`` and return the on-disk byte total. + + Used to seed the tracker at open time and to refresh it after every + eviction pass. Best-effort: files that vanish under us during the + walk (concurrent eviction by this or another process) are skipped. + Tracked total may briefly differ from this scan's result under + cross-process contention; the next eviction will reconcile. + """ + total = 0 + for path in self._iter_entry_paths(): + try: + total += path.stat().st_size + except FileNotFoundError: + continue + return total + self._sum_tmp_sizes() + + def _iter_tmp_entries(self) -> Iterable[os.DirEntry[str]]: + # Mirror ``_iter_entry_paths``: scandir + cached d_type for the + # file/dir filter + deterministic handle close on early exit. + # Yields ``DirEntry`` (not Path) so callers can use ``entry.stat`` + # / ``entry.path`` directly without an extra wrap. + try: + with os.scandir(self._tmp) as it: + yield from (entry for entry in it if entry.is_file(follow_symlinks=False)) + except FileNotFoundError: + return + + def _sum_tmp_sizes(self) -> int: + """Sum sizes of every file in ``tmp/``, skipping vanished entries. + + Both ``_compute_total_size`` (open-time seed) and + ``_enforce_size_cap`` (eviction reconciliation) need this -- + temp files occupy disk too, so undercounting them would let + bursts of in-flight writes silently exceed ``max_size_bytes``. + """ + total = 0 + for entry in self._iter_tmp_entries(): + try: + total += entry.stat(follow_symlinks=False).st_size + except FileNotFoundError: + continue + return total + + def _sweep_stale_tmp_files(self) -> None: + """Remove temp files left behind by crashed writers. + + Age threshold is conservative (``_TMP_STALE_AGE_SECONDS``) so an + in-flight write from another process is not interrupted. Best + effort: a missing file or a permission failure is ignored. + """ + cutoff = time.time() - _TMP_STALE_AGE_SECONDS + for entry in self._iter_tmp_entries(): + try: + if entry.stat(follow_symlinks=False).st_mtime < cutoff: + os.unlink(entry.path) + except (FileNotFoundError, PermissionError): + continue + + def _enforce_size_cap(self) -> None: + if self._max_size_bytes is None: + return + # Sweep stale temp files first so a long-dead writer's leftovers + # don't drag the apparent size up and force needless eviction. + self._sweep_stale_tmp_files() + entries = [] + total = 0 + # Count both committed entries AND surviving temp files: temp files + # occupy disk too, even if they're young. Without this the soft cap + # silently undercounts in-flight writes. + # + # Trade-off under burst concurrency: many young temp files (each + # below the stale-sweep threshold) can push ``total`` above + # ``max_size_bytes`` with only committed entries left to evict. + # That can over-evict committed entries during the burst; once + # the burst subsides and the temps land via ``os.replace`` (or + # are reaped by a later sweep), the cap re-stabilises. This is + # consistent with the documented soft-cap contract -- callers + # that need a hard bound should leave the cap None and prune + # externally. + for path in self._iter_entry_paths(): + try: + st = path.stat() + except FileNotFoundError: + continue + # Carry the full stat so eviction can guard against a concurrent + # os.replace that swapped a fresh entry into this path between + # snapshot and unlink. Eviction below sorts by ``st_atime`` so + # entries that callers actually read recently survive + # write-only churn (true LRU instead of FIFO). + entries.append((st.st_atime, st.st_size, path, st)) + total += st.st_size + total += self._sum_tmp_sizes() + if total <= self._max_size_bytes: + # Re-seed the tracker from the scan: catches drift from + # cross-process writers/deleters that the per-write delta + # accounting wouldn't have observed. Reaching here means the + # tracker was over-cap but the disk truth is under-cap, so + # this assignment is the cheapest reconciliation point we get. + with self._size_lock: + self._tracked_size_bytes = total + return + entries.sort(key=lambda e: e[0]) # oldest atime first + for _atime, size, path, st_before in entries: + if total <= self._max_size_bytes: + break + # _prune_if_stat_unchanged refuses if a writer replaced the file + # between snapshot and now, so eviction can't silently delete a + # freshly-committed entry from another process. + try: + stat_now = path.stat() + except FileNotFoundError: + total -= size + continue + if _stat_key(stat_now) != _stat_key(st_before): + # File was replaced -- don't unlink, but update ``total`` to + # reflect the replacement's actual size or the cap check + # below could declare us done while still over the limit. + total += stat_now.st_size - size + continue + # Tolerate Windows sharing violations during eviction: another + # process may briefly hold the file open for a read. Skip this + # entry; a later eviction pass will retry. Same outcome as if + # the stat-guard above had triggered. Other PermissionErrors + # (POSIX ACL, Windows non-sharing winerrors) are real config + # problems -- surface them rather than silently exceed the cap. + try: + _unlink_with_sharing_retry(path) + total -= size + except FileNotFoundError: + pass + except PermissionError as exc: + if not _is_windows_sharing_violation(exc): + raise + # Reconcile: after the eviction pass, ``total`` reflects what we + # believe the disk now holds. Re-seed the tracker so the next write + # accumulates from a fresh baseline. + with self._size_lock: + self._tracked_size_bytes = total diff --git a/cuda_core/cuda/core/utils/_program_cache/_in_memory.py b/cuda_core/cuda/core/utils/_program_cache/_in_memory.py new file mode 100644 index 00000000000..6a25e2afbc6 --- /dev/null +++ b/cuda_core/cuda/core/utils/_program_cache/_in_memory.py @@ -0,0 +1,127 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +"""In-memory bytes-in / bytes-out program cache.""" + +from __future__ import annotations + +import collections +import threading + +from cuda.core._module import ObjectCode + +from ._abc import ProgramCacheResource, _as_key_bytes, _extract_bytes + + +class InMemoryProgramCache(ProgramCacheResource): + """In-memory program cache with LRU eviction. + + Suitable for single-process workflows that want to avoid disk I/O -- + a typical application compiles its kernels once per process and + looks them up many times. Entries live only for the lifetime of + the process; use :class:`FileStreamProgramCache` when the cache + should persist across runs. + + Like :class:`FileStreamProgramCache`, this backend is bytes-in / + bytes-out: ``__setitem__`` accepts ``bytes``, ``bytearray``, + ``memoryview``, or any :class:`~cuda.core.ObjectCode` (path-backed + too -- the file is read at write time so the cached entry holds the + binary content, not a path). ``__getitem__`` returns ``bytes``. + + Parameters + ---------- + max_size_bytes: + Optional cap on the sum of stored payload sizes. When exceeded, + LRU eviction runs until the total fits. ``None`` means + unbounded. The size-only bound mirrors + :class:`FileStreamProgramCache`. + + Notes + ----- + Recency is updated on :meth:`__getitem__`; ``get`` is the + recommended lookup since the cache deliberately omits + ``__contains__`` (the ``if key in cache: ...`` idiom is racy + across processes; see :class:`ProgramCacheResource`). + + Thread safety: a :class:`threading.RLock` serialises every method, + so the cache can be shared across threads without external + locking. + """ + + def __init__( + self, + *, + max_size_bytes: int | None = None, + ) -> None: + if max_size_bytes is not None and max_size_bytes <= 0: + raise ValueError("max_size_bytes must be positive or None (0 would evict every write)") + self._max_size_bytes = max_size_bytes + # Key insertion order encodes LRU order: oldest first, newest last. + # Each value is ``(payload_bytes, payload_size)``; caching the size + # avoids recomputing ``len(data)`` on every eviction pass. + self._entries: collections.OrderedDict[bytes, tuple[bytes, int]] = collections.OrderedDict() + self._total_bytes = 0 + # Reentrant so helper methods that also take the lock can nest + # without deadlocking. + self._lock = threading.RLock() + + def __getitem__(self, key: object) -> bytes: + k = _as_key_bytes(key) + with self._lock: + try: + data, _size = self._entries[k] + except KeyError: + raise KeyError(key) from None + # Touch LRU: a real read promotes the entry to "most recent" + # so eviction prefers genuinely cold entries. + self._entries.move_to_end(k) + return data + + def __setitem__(self, key: object, value: bytes | bytearray | memoryview | ObjectCode) -> None: + data = _extract_bytes(value) + size = len(data) + k = _as_key_bytes(key) + with self._lock: + existing = self._entries.pop(k, None) + if existing is not None: + self._total_bytes -= existing[1] + self._entries[k] = (data, size) + self._total_bytes += size + self._evict_to_caps() + + def __delitem__(self, key: object) -> None: + k = _as_key_bytes(key) + with self._lock: + try: + _data, size = self._entries.pop(k) + except KeyError: + raise KeyError(key) from None + self._total_bytes -= size + + def __len__(self) -> int: + with self._lock: + return len(self._entries) + + def clear(self) -> None: + with self._lock: + self._entries.clear() + self._total_bytes = 0 + + # -- eviction ------------------------------------------------------------ + + def _evict_to_caps(self) -> None: + """Evict oldest entries until the size cap is satisfied. + + Called from ``__setitem__`` after an insert/update. Pops from + the front of the OrderedDict (oldest first). If the + just-inserted entry on its own exceeds ``max_size_bytes``, the + loop will evict it too -- mirroring + :class:`FileStreamProgramCache` (a write that cannot fit does + not survive its own size-cap pass). + """ + if self._max_size_bytes is None: + return + while self._entries and self._total_bytes > self._max_size_bytes: + _k, (_data, size) = self._entries.popitem(last=False) + self._total_bytes -= size diff --git a/cuda_core/cuda/core/utils/_program_cache/_keys.py b/cuda_core/cuda/core/utils/_program_cache/_keys.py new file mode 100644 index 00000000000..e170bc18131 --- /dev/null +++ b/cuda_core/cuda/core/utils/_program_cache/_keys.py @@ -0,0 +1,822 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +"""Cache-key construction. + +A backend-strategy hierarchy (:class:`_KeyBackend`) owns the per-code-type +guard / fingerprint / version-probe logic; :func:`make_program_cache_key` +dispatches to the right backend and assembles the digest. +""" + +from __future__ import annotations + +import abc +import collections.abc +import hashlib +from typing import Any, Callable, Sequence + +# Mutual-dependency contract: this module imports ProgramOptions from +# cuda.core._program at module level, and cuda.core._program imports +# ProgramCacheResource / make_program_cache_key from cuda.core.utils +# only via deferred imports inside ``Program.compile``. Adding a +# top-level ``from cuda.core.utils import ...`` to _program.pyx would +# turn this into a real import cycle -- keep the import in _program.pyx +# deferred (or import the symbols from the leaf submodule directly). +from cuda.core._program import ProgramOptions +from cuda.core._utils.cuda_utils import ( + driver as _driver, +) +from cuda.core._utils.cuda_utils import ( + handle_return as _handle_return, +) +from cuda.core._utils.cuda_utils import ( + nvrtc as _nvrtc, +) +from cuda.core._utils.validators import check_str_enum, format_or_list +from cuda.core.typing import SourceCodeType + +# Bump when the key schema changes in a way that invalidates existing caches. +_KEY_SCHEMA_VERSION = 2 + +_VALID_TARGET_TYPES = frozenset({"ptx", "cubin", "ltoir"}) + +# code_type -> allowed target_type set, mirroring Program.compile's +# SUPPORTED_TARGETS matrix in _program.pyx. +_SUPPORTED_TARGETS_BY_CODE_TYPE = { + "c++": frozenset({"ptx", "cubin", "ltoir"}), + "ptx": frozenset({"cubin", "ptx"}), + "nvvm": frozenset({"ptx", "ltoir"}), +} + + +# Map each ProgramOptions field that reaches the Linker via +# _translate_program_options (see cuda_core/cuda/core/_program.pyx) to the +# gate the Linker uses to turn it into a flag (see +# ``_prepare_nvjitlink_options`` and ``_prepare_driver_options`` in +# _linker.pyx). All other fields on ProgramOptions are NVRTC-only and must +# NOT perturb a PTX cache key: a PTX compile with a shared ProgramOptions +# that happens to set include_path/pch/frandom_seed would otherwise miss the +# cache unnecessarily. Collapsing inputs through these gates means +# semantically-equivalent configurations (``debug=False`` vs ``None``, +# ``time=True`` vs ``time="path"``) hash to the same cache key instead of +# forcing spurious misses. Single source of truth: every reader iterates +# this dict, so adding a field here is enough -- there is no parallel +# field-name list to keep in sync. +def _gate_presence(v: Any) -> bool: + return v is not None + + +def _gate_truthy(v: Any) -> bool: + return bool(v) + + +def _gate_is_true(v: Any) -> bool: + return v is True + + +def _gate_tristate_bool(v: Any) -> bool | None: + return None if v is None else bool(v) + + +def _gate_identity(v: Any) -> Any: + return v + + +def _gate_ptxas_options(v: Any) -> Any: + # ``_prepare_nvjitlink_options`` emits one ``-Xptxas=`` per element, and + # treats ``str`` as a single-element sequence. Canonicalize to a tuple so + # ``"-v"`` / ``["-v"]`` / ``("-v",)`` all hash the same. An empty sequence + # emits no flags, so collapse it to ``None`` too. + # + # Order is preserved on purpose: ptxas accepts ordering-sensitive flag + # pairs (e.g. ``-O2`` after ``-O3`` lowers the active level), so + # ``["-v", "-O2"]`` and ``["-O2", "-v"]`` are not guaranteed to produce + # identical bytes. We accept the spurious miss when callers reorder + # flags; treating order as semantic keeps the cache safe in the + # ordering-sensitive case. + if v is None: + return None + if isinstance(v, str): + return ("-Xptxas=" + v,) + if isinstance(v, collections.abc.Sequence): + if len(v) == 0: + return None + return tuple(f"-Xptxas={s}" for s in v) + return v + + +_LINKER_FIELD_GATES = { + "name": _gate_identity, + "arch": _gate_identity, + "max_register_count": _gate_identity, + "time": _gate_presence, # linker emits ``-time`` iff value is not None + "link_time_optimization": _gate_truthy, + "debug": _gate_truthy, + "lineinfo": _gate_truthy, + "ftz": _gate_tristate_bool, + "prec_div": _gate_tristate_bool, + "prec_sqrt": _gate_tristate_bool, + "fma": _gate_tristate_bool, + "split_compile": _gate_identity, + "ptxas_options": _gate_ptxas_options, + "no_cache": _gate_is_true, +} + + +# LinkerOptions fields the ``cuLink`` driver backend silently ignores +# (emits only a DeprecationWarning; no actual flag reaches the compiler). +# When the driver backend is active, collapse them to a single sentinel in +# the fingerprint so nvJitLink<->driver parity of ``ObjectCode`` doesn't +# cause cache misses from otherwise-equivalent configurations. +_DRIVER_IGNORED_LINKER_FIELDS = frozenset({"ftz", "prec_div", "prec_sqrt", "fma"}) + + +def _linker_option_fingerprint(options: ProgramOptions, *, use_driver_linker: bool | None) -> list[bytes]: + """Backend-aware fingerprint of ProgramOptions fields consumed by the Linker. + + Each field passes through the gate the Linker itself uses so equivalent + inputs (e.g. ``debug=False`` / ``None``) hash to the same bytes. When + the driver (cuLink) linker backend is in use, fields it silently + ignores collapse to one sentinel so those options don't perturb the + key on driver-backed hosts either. ``use_driver_linker=None`` means we + couldn't probe the backend; we don't collapse driver-ignored fields in + that case, to stay conservative. + """ + parts = [] + driver_ignored = use_driver_linker is True + for name, gate in _LINKER_FIELD_GATES.items(): + if driver_ignored and name in _DRIVER_IGNORED_LINKER_FIELDS: + parts.append(f"{name}=".encode()) + continue + gated = gate(getattr(options, name, None)) + parts.append(f"{name}={gated!r}".encode()) + return parts + + +# ProgramOptions fields that map to LinkerOptions fields the cuLink (driver) +# backend rejects outright (see _prepare_driver_options in _linker.pyx). +# ``split_compile_extended`` exists on LinkerOptions but is not exposed via +# ProgramOptions / _translate_program_options, so it cannot reach the driver +# linker from the cache path and is omitted here. +_DRIVER_LINKER_UNSUPPORTED_FIELDS = ("time", "ptxas_options", "split_compile") + + +def _driver_version() -> int: + return int(_handle_return(_driver.cuDriverGetVersion())) + + +def _nvrtc_version() -> tuple[int, int]: + major, minor = _handle_return(_nvrtc.nvrtcVersion()) + return int(major), int(minor) + + +def _linker_backend_and_version(use_driver: bool) -> tuple[str, str]: + """Return ``(backend, version)`` for the linker used on PTX inputs. + + ``use_driver`` is the result of ``_decide_nvjitlink_or_driver()`` and + must be passed in so a single ``make_program_cache_key`` call shares + one probe across :meth:`_LinkerBackend.validate`, + :meth:`option_fingerprint`, and :meth:`hash_version_probe` (otherwise + a transient probe flap could write inconsistent fields into the same + key). + + Raises any underlying probe exception. ``make_program_cache_key`` catches + and mixes the exception's class name into the digest, so the same probe + failure produces the same key across processes -- the cache stays + persistent in broken environments, while never sharing a key with a + working probe (``_probe_failed`` label vs. ``driver``/``nvrtc``/...). + + nvJitLink version lookup goes through ``sys.modules`` first so we hit the + same module ``_decide_nvjitlink_or_driver()`` already loaded. That keeps + fingerprinting aligned with whichever ``cuda.bindings.nvjitlink`` import + path the linker actually uses. + """ + import sys + + if use_driver: + return ("driver", str(_driver_version())) + nvjitlink = sys.modules.get("cuda.bindings.nvjitlink") + if nvjitlink is None: + from cuda.bindings import nvjitlink as _nvjitlink + + nvjitlink = _nvjitlink + + return ("nvJitLink", str(nvjitlink.version())) + + +def _nvvm_fingerprint() -> str: + """Stable identifier for the loaded NVVM toolchain. + + Combines the libNVVM library version (``module.version()``) with the IR + version reported by ``module.ir_version()``. The library version is the + primary invalidation lever: a libNVVM patch upgrade can change codegen + while keeping the same IR major/minor, so keying only on the IR pair + would silently reuse stale entries. Paired with cuda-core, the IR pair + adds defence in depth without making the key any less stable. + + Both calls go through ``_get_nvvm_module()`` so this fingerprint follows + the same availability / cuda-bindings-version gate that real NVVM + compilation does -- if NVVM is unusable at compile time, the probe + fails the same way and ``_probe`` mixes the failure label into the key. + """ + from cuda.core._program import _get_nvvm_module + + module = _get_nvvm_module() + lib_major, lib_minor = module.version() # type: ignore[attr-defined] + major, minor, debug_major, debug_minor = module.ir_version() # type: ignore[attr-defined] + return f"lib={lib_major}.{lib_minor};ir={major}.{minor}.{debug_major}.{debug_minor}" + + +# ProgramOptions fields that reference external files whose *contents* the +# cache key cannot observe without reading the filesystem. Callers that set +# any of these must supply an ``extra_digest`` covering the dependency surface +# (e.g. a hash over all reachable headers / PCH bytes). +_EXTERNAL_CONTENT_OPTIONS = ( + "include_path", + "pre_include", + "pch", + "use_pch", + "pch_dir", +) + +# ProgramOptions fields whose compilation effect is not captured in the +# returned ``ObjectCode`` -- they produce a filesystem artifact as a side +# effect. A cache hit skips compilation, so that artifact would never be +# written. Reject these outright: the persistent cache is for pure ObjectCode +# reuse, not for replaying compile-time side effects. +# * create_pch -- writes a PCH file (NVRTC). +# * time -- writes NVRTC timing info to a file. +# * fdevice_time_trace -- writes a device-compilation time trace file (NVRTC). +# These are all NVRTC-specific; the Linker's ``-time`` logs to the info log +# (not a file) and NVVM explicitly rejects all three at compile time. The +# side-effect guard is therefore gated on ``backend == "nvrtc"`` below. +_SIDE_EFFECT_OPTIONS = ("create_pch", "time", "fdevice_time_trace") + + +# ProgramOptions fields gated by plain truthiness in ``_program.pyx`` (the +# compiler writes the flag only when the value is truthy). +_BOOLEAN_OPTION_FIELDS = frozenset({"pch"}) + +# Fields whose compiler emission requires ``isinstance(value, str)`` or a +# non-empty sequence; anything else (``False``, ``int``, ``None``, ``[]``) +# is silently ignored at compile time. +_STR_OR_SEQUENCE_OPTION_FIELDS = frozenset({"include_path", "pre_include"}) + + +def _option_is_set(options: ProgramOptions, name: str) -> bool: + """Match how ``_program.pyx`` gates option emission, per field shape. + + - Boolean flags (``pch``): truthy only. + - str-or-sequence fields (``include_path``, ``pre_include``): ``str`` + (including empty) or a non-empty ``collections.abc.Sequence`` (list, + tuple, range, user subclass, ...); everything else (``False``, ``int``, + empty sequence, ``None``) is ignored by the compiler and must not + trigger a cache-time guard. + - Path/string-shaped fields (``create_pch``, ``time``, + ``fdevice_time_trace``, ``use_pch``, ``pch_dir``): ``is not None`` -- + the compiler emits ``--flag=`` for any non-None value, so + ``False`` / ``""`` / ``0`` must still count as set. + """ + value = getattr(options, name, None) + if value is None: + return False + if name in _BOOLEAN_OPTION_FIELDS: + return bool(value) + if name in _STR_OR_SEQUENCE_OPTION_FIELDS: + # Mirror ``_prepare_nvrtc_options_impl``: it checks ``isinstance(v, str)`` + # first, then ``is_sequence(v)`` (which is ``isinstance(v, Sequence)``). + # We therefore accept any ``collections.abc.Sequence`` (range, deque, + # user subclass, etc.), not just list/tuple. + if isinstance(value, str): + return True + if isinstance(value, collections.abc.Sequence): + return len(value) > 0 + return False + return True + + +def _hash_probe_failure(update: Callable[[str, bytes], None], label: str, exc: BaseException) -> None: + """Mix a probe failure into the digest under a stable, content-free label. + + Hashing only the exception's CLASS NAME (not its message) keeps the + digest stable across repeated calls within one process (e.g. NVVM's + loader reports different messages on first vs. cached-failure attempts) + AND across processes that hit the same failure mode. The + ``_probe_failed`` label differs from every backend's success label, so a + broken environment never collides with a working one -- the cache + "fails closed" between broken and working environments while staying + persistent within either. + """ + update(f"{label}_probe_failed", type(exc).__name__.encode()) + + +class _KeyBackend(abc.ABC): + """Strategy for deriving the cache key for one ``Program`` ``code_type``. + + Each subclass owns the backend-specific guard logic, code coercion, + option fingerprinting, name-expression handling, version probing, and + extra-payload hashing. The orchestrator :func:`make_program_cache_key` + validates the code_type / target_type pair, dispatches to the right + backend, and assembles the digest. + """ + + @abc.abstractmethod + def validate(self, options: ProgramOptions, target_type: str, extra_digest: bytes | None) -> None: + """Reject inputs the cache cannot key safely. + + Raises ``ValueError`` for options that have compile-time side + effects, options that pull in external file content the cache + can't observe, or any other backend-specific invariants. + """ + + def encode_code(self, code: object, code_type: str) -> bytes: + """Coerce ``code`` to bytes. Default rejects bytes-like input + (only NVVM accepts it; ``Program()`` does the same).""" + if isinstance(code, str): + return code.encode("utf-8") + if isinstance(code, (bytes, bytearray)): + raise TypeError( + f"code must be str for code_type={code_type!r}; bytes/bytearray are only accepted for code_type='nvvm'." + ) + raise TypeError(f"code must be str or bytes, got {type(code).__name__}") + + @abc.abstractmethod + def option_fingerprint(self, options: ProgramOptions, target_type: str) -> list[bytes]: + """Fingerprint of the ``ProgramOptions`` fields that reach the compiler.""" + + def encode_name_expressions(self, name_expressions: Sequence[Any]) -> tuple[bytes, ...] | None: # noqa: ARG002 + """Sorted, type-tagged name expressions, or ``None`` if the + backend does not consume them. + + ``None`` means the orchestrator emits no ``names_count`` / + ``name`` entries at all (a backend that ignores + ``name_expressions`` should never have them perturb its key). An + empty tuple means the backend supports them but the caller + passed none -- the orchestrator still emits ``names_count=0`` so + the schema is stable across "absent" and "empty". + """ + return None + + @abc.abstractmethod + def hash_version_probe(self, update: Callable[[str, bytes], None]) -> None: + """Mix the runtime/compiler version probe into the digest via + ``update(label, payload)``. On probe failure, mix + ``_hash_probe_failure(update, "